From: support Date: Fri, 8 Jul 2022 17:11:40 +0000 (+0000) Subject: Built motion from commit 6f058f2b.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;/%22avatar.png//%27?a=commitdiff_plain;h=5700004c41767de5192dcf7c263197b4ca1ef510;p=motion2.git Built motion from commit 6f058f2b.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 148e498..c84088e 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-07-08T15:38:16.667Z", + "time": "2022-07-08T17:03:09.769Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 76e23cb..7cb2ecb 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-08T15:38:16.667Z", + "time": "2022-07-08T17:03:09.769Z", "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 8ef1884..b7a5330 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 _0x0a30=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','sequelize','VIRTUAL','getDataValue','action','integration','jscripty','urlForward','browser','bot','script'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a30,0xaa));var _0x00a3=function(_0x52eb8f,_0x3fdd3e){_0x52eb8f=_0x52eb8f-0x0;var _0xbeac90=_0x0a30[_0x52eb8f];return _0xbeac90;};'use strict';var Sequelize=require(_0x00a3('0x0'));module['exports']={'name':{'type':Sequelize[_0x00a3('0x1')],'get':function(_0x52f39c){return this[_0x00a3('0x2')](_0x00a3('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x00a3('0x4'),'motionbar',_0x00a3('0x5'),_0x00a3('0x6'),_0x00a3('0x7'),_0x00a3('0x8'),_0x00a3('0x9')]],'msg':_0x00a3('0xa')}},'comment':_0x00a3('0xa')},'data1':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xc')},'data2':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xd')},'data3':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comment':_0x00a3('0xe')},'data4':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comments':_0x00a3('0xf')},'data5':{'type':Sequelize[_0x00a3('0xb')](0x1000),'comments':_0x00a3('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x00a3('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x4143=['VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[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]','TEXT','urlForward[body]','sequelize'];(function(_0x45f90f,_0x383cf4){var _0x2c5a5f=function(_0x53f5ac){while(--_0x53f5ac){_0x45f90f['push'](_0x45f90f['shift']());}};_0x2c5a5f(++_0x383cf4);}(_0x4143,0x167));var _0x3414=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x4143[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x3414('0x0'));module['exports']={'name':{'type':Sequelize[_0x3414('0x1')],'get':function(_0xab698d){return this[_0x3414('0x2')](_0x3414('0x3'));}},'action':{'type':Sequelize[_0x3414('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3414('0x5'),_0x3414('0x6'),_0x3414('0x7'),_0x3414('0x8'),_0x3414('0x9'),_0x3414('0xa'),_0x3414('0xb'),_0x3414('0xc')]],'msg':_0x3414('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x3414('0xe')},'data2':{'type':Sequelize[_0x3414('0x4')](0x1000),'comment':_0x3414('0xf')},'data3':{'type':Sequelize[_0x3414('0x4')](0x1000),'comment':_0x3414('0x10')},'data4':{'type':Sequelize[_0x3414('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3414('0x4')](0x1000),'comments':_0x3414('0x11')},'data6':{'type':Sequelize[_0x3414('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x3414('0x12')],'comments':_0x3414('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a53217f..43f81dd 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 _0x34e9=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','params','catch','destroy','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x34e9,0x167));var _0x934e=function(_0x1a130d,_0x2cb189){_0x1a130d=_0x1a130d-0x0;var _0xab6801=_0x34e9[_0x1a130d];return _0xab6801;};'use strict';var emlformat=require(_0x934e('0x0'));var rimraf=require(_0x934e('0x1'));var zipdir=require(_0x934e('0x2'));var jsonpatch=require(_0x934e('0x3'));var rp=require('request-promise');var moment=require(_0x934e('0x4'));var BPromise=require(_0x934e('0x5'));var Mustache=require(_0x934e('0x6'));var util=require(_0x934e('0x7'));var path=require(_0x934e('0x8'));var sox=require('sox');var csv=require(_0x934e('0x9'));var ejs=require(_0x934e('0xa'));var fs=require('fs');var fs_extra=require(_0x934e('0xb'));var _=require('lodash');var squel=require(_0x934e('0xc'));var crypto=require(_0x934e('0xd'));var jsforce=require(_0x934e('0xe'));var deskjs=require(_0x934e('0xf'));var toCsv=require(_0x934e('0x9'));var querystring=require('querystring');var Papa=require(_0x934e('0x10'));var Redis=require(_0x934e('0x11'));var authService=require(_0x934e('0x12'));var qs=require(_0x934e('0x13'));var as=require(_0x934e('0x14'));var hardwareService=require(_0x934e('0x15'));var logger=require(_0x934e('0x16'))(_0x934e('0x17'));var utils=require(_0x934e('0x18'));var config=require(_0x934e('0x19'));var licenseUtil=require(_0x934e('0x1a'));var db=require(_0x934e('0x1b'))['db'];function respondWithStatusCode(_0x5105be,_0x44b24f){_0x44b24f=_0x44b24f||0xcc;return function(_0x1cb98b){if(_0x1cb98b){return _0x5105be[_0x934e('0x1c')](_0x44b24f);}return _0x5105be['status'](_0x44b24f)[_0x934e('0x1d')]();};}function respondWithResult(_0xaa0389,_0x4d7ea2){_0x4d7ea2=_0x4d7ea2||0xc8;return function(_0x2800f1){if(_0x2800f1){return _0xaa0389[_0x934e('0x1e')](_0x4d7ea2)[_0x934e('0x1f')](_0x2800f1);}};}function respondWithFilteredResult(_0xecd785,_0x35ded2){return function(_0x13ff7a){if(_0x13ff7a){var _0x268fbe=typeof _0x35ded2[_0x934e('0x20')]===_0x934e('0x21')&&typeof _0x35ded2[_0x934e('0x22')]==='undefined';var _0x2e209b=_0x13ff7a[_0x934e('0x23')];var _0x5c1f4f=_0x268fbe?0x0:_0x35ded2[_0x934e('0x20')];var _0x28a4cd=_0x268fbe?_0x13ff7a[_0x934e('0x23')]:_0x35ded2[_0x934e('0x20')]+_0x35ded2[_0x934e('0x22')];var _0x3a79ce;if(_0x28a4cd>=_0x2e209b){_0x28a4cd=_0x2e209b;_0x3a79ce=0xc8;}else{_0x3a79ce=0xce;}_0xecd785[_0x934e('0x1e')](_0x3a79ce);return _0xecd785[_0x934e('0x24')](_0x934e('0x25'),_0x5c1f4f+'-'+_0x28a4cd+'/'+_0x2e209b)['json'](_0x13ff7a);}return null;};}function patchUpdates(_0x30443a){return function(_0x110d75){try{jsonpatch[_0x934e('0x26')](_0x110d75,_0x30443a,!![]);}catch(_0x54628a){return BPromise[_0x934e('0x27')](_0x54628a);}return _0x110d75[_0x934e('0x28')]();};}function saveUpdates(_0x50d966,_0x52cd5c){return function(_0x5cac08){if(_0x5cac08){return _0x5cac08[_0x934e('0x29')](_0x50d966)[_0x934e('0x2a')](function(_0x10f86d){return _0x10f86d;});}return null;};}function removeEntity(_0x4ea607,_0x439f16){return function(_0x5e17dd){if(_0x5e17dd){return _0x5e17dd['destroy']()[_0x934e('0x2a')](function(){_0x4ea607[_0x934e('0x1e')](0xcc)[_0x934e('0x1d')]();});}};}function handleEntityNotFound(_0x7b5a60,_0x58bc7e){return function(_0x14beb1){if(!_0x14beb1){_0x7b5a60[_0x934e('0x1c')](0x194);}return _0x14beb1;};}function handleError(_0x47d46c,_0x3a4622){_0x3a4622=_0x3a4622||0x1f4;return function(_0xc01d53){logger[_0x934e('0x2b')](_0xc01d53[_0x934e('0x2c')]);if(_0xc01d53[_0x934e('0x2d')]){delete _0xc01d53['name'];}_0x47d46c[_0x934e('0x1e')](_0x3a4622)[_0x934e('0x2e')](_0xc01d53);};}exports['update']=function(_0xe9ad0c,_0xe965a){if(_0xe9ad0c[_0x934e('0x2f')]['id']){delete _0xe9ad0c[_0x934e('0x2f')]['id'];}return db['Action'][_0x934e('0x30')]({'where':{'id':_0xe9ad0c[_0x934e('0x31')]['id']}})['then'](handleEntityNotFound(_0xe965a,null))[_0x934e('0x2a')](saveUpdates(_0xe9ad0c[_0x934e('0x2f')],null))[_0x934e('0x2a')](respondWithResult(_0xe965a,null))[_0x934e('0x32')](handleError(_0xe965a,null));};exports[_0x934e('0x33')]=function(_0x4bfb2a,_0x234680){return db[_0x934e('0x34')][_0x934e('0x30')]({'where':{'id':_0x4bfb2a[_0x934e('0x31')]['id']}})['then'](handleEntityNotFound(_0x234680,null))[_0x934e('0x2a')](removeEntity(_0x234680,null))[_0x934e('0x32')](handleError(_0x234680,null));}; \ No newline at end of file +var _0x386e=['stack','name','send','body','Action','params','catch','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','update','then','destroy','error'];(function(_0x43051f,_0x4a10a0){var _0x358fe1=function(_0x2e1ef9){while(--_0x2e1ef9){_0x43051f['push'](_0x43051f['shift']());}};_0x358fe1(++_0x4a10a0);}(_0x386e,0x128));var _0xe386=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0x386e[_0x937379];return _0x465709;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe386('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe386('0x1'));var rp=require(_0xe386('0x2'));var moment=require(_0xe386('0x3'));var BPromise=require(_0xe386('0x4'));var Mustache=require(_0xe386('0x5'));var util=require(_0xe386('0x6'));var path=require(_0xe386('0x7'));var sox=require(_0xe386('0x8'));var csv=require('to-csv');var ejs=require(_0xe386('0x9'));var fs=require('fs');var fs_extra=require(_0xe386('0xa'));var _=require(_0xe386('0xb'));var squel=require(_0xe386('0xc'));var crypto=require(_0xe386('0xd'));var jsforce=require(_0xe386('0xe'));var deskjs=require(_0xe386('0xf'));var toCsv=require(_0xe386('0x10'));var querystring=require('querystring');var Papa=require(_0xe386('0x11'));var Redis=require(_0xe386('0x12'));var authService=require(_0xe386('0x13'));var qs=require(_0xe386('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe386('0x15'))(_0xe386('0x16'));var utils=require('../../config/utils');var config=require(_0xe386('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe386('0x18'))['db'];function respondWithStatusCode(_0x4fc0b2,_0x47b8aa){_0x47b8aa=_0x47b8aa||0xcc;return function(_0xa9838d){if(_0xa9838d){return _0x4fc0b2[_0xe386('0x19')](_0x47b8aa);}return _0x4fc0b2[_0xe386('0x1a')](_0x47b8aa)[_0xe386('0x1b')]();};}function respondWithResult(_0x4f52c3,_0x334dc7){_0x334dc7=_0x334dc7||0xc8;return function(_0x433a04){if(_0x433a04){return _0x4f52c3[_0xe386('0x1a')](_0x334dc7)['json'](_0x433a04);}};}function respondWithFilteredResult(_0x8614a6,_0x3cd40f){return function(_0x1e0698){if(_0x1e0698){var _0x5d7267=typeof _0x3cd40f['offset']===_0xe386('0x1c')&&typeof _0x3cd40f[_0xe386('0x1d')]===_0xe386('0x1c');var _0x37753f=_0x1e0698['count'];var _0x4d65c5=_0x5d7267?0x0:_0x3cd40f[_0xe386('0x1e')];var _0x13fd3e=_0x5d7267?_0x1e0698[_0xe386('0x1f')]:_0x3cd40f['offset']+_0x3cd40f[_0xe386('0x1d')];var _0x56193b;if(_0x13fd3e>=_0x37753f){_0x13fd3e=_0x37753f;_0x56193b=0xc8;}else{_0x56193b=0xce;}_0x8614a6[_0xe386('0x1a')](_0x56193b);return _0x8614a6[_0xe386('0x20')](_0xe386('0x21'),_0x4d65c5+'-'+_0x13fd3e+'/'+_0x37753f)[_0xe386('0x22')](_0x1e0698);}return null;};}function patchUpdates(_0x457a7f){return function(_0x55d73b){try{jsonpatch[_0xe386('0x23')](_0x55d73b,_0x457a7f,!![]);}catch(_0x231fae){return BPromise['reject'](_0x231fae);}return _0x55d73b['save']();};}function saveUpdates(_0x138443,_0x56b89b){return function(_0x51cbc8){if(_0x51cbc8){return _0x51cbc8[_0xe386('0x24')](_0x138443)[_0xe386('0x25')](function(_0x2ad964){return _0x2ad964;});}return null;};}function removeEntity(_0x15988e,_0x12f6df){return function(_0x49a89c){if(_0x49a89c){return _0x49a89c[_0xe386('0x26')]()[_0xe386('0x25')](function(){_0x15988e[_0xe386('0x1a')](0xcc)[_0xe386('0x1b')]();});}};}function handleEntityNotFound(_0x5488bb,_0x3a7536){return function(_0x4b2ee3){if(!_0x4b2ee3){_0x5488bb['sendStatus'](0x194);}return _0x4b2ee3;};}function handleError(_0xd76430,_0x3c4e9a){_0x3c4e9a=_0x3c4e9a||0x1f4;return function(_0x292351){logger[_0xe386('0x27')](_0x292351[_0xe386('0x28')]);if(_0x292351[_0xe386('0x29')]){delete _0x292351[_0xe386('0x29')];}_0xd76430[_0xe386('0x1a')](_0x3c4e9a)[_0xe386('0x2a')](_0x292351);};}exports[_0xe386('0x24')]=function(_0x32708d,_0x2a49df){if(_0x32708d['body']['id']){delete _0x32708d[_0xe386('0x2b')]['id'];}return db[_0xe386('0x2c')]['find']({'where':{'id':_0x32708d[_0xe386('0x2d')]['id']}})[_0xe386('0x25')](handleEntityNotFound(_0x2a49df,null))[_0xe386('0x25')](saveUpdates(_0x32708d[_0xe386('0x2b')],null))[_0xe386('0x25')](respondWithResult(_0x2a49df,null))[_0xe386('0x2e')](handleError(_0x2a49df,null));};exports['destroy']=function(_0x385b28,_0xc2606e){return db[_0xe386('0x2c')][_0xe386('0x2f')]({'where':{'id':_0x385b28[_0xe386('0x2d')]['id']}})[_0xe386('0x25')](handleEntityNotFound(_0xc2606e,null))['then'](removeEntity(_0xc2606e,null))['catch'](handleError(_0xc2606e,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 39a0f12..b56e03d 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 _0x7f65=['Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./action.attributes','exports','define'];(function(_0x1e9c78,_0xc01460){var _0x2fc4c7=function(_0x58c08b){while(--_0x58c08b){_0x1e9c78['push'](_0x1e9c78['shift']());}};_0x2fc4c7(++_0xc01460);}(_0x7f65,0x91));var _0x57f6=function(_0x52c3de,_0x2b6bb4){_0x52c3de=_0x52c3de-0x0;var _0xed6378=_0x7f65[_0x52c3de];return _0xed6378;};'use strict';var _=require(_0x57f6('0x0'));var util=require(_0x57f6('0x1'));var logger=require(_0x57f6('0x2'))(_0x57f6('0x3'));var moment=require(_0x57f6('0x4'));var BPromise=require(_0x57f6('0x5'));var rp=require(_0x57f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x57f6('0x8'));module[_0x57f6('0x9')]=function(_0x5ba2bf,_0x2d19ae){return _0x5ba2bf[_0x57f6('0xa')](_0x57f6('0xb'),attributes,{'tableName':_0x57f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xade0=['exports','Action','tools_actions','lodash','util','../../config/logger','api','request-promise','path','./action.attributes'];(function(_0x3251e3,_0x2c3319){var _0x26af07=function(_0x2b816b){while(--_0x2b816b){_0x3251e3['push'](_0x3251e3['shift']());}};_0x26af07(++_0x2c3319);}(_0xade0,0xe9));var _0x0ade=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xade0[_0xb833b1];return _0x1ab87a;};'use strict';var _=require(_0x0ade('0x0'));var util=require(_0x0ade('0x1'));var logger=require(_0x0ade('0x2'))(_0x0ade('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ade('0x4'));var fs=require('fs');var path=require(_0x0ade('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ade('0x6'));module[_0x0ade('0x7')]=function(_0x36444a,_0x1a0c30){return _0x36444a['define'](_0x0ade('0x8'),attributes,{'tableName':_0x0ade('0x9'),'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 e199ee4..0acdd95 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x53ec,0x192));var _0xc53e=function(_0x17e4ac,_0x315ed6){_0x17e4ac=_0x17e4ac-0x0;var _0x7a9a6a=_0x53ec[_0x17e4ac];return _0x7a9a6a;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x55c5de,_0x4d5718){_0x55c5de=_0x55c5de-0x0;var _0x4b8db4=_0x7a54[_0x55c5de];return _0x4b8db4;};'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')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 14414be..5fb44cd 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 _0xae41=['/:id','destroy','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','update'];(function(_0x440fde,_0x445ce0){var _0x11052c=function(_0x49f547){while(--_0x49f547){_0x440fde['push'](_0x440fde['shift']());}};_0x11052c(++_0x445ce0);}(_0xae41,0xce));var _0x1ae4=function(_0x5bf1b0,_0x4755db){_0x5bf1b0=_0x5bf1b0-0x0;var _0x1fcdbc=_0xae41[_0x5bf1b0];return _0x1fcdbc;};'use strict';var multer=require('multer');var util=require(_0x1ae4('0x0'));var path=require(_0x1ae4('0x1'));var timeout=require(_0x1ae4('0x2'));var express=require(_0x1ae4('0x3'));var router=express['Router']();var fs_extra=require(_0x1ae4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1ae4('0x5'));var config=require(_0x1ae4('0x6'));var controller=require(_0x1ae4('0x7'));router[_0x1ae4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1ae4('0x9')]);router['delete'](_0x1ae4('0xa'),auth['isAuthenticated'](),controller[_0x1ae4('0xb')]);module['exports']=router; \ No newline at end of file +var _0x9eac=['isAuthenticated','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id'];(function(_0x30643a,_0x3851fc){var _0xacacb1=function(_0x543b63){while(--_0x543b63){_0x30643a['push'](_0x30643a['shift']());}};_0xacacb1(++_0x3851fc);}(_0x9eac,0x139));var _0xc9ea=function(_0x4cb272,_0x52c0e9){_0x4cb272=_0x4cb272-0x0;var _0x57b4aa=_0x9eac[_0x4cb272];return _0x57b4aa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc9ea('0x0'));var router=express['Router']();var fs_extra=require(_0xc9ea('0x1'));var auth=require(_0xc9ea('0x2'));var interaction=require(_0xc9ea('0x3'));var config=require('../../config/environment');var controller=require(_0xc9ea('0x4'));router[_0xc9ea('0x5')](_0xc9ea('0x6'),auth[_0xc9ea('0x7')](),controller['update']);router['delete'](_0xc9ea('0x6'),auth['isAuthenticated'](),controller[_0xc9ea('0x8')]);module[_0xc9ea('0x9')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index d3a0632..75dae95 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x2675,0x75));var _0x5267=function(_0x4c699c,_0x4cf981){_0x4c699c=_0x4c699c-0x0;var _0x50c0a8=_0x2675[_0x4c699c];return _0x50c0a8;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x43ff72,_0x1c6ac6){var _0x390ae1=function(_0x285031){while(--_0x285031){_0x43ff72['push'](_0x43ff72['shift']());}};_0x390ae1(++_0x1c6ac6);}(_0x6f47,0xc7));var _0x76f4=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6f47[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index bf2bf16..7dbae66 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 _0xc8f2=['join','right_join','COUNT(%s)','MAX(%s)','MIN(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','DESC','alias','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','SELECT','run','runReport','operator','ValidationErrorItem','metric','groupBy','Limited\x20Query:','rimraf','zip-dir','request-promise','moment','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','get','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','count','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','preview','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','options','getFields','Sequelize','select','table','MetricId','function','format','replace','orderBy','order','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes'];(function(_0x3b2421,_0xf30f91){var _0x288bde=function(_0x1d1db6){while(--_0x1d1db6){_0x3b2421['push'](_0x3b2421['shift']());}};_0x288bde(++_0xf30f91);}(_0xc8f2,0xc3));var _0x2c8f=function(_0x33089b,_0x5b755d){_0x33089b=_0x33089b-0x0;var _0x3299b9=_0xc8f2[_0x33089b];return _0x3299b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c8f('0x0'));var zipdir=require(_0x2c8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c8f('0x2'));var moment=require(_0x2c8f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c8f('0x4'));var util=require('util');var path=require(_0x2c8f('0x5'));var sox=require(_0x2c8f('0x6'));var csv=require(_0x2c8f('0x7'));var ejs=require(_0x2c8f('0x8'));var fs=require('fs');var fs_extra=require(_0x2c8f('0x9'));var _=require('lodash');var squel=require(_0x2c8f('0xa'));var crypto=require(_0x2c8f('0xb'));var jsforce=require(_0x2c8f('0xc'));var deskjs=require(_0x2c8f('0xd'));var toCsv=require(_0x2c8f('0x7'));var querystring=require('querystring');var Papa=require(_0x2c8f('0xe'));var Redis=require(_0x2c8f('0xf'));var authService=require(_0x2c8f('0x10'));var qs=require(_0x2c8f('0x11'));var as=require(_0x2c8f('0x12'));var hardwareService=require(_0x2c8f('0x13'));var logger=require('../../config/logger')(_0x2c8f('0x14'));var utils=require(_0x2c8f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2c8f('0x16'));var db=require(_0x2c8f('0x17'))['db'];var dbH=require(_0x2c8f('0x17'))[_0x2c8f('0x18')];function respondWithStatusCode(_0x45864c,_0x68f273){_0x68f273=_0x68f273||0xcc;return function(_0x1b8ded){if(_0x1b8ded){return _0x45864c[_0x2c8f('0x19')](_0x68f273);}return _0x45864c[_0x2c8f('0x1a')](_0x68f273)[_0x2c8f('0x1b')]();};}function respondWithResult(_0x3d0298,_0x3a70ba){_0x3a70ba=_0x3a70ba||0xc8;return function(_0x41de1c){if(_0x41de1c){return _0x3d0298[_0x2c8f('0x1a')](_0x3a70ba)[_0x2c8f('0x1c')](_0x41de1c);}};}function respondWithFilteredResult(_0x5150d3,_0x5c6252){return function(_0x41bb0a){if(_0x41bb0a){var _0x47080a=typeof _0x5c6252[_0x2c8f('0x1d')]===_0x2c8f('0x1e')&&typeof _0x5c6252[_0x2c8f('0x1f')]==='undefined';var _0x4eefd9=_0x41bb0a['count'];var _0x837d03=_0x47080a?0x0:_0x5c6252['offset'];var _0x571411=_0x47080a?_0x41bb0a['count']:_0x5c6252[_0x2c8f('0x1d')]+_0x5c6252[_0x2c8f('0x1f')];var _0x1bac03;if(_0x571411>=_0x4eefd9){_0x571411=_0x4eefd9;_0x1bac03=0xc8;}else{_0x1bac03=0xce;}_0x5150d3['status'](_0x1bac03);return _0x5150d3[_0x2c8f('0x20')]('Content-Range',_0x837d03+'-'+_0x571411+'/'+_0x4eefd9)[_0x2c8f('0x1c')](_0x41bb0a);}return null;};}function patchUpdates(_0x926143){return function(_0x222400){try{jsonpatch[_0x2c8f('0x21')](_0x222400,_0x926143,!![]);}catch(_0x1b5f77){return BPromise[_0x2c8f('0x22')](_0x1b5f77);}return _0x222400['save']();};}function saveUpdates(_0x562cdb,_0x1600ce){return function(_0x3e1b59){if(_0x3e1b59){return _0x3e1b59['update'](_0x562cdb)[_0x2c8f('0x23')](function(_0x2b83e1){return _0x2b83e1;});}return null;};}function removeEntity(_0x276bdb,_0x50d3d8){return function(_0x1930ce){if(_0x1930ce){return _0x1930ce['destroy']()[_0x2c8f('0x23')](function(){var _0x106737=_0x1930ce[_0x2c8f('0x24')]({'plain':!![]});var _0x5f4b92='CustomReports';return db[_0x2c8f('0x25')]['destroy']({'where':{'type':_0x5f4b92,'resourceId':_0x106737['id']}})[_0x2c8f('0x23')](function(){return _0x1930ce;});})['then'](function(){_0x276bdb['status'](0xcc)[_0x2c8f('0x1b')]();});}};}function handleEntityNotFound(_0x92f7fd,_0x1c83b8){return function(_0x474755){if(!_0x474755){_0x92f7fd['sendStatus'](0x194);}return _0x474755;};}function handleError(_0x224f80,_0x2aac35){_0x2aac35=_0x2aac35||0x1f4;return function(_0x56215b){logger[_0x2c8f('0x26')](_0x56215b[_0x2c8f('0x27')]);if(_0x56215b[_0x2c8f('0x28')]){delete _0x56215b['name'];}_0x224f80[_0x2c8f('0x1a')](_0x2aac35)['send'](_0x56215b);};}exports[_0x2c8f('0x29')]=function(_0x3de2ab,_0x28656b){var _0x16ab0a={},_0x793710={},_0x274df2={'count':0x0,'rows':[]};var _0x152733=_[_0x2c8f('0x2a')](db[_0x2c8f('0x2b')][_0x2c8f('0x2c')],function(_0x3e4f17){return{'name':_0x3e4f17[_0x2c8f('0x2d')],'type':_0x3e4f17[_0x2c8f('0x2e')][_0x2c8f('0x2f')]};});_0x793710['model']=_['map'](_0x152733,_0x2c8f('0x28'));_0x793710[_0x2c8f('0x30')]=_['keys'](_0x3de2ab[_0x2c8f('0x30')]);_0x793710[_0x2c8f('0x31')]=_['intersection'](_0x793710[_0x2c8f('0x32')],_0x793710[_0x2c8f('0x30')]);_0x16ab0a['attributes']=_['intersection'](_0x793710['model'],qs[_0x2c8f('0x33')](_0x3de2ab['query'][_0x2c8f('0x33')]));_0x16ab0a['attributes']=_0x16ab0a[_0x2c8f('0x34')][_0x2c8f('0x35')]?_0x16ab0a[_0x2c8f('0x34')]:_0x793710[_0x2c8f('0x32')];if(!_0x3de2ab['query'][_0x2c8f('0x36')](_0x2c8f('0x37'))){_0x16ab0a[_0x2c8f('0x1f')]=qs[_0x2c8f('0x1f')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x1f')]);_0x16ab0a[_0x2c8f('0x1d')]=qs[_0x2c8f('0x1d')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x1d')]);}_0x16ab0a['order']=qs[_0x2c8f('0x38')](_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x38')]);_0x16ab0a[_0x2c8f('0x39')]=qs[_0x2c8f('0x31')](_['pick'](_0x3de2ab['query'],_0x793710['filters']),_0x152733);if(_0x3de2ab[_0x2c8f('0x30')]['filter']){_0x16ab0a[_0x2c8f('0x39')]=_[_0x2c8f('0x3a')](_0x16ab0a[_0x2c8f('0x39')],{'$or':_['map'](_0x152733,function(_0x14374d){if(_0x14374d[_0x2c8f('0x2e')]!==_0x2c8f('0x3b')){var _0x1b7de4={};_0x1b7de4[_0x14374d['name']]={'$like':'%'+_0x3de2ab[_0x2c8f('0x30')][_0x2c8f('0x3c')]+'%'};return _0x1b7de4;}})});}_0x16ab0a=_['merge']({},_0x16ab0a,_0x3de2ab['options']);var _0x1a8971={'where':_0x16ab0a[_0x2c8f('0x39')]};return db[_0x2c8f('0x2b')][_0x2c8f('0x3d')](_0x1a8971)[_0x2c8f('0x23')](function(_0x19b18c){_0x274df2[_0x2c8f('0x3d')]=_0x19b18c;if(_0x3de2ab['query'][_0x2c8f('0x3e')]){_0x16ab0a['include']=[{'all':!![]}];}return db[_0x2c8f('0x2b')][_0x2c8f('0x3f')](_0x16ab0a);})['then'](function(_0x4ca9b1){_0x274df2[_0x2c8f('0x40')]=_0x4ca9b1;return _0x274df2;})[_0x2c8f('0x23')](respondWithFilteredResult(_0x28656b,_0x16ab0a))[_0x2c8f('0x41')](handleError(_0x28656b,null));};exports[_0x2c8f('0x42')]=function(_0x465100,_0x385574){var _0x920042={'raw':![],'where':{'id':_0x465100[_0x2c8f('0x43')]['id']}},_0x2b110b={};_0x2b110b[_0x2c8f('0x32')]=_[_0x2c8f('0x44')](db[_0x2c8f('0x2b')][_0x2c8f('0x2c')]);_0x2b110b[_0x2c8f('0x30')]=_['keys'](_0x465100[_0x2c8f('0x30')]);_0x2b110b[_0x2c8f('0x31')]=_[_0x2c8f('0x45')](_0x2b110b[_0x2c8f('0x32')],_0x2b110b[_0x2c8f('0x30')]);_0x920042[_0x2c8f('0x34')]=_[_0x2c8f('0x45')](_0x2b110b[_0x2c8f('0x32')],qs[_0x2c8f('0x33')](_0x465100['query']['fields']));_0x920042[_0x2c8f('0x34')]=_0x920042[_0x2c8f('0x34')][_0x2c8f('0x35')]?_0x920042['attributes']:_0x2b110b[_0x2c8f('0x32')];if(_0x465100[_0x2c8f('0x30')][_0x2c8f('0x3e')]){_0x920042[_0x2c8f('0x46')]=[{'all':!![]}];}_0x920042=_['merge']({},_0x920042,_0x465100['options']);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x920042)[_0x2c8f('0x23')](handleEntityNotFound(_0x385574,null))[_0x2c8f('0x23')](respondWithResult(_0x385574,null))['catch'](handleError(_0x385574,null));};exports[_0x2c8f('0x48')]=function(_0x154da4,_0x25f2ed){return db[_0x2c8f('0x2b')][_0x2c8f('0x48')](_0x154da4[_0x2c8f('0x49')],{})['then'](function(_0x2c6cea){var _0x344a23=_0x154da4[_0x2c8f('0x4a')]['get']({'plain':!![]});if(!_0x344a23)throw new Error(_0x2c8f('0x4b'));if(_0x344a23['role']==='user'){var _0x287ec1=_0x2c6cea['get']({'plain':!![]});var _0x52cb52=_0x2c8f('0x4c');return db[_0x2c8f('0x4d')][_0x2c8f('0x47')]({'where':{'name':_0x52cb52,'userProfileId':_0x344a23[_0x2c8f('0x4e')]},'raw':!![]})[_0x2c8f('0x23')](function(_0x1e826e){if(_0x1e826e&&_0x1e826e['autoAssociation']===0x0){return db[_0x2c8f('0x25')][_0x2c8f('0x48')]({'name':_0x287ec1[_0x2c8f('0x28')],'resourceId':_0x287ec1['id'],'type':'CustomReports','sectionId':_0x1e826e['id']},{})[_0x2c8f('0x23')](function(){return _0x2c6cea;});}else{return _0x2c6cea;}})[_0x2c8f('0x41')](function(_0xbcfb9c){logger['error'](_0x2c8f('0x4f'),_0xbcfb9c);throw _0xbcfb9c;});}return _0x2c6cea;})['then'](respondWithResult(_0x25f2ed,0xc9))[_0x2c8f('0x41')](handleError(_0x25f2ed,null));};exports[_0x2c8f('0x50')]=function(_0x427dbe,_0x596d9d){if(_0x427dbe[_0x2c8f('0x49')]['id']){delete _0x427dbe[_0x2c8f('0x49')]['id'];}return db[_0x2c8f('0x2b')][_0x2c8f('0x47')]({'where':{'id':_0x427dbe[_0x2c8f('0x43')]['id']}})['then'](handleEntityNotFound(_0x596d9d,null))[_0x2c8f('0x23')](saveUpdates(_0x427dbe[_0x2c8f('0x49')],null))[_0x2c8f('0x23')](respondWithResult(_0x596d9d,null))[_0x2c8f('0x41')](handleError(_0x596d9d,null));};exports[_0x2c8f('0x51')]=function(_0x1f6978,_0x562269){return db[_0x2c8f('0x2b')][_0x2c8f('0x47')]({'where':{'id':_0x1f6978[_0x2c8f('0x43')]['id']}})['then'](handleEntityNotFound(_0x562269,null))[_0x2c8f('0x23')](removeEntity(_0x562269,null))[_0x2c8f('0x41')](handleError(_0x562269,null));};exports[_0x2c8f('0x52')]=function(_0x41082c,_0x3efad4){var _0x1007a1=0xa;var _0x8c69d4=['join',_0x2c8f('0x53'),'right_join',_0x2c8f('0x54')];var _0x2834f3={'SUM':_0x2c8f('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2c8f('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0x175ca3={'SEC_TO_TIME':_0x2c8f('0x5b'),'DATE':_0x2c8f('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x2c8f('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfca46a=function(_0x5409a0){return!_[_0x2c8f('0x5e')]([_0x2c8f('0x5f'),_0x2c8f('0x60'),_0x2c8f('0x61'),_0x2c8f('0x62')],_0x5409a0);};var _0xe12fb=function(_0x42c459){if(!_0x42c459||!_0x42c459[_0x2c8f('0x63')][_0x2c8f('0x35')]){return'';}for(var _0xb45ccb='(',_0x3f3295=0x0;_0x3f3295<_0x42c459[_0x2c8f('0x63')]['length'];_0x3f3295+=0x1){_0x3f3295>0x0&&(_0xb45ccb+='\x20'+_0x42c459['operator']+'\x20');_0xb45ccb+=_0x42c459['rules'][_0x3f3295][_0x2c8f('0x64')]?_0xe12fb(_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x64')]):_0x42c459['rules'][_0x3f3295][_0x2c8f('0x65')]+'\x20'+_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x66')]+(_0xfca46a(_0x42c459[_0x2c8f('0x63')][_0x3f3295][_0x2c8f('0x66')])?'\x20'+_0x42c459['rules'][_0x3f3295][_0x2c8f('0x67')]:'');}return _0xb45ccb+')';};var _0x580874={'where':{'id':_0x41082c[_0x2c8f('0x43')]['id']}},_0x77e2f1,_0x5ed789,_0x3ec447,_0x517292,_0x552dac;_0x580874=_[_0x2c8f('0x3a')]({},_0x580874,_0x41082c[_0x2c8f('0x68')]);return db['AnalyticCustomReport']['find'](_0x580874)['then'](function(_0x1d04a0){if(_0x1d04a0){_0x77e2f1=_0x1d04a0;return _0x1d04a0[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0x37e113){if(_0x37e113){if(!_0x37e113['length']){throw new db[(_0x2c8f('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ed789=_0x37e113;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x2ef4c2){if(_0x2ef4c2){_0x3ec447=_['keyBy'](_0x2ef4c2,'id');var _0x18b8c1;var _0x5abde5=squel[_0x2c8f('0x6b')]();_0x5abde5['from'](_0x77e2f1[_0x2c8f('0x6c')]);for(var _0x562cfe=0x0;_0x562cfe<_0x5ed789['length'];_0x562cfe+=0x1){_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6d')]?_0x3ec447[_0x5ed789[_0x562cfe]['MetricId']]['metric']:_0x5ed789[_0x562cfe]['field'];_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6e')]?_['replace'](_0x2834f3[_0x5ed789[_0x562cfe][_0x2c8f('0x6e')]],'%s',_0x18b8c1):_0x18b8c1;_0x18b8c1=_0x5ed789[_0x562cfe][_0x2c8f('0x6f')]?_[_0x2c8f('0x70')](_0x175ca3[_0x5ed789[_0x562cfe][_0x2c8f('0x6f')]],'%s',_0x18b8c1):_0x18b8c1;if(_0x5ed789[_0x562cfe]['groupBy']){_0x5abde5[_0x2c8f('0x64')](_0x18b8c1);}_0x5ed789[_0x562cfe][_0x2c8f('0x71')]&&_0x5abde5[_0x2c8f('0x72')](_0x18b8c1,_0x5ed789[_0x562cfe][_0x2c8f('0x71')]==='DESC'?![]:!![]);_0x5abde5[_0x2c8f('0x65')](_0x18b8c1,_0x5ed789[_0x562cfe]['alias']||_0x18b8c1);}if(_0x77e2f1[_0x2c8f('0x73')]){_0x77e2f1[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x77e2f1[_0x2c8f('0x73')]);for(var _0xb6bb81=0x0;_0xb6bb81<_0x77e2f1['joins'][_0x2c8f('0x35')];_0xb6bb81+=0x1){if(_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x2e')]&&_[_0x2c8f('0x5e')](_0x8c69d4,_0x77e2f1['joins'][_0xb6bb81]['type'])&&_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x75')]&&_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x76')]&&_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x77')]){_0x5abde5[_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x2e')]](_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81]['foreignTable'],null,util[_0x2c8f('0x6f')](_0x2c8f('0x78'),_0x77e2f1['table'],_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81][_0x2c8f('0x75')],_0x77e2f1[_0x2c8f('0x73')][_0xb6bb81]['foreignTable'],_0x77e2f1['joins'][_0xb6bb81][_0x2c8f('0x77')]));}}}if(_0x77e2f1['conditions']){_0x77e2f1['conditions']=JSON[_0x2c8f('0x74')](_0x77e2f1['conditions']);_0x5abde5[_0x2c8f('0x39')](_0xe12fb(_0x77e2f1[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x552dac=_0x5abde5[_0x2c8f('0x7a')]();_0x5abde5['limit'](_0x1007a1);_0x5abde5[_0x2c8f('0x1d')](0x0);logger[_0x2c8f('0x7b')]('Limited\x20Query:',_0x5abde5[_0x2c8f('0x7c')]());return dbH[_0x2c8f('0x7d')][_0x2c8f('0x30')](_0x5abde5[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')][_0x2c8f('0x7e')]['SELECT']});}})[_0x2c8f('0x23')](respondWithResult(_0x3efad4,null))[_0x2c8f('0x41')](handleError(_0x3efad4,null));};function runReport(_0x4a3ae1,_0x30af09,_0x1d4706){var _0x1e5b47=_0x30af09[_0x2c8f('0x28')];var _0x177be1=0xa;var _0x517b64=[_0x2c8f('0x7f'),'left_join',_0x2c8f('0x80'),_0x2c8f('0x54')];var _0x292e0c={'SUM':_0x2c8f('0x55'),'COUNT':_0x2c8f('0x81'),'COUNT DISTINCT':_0x2c8f('0x56'),'MAX':_0x2c8f('0x82'),'MIN':_0x2c8f('0x83'),'AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0x434f87={'SEC_TO_TIME':_0x2c8f('0x5b'),'DATE':'DATE(%s)','HOUR':_0x2c8f('0x84'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2c8f('0x85')};var _0x55e0aa=function(_0x43819b){return!_[_0x2c8f('0x5e')]([_0x2c8f('0x5f'),_0x2c8f('0x60'),_0x2c8f('0x61'),'IS\x20NOT\x20EMPTY'],_0x43819b);};var _0x5aab29=function(_0x4e5094){if(!_0x4e5094||!_0x4e5094[_0x2c8f('0x63')][_0x2c8f('0x35')]){return'';}for(var _0x390ee6='(',_0x161311=0x0;_0x161311<_0x4e5094[_0x2c8f('0x63')][_0x2c8f('0x35')];_0x161311+=0x1){_0x161311>0x0&&(_0x390ee6+='\x20'+_0x4e5094['operator']+'\x20');_0x390ee6+=_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x64')]?_0x5aab29(_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x64')]):_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x65')]+'\x20'+_0x4e5094['rules'][_0x161311][_0x2c8f('0x66')]+(_0x55e0aa(_0x4e5094['rules'][_0x161311]['condition'])?'\x20'+_0x4e5094[_0x2c8f('0x63')][_0x161311][_0x2c8f('0x67')]:'');}return _0x390ee6+')';};var _0x1f9721={'where':{'id':_0x4a3ae1['id']}},_0x2d08b3,_0x159eb5,_0x54d8d1,_0x56e696,_0x130906;_0x1f9721=_['merge']({},_0x1f9721,_0x1d4706);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x1f9721)[_0x2c8f('0x23')](function(_0x2ede28){if(_0x2ede28){_0x2d08b3=_0x2ede28;return _0x2ede28[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0x3cac24){if(_0x3cac24){if(!_0x3cac24[_0x2c8f('0x35')]){throw new db[(_0x2c8f('0x6a'))]['ValidationErrorItem'](_0x2c8f('0x86'),0x193);}_0x159eb5=_0x3cac24;return db[_0x2c8f('0x87')]['findAll']({'raw':!![]});}return null;})[_0x2c8f('0x23')](function(_0x15828c){if(_0x15828c){_0x54d8d1=_[_0x2c8f('0x88')](_0x15828c,'id');var _0x51ac40;var _0x280b1f=squel[_0x2c8f('0x6b')]();_0x280b1f[_0x2c8f('0x89')](_0x2d08b3[_0x2c8f('0x6c')]);for(var _0x12f950=0x0;_0x12f950<_0x159eb5['length'];_0x12f950+=0x1){_0x51ac40=_0x159eb5[_0x12f950][_0x2c8f('0x6d')]?_0x54d8d1[_0x159eb5[_0x12f950][_0x2c8f('0x6d')]]['metric']:_0x159eb5[_0x12f950][_0x2c8f('0x65')];_0x51ac40=_0x159eb5[_0x12f950][_0x2c8f('0x6e')]?_['replace'](_0x292e0c[_0x159eb5[_0x12f950]['function']],'%s',_0x51ac40):_0x51ac40;_0x51ac40=_0x159eb5[_0x12f950]['format']?_[_0x2c8f('0x70')](_0x434f87[_0x159eb5[_0x12f950][_0x2c8f('0x6f')]],'%s',_0x51ac40):_0x51ac40;if(_0x159eb5[_0x12f950]['groupBy']){_0x280b1f[_0x2c8f('0x64')](_0x51ac40);}_0x159eb5[_0x12f950]['orderBy']&&_0x280b1f[_0x2c8f('0x72')](_0x51ac40,_0x159eb5[_0x12f950][_0x2c8f('0x71')]===_0x2c8f('0x8a')?![]:!![]);_0x280b1f['field'](_0x51ac40,_0x159eb5[_0x12f950][_0x2c8f('0x8b')]||_0x51ac40);}if(_0x2d08b3[_0x2c8f('0x73')]){_0x2d08b3[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x2d08b3['joins']);for(var _0x2a2897=0x0;_0x2a2897<_0x2d08b3['joins'][_0x2c8f('0x35')];_0x2a2897+=0x1){if(_0x2d08b3['joins'][_0x2a2897]['type']&&_[_0x2c8f('0x5e')](_0x517b64,_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x2e')])&&_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x75')]&&_0x2d08b3[_0x2c8f('0x73')][_0x2a2897]['foreignTable']&&_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x77')]){_0x280b1f[_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x2e')]](_0x2d08b3[_0x2c8f('0x73')][_0x2a2897]['foreignTable'],null,util[_0x2c8f('0x6f')]('%s.%s\x20=\x20%s.%s',_0x2d08b3[_0x2c8f('0x6c')],_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x75')],_0x2d08b3['joins'][_0x2a2897][_0x2c8f('0x76')],_0x2d08b3[_0x2c8f('0x73')][_0x2a2897][_0x2c8f('0x77')]));}}}if(_0x2d08b3[_0x2c8f('0x79')]){_0x2d08b3['conditions']=JSON['parse'](_0x2d08b3[_0x2c8f('0x79')]);_0x280b1f[_0x2c8f('0x39')](_0x5aab29(_0x2d08b3[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x130906=_0x280b1f[_0x2c8f('0x7a')]();_0x280b1f['limit'](_0x177be1);_0x280b1f[_0x2c8f('0x1d')](0x0);return;}})[_0x2c8f('0x23')](function(){if(_0x30af09[_0x2c8f('0x8c')]===_0x2c8f('0x8d')){return null;}var _0x350e7f=_[_0x2c8f('0x3a')](_0x30af09,{'name':_0x30af09[_0x2c8f('0x8e')]||_0x30af09['name']||_0x2d08b3[_0x2c8f('0x28')],'basename':_0x1e5b47,'savename':util['format']('%s-%s.%s',_0x30af09['name']||_0x2d08b3[_0x2c8f('0x28')],require(_0x2c8f('0x8f'))[_0x2c8f('0x90')](0x4),_0x30af09[_0x2c8f('0x8c')]||_0x2c8f('0x91')),'reportId':_0x2d08b3['id'],'reportType':'custom'});return db[_0x2c8f('0x92')]['create'](_0x350e7f,{'raw':!![]});})[_0x2c8f('0x23')](function(_0x1f9a9d){if(_0x2d08b3[_0x2c8f('0x6c')]==='cdr'){_0x130906['where'](_0x2d08b3[_0x2c8f('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x30af09[_0x2c8f('0x93')],_0x30af09[_0x2c8f('0x94')]);}else{_0x130906['where'](_0x2d08b3[_0x2c8f('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30af09[_0x2c8f('0x93')],_0x30af09[_0x2c8f('0x94')]);}if(_0x1f9a9d){logger[_0x2c8f('0x95')](_0x2c8f('0x96'),_0x130906[_0x2c8f('0x7c')]());require(_0x2c8f('0x97'))['fork'](path['join'](__dirname,_0x2c8f('0x98'),_0x1f9a9d[_0x2c8f('0x8c')]),[_0x1f9a9d['id'],_0x130906[_0x2c8f('0x7c')](),path['join'](__dirname,'../../files/reports',_0x1f9a9d['savename']),_0x1e5b47]);return _0x1f9a9d;}else{var _0xea96c1=squel[_0x2c8f('0x6b')]();_0xea96c1[_0x2c8f('0x89')]('('+_0x130906['toString']()+')','countTable');_0xea96c1['field']('COUNT(*)','count');_0x130906[_0x2c8f('0x1f')](_0x30af09[_0x2c8f('0x1f')]||_0x177be1);_0x130906['offset'](_0x30af09[_0x2c8f('0x1d')]||0x0);return dbH[_0x2c8f('0x7d')]['query'](_0xea96c1[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')]['QueryTypes'][_0x2c8f('0x99')]})[_0x2c8f('0x23')](function(_0x1649c4){if(!_0x1649c4[_0x2c8f('0x35')]){_0x56e696=0x0;}else{_0x56e696=_0x1649c4[0x0][_0x2c8f('0x3d')]||0x0;}return dbH[_0x2c8f('0x7d')]['query'](_0x130906[_0x2c8f('0x7c')](),{'type':dbH[_0x2c8f('0x7d')][_0x2c8f('0x7e')][_0x2c8f('0x99')]});})['then'](function(_0x24d49e){return{'rows':_0x24d49e||[],'count':_0x56e696};});}});}exports[_0x2c8f('0x9a')]=function(_0x1dbd27,_0x53235b){return runReport(_0x1dbd27[_0x2c8f('0x43')],_0x1dbd27[_0x2c8f('0x30')],_0x1dbd27[_0x2c8f('0x68')])['then'](respondWithResult(_0x53235b,null))['catch'](handleError(_0x53235b,null));};exports[_0x2c8f('0x9b')]=runReport;exports[_0x2c8f('0x30')]=function(_0x564615,_0x211e56){var _0x3f3bbe=0xa;var _0x1a637a=['join','left_join',_0x2c8f('0x80'),_0x2c8f('0x54')];var _0x178657={'SUM':_0x2c8f('0x55'),'COUNT':_0x2c8f('0x81'),'COUNT DISTINCT':_0x2c8f('0x56'),'MAX':_0x2c8f('0x82'),'MIN':_0x2c8f('0x83'),'AVG':_0x2c8f('0x57'),'GROUP_CONCAT':_0x2c8f('0x58'),'GROUP_CONCAT ASC':_0x2c8f('0x59'),'GROUP_CONCAT DESC':_0x2c8f('0x5a')};var _0xbc9c76={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2c8f('0x5c'),'HOUR':_0x2c8f('0x84'),'ROUND':_0x2c8f('0x5d'),'UNIX_TIMESTAMP':_0x2c8f('0x85')};var _0x30da1d=function(_0x5422fb){return!_[_0x2c8f('0x5e')](['IS\x20NULL',_0x2c8f('0x60'),'IS\x20EMPTY',_0x2c8f('0x62')],_0x5422fb);};var _0xa76f0d=function(_0xe6e4a8){if(!_0xe6e4a8||!_0xe6e4a8['rules'][_0x2c8f('0x35')]){return'';}for(var _0x1e685f='(',_0x4c53dc=0x0;_0x4c53dc<_0xe6e4a8[_0x2c8f('0x63')]['length'];_0x4c53dc+=0x1){_0x4c53dc>0x0&&(_0x1e685f+='\x20'+_0xe6e4a8[_0x2c8f('0x9c')]+'\x20');_0x1e685f+=_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc]['group']?_0xa76f0d(_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x64')]):_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x65')]+'\x20'+_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x66')]+(_0x30da1d(_0xe6e4a8[_0x2c8f('0x63')][_0x4c53dc][_0x2c8f('0x66')])?'\x20'+_0xe6e4a8['rules'][_0x4c53dc]['value']:'');}return _0x1e685f+')';};var _0x5abc9c={'where':{'id':_0x564615[_0x2c8f('0x43')]['id']}},_0x4ace06,_0x4c5bd8,_0x22008d,_0x53bebd,_0x1795b0;_0x5abc9c=_[_0x2c8f('0x3a')]({},_0x5abc9c,_0x564615['options']);return db[_0x2c8f('0x2b')][_0x2c8f('0x47')](_0x5abc9c)[_0x2c8f('0x23')](function(_0x3a8832){if(_0x3a8832){_0x4ace06=_0x3a8832;return _0x3a8832[_0x2c8f('0x69')]();}return null;})[_0x2c8f('0x23')](function(_0xc539a0){if(_0xc539a0){if(!_0xc539a0['length']){throw new db['Sequelize'][(_0x2c8f('0x9d'))](_0x2c8f('0x86'),0x193);}_0x4c5bd8=_0xc539a0;return db[_0x2c8f('0x87')][_0x2c8f('0x3f')]({'raw':!![]});}return null;})[_0x2c8f('0x23')](function(_0xa9273b){if(_0xa9273b){_0x22008d=_['keyBy'](_0xa9273b,'id');var _0x2d3730;var _0x298143=squel[_0x2c8f('0x6b')]();_0x298143[_0x2c8f('0x89')](_0x4ace06[_0x2c8f('0x6c')]);for(var _0x5411e1=0x0;_0x5411e1<_0x4c5bd8[_0x2c8f('0x35')];_0x5411e1+=0x1){_0x2d3730=_0x4c5bd8[_0x5411e1][_0x2c8f('0x6d')]?_0x22008d[_0x4c5bd8[_0x5411e1][_0x2c8f('0x6d')]][_0x2c8f('0x9e')]:_0x4c5bd8[_0x5411e1][_0x2c8f('0x65')];_0x2d3730=_0x4c5bd8[_0x5411e1]['function']?_[_0x2c8f('0x70')](_0x178657[_0x4c5bd8[_0x5411e1][_0x2c8f('0x6e')]],'%s',_0x2d3730):_0x2d3730;_0x2d3730=_0x4c5bd8[_0x5411e1][_0x2c8f('0x6f')]?_['replace'](_0xbc9c76[_0x4c5bd8[_0x5411e1]['format']],'%s',_0x2d3730):_0x2d3730;if(_0x4c5bd8[_0x5411e1][_0x2c8f('0x9f')]){_0x298143[_0x2c8f('0x64')](_0x2d3730);}_0x4c5bd8[_0x5411e1]['orderBy']&&_0x298143[_0x2c8f('0x72')](_0x2d3730,_0x4c5bd8[_0x5411e1][_0x2c8f('0x71')]===_0x2c8f('0x8a')?![]:!![]);_0x298143['field'](_0x2d3730,_0x4c5bd8[_0x5411e1][_0x2c8f('0x8b')]||_0x2d3730);}if(_0x4ace06[_0x2c8f('0x73')]){_0x4ace06[_0x2c8f('0x73')]=JSON[_0x2c8f('0x74')](_0x4ace06[_0x2c8f('0x73')]);for(var _0x1bfd93=0x0;_0x1bfd93<_0x4ace06[_0x2c8f('0x73')][_0x2c8f('0x35')];_0x1bfd93+=0x1){if(_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x2e')]&&_[_0x2c8f('0x5e')](_0x1a637a,_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x2e')])&&_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x75')]&&_0x4ace06[_0x2c8f('0x73')][_0x1bfd93]['foreignTable']&&_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x77')]){_0x298143[_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x2e')]](_0x4ace06['joins'][_0x1bfd93][_0x2c8f('0x76')],null,util['format'](_0x2c8f('0x78'),_0x4ace06['table'],_0x4ace06['joins'][_0x1bfd93]['parentKey'],_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x76')],_0x4ace06[_0x2c8f('0x73')][_0x1bfd93][_0x2c8f('0x77')]));}}}if(_0x4ace06[_0x2c8f('0x79')]){_0x4ace06['conditions']=JSON[_0x2c8f('0x74')](_0x4ace06['conditions']);_0x298143[_0x2c8f('0x39')](_0xa76f0d(_0x4ace06[_0x2c8f('0x79')][_0x2c8f('0x64')]));}_0x1795b0=_0x298143['clone']();_0x298143['limit'](_0x3f3bbe);_0x298143[_0x2c8f('0x1d')](0x0);logger['debug'](_0x2c8f('0xa0'),_0x298143[_0x2c8f('0x7c')]());return dbH[_0x2c8f('0x7d')][_0x2c8f('0x30')](_0x298143[_0x2c8f('0x7c')](),{'type':dbH['sequelize'][_0x2c8f('0x7e')][_0x2c8f('0x99')]});}})['then'](function(){return{'sql':_0x1795b0[_0x2c8f('0x7c')]()};})[_0x2c8f('0x23')](respondWithResult(_0x211e56,null))[_0x2c8f('0x41')](handleError(_0x211e56,null));}; \ No newline at end of file +var _0xaef8=['output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','left_join','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/environment','dbH','sendStatus','end','status','json','limit','count','Content-Range','apply','reject','update','then','destroy','get','CustomReports','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','preview','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','field','replace','format','groupBy','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','MAX(%s)','SEC_TO_TIME(%s)','DATE(%s)','IS\x20NULL','function','web','fullPath','randomstring','generate'];(function(_0x4c2bd1,_0x13ef1b){var _0x3f05fb=function(_0x597773){while(--_0x597773){_0x4c2bd1['push'](_0x4c2bd1['shift']());}};_0x3f05fb(++_0x13ef1b);}(_0xaef8,0xb7));var _0x8aef=function(_0x5b5c45,_0x199467){_0x5b5c45=_0x5b5c45-0x0;var _0x2cd0dd=_0xaef8[_0x5b5c45];return _0x2cd0dd;};'use strict';var emlformat=require(_0x8aef('0x0'));var rimraf=require(_0x8aef('0x1'));var zipdir=require(_0x8aef('0x2'));var jsonpatch=require(_0x8aef('0x3'));var rp=require('request-promise');var moment=require(_0x8aef('0x4'));var BPromise=require(_0x8aef('0x5'));var Mustache=require(_0x8aef('0x6'));var util=require('util');var path=require(_0x8aef('0x7'));var sox=require(_0x8aef('0x8'));var csv=require(_0x8aef('0x9'));var ejs=require(_0x8aef('0xa'));var fs=require('fs');var fs_extra=require(_0x8aef('0xb'));var _=require('lodash');var squel=require(_0x8aef('0xc'));var crypto=require(_0x8aef('0xd'));var jsforce=require(_0x8aef('0xe'));var deskjs=require(_0x8aef('0xf'));var toCsv=require(_0x8aef('0x9'));var querystring=require(_0x8aef('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8aef('0x11'));var qs=require(_0x8aef('0x12'));var as=require(_0x8aef('0x13'));var hardwareService=require(_0x8aef('0x14'));var logger=require(_0x8aef('0x15'))(_0x8aef('0x16'));var utils=require('../../config/utils');var config=require(_0x8aef('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x8aef('0x18')];function respondWithStatusCode(_0x23732e,_0x443608){_0x443608=_0x443608||0xcc;return function(_0x2b5812){if(_0x2b5812){return _0x23732e[_0x8aef('0x19')](_0x443608);}return _0x23732e['status'](_0x443608)[_0x8aef('0x1a')]();};}function respondWithResult(_0x51ad36,_0x3c002b){_0x3c002b=_0x3c002b||0xc8;return function(_0x2c6a3c){if(_0x2c6a3c){return _0x51ad36[_0x8aef('0x1b')](_0x3c002b)[_0x8aef('0x1c')](_0x2c6a3c);}};}function respondWithFilteredResult(_0x2fff4e,_0x1de54f){return function(_0x3dd4b6){if(_0x3dd4b6){var _0x17d178=typeof _0x1de54f['offset']==='undefined'&&typeof _0x1de54f[_0x8aef('0x1d')]==='undefined';var _0x501d03=_0x3dd4b6[_0x8aef('0x1e')];var _0x30e7fd=_0x17d178?0x0:_0x1de54f['offset'];var _0x308241=_0x17d178?_0x3dd4b6[_0x8aef('0x1e')]:_0x1de54f['offset']+_0x1de54f['limit'];var _0x467ee5;if(_0x308241>=_0x501d03){_0x308241=_0x501d03;_0x467ee5=0xc8;}else{_0x467ee5=0xce;}_0x2fff4e[_0x8aef('0x1b')](_0x467ee5);return _0x2fff4e['set'](_0x8aef('0x1f'),_0x30e7fd+'-'+_0x308241+'/'+_0x501d03)['json'](_0x3dd4b6);}return null;};}function patchUpdates(_0x465eb4){return function(_0x123131){try{jsonpatch[_0x8aef('0x20')](_0x123131,_0x465eb4,!![]);}catch(_0x3829bd){return BPromise[_0x8aef('0x21')](_0x3829bd);}return _0x123131['save']();};}function saveUpdates(_0x1ad299,_0x484e75){return function(_0x3522aa){if(_0x3522aa){return _0x3522aa[_0x8aef('0x22')](_0x1ad299)[_0x8aef('0x23')](function(_0x2cc32a){return _0x2cc32a;});}return null;};}function removeEntity(_0x4936b4,_0x582d50){return function(_0x30ec36){if(_0x30ec36){return _0x30ec36[_0x8aef('0x24')]()[_0x8aef('0x23')](function(){var _0x1f9bb9=_0x30ec36[_0x8aef('0x25')]({'plain':!![]});var _0x5a1a7a=_0x8aef('0x26');return db['UserProfileResource'][_0x8aef('0x24')]({'where':{'type':_0x5a1a7a,'resourceId':_0x1f9bb9['id']}})[_0x8aef('0x23')](function(){return _0x30ec36;});})[_0x8aef('0x23')](function(){_0x4936b4[_0x8aef('0x1b')](0xcc)[_0x8aef('0x1a')]();});}};}function handleEntityNotFound(_0x164140,_0x344e2d){return function(_0x20206c){if(!_0x20206c){_0x164140[_0x8aef('0x19')](0x194);}return _0x20206c;};}function handleError(_0x13795a,_0x142ccb){_0x142ccb=_0x142ccb||0x1f4;return function(_0x5e8d59){logger['error'](_0x5e8d59[_0x8aef('0x27')]);if(_0x5e8d59[_0x8aef('0x28')]){delete _0x5e8d59[_0x8aef('0x28')];}_0x13795a[_0x8aef('0x1b')](_0x142ccb)[_0x8aef('0x29')](_0x5e8d59);};}exports[_0x8aef('0x2a')]=function(_0x3e7e83,_0x3e9580){var _0x494960={},_0x5264bc={},_0x153847={'count':0x0,'rows':[]};var _0x477b7d=_[_0x8aef('0x2b')](db[_0x8aef('0x2c')][_0x8aef('0x2d')],function(_0x5283bb){return{'name':_0x5283bb[_0x8aef('0x2e')],'type':_0x5283bb[_0x8aef('0x2f')][_0x8aef('0x30')]};});_0x5264bc[_0x8aef('0x31')]=_[_0x8aef('0x2b')](_0x477b7d,_0x8aef('0x28'));_0x5264bc[_0x8aef('0x32')]=_[_0x8aef('0x33')](_0x3e7e83[_0x8aef('0x32')]);_0x5264bc[_0x8aef('0x34')]=_[_0x8aef('0x35')](_0x5264bc[_0x8aef('0x31')],_0x5264bc[_0x8aef('0x32')]);_0x494960[_0x8aef('0x36')]=_[_0x8aef('0x35')](_0x5264bc[_0x8aef('0x31')],qs[_0x8aef('0x37')](_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x37')]));_0x494960[_0x8aef('0x36')]=_0x494960['attributes'][_0x8aef('0x38')]?_0x494960[_0x8aef('0x36')]:_0x5264bc[_0x8aef('0x31')];if(!_0x3e7e83[_0x8aef('0x32')]['hasOwnProperty']('nolimit')){_0x494960[_0x8aef('0x1d')]=qs[_0x8aef('0x1d')](_0x3e7e83[_0x8aef('0x32')]['limit']);_0x494960[_0x8aef('0x39')]=qs[_0x8aef('0x39')](_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x39')]);}_0x494960[_0x8aef('0x3a')]=qs[_0x8aef('0x3b')](_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x3b')]);_0x494960[_0x8aef('0x3c')]=qs[_0x8aef('0x34')](_[_0x8aef('0x3d')](_0x3e7e83['query'],_0x5264bc[_0x8aef('0x34')]),_0x477b7d);if(_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x3e')]){_0x494960[_0x8aef('0x3c')]=_[_0x8aef('0x3f')](_0x494960[_0x8aef('0x3c')],{'$or':_['map'](_0x477b7d,function(_0x2500f7){if(_0x2500f7['type']!==_0x8aef('0x40')){var _0x5a66ca={};_0x5a66ca[_0x2500f7['name']]={'$like':'%'+_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x3e')]+'%'};return _0x5a66ca;}})});}_0x494960=_[_0x8aef('0x3f')]({},_0x494960,_0x3e7e83['options']);var _0x594215={'where':_0x494960[_0x8aef('0x3c')]};return db['AnalyticCustomReport'][_0x8aef('0x1e')](_0x594215)[_0x8aef('0x23')](function(_0x590abd){_0x153847[_0x8aef('0x1e')]=_0x590abd;if(_0x3e7e83[_0x8aef('0x32')][_0x8aef('0x41')]){_0x494960['include']=[{'all':!![]}];}return db[_0x8aef('0x2c')]['findAll'](_0x494960);})[_0x8aef('0x23')](function(_0x50b4f8){_0x153847[_0x8aef('0x42')]=_0x50b4f8;return _0x153847;})[_0x8aef('0x23')](respondWithFilteredResult(_0x3e9580,_0x494960))[_0x8aef('0x43')](handleError(_0x3e9580,null));};exports['show']=function(_0x24b031,_0x41c128){var _0x52ba65={'raw':![],'where':{'id':_0x24b031[_0x8aef('0x44')]['id']}},_0x6f5219={};_0x6f5219['model']=_['keys'](db[_0x8aef('0x2c')][_0x8aef('0x2d')]);_0x6f5219[_0x8aef('0x32')]=_[_0x8aef('0x33')](_0x24b031[_0x8aef('0x32')]);_0x6f5219['filters']=_[_0x8aef('0x35')](_0x6f5219[_0x8aef('0x31')],_0x6f5219[_0x8aef('0x32')]);_0x52ba65['attributes']=_[_0x8aef('0x35')](_0x6f5219['model'],qs[_0x8aef('0x37')](_0x24b031[_0x8aef('0x32')][_0x8aef('0x37')]));_0x52ba65[_0x8aef('0x36')]=_0x52ba65['attributes']['length']?_0x52ba65['attributes']:_0x6f5219[_0x8aef('0x31')];if(_0x24b031[_0x8aef('0x32')][_0x8aef('0x41')]){_0x52ba65[_0x8aef('0x45')]=[{'all':!![]}];}_0x52ba65=_['merge']({},_0x52ba65,_0x24b031[_0x8aef('0x46')]);return db[_0x8aef('0x2c')][_0x8aef('0x47')](_0x52ba65)[_0x8aef('0x23')](handleEntityNotFound(_0x41c128,null))[_0x8aef('0x23')](respondWithResult(_0x41c128,null))[_0x8aef('0x43')](handleError(_0x41c128,null));};exports[_0x8aef('0x48')]=function(_0x88c78c,_0x4baef7){return db['AnalyticCustomReport'][_0x8aef('0x48')](_0x88c78c[_0x8aef('0x49')],{})[_0x8aef('0x23')](function(_0x102b92){var _0x1bd64f=_0x88c78c[_0x8aef('0x4a')]['get']({'plain':!![]});if(!_0x1bd64f)throw new Error(_0x8aef('0x4b'));if(_0x1bd64f['role']===_0x8aef('0x4a')){var _0x5e07f1=_0x102b92[_0x8aef('0x25')]({'plain':!![]});var _0xa57630='Reports';return db[_0x8aef('0x4c')][_0x8aef('0x47')]({'where':{'name':_0xa57630,'userProfileId':_0x1bd64f[_0x8aef('0x4d')]},'raw':!![]})['then'](function(_0xad578d){if(_0xad578d&&_0xad578d[_0x8aef('0x4e')]===0x0){return db[_0x8aef('0x4f')]['create']({'name':_0x5e07f1[_0x8aef('0x28')],'resourceId':_0x5e07f1['id'],'type':_0x8aef('0x26'),'sectionId':_0xad578d['id']},{})[_0x8aef('0x23')](function(){return _0x102b92;});}else{return _0x102b92;}})['catch'](function(_0x8924b1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8924b1);throw _0x8924b1;});}return _0x102b92;})[_0x8aef('0x23')](respondWithResult(_0x4baef7,0xc9))[_0x8aef('0x43')](handleError(_0x4baef7,null));};exports[_0x8aef('0x22')]=function(_0x2f40cb,_0x48434e){if(_0x2f40cb[_0x8aef('0x49')]['id']){delete _0x2f40cb[_0x8aef('0x49')]['id'];}return db[_0x8aef('0x2c')][_0x8aef('0x47')]({'where':{'id':_0x2f40cb[_0x8aef('0x44')]['id']}})[_0x8aef('0x23')](handleEntityNotFound(_0x48434e,null))[_0x8aef('0x23')](saveUpdates(_0x2f40cb[_0x8aef('0x49')],null))[_0x8aef('0x23')](respondWithResult(_0x48434e,null))[_0x8aef('0x43')](handleError(_0x48434e,null));};exports['destroy']=function(_0x205e82,_0x1919bb){return db[_0x8aef('0x2c')]['find']({'where':{'id':_0x205e82[_0x8aef('0x44')]['id']}})['then'](handleEntityNotFound(_0x1919bb,null))[_0x8aef('0x23')](removeEntity(_0x1919bb,null))['catch'](handleError(_0x1919bb,null));};exports[_0x8aef('0x50')]=function(_0x409cca,_0xfb9bd8){var _0x545300=0xa;var _0x402456=[_0x8aef('0x51'),'left_join',_0x8aef('0x52'),_0x8aef('0x53')];var _0x192261={'SUM':'SUM(%s)','COUNT':_0x8aef('0x54'),'COUNT DISTINCT':_0x8aef('0x55'),'MAX':'MAX(%s)','MIN':_0x8aef('0x56'),'AVG':_0x8aef('0x57'),'GROUP_CONCAT':_0x8aef('0x58'),'GROUP_CONCAT ASC':_0x8aef('0x59'),'GROUP_CONCAT DESC':_0x8aef('0x5a')};var _0x2b4919={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x8aef('0x5b'),'ROUND':_0x8aef('0x5c'),'UNIX_TIMESTAMP':_0x8aef('0x5d')};var _0x4e2460=function(_0xd7cfe0){return!_[_0x8aef('0x5e')](['IS\x20NULL',_0x8aef('0x5f'),_0x8aef('0x60'),_0x8aef('0x61')],_0xd7cfe0);};var _0x29798c=function(_0x511387){if(!_0x511387||!_0x511387['rules']['length']){return'';}for(var _0x4b06e1='(',_0x3651fa=0x0;_0x3651fa<_0x511387[_0x8aef('0x62')][_0x8aef('0x38')];_0x3651fa+=0x1){_0x3651fa>0x0&&(_0x4b06e1+='\x20'+_0x511387[_0x8aef('0x63')]+'\x20');_0x4b06e1+=_0x511387[_0x8aef('0x62')][_0x3651fa][_0x8aef('0x64')]?_0x29798c(_0x511387[_0x8aef('0x62')][_0x3651fa]['group']):_0x511387[_0x8aef('0x62')][_0x3651fa]['field']+'\x20'+_0x511387[_0x8aef('0x62')][_0x3651fa][_0x8aef('0x65')]+(_0x4e2460(_0x511387['rules'][_0x3651fa][_0x8aef('0x65')])?'\x20'+_0x511387[_0x8aef('0x62')][_0x3651fa][_0x8aef('0x66')]:'');}return _0x4b06e1+')';};var _0x5f2b61={'where':{'id':_0x409cca[_0x8aef('0x44')]['id']}},_0x4b60e4,_0x449304,_0x553fcc,_0x166fd5,_0x2857ab;_0x5f2b61=_[_0x8aef('0x3f')]({},_0x5f2b61,_0x409cca['options']);return db['AnalyticCustomReport'][_0x8aef('0x47')](_0x5f2b61)[_0x8aef('0x23')](function(_0x1efe73){if(_0x1efe73){_0x4b60e4=_0x1efe73;return _0x1efe73['getFields']();}return null;})[_0x8aef('0x23')](function(_0x3cf5ae){if(_0x3cf5ae){if(!_0x3cf5ae[_0x8aef('0x38')]){throw new db[(_0x8aef('0x67'))][(_0x8aef('0x68'))](_0x8aef('0x69'),0x193);}_0x449304=_0x3cf5ae;return db[_0x8aef('0x6a')][_0x8aef('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x54891d){if(_0x54891d){_0x553fcc=_[_0x8aef('0x6c')](_0x54891d,'id');var _0x5e1d03;var _0xc9b0d9=squel[_0x8aef('0x6d')]();_0xc9b0d9[_0x8aef('0x6e')](_0x4b60e4[_0x8aef('0x6f')]);for(var _0x2080fd=0x0;_0x2080fd<_0x449304[_0x8aef('0x38')];_0x2080fd+=0x1){_0x5e1d03=_0x449304[_0x2080fd][_0x8aef('0x70')]?_0x553fcc[_0x449304[_0x2080fd][_0x8aef('0x70')]][_0x8aef('0x71')]:_0x449304[_0x2080fd][_0x8aef('0x72')];_0x5e1d03=_0x449304[_0x2080fd]['function']?_[_0x8aef('0x73')](_0x192261[_0x449304[_0x2080fd]['function']],'%s',_0x5e1d03):_0x5e1d03;_0x5e1d03=_0x449304[_0x2080fd][_0x8aef('0x74')]?_[_0x8aef('0x73')](_0x2b4919[_0x449304[_0x2080fd]['format']],'%s',_0x5e1d03):_0x5e1d03;if(_0x449304[_0x2080fd][_0x8aef('0x75')]){_0xc9b0d9[_0x8aef('0x64')](_0x5e1d03);}_0x449304[_0x2080fd][_0x8aef('0x76')]&&_0xc9b0d9[_0x8aef('0x3a')](_0x5e1d03,_0x449304[_0x2080fd][_0x8aef('0x76')]===_0x8aef('0x77')?![]:!![]);_0xc9b0d9[_0x8aef('0x72')](_0x5e1d03,_0x449304[_0x2080fd][_0x8aef('0x78')]||_0x5e1d03);}if(_0x4b60e4[_0x8aef('0x79')]){_0x4b60e4[_0x8aef('0x79')]=JSON['parse'](_0x4b60e4[_0x8aef('0x79')]);for(var _0x51e0ec=0x0;_0x51e0ec<_0x4b60e4[_0x8aef('0x79')]['length'];_0x51e0ec+=0x1){if(_0x4b60e4['joins'][_0x51e0ec][_0x8aef('0x2f')]&&_[_0x8aef('0x5e')](_0x402456,_0x4b60e4['joins'][_0x51e0ec][_0x8aef('0x2f')])&&_0x4b60e4[_0x8aef('0x79')][_0x51e0ec]['parentKey']&&_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x7a')]&&_0x4b60e4['joins'][_0x51e0ec][_0x8aef('0x7b')]){_0xc9b0d9[_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x2f')]](_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x7a')],null,util['format'](_0x8aef('0x7c'),_0x4b60e4[_0x8aef('0x6f')],_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x7d')],_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x7a')],_0x4b60e4[_0x8aef('0x79')][_0x51e0ec][_0x8aef('0x7b')]));}}}if(_0x4b60e4[_0x8aef('0x7e')]){_0x4b60e4[_0x8aef('0x7e')]=JSON[_0x8aef('0x7f')](_0x4b60e4[_0x8aef('0x7e')]);_0xc9b0d9[_0x8aef('0x3c')](_0x29798c(_0x4b60e4[_0x8aef('0x7e')]['group']));}_0x2857ab=_0xc9b0d9[_0x8aef('0x80')]();_0xc9b0d9[_0x8aef('0x1d')](_0x545300);_0xc9b0d9[_0x8aef('0x39')](0x0);logger[_0x8aef('0x81')](_0x8aef('0x82'),_0xc9b0d9[_0x8aef('0x83')]());return dbH[_0x8aef('0x84')]['query'](_0xc9b0d9[_0x8aef('0x83')](),{'type':dbH[_0x8aef('0x84')][_0x8aef('0x85')][_0x8aef('0x86')]});}})[_0x8aef('0x23')](respondWithResult(_0xfb9bd8,null))[_0x8aef('0x43')](handleError(_0xfb9bd8,null));};function runReport(_0x3e0a97,_0x18cb7b,_0x254a15){var _0x1c0dc0=_0x18cb7b[_0x8aef('0x28')];var _0x5d811b=0xa;var _0x2ae43e=[_0x8aef('0x51'),'left_join','right_join',_0x8aef('0x53')];var _0x56ddd2={'SUM':_0x8aef('0x87'),'COUNT':_0x8aef('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8aef('0x88'),'MIN':_0x8aef('0x56'),'AVG':_0x8aef('0x57'),'GROUP_CONCAT':_0x8aef('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x8aef('0x5a')};var _0x4e1175={'SEC_TO_TIME':_0x8aef('0x89'),'DATE':_0x8aef('0x8a'),'HOUR':_0x8aef('0x5b'),'ROUND':_0x8aef('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x200fc6=function(_0x5ed922){return!_['includes']([_0x8aef('0x8b'),_0x8aef('0x5f'),_0x8aef('0x60'),_0x8aef('0x61')],_0x5ed922);};var _0x506726=function(_0x560b5f){if(!_0x560b5f||!_0x560b5f['rules'][_0x8aef('0x38')]){return'';}for(var _0x17f0fd='(',_0x5c4aff=0x0;_0x5c4aff<_0x560b5f[_0x8aef('0x62')][_0x8aef('0x38')];_0x5c4aff+=0x1){_0x5c4aff>0x0&&(_0x17f0fd+='\x20'+_0x560b5f[_0x8aef('0x63')]+'\x20');_0x17f0fd+=_0x560b5f[_0x8aef('0x62')][_0x5c4aff][_0x8aef('0x64')]?_0x506726(_0x560b5f[_0x8aef('0x62')][_0x5c4aff][_0x8aef('0x64')]):_0x560b5f[_0x8aef('0x62')][_0x5c4aff][_0x8aef('0x72')]+'\x20'+_0x560b5f[_0x8aef('0x62')][_0x5c4aff][_0x8aef('0x65')]+(_0x200fc6(_0x560b5f[_0x8aef('0x62')][_0x5c4aff][_0x8aef('0x65')])?'\x20'+_0x560b5f['rules'][_0x5c4aff][_0x8aef('0x66')]:'');}return _0x17f0fd+')';};var _0x17d828={'where':{'id':_0x3e0a97['id']}},_0x292fd3,_0x23043a,_0x4af33b,_0x539135,_0x2d0bbc;_0x17d828=_[_0x8aef('0x3f')]({},_0x17d828,_0x254a15);return db[_0x8aef('0x2c')][_0x8aef('0x47')](_0x17d828)['then'](function(_0x587b1c){if(_0x587b1c){_0x292fd3=_0x587b1c;return _0x587b1c['getFields']();}return null;})[_0x8aef('0x23')](function(_0x128f3a){if(_0x128f3a){if(!_0x128f3a[_0x8aef('0x38')]){throw new db[(_0x8aef('0x67'))][(_0x8aef('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x23043a=_0x128f3a;return db[_0x8aef('0x6a')][_0x8aef('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x1c616f){if(_0x1c616f){_0x4af33b=_[_0x8aef('0x6c')](_0x1c616f,'id');var _0x1c0965;var _0x1c32d0=squel[_0x8aef('0x6d')]();_0x1c32d0[_0x8aef('0x6e')](_0x292fd3[_0x8aef('0x6f')]);for(var _0x5e8a2e=0x0;_0x5e8a2e<_0x23043a[_0x8aef('0x38')];_0x5e8a2e+=0x1){_0x1c0965=_0x23043a[_0x5e8a2e][_0x8aef('0x70')]?_0x4af33b[_0x23043a[_0x5e8a2e][_0x8aef('0x70')]][_0x8aef('0x71')]:_0x23043a[_0x5e8a2e][_0x8aef('0x72')];_0x1c0965=_0x23043a[_0x5e8a2e][_0x8aef('0x8c')]?_[_0x8aef('0x73')](_0x56ddd2[_0x23043a[_0x5e8a2e][_0x8aef('0x8c')]],'%s',_0x1c0965):_0x1c0965;_0x1c0965=_0x23043a[_0x5e8a2e]['format']?_[_0x8aef('0x73')](_0x4e1175[_0x23043a[_0x5e8a2e][_0x8aef('0x74')]],'%s',_0x1c0965):_0x1c0965;if(_0x23043a[_0x5e8a2e][_0x8aef('0x75')]){_0x1c32d0[_0x8aef('0x64')](_0x1c0965);}_0x23043a[_0x5e8a2e]['orderBy']&&_0x1c32d0[_0x8aef('0x3a')](_0x1c0965,_0x23043a[_0x5e8a2e]['orderBy']==='DESC'?![]:!![]);_0x1c32d0[_0x8aef('0x72')](_0x1c0965,_0x23043a[_0x5e8a2e][_0x8aef('0x78')]||_0x1c0965);}if(_0x292fd3[_0x8aef('0x79')]){_0x292fd3[_0x8aef('0x79')]=JSON[_0x8aef('0x7f')](_0x292fd3[_0x8aef('0x79')]);for(var _0x5ede97=0x0;_0x5ede97<_0x292fd3[_0x8aef('0x79')][_0x8aef('0x38')];_0x5ede97+=0x1){if(_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x2f')]&&_[_0x8aef('0x5e')](_0x2ae43e,_0x292fd3['joins'][_0x5ede97]['type'])&&_0x292fd3[_0x8aef('0x79')][_0x5ede97]['parentKey']&&_0x292fd3[_0x8aef('0x79')][_0x5ede97]['foreignTable']&&_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x7b')]){_0x1c32d0[_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x2f')]](_0x292fd3['joins'][_0x5ede97][_0x8aef('0x7a')],null,util[_0x8aef('0x74')](_0x8aef('0x7c'),_0x292fd3[_0x8aef('0x6f')],_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x7d')],_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x7a')],_0x292fd3[_0x8aef('0x79')][_0x5ede97][_0x8aef('0x7b')]));}}}if(_0x292fd3[_0x8aef('0x7e')]){_0x292fd3[_0x8aef('0x7e')]=JSON[_0x8aef('0x7f')](_0x292fd3[_0x8aef('0x7e')]);_0x1c32d0[_0x8aef('0x3c')](_0x506726(_0x292fd3['conditions'][_0x8aef('0x64')]));}_0x2d0bbc=_0x1c32d0[_0x8aef('0x80')]();_0x1c32d0[_0x8aef('0x1d')](_0x5d811b);_0x1c32d0[_0x8aef('0x39')](0x0);return;}})[_0x8aef('0x23')](function(){if(_0x18cb7b['output']===_0x8aef('0x8d')){return null;}var _0x4ac47d=_['merge'](_0x18cb7b,{'name':_0x18cb7b[_0x8aef('0x8e')]||_0x18cb7b[_0x8aef('0x28')]||_0x292fd3[_0x8aef('0x28')],'basename':_0x1c0dc0,'savename':util[_0x8aef('0x74')]('%s-%s.%s',_0x18cb7b['name']||_0x292fd3[_0x8aef('0x28')],require(_0x8aef('0x8f'))[_0x8aef('0x90')](0x4),_0x18cb7b[_0x8aef('0x91')]||_0x8aef('0x92')),'reportId':_0x292fd3['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x8aef('0x48')](_0x4ac47d,{'raw':!![]});})[_0x8aef('0x23')](function(_0x4fc777){if(_0x292fd3[_0x8aef('0x6f')]===_0x8aef('0x93')){_0x2d0bbc[_0x8aef('0x3c')](_0x292fd3[_0x8aef('0x6f')]+_0x8aef('0x94'),_0x18cb7b[_0x8aef('0x95')],_0x18cb7b['endDate']);}else{_0x2d0bbc[_0x8aef('0x3c')](_0x292fd3[_0x8aef('0x6f')]+_0x8aef('0x96'),_0x18cb7b['startDate'],_0x18cb7b['endDate']);}if(_0x4fc777){logger[_0x8aef('0x97')](_0x8aef('0x98'),_0x2d0bbc[_0x8aef('0x83')]());require(_0x8aef('0x99'))[_0x8aef('0x9a')](path[_0x8aef('0x51')](__dirname,_0x8aef('0x9b'),_0x4fc777[_0x8aef('0x91')]),[_0x4fc777['id'],_0x2d0bbc[_0x8aef('0x83')](),path[_0x8aef('0x51')](__dirname,_0x8aef('0x9c'),_0x4fc777[_0x8aef('0x9d')]),_0x1c0dc0]);return _0x4fc777;}else{var _0x9a020e=squel[_0x8aef('0x6d')]();_0x9a020e['from']('('+_0x2d0bbc[_0x8aef('0x83')]()+')',_0x8aef('0x9e'));_0x9a020e[_0x8aef('0x72')](_0x8aef('0x9f'),_0x8aef('0x1e'));_0x2d0bbc[_0x8aef('0x1d')](_0x18cb7b[_0x8aef('0x1d')]||_0x5d811b);_0x2d0bbc[_0x8aef('0x39')](_0x18cb7b[_0x8aef('0x39')]||0x0);return dbH['sequelize']['query'](_0x9a020e[_0x8aef('0x83')](),{'type':dbH[_0x8aef('0x84')]['QueryTypes'][_0x8aef('0x86')]})[_0x8aef('0x23')](function(_0x4a4af4){if(!_0x4a4af4['length']){_0x539135=0x0;}else{_0x539135=_0x4a4af4[0x0][_0x8aef('0x1e')]||0x0;}return dbH['sequelize'][_0x8aef('0x32')](_0x2d0bbc['toString'](),{'type':dbH[_0x8aef('0x84')][_0x8aef('0x85')][_0x8aef('0x86')]});})[_0x8aef('0x23')](function(_0x5bd96a){return{'rows':_0x5bd96a||[],'count':_0x539135};});}});}exports[_0x8aef('0xa0')]=function(_0x108a65,_0x3a8c3b){return runReport(_0x108a65['params'],_0x108a65['query'],_0x108a65[_0x8aef('0x46')])['then'](respondWithResult(_0x3a8c3b,null))[_0x8aef('0x43')](handleError(_0x3a8c3b,null));};exports[_0x8aef('0xa1')]=runReport;exports[_0x8aef('0x32')]=function(_0xed5028,_0x83e0bf){var _0x1c970b=0xa;var _0x141688=[_0x8aef('0x51'),_0x8aef('0xa2'),'right_join',_0x8aef('0x53')];var _0x2b8c87={'SUM':'SUM(%s)','COUNT':_0x8aef('0x54'),'COUNT DISTINCT':_0x8aef('0x55'),'MAX':_0x8aef('0x88'),'MIN':_0x8aef('0x56'),'AVG':_0x8aef('0x57'),'GROUP_CONCAT':_0x8aef('0x58'),'GROUP_CONCAT ASC':_0x8aef('0x59'),'GROUP_CONCAT DESC':_0x8aef('0x5a')};var _0x1d45bd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8aef('0x8a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x8aef('0x5d')};var _0x2f2238=function(_0x2ffc71){return!_[_0x8aef('0x5e')](['IS\x20NULL',_0x8aef('0x5f'),_0x8aef('0x60'),_0x8aef('0x61')],_0x2ffc71);};var _0x321430=function(_0x43c3aa){if(!_0x43c3aa||!_0x43c3aa[_0x8aef('0x62')]['length']){return'';}for(var _0x127e7d='(',_0xaf86f0=0x0;_0xaf86f0<_0x43c3aa[_0x8aef('0x62')][_0x8aef('0x38')];_0xaf86f0+=0x1){_0xaf86f0>0x0&&(_0x127e7d+='\x20'+_0x43c3aa[_0x8aef('0x63')]+'\x20');_0x127e7d+=_0x43c3aa[_0x8aef('0x62')][_0xaf86f0][_0x8aef('0x64')]?_0x321430(_0x43c3aa['rules'][_0xaf86f0][_0x8aef('0x64')]):_0x43c3aa[_0x8aef('0x62')][_0xaf86f0][_0x8aef('0x72')]+'\x20'+_0x43c3aa[_0x8aef('0x62')][_0xaf86f0][_0x8aef('0x65')]+(_0x2f2238(_0x43c3aa[_0x8aef('0x62')][_0xaf86f0][_0x8aef('0x65')])?'\x20'+_0x43c3aa[_0x8aef('0x62')][_0xaf86f0][_0x8aef('0x66')]:'');}return _0x127e7d+')';};var _0x25869d={'where':{'id':_0xed5028[_0x8aef('0x44')]['id']}},_0x1da966,_0x49ca45,_0x35115b,_0x2b8859,_0x391b2a;_0x25869d=_[_0x8aef('0x3f')]({},_0x25869d,_0xed5028[_0x8aef('0x46')]);return db[_0x8aef('0x2c')]['find'](_0x25869d)[_0x8aef('0x23')](function(_0x11ae1d){if(_0x11ae1d){_0x1da966=_0x11ae1d;return _0x11ae1d[_0x8aef('0xa3')]();}return null;})['then'](function(_0x3bba50){if(_0x3bba50){if(!_0x3bba50[_0x8aef('0x38')]){throw new db['Sequelize'][(_0x8aef('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x49ca45=_0x3bba50;return db[_0x8aef('0x6a')][_0x8aef('0x6b')]({'raw':!![]});}return null;})[_0x8aef('0x23')](function(_0x27c33a){if(_0x27c33a){_0x35115b=_[_0x8aef('0x6c')](_0x27c33a,'id');var _0x1cc6b7;var _0x2aecf2=squel[_0x8aef('0x6d')]();_0x2aecf2[_0x8aef('0x6e')](_0x1da966['table']);for(var _0x580dff=0x0;_0x580dff<_0x49ca45['length'];_0x580dff+=0x1){_0x1cc6b7=_0x49ca45[_0x580dff]['MetricId']?_0x35115b[_0x49ca45[_0x580dff][_0x8aef('0x70')]][_0x8aef('0x71')]:_0x49ca45[_0x580dff]['field'];_0x1cc6b7=_0x49ca45[_0x580dff]['function']?_[_0x8aef('0x73')](_0x2b8c87[_0x49ca45[_0x580dff][_0x8aef('0x8c')]],'%s',_0x1cc6b7):_0x1cc6b7;_0x1cc6b7=_0x49ca45[_0x580dff][_0x8aef('0x74')]?_['replace'](_0x1d45bd[_0x49ca45[_0x580dff][_0x8aef('0x74')]],'%s',_0x1cc6b7):_0x1cc6b7;if(_0x49ca45[_0x580dff][_0x8aef('0x75')]){_0x2aecf2[_0x8aef('0x64')](_0x1cc6b7);}_0x49ca45[_0x580dff]['orderBy']&&_0x2aecf2[_0x8aef('0x3a')](_0x1cc6b7,_0x49ca45[_0x580dff][_0x8aef('0x76')]===_0x8aef('0x77')?![]:!![]);_0x2aecf2[_0x8aef('0x72')](_0x1cc6b7,_0x49ca45[_0x580dff][_0x8aef('0x78')]||_0x1cc6b7);}if(_0x1da966[_0x8aef('0x79')]){_0x1da966[_0x8aef('0x79')]=JSON[_0x8aef('0x7f')](_0x1da966['joins']);for(var _0x1d25c2=0x0;_0x1d25c2<_0x1da966['joins'][_0x8aef('0x38')];_0x1d25c2+=0x1){if(_0x1da966['joins'][_0x1d25c2][_0x8aef('0x2f')]&&_[_0x8aef('0x5e')](_0x141688,_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x2f')])&&_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7d')]&&_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7a')]&&_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7b')]){_0x2aecf2[_0x1da966[_0x8aef('0x79')][_0x1d25c2]['type']](_0x1da966[_0x8aef('0x79')][_0x1d25c2]['foreignTable'],null,util['format'](_0x8aef('0x7c'),_0x1da966[_0x8aef('0x6f')],_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7d')],_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7a')],_0x1da966[_0x8aef('0x79')][_0x1d25c2][_0x8aef('0x7b')]));}}}if(_0x1da966[_0x8aef('0x7e')]){_0x1da966[_0x8aef('0x7e')]=JSON['parse'](_0x1da966['conditions']);_0x2aecf2[_0x8aef('0x3c')](_0x321430(_0x1da966[_0x8aef('0x7e')][_0x8aef('0x64')]));}_0x391b2a=_0x2aecf2[_0x8aef('0x80')]();_0x2aecf2[_0x8aef('0x1d')](_0x1c970b);_0x2aecf2[_0x8aef('0x39')](0x0);logger[_0x8aef('0x81')](_0x8aef('0x82'),_0x2aecf2[_0x8aef('0x83')]());return dbH[_0x8aef('0x84')]['query'](_0x2aecf2[_0x8aef('0x83')](),{'type':dbH['sequelize'][_0x8aef('0x85')]['SELECT']});}})[_0x8aef('0x23')](function(){return{'sql':_0x391b2a[_0x8aef('0x83')]()};})[_0x8aef('0x23')](respondWithResult(_0x83e0bf,null))[_0x8aef('0x43')](handleError(_0x83e0bf,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5ea529e..aad9831 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 _0xbf6f=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','moment'];(function(_0x3016ed,_0x4f12d5){var _0x2c146f=function(_0x5f02e5){while(--_0x5f02e5){_0x3016ed['push'](_0x3016ed['shift']());}};_0x2c146f(++_0x4f12d5);}(_0xbf6f,0x15c));var _0xfbf6=function(_0x56a758,_0x381a41){_0x56a758=_0x56a758-0x0;var _0x4252ef=_0xbf6f[_0x56a758];return _0x4252ef;};'use strict';var _=require(_0xfbf6('0x0'));var util=require('util');var logger=require(_0xfbf6('0x1'))('api');var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var rp=require(_0xfbf6('0x4'));var fs=require('fs');var path=require(_0xfbf6('0x5'));var rimraf=require(_0xfbf6('0x6'));var config=require(_0xfbf6('0x7'));var attributes=require(_0xfbf6('0x8'));module[_0xfbf6('0x9')]=function(_0x20485f,_0x2973b2){return _0x20485f[_0xfbf6('0xa')](_0xfbf6('0xb'),attributes,{'tableName':_0xfbf6('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb12e=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xb12e,0x8f));var _0xeb12=function(_0x1091c9,_0x4a08e4){_0x1091c9=_0x1091c9-0x0;var _0x2912ef=_0xb12e[_0x1091c9];return _0x2912ef;};'use strict';var _=require(_0xeb12('0x0'));var util=require(_0xeb12('0x1'));var logger=require(_0xeb12('0x2'))('api');var moment=require(_0xeb12('0x3'));var BPromise=require(_0xeb12('0x4'));var rp=require(_0xeb12('0x5'));var fs=require('fs');var path=require(_0xeb12('0x6'));var rimraf=require(_0xeb12('0x7'));var config=require(_0xeb12('0x8'));var attributes=require(_0xeb12('0x9'));module[_0xeb12('0xa')]=function(_0x34aab0,_0x1c49ff){return _0x34aab0[_0xeb12('0xb')](_0xeb12('0xc'),attributes,{'tableName':_0xeb12('0xd'),'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 9a0f43d..7ec85ba 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 _0xbdd8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd9921a,_0x271e08){var _0x2ef96b=function(_0x466e84){while(--_0x466e84){_0xd9921a['push'](_0xd9921a['shift']());}};_0x2ef96b(++_0x271e08);}(_0xbdd8,0xab));var _0x8bdd=function(_0x5e152a,_0x3ecde7){_0x5e152a=_0x5e152a-0x0;var _0x387327=_0xbdd8[_0x5e152a];return _0x387327;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8bdd('0x0'));var BPromise=require(_0x8bdd('0x1'));var rs=require(_0x8bdd('0x2'));var fs=require('fs');var Redis=require(_0x8bdd('0x3'));var db=require(_0x8bdd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bdd('0x5'))('rpc');var config=require(_0x8bdd('0x6'));var jayson=require(_0x8bdd('0x7'));var client=jayson[_0x8bdd('0x8')][_0x8bdd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a5dd,_0xe8d442,_0x4f1b83){return new BPromise(function(_0x1e0660,_0x219883){return client[_0x8bdd('0xa')](_0x57a5dd,_0x4f1b83)[_0x8bdd('0xb')](function(_0x573a22){logger[_0x8bdd('0xc')](_0x8bdd('0xd'),_0xe8d442,_0x8bdd('0xe'));logger['debug'](_0x8bdd('0xf'),_0xe8d442,_0x8bdd('0xe'),JSON[_0x8bdd('0x10')](_0x573a22));if(_0x573a22[_0x8bdd('0x11')]){if(_0x573a22['error'][_0x8bdd('0x12')]===0x1f4){logger['error'](_0x8bdd('0xd'),_0xe8d442,_0x573a22[_0x8bdd('0x11')]['message']);return _0x219883(_0x573a22['error'][_0x8bdd('0x13')]);}logger[_0x8bdd('0x11')](_0x8bdd('0xd'),_0xe8d442,_0x573a22[_0x8bdd('0x11')][_0x8bdd('0x13')]);return _0x1e0660(_0x573a22[_0x8bdd('0x11')][_0x8bdd('0x13')]);}else{logger[_0x8bdd('0xc')](_0x8bdd('0xd'),_0xe8d442,_0x8bdd('0xe'));_0x1e0660(_0x573a22[_0x8bdd('0x14')][_0x8bdd('0x13')]);}})[_0x8bdd('0x15')](function(_0x1fc7e5){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xe8d442,_0x1fc7e5);_0x219883(_0x1fc7e5);});});} \ No newline at end of file +var _0xdb60=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../config/utils','rpc','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xdb60,0x112));var _0x0db6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdb60[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0db6('0x0'));var util=require('util');var moment=require(_0x0db6('0x1'));var BPromise=require(_0x0db6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0db6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0db6('0x4'));var logger=require('../../config/logger')(_0x0db6('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0db6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5efb4d,_0x38cb9d,_0xb002f9){return new BPromise(function(_0x1cb1a2,_0x564115){return client[_0x0db6('0x7')](_0x5efb4d,_0xb002f9)[_0x0db6('0x8')](function(_0x5ad0f0){logger[_0x0db6('0x9')](_0x0db6('0xa'),_0x38cb9d,_0x0db6('0xb'));logger[_0x0db6('0xc')](_0x0db6('0xd'),_0x38cb9d,_0x0db6('0xb'),JSON[_0x0db6('0xe')](_0x5ad0f0));if(_0x5ad0f0['error']){if(_0x5ad0f0[_0x0db6('0xf')][_0x0db6('0x10')]===0x1f4){logger[_0x0db6('0xf')](_0x0db6('0xa'),_0x38cb9d,_0x5ad0f0[_0x0db6('0xf')][_0x0db6('0x11')]);return _0x564115(_0x5ad0f0[_0x0db6('0xf')]['message']);}logger[_0x0db6('0xf')](_0x0db6('0xa'),_0x38cb9d,_0x5ad0f0[_0x0db6('0xf')][_0x0db6('0x11')]);return _0x1cb1a2(_0x5ad0f0[_0x0db6('0xf')][_0x0db6('0x11')]);}else{logger[_0x0db6('0x9')](_0x0db6('0xa'),_0x38cb9d,_0x0db6('0xb'));_0x1cb1a2(_0x5ad0f0[_0x0db6('0x12')][_0x0db6('0x11')]);}})['catch'](function(_0x30bab1){logger[_0x0db6('0xf')](_0x0db6('0xa'),_0x38cb9d,_0x30bab1);_0x564115(_0x30bab1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 006d41d..e52acb2 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 _0x1444=['update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1444,0x180));var _0x4144=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x1444[_0x20589d];return _0x422de9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4144('0x0'));var timeout=require(_0x4144('0x1'));var express=require(_0x4144('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4144('0x3'));var interaction=require(_0x4144('0x4'));var config=require(_0x4144('0x5'));var controller=require(_0x4144('0x6'));router[_0x4144('0x7')]('/',auth[_0x4144('0x8')](),controller[_0x4144('0x9')]);router[_0x4144('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x4144('0xa'),auth[_0x4144('0x8')](),controller[_0x4144('0xb')]);router[_0x4144('0x7')]('/:id/run',auth['isAuthenticated'](),controller[_0x4144('0xc')]);router[_0x4144('0x7')](_0x4144('0xd'),auth[_0x4144('0x8')](),controller[_0x4144('0xe')]);router['post']('/',auth[_0x4144('0x8')](),controller['create']);router['put'](_0x4144('0xf'),auth['isAuthenticated'](),controller[_0x4144('0x10')]);router[_0x4144('0x11')]('/:id',auth[_0x4144('0x8')](),controller[_0x4144('0x12')]);module[_0x4144('0x13')]=router; \ No newline at end of file +var _0xfd7f=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','run','/:id/query','query','post','create','update','destroy'];(function(_0x36ba7f,_0x9a5b1c){var _0x479c13=function(_0x4ce87b){while(--_0x4ce87b){_0x36ba7f['push'](_0x36ba7f['shift']());}};_0x479c13(++_0x9a5b1c);}(_0xfd7f,0x11e));var _0xffd7=function(_0x35c5be,_0x1ce11d){_0x35c5be=_0x35c5be-0x0;var _0x362b23=_0xfd7f[_0x35c5be];return _0x362b23;};'use strict';var multer=require(_0xffd7('0x0'));var util=require(_0xffd7('0x1'));var path=require(_0xffd7('0x2'));var timeout=require(_0xffd7('0x3'));var express=require('express');var router=express[_0xffd7('0x4')]();var fs_extra=require(_0xffd7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xffd7('0x6'));var config=require(_0xffd7('0x7'));var controller=require(_0xffd7('0x8'));router[_0xffd7('0x9')]('/',auth[_0xffd7('0xa')](),controller[_0xffd7('0xb')]);router['get'](_0xffd7('0xc'),auth[_0xffd7('0xa')](),controller[_0xffd7('0xd')]);router[_0xffd7('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xffd7('0xe')]);router[_0xffd7('0x9')]('/:id/run',auth[_0xffd7('0xa')](),controller[_0xffd7('0xf')]);router[_0xffd7('0x9')](_0xffd7('0x10'),auth['isAuthenticated'](),controller[_0xffd7('0x11')]);router[_0xffd7('0x12')]('/',auth[_0xffd7('0xa')](),controller[_0xffd7('0x13')]);router['put'](_0xffd7('0xc'),auth[_0xffd7('0xa')](),controller[_0xffd7('0x14')]);router['delete'](_0xffd7('0xc'),auth[_0xffd7('0xa')](),controller[_0xffd7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 9e9f942..0f31496 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x1f6fda,_0x41513a){var _0x4c0adc=function(_0x31ba03){while(--_0x31ba03){_0x1f6fda['push'](_0x1f6fda['shift']());}};_0x4c0adc(++_0x41513a);}(_0x98a8,0x12c));var _0x898a=function(_0x359ad2,_0x19aa5d){_0x359ad2=_0x359ad2-0x0;var _0x111b54=_0x98a8[_0x359ad2];return _0x111b54;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbd51=['sequelize','STRING'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x270767,_0x527a04){_0x270767=_0x270767-0x0;var _0x3d05a2=_0xbd51[_0x270767];return _0x3d05a2;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index db7f0a8..24f5639 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x10d023,_0x6ad4ad){var _0x31371b=function(_0x210693){while(--_0x210693){_0x10d023['push'](_0x10d023['shift']());}};_0x31371b(++_0x6ad4ad);}(_0x31f0,0xb7));var _0x031f=function(_0x2a9ef6,_0x525920){_0x2a9ef6=_0x2a9ef6-0x0;var _0x557e08=_0x31f0[_0x2a9ef6];return _0x557e08;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x326f,0xd1));var _0xf326=function(_0xbb17fb,_0x1ea0bf){_0xbb17fb=_0xbb17fb-0x0;var _0x42ce6e=_0x326f[_0xbb17fb];return _0x42ce6e;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6e71cc9..597f075 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 _0x2897=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x5206dd,_0x100a63){var _0x3269bd=function(_0x2f2948){while(--_0x2f2948){_0x5206dd['push'](_0x5206dd['shift']());}};_0x3269bd(++_0x100a63);}(_0x2897,0x1c1));var _0x7289=function(_0x3b22d5,_0x57004e){_0x3b22d5=_0x3b22d5-0x0;var _0x4d9620=_0x2897[_0x3b22d5];return _0x4d9620;};'use strict';var _=require(_0x7289('0x0'));var util=require(_0x7289('0x1'));var logger=require(_0x7289('0x2'))(_0x7289('0x3'));var moment=require('moment');var BPromise=require(_0x7289('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7289('0x5'));var rimraf=require(_0x7289('0x6'));var config=require(_0x7289('0x7'));var attributes=require(_0x7289('0x8'));module[_0x7289('0x9')]=function(_0x102fa6,_0x5c00cb){return _0x102fa6[_0x7289('0xa')](_0x7289('0xb'),attributes,{'tableName':_0x7289('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3e0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','util'];(function(_0x5e872b,_0x5a9f3c){var _0x1dde74=function(_0x54f2a7){while(--_0x54f2a7){_0x5e872b['push'](_0x5e872b['shift']());}};_0x1dde74(++_0x5a9f3c);}(_0xb3e0,0x1cd));var _0x0b3e=function(_0xdbbb7c,_0x19e8e2){_0xdbbb7c=_0xdbbb7c-0x0;var _0x23643f=_0xb3e0[_0xdbbb7c];return _0x23643f;};'use strict';var _=require('lodash');var util=require(_0x0b3e('0x0'));var logger=require(_0x0b3e('0x1'))(_0x0b3e('0x2'));var moment=require(_0x0b3e('0x3'));var BPromise=require(_0x0b3e('0x4'));var rp=require(_0x0b3e('0x5'));var fs=require('fs');var path=require(_0x0b3e('0x6'));var rimraf=require(_0x0b3e('0x7'));var config=require(_0x0b3e('0x8'));var attributes=require(_0x0b3e('0x9'));module[_0x0b3e('0xa')]=function(_0x33efc0,_0x4cd577){return _0x33efc0['define']('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 c204a38..cfb483c 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 _0x8234=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x9c36e9,_0x5154e6){var _0x5a393f=function(_0x5387cb){while(--_0x5387cb){_0x9c36e9['push'](_0x9c36e9['shift']());}};_0x5a393f(++_0x5154e6);}(_0x8234,0xfb));var _0x4823=function(_0x3b29b7,_0x31831e){_0x3b29b7=_0x3b29b7-0x0;var _0x2b2669=_0x8234[_0x3b29b7];return _0x2b2669;};'use strict';var _=require(_0x4823('0x0'));var util=require(_0x4823('0x1'));var moment=require(_0x4823('0x2'));var BPromise=require(_0x4823('0x3'));var rs=require(_0x4823('0x4'));var fs=require('fs');var Redis=require(_0x4823('0x5'));var db=require(_0x4823('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4823('0x7'))(_0x4823('0x8'));var config=require(_0x4823('0x9'));var jayson=require(_0x4823('0xa'));var client=jayson[_0x4823('0xb')][_0x4823('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17c455,_0x8cdaa6,_0x1003a2){return new BPromise(function(_0x1c6180,_0x107b64){return client[_0x4823('0xd')](_0x17c455,_0x1003a2)[_0x4823('0xe')](function(_0x54d8d8){logger[_0x4823('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x8cdaa6,_0x4823('0x10'));logger['debug'](_0x4823('0x11'),_0x8cdaa6,_0x4823('0x10'),JSON['stringify'](_0x54d8d8));if(_0x54d8d8[_0x4823('0x12')]){if(_0x54d8d8[_0x4823('0x12')]['code']===0x1f4){logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);return _0x107b64(_0x54d8d8['error']['message']);}logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);return _0x1c6180(_0x54d8d8[_0x4823('0x12')][_0x4823('0x14')]);}else{logger[_0x4823('0xf')](_0x4823('0x13'),_0x8cdaa6,_0x4823('0x10'));_0x1c6180(_0x54d8d8[_0x4823('0x15')][_0x4823('0x14')]);}})[_0x4823('0x16')](function(_0x59335a){logger[_0x4823('0x12')](_0x4823('0x13'),_0x8cdaa6,_0x59335a);_0x107b64(_0x59335a);});});} \ No newline at end of file +var _0x7aae=['stringify','error','code','message','result','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x4ce663,_0x28f1d7){var _0x318ff3=function(_0x182985){while(--_0x182985){_0x4ce663['push'](_0x4ce663['shift']());}};_0x318ff3(++_0x28f1d7);}(_0x7aae,0x10e));var _0xe7aa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7aae[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe7aa('0x0'));var rs=require(_0xe7aa('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe7aa('0x2'))['db'];var utils=require(_0xe7aa('0x3'));var logger=require(_0xe7aa('0x4'))(_0xe7aa('0x5'));var config=require('../../config/environment');var jayson=require(_0xe7aa('0x6'));var client=jayson[_0xe7aa('0x7')][_0xe7aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51826f,_0x365217,_0x7cb45c){return new BPromise(function(_0x353f91,_0x1b8c20){return client[_0xe7aa('0x9')](_0x51826f,_0x7cb45c)[_0xe7aa('0xa')](function(_0x49d056){logger[_0xe7aa('0xb')](_0xe7aa('0xc'),_0x365217,_0xe7aa('0xd'));logger[_0xe7aa('0xe')](_0xe7aa('0xf'),_0x365217,'request\x20sent',JSON[_0xe7aa('0x10')](_0x49d056));if(_0x49d056[_0xe7aa('0x11')]){if(_0x49d056[_0xe7aa('0x11')][_0xe7aa('0x12')]===0x1f4){logger[_0xe7aa('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x365217,_0x49d056[_0xe7aa('0x11')][_0xe7aa('0x13')]);return _0x1b8c20(_0x49d056['error']['message']);}logger['error'](_0xe7aa('0xc'),_0x365217,_0x49d056[_0xe7aa('0x11')][_0xe7aa('0x13')]);return _0x353f91(_0x49d056[_0xe7aa('0x11')]['message']);}else{logger[_0xe7aa('0xb')](_0xe7aa('0xc'),_0x365217,'request\x20sent');_0x353f91(_0x49d056[_0xe7aa('0x14')][_0xe7aa('0x13')]);}})[_0xe7aa('0x15')](function(_0x5185b8){logger[_0xe7aa('0x11')](_0xe7aa('0xc'),_0x365217,_0x5185b8);_0x1b8c20(_0x5185b8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 57e74f8..b27d67a 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 _0x4ac9=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','create','put','update','delete','/:id','destroy','util','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x2aeb8f,_0x127e59){var _0x2c255e=function(_0x55bc2b){while(--_0x55bc2b){_0x2aeb8f['push'](_0x2aeb8f['shift']());}};_0x2c255e(++_0x127e59);}(_0x4ac9,0xe9));var _0x94ac=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x4ac9[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require(_0x94ac('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94ac('0x1'));var router=express[_0x94ac('0x2')]();var fs_extra=require(_0x94ac('0x3'));var auth=require(_0x94ac('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x94ac('0x5'));router[_0x94ac('0x6')]('/',auth[_0x94ac('0x7')](),controller[_0x94ac('0x8')]);router[_0x94ac('0x6')]('/:id',auth[_0x94ac('0x7')](),controller[_0x94ac('0x9')]);router['get'](_0x94ac('0xa'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xb')]);router[_0x94ac('0x6')](_0x94ac('0xc'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xd')]);router[_0x94ac('0x6')](_0x94ac('0xe'),auth[_0x94ac('0x7')](),controller[_0x94ac('0xf')]);router['post']('/',auth[_0x94ac('0x7')](),controller[_0x94ac('0x10')]);router[_0x94ac('0x11')]('/:id',auth[_0x94ac('0x7')](),controller[_0x94ac('0x12')]);router[_0x94ac('0x13')](_0x94ac('0x14'),auth[_0x94ac('0x7')](),controller[_0x94ac('0x15')]);module['exports']=router; \ No newline at end of file +var _0x260e=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','exports','multer'];(function(_0x478b69,_0x400e32){var _0x4fee60=function(_0x211b5e){while(--_0x211b5e){_0x478b69['push'](_0x478b69['shift']());}};_0x4fee60(++_0x400e32);}(_0x260e,0x1b9));var _0xe260=function(_0x14bba8,_0x586dde){_0x14bba8=_0x14bba8-0x0;var _0x5b9370=_0x260e[_0x14bba8];return _0x5b9370;};'use strict';var multer=require(_0xe260('0x0'));var util=require(_0xe260('0x1'));var path=require(_0xe260('0x2'));var timeout=require(_0xe260('0x3'));var express=require(_0xe260('0x4'));var router=express[_0xe260('0x5')]();var fs_extra=require(_0xe260('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe260('0x7'));var config=require(_0xe260('0x8'));var controller=require(_0xe260('0x9'));router[_0xe260('0xa')]('/',auth[_0xe260('0xb')](),controller[_0xe260('0xc')]);router[_0xe260('0xa')](_0xe260('0xd'),auth['isAuthenticated'](),controller[_0xe260('0xe')]);router[_0xe260('0xa')](_0xe260('0xf'),auth[_0xe260('0xb')](),controller[_0xe260('0x10')]);router[_0xe260('0xa')]('/:id/run',auth[_0xe260('0xb')](),controller[_0xe260('0x11')]);router[_0xe260('0xa')](_0xe260('0x12'),auth[_0xe260('0xb')](),controller[_0xe260('0x13')]);router[_0xe260('0x14')]('/',auth['isAuthenticated'](),controller[_0xe260('0x15')]);router[_0xe260('0x16')]('/:id',auth[_0xe260('0xb')](),controller[_0xe260('0x17')]);router[_0xe260('0x18')](_0xe260('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe260('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1655a67..b2c6058 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 _0xaaf6=['STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','moment'];(function(_0xd6dd72,_0x495753){var _0xa712a2=function(_0x43f66f){while(--_0x43f66f){_0xd6dd72['push'](_0xd6dd72['shift']());}};_0xa712a2(++_0x495753);}(_0xaaf6,0x128));var _0x6aaf=function(_0x53b6f0,_0x134603){_0x53b6f0=_0x53b6f0-0x0;var _0xcbc09d=_0xaaf6[_0x53b6f0];return _0xcbc09d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6aaf('0x0'));module['exports']={'name':{'type':Sequelize[_0x6aaf('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x6aaf('0x2')](_0x6aaf('0x3'),_0x6aaf('0x4'),_0x6aaf('0x5')),'allowNull':![],'defaultValue':_0x6aaf('0x3')},'savename':{'type':Sequelize[_0x6aaf('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6aaf('0x6')]},'endDate':{'type':Sequelize[_0x6aaf('0x6')]},'status':{'type':Sequelize[_0x6aaf('0x1')],'defaultValue':_0x6aaf('0x7')},'type':{'type':Sequelize[_0x6aaf('0x2')](_0x6aaf('0x8'),_0x6aaf('0x9')),'allowNull':![],'defaultValue':_0x6aaf('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x6aaf('0xa')]},'reportType':{'type':Sequelize[_0x6aaf('0x1')]}}; \ No newline at end of file +var _0x9f59=['pdf','xlsx','DATE','Loading','manual','scheduled','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x447c3c,_0x2b2d9d){var _0x4ee860=function(_0x961a17){while(--_0x961a17){_0x447c3c['push'](_0x447c3c['shift']());}};_0x4ee860(++_0x2b2d9d);}(_0x9f59,0x14a));var _0x99f5=function(_0x105689,_0x2d69f8){_0x105689=_0x105689-0x0;var _0x2bf1ca=_0x9f59[_0x105689];return _0x2bf1ca;};'use strict';var Sequelize=require(_0x99f5('0x0'));var moment=require(_0x99f5('0x1'));module[_0x99f5('0x2')]={'name':{'type':Sequelize[_0x99f5('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x99f5('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x99f5('0x4')](_0x99f5('0x5'),_0x99f5('0x6'),_0x99f5('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x99f5('0x8')]},'endDate':{'type':Sequelize[_0x99f5('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x99f5('0x9')},'type':{'type':Sequelize['ENUM'](_0x99f5('0xa'),_0x99f5('0xb')),'allowNull':![],'defaultValue':_0x99f5('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 845c40e..50d80de 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 _0x86ea=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','AnalyticExtractedReport','findAll','rows','catch','show','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','output','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis'];(function(_0x30570d,_0x5c2202){var _0x4feb88=function(_0x28d335){while(--_0x28d335){_0x30570d['push'](_0x30570d['shift']());}};_0x4feb88(++_0x5c2202);}(_0x86ea,0x16b));var _0xa86e=function(_0xd031fb,_0x33009d){_0xd031fb=_0xd031fb-0x0;var _0x5c513f=_0x86ea[_0xd031fb];return _0x5c513f;};'use strict';var emlformat=require(_0xa86e('0x0'));var rimraf=require(_0xa86e('0x1'));var zipdir=require(_0xa86e('0x2'));var jsonpatch=require(_0xa86e('0x3'));var rp=require('request-promise');var moment=require(_0xa86e('0x4'));var BPromise=require(_0xa86e('0x5'));var Mustache=require(_0xa86e('0x6'));var util=require(_0xa86e('0x7'));var path=require(_0xa86e('0x8'));var sox=require(_0xa86e('0x9'));var csv=require('to-csv');var ejs=require(_0xa86e('0xa'));var fs=require('fs');var fs_extra=require(_0xa86e('0xb'));var _=require(_0xa86e('0xc'));var squel=require('squel');var crypto=require(_0xa86e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa86e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa86e('0xf'));var Redis=require(_0xa86e('0x10'));var authService=require(_0xa86e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa86e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa86e('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd7f557,_0x2bc30d){_0x2bc30d=_0x2bc30d||0xcc;return function(_0x85b3c){if(_0x85b3c){return _0xd7f557['sendStatus'](_0x2bc30d);}return _0xd7f557[_0xa86e('0x14')](_0x2bc30d)[_0xa86e('0x15')]();};}function respondWithResult(_0x51c791,_0x13065e){_0x13065e=_0x13065e||0xc8;return function(_0x5718d7){if(_0x5718d7){return _0x51c791[_0xa86e('0x14')](_0x13065e)[_0xa86e('0x16')](_0x5718d7);}};}function respondWithFilteredResult(_0x2ad980,_0x17b34e){return function(_0x56ef4b){if(_0x56ef4b){var _0x4790f1=typeof _0x17b34e[_0xa86e('0x17')]==='undefined'&&typeof _0x17b34e[_0xa86e('0x18')]===_0xa86e('0x19');var _0x279a04=_0x56ef4b['count'];var _0xc73d87=_0x4790f1?0x0:_0x17b34e[_0xa86e('0x17')];var _0x3a9931=_0x4790f1?_0x56ef4b['count']:_0x17b34e[_0xa86e('0x17')]+_0x17b34e[_0xa86e('0x18')];var _0x2c3856;if(_0x3a9931>=_0x279a04){_0x3a9931=_0x279a04;_0x2c3856=0xc8;}else{_0x2c3856=0xce;}_0x2ad980['status'](_0x2c3856);return _0x2ad980[_0xa86e('0x1a')](_0xa86e('0x1b'),_0xc73d87+'-'+_0x3a9931+'/'+_0x279a04)[_0xa86e('0x16')](_0x56ef4b);}return null;};}function patchUpdates(_0x2679fc){return function(_0x518e1a){try{jsonpatch[_0xa86e('0x1c')](_0x518e1a,_0x2679fc,!![]);}catch(_0x36e425){return BPromise[_0xa86e('0x1d')](_0x36e425);}return _0x518e1a[_0xa86e('0x1e')]();};}function saveUpdates(_0x244b83,_0x9fa30c){return function(_0x1df386){if(_0x1df386){return _0x1df386['update'](_0x244b83)[_0xa86e('0x1f')](function(_0x93850f){return _0x93850f;});}return null;};}function removeEntity(_0x1bef3c,_0x58392c){return function(_0x1f9902){if(_0x1f9902){return _0x1f9902['destroy']()['then'](function(){var _0xc82683=_0x1f9902[_0xa86e('0x20')]({'plain':!![]});var _0x56c2e9='ExtractedReports';return db[_0xa86e('0x21')][_0xa86e('0x22')]({'where':{'type':_0x56c2e9,'resourceId':_0xc82683['id']}})['then'](function(){return _0x1f9902;});})[_0xa86e('0x1f')](function(){_0x1bef3c[_0xa86e('0x14')](0xcc)[_0xa86e('0x15')]();});}};}function handleEntityNotFound(_0x5d812a,_0x274250){return function(_0x134dce){if(!_0x134dce){_0x5d812a[_0xa86e('0x23')](0x194);}return _0x134dce;};}function handleError(_0x26fd7b,_0xc33c3f){_0xc33c3f=_0xc33c3f||0x1f4;return function(_0x2ead7f){logger[_0xa86e('0x24')](_0x2ead7f['stack']);if(_0x2ead7f[_0xa86e('0x25')]){delete _0x2ead7f[_0xa86e('0x25')];}_0x26fd7b[_0xa86e('0x14')](_0xc33c3f)[_0xa86e('0x26')](_0x2ead7f);};}exports[_0xa86e('0x27')]=function(_0x1b613c,_0x2bff49){var _0x123c8e={},_0x539dec={},_0x1e7af2={'count':0x0,'rows':[]};var _0x38c601=_['map'](db['AnalyticExtractedReport'][_0xa86e('0x28')],function(_0xda05e5){return{'name':_0xda05e5[_0xa86e('0x29')],'type':_0xda05e5['type'][_0xa86e('0x2a')]};});_0x539dec[_0xa86e('0x2b')]=_[_0xa86e('0x2c')](_0x38c601,_0xa86e('0x25'));_0x539dec[_0xa86e('0x2d')]=_[_0xa86e('0x2e')](_0x1b613c[_0xa86e('0x2d')]);_0x539dec[_0xa86e('0x2f')]=_[_0xa86e('0x30')](_0x539dec[_0xa86e('0x2b')],_0x539dec[_0xa86e('0x2d')]);_0x123c8e[_0xa86e('0x31')]=_['intersection'](_0x539dec[_0xa86e('0x2b')],qs[_0xa86e('0x32')](_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x32')]));_0x123c8e[_0xa86e('0x31')]=_0x123c8e[_0xa86e('0x31')][_0xa86e('0x33')]?_0x123c8e[_0xa86e('0x31')]:_0x539dec['model'];if(!_0x1b613c[_0xa86e('0x2d')]['hasOwnProperty'](_0xa86e('0x34'))){_0x123c8e[_0xa86e('0x18')]=qs[_0xa86e('0x18')](_0x1b613c['query']['limit']);_0x123c8e[_0xa86e('0x17')]=qs[_0xa86e('0x17')](_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x17')]);}_0x123c8e[_0xa86e('0x35')]=qs[_0xa86e('0x36')](_0x1b613c[_0xa86e('0x2d')]['sort']);_0x123c8e[_0xa86e('0x37')]=qs[_0xa86e('0x2f')](_[_0xa86e('0x38')](_0x1b613c['query'],_0x539dec[_0xa86e('0x2f')]),_0x38c601);if(_0x1b613c[_0xa86e('0x2d')][_0xa86e('0x39')]){_0x123c8e[_0xa86e('0x37')]=_[_0xa86e('0x3a')](_0x123c8e['where'],{'$or':_[_0xa86e('0x2c')](_0x38c601,function(_0x5cc7a9){if(_0x5cc7a9['type']!==_0xa86e('0x3b')){var _0x5196b0={};_0x5196b0[_0x5cc7a9[_0xa86e('0x25')]]={'$like':'%'+_0x1b613c['query'][_0xa86e('0x39')]+'%'};return _0x5196b0;}})});}_0x123c8e=_[_0xa86e('0x3a')]({},_0x123c8e,_0x1b613c[_0xa86e('0x3c')]);var _0x3d5e7e={'where':_0x123c8e[_0xa86e('0x37')]};return db['AnalyticExtractedReport'][_0xa86e('0x3d')](_0x3d5e7e)['then'](function(_0x433e8f){_0x1e7af2[_0xa86e('0x3d')]=_0x433e8f;if(_0x1b613c[_0xa86e('0x2d')]['includeAll']){_0x123c8e[_0xa86e('0x3e')]=[{'all':!![]}];}return db[_0xa86e('0x3f')][_0xa86e('0x40')](_0x123c8e);})[_0xa86e('0x1f')](function(_0x1c3bde){_0x1e7af2[_0xa86e('0x41')]=_0x1c3bde;return _0x1e7af2;})[_0xa86e('0x1f')](respondWithFilteredResult(_0x2bff49,_0x123c8e))[_0xa86e('0x42')](handleError(_0x2bff49,null));};exports[_0xa86e('0x43')]=function(_0x149633,_0x3aba37){var _0x7c51da={'raw':!![],'where':{'id':_0x149633[_0xa86e('0x44')]['id']}},_0x4fef0f={};_0x4fef0f[_0xa86e('0x2b')]=_[_0xa86e('0x2e')](db['AnalyticExtractedReport'][_0xa86e('0x28')]);_0x4fef0f[_0xa86e('0x2d')]=_['keys'](_0x149633[_0xa86e('0x2d')]);_0x4fef0f[_0xa86e('0x2f')]=_[_0xa86e('0x30')](_0x4fef0f[_0xa86e('0x2b')],_0x4fef0f[_0xa86e('0x2d')]);_0x7c51da[_0xa86e('0x31')]=_['intersection'](_0x4fef0f['model'],qs[_0xa86e('0x32')](_0x149633[_0xa86e('0x2d')][_0xa86e('0x32')]));_0x7c51da[_0xa86e('0x31')]=_0x7c51da[_0xa86e('0x31')][_0xa86e('0x33')]?_0x7c51da['attributes']:_0x4fef0f[_0xa86e('0x2b')];if(_0x149633[_0xa86e('0x2d')][_0xa86e('0x45')]){_0x7c51da[_0xa86e('0x3e')]=[{'all':!![]}];}_0x7c51da=_[_0xa86e('0x3a')]({},_0x7c51da,_0x149633[_0xa86e('0x3c')]);return db['AnalyticExtractedReport'][_0xa86e('0x46')](_0x7c51da)[_0xa86e('0x1f')](handleEntityNotFound(_0x3aba37,null))[_0xa86e('0x1f')](respondWithResult(_0x3aba37,null))[_0xa86e('0x42')](handleError(_0x3aba37,null));};exports[_0xa86e('0x47')]=function(_0x5421c6,_0x3729d6){return db[_0xa86e('0x3f')]['create'](_0x5421c6['body'],{})['then'](function(_0x359d89){var _0x3aaafa=_0x5421c6['user'][_0xa86e('0x20')]({'plain':!![]});if(!_0x3aaafa)throw new Error(_0xa86e('0x48'));if(_0x3aaafa[_0xa86e('0x49')]===_0xa86e('0x4a')){var _0x396403=_0x359d89[_0xa86e('0x20')]({'plain':!![]});var _0xb28e1a=_0xa86e('0x4b');return db[_0xa86e('0x4c')]['find']({'where':{'name':_0xb28e1a,'userProfileId':_0x3aaafa[_0xa86e('0x4d')]},'raw':!![]})[_0xa86e('0x1f')](function(_0x58f871){if(_0x58f871&&_0x58f871[_0xa86e('0x4e')]===0x0){return db[_0xa86e('0x21')][_0xa86e('0x47')]({'name':_0x396403[_0xa86e('0x25')],'resourceId':_0x396403['id'],'type':_0x58f871['name'],'sectionId':_0x58f871['id']},{})[_0xa86e('0x1f')](function(){return _0x359d89;});}else{return _0x359d89;}})['catch'](function(_0xf7b460){logger[_0xa86e('0x24')](_0xa86e('0x4f'),_0xf7b460);throw _0xf7b460;});}return _0x359d89;})['then'](respondWithResult(_0x3729d6,0xc9))['catch'](handleError(_0x3729d6,null));};exports[_0xa86e('0x50')]=function(_0x36dad7,_0x1b0b6c){if(_0x36dad7[_0xa86e('0x51')]['id']){delete _0x36dad7[_0xa86e('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xa86e('0x46')]({'where':{'id':_0x36dad7[_0xa86e('0x44')]['id']}})[_0xa86e('0x1f')](handleEntityNotFound(_0x1b0b6c,null))[_0xa86e('0x1f')](saveUpdates(_0x36dad7[_0xa86e('0x51')],null))[_0xa86e('0x1f')](respondWithResult(_0x1b0b6c,null))[_0xa86e('0x42')](handleError(_0x1b0b6c,null));};exports[_0xa86e('0x22')]=function(_0x25351e,_0x143856){return db[_0xa86e('0x3f')][_0xa86e('0x46')]({'where':{'id':_0x25351e['params']['id']}})[_0xa86e('0x1f')](handleEntityNotFound(_0x143856,null))[_0xa86e('0x1f')](removeEntity(_0x143856,null))[_0xa86e('0x42')](handleError(_0x143856,null));};exports[_0xa86e('0x52')]=function(_0x42c27e,_0x5e5580,_0x38c9c8){return db[_0xa86e('0x3f')][_0xa86e('0x46')]({'where':{'id':_0x42c27e[_0xa86e('0x44')]['id']},'attributes':[_0xa86e('0x25'),_0xa86e('0x53'),'savename',_0xa86e('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x5e5580,null))[_0xa86e('0x1f')](function(_0x425e3d){if(_0x425e3d){if(!fs['existsSync'](path[_0xa86e('0x55')](config[_0xa86e('0x56')],_0xa86e('0x57'),_0x425e3d[_0xa86e('0x58')]))){throw new db[(_0xa86e('0x59'))][(_0xa86e('0x5a'))](_0xa86e('0x5b'));}if(_0x42c27e[_0xa86e('0x2d')][_0xa86e('0x5c')]){return _0x5e5580[_0xa86e('0x23')](0xc8);}return _0x5e5580[_0xa86e('0x52')](path[_0xa86e('0x55')](config[_0xa86e('0x56')],_0xa86e('0x57'),_0x425e3d[_0xa86e('0x58')]),util['format'](_0xa86e('0x5d'),_0x425e3d['basename']||_0x425e3d[_0xa86e('0x25')],_0x425e3d[_0xa86e('0x54')][_0xa86e('0x5e')]()));}})['catch'](handleError(_0x5e5580,null));}; \ No newline at end of file +var _0x6e1a=['sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','join','root','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','ExtractedReports','UserProfileResource','stack','name','send','AnalyticExtractedReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x544d4e,_0x13ccf9){var _0x57ff5a=function(_0x479bc3){while(--_0x479bc3){_0x544d4e['push'](_0x544d4e['shift']());}};_0x57ff5a(++_0x13ccf9);}(_0x6e1a,0x81));var _0xa6e1=function(_0x59902b,_0x348717){_0x59902b=_0x59902b-0x0;var _0x134a72=_0x6e1a[_0x59902b];return _0x134a72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6e1('0x0'));var zipdir=require(_0xa6e1('0x1'));var jsonpatch=require(_0xa6e1('0x2'));var rp=require('request-promise');var moment=require(_0xa6e1('0x3'));var BPromise=require(_0xa6e1('0x4'));var Mustache=require(_0xa6e1('0x5'));var util=require(_0xa6e1('0x6'));var path=require(_0xa6e1('0x7'));var sox=require(_0xa6e1('0x8'));var csv=require(_0xa6e1('0x9'));var ejs=require(_0xa6e1('0xa'));var fs=require('fs');var fs_extra=require(_0xa6e1('0xb'));var _=require(_0xa6e1('0xc'));var squel=require(_0xa6e1('0xd'));var crypto=require(_0xa6e1('0xe'));var jsforce=require(_0xa6e1('0xf'));var deskjs=require(_0xa6e1('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6e1('0x11'));var Papa=require(_0xa6e1('0x12'));var Redis=require(_0xa6e1('0x13'));var authService=require(_0xa6e1('0x14'));var qs=require(_0xa6e1('0x15'));var as=require(_0xa6e1('0x16'));var hardwareService=require(_0xa6e1('0x17'));var logger=require(_0xa6e1('0x18'))('api');var utils=require(_0xa6e1('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa6e1('0x1a'))['db'];function respondWithStatusCode(_0x30bdc8,_0x5013a5){_0x5013a5=_0x5013a5||0xcc;return function(_0x11283d){if(_0x11283d){return _0x30bdc8[_0xa6e1('0x1b')](_0x5013a5);}return _0x30bdc8[_0xa6e1('0x1c')](_0x5013a5)['end']();};}function respondWithResult(_0x325c1c,_0x442fbe){_0x442fbe=_0x442fbe||0xc8;return function(_0x9c0250){if(_0x9c0250){return _0x325c1c[_0xa6e1('0x1c')](_0x442fbe)[_0xa6e1('0x1d')](_0x9c0250);}};}function respondWithFilteredResult(_0x5150c2,_0x32594d){return function(_0x3d0080){if(_0x3d0080){var _0x243af9=typeof _0x32594d[_0xa6e1('0x1e')]===_0xa6e1('0x1f')&&typeof _0x32594d[_0xa6e1('0x20')]===_0xa6e1('0x1f');var _0x5774e0=_0x3d0080['count'];var _0xe5651d=_0x243af9?0x0:_0x32594d[_0xa6e1('0x1e')];var _0x475281=_0x243af9?_0x3d0080[_0xa6e1('0x21')]:_0x32594d[_0xa6e1('0x1e')]+_0x32594d[_0xa6e1('0x20')];var _0x293811;if(_0x475281>=_0x5774e0){_0x475281=_0x5774e0;_0x293811=0xc8;}else{_0x293811=0xce;}_0x5150c2[_0xa6e1('0x1c')](_0x293811);return _0x5150c2[_0xa6e1('0x22')](_0xa6e1('0x23'),_0xe5651d+'-'+_0x475281+'/'+_0x5774e0)[_0xa6e1('0x1d')](_0x3d0080);}return null;};}function patchUpdates(_0x15d24b){return function(_0x36b830){try{jsonpatch[_0xa6e1('0x24')](_0x36b830,_0x15d24b,!![]);}catch(_0x24d7e8){return BPromise['reject'](_0x24d7e8);}return _0x36b830[_0xa6e1('0x25')]();};}function saveUpdates(_0x27e00e,_0x43965f){return function(_0xff9678){if(_0xff9678){return _0xff9678[_0xa6e1('0x26')](_0x27e00e)['then'](function(_0x20278c){return _0x20278c;});}return null;};}function removeEntity(_0x44c74d,_0x53b5c2){return function(_0x4792bf){if(_0x4792bf){return _0x4792bf[_0xa6e1('0x27')]()[_0xa6e1('0x28')](function(){var _0x4ec178=_0x4792bf['get']({'plain':!![]});var _0x14ee13=_0xa6e1('0x29');return db[_0xa6e1('0x2a')][_0xa6e1('0x27')]({'where':{'type':_0x14ee13,'resourceId':_0x4ec178['id']}})[_0xa6e1('0x28')](function(){return _0x4792bf;});})[_0xa6e1('0x28')](function(){_0x44c74d[_0xa6e1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bbf9d,_0x228ca5){return function(_0x5d8eaf){if(!_0x5d8eaf){_0x4bbf9d[_0xa6e1('0x1b')](0x194);}return _0x5d8eaf;};}function handleError(_0x202751,_0x18cff5){_0x18cff5=_0x18cff5||0x1f4;return function(_0x55aeb2){logger['error'](_0x55aeb2[_0xa6e1('0x2b')]);if(_0x55aeb2[_0xa6e1('0x2c')]){delete _0x55aeb2[_0xa6e1('0x2c')];}_0x202751[_0xa6e1('0x1c')](_0x18cff5)[_0xa6e1('0x2d')](_0x55aeb2);};}exports['index']=function(_0x23372f,_0x22bb35){var _0x2d7c7b={},_0x25bade={},_0x4c838d={'count':0x0,'rows':[]};var _0xdbade5=_['map'](db[_0xa6e1('0x2e')][_0xa6e1('0x2f')],function(_0x325b38){return{'name':_0x325b38[_0xa6e1('0x30')],'type':_0x325b38[_0xa6e1('0x31')]['key']};});_0x25bade[_0xa6e1('0x32')]=_[_0xa6e1('0x33')](_0xdbade5,_0xa6e1('0x2c'));_0x25bade[_0xa6e1('0x34')]=_[_0xa6e1('0x35')](_0x23372f['query']);_0x25bade['filters']=_[_0xa6e1('0x36')](_0x25bade[_0xa6e1('0x32')],_0x25bade['query']);_0x2d7c7b[_0xa6e1('0x37')]=_['intersection'](_0x25bade['model'],qs[_0xa6e1('0x38')](_0x23372f[_0xa6e1('0x34')][_0xa6e1('0x38')]));_0x2d7c7b['attributes']=_0x2d7c7b['attributes'][_0xa6e1('0x39')]?_0x2d7c7b[_0xa6e1('0x37')]:_0x25bade['model'];if(!_0x23372f['query'][_0xa6e1('0x3a')](_0xa6e1('0x3b'))){_0x2d7c7b[_0xa6e1('0x20')]=qs[_0xa6e1('0x20')](_0x23372f[_0xa6e1('0x34')][_0xa6e1('0x20')]);_0x2d7c7b[_0xa6e1('0x1e')]=qs['offset'](_0x23372f[_0xa6e1('0x34')][_0xa6e1('0x1e')]);}_0x2d7c7b[_0xa6e1('0x3c')]=qs[_0xa6e1('0x3d')](_0x23372f[_0xa6e1('0x34')]['sort']);_0x2d7c7b[_0xa6e1('0x3e')]=qs[_0xa6e1('0x3f')](_[_0xa6e1('0x40')](_0x23372f[_0xa6e1('0x34')],_0x25bade[_0xa6e1('0x3f')]),_0xdbade5);if(_0x23372f[_0xa6e1('0x34')][_0xa6e1('0x41')]){_0x2d7c7b[_0xa6e1('0x3e')]=_[_0xa6e1('0x42')](_0x2d7c7b[_0xa6e1('0x3e')],{'$or':_['map'](_0xdbade5,function(_0x400eea){if(_0x400eea[_0xa6e1('0x31')]!=='VIRTUAL'){var _0x1d3895={};_0x1d3895[_0x400eea['name']]={'$like':'%'+_0x23372f[_0xa6e1('0x34')][_0xa6e1('0x41')]+'%'};return _0x1d3895;}})});}_0x2d7c7b=_[_0xa6e1('0x42')]({},_0x2d7c7b,_0x23372f[_0xa6e1('0x43')]);var _0x287ca0={'where':_0x2d7c7b['where']};return db[_0xa6e1('0x2e')][_0xa6e1('0x21')](_0x287ca0)[_0xa6e1('0x28')](function(_0x320b60){_0x4c838d[_0xa6e1('0x21')]=_0x320b60;if(_0x23372f['query'][_0xa6e1('0x44')]){_0x2d7c7b['include']=[{'all':!![]}];}return db[_0xa6e1('0x2e')][_0xa6e1('0x45')](_0x2d7c7b);})[_0xa6e1('0x28')](function(_0x43a4c2){_0x4c838d['rows']=_0x43a4c2;return _0x4c838d;})[_0xa6e1('0x28')](respondWithFilteredResult(_0x22bb35,_0x2d7c7b))[_0xa6e1('0x46')](handleError(_0x22bb35,null));};exports[_0xa6e1('0x47')]=function(_0x309c01,_0x173a00){var _0x16f806={'raw':!![],'where':{'id':_0x309c01[_0xa6e1('0x48')]['id']}},_0x1eabdd={};_0x1eabdd[_0xa6e1('0x32')]=_[_0xa6e1('0x35')](db[_0xa6e1('0x2e')][_0xa6e1('0x2f')]);_0x1eabdd['query']=_['keys'](_0x309c01['query']);_0x1eabdd['filters']=_['intersection'](_0x1eabdd['model'],_0x1eabdd[_0xa6e1('0x34')]);_0x16f806[_0xa6e1('0x37')]=_[_0xa6e1('0x36')](_0x1eabdd[_0xa6e1('0x32')],qs[_0xa6e1('0x38')](_0x309c01[_0xa6e1('0x34')][_0xa6e1('0x38')]));_0x16f806[_0xa6e1('0x37')]=_0x16f806[_0xa6e1('0x37')]['length']?_0x16f806[_0xa6e1('0x37')]:_0x1eabdd[_0xa6e1('0x32')];if(_0x309c01['query'][_0xa6e1('0x44')]){_0x16f806['include']=[{'all':!![]}];}_0x16f806=_[_0xa6e1('0x42')]({},_0x16f806,_0x309c01[_0xa6e1('0x43')]);return db[_0xa6e1('0x2e')][_0xa6e1('0x49')](_0x16f806)['then'](handleEntityNotFound(_0x173a00,null))['then'](respondWithResult(_0x173a00,null))['catch'](handleError(_0x173a00,null));};exports[_0xa6e1('0x4a')]=function(_0x44af34,_0x1daabf){return db[_0xa6e1('0x2e')]['create'](_0x44af34[_0xa6e1('0x4b')],{})[_0xa6e1('0x28')](function(_0xfce86b){var _0x24b6e3=_0x44af34[_0xa6e1('0x4c')][_0xa6e1('0x4d')]({'plain':!![]});if(!_0x24b6e3)throw new Error(_0xa6e1('0x4e'));if(_0x24b6e3[_0xa6e1('0x4f')]===_0xa6e1('0x4c')){var _0x1ba522=_0xfce86b[_0xa6e1('0x4d')]({'plain':!![]});var _0x5c9f1e=_0xa6e1('0x29');return db[_0xa6e1('0x50')][_0xa6e1('0x49')]({'where':{'name':_0x5c9f1e,'userProfileId':_0x24b6e3['userProfileId']},'raw':!![]})[_0xa6e1('0x28')](function(_0x560714){if(_0x560714&&_0x560714['autoAssociation']===0x0){return db['UserProfileResource'][_0xa6e1('0x4a')]({'name':_0x1ba522[_0xa6e1('0x2c')],'resourceId':_0x1ba522['id'],'type':_0x560714['name'],'sectionId':_0x560714['id']},{})[_0xa6e1('0x28')](function(){return _0xfce86b;});}else{return _0xfce86b;}})[_0xa6e1('0x46')](function(_0x381d44){logger[_0xa6e1('0x51')](_0xa6e1('0x52'),_0x381d44);throw _0x381d44;});}return _0xfce86b;})[_0xa6e1('0x28')](respondWithResult(_0x1daabf,0xc9))[_0xa6e1('0x46')](handleError(_0x1daabf,null));};exports[_0xa6e1('0x26')]=function(_0x1e36ae,_0x1d6718){if(_0x1e36ae[_0xa6e1('0x4b')]['id']){delete _0x1e36ae[_0xa6e1('0x4b')]['id'];}return db[_0xa6e1('0x2e')][_0xa6e1('0x49')]({'where':{'id':_0x1e36ae['params']['id']}})['then'](handleEntityNotFound(_0x1d6718,null))[_0xa6e1('0x28')](saveUpdates(_0x1e36ae[_0xa6e1('0x4b')],null))['then'](respondWithResult(_0x1d6718,null))['catch'](handleError(_0x1d6718,null));};exports[_0xa6e1('0x27')]=function(_0x146473,_0x500372){return db[_0xa6e1('0x2e')][_0xa6e1('0x49')]({'where':{'id':_0x146473[_0xa6e1('0x48')]['id']}})['then'](handleEntityNotFound(_0x500372,null))['then'](removeEntity(_0x500372,null))[_0xa6e1('0x46')](handleError(_0x500372,null));};exports[_0xa6e1('0x53')]=function(_0x3327cc,_0x50c146,_0x4ebd33){return db[_0xa6e1('0x2e')][_0xa6e1('0x49')]({'where':{'id':_0x3327cc['params']['id']},'attributes':[_0xa6e1('0x2c'),_0xa6e1('0x54'),_0xa6e1('0x55'),_0xa6e1('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x50c146,null))[_0xa6e1('0x28')](function(_0x34b4ce){if(_0x34b4ce){if(!fs['existsSync'](path[_0xa6e1('0x57')](config[_0xa6e1('0x58')],'server/files/reports',_0x34b4ce[_0xa6e1('0x55')]))){throw new db['Sequelize']['ValidationError'](_0xa6e1('0x59'));}if(_0x3327cc['query'][_0xa6e1('0x5a')]){return _0x50c146['sendStatus'](0xc8);}return _0x50c146[_0xa6e1('0x53')](path[_0xa6e1('0x57')](config['root'],_0xa6e1('0x5b'),_0x34b4ce[_0xa6e1('0x55')]),util[_0xa6e1('0x5c')](_0xa6e1('0x5d'),_0x34b4ce[_0xa6e1('0x54')]||_0x34b4ce[_0xa6e1('0x2c')],_0x34b4ce[_0xa6e1('0x56')][_0xa6e1('0x5e')]()));}})[_0xa6e1('0x46')](handleError(_0x50c146,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7f69711..1ad1744 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 _0x179a=['api','moment','request-promise','path','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','lodash','util','../../config/logger'];(function(_0x3c789f,_0x9dacd1){var _0x3e8568=function(_0x456552){while(--_0x456552){_0x3c789f['push'](_0x3c789f['shift']());}};_0x3e8568(++_0x9dacd1);}(_0x179a,0x1a1));var _0xa179=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x179a[_0x403f5f];return _0x15b1cd;};'use strict';var _=require(_0xa179('0x0'));var util=require(_0xa179('0x1'));var logger=require(_0xa179('0x2'))(_0xa179('0x3'));var moment=require(_0xa179('0x4'));var BPromise=require('bluebird');var rp=require(_0xa179('0x5'));var fs=require('fs');var path=require(_0xa179('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa179('0x7'));module[_0xa179('0x8')]=function(_0xccaaac,_0x2ccec6){return _0xccaaac['define'](_0xa179('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0725=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x0725,0xf7));var _0x5072=function(_0x4bd298,_0x501cbb){_0x4bd298=_0x4bd298-0x0;var _0x3e3ed5=_0x0725[_0x4bd298];return _0x3e3ed5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5072('0x0'))(_0x5072('0x1'));var moment=require(_0x5072('0x2'));var BPromise=require(_0x5072('0x3'));var rp=require(_0x5072('0x4'));var fs=require('fs');var path=require(_0x5072('0x5'));var rimraf=require(_0x5072('0x6'));var config=require(_0x5072('0x7'));var attributes=require(_0x5072('0x8'));module[_0x5072('0x9')]=function(_0x120941,_0x206f18){return _0x120941['define'](_0x5072('0xa'),attributes,{'tableName':_0x5072('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 533bc7a..9f6e010 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 _0x79cc=['http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3632ae,_0x54fb49){var _0x3c0124=function(_0x5ba362){while(--_0x5ba362){_0x3632ae['push'](_0x3632ae['shift']());}};_0x3c0124(++_0x54fb49);}(_0x79cc,0x19a));var _0xc79c=function(_0x5c1850,_0x48bf66){_0x5c1850=_0x5c1850-0x0;var _0x236435=_0x79cc[_0x5c1850];return _0x236435;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var moment=require('moment');var BPromise=require(_0xc79c('0x2'));var rs=require(_0xc79c('0x3'));var fs=require('fs');var Redis=require(_0xc79c('0x4'));var db=require(_0xc79c('0x5'))['db'];var utils=require(_0xc79c('0x6'));var logger=require(_0xc79c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc79c('0x8'));var client=jayson[_0xc79c('0x9')][_0xc79c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x326e60,_0x55a927,_0x7e12b8){return new BPromise(function(_0x23b14c,_0x3de5ff){return client[_0xc79c('0xb')](_0x326e60,_0x7e12b8)[_0xc79c('0xc')](function(_0x1c955a){logger[_0xc79c('0xd')](_0xc79c('0xe'),_0x55a927,_0xc79c('0xf'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x55a927,_0xc79c('0xf'),JSON['stringify'](_0x1c955a));if(_0x1c955a[_0xc79c('0x10')]){if(_0x1c955a[_0xc79c('0x10')][_0xc79c('0x11')]===0x1f4){logger[_0xc79c('0x10')](_0xc79c('0xe'),_0x55a927,_0x1c955a['error']['message']);return _0x3de5ff(_0x1c955a[_0xc79c('0x10')][_0xc79c('0x12')]);}logger[_0xc79c('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x55a927,_0x1c955a[_0xc79c('0x10')]['message']);return _0x23b14c(_0x1c955a[_0xc79c('0x10')]['message']);}else{logger[_0xc79c('0xd')](_0xc79c('0xe'),_0x55a927,_0xc79c('0xf'));_0x23b14c(_0x1c955a[_0xc79c('0x13')][_0xc79c('0x12')]);}})[_0xc79c('0x14')](function(_0x485f82){logger['error'](_0xc79c('0xe'),_0x55a927,_0x485f82);_0x3de5ff(_0x485f82);});});} \ No newline at end of file +var _0x02b3=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug'];(function(_0x1f1e0b,_0x2f2895){var _0x5975a6=function(_0x543291){while(--_0x543291){_0x1f1e0b['push'](_0x1f1e0b['shift']());}};_0x5975a6(++_0x2f2895);}(_0x02b3,0x9f));var _0x302b=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x02b3[_0x1b5aea];return _0x51cae9;};'use strict';var _=require(_0x302b('0x0'));var util=require(_0x302b('0x1'));var moment=require(_0x302b('0x2'));var BPromise=require(_0x302b('0x3'));var rs=require(_0x302b('0x4'));var fs=require('fs');var Redis=require(_0x302b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x302b('0x6'));var logger=require(_0x302b('0x7'))(_0x302b('0x8'));var config=require(_0x302b('0x9'));var jayson=require(_0x302b('0xa'));var client=jayson[_0x302b('0xb')][_0x302b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x389b65,_0x51a748,_0x2d22af){return new BPromise(function(_0x202a8b,_0x5a92b4){return client[_0x302b('0xd')](_0x389b65,_0x2d22af)['then'](function(_0x5bccff){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x51a748,_0x302b('0xe'));logger[_0x302b('0xf')](_0x302b('0x10'),_0x51a748,_0x302b('0xe'),JSON[_0x302b('0x11')](_0x5bccff));if(_0x5bccff[_0x302b('0x12')]){if(_0x5bccff[_0x302b('0x12')][_0x302b('0x13')]===0x1f4){logger['error'](_0x302b('0x14'),_0x51a748,_0x5bccff['error'][_0x302b('0x15')]);return _0x5a92b4(_0x5bccff[_0x302b('0x12')][_0x302b('0x15')]);}logger[_0x302b('0x12')](_0x302b('0x14'),_0x51a748,_0x5bccff[_0x302b('0x12')][_0x302b('0x15')]);return _0x202a8b(_0x5bccff[_0x302b('0x12')][_0x302b('0x15')]);}else{logger[_0x302b('0x16')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x51a748,_0x302b('0xe'));_0x202a8b(_0x5bccff[_0x302b('0x17')][_0x302b('0x15')]);}})[_0x302b('0x18')](function(_0x479cf1){logger['error'](_0x302b('0x14'),_0x51a748,_0x479cf1);_0x5a92b4(_0x479cf1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 75f920e..6b42dd0 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 _0x20d3=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','isAuthenticated','show','download','post','create','/:id','update'];(function(_0x2d10a6,_0x334b39){var _0x18b66e=function(_0x404a26){while(--_0x404a26){_0x2d10a6['push'](_0x2d10a6['shift']());}};_0x18b66e(++_0x334b39);}(_0x20d3,0xa4));var _0x320d=function(_0x1a4835,_0x546c72){_0x1a4835=_0x1a4835-0x0;var _0x1af593=_0x20d3[_0x1a4835];return _0x1af593;};'use strict';var multer=require(_0x320d('0x0'));var util=require(_0x320d('0x1'));var path=require(_0x320d('0x2'));var timeout=require(_0x320d('0x3'));var express=require(_0x320d('0x4'));var router=express[_0x320d('0x5')]();var fs_extra=require(_0x320d('0x6'));var auth=require(_0x320d('0x7'));var interaction=require(_0x320d('0x8'));var config=require(_0x320d('0x9'));var controller=require(_0x320d('0xa'));router[_0x320d('0xb')]('/',auth['isAuthenticated'](),controller[_0x320d('0xc')]);router[_0x320d('0xb')]('/:id',auth[_0x320d('0xd')](),controller[_0x320d('0xe')]);router[_0x320d('0xb')]('/:id/download',auth[_0x320d('0xd')](),controller[_0x320d('0xf')]);router[_0x320d('0x10')]('/',auth[_0x320d('0xd')](),controller[_0x320d('0x11')]);router['put'](_0x320d('0x12'),auth['isAuthenticated'](),controller[_0x320d('0x13')]);router[_0x320d('0x14')](_0x320d('0x12'),auth['isAuthenticated'](),controller[_0x320d('0x15')]);module[_0x320d('0x16')]=router; \ No newline at end of file +var _0x9050=['put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','download','post','create'];(function(_0x196785,_0x15c00e){var _0x4b4b11=function(_0x4418b8){while(--_0x4418b8){_0x196785['push'](_0x196785['shift']());}};_0x4b4b11(++_0x15c00e);}(_0x9050,0x17d));var _0x0905=function(_0x10edfa,_0x584b67){_0x10edfa=_0x10edfa-0x0;var _0x382234=_0x9050[_0x10edfa];return _0x382234;};'use strict';var multer=require(_0x0905('0x0'));var util=require('util');var path=require(_0x0905('0x1'));var timeout=require(_0x0905('0x2'));var express=require(_0x0905('0x3'));var router=express[_0x0905('0x4')]();var fs_extra=require(_0x0905('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0905('0x6'));var config=require(_0x0905('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0x0905('0x8')]('/',auth[_0x0905('0x9')](),controller['index']);router[_0x0905('0x8')](_0x0905('0xa'),auth[_0x0905('0x9')](),controller[_0x0905('0xb')]);router[_0x0905('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x0905('0xc')]);router[_0x0905('0xd')]('/',auth[_0x0905('0x9')](),controller[_0x0905('0xe')]);router[_0x0905('0xf')](_0x0905('0xa'),auth[_0x0905('0x9')](),controller['update']);router[_0x0905('0x10')](_0x0905('0xa'),auth[_0x0905('0x9')](),controller['destroy']);module[_0x0905('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e289264..f9c0383 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 _0xbda4=['sequelize','TEXT','STRING','BOOLEAN'];(function(_0x26ab15,_0x5575d6){var _0x574794=function(_0x537c7d){while(--_0x537c7d){_0x26ab15['push'](_0x26ab15['shift']());}};_0x574794(++_0x5575d6);}(_0xbda4,0x88));var _0x4bda=function(_0x233e13,_0x2fa2de){_0x233e13=_0x233e13-0x0;var _0x53b1a2=_0xbda4[_0x233e13];return _0x53b1a2;};'use strict';var Sequelize=require(_0x4bda('0x0'));module['exports']={'field':{'type':Sequelize[_0x4bda('0x1')]},'alias':{'type':Sequelize[_0x4bda('0x2')]},'function':{'type':Sequelize[_0x4bda('0x2')]},'format':{'type':Sequelize[_0x4bda('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4bda('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3ca=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x53594d,_0xb372ae){var _0x3b2544=function(_0x33359f){while(--_0x33359f){_0x53594d['push'](_0x53594d['shift']());}};_0x3b2544(++_0xb372ae);}(_0xf3ca,0x87));var _0xaf3c=function(_0x58f958,_0x393b50){_0x58f958=_0x58f958-0x0;var _0x19276d=_0xf3ca[_0x58f958];return _0x19276d;};'use strict';var Sequelize=require(_0xaf3c('0x0'));module['exports']={'field':{'type':Sequelize[_0xaf3c('0x1')]},'alias':{'type':Sequelize[_0xaf3c('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xaf3c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xaf3c('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d074a3f..d7ce2b1 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 _0x0940=['status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','params','find','create','body','bulkCreate','update','ids','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus'];(function(_0x5743e3,_0x4a2aab){var _0x24d100=function(_0x10737c){while(--_0x10737c){_0x5743e3['push'](_0x5743e3['shift']());}};_0x24d100(++_0x4a2aab);}(_0x0940,0x84));var _0x0094=function(_0x159849,_0x4ff62b){_0x159849=_0x159849-0x0;var _0x433b4f=_0x0940[_0x159849];return _0x433b4f;};'use strict';var emlformat=require(_0x0094('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0094('0x1'));var jsonpatch=require(_0x0094('0x2'));var rp=require(_0x0094('0x3'));var moment=require(_0x0094('0x4'));var BPromise=require(_0x0094('0x5'));var Mustache=require('mustache');var util=require(_0x0094('0x6'));var path=require(_0x0094('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0094('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0094('0x9'));var squel=require(_0x0094('0xa'));var crypto=require(_0x0094('0xb'));var jsforce=require(_0x0094('0xc'));var deskjs=require(_0x0094('0xd'));var toCsv=require(_0x0094('0xe'));var querystring=require(_0x0094('0xf'));var Papa=require(_0x0094('0x10'));var Redis=require(_0x0094('0x11'));var authService=require(_0x0094('0x12'));var qs=require(_0x0094('0x13'));var as=require(_0x0094('0x14'));var hardwareService=require(_0x0094('0x15'));var logger=require(_0x0094('0x16'))(_0x0094('0x17'));var utils=require('../../config/utils');var config=require(_0x0094('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a7ef9,_0x565be4){_0x565be4=_0x565be4||0xcc;return function(_0xa6dc42){if(_0xa6dc42){return _0x2a7ef9[_0x0094('0x19')](_0x565be4);}return _0x2a7ef9[_0x0094('0x1a')](_0x565be4)[_0x0094('0x1b')]();};}function respondWithResult(_0x5c886c,_0x477887){_0x477887=_0x477887||0xc8;return function(_0x302155){if(_0x302155){return _0x5c886c[_0x0094('0x1a')](_0x477887)[_0x0094('0x1c')](_0x302155);}};}function respondWithFilteredResult(_0x5bb384,_0x52030e){return function(_0x29b60c){if(_0x29b60c){var _0x40dd4f=typeof _0x52030e[_0x0094('0x1d')]===_0x0094('0x1e')&&typeof _0x52030e[_0x0094('0x1f')]==='undefined';var _0x298bd3=_0x29b60c[_0x0094('0x20')];var _0x585e92=_0x40dd4f?0x0:_0x52030e['offset'];var _0x1ea161=_0x40dd4f?_0x29b60c[_0x0094('0x20')]:_0x52030e[_0x0094('0x1d')]+_0x52030e[_0x0094('0x1f')];var _0xb8d6ac;if(_0x1ea161>=_0x298bd3){_0x1ea161=_0x298bd3;_0xb8d6ac=0xc8;}else{_0xb8d6ac=0xce;}_0x5bb384['status'](_0xb8d6ac);return _0x5bb384[_0x0094('0x21')]('Content-Range',_0x585e92+'-'+_0x1ea161+'/'+_0x298bd3)['json'](_0x29b60c);}return null;};}function patchUpdates(_0x23b3ac){return function(_0x4ac754){try{jsonpatch[_0x0094('0x22')](_0x4ac754,_0x23b3ac,!![]);}catch(_0x22ae6d){return BPromise[_0x0094('0x23')](_0x22ae6d);}return _0x4ac754[_0x0094('0x24')]();};}function saveUpdates(_0x469858,_0x312b6a){return function(_0x2336f8){if(_0x2336f8){return _0x2336f8['update'](_0x469858)[_0x0094('0x25')](function(_0x3e93ca){return _0x3e93ca;});}return null;};}function removeEntity(_0x28a34b,_0xe66ba4){return function(_0x278299){if(_0x278299){return _0x278299[_0x0094('0x26')]()[_0x0094('0x25')](function(){_0x28a34b[_0x0094('0x1a')](0xcc)[_0x0094('0x1b')]();});}};}function handleEntityNotFound(_0x99c9b9,_0xe91b52){return function(_0x3d0de5){if(!_0x3d0de5){_0x99c9b9['sendStatus'](0x194);}return _0x3d0de5;};}function handleError(_0x4e2218,_0x23fb9b){_0x23fb9b=_0x23fb9b||0x1f4;return function(_0x18d3ee){logger[_0x0094('0x27')](_0x18d3ee[_0x0094('0x28')]);if(_0x18d3ee[_0x0094('0x29')]){delete _0x18d3ee[_0x0094('0x29')];}_0x4e2218[_0x0094('0x1a')](_0x23fb9b)['send'](_0x18d3ee);};}exports['index']=function(_0x178ebf,_0x2e3198){var _0x3211ff={},_0x51b654={},_0x53e210={'count':0x0,'rows':[]};var _0x2625cf=_[_0x0094('0x2a')](db['AnalyticFieldReport'][_0x0094('0x2b')],function(_0x28c712){return{'name':_0x28c712[_0x0094('0x2c')],'type':_0x28c712[_0x0094('0x2d')][_0x0094('0x2e')]};});_0x51b654[_0x0094('0x2f')]=_[_0x0094('0x2a')](_0x2625cf,_0x0094('0x29'));_0x51b654['query']=_[_0x0094('0x30')](_0x178ebf[_0x0094('0x31')]);_0x51b654[_0x0094('0x32')]=_[_0x0094('0x33')](_0x51b654[_0x0094('0x2f')],_0x51b654['query']);_0x3211ff[_0x0094('0x34')]=_[_0x0094('0x33')](_0x51b654[_0x0094('0x2f')],qs[_0x0094('0x35')](_0x178ebf[_0x0094('0x31')][_0x0094('0x35')]));_0x3211ff['attributes']=_0x3211ff[_0x0094('0x34')][_0x0094('0x36')]?_0x3211ff[_0x0094('0x34')]:_0x51b654[_0x0094('0x2f')];if(!_0x178ebf[_0x0094('0x31')]['hasOwnProperty']('nolimit')){_0x3211ff[_0x0094('0x1f')]=qs[_0x0094('0x1f')](_0x178ebf[_0x0094('0x31')][_0x0094('0x1f')]);_0x3211ff[_0x0094('0x1d')]=qs['offset'](_0x178ebf['query'][_0x0094('0x1d')]);}_0x3211ff[_0x0094('0x37')]=qs[_0x0094('0x38')](_0x178ebf['query'][_0x0094('0x38')]);_0x3211ff[_0x0094('0x39')]=qs['filters'](_[_0x0094('0x3a')](_0x178ebf[_0x0094('0x31')],_0x51b654[_0x0094('0x32')]),_0x2625cf);if(_0x178ebf['query'][_0x0094('0x3b')]){_0x3211ff['where']=_[_0x0094('0x3c')](_0x3211ff[_0x0094('0x39')],{'$or':_['map'](_0x2625cf,function(_0x38f320){if(_0x38f320[_0x0094('0x2d')]!==_0x0094('0x3d')){var _0x19ad2a={};_0x19ad2a[_0x38f320[_0x0094('0x29')]]={'$like':'%'+_0x178ebf[_0x0094('0x31')]['filter']+'%'};return _0x19ad2a;}})});}_0x3211ff=_[_0x0094('0x3c')]({},_0x3211ff,_0x178ebf[_0x0094('0x3e')]);var _0x2af0c8={'where':_0x3211ff['where']};return db[_0x0094('0x3f')][_0x0094('0x20')](_0x2af0c8)[_0x0094('0x25')](function(_0x29d33d){_0x53e210[_0x0094('0x20')]=_0x29d33d;if(_0x178ebf[_0x0094('0x31')][_0x0094('0x40')]){_0x3211ff['include']=[{'all':!![]}];}return db[_0x0094('0x3f')][_0x0094('0x41')](_0x3211ff);})[_0x0094('0x25')](function(_0xbb6ba4){_0x53e210[_0x0094('0x42')]=_0xbb6ba4;return _0x53e210;})[_0x0094('0x25')](respondWithFilteredResult(_0x2e3198,_0x3211ff))[_0x0094('0x43')](handleError(_0x2e3198,null));};exports[_0x0094('0x44')]=function(_0x482e33,_0x8abeb2){var _0x503b8e={'raw':![],'where':{'id':_0x482e33[_0x0094('0x45')]['id']}},_0x4c9da0={};_0x4c9da0[_0x0094('0x2f')]=_[_0x0094('0x30')](db[_0x0094('0x3f')]['rawAttributes']);_0x4c9da0[_0x0094('0x31')]=_['keys'](_0x482e33[_0x0094('0x31')]);_0x4c9da0['filters']=_[_0x0094('0x33')](_0x4c9da0[_0x0094('0x2f')],_0x4c9da0['query']);_0x503b8e[_0x0094('0x34')]=_['intersection'](_0x4c9da0[_0x0094('0x2f')],qs[_0x0094('0x35')](_0x482e33[_0x0094('0x31')][_0x0094('0x35')]));_0x503b8e[_0x0094('0x34')]=_0x503b8e['attributes'][_0x0094('0x36')]?_0x503b8e['attributes']:_0x4c9da0[_0x0094('0x2f')];if(_0x482e33['query'][_0x0094('0x40')]){_0x503b8e['include']=[{'all':!![]}];}_0x503b8e=_[_0x0094('0x3c')]({},_0x503b8e,_0x482e33[_0x0094('0x3e')]);return db[_0x0094('0x3f')][_0x0094('0x46')](_0x503b8e)[_0x0094('0x25')](handleEntityNotFound(_0x8abeb2,null))[_0x0094('0x25')](respondWithResult(_0x8abeb2,null))[_0x0094('0x43')](handleError(_0x8abeb2,null));};exports[_0x0094('0x47')]=function(_0x5cb953,_0x198258){return db[_0x0094('0x3f')][_0x0094('0x47')](_0x5cb953[_0x0094('0x48')],{})[_0x0094('0x25')](respondWithResult(_0x198258,0xc9))['catch'](handleError(_0x198258,null));};exports[_0x0094('0x49')]=function(_0x11d10b,_0x5708ba){return db[_0x0094('0x3f')][_0x0094('0x49')](_0x11d10b[_0x0094('0x48')],{'raw':![],'individualHooks':!![]})[_0x0094('0x25')](respondWithResult(_0x5708ba,0xc9))[_0x0094('0x43')](handleError(_0x5708ba,null));};exports[_0x0094('0x4a')]=function(_0x4c4388,_0xead7eb){if(_0x4c4388['body']['id']){delete _0x4c4388[_0x0094('0x48')]['id'];}return db['AnalyticFieldReport'][_0x0094('0x46')]({'where':{'id':_0x4c4388['params']['id']}})[_0x0094('0x25')](handleEntityNotFound(_0xead7eb,null))[_0x0094('0x25')](saveUpdates(_0x4c4388['body'],null))[_0x0094('0x25')](respondWithResult(_0xead7eb,null))[_0x0094('0x43')](handleError(_0xead7eb,null));};exports[_0x0094('0x26')]=function(_0x42b2a6,_0x2fa047){return db[_0x0094('0x3f')]['find']({'where':{'id':_0x42b2a6[_0x0094('0x45')]['id']}})[_0x0094('0x25')](handleEntityNotFound(_0x2fa047,null))[_0x0094('0x25')](removeEntity(_0x2fa047,null))[_0x0094('0x43')](handleError(_0x2fa047,null));};exports['bulkDestroy']=function(_0x4f8d9d,_0x289936){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x4f8d9d[_0x0094('0x31')][_0x0094('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x0094('0x25')](respondWithResult(_0x289936,0xcc))['catch'](handleError(_0x289936,null));};exports['addFields']=function(_0x390165,_0x11149b,_0x336236){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x390165[_0x0094('0x45')]['id']}})[_0x0094('0x25')](handleEntityNotFound(_0x11149b,null))[_0x0094('0x25')](function(_0x388957){if(_0x388957){return db[_0x0094('0x4c')][_0x0094('0x4d')](function(_0x5c1596){return db['AnalyticFieldReport'][_0x0094('0x26')]({'where':{'CustomReportId':_0x390165[_0x0094('0x45')]['id']},'transaction':_0x5c1596})[_0x0094('0x25')](function(_0x4167ba){var _0x5244d3=_[_0x0094('0x2a')](_0x390165[_0x0094('0x48')],function(_0x212a6f){delete _0x212a6f['id'];_0x212a6f[_0x0094('0x4e')]=_0x390165[_0x0094('0x45')]['id'];return _0x212a6f;});return db[_0x0094('0x3f')]['bulkCreate'](_0x5244d3,{'transaction':_0x5c1596});});})[_0x0094('0x25')](function(){return db['AnalyticFieldReport'][_0x0094('0x41')]({'where':{'CustomReportId':_0x390165[_0x0094('0x45')]['id']}});});}})[_0x0094('0x25')](respondWithResult(_0x11149b,null))[_0x0094('0x43')](handleError(_0x11149b,null));}; \ No newline at end of file +var _0x6b8f=['order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','findAll','rows','catch','show','intersection','include','create','body','bulkCreate','find','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','attributes','model','fields','length','nolimit'];(function(_0x415de4,_0x572875){var _0x1fc00a=function(_0x433c5f){while(--_0x433c5f){_0x415de4['push'](_0x415de4['shift']());}};_0x1fc00a(++_0x572875);}(_0x6b8f,0x160));var _0xf6b8=function(_0x4753b9,_0x3d3b04){_0x4753b9=_0x4753b9-0x0;var _0x427a60=_0x6b8f[_0x4753b9];return _0x427a60;};'use strict';var emlformat=require(_0xf6b8('0x0'));var rimraf=require(_0xf6b8('0x1'));var zipdir=require(_0xf6b8('0x2'));var jsonpatch=require(_0xf6b8('0x3'));var rp=require(_0xf6b8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require(_0xf6b8('0x7'));var fs=require('fs');var fs_extra=require(_0xf6b8('0x8'));var _=require(_0xf6b8('0x9'));var squel=require(_0xf6b8('0xa'));var crypto=require(_0xf6b8('0xb'));var jsforce=require(_0xf6b8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require(_0xf6b8('0xd'));var Papa=require(_0xf6b8('0xe'));var Redis=require(_0xf6b8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf6b8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6b8('0x11'));var logger=require(_0xf6b8('0x12'))(_0xf6b8('0x13'));var utils=require(_0xf6b8('0x14'));var config=require(_0xf6b8('0x15'));var licenseUtil=require(_0xf6b8('0x16'));var db=require(_0xf6b8('0x17'))['db'];function respondWithStatusCode(_0x469879,_0x5a54e8){_0x5a54e8=_0x5a54e8||0xcc;return function(_0x478efe){if(_0x478efe){return _0x469879[_0xf6b8('0x18')](_0x5a54e8);}return _0x469879[_0xf6b8('0x19')](_0x5a54e8)[_0xf6b8('0x1a')]();};}function respondWithResult(_0x1fa7c7,_0x3e61ac){_0x3e61ac=_0x3e61ac||0xc8;return function(_0x4a6863){if(_0x4a6863){return _0x1fa7c7[_0xf6b8('0x19')](_0x3e61ac)[_0xf6b8('0x1b')](_0x4a6863);}};}function respondWithFilteredResult(_0x352ff7,_0x4c60e2){return function(_0x181b93){if(_0x181b93){var _0x5ba554=typeof _0x4c60e2[_0xf6b8('0x1c')]===_0xf6b8('0x1d')&&typeof _0x4c60e2[_0xf6b8('0x1e')]===_0xf6b8('0x1d');var _0x218984=_0x181b93[_0xf6b8('0x1f')];var _0x57e4b7=_0x5ba554?0x0:_0x4c60e2[_0xf6b8('0x1c')];var _0x1ac421=_0x5ba554?_0x181b93[_0xf6b8('0x1f')]:_0x4c60e2[_0xf6b8('0x1c')]+_0x4c60e2[_0xf6b8('0x1e')];var _0x21af52;if(_0x1ac421>=_0x218984){_0x1ac421=_0x218984;_0x21af52=0xc8;}else{_0x21af52=0xce;}_0x352ff7[_0xf6b8('0x19')](_0x21af52);return _0x352ff7['set'](_0xf6b8('0x20'),_0x57e4b7+'-'+_0x1ac421+'/'+_0x218984)[_0xf6b8('0x1b')](_0x181b93);}return null;};}function patchUpdates(_0x36d7d8){return function(_0x53b69f){try{jsonpatch['apply'](_0x53b69f,_0x36d7d8,!![]);}catch(_0x25dae3){return BPromise[_0xf6b8('0x21')](_0x25dae3);}return _0x53b69f[_0xf6b8('0x22')]();};}function saveUpdates(_0x540f7a,_0xd078b2){return function(_0x26f2a1){if(_0x26f2a1){return _0x26f2a1[_0xf6b8('0x23')](_0x540f7a)[_0xf6b8('0x24')](function(_0x2fb536){return _0x2fb536;});}return null;};}function removeEntity(_0x5b7dc0,_0x2508ff){return function(_0x413f16){if(_0x413f16){return _0x413f16[_0xf6b8('0x25')]()[_0xf6b8('0x24')](function(){_0x5b7dc0[_0xf6b8('0x19')](0xcc)[_0xf6b8('0x1a')]();});}};}function handleEntityNotFound(_0x2d143e,_0x3421a6){return function(_0x58890e){if(!_0x58890e){_0x2d143e['sendStatus'](0x194);}return _0x58890e;};}function handleError(_0x562fe0,_0xd07d71){_0xd07d71=_0xd07d71||0x1f4;return function(_0x282715){logger['error'](_0x282715[_0xf6b8('0x26')]);if(_0x282715[_0xf6b8('0x27')]){delete _0x282715[_0xf6b8('0x27')];}_0x562fe0[_0xf6b8('0x19')](_0xd07d71)[_0xf6b8('0x28')](_0x282715);};}exports['index']=function(_0x1ad1af,_0x585d24){var _0x11f081={},_0x35eac1={},_0x565dd1={'count':0x0,'rows':[]};var _0x26f625=_[_0xf6b8('0x29')](db['AnalyticFieldReport'][_0xf6b8('0x2a')],function(_0x265669){return{'name':_0x265669[_0xf6b8('0x2b')],'type':_0x265669[_0xf6b8('0x2c')]['key']};});_0x35eac1['model']=_[_0xf6b8('0x29')](_0x26f625,_0xf6b8('0x27'));_0x35eac1[_0xf6b8('0x2d')]=_[_0xf6b8('0x2e')](_0x1ad1af[_0xf6b8('0x2d')]);_0x35eac1[_0xf6b8('0x2f')]=_['intersection'](_0x35eac1['model'],_0x35eac1[_0xf6b8('0x2d')]);_0x11f081[_0xf6b8('0x30')]=_['intersection'](_0x35eac1[_0xf6b8('0x31')],qs['fields'](_0x1ad1af['query'][_0xf6b8('0x32')]));_0x11f081[_0xf6b8('0x30')]=_0x11f081['attributes'][_0xf6b8('0x33')]?_0x11f081['attributes']:_0x35eac1[_0xf6b8('0x31')];if(!_0x1ad1af[_0xf6b8('0x2d')]['hasOwnProperty'](_0xf6b8('0x34'))){_0x11f081[_0xf6b8('0x1e')]=qs[_0xf6b8('0x1e')](_0x1ad1af['query']['limit']);_0x11f081['offset']=qs[_0xf6b8('0x1c')](_0x1ad1af['query'][_0xf6b8('0x1c')]);}_0x11f081[_0xf6b8('0x35')]=qs[_0xf6b8('0x36')](_0x1ad1af['query'][_0xf6b8('0x36')]);_0x11f081[_0xf6b8('0x37')]=qs[_0xf6b8('0x2f')](_[_0xf6b8('0x38')](_0x1ad1af[_0xf6b8('0x2d')],_0x35eac1[_0xf6b8('0x2f')]),_0x26f625);if(_0x1ad1af['query'][_0xf6b8('0x39')]){_0x11f081[_0xf6b8('0x37')]=_[_0xf6b8('0x3a')](_0x11f081[_0xf6b8('0x37')],{'$or':_[_0xf6b8('0x29')](_0x26f625,function(_0x545fa0){if(_0x545fa0['type']!==_0xf6b8('0x3b')){var _0x16824c={};_0x16824c[_0x545fa0[_0xf6b8('0x27')]]={'$like':'%'+_0x1ad1af['query'][_0xf6b8('0x39')]+'%'};return _0x16824c;}})});}_0x11f081=_[_0xf6b8('0x3a')]({},_0x11f081,_0x1ad1af[_0xf6b8('0x3c')]);var _0x25f3d7={'where':_0x11f081[_0xf6b8('0x37')]};return db[_0xf6b8('0x3d')][_0xf6b8('0x1f')](_0x25f3d7)[_0xf6b8('0x24')](function(_0x272200){_0x565dd1[_0xf6b8('0x1f')]=_0x272200;if(_0x1ad1af[_0xf6b8('0x2d')][_0xf6b8('0x3e')]){_0x11f081['include']=[{'all':!![]}];}return db[_0xf6b8('0x3d')][_0xf6b8('0x3f')](_0x11f081);})['then'](function(_0x31c02d){_0x565dd1[_0xf6b8('0x40')]=_0x31c02d;return _0x565dd1;})[_0xf6b8('0x24')](respondWithFilteredResult(_0x585d24,_0x11f081))[_0xf6b8('0x41')](handleError(_0x585d24,null));};exports[_0xf6b8('0x42')]=function(_0x43d01f,_0x4f23e5){var _0x4341fb={'raw':![],'where':{'id':_0x43d01f['params']['id']}},_0x5a76df={};_0x5a76df[_0xf6b8('0x31')]=_[_0xf6b8('0x2e')](db['AnalyticFieldReport'][_0xf6b8('0x2a')]);_0x5a76df[_0xf6b8('0x2d')]=_['keys'](_0x43d01f[_0xf6b8('0x2d')]);_0x5a76df['filters']=_['intersection'](_0x5a76df['model'],_0x5a76df[_0xf6b8('0x2d')]);_0x4341fb['attributes']=_[_0xf6b8('0x43')](_0x5a76df[_0xf6b8('0x31')],qs[_0xf6b8('0x32')](_0x43d01f[_0xf6b8('0x2d')][_0xf6b8('0x32')]));_0x4341fb['attributes']=_0x4341fb[_0xf6b8('0x30')][_0xf6b8('0x33')]?_0x4341fb[_0xf6b8('0x30')]:_0x5a76df['model'];if(_0x43d01f[_0xf6b8('0x2d')][_0xf6b8('0x3e')]){_0x4341fb[_0xf6b8('0x44')]=[{'all':!![]}];}_0x4341fb=_[_0xf6b8('0x3a')]({},_0x4341fb,_0x43d01f['options']);return db[_0xf6b8('0x3d')]['find'](_0x4341fb)[_0xf6b8('0x24')](handleEntityNotFound(_0x4f23e5,null))[_0xf6b8('0x24')](respondWithResult(_0x4f23e5,null))[_0xf6b8('0x41')](handleError(_0x4f23e5,null));};exports[_0xf6b8('0x45')]=function(_0x292618,_0x394279){return db[_0xf6b8('0x3d')][_0xf6b8('0x45')](_0x292618[_0xf6b8('0x46')],{})[_0xf6b8('0x24')](respondWithResult(_0x394279,0xc9))[_0xf6b8('0x41')](handleError(_0x394279,null));};exports[_0xf6b8('0x47')]=function(_0x1a69b5,_0x51f15b){return db[_0xf6b8('0x3d')][_0xf6b8('0x47')](_0x1a69b5['body'],{'raw':![],'individualHooks':!![]})[_0xf6b8('0x24')](respondWithResult(_0x51f15b,0xc9))[_0xf6b8('0x41')](handleError(_0x51f15b,null));};exports[_0xf6b8('0x23')]=function(_0xdd6840,_0x5d96b2){if(_0xdd6840['body']['id']){delete _0xdd6840[_0xf6b8('0x46')]['id'];}return db[_0xf6b8('0x3d')][_0xf6b8('0x48')]({'where':{'id':_0xdd6840[_0xf6b8('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d96b2,null))[_0xf6b8('0x24')](saveUpdates(_0xdd6840[_0xf6b8('0x46')],null))[_0xf6b8('0x24')](respondWithResult(_0x5d96b2,null))[_0xf6b8('0x41')](handleError(_0x5d96b2,null));};exports[_0xf6b8('0x25')]=function(_0x2d67ab,_0x10a6f1){return db[_0xf6b8('0x3d')][_0xf6b8('0x48')]({'where':{'id':_0x2d67ab['params']['id']}})[_0xf6b8('0x24')](handleEntityNotFound(_0x10a6f1,null))[_0xf6b8('0x24')](removeEntity(_0x10a6f1,null))[_0xf6b8('0x41')](handleError(_0x10a6f1,null));};exports[_0xf6b8('0x4a')]=function(_0x1db205,_0x7d528e){return db[_0xf6b8('0x3d')]['destroy']({'where':{'id':_0x1db205[_0xf6b8('0x2d')][_0xf6b8('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xf6b8('0x24')](respondWithResult(_0x7d528e,0xcc))[_0xf6b8('0x41')](handleError(_0x7d528e,null));};exports[_0xf6b8('0x4c')]=function(_0xc2bc6b,_0x5df1c9,_0x1e62d2){return db[_0xf6b8('0x4d')][_0xf6b8('0x4e')]({'where':{'id':_0xc2bc6b[_0xf6b8('0x49')]['id']}})[_0xf6b8('0x24')](handleEntityNotFound(_0x5df1c9,null))[_0xf6b8('0x24')](function(_0x51209b){if(_0x51209b){return db['sequelize'][_0xf6b8('0x4f')](function(_0x3db810){return db[_0xf6b8('0x3d')]['destroy']({'where':{'CustomReportId':_0xc2bc6b['params']['id']},'transaction':_0x3db810})[_0xf6b8('0x24')](function(_0x560b7f){var _0x417367=_[_0xf6b8('0x29')](_0xc2bc6b[_0xf6b8('0x46')],function(_0x3407ab){delete _0x3407ab['id'];_0x3407ab[_0xf6b8('0x50')]=_0xc2bc6b[_0xf6b8('0x49')]['id'];return _0x3407ab;});return db[_0xf6b8('0x3d')]['bulkCreate'](_0x417367,{'transaction':_0x3db810});});})['then'](function(){return db[_0xf6b8('0x3d')][_0xf6b8('0x3f')]({'where':{'CustomReportId':_0xc2bc6b['params']['id']}});});}})[_0xf6b8('0x24')](respondWithResult(_0x5df1c9,null))[_0xf6b8('0x41')](handleError(_0x5df1c9,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index e90cbfb..6aa7a57 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 _0x1569=['define','AnalyticFieldReport','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x1abcd0,_0x448c52){var _0x4e43dd=function(_0x31bd92){while(--_0x31bd92){_0x1abcd0['push'](_0x1abcd0['shift']());}};_0x4e43dd(++_0x448c52);}(_0x1569,0x146));var _0x9156=function(_0x15d6de,_0x5807c6){_0x15d6de=_0x15d6de-0x0;var _0x51e84a=_0x1569[_0x15d6de];return _0x51e84a;};'use strict';var _=require(_0x9156('0x0'));var util=require(_0x9156('0x1'));var logger=require('../../config/logger')(_0x9156('0x2'));var moment=require(_0x9156('0x3'));var BPromise=require(_0x9156('0x4'));var rp=require(_0x9156('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9156('0x6'));var config=require(_0x9156('0x7'));var attributes=require(_0x9156('0x8'));module[_0x9156('0x9')]=function(_0x523a6e,_0x223dce){return _0x523a6e[_0x9156('0xa')](_0x9156('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf266=['api','moment','request-promise','path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x25ac19,_0x563211){var _0x447a74=function(_0x3925ca){while(--_0x3925ca){_0x25ac19['push'](_0x25ac19['shift']());}};_0x447a74(++_0x563211);}(_0xf266,0xda));var _0x6f26=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xf266[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x6f26('0x0'));var util=require(_0x6f26('0x1'));var logger=require('../../config/logger')(_0x6f26('0x2'));var moment=require(_0x6f26('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f26('0x4'));var fs=require('fs');var path=require(_0x6f26('0x5'));var rimraf=require(_0x6f26('0x6'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x6f26('0x7')]=function(_0x5284a8,_0x32404d){return _0x5284a8[_0x6f26('0x8')](_0x6f26('0x9'),attributes,{'tableName':_0x6f26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 7b6230b..9d30fdf 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 _0x0306=['error','code','message','AnalyticFieldReport,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','debug','request\x20sent'];(function(_0x5626b,_0x4fd403){var _0x50874e=function(_0x24c81b){while(--_0x24c81b){_0x5626b['push'](_0x5626b['shift']());}};_0x50874e(++_0x4fd403);}(_0x0306,0x1d2));var _0x6030=function(_0x15dc98,_0x3217fa){_0x15dc98=_0x15dc98-0x0;var _0x1d3dc1=_0x0306[_0x15dc98];return _0x1d3dc1;};'use strict';var _=require(_0x6030('0x0'));var util=require(_0x6030('0x1'));var moment=require(_0x6030('0x2'));var BPromise=require(_0x6030('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6030('0x4'));var db=require(_0x6030('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6030('0x6'))('rpc');var config=require(_0x6030('0x7'));var jayson=require(_0x6030('0x8'));var client=jayson[_0x6030('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe33fef,_0xfce43e,_0x30e8b8){return new BPromise(function(_0x4a14e2,_0x207ec6){return client[_0x6030('0xa')](_0xe33fef,_0x30e8b8)[_0x6030('0xb')](function(_0x267b8c){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xfce43e,'request\x20sent');logger[_0x6030('0xc')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xfce43e,_0x6030('0xd'),JSON['stringify'](_0x267b8c));if(_0x267b8c['error']){if(_0x267b8c[_0x6030('0xe')][_0x6030('0xf')]===0x1f4){logger[_0x6030('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0xfce43e,_0x267b8c['error'][_0x6030('0x10')]);return _0x207ec6(_0x267b8c[_0x6030('0xe')][_0x6030('0x10')]);}logger[_0x6030('0xe')](_0x6030('0x11'),_0xfce43e,_0x267b8c[_0x6030('0xe')][_0x6030('0x10')]);return _0x4a14e2(_0x267b8c['error']['message']);}else{logger[_0x6030('0x12')](_0x6030('0x11'),_0xfce43e,_0x6030('0xd'));_0x4a14e2(_0x267b8c[_0x6030('0x13')]['message']);}})['catch'](function(_0x2c08f8){logger['error'](_0x6030('0x11'),_0xfce43e,_0x2c08f8);_0x207ec6(_0x2c08f8);});});} \ No newline at end of file +var _0x8eda=['rpc','jayson/promise','http','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticFieldReport,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x24b88f,_0x22ea38){var _0x34a652=function(_0xa0fb48){while(--_0xa0fb48){_0x24b88f['push'](_0x24b88f['shift']());}};_0x34a652(++_0x22ea38);}(_0x8eda,0x1c2));var _0xa8ed=function(_0x43ff39,_0x1c03a0){_0x43ff39=_0x43ff39-0x0;var _0x187de3=_0x8eda[_0x43ff39];return _0x187de3;};'use strict';var _=require('lodash');var util=require(_0xa8ed('0x0'));var moment=require(_0xa8ed('0x1'));var BPromise=require(_0xa8ed('0x2'));var rs=require(_0xa8ed('0x3'));var fs=require('fs');var Redis=require(_0xa8ed('0x4'));var db=require(_0xa8ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8ed('0x6'));var config=require('../../config/environment');var jayson=require(_0xa8ed('0x7'));var client=jayson['client'][_0xa8ed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e9a7,_0x165dbb,_0x24620f){return new BPromise(function(_0x39f87b,_0x1262fa){return client[_0xa8ed('0x9')](_0x20e9a7,_0x24620f)[_0xa8ed('0xa')](function(_0x5a1479){logger[_0xa8ed('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x165dbb,_0xa8ed('0xc'));logger['debug'](_0xa8ed('0xd'),_0x165dbb,_0xa8ed('0xc'),JSON[_0xa8ed('0xe')](_0x5a1479));if(_0x5a1479['error']){if(_0x5a1479[_0xa8ed('0xf')]['code']===0x1f4){logger[_0xa8ed('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x165dbb,_0x5a1479[_0xa8ed('0xf')][_0xa8ed('0x10')]);return _0x1262fa(_0x5a1479[_0xa8ed('0xf')][_0xa8ed('0x10')]);}logger[_0xa8ed('0xf')](_0xa8ed('0x11'),_0x165dbb,_0x5a1479[_0xa8ed('0xf')][_0xa8ed('0x10')]);return _0x39f87b(_0x5a1479[_0xa8ed('0xf')][_0xa8ed('0x10')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x165dbb,_0xa8ed('0xc'));_0x39f87b(_0x5a1479['result']['message']);}})[_0xa8ed('0x12')](function(_0x3671fa){logger[_0xa8ed('0xf')](_0xa8ed('0x11'),_0x165dbb,_0x3671fa);_0x1262fa(_0x3671fa);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e18dc83..2c70cac 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(_0x2e5f54,_0x13dd84){var _0x407d00=function(_0x51f778){while(--_0x51f778){_0x2e5f54['push'](_0x2e5f54['shift']());}};_0x407d00(++_0x13dd84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x5e37b8,_0x1c1e5c){var _0x52f02b=function(_0xede48d){while(--_0xede48d){_0x5e37b8['push'](_0x5e37b8['shift']());}};_0x52f02b(++_0x1c1e5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 31ad5c0..455e13c 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 _0x4de7=['STRING','name','TEXT','sequelize'];(function(_0x5433e8,_0x419b0b){var _0x43fac2=function(_0x485d83){while(--_0x485d83){_0x5433e8['push'](_0x5433e8['shift']());}};_0x43fac2(++_0x419b0b);}(_0x4de7,0x1f3));var _0x74de=function(_0x442c77,_0x3a95fc){_0x442c77=_0x442c77-0x0;var _0x50aed8=_0x4de7[_0x442c77];return _0x50aed8;};'use strict';var Sequelize=require(_0x74de('0x0'));module['exports']={'name':{'type':Sequelize[_0x74de('0x1')],'allowNull':![],'unique':_0x74de('0x2')},'table':{'type':Sequelize[_0x74de('0x1')]},'metric':{'type':Sequelize[_0x74de('0x3')]},'description':{'type':Sequelize[_0x74de('0x1')]}}; \ No newline at end of file +var _0x1d90=['sequelize','STRING'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x1d90,0x13e));var _0x01d9=function(_0x4f4693,_0x149780){_0x4f4693=_0x4f4693-0x0;var _0x2ca019=_0x1d90[_0x4f4693];return _0x2ca019;};'use strict';var Sequelize=require(_0x01d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x01d9('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x01d9('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x01d9('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c2767bb..c90b434 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x25a05b,_0x15616a){var _0x125e2c=function(_0xb3975e){while(--_0xb3975e){_0x25a05b['push'](_0x25a05b['shift']());}};_0x125e2c(++_0x15616a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3843af,_0x375e94){_0x3843af=_0x3843af-0x0;var _0x20543c=_0xe5b3[_0x3843af];return _0x20543c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,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(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0x55ca,0x126));var _0xa55c=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x55ca[_0x5c468f];return _0x2136b0;};'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 c46bdb7..64a6dff 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 _0xdedd=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x1696c2,_0x4edb9e){var _0x378d16=function(_0x409a89){while(--_0x409a89){_0x1696c2['push'](_0x1696c2['shift']());}};_0x378d16(++_0x4edb9e);}(_0xdedd,0x197));var _0xdded=function(_0x28ef7c,_0x33f487){_0x28ef7c=_0x28ef7c-0x0;var _0x4f4eff=_0xdedd[_0x28ef7c];return _0x4f4eff;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var logger=require(_0xdded('0x2'))(_0xdded('0x3'));var moment=require(_0xdded('0x4'));var BPromise=require('bluebird');var rp=require(_0xdded('0x5'));var fs=require('fs');var path=require(_0xdded('0x6'));var rimraf=require(_0xdded('0x7'));var config=require(_0xdded('0x8'));var attributes=require(_0xdded('0x9'));module[_0xdded('0xa')]=function(_0x2e327c,_0x277fab){return _0x2e327c['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78e0=['request-promise','path','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1574c5,_0x107f22){var _0x3cf252=function(_0x3547dc){while(--_0x3547dc){_0x1574c5['push'](_0x1574c5['shift']());}};_0x3cf252(++_0x107f22);}(_0x78e0,0x13e));var _0x078e=function(_0x6171c0,_0x127af3){_0x6171c0=_0x6171c0-0x0;var _0x227390=_0x78e0[_0x6171c0];return _0x227390;};'use strict';var _=require(_0x078e('0x0'));var util=require(_0x078e('0x1'));var logger=require(_0x078e('0x2'))(_0x078e('0x3'));var moment=require(_0x078e('0x4'));var BPromise=require(_0x078e('0x5'));var rp=require(_0x078e('0x6'));var fs=require('fs');var path=require(_0x078e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x078e('0x8'));module[_0x078e('0x9')]=function(_0x8e71c,_0x35578b){return _0x8e71c[_0x078e('0xa')]('AnalyticMetric',attributes,{'tableName':_0x078e('0xb'),'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 a924b43..551bd79 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 _0x4724=['AnalyticMetric,\x20%s,\x20%s,\x20%s','code','error','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x3c2303,_0x2c9560){var _0x97a5ed=function(_0x5e97a8){while(--_0x5e97a8){_0x3c2303['push'](_0x3c2303['shift']());}};_0x97a5ed(++_0x2c9560);}(_0x4724,0x187));var _0x4472=function(_0xd343,_0x47ddff){_0xd343=_0xd343-0x0;var _0x4886fa=_0x4724[_0xd343];return _0x4886fa;};'use strict';var _=require(_0x4472('0x0'));var util=require(_0x4472('0x1'));var moment=require(_0x4472('0x2'));var BPromise=require(_0x4472('0x3'));var rs=require(_0x4472('0x4'));var fs=require('fs');var Redis=require(_0x4472('0x5'));var db=require(_0x4472('0x6'))['db'];var utils=require(_0x4472('0x7'));var logger=require('../../config/logger')(_0x4472('0x8'));var config=require(_0x4472('0x9'));var jayson=require(_0x4472('0xa'));var client=jayson[_0x4472('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17dc23,_0x1190ac,_0xd0e0fc){return new BPromise(function(_0x2f9ac6,_0x492d6a){return client[_0x4472('0xc')](_0x17dc23,_0xd0e0fc)[_0x4472('0xd')](function(_0x5ef6c9){logger[_0x4472('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1190ac,_0x4472('0xf'));logger[_0x4472('0x10')](_0x4472('0x11'),_0x1190ac,_0x4472('0xf'),JSON['stringify'](_0x5ef6c9));if(_0x5ef6c9['error']){if(_0x5ef6c9['error'][_0x4472('0x12')]===0x1f4){logger[_0x4472('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x1190ac,_0x5ef6c9['error'][_0x4472('0x14')]);return _0x492d6a(_0x5ef6c9[_0x4472('0x13')][_0x4472('0x14')]);}logger[_0x4472('0x13')](_0x4472('0x15'),_0x1190ac,_0x5ef6c9[_0x4472('0x13')][_0x4472('0x14')]);return _0x2f9ac6(_0x5ef6c9['error'][_0x4472('0x14')]);}else{logger[_0x4472('0xe')](_0x4472('0x15'),_0x1190ac,'request\x20sent');_0x2f9ac6(_0x5ef6c9[_0x4472('0x16')][_0x4472('0x14')]);}})[_0x4472('0x17')](function(_0x1e6989){logger['error'](_0x4472('0x15'),_0x1190ac,_0x1e6989);_0x492d6a(_0x1e6989);});});} \ No newline at end of file +var _0xf9b3=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x14bdfb,_0x7ebb3c){var _0x433477=function(_0x499bf6){while(--_0x499bf6){_0x14bdfb['push'](_0x14bdfb['shift']());}};_0x433477(++_0x7ebb3c);}(_0xf9b3,0x154));var _0x3f9b=function(_0x15b218,_0x1e935a){_0x15b218=_0x15b218-0x0;var _0x54d825=_0xf9b3[_0x15b218];return _0x54d825;};'use strict';var _=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var moment=require(_0x3f9b('0x2'));var BPromise=require(_0x3f9b('0x3'));var rs=require(_0x3f9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f9b('0x6'))(_0x3f9b('0x7'));var config=require(_0x3f9b('0x8'));var jayson=require(_0x3f9b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1351c3,_0x40c7af,_0x2a0f2f){return new BPromise(function(_0x48d8b4,_0x3aaf0d){return client[_0x3f9b('0xa')](_0x1351c3,_0x2a0f2f)[_0x3f9b('0xb')](function(_0x56b98d){logger['info'](_0x3f9b('0xc'),_0x40c7af,_0x3f9b('0xd'));logger['debug'](_0x3f9b('0xe'),_0x40c7af,'request\x20sent',JSON[_0x3f9b('0xf')](_0x56b98d));if(_0x56b98d[_0x3f9b('0x10')]){if(_0x56b98d['error'][_0x3f9b('0x11')]===0x1f4){logger[_0x3f9b('0x10')](_0x3f9b('0xc'),_0x40c7af,_0x56b98d[_0x3f9b('0x10')]['message']);return _0x3aaf0d(_0x56b98d[_0x3f9b('0x10')]['message']);}logger[_0x3f9b('0x10')](_0x3f9b('0xc'),_0x40c7af,_0x56b98d[_0x3f9b('0x10')][_0x3f9b('0x12')]);return _0x48d8b4(_0x56b98d[_0x3f9b('0x10')]['message']);}else{logger[_0x3f9b('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x40c7af,_0x3f9b('0xd'));_0x48d8b4(_0x56b98d[_0x3f9b('0x14')][_0x3f9b('0x12')]);}})[_0x3f9b('0x15')](function(_0xf21347){logger[_0x3f9b('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x40c7af,_0xf21347);_0x3aaf0d(_0xf21347);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d58477c..a9a0c77 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 _0x78b7=['create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x487f48,_0x5dd2dc){var _0x3a39f8=function(_0x4afbf4){while(--_0x4afbf4){_0x487f48['push'](_0x487f48['shift']());}};_0x3a39f8(++_0x5dd2dc);}(_0x78b7,0x194));var _0x778b=function(_0x270305,_0x43a385){_0x270305=_0x270305-0x0;var _0x4014e3=_0x78b7[_0x270305];return _0x4014e3;};'use strict';var multer=require(_0x778b('0x0'));var util=require(_0x778b('0x1'));var path=require('path');var timeout=require(_0x778b('0x2'));var express=require(_0x778b('0x3'));var router=express[_0x778b('0x4')]();var fs_extra=require(_0x778b('0x5'));var auth=require(_0x778b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x778b('0x7'));router[_0x778b('0x8')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xa')]);router[_0x778b('0x8')](_0x778b('0xb'),auth['isAuthenticated'](),controller[_0x778b('0xc')]);router[_0x778b('0xd')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xe')]);router[_0x778b('0xf')]('/:id',auth[_0x778b('0x9')](),controller[_0x778b('0x10')]);router['delete'](_0x778b('0xb'),auth[_0x778b('0x9')](),controller[_0x778b('0x11')]);module[_0x778b('0x12')]=router; \ No newline at end of file +var _0xaa5c=['delete','destroy','multer','util','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x33def6,_0x1cc2bf){var _0x32ac0b=function(_0x2ba1ee){while(--_0x2ba1ee){_0x33def6['push'](_0x33def6['shift']());}};_0x32ac0b(++_0x1cc2bf);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x4665f6,_0x58851b){_0x4665f6=_0x4665f6-0x0;var _0x4834a0=_0xaa5c[_0x4665f6];return _0x4834a0;};'use strict';var multer=require(_0xcaa5('0x0'));var util=require(_0xcaa5('0x1'));var path=require(_0xcaa5('0x2'));var timeout=require(_0xcaa5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcaa5('0x4'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xcaa5('0x5')]('/',auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x7')]);router['get'](_0xcaa5('0x8'),auth[_0xcaa5('0x6')](),controller[_0xcaa5('0x9')]);router[_0xcaa5('0xa')]('/',auth['isAuthenticated'](),controller[_0xcaa5('0xb')]);router[_0xcaa5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xcaa5('0xd')]);router[_0xcaa5('0xe')](_0xcaa5('0x8'),auth['isAuthenticated'](),controller[_0xcaa5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5c7d107..405a328 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 _0xa668=['exports','TEXT'];(function(_0x2cabd5,_0x31dbd){var _0x4c02d7=function(_0x4a908c){while(--_0x4a908c){_0x2cabd5['push'](_0x2cabd5['shift']());}};_0x4c02d7(++_0x31dbd);}(_0xa668,0xe6));var _0x8a66=function(_0x3f6269,_0x3fd5ea){_0x3f6269=_0x3f6269-0x0;var _0x58f14d=_0xa668[_0x3f6269];return _0x58f14d;};'use strict';var Sequelize=require('sequelize');module[_0x8a66('0x0')]={'tree':{'type':Sequelize[_0x8a66('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb619=['TEXT','sequelize','exports'];(function(_0x3a8db3,_0x4558fc){var _0xcbd53a=function(_0x5957a1){while(--_0x5957a1){_0x3a8db3['push'](_0x3a8db3['shift']());}};_0xcbd53a(++_0x4558fc);}(_0xb619,0x12a));var _0x9b61=function(_0x25c5c6,_0x11fa9a){_0x25c5c6=_0x25c5c6-0x0;var _0x4c7307=_0xb619[_0x25c5c6];return _0x4c7307;};'use strict';var Sequelize=require(_0x9b61('0x0'));module[_0x9b61('0x1')]={'tree':{'type':Sequelize[_0x9b61('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 9e8d6dc..c8dd653 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 _0x13e6=['ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0xcd816,_0x140292){var _0x3a19c3=function(_0x501714){while(--_0x501714){_0xcd816['push'](_0xcd816['shift']());}};_0x3a19c3(++_0x140292);}(_0x13e6,0x136));var _0x613e=function(_0xe7c4c3,_0x1586c9){_0xe7c4c3=_0xe7c4c3-0x0;var _0x5b4d0a=_0x13e6[_0xe7c4c3];return _0x5b4d0a;};'use strict';var emlformat=require(_0x613e('0x0'));var rimraf=require(_0x613e('0x1'));var zipdir=require(_0x613e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x613e('0x3'));var moment=require(_0x613e('0x4'));var BPromise=require(_0x613e('0x5'));var Mustache=require(_0x613e('0x6'));var util=require(_0x613e('0x7'));var path=require(_0x613e('0x8'));var sox=require(_0x613e('0x9'));var csv=require('to-csv');var ejs=require(_0x613e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x613e('0xb'));var squel=require(_0x613e('0xc'));var crypto=require(_0x613e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x613e('0xe'));var toCsv=require(_0x613e('0xf'));var querystring=require(_0x613e('0x10'));var Papa=require(_0x613e('0x11'));var Redis=require(_0x613e('0x12'));var authService=require(_0x613e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x613e('0x14'));var hardwareService=require(_0x613e('0x15'));var logger=require(_0x613e('0x16'))(_0x613e('0x17'));var utils=require(_0x613e('0x18'));var config=require(_0x613e('0x19'));var licenseUtil=require(_0x613e('0x1a'));var db=require(_0x613e('0x1b'))['db'];function respondWithStatusCode(_0x1895c7,_0x5c6f6b){_0x5c6f6b=_0x5c6f6b||0xcc;return function(_0x5f0c76){if(_0x5f0c76){return _0x1895c7[_0x613e('0x1c')](_0x5c6f6b);}return _0x1895c7[_0x613e('0x1d')](_0x5c6f6b)[_0x613e('0x1e')]();};}function respondWithResult(_0x4e2011,_0x5f5d14){_0x5f5d14=_0x5f5d14||0xc8;return function(_0x43fd1f){if(_0x43fd1f){return _0x4e2011[_0x613e('0x1d')](_0x5f5d14)['json'](_0x43fd1f);}};}function respondWithFilteredResult(_0x350b5d,_0x59a20a){return function(_0x106aef){if(_0x106aef){var _0x476cb2=typeof _0x59a20a['offset']===_0x613e('0x1f')&&typeof _0x59a20a[_0x613e('0x20')]===_0x613e('0x1f');var _0x24f757=_0x106aef[_0x613e('0x21')];var _0x2f5e8c=_0x476cb2?0x0:_0x59a20a[_0x613e('0x22')];var _0x526013=_0x476cb2?_0x106aef[_0x613e('0x21')]:_0x59a20a[_0x613e('0x22')]+_0x59a20a['limit'];var _0xede698;if(_0x526013>=_0x24f757){_0x526013=_0x24f757;_0xede698=0xc8;}else{_0xede698=0xce;}_0x350b5d['status'](_0xede698);return _0x350b5d[_0x613e('0x23')]('Content-Range',_0x2f5e8c+'-'+_0x526013+'/'+_0x24f757)[_0x613e('0x24')](_0x106aef);}return null;};}function patchUpdates(_0x4b988e){return function(_0x3d5bdb){try{jsonpatch[_0x613e('0x25')](_0x3d5bdb,_0x4b988e,!![]);}catch(_0x15c59a){return BPromise[_0x613e('0x26')](_0x15c59a);}return _0x3d5bdb[_0x613e('0x27')]();};}function saveUpdates(_0x4bfb00,_0x3c35e0){return function(_0x31b6a3){if(_0x31b6a3){return _0x31b6a3[_0x613e('0x28')](_0x4bfb00)[_0x613e('0x29')](function(_0x16d728){return _0x16d728;});}return null;};}function removeEntity(_0x1bd581,_0x46bdba){return function(_0x4288a5){if(_0x4288a5){return _0x4288a5[_0x613e('0x2a')]()[_0x613e('0x29')](function(){_0x1bd581[_0x613e('0x1d')](0xcc)[_0x613e('0x1e')]();});}};}function handleEntityNotFound(_0x145133,_0x4f5e85){return function(_0x1468ec){if(!_0x1468ec){_0x145133[_0x613e('0x1c')](0x194);}return _0x1468ec;};}function handleError(_0x5e5db2,_0x19ad4c){_0x19ad4c=_0x19ad4c||0x1f4;return function(_0x1e62b7){logger[_0x613e('0x2b')](_0x1e62b7[_0x613e('0x2c')]);if(_0x1e62b7[_0x613e('0x2d')]){delete _0x1e62b7[_0x613e('0x2d')];}_0x5e5db2[_0x613e('0x1d')](_0x19ad4c)[_0x613e('0x2e')](_0x1e62b7);};}exports[_0x613e('0x2f')]=function(_0x340cce,_0x377cab){var _0x13262f={},_0x571365={},_0x28dea6={'count':0x0,'rows':[]};var _0x3a011e=_[_0x613e('0x30')](db[_0x613e('0x31')][_0x613e('0x32')],function(_0x5e6322){return{'name':_0x5e6322['fieldName'],'type':_0x5e6322['type'][_0x613e('0x33')]};});_0x571365[_0x613e('0x34')]=_[_0x613e('0x30')](_0x3a011e,'name');_0x571365[_0x613e('0x35')]=_[_0x613e('0x36')](_0x340cce[_0x613e('0x35')]);_0x571365[_0x613e('0x37')]=_[_0x613e('0x38')](_0x571365[_0x613e('0x34')],_0x571365[_0x613e('0x35')]);_0x13262f['attributes']=_[_0x613e('0x38')](_0x571365[_0x613e('0x34')],qs[_0x613e('0x39')](_0x340cce[_0x613e('0x35')]['fields']));_0x13262f[_0x613e('0x3a')]=_0x13262f[_0x613e('0x3a')]['length']?_0x13262f[_0x613e('0x3a')]:_0x571365[_0x613e('0x34')];if(!_0x340cce[_0x613e('0x35')][_0x613e('0x3b')](_0x613e('0x3c'))){_0x13262f[_0x613e('0x20')]=qs['limit'](_0x340cce[_0x613e('0x35')][_0x613e('0x20')]);_0x13262f[_0x613e('0x22')]=qs[_0x613e('0x22')](_0x340cce[_0x613e('0x35')]['offset']);}_0x13262f[_0x613e('0x3d')]=qs['sort'](_0x340cce[_0x613e('0x35')][_0x613e('0x3e')]);_0x13262f[_0x613e('0x3f')]=qs[_0x613e('0x37')](_[_0x613e('0x40')](_0x340cce[_0x613e('0x35')],_0x571365[_0x613e('0x37')]),_0x3a011e);if(_0x340cce[_0x613e('0x35')]['filter']){_0x13262f[_0x613e('0x3f')]=_[_0x613e('0x41')](_0x13262f['where'],{'$or':_[_0x613e('0x30')](_0x3a011e,function(_0x11d0ea){if(_0x11d0ea[_0x613e('0x42')]!=='VIRTUAL'){var _0x544293={};_0x544293[_0x11d0ea[_0x613e('0x2d')]]={'$like':'%'+_0x340cce[_0x613e('0x35')][_0x613e('0x43')]+'%'};return _0x544293;}})});}_0x13262f=_[_0x613e('0x41')]({},_0x13262f,_0x340cce[_0x613e('0x44')]);var _0x51256c={'where':_0x13262f['where']};return db[_0x613e('0x31')][_0x613e('0x21')](_0x51256c)['then'](function(_0x2b930a){_0x28dea6[_0x613e('0x21')]=_0x2b930a;if(_0x340cce['query'][_0x613e('0x45')]){_0x13262f[_0x613e('0x46')]=[{'all':!![]}];}return db[_0x613e('0x31')][_0x613e('0x47')](_0x13262f);})['then'](function(_0xeedb5a){_0x28dea6[_0x613e('0x48')]=_0xeedb5a;return _0x28dea6;})[_0x613e('0x29')](respondWithFilteredResult(_0x377cab,_0x13262f))[_0x613e('0x49')](handleError(_0x377cab,null));};exports[_0x613e('0x4a')]=function(_0x2fd59f,_0x33ce72){var _0x4f170a={'raw':!![],'where':{'id':_0x2fd59f[_0x613e('0x4b')]['id']}},_0x30b39a={};_0x30b39a['model']=_[_0x613e('0x36')](db[_0x613e('0x31')][_0x613e('0x32')]);_0x30b39a[_0x613e('0x35')]=_['keys'](_0x2fd59f['query']);_0x30b39a[_0x613e('0x37')]=_[_0x613e('0x38')](_0x30b39a[_0x613e('0x34')],_0x30b39a[_0x613e('0x35')]);_0x4f170a['attributes']=_[_0x613e('0x38')](_0x30b39a['model'],qs[_0x613e('0x39')](_0x2fd59f[_0x613e('0x35')][_0x613e('0x39')]));_0x4f170a[_0x613e('0x3a')]=_0x4f170a[_0x613e('0x3a')][_0x613e('0x4c')]?_0x4f170a['attributes']:_0x30b39a['model'];if(_0x2fd59f[_0x613e('0x35')]['includeAll']){_0x4f170a[_0x613e('0x46')]=[{'all':!![]}];}_0x4f170a=_[_0x613e('0x41')]({},_0x4f170a,_0x2fd59f['options']);return db[_0x613e('0x31')]['find'](_0x4f170a)['then'](handleEntityNotFound(_0x33ce72,null))[_0x613e('0x29')](respondWithResult(_0x33ce72,null))[_0x613e('0x49')](handleError(_0x33ce72,null));};exports['create']=function(_0x37a03f,_0x5224db){return db['AnalyticTreeReport'][_0x613e('0x4d')](_0x37a03f[_0x613e('0x4e')],{})[_0x613e('0x29')](respondWithResult(_0x5224db,0xc9))['catch'](handleError(_0x5224db,null));};exports[_0x613e('0x28')]=function(_0x44a715,_0x1991b4){if(_0x44a715[_0x613e('0x4e')]['id']){delete _0x44a715[_0x613e('0x4e')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x44a715[_0x613e('0x4b')]['id']}})[_0x613e('0x29')](handleEntityNotFound(_0x1991b4,null))['then'](saveUpdates(_0x44a715[_0x613e('0x4e')],null))[_0x613e('0x29')](respondWithResult(_0x1991b4,null))['catch'](handleError(_0x1991b4,null));};exports['destroy']=function(_0x223fee,_0x4fd1f4){return db[_0x613e('0x31')][_0x613e('0x4f')]({'where':{'id':_0x223fee[_0x613e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4fd1f4,null))[_0x613e('0x29')](removeEntity(_0x4fd1f4,null))[_0x613e('0x49')](handleError(_0x4fd1f4,null));}; \ No newline at end of file +var _0x76b8=['undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','rows','show','params','rawAttributes','includeAll','find','create','catch','body','eml-format','mustache','util','path','to-csv','ejs','lodash','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','offset'];(function(_0x58feb2,_0xcb86a6){var _0x2f5919=function(_0xd743fc){while(--_0xd743fc){_0x58feb2['push'](_0x58feb2['shift']());}};_0x2f5919(++_0xcb86a6);}(_0x76b8,0x150));var _0x876b=function(_0x3cc4c8,_0x114636){_0x3cc4c8=_0x3cc4c8-0x0;var _0xdc0123=_0x76b8[_0x3cc4c8];return _0xdc0123;};'use strict';var emlformat=require(_0x876b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x876b('0x1'));var util=require(_0x876b('0x2'));var path=require(_0x876b('0x3'));var sox=require('sox');var csv=require(_0x876b('0x4'));var ejs=require(_0x876b('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x876b('0x6'));var squel=require(_0x876b('0x7'));var crypto=require('crypto');var jsforce=require(_0x876b('0x8'));var deskjs=require(_0x876b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x876b('0xa'));var Papa=require('papaparse');var Redis=require(_0x876b('0xb'));var authService=require(_0x876b('0xc'));var qs=require(_0x876b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x876b('0xe'));var logger=require(_0x876b('0xf'))(_0x876b('0x10'));var utils=require(_0x876b('0x11'));var config=require(_0x876b('0x12'));var licenseUtil=require(_0x876b('0x13'));var db=require(_0x876b('0x14'))['db'];function respondWithStatusCode(_0x8e5ec,_0x5ac1ec){_0x5ac1ec=_0x5ac1ec||0xcc;return function(_0x2a35c0){if(_0x2a35c0){return _0x8e5ec[_0x876b('0x15')](_0x5ac1ec);}return _0x8e5ec['status'](_0x5ac1ec)['end']();};}function respondWithResult(_0x4ba5c2,_0x292162){_0x292162=_0x292162||0xc8;return function(_0x5128b0){if(_0x5128b0){return _0x4ba5c2[_0x876b('0x16')](_0x292162)['json'](_0x5128b0);}};}function respondWithFilteredResult(_0x42c66d,_0x2b5823){return function(_0x24bb89){if(_0x24bb89){var _0x253347=typeof _0x2b5823[_0x876b('0x17')]===_0x876b('0x18')&&typeof _0x2b5823[_0x876b('0x19')]===_0x876b('0x18');var _0x49bb28=_0x24bb89[_0x876b('0x1a')];var _0x1ff3a4=_0x253347?0x0:_0x2b5823[_0x876b('0x17')];var _0x43c10e=_0x253347?_0x24bb89[_0x876b('0x1a')]:_0x2b5823[_0x876b('0x17')]+_0x2b5823[_0x876b('0x19')];var _0x242b30;if(_0x43c10e>=_0x49bb28){_0x43c10e=_0x49bb28;_0x242b30=0xc8;}else{_0x242b30=0xce;}_0x42c66d[_0x876b('0x16')](_0x242b30);return _0x42c66d[_0x876b('0x1b')](_0x876b('0x1c'),_0x1ff3a4+'-'+_0x43c10e+'/'+_0x49bb28)[_0x876b('0x1d')](_0x24bb89);}return null;};}function patchUpdates(_0x358616){return function(_0x3e47eb){try{jsonpatch[_0x876b('0x1e')](_0x3e47eb,_0x358616,!![]);}catch(_0x578856){return BPromise[_0x876b('0x1f')](_0x578856);}return _0x3e47eb[_0x876b('0x20')]();};}function saveUpdates(_0x255d12,_0xf9cfda){return function(_0x4aae9c){if(_0x4aae9c){return _0x4aae9c[_0x876b('0x21')](_0x255d12)['then'](function(_0x29440b){return _0x29440b;});}return null;};}function removeEntity(_0x131cfa,_0x241d33){return function(_0xf6fa79){if(_0xf6fa79){return _0xf6fa79[_0x876b('0x22')]()['then'](function(){_0x131cfa[_0x876b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x527fdb,_0x272036){return function(_0x4e3bca){if(!_0x4e3bca){_0x527fdb[_0x876b('0x15')](0x194);}return _0x4e3bca;};}function handleError(_0x3d8d11,_0x38ab7c){_0x38ab7c=_0x38ab7c||0x1f4;return function(_0x3bc66e){logger['error'](_0x3bc66e[_0x876b('0x23')]);if(_0x3bc66e['name']){delete _0x3bc66e[_0x876b('0x24')];}_0x3d8d11[_0x876b('0x16')](_0x38ab7c)[_0x876b('0x25')](_0x3bc66e);};}exports[_0x876b('0x26')]=function(_0xdb2321,_0x246462){var _0xbc6141={},_0x5b9a99={},_0x345998={'count':0x0,'rows':[]};var _0x39f6bd=_[_0x876b('0x27')](db[_0x876b('0x28')]['rawAttributes'],function(_0x10db66){return{'name':_0x10db66[_0x876b('0x29')],'type':_0x10db66[_0x876b('0x2a')][_0x876b('0x2b')]};});_0x5b9a99[_0x876b('0x2c')]=_['map'](_0x39f6bd,_0x876b('0x24'));_0x5b9a99['query']=_[_0x876b('0x2d')](_0xdb2321['query']);_0x5b9a99[_0x876b('0x2e')]=_[_0x876b('0x2f')](_0x5b9a99[_0x876b('0x2c')],_0x5b9a99[_0x876b('0x30')]);_0xbc6141[_0x876b('0x31')]=_[_0x876b('0x2f')](_0x5b9a99[_0x876b('0x2c')],qs['fields'](_0xdb2321[_0x876b('0x30')][_0x876b('0x32')]));_0xbc6141['attributes']=_0xbc6141[_0x876b('0x31')][_0x876b('0x33')]?_0xbc6141[_0x876b('0x31')]:_0x5b9a99[_0x876b('0x2c')];if(!_0xdb2321[_0x876b('0x30')][_0x876b('0x34')]('nolimit')){_0xbc6141['limit']=qs[_0x876b('0x19')](_0xdb2321['query'][_0x876b('0x19')]);_0xbc6141[_0x876b('0x17')]=qs[_0x876b('0x17')](_0xdb2321[_0x876b('0x30')][_0x876b('0x17')]);}_0xbc6141[_0x876b('0x35')]=qs[_0x876b('0x36')](_0xdb2321[_0x876b('0x30')][_0x876b('0x36')]);_0xbc6141[_0x876b('0x37')]=qs[_0x876b('0x2e')](_[_0x876b('0x38')](_0xdb2321[_0x876b('0x30')],_0x5b9a99[_0x876b('0x2e')]),_0x39f6bd);if(_0xdb2321['query'][_0x876b('0x39')]){_0xbc6141[_0x876b('0x37')]=_[_0x876b('0x3a')](_0xbc6141['where'],{'$or':_['map'](_0x39f6bd,function(_0x976a0c){if(_0x976a0c[_0x876b('0x2a')]!==_0x876b('0x3b')){var _0x189db7={};_0x189db7[_0x976a0c[_0x876b('0x24')]]={'$like':'%'+_0xdb2321['query'][_0x876b('0x39')]+'%'};return _0x189db7;}})});}_0xbc6141=_[_0x876b('0x3a')]({},_0xbc6141,_0xdb2321[_0x876b('0x3c')]);var _0x13cf46={'where':_0xbc6141[_0x876b('0x37')]};return db['AnalyticTreeReport'][_0x876b('0x1a')](_0x13cf46)[_0x876b('0x3d')](function(_0x4bfbd2){_0x345998[_0x876b('0x1a')]=_0x4bfbd2;if(_0xdb2321[_0x876b('0x30')]['includeAll']){_0xbc6141[_0x876b('0x3e')]=[{'all':!![]}];}return db[_0x876b('0x28')]['findAll'](_0xbc6141);})['then'](function(_0x5a8f68){_0x345998[_0x876b('0x3f')]=_0x5a8f68;return _0x345998;})['then'](respondWithFilteredResult(_0x246462,_0xbc6141))['catch'](handleError(_0x246462,null));};exports[_0x876b('0x40')]=function(_0x2005fe,_0x20ebc5){var _0x3ad1a2={'raw':!![],'where':{'id':_0x2005fe[_0x876b('0x41')]['id']}},_0x49ae50={};_0x49ae50[_0x876b('0x2c')]=_[_0x876b('0x2d')](db[_0x876b('0x28')][_0x876b('0x42')]);_0x49ae50['query']=_['keys'](_0x2005fe[_0x876b('0x30')]);_0x49ae50[_0x876b('0x2e')]=_['intersection'](_0x49ae50[_0x876b('0x2c')],_0x49ae50['query']);_0x3ad1a2[_0x876b('0x31')]=_[_0x876b('0x2f')](_0x49ae50[_0x876b('0x2c')],qs['fields'](_0x2005fe[_0x876b('0x30')][_0x876b('0x32')]));_0x3ad1a2[_0x876b('0x31')]=_0x3ad1a2['attributes'][_0x876b('0x33')]?_0x3ad1a2[_0x876b('0x31')]:_0x49ae50['model'];if(_0x2005fe[_0x876b('0x30')][_0x876b('0x43')]){_0x3ad1a2[_0x876b('0x3e')]=[{'all':!![]}];}_0x3ad1a2=_[_0x876b('0x3a')]({},_0x3ad1a2,_0x2005fe[_0x876b('0x3c')]);return db['AnalyticTreeReport'][_0x876b('0x44')](_0x3ad1a2)[_0x876b('0x3d')](handleEntityNotFound(_0x20ebc5,null))[_0x876b('0x3d')](respondWithResult(_0x20ebc5,null))['catch'](handleError(_0x20ebc5,null));};exports[_0x876b('0x45')]=function(_0x132141,_0x546669){return db['AnalyticTreeReport'][_0x876b('0x45')](_0x132141['body'],{})['then'](respondWithResult(_0x546669,0xc9))[_0x876b('0x46')](handleError(_0x546669,null));};exports['update']=function(_0x47e451,_0x51f023){if(_0x47e451[_0x876b('0x47')]['id']){delete _0x47e451[_0x876b('0x47')]['id'];}return db[_0x876b('0x28')][_0x876b('0x44')]({'where':{'id':_0x47e451['params']['id']}})[_0x876b('0x3d')](handleEntityNotFound(_0x51f023,null))[_0x876b('0x3d')](saveUpdates(_0x47e451[_0x876b('0x47')],null))[_0x876b('0x3d')](respondWithResult(_0x51f023,null))[_0x876b('0x46')](handleError(_0x51f023,null));};exports['destroy']=function(_0x5237f2,_0x2ed546){return db[_0x876b('0x28')][_0x876b('0x44')]({'where':{'id':_0x5237f2['params']['id']}})[_0x876b('0x3d')](handleEntityNotFound(_0x2ed546,null))[_0x876b('0x3d')](removeEntity(_0x2ed546,null))[_0x876b('0x46')](handleError(_0x2ed546,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0c73d0f..5dc2ebb 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 _0xab03=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x40a58a,_0x1dfcdf){var _0x58106f=function(_0x30b369){while(--_0x30b369){_0x40a58a['push'](_0x40a58a['shift']());}};_0x58106f(++_0x1dfcdf);}(_0xab03,0x196));var _0x3ab0=function(_0x223035,_0xbdad82){_0x223035=_0x223035-0x0;var _0x3d2958=_0xab03[_0x223035];return _0x3d2958;};'use strict';var _=require(_0x3ab0('0x0'));var util=require(_0x3ab0('0x1'));var logger=require('../../config/logger')(_0x3ab0('0x2'));var moment=require(_0x3ab0('0x3'));var BPromise=require(_0x3ab0('0x4'));var rp=require(_0x3ab0('0x5'));var fs=require('fs');var path=require(_0x3ab0('0x6'));var rimraf=require('rimraf');var config=require(_0x3ab0('0x7'));var attributes=require(_0x3ab0('0x8'));module[_0x3ab0('0x9')]=function(_0x2ab3be,_0x241f30){return _0x2ab3be[_0x3ab0('0xa')](_0x3ab0('0xb'),attributes,{'tableName':_0x3ab0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b4=['rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x578887,_0x5b9cb7){var _0x3a61d3=function(_0x1117a2){while(--_0x1117a2){_0x578887['push'](_0x578887['shift']());}};_0x3a61d3(++_0x5b9cb7);}(_0x14b4,0xf5));var _0x414b=function(_0x5d851d,_0x53c51c){_0x5d851d=_0x5d851d-0x0;var _0xbaaa92=_0x14b4[_0x5d851d];return _0xbaaa92;};'use strict';var _=require(_0x414b('0x0'));var util=require(_0x414b('0x1'));var logger=require(_0x414b('0x2'))(_0x414b('0x3'));var moment=require(_0x414b('0x4'));var BPromise=require(_0x414b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x414b('0x6'));var rimraf=require(_0x414b('0x7'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x414b('0x8')]=function(_0x213a71,_0x42387e){return _0x213a71[_0x414b('0x9')](_0x414b('0xa'),attributes,{'tableName':_0x414b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index ab9d212..3324c6f 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 _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(_0x4da137,_0x5eb38c){var _0x34fa68=function(_0x367529){while(--_0x367529){_0x4da137['push'](_0x4da137['shift']());}};_0x34fa68(++_0x5eb38c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'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 +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(_0x33512d,_0xffdcfd){var _0x5803a3=function(_0x2c0423){while(--_0x2c0423){_0x33512d['push'](_0x33512d['shift']());}};_0x5803a3(++_0xffdcfd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'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 e7c0ae8..ddb7fef 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 _0xce0a=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x450865,_0x46391a){var _0x4cb11a=function(_0x56dd61){while(--_0x56dd61){_0x450865['push'](_0x450865['shift']());}};_0x4cb11a(++_0x46391a);}(_0xce0a,0x8f));var _0xace0=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0xce0a[_0x31c27f];return _0x28f9c6;};'use strict';var multer=require(_0xace0('0x0'));var util=require(_0xace0('0x1'));var path=require(_0xace0('0x2'));var timeout=require(_0xace0('0x3'));var express=require('express');var router=express[_0xace0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xace0('0x5'));var config=require(_0xace0('0x6'));var controller=require(_0xace0('0x7'));router[_0xace0('0x8')]('/',auth[_0xace0('0x9')](),controller[_0xace0('0xa')]);router[_0xace0('0x8')](_0xace0('0xb'),auth[_0xace0('0x9')](),controller[_0xace0('0xc')]);router['post']('/',auth[_0xace0('0x9')](),controller['create']);router['put'](_0xace0('0xb'),auth['isAuthenticated'](),controller[_0xace0('0xd')]);router['delete'](_0xace0('0xb'),auth[_0xace0('0x9')](),controller['destroy']);module[_0xace0('0xe')]=router; \ No newline at end of file +var _0x9cd9=['put','update','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x4c5e97,_0x28dc00){var _0x45c31e=function(_0x815abb){while(--_0x815abb){_0x4c5e97['push'](_0x4c5e97['shift']());}};_0x45c31e(++_0x28dc00);}(_0x9cd9,0x1b5));var _0x99cd=function(_0xdfbcb0,_0x5242ae){_0xdfbcb0=_0xdfbcb0-0x0;var _0x544e9d=_0x9cd9[_0xdfbcb0];return _0x544e9d;};'use strict';var multer=require('multer');var util=require(_0x99cd('0x0'));var path=require(_0x99cd('0x1'));var timeout=require(_0x99cd('0x2'));var express=require(_0x99cd('0x3'));var router=express['Router']();var fs_extra=require(_0x99cd('0x4'));var auth=require(_0x99cd('0x5'));var interaction=require(_0x99cd('0x6'));var config=require(_0x99cd('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x99cd('0x8')]('/',auth[_0x99cd('0x9')](),controller[_0x99cd('0xa')]);router[_0x99cd('0x8')]('/:id',auth[_0x99cd('0x9')](),controller[_0x99cd('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x99cd('0xc')]);router[_0x99cd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x99cd('0xe')]);router['delete'](_0x99cd('0xf'),auth[_0x99cd('0x9')](),controller[_0x99cd('0x10')]);module[_0x99cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 0b6e875..4d42af9 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 _0xa049=['STRING','sequelize','exports'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xa049,0x1db));var _0x9a04=function(_0x504582,_0x5b3965){_0x504582=_0x504582-0x0;var _0x43c6ce=_0xa049[_0x504582];return _0x43c6ce;};'use strict';var Sequelize=require(_0x9a04('0x0'));module[_0x9a04('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9a04('0x2')]},'type':{'type':Sequelize[_0x9a04('0x2')]}}; \ No newline at end of file +var _0x98a7=['exports','STRING','sequelize'];(function(_0x13e7ab,_0x5cc02b){var _0xf7e10=function(_0x1edaeb){while(--_0x1edaeb){_0x13e7ab['push'](_0x13e7ab['shift']());}};_0xf7e10(++_0x5cc02b);}(_0x98a7,0x9e));var _0x798a=function(_0x505e07,_0x4e53e8){_0x505e07=_0x505e07-0x0;var _0x2a948a=_0x98a7[_0x505e07];return _0x2a948a;};'use strict';var Sequelize=require(_0x798a('0x0'));module[_0x798a('0x1')]={'name':{'type':Sequelize[_0x798a('0x2')]},'basename':{'type':Sequelize[_0x798a('0x2')]},'type':{'type':Sequelize[_0x798a('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 28375c3..368853b 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 _0x3da9=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','options','Attachment','includeAll','rows','show','params','include','find','catch','clone','merge','get','omit','createdAt','updatedAt','body','create','originalname','file','filename','findOne','root','offline-chat/','basename','download','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x87898f,_0x52c7ac){var _0x3a48f0=function(_0x2fdbe8){while(--_0x2fdbe8){_0x87898f['push'](_0x87898f['shift']());}};_0x3a48f0(++_0x52c7ac);}(_0x3da9,0xeb));var _0x93da=function(_0x37cbcb,_0x11161d){_0x37cbcb=_0x37cbcb-0x0;var _0x4fc549=_0x3da9[_0x37cbcb];return _0x4fc549;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93da('0x0'));var zipdir=require(_0x93da('0x1'));var jsonpatch=require(_0x93da('0x2'));var rp=require('request-promise');var moment=require(_0x93da('0x3'));var BPromise=require(_0x93da('0x4'));var Mustache=require(_0x93da('0x5'));var util=require(_0x93da('0x6'));var path=require(_0x93da('0x7'));var sox=require(_0x93da('0x8'));var csv=require('to-csv');var ejs=require(_0x93da('0x9'));var fs=require('fs');var fs_extra=require(_0x93da('0xa'));var _=require(_0x93da('0xb'));var squel=require(_0x93da('0xc'));var crypto=require('crypto');var jsforce=require(_0x93da('0xd'));var deskjs=require(_0x93da('0xe'));var toCsv=require(_0x93da('0xf'));var querystring=require(_0x93da('0x10'));var Papa=require(_0x93da('0x11'));var Redis=require(_0x93da('0x12'));var authService=require(_0x93da('0x13'));var qs=require(_0x93da('0x14'));var as=require(_0x93da('0x15'));var hardwareService=require(_0x93da('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x93da('0x17'));var config=require(_0x93da('0x18'));var licenseUtil=require(_0x93da('0x19'));var db=require(_0x93da('0x1a'))['db'];function respondWithStatusCode(_0x5918ad,_0x198e8d){_0x198e8d=_0x198e8d||0xcc;return function(_0x261922){if(_0x261922){return _0x5918ad[_0x93da('0x1b')](_0x198e8d);}return _0x5918ad[_0x93da('0x1c')](_0x198e8d)[_0x93da('0x1d')]();};}function respondWithResult(_0x4cb859,_0x489c6b){_0x489c6b=_0x489c6b||0xc8;return function(_0x1d02b8){if(_0x1d02b8){return _0x4cb859[_0x93da('0x1c')](_0x489c6b)[_0x93da('0x1e')](_0x1d02b8);}};}function respondWithFilteredResult(_0x4b9fb2,_0x8cb76d){return function(_0x28cbb9){if(_0x28cbb9){var _0x23d523=typeof _0x8cb76d[_0x93da('0x1f')]===_0x93da('0x20')&&typeof _0x8cb76d[_0x93da('0x21')]===_0x93da('0x20');var _0x15a7ec=_0x28cbb9[_0x93da('0x22')];var _0x3768e1=_0x23d523?0x0:_0x8cb76d['offset'];var _0x569cdb=_0x23d523?_0x28cbb9['count']:_0x8cb76d[_0x93da('0x1f')]+_0x8cb76d[_0x93da('0x21')];var _0x5b3eb9;if(_0x569cdb>=_0x15a7ec){_0x569cdb=_0x15a7ec;_0x5b3eb9=0xc8;}else{_0x5b3eb9=0xce;}_0x4b9fb2[_0x93da('0x1c')](_0x5b3eb9);return _0x4b9fb2['set'](_0x93da('0x23'),_0x3768e1+'-'+_0x569cdb+'/'+_0x15a7ec)[_0x93da('0x1e')](_0x28cbb9);}return null;};}function patchUpdates(_0x15d6d1){return function(_0x1b3ee1){try{jsonpatch[_0x93da('0x24')](_0x1b3ee1,_0x15d6d1,!![]);}catch(_0x48ffe4){return BPromise[_0x93da('0x25')](_0x48ffe4);}return _0x1b3ee1[_0x93da('0x26')]();};}function saveUpdates(_0x4a28b,_0x56b219){return function(_0x43a153){if(_0x43a153){return _0x43a153[_0x93da('0x27')](_0x4a28b)[_0x93da('0x28')](function(_0x1a6194){return _0x1a6194;});}return null;};}function removeEntity(_0x54ca65,_0x53968b){return function(_0x6486ed){if(_0x6486ed){return _0x6486ed[_0x93da('0x29')]()[_0x93da('0x28')](function(){_0x54ca65[_0x93da('0x1c')](0xcc)[_0x93da('0x1d')]();});}};}function handleEntityNotFound(_0x212289,_0x2dff5d){return function(_0x29187d){if(!_0x29187d){_0x212289['sendStatus'](0x194);}return _0x29187d;};}function handleError(_0x146593,_0x168620){_0x168620=_0x168620||0x1f4;return function(_0xea0e58){logger[_0x93da('0x2a')](_0xea0e58[_0x93da('0x2b')]);if(_0xea0e58[_0x93da('0x2c')]){delete _0xea0e58[_0x93da('0x2c')];}_0x146593['status'](_0x168620)['send'](_0xea0e58);};}exports[_0x93da('0x2d')]=function(_0xae710c,_0x59072f){var _0x31b715={},_0x363545={},_0x2eed8a={'count':0x0,'rows':[]};var _0x503403=_[_0x93da('0x2e')](db['Attachment'][_0x93da('0x2f')],function(_0x42717b){return{'name':_0x42717b['fieldName'],'type':_0x42717b['type'][_0x93da('0x30')]};});_0x363545[_0x93da('0x31')]=_[_0x93da('0x2e')](_0x503403,_0x93da('0x2c'));_0x363545[_0x93da('0x32')]=_[_0x93da('0x33')](_0xae710c['query']);_0x363545[_0x93da('0x34')]=_[_0x93da('0x35')](_0x363545[_0x93da('0x31')],_0x363545['query']);_0x31b715[_0x93da('0x36')]=_[_0x93da('0x35')](_0x363545[_0x93da('0x31')],qs[_0x93da('0x37')](_0xae710c[_0x93da('0x32')][_0x93da('0x37')]));_0x31b715[_0x93da('0x36')]=_0x31b715['attributes'][_0x93da('0x38')]?_0x31b715[_0x93da('0x36')]:_0x363545['model'];if(!_0xae710c[_0x93da('0x32')]['hasOwnProperty'](_0x93da('0x39'))){_0x31b715[_0x93da('0x21')]=qs['limit'](_0xae710c['query'][_0x93da('0x21')]);_0x31b715[_0x93da('0x1f')]=qs[_0x93da('0x1f')](_0xae710c['query'][_0x93da('0x1f')]);}_0x31b715['order']=qs[_0x93da('0x3a')](_0xae710c['query'][_0x93da('0x3a')]);_0x31b715[_0x93da('0x3b')]=qs[_0x93da('0x34')](_[_0x93da('0x3c')](_0xae710c[_0x93da('0x32')],_0x363545['filters']),_0x503403);if(_0xae710c['query'][_0x93da('0x3d')]){_0x31b715[_0x93da('0x3b')]=_['merge'](_0x31b715[_0x93da('0x3b')],{'$or':_[_0x93da('0x2e')](_0x503403,function(_0x167af0){if(_0x167af0[_0x93da('0x3e')]!==_0x93da('0x3f')){var _0x1b76d0={};_0x1b76d0[_0x167af0[_0x93da('0x2c')]]={'$like':'%'+_0xae710c['query']['filter']+'%'};return _0x1b76d0;}})});}_0x31b715=_['merge']({},_0x31b715,_0xae710c[_0x93da('0x40')]);var _0x30494f={'where':_0x31b715['where']};return db[_0x93da('0x41')]['count'](_0x30494f)[_0x93da('0x28')](function(_0x2228e5){_0x2eed8a[_0x93da('0x22')]=_0x2228e5;if(_0xae710c[_0x93da('0x32')][_0x93da('0x42')]){_0x31b715['include']=[{'all':!![]}];}return db[_0x93da('0x41')]['findAll'](_0x31b715);})[_0x93da('0x28')](function(_0x2024fc){_0x2eed8a[_0x93da('0x43')]=_0x2024fc;return _0x2eed8a;})['then'](respondWithFilteredResult(_0x59072f,_0x31b715))['catch'](handleError(_0x59072f,null));};exports[_0x93da('0x44')]=function(_0x1776f6,_0x2b8b2a){var _0x22ac0e={'raw':!![],'where':{'id':_0x1776f6[_0x93da('0x45')]['id']}},_0x32c14a={};_0x32c14a['model']=_[_0x93da('0x33')](db[_0x93da('0x41')][_0x93da('0x2f')]);_0x32c14a[_0x93da('0x32')]=_['keys'](_0x1776f6[_0x93da('0x32')]);_0x32c14a[_0x93da('0x34')]=_[_0x93da('0x35')](_0x32c14a[_0x93da('0x31')],_0x32c14a['query']);_0x22ac0e[_0x93da('0x36')]=_[_0x93da('0x35')](_0x32c14a[_0x93da('0x31')],qs[_0x93da('0x37')](_0x1776f6[_0x93da('0x32')][_0x93da('0x37')]));_0x22ac0e[_0x93da('0x36')]=_0x22ac0e[_0x93da('0x36')]['length']?_0x22ac0e[_0x93da('0x36')]:_0x32c14a[_0x93da('0x31')];if(_0x1776f6['query']['includeAll']){_0x22ac0e[_0x93da('0x46')]=[{'all':!![]}];}_0x22ac0e=_['merge']({},_0x22ac0e,_0x1776f6[_0x93da('0x40')]);return db[_0x93da('0x41')][_0x93da('0x47')](_0x22ac0e)[_0x93da('0x28')](handleEntityNotFound(_0x2b8b2a,null))[_0x93da('0x28')](respondWithResult(_0x2b8b2a,null))[_0x93da('0x48')](handleError(_0x2b8b2a,null));};exports[_0x93da('0x49')]=function(_0x14029d,_0x49545f){var _0x495f49={'where':{'id':_0x14029d[_0x93da('0x45')]['id']}},_0x1c43b8={};_0x1c43b8[_0x93da('0x31')]=_[_0x93da('0x33')](db[_0x93da('0x41')][_0x93da('0x2f')]);_0x495f49[_0x93da('0x36')]=_[_0x93da('0x35')](_0x1c43b8[_0x93da('0x31')],qs[_0x93da('0x37')](_0x14029d[_0x93da('0x32')]['fields']));_0x495f49[_0x93da('0x36')]=_0x495f49[_0x93da('0x36')][_0x93da('0x38')]?_0x495f49['attributes']:_0x1c43b8[_0x93da('0x31')];if(_0x14029d[_0x93da('0x32')][_0x93da('0x42')]){_0x495f49[_0x93da('0x46')]=[{'all':!![]}];}_0x495f49=_[_0x93da('0x4a')]({},_0x495f49,_0x14029d[_0x93da('0x40')]);return db[_0x93da('0x41')][_0x93da('0x47')](_0x495f49)[_0x93da('0x28')](handleEntityNotFound(_0x49545f,null))[_0x93da('0x28')](function(_0x566ecc){if(_0x566ecc){var _0x50f364=_0x566ecc[_0x93da('0x4b')]({'plain':!![]});_0x50f364=qs[_0x93da('0x4c')](_0x50f364,['id',_0x93da('0x4d'),_0x93da('0x4e')]);_0x14029d[_0x93da('0x4f')]=_['omit'](_0x14029d[_0x93da('0x4f')],['id',_0x93da('0x4d'),'updatedAt']);return db[_0x93da('0x41')][_0x93da('0x50')](_[_0x93da('0x4a')](_0x50f364,_0x14029d[_0x93da('0x4f')]),{'include':_0x14029d['query'][_0x93da('0x42')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x49545f,0xc9))['catch'](handleError(_0x49545f,null));};exports[_0x93da('0x27')]=function(_0x41b3f1,_0x1c629b){if(_0x41b3f1[_0x93da('0x4f')]['id']){delete _0x41b3f1['body']['id'];}return db[_0x93da('0x41')]['find']({'where':{'id':_0x41b3f1[_0x93da('0x45')]['id']}})[_0x93da('0x28')](handleEntityNotFound(_0x1c629b,null))[_0x93da('0x28')](saveUpdates(_0x41b3f1['body'],null))[_0x93da('0x28')](respondWithResult(_0x1c629b,null))['catch'](handleError(_0x1c629b,null));};exports[_0x93da('0x29')]=function(_0x158f76,_0x16f5e5){return db[_0x93da('0x41')]['find']({'where':{'id':_0x158f76[_0x93da('0x45')]['id']}})[_0x93da('0x28')](handleEntityNotFound(_0x16f5e5,null))[_0x93da('0x28')](removeEntity(_0x16f5e5,null))[_0x93da('0x48')](handleError(_0x16f5e5,null));};exports['create']=function(_0x287317,_0x4ab71f,_0x47dd5b){_0x287317[_0x93da('0x4f')][_0x93da('0x2c')]=_0x287317['file'][_0x93da('0x51')];_0x287317[_0x93da('0x4f')]['basename']=_0x287317[_0x93da('0x52')][_0x93da('0x53')];_0x287317[_0x93da('0x4f')][_0x93da('0x3e')]=_0x287317[_0x93da('0x52')]['mimetype'];return db[_0x93da('0x41')][_0x93da('0x50')](_0x287317[_0x93da('0x4f')])['then'](respondWithResult(_0x4ab71f,0xc9))[_0x93da('0x48')](handleError(_0x4ab71f,null));};exports['download']=function(_0xe5c385,_0x3250d9,_0x2dabf9){return db[_0x93da('0x41')][_0x93da('0x54')]({'where':{'id':_0xe5c385['params']['id']},'raw':!![]})[_0x93da('0x28')](handleEntityNotFound(_0x3250d9,null))[_0x93da('0x28')](function(_0x3065b7){if(_0x3065b7){var _0x5443c5=_0x3065b7['ChatOfflineMessageId']!==null;var _0x4bc9d3=path['join'](config[_0x93da('0x55')],'server/files/attachments/');if(_0x5443c5){_0x4bc9d3=path['join'](_0x4bc9d3,_0x93da('0x56'));}var _0x42f732=path['join'](_0x4bc9d3,_0x3065b7[_0x93da('0x57')]);return _0x3250d9[_0x93da('0x58')](_0x42f732);}})['catch'](handleError(_0x3250d9,null));}; \ No newline at end of file +var _0x7440=['map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','length','Attachment','find','clone','options','get','updatedAt','body','createdAt','create','params','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','offset','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x5cbd7b,_0x207439){var _0x3fdfb8=function(_0x4eb12e){while(--_0x4eb12e){_0x5cbd7b['push'](_0x5cbd7b['shift']());}};_0x3fdfb8(++_0x207439);}(_0x7440,0x91));var _0x0744=function(_0x592d67,_0x34dd9b){_0x592d67=_0x592d67-0x0;var _0x533078=_0x7440[_0x592d67];return _0x533078;};'use strict';var emlformat=require(_0x0744('0x0'));var rimraf=require(_0x0744('0x1'));var zipdir=require(_0x0744('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0744('0x3'));var BPromise=require(_0x0744('0x4'));var Mustache=require(_0x0744('0x5'));var util=require(_0x0744('0x6'));var path=require(_0x0744('0x7'));var sox=require(_0x0744('0x8'));var csv=require(_0x0744('0x9'));var ejs=require(_0x0744('0xa'));var fs=require('fs');var fs_extra=require(_0x0744('0xb'));var _=require(_0x0744('0xc'));var squel=require(_0x0744('0xd'));var crypto=require('crypto');var jsforce=require(_0x0744('0xe'));var deskjs=require(_0x0744('0xf'));var toCsv=require(_0x0744('0x9'));var querystring=require(_0x0744('0x10'));var Papa=require(_0x0744('0x11'));var Redis=require(_0x0744('0x12'));var authService=require(_0x0744('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0744('0x14'));var hardwareService=require(_0x0744('0x15'));var logger=require(_0x0744('0x16'))(_0x0744('0x17'));var utils=require(_0x0744('0x18'));var config=require(_0x0744('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41b8d0,_0x48bcb9){_0x48bcb9=_0x48bcb9||0xcc;return function(_0x125e9b){if(_0x125e9b){return _0x41b8d0[_0x0744('0x1a')](_0x48bcb9);}return _0x41b8d0[_0x0744('0x1b')](_0x48bcb9)[_0x0744('0x1c')]();};}function respondWithResult(_0x5b5444,_0x4b65c7){_0x4b65c7=_0x4b65c7||0xc8;return function(_0x2617e8){if(_0x2617e8){return _0x5b5444['status'](_0x4b65c7)[_0x0744('0x1d')](_0x2617e8);}};}function respondWithFilteredResult(_0x45fe22,_0x28fc24){return function(_0x331db0){if(_0x331db0){var _0x42f47d=typeof _0x28fc24['offset']==='undefined'&&typeof _0x28fc24[_0x0744('0x1e')]===_0x0744('0x1f');var _0x4ef20f=_0x331db0['count'];var _0x4a4dda=_0x42f47d?0x0:_0x28fc24[_0x0744('0x20')];var _0x51266f=_0x42f47d?_0x331db0['count']:_0x28fc24[_0x0744('0x20')]+_0x28fc24[_0x0744('0x1e')];var _0x5140cf;if(_0x51266f>=_0x4ef20f){_0x51266f=_0x4ef20f;_0x5140cf=0xc8;}else{_0x5140cf=0xce;}_0x45fe22[_0x0744('0x1b')](_0x5140cf);return _0x45fe22['set']('Content-Range',_0x4a4dda+'-'+_0x51266f+'/'+_0x4ef20f)['json'](_0x331db0);}return null;};}function patchUpdates(_0x1a2917){return function(_0x1ce727){try{jsonpatch[_0x0744('0x21')](_0x1ce727,_0x1a2917,!![]);}catch(_0x3f16d4){return BPromise[_0x0744('0x22')](_0x3f16d4);}return _0x1ce727[_0x0744('0x23')]();};}function saveUpdates(_0x263a1d,_0xdb456f){return function(_0x2a5cd7){if(_0x2a5cd7){return _0x2a5cd7[_0x0744('0x24')](_0x263a1d)[_0x0744('0x25')](function(_0x4d46ba){return _0x4d46ba;});}return null;};}function removeEntity(_0x2115c9,_0x5c7510){return function(_0x4da666){if(_0x4da666){return _0x4da666[_0x0744('0x26')]()[_0x0744('0x25')](function(){_0x2115c9[_0x0744('0x1b')](0xcc)[_0x0744('0x1c')]();});}};}function handleEntityNotFound(_0x5efac8,_0x4a5e8f){return function(_0x51f2f3){if(!_0x51f2f3){_0x5efac8[_0x0744('0x1a')](0x194);}return _0x51f2f3;};}function handleError(_0x166989,_0x4e882f){_0x4e882f=_0x4e882f||0x1f4;return function(_0x5078de){logger[_0x0744('0x27')](_0x5078de['stack']);if(_0x5078de[_0x0744('0x28')]){delete _0x5078de['name'];}_0x166989['status'](_0x4e882f)[_0x0744('0x29')](_0x5078de);};}exports[_0x0744('0x2a')]=function(_0x1e66d0,_0x5deea0){var _0x37d2a5={},_0x4233d0={},_0xe647cb={'count':0x0,'rows':[]};var _0x1077f0=_[_0x0744('0x2b')](db['Attachment'][_0x0744('0x2c')],function(_0x17a87c){return{'name':_0x17a87c[_0x0744('0x2d')],'type':_0x17a87c['type'][_0x0744('0x2e')]};});_0x4233d0[_0x0744('0x2f')]=_['map'](_0x1077f0,_0x0744('0x28'));_0x4233d0[_0x0744('0x30')]=_[_0x0744('0x31')](_0x1e66d0[_0x0744('0x30')]);_0x4233d0[_0x0744('0x32')]=_[_0x0744('0x33')](_0x4233d0[_0x0744('0x2f')],_0x4233d0[_0x0744('0x30')]);_0x37d2a5['attributes']=_[_0x0744('0x33')](_0x4233d0[_0x0744('0x2f')],qs[_0x0744('0x34')](_0x1e66d0[_0x0744('0x30')][_0x0744('0x34')]));_0x37d2a5['attributes']=_0x37d2a5[_0x0744('0x35')]['length']?_0x37d2a5[_0x0744('0x35')]:_0x4233d0[_0x0744('0x2f')];if(!_0x1e66d0[_0x0744('0x30')][_0x0744('0x36')](_0x0744('0x37'))){_0x37d2a5[_0x0744('0x1e')]=qs[_0x0744('0x1e')](_0x1e66d0[_0x0744('0x30')]['limit']);_0x37d2a5['offset']=qs[_0x0744('0x20')](_0x1e66d0[_0x0744('0x30')][_0x0744('0x20')]);}_0x37d2a5[_0x0744('0x38')]=qs[_0x0744('0x39')](_0x1e66d0[_0x0744('0x30')][_0x0744('0x39')]);_0x37d2a5[_0x0744('0x3a')]=qs['filters'](_[_0x0744('0x3b')](_0x1e66d0['query'],_0x4233d0['filters']),_0x1077f0);if(_0x1e66d0['query'][_0x0744('0x3c')]){_0x37d2a5['where']=_[_0x0744('0x3d')](_0x37d2a5[_0x0744('0x3a')],{'$or':_[_0x0744('0x2b')](_0x1077f0,function(_0x10f718){if(_0x10f718[_0x0744('0x3e')]!==_0x0744('0x3f')){var _0x504f0d={};_0x504f0d[_0x10f718[_0x0744('0x28')]]={'$like':'%'+_0x1e66d0[_0x0744('0x30')][_0x0744('0x3c')]+'%'};return _0x504f0d;}})});}_0x37d2a5=_[_0x0744('0x3d')]({},_0x37d2a5,_0x1e66d0['options']);var _0x3848b8={'where':_0x37d2a5[_0x0744('0x3a')]};return db['Attachment'][_0x0744('0x40')](_0x3848b8)[_0x0744('0x25')](function(_0x3b7e26){_0xe647cb[_0x0744('0x40')]=_0x3b7e26;if(_0x1e66d0[_0x0744('0x30')][_0x0744('0x41')]){_0x37d2a5[_0x0744('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x0744('0x43')](_0x37d2a5);})[_0x0744('0x25')](function(_0x2b8250){_0xe647cb[_0x0744('0x44')]=_0x2b8250;return _0xe647cb;})[_0x0744('0x25')](respondWithFilteredResult(_0x5deea0,_0x37d2a5))[_0x0744('0x45')](handleError(_0x5deea0,null));};exports[_0x0744('0x46')]=function(_0x2ce959,_0xcfee70){var _0x3cd33f={'raw':!![],'where':{'id':_0x2ce959['params']['id']}},_0x30625b={};_0x30625b[_0x0744('0x2f')]=_[_0x0744('0x31')](db['Attachment']['rawAttributes']);_0x30625b[_0x0744('0x30')]=_['keys'](_0x2ce959[_0x0744('0x30')]);_0x30625b['filters']=_[_0x0744('0x33')](_0x30625b[_0x0744('0x2f')],_0x30625b[_0x0744('0x30')]);_0x3cd33f[_0x0744('0x35')]=_[_0x0744('0x33')](_0x30625b[_0x0744('0x2f')],qs['fields'](_0x2ce959[_0x0744('0x30')]['fields']));_0x3cd33f[_0x0744('0x35')]=_0x3cd33f[_0x0744('0x35')][_0x0744('0x47')]?_0x3cd33f[_0x0744('0x35')]:_0x30625b[_0x0744('0x2f')];if(_0x2ce959[_0x0744('0x30')]['includeAll']){_0x3cd33f['include']=[{'all':!![]}];}_0x3cd33f=_[_0x0744('0x3d')]({},_0x3cd33f,_0x2ce959['options']);return db[_0x0744('0x48')][_0x0744('0x49')](_0x3cd33f)[_0x0744('0x25')](handleEntityNotFound(_0xcfee70,null))['then'](respondWithResult(_0xcfee70,null))[_0x0744('0x45')](handleError(_0xcfee70,null));};exports[_0x0744('0x4a')]=function(_0x1eaa75,_0x2596d4){var _0x150944={'where':{'id':_0x1eaa75['params']['id']}},_0x383c42={};_0x383c42[_0x0744('0x2f')]=_[_0x0744('0x31')](db[_0x0744('0x48')][_0x0744('0x2c')]);_0x150944['attributes']=_['intersection'](_0x383c42[_0x0744('0x2f')],qs[_0x0744('0x34')](_0x1eaa75[_0x0744('0x30')][_0x0744('0x34')]));_0x150944[_0x0744('0x35')]=_0x150944[_0x0744('0x35')][_0x0744('0x47')]?_0x150944[_0x0744('0x35')]:_0x383c42['model'];if(_0x1eaa75[_0x0744('0x30')]['includeAll']){_0x150944['include']=[{'all':!![]}];}_0x150944=_[_0x0744('0x3d')]({},_0x150944,_0x1eaa75[_0x0744('0x4b')]);return db[_0x0744('0x48')][_0x0744('0x49')](_0x150944)[_0x0744('0x25')](handleEntityNotFound(_0x2596d4,null))[_0x0744('0x25')](function(_0x3c018d){if(_0x3c018d){var _0x321f15=_0x3c018d[_0x0744('0x4c')]({'plain':!![]});_0x321f15=qs['omit'](_0x321f15,['id','createdAt',_0x0744('0x4d')]);_0x1eaa75[_0x0744('0x4e')]=_['omit'](_0x1eaa75['body'],['id',_0x0744('0x4f'),'updatedAt']);return db['Attachment'][_0x0744('0x50')](_[_0x0744('0x3d')](_0x321f15,_0x1eaa75[_0x0744('0x4e')]),{'include':_0x1eaa75[_0x0744('0x30')][_0x0744('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2596d4,0xc9))['catch'](handleError(_0x2596d4,null));};exports[_0x0744('0x24')]=function(_0x4fe8d3,_0x575f15){if(_0x4fe8d3[_0x0744('0x4e')]['id']){delete _0x4fe8d3['body']['id'];}return db[_0x0744('0x48')]['find']({'where':{'id':_0x4fe8d3[_0x0744('0x51')]['id']}})[_0x0744('0x25')](handleEntityNotFound(_0x575f15,null))[_0x0744('0x25')](saveUpdates(_0x4fe8d3[_0x0744('0x4e')],null))[_0x0744('0x25')](respondWithResult(_0x575f15,null))[_0x0744('0x45')](handleError(_0x575f15,null));};exports[_0x0744('0x26')]=function(_0x4bca33,_0x218c2e){return db[_0x0744('0x48')][_0x0744('0x49')]({'where':{'id':_0x4bca33[_0x0744('0x51')]['id']}})[_0x0744('0x25')](handleEntityNotFound(_0x218c2e,null))[_0x0744('0x25')](removeEntity(_0x218c2e,null))[_0x0744('0x45')](handleError(_0x218c2e,null));};exports[_0x0744('0x50')]=function(_0x685264,_0x20da74,_0x5bc3b2){_0x685264['body']['name']=_0x685264[_0x0744('0x52')][_0x0744('0x53')];_0x685264[_0x0744('0x4e')]['basename']=_0x685264['file'][_0x0744('0x54')];_0x685264[_0x0744('0x4e')][_0x0744('0x3e')]=_0x685264[_0x0744('0x52')][_0x0744('0x55')];return db[_0x0744('0x48')][_0x0744('0x50')](_0x685264[_0x0744('0x4e')])[_0x0744('0x25')](respondWithResult(_0x20da74,0xc9))[_0x0744('0x45')](handleError(_0x20da74,null));};exports[_0x0744('0x56')]=function(_0x1ad071,_0x41adec,_0x2bd9e6){return db[_0x0744('0x48')][_0x0744('0x57')]({'where':{'id':_0x1ad071['params']['id']},'raw':!![]})[_0x0744('0x25')](handleEntityNotFound(_0x41adec,null))[_0x0744('0x25')](function(_0x17e5ad){if(_0x17e5ad){var _0x1665c6=_0x17e5ad[_0x0744('0x58')]!==null;var _0x5641f0=path[_0x0744('0x59')](config[_0x0744('0x5a')],_0x0744('0x5b'));if(_0x1665c6){_0x5641f0=path[_0x0744('0x59')](_0x5641f0,_0x0744('0x5c'));}var _0x36d1ba=path[_0x0744('0x59')](_0x5641f0,_0x17e5ad[_0x0744('0x5d')]);return _0x41adec['download'](_0x36d1ba);}})['catch'](handleError(_0x41adec,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 85466aa..a8fd482 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 _0x3483=['rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','lodash','api','moment','bluebird','request-promise'];(function(_0x3121f2,_0x3b6a45){var _0x5d1785=function(_0x34b030){while(--_0x34b030){_0x3121f2['push'](_0x3121f2['shift']());}};_0x5d1785(++_0x3b6a45);}(_0x3483,0x150));var _0x3348=function(_0x5bd6a0,_0x42fe62){_0x5bd6a0=_0x5bd6a0-0x0;var _0x5be3c1=_0x3483[_0x5bd6a0];return _0x5be3c1;};'use strict';var _=require(_0x3348('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3348('0x1'));var moment=require(_0x3348('0x2'));var BPromise=require(_0x3348('0x3'));var rp=require(_0x3348('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3348('0x5'));var config=require(_0x3348('0x6'));var attributes=require(_0x3348('0x7'));module[_0x3348('0x8')]=function(_0x5ec477,_0x118108){return _0x5ec477['define'](_0x3348('0x9'),attributes,{'tableName':_0x3348('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x922e=['rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','moment','bluebird','path'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x922e,0x103));var _0xe922=function(_0x48f1df,_0x3afca5){_0x48f1df=_0x48f1df-0x0;var _0x294cdd=_0x922e[_0x48f1df];return _0x294cdd;};'use strict';var _=require(_0xe922('0x0'));var util=require('util');var logger=require(_0xe922('0x1'))('api');var moment=require(_0xe922('0x2'));var BPromise=require(_0xe922('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe922('0x4'));var rimraf=require(_0xe922('0x5'));var config=require(_0xe922('0x6'));var attributes=require(_0xe922('0x7'));module['exports']=function(_0xe35e4,_0x421040){return _0xe35e4[_0xe922('0x8')](_0xe922('0x9'),attributes,{'tableName':_0xe922('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 ce24fbe..13d94c8 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 _0xb903=['Attachment,\x20%s,\x20%s','message','info','result','create','options','then','CreateAttachment','debug','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x55df9b,_0x256647){var _0x1859cd=function(_0x20e23e){while(--_0x20e23e){_0x55df9b['push'](_0x55df9b['shift']());}};_0x1859cd(++_0x256647);}(_0xb903,0x185));var _0x3b90=function(_0x1c5e30,_0x4e5b0e){_0x1c5e30=_0x1c5e30-0x0;var _0x4880b5=_0xb903[_0x1c5e30];return _0x4880b5;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('Attachment,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});}exports['CreateAttachment']=function(_0x269488){var _0x3cf281=this;return new Promise(function(_0x11ad7d,_0x131f3f){return db['Attachment'][_0x3b90('0x14')](_0x269488['body'],{'raw':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x3b90('0x16')](function(_0x12e1cf){logger[_0x3b90('0x12')](_0x3b90('0x17'),_0x269488);logger[_0x3b90('0x18')](_0x3b90('0x17'),_0x269488,JSON[_0x3b90('0x19')](_0x12e1cf));_0x11ad7d(_0x12e1cf);})[_0x3b90('0x1a')](function(_0xa98414){logger[_0x3b90('0xf')]('CreateAttachment',_0xa98414[_0x3b90('0x11')],_0x269488);_0x131f3f(_0x3cf281[_0x3b90('0xf')](0x1f4,_0xa98414[_0x3b90('0x11')]));});});}; \ No newline at end of file +var _0x89e8=['then','debug','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89e8,0x74));var _0x889e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x89e8[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var moment=require(_0x889e('0x2'));var BPromise=require(_0x889e('0x3'));var rs=require(_0x889e('0x4'));var fs=require('fs');var Redis=require(_0x889e('0x5'));var db=require(_0x889e('0x6'))['db'];var utils=require(_0x889e('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x889e('0x8'));var client=jayson[_0x889e('0x9')][_0x889e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed85f,_0x38eeae,_0x54f734){return new BPromise(function(_0x2bfae4,_0x42be62){return client[_0x889e('0xb')](_0x5ed85f,_0x54f734)['then'](function(_0x21c1d9){logger[_0x889e('0xc')](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));logger['debug'](_0x889e('0xf'),_0x38eeae,_0x889e('0xe'),JSON['stringify'](_0x21c1d9));if(_0x21c1d9[_0x889e('0x10')]){if(_0x21c1d9[_0x889e('0x10')][_0x889e('0x11')]===0x1f4){logger[_0x889e('0x10')]('Attachment,\x20%s,\x20%s',_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x42be62(_0x21c1d9[_0x889e('0x10')]['message']);}logger[_0x889e('0x10')](_0x889e('0xd'),_0x38eeae,_0x21c1d9[_0x889e('0x10')][_0x889e('0x12')]);return _0x2bfae4(_0x21c1d9[_0x889e('0x10')]['message']);}else{logger['info'](_0x889e('0xd'),_0x38eeae,_0x889e('0xe'));_0x2bfae4(_0x21c1d9[_0x889e('0x13')][_0x889e('0x12')]);}})['catch'](function(_0x22fbf6){logger[_0x889e('0x10')]('Attachment,\x20%s,\x20%s',_0x38eeae,_0x22fbf6);_0x42be62(_0x22fbf6);});});}exports[_0x889e('0x14')]=function(_0x4f9b2c){var _0x75e219=this;return new Promise(function(_0x168fed,_0x232452){return db[_0x889e('0x15')][_0x889e('0x16')](_0x4f9b2c['body'],{'raw':_0x4f9b2c[_0x889e('0x17')]?_0x4f9b2c[_0x889e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x889e('0x18')](function(_0x11abba){logger[_0x889e('0xc')]('CreateAttachment',_0x4f9b2c);logger[_0x889e('0x19')](_0x889e('0x14'),_0x4f9b2c,JSON[_0x889e('0x1a')](_0x11abba));_0x168fed(_0x11abba);})[_0x889e('0x1b')](function(_0x590b6f){logger['error'](_0x889e('0x14'),_0x590b6f[_0x889e('0x12')],_0x4f9b2c);_0x232452(_0x75e219[_0x889e('0x10')](0x1f4,_0x590b6f['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9db9da4..029b2cb 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x277715,_0x589457){var _0x4af325=function(_0x46a470){while(--_0x46a470){_0x277715['push'](_0x277715['shift']());}};_0x4af325(++_0x589457);}(_0x757a,0xde));var _0xa757=function(_0x174a5f,_0x4e580b){_0x174a5f=_0x174a5f-0x0;var _0x30dd50=_0x757a[_0x174a5f];return _0x30dd50;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _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(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var 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 ca823d8..eae7349 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 _0x87af=['role','disabled','blockedAt','online','user','then','minutes','clearBlockUser','getLicense','catch','send','message','login','json','use','ad-login','password','User','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt'];(function(_0x397dcd,_0x44f397){var _0x431acf=function(_0x256b48){while(--_0x256b48){_0x397dcd['push'](_0x397dcd['shift']());}};_0x431acf(++_0x44f397);}(_0x87af,0x14d));var _0xf87a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x87af[_0x3ab9ee];return _0x82ee88;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xf87a('0x0'))[_0xf87a('0x1')];var moment=require(_0xf87a('0x2'));var ActiveDirectory=require(_0xf87a('0x3'));var BPromise=require(_0xf87a('0x4'));var util=require(_0xf87a('0x5'));var db=require(_0xf87a('0x6'))['db'];var authService=require(_0xf87a('0x7'));var utils=require('../../config/utils');var config=require(_0xf87a('0x8'));var logger=require(_0xf87a('0x9'))('api');function isActiveDirectoryConfigured(_0x22d068){var _0x5f8973=![];if(typeof _0x22d068[_0xf87a('0xa')]!==_0xf87a('0xb')){_0x5f8973=_0x22d068[_0xf87a('0xa')][_0xf87a('0xc')]&&_0x22d068['activedirectory'][_0xf87a('0xd')]&&_0x22d068[_0xf87a('0xa')][_0xf87a('0xe')];}return _0x5f8973;}function adAuthenticate(_0x2aa8c0,_0x415e89,_0x274201){return new BPromise(function(_0x312e69,_0x1d5e4d){try{var _0x303024=new ActiveDirectory(_0x2aa8c0);_0x303024[_0xf87a('0xf')](_0x415e89,_0x274201,function(_0x3b6fd9,_0x4aa1c5){if(_0x3b6fd9){logger[_0xf87a('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x415e89,util[_0xf87a('0x11')](_0x3b6fd9,{'showHidden':![],'depth':null}));_0x1d5e4d(_0xf87a('0x12'));}else if(!_0x4aa1c5){logger[_0xf87a('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x415e89);_0x1d5e4d(_0xf87a('0x12'));}else{_0x312e69(_0x4aa1c5);}});}catch(_0x50c2ff){_0x1d5e4d(_0x50c2ff);}});}function ActiveDirectoryAuthenticate(_0x3a75e6,_0x3dccf8,_0x3ce17a,_0x2b7710){var _0x256491,_0x4f5201;if(!isActiveDirectoryConfigured(config)){logger[_0xf87a('0x10')](_0xf87a('0x13'),_0x3dccf8);return _0x2b7710(null,![],{'message':_0xf87a('0x12')});}return db[_0xf87a('0x14')][_0xf87a('0x15')]({'where':{'id':0x1},'attributes':[_0xf87a('0x16'),_0xf87a('0x17')],'raw':!![]})['then'](function(_0x61faf9){_0x256491=_0x61faf9;if(!_0x256491[_0xf87a('0x16')]){logger['error'](_0xf87a('0x18'),_0x3dccf8);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3a75e6[_0xf87a('0x15')]({'attributes':['id',_0xf87a('0x19'),'password',_0xf87a('0x1a'),_0xf87a('0x1b'),_0xf87a('0x1c'),'blocked',_0xf87a('0x1d'),_0xf87a('0x1e')],'where':{'name':_0x3dccf8,'role':{'$or':['admin',_0xf87a('0x1f'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x15289e){if(!_0x15289e||_0x15289e&&_0x15289e[_0xf87a('0x19')]!==_0x3dccf8){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4f5201=_0x15289e;var _0x55174e=_0x4f5201[_0xf87a('0x19')]+'@'+config[_0xf87a('0xa')][_0xf87a('0xe')];return adAuthenticate(config[_0xf87a('0xa')],_0x55174e,_0x3ce17a);})[_0xf87a('0x20')](function(_0x516b43){if(_0x4f5201['disabled']){throw new Error(_0xf87a('0x12'));}if(_0x256491[_0xf87a('0x17')]>0x0){if(_0x4f5201['blocked']){if(moment(_0x4f5201[_0xf87a('0x1d')])['add'](_0x256491['blockDuration'],_0xf87a('0x21'))>moment()){throw new Error(_0xf87a('0x12'));}return utils[_0xf87a('0x22')](_0x4f5201,0x0,![],null)[_0xf87a('0x20')](function(){return utils[_0xf87a('0x23')](_0x4f5201);})[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}else{return utils[_0xf87a('0x23')](_0x4f5201)[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}}else{return utils[_0xf87a('0x23')](_0x4f5201)[_0xf87a('0x20')](function(){return _0x2b7710(null,_0x4f5201);});}})[_0xf87a('0x24')](function(_0x1d1d7a){return _0x2b7710(null,![],_0x1d1d7a);});}function handleError(_0x34d778,_0x51dfb0,_0x34c8a2){return _0x34d778['status'](_0x51dfb0||0x1f4)[_0xf87a('0x25')]({'message':_0x34c8a2?_0x34c8a2[_0xf87a('0x26')]||_0x34c8a2:''});}exports[_0xf87a('0x27')]=function(_0xcc288f,_0x43c8ad,_0x15da1c){passport[_0xf87a('0xf')]('ad-login',function(_0x3b8eae,_0xe97e46,_0x1dd4ab){var _0x270f0=_0x3b8eae||_0x1dd4ab;if(_0x270f0){return handleError(_0x43c8ad,0x191,_0x270f0);}if(!_0xe97e46){return handleError(_0x43c8ad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3263fb={'payload':{'id':_0xe97e46['id'],'role':_0xe97e46[_0xf87a('0x1b')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3263fb)[_0xf87a('0x20')](function(_0x4d4a55){_0x43c8ad[_0xf87a('0x28')]({'id':_0xe97e46['id'],'token':_0x4d4a55,'statusCall':'','isAlreadyLogged':_0xe97e46[_0xf87a('0x1e')]});});}})(_0xcc288f,_0x43c8ad,_0x15da1c);};passport[_0xf87a('0x29')](_0xf87a('0x2a'),new LocalStrategy({'usernameField':_0xf87a('0x19'),'passwordField':_0xf87a('0x2b')},function(_0x3e1099,_0x533898,_0x274f41){return ActiveDirectoryAuthenticate(db[_0xf87a('0x2c')],_0x3e1099,_0x533898,_0x274f41);})); \ No newline at end of file +var _0x4523=['role','disabled','blocked','blockedAt','user','agent','blockDuration','add','minutes','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','baseDN','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','name','password','salt'];(function(_0x3b4e7a,_0x49dffa){var _0x2e8a1d=function(_0x30cafa){while(--_0x30cafa){_0x3b4e7a['push'](_0x3b4e7a['shift']());}};_0x2e8a1d(++_0x49dffa);}(_0x4523,0x165));var _0x3452=function(_0x4443f3,_0x473ea6){_0x4443f3=_0x4443f3-0x0;var _0x4cf485=_0x4523[_0x4443f3];return _0x4cf485;};'use strict';var passport=require(_0x3452('0x0'));var LocalStrategy=require(_0x3452('0x1'))[_0x3452('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x3452('0x3'));var BPromise=require(_0x3452('0x4'));var util=require(_0x3452('0x5'));var db=require(_0x3452('0x6'))['db'];var authService=require(_0x3452('0x7'));var utils=require(_0x3452('0x8'));var config=require(_0x3452('0x9'));var logger=require('../../config/logger')(_0x3452('0xa'));function isActiveDirectoryConfigured(_0x441a12){var _0x2d1675=![];if(typeof _0x441a12['activedirectory']!=='undefined'){_0x2d1675=_0x441a12[_0x3452('0xb')][_0x3452('0xc')]&&_0x441a12['activedirectory']['url']&&_0x441a12[_0x3452('0xb')][_0x3452('0xd')];}return _0x2d1675;}function adAuthenticate(_0xf1db68,_0x105e43,_0x499655){return new BPromise(function(_0x5aeaa1,_0x2f1c5d){try{var _0x3985c4=new ActiveDirectory(_0xf1db68);_0x3985c4['authenticate'](_0x105e43,_0x499655,function(_0x1ff393,_0x5645e3){if(_0x1ff393){logger['error'](_0x3452('0xe'),_0x105e43,util[_0x3452('0xf')](_0x1ff393,{'showHidden':![],'depth':null}));_0x2f1c5d(_0x3452('0x10'));}else if(!_0x5645e3){logger['error'](_0x3452('0x11'),_0x105e43);_0x2f1c5d(_0x3452('0x10'));}else{_0x5aeaa1(_0x5645e3);}});}catch(_0xd6be3f){_0x2f1c5d(_0xd6be3f);}});}function ActiveDirectoryAuthenticate(_0x4194d0,_0x3f16ca,_0x3097a2,_0x24c633){var _0x21e0b2,_0x202fb9;if(!isActiveDirectoryConfigured(config)){logger[_0x3452('0x12')](_0x3452('0x13'),_0x3f16ca);return _0x24c633(null,![],{'message':_0x3452('0x10')});}return db[_0x3452('0x14')][_0x3452('0x15')]({'where':{'id':0x1},'attributes':[_0x3452('0x16'),'blockDuration'],'raw':!![]})[_0x3452('0x17')](function(_0x12f23d){_0x21e0b2=_0x12f23d;if(!_0x21e0b2[_0x3452('0x16')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x3f16ca);throw new Error(_0x3452('0x10'));}return _0x4194d0[_0x3452('0x15')]({'attributes':['id',_0x3452('0x18'),_0x3452('0x19'),_0x3452('0x1a'),_0x3452('0x1b'),_0x3452('0x1c'),_0x3452('0x1d'),_0x3452('0x1e'),'online'],'where':{'name':_0x3f16ca,'role':{'$or':['admin',_0x3452('0x1f'),_0x3452('0x20')]},'adSsoEnabled':!![]}});})[_0x3452('0x17')](function(_0x5d166){if(!_0x5d166||_0x5d166&&_0x5d166[_0x3452('0x18')]!==_0x3f16ca){throw new Error(_0x3452('0x10'));}_0x202fb9=_0x5d166;var _0xefc83c=_0x202fb9[_0x3452('0x18')]+'@'+config['activedirectory'][_0x3452('0xd')];return adAuthenticate(config[_0x3452('0xb')],_0xefc83c,_0x3097a2);})[_0x3452('0x17')](function(_0x5c1eb9){if(_0x202fb9[_0x3452('0x1c')]){throw new Error(_0x3452('0x10'));}if(_0x21e0b2[_0x3452('0x21')]>0x0){if(_0x202fb9[_0x3452('0x1d')]){if(moment(_0x202fb9[_0x3452('0x1e')])[_0x3452('0x22')](_0x21e0b2[_0x3452('0x21')],_0x3452('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x202fb9,0x0,![],null)[_0x3452('0x17')](function(){return utils[_0x3452('0x24')](_0x202fb9);})['then'](function(){return _0x24c633(null,_0x202fb9);});}else{return utils[_0x3452('0x24')](_0x202fb9)[_0x3452('0x17')](function(){return _0x24c633(null,_0x202fb9);});}}else{return utils[_0x3452('0x24')](_0x202fb9)[_0x3452('0x17')](function(){return _0x24c633(null,_0x202fb9);});}})[_0x3452('0x25')](function(_0x21355f){return _0x24c633(null,![],_0x21355f);});}function handleError(_0x1ffdde,_0x454481,_0x2cd95e){return _0x1ffdde[_0x3452('0x26')](_0x454481||0x1f4)['send']({'message':_0x2cd95e?_0x2cd95e[_0x3452('0x27')]||_0x2cd95e:''});}exports[_0x3452('0x28')]=function(_0x48924c,_0x24a358,_0x252709){passport[_0x3452('0x29')](_0x3452('0x2a'),function(_0x12c2a7,_0x48b85f,_0x4caaab){var _0x5dc6c6=_0x12c2a7||_0x4caaab;if(_0x5dc6c6){return handleError(_0x24a358,0x191,_0x5dc6c6);}if(!_0x48b85f){return handleError(_0x24a358,0x194,{'message':_0x3452('0x2b')});}else{var _0x5a4cab={'payload':{'id':_0x48b85f['id'],'role':_0x48b85f[_0x3452('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x3452('0x2c')](_0x5a4cab)['then'](function(_0x3a53de){_0x24a358[_0x3452('0x2d')]({'id':_0x48b85f['id'],'token':_0x3a53de,'statusCall':'','isAlreadyLogged':_0x48b85f[_0x3452('0x2e')]});});}})(_0x48924c,_0x24a358,_0x252709);};passport[_0x3452('0x2f')](_0x3452('0x2a'),new LocalStrategy({'usernameField':_0x3452('0x18'),'passwordField':_0x3452('0x19')},function(_0x1c70d5,_0x501463,_0x2f3145){return ActiveDirectoryAuthenticate(db['User'],_0x1c70d5,_0x501463,_0x2f3145);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4e299d7..c5c2386 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 _0x2fb9=['Router','./authActiveDirectory.controller','post','exports','express'];(function(_0x535f2d,_0x2ca297){var _0x34a5d7=function(_0x21090b){while(--_0x21090b){_0x535f2d['push'](_0x535f2d['shift']());}};_0x34a5d7(++_0x2ca297);}(_0x2fb9,0x1e9));var _0x92fb=function(_0x3fea18,_0x386ae8){_0x3fea18=_0x3fea18-0x0;var _0x47a122=_0x2fb9[_0x3fea18];return _0x47a122;};'use strict';var express=require(_0x92fb('0x0'));var router=express[_0x92fb('0x1')]();var controller=require(_0x92fb('0x2'));router[_0x92fb('0x3')]('/',controller['login']);module[_0x92fb('0x4')]=router; \ No newline at end of file +var _0xdb87=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x470450,_0xe68acb){var _0x5fa1df=function(_0x2d8df8){while(--_0x2d8df8){_0x470450['push'](_0x470450['shift']());}};_0x5fa1df(++_0xe68acb);}(_0xdb87,0xda));var _0x7db8=function(_0x272f6e,_0x57f558){_0x272f6e=_0x272f6e-0x0;var _0xf945df=_0xdb87[_0x272f6e];return _0xf945df;};'use strict';var express=require(_0x7db8('0x0'));var router=express[_0x7db8('0x1')]();var controller=require(_0x7db8('0x2'));router[_0x7db8('0x3')]('/',controller[_0x7db8('0x4')]);module[_0x7db8('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 d814197..00f1242 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(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x388e39,_0x5ccd06){_0x388e39=_0x388e39-0x0;var _0x295484=_0x7a54[_0x388e39];return _0x295484;};'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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7a54,0x106));var _0x47a5=function(_0xad2a0,_0x27904f){_0xad2a0=_0xad2a0-0x0;var _0x5cae03=_0x7a54[_0xad2a0];return _0x5cae03;};'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 35eda37..8764de6 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 _0xeb84=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb84,0x194));var _0x4eb8=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xeb84[_0x330723];return _0x60c546;};'use strict';var express=require(_0x4eb8('0x0'));var passport=require(_0x4eb8('0x1'));var router=express[_0x4eb8('0x2')]();var controller=require(_0x4eb8('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x4eb8('0x4'));router[_0x4eb8('0x5')]('/',controller[_0x4eb8('0x6')]);router[_0x4eb8('0x5')](_0x4eb8('0x7'),controller[_0x4eb8('0x8')],authService[_0x4eb8('0x9')],userController['login'],authService[_0x4eb8('0xa')]);module[_0x4eb8('0xb')]=router; \ No newline at end of file +var _0xb708=['../../components/auth/service','get','/callback','callback','login','setTokenCookie','express','Router','../user/user.controller.js'];(function(_0x4004ed,_0x1d82a9){var _0x14ecf4=function(_0xd87ad8){while(--_0xd87ad8){_0x4004ed['push'](_0x4004ed['shift']());}};_0x14ecf4(++_0x1d82a9);}(_0xb708,0xe7));var _0x8b70=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xb708[_0x59c301];return _0x3866b9;};'use strict';var express=require(_0x8b70('0x0'));var passport=require('passport');var router=express[_0x8b70('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0x8b70('0x2'));var authService=require(_0x8b70('0x3'));router[_0x8b70('0x4')]('/',controller['login']);router[_0x8b70('0x4')](_0x8b70('0x5'),controller[_0x8b70('0x6')],authService['isMiddleware'],userController[_0x8b70('0x7')],authService[_0x8b70('0x8')]);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 64e8590..952ce61 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 _0x546e=['merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','save','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions'];(function(_0x381900,_0x2d2804){var _0x54da53=function(_0x56d214){while(--_0x56d214){_0x381900['push'](_0x381900['shift']());}};_0x54da53(++_0x2d2804);}(_0x546e,0x1bf));var _0xe546=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x546e[_0x1f9f37];return _0x21c080;};'use strict';var util=require(_0xe546('0x0'));var passport=require(_0xe546('0x1'));var LocalStrategy=require(_0xe546('0x2'))[_0xe546('0x3')];var jayson=require(_0xe546('0x4'));var _=require('lodash');var rs=require(_0xe546('0x5'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xe546('0x6'));var utils=require(_0xe546('0x7'));var client=jayson['client'][_0xe546('0x8')]({'port':0x232b});function localAuthenticate(_0x425f62,_0x461cd5,_0x1cbfc1,_0x37ed73){var _0x58d355,_0x25bb51;return db[_0xe546('0x9')][_0xe546('0xa')]({'where':{'id':0x1},'attributes':[_0xe546('0xb'),_0xe546('0xc')],'raw':!![]})[_0xe546('0xd')](function(_0x3bbaec){_0x58d355=_0x3bbaec;return _0x425f62[_0xe546('0xa')]({'attributes':['id',_0xe546('0xe'),_0xe546('0xf'),_0xe546('0x10'),_0xe546('0x11'),_0xe546('0x12'),_0xe546('0x13'),_0xe546('0x14'),_0xe546('0x15')],'where':{'name':_0x461cd5,'role':{'$or':[_0xe546('0x16'),_0xe546('0x17'),_0xe546('0x18')]}}});})[_0xe546('0xd')](function(_0x2c861a){if(!_0x2c861a||_0x2c861a&&_0x2c861a['name']!==_0x461cd5){throw new Error(_0xe546('0x19'));}else{_0x25bb51=_0x2c861a;return _0x25bb51;}})[_0xe546('0xd')](function(){_0x25bb51[_0xe546('0x1a')](_0x1cbfc1,function(_0x2755e3,_0xb889a9){var _0x9701f2=_0x25bb51['loginAttempts']+0x1;if(_0x2755e3){return _0x37ed73(_0x2755e3);}else if(!_0xb889a9){if(_0x25bb51[_0xe546('0x12')]){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else if(_0x58d355[_0xe546('0xb')]>0x0){if(_0x25bb51[_0xe546('0x13')]){if(_0x58d355[_0xe546('0xc')]>0x0){if(moment(_0x25bb51[_0xe546('0x14')])[_0xe546('0x1b')](_0x58d355[_0xe546('0xc')],_0xe546('0x1c'))>moment()){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1d')](_0x25bb51,_0x9701f2,![],null)[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x9701f2>=_0x58d355['allowedLoginAttempts']){return utils[_0xe546('0x1d')](_0x25bb51,0x0,!![],moment())[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xe546('0x1d')](_0x25bb51,_0x9701f2,![],null)[_0xe546('0xd')](function(){return _0x37ed73(null,![],{'message':_0xe546('0x19')});});}}}else{return _0x37ed73(null,![],{'message':_0xe546('0x19')});}}else{if(_0x25bb51['disabled']){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else if(_0x58d355[_0xe546('0xb')]>0x0){if(_0x25bb51[_0xe546('0x13')]){if(_0x58d355[_0xe546('0xc')]>0x0){if(moment(_0x25bb51[_0xe546('0x14')])[_0xe546('0x1b')](_0x58d355[_0xe546('0xc')],_0xe546('0x1c'))>moment()){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1d')](_0x25bb51,0x0,![],null)[_0xe546('0xd')](function(){return utils[_0xe546('0x1e')](_0x25bb51);})[_0xe546('0xd')](function(){return _0x37ed73(null,_0x25bb51);});}}else{return _0x37ed73(null,![],{'message':_0xe546('0x19')});}}else{return utils[_0xe546('0x1d')](_0x25bb51,0x0,![],null)[_0xe546('0xd')](function(){return utils['getLicense'](_0x25bb51);})['then'](function(){return _0x37ed73(null,_0x25bb51);})[_0xe546('0x1f')](function(_0x29134b){return _0x37ed73(null,![],_0x29134b);});}}else{if(_0x25bb51[_0xe546('0x13')]){return _0x37ed73(null,![],{'message':_0xe546('0x19')});}else{return utils[_0xe546('0x1e')](_0x25bb51)[_0xe546('0xd')](function(){return _0x37ed73(null,_0x25bb51);});}}}});})[_0xe546('0x1f')](function(_0x142016){return _0x37ed73(null,![],_0x142016);});}function sendServiceMail(_0x2e92f1){return db[_0xe546('0x20')][_0xe546('0x21')]({'where':{'service':!![]},'attributes':['id',_0xe546('0xe'),_0xe546('0x22')],'include':[{'model':db[_0xe546('0x23')],'as':_0xe546('0x24'),'include':[{'model':db[_0xe546('0x25')],'as':_0xe546('0x25')}]}]})[_0xe546('0xd')](function(_0x476738){if(!_0x476738){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x500226=_0x476738[_0xe546('0x26')]();var _0x59d9fb={'account':_0x500226,'message':_[_0xe546('0x27')]({'from':util[_0xe546('0x28')](_0xe546('0x29'),_0x476738[_0xe546('0xe')],_0x476738[_0xe546('0x22')]||_0x476738[_0xe546('0x24')][_0xe546('0x17')])},_0x2e92f1)};return client[_0xe546('0x2a')](_0xe546('0x2b'),_0x59d9fb);})[_0xe546('0xd')](function(_0x3783e8){if(_0x3783e8[_0xe546('0x2c')]){throw new Error(util[_0xe546('0x28')](_0xe546('0x2d'),_0x3783e8[_0xe546('0x2c')][_0xe546('0x2e')]||JSON[_0xe546('0x2f')](_0x3783e8[_0xe546('0x2c')])));}return!![];});}function handleError(_0x592397,_0x57c10c,_0x25b043){return _0x592397[_0xe546('0x30')](_0x57c10c||0x1f4)[_0xe546('0x31')]({'message':_0x25b043?_0x25b043[_0xe546('0x2e')]||_0x25b043:''});}exports[_0xe546('0x32')]=function(_0x1b3369,_0x35d24b,_0x46df24){passport[_0xe546('0x1a')](_0xe546('0x33'),function(_0xda4e00,_0x13d599,_0x24fce4){var _0x363144=_0xda4e00||_0x24fce4;if(_0x363144){return handleError(_0x35d24b,0x191,_0x363144);}if(!_0x13d599){return handleError(_0x35d24b,0x194,{'message':_0xe546('0x34')});}else{var _0x38b4a3={'payload':{'id':_0x13d599['id'],'role':_0x13d599['role']},'options':{'expiresIn':0x15180}};return authService[_0xe546('0x35')](_0x38b4a3)['then'](function(_0x3f2721){_0x35d24b[_0xe546('0x36')]({'id':_0x13d599['id'],'token':_0x3f2721,'statusCall':'','isAlreadyLogged':_0x13d599['online']});});}})(_0x1b3369,_0x35d24b,_0x46df24);};exports['forgot']=function(_0x468e04,_0x54a4ac){if(!_0x468e04[_0xe546('0x37')][_0xe546('0x22')]){return handleError(_0x54a4ac,0x1f4,{'message':_0xe546('0x38')});}var _0x5a75c0=rs['generate']();_0x468e04[_0xe546('0x37')]['email']=_0x468e04['body'][_0xe546('0x22')]['trim']()[_0xe546('0x39')]();var _0x4292c2;return db[_0xe546('0x9')][_0xe546('0xa')]({'where':{'id':0x1},'attributes':[_0xe546('0xb'),'blockDuration'],'raw':!![]})[_0xe546('0xd')](function(_0x42f8bf){_0x4292c2=_0x42f8bf;return db['User'][_0xe546('0x21')]({'where':{'email':_0x468e04[_0xe546('0x37')][_0xe546('0x22')]}});})[_0xe546('0xd')](function(_0x3874f7){if(!_0x3874f7){throw new Error(_0xe546('0x3a'));}if(_0x3874f7['disabled']){throw new Error(_0xe546('0x3b'));}if(_0x3874f7[_0xe546('0x13')]){if(moment(_0x3874f7[_0xe546('0x14')])[_0xe546('0x1b')](_0x4292c2[_0xe546('0xc')],_0xe546('0x1c'))>moment()){throw new Error(_0xe546('0x3c'));}else{_0x3874f7[_0xe546('0x13')]=![];_0x3874f7[_0xe546('0x14')]=null;}}_0x3874f7[_0xe546('0x3d')]=_0x5a75c0;_0x3874f7[_0xe546('0x3e')]=Date[_0xe546('0x3f')]()+0x36ee80;return _0x3874f7['save']();})[_0xe546('0xd')](function(){return sendServiceMail({'to':_0x468e04['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xe546('0x40')+_0xe546('0x41')+_0xe546('0x42')+_0x468e04['headers'][_0xe546('0x43')]+_0xe546('0x44')+_0x5a75c0+'\x0a\x0a'+_0xe546('0x45')});})[_0xe546('0xd')](function(){_0x54a4ac['status'](0xc8)[_0xe546('0x31')]({'message':_0xe546('0x46')});})[_0xe546('0x1f')](function(_0x364564){return handleError(_0x54a4ac,0x1f4,_0x364564);});};exports[_0xe546('0x47')]=function(_0x5c2675,_0x22a91a){return db[_0xe546('0x48')][_0xe546('0x21')]({'where':{'resetPasswordToken':_0x5c2675['params'][_0xe546('0x49')],'resetPasswordExpires':{'$gt':Date[_0xe546('0x3f')]()}}})[_0xe546('0xd')](function(_0x3ba48a){if(!_0x3ba48a){throw new Error(_0xe546('0x4a'));}return db[_0xe546('0x9')][_0xe546('0xa')]({'attributes':['id','securePassword',_0xe546('0x4b'),_0xe546('0x4c')]})[_0xe546('0xd')](function(_0x525981){if(_0x525981[_0xe546('0x4d')])authService['validatePasswordPattern'](_0x5c2675[_0xe546('0x37')][_0xe546('0xf')]);if(!_0x525981['enforcePasswordHistory']||!_0x3ba48a['previousPasswords'])return _0x3ba48a;authService['validatePasswordHistory'](_0x5c2675[_0xe546('0x37')][_0xe546('0xf')],_0x3ba48a[_0xe546('0x4e')],_0x525981[_0xe546('0x4c')]);return _0x3ba48a;})[_0xe546('0xd')](function(){_0x3ba48a[_0xe546('0xf')]=_0x5c2675[_0xe546('0x37')][_0xe546('0xf')];_0x3ba48a[_0xe546('0x3d')]=null;_0x3ba48a[_0xe546('0x3e')]=null;return _0x3ba48a[_0xe546('0x4f')]();});})[_0xe546('0xd')](function(){_0x22a91a[_0xe546('0x30')](0xc8)[_0xe546('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x538f1d){return handleError(_0x22a91a,0x1f4,_0x538f1d);});};passport[_0xe546('0x50')](_0xe546('0x33'),new LocalStrategy({'usernameField':_0xe546('0xe'),'passwordField':_0xe546('0xf')},function(_0x23b569,_0x537302,_0x267f3e){return localAuthenticate(db[_0xe546('0x48')],_0x23b569,_0x537302,_0x267f3e);})); \ No newline at end of file +var _0x9f37=['message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','resetPasswordExpires','use','util','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','loginAttempts','admin','user','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','minutes','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x1b087d,_0xbadd72){var _0x57400a=function(_0x21c333){while(--_0x21c333){_0x1b087d['push'](_0x1b087d['shift']());}};_0x57400a(++_0xbadd72);}(_0x9f37,0x10f));var _0x79f3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9f37[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x79f3('0x0'));var passport=require(_0x79f3('0x1'));var LocalStrategy=require('passport-local')[_0x79f3('0x2')];var jayson=require(_0x79f3('0x3'));var _=require('lodash');var rs=require(_0x79f3('0x4'));var moment=require(_0x79f3('0x5'));var db=require(_0x79f3('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x79f3('0x7'));var client=jayson[_0x79f3('0x8')][_0x79f3('0x9')]({'port':0x232b});function localAuthenticate(_0x472644,_0x3cce13,_0x5506e8,_0x1035ed){var _0x519f17,_0x34347c;return db[_0x79f3('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x79f3('0xb'),_0x79f3('0xc')],'raw':!![]})[_0x79f3('0xd')](function(_0x64078){_0x519f17=_0x64078;return _0x472644['findOne']({'attributes':['id',_0x79f3('0xe'),_0x79f3('0xf'),_0x79f3('0x10'),_0x79f3('0x11'),'disabled','blocked','blockedAt',_0x79f3('0x12')],'where':{'name':_0x3cce13,'role':{'$or':[_0x79f3('0x13'),_0x79f3('0x14'),'agent']}}});})['then'](function(_0x57769c){if(!_0x57769c||_0x57769c&&_0x57769c[_0x79f3('0xe')]!==_0x3cce13){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x34347c=_0x57769c;return _0x34347c;}})[_0x79f3('0xd')](function(){_0x34347c[_0x79f3('0x15')](_0x5506e8,function(_0x32990a,_0x576230){var _0x21a9a6=_0x34347c[_0x79f3('0x12')]+0x1;if(_0x32990a){return _0x1035ed(_0x32990a);}else if(!_0x576230){if(_0x34347c[_0x79f3('0x16')]){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}else if(_0x519f17['allowedLoginAttempts']>0x0){if(_0x34347c[_0x79f3('0x18')]){if(_0x519f17[_0x79f3('0xc')]>0x0){if(moment(_0x34347c[_0x79f3('0x19')])[_0x79f3('0x1a')](_0x519f17[_0x79f3('0xc')],'minutes')>moment()){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}else{return utils[_0x79f3('0x1b')](_0x34347c,_0x21a9a6,![],null)['then'](function(){return _0x1035ed(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1035ed(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x21a9a6>=_0x519f17['allowedLoginAttempts']){return utils['clearBlockUser'](_0x34347c,0x0,!![],moment())[_0x79f3('0xd')](function(){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});});}else{return utils['clearBlockUser'](_0x34347c,_0x21a9a6,![],null)['then'](function(){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});});}}}else{return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}}else{if(_0x34347c[_0x79f3('0x16')]){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}else if(_0x519f17[_0x79f3('0xb')]>0x0){if(_0x34347c[_0x79f3('0x18')]){if(_0x519f17[_0x79f3('0xc')]>0x0){if(moment(_0x34347c[_0x79f3('0x19')])[_0x79f3('0x1a')](_0x519f17[_0x79f3('0xc')],_0x79f3('0x1c'))>moment()){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}else{return utils[_0x79f3('0x1b')](_0x34347c,0x0,![],null)[_0x79f3('0xd')](function(){return utils['getLicense'](_0x34347c);})[_0x79f3('0xd')](function(){return _0x1035ed(null,_0x34347c);});}}else{return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}}else{return utils[_0x79f3('0x1b')](_0x34347c,0x0,![],null)['then'](function(){return utils['getLicense'](_0x34347c);})[_0x79f3('0xd')](function(){return _0x1035ed(null,_0x34347c);})[_0x79f3('0x1d')](function(_0x3781a9){return _0x1035ed(null,![],_0x3781a9);});}}else{if(_0x34347c[_0x79f3('0x18')]){return _0x1035ed(null,![],{'message':_0x79f3('0x17')});}else{return utils['getLicense'](_0x34347c)[_0x79f3('0xd')](function(){return _0x1035ed(null,_0x34347c);});}}}});})[_0x79f3('0x1d')](function(_0x20a247){return _0x1035ed(null,![],_0x20a247);});}function sendServiceMail(_0x1e996e){return db[_0x79f3('0x1e')][_0x79f3('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x79f3('0xe'),_0x79f3('0x20')],'include':[{'model':db[_0x79f3('0x21')],'as':'Smtp','include':[{'model':db[_0x79f3('0x22')],'as':'CloudProvider'}]}]})[_0x79f3('0xd')](function(_0xa98436){if(!_0xa98436){throw new Error(_0x79f3('0x23'));}var _0x50e5a6=_0xa98436[_0x79f3('0x24')]();var _0x5b0629={'account':_0x50e5a6,'message':_[_0x79f3('0x25')]({'from':util[_0x79f3('0x26')](_0x79f3('0x27'),_0xa98436['name'],_0xa98436[_0x79f3('0x20')]||_0xa98436[_0x79f3('0x28')][_0x79f3('0x14')])},_0x1e996e)};return client[_0x79f3('0x29')](_0x79f3('0x2a'),_0x5b0629);})[_0x79f3('0xd')](function(_0x4923f5){if(_0x4923f5[_0x79f3('0x2b')]){throw new Error(util[_0x79f3('0x26')](_0x79f3('0x2c'),_0x4923f5[_0x79f3('0x2b')][_0x79f3('0x2d')]||JSON[_0x79f3('0x2e')](_0x4923f5['error'])));}return!![];});}function handleError(_0x31ee60,_0xe1ac74,_0x4864f3){return _0x31ee60[_0x79f3('0x2f')](_0xe1ac74||0x1f4)[_0x79f3('0x30')]({'message':_0x4864f3?_0x4864f3['message']||_0x4864f3:''});}exports[_0x79f3('0x31')]=function(_0x3acb93,_0x156b5e,_0x25bb92){passport[_0x79f3('0x15')](_0x79f3('0x32'),function(_0x2b64fd,_0x5cd1d2,_0x15f3af){var _0x4a65cb=_0x2b64fd||_0x15f3af;if(_0x4a65cb){return handleError(_0x156b5e,0x191,_0x4a65cb);}if(!_0x5cd1d2){return handleError(_0x156b5e,0x194,{'message':_0x79f3('0x33')});}else{var _0x640f28={'payload':{'id':_0x5cd1d2['id'],'role':_0x5cd1d2[_0x79f3('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x79f3('0x34')](_0x640f28)[_0x79f3('0xd')](function(_0x49951a){_0x156b5e[_0x79f3('0x35')]({'id':_0x5cd1d2['id'],'token':_0x49951a,'statusCall':'','isAlreadyLogged':_0x5cd1d2['online']});});}})(_0x3acb93,_0x156b5e,_0x25bb92);};exports['forgot']=function(_0x31588b,_0x5f14d1){if(!_0x31588b[_0x79f3('0x36')][_0x79f3('0x20')]){return handleError(_0x5f14d1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x18e0fb=rs[_0x79f3('0x37')]();_0x31588b[_0x79f3('0x36')][_0x79f3('0x20')]=_0x31588b[_0x79f3('0x36')][_0x79f3('0x20')][_0x79f3('0x38')]()[_0x79f3('0x39')]();var _0x3fb270;return db[_0x79f3('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x79f3('0xb'),_0x79f3('0xc')],'raw':!![]})[_0x79f3('0xd')](function(_0x4c78c5){_0x3fb270=_0x4c78c5;return db[_0x79f3('0x3a')][_0x79f3('0x1f')]({'where':{'email':_0x31588b[_0x79f3('0x36')][_0x79f3('0x20')]}});})[_0x79f3('0xd')](function(_0x333340){if(!_0x333340){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x333340[_0x79f3('0x16')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x333340[_0x79f3('0x18')]){if(moment(_0x333340[_0x79f3('0x19')])[_0x79f3('0x1a')](_0x3fb270[_0x79f3('0xc')],_0x79f3('0x1c'))>moment()){throw new Error(_0x79f3('0x3b'));}else{_0x333340['blocked']=![];_0x333340['blockedAt']=null;}}_0x333340[_0x79f3('0x3c')]=_0x18e0fb;_0x333340['resetPasswordExpires']=Date[_0x79f3('0x3d')]()+0x36ee80;return _0x333340[_0x79f3('0x3e')]();})[_0x79f3('0xd')](function(){return sendServiceMail({'to':_0x31588b[_0x79f3('0x36')][_0x79f3('0x20')],'subject':_0x79f3('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x79f3('0x40')+_0x79f3('0x41')+_0x31588b['headers'][_0x79f3('0x42')]+'/reset/'+_0x18e0fb+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x79f3('0xd')](function(){_0x5f14d1[_0x79f3('0x2f')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x79f3('0x1d')](function(_0x6ec0bb){return handleError(_0x5f14d1,0x1f4,_0x6ec0bb);});};exports[_0x79f3('0x43')]=function(_0x11897b,_0x942b2d){return db[_0x79f3('0x3a')]['find']({'where':{'resetPasswordToken':_0x11897b[_0x79f3('0x44')]['token'],'resetPasswordExpires':{'$gt':Date[_0x79f3('0x3d')]()}}})[_0x79f3('0xd')](function(_0x2bdd18){if(!_0x2bdd18){throw new Error(_0x79f3('0x45'));}return db[_0x79f3('0xa')][_0x79f3('0x46')]({'attributes':['id',_0x79f3('0x47'),_0x79f3('0x48'),_0x79f3('0x49')]})['then'](function(_0x234122){if(_0x234122[_0x79f3('0x47')])authService[_0x79f3('0x4a')](_0x11897b[_0x79f3('0x36')][_0x79f3('0xf')]);if(!_0x234122[_0x79f3('0x48')]||!_0x2bdd18['previousPasswords'])return _0x2bdd18;authService[_0x79f3('0x4b')](_0x11897b[_0x79f3('0x36')][_0x79f3('0xf')],_0x2bdd18[_0x79f3('0x4c')],_0x234122[_0x79f3('0x49')]);return _0x2bdd18;})['then'](function(){_0x2bdd18['password']=_0x11897b[_0x79f3('0x36')][_0x79f3('0xf')];_0x2bdd18['resetPasswordToken']=null;_0x2bdd18[_0x79f3('0x4d')]=null;return _0x2bdd18[_0x79f3('0x3e')]();});})[_0x79f3('0xd')](function(){_0x942b2d[_0x79f3('0x2f')](0xc8)[_0x79f3('0x30')]({'message':'Password\x20reset!'});})['catch'](function(_0x28b2c2){return handleError(_0x942b2d,0x1f4,_0x28b2c2);});};passport[_0x79f3('0x4e')](_0x79f3('0x32'),new LocalStrategy({'usernameField':_0x79f3('0xe'),'passwordField':'password'},function(_0x519aae,_0x224876,_0x4a3c7a){return localAuthenticate(db['User'],_0x519aae,_0x224876,_0x4a3c7a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b5b93d8..02d9a90 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 _0xdea2=['reset','exports','post','login','/forgot','forgot','/reset/:token'];(function(_0x301b80,_0x3aefbf){var _0x46ee80=function(_0x174fc1){while(--_0x174fc1){_0x301b80['push'](_0x301b80['shift']());}};_0x46ee80(++_0x3aefbf);}(_0xdea2,0xbf));var _0x2dea=function(_0x2e488e,_0x50b586){_0x2e488e=_0x2e488e-0x0;var _0x2b0900=_0xdea2[_0x2e488e];return _0x2b0900;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0x2dea('0x0')]('/',controller[_0x2dea('0x1')]);router['post'](_0x2dea('0x2'),controller[_0x2dea('0x3')]);router[_0x2dea('0x0')](_0x2dea('0x4'),controller[_0x2dea('0x5')]);module[_0x2dea('0x6')]=router; \ No newline at end of file +var _0xa1df=['/forgot','forgot','exports','express','Router','./authLocal.controller','login','post'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xa1df,0xfb));var _0xfa1d=function(_0x2c8530,_0x3dd387){_0x2c8530=_0x2c8530-0x0;var _0x41310a=_0xa1df[_0x2c8530];return _0x41310a;};'use strict';var express=require(_0xfa1d('0x0'));var router=express[_0xfa1d('0x1')]();var controller=require(_0xfa1d('0x2'));router['post']('/',controller[_0xfa1d('0x3')]);router[_0xfa1d('0x4')](_0xfa1d('0x5'),controller[_0xfa1d('0x6')]);router['post']('/reset/:token',controller['reset']);module[_0xfa1d('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 545f370..75dfbcf 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 _0x98d2=['STRING','sequelize','exports'];(function(_0x2a4578,_0x104646){var _0xb18fe7=function(_0x351cd){while(--_0x351cd){_0x2a4578['push'](_0x2a4578['shift']());}};_0xb18fe7(++_0x104646);}(_0x98d2,0xeb));var _0x298d=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x98d2[_0x2e76a7];return _0x454cde;};'use strict';var Sequelize=require(_0x298d('0x0'));module[_0x298d('0x1')]={'name':{'type':Sequelize[_0x298d('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x298d('0x2')]},'description':{'type':Sequelize[_0x298d('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x2e60=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x1bdc79,_0x4803ff){var _0x4c0801=function(_0x3fd372){while(--_0x3fd372){_0x1bdc79['push'](_0x1bdc79['shift']());}};_0x4c0801(++_0x4803ff);}(_0x2e60,0x8a));var _0x02e6=function(_0x5b0f8f,_0x2c7f7c){_0x5b0f8f=_0x5b0f8f-0x0;var _0x4bd04f=_0x2e60[_0x5b0f8f];return _0x4bd04f;};'use strict';var Sequelize=require('sequelize');module[_0x02e6('0x0')]={'name':{'type':Sequelize[_0x02e6('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x02e6('0x1')]},'description':{'type':Sequelize[_0x02e6('0x1')]},'status':{'type':Sequelize[_0x02e6('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x02e6('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 62124de..ee1578f 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 _0x70bf=['reject','save','update','then','destroy','error','stack','name','map','Automation','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','addConditions','ids','getConditions','findOne','Condition','hasOwnProperty','nolimit','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x202838,_0x277181){var _0x51e925=function(_0x3caa95){while(--_0x3caa95){_0x202838['push'](_0x202838['shift']());}};_0x51e925(++_0x277181);}(_0x70bf,0x124));var _0xf70b=function(_0x3443e4,_0x4a7dbc){_0x3443e4=_0x3443e4-0x0;var _0x35fed3=_0x70bf[_0x3443e4];return _0x35fed3;};'use strict';var emlformat=require(_0xf70b('0x0'));var rimraf=require(_0xf70b('0x1'));var zipdir=require(_0xf70b('0x2'));var jsonpatch=require(_0xf70b('0x3'));var rp=require(_0xf70b('0x4'));var moment=require('moment');var BPromise=require(_0xf70b('0x5'));var Mustache=require('mustache');var util=require(_0xf70b('0x6'));var path=require(_0xf70b('0x7'));var sox=require(_0xf70b('0x8'));var csv=require(_0xf70b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf70b('0xa'));var jsforce=require(_0xf70b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf70b('0x9'));var querystring=require(_0xf70b('0xc'));var Papa=require(_0xf70b('0xd'));var Redis=require('ioredis');var authService=require(_0xf70b('0xe'));var qs=require(_0xf70b('0xf'));var as=require(_0xf70b('0x10'));var hardwareService=require(_0xf70b('0x11'));var logger=require(_0xf70b('0x12'))(_0xf70b('0x13'));var utils=require(_0xf70b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf70b('0x15'));var db=require(_0xf70b('0x16'))['db'];function respondWithStatusCode(_0x5a8d7e,_0x367d5d){_0x367d5d=_0x367d5d||0xcc;return function(_0x2316f5){if(_0x2316f5){return _0x5a8d7e['sendStatus'](_0x367d5d);}return _0x5a8d7e['status'](_0x367d5d)[_0xf70b('0x17')]();};}function respondWithResult(_0xc2420e,_0x104e42){_0x104e42=_0x104e42||0xc8;return function(_0x586a56){if(_0x586a56){return _0xc2420e[_0xf70b('0x18')](_0x104e42)['json'](_0x586a56);}};}function respondWithFilteredResult(_0x212a1b,_0x443d78){return function(_0x50cdb6){if(_0x50cdb6){var _0x421bec=typeof _0x443d78[_0xf70b('0x19')]===_0xf70b('0x1a')&&typeof _0x443d78[_0xf70b('0x1b')]===_0xf70b('0x1a');var _0x1f2a38=_0x50cdb6[_0xf70b('0x1c')];var _0x38e919=_0x421bec?0x0:_0x443d78['offset'];var _0x10ea82=_0x421bec?_0x50cdb6[_0xf70b('0x1c')]:_0x443d78['offset']+_0x443d78[_0xf70b('0x1b')];var _0x1fe4ae;if(_0x10ea82>=_0x1f2a38){_0x10ea82=_0x1f2a38;_0x1fe4ae=0xc8;}else{_0x1fe4ae=0xce;}_0x212a1b[_0xf70b('0x18')](_0x1fe4ae);return _0x212a1b['set'](_0xf70b('0x1d'),_0x38e919+'-'+_0x10ea82+'/'+_0x1f2a38)[_0xf70b('0x1e')](_0x50cdb6);}return null;};}function patchUpdates(_0xa573d9){return function(_0xffc986){try{jsonpatch[_0xf70b('0x1f')](_0xffc986,_0xa573d9,!![]);}catch(_0x4eedd0){return BPromise[_0xf70b('0x20')](_0x4eedd0);}return _0xffc986[_0xf70b('0x21')]();};}function saveUpdates(_0xf778b7,_0x5285ea){return function(_0x5528cd){if(_0x5528cd){return _0x5528cd[_0xf70b('0x22')](_0xf778b7)[_0xf70b('0x23')](function(_0x4e0616){return _0x4e0616;});}return null;};}function removeEntity(_0x34de13,_0x5a116b){return function(_0x206c44){if(_0x206c44){return _0x206c44[_0xf70b('0x24')]()[_0xf70b('0x23')](function(){_0x34de13[_0xf70b('0x18')](0xcc)[_0xf70b('0x17')]();});}};}function handleEntityNotFound(_0x30b24b,_0x28a006){return function(_0x5870d3){if(!_0x5870d3){_0x30b24b['sendStatus'](0x194);}return _0x5870d3;};}function handleError(_0x5083c9,_0x413646){_0x413646=_0x413646||0x1f4;return function(_0x4bd39c){logger[_0xf70b('0x25')](_0x4bd39c[_0xf70b('0x26')]);if(_0x4bd39c[_0xf70b('0x27')]){delete _0x4bd39c['name'];}_0x5083c9['status'](_0x413646)['send'](_0x4bd39c);};}exports['index']=function(_0x31d696,_0x51f29d){var _0x222ae5={},_0x4f55a9={},_0x8de6ad={'count':0x0,'rows':[]};var _0x377cf1=_[_0xf70b('0x28')](db[_0xf70b('0x29')][_0xf70b('0x2a')],function(_0x453c95){return{'name':_0x453c95[_0xf70b('0x2b')],'type':_0x453c95['type'][_0xf70b('0x2c')]};});_0x4f55a9['model']=_['map'](_0x377cf1,_0xf70b('0x27'));_0x4f55a9[_0xf70b('0x2d')]=_[_0xf70b('0x2e')](_0x31d696['query']);_0x4f55a9[_0xf70b('0x2f')]=_['intersection'](_0x4f55a9[_0xf70b('0x30')],_0x4f55a9[_0xf70b('0x2d')]);_0x222ae5['attributes']=_[_0xf70b('0x31')](_0x4f55a9[_0xf70b('0x30')],qs['fields'](_0x31d696[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x222ae5[_0xf70b('0x33')]=_0x222ae5[_0xf70b('0x33')]['length']?_0x222ae5[_0xf70b('0x33')]:_0x4f55a9['model'];if(!_0x31d696[_0xf70b('0x2d')]['hasOwnProperty']('nolimit')){_0x222ae5[_0xf70b('0x1b')]=qs['limit'](_0x31d696[_0xf70b('0x2d')]['limit']);_0x222ae5['offset']=qs[_0xf70b('0x19')](_0x31d696[_0xf70b('0x2d')]['offset']);}_0x222ae5[_0xf70b('0x34')]=qs[_0xf70b('0x35')](_0x31d696[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x222ae5[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0x31d696['query'],_0x4f55a9[_0xf70b('0x2f')]),_0x377cf1);if(_0x31d696[_0xf70b('0x2d')][_0xf70b('0x38')]){_0x222ae5[_0xf70b('0x36')]=_['merge'](_0x222ae5[_0xf70b('0x36')],{'$or':_['map'](_0x377cf1,function(_0x1e9274){if(_0x1e9274[_0xf70b('0x39')]!==_0xf70b('0x3a')){var _0x4fd0a5={};_0x4fd0a5[_0x1e9274[_0xf70b('0x27')]]={'$like':'%'+_0x31d696[_0xf70b('0x2d')]['filter']+'%'};return _0x4fd0a5;}})});}_0x222ae5=_[_0xf70b('0x3b')]({},_0x222ae5,_0x31d696[_0xf70b('0x3c')]);var _0x1bede1={'where':_0x222ae5[_0xf70b('0x36')]};return db[_0xf70b('0x29')]['count'](_0x1bede1)[_0xf70b('0x23')](function(_0x397db3){_0x8de6ad['count']=_0x397db3;if(_0x31d696[_0xf70b('0x2d')][_0xf70b('0x3d')]){_0x222ae5[_0xf70b('0x3e')]=[{'all':!![]}];}return db[_0xf70b('0x29')][_0xf70b('0x3f')](_0x222ae5);})[_0xf70b('0x23')](function(_0x369417){_0x8de6ad[_0xf70b('0x40')]=_0x369417;return _0x8de6ad;})[_0xf70b('0x23')](respondWithFilteredResult(_0x51f29d,_0x222ae5))[_0xf70b('0x41')](handleError(_0x51f29d,null));};exports['show']=function(_0xaf2297,_0x3e80dd){var _0x5b5ca2={'raw':![],'where':{'id':_0xaf2297['params']['id']}},_0x2960a2={};_0x2960a2['model']=_[_0xf70b('0x2e')](db[_0xf70b('0x29')][_0xf70b('0x2a')]);_0x2960a2[_0xf70b('0x2d')]=_[_0xf70b('0x2e')](_0xaf2297['query']);_0x2960a2[_0xf70b('0x2f')]=_['intersection'](_0x2960a2['model'],_0x2960a2['query']);_0x5b5ca2[_0xf70b('0x33')]=_[_0xf70b('0x31')](_0x2960a2['model'],qs['fields'](_0xaf2297[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x5b5ca2[_0xf70b('0x33')]=_0x5b5ca2['attributes'][_0xf70b('0x42')]?_0x5b5ca2[_0xf70b('0x33')]:_0x2960a2[_0xf70b('0x30')];if(_0xaf2297[_0xf70b('0x2d')]['includeAll']){_0x5b5ca2[_0xf70b('0x3e')]=[{'all':!![]}];}_0x5b5ca2=_[_0xf70b('0x3b')]({},_0x5b5ca2,_0xaf2297['options']);return db['Automation'][_0xf70b('0x43')](_0x5b5ca2)[_0xf70b('0x23')](handleEntityNotFound(_0x3e80dd,null))[_0xf70b('0x23')](respondWithResult(_0x3e80dd,null))[_0xf70b('0x41')](handleError(_0x3e80dd,null));};exports[_0xf70b('0x44')]=function(_0x2b6b38,_0x4383d7){return db[_0xf70b('0x29')][_0xf70b('0x44')](_0x2b6b38[_0xf70b('0x45')],{})['then'](respondWithResult(_0x4383d7,0xc9))[_0xf70b('0x41')](handleError(_0x4383d7,null));};exports[_0xf70b('0x22')]=function(_0x24eb3b,_0x5984f0){if(_0x24eb3b[_0xf70b('0x45')]['id']){delete _0x24eb3b['body']['id'];}return db[_0xf70b('0x29')]['find']({'where':{'id':_0x24eb3b['params']['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x5984f0,null))['then'](saveUpdates(_0x24eb3b[_0xf70b('0x45')],null))['then'](respondWithResult(_0x5984f0,null))[_0xf70b('0x41')](handleError(_0x5984f0,null));};exports[_0xf70b('0x24')]=function(_0x146e02,_0x5f4560){return db[_0xf70b('0x29')]['find']({'where':{'id':_0x146e02[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x5f4560,null))[_0xf70b('0x23')](removeEntity(_0x5f4560,null))[_0xf70b('0x41')](handleError(_0x5f4560,null));};exports[_0xf70b('0x47')]=function(_0x57d22c,_0x3d42de,_0x39d549){return db['Condition'][_0xf70b('0x43')]({'where':{'id':_0x57d22c[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x3d42de,null))['then'](function(_0xcf32b9){if(_0xcf32b9){return _0xcf32b9[_0xf70b('0x47')](_0x57d22c[_0xf70b('0x45')][_0xf70b('0x48')],_['omit'](_0x57d22c[_0xf70b('0x45')],[_0xf70b('0x48'),'id'])||{});}})['then'](respondWithResult(_0x3d42de,null))[_0xf70b('0x41')](handleError(_0x3d42de,null));};exports[_0xf70b('0x49')]=function(_0xab5e1d,_0x2676b0,_0x4b80f4){var _0x504366={};var _0x34c981={};var _0x40e9b1;var _0x55dd53;return db[_0xf70b('0x29')][_0xf70b('0x4a')]({'where':{'id':_0xab5e1d[_0xf70b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2676b0,null))[_0xf70b('0x23')](function(_0x2446ce){if(_0x2446ce){_0x40e9b1=_0x2446ce;_0x34c981[_0xf70b('0x30')]=_['keys'](db[_0xf70b('0x4b')][_0xf70b('0x2a')]);_0x34c981[_0xf70b('0x2d')]=_['keys'](_0xab5e1d[_0xf70b('0x2d')]);_0x34c981[_0xf70b('0x2f')]=_[_0xf70b('0x31')](_0x34c981[_0xf70b('0x30')],_0x34c981[_0xf70b('0x2d')]);_0x504366[_0xf70b('0x33')]=_[_0xf70b('0x31')](_0x34c981[_0xf70b('0x30')],qs[_0xf70b('0x32')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x32')]));_0x504366[_0xf70b('0x33')]=_0x504366[_0xf70b('0x33')][_0xf70b('0x42')]?_0x504366[_0xf70b('0x33')]:_0x34c981[_0xf70b('0x30')];_0x504366[_0xf70b('0x34')]=qs[_0xf70b('0x35')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x504366[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0xab5e1d[_0xf70b('0x2d')],_0x34c981[_0xf70b('0x2f')]));if(_0xab5e1d['query'][_0xf70b('0x38')]){_0x504366[_0xf70b('0x36')]=_[_0xf70b('0x3b')](_0x504366[_0xf70b('0x36')],{'$or':_[_0xf70b('0x28')](_0x504366[_0xf70b('0x33')],function(_0x3ab410){var _0x5db767={};_0x5db767[_0x3ab410]={'$like':'%'+_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x38')]+'%'};return _0x5db767;})});}_0x504366=_[_0xf70b('0x3b')]({},_0x504366,_0xab5e1d[_0xf70b('0x3c')]);return _0x40e9b1[_0xf70b('0x49')](_0x504366);}})[_0xf70b('0x23')](function(_0x1321ff){if(_0x1321ff){_0x55dd53=_0x1321ff[_0xf70b('0x42')];if(!_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x4c')](_0xf70b('0x4d'))){_0x504366['limit']=qs[_0xf70b('0x1b')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x1b')]);_0x504366[_0xf70b('0x19')]=qs[_0xf70b('0x19')](_0xab5e1d[_0xf70b('0x2d')][_0xf70b('0x19')]);}return _0x40e9b1[_0xf70b('0x49')](_0x504366);}})[_0xf70b('0x23')](function(_0x179eb1){if(_0x179eb1){return _0x179eb1?{'count':_0x55dd53,'rows':_0x179eb1}:null;}})[_0xf70b('0x23')](respondWithResult(_0x2676b0,null))[_0xf70b('0x41')](handleError(_0x2676b0,null));};exports[_0xf70b('0x4e')]=function(_0x325702,_0x30623d,_0x4a9326){return db['Action']['find']({'where':{'id':_0x325702[_0xf70b('0x46')]['id']}})['then'](handleEntityNotFound(_0x30623d,null))[_0xf70b('0x23')](function(_0x20647b){if(_0x20647b){return _0x20647b[_0xf70b('0x4e')](_0x325702[_0xf70b('0x45')][_0xf70b('0x48')],_['omit'](_0x325702['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x30623d,null))[_0xf70b('0x41')](handleError(_0x30623d,null));};exports[_0xf70b('0x4f')]=function(_0x5cba8a,_0x1e99f9,_0x16bb59){var _0x3c32ba={};var _0x3ef8db={};var _0x15084c;var _0xcc5434;return db[_0xf70b('0x29')][_0xf70b('0x4a')]({'where':{'id':_0x5cba8a[_0xf70b('0x46')]['id']}})[_0xf70b('0x23')](handleEntityNotFound(_0x1e99f9,null))[_0xf70b('0x23')](function(_0x170aac){if(_0x170aac){_0x15084c=_0x170aac;_0x3ef8db[_0xf70b('0x30')]=_[_0xf70b('0x2e')](db[_0xf70b('0x50')]['rawAttributes']);_0x3ef8db['query']=_[_0xf70b('0x2e')](_0x5cba8a[_0xf70b('0x2d')]);_0x3ef8db[_0xf70b('0x2f')]=_[_0xf70b('0x31')](_0x3ef8db['model'],_0x3ef8db[_0xf70b('0x2d')]);_0x3c32ba[_0xf70b('0x33')]=_['intersection'](_0x3ef8db[_0xf70b('0x30')],qs['fields'](_0x5cba8a['query'][_0xf70b('0x32')]));_0x3c32ba[_0xf70b('0x33')]=_0x3c32ba['attributes'][_0xf70b('0x42')]?_0x3c32ba['attributes']:_0x3ef8db['model'];_0x3c32ba['order']=qs[_0xf70b('0x35')](_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x35')]);_0x3c32ba[_0xf70b('0x36')]=qs[_0xf70b('0x2f')](_[_0xf70b('0x37')](_0x5cba8a[_0xf70b('0x2d')],_0x3ef8db[_0xf70b('0x2f')]));if(_0x5cba8a['query'][_0xf70b('0x38')]){_0x3c32ba[_0xf70b('0x36')]=_[_0xf70b('0x3b')](_0x3c32ba['where'],{'$or':_[_0xf70b('0x28')](_0x3c32ba[_0xf70b('0x33')],function(_0x392db2){var _0x23e74a={};_0x23e74a[_0x392db2]={'$like':'%'+_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x38')]+'%'};return _0x23e74a;})});}_0x3c32ba=_['merge']({},_0x3c32ba,_0x5cba8a['options']);return _0x15084c[_0xf70b('0x4f')](_0x3c32ba);}})[_0xf70b('0x23')](function(_0x21e8d3){if(_0x21e8d3){_0xcc5434=_0x21e8d3[_0xf70b('0x42')];if(!_0x5cba8a[_0xf70b('0x2d')]['hasOwnProperty'](_0xf70b('0x4d'))){_0x3c32ba[_0xf70b('0x1b')]=qs[_0xf70b('0x1b')](_0x5cba8a[_0xf70b('0x2d')][_0xf70b('0x1b')]);_0x3c32ba[_0xf70b('0x19')]=qs['offset'](_0x5cba8a['query'][_0xf70b('0x19')]);}return _0x15084c['getActions'](_0x3c32ba);}})[_0xf70b('0x23')](function(_0x34a971){if(_0x34a971){return _0x34a971?{'count':_0xcc5434,'rows':_0x34a971}:null;}})[_0xf70b('0x23')](respondWithResult(_0x1e99f9,null))[_0xf70b('0x41')](handleError(_0x1e99f9,null));}; \ No newline at end of file +var _0xe5e1=['then','destroy','sendStatus','error','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','body','addConditions','Condition','omit','ids','getConditions','nolimit','addActions','getActions','Action','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update'];(function(_0x3d9f79,_0x3e71a7){var _0x336016=function(_0x33396d){while(--_0x33396d){_0x3d9f79['push'](_0x3d9f79['shift']());}};_0x336016(++_0x3e71a7);}(_0xe5e1,0xd2));var _0x1e5e=function(_0x296278,_0x543001){_0x296278=_0x296278-0x0;var _0x2ade7c=_0xe5e1[_0x296278];return _0x2ade7c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e5e('0x0'));var jsonpatch=require(_0x1e5e('0x1'));var rp=require(_0x1e5e('0x2'));var moment=require(_0x1e5e('0x3'));var BPromise=require(_0x1e5e('0x4'));var Mustache=require('mustache');var util=require(_0x1e5e('0x5'));var path=require(_0x1e5e('0x6'));var sox=require('sox');var csv=require(_0x1e5e('0x7'));var ejs=require(_0x1e5e('0x8'));var fs=require('fs');var fs_extra=require(_0x1e5e('0x9'));var _=require(_0x1e5e('0xa'));var squel=require(_0x1e5e('0xb'));var crypto=require(_0x1e5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1e5e('0xd'));var toCsv=require(_0x1e5e('0x7'));var querystring=require(_0x1e5e('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e5e('0xf'));var authService=require(_0x1e5e('0x10'));var qs=require(_0x1e5e('0x11'));var as=require(_0x1e5e('0x12'));var hardwareService=require(_0x1e5e('0x13'));var logger=require(_0x1e5e('0x14'))('api');var utils=require(_0x1e5e('0x15'));var config=require(_0x1e5e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e5e('0x17'))['db'];function respondWithStatusCode(_0x4f9d0c,_0x4f2e87){_0x4f2e87=_0x4f2e87||0xcc;return function(_0x23d374){if(_0x23d374){return _0x4f9d0c['sendStatus'](_0x4f2e87);}return _0x4f9d0c[_0x1e5e('0x18')](_0x4f2e87)[_0x1e5e('0x19')]();};}function respondWithResult(_0x4fd727,_0x5e6a44){_0x5e6a44=_0x5e6a44||0xc8;return function(_0x1f8d01){if(_0x1f8d01){return _0x4fd727[_0x1e5e('0x18')](_0x5e6a44)[_0x1e5e('0x1a')](_0x1f8d01);}};}function respondWithFilteredResult(_0x3890a1,_0x5d2826){return function(_0x5e0022){if(_0x5e0022){var _0xf9a4f6=typeof _0x5d2826[_0x1e5e('0x1b')]===_0x1e5e('0x1c')&&typeof _0x5d2826['limit']===_0x1e5e('0x1c');var _0x4651b0=_0x5e0022['count'];var _0x4dec64=_0xf9a4f6?0x0:_0x5d2826[_0x1e5e('0x1b')];var _0x468572=_0xf9a4f6?_0x5e0022[_0x1e5e('0x1d')]:_0x5d2826['offset']+_0x5d2826[_0x1e5e('0x1e')];var _0x5ca691;if(_0x468572>=_0x4651b0){_0x468572=_0x4651b0;_0x5ca691=0xc8;}else{_0x5ca691=0xce;}_0x3890a1[_0x1e5e('0x18')](_0x5ca691);return _0x3890a1[_0x1e5e('0x1f')](_0x1e5e('0x20'),_0x4dec64+'-'+_0x468572+'/'+_0x4651b0)[_0x1e5e('0x1a')](_0x5e0022);}return null;};}function patchUpdates(_0x35933e){return function(_0x45e22c){try{jsonpatch[_0x1e5e('0x21')](_0x45e22c,_0x35933e,!![]);}catch(_0x5a0eb4){return BPromise['reject'](_0x5a0eb4);}return _0x45e22c[_0x1e5e('0x22')]();};}function saveUpdates(_0x214f7d,_0x1dfdd2){return function(_0x5c0555){if(_0x5c0555){return _0x5c0555[_0x1e5e('0x23')](_0x214f7d)[_0x1e5e('0x24')](function(_0x2f3c7b){return _0x2f3c7b;});}return null;};}function removeEntity(_0x1a6f80,_0x5eeda6){return function(_0x445955){if(_0x445955){return _0x445955[_0x1e5e('0x25')]()['then'](function(){_0x1a6f80['status'](0xcc)[_0x1e5e('0x19')]();});}};}function handleEntityNotFound(_0x21b208,_0x4a9b98){return function(_0x32380e){if(!_0x32380e){_0x21b208[_0x1e5e('0x26')](0x194);}return _0x32380e;};}function handleError(_0x1337ab,_0x20b2b3){_0x20b2b3=_0x20b2b3||0x1f4;return function(_0x4a1733){logger[_0x1e5e('0x27')](_0x4a1733[_0x1e5e('0x28')]);if(_0x4a1733['name']){delete _0x4a1733[_0x1e5e('0x29')];}_0x1337ab['status'](_0x20b2b3)[_0x1e5e('0x2a')](_0x4a1733);};}exports['index']=function(_0x3dc47a,_0x13a88c){var _0x3fb87f={},_0x166c28={},_0x2bad94={'count':0x0,'rows':[]};var _0x460976=_[_0x1e5e('0x2b')](db[_0x1e5e('0x2c')][_0x1e5e('0x2d')],function(_0x3dbacf){return{'name':_0x3dbacf[_0x1e5e('0x2e')],'type':_0x3dbacf[_0x1e5e('0x2f')][_0x1e5e('0x30')]};});_0x166c28['model']=_[_0x1e5e('0x2b')](_0x460976,_0x1e5e('0x29'));_0x166c28[_0x1e5e('0x31')]=_[_0x1e5e('0x32')](_0x3dc47a['query']);_0x166c28['filters']=_[_0x1e5e('0x33')](_0x166c28[_0x1e5e('0x34')],_0x166c28[_0x1e5e('0x31')]);_0x3fb87f['attributes']=_[_0x1e5e('0x33')](_0x166c28[_0x1e5e('0x34')],qs[_0x1e5e('0x35')](_0x3dc47a[_0x1e5e('0x31')]['fields']));_0x3fb87f['attributes']=_0x3fb87f[_0x1e5e('0x36')][_0x1e5e('0x37')]?_0x3fb87f[_0x1e5e('0x36')]:_0x166c28[_0x1e5e('0x34')];if(!_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x38')]('nolimit')){_0x3fb87f[_0x1e5e('0x1e')]=qs[_0x1e5e('0x1e')](_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x1e')]);_0x3fb87f[_0x1e5e('0x1b')]=qs[_0x1e5e('0x1b')](_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x1b')]);}_0x3fb87f[_0x1e5e('0x39')]=qs['sort'](_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x3a')]);_0x3fb87f[_0x1e5e('0x3b')]=qs['filters'](_[_0x1e5e('0x3c')](_0x3dc47a[_0x1e5e('0x31')],_0x166c28[_0x1e5e('0x3d')]),_0x460976);if(_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x3e')]){_0x3fb87f[_0x1e5e('0x3b')]=_[_0x1e5e('0x3f')](_0x3fb87f[_0x1e5e('0x3b')],{'$or':_['map'](_0x460976,function(_0x413444){if(_0x413444[_0x1e5e('0x2f')]!=='VIRTUAL'){var _0x5f35d6={};_0x5f35d6[_0x413444[_0x1e5e('0x29')]]={'$like':'%'+_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x3e')]+'%'};return _0x5f35d6;}})});}_0x3fb87f=_[_0x1e5e('0x3f')]({},_0x3fb87f,_0x3dc47a[_0x1e5e('0x40')]);var _0x5efeeb={'where':_0x3fb87f[_0x1e5e('0x3b')]};return db[_0x1e5e('0x2c')]['count'](_0x5efeeb)[_0x1e5e('0x24')](function(_0x40aa37){_0x2bad94[_0x1e5e('0x1d')]=_0x40aa37;if(_0x3dc47a[_0x1e5e('0x31')][_0x1e5e('0x41')]){_0x3fb87f[_0x1e5e('0x42')]=[{'all':!![]}];}return db['Automation'][_0x1e5e('0x43')](_0x3fb87f);})[_0x1e5e('0x24')](function(_0x243502){_0x2bad94[_0x1e5e('0x44')]=_0x243502;return _0x2bad94;})[_0x1e5e('0x24')](respondWithFilteredResult(_0x13a88c,_0x3fb87f))[_0x1e5e('0x45')](handleError(_0x13a88c,null));};exports['show']=function(_0x57a821,_0x236162){var _0x5326d4={'raw':![],'where':{'id':_0x57a821[_0x1e5e('0x46')]['id']}},_0x10cf94={};_0x10cf94[_0x1e5e('0x34')]=_[_0x1e5e('0x32')](db[_0x1e5e('0x2c')][_0x1e5e('0x2d')]);_0x10cf94['query']=_[_0x1e5e('0x32')](_0x57a821['query']);_0x10cf94[_0x1e5e('0x3d')]=_[_0x1e5e('0x33')](_0x10cf94[_0x1e5e('0x34')],_0x10cf94[_0x1e5e('0x31')]);_0x5326d4[_0x1e5e('0x36')]=_[_0x1e5e('0x33')](_0x10cf94[_0x1e5e('0x34')],qs[_0x1e5e('0x35')](_0x57a821[_0x1e5e('0x31')][_0x1e5e('0x35')]));_0x5326d4[_0x1e5e('0x36')]=_0x5326d4['attributes']['length']?_0x5326d4[_0x1e5e('0x36')]:_0x10cf94['model'];if(_0x57a821[_0x1e5e('0x31')][_0x1e5e('0x41')]){_0x5326d4[_0x1e5e('0x42')]=[{'all':!![]}];}_0x5326d4=_[_0x1e5e('0x3f')]({},_0x5326d4,_0x57a821[_0x1e5e('0x40')]);return db[_0x1e5e('0x2c')][_0x1e5e('0x47')](_0x5326d4)[_0x1e5e('0x24')](handleEntityNotFound(_0x236162,null))[_0x1e5e('0x24')](respondWithResult(_0x236162,null))['catch'](handleError(_0x236162,null));};exports['create']=function(_0x41e77a,_0x57ce52){return db[_0x1e5e('0x2c')]['create'](_0x41e77a[_0x1e5e('0x48')],{})['then'](respondWithResult(_0x57ce52,0xc9))[_0x1e5e('0x45')](handleError(_0x57ce52,null));};exports[_0x1e5e('0x23')]=function(_0x18e034,_0x1f51f5){if(_0x18e034[_0x1e5e('0x48')]['id']){delete _0x18e034[_0x1e5e('0x48')]['id'];}return db[_0x1e5e('0x2c')][_0x1e5e('0x47')]({'where':{'id':_0x18e034[_0x1e5e('0x46')]['id']}})[_0x1e5e('0x24')](handleEntityNotFound(_0x1f51f5,null))[_0x1e5e('0x24')](saveUpdates(_0x18e034[_0x1e5e('0x48')],null))[_0x1e5e('0x24')](respondWithResult(_0x1f51f5,null))[_0x1e5e('0x45')](handleError(_0x1f51f5,null));};exports['destroy']=function(_0x3a4d60,_0x1b6703){return db[_0x1e5e('0x2c')]['find']({'where':{'id':_0x3a4d60[_0x1e5e('0x46')]['id']}})[_0x1e5e('0x24')](handleEntityNotFound(_0x1b6703,null))[_0x1e5e('0x24')](removeEntity(_0x1b6703,null))['catch'](handleError(_0x1b6703,null));};exports[_0x1e5e('0x49')]=function(_0x26e462,_0x3efacf,_0x3e721e){return db[_0x1e5e('0x4a')][_0x1e5e('0x47')]({'where':{'id':_0x26e462[_0x1e5e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3efacf,null))['then'](function(_0x368a41){if(_0x368a41){return _0x368a41[_0x1e5e('0x49')](_0x26e462[_0x1e5e('0x48')]['ids'],_[_0x1e5e('0x4b')](_0x26e462[_0x1e5e('0x48')],[_0x1e5e('0x4c'),'id'])||{});}})[_0x1e5e('0x24')](respondWithResult(_0x3efacf,null))[_0x1e5e('0x45')](handleError(_0x3efacf,null));};exports[_0x1e5e('0x4d')]=function(_0x3fa3bf,_0x4612ea,_0x24ac6a){var _0x48f307={};var _0x530733={};var _0xed9bec;var _0x2a7656;return db[_0x1e5e('0x2c')]['findOne']({'where':{'id':_0x3fa3bf[_0x1e5e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4612ea,null))['then'](function(_0x230e2b){if(_0x230e2b){_0xed9bec=_0x230e2b;_0x530733[_0x1e5e('0x34')]=_[_0x1e5e('0x32')](db[_0x1e5e('0x4a')]['rawAttributes']);_0x530733[_0x1e5e('0x31')]=_[_0x1e5e('0x32')](_0x3fa3bf['query']);_0x530733['filters']=_['intersection'](_0x530733['model'],_0x530733[_0x1e5e('0x31')]);_0x48f307[_0x1e5e('0x36')]=_[_0x1e5e('0x33')](_0x530733[_0x1e5e('0x34')],qs['fields'](_0x3fa3bf[_0x1e5e('0x31')][_0x1e5e('0x35')]));_0x48f307[_0x1e5e('0x36')]=_0x48f307[_0x1e5e('0x36')][_0x1e5e('0x37')]?_0x48f307[_0x1e5e('0x36')]:_0x530733[_0x1e5e('0x34')];_0x48f307['order']=qs[_0x1e5e('0x3a')](_0x3fa3bf['query'][_0x1e5e('0x3a')]);_0x48f307[_0x1e5e('0x3b')]=qs[_0x1e5e('0x3d')](_[_0x1e5e('0x3c')](_0x3fa3bf[_0x1e5e('0x31')],_0x530733[_0x1e5e('0x3d')]));if(_0x3fa3bf[_0x1e5e('0x31')]['filter']){_0x48f307[_0x1e5e('0x3b')]=_['merge'](_0x48f307['where'],{'$or':_[_0x1e5e('0x2b')](_0x48f307[_0x1e5e('0x36')],function(_0x2e4f88){var _0x574008={};_0x574008[_0x2e4f88]={'$like':'%'+_0x3fa3bf[_0x1e5e('0x31')]['filter']+'%'};return _0x574008;})});}_0x48f307=_[_0x1e5e('0x3f')]({},_0x48f307,_0x3fa3bf[_0x1e5e('0x40')]);return _0xed9bec[_0x1e5e('0x4d')](_0x48f307);}})['then'](function(_0x16de22){if(_0x16de22){_0x2a7656=_0x16de22['length'];if(!_0x3fa3bf[_0x1e5e('0x31')][_0x1e5e('0x38')](_0x1e5e('0x4e'))){_0x48f307[_0x1e5e('0x1e')]=qs[_0x1e5e('0x1e')](_0x3fa3bf['query']['limit']);_0x48f307[_0x1e5e('0x1b')]=qs[_0x1e5e('0x1b')](_0x3fa3bf[_0x1e5e('0x31')][_0x1e5e('0x1b')]);}return _0xed9bec[_0x1e5e('0x4d')](_0x48f307);}})[_0x1e5e('0x24')](function(_0x52c8ef){if(_0x52c8ef){return _0x52c8ef?{'count':_0x2a7656,'rows':_0x52c8ef}:null;}})[_0x1e5e('0x24')](respondWithResult(_0x4612ea,null))[_0x1e5e('0x45')](handleError(_0x4612ea,null));};exports[_0x1e5e('0x4f')]=function(_0x2fab98,_0x23453b,_0x487916){return db['Action'][_0x1e5e('0x47')]({'where':{'id':_0x2fab98[_0x1e5e('0x46')]['id']}})[_0x1e5e('0x24')](handleEntityNotFound(_0x23453b,null))[_0x1e5e('0x24')](function(_0xc4c7ef){if(_0xc4c7ef){return _0xc4c7ef[_0x1e5e('0x4f')](_0x2fab98['body']['ids'],_['omit'](_0x2fab98[_0x1e5e('0x48')],['ids','id'])||{});}})[_0x1e5e('0x24')](respondWithResult(_0x23453b,null))['catch'](handleError(_0x23453b,null));};exports[_0x1e5e('0x50')]=function(_0x9869ee,_0x50684b,_0xe7be8d){var _0x326819={};var _0x4e1640={};var _0x19af2d;var _0x26dad1;return db[_0x1e5e('0x2c')]['findOne']({'where':{'id':_0x9869ee[_0x1e5e('0x46')]['id']}})[_0x1e5e('0x24')](handleEntityNotFound(_0x50684b,null))[_0x1e5e('0x24')](function(_0x983c42){if(_0x983c42){_0x19af2d=_0x983c42;_0x4e1640[_0x1e5e('0x34')]=_[_0x1e5e('0x32')](db[_0x1e5e('0x51')][_0x1e5e('0x2d')]);_0x4e1640[_0x1e5e('0x31')]=_[_0x1e5e('0x32')](_0x9869ee[_0x1e5e('0x31')]);_0x4e1640[_0x1e5e('0x3d')]=_[_0x1e5e('0x33')](_0x4e1640[_0x1e5e('0x34')],_0x4e1640['query']);_0x326819['attributes']=_[_0x1e5e('0x33')](_0x4e1640[_0x1e5e('0x34')],qs['fields'](_0x9869ee[_0x1e5e('0x31')][_0x1e5e('0x35')]));_0x326819[_0x1e5e('0x36')]=_0x326819[_0x1e5e('0x36')][_0x1e5e('0x37')]?_0x326819[_0x1e5e('0x36')]:_0x4e1640[_0x1e5e('0x34')];_0x326819['order']=qs[_0x1e5e('0x3a')](_0x9869ee[_0x1e5e('0x31')][_0x1e5e('0x3a')]);_0x326819[_0x1e5e('0x3b')]=qs[_0x1e5e('0x3d')](_['pick'](_0x9869ee[_0x1e5e('0x31')],_0x4e1640[_0x1e5e('0x3d')]));if(_0x9869ee[_0x1e5e('0x31')][_0x1e5e('0x3e')]){_0x326819[_0x1e5e('0x3b')]=_[_0x1e5e('0x3f')](_0x326819[_0x1e5e('0x3b')],{'$or':_[_0x1e5e('0x2b')](_0x326819[_0x1e5e('0x36')],function(_0x329b7e){var _0x4d9406={};_0x4d9406[_0x329b7e]={'$like':'%'+_0x9869ee['query'][_0x1e5e('0x3e')]+'%'};return _0x4d9406;})});}_0x326819=_[_0x1e5e('0x3f')]({},_0x326819,_0x9869ee[_0x1e5e('0x40')]);return _0x19af2d[_0x1e5e('0x50')](_0x326819);}})['then'](function(_0x561331){if(_0x561331){_0x26dad1=_0x561331[_0x1e5e('0x37')];if(!_0x9869ee[_0x1e5e('0x31')][_0x1e5e('0x38')]('nolimit')){_0x326819[_0x1e5e('0x1e')]=qs[_0x1e5e('0x1e')](_0x9869ee[_0x1e5e('0x31')]['limit']);_0x326819['offset']=qs[_0x1e5e('0x1b')](_0x9869ee[_0x1e5e('0x31')]['offset']);}return _0x19af2d[_0x1e5e('0x50')](_0x326819);}})['then'](function(_0x3b649d){if(_0x3b649d){return _0x3b649d?{'count':_0x26dad1,'rows':_0x3b649d}:null;}})[_0x1e5e('0x24')](respondWithResult(_0x50684b,null))[_0x1e5e('0x45')](handleError(_0x50684b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index d76217d..23fdc04 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 _0x47c1=['bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment'];(function(_0xa9ac7a,_0xa358de){var _0x58aae7=function(_0x1fb29c){while(--_0x1fb29c){_0xa9ac7a['push'](_0xa9ac7a['shift']());}};_0x58aae7(++_0xa358de);}(_0x47c1,0xa3));var _0x147c=function(_0x58284c,_0x52bfa7){_0x58284c=_0x58284c-0x0;var _0x4fc8bb=_0x47c1[_0x58284c];return _0x4fc8bb;};'use strict';var _=require(_0x147c('0x0'));var util=require(_0x147c('0x1'));var logger=require(_0x147c('0x2'))(_0x147c('0x3'));var moment=require(_0x147c('0x4'));var BPromise=require(_0x147c('0x5'));var rp=require(_0x147c('0x6'));var fs=require('fs');var path=require(_0x147c('0x7'));var rimraf=require(_0x147c('0x8'));var config=require('../../config/environment');var attributes=require(_0x147c('0x9'));module[_0x147c('0xa')]=function(_0x469075,_0x1930c5){return _0x469075[_0x147c('0xb')](_0x147c('0xc'),attributes,{'tableName':_0x147c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf452=['../../config/logger','api','moment','bluebird','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x587c36,_0x290584){var _0x8f3e11=function(_0x352b39){while(--_0x352b39){_0x587c36['push'](_0x587c36['shift']());}};_0x8f3e11(++_0x290584);}(_0xf452,0xaf));var _0x2f45=function(_0x1fcfa2,_0xf609b4){_0x1fcfa2=_0x1fcfa2-0x0;var _0x412b90=_0xf452[_0x1fcfa2];return _0x412b90;};'use strict';var _=require('lodash');var util=require(_0x2f45('0x0'));var logger=require(_0x2f45('0x1'))(_0x2f45('0x2'));var moment=require(_0x2f45('0x3'));var BPromise=require(_0x2f45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f45('0x5'));var attributes=require(_0x2f45('0x6'));module[_0x2f45('0x7')]=function(_0x3e47c6,_0x59a65d){return _0x3e47c6[_0x2f45('0x8')](_0x2f45('0x9'),attributes,{'tableName':_0x2f45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index ea72c34..76dfe3e 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 _0xb6da=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x203bf4,_0x25fd0c){var _0x3a6598=function(_0x1caaf2){while(--_0x1caaf2){_0x203bf4['push'](_0x203bf4['shift']());}};_0x3a6598(++_0x25fd0c);}(_0xb6da,0x8e));var _0xab6d=function(_0x17976c,_0x5205e7){_0x17976c=_0x17976c-0x0;var _0x68ac6f=_0xb6da[_0x17976c];return _0x68ac6f;};'use strict';var _=require(_0xab6d('0x0'));var util=require('util');var moment=require(_0xab6d('0x1'));var BPromise=require(_0xab6d('0x2'));var rs=require(_0xab6d('0x3'));var fs=require('fs');var Redis=require(_0xab6d('0x4'));var db=require(_0xab6d('0x5'))['db'];var utils=require(_0xab6d('0x6'));var logger=require(_0xab6d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab6d('0x8'));var client=jayson[_0xab6d('0x9')][_0xab6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130285,_0x359bef,_0x44d5fa){return new BPromise(function(_0x4ba0f7,_0x2e30f1){return client['request'](_0x130285,_0x44d5fa)[_0xab6d('0xb')](function(_0x590cfa){logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));logger['debug'](_0xab6d('0xe'),_0x359bef,'request\x20sent',JSON['stringify'](_0x590cfa));if(_0x590cfa[_0xab6d('0xf')]){if(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x10')]===0x1f4){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x2e30f1(_0x590cfa[_0xab6d('0xf')]['message']);}logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);return _0x4ba0f7(_0x590cfa[_0xab6d('0xf')][_0xab6d('0x11')]);}else{logger['info'](_0xab6d('0xc'),_0x359bef,_0xab6d('0xd'));_0x4ba0f7(_0x590cfa[_0xab6d('0x12')]['message']);}})[_0xab6d('0x13')](function(_0x3bd40a){logger[_0xab6d('0xf')](_0xab6d('0xc'),_0x359bef,_0x3bd40a);_0x2e30f1(_0x3bd40a);});});} \ No newline at end of file +var _0x84c6=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','Automation,\x20%s,\x20%s','error','message','result'];(function(_0x243e52,_0x1915d9){var _0x1d42ab=function(_0xf7add1){while(--_0xf7add1){_0x243e52['push'](_0x243e52['shift']());}};_0x1d42ab(++_0x1915d9);}(_0x84c6,0xe7));var _0x684c=function(_0x1fc470,_0x1de953){_0x1fc470=_0x1fc470-0x0;var _0x1f3991=_0x84c6[_0x1fc470];return _0x1f3991;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x684c('0x0'));var BPromise=require(_0x684c('0x1'));var rs=require(_0x684c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x684c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x684c('0x4'))(_0x684c('0x5'));var config=require(_0x684c('0x6'));var jayson=require(_0x684c('0x7'));var client=jayson[_0x684c('0x8')][_0x684c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x209f74,_0x2c52dd,_0x168935){return new BPromise(function(_0x2fd628,_0x5824d8){return client[_0x684c('0xa')](_0x209f74,_0x168935)[_0x684c('0xb')](function(_0x5502ad){logger[_0x684c('0xc')]('Automation,\x20%s,\x20%s',_0x2c52dd,_0x684c('0xd'));logger[_0x684c('0xe')](_0x684c('0xf'),_0x2c52dd,_0x684c('0xd'),JSON[_0x684c('0x10')](_0x5502ad));if(_0x5502ad['error']){if(_0x5502ad['error'][_0x684c('0x11')]===0x1f4){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x5824d8(_0x5502ad['error'][_0x684c('0x14')]);}logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x2fd628(_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);}else{logger[_0x684c('0xc')](_0x684c('0x12'),_0x2c52dd,_0x684c('0xd'));_0x2fd628(_0x5502ad[_0x684c('0x15')]['message']);}})[_0x684c('0x16')](function(_0x5dd4f1){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5dd4f1);_0x5824d8(_0x5dd4f1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6be8d69..0b0203c 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 _0x8fe4=['../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','create','addActions','put','/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8fe4,0x170));var _0x48fe=function(_0x23b801,_0x2b2c30){_0x23b801=_0x23b801-0x0;var _0x340c60=_0x8fe4[_0x23b801];return _0x340c60;};'use strict';var multer=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var path=require('path');var timeout=require(_0x48fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x48fe('0x3'));var auth=require(_0x48fe('0x4'));var interaction=require(_0x48fe('0x5'));var config=require(_0x48fe('0x6'));var controller=require(_0x48fe('0x7'));router[_0x48fe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x48fe('0x9')](),controller[_0x48fe('0xa')]);router[_0x48fe('0x8')](_0x48fe('0xb'),auth['isAuthenticated'](),controller[_0x48fe('0xc')]);router[_0x48fe('0x8')](_0x48fe('0xd'),auth[_0x48fe('0x9')](),controller['getActions']);router[_0x48fe('0xe')]('/',auth[_0x48fe('0x9')](),controller[_0x48fe('0xf')]);router[_0x48fe('0xe')](_0x48fe('0xb'),auth[_0x48fe('0x9')](),controller['addConditions']);router[_0x48fe('0xe')](_0x48fe('0xd'),auth['isAuthenticated'](),controller[_0x48fe('0x10')]);router[_0x48fe('0x11')](_0x48fe('0x12'),auth[_0x48fe('0x9')](),controller[_0x48fe('0x13')]);router['delete'](_0x48fe('0x12'),auth[_0x48fe('0x9')](),controller[_0x48fe('0x14')]);module[_0x48fe('0x15')]=router; \ No newline at end of file +var _0x351d=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./automation.controller','isAuthenticated','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports','multer'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x351d,0x137));var _0xd351=function(_0xe010fc,_0x1caf6d){_0xe010fc=_0xe010fc-0x0;var _0x3a3f75=_0x351d[_0xe010fc];return _0x3a3f75;};'use strict';var multer=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var path=require(_0xd351('0x2'));var timeout=require(_0xd351('0x3'));var express=require(_0xd351('0x4'));var router=express[_0xd351('0x5')]();var fs_extra=require(_0xd351('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd351('0x7'));var config=require('../../config/environment');var controller=require(_0xd351('0x8'));router['get']('/',auth[_0xd351('0x9')](),controller['index']);router[_0xd351('0xa')](_0xd351('0xb'),auth[_0xd351('0x9')](),controller[_0xd351('0xc')]);router[_0xd351('0xa')](_0xd351('0xd'),auth[_0xd351('0x9')](),controller[_0xd351('0xe')]);router[_0xd351('0xa')](_0xd351('0xf'),auth['isAuthenticated'](),controller[_0xd351('0x10')]);router[_0xd351('0x11')]('/',auth[_0xd351('0x9')](),controller[_0xd351('0x12')]);router[_0xd351('0x11')](_0xd351('0xd'),auth[_0xd351('0x9')](),controller[_0xd351('0x13')]);router[_0xd351('0x11')](_0xd351('0xf'),auth[_0xd351('0x9')](),controller[_0xd351('0x14')]);router[_0xd351('0x15')]('/:id',auth[_0xd351('0x9')](),controller[_0xd351('0x16')]);router[_0xd351('0x17')](_0xd351('0xb'),auth['isAuthenticated'](),controller[_0xd351('0x18')]);module[_0xd351('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 807d71e..698c321 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 _0x1b5b=['#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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x1b5b,0x74));var _0xb1b5=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x1b5b[_0x269ee8];return _0x4d98bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb1b5('0x0'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb1b5('0x1')](_0xb1b5('0x2')),'allowNull':![],'defaultValue':_0xb1b5('0x2')},'description':{'type':Sequelize[_0xb1b5('0x3')]},'active':{'type':Sequelize[_0xb1b5('0x4')],'defaultValue':0x0,'comment':_0xb1b5('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb1b5('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb1b5('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb1b5('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':_0xb1b5('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xb1b5('0x1')](_0xb1b5('0xf'),_0xb1b5('0x10'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb1b5('0x4')],'defaultValue':0x0,'comment':_0xb1b5('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb1b5('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb1b5('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb1b5('0x14')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb1b5('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb1b5('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb1b5('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb1b5('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb1b5('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb1b5('0x7')](0x9)[_0xb1b5('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb1b5('0x1')]('DESC','ASC'),'defaultValue':_0xb1b5('0x18')},'dialPrefix':{'type':Sequelize[_0xb1b5('0x3')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb1b5('0x19')},'dialCutDigit':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1b')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x20')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb1b5('0x7')](0x3)[_0xb1b5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb1b5('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb1b5('0x7')](0x5)[_0xb1b5('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb1b5('0x23')}}; \ No newline at end of file +var _0x8544=['name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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,*,*,*','ENUM','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x8544,0x11c));var _0x4854=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x8544[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x4854('0x0'));module[_0x4854('0x1')]={'name':{'type':Sequelize[_0x4854('0x2')],'unique':_0x4854('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4854('0x4')),'allowNull':![],'defaultValue':_0x4854('0x4')},'description':{'type':Sequelize[_0x4854('0x2')]},'active':{'type':Sequelize[_0x4854('0x5')],'defaultValue':0x0,'comment':_0x4854('0x6')},'limitCalls':{'type':Sequelize[_0x4854('0x7')](0x4)[_0x4854('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4854('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4854('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4854('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4854('0x7')](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4854('0x8')],'defaultValue':0x3,'comment':_0x4854('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4854('0x7')](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4854('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4854('0x2')],'defaultValue':_0x4854('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x4854('0x12')]('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4854('0x5')],'defaultValue':0x0,'comment':_0x4854('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x4854('0x7')](0x9)[_0x4854('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4854('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4854('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4854('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4854('0x7')](0x9)[_0x4854('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4854('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4854('0x7')](0x9)[_0x4854('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4854('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x4854('0x7')](0x9)[_0x4854('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4854('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4854('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4854('0x7')](0x9)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4854('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4854('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4854('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4854('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4854('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x4854('0x1d')),'defaultValue':_0x4854('0x1e')},'dialPrefix':{'type':Sequelize[_0x4854('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4854('0x1f')},'dialCutDigit':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4854('0x7')](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x4854('0x7')](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4854('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4854('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4854('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4854('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4854('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4854('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2801a79..3bf4251 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 _0x6324=['CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','fromQuery','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','updatedAt','body','getHoppers','findOne','CmHopper','hasOwnProperty','sort','getHopperHistories','CmHopperHistory','CampaignId','rows','getHopperFinals','CmHopperFinal','pick','CmHopperBlack','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','scheduledAt','ContactId','ListId','createdAt','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final'];(function(_0x110f59,_0x31ef13){var _0x5b77e8=function(_0x317244){while(--_0x317244){_0x110f59['push'](_0x110f59['shift']());}};_0x5b77e8(++_0x31ef13);}(_0x6324,0x142));var _0x4632=function(_0x4afc33,_0x5088fd){_0x4afc33=_0x4afc33-0x0;var _0x448b1c=_0x6324[_0x4afc33];return _0x448b1c;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x51')]=function(_0x32cd35,_0x6c2864){var _0xb1456b={'where':{'id':_0x32cd35['params']['id']}},_0x36c824={};_0x36c824[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')][_0x4632('0x52')]);_0xb1456b[_0x4632('0x38')]=_[_0x4632('0x36')](_0x36c824['model'],qs[_0x4632('0x45')](_0x32cd35[_0x4632('0x34')][_0x4632('0x45')]));_0xb1456b['attributes']=_0xb1456b[_0x4632('0x38')][_0x4632('0x46')]?_0xb1456b['attributes']:_0x36c824[_0x4632('0x37')];if(_0x32cd35[_0x4632('0x34')][_0x4632('0x47')]){_0xb1456b['include']=[{'all':!![]}];}_0xb1456b=_[_0x4632('0x3d')]({},_0xb1456b,_0x32cd35[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0xb1456b)[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](function(_0x180662){if(_0x180662){var _0x4658de=_0x180662[_0x4632('0x28')]({'plain':!![]});_0x4658de=qs[_0x4632('0x53')](_0x4658de,['id','createdAt',_0x4632('0x54')]);_0x32cd35[_0x4632('0x55')]=_['omit'](_0x32cd35[_0x4632('0x55')],['id','createdAt','updatedAt']);return db[_0x4632('0x30')][_0x4632('0x49')](_[_0x4632('0x3d')](_0x4658de,_0x32cd35[_0x4632('0x55')]),{'include':_0x32cd35[_0x4632('0x34')][_0x4632('0x47')]?[{'all':!![]}]:undefined})[_0x4632('0x26')](function(_0x3e2849){var _0x133cb6=_0x32cd35[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x133cb6)throw new Error(_0x4632('0x4b'));if(_0x133cb6[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x5442c9=_0x3e2849['get']({'plain':!![]});var _0x2e34d9=_0x4632('0x29');return db[_0x4632('0x4d')][_0x4632('0x48')]({'where':{'name':_0x2e34d9,'userProfileId':_0x133cb6[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x5b66ee){if(_0x5b66ee&&_0x5b66ee[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x5442c9[_0x4632('0x2d')],'resourceId':_0x5442c9['id'],'type':_0x5b66ee['name'],'sectionId':_0x5b66ee['id']},{})['then'](function(){return _0x3e2849;});}else{return _0x3e2849;}})[_0x4632('0x42')](function(_0x4c547c){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x4c547c);throw _0x4c547c;});}return _0x3e2849;});}})[_0x4632('0x26')](respondWithResult(_0x6c2864,0xc9))[_0x4632('0x42')](handleError(_0x6c2864,null));};exports[_0x4632('0x25')]=function(_0x5e5669,_0x61aa92){if(_0x5e5669[_0x4632('0x55')]['id']){delete _0x5e5669['body']['id'];}return db['Campaign'][_0x4632('0x48')]({'where':{'id':_0x5e5669[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x61aa92,null))[_0x4632('0x26')](saveUpdates(_0x5e5669['body'],null))['then'](respondWithResult(_0x61aa92,null))['catch'](handleError(_0x61aa92,null));};exports[_0x4632('0x27')]=function(_0x5b37cc,_0x3af9ec){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x5b37cc[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3af9ec,null))[_0x4632('0x26')](removeEntity(_0x3af9ec,null))[_0x4632('0x42')](handleError(_0x3af9ec,null));};exports[_0x4632('0x56')]=function(_0x44590d,_0x321969,_0x1dbba9){var _0x2b4c83={'raw':!![],'where':{}};var _0x1c5c49={};var _0x3d5e65={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x44590d['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x321969,null))[_0x4632('0x26')](function(_0x3bc386){if(_0x3bc386){_0x1c5c49[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x58')][_0x4632('0x52')]);_0x1c5c49[_0x4632('0x34')]=_[_0x4632('0x33')](_0x44590d[_0x4632('0x34')]);_0x1c5c49[_0x4632('0x35')]=_[_0x4632('0x36')](_0x1c5c49[_0x4632('0x37')],_0x1c5c49['query']);_0x2b4c83[_0x4632('0x38')]=_[_0x4632('0x36')](_0x1c5c49[_0x4632('0x37')],qs[_0x4632('0x45')](_0x44590d[_0x4632('0x34')][_0x4632('0x45')]));_0x2b4c83['attributes']=_0x2b4c83[_0x4632('0x38')][_0x4632('0x46')]?_0x2b4c83['attributes']:_0x1c5c49[_0x4632('0x37')];if(!_0x44590d[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x2b4c83[_0x4632('0x1e')]=qs['limit'](_0x44590d[_0x4632('0x34')][_0x4632('0x1e')]);_0x2b4c83[_0x4632('0x1c')]=qs['offset'](_0x44590d[_0x4632('0x34')][_0x4632('0x1c')]);}_0x2b4c83[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x44590d[_0x4632('0x34')][_0x4632('0x5a')]);_0x2b4c83[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x44590d[_0x4632('0x34')],_0x1c5c49[_0x4632('0x35')]));_0x2b4c83[_0x4632('0x3b')]['CampaignId']=_0x3bc386['id'];if(_0x44590d[_0x4632('0x34')][_0x4632('0x3c')]){_0x2b4c83['where']=_['merge'](_0x2b4c83[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x2b4c83['attributes'],function(_0x63d3e1){var _0x27e95f={};_0x27e95f[_0x63d3e1]={'$like':'%'+_0x44590d[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x27e95f;})});}_0x2b4c83=_[_0x4632('0x3d')]({},_0x2b4c83,_0x44590d[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x1f')]({'where':_0x2b4c83['where']})[_0x4632('0x26')](function(_0x3f7dff){_0x3d5e65[_0x4632('0x1f')]=_0x3f7dff;if(_0x44590d[_0x4632('0x34')]['includeAll']){_0x2b4c83[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x58')][_0x4632('0x41')](_0x2b4c83);})[_0x4632('0x26')](function(_0x3cee1d){_0x3d5e65['rows']=_0x3cee1d;return _0x3d5e65;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x321969,_0x2b4c83))[_0x4632('0x42')](handleError(_0x321969,null));};exports[_0x4632('0x5b')]=function(_0x2f3fd2,_0x1440ee,_0x219017){var _0x35b01a={'raw':!![],'where':{}};var _0x399037={};var _0x56a39b={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x2f3fd2[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x1440ee,null))[_0x4632('0x26')](function(_0x3a2560){if(_0x3a2560){_0x399037['model']=_[_0x4632('0x33')](db[_0x4632('0x5c')][_0x4632('0x52')]);_0x399037[_0x4632('0x34')]=_[_0x4632('0x33')](_0x2f3fd2[_0x4632('0x34')]);_0x399037[_0x4632('0x35')]=_['intersection'](_0x399037[_0x4632('0x37')],_0x399037[_0x4632('0x34')]);_0x35b01a[_0x4632('0x38')]=_[_0x4632('0x36')](_0x399037[_0x4632('0x37')],qs[_0x4632('0x45')](_0x2f3fd2[_0x4632('0x34')]['fields']));_0x35b01a[_0x4632('0x38')]=_0x35b01a['attributes'][_0x4632('0x46')]?_0x35b01a[_0x4632('0x38')]:_0x399037[_0x4632('0x37')];if(!_0x2f3fd2[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x35b01a[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x2f3fd2[_0x4632('0x34')]['limit']);_0x35b01a[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2f3fd2[_0x4632('0x34')]['offset']);}_0x35b01a[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x2f3fd2[_0x4632('0x34')][_0x4632('0x5a')]);_0x35b01a[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x2f3fd2['query'],_0x399037[_0x4632('0x35')]));_0x35b01a[_0x4632('0x3b')][_0x4632('0x5d')]=_0x3a2560['id'];if(_0x2f3fd2['query'][_0x4632('0x3c')]){_0x35b01a['where']=_[_0x4632('0x3d')](_0x35b01a['where'],{'$or':_[_0x4632('0x2f')](_0x35b01a[_0x4632('0x38')],function(_0x49ebe8){var _0x219a62={};_0x219a62[_0x49ebe8]={'$like':'%'+_0x2f3fd2[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x219a62;})});}_0x35b01a=_['merge']({},_0x35b01a,_0x2f3fd2[_0x4632('0x3f')]);return db[_0x4632('0x5c')][_0x4632('0x1f')]({'where':_0x35b01a[_0x4632('0x3b')]})['then'](function(_0x43386b){_0x56a39b[_0x4632('0x1f')]=_0x43386b;if(_0x2f3fd2[_0x4632('0x34')][_0x4632('0x47')]){_0x35b01a['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x4632('0x41')](_0x35b01a);})[_0x4632('0x26')](function(_0x248220){_0x56a39b[_0x4632('0x5e')]=_0x248220;return _0x56a39b;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x1440ee,_0x35b01a))[_0x4632('0x42')](handleError(_0x1440ee,null));};exports[_0x4632('0x5f')]=function(_0x5aa17f,_0x3ccd89,_0x33b497){var _0x505664={'raw':!![],'where':{}};var _0x51df53={};var _0x1aaaca={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x5aa17f[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3ccd89,null))[_0x4632('0x26')](function(_0x2a2b1b){if(_0x2a2b1b){_0x51df53[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x60')]['rawAttributes']);_0x51df53[_0x4632('0x34')]=_[_0x4632('0x33')](_0x5aa17f[_0x4632('0x34')]);_0x51df53[_0x4632('0x35')]=_[_0x4632('0x36')](_0x51df53[_0x4632('0x37')],_0x51df53[_0x4632('0x34')]);_0x505664[_0x4632('0x38')]=_[_0x4632('0x36')](_0x51df53['model'],qs[_0x4632('0x45')](_0x5aa17f['query'][_0x4632('0x45')]));_0x505664['attributes']=_0x505664[_0x4632('0x38')]['length']?_0x505664[_0x4632('0x38')]:_0x51df53[_0x4632('0x37')];if(!_0x5aa17f[_0x4632('0x34')]['hasOwnProperty']('nolimit')){_0x505664[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x1e')]);_0x505664[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x1c')]);}_0x505664['order']=qs[_0x4632('0x5a')](_0x5aa17f[_0x4632('0x34')][_0x4632('0x5a')]);_0x505664[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x5aa17f[_0x4632('0x34')],_0x51df53[_0x4632('0x35')]));_0x505664[_0x4632('0x3b')][_0x4632('0x5d')]=_0x2a2b1b['id'];if(_0x5aa17f['query'][_0x4632('0x3c')]){_0x505664[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x505664['where'],{'$or':_[_0x4632('0x2f')](_0x505664[_0x4632('0x38')],function(_0x27e56d){var _0x77891b={};_0x77891b[_0x27e56d]={'$like':'%'+_0x5aa17f[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x77891b;})});}_0x505664=_[_0x4632('0x3d')]({},_0x505664,_0x5aa17f[_0x4632('0x3f')]);return db[_0x4632('0x60')][_0x4632('0x1f')]({'where':_0x505664[_0x4632('0x3b')]})['then'](function(_0x3a86d9){_0x1aaaca['count']=_0x3a86d9;if(_0x5aa17f[_0x4632('0x34')][_0x4632('0x47')]){_0x505664['include']=[{'all':!![]}];}return db[_0x4632('0x60')][_0x4632('0x41')](_0x505664);})[_0x4632('0x26')](function(_0x537711){_0x1aaaca[_0x4632('0x5e')]=_0x537711;return _0x1aaaca;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x3ccd89,_0x505664))['catch'](handleError(_0x3ccd89,null));};exports['getHopperBlacks']=function(_0x27f0d4,_0x2addad,_0x225318){var _0x3380ae={'raw':!![],'where':{}};var _0x134488={};var _0x2feec1={'count':0x0,'rows':[]};return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x27f0d4[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x2addad,null))[_0x4632('0x26')](function(_0xd86291){if(_0xd86291){_0x134488[_0x4632('0x37')]=_[_0x4632('0x33')](db['CmHopperBlack'][_0x4632('0x52')]);_0x134488[_0x4632('0x34')]=_[_0x4632('0x33')](_0x27f0d4['query']);_0x134488[_0x4632('0x35')]=_[_0x4632('0x36')](_0x134488[_0x4632('0x37')],_0x134488[_0x4632('0x34')]);_0x3380ae[_0x4632('0x38')]=_[_0x4632('0x36')](_0x134488[_0x4632('0x37')],qs[_0x4632('0x45')](_0x27f0d4[_0x4632('0x34')]['fields']));_0x3380ae[_0x4632('0x38')]=_0x3380ae[_0x4632('0x38')][_0x4632('0x46')]?_0x3380ae[_0x4632('0x38')]:_0x134488[_0x4632('0x37')];if(!_0x27f0d4[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x3380ae[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x27f0d4['query']['limit']);_0x3380ae['offset']=qs[_0x4632('0x1c')](_0x27f0d4['query'][_0x4632('0x1c')]);}_0x3380ae[_0x4632('0x3a')]=qs[_0x4632('0x5a')](_0x27f0d4[_0x4632('0x34')][_0x4632('0x5a')]);_0x3380ae[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x27f0d4[_0x4632('0x34')],_0x134488[_0x4632('0x35')]));_0x3380ae[_0x4632('0x3b')][_0x4632('0x5d')]=_0xd86291['id'];if(_0x27f0d4[_0x4632('0x34')][_0x4632('0x3c')]){_0x3380ae[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x3380ae['where'],{'$or':_[_0x4632('0x2f')](_0x3380ae[_0x4632('0x38')],function(_0x41cae7){var _0x5e17f3={};_0x5e17f3[_0x41cae7]={'$like':'%'+_0x27f0d4[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x5e17f3;})});}_0x3380ae=_[_0x4632('0x3d')]({},_0x3380ae,_0x27f0d4[_0x4632('0x3f')]);return db[_0x4632('0x62')][_0x4632('0x1f')]({'where':_0x3380ae[_0x4632('0x3b')]})['then'](function(_0x310e64){_0x2feec1['count']=_0x310e64;if(_0x27f0d4['query']['includeAll']){_0x3380ae['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x4632('0x41')](_0x3380ae);})[_0x4632('0x26')](function(_0x29d271){_0x2feec1[_0x4632('0x5e')]=_0x29d271;return _0x2feec1;});}})[_0x4632('0x26')](respondWithFilteredResult(_0x2addad,_0x3380ae))['catch'](handleError(_0x2addad,null));};exports['getLists']=function(_0x1687e2,_0x29b08a,_0x1b005f){var _0x125db7={};var _0x1135e6={};var _0x29ec86;var _0x5cbd30;return db['Campaign'][_0x4632('0x57')]({'where':{'id':_0x1687e2[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x29b08a,null))[_0x4632('0x26')](function(_0x1aef6b){if(_0x1aef6b){_0x29ec86=_0x1aef6b;_0x1135e6['model']=_[_0x4632('0x33')](db[_0x4632('0x63')][_0x4632('0x52')]);_0x1135e6[_0x4632('0x34')]=_[_0x4632('0x33')](_0x1687e2['query']);_0x1135e6[_0x4632('0x35')]=_[_0x4632('0x36')](_0x1135e6['model'],_0x1135e6['query']);_0x125db7[_0x4632('0x38')]=_[_0x4632('0x36')](_0x1135e6[_0x4632('0x37')],qs['fields'](_0x1687e2['query'][_0x4632('0x45')]));_0x125db7[_0x4632('0x38')]=_0x125db7[_0x4632('0x38')][_0x4632('0x46')]?_0x125db7[_0x4632('0x38')]:_0x1135e6['model'];_0x125db7[_0x4632('0x3a')]=qs['sort'](_0x1687e2[_0x4632('0x34')]['sort']);_0x125db7['where']=qs[_0x4632('0x35')](_['pick'](_0x1687e2[_0x4632('0x34')],_0x1135e6[_0x4632('0x35')]));if(_0x1687e2[_0x4632('0x34')]['filter']){_0x125db7[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x125db7['where'],{'$or':_['map'](_0x125db7[_0x4632('0x38')],function(_0x527a5c){var _0x80a451={};_0x80a451[_0x527a5c]={'$like':'%'+_0x1687e2[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x80a451;})});}_0x125db7=_[_0x4632('0x3d')]({},_0x125db7,_0x1687e2['options']);return _0x29ec86['getLists'](_0x125db7);}})['then'](function(_0x5dd45b){if(_0x5dd45b){_0x5cbd30=_0x5dd45b[_0x4632('0x46')];if(!_0x1687e2[_0x4632('0x34')][_0x4632('0x59')](_0x4632('0x39'))){_0x125db7[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x1687e2[_0x4632('0x34')][_0x4632('0x1e')]);_0x125db7[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x1687e2['query'][_0x4632('0x1c')]);}return _0x29ec86['getLists'](_0x125db7);}})[_0x4632('0x26')](function(_0x1210fd){if(_0x1210fd){return _0x1210fd?{'count':_0x5cbd30,'rows':_0x1210fd}:null;}})[_0x4632('0x26')](respondWithResult(_0x29b08a,null))[_0x4632('0x42')](handleError(_0x29b08a,null));};exports[_0x4632('0x64')]=function(_0x5f3f6b,_0x2b9a28,_0x279456){var _0x4c3399,_0x199546;var _0x28f727=[];var _0x47d2cc=moment()[_0x4632('0x65')](_0x4632('0x66'));return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x5f3f6b[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x2b9a28,null))[_0x4632('0x26')](function(_0x9b14e4){if(_0x9b14e4){_0x199546=_0x9b14e4;return _0x9b14e4['addLists'](_0x5f3f6b[_0x4632('0x55')][_0x4632('0x67')],_[_0x4632('0x53')](_0x5f3f6b[_0x4632('0x55')],[_0x4632('0x67'),'id'])||{});}return null;})[_0x4632('0x68')](function(_0x27efa3){var _0x5d0c25;var _0x20ea25;_0x4c3399=_0x27efa3||[];var _0x22d667=[];if(_0x27efa3){for(var _0x2f09c4=0x0;_0x2f09c4<_0x27efa3[_0x4632('0x46')];_0x2f09c4+=0x1){var _0x2172a2=_0x27efa3[_0x2f09c4]['get']({'plain':!![]});_0x199546['dialCheckDuplicateType']=_0x5f3f6b['body'][_0x4632('0x69')]?_0x5f3f6b[_0x4632('0x55')][_0x4632('0x69')]:_0x199546[_0x4632('0x69')];switch(_0x199546[_0x4632('0x69')]){case _0x4632('0x6a'):_0x5d0c25=squel['insert']()['into'](_0x4632('0x6b'))['fromQuery'](['phone',_0x4632('0x6c'),_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),_0x4632('0x6f'),_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))['field']('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))['field']('\x27'+_0x47d2cc+'\x27','updatedAt')[_0x4632('0x76')](_0x4632('0x77'))['where'](_0x4632('0x78'))['where']('ListId\x20=\x20?',_0x2172a2[_0x4632('0x74')]['toString']())['where'](_0x4632('0x79'))[_0x4632('0x3b')](_0x4632('0x7a'),squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x7b'))['from'](_0x4632('0x7c'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b['params']['id'][_0x4632('0x75')]()))['where'](_0x4632('0x7a'),squel['select']()['field'](_0x4632('0x7e'))[_0x4632('0x76')](_0x4632('0x6b'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b['params']['id'][_0x4632('0x75')]())))[_0x4632('0x75')]();break;case _0x4632('0x7f'):_0x5d0c25=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x6b'))[_0x4632('0x82')]([_0x4632('0x72'),'scheduledAt',_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),'scheduledAt')[_0x4632('0x71')]('id','ContactId')['field'](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))['field']('\x27'+_0x47d2cc+'\x27','updatedAt')[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))[_0x4632('0x3b')](_0x4632('0x83'),_0x2172a2[_0x4632('0x74')]['toString']())[_0x4632('0x3b')](_0x4632('0x79'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x7e'))[_0x4632('0x76')](_0x4632('0x6b'))[_0x4632('0x3b')](_0x4632('0x7d'),_0x5f3f6b[_0x4632('0x44')]['id']['toString']())))['toString']();break;default:_0x5d0c25=squel[_0x4632('0x80')]()['into'](_0x4632('0x6b'))[_0x4632('0x82')]([_0x4632('0x72'),_0x4632('0x6c'),'ContactId',_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel['select']()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x2172a2[_0x4632('0x74')][_0x4632('0x75')](),_0x4632('0x6e'))[_0x4632('0x71')](_0x5f3f6b[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27','createdAt')[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x54'))[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))[_0x4632('0x3b')]('ListId\x20=\x20?',_0x2172a2[_0x4632('0x74')][_0x4632('0x75')]())[_0x4632('0x3b')](_0x4632('0x79')))[_0x4632('0x75')]();}_0x20ea25=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x84'))[_0x4632('0x82')]([_0x4632('0x85'),_0x4632('0x6c'),_0x4632('0x72'),_0x4632('0x86'),'createdAt',_0x4632('0x54')],squel[_0x4632('0x70')]()[_0x4632('0x71')](_0x4632('0x87'),'id')[_0x4632('0x71')](_0x4632('0x73'),_0x4632('0x6c'))[_0x4632('0x71')](_0x4632('0x88'),'phone')['field'](_0x4632('0x89'),_0x4632('0x86'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x6f'))[_0x4632('0x71')]('\x27'+_0x47d2cc+'\x27',_0x4632('0x54'))['from'](_0x4632('0x8a'),'ci')[_0x4632('0x8b')]('cm_hopper','h',_0x4632('0x8c'))[_0x4632('0x3b')]('h.ListId\x20=\x20?',_0x2172a2['CmListId'][_0x4632('0x75')]())[_0x4632('0x3b')]('h.CampaignId=?',_0x5f3f6b['params']['id'][_0x4632('0x75')]())[_0x4632('0x3b')](_0x4632('0x8d'),_0x47d2cc))[_0x4632('0x75')]();_0x22d667[_0x4632('0x8e')](db[_0x4632('0x8f')][_0x4632('0x34')](_0x5d0c25));_0x28f727['push'](db[_0x4632('0x8f')][_0x4632('0x34')](_0x20ea25));}return BPromise[_0x4632('0x90')](_0x22d667);}})[_0x4632('0x26')](function(){return BPromise[_0x4632('0x90')](_0x28f727);})['then'](function(){return _0x4c3399;})['then'](respondWithResult(_0x2b9a28,null))[_0x4632('0x42')](handleError(_0x2b9a28,null));};exports['removeLists']=function(_0x18b3b7,_0xdd065f,_0x32ee2c){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x18b3b7[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xdd065f,null))[_0x4632('0x26')](function(_0xbe285c){if(_0xbe285c){return _0xbe285c['removeLists'](_0x18b3b7['query']['ids']);}})[_0x4632('0x26')](function(_0x2d8d83){if(_0x2d8d83){return db[_0x4632('0x58')]['destroy']({'where':{'ListId':_0x18b3b7[_0x4632('0x34')][_0x4632('0x67')],'CampaignId':_0x18b3b7[_0x4632('0x44')]['id']}})[_0x4632('0x26')](function(){return _0x2d8d83;});}})[_0x4632('0x26')](respondWithStatusCode(_0xdd065f,null))['catch'](handleError(_0xdd065f,null));};exports[_0x4632('0x91')]=function(_0x2586ca,_0x9a5191,_0x350691){var _0x33336a={};var _0x287d7b={};var _0x1eaf71;var _0xbadb5e;return db[_0x4632('0x30')][_0x4632('0x57')]({'where':{'id':_0x2586ca['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x9a5191,null))[_0x4632('0x26')](function(_0x40e1a0){if(_0x40e1a0){_0x1eaf71=_0x40e1a0;_0x287d7b[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x63')][_0x4632('0x52')]);_0x287d7b[_0x4632('0x34')]=_[_0x4632('0x33')](_0x2586ca[_0x4632('0x34')]);_0x287d7b[_0x4632('0x35')]=_[_0x4632('0x36')](_0x287d7b[_0x4632('0x37')],_0x287d7b[_0x4632('0x34')]);_0x33336a['attributes']=_[_0x4632('0x36')](_0x287d7b[_0x4632('0x37')],qs[_0x4632('0x45')](_0x2586ca[_0x4632('0x34')][_0x4632('0x45')]));_0x33336a[_0x4632('0x38')]=_0x33336a[_0x4632('0x38')][_0x4632('0x46')]?_0x33336a[_0x4632('0x38')]:_0x287d7b['model'];_0x33336a['order']=qs[_0x4632('0x5a')](_0x2586ca['query'][_0x4632('0x5a')]);_0x33336a['where']=qs[_0x4632('0x35')](_[_0x4632('0x61')](_0x2586ca[_0x4632('0x34')],_0x287d7b[_0x4632('0x35')]));if(_0x2586ca['query'][_0x4632('0x3c')]){_0x33336a[_0x4632('0x3b')]=_['merge'](_0x33336a['where'],{'$or':_[_0x4632('0x2f')](_0x33336a[_0x4632('0x38')],function(_0x1a5d60){var _0x4c3619={};_0x4c3619[_0x1a5d60]={'$like':'%'+_0x2586ca['query'][_0x4632('0x3c')]+'%'};return _0x4c3619;})});}_0x33336a=_['merge']({},_0x33336a,_0x2586ca[_0x4632('0x3f')]);return _0x1eaf71[_0x4632('0x91')](_0x33336a);}})['then'](function(_0x594957){if(_0x594957){_0xbadb5e=_0x594957[_0x4632('0x46')];if(!_0x2586ca[_0x4632('0x34')][_0x4632('0x59')]('nolimit')){_0x33336a[_0x4632('0x1e')]=qs['limit'](_0x2586ca['query'][_0x4632('0x1e')]);_0x33336a[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x2586ca[_0x4632('0x34')][_0x4632('0x1c')]);}return _0x1eaf71[_0x4632('0x91')](_0x33336a);}})[_0x4632('0x26')](function(_0x652a18){if(_0x652a18){return _0x652a18?{'count':_0xbadb5e,'rows':_0x652a18}:null;}})[_0x4632('0x26')](respondWithResult(_0x9a5191,null))[_0x4632('0x42')](handleError(_0x9a5191,null));};exports[_0x4632('0x92')]=function(_0x2324b1,_0x32e515,_0x27f514){var _0x56e812,_0x2374e6;var _0xa7816c=[];var _0x5a1eb7=moment()[_0x4632('0x65')](_0x4632('0x66'));return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x2324b1['params']['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x32e515,null))['then'](function(_0x7622fe){if(_0x7622fe){_0x2374e6=_0x7622fe;return _0x7622fe[_0x4632('0x92')](_0x2324b1[_0x4632('0x55')][_0x4632('0x67')],_[_0x4632('0x53')](_0x2324b1[_0x4632('0x55')],[_0x4632('0x67'),'id'])||{});}return null;})[_0x4632('0x68')](function(_0x68216b){var _0x5a19a5;var _0x1e8f57;_0x56e812=_0x68216b||[];var _0xdb8048=[];if(_0x68216b){for(var _0x1e824f=0x0;_0x1e824f<_0x68216b[_0x4632('0x46')];_0x1e824f+=0x1){var _0x55c04f=_0x68216b[_0x1e824f][_0x4632('0x28')]({'plain':!![]});_0x5a19a5=squel[_0x4632('0x80')]()[_0x4632('0x81')](_0x4632('0x93'))['fromQuery'](['phone',_0x4632('0x6d'),_0x4632('0x6e'),_0x4632('0x5d'),'createdAt',_0x4632('0x54')],squel['select']()[_0x4632('0x71')](_0x4632('0x72'),_0x4632('0x72'))[_0x4632('0x71')]('id',_0x4632('0x6d'))[_0x4632('0x71')](_0x55c04f['CmListId'][_0x4632('0x75')](),_0x4632('0x6e'))['field'](_0x2324b1[_0x4632('0x44')]['id'][_0x4632('0x75')](),_0x4632('0x5d'))[_0x4632('0x71')]('NOW()',_0x4632('0x6f'))[_0x4632('0x71')](_0x4632('0x73'),'updatedAt')[_0x4632('0x76')](_0x4632('0x77'))[_0x4632('0x3b')](_0x4632('0x78'))['where'](_0x4632('0x83'),_0x55c04f[_0x4632('0x74')]['toString']())[_0x4632('0x3b')](_0x4632('0x79')))[_0x4632('0x75')]();_0xdb8048[_0x4632('0x8e')](db[_0x4632('0x8f')]['query'](_0x5a19a5));}return BPromise[_0x4632('0x90')](_0xdb8048);}})['then'](function(){return _0x56e812;})[_0x4632('0x26')](respondWithResult(_0x32e515,null))['catch'](handleError(_0x32e515,null));};exports[_0x4632('0x94')]=function(_0x3caed3,_0x504de7,_0xeb4cc8){return db[_0x4632('0x30')][_0x4632('0x48')]({'where':{'id':_0x3caed3[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x504de7,null))['then'](function(_0x1bc678){if(_0x1bc678){return _0x1bc678['removeBlackLists'](_0x3caed3[_0x4632('0x34')][_0x4632('0x67')]);}})[_0x4632('0x26')](function(_0x22f0cd){if(_0x22f0cd){return db[_0x4632('0x62')][_0x4632('0x27')]({'where':{'ListId':_0x3caed3['query'][_0x4632('0x67')],'CampaignId':_0x3caed3[_0x4632('0x44')]['id']}})[_0x4632('0x26')](function(){return _0x22f0cd;});}})[_0x4632('0x26')](respondWithStatusCode(_0x504de7,null))['catch'](handleError(_0x504de7,null));}; \ No newline at end of file +var _0x8da1=['status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','get','destroy','end','error','stack','name','send','index','map','Campaign','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','role','user','autoAssociation','getHoppers','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','field','toString','ListId','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','NOW()','deletedAt\x20IS\x20NULL','CmListId','CampaignId\x20=\x20?','fromQuery','ListId\x20=\x20?','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.CampaignId=?','h.createdAt\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x8da1,0x1a6));var _0x18da=function(_0x507d62,_0x1f83cb){_0x507d62=_0x507d62-0x0;var _0xed22f2=_0x8da1[_0x507d62];return _0xed22f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x18da('0x0'));var jsonpatch=require(_0x18da('0x1'));var rp=require(_0x18da('0x2'));var moment=require(_0x18da('0x3'));var BPromise=require(_0x18da('0x4'));var Mustache=require(_0x18da('0x5'));var util=require(_0x18da('0x6'));var path=require('path');var sox=require(_0x18da('0x7'));var csv=require(_0x18da('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18da('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x18da('0xa'));var jsforce=require(_0x18da('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18da('0xc'));var Papa=require('papaparse');var Redis=require(_0x18da('0xd'));var authService=require(_0x18da('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x18da('0xf'));var hardwareService=require(_0x18da('0x10'));var logger=require(_0x18da('0x11'))(_0x18da('0x12'));var utils=require('../../config/utils');var config=require(_0x18da('0x13'));var licenseUtil=require(_0x18da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509e5b,_0x351d79){_0x351d79=_0x351d79||0xcc;return function(_0x2c1032){if(_0x2c1032){return _0x509e5b[_0x18da('0x15')](_0x351d79);}return _0x509e5b[_0x18da('0x16')](_0x351d79)['end']();};}function respondWithResult(_0x186c5e,_0x5f39aa){_0x5f39aa=_0x5f39aa||0xc8;return function(_0x4a5fe7){if(_0x4a5fe7){return _0x186c5e['status'](_0x5f39aa)['json'](_0x4a5fe7);}};}function respondWithFilteredResult(_0x1c42c8,_0x99c0cf){return function(_0x4120c2){if(_0x4120c2){var _0x2881a7=typeof _0x99c0cf[_0x18da('0x17')]==='undefined'&&typeof _0x99c0cf['limit']===_0x18da('0x18');var _0x31dd7d=_0x4120c2[_0x18da('0x19')];var _0xe867a=_0x2881a7?0x0:_0x99c0cf[_0x18da('0x17')];var _0x55b3a1=_0x2881a7?_0x4120c2[_0x18da('0x19')]:_0x99c0cf[_0x18da('0x17')]+_0x99c0cf[_0x18da('0x1a')];var _0xc7033e;if(_0x55b3a1>=_0x31dd7d){_0x55b3a1=_0x31dd7d;_0xc7033e=0xc8;}else{_0xc7033e=0xce;}_0x1c42c8[_0x18da('0x16')](_0xc7033e);return _0x1c42c8['set'](_0x18da('0x1b'),_0xe867a+'-'+_0x55b3a1+'/'+_0x31dd7d)[_0x18da('0x1c')](_0x4120c2);}return null;};}function patchUpdates(_0x1ad984){return function(_0x21a792){try{jsonpatch[_0x18da('0x1d')](_0x21a792,_0x1ad984,!![]);}catch(_0x3045f1){return BPromise[_0x18da('0x1e')](_0x3045f1);}return _0x21a792[_0x18da('0x1f')]();};}function saveUpdates(_0xfd2afd,_0x4d5958){return function(_0x27f6d1){if(_0x27f6d1){return _0x27f6d1[_0x18da('0x20')](_0xfd2afd)['then'](function(_0x183f63){return _0x183f63;});}return null;};}function removeEntity(_0x1ef528,_0x2f5429){return function(_0x2d3cba){if(_0x2d3cba){return _0x2d3cba['destroy']()[_0x18da('0x21')](function(){var _0x253c5b=_0x2d3cba[_0x18da('0x22')]({'plain':!![]});var _0x588014='IvrCampaigns';return db['UserProfileResource'][_0x18da('0x23')]({'where':{'type':_0x588014,'resourceId':_0x253c5b['id']}})['then'](function(){return _0x2d3cba;});})[_0x18da('0x21')](function(){_0x1ef528[_0x18da('0x16')](0xcc)[_0x18da('0x24')]();});}};}function handleEntityNotFound(_0x2cd46d,_0x52db6c){return function(_0xa91c23){if(!_0xa91c23){_0x2cd46d[_0x18da('0x15')](0x194);}return _0xa91c23;};}function handleError(_0x4d7cf7,_0x3bec6f){_0x3bec6f=_0x3bec6f||0x1f4;return function(_0xd3732b){logger[_0x18da('0x25')](_0xd3732b[_0x18da('0x26')]);if(_0xd3732b[_0x18da('0x27')]){delete _0xd3732b[_0x18da('0x27')];}_0x4d7cf7['status'](_0x3bec6f)[_0x18da('0x28')](_0xd3732b);};}exports[_0x18da('0x29')]=function(_0x1cf0b0,_0xc554d7){var _0x34f6fd={},_0x291c2a={},_0x46d863={'count':0x0,'rows':[]};var _0x20cf42=_[_0x18da('0x2a')](db[_0x18da('0x2b')]['rawAttributes'],function(_0x1f0e57){return{'name':_0x1f0e57[_0x18da('0x2c')],'type':_0x1f0e57[_0x18da('0x2d')][_0x18da('0x2e')]};});_0x291c2a['model']=_[_0x18da('0x2a')](_0x20cf42,'name');_0x291c2a[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x1cf0b0[_0x18da('0x2f')]);_0x291c2a[_0x18da('0x31')]=_[_0x18da('0x32')](_0x291c2a[_0x18da('0x33')],_0x291c2a[_0x18da('0x2f')]);_0x34f6fd['attributes']=_[_0x18da('0x32')](_0x291c2a['model'],qs[_0x18da('0x34')](_0x1cf0b0[_0x18da('0x2f')][_0x18da('0x34')]));_0x34f6fd[_0x18da('0x35')]=_0x34f6fd[_0x18da('0x35')][_0x18da('0x36')]?_0x34f6fd['attributes']:_0x291c2a['model'];if(!_0x1cf0b0[_0x18da('0x2f')]['hasOwnProperty'](_0x18da('0x37'))){_0x34f6fd[_0x18da('0x1a')]=qs[_0x18da('0x1a')](_0x1cf0b0['query'][_0x18da('0x1a')]);_0x34f6fd['offset']=qs['offset'](_0x1cf0b0[_0x18da('0x2f')][_0x18da('0x17')]);}_0x34f6fd[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x1cf0b0[_0x18da('0x2f')][_0x18da('0x39')]);_0x34f6fd['where']=qs['filters'](_[_0x18da('0x3a')](_0x1cf0b0[_0x18da('0x2f')],_0x291c2a[_0x18da('0x31')]),_0x20cf42);if(_0x1cf0b0[_0x18da('0x2f')][_0x18da('0x3b')]){_0x34f6fd[_0x18da('0x3c')]=_['merge'](_0x34f6fd['where'],{'$or':_[_0x18da('0x2a')](_0x20cf42,function(_0x5a6797){if(_0x5a6797[_0x18da('0x2d')]!==_0x18da('0x3d')){var _0xc8e2f0={};_0xc8e2f0[_0x5a6797[_0x18da('0x27')]]={'$like':'%'+_0x1cf0b0[_0x18da('0x2f')][_0x18da('0x3b')]+'%'};return _0xc8e2f0;}})});}_0x34f6fd=_[_0x18da('0x3e')]({},_0x34f6fd,_0x1cf0b0['options']);var _0x35534d={'where':_0x34f6fd[_0x18da('0x3c')]};return db[_0x18da('0x2b')][_0x18da('0x19')](_0x35534d)[_0x18da('0x21')](function(_0x59d7a1){_0x46d863[_0x18da('0x19')]=_0x59d7a1;if(_0x1cf0b0[_0x18da('0x2f')]['includeAll']){_0x34f6fd['include']=[{'all':!![]}];}return db[_0x18da('0x2b')][_0x18da('0x3f')](_0x34f6fd);})[_0x18da('0x21')](function(_0x3c2f26){_0x46d863[_0x18da('0x40')]=_0x3c2f26;return _0x46d863;})[_0x18da('0x21')](respondWithFilteredResult(_0xc554d7,_0x34f6fd))[_0x18da('0x41')](handleError(_0xc554d7,null));};exports[_0x18da('0x42')]=function(_0x4a8525,_0xa23065){var _0x5eccf3={'raw':![],'where':{'id':_0x4a8525[_0x18da('0x43')]['id']}},_0x557dfe={};_0x557dfe[_0x18da('0x33')]=_[_0x18da('0x30')](db[_0x18da('0x2b')][_0x18da('0x44')]);_0x557dfe[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x4a8525['query']);_0x557dfe[_0x18da('0x31')]=_[_0x18da('0x32')](_0x557dfe[_0x18da('0x33')],_0x557dfe[_0x18da('0x2f')]);_0x5eccf3[_0x18da('0x35')]=_[_0x18da('0x32')](_0x557dfe[_0x18da('0x33')],qs[_0x18da('0x34')](_0x4a8525[_0x18da('0x2f')][_0x18da('0x34')]));_0x5eccf3['attributes']=_0x5eccf3[_0x18da('0x35')]['length']?_0x5eccf3[_0x18da('0x35')]:_0x557dfe['model'];if(_0x4a8525[_0x18da('0x2f')]['includeAll']){_0x5eccf3[_0x18da('0x45')]=[{'all':!![]}];}_0x5eccf3=_[_0x18da('0x3e')]({},_0x5eccf3,_0x4a8525[_0x18da('0x46')]);return db[_0x18da('0x2b')][_0x18da('0x47')](_0x5eccf3)[_0x18da('0x21')](handleEntityNotFound(_0xa23065,null))['then'](respondWithResult(_0xa23065,null))['catch'](handleError(_0xa23065,null));};exports['create']=function(_0x51885e,_0x3ef616){return db[_0x18da('0x2b')][_0x18da('0x48')](_0x51885e[_0x18da('0x49')],{})[_0x18da('0x21')](function(_0x571848){var _0x44960f=_0x51885e['user'][_0x18da('0x22')]({'plain':!![]});if(!_0x44960f)throw new Error(_0x18da('0x4a'));if(_0x44960f['role']==='user'){var _0x5d5546=_0x571848[_0x18da('0x22')]({'plain':!![]});var _0x37d182=_0x18da('0x4b');return db[_0x18da('0x4c')][_0x18da('0x47')]({'where':{'name':_0x37d182,'userProfileId':_0x44960f[_0x18da('0x4d')]},'raw':!![]})['then'](function(_0x5cc3e7){if(_0x5cc3e7&&_0x5cc3e7['autoAssociation']===0x0){return db[_0x18da('0x4e')][_0x18da('0x48')]({'name':_0x5d5546[_0x18da('0x27')],'resourceId':_0x5d5546['id'],'type':_0x5cc3e7['name'],'sectionId':_0x5cc3e7['id']},{})[_0x18da('0x21')](function(){return _0x571848;});}else{return _0x571848;}})['catch'](function(_0x57592a){logger[_0x18da('0x25')](_0x18da('0x4f'),_0x57592a);throw _0x57592a;});}return _0x571848;})[_0x18da('0x21')](respondWithResult(_0x3ef616,0xc9))['catch'](handleError(_0x3ef616,null));};exports[_0x18da('0x50')]=function(_0x26421b,_0x4eb1da){var _0x48cb21={'where':{'id':_0x26421b[_0x18da('0x43')]['id']}},_0x45e3a7={};_0x45e3a7[_0x18da('0x33')]=_[_0x18da('0x30')](db[_0x18da('0x2b')][_0x18da('0x44')]);_0x48cb21[_0x18da('0x35')]=_[_0x18da('0x32')](_0x45e3a7['model'],qs[_0x18da('0x34')](_0x26421b[_0x18da('0x2f')]['fields']));_0x48cb21[_0x18da('0x35')]=_0x48cb21[_0x18da('0x35')][_0x18da('0x36')]?_0x48cb21[_0x18da('0x35')]:_0x45e3a7[_0x18da('0x33')];if(_0x26421b[_0x18da('0x2f')][_0x18da('0x51')]){_0x48cb21[_0x18da('0x45')]=[{'all':!![]}];}_0x48cb21=_[_0x18da('0x3e')]({},_0x48cb21,_0x26421b[_0x18da('0x46')]);return db['Campaign'][_0x18da('0x47')](_0x48cb21)['then'](handleEntityNotFound(_0x4eb1da,null))[_0x18da('0x21')](function(_0x604586){if(_0x604586){var _0x375f20=_0x604586['get']({'plain':!![]});_0x375f20=qs[_0x18da('0x52')](_0x375f20,['id',_0x18da('0x53'),_0x18da('0x54')]);_0x26421b[_0x18da('0x49')]=_['omit'](_0x26421b[_0x18da('0x49')],['id','createdAt',_0x18da('0x54')]);return db[_0x18da('0x2b')][_0x18da('0x48')](_[_0x18da('0x3e')](_0x375f20,_0x26421b[_0x18da('0x49')]),{'include':_0x26421b[_0x18da('0x2f')][_0x18da('0x51')]?[{'all':!![]}]:undefined})[_0x18da('0x21')](function(_0x45b347){var _0x456c03=_0x26421b['user'][_0x18da('0x22')]({'plain':!![]});if(!_0x456c03)throw new Error(_0x18da('0x4a'));if(_0x456c03[_0x18da('0x55')]===_0x18da('0x56')){var _0x40f66c=_0x45b347[_0x18da('0x22')]({'plain':!![]});var _0x4ad8f8='IvrCampaigns';return db['UserProfileSection'][_0x18da('0x47')]({'where':{'name':_0x4ad8f8,'userProfileId':_0x456c03[_0x18da('0x4d')]},'raw':!![]})['then'](function(_0x2ab7e7){if(_0x2ab7e7&&_0x2ab7e7[_0x18da('0x57')]===0x0){return db[_0x18da('0x4e')][_0x18da('0x48')]({'name':_0x40f66c[_0x18da('0x27')],'resourceId':_0x40f66c['id'],'type':_0x2ab7e7[_0x18da('0x27')],'sectionId':_0x2ab7e7['id']},{})[_0x18da('0x21')](function(){return _0x45b347;});}else{return _0x45b347;}})[_0x18da('0x41')](function(_0x30f411){logger[_0x18da('0x25')](_0x18da('0x4f'),_0x30f411);throw _0x30f411;});}return _0x45b347;});}})[_0x18da('0x21')](respondWithResult(_0x4eb1da,0xc9))[_0x18da('0x41')](handleError(_0x4eb1da,null));};exports['update']=function(_0x2875e2,_0x5b7188){if(_0x2875e2[_0x18da('0x49')]['id']){delete _0x2875e2[_0x18da('0x49')]['id'];}return db[_0x18da('0x2b')][_0x18da('0x47')]({'where':{'id':_0x2875e2[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x5b7188,null))[_0x18da('0x21')](saveUpdates(_0x2875e2[_0x18da('0x49')],null))[_0x18da('0x21')](respondWithResult(_0x5b7188,null))[_0x18da('0x41')](handleError(_0x5b7188,null));};exports[_0x18da('0x23')]=function(_0x1c58f7,_0x1d063a){return db[_0x18da('0x2b')][_0x18da('0x47')]({'where':{'id':_0x1c58f7[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x1d063a,null))[_0x18da('0x21')](removeEntity(_0x1d063a,null))[_0x18da('0x41')](handleError(_0x1d063a,null));};exports[_0x18da('0x58')]=function(_0xbf5914,_0x3315ae,_0x480ab8){var _0x322c80={'raw':!![],'where':{}};var _0x2852fd={};var _0x56ea45={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xbf5914[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x3315ae,null))[_0x18da('0x21')](function(_0x5bad78){if(_0x5bad78){_0x2852fd[_0x18da('0x33')]=_[_0x18da('0x30')](db['CmHopper'][_0x18da('0x44')]);_0x2852fd[_0x18da('0x2f')]=_['keys'](_0xbf5914[_0x18da('0x2f')]);_0x2852fd[_0x18da('0x31')]=_[_0x18da('0x32')](_0x2852fd['model'],_0x2852fd[_0x18da('0x2f')]);_0x322c80[_0x18da('0x35')]=_[_0x18da('0x32')](_0x2852fd[_0x18da('0x33')],qs[_0x18da('0x34')](_0xbf5914[_0x18da('0x2f')][_0x18da('0x34')]));_0x322c80[_0x18da('0x35')]=_0x322c80['attributes'][_0x18da('0x36')]?_0x322c80[_0x18da('0x35')]:_0x2852fd[_0x18da('0x33')];if(!_0xbf5914[_0x18da('0x2f')]['hasOwnProperty'](_0x18da('0x37'))){_0x322c80[_0x18da('0x1a')]=qs[_0x18da('0x1a')](_0xbf5914['query']['limit']);_0x322c80['offset']=qs[_0x18da('0x17')](_0xbf5914['query']['offset']);}_0x322c80[_0x18da('0x38')]=qs[_0x18da('0x39')](_0xbf5914[_0x18da('0x2f')][_0x18da('0x39')]);_0x322c80['where']=qs[_0x18da('0x31')](_[_0x18da('0x3a')](_0xbf5914[_0x18da('0x2f')],_0x2852fd['filters']));_0x322c80[_0x18da('0x3c')][_0x18da('0x59')]=_0x5bad78['id'];if(_0xbf5914[_0x18da('0x2f')][_0x18da('0x3b')]){_0x322c80['where']=_['merge'](_0x322c80[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x322c80[_0x18da('0x35')],function(_0x4c9525){var _0xa0275e={};_0xa0275e[_0x4c9525]={'$like':'%'+_0xbf5914[_0x18da('0x2f')][_0x18da('0x3b')]+'%'};return _0xa0275e;})});}_0x322c80=_['merge']({},_0x322c80,_0xbf5914[_0x18da('0x46')]);return db[_0x18da('0x5a')][_0x18da('0x19')]({'where':_0x322c80['where']})['then'](function(_0xe43eec){_0x56ea45[_0x18da('0x19')]=_0xe43eec;if(_0xbf5914[_0x18da('0x2f')][_0x18da('0x51')]){_0x322c80[_0x18da('0x45')]=[{'all':!![]}];}return db[_0x18da('0x5a')][_0x18da('0x3f')](_0x322c80);})[_0x18da('0x21')](function(_0x3f9adc){_0x56ea45[_0x18da('0x40')]=_0x3f9adc;return _0x56ea45;});}})[_0x18da('0x21')](respondWithFilteredResult(_0x3315ae,_0x322c80))[_0x18da('0x41')](handleError(_0x3315ae,null));};exports[_0x18da('0x5b')]=function(_0x416a1f,_0x2b98ef,_0x453132){var _0x2623e5={'raw':!![],'where':{}};var _0x473de6={};var _0x3a8176={'count':0x0,'rows':[]};return db[_0x18da('0x2b')]['findOne']({'where':{'id':_0x416a1f['params']['id']}})['then'](handleEntityNotFound(_0x2b98ef,null))[_0x18da('0x21')](function(_0x28d3e1){if(_0x28d3e1){_0x473de6['model']=_[_0x18da('0x30')](db[_0x18da('0x5c')]['rawAttributes']);_0x473de6[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x416a1f[_0x18da('0x2f')]);_0x473de6['filters']=_[_0x18da('0x32')](_0x473de6[_0x18da('0x33')],_0x473de6[_0x18da('0x2f')]);_0x2623e5[_0x18da('0x35')]=_[_0x18da('0x32')](_0x473de6[_0x18da('0x33')],qs[_0x18da('0x34')](_0x416a1f[_0x18da('0x2f')][_0x18da('0x34')]));_0x2623e5['attributes']=_0x2623e5['attributes']['length']?_0x2623e5['attributes']:_0x473de6[_0x18da('0x33')];if(!_0x416a1f[_0x18da('0x2f')][_0x18da('0x5d')](_0x18da('0x37'))){_0x2623e5[_0x18da('0x1a')]=qs[_0x18da('0x1a')](_0x416a1f[_0x18da('0x2f')][_0x18da('0x1a')]);_0x2623e5[_0x18da('0x17')]=qs[_0x18da('0x17')](_0x416a1f['query']['offset']);}_0x2623e5[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x416a1f[_0x18da('0x2f')][_0x18da('0x39')]);_0x2623e5['where']=qs[_0x18da('0x31')](_[_0x18da('0x3a')](_0x416a1f[_0x18da('0x2f')],_0x473de6['filters']));_0x2623e5['where']['CampaignId']=_0x28d3e1['id'];if(_0x416a1f[_0x18da('0x2f')][_0x18da('0x3b')]){_0x2623e5[_0x18da('0x3c')]=_['merge'](_0x2623e5[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x2623e5['attributes'],function(_0x24b7f8){var _0x17346d={};_0x17346d[_0x24b7f8]={'$like':'%'+_0x416a1f[_0x18da('0x2f')]['filter']+'%'};return _0x17346d;})});}_0x2623e5=_['merge']({},_0x2623e5,_0x416a1f[_0x18da('0x46')]);return db[_0x18da('0x5c')][_0x18da('0x19')]({'where':_0x2623e5['where']})['then'](function(_0x1ff66e){_0x3a8176[_0x18da('0x19')]=_0x1ff66e;if(_0x416a1f[_0x18da('0x2f')][_0x18da('0x51')]){_0x2623e5[_0x18da('0x45')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x2623e5);})[_0x18da('0x21')](function(_0x3527b1){_0x3a8176[_0x18da('0x40')]=_0x3527b1;return _0x3a8176;});}})[_0x18da('0x21')](respondWithFilteredResult(_0x2b98ef,_0x2623e5))[_0x18da('0x41')](handleError(_0x2b98ef,null));};exports[_0x18da('0x5e')]=function(_0x55e08a,_0x384d1f,_0x39780a){var _0x10e391={'raw':!![],'where':{}};var _0x5262f9={};var _0x566938={'count':0x0,'rows':[]};return db[_0x18da('0x2b')][_0x18da('0x5f')]({'where':{'id':_0x55e08a[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x384d1f,null))[_0x18da('0x21')](function(_0x469901){if(_0x469901){_0x5262f9[_0x18da('0x33')]=_[_0x18da('0x30')](db['CmHopperFinal'][_0x18da('0x44')]);_0x5262f9[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x55e08a[_0x18da('0x2f')]);_0x5262f9['filters']=_['intersection'](_0x5262f9[_0x18da('0x33')],_0x5262f9[_0x18da('0x2f')]);_0x10e391[_0x18da('0x35')]=_['intersection'](_0x5262f9[_0x18da('0x33')],qs['fields'](_0x55e08a[_0x18da('0x2f')][_0x18da('0x34')]));_0x10e391['attributes']=_0x10e391[_0x18da('0x35')][_0x18da('0x36')]?_0x10e391[_0x18da('0x35')]:_0x5262f9['model'];if(!_0x55e08a[_0x18da('0x2f')]['hasOwnProperty'](_0x18da('0x37'))){_0x10e391['limit']=qs[_0x18da('0x1a')](_0x55e08a[_0x18da('0x2f')]['limit']);_0x10e391[_0x18da('0x17')]=qs[_0x18da('0x17')](_0x55e08a['query'][_0x18da('0x17')]);}_0x10e391[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x55e08a[_0x18da('0x2f')][_0x18da('0x39')]);_0x10e391[_0x18da('0x3c')]=qs['filters'](_[_0x18da('0x3a')](_0x55e08a['query'],_0x5262f9[_0x18da('0x31')]));_0x10e391['where']['CampaignId']=_0x469901['id'];if(_0x55e08a[_0x18da('0x2f')][_0x18da('0x3b')]){_0x10e391[_0x18da('0x3c')]=_[_0x18da('0x3e')](_0x10e391[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x10e391[_0x18da('0x35')],function(_0x1558d4){var _0x464a15={};_0x464a15[_0x1558d4]={'$like':'%'+_0x55e08a[_0x18da('0x2f')][_0x18da('0x3b')]+'%'};return _0x464a15;})});}_0x10e391=_[_0x18da('0x3e')]({},_0x10e391,_0x55e08a[_0x18da('0x46')]);return db[_0x18da('0x60')][_0x18da('0x19')]({'where':_0x10e391[_0x18da('0x3c')]})[_0x18da('0x21')](function(_0x4589b2){_0x566938[_0x18da('0x19')]=_0x4589b2;if(_0x55e08a[_0x18da('0x2f')][_0x18da('0x51')]){_0x10e391[_0x18da('0x45')]=[{'all':!![]}];}return db[_0x18da('0x60')][_0x18da('0x3f')](_0x10e391);})[_0x18da('0x21')](function(_0x151c39){_0x566938['rows']=_0x151c39;return _0x566938;});}})[_0x18da('0x21')](respondWithFilteredResult(_0x384d1f,_0x10e391))[_0x18da('0x41')](handleError(_0x384d1f,null));};exports[_0x18da('0x61')]=function(_0x1b0f48,_0x21c282,_0x23294c){var _0x1c3202={'raw':!![],'where':{}};var _0xe406c5={};var _0x50b0cf={'count':0x0,'rows':[]};return db[_0x18da('0x2b')]['findOne']({'where':{'id':_0x1b0f48[_0x18da('0x43')]['id']}})['then'](handleEntityNotFound(_0x21c282,null))[_0x18da('0x21')](function(_0x4c0620){if(_0x4c0620){_0xe406c5[_0x18da('0x33')]=_[_0x18da('0x30')](db[_0x18da('0x62')][_0x18da('0x44')]);_0xe406c5[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x1b0f48[_0x18da('0x2f')]);_0xe406c5[_0x18da('0x31')]=_['intersection'](_0xe406c5['model'],_0xe406c5[_0x18da('0x2f')]);_0x1c3202[_0x18da('0x35')]=_['intersection'](_0xe406c5['model'],qs[_0x18da('0x34')](_0x1b0f48[_0x18da('0x2f')][_0x18da('0x34')]));_0x1c3202[_0x18da('0x35')]=_0x1c3202[_0x18da('0x35')][_0x18da('0x36')]?_0x1c3202[_0x18da('0x35')]:_0xe406c5[_0x18da('0x33')];if(!_0x1b0f48['query'][_0x18da('0x5d')]('nolimit')){_0x1c3202['limit']=qs['limit'](_0x1b0f48['query'][_0x18da('0x1a')]);_0x1c3202[_0x18da('0x17')]=qs[_0x18da('0x17')](_0x1b0f48[_0x18da('0x2f')][_0x18da('0x17')]);}_0x1c3202[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x1b0f48[_0x18da('0x2f')][_0x18da('0x39')]);_0x1c3202[_0x18da('0x3c')]=qs['filters'](_['pick'](_0x1b0f48[_0x18da('0x2f')],_0xe406c5[_0x18da('0x31')]));_0x1c3202[_0x18da('0x3c')][_0x18da('0x59')]=_0x4c0620['id'];if(_0x1b0f48[_0x18da('0x2f')]['filter']){_0x1c3202[_0x18da('0x3c')]=_[_0x18da('0x3e')](_0x1c3202[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x1c3202[_0x18da('0x35')],function(_0x4eaa06){var _0x207e11={};_0x207e11[_0x4eaa06]={'$like':'%'+_0x1b0f48['query'][_0x18da('0x3b')]+'%'};return _0x207e11;})});}_0x1c3202=_[_0x18da('0x3e')]({},_0x1c3202,_0x1b0f48[_0x18da('0x46')]);return db[_0x18da('0x62')]['count']({'where':_0x1c3202['where']})[_0x18da('0x21')](function(_0x171e50){_0x50b0cf[_0x18da('0x19')]=_0x171e50;if(_0x1b0f48[_0x18da('0x2f')][_0x18da('0x51')]){_0x1c3202[_0x18da('0x45')]=[{'all':!![]}];}return db[_0x18da('0x62')][_0x18da('0x3f')](_0x1c3202);})[_0x18da('0x21')](function(_0x45097d){_0x50b0cf[_0x18da('0x40')]=_0x45097d;return _0x50b0cf;});}})[_0x18da('0x21')](respondWithFilteredResult(_0x21c282,_0x1c3202))[_0x18da('0x41')](handleError(_0x21c282,null));};exports[_0x18da('0x63')]=function(_0x5c9141,_0x34076c,_0x539509){var _0x42ae8f={};var _0x5540ac={};var _0x8fd104;var _0x1ab929;return db['Campaign'][_0x18da('0x5f')]({'where':{'id':_0x5c9141[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x34076c,null))['then'](function(_0x522a4e){if(_0x522a4e){_0x8fd104=_0x522a4e;_0x5540ac['model']=_[_0x18da('0x30')](db[_0x18da('0x64')][_0x18da('0x44')]);_0x5540ac[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x5c9141[_0x18da('0x2f')]);_0x5540ac[_0x18da('0x31')]=_[_0x18da('0x32')](_0x5540ac[_0x18da('0x33')],_0x5540ac[_0x18da('0x2f')]);_0x42ae8f[_0x18da('0x35')]=_[_0x18da('0x32')](_0x5540ac['model'],qs[_0x18da('0x34')](_0x5c9141['query']['fields']));_0x42ae8f['attributes']=_0x42ae8f[_0x18da('0x35')][_0x18da('0x36')]?_0x42ae8f[_0x18da('0x35')]:_0x5540ac['model'];_0x42ae8f[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x5c9141[_0x18da('0x2f')]['sort']);_0x42ae8f['where']=qs['filters'](_[_0x18da('0x3a')](_0x5c9141[_0x18da('0x2f')],_0x5540ac[_0x18da('0x31')]));if(_0x5c9141[_0x18da('0x2f')][_0x18da('0x3b')]){_0x42ae8f[_0x18da('0x3c')]=_[_0x18da('0x3e')](_0x42ae8f[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x42ae8f['attributes'],function(_0x186ed5){var _0x5e4bc9={};_0x5e4bc9[_0x186ed5]={'$like':'%'+_0x5c9141[_0x18da('0x2f')][_0x18da('0x3b')]+'%'};return _0x5e4bc9;})});}_0x42ae8f=_['merge']({},_0x42ae8f,_0x5c9141['options']);return _0x8fd104[_0x18da('0x63')](_0x42ae8f);}})[_0x18da('0x21')](function(_0x226223){if(_0x226223){_0x1ab929=_0x226223[_0x18da('0x36')];if(!_0x5c9141['query'][_0x18da('0x5d')]('nolimit')){_0x42ae8f[_0x18da('0x1a')]=qs[_0x18da('0x1a')](_0x5c9141['query'][_0x18da('0x1a')]);_0x42ae8f[_0x18da('0x17')]=qs[_0x18da('0x17')](_0x5c9141[_0x18da('0x2f')][_0x18da('0x17')]);}return _0x8fd104[_0x18da('0x63')](_0x42ae8f);}})[_0x18da('0x21')](function(_0x3c2a4a){if(_0x3c2a4a){return _0x3c2a4a?{'count':_0x1ab929,'rows':_0x3c2a4a}:null;}})['then'](respondWithResult(_0x34076c,null))['catch'](handleError(_0x34076c,null));};exports['addLists']=function(_0xa24214,_0x4d09a0,_0x406803){var _0x2fb492,_0x2719bc;var _0x2f597b=[];var _0x9707a3=moment()[_0x18da('0x65')](_0x18da('0x66'));return db[_0x18da('0x2b')][_0x18da('0x47')]({'where':{'id':_0xa24214[_0x18da('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d09a0,null))[_0x18da('0x21')](function(_0x472f9b){if(_0x472f9b){_0x2719bc=_0x472f9b;return _0x472f9b[_0x18da('0x67')](_0xa24214[_0x18da('0x49')][_0x18da('0x68')],_[_0x18da('0x52')](_0xa24214[_0x18da('0x49')],[_0x18da('0x68'),'id'])||{});}return null;})[_0x18da('0x69')](function(_0x3fddc0){var _0x3b1a70;var _0x414500;_0x2fb492=_0x3fddc0||[];var _0x4ef61=[];if(_0x3fddc0){for(var _0x27f636=0x0;_0x27f636<_0x3fddc0[_0x18da('0x36')];_0x27f636+=0x1){var _0xdd8d66=_0x3fddc0[_0x27f636][_0x18da('0x22')]({'plain':!![]});_0x2719bc['dialCheckDuplicateType']=_0xa24214[_0x18da('0x49')][_0x18da('0x6a')]?_0xa24214[_0x18da('0x49')][_0x18da('0x6a')]:_0x2719bc[_0x18da('0x6a')];switch(_0x2719bc[_0x18da('0x6a')]){case'always':_0x3b1a70=squel['insert']()[_0x18da('0x6b')](_0x18da('0x6c'))['fromQuery']([_0x18da('0x6d'),_0x18da('0x6e'),_0x18da('0x6f'),'ListId','CampaignId',_0x18da('0x53'),_0x18da('0x54')],squel['select']()['field'](_0x18da('0x6d'),_0x18da('0x6d'))[_0x18da('0x70')]('NOW()','scheduledAt')[_0x18da('0x70')]('id',_0x18da('0x6f'))[_0x18da('0x70')](_0xdd8d66['CmListId'][_0x18da('0x71')](),_0x18da('0x72'))[_0x18da('0x70')](_0xa24214['params']['id'][_0x18da('0x71')](),_0x18da('0x59'))[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27',_0x18da('0x53'))[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27',_0x18da('0x54'))[_0x18da('0x73')](_0x18da('0x74'))[_0x18da('0x3c')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xdd8d66['CmListId']['toString']())[_0x18da('0x3c')](_0x18da('0x75'))[_0x18da('0x3c')](_0x18da('0x76'),squel[_0x18da('0x77')]()[_0x18da('0x70')](_0x18da('0x78'))[_0x18da('0x73')](_0x18da('0x79'))[_0x18da('0x3c')]('CampaignId\x20=\x20?',_0xa24214[_0x18da('0x43')]['id'][_0x18da('0x71')]()))[_0x18da('0x3c')](_0x18da('0x76'),squel[_0x18da('0x77')]()[_0x18da('0x70')](_0x18da('0x7a'))[_0x18da('0x73')]('cm_hopper')[_0x18da('0x3c')]('CampaignId\x20=\x20?',_0xa24214[_0x18da('0x43')]['id'][_0x18da('0x71')]())))[_0x18da('0x71')]();break;case _0x18da('0x7b'):_0x3b1a70=squel[_0x18da('0x7c')]()['into'](_0x18da('0x6c'))['fromQuery']([_0x18da('0x6d'),_0x18da('0x6e'),'ContactId',_0x18da('0x72'),_0x18da('0x59'),_0x18da('0x53'),_0x18da('0x54')],squel[_0x18da('0x77')]()[_0x18da('0x70')](_0x18da('0x6d'),'phone')['field'](_0x18da('0x7d'),_0x18da('0x6e'))['field']('id',_0x18da('0x6f'))['field'](_0xdd8d66['CmListId'][_0x18da('0x71')](),_0x18da('0x72'))[_0x18da('0x70')](_0xa24214['params']['id'][_0x18da('0x71')](),_0x18da('0x59'))[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27','createdAt')[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27','updatedAt')[_0x18da('0x73')](_0x18da('0x74'))[_0x18da('0x3c')](_0x18da('0x7e'))[_0x18da('0x3c')]('ListId\x20=\x20?',_0xdd8d66[_0x18da('0x7f')][_0x18da('0x71')]())['where'](_0x18da('0x75'))['where'](_0x18da('0x76'),squel[_0x18da('0x77')]()[_0x18da('0x70')](_0x18da('0x7a'))[_0x18da('0x73')]('cm_hopper')[_0x18da('0x3c')](_0x18da('0x80'),_0xa24214[_0x18da('0x43')]['id'][_0x18da('0x71')]())))[_0x18da('0x71')]();break;default:_0x3b1a70=squel[_0x18da('0x7c')]()[_0x18da('0x6b')]('cm_hopper')[_0x18da('0x81')]([_0x18da('0x6d'),_0x18da('0x6e'),_0x18da('0x6f'),_0x18da('0x72'),_0x18da('0x59'),'createdAt',_0x18da('0x54')],squel[_0x18da('0x77')]()[_0x18da('0x70')]('phone','phone')[_0x18da('0x70')](_0x18da('0x7d'),_0x18da('0x6e'))['field']('id',_0x18da('0x6f'))['field'](_0xdd8d66['CmListId'][_0x18da('0x71')](),'ListId')[_0x18da('0x70')](_0xa24214['params']['id']['toString'](),'CampaignId')['field']('\x27'+_0x9707a3+'\x27',_0x18da('0x53'))[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27',_0x18da('0x54'))['from'](_0x18da('0x74'))[_0x18da('0x3c')](_0x18da('0x7e'))[_0x18da('0x3c')](_0x18da('0x82'),_0xdd8d66[_0x18da('0x7f')]['toString']())['where'](_0x18da('0x75')))[_0x18da('0x71')]();}_0x414500=squel[_0x18da('0x7c')]()[_0x18da('0x6b')](_0x18da('0x83'))['fromQuery']([_0x18da('0x84'),_0x18da('0x6e'),_0x18da('0x6d'),_0x18da('0x85'),_0x18da('0x53'),'updatedAt'],squel[_0x18da('0x77')]()[_0x18da('0x70')](_0x18da('0x86'),'id')['field'](_0x18da('0x7d'),_0x18da('0x6e'))['field'](_0x18da('0x87'),_0x18da('0x6d'))['field'](_0x18da('0x88'),_0x18da('0x85'))[_0x18da('0x70')]('\x27'+_0x9707a3+'\x27',_0x18da('0x53'))['field']('\x27'+_0x9707a3+'\x27',_0x18da('0x54'))[_0x18da('0x73')](_0x18da('0x89'),'ci')['join']('cm_hopper','h',_0x18da('0x8a'))[_0x18da('0x3c')](_0x18da('0x8b'),_0xdd8d66['CmListId'][_0x18da('0x71')]())[_0x18da('0x3c')](_0x18da('0x8c'),_0xa24214[_0x18da('0x43')]['id'][_0x18da('0x71')]())[_0x18da('0x3c')](_0x18da('0x8d'),_0x9707a3))[_0x18da('0x71')]();_0x4ef61['push'](db['sequelize'][_0x18da('0x2f')](_0x3b1a70));_0x2f597b[_0x18da('0x8e')](db['sequelize']['query'](_0x414500));}return BPromise[_0x18da('0x8f')](_0x4ef61);}})[_0x18da('0x21')](function(){return BPromise['all'](_0x2f597b);})[_0x18da('0x21')](function(){return _0x2fb492;})[_0x18da('0x21')](respondWithResult(_0x4d09a0,null))[_0x18da('0x41')](handleError(_0x4d09a0,null));};exports['removeLists']=function(_0x530cb1,_0x476926,_0x18e62e){return db['Campaign'][_0x18da('0x47')]({'where':{'id':_0x530cb1[_0x18da('0x43')]['id']}})['then'](handleEntityNotFound(_0x476926,null))[_0x18da('0x21')](function(_0x4c1a8b){if(_0x4c1a8b){return _0x4c1a8b[_0x18da('0x90')](_0x530cb1[_0x18da('0x2f')][_0x18da('0x68')]);}})[_0x18da('0x21')](function(_0x1f16b5){if(_0x1f16b5){return db[_0x18da('0x5a')][_0x18da('0x23')]({'where':{'ListId':_0x530cb1[_0x18da('0x2f')][_0x18da('0x68')],'CampaignId':_0x530cb1[_0x18da('0x43')]['id']}})[_0x18da('0x21')](function(){return _0x1f16b5;});}})[_0x18da('0x21')](respondWithStatusCode(_0x476926,null))[_0x18da('0x41')](handleError(_0x476926,null));};exports[_0x18da('0x91')]=function(_0x555c15,_0x48b32c,_0x2fc9e4){var _0x1716f4={};var _0x4e20b8={};var _0x11b36a;var _0x41fedc;return db['Campaign']['findOne']({'where':{'id':_0x555c15[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0x48b32c,null))[_0x18da('0x21')](function(_0x2a2280){if(_0x2a2280){_0x11b36a=_0x2a2280;_0x4e20b8[_0x18da('0x33')]=_[_0x18da('0x30')](db[_0x18da('0x64')]['rawAttributes']);_0x4e20b8[_0x18da('0x2f')]=_[_0x18da('0x30')](_0x555c15[_0x18da('0x2f')]);_0x4e20b8[_0x18da('0x31')]=_['intersection'](_0x4e20b8['model'],_0x4e20b8[_0x18da('0x2f')]);_0x1716f4['attributes']=_[_0x18da('0x32')](_0x4e20b8['model'],qs[_0x18da('0x34')](_0x555c15[_0x18da('0x2f')]['fields']));_0x1716f4['attributes']=_0x1716f4[_0x18da('0x35')]['length']?_0x1716f4[_0x18da('0x35')]:_0x4e20b8[_0x18da('0x33')];_0x1716f4[_0x18da('0x38')]=qs[_0x18da('0x39')](_0x555c15[_0x18da('0x2f')][_0x18da('0x39')]);_0x1716f4[_0x18da('0x3c')]=qs[_0x18da('0x31')](_[_0x18da('0x3a')](_0x555c15[_0x18da('0x2f')],_0x4e20b8[_0x18da('0x31')]));if(_0x555c15[_0x18da('0x2f')]['filter']){_0x1716f4[_0x18da('0x3c')]=_[_0x18da('0x3e')](_0x1716f4[_0x18da('0x3c')],{'$or':_[_0x18da('0x2a')](_0x1716f4[_0x18da('0x35')],function(_0x4ec996){var _0x5cd711={};_0x5cd711[_0x4ec996]={'$like':'%'+_0x555c15[_0x18da('0x2f')][_0x18da('0x3b')]+'%'};return _0x5cd711;})});}_0x1716f4=_['merge']({},_0x1716f4,_0x555c15[_0x18da('0x46')]);return _0x11b36a[_0x18da('0x91')](_0x1716f4);}})[_0x18da('0x21')](function(_0x3ced9e){if(_0x3ced9e){_0x41fedc=_0x3ced9e['length'];if(!_0x555c15[_0x18da('0x2f')][_0x18da('0x5d')](_0x18da('0x37'))){_0x1716f4[_0x18da('0x1a')]=qs[_0x18da('0x1a')](_0x555c15[_0x18da('0x2f')]['limit']);_0x1716f4[_0x18da('0x17')]=qs[_0x18da('0x17')](_0x555c15[_0x18da('0x2f')][_0x18da('0x17')]);}return _0x11b36a[_0x18da('0x91')](_0x1716f4);}})[_0x18da('0x21')](function(_0x1406ab){if(_0x1406ab){return _0x1406ab?{'count':_0x41fedc,'rows':_0x1406ab}:null;}})[_0x18da('0x21')](respondWithResult(_0x48b32c,null))[_0x18da('0x41')](handleError(_0x48b32c,null));};exports[_0x18da('0x92')]=function(_0x4a9f7d,_0xa2237b,_0x12dcd8){var _0x219446,_0x45cb8d;var _0x3dc5c9=[];var _0x210cd6=moment()[_0x18da('0x65')](_0x18da('0x66'));return db['Campaign'][_0x18da('0x47')]({'where':{'id':_0x4a9f7d[_0x18da('0x43')]['id']}})[_0x18da('0x21')](handleEntityNotFound(_0xa2237b,null))[_0x18da('0x21')](function(_0x3d0156){if(_0x3d0156){_0x45cb8d=_0x3d0156;return _0x3d0156[_0x18da('0x92')](_0x4a9f7d['body'][_0x18da('0x68')],_[_0x18da('0x52')](_0x4a9f7d[_0x18da('0x49')],[_0x18da('0x68'),'id'])||{});}return null;})[_0x18da('0x69')](function(_0x446018){var _0x1ce5fa;var _0xc348ed;_0x219446=_0x446018||[];var _0xe9b08f=[];if(_0x446018){for(var _0x23f47c=0x0;_0x23f47c<_0x446018[_0x18da('0x36')];_0x23f47c+=0x1){var _0x15453b=_0x446018[_0x23f47c][_0x18da('0x22')]({'plain':!![]});_0x1ce5fa=squel[_0x18da('0x7c')]()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x18da('0x72'),_0x18da('0x59'),'createdAt',_0x18da('0x54')],squel[_0x18da('0x77')]()['field'](_0x18da('0x6d'),_0x18da('0x6d'))[_0x18da('0x70')]('id','ContactId')[_0x18da('0x70')](_0x15453b[_0x18da('0x7f')][_0x18da('0x71')](),'ListId')['field'](_0x4a9f7d[_0x18da('0x43')]['id']['toString'](),_0x18da('0x59'))[_0x18da('0x70')]('NOW()',_0x18da('0x53'))[_0x18da('0x70')]('NOW()',_0x18da('0x54'))[_0x18da('0x73')](_0x18da('0x74'))['where'](_0x18da('0x7e'))[_0x18da('0x3c')]('ListId\x20=\x20?',_0x15453b[_0x18da('0x7f')][_0x18da('0x71')]())[_0x18da('0x3c')](_0x18da('0x75')))[_0x18da('0x71')]();_0xe9b08f[_0x18da('0x8e')](db['sequelize'][_0x18da('0x2f')](_0x1ce5fa));}return BPromise[_0x18da('0x8f')](_0xe9b08f);}})['then'](function(){return _0x219446;})['then'](respondWithResult(_0xa2237b,null))[_0x18da('0x41')](handleError(_0xa2237b,null));};exports[_0x18da('0x93')]=function(_0xa5626b,_0x663052,_0x64fbfe){return db[_0x18da('0x2b')][_0x18da('0x47')]({'where':{'id':_0xa5626b['params']['id']}})['then'](handleEntityNotFound(_0x663052,null))[_0x18da('0x21')](function(_0x5e6b2f){if(_0x5e6b2f){return _0x5e6b2f[_0x18da('0x93')](_0xa5626b[_0x18da('0x2f')][_0x18da('0x68')]);}})[_0x18da('0x21')](function(_0x5d9ee6){if(_0x5d9ee6){return db['CmHopperBlack'][_0x18da('0x23')]({'where':{'ListId':_0xa5626b['query'][_0x18da('0x68')],'CampaignId':_0xa5626b[_0x18da('0x43')]['id']}})['then'](function(){return _0x5d9ee6;});}})[_0x18da('0x21')](respondWithStatusCode(_0x663052,null))['catch'](handleError(_0x663052,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9ffb62d..eb2ee5d 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(_0x4597a7,_0x5da925){var _0x52cd16=function(_0x58a526){while(--_0x58a526){_0x4597a7['push'](_0x4597a7['shift']());}};_0x52cd16(++_0x5da925);}(_0x7a54,0x106));var _0x47a5=function(_0x34fca5,_0x103f92){_0x34fca5=_0x34fca5-0x0;var _0x2b94bf=_0x7a54[_0x34fca5];return _0x2b94bf;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3655bd,_0x5da5f1){var _0x3a69e4=function(_0x11192c){while(--_0x11192c){_0x3655bd['push'](_0x3655bd['shift']());}};_0x3a69e4(++_0x5da5f1);}(_0x7a54,0x106));var _0x47a5=function(_0x32fc41,_0x12fabd){_0x32fc41=_0x32fc41-0x0;var _0x33f702=_0x7a54[_0x32fc41];return _0x33f702;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a1d37cb..d0ead51 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 _0xaa88=['../../config/environment','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','Campaign,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetCampaign','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x457b0e,_0x5f5b0b){var _0x6e91af=function(_0x36fdfc){while(--_0x36fdfc){_0x457b0e['push'](_0x457b0e['shift']());}};_0x6e91af(++_0x5f5b0b);}(_0xaa88,0x137));var _0x8aa8=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xaa88[_0x434783];return _0x13efcf;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('Campaign,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});}exports['GetCampaign']=function(_0x2c1b9a){var _0x49d80d=this;return new Promise(function(_0x557adc,_0xab7af5){return db['Campaign'][_0x8aa8('0x15')]({'raw':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x17')]===undefined?!![]:![]:!![],'where':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x18')]||null:null,'attributes':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a[_0x8aa8('0x16')][_0x8aa8('0x19')]||null:null,'limit':_0x2c1b9a[_0x8aa8('0x16')]?_0x2c1b9a['options'][_0x8aa8('0x1a')]||null:null,'include':_0x2c1b9a['options']?_0x2c1b9a[_0x8aa8('0x16')]['include']?_[_0x8aa8('0x1b')](_0x2c1b9a['options'][_0x8aa8('0x1c')],function(_0x40adb5){return{'model':db[_0x40adb5[_0x8aa8('0x1d')]],'as':_0x40adb5['as'],'attributes':_0x40adb5['attributes'],'include':_0x40adb5[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x40adb5[_0x8aa8('0x1c')],function(_0x547a7b){return{'model':db[_0x547a7b['model']],'as':_0x547a7b['as'],'attributes':_0x547a7b[_0x8aa8('0x19')],'include':_0x547a7b[_0x8aa8('0x1c')]?_[_0x8aa8('0x1b')](_0x547a7b[_0x8aa8('0x1c')],function(_0x24143e){return{'model':db[_0x24143e['model']],'as':_0x24143e['as'],'attributes':_0x24143e[_0x8aa8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0ff2){logger[_0x8aa8('0xc')](_0x8aa8('0x1e'),_0x2c1b9a);logger['debug']('GetCampaign',_0x2c1b9a,JSON[_0x8aa8('0x1f')](_0x2a0ff2));_0x557adc(_0x2a0ff2);})['catch'](function(_0x385208){logger[_0x8aa8('0x10')](_0x8aa8('0x1e'),_0x385208[_0x8aa8('0x12')],_0x2c1b9a);_0xab7af5(_0x49d80d[_0x8aa8('0x10')](0x1f4,_0x385208['message']));});});}; \ No newline at end of file +var _0x984b=['ioredis','../../config/logger','rpc','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','bluebird','randomstring'];(function(_0x416cea,_0x7d4ee0){var _0x43fdd4=function(_0xa19c32){while(--_0xa19c32){_0x416cea['push'](_0x416cea['shift']());}};_0x43fdd4(++_0x7d4ee0);}(_0x984b,0xee));var _0xb984=function(_0x50ceb2,_0x58b68b){_0x50ceb2=_0x50ceb2-0x0;var _0xd8ff98=_0x984b[_0x50ceb2];return _0xd8ff98;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetCampaign']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetCampaign',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e8a6142..7508856 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 _0x08db=['/:id/hopper_black','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/lists','addLists','addBlackLists','/:id','update','delete','removeLists','removeBlackLists','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x29f50d,_0x580fae){var _0x4eeeae=function(_0x267422){while(--_0x267422){_0x29f50d['push'](_0x29f50d['shift']());}};_0x4eeeae(++_0x580fae);}(_0x08db,0x14e));var _0xb08d=function(_0x473680,_0x412316){_0x473680=_0x473680-0x0;var _0x2e2bd3=_0x08db[_0x473680];return _0x2e2bd3;};'use strict';var multer=require(_0xb08d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb08d('0x1'));var express=require('express');var router=express[_0xb08d('0x2')]();var fs_extra=require(_0xb08d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb08d('0x4'));var config=require(_0xb08d('0x5'));var controller=require(_0xb08d('0x6'));router[_0xb08d('0x7')]('/',auth[_0xb08d('0x8')](),controller['index']);router[_0xb08d('0x7')]('/:id',auth[_0xb08d('0x8')](),controller['show']);router['get'](_0xb08d('0x9'),auth[_0xb08d('0x8')](),controller[_0xb08d('0xa')]);router[_0xb08d('0x7')]('/:id/hopper_histories',auth[_0xb08d('0x8')](),controller[_0xb08d('0xb')]);router[_0xb08d('0x7')](_0xb08d('0xc'),auth[_0xb08d('0x8')](),controller[_0xb08d('0xd')]);router[_0xb08d('0x7')](_0xb08d('0xe'),auth[_0xb08d('0x8')](),controller['getHopperBlacks']);router[_0xb08d('0x7')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0xb08d('0x7')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x10')]);router['post']('/',auth[_0xb08d('0x8')](),controller[_0xb08d('0x11')]);router[_0xb08d('0x12')](_0xb08d('0x13'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x14')]);router['post'](_0xb08d('0x15'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x16')]);router[_0xb08d('0x12')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x17')]);router['put'](_0xb08d('0x18'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x19')]);router['delete'](_0xb08d('0x18'),auth[_0xb08d('0x8')](),controller['destroy']);router[_0xb08d('0x1a')](_0xb08d('0x15'),auth['isAuthenticated'](),controller[_0xb08d('0x1b')]);router[_0xb08d('0x1a')](_0xb08d('0xf'),auth[_0xb08d('0x8')](),controller[_0xb08d('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x8728=['isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','addLists','put','/:id','update','delete','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get'];(function(_0x11198b,_0x4b5155){var _0x1732b1=function(_0xbf8a00){while(--_0xbf8a00){_0x11198b['push'](_0x11198b['shift']());}};_0x1732b1(++_0x4b5155);}(_0x8728,0x14a));var _0x8872=function(_0x54b025,_0x45a708){_0x54b025=_0x54b025-0x0;var _0x196a8c=_0x8728[_0x54b025];return _0x196a8c;};'use strict';var multer=require(_0x8872('0x0'));var util=require(_0x8872('0x1'));var path=require('path');var timeout=require(_0x8872('0x2'));var express=require('express');var router=express[_0x8872('0x3')]();var fs_extra=require(_0x8872('0x4'));var auth=require(_0x8872('0x5'));var interaction=require(_0x8872('0x6'));var config=require(_0x8872('0x7'));var controller=require(_0x8872('0x8'));router[_0x8872('0x9')]('/',auth[_0x8872('0xa')](),controller[_0x8872('0xb')]);router[_0x8872('0x9')]('/:id',auth[_0x8872('0xa')](),controller[_0x8872('0xc')]);router[_0x8872('0x9')]('/:id/hoppers',auth[_0x8872('0xa')](),controller[_0x8872('0xd')]);router[_0x8872('0x9')](_0x8872('0xe'),auth[_0x8872('0xa')](),controller[_0x8872('0xf')]);router[_0x8872('0x9')](_0x8872('0x10'),auth['isAuthenticated'](),controller[_0x8872('0x11')]);router[_0x8872('0x9')](_0x8872('0x12'),auth[_0x8872('0xa')](),controller[_0x8872('0x13')]);router['get'](_0x8872('0x14'),auth[_0x8872('0xa')](),controller[_0x8872('0x15')]);router[_0x8872('0x9')](_0x8872('0x16'),auth[_0x8872('0xa')](),controller[_0x8872('0x17')]);router[_0x8872('0x18')]('/',auth[_0x8872('0xa')](),controller[_0x8872('0x19')]);router['post']('/:id/clone',auth[_0x8872('0xa')](),controller['clone']);router[_0x8872('0x18')](_0x8872('0x14'),auth['isAuthenticated'](),controller[_0x8872('0x1a')]);router[_0x8872('0x18')]('/:id/blacklists',auth[_0x8872('0xa')](),controller['addBlackLists']);router[_0x8872('0x1b')](_0x8872('0x1c'),auth['isAuthenticated'](),controller[_0x8872('0x1d')]);router[_0x8872('0x1e')](_0x8872('0x1c'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0x8872('0x1f')]);router[_0x8872('0x1e')](_0x8872('0x16'),auth[_0x8872('0xa')](),controller[_0x8872('0x20')]);module[_0x8872('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index e0dbadb..79843c6 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 _0x5e29=['STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x5e29,0xd6));var _0x95e2=function(_0xd5246e,_0x90d9d2){_0xd5246e=_0xd5246e-0x0;var _0x57397d=_0x5e29[_0xd5246e];return _0x57397d;};'use strict';var Sequelize=require(_0x95e2('0x0'));module[_0x95e2('0x1')]={'key':{'type':Sequelize[_0x95e2('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x95e2('0x2')]},'name':{'type':Sequelize[_0x95e2('0x3')],'get':function(){return this[_0x95e2('0x4')](_0x95e2('0x5'));}}}; \ No newline at end of file +var _0x5ec6=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x259728,_0x467c29){var _0x636d55=function(_0x6d37ea){while(--_0x6d37ea){_0x259728['push'](_0x259728['shift']());}};_0x636d55(++_0x467c29);}(_0x5ec6,0xc1));var _0x65ec=function(_0x4ad285,_0x38adca){_0x4ad285=_0x4ad285-0x0;var _0x47dbf1=_0x5ec6[_0x4ad285];return _0x47dbf1;};'use strict';var Sequelize=require('sequelize');module[_0x65ec('0x0')]={'key':{'type':Sequelize[_0x65ec('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x65ec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x65ec('0x1')]},'name':{'type':Sequelize[_0x65ec('0x3')],'get':function(){return this[_0x65ec('0x4')](_0x65ec('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 843e500..c5b3a07 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 _0xf6cd=['includeAll','include','options','find','body','catch','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','get','CannedAnswers','destroy','end','sendStatus','error','stack','name','send','index','CannedAnswer','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','filter','merge','findAll','rows','params','rawAttributes','length'];(function(_0x31d8bb,_0x259e4){var _0x4bf266=function(_0x20c68e){while(--_0x20c68e){_0x31d8bb['push'](_0x31d8bb['shift']());}};_0x4bf266(++_0x259e4);}(_0xf6cd,0x185));var _0xdf6c=function(_0x6823e,_0xc66f0e){_0x6823e=_0x6823e-0x0;var _0x5a2be8=_0xf6cd[_0x6823e];return _0x5a2be8;};'use strict';var emlformat=require(_0xdf6c('0x0'));var rimraf=require(_0xdf6c('0x1'));var zipdir=require(_0xdf6c('0x2'));var jsonpatch=require(_0xdf6c('0x3'));var rp=require(_0xdf6c('0x4'));var moment=require(_0xdf6c('0x5'));var BPromise=require(_0xdf6c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf6c('0x7'));var sox=require(_0xdf6c('0x8'));var csv=require(_0xdf6c('0x9'));var ejs=require(_0xdf6c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf6c('0xb'));var _=require(_0xdf6c('0xc'));var squel=require(_0xdf6c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdf6c('0xe'));var toCsv=require(_0xdf6c('0x9'));var querystring=require(_0xdf6c('0xf'));var Papa=require(_0xdf6c('0x10'));var Redis=require(_0xdf6c('0x11'));var authService=require(_0xdf6c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdf6c('0x13'));var hardwareService=require(_0xdf6c('0x14'));var logger=require(_0xdf6c('0x15'))(_0xdf6c('0x16'));var utils=require(_0xdf6c('0x17'));var config=require(_0xdf6c('0x18'));var licenseUtil=require(_0xdf6c('0x19'));var db=require(_0xdf6c('0x1a'))['db'];function respondWithStatusCode(_0x4943ff,_0x11ad4e){_0x11ad4e=_0x11ad4e||0xcc;return function(_0x4cb72c){if(_0x4cb72c){return _0x4943ff['sendStatus'](_0x11ad4e);}return _0x4943ff['status'](_0x11ad4e)['end']();};}function respondWithResult(_0x59bdf8,_0xe804c2){_0xe804c2=_0xe804c2||0xc8;return function(_0x38485f){if(_0x38485f){return _0x59bdf8[_0xdf6c('0x1b')](_0xe804c2)[_0xdf6c('0x1c')](_0x38485f);}};}function respondWithFilteredResult(_0x2c89f2,_0x3e0745){return function(_0x49da8f){if(_0x49da8f){var _0x266ad5=typeof _0x3e0745[_0xdf6c('0x1d')]===_0xdf6c('0x1e')&&typeof _0x3e0745['limit']==='undefined';var _0x211b6e=_0x49da8f[_0xdf6c('0x1f')];var _0x1f0c0b=_0x266ad5?0x0:_0x3e0745['offset'];var _0x5d7062=_0x266ad5?_0x49da8f[_0xdf6c('0x1f')]:_0x3e0745['offset']+_0x3e0745['limit'];var _0x29f663;if(_0x5d7062>=_0x211b6e){_0x5d7062=_0x211b6e;_0x29f663=0xc8;}else{_0x29f663=0xce;}_0x2c89f2[_0xdf6c('0x1b')](_0x29f663);return _0x2c89f2[_0xdf6c('0x20')](_0xdf6c('0x21'),_0x1f0c0b+'-'+_0x5d7062+'/'+_0x211b6e)[_0xdf6c('0x1c')](_0x49da8f);}return null;};}function patchUpdates(_0x377487){return function(_0x271f90){try{jsonpatch[_0xdf6c('0x22')](_0x271f90,_0x377487,!![]);}catch(_0x20edb2){return BPromise[_0xdf6c('0x23')](_0x20edb2);}return _0x271f90[_0xdf6c('0x24')]();};}function saveUpdates(_0x203c96,_0x2d0f4a){return function(_0x4a8c77){if(_0x4a8c77){return _0x4a8c77['update'](_0x203c96)[_0xdf6c('0x25')](function(_0xb86613){return _0xb86613;});}return null;};}function removeEntity(_0x2486dc,_0x16d94c){return function(_0x469ae4){if(_0x469ae4){return _0x469ae4['destroy']()[_0xdf6c('0x25')](function(){var _0x14560b=_0x469ae4[_0xdf6c('0x26')]({'plain':!![]});var _0x176734=_0xdf6c('0x27');return db['UserProfileResource'][_0xdf6c('0x28')]({'where':{'type':_0x176734,'resourceId':_0x14560b['id']}})['then'](function(){return _0x469ae4;});})[_0xdf6c('0x25')](function(){_0x2486dc['status'](0xcc)[_0xdf6c('0x29')]();});}};}function handleEntityNotFound(_0x1efcb0,_0x442885){return function(_0x12ff92){if(!_0x12ff92){_0x1efcb0[_0xdf6c('0x2a')](0x194);}return _0x12ff92;};}function handleError(_0x4801a7,_0x46737e){_0x46737e=_0x46737e||0x1f4;return function(_0x3cd35d){logger[_0xdf6c('0x2b')](_0x3cd35d[_0xdf6c('0x2c')]);if(_0x3cd35d['name']){delete _0x3cd35d[_0xdf6c('0x2d')];}_0x4801a7[_0xdf6c('0x1b')](_0x46737e)[_0xdf6c('0x2e')](_0x3cd35d);};}exports[_0xdf6c('0x2f')]=function(_0x597c53,_0x3fc453){var _0x53c41a={},_0x8e970a={},_0x3e2df3={'count':0x0,'rows':[]};var _0x52b1ff=_['map'](db[_0xdf6c('0x30')]['rawAttributes'],function(_0x3aa7d1){return{'name':_0x3aa7d1[_0xdf6c('0x31')],'type':_0x3aa7d1[_0xdf6c('0x32')][_0xdf6c('0x33')]};});_0x8e970a[_0xdf6c('0x34')]=_['map'](_0x52b1ff,'name');_0x8e970a['query']=_[_0xdf6c('0x35')](_0x597c53[_0xdf6c('0x36')]);_0x8e970a[_0xdf6c('0x37')]=_['intersection'](_0x8e970a['model'],_0x8e970a['query']);_0x53c41a[_0xdf6c('0x38')]=_[_0xdf6c('0x39')](_0x8e970a[_0xdf6c('0x34')],qs[_0xdf6c('0x3a')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3a')]));_0x53c41a['attributes']=_0x53c41a[_0xdf6c('0x38')]['length']?_0x53c41a[_0xdf6c('0x38')]:_0x8e970a['model'];if(!_0x597c53['query'][_0xdf6c('0x3b')](_0xdf6c('0x3c'))){_0x53c41a['limit']=qs[_0xdf6c('0x3d')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3d')]);_0x53c41a[_0xdf6c('0x1d')]=qs[_0xdf6c('0x1d')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x1d')]);}_0x53c41a['order']=qs[_0xdf6c('0x3e')](_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x3e')]);_0x53c41a[_0xdf6c('0x3f')]=qs[_0xdf6c('0x37')](_['pick'](_0x597c53['query'],_0x8e970a[_0xdf6c('0x37')]),_0x52b1ff);if(_0x597c53[_0xdf6c('0x36')][_0xdf6c('0x40')]){_0x53c41a[_0xdf6c('0x3f')]=_[_0xdf6c('0x41')](_0x53c41a[_0xdf6c('0x3f')],{'$or':[{'key':{'$like':'%'+_0x597c53[_0xdf6c('0x36')]['filter']+'%'}},{'value':{'$like':'%'+_0x597c53['query'][_0xdf6c('0x40')]+'%'}}]});}_0x53c41a=_[_0xdf6c('0x41')]({},_0x53c41a,_0x597c53['options']);var _0x42d2c6={'where':_0x53c41a[_0xdf6c('0x3f')]};return db[_0xdf6c('0x30')][_0xdf6c('0x1f')](_0x42d2c6)[_0xdf6c('0x25')](function(_0x276cce){_0x3e2df3[_0xdf6c('0x1f')]=_0x276cce;if(_0x597c53[_0xdf6c('0x36')]['includeAll']){_0x53c41a['include']=[{'all':!![]}];}return db[_0xdf6c('0x30')][_0xdf6c('0x42')](_0x53c41a);})[_0xdf6c('0x25')](function(_0x3c92bd){_0x3e2df3[_0xdf6c('0x43')]=_0x3c92bd;return _0x3e2df3;})[_0xdf6c('0x25')](respondWithFilteredResult(_0x3fc453,_0x53c41a))['catch'](handleError(_0x3fc453,null));};exports['show']=function(_0x3cb6af,_0x415280){var _0x4c2eec={'raw':!![],'where':{'id':_0x3cb6af[_0xdf6c('0x44')]['id']}},_0x23d580={};_0x23d580[_0xdf6c('0x34')]=_[_0xdf6c('0x35')](db['CannedAnswer'][_0xdf6c('0x45')]);_0x23d580[_0xdf6c('0x36')]=_['keys'](_0x3cb6af[_0xdf6c('0x36')]);_0x23d580[_0xdf6c('0x37')]=_['intersection'](_0x23d580[_0xdf6c('0x34')],_0x23d580[_0xdf6c('0x36')]);_0x4c2eec[_0xdf6c('0x38')]=_[_0xdf6c('0x39')](_0x23d580[_0xdf6c('0x34')],qs[_0xdf6c('0x3a')](_0x3cb6af[_0xdf6c('0x36')][_0xdf6c('0x3a')]));_0x4c2eec[_0xdf6c('0x38')]=_0x4c2eec['attributes'][_0xdf6c('0x46')]?_0x4c2eec[_0xdf6c('0x38')]:_0x23d580[_0xdf6c('0x34')];if(_0x3cb6af[_0xdf6c('0x36')][_0xdf6c('0x47')]){_0x4c2eec[_0xdf6c('0x48')]=[{'all':!![]}];}_0x4c2eec=_[_0xdf6c('0x41')]({},_0x4c2eec,_0x3cb6af[_0xdf6c('0x49')]);return db[_0xdf6c('0x30')][_0xdf6c('0x4a')](_0x4c2eec)[_0xdf6c('0x25')](handleEntityNotFound(_0x415280,null))[_0xdf6c('0x25')](respondWithResult(_0x415280,null))['catch'](handleError(_0x415280,null));};exports['update']=function(_0x186ba3,_0x559a25){if(_0x186ba3[_0xdf6c('0x4b')]['id']){delete _0x186ba3[_0xdf6c('0x4b')]['id'];}return db[_0xdf6c('0x30')][_0xdf6c('0x4a')]({'where':{'id':_0x186ba3['params']['id']}})[_0xdf6c('0x25')](handleEntityNotFound(_0x559a25,null))['then'](saveUpdates(_0x186ba3[_0xdf6c('0x4b')],null))[_0xdf6c('0x25')](respondWithResult(_0x559a25,null))[_0xdf6c('0x4c')](handleError(_0x559a25,null));};exports[_0xdf6c('0x28')]=function(_0x2b5d22,_0x36ea4f){return db[_0xdf6c('0x30')][_0xdf6c('0x4a')]({'where':{'id':_0x2b5d22[_0xdf6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x36ea4f,null))[_0xdf6c('0x25')](removeEntity(_0x36ea4f,null))[_0xdf6c('0x4c')](handleError(_0x36ea4f,null));};exports[_0xdf6c('0x4d')]=function(_0x5771af,_0x1722dc){var _0xc51c66={'key':_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x33')]};if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4e')]){_0xc51c66[_0xdf6c('0x4e')]=_0x5771af[_0xdf6c('0x4b')]['MailAccountId'];}else if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4f')]){_0xc51c66[_0xdf6c('0x4f')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x4f')];}else if(_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x50')]){_0xc51c66[_0xdf6c('0x50')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x50')];}else if(_0x5771af[_0xdf6c('0x4b')]['ChatWebsiteId']){_0xc51c66[_0xdf6c('0x51')]=_0x5771af[_0xdf6c('0x4b')][_0xdf6c('0x51')];}return db['CannedAnswer']['find']({'where':_0xc51c66})[_0xdf6c('0x25')](function(_0x31fd5e){if(_0x31fd5e){throw new db[(_0xdf6c('0x52'))][(_0xdf6c('0x53'))](_0xdf6c('0x54'));}return db[_0xdf6c('0x30')][_0xdf6c('0x4d')](_0x5771af[_0xdf6c('0x4b')]);})[_0xdf6c('0x25')](function(_0x38a277){var _0x240aaf=_0x5771af['user'][_0xdf6c('0x26')]({'plain':!![]});if(!_0x240aaf)throw new Error(_0xdf6c('0x55'));if(_0x240aaf[_0xdf6c('0x56')]==='user'){var _0x545f50=_0x38a277[_0xdf6c('0x26')]({'plain':!![]});return db[_0xdf6c('0x57')][_0xdf6c('0x4a')]({'where':{'name':_0xdf6c('0x27'),'userProfileId':_0x240aaf[_0xdf6c('0x58')]},'raw':!![]})[_0xdf6c('0x25')](function(_0x24a285){if(_0x24a285&&_0x24a285[_0xdf6c('0x59')]===0x0){return db[_0xdf6c('0x5a')]['create']({'name':_0x545f50['name'],'resourceId':_0x545f50['id'],'type':_0x24a285[_0xdf6c('0x2d')],'sectionId':_0x24a285['id']},{})[_0xdf6c('0x25')](function(){return _0x38a277;});}else{return _0x38a277;}})[_0xdf6c('0x4c')](function(_0x4e6acf){logger[_0xdf6c('0x2b')](_0xdf6c('0x5b'),_0x4e6acf);throw _0x4e6acf;});}return _0x38a277;})['then'](respondWithResult(_0x1722dc,0xc9))[_0xdf6c('0x4c')](handleError(_0x1722dc,null));}; \ No newline at end of file +var _0x52a1=['fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','show','params','includeAll','catch','update','body','find','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52a1,0x1ef));var _0x152a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x52a1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x152a('0x0'));var zipdir=require(_0x152a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x152a('0x2'));var moment=require(_0x152a('0x3'));var BPromise=require(_0x152a('0x4'));var Mustache=require(_0x152a('0x5'));var util=require('util');var path=require(_0x152a('0x6'));var sox=require(_0x152a('0x7'));var csv=require('to-csv');var ejs=require(_0x152a('0x8'));var fs=require('fs');var fs_extra=require(_0x152a('0x9'));var _=require(_0x152a('0xa'));var squel=require(_0x152a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x152a('0xc'));var toCsv=require(_0x152a('0xd'));var querystring=require(_0x152a('0xe'));var Papa=require(_0x152a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x152a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x152a('0x11'));var logger=require(_0x152a('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x492302,_0x8233e9){_0x8233e9=_0x8233e9||0xcc;return function(_0x5e232c){if(_0x5e232c){return _0x492302[_0x152a('0x13')](_0x8233e9);}return _0x492302['status'](_0x8233e9)[_0x152a('0x14')]();};}function respondWithResult(_0x4d481a,_0x2f914a){_0x2f914a=_0x2f914a||0xc8;return function(_0x24b638){if(_0x24b638){return _0x4d481a[_0x152a('0x15')](_0x2f914a)[_0x152a('0x16')](_0x24b638);}};}function respondWithFilteredResult(_0x35c222,_0x1b0fa1){return function(_0x2d70f6){if(_0x2d70f6){var _0x429563=typeof _0x1b0fa1['offset']==='undefined'&&typeof _0x1b0fa1['limit']==='undefined';var _0x2aaeed=_0x2d70f6[_0x152a('0x17')];var _0x54751a=_0x429563?0x0:_0x1b0fa1[_0x152a('0x18')];var _0x66aedb=_0x429563?_0x2d70f6[_0x152a('0x17')]:_0x1b0fa1['offset']+_0x1b0fa1[_0x152a('0x19')];var _0x4a8d16;if(_0x66aedb>=_0x2aaeed){_0x66aedb=_0x2aaeed;_0x4a8d16=0xc8;}else{_0x4a8d16=0xce;}_0x35c222[_0x152a('0x15')](_0x4a8d16);return _0x35c222[_0x152a('0x1a')](_0x152a('0x1b'),_0x54751a+'-'+_0x66aedb+'/'+_0x2aaeed)[_0x152a('0x16')](_0x2d70f6);}return null;};}function patchUpdates(_0x40794c){return function(_0x43532a){try{jsonpatch[_0x152a('0x1c')](_0x43532a,_0x40794c,!![]);}catch(_0x5a45c0){return BPromise[_0x152a('0x1d')](_0x5a45c0);}return _0x43532a[_0x152a('0x1e')]();};}function saveUpdates(_0x3650f1,_0x461253){return function(_0x17fbfc){if(_0x17fbfc){return _0x17fbfc['update'](_0x3650f1)[_0x152a('0x1f')](function(_0x371d52){return _0x371d52;});}return null;};}function removeEntity(_0x4352c6,_0x426f78){return function(_0x4983c4){if(_0x4983c4){return _0x4983c4[_0x152a('0x20')]()[_0x152a('0x1f')](function(){var _0x3e3d43=_0x4983c4[_0x152a('0x21')]({'plain':!![]});var _0x87e33a='CannedAnswers';return db[_0x152a('0x22')][_0x152a('0x20')]({'where':{'type':_0x87e33a,'resourceId':_0x3e3d43['id']}})[_0x152a('0x1f')](function(){return _0x4983c4;});})[_0x152a('0x1f')](function(){_0x4352c6[_0x152a('0x15')](0xcc)[_0x152a('0x14')]();});}};}function handleEntityNotFound(_0x480b6b,_0x215860){return function(_0x445e4b){if(!_0x445e4b){_0x480b6b[_0x152a('0x13')](0x194);}return _0x445e4b;};}function handleError(_0x5f1bbf,_0x482a48){_0x482a48=_0x482a48||0x1f4;return function(_0x49c9da){logger[_0x152a('0x23')](_0x49c9da[_0x152a('0x24')]);if(_0x49c9da[_0x152a('0x25')]){delete _0x49c9da[_0x152a('0x25')];}_0x5f1bbf['status'](_0x482a48)[_0x152a('0x26')](_0x49c9da);};}exports[_0x152a('0x27')]=function(_0x474c77,_0x390b04){var _0x5d4570={},_0x2722af={},_0x293313={'count':0x0,'rows':[]};var _0x1bb5d0=_['map'](db[_0x152a('0x28')][_0x152a('0x29')],function(_0x468057){return{'name':_0x468057[_0x152a('0x2a')],'type':_0x468057['type']['key']};});_0x2722af[_0x152a('0x2b')]=_['map'](_0x1bb5d0,_0x152a('0x25'));_0x2722af[_0x152a('0x2c')]=_[_0x152a('0x2d')](_0x474c77[_0x152a('0x2c')]);_0x2722af[_0x152a('0x2e')]=_['intersection'](_0x2722af[_0x152a('0x2b')],_0x2722af[_0x152a('0x2c')]);_0x5d4570[_0x152a('0x2f')]=_[_0x152a('0x30')](_0x2722af['model'],qs[_0x152a('0x31')](_0x474c77[_0x152a('0x2c')]['fields']));_0x5d4570['attributes']=_0x5d4570[_0x152a('0x2f')][_0x152a('0x32')]?_0x5d4570[_0x152a('0x2f')]:_0x2722af[_0x152a('0x2b')];if(!_0x474c77['query'][_0x152a('0x33')](_0x152a('0x34'))){_0x5d4570[_0x152a('0x19')]=qs[_0x152a('0x19')](_0x474c77['query'][_0x152a('0x19')]);_0x5d4570[_0x152a('0x18')]=qs[_0x152a('0x18')](_0x474c77[_0x152a('0x2c')][_0x152a('0x18')]);}_0x5d4570[_0x152a('0x35')]=qs['sort'](_0x474c77[_0x152a('0x2c')]['sort']);_0x5d4570[_0x152a('0x36')]=qs[_0x152a('0x2e')](_[_0x152a('0x37')](_0x474c77[_0x152a('0x2c')],_0x2722af[_0x152a('0x2e')]),_0x1bb5d0);if(_0x474c77['query'][_0x152a('0x38')]){_0x5d4570[_0x152a('0x36')]=_[_0x152a('0x39')](_0x5d4570[_0x152a('0x36')],{'$or':[{'key':{'$like':'%'+_0x474c77[_0x152a('0x2c')][_0x152a('0x38')]+'%'}},{'value':{'$like':'%'+_0x474c77['query'][_0x152a('0x38')]+'%'}}]});}_0x5d4570=_['merge']({},_0x5d4570,_0x474c77[_0x152a('0x3a')]);var _0xf6189d={'where':_0x5d4570[_0x152a('0x36')]};return db[_0x152a('0x28')][_0x152a('0x17')](_0xf6189d)[_0x152a('0x1f')](function(_0x1d838a){_0x293313[_0x152a('0x17')]=_0x1d838a;if(_0x474c77[_0x152a('0x2c')]['includeAll']){_0x5d4570[_0x152a('0x3b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x152a('0x3c')](_0x5d4570);})[_0x152a('0x1f')](function(_0x60d3c5){_0x293313['rows']=_0x60d3c5;return _0x293313;})[_0x152a('0x1f')](respondWithFilteredResult(_0x390b04,_0x5d4570))['catch'](handleError(_0x390b04,null));};exports[_0x152a('0x3d')]=function(_0xc84f31,_0x23b944){var _0x47dc65={'raw':!![],'where':{'id':_0xc84f31[_0x152a('0x3e')]['id']}},_0x2d9083={};_0x2d9083['model']=_['keys'](db[_0x152a('0x28')][_0x152a('0x29')]);_0x2d9083[_0x152a('0x2c')]=_['keys'](_0xc84f31[_0x152a('0x2c')]);_0x2d9083[_0x152a('0x2e')]=_[_0x152a('0x30')](_0x2d9083['model'],_0x2d9083['query']);_0x47dc65[_0x152a('0x2f')]=_[_0x152a('0x30')](_0x2d9083[_0x152a('0x2b')],qs[_0x152a('0x31')](_0xc84f31[_0x152a('0x2c')][_0x152a('0x31')]));_0x47dc65[_0x152a('0x2f')]=_0x47dc65['attributes'][_0x152a('0x32')]?_0x47dc65[_0x152a('0x2f')]:_0x2d9083[_0x152a('0x2b')];if(_0xc84f31[_0x152a('0x2c')][_0x152a('0x3f')]){_0x47dc65['include']=[{'all':!![]}];}_0x47dc65=_['merge']({},_0x47dc65,_0xc84f31[_0x152a('0x3a')]);return db['CannedAnswer']['find'](_0x47dc65)[_0x152a('0x1f')](handleEntityNotFound(_0x23b944,null))[_0x152a('0x1f')](respondWithResult(_0x23b944,null))[_0x152a('0x40')](handleError(_0x23b944,null));};exports[_0x152a('0x41')]=function(_0x176af8,_0xfd6f70){if(_0x176af8[_0x152a('0x42')]['id']){delete _0x176af8[_0x152a('0x42')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x176af8[_0x152a('0x3e')]['id']}})['then'](handleEntityNotFound(_0xfd6f70,null))[_0x152a('0x1f')](saveUpdates(_0x176af8[_0x152a('0x42')],null))['then'](respondWithResult(_0xfd6f70,null))[_0x152a('0x40')](handleError(_0xfd6f70,null));};exports[_0x152a('0x20')]=function(_0x21c53f,_0x52e1d6){return db[_0x152a('0x28')][_0x152a('0x43')]({'where':{'id':_0x21c53f[_0x152a('0x3e')]['id']}})[_0x152a('0x1f')](handleEntityNotFound(_0x52e1d6,null))[_0x152a('0x1f')](removeEntity(_0x52e1d6,null))[_0x152a('0x40')](handleError(_0x52e1d6,null));};exports['create']=function(_0x40bcb8,_0x4e515d){var _0x1f3753={'key':_0x40bcb8[_0x152a('0x42')][_0x152a('0x44')]};if(_0x40bcb8[_0x152a('0x42')][_0x152a('0x45')]){_0x1f3753[_0x152a('0x45')]=_0x40bcb8[_0x152a('0x42')][_0x152a('0x45')];}else if(_0x40bcb8['body'][_0x152a('0x46')]){_0x1f3753[_0x152a('0x46')]=_0x40bcb8[_0x152a('0x42')][_0x152a('0x46')];}else if(_0x40bcb8['body'][_0x152a('0x47')]){_0x1f3753[_0x152a('0x47')]=_0x40bcb8[_0x152a('0x42')][_0x152a('0x47')];}else if(_0x40bcb8[_0x152a('0x42')][_0x152a('0x48')]){_0x1f3753[_0x152a('0x48')]=_0x40bcb8[_0x152a('0x42')][_0x152a('0x48')];}return db[_0x152a('0x28')][_0x152a('0x43')]({'where':_0x1f3753})['then'](function(_0x581193){if(_0x581193){throw new db[(_0x152a('0x49'))][(_0x152a('0x4a'))](_0x152a('0x4b'));}return db[_0x152a('0x28')][_0x152a('0x4c')](_0x40bcb8[_0x152a('0x42')]);})[_0x152a('0x1f')](function(_0x3a6796){var _0x580170=_0x40bcb8[_0x152a('0x4d')][_0x152a('0x21')]({'plain':!![]});if(!_0x580170)throw new Error(_0x152a('0x4e'));if(_0x580170[_0x152a('0x4f')]==='user'){var _0x51be61=_0x3a6796[_0x152a('0x21')]({'plain':!![]});return db[_0x152a('0x50')][_0x152a('0x43')]({'where':{'name':_0x152a('0x51'),'userProfileId':_0x580170['userProfileId']},'raw':!![]})[_0x152a('0x1f')](function(_0xd3660d){if(_0xd3660d&&_0xd3660d[_0x152a('0x52')]===0x0){return db[_0x152a('0x22')][_0x152a('0x4c')]({'name':_0x51be61['name'],'resourceId':_0x51be61['id'],'type':_0xd3660d['name'],'sectionId':_0xd3660d['id']},{})[_0x152a('0x1f')](function(){return _0x3a6796;});}else{return _0x3a6796;}})[_0x152a('0x40')](function(_0x598b41){logger[_0x152a('0x23')](_0x152a('0x53'),_0x598b41);throw _0x598b41;});}return _0x3a6796;})[_0x152a('0x1f')](respondWithResult(_0x4e515d,0xc9))[_0x152a('0x40')](handleError(_0x4e515d,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 7084060..3f53e83 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 _0x2bc2=['./cannedAnswer.attributes','define','CannedAnswer','utf8mb4_unicode_ci','lodash','api','request-promise','rimraf'];(function(_0x593487,_0x40c39b){var _0x4d3f61=function(_0x4079c1){while(--_0x4079c1){_0x593487['push'](_0x593487['shift']());}};_0x4d3f61(++_0x40c39b);}(_0x2bc2,0x1ac));var _0x22bc=function(_0x586998,_0xc9fd34){_0x586998=_0x586998-0x0;var _0x1c882d=_0x2bc2[_0x586998];return _0x1c882d;};'use strict';var _=require(_0x22bc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x22bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22bc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22bc('0x3'));var config=require('../../config/environment');var attributes=require(_0x22bc('0x4'));module['exports']=function(_0x12232a,_0x130212){return _0x12232a[_0x22bc('0x5')](_0x22bc('0x6'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x22bc('0x7')});}; \ No newline at end of file +var _0xe706=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x397f37,_0x3cf86d){var _0x31cae6=function(_0x5cddb9){while(--_0x5cddb9){_0x397f37['push'](_0x397f37['shift']());}};_0x31cae6(++_0x3cf86d);}(_0xe706,0xa3));var _0x6e70=function(_0x1ea729,_0x3552bb){_0x1ea729=_0x1ea729-0x0;var _0x3576c4=_0xe706[_0x1ea729];return _0x3576c4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6e70('0xe'),'collate':_0x6e70('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 47a3218..c464682 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(_0x217f74,_0x14dd9b){var _0x3ab223=function(_0x17a123){while(--_0x17a123){_0x217f74['push'](_0x217f74['shift']());}};_0x3ab223(++_0x14dd9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x8b5726,_0x1f33d3){var _0x538c4d=function(_0x4cd9bc){while(--_0x4cd9bc){_0x8b5726['push'](_0x8b5726['shift']());}};_0x538c4d(++_0x1f33d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 9971e41..5cbcdca 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 _0xc5d0=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x4b86bc,_0x13ccf7){var _0x561b60=function(_0x42a3d8){while(--_0x42a3d8){_0x4b86bc['push'](_0x4b86bc['shift']());}};_0x561b60(++_0x13ccf7);}(_0xc5d0,0xbc));var _0x0c5d=function(_0xbcd604,_0x5c6862){_0xbcd604=_0xbcd604-0x0;var _0x16a71e=_0xc5d0[_0xbcd604];return _0x16a71e;};'use strict';var multer=require(_0x0c5d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c5d('0x1'));var router=express[_0x0c5d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0c5d('0x3'));var interaction=require(_0x0c5d('0x4'));var config=require(_0x0c5d('0x5'));var controller=require('./cannedAnswer.controller');router[_0x0c5d('0x6')]('/',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0x8')]);router[_0x0c5d('0x6')](_0x0c5d('0x9'),auth['isAuthenticated'](),controller[_0x0c5d('0xa')]);router[_0x0c5d('0xb')]('/',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xc')]);router['put']('/:id',auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xd')]);router[_0x0c5d('0xe')](_0x0c5d('0x9'),auth[_0x0c5d('0x7')](),controller[_0x0c5d('0xf')]);module[_0x0c5d('0x10')]=router; \ No newline at end of file +var _0x3dff=['isAuthenticated','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','/:id'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3dff,0xec));var _0xf3df=function(_0x241b08,_0x41c97a){_0x241b08=_0x241b08-0x0;var _0x5e2bfa=_0x3dff[_0x241b08];return _0x5e2bfa;};'use strict';var multer=require(_0xf3df('0x0'));var util=require('util');var path=require(_0xf3df('0x1'));var timeout=require(_0xf3df('0x2'));var express=require(_0xf3df('0x3'));var router=express[_0xf3df('0x4')]();var fs_extra=require(_0xf3df('0x5'));var auth=require(_0xf3df('0x6'));var interaction=require(_0xf3df('0x7'));var config=require('../../config/environment');var controller=require(_0xf3df('0x8'));router[_0xf3df('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf3df('0x9')](_0xf3df('0xa'),auth[_0xf3df('0xb')](),controller[_0xf3df('0xc')]);router[_0xf3df('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf3df('0xe')]('/:id',auth[_0xf3df('0xb')](),controller[_0xf3df('0xf')]);router[_0xf3df('0x10')](_0xf3df('0xa'),auth[_0xf3df('0xb')](),controller[_0xf3df('0x11')]);module[_0xf3df('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 912d395..2afefc2 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 _0xd770=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x52deb5,_0x4c7748){var _0x476601=function(_0x19c7f2){while(--_0x19c7f2){_0x52deb5['push'](_0x52deb5['shift']());}};_0x476601(++_0x4c7748);}(_0xd770,0x1e5));var _0x0d77=function(_0x24dda9,_0x59f3a5){_0x24dda9=_0x24dda9-0x0;var _0x416acb=_0xd770[_0x24dda9];return _0x416acb;};'use strict';var Sequelize=require('sequelize');module[_0x0d77('0x0')]={'calldate':{'type':Sequelize[_0x0d77('0x1')],'allowNull':![],'defaultValue':_0x0d77('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x0d77('0x3')]},'dst':{'type':Sequelize[_0x0d77('0x3')]},'dcontext':{'type':Sequelize[_0x0d77('0x3')]},'channel':{'type':Sequelize[_0x0d77('0x3')]},'dstchannel':{'type':Sequelize[_0x0d77('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x0d77('0x3')]},'duration':{'type':Sequelize[_0x0d77('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0d77('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0d77('0x3')]},'userfield':{'type':Sequelize[_0x0d77('0x3')]},'uniqueid':{'type':Sequelize[_0x0d77('0x3')]},'linkedid':{'type':Sequelize[_0x0d77('0x3')]},'sequence':{'type':Sequelize[_0x0d77('0x3')]},'peeraccount':{'type':Sequelize[_0x0d77('0x3')]},'type':{'type':Sequelize[_0x0d77('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3df4=['STRING','INTEGER','DATE','1970-01-01\x2000:00:01'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3df4,0x102));var _0x43df=function(_0x320112,_0x5f10ae){_0x320112=_0x320112-0x0;var _0x353564=_0x3df4[_0x320112];return _0x353564;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0x43df('0x0')],'allowNull':![],'defaultValue':_0x43df('0x1')},'clid':{'type':Sequelize[_0x43df('0x2')]},'src':{'type':Sequelize[_0x43df('0x2')]},'dst':{'type':Sequelize[_0x43df('0x2')]},'dcontext':{'type':Sequelize[_0x43df('0x2')]},'channel':{'type':Sequelize[_0x43df('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x43df('0x2')]},'duration':{'type':Sequelize[_0x43df('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x43df('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x43df('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x43df('0x2')]},'uniqueid':{'type':Sequelize[_0x43df('0x2')]},'linkedid':{'type':Sequelize[_0x43df('0x2')]},'sequence':{'type':Sequelize[_0x43df('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x43df('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e07ef61..c2dad5b 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 _0xa9b1=['where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Cdr','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter'];(function(_0x2ba1b2,_0x1d4370){var _0x23345e=function(_0x397142){while(--_0x397142){_0x2ba1b2['push'](_0x2ba1b2['shift']());}};_0x23345e(++_0x1d4370);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1a9b('0x0'));var jsonpatch=require(_0x1a9b('0x1'));var rp=require(_0x1a9b('0x2'));var moment=require(_0x1a9b('0x3'));var BPromise=require(_0x1a9b('0x4'));var Mustache=require(_0x1a9b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1a9b('0x6'));var ejs=require(_0x1a9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1a9b('0x8'));var _=require(_0x1a9b('0x9'));var squel=require(_0x1a9b('0xa'));var crypto=require(_0x1a9b('0xb'));var jsforce=require(_0x1a9b('0xc'));var deskjs=require(_0x1a9b('0xd'));var toCsv=require(_0x1a9b('0x6'));var querystring=require(_0x1a9b('0xe'));var Papa=require(_0x1a9b('0xf'));var Redis=require(_0x1a9b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a9b('0x11'));var hardwareService=require(_0x1a9b('0x12'));var logger=require(_0x1a9b('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1a9b('0x14'));var db=require(_0x1a9b('0x15'))['db'];function respondWithStatusCode(_0x2c75cf,_0x11bf7e){_0x11bf7e=_0x11bf7e||0xcc;return function(_0x2c3170){if(_0x2c3170){return _0x2c75cf[_0x1a9b('0x16')](_0x11bf7e);}return _0x2c75cf['status'](_0x11bf7e)[_0x1a9b('0x17')]();};}function respondWithResult(_0x34f082,_0x245883){_0x245883=_0x245883||0xc8;return function(_0x53c725){if(_0x53c725){return _0x34f082[_0x1a9b('0x18')](_0x245883)[_0x1a9b('0x19')](_0x53c725);}};}function respondWithFilteredResult(_0x55a00d,_0x2a7d72){return function(_0x57ca87){if(_0x57ca87){var _0x439acd=typeof _0x2a7d72[_0x1a9b('0x1a')]===_0x1a9b('0x1b')&&typeof _0x2a7d72[_0x1a9b('0x1c')]===_0x1a9b('0x1b');var _0x20b8dc=_0x57ca87[_0x1a9b('0x1d')];var _0x205a0d=_0x439acd?0x0:_0x2a7d72[_0x1a9b('0x1a')];var _0x1281c2=_0x439acd?_0x57ca87['count']:_0x2a7d72[_0x1a9b('0x1a')]+_0x2a7d72[_0x1a9b('0x1c')];var _0x3df7d2;if(_0x1281c2>=_0x20b8dc){_0x1281c2=_0x20b8dc;_0x3df7d2=0xc8;}else{_0x3df7d2=0xce;}_0x55a00d[_0x1a9b('0x18')](_0x3df7d2);return _0x55a00d['set'](_0x1a9b('0x1e'),_0x205a0d+'-'+_0x1281c2+'/'+_0x20b8dc)[_0x1a9b('0x19')](_0x57ca87);}return null;};}function patchUpdates(_0x4b3cd3){return function(_0x23e327){try{jsonpatch[_0x1a9b('0x1f')](_0x23e327,_0x4b3cd3,!![]);}catch(_0x44cebf){return BPromise[_0x1a9b('0x20')](_0x44cebf);}return _0x23e327[_0x1a9b('0x21')]();};}function saveUpdates(_0x590568,_0x189e78){return function(_0x17b1dd){if(_0x17b1dd){return _0x17b1dd[_0x1a9b('0x22')](_0x590568)[_0x1a9b('0x23')](function(_0x36391a){return _0x36391a;});}return null;};}function removeEntity(_0x2e42f1,_0x28f937){return function(_0x488a33){if(_0x488a33){return _0x488a33[_0x1a9b('0x24')]()['then'](function(){_0x2e42f1[_0x1a9b('0x18')](0xcc)[_0x1a9b('0x17')]();});}};}function handleEntityNotFound(_0xad6541,_0x4e7234){return function(_0x213841){if(!_0x213841){_0xad6541[_0x1a9b('0x16')](0x194);}return _0x213841;};}function handleError(_0x1521f4,_0x181331){_0x181331=_0x181331||0x1f4;return function(_0x18c9dd){logger[_0x1a9b('0x25')](_0x18c9dd['stack']);if(_0x18c9dd[_0x1a9b('0x26')]){delete _0x18c9dd[_0x1a9b('0x26')];}_0x1521f4['status'](_0x181331)[_0x1a9b('0x27')](_0x18c9dd);};}exports[_0x1a9b('0x28')]=function(_0x5d70dc,_0x5d7e8c){var _0x3f8e98={},_0x1d981e={},_0x5362b8={'count':0x0,'rows':[]};var _0x30278b=_[_0x1a9b('0x29')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')],function(_0x1a5085){return{'name':_0x1a5085[_0x1a9b('0x2c')],'type':_0x1a5085[_0x1a9b('0x2d')]['key']};});_0x1d981e[_0x1a9b('0x2e')]=_[_0x1a9b('0x29')](_0x30278b,_0x1a9b('0x26'));_0x1d981e[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x5d70dc[_0x1a9b('0x2f')]);_0x1d981e[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x1d981e[_0x1a9b('0x2e')],_0x1d981e[_0x1a9b('0x2f')]);_0x3f8e98[_0x1a9b('0x33')]=_['intersection'](_0x1d981e['model'],qs[_0x1a9b('0x34')](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x3f8e98['attributes']=_0x3f8e98[_0x1a9b('0x33')]['length']?_0x3f8e98[_0x1a9b('0x33')]:_0x1d981e['model'];if(!_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x35')]('nolimit')){_0x3f8e98[_0x1a9b('0x1c')]=qs['limit'](_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x1c')]);_0x3f8e98[_0x1a9b('0x1a')]=qs[_0x1a9b('0x1a')](_0x5d70dc['query'][_0x1a9b('0x1a')]);}_0x3f8e98[_0x1a9b('0x36')]=qs[_0x1a9b('0x37')](_0x5d70dc['query'][_0x1a9b('0x37')]);_0x3f8e98['where']=qs['filters'](_[_0x1a9b('0x38')](_0x5d70dc[_0x1a9b('0x2f')],_0x1d981e[_0x1a9b('0x31')]),_0x30278b);if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]){_0x3f8e98[_0x1a9b('0x3a')]=_[_0x1a9b('0x3b')](_0x3f8e98['where'],{'$or':_[_0x1a9b('0x29')](_0x30278b,function(_0x230fc6){if(_0x230fc6[_0x1a9b('0x2d')]!=='VIRTUAL'){var _0x466827={};_0x466827[_0x230fc6[_0x1a9b('0x26')]]={'$like':'%'+_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x39')]+'%'};return _0x466827;}})});}_0x3f8e98=_['merge']({},_0x3f8e98,_0x5d70dc['options']);var _0x10e80f={'where':_0x3f8e98[_0x1a9b('0x3a')]};return db[_0x1a9b('0x2a')]['count'](_0x10e80f)['then'](function(_0x2b9bcf){_0x5362b8[_0x1a9b('0x1d')]=_0x2b9bcf;if(_0x5d70dc[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x3f8e98[_0x1a9b('0x3d')]=[{'all':!![]}];}return db[_0x1a9b('0x2a')][_0x1a9b('0x3e')](_0x3f8e98);})['then'](function(_0x313921){_0x5362b8[_0x1a9b('0x3f')]=_0x313921;return _0x5362b8;})[_0x1a9b('0x23')](respondWithFilteredResult(_0x5d7e8c,_0x3f8e98))[_0x1a9b('0x40')](handleError(_0x5d7e8c,null));};exports[_0x1a9b('0x41')]=function(_0x1decb8,_0xb4cbf4){var _0x398db3={'raw':!![],'where':{'id':_0x1decb8[_0x1a9b('0x42')]['id']}},_0x35f6d8={};_0x35f6d8[_0x1a9b('0x2e')]=_[_0x1a9b('0x30')](db[_0x1a9b('0x2a')][_0x1a9b('0x2b')]);_0x35f6d8[_0x1a9b('0x2f')]=_[_0x1a9b('0x30')](_0x1decb8['query']);_0x35f6d8[_0x1a9b('0x31')]=_[_0x1a9b('0x32')](_0x35f6d8['model'],_0x35f6d8[_0x1a9b('0x2f')]);_0x398db3['attributes']=_['intersection'](_0x35f6d8[_0x1a9b('0x2e')],qs[_0x1a9b('0x34')](_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x34')]));_0x398db3[_0x1a9b('0x33')]=_0x398db3[_0x1a9b('0x33')][_0x1a9b('0x43')]?_0x398db3['attributes']:_0x35f6d8[_0x1a9b('0x2e')];if(_0x1decb8[_0x1a9b('0x2f')][_0x1a9b('0x3c')]){_0x398db3[_0x1a9b('0x3d')]=[{'all':!![]}];}_0x398db3=_['merge']({},_0x398db3,_0x1decb8[_0x1a9b('0x44')]);return db[_0x1a9b('0x2a')][_0x1a9b('0x45')](_0x398db3)[_0x1a9b('0x23')](handleEntityNotFound(_0xb4cbf4,null))['then'](respondWithResult(_0xb4cbf4,null))[_0x1a9b('0x40')](handleError(_0xb4cbf4,null));};exports[_0x1a9b('0x46')]=function(_0x41e9fc,_0x1e93df){return db[_0x1a9b('0x2a')]['create'](_0x41e9fc['body'],{})[_0x1a9b('0x23')](respondWithResult(_0x1e93df,0xc9))[_0x1a9b('0x40')](handleError(_0x1e93df,null));};exports['update']=function(_0x52b06e,_0x252140){if(_0x52b06e[_0x1a9b('0x47')]['id']){delete _0x52b06e[_0x1a9b('0x47')]['id'];}return db['Cdr'][_0x1a9b('0x45')]({'where':{'id':_0x52b06e[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x252140,null))[_0x1a9b('0x23')](saveUpdates(_0x52b06e[_0x1a9b('0x47')],null))[_0x1a9b('0x23')](respondWithResult(_0x252140,null))[_0x1a9b('0x40')](handleError(_0x252140,null));};exports['destroy']=function(_0x54b9ac,_0x5465d0){return db[_0x1a9b('0x2a')][_0x1a9b('0x45')]({'where':{'id':_0x54b9ac[_0x1a9b('0x42')]['id']}})[_0x1a9b('0x23')](handleEntityNotFound(_0x5465d0,null))[_0x1a9b('0x23')](removeEntity(_0x5465d0,null))['catch'](handleError(_0x5465d0,null));};exports[_0x1a9b('0x48')]=function(_0x222bba,_0x3b1fdf){return db[_0x1a9b('0x2a')][_0x1a9b('0x48')]()[_0x1a9b('0x23')](respondWithResult(_0x3b1fdf,null))[_0x1a9b('0x40')](handleError(_0x3b1fdf,null));}; \ No newline at end of file +var _0xac9d=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac9d,0x14d));var _0xdac9=function(_0x1feefe,_0x2018ad){_0x1feefe=_0x1feefe-0x0;var _0x56471a=_0xac9d[_0x1feefe];return _0x56471a;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b'));_0x3eed7a[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x170afd[_0xdac9('0x34')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a[_0xdac9('0x34')]);_0x4c4e21[_0xdac9('0x38')]=_['intersection'](_0x3eed7a['model'],qs[_0xdac9('0x39')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x39')]));_0x4c4e21[_0xdac9('0x38')]=_0x4c4e21[_0xdac9('0x38')]['length']?_0x4c4e21[_0xdac9('0x38')]:_0x3eed7a['model'];if(!_0x170afd[_0xdac9('0x34')][_0xdac9('0x3a')]('nolimit')){_0x4c4e21[_0xdac9('0x20')]=qs['limit'](_0x170afd['query'][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x1e')]);}_0x4c4e21[_0xdac9('0x3b')]=qs['sort'](_0x170afd[_0xdac9('0x34')][_0xdac9('0x3c')]);_0x4c4e21['where']=qs[_0xdac9('0x36')](_[_0xdac9('0x3d')](_0x170afd[_0xdac9('0x34')],_0x3eed7a[_0xdac9('0x36')]),_0x13efba);if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x3e')]){_0x4c4e21[_0xdac9('0x3f')]=_['merge'](_0x4c4e21[_0xdac9('0x3f')],{'$or':_[_0xdac9('0x2d')](_0x13efba,function(_0x238769){if(_0x238769['type']!==_0xdac9('0x40')){var _0x338e4a={};_0x338e4a[_0x238769[_0xdac9('0x2b')]]={'$like':'%'+_0x170afd[_0xdac9('0x34')]['filter']+'%'};return _0x338e4a;}})});}_0x4c4e21=_['merge']({},_0x4c4e21,_0x170afd[_0xdac9('0x41')]);var _0xe47a3c={'where':_0x4c4e21[_0xdac9('0x3f')]};return db[_0xdac9('0x2e')][_0xdac9('0x21')](_0xe47a3c)['then'](function(_0x8435e8){_0x3505c5['count']=_0x8435e8;if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x42')]){_0x4c4e21[_0xdac9('0x43')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x44')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x413fb1){_0x3505c5[_0xdac9('0x45')]=_0x413fb1;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x46')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x47')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x48')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x33')]=_['keys'](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x5335ae[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x24b570[_0xdac9('0x34')]);_0x5335ae[_0xdac9('0x36')]=_['intersection'](_0x5335ae[_0xdac9('0x33')],_0x5335ae['query']);_0x441676[_0xdac9('0x38')]=_[_0xdac9('0x37')](_0x5335ae[_0xdac9('0x33')],qs[_0xdac9('0x39')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x38')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x33')];if(_0x24b570[_0xdac9('0x34')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x49')]({},_0x441676,_0x24b570[_0xdac9('0x41')]);return db[_0xdac9('0x2e')][_0xdac9('0x4a')](_0x441676)[_0xdac9('0x26')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x26')](respondWithResult(_0x278826,null))[_0xdac9('0x46')](handleError(_0x278826,null));};exports[_0xdac9('0x4b')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x2e')][_0xdac9('0x4b')](_0x5c008b[_0xdac9('0x4c')],{})[_0xdac9('0x26')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x46')](handleError(_0x621cf,null));};exports[_0xdac9('0x25')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x4c')]['id']){delete _0x37b498[_0xdac9('0x4c')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4a')]({'where':{'id':_0x37b498[_0xdac9('0x48')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x26')](respondWithResult(_0x140dc5,null))[_0xdac9('0x46')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x2e')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x48')]['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x4d')]=function(_0x4469d8,_0x222de9){return db[_0xdac9('0x2e')][_0xdac9('0x4d')]()[_0xdac9('0x26')](respondWithResult(_0x222de9,null))[_0xdac9('0x46')](handleError(_0x222de9,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2d94f07..ca2ba40 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x30d065,_0x538346){var _0x52bd72=function(_0x4a25b0){while(--_0x4a25b0){_0x30d065['push'](_0x30d065['shift']());}};_0x52bd72(++_0x538346);}(_0x7a54,0x106));var _0x47a5=function(_0x2efb08,_0x2f0164){_0x2efb08=_0x2efb08-0x0;var _0x5eae74=_0x7a54[_0x2efb08];return _0x5eae74;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x372e7b,_0x37289d){var _0x36b1c2=function(_0x5033eb){while(--_0x5033eb){_0x372e7b['push'](_0x372e7b['shift']());}};_0x36b1c2(++_0x37289d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e32cc69..af396e8 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 _0xa388=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa388,0x1d0));var _0x8a38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa388[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a38('0x0'));var util=require(_0x8a38('0x1'));var moment=require('moment');var BPromise=require(_0x8a38('0x2'));var rs=require(_0x8a38('0x3'));var fs=require('fs');var Redis=require(_0x8a38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a38('0x5'));var logger=require(_0x8a38('0x6'))('rpc');var config=require(_0x8a38('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8a38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188f85,_0x1161bf,_0x3065d7){return new BPromise(function(_0xda76e7,_0x432a47){return client[_0x8a38('0x9')](_0x188f85,_0x3065d7)[_0x8a38('0xa')](function(_0x12f07f){logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x1161bf,_0x8a38('0xd'));logger[_0x8a38('0xe')](_0x8a38('0xf'),_0x1161bf,_0x8a38('0xd'),JSON['stringify'](_0x12f07f));if(_0x12f07f[_0x8a38('0x10')]){if(_0x12f07f[_0x8a38('0x10')][_0x8a38('0x11')]===0x1f4){logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);return _0x432a47(_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);}logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x12f07f[_0x8a38('0x10')][_0x8a38('0x12')]);return _0xda76e7(_0x12f07f['error'][_0x8a38('0x12')]);}else{logger[_0x8a38('0xb')](_0x8a38('0xc'),_0x1161bf,_0x8a38('0xd'));_0xda76e7(_0x12f07f[_0x8a38('0x13')][_0x8a38('0x12')]);}})[_0x8a38('0x14')](function(_0x338444){logger[_0x8a38('0x10')](_0x8a38('0xc'),_0x1161bf,_0x338444);_0x432a47(_0x338444);});});} \ No newline at end of file +var _0x9d14=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x194b44,_0x1bf886){var _0x4b93dc=function(_0x3d0e9a){while(--_0x3d0e9a){_0x194b44['push'](_0x194b44['shift']());}};_0x4b93dc(++_0x1bf886);}(_0x9d14,0x1e8));var _0x49d1=function(_0x10b8e5,_0x395072){_0x10b8e5=_0x10b8e5-0x0;var _0x37d55b=_0x9d14[_0x10b8e5];return _0x37d55b;};'use strict';var _=require(_0x49d1('0x0'));var util=require(_0x49d1('0x1'));var moment=require(_0x49d1('0x2'));var BPromise=require(_0x49d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49d1('0x6'));var jayson=require(_0x49d1('0x7'));var client=jayson['client'][_0x49d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5054d6,_0x5052e3,_0x54f128){return new BPromise(function(_0x143169,_0x22a16e){return client[_0x49d1('0x9')](_0x5054d6,_0x54f128)[_0x49d1('0xa')](function(_0x5a6afa){logger['info'](_0x49d1('0xb'),_0x5052e3,_0x49d1('0xc'));logger[_0x49d1('0xd')](_0x49d1('0xe'),_0x5052e3,_0x49d1('0xc'),JSON[_0x49d1('0xf')](_0x5a6afa));if(_0x5a6afa[_0x49d1('0x10')]){if(_0x5a6afa[_0x49d1('0x10')][_0x49d1('0x11')]===0x1f4){logger[_0x49d1('0x10')](_0x49d1('0xb'),_0x5052e3,_0x5a6afa[_0x49d1('0x10')][_0x49d1('0x12')]);return _0x22a16e(_0x5a6afa['error'][_0x49d1('0x12')]);}logger['error'](_0x49d1('0xb'),_0x5052e3,_0x5a6afa[_0x49d1('0x10')][_0x49d1('0x12')]);return _0x143169(_0x5a6afa[_0x49d1('0x10')][_0x49d1('0x12')]);}else{logger[_0x49d1('0x13')]('Cdr,\x20%s,\x20%s',_0x5052e3,_0x49d1('0xc'));_0x143169(_0x5a6afa[_0x49d1('0x14')][_0x49d1('0x12')]);}})[_0x49d1('0x15')](function(_0x394227){logger[_0x49d1('0x10')](_0x49d1('0xb'),_0x5052e3,_0x394227);_0x22a16e(_0x394227);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 9311fde..0d9a873 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(_0x42e98c,_0x1c6bb9){var _0x59803e=function(_0x3a587e){while(--_0x3a587e){_0x42e98c['push'](_0x42e98c['shift']());}};_0x59803e(++_0x1c6bb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 fbeb1e0..cda7917 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 _0x76ca=['sequelize','exports','STRING','noop','TEXT'];(function(_0x2ade6f,_0x18d576){var _0x28fa0f=function(_0x4ad67c){while(--_0x4ad67c){_0x2ade6f['push'](_0x2ade6f['shift']());}};_0x28fa0f(++_0x18d576);}(_0x76ca,0xcd));var _0xa76c=function(_0x3c9be5,_0x3b5e36){_0x3c9be5=_0x3c9be5-0x0;var _0x467cca=_0x76ca[_0x3c9be5];return _0x467cca;};'use strict';var Sequelize=require(_0xa76c('0x0'));module[_0xa76c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa76c('0x2')],'allowNull':![],'defaultValue':_0xa76c('0x3')},'appdata':{'type':Sequelize[_0xa76c('0x4')]()},'description':{'type':Sequelize[_0xa76c('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x349a=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x349a,0x17f));var _0xa349=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x349a[_0x1ae4a9];return _0x54d0b0;};'use strict';var Sequelize=require(_0xa349('0x0'));module[_0xa349('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa349('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa349('0x3')]()},'description':{'type':Sequelize[_0xa349('0x2')]},'interval':{'type':Sequelize[_0xa349('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 fbc320e..8fe9ab4 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 _0xe3ed=['Content-Range','apply','reject','save','then','destroy','error','stack','name','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set'];(function(_0x2b98cc,_0x512e0e){var _0x97b31f=function(_0x1af0d2){while(--_0x1af0d2){_0x2b98cc['push'](_0x2b98cc['shift']());}};_0x97b31f(++_0x512e0e);}(_0xe3ed,0x8d));var _0xde3e=function(_0x20eeb5,_0x5dbaaa){_0x20eeb5=_0x20eeb5-0x0;var _0x1e3e86=_0xe3ed[_0x20eeb5];return _0x1e3e86;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];function respondWithStatusCode(_0x5d0240,_0x22ffc2){_0x22ffc2=_0x22ffc2||0xcc;return function(_0x4e0f23){if(_0x4e0f23){return _0x5d0240[_0xde3e('0x1a')](_0x22ffc2);}return _0x5d0240[_0xde3e('0x1b')](_0x22ffc2)[_0xde3e('0x1c')]();};}function respondWithResult(_0x4fe882,_0x167fa7){_0x167fa7=_0x167fa7||0xc8;return function(_0x1fee7b){if(_0x1fee7b){return _0x4fe882['status'](_0x167fa7)['json'](_0x1fee7b);}};}function respondWithFilteredResult(_0x120077,_0x11db96){return function(_0x6543f7){if(_0x6543f7){var _0x552fc4=typeof _0x11db96['offset']===_0xde3e('0x1d')&&typeof _0x11db96['limit']==='undefined';var _0xc3ee05=_0x6543f7[_0xde3e('0x1e')];var _0x4aa02c=_0x552fc4?0x0:_0x11db96[_0xde3e('0x1f')];var _0x276e83=_0x552fc4?_0x6543f7[_0xde3e('0x1e')]:_0x11db96['offset']+_0x11db96['limit'];var _0x4fa0d2;if(_0x276e83>=_0xc3ee05){_0x276e83=_0xc3ee05;_0x4fa0d2=0xc8;}else{_0x4fa0d2=0xce;}_0x120077[_0xde3e('0x1b')](_0x4fa0d2);return _0x120077[_0xde3e('0x20')](_0xde3e('0x21'),_0x4aa02c+'-'+_0x276e83+'/'+_0xc3ee05)['json'](_0x6543f7);}return null;};}function patchUpdates(_0x2ceb3e){return function(_0x11dd22){try{jsonpatch[_0xde3e('0x22')](_0x11dd22,_0x2ceb3e,!![]);}catch(_0x8c8ace){return BPromise[_0xde3e('0x23')](_0x8c8ace);}return _0x11dd22[_0xde3e('0x24')]();};}function saveUpdates(_0x26c5ca,_0x1eda88){return function(_0x443e8d){if(_0x443e8d){return _0x443e8d['update'](_0x26c5ca)[_0xde3e('0x25')](function(_0x334093){return _0x334093;});}return null;};}function removeEntity(_0x37615f,_0x57df9e){return function(_0x361511){if(_0x361511){return _0x361511[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){_0x37615f['status'](0xcc)[_0xde3e('0x1c')]();});}};}function handleEntityNotFound(_0x78647,_0x1d9432){return function(_0xd795ac){if(!_0xd795ac){_0x78647[_0xde3e('0x1a')](0x194);}return _0xd795ac;};}function handleError(_0x5ec4b6,_0x5313cb){_0x5313cb=_0x5313cb||0x1f4;return function(_0x6c0db0){logger[_0xde3e('0x27')](_0x6c0db0[_0xde3e('0x28')]);if(_0x6c0db0['name']){delete _0x6c0db0[_0xde3e('0x29')];}_0x5ec4b6[_0xde3e('0x1b')](_0x5313cb)['send'](_0x6c0db0);};}exports['show']=function(_0x245fbc,_0x3c83c8){var _0x582c8d={'raw':!![],'where':{'id':_0x245fbc[_0xde3e('0x2a')]['id']}},_0x2e4c62={};_0x2e4c62[_0xde3e('0x2b')]=_['keys'](db['ChatApplication'][_0xde3e('0x2c')]);_0x2e4c62['query']=_['keys'](_0x245fbc[_0xde3e('0x2d')]);_0x2e4c62[_0xde3e('0x2e')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],_0x2e4c62[_0xde3e('0x2d')]);_0x582c8d[_0xde3e('0x30')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],qs[_0xde3e('0x31')](_0x245fbc[_0xde3e('0x2d')][_0xde3e('0x31')]));_0x582c8d[_0xde3e('0x30')]=_0x582c8d[_0xde3e('0x30')][_0xde3e('0x32')]?_0x582c8d[_0xde3e('0x30')]:_0x2e4c62[_0xde3e('0x2b')];if(_0x245fbc[_0xde3e('0x2d')]['includeAll']){_0x582c8d[_0xde3e('0x33')]=[{'all':!![]}];}_0x582c8d=_[_0xde3e('0x34')]({},_0x582c8d,_0x245fbc[_0xde3e('0x35')]);return db[_0xde3e('0x36')][_0xde3e('0x37')](_0x582c8d)[_0xde3e('0x25')](handleEntityNotFound(_0x3c83c8,null))[_0xde3e('0x25')](respondWithResult(_0x3c83c8,null))[_0xde3e('0x38')](handleError(_0x3c83c8,null));};exports['update']=function(_0x50f1e3,_0x47793d){if(_0x50f1e3['body']['id']){delete _0x50f1e3['body']['id'];}return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x50f1e3[_0xde3e('0x2a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x47793d,null))[_0xde3e('0x25')](saveUpdates(_0x50f1e3[_0xde3e('0x39')],null))['then'](respondWithResult(_0x47793d,null))['catch'](handleError(_0x47793d,null));};exports[_0xde3e('0x26')]=function(_0x24adee,_0x1ade0c){return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x24adee[_0xde3e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1ade0c,null))[_0xde3e('0x25')](removeEntity(_0x1ade0c,null))['catch'](handleError(_0x1ade0c,null));}; \ No newline at end of file +var _0x7daf=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','find','update','params','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4491d9,_0x5856ec){var _0x3e9dba=function(_0x2a6302){while(--_0x2a6302){_0x4491d9['push'](_0x4491d9['shift']());}};_0x3e9dba(++_0x5856ec);}(_0x7daf,0xaa));var _0xf7da=function(_0x331e28,_0x163e3c){_0x331e28=_0x331e28-0x0;var _0x42abb8=_0x7daf[_0x331e28];return _0x42abb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7da('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7da('0x1'));var rp=require(_0xf7da('0x2'));var moment=require('moment');var BPromise=require(_0xf7da('0x3'));var Mustache=require(_0xf7da('0x4'));var util=require(_0xf7da('0x5'));var path=require(_0xf7da('0x6'));var sox=require(_0xf7da('0x7'));var csv=require('to-csv');var ejs=require(_0xf7da('0x8'));var fs=require('fs');var fs_extra=require(_0xf7da('0x9'));var _=require(_0xf7da('0xa'));var squel=require(_0xf7da('0xb'));var crypto=require(_0xf7da('0xc'));var jsforce=require(_0xf7da('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf7da('0xe'));var querystring=require(_0xf7da('0xf'));var Papa=require(_0xf7da('0x10'));var Redis=require(_0xf7da('0x11'));var authService=require(_0xf7da('0x12'));var qs=require(_0xf7da('0x13'));var as=require(_0xf7da('0x14'));var hardwareService=require(_0xf7da('0x15'));var logger=require(_0xf7da('0x16'))(_0xf7da('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf7da('0x18'));var db=require(_0xf7da('0x19'))['db'];function respondWithStatusCode(_0x2a5afc,_0x392244){_0x392244=_0x392244||0xcc;return function(_0x2da6bd){if(_0x2da6bd){return _0x2a5afc[_0xf7da('0x1a')](_0x392244);}return _0x2a5afc['status'](_0x392244)[_0xf7da('0x1b')]();};}function respondWithResult(_0x61af71,_0x5bfc67){_0x5bfc67=_0x5bfc67||0xc8;return function(_0x1958dd){if(_0x1958dd){return _0x61af71[_0xf7da('0x1c')](_0x5bfc67)[_0xf7da('0x1d')](_0x1958dd);}};}function respondWithFilteredResult(_0x37d3f7,_0xe82d40){return function(_0x26f112){if(_0x26f112){var _0x4f5afa=typeof _0xe82d40['offset']==='undefined'&&typeof _0xe82d40[_0xf7da('0x1e')]===_0xf7da('0x1f');var _0x231d6e=_0x26f112[_0xf7da('0x20')];var _0x336fca=_0x4f5afa?0x0:_0xe82d40[_0xf7da('0x21')];var _0xb75a2c=_0x4f5afa?_0x26f112[_0xf7da('0x20')]:_0xe82d40[_0xf7da('0x21')]+_0xe82d40[_0xf7da('0x1e')];var _0x303459;if(_0xb75a2c>=_0x231d6e){_0xb75a2c=_0x231d6e;_0x303459=0xc8;}else{_0x303459=0xce;}_0x37d3f7[_0xf7da('0x1c')](_0x303459);return _0x37d3f7[_0xf7da('0x22')](_0xf7da('0x23'),_0x336fca+'-'+_0xb75a2c+'/'+_0x231d6e)['json'](_0x26f112);}return null;};}function patchUpdates(_0x3f5f58){return function(_0x3b0913){try{jsonpatch[_0xf7da('0x24')](_0x3b0913,_0x3f5f58,!![]);}catch(_0xa43acc){return BPromise[_0xf7da('0x25')](_0xa43acc);}return _0x3b0913[_0xf7da('0x26')]();};}function saveUpdates(_0x119f49,_0x35ac94){return function(_0x3affce){if(_0x3affce){return _0x3affce['update'](_0x119f49)[_0xf7da('0x27')](function(_0x1b68d3){return _0x1b68d3;});}return null;};}function removeEntity(_0x265192,_0x4b627e){return function(_0x3bf5d1){if(_0x3bf5d1){return _0x3bf5d1[_0xf7da('0x28')]()[_0xf7da('0x27')](function(){_0x265192[_0xf7da('0x1c')](0xcc)[_0xf7da('0x1b')]();});}};}function handleEntityNotFound(_0x9d2da,_0x5a9866){return function(_0x1aadd8){if(!_0x1aadd8){_0x9d2da[_0xf7da('0x1a')](0x194);}return _0x1aadd8;};}function handleError(_0x474aa4,_0x583bfc){_0x583bfc=_0x583bfc||0x1f4;return function(_0x13ace4){logger[_0xf7da('0x29')](_0x13ace4[_0xf7da('0x2a')]);if(_0x13ace4[_0xf7da('0x2b')]){delete _0x13ace4[_0xf7da('0x2b')];}_0x474aa4['status'](_0x583bfc)[_0xf7da('0x2c')](_0x13ace4);};}exports['show']=function(_0x258c74,_0xdaef0d){var _0x1dfcc5={'raw':!![],'where':{'id':_0x258c74['params']['id']}},_0x23a27e={};_0x23a27e[_0xf7da('0x2d')]=_[_0xf7da('0x2e')](db[_0xf7da('0x2f')][_0xf7da('0x30')]);_0x23a27e[_0xf7da('0x31')]=_[_0xf7da('0x2e')](_0x258c74[_0xf7da('0x31')]);_0x23a27e[_0xf7da('0x32')]=_['intersection'](_0x23a27e[_0xf7da('0x2d')],_0x23a27e[_0xf7da('0x31')]);_0x1dfcc5[_0xf7da('0x33')]=_[_0xf7da('0x34')](_0x23a27e[_0xf7da('0x2d')],qs['fields'](_0x258c74[_0xf7da('0x31')][_0xf7da('0x35')]));_0x1dfcc5['attributes']=_0x1dfcc5[_0xf7da('0x33')]['length']?_0x1dfcc5[_0xf7da('0x33')]:_0x23a27e[_0xf7da('0x2d')];if(_0x258c74[_0xf7da('0x31')][_0xf7da('0x36')]){_0x1dfcc5[_0xf7da('0x37')]=[{'all':!![]}];}_0x1dfcc5=_[_0xf7da('0x38')]({},_0x1dfcc5,_0x258c74['options']);return db[_0xf7da('0x2f')][_0xf7da('0x39')](_0x1dfcc5)[_0xf7da('0x27')](handleEntityNotFound(_0xdaef0d,null))['then'](respondWithResult(_0xdaef0d,null))['catch'](handleError(_0xdaef0d,null));};exports[_0xf7da('0x3a')]=function(_0x4f5637,_0x4ec362){if(_0x4f5637['body']['id']){delete _0x4f5637['body']['id'];}return db[_0xf7da('0x2f')]['find']({'where':{'id':_0x4f5637[_0xf7da('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4ec362,null))[_0xf7da('0x27')](saveUpdates(_0x4f5637['body'],null))[_0xf7da('0x27')](respondWithResult(_0x4ec362,null))[_0xf7da('0x3c')](handleError(_0x4ec362,null));};exports[_0xf7da('0x28')]=function(_0x281fd4,_0x44f982){return db['ChatApplication'][_0xf7da('0x39')]({'where':{'id':_0x281fd4[_0xf7da('0x3b')]['id']}})[_0xf7da('0x27')](handleEntityNotFound(_0x44f982,null))[_0xf7da('0x27')](removeEntity(_0x44f982,null))[_0xf7da('0x3c')](handleError(_0x44f982,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c2bc56c..5bab0d5 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 _0xb38e=['api','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4_unicode_ci','util'];(function(_0x24a46c,_0x2f195d){var _0x1c7990=function(_0x1723ef){while(--_0x1723ef){_0x24a46c['push'](_0x24a46c['shift']());}};_0x1c7990(++_0x2f195d);}(_0xb38e,0x1d8));var _0xeb38=function(_0x3343c8,_0x39eaa9){_0x3343c8=_0x3343c8-0x0;var _0x2374db=_0xb38e[_0x3343c8];return _0x2374db;};'use strict';var _=require('lodash');var util=require(_0xeb38('0x0'));var logger=require('../../config/logger')(_0xeb38('0x1'));var moment=require('moment');var BPromise=require(_0xeb38('0x2'));var rp=require(_0xeb38('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb38('0x4'));var config=require(_0xeb38('0x5'));var attributes=require(_0xeb38('0x6'));module[_0xeb38('0x7')]=function(_0x5238d1,_0x40f090){return _0x5238d1[_0xeb38('0x8')](_0xeb38('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xeb38('0xa')});}; \ No newline at end of file +var _0xe489=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','./chatApplication.attributes','define','ChatApplication'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe489,0x9e));var _0x9e48=function(_0x33b669,_0x451958){_0x33b669=_0x33b669-0x0;var _0x3d13d0=_0xe489[_0x33b669];return _0x3d13d0;};'use strict';var _=require(_0x9e48('0x0'));var util=require(_0x9e48('0x1'));var logger=require('../../config/logger')(_0x9e48('0x2'));var moment=require(_0x9e48('0x3'));var BPromise=require(_0x9e48('0x4'));var rp=require(_0x9e48('0x5'));var fs=require('fs');var path=require(_0x9e48('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e48('0x7'));module['exports']=function(_0x9b6c19,_0x42747f){return _0x9b6c19[_0x9e48('0x8')](_0x9e48('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9e48('0xa'),'collate':_0x9e48('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 333c65b..176e3e9 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 _0x8e34=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x7874e7,_0x2c4b42){var _0x29db49=function(_0x493b72){while(--_0x493b72){_0x7874e7['push'](_0x7874e7['shift']());}};_0x29db49(++_0x2c4b42);}(_0x8e34,0x73));var _0x48e3=function(_0x12322a,_0x5f99ae){_0x12322a=_0x12322a-0x0;var _0x25bc57=_0x8e34[_0x12322a];return _0x25bc57;};'use strict';var _=require(_0x48e3('0x0'));var util=require(_0x48e3('0x1'));var moment=require(_0x48e3('0x2'));var BPromise=require(_0x48e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e3('0x4'));var db=require(_0x48e3('0x5'))['db'];var utils=require(_0x48e3('0x6'));var logger=require(_0x48e3('0x7'))(_0x48e3('0x8'));var config=require(_0x48e3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x48e3('0xa')][_0x48e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe78a,_0x152a16,_0x5cd6af){return new BPromise(function(_0x149111,_0x49f7e5){return client[_0x48e3('0xc')](_0xe78a,_0x5cd6af)['then'](function(_0x598a24){logger[_0x48e3('0xd')](_0x48e3('0xe'),_0x152a16,_0x48e3('0xf'));logger[_0x48e3('0x10')](_0x48e3('0x11'),_0x152a16,_0x48e3('0xf'),JSON[_0x48e3('0x12')](_0x598a24));if(_0x598a24[_0x48e3('0x13')]){if(_0x598a24['error']['code']===0x1f4){logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);return _0x49f7e5(_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);}logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x598a24[_0x48e3('0x13')]['message']);return _0x149111(_0x598a24[_0x48e3('0x13')][_0x48e3('0x14')]);}else{logger[_0x48e3('0xd')]('ChatApplication,\x20%s,\x20%s',_0x152a16,_0x48e3('0xf'));_0x149111(_0x598a24[_0x48e3('0x15')][_0x48e3('0x14')]);}})[_0x48e3('0x16')](function(_0x5a8dc5){logger[_0x48e3('0x13')](_0x48e3('0xe'),_0x152a16,_0x5a8dc5);_0x49f7e5(_0x5a8dc5);});});} \ No newline at end of file +var _0xaf21=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','ChatApplication,\x20%s,\x20%s','request\x20sent'];(function(_0xed0012,_0x2d512a){var _0x511415=function(_0x45e806){while(--_0x45e806){_0xed0012['push'](_0xed0012['shift']());}};_0x511415(++_0x2d512a);}(_0xaf21,0x16e));var _0x1af2=function(_0x550e3b,_0x40a6b4){_0x550e3b=_0x550e3b-0x0;var _0x473a74=_0xaf21[_0x550e3b];return _0x473a74;};'use strict';var _=require(_0x1af2('0x0'));var util=require(_0x1af2('0x1'));var moment=require(_0x1af2('0x2'));var BPromise=require(_0x1af2('0x3'));var rs=require(_0x1af2('0x4'));var fs=require('fs');var Redis=require(_0x1af2('0x5'));var db=require(_0x1af2('0x6'))['db'];var utils=require(_0x1af2('0x7'));var logger=require(_0x1af2('0x8'))(_0x1af2('0x9'));var config=require(_0x1af2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1af2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55b545,_0xbc9b01,_0x5b0607){return new BPromise(function(_0x37c59d,_0x52a5bf){return client['request'](_0x55b545,_0x5b0607)['then'](function(_0x5c12ba){logger['info'](_0x1af2('0xc'),_0xbc9b01,_0x1af2('0xd'));logger[_0x1af2('0xe')](_0x1af2('0xf'),_0xbc9b01,_0x1af2('0xd'),JSON['stringify'](_0x5c12ba));if(_0x5c12ba[_0x1af2('0x10')]){if(_0x5c12ba[_0x1af2('0x10')][_0x1af2('0x11')]===0x1f4){logger[_0x1af2('0x10')]('ChatApplication,\x20%s,\x20%s',_0xbc9b01,_0x5c12ba[_0x1af2('0x10')][_0x1af2('0x12')]);return _0x52a5bf(_0x5c12ba[_0x1af2('0x10')][_0x1af2('0x12')]);}logger[_0x1af2('0x10')]('ChatApplication,\x20%s,\x20%s',_0xbc9b01,_0x5c12ba[_0x1af2('0x10')][_0x1af2('0x12')]);return _0x37c59d(_0x5c12ba[_0x1af2('0x10')]['message']);}else{logger['info'](_0x1af2('0xc'),_0xbc9b01,'request\x20sent');_0x37c59d(_0x5c12ba['result'][_0x1af2('0x12')]);}})[_0x1af2('0x13')](function(_0x2330ad){logger[_0x1af2('0x10')]('ChatApplication,\x20%s,\x20%s',_0xbc9b01,_0x2330ad);_0x52a5bf(_0x2330ad);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index c649af2..58fb994 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 _0x96f4=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0x96f4,0x15e));var _0x496f=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x96f4[_0x57cc22];return _0x6f7bdc;};'use strict';var multer=require('multer');var util=require(_0x496f('0x0'));var path=require(_0x496f('0x1'));var timeout=require(_0x496f('0x2'));var express=require('express');var router=express[_0x496f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x496f('0x4'));var interaction=require(_0x496f('0x5'));var config=require(_0x496f('0x6'));var controller=require(_0x496f('0x7'));router[_0x496f('0x8')](_0x496f('0x9'),auth[_0x496f('0xa')](),controller[_0x496f('0xb')]);router[_0x496f('0xc')](_0x496f('0x9'),auth[_0x496f('0xa')](),controller[_0x496f('0xd')]);router[_0x496f('0xe')]('/:id',auth[_0x496f('0xa')](),controller[_0x496f('0xf')]);module[_0x496f('0x10')]=router; \ No newline at end of file +var _0x7c0a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','path','connect-timeout','express'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x7c0a,0x1ed));var _0xa7c0=function(_0x4560a1,_0x4bab97){_0x4560a1=_0x4560a1-0x0;var _0x4bab23=_0x7c0a[_0x4560a1];return _0x4bab23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7c0('0x0'));var timeout=require(_0xa7c0('0x1'));var express=require(_0xa7c0('0x2'));var router=express[_0xa7c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa7c0('0x4'));var interaction=require(_0xa7c0('0x5'));var config=require(_0xa7c0('0x6'));var controller=require(_0xa7c0('0x7'));router[_0xa7c0('0x8')](_0xa7c0('0x9'),auth[_0xa7c0('0xa')](),controller[_0xa7c0('0xb')]);router[_0xa7c0('0xc')](_0xa7c0('0x9'),auth[_0xa7c0('0xa')](),controller['update']);router[_0xa7c0('0xd')](_0xa7c0('0x9'),auth[_0xa7c0('0xa')](),controller[_0xa7c0('0xe')]);module[_0xa7c0('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index bf58860..f72d840 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 _0xf494=['STRING','BOOLEAN','sequelize','exports'];(function(_0x8d9185,_0xbc4093){var _0x40c6f5=function(_0x6519a8){while(--_0x6519a8){_0x8d9185['push'](_0x8d9185['shift']());}};_0x40c6f5(++_0xbc4093);}(_0xf494,0x1c6));var _0x4f49=function(_0x54dc07,_0x1c0445){_0x54dc07=_0x54dc07-0x0;var _0x3bbd21=_0xf494[_0x54dc07];return _0x3bbd21;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x4f49('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1a3b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2120f1,_0x5a524c){var _0x2e7ebb=function(_0xb59ff4){while(--_0xb59ff4){_0x2120f1['push'](_0x2120f1['shift']());}};_0x2e7ebb(++_0x5a524c);}(_0x1a3b,0x83));var _0xb1a3=function(_0x4f6148,_0x21bb49){_0x4f6148=_0x4f6148-0x0;var _0x5920f3=_0x1a3b[_0x4f6148];return _0x5920f3;};'use strict';var Sequelize=require(_0xb1a3('0x0'));module[_0xb1a3('0x1')]={'name':{'type':Sequelize[_0xb1a3('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb1a3('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index ae061f3..3dc9702 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 _0x7169=['ChatGroup','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','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','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send'];(function(_0x4d93cd,_0x3dcf49){var _0x71b7f8=function(_0x4da677){while(--_0x4da677){_0x4d93cd['push'](_0x4d93cd['shift']());}};_0x71b7f8(++_0x3dcf49);}(_0x7169,0x92));var _0x9716=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7169[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require(_0x9716('0x0'));var rimraf=require(_0x9716('0x1'));var zipdir=require(_0x9716('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9716('0x3'));var moment=require(_0x9716('0x4'));var BPromise=require(_0x9716('0x5'));var Mustache=require(_0x9716('0x6'));var util=require('util');var path=require(_0x9716('0x7'));var sox=require('sox');var csv=require(_0x9716('0x8'));var ejs=require(_0x9716('0x9'));var fs=require('fs');var fs_extra=require(_0x9716('0xa'));var _=require(_0x9716('0xb'));var squel=require(_0x9716('0xc'));var crypto=require(_0x9716('0xd'));var jsforce=require(_0x9716('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9716('0x8'));var querystring=require(_0x9716('0xf'));var Papa=require('papaparse');var Redis=require(_0x9716('0x10'));var authService=require(_0x9716('0x11'));var qs=require(_0x9716('0x12'));var as=require(_0x9716('0x13'));var hardwareService=require(_0x9716('0x14'));var logger=require('../../config/logger')(_0x9716('0x15'));var utils=require(_0x9716('0x16'));var config=require(_0x9716('0x17'));var licenseUtil=require(_0x9716('0x18'));var db=require(_0x9716('0x19'))['db'];config[_0x9716('0x1a')]=_['defaults'](config['redis'],{'host':_0x9716('0x1b'),'port':0x18eb});var socket=require(_0x9716('0x1c'))(new Redis(config[_0x9716('0x1a')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x3237cb,_0x4618dc){_0x4618dc=_0x4618dc||0xcc;return function(_0x21b2f5){if(_0x21b2f5){return _0x3237cb['sendStatus'](_0x4618dc);}return _0x3237cb['status'](_0x4618dc)[_0x9716('0x1d')]();};}function respondWithResult(_0x1639af,_0x11f94c){_0x11f94c=_0x11f94c||0xc8;return function(_0x514abb){if(_0x514abb){return _0x1639af[_0x9716('0x1e')](_0x11f94c)[_0x9716('0x1f')](_0x514abb);}};}function respondWithFilteredResult(_0x4c0585,_0x35fd0a){return function(_0x4d9b68){if(_0x4d9b68){var _0x47cf32=typeof _0x35fd0a[_0x9716('0x20')]===_0x9716('0x21')&&typeof _0x35fd0a[_0x9716('0x22')]==='undefined';var _0x243ebd=_0x4d9b68[_0x9716('0x23')];var _0x31fed7=_0x47cf32?0x0:_0x35fd0a[_0x9716('0x20')];var _0x30c3f1=_0x47cf32?_0x4d9b68[_0x9716('0x23')]:_0x35fd0a[_0x9716('0x20')]+_0x35fd0a[_0x9716('0x22')];var _0x39e8ee;if(_0x30c3f1>=_0x243ebd){_0x30c3f1=_0x243ebd;_0x39e8ee=0xc8;}else{_0x39e8ee=0xce;}_0x4c0585[_0x9716('0x1e')](_0x39e8ee);return _0x4c0585[_0x9716('0x24')](_0x9716('0x25'),_0x31fed7+'-'+_0x30c3f1+'/'+_0x243ebd)[_0x9716('0x1f')](_0x4d9b68);}return null;};}function patchUpdates(_0x26e853){return function(_0x24a0a7){try{jsonpatch[_0x9716('0x26')](_0x24a0a7,_0x26e853,!![]);}catch(_0x5bb22b){return BPromise[_0x9716('0x27')](_0x5bb22b);}return _0x24a0a7[_0x9716('0x28')]();};}function saveUpdates(_0x407e56,_0x55568f){return function(_0x19fcc1){if(_0x19fcc1){return _0x19fcc1[_0x9716('0x29')](_0x407e56)['then'](function(_0x53acc2){return _0x53acc2;});}return null;};}function removeEntity(_0x2b36a6,_0x3280d0){return function(_0x3f8fcb){if(_0x3f8fcb){return _0x3f8fcb['destroy']()[_0x9716('0x2a')](function(){_0x2b36a6[_0x9716('0x1e')](0xcc)[_0x9716('0x1d')]();});}};}function handleEntityNotFound(_0x4507f0,_0x5cbe52){return function(_0x3768bc){if(!_0x3768bc){_0x4507f0[_0x9716('0x2b')](0x194);}return _0x3768bc;};}function handleError(_0x3295ae,_0x10bc33){_0x10bc33=_0x10bc33||0x1f4;return function(_0x3e2760){logger[_0x9716('0x2c')](_0x3e2760[_0x9716('0x2d')]);if(_0x3e2760[_0x9716('0x2e')]){delete _0x3e2760[_0x9716('0x2e')];}_0x3295ae[_0x9716('0x1e')](_0x10bc33)[_0x9716('0x2f')](_0x3e2760);};}exports['index']=function(_0x528e3e,_0x4a9196){var _0x13d1e2={},_0x397ba2={},_0x98d4b1={'count':0x0,'rows':[]};var _0x5ae329=_['map'](db[_0x9716('0x30')][_0x9716('0x31')],function(_0x921e04){return{'name':_0x921e04['fieldName'],'type':_0x921e04[_0x9716('0x32')][_0x9716('0x33')]};});_0x397ba2[_0x9716('0x34')]=_[_0x9716('0x35')](_0x5ae329,_0x9716('0x2e'));_0x397ba2[_0x9716('0x36')]=_[_0x9716('0x37')](_0x528e3e['query']);_0x397ba2[_0x9716('0x38')]=_[_0x9716('0x39')](_0x397ba2[_0x9716('0x34')],_0x397ba2[_0x9716('0x36')]);_0x13d1e2[_0x9716('0x3a')]=_[_0x9716('0x39')](_0x397ba2[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x528e3e[_0x9716('0x36')][_0x9716('0x3b')]));_0x13d1e2['attributes']=_0x13d1e2['attributes'][_0x9716('0x3c')]?_0x13d1e2['attributes']:_0x397ba2[_0x9716('0x34')];if(!_0x528e3e[_0x9716('0x36')][_0x9716('0x3d')](_0x9716('0x3e'))){_0x13d1e2[_0x9716('0x22')]=qs[_0x9716('0x22')](_0x528e3e[_0x9716('0x36')][_0x9716('0x22')]);_0x13d1e2[_0x9716('0x20')]=qs[_0x9716('0x20')](_0x528e3e[_0x9716('0x36')][_0x9716('0x20')]);}_0x13d1e2[_0x9716('0x3f')]=qs['sort'](_0x528e3e[_0x9716('0x36')][_0x9716('0x40')]);_0x13d1e2[_0x9716('0x41')]=qs[_0x9716('0x38')](_[_0x9716('0x42')](_0x528e3e[_0x9716('0x36')],_0x397ba2[_0x9716('0x38')]),_0x5ae329);if(_0x528e3e[_0x9716('0x36')][_0x9716('0x43')]){_0x13d1e2['where']=_[_0x9716('0x44')](_0x13d1e2[_0x9716('0x41')],{'$or':_[_0x9716('0x35')](_0x5ae329,function(_0xd5a7b6){if(_0xd5a7b6[_0x9716('0x32')]!==_0x9716('0x45')){var _0x4670df={};_0x4670df[_0xd5a7b6['name']]={'$like':'%'+_0x528e3e[_0x9716('0x36')][_0x9716('0x43')]+'%'};return _0x4670df;}})});}_0x13d1e2=_[_0x9716('0x44')]({},_0x13d1e2,_0x528e3e[_0x9716('0x46')]);var _0x2278a3={'where':_0x13d1e2[_0x9716('0x41')]};return db[_0x9716('0x30')][_0x9716('0x23')](_0x2278a3)['then'](function(_0x45343d){_0x98d4b1[_0x9716('0x23')]=_0x45343d;if(_0x528e3e[_0x9716('0x36')]['includeAll']){_0x13d1e2[_0x9716('0x47')]=[{'all':!![]}];}return db['ChatGroup'][_0x9716('0x48')](_0x13d1e2);})[_0x9716('0x2a')](function(_0x4999cf){_0x98d4b1[_0x9716('0x49')]=_0x4999cf;return _0x98d4b1;})[_0x9716('0x2a')](respondWithFilteredResult(_0x4a9196,_0x13d1e2))[_0x9716('0x4a')](handleError(_0x4a9196,null));};exports['show']=function(_0x480de8,_0xc2edf7){var _0x253d3e={'raw':!![],'where':{'id':_0x480de8[_0x9716('0x4b')]['id']}},_0x140f1a={};_0x140f1a[_0x9716('0x34')]=_['keys'](db[_0x9716('0x30')][_0x9716('0x31')]);_0x140f1a['query']=_[_0x9716('0x37')](_0x480de8[_0x9716('0x36')]);_0x140f1a[_0x9716('0x38')]=_[_0x9716('0x39')](_0x140f1a['model'],_0x140f1a[_0x9716('0x36')]);_0x253d3e[_0x9716('0x3a')]=_['intersection'](_0x140f1a[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x480de8['query']['fields']));_0x253d3e[_0x9716('0x3a')]=_0x253d3e[_0x9716('0x3a')][_0x9716('0x3c')]?_0x253d3e[_0x9716('0x3a')]:_0x140f1a[_0x9716('0x34')];if(_0x480de8[_0x9716('0x36')][_0x9716('0x4c')]){_0x253d3e[_0x9716('0x47')]=[{'all':!![]}];}_0x253d3e=_[_0x9716('0x44')]({},_0x253d3e,_0x480de8[_0x9716('0x46')]);return db[_0x9716('0x30')][_0x9716('0x4d')](_0x253d3e)['then'](handleEntityNotFound(_0xc2edf7,null))[_0x9716('0x2a')](respondWithResult(_0xc2edf7,null))[_0x9716('0x4a')](handleError(_0xc2edf7,null));};exports['create']=function(_0x3b458a,_0x24a59a){return db[_0x9716('0x30')][_0x9716('0x4e')](_0x3b458a[_0x9716('0x4f')],{})[_0x9716('0x2a')](respondWithResult(_0x24a59a,0xc9))['catch'](handleError(_0x24a59a,null));};exports[_0x9716('0x29')]=function(_0x111922,_0x58be10){if(_0x111922[_0x9716('0x4f')]['id']){delete _0x111922[_0x9716('0x4f')]['id'];}return db[_0x9716('0x30')][_0x9716('0x4d')]({'where':{'id':_0x111922[_0x9716('0x4b')]['id']}})['then'](handleEntityNotFound(_0x58be10,null))[_0x9716('0x2a')](saveUpdates(_0x111922[_0x9716('0x4f')],null))['then'](respondWithResult(_0x58be10,null))[_0x9716('0x4a')](handleError(_0x58be10,null));};exports['destroy']=function(_0x26b18b,_0x2353e3){return db[_0x9716('0x30')]['find']({'where':{'id':_0x26b18b[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x2353e3,null))[_0x9716('0x2a')](removeEntity(_0x2353e3,null))[_0x9716('0x4a')](handleError(_0x2353e3,null));};exports[_0x9716('0x50')]=function(_0x3a12af,_0xf218f6){return db[_0x9716('0x30')][_0x9716('0x50')]()[_0x9716('0x2a')](respondWithResult(_0xf218f6,null))['catch'](handleError(_0xf218f6,null));};exports[_0x9716('0x51')]=function(_0x3a55ab,_0x57b258,_0x1da6e8){return db[_0x9716('0x52')]['count']({'where':{'ChatGroupId':_0x3a55ab[_0x9716('0x4b')]['id'],'ToId':_0x3a55ab['user']['id'],'read':![]}})[_0x9716('0x2a')](function(_0x52e2b7){return{'id':_[_0x9716('0x53')](_0x3a55ab[_0x9716('0x4b')]['id']),'count':_0x52e2b7};})[_0x9716('0x2a')](respondWithResult(_0x57b258,null))[_0x9716('0x4a')](handleError(_0x57b258,null));};exports[_0x9716('0x54')]=function(_0x28ee27,_0x5029d4,_0xcb82b4){return db[_0x9716('0x30')][_0x9716('0x4d')]({'where':{'id':_0x28ee27[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x5029d4,null))['then'](function(_0x280a55){if(_0x280a55){return _0x280a55[_0x9716('0x54')](_0x28ee27['body'][_0x9716('0x55')],_['omit'](_0x28ee27[_0x9716('0x4f')],[_0x9716('0x55'),'id'])||{});}})[_0x9716('0x2a')](respondWithResult(_0x5029d4,null))[_0x9716('0x4a')](handleError(_0x5029d4,null));};exports[_0x9716('0x56')]=function(_0x48b982,_0x5dc396,_0x2bbd10){var _0x1a8706={};var _0x33df3f={};var _0x2837a5;var _0x379e97;return db[_0x9716('0x30')][_0x9716('0x57')]({'where':{'id':_0x48b982[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x5dc396,null))[_0x9716('0x2a')](function(_0x3c8871){if(_0x3c8871){_0x2837a5=_0x3c8871;_0x33df3f[_0x9716('0x34')]=_[_0x9716('0x37')](db[_0x9716('0x58')][_0x9716('0x31')]);_0x33df3f['query']=_[_0x9716('0x37')](_0x48b982[_0x9716('0x36')]);_0x33df3f['filters']=_['intersection'](_0x33df3f[_0x9716('0x34')],_0x33df3f['query']);_0x1a8706[_0x9716('0x3a')]=_[_0x9716('0x39')](_0x33df3f[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x48b982[_0x9716('0x36')][_0x9716('0x3b')]));_0x1a8706[_0x9716('0x3a')]=_0x1a8706[_0x9716('0x3a')][_0x9716('0x3c')]?_0x1a8706[_0x9716('0x3a')]:_0x33df3f[_0x9716('0x34')];_0x1a8706[_0x9716('0x3f')]=qs[_0x9716('0x40')](_0x48b982[_0x9716('0x36')][_0x9716('0x40')]);_0x1a8706[_0x9716('0x41')]=qs[_0x9716('0x38')](_['pick'](_0x48b982[_0x9716('0x36')],_0x33df3f['filters']));if(_0x48b982[_0x9716('0x36')]['filter']){_0x1a8706['where']=_[_0x9716('0x44')](_0x1a8706[_0x9716('0x41')],{'$or':_[_0x9716('0x35')](_0x1a8706[_0x9716('0x3a')],function(_0x120d3a){var _0x1765a9={};_0x1765a9[_0x120d3a]={'$like':'%'+_0x48b982['query'][_0x9716('0x43')]+'%'};return _0x1765a9;})});}_0x1a8706=_['merge']({},_0x1a8706,_0x48b982['options']);return _0x2837a5[_0x9716('0x56')](_0x1a8706);}})[_0x9716('0x2a')](function(_0x285068){if(_0x285068){_0x379e97=_0x285068[_0x9716('0x3c')];if(!_0x48b982[_0x9716('0x36')][_0x9716('0x3d')](_0x9716('0x3e'))){_0x1a8706['limit']=qs[_0x9716('0x22')](_0x48b982[_0x9716('0x36')][_0x9716('0x22')]);_0x1a8706[_0x9716('0x20')]=qs['offset'](_0x48b982[_0x9716('0x36')][_0x9716('0x20')]);}return _0x2837a5[_0x9716('0x56')](_0x1a8706);}})[_0x9716('0x2a')](function(_0x4042b0){if(_0x4042b0){return _0x4042b0?{'count':_0x379e97,'rows':_0x4042b0}:null;}})[_0x9716('0x2a')](respondWithResult(_0x5dc396,null))['catch'](handleError(_0x5dc396,null));};exports[_0x9716('0x59')]=function(_0x4e0a2c,_0x10a430,_0x4a89ea){return db[_0x9716('0x30')]['find']({'where':{'id':_0x4e0a2c[_0x9716('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10a430,null))['then'](function(_0x34182c){if(_0x34182c){return _0x34182c[_0x9716('0x59')](_0x4e0a2c[_0x9716('0x36')][_0x9716('0x55')]);}})[_0x9716('0x2a')](respondWithStatusCode(_0x10a430,null))['catch'](handleError(_0x10a430,null));};exports[_0x9716('0x5a')]=function(_0x4bccf7,_0x24507f,_0x38d5ed){if(_0x4bccf7[_0x9716('0x4f')]['id']){delete _0x4bccf7[_0x9716('0x4f')]['id'];}return db['ChatGroup'][_0x9716('0x4d')]({'where':{'id':_0x4bccf7[_0x9716('0x4b')]['id']}})[_0x9716('0x2a')](handleEntityNotFound(_0x24507f,null))['then'](function(_0x34d2f1){if(_0x34d2f1){_0x4bccf7['body'][_0x9716('0x5b')]=_0x34d2f1['id'];return db[_0x9716('0x52')][_0x9716('0x4e')](_0x4bccf7[_0x9716('0x4f')]);}})[_0x9716('0x2a')](respondWithResult(_0x24507f,null))[_0x9716('0x4a')](handleError(_0x24507f,null));};exports[_0x9716('0x5c')]=function(_0x3c38aa,_0x52e50c,_0x55f544){var _0x5133fc={};var _0x568bf3={};var _0x392b5c;var _0x5e8c59;return db[_0x9716('0x30')][_0x9716('0x57')]({'where':{'id':_0x3c38aa['params']['id']}})['then'](handleEntityNotFound(_0x52e50c,null))[_0x9716('0x2a')](function(_0x32d56e){if(_0x32d56e){_0x392b5c=_0x32d56e;_0x568bf3[_0x9716('0x34')]=_[_0x9716('0x37')](db[_0x9716('0x52')][_0x9716('0x31')]);_0x568bf3['query']=_[_0x9716('0x37')](_0x3c38aa[_0x9716('0x36')]);_0x568bf3[_0x9716('0x38')]=_[_0x9716('0x39')](_0x568bf3[_0x9716('0x34')],_0x568bf3['query']);_0x5133fc[_0x9716('0x3a')]=_['intersection'](_0x568bf3[_0x9716('0x34')],qs[_0x9716('0x3b')](_0x3c38aa['query'][_0x9716('0x3b')]));_0x5133fc[_0x9716('0x3a')]=_0x5133fc[_0x9716('0x3a')]['length']?_0x5133fc[_0x9716('0x3a')]:_0x568bf3[_0x9716('0x34')];_0x5133fc[_0x9716('0x3f')]=qs[_0x9716('0x40')](_0x3c38aa['query']['sort']);_0x5133fc[_0x9716('0x41')]=qs[_0x9716('0x38')](_['pick'](_0x3c38aa['query'],_0x568bf3['filters']));if(_0x3c38aa['query'][_0x9716('0x43')]){_0x5133fc['where']=_[_0x9716('0x44')](_0x5133fc['where'],{'$or':_[_0x9716('0x35')](_0x5133fc[_0x9716('0x3a')],function(_0x5f19bd){var _0x48040a={};_0x48040a[_0x5f19bd]={'$like':'%'+_0x3c38aa[_0x9716('0x36')][_0x9716('0x43')]+'%'};return _0x48040a;})});}if(_0x3c38aa[_0x9716('0x36')][_0x9716('0x5d')]){var _0x50a170=_0x3c38aa[_0x9716('0x36')][_0x9716('0x5d')][_0x9716('0x5e')](',');var _0x773200={};_0x773200[_0x50a170[0x0]]={'$gte':moment(_0x50a170[0x1])[_0x9716('0x5f')](_0x9716('0x60'))};_0x5133fc['where']=_[_0x9716('0x44')](_0x5133fc[_0x9716('0x41')],_0x773200);}_0x5133fc=_[_0x9716('0x44')]({},_0x5133fc,_0x3c38aa[_0x9716('0x46')]);return _0x392b5c[_0x9716('0x5c')](_0x5133fc);}})[_0x9716('0x2a')](function(_0x2158fe){if(_0x2158fe){_0x5e8c59=_0x2158fe[_0x9716('0x3c')];if(!_0x3c38aa['query'][_0x9716('0x3d')](_0x9716('0x3e'))){_0x5133fc['limit']=qs['limit'](_0x3c38aa['query'][_0x9716('0x22')]);_0x5133fc[_0x9716('0x20')]=qs[_0x9716('0x20')](_0x3c38aa[_0x9716('0x36')][_0x9716('0x20')]);}return _0x392b5c[_0x9716('0x5c')](_0x5133fc);}})[_0x9716('0x2a')](function(_0x34a2d1){if(_0x34a2d1){return _0x34a2d1?{'count':_0x5e8c59,'rows':_0x34a2d1}:null;}})[_0x9716('0x2a')](respondWithResult(_0x52e50c,null))[_0x9716('0x4a')](handleError(_0x52e50c,null));}; \ No newline at end of file +var _0x031b=['create','body','describe','user','toInteger','addMembers','omit','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0xd02bb,_0x26e2d0){var _0x1cdf23=function(_0x18fd05){while(--_0x18fd05){_0xd02bb['push'](_0xd02bb['shift']());}};_0x1cdf23(++_0x26e2d0);}(_0x031b,0x1ef));var _0xb031=function(_0x26a4ae,_0x47d1e6){_0x26a4ae=_0x26a4ae-0x0;var _0x123384=_0x031b[_0x26a4ae];return _0x123384;};'use strict';var emlformat=require(_0xb031('0x0'));var rimraf=require(_0xb031('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb031('0x2'));var rp=require(_0xb031('0x3'));var moment=require(_0xb031('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb031('0x5'));var util=require('util');var path=require(_0xb031('0x6'));var sox=require(_0xb031('0x7'));var csv=require(_0xb031('0x8'));var ejs=require(_0xb031('0x9'));var fs=require('fs');var fs_extra=require(_0xb031('0xa'));var _=require(_0xb031('0xb'));var squel=require(_0xb031('0xc'));var crypto=require(_0xb031('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb031('0xe'));var Papa=require(_0xb031('0xf'));var Redis=require(_0xb031('0x10'));var authService=require(_0xb031('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb031('0x12'))(_0xb031('0x13'));var utils=require(_0xb031('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb031('0x15'));var db=require(_0xb031('0x16'))['db'];config['redis']=_[_0xb031('0x17')](config[_0xb031('0x18')],{'host':_0xb031('0x19'),'port':0x18eb});var socket=require(_0xb031('0x1a'))(new Redis(config[_0xb031('0x18')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x282a9c,_0x24a005){_0x24a005=_0x24a005||0xcc;return function(_0x2dc8d8){if(_0x2dc8d8){return _0x282a9c[_0xb031('0x1b')](_0x24a005);}return _0x282a9c[_0xb031('0x1c')](_0x24a005)[_0xb031('0x1d')]();};}function respondWithResult(_0x343b19,_0x536771){_0x536771=_0x536771||0xc8;return function(_0x100c4f){if(_0x100c4f){return _0x343b19[_0xb031('0x1c')](_0x536771)['json'](_0x100c4f);}};}function respondWithFilteredResult(_0x2efe7c,_0x67fbcd){return function(_0x2e14e4){if(_0x2e14e4){var _0x4d3ce0=typeof _0x67fbcd['offset']===_0xb031('0x1e')&&typeof _0x67fbcd['limit']===_0xb031('0x1e');var _0x25f3f3=_0x2e14e4[_0xb031('0x1f')];var _0x5c06cb=_0x4d3ce0?0x0:_0x67fbcd[_0xb031('0x20')];var _0x3128d2=_0x4d3ce0?_0x2e14e4[_0xb031('0x1f')]:_0x67fbcd[_0xb031('0x20')]+_0x67fbcd[_0xb031('0x21')];var _0x528b53;if(_0x3128d2>=_0x25f3f3){_0x3128d2=_0x25f3f3;_0x528b53=0xc8;}else{_0x528b53=0xce;}_0x2efe7c['status'](_0x528b53);return _0x2efe7c['set'](_0xb031('0x22'),_0x5c06cb+'-'+_0x3128d2+'/'+_0x25f3f3)[_0xb031('0x23')](_0x2e14e4);}return null;};}function patchUpdates(_0x2dc5a6){return function(_0x142064){try{jsonpatch[_0xb031('0x24')](_0x142064,_0x2dc5a6,!![]);}catch(_0x2c2512){return BPromise['reject'](_0x2c2512);}return _0x142064[_0xb031('0x25')]();};}function saveUpdates(_0x427641,_0x47f22c){return function(_0x512cd4){if(_0x512cd4){return _0x512cd4[_0xb031('0x26')](_0x427641)[_0xb031('0x27')](function(_0x553700){return _0x553700;});}return null;};}function removeEntity(_0x31b9d8,_0x3fdb7e){return function(_0x4a3b72){if(_0x4a3b72){return _0x4a3b72[_0xb031('0x28')]()['then'](function(){_0x31b9d8['status'](0xcc)[_0xb031('0x1d')]();});}};}function handleEntityNotFound(_0x30cecd,_0x46a0de){return function(_0x2afb97){if(!_0x2afb97){_0x30cecd[_0xb031('0x1b')](0x194);}return _0x2afb97;};}function handleError(_0x1be974,_0x39dd54){_0x39dd54=_0x39dd54||0x1f4;return function(_0x356c4a){logger[_0xb031('0x29')](_0x356c4a[_0xb031('0x2a')]);if(_0x356c4a[_0xb031('0x2b')]){delete _0x356c4a[_0xb031('0x2b')];}_0x1be974['status'](_0x39dd54)[_0xb031('0x2c')](_0x356c4a);};}exports[_0xb031('0x2d')]=function(_0x30d91f,_0xeda96d){var _0x3f189a={},_0x5d0a7b={},_0x157977={'count':0x0,'rows':[]};var _0x44a5e7=_[_0xb031('0x2e')](db[_0xb031('0x2f')]['rawAttributes'],function(_0x55434b){return{'name':_0x55434b['fieldName'],'type':_0x55434b['type'][_0xb031('0x30')]};});_0x5d0a7b[_0xb031('0x31')]=_[_0xb031('0x2e')](_0x44a5e7,'name');_0x5d0a7b['query']=_[_0xb031('0x32')](_0x30d91f[_0xb031('0x33')]);_0x5d0a7b[_0xb031('0x34')]=_[_0xb031('0x35')](_0x5d0a7b[_0xb031('0x31')],_0x5d0a7b['query']);_0x3f189a['attributes']=_[_0xb031('0x35')](_0x5d0a7b[_0xb031('0x31')],qs[_0xb031('0x36')](_0x30d91f[_0xb031('0x33')][_0xb031('0x36')]));_0x3f189a[_0xb031('0x37')]=_0x3f189a[_0xb031('0x37')][_0xb031('0x38')]?_0x3f189a[_0xb031('0x37')]:_0x5d0a7b['model'];if(!_0x30d91f['query'][_0xb031('0x39')]('nolimit')){_0x3f189a[_0xb031('0x21')]=qs[_0xb031('0x21')](_0x30d91f[_0xb031('0x33')][_0xb031('0x21')]);_0x3f189a[_0xb031('0x20')]=qs[_0xb031('0x20')](_0x30d91f[_0xb031('0x33')][_0xb031('0x20')]);}_0x3f189a[_0xb031('0x3a')]=qs[_0xb031('0x3b')](_0x30d91f[_0xb031('0x33')]['sort']);_0x3f189a[_0xb031('0x3c')]=qs[_0xb031('0x34')](_[_0xb031('0x3d')](_0x30d91f[_0xb031('0x33')],_0x5d0a7b['filters']),_0x44a5e7);if(_0x30d91f[_0xb031('0x33')][_0xb031('0x3e')]){_0x3f189a[_0xb031('0x3c')]=_[_0xb031('0x3f')](_0x3f189a[_0xb031('0x3c')],{'$or':_[_0xb031('0x2e')](_0x44a5e7,function(_0x42a2fb){if(_0x42a2fb[_0xb031('0x40')]!==_0xb031('0x41')){var _0x15b3e0={};_0x15b3e0[_0x42a2fb[_0xb031('0x2b')]]={'$like':'%'+_0x30d91f[_0xb031('0x33')]['filter']+'%'};return _0x15b3e0;}})});}_0x3f189a=_['merge']({},_0x3f189a,_0x30d91f['options']);var _0x979b40={'where':_0x3f189a[_0xb031('0x3c')]};return db['ChatGroup'][_0xb031('0x1f')](_0x979b40)[_0xb031('0x27')](function(_0x45855d){_0x157977[_0xb031('0x1f')]=_0x45855d;if(_0x30d91f[_0xb031('0x33')][_0xb031('0x42')]){_0x3f189a[_0xb031('0x43')]=[{'all':!![]}];}return db[_0xb031('0x2f')][_0xb031('0x44')](_0x3f189a);})[_0xb031('0x27')](function(_0x58a51f){_0x157977[_0xb031('0x45')]=_0x58a51f;return _0x157977;})[_0xb031('0x27')](respondWithFilteredResult(_0xeda96d,_0x3f189a))[_0xb031('0x46')](handleError(_0xeda96d,null));};exports[_0xb031('0x47')]=function(_0x2f471b,_0x80d14f){var _0x11c1ec={'raw':!![],'where':{'id':_0x2f471b[_0xb031('0x48')]['id']}},_0x4e1195={};_0x4e1195[_0xb031('0x31')]=_[_0xb031('0x32')](db[_0xb031('0x2f')][_0xb031('0x49')]);_0x4e1195[_0xb031('0x33')]=_[_0xb031('0x32')](_0x2f471b['query']);_0x4e1195[_0xb031('0x34')]=_[_0xb031('0x35')](_0x4e1195[_0xb031('0x31')],_0x4e1195[_0xb031('0x33')]);_0x11c1ec[_0xb031('0x37')]=_['intersection'](_0x4e1195[_0xb031('0x31')],qs[_0xb031('0x36')](_0x2f471b[_0xb031('0x33')]['fields']));_0x11c1ec['attributes']=_0x11c1ec['attributes']['length']?_0x11c1ec['attributes']:_0x4e1195[_0xb031('0x31')];if(_0x2f471b[_0xb031('0x33')][_0xb031('0x42')]){_0x11c1ec[_0xb031('0x43')]=[{'all':!![]}];}_0x11c1ec=_['merge']({},_0x11c1ec,_0x2f471b['options']);return db['ChatGroup'][_0xb031('0x4a')](_0x11c1ec)['then'](handleEntityNotFound(_0x80d14f,null))[_0xb031('0x27')](respondWithResult(_0x80d14f,null))['catch'](handleError(_0x80d14f,null));};exports['create']=function(_0x4727c2,_0x4f117c){return db['ChatGroup'][_0xb031('0x4b')](_0x4727c2[_0xb031('0x4c')],{})[_0xb031('0x27')](respondWithResult(_0x4f117c,0xc9))[_0xb031('0x46')](handleError(_0x4f117c,null));};exports[_0xb031('0x26')]=function(_0x3dcd51,_0x433f20){if(_0x3dcd51['body']['id']){delete _0x3dcd51[_0xb031('0x4c')]['id'];}return db['ChatGroup'][_0xb031('0x4a')]({'where':{'id':_0x3dcd51[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x433f20,null))['then'](saveUpdates(_0x3dcd51[_0xb031('0x4c')],null))[_0xb031('0x27')](respondWithResult(_0x433f20,null))['catch'](handleError(_0x433f20,null));};exports['destroy']=function(_0x2b0474,_0x81f1d2){return db[_0xb031('0x2f')][_0xb031('0x4a')]({'where':{'id':_0x2b0474[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x81f1d2,null))[_0xb031('0x27')](removeEntity(_0x81f1d2,null))[_0xb031('0x46')](handleError(_0x81f1d2,null));};exports['describe']=function(_0x285ef2,_0x444d6c){return db['ChatGroup'][_0xb031('0x4d')]()['then'](respondWithResult(_0x444d6c,null))[_0xb031('0x46')](handleError(_0x444d6c,null));};exports['getUnread']=function(_0x5f1a1d,_0x46c8a9,_0x32a234){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x5f1a1d[_0xb031('0x48')]['id'],'ToId':_0x5f1a1d[_0xb031('0x4e')]['id'],'read':![]}})[_0xb031('0x27')](function(_0x1caf76){return{'id':_[_0xb031('0x4f')](_0x5f1a1d[_0xb031('0x48')]['id']),'count':_0x1caf76};})[_0xb031('0x27')](respondWithResult(_0x46c8a9,null))[_0xb031('0x46')](handleError(_0x46c8a9,null));};exports[_0xb031('0x50')]=function(_0x47448d,_0x3d9c87,_0x24c9eb){return db[_0xb031('0x2f')][_0xb031('0x4a')]({'where':{'id':_0x47448d[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x3d9c87,null))[_0xb031('0x27')](function(_0x2ad9a6){if(_0x2ad9a6){return _0x2ad9a6[_0xb031('0x50')](_0x47448d[_0xb031('0x4c')]['ids'],_[_0xb031('0x51')](_0x47448d['body'],['ids','id'])||{});}})[_0xb031('0x27')](respondWithResult(_0x3d9c87,null))[_0xb031('0x46')](handleError(_0x3d9c87,null));};exports[_0xb031('0x52')]=function(_0x65c622,_0x856a36,_0x4b5ce4){var _0x44fd50={};var _0x5473f5={};var _0x2ff83b;var _0x15569d;return db[_0xb031('0x2f')]['findOne']({'where':{'id':_0x65c622[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x856a36,null))[_0xb031('0x27')](function(_0x1c2fe6){if(_0x1c2fe6){_0x2ff83b=_0x1c2fe6;_0x5473f5[_0xb031('0x31')]=_['keys'](db[_0xb031('0x53')]['rawAttributes']);_0x5473f5['query']=_[_0xb031('0x32')](_0x65c622[_0xb031('0x33')]);_0x5473f5[_0xb031('0x34')]=_[_0xb031('0x35')](_0x5473f5[_0xb031('0x31')],_0x5473f5[_0xb031('0x33')]);_0x44fd50['attributes']=_[_0xb031('0x35')](_0x5473f5[_0xb031('0x31')],qs[_0xb031('0x36')](_0x65c622['query'][_0xb031('0x36')]));_0x44fd50[_0xb031('0x37')]=_0x44fd50[_0xb031('0x37')][_0xb031('0x38')]?_0x44fd50[_0xb031('0x37')]:_0x5473f5[_0xb031('0x31')];_0x44fd50['order']=qs[_0xb031('0x3b')](_0x65c622[_0xb031('0x33')][_0xb031('0x3b')]);_0x44fd50[_0xb031('0x3c')]=qs[_0xb031('0x34')](_[_0xb031('0x3d')](_0x65c622[_0xb031('0x33')],_0x5473f5[_0xb031('0x34')]));if(_0x65c622[_0xb031('0x33')]['filter']){_0x44fd50[_0xb031('0x3c')]=_['merge'](_0x44fd50[_0xb031('0x3c')],{'$or':_[_0xb031('0x2e')](_0x44fd50[_0xb031('0x37')],function(_0x2f791b){var _0x2f45a6={};_0x2f45a6[_0x2f791b]={'$like':'%'+_0x65c622['query'][_0xb031('0x3e')]+'%'};return _0x2f45a6;})});}_0x44fd50=_[_0xb031('0x3f')]({},_0x44fd50,_0x65c622['options']);return _0x2ff83b[_0xb031('0x52')](_0x44fd50);}})['then'](function(_0x5c572f){if(_0x5c572f){_0x15569d=_0x5c572f[_0xb031('0x38')];if(!_0x65c622['query']['hasOwnProperty'](_0xb031('0x54'))){_0x44fd50[_0xb031('0x21')]=qs['limit'](_0x65c622['query']['limit']);_0x44fd50[_0xb031('0x20')]=qs[_0xb031('0x20')](_0x65c622[_0xb031('0x33')][_0xb031('0x20')]);}return _0x2ff83b[_0xb031('0x52')](_0x44fd50);}})[_0xb031('0x27')](function(_0x9fb970){if(_0x9fb970){return _0x9fb970?{'count':_0x15569d,'rows':_0x9fb970}:null;}})[_0xb031('0x27')](respondWithResult(_0x856a36,null))[_0xb031('0x46')](handleError(_0x856a36,null));};exports[_0xb031('0x55')]=function(_0x3d6757,_0x4fba7e,_0x559202){return db[_0xb031('0x2f')][_0xb031('0x4a')]({'where':{'id':_0x3d6757[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x4fba7e,null))[_0xb031('0x27')](function(_0x58018e){if(_0x58018e){return _0x58018e[_0xb031('0x55')](_0x3d6757[_0xb031('0x33')]['ids']);}})[_0xb031('0x27')](respondWithStatusCode(_0x4fba7e,null))[_0xb031('0x46')](handleError(_0x4fba7e,null));};exports[_0xb031('0x56')]=function(_0x4bd5b6,_0x3c8c49,_0x2a96ea){if(_0x4bd5b6['body']['id']){delete _0x4bd5b6[_0xb031('0x4c')]['id'];}return db[_0xb031('0x2f')][_0xb031('0x4a')]({'where':{'id':_0x4bd5b6[_0xb031('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c8c49,null))[_0xb031('0x27')](function(_0x3f28d4){if(_0x3f28d4){_0x4bd5b6['body'][_0xb031('0x57')]=_0x3f28d4['id'];return db[_0xb031('0x58')]['create'](_0x4bd5b6[_0xb031('0x4c')]);}})[_0xb031('0x27')](respondWithResult(_0x3c8c49,null))[_0xb031('0x46')](handleError(_0x3c8c49,null));};exports[_0xb031('0x59')]=function(_0x5ccf5b,_0x2ca3ef,_0x48c595){var _0x916e7d={};var _0x3832cd={};var _0x10dc7d;var _0x4b22a3;return db[_0xb031('0x2f')][_0xb031('0x5a')]({'where':{'id':_0x5ccf5b[_0xb031('0x48')]['id']}})[_0xb031('0x27')](handleEntityNotFound(_0x2ca3ef,null))[_0xb031('0x27')](function(_0x265655){if(_0x265655){_0x10dc7d=_0x265655;_0x3832cd[_0xb031('0x31')]=_[_0xb031('0x32')](db[_0xb031('0x58')][_0xb031('0x49')]);_0x3832cd[_0xb031('0x33')]=_[_0xb031('0x32')](_0x5ccf5b[_0xb031('0x33')]);_0x3832cd['filters']=_[_0xb031('0x35')](_0x3832cd[_0xb031('0x31')],_0x3832cd['query']);_0x916e7d['attributes']=_['intersection'](_0x3832cd['model'],qs[_0xb031('0x36')](_0x5ccf5b[_0xb031('0x33')][_0xb031('0x36')]));_0x916e7d['attributes']=_0x916e7d[_0xb031('0x37')][_0xb031('0x38')]?_0x916e7d[_0xb031('0x37')]:_0x3832cd['model'];_0x916e7d[_0xb031('0x3a')]=qs[_0xb031('0x3b')](_0x5ccf5b['query'][_0xb031('0x3b')]);_0x916e7d['where']=qs[_0xb031('0x34')](_[_0xb031('0x3d')](_0x5ccf5b[_0xb031('0x33')],_0x3832cd[_0xb031('0x34')]));if(_0x5ccf5b['query'][_0xb031('0x3e')]){_0x916e7d[_0xb031('0x3c')]=_[_0xb031('0x3f')](_0x916e7d[_0xb031('0x3c')],{'$or':_[_0xb031('0x2e')](_0x916e7d['attributes'],function(_0x1467e7){var _0x3eaa8f={};_0x3eaa8f[_0x1467e7]={'$like':'%'+_0x5ccf5b['query'][_0xb031('0x3e')]+'%'};return _0x3eaa8f;})});}if(_0x5ccf5b[_0xb031('0x33')]['$gte']){var _0x102345=_0x5ccf5b[_0xb031('0x33')][_0xb031('0x5b')]['split'](',');var _0x5d4af0={};_0x5d4af0[_0x102345[0x0]]={'$gte':moment(_0x102345[0x1])[_0xb031('0x5c')](_0xb031('0x5d'))};_0x916e7d[_0xb031('0x3c')]=_[_0xb031('0x3f')](_0x916e7d[_0xb031('0x3c')],_0x5d4af0);}_0x916e7d=_['merge']({},_0x916e7d,_0x5ccf5b[_0xb031('0x5e')]);return _0x10dc7d[_0xb031('0x59')](_0x916e7d);}})['then'](function(_0x4b30c6){if(_0x4b30c6){_0x4b22a3=_0x4b30c6['length'];if(!_0x5ccf5b[_0xb031('0x33')]['hasOwnProperty'](_0xb031('0x54'))){_0x916e7d['limit']=qs[_0xb031('0x21')](_0x5ccf5b[_0xb031('0x33')][_0xb031('0x21')]);_0x916e7d[_0xb031('0x20')]=qs['offset'](_0x5ccf5b[_0xb031('0x33')]['offset']);}return _0x10dc7d['getMessages'](_0x916e7d);}})[_0xb031('0x27')](function(_0x1bf7a8){if(_0x1bf7a8){return _0x1bf7a8?{'count':_0x4b22a3,'rows':_0x1bf7a8}:null;}})[_0xb031('0x27')](respondWithResult(_0x2ca3ef,null))['catch'](handleError(_0x2ca3ef,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 356112f..d7d47c3 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 _0xa46e=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0xa713ca,_0x35c118){var _0x23a3be=function(_0x531774){while(--_0x531774){_0xa713ca['push'](_0xa713ca['shift']());}};_0x23a3be(++_0x35c118);}(_0xa46e,0x8a));var _0xea46=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xa46e[_0x199c03];return _0x11a7d4;};'use strict';var EventEmitter=require(_0xea46('0x0'));var ChatGroup=require(_0xea46('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xea46('0x2')](0x0);var events={'afterCreate':_0xea46('0x3'),'afterUpdate':_0xea46('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19f135){return function(_0x4b6e4a,_0x3a2209,_0x47d633){ChatGroupEvents[_0xea46('0x5')](_0x19f135+':'+_0x4b6e4a['id'],_0x4b6e4a);ChatGroupEvents['emit'](_0x19f135,_0x4b6e4a);_0x47d633(null);};}for(var e in events){if(events[_0xea46('0x6')](e)){var event=events[e];ChatGroup[_0xea46('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x1e20=['emit','hook','../../mysqldb','save','update','remove'];(function(_0x4b9f55,_0x50768d){var _0x3d443b=function(_0xf01582){while(--_0xf01582){_0x4b9f55['push'](_0x4b9f55['shift']());}};_0x3d443b(++_0x50768d);}(_0x1e20,0x1ac));var _0x01e2=function(_0x5257c0,_0xc2e255){_0x5257c0=_0x5257c0-0x0;var _0x5677a6=_0x1e20[_0x5257c0];return _0x5677a6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x01e2('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01e2('0x1'),'afterUpdate':_0x01e2('0x2'),'afterDestroy':_0x01e2('0x3')};function emitEvent(_0x1225ad){return function(_0x47b2e6,_0x7a5157,_0x4f5b5d){ChatGroupEvents[_0x01e2('0x4')](_0x1225ad+':'+_0x47b2e6['id'],_0x47b2e6);ChatGroupEvents[_0x01e2('0x4')](_0x1225ad,_0x47b2e6);_0x4f5b5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x01e2('0x5')](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 05c5c35..2efd7e3 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 _0x6957=['./chatGroup.attributes','exports','define','chat_groups','lodash','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd3bc,_0x332f04){var _0x28d039=function(_0x10b604){while(--_0x10b604){_0x3dd3bc['push'](_0x3dd3bc['shift']());}};_0x28d039(++_0x332f04);}(_0x6957,0x176));var _0x7695=function(_0x4596a9,_0x44655a){_0x4596a9=_0x4596a9-0x0;var _0x3ea3d0=_0x6957[_0x4596a9];return _0x3ea3d0;};'use strict';var _=require(_0x7695('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7695('0x1'));var BPromise=require('bluebird');var rp=require(_0x7695('0x2'));var fs=require('fs');var path=require(_0x7695('0x3'));var rimraf=require(_0x7695('0x4'));var config=require(_0x7695('0x5'));var attributes=require(_0x7695('0x6'));module[_0x7695('0x7')]=function(_0x313ced,_0x56a4cd){return _0x313ced[_0x7695('0x8')]('ChatGroup',attributes,{'tableName':_0x7695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a16=['chat_groups','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup'];(function(_0x35b223,_0x436064){var _0x3e32b0=function(_0x5d27c1){while(--_0x5d27c1){_0x35b223['push'](_0x35b223['shift']());}};_0x3e32b0(++_0x436064);}(_0x0a16,0x19b));var _0x60a1=function(_0x106999,_0x32e943){_0x106999=_0x106999-0x0;var _0x2f8661=_0x0a16[_0x106999];return _0x2f8661;};'use strict';var _=require('lodash');var util=require(_0x60a1('0x0'));var logger=require(_0x60a1('0x1'))(_0x60a1('0x2'));var moment=require('moment');var BPromise=require(_0x60a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x60a1('0x4'));var config=require(_0x60a1('0x5'));var attributes=require(_0x60a1('0x6'));module[_0x60a1('0x7')]=function(_0x418f10,_0x3640fb){return _0x418f10['define'](_0x60a1('0x8'),attributes,{'tableName':_0x60a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b4f4ac1..eb99790 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 _0x0738=['http','redis','defaults','localhost','./chatGroup.socket','register','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ffee8,_0x126cdd){var _0x432ebf=function(_0x521355){while(--_0x521355){_0x2ffee8['push'](_0x2ffee8['shift']());}};_0x432ebf(++_0x126cdd);}(_0x0738,0xb9));var _0x8073=function(_0x4920f2,_0xa4bfbf){_0x4920f2=_0x4920f2-0x0;var _0x1f27cf=_0x0738[_0x4920f2];return _0x1f27cf;};'use strict';var _=require(_0x8073('0x0'));var util=require(_0x8073('0x1'));var moment=require(_0x8073('0x2'));var BPromise=require(_0x8073('0x3'));var rs=require(_0x8073('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8073('0x5'));var logger=require(_0x8073('0x6'))(_0x8073('0x7'));var config=require(_0x8073('0x8'));var jayson=require(_0x8073('0x9'));var client=jayson[_0x8073('0xa')][_0x8073('0xb')]({'port':0x232a});config[_0x8073('0xc')]=_[_0x8073('0xd')](config[_0x8073('0xc')],{'host':_0x8073('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8073('0xf'))[_0x8073('0x10')](socket);function respondWithRpcPromise(_0x5d0760,_0x2d3df4,_0x33674f){return new BPromise(function(_0x28031e,_0x3f2c1c){return client['request'](_0x5d0760,_0x33674f)[_0x8073('0x11')](function(_0x5d0356){logger[_0x8073('0x12')]('ChatGroup,\x20%s,\x20%s',_0x2d3df4,'request\x20sent');logger[_0x8073('0x13')](_0x8073('0x14'),_0x2d3df4,'request\x20sent',JSON[_0x8073('0x15')](_0x5d0356));if(_0x5d0356[_0x8073('0x16')]){if(_0x5d0356['error'][_0x8073('0x17')]===0x1f4){logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0x5d0356[_0x8073('0x16')]['message']);return _0x3f2c1c(_0x5d0356[_0x8073('0x16')][_0x8073('0x19')]);}logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0x5d0356[_0x8073('0x16')][_0x8073('0x19')]);return _0x28031e(_0x5d0356['error'][_0x8073('0x19')]);}else{logger['info'](_0x8073('0x18'),_0x2d3df4,_0x8073('0x1a'));_0x28031e(_0x5d0356['result'][_0x8073('0x19')]);}})[_0x8073('0x1b')](function(_0xdb5ddf){logger[_0x8073('0x16')](_0x8073('0x18'),_0x2d3df4,_0xdb5ddf);_0x3f2c1c(_0xdb5ddf);});});} \ No newline at end of file +var _0xe0ae=['request\x20sent','stringify','code','error','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','debug'];(function(_0xd0c858,_0x296098){var _0x491d93=function(_0x1d9b8d){while(--_0x1d9b8d){_0xd0c858['push'](_0xd0c858['shift']());}};_0x491d93(++_0x296098);}(_0xe0ae,0xa1));var _0xee0a=function(_0x3d13bb,_0x262a54){_0x3d13bb=_0x3d13bb-0x0;var _0x4b5a1b=_0xe0ae[_0x3d13bb];return _0x4b5a1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee0a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('rpc');var config=require(_0xee0a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee0a('0x6')]({'port':0x232a});config[_0xee0a('0x7')]=_[_0xee0a('0x8')](config[_0xee0a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xee0a('0x9'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xee0a('0xa')](socket);function respondWithRpcPromise(_0x3d0b3f,_0xbd4483,_0x57d190){return new BPromise(function(_0x3bc0cf,_0x1a953e){return client['request'](_0x3d0b3f,_0x57d190)[_0xee0a('0xb')](function(_0x4b3e49){logger[_0xee0a('0xc')](_0xee0a('0xd'),_0xbd4483,'request\x20sent');logger[_0xee0a('0xe')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xbd4483,_0xee0a('0xf'),JSON[_0xee0a('0x10')](_0x4b3e49));if(_0x4b3e49['error']){if(_0x4b3e49['error'][_0xee0a('0x11')]===0x1f4){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x1a953e(_0x4b3e49['error'][_0xee0a('0x13')]);}logger[_0xee0a('0x12')]('ChatGroup,\x20%s,\x20%s',_0xbd4483,_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);return _0x3bc0cf(_0x4b3e49[_0xee0a('0x12')][_0xee0a('0x13')]);}else{logger['info'](_0xee0a('0xd'),_0xbd4483,_0xee0a('0xf'));_0x3bc0cf(_0x4b3e49[_0xee0a('0x14')]['message']);}})[_0xee0a('0x15')](function(_0x1ffdb5){logger[_0xee0a('0x12')](_0xee0a('0xd'),_0xbd4483,_0x1ffdb5);_0x1a953e(_0x1ffdb5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 140f08e..caff291 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 _0x1f0f=['emit','removeListener','register','chatGroup:','save','remove','update'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x1f0f,0x1ee));var _0xf1f0=function(_0xbcd28d,_0x5eaa62){_0xbcd28d=_0xbcd28d-0x0;var _0x1b86da=_0x1f0f[_0xbcd28d];return _0x1b86da;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xf1f0('0x0'),_0xf1f0('0x1'),_0xf1f0('0x2')];function createListener(_0x5961ca,_0xbc4e59){return function(_0xb9a323){_0xbc4e59[_0xf1f0('0x3')](_0x5961ca,_0xb9a323);};}function removeListener(_0x4dc8ce,_0x48d8e3){return function(){ChatGroupEvents[_0xf1f0('0x4')](_0x4dc8ce,_0x48d8e3);};}exports[_0xf1f0('0x5')]=function(_0x56383b){for(var _0x2084d7=0x0,_0x4149b0=events['length'];_0x2084d7<_0x4149b0;_0x2084d7++){var _0x49e289=events[_0x2084d7];var _0x1c2373=createListener(_0xf1f0('0x6')+_0x49e289,_0x56383b);ChatGroupEvents['on'](_0x49e289,_0x1c2373);}}; \ No newline at end of file +var _0x61de=['remove','update','emit','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x61de,0x164));var _0xe61d=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x61de[_0x4ea69d];return _0x5318e0;};'use strict';var ChatGroupEvents=require(_0xe61d('0x0'));var events=['save',_0xe61d('0x1'),_0xe61d('0x2')];function createListener(_0x11e27e,_0x473397){return function(_0x38c036){_0x473397[_0xe61d('0x3')](_0x11e27e,_0x38c036);};}function removeListener(_0x12025d,_0x2795b2){return function(){ChatGroupEvents[_0xe61d('0x4')](_0x12025d,_0x2795b2);};}exports['register']=function(_0x4215af){for(var _0x47a54d=0x0,_0x3f9070=events[_0xe61d('0x5')];_0x47a54d<_0x3f9070;_0x47a54d++){var _0x253061=events[_0x47a54d];var _0x470d69=createListener(_0xe61d('0x6')+_0x253061,_0x4215af);ChatGroupEvents['on'](_0x253061,_0x470d69);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 87432f9..c1830ae 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 _0xb80c=['addMessage','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','addMembers'];(function(_0x31c4cc,_0x150943){var _0x3099ee=function(_0xe3f487){while(--_0xe3f487){_0x31c4cc['push'](_0x31c4cc['shift']());}};_0x3099ee(++_0x150943);}(_0xb80c,0x1f2));var _0xcb80=function(_0x3cfa2c,_0x30b6cb){_0x3cfa2c=_0x3cfa2c-0x0;var _0x35740c=_0xb80c[_0x3cfa2c];return _0x35740c;};'use strict';var multer=require(_0xcb80('0x0'));var util=require(_0xcb80('0x1'));var path=require('path');var timeout=require(_0xcb80('0x2'));var express=require(_0xcb80('0x3'));var router=express[_0xcb80('0x4')]();var fs_extra=require(_0xcb80('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb80('0x6'));var config=require('../../config/environment');var controller=require(_0xcb80('0x7'));router[_0xcb80('0x8')]('/',auth['isAuthenticated'](),controller[_0xcb80('0x9')]);router['get'](_0xcb80('0xa'),auth[_0xcb80('0xb')](),controller[_0xcb80('0xc')]);router[_0xcb80('0x8')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller[_0xcb80('0xe')]);router[_0xcb80('0x8')](_0xcb80('0xf'),auth[_0xcb80('0xb')](),controller[_0xcb80('0x10')]);router[_0xcb80('0x8')](_0xcb80('0x11'),auth['isAuthenticated'](),controller[_0xcb80('0x12')]);router[_0xcb80('0x8')]('/:id/messages',auth[_0xcb80('0xb')](),controller[_0xcb80('0x13')]);router[_0xcb80('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcb80('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xcb80('0x15')]);router[_0xcb80('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xcb80('0x16')]);router[_0xcb80('0x17')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller['update']);router[_0xcb80('0x18')](_0xcb80('0xd'),auth[_0xcb80('0xb')](),controller[_0xcb80('0x19')]);router['delete']('/:id/members',auth[_0xcb80('0xb')](),controller['removeMembers']);module['exports']=router; \ No newline at end of file +var _0xd9df=['getUnread','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','/:id/unread'];(function(_0x36cb50,_0x59e5a5){var _0xa7b819=function(_0x50bc01){while(--_0x50bc01){_0x36cb50['push'](_0x36cb50['shift']());}};_0xa7b819(++_0x59e5a5);}(_0xd9df,0x87));var _0xfd9d=function(_0x4fb606,_0x127320){_0x4fb606=_0x4fb606-0x0;var _0x27349d=_0xd9df[_0x4fb606];return _0x27349d;};'use strict';var multer=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var path=require(_0xfd9d('0x2'));var timeout=require(_0xfd9d('0x3'));var express=require(_0xfd9d('0x4'));var router=express[_0xfd9d('0x5')]();var fs_extra=require(_0xfd9d('0x6'));var auth=require(_0xfd9d('0x7'));var interaction=require(_0xfd9d('0x8'));var config=require(_0xfd9d('0x9'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xfd9d('0xa')](),controller['index']);router[_0xfd9d('0xb')]('/describe',auth[_0xfd9d('0xa')](),controller[_0xfd9d('0xc')]);router['get'](_0xfd9d('0xd'),auth[_0xfd9d('0xa')](),controller['show']);router[_0xfd9d('0xb')](_0xfd9d('0xe'),auth[_0xfd9d('0xa')](),controller[_0xfd9d('0xf')]);router['get']('/:id/members',auth[_0xfd9d('0xa')](),controller[_0xfd9d('0x10')]);router[_0xfd9d('0xb')]('/:id/messages',auth[_0xfd9d('0xa')](),controller[_0xfd9d('0x11')]);router[_0xfd9d('0x12')]('/',auth[_0xfd9d('0xa')](),controller[_0xfd9d('0x13')]);router[_0xfd9d('0x12')](_0xfd9d('0x14'),auth[_0xfd9d('0xa')](),controller[_0xfd9d('0x15')]);router[_0xfd9d('0x12')](_0xfd9d('0x16'),auth['isAuthenticated'](),controller[_0xfd9d('0x17')]);router[_0xfd9d('0x18')](_0xfd9d('0xd'),auth[_0xfd9d('0xa')](),controller[_0xfd9d('0x19')]);router[_0xfd9d('0x1a')](_0xfd9d('0xd'),auth['isAuthenticated'](),controller[_0xfd9d('0x1b')]);router[_0xfd9d('0x1a')](_0xfd9d('0x14'),auth['isAuthenticated'](),controller[_0xfd9d('0x1c')]);module[_0xfd9d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 5a0f50a..4a47336 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 _0xb677=['DATE','STRING','sequelize','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb677,0x119));var _0x7b67=function(_0x573654,_0x4b3f64){_0x573654=_0x573654-0x0;var _0x274d3b=_0xb677[_0x573654];return _0x274d3b;};'use strict';var Sequelize=require(_0x7b67('0x0'));module['exports']={'closed':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7b67('0x2')]},'ratingType':{'type':Sequelize[_0x7b67('0x3')](_0x7b67('0x4'),_0x7b67('0x5')),'defaultValue':_0x7b67('0x4')},'ratingMessage':{'type':Sequelize[_0x7b67('0x6')]},'pathTranscript':{'type':Sequelize[_0x7b67('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7b67('0x7')]},'disposition':{'type':Sequelize[_0x7b67('0x8')]},'secondDisposition':{'type':Sequelize[_0x7b67('0x8')]},'thirdDisposition':{'type':Sequelize[_0x7b67('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x7b67('0x8')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7b67('0x8')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7b67('0x8')]},'referer':{'type':Sequelize[_0x7b67('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7b67('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7b67('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7b67('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7b67('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x7b67('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x7117=['INTEGER','star','thumb','TEXT','STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN'];(function(_0x16f41b,_0x5e0f92){var _0x321c3b=function(_0x5253f0){while(--_0x5253f0){_0x16f41b['push'](_0x16f41b['shift']());}};_0x321c3b(++_0x5e0f92);}(_0x7117,0x1ec));var _0x7711=function(_0x351987,_0x2ad352){_0x351987=_0x351987-0x0;var _0x4cdf93=_0x7117[_0x351987];return _0x4cdf93;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'closed':{'type':Sequelize[_0x7711('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7711('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x7711('0x4'),_0x7711('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7711('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x7711('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7711('0x8')]},'disposition':{'type':Sequelize[_0x7711('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x7711('0x7')]},'osName':{'type':Sequelize[_0x7711('0x7')]},'osVersion':{'type':Sequelize[_0x7711('0x7')]},'deviceModel':{'type':Sequelize[_0x7711('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7711('0x7')]},'referer':{'type':Sequelize[_0x7711('0x6')]},'customerIp':{'type':Sequelize[_0x7711('0x7')]},'formData':{'type':Sequelize[_0x7711('0x6')](_0x7711('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7711('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x7711('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7711('0x7')]},'customerPort':{'type':Sequelize[_0x7711('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x7711('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x7711('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index eb32337..281f030 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 _0x63b5=['ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsiteId','ContactId','length','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','CloudProvider','Smtp','SendMail','sendMail','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','includeAgent','push','includeAll','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','firstName','lastName','Owner','get','mkdirSync','Account','N.A.','toString','closedAt','browserName','osName','customerPort','tail','createReadStream','read','value','renderFile','views','.pdf','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','name','render','body','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','params','model','keys','filters','intersection','attributes','fields','include','merge','create','find','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','isNull','parse','metadata','Sequelize'];(function(_0xa94fd,_0x21edfe){var _0x315fea=function(_0x488acd){while(--_0x488acd){_0xa94fd['push'](_0xa94fd['shift']());}};_0x315fea(++_0x21edfe);}(_0x63b5,0x142));var _0x563b=function(_0xdd2074,_0x59bb75){_0xdd2074=_0xdd2074-0x0;var _0x4d08f9=_0x63b5[_0xdd2074];return _0x4d08f9;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x563b('0x0'));var rp=require(_0x563b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x563b('0x2'));var util=require(_0x563b('0x3'));var path=require(_0x563b('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x563b('0x5'));var Redis=require(_0x563b('0x6'));var interaction=require(_0x563b('0x7'));var qs=require(_0x563b('0x8'));var pdf=require(_0x563b('0x9'));var logger=require(_0x563b('0xa'))(_0x563b('0xb'));var config=require(_0x563b('0xc'));var db=require(_0x563b('0xd'))['db'];config[_0x563b('0xe')]=_[_0x563b('0xf')](config[_0x563b('0xe')],{'host':_0x563b('0x10'),'port':0x18eb});var socket=require(_0x563b('0x11'))(new Redis(config['redis']));require(_0x563b('0x12'))[_0x563b('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x563b('0x14')][_0x563b('0x15')]({'port':0x232b});var client9004=jayson[_0x563b('0x14')][_0x563b('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x39a3d9,_0x2a4e13,_0x52d12e,_0x1c2333){return new BPromise(function(_0x4b5c2d,_0x1cfdbd){var _0x184dc8=_0x1c2333||client;return _0x184dc8[_0x563b('0x16')](_0x39a3d9,_0x52d12e)[_0x563b('0x17')](function(_0x3b697b){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2a4e13,_0x563b('0x18'));logger['debug'](_0x563b('0x19'),_0x2a4e13,'request\x20sent',JSON['stringify'](_0x3b697b));if(_0x3b697b[_0x563b('0x1a')]){if(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1b')]===0x1f4){logger[_0x563b('0x1a')](_0x563b('0x1c'),_0x2a4e13,_0x3b697b['error'][_0x563b('0x1d')]);return _0x1cfdbd(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);}logger[_0x563b('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x2a4e13,_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);return _0x4b5c2d(_0x3b697b[_0x563b('0x1a')][_0x563b('0x1d')]);}else{logger['info'](_0x563b('0x1c'),_0x2a4e13,_0x563b('0x18'));_0x4b5c2d(_0x3b697b[_0x563b('0x1e')][_0x563b('0x1d')]);}})[_0x563b('0x1f')](function(_0x1889b0){logger[_0x563b('0x1a')](_0x563b('0x1c'),_0x2a4e13,_0x1889b0);_0x1cfdbd(_0x1889b0);});});}function respondWithStatusCode(_0x56cce8,_0x6ed85c){_0x6ed85c=_0x6ed85c||0xcc;return function(_0x9bf9c){if(_0x9bf9c){return _0x56cce8[_0x563b('0x20')](_0x6ed85c);}return _0x56cce8[_0x563b('0x21')](_0x6ed85c)[_0x563b('0x22')]();};}function respondWithResult(_0x41cbd4,_0x44b8cf){_0x44b8cf=_0x44b8cf||0xc8;return function(_0x56e18e){if(_0x56e18e){return _0x41cbd4['status'](_0x44b8cf)[_0x563b('0x23')](_0x56e18e);}};}function respondWithFilteredResult(_0x29c718,_0x182527){return function(_0x1e86ca){if(_0x1e86ca){var _0x1622ef=typeof _0x182527['offset']===_0x563b('0x24')&&typeof _0x182527[_0x563b('0x25')]===_0x563b('0x24');var _0x4dee69=_0x1e86ca[_0x563b('0x26')];var _0xee4b89=_0x1622ef?0x0:_0x182527[_0x563b('0x27')];var _0x36fb03=_0x1622ef?_0x1e86ca[_0x563b('0x26')]:_0x182527[_0x563b('0x27')]+_0x182527[_0x563b('0x25')];var _0x1ec25f;if(_0x36fb03>=_0x4dee69){_0x36fb03=_0x4dee69;_0x1ec25f=0xc8;}else{_0x1ec25f=0xce;}_0x29c718[_0x563b('0x21')](_0x1ec25f);return _0x29c718[_0x563b('0x28')]('Content-Range',_0xee4b89+'-'+_0x36fb03+'/'+_0x4dee69)['json'](_0x1e86ca);}return null;};}function saveUpdates(_0x112d97){return function(_0x2a4341){if(_0x2a4341){return _0x2a4341[_0x563b('0x29')](_0x112d97)[_0x563b('0x17')](function(_0x3d6a3f){return _0x3d6a3f;});}return null;};}function removeEntity(_0x1fb8e6){return function(_0x47e87a){if(_0x47e87a){return _0x47e87a[_0x563b('0x2a')]()[_0x563b('0x17')](function(){_0x1fb8e6[_0x563b('0x21')](0xcc)[_0x563b('0x22')]();});}};}function handleEntityNotFound(_0xbb5eb6){return function(_0x11b97f){if(!_0x11b97f){_0xbb5eb6['sendStatus'](0x194);}return _0x11b97f;};}function handleError(_0x3418b7,_0x47fc6f){_0x47fc6f=_0x47fc6f||0x1f4;return function(_0x4c2e3b){logger[_0x563b('0x1a')](_0x4c2e3b['stack']);if(_0x4c2e3b['name']){delete _0x4c2e3b[_0x563b('0x2b')];}_0x3418b7[_0x563b('0x21')](_0x47fc6f)['send'](_0x4c2e3b);};}function getMustacheRender(_0x2a60ca,_0x547f51){return Mustache[_0x563b('0x2c')](_0x2a60ca,_['merge'](_0x547f51[_0x563b('0x2d')],{'contact':_0x547f51['contact'],'message':_0x547f51[_0x563b('0x1d')],'agent':_0x547f51['agent'],'interaction':_0x547f51[_0x563b('0x2e')],'account':_0x547f51[_0x563b('0x2f')]}))||'';}exports[_0x563b('0x30')]=function(_0x4719d4,_0xe49f81){var _0x5ad0c0={};var _0x537357=_[_0x563b('0x31')](db[_0x563b('0x32')][_0x563b('0x33')],function(_0xec5431){return{'name':_0xec5431[_0x563b('0x34')],'type':_0xec5431[_0x563b('0x35')][_0x563b('0x36')]};});_0x5ad0c0=qs[_0x563b('0x37')](_0x537357,_0x4719d4);return interaction[_0x563b('0x38')](_0x563b('0x39'),_0x4719d4[_0x563b('0x3a')],_0x4719d4[_0x563b('0x3b')],_0x5ad0c0,_0x537357)[_0x563b('0x17')](respondWithFilteredResult(_0xe49f81,_0x5ad0c0))[_0x563b('0x1f')](handleError(_0xe49f81,null));};exports['show']=function(_0x8f025,_0x5ea37f){var _0x2a2737={'raw':![],'where':{'id':_0x8f025[_0x563b('0x3c')]['id']}},_0x9e6ab3={};_0x9e6ab3[_0x563b('0x3d')]=_['keys'](db['ChatInteraction'][_0x563b('0x33')]);_0x9e6ab3[_0x563b('0x3a')]=_[_0x563b('0x3e')](_0x8f025[_0x563b('0x3a')]);_0x9e6ab3[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x9e6ab3[_0x563b('0x3d')],_0x9e6ab3[_0x563b('0x3a')]);_0x2a2737[_0x563b('0x41')]=_[_0x563b('0x40')](_0x9e6ab3[_0x563b('0x3d')],qs[_0x563b('0x42')](_0x8f025[_0x563b('0x3a')][_0x563b('0x42')]));_0x2a2737['attributes']=_0x2a2737[_0x563b('0x41')]['length']?_0x2a2737[_0x563b('0x41')]:_0x9e6ab3[_0x563b('0x3d')];if(_0x8f025[_0x563b('0x3a')]['includeAll']){_0x2a2737[_0x563b('0x43')]=[{'all':!![]}];}_0x2a2737=_[_0x563b('0x44')]({},_0x2a2737,_0x8f025['options']);return db[_0x563b('0x32')]['find'](_0x2a2737)[_0x563b('0x17')](handleEntityNotFound(_0x5ea37f,null))[_0x563b('0x17')](respondWithResult(_0x5ea37f,null))['catch'](handleError(_0x5ea37f,null));};exports[_0x563b('0x45')]=function(_0x1fffda,_0x16a267){return db[_0x563b('0x32')][_0x563b('0x45')](_0x1fffda['body'],{})['then'](respondWithResult(_0x16a267,0xc9))[_0x563b('0x1f')](handleError(_0x16a267,null));};exports[_0x563b('0x29')]=function(_0x1a0856,_0x58f765){if(_0x1a0856[_0x563b('0x2d')]['id']){delete _0x1a0856['body']['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x1a0856[_0x563b('0x3c')]['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x58f765,null))[_0x563b('0x17')](saveUpdates(_0x1a0856['body'],null))[_0x563b('0x17')](respondWithResult(_0x58f765,null))[_0x563b('0x1f')](handleError(_0x58f765,null));};exports['destroy']=function(_0x48742,_0x67a5ea){return db[_0x563b('0x32')]['find']({'where':{'id':_0x48742['params']['id']}})['then'](handleEntityNotFound(_0x67a5ea,null))[_0x563b('0x17')](removeEntity(_0x67a5ea,null))[_0x563b('0x1f')](handleError(_0x67a5ea,null));};exports[_0x563b('0x47')]=function(_0x12ba44,_0x5c61f7){return db[_0x563b('0x32')]['describe']()[_0x563b('0x17')](respondWithResult(_0x5c61f7,null))[_0x563b('0x1f')](handleError(_0x5c61f7,null));};exports[_0x563b('0x48')]=function(_0x49ef91,_0xbfecbe){var _0x37f1b6=_0x49ef91[_0x563b('0x3c')]['id'];var _0x4f870b;var _0x28f1f4;var _0x122d94;return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x37f1b6}})[_0x563b('0x17')](function(_0x533061){_0x4f870b=_0x533061;return db[_0x563b('0x4a')]['findOne']({'where':{'id':_0x533061['ChatWebsiteId']},'attributes':['id',_0x563b('0x4b'),_0x563b('0x4c'),_0x563b('0x4d'),_0x563b('0x4e'),_0x563b('0x4f')],'raw':!![]});})[_0x563b('0x17')](function(_0x20e570){if(_0x20e570&&_0x20e570[_0x563b('0x4b')]&&_0x20e570['vidaooEscalation']){_0x28f1f4=_0x20e570;var _0x2f9954={'interaction':{'id':_0x37f1b6},'agent':{'id':_0x49ef91[_0x563b('0x3b')]['id'],'name':_0x49ef91[_0x563b('0x3b')][_0x563b('0x2b')],'fullname':_0x49ef91[_0x563b('0x3b')]['fullname'],'email':_0x49ef91[_0x563b('0x3b')][_0x563b('0x50')]},'contact':_0x49ef91['body']['contact'],'account':_0x49ef91[_0x563b('0x2d')]['account']};var _0x5ce761={'rejectUnauthorized':![],'method':_0x563b('0x51'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x20e570[_0x563b('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49ef91[_0x563b('0x3b')][_0x563b('0x50')]],'buttons':null,'topic':_0x28f1f4['vidaooTopic'],'note':_[_0x563b('0x52')](_0x28f1f4[_0x563b('0x4e')])?null:getMustacheRender(_0x28f1f4[_0x563b('0x4e')],_0x2f9954),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x563b('0x52')](_0x28f1f4[_0x563b('0x4f')])){var _0x26b378=getMustacheRender(_0x28f1f4['vidaooMetadata'],_0x2f9954);var _0x512282=JSON[_0x563b('0x53')](_0x26b378);_0x5ce761[_0x563b('0x2d')][_0x563b('0x54')]=_0x512282;}}catch(_0x44e222){throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x57'));}return rp(_0x5ce761);}else{throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x58'));}})['then'](function(_0x21655b){_0x122d94=_0x21655b;if(_0x122d94['id']){var _0x1c9931={'body':_0x122d94['join_url'],'ChatWebsiteId':_0x28f1f4['id'],'ChatInteractionId':_0x4f870b['id'],'direction':_0x563b('0x59'),'UserId':_0x49ef91['user']['id']};return db[_0x563b('0x5a')][_0x563b('0x45')](_0x1c9931,{});}else{throw new db[(_0x563b('0x55'))][(_0x563b('0x56'))](_0x563b('0x5b'));}})[_0x563b('0x17')](function(){return _0x4f870b['updateAttributes']({'vidaooSessionId':_0x122d94['id']});})[_0x563b('0x17')](respondWithResult(_0xbfecbe,null))['catch'](handleError(_0xbfecbe,null));};exports[_0x563b('0x5c')]=function(_0xd9bab1,_0x1dcfea){if(_0xd9bab1['body']['id']){delete _0xd9bab1[_0x563b('0x2d')]['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0xd9bab1[_0x563b('0x3c')]['id']},'include':[{'model':db[_0x563b('0x5d')],'as':_0x563b('0x5e')}]})['then'](handleEntityNotFound(_0x1dcfea,null))[_0x563b('0x17')](saveUpdates(_0xd9bab1[_0x563b('0x2d')],null))[_0x563b('0x17')](respondWithResult(_0x1dcfea,null))[_0x563b('0x1f')](handleError(_0x1dcfea,null));};exports['abandon']=function(_0x14ae4d,_0x2ff09e){if(_0x14ae4d[_0x563b('0x2d')]['id']){delete _0x14ae4d[_0x563b('0x2d')]['id'];}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x14ae4d['params']['id']}})['then'](function(_0x3d150f){if(!_0x3d150f){logger['error'](_0x563b('0x5f'),'abandon',0x194,_0x563b('0x60'));_0x2ff09e[_0x563b('0x20')](0x194);}else{if(_0x3d150f['UserId']){throw new db['Sequelize'][(_0x563b('0x56'))](_0x563b('0x61'));}}return _0x3d150f;})[_0x563b('0x17')](function(_0x16cd46){if(_0x16cd46){return _0x16cd46[_0x563b('0x29')]({'closed':_0x14ae4d[_0x563b('0x2d')][_0x563b('0x62')],'disposition':_0x14ae4d[_0x563b('0x2d')][_0x563b('0x63')]})['then'](function(_0x564d32){return _0x564d32;});}})[_0x563b('0x17')](function(){return respondWithRpcPromise(_0x563b('0x64'),'abandon',_0x14ae4d[_0x563b('0x2d')],client9004);})['then'](respondWithResult(_0x2ff09e,null))[_0x563b('0x1f')](handleError(_0x2ff09e,null));};exports['attachmentUpload']=function(_0x395703,_0x4ca441){_0x395703[_0x563b('0x2d')][_0x563b('0x2b')]=_0x395703[_0x563b('0x65')][_0x563b('0x66')];_0x395703[_0x563b('0x2d')]['basename']=_0x395703[_0x563b('0x65')][_0x563b('0x67')];_0x395703['body'][_0x563b('0x35')]=_0x395703['file'][_0x563b('0x68')];return db[_0x563b('0x69')]['create'](_0x395703['body'])[_0x563b('0x17')](respondWithResult(_0x4ca441,0xc9))[_0x563b('0x1f')](handleError(_0x4ca441,null));};exports[_0x563b('0x6a')]=function(_0x13f7a0,_0x4cdb51){return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x13f7a0['params']['id']},'raw':!![]})[_0x563b('0x17')](handleEntityNotFound(_0x4cdb51,null))[_0x563b('0x17')](function(_0x1bb925){if(_0x1bb925){if(_0x1bb925['closed']){return _0x4cdb51[_0x563b('0x21')](0x193)[_0x563b('0x23')]({'status':0x193,'message':_0x563b('0x6b')});}return db[_0x563b('0x69')][_0x563b('0x49')]({'where':{'id':_0x13f7a0[_0x563b('0x3a')][_0x563b('0x6c')]},'raw':!![]})[_0x563b('0x17')](handleEntityNotFound(_0x4cdb51,null));}})[_0x563b('0x17')](function(_0x4b5411){if(_0x4b5411){var _0x59d329=_0x4b5411[_0x563b('0x6d')]!==null;var _0xe6df85=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0x70'));if(_0x59d329){_0xe6df85=path[_0x563b('0x6e')](_0xe6df85,'offline-chat/');}var _0x1c99cc=path['join'](_0xe6df85,_0x4b5411[_0x563b('0x71')]);return _0x4cdb51[_0x563b('0x72')](_0x1c99cc);}})['catch'](handleError(_0x4cdb51,null));};exports[_0x563b('0x73')]=function(_0x5de8ee,_0x12efea){var _0x2c9a0f=null;var _0x5e29a3=null;var _0x182317=null;if(_0x5de8ee[_0x563b('0x2d')]['id']){delete _0x5de8ee[_0x563b('0x2d')]['id'];}if(_0x5de8ee['body'][_0x563b('0x74')]){_0x182317=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0x75'),util[_0x563b('0x76')](_0x563b('0x77'),Date['now']()));_0x5de8ee[_0x563b('0x2d')][_0x563b('0x78')]=_0x182317;}return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x5de8ee[_0x563b('0x3c')]['id']},'include':[{'model':db[_0x563b('0x5a')],'as':_0x563b('0x79'),'include':[{'model':db[_0x563b('0x7a')],'as':_0x563b('0x7a')}]}]})[_0x563b('0x17')](handleEntityNotFound(_0x12efea,null))[_0x563b('0x17')](saveUpdates(_0x5de8ee[_0x563b('0x2d')],null))[_0x563b('0x17')](function(_0x322c5b){if(_0x322c5b){_0x2c9a0f=_0x322c5b;return db[_0x563b('0x4a')][_0x563b('0x46')]({'where':{'id':_0x2c9a0f[_0x563b('0x7b')]}});}})[_0x563b('0x17')](function(_0x3a5839){if(_0x3a5839){_0x5e29a3=_0x3a5839;return db[_0x563b('0x5d')]['find']({'where':{'id':_0x2c9a0f[_0x563b('0x7c')]}});}})[_0x563b('0x17')](function(_0x51d742){if(_0x51d742){if(_0x182317){var _0x970855=null;for(var _0xafbc42=0x1;_0xafbc42<_0x2c9a0f[_0x563b('0x79')][_0x563b('0x7d')];++_0xafbc42){_0x970855=_0x2c9a0f[_0x563b('0x79')][_0xafbc42];var _0xa33618=_0x970855[_0x563b('0x7e')]?util[_0x563b('0x76')](_0x563b('0x7f'),_0x5e29a3[_0x563b('0x80')],_0x970855[_0x563b('0x7e')]):_0x563b('0x81');var _0x58e2ba=_0x5de8ee[_0x563b('0x2d')][_0x563b('0x82')]||util[_0x563b('0x76')](_0x563b('0x7f'),_0x563b('0x83'),_0x970855['ContactId']);switch(_0x5e29a3[_0x563b('0x84')]){case _0x563b('0x85'):_0xa33618=_0x970855[_0x563b('0x7e')]?util[_0x563b('0x76')]('%s%d',_0x5e29a3[_0x563b('0x80')],_0x970855[_0x563b('0x7e')]):_0x563b('0x81');break;case _0x563b('0x86'):_0xa33618=_0x970855[_0x563b('0x7e')]?_0x970855['User'][_0x563b('0x87')]||_0x970855[_0x563b('0x7a')][_0x563b('0x88')]:_0x563b('0x81');break;case _0x563b('0x89'):_0xa33618=_0x970855[_0x563b('0x7e')]?_0x970855[_0x563b('0x7a')]['fullname']:_0x563b('0x81');break;default:_0xa33618=_0x970855['UserId']?util[_0x563b('0x76')]('%s%d',_0x5e29a3['agentAlias'],_0x970855[_0x563b('0x7e')]):'System';}var _0x4dfc2b=util[_0x563b('0x76')](_0x563b('0x8a'),moment(_0x970855[_0x563b('0x8b')])[_0x563b('0x76')](_0x563b('0x8c')),_0x970855[_0x563b('0x8d')]==='in'?_0x58e2ba:_0xa33618,_0x970855[_0x563b('0x2d')]);if(!_0x970855[_0x563b('0x8e')]){fs[_0x563b('0x8f')](_0x182317,_0x4dfc2b);}}return db['MailAccount'][_0x563b('0x49')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x563b('0x90')],'as':_0x563b('0x90'),'raw':!![]}]}]});}}})[_0x563b('0x17')](function(_0x2d5dcf){if(!_0x2d5dcf||!_0x2d5dcf[_0x563b('0x91')]||!_0x5de8ee[_0x563b('0x2d')])return _0x2c9a0f;var _0x58c210=_0x2d5dcf['getSmtpOptions']();return respondWithRpcPromise(_0x563b('0x92'),_0x563b('0x93'),{'account':_0x58c210,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2d5dcf['name'],_0x2d5dcf['email']||_0x2d5dcf[_0x563b('0x91')]['user']),'to':_0x5de8ee['body']['mailTranscript'],'subject':_0x563b('0x94'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x5de8ee['body'][_0x563b('0x74')]),'attachments':[{'path':_0x182317}]}})[_0x563b('0x17')](function(){return _0x2c9a0f;})[_0x563b('0x1f')](function(_0x4ecf85){logger['error'](_0x4ecf85);});})[_0x563b('0x17')](respondWithStatusCode(_0x12efea,0xc8))[_0x563b('0x1f')](handleError(_0x12efea,null));};exports['addMessage']=function(_0x598cc3,_0x31f6bb){return db[_0x563b('0x5a')][_0x563b('0x46')]({'where':{'id':_0x598cc3[_0x563b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x31f6bb,null))[_0x563b('0x17')](function(_0x4281cd){if(_0x4281cd){return _0x4281cd[_0x563b('0x95')](_0x598cc3[_0x563b('0x2d')][_0x563b('0x96')],_[_0x563b('0x97')](_0x598cc3[_0x563b('0x2d')],[_0x563b('0x96'),'id'])||{});}})['then'](respondWithResult(_0x31f6bb,null))[_0x563b('0x1f')](handleError(_0x31f6bb,null));};exports[_0x563b('0x98')]=function(_0x44a55e,_0x4ee59f){var _0x42c8f3={'raw':![],'where':{}};var _0x19802d={};var _0x511f11={'count':0x0,'rows':[]};return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0x44a55e['params']['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x4ee59f,null))[_0x563b('0x17')](function(_0xe849ab){if(_0xe849ab){_0x19802d[_0x563b('0x3d')]=_[_0x563b('0x3e')](db['ChatMessage']['rawAttributes']);_0x19802d[_0x563b('0x3a')]=_['keys'](_0x44a55e[_0x563b('0x3a')]);_0x19802d[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x19802d[_0x563b('0x3d')],_0x19802d[_0x563b('0x3a')]);_0x42c8f3['attributes']=_[_0x563b('0x40')](_0x19802d[_0x563b('0x3d')],qs['fields'](_0x44a55e[_0x563b('0x3a')][_0x563b('0x42')]));_0x42c8f3[_0x563b('0x41')]=_0x42c8f3[_0x563b('0x41')][_0x563b('0x7d')]?_0x42c8f3[_0x563b('0x41')]:_0x19802d['model'];if(!_0x44a55e[_0x563b('0x3a')][_0x563b('0x99')](_0x563b('0x9a'))){_0x42c8f3[_0x563b('0x25')]=qs['limit'](_0x44a55e[_0x563b('0x3a')][_0x563b('0x25')]);_0x42c8f3[_0x563b('0x27')]=qs[_0x563b('0x27')](_0x44a55e[_0x563b('0x3a')][_0x563b('0x27')]);}_0x42c8f3[_0x563b('0x9b')]=qs[_0x563b('0x9c')](_0x44a55e[_0x563b('0x3a')][_0x563b('0x9c')]);_0x42c8f3[_0x563b('0x9d')]=qs[_0x563b('0x3f')](_[_0x563b('0x9e')](_0x44a55e['query'],_0x19802d[_0x563b('0x3f')]));_0x42c8f3['where'][_0x563b('0x9f')]=_0xe849ab['id'];if(_0x44a55e[_0x563b('0x3a')][_0x563b('0xa0')]){_0x42c8f3[_0x563b('0x9d')]=_[_0x563b('0x44')](_0x42c8f3[_0x563b('0x9d')],{'$or':_[_0x563b('0x31')](_0x42c8f3[_0x563b('0x41')],function(_0x6d7899){var _0x40f06a={};_0x40f06a[_0x6d7899]={'$like':'%'+_0x44a55e[_0x563b('0x3a')]['filter']+'%'};return _0x40f06a;})});}if(_0x44a55e[_0x563b('0x3a')][_0x563b('0xa1')]){var _0x18c95b=_0x44a55e['query'][_0x563b('0xa1')][_0x563b('0xa2')](',');var _0x50a20c={};_0x50a20c[_0x18c95b[0x0]]={'$gte':moment(_0x18c95b[0x1])[_0x563b('0x76')](_0x563b('0xa3'))};_0x42c8f3[_0x563b('0x9d')]=_[_0x563b('0x44')](_0x42c8f3['where'],_0x50a20c);}_0x42c8f3=_[_0x563b('0x44')]({},_0x42c8f3,_0x44a55e[_0x563b('0xa4')]);return db[_0x563b('0x5a')][_0x563b('0x26')]({'where':_0x42c8f3[_0x563b('0x9d')]})[_0x563b('0x17')](function(_0x593feb){_0x511f11[_0x563b('0x26')]=_0x593feb;if(_0x44a55e[_0x563b('0x3a')]['includeAll']){_0x42c8f3[_0x563b('0x43')]=[{'all':!![]}];}return db[_0x563b('0x5a')]['findAll'](_0x42c8f3);})[_0x563b('0x17')](function(_0x15cedc){_0x511f11[_0x563b('0xa5')]=_0x15cedc;return _0x511f11;});}})[_0x563b('0x17')](respondWithFilteredResult(_0x4ee59f,_0x42c8f3))[_0x563b('0x1f')](handleError(_0x4ee59f,null));};exports[_0x563b('0xa6')]=function(_0xe44077,_0x2d4e28){var _0x417b1d={'where':{}},_0x5142d0={},_0x1069e1={'count':0x0,'rows':[]};return db[_0x563b('0x32')][_0x563b('0x49')]({'where':{'id':_0xe44077[_0x563b('0x3c')]['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x2d4e28,null))[_0x563b('0x17')](function(_0x641552){if(_0x641552){_0x5142d0[_0x563b('0x3d')]=_[_0x563b('0x3e')](db[_0x563b('0x5a')][_0x563b('0x33')]);_0x5142d0[_0x563b('0x3a')]=_['keys'](_0xe44077['query']);_0x5142d0[_0x563b('0x3f')]=_[_0x563b('0x40')](_0x5142d0['model'],_0x5142d0[_0x563b('0x3a')]);_0x417b1d['attributes']=_[_0x563b('0x40')](_0x5142d0[_0x563b('0x3d')],qs[_0x563b('0x42')](_0xe44077[_0x563b('0x3a')][_0x563b('0x42')]));_0x417b1d[_0x563b('0x41')]=_0x417b1d['attributes'][_0x563b('0x7d')]?_0x417b1d[_0x563b('0x41')]:_0x5142d0[_0x563b('0x3d')];if(!_0xe44077['query'][_0x563b('0x99')](_0x563b('0x9a'))){_0x417b1d[_0x563b('0x25')]=qs[_0x563b('0x25')](_0xe44077[_0x563b('0x3a')]['limit']);_0x417b1d['offset']=qs[_0x563b('0x27')](_0xe44077[_0x563b('0x3a')][_0x563b('0x27')]);}_0x417b1d[_0x563b('0x9b')]=qs[_0x563b('0x9c')](_0xe44077['query']['sort']);_0x417b1d[_0x563b('0x9d')]=qs[_0x563b('0x3f')](_['pick'](_0xe44077[_0x563b('0x3a')],_0x5142d0[_0x563b('0x3f')]));_0x417b1d['where'][_0x563b('0x9f')]=_0x641552['id'];if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa0')]){_0x417b1d['where']=_[_0x563b('0x44')](_0x417b1d[_0x563b('0x9d')],{'$or':_[_0x563b('0x31')](_0x417b1d[_0x563b('0x41')],function(_0x3562aa){var _0x500b40={};_0x500b40[_0x3562aa]={'$like':'%'+_0xe44077['query'][_0x563b('0xa0')]+'%'};return _0x500b40;})});}_0x417b1d[_0x563b('0x9d')][_0x563b('0x8e')]=![];if(_0xe44077[_0x563b('0x3a')]['id']){_0x417b1d[_0x563b('0x9d')]['id']={'$gt':_0xe44077[_0x563b('0x3a')]['id']};}_0x417b1d=_[_0x563b('0x44')]({},_0x417b1d,_0xe44077[_0x563b('0xa4')]);return db[_0x563b('0x5a')][_0x563b('0x26')]({'where':_0x417b1d[_0x563b('0x9d')]})[_0x563b('0x17')](function(_0x28e1a4){_0x1069e1[_0x563b('0x26')]=_0x28e1a4;_0x417b1d['include']=[];if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa7')]){_0x417b1d[_0x563b('0x43')][_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':_0x563b('0x7a'),'attributes':['id',_0x563b('0x88'),_0x563b('0x87')]});}if(_0xe44077[_0x563b('0x3a')][_0x563b('0xa9')]){_0x417b1d[_0x563b('0x43')]=[{'all':!![]}];}return db[_0x563b('0x5a')][_0x563b('0x38')](_0x417b1d);})[_0x563b('0x17')](function(_0x38cae7){_0x1069e1['rows']=_0x38cae7;return _0x1069e1;});}})[_0x563b('0x17')](respondWithFilteredResult(_0x2d4e28,_0x417b1d))[_0x563b('0x1f')](handleError(_0x2d4e28,null));};exports['addTags']=function(_0x436b52,_0x35075f){return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x436b52['params']['id']}})[_0x563b('0x17')](handleEntityNotFound(_0x35075f,null))['then'](function(_0x4c2072){if(_0x4c2072){return _0x4c2072[_0x563b('0xaa')](_0x436b52[_0x563b('0x2d')]['ids'],_[_0x563b('0x97')](_0x436b52['body'],[_0x563b('0x96'),'id'])||{})['spread'](function(){return db[_0x563b('0xab')]['findAll']({'attributes':['id',_0x563b('0x2b'),_0x563b('0xac')],'where':{'id':_0x436b52[_0x563b('0x2d')][_0x563b('0x96')]}});})[_0x563b('0x17')](function(_0x566399){socket[_0x563b('0xad')](_0x563b('0xae'),{'id':Number(_0x436b52[_0x563b('0x3c')]['id']),'tags':_0x566399||[]});return{'id':Number(_0x436b52[_0x563b('0x3c')]['id']),'tags':_0x566399||[]};});}})['then'](respondWithResult(_0x35075f,null))[_0x563b('0x1f')](handleError(_0x35075f,null));};exports[_0x563b('0xaf')]=function(_0x7e3bc1,_0x401571){return db['ChatInteraction'][_0x563b('0x46')]({'where':{'id':_0x7e3bc1[_0x563b('0x3c')]['id']}})['then'](handleEntityNotFound(_0x401571,null))[_0x563b('0x17')](function(_0x41b5d0){if(_0x41b5d0){return _0x41b5d0['removeTags'](_0x7e3bc1[_0x563b('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x401571,null))[_0x563b('0x1f')](handleError(_0x401571,null));};exports['download']=function(_0x441855,_0x6f0e21){var _0x49748a=moment()[_0x563b('0xb0')]()['toString']();var _0x5a96cc=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xb2'),_0x563b('0xb3'));var _0x3ab220=path[_0x563b('0x6e')](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xb2'),_0x563b('0xb4'));var _0x3bb5bb=path[_0x563b('0x6e')](_0x5a96cc,_0x49748a);var _0x1c0497=util[_0x563b('0x76')]('transcript-%d-%s.zip',_0x441855['params']['id'],_0x49748a);var _0x4dc176=path[_0x563b('0x6e')](_0x5a96cc,_0x1c0497);var _0x144548=[];_0x144548[_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x144548['push']({'model':db[_0x563b('0x5d')],'as':_0x563b('0x5e'),'attributes':['id',_0x563b('0xb5'),_0x563b('0xb6')],'raw':!![]});if(_0x441855[_0x563b('0x3a')][_0x563b('0xb4')]){_0x144548[_0x563b('0xa8')]({'model':db[_0x563b('0x69')],'as':_0x563b('0x69'),'raw':!![]});}var _0x5bfd02=[{'model':db[_0x563b('0x5a')],'as':'Messages','attributes':['id',_0x563b('0x2d'),_0x563b('0x8b'),_0x563b('0x8d'),_0x563b('0x8e'),'read'],'include':_0x144548}];_0x5bfd02[_0x563b('0xa8')]({'model':db[_0x563b('0x4a')],'as':'Account','attributes':['id','name']});_0x5bfd02[_0x563b('0xa8')]({'model':db[_0x563b('0x7a')],'as':_0x563b('0xb7'),'attributes':['id',_0x563b('0x88')]});return db[_0x563b('0x32')][_0x563b('0x46')]({'where':{'id':_0x441855['params']['id']},'include':_0x5bfd02})[_0x563b('0x17')](handleEntityNotFound(_0x6f0e21,null))['then'](function(_0x61a141){if(_0x61a141){var _0x4700ed=_0x61a141[_0x563b('0xb8')]({'plain':!![]});fs[_0x563b('0xb9')](_0x3bb5bb);var _0x4dcf4f={'channel':'Chat','account':_0x4700ed[_0x563b('0xba')][_0x563b('0x2b')],'agent':_0x4700ed[_0x563b('0xb7')]?_0x4700ed[_0x563b('0xb7')][_0x563b('0x88')]:_0x563b('0xbb'),'createdAt':moment(_0x4700ed['createdAt'])[_0x563b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')[_0x563b('0xbc')](),'closedAt':_0x4700ed[_0x563b('0x62')]?moment(_0x4700ed[_0x563b('0xbd')])[_0x563b('0x76')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x4700ed['disposition'],'chatInfo':{'browser':_0x4700ed[_0x563b('0xbe')],'os':_0x4700ed[_0x563b('0xbf')],'referer':_0x4700ed['referer'],'customerIp':_0x4700ed['customerIp'],'customerPort':_0x4700ed[_0x563b('0xc0')]?_0x4700ed[_0x563b('0xc0')]:_0x563b('0xbb')},'messages':_(_0x4700ed[_0x563b('0x79')])[_0x563b('0xc1')]()[_0x563b('0xa0')]({'secret':![]})[_0x563b('0x31')](function(_0x334f7f){if(_0x334f7f['Attachment']){var _0x53816e=path[_0x563b('0x6e')](_0x3ab220,_0x334f7f['Attachment'][_0x563b('0x71')]);if(fs['existsSync'](_0x53816e)){fs[_0x563b('0xc2')](_0x53816e)['pipe'](fs['createWriteStream'](path[_0x563b('0x6e')](_0x3bb5bb,_0x334f7f[_0x563b('0x69')][_0x563b('0x71')])));}}return{'date':moment(_0x334f7f[_0x563b('0x8b')])[_0x563b('0x76')](_0x563b('0xa3'))['toString'](),'sender':_0x334f7f[_0x563b('0x8d')]===_0x563b('0x59')?_0x334f7f[_0x563b('0x7a')]?_0x334f7f['User'][_0x563b('0x88')]:'System':_0x334f7f[_0x563b('0x5e')][_0x563b('0xb5')]+(_0x334f7f[_0x563b('0x5e')][_0x563b('0xb6')]?'\x20'+_0x334f7f[_0x563b('0x5e')][_0x563b('0xb6')]:''),'body':_0x334f7f[_0x563b('0x69')]?_0x334f7f['Attachment'][_0x563b('0x71')]:_0x334f7f[_0x563b('0x2d')],'direction':_0x334f7f[_0x563b('0x8d')]==='out'?'A':'C','secret':_0x334f7f[_0x563b('0x8e')],'read':_0x334f7f[_0x563b('0xc3')],'attachment':_0x334f7f[_0x563b('0x69')]};})[_0x563b('0xc4')]()};return ejs[_0x563b('0xc5')](path['join'](config[_0x563b('0x6f')],_0x563b('0xb1'),_0x563b('0xc6'),'downloadInteraction.ejs'),{'interaction':_0x4dcf4f})['then'](function(_0x3d9bc2){var _0x4cf79d=path[_0x563b('0x6e')](_0x3bb5bb,'transcript-'+_0x4700ed['id']+'-'+_0x49748a+_0x563b('0xc7'));var _0xe896da={'path':_0x4cf79d,'channel':_0x563b('0xc8'),'interactionId':_0x4700ed['id']};return pdf[_0x563b('0xc9')](_0x3d9bc2,_0xe896da);})['then'](function(){return new Promise(function(_0x3dab2d,_0x23ce9a){zipdir(_0x3bb5bb,{'saveTo':_0x4dc176},function(_0x4efeb3,_0x334156){if(_0x4efeb3)return _0x23ce9a(_0x4efeb3);return _0x3dab2d(_0x334156);});})[_0x563b('0x17')](function(){return new BPromise(function(_0x5a4010,_0x3e3416){rimraf(_0x3bb5bb,function(_0x37233b){if(_0x37233b)_0x3e3416(_0x37233b);return _0x5a4010();});});})[_0x563b('0x17')](function(){return _0x6f0e21[_0x563b('0x72')](_0x4dc176,_0x1c0497,function(_0x5b51ec){if(_0x5b51ec){logger[_0x563b('0x1a')](_0x563b('0xca'),_0x5b51ec);}else{fs[_0x563b('0xcb')](_0x4dc176);}});});});}else{return _0x6f0e21[_0x563b('0x20')](0xc8);}})[_0x563b('0x1f')](handleError(_0x6f0e21,null));}; \ No newline at end of file +var _0xe4dd=['Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','show','params','model','keys','filters','intersection','attributes','fields','query','length','includeAll','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','ChatMessage','Messages','User','ContactId','UserId','%s%d','System','customer','website_alias','agentAlias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','hasOwnProperty','addTags','spread','Tag','color','emit','chatInteractionTags:save','toString','server','files','tmp','transcript-%d-%s.zip','push','firstName','lastName','attachments','direction','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x3f4cd0,_0x303070){var _0x3f9f01=function(_0x6ced93){while(--_0x6ced93){_0x3f4cd0['push'](_0x3f4cd0['shift']());}};_0x3f9f01(++_0x303070);}(_0xe4dd,0xa8));var _0xde4d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xe4dd[_0xd1d19a];return _0x52a79d;};'use strict';var rimraf=require(_0xde4d('0x0'));var zipdir=require(_0xde4d('0x1'));var rp=require(_0xde4d('0x2'));var moment=require(_0xde4d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde4d('0x4'));var util=require(_0xde4d('0x5'));var path=require(_0xde4d('0x6'));var ejs=require(_0xde4d('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xde4d('0x8'));var qs=require(_0xde4d('0x9'));var pdf=require(_0xde4d('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xde4d('0xb'));var db=require(_0xde4d('0xc'))['db'];config['redis']=_['defaults'](config[_0xde4d('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde4d('0xd')]));require(_0xde4d('0xe'))[_0xde4d('0xf')](socket);var jayson=require(_0xde4d('0x10'));var client=jayson['client'][_0xde4d('0x11')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x427e63,_0x10693c,_0x320e74,_0x54aab9){return new BPromise(function(_0x1b8106,_0x569c01){var _0x23e04c=_0x54aab9||client;return _0x23e04c[_0xde4d('0x12')](_0x427e63,_0x320e74)[_0xde4d('0x13')](function(_0x5cbe3c){logger[_0xde4d('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x10693c,_0xde4d('0x15'));logger[_0xde4d('0x16')](_0xde4d('0x17'),_0x10693c,_0xde4d('0x15'),JSON[_0xde4d('0x18')](_0x5cbe3c));if(_0x5cbe3c['error']){if(_0x5cbe3c[_0xde4d('0x19')][_0xde4d('0x1a')]===0x1f4){logger['error'](_0xde4d('0x1b'),_0x10693c,_0x5cbe3c[_0xde4d('0x19')][_0xde4d('0x1c')]);return _0x569c01(_0x5cbe3c[_0xde4d('0x19')][_0xde4d('0x1c')]);}logger[_0xde4d('0x19')](_0xde4d('0x1b'),_0x10693c,_0x5cbe3c[_0xde4d('0x19')][_0xde4d('0x1c')]);return _0x1b8106(_0x5cbe3c[_0xde4d('0x19')][_0xde4d('0x1c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x10693c,_0xde4d('0x15'));_0x1b8106(_0x5cbe3c[_0xde4d('0x1d')][_0xde4d('0x1c')]);}})[_0xde4d('0x1e')](function(_0x549c04){logger[_0xde4d('0x19')](_0xde4d('0x1b'),_0x10693c,_0x549c04);_0x569c01(_0x549c04);});});}function respondWithStatusCode(_0x212366,_0x72c0d1){_0x72c0d1=_0x72c0d1||0xcc;return function(_0x8555b3){if(_0x8555b3){return _0x212366[_0xde4d('0x1f')](_0x72c0d1);}return _0x212366[_0xde4d('0x20')](_0x72c0d1)[_0xde4d('0x21')]();};}function respondWithResult(_0x4da0ec,_0x925a7a){_0x925a7a=_0x925a7a||0xc8;return function(_0x5487fa){if(_0x5487fa){return _0x4da0ec[_0xde4d('0x20')](_0x925a7a)[_0xde4d('0x22')](_0x5487fa);}};}function respondWithFilteredResult(_0x4b63bb,_0x3f8639){return function(_0x3506e2){if(_0x3506e2){var _0x3f04ee=typeof _0x3f8639[_0xde4d('0x23')]===_0xde4d('0x24')&&typeof _0x3f8639[_0xde4d('0x25')]===_0xde4d('0x24');var _0x16d850=_0x3506e2[_0xde4d('0x26')];var _0x10b6e9=_0x3f04ee?0x0:_0x3f8639[_0xde4d('0x23')];var _0x4f9c1c=_0x3f04ee?_0x3506e2[_0xde4d('0x26')]:_0x3f8639['offset']+_0x3f8639[_0xde4d('0x25')];var _0x50de7b;if(_0x4f9c1c>=_0x16d850){_0x4f9c1c=_0x16d850;_0x50de7b=0xc8;}else{_0x50de7b=0xce;}_0x4b63bb[_0xde4d('0x20')](_0x50de7b);return _0x4b63bb[_0xde4d('0x27')](_0xde4d('0x28'),_0x10b6e9+'-'+_0x4f9c1c+'/'+_0x16d850)['json'](_0x3506e2);}return null;};}function saveUpdates(_0x5db01){return function(_0x3859fa){if(_0x3859fa){return _0x3859fa[_0xde4d('0x29')](_0x5db01)['then'](function(_0x14a922){return _0x14a922;});}return null;};}function removeEntity(_0x37e78d){return function(_0x16c2a3){if(_0x16c2a3){return _0x16c2a3[_0xde4d('0x2a')]()[_0xde4d('0x13')](function(){_0x37e78d[_0xde4d('0x20')](0xcc)[_0xde4d('0x21')]();});}};}function handleEntityNotFound(_0x4f4f02){return function(_0x2584f3){if(!_0x2584f3){_0x4f4f02['sendStatus'](0x194);}return _0x2584f3;};}function handleError(_0x21778f,_0x353d58){_0x353d58=_0x353d58||0x1f4;return function(_0x43aa5b){logger[_0xde4d('0x19')](_0x43aa5b[_0xde4d('0x2b')]);if(_0x43aa5b[_0xde4d('0x2c')]){delete _0x43aa5b[_0xde4d('0x2c')];}_0x21778f[_0xde4d('0x20')](_0x353d58)[_0xde4d('0x2d')](_0x43aa5b);};}function getMustacheRender(_0x1b2c1c,_0x1d8c9b){return Mustache[_0xde4d('0x2e')](_0x1b2c1c,_[_0xde4d('0x2f')](_0x1d8c9b[_0xde4d('0x30')],{'contact':_0x1d8c9b[_0xde4d('0x31')],'message':_0x1d8c9b[_0xde4d('0x1c')],'agent':_0x1d8c9b[_0xde4d('0x32')],'interaction':_0x1d8c9b[_0xde4d('0x33')],'account':_0x1d8c9b[_0xde4d('0x34')]}))||'';}exports[_0xde4d('0x35')]=function(_0x2e6429,_0x4d63e8){var _0x22b51e={};var _0x3011bc=_[_0xde4d('0x36')](db[_0xde4d('0x37')][_0xde4d('0x38')],function(_0x1bf1b1){return{'name':_0x1bf1b1[_0xde4d('0x39')],'type':_0x1bf1b1[_0xde4d('0x3a')][_0xde4d('0x3b')]};});_0x22b51e=qs[_0xde4d('0x3c')](_0x3011bc,_0x2e6429);return interaction[_0xde4d('0x3d')]('chat',_0x2e6429['query'],_0x2e6429['user'],_0x22b51e,_0x3011bc)[_0xde4d('0x13')](respondWithFilteredResult(_0x4d63e8,_0x22b51e))[_0xde4d('0x1e')](handleError(_0x4d63e8,null));};exports[_0xde4d('0x3e')]=function(_0x265126,_0x325548){var _0x14cd4b={'raw':![],'where':{'id':_0x265126[_0xde4d('0x3f')]['id']}},_0x3b1870={};_0x3b1870[_0xde4d('0x40')]=_[_0xde4d('0x41')](db[_0xde4d('0x37')]['rawAttributes']);_0x3b1870['query']=_[_0xde4d('0x41')](_0x265126['query']);_0x3b1870[_0xde4d('0x42')]=_[_0xde4d('0x43')](_0x3b1870[_0xde4d('0x40')],_0x3b1870['query']);_0x14cd4b[_0xde4d('0x44')]=_[_0xde4d('0x43')](_0x3b1870[_0xde4d('0x40')],qs[_0xde4d('0x45')](_0x265126[_0xde4d('0x46')]['fields']));_0x14cd4b['attributes']=_0x14cd4b[_0xde4d('0x44')][_0xde4d('0x47')]?_0x14cd4b[_0xde4d('0x44')]:_0x3b1870[_0xde4d('0x40')];if(_0x265126[_0xde4d('0x46')][_0xde4d('0x48')]){_0x14cd4b['include']=[{'all':!![]}];}_0x14cd4b=_[_0xde4d('0x2f')]({},_0x14cd4b,_0x265126[_0xde4d('0x49')]);return db[_0xde4d('0x37')][_0xde4d('0x4a')](_0x14cd4b)[_0xde4d('0x13')](handleEntityNotFound(_0x325548,null))[_0xde4d('0x13')](respondWithResult(_0x325548,null))['catch'](handleError(_0x325548,null));};exports[_0xde4d('0x4b')]=function(_0x3acf6b,_0x44fcce){return db[_0xde4d('0x37')][_0xde4d('0x4b')](_0x3acf6b[_0xde4d('0x30')],{})[_0xde4d('0x13')](respondWithResult(_0x44fcce,0xc9))[_0xde4d('0x1e')](handleError(_0x44fcce,null));};exports['update']=function(_0x7534cd,_0x11853e){if(_0x7534cd['body']['id']){delete _0x7534cd[_0xde4d('0x30')]['id'];}return db[_0xde4d('0x37')][_0xde4d('0x4a')]({'where':{'id':_0x7534cd[_0xde4d('0x3f')]['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0x11853e,null))['then'](saveUpdates(_0x7534cd[_0xde4d('0x30')],null))[_0xde4d('0x13')](respondWithResult(_0x11853e,null))[_0xde4d('0x1e')](handleError(_0x11853e,null));};exports['destroy']=function(_0x6ab3b0,_0xe19d91){return db[_0xde4d('0x37')][_0xde4d('0x4a')]({'where':{'id':_0x6ab3b0[_0xde4d('0x3f')]['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0xe19d91,null))[_0xde4d('0x13')](removeEntity(_0xe19d91,null))[_0xde4d('0x1e')](handleError(_0xe19d91,null));};exports[_0xde4d('0x4c')]=function(_0xf095a9,_0x31d6b4){return db[_0xde4d('0x37')][_0xde4d('0x4c')]()['then'](respondWithResult(_0x31d6b4,null))[_0xde4d('0x1e')](handleError(_0x31d6b4,null));};exports[_0xde4d('0x4d')]=function(_0x5da51f,_0x3d2e01){var _0x4f2feb=_0x5da51f[_0xde4d('0x3f')]['id'];var _0xcf3a37;var _0x1f9ecd;var _0x47c5f1;return db[_0xde4d('0x37')][_0xde4d('0x4e')]({'where':{'id':_0x4f2feb}})[_0xde4d('0x13')](function(_0x473c5c){_0xcf3a37=_0x473c5c;return db[_0xde4d('0x4f')][_0xde4d('0x4e')]({'where':{'id':_0x473c5c[_0xde4d('0x50')]},'attributes':['id',_0xde4d('0x51'),_0xde4d('0x52'),_0xde4d('0x53'),_0xde4d('0x54'),_0xde4d('0x55')],'raw':!![]});})[_0xde4d('0x13')](function(_0x295ca9){if(_0x295ca9&&_0x295ca9[_0xde4d('0x51')]&&_0x295ca9[_0xde4d('0x52')]){_0x1f9ecd=_0x295ca9;var _0x3eb7fd={'interaction':{'id':_0x4f2feb},'agent':{'id':_0x5da51f[_0xde4d('0x56')]['id'],'name':_0x5da51f[_0xde4d('0x56')]['name'],'fullname':_0x5da51f['user'][_0xde4d('0x57')],'email':_0x5da51f[_0xde4d('0x56')][_0xde4d('0x58')]},'contact':_0x5da51f[_0xde4d('0x30')][_0xde4d('0x31')],'account':_0x5da51f[_0xde4d('0x30')][_0xde4d('0x34')]};var _0xc5d9b5={'rejectUnauthorized':![],'method':_0xde4d('0x59'),'url':_0xde4d('0x5a'),'headers':{'X-APIKEY':_0x295ca9[_0xde4d('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5da51f[_0xde4d('0x56')]['email']],'buttons':null,'topic':_0x1f9ecd[_0xde4d('0x53')],'note':_['isNull'](_0x1f9ecd[_0xde4d('0x54')])?null:getMustacheRender(_0x1f9ecd[_0xde4d('0x54')],_0x3eb7fd),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xde4d('0x5b')](_0x1f9ecd[_0xde4d('0x55')])){var _0x4d57c5=getMustacheRender(_0x1f9ecd[_0xde4d('0x55')],_0x3eb7fd);var _0x37259d=JSON[_0xde4d('0x5c')](_0x4d57c5);_0xc5d9b5[_0xde4d('0x30')][_0xde4d('0x5d')]=_0x37259d;}}catch(_0x5a3f20){throw new db[(_0xde4d('0x5e'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xc5d9b5);}else{throw new db[(_0xde4d('0x5e'))][(_0xde4d('0x5f'))](_0xde4d('0x60'));}})[_0xde4d('0x13')](function(_0x3322d3){_0x47c5f1=_0x3322d3;if(_0x47c5f1['id']){var _0x4e4751={'body':_0x47c5f1['join_url'],'ChatWebsiteId':_0x1f9ecd['id'],'ChatInteractionId':_0xcf3a37['id'],'direction':_0xde4d('0x61'),'UserId':_0x5da51f[_0xde4d('0x56')]['id']};return db['ChatMessage'][_0xde4d('0x4b')](_0x4e4751,{});}else{throw new db[(_0xde4d('0x5e'))][(_0xde4d('0x5f'))](_0xde4d('0x62'));}})[_0xde4d('0x13')](function(){return _0xcf3a37[_0xde4d('0x63')]({'vidaooSessionId':_0x47c5f1['id']});})['then'](respondWithResult(_0x3d2e01,null))[_0xde4d('0x1e')](handleError(_0x3d2e01,null));};exports['customUpdate']=function(_0x558edc,_0x153d72){if(_0x558edc[_0xde4d('0x30')]['id']){delete _0x558edc[_0xde4d('0x30')]['id'];}return db['ChatInteraction'][_0xde4d('0x4a')]({'where':{'id':_0x558edc[_0xde4d('0x3f')]['id']},'include':[{'model':db[_0xde4d('0x64')],'as':_0xde4d('0x65')}]})[_0xde4d('0x13')](handleEntityNotFound(_0x153d72,null))['then'](saveUpdates(_0x558edc['body'],null))[_0xde4d('0x13')](respondWithResult(_0x153d72,null))[_0xde4d('0x1e')](handleError(_0x153d72,null));};exports[_0xde4d('0x66')]=function(_0x53cb86,_0x352d9a){if(_0x53cb86['body']['id']){delete _0x53cb86[_0xde4d('0x30')]['id'];}return db[_0xde4d('0x37')]['find']({'where':{'id':_0x53cb86[_0xde4d('0x3f')]['id']}})[_0xde4d('0x13')](function(_0x52fa9b){if(!_0x52fa9b){logger[_0xde4d('0x19')](_0xde4d('0x67'),_0xde4d('0x66'),0x194,_0xde4d('0x68'));_0x352d9a['sendStatus'](0x194);}else{if(_0x52fa9b['UserId']){throw new db[(_0xde4d('0x5e'))][(_0xde4d('0x5f'))](_0xde4d('0x69'));}}return _0x52fa9b;})['then'](function(_0x1d317c){if(_0x1d317c){return _0x1d317c['update']({'closed':_0x53cb86[_0xde4d('0x30')][_0xde4d('0x6a')],'disposition':_0x53cb86[_0xde4d('0x30')][_0xde4d('0x6b')]})[_0xde4d('0x13')](function(_0x59c5b5){return _0x59c5b5;});}})['then'](function(){return respondWithRpcPromise(_0xde4d('0x6c'),_0xde4d('0x66'),_0x53cb86[_0xde4d('0x30')],client9004);})[_0xde4d('0x13')](respondWithResult(_0x352d9a,null))[_0xde4d('0x1e')](handleError(_0x352d9a,null));};exports[_0xde4d('0x6d')]=function(_0x16d9e4,_0x4b6dcf){_0x16d9e4[_0xde4d('0x30')][_0xde4d('0x2c')]=_0x16d9e4[_0xde4d('0x6e')][_0xde4d('0x6f')];_0x16d9e4[_0xde4d('0x30')]['basename']=_0x16d9e4[_0xde4d('0x6e')]['filename'];_0x16d9e4[_0xde4d('0x30')][_0xde4d('0x3a')]=_0x16d9e4[_0xde4d('0x6e')][_0xde4d('0x70')];return db[_0xde4d('0x71')]['create'](_0x16d9e4[_0xde4d('0x30')])[_0xde4d('0x13')](respondWithResult(_0x4b6dcf,0xc9))[_0xde4d('0x1e')](handleError(_0x4b6dcf,null));};exports[_0xde4d('0x72')]=function(_0x8b8b23,_0x91862a){return db[_0xde4d('0x37')][_0xde4d('0x4e')]({'where':{'id':_0x8b8b23[_0xde4d('0x3f')]['id']},'raw':!![]})[_0xde4d('0x13')](handleEntityNotFound(_0x91862a,null))[_0xde4d('0x13')](function(_0x44ed94){if(_0x44ed94){if(_0x44ed94[_0xde4d('0x6a')]){return _0x91862a[_0xde4d('0x20')](0x193)[_0xde4d('0x22')]({'status':0x193,'message':_0xde4d('0x73')});}return db[_0xde4d('0x71')][_0xde4d('0x4e')]({'where':{'id':_0x8b8b23[_0xde4d('0x46')][_0xde4d('0x74')]},'raw':!![]})['then'](handleEntityNotFound(_0x91862a,null));}})[_0xde4d('0x13')](function(_0x36e51c){if(_0x36e51c){var _0x44ec61=_0x36e51c[_0xde4d('0x75')]!==null;var _0x11fc0d=path[_0xde4d('0x76')](config[_0xde4d('0x77')],_0xde4d('0x78'));if(_0x44ec61){_0x11fc0d=path[_0xde4d('0x76')](_0x11fc0d,_0xde4d('0x79'));}var _0x993d19=path[_0xde4d('0x76')](_0x11fc0d,_0x36e51c[_0xde4d('0x7a')]);return _0x91862a[_0xde4d('0x7b')](_0x993d19);}})[_0xde4d('0x1e')](handleError(_0x91862a,null));};exports[_0xde4d('0x7c')]=function(_0x6f64d4,_0x46d129){var _0xcbd990=null;var _0x481b61=null;var _0x3aff8d=null;if(_0x6f64d4[_0xde4d('0x30')]['id']){delete _0x6f64d4[_0xde4d('0x30')]['id'];}if(_0x6f64d4['body'][_0xde4d('0x7d')]){_0x3aff8d=path[_0xde4d('0x76')](config[_0xde4d('0x77')],_0xde4d('0x7e'),util[_0xde4d('0x7f')]('transcript-%s.txt',Date[_0xde4d('0x80')]()));_0x6f64d4[_0xde4d('0x30')][_0xde4d('0x81')]=_0x3aff8d;}return db['ChatInteraction'][_0xde4d('0x4a')]({'where':{'id':_0x6f64d4['params']['id']},'include':[{'model':db[_0xde4d('0x82')],'as':_0xde4d('0x83'),'include':[{'model':db[_0xde4d('0x84')],'as':_0xde4d('0x84')}]}]})[_0xde4d('0x13')](handleEntityNotFound(_0x46d129,null))[_0xde4d('0x13')](saveUpdates(_0x6f64d4[_0xde4d('0x30')],null))[_0xde4d('0x13')](function(_0x25d67c){if(_0x25d67c){_0xcbd990=_0x25d67c;return db[_0xde4d('0x4f')][_0xde4d('0x4a')]({'where':{'id':_0xcbd990[_0xde4d('0x50')]}});}})[_0xde4d('0x13')](function(_0x29dc11){if(_0x29dc11){_0x481b61=_0x29dc11;return db['CmContact'][_0xde4d('0x4a')]({'where':{'id':_0xcbd990[_0xde4d('0x85')]}});}})[_0xde4d('0x13')](function(_0x551a07){if(_0x551a07){if(_0x3aff8d){var _0x621631=null;for(var _0x105431=0x1;_0x105431<_0xcbd990[_0xde4d('0x83')]['length'];++_0x105431){_0x621631=_0xcbd990[_0xde4d('0x83')][_0x105431];var _0x365ac6=_0x621631[_0xde4d('0x86')]?util[_0xde4d('0x7f')](_0xde4d('0x87'),_0x481b61['agentAlias'],_0x621631[_0xde4d('0x86')]):_0xde4d('0x88');var _0x3f5c3f=_0x6f64d4[_0xde4d('0x30')][_0xde4d('0x89')]||util[_0xde4d('0x7f')](_0xde4d('0x87'),'Visitor',_0x621631[_0xde4d('0x85')]);switch(_0x481b61['agentIdentifier']){case _0xde4d('0x8a'):_0x365ac6=_0x621631[_0xde4d('0x86')]?util[_0xde4d('0x7f')]('%s%d',_0x481b61[_0xde4d('0x8b')],_0x621631['UserId']):'System';break;case'agent_alias':_0x365ac6=_0x621631['UserId']?_0x621631[_0xde4d('0x84')][_0xde4d('0x8c')]||_0x621631[_0xde4d('0x84')][_0xde4d('0x57')]:_0xde4d('0x88');break;case _0xde4d('0x8d'):_0x365ac6=_0x621631[_0xde4d('0x86')]?_0x621631['User'][_0xde4d('0x57')]:_0xde4d('0x88');break;default:_0x365ac6=_0x621631['UserId']?util[_0xde4d('0x7f')](_0xde4d('0x87'),_0x481b61[_0xde4d('0x8b')],_0x621631[_0xde4d('0x86')]):_0xde4d('0x88');}var _0x43ccdd=util['format'](_0xde4d('0x8e'),moment(_0x621631[_0xde4d('0x8f')])[_0xde4d('0x7f')](_0xde4d('0x90')),_0x621631['direction']==='in'?_0x3f5c3f:_0x365ac6,_0x621631[_0xde4d('0x30')]);if(!_0x621631[_0xde4d('0x91')]){fs[_0xde4d('0x92')](_0x3aff8d,_0x43ccdd);}}return db[_0xde4d('0x93')][_0xde4d('0x4e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xde4d('0x94'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xde4d('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x48d787){if(!_0x48d787||!_0x48d787[_0xde4d('0x94')]||!_0x6f64d4[_0xde4d('0x30')])return _0xcbd990;var _0x954411=_0x48d787[_0xde4d('0x96')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x954411,'message':{'from':util[_0xde4d('0x7f')](_0xde4d('0x97'),_0x48d787['name'],_0x48d787[_0xde4d('0x58')]||_0x48d787[_0xde4d('0x94')][_0xde4d('0x56')]),'to':_0x6f64d4[_0xde4d('0x30')][_0xde4d('0x7d')],'subject':_0xde4d('0x98'),'text':util[_0xde4d('0x7f')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x6f64d4['body'][_0xde4d('0x7d')]),'attachments':[{'path':_0x3aff8d}]}})[_0xde4d('0x13')](function(){return _0xcbd990;})[_0xde4d('0x1e')](function(_0x51bdaa){logger[_0xde4d('0x19')](_0x51bdaa);});})['then'](respondWithStatusCode(_0x46d129,0xc8))['catch'](handleError(_0x46d129,null));};exports[_0xde4d('0x99')]=function(_0x5ed162,_0x1e33d8){return db['ChatMessage'][_0xde4d('0x4a')]({'where':{'id':_0x5ed162['params']['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0x1e33d8,null))['then'](function(_0x104f0e){if(_0x104f0e){return _0x104f0e['addMessage'](_0x5ed162[_0xde4d('0x30')][_0xde4d('0x9a')],_[_0xde4d('0x9b')](_0x5ed162[_0xde4d('0x30')],['ids','id'])||{});}})[_0xde4d('0x13')](respondWithResult(_0x1e33d8,null))[_0xde4d('0x1e')](handleError(_0x1e33d8,null));};exports[_0xde4d('0x9c')]=function(_0xbd7c46,_0x51a0de){var _0x2deceb={'raw':![],'where':{}};var _0x57881b={};var _0x29feb3={'count':0x0,'rows':[]};return db[_0xde4d('0x37')][_0xde4d('0x4e')]({'where':{'id':_0xbd7c46['params']['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0x51a0de,null))[_0xde4d('0x13')](function(_0x1595fb){if(_0x1595fb){_0x57881b['model']=_[_0xde4d('0x41')](db['ChatMessage'][_0xde4d('0x38')]);_0x57881b['query']=_[_0xde4d('0x41')](_0xbd7c46[_0xde4d('0x46')]);_0x57881b[_0xde4d('0x42')]=_[_0xde4d('0x43')](_0x57881b[_0xde4d('0x40')],_0x57881b[_0xde4d('0x46')]);_0x2deceb[_0xde4d('0x44')]=_[_0xde4d('0x43')](_0x57881b[_0xde4d('0x40')],qs[_0xde4d('0x45')](_0xbd7c46[_0xde4d('0x46')][_0xde4d('0x45')]));_0x2deceb['attributes']=_0x2deceb[_0xde4d('0x44')]['length']?_0x2deceb[_0xde4d('0x44')]:_0x57881b[_0xde4d('0x40')];if(!_0xbd7c46[_0xde4d('0x46')]['hasOwnProperty']('nolimit')){_0x2deceb['limit']=qs[_0xde4d('0x25')](_0xbd7c46[_0xde4d('0x46')][_0xde4d('0x25')]);_0x2deceb['offset']=qs[_0xde4d('0x23')](_0xbd7c46[_0xde4d('0x46')][_0xde4d('0x23')]);}_0x2deceb[_0xde4d('0x9d')]=qs[_0xde4d('0x9e')](_0xbd7c46[_0xde4d('0x46')][_0xde4d('0x9e')]);_0x2deceb[_0xde4d('0x9f')]=qs[_0xde4d('0x42')](_[_0xde4d('0xa0')](_0xbd7c46['query'],_0x57881b[_0xde4d('0x42')]));_0x2deceb[_0xde4d('0x9f')][_0xde4d('0xa1')]=_0x1595fb['id'];if(_0xbd7c46[_0xde4d('0x46')][_0xde4d('0xa2')]){_0x2deceb[_0xde4d('0x9f')]=_[_0xde4d('0x2f')](_0x2deceb[_0xde4d('0x9f')],{'$or':_[_0xde4d('0x36')](_0x2deceb[_0xde4d('0x44')],function(_0x2dbd42){var _0x57144d={};_0x57144d[_0x2dbd42]={'$like':'%'+_0xbd7c46[_0xde4d('0x46')]['filter']+'%'};return _0x57144d;})});}if(_0xbd7c46[_0xde4d('0x46')][_0xde4d('0xa3')]){var _0x312939=_0xbd7c46[_0xde4d('0x46')][_0xde4d('0xa3')][_0xde4d('0xa4')](',');var _0x39fa88={};_0x39fa88[_0x312939[0x0]]={'$gte':moment(_0x312939[0x1])[_0xde4d('0x7f')](_0xde4d('0xa5'))};_0x2deceb['where']=_[_0xde4d('0x2f')](_0x2deceb[_0xde4d('0x9f')],_0x39fa88);}_0x2deceb=_['merge']({},_0x2deceb,_0xbd7c46[_0xde4d('0x49')]);return db[_0xde4d('0x82')][_0xde4d('0x26')]({'where':_0x2deceb[_0xde4d('0x9f')]})[_0xde4d('0x13')](function(_0x45bab9){_0x29feb3['count']=_0x45bab9;if(_0xbd7c46['query'][_0xde4d('0x48')]){_0x2deceb[_0xde4d('0xa6')]=[{'all':!![]}];}return db[_0xde4d('0x82')][_0xde4d('0x3d')](_0x2deceb);})[_0xde4d('0x13')](function(_0x3fc3a6){_0x29feb3[_0xde4d('0xa7')]=_0x3fc3a6;return _0x29feb3;});}})[_0xde4d('0x13')](respondWithFilteredResult(_0x51a0de,_0x2deceb))[_0xde4d('0x1e')](handleError(_0x51a0de,null));};exports[_0xde4d('0xa8')]=function(_0x122ee5,_0xe019d8){var _0x51ab0b={'where':{}},_0x30b7c0={},_0x437444={'count':0x0,'rows':[]};return db[_0xde4d('0x37')][_0xde4d('0x4e')]({'where':{'id':_0x122ee5['params']['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0xe019d8,null))[_0xde4d('0x13')](function(_0x381696){if(_0x381696){_0x30b7c0['model']=_[_0xde4d('0x41')](db[_0xde4d('0x82')][_0xde4d('0x38')]);_0x30b7c0[_0xde4d('0x46')]=_['keys'](_0x122ee5[_0xde4d('0x46')]);_0x30b7c0['filters']=_[_0xde4d('0x43')](_0x30b7c0[_0xde4d('0x40')],_0x30b7c0[_0xde4d('0x46')]);_0x51ab0b[_0xde4d('0x44')]=_[_0xde4d('0x43')](_0x30b7c0[_0xde4d('0x40')],qs[_0xde4d('0x45')](_0x122ee5[_0xde4d('0x46')][_0xde4d('0x45')]));_0x51ab0b[_0xde4d('0x44')]=_0x51ab0b[_0xde4d('0x44')][_0xde4d('0x47')]?_0x51ab0b[_0xde4d('0x44')]:_0x30b7c0['model'];if(!_0x122ee5[_0xde4d('0x46')][_0xde4d('0xa9')]('nolimit')){_0x51ab0b[_0xde4d('0x25')]=qs[_0xde4d('0x25')](_0x122ee5[_0xde4d('0x46')][_0xde4d('0x25')]);_0x51ab0b[_0xde4d('0x23')]=qs['offset'](_0x122ee5[_0xde4d('0x46')][_0xde4d('0x23')]);}_0x51ab0b[_0xde4d('0x9d')]=qs[_0xde4d('0x9e')](_0x122ee5[_0xde4d('0x46')][_0xde4d('0x9e')]);_0x51ab0b[_0xde4d('0x9f')]=qs['filters'](_[_0xde4d('0xa0')](_0x122ee5[_0xde4d('0x46')],_0x30b7c0[_0xde4d('0x42')]));_0x51ab0b[_0xde4d('0x9f')][_0xde4d('0xa1')]=_0x381696['id'];if(_0x122ee5[_0xde4d('0x46')][_0xde4d('0xa2')]){_0x51ab0b[_0xde4d('0x9f')]=_[_0xde4d('0x2f')](_0x51ab0b[_0xde4d('0x9f')],{'$or':_[_0xde4d('0x36')](_0x51ab0b[_0xde4d('0x44')],function(_0x5ac0da){var _0x5f03c9={};_0x5f03c9[_0x5ac0da]={'$like':'%'+_0x122ee5['query'][_0xde4d('0xa2')]+'%'};return _0x5f03c9;})});}_0x51ab0b[_0xde4d('0x9f')][_0xde4d('0x91')]=![];if(_0x122ee5[_0xde4d('0x46')]['id']){_0x51ab0b[_0xde4d('0x9f')]['id']={'$gt':_0x122ee5[_0xde4d('0x46')]['id']};}_0x51ab0b=_[_0xde4d('0x2f')]({},_0x51ab0b,_0x122ee5['options']);return db['ChatMessage'][_0xde4d('0x26')]({'where':_0x51ab0b['where']})[_0xde4d('0x13')](function(_0x23b529){_0x437444[_0xde4d('0x26')]=_0x23b529;_0x51ab0b[_0xde4d('0xa6')]=[];if(_0x122ee5[_0xde4d('0x46')]['includeAgent']){_0x51ab0b[_0xde4d('0xa6')]['push']({'model':db[_0xde4d('0x84')],'as':_0xde4d('0x84'),'attributes':['id',_0xde4d('0x57'),_0xde4d('0x8c')]});}if(_0x122ee5[_0xde4d('0x46')][_0xde4d('0x48')]){_0x51ab0b[_0xde4d('0xa6')]=[{'all':!![]}];}return db['ChatMessage'][_0xde4d('0x3d')](_0x51ab0b);})['then'](function(_0x280283){_0x437444[_0xde4d('0xa7')]=_0x280283;return _0x437444;});}})[_0xde4d('0x13')](respondWithFilteredResult(_0xe019d8,_0x51ab0b))[_0xde4d('0x1e')](handleError(_0xe019d8,null));};exports[_0xde4d('0xaa')]=function(_0x5af129,_0x44d432){return db[_0xde4d('0x37')][_0xde4d('0x4a')]({'where':{'id':_0x5af129[_0xde4d('0x3f')]['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0x44d432,null))[_0xde4d('0x13')](function(_0x18e2b6){if(_0x18e2b6){return _0x18e2b6['setTags'](_0x5af129[_0xde4d('0x30')][_0xde4d('0x9a')],_[_0xde4d('0x9b')](_0x5af129[_0xde4d('0x30')],[_0xde4d('0x9a'),'id'])||{})[_0xde4d('0xab')](function(){return db[_0xde4d('0xac')][_0xde4d('0x3d')]({'attributes':['id',_0xde4d('0x2c'),_0xde4d('0xad')],'where':{'id':_0x5af129[_0xde4d('0x30')][_0xde4d('0x9a')]}});})[_0xde4d('0x13')](function(_0x1dc502){socket[_0xde4d('0xae')](_0xde4d('0xaf'),{'id':Number(_0x5af129[_0xde4d('0x3f')]['id']),'tags':_0x1dc502||[]});return{'id':Number(_0x5af129[_0xde4d('0x3f')]['id']),'tags':_0x1dc502||[]};});}})[_0xde4d('0x13')](respondWithResult(_0x44d432,null))['catch'](handleError(_0x44d432,null));};exports['removeTags']=function(_0x5e099b,_0x3135a4){return db[_0xde4d('0x37')][_0xde4d('0x4a')]({'where':{'id':_0x5e099b[_0xde4d('0x3f')]['id']}})[_0xde4d('0x13')](handleEntityNotFound(_0x3135a4,null))[_0xde4d('0x13')](function(_0x6c0351){if(_0x6c0351){return _0x6c0351['removeTags'](_0x5e099b[_0xde4d('0x46')][_0xde4d('0x9a')]);}})[_0xde4d('0x13')](respondWithStatusCode(_0x3135a4,null))['catch'](handleError(_0x3135a4,null));};exports[_0xde4d('0x7b')]=function(_0x7c6cfb,_0x553ca1){var _0x156861=moment()['unix']()[_0xde4d('0xb0')]();var _0x4c1c29=path[_0xde4d('0x76')](config[_0xde4d('0x77')],_0xde4d('0xb1'),_0xde4d('0xb2'),_0xde4d('0xb3'));var _0x3ba545=path['join'](config['root'],_0xde4d('0xb1'),'files','attachments');var _0x4f145f=path[_0xde4d('0x76')](_0x4c1c29,_0x156861);var _0x59da37=util[_0xde4d('0x7f')](_0xde4d('0xb4'),_0x7c6cfb['params']['id'],_0x156861);var _0x3c630f=path['join'](_0x4c1c29,_0x59da37);var _0x5b85cf=[];_0x5b85cf[_0xde4d('0xb5')]({'model':db[_0xde4d('0x84')],'as':_0xde4d('0x84'),'attributes':['id',_0xde4d('0x57')],'raw':!![]});_0x5b85cf[_0xde4d('0xb5')]({'model':db[_0xde4d('0x64')],'as':_0xde4d('0x65'),'attributes':['id',_0xde4d('0xb6'),_0xde4d('0xb7')],'raw':!![]});if(_0x7c6cfb['query'][_0xde4d('0xb8')]){_0x5b85cf[_0xde4d('0xb5')]({'model':db['Attachment'],'as':_0xde4d('0x71'),'raw':!![]});}var _0xe3a604=[{'model':db[_0xde4d('0x82')],'as':_0xde4d('0x83'),'attributes':['id',_0xde4d('0x30'),_0xde4d('0x8f'),_0xde4d('0xb9'),_0xde4d('0x91'),_0xde4d('0xba')],'include':_0x5b85cf}];_0xe3a604[_0xde4d('0xb5')]({'model':db['ChatWebsite'],'as':_0xde4d('0xbb'),'attributes':['id',_0xde4d('0x2c')]});_0xe3a604[_0xde4d('0xb5')]({'model':db[_0xde4d('0x84')],'as':_0xde4d('0xbc'),'attributes':['id',_0xde4d('0x57')]});return db['ChatInteraction'][_0xde4d('0x4a')]({'where':{'id':_0x7c6cfb[_0xde4d('0x3f')]['id']},'include':_0xe3a604})['then'](handleEntityNotFound(_0x553ca1,null))[_0xde4d('0x13')](function(_0x522f82){if(_0x522f82){var _0x1a6c76=_0x522f82[_0xde4d('0xbd')]({'plain':!![]});fs[_0xde4d('0xbe')](_0x4f145f);var _0x36a95b={'channel':_0xde4d('0xbf'),'account':_0x1a6c76[_0xde4d('0xbb')]['name'],'agent':_0x1a6c76[_0xde4d('0xbc')]?_0x1a6c76[_0xde4d('0xbc')][_0xde4d('0x57')]:_0xde4d('0xc0'),'createdAt':moment(_0x1a6c76[_0xde4d('0x8f')])['format'](_0xde4d('0xa5'))[_0xde4d('0xb0')](),'closedAt':_0x1a6c76[_0xde4d('0x6a')]?moment(_0x1a6c76[_0xde4d('0xc1')])[_0xde4d('0x7f')](_0xde4d('0xa5'))[_0xde4d('0xb0')]():'','disposition':_0x1a6c76[_0xde4d('0x6b')],'chatInfo':{'browser':_0x1a6c76[_0xde4d('0xc2')],'os':_0x1a6c76[_0xde4d('0xc3')],'referer':_0x1a6c76[_0xde4d('0xc4')],'customerIp':_0x1a6c76[_0xde4d('0xc5')],'customerPort':_0x1a6c76['customerPort']?_0x1a6c76[_0xde4d('0xc6')]:_0xde4d('0xc0')},'messages':_(_0x1a6c76[_0xde4d('0x83')])[_0xde4d('0xc7')]()['filter']({'secret':![]})[_0xde4d('0x36')](function(_0x204a31){if(_0x204a31[_0xde4d('0x71')]){var _0xb65f0d=path[_0xde4d('0x76')](_0x3ba545,_0x204a31['Attachment'][_0xde4d('0x7a')]);if(fs[_0xde4d('0xc8')](_0xb65f0d)){fs[_0xde4d('0xc9')](_0xb65f0d)[_0xde4d('0xca')](fs[_0xde4d('0xcb')](path[_0xde4d('0x76')](_0x4f145f,_0x204a31[_0xde4d('0x71')][_0xde4d('0x7a')])));}}return{'date':moment(_0x204a31[_0xde4d('0x8f')])[_0xde4d('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde4d('0xb0')](),'sender':_0x204a31[_0xde4d('0xb9')]===_0xde4d('0x61')?_0x204a31[_0xde4d('0x84')]?_0x204a31[_0xde4d('0x84')][_0xde4d('0x57')]:_0xde4d('0x88'):_0x204a31[_0xde4d('0x65')][_0xde4d('0xb6')]+(_0x204a31['Contact'][_0xde4d('0xb7')]?'\x20'+_0x204a31[_0xde4d('0x65')][_0xde4d('0xb7')]:''),'body':_0x204a31[_0xde4d('0x71')]?_0x204a31['Attachment']['basename']:_0x204a31[_0xde4d('0x30')],'direction':_0x204a31[_0xde4d('0xb9')]===_0xde4d('0x61')?'A':'C','secret':_0x204a31['secret'],'read':_0x204a31['read'],'attachment':_0x204a31[_0xde4d('0x71')]};})['value']()};return ejs[_0xde4d('0xcc')](path[_0xde4d('0x76')](config[_0xde4d('0x77')],'server',_0xde4d('0xcd'),'downloadInteraction.ejs'),{'interaction':_0x36a95b})[_0xde4d('0x13')](function(_0x3a7639){var _0x56d1cf=path[_0xde4d('0x76')](_0x4f145f,'transcript-'+_0x1a6c76['id']+'-'+_0x156861+'.pdf');var _0x52ac59={'path':_0x56d1cf,'channel':_0xde4d('0xbf'),'interactionId':_0x1a6c76['id']};return pdf['createPdfFromHTML'](_0x3a7639,_0x52ac59);})[_0xde4d('0x13')](function(){return new Promise(function(_0x32c2e2,_0x3fc410){zipdir(_0x4f145f,{'saveTo':_0x3c630f},function(_0x22f9fc,_0x401853){if(_0x22f9fc)return _0x3fc410(_0x22f9fc);return _0x32c2e2(_0x401853);});})[_0xde4d('0x13')](function(){return new BPromise(function(_0x2e861f,_0x137d1b){rimraf(_0x4f145f,function(_0x28e10a){if(_0x28e10a)_0x137d1b(_0x28e10a);return _0x2e861f();});});})[_0xde4d('0x13')](function(){return _0x553ca1[_0xde4d('0x7b')](_0x3c630f,_0x59da37,function(_0x4d9ca1){if(_0x4d9ca1){logger[_0xde4d('0x19')](_0xde4d('0xce'),_0x4d9ca1);}else{fs[_0xde4d('0xcf')](_0x3c630f);}});});});}else{return _0x553ca1[_0xde4d('0x1f')](0xc8);}})[_0xde4d('0x1e')](handleError(_0x553ca1,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5b08757..81040c4 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 _0x5428=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x35f5a5,_0x3f8a65){var _0x143dce=function(_0x5c3197){while(--_0x5c3197){_0x35f5a5['push'](_0x35f5a5['shift']());}};_0x143dce(++_0x3f8a65);}(_0x5428,0x1eb));var _0x8542=function(_0x47eed5,_0x91ec98){_0x47eed5=_0x47eed5-0x0;var _0x59fb5f=_0x5428[_0x47eed5];return _0x59fb5f;};'use strict';var EventEmitter=require(_0x8542('0x0'));var ChatInteraction=require(_0x8542('0x1'))['db'][_0x8542('0x2')];var ChatMessage=require(_0x8542('0x1'))['db'][_0x8542('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8542('0x4')](0x0);var events={'afterCreate':_0x8542('0x5'),'afterUpdate':'update','afterDestroy':_0x8542('0x6')};function emitEvent(_0xb3ab65){return function(_0x415ef0,_0x200d42,_0x7efcba){_0x415ef0[_0x8542('0x7')]({'attributes':['id'],'raw':!![]})[_0x8542('0x8')](function(_0x407275){_0x415ef0[_0x8542('0x9')]('Users',_0x407275[_0x8542('0xa')](function(_0x3aaf2c){return{'id':_0x3aaf2c['id']};}));return ChatMessage[_0x8542('0xb')]({'where':{'ChatInteractionId':_0x415ef0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8542('0x8')](function(_0x4696cc){_0x415ef0['setDataValue'](_0x8542('0xc'),_0x4696cc['length']);ChatInteractionEvents[_0x8542('0xd')](_0xb3ab65+':'+_0x415ef0['id'],_0x415ef0);ChatInteractionEvents[_0x8542('0xd')](_0xb3ab65,_0x415ef0);_0x7efcba(null);})[_0x8542('0xe')](_0x7efcba(null));};}for(var e in events){if(events[_0x8542('0xf')](e)){var event=events[e];ChatInteraction[_0x8542('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x03da=['findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','ChatMessage','setMaxListeners','update','remove','then','setDataValue','Users','map'];(function(_0x1a26cf,_0x24ff00){var _0x34e0e1=function(_0x177354){while(--_0x177354){_0x1a26cf['push'](_0x1a26cf['shift']());}};_0x34e0e1(++_0x24ff00);}(_0x03da,0x66));var _0xa03d=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x03da[_0xb6e43];return _0x47c40f;};'use strict';var EventEmitter=require(_0xa03d('0x0'));var ChatInteraction=require(_0xa03d('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xa03d('0x1'))['db'][_0xa03d('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa03d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa03d('0x4'),'afterDestroy':_0xa03d('0x5')};function emitEvent(_0x55926){return function(_0x22da6c,_0x34a8e8,_0x23bd99){_0x22da6c['getUsers']({'attributes':['id'],'raw':!![]})[_0xa03d('0x6')](function(_0x1f5b4c){_0x22da6c[_0xa03d('0x7')](_0xa03d('0x8'),_0x1f5b4c[_0xa03d('0x9')](function(_0x2c049c){return{'id':_0x2c049c['id']};}));return ChatMessage[_0xa03d('0xa')]({'where':{'ChatInteractionId':_0x22da6c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa03d('0x6')](function(_0x3b5fb7){_0x22da6c[_0xa03d('0x7')](_0xa03d('0xb'),_0x3b5fb7[_0xa03d('0xc')]);ChatInteractionEvents[_0xa03d('0xd')](_0x55926+':'+_0x22da6c['id'],_0x22da6c);ChatInteractionEvents[_0xa03d('0xd')](_0x55926,_0x22da6c);_0x23bd99(null);})[_0xa03d('0xe')](_0x23bd99(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xa03d('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 986d8cf..66deca6 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 _0x7606=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7606,0x8d));var _0x6760=function(_0x42d041,_0x4a3448){_0x42d041=_0x42d041-0x0;var _0x14b609=_0x7606[_0x42d041];return _0x14b609;};'use strict';var _=require(_0x6760('0x0'));var util=require(_0x6760('0x1'));var logger=require(_0x6760('0x2'))(_0x6760('0x3'));var moment=require(_0x6760('0x4'));var BPromise=require(_0x6760('0x5'));var rp=require(_0x6760('0x6'));var fs=require('fs');var path=require(_0x6760('0x7'));var rimraf=require(_0x6760('0x8'));var config=require(_0x6760('0x9'));var attributes=require(_0x6760('0xa'));module[_0x6760('0xb')]=function(_0xb07b5,_0xb57fc6){return _0xb07b5[_0x6760('0xc')](_0x6760('0xd'),attributes,{'tableName':_0x6760('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ca3cf,_0x2a7853,_0x4ae7cb){if(_0x3ca3cf[_0x6760('0xf')]('closed')){_0x3ca3cf[_0x6760('0x10')]=moment()[_0x6760('0x11')](_0x6760('0x12'));}_0x4ae7cb(null,_0x3ca3cf);}},'charset':'utf8mb4','collate':_0x6760('0x13')});}; \ No newline at end of file +var _0xc3f6=['../../config/environment','ChatInteraction','changed','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x554d40,_0x3e4d2e){var _0x2e95a6=function(_0x5924de){while(--_0x5924de){_0x554d40['push'](_0x554d40['shift']());}};_0x2e95a6(++_0x3e4d2e);}(_0xc3f6,0xb0));var _0x6c3f=function(_0x1f088c,_0x53b5a7){_0x1f088c=_0x1f088c-0x0;var _0x1fbe22=_0xc3f6[_0x1f088c];return _0x1fbe22;};'use strict';var _=require(_0x6c3f('0x0'));var util=require('util');var logger=require(_0x6c3f('0x1'))(_0x6c3f('0x2'));var moment=require('moment');var BPromise=require(_0x6c3f('0x3'));var rp=require(_0x6c3f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c3f('0x5'));var config=require(_0x6c3f('0x6'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x75924b,_0x413ffc){return _0x75924b['define'](_0x6c3f('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b238d,_0x355dcd,_0x2885d6){if(_0x5b238d[_0x6c3f('0x8')](_0x6c3f('0x9'))){_0x5b238d['closedAt']=moment()[_0x6c3f('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2885d6(null,_0x5b238d);}},'charset':_0x6c3f('0xb'),'collate':_0x6c3f('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 785015b..d40f228 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 _0xb1f6=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','ChatInteraction','body','options','where','attributes','limit','then','UpdateChatInteraction','stringify','catch','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s'];(function(_0x89eef8,_0x2896dd){var _0xe260aa=function(_0x1bf035){while(--_0x1bf035){_0x89eef8['push'](_0x89eef8['shift']());}};_0xe260aa(++_0x2896dd);}(_0xb1f6,0x187));var _0x6b1f=function(_0x3d7159,_0x4bf336){_0x3d7159=_0x3d7159-0x0;var _0x7e9b2f=_0xb1f6[_0x3d7159];return _0x7e9b2f;};'use strict';var _=require(_0x6b1f('0x0'));var util=require(_0x6b1f('0x1'));var moment=require(_0x6b1f('0x2'));var BPromise=require(_0x6b1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b1f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b1f('0x5'))(_0x6b1f('0x6'));var config=require(_0x6b1f('0x7'));var jayson=require(_0x6b1f('0x8'));var client=jayson[_0x6b1f('0x9')]['http']({'port':0x232a});config[_0x6b1f('0xa')]=_[_0x6b1f('0xb')](config[_0x6b1f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b1f('0xa')]));require(_0x6b1f('0xc'))[_0x6b1f('0xd')](socket);function respondWithRpcPromise(_0x53a680,_0x19b0c6,_0xdefc30){return new BPromise(function(_0x3fe938,_0x4934b9){return client[_0x6b1f('0xe')](_0x53a680,_0xdefc30)['then'](function(_0x17358a){logger['info'](_0x6b1f('0xf'),_0x19b0c6,'request\x20sent');logger[_0x6b1f('0x10')](_0x6b1f('0x11'),_0x19b0c6,_0x6b1f('0x12'),JSON['stringify'](_0x17358a));if(_0x17358a[_0x6b1f('0x13')]){if(_0x17358a['error']['code']===0x1f4){logger[_0x6b1f('0x13')](_0x6b1f('0xf'),_0x19b0c6,_0x17358a['error']['message']);return _0x4934b9(_0x17358a[_0x6b1f('0x13')]['message']);}logger[_0x6b1f('0x13')](_0x6b1f('0xf'),_0x19b0c6,_0x17358a[_0x6b1f('0x13')][_0x6b1f('0x14')]);return _0x3fe938(_0x17358a['error'][_0x6b1f('0x14')]);}else{logger[_0x6b1f('0x15')](_0x6b1f('0xf'),_0x19b0c6,_0x6b1f('0x12'));_0x3fe938(_0x17358a['result']['message']);}})['catch'](function(_0x3814c4){logger['error'](_0x6b1f('0xf'),_0x19b0c6,_0x3814c4);_0x4934b9(_0x3814c4);});});}exports['UpdateChatInteraction']=function(_0x576d38){var _0x250743=this;return new Promise(function(_0x267649,_0x3e6adc){return db[_0x6b1f('0x16')]['update'](_0x576d38[_0x6b1f('0x17')],{'raw':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576d38['options']?_0x576d38['options'][_0x6b1f('0x19')]||null:null,'attributes':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')][_0x6b1f('0x1a')]||null:null,'limit':_0x576d38[_0x6b1f('0x18')]?_0x576d38[_0x6b1f('0x18')][_0x6b1f('0x1b')]||null:null})[_0x6b1f('0x1c')](function(_0x3fd841){logger['info'](_0x6b1f('0x1d'),_0x576d38);logger[_0x6b1f('0x10')](_0x6b1f('0x1d'),_0x576d38,JSON[_0x6b1f('0x1e')](_0x3fd841));_0x267649(_0x3fd841);})[_0x6b1f('0x1f')](function(_0x15c23d){logger[_0x6b1f('0x13')](_0x6b1f('0x1d'),_0x15c23d['message'],_0x576d38);_0x3e6adc(_0x250743[_0x6b1f('0x13')](0x1f4,_0x15c23d[_0x6b1f('0x14')]));});});};exports['AddTagsToChatInteraction']=function(_0x3623b9){return new Promise(function(_0x51b323,_0x116ca5){return db[_0x6b1f('0x16')][_0x6b1f('0x20')]({'where':_0x3623b9[_0x6b1f('0x18')]?_0x3623b9['options'][_0x6b1f('0x19')]||null:null})[_0x6b1f('0x1c')](function(_0x4e2fd3){if(_0x4e2fd3){return _0x4e2fd3['addTags'](_0x3623b9['body'][_0x6b1f('0x21')],_[_0x6b1f('0x22')](_0x3623b9['body'],['ids','id'])||{});}})[_0x6b1f('0x23')](function(_0x6e6f1e){logger[_0x6b1f('0x15')](_0x6b1f('0x24'),_0x3623b9);logger['debug'](_0x6b1f('0x24'),_0x3623b9,JSON[_0x6b1f('0x1e')](_0x6e6f1e));_0x51b323(_0x6e6f1e);})[_0x6b1f('0x1f')](function(_0x4b45ce){logger['error'](_0x6b1f('0x24'),_0x4b45ce[_0x6b1f('0x14')],_0x3623b9);_0x116ca5(_this[_0x6b1f('0x13')](0x1f4,_0x4b45ce[_0x6b1f('0x14')]));});});}; \ No newline at end of file +var _0xe944=['redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2e1ca2,_0x150397){var _0x60bc65=function(_0x12de2d){while(--_0x12de2d){_0x2e1ca2['push'](_0x2e1ca2['shift']());}};_0x60bc65(++_0x150397);}(_0xe944,0x178));var _0x4e94=function(_0x597b02,_0x6860c){_0x597b02=_0x597b02-0x0;var _0x39a2f9=_0xe944[_0x597b02];return _0x39a2f9;};'use strict';var _=require(_0x4e94('0x0'));var util=require(_0x4e94('0x1'));var moment=require(_0x4e94('0x2'));var BPromise=require(_0x4e94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e94('0x5'));var logger=require(_0x4e94('0x6'))(_0x4e94('0x7'));var config=require('../../config/environment');var jayson=require(_0x4e94('0x8'));var client=jayson[_0x4e94('0x9')][_0x4e94('0xa')]({'port':0x232a});config[_0x4e94('0xb')]=_[_0x4e94('0xc')](config[_0x4e94('0xb')],{'host':_0x4e94('0xd'),'port':0x18eb});var socket=require(_0x4e94('0xe'))(new Redis(config['redis']));require(_0x4e94('0xf'))[_0x4e94('0x10')](socket);function respondWithRpcPromise(_0x4e8394,_0x1d8427,_0x16f4a9){return new BPromise(function(_0x58fa7a,_0x5ddd51){return client['request'](_0x4e8394,_0x16f4a9)[_0x4e94('0x11')](function(_0x1249a5){logger[_0x4e94('0x12')](_0x4e94('0x13'),_0x1d8427,_0x4e94('0x14'));logger[_0x4e94('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1d8427,_0x4e94('0x14'),JSON[_0x4e94('0x16')](_0x1249a5));if(_0x1249a5[_0x4e94('0x17')]){if(_0x1249a5[_0x4e94('0x17')][_0x4e94('0x18')]===0x1f4){logger['error'](_0x4e94('0x13'),_0x1d8427,_0x1249a5[_0x4e94('0x17')][_0x4e94('0x19')]);return _0x5ddd51(_0x1249a5[_0x4e94('0x17')][_0x4e94('0x19')]);}logger[_0x4e94('0x17')](_0x4e94('0x13'),_0x1d8427,_0x1249a5[_0x4e94('0x17')][_0x4e94('0x19')]);return _0x58fa7a(_0x1249a5['error'][_0x4e94('0x19')]);}else{logger[_0x4e94('0x12')](_0x4e94('0x13'),_0x1d8427,_0x4e94('0x14'));_0x58fa7a(_0x1249a5[_0x4e94('0x1a')][_0x4e94('0x19')]);}})['catch'](function(_0x10ff24){logger[_0x4e94('0x17')](_0x4e94('0x13'),_0x1d8427,_0x10ff24);_0x5ddd51(_0x10ff24);});});}exports[_0x4e94('0x1b')]=function(_0x24326d){var _0x1c3ab4=this;return new Promise(function(_0x210b22,_0x445ff1){return db[_0x4e94('0x1c')][_0x4e94('0x1d')](_0x24326d[_0x4e94('0x1e')],{'raw':_0x24326d[_0x4e94('0x1f')]?_0x24326d[_0x4e94('0x1f')][_0x4e94('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24326d[_0x4e94('0x1f')]?_0x24326d['options'][_0x4e94('0x21')]||null:null,'attributes':_0x24326d[_0x4e94('0x1f')]?_0x24326d[_0x4e94('0x1f')][_0x4e94('0x22')]||null:null,'limit':_0x24326d[_0x4e94('0x1f')]?_0x24326d['options']['limit']||null:null})[_0x4e94('0x11')](function(_0x16a3b2){logger['info'](_0x4e94('0x1b'),_0x24326d);logger[_0x4e94('0x15')](_0x4e94('0x1b'),_0x24326d,JSON[_0x4e94('0x16')](_0x16a3b2));_0x210b22(_0x16a3b2);})[_0x4e94('0x23')](function(_0x196b24){logger['error'](_0x4e94('0x1b'),_0x196b24[_0x4e94('0x19')],_0x24326d);_0x445ff1(_0x1c3ab4['error'](0x1f4,_0x196b24[_0x4e94('0x19')]));});});};exports[_0x4e94('0x24')]=function(_0x259ed2){return new Promise(function(_0x486c9a,_0x36f47d){return db[_0x4e94('0x1c')][_0x4e94('0x25')]({'where':_0x259ed2[_0x4e94('0x1f')]?_0x259ed2[_0x4e94('0x1f')][_0x4e94('0x21')]||null:null})['then'](function(_0x1c307f){if(_0x1c307f){return _0x1c307f[_0x4e94('0x26')](_0x259ed2['body'][_0x4e94('0x27')],_[_0x4e94('0x28')](_0x259ed2[_0x4e94('0x1e')],[_0x4e94('0x27'),'id'])||{});}})[_0x4e94('0x29')](function(_0x1b26a2){logger[_0x4e94('0x12')](_0x4e94('0x2a'),_0x259ed2);logger[_0x4e94('0x15')]('AddTags',_0x259ed2,JSON[_0x4e94('0x16')](_0x1b26a2));_0x486c9a(_0x1b26a2);})[_0x4e94('0x23')](function(_0x50c017){logger[_0x4e94('0x17')](_0x4e94('0x2a'),_0x50c017[_0x4e94('0x19')],_0x259ed2);_0x36f47d(_this[_0x4e94('0x17')](0x1f4,_0x50c017[_0x4e94('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 07a707f..6bab2ea 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 _0x9daa=['remove','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events','save'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9daa,0x146));var _0xa9da=function(_0x1dba8d,_0x34b988){_0x1dba8d=_0x1dba8d-0x0;var _0x202828=_0x9daa[_0x1dba8d];return _0x202828;};'use strict';var ChatInteractionEvents=require(_0xa9da('0x0'));var events=[_0xa9da('0x1'),_0xa9da('0x2'),_0xa9da('0x3')];function createListener(_0x54105a,_0xa817d9){return function(_0x112851){_0xa817d9[_0xa9da('0x4')](_0x54105a,_0x112851);};}function removeListener(_0xee9072,_0x347ed7){return function(){ChatInteractionEvents[_0xa9da('0x5')](_0xee9072,_0x347ed7);};}exports[_0xa9da('0x6')]=function(_0x56a8fc){for(var _0x4dbf12=0x0,_0x4ef8e6=events['length'];_0x4dbf12<_0x4ef8e6;_0x4dbf12++){var _0x2840df=events[_0x4dbf12];var _0x5e588c=createListener(_0xa9da('0x7')+_0x2840df,_0x56a8fc);ChatInteractionEvents['on'](_0x2840df,_0x5e588c);}}; \ No newline at end of file +var _0x7deb=['save','remove','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x25ee27,_0x180283){var _0xa793a5=function(_0x4fb627){while(--_0x4fb627){_0x25ee27['push'](_0x25ee27['shift']());}};_0xa793a5(++_0x180283);}(_0x7deb,0x11f));var _0xb7de=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x7deb[_0xb833b1];return _0x1ab87a;};'use strict';var ChatInteractionEvents=require(_0xb7de('0x0'));var events=[_0xb7de('0x1'),_0xb7de('0x2'),'update'];function createListener(_0x57e31f,_0x4e1dbe){return function(_0x5a8a45){_0x4e1dbe[_0xb7de('0x3')](_0x57e31f,_0x5a8a45);};}function removeListener(_0x219f61,_0x54d165){return function(){ChatInteractionEvents[_0xb7de('0x4')](_0x219f61,_0x54d165);};}exports[_0xb7de('0x5')]=function(_0x3fa2f8){for(var _0x27e8ab=0x0,_0x12dc76=events[_0xb7de('0x6')];_0x27e8ab<_0x12dc76;_0x27e8ab++){var _0x28c892=events[_0x27e8ab];var _0x4e7710=createListener(_0xb7de('0x7')+_0x28c892,_0x3fa2f8);ChatInteractionEvents['on'](_0x28c892,_0x4e7710);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index cfb76a3..b4ddab2 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 _0xc34d=['chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','%s-%s','now','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put'];(function(_0x81a95,_0x49ec86){var _0x41518c=function(_0x4180c3){while(--_0x4180c3){_0x81a95['push'](_0x81a95['shift']());}};_0x41518c(++_0x49ec86);}(_0xc34d,0x1e9));var _0xdc34=function(_0x4bfd4a,_0x444995){_0x4bfd4a=_0x4bfd4a-0x0;var _0x4cd8a8=_0xc34d[_0x4bfd4a];return _0x4cd8a8;};'use strict';var multer=require('multer');var util=require(_0xdc34('0x0'));var path=require(_0xdc34('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc34('0x2'));var router=express[_0xdc34('0x3')]();var fs_extra=require(_0xdc34('0x4'));var auth=require(_0xdc34('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc34('0x6'));var controller=require(_0xdc34('0x7'));router['get']('/',auth[_0xdc34('0x8')](),controller[_0xdc34('0x9')]);router[_0xdc34('0xa')](_0xdc34('0xb'),auth[_0xdc34('0x8')](),controller[_0xdc34('0xc')]);router[_0xdc34('0xa')](_0xdc34('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xdc34('0xe')]);router['get']('/:id/attachment_download',auth[_0xdc34('0xf')](),controller[_0xdc34('0x10')]);router[_0xdc34('0xa')](_0xdc34('0x11'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x12')]);router[_0xdc34('0xa')](_0xdc34('0x13'),auth[_0xdc34('0xf')](),controller[_0xdc34('0x14')]);router[_0xdc34('0xa')](_0xdc34('0x15'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x16')]);router['post']('/',auth[_0xdc34('0x8')](),controller[_0xdc34('0x17')]);router[_0xdc34('0x18')](_0xdc34('0x19'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x1a')]);var upload=multer({'storage':multer[_0xdc34('0x1b')]({'destination':function(_0x45b6eb,_0xfbadfc,_0x5f2ba9){_0x5f2ba9(null,path['join'](config[_0xdc34('0x1c')],'server/files/attachments/'));},'filename':function(_0xa3e0f5,_0x4aec9e,_0x54abef){_0x54abef(null,util['format'](_0xdc34('0x1d'),Date[_0xdc34('0x1e')](),_0x4aec9e['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdc34('0x18')](_0xdc34('0x1f'),upload[_0xdc34('0x20')](_0xdc34('0x21')),controller[_0xdc34('0x22')]);router['post']('/:id/messages',auth[_0xdc34('0xf')](),controller[_0xdc34('0x23')]);router[_0xdc34('0x18')](_0xdc34('0x24'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x27')),controller['addTags']);router[_0xdc34('0x28')](_0xdc34('0xd'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x29')),controller[_0xdc34('0x2a')]);router[_0xdc34('0x28')](_0xdc34('0x2b'),controller[_0xdc34('0x2c')]);router[_0xdc34('0x28')](_0xdc34('0x2d'),auth[_0xdc34('0xf')](),controller[_0xdc34('0x2e')]);router[_0xdc34('0x28')](_0xdc34('0x2f'),controller[_0xdc34('0x30')]);router[_0xdc34('0x31')](_0xdc34('0xd'),auth[_0xdc34('0x8')](),interaction[_0xdc34('0x25')](_0xdc34('0x26'),_0xdc34('0x32')),controller[_0xdc34('0x33')]);router[_0xdc34('0x31')](_0xdc34('0x24'),auth[_0xdc34('0x8')](),controller[_0xdc34('0x34')]);module['exports']=router; \ No newline at end of file +var _0x1f4c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','create','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','exports','multer'];(function(_0x69ba74,_0x587a85){var _0x4b32e4=function(_0xc13461){while(--_0xc13461){_0x69ba74['push'](_0x69ba74['shift']());}};_0x4b32e4(++_0x587a85);}(_0x1f4c,0xd7));var _0xc1f4=function(_0x163876,_0x1c4181){_0x163876=_0x163876-0x0;var _0x13a661=_0x1f4c[_0x163876];return _0x13a661;};'use strict';var multer=require(_0xc1f4('0x0'));var util=require(_0xc1f4('0x1'));var path=require(_0xc1f4('0x2'));var timeout=require(_0xc1f4('0x3'));var express=require(_0xc1f4('0x4'));var router=express[_0xc1f4('0x5')]();var fs_extra=require(_0xc1f4('0x6'));var auth=require(_0xc1f4('0x7'));var interaction=require(_0xc1f4('0x8'));var config=require(_0xc1f4('0x9'));var controller=require(_0xc1f4('0xa'));router[_0xc1f4('0xb')]('/',auth[_0xc1f4('0xc')](),controller[_0xc1f4('0xd')]);router[_0xc1f4('0xb')](_0xc1f4('0xe'),auth[_0xc1f4('0xc')](),controller[_0xc1f4('0xf')]);router[_0xc1f4('0xb')](_0xc1f4('0x10'),auth[_0xc1f4('0x11')](),controller[_0xc1f4('0x12')]);router['get'](_0xc1f4('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xc1f4('0x14')]);router['get'](_0xc1f4('0x15'),auth[_0xc1f4('0xc')](),controller['getMessages']);router['get']('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller[_0xc1f4('0x16')]);router[_0xc1f4('0xb')]('/:id/download',auth[_0xc1f4('0xc')](),controller['download']);router['post']('/',auth[_0xc1f4('0xc')](),controller[_0xc1f4('0x17')]);router[_0xc1f4('0x18')]('/:id/vidaoo',auth[_0xc1f4('0xc')](),controller[_0xc1f4('0x19')]);var upload=multer({'storage':multer[_0xc1f4('0x1a')]({'destination':function(_0x3eced8,_0x1f2cbe,_0x16d60d){_0x16d60d(null,path[_0xc1f4('0x1b')](config[_0xc1f4('0x1c')],_0xc1f4('0x1d')));},'filename':function(_0x80473,_0x3ac525,_0x1eac38){_0x1eac38(null,util[_0xc1f4('0x1e')]('%s-%s',Date[_0xc1f4('0x1f')](),_0x3ac525[_0xc1f4('0x20')][_0xc1f4('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc1f4('0x22'),upload[_0xc1f4('0x23')](_0xc1f4('0x24')),controller[_0xc1f4('0x25')]);router[_0xc1f4('0x18')]('/:id/messages',auth[_0xc1f4('0x11')](),controller['addMessage']);router[_0xc1f4('0x18')](_0xc1f4('0x26'),auth['isAuthenticated'](),interaction[_0xc1f4('0x27')](_0xc1f4('0x28'),'chatinteraction:addtags'),controller[_0xc1f4('0x29')]);router[_0xc1f4('0x2a')](_0xc1f4('0x10'),auth[_0xc1f4('0xc')](),interaction[_0xc1f4('0x27')](_0xc1f4('0x28'),_0xc1f4('0x2b')),controller[_0xc1f4('0x2c')]);router[_0xc1f4('0x2a')](_0xc1f4('0x2d'),controller[_0xc1f4('0x2e')]);router[_0xc1f4('0x2a')](_0xc1f4('0x2f'),auth[_0xc1f4('0x11')](),controller['abandon']);router[_0xc1f4('0x2a')](_0xc1f4('0x30'),controller[_0xc1f4('0x31')]);router['delete'](_0xc1f4('0x10'),auth[_0xc1f4('0xc')](),interaction[_0xc1f4('0x27')](_0xc1f4('0x28'),_0xc1f4('0x32')),controller[_0xc1f4('0x33')]);router[_0xc1f4('0x34')](_0xc1f4('0x26'),auth['isAuthenticated'](),controller['removeTags']);module[_0xc1f4('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 59b0fb2..8911450 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 _0x6d83=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0x6d83,0x80));var _0x36d8=function(_0x23449d,_0x5395f4){_0x23449d=_0x23449d-0x0;var _0x1b78bb=_0x6d83[_0x23449d];return _0x1b78bb;};'use strict';var Sequelize=require(_0x36d8('0x0'));module[_0x36d8('0x1')]={'body':{'type':Sequelize[_0x36d8('0x2')](_0x36d8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x36d8('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x36d8('0x5')]}}; \ No newline at end of file +var _0xe223=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0x3bf2f7,_0x540f96){var _0x2e5307=function(_0x333beb){while(--_0x333beb){_0x3bf2f7['push'](_0x3bf2f7['shift']());}};_0x2e5307(++_0x540f96);}(_0xe223,0x1d1));var _0x3e22=function(_0x44f45f,_0x2ae023){_0x44f45f=_0x44f45f-0x0;var _0x985a3c=_0xe223[_0x44f45f];return _0x985a3c;};'use strict';var Sequelize=require(_0x3e22('0x0'));module[_0x3e22('0x1')]={'body':{'type':Sequelize[_0x3e22('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3e22('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3e22('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e223712..d191292 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 _0xa1d1=['role','userpic','allowmessenger','showWebBar','sort','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','name','ChatInternalMessage','rawAttributes','fieldName','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','create','body','params','find','describe','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user'];(function(_0x274600,_0x100ccf){var _0xef0f9c=function(_0x2961a0){while(--_0x2961a0){_0x274600['push'](_0x274600['shift']());}};_0xef0f9c(++_0x100ccf);}(_0xa1d1,0x71));var _0x1a1d=function(_0x20ae2f,_0x455457){_0x20ae2f=_0x20ae2f-0x0;var _0x47adce=_0xa1d1[_0x20ae2f];return _0x47adce;};'use strict';var emlformat=require(_0x1a1d('0x0'));var rimraf=require(_0x1a1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a1d('0x3'));var util=require(_0x1a1d('0x4'));var path=require(_0x1a1d('0x5'));var sox=require(_0x1a1d('0x6'));var csv=require(_0x1a1d('0x7'));var ejs=require(_0x1a1d('0x8'));var fs=require('fs');var fs_extra=require(_0x1a1d('0x9'));var _=require('lodash');var squel=require(_0x1a1d('0xa'));var crypto=require(_0x1a1d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1a1d('0xc'));var toCsv=require(_0x1a1d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1a1d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1a1d('0xe'));var hardwareService=require(_0x1a1d('0xf'));var logger=require(_0x1a1d('0x10'))(_0x1a1d('0x11'));var utils=require('../../config/utils');var config=require(_0x1a1d('0x12'));var licenseUtil=require(_0x1a1d('0x13'));var db=require(_0x1a1d('0x14'))['db'];config[_0x1a1d('0x15')]=_['defaults'](config[_0x1a1d('0x15')],{'host':_0x1a1d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a1d('0x15')]));require(_0x1a1d('0x17'))['register'](socket);function respondWithStatusCode(_0xe96cb9,_0x44981f){_0x44981f=_0x44981f||0xcc;return function(_0x59b0a4){if(_0x59b0a4){return _0xe96cb9[_0x1a1d('0x18')](_0x44981f);}return _0xe96cb9['status'](_0x44981f)[_0x1a1d('0x19')]();};}function respondWithResult(_0x183a7e,_0x55cb4b){_0x55cb4b=_0x55cb4b||0xc8;return function(_0x38f429){if(_0x38f429){return _0x183a7e[_0x1a1d('0x1a')](_0x55cb4b)[_0x1a1d('0x1b')](_0x38f429);}};}function respondWithFilteredResult(_0x47ef30,_0x116684){return function(_0x54cb9d){if(_0x54cb9d){var _0xecbd9d=typeof _0x116684['offset']==='undefined'&&typeof _0x116684[_0x1a1d('0x1c')]==='undefined';var _0x30db76=_0x54cb9d[_0x1a1d('0x1d')];var _0x11521c=_0xecbd9d?0x0:_0x116684[_0x1a1d('0x1e')];var _0x523873=_0xecbd9d?_0x54cb9d['count']:_0x116684[_0x1a1d('0x1e')]+_0x116684[_0x1a1d('0x1c')];var _0x47e577;if(_0x523873>=_0x30db76){_0x523873=_0x30db76;_0x47e577=0xc8;}else{_0x47e577=0xce;}_0x47ef30[_0x1a1d('0x1a')](_0x47e577);return _0x47ef30[_0x1a1d('0x1f')](_0x1a1d('0x20'),_0x11521c+'-'+_0x523873+'/'+_0x30db76)[_0x1a1d('0x1b')](_0x54cb9d);}return null;};}function patchUpdates(_0xf4679e){return function(_0x57e7f2){try{jsonpatch[_0x1a1d('0x21')](_0x57e7f2,_0xf4679e,!![]);}catch(_0x19c6e1){return BPromise['reject'](_0x19c6e1);}return _0x57e7f2[_0x1a1d('0x22')]();};}function saveUpdates(_0x1a83b5,_0x29bf02){return function(_0xb27b72){if(_0xb27b72){return _0xb27b72[_0x1a1d('0x23')](_0x1a83b5)[_0x1a1d('0x24')](function(_0x581f35){return _0x581f35;});}return null;};}function removeEntity(_0x414547,_0x2af664){return function(_0x48eee1){if(_0x48eee1){return _0x48eee1[_0x1a1d('0x25')]()[_0x1a1d('0x24')](function(){_0x414547[_0x1a1d('0x1a')](0xcc)[_0x1a1d('0x19')]();});}};}function handleEntityNotFound(_0x1c8712,_0x39536f){return function(_0x348f9f){if(!_0x348f9f){_0x1c8712[_0x1a1d('0x18')](0x194);}return _0x348f9f;};}function handleError(_0x3013ad,_0x2ada71){_0x2ada71=_0x2ada71||0x1f4;return function(_0x33c6f2){logger['error'](_0x33c6f2['stack']);if(_0x33c6f2['name']){delete _0x33c6f2[_0x1a1d('0x26')];}_0x3013ad[_0x1a1d('0x1a')](_0x2ada71)['send'](_0x33c6f2);};}exports['index']=function(_0x1ddf0f,_0x531cc7){var _0x2e14a1={},_0x36cd17={},_0xe2150a={'count':0x0,'rows':[]};var _0x389dce=_['map'](db[_0x1a1d('0x27')][_0x1a1d('0x28')],function(_0x43e92d){return{'name':_0x43e92d[_0x1a1d('0x29')],'type':_0x43e92d['type']['key']};});_0x36cd17['model']=_[_0x1a1d('0x2a')](_0x389dce,'name');_0x36cd17[_0x1a1d('0x2b')]=_['keys'](_0x1ddf0f['query']);_0x36cd17[_0x1a1d('0x2c')]=_['intersection'](_0x36cd17[_0x1a1d('0x2d')],_0x36cd17[_0x1a1d('0x2b')]);_0x2e14a1[_0x1a1d('0x2e')]=_[_0x1a1d('0x2f')](_0x36cd17[_0x1a1d('0x2d')],qs['fields'](_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x30')]));_0x2e14a1['attributes']=_0x2e14a1['attributes']['length']?_0x2e14a1[_0x1a1d('0x2e')]:_0x36cd17[_0x1a1d('0x2d')];if(!_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x31')]('nolimit')){_0x2e14a1[_0x1a1d('0x1c')]=qs[_0x1a1d('0x1c')](_0x1ddf0f['query'][_0x1a1d('0x1c')]);_0x2e14a1[_0x1a1d('0x1e')]=qs[_0x1a1d('0x1e')](_0x1ddf0f['query']['offset']);}_0x2e14a1[_0x1a1d('0x32')]=qs['sort'](_0x1ddf0f[_0x1a1d('0x2b')]['sort']);_0x2e14a1[_0x1a1d('0x33')]=qs[_0x1a1d('0x2c')](_[_0x1a1d('0x34')](_0x1ddf0f[_0x1a1d('0x2b')],_0x36cd17[_0x1a1d('0x2c')]),_0x389dce);if(_0x1ddf0f['query']['filter']){_0x2e14a1[_0x1a1d('0x33')]=_['merge'](_0x2e14a1[_0x1a1d('0x33')],{'$or':_[_0x1a1d('0x2a')](_0x389dce,function(_0x457f05){if(_0x457f05[_0x1a1d('0x35')]!==_0x1a1d('0x36')){var _0x218da5={};_0x218da5[_0x457f05[_0x1a1d('0x26')]]={'$like':'%'+_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x37')]+'%'};return _0x218da5;}})});}_0x2e14a1=_[_0x1a1d('0x38')]({},_0x2e14a1,_0x1ddf0f[_0x1a1d('0x39')]);var _0x60194d={'where':_0x2e14a1['where']};return db[_0x1a1d('0x27')]['count'](_0x60194d)[_0x1a1d('0x24')](function(_0x44e137){_0xe2150a[_0x1a1d('0x1d')]=_0x44e137;if(_0x1ddf0f[_0x1a1d('0x2b')][_0x1a1d('0x3a')]){_0x2e14a1[_0x1a1d('0x3b')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1a1d('0x3c')](_0x2e14a1);})[_0x1a1d('0x24')](function(_0x2d7def){_0xe2150a[_0x1a1d('0x3d')]=_0x2d7def;return _0xe2150a;})['then'](respondWithFilteredResult(_0x531cc7,_0x2e14a1))[_0x1a1d('0x3e')](handleError(_0x531cc7,null));};exports[_0x1a1d('0x3f')]=function(_0x597848,_0x425c86){var _0x56c771={'raw':!![],'where':{'id':_0x597848['params']['id']}},_0x24ac59={};_0x24ac59[_0x1a1d('0x2d')]=_[_0x1a1d('0x40')](db[_0x1a1d('0x27')][_0x1a1d('0x28')]);_0x24ac59[_0x1a1d('0x2b')]=_['keys'](_0x597848[_0x1a1d('0x2b')]);_0x24ac59[_0x1a1d('0x2c')]=_[_0x1a1d('0x2f')](_0x24ac59[_0x1a1d('0x2d')],_0x24ac59[_0x1a1d('0x2b')]);_0x56c771[_0x1a1d('0x2e')]=_[_0x1a1d('0x2f')](_0x24ac59['model'],qs[_0x1a1d('0x30')](_0x597848['query'][_0x1a1d('0x30')]));_0x56c771[_0x1a1d('0x2e')]=_0x56c771[_0x1a1d('0x2e')][_0x1a1d('0x41')]?_0x56c771[_0x1a1d('0x2e')]:_0x24ac59['model'];if(_0x597848[_0x1a1d('0x2b')]['includeAll']){_0x56c771[_0x1a1d('0x3b')]=[{'all':!![]}];}_0x56c771=_[_0x1a1d('0x38')]({},_0x56c771,_0x597848[_0x1a1d('0x39')]);return db[_0x1a1d('0x27')]['find'](_0x56c771)[_0x1a1d('0x24')](handleEntityNotFound(_0x425c86,null))[_0x1a1d('0x24')](respondWithResult(_0x425c86,null))[_0x1a1d('0x3e')](handleError(_0x425c86,null));};exports[_0x1a1d('0x42')]=function(_0x523997,_0x2ee4ec){return db[_0x1a1d('0x27')][_0x1a1d('0x42')](_0x523997[_0x1a1d('0x43')],{})[_0x1a1d('0x24')](respondWithResult(_0x2ee4ec,0xc9))[_0x1a1d('0x3e')](handleError(_0x2ee4ec,null));};exports[_0x1a1d('0x23')]=function(_0x261391,_0x2eed4d){if(_0x261391[_0x1a1d('0x43')]['id']){delete _0x261391[_0x1a1d('0x43')]['id'];}return db[_0x1a1d('0x27')]['find']({'where':{'id':_0x261391[_0x1a1d('0x44')]['id']}})[_0x1a1d('0x24')](handleEntityNotFound(_0x2eed4d,null))[_0x1a1d('0x24')](saveUpdates(_0x261391['body'],null))['then'](respondWithResult(_0x2eed4d,null))[_0x1a1d('0x3e')](handleError(_0x2eed4d,null));};exports[_0x1a1d('0x25')]=function(_0x5664c8,_0x5ab965){return db[_0x1a1d('0x27')][_0x1a1d('0x45')]({'where':{'id':_0x5664c8['params']['id']}})[_0x1a1d('0x24')](handleEntityNotFound(_0x5ab965,null))[_0x1a1d('0x24')](removeEntity(_0x5ab965,null))[_0x1a1d('0x3e')](handleError(_0x5ab965,null));};exports['describe']=function(_0x19debe,_0x4ab450){return db[_0x1a1d('0x27')][_0x1a1d('0x46')]()[_0x1a1d('0x24')](respondWithResult(_0x4ab450,null))['catch'](handleError(_0x4ab450,null));};function wrapUser(_0x48a62a){return function(_0x5a42f7){var _0x4c3e8d=_0x48a62a['get']({'plain':!![]});_0x4c3e8d[_0x1a1d('0x47')]=[];if(_0x5a42f7){_0x4c3e8d[_0x1a1d('0x48')]=_0x5a42f7[_0x1a1d('0x49')];_0x4c3e8d[_0x1a1d('0x4a')]=_0x5a42f7;}else{_0x4c3e8d[_0x1a1d('0x48')]=moment(0x0)['format'](_0x1a1d('0x4b'));_0x4c3e8d[_0x1a1d('0x4a')]={};}return _0x4c3e8d;};}exports[_0x1a1d('0x4c')]=function(_0x135878,_0x75856c,_0x93b716){var _0x1bd661=[];return db[_0x1a1d('0x4d')][_0x1a1d('0x3c')]({'where':{'role':[_0x1a1d('0x4e'),_0x1a1d('0x4f'),_0x1a1d('0x50')]},'attributes':['id','fullname','name',_0x1a1d('0x51'),_0x1a1d('0x52'),'internal','online','lastLoginAt',_0x1a1d('0x53'),_0x1a1d('0x54')],'order':qs[_0x1a1d('0x55')](_0x1a1d('0x56')),'include':[{'model':db[_0x1a1d('0x57')],'as':'VoiceQueues','attributes':['id',_0x1a1d('0x26'),_0x1a1d('0x35')],'through':{'attributes':[]}}]})[_0x1a1d('0x24')](function(_0x2decd9){if(_0x2decd9){var _0xc8eca7=_0x135878[_0x1a1d('0x50')]['get']({'plain':!![]});if(!_0xc8eca7)throw new Error(_0x1a1d('0x58'));if(_0xc8eca7[_0x1a1d('0x51')]===_0x1a1d('0x50')){return db[_0x1a1d('0x59')][_0x1a1d('0x45')]({'where':{'name':_0x1a1d('0x5a'),'userProfileId':_0xc8eca7['userProfileId']},'raw':!![]})[_0x1a1d('0x24')](function(_0x5c9171){if(_0x5c9171){if(_0x5c9171['autoAssociation']===0x0){return db['UserProfileResource'][_0x1a1d('0x3c')]({'where':{'sectionId':_0x5c9171['id']},'raw':!![]})[_0x1a1d('0x24')](function(_0x1aa751){var _0xc2913a=[];if(_['isEmpty'](_0x1aa751)){_0xc2913a=_[_0x1a1d('0x37')](_0x2decd9,function(_0x404b0a){if(_0x404b0a[_0x1a1d('0x51')]!==_0x1a1d('0x4e')){return _0x404b0a;}});return _0xc2913a;}else{for(var _0x1db02e=0x0;_0x1db02e<_0x2decd9[_0x1a1d('0x41')];_0x1db02e++){var _0x8c010b=_0x2decd9[_0x1db02e];if(_0x8c010b[_0x1a1d('0x51')]==='agent'){var _0x14a6af=_['find'](_0x1aa751,function(_0x1fb6f5){return _0x1fb6f5[_0x1a1d('0x5b')]===_0x8c010b['id'];});if(_0x14a6af)_0xc2913a['push'](_0x8c010b);}else{_0xc2913a['push'](_0x8c010b);}}return _0xc2913a;}});}else{return _0x2decd9;}}else{var _0x1cb573=_[_0x1a1d('0x37')](_0x2decd9,function(_0x397dfe){if(_0x397dfe['role']!==_0x1a1d('0x4e')){return _0x397dfe;}});return _0x1cb573;}});}else{return _0x2decd9;}}})['then'](function(_0x518f8b){var _0x56d426=[];if(_0x518f8b){_0x1bd661=_0x518f8b;for(var _0x53a9fd=0x0;_0x53a9fd<_0x518f8b[_0x1a1d('0x41')];_0x53a9fd+=0x1){_0x1bd661[_0x53a9fd]['messages']=[];_0x56d426[_0x1a1d('0x5c')](db[_0x1a1d('0x27')][_0x1a1d('0x45')]({'where':{'FromId':[_0x135878[_0x1a1d('0x50')]['id'],_0x518f8b[_0x53a9fd]['id']],'ToId':[_0x135878['user']['id'],_0x518f8b[_0x53a9fd]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x1a1d('0x5d'),_0x1a1d('0x5e'),_0x1a1d('0x5f'),_0x1a1d('0x43')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1a1d('0x24')](wrapUser(_0x518f8b[_0x53a9fd])));}return BPromise[_0x1a1d('0x60')](_0x56d426);}return[];})['then'](function(_0x5cdf6a){return{'rows':_0x5cdf6a,'count':_0x5cdf6a[_0x1a1d('0x41')]};})['then'](respondWithResult(_0x75856c,null))['catch'](handleError(_0x75856c,null));}; \ No newline at end of file +var _0x47a2=['./chatInternalMessage.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','ChatInternalMessage','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter'];(function(_0xddd0c9,_0x204372){var _0x514258=function(_0x5021e0){while(--_0x5021e0){_0xddd0c9['push'](_0xddd0c9['shift']());}};_0x514258(++_0x204372);}(_0x47a2,0xbf));var _0x247a=function(_0x58de16,_0x2cc1f5){_0x58de16=_0x58de16-0x0;var _0x48ff5c=_0x47a2[_0x58de16];return _0x48ff5c;};'use strict';var emlformat=require(_0x247a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x247a('0x1'));var jsonpatch=require(_0x247a('0x2'));var rp=require(_0x247a('0x3'));var moment=require(_0x247a('0x4'));var BPromise=require(_0x247a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x247a('0x6'));var sox=require(_0x247a('0x7'));var csv=require(_0x247a('0x8'));var ejs=require(_0x247a('0x9'));var fs=require('fs');var fs_extra=require(_0x247a('0xa'));var _=require(_0x247a('0xb'));var squel=require(_0x247a('0xc'));var crypto=require('crypto');var jsforce=require(_0x247a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x247a('0x8'));var querystring=require(_0x247a('0xe'));var Papa=require(_0x247a('0xf'));var Redis=require(_0x247a('0x10'));var authService=require(_0x247a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x247a('0x12'));var logger=require(_0x247a('0x13'))(_0x247a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x247a('0x15'));var db=require(_0x247a('0x16'))['db'];config['redis']=_['defaults'](config[_0x247a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x247a('0x18'))(new Redis(config['redis']));require(_0x247a('0x19'))['register'](socket);function respondWithStatusCode(_0x3e9a84,_0x1ee099){_0x1ee099=_0x1ee099||0xcc;return function(_0x3304fe){if(_0x3304fe){return _0x3e9a84[_0x247a('0x1a')](_0x1ee099);}return _0x3e9a84[_0x247a('0x1b')](_0x1ee099)[_0x247a('0x1c')]();};}function respondWithResult(_0x324c31,_0x3af2ce){_0x3af2ce=_0x3af2ce||0xc8;return function(_0x1b3e5d){if(_0x1b3e5d){return _0x324c31[_0x247a('0x1b')](_0x3af2ce)[_0x247a('0x1d')](_0x1b3e5d);}};}function respondWithFilteredResult(_0x2f3d71,_0x13be60){return function(_0x3a9671){if(_0x3a9671){var _0xda5bec=typeof _0x13be60[_0x247a('0x1e')]==='undefined'&&typeof _0x13be60[_0x247a('0x1f')]==='undefined';var _0x1416fc=_0x3a9671[_0x247a('0x20')];var _0x9e4b08=_0xda5bec?0x0:_0x13be60[_0x247a('0x1e')];var _0x503940=_0xda5bec?_0x3a9671[_0x247a('0x20')]:_0x13be60[_0x247a('0x1e')]+_0x13be60['limit'];var _0x16491c;if(_0x503940>=_0x1416fc){_0x503940=_0x1416fc;_0x16491c=0xc8;}else{_0x16491c=0xce;}_0x2f3d71[_0x247a('0x1b')](_0x16491c);return _0x2f3d71[_0x247a('0x21')](_0x247a('0x22'),_0x9e4b08+'-'+_0x503940+'/'+_0x1416fc)[_0x247a('0x1d')](_0x3a9671);}return null;};}function patchUpdates(_0x1c6b77){return function(_0x3b1edc){try{jsonpatch[_0x247a('0x23')](_0x3b1edc,_0x1c6b77,!![]);}catch(_0xbe9f91){return BPromise[_0x247a('0x24')](_0xbe9f91);}return _0x3b1edc[_0x247a('0x25')]();};}function saveUpdates(_0x2768b5,_0x406399){return function(_0x41636a){if(_0x41636a){return _0x41636a[_0x247a('0x26')](_0x2768b5)[_0x247a('0x27')](function(_0x17848d){return _0x17848d;});}return null;};}function removeEntity(_0x4af52d,_0x5e0afb){return function(_0x16eba3){if(_0x16eba3){return _0x16eba3['destroy']()['then'](function(){_0x4af52d[_0x247a('0x1b')](0xcc)[_0x247a('0x1c')]();});}};}function handleEntityNotFound(_0x1d2d05,_0x4f4f2e){return function(_0x25c740){if(!_0x25c740){_0x1d2d05[_0x247a('0x1a')](0x194);}return _0x25c740;};}function handleError(_0x2d0db2,_0x105637){_0x105637=_0x105637||0x1f4;return function(_0x4ba860){logger['error'](_0x4ba860[_0x247a('0x28')]);if(_0x4ba860[_0x247a('0x29')]){delete _0x4ba860[_0x247a('0x29')];}_0x2d0db2[_0x247a('0x1b')](_0x105637)[_0x247a('0x2a')](_0x4ba860);};}exports[_0x247a('0x2b')]=function(_0x34ccc4,_0x3bc3ec){var _0x3d4c39={},_0x1c8690={},_0x19dcf8={'count':0x0,'rows':[]};var _0x51346b=_[_0x247a('0x2c')](db['ChatInternalMessage']['rawAttributes'],function(_0x5bb3e9){return{'name':_0x5bb3e9['fieldName'],'type':_0x5bb3e9[_0x247a('0x2d')][_0x247a('0x2e')]};});_0x1c8690['model']=_['map'](_0x51346b,_0x247a('0x29'));_0x1c8690['query']=_[_0x247a('0x2f')](_0x34ccc4[_0x247a('0x30')]);_0x1c8690[_0x247a('0x31')]=_[_0x247a('0x32')](_0x1c8690[_0x247a('0x33')],_0x1c8690['query']);_0x3d4c39['attributes']=_[_0x247a('0x32')](_0x1c8690['model'],qs[_0x247a('0x34')](_0x34ccc4['query'][_0x247a('0x34')]));_0x3d4c39[_0x247a('0x35')]=_0x3d4c39[_0x247a('0x35')][_0x247a('0x36')]?_0x3d4c39[_0x247a('0x35')]:_0x1c8690[_0x247a('0x33')];if(!_0x34ccc4[_0x247a('0x30')][_0x247a('0x37')](_0x247a('0x38'))){_0x3d4c39[_0x247a('0x1f')]=qs['limit'](_0x34ccc4[_0x247a('0x30')]['limit']);_0x3d4c39[_0x247a('0x1e')]=qs['offset'](_0x34ccc4['query'][_0x247a('0x1e')]);}_0x3d4c39[_0x247a('0x39')]=qs[_0x247a('0x3a')](_0x34ccc4[_0x247a('0x30')][_0x247a('0x3a')]);_0x3d4c39['where']=qs[_0x247a('0x31')](_[_0x247a('0x3b')](_0x34ccc4[_0x247a('0x30')],_0x1c8690['filters']),_0x51346b);if(_0x34ccc4[_0x247a('0x30')]['filter']){_0x3d4c39[_0x247a('0x3c')]=_[_0x247a('0x3d')](_0x3d4c39['where'],{'$or':_[_0x247a('0x2c')](_0x51346b,function(_0x4a3893){if(_0x4a3893[_0x247a('0x2d')]!==_0x247a('0x3e')){var _0x4dc239={};_0x4dc239[_0x4a3893[_0x247a('0x29')]]={'$like':'%'+_0x34ccc4[_0x247a('0x30')][_0x247a('0x3f')]+'%'};return _0x4dc239;}})});}_0x3d4c39=_[_0x247a('0x3d')]({},_0x3d4c39,_0x34ccc4[_0x247a('0x40')]);var _0x455e36={'where':_0x3d4c39[_0x247a('0x3c')]};return db['ChatInternalMessage'][_0x247a('0x20')](_0x455e36)[_0x247a('0x27')](function(_0x5a4f65){_0x19dcf8[_0x247a('0x20')]=_0x5a4f65;if(_0x34ccc4[_0x247a('0x30')]['includeAll']){_0x3d4c39[_0x247a('0x41')]=[{'all':!![]}];}return db[_0x247a('0x42')][_0x247a('0x43')](_0x3d4c39);})['then'](function(_0x44c8da){_0x19dcf8['rows']=_0x44c8da;return _0x19dcf8;})[_0x247a('0x27')](respondWithFilteredResult(_0x3bc3ec,_0x3d4c39))[_0x247a('0x44')](handleError(_0x3bc3ec,null));};exports[_0x247a('0x45')]=function(_0x402299,_0x5cdcb3){var _0x111b2f={'raw':!![],'where':{'id':_0x402299[_0x247a('0x46')]['id']}},_0x26812d={};_0x26812d[_0x247a('0x33')]=_[_0x247a('0x2f')](db[_0x247a('0x42')][_0x247a('0x47')]);_0x26812d[_0x247a('0x30')]=_[_0x247a('0x2f')](_0x402299['query']);_0x26812d[_0x247a('0x31')]=_[_0x247a('0x32')](_0x26812d['model'],_0x26812d[_0x247a('0x30')]);_0x111b2f['attributes']=_[_0x247a('0x32')](_0x26812d[_0x247a('0x33')],qs['fields'](_0x402299[_0x247a('0x30')][_0x247a('0x34')]));_0x111b2f[_0x247a('0x35')]=_0x111b2f['attributes']['length']?_0x111b2f[_0x247a('0x35')]:_0x26812d[_0x247a('0x33')];if(_0x402299[_0x247a('0x30')][_0x247a('0x48')]){_0x111b2f['include']=[{'all':!![]}];}_0x111b2f=_[_0x247a('0x3d')]({},_0x111b2f,_0x402299['options']);return db[_0x247a('0x42')][_0x247a('0x49')](_0x111b2f)[_0x247a('0x27')](handleEntityNotFound(_0x5cdcb3,null))[_0x247a('0x27')](respondWithResult(_0x5cdcb3,null))['catch'](handleError(_0x5cdcb3,null));};exports[_0x247a('0x4a')]=function(_0x6cb1a0,_0x3f0868){return db[_0x247a('0x42')][_0x247a('0x4a')](_0x6cb1a0['body'],{})[_0x247a('0x27')](respondWithResult(_0x3f0868,0xc9))['catch'](handleError(_0x3f0868,null));};exports[_0x247a('0x26')]=function(_0x355c9b,_0x10a876){if(_0x355c9b[_0x247a('0x4b')]['id']){delete _0x355c9b[_0x247a('0x4b')]['id'];}return db[_0x247a('0x42')][_0x247a('0x49')]({'where':{'id':_0x355c9b['params']['id']}})[_0x247a('0x27')](handleEntityNotFound(_0x10a876,null))[_0x247a('0x27')](saveUpdates(_0x355c9b[_0x247a('0x4b')],null))[_0x247a('0x27')](respondWithResult(_0x10a876,null))[_0x247a('0x44')](handleError(_0x10a876,null));};exports['destroy']=function(_0x4370a7,_0x4becbd){return db['ChatInternalMessage']['find']({'where':{'id':_0x4370a7[_0x247a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4becbd,null))[_0x247a('0x27')](removeEntity(_0x4becbd,null))[_0x247a('0x44')](handleError(_0x4becbd,null));};exports[_0x247a('0x4c')]=function(_0x15e01f,_0x3a5417){return db[_0x247a('0x42')][_0x247a('0x4c')]()[_0x247a('0x27')](respondWithResult(_0x3a5417,null))['catch'](handleError(_0x3a5417,null));};function wrapUser(_0x349196){return function(_0x129a36){var _0x5ce7bf=_0x349196[_0x247a('0x4d')]({'plain':!![]});_0x5ce7bf[_0x247a('0x4e')]=[];if(_0x129a36){_0x5ce7bf[_0x247a('0x4f')]=_0x129a36[_0x247a('0x50')];_0x5ce7bf[_0x247a('0x51')]=_0x129a36;}else{_0x5ce7bf[_0x247a('0x4f')]=moment(0x0)[_0x247a('0x52')](_0x247a('0x53'));_0x5ce7bf['lastMessage']={};}return _0x5ce7bf;};}exports[_0x247a('0x54')]=function(_0x1880ce,_0x5a2b2a,_0x2781a1){var _0x55e908=[];return db[_0x247a('0x55')][_0x247a('0x43')]({'where':{'role':[_0x247a('0x56'),_0x247a('0x57'),'user']},'attributes':['id','fullname',_0x247a('0x29'),_0x247a('0x58'),'userpic','internal',_0x247a('0x59'),_0x247a('0x5a'),_0x247a('0x5b'),_0x247a('0x5c')],'order':qs[_0x247a('0x3a')]('-online'),'include':[{'model':db[_0x247a('0x5d')],'as':_0x247a('0x5e'),'attributes':['id',_0x247a('0x29'),_0x247a('0x2d')],'through':{'attributes':[]}}]})[_0x247a('0x27')](function(_0x48a572){if(_0x48a572){var _0x423903=_0x1880ce[_0x247a('0x5f')][_0x247a('0x4d')]({'plain':!![]});if(!_0x423903)throw new Error(_0x247a('0x60'));if(_0x423903[_0x247a('0x58')]===_0x247a('0x5f')){return db[_0x247a('0x61')][_0x247a('0x49')]({'where':{'name':_0x247a('0x62'),'userProfileId':_0x423903['userProfileId']},'raw':!![]})['then'](function(_0x3efba9){if(_0x3efba9){if(_0x3efba9[_0x247a('0x63')]===0x0){return db[_0x247a('0x64')][_0x247a('0x43')]({'where':{'sectionId':_0x3efba9['id']},'raw':!![]})[_0x247a('0x27')](function(_0x410787){var _0x14029c=[];if(_[_0x247a('0x65')](_0x410787)){_0x14029c=_[_0x247a('0x3f')](_0x48a572,function(_0x2c739e){if(_0x2c739e['role']!==_0x247a('0x56')){return _0x2c739e;}});return _0x14029c;}else{for(var _0x4fb1a3=0x0;_0x4fb1a3<_0x48a572[_0x247a('0x36')];_0x4fb1a3++){var _0x1f2f42=_0x48a572[_0x4fb1a3];if(_0x1f2f42[_0x247a('0x58')]==='agent'){var _0x7b284b=_['find'](_0x410787,function(_0x225ecc){return _0x225ecc[_0x247a('0x66')]===_0x1f2f42['id'];});if(_0x7b284b)_0x14029c[_0x247a('0x67')](_0x1f2f42);}else{_0x14029c['push'](_0x1f2f42);}}return _0x14029c;}});}else{return _0x48a572;}}else{var _0x4513c1=_[_0x247a('0x3f')](_0x48a572,function(_0x1e13b5){if(_0x1e13b5[_0x247a('0x58')]!=='agent'){return _0x1e13b5;}});return _0x4513c1;}});}else{return _0x48a572;}}})[_0x247a('0x27')](function(_0x17cdb6){var _0x23ae76=[];if(_0x17cdb6){_0x55e908=_0x17cdb6;for(var _0x3d034a=0x0;_0x3d034a<_0x17cdb6[_0x247a('0x36')];_0x3d034a+=0x1){_0x55e908[_0x3d034a][_0x247a('0x4e')]=[];_0x23ae76['push'](db[_0x247a('0x42')][_0x247a('0x49')]({'where':{'FromId':[_0x1880ce[_0x247a('0x5f')]['id'],_0x17cdb6[_0x3d034a]['id']],'ToId':[_0x1880ce[_0x247a('0x5f')]['id'],_0x17cdb6[_0x3d034a]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x247a('0x68'),_0x247a('0x69'),_0x247a('0x6a'),_0x247a('0x4b')],'order':qs['sort'](_0x247a('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x17cdb6[_0x3d034a])));}return BPromise['all'](_0x23ae76);}return[];})[_0x247a('0x27')](function(_0x2bf899){return{'rows':_0x2bf899,'count':_0x2bf899['length']};})['then'](respondWithResult(_0x5a2b2a,null))['catch'](handleError(_0x5a2b2a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2c60a49..fefd55e 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 _0x3b48=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x186bfa,_0xae755f){var _0x458af4=function(_0x1f572d){while(--_0x1f572d){_0x186bfa['push'](_0x186bfa['shift']());}};_0x458af4(++_0xae755f);}(_0x3b48,0x1b1));var _0x83b4=function(_0x240315,_0x5888c8){_0x240315=_0x240315-0x0;var _0x1f0a1d=_0x3b48[_0x240315];return _0x1f0a1d;};'use strict';var EventEmitter=require(_0x83b4('0x0'));var ChatInternalMessage=require(_0x83b4('0x1'))['db'][_0x83b4('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x83b4('0x3')](0x0);var events={'afterCreate':_0x83b4('0x4'),'afterUpdate':_0x83b4('0x5'),'afterDestroy':_0x83b4('0x6')};function emitEvent(_0x559fc7){return function(_0x516c2a,_0x48a0f8,_0x2b7ca3){ChatInternalMessageEvents[_0x83b4('0x7')](_0x559fc7+':'+_0x516c2a['id'],_0x516c2a);ChatInternalMessageEvents[_0x83b4('0x7')](_0x559fc7,_0x516c2a);_0x2b7ca3(null);};}for(var e in events){if(events[_0x83b4('0x8')](e)){var event=events[e];ChatInternalMessage[_0x83b4('0x9')](e,emitEvent(event));}}module[_0x83b4('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb923=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x8ee223,_0x3ecb7d){var _0x3adefb=function(_0x405385){while(--_0x405385){_0x8ee223['push'](_0x8ee223['shift']());}};_0x3adefb(++_0x3ecb7d);}(_0xb923,0x1a2));var _0x3b92=function(_0x265a39,_0x21b24a){_0x265a39=_0x265a39-0x0;var _0x4b9b52=_0xb923[_0x265a39];return _0x4b9b52;};'use strict';var EventEmitter=require(_0x3b92('0x0'));var ChatInternalMessage=require(_0x3b92('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3b92('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b92('0x3'),'afterDestroy':_0x3b92('0x4')};function emitEvent(_0xb6b069){return function(_0x597b75,_0x2bcb94,_0x31d981){ChatInternalMessageEvents[_0x3b92('0x5')](_0xb6b069+':'+_0x597b75['id'],_0x597b75);ChatInternalMessageEvents[_0x3b92('0x5')](_0xb6b069,_0x597b75);_0x31d981(null);};}for(var e in events){if(events[_0x3b92('0x6')](e)){var event=events[e];ChatInternalMessage[_0x3b92('0x7')](e,emitEvent(event));}}module[_0x3b92('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8b5c8d6..c3b0536 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 _0x7b50=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4322de,_0x4c21d3){var _0x3230f8=function(_0x337676){while(--_0x337676){_0x4322de['push'](_0x4322de['shift']());}};_0x3230f8(++_0x4c21d3);}(_0x7b50,0x1df));var _0x07b5=function(_0x4aaa22,_0x18bd75){_0x4aaa22=_0x4aaa22-0x0;var _0x40be29=_0x7b50[_0x4aaa22];return _0x40be29;};'use strict';var _=require(_0x07b5('0x0'));var util=require('util');var logger=require(_0x07b5('0x1'))(_0x07b5('0x2'));var moment=require(_0x07b5('0x3'));var BPromise=require(_0x07b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07b5('0x5'));var rimraf=require('rimraf');var config=require(_0x07b5('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x07b5('0x7')]=function(_0x24d12d,_0x1929ad){return _0x24d12d[_0x07b5('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x07b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07b5('0xa'),'collate':_0x07b5('0xb')});}; \ No newline at end of file +var _0x0723=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xd1dc6,_0x4f64c5){var _0xa275ee=function(_0x3e2c44){while(--_0x3e2c44){_0xd1dc6['push'](_0xd1dc6['shift']());}};_0xa275ee(++_0x4f64c5);}(_0x0723,0x169));var _0x3072=function(_0x27153e,_0xe304d5){_0x27153e=_0x27153e-0x0;var _0x4b1254=_0x0723[_0x27153e];return _0x4b1254;};'use strict';var _=require(_0x3072('0x0'));var util=require(_0x3072('0x1'));var logger=require(_0x3072('0x2'))(_0x3072('0x3'));var moment=require(_0x3072('0x4'));var BPromise=require(_0x3072('0x5'));var rp=require(_0x3072('0x6'));var fs=require('fs');var path=require(_0x3072('0x7'));var rimraf=require(_0x3072('0x8'));var config=require(_0x3072('0x9'));var attributes=require(_0x3072('0xa'));module[_0x3072('0xb')]=function(_0x26ba78,_0x501629){return _0x26ba78[_0x3072('0xc')](_0x3072('0xd'),attributes,{'tableName':_0x3072('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3072('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ab58ea6..eec429e 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 _0x5889=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x556e0b,_0x413257){var _0x2e49ff=function(_0x44a9c2){while(--_0x44a9c2){_0x556e0b['push'](_0x556e0b['shift']());}};_0x2e49ff(++_0x413257);}(_0x5889,0x95));var _0x9588=function(_0x4ae292,_0x51bc7a){_0x4ae292=_0x4ae292-0x0;var _0x174d0c=_0x5889[_0x4ae292];return _0x174d0c;};'use strict';var _=require('lodash');var util=require(_0x9588('0x0'));var moment=require(_0x9588('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9588('0x2'));var db=require(_0x9588('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9588('0x4'))(_0x9588('0x5'));var config=require(_0x9588('0x6'));var jayson=require(_0x9588('0x7'));var client=jayson[_0x9588('0x8')][_0x9588('0x9')]({'port':0x232a});config[_0x9588('0xa')]=_[_0x9588('0xb')](config['redis'],{'host':_0x9588('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9588('0xa')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4d82a1,_0x1289ee,_0x3996ce){return new BPromise(function(_0x1d23a8,_0x4f76fa){return client['request'](_0x4d82a1,_0x3996ce)[_0x9588('0xd')](function(_0x5752cf){logger['info'](_0x9588('0xe'),_0x1289ee,'request\x20sent');logger[_0x9588('0xf')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1289ee,_0x9588('0x10'),JSON[_0x9588('0x11')](_0x5752cf));if(_0x5752cf[_0x9588('0x12')]){if(_0x5752cf[_0x9588('0x12')]['code']===0x1f4){logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);return _0x4f76fa(_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);}logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5752cf[_0x9588('0x12')]['message']);return _0x1d23a8(_0x5752cf[_0x9588('0x12')][_0x9588('0x13')]);}else{logger['info'](_0x9588('0xe'),_0x1289ee,_0x9588('0x10'));_0x1d23a8(_0x5752cf[_0x9588('0x14')][_0x9588('0x13')]);}})[_0x9588('0x15')](function(_0x5703ce){logger[_0x9588('0x12')](_0x9588('0xe'),_0x1289ee,_0x5703ce);_0x4f76fa(_0x5703ce);});});} \ No newline at end of file +var _0x16e4=['ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','then','info','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16e4,0x97));var _0x416e=function(_0x565c59,_0x47d574){_0x565c59=_0x565c59-0x0;var _0x4e1306=_0x16e4[_0x565c59];return _0x4e1306;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var moment=require(_0x416e('0x2'));var BPromise=require(_0x416e('0x3'));var rs=require(_0x416e('0x4'));var fs=require('fs');var Redis=require(_0x416e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x416e('0x6'));var logger=require('../../config/logger')(_0x416e('0x7'));var config=require(_0x416e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x416e('0x9')][_0x416e('0xa')]({'port':0x232a});config[_0x416e('0xb')]=_[_0x416e('0xc')](config[_0x416e('0xb')],{'host':_0x416e('0xd'),'port':0x18eb});var socket=require(_0x416e('0xe'))(new Redis(config[_0x416e('0xb')]));require(_0x416e('0xf'))['register'](socket);function respondWithRpcPromise(_0x86c7f2,_0x541e74,_0x286d17){return new BPromise(function(_0x14bbf6,_0x13bcd0){return client['request'](_0x86c7f2,_0x286d17)[_0x416e('0x10')](function(_0x417bc6){logger[_0x416e('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x541e74,_0x416e('0x12'));logger['debug'](_0x416e('0x13'),_0x541e74,_0x416e('0x12'),JSON[_0x416e('0x14')](_0x417bc6));if(_0x417bc6[_0x416e('0x15')]){if(_0x417bc6['error'][_0x416e('0x16')]===0x1f4){logger[_0x416e('0x15')](_0x416e('0x17'),_0x541e74,_0x417bc6[_0x416e('0x15')][_0x416e('0x18')]);return _0x13bcd0(_0x417bc6[_0x416e('0x15')][_0x416e('0x18')]);}logger[_0x416e('0x15')](_0x416e('0x17'),_0x541e74,_0x417bc6['error']['message']);return _0x14bbf6(_0x417bc6['error'][_0x416e('0x18')]);}else{logger[_0x416e('0x11')](_0x416e('0x17'),_0x541e74,_0x416e('0x12'));_0x14bbf6(_0x417bc6['result'][_0x416e('0x18')]);}})[_0x416e('0x19')](function(_0x4b6351){logger[_0x416e('0x15')](_0x416e('0x17'),_0x541e74,_0x4b6351);_0x13bcd0(_0x4b6351);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0c1716e..33d6c2a 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 _0xa798=['save','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x1a5243,_0x2755ec){var _0x575645=function(_0x54ee7c){while(--_0x54ee7c){_0x1a5243['push'](_0x1a5243['shift']());}};_0x575645(++_0x2755ec);}(_0xa798,0x17a));var _0x8a79=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa798[_0x25bea7];return _0x175952;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x8a79('0x0'),_0x8a79('0x1'),_0x8a79('0x2')];function createListener(_0x510ea1,_0x1d1b5f){return function(_0x53ec74){_0x1d1b5f[_0x8a79('0x3')](_0x510ea1,_0x53ec74);};}function removeListener(_0x52f725,_0x31db43){return function(){ChatInternalMessageEvents[_0x8a79('0x4')](_0x52f725,_0x31db43);};}exports[_0x8a79('0x5')]=function(_0x3fe06c){for(var _0x68553=0x0,_0x406015=events['length'];_0x68553<_0x406015;_0x68553++){var _0x552f20=events[_0x68553];var _0x31f9f3=createListener(_0x8a79('0x6')+_0x552f20,_0x3fe06c);ChatInternalMessageEvents['on'](_0x552f20,_0x31f9f3);}}; \ No newline at end of file +var _0xfa1a=['length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit','register'];(function(_0x32b51a,_0x5725a3){var _0x20217d=function(_0x53d2a2){while(--_0x53d2a2){_0x32b51a['push'](_0x32b51a['shift']());}};_0x20217d(++_0x5725a3);}(_0xfa1a,0x1ec));var _0xafa1=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0xfa1a[_0x2c6120];return _0x5fb114;};'use strict';var ChatInternalMessageEvents=require(_0xafa1('0x0'));var events=['save',_0xafa1('0x1'),_0xafa1('0x2')];function createListener(_0x2be7b1,_0x556460){return function(_0x1a276c){_0x556460[_0xafa1('0x3')](_0x2be7b1,_0x1a276c);};}function removeListener(_0x2be79c,_0x109298){return function(){ChatInternalMessageEvents['removeListener'](_0x2be79c,_0x109298);};}exports[_0xafa1('0x4')]=function(_0x443c4c){for(var _0x175614=0x0,_0x287931=events[_0xafa1('0x5')];_0x175614<_0x287931;_0x175614++){var _0x57a30e=events[_0x175614];var _0x155295=createListener(_0xafa1('0x6')+_0x57a30e,_0x443c4c);ChatInternalMessageEvents['on'](_0x57a30e,_0x155295);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 075a98a..d0afa43 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 _0x2e82=['./chatInternalMessage.controller','get','index','isAuthenticated','describe','/users','getUsers','show','post','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x633a64,_0x546fe2){var _0x3f60e7=function(_0x3401a8){while(--_0x3401a8){_0x633a64['push'](_0x633a64['shift']());}};_0x3f60e7(++_0x546fe2);}(_0x2e82,0x1e8));var _0x22e8=function(_0x330875,_0x35b36e){_0x330875=_0x330875-0x0;var _0xd4813c=_0x2e82[_0x330875];return _0xd4813c;};'use strict';var multer=require('multer');var util=require(_0x22e8('0x0'));var path=require(_0x22e8('0x1'));var timeout=require('connect-timeout');var express=require(_0x22e8('0x2'));var router=express[_0x22e8('0x3')]();var fs_extra=require(_0x22e8('0x4'));var auth=require(_0x22e8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22e8('0x6'));router[_0x22e8('0x7')]('/',auth['isAuthenticated'](),controller[_0x22e8('0x8')]);router['get']('/describe',auth[_0x22e8('0x9')](),controller[_0x22e8('0xa')]);router[_0x22e8('0x7')](_0x22e8('0xb'),auth[_0x22e8('0x9')](),controller[_0x22e8('0xc')]);router[_0x22e8('0x7')]('/:id',auth[_0x22e8('0x9')](),controller[_0x22e8('0xd')]);router[_0x22e8('0xe')]('/',auth[_0x22e8('0x9')](),controller['create']);router['put'](_0x22e8('0xf'),controller[_0x22e8('0x10')]);router[_0x22e8('0x11')](_0x22e8('0xf'),auth[_0x22e8('0x9')](),controller[_0x22e8('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5223=['../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','getUsers','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a602a,_0x29e22a){var _0x6c4f9b=function(_0x2112f7){while(--_0x2112f7){_0x4a602a['push'](_0x4a602a['shift']());}};_0x6c4f9b(++_0x29e22a);}(_0x5223,0x67));var _0x3522=function(_0x58fcb8,_0x3b46a1){_0x58fcb8=_0x58fcb8-0x0;var _0x575b1c=_0x5223[_0x58fcb8];return _0x575b1c;};'use strict';var multer=require(_0x3522('0x0'));var util=require('util');var path=require(_0x3522('0x1'));var timeout=require(_0x3522('0x2'));var express=require(_0x3522('0x3'));var router=express[_0x3522('0x4')]();var fs_extra=require(_0x3522('0x5'));var auth=require(_0x3522('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3522('0x7'));var controller=require(_0x3522('0x8'));router['get']('/',auth[_0x3522('0x9')](),controller[_0x3522('0xa')]);router[_0x3522('0xb')](_0x3522('0xc'),auth[_0x3522('0x9')](),controller['describe']);router[_0x3522('0xb')]('/users',auth[_0x3522('0x9')](),controller[_0x3522('0xd')]);router[_0x3522('0xb')](_0x3522('0xe'),auth[_0x3522('0x9')](),controller[_0x3522('0xf')]);router[_0x3522('0x10')]('/',auth[_0x3522('0x9')](),controller[_0x3522('0x11')]);router[_0x3522('0x12')]('/:id',controller[_0x3522('0x13')]);router['delete']('/:id',auth[_0x3522('0x9')](),controller[_0x3522('0x14')]);module[_0x3522('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 82ab2a0..70a748b 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 _0xb846=['STRING','TEXT','sequelize','medium','BOOLEAN','ENUM','DATE'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0xb846,0x1d0));var _0x6b84=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xb846[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x6b84('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x6b84('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6b84('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6b84('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6b84('0x4')]},'providerName':{'type':Sequelize[_0x6b84('0x5')]},'providerResponse':{'type':Sequelize[_0x6b84('0x6')]}}; \ No newline at end of file +var _0x38c9=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x489102,_0xa751d7){var _0x2e0d6a=function(_0x2abb75){while(--_0x2abb75){_0x489102['push'](_0x489102['shift']());}};_0x2e0d6a(++_0xa751d7);}(_0x38c9,0x199));var _0x938c=function(_0x3132e8,_0x499a0e){_0x3132e8=_0x3132e8-0x0;var _0x43eb8c=_0x38c9[_0x3132e8];return _0x43eb8c;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'body':{'type':Sequelize[_0x938c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x938c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x938c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x938c('0x4')]('in',_0x938c('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x938c('0x6')]},'providerName':{'type':Sequelize[_0x938c('0x7')]},'providerResponse':{'type':Sequelize[_0x938c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 854538e..78cf010 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 _0x9d60=['localhost','socket.io-emitter','./chatMessage.socket','register','http','client','request','then','info','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','where','filter','merge','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','params','length','find','create','update','body','describe','chat-interactions','accept','chat','read','readAt','UserId','user','agent','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','fullname','email','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults'];(function(_0xb84935,_0xcfc95c){var _0x3579fc=function(_0x52af36){while(--_0x52af36){_0xb84935['push'](_0xb84935['shift']());}};_0x3579fc(++_0xcfc95c);}(_0x9d60,0x1e6));var _0x09d6=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x9d60[_0x41b0a8];return _0x3a83d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09d6('0x0'));var zipdir=require(_0x09d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09d6('0x2'));var moment=require(_0x09d6('0x3'));var BPromise=require(_0x09d6('0x4'));var Mustache=require(_0x09d6('0x5'));var util=require(_0x09d6('0x6'));var path=require(_0x09d6('0x7'));var sox=require(_0x09d6('0x8'));var csv=require(_0x09d6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x09d6('0xa'));var _=require('lodash');var squel=require(_0x09d6('0xb'));var crypto=require(_0x09d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x09d6('0xd'));var toCsv=require(_0x09d6('0x9'));var querystring=require(_0x09d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x09d6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x09d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09d6('0x11'));var logger=require(_0x09d6('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x09d6('0x13'))['db'];config[_0x09d6('0x14')]=_[_0x09d6('0x15')](config['redis'],{'host':_0x09d6('0x16'),'port':0x18eb});var socket=require(_0x09d6('0x17'))(new Redis(config['redis']));require(_0x09d6('0x18'))[_0x09d6('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x09d6('0x1a')]({'port':0x232c});var client9002=jayson[_0x09d6('0x1b')][_0x09d6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x362700,_0x5e3783,_0x4493ad,_0x40f6aa){return new BPromise(function(_0x22fa85,_0x3b9e66){var _0x1e9dc6=_0x40f6aa||client;return _0x1e9dc6[_0x09d6('0x1c')](_0x362700,_0x4493ad)[_0x09d6('0x1d')](function(_0x39ca3f){logger[_0x09d6('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x5e3783,_0x09d6('0x1f'));logger[_0x09d6('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5e3783,'request\x20sent',JSON[_0x09d6('0x21')](_0x39ca3f));if(_0x39ca3f['error']){if(_0x39ca3f['error']['code']===0x1f4){logger[_0x09d6('0x22')](_0x09d6('0x23'),_0x5e3783,_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);return _0x3b9e66(_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);}logger[_0x09d6('0x22')](_0x09d6('0x23'),_0x5e3783,_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);return _0x22fa85(_0x39ca3f[_0x09d6('0x22')][_0x09d6('0x24')]);}else{logger['info'](_0x09d6('0x23'),_0x5e3783,_0x09d6('0x1f'));_0x22fa85(_0x39ca3f[_0x09d6('0x25')]['message']);}})[_0x09d6('0x26')](function(_0x5bedf8){logger[_0x09d6('0x22')]('ChatMessage,\x20%s,\x20%s',_0x5e3783,_0x5bedf8);_0x3b9e66(_0x5bedf8);});});}function respondWithStatusCode(_0x54ae56,_0x25dcd0){_0x25dcd0=_0x25dcd0||0xcc;return function(_0x2217de){if(_0x2217de){return _0x54ae56[_0x09d6('0x27')](_0x25dcd0);}return _0x54ae56[_0x09d6('0x28')](_0x25dcd0)[_0x09d6('0x29')]();};}function respondWithResult(_0x58d8d3,_0x3ea534){_0x3ea534=_0x3ea534||0xc8;return function(_0x44ef81){if(_0x44ef81){return _0x58d8d3[_0x09d6('0x28')](_0x3ea534)[_0x09d6('0x2a')](_0x44ef81);}};}function respondWithFilteredResult(_0x1ebd88,_0x5d230b){return function(_0x3a75f5){if(_0x3a75f5){var _0x243432=typeof _0x5d230b[_0x09d6('0x2b')]===_0x09d6('0x2c')&&typeof _0x5d230b['limit']===_0x09d6('0x2c');var _0x4ad4bb=_0x3a75f5[_0x09d6('0x2d')];var _0x2bb16c=_0x243432?0x0:_0x5d230b[_0x09d6('0x2b')];var _0x368f25=_0x243432?_0x3a75f5[_0x09d6('0x2d')]:_0x5d230b[_0x09d6('0x2b')]+_0x5d230b[_0x09d6('0x2e')];var _0x1b89c4;if(_0x368f25>=_0x4ad4bb){_0x368f25=_0x4ad4bb;_0x1b89c4=0xc8;}else{_0x1b89c4=0xce;}_0x1ebd88[_0x09d6('0x28')](_0x1b89c4);return _0x1ebd88['set'](_0x09d6('0x2f'),_0x2bb16c+'-'+_0x368f25+'/'+_0x4ad4bb)[_0x09d6('0x2a')](_0x3a75f5);}return null;};}function patchUpdates(_0x3d9d69){return function(_0x1f8775){try{jsonpatch[_0x09d6('0x30')](_0x1f8775,_0x3d9d69,!![]);}catch(_0x25444d){return BPromise[_0x09d6('0x31')](_0x25444d);}return _0x1f8775[_0x09d6('0x32')]();};}function saveUpdates(_0x1b96db,_0x38156e){return function(_0x4dfcd7){if(_0x4dfcd7){return _0x4dfcd7['update'](_0x1b96db)[_0x09d6('0x1d')](function(_0x1327a7){return _0x1327a7;});}return null;};}function removeEntity(_0x1688e0,_0x157ff8){return function(_0x5aa17e){if(_0x5aa17e){return _0x5aa17e[_0x09d6('0x33')]()[_0x09d6('0x1d')](function(){_0x1688e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12fd4c,_0x253b7a){return function(_0x1933f3){if(!_0x1933f3){_0x12fd4c[_0x09d6('0x27')](0x194);}return _0x1933f3;};}function handleError(_0x57327b,_0x19c48c){_0x19c48c=_0x19c48c||0x1f4;return function(_0x46e302){logger[_0x09d6('0x22')](_0x46e302[_0x09d6('0x34')]);if(_0x46e302[_0x09d6('0x35')]){delete _0x46e302['name'];}_0x57327b['status'](_0x19c48c)[_0x09d6('0x36')](_0x46e302);};}exports[_0x09d6('0x37')]=function(_0x5013d9,_0xb667b2){var _0x498549={},_0x5d54d8={},_0x57e8ce={'count':0x0,'rows':[]};var _0x31b77d=_[_0x09d6('0x38')](db['ChatMessage'][_0x09d6('0x39')],function(_0x59a660){return{'name':_0x59a660[_0x09d6('0x3a')],'type':_0x59a660['type'][_0x09d6('0x3b')]};});_0x5d54d8[_0x09d6('0x3c')]=_[_0x09d6('0x38')](_0x31b77d,_0x09d6('0x35'));_0x5d54d8[_0x09d6('0x3d')]=_[_0x09d6('0x3e')](_0x5013d9[_0x09d6('0x3d')]);_0x5d54d8[_0x09d6('0x3f')]=_['intersection'](_0x5d54d8[_0x09d6('0x3c')],_0x5d54d8[_0x09d6('0x3d')]);_0x498549[_0x09d6('0x40')]=_[_0x09d6('0x41')](_0x5d54d8[_0x09d6('0x3c')],qs[_0x09d6('0x42')](_0x5013d9[_0x09d6('0x3d')]['fields']));_0x498549[_0x09d6('0x40')]=_0x498549['attributes']['length']?_0x498549[_0x09d6('0x40')]:_0x5d54d8[_0x09d6('0x3c')];if(!_0x5013d9[_0x09d6('0x3d')]['hasOwnProperty'](_0x09d6('0x43'))){_0x498549[_0x09d6('0x2e')]=qs[_0x09d6('0x2e')](_0x5013d9[_0x09d6('0x3d')]['limit']);_0x498549[_0x09d6('0x2b')]=qs[_0x09d6('0x2b')](_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x2b')]);}_0x498549[_0x09d6('0x44')]=qs['sort'](_0x5013d9[_0x09d6('0x3d')]['sort']);_0x498549[_0x09d6('0x45')]=qs[_0x09d6('0x3f')](_['pick'](_0x5013d9[_0x09d6('0x3d')],_0x5d54d8[_0x09d6('0x3f')]),_0x31b77d);if(_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x46')]){_0x498549[_0x09d6('0x45')]=_[_0x09d6('0x47')](_0x498549[_0x09d6('0x45')],{'$or':_[_0x09d6('0x38')](_0x31b77d,function(_0x92a687){if(_0x92a687['type']!==_0x09d6('0x48')){var _0x522d9b={};_0x522d9b[_0x92a687[_0x09d6('0x35')]]={'$like':'%'+_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x46')]+'%'};return _0x522d9b;}})});}_0x498549=_['merge']({},_0x498549,_0x5013d9['options']);var _0x5c24e5={'where':_0x498549[_0x09d6('0x45')]};return db[_0x09d6('0x49')][_0x09d6('0x2d')](_0x5c24e5)[_0x09d6('0x1d')](function(_0x1a0a21){_0x57e8ce[_0x09d6('0x2d')]=_0x1a0a21;if(_0x5013d9[_0x09d6('0x3d')][_0x09d6('0x4a')]){_0x498549[_0x09d6('0x4b')]=[{'all':!![]}];}return db[_0x09d6('0x49')][_0x09d6('0x4c')](_0x498549);})[_0x09d6('0x1d')](function(_0x24f9f9){_0x57e8ce[_0x09d6('0x4d')]=_0x24f9f9;return _0x57e8ce;})['then'](respondWithFilteredResult(_0xb667b2,_0x498549))[_0x09d6('0x26')](handleError(_0xb667b2,null));};exports[_0x09d6('0x4e')]=function(_0x2e2051,_0x5774c8){var _0x27bff2={'raw':!![],'where':{'id':_0x2e2051[_0x09d6('0x4f')]['id']}},_0x389d7f={};_0x389d7f[_0x09d6('0x3c')]=_[_0x09d6('0x3e')](db[_0x09d6('0x49')][_0x09d6('0x39')]);_0x389d7f[_0x09d6('0x3d')]=_['keys'](_0x2e2051[_0x09d6('0x3d')]);_0x389d7f[_0x09d6('0x3f')]=_[_0x09d6('0x41')](_0x389d7f['model'],_0x389d7f[_0x09d6('0x3d')]);_0x27bff2['attributes']=_['intersection'](_0x389d7f[_0x09d6('0x3c')],qs[_0x09d6('0x42')](_0x2e2051[_0x09d6('0x3d')][_0x09d6('0x42')]));_0x27bff2[_0x09d6('0x40')]=_0x27bff2[_0x09d6('0x40')][_0x09d6('0x50')]?_0x27bff2['attributes']:_0x389d7f[_0x09d6('0x3c')];if(_0x2e2051[_0x09d6('0x3d')][_0x09d6('0x4a')]){_0x27bff2[_0x09d6('0x4b')]=[{'all':!![]}];}_0x27bff2=_['merge']({},_0x27bff2,_0x2e2051['options']);return db[_0x09d6('0x49')][_0x09d6('0x51')](_0x27bff2)[_0x09d6('0x1d')](handleEntityNotFound(_0x5774c8,null))['then'](respondWithResult(_0x5774c8,null))[_0x09d6('0x26')](handleError(_0x5774c8,null));};exports[_0x09d6('0x52')]=function(_0x2a0140,_0x5071b8){return db[_0x09d6('0x49')][_0x09d6('0x52')](_0x2a0140['body'],{})['then'](respondWithResult(_0x5071b8,0xc9))['catch'](handleError(_0x5071b8,null));};exports[_0x09d6('0x53')]=function(_0x9afb7b,_0x4b3447){if(_0x9afb7b[_0x09d6('0x54')]['id']){delete _0x9afb7b[_0x09d6('0x54')]['id'];}return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x9afb7b[_0x09d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b3447,null))[_0x09d6('0x1d')](saveUpdates(_0x9afb7b[_0x09d6('0x54')],null))['then'](respondWithResult(_0x4b3447,null))['catch'](handleError(_0x4b3447,null));};exports[_0x09d6('0x33')]=function(_0x16265b,_0x4b1a8b){return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x16265b[_0x09d6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b1a8b,null))['then'](removeEntity(_0x4b1a8b,null))[_0x09d6('0x26')](handleError(_0x4b1a8b,null));};exports['describe']=function(_0xa19279,_0x409ecb){return db['ChatMessage'][_0x09d6('0x55')]()[_0x09d6('0x1d')](respondWithResult(_0x409ecb,null))[_0x09d6('0x26')](handleError(_0x409ecb,null));};var interaction_log=require(_0x09d6('0x12'))(_0x09d6('0x56'));exports[_0x09d6('0x57')]=function(_0x1d023d,_0x190657,_0x4d7fd6){var _0x4659cf={'agent':{},'channel':_0x09d6('0x58')};if(_0x1d023d[_0x09d6('0x54')]['id']){delete _0x1d023d['body']['id'];}_0x1d023d[_0x09d6('0x54')][_0x09d6('0x59')]=!![];_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')]=_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')]||_0x1d023d[_0x09d6('0x5c')]['id'];_0x4659cf[_0x09d6('0x5d')]['id']=_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')];return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x1d023d[_0x09d6('0x4f')]['id'],'UserId':null}})[_0x09d6('0x1d')](handleEntityNotFound(_0x190657,null))[_0x09d6('0x1d')](saveUpdates(_0x1d023d[_0x09d6('0x54')],null))[_0x09d6('0x1d')](function(_0xfdcd19){if(_0xfdcd19){_0x4659cf[_0x09d6('0x24')]=_0xfdcd19['get']({'plain':!![]});return db[_0x09d6('0x5e')][_0x09d6('0x51')]({'where':{'id':_0xfdcd19[_0x09d6('0x5f')]}});}return null;})[_0x09d6('0x1d')](handleEntityNotFound(_0x190657,null))[_0x09d6('0x1d')](function(_0x1bbb6f){if(_0x1bbb6f){return _0x1bbb6f['update']({'UserId':_0x1d023d[_0x09d6('0x54')][_0x09d6('0x5b')],'read1stAt':_['isNil'](_0x1bbb6f[_0x09d6('0x60')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x09d6('0x1d')](function(_0x1eb166){if(_0x1eb166){_0x4659cf[_0x09d6('0x61')]=_0x1eb166[_0x09d6('0x62')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1d023d[_0x09d6('0x5c')]['id'],_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x35')],_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x63')],_0x4659cf['interaction']['id'],_0x1d023d[_0x09d6('0x54')]?JSON['stringify'](_0x1d023d[_0x09d6('0x54')]):'null');return respondWithRpcPromise(_0x09d6('0x64'),_0x09d6('0x65'),_0x4659cf);}return null;})[_0x09d6('0x1d')](function(_0x4aec30){var _0x192432=_0x09d6('0x66')+_0x4aec30[_0x09d6('0x24')]['ContactId'];return db[_0x09d6('0x67')][_0x09d6('0x3d')](_0x192432,{'type':db['Sequelize'][_0x09d6('0x68')][_0x09d6('0x69')],'raw':!![]})[_0x09d6('0x1d')](function(_0x2c00bc){return _0x2c00bc;});})['then'](function(_0x28bd8a){if(_0x28bd8a){_0x4659cf[_0x09d6('0x24')][_0x09d6('0x6a')]=_0x28bd8a[0x0];if(!_0x1d023d['body'][_0x09d6('0x5b')])return;return db[_0x09d6('0x6b')][_0x09d6('0x51')]({'where':{'id':_0x1d023d['body'][_0x09d6('0x5b')],'role':_0x09d6('0x5d')},'attributes':['id',_0x09d6('0x35'),'fullname','email',_0x09d6('0x6c')],'raw':!![]});}return null;})[_0x09d6('0x1d')](function(_0x3446df){if(!_0x3446df)return null;_0x4659cf[_0x09d6('0x24')]['agent']=_0x3446df;return _0x4659cf;})[_0x09d6('0x1d')](function(_0x4e6e7f){if(_0x4e6e7f){if(_0x1d023d['body'][_0x09d6('0x6d')]){_0x4659cf[_0x09d6('0x24')][_0x09d6('0x6e')]=util[_0x09d6('0x6f')](_0x09d6('0x70'),_0x1d023d[_0x09d6('0x5c')][_0x09d6('0x35')]);_0x4659cf[_0x09d6('0x24')][_0x09d6('0x71')]=_0x4659cf[_0x09d6('0x71')];_0x4659cf[_0x09d6('0x24')][_0x09d6('0x72')]=_0x4659cf['channel'];_0x4659cf[_0x09d6('0x24')][_0x09d6('0x73')]=_0x09d6('0x57');return respondWithRpcPromise(_0x09d6('0x74'),_0x09d6('0x74'),{'event':_0x09d6('0x75'),'message':_['merge'](_0x4659cf[_0x09d6('0x24')],JSON[_0x09d6('0x76')](_0x4659cf['interaction'][_0x09d6('0x77')]))},client9002)[_0x09d6('0x1d')](function(){return _0x4659cf;});}return _0x4659cf;}return null;})['then'](respondWithResult(_0x190657,null))[_0x09d6('0x26')](handleError(_0x190657,null));};var interaction_log=require('../../config/logger')(_0x09d6('0x56'));exports[_0x09d6('0x31')]=function(_0x5743ce,_0x4f8f7e,_0x463db9){var _0x46de92={'agent':{},'channel':'chat'};if(_0x5743ce[_0x09d6('0x54')]['id']){delete _0x5743ce['body']['id'];}_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')]=_0x5743ce['body'][_0x09d6('0x5b')]||_0x5743ce[_0x09d6('0x5c')]['id'];_0x46de92[_0x09d6('0x5d')]['id']=_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')];return db[_0x09d6('0x49')][_0x09d6('0x51')]({'where':{'id':_0x5743ce[_0x09d6('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4f8f7e,null))[_0x09d6('0x1d')](function(_0x759e22){if(_0x759e22){_0x46de92[_0x09d6('0x24')]=_0x759e22[_0x09d6('0x62')]({'plain':!![]});return db[_0x09d6('0x5e')]['find']({'where':{'id':_0x759e22['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4f8f7e,null))[_0x09d6('0x1d')](function(_0x18680c){if(_0x18680c){_0x46de92[_0x09d6('0x61')]=_0x18680c[_0x09d6('0x62')]({'plain':!![]});interaction_log[_0x09d6('0x1e')](_0x09d6('0x78'),_0x5743ce['user']['id'],_0x5743ce['user'][_0x09d6('0x35')],_0x5743ce['user'][_0x09d6('0x63')],_0x46de92[_0x09d6('0x61')]['id'],_0x5743ce['body']?JSON['stringify'](_0x5743ce[_0x09d6('0x54')]):_0x09d6('0x79'));return respondWithRpcPromise(_0x09d6('0x7a'),'rejectMessage',_0x46de92);}return null;})[_0x09d6('0x1d')](function(_0x54c1b5){var _0x18944a=_0x09d6('0x66')+_0x54c1b5[_0x09d6('0x24')][_0x09d6('0x7b')];return db[_0x09d6('0x67')]['query'](_0x18944a,{'type':db['Sequelize']['QueryTypes'][_0x09d6('0x69')],'raw':!![]})[_0x09d6('0x1d')](function(_0x43346f){return _0x43346f;});})['then'](function(_0xed52af){if(_0xed52af){_0x46de92['message'][_0x09d6('0x6a')]=_0xed52af[0x0];if(!_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')])return;return db['User']['find']({'where':{'id':_0x5743ce[_0x09d6('0x54')][_0x09d6('0x5b')],'role':_0x09d6('0x5d')},'attributes':['id',_0x09d6('0x35'),_0x09d6('0x7c'),_0x09d6('0x7d'),_0x09d6('0x6c')],'raw':!![]});}return null;})[_0x09d6('0x1d')](function(_0x17702f){if(!_0x17702f)return null;_0x46de92[_0x09d6('0x24')][_0x09d6('0x5d')]=_0x17702f;return _0x46de92;})[_0x09d6('0x1d')](function(_0x13c77a){if(_0x13c77a){_0x13c77a[_0x09d6('0x24')]['interface']=util[_0x09d6('0x6f')](_0x09d6('0x70'),_0x5743ce[_0x09d6('0x5c')][_0x09d6('0x35')]);_0x13c77a[_0x09d6('0x24')][_0x09d6('0x71')]=_0x46de92[_0x09d6('0x71')];_0x13c77a[_0x09d6('0x24')][_0x09d6('0x72')]=_0x46de92['channel'];_0x13c77a['message'][_0x09d6('0x73')]=_0x09d6('0x31');respondWithRpcPromise(_0x09d6('0x74'),_0x09d6('0x74'),{'event':_0x09d6('0x7e'),'message':_[_0x09d6('0x47')](_0x46de92[_0x09d6('0x24')],JSON[_0x09d6('0x76')](_0x46de92['interaction'][_0x09d6('0x77')]))},client9002);return _0x46de92;}return null;})[_0x09d6('0x1d')](respondWithResult(_0x4f8f7e,null))[_0x09d6('0x26')](handleError(_0x4f8f7e,null));}; \ No newline at end of file +var _0x95cf=['chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','ChatInteraction','stringify','null','RejectMessage','ContactId','User','rejectmessage','formData','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','end','status','json','undefined','count','offset','set','apply','reject','save','update','sendStatus','name','index','ChatMessage','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','filter','options','rows','catch','show','params','length','includeAll','include','find','create','body','destroy','describe','accept'];(function(_0x1714f9,_0x1cccf5){var _0x2c669d=function(_0x217830){while(--_0x217830){_0x1714f9['push'](_0x1714f9['shift']());}};_0x2c669d(++_0x1cccf5);}(_0x95cf,0xa6));var _0xf95c=function(_0x26eecd,_0x5b2abd){_0x26eecd=_0x26eecd-0x0;var _0x1d23d6=_0x95cf[_0x26eecd];return _0x1d23d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf95c('0x0'));var zipdir=require(_0xf95c('0x1'));var jsonpatch=require(_0xf95c('0x2'));var rp=require(_0xf95c('0x3'));var moment=require('moment');var BPromise=require(_0xf95c('0x4'));var Mustache=require(_0xf95c('0x5'));var util=require(_0xf95c('0x6'));var path=require(_0xf95c('0x7'));var sox=require('sox');var csv=require(_0xf95c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf95c('0x9'));var squel=require(_0xf95c('0xa'));var crypto=require('crypto');var jsforce=require(_0xf95c('0xb'));var deskjs=require(_0xf95c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf95c('0xd'));var Papa=require(_0xf95c('0xe'));var Redis=require(_0xf95c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf95c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf95c('0x11'));var logger=require(_0xf95c('0x12'))(_0xf95c('0x13'));var utils=require('../../config/utils');var config=require(_0xf95c('0x14'));var licenseUtil=require(_0xf95c('0x15'));var db=require(_0xf95c('0x16'))['db'];config[_0xf95c('0x17')]=_[_0xf95c('0x18')](config[_0xf95c('0x17')],{'host':_0xf95c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf95c('0x1a'))[_0xf95c('0x1b')](socket);var jayson=require(_0xf95c('0x1c'));var client=jayson[_0xf95c('0x1d')][_0xf95c('0x1e')]({'port':0x232c});var client9002=jayson[_0xf95c('0x1d')][_0xf95c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x437828,_0x567c1d,_0x37ad98,_0x57b028){return new BPromise(function(_0x273d08,_0x1aa0b4){var _0x1cea6e=_0x57b028||client;return _0x1cea6e['request'](_0x437828,_0x37ad98)[_0xf95c('0x1f')](function(_0x5b33b7){logger[_0xf95c('0x20')](_0xf95c('0x21'),_0x567c1d,_0xf95c('0x22'));logger[_0xf95c('0x23')](_0xf95c('0x24'),_0x567c1d,'request\x20sent',JSON['stringify'](_0x5b33b7));if(_0x5b33b7[_0xf95c('0x25')]){if(_0x5b33b7[_0xf95c('0x25')][_0xf95c('0x26')]===0x1f4){logger[_0xf95c('0x25')](_0xf95c('0x21'),_0x567c1d,_0x5b33b7[_0xf95c('0x25')]['message']);return _0x1aa0b4(_0x5b33b7[_0xf95c('0x25')][_0xf95c('0x27')]);}logger[_0xf95c('0x25')]('ChatMessage,\x20%s,\x20%s',_0x567c1d,_0x5b33b7[_0xf95c('0x25')][_0xf95c('0x27')]);return _0x273d08(_0x5b33b7[_0xf95c('0x25')]['message']);}else{logger[_0xf95c('0x20')]('ChatMessage,\x20%s,\x20%s',_0x567c1d,_0xf95c('0x22'));_0x273d08(_0x5b33b7['result'][_0xf95c('0x27')]);}})['catch'](function(_0x456978){logger['error'](_0xf95c('0x21'),_0x567c1d,_0x456978);_0x1aa0b4(_0x456978);});});}function respondWithStatusCode(_0xf3b0cb,_0x3ece9b){_0x3ece9b=_0x3ece9b||0xcc;return function(_0x2b61cb){if(_0x2b61cb){return _0xf3b0cb['sendStatus'](_0x3ece9b);}return _0xf3b0cb['status'](_0x3ece9b)[_0xf95c('0x28')]();};}function respondWithResult(_0x20896a,_0x328f27){_0x328f27=_0x328f27||0xc8;return function(_0x2296eb){if(_0x2296eb){return _0x20896a[_0xf95c('0x29')](_0x328f27)[_0xf95c('0x2a')](_0x2296eb);}};}function respondWithFilteredResult(_0x4c18ff,_0x547297){return function(_0x3aaa38){if(_0x3aaa38){var _0x11f8aa=typeof _0x547297['offset']==='undefined'&&typeof _0x547297['limit']===_0xf95c('0x2b');var _0x45ab7b=_0x3aaa38[_0xf95c('0x2c')];var _0x48da18=_0x11f8aa?0x0:_0x547297[_0xf95c('0x2d')];var _0xda2e8=_0x11f8aa?_0x3aaa38[_0xf95c('0x2c')]:_0x547297[_0xf95c('0x2d')]+_0x547297['limit'];var _0x23271c;if(_0xda2e8>=_0x45ab7b){_0xda2e8=_0x45ab7b;_0x23271c=0xc8;}else{_0x23271c=0xce;}_0x4c18ff[_0xf95c('0x29')](_0x23271c);return _0x4c18ff[_0xf95c('0x2e')]('Content-Range',_0x48da18+'-'+_0xda2e8+'/'+_0x45ab7b)['json'](_0x3aaa38);}return null;};}function patchUpdates(_0x1b2d6f){return function(_0x22e56f){try{jsonpatch[_0xf95c('0x2f')](_0x22e56f,_0x1b2d6f,!![]);}catch(_0x1de7f7){return BPromise[_0xf95c('0x30')](_0x1de7f7);}return _0x22e56f[_0xf95c('0x31')]();};}function saveUpdates(_0x1b36f2,_0x2f2653){return function(_0x5d2624){if(_0x5d2624){return _0x5d2624[_0xf95c('0x32')](_0x1b36f2)['then'](function(_0x2663f5){return _0x2663f5;});}return null;};}function removeEntity(_0x1164d2,_0x49342a){return function(_0x10bd21){if(_0x10bd21){return _0x10bd21['destroy']()['then'](function(){_0x1164d2[_0xf95c('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302cc3,_0x3b2531){return function(_0x143fc3){if(!_0x143fc3){_0x302cc3[_0xf95c('0x33')](0x194);}return _0x143fc3;};}function handleError(_0x55bde9,_0x1db06e){_0x1db06e=_0x1db06e||0x1f4;return function(_0x403dae){logger['error'](_0x403dae['stack']);if(_0x403dae[_0xf95c('0x34')]){delete _0x403dae[_0xf95c('0x34')];}_0x55bde9[_0xf95c('0x29')](_0x1db06e)['send'](_0x403dae);};}exports[_0xf95c('0x35')]=function(_0x1fb241,_0x4149b8){var _0x17dd60={},_0x115374={},_0x1b4552={'count':0x0,'rows':[]};var _0x1d5c77=_['map'](db[_0xf95c('0x36')][_0xf95c('0x37')],function(_0x29410d){return{'name':_0x29410d[_0xf95c('0x38')],'type':_0x29410d[_0xf95c('0x39')]['key']};});_0x115374[_0xf95c('0x3a')]=_[_0xf95c('0x3b')](_0x1d5c77,_0xf95c('0x34'));_0x115374[_0xf95c('0x3c')]=_[_0xf95c('0x3d')](_0x1fb241[_0xf95c('0x3c')]);_0x115374['filters']=_[_0xf95c('0x3e')](_0x115374[_0xf95c('0x3a')],_0x115374['query']);_0x17dd60[_0xf95c('0x3f')]=_[_0xf95c('0x3e')](_0x115374[_0xf95c('0x3a')],qs[_0xf95c('0x40')](_0x1fb241[_0xf95c('0x3c')]['fields']));_0x17dd60[_0xf95c('0x3f')]=_0x17dd60['attributes']['length']?_0x17dd60[_0xf95c('0x3f')]:_0x115374[_0xf95c('0x3a')];if(!_0x1fb241['query'][_0xf95c('0x41')](_0xf95c('0x42'))){_0x17dd60[_0xf95c('0x43')]=qs[_0xf95c('0x43')](_0x1fb241[_0xf95c('0x3c')][_0xf95c('0x43')]);_0x17dd60[_0xf95c('0x2d')]=qs[_0xf95c('0x2d')](_0x1fb241[_0xf95c('0x3c')][_0xf95c('0x2d')]);}_0x17dd60['order']=qs[_0xf95c('0x44')](_0x1fb241[_0xf95c('0x3c')][_0xf95c('0x44')]);_0x17dd60['where']=qs[_0xf95c('0x45')](_[_0xf95c('0x46')](_0x1fb241[_0xf95c('0x3c')],_0x115374[_0xf95c('0x45')]),_0x1d5c77);if(_0x1fb241[_0xf95c('0x3c')]['filter']){_0x17dd60[_0xf95c('0x47')]=_[_0xf95c('0x48')](_0x17dd60[_0xf95c('0x47')],{'$or':_[_0xf95c('0x3b')](_0x1d5c77,function(_0x2a5e39){if(_0x2a5e39[_0xf95c('0x39')]!=='VIRTUAL'){var _0x475b91={};_0x475b91[_0x2a5e39[_0xf95c('0x34')]]={'$like':'%'+_0x1fb241[_0xf95c('0x3c')][_0xf95c('0x49')]+'%'};return _0x475b91;}})});}_0x17dd60=_[_0xf95c('0x48')]({},_0x17dd60,_0x1fb241[_0xf95c('0x4a')]);var _0x133920={'where':_0x17dd60[_0xf95c('0x47')]};return db['ChatMessage'][_0xf95c('0x2c')](_0x133920)[_0xf95c('0x1f')](function(_0x4cde9f){_0x1b4552[_0xf95c('0x2c')]=_0x4cde9f;if(_0x1fb241[_0xf95c('0x3c')]['includeAll']){_0x17dd60['include']=[{'all':!![]}];}return db[_0xf95c('0x36')]['findAll'](_0x17dd60);})['then'](function(_0x3415a0){_0x1b4552[_0xf95c('0x4b')]=_0x3415a0;return _0x1b4552;})[_0xf95c('0x1f')](respondWithFilteredResult(_0x4149b8,_0x17dd60))[_0xf95c('0x4c')](handleError(_0x4149b8,null));};exports[_0xf95c('0x4d')]=function(_0x4f7f4e,_0xf9914e){var _0x49a5be={'raw':!![],'where':{'id':_0x4f7f4e[_0xf95c('0x4e')]['id']}},_0x59f2fc={};_0x59f2fc['model']=_[_0xf95c('0x3d')](db[_0xf95c('0x36')][_0xf95c('0x37')]);_0x59f2fc[_0xf95c('0x3c')]=_[_0xf95c('0x3d')](_0x4f7f4e[_0xf95c('0x3c')]);_0x59f2fc[_0xf95c('0x45')]=_[_0xf95c('0x3e')](_0x59f2fc['model'],_0x59f2fc['query']);_0x49a5be[_0xf95c('0x3f')]=_[_0xf95c('0x3e')](_0x59f2fc['model'],qs[_0xf95c('0x40')](_0x4f7f4e[_0xf95c('0x3c')]['fields']));_0x49a5be[_0xf95c('0x3f')]=_0x49a5be[_0xf95c('0x3f')][_0xf95c('0x4f')]?_0x49a5be[_0xf95c('0x3f')]:_0x59f2fc['model'];if(_0x4f7f4e[_0xf95c('0x3c')][_0xf95c('0x50')]){_0x49a5be[_0xf95c('0x51')]=[{'all':!![]}];}_0x49a5be=_['merge']({},_0x49a5be,_0x4f7f4e[_0xf95c('0x4a')]);return db[_0xf95c('0x36')][_0xf95c('0x52')](_0x49a5be)[_0xf95c('0x1f')](handleEntityNotFound(_0xf9914e,null))[_0xf95c('0x1f')](respondWithResult(_0xf9914e,null))[_0xf95c('0x4c')](handleError(_0xf9914e,null));};exports[_0xf95c('0x53')]=function(_0xf9b59a,_0x40b44a){return db['ChatMessage'][_0xf95c('0x53')](_0xf9b59a['body'],{})[_0xf95c('0x1f')](respondWithResult(_0x40b44a,0xc9))[_0xf95c('0x4c')](handleError(_0x40b44a,null));};exports['update']=function(_0x33fd5a,_0x372b71){if(_0x33fd5a[_0xf95c('0x54')]['id']){delete _0x33fd5a[_0xf95c('0x54')]['id'];}return db['ChatMessage'][_0xf95c('0x52')]({'where':{'id':_0x33fd5a[_0xf95c('0x4e')]['id']}})[_0xf95c('0x1f')](handleEntityNotFound(_0x372b71,null))[_0xf95c('0x1f')](saveUpdates(_0x33fd5a[_0xf95c('0x54')],null))['then'](respondWithResult(_0x372b71,null))[_0xf95c('0x4c')](handleError(_0x372b71,null));};exports[_0xf95c('0x55')]=function(_0x56a0b3,_0xbba475){return db[_0xf95c('0x36')][_0xf95c('0x52')]({'where':{'id':_0x56a0b3[_0xf95c('0x4e')]['id']}})[_0xf95c('0x1f')](handleEntityNotFound(_0xbba475,null))['then'](removeEntity(_0xbba475,null))[_0xf95c('0x4c')](handleError(_0xbba475,null));};exports[_0xf95c('0x56')]=function(_0x26a49f,_0x25f56f){return db[_0xf95c('0x36')]['describe']()[_0xf95c('0x1f')](respondWithResult(_0x25f56f,null))[_0xf95c('0x4c')](handleError(_0x25f56f,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xf95c('0x57')]=function(_0x5765b6,_0x72d8cc,_0x38a151){var _0x22f096={'agent':{},'channel':_0xf95c('0x58')};if(_0x5765b6[_0xf95c('0x54')]['id']){delete _0x5765b6[_0xf95c('0x54')]['id'];}_0x5765b6['body']['read']=!![];_0x5765b6[_0xf95c('0x54')][_0xf95c('0x59')]=moment()[_0xf95c('0x5a')](_0xf95c('0x5b'));_0x5765b6[_0xf95c('0x54')][_0xf95c('0x5c')]=_0x5765b6[_0xf95c('0x54')][_0xf95c('0x5c')]||_0x5765b6['user']['id'];_0x22f096[_0xf95c('0x5d')]['id']=_0x5765b6['body'][_0xf95c('0x5c')];return db[_0xf95c('0x36')][_0xf95c('0x52')]({'where':{'id':_0x5765b6['params']['id'],'UserId':null}})[_0xf95c('0x1f')](handleEntityNotFound(_0x72d8cc,null))['then'](saveUpdates(_0x5765b6[_0xf95c('0x54')],null))[_0xf95c('0x1f')](function(_0xd1593){if(_0xd1593){_0x22f096['message']=_0xd1593[_0xf95c('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0xf95c('0x52')]({'where':{'id':_0xd1593[_0xf95c('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x72d8cc,null))[_0xf95c('0x1f')](function(_0x4e692f){if(_0x4e692f){return _0x4e692f[_0xf95c('0x32')]({'UserId':_0x5765b6[_0xf95c('0x54')][_0xf95c('0x5c')],'read1stAt':_['isNil'](_0x4e692f[_0xf95c('0x60')])?moment()[_0xf95c('0x5a')](_0xf95c('0x5b')):undefined});}return null;})[_0xf95c('0x1f')](function(_0x584e1d){if(_0x584e1d){_0x22f096[_0xf95c('0x61')]=_0x584e1d[_0xf95c('0x5e')]({'plain':!![]});interaction_log[_0xf95c('0x20')](_0xf95c('0x62'),_0x5765b6[_0xf95c('0x63')]['id'],_0x5765b6[_0xf95c('0x63')]['name'],_0x5765b6[_0xf95c('0x63')][_0xf95c('0x64')],_0x22f096[_0xf95c('0x61')]['id'],_0x5765b6[_0xf95c('0x54')]?JSON['stringify'](_0x5765b6['body']):'null');return respondWithRpcPromise(_0xf95c('0x65'),_0xf95c('0x66'),_0x22f096);}return null;})[_0xf95c('0x1f')](function(_0x4afe6e){var _0x2281e9=_0xf95c('0x67')+_0x4afe6e[_0xf95c('0x27')]['ContactId'];return db[_0xf95c('0x68')][_0xf95c('0x3c')](_0x2281e9,{'type':db[_0xf95c('0x69')][_0xf95c('0x6a')][_0xf95c('0x6b')],'raw':!![]})[_0xf95c('0x1f')](function(_0x5b0de1){return _0x5b0de1;});})[_0xf95c('0x1f')](function(_0x41b9a8){if(_0x41b9a8){_0x22f096[_0xf95c('0x27')][_0xf95c('0x6c')]=_0x41b9a8[0x0];if(!_0x5765b6[_0xf95c('0x54')][_0xf95c('0x5c')])return;return db['User']['find']({'where':{'id':_0x5765b6[_0xf95c('0x54')][_0xf95c('0x5c')],'role':_0xf95c('0x5d')},'attributes':['id',_0xf95c('0x34'),_0xf95c('0x6d'),_0xf95c('0x6e'),_0xf95c('0x6f')],'raw':!![]});}return null;})[_0xf95c('0x1f')](function(_0x37a453){if(!_0x37a453)return null;_0x22f096['message']['agent']=_0x37a453;return _0x22f096;})[_0xf95c('0x1f')](function(_0x3bf406){if(_0x3bf406){if(_0x5765b6[_0xf95c('0x54')][_0xf95c('0x70')]){_0x22f096[_0xf95c('0x27')][_0xf95c('0x71')]=util[_0xf95c('0x5a')](_0xf95c('0x72'),_0x5765b6['user'][_0xf95c('0x34')]);_0x22f096[_0xf95c('0x27')][_0xf95c('0x73')]=_0x22f096['channel'];_0x22f096[_0xf95c('0x27')][_0xf95c('0x74')]=_0x22f096['channel'];_0x22f096['message'][_0xf95c('0x75')]=_0xf95c('0x57');return respondWithRpcPromise(_0xf95c('0x76'),_0xf95c('0x76'),{'event':'acceptmessage','message':_[_0xf95c('0x48')](_0x22f096[_0xf95c('0x27')],JSON['parse'](_0x22f096[_0xf95c('0x61')]['formData']))},client9002)[_0xf95c('0x1f')](function(){return _0x22f096;});}return _0x22f096;}return null;})[_0xf95c('0x1f')](respondWithResult(_0x72d8cc,null))['catch'](handleError(_0x72d8cc,null));};var interaction_log=require(_0xf95c('0x12'))('chat-interactions');exports[_0xf95c('0x30')]=function(_0x1b36c7,_0x26f61d,_0x432600){var _0x51c572={'agent':{},'channel':_0xf95c('0x58')};if(_0x1b36c7[_0xf95c('0x54')]['id']){delete _0x1b36c7[_0xf95c('0x54')]['id'];}_0x1b36c7[_0xf95c('0x54')][_0xf95c('0x5c')]=_0x1b36c7['body'][_0xf95c('0x5c')]||_0x1b36c7[_0xf95c('0x63')]['id'];_0x51c572[_0xf95c('0x5d')]['id']=_0x1b36c7['body'][_0xf95c('0x5c')];return db[_0xf95c('0x36')][_0xf95c('0x52')]({'where':{'id':_0x1b36c7[_0xf95c('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26f61d,null))['then'](function(_0x31ff44){if(_0x31ff44){_0x51c572[_0xf95c('0x27')]=_0x31ff44[_0xf95c('0x5e')]({'plain':!![]});return db[_0xf95c('0x77')][_0xf95c('0x52')]({'where':{'id':_0x31ff44['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x26f61d,null))[_0xf95c('0x1f')](function(_0x9ed97){if(_0x9ed97){_0x51c572[_0xf95c('0x61')]=_0x9ed97[_0xf95c('0x5e')]({'plain':!![]});interaction_log[_0xf95c('0x20')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1b36c7[_0xf95c('0x63')]['id'],_0x1b36c7[_0xf95c('0x63')][_0xf95c('0x34')],_0x1b36c7[_0xf95c('0x63')][_0xf95c('0x64')],_0x51c572[_0xf95c('0x61')]['id'],_0x1b36c7[_0xf95c('0x54')]?JSON[_0xf95c('0x78')](_0x1b36c7[_0xf95c('0x54')]):_0xf95c('0x79'));return respondWithRpcPromise(_0xf95c('0x7a'),'rejectMessage',_0x51c572);}return null;})[_0xf95c('0x1f')](function(_0x5114ce){var _0x2b6a85=_0xf95c('0x67')+_0x5114ce[_0xf95c('0x27')][_0xf95c('0x7b')];return db['sequelize'][_0xf95c('0x3c')](_0x2b6a85,{'type':db['Sequelize'][_0xf95c('0x6a')][_0xf95c('0x6b')],'raw':!![]})[_0xf95c('0x1f')](function(_0x50f3be){return _0x50f3be;});})[_0xf95c('0x1f')](function(_0x19884f){if(_0x19884f){_0x51c572[_0xf95c('0x27')][_0xf95c('0x6c')]=_0x19884f[0x0];if(!_0x1b36c7['body'][_0xf95c('0x5c')])return;return db[_0xf95c('0x7c')][_0xf95c('0x52')]({'where':{'id':_0x1b36c7[_0xf95c('0x54')][_0xf95c('0x5c')],'role':_0xf95c('0x5d')},'attributes':['id',_0xf95c('0x34'),_0xf95c('0x6d'),_0xf95c('0x6e'),'internal'],'raw':!![]});}return null;})[_0xf95c('0x1f')](function(_0x5db91d){if(!_0x5db91d)return null;_0x51c572['message'][_0xf95c('0x5d')]=_0x5db91d;return _0x51c572;})[_0xf95c('0x1f')](function(_0x50f2b6){if(_0x50f2b6){_0x50f2b6['message'][_0xf95c('0x71')]=util['format']('SIP/%s',_0x1b36c7[_0xf95c('0x63')][_0xf95c('0x34')]);_0x50f2b6[_0xf95c('0x27')][_0xf95c('0x73')]=_0x51c572['channel'];_0x50f2b6[_0xf95c('0x27')]['motionChannel']=_0x51c572['channel'];_0x50f2b6[_0xf95c('0x27')][_0xf95c('0x75')]=_0xf95c('0x30');respondWithRpcPromise('EventManager',_0xf95c('0x76'),{'event':_0xf95c('0x7d'),'message':_[_0xf95c('0x48')](_0x51c572['message'],JSON['parse'](_0x51c572[_0xf95c('0x61')][_0xf95c('0x7e')]))},client9002);return _0x51c572;}return null;})[_0xf95c('0x1f')](respondWithResult(_0x26f61d,null))['catch'](handleError(_0x26f61d,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b7c629b..97f3dae 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 _0x199d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x8f71a0,_0x282eec){var _0x1c71c4=function(_0x2ebb2c){while(--_0x2ebb2c){_0x8f71a0['push'](_0x8f71a0['shift']());}};_0x1c71c4(++_0x282eec);}(_0x199d,0xde));var _0xd199=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x199d[_0x1c156e];return _0x58fc22;};'use strict';var EventEmitter=require(_0xd199('0x0'));var ChatMessage=require(_0xd199('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd199('0x2')](0x0);var events={'afterCreate':_0xd199('0x3'),'afterUpdate':_0xd199('0x4'),'afterDestroy':_0xd199('0x5')};function emitEvent(_0x56a256){return function(_0x2235aa,_0x4ea751,_0xcc720f){ChatMessageEvents[_0xd199('0x6')](_0x56a256+':'+_0x2235aa['id'],_0x2235aa);ChatMessageEvents[_0xd199('0x6')](_0x56a256,_0x2235aa);_0xcc720f(null);};}for(var e in events){if(events[_0xd199('0x7')](e)){var event=events[e];ChatMessage[_0xd199('0x8')](e,emitEvent(event));}}module[_0xd199('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xe3b6=['ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xb9d225,_0x4672de){var _0x128869=function(_0x234efa){while(--_0x234efa){_0xb9d225['push'](_0xb9d225['shift']());}};_0x128869(++_0x4672de);}(_0xe3b6,0x1ca));var _0x6e3b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe3b6[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x6e3b('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x6e3b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6e3b('0x2')](0x0);var events={'afterCreate':_0x6e3b('0x3'),'afterUpdate':_0x6e3b('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa680b9){return function(_0x4f3705,_0x319e49,_0x3fc036){ChatMessageEvents[_0x6e3b('0x5')](_0xa680b9+':'+_0x4f3705['id'],_0x4f3705);ChatMessageEvents[_0x6e3b('0x5')](_0xa680b9,_0x4f3705);_0x3fc036(null);};}for(var e in events){if(events[_0x6e3b('0x6')](e)){var event=events[e];ChatMessage[_0x6e3b('0x7')](e,emitEvent(event));}}module[_0x6e3b('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9880c51..2109aaf 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 _0x49c2=['api','bluebird','request-promise','rimraf','../../config/environment','exports','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1a8132,_0x1d4978){var _0x5b9329=function(_0x1f1447){while(--_0x1f1447){_0x1a8132['push'](_0x1a8132['shift']());}};_0x5b9329(++_0x1d4978);}(_0x49c2,0x176));var _0x249c=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x49c2[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var logger=require(_0x249c('0x2'))(_0x249c('0x3'));var moment=require('moment');var BPromise=require(_0x249c('0x4'));var rp=require(_0x249c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x249c('0x6'));var config=require(_0x249c('0x7'));var attributes=require('./chatMessage.attributes');module[_0x249c('0x8')]=function(_0x4c0c15,_0x5c5f30){return _0x4c0c15['define']('ChatMessage',attributes,{'tableName':_0x249c('0x9'),'paranoid':![],'indexes':[{'name':_0x249c('0xa'),'fields':[_0x249c('0xb')],'type':_0x249c('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b7ed1,_0x3d61a2,_0x2216eb){var _0x35a42b=_0x4c0c15[_0x249c('0xd')];var _0x422d7b=_0x2b7ed1['get']({'plain':!![]});if(_0x422d7b[_0x249c('0xe')][_0x249c('0xf')]()==='in'||_0x422d7b['direction']['toLowerCase']()===_0x249c('0x10')&&!_0x422d7b[_0x249c('0x11')]&&!_[_0x249c('0x12')](_0x422d7b[_0x249c('0x13')])){_0x35a42b[_0x249c('0x14')][_0x249c('0x15')]({'where':{'id':_0x422d7b[_0x249c('0x16')]}})[_0x249c('0x17')](function(_0x4fdede){if(_0x4fdede){_0x4fdede[_0x249c('0x18')]({'lastMsgAt':_0x422d7b[_0x249c('0x19')],'lastMsgDirection':_0x422d7b[_0x249c('0xe')][_0x249c('0xf')]()});}})['catch'](function(_0x56cf21){console[_0x249c('0x1a')](_0x56cf21);});}_0x2216eb();}},'charset':_0x249c('0x1b'),'collate':_0x249c('0x1c')});}; \ No newline at end of file +var _0xc26a=['utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','define','fti_chat_messages','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','createdAt','catch'];(function(_0x335fb1,_0x409863){var _0x10bb68=function(_0x308072){while(--_0x308072){_0x335fb1['push'](_0x335fb1['shift']());}};_0x10bb68(++_0x409863);}(_0xc26a,0x1c9));var _0xac26=function(_0x5aea5a,_0x346fe0){_0x5aea5a=_0x5aea5a-0x0;var _0x557a58=_0xc26a[_0x5aea5a];return _0x557a58;};'use strict';var _=require(_0xac26('0x0'));var util=require('util');var logger=require(_0xac26('0x1'))(_0xac26('0x2'));var moment=require(_0xac26('0x3'));var BPromise=require(_0xac26('0x4'));var rp=require(_0xac26('0x5'));var fs=require('fs');var path=require(_0xac26('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac26('0x7'));module[_0xac26('0x8')]=function(_0x34451d,_0x49fad0){return _0x34451d[_0xac26('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xac26('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ec2b5,_0xc58a0,_0x357d2d){var _0x2c1c39=_0x34451d[_0xac26('0xb')];var _0x17fc1f=_0x4ec2b5[_0xac26('0xc')]({'plain':!![]});if(_0x17fc1f[_0xac26('0xd')][_0xac26('0xe')]()==='in'||_0x17fc1f['direction'][_0xac26('0xe')]()===_0xac26('0xf')&&!_0x17fc1f[_0xac26('0x10')]&&!_[_0xac26('0x11')](_0x17fc1f['UserId'])){_0x2c1c39[_0xac26('0x12')][_0xac26('0x13')]({'where':{'id':_0x17fc1f['ChatInteractionId']}})[_0xac26('0x14')](function(_0x3f33bc){if(_0x3f33bc){_0x3f33bc['update']({'lastMsgAt':_0x17fc1f[_0xac26('0x15')],'lastMsgDirection':_0x17fc1f[_0xac26('0xd')][_0xac26('0xe')]()});}})[_0xac26('0x16')](function(_0x1f6b6e){console['error'](_0x1f6b6e);});}_0x357d2d();}},'charset':_0xac26('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4cd0a40..e2f73ef 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 _0x978a=['rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreateChatMessage','ChatMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x59f97a,_0x511696){var _0x411b33=function(_0x4f801e){while(--_0x4f801e){_0x59f97a['push'](_0x59f97a['shift']());}};_0x411b33(++_0x511696);}(_0x978a,0x93));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa978('0x0'));var util=require(_0xa978('0x1'));var moment=require(_0xa978('0x2'));var BPromise=require(_0xa978('0x3'));var rs=require(_0xa978('0x4'));var fs=require('fs');var Redis=require(_0xa978('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa978('0x6'));var logger=require(_0xa978('0x7'))(_0xa978('0x8'));var config=require(_0xa978('0x9'));var jayson=require(_0xa978('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa978('0xb')]=_[_0xa978('0xc')](config[_0xa978('0xb')],{'host':_0xa978('0xd'),'port':0x18eb});var socket=require(_0xa978('0xe'))(new Redis(config[_0xa978('0xb')]));require(_0xa978('0xf'))[_0xa978('0x10')](socket);function respondWithRpcPromise(_0x5c7af3,_0x460c3e,_0x21ae97){return new BPromise(function(_0x3520b0,_0xdd7815){return client['request'](_0x5c7af3,_0x21ae97)[_0xa978('0x11')](function(_0x26a0b9){logger['info'](_0xa978('0x12'),_0x460c3e,_0xa978('0x13'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x460c3e,_0xa978('0x13'),JSON['stringify'](_0x26a0b9));if(_0x26a0b9[_0xa978('0x14')]){if(_0x26a0b9[_0xa978('0x14')][_0xa978('0x15')]===0x1f4){logger[_0xa978('0x14')](_0xa978('0x12'),_0x460c3e,_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);return _0xdd7815(_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);}logger[_0xa978('0x14')]('ChatMessage,\x20%s,\x20%s',_0x460c3e,_0x26a0b9['error'][_0xa978('0x16')]);return _0x3520b0(_0x26a0b9[_0xa978('0x14')][_0xa978('0x16')]);}else{logger[_0xa978('0x17')](_0xa978('0x12'),_0x460c3e,_0xa978('0x13'));_0x3520b0(_0x26a0b9[_0xa978('0x18')][_0xa978('0x16')]);}})['catch'](function(_0x11b36b){logger['error'](_0xa978('0x12'),_0x460c3e,_0x11b36b);_0xdd7815(_0x11b36b);});});}exports[_0xa978('0x19')]=function(_0x6dbb7f){var _0x4f4f31=this;return new Promise(function(_0x2a20d8,_0x5d6137){return db[_0xa978('0x1a')]['create'](_0x6dbb7f[_0xa978('0x1b')],{'raw':_0x6dbb7f[_0xa978('0x1c')]?_0x6dbb7f['options'][_0xa978('0x1d')]===undefined?!![]:![]:!![]})[_0xa978('0x11')](function(_0x547fe){logger[_0xa978('0x17')]('CreateChatMessage',_0x6dbb7f);logger['debug'](_0xa978('0x19'),_0x6dbb7f,JSON[_0xa978('0x1e')](_0x547fe));_0x2a20d8(_0x547fe);})['catch'](function(_0x4beb97){logger[_0xa978('0x14')](_0xa978('0x19'),_0x4beb97[_0xa978('0x16')],_0x6dbb7f);_0x5d6137(_0x4f4f31[_0xa978('0x14')](0x1f4,_0x4beb97[_0xa978('0x16')]));});});}; \ No newline at end of file +var _0x76c1=['error','ChatMessage,\x20%s,\x20%s','message','info','catch','ChatMessage','body','options','raw','CreateChatMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5d7dc0,_0x212a52){var _0xfc6a81=function(_0x5b92a2){while(--_0x5b92a2){_0x5d7dc0['push'](_0x5d7dc0['shift']());}};_0xfc6a81(++_0x212a52);}(_0x76c1,0x87));var _0x176c=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x76c1[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x176c('0x0'));var util=require(_0x176c('0x1'));var moment=require(_0x176c('0x2'));var BPromise=require(_0x176c('0x3'));var rs=require(_0x176c('0x4'));var fs=require('fs');var Redis=require(_0x176c('0x5'));var db=require(_0x176c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x176c('0x7'))(_0x176c('0x8'));var config=require(_0x176c('0x9'));var jayson=require(_0x176c('0xa'));var client=jayson[_0x176c('0xb')]['http']({'port':0x232a});config[_0x176c('0xc')]=_[_0x176c('0xd')](config['redis'],{'host':_0x176c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x176c('0xc')]));require('./chatMessage.socket')[_0x176c('0xf')](socket);function respondWithRpcPromise(_0x549802,_0x130994,_0x183a49){return new BPromise(function(_0x277c79,_0x530688){return client[_0x176c('0x10')](_0x549802,_0x183a49)['then'](function(_0x262a5f){logger['info']('ChatMessage,\x20%s,\x20%s',_0x130994,_0x176c('0x11'));logger[_0x176c('0x12')](_0x176c('0x13'),_0x130994,_0x176c('0x11'),JSON['stringify'](_0x262a5f));if(_0x262a5f[_0x176c('0x14')]){if(_0x262a5f['error']['code']===0x1f4){logger[_0x176c('0x14')](_0x176c('0x15'),_0x130994,_0x262a5f[_0x176c('0x14')][_0x176c('0x16')]);return _0x530688(_0x262a5f[_0x176c('0x14')][_0x176c('0x16')]);}logger[_0x176c('0x14')](_0x176c('0x15'),_0x130994,_0x262a5f[_0x176c('0x14')][_0x176c('0x16')]);return _0x277c79(_0x262a5f[_0x176c('0x14')][_0x176c('0x16')]);}else{logger[_0x176c('0x17')](_0x176c('0x15'),_0x130994,_0x176c('0x11'));_0x277c79(_0x262a5f['result'][_0x176c('0x16')]);}})[_0x176c('0x18')](function(_0xd85970){logger[_0x176c('0x14')]('ChatMessage,\x20%s,\x20%s',_0x130994,_0xd85970);_0x530688(_0xd85970);});});}exports['CreateChatMessage']=function(_0x420ddb){var _0x154bbb=this;return new Promise(function(_0x46c7f4,_0x1cb1f8){return db[_0x176c('0x19')]['create'](_0x420ddb[_0x176c('0x1a')],{'raw':_0x420ddb[_0x176c('0x1b')]?_0x420ddb['options'][_0x176c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0xfb879b){logger[_0x176c('0x17')](_0x176c('0x1d'),_0x420ddb);logger[_0x176c('0x12')](_0x176c('0x1d'),_0x420ddb,JSON[_0x176c('0x1e')](_0xfb879b));_0x46c7f4(_0xfb879b);})[_0x176c('0x18')](function(_0x4e5f25){logger[_0x176c('0x14')](_0x176c('0x1d'),_0x4e5f25[_0x176c('0x16')],_0x420ddb);_0x1cb1f8(_0x154bbb[_0x176c('0x14')](0x1f4,_0x4e5f25[_0x176c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 342b682..213830d 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 _0x383d=['register','length','remove','update','emit','removeListener'];(function(_0x4f9e12,_0xec557f){var _0x146653=function(_0x2975e9){while(--_0x2975e9){_0x4f9e12['push'](_0x4f9e12['shift']());}};_0x146653(++_0xec557f);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0xd383('0x0'),_0xd383('0x1')];function createListener(_0x35486e,_0x559dd3){return function(_0x7554ef){_0x559dd3[_0xd383('0x2')](_0x35486e,_0x7554ef);};}function removeListener(_0x319f67,_0x3439dd){return function(){ChatMessageEvents[_0xd383('0x3')](_0x319f67,_0x3439dd);};}exports[_0xd383('0x4')]=function(_0x5a0b1d){for(var _0xc64e9b=0x0,_0x30ba82=events[_0xd383('0x5')];_0xc64e9b<_0x30ba82;_0xc64e9b++){var _0x470d8d=events[_0xc64e9b];var _0xffa778=createListener('chatMessage:'+_0x470d8d,_0x5a0b1d);ChatMessageEvents['on'](_0x470d8d,_0xffa778);}}; \ No newline at end of file +var _0x9879=['remove','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x2e2292,_0x1891b8){var _0x4f77ab=function(_0x3e5cb6){while(--_0x3e5cb6){_0x2e2292['push'](_0x2e2292['shift']());}};_0x4f77ab(++_0x1891b8);}(_0x9879,0x98));var _0x9987=function(_0x1a6fc7,_0x393068){_0x1a6fc7=_0x1a6fc7-0x0;var _0x3ad226=_0x9879[_0x1a6fc7];return _0x3ad226;};'use strict';var ChatMessageEvents=require(_0x9987('0x0'));var events=[_0x9987('0x1'),_0x9987('0x2'),'update'];function createListener(_0xadce9d,_0x525218){return function(_0x3a2473){_0x525218[_0x9987('0x3')](_0xadce9d,_0x3a2473);};}function removeListener(_0x1fd45d,_0xcc5722){return function(){ChatMessageEvents[_0x9987('0x4')](_0x1fd45d,_0xcc5722);};}exports[_0x9987('0x5')]=function(_0x4258df){for(var _0x4d479d=0x0,_0x34d2fd=events['length'];_0x4d479d<_0x34d2fd;_0x4d479d++){var _0x6cb988=events[_0x4d479d];var _0x3e5538=createListener(_0x9987('0x6')+_0x6cb988,_0x4258df);ChatMessageEvents['on'](_0x6cb988,_0x3e5538);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index aa2f945..3fb1a81 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 _0x2611=['create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','show','post','tracked','chat'];(function(_0x58dd9e,_0x283816){var _0xbcc1d1=function(_0x2d2ff4){while(--_0x2d2ff4){_0x58dd9e['push'](_0x58dd9e['shift']());}};_0xbcc1d1(++_0x283816);}(_0x2611,0x1af));var _0x1261=function(_0x1ffcad,_0x9afad3){_0x1ffcad=_0x1ffcad-0x0;var _0x63720e=_0x2611[_0x1ffcad];return _0x63720e;};'use strict';var multer=require('multer');var util=require(_0x1261('0x0'));var path=require(_0x1261('0x1'));var timeout=require(_0x1261('0x2'));var express=require(_0x1261('0x3'));var router=express[_0x1261('0x4')]();var fs_extra=require(_0x1261('0x5'));var auth=require(_0x1261('0x6'));var interaction=require(_0x1261('0x7'));var config=require(_0x1261('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1261('0x9')]);router[_0x1261('0xa')](_0x1261('0xb'),auth[_0x1261('0xc')](),controller['describe']);router['get']('/:id',auth[_0x1261('0xc')](),controller[_0x1261('0xd')]);router[_0x1261('0xe')]('/',auth[_0x1261('0xc')](),interaction[_0x1261('0xf')](_0x1261('0x10'),'chatmessage:create'),controller[_0x1261('0x11')]);router[_0x1261('0x12')](_0x1261('0x13'),controller[_0x1261('0x14')]);router[_0x1261('0x12')](_0x1261('0x15'),auth['isAuthenticated'](),controller[_0x1261('0x16')]);router[_0x1261('0x12')](_0x1261('0x17'),auth[_0x1261('0xc')](),controller[_0x1261('0x18')]);router[_0x1261('0x19')]('/:id',auth[_0x1261('0xc')](),controller[_0x1261('0x1a')]);module[_0x1261('0x1b')]=router; \ No newline at end of file +var _0xfd19=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','chat','update','put','/:id/accept','accept','/:id/reject'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xfd19,0x16f));var _0x9fd1=function(_0x2ee78b,_0x489f2b){_0x2ee78b=_0x2ee78b-0x0;var _0x139bd7=_0xfd19[_0x2ee78b];return _0x139bd7;};'use strict';var multer=require(_0x9fd1('0x0'));var util=require(_0x9fd1('0x1'));var path=require(_0x9fd1('0x2'));var timeout=require(_0x9fd1('0x3'));var express=require(_0x9fd1('0x4'));var router=express[_0x9fd1('0x5')]();var fs_extra=require(_0x9fd1('0x6'));var auth=require(_0x9fd1('0x7'));var interaction=require(_0x9fd1('0x8'));var config=require('../../config/environment');var controller=require(_0x9fd1('0x9'));router['get']('/',auth[_0x9fd1('0xa')](),controller[_0x9fd1('0xb')]);router[_0x9fd1('0xc')](_0x9fd1('0xd'),auth[_0x9fd1('0xa')](),controller[_0x9fd1('0xe')]);router[_0x9fd1('0xc')](_0x9fd1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x9fd1('0x10')]('/',auth[_0x9fd1('0xa')](),interaction['tracked'](_0x9fd1('0x11'),'chatmessage:create'),controller['create']);router['put'](_0x9fd1('0xf'),controller[_0x9fd1('0x12')]);router[_0x9fd1('0x13')](_0x9fd1('0x14'),auth[_0x9fd1('0xa')](),controller[_0x9fd1('0x15')]);router[_0x9fd1('0x13')](_0x9fd1('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x9fd1('0x17')](_0x9fd1('0xf'),auth[_0x9fd1('0xa')](),controller[_0x9fd1('0x18')]);module[_0x9fd1('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c606235..1457f18 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 _0xb10b=['medium','sequelize','TEXT'];(function(_0x51ec16,_0x489add){var _0x17f80d=function(_0x3934f9){while(--_0x3934f9){_0x51ec16['push'](_0x51ec16['shift']());}};_0x17f80d(++_0x489add);}(_0xb10b,0x12a));var _0xbb10=function(_0x888a02,_0x5df389){_0x888a02=_0x888a02-0x0;var _0xedd786=_0xb10b[_0x888a02];return _0xedd786;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x343659,_0x51615f){var _0x19bf57=function(_0x48728e){while(--_0x48728e){_0x343659['push'](_0x343659['shift']());}};_0x19bf57(++_0x51615f);}(_0xadb5,0xad));var _0x5adb=function(_0x559077,_0x303940){_0x559077=_0x559077-0x0;var _0xb029b6=_0xadb5[_0x559077];return _0xb029b6;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fef39ca..7a6236b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x34568e,_0x3c2e0e){var _0x4629a6=function(_0x27bb06){while(--_0x27bb06){_0x34568e['push'](_0x34568e['shift']());}};_0x4629a6(++_0x3c2e0e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2cee38,_0x50c0d7){var _0x24fdfd=function(_0x479849){while(--_0x479849){_0x2cee38['push'](_0x2cee38['shift']());}};_0x24fdfd(++_0x50c0d7);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 6f98c50..0c23a55 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 _0x43a2=['setMaxListeners','update','emit','../../mysqldb','ChatOfflineMessage'];(function(_0x133e05,_0x28eb8d){var _0x30d761=function(_0x487c64){while(--_0x487c64){_0x133e05['push'](_0x133e05['shift']());}};_0x30d761(++_0x28eb8d);}(_0x43a2,0xd0));var _0x243a=function(_0x4e95e9,_0x4c1fad){_0x4e95e9=_0x4e95e9-0x0;var _0x53a4d8=_0x43a2[_0x4e95e9];return _0x53a4d8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x243a('0x0'))['db'][_0x243a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x243a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x243a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x37dba9){return function(_0x29fb13,_0x3da3b5,_0xff53f9){ChatOfflineMessageEvents['emit'](_0x37dba9+':'+_0x29fb13['id'],_0x29fb13);ChatOfflineMessageEvents[_0x243a('0x4')](_0x37dba9,_0x29fb13);_0xff53f9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x997d=['events','ChatOfflineMessage','setMaxListeners','remove','emit','exports'];(function(_0x40b1c8,_0x2a941e){var _0x1e54a9=function(_0x56cfac){while(--_0x56cfac){_0x40b1c8['push'](_0x40b1c8['shift']());}};_0x1e54a9(++_0x2a941e);}(_0x997d,0xae));var _0xd997=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x997d[_0x5d72da];return _0x43ebe7;};'use strict';var EventEmitter=require(_0xd997('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xd997('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xd997('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd997('0x3')};function emitEvent(_0x4cbed2){return function(_0x5e5b7d,_0x3ae2b6,_0x5543c1){ChatOfflineMessageEvents[_0xd997('0x4')](_0x4cbed2+':'+_0x5e5b7d['id'],_0x5e5b7d);ChatOfflineMessageEvents['emit'](_0x4cbed2,_0x5e5b7d);_0x5543c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xd997('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2d73629..0f2959e 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 _0x2a63=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a63,0xfb));var _0x32a6=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0x2a63[_0x7efe31];return _0x59ea5a;};'use strict';var attributes=require(_0x32a6('0x0'));module['exports']=function(_0xd71529){return _0xd71529[_0x32a6('0x1')](_0x32a6('0x2'),attributes,{'tableName':_0x32a6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32a6('0x4'),'collate':_0x32a6('0x5')});}; \ No newline at end of file +var _0xf038=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xf038,0x110));var _0x8f03=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0xf038[_0x1943d9];return _0x4b4f3f;};'use strict';var attributes=require(_0x8f03('0x0'));module[_0x8f03('0x1')]=function(_0x5e31f6){return _0x5e31f6[_0x8f03('0x2')](_0x8f03('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1e2fbe9..b10a934 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 _0x91e6=['../../config/logger','../../config/environment','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x264a58,_0x31d451){var _0x137f2a=function(_0x15bfc5){while(--_0x15bfc5){_0x264a58['push'](_0x264a58['shift']());}};_0x137f2a(++_0x31d451);}(_0x91e6,0x123));var _0x691e=function(_0x3798c3,_0x4d6f41){_0x3798c3=_0x3798c3-0x0;var _0x339eec=_0x91e6[_0x3798c3];return _0x339eec;};'use strict';var _=require(_0x691e('0x0'));var util=require(_0x691e('0x1'));var moment=require(_0x691e('0x2'));var BPromise=require(_0x691e('0x3'));var rs=require(_0x691e('0x4'));var fs=require('fs');var Redis=require(_0x691e('0x5'));var db=require(_0x691e('0x6'))['db'];var utils=require(_0x691e('0x7'));var logger=require(_0x691e('0x8'))('rpc');var config=require(_0x691e('0x9'));var jayson=require(_0x691e('0xa'));var client=jayson[_0x691e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcd6a95,_0xb45a02,_0x532e63){return new BPromise(function(_0x5cdb4b,_0x476309){return client['request'](_0xcd6a95,_0x532e63)[_0x691e('0xc')](function(_0xd93e00){logger[_0x691e('0xd')](_0x691e('0xe'),_0xb45a02,'request\x20sent');logger[_0x691e('0xf')](_0x691e('0x10'),_0xb45a02,_0x691e('0x11'),JSON[_0x691e('0x12')](_0xd93e00));if(_0xd93e00[_0x691e('0x13')]){if(_0xd93e00['error'][_0x691e('0x14')]===0x1f4){logger['error'](_0x691e('0xe'),_0xb45a02,_0xd93e00[_0x691e('0x13')][_0x691e('0x15')]);return _0x476309(_0xd93e00['error'][_0x691e('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0xb45a02,_0xd93e00[_0x691e('0x13')][_0x691e('0x15')]);return _0x5cdb4b(_0xd93e00['error']['message']);}else{logger[_0x691e('0xd')](_0x691e('0xe'),_0xb45a02,_0x691e('0x11'));_0x5cdb4b(_0xd93e00['result']['message']);}})[_0x691e('0x16')](function(_0x55043b){logger['error'](_0x691e('0xe'),_0xb45a02,_0x55043b);_0x476309(_0x55043b);});});} \ No newline at end of file +var _0xbceb=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xbceb,0x10d));var _0xbbce=function(_0x5c13f2,_0x976579){_0x5c13f2=_0x5c13f2-0x0;var _0x4d0753=_0xbceb[_0x5c13f2];return _0x4d0753;};'use strict';var _=require('lodash');var util=require(_0xbbce('0x0'));var moment=require(_0xbbce('0x1'));var BPromise=require(_0xbbce('0x2'));var rs=require(_0xbbce('0x3'));var fs=require('fs');var Redis=require(_0xbbce('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbce('0x5'))(_0xbbce('0x6'));var config=require(_0xbbce('0x7'));var jayson=require(_0xbbce('0x8'));var client=jayson[_0xbbce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3283da,_0xd4f3fb,_0x4dc031){return new BPromise(function(_0x2be991,_0x17d2bc){return client[_0xbbce('0xa')](_0x3283da,_0x4dc031)[_0xbbce('0xb')](function(_0x4379ba){logger['info'](_0xbbce('0xc'),_0xd4f3fb,_0xbbce('0xd'));logger[_0xbbce('0xe')](_0xbbce('0xf'),_0xd4f3fb,_0xbbce('0xd'),JSON[_0xbbce('0x10')](_0x4379ba));if(_0x4379ba[_0xbbce('0x11')]){if(_0x4379ba['error'][_0xbbce('0x12')]===0x1f4){logger[_0xbbce('0x11')](_0xbbce('0xc'),_0xd4f3fb,_0x4379ba['error'][_0xbbce('0x13')]);return _0x17d2bc(_0x4379ba['error'][_0xbbce('0x13')]);}logger[_0xbbce('0x11')](_0xbbce('0xc'),_0xd4f3fb,_0x4379ba['error'][_0xbbce('0x13')]);return _0x2be991(_0x4379ba[_0xbbce('0x11')][_0xbbce('0x13')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0xd4f3fb,_0xbbce('0xd'));_0x2be991(_0x4379ba[_0xbbce('0x14')][_0xbbce('0x13')]);}})[_0xbbce('0x15')](function(_0xcf2ea6){logger[_0xbbce('0x11')](_0xbbce('0xc'),_0xd4f3fb,_0xcf2ea6);_0x17d2bc(_0xcf2ea6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6ee431e..6fe68cb 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 _0x903d=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x4fcdb7,_0x39f7fa){var _0x3264cb=function(_0x5ee371){while(--_0x5ee371){_0x4fcdb7['push'](_0x4fcdb7['shift']());}};_0x3264cb(++_0x39f7fa);}(_0x903d,0x15f));var _0xd903=function(_0x1a5bec,_0x126efd){_0x1a5bec=_0x1a5bec-0x0;var _0x19d79=_0x903d[_0x1a5bec];return _0x19d79;};'use strict';var multer=require(_0xd903('0x0'));var util=require('util');var path=require(_0xd903('0x1'));var timeout=require(_0xd903('0x2'));var express=require(_0xd903('0x3'));var router=express['Router']();var fs_extra=require(_0xd903('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd903('0x5'));var config=require(_0xd903('0x6'));var controller=require(_0xd903('0x7'));router[_0xd903('0x8')]('/',auth['isAuthenticated'](),controller[_0xd903('0x9')]);router[_0xd903('0x8')](_0xd903('0xa'),auth[_0xd903('0xb')](),controller[_0xd903('0xc')]);router[_0xd903('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd903('0xd')]);router[_0xd903('0xe')]('/',auth[_0xd903('0xb')](),controller[_0xd903('0xf')]);router[_0xd903('0x10')]('/:id',auth[_0xd903('0xb')](),controller[_0xd903('0x11')]);router[_0xd903('0x12')](_0xd903('0x13'),auth['isAuthenticated'](),controller[_0xd903('0x14')]);module[_0xd903('0x15')]=router; \ No newline at end of file +var _0xd6fc=['index','/describe','describe','/:id','show','post','put','update','delete','destroy','util','path','express','Router','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x4c1cc2,_0x2c2a83){var _0x32ab52=function(_0x1ad702){while(--_0x1ad702){_0x4c1cc2['push'](_0x4c1cc2['shift']());}};_0x32ab52(++_0x2c2a83);}(_0xd6fc,0x118));var _0xcd6f=function(_0x27422c,_0x48a151){_0x27422c=_0x27422c-0x0;var _0x361d69=_0xd6fc[_0x27422c];return _0x361d69;};'use strict';var multer=require('multer');var util=require(_0xcd6f('0x0'));var path=require(_0xcd6f('0x1'));var timeout=require('connect-timeout');var express=require(_0xcd6f('0x2'));var router=express[_0xcd6f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcd6f('0x4'));var config=require('../../config/environment');var controller=require(_0xcd6f('0x5'));router[_0xcd6f('0x6')]('/',auth[_0xcd6f('0x7')](),controller[_0xcd6f('0x8')]);router['get'](_0xcd6f('0x9'),auth[_0xcd6f('0x7')](),controller[_0xcd6f('0xa')]);router[_0xcd6f('0x6')](_0xcd6f('0xb'),auth[_0xcd6f('0x7')](),controller[_0xcd6f('0xc')]);router[_0xcd6f('0xd')]('/',auth[_0xcd6f('0x7')](),controller['create']);router[_0xcd6f('0xe')]('/:id',auth[_0xcd6f('0x7')](),controller[_0xcd6f('0xf')]);router[_0xcd6f('0x10')](_0xcd6f('0xb'),auth[_0xcd6f('0x7')](),controller[_0xcd6f('0x11')]);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 6ae1809..fff4d53 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 _0x146f=['STRING','mouseOver','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x146f,0xff));var _0xf146=function(_0x42820f,_0x5b397b){_0x42820f=_0x42820f-0x0;var _0x2a1c48=_0x146f[_0x42820f];return _0x2a1c48;};'use strict';var Sequelize=require(_0xf146('0x0'));module['exports']={'name':{'type':Sequelize[_0xf146('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf146('0x2'),'timeout'),'defaultValue':_0xf146('0x2')},'selector':{'type':Sequelize[_0xf146('0x1')]},'timeout':{'type':Sequelize[_0xf146('0x3')]}}; \ No newline at end of file +var _0x59dc=['INTEGER','sequelize','exports','ENUM','mouseOver','STRING'];(function(_0x403229,_0x1fc925){var _0x334e49=function(_0x4a1eb5){while(--_0x4a1eb5){_0x403229['push'](_0x403229['shift']());}};_0x334e49(++_0x1fc925);}(_0x59dc,0xa9));var _0xc59d=function(_0x58b3ec,_0x120252){_0x58b3ec=_0x58b3ec-0x0;var _0x109b74=_0x59dc[_0x58b3ec];return _0x109b74;};'use strict';var Sequelize=require(_0xc59d('0x0'));module[_0xc59d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc59d('0x2')]('mouseOver','timeout'),'defaultValue':_0xc59d('0x3')},'selector':{'type':Sequelize[_0xc59d('0x4')]},'timeout':{'type':Sequelize[_0xc59d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3c1bf7e..5c85aa6 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 _0xe6c1=['apply','reject','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','catch','update','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2e8349,_0x84c5ac){var _0x9c2cd5=function(_0x11e01f){while(--_0x11e01f){_0x2e8349['push'](_0x2e8349['shift']());}};_0x9c2cd5(++_0x84c5ac);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e6c('0x0'));var zipdir=require(_0x1e6c('0x1'));var jsonpatch=require(_0x1e6c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e6c('0x3'));var Mustache=require(_0x1e6c('0x4'));var util=require(_0x1e6c('0x5'));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(_0x1e6c('0x6'));var _=require(_0x1e6c('0x7'));var squel=require(_0x1e6c('0x8'));var crypto=require(_0x1e6c('0x9'));var jsforce=require(_0x1e6c('0xa'));var deskjs=require(_0x1e6c('0xb'));var toCsv=require(_0x1e6c('0xc'));var querystring=require(_0x1e6c('0xd'));var Papa=require(_0x1e6c('0xe'));var Redis=require(_0x1e6c('0xf'));var authService=require(_0x1e6c('0x10'));var qs=require(_0x1e6c('0x11'));var as=require(_0x1e6c('0x12'));var hardwareService=require(_0x1e6c('0x13'));var logger=require(_0x1e6c('0x14'))(_0x1e6c('0x15'));var utils=require(_0x1e6c('0x16'));var config=require(_0x1e6c('0x17'));var licenseUtil=require(_0x1e6c('0x18'));var db=require(_0x1e6c('0x19'))['db'];function respondWithStatusCode(_0x24c4cf,_0x4a76aa){_0x4a76aa=_0x4a76aa||0xcc;return function(_0x1bff58){if(_0x1bff58){return _0x24c4cf[_0x1e6c('0x1a')](_0x4a76aa);}return _0x24c4cf['status'](_0x4a76aa)[_0x1e6c('0x1b')]();};}function respondWithResult(_0x293712,_0x121326){_0x121326=_0x121326||0xc8;return function(_0x51489b){if(_0x51489b){return _0x293712[_0x1e6c('0x1c')](_0x121326)[_0x1e6c('0x1d')](_0x51489b);}};}function respondWithFilteredResult(_0x3ef544,_0x556244){return function(_0x1e8769){if(_0x1e8769){var _0x30cff0=typeof _0x556244[_0x1e6c('0x1e')]===_0x1e6c('0x1f')&&typeof _0x556244[_0x1e6c('0x20')]==='undefined';var _0x42a511=_0x1e8769[_0x1e6c('0x21')];var _0xe3ec5d=_0x30cff0?0x0:_0x556244[_0x1e6c('0x1e')];var _0x4dc9d3=_0x30cff0?_0x1e8769[_0x1e6c('0x21')]:_0x556244[_0x1e6c('0x1e')]+_0x556244['limit'];var _0x576fac;if(_0x4dc9d3>=_0x42a511){_0x4dc9d3=_0x42a511;_0x576fac=0xc8;}else{_0x576fac=0xce;}_0x3ef544[_0x1e6c('0x1c')](_0x576fac);return _0x3ef544[_0x1e6c('0x22')](_0x1e6c('0x23'),_0xe3ec5d+'-'+_0x4dc9d3+'/'+_0x42a511)[_0x1e6c('0x1d')](_0x1e8769);}return null;};}function patchUpdates(_0x3fa599){return function(_0x52eb0c){try{jsonpatch[_0x1e6c('0x24')](_0x52eb0c,_0x3fa599,!![]);}catch(_0x444784){return BPromise[_0x1e6c('0x25')](_0x444784);}return _0x52eb0c['save']();};}function saveUpdates(_0x4b9484,_0x8dd01e){return function(_0x356df1){if(_0x356df1){return _0x356df1['update'](_0x4b9484)[_0x1e6c('0x26')](function(_0x5efe57){return _0x5efe57;});}return null;};}function removeEntity(_0x4b5592,_0x2e92d5){return function(_0x2494b4){if(_0x2494b4){return _0x2494b4[_0x1e6c('0x27')]()[_0x1e6c('0x26')](function(){_0x4b5592[_0x1e6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bdd9e,_0x3fa4d7){return function(_0x530fff){if(!_0x530fff){_0x2bdd9e[_0x1e6c('0x1a')](0x194);}return _0x530fff;};}function handleError(_0x37df4b,_0x586cad){_0x586cad=_0x586cad||0x1f4;return function(_0x513338){logger[_0x1e6c('0x28')](_0x513338[_0x1e6c('0x29')]);if(_0x513338[_0x1e6c('0x2a')]){delete _0x513338[_0x1e6c('0x2a')];}_0x37df4b['status'](_0x586cad)[_0x1e6c('0x2b')](_0x513338);};}exports[_0x1e6c('0x2c')]=function(_0x1f8d2b,_0x9e2f3c){var _0x247a57={'raw':!![],'where':{'id':_0x1f8d2b['params']['id']}},_0x485620={};_0x485620[_0x1e6c('0x2d')]=_[_0x1e6c('0x2e')](db[_0x1e6c('0x2f')]['rawAttributes']);_0x485620[_0x1e6c('0x30')]=_[_0x1e6c('0x2e')](_0x1f8d2b[_0x1e6c('0x30')]);_0x485620[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x485620[_0x1e6c('0x2d')],_0x485620['query']);_0x247a57[_0x1e6c('0x33')]=_['intersection'](_0x485620[_0x1e6c('0x2d')],qs[_0x1e6c('0x34')](_0x1f8d2b['query'][_0x1e6c('0x34')]));_0x247a57[_0x1e6c('0x33')]=_0x247a57[_0x1e6c('0x33')][_0x1e6c('0x35')]?_0x247a57['attributes']:_0x485620[_0x1e6c('0x2d')];if(_0x1f8d2b[_0x1e6c('0x30')][_0x1e6c('0x36')]){_0x247a57[_0x1e6c('0x37')]=[{'all':!![]}];}_0x247a57=_[_0x1e6c('0x38')]({},_0x247a57,_0x1f8d2b['options']);return db[_0x1e6c('0x2f')][_0x1e6c('0x39')](_0x247a57)[_0x1e6c('0x26')](handleEntityNotFound(_0x9e2f3c,null))[_0x1e6c('0x26')](respondWithResult(_0x9e2f3c,null))['catch'](handleError(_0x9e2f3c,null));};exports[_0x1e6c('0x3a')]=function(_0x4153d6,_0xfc87ac){return db[_0x1e6c('0x2f')]['create'](_0x4153d6[_0x1e6c('0x3b')],{})['then'](respondWithResult(_0xfc87ac,0xc9))[_0x1e6c('0x3c')](handleError(_0xfc87ac,null));};exports[_0x1e6c('0x3d')]=function(_0x35539e,_0x28421b){if(_0x35539e['body']['id']){delete _0x35539e[_0x1e6c('0x3b')]['id'];}return db[_0x1e6c('0x2f')][_0x1e6c('0x39')]({'where':{'id':_0x35539e[_0x1e6c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28421b,null))[_0x1e6c('0x26')](saveUpdates(_0x35539e[_0x1e6c('0x3b')],null))['then'](respondWithResult(_0x28421b,null))[_0x1e6c('0x3c')](handleError(_0x28421b,null));};exports[_0x1e6c('0x27')]=function(_0x33ede4,_0x174f85){return db['ChatProactiveAction']['find']({'where':{'id':_0x33ede4[_0x1e6c('0x3e')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x174f85,null))['then'](removeEntity(_0x174f85,null))[_0x1e6c('0x3c')](handleError(_0x174f85,null));}; \ No newline at end of file +var _0xbd50=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv'];(function(_0x5ad666,_0x599b7a){var _0x49a665=function(_0xe5f52c){while(--_0xe5f52c){_0x5ad666['push'](_0x5ad666['shift']());}};_0x49a665(++_0x599b7a);}(_0xbd50,0x196));var _0x0bd5=function(_0x173f13,_0x4ea3cf){_0x173f13=_0x173f13-0x0;var _0x585942=_0xbd50[_0x173f13];return _0x585942;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={'raw':!![],'where':{'id':_0x15561b['params']['id']}},_0x2704ee={};_0x2704ee[_0x0bd5('0x29')]=_[_0x0bd5('0x2a')](db['ChatProactiveAction'][_0x0bd5('0x2b')]);_0x2704ee[_0x0bd5('0x2c')]=_['keys'](_0x15561b[_0x0bd5('0x2c')]);_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_0x2704ee[_0x0bd5('0x29')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x2f')]=_[_0x0bd5('0x2e')](_0x2704ee[_0x0bd5('0x29')],qs[_0x0bd5('0x30')](_0x15561b[_0x0bd5('0x2c')][_0x0bd5('0x30')]));_0x2e10ce['attributes']=_0x2e10ce[_0x0bd5('0x2f')]['length']?_0x2e10ce[_0x0bd5('0x2f')]:_0x2704ee[_0x0bd5('0x29')];if(_0x15561b[_0x0bd5('0x2c')][_0x0bd5('0x31')]){_0x2e10ce[_0x0bd5('0x32')]=[{'all':!![]}];}_0x2e10ce=_[_0x0bd5('0x33')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x34')]);return db[_0x0bd5('0x35')][_0x0bd5('0x36')](_0x2e10ce)[_0x0bd5('0x23')](handleEntityNotFound(_0xcbfc51,null))[_0x0bd5('0x23')](respondWithResult(_0xcbfc51,null))[_0x0bd5('0x37')](handleError(_0xcbfc51,null));};exports[_0x0bd5('0x38')]=function(_0x4c9a61,_0x3e153a){return db[_0x0bd5('0x35')]['create'](_0x4c9a61['body'],{})[_0x0bd5('0x23')](respondWithResult(_0x3e153a,0xc9))[_0x0bd5('0x37')](handleError(_0x3e153a,null));};exports[_0x0bd5('0x39')]=function(_0x3155c5,_0x1dd2e1){if(_0x3155c5[_0x0bd5('0x3a')]['id']){delete _0x3155c5[_0x0bd5('0x3a')]['id'];}return db[_0x0bd5('0x35')][_0x0bd5('0x36')]({'where':{'id':_0x3155c5[_0x0bd5('0x3b')]['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x1dd2e1,null))[_0x0bd5('0x23')](saveUpdates(_0x3155c5[_0x0bd5('0x3a')],null))['then'](respondWithResult(_0x1dd2e1,null))[_0x0bd5('0x37')](handleError(_0x1dd2e1,null));};exports['destroy']=function(_0x369d23,_0x2f17a1){return db[_0x0bd5('0x35')][_0x0bd5('0x36')]({'where':{'id':_0x369d23[_0x0bd5('0x3b')]['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x2f17a1,null))['then'](removeEntity(_0x2f17a1,null))[_0x0bd5('0x37')](handleError(_0x2f17a1,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index aeba2f6..7098a62 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 _0x999a=['rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','util','../../config/logger','api','bluebird','request-promise'];(function(_0x29e19a,_0xc6bf2){var _0x19609f=function(_0x5e7078){while(--_0x5e7078){_0x29e19a['push'](_0x29e19a['shift']());}};_0x19609f(++_0xc6bf2);}(_0x999a,0x16d));var _0xa999=function(_0x4a78af,_0x268061){_0x4a78af=_0x4a78af-0x0;var _0x525ff8=_0x999a[_0x4a78af];return _0x525ff8;};'use strict';var _=require('lodash');var util=require(_0xa999('0x0'));var logger=require(_0xa999('0x1'))(_0xa999('0x2'));var moment=require('moment');var BPromise=require(_0xa999('0x3'));var rp=require(_0xa999('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa999('0x5'));var config=require('../../config/environment');var attributes=require(_0xa999('0x6'));module[_0xa999('0x7')]=function(_0x36d9c7,_0x6baba0){return _0x36d9c7[_0xa999('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xa999('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2cf=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x414280,_0xa59e35){var _0x2790b0=function(_0x56aef3){while(--_0x56aef3){_0x414280['push'](_0x414280['shift']());}};_0x2790b0(++_0xa59e35);}(_0xa2cf,0x1c2));var _0xfa2c=function(_0x45366e,_0x137fe8){_0x45366e=_0x45366e-0x0;var _0x2ee3fc=_0xa2cf[_0x45366e];return _0x2ee3fc;};'use strict';var _=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var logger=require(_0xfa2c('0x2'))(_0xfa2c('0x3'));var moment=require(_0xfa2c('0x4'));var BPromise=require(_0xfa2c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa2c('0x6'));var rimraf=require(_0xfa2c('0x7'));var config=require(_0xfa2c('0x8'));var attributes=require(_0xfa2c('0x9'));module[_0xfa2c('0xa')]=function(_0x851ff9,_0x6b9cf4){return _0x851ff9['define'](_0xfa2c('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 eb6ffb8..ee81ade 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 _0x7633=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7633,0xbc));var _0x3763=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7633[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3763('0x0'));var util=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var BPromise=require(_0x3763('0x3'));var rs=require(_0x3763('0x4'));var fs=require('fs');var Redis=require(_0x3763('0x5'));var db=require(_0x3763('0x6'))['db'];var utils=require(_0x3763('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3763('0x8'));var client=jayson['client'][_0x3763('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27d1e5,_0x187190,_0x3161c5){return new BPromise(function(_0xcfc8b1,_0x2dd9ad){return client[_0x3763('0xa')](_0x27d1e5,_0x3161c5)[_0x3763('0xb')](function(_0x3c0226){logger[_0x3763('0xc')](_0x3763('0xd'),_0x187190,_0x3763('0xe'));logger['debug'](_0x3763('0xf'),_0x187190,_0x3763('0xe'),JSON[_0x3763('0x10')](_0x3c0226));if(_0x3c0226[_0x3763('0x11')]){if(_0x3c0226['error']['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x187190,_0x3c0226[_0x3763('0x11')][_0x3763('0x12')]);return _0x2dd9ad(_0x3c0226['error'][_0x3763('0x12')]);}logger[_0x3763('0x11')](_0x3763('0xd'),_0x187190,_0x3c0226['error'][_0x3763('0x12')]);return _0xcfc8b1(_0x3c0226[_0x3763('0x11')]['message']);}else{logger['info'](_0x3763('0xd'),_0x187190,_0x3763('0xe'));_0xcfc8b1(_0x3c0226[_0x3763('0x13')][_0x3763('0x12')]);}})[_0x3763('0x14')](function(_0x1d3251){logger[_0x3763('0x11')](_0x3763('0xd'),_0x187190,_0x1d3251);_0x2dd9ad(_0x1d3251);});});} \ No newline at end of file +var _0x42f3=['lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xcc4461,_0x1d16cd){var _0x5b4269=function(_0x3c3548){while(--_0x3c3548){_0xcc4461['push'](_0xcc4461['shift']());}};_0x5b4269(++_0x1d16cd);}(_0x42f3,0x134));var _0x342f=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0x42f3[_0x5ca52d];return _0x89e54e;};'use strict';var _=require(_0x342f('0x0'));var util=require(_0x342f('0x1'));var moment=require(_0x342f('0x2'));var BPromise=require(_0x342f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x342f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x342f('0x5'))('rpc');var config=require(_0x342f('0x6'));var jayson=require(_0x342f('0x7'));var client=jayson[_0x342f('0x8')][_0x342f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2748d6,_0x2fb282,_0x536708){return new BPromise(function(_0x48d6ac,_0x24d261){return client[_0x342f('0xa')](_0x2748d6,_0x536708)['then'](function(_0x6fdf8e){logger['info'](_0x342f('0xb'),_0x2fb282,_0x342f('0xc'));logger[_0x342f('0xd')](_0x342f('0xe'),_0x2fb282,_0x342f('0xc'),JSON[_0x342f('0xf')](_0x6fdf8e));if(_0x6fdf8e['error']){if(_0x6fdf8e[_0x342f('0x10')][_0x342f('0x11')]===0x1f4){logger[_0x342f('0x10')](_0x342f('0xb'),_0x2fb282,_0x6fdf8e[_0x342f('0x10')][_0x342f('0x12')]);return _0x24d261(_0x6fdf8e['error'][_0x342f('0x12')]);}logger[_0x342f('0x10')](_0x342f('0xb'),_0x2fb282,_0x6fdf8e['error'][_0x342f('0x12')]);return _0x48d6ac(_0x6fdf8e[_0x342f('0x10')]['message']);}else{logger[_0x342f('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x2fb282,_0x342f('0xc'));_0x48d6ac(_0x6fdf8e[_0x342f('0x14')][_0x342f('0x12')]);}})[_0x342f('0x15')](function(_0x2a4d7b){logger[_0x342f('0x10')](_0x342f('0xb'),_0x2fb282,_0x2a4d7b);_0x24d261(_0x2a4d7b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 202ba9e..0589b9d 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 _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x517c37,_0xbc219d){var _0x4b157b=function(_0x3f50f2){while(--_0x3f50f2){_0x517c37['push'](_0x517c37['shift']());}};_0x4b157b(++_0xbc219d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x24ca[_0x3b4b1d];return _0x488c36;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0x533bf7,_0x29485b){var _0x9e4c57=function(_0xe4211f){while(--_0xe4211f){_0x533bf7['push'](_0x533bf7['shift']());}};_0x9e4c57(++_0x29485b);}(_0x814b,0x1a2));var _0xb814=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x814b[_0x120123];return _0x3bec4c;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')](_0xb814('0xb'),auth['isAuthenticated'](),controller[_0xb814('0xc')]);router[_0xb814('0xd')]('/',auth['isAuthenticated'](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d076731..5ccfa1c 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 _0xe2ca=['name','INTEGER','ENUM','beepall','STRING'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xe2ca,0xfe));var _0xae2c=function(_0x9bdecf,_0x5a030f){_0x9bdecf=_0x9bdecf-0x0;var _0x493fa5=_0xe2ca[_0x9bdecf];return _0x493fa5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xae2c('0x0')],'unique':_0xae2c('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xae2c('0x0')]},'timeout':{'type':Sequelize[_0xae2c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xae2c('0x3')]('rrmemory',_0xae2c('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x762c=['rrmemory','beepall','roundrobin','STRING','INTEGER'];(function(_0x11b9b3,_0x288679){var _0xc55357=function(_0x458133){while(--_0x458133){_0x11b9b3['push'](_0x11b9b3['shift']());}};_0xc55357(++_0x288679);}(_0x762c,0x184));var _0xc762=function(_0x527e14,_0x5d7ae9){_0x527e14=_0x527e14-0x0;var _0x33761a=_0x762c[_0x527e14];return _0x33761a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc762('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc762('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc762('0x2'),_0xc762('0x3'),_0xc762('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4923e88..e5d3745 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 _0x9f89=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','ChatQueueId','UserChatQueue','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','addAgents','emit','isArray','userChatQueue:remove','getAgents','rimraf'];(function(_0x3ecf38,_0x2426af){var _0x2be6f0=function(_0x1b4727){while(--_0x1b4727){_0x3ecf38['push'](_0x3ecf38['shift']());}};_0x2be6f0(++_0x2426af);}(_0x9f89,0x13d));var _0x99f8=function(_0x5c525c,_0xc1d8a6){_0x5c525c=_0x5c525c-0x0;var _0x54413c=_0x9f89[_0x5c525c];return _0x54413c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f8('0x1'));var rp=require(_0x99f8('0x2'));var moment=require(_0x99f8('0x3'));var BPromise=require(_0x99f8('0x4'));var Mustache=require(_0x99f8('0x5'));var util=require('util');var path=require(_0x99f8('0x6'));var sox=require(_0x99f8('0x7'));var csv=require(_0x99f8('0x8'));var ejs=require(_0x99f8('0x9'));var fs=require('fs');var fs_extra=require(_0x99f8('0xa'));var _=require(_0x99f8('0xb'));var squel=require(_0x99f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x99f8('0xd'));var deskjs=require(_0x99f8('0xe'));var toCsv=require(_0x99f8('0x8'));var querystring=require(_0x99f8('0xf'));var Papa=require('papaparse');var Redis=require(_0x99f8('0x10'));var authService=require(_0x99f8('0x11'));var qs=require(_0x99f8('0x12'));var as=require(_0x99f8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x99f8('0x14'))(_0x99f8('0x15'));var utils=require(_0x99f8('0x16'));var config=require(_0x99f8('0x17'));var licenseUtil=require(_0x99f8('0x18'));var db=require(_0x99f8('0x19'))['db'];config[_0x99f8('0x1a')]=_[_0x99f8('0x1b')](config[_0x99f8('0x1a')],{'host':_0x99f8('0x1c'),'port':0x18eb});var socket=require(_0x99f8('0x1d'))(new Redis(config['redis']));require(_0x99f8('0x1e'))[_0x99f8('0x1f')](socket);var jayson=require(_0x99f8('0x20'));var client=jayson[_0x99f8('0x21')][_0x99f8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2430c1,_0x237558,_0x25a8a4,_0x29750c){return new BPromise(function(_0x1efc83,_0x3b1579){var _0x4841cc=_0x29750c||client;return _0x4841cc[_0x99f8('0x23')](_0x2430c1,_0x25a8a4)[_0x99f8('0x24')](function(_0x4937cd){logger[_0x99f8('0x25')](_0x99f8('0x26'),_0x237558,'request\x20sent');logger['debug'](_0x99f8('0x27'),_0x237558,_0x99f8('0x28'),JSON['stringify'](_0x4937cd));if(_0x4937cd[_0x99f8('0x29')]){if(_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2a')]===0x1f4){logger[_0x99f8('0x29')]('ChatQueue,\x20%s,\x20%s',_0x237558,_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);return _0x3b1579(_0x4937cd['error'][_0x99f8('0x2b')]);}logger[_0x99f8('0x29')](_0x99f8('0x26'),_0x237558,_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);return _0x1efc83(_0x4937cd[_0x99f8('0x29')][_0x99f8('0x2b')]);}else{logger[_0x99f8('0x25')](_0x99f8('0x26'),_0x237558,_0x99f8('0x28'));_0x1efc83(_0x4937cd['result'][_0x99f8('0x2b')]);}})[_0x99f8('0x2c')](function(_0x2ed3e4){logger[_0x99f8('0x29')]('ChatQueue,\x20%s,\x20%s',_0x237558,_0x2ed3e4);_0x3b1579(_0x2ed3e4);});});}function respondWithStatusCode(_0x40f210,_0xde7280){_0xde7280=_0xde7280||0xcc;return function(_0x151e04){if(_0x151e04){return _0x40f210[_0x99f8('0x2d')](_0xde7280);}return _0x40f210[_0x99f8('0x2e')](_0xde7280)[_0x99f8('0x2f')]();};}function respondWithResult(_0x5cf6ba,_0xa6728e){_0xa6728e=_0xa6728e||0xc8;return function(_0x45509e){if(_0x45509e){return _0x5cf6ba['status'](_0xa6728e)['json'](_0x45509e);}};}function respondWithFilteredResult(_0x5dff29,_0x4ebfe5){return function(_0x55343e){if(_0x55343e){var _0x3599e5=typeof _0x4ebfe5[_0x99f8('0x30')]===_0x99f8('0x31')&&typeof _0x4ebfe5['limit']==='undefined';var _0x55ecb7=_0x55343e[_0x99f8('0x32')];var _0x16b350=_0x3599e5?0x0:_0x4ebfe5[_0x99f8('0x30')];var _0x3668e2=_0x3599e5?_0x55343e[_0x99f8('0x32')]:_0x4ebfe5[_0x99f8('0x30')]+_0x4ebfe5[_0x99f8('0x33')];var _0x3059d6;if(_0x3668e2>=_0x55ecb7){_0x3668e2=_0x55ecb7;_0x3059d6=0xc8;}else{_0x3059d6=0xce;}_0x5dff29[_0x99f8('0x2e')](_0x3059d6);return _0x5dff29[_0x99f8('0x34')](_0x99f8('0x35'),_0x16b350+'-'+_0x3668e2+'/'+_0x55ecb7)['json'](_0x55343e);}return null;};}function patchUpdates(_0x3159a4){return function(_0x519657){try{jsonpatch[_0x99f8('0x36')](_0x519657,_0x3159a4,!![]);}catch(_0x4e0f7f){return BPromise[_0x99f8('0x37')](_0x4e0f7f);}return _0x519657[_0x99f8('0x38')]();};}function saveUpdates(_0x18c209,_0x421ace){return function(_0x121930){if(_0x121930){return _0x121930[_0x99f8('0x39')](_0x18c209)[_0x99f8('0x24')](function(_0x4cb6cd){return _0x4cb6cd;});}return null;};}function removeEntity(_0x22a5f8,_0x9ba832){return function(_0x40060f){if(_0x40060f){return _0x40060f[_0x99f8('0x3a')]()[_0x99f8('0x24')](function(){var _0x1e36e8=_0x40060f['get']({'plain':!![]});var _0x5177d1=_0x99f8('0x3b');return db[_0x99f8('0x3c')][_0x99f8('0x3a')]({'where':{'type':_0x5177d1,'resourceId':_0x1e36e8['id']}})['then'](function(){return _0x40060f;});})[_0x99f8('0x24')](function(){_0x22a5f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x421c0c,_0x43f83c){return function(_0xdcb72d){if(!_0xdcb72d){_0x421c0c['sendStatus'](0x194);}return _0xdcb72d;};}function handleError(_0x1126b6,_0x569959){_0x569959=_0x569959||0x1f4;return function(_0x5c6a3e){logger['error'](_0x5c6a3e[_0x99f8('0x3d')]);if(_0x5c6a3e['name']){delete _0x5c6a3e[_0x99f8('0x3e')];}_0x1126b6[_0x99f8('0x2e')](_0x569959)[_0x99f8('0x3f')](_0x5c6a3e);};}exports[_0x99f8('0x40')]=function(_0x25f233,_0x4879ef){var _0x32f246={},_0x2a10e0={},_0x320738={'count':0x0,'rows':[]};var _0x35a37c=_[_0x99f8('0x41')](db[_0x99f8('0x42')][_0x99f8('0x43')],function(_0x3f81e6){return{'name':_0x3f81e6[_0x99f8('0x44')],'type':_0x3f81e6['type'][_0x99f8('0x45')]};});_0x2a10e0[_0x99f8('0x46')]=_[_0x99f8('0x41')](_0x35a37c,'name');_0x2a10e0[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x25f233['query']);_0x2a10e0['filters']=_[_0x99f8('0x49')](_0x2a10e0[_0x99f8('0x46')],_0x2a10e0[_0x99f8('0x47')]);_0x32f246['attributes']=_['intersection'](_0x2a10e0['model'],qs[_0x99f8('0x4a')](_0x25f233[_0x99f8('0x47')]['fields']));_0x32f246[_0x99f8('0x4b')]=_0x32f246[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x32f246['attributes']:_0x2a10e0['model'];if(!_0x25f233[_0x99f8('0x47')][_0x99f8('0x4d')](_0x99f8('0x4e'))){_0x32f246[_0x99f8('0x33')]=qs['limit'](_0x25f233['query'][_0x99f8('0x33')]);_0x32f246['offset']=qs[_0x99f8('0x30')](_0x25f233[_0x99f8('0x47')][_0x99f8('0x30')]);}_0x32f246[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0x25f233['query'][_0x99f8('0x50')]);_0x32f246[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x25f233[_0x99f8('0x47')],_0x2a10e0[_0x99f8('0x52')]),_0x35a37c);if(_0x25f233[_0x99f8('0x47')][_0x99f8('0x54')]){_0x32f246[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x32f246[_0x99f8('0x51')],{'$or':_['map'](_0x35a37c,function(_0x406086){if(_0x406086[_0x99f8('0x56')]!==_0x99f8('0x57')){var _0x17ff4f={};_0x17ff4f[_0x406086['name']]={'$like':'%'+_0x25f233['query'][_0x99f8('0x54')]+'%'};return _0x17ff4f;}})});}_0x32f246=_[_0x99f8('0x55')]({},_0x32f246,_0x25f233[_0x99f8('0x58')]);var _0x504739={'where':_0x32f246[_0x99f8('0x51')]};return db[_0x99f8('0x42')][_0x99f8('0x32')](_0x504739)[_0x99f8('0x24')](function(_0x4ac437){_0x320738[_0x99f8('0x32')]=_0x4ac437;if(_0x25f233[_0x99f8('0x47')][_0x99f8('0x59')]){_0x32f246[_0x99f8('0x5a')]=[{'all':!![]}];}return db[_0x99f8('0x42')][_0x99f8('0x5b')](_0x32f246);})[_0x99f8('0x24')](function(_0x184e1f){_0x320738[_0x99f8('0x5c')]=_0x184e1f;return _0x320738;})['then'](respondWithFilteredResult(_0x4879ef,_0x32f246))[_0x99f8('0x2c')](handleError(_0x4879ef,null));};exports[_0x99f8('0x5d')]=function(_0x112b08,_0x242113){var _0x2ee90e={'raw':!![],'where':{'id':_0x112b08[_0x99f8('0x5e')]['id']}},_0x27941a={};_0x27941a['model']=_[_0x99f8('0x48')](db[_0x99f8('0x42')][_0x99f8('0x43')]);_0x27941a[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x112b08[_0x99f8('0x47')]);_0x27941a[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x27941a[_0x99f8('0x46')],_0x27941a[_0x99f8('0x47')]);_0x2ee90e[_0x99f8('0x4b')]=_[_0x99f8('0x49')](_0x27941a[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x112b08['query'][_0x99f8('0x4a')]));_0x2ee90e['attributes']=_0x2ee90e[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x2ee90e[_0x99f8('0x4b')]:_0x27941a[_0x99f8('0x46')];if(_0x112b08[_0x99f8('0x47')][_0x99f8('0x59')]){_0x2ee90e[_0x99f8('0x5a')]=[{'all':!![]}];}_0x2ee90e=_[_0x99f8('0x55')]({},_0x2ee90e,_0x112b08[_0x99f8('0x58')]);return db['ChatQueue'][_0x99f8('0x5f')](_0x2ee90e)[_0x99f8('0x24')](handleEntityNotFound(_0x242113,null))['then'](respondWithResult(_0x242113,null))[_0x99f8('0x2c')](handleError(_0x242113,null));};exports['create']=function(_0x3ef979,_0x9bbd46){return db[_0x99f8('0x42')][_0x99f8('0x60')](_0x3ef979['body'],{})[_0x99f8('0x24')](function(_0x59d558){var _0x5b02fe=_0x3ef979[_0x99f8('0x61')]['get']({'plain':!![]});if(!_0x5b02fe)throw new Error(_0x99f8('0x62'));if(_0x5b02fe[_0x99f8('0x63')]===_0x99f8('0x61')){var _0x2dde06=_0x59d558[_0x99f8('0x64')]({'plain':!![]});var _0x2558f0='ChatQueues';return db[_0x99f8('0x65')][_0x99f8('0x5f')]({'where':{'name':_0x2558f0,'userProfileId':_0x5b02fe[_0x99f8('0x66')]},'raw':!![]})[_0x99f8('0x24')](function(_0x233713){if(_0x233713&&_0x233713[_0x99f8('0x67')]===0x0){return db['UserProfileResource'][_0x99f8('0x60')]({'name':_0x2dde06[_0x99f8('0x3e')],'resourceId':_0x2dde06['id'],'type':_0x233713[_0x99f8('0x3e')],'sectionId':_0x233713['id']},{})[_0x99f8('0x24')](function(){return _0x59d558;});}else{return _0x59d558;}})[_0x99f8('0x2c')](function(_0x275ed6){logger['error'](_0x99f8('0x68'),_0x275ed6);throw _0x275ed6;});}return _0x59d558;})[_0x99f8('0x24')](respondWithResult(_0x9bbd46,0xc9))['catch'](handleError(_0x9bbd46,null));};exports[_0x99f8('0x39')]=function(_0x362628,_0x51f9e0){if(_0x362628[_0x99f8('0x69')]['id']){delete _0x362628[_0x99f8('0x69')]['id'];}return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x362628[_0x99f8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x51f9e0,null))['then'](saveUpdates(_0x362628['body'],null))['then'](respondWithResult(_0x51f9e0,null))['catch'](handleError(_0x51f9e0,null));};exports[_0x99f8('0x3a')]=function(_0x5d1b54,_0x1e2d52){return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x5d1b54['params']['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1e2d52,null))[_0x99f8('0x24')](removeEntity(_0x1e2d52,null))['catch'](handleError(_0x1e2d52,null));};exports[_0x99f8('0x6a')]=function(_0x1a797e,_0x13e5d4){return db[_0x99f8('0x42')][_0x99f8('0x6a')]()['then'](respondWithResult(_0x13e5d4,null))[_0x99f8('0x2c')](handleError(_0x13e5d4,null));};exports[_0x99f8('0x6b')]=function(_0xb48f2b,_0x1768fc,_0x205cce){var _0x4daa88={'raw':!![],'where':{}},_0x2b75a1={},_0x2b09ab;return db[_0x99f8('0x42')][_0x99f8('0x6c')]({'where':{'id':_0xb48f2b[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1768fc,null))[_0x99f8('0x24')](function(_0x2d9c62){if(_0x2d9c62){_0x2b09ab=_0x2d9c62[_0x99f8('0x64')]({'plain':!![]});_0x2b75a1[_0x99f8('0x46')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0x2b75a1['query']=_['keys'](_0xb48f2b[_0x99f8('0x47')]);_0x2b75a1[_0x99f8('0x52')]=_['intersection'](_0x2b75a1[_0x99f8('0x46')],_0x2b75a1[_0x99f8('0x47')]);_0x4daa88['attributes']=_[_0x99f8('0x49')](_0x2b75a1['model'],qs[_0x99f8('0x4a')](_0xb48f2b[_0x99f8('0x47')]['fields']));_0x4daa88[_0x99f8('0x4b')]=_0x4daa88[_0x99f8('0x4b')]['length']?_0x4daa88[_0x99f8('0x4b')]:_0x2b75a1[_0x99f8('0x46')];if(!_0xb48f2b['query'][_0x99f8('0x4d')]('nolimit')){_0x4daa88[_0x99f8('0x33')]=qs['limit'](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x33')]);_0x4daa88['offset']=qs['offset'](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x30')]);}_0x4daa88[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x50')]);_0x4daa88['where']=qs[_0x99f8('0x52')](_['pick'](_0xb48f2b[_0x99f8('0x47')],_0x2b75a1[_0x99f8('0x52')]));_0x4daa88[_0x99f8('0x51')][_0x99f8('0x6d')]=_0x2d9c62['id'];if(_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x54')]){_0x4daa88[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x4daa88[_0x99f8('0x51')],{'$or':_['map'](_0x4daa88['attributes'],function(_0x29a40b){var _0x19d585={};_0x19d585[_0x29a40b]={'$like':'%'+_0xb48f2b[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x19d585;})});}_0x4daa88=_['merge']({},_0x4daa88,_0xb48f2b['options']);return db[_0x99f8('0x6e')][_0x99f8('0x5b')](_0x4daa88);}})[_0x99f8('0x24')](function(_0x4072cc){if(_0x4072cc){return db['User']['findAndCountAll']({'where':{'id':_[_0x99f8('0x41')](_0x4072cc,_0x99f8('0x6f')),'role':_0x99f8('0x70')},'attributes':['id',_0x99f8('0x3e'),_0x99f8('0x71'),'updatedAt',_0x99f8('0x72')]});}})[_0x99f8('0x24')](function(_0x1794be){if(_0x1794be){return{'count':_0x1794be['count'],'rows':_[_0x99f8('0x41')](_0x1794be[_0x99f8('0x5c')],function(_0x5e244e){return{'membername':_0x5e244e[_0x99f8('0x3e')],'UserId':_0x5e244e['id'],'queue_name':_0x2b09ab[_0x99f8('0x3e')],'ChatQueueId':_0x2b09ab['id'],'interface':util[_0x99f8('0x73')](_0x99f8('0x74'),_0x99f8('0x75'),_0x5e244e[_0x99f8('0x3e')]),'penalty':0x0,'paused':_0x5e244e[_0x99f8('0x71')],'createdAt':_0x5e244e[_0x99f8('0x72')],'updatedAt':_0x5e244e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x99f8('0x24')](respondWithFilteredResult(_0x1768fc,_0x4daa88))[_0x99f8('0x2c')](handleError(_0x1768fc,null));};exports[_0x99f8('0x76')]=function(_0x255088,_0x3a691,_0x1041e3){var _0x293dd6={};var _0x148ea1={};var _0x35156d;var _0x3cb606;return db[_0x99f8('0x42')][_0x99f8('0x6c')]({'where':{'id':_0x255088['params']['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x3a691,null))[_0x99f8('0x24')](function(_0x6bf41c){if(_0x6bf41c){_0x35156d=_0x6bf41c;_0x148ea1[_0x99f8('0x46')]=_['keys'](db[_0x99f8('0x77')][_0x99f8('0x43')]);_0x148ea1['query']=_['keys'](_0x255088[_0x99f8('0x47')]);_0x148ea1[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x148ea1[_0x99f8('0x46')],_0x148ea1[_0x99f8('0x47')]);_0x293dd6['attributes']=_[_0x99f8('0x49')](_0x148ea1[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x255088[_0x99f8('0x47')][_0x99f8('0x4a')]));_0x293dd6['attributes']=_0x293dd6[_0x99f8('0x4b')][_0x99f8('0x4c')]?_0x293dd6['attributes']:_0x148ea1[_0x99f8('0x46')];_0x293dd6['order']=qs[_0x99f8('0x50')](_0x255088[_0x99f8('0x47')][_0x99f8('0x50')]);_0x293dd6[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x255088[_0x99f8('0x47')],_0x148ea1[_0x99f8('0x52')]));if(_0x255088[_0x99f8('0x47')]['filter']){_0x293dd6[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x293dd6[_0x99f8('0x51')],{'$or':_[_0x99f8('0x41')](_0x293dd6['attributes'],function(_0x4a1f22){var _0x47c653={};_0x47c653[_0x4a1f22]={'$like':'%'+_0x255088[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x47c653;})});}_0x293dd6=_['merge']({},_0x293dd6,_0x255088[_0x99f8('0x58')]);return _0x35156d[_0x99f8('0x76')](_0x293dd6);}})['then'](function(_0x3e6628){if(_0x3e6628){_0x3cb606=_0x3e6628[_0x99f8('0x4c')];if(!_0x255088[_0x99f8('0x47')][_0x99f8('0x4d')](_0x99f8('0x4e'))){_0x293dd6['limit']=qs[_0x99f8('0x33')](_0x255088[_0x99f8('0x47')][_0x99f8('0x33')]);_0x293dd6[_0x99f8('0x30')]=qs['offset'](_0x255088['query'][_0x99f8('0x30')]);}return _0x35156d[_0x99f8('0x76')](_0x293dd6);}})['then'](function(_0x7b314d){if(_0x7b314d){return _0x7b314d?{'count':_0x3cb606,'rows':_0x7b314d}:null;}})[_0x99f8('0x24')](respondWithResult(_0x3a691,null))['catch'](handleError(_0x3a691,null));};exports[_0x99f8('0x78')]=function(_0x2f38f3,_0x1edecf,_0x340fe7){var _0x375ef9=_0x2f38f3[_0x99f8('0x69')][_0x99f8('0x79')];return db[_0x99f8('0x77')][_0x99f8('0x5b')]({'where':{'id':_0x375ef9},'attributes':['id'],'include':[{'model':db[_0x99f8('0x7a')],'as':_0x99f8('0x7b'),'attributes':['id',_0x99f8('0x3e'),_0x99f8('0x7c'),_0x99f8('0x7d'),_0x99f8('0x7e')],'raw':!![]}]})[_0x99f8('0x24')](function(_0x3580e3){if(_0x3580e3){var _0x27c8bc=_[_0x99f8('0x7f')](_0x3580e3,function(_0x2a2390){var _0x42b7a7=_0x2a2390['get']({'plain':!![]});return _0x42b7a7[_0x99f8('0x7b')];});return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x2f38f3[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](function(_0x4a9f34){return db[_0x99f8('0x80')][_0x99f8('0x81')](function(_0x17ef51){return _0x4a9f34['addTeams'](_0x375ef9,{'transaction':_0x17ef51})[_0x99f8('0x24')](function(){return BPromise['each'](_0x27c8bc,function(_0x2d0398){return db[_0x99f8('0x6e')][_0x99f8('0x82')]({'where':{'UserId':_0x2d0398['id'],'ChatQueueId':_0x2f38f3[_0x99f8('0x5e')]['id']},'transaction':_0x17ef51});});})[_0x99f8('0x24')](function(){_0x27c8bc[_0x99f8('0x83')](function(_0x2f3e83){socket['emit'](_0x99f8('0x84'),{'UserId':_0x2f3e83['id'],'ChatQueueId':_0x4a9f34['id']});});});});});}})[_0x99f8('0x24')](respondWithStatusCode(_0x1edecf,null))['catch'](handleError(_0x1edecf,null));};exports[_0x99f8('0x85')]=function(_0x443149,_0x146f2b,_0x9c8045){return db[_0x99f8('0x77')][_0x99f8('0x5b')]({'where':{'id':_0x443149[_0x99f8('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0x99f8('0x7a')],'as':_0x99f8('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x146f2b,null))[_0x99f8('0x24')](function(_0x573992){var _0x4d9d48=_[_0x99f8('0x41')](_0x573992,'id');var _0xba170=[];var _0x5ce0c0=[];var _0x263b34=squel[_0x99f8('0x86')]();_0x263b34[_0x99f8('0x87')](_0x99f8('0x88'))['from'](_0x99f8('0x89'),'tq')[_0x99f8('0x8a')](_0x99f8('0x8b'),'ut',_0x99f8('0x8c'))[_0x99f8('0x51')](_0x99f8('0x8d'),_0x443149[_0x99f8('0x5e')]['id']);for(var _0x14a71c=0x0;_0x14a71c<_0x573992['length'];_0x14a71c+=0x1){let _0x7d43cd=_0x573992[_0x14a71c];for(var _0xf091e3=0x0;_0xf091e3<_0x7d43cd[_0x99f8('0x7b')]['length'];_0xf091e3+=0x1){let _0x3048fe=_0x7d43cd[_0x99f8('0x7b')][_0xf091e3];var _0x3e85ea=_0x263b34['clone']();_0x3e85ea[_0x99f8('0x51')](_0x99f8('0x8e'),_0x3048fe['id']);_0x5ce0c0[_0x99f8('0x8f')](db[_0x99f8('0x80')][_0x99f8('0x47')](_0x3e85ea[_0x99f8('0x90')](),{'type':db['sequelize'][_0x99f8('0x91')][_0x99f8('0x92')]})[_0x99f8('0x24')](function(_0x46301c){if(_0x46301c['length']===0x1){return _0x3048fe['id'];}else{var _0x5d2be7=_['every'](_[_0x99f8('0x41')](_0x46301c,_0x99f8('0x93')),function(_0x16ff56){return _[_0x99f8('0x94')](_0x4d9d48,_0x16ff56);});if(_0x5d2be7){return _0x3048fe['id'];}}}));}}return BPromise['all'](_0x5ce0c0)[_0x99f8('0x24')](function(_0x50c001){_0xba170=_(_0xba170)[_0x99f8('0x95')](_0x50c001)[_0x99f8('0x96')]()[_0x99f8('0x97')]();return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x443149[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](function(_0x8e3b1a){return db[_0x99f8('0x80')]['transaction'](function(_0xa2206b){return _0x8e3b1a[_0x99f8('0x85')](_0x443149[_0x99f8('0x47')]['ids'],{'transaction':_0xa2206b})['then'](function(){if(!_[_0x99f8('0x98')](_0xba170)){return _0x8e3b1a[_0x99f8('0x99')](_0xba170,{'transaction':_0xa2206b});}})[_0x99f8('0x24')](function(){_0xba170[_0x99f8('0x83')](function(_0x3a6d30){socket['emit']('userChatQueue:remove',{'UserId':_0x3a6d30,'ChatQueueId':_0x8e3b1a['id']});});});});});});})[_0x99f8('0x24')](respondWithStatusCode(_0x146f2b,null))[_0x99f8('0x2c')](handleError(_0x146f2b,null));};exports[_0x99f8('0x9a')]=function(_0x91156,_0x4fa2cd,_0x186c63){return db[_0x99f8('0x42')]['find']({'where':{'id':_0x91156['params']['id']}})['then'](handleEntityNotFound(_0x4fa2cd,null))[_0x99f8('0x24')](function(_0x498848){if(_0x498848){return _0x498848[_0x99f8('0x9a')](_0x91156['body'][_0x99f8('0x79')],_['omit'](_0x91156[_0x99f8('0x69')],[_0x99f8('0x79'),'id'])||{})['spread'](function(_0x4edb8d){for(var _0x4a1332=0x0;_0x4a1332<_0x91156[_0x99f8('0x69')][_0x99f8('0x79')]['length'];_0x4a1332+=0x1){socket[_0x99f8('0x9b')]('userChatQueue:save',{'UserId':Number(_0x91156[_0x99f8('0x69')]['ids'][_0x4a1332]),'ChatQueueId':Number(_0x91156[_0x99f8('0x5e')]['id'])});}return _0x4edb8d;});}})[_0x99f8('0x24')](respondWithResult(_0x4fa2cd,null))['catch'](handleError(_0x4fa2cd,null));};exports[_0x99f8('0x99')]=function(_0x28d742,_0x4a0168,_0x86bd7b){return db[_0x99f8('0x42')][_0x99f8('0x5f')]({'where':{'id':_0x28d742[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x4a0168,null))['then'](function(_0x18a653){if(_0x18a653){return _0x18a653[_0x99f8('0x99')](_0x28d742['query'][_0x99f8('0x79')])[_0x99f8('0x24')](function(){if(_[_0x99f8('0x9c')](_0x28d742[_0x99f8('0x47')]['ids'])){for(var _0x3cdfc6=0x0;_0x3cdfc6<_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')][_0x99f8('0x4c')];_0x3cdfc6+=0x1){socket[_0x99f8('0x9b')](_0x99f8('0x9d'),{'UserId':Number(_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')][_0x3cdfc6]),'ChatQueueId':Number(_0x28d742[_0x99f8('0x5e')]['id'])});}}else{socket['emit'](_0x99f8('0x9d'),{'UserId':Number(_0x28d742[_0x99f8('0x47')][_0x99f8('0x79')]),'ChatQueueId':Number(_0x28d742['params']['id'])});}});}})[_0x99f8('0x24')](respondWithStatusCode(_0x4a0168,null))[_0x99f8('0x2c')](handleError(_0x4a0168,null));};exports['getAgents']=function(_0x1a1545,_0x1ef102,_0x362843){var _0x1e3ecb={};var _0x34e71a={};var _0x5b1a66;var _0x47c535;return db[_0x99f8('0x42')]['findOne']({'where':{'id':_0x1a1545[_0x99f8('0x5e')]['id']}})[_0x99f8('0x24')](handleEntityNotFound(_0x1ef102,null))['then'](function(_0x6e46bb){if(_0x6e46bb){_0x5b1a66=_0x6e46bb;_0x34e71a[_0x99f8('0x46')]=_['keys'](db[_0x99f8('0x7a')][_0x99f8('0x43')]);_0x34e71a[_0x99f8('0x47')]=_[_0x99f8('0x48')](_0x1a1545['query']);_0x34e71a[_0x99f8('0x52')]=_[_0x99f8('0x49')](_0x34e71a['model'],_0x34e71a[_0x99f8('0x47')]);_0x1e3ecb[_0x99f8('0x4b')]=_[_0x99f8('0x49')](_0x34e71a[_0x99f8('0x46')],qs[_0x99f8('0x4a')](_0x1a1545['query'][_0x99f8('0x4a')]));_0x1e3ecb['attributes']=_0x1e3ecb[_0x99f8('0x4b')]['length']?_0x1e3ecb[_0x99f8('0x4b')]:_0x34e71a['model'];_0x1e3ecb[_0x99f8('0x4f')]=qs[_0x99f8('0x50')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x50')]);_0x1e3ecb[_0x99f8('0x51')]=qs[_0x99f8('0x52')](_[_0x99f8('0x53')](_0x1a1545[_0x99f8('0x47')],_0x34e71a['filters']));if(_0x1a1545['query']['filter']){_0x1e3ecb[_0x99f8('0x51')]=_[_0x99f8('0x55')](_0x1e3ecb[_0x99f8('0x51')],{'$or':_['map'](_0x1e3ecb[_0x99f8('0x4b')],function(_0x3eef27){var _0x2076a5={};_0x2076a5[_0x3eef27]={'$like':'%'+_0x1a1545[_0x99f8('0x47')][_0x99f8('0x54')]+'%'};return _0x2076a5;})});}_0x1e3ecb=_[_0x99f8('0x55')]({},_0x1e3ecb,_0x1a1545[_0x99f8('0x58')]);return _0x5b1a66[_0x99f8('0x9e')](_0x1e3ecb);}})[_0x99f8('0x24')](function(_0x10fd09){if(_0x10fd09){_0x47c535=_0x10fd09[_0x99f8('0x4c')];if(!_0x1a1545[_0x99f8('0x47')][_0x99f8('0x4d')]('nolimit')){_0x1e3ecb['limit']=qs[_0x99f8('0x33')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x33')]);_0x1e3ecb[_0x99f8('0x30')]=qs[_0x99f8('0x30')](_0x1a1545[_0x99f8('0x47')][_0x99f8('0x30')]);}return _0x5b1a66[_0x99f8('0x9e')](_0x1e3ecb);}})[_0x99f8('0x24')](function(_0x17e37d){if(_0x17e37d){return _0x17e37d?{'count':_0x47c535,'rows':_0x17e37d}:null;}})['then'](respondWithResult(_0x1ef102,null))[_0x99f8('0x2c')](handleError(_0x1ef102,null));}; \ No newline at end of file +var _0x1648=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','format','%s/%s','SIP','chatPause','createdAt','getTeams','Team','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','userChatQueue:save','removeTeams','field','tq.TeamId','team_has_chat_queues','join'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x1648,0x1e9));var _0x8164=function(_0x17dc14,_0x474bdf){_0x17dc14=_0x17dc14-0x0;var _0x551bc2=_0x1648[_0x17dc14];return _0x551bc2;};'use strict';var emlformat=require(_0x8164('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8164('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8164('0x2'));var moment=require(_0x8164('0x3'));var BPromise=require(_0x8164('0x4'));var Mustache=require('mustache');var util=require(_0x8164('0x5'));var path=require(_0x8164('0x6'));var sox=require(_0x8164('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8164('0x8'));var _=require(_0x8164('0x9'));var squel=require(_0x8164('0xa'));var crypto=require('crypto');var jsforce=require(_0x8164('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8164('0xc'));var querystring=require(_0x8164('0xd'));var Papa=require(_0x8164('0xe'));var Redis=require(_0x8164('0xf'));var authService=require(_0x8164('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8164('0x11'));var hardwareService=require(_0x8164('0x12'));var logger=require(_0x8164('0x13'))('api');var utils=require(_0x8164('0x14'));var config=require(_0x8164('0x15'));var licenseUtil=require(_0x8164('0x16'));var db=require(_0x8164('0x17'))['db'];config[_0x8164('0x18')]=_[_0x8164('0x19')](config[_0x8164('0x18')],{'host':_0x8164('0x1a'),'port':0x18eb});var socket=require(_0x8164('0x1b'))(new Redis(config[_0x8164('0x18')]));require(_0x8164('0x1c'))[_0x8164('0x1d')](socket);var jayson=require(_0x8164('0x1e'));var client=jayson['client'][_0x8164('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x20ad07,_0x598262,_0x3835c7,_0x11a97b){return new BPromise(function(_0x49d3e0,_0x4e8aca){var _0x244a34=_0x11a97b||client;return _0x244a34['request'](_0x20ad07,_0x3835c7)['then'](function(_0x235dcd){logger[_0x8164('0x20')](_0x8164('0x21'),_0x598262,_0x8164('0x22'));logger[_0x8164('0x23')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x598262,'request\x20sent',JSON[_0x8164('0x24')](_0x235dcd));if(_0x235dcd[_0x8164('0x25')]){if(_0x235dcd[_0x8164('0x25')][_0x8164('0x26')]===0x1f4){logger[_0x8164('0x25')]('ChatQueue,\x20%s,\x20%s',_0x598262,_0x235dcd[_0x8164('0x25')][_0x8164('0x27')]);return _0x4e8aca(_0x235dcd[_0x8164('0x25')][_0x8164('0x27')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x598262,_0x235dcd[_0x8164('0x25')][_0x8164('0x27')]);return _0x49d3e0(_0x235dcd[_0x8164('0x25')][_0x8164('0x27')]);}else{logger[_0x8164('0x20')](_0x8164('0x21'),_0x598262,'request\x20sent');_0x49d3e0(_0x235dcd[_0x8164('0x28')][_0x8164('0x27')]);}})[_0x8164('0x29')](function(_0x34ca56){logger['error'](_0x8164('0x21'),_0x598262,_0x34ca56);_0x4e8aca(_0x34ca56);});});}function respondWithStatusCode(_0x51f3ff,_0x3471df){_0x3471df=_0x3471df||0xcc;return function(_0x18b709){if(_0x18b709){return _0x51f3ff[_0x8164('0x2a')](_0x3471df);}return _0x51f3ff[_0x8164('0x2b')](_0x3471df)[_0x8164('0x2c')]();};}function respondWithResult(_0x2b5aff,_0x52a2d9){_0x52a2d9=_0x52a2d9||0xc8;return function(_0x28e94d){if(_0x28e94d){return _0x2b5aff['status'](_0x52a2d9)[_0x8164('0x2d')](_0x28e94d);}};}function respondWithFilteredResult(_0x3bc989,_0x1ce94a){return function(_0xb7689b){if(_0xb7689b){var _0x467a11=typeof _0x1ce94a[_0x8164('0x2e')]===_0x8164('0x2f')&&typeof _0x1ce94a['limit']===_0x8164('0x2f');var _0x5c075b=_0xb7689b['count'];var _0x167ba6=_0x467a11?0x0:_0x1ce94a[_0x8164('0x2e')];var _0x40adea=_0x467a11?_0xb7689b[_0x8164('0x30')]:_0x1ce94a['offset']+_0x1ce94a[_0x8164('0x31')];var _0x249988;if(_0x40adea>=_0x5c075b){_0x40adea=_0x5c075b;_0x249988=0xc8;}else{_0x249988=0xce;}_0x3bc989[_0x8164('0x2b')](_0x249988);return _0x3bc989[_0x8164('0x32')](_0x8164('0x33'),_0x167ba6+'-'+_0x40adea+'/'+_0x5c075b)[_0x8164('0x2d')](_0xb7689b);}return null;};}function patchUpdates(_0x1c996c){return function(_0x2d6257){try{jsonpatch[_0x8164('0x34')](_0x2d6257,_0x1c996c,!![]);}catch(_0xe18bdd){return BPromise['reject'](_0xe18bdd);}return _0x2d6257[_0x8164('0x35')]();};}function saveUpdates(_0x38a864,_0x382f3d){return function(_0x3a026b){if(_0x3a026b){return _0x3a026b[_0x8164('0x36')](_0x38a864)[_0x8164('0x37')](function(_0x3676f8){return _0x3676f8;});}return null;};}function removeEntity(_0x480ea3,_0x1b343e){return function(_0xc3cddc){if(_0xc3cddc){return _0xc3cddc[_0x8164('0x38')]()[_0x8164('0x37')](function(){var _0x250e38=_0xc3cddc[_0x8164('0x39')]({'plain':!![]});var _0x4a9f9f=_0x8164('0x3a');return db[_0x8164('0x3b')][_0x8164('0x38')]({'where':{'type':_0x4a9f9f,'resourceId':_0x250e38['id']}})[_0x8164('0x37')](function(){return _0xc3cddc;});})[_0x8164('0x37')](function(){_0x480ea3[_0x8164('0x2b')](0xcc)[_0x8164('0x2c')]();});}};}function handleEntityNotFound(_0x11d8ea,_0x1102a7){return function(_0x407041){if(!_0x407041){_0x11d8ea[_0x8164('0x2a')](0x194);}return _0x407041;};}function handleError(_0x1daf94,_0x2a25ac){_0x2a25ac=_0x2a25ac||0x1f4;return function(_0x4b782d){logger['error'](_0x4b782d[_0x8164('0x3c')]);if(_0x4b782d['name']){delete _0x4b782d[_0x8164('0x3d')];}_0x1daf94['status'](_0x2a25ac)[_0x8164('0x3e')](_0x4b782d);};}exports[_0x8164('0x3f')]=function(_0x21928f,_0x34ba8b){var _0x4f01e7={},_0x69fc9b={},_0xdd6c4d={'count':0x0,'rows':[]};var _0x3c21e3=_[_0x8164('0x40')](db[_0x8164('0x41')][_0x8164('0x42')],function(_0x2b5a26){return{'name':_0x2b5a26[_0x8164('0x43')],'type':_0x2b5a26['type']['key']};});_0x69fc9b[_0x8164('0x44')]=_[_0x8164('0x40')](_0x3c21e3,_0x8164('0x3d'));_0x69fc9b['query']=_[_0x8164('0x45')](_0x21928f[_0x8164('0x46')]);_0x69fc9b[_0x8164('0x47')]=_['intersection'](_0x69fc9b[_0x8164('0x44')],_0x69fc9b[_0x8164('0x46')]);_0x4f01e7['attributes']=_[_0x8164('0x48')](_0x69fc9b[_0x8164('0x44')],qs['fields'](_0x21928f[_0x8164('0x46')][_0x8164('0x49')]));_0x4f01e7['attributes']=_0x4f01e7[_0x8164('0x4a')][_0x8164('0x4b')]?_0x4f01e7[_0x8164('0x4a')]:_0x69fc9b[_0x8164('0x44')];if(!_0x21928f[_0x8164('0x46')][_0x8164('0x4c')](_0x8164('0x4d'))){_0x4f01e7[_0x8164('0x31')]=qs[_0x8164('0x31')](_0x21928f[_0x8164('0x46')][_0x8164('0x31')]);_0x4f01e7[_0x8164('0x2e')]=qs[_0x8164('0x2e')](_0x21928f[_0x8164('0x46')][_0x8164('0x2e')]);}_0x4f01e7[_0x8164('0x4e')]=qs[_0x8164('0x4f')](_0x21928f[_0x8164('0x46')][_0x8164('0x4f')]);_0x4f01e7['where']=qs[_0x8164('0x47')](_[_0x8164('0x50')](_0x21928f[_0x8164('0x46')],_0x69fc9b[_0x8164('0x47')]),_0x3c21e3);if(_0x21928f['query']['filter']){_0x4f01e7[_0x8164('0x51')]=_[_0x8164('0x52')](_0x4f01e7[_0x8164('0x51')],{'$or':_[_0x8164('0x40')](_0x3c21e3,function(_0x2d0dd6){if(_0x2d0dd6[_0x8164('0x53')]!==_0x8164('0x54')){var _0x2f9c59={};_0x2f9c59[_0x2d0dd6[_0x8164('0x3d')]]={'$like':'%'+_0x21928f[_0x8164('0x46')][_0x8164('0x55')]+'%'};return _0x2f9c59;}})});}_0x4f01e7=_[_0x8164('0x52')]({},_0x4f01e7,_0x21928f[_0x8164('0x56')]);var _0x5ae23f={'where':_0x4f01e7[_0x8164('0x51')]};return db[_0x8164('0x41')][_0x8164('0x30')](_0x5ae23f)[_0x8164('0x37')](function(_0x2879a6){_0xdd6c4d[_0x8164('0x30')]=_0x2879a6;if(_0x21928f['query'][_0x8164('0x57')]){_0x4f01e7['include']=[{'all':!![]}];}return db['ChatQueue'][_0x8164('0x58')](_0x4f01e7);})[_0x8164('0x37')](function(_0x148134){_0xdd6c4d[_0x8164('0x59')]=_0x148134;return _0xdd6c4d;})[_0x8164('0x37')](respondWithFilteredResult(_0x34ba8b,_0x4f01e7))[_0x8164('0x29')](handleError(_0x34ba8b,null));};exports[_0x8164('0x5a')]=function(_0x1c56b1,_0x23697f){var _0x5c91a7={'raw':!![],'where':{'id':_0x1c56b1[_0x8164('0x5b')]['id']}},_0x17efb2={};_0x17efb2[_0x8164('0x44')]=_[_0x8164('0x45')](db[_0x8164('0x41')][_0x8164('0x42')]);_0x17efb2[_0x8164('0x46')]=_[_0x8164('0x45')](_0x1c56b1[_0x8164('0x46')]);_0x17efb2['filters']=_['intersection'](_0x17efb2[_0x8164('0x44')],_0x17efb2['query']);_0x5c91a7[_0x8164('0x4a')]=_[_0x8164('0x48')](_0x17efb2[_0x8164('0x44')],qs[_0x8164('0x49')](_0x1c56b1['query'][_0x8164('0x49')]));_0x5c91a7[_0x8164('0x4a')]=_0x5c91a7[_0x8164('0x4a')][_0x8164('0x4b')]?_0x5c91a7[_0x8164('0x4a')]:_0x17efb2[_0x8164('0x44')];if(_0x1c56b1[_0x8164('0x46')]['includeAll']){_0x5c91a7[_0x8164('0x5c')]=[{'all':!![]}];}_0x5c91a7=_[_0x8164('0x52')]({},_0x5c91a7,_0x1c56b1[_0x8164('0x56')]);return db[_0x8164('0x41')][_0x8164('0x5d')](_0x5c91a7)[_0x8164('0x37')](handleEntityNotFound(_0x23697f,null))['then'](respondWithResult(_0x23697f,null))[_0x8164('0x29')](handleError(_0x23697f,null));};exports[_0x8164('0x5e')]=function(_0x371073,_0x554c54){return db[_0x8164('0x41')][_0x8164('0x5e')](_0x371073[_0x8164('0x5f')],{})[_0x8164('0x37')](function(_0xc0b5ff){var _0x40676a=_0x371073[_0x8164('0x60')][_0x8164('0x39')]({'plain':!![]});if(!_0x40676a)throw new Error(_0x8164('0x61'));if(_0x40676a[_0x8164('0x62')]==='user'){var _0x561395=_0xc0b5ff[_0x8164('0x39')]({'plain':!![]});var _0x1a8c4c=_0x8164('0x3a');return db[_0x8164('0x63')][_0x8164('0x5d')]({'where':{'name':_0x1a8c4c,'userProfileId':_0x40676a[_0x8164('0x64')]},'raw':!![]})[_0x8164('0x37')](function(_0x4f33e4){if(_0x4f33e4&&_0x4f33e4[_0x8164('0x65')]===0x0){return db['UserProfileResource'][_0x8164('0x5e')]({'name':_0x561395['name'],'resourceId':_0x561395['id'],'type':_0x4f33e4[_0x8164('0x3d')],'sectionId':_0x4f33e4['id']},{})[_0x8164('0x37')](function(){return _0xc0b5ff;});}else{return _0xc0b5ff;}})[_0x8164('0x29')](function(_0x43505e){logger[_0x8164('0x25')](_0x8164('0x66'),_0x43505e);throw _0x43505e;});}return _0xc0b5ff;})[_0x8164('0x37')](respondWithResult(_0x554c54,0xc9))[_0x8164('0x29')](handleError(_0x554c54,null));};exports[_0x8164('0x36')]=function(_0x47230f,_0x116d28){if(_0x47230f[_0x8164('0x5f')]['id']){delete _0x47230f[_0x8164('0x5f')]['id'];}return db[_0x8164('0x41')][_0x8164('0x5d')]({'where':{'id':_0x47230f[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](handleEntityNotFound(_0x116d28,null))['then'](saveUpdates(_0x47230f['body'],null))['then'](respondWithResult(_0x116d28,null))[_0x8164('0x29')](handleError(_0x116d28,null));};exports['destroy']=function(_0x468c28,_0x586139){return db[_0x8164('0x41')]['find']({'where':{'id':_0x468c28[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](handleEntityNotFound(_0x586139,null))[_0x8164('0x37')](removeEntity(_0x586139,null))['catch'](handleError(_0x586139,null));};exports[_0x8164('0x67')]=function(_0x57a82f,_0x5b424d){return db[_0x8164('0x41')][_0x8164('0x67')]()['then'](respondWithResult(_0x5b424d,null))['catch'](handleError(_0x5b424d,null));};exports[_0x8164('0x68')]=function(_0x3509b8,_0x400158,_0x5b227e){var _0x37adc3={'raw':!![],'where':{}},_0x3418c9={},_0x328060;return db[_0x8164('0x41')][_0x8164('0x69')]({'where':{'id':_0x3509b8[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](handleEntityNotFound(_0x400158,null))[_0x8164('0x37')](function(_0x35daa8){if(_0x35daa8){_0x328060=_0x35daa8['get']({'plain':!![]});_0x3418c9[_0x8164('0x44')]=_[_0x8164('0x45')](db['UserChatQueue'][_0x8164('0x42')]);_0x3418c9['query']=_[_0x8164('0x45')](_0x3509b8[_0x8164('0x46')]);_0x3418c9['filters']=_[_0x8164('0x48')](_0x3418c9[_0x8164('0x44')],_0x3418c9[_0x8164('0x46')]);_0x37adc3[_0x8164('0x4a')]=_[_0x8164('0x48')](_0x3418c9[_0x8164('0x44')],qs[_0x8164('0x49')](_0x3509b8[_0x8164('0x46')][_0x8164('0x49')]));_0x37adc3[_0x8164('0x4a')]=_0x37adc3[_0x8164('0x4a')][_0x8164('0x4b')]?_0x37adc3[_0x8164('0x4a')]:_0x3418c9['model'];if(!_0x3509b8[_0x8164('0x46')]['hasOwnProperty'](_0x8164('0x4d'))){_0x37adc3[_0x8164('0x31')]=qs[_0x8164('0x31')](_0x3509b8['query']['limit']);_0x37adc3[_0x8164('0x2e')]=qs['offset'](_0x3509b8[_0x8164('0x46')][_0x8164('0x2e')]);}_0x37adc3[_0x8164('0x4e')]=qs[_0x8164('0x4f')](_0x3509b8['query'][_0x8164('0x4f')]);_0x37adc3[_0x8164('0x51')]=qs[_0x8164('0x47')](_[_0x8164('0x50')](_0x3509b8[_0x8164('0x46')],_0x3418c9[_0x8164('0x47')]));_0x37adc3[_0x8164('0x51')][_0x8164('0x6a')]=_0x35daa8['id'];if(_0x3509b8[_0x8164('0x46')][_0x8164('0x55')]){_0x37adc3[_0x8164('0x51')]=_[_0x8164('0x52')](_0x37adc3[_0x8164('0x51')],{'$or':_[_0x8164('0x40')](_0x37adc3[_0x8164('0x4a')],function(_0x1cf1ed){var _0x366b43={};_0x366b43[_0x1cf1ed]={'$like':'%'+_0x3509b8[_0x8164('0x46')][_0x8164('0x55')]+'%'};return _0x366b43;})});}_0x37adc3=_[_0x8164('0x52')]({},_0x37adc3,_0x3509b8['options']);return db[_0x8164('0x6b')]['findAll'](_0x37adc3);}})[_0x8164('0x37')](function(_0x3d91e3){if(_0x3d91e3){return db[_0x8164('0x6c')][_0x8164('0x6d')]({'where':{'id':_[_0x8164('0x40')](_0x3d91e3,_0x8164('0x6e')),'role':_0x8164('0x6f')},'attributes':['id',_0x8164('0x3d'),'chatPause','updatedAt','createdAt']});}})[_0x8164('0x37')](function(_0x543487){if(_0x543487){return{'count':_0x543487[_0x8164('0x30')],'rows':_['map'](_0x543487['rows'],function(_0x5c750f){return{'membername':_0x5c750f[_0x8164('0x3d')],'UserId':_0x5c750f['id'],'queue_name':_0x328060[_0x8164('0x3d')],'ChatQueueId':_0x328060['id'],'interface':util[_0x8164('0x70')](_0x8164('0x71'),_0x8164('0x72'),_0x5c750f[_0x8164('0x3d')]),'penalty':0x0,'paused':_0x5c750f[_0x8164('0x73')],'createdAt':_0x5c750f[_0x8164('0x74')],'updatedAt':_0x5c750f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8164('0x37')](respondWithFilteredResult(_0x400158,_0x37adc3))[_0x8164('0x29')](handleError(_0x400158,null));};exports[_0x8164('0x75')]=function(_0x6cc197,_0x2859fc,_0x1a1652){var _0x4a7d60={};var _0xd14f61={};var _0x57fc04;var _0x3ed6ab;return db[_0x8164('0x41')][_0x8164('0x69')]({'where':{'id':_0x6cc197[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](handleEntityNotFound(_0x2859fc,null))[_0x8164('0x37')](function(_0x465c77){if(_0x465c77){_0x57fc04=_0x465c77;_0xd14f61[_0x8164('0x44')]=_['keys'](db[_0x8164('0x76')][_0x8164('0x42')]);_0xd14f61[_0x8164('0x46')]=_[_0x8164('0x45')](_0x6cc197[_0x8164('0x46')]);_0xd14f61[_0x8164('0x47')]=_[_0x8164('0x48')](_0xd14f61[_0x8164('0x44')],_0xd14f61[_0x8164('0x46')]);_0x4a7d60['attributes']=_[_0x8164('0x48')](_0xd14f61[_0x8164('0x44')],qs[_0x8164('0x49')](_0x6cc197[_0x8164('0x46')]['fields']));_0x4a7d60[_0x8164('0x4a')]=_0x4a7d60['attributes'][_0x8164('0x4b')]?_0x4a7d60[_0x8164('0x4a')]:_0xd14f61[_0x8164('0x44')];_0x4a7d60['order']=qs['sort'](_0x6cc197['query'][_0x8164('0x4f')]);_0x4a7d60[_0x8164('0x51')]=qs[_0x8164('0x47')](_['pick'](_0x6cc197['query'],_0xd14f61[_0x8164('0x47')]));if(_0x6cc197[_0x8164('0x46')]['filter']){_0x4a7d60['where']=_[_0x8164('0x52')](_0x4a7d60[_0x8164('0x51')],{'$or':_[_0x8164('0x40')](_0x4a7d60[_0x8164('0x4a')],function(_0x583b6f){var _0x186417={};_0x186417[_0x583b6f]={'$like':'%'+_0x6cc197[_0x8164('0x46')][_0x8164('0x55')]+'%'};return _0x186417;})});}_0x4a7d60=_['merge']({},_0x4a7d60,_0x6cc197[_0x8164('0x56')]);return _0x57fc04[_0x8164('0x75')](_0x4a7d60);}})[_0x8164('0x37')](function(_0x4fb728){if(_0x4fb728){_0x3ed6ab=_0x4fb728[_0x8164('0x4b')];if(!_0x6cc197[_0x8164('0x46')][_0x8164('0x4c')](_0x8164('0x4d'))){_0x4a7d60[_0x8164('0x31')]=qs[_0x8164('0x31')](_0x6cc197[_0x8164('0x46')][_0x8164('0x31')]);_0x4a7d60[_0x8164('0x2e')]=qs[_0x8164('0x2e')](_0x6cc197[_0x8164('0x46')][_0x8164('0x2e')]);}return _0x57fc04[_0x8164('0x75')](_0x4a7d60);}})[_0x8164('0x37')](function(_0x59db03){if(_0x59db03){return _0x59db03?{'count':_0x3ed6ab,'rows':_0x59db03}:null;}})['then'](respondWithResult(_0x2859fc,null))[_0x8164('0x29')](handleError(_0x2859fc,null));};exports['addTeams']=function(_0x5ce07e,_0x3aebfc,_0x404395){var _0x253708=_0x5ce07e[_0x8164('0x5f')][_0x8164('0x77')];return db[_0x8164('0x76')][_0x8164('0x58')]({'where':{'id':_0x253708},'attributes':['id'],'include':[{'model':db[_0x8164('0x6c')],'as':_0x8164('0x78'),'attributes':['id',_0x8164('0x3d'),'online',_0x8164('0x79'),_0x8164('0x7a')],'raw':!![]}]})[_0x8164('0x37')](function(_0x4f0b2c){if(_0x4f0b2c){var _0x59270d=_[_0x8164('0x7b')](_0x4f0b2c,function(_0x6117ac){var _0x19d0e5=_0x6117ac[_0x8164('0x39')]({'plain':!![]});return _0x19d0e5[_0x8164('0x78')];});return db['ChatQueue'][_0x8164('0x5d')]({'where':{'id':_0x5ce07e[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](function(_0x89f01a){return db[_0x8164('0x7c')][_0x8164('0x7d')](function(_0x12ddee){return _0x89f01a[_0x8164('0x7e')](_0x253708,{'transaction':_0x12ddee})[_0x8164('0x37')](function(){return BPromise[_0x8164('0x7f')](_0x59270d,function(_0x2d4922){return db[_0x8164('0x6b')]['findOrCreate']({'where':{'UserId':_0x2d4922['id'],'ChatQueueId':_0x5ce07e[_0x8164('0x5b')]['id']},'transaction':_0x12ddee});});})[_0x8164('0x37')](function(){_0x59270d[_0x8164('0x80')](function(_0x389ec0){socket['emit'](_0x8164('0x81'),{'UserId':_0x389ec0['id'],'ChatQueueId':_0x89f01a['id']});});});});});}})[_0x8164('0x37')](respondWithStatusCode(_0x3aebfc,null))['catch'](handleError(_0x3aebfc,null));};exports[_0x8164('0x82')]=function(_0x44c7c3,_0x3bff2c,_0x47d586){return db[_0x8164('0x76')][_0x8164('0x58')]({'where':{'id':_0x44c7c3[_0x8164('0x46')][_0x8164('0x77')]},'attributes':['id'],'include':[{'model':db[_0x8164('0x6c')],'as':_0x8164('0x78'),'attributes':['id'],'raw':!![]}]})[_0x8164('0x37')](handleEntityNotFound(_0x3bff2c,null))[_0x8164('0x37')](function(_0x466b1e){var _0x284a76=_[_0x8164('0x40')](_0x466b1e,'id');var _0x1e3f4e=[];var _0x46ee79=[];var _0x3b9d13=squel['select']();_0x3b9d13[_0x8164('0x83')](_0x8164('0x84'))['from'](_0x8164('0x85'),'tq')[_0x8164('0x86')](_0x8164('0x87'),'ut',_0x8164('0x88'))['where'](_0x8164('0x89'),_0x44c7c3[_0x8164('0x5b')]['id']);for(var _0x50f6f1=0x0;_0x50f6f1<_0x466b1e[_0x8164('0x4b')];_0x50f6f1+=0x1){let _0x10a140=_0x466b1e[_0x50f6f1];for(var _0x2f5ec5=0x0;_0x2f5ec5<_0x10a140[_0x8164('0x78')][_0x8164('0x4b')];_0x2f5ec5+=0x1){let _0x5bb72b=_0x10a140['Agents'][_0x2f5ec5];var _0x32bb18=_0x3b9d13[_0x8164('0x8a')]();_0x32bb18[_0x8164('0x51')](_0x8164('0x8b'),_0x5bb72b['id']);_0x46ee79[_0x8164('0x8c')](db[_0x8164('0x7c')][_0x8164('0x46')](_0x32bb18[_0x8164('0x8d')](),{'type':db[_0x8164('0x7c')][_0x8164('0x8e')]['SELECT']})[_0x8164('0x37')](function(_0x5a3e99){if(_0x5a3e99[_0x8164('0x4b')]===0x1){return _0x5bb72b['id'];}else{var _0x41c98c=_[_0x8164('0x8f')](_['map'](_0x5a3e99,'TeamId'),function(_0x5eb802){return _[_0x8164('0x90')](_0x284a76,_0x5eb802);});if(_0x41c98c){return _0x5bb72b['id'];}}}));}}return BPromise['all'](_0x46ee79)['then'](function(_0x1e66c4){_0x1e3f4e=_(_0x1e3f4e)[_0x8164('0x91')](_0x1e66c4)['compact']()[_0x8164('0x92')]();return db['ChatQueue'][_0x8164('0x5d')]({'where':{'id':_0x44c7c3['params']['id']}})[_0x8164('0x37')](function(_0xa77315){return db[_0x8164('0x7c')][_0x8164('0x7d')](function(_0x4d695c){return _0xa77315['removeTeams'](_0x44c7c3[_0x8164('0x46')][_0x8164('0x77')],{'transaction':_0x4d695c})[_0x8164('0x37')](function(){if(!_[_0x8164('0x93')](_0x1e3f4e)){return _0xa77315[_0x8164('0x94')](_0x1e3f4e,{'transaction':_0x4d695c});}})[_0x8164('0x37')](function(){_0x1e3f4e[_0x8164('0x80')](function(_0x3f246b){socket['emit'](_0x8164('0x95'),{'UserId':_0x3f246b,'ChatQueueId':_0xa77315['id']});});});});});});})[_0x8164('0x37')](respondWithStatusCode(_0x3bff2c,null))['catch'](handleError(_0x3bff2c,null));};exports[_0x8164('0x96')]=function(_0x107be0,_0x2ba591,_0x1ef4f0){return db['ChatQueue'][_0x8164('0x5d')]({'where':{'id':_0x107be0['params']['id']}})[_0x8164('0x37')](handleEntityNotFound(_0x2ba591,null))[_0x8164('0x37')](function(_0x2e0145){if(_0x2e0145){return _0x2e0145[_0x8164('0x96')](_0x107be0[_0x8164('0x5f')][_0x8164('0x77')],_[_0x8164('0x97')](_0x107be0['body'],['ids','id'])||{})[_0x8164('0x98')](function(_0x32c375){for(var _0x515233=0x0;_0x515233<_0x107be0[_0x8164('0x5f')][_0x8164('0x77')][_0x8164('0x4b')];_0x515233+=0x1){socket[_0x8164('0x99')](_0x8164('0x81'),{'UserId':Number(_0x107be0[_0x8164('0x5f')][_0x8164('0x77')][_0x515233]),'ChatQueueId':Number(_0x107be0[_0x8164('0x5b')]['id'])});}return _0x32c375;});}})[_0x8164('0x37')](respondWithResult(_0x2ba591,null))[_0x8164('0x29')](handleError(_0x2ba591,null));};exports['removeAgents']=function(_0xa49e1e,_0x3e860c,_0x20a140){return db['ChatQueue'][_0x8164('0x5d')]({'where':{'id':_0xa49e1e[_0x8164('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3e860c,null))['then'](function(_0x4d536a){if(_0x4d536a){return _0x4d536a[_0x8164('0x94')](_0xa49e1e[_0x8164('0x46')][_0x8164('0x77')])[_0x8164('0x37')](function(){if(_[_0x8164('0x9a')](_0xa49e1e[_0x8164('0x46')]['ids'])){for(var _0x256c23=0x0;_0x256c23<_0xa49e1e[_0x8164('0x46')][_0x8164('0x77')][_0x8164('0x4b')];_0x256c23+=0x1){socket[_0x8164('0x99')](_0x8164('0x95'),{'UserId':Number(_0xa49e1e[_0x8164('0x46')][_0x8164('0x77')][_0x256c23]),'ChatQueueId':Number(_0xa49e1e[_0x8164('0x5b')]['id'])});}}else{socket[_0x8164('0x99')]('userChatQueue:remove',{'UserId':Number(_0xa49e1e[_0x8164('0x46')][_0x8164('0x77')]),'ChatQueueId':Number(_0xa49e1e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3e860c,null))[_0x8164('0x29')](handleError(_0x3e860c,null));};exports[_0x8164('0x9b')]=function(_0x3c5faa,_0xbfadb,_0x4e5527){var _0xfd5e8f={};var _0x51f81b={};var _0x4016b3;var _0x50574a;return db[_0x8164('0x41')][_0x8164('0x69')]({'where':{'id':_0x3c5faa[_0x8164('0x5b')]['id']}})[_0x8164('0x37')](handleEntityNotFound(_0xbfadb,null))[_0x8164('0x37')](function(_0x2b9c7f){if(_0x2b9c7f){_0x4016b3=_0x2b9c7f;_0x51f81b[_0x8164('0x44')]=_['keys'](db[_0x8164('0x6c')][_0x8164('0x42')]);_0x51f81b[_0x8164('0x46')]=_[_0x8164('0x45')](_0x3c5faa[_0x8164('0x46')]);_0x51f81b[_0x8164('0x47')]=_[_0x8164('0x48')](_0x51f81b['model'],_0x51f81b[_0x8164('0x46')]);_0xfd5e8f[_0x8164('0x4a')]=_[_0x8164('0x48')](_0x51f81b['model'],qs[_0x8164('0x49')](_0x3c5faa[_0x8164('0x46')]['fields']));_0xfd5e8f[_0x8164('0x4a')]=_0xfd5e8f[_0x8164('0x4a')][_0x8164('0x4b')]?_0xfd5e8f[_0x8164('0x4a')]:_0x51f81b[_0x8164('0x44')];_0xfd5e8f[_0x8164('0x4e')]=qs[_0x8164('0x4f')](_0x3c5faa['query'][_0x8164('0x4f')]);_0xfd5e8f[_0x8164('0x51')]=qs[_0x8164('0x47')](_[_0x8164('0x50')](_0x3c5faa[_0x8164('0x46')],_0x51f81b['filters']));if(_0x3c5faa[_0x8164('0x46')][_0x8164('0x55')]){_0xfd5e8f['where']=_[_0x8164('0x52')](_0xfd5e8f[_0x8164('0x51')],{'$or':_[_0x8164('0x40')](_0xfd5e8f[_0x8164('0x4a')],function(_0x56b14b){var _0x83a7f1={};_0x83a7f1[_0x56b14b]={'$like':'%'+_0x3c5faa[_0x8164('0x46')][_0x8164('0x55')]+'%'};return _0x83a7f1;})});}_0xfd5e8f=_[_0x8164('0x52')]({},_0xfd5e8f,_0x3c5faa[_0x8164('0x56')]);return _0x4016b3[_0x8164('0x9b')](_0xfd5e8f);}})[_0x8164('0x37')](function(_0x5911ce){if(_0x5911ce){_0x50574a=_0x5911ce[_0x8164('0x4b')];if(!_0x3c5faa[_0x8164('0x46')]['hasOwnProperty'](_0x8164('0x4d'))){_0xfd5e8f['limit']=qs['limit'](_0x3c5faa['query'][_0x8164('0x31')]);_0xfd5e8f[_0x8164('0x2e')]=qs['offset'](_0x3c5faa['query'][_0x8164('0x2e')]);}return _0x4016b3[_0x8164('0x9b')](_0xfd5e8f);}})[_0x8164('0x37')](function(_0x573cbe){if(_0x573cbe){return _0x573cbe?{'count':_0x50574a,'rows':_0x573cbe}:null;}})[_0x8164('0x37')](respondWithResult(_0xbfadb,null))[_0x8164('0x29')](handleError(_0xbfadb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f90c89f..950fd4f 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 _0xc434=['../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x327c57,_0x129c09){var _0x322063=function(_0x2cc1c7){while(--_0x2cc1c7){_0x327c57['push'](_0x327c57['shift']());}};_0x322063(++_0x129c09);}(_0xc434,0x17a));var _0x4c43=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xc434[_0x243b59];return _0x3e1676;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x4c43('0x0'))['db'][_0x4c43('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4c43('0x2')](0x0);var events={'afterCreate':_0x4c43('0x3'),'afterUpdate':_0x4c43('0x4'),'afterDestroy':_0x4c43('0x5')};function emitEvent(_0x7d564a){return function(_0x29f080,_0x221fc0,_0x5d7a56){ChatQueueEvents[_0x4c43('0x6')](_0x7d564a+':'+_0x29f080['id'],_0x29f080);ChatQueueEvents[_0x4c43('0x6')](_0x7d564a,_0x29f080);_0x5d7a56(null);};}for(var e in events){if(events[_0x4c43('0x7')](e)){var event=events[e];ChatQueue[_0x4c43('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0b4d=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0b4d,0x99));var _0xd0b4=function(_0x3c7a48,_0x147ef7){_0x3c7a48=_0x3c7a48-0x0;var _0x487831=_0x0b4d[_0x3c7a48];return _0x487831;};'use strict';var EventEmitter=require(_0xd0b4('0x0'));var ChatQueue=require(_0xd0b4('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd0b4('0x2')](0x0);var events={'afterCreate':_0xd0b4('0x3'),'afterUpdate':'update','afterDestroy':_0xd0b4('0x4')};function emitEvent(_0x760c95){return function(_0x26540e,_0x432c3e,_0x44a44f){ChatQueueEvents[_0xd0b4('0x5')](_0x760c95+':'+_0x26540e['id'],_0x26540e);ChatQueueEvents[_0xd0b4('0x5')](_0x760c95,_0x26540e);_0x44a44f(null);};}for(var e in events){if(events[_0xd0b4('0x6')](e)){var event=events[e];ChatQueue[_0xd0b4('0x7')](e,emitEvent(event));}}module[_0xd0b4('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c78f73d..bc2cac5 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 _0x797a=['path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x797a,0x10f));var _0xa797=function(_0x55fb4a,_0x84c93b){_0x55fb4a=_0x55fb4a-0x0;var _0x564fd5=_0x797a[_0x55fb4a];return _0x564fd5;};'use strict';var _=require('lodash');var util=require(_0xa797('0x0'));var logger=require(_0xa797('0x1'))('api');var moment=require(_0xa797('0x2'));var BPromise=require(_0xa797('0x3'));var rp=require(_0xa797('0x4'));var fs=require('fs');var path=require(_0xa797('0x5'));var rimraf=require(_0xa797('0x6'));var config=require(_0xa797('0x7'));var attributes=require(_0xa797('0x8'));module['exports']=function(_0x3e935e,_0xffd593){return _0x3e935e[_0xa797('0x9')](_0xa797('0xa'),attributes,{'tableName':_0xa797('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe698=['define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x187f71,_0xf40f00){var _0xdf027a=function(_0x127e87){while(--_0x127e87){_0x187f71['push'](_0x187f71['shift']());}};_0xdf027a(++_0xf40f00);}(_0xe698,0xd5));var _0x8e69=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe698[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8e69('0x0'));var util=require(_0x8e69('0x1'));var logger=require(_0x8e69('0x2'))(_0x8e69('0x3'));var moment=require(_0x8e69('0x4'));var BPromise=require(_0x8e69('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e69('0x6'));var rimraf=require(_0x8e69('0x7'));var config=require(_0x8e69('0x8'));var attributes=require(_0x8e69('0x9'));module[_0x8e69('0xa')]=function(_0x1c2adc,_0xfbbb29){return _0x1c2adc[_0x8e69('0xb')](_0x8e69('0xc'),attributes,{'tableName':_0x8e69('0xd'),'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 320437d..0195d47 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 _0xa5fa=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','include','map','model','attributes','catch','ShowChatQueue','find','where','util','moment','bluebird','randomstring'];(function(_0x4dc38c,_0x23daf9){var _0x3d939a=function(_0x348f0f){while(--_0x348f0f){_0x4dc38c['push'](_0x4dc38c['shift']());}};_0x3d939a(++_0x23daf9);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x53a9cb,_0x1d7a73){_0x53a9cb=_0x53a9cb-0x0;var _0x4fc163=_0xa5fa[_0x53a9cb];return _0x4fc163;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./chatQueue.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});}exports[_0xaa5f('0x1b')]=function(_0xc07d99){var _0xc57fd5=this;return new Promise(function(_0x21cd23,_0x194691){return db[_0xaa5f('0x1c')][_0xaa5f('0x1d')]({'raw':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x1f')]===undefined?!![]:![]:!![],'where':_0xc07d99['options']?_0xc07d99[_0xaa5f('0x1e')]['where']||null:null,'attributes':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')]['attributes']||null:null,'limit':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')]['limit']||null:null,'include':_0xc07d99[_0xaa5f('0x1e')]?_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x20')]?_[_0xaa5f('0x21')](_0xc07d99[_0xaa5f('0x1e')][_0xaa5f('0x20')],function(_0x3d7bca){return{'model':db[_0x3d7bca[_0xaa5f('0x22')]],'as':_0x3d7bca['as'],'attributes':_0x3d7bca['attributes'],'include':_0x3d7bca[_0xaa5f('0x20')]?_[_0xaa5f('0x21')](_0x3d7bca[_0xaa5f('0x20')],function(_0x5a7cf1){return{'model':db[_0x5a7cf1[_0xaa5f('0x22')]],'as':_0x5a7cf1['as'],'attributes':_0x5a7cf1[_0xaa5f('0x23')],'include':_0x5a7cf1[_0xaa5f('0x20')]?_['map'](_0x5a7cf1[_0xaa5f('0x20')],function(_0x479f29){return{'model':db[_0x479f29['model']],'as':_0x479f29['as'],'attributes':_0x479f29[_0xaa5f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bffec){logger['info']('GetChatQueue',_0xc07d99);logger['debug'](_0xaa5f('0x1b'),_0xc07d99,JSON['stringify'](_0x1bffec));_0x21cd23(_0x1bffec);})[_0xaa5f('0x24')](function(_0xc0bb03){logger['error']('GetChatQueue',_0xc0bb03[_0xaa5f('0x19')],_0xc07d99);_0x194691(_0xc57fd5['error'](0x1f4,_0xc0bb03[_0xaa5f('0x19')]));});});};exports[_0xaa5f('0x25')]=function(_0x52132c){var _0xda1742=this;return new Promise(function(_0x1610b8,_0x9c733b){return db['ChatQueue'][_0xaa5f('0x26')]({'raw':_0x52132c[_0xaa5f('0x1e')]?_0x52132c['options']['raw']===undefined?!![]:![]:!![],'where':_0x52132c['options']?_0x52132c['options'][_0xaa5f('0x27')]||null:null,'attributes':_0x52132c[_0xaa5f('0x1e')]?_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x23')]||null:null,'include':_0x52132c[_0xaa5f('0x1e')]?_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x20')]?_['map'](_0x52132c[_0xaa5f('0x1e')][_0xaa5f('0x20')],function(_0x440845){return{'model':db[_0x440845[_0xaa5f('0x22')]],'as':_0x440845['as'],'attributes':_0x440845[_0xaa5f('0x23')],'include':_0x440845[_0xaa5f('0x20')]?_['map'](_0x440845[_0xaa5f('0x20')],function(_0x3131c2){return{'model':db[_0x3131c2[_0xaa5f('0x22')]],'as':_0x3131c2['as'],'attributes':_0x3131c2[_0xaa5f('0x23')],'include':_0x3131c2[_0xaa5f('0x20')]?_['map'](_0x3131c2['include'],function(_0x43126e){return{'model':db[_0x43126e[_0xaa5f('0x22')]],'as':_0x43126e['as'],'attributes':_0x43126e[_0xaa5f('0x23')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x10')](function(_0x56826c){logger[_0xaa5f('0x11')](_0xaa5f('0x25'),_0x52132c);logger[_0xaa5f('0x14')](_0xaa5f('0x25'),_0x52132c,JSON[_0xaa5f('0x16')](_0x56826c));_0x1610b8(_0x56826c);})[_0xaa5f('0x24')](function(_0xc4735b){logger[_0xaa5f('0x17')](_0xaa5f('0x25'),_0xc4735b[_0xaa5f('0x19')],_0x52132c);_0x9c733b(_0xda1742[_0xaa5f('0x17')](0x1f4,_0xc4735b['message']));});});}; \ No newline at end of file +var _0xbbbc=['model','include','then','debug','catch','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','map'];(function(_0x1ad9b3,_0x1533c6){var _0x45e47c=function(_0x4e997e){while(--_0x4e997e){_0x1ad9b3['push'](_0x1ad9b3['shift']());}};_0x45e47c(++_0x1533c6);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x28da0c,_0x4282ed){_0x28da0c=_0x28da0c-0x0;var _0x3a3aa2=_0xbbbc[_0x28da0c];return _0x3a3aa2;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});config[_0xcbbb('0xc')]=_[_0xcbbb('0xd')](config[_0xcbbb('0xc')],{'host':_0xcbbb('0xe'),'port':0x18eb});var socket=require(_0xcbbb('0xf'))(new Redis(config[_0xcbbb('0xc')]));require(_0xcbbb('0x10'))['register'](socket);function respondWithRpcPromise(_0x225156,_0x4b0138,_0x5893f9){return new BPromise(function(_0x107c35,_0x56c7d0){return client[_0xcbbb('0x11')](_0x225156,_0x5893f9)['then'](function(_0x3766c2){logger[_0xcbbb('0x12')]('ChatQueue,\x20%s,\x20%s',_0x4b0138,_0xcbbb('0x13'));logger['debug'](_0xcbbb('0x14'),_0x4b0138,'request\x20sent',JSON[_0xcbbb('0x15')](_0x3766c2));if(_0x3766c2[_0xcbbb('0x16')]){if(_0x3766c2[_0xcbbb('0x16')]['code']===0x1f4){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x56c7d0(_0x3766c2['error']['message']);}logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x3766c2[_0xcbbb('0x16')][_0xcbbb('0x18')]);return _0x107c35(_0x3766c2['error'][_0xcbbb('0x18')]);}else{logger['info'](_0xcbbb('0x17'),_0x4b0138,_0xcbbb('0x13'));_0x107c35(_0x3766c2[_0xcbbb('0x19')]['message']);}})['catch'](function(_0x4bcd9a){logger[_0xcbbb('0x16')](_0xcbbb('0x17'),_0x4b0138,_0x4bcd9a);_0x56c7d0(_0x4bcd9a);});});}exports[_0xcbbb('0x1a')]=function(_0x25e92f){var _0x658337=this;return new Promise(function(_0x1cca90,_0x45de5f){return db[_0xcbbb('0x1b')][_0xcbbb('0x1c')]({'raw':_0x25e92f[_0xcbbb('0x1d')]?_0x25e92f['options'][_0xcbbb('0x1e')]===undefined?!![]:![]:!![],'where':_0x25e92f[_0xcbbb('0x1d')]?_0x25e92f[_0xcbbb('0x1d')][_0xcbbb('0x1f')]||null:null,'attributes':_0x25e92f[_0xcbbb('0x1d')]?_0x25e92f[_0xcbbb('0x1d')][_0xcbbb('0x20')]||null:null,'limit':_0x25e92f[_0xcbbb('0x1d')]?_0x25e92f[_0xcbbb('0x1d')]['limit']||null:null,'include':_0x25e92f[_0xcbbb('0x1d')]?_0x25e92f[_0xcbbb('0x1d')]['include']?_[_0xcbbb('0x21')](_0x25e92f['options']['include'],function(_0x575d56){return{'model':db[_0x575d56[_0xcbbb('0x22')]],'as':_0x575d56['as'],'attributes':_0x575d56['attributes'],'include':_0x575d56['include']?_['map'](_0x575d56[_0xcbbb('0x23')],function(_0x55e1d8){return{'model':db[_0x55e1d8['model']],'as':_0x55e1d8['as'],'attributes':_0x55e1d8[_0xcbbb('0x20')],'include':_0x55e1d8[_0xcbbb('0x23')]?_[_0xcbbb('0x21')](_0x55e1d8[_0xcbbb('0x23')],function(_0x372024){return{'model':db[_0x372024[_0xcbbb('0x22')]],'as':_0x372024['as'],'attributes':_0x372024[_0xcbbb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcbbb('0x24')](function(_0x2a023f){logger[_0xcbbb('0x12')](_0xcbbb('0x1a'),_0x25e92f);logger[_0xcbbb('0x25')](_0xcbbb('0x1a'),_0x25e92f,JSON[_0xcbbb('0x15')](_0x2a023f));_0x1cca90(_0x2a023f);})[_0xcbbb('0x26')](function(_0xcae72c){logger[_0xcbbb('0x16')](_0xcbbb('0x1a'),_0xcae72c['message'],_0x25e92f);_0x45de5f(_0x658337[_0xcbbb('0x16')](0x1f4,_0xcae72c[_0xcbbb('0x18')]));});});};exports['ShowChatQueue']=function(_0xec2761){var _0x539dcf=this;return new Promise(function(_0x2d37d3,_0x1fb05e){return db[_0xcbbb('0x1b')]['find']({'raw':_0xec2761[_0xcbbb('0x1d')]?_0xec2761[_0xcbbb('0x1d')][_0xcbbb('0x1e')]===undefined?!![]:![]:!![],'where':_0xec2761[_0xcbbb('0x1d')]?_0xec2761[_0xcbbb('0x1d')][_0xcbbb('0x1f')]||null:null,'attributes':_0xec2761[_0xcbbb('0x1d')]?_0xec2761[_0xcbbb('0x1d')][_0xcbbb('0x20')]||null:null,'include':_0xec2761[_0xcbbb('0x1d')]?_0xec2761['options']['include']?_['map'](_0xec2761['options'][_0xcbbb('0x23')],function(_0x5ccc55){return{'model':db[_0x5ccc55[_0xcbbb('0x22')]],'as':_0x5ccc55['as'],'attributes':_0x5ccc55[_0xcbbb('0x20')],'include':_0x5ccc55[_0xcbbb('0x23')]?_[_0xcbbb('0x21')](_0x5ccc55[_0xcbbb('0x23')],function(_0x39a417){return{'model':db[_0x39a417[_0xcbbb('0x22')]],'as':_0x39a417['as'],'attributes':_0x39a417[_0xcbbb('0x20')],'include':_0x39a417[_0xcbbb('0x23')]?_[_0xcbbb('0x21')](_0x39a417['include'],function(_0x5f578f){return{'model':db[_0x5f578f[_0xcbbb('0x22')]],'as':_0x5f578f['as'],'attributes':_0x5f578f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dbd8d){logger[_0xcbbb('0x12')](_0xcbbb('0x27'),_0xec2761);logger[_0xcbbb('0x25')](_0xcbbb('0x27'),_0xec2761,JSON[_0xcbbb('0x15')](_0x5dbd8d));_0x2d37d3(_0x5dbd8d);})[_0xcbbb('0x26')](function(_0x18054f){logger[_0xcbbb('0x16')](_0xcbbb('0x27'),_0x18054f[_0xcbbb('0x18')],_0xec2761);_0x1fb05e(_0x539dcf[_0xcbbb('0x16')](0x1f4,_0x18054f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 72b3b05..e801ccd 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 _0x5089=['length','chatQueue:','./chatQueue.events','save','update','emit','register'];(function(_0x4edde2,_0x59b3fe){var _0x544bde=function(_0x2abef1){while(--_0x2abef1){_0x4edde2['push'](_0x4edde2['shift']());}};_0x544bde(++_0x59b3fe);}(_0x5089,0x1bb));var _0x9508=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0x5089[_0xbf1875];return _0x2e598b;};'use strict';var ChatQueueEvents=require(_0x9508('0x0'));var events=[_0x9508('0x1'),'remove',_0x9508('0x2')];function createListener(_0x35878a,_0x7dd13d){return function(_0x100d7e){_0x7dd13d[_0x9508('0x3')](_0x35878a,_0x100d7e);};}function removeListener(_0x59d3ee,_0x86540d){return function(){ChatQueueEvents['removeListener'](_0x59d3ee,_0x86540d);};}exports[_0x9508('0x4')]=function(_0x4538dd){for(var _0x257318=0x0,_0x4ab3c6=events[_0x9508('0x5')];_0x257318<_0x4ab3c6;_0x257318++){var _0x42d13a=events[_0x257318];var _0x55a5de=createListener(_0x9508('0x6')+_0x42d13a,_0x4538dd);ChatQueueEvents['on'](_0x42d13a,_0x55a5de);}}; \ No newline at end of file +var _0xb7c8=['chatQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x1d2b15,_0x7de0f){var _0x172197=function(_0x213cb1){while(--_0x213cb1){_0x1d2b15['push'](_0x1d2b15['shift']());}};_0x172197(++_0x7de0f);}(_0xb7c8,0x119));var _0x8b7c=function(_0x593dab,_0x166614){_0x593dab=_0x593dab-0x0;var _0x1e0360=_0xb7c8[_0x593dab];return _0x1e0360;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8b7c('0x0'),_0x8b7c('0x1'),_0x8b7c('0x2')];function createListener(_0x3a84fc,_0x1dceff){return function(_0x31ad24){_0x1dceff[_0x8b7c('0x3')](_0x3a84fc,_0x31ad24);};}function removeListener(_0x50113e,_0x38672b){return function(){ChatQueueEvents[_0x8b7c('0x4')](_0x50113e,_0x38672b);};}exports[_0x8b7c('0x5')]=function(_0x440900){for(var _0x107428=0x0,_0x12665c=events[_0x8b7c('0x6')];_0x107428<_0x12665c;_0x107428++){var _0x3c8fd6=events[_0x107428];var _0x6afb55=createListener(_0x8b7c('0x7')+_0x3c8fd6,_0x440900);ChatQueueEvents['on'](_0x3c8fd6,_0x6afb55);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0215a8c..7cec771 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1e4b24,_0x376c4d){var _0x14534f=function(_0x124698){while(--_0x124698){_0x1e4b24['push'](_0x1e4b24['shift']());}};_0x14534f(++_0x376c4d);}(_0x814b,0x1a2));var _0xb814=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x814b[_0x5bd626];return _0x2661ca;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x5fc3[_0x3b16e1];return _0x311d1b;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 062a22b..3f4b14a 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 _0x4082=['moment','sequelize','exports','STRING','DATE'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x4082,0x118));var _0x2408=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x4082[_0x5c4f6b];return _0x104c4e;};'use strict';var moment=require(_0x2408('0x0'));var Sequelize=require(_0x2408('0x1'));module[_0x2408('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2408('0x3')]},'joinAt':{'type':Sequelize[_0x2408('0x4')]},'leaveAt':{'type':Sequelize[_0x2408('0x4')]},'acceptAt':{'type':Sequelize[_0x2408('0x4')]},'exitAt':{'type':Sequelize[_0x2408('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d98=['exports','STRING','DATE','moment','sequelize'];(function(_0x3cc1b2,_0x265d8b){var _0x22987f=function(_0x2403ba){while(--_0x2403ba){_0x3cc1b2['push'](_0x3cc1b2['shift']());}};_0x22987f(++_0x265d8b);}(_0x8d98,0x1a7));var _0x88d9=function(_0x5e57aa,_0x5cf040){_0x5e57aa=_0x5e57aa-0x0;var _0x4c376f=_0x8d98[_0x5e57aa];return _0x4c376f;};'use strict';var moment=require(_0x88d9('0x0'));var Sequelize=require(_0x88d9('0x1'));module[_0x88d9('0x2')]={'uniqueid':{'type':Sequelize[_0x88d9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x88d9('0x4')]},'leaveAt':{'type':Sequelize[_0x88d9('0x4')]},'acceptAt':{'type':Sequelize[_0x88d9('0x4')]},'exitAt':{'type':Sequelize[_0x88d9('0x4')]},'reason':{'type':Sequelize[_0x88d9('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c8f25b3..69af26c 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 _0xf470=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','keys','query'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0xf470,0xfd));var _0x0f47=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xf470[_0x231e16];return _0x570a7c;};'use strict';var emlformat=require(_0x0f47('0x0'));var rimraf=require(_0x0f47('0x1'));var zipdir=require(_0x0f47('0x2'));var jsonpatch=require(_0x0f47('0x3'));var rp=require(_0x0f47('0x4'));var moment=require(_0x0f47('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f47('0x6'));var util=require(_0x0f47('0x7'));var path=require('path');var sox=require(_0x0f47('0x8'));var csv=require(_0x0f47('0x9'));var ejs=require(_0x0f47('0xa'));var fs=require('fs');var fs_extra=require(_0x0f47('0xb'));var _=require(_0x0f47('0xc'));var squel=require(_0x0f47('0xd'));var crypto=require(_0x0f47('0xe'));var jsforce=require(_0x0f47('0xf'));var deskjs=require(_0x0f47('0x10'));var toCsv=require(_0x0f47('0x9'));var querystring=require(_0x0f47('0x11'));var Papa=require(_0x0f47('0x12'));var Redis=require(_0x0f47('0x13'));var authService=require(_0x0f47('0x14'));var qs=require(_0x0f47('0x15'));var as=require(_0x0f47('0x16'));var hardwareService=require(_0x0f47('0x17'));var logger=require(_0x0f47('0x18'))(_0x0f47('0x19'));var utils=require('../../config/utils');var config=require(_0x0f47('0x1a'));var licenseUtil=require(_0x0f47('0x1b'));var db=require(_0x0f47('0x1c'))['db'];function respondWithStatusCode(_0x26095f,_0x128b8c){_0x128b8c=_0x128b8c||0xcc;return function(_0x4ce7e6){if(_0x4ce7e6){return _0x26095f['sendStatus'](_0x128b8c);}return _0x26095f[_0x0f47('0x1d')](_0x128b8c)[_0x0f47('0x1e')]();};}function respondWithResult(_0x42ace5,_0x327f2f){_0x327f2f=_0x327f2f||0xc8;return function(_0x7579d1){if(_0x7579d1){return _0x42ace5['status'](_0x327f2f)[_0x0f47('0x1f')](_0x7579d1);}};}function respondWithFilteredResult(_0x553f66,_0x4e5c11){return function(_0x1e08f6){if(_0x1e08f6){var _0x2c2ba8=typeof _0x4e5c11[_0x0f47('0x20')]===_0x0f47('0x21')&&typeof _0x4e5c11[_0x0f47('0x22')]===_0x0f47('0x21');var _0x25e2e9=_0x1e08f6['count'];var _0x1d8fe5=_0x2c2ba8?0x0:_0x4e5c11[_0x0f47('0x20')];var _0x524868=_0x2c2ba8?_0x1e08f6[_0x0f47('0x23')]:_0x4e5c11[_0x0f47('0x20')]+_0x4e5c11[_0x0f47('0x22')];var _0x87f9da;if(_0x524868>=_0x25e2e9){_0x524868=_0x25e2e9;_0x87f9da=0xc8;}else{_0x87f9da=0xce;}_0x553f66[_0x0f47('0x1d')](_0x87f9da);return _0x553f66[_0x0f47('0x24')](_0x0f47('0x25'),_0x1d8fe5+'-'+_0x524868+'/'+_0x25e2e9)[_0x0f47('0x1f')](_0x1e08f6);}return null;};}function patchUpdates(_0xb34491){return function(_0x40fff8){try{jsonpatch[_0x0f47('0x26')](_0x40fff8,_0xb34491,!![]);}catch(_0x55a0ef){return BPromise['reject'](_0x55a0ef);}return _0x40fff8['save']();};}function saveUpdates(_0x1fe6ea,_0x5a0c8c){return function(_0x5f1830){if(_0x5f1830){return _0x5f1830[_0x0f47('0x27')](_0x1fe6ea)[_0x0f47('0x28')](function(_0x456611){return _0x456611;});}return null;};}function removeEntity(_0x19a68c,_0x28edc5){return function(_0x46c30f){if(_0x46c30f){return _0x46c30f[_0x0f47('0x29')]()['then'](function(){_0x19a68c['status'](0xcc)[_0x0f47('0x1e')]();});}};}function handleEntityNotFound(_0x48c86,_0x3c0ae0){return function(_0x49f2ff){if(!_0x49f2ff){_0x48c86[_0x0f47('0x2a')](0x194);}return _0x49f2ff;};}function handleError(_0x41a31e,_0x3e1fb0){_0x3e1fb0=_0x3e1fb0||0x1f4;return function(_0x17c7cf){logger['error'](_0x17c7cf[_0x0f47('0x2b')]);if(_0x17c7cf[_0x0f47('0x2c')]){delete _0x17c7cf[_0x0f47('0x2c')];}_0x41a31e[_0x0f47('0x1d')](_0x3e1fb0)[_0x0f47('0x2d')](_0x17c7cf);};}exports[_0x0f47('0x2e')]=function(_0x1142cd,_0xd47c98){var _0x2b902e={},_0x2648f1={},_0x8e5d1f={'count':0x0,'rows':[]};var _0x3a3687=_['map'](db[_0x0f47('0x2f')][_0x0f47('0x30')],function(_0xd503e4){return{'name':_0xd503e4[_0x0f47('0x31')],'type':_0xd503e4[_0x0f47('0x32')]['key']};});_0x2648f1[_0x0f47('0x33')]=_[_0x0f47('0x34')](_0x3a3687,_0x0f47('0x2c'));_0x2648f1['query']=_[_0x0f47('0x35')](_0x1142cd[_0x0f47('0x36')]);_0x2648f1[_0x0f47('0x37')]=_[_0x0f47('0x38')](_0x2648f1[_0x0f47('0x33')],_0x2648f1[_0x0f47('0x36')]);_0x2b902e['attributes']=_['intersection'](_0x2648f1['model'],qs[_0x0f47('0x39')](_0x1142cd['query'][_0x0f47('0x39')]));_0x2b902e['attributes']=_0x2b902e[_0x0f47('0x3a')][_0x0f47('0x3b')]?_0x2b902e[_0x0f47('0x3a')]:_0x2648f1[_0x0f47('0x33')];if(!_0x1142cd['query'][_0x0f47('0x3c')](_0x0f47('0x3d'))){_0x2b902e[_0x0f47('0x22')]=qs[_0x0f47('0x22')](_0x1142cd[_0x0f47('0x36')]['limit']);_0x2b902e[_0x0f47('0x20')]=qs[_0x0f47('0x20')](_0x1142cd[_0x0f47('0x36')][_0x0f47('0x20')]);}_0x2b902e[_0x0f47('0x3e')]=qs['sort'](_0x1142cd['query']['sort']);_0x2b902e[_0x0f47('0x3f')]=qs[_0x0f47('0x37')](_[_0x0f47('0x40')](_0x1142cd['query'],_0x2648f1[_0x0f47('0x37')]),_0x3a3687);if(_0x1142cd[_0x0f47('0x36')]['filter']){_0x2b902e['where']=_['merge'](_0x2b902e[_0x0f47('0x3f')],{'$or':_['map'](_0x3a3687,function(_0x1a812b){if(_0x1a812b[_0x0f47('0x32')]!=='VIRTUAL'){var _0x477c59={};_0x477c59[_0x1a812b[_0x0f47('0x2c')]]={'$like':'%'+_0x1142cd[_0x0f47('0x36')][_0x0f47('0x41')]+'%'};return _0x477c59;}})});}_0x2b902e=_[_0x0f47('0x42')]({},_0x2b902e,_0x1142cd[_0x0f47('0x43')]);var _0x331c8c={'where':_0x2b902e[_0x0f47('0x3f')]};return db['ChatQueueReport'][_0x0f47('0x23')](_0x331c8c)[_0x0f47('0x28')](function(_0x30bcdc){_0x8e5d1f[_0x0f47('0x23')]=_0x30bcdc;if(_0x1142cd[_0x0f47('0x36')][_0x0f47('0x44')]){_0x2b902e['include']=[{'all':!![]}];}return db[_0x0f47('0x2f')]['findAll'](_0x2b902e);})[_0x0f47('0x28')](function(_0x1753be){_0x8e5d1f['rows']=_0x1753be;return _0x8e5d1f;})[_0x0f47('0x28')](respondWithFilteredResult(_0xd47c98,_0x2b902e))[_0x0f47('0x45')](handleError(_0xd47c98,null));};exports[_0x0f47('0x46')]=function(_0x2d6c86,_0x46f86b){var _0x48dfee={'raw':!![],'where':{'id':_0x2d6c86[_0x0f47('0x47')]['id']}},_0x4a2305={};_0x4a2305[_0x0f47('0x33')]=_[_0x0f47('0x35')](db[_0x0f47('0x2f')][_0x0f47('0x30')]);_0x4a2305[_0x0f47('0x36')]=_[_0x0f47('0x35')](_0x2d6c86['query']);_0x4a2305['filters']=_[_0x0f47('0x38')](_0x4a2305[_0x0f47('0x33')],_0x4a2305[_0x0f47('0x36')]);_0x48dfee['attributes']=_[_0x0f47('0x38')](_0x4a2305[_0x0f47('0x33')],qs[_0x0f47('0x39')](_0x2d6c86[_0x0f47('0x36')][_0x0f47('0x39')]));_0x48dfee[_0x0f47('0x3a')]=_0x48dfee[_0x0f47('0x3a')][_0x0f47('0x3b')]?_0x48dfee[_0x0f47('0x3a')]:_0x4a2305['model'];if(_0x2d6c86[_0x0f47('0x36')][_0x0f47('0x44')]){_0x48dfee[_0x0f47('0x48')]=[{'all':!![]}];}_0x48dfee=_[_0x0f47('0x42')]({},_0x48dfee,_0x2d6c86[_0x0f47('0x43')]);return db[_0x0f47('0x2f')][_0x0f47('0x49')](_0x48dfee)[_0x0f47('0x28')](handleEntityNotFound(_0x46f86b,null))[_0x0f47('0x28')](respondWithResult(_0x46f86b,null))['catch'](handleError(_0x46f86b,null));};exports['create']=function(_0x16a4b2,_0x341aeb){return db[_0x0f47('0x2f')][_0x0f47('0x4a')](_0x16a4b2[_0x0f47('0x4b')],{})[_0x0f47('0x28')](respondWithResult(_0x341aeb,0xc9))[_0x0f47('0x45')](handleError(_0x341aeb,null));};exports['update']=function(_0x358c09,_0x143667){if(_0x358c09[_0x0f47('0x4b')]['id']){delete _0x358c09[_0x0f47('0x4b')]['id'];}return db[_0x0f47('0x2f')][_0x0f47('0x49')]({'where':{'id':_0x358c09[_0x0f47('0x47')]['id']}})['then'](handleEntityNotFound(_0x143667,null))[_0x0f47('0x28')](saveUpdates(_0x358c09[_0x0f47('0x4b')],null))[_0x0f47('0x28')](respondWithResult(_0x143667,null))[_0x0f47('0x45')](handleError(_0x143667,null));};exports['destroy']=function(_0x1a1fb4,_0x3f8bb9){return db[_0x0f47('0x2f')][_0x0f47('0x49')]({'where':{'id':_0x1a1fb4[_0x0f47('0x47')]['id']}})[_0x0f47('0x28')](handleEntityNotFound(_0x3f8bb9,null))[_0x0f47('0x28')](removeEntity(_0x3f8bb9,null))[_0x0f47('0x45')](handleError(_0x3f8bb9,null));};exports[_0x0f47('0x4c')]=function(_0x58927d,_0x120a02){return db[_0x0f47('0x2f')][_0x0f47('0x4c')]()[_0x0f47('0x28')](respondWithResult(_0x120a02,null))[_0x0f47('0x45')](handleError(_0x120a02,null));}; \ No newline at end of file +var _0xb366=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset'];(function(_0x1668fd,_0x28d832){var _0xe56614=function(_0x4aac51){while(--_0x4aac51){_0x1668fd['push'](_0x1668fd['shift']());}};_0xe56614(++_0x28d832);}(_0xb366,0xa4));var _0x6b36=function(_0x5116a3,_0x1054c0){_0x5116a3=_0x5116a3-0x0;var _0x4f3d35=_0xb366[_0x5116a3];return _0x4f3d35;};'use strict';var emlformat=require(_0x6b36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b36('0x1'));var jsonpatch=require(_0x6b36('0x2'));var rp=require('request-promise');var moment=require(_0x6b36('0x3'));var BPromise=require(_0x6b36('0x4'));var Mustache=require(_0x6b36('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6b36('0x6'));var ejs=require(_0x6b36('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b36('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b36('0x9'));var deskjs=require(_0x6b36('0xa'));var toCsv=require(_0x6b36('0x6'));var querystring=require(_0x6b36('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b36('0xc'));var authService=require(_0x6b36('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x6b36('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b36('0xf'))(_0x6b36('0x10'));var utils=require(_0x6b36('0x11'));var config=require(_0x6b36('0x12'));var licenseUtil=require(_0x6b36('0x13'));var db=require(_0x6b36('0x14'))['db'];function respondWithStatusCode(_0x51ff2a,_0x22bab4){_0x22bab4=_0x22bab4||0xcc;return function(_0x283873){if(_0x283873){return _0x51ff2a['sendStatus'](_0x22bab4);}return _0x51ff2a[_0x6b36('0x15')](_0x22bab4)['end']();};}function respondWithResult(_0x1351f3,_0x4fffe4){_0x4fffe4=_0x4fffe4||0xc8;return function(_0x4dd3ed){if(_0x4dd3ed){return _0x1351f3['status'](_0x4fffe4)[_0x6b36('0x16')](_0x4dd3ed);}};}function respondWithFilteredResult(_0x3cfdff,_0x291a25){return function(_0x4f6ca1){if(_0x4f6ca1){var _0x207dc7=typeof _0x291a25['offset']===_0x6b36('0x17')&&typeof _0x291a25[_0x6b36('0x18')]===_0x6b36('0x17');var _0x58dc48=_0x4f6ca1['count'];var _0x17c969=_0x207dc7?0x0:_0x291a25['offset'];var _0x41334a=_0x207dc7?_0x4f6ca1[_0x6b36('0x19')]:_0x291a25['offset']+_0x291a25[_0x6b36('0x18')];var _0x56b605;if(_0x41334a>=_0x58dc48){_0x41334a=_0x58dc48;_0x56b605=0xc8;}else{_0x56b605=0xce;}_0x3cfdff[_0x6b36('0x15')](_0x56b605);return _0x3cfdff['set'](_0x6b36('0x1a'),_0x17c969+'-'+_0x41334a+'/'+_0x58dc48)[_0x6b36('0x16')](_0x4f6ca1);}return null;};}function patchUpdates(_0xda25fd){return function(_0xa4157f){try{jsonpatch[_0x6b36('0x1b')](_0xa4157f,_0xda25fd,!![]);}catch(_0x280e60){return BPromise[_0x6b36('0x1c')](_0x280e60);}return _0xa4157f[_0x6b36('0x1d')]();};}function saveUpdates(_0xfa1de9,_0xc14d73){return function(_0x189e7b){if(_0x189e7b){return _0x189e7b[_0x6b36('0x1e')](_0xfa1de9)['then'](function(_0x3df348){return _0x3df348;});}return null;};}function removeEntity(_0x3dc7d1,_0x514c0d){return function(_0x264a83){if(_0x264a83){return _0x264a83['destroy']()[_0x6b36('0x1f')](function(){_0x3dc7d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b00d1,_0x2aec5a){return function(_0x1fa74e){if(!_0x1fa74e){_0x5b00d1[_0x6b36('0x20')](0x194);}return _0x1fa74e;};}function handleError(_0xf0eec6,_0x2d1af7){_0x2d1af7=_0x2d1af7||0x1f4;return function(_0x33d343){logger[_0x6b36('0x21')](_0x33d343[_0x6b36('0x22')]);if(_0x33d343['name']){delete _0x33d343[_0x6b36('0x23')];}_0xf0eec6[_0x6b36('0x15')](_0x2d1af7)['send'](_0x33d343);};}exports[_0x6b36('0x24')]=function(_0x432637,_0x4920df){var _0x40741d={},_0x111655={},_0xdf2d9c={'count':0x0,'rows':[]};var _0x45513b=_[_0x6b36('0x25')](db[_0x6b36('0x26')][_0x6b36('0x27')],function(_0xbc15cc){return{'name':_0xbc15cc[_0x6b36('0x28')],'type':_0xbc15cc[_0x6b36('0x29')]['key']};});_0x111655[_0x6b36('0x2a')]=_[_0x6b36('0x25')](_0x45513b,_0x6b36('0x23'));_0x111655[_0x6b36('0x2b')]=_['keys'](_0x432637['query']);_0x111655[_0x6b36('0x2c')]=_['intersection'](_0x111655[_0x6b36('0x2a')],_0x111655[_0x6b36('0x2b')]);_0x40741d[_0x6b36('0x2d')]=_[_0x6b36('0x2e')](_0x111655[_0x6b36('0x2a')],qs[_0x6b36('0x2f')](_0x432637[_0x6b36('0x2b')][_0x6b36('0x2f')]));_0x40741d[_0x6b36('0x2d')]=_0x40741d[_0x6b36('0x2d')][_0x6b36('0x30')]?_0x40741d['attributes']:_0x111655['model'];if(!_0x432637[_0x6b36('0x2b')][_0x6b36('0x31')](_0x6b36('0x32'))){_0x40741d[_0x6b36('0x18')]=qs[_0x6b36('0x18')](_0x432637['query']['limit']);_0x40741d[_0x6b36('0x33')]=qs[_0x6b36('0x33')](_0x432637[_0x6b36('0x2b')]['offset']);}_0x40741d[_0x6b36('0x34')]=qs[_0x6b36('0x35')](_0x432637['query'][_0x6b36('0x35')]);_0x40741d[_0x6b36('0x36')]=qs['filters'](_[_0x6b36('0x37')](_0x432637[_0x6b36('0x2b')],_0x111655[_0x6b36('0x2c')]),_0x45513b);if(_0x432637[_0x6b36('0x2b')]['filter']){_0x40741d[_0x6b36('0x36')]=_[_0x6b36('0x38')](_0x40741d[_0x6b36('0x36')],{'$or':_[_0x6b36('0x25')](_0x45513b,function(_0x49d42b){if(_0x49d42b[_0x6b36('0x29')]!==_0x6b36('0x39')){var _0x5e0455={};_0x5e0455[_0x49d42b[_0x6b36('0x23')]]={'$like':'%'+_0x432637['query'][_0x6b36('0x3a')]+'%'};return _0x5e0455;}})});}_0x40741d=_[_0x6b36('0x38')]({},_0x40741d,_0x432637[_0x6b36('0x3b')]);var _0x2dee8a={'where':_0x40741d[_0x6b36('0x36')]};return db['ChatQueueReport'][_0x6b36('0x19')](_0x2dee8a)[_0x6b36('0x1f')](function(_0x2cb16d){_0xdf2d9c['count']=_0x2cb16d;if(_0x432637[_0x6b36('0x2b')][_0x6b36('0x3c')]){_0x40741d['include']=[{'all':!![]}];}return db[_0x6b36('0x26')][_0x6b36('0x3d')](_0x40741d);})['then'](function(_0x427223){_0xdf2d9c['rows']=_0x427223;return _0xdf2d9c;})[_0x6b36('0x1f')](respondWithFilteredResult(_0x4920df,_0x40741d))[_0x6b36('0x3e')](handleError(_0x4920df,null));};exports[_0x6b36('0x3f')]=function(_0x576687,_0x47f8d6){var _0x226c52={'raw':!![],'where':{'id':_0x576687[_0x6b36('0x40')]['id']}},_0x33b6bc={};_0x33b6bc['model']=_[_0x6b36('0x41')](db[_0x6b36('0x26')][_0x6b36('0x27')]);_0x33b6bc[_0x6b36('0x2b')]=_[_0x6b36('0x41')](_0x576687[_0x6b36('0x2b')]);_0x33b6bc[_0x6b36('0x2c')]=_[_0x6b36('0x2e')](_0x33b6bc['model'],_0x33b6bc[_0x6b36('0x2b')]);_0x226c52[_0x6b36('0x2d')]=_[_0x6b36('0x2e')](_0x33b6bc['model'],qs['fields'](_0x576687[_0x6b36('0x2b')][_0x6b36('0x2f')]));_0x226c52[_0x6b36('0x2d')]=_0x226c52[_0x6b36('0x2d')][_0x6b36('0x30')]?_0x226c52[_0x6b36('0x2d')]:_0x33b6bc[_0x6b36('0x2a')];if(_0x576687[_0x6b36('0x2b')][_0x6b36('0x3c')]){_0x226c52[_0x6b36('0x42')]=[{'all':!![]}];}_0x226c52=_[_0x6b36('0x38')]({},_0x226c52,_0x576687[_0x6b36('0x3b')]);return db[_0x6b36('0x26')][_0x6b36('0x43')](_0x226c52)[_0x6b36('0x1f')](handleEntityNotFound(_0x47f8d6,null))[_0x6b36('0x1f')](respondWithResult(_0x47f8d6,null))['catch'](handleError(_0x47f8d6,null));};exports['create']=function(_0x51f0d4,_0x41e493){return db['ChatQueueReport'][_0x6b36('0x44')](_0x51f0d4[_0x6b36('0x45')],{})['then'](respondWithResult(_0x41e493,0xc9))['catch'](handleError(_0x41e493,null));};exports['update']=function(_0x5823ab,_0x2bfccf){if(_0x5823ab['body']['id']){delete _0x5823ab['body']['id'];}return db[_0x6b36('0x26')][_0x6b36('0x43')]({'where':{'id':_0x5823ab[_0x6b36('0x40')]['id']}})['then'](handleEntityNotFound(_0x2bfccf,null))[_0x6b36('0x1f')](saveUpdates(_0x5823ab[_0x6b36('0x45')],null))[_0x6b36('0x1f')](respondWithResult(_0x2bfccf,null))['catch'](handleError(_0x2bfccf,null));};exports[_0x6b36('0x46')]=function(_0x2b3d00,_0x3e8ca0){return db[_0x6b36('0x26')][_0x6b36('0x43')]({'where':{'id':_0x2b3d00[_0x6b36('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e8ca0,null))[_0x6b36('0x1f')](removeEntity(_0x3e8ca0,null))['catch'](handleError(_0x3e8ca0,null));};exports[_0x6b36('0x47')]=function(_0x15ad91,_0x252c7b){return db[_0x6b36('0x26')]['describe']()[_0x6b36('0x1f')](respondWithResult(_0x252c7b,null))['catch'](handleError(_0x252c7b,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 6dd58d5..74f4069 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x51486b,_0x320879){var _0x3fe26b=function(_0x30abc9){while(--_0x30abc9){_0x51486b['push'](_0x51486b['shift']());}};_0x3fe26b(++_0x320879);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'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 +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 295d398..94b79ec 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 _0x5d75=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatQueueReport','options','ChatQueueReport','update','body','raw','attributes','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2893cd,_0xca8511){var _0x401396=function(_0xf59843){while(--_0xf59843){_0x2893cd['push'](_0x2893cd['shift']());}};_0x401396(++_0xca8511);}(_0x5d75,0x19e));var _0x55d7=function(_0x3090e7,_0x11c7d6){_0x3090e7=_0x3090e7-0x0;var _0x39d4fa=_0x5d75[_0x3090e7];return _0x39d4fa;};'use strict';var _=require(_0x55d7('0x0'));var util=require(_0x55d7('0x1'));var moment=require(_0x55d7('0x2'));var BPromise=require(_0x55d7('0x3'));var rs=require(_0x55d7('0x4'));var fs=require('fs');var Redis=require(_0x55d7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55d7('0x6'))(_0x55d7('0x7'));var config=require(_0x55d7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x55d7('0x9')][_0x55d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae1fc,_0x1290fc,_0x309105){return new BPromise(function(_0x35a538,_0x2ce6fa){return client[_0x55d7('0xb')](_0x4ae1fc,_0x309105)[_0x55d7('0xc')](function(_0x12ebf7){logger['info'](_0x55d7('0xd'),_0x1290fc,_0x55d7('0xe'));logger[_0x55d7('0xf')](_0x55d7('0x10'),_0x1290fc,'request\x20sent',JSON[_0x55d7('0x11')](_0x12ebf7));if(_0x12ebf7[_0x55d7('0x12')]){if(_0x12ebf7['error'][_0x55d7('0x13')]===0x1f4){logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);return _0x2ce6fa(_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);}logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);return _0x35a538(_0x12ebf7[_0x55d7('0x12')][_0x55d7('0x14')]);}else{logger[_0x55d7('0x15')](_0x55d7('0xd'),_0x1290fc,'request\x20sent');_0x35a538(_0x12ebf7[_0x55d7('0x16')][_0x55d7('0x14')]);}})[_0x55d7('0x17')](function(_0x2d0508){logger[_0x55d7('0x12')](_0x55d7('0xd'),_0x1290fc,_0x2d0508);_0x2ce6fa(_0x2d0508);});});}exports[_0x55d7('0x18')]=function(_0x115667){var _0x1285b8=this;return new Promise(function(_0x5df966,_0x15a470){return db['ChatQueueReport']['create'](_0x115667['body'],{'raw':_0x115667[_0x55d7('0x19')]?_0x115667[_0x55d7('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x55d7('0xc')](function(_0x4613b6){logger['info']('CreateChatQueueReport',_0x115667);logger[_0x55d7('0xf')](_0x55d7('0x18'),_0x115667,JSON['stringify'](_0x4613b6));_0x5df966(_0x4613b6);})[_0x55d7('0x17')](function(_0x8f5e35){logger[_0x55d7('0x12')](_0x55d7('0x18'),_0x8f5e35['message'],_0x115667);_0x15a470(_0x1285b8[_0x55d7('0x12')](0x1f4,_0x8f5e35[_0x55d7('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x45d832){var _0x25bb1b=this;return new Promise(function(_0x25fd7b,_0x14ddb7){return db[_0x55d7('0x1a')][_0x55d7('0x1b')](_0x45d832[_0x55d7('0x1c')],{'raw':_0x45d832[_0x55d7('0x19')]?_0x45d832[_0x55d7('0x19')][_0x55d7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45d832[_0x55d7('0x19')]?_0x45d832[_0x55d7('0x19')]['where']||null:null,'attributes':_0x45d832[_0x55d7('0x19')]?_0x45d832['options'][_0x55d7('0x1e')]||null:null,'limit':_0x45d832[_0x55d7('0x19')]?_0x45d832['options'][_0x55d7('0x1f')]||null:null})['then'](function(_0x3f384a){logger[_0x55d7('0x15')](_0x55d7('0x20'),_0x45d832);logger[_0x55d7('0xf')](_0x55d7('0x20'),_0x45d832,JSON[_0x55d7('0x11')](_0x3f384a));_0x25fd7b(_0x3f384a);})[_0x55d7('0x17')](function(_0x17dc78){logger[_0x55d7('0x12')](_0x55d7('0x20'),_0x17dc78[_0x55d7('0x14')],_0x45d832);_0x14ddb7(_0x25bb1b[_0x55d7('0x12')](0x1f4,_0x17dc78[_0x55d7('0x14')]));});});}; \ No newline at end of file +var _0x8bf1=['info','request\x20sent','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','catch','CreateChatQueueReport','create','body','options','raw','then','debug','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request'];(function(_0xe3c0b6,_0x4c192a){var _0x1c737f=function(_0x6bd76e){while(--_0x6bd76e){_0xe3c0b6['push'](_0xe3c0b6['shift']());}};_0x1c737f(++_0x4c192a);}(_0x8bf1,0xd5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var util=require(_0x18bf('0x1'));var moment=require(_0x18bf('0x2'));var BPromise=require(_0x18bf('0x3'));var rs=require(_0x18bf('0x4'));var fs=require('fs');var Redis=require(_0x18bf('0x5'));var db=require(_0x18bf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x18bf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x18bf('0x8'));var client=jayson[_0x18bf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x741a1f,_0x1570d9,_0x15cee3){return new BPromise(function(_0x5d2ba2,_0x50e202){return client[_0x18bf('0xa')](_0x741a1f,_0x15cee3)['then'](function(_0x59b66c){logger[_0x18bf('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x1570d9,_0x18bf('0xc'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1570d9,_0x18bf('0xc'),JSON[_0x18bf('0xd')](_0x59b66c));if(_0x59b66c[_0x18bf('0xe')]){if(_0x59b66c['error'][_0x18bf('0xf')]===0x1f4){logger[_0x18bf('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x1570d9,_0x59b66c[_0x18bf('0xe')]['message']);return _0x50e202(_0x59b66c['error'][_0x18bf('0x10')]);}logger['error'](_0x18bf('0x11'),_0x1570d9,_0x59b66c[_0x18bf('0xe')][_0x18bf('0x10')]);return _0x5d2ba2(_0x59b66c['error'][_0x18bf('0x10')]);}else{logger[_0x18bf('0xb')](_0x18bf('0x11'),_0x1570d9,_0x18bf('0xc'));_0x5d2ba2(_0x59b66c['result']['message']);}})[_0x18bf('0x12')](function(_0x290d87){logger[_0x18bf('0xe')](_0x18bf('0x11'),_0x1570d9,_0x290d87);_0x50e202(_0x290d87);});});}exports[_0x18bf('0x13')]=function(_0x545ebb){var _0x432156=this;return new Promise(function(_0x410ba6,_0x33c207){return db['ChatQueueReport'][_0x18bf('0x14')](_0x545ebb[_0x18bf('0x15')],{'raw':_0x545ebb['options']?_0x545ebb[_0x18bf('0x16')][_0x18bf('0x17')]===undefined?!![]:![]:!![]})[_0x18bf('0x18')](function(_0xf513e6){logger['info'](_0x18bf('0x13'),_0x545ebb);logger[_0x18bf('0x19')](_0x18bf('0x13'),_0x545ebb,JSON[_0x18bf('0xd')](_0xf513e6));_0x410ba6(_0xf513e6);})['catch'](function(_0x334f2b){logger[_0x18bf('0xe')](_0x18bf('0x13'),_0x334f2b[_0x18bf('0x10')],_0x545ebb);_0x33c207(_0x432156[_0x18bf('0xe')](0x1f4,_0x334f2b[_0x18bf('0x10')]));});});};exports[_0x18bf('0x1a')]=function(_0x4b8607){var _0x1cf87a=this;return new Promise(function(_0x82dfda,_0x2419bf){return db[_0x18bf('0x1b')][_0x18bf('0x1c')](_0x4b8607[_0x18bf('0x15')],{'raw':_0x4b8607[_0x18bf('0x16')]?_0x4b8607[_0x18bf('0x16')][_0x18bf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8607[_0x18bf('0x16')]?_0x4b8607[_0x18bf('0x16')][_0x18bf('0x1d')]||null:null,'attributes':_0x4b8607[_0x18bf('0x16')]?_0x4b8607[_0x18bf('0x16')][_0x18bf('0x1e')]||null:null,'limit':_0x4b8607[_0x18bf('0x16')]?_0x4b8607[_0x18bf('0x16')][_0x18bf('0x1f')]||null:null})[_0x18bf('0x18')](function(_0x4d7a2e){logger[_0x18bf('0xb')](_0x18bf('0x1a'),_0x4b8607);logger[_0x18bf('0x19')](_0x18bf('0x1a'),_0x4b8607,JSON['stringify'](_0x4d7a2e));_0x82dfda(_0x4d7a2e);})['catch'](function(_0x2d45d8){logger[_0x18bf('0xe')](_0x18bf('0x1a'),_0x2d45d8[_0x18bf('0x10')],_0x4b8607);_0x2419bf(_0x1cf87a['error'](0x1f4,_0x2d45d8[_0x18bf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index ca1a142..7aaf275 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 _0x8ea5=['express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','/describe','describe','isAuthenticated','show','create','put','/:id','destroy','exports','util','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8ea5,0x1b8));var _0x58ea=function(_0x13426b,_0x19417c){_0x13426b=_0x13426b-0x0;var _0x31d7a6=_0x8ea5[_0x13426b];return _0x31d7a6;};'use strict';var multer=require('multer');var util=require(_0x58ea('0x0'));var path=require('path');var timeout=require(_0x58ea('0x1'));var express=require(_0x58ea('0x2'));var router=express[_0x58ea('0x3')]();var fs_extra=require(_0x58ea('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x58ea('0x5'));var controller=require(_0x58ea('0x6'));router[_0x58ea('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x58ea('0x7')](_0x58ea('0x8'),auth['isAuthenticated'](),controller[_0x58ea('0x9')]);router[_0x58ea('0x7')]('/:id',auth[_0x58ea('0xa')](),controller[_0x58ea('0xb')]);router['post']('/',auth[_0x58ea('0xa')](),controller[_0x58ea('0xc')]);router[_0x58ea('0xd')](_0x58ea('0xe'),auth[_0x58ea('0xa')](),controller['update']);router['delete'](_0x58ea('0xe'),auth[_0x58ea('0xa')](),controller[_0x58ea('0xf')]);module[_0x58ea('0x10')]=router; \ No newline at end of file +var _0x8cb5=['/describe','describe','post','create','put','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0xee2b,_0x11e595){var _0x332e9a=function(_0x19335a){while(--_0x19335a){_0xee2b['push'](_0xee2b['shift']());}};_0x332e9a(++_0x11e595);}(_0x8cb5,0x1e4));var _0x58cb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8cb5[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x58cb('0x0'));var path=require(_0x58cb('0x1'));var timeout=require(_0x58cb('0x2'));var express=require('express');var router=express[_0x58cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x58cb('0x4'));var interaction=require(_0x58cb('0x5'));var config=require(_0x58cb('0x6'));var controller=require(_0x58cb('0x7'));router[_0x58cb('0x8')]('/',auth[_0x58cb('0x9')](),controller['index']);router['get'](_0x58cb('0xa'),auth[_0x58cb('0x9')](),controller[_0x58cb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x58cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x58cb('0xd')]);router[_0x58cb('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x58cb('0xf')](_0x58cb('0x10'),auth[_0x58cb('0x9')](),controller[_0x58cb('0x11')]);module[_0x58cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index dfd255d..3d6c7ad 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x534e4e,_0x1c8361){var _0x36b363=function(_0x32fa5c){while(--_0x32fa5c){_0x534e4e['push'](_0x534e4e['shift']());}};_0x36b363(++_0x1c8361);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x28db4a,_0x6d6d5a){var _0x3bf87e=function(_0x3e0f75){while(--_0x3e0f75){_0x28db4a['push'](_0x28db4a['shift']());}};_0x3bf87e(++_0x6d6d5a);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 9fe3726..5911d2a 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 _0x2e01=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','ChatTransferReport','rawAttributes'];(function(_0x39faf6,_0x5b0b13){var _0x4117ba=function(_0x44e4bc){while(--_0x44e4bc){_0x39faf6['push'](_0x39faf6['shift']());}};_0x4117ba(++_0x5b0b13);}(_0x2e01,0x135));var _0x12e0=function(_0x59514b,_0x31770c){_0x59514b=_0x59514b-0x0;var _0x446f4d=_0x2e01[_0x59514b];return _0x446f4d;};'use strict';var emlformat=require(_0x12e0('0x0'));var rimraf=require(_0x12e0('0x1'));var zipdir=require(_0x12e0('0x2'));var jsonpatch=require(_0x12e0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x12e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x12e0('0x5'));var csv=require(_0x12e0('0x6'));var ejs=require(_0x12e0('0x7'));var fs=require('fs');var fs_extra=require(_0x12e0('0x8'));var _=require('lodash');var squel=require(_0x12e0('0x9'));var crypto=require(_0x12e0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x12e0('0xb'));var toCsv=require(_0x12e0('0x6'));var querystring=require(_0x12e0('0xc'));var Papa=require(_0x12e0('0xd'));var Redis=require('ioredis');var authService=require(_0x12e0('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x12e0('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x12e0('0x10'));var config=require(_0x12e0('0x11'));var licenseUtil=require(_0x12e0('0x12'));var db=require(_0x12e0('0x13'))['db'];function respondWithStatusCode(_0xba357e,_0x2433a1){_0x2433a1=_0x2433a1||0xcc;return function(_0x6309ca){if(_0x6309ca){return _0xba357e['sendStatus'](_0x2433a1);}return _0xba357e[_0x12e0('0x14')](_0x2433a1)['end']();};}function respondWithResult(_0x94a58e,_0x27bde7){_0x27bde7=_0x27bde7||0xc8;return function(_0x4d51e7){if(_0x4d51e7){return _0x94a58e[_0x12e0('0x14')](_0x27bde7)[_0x12e0('0x15')](_0x4d51e7);}};}function respondWithFilteredResult(_0x490e21,_0x40e3dc){return function(_0x3a6dd8){if(_0x3a6dd8){var _0x42469f=typeof _0x40e3dc[_0x12e0('0x16')]===_0x12e0('0x17')&&typeof _0x40e3dc['limit']===_0x12e0('0x17');var _0x4b5c32=_0x3a6dd8[_0x12e0('0x18')];var _0x42308e=_0x42469f?0x0:_0x40e3dc[_0x12e0('0x16')];var _0x421455=_0x42469f?_0x3a6dd8[_0x12e0('0x18')]:_0x40e3dc[_0x12e0('0x16')]+_0x40e3dc[_0x12e0('0x19')];var _0xe90f76;if(_0x421455>=_0x4b5c32){_0x421455=_0x4b5c32;_0xe90f76=0xc8;}else{_0xe90f76=0xce;}_0x490e21['status'](_0xe90f76);return _0x490e21[_0x12e0('0x1a')](_0x12e0('0x1b'),_0x42308e+'-'+_0x421455+'/'+_0x4b5c32)['json'](_0x3a6dd8);}return null;};}function patchUpdates(_0x31ea9d){return function(_0x1817b7){try{jsonpatch[_0x12e0('0x1c')](_0x1817b7,_0x31ea9d,!![]);}catch(_0x18dc58){return BPromise[_0x12e0('0x1d')](_0x18dc58);}return _0x1817b7[_0x12e0('0x1e')]();};}function saveUpdates(_0xc31c74,_0x328df4){return function(_0x3a3253){if(_0x3a3253){return _0x3a3253[_0x12e0('0x1f')](_0xc31c74)[_0x12e0('0x20')](function(_0x4fd3c8){return _0x4fd3c8;});}return null;};}function removeEntity(_0x21ca0d,_0xafa586){return function(_0x4ad130){if(_0x4ad130){return _0x4ad130[_0x12e0('0x21')]()['then'](function(){_0x21ca0d[_0x12e0('0x14')](0xcc)[_0x12e0('0x22')]();});}};}function handleEntityNotFound(_0x50fce0,_0x30e1e8){return function(_0x59a698){if(!_0x59a698){_0x50fce0['sendStatus'](0x194);}return _0x59a698;};}function handleError(_0x1e8fcf,_0x3643d6){_0x3643d6=_0x3643d6||0x1f4;return function(_0x19413c){logger[_0x12e0('0x23')](_0x19413c[_0x12e0('0x24')]);if(_0x19413c[_0x12e0('0x25')]){delete _0x19413c[_0x12e0('0x25')];}_0x1e8fcf[_0x12e0('0x14')](_0x3643d6)['send'](_0x19413c);};}exports[_0x12e0('0x26')]=function(_0x221de4,_0x1f780e){var _0x2f33dc={},_0x439ccd={},_0x1c11d9={'count':0x0,'rows':[]};var _0x4ba7e8=_['map'](db[_0x12e0('0x27')][_0x12e0('0x28')],function(_0xdac09d){return{'name':_0xdac09d['fieldName'],'type':_0xdac09d[_0x12e0('0x29')][_0x12e0('0x2a')]};});_0x439ccd[_0x12e0('0x2b')]=_['map'](_0x4ba7e8,_0x12e0('0x25'));_0x439ccd[_0x12e0('0x2c')]=_[_0x12e0('0x2d')](_0x221de4[_0x12e0('0x2c')]);_0x439ccd['filters']=_[_0x12e0('0x2e')](_0x439ccd['model'],_0x439ccd[_0x12e0('0x2c')]);_0x2f33dc[_0x12e0('0x2f')]=_[_0x12e0('0x2e')](_0x439ccd[_0x12e0('0x2b')],qs['fields'](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x30')]));_0x2f33dc[_0x12e0('0x2f')]=_0x2f33dc['attributes'][_0x12e0('0x31')]?_0x2f33dc[_0x12e0('0x2f')]:_0x439ccd[_0x12e0('0x2b')];if(!_0x221de4[_0x12e0('0x2c')][_0x12e0('0x32')](_0x12e0('0x33'))){_0x2f33dc['limit']=qs[_0x12e0('0x19')](_0x221de4['query'][_0x12e0('0x19')]);_0x2f33dc['offset']=qs[_0x12e0('0x16')](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x16')]);}_0x2f33dc[_0x12e0('0x34')]=qs['sort'](_0x221de4[_0x12e0('0x2c')][_0x12e0('0x35')]);_0x2f33dc['where']=qs['filters'](_[_0x12e0('0x36')](_0x221de4['query'],_0x439ccd[_0x12e0('0x37')]),_0x4ba7e8);if(_0x221de4['query'][_0x12e0('0x38')]){_0x2f33dc[_0x12e0('0x39')]=_[_0x12e0('0x3a')](_0x2f33dc['where'],{'$or':_['map'](_0x4ba7e8,function(_0x5df904){if(_0x5df904[_0x12e0('0x29')]!=='VIRTUAL'){var _0x11909d={};_0x11909d[_0x5df904[_0x12e0('0x25')]]={'$like':'%'+_0x221de4[_0x12e0('0x2c')][_0x12e0('0x38')]+'%'};return _0x11909d;}})});}_0x2f33dc=_['merge']({},_0x2f33dc,_0x221de4[_0x12e0('0x3b')]);var _0x4a749d={'where':_0x2f33dc[_0x12e0('0x39')]};return db[_0x12e0('0x27')][_0x12e0('0x18')](_0x4a749d)[_0x12e0('0x20')](function(_0x2896af){_0x1c11d9[_0x12e0('0x18')]=_0x2896af;if(_0x221de4['query']['includeAll']){_0x2f33dc[_0x12e0('0x3c')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x12e0('0x3d')](_0x2f33dc);})[_0x12e0('0x20')](function(_0x1b5a1e){_0x1c11d9['rows']=_0x1b5a1e;return _0x1c11d9;})[_0x12e0('0x20')](respondWithFilteredResult(_0x1f780e,_0x2f33dc))[_0x12e0('0x3e')](handleError(_0x1f780e,null));};exports[_0x12e0('0x3f')]=function(_0x15f7cc,_0xe3708a){var _0x60cf45={'raw':!![],'where':{'id':_0x15f7cc['params']['id']}},_0x269eb2={};_0x269eb2[_0x12e0('0x2b')]=_[_0x12e0('0x2d')](db[_0x12e0('0x27')][_0x12e0('0x28')]);_0x269eb2['query']=_['keys'](_0x15f7cc[_0x12e0('0x2c')]);_0x269eb2['filters']=_['intersection'](_0x269eb2[_0x12e0('0x2b')],_0x269eb2[_0x12e0('0x2c')]);_0x60cf45[_0x12e0('0x2f')]=_[_0x12e0('0x2e')](_0x269eb2[_0x12e0('0x2b')],qs[_0x12e0('0x30')](_0x15f7cc[_0x12e0('0x2c')][_0x12e0('0x30')]));_0x60cf45[_0x12e0('0x2f')]=_0x60cf45[_0x12e0('0x2f')][_0x12e0('0x31')]?_0x60cf45[_0x12e0('0x2f')]:_0x269eb2['model'];if(_0x15f7cc[_0x12e0('0x2c')][_0x12e0('0x40')]){_0x60cf45[_0x12e0('0x3c')]=[{'all':!![]}];}_0x60cf45=_['merge']({},_0x60cf45,_0x15f7cc[_0x12e0('0x3b')]);return db['ChatTransferReport'][_0x12e0('0x41')](_0x60cf45)[_0x12e0('0x20')](handleEntityNotFound(_0xe3708a,null))['then'](respondWithResult(_0xe3708a,null))[_0x12e0('0x3e')](handleError(_0xe3708a,null));};exports[_0x12e0('0x42')]=function(_0x1427f7,_0x2b9456){return db[_0x12e0('0x27')][_0x12e0('0x42')](_0x1427f7[_0x12e0('0x43')],{})['then'](respondWithResult(_0x2b9456,0xc9))['catch'](handleError(_0x2b9456,null));};exports['update']=function(_0x546db6,_0x2ccada){if(_0x546db6[_0x12e0('0x43')]['id']){delete _0x546db6[_0x12e0('0x43')]['id'];}return db[_0x12e0('0x27')][_0x12e0('0x41')]({'where':{'id':_0x546db6[_0x12e0('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ccada,null))[_0x12e0('0x20')](saveUpdates(_0x546db6[_0x12e0('0x43')],null))[_0x12e0('0x20')](respondWithResult(_0x2ccada,null))[_0x12e0('0x3e')](handleError(_0x2ccada,null));};exports['destroy']=function(_0xa308c6,_0x18998f){return db['ChatTransferReport'][_0x12e0('0x41')]({'where':{'id':_0xa308c6[_0x12e0('0x44')]['id']}})[_0x12e0('0x20')](handleEntityNotFound(_0x18998f,null))[_0x12e0('0x20')](removeEntity(_0x18998f,null))[_0x12e0('0x3e')](handleError(_0x18998f,null));};exports['describe']=function(_0x52f856,_0x43cf23){return db[_0x12e0('0x27')][_0x12e0('0x45')]()['then'](respondWithResult(_0x43cf23,null))['catch'](handleError(_0x43cf23,null));}; \ No newline at end of file +var _0x9d8c=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','ChatTransferReport','findAll','rows','catch','show','includeAll','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x5d8758,_0x20640f){var _0x5d0dff=function(_0x5e4623){while(--_0x5e4623){_0x5d8758['push'](_0x5d8758['shift']());}};_0x5d0dff(++_0x20640f);}(_0x9d8c,0x158));var _0xc9d8=function(_0x57d357,_0x113487){_0x57d357=_0x57d357-0x0;var _0x1be154=_0x9d8c[_0x57d357];return _0x1be154;};'use strict';var emlformat=require(_0xc9d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9d8('0x1'));var jsonpatch=require(_0xc9d8('0x2'));var rp=require(_0xc9d8('0x3'));var moment=require(_0xc9d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc9d8('0x5'));var util=require('util');var path=require(_0xc9d8('0x6'));var sox=require(_0xc9d8('0x7'));var csv=require(_0xc9d8('0x8'));var ejs=require(_0xc9d8('0x9'));var fs=require('fs');var fs_extra=require(_0xc9d8('0xa'));var _=require(_0xc9d8('0xb'));var squel=require('squel');var crypto=require(_0xc9d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc9d8('0xd'));var toCsv=require(_0xc9d8('0x8'));var querystring=require('querystring');var Papa=require(_0xc9d8('0xe'));var Redis=require(_0xc9d8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9d8('0x10'))(_0xc9d8('0x11'));var utils=require(_0xc9d8('0x12'));var config=require(_0xc9d8('0x13'));var licenseUtil=require(_0xc9d8('0x14'));var db=require(_0xc9d8('0x15'))['db'];function respondWithStatusCode(_0x1c4ed0,_0x2f5ede){_0x2f5ede=_0x2f5ede||0xcc;return function(_0x7aea14){if(_0x7aea14){return _0x1c4ed0[_0xc9d8('0x16')](_0x2f5ede);}return _0x1c4ed0[_0xc9d8('0x17')](_0x2f5ede)['end']();};}function respondWithResult(_0x40f0a7,_0xa33e20){_0xa33e20=_0xa33e20||0xc8;return function(_0x4c36cd){if(_0x4c36cd){return _0x40f0a7[_0xc9d8('0x17')](_0xa33e20)[_0xc9d8('0x18')](_0x4c36cd);}};}function respondWithFilteredResult(_0x509a16,_0xaa2fc5){return function(_0x4478a0){if(_0x4478a0){var _0x7c0a20=typeof _0xaa2fc5[_0xc9d8('0x19')]===_0xc9d8('0x1a')&&typeof _0xaa2fc5[_0xc9d8('0x1b')]===_0xc9d8('0x1a');var _0x13dc7a=_0x4478a0[_0xc9d8('0x1c')];var _0x324a41=_0x7c0a20?0x0:_0xaa2fc5[_0xc9d8('0x19')];var _0x7fd180=_0x7c0a20?_0x4478a0['count']:_0xaa2fc5[_0xc9d8('0x19')]+_0xaa2fc5['limit'];var _0x4f4804;if(_0x7fd180>=_0x13dc7a){_0x7fd180=_0x13dc7a;_0x4f4804=0xc8;}else{_0x4f4804=0xce;}_0x509a16[_0xc9d8('0x17')](_0x4f4804);return _0x509a16['set'](_0xc9d8('0x1d'),_0x324a41+'-'+_0x7fd180+'/'+_0x13dc7a)[_0xc9d8('0x18')](_0x4478a0);}return null;};}function patchUpdates(_0x1b7ef2){return function(_0x496d40){try{jsonpatch[_0xc9d8('0x1e')](_0x496d40,_0x1b7ef2,!![]);}catch(_0x298d81){return BPromise[_0xc9d8('0x1f')](_0x298d81);}return _0x496d40[_0xc9d8('0x20')]();};}function saveUpdates(_0x448163,_0x12a811){return function(_0x5b6547){if(_0x5b6547){return _0x5b6547['update'](_0x448163)[_0xc9d8('0x21')](function(_0x22d407){return _0x22d407;});}return null;};}function removeEntity(_0xdfd03a,_0x527de9){return function(_0x5a426f){if(_0x5a426f){return _0x5a426f[_0xc9d8('0x22')]()[_0xc9d8('0x21')](function(){_0xdfd03a['status'](0xcc)[_0xc9d8('0x23')]();});}};}function handleEntityNotFound(_0x4eeeec,_0x328680){return function(_0x52b5cd){if(!_0x52b5cd){_0x4eeeec[_0xc9d8('0x16')](0x194);}return _0x52b5cd;};}function handleError(_0x1cded6,_0x58a17c){_0x58a17c=_0x58a17c||0x1f4;return function(_0x3cca61){logger[_0xc9d8('0x24')](_0x3cca61[_0xc9d8('0x25')]);if(_0x3cca61[_0xc9d8('0x26')]){delete _0x3cca61['name'];}_0x1cded6['status'](_0x58a17c)['send'](_0x3cca61);};}exports[_0xc9d8('0x27')]=function(_0x53762e,_0x105c54){var _0x2b7a20={},_0x5e6aca={},_0x5ceb17={'count':0x0,'rows':[]};var _0x386ecf=_[_0xc9d8('0x28')](db['ChatTransferReport'][_0xc9d8('0x29')],function(_0x58d943){return{'name':_0x58d943[_0xc9d8('0x2a')],'type':_0x58d943[_0xc9d8('0x2b')]['key']};});_0x5e6aca[_0xc9d8('0x2c')]=_[_0xc9d8('0x28')](_0x386ecf,_0xc9d8('0x26'));_0x5e6aca[_0xc9d8('0x2d')]=_[_0xc9d8('0x2e')](_0x53762e[_0xc9d8('0x2d')]);_0x5e6aca[_0xc9d8('0x2f')]=_[_0xc9d8('0x30')](_0x5e6aca[_0xc9d8('0x2c')],_0x5e6aca[_0xc9d8('0x2d')]);_0x2b7a20[_0xc9d8('0x31')]=_['intersection'](_0x5e6aca[_0xc9d8('0x2c')],qs[_0xc9d8('0x32')](_0x53762e['query'][_0xc9d8('0x32')]));_0x2b7a20[_0xc9d8('0x31')]=_0x2b7a20[_0xc9d8('0x31')]['length']?_0x2b7a20[_0xc9d8('0x31')]:_0x5e6aca['model'];if(!_0x53762e[_0xc9d8('0x2d')][_0xc9d8('0x33')](_0xc9d8('0x34'))){_0x2b7a20[_0xc9d8('0x1b')]=qs[_0xc9d8('0x1b')](_0x53762e[_0xc9d8('0x2d')][_0xc9d8('0x1b')]);_0x2b7a20['offset']=qs[_0xc9d8('0x19')](_0x53762e['query'][_0xc9d8('0x19')]);}_0x2b7a20[_0xc9d8('0x35')]=qs[_0xc9d8('0x36')](_0x53762e[_0xc9d8('0x2d')][_0xc9d8('0x36')]);_0x2b7a20[_0xc9d8('0x37')]=qs['filters'](_[_0xc9d8('0x38')](_0x53762e[_0xc9d8('0x2d')],_0x5e6aca['filters']),_0x386ecf);if(_0x53762e[_0xc9d8('0x2d')]['filter']){_0x2b7a20[_0xc9d8('0x37')]=_[_0xc9d8('0x39')](_0x2b7a20[_0xc9d8('0x37')],{'$or':_[_0xc9d8('0x28')](_0x386ecf,function(_0x5da883){if(_0x5da883['type']!=='VIRTUAL'){var _0x270956={};_0x270956[_0x5da883['name']]={'$like':'%'+_0x53762e[_0xc9d8('0x2d')][_0xc9d8('0x3a')]+'%'};return _0x270956;}})});}_0x2b7a20=_[_0xc9d8('0x39')]({},_0x2b7a20,_0x53762e[_0xc9d8('0x3b')]);var _0x392679={'where':_0x2b7a20[_0xc9d8('0x37')]};return db['ChatTransferReport'][_0xc9d8('0x1c')](_0x392679)['then'](function(_0x45f259){_0x5ceb17['count']=_0x45f259;if(_0x53762e['query']['includeAll']){_0x2b7a20[_0xc9d8('0x3c')]=[{'all':!![]}];}return db[_0xc9d8('0x3d')][_0xc9d8('0x3e')](_0x2b7a20);})[_0xc9d8('0x21')](function(_0x5b058d){_0x5ceb17[_0xc9d8('0x3f')]=_0x5b058d;return _0x5ceb17;})[_0xc9d8('0x21')](respondWithFilteredResult(_0x105c54,_0x2b7a20))[_0xc9d8('0x40')](handleError(_0x105c54,null));};exports[_0xc9d8('0x41')]=function(_0x4265c2,_0x1b35ab){var _0x5110b7={'raw':!![],'where':{'id':_0x4265c2['params']['id']}},_0xc7e52d={};_0xc7e52d[_0xc9d8('0x2c')]=_[_0xc9d8('0x2e')](db[_0xc9d8('0x3d')][_0xc9d8('0x29')]);_0xc7e52d['query']=_['keys'](_0x4265c2[_0xc9d8('0x2d')]);_0xc7e52d['filters']=_['intersection'](_0xc7e52d[_0xc9d8('0x2c')],_0xc7e52d[_0xc9d8('0x2d')]);_0x5110b7[_0xc9d8('0x31')]=_['intersection'](_0xc7e52d[_0xc9d8('0x2c')],qs[_0xc9d8('0x32')](_0x4265c2['query'][_0xc9d8('0x32')]));_0x5110b7['attributes']=_0x5110b7[_0xc9d8('0x31')]['length']?_0x5110b7[_0xc9d8('0x31')]:_0xc7e52d[_0xc9d8('0x2c')];if(_0x4265c2['query'][_0xc9d8('0x42')]){_0x5110b7[_0xc9d8('0x3c')]=[{'all':!![]}];}_0x5110b7=_[_0xc9d8('0x39')]({},_0x5110b7,_0x4265c2[_0xc9d8('0x3b')]);return db['ChatTransferReport'][_0xc9d8('0x43')](_0x5110b7)[_0xc9d8('0x21')](handleEntityNotFound(_0x1b35ab,null))['then'](respondWithResult(_0x1b35ab,null))[_0xc9d8('0x40')](handleError(_0x1b35ab,null));};exports[_0xc9d8('0x44')]=function(_0x93d472,_0xb4a80a){return db[_0xc9d8('0x3d')][_0xc9d8('0x44')](_0x93d472[_0xc9d8('0x45')],{})[_0xc9d8('0x21')](respondWithResult(_0xb4a80a,0xc9))['catch'](handleError(_0xb4a80a,null));};exports[_0xc9d8('0x46')]=function(_0x388aef,_0x45edab){if(_0x388aef[_0xc9d8('0x45')]['id']){delete _0x388aef[_0xc9d8('0x45')]['id'];}return db[_0xc9d8('0x3d')][_0xc9d8('0x43')]({'where':{'id':_0x388aef[_0xc9d8('0x47')]['id']}})[_0xc9d8('0x21')](handleEntityNotFound(_0x45edab,null))['then'](saveUpdates(_0x388aef[_0xc9d8('0x45')],null))[_0xc9d8('0x21')](respondWithResult(_0x45edab,null))[_0xc9d8('0x40')](handleError(_0x45edab,null));};exports[_0xc9d8('0x22')]=function(_0x4f2f87,_0x501e15){return db[_0xc9d8('0x3d')][_0xc9d8('0x43')]({'where':{'id':_0x4f2f87[_0xc9d8('0x47')]['id']}})[_0xc9d8('0x21')](handleEntityNotFound(_0x501e15,null))['then'](removeEntity(_0x501e15,null))[_0xc9d8('0x40')](handleError(_0x501e15,null));};exports['describe']=function(_0x215467,_0x4f2d2f){return db[_0xc9d8('0x3d')][_0xc9d8('0x48')]()['then'](respondWithResult(_0x4f2d2f,null))['catch'](handleError(_0x4f2d2f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c022916..faf811d 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 _0x8501=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_chat_transfer'];(function(_0x4416c0,_0x53b522){var _0x35546d=function(_0x7354eb){while(--_0x7354eb){_0x4416c0['push'](_0x4416c0['shift']());}};_0x35546d(++_0x53b522);}(_0x8501,0x139));var _0x1850=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x8501[_0x28611e];return _0x530f69;};'use strict';var _=require(_0x1850('0x0'));var util=require(_0x1850('0x1'));var logger=require(_0x1850('0x2'))('api');var moment=require(_0x1850('0x3'));var BPromise=require(_0x1850('0x4'));var rp=require(_0x1850('0x5'));var fs=require('fs');var path=require(_0x1850('0x6'));var rimraf=require(_0x1850('0x7'));var config=require(_0x1850('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0x1850('0x9')]=function(_0x2574e2,_0x146b49){return _0x2574e2[_0x1850('0xa')]('ChatTransferReport',attributes,{'tableName':_0x1850('0xb'),'paranoid':![],'indexes':[{'name':_0x1850('0xc'),'fields':[_0x1850('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f2=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path','rimraf','exports','define'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb9f2,0x12c));var _0x2b9f=function(_0x59c92c,_0x1a98c9){_0x59c92c=_0x59c92c-0x0;var _0x11fe84=_0xb9f2[_0x59c92c];return _0x11fe84;};'use strict';var _=require(_0x2b9f('0x0'));var util=require(_0x2b9f('0x1'));var logger=require(_0x2b9f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b9f('0x3'));var fs=require('fs');var path=require(_0x2b9f('0x4'));var rimraf=require(_0x2b9f('0x5'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0x2b9f('0x6')]=function(_0x1b4f36,_0x222d32){return _0x1b4f36[_0x2b9f('0x7')](_0x2b9f('0x8'),attributes,{'tableName':_0x2b9f('0x9'),'paranoid':![],'indexes':[{'name':_0x2b9f('0xa'),'fields':[_0x2b9f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f677d6d..bb87381 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 _0xc891=['client','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3d209a,_0x5441f4){var _0x23fe42=function(_0x39651e){while(--_0x39651e){_0x3d209a['push'](_0x3d209a['shift']());}};_0x23fe42(++_0x5441f4);}(_0xc891,0xc0));var _0x1c89=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc891[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1c89('0x0'));var BPromise=require(_0x1c89('0x1'));var rs=require(_0x1c89('0x2'));var fs=require('fs');var Redis=require(_0x1c89('0x3'));var db=require(_0x1c89('0x4'))['db'];var utils=require(_0x1c89('0x5'));var logger=require('../../config/logger')(_0x1c89('0x6'));var config=require(_0x1c89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c89('0x8')][_0x1c89('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4918e4,_0x184d5c,_0x37303d){return new BPromise(function(_0x5d936d,_0x2e1833){return client[_0x1c89('0xa')](_0x4918e4,_0x37303d)['then'](function(_0x530f56){logger[_0x1c89('0xb')](_0x1c89('0xc'),_0x184d5c,'request\x20sent');logger['debug'](_0x1c89('0xd'),_0x184d5c,_0x1c89('0xe'),JSON[_0x1c89('0xf')](_0x530f56));if(_0x530f56[_0x1c89('0x10')]){if(_0x530f56['error']['code']===0x1f4){logger[_0x1c89('0x10')](_0x1c89('0xc'),_0x184d5c,_0x530f56['error'][_0x1c89('0x11')]);return _0x2e1833(_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);}logger['error'](_0x1c89('0xc'),_0x184d5c,_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);return _0x5d936d(_0x530f56[_0x1c89('0x10')][_0x1c89('0x11')]);}else{logger['info'](_0x1c89('0xc'),_0x184d5c,_0x1c89('0xe'));_0x5d936d(_0x530f56[_0x1c89('0x12')]['message']);}})[_0x1c89('0x13')](function(_0x14e683){logger[_0x1c89('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x184d5c,_0x14e683);_0x2e1833(_0x14e683);});});} \ No newline at end of file +var _0x47a3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x47a3,0x6c));var _0x347a=function(_0xa86d9f,_0x51eaf6){_0xa86d9f=_0xa86d9f-0x0;var _0x227717=_0x47a3[_0xa86d9f];return _0x227717;};'use strict';var _=require(_0x347a('0x0'));var util=require(_0x347a('0x1'));var moment=require(_0x347a('0x2'));var BPromise=require(_0x347a('0x3'));var rs=require(_0x347a('0x4'));var fs=require('fs');var Redis=require(_0x347a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x347a('0x6'));var logger=require(_0x347a('0x7'))(_0x347a('0x8'));var config=require(_0x347a('0x9'));var jayson=require(_0x347a('0xa'));var client=jayson[_0x347a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3de943,_0x106959,_0x3f9192){return new BPromise(function(_0x3d8a33,_0x1e09a7){return client['request'](_0x3de943,_0x3f9192)[_0x347a('0xc')](function(_0xd6a451){logger[_0x347a('0xd')](_0x347a('0xe'),_0x106959,_0x347a('0xf'));logger[_0x347a('0x10')](_0x347a('0x11'),_0x106959,_0x347a('0xf'),JSON[_0x347a('0x12')](_0xd6a451));if(_0xd6a451[_0x347a('0x13')]){if(_0xd6a451['error'][_0x347a('0x14')]===0x1f4){logger[_0x347a('0x13')](_0x347a('0xe'),_0x106959,_0xd6a451[_0x347a('0x13')][_0x347a('0x15')]);return _0x1e09a7(_0xd6a451[_0x347a('0x13')][_0x347a('0x15')]);}logger[_0x347a('0x13')](_0x347a('0xe'),_0x106959,_0xd6a451[_0x347a('0x13')]['message']);return _0x3d8a33(_0xd6a451[_0x347a('0x13')]['message']);}else{logger[_0x347a('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x106959,'request\x20sent');_0x3d8a33(_0xd6a451[_0x347a('0x16')][_0x347a('0x15')]);}})['catch'](function(_0x591ff1){logger['error'](_0x347a('0xe'),_0x106959,_0x591ff1);_0x1e09a7(_0x591ff1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b75440b..e081856 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 _0x7651=['/describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0xbcc213,_0xefb217){var _0xf1a438=function(_0x3f8f04){while(--_0x3f8f04){_0xbcc213['push'](_0xbcc213['shift']());}};_0xf1a438(++_0xefb217);}(_0x7651,0x6c));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1765('0x0'));var util=require(_0x1765('0x1'));var path=require(_0x1765('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1765('0x3')]();var fs_extra=require(_0x1765('0x4'));var auth=require(_0x1765('0x5'));var interaction=require(_0x1765('0x6'));var config=require(_0x1765('0x7'));var controller=require(_0x1765('0x8'));router[_0x1765('0x9')]('/',auth[_0x1765('0xa')](),controller[_0x1765('0xb')]);router[_0x1765('0x9')](_0x1765('0xc'),auth[_0x1765('0xa')](),controller['describe']);router[_0x1765('0x9')]('/:id',auth[_0x1765('0xa')](),controller[_0x1765('0xd')]);router['post']('/',auth[_0x1765('0xa')](),controller[_0x1765('0xe')]);router[_0x1765('0xf')](_0x1765('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1765('0x11')](_0x1765('0x10'),auth['isAuthenticated'](),controller[_0x1765('0x12')]);module[_0x1765('0x13')]=router; \ No newline at end of file +var _0x87d5=['describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x236bf4,_0x1322e9){var _0x40d0eb=function(_0x4387cd){while(--_0x4387cd){_0x236bf4['push'](_0x236bf4['shift']());}};_0x40d0eb(++_0x1322e9);}(_0x87d5,0x185));var _0x587d=function(_0x264841,_0x346e09){_0x264841=_0x264841-0x0;var _0xa9d6e3=_0x87d5[_0x264841];return _0xa9d6e3;};'use strict';var multer=require('multer');var util=require(_0x587d('0x0'));var path=require(_0x587d('0x1'));var timeout=require(_0x587d('0x2'));var express=require(_0x587d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x587d('0x4'));var interaction=require(_0x587d('0x5'));var config=require(_0x587d('0x6'));var controller=require(_0x587d('0x7'));router[_0x587d('0x8')]('/',auth[_0x587d('0x9')](),controller['index']);router[_0x587d('0x8')](_0x587d('0xa'),auth['isAuthenticated'](),controller[_0x587d('0xb')]);router[_0x587d('0x8')](_0x587d('0xc'),auth[_0x587d('0x9')](),controller[_0x587d('0xd')]);router['post']('/',auth[_0x587d('0x9')](),controller[_0x587d('0xe')]);router[_0x587d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x587d('0x10')]);router[_0x587d('0x11')](_0x587d('0xc'),auth[_0x587d('0x9')](),controller[_0x587d('0x12')]);module[_0x587d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1632285..fb6a19d 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 _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x4e5564,_0x8c8c66){var _0x5ed04b=function(_0x3b6e6b){while(--_0x3b6e6b){_0x4e5564['push'](_0x4e5564['shift']());}};_0x5ed04b(++_0x8c8c66);}(_0x55e0,0xdc));var _0x055e=function(_0x130d1f,_0x19dd78){_0x130d1f=_0x130d1f-0x0;var _0x577e83=_0x55e0[_0x130d1f];return _0x577e83;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'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[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file +var _0xa74f=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','address','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','TEXT','stringify','input','name','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion'];(function(_0xf34895,_0x21fb70){var _0x143f44=function(_0x2e7730){while(--_0x2e7730){_0xf34895['push'](_0xf34895['shift']());}};_0x143f44(++_0x21fb70);}(_0xa74f,0x9a));var _0xfa74=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0xa74f[_0x58c20f];return _0x3b0318;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xfa74('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfa74('0x1')},'description':{'type':Sequelize[_0xfa74('0x2')]},'mapKey':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x4')},'customerAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfa74('0x9')]('rounded',_0xfa74('0xa')),'defaultValue':_0xfa74('0xb')},'header_online':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0xd')},'offline_chat_button':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'header_offline':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x12')},'noteTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'skipMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x14')},'ratingType':{'type':Sequelize[_0xfa74('0x9')]('star','thumb'),'defaultValue':_0xfa74('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':_0xfa74('0x18'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xfa74('0x19'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xfa74('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfa74('0x1a')](_0xfa74('0x1b'))?JSON['parse'](this['getDataValue'](_0xfa74('0x1b'))):{};},'set':function(_0xeb6c11){return this['setDataValue'](_0xfa74('0x1b'),JSON['stringify'](_0xeb6c11));}},'offlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':'input','props':{'title':_0xfa74('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xfa74('0x3'),'type':_0xfa74('0x3')},'variable':null},{'type':_0xfa74('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':_0xfa74('0x1d'),'helpText':_0xfa74('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xfa74('0x1a')]('offlineForm')?JSON['parse'](this[_0xfa74('0x1a')](_0xfa74('0x1f'))):{};},'set':function(_0x5df5cd){return this['setDataValue'](_0xfa74('0x1f'),JSON['stringify'](_0x5df5cd));}},'token':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfa74('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfa74('0x2')]},'waitingTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x20')},'waitingMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x23')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x24')},'skipUnmanaged':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfa74('0x16')]},'showAgentAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return _0xfa74('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x27')},'verticalAlignment':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x28')},'messagesAlignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x29')},'defaultTitle':{'type':Sequelize[_0xfa74('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x2b')},'systemAvatar':{'type':Sequelize[_0xfa74('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfa74('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'comment':_0xfa74('0x2d'),'set':function(_0x35f252){if(!_0x35f252)this['setDataValue'](_0xfa74('0x2e'),null);this[_0xfa74('0x2f')](_0xfa74('0x30'),_0x35f252);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x31')},'vidaooNote':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return _0xfa74('0x32');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfa74('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b8454fc..0e5af9c 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 _0x56fa=['removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','ioredis','../../config/logger','api','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','ChatWebsite','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rows','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','list','asc','contact','cf-connecting-ip','headers','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','findOrCreate','readFileSync','utf8','render','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','offline-chat','basename','openNewInteraction','transaction','bulkCreate','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','remove','addInteraction','omit','getInteractions','Owner','fullname','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','custom','increment','chatLicenseExceeded','Intervals','some','server/files/chat/iframe.ejs','address','remote','x-real-ip','connection','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','ChatApplication','priority','finally','getApplications','chatProactiveAction','addProactiveActions','getFields','online','false','offlineForm','onlineForm','fromKey','getOfflineMessages','Contact','Attachments','addAgents','spread','emit','userChatWebsite:save'];(function(_0x177846,_0x12b670){var _0x242022=function(_0x54a4b4){while(--_0x54a4b4){_0x177846['push'](_0x177846['shift']());}};_0x242022(++_0x12b670);}(_0x56fa,0x12c));var _0xa56f=function(_0x154f92,_0x169556){_0x154f92=_0x154f92-0x0;var _0x4c6cd6=_0x56fa[_0x154f92];return _0x4c6cd6;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0xa56f('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xa56f('0x1'));var fs=require('fs');var fs_extra=require(_0xa56f('0x2'));var _=require(_0xa56f('0x3'));var querystring=require('querystring');var Redis=require(_0xa56f('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xa56f('0x5'))(_0xa56f('0x6'));var config=require('../../config/environment');var url=require(_0xa56f('0x7'));var db=require(_0xa56f('0x8'))['db'];config[_0xa56f('0x9')]=_[_0xa56f('0xa')](config['redis'],{'host':_0xa56f('0xb'),'port':0x18eb});var socket=require(_0xa56f('0xc'))(new Redis(config[_0xa56f('0x9')]));require(_0xa56f('0xd'))['register'](socket);var htmlToText=require(_0xa56f('0xe'));var jayson=require('jayson/promise');var client=jayson[_0xa56f('0xf')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xa56f('0xf')][_0xa56f('0x10')]({'port':0x232b});var client9001=jayson[_0xa56f('0xf')][_0xa56f('0x10')]({'port':0x2329});function respondWithRpcPromise(_0xe10459,_0x1e4a6a,_0x4ecdf0,_0x468b3e){return new BPromise(function(_0x28555d,_0x2828fc){var _0x145daf=_0x468b3e||client;return _0x145daf['request'](_0xe10459,_0x4ecdf0)['then'](function(_0x178ec6){logger[_0xa56f('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x1e4a6a,_0xa56f('0x12'));logger[_0xa56f('0x13')](_0xa56f('0x14'),_0x1e4a6a,'request\x20sent',JSON[_0xa56f('0x15')](_0x178ec6));if(_0x178ec6['error']){if(_0x178ec6[_0xa56f('0x16')][_0xa56f('0x17')]===0x1f4){logger['error'](_0xa56f('0x18'),_0x1e4a6a,_0x178ec6[_0xa56f('0x16')][_0xa56f('0x19')]);return _0x2828fc(_0x178ec6[_0xa56f('0x16')]['message']);}logger[_0xa56f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1e4a6a,_0x178ec6[_0xa56f('0x16')][_0xa56f('0x19')]);return _0x28555d(_0x178ec6['error']['message']);}else{logger[_0xa56f('0x11')](_0xa56f('0x18'),_0x1e4a6a,_0xa56f('0x12'));_0x28555d(_0x178ec6[_0xa56f('0x1a')]['message']);}})['catch'](function(_0x28db2a){logger['error'](_0xa56f('0x18'),_0x1e4a6a,_0x28db2a);_0x2828fc(_0x28db2a);});});}function respondWithStatusCode(_0x26d447,_0xfb9039){_0xfb9039=_0xfb9039||0xcc;return function(_0x4fb7cc){if(_0x4fb7cc){return _0x26d447[_0xa56f('0x1b')](_0xfb9039);}return _0x26d447[_0xa56f('0x1c')](_0xfb9039)[_0xa56f('0x1d')]();};}function respondWithResult(_0x1bf989,_0x3cba93){_0x3cba93=_0x3cba93||0xc8;return function(_0x5596ad){if(_0x5596ad){return _0x1bf989[_0xa56f('0x1c')](_0x3cba93)[_0xa56f('0x1e')](_0x5596ad);}};}function respondWithFilteredResult(_0x4c319b,_0x1c7043){return function(_0x516c33){if(_0x516c33){var _0x6681c3=typeof _0x1c7043[_0xa56f('0x1f')]===_0xa56f('0x20')&&typeof _0x1c7043['limit']===_0xa56f('0x20');var _0x3ead12=_0x516c33[_0xa56f('0x21')];var _0x446742=_0x6681c3?0x0:_0x1c7043['offset'];var _0xed74f1=_0x6681c3?_0x516c33[_0xa56f('0x21')]:_0x1c7043[_0xa56f('0x1f')]+_0x1c7043[_0xa56f('0x22')];var _0xf02475;if(_0xed74f1>=_0x3ead12){_0xed74f1=_0x3ead12;_0xf02475=0xc8;}else{_0xf02475=0xce;}_0x4c319b['status'](_0xf02475);return _0x4c319b[_0xa56f('0x23')](_0xa56f('0x24'),_0x446742+'-'+_0xed74f1+'/'+_0x3ead12)[_0xa56f('0x1e')](_0x516c33);}return null;};}function saveUpdates(_0xc3f8e2){return function(_0x261fbb){if(_0x261fbb){return _0x261fbb[_0xa56f('0x25')](_0xc3f8e2)['then'](function(_0x265cd2){return _0x265cd2;});}return null;};}function removeEntity(_0x36d83b){return function(_0x2da3b1){if(_0x2da3b1){return _0x2da3b1[_0xa56f('0x26')]()[_0xa56f('0x27')](function(){var _0x4ef7a5=_0x2da3b1[_0xa56f('0x28')]({'plain':!![]});var _0x3154bf=_0xa56f('0x29');return db[_0xa56f('0x2a')][_0xa56f('0x26')]({'where':{'type':_0x3154bf,'resourceId':_0x4ef7a5['id']}})[_0xa56f('0x27')](function(){return _0x2da3b1;});})[_0xa56f('0x27')](function(){_0x36d83b[_0xa56f('0x1c')](0xcc)[_0xa56f('0x1d')]();});}};}function handleEntityNotFound(_0x1efe36){return function(_0x404822){if(!_0x404822){_0x1efe36[_0xa56f('0x1b')](0x194);}return _0x404822;};}function handleError(_0x25b064,_0x58ca30){_0x58ca30=_0x58ca30||0x1f4;return function(_0x255e48){logger[_0xa56f('0x16')](_0x255e48[_0xa56f('0x2b')]);if(_0x255e48[_0xa56f('0x2c')]){delete _0x255e48['name'];}_0x25b064['status'](_0x58ca30)[_0xa56f('0x2d')](_0x255e48);};}exports[_0xa56f('0x2e')]=function(_0x49e84e,_0x1f7490){var _0x33957e={'include':[{'model':db[_0xa56f('0x2f')],'as':'mandatoryDispositionPause'}]},_0x1ecb41={},_0x2d185b={'count':0x0,'rows':[]};var _0x1ae361=_['map'](db[_0xa56f('0x30')][_0xa56f('0x31')],function(_0x4065b6){return{'name':_0x4065b6['fieldName'],'type':_0x4065b6['type'][_0xa56f('0x32')]};});_0x1ecb41[_0xa56f('0x33')]=_[_0xa56f('0x34')](_0x1ae361,_0xa56f('0x2c'));_0x1ecb41[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x49e84e[_0xa56f('0x35')]);_0x1ecb41['filters']=_[_0xa56f('0x37')](_0x1ecb41[_0xa56f('0x33')],_0x1ecb41['query']);_0x33957e[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x1ecb41['model'],qs['fields'](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x39')]));_0x33957e[_0xa56f('0x38')]=_0x33957e['attributes'][_0xa56f('0x3a')]?_0x33957e['attributes']:_0x1ecb41[_0xa56f('0x33')];if(!_0x49e84e[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x33957e[_0xa56f('0x22')]=qs['limit'](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x22')]);_0x33957e['offset']=qs['offset'](_0x49e84e[_0xa56f('0x35')]['offset']);}_0x33957e[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x49e84e[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x33957e[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x49e84e[_0xa56f('0x35')],_0x1ecb41[_0xa56f('0x40')]),_0x1ae361);if(_0x49e84e[_0xa56f('0x35')][_0xa56f('0x42')]){_0x33957e[_0xa56f('0x3f')]=_['merge'](_0x33957e['where'],{'$or':_[_0xa56f('0x34')](_0x1ae361,function(_0xaa635f){if(_0xaa635f['type']!==_0xa56f('0x43')){var _0x369d9d={};_0x369d9d[_0xaa635f[_0xa56f('0x2c')]]={'$like':'%'+_0x49e84e['query'][_0xa56f('0x42')]+'%'};return _0x369d9d;}})});}_0x33957e=_[_0xa56f('0x44')]({},_0x33957e,_0x49e84e[_0xa56f('0x45')]);var _0x315545={'where':_0x33957e['where']};return db[_0xa56f('0x30')][_0xa56f('0x21')](_0x315545)[_0xa56f('0x27')](function(_0x2f3a44){_0x2d185b['count']=_0x2f3a44;if(_0x49e84e[_0xa56f('0x35')][_0xa56f('0x46')]){_0x33957e[_0xa56f('0x47')]=[{'all':!![]}];}return db[_0xa56f('0x30')][_0xa56f('0x48')](_0x33957e);})[_0xa56f('0x27')](function(_0x692ed1){_0x2d185b['rows']=_0x692ed1;return _0x2d185b;})[_0xa56f('0x27')](respondWithFilteredResult(_0x1f7490,_0x33957e))['catch'](handleError(_0x1f7490,null));};exports[_0xa56f('0x49')]=function(_0xae9670,_0xa1d4f7){var _0x2e0594={'raw':![],'where':{'id':_0xae9670[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x2f')],'as':_0xa56f('0x4b')}]},_0x5a6881={};_0x5a6881[_0xa56f('0x33')]=_[_0xa56f('0x36')](db[_0xa56f('0x30')][_0xa56f('0x31')]);_0x5a6881[_0xa56f('0x35')]=_['keys'](_0xae9670[_0xa56f('0x35')]);_0x5a6881['filters']=_[_0xa56f('0x37')](_0x5a6881[_0xa56f('0x33')],_0x5a6881[_0xa56f('0x35')]);_0x2e0594[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x5a6881[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0xae9670[_0xa56f('0x35')][_0xa56f('0x39')]));_0x2e0594[_0xa56f('0x38')]=_0x2e0594[_0xa56f('0x38')][_0xa56f('0x3a')]?_0x2e0594[_0xa56f('0x38')]:_0x5a6881[_0xa56f('0x33')];if(_0xae9670['query'][_0xa56f('0x46')]){_0x2e0594[_0xa56f('0x47')]=[{'all':!![]}];}_0x2e0594=_[_0xa56f('0x44')]({},_0x2e0594,_0xae9670[_0xa56f('0x45')]);return db[_0xa56f('0x30')]['find'](_0x2e0594)['then'](handleEntityNotFound(_0xa1d4f7,null))[_0xa56f('0x27')](respondWithResult(_0xa1d4f7,null))[_0xa56f('0x4c')](handleError(_0xa1d4f7,null));};exports[_0xa56f('0x4d')]=function(_0x588754,_0x30943e){return db[_0xa56f('0x30')][_0xa56f('0x4d')](_0x588754[_0xa56f('0x4e')],{})['then'](function(_0x1e2d9c){var _0x17cc44=_0x588754[_0xa56f('0x4f')]['get']({'plain':!![]});if(!_0x17cc44)throw new Error(_0xa56f('0x50'));if(_0x17cc44['role']==='user'){var _0x7c7fef=_0x1e2d9c[_0xa56f('0x28')]({'plain':!![]});var _0x49603c=_0xa56f('0x29');return db[_0xa56f('0x51')][_0xa56f('0x52')]({'where':{'name':_0x49603c,'userProfileId':_0x17cc44[_0xa56f('0x53')]},'raw':!![]})['then'](function(_0x3fc2ae){if(_0x3fc2ae&&_0x3fc2ae['autoAssociation']===0x0){return db[_0xa56f('0x2a')]['create']({'name':_0x7c7fef[_0xa56f('0x2c')],'resourceId':_0x7c7fef['id'],'type':_0x3fc2ae[_0xa56f('0x2c')],'sectionId':_0x3fc2ae['id']},{})['then'](function(){return _0x1e2d9c;});}else{return _0x1e2d9c;}})[_0xa56f('0x4c')](function(_0x43542e){logger['error'](_0xa56f('0x54'),_0x43542e);throw _0x43542e;});}return _0x1e2d9c;})[_0xa56f('0x27')](respondWithResult(_0x30943e,0xc9))[_0xa56f('0x4c')](handleError(_0x30943e,null));};exports['update']=function(_0xdc840c,_0x33c9e4){if(_0xdc840c[_0xa56f('0x4e')]['id']){delete _0xdc840c['body']['id'];}return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0xdc840c['params']['id']},'include':[{'model':db[_0xa56f('0x2f')],'as':_0xa56f('0x4b')}]})[_0xa56f('0x27')](handleEntityNotFound(_0x33c9e4,null))[_0xa56f('0x27')](saveUpdates(_0xdc840c['body'],null))['then'](respondWithResult(_0x33c9e4,null))[_0xa56f('0x4c')](handleError(_0x33c9e4,null));};exports[_0xa56f('0x26')]=function(_0x34c359,_0x234d3b){return db[_0xa56f('0x30')]['find']({'where':{'id':_0x34c359[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x234d3b,null))[_0xa56f('0x27')](removeEntity(_0x234d3b,null))[_0xa56f('0x4c')](handleError(_0x234d3b,null));};exports[_0xa56f('0x55')]=function(_0x12723c,_0x4fa285){return db['ChatWebsite'][_0xa56f('0x55')]()[_0xa56f('0x27')](respondWithResult(_0x4fa285,null))[_0xa56f('0x4c')](handleError(_0x4fa285,null));};exports[_0xa56f('0x56')]=function(_0x4c8d05,_0x4dce6d){if(_0x4c8d05[_0xa56f('0x4e')]['id']){delete _0x4c8d05[_0xa56f('0x4e')]['id'];}return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x4c8d05[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x4dce6d,null))[_0xa56f('0x27')](function(_0x4f2c41){if(_0x4f2c41){_0x4c8d05[_0xa56f('0x4e')][_0xa56f('0x57')]=_0x4f2c41['id'];return db[_0xa56f('0x58')][_0xa56f('0x4d')](_0x4c8d05[_0xa56f('0x4e')]);}})[_0xa56f('0x27')](respondWithResult(_0x4dce6d,null))[_0xa56f('0x4c')](handleError(_0x4dce6d,null));};exports[_0xa56f('0x59')]=function(_0x48a074,_0x5ddcb6){var _0x5647c0={'raw':![],'where':{}};var _0x37dd69={};var _0x34b2a2={'count':0x0,'rows':[]};return db[_0xa56f('0x30')]['findOne']({'where':{'id':_0x48a074[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x5ddcb6,null))['then'](function(_0x4cc990){if(_0x4cc990){_0x37dd69['model']=_['keys'](db[_0xa56f('0x58')][_0xa56f('0x31')]);_0x37dd69['query']=_[_0xa56f('0x36')](_0x48a074[_0xa56f('0x35')]);_0x37dd69[_0xa56f('0x40')]=_['intersection'](_0x37dd69[_0xa56f('0x33')],_0x37dd69[_0xa56f('0x35')]);_0x5647c0[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x37dd69[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x39')]));_0x5647c0['attributes']=_0x5647c0['attributes'][_0xa56f('0x3a')]?_0x5647c0[_0xa56f('0x38')]:_0x37dd69[_0xa56f('0x33')];if(!_0x48a074['query'][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x5647c0[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x22')]);_0x5647c0[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x48a074[_0xa56f('0x35')][_0xa56f('0x1f')]);}_0x5647c0[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x48a074['query'][_0xa56f('0x3e')]);_0x5647c0[_0xa56f('0x3f')]=qs['filters'](_['pick'](_0x48a074[_0xa56f('0x35')],_0x37dd69[_0xa56f('0x40')]));_0x5647c0[_0xa56f('0x3f')]['ChatWebsiteId']=_0x4cc990['id'];if(_0x48a074['query'][_0xa56f('0x42')]){_0x5647c0[_0xa56f('0x3f')]=_['merge'](_0x5647c0[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x5647c0[_0xa56f('0x38')],function(_0x59330c){var _0xeed3f={};_0xeed3f[_0x59330c]={'$like':'%'+_0x48a074['query'][_0xa56f('0x42')]+'%'};return _0xeed3f;})});}_0x5647c0=_[_0xa56f('0x44')]({},_0x5647c0,_0x48a074[_0xa56f('0x45')]);return db[_0xa56f('0x58')][_0xa56f('0x21')]({'where':_0x5647c0[_0xa56f('0x3f')]})['then'](function(_0x3a89e3){_0x34b2a2[_0xa56f('0x21')]=_0x3a89e3;if(_0x48a074[_0xa56f('0x35')][_0xa56f('0x46')]){_0x5647c0['include']=[{'all':!![]}];}return db[_0xa56f('0x58')][_0xa56f('0x48')](_0x5647c0);})[_0xa56f('0x27')](function(_0x1404d1){_0x34b2a2['rows']=_0x1404d1;return _0x34b2a2;});}})['then'](respondWithFilteredResult(_0x5ddcb6,_0x5647c0))[_0xa56f('0x4c')](handleError(_0x5ddcb6,null));};exports[_0xa56f('0x5a')]=function(_0x55ee68,_0x358aa5){return db[_0xa56f('0x30')]['find']({'where':{'id':_0x55ee68[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x358aa5,null))[_0xa56f('0x27')](function(_0x5343ef){if(_0x5343ef){return _0x5343ef[_0xa56f('0x5a')](_0x55ee68[_0xa56f('0x35')][_0xa56f('0x5b')]);}})['then'](respondWithStatusCode(_0x358aa5,null))[_0xa56f('0x4c')](handleError(_0x358aa5,null));};exports[_0xa56f('0x5c')]=function(_0x46ef1a,_0x1ba03e){if(_0x46ef1a[_0xa56f('0x4e')]['id']){delete _0x46ef1a[_0xa56f('0x4e')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x46ef1a[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ba03e,null))[_0xa56f('0x27')](function(_0x27fed8){if(_0x27fed8){_0x46ef1a[_0xa56f('0x4e')][_0xa56f('0x57')]=_0x27fed8['id'];return db[_0xa56f('0x5d')][_0xa56f('0x4d')](_0x46ef1a[_0xa56f('0x4e')]);}})[_0xa56f('0x27')](respondWithResult(_0x1ba03e,null))['catch'](handleError(_0x1ba03e,null));};exports[_0xa56f('0x5e')]=function(_0x270c11,_0x508b05){var _0x57362d={'raw':![],'where':{}};var _0x5b9072={};var _0xa9872d={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x270c11[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x508b05,null))['then'](function(_0x273c66){if(_0x273c66){_0x5b9072[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['CannedAnswer']['rawAttributes']);_0x5b9072['query']=_[_0xa56f('0x36')](_0x270c11[_0xa56f('0x35')]);_0x5b9072[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x5b9072[_0xa56f('0x33')],_0x5b9072[_0xa56f('0x35')]);_0x57362d['attributes']=_[_0xa56f('0x37')](_0x5b9072['model'],qs[_0xa56f('0x39')](_0x270c11[_0xa56f('0x35')][_0xa56f('0x39')]));_0x57362d['attributes']=_0x57362d[_0xa56f('0x38')]['length']?_0x57362d[_0xa56f('0x38')]:_0x5b9072[_0xa56f('0x33')];if(!_0x270c11[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x57362d[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x270c11[_0xa56f('0x35')]['limit']);_0x57362d[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x270c11[_0xa56f('0x35')][_0xa56f('0x1f')]);}_0x57362d[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x270c11['query'][_0xa56f('0x3e')]);_0x57362d[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x270c11[_0xa56f('0x35')],_0x5b9072[_0xa56f('0x40')]));_0x57362d['where']['ChatWebsiteId']=_0x273c66['id'];if(_0x270c11[_0xa56f('0x35')][_0xa56f('0x42')]){_0x57362d[_0xa56f('0x3f')]=_['merge'](_0x57362d[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x57362d['attributes'],function(_0x2f164d){var _0x2c826e={};_0x2c826e[_0x2f164d]={'$like':'%'+_0x270c11[_0xa56f('0x35')]['filter']+'%'};return _0x2c826e;})});}_0x57362d=_[_0xa56f('0x44')]({},_0x57362d,_0x270c11['options']);return db[_0xa56f('0x5d')]['count']({'where':_0x57362d['where']})['then'](function(_0x2411a5){_0xa9872d[_0xa56f('0x21')]=_0x2411a5;if(_0x270c11['query']['includeAll']){_0x57362d[_0xa56f('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa56f('0x48')](_0x57362d);})[_0xa56f('0x27')](function(_0x1e7027){_0xa9872d[_0xa56f('0x60')]=_0x1e7027;return _0xa9872d;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x508b05,_0x57362d))['catch'](handleError(_0x508b05,null));};exports[_0xa56f('0x61')]=function(_0x59df31,_0x500b2f){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x59df31[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x500b2f,null))[_0xa56f('0x27')](function(_0x44618d){if(_0x44618d){return _0x44618d['removeAnswers'](_0x59df31['query']['ids']);}})[_0xa56f('0x27')](respondWithStatusCode(_0x500b2f,null))[_0xa56f('0x4c')](handleError(_0x500b2f,null));};exports[_0xa56f('0x62')]=function(_0x505fb8,_0x96da69){_0x505fb8[_0xa56f('0x4e')][_0xa56f('0x63')]=_0x505fb8[_0xa56f('0x64')][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x505fb8[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x96da69,null))[_0xa56f('0x27')](saveUpdates(_0x505fb8['body'],null))[_0xa56f('0x27')](respondWithResult(_0x96da69,null))[_0xa56f('0x4c')](handleError(_0x96da69,null));};exports[_0xa56f('0x66')]=function(_0x420f73,_0x1d484d){_0x420f73[_0xa56f('0x4e')][_0xa56f('0x67')]=_0x420f73['file'][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x420f73[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1d484d,null))[_0xa56f('0x27')](saveUpdates(_0x420f73[_0xa56f('0x4e')],null))['then'](respondWithResult(_0x1d484d,null))['catch'](handleError(_0x1d484d,null));};exports['addCustomerAvatar']=function(_0x1f35db,_0x104a75){_0x1f35db[_0xa56f('0x4e')][_0xa56f('0x68')]=_0x1f35db[_0xa56f('0x64')][_0xa56f('0x65')];return db[_0xa56f('0x30')]['find']({'where':{'id':_0x1f35db[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x104a75,null))['then'](saveUpdates(_0x1f35db['body'],null))[_0xa56f('0x27')](respondWithResult(_0x104a75,null))[_0xa56f('0x4c')](handleError(_0x104a75,null));};exports[_0xa56f('0x69')]=function(_0x481453,_0x3c31d6){_0x481453[_0xa56f('0x4e')][_0xa56f('0x6a')]=_0x481453['file'][_0xa56f('0x65')];return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x481453[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x3c31d6,null))[_0xa56f('0x27')](saveUpdates(_0x481453[_0xa56f('0x4e')],null))[_0xa56f('0x27')](respondWithResult(_0x3c31d6,null))['catch'](handleError(_0x3c31d6,null));};exports[_0xa56f('0x6b')]=function(_0x2792f9,_0x3dbf82){var _0x1974f1=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x6e'));var _0x531468={'where':{'id':_0x2792f9[_0xa56f('0x4a')]['id']},'attributes':['id',_0xa56f('0x63')],'raw':!![]};var _0x36215c=![];return require(_0xa56f('0x6f'))[_0xa56f('0x70')]()[_0xa56f('0x27')](function(_0x426e53){if(_0x426e53){_0x36215c=_0x426e53['custom'];}})[_0xa56f('0x27')](function(){return db[_0xa56f('0x30')]['find'](_0x531468);})['then'](handleEntityNotFound(_0x3dbf82,null))[_0xa56f('0x27')](function(_0x944838){if(_0x944838){if(!_['isNil'](_0x944838[_0xa56f('0x63')])){if(fs[_0xa56f('0x71')](path['join'](config[_0xa56f('0x6d')],_0xa56f('0x72'),_0x944838[_0xa56f('0x63')]))&&_0x36215c){_0x1974f1=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/logos/',_0x944838[_0xa56f('0x63')]);}}return _0x3dbf82[_0xa56f('0x73')](_0x1974f1);}})[_0xa56f('0x4c')](handleError(_0x3dbf82,null));};exports[_0xa56f('0x74')]=function(_0x283b3a,_0x516689){var _0x937b09=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x75'));var _0x2a122b={'where':{'id':_0x283b3a['params']['id']},'attributes':['id',_0xa56f('0x67')],'raw':!![]};return db[_0xa56f('0x30')][_0xa56f('0x52')](_0x2a122b)[_0xa56f('0x27')](handleEntityNotFound(_0x516689,null))[_0xa56f('0x27')](function(_0x4e00d4){if(_0x4e00d4){if(!_[_0xa56f('0x76')](_0x4e00d4[_0xa56f('0x67')])){if(fs['existsSync'](path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x4e00d4[_0xa56f('0x67')]))){_0x937b09=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/avatars/',_0x4e00d4[_0xa56f('0x67')]);}}return _0x516689[_0xa56f('0x73')](_0x937b09);}})[_0xa56f('0x4c')](handleError(_0x516689,null));};exports[_0xa56f('0x78')]=function(_0xb0699f,_0x2cb7b5){var _0x360a12=path[_0xa56f('0x6c')](config['root'],_0xa56f('0x79'));var _0x1ebfd6={'where':{'id':_0xb0699f['params']['id']},'attributes':['id',_0xa56f('0x68'),_0xa56f('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0x1ebfd6)[_0xa56f('0x27')](handleEntityNotFound(_0x2cb7b5,null))['then'](function(_0x5ad89b){if(_0x5ad89b){if(!_['isNil'](_0x5ad89b[_0xa56f('0x68')])){if(fs[_0xa56f('0x71')](path['join'](config['root'],_0xa56f('0x77'),_0x5ad89b[_0xa56f('0x68')]))&&_0x5ad89b['showCustomerAvatar']){_0x360a12=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x5ad89b[_0xa56f('0x68')]);}}return _0x2cb7b5[_0xa56f('0x73')](_0x360a12);}})[_0xa56f('0x4c')](handleError(_0x2cb7b5,null));};exports[_0xa56f('0x7b')]=function(_0x4f896f,_0x58dccb){var _0x18d3ae=path['join'](config[_0xa56f('0x6d')],_0xa56f('0x7c'));var _0x21056e={'where':{'id':_0x4f896f[_0xa56f('0x4a')]['id']},'attributes':['id',_0xa56f('0x6a')],'raw':!![]};return db['ChatWebsite']['find'](_0x21056e)[_0xa56f('0x27')](handleEntityNotFound(_0x58dccb,null))[_0xa56f('0x27')](function(_0x31b230){if(_0x31b230){if(!_['isNil'](_0x31b230[_0xa56f('0x6a')])){if(fs['existsSync'](path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server/files/images/avatars/',_0x31b230[_0xa56f('0x6a')]))){_0x18d3ae=path['join'](config[_0xa56f('0x6d')],_0xa56f('0x77'),_0x31b230['systemAvatar']);}}return _0x58dccb[_0xa56f('0x73')](_0x18d3ae);}})[_0xa56f('0x4c')](handleError(_0x58dccb,null));};exports[_0xa56f('0x7d')]=function(_0x502609,_0x543cd9){var _0x5db351=require(_0xa56f('0x7e'));var _0x57103d=new _0x5db351();var _0x2b2fdd=_0x57103d[_0xa56f('0x7f')](_0x502609['headers'][_0xa56f('0x80')])[_0xa56f('0x81')]();var _0x180a8f={'body':_0x502609[_0xa56f('0x4e')],'channel':_0xa56f('0x82')};var _0x235ed1=[];var _0x1e0a7=[];var _0x5e4efd={};var _0x5068ca=![];return db['CmContact'][_0xa56f('0x55')]()[_0xa56f('0x27')](function(_0x2dcf08){if(!_0x2dcf08){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x85'));}_0x235ed1=_[_0xa56f('0x86')](_[_0xa56f('0x36')](_0x2dcf08),['createdAt',_0xa56f('0x87')]);_0x1e0a7=_[_0xa56f('0x86')](_[_0xa56f('0x36')](_0x2dcf08),[_0xa56f('0x88'),_0xa56f('0x87'),_0xa56f('0x89'),_0xa56f('0x8a')]);if(_0x502609[_0xa56f('0x4e')]['id']){delete _0x502609['body']['id'];}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x8b')])){throw new db['Sequelize']['ValidationError'](_0xa56f('0x8c'));}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x4e')])||_0x502609[_0xa56f('0x4e')][_0xa56f('0x4e')]===''){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x8d'));}if(_[_0xa56f('0x76')](_0x502609[_0xa56f('0x4e')][_0xa56f('0x8e')])){throw new db[(_0xa56f('0x83'))]['ValidationError'](_0xa56f('0x8f')+_0x1e0a7);}if(!_['includes'](_0x1e0a7,_0x502609['body'][_0xa56f('0x8e')])){throw new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x90')+_0x1e0a7);}_0x5e4efd[_0x502609['body'][_0xa56f('0x8e')]]=_0x502609['body'][_0xa56f('0x8b')];})['then'](function(){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x502609[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x91')],'as':_0xa56f('0x92'),'include':[{'model':db[_0xa56f('0x93')],'as':_0xa56f('0x94'),'where':_0x5e4efd,'limit':0x1,'order':[[_0xa56f('0x87'),_0xa56f('0x95')]]}]},{'model':db['ChatApplication'],'as':_0xa56f('0x96')}]});})[_0xa56f('0x27')](handleEntityNotFound(_0x543cd9,null))['then'](function(_0x11e7b2){if(_0x11e7b2&&_0x11e7b2[_0xa56f('0x92')]){_0x180a8f[_0xa56f('0x97')]=_0x11e7b2;_0x180a8f[_0xa56f('0x98')]=_0x11e7b2[_0xa56f('0x96')];_0x180a8f[_0xa56f('0x99')]=_0x11e7b2[_0xa56f('0x92')];_0x180a8f[_0xa56f('0x98')]=_['orderBy'](_0x180a8f['applications'],['priority'],[_0xa56f('0x9a')]);if(_0x180a8f['account'][_0xa56f('0x96')]){delete _0x180a8f[_0xa56f('0x97')][_0xa56f('0x96')];}if(_0x180a8f[_0xa56f('0x97')][_0xa56f('0x92')]&&_0x180a8f[_0xa56f('0x97')]['List'][_0xa56f('0x94')][_0xa56f('0x3a')]){return _0x180a8f[_0xa56f('0x97')][_0xa56f('0x92')][_0xa56f('0x94')][0x0];}var _0x57db7d=_[_0xa56f('0xa')](_0x502609['body'],{'firstName':_0x502609[_0xa56f('0x4e')][_0xa56f('0x8b')],'ListId':_0x11e7b2[_0xa56f('0x8a')]});_0x57db7d[_0x502609[_0xa56f('0x4e')]['mapKey']]=_0x502609[_0xa56f('0x4e')]['from'];return db[_0xa56f('0x93')][_0xa56f('0x4d')](_0x57db7d,{'fields':_0x235ed1,'raw':!![]});}})[_0xa56f('0x27')](handleEntityNotFound(_0x543cd9,null))[_0xa56f('0x27')](function(_0x2bc455){_0x180a8f[_0xa56f('0x9b')]=_0x2bc455;var _0x5c2e77=_0x502609[_0xa56f('0x4e')]['customerIp'];if(_0x502609['headers'][_0xa56f('0x9c')]){_0x5c2e77=_0x502609[_0xa56f('0x9d')][_0xa56f('0x9c')];}else if(_0x502609[_0xa56f('0x9d')][_0xa56f('0x9e')]){_0x5c2e77=_[_0xa56f('0x9f')](_0x502609[_0xa56f('0x9d')]['x-forwarded-for'][_0xa56f('0xa0')](','));}if(_0x2bc455){var _0x201c4d={'ContactId':_0x2bc455['id'],'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'from':(_0x2bc455[_0xa56f('0xa1')]||'')+'\x20'+(_0x2bc455['lastName']||''),'customerIp':_0x5c2e77,'customerPort':_0x502609[_0xa56f('0x9d')][_0xa56f('0xa2')]?_0x502609[_0xa56f('0x9d')][_0xa56f('0xa2')]:null,'referer':_0x502609[_0xa56f('0x4e')][_0xa56f('0xa3')],'browserName':_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0x2c')]&&_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]?util[_0xa56f('0xa6')](_0xa56f('0xa7'),_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0x2c')],_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]):'unknown','browserVersion':_0x2b2fdd[_0xa56f('0xa4')][_0xa56f('0xa5')]||'unknown','osName':util['format'](_0xa56f('0xa7'),_0x2b2fdd['os'][_0xa56f('0x2c')],_0x2b2fdd['os']['version']),'osVersion':_0x2b2fdd['os'][_0xa56f('0xa5')],'deviceModel':_0x2b2fdd[_0xa56f('0xa8')]['model']&&_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xa9')]?util[_0xa56f('0xa6')]('%s\x20%s\x20%s',_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0x33')],_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xa9')],_0x2b2fdd[_0xa56f('0xa8')][_0xa56f('0xaa')]):null,'deviceVendor':_0x2b2fdd[_0xa56f('0xa8')]['vendor'],'deviceType':_0x2b2fdd['device'][_0xa56f('0xaa')],'formData':JSON[_0xa56f('0x15')](_0x502609[_0xa56f('0x4e')])};var _0x1c0ea4={'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'closed':![]};if(_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]){_0x1c0ea4[_0xa56f('0xab')]=_0x502609['body'][_0xa56f('0xab')];return db[_0xa56f('0xac')][_0xa56f('0x52')]({'where':_0x1c0ea4})[_0xa56f('0x27')](function(_0x812c9c){if(_0x812c9c){return[_0x812c9c,![]];}_0x201c4d[_0xa56f('0xab')]=_0x502609[_0xa56f('0x4e')]['threadId'];_0x201c4d[_0xa56f('0xad')]=_0x502609[_0xa56f('0x4e')][_0xa56f('0xad')];return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)['then'](function(_0x59e617){return[_0x59e617,!![]];});});}_0x1c0ea4[_0xa56f('0xae')]=_0x2bc455['id'];if(_0x502609['body'][_0xa56f('0xaf')]&&_0x502609[_0xa56f('0x4e')][_0xa56f('0xaf')]['id']){_0x1c0ea4['id']=_0x502609[_0xa56f('0x4e')][_0xa56f('0xaf')]['id'];return db['ChatInteraction']['find']({'where':_0x1c0ea4})[_0xa56f('0x27')](function(_0x5ba082){if(_0x5ba082){return[_0x5ba082,![]];}return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)[_0xa56f('0x27')](function(_0x77ae9f){return[_0x77ae9f,!![]];});});}return db[_0xa56f('0xac')][_0xa56f('0x4d')](_0x201c4d)[_0xa56f('0x27')](function(_0x3cc61c){return[_0x3cc61c,!![]];});}})['spread'](function(_0xa20249,_0x1ef907){if(_0xa20249){_0x5068ca=_0x1ef907;if(!_0x1ef907){var _0x45bf0b={'from':(_0x180a8f[_0xa56f('0x9b')]['firstName']||'')+'\x20'+(_0x180a8f['contact'][_0xa56f('0xb0')]||'')};if(_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]&&_0x502609[_0xa56f('0x4e')]['messageId']&&_0x502609[_0xa56f('0x4e')][_0xa56f('0xab')]!=_0x502609[_0xa56f('0x4e')][_0xa56f('0xb1')]){_0x45bf0b[_0xa56f('0xab')]=_0x502609[_0xa56f('0x4e')][_0xa56f('0xb1')];}return _0xa20249[_0xa56f('0x25')](_0x45bf0b);}else{return _0xa20249;}}})[_0xa56f('0x27')](function(_0x4b5876){_0x180a8f['interaction']=_0x4b5876['get']({'plain':!![]});_0x180a8f[_0xa56f('0xaf')][_0xa56f('0xb2')]=_0x5068ca;if(_0x180a8f['interaction'][_0xa56f('0xb2')]){if(_0x180a8f[_0xa56f('0x97')][_0xa56f('0xb3')]){_0x180a8f['applications'][_0xa56f('0xb4')]({'id':0x0,'priority':_0x180a8f[_0xa56f('0x98')][_0xa56f('0x3a')]+0x1,'app':_0xa56f('0xb5'),'appdata':_0xa56f('0xb6'),'interval':_0xa56f('0xb7')});}}return db['ChatMessage'][_0xa56f('0x4d')]({'body':_0x502609['body']['body'],'ChatWebsiteId':_0x502609[_0xa56f('0x4a')]['id'],'ChatInteractionId':_0x4b5876['id'],'direction':'in','ContactId':_0x180a8f[_0xa56f('0x9b')]['id'],'AttachmentId':_0x502609[_0xa56f('0x4e')][_0xa56f('0xb8')]});})['then'](function(_0x255869){_0x180a8f[_0xa56f('0x19')]=_0x255869;if(_0x180a8f[_0xa56f('0xaf')]['UserId']){return db[_0xa56f('0xb9')][_0xa56f('0x52')]({'attributes':['id',_0xa56f('0x2c')],'where':{'id':_0x180a8f[_0xa56f('0xaf')][_0xa56f('0xba')]}})['then'](function(_0x33537d){if(_0x33537d){_0x180a8f[_0xa56f('0x98')][_0xa56f('0xbb')]({'id':0x0,'priority':0x0,'app':_0xa56f('0xbc'),'appdata':_0x33537d['name']+','+(_0x180a8f[_0xa56f('0x97')][_0xa56f('0xbd')]||0xa),'interval':_0xa56f('0xb7')});_0x180a8f[_0xa56f('0xbe')]=!![];}return respondWithRpcPromise(_0xa56f('0xbf'),_0xa56f('0xc0'),_0x180a8f);});}return respondWithRpcPromise('Start',_0xa56f('0xc0'),_0x180a8f);})[_0xa56f('0x27')](function(_0x5ea871){respondWithRpcPromise(_0xa56f('0xc1'),_0xa56f('0xc1'),{'event':'notify','message':_0x5ea871},client9002);return _0x5ea871;})[_0xa56f('0x27')](respondWithResult(_0x543cd9,null))['catch'](handleError(_0x543cd9,null));};exports[_0xa56f('0xc2')]=function(_0x9bbe3c,_0x1b8607){var _0x552378,_0x5ecb45,_0x157ef5;var _0x20cf75=[];var _0x1fa3e8={};var _0x1c005b=_0x9bbe3c[_0xa56f('0xc3')]||[];var _0x2157eb=[];var _0x4cca20;return db['CmContact'][_0xa56f('0x55')]()[_0xa56f('0x27')](function(_0x5368a0){if(!_0x5368a0){throw new db['Sequelize']['ValidationError'](_0xa56f('0x85'));}_0x20cf75=_[_0xa56f('0x86')](_['keys'](_0x5368a0),[_0xa56f('0x88'),'updatedAt','CompanyId','ListId']);if(_0x9bbe3c['body']['id']){delete _0x9bbe3c[_0xa56f('0x4e')]['id'];}if(_[_0xa56f('0x76')](_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x8b')])){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)[_0xa56f('0x2d')](new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0x8c')));}if(_['isNil'](_0x9bbe3c[_0xa56f('0x4e')]['body'])||_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x4e')]===''){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)[_0xa56f('0x2d')](new db['Sequelize']['ValidationError'](_0xa56f('0x8d')));}if(_[_0xa56f('0x76')](_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')])){throw _0x1b8607[_0xa56f('0x1c')](0x1f4)['send'](new db[(_0xa56f('0x83'))][(_0xa56f('0x84'))](_0xa56f('0xc5')+_0x20cf75));}if(!_[_0xa56f('0xc6')](_0x20cf75,_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')])){throw _0x1b8607['status'](0x1f4)['send'](new db[(_0xa56f('0x83'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20cf75));}_0x1fa3e8[_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')]]=_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0x8b')];})[_0xa56f('0x27')](function(){return db['ChatWebsite'][_0xa56f('0x52')]({'where':{'id':_0x9bbe3c[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0x91')],'as':_0xa56f('0x92')},{'model':db[_0xa56f('0xc7')],'as':_0xa56f('0xc7')}]});})[_0xa56f('0x27')](handleEntityNotFound(_0x1b8607,null))[_0xa56f('0x27')](function(_0x1a618a){if(_0x1a618a&&_0x1a618a[_0xa56f('0x92')]){_0x5ecb45=_0x1a618a;var _0xd6737c=_[_0xa56f('0xa')](_0x9bbe3c[_0xa56f('0x4e')],{'firstName':_0x9bbe3c['body'][_0xa56f('0x8b')],'phone':_0x9bbe3c[_0xa56f('0x4e')]['from'],'ListId':_0x1a618a['ListId']});_0xd6737c[_0x9bbe3c[_0xa56f('0x4e')][_0xa56f('0xc4')]]=_0x9bbe3c['body']['from'];return db['CmContact'][_0xa56f('0xc8')]({'where':_0x1fa3e8,'defaults':_0xd6737c});}})['spread'](function(_0x2e8db8){if(_0x2e8db8){_0x157ef5=_0x2e8db8;var _0x42885a=fs[_0xa56f('0xc9')](path['join'](config[_0xa56f('0x6d')],'server/files/templates/chatOfflineMessage.ejs'),_0xa56f('0xca'));var _0x1f93a2=ejs[_0xa56f('0xcb')](_0x42885a,{'body':_['toPairs'](_0x9bbe3c[_0xa56f('0x4e')]['body']),'bodyTitle':_0x5ecb45[_0xa56f('0xcc')]});return db[_0xa56f('0xcd')][_0xa56f('0x4d')]({'body':_0x1f93a2,'plainBody':htmlToText['fromString'](_0x1f93a2),'ContactId':_0x2e8db8['id'],'ChatWebsiteId':_0x5ecb45['id']});}})['then'](function(_0x2388fe){_0x4cca20=_0x2388fe;if(_0x1c005b[_0xa56f('0x3a')]){var _0x23e732=_0x1c005b['map'](function(_0x38c602){return{'name':_0x38c602[_0xa56f('0xce')],'basename':_0x38c602[_0xa56f('0x65')],'type':_0x38c602['mimetype'],'ChatOfflineMessageId':_0x2388fe['id']};});_0x2157eb=_0x23e732[_0xa56f('0x34')](_0x301360=>{var _0xa69d5f={'filename':_0x301360[_0xa56f('0x2c')],'path':path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],_0xa56f('0xcf'),_0xa56f('0xc3'),_0xa56f('0xd0'),_0xa56f('0xd1'),_0x301360[_0xa56f('0xd2')])};return _0xa69d5f;});if(!_0x5ecb45[_0xa56f('0xd3')]){return db['sequelize'][_0xa56f('0xd4')](function(_0x42412d){return db['Attachment'][_0xa56f('0xd5')](_0x23e732,{'transaction':_0x42412d});});}}})['then'](function(){if(_0x4cca20){_0x552378=_0x4cca20;return db[_0xa56f('0xc7')][_0xa56f('0x5f')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa56f('0xd6')],'as':_0xa56f('0xd6'),'raw':!![]}]}]});}})['then'](function(_0x100411){if(_0x100411&&_0x100411[_0xa56f('0xd7')]&&_0x5ecb45[_0xa56f('0xd8')]&&_0x5ecb45[_0xa56f('0xd9')]){var _0x3364e8=_0x100411[_0xa56f('0xda')]();return respondWithRpcPromise(_0xa56f('0xdb'),'sendMail',{'account':_0x3364e8,'message':{'from':util['format'](_0xa56f('0xdc'),_0x100411['name'],_0x100411[_0xa56f('0xdd')]||_0x100411[_0xa56f('0xd7')][_0xa56f('0x4f')]),'to':_0x5ecb45[_0xa56f('0xd9')],'subject':_0x5ecb45[_0xa56f('0xde')],'html':_0x552378[_0xa56f('0x4e')],'attachments':_0x2157eb}},client9003)[_0xa56f('0x27')](function(){return _0x552378;})['catch'](function(_0x3696c5){logger['error'](_0x3696c5);});}})[_0xa56f('0x27')](function(){if(_0x5ecb45&&_0x5ecb45[_0xa56f('0xd3')]&&_0x5ecb45[_0xa56f('0xdf')]){var _0x276eb9=[];if(_0x1c005b[_0xa56f('0x3a')]){_0x276eb9=_0x1c005b[_0xa56f('0x34')](function(_0xa9fcf7){return{'name':_0xa9fcf7[_0xa56f('0xce')],'basename':_0xa9fcf7[_0xa56f('0x65')],'type':_0xa9fcf7[_0xa56f('0xe0')],'ChatOfflineMessageId':_0x4cca20['id']};});}var _0x269d4d;if(!_[_0xa56f('0x76')](_0x5ecb45[_0xa56f('0xe1')])){var _0x25c8e2=_[_0xa56f('0x34')](_0x9bbe3c[_0xa56f('0x4e')],function(_0x4b5798){return _0x4b5798;});var _0x531539=_[_0xa56f('0xe2')](_0x25c8e2)[0x0];var _0x630cf8=_['mapValues'](_0x531539,function(_0x8dd234){return _0x8dd234;});_0x269d4d=_0x630cf8[0x1][_0x5ecb45[_0xa56f('0xe1')]];}var _0x48365e={'from':_0x157ef5[_0xa56f('0xdd')],'firstName':_0x157ef5[_0xa56f('0xa1')],'lastName':_0x157ef5['lastName'],'mapKey':_0xa56f('0xdd'),'message':{'from':_0x157ef5[_0xa56f('0xdd')],'to':_0x5ecb45[_0xa56f('0xc7')][_0xa56f('0xdd')],'cc':'','subject':_[_0xa56f('0x76')](_0x269d4d)?_0x5ecb45[_0xa56f('0xde')]:_0x269d4d,'messageId':'','sentAt':new Date(),'attach':_0x276eb9['length'],'attachments':_0x276eb9,'originChannel':_0xa56f('0xe3'),'ChatWebsiteId':_0x5ecb45['id'],'ChatOfflineMessageId':_0x552378['id'],'originTo':_0x5ecb45[_0xa56f('0xc7')][_0xa56f('0xdd')]},'body':_0x552378['body']};var _0x4c931c={'account':{'id':_0x5ecb45[_0xa56f('0xdf')]},'body':_0x48365e,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x4c931c,client9001)[_0xa56f('0x27')](function(){return _0x552378;})[_0xa56f('0x4c')](function(_0x2f7b2e){logger[_0xa56f('0x16')](_0x2f7b2e);});}return;})['then'](function(){if(_0x552378){return _0x552378;}})[_0xa56f('0x27')](respondWithResult(_0x1b8607,null))[_0xa56f('0x4c')](function(_0x3bf0ec){logger[_0xa56f('0x16')]('catch',_0x3bf0ec);for(var _0x42ef44 of _0x1c005b){var _0x4d5d92=path[_0xa56f('0x6c')](config[_0xa56f('0x6d')],'server',_0xa56f('0xc3'),'attachments',_0xa56f('0xd1'),_0x42ef44['filename']);fs_extra[_0xa56f('0xe4')](_0x4d5d92)['catch'](function(_0x367d4b){logger[_0xa56f('0x16')]('Could\x20not\x20remove\x20attachment\x20file',_0x4d5d92,_0x367d4b);});}});};exports[_0xa56f('0xe5')]=function(_0x88e0f0,_0x5bae0d){return db[_0xa56f('0xac')][_0xa56f('0x52')]({'where':{'id':_0x88e0f0[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x5bae0d,null))[_0xa56f('0x27')](function(_0x58012f){if(_0x58012f){return _0x58012f[_0xa56f('0xe5')](_0x88e0f0[_0xa56f('0x4e')][_0xa56f('0x5b')],_[_0xa56f('0xe6')](_0x88e0f0[_0xa56f('0x4e')],['ids','id'])||{});}})[_0xa56f('0x27')](respondWithResult(_0x5bae0d,null))['catch'](handleError(_0x5bae0d,null));};exports[_0xa56f('0xe7')]=function(_0x28a064,_0x2cdaa8){var _0x4a374b={'raw':![],'where':{}};var _0x4e93c3={};var _0x5cc501={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x28a064[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x2cdaa8,null))[_0xa56f('0x27')](function(_0x27c5d5){if(_0x27c5d5){_0x4e93c3[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['ChatInteraction'][_0xa56f('0x31')]);_0x4e93c3['query']=_[_0xa56f('0x36')](_0x28a064[_0xa56f('0x35')]);_0x4e93c3[_0xa56f('0x40')]=_['intersection'](_0x4e93c3['model'],_0x4e93c3[_0xa56f('0x35')]);_0x4a374b['attributes']=_[_0xa56f('0x37')](_0x4e93c3[_0xa56f('0x33')],qs['fields'](_0x28a064[_0xa56f('0x35')][_0xa56f('0x39')]));_0x4a374b[_0xa56f('0x38')]=_0x4a374b['attributes'][_0xa56f('0x3a')]?_0x4a374b['attributes']:_0x4e93c3['model'];if(!_0x28a064[_0xa56f('0x35')][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x4a374b[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x28a064[_0xa56f('0x35')]['limit']);_0x4a374b['offset']=qs[_0xa56f('0x1f')](_0x28a064['query']['offset']);}_0x4a374b['order']=qs['sort'](_0x28a064[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x4a374b[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x28a064[_0xa56f('0x35')],_0x4e93c3['filters']));_0x4a374b[_0xa56f('0x3f')]['ChatWebsiteId']=_0x27c5d5['id'];if(_0x28a064[_0xa56f('0x35')][_0xa56f('0x42')]){_0x4a374b[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x4a374b[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x4a374b['attributes'],function(_0x43b0c4){var _0x322678={};_0x322678[_0x43b0c4]={'$like':'%'+_0x28a064[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x322678;})});}_0x4a374b=_[_0xa56f('0x44')]({},_0x4a374b,_0x28a064['options']);return db['ChatInteraction'][_0xa56f('0x21')]({'where':_0x4a374b[_0xa56f('0x3f')]})['then'](function(_0x1617d0){_0x5cc501[_0xa56f('0x21')]=_0x1617d0;if(_0x28a064[_0xa56f('0x35')][_0xa56f('0x46')]){_0x4a374b['include']=[{'model':db[_0xa56f('0x93')],'as':'Contact','required':![]},{'model':db[_0xa56f('0xb9')],'as':_0xa56f('0xe8'),'attributes':['name',_0xa56f('0xe9'),'internal'],'required':![]},{'model':db[_0xa56f('0xea')],'as':'Tags','attributes':['id',_0xa56f('0x2c'),_0xa56f('0xeb')],'where':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]?{'id':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]}:undefined,'required':_0x28a064[_0xa56f('0x35')][_0xa56f('0xec')]?!![]:![]}];}return db[_0xa56f('0xac')][_0xa56f('0x48')](_0x4a374b);})[_0xa56f('0x27')](function(_0x475f9e){_0x5cc501[_0xa56f('0x60')]=_0x475f9e;return _0x5cc501;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x2cdaa8,_0x4a374b))[_0xa56f('0x4c')](handleError(_0x2cdaa8,null));};function iftimePromise(_0x336fb0,_0x13fc97){return respondWithRpcPromise('Command',_0xa56f('0xed'),{'command':_0x13fc97[_0xa56f('0xee')]?util['format'](_0xa56f('0xef'),_0x336fb0[_0xa56f('0xf0')],_0x13fc97['timezone']):util[_0xa56f('0xa6')](_0xa56f('0xf1'),_0x336fb0[_0xa56f('0xf0')])},client9002)[_0xa56f('0x27')](function(_0x14e42c){var _0x2ce301=_0x14e42c&&_0x14e42c[_0xa56f('0xf2')](_0xa56f('0xf3'))>=0x0?!![]:![];logger['info'](_0xa56f('0xf4'),_0x13fc97['id'],_0x336fb0['id'],_0x336fb0[_0xa56f('0xf0')],_0x2ce301?_0xa56f('0xf5'):_0xa56f('0xf6'),_0x13fc97[_0xa56f('0xee')]?_0x13fc97[_0xa56f('0xee')]:_0xa56f('0xf7'));return _0x2ce301;})[_0xa56f('0x4c')](function(_0x3dc670){logger[_0xa56f('0x16')](_0xa56f('0xf4'),_0x13fc97['id'],_0x336fb0['id'],_0x336fb0['interval'],util[_0xa56f('0xf8')](_0x3dc670,{'showHidden':![],'depth':null}),_0x13fc97['timezone']?_0x13fc97[_0xa56f('0xee')]:'No\x20timezone');return![];});}exports[_0xa56f('0xed')]=function(_0x2654a5,_0x3ee2f9){var _0x2ada27=0x0;var _0x4399e5=0x0;var _0x383403=![];var _0x4d87f2;var _0x4a08b5;return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x2654a5[_0xa56f('0x4a')]['id']},'include':[{'model':db[_0xa56f('0xf9')],'as':_0xa56f('0xf9'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xa56f('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3ee2f9,null))[_0xa56f('0x27')](function(_0x546347){if(_0x546347){_0x4d87f2=_0x546347;return _0x546347[_0xa56f('0xfa')]({'raw':!![]});}})['then'](function(_0x1f6cc0){if(_0x4d87f2){if(_0x1f6cc0){_0x4a08b5=_0x1f6cc0;}}return require(_0xa56f('0x6f'))[_0xa56f('0x70')]();})[_0xa56f('0x27')](function(_0x286fb6){if(_0x286fb6){_0x4399e5=_0x286fb6[_0xa56f('0xfb')];_0x383403=_0x286fb6[_0xa56f('0xfc')];}})[_0xa56f('0x27')](function(){return db[_0xa56f('0xac')]['count']({'where':{'closed':![]}});})[_0xa56f('0x27')](function(_0x255151){_0x2ada27=_0x255151;if(_0x4399e5&&_0x255151>_0x4399e5){return db['License'][_0xa56f('0x5f')]({'where':{'id':0x1}})['then'](function(_0x1e1e66){if(_0x1e1e66){_0x1e1e66[_0xa56f('0xfd')](_0xa56f('0xfe'));}});}})['then'](function(){if(_0x4d87f2[_0xa56f('0xf9')]&&_0x4d87f2[_0xa56f('0xf9')]['Intervals']){var _0x355ea1=[];for(var _0x281610=0x0;_0x281610<_0x4d87f2[_0xa56f('0xf9')][_0xa56f('0xff')]['length'];_0x281610++){var _0x6e8b23=_0x4d87f2['Interval'][_0xa56f('0xff')][_0x281610][_0xa56f('0x28')]({'plain':!![]});_0x355ea1[_0xa56f('0xb4')](iftimePromise(_0x6e8b23,_0x4d87f2));}return BPromise['all'](_0x355ea1)[_0xa56f('0x27')](function(_0x259874){return _[_0xa56f('0x100')](_0x259874);});}else{return!![];}})['then'](function(_0x471a4e){var _0x370a6f=fs[_0xa56f('0xc9')](path['join'](config[_0xa56f('0x6d')],_0xa56f('0x101')),_0xa56f('0xca'));var _0x56d640=new url['URL'](_0x4d87f2[_0xa56f('0x102')])['origin'];var _0x3049f3='3.1.0';var _0x4e9b33=![];var _0xc19457={'chatVersion':_0x3049f3,'chatWebsiteAddressOrigin':_0x56d640,'remote':_0x4d87f2[_0xa56f('0x103')],'query':querystring['stringify'](_['merge'](_0x4d87f2[_0xa56f('0x28')]({'plain':!![]}),{'customerIp':_0x2654a5['headers']['x-forwarded-for']||_0x2654a5['headers'][_0xa56f('0x104')]||_0x2654a5[_0xa56f('0x105')]['remoteAddress']||_0x2654a5['ip'],'referer':_0x2654a5['headers'][_0xa56f('0xa3')],'openedInteractions':_0x2ada27,'maxInteractions':_0x4399e5,'virtual':_0x383403[_0xa56f('0xfb')],'online':_0x471a4e,'custom':_0x383403}))[_0xa56f('0x106')](/'/g,'\x5c\x27')};_0x3ee2f9[_0xa56f('0x2d')](ejs[_0xa56f('0xcb')](Mustache[_0xa56f('0xcb')](_0x370a6f,_0xc19457),{'proactiveActions':_0x4a08b5,'alignment':_0x4d87f2[_0xa56f('0x107')],'verticalAlignment':_0x4d87f2[_0xa56f('0x108')],'div_color':_0x4d87f2[_0xa56f('0xeb')],'labelText':_0x4d87f2['labelText'],'text_color':_0x4d87f2[_0xa56f('0x109')],'text_button_color':_0x4d87f2[_0xa56f('0x10a')],'button_color':_0x4d87f2[_0xa56f('0x10b')],'background_color':_0x4d87f2['backgroundColor'],'hideWhenOffline':_0x4d87f2[_0xa56f('0x10c')],'intervalId':_0x4d87f2[_0xa56f('0x10d')],'isDevelopment':_0x4e9b33,'chatVersion':_0x3049f3}));})[_0xa56f('0x4c')](handleError(_0x3ee2f9,null));};exports['addApplications']=function(_0x53c41f,_0x2cbe41){var _0x1368e8=_0x53c41f[_0xa56f('0x4a')]['id'];var _0xee08dd=_0x53c41f['body'];var _0x1d4ff6=0xc8;var _0x941444=null;return db[_0xa56f('0x10e')][_0xa56f('0xd4')]({'isolationLevel':db[_0xa56f('0x10e')][_0xa56f('0x10f')][_0xa56f('0x110')]['READ_COMMITTED']},function(_0x14570b){return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x1368e8},'transaction':_0x14570b})[_0xa56f('0x27')](function(_0x1f1e1c){if(_0x1f1e1c){return db['ChatApplication'][_0xa56f('0x26')]({'where':{'ChatWebsiteId':_0x1368e8},'transaction':_0x14570b})[_0xa56f('0x27')](function(){var _0x3a7b38=_[_0xa56f('0x34')](_0xee08dd,function(_0x1566a1){_0x1566a1['ChatWebsiteId']=_0x1368e8;return _0x1566a1;});return db[_0xa56f('0x111')]['bulkCreate'](_0x3a7b38,{'transaction':_0x14570b});});}else{_0x1d4ff6=0x194;_0x941444=[];}});})['then'](function(){if(_0x1d4ff6!==0x194){return db[_0xa56f('0x111')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1368e8},'order':_0xa56f('0x112')})[_0xa56f('0x27')](function(_0x161bb2){_0x941444=_0x161bb2;});}})[_0xa56f('0x4c')](function(_0x449e3f){_0x1d4ff6=0x1f4;logger['error'](_0x449e3f[_0xa56f('0x2b')]);if(_0x449e3f[_0xa56f('0x2c')]){delete _0x449e3f[_0xa56f('0x2c')];}_0x941444=_0x449e3f;})[_0xa56f('0x113')](function(){if(_0x941444===null){_0x2cbe41['sendStatus'](_0x1d4ff6);}else{if(_0x1d4ff6===0x1f4){_0x2cbe41['status'](_0x1d4ff6)[_0xa56f('0x2d')](_0x941444);}else{_0x2cbe41['status'](_0x1d4ff6)[_0xa56f('0x1e')](_0x941444);}}});};exports[_0xa56f('0x114')]=function(_0x9d749f,_0x1aad8a){var _0x42bc42={};var _0x15f7c5={};var _0x2cc073;var _0x177b02;return db['ChatWebsite']['findOne']({'where':{'id':_0x9d749f[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x1aad8a,null))[_0xa56f('0x27')](function(_0x5df434){if(_0x5df434){_0x2cc073=_0x5df434;_0x15f7c5['model']=_[_0xa56f('0x36')](db[_0xa56f('0x111')][_0xa56f('0x31')]);_0x15f7c5['query']=_[_0xa56f('0x36')](_0x9d749f[_0xa56f('0x35')]);_0x15f7c5[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x15f7c5[_0xa56f('0x33')],_0x15f7c5['query']);_0x42bc42[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x15f7c5['model'],qs['fields'](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x39')]));_0x42bc42[_0xa56f('0x38')]=_0x42bc42['attributes'][_0xa56f('0x3a')]?_0x42bc42[_0xa56f('0x38')]:_0x15f7c5[_0xa56f('0x33')];_0x42bc42[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x42bc42[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x9d749f[_0xa56f('0x35')],_0x15f7c5[_0xa56f('0x40')]));if(_0x9d749f[_0xa56f('0x35')][_0xa56f('0x42')]){_0x42bc42['where']=_[_0xa56f('0x44')](_0x42bc42[_0xa56f('0x3f')],{'$or':_[_0xa56f('0x34')](_0x42bc42[_0xa56f('0x38')],function(_0x1ce365){var _0x30cecd={};_0x30cecd[_0x1ce365]={'$like':'%'+_0x9d749f[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x30cecd;})});}_0x42bc42=_[_0xa56f('0x44')]({},_0x42bc42,_0x9d749f[_0xa56f('0x45')]);return _0x2cc073[_0xa56f('0x114')](_0x42bc42);}})['then'](function(_0x17f212){if(_0x17f212){_0x177b02=_0x17f212[_0xa56f('0x3a')];if(!_0x9d749f[_0xa56f('0x35')][_0xa56f('0x3b')]('nolimit')){_0x42bc42['limit']=qs[_0xa56f('0x22')](_0x9d749f[_0xa56f('0x35')][_0xa56f('0x22')]);_0x42bc42['offset']=qs['offset'](_0x9d749f[_0xa56f('0x35')]['offset']);}return _0x2cc073[_0xa56f('0x114')](_0x42bc42);}})[_0xa56f('0x27')](function(_0x28c495){if(_0x28c495){return _0x28c495?{'count':_0x177b02,'rows':_0x28c495}:null;}})[_0xa56f('0x27')](respondWithResult(_0x1aad8a,null))[_0xa56f('0x4c')](handleError(_0x1aad8a,null));};exports['addProactiveActions']=function(_0x2b62fd,_0x210ee2){return db[_0xa56f('0x115')][_0xa56f('0x52')]({'where':{'id':_0x2b62fd[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x210ee2,null))[_0xa56f('0x27')](function(_0x3c5348){if(_0x3c5348){return _0x3c5348[_0xa56f('0x116')](_0x2b62fd[_0xa56f('0x4e')]['ids'],_[_0xa56f('0xe6')](_0x2b62fd[_0xa56f('0x4e')],['ids','id'])||{});}})[_0xa56f('0x27')](respondWithResult(_0x210ee2,null))[_0xa56f('0x4c')](handleError(_0x210ee2,null));};exports[_0xa56f('0xfa')]=function(_0x37d183,_0x20e5c5){var _0x548d70={};var _0x2d2aa1={};var _0x72aacf;var _0x5ee7c3;return db[_0xa56f('0x30')]['findOne']({'where':{'id':_0x37d183['params']['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x20e5c5,null))[_0xa56f('0x27')](function(_0x13ab67){if(_0x13ab67){_0x72aacf=_0x13ab67;_0x2d2aa1[_0xa56f('0x33')]=_[_0xa56f('0x36')](db['ChatProactiveAction'][_0xa56f('0x31')]);_0x2d2aa1[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x37d183[_0xa56f('0x35')]);_0x2d2aa1[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x2d2aa1[_0xa56f('0x33')],_0x2d2aa1[_0xa56f('0x35')]);_0x548d70[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x2d2aa1[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x39')]));_0x548d70['attributes']=_0x548d70[_0xa56f('0x38')]['length']?_0x548d70['attributes']:_0x2d2aa1['model'];_0x548d70['order']=qs[_0xa56f('0x3e')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x548d70[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_['pick'](_0x37d183[_0xa56f('0x35')],_0x2d2aa1[_0xa56f('0x40')]));if(_0x37d183[_0xa56f('0x35')][_0xa56f('0x42')]){_0x548d70[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x548d70['where'],{'$or':_['map'](_0x548d70[_0xa56f('0x38')],function(_0x5593f2){var _0x433805={};_0x433805[_0x5593f2]={'$like':'%'+_0x37d183[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x433805;})});}_0x548d70=_[_0xa56f('0x44')]({},_0x548d70,_0x37d183['options']);return _0x72aacf[_0xa56f('0xfa')](_0x548d70);}})['then'](function(_0x25ecbe){if(_0x25ecbe){_0x5ee7c3=_0x25ecbe['length'];if(!_0x37d183[_0xa56f('0x35')][_0xa56f('0x3b')]('nolimit')){_0x548d70[_0xa56f('0x22')]=qs['limit'](_0x37d183[_0xa56f('0x35')][_0xa56f('0x22')]);_0x548d70[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x37d183[_0xa56f('0x35')][_0xa56f('0x1f')]);}return _0x72aacf['getProactiveActions'](_0x548d70);}})[_0xa56f('0x27')](function(_0x1db8ee){if(_0x1db8ee){return _0x1db8ee?{'count':_0x5ee7c3,'rows':_0x1db8ee}:null;}})[_0xa56f('0x27')](respondWithResult(_0x20e5c5,null))[_0xa56f('0x4c')](handleError(_0x20e5c5,null));};exports[_0xa56f('0x117')]=function(_0x4a0c5c,_0x8f2773){var _0x333494=_0x4a0c5c[_0xa56f('0x35')][_0xa56f('0x118')]===_0xa56f('0x119')?_0xa56f('0x11a'):_0xa56f('0x11b');return db[_0xa56f('0x30')][_0xa56f('0x52')]({'attributes':['id',_0x333494],'where':{'id':_0x4a0c5c[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x8f2773,null))[_0xa56f('0x27')](function(_0x46d4f4){if(_0x46d4f4){var _0xc2b3e7=_0x46d4f4[_0x333494];var _0x2867a8=_0xc2b3e7&&_0xc2b3e7['items']?_0xc2b3e7['items']:[];_0x8f2773[_0xa56f('0x2d')]({'fromKey':_[_0xa56f('0x76')](_0xc2b3e7[_0xa56f('0x11c')])?undefined:_0xc2b3e7[_0xa56f('0x11c')],'count':_0x2867a8['length'],'rows':_0x2867a8});}})[_0xa56f('0x4c')](handleError(_0x8f2773,null));};exports[_0xa56f('0x11d')]=function(_0x2e3ed9,_0x14106f){var _0x58aa21={'raw':![],'where':{}};var _0x1fd12b={};var _0x5ae04b={'count':0x0,'rows':[]};return db[_0xa56f('0x30')][_0xa56f('0x5f')]({'where':{'id':_0x2e3ed9[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x14106f,null))['then'](function(_0x3e7e0b){if(_0x3e7e0b){_0x1fd12b[_0xa56f('0x33')]=_['keys'](db[_0xa56f('0xcd')][_0xa56f('0x31')]);_0x1fd12b[_0xa56f('0x35')]=_['keys'](_0x2e3ed9['query']);_0x1fd12b['filters']=_['intersection'](_0x1fd12b[_0xa56f('0x33')],_0x1fd12b[_0xa56f('0x35')]);_0x58aa21[_0xa56f('0x38')]=_[_0xa56f('0x37')](_0x1fd12b[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x2e3ed9[_0xa56f('0x35')]['fields']));_0x58aa21[_0xa56f('0x38')]=_0x58aa21['attributes']['length']?_0x58aa21[_0xa56f('0x38')]:_0x1fd12b[_0xa56f('0x33')];if(!_0x2e3ed9[_0xa56f('0x35')]['hasOwnProperty'](_0xa56f('0x3c'))){_0x58aa21[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x22')]);_0x58aa21[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x2e3ed9['query'][_0xa56f('0x1f')]);}_0x58aa21['order']=qs[_0xa56f('0x3e')](_0x2e3ed9[_0xa56f('0x35')]['sort']);_0x58aa21[_0xa56f('0x3f')]=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x2e3ed9['query'],_0x1fd12b[_0xa56f('0x40')]));_0x58aa21[_0xa56f('0x3f')][_0xa56f('0x57')]=_0x3e7e0b['id'];if(_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x42')]){_0x58aa21['where']=_[_0xa56f('0x44')](_0x58aa21['where'],{'$or':_['map'](_0x58aa21['attributes'],function(_0x646827){var _0x30710c={};_0x30710c[_0x646827]={'$like':'%'+_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x30710c;})});}_0x58aa21=_[_0xa56f('0x44')]({},_0x58aa21,_0x2e3ed9[_0xa56f('0x45')]);return db[_0xa56f('0xcd')][_0xa56f('0x21')]({'where':_0x58aa21['where']})['then'](function(_0x4c667b){_0x5ae04b[_0xa56f('0x21')]=_0x4c667b;if(_0x2e3ed9[_0xa56f('0x35')][_0xa56f('0x46')]){_0x58aa21['include']=[{'all':!![]}];}else{_0x58aa21[_0xa56f('0x47')]=[{'model':db[_0xa56f('0x93')],'as':_0xa56f('0x11e'),'required':![]},{'model':db['Attachment'],'as':_0xa56f('0x11f'),'required':![]}];}return db[_0xa56f('0xcd')]['findAll'](_0x58aa21);})[_0xa56f('0x27')](function(_0x140946){_0x5ae04b[_0xa56f('0x60')]=_0x140946;return _0x5ae04b;});}})[_0xa56f('0x27')](respondWithFilteredResult(_0x14106f,_0x58aa21))[_0xa56f('0x4c')](handleError(_0x14106f,null));};exports[_0xa56f('0x120')]=function(_0x139ec7,_0x5582d3){return db['ChatWebsite'][_0xa56f('0x52')]({'where':{'id':_0x139ec7[_0xa56f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5582d3,null))[_0xa56f('0x27')](function(_0xde85dd){if(_0xde85dd){return _0xde85dd['addAgents'](_0x139ec7[_0xa56f('0x4e')]['ids'],_[_0xa56f('0xe6')](_0x139ec7[_0xa56f('0x4e')],['ids','id'])||{})[_0xa56f('0x121')](function(_0x3cb5f4){for(var _0x13a6a7=0x0;_0x13a6a7<_0x139ec7[_0xa56f('0x4e')][_0xa56f('0x5b')][_0xa56f('0x3a')];_0x13a6a7+=0x1){socket[_0xa56f('0x122')](_0xa56f('0x123'),{'UserId':Number(_0x139ec7['body'][_0xa56f('0x5b')][_0x13a6a7]),'ChatWebsiteId':Number(_0x139ec7['params']['id'])});}return _0x3cb5f4;});}})[_0xa56f('0x27')](respondWithResult(_0x5582d3,null))[_0xa56f('0x4c')](handleError(_0x5582d3,null));};exports[_0xa56f('0x124')]=function(_0x509082,_0x1d7750){return db[_0xa56f('0x30')][_0xa56f('0x52')]({'where':{'id':_0x509082[_0xa56f('0x4a')]['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x1d7750,null))[_0xa56f('0x27')](function(_0x3b47e3){if(_0x3b47e3){return _0x3b47e3['removeAgents'](_0x509082['query']['ids'])['then'](function(){if(_[_0xa56f('0x125')](_0x509082[_0xa56f('0x35')]['ids'])){for(var _0x2bb697=0x0;_0x2bb697<_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')][_0xa56f('0x3a')];_0x2bb697+=0x1){socket[_0xa56f('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')][_0x2bb697]),'ChatWebsiteId':Number(_0x509082[_0xa56f('0x4a')]['id'])});}}else{socket[_0xa56f('0x122')](_0xa56f('0x126'),{'UserId':Number(_0x509082[_0xa56f('0x35')][_0xa56f('0x5b')]),'ChatWebsiteId':Number(_0x509082[_0xa56f('0x4a')]['id'])});}});}})[_0xa56f('0x27')](respondWithStatusCode(_0x1d7750,null))['catch'](handleError(_0x1d7750,null));};exports[_0xa56f('0x127')]=function(_0x528246,_0x172281){var _0x497fe6={};var _0x221cfe={};var _0x4a1541;var _0xb8dc83;return db['ChatWebsite'][_0xa56f('0x5f')]({'where':{'id':_0x528246['params']['id']}})[_0xa56f('0x27')](handleEntityNotFound(_0x172281,null))[_0xa56f('0x27')](function(_0x18a23d){if(_0x18a23d){_0x4a1541=_0x18a23d;_0x221cfe[_0xa56f('0x33')]=_[_0xa56f('0x36')](db[_0xa56f('0xb9')][_0xa56f('0x31')]);_0x221cfe['query']=_[_0xa56f('0x36')](_0x528246['query']);_0x221cfe[_0xa56f('0x40')]=_[_0xa56f('0x37')](_0x221cfe[_0xa56f('0x33')],_0x221cfe[_0xa56f('0x35')]);_0x497fe6['attributes']=_[_0xa56f('0x37')](_0x221cfe[_0xa56f('0x33')],qs[_0xa56f('0x39')](_0x528246[_0xa56f('0x35')][_0xa56f('0x39')]));_0x497fe6[_0xa56f('0x38')]=_0x497fe6[_0xa56f('0x38')]['length']?_0x497fe6[_0xa56f('0x38')]:_0x221cfe[_0xa56f('0x33')];_0x497fe6[_0xa56f('0x3d')]=qs[_0xa56f('0x3e')](_0x528246[_0xa56f('0x35')][_0xa56f('0x3e')]);_0x497fe6['where']=qs[_0xa56f('0x40')](_[_0xa56f('0x41')](_0x528246[_0xa56f('0x35')],_0x221cfe[_0xa56f('0x40')]));if(_0x528246[_0xa56f('0x35')]['filter']){_0x497fe6[_0xa56f('0x3f')]=_[_0xa56f('0x44')](_0x497fe6[_0xa56f('0x3f')],{'$or':_['map'](_0x497fe6[_0xa56f('0x38')],function(_0x309364){var _0x189a84={};_0x189a84[_0x309364]={'$like':'%'+_0x528246[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x189a84;})});}_0x497fe6=_[_0xa56f('0x44')]({},_0x497fe6,_0x528246['options']);return _0x4a1541[_0xa56f('0x127')](_0x497fe6);}})[_0xa56f('0x27')](function(_0x298194){if(_0x298194){_0xb8dc83=_0x298194[_0xa56f('0x3a')];if(!_0x528246['query'][_0xa56f('0x3b')](_0xa56f('0x3c'))){_0x497fe6[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x528246[_0xa56f('0x35')]['limit']);_0x497fe6[_0xa56f('0x1f')]=qs[_0xa56f('0x1f')](_0x528246[_0xa56f('0x35')][_0xa56f('0x1f')]);}return _0x4a1541[_0xa56f('0x127')](_0x497fe6);}})['then'](function(_0x2f3340){if(_0x2f3340){return _0x2f3340?{'count':_0xb8dc83,'rows':_0x2f3340}:null;}})['then'](respondWithResult(_0x172281,null))['catch'](handleError(_0x172281,null));}; \ No newline at end of file +var _0xa5d0=['server','attachments','basename','sequelize','transaction','findOne','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','mapValues','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','Owner','fullname','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getLicense','virtual','License','all','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','x-real-ip','connection','remoteAddress','referer','replace','verticalAlignment','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','READ_COMMITTED','finally','getApplications','addProactiveActions','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','path','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','sendStatus','status','json','offset','limit','count','Content-Range','update','destroy','ChatWebsites','end','stack','send','Pause','mandatoryDispositionPause','ChatWebsite','type','key','name','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','body','params','describe','addDisposition','ChatWebsiteId','Disposition','pick','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','addAvatar','file','filename','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','custom','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','Contacts','DESC','ChatApplication','List','account','applications','Applications','list','orderBy','priority','asc','defaults','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','unknown','format','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','files','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa5d0,0x178));var _0x0a5d=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa5d0[_0xbe200f];return _0x192597;};'use strict';var BPromise=require(_0x0a5d('0x0'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a5d('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a5d('0x2'));var querystring=require(_0x0a5d('0x3'));var Redis=require(_0x0a5d('0x4'));var qs=require(_0x0a5d('0x5'));var logger=require('../../config/logger')(_0x0a5d('0x6'));var config=require(_0x0a5d('0x7'));var url=require(_0x0a5d('0x8'));var db=require(_0x0a5d('0x9'))['db'];config[_0x0a5d('0xa')]=_['defaults'](config[_0x0a5d('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a5d('0xa')]));require(_0x0a5d('0xb'))[_0x0a5d('0xc')](socket);var htmlToText=require(_0x0a5d('0xd'));var jayson=require(_0x0a5d('0xe'));var client=jayson[_0x0a5d('0xf')][_0x0a5d('0x10')]({'port':0x232c});var client9002=jayson[_0x0a5d('0xf')][_0x0a5d('0x10')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x155f2f,_0x52afe1,_0x3a8725,_0x12798f){return new BPromise(function(_0x47b24f,_0x1e7fd5){var _0x40b40a=_0x12798f||client;return _0x40b40a[_0x0a5d('0x11')](_0x155f2f,_0x3a8725)[_0x0a5d('0x12')](function(_0x39c25c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x52afe1,_0x0a5d('0x13'));logger['debug'](_0x0a5d('0x14'),_0x52afe1,'request\x20sent',JSON[_0x0a5d('0x15')](_0x39c25c));if(_0x39c25c[_0x0a5d('0x16')]){if(_0x39c25c[_0x0a5d('0x16')][_0x0a5d('0x17')]===0x1f4){logger['error'](_0x0a5d('0x18'),_0x52afe1,_0x39c25c[_0x0a5d('0x16')][_0x0a5d('0x19')]);return _0x1e7fd5(_0x39c25c[_0x0a5d('0x16')][_0x0a5d('0x19')]);}logger[_0x0a5d('0x16')](_0x0a5d('0x18'),_0x52afe1,_0x39c25c[_0x0a5d('0x16')][_0x0a5d('0x19')]);return _0x47b24f(_0x39c25c[_0x0a5d('0x16')][_0x0a5d('0x19')]);}else{logger[_0x0a5d('0x1a')](_0x0a5d('0x18'),_0x52afe1,_0x0a5d('0x13'));_0x47b24f(_0x39c25c['result'][_0x0a5d('0x19')]);}})['catch'](function(_0x4f0305){logger[_0x0a5d('0x16')](_0x0a5d('0x18'),_0x52afe1,_0x4f0305);_0x1e7fd5(_0x4f0305);});});}function respondWithStatusCode(_0x5c4f4d,_0x415da7){_0x415da7=_0x415da7||0xcc;return function(_0x9d2904){if(_0x9d2904){return _0x5c4f4d[_0x0a5d('0x1b')](_0x415da7);}return _0x5c4f4d[_0x0a5d('0x1c')](_0x415da7)['end']();};}function respondWithResult(_0x11087d,_0x2f76db){_0x2f76db=_0x2f76db||0xc8;return function(_0x211034){if(_0x211034){return _0x11087d[_0x0a5d('0x1c')](_0x2f76db)[_0x0a5d('0x1d')](_0x211034);}};}function respondWithFilteredResult(_0x705468,_0x10ee93){return function(_0x1a99cb){if(_0x1a99cb){var _0x2b214c=typeof _0x10ee93[_0x0a5d('0x1e')]==='undefined'&&typeof _0x10ee93[_0x0a5d('0x1f')]==='undefined';var _0x2fb8da=_0x1a99cb[_0x0a5d('0x20')];var _0x3ae8a1=_0x2b214c?0x0:_0x10ee93[_0x0a5d('0x1e')];var _0x4421cf=_0x2b214c?_0x1a99cb['count']:_0x10ee93['offset']+_0x10ee93[_0x0a5d('0x1f')];var _0x3fe4ef;if(_0x4421cf>=_0x2fb8da){_0x4421cf=_0x2fb8da;_0x3fe4ef=0xc8;}else{_0x3fe4ef=0xce;}_0x705468['status'](_0x3fe4ef);return _0x705468['set'](_0x0a5d('0x21'),_0x3ae8a1+'-'+_0x4421cf+'/'+_0x2fb8da)[_0x0a5d('0x1d')](_0x1a99cb);}return null;};}function saveUpdates(_0x3e2f09){return function(_0x21a7c9){if(_0x21a7c9){return _0x21a7c9[_0x0a5d('0x22')](_0x3e2f09)[_0x0a5d('0x12')](function(_0x387242){return _0x387242;});}return null;};}function removeEntity(_0xef4fa){return function(_0x81ee33){if(_0x81ee33){return _0x81ee33[_0x0a5d('0x23')]()[_0x0a5d('0x12')](function(){var _0x3452f9=_0x81ee33['get']({'plain':!![]});var _0x50eca4=_0x0a5d('0x24');return db['UserProfileResource'][_0x0a5d('0x23')]({'where':{'type':_0x50eca4,'resourceId':_0x3452f9['id']}})[_0x0a5d('0x12')](function(){return _0x81ee33;});})[_0x0a5d('0x12')](function(){_0xef4fa[_0x0a5d('0x1c')](0xcc)[_0x0a5d('0x25')]();});}};}function handleEntityNotFound(_0x5ea70b){return function(_0x3e2fba){if(!_0x3e2fba){_0x5ea70b['sendStatus'](0x194);}return _0x3e2fba;};}function handleError(_0x56f099,_0x4059cf){_0x4059cf=_0x4059cf||0x1f4;return function(_0x56676b){logger['error'](_0x56676b[_0x0a5d('0x26')]);if(_0x56676b['name']){delete _0x56676b['name'];}_0x56f099[_0x0a5d('0x1c')](_0x4059cf)[_0x0a5d('0x27')](_0x56676b);};}exports['index']=function(_0x51f25f,_0x4e2056){var _0x1cdf90={'include':[{'model':db[_0x0a5d('0x28')],'as':_0x0a5d('0x29')}]},_0xa963ee={},_0x16ccf8={'count':0x0,'rows':[]};var _0x1e7236=_['map'](db[_0x0a5d('0x2a')]['rawAttributes'],function(_0x1083a9){return{'name':_0x1083a9['fieldName'],'type':_0x1083a9[_0x0a5d('0x2b')][_0x0a5d('0x2c')]};});_0xa963ee['model']=_['map'](_0x1e7236,_0x0a5d('0x2d'));_0xa963ee[_0x0a5d('0x2e')]=_[_0x0a5d('0x2f')](_0x51f25f[_0x0a5d('0x2e')]);_0xa963ee[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0xa963ee['model'],_0xa963ee[_0x0a5d('0x2e')]);_0x1cdf90[_0x0a5d('0x32')]=_[_0x0a5d('0x31')](_0xa963ee['model'],qs[_0x0a5d('0x33')](_0x51f25f[_0x0a5d('0x2e')][_0x0a5d('0x33')]));_0x1cdf90['attributes']=_0x1cdf90['attributes'][_0x0a5d('0x34')]?_0x1cdf90[_0x0a5d('0x32')]:_0xa963ee[_0x0a5d('0x35')];if(!_0x51f25f[_0x0a5d('0x2e')][_0x0a5d('0x36')](_0x0a5d('0x37'))){_0x1cdf90[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x51f25f[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x1cdf90[_0x0a5d('0x1e')]=qs[_0x0a5d('0x1e')](_0x51f25f[_0x0a5d('0x2e')]['offset']);}_0x1cdf90[_0x0a5d('0x38')]=qs[_0x0a5d('0x39')](_0x51f25f['query'][_0x0a5d('0x39')]);_0x1cdf90['where']=qs[_0x0a5d('0x30')](_['pick'](_0x51f25f['query'],_0xa963ee[_0x0a5d('0x30')]),_0x1e7236);if(_0x51f25f[_0x0a5d('0x2e')]['filter']){_0x1cdf90['where']=_['merge'](_0x1cdf90[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0x1e7236,function(_0x224cb4){if(_0x224cb4[_0x0a5d('0x2b')]!==_0x0a5d('0x3c')){var _0x5f4ff6={};_0x5f4ff6[_0x224cb4[_0x0a5d('0x2d')]]={'$like':'%'+_0x51f25f[_0x0a5d('0x2e')][_0x0a5d('0x3d')]+'%'};return _0x5f4ff6;}})});}_0x1cdf90=_[_0x0a5d('0x3e')]({},_0x1cdf90,_0x51f25f[_0x0a5d('0x3f')]);var _0x4e2ecc={'where':_0x1cdf90['where']};return db['ChatWebsite'][_0x0a5d('0x20')](_0x4e2ecc)[_0x0a5d('0x12')](function(_0x23abfe){_0x16ccf8['count']=_0x23abfe;if(_0x51f25f[_0x0a5d('0x2e')][_0x0a5d('0x40')]){_0x1cdf90[_0x0a5d('0x41')]=[{'all':!![]}];}return db[_0x0a5d('0x2a')][_0x0a5d('0x42')](_0x1cdf90);})[_0x0a5d('0x12')](function(_0x2ac97f){_0x16ccf8[_0x0a5d('0x43')]=_0x2ac97f;return _0x16ccf8;})[_0x0a5d('0x12')](respondWithFilteredResult(_0x4e2056,_0x1cdf90))['catch'](handleError(_0x4e2056,null));};exports['show']=function(_0x253b38,_0x3d4b5b){var _0x1465db={'raw':![],'where':{'id':_0x253b38['params']['id']},'include':[{'model':db[_0x0a5d('0x28')],'as':_0x0a5d('0x29')}]},_0x32f4ee={};_0x32f4ee['model']=_[_0x0a5d('0x2f')](db[_0x0a5d('0x2a')][_0x0a5d('0x44')]);_0x32f4ee[_0x0a5d('0x2e')]=_[_0x0a5d('0x2f')](_0x253b38[_0x0a5d('0x2e')]);_0x32f4ee['filters']=_[_0x0a5d('0x31')](_0x32f4ee[_0x0a5d('0x35')],_0x32f4ee['query']);_0x1465db[_0x0a5d('0x32')]=_[_0x0a5d('0x31')](_0x32f4ee[_0x0a5d('0x35')],qs[_0x0a5d('0x33')](_0x253b38[_0x0a5d('0x2e')]['fields']));_0x1465db[_0x0a5d('0x32')]=_0x1465db[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x1465db[_0x0a5d('0x32')]:_0x32f4ee[_0x0a5d('0x35')];if(_0x253b38[_0x0a5d('0x2e')][_0x0a5d('0x40')]){_0x1465db[_0x0a5d('0x41')]=[{'all':!![]}];}_0x1465db=_[_0x0a5d('0x3e')]({},_0x1465db,_0x253b38['options']);return db[_0x0a5d('0x2a')][_0x0a5d('0x45')](_0x1465db)[_0x0a5d('0x12')](handleEntityNotFound(_0x3d4b5b,null))[_0x0a5d('0x12')](respondWithResult(_0x3d4b5b,null))[_0x0a5d('0x46')](handleError(_0x3d4b5b,null));};exports[_0x0a5d('0x47')]=function(_0x6637b9,_0x22c07){return db[_0x0a5d('0x2a')][_0x0a5d('0x47')](_0x6637b9['body'],{})[_0x0a5d('0x12')](function(_0x3f33a4){var _0x4eca45=_0x6637b9[_0x0a5d('0x48')][_0x0a5d('0x49')]({'plain':!![]});if(!_0x4eca45)throw new Error(_0x0a5d('0x4a'));if(_0x4eca45['role']===_0x0a5d('0x48')){var _0x1d2512=_0x3f33a4[_0x0a5d('0x49')]({'plain':!![]});var _0x4386fb='ChatWebsites';return db['UserProfileSection'][_0x0a5d('0x45')]({'where':{'name':_0x4386fb,'userProfileId':_0x4eca45[_0x0a5d('0x4b')]},'raw':!![]})[_0x0a5d('0x12')](function(_0x3188f2){if(_0x3188f2&&_0x3188f2['autoAssociation']===0x0){return db[_0x0a5d('0x4c')]['create']({'name':_0x1d2512[_0x0a5d('0x2d')],'resourceId':_0x1d2512['id'],'type':_0x3188f2[_0x0a5d('0x2d')],'sectionId':_0x3188f2['id']},{})[_0x0a5d('0x12')](function(){return _0x3f33a4;});}else{return _0x3f33a4;}})['catch'](function(_0x1dd444){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dd444);throw _0x1dd444;});}return _0x3f33a4;})[_0x0a5d('0x12')](respondWithResult(_0x22c07,0xc9))[_0x0a5d('0x46')](handleError(_0x22c07,null));};exports[_0x0a5d('0x22')]=function(_0x2e0593,_0x56895d){if(_0x2e0593[_0x0a5d('0x4d')]['id']){delete _0x2e0593[_0x0a5d('0x4d')]['id'];}return db[_0x0a5d('0x2a')]['find']({'where':{'id':_0x2e0593[_0x0a5d('0x4e')]['id']},'include':[{'model':db['Pause'],'as':_0x0a5d('0x29')}]})[_0x0a5d('0x12')](handleEntityNotFound(_0x56895d,null))[_0x0a5d('0x12')](saveUpdates(_0x2e0593[_0x0a5d('0x4d')],null))[_0x0a5d('0x12')](respondWithResult(_0x56895d,null))[_0x0a5d('0x46')](handleError(_0x56895d,null));};exports[_0x0a5d('0x23')]=function(_0x1650d7,_0x7f4e51){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x1650d7[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x7f4e51,null))['then'](removeEntity(_0x7f4e51,null))['catch'](handleError(_0x7f4e51,null));};exports[_0x0a5d('0x4f')]=function(_0x4fef44,_0x4e1ebb){return db[_0x0a5d('0x2a')]['describe']()[_0x0a5d('0x12')](respondWithResult(_0x4e1ebb,null))[_0x0a5d('0x46')](handleError(_0x4e1ebb,null));};exports[_0x0a5d('0x50')]=function(_0xff744e,_0x225717){if(_0xff744e[_0x0a5d('0x4d')]['id']){delete _0xff744e['body']['id'];}return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0xff744e[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x225717,null))['then'](function(_0x1b7b79){if(_0x1b7b79){_0xff744e[_0x0a5d('0x4d')][_0x0a5d('0x51')]=_0x1b7b79['id'];return db[_0x0a5d('0x52')]['create'](_0xff744e[_0x0a5d('0x4d')]);}})[_0x0a5d('0x12')](respondWithResult(_0x225717,null))['catch'](handleError(_0x225717,null));};exports['getDispositions']=function(_0x3ab0e8,_0x2e17f4){var _0x18f0f4={'raw':![],'where':{}};var _0x14646e={};var _0x5ac037={'count':0x0,'rows':[]};return db[_0x0a5d('0x2a')]['findOne']({'where':{'id':_0x3ab0e8[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x2e17f4,null))[_0x0a5d('0x12')](function(_0x4dfb11){if(_0x4dfb11){_0x14646e['model']=_['keys'](db[_0x0a5d('0x52')][_0x0a5d('0x44')]);_0x14646e['query']=_['keys'](_0x3ab0e8[_0x0a5d('0x2e')]);_0x14646e[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0x14646e[_0x0a5d('0x35')],_0x14646e[_0x0a5d('0x2e')]);_0x18f0f4[_0x0a5d('0x32')]=_['intersection'](_0x14646e['model'],qs[_0x0a5d('0x33')](_0x3ab0e8[_0x0a5d('0x2e')]['fields']));_0x18f0f4[_0x0a5d('0x32')]=_0x18f0f4[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x18f0f4[_0x0a5d('0x32')]:_0x14646e[_0x0a5d('0x35')];if(!_0x3ab0e8[_0x0a5d('0x2e')][_0x0a5d('0x36')]('nolimit')){_0x18f0f4[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x3ab0e8[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x18f0f4['offset']=qs['offset'](_0x3ab0e8[_0x0a5d('0x2e')]['offset']);}_0x18f0f4[_0x0a5d('0x38')]=qs[_0x0a5d('0x39')](_0x3ab0e8[_0x0a5d('0x2e')][_0x0a5d('0x39')]);_0x18f0f4[_0x0a5d('0x3a')]=qs[_0x0a5d('0x30')](_[_0x0a5d('0x53')](_0x3ab0e8['query'],_0x14646e[_0x0a5d('0x30')]));_0x18f0f4[_0x0a5d('0x3a')][_0x0a5d('0x51')]=_0x4dfb11['id'];if(_0x3ab0e8[_0x0a5d('0x2e')]['filter']){_0x18f0f4[_0x0a5d('0x3a')]=_['merge'](_0x18f0f4['where'],{'$or':_['map'](_0x18f0f4[_0x0a5d('0x32')],function(_0x58039d){var _0x532ead={};_0x532ead[_0x58039d]={'$like':'%'+_0x3ab0e8[_0x0a5d('0x2e')][_0x0a5d('0x3d')]+'%'};return _0x532ead;})});}_0x18f0f4=_['merge']({},_0x18f0f4,_0x3ab0e8[_0x0a5d('0x3f')]);return db[_0x0a5d('0x52')][_0x0a5d('0x20')]({'where':_0x18f0f4[_0x0a5d('0x3a')]})[_0x0a5d('0x12')](function(_0x5a7ae9){_0x5ac037['count']=_0x5a7ae9;if(_0x3ab0e8[_0x0a5d('0x2e')][_0x0a5d('0x40')]){_0x18f0f4[_0x0a5d('0x41')]=[{'all':!![]}];}return db[_0x0a5d('0x52')][_0x0a5d('0x42')](_0x18f0f4);})[_0x0a5d('0x12')](function(_0x8ccc12){_0x5ac037[_0x0a5d('0x43')]=_0x8ccc12;return _0x5ac037;});}})[_0x0a5d('0x12')](respondWithFilteredResult(_0x2e17f4,_0x18f0f4))[_0x0a5d('0x46')](handleError(_0x2e17f4,null));};exports['removeDispositions']=function(_0x4648b7,_0x295adb){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x4648b7[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x295adb,null))['then'](function(_0x45a8f6){if(_0x45a8f6){return _0x45a8f6['removeDispositions'](_0x4648b7['query'][_0x0a5d('0x54')]);}})[_0x0a5d('0x12')](respondWithStatusCode(_0x295adb,null))[_0x0a5d('0x46')](handleError(_0x295adb,null));};exports['addAnswer']=function(_0x4d28b6,_0x5486ac){if(_0x4d28b6[_0x0a5d('0x4d')]['id']){delete _0x4d28b6[_0x0a5d('0x4d')]['id'];}return db['ChatWebsite'][_0x0a5d('0x45')]({'where':{'id':_0x4d28b6[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x5486ac,null))[_0x0a5d('0x12')](function(_0x470334){if(_0x470334){_0x4d28b6['body']['ChatWebsiteId']=_0x470334['id'];return db[_0x0a5d('0x55')][_0x0a5d('0x47')](_0x4d28b6[_0x0a5d('0x4d')]);}})['then'](respondWithResult(_0x5486ac,null))[_0x0a5d('0x46')](handleError(_0x5486ac,null));};exports[_0x0a5d('0x56')]=function(_0x191f8d,_0x1abf83){var _0xb823de={'raw':![],'where':{}};var _0x259468={};var _0x20cd14={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x191f8d[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x1abf83,null))[_0x0a5d('0x12')](function(_0x3691f3){if(_0x3691f3){_0x259468[_0x0a5d('0x35')]=_['keys'](db[_0x0a5d('0x55')][_0x0a5d('0x44')]);_0x259468[_0x0a5d('0x2e')]=_['keys'](_0x191f8d['query']);_0x259468[_0x0a5d('0x30')]=_['intersection'](_0x259468[_0x0a5d('0x35')],_0x259468[_0x0a5d('0x2e')]);_0xb823de[_0x0a5d('0x32')]=_[_0x0a5d('0x31')](_0x259468['model'],qs[_0x0a5d('0x33')](_0x191f8d['query']['fields']));_0xb823de[_0x0a5d('0x32')]=_0xb823de[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0xb823de[_0x0a5d('0x32')]:_0x259468['model'];if(!_0x191f8d['query'][_0x0a5d('0x36')](_0x0a5d('0x37'))){_0xb823de[_0x0a5d('0x1f')]=qs['limit'](_0x191f8d['query'][_0x0a5d('0x1f')]);_0xb823de[_0x0a5d('0x1e')]=qs[_0x0a5d('0x1e')](_0x191f8d['query'][_0x0a5d('0x1e')]);}_0xb823de[_0x0a5d('0x38')]=qs['sort'](_0x191f8d[_0x0a5d('0x2e')]['sort']);_0xb823de['where']=qs[_0x0a5d('0x30')](_[_0x0a5d('0x53')](_0x191f8d[_0x0a5d('0x2e')],_0x259468[_0x0a5d('0x30')]));_0xb823de['where'][_0x0a5d('0x51')]=_0x3691f3['id'];if(_0x191f8d[_0x0a5d('0x2e')][_0x0a5d('0x3d')]){_0xb823de[_0x0a5d('0x3a')]=_[_0x0a5d('0x3e')](_0xb823de[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0xb823de[_0x0a5d('0x32')],function(_0x44739e){var _0x298d6f={};_0x298d6f[_0x44739e]={'$like':'%'+_0x191f8d[_0x0a5d('0x2e')]['filter']+'%'};return _0x298d6f;})});}_0xb823de=_[_0x0a5d('0x3e')]({},_0xb823de,_0x191f8d[_0x0a5d('0x3f')]);return db[_0x0a5d('0x55')][_0x0a5d('0x20')]({'where':_0xb823de[_0x0a5d('0x3a')]})[_0x0a5d('0x12')](function(_0x377643){_0x20cd14[_0x0a5d('0x20')]=_0x377643;if(_0x191f8d['query'][_0x0a5d('0x40')]){_0xb823de[_0x0a5d('0x41')]=[{'all':!![]}];}return db[_0x0a5d('0x55')][_0x0a5d('0x42')](_0xb823de);})[_0x0a5d('0x12')](function(_0x54bb73){_0x20cd14[_0x0a5d('0x43')]=_0x54bb73;return _0x20cd14;});}})[_0x0a5d('0x12')](respondWithFilteredResult(_0x1abf83,_0xb823de))[_0x0a5d('0x46')](handleError(_0x1abf83,null));};exports[_0x0a5d('0x57')]=function(_0x24b884,_0x2dd868){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x24b884[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2dd868,null))[_0x0a5d('0x12')](function(_0x1392e0){if(_0x1392e0){return _0x1392e0['removeAnswers'](_0x24b884['query'][_0x0a5d('0x54')]);}})[_0x0a5d('0x12')](respondWithStatusCode(_0x2dd868,null))['catch'](handleError(_0x2dd868,null));};exports['addLogo']=function(_0x173c1e,_0x12e88a){_0x173c1e[_0x0a5d('0x4d')][_0x0a5d('0x58')]=_0x173c1e['file']['filename'];return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x173c1e[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12e88a,null))['then'](saveUpdates(_0x173c1e[_0x0a5d('0x4d')],null))[_0x0a5d('0x12')](respondWithResult(_0x12e88a,null))[_0x0a5d('0x46')](handleError(_0x12e88a,null));};exports[_0x0a5d('0x59')]=function(_0xdaa037,_0xb10e48){_0xdaa037[_0x0a5d('0x4d')]['agentAvatar']=_0xdaa037[_0x0a5d('0x5a')][_0x0a5d('0x5b')];return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0xdaa037[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0xb10e48,null))[_0x0a5d('0x12')](saveUpdates(_0xdaa037[_0x0a5d('0x4d')],null))[_0x0a5d('0x12')](respondWithResult(_0xb10e48,null))[_0x0a5d('0x46')](handleError(_0xb10e48,null));};exports['addCustomerAvatar']=function(_0x5a0061,_0xfe27df){_0x5a0061[_0x0a5d('0x4d')][_0x0a5d('0x5c')]=_0x5a0061['file'][_0x0a5d('0x5b')];return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x5a0061['params']['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0xfe27df,null))[_0x0a5d('0x12')](saveUpdates(_0x5a0061['body'],null))['then'](respondWithResult(_0xfe27df,null))[_0x0a5d('0x46')](handleError(_0xfe27df,null));};exports[_0x0a5d('0x5d')]=function(_0x94f6ab,_0x5bab47){_0x94f6ab[_0x0a5d('0x4d')][_0x0a5d('0x5e')]=_0x94f6ab[_0x0a5d('0x5a')]['filename'];return db[_0x0a5d('0x2a')]['find']({'where':{'id':_0x94f6ab[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5bab47,null))[_0x0a5d('0x12')](saveUpdates(_0x94f6ab[_0x0a5d('0x4d')],null))['then'](respondWithResult(_0x5bab47,null))[_0x0a5d('0x46')](handleError(_0x5bab47,null));};exports['getLogo']=function(_0x251c56,_0xd538e6){var _0x193408=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x61'));var _0x4460e6={'where':{'id':_0x251c56[_0x0a5d('0x4e')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1f9d6d=![];return require(_0x0a5d('0x62'))['getLicense']()[_0x0a5d('0x12')](function(_0x5b920d){if(_0x5b920d){_0x1f9d6d=_0x5b920d[_0x0a5d('0x63')];}})[_0x0a5d('0x12')](function(){return db[_0x0a5d('0x2a')]['find'](_0x4460e6);})[_0x0a5d('0x12')](handleEntityNotFound(_0xd538e6,null))[_0x0a5d('0x12')](function(_0x416b4f){if(_0x416b4f){if(!_['isNil'](_0x416b4f['sitepic'])){if(fs['existsSync'](path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x64'),_0x416b4f[_0x0a5d('0x58')]))&&_0x1f9d6d){_0x193408=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x64'),_0x416b4f[_0x0a5d('0x58')]);}}return _0xd538e6['download'](_0x193408);}})[_0x0a5d('0x46')](handleError(_0xd538e6,null));};exports[_0x0a5d('0x65')]=function(_0x5a5acc,_0x2315a4){var _0x40f09c=path[_0x0a5d('0x5f')](config['root'],_0x0a5d('0x66'));var _0x5b8a2b={'where':{'id':_0x5a5acc[_0x0a5d('0x4e')]['id']},'attributes':['id',_0x0a5d('0x67')],'raw':!![]};return db[_0x0a5d('0x2a')][_0x0a5d('0x45')](_0x5b8a2b)[_0x0a5d('0x12')](handleEntityNotFound(_0x2315a4,null))[_0x0a5d('0x12')](function(_0x5f5e01){if(_0x5f5e01){if(!_['isNil'](_0x5f5e01[_0x0a5d('0x67')])){if(fs['existsSync'](path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x68'),_0x5f5e01[_0x0a5d('0x67')]))){_0x40f09c=path[_0x0a5d('0x5f')](config['root'],_0x0a5d('0x68'),_0x5f5e01['agentAvatar']);}}return _0x2315a4['download'](_0x40f09c);}})[_0x0a5d('0x46')](handleError(_0x2315a4,null));};exports['getCustomerAvatar']=function(_0x330303,_0x196c1f){var _0x1867f9=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x69'));var _0x44fe28={'where':{'id':_0x330303[_0x0a5d('0x4e')]['id']},'attributes':['id','customerAvatar',_0x0a5d('0x6a')],'raw':!![]};return db[_0x0a5d('0x2a')][_0x0a5d('0x45')](_0x44fe28)[_0x0a5d('0x12')](handleEntityNotFound(_0x196c1f,null))[_0x0a5d('0x12')](function(_0x2ace25){if(_0x2ace25){if(!_['isNil'](_0x2ace25[_0x0a5d('0x5c')])){if(fs[_0x0a5d('0x6b')](path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x68'),_0x2ace25[_0x0a5d('0x5c')]))&&_0x2ace25['showCustomerAvatar']){_0x1867f9=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x68'),_0x2ace25['customerAvatar']);}}return _0x196c1f[_0x0a5d('0x6c')](_0x1867f9);}})[_0x0a5d('0x46')](handleError(_0x196c1f,null));};exports[_0x0a5d('0x6d')]=function(_0x1f5140,_0x46f054){var _0x1cd521=path[_0x0a5d('0x5f')](config['root'],_0x0a5d('0x6e'));var _0x16f3a0={'where':{'id':_0x1f5140['params']['id']},'attributes':['id',_0x0a5d('0x5e')],'raw':!![]};return db['ChatWebsite']['find'](_0x16f3a0)[_0x0a5d('0x12')](handleEntityNotFound(_0x46f054,null))[_0x0a5d('0x12')](function(_0x10a8ef){if(_0x10a8ef){if(!_['isNil'](_0x10a8ef[_0x0a5d('0x5e')])){if(fs[_0x0a5d('0x6b')](path['join'](config[_0x0a5d('0x60')],_0x0a5d('0x68'),_0x10a8ef[_0x0a5d('0x5e')]))){_0x1cd521=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0x68'),_0x10a8ef[_0x0a5d('0x5e')]);}}return _0x46f054[_0x0a5d('0x6c')](_0x1cd521);}})['catch'](handleError(_0x46f054,null));};exports[_0x0a5d('0x6f')]=function(_0x43ee17,_0x547d34){var _0x1f91b9=require(_0x0a5d('0x70'));var _0x4b316c=new _0x1f91b9();var _0x22446c=_0x4b316c[_0x0a5d('0x71')](_0x43ee17[_0x0a5d('0x72')]['user-agent'])[_0x0a5d('0x73')]();var _0x3ff6b8={'body':_0x43ee17[_0x0a5d('0x4d')],'channel':_0x0a5d('0x74')};var _0x5afd2c=[];var _0x491a5d=[];var _0x100c08={};var _0x4ce06a=![];return db[_0x0a5d('0x75')][_0x0a5d('0x4f')]()[_0x0a5d('0x12')](function(_0x2aa5a0){if(!_0x2aa5a0){throw new db[(_0x0a5d('0x76'))]['ValidationError'](_0x0a5d('0x77'));}_0x5afd2c=_[_0x0a5d('0x78')](_[_0x0a5d('0x2f')](_0x2aa5a0),[_0x0a5d('0x79'),_0x0a5d('0x7a')]);_0x491a5d=_[_0x0a5d('0x78')](_[_0x0a5d('0x2f')](_0x2aa5a0),[_0x0a5d('0x79'),_0x0a5d('0x7a'),'CompanyId','ListId']);if(_0x43ee17['body']['id']){delete _0x43ee17[_0x0a5d('0x4d')]['id'];}if(_[_0x0a5d('0x7b')](_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x7c')])){throw new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))](_0x0a5d('0x7e'));}if(_[_0x0a5d('0x7b')](_0x43ee17['body'][_0x0a5d('0x4d')])||_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x4d')]===''){throw new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))](_0x0a5d('0x7f'));}if(_['isNil'](_0x43ee17[_0x0a5d('0x4d')]['mapKey'])){throw new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x491a5d);}if(!_[_0x0a5d('0x80')](_0x491a5d,_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x81')])){throw new db[(_0x0a5d('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x491a5d);}_0x100c08[_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x81')]]=_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x7c')];})[_0x0a5d('0x12')](function(){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x43ee17['params']['id']},'include':[{'model':db[_0x0a5d('0x82')],'as':'List','include':[{'model':db[_0x0a5d('0x75')],'as':_0x0a5d('0x83'),'where':_0x100c08,'limit':0x1,'order':[[_0x0a5d('0x7a'),_0x0a5d('0x84')]]}]},{'model':db[_0x0a5d('0x85')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x547d34,null))['then'](function(_0x4a5366){if(_0x4a5366&&_0x4a5366[_0x0a5d('0x86')]){_0x3ff6b8[_0x0a5d('0x87')]=_0x4a5366;_0x3ff6b8[_0x0a5d('0x88')]=_0x4a5366[_0x0a5d('0x89')];_0x3ff6b8[_0x0a5d('0x8a')]=_0x4a5366[_0x0a5d('0x86')];_0x3ff6b8['applications']=_[_0x0a5d('0x8b')](_0x3ff6b8[_0x0a5d('0x88')],[_0x0a5d('0x8c')],[_0x0a5d('0x8d')]);if(_0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0x89')]){delete _0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0x89')];}if(_0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0x86')]&&_0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0x86')][_0x0a5d('0x83')][_0x0a5d('0x34')]){return _0x3ff6b8[_0x0a5d('0x87')]['List'][_0x0a5d('0x83')][0x0];}var _0x4dea7a=_[_0x0a5d('0x8e')](_0x43ee17[_0x0a5d('0x4d')],{'firstName':_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x7c')],'ListId':_0x4a5366[_0x0a5d('0x8f')]});_0x4dea7a[_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x81')]]=_0x43ee17['body'][_0x0a5d('0x7c')];return db[_0x0a5d('0x75')][_0x0a5d('0x47')](_0x4dea7a,{'fields':_0x5afd2c,'raw':!![]});}})[_0x0a5d('0x12')](handleEntityNotFound(_0x547d34,null))[_0x0a5d('0x12')](function(_0x4d6c50){_0x3ff6b8[_0x0a5d('0x90')]=_0x4d6c50;var _0x5d8f97=_0x43ee17['body'][_0x0a5d('0x91')];if(_0x43ee17['headers'][_0x0a5d('0x92')]){_0x5d8f97=_0x43ee17[_0x0a5d('0x72')]['cf-connecting-ip'];}else if(_0x43ee17[_0x0a5d('0x72')][_0x0a5d('0x93')]){_0x5d8f97=_['first'](_0x43ee17['headers'][_0x0a5d('0x93')][_0x0a5d('0x94')](','));}if(_0x4d6c50){var _0x456a69={'ContactId':_0x4d6c50['id'],'ChatWebsiteId':_0x43ee17[_0x0a5d('0x4e')]['id'],'from':(_0x4d6c50[_0x0a5d('0x95')]||'')+'\x20'+(_0x4d6c50[_0x0a5d('0x96')]||''),'customerIp':_0x5d8f97,'customerPort':_0x43ee17[_0x0a5d('0x72')][_0x0a5d('0x97')]?_0x43ee17[_0x0a5d('0x72')][_0x0a5d('0x97')]:null,'referer':_0x43ee17['body']['referer'],'browserName':_0x22446c[_0x0a5d('0x98')][_0x0a5d('0x2d')]&&_0x22446c[_0x0a5d('0x98')][_0x0a5d('0x99')]?util['format']('%s\x20%s',_0x22446c[_0x0a5d('0x98')][_0x0a5d('0x2d')],_0x22446c[_0x0a5d('0x98')][_0x0a5d('0x99')]):_0x0a5d('0x9a'),'browserVersion':_0x22446c['browser'][_0x0a5d('0x99')]||_0x0a5d('0x9a'),'osName':util[_0x0a5d('0x9b')](_0x0a5d('0x9c'),_0x22446c['os'][_0x0a5d('0x2d')],_0x22446c['os'][_0x0a5d('0x99')]),'osVersion':_0x22446c['os'][_0x0a5d('0x99')],'deviceModel':_0x22446c[_0x0a5d('0x9d')]['model']&&_0x22446c[_0x0a5d('0x9d')][_0x0a5d('0x9e')]?util[_0x0a5d('0x9b')]('%s\x20%s\x20%s',_0x22446c[_0x0a5d('0x9d')]['model'],_0x22446c['device'][_0x0a5d('0x9e')],_0x22446c[_0x0a5d('0x9d')][_0x0a5d('0x2b')]):null,'deviceVendor':_0x22446c[_0x0a5d('0x9d')][_0x0a5d('0x9e')],'deviceType':_0x22446c[_0x0a5d('0x9d')][_0x0a5d('0x2b')],'formData':JSON[_0x0a5d('0x15')](_0x43ee17[_0x0a5d('0x4d')])};var _0x156922={'ChatWebsiteId':_0x43ee17[_0x0a5d('0x4e')]['id'],'closed':![]};if(_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x9f')]){_0x156922[_0x0a5d('0x9f')]=_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x9f')];return db[_0x0a5d('0xa0')]['find']({'where':_0x156922})[_0x0a5d('0x12')](function(_0x2fbb0e){if(_0x2fbb0e){return[_0x2fbb0e,![]];}_0x456a69[_0x0a5d('0x9f')]=_0x43ee17['body'][_0x0a5d('0x9f')];_0x456a69[_0x0a5d('0xa1')]=_0x43ee17[_0x0a5d('0x4d')]['externalUrl'];return db[_0x0a5d('0xa0')][_0x0a5d('0x47')](_0x456a69)['then'](function(_0x164efa){return[_0x164efa,!![]];});});}_0x156922[_0x0a5d('0xa2')]=_0x4d6c50['id'];if(_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xa3')]&&_0x43ee17[_0x0a5d('0x4d')]['interaction']['id']){_0x156922['id']=_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xa3')]['id'];return db[_0x0a5d('0xa0')]['find']({'where':_0x156922})[_0x0a5d('0x12')](function(_0x793eb7){if(_0x793eb7){return[_0x793eb7,![]];}return db[_0x0a5d('0xa0')][_0x0a5d('0x47')](_0x456a69)[_0x0a5d('0x12')](function(_0x4a87c2){return[_0x4a87c2,!![]];});});}return db['ChatInteraction'][_0x0a5d('0x47')](_0x456a69)[_0x0a5d('0x12')](function(_0x564187){return[_0x564187,!![]];});}})[_0x0a5d('0xa4')](function(_0x4c1991,_0x454c8e){if(_0x4c1991){_0x4ce06a=_0x454c8e;if(!_0x454c8e){var _0x3f8925={'from':(_0x3ff6b8[_0x0a5d('0x90')][_0x0a5d('0x95')]||'')+'\x20'+(_0x3ff6b8[_0x0a5d('0x90')]['lastName']||'')};if(_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x9f')]&&_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xa5')]&&_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x9f')]!=_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xa5')]){_0x3f8925[_0x0a5d('0x9f')]=_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xa5')];}return _0x4c1991[_0x0a5d('0x22')](_0x3f8925);}else{return _0x4c1991;}}})[_0x0a5d('0x12')](function(_0x1c61e9){_0x3ff6b8[_0x0a5d('0xa3')]=_0x1c61e9[_0x0a5d('0x49')]({'plain':!![]});_0x3ff6b8['interaction'][_0x0a5d('0xa6')]=_0x4ce06a;if(_0x3ff6b8[_0x0a5d('0xa3')]['created']){if(_0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0xa7')]){_0x3ff6b8[_0x0a5d('0x88')][_0x0a5d('0xa8')]({'id':0x0,'priority':_0x3ff6b8['applications'][_0x0a5d('0x34')]+0x1,'app':_0x0a5d('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x0a5d('0xaa')]['create']({'body':_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0x4d')],'ChatWebsiteId':_0x43ee17[_0x0a5d('0x4e')]['id'],'ChatInteractionId':_0x1c61e9['id'],'direction':'in','ContactId':_0x3ff6b8[_0x0a5d('0x90')]['id'],'AttachmentId':_0x43ee17[_0x0a5d('0x4d')][_0x0a5d('0xab')]});})[_0x0a5d('0x12')](function(_0x2b720f){_0x3ff6b8[_0x0a5d('0x19')]=_0x2b720f;if(_0x3ff6b8['interaction'][_0x0a5d('0xac')]){return db[_0x0a5d('0xad')][_0x0a5d('0x45')]({'attributes':['id',_0x0a5d('0x2d')],'where':{'id':_0x3ff6b8['interaction'][_0x0a5d('0xac')]}})[_0x0a5d('0x12')](function(_0x567203){if(_0x567203){_0x3ff6b8[_0x0a5d('0x88')][_0x0a5d('0xae')]({'id':0x0,'priority':0x0,'app':_0x0a5d('0xaf'),'appdata':_0x567203['name']+','+(_0x3ff6b8[_0x0a5d('0x87')][_0x0a5d('0xb0')]||0xa),'interval':'*,*,*,*'});_0x3ff6b8[_0x0a5d('0xb1')]=!![];}return respondWithRpcPromise(_0x0a5d('0xb2'),'startRouting',_0x3ff6b8);});}return respondWithRpcPromise(_0x0a5d('0xb2'),'startRouting',_0x3ff6b8);})['then'](function(_0x3738ae){respondWithRpcPromise(_0x0a5d('0xb3'),_0x0a5d('0xb3'),{'event':_0x0a5d('0x6f'),'message':_0x3738ae},client9002);return _0x3738ae;})[_0x0a5d('0x12')](respondWithResult(_0x547d34,null))[_0x0a5d('0x46')](handleError(_0x547d34,null));};exports['offline']=function(_0xa5adb9,_0x4a3e05){var _0x41d54e,_0x4bbb1f,_0x7bc63f;var _0x168474=[];var _0x1966cb={};var _0x33d419=_0xa5adb9[_0x0a5d('0xb4')]||[];var _0x5d996b=[];var _0x5ad6d6;return db[_0x0a5d('0x75')][_0x0a5d('0x4f')]()[_0x0a5d('0x12')](function(_0x299e66){if(!_0x299e66){throw new db['Sequelize'][(_0x0a5d('0x7d'))](_0x0a5d('0x77'));}_0x168474=_[_0x0a5d('0x78')](_[_0x0a5d('0x2f')](_0x299e66),[_0x0a5d('0x79'),'updatedAt',_0x0a5d('0xb5'),_0x0a5d('0x8f')]);if(_0xa5adb9[_0x0a5d('0x4d')]['id']){delete _0xa5adb9[_0x0a5d('0x4d')]['id'];}if(_[_0x0a5d('0x7b')](_0xa5adb9['body'][_0x0a5d('0x7c')])){throw _0x4a3e05['status'](0x1f4)[_0x0a5d('0x27')](new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))](_0x0a5d('0x7e')));}if(_[_0x0a5d('0x7b')](_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0x4d')])||_0xa5adb9['body'][_0x0a5d('0x4d')]===''){throw _0x4a3e05[_0x0a5d('0x1c')](0x1f4)[_0x0a5d('0x27')](new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))](_0x0a5d('0x7f')));}if(_[_0x0a5d('0x7b')](_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0xb6')])){throw _0x4a3e05['status'](0x1f4)[_0x0a5d('0x27')](new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x168474));}if(!_['includes'](_0x168474,_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0xb6')])){throw _0x4a3e05[_0x0a5d('0x1c')](0x1f4)['send'](new db[(_0x0a5d('0x76'))][(_0x0a5d('0x7d'))](_0x0a5d('0xb7')+_0x168474));}_0x1966cb[_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0xb6')]]=_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0x7c')];})['then'](function(){return db['ChatWebsite'][_0x0a5d('0x45')]({'where':{'id':_0xa5adb9[_0x0a5d('0x4e')]['id']},'include':[{'model':db[_0x0a5d('0x82')],'as':_0x0a5d('0x86')},{'model':db[_0x0a5d('0xb8')],'as':_0x0a5d('0xb8')}]});})[_0x0a5d('0x12')](handleEntityNotFound(_0x4a3e05,null))['then'](function(_0x1f7fef){if(_0x1f7fef&&_0x1f7fef[_0x0a5d('0x86')]){_0x4bbb1f=_0x1f7fef;var _0x35d926=_[_0x0a5d('0x8e')](_0xa5adb9['body'],{'firstName':_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0x7c')],'phone':_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0x7c')],'ListId':_0x1f7fef[_0x0a5d('0x8f')]});_0x35d926[_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0xb6')]]=_0xa5adb9[_0x0a5d('0x4d')][_0x0a5d('0x7c')];return db[_0x0a5d('0x75')][_0x0a5d('0xb9')]({'where':_0x1966cb,'defaults':_0x35d926});}})[_0x0a5d('0xa4')](function(_0x56a8a2){if(_0x56a8a2){_0x7bc63f=_0x56a8a2;var _0x4be04e=fs['readFileSync'](path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0xba')),_0x0a5d('0xbb'));var _0x354a06=ejs[_0x0a5d('0xbc')](_0x4be04e,{'body':_[_0x0a5d('0xbd')](_0xa5adb9[_0x0a5d('0x4d')]['body']),'bodyTitle':_0x4bbb1f['offlineMessageBody']});return db[_0x0a5d('0xbe')][_0x0a5d('0x47')]({'body':_0x354a06,'plainBody':htmlToText[_0x0a5d('0xbf')](_0x354a06),'ContactId':_0x56a8a2['id'],'ChatWebsiteId':_0x4bbb1f['id']});}})[_0x0a5d('0x12')](function(_0x3f6789){_0x5ad6d6=_0x3f6789;if(_0x33d419[_0x0a5d('0x34')]){var _0x4eed71=_0x33d419['map'](function(_0x446838){return{'name':_0x446838[_0x0a5d('0xc0')],'basename':_0x446838[_0x0a5d('0x5b')],'type':_0x446838[_0x0a5d('0xc1')],'ChatOfflineMessageId':_0x3f6789['id']};});_0x5d996b=_0x4eed71[_0x0a5d('0x3b')](_0x40b9cc=>{var _0x357b3a={'filename':_0x40b9cc['name'],'path':path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0xc2'),'files',_0x0a5d('0xc3'),'offline-chat',_0x40b9cc[_0x0a5d('0xc4')])};return _0x357b3a;});if(!_0x4bbb1f['openNewInteraction']){return db[_0x0a5d('0xc5')][_0x0a5d('0xc6')](function(_0x10168a){return db['Attachment']['bulkCreate'](_0x4eed71,{'transaction':_0x10168a});});}}})[_0x0a5d('0x12')](function(){if(_0x5ad6d6){_0x41d54e=_0x5ad6d6;return db[_0x0a5d('0xb8')][_0x0a5d('0xc7')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0a5d('0xc8')],'as':_0x0a5d('0xc8'),'raw':!![]}]}]});}})[_0x0a5d('0x12')](function(_0xdf9322){if(_0xdf9322&&_0xdf9322[_0x0a5d('0xc9')]&&_0x4bbb1f[_0x0a5d('0xca')]&&_0x4bbb1f[_0x0a5d('0xcb')]){var _0x140be1=_0xdf9322['getSmtpOptions']();return respondWithRpcPromise(_0x0a5d('0xcc'),_0x0a5d('0xcd'),{'account':_0x140be1,'message':{'from':util[_0x0a5d('0x9b')](_0x0a5d('0xce'),_0xdf9322['name'],_0xdf9322[_0x0a5d('0xcf')]||_0xdf9322[_0x0a5d('0xc9')][_0x0a5d('0x48')]),'to':_0x4bbb1f[_0x0a5d('0xcb')],'subject':_0x4bbb1f['offlineMessageSubject'],'html':_0x41d54e[_0x0a5d('0x4d')],'attachments':_0x5d996b}},client9003)[_0x0a5d('0x12')](function(){return _0x41d54e;})[_0x0a5d('0x46')](function(_0xd12859){logger[_0x0a5d('0x16')](_0xd12859);});}})[_0x0a5d('0x12')](function(){if(_0x4bbb1f&&_0x4bbb1f[_0x0a5d('0xd0')]&&_0x4bbb1f[_0x0a5d('0xd1')]){var _0x2d5595=[];if(_0x33d419[_0x0a5d('0x34')]){_0x2d5595=_0x33d419[_0x0a5d('0x3b')](function(_0x5725bd){return{'name':_0x5725bd['originalname'],'basename':_0x5725bd['filename'],'type':_0x5725bd['mimetype'],'ChatOfflineMessageId':_0x5ad6d6['id']};});}var _0xc86d41;if(!_[_0x0a5d('0x7b')](_0x4bbb1f['subjectOffline'])){var _0x3367c1=_['map'](_0xa5adb9[_0x0a5d('0x4d')],function(_0x26ca83){return _0x26ca83;});var _0x5ed5d2=_['toPairsIn'](_0x3367c1)[0x0];var _0xff9dd6=_[_0x0a5d('0xd2')](_0x5ed5d2,function(_0x326645){return _0x326645;});_0xc86d41=_0xff9dd6[0x1][_0x4bbb1f[_0x0a5d('0xd3')]];}var _0x48c659={'from':_0x7bc63f[_0x0a5d('0xcf')],'firstName':_0x7bc63f[_0x0a5d('0x95')],'lastName':_0x7bc63f[_0x0a5d('0x96')],'mapKey':_0x0a5d('0xcf'),'message':{'from':_0x7bc63f[_0x0a5d('0xcf')],'to':_0x4bbb1f[_0x0a5d('0xb8')]['email'],'cc':'','subject':_[_0x0a5d('0x7b')](_0xc86d41)?_0x4bbb1f[_0x0a5d('0xd4')]:_0xc86d41,'messageId':'','sentAt':new Date(),'attach':_0x2d5595[_0x0a5d('0x34')],'attachments':_0x2d5595,'originChannel':_0x0a5d('0xd5'),'ChatWebsiteId':_0x4bbb1f['id'],'ChatOfflineMessageId':_0x41d54e['id'],'originTo':_0x4bbb1f['MailAccount'][_0x0a5d('0xcf')]},'body':_0x41d54e[_0x0a5d('0x4d')]};var _0x2b2cd8={'account':{'id':_0x4bbb1f[_0x0a5d('0xd1')]},'body':_0x48c659,'log':_0x0a5d('0xd6')};return respondWithRpcPromise('NotifyMailAccount',_0x0a5d('0xd7'),_0x2b2cd8,client9001)[_0x0a5d('0x12')](function(){return _0x41d54e;})[_0x0a5d('0x46')](function(_0x44f75c){logger['error'](_0x44f75c);});}return;})['then'](function(){if(_0x41d54e){return _0x41d54e;}})[_0x0a5d('0x12')](respondWithResult(_0x4a3e05,null))[_0x0a5d('0x46')](function(_0x3b5946){logger[_0x0a5d('0x16')](_0x0a5d('0x46'),_0x3b5946);for(var _0x24c8e3 of _0x33d419){var _0x19b1f1=path[_0x0a5d('0x5f')](config[_0x0a5d('0x60')],_0x0a5d('0xc2'),_0x0a5d('0xb4'),'attachments',_0x0a5d('0xd8'),_0x24c8e3['filename']);fs_extra['remove'](_0x19b1f1)[_0x0a5d('0x46')](function(_0x550a9b){logger['error'](_0x0a5d('0xd9'),_0x19b1f1,_0x550a9b);});}});};exports[_0x0a5d('0xda')]=function(_0x2c61a4,_0x1ca7f7){return db[_0x0a5d('0xa0')][_0x0a5d('0x45')]({'where':{'id':_0x2c61a4[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ca7f7,null))['then'](function(_0x5d640b){if(_0x5d640b){return _0x5d640b['addInteraction'](_0x2c61a4[_0x0a5d('0x4d')]['ids'],_['omit'](_0x2c61a4[_0x0a5d('0x4d')],[_0x0a5d('0x54'),'id'])||{});}})[_0x0a5d('0x12')](respondWithResult(_0x1ca7f7,null))['catch'](handleError(_0x1ca7f7,null));};exports[_0x0a5d('0xdb')]=function(_0x1b4861,_0x52daa8){var _0x4cc62a={'raw':![],'where':{}};var _0x5a6379={};var _0x12b40a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0a5d('0xc7')]({'where':{'id':_0x1b4861[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x52daa8,null))[_0x0a5d('0x12')](function(_0xabd00){if(_0xabd00){_0x5a6379[_0x0a5d('0x35')]=_['keys'](db[_0x0a5d('0xa0')]['rawAttributes']);_0x5a6379[_0x0a5d('0x2e')]=_[_0x0a5d('0x2f')](_0x1b4861[_0x0a5d('0x2e')]);_0x5a6379[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0x5a6379['model'],_0x5a6379[_0x0a5d('0x2e')]);_0x4cc62a[_0x0a5d('0x32')]=_['intersection'](_0x5a6379[_0x0a5d('0x35')],qs[_0x0a5d('0x33')](_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0x33')]));_0x4cc62a[_0x0a5d('0x32')]=_0x4cc62a[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x4cc62a['attributes']:_0x5a6379[_0x0a5d('0x35')];if(!_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0x36')]('nolimit')){_0x4cc62a[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x4cc62a[_0x0a5d('0x1e')]=qs[_0x0a5d('0x1e')](_0x1b4861['query']['offset']);}_0x4cc62a[_0x0a5d('0x38')]=qs['sort'](_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0x39')]);_0x4cc62a[_0x0a5d('0x3a')]=qs[_0x0a5d('0x30')](_[_0x0a5d('0x53')](_0x1b4861[_0x0a5d('0x2e')],_0x5a6379['filters']));_0x4cc62a[_0x0a5d('0x3a')]['ChatWebsiteId']=_0xabd00['id'];if(_0x1b4861['query']['filter']){_0x4cc62a[_0x0a5d('0x3a')]=_[_0x0a5d('0x3e')](_0x4cc62a[_0x0a5d('0x3a')],{'$or':_['map'](_0x4cc62a[_0x0a5d('0x32')],function(_0x4099e9){var _0x4afafd={};_0x4afafd[_0x4099e9]={'$like':'%'+_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0x3d')]+'%'};return _0x4afafd;})});}_0x4cc62a=_[_0x0a5d('0x3e')]({},_0x4cc62a,_0x1b4861['options']);return db[_0x0a5d('0xa0')][_0x0a5d('0x20')]({'where':_0x4cc62a[_0x0a5d('0x3a')]})[_0x0a5d('0x12')](function(_0x139ade){_0x12b40a[_0x0a5d('0x20')]=_0x139ade;if(_0x1b4861['query'][_0x0a5d('0x40')]){_0x4cc62a['include']=[{'model':db[_0x0a5d('0x75')],'as':_0x0a5d('0xdc'),'required':![]},{'model':db[_0x0a5d('0xad')],'as':_0x0a5d('0xdd'),'attributes':[_0x0a5d('0x2d'),_0x0a5d('0xde'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0a5d('0xdf'),'attributes':['id',_0x0a5d('0x2d'),_0x0a5d('0xe0')],'where':_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0xe1')]?{'id':_0x1b4861[_0x0a5d('0x2e')][_0x0a5d('0xe1')]}:undefined,'required':_0x1b4861['query'][_0x0a5d('0xe1')]?!![]:![]}];}return db[_0x0a5d('0xa0')][_0x0a5d('0x42')](_0x4cc62a);})[_0x0a5d('0x12')](function(_0x1f17e6){_0x12b40a[_0x0a5d('0x43')]=_0x1f17e6;return _0x12b40a;});}})['then'](respondWithFilteredResult(_0x52daa8,_0x4cc62a))[_0x0a5d('0x46')](handleError(_0x52daa8,null));};function iftimePromise(_0x528538,_0x4f7a05){return respondWithRpcPromise(_0x0a5d('0xe2'),_0x0a5d('0xe3'),{'command':_0x4f7a05[_0x0a5d('0xe4')]?util[_0x0a5d('0x9b')](_0x0a5d('0xe5'),_0x528538[_0x0a5d('0xe6')],_0x4f7a05[_0x0a5d('0xe4')]):util[_0x0a5d('0x9b')](_0x0a5d('0xe7'),_0x528538[_0x0a5d('0xe6')])},client9002)[_0x0a5d('0x12')](function(_0x4149e0){var _0x349fb9=_0x4149e0&&_0x4149e0[_0x0a5d('0xe8')]('true')>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4f7a05['id'],_0x528538['id'],_0x528538[_0x0a5d('0xe6')],_0x349fb9?_0x0a5d('0xe9'):_0x0a5d('0xea'),_0x4f7a05[_0x0a5d('0xe4')]?_0x4f7a05['timezone']:_0x0a5d('0xeb'));return _0x349fb9;})['catch'](function(_0x5799b6){logger[_0x0a5d('0x16')](_0x0a5d('0xec'),_0x4f7a05['id'],_0x528538['id'],_0x528538['interval'],util[_0x0a5d('0xed')](_0x5799b6,{'showHidden':![],'depth':null}),_0x4f7a05[_0x0a5d('0xe4')]?_0x4f7a05[_0x0a5d('0xe4')]:_0x0a5d('0xeb'));return![];});}exports[_0x0a5d('0xe3')]=function(_0x187cc2,_0x3aec2c){var _0x410297=0x0;var _0x356121=0x0;var _0x455643=![];var _0x94b5ec;var _0x10f825;return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x187cc2['params']['id']},'include':[{'model':db[_0x0a5d('0xee')],'as':_0x0a5d('0xee'),'include':[{'model':db[_0x0a5d('0xee')],'as':_0x0a5d('0xef'),'attributes':['id',_0x0a5d('0xe6')],'raw':!![]}]}]})[_0x0a5d('0x12')](handleEntityNotFound(_0x3aec2c,null))['then'](function(_0x17f245){if(_0x17f245){_0x94b5ec=_0x17f245;return _0x17f245['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3323f7){if(_0x94b5ec){if(_0x3323f7){_0x10f825=_0x3323f7;}}return require(_0x0a5d('0x62'))[_0x0a5d('0xf0')]();})[_0x0a5d('0x12')](function(_0xb730b8){if(_0xb730b8){_0x356121=_0xb730b8[_0x0a5d('0xf1')];_0x455643=_0xb730b8[_0x0a5d('0x63')];}})['then'](function(){return db[_0x0a5d('0xa0')][_0x0a5d('0x20')]({'where':{'closed':![]}});})[_0x0a5d('0x12')](function(_0x143cfe){_0x410297=_0x143cfe;if(_0x356121&&_0x143cfe>_0x356121){return db[_0x0a5d('0xf2')][_0x0a5d('0xc7')]({'where':{'id':0x1}})[_0x0a5d('0x12')](function(_0x5a2b47){if(_0x5a2b47){_0x5a2b47['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x94b5ec['Interval']&&_0x94b5ec[_0x0a5d('0xee')][_0x0a5d('0xef')]){var _0x33b8e0=[];for(var _0xc72d5=0x0;_0xc72d5<_0x94b5ec[_0x0a5d('0xee')][_0x0a5d('0xef')][_0x0a5d('0x34')];_0xc72d5++){var _0x5f1fde=_0x94b5ec['Interval']['Intervals'][_0xc72d5][_0x0a5d('0x49')]({'plain':!![]});_0x33b8e0[_0x0a5d('0xa8')](iftimePromise(_0x5f1fde,_0x94b5ec));}return BPromise[_0x0a5d('0xf3')](_0x33b8e0)[_0x0a5d('0x12')](function(_0x2fa8c7){return _['some'](_0x2fa8c7);});}else{return!![];}})['then'](function(_0x144cf2){var _0x4d9544=fs[_0x0a5d('0xf4')](path['join'](config[_0x0a5d('0x60')],_0x0a5d('0xf5')),'utf8');var _0x30287d=new url[(_0x0a5d('0xf6'))](_0x94b5ec[_0x0a5d('0xf7')])[_0x0a5d('0xf8')];var _0x39bd92=_0x0a5d('0xf9');var _0x5f0bf7=![];var _0x2f8927={'chatVersion':_0x39bd92,'chatWebsiteAddressOrigin':_0x30287d,'remote':_0x94b5ec['remote'],'query':querystring[_0x0a5d('0x15')](_[_0x0a5d('0x3e')](_0x94b5ec['get']({'plain':!![]}),{'customerIp':_0x187cc2['headers'][_0x0a5d('0x93')]||_0x187cc2[_0x0a5d('0x72')][_0x0a5d('0xfa')]||_0x187cc2[_0x0a5d('0xfb')][_0x0a5d('0xfc')]||_0x187cc2['ip'],'referer':_0x187cc2[_0x0a5d('0x72')][_0x0a5d('0xfd')],'openedInteractions':_0x410297,'maxInteractions':_0x356121,'virtual':_0x455643['virtual'],'online':_0x144cf2,'custom':_0x455643}))[_0x0a5d('0xfe')](/'/g,'\x5c\x27')};_0x3aec2c['send'](ejs['render'](Mustache[_0x0a5d('0xbc')](_0x4d9544,_0x2f8927),{'proactiveActions':_0x10f825,'alignment':_0x94b5ec['alignment'],'verticalAlignment':_0x94b5ec[_0x0a5d('0xff')],'div_color':_0x94b5ec[_0x0a5d('0xe0')],'labelText':_0x94b5ec['labelText'],'text_color':_0x94b5ec[_0x0a5d('0x100')],'text_button_color':_0x94b5ec[_0x0a5d('0x101')],'button_color':_0x94b5ec[_0x0a5d('0x102')],'background_color':_0x94b5ec['backgroundColor'],'hideWhenOffline':_0x94b5ec[_0x0a5d('0x103')],'intervalId':_0x94b5ec[_0x0a5d('0x104')],'isDevelopment':_0x5f0bf7,'chatVersion':_0x39bd92}));})[_0x0a5d('0x46')](handleError(_0x3aec2c,null));};exports[_0x0a5d('0x105')]=function(_0x4e547e,_0x428129){var _0x4d955b=_0x4e547e[_0x0a5d('0x4e')]['id'];var _0x104788=_0x4e547e['body'];var _0x42a64b=0xc8;var _0x4b2825=null;return db['sequelize'][_0x0a5d('0xc6')]({'isolationLevel':db[_0x0a5d('0xc5')][_0x0a5d('0x106')]['ISOLATION_LEVELS'][_0x0a5d('0x107')]},function(_0x37f5e5){return db[_0x0a5d('0x2a')][_0x0a5d('0xc7')]({'where':{'id':_0x4d955b},'transaction':_0x37f5e5})[_0x0a5d('0x12')](function(_0x381b13){if(_0x381b13){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x4d955b},'transaction':_0x37f5e5})[_0x0a5d('0x12')](function(){var _0x3ad58e=_['map'](_0x104788,function(_0x28a910){_0x28a910[_0x0a5d('0x51')]=_0x4d955b;return _0x28a910;});return db[_0x0a5d('0x85')]['bulkCreate'](_0x3ad58e,{'transaction':_0x37f5e5});});}else{_0x42a64b=0x194;_0x4b2825=[];}});})[_0x0a5d('0x12')](function(){if(_0x42a64b!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x4d955b},'order':_0x0a5d('0x8c')})[_0x0a5d('0x12')](function(_0xd72e75){_0x4b2825=_0xd72e75;});}})[_0x0a5d('0x46')](function(_0x5b41d9){_0x42a64b=0x1f4;logger['error'](_0x5b41d9['stack']);if(_0x5b41d9['name']){delete _0x5b41d9[_0x0a5d('0x2d')];}_0x4b2825=_0x5b41d9;})[_0x0a5d('0x108')](function(){if(_0x4b2825===null){_0x428129[_0x0a5d('0x1b')](_0x42a64b);}else{if(_0x42a64b===0x1f4){_0x428129[_0x0a5d('0x1c')](_0x42a64b)['send'](_0x4b2825);}else{_0x428129['status'](_0x42a64b)['json'](_0x4b2825);}}});};exports['getApplications']=function(_0x53509b,_0x90c403){var _0x515983={};var _0x56a4fa={};var _0x3268a8;var _0xf83cd6;return db[_0x0a5d('0x2a')][_0x0a5d('0xc7')]({'where':{'id':_0x53509b[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x90c403,null))['then'](function(_0x3d5f32){if(_0x3d5f32){_0x3268a8=_0x3d5f32;_0x56a4fa[_0x0a5d('0x35')]=_['keys'](db[_0x0a5d('0x85')][_0x0a5d('0x44')]);_0x56a4fa[_0x0a5d('0x2e')]=_[_0x0a5d('0x2f')](_0x53509b[_0x0a5d('0x2e')]);_0x56a4fa[_0x0a5d('0x30')]=_['intersection'](_0x56a4fa[_0x0a5d('0x35')],_0x56a4fa[_0x0a5d('0x2e')]);_0x515983[_0x0a5d('0x32')]=_[_0x0a5d('0x31')](_0x56a4fa[_0x0a5d('0x35')],qs['fields'](_0x53509b[_0x0a5d('0x2e')][_0x0a5d('0x33')]));_0x515983['attributes']=_0x515983[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x515983[_0x0a5d('0x32')]:_0x56a4fa['model'];_0x515983[_0x0a5d('0x38')]=qs[_0x0a5d('0x39')](_0x53509b[_0x0a5d('0x2e')][_0x0a5d('0x39')]);_0x515983[_0x0a5d('0x3a')]=qs[_0x0a5d('0x30')](_[_0x0a5d('0x53')](_0x53509b[_0x0a5d('0x2e')],_0x56a4fa[_0x0a5d('0x30')]));if(_0x53509b['query']['filter']){_0x515983[_0x0a5d('0x3a')]=_['merge'](_0x515983[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0x515983[_0x0a5d('0x32')],function(_0x24f244){var _0x3ac37d={};_0x3ac37d[_0x24f244]={'$like':'%'+_0x53509b['query'][_0x0a5d('0x3d')]+'%'};return _0x3ac37d;})});}_0x515983=_[_0x0a5d('0x3e')]({},_0x515983,_0x53509b[_0x0a5d('0x3f')]);return _0x3268a8[_0x0a5d('0x109')](_0x515983);}})[_0x0a5d('0x12')](function(_0x4b2572){if(_0x4b2572){_0xf83cd6=_0x4b2572['length'];if(!_0x53509b['query']['hasOwnProperty']('nolimit')){_0x515983[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x53509b[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x515983['offset']=qs[_0x0a5d('0x1e')](_0x53509b[_0x0a5d('0x2e')][_0x0a5d('0x1e')]);}return _0x3268a8[_0x0a5d('0x109')](_0x515983);}})['then'](function(_0x3f8d3a){if(_0x3f8d3a){return _0x3f8d3a?{'count':_0xf83cd6,'rows':_0x3f8d3a}:null;}})[_0x0a5d('0x12')](respondWithResult(_0x90c403,null))[_0x0a5d('0x46')](handleError(_0x90c403,null));};exports[_0x0a5d('0x10a')]=function(_0x26336c,_0x2c570b){return db['chatProactiveAction'][_0x0a5d('0x45')]({'where':{'id':_0x26336c[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x2c570b,null))[_0x0a5d('0x12')](function(_0x34b146){if(_0x34b146){return _0x34b146['addProactiveActions'](_0x26336c[_0x0a5d('0x4d')][_0x0a5d('0x54')],_[_0x0a5d('0x10b')](_0x26336c['body'],[_0x0a5d('0x54'),'id'])||{});}})[_0x0a5d('0x12')](respondWithResult(_0x2c570b,null))[_0x0a5d('0x46')](handleError(_0x2c570b,null));};exports[_0x0a5d('0x10c')]=function(_0x3a646b,_0x5296fb){var _0x281154={};var _0x31e2ca={};var _0x1ba9ed;var _0x1b35fc;return db[_0x0a5d('0x2a')]['findOne']({'where':{'id':_0x3a646b[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x5296fb,null))[_0x0a5d('0x12')](function(_0x336f94){if(_0x336f94){_0x1ba9ed=_0x336f94;_0x31e2ca['model']=_[_0x0a5d('0x2f')](db[_0x0a5d('0x10d')][_0x0a5d('0x44')]);_0x31e2ca[_0x0a5d('0x2e')]=_['keys'](_0x3a646b[_0x0a5d('0x2e')]);_0x31e2ca[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0x31e2ca[_0x0a5d('0x35')],_0x31e2ca['query']);_0x281154[_0x0a5d('0x32')]=_['intersection'](_0x31e2ca[_0x0a5d('0x35')],qs[_0x0a5d('0x33')](_0x3a646b['query']['fields']));_0x281154[_0x0a5d('0x32')]=_0x281154[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x281154['attributes']:_0x31e2ca[_0x0a5d('0x35')];_0x281154['order']=qs[_0x0a5d('0x39')](_0x3a646b[_0x0a5d('0x2e')][_0x0a5d('0x39')]);_0x281154['where']=qs[_0x0a5d('0x30')](_[_0x0a5d('0x53')](_0x3a646b['query'],_0x31e2ca['filters']));if(_0x3a646b[_0x0a5d('0x2e')][_0x0a5d('0x3d')]){_0x281154[_0x0a5d('0x3a')]=_[_0x0a5d('0x3e')](_0x281154[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0x281154['attributes'],function(_0x468e8f){var _0xb00283={};_0xb00283[_0x468e8f]={'$like':'%'+_0x3a646b[_0x0a5d('0x2e')]['filter']+'%'};return _0xb00283;})});}_0x281154=_[_0x0a5d('0x3e')]({},_0x281154,_0x3a646b[_0x0a5d('0x3f')]);return _0x1ba9ed[_0x0a5d('0x10c')](_0x281154);}})[_0x0a5d('0x12')](function(_0x560e2c){if(_0x560e2c){_0x1b35fc=_0x560e2c[_0x0a5d('0x34')];if(!_0x3a646b[_0x0a5d('0x2e')][_0x0a5d('0x36')](_0x0a5d('0x37'))){_0x281154[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x3a646b[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x281154[_0x0a5d('0x1e')]=qs['offset'](_0x3a646b[_0x0a5d('0x2e')][_0x0a5d('0x1e')]);}return _0x1ba9ed[_0x0a5d('0x10c')](_0x281154);}})[_0x0a5d('0x12')](function(_0x26bd0d){if(_0x26bd0d){return _0x26bd0d?{'count':_0x1b35fc,'rows':_0x26bd0d}:null;}})['then'](respondWithResult(_0x5296fb,null))['catch'](handleError(_0x5296fb,null));};exports[_0x0a5d('0x10e')]=function(_0x25ab99,_0x2213d1){var _0x8ce0b4=_0x25ab99[_0x0a5d('0x2e')][_0x0a5d('0x10f')]===_0x0a5d('0x110')?'offlineForm':_0x0a5d('0x111');return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'attributes':['id',_0x8ce0b4],'where':{'id':_0x25ab99[_0x0a5d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2213d1,null))['then'](function(_0x1ac85c){if(_0x1ac85c){var _0x482cb4=_0x1ac85c[_0x8ce0b4];var _0x337b8e=_0x482cb4&&_0x482cb4['items']?_0x482cb4[_0x0a5d('0x112')]:[];_0x2213d1['send']({'fromKey':_[_0x0a5d('0x7b')](_0x482cb4[_0x0a5d('0x113')])?undefined:_0x482cb4['fromKey'],'count':_0x337b8e[_0x0a5d('0x34')],'rows':_0x337b8e});}})['catch'](handleError(_0x2213d1,null));};exports[_0x0a5d('0x114')]=function(_0x4e439b,_0x1aefd5){var _0x2f7960={'raw':![],'where':{}};var _0x2be823={};var _0x115c36={'count':0x0,'rows':[]};return db[_0x0a5d('0x2a')][_0x0a5d('0xc7')]({'where':{'id':_0x4e439b['params']['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x1aefd5,null))['then'](function(_0xf7a1fe){if(_0xf7a1fe){_0x2be823[_0x0a5d('0x35')]=_[_0x0a5d('0x2f')](db['ChatOfflineMessage']['rawAttributes']);_0x2be823['query']=_['keys'](_0x4e439b[_0x0a5d('0x2e')]);_0x2be823[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0x2be823[_0x0a5d('0x35')],_0x2be823[_0x0a5d('0x2e')]);_0x2f7960[_0x0a5d('0x32')]=_['intersection'](_0x2be823[_0x0a5d('0x35')],qs[_0x0a5d('0x33')](_0x4e439b['query']['fields']));_0x2f7960[_0x0a5d('0x32')]=_0x2f7960[_0x0a5d('0x32')][_0x0a5d('0x34')]?_0x2f7960[_0x0a5d('0x32')]:_0x2be823[_0x0a5d('0x35')];if(!_0x4e439b[_0x0a5d('0x2e')][_0x0a5d('0x36')](_0x0a5d('0x37'))){_0x2f7960['limit']=qs[_0x0a5d('0x1f')](_0x4e439b[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x2f7960['offset']=qs[_0x0a5d('0x1e')](_0x4e439b[_0x0a5d('0x2e')][_0x0a5d('0x1e')]);}_0x2f7960[_0x0a5d('0x38')]=qs[_0x0a5d('0x39')](_0x4e439b['query'][_0x0a5d('0x39')]);_0x2f7960[_0x0a5d('0x3a')]=qs['filters'](_['pick'](_0x4e439b[_0x0a5d('0x2e')],_0x2be823[_0x0a5d('0x30')]));_0x2f7960[_0x0a5d('0x3a')][_0x0a5d('0x51')]=_0xf7a1fe['id'];if(_0x4e439b[_0x0a5d('0x2e')][_0x0a5d('0x3d')]){_0x2f7960[_0x0a5d('0x3a')]=_[_0x0a5d('0x3e')](_0x2f7960[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0x2f7960[_0x0a5d('0x32')],function(_0x1d2ee0){var _0x28ef0e={};_0x28ef0e[_0x1d2ee0]={'$like':'%'+_0x4e439b['query'][_0x0a5d('0x3d')]+'%'};return _0x28ef0e;})});}_0x2f7960=_['merge']({},_0x2f7960,_0x4e439b['options']);return db[_0x0a5d('0xbe')]['count']({'where':_0x2f7960[_0x0a5d('0x3a')]})['then'](function(_0x40c64d){_0x115c36[_0x0a5d('0x20')]=_0x40c64d;if(_0x4e439b['query'][_0x0a5d('0x40')]){_0x2f7960['include']=[{'all':!![]}];}else{_0x2f7960['include']=[{'model':db[_0x0a5d('0x75')],'as':_0x0a5d('0xdc'),'required':![]},{'model':db[_0x0a5d('0x115')],'as':_0x0a5d('0x116'),'required':![]}];}return db[_0x0a5d('0xbe')]['findAll'](_0x2f7960);})['then'](function(_0x49ce34){_0x115c36[_0x0a5d('0x43')]=_0x49ce34;return _0x115c36;});}})[_0x0a5d('0x12')](respondWithFilteredResult(_0x1aefd5,_0x2f7960))['catch'](handleError(_0x1aefd5,null));};exports['addAgents']=function(_0x2bb58b,_0x1ce0cb){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0x2bb58b[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x1ce0cb,null))['then'](function(_0x598a92){if(_0x598a92){return _0x598a92['addAgents'](_0x2bb58b['body']['ids'],_['omit'](_0x2bb58b[_0x0a5d('0x4d')],[_0x0a5d('0x54'),'id'])||{})['spread'](function(_0x5099e3){for(var _0x4ee28f=0x0;_0x4ee28f<_0x2bb58b['body'][_0x0a5d('0x54')][_0x0a5d('0x34')];_0x4ee28f+=0x1){socket[_0x0a5d('0x117')](_0x0a5d('0x118'),{'UserId':Number(_0x2bb58b[_0x0a5d('0x4d')][_0x0a5d('0x54')][_0x4ee28f]),'ChatWebsiteId':Number(_0x2bb58b['params']['id'])});}return _0x5099e3;});}})['then'](respondWithResult(_0x1ce0cb,null))['catch'](handleError(_0x1ce0cb,null));};exports[_0x0a5d('0x119')]=function(_0xc7c28,_0x2f6dd5){return db[_0x0a5d('0x2a')][_0x0a5d('0x45')]({'where':{'id':_0xc7c28[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x2f6dd5,null))['then'](function(_0xa87e14){if(_0xa87e14){return _0xa87e14[_0x0a5d('0x119')](_0xc7c28[_0x0a5d('0x2e')][_0x0a5d('0x54')])['then'](function(){if(_[_0x0a5d('0x11a')](_0xc7c28[_0x0a5d('0x2e')][_0x0a5d('0x54')])){for(var _0x8e183f=0x0;_0x8e183f<_0xc7c28[_0x0a5d('0x2e')][_0x0a5d('0x54')]['length'];_0x8e183f+=0x1){socket[_0x0a5d('0x117')]('userChatWebsite:remove',{'UserId':Number(_0xc7c28['query'][_0x0a5d('0x54')][_0x8e183f]),'ChatWebsiteId':Number(_0xc7c28['params']['id'])});}}else{socket['emit'](_0x0a5d('0x11b'),{'UserId':Number(_0xc7c28[_0x0a5d('0x2e')]['ids']),'ChatWebsiteId':Number(_0xc7c28[_0x0a5d('0x4e')]['id'])});}});}})[_0x0a5d('0x12')](respondWithStatusCode(_0x2f6dd5,null))[_0x0a5d('0x46')](handleError(_0x2f6dd5,null));};exports[_0x0a5d('0x11c')]=function(_0x3f5a64,_0x33cce6){var _0x39b3fe={};var _0x274afd={};var _0x2e8ec1;var _0x12d4d1;return db[_0x0a5d('0x2a')][_0x0a5d('0xc7')]({'where':{'id':_0x3f5a64[_0x0a5d('0x4e')]['id']}})[_0x0a5d('0x12')](handleEntityNotFound(_0x33cce6,null))['then'](function(_0x58a665){if(_0x58a665){_0x2e8ec1=_0x58a665;_0x274afd['model']=_['keys'](db['User'][_0x0a5d('0x44')]);_0x274afd[_0x0a5d('0x2e')]=_[_0x0a5d('0x2f')](_0x3f5a64[_0x0a5d('0x2e')]);_0x274afd[_0x0a5d('0x30')]=_[_0x0a5d('0x31')](_0x274afd['model'],_0x274afd['query']);_0x39b3fe[_0x0a5d('0x32')]=_[_0x0a5d('0x31')](_0x274afd[_0x0a5d('0x35')],qs['fields'](_0x3f5a64[_0x0a5d('0x2e')][_0x0a5d('0x33')]));_0x39b3fe[_0x0a5d('0x32')]=_0x39b3fe['attributes']['length']?_0x39b3fe[_0x0a5d('0x32')]:_0x274afd[_0x0a5d('0x35')];_0x39b3fe[_0x0a5d('0x38')]=qs[_0x0a5d('0x39')](_0x3f5a64[_0x0a5d('0x2e')][_0x0a5d('0x39')]);_0x39b3fe[_0x0a5d('0x3a')]=qs['filters'](_[_0x0a5d('0x53')](_0x3f5a64[_0x0a5d('0x2e')],_0x274afd[_0x0a5d('0x30')]));if(_0x3f5a64[_0x0a5d('0x2e')][_0x0a5d('0x3d')]){_0x39b3fe[_0x0a5d('0x3a')]=_[_0x0a5d('0x3e')](_0x39b3fe[_0x0a5d('0x3a')],{'$or':_[_0x0a5d('0x3b')](_0x39b3fe['attributes'],function(_0x3f2ca0){var _0xe1b07d={};_0xe1b07d[_0x3f2ca0]={'$like':'%'+_0x3f5a64['query']['filter']+'%'};return _0xe1b07d;})});}_0x39b3fe=_['merge']({},_0x39b3fe,_0x3f5a64[_0x0a5d('0x3f')]);return _0x2e8ec1[_0x0a5d('0x11c')](_0x39b3fe);}})[_0x0a5d('0x12')](function(_0x1df04e){if(_0x1df04e){_0x12d4d1=_0x1df04e[_0x0a5d('0x34')];if(!_0x3f5a64[_0x0a5d('0x2e')]['hasOwnProperty'](_0x0a5d('0x37'))){_0x39b3fe[_0x0a5d('0x1f')]=qs[_0x0a5d('0x1f')](_0x3f5a64[_0x0a5d('0x2e')][_0x0a5d('0x1f')]);_0x39b3fe[_0x0a5d('0x1e')]=qs['offset'](_0x3f5a64['query'][_0x0a5d('0x1e')]);}return _0x2e8ec1[_0x0a5d('0x11c')](_0x39b3fe);}})[_0x0a5d('0x12')](function(_0xd1533c){if(_0xd1533c){return _0xd1533c?{'count':_0x12d4d1,'rows':_0xd1533c}:null;}})[_0x0a5d('0x12')](respondWithResult(_0x33cce6,null))[_0x0a5d('0x46')](handleError(_0x33cce6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 2e560c6..1bbd8ad 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 _0xe35c=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit'];(function(_0x3667eb,_0x1bd874){var _0x44cf07=function(_0x260898){while(--_0x260898){_0x3667eb['push'](_0x3667eb['shift']());}};_0x44cf07(++_0x1bd874);}(_0xe35c,0x146));var _0xce35=function(_0x284bde,_0x3a2ab2){_0x284bde=_0x284bde-0x0;var _0x455f4b=_0xe35c[_0x284bde];return _0x455f4b;};'use strict';var EventEmitter=require(_0xce35('0x0'));var ChatWebsite=require(_0xce35('0x1'))['db'][_0xce35('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xce35('0x3')](0x0);var events={'afterCreate':_0xce35('0x4'),'afterUpdate':_0xce35('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b2135){return function(_0x17648a,_0x4a005b,_0x3e370f){ChatWebsiteEvents[_0xce35('0x6')](_0x5b2135+':'+_0x17648a['id'],_0x17648a);ChatWebsiteEvents[_0xce35('0x6')](_0x5b2135,_0x17648a);_0x3e370f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xce35('0x7')](e,emitEvent(event));}}module[_0xce35('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6f72=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatWebsite'];(function(_0x4ce414,_0x5ac84d){var _0x3f0dd8=function(_0x5fe045){while(--_0x5fe045){_0x4ce414['push'](_0x4ce414['shift']());}};_0x3f0dd8(++_0x5ac84d);}(_0x6f72,0xae));var _0x26f7=function(_0x3be56b,_0x135bc6){_0x3be56b=_0x3be56b-0x0;var _0x30af13=_0x6f72[_0x3be56b];return _0x30af13;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x26f7('0x0'))['db'][_0x26f7('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x26f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x26f7('0x3'),'afterDestroy':_0x26f7('0x4')};function emitEvent(_0x49904c){return function(_0x4e19f5,_0x10b953,_0x48d005){ChatWebsiteEvents[_0x26f7('0x5')](_0x49904c+':'+_0x4e19f5['id'],_0x4e19f5);ChatWebsiteEvents['emit'](_0x49904c,_0x4e19f5);_0x48d005(null);};}for(var e in events){if(events[_0x26f7('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x26f7('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 27fa8e0..7fc37b3 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 _0x58f4=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x41ffa9,_0x3297fd){var _0x2b54f1=function(_0x54a92d){while(--_0x54a92d){_0x41ffa9['push'](_0x41ffa9['shift']());}};_0x2b54f1(++_0x3297fd);}(_0x58f4,0xc6));var _0x458f=function(_0x455d24,_0x5d6798){_0x455d24=_0x455d24-0x0;var _0x329c60=_0x58f4[_0x455d24];return _0x329c60;};'use strict';var _=require('lodash');var util=require(_0x458f('0x0'));var logger=require(_0x458f('0x1'))(_0x458f('0x2'));var moment=require('moment');var BPromise=require(_0x458f('0x3'));var rp=require(_0x458f('0x4'));var fs=require('fs');var path=require(_0x458f('0x5'));var rimraf=require(_0x458f('0x6'));var config=require('../../config/environment');var attributes=require(_0x458f('0x7'));module[_0x458f('0x8')]=function(_0x29a575,_0x4dfc4d){return _0x29a575[_0x458f('0x9')](_0x458f('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4583=['define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x2706f2,_0x9a058){var _0x595bab=function(_0x54371f){while(--_0x54371f){_0x2706f2['push'](_0x2706f2['shift']());}};_0x595bab(++_0x9a058);}(_0x4583,0x1d1));var _0x3458=function(_0x228267,_0x57824a){_0x228267=_0x228267-0x0;var _0x1f0c90=_0x4583[_0x228267];return _0x1f0c90;};'use strict';var _=require(_0x3458('0x0'));var util=require(_0x3458('0x1'));var logger=require(_0x3458('0x2'))(_0x3458('0x3'));var moment=require(_0x3458('0x4'));var BPromise=require('bluebird');var rp=require(_0x3458('0x5'));var fs=require('fs');var path=require(_0x3458('0x6'));var rimraf=require(_0x3458('0x7'));var config=require(_0x3458('0x8'));var attributes=require(_0x3458('0x9'));module[_0x3458('0xa')]=function(_0x4a230f,_0x5ef4c0){return _0x4a230f[_0x3458('0xb')](_0x3458('0xc'),attributes,{'tableName':_0x3458('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 3904ff0..7985232 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 _0xf310=['code','message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','ChatWebsite,\x20%s,\x20%s','debug','stringify','error'];(function(_0x4ab6a1,_0x4d64d5){var _0x2a24cc=function(_0x2625a0){while(--_0x2625a0){_0x4ab6a1['push'](_0x4ab6a1['shift']());}};_0x2a24cc(++_0x4d64d5);}(_0xf310,0x1ae));var _0x0f31=function(_0x2ef041,_0x34e819){_0x2ef041=_0x2ef041-0x0;var _0x4babf1=_0xf310[_0x2ef041];return _0x4babf1;};'use strict';var _=require('lodash');var util=require(_0x0f31('0x0'));var moment=require(_0x0f31('0x1'));var BPromise=require(_0x0f31('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f31('0x3'));var db=require(_0x0f31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f31('0x5'))('rpc');var config=require(_0x0f31('0x6'));var jayson=require(_0x0f31('0x7'));var client=jayson['client'][_0x0f31('0x8')]({'port':0x232a});config['redis']=_[_0x0f31('0x9')](config[_0x0f31('0xa')],{'host':_0x0f31('0xb'),'port':0x18eb});var socket=require(_0x0f31('0xc'))(new Redis(config[_0x0f31('0xa')]));require(_0x0f31('0xd'))[_0x0f31('0xe')](socket);function respondWithRpcPromise(_0x5b85bd,_0x21158f,_0x46f536){return new BPromise(function(_0x5a1801,_0x1bf217){return client[_0x0f31('0xf')](_0x5b85bd,_0x46f536)['then'](function(_0x3c8cd2){logger['info'](_0x0f31('0x10'),_0x21158f,'request\x20sent');logger[_0x0f31('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x21158f,'request\x20sent',JSON[_0x0f31('0x12')](_0x3c8cd2));if(_0x3c8cd2[_0x0f31('0x13')]){if(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x14')]===0x1f4){logger['error'](_0x0f31('0x10'),_0x21158f,_0x3c8cd2[_0x0f31('0x13')]['message']);return _0x1bf217(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);}logger[_0x0f31('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x21158f,_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);return _0x5a1801(_0x3c8cd2[_0x0f31('0x13')][_0x0f31('0x15')]);}else{logger['info'](_0x0f31('0x10'),_0x21158f,_0x0f31('0x16'));_0x5a1801(_0x3c8cd2[_0x0f31('0x17')][_0x0f31('0x15')]);}})[_0x0f31('0x18')](function(_0x1467ae){logger['error'](_0x0f31('0x10'),_0x21158f,_0x1467ae);_0x1bf217(_0x1467ae);});});} \ No newline at end of file +var _0xaa13=['../../config/environment','client','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5e3f6c,_0x40a8d5){var _0x34b41b=function(_0x561d31){while(--_0x561d31){_0x5e3f6c['push'](_0x5e3f6c['shift']());}};_0x34b41b(++_0x40a8d5);}(_0xaa13,0x198));var _0x3aa1=function(_0xa2a662,_0x4ee2a8){_0xa2a662=_0xa2a662-0x0;var _0x2b6030=_0xaa13[_0xa2a662];return _0x2b6030;};'use strict';var _=require(_0x3aa1('0x0'));var util=require(_0x3aa1('0x1'));var moment=require('moment');var BPromise=require(_0x3aa1('0x2'));var rs=require(_0x3aa1('0x3'));var fs=require('fs');var Redis=require(_0x3aa1('0x4'));var db=require(_0x3aa1('0x5'))['db'];var utils=require(_0x3aa1('0x6'));var logger=require('../../config/logger')(_0x3aa1('0x7'));var config=require(_0x3aa1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3aa1('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3aa1('0xa')](config['redis'],{'host':_0x3aa1('0xb'),'port':0x18eb});var socket=require(_0x3aa1('0xc'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x3aa1('0xd')](socket);function respondWithRpcPromise(_0x8fd708,_0x1c44df,_0x487cbb){return new BPromise(function(_0x3accf8,_0x4ef87e){return client[_0x3aa1('0xe')](_0x8fd708,_0x487cbb)[_0x3aa1('0xf')](function(_0x5d24a8){logger[_0x3aa1('0x10')](_0x3aa1('0x11'),_0x1c44df,_0x3aa1('0x12'));logger[_0x3aa1('0x13')](_0x3aa1('0x14'),_0x1c44df,_0x3aa1('0x12'),JSON[_0x3aa1('0x15')](_0x5d24a8));if(_0x5d24a8[_0x3aa1('0x16')]){if(_0x5d24a8['error'][_0x3aa1('0x17')]===0x1f4){logger[_0x3aa1('0x16')](_0x3aa1('0x11'),_0x1c44df,_0x5d24a8[_0x3aa1('0x16')]['message']);return _0x4ef87e(_0x5d24a8[_0x3aa1('0x16')][_0x3aa1('0x18')]);}logger[_0x3aa1('0x16')](_0x3aa1('0x11'),_0x1c44df,_0x5d24a8[_0x3aa1('0x16')][_0x3aa1('0x18')]);return _0x3accf8(_0x5d24a8['error'][_0x3aa1('0x18')]);}else{logger['info'](_0x3aa1('0x11'),_0x1c44df,_0x3aa1('0x12'));_0x3accf8(_0x5d24a8['result'][_0x3aa1('0x18')]);}})[_0x3aa1('0x19')](function(_0x1c6163){logger['error'](_0x3aa1('0x11'),_0x1c44df,_0x1c6163);_0x4ef87e(_0x1c6163);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 88a6e5c..f5c9b47 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 _0xf154=['emit','removeListener','register','length','save','remove','update'];(function(_0x90c434,_0x42072a){var _0x10e99a=function(_0x5f39ca){while(--_0x5f39ca){_0x90c434['push'](_0x90c434['shift']());}};_0x10e99a(++_0x42072a);}(_0xf154,0x74));var _0x4f15=function(_0x4b71b4,_0x26595a){_0x4b71b4=_0x4b71b4-0x0;var _0xb99700=_0xf154[_0x4b71b4];return _0xb99700;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x4f15('0x0'),_0x4f15('0x1'),_0x4f15('0x2')];function createListener(_0x1bbf19,_0x5d74ba){return function(_0xdf5aca){_0x5d74ba[_0x4f15('0x3')](_0x1bbf19,_0xdf5aca);};}function removeListener(_0x1092c7,_0x5d2e73){return function(){ChatWebsiteEvents[_0x4f15('0x4')](_0x1092c7,_0x5d2e73);};}exports[_0x4f15('0x5')]=function(_0x34d983){for(var _0x15bc9e=0x0,_0x500f86=events[_0x4f15('0x6')];_0x15bc9e<_0x500f86;_0x15bc9e++){var _0x222a1e=events[_0x15bc9e];var _0x116110=createListener('chatWebsite:'+_0x222a1e,_0x34d983);ChatWebsiteEvents['on'](_0x222a1e,_0x116110);}}; \ No newline at end of file +var _0xed18=['save','remove','update','emit','length','chatWebsite:','./chatWebsite.events'];(function(_0x5a2036,_0x25a0fd){var _0xbf1458=function(_0x4b6a2d){while(--_0x4b6a2d){_0x5a2036['push'](_0x5a2036['shift']());}};_0xbf1458(++_0x25a0fd);}(_0xed18,0xa7));var _0x8ed1=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xed18[_0x1ccbcc];return _0x1e873f;};'use strict';var ChatWebsiteEvents=require(_0x8ed1('0x0'));var events=[_0x8ed1('0x1'),_0x8ed1('0x2'),_0x8ed1('0x3')];function createListener(_0xa49efb,_0xcd7986){return function(_0x4fb98f){_0xcd7986[_0x8ed1('0x4')](_0xa49efb,_0x4fb98f);};}function removeListener(_0x4deba7,_0x3bbbe6){return function(){ChatWebsiteEvents['removeListener'](_0x4deba7,_0x3bbbe6);};}exports['register']=function(_0x40a6cf){for(var _0x44f848=0x0,_0x5cd24f=events[_0x8ed1('0x5')];_0x44f848<_0x5cd24f;_0x44f848++){var _0x226ff4=events[_0x44f848];var _0x3ad203=createListener(_0x8ed1('0x6')+_0x226ff4,_0x40a6cf);ChatWebsiteEvents['on'](_0x226ff4,_0x3ad203);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b0ad423..fd46eea 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 _0xfc7a=['server/files','attachments','replace','extname','/:id/offline','any','offline','/:id/interactions','/:id/applications','/:id/proactive_actions','addProactiveActions','put','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','index','get','/describe','isAuthenticated','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/fields','getFields','/:id/users','getAgents','post','create','addDisposition','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','join','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify'];(function(_0x45b3c1,_0x2d161b){var _0x6d0616=function(_0x4980ee){while(--_0x4980ee){_0x45b3c1['push'](_0x45b3c1['shift']());}};_0x6d0616(++_0x2d161b);}(_0xfc7a,0x12d));var _0xafc7=function(_0xce3a0b,_0x5b271b){_0xce3a0b=_0xce3a0b-0x0;var _0x1ca1b9=_0xfc7a[_0xce3a0b];return _0x1ca1b9;};'use strict';var multer=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var path=require(_0xafc7('0x2'));var timeout=require(_0xafc7('0x3'));var express=require(_0xafc7('0x4'));var router=express[_0xafc7('0x5')]();var fs_extra=require(_0xafc7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xafc7('0x7'));var config=require('../../config/environment');var controller=require(_0xafc7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xafc7('0x9')]);router[_0xafc7('0xa')](_0xafc7('0xb'),auth[_0xafc7('0xc')](),controller['describe']);router[_0xafc7('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xafc7('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xafc7('0xd')]);router['get'](_0xafc7('0xe'),auth[_0xafc7('0xc')](),controller['getAnswers']);router[_0xafc7('0xa')]('/:id/logo',controller[_0xafc7('0xf')]);router[_0xafc7('0xa')](_0xafc7('0x10'),controller[_0xafc7('0x11')]);router[_0xafc7('0xa')](_0xafc7('0x12'),controller[_0xafc7('0x13')]);router[_0xafc7('0xa')](_0xafc7('0x14'),controller[_0xafc7('0x15')]);router['get']('/:id/interactions',auth[_0xafc7('0xc')](),controller[_0xafc7('0x16')]);router[_0xafc7('0xa')](_0xafc7('0x17'),controller['getSnippet']);router[_0xafc7('0xa')]('/:id/applications',auth[_0xafc7('0xc')](),controller[_0xafc7('0x18')]);router[_0xafc7('0xa')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xafc7('0xa')](_0xafc7('0x19'),controller[_0xafc7('0x1a')]);router[_0xafc7('0xa')]('/:id/offline_messages',auth[_0xafc7('0xc')](),controller['getOfflineMessages']);router['get'](_0xafc7('0x1b'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x1c')]);router[_0xafc7('0x1d')]('/',auth[_0xafc7('0xc')](),controller[_0xafc7('0x1e')]);router[_0xafc7('0x1d')]('/:id/dispositions',auth[_0xafc7('0xc')](),controller[_0xafc7('0x1f')]);router[_0xafc7('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x5484ea,_0x5aab5c,_0x3d0522){_0x3d0522(null,path['join'](config[_0xafc7('0x21')],_0xafc7('0x22')));},'filename':function(_0x331908,_0xa562de,_0xca6a85){_0xca6a85(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0xa562de[_0xafc7('0x26')]));}})});router[_0xafc7('0x1d')](_0xafc7('0x27'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller[_0xafc7('0x2a')]);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x291b3f,_0x566d33,_0xcb5f5a){_0xcb5f5a(null,path[_0xafc7('0x2b')](config['root'],_0xafc7('0x2c')));},'filename':function(_0x45fecc,_0x2dad3e,_0x1e0d28){_0x1e0d28(null,util[_0xafc7('0x23')]('%s-%s',Date['now'](),_0x2dad3e[_0xafc7('0x26')]));}})});router['post'](_0xafc7('0x10'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x2e96ba,_0x5a36a5,_0x2ce66b){_0x2ce66b(null,path[_0xafc7('0x2b')](config[_0xafc7('0x21')],_0xafc7('0x2c')));},'filename':function(_0x5b4ecd,_0x4a7021,_0x682883){_0x682883(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0x4a7021[_0xafc7('0x26')]));}})});router['post'](_0xafc7('0x12'),upload[_0xafc7('0x28')](_0xafc7('0x29')),controller[_0xafc7('0x2d')]);var upload=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0x8d40bf,_0x2994bd,_0x51b40e){_0x51b40e(null,path[_0xafc7('0x2b')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x2a2cea,_0x2b8ee1,_0x2c76fe){_0x2c76fe(null,util[_0xafc7('0x23')](_0xafc7('0x24'),Date[_0xafc7('0x25')](),_0x2b8ee1[_0xafc7('0x26')]));}})});router[_0xafc7('0x1d')](_0xafc7('0x14'),upload['single'](_0xafc7('0x29')),controller[_0xafc7('0x2e')]);router[_0xafc7('0x1d')](_0xafc7('0x2f'),controller[_0xafc7('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0xafc7('0x20')]({'destination':function(_0xc96477,_0x409a7b,_0x3450ba){const _0x2b2289=path['join'](config[_0xafc7('0x21')],_0xafc7('0x31'),_0xafc7('0x32'),'offline-chat');fs_extra['ensureDir'](_0x2b2289,function(){_0x3450ba(null,_0x2b2289);});},'filename':function(_0x5b35eb,_0x2c2b86,_0xcde905){const _0x1c4179=_0x2c2b86[_0xafc7('0x26')][_0xafc7('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x85ef7=path[_0xafc7('0x34')](_0x1c4179);const _0x21a891=Date[_0xafc7('0x25')]()+'-'+_0x1c4179['replace'](_0x85ef7,'')+_0x85ef7;_0xcde905(null,_0x21a891);}})});router[_0xafc7('0x1d')](_0xafc7('0x35'),offlineUploadMulter[_0xafc7('0x36')](),controller[_0xafc7('0x37')]);router[_0xafc7('0x1d')](_0xafc7('0x38'),auth[_0xafc7('0xc')](),controller['addInteraction']);router[_0xafc7('0x1d')](_0xafc7('0x39'),auth[_0xafc7('0xc')](),controller['addApplications']);router[_0xafc7('0x1d')](_0xafc7('0x3a'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x3b')]);router[_0xafc7('0x1d')](_0xafc7('0x1b'),auth[_0xafc7('0xc')](),controller['addAgents']);router[_0xafc7('0x3c')](_0xafc7('0x3d'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x3e')]);router[_0xafc7('0x3f')]('/:id',auth['isAuthenticated'](),controller[_0xafc7('0x40')]);router['delete'](_0xafc7('0x41'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x42')]);router[_0xafc7('0x3f')](_0xafc7('0xe'),auth[_0xafc7('0xc')](),controller[_0xafc7('0x43')]);router[_0xafc7('0x3f')](_0xafc7('0x1b'),auth['isAuthenticated'](),controller[_0xafc7('0x44')]);module[_0xafc7('0x45')]=router; \ No newline at end of file +var _0x9eb1=['addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','extname','replace','any','offline','addInteraction','/:id/applications','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/canned_answers','addAnswer','join','root','server/files/images/logos/','format','/:id/logo','single','file','addLogo','server/files/images/avatars/','%s-%s','now','originalname','addAvatar','diskStorage'];(function(_0x4b71aa,_0xfbf067){var _0x521f22=function(_0x43a224){while(--_0x43a224){_0x4b71aa['push'](_0x4b71aa['shift']());}};_0x521f22(++_0xfbf067);}(_0x9eb1,0x139));var _0x19eb=function(_0x56c05a,_0x12b70d){_0x56c05a=_0x56c05a-0x0;var _0x111d41=_0x9eb1[_0x56c05a];return _0x111d41;};'use strict';var multer=require('multer');var util=require(_0x19eb('0x0'));var path=require(_0x19eb('0x1'));var timeout=require(_0x19eb('0x2'));var express=require('express');var router=express[_0x19eb('0x3')]();var fs_extra=require(_0x19eb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x19eb('0x5'));var config=require(_0x19eb('0x6'));var controller=require(_0x19eb('0x7'));router[_0x19eb('0x8')]('/',auth[_0x19eb('0x9')](),controller[_0x19eb('0xa')]);router[_0x19eb('0x8')]('/describe',auth[_0x19eb('0x9')](),controller['describe']);router[_0x19eb('0x8')](_0x19eb('0xb'),auth[_0x19eb('0x9')](),controller[_0x19eb('0xc')]);router[_0x19eb('0x8')](_0x19eb('0xd'),auth[_0x19eb('0x9')](),controller[_0x19eb('0xe')]);router[_0x19eb('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x19eb('0xf')]);router[_0x19eb('0x8')]('/:id/logo',controller[_0x19eb('0x10')]);router[_0x19eb('0x8')](_0x19eb('0x11'),controller[_0x19eb('0x12')]);router[_0x19eb('0x8')](_0x19eb('0x13'),controller[_0x19eb('0x14')]);router[_0x19eb('0x8')](_0x19eb('0x15'),controller[_0x19eb('0x16')]);router[_0x19eb('0x8')](_0x19eb('0x17'),auth['isAuthenticated'](),controller[_0x19eb('0x18')]);router[_0x19eb('0x8')](_0x19eb('0x19'),controller[_0x19eb('0x1a')]);router[_0x19eb('0x8')]('/:id/applications',auth[_0x19eb('0x9')](),controller[_0x19eb('0x1b')]);router['get'](_0x19eb('0x1c'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x1d')]);router[_0x19eb('0x8')](_0x19eb('0x1e'),controller['getFields']);router[_0x19eb('0x8')](_0x19eb('0x1f'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x20')]);router['get']('/:id/users',auth[_0x19eb('0x9')](),controller[_0x19eb('0x21')]);router[_0x19eb('0x22')]('/',auth[_0x19eb('0x9')](),controller[_0x19eb('0x23')]);router[_0x19eb('0x22')](_0x19eb('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x19eb('0x22')](_0x19eb('0x24'),auth['isAuthenticated'](),controller[_0x19eb('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x411908,_0x47f3ce,_0x30edcb){_0x30edcb(null,path[_0x19eb('0x26')](config[_0x19eb('0x27')],_0x19eb('0x28')));},'filename':function(_0xe33162,_0x4e058a,_0x4c818f){_0x4c818f(null,util[_0x19eb('0x29')]('%s-%s',Date['now'](),_0x4e058a['originalname']));}})});router[_0x19eb('0x22')](_0x19eb('0x2a'),upload[_0x19eb('0x2b')](_0x19eb('0x2c')),controller[_0x19eb('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b64bb,_0x15a2c9,_0x2dcf47){_0x2dcf47(null,path['join'](config[_0x19eb('0x27')],_0x19eb('0x2e')));},'filename':function(_0xadbd82,_0x351cd3,_0xf45d0e){_0xf45d0e(null,util['format'](_0x19eb('0x2f'),Date[_0x19eb('0x30')](),_0x351cd3[_0x19eb('0x31')]));}})});router['post'](_0x19eb('0x11'),upload[_0x19eb('0x2b')](_0x19eb('0x2c')),controller[_0x19eb('0x32')]);var upload=multer({'storage':multer[_0x19eb('0x33')]({'destination':function(_0x2d005d,_0x4fe9ee,_0x229178){_0x229178(null,path[_0x19eb('0x26')](config[_0x19eb('0x27')],_0x19eb('0x2e')));},'filename':function(_0x582b76,_0x283515,_0x5ad06a){_0x5ad06a(null,util[_0x19eb('0x29')](_0x19eb('0x2f'),Date[_0x19eb('0x30')](),_0x283515['originalname']));}})});router[_0x19eb('0x22')](_0x19eb('0x13'),upload[_0x19eb('0x2b')](_0x19eb('0x2c')),controller[_0x19eb('0x34')]);var upload=multer({'storage':multer[_0x19eb('0x33')]({'destination':function(_0x4b9aee,_0x1e6d2b,_0x22585e){_0x22585e(null,path[_0x19eb('0x26')](config[_0x19eb('0x27')],_0x19eb('0x2e')));},'filename':function(_0x11d21f,_0x1b28f8,_0x53c197){_0x53c197(null,util[_0x19eb('0x29')](_0x19eb('0x2f'),Date[_0x19eb('0x30')](),_0x1b28f8[_0x19eb('0x31')]));}})});router['post'](_0x19eb('0x15'),upload[_0x19eb('0x2b')](_0x19eb('0x2c')),controller['addSystemAvatar']);router['post'](_0x19eb('0x35'),controller[_0x19eb('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x19eb('0x33')]({'destination':function(_0x27156a,_0x2cf413,_0x52d885){const _0x1779de=path[_0x19eb('0x26')](config[_0x19eb('0x27')],_0x19eb('0x37'),'attachments',_0x19eb('0x38'));fs_extra[_0x19eb('0x39')](_0x1779de,function(){_0x52d885(null,_0x1779de);});},'filename':function(_0x20bd24,_0xb67df6,_0x3a343e){const _0x4e96be=_0xb67df6[_0x19eb('0x31')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4607d5=path[_0x19eb('0x3a')](_0x4e96be);const _0x28da15=Date[_0x19eb('0x30')]()+'-'+_0x4e96be[_0x19eb('0x3b')](_0x4607d5,'')+_0x4607d5;_0x3a343e(null,_0x28da15);}})});router[_0x19eb('0x22')]('/:id/offline',offlineUploadMulter[_0x19eb('0x3c')](),controller[_0x19eb('0x3d')]);router[_0x19eb('0x22')](_0x19eb('0x17'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x3e')]);router['post'](_0x19eb('0x3f'),auth[_0x19eb('0x9')](),controller['addApplications']);router['post'](_0x19eb('0x1c'),auth[_0x19eb('0x9')](),controller['addProactiveActions']);router['post'](_0x19eb('0x40'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x41')]);router[_0x19eb('0x42')](_0x19eb('0xb'),auth['isAuthenticated'](),controller[_0x19eb('0x43')]);router[_0x19eb('0x44')](_0x19eb('0xb'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x45')]);router[_0x19eb('0x44')](_0x19eb('0xd'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x46')]);router[_0x19eb('0x44')]('/:id/canned_answers',auth[_0x19eb('0x9')](),controller['removeAnswers']);router['delete'](_0x19eb('0x40'),auth[_0x19eb('0x9')](),controller[_0x19eb('0x47')]);module[_0x19eb('0x48')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index c3ea2c1..7b91527 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 _0x3003=['get','/client-logs','isAuthenticated','exports','beaver-logger/server','express','../config/environment','env','production','app'];(function(_0x38deb6,_0x587445){var _0x3cf12e=function(_0x4d178b){while(--_0x4d178b){_0x38deb6['push'](_0x38deb6['shift']());}};_0x3cf12e(++_0x587445);}(_0x3003,0x18a));var _0x3300=function(_0x2f6e0d,_0x19687d){_0x2f6e0d=_0x2f6e0d-0x0;var _0x4c0d36=_0x3003[_0x2f6e0d];return _0x4c0d36;};var beaverLogger=require(_0x3300('0x0'));var express=require(_0x3300('0x1'));var auth=require('../components/auth/service');var config=require(_0x3300('0x2'));var router=express['Router']();var isProduction=config[_0x3300('0x3')]===_0x3300('0x4')||![];function clientSideLogs(_0xb004e6,_0x424af5,_0x2a2e91){var _0x23f146=_0xb004e6[_0x3300('0x5')][_0x3300('0x6')]('client-side-logger');if(!_0x23f146){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0x3300('0x7'),'logger':_0x23f146,'enableCors':!isProduction})(_0xb004e6,_0x424af5,_0x2a2e91);}router['use'](auth[_0x3300('0x8')](),clientSideLogs);module[_0x3300('0x9')]=router; \ No newline at end of file +var _0x485f=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','../config/environment','Router','env','production','app','get'];(function(_0x28edf8,_0x3ab79f){var _0xb0bbba=function(_0x52eeae){while(--_0x52eeae){_0x28edf8['push'](_0x28edf8['shift']());}};_0xb0bbba(++_0x3ab79f);}(_0x485f,0x162));var _0xf485=function(_0x1d3dac,_0x24f28f){_0x1d3dac=_0x1d3dac-0x0;var _0x51a5b2=_0x485f[_0x1d3dac];return _0x51a5b2;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require('../components/auth/service');var config=require(_0xf485('0x0'));var router=express[_0xf485('0x1')]();var isProduction=config[_0xf485('0x2')]===_0xf485('0x3')||![];function clientSideLogs(_0x259d99,_0x2cb542,_0x3475c8){var _0x26a1ba=_0x259d99[_0xf485('0x4')][_0xf485('0x5')]('client-side-logger');if(!_0x26a1ba){throw new Error(_0xf485('0x6'));}return beaverLogger[_0xf485('0x7')]({'uri':_0xf485('0x8'),'logger':_0x26a1ba,'enableCors':!isProduction})(_0x259d99,_0x2cb542,_0x3475c8);}router[_0xf485('0x9')](auth[_0xf485('0xa')](),clientSideLogs);module[_0xf485('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 29fa9a1..b6c6b1a 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 _0xbd39=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','STRING','MicrosoftAzure\x20=>\x20client_id'];(function(_0x25b9c5,_0x31a38e){var _0x1a50d5=function(_0x33aaac){while(--_0x33aaac){_0x25b9c5['push'](_0x25b9c5['shift']());}};_0x1a50d5(++_0x31a38e);}(_0xbd39,0x102));var _0x9bd3=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xbd39[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require('sequelize');module[_0x9bd3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9bd3('0x1')](_0x9bd3('0x2'),_0x9bd3('0x3'),_0x9bd3('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x9bd3('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x7')},'data2':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x8')},'data3':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0x9')},'data4':{'type':Sequelize[_0x9bd3('0x6')],'comment':_0x9bd3('0xa')},'data5':{'type':Sequelize[_0x9bd3('0xb')],'comment':_0x9bd3('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9bd3('0xb')],'comment':_0x9bd3('0xd')}}; \ No newline at end of file +var _0x3f30=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google'];(function(_0x227814,_0x1a334c){var _0x384d06=function(_0x253178){while(--_0x253178){_0x227814['push'](_0x227814['shift']());}};_0x384d06(++_0x1a334c);}(_0x3f30,0xe9));var _0x03f3=function(_0x5375c7,_0x46f518){_0x5375c7=_0x5375c7-0x0;var _0x3c4917=_0x3f30[_0x5375c7];return _0x3c4917;};'use strict';var Sequelize=require(_0x03f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x03f3('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x03f3('0x2')](_0x03f3('0x3'),_0x03f3('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x03f3('0x2')](_0x03f3('0x5'),_0x03f3('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x03f3('0x7')},'data3':{'type':Sequelize[_0x03f3('0x1')],'comment':_0x03f3('0x8')},'data4':{'type':Sequelize[_0x03f3('0x1')],'comment':_0x03f3('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0x03f3('0xa')},'data6':{'type':Sequelize['TEXT'],'comment':_0x03f3('0xb')},'data7':{'type':Sequelize[_0x03f3('0xc')],'comment':_0x03f3('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8e157a2..fe0a161 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 _0x2a14=['options','CloudProvider','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','include','create','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','find','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','ascii','isValidIdToken','oauth2Claims','del','code','data5','access_token','refresh_token','data6','startRefreshInterval','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','padEnd','slice','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL'];(function(_0x443e88,_0x4b9d1e){var _0x50f7b1=function(_0x348e68){while(--_0x348e68){_0x443e88['push'](_0x443e88['shift']());}};_0x50f7b1(++_0x4b9d1e);}(_0x2a14,0x1ee));var _0x42a1=function(_0x297b47,_0x305c9d){_0x297b47=_0x297b47-0x0;var _0xc87900=_0x2a14[_0x297b47];return _0xc87900;};'use strict';var _=require(_0x42a1('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x42a1('0x1'));var config=require(_0x42a1('0x2'));var logger=require(_0x42a1('0x3'))('api');var db=require(_0x42a1('0x4'))['db'];var oauth=require(_0x42a1('0x5'));config[_0x42a1('0x6')]=_[_0x42a1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42a1('0x8'))(new Redis(config[_0x42a1('0x6')]));var redis=new Redis(config[_0x42a1('0x6')]);function respondWithStatusCode(_0x28189b,_0x26ef14){_0x26ef14=_0x26ef14||0xcc;return function(_0x557a5d){if(_0x557a5d){return _0x28189b[_0x42a1('0x9')](_0x26ef14);}return _0x28189b[_0x42a1('0xa')](_0x26ef14)[_0x42a1('0xb')]();};}function respondWithResult(_0x5a2afe,_0x1521bc){_0x1521bc=_0x1521bc||0xc8;return function(_0x1ef271){if(_0x1ef271){return _0x5a2afe[_0x42a1('0xa')](_0x1521bc)[_0x42a1('0xc')](_0x1ef271);}};}function respondWithFilteredResult(_0x74c62b,_0x461239){return function(_0x3ae597){if(_0x3ae597){var _0x58f748=typeof _0x461239[_0x42a1('0xd')]===_0x42a1('0xe')&&typeof _0x461239[_0x42a1('0xf')]===_0x42a1('0xe');var _0xb00c84=_0x3ae597[_0x42a1('0x10')];var _0x5b82b5=_0x58f748?0x0:_0x461239['offset'];var _0x5cbed0=_0x58f748?_0x3ae597['count']:_0x461239['offset']+_0x461239['limit'];var _0x366292;if(_0x5cbed0>=_0xb00c84){_0x5cbed0=_0xb00c84;_0x366292=0xc8;}else{_0x366292=0xce;}_0x74c62b['status'](_0x366292);return _0x74c62b['set'](_0x42a1('0x11'),_0x5b82b5+'-'+_0x5cbed0+'/'+_0xb00c84)[_0x42a1('0xc')](_0x3ae597);}return null;};}function saveUpdates(_0x508725){return function(_0x39cfde){if(_0x39cfde){return _0x39cfde[_0x42a1('0x12')](_0x508725)[_0x42a1('0x13')](function(_0x163f6e){return _0x163f6e;});}return null;};}function removeEntity(_0x2cb17d){return function(_0x4c4ae8){if(_0x4c4ae8){return _0x4c4ae8[_0x42a1('0x14')]()[_0x42a1('0x13')](function(){_0x2cb17d[_0x42a1('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17a531){return function(_0x48eef7){if(!_0x48eef7){_0x17a531['sendStatus'](0x194);}return _0x48eef7;};}function handleError(_0x38233f,_0x92f6e9){_0x92f6e9=_0x92f6e9||0x1f4;return function(_0x2bd83b){logger[_0x42a1('0x15')](_0x2bd83b[_0x42a1('0x16')]);if(_0x2bd83b['name']){delete _0x2bd83b['name'];}_0x38233f['status'](_0x92f6e9)['send'](_0x2bd83b);};}function maskClientSecret(_0x32e08c){return _[_0x42a1('0x17')](_0x32e08c[_0x42a1('0x18')](0x0,0x3),0x14,'*');}exports[_0x42a1('0x19')]=function(_0x5e9495,_0x3c5fa2){var _0x55fb51={},_0x22cb21={},_0x31a9e8={'count':0x0,'rows':[]};var _0x168cf7=_[_0x42a1('0x1a')](db['CloudProvider'][_0x42a1('0x1b')],function(_0x364661){return{'name':_0x364661[_0x42a1('0x1c')],'type':_0x364661[_0x42a1('0x1d')][_0x42a1('0x1e')]};});_0x22cb21[_0x42a1('0x1f')]=_[_0x42a1('0x1a')](_0x168cf7,_0x42a1('0x20'));_0x22cb21['query']=_['keys'](_0x5e9495[_0x42a1('0x21')]);_0x22cb21[_0x42a1('0x22')]=_[_0x42a1('0x23')](_0x22cb21[_0x42a1('0x1f')],_0x22cb21[_0x42a1('0x21')]);_0x55fb51[_0x42a1('0x24')]=_['intersection'](_0x22cb21[_0x42a1('0x1f')],qs[_0x42a1('0x25')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0x25')]));_0x55fb51[_0x42a1('0x24')]=_0x55fb51[_0x42a1('0x24')][_0x42a1('0x26')]?_0x55fb51[_0x42a1('0x24')]:_0x22cb21[_0x42a1('0x1f')];if(!_0x5e9495['query'][_0x42a1('0x27')]('nolimit')){_0x55fb51['limit']=qs[_0x42a1('0xf')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0xf')]);_0x55fb51[_0x42a1('0xd')]=qs[_0x42a1('0xd')](_0x5e9495[_0x42a1('0x21')][_0x42a1('0xd')]);}_0x55fb51[_0x42a1('0x28')]=qs['sort'](_0x5e9495['query']['sort']);_0x55fb51['where']=qs[_0x42a1('0x22')](_[_0x42a1('0x29')](_0x5e9495[_0x42a1('0x21')],_0x22cb21[_0x42a1('0x22')]),_0x168cf7);if(_0x5e9495['query'][_0x42a1('0x2a')]){_0x55fb51[_0x42a1('0x2b')]=_[_0x42a1('0x2c')](_0x55fb51[_0x42a1('0x2b')],{'$or':_[_0x42a1('0x1a')](_0x168cf7,function(_0xfcea73){if(_0xfcea73[_0x42a1('0x1d')]!==_0x42a1('0x2d')){var _0x1f4f3a={};_0x1f4f3a[_0xfcea73[_0x42a1('0x20')]]={'$like':'%'+_0x5e9495[_0x42a1('0x21')][_0x42a1('0x2a')]+'%'};return _0x1f4f3a;}})});}_0x55fb51=_[_0x42a1('0x2c')]({},_0x55fb51,_0x5e9495[_0x42a1('0x2e')]);var _0x8cdb76={'where':_0x55fb51[_0x42a1('0x2b')]};return db[_0x42a1('0x2f')][_0x42a1('0x10')](_0x8cdb76)[_0x42a1('0x13')](function(_0x48e9b9){_0x31a9e8[_0x42a1('0x10')]=_0x48e9b9;if(_0x5e9495[_0x42a1('0x21')]['includeAll']){_0x55fb51['include']=[{'all':!![]}];}return db[_0x42a1('0x2f')][_0x42a1('0x30')](_0x55fb51);})['then'](function(_0x265651){_0x31a9e8[_0x42a1('0x31')]=_[_0x42a1('0x1a')](_0x265651,function(_0x39bfe1){if(_0x39bfe1[_0x42a1('0x32')]===_0x42a1('0x33')){var _0x8888ce=encryptor[_0x42a1('0x34')](_0x39bfe1[_0x42a1('0x35')]);_0x39bfe1[_0x42a1('0x35')]=maskClientSecret(_0x8888ce);}return _0x39bfe1;});return _0x31a9e8;})['then'](respondWithFilteredResult(_0x3c5fa2,_0x55fb51))[_0x42a1('0x36')](handleError(_0x3c5fa2,null));};exports[_0x42a1('0x37')]=function(_0x4cce7c,_0x4bc9ff){var _0x16b93e={'raw':!![],'where':{'id':_0x4cce7c[_0x42a1('0x38')]['id']}},_0x38b17c={};_0x38b17c['model']=_['keys'](db[_0x42a1('0x2f')][_0x42a1('0x1b')]);_0x38b17c[_0x42a1('0x21')]=_['keys'](_0x4cce7c[_0x42a1('0x21')]);_0x38b17c[_0x42a1('0x22')]=_[_0x42a1('0x23')](_0x38b17c['model'],_0x38b17c[_0x42a1('0x21')]);_0x16b93e['attributes']=_[_0x42a1('0x23')](_0x38b17c[_0x42a1('0x1f')],qs[_0x42a1('0x25')](_0x4cce7c['query'][_0x42a1('0x25')]));_0x16b93e['attributes']=_0x16b93e[_0x42a1('0x24')][_0x42a1('0x26')]?_0x16b93e[_0x42a1('0x24')]:_0x38b17c[_0x42a1('0x1f')];if(_0x4cce7c[_0x42a1('0x21')][_0x42a1('0x39')]){_0x16b93e[_0x42a1('0x3a')]=[{'all':!![]}];}_0x16b93e=_['merge']({},_0x16b93e,_0x4cce7c[_0x42a1('0x2e')]);return db[_0x42a1('0x2f')]['find'](_0x16b93e)[_0x42a1('0x13')](handleEntityNotFound(_0x4bc9ff,null))[_0x42a1('0x13')](function(_0x40b97b){if(_0x40b97b[_0x42a1('0x32')]===_0x42a1('0x33')){var _0x3e76d2=encryptor[_0x42a1('0x34')](_0x40b97b['data3']);_0x40b97b[_0x42a1('0x35')]=maskClientSecret(_0x3e76d2);}return _0x40b97b;})['then'](respondWithResult(_0x4bc9ff,null))[_0x42a1('0x36')](handleError(_0x4bc9ff,null));};exports[_0x42a1('0x3b')]=function(_0x1ac5a7,_0x271c08){if(!_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x20')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')])throw new Error(_0x42a1('0x3d'));var _0x3f725c=db[_0x42a1('0x2f')]['rawAttributes'][_0x42a1('0x32')]['values'];if(!_0x3f725c[_0x42a1('0x3e')](_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')]))throw new Error(_0x42a1('0x3f')+_0x3f725c['join'](',\x20'));if(_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x32')]==='MicrosoftAzure'&&_0x1ac5a7[_0x42a1('0x3c')][_0x42a1('0x35')]){_0x1ac5a7[_0x42a1('0x3c')]['data3']=encryptor[_0x42a1('0x40')](_0x1ac5a7['body'][_0x42a1('0x35')]);}return db['CloudProvider']['create'](_0x1ac5a7['body'],{})['then'](respondWithResult(_0x271c08,0xc9))[_0x42a1('0x36')](handleError(_0x271c08,null));};exports[_0x42a1('0x12')]=function(_0x7905cf,_0x2285c4){if(_0x7905cf[_0x42a1('0x3c')]['id']){delete _0x7905cf[_0x42a1('0x3c')]['id'];}return db[_0x42a1('0x2f')][_0x42a1('0x41')]({'where':{'id':_0x7905cf[_0x42a1('0x38')]['id']}})['then'](handleEntityNotFound(_0x2285c4,null))[_0x42a1('0x13')](function(_0x5c616d){if(_0x5c616d[_0x42a1('0x32')]==='MicrosoftAzure'&&_0x7905cf[_0x42a1('0x3c')][_0x42a1('0x35')]){_0x7905cf[_0x42a1('0x3c')][_0x42a1('0x35')]=encryptor[_0x42a1('0x40')](_0x7905cf['body'][_0x42a1('0x35')]);}return _0x5c616d;})[_0x42a1('0x13')](saveUpdates(_0x7905cf['body'],null))[_0x42a1('0x13')](respondWithResult(_0x2285c4,null))[_0x42a1('0x36')](handleError(_0x2285c4,null));};exports[_0x42a1('0x14')]=function(_0x7df153,_0x35d284){return db['CloudProvider']['find']({'where':{'id':_0x7df153[_0x42a1('0x38')]['id']}})[_0x42a1('0x13')](handleEntityNotFound(_0x35d284,null))['then'](removeEntity(_0x35d284,null))[_0x42a1('0x36')](handleError(_0x35d284,null));};exports['oauth2MicrosoftAuthorize']=function(_0xa05679,_0x14f5da){return db[_0x42a1('0x2f')]['findOne']({'where':{'id':_0xa05679[_0x42a1('0x38')]['id']},'raw':!![]})[_0x42a1('0x13')](function(_0x3d45a3){if(!_0x3d45a3)return _0x14f5da['sendStatus'](0x194);return{'url':oauth[_0x42a1('0x42')](_0x3d45a3,_0xa05679[_0x42a1('0x43')]['id'])};})[_0x42a1('0x13')](respondWithResult(_0x14f5da,null))['catch'](handleError(_0x14f5da,null));};exports[_0x42a1('0x44')]=function(_0x79dfc0,_0x4c7927){var _0x10d711=_0x79dfc0[_0x42a1('0x3c')];var _0x1f7a33;var _0x3c36ae;if(_0x10d711[_0x42a1('0x15')])throw _0x10d711;redis[_0x42a1('0x45')](_0x10d711[_0x42a1('0x46')])[_0x42a1('0x13')](function(_0x549782){if(!_0x549782)throw new Error(_0x42a1('0x47'));_0x1f7a33=JSON[_0x42a1('0x48')](_0x549782);var _0x1b5115=Buffer['from'](_0x10d711[_0x42a1('0x46')],_0x42a1('0x49'))['toString'](_0x42a1('0x4a'));_0x3c36ae=JSON['parse'](_0x1b5115);if(!oauth[_0x42a1('0x4b')](_0x10d711['id_token'],_0x1f7a33[_0x42a1('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x42a1('0x4d')](_0x10d711['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x10d711[_0x42a1('0x4e')],_0x1f7a33);})[_0x42a1('0x13')](function(_0x4aa303){_0x1f7a33[_0x42a1('0x4f')]=_0x4aa303[_0x42a1('0x50')];_0x1f7a33['data6']=_0x4aa303[_0x42a1('0x51')];return db[_0x42a1('0x2f')][_0x42a1('0x12')]({'data5':_0x1f7a33['data5'],'data6':_0x1f7a33[_0x42a1('0x52')]},{'where':{'id':_0x1f7a33['id']}});})[_0x42a1('0x13')](function(){oauth[_0x42a1('0x53')](_0x1f7a33);socket['emit'](_0x42a1('0x54'),{'id':_0x3c36ae['id']});return;})['then'](respondWithStatusCode(_0x4c7927,null))[_0x42a1('0x36')](function(_0x127f8d){if(_0x3c36ae){socket['emit']('microsoftAuthorization:error',{'id':_0x3c36ae['id']});}if(!_0x1f7a33){logger[_0x42a1('0x15')](_0x42a1('0x55'),_0x127f8d);return _0x4c7927[_0x42a1('0xa')](0x1f4)[_0x42a1('0x56')](_0x127f8d[_0x42a1('0x57')]);}logger['error'](_0x42a1('0x58'),_0x1f7a33['id'],JSON[_0x42a1('0x59')](_0x127f8d));});}; \ No newline at end of file +var _0x5cf4=['VIRTUAL','merge','options','CloudProvider','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','params','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','find','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','socket.io-emitter','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','name','padEnd','slice','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x5cf4,0x93));var _0x45cf=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x5cf4[_0x3fd3a3];return _0xa3e4d5;};'use strict';var _=require('lodash');var Redis=require(_0x45cf('0x0'));var qs=require(_0x45cf('0x1'));var encryptor=require(_0x45cf('0x2'));var config=require(_0x45cf('0x3'));var logger=require(_0x45cf('0x4'))('api');var db=require(_0x45cf('0x5'))['db'];var oauth=require(_0x45cf('0x6'));config[_0x45cf('0x7')]=_['defaults'](config[_0x45cf('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x45cf('0x8'))(new Redis(config[_0x45cf('0x7')]));var redis=new Redis(config[_0x45cf('0x7')]);function respondWithStatusCode(_0x4c90b8,_0x5cfb42){_0x5cfb42=_0x5cfb42||0xcc;return function(_0x1af8f0){if(_0x1af8f0){return _0x4c90b8[_0x45cf('0x9')](_0x5cfb42);}return _0x4c90b8['status'](_0x5cfb42)[_0x45cf('0xa')]();};}function respondWithResult(_0x4e539c,_0x2174f3){_0x2174f3=_0x2174f3||0xc8;return function(_0x2e0b69){if(_0x2e0b69){return _0x4e539c[_0x45cf('0xb')](_0x2174f3)[_0x45cf('0xc')](_0x2e0b69);}};}function respondWithFilteredResult(_0xf7bf77,_0x17d9a0){return function(_0x29ab2a){if(_0x29ab2a){var _0x1c059c=typeof _0x17d9a0['offset']===_0x45cf('0xd')&&typeof _0x17d9a0[_0x45cf('0xe')]===_0x45cf('0xd');var _0x1ec7e5=_0x29ab2a[_0x45cf('0xf')];var _0x4a00ad=_0x1c059c?0x0:_0x17d9a0[_0x45cf('0x10')];var _0x5ba081=_0x1c059c?_0x29ab2a[_0x45cf('0xf')]:_0x17d9a0[_0x45cf('0x10')]+_0x17d9a0[_0x45cf('0xe')];var _0x5e12d0;if(_0x5ba081>=_0x1ec7e5){_0x5ba081=_0x1ec7e5;_0x5e12d0=0xc8;}else{_0x5e12d0=0xce;}_0xf7bf77['status'](_0x5e12d0);return _0xf7bf77['set'](_0x45cf('0x11'),_0x4a00ad+'-'+_0x5ba081+'/'+_0x1ec7e5)[_0x45cf('0xc')](_0x29ab2a);}return null;};}function saveUpdates(_0x2f0634){return function(_0x593961){if(_0x593961){return _0x593961[_0x45cf('0x12')](_0x2f0634)[_0x45cf('0x13')](function(_0x23382e){return _0x23382e;});}return null;};}function removeEntity(_0x272e93){return function(_0x21f766){if(_0x21f766){return _0x21f766[_0x45cf('0x14')]()[_0x45cf('0x13')](function(){_0x272e93[_0x45cf('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176357){return function(_0xc974b4){if(!_0xc974b4){_0x176357[_0x45cf('0x9')](0x194);}return _0xc974b4;};}function handleError(_0x31e41a,_0x1b5866){_0x1b5866=_0x1b5866||0x1f4;return function(_0x3ee338){logger['error'](_0x3ee338['stack']);if(_0x3ee338[_0x45cf('0x15')]){delete _0x3ee338['name'];}_0x31e41a[_0x45cf('0xb')](_0x1b5866)['send'](_0x3ee338);};}function maskClientSecret(_0xcaee40){return _[_0x45cf('0x16')](_0xcaee40[_0x45cf('0x17')](0x0,0x3),0x14,'*');}exports['index']=function(_0x1f4f42,_0x2a53c9){var _0x45e54d={},_0x1cd1cc={},_0x84b1f0={'count':0x0,'rows':[]};var _0x115b44=_[_0x45cf('0x18')](db['CloudProvider']['rawAttributes'],function(_0x594a8f){return{'name':_0x594a8f[_0x45cf('0x19')],'type':_0x594a8f[_0x45cf('0x1a')][_0x45cf('0x1b')]};});_0x1cd1cc['model']=_[_0x45cf('0x18')](_0x115b44,'name');_0x1cd1cc['query']=_[_0x45cf('0x1c')](_0x1f4f42[_0x45cf('0x1d')]);_0x1cd1cc['filters']=_[_0x45cf('0x1e')](_0x1cd1cc[_0x45cf('0x1f')],_0x1cd1cc[_0x45cf('0x1d')]);_0x45e54d[_0x45cf('0x20')]=_[_0x45cf('0x1e')](_0x1cd1cc[_0x45cf('0x1f')],qs[_0x45cf('0x21')](_0x1f4f42[_0x45cf('0x1d')][_0x45cf('0x21')]));_0x45e54d['attributes']=_0x45e54d[_0x45cf('0x20')][_0x45cf('0x22')]?_0x45e54d[_0x45cf('0x20')]:_0x1cd1cc[_0x45cf('0x1f')];if(!_0x1f4f42[_0x45cf('0x1d')][_0x45cf('0x23')](_0x45cf('0x24'))){_0x45e54d['limit']=qs[_0x45cf('0xe')](_0x1f4f42[_0x45cf('0x1d')][_0x45cf('0xe')]);_0x45e54d['offset']=qs[_0x45cf('0x10')](_0x1f4f42[_0x45cf('0x1d')]['offset']);}_0x45e54d[_0x45cf('0x25')]=qs[_0x45cf('0x26')](_0x1f4f42[_0x45cf('0x1d')][_0x45cf('0x26')]);_0x45e54d[_0x45cf('0x27')]=qs[_0x45cf('0x28')](_[_0x45cf('0x29')](_0x1f4f42[_0x45cf('0x1d')],_0x1cd1cc[_0x45cf('0x28')]),_0x115b44);if(_0x1f4f42['query'][_0x45cf('0x2a')]){_0x45e54d['where']=_['merge'](_0x45e54d['where'],{'$or':_[_0x45cf('0x18')](_0x115b44,function(_0x50a896){if(_0x50a896[_0x45cf('0x1a')]!==_0x45cf('0x2b')){var _0x8f37e5={};_0x8f37e5[_0x50a896['name']]={'$like':'%'+_0x1f4f42['query']['filter']+'%'};return _0x8f37e5;}})});}_0x45e54d=_[_0x45cf('0x2c')]({},_0x45e54d,_0x1f4f42[_0x45cf('0x2d')]);var _0x100712={'where':_0x45e54d[_0x45cf('0x27')]};return db[_0x45cf('0x2e')][_0x45cf('0xf')](_0x100712)[_0x45cf('0x13')](function(_0x2bb8fd){_0x84b1f0[_0x45cf('0xf')]=_0x2bb8fd;if(_0x1f4f42['query'][_0x45cf('0x2f')]){_0x45e54d[_0x45cf('0x30')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x45e54d);})['then'](function(_0x3fa190){_0x84b1f0[_0x45cf('0x31')]=_[_0x45cf('0x18')](_0x3fa190,function(_0xe6d577){if(_0xe6d577[_0x45cf('0x32')]===_0x45cf('0x33')){var _0x38b0e0=encryptor[_0x45cf('0x34')](_0xe6d577[_0x45cf('0x35')]);_0xe6d577[_0x45cf('0x35')]=maskClientSecret(_0x38b0e0);}return _0xe6d577;});return _0x84b1f0;})['then'](respondWithFilteredResult(_0x2a53c9,_0x45e54d))['catch'](handleError(_0x2a53c9,null));};exports['show']=function(_0x33c6c7,_0x160258){var _0x31a18d={'raw':!![],'where':{'id':_0x33c6c7[_0x45cf('0x36')]['id']}},_0x1581bb={};_0x1581bb[_0x45cf('0x1f')]=_[_0x45cf('0x1c')](db[_0x45cf('0x2e')]['rawAttributes']);_0x1581bb[_0x45cf('0x1d')]=_[_0x45cf('0x1c')](_0x33c6c7['query']);_0x1581bb[_0x45cf('0x28')]=_[_0x45cf('0x1e')](_0x1581bb[_0x45cf('0x1f')],_0x1581bb['query']);_0x31a18d['attributes']=_[_0x45cf('0x1e')](_0x1581bb[_0x45cf('0x1f')],qs[_0x45cf('0x21')](_0x33c6c7[_0x45cf('0x1d')][_0x45cf('0x21')]));_0x31a18d['attributes']=_0x31a18d[_0x45cf('0x20')][_0x45cf('0x22')]?_0x31a18d[_0x45cf('0x20')]:_0x1581bb[_0x45cf('0x1f')];if(_0x33c6c7[_0x45cf('0x1d')][_0x45cf('0x2f')]){_0x31a18d['include']=[{'all':!![]}];}_0x31a18d=_[_0x45cf('0x2c')]({},_0x31a18d,_0x33c6c7[_0x45cf('0x2d')]);return db['CloudProvider']['find'](_0x31a18d)[_0x45cf('0x13')](handleEntityNotFound(_0x160258,null))[_0x45cf('0x13')](function(_0x34b519){if(_0x34b519['service']===_0x45cf('0x33')){var _0x4c3799=encryptor['decryptString'](_0x34b519[_0x45cf('0x35')]);_0x34b519[_0x45cf('0x35')]=maskClientSecret(_0x4c3799);}return _0x34b519;})['then'](respondWithResult(_0x160258,null))[_0x45cf('0x37')](handleError(_0x160258,null));};exports[_0x45cf('0x38')]=function(_0x165088,_0x3d9204){if(!_0x165088[_0x45cf('0x39')][_0x45cf('0x15')])throw new Error(_0x45cf('0x3a'));if(!_0x165088[_0x45cf('0x39')][_0x45cf('0x32')])throw new Error(_0x45cf('0x3b'));var _0x35318b=db[_0x45cf('0x2e')][_0x45cf('0x3c')][_0x45cf('0x32')]['values'];if(!_0x35318b[_0x45cf('0x3d')](_0x165088[_0x45cf('0x39')][_0x45cf('0x32')]))throw new Error(_0x45cf('0x3e')+_0x35318b[_0x45cf('0x3f')](',\x20'));if(_0x165088[_0x45cf('0x39')][_0x45cf('0x32')]===_0x45cf('0x33')&&_0x165088[_0x45cf('0x39')][_0x45cf('0x35')]){_0x165088[_0x45cf('0x39')][_0x45cf('0x35')]=encryptor['encryptString'](_0x165088[_0x45cf('0x39')][_0x45cf('0x35')]);}return db[_0x45cf('0x2e')]['create'](_0x165088[_0x45cf('0x39')],{})[_0x45cf('0x13')](respondWithResult(_0x3d9204,0xc9))[_0x45cf('0x37')](handleError(_0x3d9204,null));};exports[_0x45cf('0x12')]=function(_0x5adad8,_0xb16de4){if(_0x5adad8[_0x45cf('0x39')]['id']){delete _0x5adad8[_0x45cf('0x39')]['id'];}return db[_0x45cf('0x2e')][_0x45cf('0x40')]({'where':{'id':_0x5adad8[_0x45cf('0x36')]['id']}})[_0x45cf('0x13')](handleEntityNotFound(_0xb16de4,null))['then'](function(_0x12ccab){if(_0x12ccab[_0x45cf('0x32')]===_0x45cf('0x33')&&_0x5adad8['body'][_0x45cf('0x35')]){_0x5adad8['body'][_0x45cf('0x35')]=encryptor[_0x45cf('0x41')](_0x5adad8[_0x45cf('0x39')][_0x45cf('0x35')]);}return _0x12ccab;})[_0x45cf('0x13')](saveUpdates(_0x5adad8[_0x45cf('0x39')],null))[_0x45cf('0x13')](respondWithResult(_0xb16de4,null))['catch'](handleError(_0xb16de4,null));};exports[_0x45cf('0x14')]=function(_0x3e95dc,_0x56f3e2){return db[_0x45cf('0x2e')][_0x45cf('0x40')]({'where':{'id':_0x3e95dc[_0x45cf('0x36')]['id']}})['then'](handleEntityNotFound(_0x56f3e2,null))[_0x45cf('0x13')](removeEntity(_0x56f3e2,null))[_0x45cf('0x37')](handleError(_0x56f3e2,null));};exports[_0x45cf('0x42')]=function(_0x2da671,_0x2a3f14){return db[_0x45cf('0x2e')][_0x45cf('0x43')]({'where':{'id':_0x2da671[_0x45cf('0x36')]['id']},'raw':!![]})[_0x45cf('0x13')](function(_0x29a171){if(!_0x29a171)return _0x2a3f14[_0x45cf('0x9')](0x194);return{'url':oauth[_0x45cf('0x44')](_0x29a171,_0x2da671['user']['id'])};})[_0x45cf('0x13')](respondWithResult(_0x2a3f14,null))[_0x45cf('0x37')](handleError(_0x2a3f14,null));};exports[_0x45cf('0x45')]=function(_0x47857b,_0x77850b){var _0x186732=_0x47857b['body'];var _0x255bbd;var _0x29cb61;if(_0x186732[_0x45cf('0x46')])throw _0x186732;redis['get'](_0x186732['state'])['then'](function(_0x4d1422){if(!_0x4d1422)throw new Error(_0x45cf('0x47'));_0x255bbd=JSON[_0x45cf('0x48')](_0x4d1422);var _0x271b48=Buffer[_0x45cf('0x49')](_0x186732[_0x45cf('0x4a')],_0x45cf('0x4b'))[_0x45cf('0x4c')](_0x45cf('0x4d'));_0x29cb61=JSON[_0x45cf('0x48')](_0x271b48);if(!oauth[_0x45cf('0x4e')](_0x186732[_0x45cf('0x4f')],_0x255bbd['oauth2Claims']))throw new Error(_0x45cf('0x50'));redis[_0x45cf('0x51')](_0x186732[_0x45cf('0x4a')]);return oauth[_0x45cf('0x52')](_0x186732[_0x45cf('0x53')],_0x255bbd);})[_0x45cf('0x13')](function(_0x12808f){_0x255bbd[_0x45cf('0x54')]=_0x12808f['access_token'];_0x255bbd[_0x45cf('0x55')]=_0x12808f[_0x45cf('0x56')];return db[_0x45cf('0x2e')][_0x45cf('0x12')]({'data5':_0x255bbd[_0x45cf('0x54')],'data6':_0x255bbd[_0x45cf('0x55')]},{'where':{'id':_0x255bbd['id']}});})[_0x45cf('0x13')](function(){oauth[_0x45cf('0x57')](_0x255bbd);socket[_0x45cf('0x58')](_0x45cf('0x59'),{'id':_0x29cb61['id']});return;})[_0x45cf('0x13')](respondWithStatusCode(_0x77850b,null))[_0x45cf('0x37')](function(_0x4a98df){if(_0x29cb61){socket[_0x45cf('0x58')]('microsoftAuthorization:error',{'id':_0x29cb61['id']});}if(!_0x255bbd){logger[_0x45cf('0x46')](_0x45cf('0x5a'),_0x4a98df);return _0x77850b['status'](0x1f4)[_0x45cf('0x5b')](_0x4a98df[_0x45cf('0x5c')]);}logger[_0x45cf('0x46')](_0x45cf('0x5d'),_0x255bbd['id'],JSON[_0x45cf('0x5e')](_0x4a98df));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index bb18574..1c5c426 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 _0xd1c1=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0xd1c1,0x1af));var _0x1d1c=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xd1c1[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require(_0x1d1c('0x0'));var util=require('util');var logger=require(_0x1d1c('0x1'))(_0x1d1c('0x2'));var moment=require('moment');var BPromise=require(_0x1d1c('0x3'));var rp=require(_0x1d1c('0x4'));var fs=require('fs');var path=require(_0x1d1c('0x5'));var rimraf=require(_0x1d1c('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d1c('0x7'));module[_0x1d1c('0x8')]=function(_0x20bc1f,_0x48da36){return _0x20bc1f[_0x1d1c('0x9')](_0x1d1c('0xa'),attributes,{'tableName':_0x1d1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcd9=['bluebird','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x4a602,_0xaa5b8e){var _0x38643c=function(_0x40208e){while(--_0x40208e){_0x4a602['push'](_0x4a602['shift']());}};_0x38643c(++_0xaa5b8e);}(_0xfcd9,0xcd));var _0x9fcd=function(_0x32358b,_0x5c7c35){_0x32358b=_0x32358b-0x0;var _0x58c21d=_0xfcd9[_0x32358b];return _0x58c21d;};'use strict';var _=require(_0x9fcd('0x0'));var util=require(_0x9fcd('0x1'));var logger=require(_0x9fcd('0x2'))(_0x9fcd('0x3'));var moment=require(_0x9fcd('0x4'));var BPromise=require(_0x9fcd('0x5'));var rp=require(_0x9fcd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fcd('0x7'));var config=require(_0x9fcd('0x8'));var attributes=require(_0x9fcd('0x9'));module[_0x9fcd('0xa')]=function(_0x44da9f,_0x2d9d06){return _0x44da9f[_0x9fcd('0xb')](_0x9fcd('0xc'),attributes,{'tableName':_0x9fcd('0xd'),'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 88648da..1d61668 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 _0xb6b7=['map','key','value','oauth2Claims','oauth2/','data1','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','data6','data4','POST','data5','access_token','update','catch','error','authorization_code','intervals','bind','CloudProvider','findAll','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','client_id','response_type','join','redirect_uri','response_mode','state','nonce','prompt','login'];(function(_0x3f2605,_0x262173){var _0x15169a=function(_0x1438d0){while(--_0x1438d0){_0x3f2605['push'](_0x3f2605['shift']());}};_0x15169a(++_0x262173);}(_0xb6b7,0xc6));var _0x7b6b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb6b7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7b6b('0x0'));var crypto=require(_0x7b6b('0x1'));var jwt=require(_0x7b6b('0x2'));var moment=require(_0x7b6b('0x3'));var Redis=require(_0x7b6b('0x4'));var rp=require(_0x7b6b('0x5'));var util=require('util');var encryptor=require(_0x7b6b('0x6'));var config=require('../../config/environment');var logger=require(_0x7b6b('0x7'))(_0x7b6b('0x8'));var schedule=require(_0x7b6b('0x9'));var db=require(_0x7b6b('0xa'))['db'];config[_0x7b6b('0xb')]=_[_0x7b6b('0xc')](config['redis'],{'host':_0x7b6b('0xd'),'port':0x18eb});var redis=new Redis(config[_0x7b6b('0xb')]);var MICROSOFT_AUTH_URL=_0x7b6b('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x7b6b('0xf'),'profile',_0x7b6b('0x10'),_0x7b6b('0x11'),_0x7b6b('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0x7b6b('0x13')],'Dynamics365':[_0x7b6b('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x7b6b('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x7b6b('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x37f696){var _0x54160e=_['map'](AZURE_AUTH_SCOPES[_0x37f696[_0x7b6b('0x16')]]);if(_0x37f696['type']===_0x7b6b('0x17'))_0x54160e[_0x7b6b('0x18')](_0x37f696[_0x7b6b('0x19')]+'/.default');return _0x54160e['join']('\x20');}function getAccessTokenScope(_0x33296a){if(_0x33296a[_0x7b6b('0x16')]===_0x7b6b('0x1a'))return _0x7b6b('0x12');if(_0x33296a['type']===_0x7b6b('0x17'))return _0x33296a[_0x7b6b('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x411761,_0x1c9175){var _0x35a98f=MICROSOFT_AUTH_URL[_0x7b6b('0x1b')](_0x7b6b('0x1c'),_0x411761[_0x7b6b('0x1d')]);var _0x38b8e8=[_0x7b6b('0x1e'),_0x7b6b('0x1f')];var _0x16a82e=Buffer[_0x7b6b('0x20')](JSON[_0x7b6b('0x21')]({'id':_0x1c9175}))['toString']('base64');var _0x2cac88=crypto[_0x7b6b('0x22')](0x10)[_0x7b6b('0x23')]('hex');var _0x56d214=getAuthorizationScopes(_0x411761);var _0x9d54ad=[{'key':_0x7b6b('0x24'),'value':_0x411761['data1']},{'key':_0x7b6b('0x25'),'value':encodeURIComponent(_0x38b8e8[_0x7b6b('0x26')]('\x20'))},{'key':_0x7b6b('0x27'),'value':_0x411761['data4']},{'key':_0x7b6b('0x28'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x56d214)},{'key':_0x7b6b('0x29'),'value':_0x16a82e},{'key':_0x7b6b('0x2a'),'value':_0x2cac88},{'key':_0x7b6b('0x2b'),'value':_0x7b6b('0x2c')}];var _0xa04fc9=_0x35a98f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7b6b('0x2d')](_0x9d54ad,function(_0x3926ef){return _0x3926ef[_0x7b6b('0x2e')]+'='+_0x3926ef[_0x7b6b('0x2f')];})[_0x7b6b('0x26')]('&');_0x411761[_0x7b6b('0x30')]={'issuer':_0x35a98f[_0x7b6b('0x1b')](_0x7b6b('0x31'),''),'audience':_0x411761[_0x7b6b('0x32')],'state':_0x16a82e,'nonce':_0x2cac88};redis['set'](_0x16a82e,JSON[_0x7b6b('0x21')](_0x411761));return _0xa04fc9;}function isValidIdToken(_0xb2ad45,_0x306490){try{var _0x3cfa43=jwt[_0x7b6b('0x33')](_0xb2ad45,{'complete':!![]});var _0x1e3076=_0x3cfa43[_0x7b6b('0x34')];if(_0x1e3076[_0x7b6b('0x35')]!==_0x306490[_0x7b6b('0x36')])return![];if(_0x1e3076[_0x7b6b('0x37')]!==_0x306490[_0x7b6b('0x38')])return![];if(_0x1e3076[_0x7b6b('0x2a')]!==_0x306490[_0x7b6b('0x2a')])return![];if(moment()[_0x7b6b('0x39')](moment[_0x7b6b('0x3a')](_0x1e3076[_0x7b6b('0x3b')])))return![];return!![];}catch(_0x255171){throw _0x255171;}}function refreshOauth2MicrosoftAccessToken(_0x16a36f){return Promise[_0x7b6b('0x3c')]()[_0x7b6b('0x3d')](function(){if(_0x16a36f[_0x7b6b('0x3e')])return _0x16a36f;return db['CloudProvider'][_0x7b6b('0x3f')]({'where':{'id':_0x16a36f['id']},'raw':!![]});})[_0x7b6b('0x3d')](function(_0x4df009){var _0x38852e={'grant_type':_0x7b6b('0x40'),'refresh_token':_0x4df009[_0x7b6b('0x41')],'scope':getAccessTokenScope(_0x4df009),'redirect_uri':_0x4df009[_0x7b6b('0x42')],'client_id':_0x4df009[_0x7b6b('0x32')],'client_secret':encryptor['decryptString'](_0x4df009[_0x7b6b('0x3e')])};var _0x454a0d={'method':_0x7b6b('0x43'),'uri':MICROSOFT_AUTH_URL[_0x7b6b('0x1b')](_0x7b6b('0x1c'),_0x4df009[_0x7b6b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x38852e,'json':!![]};return rp(_0x454a0d);})[_0x7b6b('0x3d')](function(_0xde4bab){_0x16a36f[_0x7b6b('0x44')]=_0xde4bab[_0x7b6b('0x45')];_0x16a36f[_0x7b6b('0x41')]=_0xde4bab[_0x7b6b('0x40')];return db['CloudProvider'][_0x7b6b('0x46')]({'data5':_0x16a36f[_0x7b6b('0x44')],'data6':_0x16a36f['data6']},{'where':{'id':_0x16a36f['id']}});})[_0x7b6b('0x3d')](function(){return _0x16a36f;})[_0x7b6b('0x47')](function(_0x460bc7){logger[_0x7b6b('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x16a36f['id'],_0x460bc7);});}function getOauth2MicrosoftAccessToken(_0x2722e7,_0x220d5b){var _0x10a636={'grant_type':_0x7b6b('0x49'),'code':_0x2722e7,'scope':getAccessTokenScope(_0x220d5b),'redirect_uri':_0x220d5b['data4'],'client_id':_0x220d5b['data1'],'client_secret':encryptor['decryptString'](_0x220d5b[_0x7b6b('0x3e')])};var _0x10e743={'method':_0x7b6b('0x43'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7b6b('0x1c'),_0x220d5b[_0x7b6b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x10a636,'json':!![]};return rp(_0x10e743);}function startRefreshInterval(_0x22aeef){var _0x38f4ad=schedule[_0x7b6b('0x4a')];if(_0x38f4ad[_0x22aeef['id']])clearInterval(_0x38f4ad[_0x22aeef['id']]);_0x38f4ad[_0x22aeef['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7b6b('0x4b')](this,{'id':_0x22aeef['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7b6b('0x4a')]=_0x38f4ad;}function startAllRefreshIntervals(){return db[_0x7b6b('0x4c')][_0x7b6b('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7b6b('0x3d')](function(_0x1d3672){var _0x4c7351=_0x1d3672[_0x7b6b('0x2d')](function(_0x57c064){return refreshOauth2MicrosoftAccessToken(_0x57c064)[_0x7b6b('0x3d')](function(_0x485260){startRefreshInterval(_0x485260);});});return Promise['all'](_0x4c7351);})[_0x7b6b('0x47')](function(_0x53e3bf){var _0x4142dd=_0x53e3bf?util[_0x7b6b('0x4e')](_0x53e3bf,{'showHidden':![],'depth':null}):'';logger[_0x7b6b('0x48')](_0x7b6b('0x4f'),_0x4142dd);});}module[_0x7b6b('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8350=['ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','map','type','Dynamics365','push','data7','join','Outlook365','/.default','replace','from','stringify','toString','randomBytes','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','set','decode','payload','iss','issuer','audience','isAfter','unix','resolve','data3','CloudProvider','findOne','then','refresh_token','decryptString','POST','data2','data5','access_token','update','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8350,0x1d8));var _0x0835=function(_0x54f996,_0x2464f8){_0x54f996=_0x54f996-0x0;var _0x3a7f6b=_0x8350[_0x54f996];return _0x3a7f6b;};'use strict';var _=require('lodash');var crypto=require(_0x0835('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x0835('0x1'));var Redis=require(_0x0835('0x2'));var rp=require(_0x0835('0x3'));var util=require(_0x0835('0x4'));var encryptor=require(_0x0835('0x5'));var config=require(_0x0835('0x6'));var logger=require('../../config/logger')(_0x0835('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x0835('0x8'))['db'];config[_0x0835('0x9')]=_[_0x0835('0xa')](config[_0x0835('0x9')],{'host':_0x0835('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x0835('0xc'),_0x0835('0xd'),_0x0835('0xe'),_0x0835('0xf'),_0x0835('0x10'),_0x0835('0x11')],'Dynamics365':[_0x0835('0x12'),_0x0835('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x0835('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x28b72f){var _0x480f42=_[_0x0835('0x14')](AZURE_AUTH_SCOPES[_0x28b72f['type']]);if(_0x28b72f[_0x0835('0x15')]===_0x0835('0x16'))_0x480f42[_0x0835('0x17')](_0x28b72f[_0x0835('0x18')]+'/.default');return _0x480f42[_0x0835('0x19')]('\x20');}function getAccessTokenScope(_0x264c09){if(_0x264c09[_0x0835('0x15')]===_0x0835('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x264c09['type']==='Dynamics365')return _0x264c09[_0x0835('0x18')]+_0x0835('0x1b');}function generateMicrosoftAuthorizationUrl(_0x3ea3e6,_0x2ce127){var _0x13c815=MICROSOFT_AUTH_URL[_0x0835('0x1c')]('{TENANT_ID}',_0x3ea3e6['data2']);var _0x47fb52=['code','id_token'];var _0x2c8acc=Buffer[_0x0835('0x1d')](JSON[_0x0835('0x1e')]({'id':_0x2ce127}))[_0x0835('0x1f')]('base64');var _0x14b1e9=crypto[_0x0835('0x20')](0x10)['toString']('hex');var _0x110f02=getAuthorizationScopes(_0x3ea3e6);var _0xf2f437=[{'key':_0x0835('0x21'),'value':_0x3ea3e6[_0x0835('0x22')]},{'key':_0x0835('0x23'),'value':encodeURIComponent(_0x47fb52['join']('\x20'))},{'key':_0x0835('0x24'),'value':_0x3ea3e6[_0x0835('0x25')]},{'key':_0x0835('0x26'),'value':_0x0835('0x27')},{'key':_0x0835('0x28'),'value':encodeURIComponent(_0x110f02)},{'key':_0x0835('0x29'),'value':_0x2c8acc},{'key':_0x0835('0x2a'),'value':_0x14b1e9},{'key':_0x0835('0x2b'),'value':_0x0835('0x2c')}];var _0x3e026d=_0x13c815+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0835('0x14')](_0xf2f437,function(_0x2c8966){return _0x2c8966[_0x0835('0x2d')]+'='+_0x2c8966[_0x0835('0x2e')];})[_0x0835('0x19')]('&');_0x3ea3e6['oauth2Claims']={'issuer':_0x13c815[_0x0835('0x1c')]('oauth2/',''),'audience':_0x3ea3e6['data1'],'state':_0x2c8acc,'nonce':_0x14b1e9};redis[_0x0835('0x2f')](_0x2c8acc,JSON[_0x0835('0x1e')](_0x3ea3e6));return _0x3e026d;}function isValidIdToken(_0x502c83,_0x430910){try{var _0x557711=jwt[_0x0835('0x30')](_0x502c83,{'complete':!![]});var _0x1977bd=_0x557711[_0x0835('0x31')];if(_0x1977bd[_0x0835('0x32')]!==_0x430910[_0x0835('0x33')])return![];if(_0x1977bd['aud']!==_0x430910[_0x0835('0x34')])return![];if(_0x1977bd[_0x0835('0x2a')]!==_0x430910['nonce'])return![];if(moment()[_0x0835('0x35')](moment[_0x0835('0x36')](_0x1977bd['exp'])))return![];return!![];}catch(_0x31b195){throw _0x31b195;}}function refreshOauth2MicrosoftAccessToken(_0x2ac6d9){return Promise[_0x0835('0x37')]()['then'](function(){if(_0x2ac6d9[_0x0835('0x38')])return _0x2ac6d9;return db[_0x0835('0x39')][_0x0835('0x3a')]({'where':{'id':_0x2ac6d9['id']},'raw':!![]});})[_0x0835('0x3b')](function(_0x46e549){var _0x14ef33={'grant_type':_0x0835('0x3c'),'refresh_token':_0x46e549['data6'],'scope':getAccessTokenScope(_0x46e549),'redirect_uri':_0x46e549[_0x0835('0x25')],'client_id':_0x46e549['data1'],'client_secret':encryptor[_0x0835('0x3d')](_0x46e549['data3'])};var _0x5d95a9={'method':_0x0835('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x0835('0x1c')]('{TENANT_ID}',_0x46e549[_0x0835('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x14ef33,'json':!![]};return rp(_0x5d95a9);})['then'](function(_0x3a8dd3){_0x2ac6d9[_0x0835('0x40')]=_0x3a8dd3[_0x0835('0x41')];_0x2ac6d9['data6']=_0x3a8dd3['refresh_token'];return db[_0x0835('0x39')][_0x0835('0x42')]({'data5':_0x2ac6d9[_0x0835('0x40')],'data6':_0x2ac6d9[_0x0835('0x43')]},{'where':{'id':_0x2ac6d9['id']}});})[_0x0835('0x3b')](function(){return _0x2ac6d9;})[_0x0835('0x44')](function(_0x550298){logger[_0x0835('0x45')](_0x0835('0x46'),_0x2ac6d9['id'],_0x550298);});}function getOauth2MicrosoftAccessToken(_0x93f09a,_0x30c6ea){var _0x4d696c={'grant_type':_0x0835('0x47'),'code':_0x93f09a,'scope':getAccessTokenScope(_0x30c6ea),'redirect_uri':_0x30c6ea[_0x0835('0x25')],'client_id':_0x30c6ea[_0x0835('0x22')],'client_secret':encryptor['decryptString'](_0x30c6ea['data3'])};var _0x1e6a37={'method':_0x0835('0x3e'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x30c6ea[_0x0835('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4d696c,'json':!![]};return rp(_0x1e6a37);}function startRefreshInterval(_0x4958cb){var _0xf4becb=schedule['intervals'];if(_0xf4becb[_0x4958cb['id']])clearInterval(_0xf4becb[_0x4958cb['id']]);_0xf4becb[_0x4958cb['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0835('0x48')](this,{'id':_0x4958cb['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0835('0x49')]=_0xf4becb;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x0835('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3fc675){var _0x589e16=_0x3fc675[_0x0835('0x14')](function(_0x1fe10b){return refreshOauth2MicrosoftAccessToken(_0x1fe10b)[_0x0835('0x3b')](function(_0x46ada1){startRefreshInterval(_0x46ada1);});});return Promise[_0x0835('0x4b')](_0x589e16);})[_0x0835('0x44')](function(_0x505d24){var _0x40c3bf=_0x505d24?util[_0x0835('0x4c')](_0x505d24,{'showHidden':![],'depth':null}):'';logger[_0x0835('0x45')](_0x0835('0x4d'),_0x40c3bf);});}module[_0x0835('0x4e')]={'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 0d412f1..f6b2d17 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 _0xa0a3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','moment','randomstring','ioredis'];(function(_0x3abc2b,_0x239fe6){var _0x1eb069=function(_0x37c100){while(--_0x37c100){_0x3abc2b['push'](_0x3abc2b['shift']());}};_0x1eb069(++_0x239fe6);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xa0a3[_0xd3da2a];return _0x10ab61;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4719d,_0x451873,_0x1766c1){return new BPromise(function(_0x5d98d3,_0x56ee1b){return client[_0x3a0a('0xc')](_0x4719d,_0x1766c1)[_0x3a0a('0xd')](function(_0x29207e){logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));logger[_0x3a0a('0x11')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x451873,'request\x20sent',JSON[_0x3a0a('0x12')](_0x29207e));if(_0x29207e[_0x3a0a('0x13')]){if(_0x29207e['error']['code']===0x1f4){logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e['error'][_0x3a0a('0x14')]);return _0x56ee1b(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}logger[_0x3a0a('0x13')](_0x3a0a('0xf'),_0x451873,_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);return _0x5d98d3(_0x29207e[_0x3a0a('0x13')][_0x3a0a('0x14')]);}else{logger[_0x3a0a('0xe')](_0x3a0a('0xf'),_0x451873,_0x3a0a('0x10'));_0x5d98d3(_0x29207e[_0x3a0a('0x15')][_0x3a0a('0x14')]);}})['catch'](function(_0x41a6b0){logger['error'](_0x3a0a('0xf'),_0x451873,_0x41a6b0);_0x56ee1b(_0x41a6b0);});});} \ No newline at end of file +var _0xb511=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2816aa,_0x3eee56){var _0x510f23=function(_0x5cac09){while(--_0x5cac09){_0x2816aa['push'](_0x2816aa['shift']());}};_0x510f23(++_0x3eee56);}(_0xb511,0x165));var _0x1b51=function(_0x38fa9c,_0xb11d1c){_0x38fa9c=_0x38fa9c-0x0;var _0x3fcf31=_0xb511[_0x38fa9c];return _0x3fcf31;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var moment=require(_0x1b51('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b51('0x3'));var fs=require('fs');var Redis=require(_0x1b51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b51('0x5'));var logger=require(_0x1b51('0x6'))(_0x1b51('0x7'));var config=require('../../config/environment');var jayson=require(_0x1b51('0x8'));var client=jayson[_0x1b51('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475add,_0x43c14c,_0x5e7ece){return new BPromise(function(_0xfa46a3,_0x1690c9){return client[_0x1b51('0xa')](_0x475add,_0x5e7ece)[_0x1b51('0xb')](function(_0x3ceabe){logger[_0x1b51('0xc')](_0x1b51('0xd'),_0x43c14c,_0x1b51('0xe'));logger['debug'](_0x1b51('0xf'),_0x43c14c,_0x1b51('0xe'),JSON[_0x1b51('0x10')](_0x3ceabe));if(_0x3ceabe[_0x1b51('0x11')]){if(_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x12')]===0x1f4){logger['error'](_0x1b51('0xd'),_0x43c14c,_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x13')]);return _0x1690c9(_0x3ceabe[_0x1b51('0x11')][_0x1b51('0x13')]);}logger[_0x1b51('0x11')](_0x1b51('0xd'),_0x43c14c,_0x3ceabe['error'][_0x1b51('0x13')]);return _0xfa46a3(_0x3ceabe['error']['message']);}else{logger[_0x1b51('0xc')](_0x1b51('0xd'),_0x43c14c,'request\x20sent');_0xfa46a3(_0x3ceabe[_0x1b51('0x14')][_0x1b51('0x13')]);}})[_0x1b51('0x15')](function(_0x4ea5e3){logger[_0x1b51('0x11')](_0x1b51('0xd'),_0x43c14c,_0x4ea5e3);_0x1690c9(_0x4ea5e3);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 238a52a..5e12cf3 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(_0x59145a,_0x1f60f1){var _0xf04d7=function(_0x247581){while(--_0x247581){_0x59145a['push'](_0x59145a['shift']());}};_0xf04d7(++_0x1f60f1);}(_0x1261,0x144));var _0x1126=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x1261[_0x32b79a];return _0x483450;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5daaa1,_0x545454){_0x5daaa1=_0x5daaa1-0x0;var _0x4b40a1=_0x5f2f[_0x5daaa1];return _0x4b40a1;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 37deb5f..f507311 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 _0x913c=['name','STRING','exports'];(function(_0x35cf09,_0x5e86eb){var _0x3063f8=function(_0x55187a){while(--_0x55187a){_0x35cf09['push'](_0x35cf09['shift']());}};_0x3063f8(++_0x5e86eb);}(_0x913c,0x1a0));var _0xc913=function(_0x4c1cbc,_0x2219c5){_0x4c1cbc=_0x4c1cbc-0x0;var _0x27dc70=_0x913c[_0x4c1cbc];return _0x27dc70;};'use strict';var Sequelize=require('sequelize');module[_0xc913('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc913('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc913('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xc913('0x2')]},'phone':{'type':Sequelize[_0xc913('0x2')]},'fax':{'type':Sequelize[_0xc913('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc913('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc913('0x2')]},'country':{'type':Sequelize[_0xc913('0x2')]},'email':{'type':Sequelize[_0xc913('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc913('0x2')]},'sStreet':{'type':Sequelize[_0xc913('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xc913('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae6d=['STRING','name'];(function(_0x475741,_0x30bf38){var _0x4e34ec=function(_0x2e91c9){while(--_0x2e91c9){_0x475741['push'](_0x475741['shift']());}};_0x4e34ec(++_0x30bf38);}(_0xae6d,0xdc));var _0xdae6=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0xae6d[_0x3df822];return _0x4e457d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdae6('0x0')],'unique':_0xdae6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xdae6('0x0')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xdae6('0x0')]},'type':{'type':Sequelize[_0xdae6('0x0')]},'street':{'type':Sequelize[_0xdae6('0x0')]},'postalCode':{'type':Sequelize[_0xdae6('0x0')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xdae6('0x0')]},'email':{'type':Sequelize[_0xdae6('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xdae6('0x0')]},'sPostalCode':{'type':Sequelize[_0xdae6('0x0')]},'sCity':{'type':Sequelize[_0xdae6('0x0')]},'sCountry':{'type':Sequelize[_0xdae6('0x0')]},'description':{'type':Sequelize[_0xdae6('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9832d1a..6b58f8a 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 _0xccb9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2e6dc4,_0x502af5){var _0x3889cb=function(_0x5926cf){while(--_0x5926cf){_0x2e6dc4['push'](_0x2e6dc4['shift']());}};_0x3889cb(++_0x502af5);}(_0xccb9,0x1f0));var _0x9ccb=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xccb9[_0x5e6cb8];return _0x3faeb3;};'use strict';var emlformat=require(_0x9ccb('0x0'));var rimraf=require(_0x9ccb('0x1'));var zipdir=require(_0x9ccb('0x2'));var jsonpatch=require(_0x9ccb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ccb('0x4'));var Mustache=require(_0x9ccb('0x5'));var util=require(_0x9ccb('0x6'));var path=require(_0x9ccb('0x7'));var sox=require(_0x9ccb('0x8'));var csv=require('to-csv');var ejs=require(_0x9ccb('0x9'));var fs=require('fs');var fs_extra=require(_0x9ccb('0xa'));var _=require(_0x9ccb('0xb'));var squel=require(_0x9ccb('0xc'));var crypto=require(_0x9ccb('0xd'));var jsforce=require(_0x9ccb('0xe'));var deskjs=require(_0x9ccb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9ccb('0x10'));var Papa=require(_0x9ccb('0x11'));var Redis=require(_0x9ccb('0x12'));var authService=require(_0x9ccb('0x13'));var qs=require(_0x9ccb('0x14'));var as=require(_0x9ccb('0x15'));var hardwareService=require(_0x9ccb('0x16'));var logger=require('../../config/logger')(_0x9ccb('0x17'));var utils=require('../../config/utils');var config=require(_0x9ccb('0x18'));var licenseUtil=require(_0x9ccb('0x19'));var db=require(_0x9ccb('0x1a'))['db'];function respondWithStatusCode(_0x3110ed,_0x1ddef9){_0x1ddef9=_0x1ddef9||0xcc;return function(_0x206a01){if(_0x206a01){return _0x3110ed[_0x9ccb('0x1b')](_0x1ddef9);}return _0x3110ed[_0x9ccb('0x1c')](_0x1ddef9)['end']();};}function respondWithResult(_0x585751,_0x3317dd){_0x3317dd=_0x3317dd||0xc8;return function(_0x2e73cb){if(_0x2e73cb){return _0x585751[_0x9ccb('0x1c')](_0x3317dd)['json'](_0x2e73cb);}};}function respondWithFilteredResult(_0x5aa0f5,_0x218acc){return function(_0x4d03e4){if(_0x4d03e4){var _0xc39172=typeof _0x218acc[_0x9ccb('0x1d')]===_0x9ccb('0x1e')&&typeof _0x218acc[_0x9ccb('0x1f')]===_0x9ccb('0x1e');var _0x8c55b0=_0x4d03e4['count'];var _0x1f65e0=_0xc39172?0x0:_0x218acc[_0x9ccb('0x1d')];var _0x7d49c7=_0xc39172?_0x4d03e4[_0x9ccb('0x20')]:_0x218acc[_0x9ccb('0x1d')]+_0x218acc[_0x9ccb('0x1f')];var _0x577bc2;if(_0x7d49c7>=_0x8c55b0){_0x7d49c7=_0x8c55b0;_0x577bc2=0xc8;}else{_0x577bc2=0xce;}_0x5aa0f5[_0x9ccb('0x1c')](_0x577bc2);return _0x5aa0f5[_0x9ccb('0x21')]('Content-Range',_0x1f65e0+'-'+_0x7d49c7+'/'+_0x8c55b0)['json'](_0x4d03e4);}return null;};}function patchUpdates(_0x579d58){return function(_0x25bfda){try{jsonpatch[_0x9ccb('0x22')](_0x25bfda,_0x579d58,!![]);}catch(_0x1468c8){return BPromise['reject'](_0x1468c8);}return _0x25bfda[_0x9ccb('0x23')]();};}function saveUpdates(_0xdee7f6,_0x278579){return function(_0x5cd3b1){if(_0x5cd3b1){return _0x5cd3b1[_0x9ccb('0x24')](_0xdee7f6)[_0x9ccb('0x25')](function(_0x11db26){return _0x11db26;});}return null;};}function removeEntity(_0x31bbc6,_0x51d89a){return function(_0x46929e){if(_0x46929e){return _0x46929e[_0x9ccb('0x26')]()['then'](function(){var _0x47ae1a=_0x46929e[_0x9ccb('0x27')]({'plain':!![]});var _0x4146c3=_0x9ccb('0x28');return db[_0x9ccb('0x29')][_0x9ccb('0x26')]({'where':{'type':_0x4146c3,'resourceId':_0x47ae1a['id']}})['then'](function(){return _0x46929e;});})[_0x9ccb('0x25')](function(){_0x31bbc6[_0x9ccb('0x1c')](0xcc)[_0x9ccb('0x2a')]();});}};}function handleEntityNotFound(_0x164858,_0x374e64){return function(_0x444580){if(!_0x444580){_0x164858[_0x9ccb('0x1b')](0x194);}return _0x444580;};}function handleError(_0x1311c7,_0x1adc61){_0x1adc61=_0x1adc61||0x1f4;return function(_0x6e8d7d){logger[_0x9ccb('0x2b')](_0x6e8d7d['stack']);if(_0x6e8d7d[_0x9ccb('0x2c')]){delete _0x6e8d7d[_0x9ccb('0x2c')];}_0x1311c7[_0x9ccb('0x1c')](_0x1adc61)[_0x9ccb('0x2d')](_0x6e8d7d);};}exports[_0x9ccb('0x2e')]=function(_0x18fa5b,_0x46bcf4){var _0x1040d7={},_0x2b9ac9={},_0x26a9c5={'count':0x0,'rows':[]};return db[_0x9ccb('0x2f')]['describe']()[_0x9ccb('0x25')](function(_0x30494a){_0x2b9ac9[_0x9ccb('0x30')]=_[_0x9ccb('0x31')](_0x30494a);_0x2b9ac9[_0x9ccb('0x32')]=_['keys'](_0x18fa5b[_0x9ccb('0x32')]);_0x2b9ac9[_0x9ccb('0x33')]=_['intersection'](_0x2b9ac9[_0x9ccb('0x30')],_0x2b9ac9['query']);_0x1040d7['attributes']=_[_0x9ccb('0x34')](_0x2b9ac9[_0x9ccb('0x30')],qs['fields'](_0x18fa5b['query'][_0x9ccb('0x35')]));_0x1040d7[_0x9ccb('0x36')]=_0x1040d7[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x1040d7[_0x9ccb('0x36')]:_0x2b9ac9['model'];if(!_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x38')](_0x9ccb('0x39'))){_0x1040d7[_0x9ccb('0x1f')]=qs[_0x9ccb('0x1f')](_0x18fa5b['query']['limit']);_0x1040d7[_0x9ccb('0x1d')]=qs['offset'](_0x18fa5b['query'][_0x9ccb('0x1d')]);}_0x1040d7[_0x9ccb('0x3a')]=qs[_0x9ccb('0x3b')](_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3b')]);_0x1040d7[_0x9ccb('0x3c')]=qs[_0x9ccb('0x33')](_[_0x9ccb('0x3d')](_0x18fa5b[_0x9ccb('0x32')],_0x2b9ac9[_0x9ccb('0x33')]),_0x30494a);if(_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3e')]){_0x1040d7['where']=_[_0x9ccb('0x3f')](_0x1040d7[_0x9ccb('0x3c')],{'$or':_[_0x9ccb('0x40')](_0x1040d7[_0x9ccb('0x36')],function(_0x494b5b){var _0xcfe3cf={};_0xcfe3cf[_0x494b5b]={'$like':'%'+_0x18fa5b[_0x9ccb('0x32')][_0x9ccb('0x3e')]+'%'};return _0xcfe3cf;})});}_0x1040d7=_[_0x9ccb('0x3f')]({},_0x1040d7,_0x18fa5b[_0x9ccb('0x41')]);var _0x1c538a={'where':_0x1040d7[_0x9ccb('0x3c')]};return db[_0x9ccb('0x2f')][_0x9ccb('0x20')](_0x1c538a)[_0x9ccb('0x25')](function(_0x2f3979){_0x26a9c5[_0x9ccb('0x20')]=_0x2f3979;if(_0x18fa5b['query'][_0x9ccb('0x42')]){_0x1040d7['include']=[{'all':!![]}];}return db[_0x9ccb('0x2f')][_0x9ccb('0x43')](_0x1040d7);})['then'](function(_0x49a5eb){_0x26a9c5['rows']=_0x49a5eb;return _0x26a9c5;})[_0x9ccb('0x25')](respondWithFilteredResult(_0x46bcf4,_0x1040d7))[_0x9ccb('0x44')](handleError(_0x46bcf4,null));})[_0x9ccb('0x44')](handleError(_0x46bcf4,null));};exports[_0x9ccb('0x45')]=function(_0x1beb59,_0x441a7b){var _0x24ce66={'raw':![],'where':{'id':_0x1beb59[_0x9ccb('0x46')]['id']}},_0x5e4fbb={};_0x5e4fbb['model']=_[_0x9ccb('0x31')](db[_0x9ccb('0x2f')][_0x9ccb('0x47')]);_0x5e4fbb[_0x9ccb('0x32')]=_[_0x9ccb('0x31')](_0x1beb59[_0x9ccb('0x32')]);_0x5e4fbb[_0x9ccb('0x33')]=_[_0x9ccb('0x34')](_0x5e4fbb[_0x9ccb('0x30')],_0x5e4fbb[_0x9ccb('0x32')]);_0x24ce66['attributes']=_[_0x9ccb('0x34')](_0x5e4fbb[_0x9ccb('0x30')],qs['fields'](_0x1beb59[_0x9ccb('0x32')][_0x9ccb('0x35')]));_0x24ce66[_0x9ccb('0x36')]=_0x24ce66[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x24ce66['attributes']:_0x5e4fbb[_0x9ccb('0x30')];if(_0x1beb59[_0x9ccb('0x32')][_0x9ccb('0x42')]){_0x24ce66['include']=[{'all':!![]}];}_0x24ce66=_['merge']({},_0x24ce66,_0x1beb59['options']);return db[_0x9ccb('0x2f')][_0x9ccb('0x48')](_0x24ce66)[_0x9ccb('0x25')](handleEntityNotFound(_0x441a7b,null))['then'](respondWithResult(_0x441a7b,null))[_0x9ccb('0x44')](handleError(_0x441a7b,null));};exports[_0x9ccb('0x49')]=function(_0x37438a,_0x402358){return db['CmCompany']['create'](_0x37438a[_0x9ccb('0x4a')],{})['then'](function(_0x5537bc){var _0x244b6a=_0x37438a[_0x9ccb('0x4b')][_0x9ccb('0x27')]({'plain':!![]});if(!_0x244b6a)throw new Error(_0x9ccb('0x4c'));if(_0x244b6a[_0x9ccb('0x4d')]===_0x9ccb('0x4b')){var _0x5e1e22=_0x5537bc[_0x9ccb('0x27')]({'plain':!![]});var _0x117475=_0x9ccb('0x28');return db[_0x9ccb('0x4e')][_0x9ccb('0x48')]({'where':{'name':_0x117475,'userProfileId':_0x244b6a[_0x9ccb('0x4f')]},'raw':!![]})['then'](function(_0x24e0ce){if(_0x24e0ce&&_0x24e0ce['autoAssociation']===0x0){return db[_0x9ccb('0x29')][_0x9ccb('0x49')]({'name':_0x5e1e22[_0x9ccb('0x2c')],'resourceId':_0x5e1e22['id'],'type':_0x24e0ce[_0x9ccb('0x2c')],'sectionId':_0x24e0ce['id']},{})[_0x9ccb('0x25')](function(){return _0x5537bc;});}else{return _0x5537bc;}})[_0x9ccb('0x44')](function(_0x442041){logger['error'](_0x9ccb('0x50'),_0x442041);throw _0x442041;});}return _0x5537bc;})[_0x9ccb('0x25')](respondWithResult(_0x402358,0xc9))['catch'](handleError(_0x402358,null));};exports['update']=function(_0x2be60d,_0x3a6348){if(_0x2be60d[_0x9ccb('0x4a')]['id']){delete _0x2be60d[_0x9ccb('0x4a')]['id'];}return db[_0x9ccb('0x2f')][_0x9ccb('0x48')]({'where':{'id':_0x2be60d[_0x9ccb('0x46')]['id']}})[_0x9ccb('0x25')](handleEntityNotFound(_0x3a6348,null))['then'](saveUpdates(_0x2be60d[_0x9ccb('0x4a')],null))[_0x9ccb('0x25')](respondWithResult(_0x3a6348,null))[_0x9ccb('0x44')](handleError(_0x3a6348,null));};exports[_0x9ccb('0x26')]=function(_0x2d09ef,_0x5032c0){return db[_0x9ccb('0x2f')]['find']({'where':{'id':_0x2d09ef['params']['id']}})['then'](handleEntityNotFound(_0x5032c0,null))[_0x9ccb('0x25')](removeEntity(_0x5032c0,null))['catch'](handleError(_0x5032c0,null));};exports['describe']=function(_0x2719ed,_0x132b28){return db[_0x9ccb('0x2f')]['describe']()[_0x9ccb('0x25')](respondWithResult(_0x132b28,null))[_0x9ccb('0x44')](handleError(_0x132b28,null));};exports[_0x9ccb('0x51')]=function(_0x186ad5,_0x394965,_0x2d69bc){return db[_0x9ccb('0x52')]['find']({'where':{'id':_0x186ad5['params']['id']}})['then'](handleEntityNotFound(_0x394965,null))[_0x9ccb('0x25')](function(_0x1b1a28){if(_0x1b1a28){return _0x1b1a28[_0x9ccb('0x51')](_0x186ad5[_0x9ccb('0x4a')][_0x9ccb('0x53')],_[_0x9ccb('0x54')](_0x186ad5[_0x9ccb('0x4a')],['ids','id'])||{});}})[_0x9ccb('0x25')](respondWithResult(_0x394965,null))[_0x9ccb('0x44')](handleError(_0x394965,null));};exports['getContacts']=function(_0x4cfe75,_0x32d0b3,_0x2d30f6){var _0x7a5c53={};var _0x5619a4={};var _0x427b8c;var _0x1dfe1a;return db[_0x9ccb('0x2f')]['findOne']({'where':{'id':_0x4cfe75[_0x9ccb('0x46')]['id']}})[_0x9ccb('0x25')](handleEntityNotFound(_0x32d0b3,null))[_0x9ccb('0x25')](function(_0x27df7d){if(_0x27df7d){_0x427b8c=_0x27df7d;_0x5619a4['model']=_[_0x9ccb('0x31')](db[_0x9ccb('0x52')][_0x9ccb('0x47')]);_0x5619a4['query']=_[_0x9ccb('0x31')](_0x4cfe75['query']);_0x5619a4['filters']=_[_0x9ccb('0x34')](_0x5619a4[_0x9ccb('0x30')],_0x5619a4[_0x9ccb('0x32')]);_0x7a5c53[_0x9ccb('0x36')]=_[_0x9ccb('0x34')](_0x5619a4[_0x9ccb('0x30')],qs['fields'](_0x4cfe75['query'][_0x9ccb('0x35')]));_0x7a5c53['attributes']=_0x7a5c53[_0x9ccb('0x36')][_0x9ccb('0x37')]?_0x7a5c53[_0x9ccb('0x36')]:_0x5619a4[_0x9ccb('0x30')];_0x7a5c53[_0x9ccb('0x3a')]=qs[_0x9ccb('0x3b')](_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3b')]);_0x7a5c53['where']=qs['filters'](_['pick'](_0x4cfe75[_0x9ccb('0x32')],_0x5619a4[_0x9ccb('0x33')]));if(_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3e')]){_0x7a5c53[_0x9ccb('0x3c')]=_[_0x9ccb('0x3f')](_0x7a5c53[_0x9ccb('0x3c')],{'$or':_[_0x9ccb('0x40')](_0x7a5c53['attributes'],function(_0x260c3e){var _0x46969b={};_0x46969b[_0x260c3e]={'$like':'%'+_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x3e')]+'%'};return _0x46969b;})});}_0x7a5c53=_[_0x9ccb('0x3f')]({},_0x7a5c53,_0x4cfe75[_0x9ccb('0x41')]);return _0x427b8c[_0x9ccb('0x55')](_0x7a5c53);}})[_0x9ccb('0x25')](function(_0x1be4f1){if(_0x1be4f1){_0x1dfe1a=_0x1be4f1['length'];if(!_0x4cfe75[_0x9ccb('0x32')][_0x9ccb('0x38')]('nolimit')){_0x7a5c53[_0x9ccb('0x1f')]=qs['limit'](_0x4cfe75[_0x9ccb('0x32')]['limit']);_0x7a5c53['offset']=qs['offset'](_0x4cfe75[_0x9ccb('0x32')]['offset']);}return _0x427b8c[_0x9ccb('0x55')](_0x7a5c53);}})[_0x9ccb('0x25')](function(_0x3cee1d){if(_0x3cee1d){return _0x3cee1d?{'count':_0x1dfe1a,'rows':_0x3cee1d}:null;}})['then'](respondWithResult(_0x32d0b3,null))[_0x9ccb('0x44')](handleError(_0x32d0b3,null));}; \ No newline at end of file +var _0x791c=['status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','describe','model','query','filters','intersection','fields','attributes','hasOwnProperty','offset','order','sort','pick','filter','where','merge','map','options','CmCompany','include','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x162f4b,_0x31b569){var _0x57b00b=function(_0xef34c9){while(--_0xef34c9){_0x162f4b['push'](_0x162f4b['shift']());}};_0x57b00b(++_0x31b569);}(_0x791c,0x1aa));var _0xc791=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x791c[_0x561f25];return _0x150e4c;};'use strict';var emlformat=require(_0xc791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc791('0x1'));var jsonpatch=require(_0xc791('0x2'));var rp=require(_0xc791('0x3'));var moment=require(_0xc791('0x4'));var BPromise=require(_0xc791('0x5'));var Mustache=require(_0xc791('0x6'));var util=require(_0xc791('0x7'));var path=require(_0xc791('0x8'));var sox=require(_0xc791('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc791('0xa'));var squel=require(_0xc791('0xb'));var crypto=require('crypto');var jsforce=require(_0xc791('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc791('0xd'));var querystring=require(_0xc791('0xe'));var Papa=require(_0xc791('0xf'));var Redis=require(_0xc791('0x10'));var authService=require(_0xc791('0x11'));var qs=require(_0xc791('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc791('0x13'));var logger=require('../../config/logger')(_0xc791('0x14'));var utils=require(_0xc791('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc791('0x16'));var db=require(_0xc791('0x17'))['db'];function respondWithStatusCode(_0x1a8028,_0x41be1a){_0x41be1a=_0x41be1a||0xcc;return function(_0x58a16b){if(_0x58a16b){return _0x1a8028['sendStatus'](_0x41be1a);}return _0x1a8028[_0xc791('0x18')](_0x41be1a)[_0xc791('0x19')]();};}function respondWithResult(_0x4c3d94,_0x2931fc){_0x2931fc=_0x2931fc||0xc8;return function(_0x234187){if(_0x234187){return _0x4c3d94[_0xc791('0x18')](_0x2931fc)[_0xc791('0x1a')](_0x234187);}};}function respondWithFilteredResult(_0x735354,_0x4a227a){return function(_0x575510){if(_0x575510){var _0x475aec=typeof _0x4a227a['offset']===_0xc791('0x1b')&&typeof _0x4a227a[_0xc791('0x1c')]==='undefined';var _0xefda2a=_0x575510[_0xc791('0x1d')];var _0x11bf47=_0x475aec?0x0:_0x4a227a['offset'];var _0x17ebda=_0x475aec?_0x575510[_0xc791('0x1d')]:_0x4a227a['offset']+_0x4a227a[_0xc791('0x1c')];var _0x52f510;if(_0x17ebda>=_0xefda2a){_0x17ebda=_0xefda2a;_0x52f510=0xc8;}else{_0x52f510=0xce;}_0x735354[_0xc791('0x18')](_0x52f510);return _0x735354[_0xc791('0x1e')](_0xc791('0x1f'),_0x11bf47+'-'+_0x17ebda+'/'+_0xefda2a)['json'](_0x575510);}return null;};}function patchUpdates(_0x18bfe2){return function(_0x513c69){try{jsonpatch[_0xc791('0x20')](_0x513c69,_0x18bfe2,!![]);}catch(_0x2a2f25){return BPromise[_0xc791('0x21')](_0x2a2f25);}return _0x513c69[_0xc791('0x22')]();};}function saveUpdates(_0x5b7070,_0x5e18c4){return function(_0x33963a){if(_0x33963a){return _0x33963a[_0xc791('0x23')](_0x5b7070)[_0xc791('0x24')](function(_0x35167e){return _0x35167e;});}return null;};}function removeEntity(_0x55d817,_0x71cd2e){return function(_0x5cf270){if(_0x5cf270){return _0x5cf270[_0xc791('0x25')]()[_0xc791('0x24')](function(){var _0x1f7246=_0x5cf270[_0xc791('0x26')]({'plain':!![]});var _0x3012eb=_0xc791('0x27');return db[_0xc791('0x28')][_0xc791('0x25')]({'where':{'type':_0x3012eb,'resourceId':_0x1f7246['id']}})[_0xc791('0x24')](function(){return _0x5cf270;});})[_0xc791('0x24')](function(){_0x55d817[_0xc791('0x18')](0xcc)[_0xc791('0x19')]();});}};}function handleEntityNotFound(_0x2d6e1b,_0x14108b){return function(_0x5ad8ee){if(!_0x5ad8ee){_0x2d6e1b[_0xc791('0x29')](0x194);}return _0x5ad8ee;};}function handleError(_0x315d12,_0x3c02ef){_0x3c02ef=_0x3c02ef||0x1f4;return function(_0x5a2ba2){logger['error'](_0x5a2ba2[_0xc791('0x2a')]);if(_0x5a2ba2[_0xc791('0x2b')]){delete _0x5a2ba2[_0xc791('0x2b')];}_0x315d12[_0xc791('0x18')](_0x3c02ef)[_0xc791('0x2c')](_0x5a2ba2);};}exports[_0xc791('0x2d')]=function(_0x3197d8,_0x3adf4e){var _0x1c9880={},_0x162ccc={},_0x2939e8={'count':0x0,'rows':[]};return db['CmCompany'][_0xc791('0x2e')]()['then'](function(_0x15b134){_0x162ccc[_0xc791('0x2f')]=_['keys'](_0x15b134);_0x162ccc[_0xc791('0x30')]=_['keys'](_0x3197d8['query']);_0x162ccc[_0xc791('0x31')]=_[_0xc791('0x32')](_0x162ccc['model'],_0x162ccc[_0xc791('0x30')]);_0x1c9880['attributes']=_[_0xc791('0x32')](_0x162ccc['model'],qs[_0xc791('0x33')](_0x3197d8[_0xc791('0x30')][_0xc791('0x33')]));_0x1c9880[_0xc791('0x34')]=_0x1c9880['attributes']['length']?_0x1c9880[_0xc791('0x34')]:_0x162ccc[_0xc791('0x2f')];if(!_0x3197d8[_0xc791('0x30')][_0xc791('0x35')]('nolimit')){_0x1c9880[_0xc791('0x1c')]=qs['limit'](_0x3197d8[_0xc791('0x30')][_0xc791('0x1c')]);_0x1c9880['offset']=qs[_0xc791('0x36')](_0x3197d8[_0xc791('0x30')][_0xc791('0x36')]);}_0x1c9880[_0xc791('0x37')]=qs['sort'](_0x3197d8[_0xc791('0x30')][_0xc791('0x38')]);_0x1c9880['where']=qs[_0xc791('0x31')](_[_0xc791('0x39')](_0x3197d8[_0xc791('0x30')],_0x162ccc[_0xc791('0x31')]),_0x15b134);if(_0x3197d8[_0xc791('0x30')][_0xc791('0x3a')]){_0x1c9880[_0xc791('0x3b')]=_[_0xc791('0x3c')](_0x1c9880[_0xc791('0x3b')],{'$or':_[_0xc791('0x3d')](_0x1c9880[_0xc791('0x34')],function(_0x4e131f){var _0x3865dc={};_0x3865dc[_0x4e131f]={'$like':'%'+_0x3197d8[_0xc791('0x30')]['filter']+'%'};return _0x3865dc;})});}_0x1c9880=_['merge']({},_0x1c9880,_0x3197d8[_0xc791('0x3e')]);var _0xea170e={'where':_0x1c9880[_0xc791('0x3b')]};return db[_0xc791('0x3f')]['count'](_0xea170e)[_0xc791('0x24')](function(_0x46095e){_0x2939e8['count']=_0x46095e;if(_0x3197d8[_0xc791('0x30')]['includeAll']){_0x1c9880[_0xc791('0x40')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x1c9880);})[_0xc791('0x24')](function(_0x38bc83){_0x2939e8[_0xc791('0x41')]=_0x38bc83;return _0x2939e8;})['then'](respondWithFilteredResult(_0x3adf4e,_0x1c9880))[_0xc791('0x42')](handleError(_0x3adf4e,null));})['catch'](handleError(_0x3adf4e,null));};exports[_0xc791('0x43')]=function(_0x282a9a,_0x48d334){var _0x15f5d1={'raw':![],'where':{'id':_0x282a9a[_0xc791('0x44')]['id']}},_0x4236d4={};_0x4236d4[_0xc791('0x2f')]=_[_0xc791('0x45')](db[_0xc791('0x3f')][_0xc791('0x46')]);_0x4236d4[_0xc791('0x30')]=_[_0xc791('0x45')](_0x282a9a[_0xc791('0x30')]);_0x4236d4[_0xc791('0x31')]=_['intersection'](_0x4236d4['model'],_0x4236d4[_0xc791('0x30')]);_0x15f5d1['attributes']=_[_0xc791('0x32')](_0x4236d4[_0xc791('0x2f')],qs[_0xc791('0x33')](_0x282a9a['query'][_0xc791('0x33')]));_0x15f5d1[_0xc791('0x34')]=_0x15f5d1[_0xc791('0x34')][_0xc791('0x47')]?_0x15f5d1['attributes']:_0x4236d4[_0xc791('0x2f')];if(_0x282a9a['query'][_0xc791('0x48')]){_0x15f5d1['include']=[{'all':!![]}];}_0x15f5d1=_[_0xc791('0x3c')]({},_0x15f5d1,_0x282a9a['options']);return db[_0xc791('0x3f')][_0xc791('0x49')](_0x15f5d1)['then'](handleEntityNotFound(_0x48d334,null))[_0xc791('0x24')](respondWithResult(_0x48d334,null))[_0xc791('0x42')](handleError(_0x48d334,null));};exports[_0xc791('0x4a')]=function(_0x269ee4,_0xa97d3){return db['CmCompany']['create'](_0x269ee4[_0xc791('0x4b')],{})[_0xc791('0x24')](function(_0x344151){var _0x1ca119=_0x269ee4[_0xc791('0x4c')][_0xc791('0x26')]({'plain':!![]});if(!_0x1ca119)throw new Error(_0xc791('0x4d'));if(_0x1ca119[_0xc791('0x4e')]==='user'){var _0x30cd55=_0x344151[_0xc791('0x26')]({'plain':!![]});var _0x3a4245='Companies';return db[_0xc791('0x4f')][_0xc791('0x49')]({'where':{'name':_0x3a4245,'userProfileId':_0x1ca119[_0xc791('0x50')]},'raw':!![]})[_0xc791('0x24')](function(_0x26bbcd){if(_0x26bbcd&&_0x26bbcd[_0xc791('0x51')]===0x0){return db[_0xc791('0x28')][_0xc791('0x4a')]({'name':_0x30cd55[_0xc791('0x2b')],'resourceId':_0x30cd55['id'],'type':_0x26bbcd[_0xc791('0x2b')],'sectionId':_0x26bbcd['id']},{})[_0xc791('0x24')](function(){return _0x344151;});}else{return _0x344151;}})['catch'](function(_0x407ff3){logger[_0xc791('0x52')](_0xc791('0x53'),_0x407ff3);throw _0x407ff3;});}return _0x344151;})[_0xc791('0x24')](respondWithResult(_0xa97d3,0xc9))[_0xc791('0x42')](handleError(_0xa97d3,null));};exports['update']=function(_0x3b69f3,_0x1aa074){if(_0x3b69f3[_0xc791('0x4b')]['id']){delete _0x3b69f3['body']['id'];}return db[_0xc791('0x3f')][_0xc791('0x49')]({'where':{'id':_0x3b69f3[_0xc791('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aa074,null))[_0xc791('0x24')](saveUpdates(_0x3b69f3[_0xc791('0x4b')],null))[_0xc791('0x24')](respondWithResult(_0x1aa074,null))['catch'](handleError(_0x1aa074,null));};exports[_0xc791('0x25')]=function(_0x3dcecc,_0x2021c3){return db[_0xc791('0x3f')][_0xc791('0x49')]({'where':{'id':_0x3dcecc[_0xc791('0x44')]['id']}})[_0xc791('0x24')](handleEntityNotFound(_0x2021c3,null))['then'](removeEntity(_0x2021c3,null))[_0xc791('0x42')](handleError(_0x2021c3,null));};exports[_0xc791('0x2e')]=function(_0x1a0aa5,_0x558591){return db[_0xc791('0x3f')]['describe']()[_0xc791('0x24')](respondWithResult(_0x558591,null))[_0xc791('0x42')](handleError(_0x558591,null));};exports[_0xc791('0x54')]=function(_0x286141,_0x33c948,_0xda62b2){return db['CmContact'][_0xc791('0x49')]({'where':{'id':_0x286141[_0xc791('0x44')]['id']}})[_0xc791('0x24')](handleEntityNotFound(_0x33c948,null))[_0xc791('0x24')](function(_0x5d77aa){if(_0x5d77aa){return _0x5d77aa[_0xc791('0x54')](_0x286141[_0xc791('0x4b')][_0xc791('0x55')],_[_0xc791('0x56')](_0x286141[_0xc791('0x4b')],['ids','id'])||{});}})[_0xc791('0x24')](respondWithResult(_0x33c948,null))[_0xc791('0x42')](handleError(_0x33c948,null));};exports[_0xc791('0x57')]=function(_0x41e5f8,_0x4cc8e1,_0x5a2481){var _0x5c3978={};var _0x5c0f38={};var _0x1f271b;var _0x4790e4;return db['CmCompany'][_0xc791('0x58')]({'where':{'id':_0x41e5f8[_0xc791('0x44')]['id']}})[_0xc791('0x24')](handleEntityNotFound(_0x4cc8e1,null))[_0xc791('0x24')](function(_0x3aa13e){if(_0x3aa13e){_0x1f271b=_0x3aa13e;_0x5c0f38[_0xc791('0x2f')]=_[_0xc791('0x45')](db[_0xc791('0x59')][_0xc791('0x46')]);_0x5c0f38[_0xc791('0x30')]=_[_0xc791('0x45')](_0x41e5f8[_0xc791('0x30')]);_0x5c0f38[_0xc791('0x31')]=_['intersection'](_0x5c0f38[_0xc791('0x2f')],_0x5c0f38[_0xc791('0x30')]);_0x5c3978['attributes']=_[_0xc791('0x32')](_0x5c0f38[_0xc791('0x2f')],qs[_0xc791('0x33')](_0x41e5f8[_0xc791('0x30')][_0xc791('0x33')]));_0x5c3978[_0xc791('0x34')]=_0x5c3978[_0xc791('0x34')][_0xc791('0x47')]?_0x5c3978[_0xc791('0x34')]:_0x5c0f38[_0xc791('0x2f')];_0x5c3978[_0xc791('0x37')]=qs[_0xc791('0x38')](_0x41e5f8[_0xc791('0x30')][_0xc791('0x38')]);_0x5c3978[_0xc791('0x3b')]=qs[_0xc791('0x31')](_[_0xc791('0x39')](_0x41e5f8[_0xc791('0x30')],_0x5c0f38['filters']));if(_0x41e5f8[_0xc791('0x30')]['filter']){_0x5c3978['where']=_[_0xc791('0x3c')](_0x5c3978['where'],{'$or':_[_0xc791('0x3d')](_0x5c3978[_0xc791('0x34')],function(_0x5b9074){var _0x52ec03={};_0x52ec03[_0x5b9074]={'$like':'%'+_0x41e5f8[_0xc791('0x30')][_0xc791('0x3a')]+'%'};return _0x52ec03;})});}_0x5c3978=_[_0xc791('0x3c')]({},_0x5c3978,_0x41e5f8[_0xc791('0x3e')]);return _0x1f271b[_0xc791('0x57')](_0x5c3978);}})[_0xc791('0x24')](function(_0x3fa53d){if(_0x3fa53d){_0x4790e4=_0x3fa53d[_0xc791('0x47')];if(!_0x41e5f8[_0xc791('0x30')]['hasOwnProperty']('nolimit')){_0x5c3978[_0xc791('0x1c')]=qs[_0xc791('0x1c')](_0x41e5f8['query'][_0xc791('0x1c')]);_0x5c3978[_0xc791('0x36')]=qs[_0xc791('0x36')](_0x41e5f8[_0xc791('0x30')]['offset']);}return _0x1f271b[_0xc791('0x57')](_0x5c3978);}})['then'](function(_0x5053fb){if(_0x5053fb){return _0x5053fb?{'count':_0x4790e4,'rows':_0x5053fb}:null;}})[_0xc791('0x24')](respondWithResult(_0x4cc8e1,null))[_0xc791('0x42')](handleError(_0x4cc8e1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index dc22c22..ad4df53 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 _0xf769=['exports','define','CmCompany','util','api','bluebird','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x10f5e9,_0x68f062){var _0x552cc1=function(_0x35da1e){while(--_0x35da1e){_0x10f5e9['push'](_0x10f5e9['shift']());}};_0x552cc1(++_0x68f062);}(_0xf769,0x147));var _0x9f76=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0xf769[_0xe0b81f];return _0x290e5e;};'use strict';var _=require('lodash');var util=require(_0x9f76('0x0'));var logger=require('../../config/logger')(_0x9f76('0x1'));var moment=require('moment');var BPromise=require(_0x9f76('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f76('0x3'));var config=require(_0x9f76('0x4'));var attributes=require(_0x9f76('0x5'));module[_0x9f76('0x6')]=function(_0x3c3e8f,_0x38f8c6){return _0x3c3e8f[_0x9f76('0x7')](_0x9f76('0x8'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b1=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash'];(function(_0x3bac6c,_0x54f9b7){var _0x242365=function(_0x10ccaa){while(--_0x10ccaa){_0x3bac6c['push'](_0x3bac6c['shift']());}};_0x242365(++_0x54f9b7);}(_0x80b1,0x173));var _0x180b=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0x80b1[_0x19a90e];return _0xa49b11;};'use strict';var _=require(_0x180b('0x0'));var util=require('util');var logger=require(_0x180b('0x1'))('api');var moment=require(_0x180b('0x2'));var BPromise=require(_0x180b('0x3'));var rp=require(_0x180b('0x4'));var fs=require('fs');var path=require(_0x180b('0x5'));var rimraf=require(_0x180b('0x6'));var config=require('../../config/environment');var attributes=require(_0x180b('0x7'));module[_0x180b('0x8')]=function(_0x5d46e0,_0x4d5bff){return _0x5d46e0[_0x180b('0x9')](_0x180b('0xa'),attributes,{'tableName':_0x180b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index d1bc846..498f9cd 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 _0xcd31=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x562c98,_0x59211c){var _0x43f4c6=function(_0xc27258){while(--_0xc27258){_0x562c98['push'](_0x562c98['shift']());}};_0x43f4c6(++_0x59211c);}(_0xcd31,0x119));var _0x1cd3=function(_0x4e1a60,_0x233ed1){_0x4e1a60=_0x4e1a60-0x0;var _0x19277a=_0xcd31[_0x4e1a60];return _0x19277a;};'use strict';var _=require('lodash');var util=require(_0x1cd3('0x0'));var moment=require(_0x1cd3('0x1'));var BPromise=require(_0x1cd3('0x2'));var rs=require(_0x1cd3('0x3'));var fs=require('fs');var Redis=require(_0x1cd3('0x4'));var db=require(_0x1cd3('0x5'))['db'];var utils=require(_0x1cd3('0x6'));var logger=require(_0x1cd3('0x7'))(_0x1cd3('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cd3('0x9'));var client=jayson[_0x1cd3('0xa')][_0x1cd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2035d1,_0x59a5ae,_0x5e12bb){return new BPromise(function(_0xb40452,_0x2ee4a7){return client[_0x1cd3('0xc')](_0x2035d1,_0x5e12bb)['then'](function(_0x3f993c){logger[_0x1cd3('0xd')](_0x1cd3('0xe'),_0x59a5ae,_0x1cd3('0xf'));logger[_0x1cd3('0x10')](_0x1cd3('0x11'),_0x59a5ae,'request\x20sent',JSON[_0x1cd3('0x12')](_0x3f993c));if(_0x3f993c[_0x1cd3('0x13')]){if(_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x14')]===0x1f4){logger[_0x1cd3('0x13')]('CmCompany,\x20%s,\x20%s',_0x59a5ae,_0x3f993c['error']['message']);return _0x2ee4a7(_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x15')]);}logger[_0x1cd3('0x13')](_0x1cd3('0xe'),_0x59a5ae,_0x3f993c[_0x1cd3('0x13')][_0x1cd3('0x15')]);return _0xb40452(_0x3f993c['error'][_0x1cd3('0x15')]);}else{logger[_0x1cd3('0xd')](_0x1cd3('0xe'),_0x59a5ae,_0x1cd3('0xf'));_0xb40452(_0x3f993c[_0x1cd3('0x16')][_0x1cd3('0x15')]);}})['catch'](function(_0x5d0a37){logger[_0x1cd3('0x13')](_0x1cd3('0xe'),_0x59a5ae,_0x5d0a37);_0x2ee4a7(_0x5d0a37);});});} \ No newline at end of file +var _0x953d=['debug','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s'];(function(_0x2bc05b,_0x3dffbd){var _0x5ef2eb=function(_0x15e58d){while(--_0x15e58d){_0x2bc05b['push'](_0x2bc05b['shift']());}};_0x5ef2eb(++_0x3dffbd);}(_0x953d,0x105));var _0xd953=function(_0x14a321,_0x4889d9){_0x14a321=_0x14a321-0x0;var _0x16dd89=_0x953d[_0x14a321];return _0x16dd89;};'use strict';var _=require(_0xd953('0x0'));var util=require(_0xd953('0x1'));var moment=require(_0xd953('0x2'));var BPromise=require(_0xd953('0x3'));var rs=require(_0xd953('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd953('0x5'))['db'];var utils=require(_0xd953('0x6'));var logger=require(_0xd953('0x7'))(_0xd953('0x8'));var config=require('../../config/environment');var jayson=require(_0xd953('0x9'));var client=jayson[_0xd953('0xa')][_0xd953('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x172c57,_0x3c14cb,_0x87f0f4){return new BPromise(function(_0x4e9ecb,_0x2f57f2){return client[_0xd953('0xc')](_0x172c57,_0x87f0f4)[_0xd953('0xd')](function(_0x5a71c2){logger['info'](_0xd953('0xe'),_0x3c14cb,'request\x20sent');logger[_0xd953('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3c14cb,_0xd953('0x10'),JSON[_0xd953('0x11')](_0x5a71c2));if(_0x5a71c2[_0xd953('0x12')]){if(_0x5a71c2[_0xd953('0x12')][_0xd953('0x13')]===0x1f4){logger[_0xd953('0x12')](_0xd953('0xe'),_0x3c14cb,_0x5a71c2[_0xd953('0x12')][_0xd953('0x14')]);return _0x2f57f2(_0x5a71c2['error'][_0xd953('0x14')]);}logger['error'](_0xd953('0xe'),_0x3c14cb,_0x5a71c2['error'][_0xd953('0x14')]);return _0x4e9ecb(_0x5a71c2[_0xd953('0x12')][_0xd953('0x14')]);}else{logger[_0xd953('0x15')](_0xd953('0xe'),_0x3c14cb,'request\x20sent');_0x4e9ecb(_0x5a71c2[_0xd953('0x16')]['message']);}})['catch'](function(_0x5f5c71){logger[_0xd953('0x12')]('CmCompany,\x20%s,\x20%s',_0x3c14cb,_0x5f5c71);_0x2f57f2(_0x5f5c71);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4220072..42a5108 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 _0xd38e=['getContacts','post','create','put','update','delete','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe','show','/:id/contacts'];(function(_0x2ba701,_0x7da377){var _0x5a4dd1=function(_0x1457ca){while(--_0x1457ca){_0x2ba701['push'](_0x2ba701['shift']());}};_0x5a4dd1(++_0x7da377);}(_0xd38e,0x17d));var _0xed38=function(_0x4ae1fe,_0x54d08e){_0x4ae1fe=_0x4ae1fe-0x0;var _0x2a45e9=_0xd38e[_0x4ae1fe];return _0x2a45e9;};'use strict';var multer=require(_0xed38('0x0'));var util=require('util');var path=require(_0xed38('0x1'));var timeout=require(_0xed38('0x2'));var express=require(_0xed38('0x3'));var router=express[_0xed38('0x4')]();var fs_extra=require(_0xed38('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed38('0x6'));var config=require(_0xed38('0x7'));var controller=require(_0xed38('0x8'));router['get']('/',auth[_0xed38('0x9')](),controller[_0xed38('0xa')]);router[_0xed38('0xb')]('/describe',auth[_0xed38('0x9')](),controller[_0xed38('0xc')]);router[_0xed38('0xb')]('/:id',auth[_0xed38('0x9')](),controller[_0xed38('0xd')]);router[_0xed38('0xb')](_0xed38('0xe'),auth['isAuthenticated'](),controller[_0xed38('0xf')]);router[_0xed38('0x10')]('/',auth[_0xed38('0x9')](),controller[_0xed38('0x11')]);router[_0xed38('0x10')](_0xed38('0xe'),auth['isAuthenticated'](),controller['addContacts']);router[_0xed38('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xed38('0x13')]);router[_0xed38('0x14')](_0xed38('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x516a=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','put','update','delete','exports','multer','util'];(function(_0x22074d,_0x33df85){var _0x3a24ce=function(_0x1dfb83){while(--_0x1dfb83){_0x22074d['push'](_0x22074d['shift']());}};_0x3a24ce(++_0x33df85);}(_0x516a,0x1d9));var _0xa516=function(_0xe6e3e2,_0x2b01da){_0xe6e3e2=_0xe6e3e2-0x0;var _0x126571=_0x516a[_0xe6e3e2];return _0x126571;};'use strict';var multer=require(_0xa516('0x0'));var util=require(_0xa516('0x1'));var path=require(_0xa516('0x2'));var timeout=require(_0xa516('0x3'));var express=require(_0xa516('0x4'));var router=express[_0xa516('0x5')]();var fs_extra=require(_0xa516('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa516('0x7'));var config=require(_0xa516('0x8'));var controller=require(_0xa516('0x9'));router[_0xa516('0xa')]('/',auth['isAuthenticated'](),controller[_0xa516('0xb')]);router[_0xa516('0xa')](_0xa516('0xc'),auth[_0xa516('0xd')](),controller[_0xa516('0xe')]);router[_0xa516('0xa')](_0xa516('0xf'),auth[_0xa516('0xd')](),controller[_0xa516('0x10')]);router[_0xa516('0xa')]('/:id/contacts',auth[_0xa516('0xd')](),controller[_0xa516('0x11')]);router[_0xa516('0x12')]('/',auth['isAuthenticated'](),controller[_0xa516('0x13')]);router[_0xa516('0x12')](_0xa516('0x14'),auth[_0xa516('0xd')](),controller['addContacts']);router[_0xa516('0x15')](_0xa516('0xf'),auth[_0xa516('0xd')](),controller[_0xa516('0x16')]);router[_0xa516('0x17')]('/:id',auth[_0xa516('0xd')](),controller['destroy']);module[_0xa516('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4f9ffb8..f1dcd00 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 _0xb5d5=['STRING','INTEGER','UNSIGNED','NOW','sequelize','exports'];(function(_0x3f67b4,_0xb0c4eb){var _0x4b10b4=function(_0x983ac5){while(--_0x983ac5){_0x3f67b4['push'](_0x3f67b4['shift']());}};_0x4b10b4(++_0xb0c4eb);}(_0xb5d5,0xd6));var _0x5b5d=function(_0x4ad38b,_0x2a7e44){_0x4ad38b=_0x4ad38b-0x0;var _0x53090e=_0xb5d5[_0x4ad38b];return _0x53090e;};'use strict';var _=require('lodash');var Sequelize=require(_0x5b5d('0x0'));module[_0x5b5d('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5b5d('0x2')]},'street':{'type':Sequelize[_0x5b5d('0x2')]},'postalCode':{'type':Sequelize[_0x5b5d('0x2')]},'city':{'type':Sequelize[_0x5b5d('0x2')]},'country':{'type':Sequelize[_0x5b5d('0x2')]},'dateOfBirth':{'type':Sequelize[_0x5b5d('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x5b5d('0x2')]},'mobile':{'type':Sequelize[_0x5b5d('0x2')]},'fax':{'type':Sequelize[_0x5b5d('0x2')]},'email':{'type':Sequelize[_0x5b5d('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5b5d('0x2')]},'fb_data':{'type':Sequelize[_0x5b5d('0x2')]},'twitter':{'type':Sequelize[_0x5b5d('0x2')]},'skype':{'type':Sequelize[_0x5b5d('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5b5d('0x2')]},'telegram':{'type':Sequelize[_0x5b5d('0x2')]},'UserId':{'type':Sequelize[_0x5b5d('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x5b5d('0x2')]},'priority':{'type':Sequelize[_0x5b5d('0x3')](0x2)[_0x5b5d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x5b5d('0x5')]},'dialTimezone':{'type':Sequelize[_0x5b5d('0x2')]},'utcOffset':{'type':Sequelize[_0x5b5d('0x3')]}}; \ No newline at end of file +var _0xbf67=['INTEGER','UNSIGNED','NOW','lodash','exports','STRING','TEXT'];(function(_0x6ef4ec,_0x1d73b0){var _0x2eb05b=function(_0x36ba4f){while(--_0x36ba4f){_0x6ef4ec['push'](_0x6ef4ec['shift']());}};_0x2eb05b(++_0x1d73b0);}(_0xbf67,0x1ca));var _0x7bf6=function(_0xc3ffb1,_0x2f1fcf){_0xc3ffb1=_0xc3ffb1-0x0;var _0x2f26ee=_0xbf67[_0xc3ffb1];return _0x2f26ee;};'use strict';var _=require(_0x7bf6('0x0'));var Sequelize=require('sequelize');module[_0x7bf6('0x1')]={'firstName':{'type':Sequelize[_0x7bf6('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x7bf6('0x2')]},'postalCode':{'type':Sequelize[_0x7bf6('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7bf6('0x2')]},'dateOfBirth':{'type':Sequelize[_0x7bf6('0x2')]},'description':{'type':Sequelize[_0x7bf6('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7bf6('0x2')]},'fax':{'type':Sequelize[_0x7bf6('0x2')]},'email':{'type':Sequelize[_0x7bf6('0x2')]},'url':{'type':Sequelize[_0x7bf6('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7bf6('0x2')]},'twitter':{'type':Sequelize[_0x7bf6('0x2')]},'skype':{'type':Sequelize[_0x7bf6('0x2')]},'teams':{'type':Sequelize[_0x7bf6('0x2')]},'viber':{'type':Sequelize[_0x7bf6('0x2')]},'line':{'type':Sequelize[_0x7bf6('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x7bf6('0x2')]},'UserId':{'type':Sequelize[_0x7bf6('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x7bf6('0x2')]},'priority':{'type':Sequelize[_0x7bf6('0x4')](0x2)[_0x7bf6('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x7bf6('0x6')]},'dialTimezone':{'type':Sequelize[_0x7bf6('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 89d5e05..002b8e6 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];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 respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];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 respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index a8eb912..ab6a36c 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 _0x06ed=['exports','events','../../mysqldb','CmContact','setMaxListeners','save','update','emit','hook'];(function(_0x37852c,_0x4e8d52){var _0x285236=function(_0x4c0387){while(--_0x4c0387){_0x37852c['push'](_0x37852c['shift']());}};_0x285236(++_0x4e8d52);}(_0x06ed,0x7f));var _0xd06e=function(_0x1464de,_0x2f58c4){_0x1464de=_0x1464de-0x0;var _0x595929=_0x06ed[_0x1464de];return _0x595929;};'use strict';var EventEmitter=require(_0xd06e('0x0'));var CmContact=require(_0xd06e('0x1'))['db'][_0xd06e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd06e('0x3')](0x0);var events={'afterCreate':_0xd06e('0x4'),'afterUpdate':_0xd06e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42573a){return function(_0x492ca5,_0x5dd1ba,_0x335bd4){CmContactEvents[_0xd06e('0x6')](_0x42573a+':'+_0x492ca5['id'],_0x492ca5);CmContactEvents[_0xd06e('0x6')](_0x42573a,_0x492ca5);_0x335bd4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xd06e('0x7')](e,emitEvent(event));}}module[_0xd06e('0x8')]=CmContactEvents; \ No newline at end of file +var _0x4830=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x216097,_0x7a31d5){var _0x15068e=function(_0xa675aa){while(--_0xa675aa){_0x216097['push'](_0x216097['shift']());}};_0x15068e(++_0x7a31d5);}(_0x4830,0x1cc));var _0x0483=function(_0x55dc42,_0xe806aa){_0x55dc42=_0x55dc42-0x0;var _0x22d7b3=_0x4830[_0x55dc42];return _0x22d7b3;};'use strict';var EventEmitter=require(_0x0483('0x0'));var CmContact=require(_0x0483('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0483('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0483('0x3')};function emitEvent(_0x2307e4){return function(_0x2cd6af,_0x59794b,_0x37af3f){CmContactEvents[_0x0483('0x4')](_0x2307e4+':'+_0x2cd6af['id'],_0x2cd6af);CmContactEvents[_0x0483('0x4')](_0x2307e4,_0x2cd6af);_0x37af3f(null);};}for(var e in events){if(events[_0x0483('0x5')](e)){var event=events[e];CmContact[_0x0483('0x6')](e,emitEvent(event));}}module[_0x0483('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 8afee68..c36f4f4 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 _0x025f=['utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','afterCreate','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','lastName','mobile','fax','FULLTEXT','utf8mb4','models','get','error','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','timezones'];(function(_0x4209e0,_0x4d97a5){var _0x431f53=function(_0x2d21e0){while(--_0x2d21e0){_0x4209e0['push'](_0x4209e0['shift']());}};_0x431f53(++_0x4d97a5);}(_0x025f,0x107));var _0xf025=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x025f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf025('0x0'));var util=require(_0xf025('0x1'));var logger=require(_0xf025('0x2'))('api');var moment=require(_0xf025('0x3'));var BPromise=require(_0xf025('0x4'));var rp=require(_0xf025('0x5'));var fs=require('fs');var path=require(_0xf025('0x6'));var rimraf=require(_0xf025('0x7'));var config=require('../../config/environment');var shared=require(_0xf025('0x8'));var attributes=require(_0xf025('0x9'));module[_0xf025('0xa')]=function(_0x83c12e,_0x56450c){return _0x83c12e[_0xf025('0xb')](_0xf025('0xc'),attributes,{'tableName':_0xf025('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xf025('0xe')]},{'name':'fti_cm_contacts','fields':['firstName',_0xf025('0xf'),_0xf025('0xe'),_0xf025('0x10'),_0xf025('0x11'),'email'],'type':_0xf025('0x12')}],'timestamps':!![],'charset':_0xf025('0x13'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xbe24,_0x4eca36,_0x271397){var _0x127c43=_0x83c12e[_0xf025('0x14')];var _0x51025f=_0xbe24[_0xf025('0x15')]({'plain':!![]});function _0x443010(){return function(_0x1c031c){logger[_0xf025('0x16')]('cmContact','afterCreate',util['inspect'](_0x1c031c,{'showHidden':![],'depth':null}));};}function _0x1d0445(_0x446f87,_0x15b367){var _0x2d5d5f=_0x15b367[_0xf025('0x17')]?_0x15b367['scheduledat']:moment()[_0xf025('0x18')](_0xf025('0x19'));return new BPromise(function(_0x21eada,_0x48a1fe){if(_[_0xf025('0x1a')](_0x15b367[_0xf025('0x1b')])){_0x21eada({'ret':_0x2d5d5f});}else{_0x127c43['VoiceQueue']['findOne']({'where':{'id':_0x446f87['id']}})['then'](function(_0x2cd646){if(!_[_0xf025('0x1a')](_0x2cd646)){var _0x5aebc4=_0x2cd646['dialTimezone'];if(!_[_0xf025('0x1a')](_0x5aebc4)){var _0x4af80e=shared[_0xf025('0x1c')];var _0xf54592=_0x4af80e[_0x5aebc4];var _0x4d7368=_0x4af80e[_0x15b367['dialTimezone']];if(!_[_0xf025('0x1a')](_0xf54592)&&!_[_0xf025('0x1a')](_0x4d7368)){var _0x63d33b=_0xf54592[_0xf025('0x1d')]-_0x4d7368[_0xf025('0x1d')];_0x2d5d5f=_0x15b367[_0xf025('0x17')]?_0x15b367[_0xf025('0x17')]:moment();var _0x2baeb8=moment(_0x2d5d5f)[_0xf025('0x1e')](_0x63d33b,_0xf025('0x1f'));_0x21eada({'ret':_0x2baeb8[_0xf025('0x18')](_0xf025('0x19'))});}else _0x21eada({'ret':_0x2d5d5f});}else _0x21eada({'ret':_0x2d5d5f});}else{_0x21eada({'ret':_0x2d5d5f});}});}});return 0xa;}var _0x22873d=function(_0x532097){return new BPromise(function(_0x5cc5cb,_0x29cf5e){_0x1d0445(_0x532097,_0x51025f)[_0xf025('0x20')](function(_0x36b330){_0x51025f[_0xf025('0x17')]=_0x36b330[_0xf025('0x21')];_0x127c43[_0xf025('0x22')]['findOne']({'where':{'phone':_0x51025f[_0xf025('0xe')],'VoiceQueueId':_0x532097['id']}})[_0xf025('0x20')](function(_0xe3d705){if(!_[_0xf025('0x1a')](_0xe3d705)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x24')+_0x532097['id']);}return _0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f['scheduledat']?_0x51025f['scheduledat']:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f['callbackUniqueid']?moment()['format'](_0xf025('0x19')):undefined,'VoiceQueueId':_0x532097['id']});})[_0xf025('0x29')](function(_0x4822c9){_0x29cf5e(_0x4822c9);});});});};var _0x16ac1f=function(_0x2f313c){return new BPromise(function(_0x81add2,_0x12a936){_0x1d0445(_0x2f313c,_0x51025f)[_0xf025('0x20')](function(_0x44596f){_0x51025f[_0xf025('0x17')]=_0x44596f[_0xf025('0x21')];_0x127c43[_0xf025('0x22')][_0xf025('0x2a')]({'where':{'phone':_0x51025f[_0xf025('0xe')],'VoiceQueueId':_0x2f313c['id']}})[_0xf025('0x20')](function(_0x54ddbd){if(!_[_0xf025('0x1a')](_0x54ddbd)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x2b')+_0x2f313c['id']);}return _0x127c43['CmHopperFinal'][_0xf025('0x2a')]({'where':{'calleridnum':_0x51025f['phone'],'VoiceQueueId':_0x2f313c['id']}});})['then'](function(_0x53ed9f){if(!_['isNil'](_0x53ed9f)){throw new Error(_0xf025('0x2c')+_0x51025f['phone']+_0xf025('0x2d')+_0x2f313c['id']);}return _0x127c43[_0xf025('0x22')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f['callbackUniqueid']:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()['format'](_0xf025('0x19')):undefined,'VoiceQueueId':_0x2f313c['id']});})[_0xf025('0x29')](function(_0x46bd8a){_0x12a936(_0x46bd8a);});});});};function _0x5c779a(){return function(_0x21aca0){logger['error'](_0xf025('0x2e'),_0xf025('0x2f'),util[_0xf025('0x30')](_0x21aca0,{'showHidden':![],'depth':null}));};}function _0x100008(_0x4c180c,_0x458be9){var _0x39a3fd=_0x458be9[_0xf025('0x17')]?_0x458be9[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19'));return new BPromise(function(_0x5ad884,_0x265c8a){if(_[_0xf025('0x1a')](_0x458be9[_0xf025('0x1b')])){_0x5ad884({'ret':_0x39a3fd});}else{_0x127c43[_0xf025('0x31')][_0xf025('0x2a')]({'where':{'id':_0x4c180c['id']}})[_0xf025('0x20')](function(_0x1cd6ab){if(!_['isNil'](_0x1cd6ab)){var _0x38f4bd=_0x1cd6ab[_0xf025('0x1b')];if(!_['isNil'](_0x38f4bd)){var _0x43f17f=shared[_0xf025('0x1c')];var _0x40ee1a=_0x43f17f[_0x38f4bd];var _0x2eafb4=_0x43f17f[_0x458be9['dialTimezone']];if(!_[_0xf025('0x1a')](_0x40ee1a)&&!_[_0xf025('0x1a')](_0x2eafb4)){var _0x1cbed6=_0x40ee1a[_0xf025('0x1d')]-_0x2eafb4[_0xf025('0x1d')];_0x39a3fd=_0x458be9[_0xf025('0x17')]?_0x458be9[_0xf025('0x17')]:moment();var _0xaf8533=moment(_0x39a3fd)[_0xf025('0x1e')](_0x1cbed6,_0xf025('0x1f'));_0x5ad884({'ret':_0xaf8533[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5ad884({'ret':_0x39a3fd});}else _0x5ad884({'ret':_0x39a3fd});}else{_0x5ad884({'ret':_0x39a3fd});}});}});return 0xa;}var _0x3974da=function(_0x391a7a){return new BPromise(function(_0x31f139,_0x35b901){_0x100008(_0x391a7a,_0x51025f)[_0xf025('0x20')](function(_0x9ca6ad){_0x51025f[_0xf025('0x17')]=_0x9ca6ad[_0xf025('0x21')];_0x127c43[_0xf025('0x22')][_0xf025('0x2a')]({'where':{'phone':_0x51025f[_0xf025('0xe')],'CampaignId':_0x391a7a['id']}})[_0xf025('0x20')](function(_0x41e40c){if(!_[_0xf025('0x1a')](_0x41e40c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x51025f[_0xf025('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x391a7a['id']);}return _0x127c43['CmHopper'][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f['ListId'],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f['callbackUniqueid']:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0x391a7a['id']});})[_0xf025('0x29')](function(_0xbe79e3){_0x35b901(_0xbe79e3);});});});};var _0x504f0c=function(_0x11df99){return new BPromise(function(_0x25ba9c,_0x3234bc){_0x100008(_0x11df99,_0x51025f)[_0xf025('0x20')](function(_0x2f7f38){_0x51025f[_0xf025('0x17')]=_0x2f7f38['ret'];_0x127c43['CmHopper'][_0xf025('0x2a')]({'where':{'phone':_0x51025f['phone'],'CampaignId':_0x11df99['id']}})[_0xf025('0x20')](function(_0x5ec581){if(!_[_0xf025('0x1a')](_0x5ec581)){throw new Error(_0xf025('0x23')+_0x51025f[_0xf025('0xe')]+_0xf025('0x32')+_0x11df99['id']);}return _0x127c43['CmHopperFinal'][_0xf025('0x2a')]({'where':{'calleridnum':_0x51025f['phone'],'CampaignId':_0x11df99['id']}});})[_0xf025('0x20')](function(_0x53cd62){if(!_['isNil'](_0x53cd62)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x51025f['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x11df99['id']);}return _0x127c43[_0xf025('0x22')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f['ListId'],'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'callback':_0x51025f[_0xf025('0x28')]?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0x11df99['id']});})[_0xf025('0x29')](function(_0x28a717){_0x3234bc(_0x28a717);});});});};if(_0x51025f[_0xf025('0x26')]){_0x127c43[_0xf025('0x33')][_0xf025('0x34')]({'where':{'type':_0xf025('0x35')},'attributes':['id',_0xf025('0x36'),_0xf025('0x1b')],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x38'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})['then'](function(_0xe671fe){if(_0xe671fe){var _0x5b4314=[];for(var _0x478dbf=0x0,_0x238ddd;_0x478dbf<_0xe671fe['length'];_0x478dbf+=0x1){_0x238ddd=_0xe671fe[_0x478dbf][_0xf025('0x15')]({'plain':!![]});switch(_0x238ddd[_0xf025('0x36')]){case _0xf025('0x39'):_0x16ac1f(_0x238ddd)[_0xf025('0x29')](_0x443010());break;case _0xf025('0x3a'):_0x22873d(_0x238ddd)[_0xf025('0x29')](_0x443010());break;default:_0x100008(_0x238ddd,_0x51025f)[_0xf025('0x20')](function(_0x271db5){_0x51025f[_0xf025('0x17')]=_0x271db5['ret'];_0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()['format'](_0xf025('0x19')),'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f[_0xf025('0x28')]?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f['callbackUniqueid']?moment()[_0xf025('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x238ddd['id']})[_0xf025('0x29')](_0x443010());});}}}})[_0xf025('0x20')](function(){return _0x127c43['VoiceQueue']['findAll']({'where':{'type':_0xf025('0x35')},'attributes':['id'],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x3b'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})['then'](function(_0xd9c2d5){if(_0xd9c2d5){var _0x1e56bf=[];for(var _0x4076a8=0x0,_0x38c289;_0x4076a8<_0xd9c2d5[_0xf025('0x3c')];_0x4076a8+=0x1){_0x38c289=_0xd9c2d5[_0x4076a8][_0xf025('0x15')]({'plain':!![]});_0x127c43[_0xf025('0x3d')]['create']({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'VoiceQueueId':_0x38c289['id']})['catch'](function(_0x5d3cee){logger[_0xf025('0x16')](_0xf025('0x3e'),'afterCreate',_0x5d3cee[_0xf025('0x3f')]);});}}});})[_0xf025('0x20')](function(){return _0x127c43['Campaign']['findAll']({'attributes':['id',_0xf025('0x36'),_0xf025('0x1b')],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':_0xf025('0x38'),'where':{'id':_0x51025f[_0xf025('0x26')]}}]})[_0xf025('0x20')](function(_0x1e4aa3){if(_0x1e4aa3){var _0x15f5f5=[];for(var _0x2433ca=0x0,_0xcbabc7;_0x2433ca<_0x1e4aa3[_0xf025('0x3c')];_0x2433ca+=0x1){_0xcbabc7=_0x1e4aa3[_0x2433ca][_0xf025('0x15')]({'plain':!![]});switch(_0xcbabc7['dialCheckDuplicateType']){case'always':_0x504f0c(_0xcbabc7)['catch'](_0x5c779a());break;case _0xf025('0x3a'):_0x3974da(_0xcbabc7)[_0xf025('0x29')](_0x5c779a());break;default:_0x127c43[_0xf025('0x22')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'scheduledat':_0x51025f[_0xf025('0x17')]?_0x51025f[_0xf025('0x17')]:moment()[_0xf025('0x18')](_0xf025('0x19')),'priority':_0x51025f[_0xf025('0x27')]?_0x51025f[_0xf025('0x27')]:0x2,'callback':_0x51025f['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x51025f['callbackUniqueid']?_0x51025f[_0xf025('0x28')]:undefined,'callbackat':_0x51025f[_0xf025('0x28')]?moment()[_0xf025('0x18')](_0xf025('0x19')):undefined,'CampaignId':_0xcbabc7['id']})['catch'](_0x5c779a());}}}});})['then'](function(){return _0x127c43[_0xf025('0x31')][_0xf025('0x34')]({'attributes':['id'],'include':[{'model':_0x127c43[_0xf025('0x37')],'as':'BlackLists','where':{'id':_0x51025f[_0xf025('0x26')]}}]})[_0xf025('0x20')](function(_0x5168c2){if(_0x5168c2){var _0x8e7698=[];for(var _0x5db355=0x0,_0x32a231;_0x5db355<_0x5168c2[_0xf025('0x3c')];_0x5db355+=0x1){_0x32a231=_0x5168c2[_0x5db355][_0xf025('0x15')]({'plain':!![]});_0x127c43[_0xf025('0x3d')][_0xf025('0x25')]({'phone':_0x51025f[_0xf025('0xe')],'ContactId':_0x51025f['id'],'ListId':_0x51025f[_0xf025('0x26')],'CampaignId':_0x32a231['id']})[_0xf025('0x29')](function(_0x9f6202){logger[_0xf025('0x16')](_0xf025('0x3e'),_0xf025('0x2f'),_0x9f6202[_0xf025('0x3f')]);});}}});})[_0xf025('0x20')](function(){_0x271397();})['catch'](function(_0x1823ea){logger[_0xf025('0x16')](_0xf025('0x3e'),'afterCreate',_0x1823ea[_0xf025('0x3f')]);_0x271397(_0x1823ea);});}else{_0x271397(new Error(_0xf025('0x40')));}},'afterDestroy':function(_0x463ba4,_0x107af9,_0x4c63c9){var _0x145b0a=_0x83c12e[_0xf025('0x14')];var _0x2ab1d1=_0x463ba4[_0xf025('0x15')]({'plain':!![]});return _0x145b0a[_0xf025('0x22')][_0xf025('0x34')]({'raw':!![],'where':{'ListId':_0x2ab1d1[_0xf025('0x26')],'ContactId':_0x2ab1d1['id']}})[_0xf025('0x20')](function(_0x2a5d81){if(!_[_0xf025('0x41')](_0x2a5d81)){var _0x2cc4e2=[];for(var _0x49bab5=0x0;_0x49bab5<_0x2a5d81['length'];_0x49bab5+=0x1){var _0x18fe1c=_0x145b0a['CmHopper'][_0xf025('0x42')]({'where':{'ListId':_0x2a5d81[_0x49bab5]['ListId'],'ContactId':_0x2a5d81[_0x49bab5][_0xf025('0x43')],'VoiceQueueId':_0x2a5d81[_0x49bab5][_0xf025('0x44')],'CampaignId':_0x2a5d81[_0x49bab5][_0xf025('0x45')]}});_0x2cc4e2[_0xf025('0x46')](_0x18fe1c);}return BPromise[_0xf025('0x47')](_0x2cc4e2);}})[_0xf025('0x20')](function(_0x44e2d1){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xf025('0x30')](_0x44e2d1,{'showHidden':![],'depth':null}));_0x4c63c9();})[_0xf025('0x29')](function(_0x1a4fc7){logger[_0xf025('0x16')](_0xf025('0x48'),util['inspect'](_0x1a4fc7,{'showHidden':![],'depth':null}));_0x4c63c9(_0x1a4fc7);});}}});}; \ No newline at end of file +var _0x4038=['CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','always','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','onlyIfOpen','Campaign','error','isEmpty','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','models','get','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','format','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'];(function(_0x511d9e,_0x239682){var _0x1ac3e1=function(_0x2e3032){while(--_0x2e3032){_0x511d9e['push'](_0x511d9e['shift']());}};_0x1ac3e1(++_0x239682);}(_0x4038,0x193));var _0x8403=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x4038[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x8403('0x0'));var util=require(_0x8403('0x1'));var logger=require(_0x8403('0x2'))('api');var moment=require(_0x8403('0x3'));var BPromise=require(_0x8403('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8403('0x5'));var rimraf=require(_0x8403('0x6'));var config=require(_0x8403('0x7'));var shared=require(_0x8403('0x8'));var attributes=require('./cmContact.attributes');module[_0x8403('0x9')]=function(_0x14cff8,_0x445f49){return _0x14cff8[_0x8403('0xa')](_0x8403('0xb'),attributes,{'tableName':_0x8403('0xc'),'paranoid':!![],'indexes':[{'name':_0x8403('0xd'),'fields':[_0x8403('0xd')]},{'name':_0x8403('0xe'),'fields':[_0x8403('0xf'),_0x8403('0x10'),_0x8403('0xd'),_0x8403('0x11'),_0x8403('0x12'),_0x8403('0x13')],'type':_0x8403('0x14')}],'timestamps':!![],'charset':_0x8403('0x15'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xd4c56d,_0xad046,_0x12996c){var _0x3e079f=_0x14cff8[_0x8403('0x16')];var _0x360c7b=_0xd4c56d[_0x8403('0x17')]({'plain':!![]});function _0x3649c2(){return function(_0x3e0ea5){logger['error'](_0x8403('0x18'),_0x8403('0x19'),util[_0x8403('0x1a')](_0x3e0ea5,{'showHidden':![],'depth':null}));};}function _0xc2c3cf(_0x1300e6,_0x5c25ff){var _0x5ba2a5=_0x5c25ff[_0x8403('0x1b')]?_0x5c25ff[_0x8403('0x1b')]:moment()['format'](_0x8403('0x1c'));return new BPromise(function(_0x205fe7,_0x4cb7fd){if(_[_0x8403('0x1d')](_0x5c25ff['dialTimezone'])){_0x205fe7({'ret':_0x5ba2a5});}else{_0x3e079f[_0x8403('0x1e')][_0x8403('0x1f')]({'where':{'id':_0x1300e6['id']}})[_0x8403('0x20')](function(_0x54d7e3){if(!_['isNil'](_0x54d7e3)){var _0x255d04=_0x54d7e3[_0x8403('0x21')];if(!_['isNil'](_0x255d04)){var _0x4cc244=shared[_0x8403('0x22')];var _0x56c90d=_0x4cc244[_0x255d04];var _0x4be3f3=_0x4cc244[_0x5c25ff['dialTimezone']];if(!_['isNil'](_0x56c90d)&&!_[_0x8403('0x1d')](_0x4be3f3)){var _0x584c7d=_0x56c90d[_0x8403('0x23')]-_0x4be3f3[_0x8403('0x23')];_0x5ba2a5=_0x5c25ff[_0x8403('0x1b')]?_0x5c25ff[_0x8403('0x1b')]:moment();var _0x44364=moment(_0x5ba2a5)[_0x8403('0x24')](_0x584c7d,_0x8403('0x25'));_0x205fe7({'ret':_0x44364[_0x8403('0x26')](_0x8403('0x1c'))});}else _0x205fe7({'ret':_0x5ba2a5});}else _0x205fe7({'ret':_0x5ba2a5});}else{_0x205fe7({'ret':_0x5ba2a5});}});}});return 0xa;}var _0x52c353=function(_0x2d7824){return new BPromise(function(_0x57e4f6,_0x50d542){_0xc2c3cf(_0x2d7824,_0x360c7b)['then'](function(_0x23273a){_0x360c7b[_0x8403('0x1b')]=_0x23273a['ret'];_0x3e079f[_0x8403('0x27')][_0x8403('0x1f')]({'where':{'phone':_0x360c7b['phone'],'VoiceQueueId':_0x2d7824['id']}})[_0x8403('0x20')](function(_0x52414b){if(!_[_0x8403('0x1d')](_0x52414b)){throw new Error(_0x8403('0x28')+_0x360c7b[_0x8403('0xd')]+_0x8403('0x29')+_0x2d7824['id']);}return _0x3e079f[_0x8403('0x27')]['create']({'phone':_0x360c7b[_0x8403('0xd')],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'priority':_0x360c7b['priority']?_0x360c7b[_0x8403('0x2b')]:0x2,'scheduledat':_0x360c7b[_0x8403('0x1b')]?_0x360c7b[_0x8403('0x1b')]:moment()[_0x8403('0x26')](_0x8403('0x1c')),'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b[_0x8403('0x2c')]?_0x360c7b[_0x8403('0x2c')]:undefined,'callbackat':_0x360c7b[_0x8403('0x2c')]?moment()[_0x8403('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2d7824['id']});})[_0x8403('0x2d')](function(_0x2f0fb5){_0x50d542(_0x2f0fb5);});});});};var _0x3b49d0=function(_0x48a66c){return new BPromise(function(_0x36a301,_0x347372){_0xc2c3cf(_0x48a66c,_0x360c7b)[_0x8403('0x20')](function(_0x5df5d8){_0x360c7b[_0x8403('0x1b')]=_0x5df5d8['ret'];_0x3e079f[_0x8403('0x27')][_0x8403('0x1f')]({'where':{'phone':_0x360c7b[_0x8403('0xd')],'VoiceQueueId':_0x48a66c['id']}})[_0x8403('0x20')](function(_0xda998c){if(!_['isNil'](_0xda998c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x360c7b[_0x8403('0xd')]+_0x8403('0x2e')+_0x48a66c['id']);}return _0x3e079f[_0x8403('0x2f')][_0x8403('0x1f')]({'where':{'calleridnum':_0x360c7b[_0x8403('0xd')],'VoiceQueueId':_0x48a66c['id']}});})[_0x8403('0x20')](function(_0x2e2e85){if(!_[_0x8403('0x1d')](_0x2e2e85)){throw new Error(_0x8403('0x30')+_0x360c7b[_0x8403('0xd')]+_0x8403('0x31')+_0x48a66c['id']);}return _0x3e079f[_0x8403('0x27')][_0x8403('0x32')]({'phone':_0x360c7b['phone'],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'priority':_0x360c7b['priority']?_0x360c7b['priority']:0x2,'scheduledat':_0x360c7b[_0x8403('0x1b')]?_0x360c7b[_0x8403('0x1b')]:moment()[_0x8403('0x26')](_0x8403('0x1c')),'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b['callbackUniqueid']?_0x360c7b[_0x8403('0x2c')]:undefined,'callbackat':_0x360c7b[_0x8403('0x2c')]?moment()['format'](_0x8403('0x1c')):undefined,'VoiceQueueId':_0x48a66c['id']});})[_0x8403('0x2d')](function(_0x22979a){_0x347372(_0x22979a);});});});};function _0x4d1600(){return function(_0x4cfb19){logger['error'](_0x8403('0x18'),_0x8403('0x19'),util[_0x8403('0x1a')](_0x4cfb19,{'showHidden':![],'depth':null}));};}function _0x53c2ac(_0x35f624,_0x4b1b47){var _0xd75858=_0x4b1b47[_0x8403('0x1b')]?_0x4b1b47[_0x8403('0x1b')]:moment()['format'](_0x8403('0x1c'));return new BPromise(function(_0x387653,_0x18e152){if(_[_0x8403('0x1d')](_0x4b1b47['dialTimezone'])){_0x387653({'ret':_0xd75858});}else{_0x3e079f['Campaign'][_0x8403('0x1f')]({'where':{'id':_0x35f624['id']}})['then'](function(_0x369b04){if(!_['isNil'](_0x369b04)){var _0x3a6f7c=_0x369b04[_0x8403('0x21')];if(!_[_0x8403('0x1d')](_0x3a6f7c)){var _0x123cd5=shared[_0x8403('0x22')];var _0x50c751=_0x123cd5[_0x3a6f7c];var _0x1aec02=_0x123cd5[_0x4b1b47['dialTimezone']];if(!_[_0x8403('0x1d')](_0x50c751)&&!_[_0x8403('0x1d')](_0x1aec02)){var _0x118d2e=_0x50c751[_0x8403('0x23')]-_0x1aec02['utcOffset'];_0xd75858=_0x4b1b47[_0x8403('0x1b')]?_0x4b1b47[_0x8403('0x1b')]:moment();var _0x1e5a35=moment(_0xd75858)[_0x8403('0x24')](_0x118d2e,'minutes');_0x387653({'ret':_0x1e5a35[_0x8403('0x26')](_0x8403('0x1c'))});}else _0x387653({'ret':_0xd75858});}else _0x387653({'ret':_0xd75858});}else{_0x387653({'ret':_0xd75858});}});}});return 0xa;}var _0x28672b=function(_0x19ed4e){return new BPromise(function(_0x3fa312,_0x30a9e3){_0x53c2ac(_0x19ed4e,_0x360c7b)[_0x8403('0x20')](function(_0x4cc41){_0x360c7b[_0x8403('0x1b')]=_0x4cc41[_0x8403('0x33')];_0x3e079f[_0x8403('0x27')][_0x8403('0x1f')]({'where':{'phone':_0x360c7b[_0x8403('0xd')],'CampaignId':_0x19ed4e['id']}})[_0x8403('0x20')](function(_0xf88d51){if(!_[_0x8403('0x1d')](_0xf88d51)){throw new Error(_0x8403('0x28')+_0x360c7b['phone']+_0x8403('0x34')+_0x19ed4e['id']);}return _0x3e079f['CmHopper'][_0x8403('0x32')]({'phone':_0x360c7b[_0x8403('0xd')],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'priority':_0x360c7b[_0x8403('0x2b')]?_0x360c7b[_0x8403('0x2b')]:0x2,'scheduledat':_0x360c7b[_0x8403('0x1b')]?_0x360c7b[_0x8403('0x1b')]:moment()['format'](_0x8403('0x1c')),'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b[_0x8403('0x2c')]?_0x360c7b[_0x8403('0x2c')]:undefined,'callbackat':_0x360c7b[_0x8403('0x2c')]?moment()[_0x8403('0x26')](_0x8403('0x1c')):undefined,'CampaignId':_0x19ed4e['id']});})[_0x8403('0x2d')](function(_0x4d21c3){_0x30a9e3(_0x4d21c3);});});});};var _0x176e74=function(_0x1cf070){return new BPromise(function(_0x873076,_0x56e6ff){_0x53c2ac(_0x1cf070,_0x360c7b)[_0x8403('0x20')](function(_0x3cb2fa){_0x360c7b[_0x8403('0x1b')]=_0x3cb2fa[_0x8403('0x33')];_0x3e079f[_0x8403('0x27')][_0x8403('0x1f')]({'where':{'phone':_0x360c7b['phone'],'CampaignId':_0x1cf070['id']}})[_0x8403('0x20')](function(_0x2b7867){if(!_['isNil'](_0x2b7867)){throw new Error(_0x8403('0x28')+_0x360c7b['phone']+_0x8403('0x35')+_0x1cf070['id']);}return _0x3e079f[_0x8403('0x2f')]['findOne']({'where':{'calleridnum':_0x360c7b['phone'],'CampaignId':_0x1cf070['id']}});})[_0x8403('0x20')](function(_0x4428ff){if(!_[_0x8403('0x1d')](_0x4428ff)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x360c7b[_0x8403('0xd')]+_0x8403('0x36')+_0x1cf070['id']);}return _0x3e079f[_0x8403('0x27')]['create']({'phone':_0x360c7b['phone'],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'priority':_0x360c7b['priority']?_0x360c7b[_0x8403('0x2b')]:0x2,'scheduledat':_0x360c7b[_0x8403('0x1b')]?_0x360c7b['scheduledat']:moment()[_0x8403('0x26')](_0x8403('0x1c')),'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b[_0x8403('0x2c')]?_0x360c7b[_0x8403('0x2c')]:undefined,'callbackat':_0x360c7b['callbackUniqueid']?moment()['format'](_0x8403('0x1c')):undefined,'CampaignId':_0x1cf070['id']});})[_0x8403('0x2d')](function(_0x407134){_0x56e6ff(_0x407134);});});});};if(_0x360c7b['ListId']){_0x3e079f[_0x8403('0x1e')]['findAll']({'where':{'type':_0x8403('0x37')},'attributes':['id',_0x8403('0x38'),_0x8403('0x21')],'include':[{'model':_0x3e079f[_0x8403('0x39')],'as':'Lists','where':{'id':_0x360c7b[_0x8403('0x2a')]}}]})[_0x8403('0x20')](function(_0x326013){if(_0x326013){var _0x1a1593=[];for(var _0x344501=0x0,_0x93ab6a;_0x344501<_0x326013['length'];_0x344501+=0x1){_0x93ab6a=_0x326013[_0x344501][_0x8403('0x17')]({'plain':!![]});switch(_0x93ab6a[_0x8403('0x38')]){case _0x8403('0x3a'):_0x3b49d0(_0x93ab6a)[_0x8403('0x2d')](_0x3649c2());break;case'onlyIfOpen':_0x52c353(_0x93ab6a)[_0x8403('0x2d')](_0x3649c2());break;default:_0x53c2ac(_0x93ab6a,_0x360c7b)[_0x8403('0x20')](function(_0x1cd0fd){_0x360c7b[_0x8403('0x1b')]=_0x1cd0fd['ret'];_0x3e079f[_0x8403('0x27')][_0x8403('0x32')]({'phone':_0x360c7b[_0x8403('0xd')],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'scheduledat':_0x360c7b[_0x8403('0x1b')]?_0x360c7b[_0x8403('0x1b')]:moment()[_0x8403('0x26')](_0x8403('0x1c')),'priority':_0x360c7b['priority']?_0x360c7b[_0x8403('0x2b')]:0x2,'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b[_0x8403('0x2c')]?_0x360c7b['callbackUniqueid']:undefined,'callbackat':_0x360c7b[_0x8403('0x2c')]?moment()[_0x8403('0x26')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x93ab6a['id']})[_0x8403('0x2d')](_0x3649c2());});}}}})['then'](function(){return _0x3e079f[_0x8403('0x1e')][_0x8403('0x3b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x3e079f[_0x8403('0x39')],'as':_0x8403('0x3c'),'where':{'id':_0x360c7b[_0x8403('0x2a')]}}]})[_0x8403('0x20')](function(_0x6d7616){if(_0x6d7616){var _0xb1b923=[];for(var _0x391d12=0x0,_0x5d90b1;_0x391d12<_0x6d7616[_0x8403('0x3d')];_0x391d12+=0x1){_0x5d90b1=_0x6d7616[_0x391d12][_0x8403('0x17')]({'plain':!![]});_0x3e079f[_0x8403('0x3e')][_0x8403('0x32')]({'phone':_0x360c7b['phone'],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'VoiceQueueId':_0x5d90b1['id']})[_0x8403('0x2d')](function(_0x2a38d1){logger['error'](_0x8403('0x3f'),_0x8403('0x19'),_0x2a38d1[_0x8403('0x40')]);});}}});})[_0x8403('0x20')](function(){return _0x3e079f['Campaign'][_0x8403('0x3b')]({'attributes':['id',_0x8403('0x38'),_0x8403('0x21')],'include':[{'model':_0x3e079f[_0x8403('0x39')],'as':_0x8403('0x41'),'where':{'id':_0x360c7b[_0x8403('0x2a')]}}]})['then'](function(_0x1d4e38){if(_0x1d4e38){var _0x38e168=[];for(var _0x2004ff=0x0,_0x504ef5;_0x2004ff<_0x1d4e38[_0x8403('0x3d')];_0x2004ff+=0x1){_0x504ef5=_0x1d4e38[_0x2004ff][_0x8403('0x17')]({'plain':!![]});switch(_0x504ef5[_0x8403('0x38')]){case _0x8403('0x3a'):_0x176e74(_0x504ef5)[_0x8403('0x2d')](_0x4d1600());break;case _0x8403('0x42'):_0x28672b(_0x504ef5)['catch'](_0x4d1600());break;default:_0x3e079f[_0x8403('0x27')][_0x8403('0x32')]({'phone':_0x360c7b[_0x8403('0xd')],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'scheduledat':_0x360c7b['scheduledat']?_0x360c7b['scheduledat']:moment()[_0x8403('0x26')](_0x8403('0x1c')),'priority':_0x360c7b[_0x8403('0x2b')]?_0x360c7b[_0x8403('0x2b')]:0x2,'callback':_0x360c7b[_0x8403('0x2c')]?!![]:![],'callbackuniqueid':_0x360c7b[_0x8403('0x2c')]?_0x360c7b[_0x8403('0x2c')]:undefined,'callbackat':_0x360c7b[_0x8403('0x2c')]?moment()[_0x8403('0x26')](_0x8403('0x1c')):undefined,'CampaignId':_0x504ef5['id']})['catch'](_0x4d1600());}}}});})[_0x8403('0x20')](function(){return _0x3e079f[_0x8403('0x43')][_0x8403('0x3b')]({'attributes':['id'],'include':[{'model':_0x3e079f[_0x8403('0x39')],'as':'BlackLists','where':{'id':_0x360c7b[_0x8403('0x2a')]}}]})[_0x8403('0x20')](function(_0x2def39){if(_0x2def39){var _0x471445=[];for(var _0x124b1f=0x0,_0x41aa7a;_0x124b1f<_0x2def39['length'];_0x124b1f+=0x1){_0x41aa7a=_0x2def39[_0x124b1f][_0x8403('0x17')]({'plain':!![]});_0x3e079f[_0x8403('0x3e')]['create']({'phone':_0x360c7b[_0x8403('0xd')],'ContactId':_0x360c7b['id'],'ListId':_0x360c7b[_0x8403('0x2a')],'CampaignId':_0x41aa7a['id']})[_0x8403('0x2d')](function(_0x14629a){logger[_0x8403('0x44')]('cmContact,\x20%s,\x20%s',_0x8403('0x19'),_0x14629a[_0x8403('0x40')]);});}}});})['then'](function(){_0x12996c();})[_0x8403('0x2d')](function(_0x2ce533){logger[_0x8403('0x44')]('cmContact,\x20%s,\x20%s',_0x8403('0x19'),_0x2ce533[_0x8403('0x40')]);_0x12996c(_0x2ce533);});}else{_0x12996c(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x310786,_0x2d2686,_0x76fda9){var _0x13471a=_0x14cff8[_0x8403('0x16')];var _0x2811e7=_0x310786[_0x8403('0x17')]({'plain':!![]});return _0x13471a['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x2811e7[_0x8403('0x2a')],'ContactId':_0x2811e7['id']}})['then'](function(_0x157de6){if(!_[_0x8403('0x45')](_0x157de6)){var _0x5e6c28=[];for(var _0x226b54=0x0;_0x226b54<_0x157de6['length'];_0x226b54+=0x1){var _0x113a26=_0x13471a[_0x8403('0x27')]['destroy']({'where':{'ListId':_0x157de6[_0x226b54]['ListId'],'ContactId':_0x157de6[_0x226b54]['ContactId'],'VoiceQueueId':_0x157de6[_0x226b54][_0x8403('0x46')],'CampaignId':_0x157de6[_0x226b54][_0x8403('0x47')]}});_0x5e6c28['push'](_0x113a26);}return BPromise[_0x8403('0x48')](_0x5e6c28);}})[_0x8403('0x20')](function(_0x5f1b31){logger[_0x8403('0x49')]('[CmContact][afterDestroy][Succesfull]',util[_0x8403('0x1a')](_0x5f1b31,{'showHidden':![],'depth':null}));_0x76fda9();})['catch'](function(_0x43c782){logger['error'](_0x8403('0x4a'),util[_0x8403('0x1a')](_0x43c782,{'showHidden':![],'depth':null}));_0x76fda9(_0x43c782);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 39b4305..ccdbcb8 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 _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x1c96ba,_0x1411ae){var _0x3c1b73=function(_0x3f1300){while(--_0x3f1300){_0x1c96ba['push'](_0x1c96ba['shift']());}};_0x3c1b73(++_0x1411ae);}(_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 squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\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(_0x13be30,_0xe74a40){var _0x291f45=function(_0x214e14){while(--_0x214e14){_0x13be30['push'](_0x13be30['shift']());}};_0x291f45(++_0xe74a40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 791970a..f85e875 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 _0x4f88=['exports','STRING','INTEGER','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4f88,0xf3));var _0x84f8=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x4f88[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require(_0x84f8('0x0'));module[_0x84f8('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x84f8('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x84f8('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xa37e=['STRING','INTEGER'];(function(_0x4b177f,_0x3162d8){var _0x271659=function(_0x447717){while(--_0x447717){_0x4b177f['push'](_0x4b177f['shift']());}};_0x271659(++_0x3162d8);}(_0xa37e,0x97));var _0xea37=function(_0x139e94,_0x2797ad){_0x139e94=_0x139e94-0x0;var _0x275d69=_0xa37e[_0x139e94];return _0x275d69;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xea37('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0xea37('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xea37('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xea37('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xea37('0x0')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 bb54288..90969c6 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 _0x3516=['catch','params','includeAll','include','options','find','create','body','user','role','UserProfileSection','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmContactHasItem'];(function(_0x503a67,_0x1ea47d){var _0x321154=function(_0x472777){while(--_0x472777){_0x503a67['push'](_0x503a67['shift']());}};_0x321154(++_0x1ea47d);}(_0x3516,0xad));var _0x6351=function(_0x4d32c9,_0xa9aa9d){_0x4d32c9=_0x4d32c9-0x0;var _0x16cbbf=_0x3516[_0x4d32c9];return _0x16cbbf;};'use strict';var emlformat=require(_0x6351('0x0'));var rimraf=require(_0x6351('0x1'));var zipdir=require(_0x6351('0x2'));var jsonpatch=require(_0x6351('0x3'));var rp=require(_0x6351('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6351('0x5'));var util=require(_0x6351('0x6'));var path=require(_0x6351('0x7'));var sox=require(_0x6351('0x8'));var csv=require(_0x6351('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6351('0xa'));var _=require(_0x6351('0xb'));var squel=require(_0x6351('0xc'));var crypto=require(_0x6351('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6351('0xe'));var toCsv=require(_0x6351('0x9'));var querystring=require(_0x6351('0xf'));var Papa=require(_0x6351('0x10'));var Redis=require(_0x6351('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6351('0x12'));var as=require(_0x6351('0x13'));var hardwareService=require(_0x6351('0x14'));var logger=require(_0x6351('0x15'))('api');var utils=require(_0x6351('0x16'));var config=require(_0x6351('0x17'));var licenseUtil=require(_0x6351('0x18'));var db=require(_0x6351('0x19'))['db'];function respondWithStatusCode(_0x4f9916,_0x215b98){_0x215b98=_0x215b98||0xcc;return function(_0xeb0b26){if(_0xeb0b26){return _0x4f9916['sendStatus'](_0x215b98);}return _0x4f9916[_0x6351('0x1a')](_0x215b98)['end']();};}function respondWithResult(_0x2de158,_0x50133e){_0x50133e=_0x50133e||0xc8;return function(_0x3e9f5a){if(_0x3e9f5a){return _0x2de158[_0x6351('0x1a')](_0x50133e)['json'](_0x3e9f5a);}};}function respondWithFilteredResult(_0x5d51a4,_0x565925){return function(_0x19cf8e){if(_0x19cf8e){var _0x34c164=typeof _0x565925[_0x6351('0x1b')]===_0x6351('0x1c')&&typeof _0x565925['limit']===_0x6351('0x1c');var _0x26c368=_0x19cf8e[_0x6351('0x1d')];var _0x59ce5d=_0x34c164?0x0:_0x565925[_0x6351('0x1b')];var _0x5597bd=_0x34c164?_0x19cf8e[_0x6351('0x1d')]:_0x565925['offset']+_0x565925[_0x6351('0x1e')];var _0x10002c;if(_0x5597bd>=_0x26c368){_0x5597bd=_0x26c368;_0x10002c=0xc8;}else{_0x10002c=0xce;}_0x5d51a4[_0x6351('0x1a')](_0x10002c);return _0x5d51a4[_0x6351('0x1f')](_0x6351('0x20'),_0x59ce5d+'-'+_0x5597bd+'/'+_0x26c368)[_0x6351('0x21')](_0x19cf8e);}return null;};}function patchUpdates(_0x38fc02){return function(_0x44cdcb){try{jsonpatch[_0x6351('0x22')](_0x44cdcb,_0x38fc02,!![]);}catch(_0x3c0986){return BPromise['reject'](_0x3c0986);}return _0x44cdcb[_0x6351('0x23')]();};}function saveUpdates(_0x3113ab,_0x5d373d){return function(_0x28de1d){if(_0x28de1d){return _0x28de1d[_0x6351('0x24')](_0x3113ab)[_0x6351('0x25')](function(_0x4f01c9){return _0x4f01c9;});}return null;};}function removeEntity(_0x4d813d,_0x4f1f7a){return function(_0xf200fe){if(_0xf200fe){return _0xf200fe[_0x6351('0x26')]()['then'](function(){var _0x2addb3=_0xf200fe[_0x6351('0x27')]({'plain':!![]});var _0x501674=_0x6351('0x28');return db[_0x6351('0x29')][_0x6351('0x26')]({'where':{'type':_0x501674,'resourceId':_0x2addb3['id']}})[_0x6351('0x25')](function(){return _0xf200fe;});})[_0x6351('0x25')](function(){_0x4d813d[_0x6351('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336405,_0x16880e){return function(_0x2a36d4){if(!_0x2a36d4){_0x336405[_0x6351('0x2a')](0x194);}return _0x2a36d4;};}function handleError(_0x15d9d4,_0x6c862a){_0x6c862a=_0x6c862a||0x1f4;return function(_0x50ed1e){logger['error'](_0x50ed1e[_0x6351('0x2b')]);if(_0x50ed1e[_0x6351('0x2c')]){delete _0x50ed1e[_0x6351('0x2c')];}_0x15d9d4['status'](_0x6c862a)[_0x6351('0x2d')](_0x50ed1e);};}exports['index']=function(_0x3fd85e,_0x2f5471){var _0x4f19db={},_0x4a39da={},_0x8636b2={'count':0x0,'rows':[]};var _0x5e86aa=_[_0x6351('0x2e')](db['CmContactHasItem'][_0x6351('0x2f')],function(_0x468f1c){return{'name':_0x468f1c['fieldName'],'type':_0x468f1c[_0x6351('0x30')][_0x6351('0x31')]};});_0x4a39da[_0x6351('0x32')]=_['map'](_0x5e86aa,'name');_0x4a39da[_0x6351('0x33')]=_[_0x6351('0x34')](_0x3fd85e[_0x6351('0x33')]);_0x4a39da[_0x6351('0x35')]=_[_0x6351('0x36')](_0x4a39da[_0x6351('0x32')],_0x4a39da[_0x6351('0x33')]);_0x4f19db['attributes']=_[_0x6351('0x36')](_0x4a39da[_0x6351('0x32')],qs[_0x6351('0x37')](_0x3fd85e['query'][_0x6351('0x37')]));_0x4f19db[_0x6351('0x38')]=_0x4f19db[_0x6351('0x38')][_0x6351('0x39')]?_0x4f19db[_0x6351('0x38')]:_0x4a39da[_0x6351('0x32')];if(!_0x3fd85e['query']['hasOwnProperty'](_0x6351('0x3a'))){_0x4f19db[_0x6351('0x1e')]=qs[_0x6351('0x1e')](_0x3fd85e[_0x6351('0x33')][_0x6351('0x1e')]);_0x4f19db[_0x6351('0x1b')]=qs[_0x6351('0x1b')](_0x3fd85e[_0x6351('0x33')]['offset']);}_0x4f19db[_0x6351('0x3b')]=qs['sort'](_0x3fd85e['query'][_0x6351('0x3c')]);_0x4f19db[_0x6351('0x3d')]=qs[_0x6351('0x35')](_[_0x6351('0x3e')](_0x3fd85e[_0x6351('0x33')],_0x4a39da['filters']),_0x5e86aa);if(_0x3fd85e[_0x6351('0x33')][_0x6351('0x3f')]){_0x4f19db[_0x6351('0x3d')]=_[_0x6351('0x40')](_0x4f19db[_0x6351('0x3d')],{'$or':_[_0x6351('0x2e')](_0x5e86aa,function(_0x307860){if(_0x307860[_0x6351('0x30')]!==_0x6351('0x41')){var _0x444799={};_0x444799[_0x307860['name']]={'$like':'%'+_0x3fd85e['query'][_0x6351('0x3f')]+'%'};return _0x444799;}})});}_0x4f19db=_[_0x6351('0x40')]({},_0x4f19db,_0x3fd85e['options']);var _0x10b5ff={'where':_0x4f19db[_0x6351('0x3d')]};return db['CmContactHasItem'][_0x6351('0x1d')](_0x10b5ff)['then'](function(_0x46cb85){_0x8636b2[_0x6351('0x1d')]=_0x46cb85;if(_0x3fd85e[_0x6351('0x33')]['includeAll']){_0x4f19db['include']=[{'all':!![]}];}return db[_0x6351('0x42')]['findAll'](_0x4f19db);})[_0x6351('0x25')](function(_0x30621b){_0x8636b2['rows']=_0x30621b;return _0x8636b2;})[_0x6351('0x25')](respondWithFilteredResult(_0x2f5471,_0x4f19db))[_0x6351('0x43')](handleError(_0x2f5471,null));};exports['show']=function(_0x5bee84,_0x5e0c4a){var _0x67e19={'raw':!![],'where':{'id':_0x5bee84[_0x6351('0x44')]['id']}},_0x38a5b0={};_0x38a5b0[_0x6351('0x32')]=_[_0x6351('0x34')](db[_0x6351('0x42')][_0x6351('0x2f')]);_0x38a5b0[_0x6351('0x33')]=_['keys'](_0x5bee84[_0x6351('0x33')]);_0x38a5b0[_0x6351('0x35')]=_[_0x6351('0x36')](_0x38a5b0[_0x6351('0x32')],_0x38a5b0[_0x6351('0x33')]);_0x67e19[_0x6351('0x38')]=_[_0x6351('0x36')](_0x38a5b0['model'],qs[_0x6351('0x37')](_0x5bee84[_0x6351('0x33')][_0x6351('0x37')]));_0x67e19[_0x6351('0x38')]=_0x67e19[_0x6351('0x38')][_0x6351('0x39')]?_0x67e19[_0x6351('0x38')]:_0x38a5b0[_0x6351('0x32')];if(_0x5bee84[_0x6351('0x33')][_0x6351('0x45')]){_0x67e19[_0x6351('0x46')]=[{'all':!![]}];}_0x67e19=_[_0x6351('0x40')]({},_0x67e19,_0x5bee84[_0x6351('0x47')]);return db['CmContactHasItem'][_0x6351('0x48')](_0x67e19)['then'](handleEntityNotFound(_0x5e0c4a,null))[_0x6351('0x25')](respondWithResult(_0x5e0c4a,null))[_0x6351('0x43')](handleError(_0x5e0c4a,null));};exports[_0x6351('0x49')]=function(_0x396eb4,_0x46f391){return db[_0x6351('0x42')][_0x6351('0x49')](_0x396eb4[_0x6351('0x4a')],{})[_0x6351('0x25')](function(_0x7361f6){var _0x5e82dd=_0x396eb4[_0x6351('0x4b')]['get']({'plain':!![]});if(!_0x5e82dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e82dd[_0x6351('0x4c')]==='user'){var _0x494229=_0x7361f6[_0x6351('0x27')]({'plain':!![]});var _0x37356f=_0x6351('0x28');return db[_0x6351('0x4d')][_0x6351('0x48')]({'where':{'name':_0x37356f,'userProfileId':_0x5e82dd['userProfileId']},'raw':!![]})[_0x6351('0x25')](function(_0x1c1bab){if(_0x1c1bab&&_0x1c1bab[_0x6351('0x4e')]===0x0){return db[_0x6351('0x29')][_0x6351('0x49')]({'name':_0x494229[_0x6351('0x2c')],'resourceId':_0x494229['id'],'type':_0x1c1bab['name'],'sectionId':_0x1c1bab['id']},{})[_0x6351('0x25')](function(){return _0x7361f6;});}else{return _0x7361f6;}})[_0x6351('0x43')](function(_0x4f8f08){logger[_0x6351('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8f08);throw _0x4f8f08;});}return _0x7361f6;})[_0x6351('0x25')](respondWithResult(_0x46f391,0xc9))[_0x6351('0x43')](handleError(_0x46f391,null));};exports[_0x6351('0x24')]=function(_0x200895,_0x61f94d){if(_0x200895[_0x6351('0x4a')]['id']){delete _0x200895[_0x6351('0x4a')]['id'];}return db['CmContactHasItem'][_0x6351('0x48')]({'where':{'id':_0x200895[_0x6351('0x44')]['id']}})[_0x6351('0x25')](handleEntityNotFound(_0x61f94d,null))[_0x6351('0x25')](saveUpdates(_0x200895['body'],null))[_0x6351('0x25')](respondWithResult(_0x61f94d,null))[_0x6351('0x43')](handleError(_0x61f94d,null));};exports[_0x6351('0x26')]=function(_0x3072df,_0x4212e7){return db[_0x6351('0x42')]['find']({'where':{'id':_0x3072df[_0x6351('0x44')]['id']}})['then'](handleEntityNotFound(_0x4212e7,null))['then'](removeEntity(_0x4212e7,null))[_0x6351('0x43')](handleError(_0x4212e7,null));}; \ No newline at end of file +var _0x8cc2=['create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','stack','name','send','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','length','catch'];(function(_0x43cb67,_0x4b7e2a){var _0x300fe0=function(_0x1bd17b){while(--_0x1bd17b){_0x43cb67['push'](_0x43cb67['shift']());}};_0x300fe0(++_0x4b7e2a);}(_0x8cc2,0x64));var _0x28cc=function(_0x588a1f,_0x1a63dd){_0x588a1f=_0x588a1f-0x0;var _0x2ae8dc=_0x8cc2[_0x588a1f];return _0x2ae8dc;};'use strict';var emlformat=require(_0x28cc('0x0'));var rimraf=require(_0x28cc('0x1'));var zipdir=require(_0x28cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28cc('0x3'));var moment=require(_0x28cc('0x4'));var BPromise=require(_0x28cc('0x5'));var Mustache=require(_0x28cc('0x6'));var util=require('util');var path=require(_0x28cc('0x7'));var sox=require(_0x28cc('0x8'));var csv=require(_0x28cc('0x9'));var ejs=require(_0x28cc('0xa'));var fs=require('fs');var fs_extra=require(_0x28cc('0xb'));var _=require(_0x28cc('0xc'));var squel=require(_0x28cc('0xd'));var crypto=require(_0x28cc('0xe'));var jsforce=require(_0x28cc('0xf'));var deskjs=require(_0x28cc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x28cc('0x11'));var Redis=require(_0x28cc('0x12'));var authService=require(_0x28cc('0x13'));var qs=require(_0x28cc('0x14'));var as=require(_0x28cc('0x15'));var hardwareService=require(_0x28cc('0x16'));var logger=require(_0x28cc('0x17'))(_0x28cc('0x18'));var utils=require('../../config/utils');var config=require(_0x28cc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x28cc('0x1a'))['db'];function respondWithStatusCode(_0x43e26a,_0x1a1a1e){_0x1a1a1e=_0x1a1a1e||0xcc;return function(_0x24121f){if(_0x24121f){return _0x43e26a[_0x28cc('0x1b')](_0x1a1a1e);}return _0x43e26a[_0x28cc('0x1c')](_0x1a1a1e)[_0x28cc('0x1d')]();};}function respondWithResult(_0x540732,_0x3efb80){_0x3efb80=_0x3efb80||0xc8;return function(_0x77558a){if(_0x77558a){return _0x540732[_0x28cc('0x1c')](_0x3efb80)[_0x28cc('0x1e')](_0x77558a);}};}function respondWithFilteredResult(_0x525a7b,_0x42e742){return function(_0x2095bb){if(_0x2095bb){var _0x4ed27d=typeof _0x42e742['offset']===_0x28cc('0x1f')&&typeof _0x42e742[_0x28cc('0x20')]===_0x28cc('0x1f');var _0xd2dc47=_0x2095bb[_0x28cc('0x21')];var _0x168771=_0x4ed27d?0x0:_0x42e742[_0x28cc('0x22')];var _0x3fa65c=_0x4ed27d?_0x2095bb[_0x28cc('0x21')]:_0x42e742[_0x28cc('0x22')]+_0x42e742[_0x28cc('0x20')];var _0x9a4302;if(_0x3fa65c>=_0xd2dc47){_0x3fa65c=_0xd2dc47;_0x9a4302=0xc8;}else{_0x9a4302=0xce;}_0x525a7b[_0x28cc('0x1c')](_0x9a4302);return _0x525a7b[_0x28cc('0x23')](_0x28cc('0x24'),_0x168771+'-'+_0x3fa65c+'/'+_0xd2dc47)['json'](_0x2095bb);}return null;};}function patchUpdates(_0x452275){return function(_0x484f6b){try{jsonpatch[_0x28cc('0x25')](_0x484f6b,_0x452275,!![]);}catch(_0x4f35b7){return BPromise[_0x28cc('0x26')](_0x4f35b7);}return _0x484f6b[_0x28cc('0x27')]();};}function saveUpdates(_0x341655,_0x2cf988){return function(_0x353911){if(_0x353911){return _0x353911['update'](_0x341655)[_0x28cc('0x28')](function(_0x5da609){return _0x5da609;});}return null;};}function removeEntity(_0x34edc0,_0x11b524){return function(_0x1642ff){if(_0x1642ff){return _0x1642ff['destroy']()['then'](function(){var _0xb2e5da=_0x1642ff[_0x28cc('0x29')]({'plain':!![]});var _0x237c83=_0x28cc('0x2a');return db[_0x28cc('0x2b')][_0x28cc('0x2c')]({'where':{'type':_0x237c83,'resourceId':_0xb2e5da['id']}})['then'](function(){return _0x1642ff;});})[_0x28cc('0x28')](function(){_0x34edc0[_0x28cc('0x1c')](0xcc)[_0x28cc('0x1d')]();});}};}function handleEntityNotFound(_0x57f528,_0x180ea1){return function(_0x567159){if(!_0x567159){_0x57f528[_0x28cc('0x1b')](0x194);}return _0x567159;};}function handleError(_0x7f3c01,_0x3b4279){_0x3b4279=_0x3b4279||0x1f4;return function(_0x17a309){logger['error'](_0x17a309[_0x28cc('0x2d')]);if(_0x17a309[_0x28cc('0x2e')]){delete _0x17a309[_0x28cc('0x2e')];}_0x7f3c01['status'](_0x3b4279)[_0x28cc('0x2f')](_0x17a309);};}exports[_0x28cc('0x30')]=function(_0x18db00,_0x5579f4){var _0x25cc1f={},_0x2ba652={},_0x2a80f5={'count':0x0,'rows':[]};var _0x2a0bc6=_[_0x28cc('0x31')](db[_0x28cc('0x32')]['rawAttributes'],function(_0x1de08a){return{'name':_0x1de08a[_0x28cc('0x33')],'type':_0x1de08a[_0x28cc('0x34')][_0x28cc('0x35')]};});_0x2ba652[_0x28cc('0x36')]=_[_0x28cc('0x31')](_0x2a0bc6,_0x28cc('0x2e'));_0x2ba652[_0x28cc('0x37')]=_[_0x28cc('0x38')](_0x18db00[_0x28cc('0x37')]);_0x2ba652[_0x28cc('0x39')]=_[_0x28cc('0x3a')](_0x2ba652[_0x28cc('0x36')],_0x2ba652['query']);_0x25cc1f[_0x28cc('0x3b')]=_[_0x28cc('0x3a')](_0x2ba652['model'],qs[_0x28cc('0x3c')](_0x18db00[_0x28cc('0x37')][_0x28cc('0x3c')]));_0x25cc1f[_0x28cc('0x3b')]=_0x25cc1f[_0x28cc('0x3b')]['length']?_0x25cc1f[_0x28cc('0x3b')]:_0x2ba652[_0x28cc('0x36')];if(!_0x18db00['query'][_0x28cc('0x3d')](_0x28cc('0x3e'))){_0x25cc1f[_0x28cc('0x20')]=qs['limit'](_0x18db00[_0x28cc('0x37')][_0x28cc('0x20')]);_0x25cc1f[_0x28cc('0x22')]=qs[_0x28cc('0x22')](_0x18db00[_0x28cc('0x37')]['offset']);}_0x25cc1f[_0x28cc('0x3f')]=qs[_0x28cc('0x40')](_0x18db00['query'][_0x28cc('0x40')]);_0x25cc1f[_0x28cc('0x41')]=qs[_0x28cc('0x39')](_[_0x28cc('0x42')](_0x18db00['query'],_0x2ba652[_0x28cc('0x39')]),_0x2a0bc6);if(_0x18db00[_0x28cc('0x37')][_0x28cc('0x43')]){_0x25cc1f['where']=_[_0x28cc('0x44')](_0x25cc1f[_0x28cc('0x41')],{'$or':_[_0x28cc('0x31')](_0x2a0bc6,function(_0x2931ed){if(_0x2931ed[_0x28cc('0x34')]!==_0x28cc('0x45')){var _0x20bd2a={};_0x20bd2a[_0x2931ed[_0x28cc('0x2e')]]={'$like':'%'+_0x18db00[_0x28cc('0x37')][_0x28cc('0x43')]+'%'};return _0x20bd2a;}})});}_0x25cc1f=_[_0x28cc('0x44')]({},_0x25cc1f,_0x18db00[_0x28cc('0x46')]);var _0x4e4838={'where':_0x25cc1f[_0x28cc('0x41')]};return db['CmContactHasItem'][_0x28cc('0x21')](_0x4e4838)[_0x28cc('0x28')](function(_0x1b1324){_0x2a80f5['count']=_0x1b1324;if(_0x18db00[_0x28cc('0x37')][_0x28cc('0x47')]){_0x25cc1f[_0x28cc('0x48')]=[{'all':!![]}];}return db[_0x28cc('0x32')]['findAll'](_0x25cc1f);})[_0x28cc('0x28')](function(_0x28a31a){_0x2a80f5[_0x28cc('0x49')]=_0x28a31a;return _0x2a80f5;})[_0x28cc('0x28')](respondWithFilteredResult(_0x5579f4,_0x25cc1f))['catch'](handleError(_0x5579f4,null));};exports['show']=function(_0x2ea0c9,_0x44dbdb){var _0x4fd60a={'raw':!![],'where':{'id':_0x2ea0c9[_0x28cc('0x4a')]['id']}},_0x304838={};_0x304838[_0x28cc('0x36')]=_[_0x28cc('0x38')](db[_0x28cc('0x32')][_0x28cc('0x4b')]);_0x304838['query']=_['keys'](_0x2ea0c9['query']);_0x304838[_0x28cc('0x39')]=_['intersection'](_0x304838[_0x28cc('0x36')],_0x304838['query']);_0x4fd60a[_0x28cc('0x3b')]=_['intersection'](_0x304838[_0x28cc('0x36')],qs[_0x28cc('0x3c')](_0x2ea0c9[_0x28cc('0x37')][_0x28cc('0x3c')]));_0x4fd60a[_0x28cc('0x3b')]=_0x4fd60a[_0x28cc('0x3b')][_0x28cc('0x4c')]?_0x4fd60a['attributes']:_0x304838[_0x28cc('0x36')];if(_0x2ea0c9[_0x28cc('0x37')][_0x28cc('0x47')]){_0x4fd60a[_0x28cc('0x48')]=[{'all':!![]}];}_0x4fd60a=_['merge']({},_0x4fd60a,_0x2ea0c9[_0x28cc('0x46')]);return db[_0x28cc('0x32')]['find'](_0x4fd60a)[_0x28cc('0x28')](handleEntityNotFound(_0x44dbdb,null))['then'](respondWithResult(_0x44dbdb,null))[_0x28cc('0x4d')](handleError(_0x44dbdb,null));};exports[_0x28cc('0x4e')]=function(_0x4e46e5,_0x29d38f){return db[_0x28cc('0x32')]['create'](_0x4e46e5[_0x28cc('0x4f')],{})[_0x28cc('0x28')](function(_0x49abd8){var _0x330020=_0x4e46e5['user'][_0x28cc('0x29')]({'plain':!![]});if(!_0x330020)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x330020[_0x28cc('0x50')]===_0x28cc('0x51')){var _0x2edb3a=_0x49abd8[_0x28cc('0x29')]({'plain':!![]});var _0x248caa=_0x28cc('0x2a');return db[_0x28cc('0x52')][_0x28cc('0x53')]({'where':{'name':_0x248caa,'userProfileId':_0x330020[_0x28cc('0x54')]},'raw':!![]})['then'](function(_0x37f09a){if(_0x37f09a&&_0x37f09a[_0x28cc('0x55')]===0x0){return db[_0x28cc('0x2b')]['create']({'name':_0x2edb3a['name'],'resourceId':_0x2edb3a['id'],'type':_0x37f09a[_0x28cc('0x2e')],'sectionId':_0x37f09a['id']},{})[_0x28cc('0x28')](function(){return _0x49abd8;});}else{return _0x49abd8;}})[_0x28cc('0x4d')](function(_0x3fd2a0){logger[_0x28cc('0x56')](_0x28cc('0x57'),_0x3fd2a0);throw _0x3fd2a0;});}return _0x49abd8;})[_0x28cc('0x28')](respondWithResult(_0x29d38f,0xc9))['catch'](handleError(_0x29d38f,null));};exports[_0x28cc('0x58')]=function(_0x27ae5b,_0x45927a){if(_0x27ae5b[_0x28cc('0x4f')]['id']){delete _0x27ae5b[_0x28cc('0x4f')]['id'];}return db[_0x28cc('0x32')][_0x28cc('0x53')]({'where':{'id':_0x27ae5b['params']['id']}})[_0x28cc('0x28')](handleEntityNotFound(_0x45927a,null))[_0x28cc('0x28')](saveUpdates(_0x27ae5b['body'],null))[_0x28cc('0x28')](respondWithResult(_0x45927a,null))['catch'](handleError(_0x45927a,null));};exports['destroy']=function(_0x5e2082,_0x2780dc){return db['CmContactHasItem'][_0x28cc('0x53')]({'where':{'id':_0x5e2082[_0x28cc('0x4a')]['id']}})[_0x28cc('0x28')](handleEntityNotFound(_0x2780dc,null))[_0x28cc('0x28')](removeEntity(_0x2780dc,null))[_0x28cc('0x4d')](handleError(_0x2780dc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index df5499f..5d334e9 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 _0x13f1=['define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x13f1,0xb3));var _0x113f=function(_0x4a31eb,_0x8a45a5){_0x4a31eb=_0x4a31eb-0x0;var _0x35e1c1=_0x13f1[_0x4a31eb];return _0x35e1c1;};'use strict';var _=require(_0x113f('0x0'));var util=require('util');var logger=require(_0x113f('0x1'))(_0x113f('0x2'));var moment=require('moment');var BPromise=require(_0x113f('0x3'));var rp=require(_0x113f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x113f('0x5'));var config=require(_0x113f('0x6'));var attributes=require('./cmContactHasItem.attributes');module[_0x113f('0x7')]=function(_0x508e2a,_0x2961e4){return _0x508e2a[_0x113f('0x8')](_0x113f('0x9'),attributes,{'tableName':_0x113f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8375=['exports','define','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes'];(function(_0x2aee0a,_0x27074e){var _0x201ac2=function(_0x5cfc4c){while(--_0x5cfc4c){_0x2aee0a['push'](_0x2aee0a['shift']());}};_0x201ac2(++_0x27074e);}(_0x8375,0x1a4));var _0x5837=function(_0x5797f4,_0x5e6188){_0x5797f4=_0x5797f4-0x0;var _0x4375b3=_0x8375[_0x5797f4];return _0x4375b3;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var logger=require(_0x5837('0x1'))(_0x5837('0x2'));var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require('../../config/environment');var attributes=require(_0x5837('0x8'));module[_0x5837('0x9')]=function(_0x3de06a,_0x2128cf){return _0x3de06a[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':_0x5837('0xc'),'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 ca48b18..4107401 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 _0x2bd7=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xf8f6f1,_0x551483){var _0x51db61=function(_0x31f8af){while(--_0x31f8af){_0xf8f6f1['push'](_0xf8f6f1['shift']());}};_0x51db61(++_0x551483);}(_0x2bd7,0x192));var _0x72bd=function(_0x18179e,_0x25a7ef){_0x18179e=_0x18179e-0x0;var _0x1b862a=_0x2bd7[_0x18179e];return _0x1b862a;};'use strict';var _=require(_0x72bd('0x0'));var util=require(_0x72bd('0x1'));var moment=require(_0x72bd('0x2'));var BPromise=require(_0x72bd('0x3'));var rs=require(_0x72bd('0x4'));var fs=require('fs');var Redis=require(_0x72bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x72bd('0x6'))(_0x72bd('0x7'));var config=require(_0x72bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x72bd('0x9')][_0x72bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca6c8,_0x12291a,_0x2e9667){return new BPromise(function(_0x175f13,_0xbe53d9){return client['request'](_0x5ca6c8,_0x2e9667)[_0x72bd('0xb')](function(_0x6c2de8){logger[_0x72bd('0xc')](_0x72bd('0xd'),_0x12291a,'request\x20sent');logger[_0x72bd('0xe')](_0x72bd('0xf'),_0x12291a,_0x72bd('0x10'),JSON['stringify'](_0x6c2de8));if(_0x6c2de8[_0x72bd('0x11')]){if(_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x12')]===0x1f4){logger['error'](_0x72bd('0xd'),_0x12291a,_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x13')]);return _0xbe53d9(_0x6c2de8['error']['message']);}logger[_0x72bd('0x11')](_0x72bd('0xd'),_0x12291a,_0x6c2de8[_0x72bd('0x11')][_0x72bd('0x13')]);return _0x175f13(_0x6c2de8['error']['message']);}else{logger[_0x72bd('0xc')](_0x72bd('0xd'),_0x12291a,_0x72bd('0x10'));_0x175f13(_0x6c2de8['result'][_0x72bd('0x13')]);}})['catch'](function(_0x2d2282){logger['error'](_0x72bd('0xd'),_0x12291a,_0x2d2282);_0xbe53d9(_0x2d2282);});});} \ No newline at end of file +var _0xfb3c=['../../config/logger','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c2fe7,_0x435b24){var _0x283d18=function(_0x3421a6){while(--_0x3421a6){_0x2c2fe7['push'](_0x2c2fe7['shift']());}};_0x283d18(++_0x435b24);}(_0xfb3c,0x18a));var _0xcfb3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xfb3c[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0xcfb3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcfb3('0x1'));var fs=require('fs');var Redis=require(_0xcfb3('0x2'));var db=require(_0xcfb3('0x3'))['db'];var utils=require(_0xcfb3('0x4'));var logger=require(_0xcfb3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfb3('0x6'));var client=jayson[_0xcfb3('0x7')][_0xcfb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e272a,_0x26d5c5,_0xcce10d){return new BPromise(function(_0x444729,_0x226b8a){return client[_0xcfb3('0x9')](_0x2e272a,_0xcce10d)[_0xcfb3('0xa')](function(_0xbf4f41){logger['info'](_0xcfb3('0xb'),_0x26d5c5,'request\x20sent');logger[_0xcfb3('0xc')](_0xcfb3('0xd'),_0x26d5c5,'request\x20sent',JSON['stringify'](_0xbf4f41));if(_0xbf4f41[_0xcfb3('0xe')]){if(_0xbf4f41[_0xcfb3('0xe')]['code']===0x1f4){logger[_0xcfb3('0xe')](_0xcfb3('0xb'),_0x26d5c5,_0xbf4f41['error']['message']);return _0x226b8a(_0xbf4f41['error'][_0xcfb3('0xf')]);}logger[_0xcfb3('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x26d5c5,_0xbf4f41[_0xcfb3('0xe')][_0xcfb3('0xf')]);return _0x444729(_0xbf4f41[_0xcfb3('0xe')]['message']);}else{logger[_0xcfb3('0x10')](_0xcfb3('0xb'),_0x26d5c5,'request\x20sent');_0x444729(_0xbf4f41[_0xcfb3('0x11')][_0xcfb3('0xf')]);}})[_0xcfb3('0x12')](function(_0x2bed46){logger['error'](_0xcfb3('0xb'),_0x26d5c5,_0x2bed46);_0x226b8a(_0x2bed46);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ac5ffd7..4deb8b8 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 _0x316b=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x316b,0x17e));var _0xb316=function(_0x369289,_0xb779d8){_0x369289=_0x369289-0x0;var _0x1c8ba4=_0x316b[_0x369289];return _0x1c8ba4;};'use strict';var multer=require(_0xb316('0x0'));var util=require('util');var path=require(_0xb316('0x1'));var timeout=require('connect-timeout');var express=require(_0xb316('0x2'));var router=express[_0xb316('0x3')]();var fs_extra=require(_0xb316('0x4'));var auth=require(_0xb316('0x5'));var interaction=require(_0xb316('0x6'));var config=require(_0xb316('0x7'));var controller=require(_0xb316('0x8'));router['get']('/',auth[_0xb316('0x9')](),controller[_0xb316('0xa')]);router[_0xb316('0xb')](_0xb316('0xc'),auth['isAuthenticated'](),controller[_0xb316('0xd')]);router[_0xb316('0xe')]('/',auth['isAuthenticated'](),controller[_0xb316('0xf')]);router[_0xb316('0x10')](_0xb316('0xc'),auth[_0xb316('0x9')](),controller['update']);router[_0xb316('0x11')](_0xb316('0xc'),auth[_0xb316('0x9')](),controller[_0xb316('0x12')]);module[_0xb316('0x13')]=router; \ No newline at end of file +var _0x1312=['util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x1f6c14,_0x2d984f){var _0x4aafc1=function(_0x2fe5fd){while(--_0x2fe5fd){_0x1f6c14['push'](_0x1f6c14['shift']());}};_0x4aafc1(++_0x2d984f);}(_0x1312,0x167));var _0x2131=function(_0x2b559d,_0x1b3307){_0x2b559d=_0x2b559d-0x0;var _0x25d03a=_0x1312[_0x2b559d];return _0x25d03a;};'use strict';var multer=require(_0x2131('0x0'));var util=require(_0x2131('0x1'));var path=require(_0x2131('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2131('0x3')]();var fs_extra=require(_0x2131('0x4'));var auth=require(_0x2131('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2131('0x6'));var controller=require(_0x2131('0x7'));router[_0x2131('0x8')]('/',auth[_0x2131('0x9')](),controller['index']);router[_0x2131('0x8')](_0x2131('0xa'),auth[_0x2131('0x9')](),controller[_0x2131('0xb')]);router[_0x2131('0xc')]('/',auth[_0x2131('0x9')](),controller[_0x2131('0xd')]);router[_0x2131('0xe')](_0x2131('0xa'),auth[_0x2131('0x9')](),controller['update']);router[_0x2131('0xf')](_0x2131('0xa'),auth['isAuthenticated'](),controller[_0x2131('0x10')]);module[_0x2131('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 9f9703f..5a0a04d 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 _0x7c9c=['TEXT','long','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name'];(function(_0x393ab1,_0x6491b4){var _0x418b71=function(_0x23d013){while(--_0x23d013){_0x393ab1['push'](_0x393ab1['shift']());}};_0x418b71(++_0x6491b4);}(_0x7c9c,0x98));var _0xc7c9=function(_0x4f51cb,_0x3d7bd4){_0x4f51cb=_0x4f51cb-0x0;var _0x4b34b1=_0x7c9c[_0x4f51cb];return _0x4b34b1;};'use strict';var Sequelize=require(_0xc7c9('0x0'));var _=require(_0xc7c9('0x1'));module['exports']={'name':{'type':Sequelize[_0xc7c9('0x2')],'get':function(_0x168e1d){return this[_0xc7c9('0x3')](_0xc7c9('0x4'));}},'alias':{'type':Sequelize[_0xc7c9('0x5')],'allowNull':![],'set':function(_0x459cc0){this[_0xc7c9('0x6')](_0xc7c9('0x4'),_0x459cc0?_0x459cc0:this['getDataValue'](_0xc7c9('0x7')));}},'type':{'type':Sequelize[_0xc7c9('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xc7c9('0x8')](_0xc7c9('0x9')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON[_0xc7c9('0xa')](this[_0xc7c9('0x3')](_0xc7c9('0xb')));}else{return this[_0xc7c9('0x3')](_0xc7c9('0xb'));}},'set':function(_0x224cd0){if(Array[_0xc7c9('0xc')](_0x224cd0)){this['setDataValue'](_0xc7c9('0xb'),JSON['stringify'](_0x224cd0));}else{this['setDataValue'](_0xc7c9('0xb'),_0x224cd0);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc7c9('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc7c9('0xe')](_0xc7c9('0xf'))}}; \ No newline at end of file +var _0x7bf0=['select','values','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','type'];(function(_0x4fbb2d,_0x396fa2){var _0x3f886b=function(_0x12e990){while(--_0x12e990){_0x4fbb2d['push'](_0x4fbb2d['shift']());}};_0x3f886b(++_0x396fa2);}(_0x7bf0,0x66));var _0x07bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bf0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x07bf('0x0'));module[_0x07bf('0x1')]={'name':{'type':Sequelize[_0x07bf('0x2')],'get':function(_0x1c8a80){return this[_0x07bf('0x3')](_0x07bf('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5ec1e0){this[_0x07bf('0x5')]('alias',_0x5ec1e0?_0x5ec1e0:this[_0x07bf('0x3')](_0x07bf('0x6')));}},'type':{'type':Sequelize[_0x07bf('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x07bf('0x8')]('long'),'get':function(){if(this[_0x07bf('0x3')](_0x07bf('0x9'))===_0x07bf('0xa')){return JSON['parse'](this[_0x07bf('0x3')](_0x07bf('0xb')));}else{return this['getDataValue'](_0x07bf('0xb'));}},'set':function(_0x24f07a){if(Array['isArray'](_0x24f07a)){this[_0x07bf('0x5')](_0x07bf('0xb'),JSON[_0x07bf('0xc')](_0x24f07a));}else{this[_0x07bf('0x5')](_0x07bf('0xb'),_0x24f07a);}}},'required':{'type':Sequelize[_0x07bf('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x07bf('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x07bf('0xe')](_0x07bf('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4708c05..aef434b 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 _0x4680=['Content-Range','apply','reject','destroy','then','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','fields','length','find','sequelize','create','body','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4680,0x1d9));var _0x0468=function(_0x138151,_0x4c8480){_0x138151=_0x138151-0x0;var _0x31717e=_0x4680[_0x138151];return _0x31717e;};'use strict';var emlformat=require(_0x0468('0x0'));var rimraf=require(_0x0468('0x1'));var zipdir=require(_0x0468('0x2'));var jsonpatch=require(_0x0468('0x3'));var rp=require('request-promise');var moment=require(_0x0468('0x4'));var BPromise=require(_0x0468('0x5'));var Mustache=require('mustache');var util=require(_0x0468('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0468('0x7'));var ejs=require(_0x0468('0x8'));var fs=require('fs');var fs_extra=require(_0x0468('0x9'));var _=require(_0x0468('0xa'));var squel=require(_0x0468('0xb'));var crypto=require(_0x0468('0xc'));var jsforce=require(_0x0468('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0468('0x7'));var querystring=require(_0x0468('0xe'));var Papa=require(_0x0468('0xf'));var Redis=require(_0x0468('0x10'));var authService=require(_0x0468('0x11'));var qs=require(_0x0468('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0468('0x13'));var logger=require(_0x0468('0x14'))('api');var utils=require(_0x0468('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0468('0x16'))['db'];function respondWithStatusCode(_0x3b36d5,_0x19bc34){_0x19bc34=_0x19bc34||0xcc;return function(_0x58a0c8){if(_0x58a0c8){return _0x3b36d5[_0x0468('0x17')](_0x19bc34);}return _0x3b36d5['status'](_0x19bc34)[_0x0468('0x18')]();};}function respondWithResult(_0x3aeffa,_0xab9fad){_0xab9fad=_0xab9fad||0xc8;return function(_0x4bfb13){if(_0x4bfb13){return _0x3aeffa['status'](_0xab9fad)[_0x0468('0x19')](_0x4bfb13);}};}function respondWithFilteredResult(_0x56d59b,_0x2bc69f){return function(_0x651423){if(_0x651423){var _0x5051a8=typeof _0x2bc69f[_0x0468('0x1a')]===_0x0468('0x1b')&&typeof _0x2bc69f['limit']==='undefined';var _0x34b7b1=_0x651423[_0x0468('0x1c')];var _0x918bf5=_0x5051a8?0x0:_0x2bc69f[_0x0468('0x1a')];var _0x2756dc=_0x5051a8?_0x651423[_0x0468('0x1c')]:_0x2bc69f[_0x0468('0x1a')]+_0x2bc69f['limit'];var _0xf8c1ed;if(_0x2756dc>=_0x34b7b1){_0x2756dc=_0x34b7b1;_0xf8c1ed=0xc8;}else{_0xf8c1ed=0xce;}_0x56d59b[_0x0468('0x1d')](_0xf8c1ed);return _0x56d59b[_0x0468('0x1e')](_0x0468('0x1f'),_0x918bf5+'-'+_0x2756dc+'/'+_0x34b7b1)[_0x0468('0x19')](_0x651423);}return null;};}function patchUpdates(_0x12a264){return function(_0x56019d){try{jsonpatch[_0x0468('0x20')](_0x56019d,_0x12a264,!![]);}catch(_0x4de9c6){return BPromise[_0x0468('0x21')](_0x4de9c6);}return _0x56019d['save']();};}function saveUpdates(_0x1e76d9,_0x58a3e7){return function(_0x53e4c5){if(_0x53e4c5){return _0x53e4c5['update'](_0x1e76d9)['then'](function(_0x18502e){return _0x18502e;});}return null;};}function removeEntity(_0x1d471a,_0x4cf96b){return function(_0x516f50){if(_0x516f50){return _0x516f50[_0x0468('0x22')]()[_0x0468('0x23')](function(){_0x1d471a['status'](0xcc)[_0x0468('0x18')]();});}};}function handleEntityNotFound(_0x44f103,_0x585030){return function(_0x1efbd7){if(!_0x1efbd7){_0x44f103['sendStatus'](0x194);}return _0x1efbd7;};}function handleError(_0x2e4c7c,_0x2cb3ba){_0x2cb3ba=_0x2cb3ba||0x1f4;return function(_0x3e1650){logger[_0x0468('0x24')](_0x3e1650['stack']);if(_0x3e1650[_0x0468('0x25')]){delete _0x3e1650[_0x0468('0x25')];}_0x2e4c7c[_0x0468('0x1d')](_0x2cb3ba)[_0x0468('0x26')](_0x3e1650);};}exports[_0x0468('0x27')]=function(_0x17e990,_0x4ffa95){var _0x1a876a={},_0x39ff4d={},_0x953a86={'count':0x0,'rows':[]};var _0x528637=_[_0x0468('0x28')](db[_0x0468('0x29')][_0x0468('0x2a')],function(_0x38755d){return{'name':_0x38755d[_0x0468('0x2b')],'type':_0x38755d[_0x0468('0x2c')][_0x0468('0x2d')]};});_0x39ff4d[_0x0468('0x2e')]=_[_0x0468('0x2f')](_[_0x0468('0x28')](_0x528637,'name'),[_0x0468('0x25')]);_0x39ff4d['query']=_[_0x0468('0x30')](_0x17e990[_0x0468('0x31')]);_0x39ff4d[_0x0468('0x32')]=_[_0x0468('0x33')](_0x39ff4d[_0x0468('0x2e')],_0x39ff4d[_0x0468('0x31')]);_0x1a876a['attributes']=_['intersection'](_0x39ff4d[_0x0468('0x2e')],qs['fields'](_0x17e990[_0x0468('0x31')]['fields']));_0x1a876a[_0x0468('0x34')]=_0x1a876a[_0x0468('0x34')]['length']?_0x1a876a[_0x0468('0x34')]:_0x39ff4d['model'];if(!_0x17e990[_0x0468('0x31')]['hasOwnProperty'](_0x0468('0x35'))){_0x1a876a[_0x0468('0x36')]=qs[_0x0468('0x36')](_0x17e990['query'][_0x0468('0x36')]);_0x1a876a[_0x0468('0x1a')]=qs[_0x0468('0x1a')](_0x17e990[_0x0468('0x31')][_0x0468('0x1a')]);}_0x1a876a[_0x0468('0x37')]=qs[_0x0468('0x38')](_0x17e990['query'][_0x0468('0x38')]);_0x1a876a[_0x0468('0x39')]=qs['filters'](_['pick'](_0x17e990[_0x0468('0x31')],_0x39ff4d[_0x0468('0x32')]),_0x528637);if(_0x17e990['query'][_0x0468('0x3a')]){_0x1a876a['where']=_[_0x0468('0x3b')](_0x1a876a['where'],{'$or':_[_0x0468('0x28')](_0x528637,function(_0xef6b22){if(_0xef6b22['type']!=='VIRTUAL'){var _0x31da38={};_0x31da38[_0xef6b22[_0x0468('0x25')]]={'$like':'%'+_0x17e990[_0x0468('0x31')]['filter']+'%'};return _0x31da38;}})});}_0x1a876a=_[_0x0468('0x3b')]({},_0x1a876a,_0x17e990[_0x0468('0x3c')]);var _0x4cd6f8={'where':_0x1a876a[_0x0468('0x39')]};return db['CmCustomField'][_0x0468('0x1c')](_0x4cd6f8)[_0x0468('0x23')](function(_0x343cd3){_0x953a86[_0x0468('0x1c')]=_0x343cd3;if(_0x17e990['query'][_0x0468('0x3d')]){_0x1a876a[_0x0468('0x3e')]=[{'all':!![]}];}return db[_0x0468('0x29')]['findAll'](_0x1a876a);})[_0x0468('0x23')](function(_0x450311){_0x953a86[_0x0468('0x3f')]=_0x450311;return _0x953a86;})[_0x0468('0x23')](respondWithFilteredResult(_0x4ffa95,_0x1a876a))[_0x0468('0x40')](handleError(_0x4ffa95,null));};exports[_0x0468('0x41')]=function(_0x40af25,_0x34c6ea){var _0x499195={'raw':!![],'where':{'id':_0x40af25[_0x0468('0x42')]['id']}},_0x488eb8={};_0x488eb8[_0x0468('0x2e')]=_['keys'](db['CmCustomField'][_0x0468('0x2a')]);_0x488eb8[_0x0468('0x31')]=_[_0x0468('0x30')](_0x40af25[_0x0468('0x31')]);_0x488eb8[_0x0468('0x32')]=_[_0x0468('0x33')](_0x488eb8[_0x0468('0x2e')],_0x488eb8[_0x0468('0x31')]);_0x499195['attributes']=_[_0x0468('0x33')](_0x488eb8[_0x0468('0x2e')],qs['fields'](_0x40af25['query'][_0x0468('0x43')]));_0x499195[_0x0468('0x34')]=_0x499195[_0x0468('0x34')][_0x0468('0x44')]?_0x499195[_0x0468('0x34')]:_0x488eb8[_0x0468('0x2e')];if(_0x40af25['query'][_0x0468('0x3d')]){_0x499195[_0x0468('0x3e')]=[{'all':!![]}];}_0x499195=_['merge']({},_0x499195,_0x40af25[_0x0468('0x3c')]);return db[_0x0468('0x29')][_0x0468('0x45')](_0x499195)[_0x0468('0x23')](handleEntityNotFound(_0x34c6ea,null))['then'](respondWithResult(_0x34c6ea,null))['catch'](handleError(_0x34c6ea,null));};exports['update']=function(_0x3240ac,_0x22aa78){if(_0x3240ac['body']['id']){delete _0x3240ac['body']['id'];}return db['CmCustomField'][_0x0468('0x45')]({'where':{'id':_0x3240ac[_0x0468('0x42')]['id']}})[_0x0468('0x23')](handleEntityNotFound(_0x22aa78,null))[_0x0468('0x23')](saveUpdates(_0x3240ac['body'],null))[_0x0468('0x23')](respondWithResult(_0x22aa78,null))[_0x0468('0x40')](handleError(_0x22aa78,null));};exports[_0x0468('0x22')]=function(_0x10c17d,_0x10c6c7){return db[_0x0468('0x29')][_0x0468('0x45')]({'where':{'id':_0x10c17d[_0x0468('0x42')]['id']}})[_0x0468('0x23')](handleEntityNotFound(_0x10c6c7,null))[_0x0468('0x23')](removeEntity(_0x10c6c7,null))[_0x0468('0x40')](handleError(_0x10c6c7,null));};exports['create']=function(_0x104567,_0x5c9969){var _0x1daa1e;return db[_0x0468('0x46')]['transaction'](function(_0x31b845){return db['CmCustomField'][_0x0468('0x47')](_0x104567[_0x0468('0x48')],{'transaction':_0x31b845})[_0x0468('0x23')](function(_0xc867){_0x1daa1e=_0xc867;var _0x2ea7f2={'type':db[_0x0468('0x49')][_0x0468('0x4a')],'transaction':_0x31b845};switch(_0x104567[_0x0468('0x48')][_0x0468('0x2c')]){case _0x0468('0x4b'):_0x2ea7f2[_0x0468('0x2c')]=db['Sequelize'][_0x0468('0x4a')];break;case'number':_0x2ea7f2['type']=db[_0x0468('0x49')][_0x0468('0x4c')];break;case _0x0468('0x4d'):_0x2ea7f2[_0x0468('0x2c')]=db[_0x0468('0x49')][_0x0468('0x4e')];_0x2ea7f2[_0x0468('0x4f')]=![];break;default:}return db[_0x0468('0x46')]['queryInterface'][_0x0468('0x50')](_0x0468('0x51'),util[_0x0468('0x52')](_0x0468('0x53'),_0x1daa1e['id']),_0x2ea7f2);})[_0x0468('0x23')](function(){return _0x1daa1e;});})[_0x0468('0x23')](respondWithResult(_0x5c9969,0xc9))['catch'](handleError(_0x5c9969,null));}; \ No newline at end of file +var _0xb628=['Sequelize','TEXT','type','text','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','reject','save','update','destroy','end','sendStatus','stack','send','index','CmCustomField','rawAttributes','fieldName','key','differenceBy','map','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','then','catch','params','find','body','sequelize','transaction','create'];(function(_0xc285b4,_0x569050){var _0x327c95=function(_0x140aec){while(--_0x140aec){_0xc285b4['push'](_0xc285b4['shift']());}};_0x327c95(++_0x569050);}(_0xb628,0x19b));var _0x8b62=function(_0x1bb410,_0x2db6e1){_0x1bb410=_0x1bb410-0x0;var _0x467d41=_0xb628[_0x1bb410];return _0x467d41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b62('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b62('0x1'));var rp=require(_0x8b62('0x2'));var moment=require(_0x8b62('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8b62('0x4'));var sox=require(_0x8b62('0x5'));var csv=require(_0x8b62('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b62('0x7'));var squel=require(_0x8b62('0x8'));var crypto=require(_0x8b62('0x9'));var jsforce=require(_0x8b62('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8b62('0x6'));var querystring=require('querystring');var Papa=require(_0x8b62('0xb'));var Redis=require('ioredis');var authService=require(_0x8b62('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x8b62('0xd'));var hardwareService=require(_0x8b62('0xe'));var logger=require(_0x8b62('0xf'))(_0x8b62('0x10'));var utils=require(_0x8b62('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8b62('0x12'));var db=require(_0x8b62('0x13'))['db'];function respondWithStatusCode(_0x586a02,_0x53cff6){_0x53cff6=_0x53cff6||0xcc;return function(_0x40fbf9){if(_0x40fbf9){return _0x586a02['sendStatus'](_0x53cff6);}return _0x586a02[_0x8b62('0x14')](_0x53cff6)['end']();};}function respondWithResult(_0x462504,_0x2f72f0){_0x2f72f0=_0x2f72f0||0xc8;return function(_0x56f16b){if(_0x56f16b){return _0x462504[_0x8b62('0x14')](_0x2f72f0)[_0x8b62('0x15')](_0x56f16b);}};}function respondWithFilteredResult(_0x4d339e,_0x2e438d){return function(_0x1bc14c){if(_0x1bc14c){var _0xec975e=typeof _0x2e438d['offset']==='undefined'&&typeof _0x2e438d[_0x8b62('0x16')]===_0x8b62('0x17');var _0x411b49=_0x1bc14c['count'];var _0x2d7e39=_0xec975e?0x0:_0x2e438d['offset'];var _0x19991a=_0xec975e?_0x1bc14c[_0x8b62('0x18')]:_0x2e438d[_0x8b62('0x19')]+_0x2e438d[_0x8b62('0x16')];var _0x2e8a75;if(_0x19991a>=_0x411b49){_0x19991a=_0x411b49;_0x2e8a75=0xc8;}else{_0x2e8a75=0xce;}_0x4d339e[_0x8b62('0x14')](_0x2e8a75);return _0x4d339e[_0x8b62('0x1a')]('Content-Range',_0x2d7e39+'-'+_0x19991a+'/'+_0x411b49)['json'](_0x1bc14c);}return null;};}function patchUpdates(_0x14e564){return function(_0x3f4c61){try{jsonpatch['apply'](_0x3f4c61,_0x14e564,!![]);}catch(_0x122f81){return BPromise[_0x8b62('0x1b')](_0x122f81);}return _0x3f4c61[_0x8b62('0x1c')]();};}function saveUpdates(_0x227e4e,_0x3419ba){return function(_0x34cf2d){if(_0x34cf2d){return _0x34cf2d[_0x8b62('0x1d')](_0x227e4e)['then'](function(_0x4dedc6){return _0x4dedc6;});}return null;};}function removeEntity(_0x39564a,_0x1bf134){return function(_0x1ae868){if(_0x1ae868){return _0x1ae868[_0x8b62('0x1e')]()['then'](function(){_0x39564a['status'](0xcc)[_0x8b62('0x1f')]();});}};}function handleEntityNotFound(_0x3eed6b,_0x4d0658){return function(_0x50c0dd){if(!_0x50c0dd){_0x3eed6b[_0x8b62('0x20')](0x194);}return _0x50c0dd;};}function handleError(_0x4714cc,_0x168b22){_0x168b22=_0x168b22||0x1f4;return function(_0x5b29f4){logger['error'](_0x5b29f4[_0x8b62('0x21')]);if(_0x5b29f4['name']){delete _0x5b29f4['name'];}_0x4714cc['status'](_0x168b22)[_0x8b62('0x22')](_0x5b29f4);};}exports[_0x8b62('0x23')]=function(_0x214700,_0x4320e2){var _0xa3c673={},_0x3f7f08={},_0x2a97b6={'count':0x0,'rows':[]};var _0xac73b8=_['map'](db[_0x8b62('0x24')][_0x8b62('0x25')],function(_0xdb425e){return{'name':_0xdb425e[_0x8b62('0x26')],'type':_0xdb425e['type'][_0x8b62('0x27')]};});_0x3f7f08['model']=_[_0x8b62('0x28')](_[_0x8b62('0x29')](_0xac73b8,_0x8b62('0x2a')),[_0x8b62('0x2a')]);_0x3f7f08[_0x8b62('0x2b')]=_[_0x8b62('0x2c')](_0x214700[_0x8b62('0x2b')]);_0x3f7f08[_0x8b62('0x2d')]=_[_0x8b62('0x2e')](_0x3f7f08['model'],_0x3f7f08[_0x8b62('0x2b')]);_0xa3c673[_0x8b62('0x2f')]=_[_0x8b62('0x2e')](_0x3f7f08[_0x8b62('0x30')],qs[_0x8b62('0x31')](_0x214700['query'][_0x8b62('0x31')]));_0xa3c673[_0x8b62('0x2f')]=_0xa3c673[_0x8b62('0x2f')][_0x8b62('0x32')]?_0xa3c673[_0x8b62('0x2f')]:_0x3f7f08[_0x8b62('0x30')];if(!_0x214700['query'][_0x8b62('0x33')](_0x8b62('0x34'))){_0xa3c673[_0x8b62('0x16')]=qs[_0x8b62('0x16')](_0x214700[_0x8b62('0x2b')][_0x8b62('0x16')]);_0xa3c673[_0x8b62('0x19')]=qs[_0x8b62('0x19')](_0x214700[_0x8b62('0x2b')][_0x8b62('0x19')]);}_0xa3c673[_0x8b62('0x35')]=qs[_0x8b62('0x36')](_0x214700['query'][_0x8b62('0x36')]);_0xa3c673[_0x8b62('0x37')]=qs[_0x8b62('0x2d')](_['pick'](_0x214700[_0x8b62('0x2b')],_0x3f7f08['filters']),_0xac73b8);if(_0x214700[_0x8b62('0x2b')][_0x8b62('0x38')]){_0xa3c673[_0x8b62('0x37')]=_[_0x8b62('0x39')](_0xa3c673[_0x8b62('0x37')],{'$or':_[_0x8b62('0x29')](_0xac73b8,function(_0xb2be1e){if(_0xb2be1e['type']!==_0x8b62('0x3a')){var _0x2d3ed4={};_0x2d3ed4[_0xb2be1e[_0x8b62('0x2a')]]={'$like':'%'+_0x214700['query'][_0x8b62('0x38')]+'%'};return _0x2d3ed4;}})});}_0xa3c673=_[_0x8b62('0x39')]({},_0xa3c673,_0x214700['options']);var _0x1f8550={'where':_0xa3c673[_0x8b62('0x37')]};return db[_0x8b62('0x24')][_0x8b62('0x18')](_0x1f8550)['then'](function(_0x5bc9a3){_0x2a97b6[_0x8b62('0x18')]=_0x5bc9a3;if(_0x214700[_0x8b62('0x2b')][_0x8b62('0x3b')]){_0xa3c673[_0x8b62('0x3c')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0xa3c673);})[_0x8b62('0x3d')](function(_0x2d02ca){_0x2a97b6['rows']=_0x2d02ca;return _0x2a97b6;})[_0x8b62('0x3d')](respondWithFilteredResult(_0x4320e2,_0xa3c673))[_0x8b62('0x3e')](handleError(_0x4320e2,null));};exports['show']=function(_0x53b1e7,_0x53174c){var _0x11b199={'raw':!![],'where':{'id':_0x53b1e7[_0x8b62('0x3f')]['id']}},_0x2debaa={};_0x2debaa[_0x8b62('0x30')]=_[_0x8b62('0x2c')](db[_0x8b62('0x24')][_0x8b62('0x25')]);_0x2debaa[_0x8b62('0x2b')]=_[_0x8b62('0x2c')](_0x53b1e7[_0x8b62('0x2b')]);_0x2debaa['filters']=_['intersection'](_0x2debaa['model'],_0x2debaa['query']);_0x11b199[_0x8b62('0x2f')]=_[_0x8b62('0x2e')](_0x2debaa[_0x8b62('0x30')],qs[_0x8b62('0x31')](_0x53b1e7[_0x8b62('0x2b')]['fields']));_0x11b199['attributes']=_0x11b199['attributes'][_0x8b62('0x32')]?_0x11b199[_0x8b62('0x2f')]:_0x2debaa[_0x8b62('0x30')];if(_0x53b1e7[_0x8b62('0x2b')][_0x8b62('0x3b')]){_0x11b199[_0x8b62('0x3c')]=[{'all':!![]}];}_0x11b199=_[_0x8b62('0x39')]({},_0x11b199,_0x53b1e7['options']);return db['CmCustomField'][_0x8b62('0x40')](_0x11b199)[_0x8b62('0x3d')](handleEntityNotFound(_0x53174c,null))[_0x8b62('0x3d')](respondWithResult(_0x53174c,null))['catch'](handleError(_0x53174c,null));};exports['update']=function(_0xccae22,_0x5506cc){if(_0xccae22[_0x8b62('0x41')]['id']){delete _0xccae22['body']['id'];}return db[_0x8b62('0x24')][_0x8b62('0x40')]({'where':{'id':_0xccae22[_0x8b62('0x3f')]['id']}})[_0x8b62('0x3d')](handleEntityNotFound(_0x5506cc,null))[_0x8b62('0x3d')](saveUpdates(_0xccae22[_0x8b62('0x41')],null))[_0x8b62('0x3d')](respondWithResult(_0x5506cc,null))['catch'](handleError(_0x5506cc,null));};exports[_0x8b62('0x1e')]=function(_0x357592,_0x22edf1){return db[_0x8b62('0x24')][_0x8b62('0x40')]({'where':{'id':_0x357592[_0x8b62('0x3f')]['id']}})['then'](handleEntityNotFound(_0x22edf1,null))[_0x8b62('0x3d')](removeEntity(_0x22edf1,null))[_0x8b62('0x3e')](handleError(_0x22edf1,null));};exports['create']=function(_0x1a4387,_0x3d1177){var _0x15455b;return db[_0x8b62('0x42')][_0x8b62('0x43')](function(_0x2caddc){return db[_0x8b62('0x24')][_0x8b62('0x44')](_0x1a4387[_0x8b62('0x41')],{'transaction':_0x2caddc})['then'](function(_0x3228b3){_0x15455b=_0x3228b3;var _0x491ba8={'type':db[_0x8b62('0x45')][_0x8b62('0x46')],'transaction':_0x2caddc};switch(_0x1a4387[_0x8b62('0x41')][_0x8b62('0x47')]){case _0x8b62('0x48'):_0x491ba8[_0x8b62('0x47')]=db[_0x8b62('0x45')]['TEXT'];break;case _0x8b62('0x49'):_0x491ba8[_0x8b62('0x47')]=db[_0x8b62('0x45')][_0x8b62('0x4a')];break;case _0x8b62('0x4b'):_0x491ba8['type']=db['Sequelize']['BOOLEAN'];_0x491ba8[_0x8b62('0x4c')]=![];break;default:}return db['sequelize'][_0x8b62('0x4d')]['addColumn'](_0x8b62('0x4e'),util[_0x8b62('0x4f')]('cf_%d',_0x15455b['id']),_0x491ba8);})[_0x8b62('0x3d')](function(){return _0x15455b;});})['then'](respondWithResult(_0x3d1177,0xc9))[_0x8b62('0x3e')](handleError(_0x3d1177,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f68d62b..2cf4599 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 _0x4647=['define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x4647,0x1be));var _0x7464=function(_0x21ec1f,_0x39bb8a){_0x21ec1f=_0x21ec1f-0x0;var _0x5c7b62=_0x4647[_0x21ec1f];return _0x5c7b62;};'use strict';var _=require(_0x7464('0x0'));var util=require(_0x7464('0x1'));var logger=require(_0x7464('0x2'))(_0x7464('0x3'));var moment=require(_0x7464('0x4'));var BPromise=require(_0x7464('0x5'));var rp=require(_0x7464('0x6'));var fs=require('fs');var path=require(_0x7464('0x7'));var rimraf=require(_0x7464('0x8'));var config=require('../../config/environment');var attributes=require(_0x7464('0x9'));module['exports']=function(_0x284933,_0xaacf83){return _0x284933[_0x7464('0xa')]('CmCustomField',attributes,{'tableName':_0x7464('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x959f=['./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3a8fb6,_0x52dad8){var _0xe77179=function(_0x10b57f){while(--_0x10b57f){_0x3a8fb6['push'](_0x3a8fb6['shift']());}};_0xe77179(++_0x52dad8);}(_0x959f,0x7d));var _0xf959=function(_0x1fd09f,_0x1e0a0d){_0x1fd09f=_0x1fd09f-0x0;var _0x18869f=_0x959f[_0x1fd09f];return _0x18869f;};'use strict';var _=require('lodash');var util=require(_0xf959('0x0'));var logger=require(_0xf959('0x1'))(_0xf959('0x2'));var moment=require(_0xf959('0x3'));var BPromise=require('bluebird');var rp=require(_0xf959('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf959('0x5'));var config=require(_0xf959('0x6'));var attributes=require(_0xf959('0x7'));module[_0xf959('0x8')]=function(_0x4e2e75,_0x266c1d){return _0x4e2e75['define'](_0xf959('0x9'),attributes,{'tableName':_0xf959('0xa'),'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 6a80ec5..76bf777 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 _0xc88c=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc88c,0xb4));var _0xcc88=function(_0x120c0f,_0x328637){_0x120c0f=_0x120c0f-0x0;var _0x591f2f=_0xc88c[_0x120c0f];return _0x591f2f;};'use strict';var _=require('lodash');var util=require(_0xcc88('0x0'));var moment=require(_0xcc88('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc88('0x2'));var db=require(_0xcc88('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc88('0x4'))(_0xcc88('0x5'));var config=require(_0xcc88('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcc88('0x7')][_0xcc88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x525802,_0x33a28a,_0x4a68b5){return new BPromise(function(_0x1814dd,_0x364034){return client['request'](_0x525802,_0x4a68b5)[_0xcc88('0x9')](function(_0x4c6804){logger['info'](_0xcc88('0xa'),_0x33a28a,_0xcc88('0xb'));logger[_0xcc88('0xc')](_0xcc88('0xd'),_0x33a28a,_0xcc88('0xb'),JSON[_0xcc88('0xe')](_0x4c6804));if(_0x4c6804['error']){if(_0x4c6804[_0xcc88('0xf')]['code']===0x1f4){logger[_0xcc88('0xf')](_0xcc88('0xa'),_0x33a28a,_0x4c6804['error'][_0xcc88('0x10')]);return _0x364034(_0x4c6804['error'][_0xcc88('0x10')]);}logger[_0xcc88('0xf')]('CmCustomField,\x20%s,\x20%s',_0x33a28a,_0x4c6804[_0xcc88('0xf')]['message']);return _0x1814dd(_0x4c6804[_0xcc88('0xf')][_0xcc88('0x10')]);}else{logger['info'](_0xcc88('0xa'),_0x33a28a,_0xcc88('0xb'));_0x1814dd(_0x4c6804[_0xcc88('0x11')][_0xcc88('0x10')]);}})[_0xcc88('0x12')](function(_0x29d048){logger[_0xcc88('0xf')]('CmCustomField,\x20%s,\x20%s',_0x33a28a,_0x29d048);_0x364034(_0x29d048);});});} \ No newline at end of file +var _0x75a6=['then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request'];(function(_0xa112c,_0x5eddac){var _0x27dbc9=function(_0x3d32ab){while(--_0x3d32ab){_0xa112c['push'](_0xa112c['shift']());}};_0x27dbc9(++_0x5eddac);}(_0x75a6,0x6f));var _0x675a=function(_0x48028a,_0x5dc201){_0x48028a=_0x48028a-0x0;var _0x1ec4bc=_0x75a6[_0x48028a];return _0x1ec4bc;};'use strict';var _=require(_0x675a('0x0'));var util=require('util');var moment=require(_0x675a('0x1'));var BPromise=require(_0x675a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x675a('0x3'));var db=require(_0x675a('0x4'))['db'];var utils=require(_0x675a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x675a('0x6'));var client=jayson['client'][_0x675a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b9af8,_0x393a88,_0x220367){return new BPromise(function(_0x267e1d,_0xb4a0e2){return client[_0x675a('0x8')](_0x5b9af8,_0x220367)[_0x675a('0x9')](function(_0x26703a){logger[_0x675a('0xa')](_0x675a('0xb'),_0x393a88,_0x675a('0xc'));logger[_0x675a('0xd')](_0x675a('0xe'),_0x393a88,_0x675a('0xc'),JSON[_0x675a('0xf')](_0x26703a));if(_0x26703a[_0x675a('0x10')]){if(_0x26703a['error'][_0x675a('0x11')]===0x1f4){logger['error'](_0x675a('0xb'),_0x393a88,_0x26703a[_0x675a('0x10')]['message']);return _0xb4a0e2(_0x26703a[_0x675a('0x10')]['message']);}logger[_0x675a('0x10')]('CmCustomField,\x20%s,\x20%s',_0x393a88,_0x26703a['error']['message']);return _0x267e1d(_0x26703a[_0x675a('0x10')][_0x675a('0x12')]);}else{logger[_0x675a('0xa')](_0x675a('0xb'),_0x393a88,_0x675a('0xc'));_0x267e1d(_0x26703a[_0x675a('0x13')]['message']);}})['catch'](function(_0x304d6c){logger[_0x675a('0x10')](_0x675a('0xb'),_0x393a88,_0x304d6c);_0xb4a0e2(_0x304d6c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bd303ae..60f9500 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 _0x0389=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','show','post','put','update','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0389,0x175));var _0x9038=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x0389[_0x3c504b];return _0x2e5354;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var fs_extra=require(_0x9038('0x5'));var auth=require(_0x9038('0x6'));var interaction=require(_0x9038('0x7'));var config=require('../../config/environment');var controller=require(_0x9038('0x8'));router[_0x9038('0x9')]('/',auth[_0x9038('0xa')](),controller['index']);router['get']('/:id',auth[_0x9038('0xa')](),controller[_0x9038('0xb')]);router[_0x9038('0xc')]('/',auth[_0x9038('0xa')](),controller['create']);router[_0x9038('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x9038('0xe')]);router[_0x9038('0xf')]('/:id',auth[_0x9038('0xa')](),controller['destroy']);module[_0x9038('0x10')]=router; \ No newline at end of file +var _0x38e4=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','put','delete','exports','multer','util'];(function(_0xc9e944,_0x1438ba){var _0x130b13=function(_0x31a1b5){while(--_0x31a1b5){_0xc9e944['push'](_0xc9e944['shift']());}};_0x130b13(++_0x1438ba);}(_0x38e4,0x9e));var _0x438e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x38e4[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var path=require('path');var timeout=require(_0x438e('0x2'));var express=require(_0x438e('0x3'));var router=express['Router']();var fs_extra=require(_0x438e('0x4'));var auth=require(_0x438e('0x5'));var interaction=require(_0x438e('0x6'));var config=require('../../config/environment');var controller=require(_0x438e('0x7'));router[_0x438e('0x8')]('/',auth[_0x438e('0x9')](),controller[_0x438e('0xa')]);router[_0x438e('0x8')](_0x438e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x438e('0xc')]);router[_0x438e('0xd')](_0x438e('0xb'),auth[_0x438e('0x9')](),controller['update']);router[_0x438e('0xe')]('/:id',auth[_0x438e('0x9')](),controller['destroy']);module[_0x438e('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c905f34..7247d30 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 _0x3c37=['STRING','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c37,0x14b));var _0x73c3=function(_0x16e8ba,_0x2afffc){_0x16e8ba=_0x16e8ba-0x0;var _0x39493f=_0x3c37[_0x16e8ba];return _0x39493f;};'use strict';var moment=require(_0x73c3('0x0'));var Sequelize=require(_0x73c3('0x1'));module['exports']={'phone':{'type':Sequelize[_0x73c3('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x73c3('0x3'))},'countbusyretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x73c3('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x73c3('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x73c3('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x73c3('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'ListId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'UserId':{'type':Sequelize[_0x73c3('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x73c3('0x4')],'unique':_0x73c3('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x73c3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x73c3('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x94c0=['contactListQueue','sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x94c0,0xf1));var _0x094c=function(_0x574524,_0x114ff8){_0x574524=_0x574524-0x0;var _0x4c6d91=_0x94c0[_0x574524];return _0x4c6d91;};'use strict';var moment=require('moment');var Sequelize=require(_0x094c('0x0'));module[_0x094c('0x1')]={'phone':{'type':Sequelize[_0x094c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x094c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x094c('0x4'))},'countbusyretry':{'type':Sequelize[_0x094c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x094c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x094c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x094c('0x6')]},'priority':{'type':Sequelize[_0x094c('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x094c('0x5')],'unique':_0x094c('0x7')},'ListId':{'type':Sequelize[_0x094c('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x094c('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x094c('0x7')},'CampaignId':{'type':Sequelize[_0x094c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x094c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x094c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x094c('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x094c('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x094c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x094c('0x6')],'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 e4fb0e2..a5fb90d 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 _0xf2cb=['transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','CmCompany','getOpenContacts','format','isNil','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','../../config/environment','json','offset','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','statedesc','deleted','campaign','user','deletedat','campaigntype','queue','ivr','CmContact','ContactId','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2cb,0x130));var _0xbf2c=function(_0x38969c,_0x16de69){_0x38969c=_0x38969c-0x0;var _0x5cc887=_0xf2cb[_0x38969c];return _0x5cc887;};'use strict';var moment=require('moment');var _=require(_0xbf2c('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbf2c('0x1'))('api');var shared=require(_0xbf2c('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1ecb79,_0x41c649){_0x41c649=_0x41c649||0xc8;return function(_0x5abeb3){if(_0x5abeb3){return _0x1ecb79['status'](_0x41c649)[_0xbf2c('0x3')](_0x5abeb3);}};}function respondWithFilteredResult(_0x46d282,_0x1fc371){return function(_0xaacd25){if(_0xaacd25){var _0x516715=typeof _0x1fc371[_0xbf2c('0x4')]==='undefined'&&typeof _0x1fc371[_0xbf2c('0x5')]==='undefined';var _0x5f25ea=_0xaacd25[_0xbf2c('0x6')];var _0x16c303=_0x516715?0x0:_0x1fc371[_0xbf2c('0x4')];var _0x5e10f4=_0x516715?_0xaacd25[_0xbf2c('0x6')]:_0x1fc371[_0xbf2c('0x4')]+_0x1fc371[_0xbf2c('0x5')];var _0x27be1c;if(_0x5e10f4>=_0x5f25ea){_0x5e10f4=_0x5f25ea;_0x27be1c=0xc8;}else{_0x27be1c=0xce;}_0x46d282[_0xbf2c('0x7')](_0x27be1c);return _0x46d282[_0xbf2c('0x8')](_0xbf2c('0x9'),_0x16c303+'-'+_0x5e10f4+'/'+_0x5f25ea)[_0xbf2c('0x3')](_0xaacd25);}return null;};}function saveUpdates(_0x52983d,_0x149235){return function(_0x294d0d){if(_0x294d0d){return _0x294d0d[_0xbf2c('0xa')](_0x52983d)[_0xbf2c('0xb')](function(_0x5220e2){return _0x5220e2;});}return null;};}function handleEntityNotFound(_0x7665b1,_0x5a160b){return function(_0x557740){if(!_0x557740){_0x7665b1[_0xbf2c('0xc')](0x194);}return _0x557740;};}function handleError(_0x4f58c7,_0x47df49){_0x47df49=_0x47df49||0x1f4;return function(_0x3ed1c3){logger[_0xbf2c('0xd')](_0x3ed1c3[_0xbf2c('0xe')]);if(_0x3ed1c3[_0xbf2c('0xf')]){delete _0x3ed1c3[_0xbf2c('0xf')];}_0x4f58c7['status'](_0x47df49)[_0xbf2c('0x10')](_0x3ed1c3);};}exports['index']=function(_0x4ced7f,_0x1df2ab){var _0x298329={},_0x32a44d={},_0x266035={'count':0x0,'rows':[]};var _0x57e01a=_[_0xbf2c('0x11')](db[_0xbf2c('0x12')][_0xbf2c('0x13')],function(_0x5353e7){return{'name':_0x5353e7[_0xbf2c('0x14')],'type':_0x5353e7[_0xbf2c('0x15')][_0xbf2c('0x16')]};});_0x32a44d['model']=_[_0xbf2c('0x11')](_0x57e01a,_0xbf2c('0xf'));_0x32a44d[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x4ced7f['query']);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x32a44d['model'],_0x32a44d[_0xbf2c('0x17')]);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1b')](_0x32a44d['filters'],['$and',_0xbf2c('0x1c'),_0xbf2c('0x1d'),_0xbf2c('0x1e'),_0xbf2c('0x1f'),_0xbf2c('0x20'),_0xbf2c('0x21'),_0xbf2c('0x22'),'$not','$between',_0xbf2c('0x23'),_0xbf2c('0x24'),_0xbf2c('0x25'),_0xbf2c('0x26'),_0xbf2c('0x27'),_0xbf2c('0x28'),_0xbf2c('0x29'),_0xbf2c('0x26'),_0xbf2c('0x2a'),'$contains',_0xbf2c('0x2b'),'$any']);_0x298329[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x32a44d[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x4ced7f[_0xbf2c('0x17')]['fields']));_0x298329[_0xbf2c('0x2c')]=_0x298329[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x298329[_0xbf2c('0x2c')]:_0x32a44d[_0xbf2c('0x2d')];if(!_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x30')](_0xbf2c('0x31'))){_0x298329['limit']=qs[_0xbf2c('0x5')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x5')]);_0x298329['offset']=qs['offset'](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x4')]);}_0x298329[_0xbf2c('0x32')]=qs[_0xbf2c('0x33')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x33')]);_0x298329[_0xbf2c('0x34')]=qs[_0xbf2c('0x19')](_[_0xbf2c('0x35')](_0x4ced7f['query'],_0x32a44d[_0xbf2c('0x19')]),_0x57e01a);if(_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x36')]){_0x298329[_0xbf2c('0x34')]=_[_0xbf2c('0x37')](_0x298329[_0xbf2c('0x34')],{'$or':_[_0xbf2c('0x11')](_0x57e01a,function(_0x4722b3){if(_0x4722b3['type']!==_0xbf2c('0x38')){var _0x475594={};_0x475594[_0x4722b3[_0xbf2c('0xf')]]={'$like':'%'+_0x4ced7f['query'][_0xbf2c('0x36')]+'%'};return _0x475594;}})});}_0x298329=_[_0xbf2c('0x37')]({},_0x298329,_0x4ced7f[_0xbf2c('0x39')]);var _0x5402ff={'where':_0x298329[_0xbf2c('0x34')]};return db[_0xbf2c('0x12')]['count'](_0x5402ff)['then'](function(_0x47ab9a){_0x266035['count']=_0x47ab9a;if(_0x4ced7f['query'][_0xbf2c('0x3a')]){_0x298329[_0xbf2c('0x3b')]=[{'all':!![]}];}return db[_0xbf2c('0x12')][_0xbf2c('0x3c')](_0x298329);})[_0xbf2c('0xb')](function(_0x16fbd5){_0x266035[_0xbf2c('0x3d')]=_0x16fbd5;return _0x266035;})[_0xbf2c('0xb')](respondWithFilteredResult(_0x1df2ab,_0x298329))[_0xbf2c('0x3e')](handleError(_0x1df2ab,null));};exports[_0xbf2c('0x3f')]=function(_0x245eaf,_0x99abc8){var _0x3fbf90={'raw':!![],'where':{'id':_0x245eaf[_0xbf2c('0x40')]['id']}},_0x1eac50={};_0x1eac50[_0xbf2c('0x2d')]=_['keys'](db[_0xbf2c('0x12')][_0xbf2c('0x13')]);_0x1eac50[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x245eaf[_0xbf2c('0x17')]);_0x1eac50[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],_0x1eac50['query']);_0x3fbf90[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x245eaf['query'][_0xbf2c('0x2e')]));_0x3fbf90['attributes']=_0x3fbf90[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x3fbf90[_0xbf2c('0x2c')]:_0x1eac50[_0xbf2c('0x2d')];if(_0x245eaf[_0xbf2c('0x17')][_0xbf2c('0x3a')]){_0x3fbf90['include']=[{'all':!![]}];}_0x3fbf90=_[_0xbf2c('0x37')]({},_0x3fbf90,_0x245eaf['options']);return db['CmHopper'][_0xbf2c('0x41')](_0x3fbf90)['then'](handleEntityNotFound(_0x99abc8,null))['then'](respondWithResult(_0x99abc8,null))[_0xbf2c('0x3e')](handleError(_0x99abc8,null));};exports[_0xbf2c('0x42')]=function(_0x56fc01,_0x403568){return db['CmHopper'][_0xbf2c('0x42')](_0x56fc01['body'],{})[_0xbf2c('0xb')](respondWithResult(_0x403568,0xc9))[_0xbf2c('0x3e')](handleError(_0x403568,null));};exports[_0xbf2c('0xa')]=function(_0x343255,_0x222721){if(_0x343255[_0xbf2c('0x43')]['id']){delete _0x343255['body']['id'];}return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x343255[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x222721,null))[_0xbf2c('0xb')](saveUpdates(_0x343255['body'],null))['then'](respondWithResult(_0x222721,null))[_0xbf2c('0x3e')](handleError(_0x222721,null));};exports['describe']=function(_0xa08482,_0x1c64e0){return db[_0xbf2c('0x12')][_0xbf2c('0x44')]()[_0xbf2c('0xb')](respondWithResult(_0x1c64e0,null))[_0xbf2c('0x3e')](handleError(_0x1c64e0,null));};exports[_0xbf2c('0x45')]=function(_0x1c3b78,_0x128e97){var _0x23912d;var _0x31791b=_0x1c3b78['params']['id'];return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x1c3b78[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x128e97,null))['then'](function(_0x4edca4){if(_0x4edca4){return _0x4edca4['destroy']()[_0xbf2c('0xb')](function(_0x2451ba){return _0x2451ba;});}})['then'](function(_0x5a0c37){_0x23912d=_0x5a0c37;if(_0x5a0c37){if(_0x5a0c37['VoiceQueueId']||_0x5a0c37[_0xbf2c('0x46')]){return db[_0x5a0c37[_0xbf2c('0x47')]?_0xbf2c('0x48'):_0xbf2c('0x49')][_0xbf2c('0x41')]({'where':{'id':_0x5a0c37[_0xbf2c('0x47')]?_0x5a0c37['VoiceQueueId']:_0x5a0c37[_0xbf2c('0x46')]},'attributes':['id',_0xbf2c('0xf')],'raw':!![]});}}})[_0xbf2c('0xb')](function(_0x3fa07e){var _0x36d1ec={};if(_0x3fa07e){_[_0xbf2c('0x37')](_0x36d1ec,_[_0xbf2c('0x4a')](_0x23912d[_0xbf2c('0x4b')],['createdAt','updatedAt','id']));_0x36d1ec['state']=0x15;_0x36d1ec[_0xbf2c('0x4c')]=_0xbf2c('0x4d');_0x36d1ec[_0xbf2c('0x4e')]=_0x3fa07e[_0xbf2c('0xf')];_0x36d1ec['membername']=_0x1c3b78[_0xbf2c('0x4f')][_0xbf2c('0xf')];_0x36d1ec['UserId']=_0x1c3b78[_0xbf2c('0x4f')]['id'];_0x36d1ec[_0xbf2c('0x4d')]=!![];_0x36d1ec[_0xbf2c('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36d1ec['calleridnum']=_0x23912d['phone'];_0x36d1ec[_0xbf2c('0x51')]=_0x23912d[_0xbf2c('0x47')]?_0xbf2c('0x52'):_0xbf2c('0x53');return db[_0xbf2c('0x54')]['find']({'where':{'id':_0x36d1ec[_0xbf2c('0x55')]},'attributes':[_0xbf2c('0x56'),'lastName']})[_0xbf2c('0xb')](function(_0x3f0129){if(!_['isNil'](_0x128e97)&&!_['isNil'](_0x3f0129['firstName'])){_0x36d1ec[_0xbf2c('0x57')]=_0x3f0129['firstName'];if(!_['isNil'](_0x3f0129[_0xbf2c('0x58')])){_0x36d1ec[_0xbf2c('0x57')]+='\x20'+_0x3f0129[_0xbf2c('0x58')];}}})[_0xbf2c('0x59')](function(){return db['CmHopperFinal']['create'](_0x36d1ec);});}})[_0xbf2c('0xb')](function(_0xc0b6ff){return db[_0xbf2c('0x5a')][_0xbf2c('0x45')]({'where':{'CmHopperId':_0x31791b}});})[_0xbf2c('0xb')](function(){return _0x128e97['status'](0xcc)['end']();})[_0xbf2c('0x3e')](handleError(_0x128e97,null));};exports[_0xbf2c('0x5b')]=function(_0x40f93e,_0x45b91c){var _0x1f984e=[];return db[_0xbf2c('0x54')]['describe']()['then'](function(_0x47b287){_0x1f984e=_[_0xbf2c('0x18')](_0x47b287);return _0x40f93e[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id',_0xbf2c('0x5f'),_0xbf2c('0x60')],'raw':!![]});})[_0xbf2c('0xb')](function(_0x50d44d){if(_0x50d44d&&_0x50d44d['length']){return db[_0xbf2c('0x61')][_0xbf2c('0x62')](function(_0x38ce66){var _0x42f789={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x50d44d,'id')},'$or':[{'UserId':null},{'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']}]};var _0x4ed155={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d44d)[_0xbf2c('0x36')]([_0xbf2c('0x60'),0x0])[_0xbf2c('0x11')]('id')[_0xbf2c('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x40f93e['user']['id']}]};var _0x3e9448={'$or':[_0x42f789,_0x4ed155]};var _0x12bee7=[];if(_0x40f93e[_0xbf2c('0x43')]['direction']&&_0x40f93e['body'][_0xbf2c('0x65')]==='prev'){if(!_['isEmpty'](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$in':_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),'ASC'],['scheduledAt',_0x50d44d[0x0][_0xbf2c('0x5f')]===_0xbf2c('0x68')?'DESC':_0xbf2c('0x68')],db[_0xbf2c('0x61')]['literal'](_0xbf2c('0x69')),['id','DESC']];}else{if(!_[_0xbf2c('0x6a')](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$notIn':_0x40f93e['body'][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),_0xbf2c('0x6b')],[_0xbf2c('0x6c'),_0x50d44d[0x0][_0xbf2c('0x5f')]],db[_0xbf2c('0x61')][_0xbf2c('0x6d')](_0xbf2c('0x6e')),['id',_0xbf2c('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbf2c('0x6f'),_0xbf2c('0x70'),_0xbf2c('0x71')],'where':_0x3e9448,'order':_0x12bee7,'transaction':_0x38ce66,'lock':_0x38ce66[_0xbf2c('0x72')][_0xbf2c('0x73')],'include':[{'model':db[_0xbf2c('0x54')],'as':_0xbf2c('0x74'),'attributes':_0x1f984e,'include':[{'model':db['CmCompany'],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':_0xbf2c('0x77'),'attributes':['id',_0xbf2c('0xf')]},{'model':db['VoiceQueue'],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x4e7b32){if(_0x4e7b32){return _0x4e7b32[_0xbf2c('0xa')]({'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']},{'transaction':_0x38ce66});}});});}})[_0xbf2c('0xb')](handleEntityNotFound(_0x45b91c,null))[_0xbf2c('0xb')](respondWithResult(_0x45b91c,null))[_0xbf2c('0x3e')](handleError(_0x45b91c,null));};exports[_0xbf2c('0x7a')]=function(_0x2029f7,_0x290f8c,_0x51617d){var _0x79cc7=[];var _0x5440a8=_0x2029f7[_0xbf2c('0x40')]['id'];var _0x12b821=_0x2029f7[_0xbf2c('0x4f')]['id'];return db['CmContact'][_0xbf2c('0x44')]()[_0xbf2c('0xb')](function(_0x4ff5c3){_0x79cc7=_[_0xbf2c('0x18')](_0x4ff5c3);return db['sequelize'][_0xbf2c('0x62')](function(_0x357989){const _0x307e46={'id':_0x5440a8};return db[_0xbf2c('0x12')]['findOne']({'attributes':['id','scheduledat',_0xbf2c('0x71')],'where':_0x307e46,'transaction':_0x357989,'lock':_0x357989[_0xbf2c('0x72')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbf2c('0x74'),'attributes':_0x79cc7,'include':[{'model':db[_0xbf2c('0x7b')],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':'List','attributes':['id',_0xbf2c('0xf')]},{'model':db[_0xbf2c('0x48')],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x26fdee){if(_0x26fdee){return _0x26fdee[_0xbf2c('0xa')]({'UserId':_0x12b821},{'transaction':_0x357989});}});});})[_0xbf2c('0xb')](handleEntityNotFound(_0x290f8c,null))[_0xbf2c('0xb')](respondWithResult(_0x290f8c,null))[_0xbf2c('0x3e')](handleError(_0x290f8c,null));};exports[_0xbf2c('0x7c')]=function(_0x5ecd37,_0x3ab5ac){return _0x5ecd37[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id'],'raw':!![]})[_0xbf2c('0xb')](function(_0x545447){if(_0x545447&&_0x545447[_0xbf2c('0x2f')]){return db[_0xbf2c('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbf2c('0x7d')](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x545447,'id')},'$or':[{'UserId':null},{'UserId':_0x5ecd37[_0xbf2c('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x2c7cf7){if(!_[_0xbf2c('0x7e')](_0x2c7cf7)&&_['isNumber'](_0x2c7cf7)){return _0x3ab5ac[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'contacts':_0x2c7cf7});}else{logger[_0xbf2c('0xd')](_0xbf2c('0x7f'),_0xbf2c('0x7c'),0x194,_0xbf2c('0x80'));_0x3ab5ac['sendStatus'](0x194);}})[_0xbf2c('0x3e')](handleError(_0x3ab5ac,null));};exports[_0xbf2c('0x81')]=function(_0x1377c1,_0x4fa011){var _0x2aa3c3=shared[_0xbf2c('0x82')];var _0x40681f=[];_[_0xbf2c('0x11')](_0x2aa3c3,function(_0x5f4f90){_0x40681f[_0xbf2c('0x83')]({'id':_0x5f4f90[_0xbf2c('0xf')],'name':_0x5f4f90[_0xbf2c('0xf')],'utcOffset':_0x5f4f90[_0xbf2c('0x84')]});});return _0x4fa011[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'tz':_0x40681f});};exports[_0xbf2c('0x85')]=function(_0x31d6f,_0x2fcb0a){var _0x391208=shared[_0xbf2c('0x82')];var _0x560da4={};if(!_[_0xbf2c('0x7e')](_0x391208[_0x31d6f['body']['id']]))_0x560da4=_0x391208[_0x31d6f[_0xbf2c('0x43')]['id']];return _0x2fcb0a[_0xbf2c('0x7')](0xc8)['json'](_0x560da4);}; \ No newline at end of file +var _0x60c2=['getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','update','then','error','name','send','index','CmHopper','fieldName','key','model','map','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','rawAttributes','options','create','catch','body','find','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','end','getVoiceQueues','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','Queue','getPreviewRecall','recallme','CmCompany','dialActive','getOpenContacts','outbound','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x60c2,0x8f));var _0x260c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x60c2[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var _=require(_0x260c('0x0'));var qs=require(_0x260c('0x1'));var logger=require(_0x260c('0x2'))(_0x260c('0x3'));var shared=require(_0x260c('0x4'));var db=require(_0x260c('0x5'))['db'];function respondWithResult(_0x4cda33,_0x309bde){_0x309bde=_0x309bde||0xc8;return function(_0x17a599){if(_0x17a599){return _0x4cda33[_0x260c('0x6')](_0x309bde)[_0x260c('0x7')](_0x17a599);}};}function respondWithFilteredResult(_0x13c7d0,_0x558b0c){return function(_0x14fab2){if(_0x14fab2){var _0x2c2cd8=typeof _0x558b0c[_0x260c('0x8')]===_0x260c('0x9')&&typeof _0x558b0c['limit']===_0x260c('0x9');var _0x3cb2c9=_0x14fab2[_0x260c('0xa')];var _0x39f98a=_0x2c2cd8?0x0:_0x558b0c[_0x260c('0x8')];var _0x1164e9=_0x2c2cd8?_0x14fab2[_0x260c('0xa')]:_0x558b0c['offset']+_0x558b0c[_0x260c('0xb')];var _0x1943ca;if(_0x1164e9>=_0x3cb2c9){_0x1164e9=_0x3cb2c9;_0x1943ca=0xc8;}else{_0x1943ca=0xce;}_0x13c7d0[_0x260c('0x6')](_0x1943ca);return _0x13c7d0['set'](_0x260c('0xc'),_0x39f98a+'-'+_0x1164e9+'/'+_0x3cb2c9)[_0x260c('0x7')](_0x14fab2);}return null;};}function saveUpdates(_0x191490,_0x5aed37){return function(_0xc44e8d){if(_0xc44e8d){return _0xc44e8d[_0x260c('0xd')](_0x191490)[_0x260c('0xe')](function(_0x280270){return _0x280270;});}return null;};}function handleEntityNotFound(_0x1d3775,_0x53df53){return function(_0x3930b6){if(!_0x3930b6){_0x1d3775['sendStatus'](0x194);}return _0x3930b6;};}function handleError(_0x44fd50,_0x5a021c){_0x5a021c=_0x5a021c||0x1f4;return function(_0x47edc1){logger[_0x260c('0xf')](_0x47edc1['stack']);if(_0x47edc1[_0x260c('0x10')]){delete _0x47edc1[_0x260c('0x10')];}_0x44fd50[_0x260c('0x6')](_0x5a021c)[_0x260c('0x11')](_0x47edc1);};}exports[_0x260c('0x12')]=function(_0x1d109d,_0x11e634){var _0x2b0872={},_0x201e59={},_0x33e14c={'count':0x0,'rows':[]};var _0x38059e=_['map'](db[_0x260c('0x13')]['rawAttributes'],function(_0xc79076){return{'name':_0xc79076[_0x260c('0x14')],'type':_0xc79076['type'][_0x260c('0x15')]};});_0x201e59[_0x260c('0x16')]=_[_0x260c('0x17')](_0x38059e,_0x260c('0x10'));_0x201e59[_0x260c('0x18')]=_[_0x260c('0x19')](_0x1d109d['query']);_0x201e59[_0x260c('0x1a')]=_[_0x260c('0x1b')](_0x201e59[_0x260c('0x16')],_0x201e59[_0x260c('0x18')]);_0x201e59['filters']=_[_0x260c('0x1c')](_0x201e59[_0x260c('0x1a')],[_0x260c('0x1d'),_0x260c('0x1e'),'$gt',_0x260c('0x1f'),_0x260c('0x20'),_0x260c('0x21'),_0x260c('0x22'),'$eq',_0x260c('0x23'),_0x260c('0x24'),'$notBetween','$in',_0x260c('0x25'),_0x260c('0x26'),_0x260c('0x27'),_0x260c('0x28'),_0x260c('0x29'),_0x260c('0x26'),'$overlap',_0x260c('0x2a'),_0x260c('0x2b'),_0x260c('0x2c')]);_0x2b0872[_0x260c('0x2d')]=_['intersection'](_0x201e59[_0x260c('0x16')],qs[_0x260c('0x2e')](_0x1d109d['query'][_0x260c('0x2e')]));_0x2b0872[_0x260c('0x2d')]=_0x2b0872[_0x260c('0x2d')][_0x260c('0x2f')]?_0x2b0872[_0x260c('0x2d')]:_0x201e59[_0x260c('0x16')];if(!_0x1d109d[_0x260c('0x18')][_0x260c('0x30')]('nolimit')){_0x2b0872[_0x260c('0xb')]=qs[_0x260c('0xb')](_0x1d109d['query'][_0x260c('0xb')]);_0x2b0872['offset']=qs['offset'](_0x1d109d['query'][_0x260c('0x8')]);}_0x2b0872[_0x260c('0x31')]=qs['sort'](_0x1d109d[_0x260c('0x18')][_0x260c('0x32')]);_0x2b0872[_0x260c('0x33')]=qs[_0x260c('0x1a')](_[_0x260c('0x34')](_0x1d109d[_0x260c('0x18')],_0x201e59['filters']),_0x38059e);if(_0x1d109d[_0x260c('0x18')][_0x260c('0x35')]){_0x2b0872[_0x260c('0x33')]=_[_0x260c('0x36')](_0x2b0872[_0x260c('0x33')],{'$or':_[_0x260c('0x17')](_0x38059e,function(_0x2ad570){if(_0x2ad570[_0x260c('0x37')]!==_0x260c('0x38')){var _0x5554a5={};_0x5554a5[_0x2ad570[_0x260c('0x10')]]={'$like':'%'+_0x1d109d['query']['filter']+'%'};return _0x5554a5;}})});}_0x2b0872=_['merge']({},_0x2b0872,_0x1d109d['options']);var _0x4e2c9f={'where':_0x2b0872['where']};return db['CmHopper'][_0x260c('0xa')](_0x4e2c9f)[_0x260c('0xe')](function(_0x12dd2b){_0x33e14c[_0x260c('0xa')]=_0x12dd2b;if(_0x1d109d['query'][_0x260c('0x39')]){_0x2b0872[_0x260c('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0x260c('0x3b')](_0x2b0872);})[_0x260c('0xe')](function(_0x342d91){_0x33e14c[_0x260c('0x3c')]=_0x342d91;return _0x33e14c;})[_0x260c('0xe')](respondWithFilteredResult(_0x11e634,_0x2b0872))['catch'](handleError(_0x11e634,null));};exports['show']=function(_0x460fd6,_0x2de67a){var _0x1de711={'raw':!![],'where':{'id':_0x460fd6['params']['id']}},_0xf04cf1={};_0xf04cf1[_0x260c('0x16')]=_[_0x260c('0x19')](db[_0x260c('0x13')][_0x260c('0x3d')]);_0xf04cf1[_0x260c('0x18')]=_[_0x260c('0x19')](_0x460fd6[_0x260c('0x18')]);_0xf04cf1[_0x260c('0x1a')]=_[_0x260c('0x1b')](_0xf04cf1[_0x260c('0x16')],_0xf04cf1[_0x260c('0x18')]);_0x1de711[_0x260c('0x2d')]=_[_0x260c('0x1b')](_0xf04cf1['model'],qs['fields'](_0x460fd6[_0x260c('0x18')][_0x260c('0x2e')]));_0x1de711[_0x260c('0x2d')]=_0x1de711['attributes'][_0x260c('0x2f')]?_0x1de711['attributes']:_0xf04cf1['model'];if(_0x460fd6[_0x260c('0x18')]['includeAll']){_0x1de711[_0x260c('0x3a')]=[{'all':!![]}];}_0x1de711=_[_0x260c('0x36')]({},_0x1de711,_0x460fd6[_0x260c('0x3e')]);return db[_0x260c('0x13')]['find'](_0x1de711)[_0x260c('0xe')](handleEntityNotFound(_0x2de67a,null))[_0x260c('0xe')](respondWithResult(_0x2de67a,null))['catch'](handleError(_0x2de67a,null));};exports[_0x260c('0x3f')]=function(_0x549cbe,_0x1b4b2b){return db[_0x260c('0x13')][_0x260c('0x3f')](_0x549cbe['body'],{})[_0x260c('0xe')](respondWithResult(_0x1b4b2b,0xc9))[_0x260c('0x40')](handleError(_0x1b4b2b,null));};exports[_0x260c('0xd')]=function(_0x11c41d,_0x2b5622){if(_0x11c41d[_0x260c('0x41')]['id']){delete _0x11c41d[_0x260c('0x41')]['id'];}return db[_0x260c('0x13')][_0x260c('0x42')]({'where':{'id':_0x11c41d[_0x260c('0x43')]['id']}})[_0x260c('0xe')](handleEntityNotFound(_0x2b5622,null))[_0x260c('0xe')](saveUpdates(_0x11c41d['body'],null))['then'](respondWithResult(_0x2b5622,null))[_0x260c('0x40')](handleError(_0x2b5622,null));};exports[_0x260c('0x44')]=function(_0x18321f,_0x43c16c){return db['CmHopper'][_0x260c('0x44')]()[_0x260c('0xe')](respondWithResult(_0x43c16c,null))[_0x260c('0x40')](handleError(_0x43c16c,null));};exports[_0x260c('0x45')]=function(_0x45175a,_0x1d0890){var _0x3dc1c3;var _0x46c85a=_0x45175a[_0x260c('0x43')]['id'];return db['CmHopper'][_0x260c('0x42')]({'where':{'id':_0x45175a[_0x260c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d0890,null))[_0x260c('0xe')](function(_0x4aa1e3){if(_0x4aa1e3){return _0x4aa1e3[_0x260c('0x45')]()['then'](function(_0x4dcdca){return _0x4dcdca;});}})[_0x260c('0xe')](function(_0x2a0a14){_0x3dc1c3=_0x2a0a14;if(_0x2a0a14){if(_0x2a0a14[_0x260c('0x46')]||_0x2a0a14[_0x260c('0x47')]){return db[_0x2a0a14[_0x260c('0x46')]?_0x260c('0x48'):_0x260c('0x49')]['find']({'where':{'id':_0x2a0a14[_0x260c('0x46')]?_0x2a0a14['VoiceQueueId']:_0x2a0a14[_0x260c('0x47')]},'attributes':['id',_0x260c('0x10')],'raw':!![]});}}})[_0x260c('0xe')](function(_0x64a688){var _0x472fc0={};if(_0x64a688){_[_0x260c('0x36')](_0x472fc0,_[_0x260c('0x4a')](_0x3dc1c3[_0x260c('0x4b')],['createdAt',_0x260c('0x4c'),'id']));_0x472fc0[_0x260c('0x4d')]=0x15;_0x472fc0[_0x260c('0x4e')]=_0x260c('0x4f');_0x472fc0['campaign']=_0x64a688[_0x260c('0x10')];_0x472fc0['membername']=_0x45175a[_0x260c('0x50')]['name'];_0x472fc0['UserId']=_0x45175a[_0x260c('0x50')]['id'];_0x472fc0['deleted']=!![];_0x472fc0[_0x260c('0x51')]=moment()['format'](_0x260c('0x52'));_0x472fc0[_0x260c('0x53')]=_0x3dc1c3[_0x260c('0x54')];_0x472fc0[_0x260c('0x55')]=_0x3dc1c3[_0x260c('0x46')]?_0x260c('0x56'):_0x260c('0x57');return db[_0x260c('0x58')][_0x260c('0x42')]({'where':{'id':_0x472fc0[_0x260c('0x59')]},'attributes':['firstName','lastName']})['then'](function(_0x56a482){if(!_[_0x260c('0x5a')](_0x1d0890)&&!_[_0x260c('0x5a')](_0x56a482[_0x260c('0x5b')])){_0x472fc0[_0x260c('0x5c')]=_0x56a482[_0x260c('0x5b')];if(!_[_0x260c('0x5a')](_0x56a482[_0x260c('0x5d')])){_0x472fc0['calleridname']+='\x20'+_0x56a482[_0x260c('0x5d')];}}})[_0x260c('0x5e')](function(){return db['CmHopperFinal'][_0x260c('0x3f')](_0x472fc0);});}})[_0x260c('0xe')](function(_0x26d6ee){return db[_0x260c('0x5f')][_0x260c('0x45')]({'where':{'CmHopperId':_0x46c85a}});})[_0x260c('0xe')](function(){return _0x1d0890[_0x260c('0x6')](0xcc)[_0x260c('0x60')]();})[_0x260c('0x40')](handleError(_0x1d0890,null));};exports['getPreview']=function(_0x2052bb,_0x597980){var _0x2d9c8a=[];return db[_0x260c('0x58')][_0x260c('0x44')]()[_0x260c('0xe')](function(_0x151285){_0x2d9c8a=_[_0x260c('0x19')](_0x151285);return _0x2052bb[_0x260c('0x50')][_0x260c('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x260c('0x62')],'raw':!![]});})[_0x260c('0xe')](function(_0x332a89){if(_0x332a89&&_0x332a89[_0x260c('0x2f')]){return db[_0x260c('0x63')]['transaction'](function(_0x5c1952){var _0xb087a8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x260c('0x64')](_0x260c('0x52'))},'VoiceQueueId':{'$in':_[_0x260c('0x17')](_0x332a89,'id')},'$or':[{'UserId':null},{'UserId':_0x2052bb[_0x260c('0x50')]['id']}]};var _0x2d7c12={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x332a89)['filter']([_0x260c('0x62'),0x0])['map']('id')[_0x260c('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x2052bb[_0x260c('0x50')]['id']}]};var _0x366a2b={'$or':[_0xb087a8,_0x2d7c12]};var _0x116d3e=[];if(_0x2052bb[_0x260c('0x41')][_0x260c('0x66')]&&_0x2052bb[_0x260c('0x41')][_0x260c('0x66')]===_0x260c('0x67')){if(!_[_0x260c('0x68')](_0x2052bb[_0x260c('0x41')]['hopperIds'])){_0x366a2b['id']={'$in':_0x2052bb[_0x260c('0x41')][_0x260c('0x69')]};}_0x116d3e=[[_0x260c('0x6a'),_0x260c('0x6b')],[_0x260c('0x6c'),_0x332a89[0x0][_0x260c('0x6d')]===_0x260c('0x6b')?_0x260c('0x6e'):_0x260c('0x6b')],db[_0x260c('0x63')][_0x260c('0x6f')](_0x260c('0x70')),['id','DESC']];}else{if(!_[_0x260c('0x68')](_0x2052bb[_0x260c('0x41')]['hopperIds'])){_0x366a2b['id']={'$notIn':_0x2052bb[_0x260c('0x41')][_0x260c('0x69')]};}_0x116d3e=[['priority',_0x260c('0x6e')],[_0x260c('0x6c'),_0x332a89[0x0]['dialOrderByScheduledAt']],db[_0x260c('0x63')][_0x260c('0x6f')](_0x260c('0x71')),['id','ASC']];}return db['CmHopper'][_0x260c('0x72')]({'attributes':['id',_0x260c('0x73'),_0x260c('0x54'),'recallme'],'where':_0x366a2b,'order':_0x116d3e,'transaction':_0x5c1952,'lock':_0x5c1952[_0x260c('0x74')][_0x260c('0x75')],'include':[{'model':db['CmContact'],'as':_0x260c('0x76'),'attributes':_0x2d9c8a,'include':[{'model':db['CmCompany'],'as':_0x260c('0x77'),'attributes':['id',_0x260c('0x10')]}]},{'model':db[_0x260c('0x78')],'as':_0x260c('0x79'),'attributes':['id','name']},{'model':db[_0x260c('0x48')],'as':_0x260c('0x7a'),'attributes':['id',_0x260c('0x10'),'dialActive']}]})[_0x260c('0xe')](function(_0x2d0255){if(_0x2d0255){return _0x2d0255[_0x260c('0xd')]({'UserId':_0x2052bb['user']['id']},{'transaction':_0x5c1952});}});});}})[_0x260c('0xe')](handleEntityNotFound(_0x597980,null))[_0x260c('0xe')](respondWithResult(_0x597980,null))['catch'](handleError(_0x597980,null));};exports[_0x260c('0x7b')]=function(_0x22067f,_0x29ebcd,_0x5ae38c){var _0x3f376e=[];var _0x124ea2=_0x22067f[_0x260c('0x43')]['id'];var _0x3006b6=_0x22067f[_0x260c('0x50')]['id'];return db[_0x260c('0x58')][_0x260c('0x44')]()[_0x260c('0xe')](function(_0x1f83b8){_0x3f376e=_[_0x260c('0x19')](_0x1f83b8);return db[_0x260c('0x63')]['transaction'](function(_0x70ab16){const _0xd3bbad={'id':_0x124ea2};return db[_0x260c('0x13')][_0x260c('0x72')]({'attributes':['id','scheduledat',_0x260c('0x7c')],'where':_0xd3bbad,'transaction':_0x70ab16,'lock':_0x70ab16[_0x260c('0x74')][_0x260c('0x75')],'include':[{'model':db[_0x260c('0x58')],'as':_0x260c('0x76'),'attributes':_0x3f376e,'include':[{'model':db[_0x260c('0x7d')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x260c('0x79'),'attributes':['id','name']},{'model':db[_0x260c('0x48')],'as':_0x260c('0x7a'),'attributes':['id',_0x260c('0x10'),_0x260c('0x7e')]}]})[_0x260c('0xe')](function(_0x59d4d8){if(_0x59d4d8){return _0x59d4d8[_0x260c('0xd')]({'UserId':_0x3006b6},{'transaction':_0x70ab16});}});});})[_0x260c('0xe')](handleEntityNotFound(_0x29ebcd,null))[_0x260c('0xe')](respondWithResult(_0x29ebcd,null))[_0x260c('0x40')](handleError(_0x29ebcd,null));};exports[_0x260c('0x7f')]=function(_0x4d5d6c,_0x4a9f88){return _0x4d5d6c[_0x260c('0x50')]['getVoiceQueues']({'where':{'type':_0x260c('0x80'),'dialActive':!![],'dialMethod':_0x260c('0x81')},'attributes':['id'],'raw':!![]})['then'](function(_0x2a069b){if(_0x2a069b&&_0x2a069b[_0x260c('0x2f')]){return db[_0x260c('0x13')][_0x260c('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x260c('0x64')](_0x260c('0x52'))},'VoiceQueueId':{'$in':_[_0x260c('0x17')](_0x2a069b,'id')},'$or':[{'UserId':null},{'UserId':_0x4d5d6c[_0x260c('0x50')]['id']}]}});}return 0x0;})[_0x260c('0xe')](function(_0x4bb97e){if(!_[_0x260c('0x5a')](_0x4bb97e)&&_['isNumber'](_0x4bb97e)){return _0x4a9f88[_0x260c('0x6')](0xc8)[_0x260c('0x7')]({'contacts':_0x4bb97e});}else{logger['error'](_0x260c('0x82'),_0x260c('0x7f'),0x194,_0x260c('0x83'));_0x4a9f88[_0x260c('0x84')](0x194);}})[_0x260c('0x40')](handleError(_0x4a9f88,null));};exports[_0x260c('0x85')]=function(_0x1cf31d,_0x11823c){var _0x3b7188=shared[_0x260c('0x86')];var _0x47b2fd=[];_[_0x260c('0x17')](_0x3b7188,function(_0x91f974){_0x47b2fd[_0x260c('0x87')]({'id':_0x91f974[_0x260c('0x10')],'name':_0x91f974['name'],'utcOffset':_0x91f974[_0x260c('0x88')]});});return _0x11823c['status'](0xc8)[_0x260c('0x7')]({'tz':_0x47b2fd});};exports[_0x260c('0x89')]=function(_0x475720,_0x4b2dcc){var _0x29a535=shared[_0x260c('0x86')];var _0x3a36ba={};if(!_[_0x260c('0x5a')](_0x29a535[_0x475720[_0x260c('0x41')]['id']]))_0x3a36ba=_0x29a535[_0x475720['body']['id']];return _0x4b2dcc['status'](0xc8)['json'](_0x3a36ba);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 64e04e0..5a33246 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x187d,0x93));var _0xd187=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x187d[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x4a02e9,_0x5d7b67){var _0x229ed7=function(_0x830f6c){while(--_0x830f6c){_0x4a02e9['push'](_0x4a02e9['shift']());}};_0x229ed7(++_0x5d7b67);}(_0x4975,0x86));var _0x5497=function(_0x522816,_0x45fdc6){_0x522816=_0x522816-0x0;var _0x241928=_0x4975[_0x522816];return _0x241928;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ec24e82..cb2f10a 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 _0xe423=['User','Agent','name','UserId','includes','push','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','where','attributes','include','model','map','info','GetCmHopper','stringify','catch','message','error','ShowCmHopper','find','raw','then','debug','CreateCmHopper','create','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','CmContact','describe','transaction','limit','order','LOCK','UPDATE','Contact','keys'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xe423,0x125));var _0x3e42=function(_0x75979f,_0x2540a0){_0x75979f=_0x75979f-0x0;var _0x253db5=_0xe423[_0x75979f];return _0x253db5;};'use strict';var _=require(_0x3e42('0x0'));var util=require(_0x3e42('0x1'));var moment=require(_0x3e42('0x2'));var BPromise=require(_0x3e42('0x3'));var db=require(_0x3e42('0x4'))['db'];var logger=require(_0x3e42('0x5'))(_0x3e42('0x6'));exports['GetCmHopper']=function(_0x2d2f27){var _0x38d21d=this;return new Promise(function(_0x109b42,_0x5229c3){return db[_0x3e42('0x7')]['findAll']({'raw':_0x2d2f27['options']?_0x2d2f27[_0x3e42('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27['options'][_0x3e42('0x9')]||null:null,'attributes':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27['options'][_0x3e42('0xa')]||null:null,'limit':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27[_0x3e42('0x8')]['limit']||null:null,'include':_0x2d2f27[_0x3e42('0x8')]?_0x2d2f27[_0x3e42('0x8')][_0x3e42('0xb')]?_['map'](_0x2d2f27['options'][_0x3e42('0xb')],function(_0x42e159){return{'model':db[_0x42e159[_0x3e42('0xc')]],'as':_0x42e159['as'],'attributes':_0x42e159[_0x3e42('0xa')],'include':_0x42e159[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x42e159['include'],function(_0x2a5d47){return{'model':db[_0x2a5d47[_0x3e42('0xc')]],'as':_0x2a5d47['as'],'attributes':_0x2a5d47[_0x3e42('0xa')],'include':_0x2a5d47['include']?_[_0x3e42('0xd')](_0x2a5d47[_0x3e42('0xb')],function(_0x3e9750){return{'model':db[_0x3e9750[_0x3e42('0xc')]],'as':_0x3e9750['as'],'attributes':_0x3e9750[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c271){logger[_0x3e42('0xe')](_0x3e42('0xf'),_0x2d2f27);logger['debug'](_0x3e42('0xf'),_0x2d2f27,JSON[_0x3e42('0x10')](_0x55c271));_0x109b42(_0x55c271);})[_0x3e42('0x11')](function(_0x4e0701){logger['error'](_0x3e42('0xf'),_0x4e0701[_0x3e42('0x12')],_0x2d2f27);_0x5229c3(_0x38d21d[_0x3e42('0x13')](0x1f4,_0x4e0701[_0x3e42('0x12')]));});});};exports[_0x3e42('0x14')]=function(_0x119fa8){var _0xacf14c=this;return new Promise(function(_0x4f5145,_0x5521db){return db[_0x3e42('0x7')][_0x3e42('0x15')]({'raw':_0x119fa8[_0x3e42('0x8')]?_0x119fa8['options'][_0x3e42('0x16')]===undefined?!![]:![]:!![],'where':_0x119fa8[_0x3e42('0x8')]?_0x119fa8['options'][_0x3e42('0x9')]||null:null,'attributes':_0x119fa8[_0x3e42('0x8')]?_0x119fa8[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'include':_0x119fa8['options']?_0x119fa8['options'][_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x119fa8[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x316a7c){return{'model':db[_0x316a7c['model']],'as':_0x316a7c['as'],'attributes':_0x316a7c[_0x3e42('0xa')],'include':_0x316a7c[_0x3e42('0xb')]?_['map'](_0x316a7c['include'],function(_0x4488c6){return{'model':db[_0x4488c6[_0x3e42('0xc')]],'as':_0x4488c6['as'],'attributes':_0x4488c6[_0x3e42('0xa')],'include':_0x4488c6[_0x3e42('0xb')]?_['map'](_0x4488c6[_0x3e42('0xb')],function(_0x3fceb6){return{'model':db[_0x3fceb6[_0x3e42('0xc')]],'as':_0x3fceb6['as'],'attributes':_0x3fceb6[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x425d92){logger[_0x3e42('0xe')](_0x3e42('0x14'),_0x119fa8);logger[_0x3e42('0x18')]('ShowCmHopper',_0x119fa8,JSON[_0x3e42('0x10')](_0x425d92));_0x4f5145(_0x425d92);})[_0x3e42('0x11')](function(_0x82556){logger['error'](_0x3e42('0x14'),_0x82556[_0x3e42('0x12')],_0x119fa8);_0x5521db(_0xacf14c[_0x3e42('0x13')](0x1f4,_0x82556[_0x3e42('0x12')]));});});};exports[_0x3e42('0x19')]=function(_0x2822d2){var _0x39c117=this;return new Promise(function(_0x46a2f0,_0x432768){return db[_0x3e42('0x7')][_0x3e42('0x1a')](_0x2822d2['body'],{'raw':_0x2822d2['options']?_0x2822d2['options'][_0x3e42('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x10c73c){logger[_0x3e42('0xe')](_0x3e42('0x19'),_0x2822d2);logger['debug'](_0x3e42('0x19'),_0x2822d2,JSON[_0x3e42('0x10')](_0x10c73c));_0x46a2f0(_0x10c73c);})[_0x3e42('0x11')](function(_0x110cf5){logger['error']('CreateCmHopper',_0x110cf5[_0x3e42('0x12')],_0x2822d2);_0x432768(_0x39c117[_0x3e42('0x13')](0x1f4,_0x110cf5[_0x3e42('0x12')]));});});};exports['UpdateCmHopper']=function(_0x37d379){var _0x237393=this;return new Promise(function(_0x5a6696,_0x3547f5){return db[_0x3e42('0x7')][_0x3e42('0x1b')](_0x37d379[_0x3e42('0x1c')],{'raw':_0x37d379['options']?_0x37d379['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d379[_0x3e42('0x8')]?_0x37d379['options']['where']||null:null,'attributes':_0x37d379[_0x3e42('0x8')]?_0x37d379[_0x3e42('0x8')]['attributes']||null:null,'limit':_0x37d379[_0x3e42('0x8')]?_0x37d379[_0x3e42('0x8')]['limit']||null:null})['then'](function(_0x51cd1b){logger[_0x3e42('0xe')](_0x3e42('0x1d'),_0x37d379);logger[_0x3e42('0xe')](_0x3e42('0x1e'),JSON[_0x3e42('0x10')](_0x37d379[_0x3e42('0x8')][_0x3e42('0x9')]),_0x37d379[_0x3e42('0x1c')][_0x3e42('0x1f')]);logger[_0x3e42('0x18')](_0x3e42('0x1d'),_0x37d379,JSON[_0x3e42('0x10')](_0x51cd1b));_0x5a6696(_0x51cd1b);})['catch'](function(_0x33be06){logger[_0x3e42('0x13')](_0x3e42('0x1d'),_0x33be06[_0x3e42('0x12')],_0x37d379);_0x3547f5(_0x237393[_0x3e42('0x13')](0x1f4,_0x33be06[_0x3e42('0x12')]));});});};exports['DestroyCmHopper']=function(_0x294853){var _0xb13a8d=this;return new Promise(function(_0x595313,_0x11fd15){return db[_0x3e42('0x7')][_0x3e42('0x20')]({'where':_0x294853['options']?_0x294853['options'][_0x3e42('0x9')]||null:null})[_0x3e42('0x17')](function(_0x408104){logger[_0x3e42('0xe')](_0x3e42('0x21'),_0x294853);logger[_0x3e42('0x18')]('DestroyCmHopper',_0x294853,JSON['stringify'](_0x408104));_0x595313(_0x408104);})[_0x3e42('0x11')](function(_0x1afb43){logger[_0x3e42('0x13')](_0x3e42('0x21'),_0x1afb43['message'],_0x294853);_0x11fd15(_0xb13a8d[_0x3e42('0x13')](0x1f4,_0x1afb43['message']));});});};exports['GetContactDialer']=function(_0x4125a7){var _0x1d52a7=this;return new Promise(function(_0x1c2790,_0x1277ec){return db[_0x3e42('0x22')][_0x3e42('0x23')]()[_0x3e42('0x17')](function(_0x16c58a){return db['sequelize'][_0x3e42('0x24')](function(_0x2b8773){return db[_0x3e42('0x7')]['findAll']({'where':_0x4125a7[_0x3e42('0x8')]?_0x4125a7['options'][_0x3e42('0x9')]||null:null,'attributes':_0x4125a7['options']?_0x4125a7[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':_0x4125a7[_0x3e42('0x8')]?_0x4125a7[_0x3e42('0x8')][_0x3e42('0x25')]||null:null,'order':_0x4125a7[_0x3e42('0x8')]?_0x4125a7[_0x3e42('0x8')][_0x3e42('0x26')]||null:null,'transaction':_0x2b8773,'lock':_0x2b8773[_0x3e42('0x27')][_0x3e42('0x28')],'include':[{'model':db[_0x3e42('0x22')],'as':_0x3e42('0x29'),'attributes':_[_0x3e42('0x2a')](_0x16c58a)},{'model':db[_0x3e42('0x2b')],'as':_0x3e42('0x2c'),'attributes':['id',_0x3e42('0x2d'),'voicePause']}]})['then'](function(_0x51457b){var _0x3ccefa=[];var _0x487ddb=[];for(var _0x190186=0x0;_0x190186<_0x51457b['length'];_0x190186+=0x1){var _0x1d6f48=_0x51457b[_0x190186][_0x3e42('0x2e')];if(_0x1d6f48===null){_0x3ccefa['push'](_0x51457b[_0x190186][_0x3e42('0x1b')](_0x4125a7['body'],{'transaction':_0x2b8773}));}else if(!_0x487ddb[_0x3e42('0x2f')](_0x1d6f48)){_0x487ddb[_0x3e42('0x30')](_0x1d6f48);_0x3ccefa[_0x3e42('0x30')](_0x51457b[_0x190186][_0x3e42('0x1b')](_0x4125a7[_0x3e42('0x1c')],{'transaction':_0x2b8773}));}}return BPromise['all'](_0x3ccefa);});})[_0x3e42('0x17')](function(_0x217833){logger[_0x3e42('0xe')](_0x3e42('0x31'),_0x4125a7);if(_0x217833[_0x3e42('0x32')]>0x0){logger[_0x3e42('0xe')](_0x3e42('0x33'),_0x217833[0x0][_0x3e42('0x34')]['id'],_0x217833[0x0][_0x3e42('0x34')][_0x3e42('0x35')],_0x217833[0x0][_0x3e42('0x34')][_0x3e42('0x1f')]);}logger[_0x3e42('0x18')]('GetContactDialer',_0x4125a7,JSON[_0x3e42('0x10')](_0x217833));_0x1c2790(_0x217833);})[_0x3e42('0x11')](function(_0x132f33){logger[_0x3e42('0x13')](_0x3e42('0x31'),_0x132f33[_0x3e42('0x12')],_0x4125a7);_0x1277ec(_0x1d52a7[_0x3e42('0x13')](0x1f4,_0x132f33[_0x3e42('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x4a5f56){var _0x50f3d4=this;return new Promise(function(_0x2f53c8,_0x3b4ab7){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x2d9adc){return db[_0x3e42('0x37')][_0x3e42('0x1a')](_0x4a5f56['body'],{'raw':_0x4a5f56[_0x3e42('0x8')]?_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x16')]===undefined?!![]:![]:!![],'transaction':_0x2d9adc})[_0x3e42('0x17')](function(){logger[_0x3e42('0xe')](_0x3e42('0x38'),JSON['stringify'](_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x9')]),_0x4a5f56[_0x3e42('0x8')]['where'][_0x3e42('0x1f')]);return db[_0x3e42('0x7')]['destroy']({'where':_0x4a5f56['options']?_0x4a5f56[_0x3e42('0x8')][_0x3e42('0x9')]||null:null,'transaction':_0x2d9adc});});})[_0x3e42('0x17')](function(_0x49253a){logger[_0x3e42('0xe')]('MoveContactManagedDialer',_0x4a5f56);logger[_0x3e42('0x18')](_0x3e42('0x39'),_0x4a5f56,JSON[_0x3e42('0x10')](_0x49253a));_0x2f53c8(_0x49253a);})['catch'](function(_0x55a666){logger[_0x3e42('0x13')]('MoveContactManagedDialer',_0x55a666[_0x3e42('0x12')],_0x4a5f56);_0x3b4ab7(_0x50f3d4[_0x3e42('0x13')](0x1f4,_0x55a666[_0x3e42('0x12')]));});});};exports[_0x3e42('0x3a')]=function(_0xb118b6){var _0x14124a=this;return new Promise(function(_0x4a6f41,_0x28138c){return db[_0x3e42('0x7')][_0x3e42('0x3b')]({'raw':_0xb118b6[_0x3e42('0x8')]?_0xb118b6[_0x3e42('0x8')][_0x3e42('0x16')]===undefined?!![]:![]:!![],'where':_0xb118b6[_0x3e42('0x8')]?_0xb118b6[_0x3e42('0x8')]['where']||null:null,'attributes':[[db[_0x3e42('0x36')]['fn'](_0x3e42('0x3c'),db[_0x3e42('0x36')]['fn']('IF',db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x3e')+util[_0x3e42('0x3f')](_0x3e42('0x40'),moment()['format'](_0x3e42('0x41')))+_0x3e42('0x42')))),_0x3e42('0x43')]]})['then'](function(_0x3d478d){logger['info'](_0x3e42('0x3a'),_0xb118b6);logger[_0x3e42('0x18')]('CountReScheduled',_0xb118b6,JSON['stringify'](_0x3d478d));_0x4a6f41(_0x3d478d);})[_0x3e42('0x11')](function(_0x5c2b76){logger[_0x3e42('0x13')]('CountReScheduled',_0x5c2b76[_0x3e42('0x12')],_0xb118b6);_0x28138c(_0x14124a[_0x3e42('0x13')](0x1f4,_0x5c2b76[_0x3e42('0x12')]));});});};exports['GetContactRecallMe']=function(_0x4eda1f){var _0x592629=this;return new Promise(function(_0x3a10d6,_0x13bfb6){return db[_0x3e42('0x22')]['describe']()[_0x3e42('0x17')](function(){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x2633a5){return db['CmHopper'][_0x3e42('0x3b')]({'where':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')]['where']||null:null,'attributes':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':0x1,'order':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f['options'][_0x3e42('0x26')]||null:null,'group':db[_0x3e42('0x7')]['UserId'],'transaction':_0x2633a5,'lock':_0x2633a5['LOCK'][_0x3e42('0x28')],'include':_0x4eda1f[_0x3e42('0x8')]?_0x4eda1f[_0x3e42('0x8')]['include']?_[_0x3e42('0xd')](_0x4eda1f[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x49aaa3){return{'model':db[_0x49aaa3[_0x3e42('0xc')]],'as':_0x49aaa3['as'],'attributes':_0x49aaa3[_0x3e42('0xa')],'include':_0x49aaa3[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x49aaa3[_0x3e42('0xb')],function(_0x40c28a){return{'model':db[_0x40c28a[_0x3e42('0xc')]],'as':_0x40c28a['as'],'attributes':_0x40c28a[_0x3e42('0xa')],'include':_0x40c28a['include']?_[_0x3e42('0xd')](_0x40c28a[_0x3e42('0xb')],function(_0x77f65f){return{'model':db[_0x77f65f['model']],'as':_0x77f65f['as'],'attributes':_0x77f65f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x304889){var _0x1479ce=[];for(var _0x3daac5=0x0;_0x3daac5<_0x304889[_0x3e42('0x32')];_0x3daac5+=0x1){_0x1479ce[_0x3e42('0x30')](_0x304889[_0x3daac5][_0x3e42('0x1b')](_0x4eda1f[_0x3e42('0x1c')],{'transaction':_0x2633a5}));}return BPromise['all'](_0x1479ce);});})['then'](function(_0x20831d){logger[_0x3e42('0xe')]('GetContactRecallMe',_0x4eda1f);logger[_0x3e42('0x18')](_0x3e42('0x44'),_0x4eda1f,JSON[_0x3e42('0x10')](_0x20831d));_0x3a10d6(_0x20831d);})[_0x3e42('0x11')](function(_0x2ceea5){logger[_0x3e42('0x13')](_0x3e42('0x44'),_0x2ceea5[_0x3e42('0x12')],_0x4eda1f);_0x13bfb6(_0x592629[_0x3e42('0x13')](0x1f4,_0x2ceea5[_0x3e42('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x4f3947){var _0x1ae390=this;return new Promise(function(_0x56a558,_0x4dde14){db[_0x3e42('0x22')][_0x3e42('0x23')]()[_0x3e42('0x17')](function(_0x404a29){return db[_0x3e42('0x7')][_0x3e42('0x3b')]({'raw':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x4f3947['options']?_0x4f3947[_0x3e42('0x8')][_0x3e42('0x9')]||null:null,'attributes':_0x4f3947['options']?_0x4f3947[_0x3e42('0x8')][_0x3e42('0xa')]||null:null,'limit':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')]['limit']||null:null,'include':_0x4f3947[_0x3e42('0x8')]?_0x4f3947[_0x3e42('0x8')][_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x4f3947[_0x3e42('0x8')][_0x3e42('0xb')],function(_0x5d3b33){return{'model':db[_0x5d3b33[_0x3e42('0xc')]],'as':_0x5d3b33['as'],'attributes':_0x5d3b33['as']===_0x3e42('0x29')?_['keys'](_0x404a29):_0x5d3b33[_0x3e42('0xa')],'include':_0x5d3b33[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x5d3b33[_0x3e42('0xb')],function(_0x9134e){return{'model':db[_0x9134e[_0x3e42('0xc')]],'as':_0x9134e['as'],'attributes':_0x9134e[_0x3e42('0xa')],'include':_0x9134e[_0x3e42('0xb')]?_[_0x3e42('0xd')](_0x9134e[_0x3e42('0xb')],function(_0x31f737){return{'model':db[_0x31f737[_0x3e42('0xc')]],'as':_0x31f737['as'],'attributes':_0x31f737[_0x3e42('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3e42('0x17')](function(_0x36343c){logger[_0x3e42('0xe')](_0x3e42('0xf'),_0x4f3947);logger[_0x3e42('0x18')]('GetCmHopper',_0x4f3947,JSON[_0x3e42('0x10')](_0x36343c));_0x56a558(_0x36343c);})[_0x3e42('0x11')](function(_0x33530d){logger['error'](_0x3e42('0xf'),_0x33530d[_0x3e42('0x12')],_0x4f3947);_0x4dde14(_0x1ae390['error'](0x1f4,_0x33530d['message']));});});});};exports[_0x3e42('0x45')]=function(_0x523965){var _0x326e37=this;return new Promise(function(_0x2e29e5,_0x41c9d5){return db[_0x3e42('0x22')][_0x3e42('0x46')]({'raw':!![],'where':{'phone':_0x523965[_0x3e42('0x8')][_0x3e42('0x9')]['phone']},'attributes':['id',_0x3e42('0x47')],'order':[['id',_0x3e42('0x48')]]})[_0x3e42('0x17')](function(_0x1cf251){logger[_0x3e42('0xe')](_0x3e42('0x49'),_0x523965);logger[_0x3e42('0x18')](_0x3e42('0x49'),_0x523965,JSON[_0x3e42('0x10')](_0x1cf251));_0x2e29e5(_0x1cf251);})[_0x3e42('0x11')](function(_0x428b6a){logger['error'](_0x3e42('0x49'),_0x428b6a[_0x3e42('0x12')],_0x523965);_0x41c9d5(_0x326e37[_0x3e42('0x13')](0x1f4,_0x428b6a['message']));});});};exports[_0x3e42('0x4a')]=function(_0x38a166){var _0x59460b=this;return new Promise(function(_0x5ea0b1,_0x4dc90e){return db['sequelize'][_0x3e42('0x24')](function(_0x4f9346){var _0x50e949=_0x38a166[_0x3e42('0x8')]&&_0x38a166[_0x3e42('0x8')][_0x3e42('0x9')]?_0x38a166['options'][_0x3e42('0x9')]:{};return db[_0x3e42('0x7')][_0x3e42('0x1b')](_0x38a166['body'],{'where':_0x50e949,'transaction':_0x4f9346})[_0x3e42('0x17')](function(_0x4650f3){logger[_0x3e42('0xe')](_0x3e42('0x4a'),_0x38a166);logger[_0x3e42('0x18')](_0x3e42('0x4a'),_0x38a166,JSON[_0x3e42('0x10')](_0x4650f3));_0x5ea0b1(_0x4650f3);})[_0x3e42('0x11')](function(_0x1f4d9d){logger[_0x3e42('0x13')]('ResetActiveCalls',_0x1f4d9d[_0x3e42('0x12')],_0x38a166);_0x4dc90e(_0x59460b[_0x3e42('0x13')](0x1f4,_0x1f4d9d[_0x3e42('0x12')]));});});});};exports[_0x3e42('0x4b')]=function(_0x3c218b){var _0x2ad9d3=this;var _0x33b9d9=_0x3c218b[_0x3e42('0x1c')][_0x3e42('0x9')][_0x3e42('0x4c')];var _0x1befc2=_0x3c218b[_0x3e42('0x1c')][_0x3e42('0x9')][_0x3e42('0x4d')];var _0x50b70a=_0x3c218b['body']['where'][_0x3e42('0x4e')];return new Promise(function(_0x334550,_0x52e4d8){return db[_0x3e42('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x33b9d9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x4f')+_0x1befc2+_0x3e42('0x50')),'$gt':db[_0x3e42('0x36')][_0x3e42('0x3d')](_0x3e42('0x51'))}},'UserId':{'$in':_0x50b70a}},'include':[{'model':db['CmContact'],'as':_0x3e42('0x29')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x3e42('0x52')]},{'model':db['CmList'],'as':_0x3e42('0x53')}]})[_0x3e42('0x17')](function(_0x5432c){if(_0x5432c[_0x3e42('0x32')]>0x0){return db[_0x3e42('0x36')][_0x3e42('0x24')](function(_0x3e4400){return db[_0x3e42('0x7')][_0x3e42('0x1b')]({'recallmeNotifiedDate':db[_0x3e42('0x36')]['literal'](_0x3e42('0x51'))},{'where':{'id':{'$in':_[_0x3e42('0xd')](_0x5432c,'id')}},'transaction':_0x3e4400})[_0x3e42('0x17')](function(){_0x334550(_0x5432c);})[_0x3e42('0x11')](function(_0x154ec6){logger['error'](_0x3e42('0x4b'),_0x154ec6['message'],_0x3c218b);_0x52e4d8(_0x2ad9d3[_0x3e42('0x13')](0x1f4,_0x154ec6[_0x3e42('0x12')]));});})[_0x3e42('0x11')](function(_0x4b0fc8){logger[_0x3e42('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x4b0fc8[_0x3e42('0x12')],_0x3c218b);_0x52e4d8(_0x2ad9d3['error'](0x1f4,_0x4b0fc8[_0x3e42('0x12')]));});}else{_0x334550(_0x5432c);}});});}; \ No newline at end of file +var _0x883d=['GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','GetContactRecallMe','order','GetCmHopperPreview','Contact','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','Agent','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','stringify','error','message','CmHopper','find','info','ShowCmHopper','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','LOCK','UPDATE','name','length','UserId','push','includes','all'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x883d,0x111));var _0xd883=function(_0x1da04e,_0x34074a){_0x1da04e=_0x1da04e-0x0;var _0x1a14bb=_0x883d[_0x1da04e];return _0x1a14bb;};'use strict';var _=require(_0xd883('0x0'));var util=require(_0xd883('0x1'));var moment=require(_0xd883('0x2'));var BPromise=require(_0xd883('0x3'));var db=require(_0xd883('0x4'))['db'];var logger=require(_0xd883('0x5'))('rpc');exports[_0xd883('0x6')]=function(_0x421aec){var _0x415ee5=this;return new Promise(function(_0x4b229c,_0x5d93a6){return db['CmHopper'][_0xd883('0x7')]({'raw':_0x421aec[_0xd883('0x8')]?_0x421aec['options'][_0xd883('0x9')]===undefined?!![]:![]:!![],'where':_0x421aec[_0xd883('0x8')]?_0x421aec[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':_0x421aec[_0xd883('0x8')]?_0x421aec[_0xd883('0x8')][_0xd883('0xb')]||null:null,'limit':_0x421aec[_0xd883('0x8')]?_0x421aec[_0xd883('0x8')][_0xd883('0xc')]||null:null,'include':_0x421aec[_0xd883('0x8')]?_0x421aec[_0xd883('0x8')]['include']?_[_0xd883('0xd')](_0x421aec[_0xd883('0x8')][_0xd883('0xe')],function(_0x10b7a3){return{'model':db[_0x10b7a3[_0xd883('0xf')]],'as':_0x10b7a3['as'],'attributes':_0x10b7a3[_0xd883('0xb')],'include':_0x10b7a3[_0xd883('0xe')]?_['map'](_0x10b7a3[_0xd883('0xe')],function(_0x5471b6){return{'model':db[_0x5471b6[_0xd883('0xf')]],'as':_0x5471b6['as'],'attributes':_0x5471b6[_0xd883('0xb')],'include':_0x5471b6[_0xd883('0xe')]?_[_0xd883('0xd')](_0x5471b6['include'],function(_0x5468b6){return{'model':db[_0x5468b6['model']],'as':_0x5468b6['as'],'attributes':_0x5468b6[_0xd883('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd883('0x10')](function(_0x482e9f){logger['info'](_0xd883('0x6'),_0x421aec);logger[_0xd883('0x11')](_0xd883('0x6'),_0x421aec,JSON[_0xd883('0x12')](_0x482e9f));_0x4b229c(_0x482e9f);})['catch'](function(_0x529488){logger[_0xd883('0x13')](_0xd883('0x6'),_0x529488[_0xd883('0x14')],_0x421aec);_0x5d93a6(_0x415ee5['error'](0x1f4,_0x529488[_0xd883('0x14')]));});});};exports['ShowCmHopper']=function(_0x410216){var _0x549b4e=this;return new Promise(function(_0x55940c,_0x259e64){return db[_0xd883('0x15')][_0xd883('0x16')]({'raw':_0x410216[_0xd883('0x8')]?_0x410216[_0xd883('0x8')][_0xd883('0x9')]===undefined?!![]:![]:!![],'where':_0x410216[_0xd883('0x8')]?_0x410216[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':_0x410216[_0xd883('0x8')]?_0x410216[_0xd883('0x8')][_0xd883('0xb')]||null:null,'include':_0x410216[_0xd883('0x8')]?_0x410216['options'][_0xd883('0xe')]?_[_0xd883('0xd')](_0x410216[_0xd883('0x8')][_0xd883('0xe')],function(_0x41601e){return{'model':db[_0x41601e[_0xd883('0xf')]],'as':_0x41601e['as'],'attributes':_0x41601e[_0xd883('0xb')],'include':_0x41601e[_0xd883('0xe')]?_[_0xd883('0xd')](_0x41601e[_0xd883('0xe')],function(_0x467599){return{'model':db[_0x467599[_0xd883('0xf')]],'as':_0x467599['as'],'attributes':_0x467599['attributes'],'include':_0x467599[_0xd883('0xe')]?_[_0xd883('0xd')](_0x467599[_0xd883('0xe')],function(_0x71f735){return{'model':db[_0x71f735[_0xd883('0xf')]],'as':_0x71f735['as'],'attributes':_0x71f735[_0xd883('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43f1f7){logger[_0xd883('0x17')](_0xd883('0x18'),_0x410216);logger[_0xd883('0x11')](_0xd883('0x18'),_0x410216,JSON[_0xd883('0x12')](_0x43f1f7));_0x55940c(_0x43f1f7);})[_0xd883('0x19')](function(_0x31ec23){logger[_0xd883('0x13')](_0xd883('0x18'),_0x31ec23[_0xd883('0x14')],_0x410216);_0x259e64(_0x549b4e['error'](0x1f4,_0x31ec23[_0xd883('0x14')]));});});};exports[_0xd883('0x1a')]=function(_0x36feeb){var _0x136c83=this;return new Promise(function(_0xd11c9a,_0x8017b8){return db[_0xd883('0x15')][_0xd883('0x1b')](_0x36feeb[_0xd883('0x1c')],{'raw':_0x36feeb[_0xd883('0x8')]?_0x36feeb[_0xd883('0x8')][_0xd883('0x9')]===undefined?!![]:![]:!![]})[_0xd883('0x10')](function(_0x44f7a9){logger['info'](_0xd883('0x1a'),_0x36feeb);logger['debug'](_0xd883('0x1a'),_0x36feeb,JSON[_0xd883('0x12')](_0x44f7a9));_0xd11c9a(_0x44f7a9);})['catch'](function(_0x21a027){logger[_0xd883('0x13')]('CreateCmHopper',_0x21a027['message'],_0x36feeb);_0x8017b8(_0x136c83[_0xd883('0x13')](0x1f4,_0x21a027[_0xd883('0x14')]));});});};exports[_0xd883('0x1d')]=function(_0x53c4e1){var _0x25a974=this;return new Promise(function(_0x194b6d,_0x1858ab){return db[_0xd883('0x15')][_0xd883('0x1e')](_0x53c4e1['body'],{'raw':_0x53c4e1[_0xd883('0x8')]?_0x53c4e1[_0xd883('0x8')][_0xd883('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53c4e1[_0xd883('0x8')]?_0x53c4e1['options'][_0xd883('0xa')]||null:null,'attributes':_0x53c4e1[_0xd883('0x8')]?_0x53c4e1[_0xd883('0x8')][_0xd883('0xb')]||null:null,'limit':_0x53c4e1['options']?_0x53c4e1[_0xd883('0x8')][_0xd883('0xc')]||null:null})[_0xd883('0x10')](function(_0x58418b){logger[_0xd883('0x17')](_0xd883('0x1d'),_0x53c4e1);logger['info'](_0xd883('0x1f'),JSON[_0xd883('0x12')](_0x53c4e1[_0xd883('0x8')][_0xd883('0xa')]),_0x53c4e1[_0xd883('0x1c')][_0xd883('0x20')]);logger['debug'](_0xd883('0x1d'),_0x53c4e1,JSON[_0xd883('0x12')](_0x58418b));_0x194b6d(_0x58418b);})[_0xd883('0x19')](function(_0x116549){logger[_0xd883('0x13')](_0xd883('0x1d'),_0x116549['message'],_0x53c4e1);_0x1858ab(_0x25a974[_0xd883('0x13')](0x1f4,_0x116549[_0xd883('0x14')]));});});};exports[_0xd883('0x21')]=function(_0x4bc802){var _0x2b3ef7=this;return new Promise(function(_0x364e4d,_0x1b9436){return db['CmHopper'][_0xd883('0x22')]({'where':_0x4bc802[_0xd883('0x8')]?_0x4bc802[_0xd883('0x8')][_0xd883('0xa')]||null:null})[_0xd883('0x10')](function(_0x57bac2){logger[_0xd883('0x17')](_0xd883('0x21'),_0x4bc802);logger[_0xd883('0x11')](_0xd883('0x21'),_0x4bc802,JSON[_0xd883('0x12')](_0x57bac2));_0x364e4d(_0x57bac2);})[_0xd883('0x19')](function(_0xfacfd2){logger[_0xd883('0x13')](_0xd883('0x21'),_0xfacfd2['message'],_0x4bc802);_0x1b9436(_0x2b3ef7[_0xd883('0x13')](0x1f4,_0xfacfd2[_0xd883('0x14')]));});});};exports[_0xd883('0x23')]=function(_0x1e27ea){var _0x10f967=this;return new Promise(function(_0x33eaa7,_0xae101d){return db[_0xd883('0x24')][_0xd883('0x25')]()[_0xd883('0x10')](function(_0x5807c0){return db['sequelize'][_0xd883('0x26')](function(_0xc6a335){return db[_0xd883('0x15')][_0xd883('0x7')]({'where':_0x1e27ea[_0xd883('0x8')]?_0x1e27ea[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':_0x1e27ea[_0xd883('0x8')]?_0x1e27ea[_0xd883('0x8')][_0xd883('0xb')]||null:null,'limit':_0x1e27ea[_0xd883('0x8')]?_0x1e27ea[_0xd883('0x8')]['limit']||null:null,'order':_0x1e27ea[_0xd883('0x8')]?_0x1e27ea[_0xd883('0x8')]['order']||null:null,'transaction':_0xc6a335,'lock':_0xc6a335[_0xd883('0x27')][_0xd883('0x28')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0x5807c0)},{'model':db['User'],'as':'Agent','attributes':['id',_0xd883('0x29'),'voicePause']}]})[_0xd883('0x10')](function(_0x4d8840){var _0x8505ca=[];var _0x529bb4=[];for(var _0x272898=0x0;_0x272898<_0x4d8840[_0xd883('0x2a')];_0x272898+=0x1){var _0x1d39a3=_0x4d8840[_0x272898][_0xd883('0x2b')];if(_0x1d39a3===null){_0x8505ca[_0xd883('0x2c')](_0x4d8840[_0x272898][_0xd883('0x1e')](_0x1e27ea[_0xd883('0x1c')],{'transaction':_0xc6a335}));}else if(!_0x529bb4[_0xd883('0x2d')](_0x1d39a3)){_0x529bb4[_0xd883('0x2c')](_0x1d39a3);_0x8505ca['push'](_0x4d8840[_0x272898][_0xd883('0x1e')](_0x1e27ea[_0xd883('0x1c')],{'transaction':_0xc6a335}));}}return BPromise[_0xd883('0x2e')](_0x8505ca);});})['then'](function(_0x2f8cae){logger['info'](_0xd883('0x23'),_0x1e27ea);if(_0x2f8cae[_0xd883('0x2a')]>0x0){logger[_0xd883('0x17')](_0xd883('0x2f'),_0x2f8cae[0x0][_0xd883('0x30')]['id'],_0x2f8cae[0x0][_0xd883('0x30')][_0xd883('0x31')],_0x2f8cae[0x0][_0xd883('0x30')][_0xd883('0x20')]);}logger[_0xd883('0x11')](_0xd883('0x23'),_0x1e27ea,JSON[_0xd883('0x12')](_0x2f8cae));_0x33eaa7(_0x2f8cae);})[_0xd883('0x19')](function(_0xf5db49){logger[_0xd883('0x13')](_0xd883('0x23'),_0xf5db49[_0xd883('0x14')],_0x1e27ea);_0xae101d(_0x10f967[_0xd883('0x13')](0x1f4,_0xf5db49[_0xd883('0x14')]));});});});};exports[_0xd883('0x32')]=function(_0xfdfafb){var _0x2770a6=this;return new Promise(function(_0x51185d,_0x409295){return db[_0xd883('0x33')][_0xd883('0x26')](function(_0x281491){return db[_0xd883('0x34')][_0xd883('0x1b')](_0xfdfafb[_0xd883('0x1c')],{'raw':_0xfdfafb[_0xd883('0x8')]?_0xfdfafb[_0xd883('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x281491})[_0xd883('0x10')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xd883('0x12')](_0xfdfafb[_0xd883('0x8')][_0xd883('0xa')]),_0xfdfafb[_0xd883('0x8')][_0xd883('0xa')][_0xd883('0x20')]);return db[_0xd883('0x15')][_0xd883('0x22')]({'where':_0xfdfafb[_0xd883('0x8')]?_0xfdfafb[_0xd883('0x8')][_0xd883('0xa')]||null:null,'transaction':_0x281491});});})[_0xd883('0x10')](function(_0x5998fa){logger[_0xd883('0x17')](_0xd883('0x32'),_0xfdfafb);logger['debug'](_0xd883('0x32'),_0xfdfafb,JSON['stringify'](_0x5998fa));_0x51185d(_0x5998fa);})[_0xd883('0x19')](function(_0x4cf239){logger[_0xd883('0x13')](_0xd883('0x32'),_0x4cf239[_0xd883('0x14')],_0xfdfafb);_0x409295(_0x2770a6[_0xd883('0x13')](0x1f4,_0x4cf239[_0xd883('0x14')]));});});};exports[_0xd883('0x35')]=function(_0x4ad9e6){var _0x2fe085=this;return new Promise(function(_0x5e3cde,_0x39faf1){return db[_0xd883('0x15')][_0xd883('0x7')]({'raw':_0x4ad9e6[_0xd883('0x8')]?_0x4ad9e6[_0xd883('0x8')][_0xd883('0x9')]===undefined?!![]:![]:!![],'where':_0x4ad9e6[_0xd883('0x8')]?_0x4ad9e6[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0xd883('0x36'),db[_0xd883('0x33')]['fn']('IF',db['sequelize']['literal'](_0xd883('0x37')+util['format']('\x22%s\x22',moment()[_0xd883('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xd883('0x10')](function(_0x5031ae){logger[_0xd883('0x17')](_0xd883('0x35'),_0x4ad9e6);logger['debug'](_0xd883('0x35'),_0x4ad9e6,JSON[_0xd883('0x12')](_0x5031ae));_0x5e3cde(_0x5031ae);})[_0xd883('0x19')](function(_0x114e52){logger['error']('CountReScheduled',_0x114e52[_0xd883('0x14')],_0x4ad9e6);_0x39faf1(_0x2fe085[_0xd883('0x13')](0x1f4,_0x114e52[_0xd883('0x14')]));});});};exports[_0xd883('0x39')]=function(_0x5c68ce){var _0x32ac2a=this;return new Promise(function(_0x59396b,_0x3525e4){return db[_0xd883('0x24')]['describe']()['then'](function(){return db[_0xd883('0x33')][_0xd883('0x26')](function(_0x498f9e){return db[_0xd883('0x15')][_0xd883('0x7')]({'where':_0x5c68ce[_0xd883('0x8')]?_0x5c68ce[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':_0x5c68ce[_0xd883('0x8')]?_0x5c68ce[_0xd883('0x8')][_0xd883('0xb')]||null:null,'limit':0x1,'order':_0x5c68ce[_0xd883('0x8')]?_0x5c68ce['options'][_0xd883('0x3a')]||null:null,'group':db[_0xd883('0x15')][_0xd883('0x2b')],'transaction':_0x498f9e,'lock':_0x498f9e['LOCK']['UPDATE'],'include':_0x5c68ce[_0xd883('0x8')]?_0x5c68ce[_0xd883('0x8')]['include']?_['map'](_0x5c68ce['options'][_0xd883('0xe')],function(_0x9463d3){return{'model':db[_0x9463d3[_0xd883('0xf')]],'as':_0x9463d3['as'],'attributes':_0x9463d3[_0xd883('0xb')],'include':_0x9463d3[_0xd883('0xe')]?_['map'](_0x9463d3[_0xd883('0xe')],function(_0x3f078b){return{'model':db[_0x3f078b['model']],'as':_0x3f078b['as'],'attributes':_0x3f078b['attributes'],'include':_0x3f078b[_0xd883('0xe')]?_[_0xd883('0xd')](_0x3f078b[_0xd883('0xe')],function(_0x57d24e){return{'model':db[_0x57d24e[_0xd883('0xf')]],'as':_0x57d24e['as'],'attributes':_0x57d24e[_0xd883('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd883('0x10')](function(_0x34bfa4){var _0x4d0ee9=[];for(var _0x54ecdb=0x0;_0x54ecdb<_0x34bfa4[_0xd883('0x2a')];_0x54ecdb+=0x1){_0x4d0ee9[_0xd883('0x2c')](_0x34bfa4[_0x54ecdb][_0xd883('0x1e')](_0x5c68ce[_0xd883('0x1c')],{'transaction':_0x498f9e}));}return BPromise[_0xd883('0x2e')](_0x4d0ee9);});})['then'](function(_0x38031b){logger['info'](_0xd883('0x39'),_0x5c68ce);logger['debug']('GetContactRecallMe',_0x5c68ce,JSON[_0xd883('0x12')](_0x38031b));_0x59396b(_0x38031b);})[_0xd883('0x19')](function(_0x1c9238){logger[_0xd883('0x13')](_0xd883('0x39'),_0x1c9238[_0xd883('0x14')],_0x5c68ce);_0x3525e4(_0x32ac2a[_0xd883('0x13')](0x1f4,_0x1c9238['message']));});});});};exports[_0xd883('0x3b')]=function(_0x156edd){var _0xfc88d=this;return new Promise(function(_0x5f0096,_0x2a7e05){db[_0xd883('0x24')]['describe']()['then'](function(_0x5e83bd){return db[_0xd883('0x15')][_0xd883('0x7')]({'raw':_0x156edd[_0xd883('0x8')]?_0x156edd[_0xd883('0x8')][_0xd883('0x9')]===undefined?!![]:![]:!![],'where':_0x156edd[_0xd883('0x8')]?_0x156edd[_0xd883('0x8')][_0xd883('0xa')]||null:null,'attributes':_0x156edd['options']?_0x156edd[_0xd883('0x8')][_0xd883('0xb')]||null:null,'limit':_0x156edd[_0xd883('0x8')]?_0x156edd[_0xd883('0x8')][_0xd883('0xc')]||null:null,'include':_0x156edd[_0xd883('0x8')]?_0x156edd[_0xd883('0x8')][_0xd883('0xe')]?_[_0xd883('0xd')](_0x156edd['options'][_0xd883('0xe')],function(_0x3d943b){return{'model':db[_0x3d943b['model']],'as':_0x3d943b['as'],'attributes':_0x3d943b['as']===_0xd883('0x3c')?_[_0xd883('0x3d')](_0x5e83bd):_0x3d943b[_0xd883('0xb')],'include':_0x3d943b[_0xd883('0xe')]?_['map'](_0x3d943b[_0xd883('0xe')],function(_0x778a4f){return{'model':db[_0x778a4f['model']],'as':_0x778a4f['as'],'attributes':_0x778a4f[_0xd883('0xb')],'include':_0x778a4f[_0xd883('0xe')]?_[_0xd883('0xd')](_0x778a4f[_0xd883('0xe')],function(_0x28250f){return{'model':db[_0x28250f['model']],'as':_0x28250f['as'],'attributes':_0x28250f[_0xd883('0xb')]};}):[]};}):[]};}):[]:[]})[_0xd883('0x10')](function(_0x5cce8d){logger[_0xd883('0x17')](_0xd883('0x6'),_0x156edd);logger[_0xd883('0x11')]('GetCmHopper',_0x156edd,JSON[_0xd883('0x12')](_0x5cce8d));_0x5f0096(_0x5cce8d);})[_0xd883('0x19')](function(_0x1afa08){logger['error'](_0xd883('0x6'),_0x1afa08[_0xd883('0x14')],_0x156edd);_0x2a7e05(_0xfc88d[_0xd883('0x13')](0x1f4,_0x1afa08[_0xd883('0x14')]));});});});};exports[_0xd883('0x3e')]=function(_0x2e1401){var _0x5a60e7=this;return new Promise(function(_0x1be059,_0x3ff58a){return db[_0xd883('0x24')][_0xd883('0x3f')]({'raw':!![],'where':{'phone':_0x2e1401[_0xd883('0x8')]['where'][_0xd883('0x40')]},'attributes':['id',_0xd883('0x41')],'order':[['id',_0xd883('0x42')]]})[_0xd883('0x10')](function(_0x3aea96){logger['info'](_0xd883('0x43'),_0x2e1401);logger[_0xd883('0x11')](_0xd883('0x43'),_0x2e1401,JSON[_0xd883('0x12')](_0x3aea96));_0x1be059(_0x3aea96);})[_0xd883('0x19')](function(_0x5220ec){logger[_0xd883('0x13')]('getContactByPhone',_0x5220ec['message'],_0x2e1401);_0x3ff58a(_0x5a60e7[_0xd883('0x13')](0x1f4,_0x5220ec[_0xd883('0x14')]));});});};exports[_0xd883('0x44')]=function(_0x5b42d9){var _0x1c2f85=this;return new Promise(function(_0x4e2906,_0xd5b965){return db[_0xd883('0x33')][_0xd883('0x26')](function(_0x399f59){var _0x5ca8a4=_0x5b42d9[_0xd883('0x8')]&&_0x5b42d9[_0xd883('0x8')][_0xd883('0xa')]?_0x5b42d9[_0xd883('0x8')][_0xd883('0xa')]:{};return db[_0xd883('0x15')][_0xd883('0x1e')](_0x5b42d9[_0xd883('0x1c')],{'where':_0x5ca8a4,'transaction':_0x399f59})[_0xd883('0x10')](function(_0x572279){logger[_0xd883('0x17')]('ResetActiveCalls',_0x5b42d9);logger[_0xd883('0x11')]('ResetActiveCalls',_0x5b42d9,JSON['stringify'](_0x572279));_0x4e2906(_0x572279);})[_0xd883('0x19')](function(_0x567f8d){logger[_0xd883('0x13')](_0xd883('0x44'),_0x567f8d[_0xd883('0x14')],_0x5b42d9);_0xd5b965(_0x1c2f85[_0xd883('0x13')](0x1f4,_0x567f8d[_0xd883('0x14')]));});});});};exports[_0xd883('0x45')]=function(_0x598cf3){var _0x1e2bb5=this;var _0x51749a=_0x598cf3[_0xd883('0x1c')][_0xd883('0xa')]['voiceQueueIds'];var _0x45dcff=_0x598cf3[_0xd883('0x1c')]['where'][_0xd883('0x46')];var _0x4bcbcd=_0x598cf3[_0xd883('0x1c')]['where'][_0xd883('0x47')];return new Promise(function(_0x2a16d6,_0x3c4509){return db['CmHopper'][_0xd883('0x7')]({'where':{'voiceQueueId':{'$in':_0x51749a},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd883('0x33')][_0xd883('0x48')](_0xd883('0x49')+_0x45dcff+_0xd883('0x4a')),'$gt':db[_0xd883('0x33')][_0xd883('0x48')](_0xd883('0x4b'))}},'UserId':{'$in':_0x4bcbcd}},'include':[{'model':db[_0xd883('0x24')],'as':_0xd883('0x3c')},{'model':db[_0xd883('0x4c')],'as':_0xd883('0x4d'),'attributes':['id',_0xd883('0x29'),'voicePause']},{'model':db[_0xd883('0x4e')],'as':_0xd883('0x4f')}]})[_0xd883('0x10')](function(_0x382165){if(_0x382165['length']>0x0){return db[_0xd883('0x33')][_0xd883('0x26')](function(_0x4412c7){return db[_0xd883('0x15')][_0xd883('0x1e')]({'recallmeNotifiedDate':db[_0xd883('0x33')][_0xd883('0x48')](_0xd883('0x4b'))},{'where':{'id':{'$in':_[_0xd883('0xd')](_0x382165,'id')}},'transaction':_0x4412c7})[_0xd883('0x10')](function(){_0x2a16d6(_0x382165);})[_0xd883('0x19')](function(_0x5a650d){logger[_0xd883('0x13')](_0xd883('0x45'),_0x5a650d['message'],_0x598cf3);_0x3c4509(_0x1e2bb5[_0xd883('0x13')](0x1f4,_0x5a650d['message']));});})[_0xd883('0x19')](function(_0x35b272){logger[_0xd883('0x13')](_0xd883('0x45'),_0x35b272[_0xd883('0x14')],_0x598cf3);_0x3c4509(_0x1e2bb5[_0xd883('0x13')](0x1f4,_0x35b272[_0xd883('0x14')]));});}else{_0x2a16d6(_0x382165);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9f85fc2..210b2ce 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 _0x8d77=['/opencontacts','isAuthenticated','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','describe'];(function(_0x239302,_0x35cd5d){var _0x2bf5f7=function(_0xbff060){while(--_0xbff060){_0x239302['push'](_0x239302['shift']());}};_0x2bf5f7(++_0x35cd5d);}(_0x8d77,0xc8));var _0x78d7=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x8d77[_0x220dbb];return _0x2b77de;};'use strict';var express=require(_0x78d7('0x0'));var router=express[_0x78d7('0x1')]();var auth=require(_0x78d7('0x2'));var controller=require(_0x78d7('0x3'));router[_0x78d7('0x4')]('/',auth['isAuthenticated'](),controller[_0x78d7('0x5')]);router[_0x78d7('0x4')](_0x78d7('0x6'),auth['isAuthenticated'](),controller[_0x78d7('0x7')]);router[_0x78d7('0x4')](_0x78d7('0x8'),auth[_0x78d7('0x9')](),controller[_0x78d7('0xa')]);router[_0x78d7('0x4')]('/timezones',auth[_0x78d7('0x9')](),controller[_0x78d7('0xb')]);router['get'](_0x78d7('0xc'),auth['isAuthenticated'](),controller[_0x78d7('0xd')]);router[_0x78d7('0x4')](_0x78d7('0xe'),auth[_0x78d7('0x9')](),controller[_0x78d7('0xf')]);router[_0x78d7('0x10')]('/',auth[_0x78d7('0x9')](),controller['create']);router[_0x78d7('0x10')](_0x78d7('0x11'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x12')]);router[_0x78d7('0x10')](_0x78d7('0x13'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x14')]);router[_0x78d7('0x15')](_0x78d7('0xc'),auth['isAuthenticated'](),controller[_0x78d7('0x16')]);router[_0x78d7('0x17')](_0x78d7('0xc'),auth[_0x78d7('0x9')](),controller[_0x78d7('0x18')]);module[_0x78d7('0x19')]=router; \ No newline at end of file +var _0x9463=['post','/preview','getTimezone','/:id','update','express','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','show','/:id/previewrecall','create'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0x9463,0xfc));var _0x3946=function(_0x1c5c03,_0x446bfd){_0x1c5c03=_0x1c5c03-0x0;var _0x1437cd=_0x9463[_0x1c5c03];return _0x1437cd;};'use strict';var express=require(_0x3946('0x0'));var router=express['Router']();var auth=require(_0x3946('0x1'));var controller=require(_0x3946('0x2'));router[_0x3946('0x3')]('/',auth['isAuthenticated'](),controller[_0x3946('0x4')]);router[_0x3946('0x3')](_0x3946('0x5'),auth[_0x3946('0x6')](),controller[_0x3946('0x7')]);router[_0x3946('0x3')](_0x3946('0x8'),auth['isAuthenticated'](),controller['getOpenContacts']);router['get'](_0x3946('0x9'),auth['isAuthenticated'](),controller[_0x3946('0xa')]);router[_0x3946('0x3')]('/:id',auth[_0x3946('0x6')](),controller[_0x3946('0xb')]);router[_0x3946('0x3')](_0x3946('0xc'),auth[_0x3946('0x6')](),controller['getPreviewRecall']);router['post']('/',auth[_0x3946('0x6')](),controller[_0x3946('0xd')]);router[_0x3946('0xe')](_0x3946('0xf'),auth['isAuthenticated'](),controller['getPreview']);router[_0x3946('0xe')]('/timezone',auth[_0x3946('0x6')](),controller[_0x3946('0x10')]);router['put'](_0x3946('0x11'),auth[_0x3946('0x6')](),controller[_0x3946('0x12')]);router['delete'](_0x3946('0x11'),auth[_0x3946('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 077973a..3f7f570 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 _0xc549=['INTEGER','DATE','format','exports'];(function(_0x4d331c,_0x39ae7e){var _0x48f738=function(_0x5e1d90){while(--_0x5e1d90){_0x4d331c['push'](_0x4d331c['shift']());}};_0x48f738(++_0x39ae7e);}(_0xc549,0xd3));var _0x9c54=function(_0x473106,_0x4d1abe){_0x473106=_0x473106-0x0;var _0x1415bc=_0xc549[_0x473106];return _0x1415bc;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9c54('0x0')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9c54('0x2')],'defaultValue':moment()[_0x9c54('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9c54('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4f4b=['sequelize','exports','STRING','format','INTEGER','moment'];(function(_0x2e6f4b,_0xfec3eb){var _0x26b6bd=function(_0x112036){while(--_0x112036){_0x2e6f4b['push'](_0x2e6f4b['shift']());}};_0x26b6bd(++_0xfec3eb);}(_0x4f4b,0xf5));var _0xb4f4=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x4f4b[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0xb4f4('0x0'));var Sequelize=require(_0xb4f4('0x1'));module[_0xb4f4('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xb4f4('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb4f4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb4f4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb4f4('0x5')],'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 3631ce6..e4fc02b 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 _0x2c9a=['bluebird','mustache','util','path','sox','to-csv','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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','filter','VIRTUAL','merge','options','where','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x40067b,_0x5a4653){var _0x1d9959=function(_0x32080e){while(--_0x32080e){_0x40067b['push'](_0x40067b['shift']());}};_0x1d9959(++_0x5a4653);}(_0x2c9a,0xfd));var _0xa2c9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2c9a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa2c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2c9('0x1'));var jsonpatch=require(_0xa2c9('0x2'));var rp=require(_0xa2c9('0x3'));var moment=require(_0xa2c9('0x4'));var BPromise=require(_0xa2c9('0x5'));var Mustache=require(_0xa2c9('0x6'));var util=require(_0xa2c9('0x7'));var path=require(_0xa2c9('0x8'));var sox=require(_0xa2c9('0x9'));var csv=require(_0xa2c9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2c9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2c9('0xc'));var jsforce=require(_0xa2c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa2c9('0xa'));var querystring=require(_0xa2c9('0xe'));var Papa=require(_0xa2c9('0xf'));var Redis=require(_0xa2c9('0x10'));var authService=require(_0xa2c9('0x11'));var qs=require(_0xa2c9('0x12'));var as=require(_0xa2c9('0x13'));var hardwareService=require(_0xa2c9('0x14'));var logger=require(_0xa2c9('0x15'))(_0xa2c9('0x16'));var utils=require(_0xa2c9('0x17'));var config=require(_0xa2c9('0x18'));var licenseUtil=require(_0xa2c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec448,_0xd76159){_0xd76159=_0xd76159||0xcc;return function(_0x134a63){if(_0x134a63){return _0x3ec448[_0xa2c9('0x1a')](_0xd76159);}return _0x3ec448['status'](_0xd76159)['end']();};}function respondWithResult(_0xaae578,_0x8f8e6f){_0x8f8e6f=_0x8f8e6f||0xc8;return function(_0x45dc2e){if(_0x45dc2e){return _0xaae578[_0xa2c9('0x1b')](_0x8f8e6f)[_0xa2c9('0x1c')](_0x45dc2e);}};}function respondWithFilteredResult(_0x52f1ac,_0xa8b397){return function(_0x408760){if(_0x408760){var _0x4aded0=typeof _0xa8b397[_0xa2c9('0x1d')]===_0xa2c9('0x1e')&&typeof _0xa8b397[_0xa2c9('0x1f')]===_0xa2c9('0x1e');var _0x3d8b5a=_0x408760[_0xa2c9('0x20')];var _0x555bbf=_0x4aded0?0x0:_0xa8b397[_0xa2c9('0x1d')];var _0x21869a=_0x4aded0?_0x408760[_0xa2c9('0x20')]:_0xa8b397['offset']+_0xa8b397[_0xa2c9('0x1f')];var _0x1010a1;if(_0x21869a>=_0x3d8b5a){_0x21869a=_0x3d8b5a;_0x1010a1=0xc8;}else{_0x1010a1=0xce;}_0x52f1ac[_0xa2c9('0x1b')](_0x1010a1);return _0x52f1ac[_0xa2c9('0x21')](_0xa2c9('0x22'),_0x555bbf+'-'+_0x21869a+'/'+_0x3d8b5a)['json'](_0x408760);}return null;};}function patchUpdates(_0x3e7d82){return function(_0x1f60a3){try{jsonpatch[_0xa2c9('0x23')](_0x1f60a3,_0x3e7d82,!![]);}catch(_0x313509){return BPromise[_0xa2c9('0x24')](_0x313509);}return _0x1f60a3[_0xa2c9('0x25')]();};}function saveUpdates(_0x17fce5,_0x550466){return function(_0x22fa2f){if(_0x22fa2f){return _0x22fa2f[_0xa2c9('0x26')](_0x17fce5)['then'](function(_0x32613f){return _0x32613f;});}return null;};}function removeEntity(_0x1f7fdc,_0x4e2243){return function(_0x3ddd9f){if(_0x3ddd9f){return _0x3ddd9f[_0xa2c9('0x27')]()[_0xa2c9('0x28')](function(){var _0x55c44f=_0x3ddd9f['get']({'plain':!![]});var _0x4dac76=_0xa2c9('0x29');return db[_0xa2c9('0x2a')][_0xa2c9('0x27')]({'where':{'type':_0x4dac76,'resourceId':_0x55c44f['id']}})[_0xa2c9('0x28')](function(){return _0x3ddd9f;});})[_0xa2c9('0x28')](function(){_0x1f7fdc[_0xa2c9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e52f,_0xb1831f){return function(_0x2b6e0e){if(!_0x2b6e0e){_0x11e52f[_0xa2c9('0x1a')](0x194);}return _0x2b6e0e;};}function handleError(_0x4a842b,_0x198cda){_0x198cda=_0x198cda||0x1f4;return function(_0x293e56){logger[_0xa2c9('0x2b')](_0x293e56[_0xa2c9('0x2c')]);if(_0x293e56[_0xa2c9('0x2d')]){delete _0x293e56[_0xa2c9('0x2d')];}_0x4a842b[_0xa2c9('0x1b')](_0x198cda)[_0xa2c9('0x2e')](_0x293e56);};}exports[_0xa2c9('0x2f')]=function(_0x2934ee,_0x8d5e86){var _0x2776e5={},_0x4b6a00={},_0xe18ebb={'count':0x0,'rows':[]};var _0x17f2cb=_[_0xa2c9('0x30')](db[_0xa2c9('0x31')][_0xa2c9('0x32')],function(_0x59958a){return{'name':_0x59958a[_0xa2c9('0x33')],'type':_0x59958a[_0xa2c9('0x34')][_0xa2c9('0x35')]};});_0x4b6a00[_0xa2c9('0x36')]=_['map'](_0x17f2cb,_0xa2c9('0x2d'));_0x4b6a00['query']=_[_0xa2c9('0x37')](_0x2934ee['query']);_0x4b6a00[_0xa2c9('0x38')]=_[_0xa2c9('0x39')](_0x4b6a00[_0xa2c9('0x36')],_0x4b6a00[_0xa2c9('0x3a')]);_0x2776e5['attributes']=_[_0xa2c9('0x39')](_0x4b6a00[_0xa2c9('0x36')],qs[_0xa2c9('0x3b')](_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x3b')]));_0x2776e5[_0xa2c9('0x3c')]=_0x2776e5[_0xa2c9('0x3c')][_0xa2c9('0x3d')]?_0x2776e5['attributes']:_0x4b6a00['model'];if(!_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x3e')]('nolimit')){_0x2776e5[_0xa2c9('0x1f')]=qs['limit'](_0x2934ee['query'][_0xa2c9('0x1f')]);_0x2776e5[_0xa2c9('0x1d')]=qs[_0xa2c9('0x1d')](_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x1d')]);}_0x2776e5[_0xa2c9('0x3f')]=qs[_0xa2c9('0x40')](_0x2934ee[_0xa2c9('0x3a')]['sort']);_0x2776e5['where']=qs[_0xa2c9('0x38')](_['pick'](_0x2934ee[_0xa2c9('0x3a')],_0x4b6a00[_0xa2c9('0x38')]),_0x17f2cb);if(_0x2934ee[_0xa2c9('0x3a')][_0xa2c9('0x41')]){_0x2776e5['where']=_['merge'](_0x2776e5['where'],{'$or':_['map'](_0x17f2cb,function(_0xcb5b01){if(_0xcb5b01[_0xa2c9('0x34')]!==_0xa2c9('0x42')){var _0x34527b={};_0x34527b[_0xcb5b01[_0xa2c9('0x2d')]]={'$like':'%'+_0x2934ee['query'][_0xa2c9('0x41')]+'%'};return _0x34527b;}})});}_0x2776e5=_[_0xa2c9('0x43')]({},_0x2776e5,_0x2934ee[_0xa2c9('0x44')]);var _0x3ed97a={'where':_0x2776e5[_0xa2c9('0x45')]};return db['CmHopperAdditionalPhone'][_0xa2c9('0x20')](_0x3ed97a)[_0xa2c9('0x28')](function(_0x17fe10){_0xe18ebb[_0xa2c9('0x20')]=_0x17fe10;if(_0x2934ee['query'][_0xa2c9('0x46')]){_0x2776e5['include']=[{'all':!![]}];}return db[_0xa2c9('0x31')][_0xa2c9('0x47')](_0x2776e5);})['then'](function(_0xb120b4){_0xe18ebb[_0xa2c9('0x48')]=_0xb120b4;return _0xe18ebb;})[_0xa2c9('0x28')](respondWithFilteredResult(_0x8d5e86,_0x2776e5))[_0xa2c9('0x49')](handleError(_0x8d5e86,null));};exports[_0xa2c9('0x4a')]=function(_0x438767,_0x199ae8){var _0x12c7fb={'raw':!![],'where':{'id':_0x438767[_0xa2c9('0x4b')]['id']}},_0x5a539e={};_0x5a539e[_0xa2c9('0x36')]=_['keys'](db[_0xa2c9('0x31')]['rawAttributes']);_0x5a539e['query']=_['keys'](_0x438767[_0xa2c9('0x3a')]);_0x5a539e[_0xa2c9('0x38')]=_[_0xa2c9('0x39')](_0x5a539e['model'],_0x5a539e[_0xa2c9('0x3a')]);_0x12c7fb[_0xa2c9('0x3c')]=_['intersection'](_0x5a539e[_0xa2c9('0x36')],qs[_0xa2c9('0x3b')](_0x438767[_0xa2c9('0x3a')][_0xa2c9('0x3b')]));_0x12c7fb[_0xa2c9('0x3c')]=_0x12c7fb['attributes'][_0xa2c9('0x3d')]?_0x12c7fb[_0xa2c9('0x3c')]:_0x5a539e[_0xa2c9('0x36')];if(_0x438767[_0xa2c9('0x3a')][_0xa2c9('0x46')]){_0x12c7fb['include']=[{'all':!![]}];}_0x12c7fb=_[_0xa2c9('0x43')]({},_0x12c7fb,_0x438767[_0xa2c9('0x44')]);return db[_0xa2c9('0x31')][_0xa2c9('0x4c')](_0x12c7fb)[_0xa2c9('0x28')](handleEntityNotFound(_0x199ae8,null))[_0xa2c9('0x28')](respondWithResult(_0x199ae8,null))['catch'](handleError(_0x199ae8,null));};exports[_0xa2c9('0x4d')]=function(_0x2d0cd3,_0x4bb05a){return db[_0xa2c9('0x31')][_0xa2c9('0x4d')](_0x2d0cd3[_0xa2c9('0x4e')],{})[_0xa2c9('0x28')](function(_0x40f9c6){var _0x1f5c22=_0x2d0cd3[_0xa2c9('0x4f')]['get']({'plain':!![]});if(!_0x1f5c22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5c22[_0xa2c9('0x50')]===_0xa2c9('0x4f')){var _0xb10c0c=_0x40f9c6[_0xa2c9('0x51')]({'plain':!![]});var _0x2443ce=_0xa2c9('0x29');return db[_0xa2c9('0x52')][_0xa2c9('0x4c')]({'where':{'name':_0x2443ce,'userProfileId':_0x1f5c22[_0xa2c9('0x53')]},'raw':!![]})[_0xa2c9('0x28')](function(_0x27f9a6){if(_0x27f9a6&&_0x27f9a6[_0xa2c9('0x54')]===0x0){return db[_0xa2c9('0x2a')]['create']({'name':_0xb10c0c[_0xa2c9('0x2d')],'resourceId':_0xb10c0c['id'],'type':_0x27f9a6[_0xa2c9('0x2d')],'sectionId':_0x27f9a6['id']},{})[_0xa2c9('0x28')](function(){return _0x40f9c6;});}else{return _0x40f9c6;}})['catch'](function(_0x2c929c){logger[_0xa2c9('0x2b')](_0xa2c9('0x55'),_0x2c929c);throw _0x2c929c;});}return _0x40f9c6;})[_0xa2c9('0x28')](respondWithResult(_0x4bb05a,0xc9))[_0xa2c9('0x49')](handleError(_0x4bb05a,null));};exports[_0xa2c9('0x26')]=function(_0x3e5d01,_0x36e2af){if(_0x3e5d01[_0xa2c9('0x4e')]['id']){delete _0x3e5d01['body']['id'];}return db[_0xa2c9('0x31')][_0xa2c9('0x4c')]({'where':{'id':_0x3e5d01[_0xa2c9('0x4b')]['id']}})[_0xa2c9('0x28')](handleEntityNotFound(_0x36e2af,null))[_0xa2c9('0x28')](saveUpdates(_0x3e5d01[_0xa2c9('0x4e')],null))['then'](respondWithResult(_0x36e2af,null))['catch'](handleError(_0x36e2af,null));};exports[_0xa2c9('0x27')]=function(_0x10442c,_0x4521b6){return db[_0xa2c9('0x31')][_0xa2c9('0x4c')]({'where':{'id':_0x10442c[_0xa2c9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4521b6,null))[_0xa2c9('0x28')](removeEntity(_0x4521b6,null))['catch'](handleError(_0x4521b6,null));}; \ No newline at end of file +var _0x608c=['UserProfileResource','error','stack','name','send','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','end','status','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','CmHopperAdditionalPhones'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x608c,0x1ae));var _0xc608=function(_0x5e7e66,_0x2f37c1){_0x5e7e66=_0x5e7e66-0x0;var _0x3b3f02=_0x608c[_0x5e7e66];return _0x3b3f02;};'use strict';var emlformat=require(_0xc608('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc608('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc608('0x2'));var moment=require(_0xc608('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc608('0x4'));var path=require(_0xc608('0x5'));var sox=require(_0xc608('0x6'));var csv=require(_0xc608('0x7'));var ejs=require(_0xc608('0x8'));var fs=require('fs');var fs_extra=require(_0xc608('0x9'));var _=require('lodash');var squel=require(_0xc608('0xa'));var crypto=require(_0xc608('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc608('0x7'));var querystring=require('querystring');var Papa=require(_0xc608('0xc'));var Redis=require(_0xc608('0xd'));var authService=require(_0xc608('0xe'));var qs=require(_0xc608('0xf'));var as=require(_0xc608('0x10'));var hardwareService=require(_0xc608('0x11'));var logger=require(_0xc608('0x12'))(_0xc608('0x13'));var utils=require(_0xc608('0x14'));var config=require(_0xc608('0x15'));var licenseUtil=require(_0xc608('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49a643,_0x47b730){_0x47b730=_0x47b730||0xcc;return function(_0x252823){if(_0x252823){return _0x49a643[_0xc608('0x17')](_0x47b730);}return _0x49a643['status'](_0x47b730)[_0xc608('0x18')]();};}function respondWithResult(_0x5c7523,_0x17b74b){_0x17b74b=_0x17b74b||0xc8;return function(_0x1d806a){if(_0x1d806a){return _0x5c7523[_0xc608('0x19')](_0x17b74b)['json'](_0x1d806a);}};}function respondWithFilteredResult(_0x271575,_0x14ed9d){return function(_0x439628){if(_0x439628){var _0x2931c9=typeof _0x14ed9d[_0xc608('0x1a')]===_0xc608('0x1b')&&typeof _0x14ed9d[_0xc608('0x1c')]===_0xc608('0x1b');var _0x2e385d=_0x439628[_0xc608('0x1d')];var _0x2dc1f5=_0x2931c9?0x0:_0x14ed9d[_0xc608('0x1a')];var _0x592b1e=_0x2931c9?_0x439628[_0xc608('0x1d')]:_0x14ed9d[_0xc608('0x1a')]+_0x14ed9d[_0xc608('0x1c')];var _0x328156;if(_0x592b1e>=_0x2e385d){_0x592b1e=_0x2e385d;_0x328156=0xc8;}else{_0x328156=0xce;}_0x271575[_0xc608('0x19')](_0x328156);return _0x271575[_0xc608('0x1e')]('Content-Range',_0x2dc1f5+'-'+_0x592b1e+'/'+_0x2e385d)['json'](_0x439628);}return null;};}function patchUpdates(_0xc112e6){return function(_0x59e08f){try{jsonpatch['apply'](_0x59e08f,_0xc112e6,!![]);}catch(_0x5bb3a6){return BPromise[_0xc608('0x1f')](_0x5bb3a6);}return _0x59e08f[_0xc608('0x20')]();};}function saveUpdates(_0x1ec663,_0x38cd34){return function(_0x45995b){if(_0x45995b){return _0x45995b[_0xc608('0x21')](_0x1ec663)[_0xc608('0x22')](function(_0x349ae0){return _0x349ae0;});}return null;};}function removeEntity(_0x6e81e4,_0x391677){return function(_0x1bc06e){if(_0x1bc06e){return _0x1bc06e[_0xc608('0x23')]()[_0xc608('0x22')](function(){var _0x40c4d5=_0x1bc06e[_0xc608('0x24')]({'plain':!![]});var _0x5a433c=_0xc608('0x25');return db[_0xc608('0x26')][_0xc608('0x23')]({'where':{'type':_0x5a433c,'resourceId':_0x40c4d5['id']}})[_0xc608('0x22')](function(){return _0x1bc06e;});})[_0xc608('0x22')](function(){_0x6e81e4['status'](0xcc)[_0xc608('0x18')]();});}};}function handleEntityNotFound(_0x4b72ab,_0x376562){return function(_0x253c74){if(!_0x253c74){_0x4b72ab['sendStatus'](0x194);}return _0x253c74;};}function handleError(_0x5b67af,_0x183780){_0x183780=_0x183780||0x1f4;return function(_0x89733b){logger[_0xc608('0x27')](_0x89733b[_0xc608('0x28')]);if(_0x89733b[_0xc608('0x29')]){delete _0x89733b['name'];}_0x5b67af[_0xc608('0x19')](_0x183780)[_0xc608('0x2a')](_0x89733b);};}exports['index']=function(_0x517909,_0x4698c1){var _0xcf9b6a={},_0x5ccdef={},_0x9d4df2={'count':0x0,'rows':[]};var _0xe8fa82=_['map'](db[_0xc608('0x2b')][_0xc608('0x2c')],function(_0x3e5880){return{'name':_0x3e5880[_0xc608('0x2d')],'type':_0x3e5880[_0xc608('0x2e')]['key']};});_0x5ccdef[_0xc608('0x2f')]=_['map'](_0xe8fa82,_0xc608('0x29'));_0x5ccdef[_0xc608('0x30')]=_[_0xc608('0x31')](_0x517909[_0xc608('0x30')]);_0x5ccdef['filters']=_[_0xc608('0x32')](_0x5ccdef[_0xc608('0x2f')],_0x5ccdef[_0xc608('0x30')]);_0xcf9b6a[_0xc608('0x33')]=_['intersection'](_0x5ccdef[_0xc608('0x2f')],qs[_0xc608('0x34')](_0x517909[_0xc608('0x30')]['fields']));_0xcf9b6a[_0xc608('0x33')]=_0xcf9b6a['attributes'][_0xc608('0x35')]?_0xcf9b6a['attributes']:_0x5ccdef[_0xc608('0x2f')];if(!_0x517909[_0xc608('0x30')][_0xc608('0x36')](_0xc608('0x37'))){_0xcf9b6a['limit']=qs[_0xc608('0x1c')](_0x517909[_0xc608('0x30')]['limit']);_0xcf9b6a[_0xc608('0x1a')]=qs[_0xc608('0x1a')](_0x517909[_0xc608('0x30')][_0xc608('0x1a')]);}_0xcf9b6a[_0xc608('0x38')]=qs['sort'](_0x517909['query']['sort']);_0xcf9b6a['where']=qs[_0xc608('0x39')](_['pick'](_0x517909[_0xc608('0x30')],_0x5ccdef[_0xc608('0x39')]),_0xe8fa82);if(_0x517909[_0xc608('0x30')][_0xc608('0x3a')]){_0xcf9b6a[_0xc608('0x3b')]=_[_0xc608('0x3c')](_0xcf9b6a[_0xc608('0x3b')],{'$or':_['map'](_0xe8fa82,function(_0x9835be){if(_0x9835be[_0xc608('0x2e')]!==_0xc608('0x3d')){var _0x4a9688={};_0x4a9688[_0x9835be[_0xc608('0x29')]]={'$like':'%'+_0x517909[_0xc608('0x30')][_0xc608('0x3a')]+'%'};return _0x4a9688;}})});}_0xcf9b6a=_[_0xc608('0x3c')]({},_0xcf9b6a,_0x517909[_0xc608('0x3e')]);var _0x1c2ba3={'where':_0xcf9b6a['where']};return db[_0xc608('0x2b')]['count'](_0x1c2ba3)['then'](function(_0x55ecc8){_0x9d4df2['count']=_0x55ecc8;if(_0x517909[_0xc608('0x30')][_0xc608('0x3f')]){_0xcf9b6a['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xc608('0x40')](_0xcf9b6a);})['then'](function(_0xea9fbb){_0x9d4df2[_0xc608('0x41')]=_0xea9fbb;return _0x9d4df2;})[_0xc608('0x22')](respondWithFilteredResult(_0x4698c1,_0xcf9b6a))[_0xc608('0x42')](handleError(_0x4698c1,null));};exports[_0xc608('0x43')]=function(_0x247ba6,_0x3aa01b){var _0xb29242={'raw':!![],'where':{'id':_0x247ba6[_0xc608('0x44')]['id']}},_0x15b1a6={};_0x15b1a6[_0xc608('0x2f')]=_[_0xc608('0x31')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x15b1a6[_0xc608('0x30')]=_['keys'](_0x247ba6[_0xc608('0x30')]);_0x15b1a6[_0xc608('0x39')]=_[_0xc608('0x32')](_0x15b1a6['model'],_0x15b1a6[_0xc608('0x30')]);_0xb29242['attributes']=_[_0xc608('0x32')](_0x15b1a6[_0xc608('0x2f')],qs[_0xc608('0x34')](_0x247ba6[_0xc608('0x30')][_0xc608('0x34')]));_0xb29242[_0xc608('0x33')]=_0xb29242[_0xc608('0x33')][_0xc608('0x35')]?_0xb29242[_0xc608('0x33')]:_0x15b1a6[_0xc608('0x2f')];if(_0x247ba6[_0xc608('0x30')]['includeAll']){_0xb29242['include']=[{'all':!![]}];}_0xb29242=_[_0xc608('0x3c')]({},_0xb29242,_0x247ba6[_0xc608('0x3e')]);return db['CmHopperAdditionalPhone'][_0xc608('0x45')](_0xb29242)[_0xc608('0x22')](handleEntityNotFound(_0x3aa01b,null))[_0xc608('0x22')](respondWithResult(_0x3aa01b,null))[_0xc608('0x42')](handleError(_0x3aa01b,null));};exports['create']=function(_0x43152d,_0x452546){return db[_0xc608('0x2b')][_0xc608('0x46')](_0x43152d[_0xc608('0x47')],{})[_0xc608('0x22')](function(_0xb28a55){var _0x59c8d9=_0x43152d[_0xc608('0x48')][_0xc608('0x24')]({'plain':!![]});if(!_0x59c8d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59c8d9[_0xc608('0x49')]===_0xc608('0x48')){var _0x5ad398=_0xb28a55['get']({'plain':!![]});var _0x16a1b5=_0xc608('0x25');return db[_0xc608('0x4a')]['find']({'where':{'name':_0x16a1b5,'userProfileId':_0x59c8d9[_0xc608('0x4b')]},'raw':!![]})[_0xc608('0x22')](function(_0x27257d){if(_0x27257d&&_0x27257d[_0xc608('0x4c')]===0x0){return db[_0xc608('0x26')][_0xc608('0x46')]({'name':_0x5ad398['name'],'resourceId':_0x5ad398['id'],'type':_0x27257d[_0xc608('0x29')],'sectionId':_0x27257d['id']},{})['then'](function(){return _0xb28a55;});}else{return _0xb28a55;}})[_0xc608('0x42')](function(_0x2aa266){logger[_0xc608('0x27')](_0xc608('0x4d'),_0x2aa266);throw _0x2aa266;});}return _0xb28a55;})['then'](respondWithResult(_0x452546,0xc9))[_0xc608('0x42')](handleError(_0x452546,null));};exports[_0xc608('0x21')]=function(_0x68822b,_0x13c9ac){if(_0x68822b[_0xc608('0x47')]['id']){delete _0x68822b['body']['id'];}return db['CmHopperAdditionalPhone'][_0xc608('0x45')]({'where':{'id':_0x68822b[_0xc608('0x44')]['id']}})[_0xc608('0x22')](handleEntityNotFound(_0x13c9ac,null))[_0xc608('0x22')](saveUpdates(_0x68822b[_0xc608('0x47')],null))[_0xc608('0x22')](respondWithResult(_0x13c9ac,null))[_0xc608('0x42')](handleError(_0x13c9ac,null));};exports[_0xc608('0x23')]=function(_0x3615fb,_0x126bb2){return db['CmHopperAdditionalPhone'][_0xc608('0x45')]({'where':{'id':_0x3615fb['params']['id']}})[_0xc608('0x22')](handleEntityNotFound(_0x126bb2,null))['then'](removeEntity(_0x126bb2,null))[_0xc608('0x42')](handleError(_0x126bb2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 721688a..0323071 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 _0x5251=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone'];(function(_0x48bc0d,_0x30becd){var _0x35f641=function(_0x136926){while(--_0x136926){_0x48bc0d['push'](_0x48bc0d['shift']());}};_0x35f641(++_0x30becd);}(_0x5251,0x1c9));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1525('0x0'));var util=require(_0x1525('0x1'));var logger=require(_0x1525('0x2'))(_0x1525('0x3'));var moment=require(_0x1525('0x4'));var BPromise=require(_0x1525('0x5'));var rp=require(_0x1525('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1525('0x7'));var config=require(_0x1525('0x8'));var attributes=require(_0x1525('0x9'));module['exports']=function(_0x354664,_0x386b9f){return _0x354664['define'](_0x1525('0xa'),attributes,{'tableName':_0x1525('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51e3=['request-promise','path','../../config/environment','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','moment','bluebird'];(function(_0x545b2b,_0x41f0b8){var _0x3075d0=function(_0x48c38f){while(--_0x48c38f){_0x545b2b['push'](_0x545b2b['shift']());}};_0x3075d0(++_0x41f0b8);}(_0x51e3,0x87));var _0x351e=function(_0x4787e0,_0x30eae0){_0x4787e0=_0x4787e0-0x0;var _0x2de174=_0x51e3[_0x4787e0];return _0x2de174;};'use strict';var _=require(_0x351e('0x0'));var util=require(_0x351e('0x1'));var logger=require(_0x351e('0x2'))('api');var moment=require(_0x351e('0x3'));var BPromise=require(_0x351e('0x4'));var rp=require(_0x351e('0x5'));var fs=require('fs');var path=require(_0x351e('0x6'));var rimraf=require('rimraf');var config=require(_0x351e('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x21ed9d,_0x5ebfd4){return _0x21ed9d[_0x351e('0x8')](_0x351e('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 9cd1413..99b1d56 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 _0xa70e=['message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countbusyretry','countnosuchnumberretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0xa70e,0x103));var _0xea70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa70e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea70('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea70('0x1'));var db=require(_0xea70('0x2'))['db'];var utils=require(_0xea70('0x3'));var logger=require(_0xea70('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xea70('0x5'));var client=jayson['client'][_0xea70('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x583cf9,_0x4b4826,_0x160d5b){return new BPromise(function(_0x2ab072,_0x140aa6){return client[_0xea70('0x7')](_0x583cf9,_0x160d5b)[_0xea70('0x8')](function(_0x4374ca){logger[_0xea70('0x9')](_0xea70('0xa'),_0x4b4826,'request\x20sent');logger[_0xea70('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x4b4826,_0xea70('0xc'),JSON[_0xea70('0xd')](_0x4374ca));if(_0x4374ca[_0xea70('0xe')]){if(_0x4374ca['error'][_0xea70('0xf')]===0x1f4){logger[_0xea70('0xe')](_0xea70('0xa'),_0x4b4826,_0x4374ca[_0xea70('0xe')][_0xea70('0x10')]);return _0x140aa6(_0x4374ca[_0xea70('0xe')]['message']);}logger[_0xea70('0xe')](_0xea70('0xa'),_0x4b4826,_0x4374ca[_0xea70('0xe')]['message']);return _0x2ab072(_0x4374ca[_0xea70('0xe')][_0xea70('0x10')]);}else{logger[_0xea70('0x9')](_0xea70('0xa'),_0x4b4826,_0xea70('0xc'));_0x2ab072(_0x4374ca[_0xea70('0x11')][_0xea70('0x10')]);}})[_0xea70('0x12')](function(_0x1aaa36){logger['error'](_0xea70('0xa'),_0x4b4826,_0x1aaa36);_0x140aa6(_0x1aaa36);});});}exports[_0xea70('0x13')]=function(_0x1d1f12){var _0x22ee08=this;return new Promise(function(_0x25739c,_0x59a5d6){return db[_0xea70('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x16')],'ListId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x17')],'VoiceQueueId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x18')]===undefined?null:_0x1d1f12[_0xea70('0x15')][_0xea70('0x18')],'CampaignId':_0x1d1f12[_0xea70('0x15')][_0xea70('0x19')]===undefined?null:_0x1d1f12[_0xea70('0x15')][_0xea70('0x19')]}})[_0xea70('0x8')](function(_0x5f0e0b){if(_0x5f0e0b!=null){return db[_0xea70('0x1a')][_0xea70('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x5f0e0b['id'],'OrderBy':{'$gt':_0x5f0e0b[_0xea70('0x1c')]}},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0xc3e631){var _0x538763=0x0;if(_0xc3e631){if(_0xc3e631['countbusyretry']+_0xc3e631[_0xea70('0x1e')]+_0xc3e631[_0xea70('0x1f')]+_0xc3e631['countnosuchnumberretry']+_0xc3e631[_0xea70('0x20')]+_0xc3e631[_0xea70('0x21')]+_0xc3e631[_0xea70('0x22')]+_0xc3e631[_0xea70('0x23')]<_0x1d1f12[_0xea70('0x24')]['dialGlobalMaxRetry'])_0x538763=0x1;_0x25739c({'additional':_0x538763});}else{return db[_0xea70('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5f0e0b['id']},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0x1be30c){var _0x24773a=0x0;if(_0x1be30c){if(_0x1be30c[_0xea70('0x25')]+_0x1be30c[_0xea70('0x1e')]+_0x1be30c[_0xea70('0x1f')]+_0x1be30c[_0xea70('0x26')]+_0x1be30c[_0xea70('0x20')]+_0x1be30c[_0xea70('0x21')]+_0x1be30c[_0xea70('0x22')]+_0x1be30c[_0xea70('0x23')]<_0x1d1f12[_0xea70('0x24')][_0xea70('0x27')])_0x24773a=0x1;_0x25739c({'additional':_0x24773a});}else{_0x25739c({'additional':0x0});}})[_0xea70('0x12')](function(_0x21ce11){logger['error'](_0xea70('0x13'),_0x21ce11[_0xea70('0x10')]);_0x59a5d6(_0x22ee08[_0xea70('0xe')](0x1f4,_0x21ce11[_0xea70('0x10')]));});}})[_0xea70('0x12')](function(_0x8881f){logger['error'](_0xea70('0x13'),_0x8881f[_0xea70('0x10')]);_0x59a5d6(_0x22ee08[_0xea70('0xe')](0x1f4,_0x8881f[_0xea70('0x10')]));});}else _0x25739c({'additional':0x0});});});};exports[_0xea70('0x28')]=function(_0x239b9c){var _0x638ea0=this;return new Promise(function(_0x3d673c,_0x7c89a7){return db[_0xea70('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x239b9c[_0xea70('0x15')]['ContactId'],'ListId':_0x239b9c['body'][_0xea70('0x17')],'VoiceQueueId':_0x239b9c['body'][_0xea70('0x18')]===undefined?null:_0x239b9c[_0xea70('0x15')]['VoiceQueueId'],'CampaignId':_0x239b9c['body'][_0xea70('0x19')]===undefined?null:_0x239b9c[_0xea70('0x15')]['CampaignId']}})[_0xea70('0x8')](function(_0x3f81e0){if(_0x3f81e0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x3f81e0['id'],'OrderBy':{'$gte':_0x3f81e0[_0xea70('0x1c')]}},'order':[[_0xea70('0x1c'),'ASC']]})[_0xea70('0x8')](function(_0x4c0e14){if(_0x4c0e14)return activateAdditionalPhone(_0x3f81e0,_0x239b9c[_0xea70('0x15')],_0x4c0e14,_0x239b9c[_0xea70('0x29')],_0x239b9c[_0xea70('0x2a')])[_0xea70('0x8')](function(_0x1fd4a7){_0x3d673c(_0x1fd4a7);});else{return db['CmHopperAdditionalPhone'][_0xea70('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3f81e0['id']},'order':[[_0xea70('0x1c'),_0xea70('0x1d')]]})[_0xea70('0x8')](function(_0x895072){if(_0x895072)return activateAdditionalPhone(_0x3f81e0,_0x239b9c[_0xea70('0x15')],_0x895072,_0x239b9c['duration'],_0x239b9c[_0xea70('0x2a')])[_0xea70('0x8')](function(_0x30bf62){_0x3d673c(_0x30bf62);});else{_0x3d673c({'id':_0x3f81e0['id'],'phone':''});}})[_0xea70('0x12')](function(_0x422f46){logger[_0xea70('0xe')](_0xea70('0x13'),_0x422f46[_0xea70('0x10')]);_0x7c89a7(_0x638ea0['error'](0x1f4,_0x422f46[_0xea70('0x10')]));});}})[_0xea70('0x12')](function(_0x4461e2){logger[_0xea70('0xe')]('VerifyAdditionalPhones',_0x4461e2[_0xea70('0x10')]);_0x7c89a7(_0x638ea0[_0xea70('0xe')](0x1f4,_0x4461e2[_0xea70('0x10')]));});}else _0x3d673c(0x1);});});};function activateAdditionalPhone(_0x490cf2,_0x55f2bb,_0x19a196,_0x4f2159,_0x481197){return new Promise(function(_0x4b034a,_0x57564d){var _0x560a89;if(_[_0xea70('0x2b')](_0x19a196[_0xea70('0x2c')])){_0x19a196[_0xea70('0x2c')]=moment();}if(moment()>moment(_0x19a196['scheduledat'])){_0x560a89=moment()[_0xea70('0x2d')](_0x481197||0x3,_0xea70('0x2e'));}else{if(_0x19a196['OrderBy']==0x0){_0x560a89=moment(_0x19a196[_0xea70('0x2c')]);}else{_0x560a89=moment()['add'](_0x481197||0x3,_0xea70('0x2e'));}}if(_[_0xea70('0x2b')](_0x560a89)){_0x560a89=moment()[_0xea70('0x2d')](_0x481197||0x3,_0xea70('0x2e'));}var _0x2cb2db={'phone':_0x490cf2[_0xea70('0x2f')],'active':0x0,'OrderBy':_[_0xea70('0x2b')](_0x490cf2[_0xea70('0x1c')])?0x0:_0x490cf2[_0xea70('0x1c')],'scheduledat':moment()[_0xea70('0x2d')](_0x4f2159||0x1,_0xea70('0x2e')),'countbusyretry':_0x55f2bb['countbusyretry'],'countcongestionretry':_0x55f2bb[_0xea70('0x1e')],'countnoanswerretry':_0x55f2bb[_0xea70('0x1f')],'countnosuchnumberretry':_0x55f2bb[_0xea70('0x26')],'countdropretry':_0x55f2bb[_0xea70('0x20')],'countabandonedretry':_0x55f2bb[_0xea70('0x21')],'countmachineretry':_0x55f2bb[_0xea70('0x22')],'countagentrejectretry':_0x55f2bb[_0xea70('0x23')],'createdAt':_0x55f2bb[_0xea70('0x30')],'updatedAt':_0x55f2bb['updatedAt']};var _0x94e9ba={'CmHopperId':_0x490cf2['id'],'phone':_0x19a196['phone'],'active':0x0,'OrderBy':_[_0xea70('0x2b')](_0x19a196[_0xea70('0x1c')])?0x0:_0x19a196[_0xea70('0x1c')],'scheduledat':_0x560a89,'countbusyretry':_0x19a196[_0xea70('0x25')],'countcongestionretry':_0x19a196['countcongestionretry'],'countnoanswerretry':_0x19a196[_0xea70('0x1f')],'countnosuchnumberretry':_0x19a196[_0xea70('0x26')],'countdropretry':_0x19a196[_0xea70('0x20')],'countabandonedretry':_0x19a196['countabandonedretry'],'countmachineretry':_0x19a196[_0xea70('0x22')],'countagentrejectretry':_0x19a196[_0xea70('0x23')],'createdAt':_0x19a196[_0xea70('0x30')],'updatedAt':_0x19a196[_0xea70('0x31')]};return db[_0xea70('0x32')]['transaction'](function(_0x6a43d0){return db[_0xea70('0x1a')][_0xea70('0x33')](_0x2cb2db,{'where':{'id':_0x19a196['id']}},{'transaction':_0x6a43d0})[_0xea70('0x8')](function(){return db[_0xea70('0x14')][_0xea70('0x33')](_0x94e9ba,{'where':{'id':_0x490cf2['id']}},{'transaction':_0x6a43d0});});})['then'](function(_0x281f33){_0x4b034a({'id':_0x490cf2['id'],'phone':_0x19a196[_0xea70('0x2f')]});})[_0xea70('0x12')](function(_0x10cf4e){logger[_0xea70('0xe')](_0xea70('0x34'),_0x10cf4e[_0xea70('0x10')]);_0x57564d({'error':_0x10cf4e[_0xea70('0x10')]});});});}exports['IncrementPreviewCounters']=function(_0x4bfc1e){var _0x2932e7=this;return new Promise(function(_0x424ced,_0x4b49c7){return db[_0xea70('0x14')][_0xea70('0x33')](_0x4bfc1e[_0xea70('0x15')][_0xea70('0x35')],{'where':{'id':_0x4bfc1e[_0xea70('0x15')]['id']}})[_0xea70('0x8')](function(_0x5a4a6b){_0x424ced(_0x5a4a6b);})[_0xea70('0x12')](function(_0x1808c4){logger['error'](_0xea70('0x36'),_0x1808c4[_0xea70('0x10')]);_0x4b49c7(_0x2932e7[_0xea70('0xe')](0x1f4,_0x1808c4[_0xea70('0x10')]));});});}; \ No newline at end of file +var _0xaec7=['ContactId','ListId','VoiceQueueId','duration','waitTime','CmHopperAdditionalPhone','isNil','scheduledat','add','minutes','createdAt','updatedAt','transaction','update','phone','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','body','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','findOne','ASC','countnoanswerretry','countabandonedretry','countagentrejectretry','catch'];(function(_0x37b83f,_0x29a8f7){var _0x1fbac1=function(_0x1cdcc2){while(--_0x1cdcc2){_0x37b83f['push'](_0x37b83f['shift']());}};_0x1fbac1(++_0x29a8f7);}(_0xaec7,0x162));var _0x7aec=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xaec7[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require(_0x7aec('0x0'));var moment=require(_0x7aec('0x1'));var BPromise=require(_0x7aec('0x2'));var rs=require(_0x7aec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7aec('0x4'))['db'];var utils=require(_0x7aec('0x5'));var logger=require('../../config/logger')(_0x7aec('0x6'));var config=require(_0x7aec('0x7'));var jayson=require(_0x7aec('0x8'));var client=jayson[_0x7aec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bc9b0,_0xec4262,_0x2d5fa5){return new BPromise(function(_0x5416b9,_0x433640){return client[_0x7aec('0xa')](_0x4bc9b0,_0x2d5fa5)[_0x7aec('0xb')](function(_0x3c638c){logger[_0x7aec('0xc')](_0x7aec('0xd'),_0xec4262,_0x7aec('0xe'));logger['debug'](_0x7aec('0xf'),_0xec4262,'request\x20sent',JSON['stringify'](_0x3c638c));if(_0x3c638c['error']){if(_0x3c638c[_0x7aec('0x10')][_0x7aec('0x11')]===0x1f4){logger[_0x7aec('0x10')](_0x7aec('0xd'),_0xec4262,_0x3c638c[_0x7aec('0x10')][_0x7aec('0x12')]);return _0x433640(_0x3c638c[_0x7aec('0x10')][_0x7aec('0x12')]);}logger[_0x7aec('0x10')](_0x7aec('0xd'),_0xec4262,_0x3c638c['error']['message']);return _0x5416b9(_0x3c638c[_0x7aec('0x10')][_0x7aec('0x12')]);}else{logger[_0x7aec('0xc')](_0x7aec('0xd'),_0xec4262,'request\x20sent');_0x5416b9(_0x3c638c[_0x7aec('0x13')][_0x7aec('0x12')]);}})['catch'](function(_0x2e5c8c){logger[_0x7aec('0x10')](_0x7aec('0xd'),_0xec4262,_0x2e5c8c);_0x433640(_0x2e5c8c);});});}exports[_0x7aec('0x14')]=function(_0x15b9a5){var _0x513967=this;return new Promise(function(_0x3c510c,_0x571510){return db[_0x7aec('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x15b9a5[_0x7aec('0x16')]['ContactId'],'ListId':_0x15b9a5[_0x7aec('0x16')]['ListId'],'VoiceQueueId':_0x15b9a5['body']['VoiceQueueId']===undefined?null:_0x15b9a5[_0x7aec('0x16')]['VoiceQueueId'],'CampaignId':_0x15b9a5[_0x7aec('0x16')][_0x7aec('0x17')]===undefined?null:_0x15b9a5['body']['CampaignId']}})[_0x7aec('0xb')](function(_0x4e2fb9){if(_0x4e2fb9!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x4e2fb9['id'],'OrderBy':{'$gt':_0x4e2fb9['OrderBy']}},'order':[[_0x7aec('0x18'),'ASC']]})['then'](function(_0x558638){var _0x2906e8=0x0;if(_0x558638){if(_0x558638[_0x7aec('0x19')]+_0x558638[_0x7aec('0x1a')]+_0x558638['countnoanswerretry']+_0x558638[_0x7aec('0x1b')]+_0x558638[_0x7aec('0x1c')]+_0x558638['countabandonedretry']+_0x558638[_0x7aec('0x1d')]+_0x558638['countagentrejectretry']<_0x15b9a5[_0x7aec('0x1e')][_0x7aec('0x1f')])_0x2906e8=0x1;_0x3c510c({'additional':_0x2906e8});}else{return db['CmHopperAdditionalPhone'][_0x7aec('0x20')]({'raw':!![],'where':{'CmHopperId':_0x4e2fb9['id']},'order':[[_0x7aec('0x18'),_0x7aec('0x21')]]})[_0x7aec('0xb')](function(_0x5427d9){var _0x20a8b0=0x0;if(_0x5427d9){if(_0x5427d9[_0x7aec('0x19')]+_0x5427d9[_0x7aec('0x1a')]+_0x5427d9[_0x7aec('0x22')]+_0x5427d9[_0x7aec('0x1b')]+_0x5427d9[_0x7aec('0x1c')]+_0x5427d9[_0x7aec('0x23')]+_0x5427d9[_0x7aec('0x1d')]+_0x5427d9[_0x7aec('0x24')]<_0x15b9a5[_0x7aec('0x1e')][_0x7aec('0x1f')])_0x20a8b0=0x1;_0x3c510c({'additional':_0x20a8b0});}else{_0x3c510c({'additional':0x0});}})[_0x7aec('0x25')](function(_0x35cf9b){logger[_0x7aec('0x10')]('VerifyAdditionalPhones',_0x35cf9b[_0x7aec('0x12')]);_0x571510(_0x513967[_0x7aec('0x10')](0x1f4,_0x35cf9b[_0x7aec('0x12')]));});}})['catch'](function(_0x1d3640){logger['error'](_0x7aec('0x14'),_0x1d3640[_0x7aec('0x12')]);_0x571510(_0x513967[_0x7aec('0x10')](0x1f4,_0x1d3640[_0x7aec('0x12')]));});}else _0x3c510c({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x43c9d8){var _0x13b7d1=this;return new Promise(function(_0x265f17,_0x311683){return db[_0x7aec('0x15')][_0x7aec('0x20')]({'raw':!![],'where':{'ContactId':_0x43c9d8[_0x7aec('0x16')][_0x7aec('0x26')],'ListId':_0x43c9d8[_0x7aec('0x16')][_0x7aec('0x27')],'VoiceQueueId':_0x43c9d8[_0x7aec('0x16')][_0x7aec('0x28')]===undefined?null:_0x43c9d8['body'][_0x7aec('0x28')],'CampaignId':_0x43c9d8['body'][_0x7aec('0x17')]===undefined?null:_0x43c9d8[_0x7aec('0x16')]['CampaignId']}})[_0x7aec('0xb')](function(_0x3e3437){if(_0x3e3437!=null){return db['CmHopperAdditionalPhone'][_0x7aec('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3e3437['id'],'OrderBy':{'$gte':_0x3e3437['OrderBy']}},'order':[['OrderBy',_0x7aec('0x21')]]})[_0x7aec('0xb')](function(_0xa1b0ba){if(_0xa1b0ba)return activateAdditionalPhone(_0x3e3437,_0x43c9d8[_0x7aec('0x16')],_0xa1b0ba,_0x43c9d8[_0x7aec('0x29')],_0x43c9d8[_0x7aec('0x2a')])[_0x7aec('0xb')](function(_0x50bf37){_0x265f17(_0x50bf37);});else{return db[_0x7aec('0x2b')][_0x7aec('0x20')]({'raw':!![],'where':{'CmHopperId':_0x3e3437['id']},'order':[['OrderBy','ASC']]})[_0x7aec('0xb')](function(_0x209e84){if(_0x209e84)return activateAdditionalPhone(_0x3e3437,_0x43c9d8[_0x7aec('0x16')],_0x209e84,_0x43c9d8[_0x7aec('0x29')],_0x43c9d8[_0x7aec('0x2a')])[_0x7aec('0xb')](function(_0x275446){_0x265f17(_0x275446);});else{_0x265f17({'id':_0x3e3437['id'],'phone':''});}})[_0x7aec('0x25')](function(_0x3fb1d2){logger[_0x7aec('0x10')](_0x7aec('0x14'),_0x3fb1d2[_0x7aec('0x12')]);_0x311683(_0x13b7d1[_0x7aec('0x10')](0x1f4,_0x3fb1d2['message']));});}})[_0x7aec('0x25')](function(_0x2caf98){logger['error'](_0x7aec('0x14'),_0x2caf98['message']);_0x311683(_0x13b7d1[_0x7aec('0x10')](0x1f4,_0x2caf98[_0x7aec('0x12')]));});}else _0x265f17(0x1);});});};function activateAdditionalPhone(_0x3eb25f,_0x4bc2f4,_0x1a43c8,_0x3b296a,_0xb3c73b){return new Promise(function(_0x2d4d57,_0x2d2807){var _0x1954a5;if(_[_0x7aec('0x2c')](_0x1a43c8[_0x7aec('0x2d')])){_0x1a43c8['scheduledat']=moment();}if(moment()>moment(_0x1a43c8[_0x7aec('0x2d')])){_0x1954a5=moment()[_0x7aec('0x2e')](_0xb3c73b||0x3,'minutes');}else{if(_0x1a43c8[_0x7aec('0x18')]==0x0){_0x1954a5=moment(_0x1a43c8[_0x7aec('0x2d')]);}else{_0x1954a5=moment()[_0x7aec('0x2e')](_0xb3c73b||0x3,_0x7aec('0x2f'));}}if(_[_0x7aec('0x2c')](_0x1954a5)){_0x1954a5=moment()[_0x7aec('0x2e')](_0xb3c73b||0x3,_0x7aec('0x2f'));}var _0x126653={'phone':_0x3eb25f['phone'],'active':0x0,'OrderBy':_[_0x7aec('0x2c')](_0x3eb25f['OrderBy'])?0x0:_0x3eb25f[_0x7aec('0x18')],'scheduledat':moment()[_0x7aec('0x2e')](_0x3b296a||0x1,_0x7aec('0x2f')),'countbusyretry':_0x4bc2f4['countbusyretry'],'countcongestionretry':_0x4bc2f4[_0x7aec('0x1a')],'countnoanswerretry':_0x4bc2f4[_0x7aec('0x22')],'countnosuchnumberretry':_0x4bc2f4[_0x7aec('0x1b')],'countdropretry':_0x4bc2f4[_0x7aec('0x1c')],'countabandonedretry':_0x4bc2f4['countabandonedretry'],'countmachineretry':_0x4bc2f4['countmachineretry'],'countagentrejectretry':_0x4bc2f4[_0x7aec('0x24')],'createdAt':_0x4bc2f4[_0x7aec('0x30')],'updatedAt':_0x4bc2f4[_0x7aec('0x31')]};var _0x1eb244={'CmHopperId':_0x3eb25f['id'],'phone':_0x1a43c8['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1a43c8[_0x7aec('0x18')])?0x0:_0x1a43c8['OrderBy'],'scheduledat':_0x1954a5,'countbusyretry':_0x1a43c8['countbusyretry'],'countcongestionretry':_0x1a43c8['countcongestionretry'],'countnoanswerretry':_0x1a43c8[_0x7aec('0x22')],'countnosuchnumberretry':_0x1a43c8['countnosuchnumberretry'],'countdropretry':_0x1a43c8[_0x7aec('0x1c')],'countabandonedretry':_0x1a43c8[_0x7aec('0x23')],'countmachineretry':_0x1a43c8['countmachineretry'],'countagentrejectretry':_0x1a43c8['countagentrejectretry'],'createdAt':_0x1a43c8[_0x7aec('0x30')],'updatedAt':_0x1a43c8[_0x7aec('0x31')]};return db['sequelize'][_0x7aec('0x32')](function(_0x13505a){return db[_0x7aec('0x2b')][_0x7aec('0x33')](_0x126653,{'where':{'id':_0x1a43c8['id']}},{'transaction':_0x13505a})[_0x7aec('0xb')](function(){return db[_0x7aec('0x15')][_0x7aec('0x33')](_0x1eb244,{'where':{'id':_0x3eb25f['id']}},{'transaction':_0x13505a});});})[_0x7aec('0xb')](function(_0xd1a07f){_0x2d4d57({'id':_0x3eb25f['id'],'phone':_0x1a43c8[_0x7aec('0x34')]});})[_0x7aec('0x25')](function(_0x36bf62){logger[_0x7aec('0x10')](_0x7aec('0x35'),_0x36bf62[_0x7aec('0x12')]);_0x2d2807({'error':_0x36bf62[_0x7aec('0x12')]});});});}exports[_0x7aec('0x36')]=function(_0xfcb29d){var _0xaaf75f=this;return new Promise(function(_0x24c6a6,_0x5b120f){return db[_0x7aec('0x15')][_0x7aec('0x33')](_0xfcb29d[_0x7aec('0x16')][_0x7aec('0x37')],{'where':{'id':_0xfcb29d['body']['id']}})['then'](function(_0x422979){_0x24c6a6(_0x422979);})[_0x7aec('0x25')](function(_0x4abc53){logger[_0x7aec('0x10')](_0x7aec('0x36'),_0x4abc53[_0x7aec('0x12')]);_0x5b120f(_0xaaf75f[_0x7aec('0x10')](0x1f4,_0x4abc53['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1d39fc9..1bba17b 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 _0x8b13=['path','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','util'];(function(_0x25e1b6,_0x52ddaa){var _0x4d2915=function(_0x39b5a8){while(--_0x39b5a8){_0x25e1b6['push'](_0x25e1b6['shift']());}};_0x4d2915(++_0x52ddaa);}(_0x8b13,0x1ef));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x38b1('0x0'));var path=require(_0x38b1('0x1'));var timeout=require('connect-timeout');var express=require(_0x38b1('0x2'));var router=express[_0x38b1('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x38b1('0x4'));var config=require('../../config/environment');var controller=require(_0x38b1('0x5'));router[_0x38b1('0x6')]('/',auth[_0x38b1('0x7')](),controller['index']);router[_0x38b1('0x6')](_0x38b1('0x8'),auth[_0x38b1('0x7')](),controller[_0x38b1('0x9')]);router[_0x38b1('0xa')]('/',auth[_0x38b1('0x7')](),controller[_0x38b1('0xb')]);router[_0x38b1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x38b1('0xd')]);router['delete'](_0x38b1('0x8'),auth[_0x38b1('0x7')](),controller[_0x38b1('0xe')]);module[_0x38b1('0xf')]=router; \ No newline at end of file +var _0x8bc6=['get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x375b16,_0x4130bf){var _0x24541f=function(_0x204806){while(--_0x204806){_0x375b16['push'](_0x375b16['shift']());}};_0x24541f(++_0x4130bf);}(_0x8bc6,0xc4));var _0x68bc=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x8bc6[_0x26b80e];return _0x84a8a8;};'use strict';var multer=require(_0x68bc('0x0'));var util=require(_0x68bc('0x1'));var path=require('path');var timeout=require(_0x68bc('0x2'));var express=require(_0x68bc('0x3'));var router=express['Router']();var fs_extra=require(_0x68bc('0x4'));var auth=require(_0x68bc('0x5'));var interaction=require(_0x68bc('0x6'));var config=require(_0x68bc('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x68bc('0x8')]('/',auth[_0x68bc('0x9')](),controller['index']);router['get'](_0x68bc('0xa'),auth[_0x68bc('0x9')](),controller[_0x68bc('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x68bc('0xc')]);router[_0x68bc('0xd')](_0x68bc('0xa'),auth[_0x68bc('0x9')](),controller['update']);router[_0x68bc('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x68bc('0xf')]);module[_0x68bc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3b0deb4..c37dc48 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 _0x8173=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x48aabf,_0x4fe205){var _0x1969e7=function(_0x5eae32){while(--_0x5eae32){_0x48aabf['push'](_0x48aabf['shift']());}};_0x1969e7(++_0x4fe205);}(_0x8173,0x1db));var _0x3817=function(_0x492fd8,_0x46d682){_0x492fd8=_0x492fd8-0x0;var _0x3b9b51=_0x8173[_0x492fd8];return _0x3b9b51;};'use strict';var moment=require(_0x3817('0x0'));var Sequelize=require(_0x3817('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3817('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3817('0x3')],'unique':_0x3817('0x4')},'ListId':{'type':Sequelize[_0x3817('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3817('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xc77b=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xc77b,0x187));var _0xbc77=function(_0x234031,_0x2c2765){_0x234031=_0x234031-0x0;var _0x395858=_0xc77b[_0x234031];return _0x395858;};'use strict';var moment=require(_0xbc77('0x0'));var Sequelize=require(_0xbc77('0x1'));module[_0xbc77('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xbc77('0x3')],'unique':_0xbc77('0x4')},'ListId':{'type':Sequelize[_0xbc77('0x3')],'unique':_0xbc77('0x4')},'VoiceQueueId':{'type':Sequelize[_0xbc77('0x3')],'unique':_0xbc77('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8b92957..0c3a1b4 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 _0xf751=['include','rows','catch','show','params','keys','options','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','stack','name','send','map','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','CmHopperBlack','includeAll'];(function(_0x42c579,_0x588c59){var _0x100d74=function(_0x31e272){while(--_0x31e272){_0x42c579['push'](_0x42c579['shift']());}};_0x100d74(++_0x588c59);}(_0xf751,0x132));var _0x1f75=function(_0x42936d,_0x37c54d){_0x42936d=_0x42936d-0x0;var _0x5f3d5e=_0xf751[_0x42936d];return _0x5f3d5e;};'use strict';var emlformat=require(_0x1f75('0x0'));var rimraf=require(_0x1f75('0x1'));var zipdir=require(_0x1f75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f75('0x3'));var moment=require(_0x1f75('0x4'));var BPromise=require(_0x1f75('0x5'));var Mustache=require(_0x1f75('0x6'));var util=require('util');var path=require(_0x1f75('0x7'));var sox=require(_0x1f75('0x8'));var csv=require('to-csv');var ejs=require(_0x1f75('0x9'));var fs=require('fs');var fs_extra=require(_0x1f75('0xa'));var _=require(_0x1f75('0xb'));var squel=require(_0x1f75('0xc'));var crypto=require(_0x1f75('0xd'));var jsforce=require(_0x1f75('0xe'));var deskjs=require(_0x1f75('0xf'));var toCsv=require(_0x1f75('0x10'));var querystring=require(_0x1f75('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f75('0x12'));var authService=require(_0x1f75('0x13'));var qs=require(_0x1f75('0x14'));var as=require(_0x1f75('0x15'));var hardwareService=require(_0x1f75('0x16'));var logger=require(_0x1f75('0x17'))(_0x1f75('0x18'));var utils=require(_0x1f75('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1f75('0x1a'));var db=require(_0x1f75('0x1b'))['db'];function respondWithStatusCode(_0xfc0ea9,_0x5582da){_0x5582da=_0x5582da||0xcc;return function(_0x325c19){if(_0x325c19){return _0xfc0ea9[_0x1f75('0x1c')](_0x5582da);}return _0xfc0ea9[_0x1f75('0x1d')](_0x5582da)['end']();};}function respondWithResult(_0x3b75b9,_0x586842){_0x586842=_0x586842||0xc8;return function(_0x46e8af){if(_0x46e8af){return _0x3b75b9[_0x1f75('0x1d')](_0x586842)[_0x1f75('0x1e')](_0x46e8af);}};}function respondWithFilteredResult(_0x4286f1,_0x52886f){return function(_0x4c8a20){if(_0x4c8a20){var _0x2db0d9=typeof _0x52886f[_0x1f75('0x1f')]===_0x1f75('0x20')&&typeof _0x52886f['limit']===_0x1f75('0x20');var _0x494522=_0x4c8a20[_0x1f75('0x21')];var _0x3b3c03=_0x2db0d9?0x0:_0x52886f['offset'];var _0x25f3a9=_0x2db0d9?_0x4c8a20['count']:_0x52886f[_0x1f75('0x1f')]+_0x52886f[_0x1f75('0x22')];var _0x4fc6dd;if(_0x25f3a9>=_0x494522){_0x25f3a9=_0x494522;_0x4fc6dd=0xc8;}else{_0x4fc6dd=0xce;}_0x4286f1[_0x1f75('0x1d')](_0x4fc6dd);return _0x4286f1[_0x1f75('0x23')]('Content-Range',_0x3b3c03+'-'+_0x25f3a9+'/'+_0x494522)[_0x1f75('0x1e')](_0x4c8a20);}return null;};}function patchUpdates(_0x5119ba){return function(_0x5d871d){try{jsonpatch[_0x1f75('0x24')](_0x5d871d,_0x5119ba,!![]);}catch(_0x2ccdf0){return BPromise['reject'](_0x2ccdf0);}return _0x5d871d[_0x1f75('0x25')]();};}function saveUpdates(_0x512645,_0x4e3892){return function(_0xa57176){if(_0xa57176){return _0xa57176[_0x1f75('0x26')](_0x512645)[_0x1f75('0x27')](function(_0x4bb299){return _0x4bb299;});}return null;};}function removeEntity(_0x355f1a,_0x46b746){return function(_0x55db55){if(_0x55db55){return _0x55db55[_0x1f75('0x28')]()[_0x1f75('0x27')](function(){_0x355f1a[_0x1f75('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eda3,_0x22e5fb){return function(_0x1ed9ee){if(!_0x1ed9ee){_0x44eda3[_0x1f75('0x1c')](0x194);}return _0x1ed9ee;};}function handleError(_0x131290,_0x569102){_0x569102=_0x569102||0x1f4;return function(_0x541e7f){logger['error'](_0x541e7f[_0x1f75('0x29')]);if(_0x541e7f[_0x1f75('0x2a')]){delete _0x541e7f[_0x1f75('0x2a')];}_0x131290[_0x1f75('0x1d')](_0x569102)[_0x1f75('0x2b')](_0x541e7f);};}exports['index']=function(_0x3253cd,_0x4f1192){var _0x14011f={},_0x2dccdd={},_0x183d00={'count':0x0,'rows':[]};var _0x3e791b=_[_0x1f75('0x2c')](db['CmHopperBlack']['rawAttributes'],function(_0x596f8f){return{'name':_0x596f8f[_0x1f75('0x2d')],'type':_0x596f8f[_0x1f75('0x2e')]['key']};});_0x2dccdd['model']=_[_0x1f75('0x2c')](_0x3e791b,_0x1f75('0x2a'));_0x2dccdd[_0x1f75('0x2f')]=_['keys'](_0x3253cd[_0x1f75('0x2f')]);_0x2dccdd[_0x1f75('0x30')]=_[_0x1f75('0x31')](_0x2dccdd[_0x1f75('0x32')],_0x2dccdd[_0x1f75('0x2f')]);_0x14011f[_0x1f75('0x33')]=_[_0x1f75('0x31')](_0x2dccdd[_0x1f75('0x32')],qs[_0x1f75('0x34')](_0x3253cd['query'][_0x1f75('0x34')]));_0x14011f[_0x1f75('0x33')]=_0x14011f[_0x1f75('0x33')][_0x1f75('0x35')]?_0x14011f['attributes']:_0x2dccdd[_0x1f75('0x32')];if(!_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x36')](_0x1f75('0x37'))){_0x14011f[_0x1f75('0x22')]=qs[_0x1f75('0x22')](_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x22')]);_0x14011f[_0x1f75('0x1f')]=qs[_0x1f75('0x1f')](_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x1f')]);}_0x14011f['order']=qs[_0x1f75('0x38')](_0x3253cd[_0x1f75('0x2f')]['sort']);_0x14011f[_0x1f75('0x39')]=qs['filters'](_[_0x1f75('0x3a')](_0x3253cd[_0x1f75('0x2f')],_0x2dccdd[_0x1f75('0x30')]),_0x3e791b);if(_0x3253cd['query'][_0x1f75('0x3b')]){_0x14011f[_0x1f75('0x39')]=_[_0x1f75('0x3c')](_0x14011f[_0x1f75('0x39')],{'$or':_[_0x1f75('0x2c')](_0x3e791b,function(_0x51f17f){if(_0x51f17f[_0x1f75('0x2e')]!==_0x1f75('0x3d')){var _0xd0e58a={};_0xd0e58a[_0x51f17f[_0x1f75('0x2a')]]={'$like':'%'+_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x3b')]+'%'};return _0xd0e58a;}})});}_0x14011f=_['merge']({},_0x14011f,_0x3253cd['options']);var _0x5b1c52={'where':_0x14011f[_0x1f75('0x39')]};return db[_0x1f75('0x3e')][_0x1f75('0x21')](_0x5b1c52)[_0x1f75('0x27')](function(_0x42b3cd){_0x183d00['count']=_0x42b3cd;if(_0x3253cd[_0x1f75('0x2f')][_0x1f75('0x3f')]){_0x14011f[_0x1f75('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x14011f);})[_0x1f75('0x27')](function(_0x3ad868){_0x183d00[_0x1f75('0x41')]=_0x3ad868;return _0x183d00;})['then'](respondWithFilteredResult(_0x4f1192,_0x14011f))[_0x1f75('0x42')](handleError(_0x4f1192,null));};exports[_0x1f75('0x43')]=function(_0x3750a9,_0x14bfa0){var _0x3825af={'raw':!![],'where':{'id':_0x3750a9[_0x1f75('0x44')]['id']}},_0x4d9de8={};_0x4d9de8[_0x1f75('0x32')]=_[_0x1f75('0x45')](db[_0x1f75('0x3e')]['rawAttributes']);_0x4d9de8[_0x1f75('0x2f')]=_[_0x1f75('0x45')](_0x3750a9[_0x1f75('0x2f')]);_0x4d9de8[_0x1f75('0x30')]=_[_0x1f75('0x31')](_0x4d9de8[_0x1f75('0x32')],_0x4d9de8['query']);_0x3825af[_0x1f75('0x33')]=_[_0x1f75('0x31')](_0x4d9de8[_0x1f75('0x32')],qs[_0x1f75('0x34')](_0x3750a9[_0x1f75('0x2f')][_0x1f75('0x34')]));_0x3825af[_0x1f75('0x33')]=_0x3825af[_0x1f75('0x33')][_0x1f75('0x35')]?_0x3825af[_0x1f75('0x33')]:_0x4d9de8[_0x1f75('0x32')];if(_0x3750a9[_0x1f75('0x2f')]['includeAll']){_0x3825af[_0x1f75('0x40')]=[{'all':!![]}];}_0x3825af=_[_0x1f75('0x3c')]({},_0x3825af,_0x3750a9[_0x1f75('0x46')]);return db[_0x1f75('0x3e')][_0x1f75('0x47')](_0x3825af)[_0x1f75('0x27')](handleEntityNotFound(_0x14bfa0,null))[_0x1f75('0x27')](respondWithResult(_0x14bfa0,null))['catch'](handleError(_0x14bfa0,null));};exports['update']=function(_0x376b20,_0x511f2e){if(_0x376b20[_0x1f75('0x48')]['id']){delete _0x376b20[_0x1f75('0x48')]['id'];}return db[_0x1f75('0x3e')][_0x1f75('0x47')]({'where':{'id':_0x376b20[_0x1f75('0x44')]['id']}})['then'](handleEntityNotFound(_0x511f2e,null))[_0x1f75('0x27')](saveUpdates(_0x376b20[_0x1f75('0x48')],null))[_0x1f75('0x27')](respondWithResult(_0x511f2e,null))[_0x1f75('0x42')](handleError(_0x511f2e,null));};exports[_0x1f75('0x28')]=function(_0x1dcb68,_0x527339){return db['CmHopperBlack'][_0x1f75('0x47')]({'where':{'id':_0x1dcb68[_0x1f75('0x44')]['id']}})[_0x1f75('0x27')](handleEntityNotFound(_0x527339,null))[_0x1f75('0x27')](removeEntity(_0x527339,null))['catch'](handleError(_0x527339,null));};exports[_0x1f75('0x49')]=function(_0x5d4e75,_0x4e2d9c){return db[_0x1f75('0x3e')]['describe']()[_0x1f75('0x27')](respondWithResult(_0x4e2d9c,null))[_0x1f75('0x42')](handleError(_0x4e2d9c,null));}; \ No newline at end of file +var _0xc03d=['merge','options','includeAll','findAll','rows','catch','show','include','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','sort','where','filter'];(function(_0x126366,_0x1abd2b){var _0x3d6906=function(_0x50d6f8){while(--_0x50d6f8){_0x126366['push'](_0x126366['shift']());}};_0x3d6906(++_0x1abd2b);}(_0xc03d,0x1b5));var _0xdc03=function(_0x2056b9,_0x15b9ea){_0x2056b9=_0x2056b9-0x0;var _0x57244b=_0xc03d[_0x2056b9];return _0x57244b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc03('0x0'));var zipdir=require(_0xdc03('0x1'));var jsonpatch=require(_0xdc03('0x2'));var rp=require(_0xdc03('0x3'));var moment=require('moment');var BPromise=require(_0xdc03('0x4'));var Mustache=require(_0xdc03('0x5'));var util=require(_0xdc03('0x6'));var path=require(_0xdc03('0x7'));var sox=require(_0xdc03('0x8'));var csv=require(_0xdc03('0x9'));var ejs=require(_0xdc03('0xa'));var fs=require('fs');var fs_extra=require(_0xdc03('0xb'));var _=require('lodash');var squel=require(_0xdc03('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc03('0xd'));var Papa=require(_0xdc03('0xe'));var Redis=require(_0xdc03('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdc03('0x10'));var hardwareService=require(_0xdc03('0x11'));var logger=require(_0xdc03('0x12'))(_0xdc03('0x13'));var utils=require('../../config/utils');var config=require(_0xdc03('0x14'));var licenseUtil=require(_0xdc03('0x15'));var db=require(_0xdc03('0x16'))['db'];function respondWithStatusCode(_0x2a7064,_0x1055d4){_0x1055d4=_0x1055d4||0xcc;return function(_0xd7779f){if(_0xd7779f){return _0x2a7064[_0xdc03('0x17')](_0x1055d4);}return _0x2a7064['status'](_0x1055d4)[_0xdc03('0x18')]();};}function respondWithResult(_0x44a631,_0x16d194){_0x16d194=_0x16d194||0xc8;return function(_0x522527){if(_0x522527){return _0x44a631[_0xdc03('0x19')](_0x16d194)[_0xdc03('0x1a')](_0x522527);}};}function respondWithFilteredResult(_0x3a4620,_0x2a3936){return function(_0x3f3355){if(_0x3f3355){var _0x3e20a4=typeof _0x2a3936[_0xdc03('0x1b')]===_0xdc03('0x1c')&&typeof _0x2a3936[_0xdc03('0x1d')]===_0xdc03('0x1c');var _0x397b46=_0x3f3355[_0xdc03('0x1e')];var _0x363831=_0x3e20a4?0x0:_0x2a3936[_0xdc03('0x1b')];var _0xea3bba=_0x3e20a4?_0x3f3355[_0xdc03('0x1e')]:_0x2a3936[_0xdc03('0x1b')]+_0x2a3936[_0xdc03('0x1d')];var _0xf680b7;if(_0xea3bba>=_0x397b46){_0xea3bba=_0x397b46;_0xf680b7=0xc8;}else{_0xf680b7=0xce;}_0x3a4620[_0xdc03('0x19')](_0xf680b7);return _0x3a4620[_0xdc03('0x1f')](_0xdc03('0x20'),_0x363831+'-'+_0xea3bba+'/'+_0x397b46)[_0xdc03('0x1a')](_0x3f3355);}return null;};}function patchUpdates(_0x172d1c){return function(_0x594530){try{jsonpatch['apply'](_0x594530,_0x172d1c,!![]);}catch(_0x26bec9){return BPromise[_0xdc03('0x21')](_0x26bec9);}return _0x594530[_0xdc03('0x22')]();};}function saveUpdates(_0x34fd61,_0x587f25){return function(_0x414fb1){if(_0x414fb1){return _0x414fb1[_0xdc03('0x23')](_0x34fd61)['then'](function(_0x1a995c){return _0x1a995c;});}return null;};}function removeEntity(_0x73919a,_0x55e3a9){return function(_0x118a1f){if(_0x118a1f){return _0x118a1f[_0xdc03('0x24')]()[_0xdc03('0x25')](function(){_0x73919a[_0xdc03('0x19')](0xcc)[_0xdc03('0x18')]();});}};}function handleEntityNotFound(_0x204be5,_0x2770de){return function(_0xcb6450){if(!_0xcb6450){_0x204be5[_0xdc03('0x17')](0x194);}return _0xcb6450;};}function handleError(_0x5e2571,_0x3caed5){_0x3caed5=_0x3caed5||0x1f4;return function(_0x551729){logger[_0xdc03('0x26')](_0x551729[_0xdc03('0x27')]);if(_0x551729[_0xdc03('0x28')]){delete _0x551729[_0xdc03('0x28')];}_0x5e2571[_0xdc03('0x19')](_0x3caed5)[_0xdc03('0x29')](_0x551729);};}exports[_0xdc03('0x2a')]=function(_0x524f95,_0x4e99b6){var _0x2d6b14={},_0x179e1e={},_0x4fa3da={'count':0x0,'rows':[]};var _0x1220d7=_[_0xdc03('0x2b')](db[_0xdc03('0x2c')][_0xdc03('0x2d')],function(_0x3b673e){return{'name':_0x3b673e[_0xdc03('0x2e')],'type':_0x3b673e[_0xdc03('0x2f')][_0xdc03('0x30')]};});_0x179e1e['model']=_['map'](_0x1220d7,_0xdc03('0x28'));_0x179e1e['query']=_[_0xdc03('0x31')](_0x524f95[_0xdc03('0x32')]);_0x179e1e[_0xdc03('0x33')]=_['intersection'](_0x179e1e[_0xdc03('0x34')],_0x179e1e[_0xdc03('0x32')]);_0x2d6b14['attributes']=_[_0xdc03('0x35')](_0x179e1e[_0xdc03('0x34')],qs[_0xdc03('0x36')](_0x524f95[_0xdc03('0x32')][_0xdc03('0x36')]));_0x2d6b14[_0xdc03('0x37')]=_0x2d6b14['attributes'][_0xdc03('0x38')]?_0x2d6b14[_0xdc03('0x37')]:_0x179e1e[_0xdc03('0x34')];if(!_0x524f95[_0xdc03('0x32')]['hasOwnProperty']('nolimit')){_0x2d6b14[_0xdc03('0x1d')]=qs[_0xdc03('0x1d')](_0x524f95['query'][_0xdc03('0x1d')]);_0x2d6b14[_0xdc03('0x1b')]=qs[_0xdc03('0x1b')](_0x524f95['query'][_0xdc03('0x1b')]);}_0x2d6b14['order']=qs[_0xdc03('0x39')](_0x524f95[_0xdc03('0x32')][_0xdc03('0x39')]);_0x2d6b14[_0xdc03('0x3a')]=qs[_0xdc03('0x33')](_['pick'](_0x524f95[_0xdc03('0x32')],_0x179e1e['filters']),_0x1220d7);if(_0x524f95[_0xdc03('0x32')][_0xdc03('0x3b')]){_0x2d6b14[_0xdc03('0x3a')]=_[_0xdc03('0x3c')](_0x2d6b14[_0xdc03('0x3a')],{'$or':_[_0xdc03('0x2b')](_0x1220d7,function(_0x5ba45c){if(_0x5ba45c[_0xdc03('0x2f')]!=='VIRTUAL'){var _0x2a883c={};_0x2a883c[_0x5ba45c[_0xdc03('0x28')]]={'$like':'%'+_0x524f95[_0xdc03('0x32')][_0xdc03('0x3b')]+'%'};return _0x2a883c;}})});}_0x2d6b14=_[_0xdc03('0x3c')]({},_0x2d6b14,_0x524f95[_0xdc03('0x3d')]);var _0x6b4706={'where':_0x2d6b14[_0xdc03('0x3a')]};return db['CmHopperBlack'][_0xdc03('0x1e')](_0x6b4706)[_0xdc03('0x25')](function(_0x38e5fe){_0x4fa3da['count']=_0x38e5fe;if(_0x524f95['query'][_0xdc03('0x3e')]){_0x2d6b14['include']=[{'all':!![]}];}return db[_0xdc03('0x2c')][_0xdc03('0x3f')](_0x2d6b14);})['then'](function(_0x176d2d){_0x4fa3da[_0xdc03('0x40')]=_0x176d2d;return _0x4fa3da;})[_0xdc03('0x25')](respondWithFilteredResult(_0x4e99b6,_0x2d6b14))[_0xdc03('0x41')](handleError(_0x4e99b6,null));};exports[_0xdc03('0x42')]=function(_0x4f66eb,_0x9f510d){var _0x36c71c={'raw':!![],'where':{'id':_0x4f66eb['params']['id']}},_0x54fde2={};_0x54fde2[_0xdc03('0x34')]=_['keys'](db[_0xdc03('0x2c')]['rawAttributes']);_0x54fde2[_0xdc03('0x32')]=_['keys'](_0x4f66eb[_0xdc03('0x32')]);_0x54fde2['filters']=_['intersection'](_0x54fde2[_0xdc03('0x34')],_0x54fde2[_0xdc03('0x32')]);_0x36c71c[_0xdc03('0x37')]=_['intersection'](_0x54fde2[_0xdc03('0x34')],qs[_0xdc03('0x36')](_0x4f66eb['query'][_0xdc03('0x36')]));_0x36c71c['attributes']=_0x36c71c['attributes'][_0xdc03('0x38')]?_0x36c71c[_0xdc03('0x37')]:_0x54fde2['model'];if(_0x4f66eb[_0xdc03('0x32')][_0xdc03('0x3e')]){_0x36c71c[_0xdc03('0x43')]=[{'all':!![]}];}_0x36c71c=_[_0xdc03('0x3c')]({},_0x36c71c,_0x4f66eb[_0xdc03('0x3d')]);return db[_0xdc03('0x2c')]['find'](_0x36c71c)[_0xdc03('0x25')](handleEntityNotFound(_0x9f510d,null))[_0xdc03('0x25')](respondWithResult(_0x9f510d,null))[_0xdc03('0x41')](handleError(_0x9f510d,null));};exports['update']=function(_0x1c079a,_0x7f14c0){if(_0x1c079a[_0xdc03('0x44')]['id']){delete _0x1c079a[_0xdc03('0x44')]['id'];}return db[_0xdc03('0x2c')][_0xdc03('0x45')]({'where':{'id':_0x1c079a['params']['id']}})[_0xdc03('0x25')](handleEntityNotFound(_0x7f14c0,null))[_0xdc03('0x25')](saveUpdates(_0x1c079a['body'],null))[_0xdc03('0x25')](respondWithResult(_0x7f14c0,null))[_0xdc03('0x41')](handleError(_0x7f14c0,null));};exports['destroy']=function(_0x466fb1,_0x4643a5){return db[_0xdc03('0x2c')][_0xdc03('0x45')]({'where':{'id':_0x466fb1[_0xdc03('0x46')]['id']}})['then'](handleEntityNotFound(_0x4643a5,null))[_0xdc03('0x25')](removeEntity(_0x4643a5,null))[_0xdc03('0x41')](handleError(_0x4643a5,null));};exports['describe']=function(_0x5bf7ac,_0x5a0ac3){return db[_0xdc03('0x2c')]['describe']()[_0xdc03('0x25')](respondWithResult(_0x5a0ac3,null))[_0xdc03('0x41')](handleError(_0x5a0ac3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b70f6ac..0fe137b 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 _0x50ae=['request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x599287,_0x184377){var _0x5b4329=function(_0x4395a5){while(--_0x4395a5){_0x599287['push'](_0x599287['shift']());}};_0x5b4329(++_0x184377);}(_0x50ae,0x15a));var _0xe50a=function(_0x3ac3da,_0x4e467c){_0x3ac3da=_0x3ac3da-0x0;var _0x1a7525=_0x50ae[_0x3ac3da];return _0x1a7525;};'use strict';var _=require(_0xe50a('0x0'));var util=require(_0xe50a('0x1'));var logger=require('../../config/logger')(_0xe50a('0x2'));var moment=require(_0xe50a('0x3'));var BPromise=require(_0xe50a('0x4'));var rp=require(_0xe50a('0x5'));var fs=require('fs');var path=require(_0xe50a('0x6'));var rimraf=require('rimraf');var config=require(_0xe50a('0x7'));var attributes=require(_0xe50a('0x8'));module[_0xe50a('0x9')]=function(_0x2ac3be,_0xb21335){return _0x2ac3be[_0xe50a('0xa')](_0xe50a('0xb'),attributes,{'tableName':_0xe50a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb299=['bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','define','cm_hopper_black','util','../../config/logger','api','moment'];(function(_0x5e7a5f,_0x434f1f){var _0x264521=function(_0x2ef5d4){while(--_0x2ef5d4){_0x5e7a5f['push'](_0x5e7a5f['shift']());}};_0x264521(++_0x434f1f);}(_0xb299,0x13b));var _0x9b29=function(_0x60de0a,_0x220781){_0x60de0a=_0x60de0a-0x0;var _0x115f49=_0xb299[_0x60de0a];return _0x115f49;};'use strict';var _=require('lodash');var util=require(_0x9b29('0x0'));var logger=require(_0x9b29('0x1'))(_0x9b29('0x2'));var moment=require(_0x9b29('0x3'));var BPromise=require(_0x9b29('0x4'));var rp=require(_0x9b29('0x5'));var fs=require('fs');var path=require(_0x9b29('0x6'));var rimraf=require('rimraf');var config=require(_0x9b29('0x7'));var attributes=require(_0x9b29('0x8'));module['exports']=function(_0x366db4,_0x5b65e0){return _0x366db4[_0x9b29('0x9')]('CmHopperBlack',attributes,{'tableName':_0x9b29('0xa'),'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 be02504..58a995e 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 _0xf64b=['then','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','CmHopperBlack','body'];(function(_0xbd52c2,_0x1f089b){var _0x24fda2=function(_0x394b54){while(--_0x394b54){_0xbd52c2['push'](_0xbd52c2['shift']());}};_0x24fda2(++_0x1f089b);}(_0xf64b,0x161));var _0xbf64=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xf64b[_0x18d631];return _0x50d708;};'use strict';var _=require(_0xbf64('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbf64('0x1'));var rs=require(_0xbf64('0x2'));var fs=require('fs');var Redis=require(_0xbf64('0x3'));var db=require(_0xbf64('0x4'))['db'];var utils=require(_0xbf64('0x5'));var logger=require('../../config/logger')(_0xbf64('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf64('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e50,_0x47c880,_0x502fa1){return new BPromise(function(_0x4c0620,_0x51cc8d){return client[_0xbf64('0x8')](_0x3e3e50,_0x502fa1)['then'](function(_0x295e3c){logger[_0xbf64('0x9')](_0xbf64('0xa'),_0x47c880,_0xbf64('0xb'));logger[_0xbf64('0xc')](_0xbf64('0xd'),_0x47c880,_0xbf64('0xb'),JSON[_0xbf64('0xe')](_0x295e3c));if(_0x295e3c[_0xbf64('0xf')]){if(_0x295e3c[_0xbf64('0xf')][_0xbf64('0x10')]===0x1f4){logger[_0xbf64('0xf')](_0xbf64('0xa'),_0x47c880,_0x295e3c[_0xbf64('0xf')][_0xbf64('0x11')]);return _0x51cc8d(_0x295e3c['error']['message']);}logger[_0xbf64('0xf')](_0xbf64('0xa'),_0x47c880,_0x295e3c['error']['message']);return _0x4c0620(_0x295e3c[_0xbf64('0xf')][_0xbf64('0x11')]);}else{logger['info'](_0xbf64('0xa'),_0x47c880,_0xbf64('0xb'));_0x4c0620(_0x295e3c[_0xbf64('0x12')][_0xbf64('0x11')]);}})['catch'](function(_0x1841fb){logger['error'](_0xbf64('0xa'),_0x47c880,_0x1841fb);_0x51cc8d(_0x1841fb);});});}exports[_0xbf64('0x13')]=function(_0x5934a5){var _0x12f538=this;return new Promise(function(_0x301384,_0x4ef5b6){return db['CmHopperBlack'][_0xbf64('0x14')]({'raw':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x16')]===undefined?!![]:![]:!![],'where':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x17')]||null:null,'attributes':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x18')]||null:null,'limit':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x19')]||null:null,'include':_0x5934a5[_0xbf64('0x15')]?_0x5934a5[_0xbf64('0x15')][_0xbf64('0x1a')]?_['map'](_0x5934a5['options'][_0xbf64('0x1a')],function(_0x4c7c88){return{'model':db[_0x4c7c88['model']],'as':_0x4c7c88['as'],'attributes':_0x4c7c88['attributes'],'include':_0x4c7c88[_0xbf64('0x1a')]?_[_0xbf64('0x1b')](_0x4c7c88['include'],function(_0x3dbdd1){return{'model':db[_0x3dbdd1[_0xbf64('0x1c')]],'as':_0x3dbdd1['as'],'attributes':_0x3dbdd1[_0xbf64('0x18')],'include':_0x3dbdd1[_0xbf64('0x1a')]?_[_0xbf64('0x1b')](_0x3dbdd1[_0xbf64('0x1a')],function(_0x2e488b){return{'model':db[_0x2e488b[_0xbf64('0x1c')]],'as':_0x2e488b['as'],'attributes':_0x2e488b[_0xbf64('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x420054){logger[_0xbf64('0x9')](_0xbf64('0x13'),_0x5934a5);logger[_0xbf64('0xc')](_0xbf64('0x13'),_0x5934a5,JSON['stringify'](_0x420054));_0x301384(_0x420054);})[_0xbf64('0x1d')](function(_0x45b663){logger[_0xbf64('0xf')](_0xbf64('0x13'),_0x45b663[_0xbf64('0x11')],_0x5934a5);_0x4ef5b6(_0x12f538[_0xbf64('0xf')](0x1f4,_0x45b663[_0xbf64('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x345a36){var _0x220aeb=this;return new Promise(function(_0x1af8ee,_0x3f1b0f){return db[_0xbf64('0x1e')]['update'](_0x345a36[_0xbf64('0x1f')],{'raw':_0x345a36[_0xbf64('0x15')]?_0x345a36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x17')]||null:null,'attributes':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x18')]||null:null,'limit':_0x345a36[_0xbf64('0x15')]?_0x345a36[_0xbf64('0x15')][_0xbf64('0x19')]||null:null})[_0xbf64('0x20')](function(_0x419118){logger['info'](_0xbf64('0x21'),_0x345a36);logger[_0xbf64('0xc')](_0xbf64('0x21'),_0x345a36,JSON[_0xbf64('0xe')](_0x419118));_0x1af8ee(_0x419118);})[_0xbf64('0x1d')](function(_0x1e9a8f){logger[_0xbf64('0xf')](_0xbf64('0x21'),_0x1e9a8f[_0xbf64('0x11')],_0x345a36);_0x3f1b0f(_0x220aeb[_0xbf64('0xf')](0x1f4,_0x1e9a8f[_0xbf64('0x11')]));});});};exports[_0xbf64('0x22')]=function(_0x566dd5){var _0x32b39a=this;return new Promise(function(_0x4e23ba,_0x365bde){return db['CmHopperBlack']['destroy']({'where':_0x566dd5[_0xbf64('0x15')]?_0x566dd5['options'][_0xbf64('0x17')]||null:null})[_0xbf64('0x20')](function(_0x6732f9){logger['info'](_0xbf64('0x22'),_0x566dd5);logger[_0xbf64('0xc')](_0xbf64('0x22'),_0x566dd5,JSON['stringify'](_0x6732f9));_0x4e23ba(_0x6732f9);})[_0xbf64('0x1d')](function(_0x20ae3a){logger[_0xbf64('0xf')](_0xbf64('0x22'),_0x20ae3a[_0xbf64('0x11')],_0x566dd5);_0x365bde(_0x32b39a[_0xbf64('0xf')](0x1f4,_0x20ae3a['message']));});});}; \ No newline at end of file +var _0x431c=['DestroyCmHopperBlack','destroy','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopperBlack','options','where','attributes','limit','include','map','model','CmHopperBlack','update','body','raw','UpdateCmHopperBlack'];(function(_0x3d4fbf,_0x1116e){var _0x2ba4f6=function(_0x1e7e09){while(--_0x1e7e09){_0x3d4fbf['push'](_0x3d4fbf['shift']());}};_0x2ba4f6(++_0x1116e);}(_0x431c,0x1be));var _0xc431=function(_0xa49628,_0x1d79a2){_0xa49628=_0xa49628-0x0;var _0x1eb99b=_0x431c[_0xa49628];return _0x1eb99b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc431('0x0'));var BPromise=require(_0xc431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc431('0x2'));var db=require(_0xc431('0x3'))['db'];var utils=require(_0xc431('0x4'));var logger=require(_0xc431('0x5'))(_0xc431('0x6'));var config=require('../../config/environment');var jayson=require(_0xc431('0x7'));var client=jayson[_0xc431('0x8')][_0xc431('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d7551,_0x2e2910,_0x582725){return new BPromise(function(_0x457422,_0x372f18){return client[_0xc431('0xa')](_0x2d7551,_0x582725)[_0xc431('0xb')](function(_0x55a1e9){logger[_0xc431('0xc')](_0xc431('0xd'),_0x2e2910,_0xc431('0xe'));logger[_0xc431('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2e2910,_0xc431('0xe'),JSON[_0xc431('0x10')](_0x55a1e9));if(_0x55a1e9['error']){if(_0x55a1e9[_0xc431('0x11')][_0xc431('0x12')]===0x1f4){logger[_0xc431('0x11')](_0xc431('0xd'),_0x2e2910,_0x55a1e9[_0xc431('0x11')][_0xc431('0x13')]);return _0x372f18(_0x55a1e9[_0xc431('0x11')][_0xc431('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x2e2910,_0x55a1e9[_0xc431('0x11')][_0xc431('0x13')]);return _0x457422(_0x55a1e9[_0xc431('0x11')]['message']);}else{logger[_0xc431('0xc')](_0xc431('0xd'),_0x2e2910,_0xc431('0xe'));_0x457422(_0x55a1e9[_0xc431('0x14')][_0xc431('0x13')]);}})[_0xc431('0x15')](function(_0x216b8a){logger[_0xc431('0x11')](_0xc431('0xd'),_0x2e2910,_0x216b8a);_0x372f18(_0x216b8a);});});}exports[_0xc431('0x16')]=function(_0x52da4a){var _0x5d6866=this;return new Promise(function(_0x1c8891,_0x1b2d70){return db['CmHopperBlack']['findAll']({'raw':_0x52da4a[_0xc431('0x17')]?_0x52da4a['options']['raw']===undefined?!![]:![]:!![],'where':_0x52da4a[_0xc431('0x17')]?_0x52da4a['options'][_0xc431('0x18')]||null:null,'attributes':_0x52da4a[_0xc431('0x17')]?_0x52da4a['options'][_0xc431('0x19')]||null:null,'limit':_0x52da4a[_0xc431('0x17')]?_0x52da4a[_0xc431('0x17')][_0xc431('0x1a')]||null:null,'include':_0x52da4a[_0xc431('0x17')]?_0x52da4a[_0xc431('0x17')][_0xc431('0x1b')]?_[_0xc431('0x1c')](_0x52da4a[_0xc431('0x17')][_0xc431('0x1b')],function(_0x53c341){return{'model':db[_0x53c341[_0xc431('0x1d')]],'as':_0x53c341['as'],'attributes':_0x53c341[_0xc431('0x19')],'include':_0x53c341['include']?_[_0xc431('0x1c')](_0x53c341['include'],function(_0x317069){return{'model':db[_0x317069[_0xc431('0x1d')]],'as':_0x317069['as'],'attributes':_0x317069[_0xc431('0x19')],'include':_0x317069['include']?_['map'](_0x317069['include'],function(_0x4dd8b5){return{'model':db[_0x4dd8b5['model']],'as':_0x4dd8b5['as'],'attributes':_0x4dd8b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xddd97b){logger[_0xc431('0xc')](_0xc431('0x16'),_0x52da4a);logger[_0xc431('0xf')](_0xc431('0x16'),_0x52da4a,JSON[_0xc431('0x10')](_0xddd97b));_0x1c8891(_0xddd97b);})[_0xc431('0x15')](function(_0x429d7a){logger[_0xc431('0x11')](_0xc431('0x16'),_0x429d7a[_0xc431('0x13')],_0x52da4a);_0x1b2d70(_0x5d6866[_0xc431('0x11')](0x1f4,_0x429d7a[_0xc431('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x180557){var _0x36a00b=this;return new Promise(function(_0x4c15a4,_0x3bc3ab){return db[_0xc431('0x1e')][_0xc431('0x1f')](_0x180557[_0xc431('0x20')],{'raw':_0x180557[_0xc431('0x17')]?_0x180557[_0xc431('0x17')][_0xc431('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180557[_0xc431('0x17')]?_0x180557[_0xc431('0x17')][_0xc431('0x18')]||null:null,'attributes':_0x180557[_0xc431('0x17')]?_0x180557[_0xc431('0x17')]['attributes']||null:null,'limit':_0x180557[_0xc431('0x17')]?_0x180557[_0xc431('0x17')][_0xc431('0x1a')]||null:null})['then'](function(_0x171368){logger[_0xc431('0xc')]('UpdateCmHopperBlack',_0x180557);logger['debug'](_0xc431('0x22'),_0x180557,JSON[_0xc431('0x10')](_0x171368));_0x4c15a4(_0x171368);})['catch'](function(_0x4627ae){logger[_0xc431('0x11')](_0xc431('0x22'),_0x4627ae['message'],_0x180557);_0x3bc3ab(_0x36a00b[_0xc431('0x11')](0x1f4,_0x4627ae[_0xc431('0x13')]));});});};exports[_0xc431('0x23')]=function(_0xae8309){var _0x877f57=this;return new Promise(function(_0x3fcbbc,_0x565e37){return db['CmHopperBlack'][_0xc431('0x24')]({'where':_0xae8309['options']?_0xae8309[_0xc431('0x17')][_0xc431('0x18')]||null:null})[_0xc431('0xb')](function(_0x207e9b){logger['info'](_0xc431('0x23'),_0xae8309);logger[_0xc431('0xf')](_0xc431('0x23'),_0xae8309,JSON['stringify'](_0x207e9b));_0x3fcbbc(_0x207e9b);})['catch'](function(_0x4dbc45){logger[_0xc431('0x11')](_0xc431('0x23'),_0x4dbc45[_0xc431('0x13')],_0xae8309);_0x565e37(_0x877f57['error'](0x1f4,_0x4dbc45[_0xc431('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d8287d4..d64b164 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 _0x323f=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e322e,_0x1a3190){var _0x5ee728=function(_0x33e64a){while(--_0x33e64a){_0x4e322e['push'](_0x4e322e['shift']());}};_0x5ee728(++_0x1a3190);}(_0x323f,0x1ee));var _0xf323=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x323f[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);module[_0xf323('0x13')]=router; \ No newline at end of file +var _0x7b84=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7b84,0x17c));var _0x47b8=function(_0x571c93,_0x7ac3b9){_0x571c93=_0x571c93-0x0;var _0x14ae6d=_0x7b84[_0x571c93];return _0x14ae6d;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);module[_0x47b8('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 99f2249..a4ce2b7 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 _0xe242=['STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','DATE'];(function(_0x129d42,_0x1864d5){var _0xeeb303=function(_0x15c9d0){while(--_0x15c9d0){_0x129d42['push'](_0x129d42['shift']());}};_0xeeb303(++_0x1864d5);}(_0xe242,0x18e));var _0x2e24=function(_0x3d400a,_0xd94376){_0x3d400a=_0x3d400a-0x0;var _0x3fd2d6=_0xe242[_0x3d400a];return _0x3fd2d6;};'use strict';var Sequelize=require(_0x2e24('0x0'));var moment=require(_0x2e24('0x1'));module[_0x2e24('0x2')]={'state':{'type':Sequelize[_0x2e24('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2e24('0x4')]},'countbusyretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x2e24('0x5')]},'originatecalleridname':{'type':Sequelize[_0x2e24('0x5')]},'calleridnum':{'type':Sequelize[_0x2e24('0x5')]},'calleridname':{'type':Sequelize[_0x2e24('0x5')]},'starttime':{'type':Sequelize[_0x2e24('0x4')]},'responsetime':{'type':Sequelize[_0x2e24('0x4')]},'answertime':{'type':Sequelize[_0x2e24('0x4')]},'droptime':{'type':Sequelize[_0x2e24('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2e24('0x5')]},'campaign':{'type':Sequelize[_0x2e24('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2e24('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x2e24('0x5')]},'secondDisposition':{'type':Sequelize[_0x2e24('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2e24('0x5')]},'dispositionat':{'type':Sequelize[_0x2e24('0x4')],'set':function(_0x4a5538){var _0x247b79=this[_0x2e24('0x6')](_0x2e24('0x7'));if(_0x247b79&&_0x4a5538){this[_0x2e24('0x8')](_0x2e24('0x9'),moment(_0x4a5538)[_0x2e24('0xa')](moment(_0x247b79),_0x2e24('0xb')));}}},'amd':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2e24('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x2e24('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2e24('0x4')]},'recallme':{'type':Sequelize[_0x2e24('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2e24('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc64=['setDataValue','diff','seconds','BOOLEAN','sequelize','exports','STRING','INTEGER','DATE','endtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc64,0xa4));var _0x4bc6=function(_0x29260a,_0x59398a){_0x29260a=_0x29260a-0x0;var _0xcdb779=_0xbc64[_0x29260a];return _0xcdb779;};'use strict';var Sequelize=require(_0x4bc6('0x0'));var moment=require('moment');module[_0x4bc6('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4bc6('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4bc6('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4bc6('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4bc6('0x2')]},'calleridnum':{'type':Sequelize[_0x4bc6('0x2')]},'calleridname':{'type':Sequelize[_0x4bc6('0x2')]},'starttime':{'type':Sequelize[_0x4bc6('0x4')]},'responsetime':{'type':Sequelize[_0x4bc6('0x4')]},'answertime':{'type':Sequelize[_0x4bc6('0x4')]},'droptime':{'type':Sequelize[_0x4bc6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4bc6('0x2')]},'campaign':{'type':Sequelize[_0x4bc6('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4bc6('0x2')]},'reason':{'type':Sequelize[_0x4bc6('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4bc6('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x4bc6('0x4')],'set':function(_0x109e38){var _0x246c3a=this['getDataValue'](_0x4bc6('0x5'));if(_0x246c3a&&_0x109e38){this[_0x4bc6('0x6')]('followuptime',moment(_0x109e38)[_0x4bc6('0x7')](moment(_0x246c3a),_0x4bc6('0x8')));}}},'amd':{'type':Sequelize[_0x4bc6('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4bc6('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4bc6('0x4')]},'callback':{'type':Sequelize[_0x4bc6('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4bc6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4bc6('0x4')]},'deleted':{'type':Sequelize[_0x4bc6('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4bc6('0x4')]},'recallme':{'type':Sequelize[_0x4bc6('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4bc6('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 51a64bd..c1e1e6a 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 _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0x5d17,0x114));var _0x75d1=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0x5d17[_0x1123bb];return _0xdeb602;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x3b6baf,_0x158315){var _0x1e244b=function(_0x241353){while(--_0x241353){_0x3b6baf['push'](_0x3b6baf['shift']());}};_0x1e244b(++_0x158315);}(_0x7096,0x10c));var _0x6709=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7096[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 126253c..fa61962 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 _0xd382=['bluebird','path','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3a1c80,_0x541223){var _0x26091c=function(_0x2d5479){while(--_0x2d5479){_0x3a1c80['push'](_0x3a1c80['shift']());}};_0x26091c(++_0x541223);}(_0xd382,0x1f4));var _0x2d38=function(_0x3149ef,_0x5a3548){_0x3149ef=_0x3149ef-0x0;var _0x5cb3d6=_0xd382[_0x3149ef];return _0x5cb3d6;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))('api');var moment=require(_0x2d38('0x3'));var BPromise=require(_0x2d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d38('0x5'));var rimraf=require(_0x2d38('0x6'));var config=require(_0x2d38('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x2d38('0x8')]=function(_0x40e328,_0x46dca8){return _0x40e328[_0x2d38('0x9')](_0x2d38('0xa'),attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[{'name':_0x2d38('0xc'),'fields':[_0x2d38('0xc')]},{'name':_0x2d38('0xd'),'fields':[_0x2d38('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7435=['lodash','util','api','bluebird','request-promise','path','rimraf','define','CmHopperFinal','calleridnum'];(function(_0x2a8754,_0x420981){var _0x14caa7=function(_0x2565c1){while(--_0x2565c1){_0x2a8754['push'](_0x2a8754['shift']());}};_0x14caa7(++_0x420981);}(_0x7435,0x1ae));var _0x5743=function(_0x99fa2c,_0x439c37){_0x99fa2c=_0x99fa2c-0x0;var _0x448b9d=_0x7435[_0x99fa2c];return _0x448b9d;};'use strict';var _=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var logger=require('../../config/logger')(_0x5743('0x2'));var moment=require('moment');var BPromise=require(_0x5743('0x3'));var rp=require(_0x5743('0x4'));var fs=require('fs');var path=require(_0x5743('0x5'));var rimraf=require(_0x5743('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x268182,_0x2ccf40){return _0x268182[_0x5743('0x7')](_0x5743('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x5743('0x9'),'fields':[_0x5743('0x9')]},{'name':'uniqueid','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 369cec5..b483077 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(_0x2686fc,_0x33dd73){var _0x59f3e4=function(_0x15b9c6){while(--_0x15b9c6){_0x2686fc['push'](_0x2686fc['shift']());}};_0x59f3e4(++_0x33dd73);}(_0xb10b,0x12a));var _0xbb10=function(_0xd8768,_0x3fedcb){_0xd8768=_0xd8768-0x0;var _0x46228f=_0xb10b[_0xd8768];return _0x46228f;};'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 _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(_0x1d4a55,_0x52eb53){var _0x264a96=function(_0x562b3d){while(--_0x562b3d){_0x1d4a55['push'](_0x1d4a55['shift']());}};_0x264a96(++_0x52eb53);}(_0xb10b,0x12a));var _0xbb10=function(_0x1736e8,_0x28cb17){_0x1736e8=_0x1736e8-0x0;var _0x23024e=_0xb10b[_0x1736e8];return _0x23024e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 65582fe..18b10fc 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 _0x5e11=['index','get','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated'];(function(_0x1a8e6d,_0x309736){var _0x5a58c1=function(_0x460d0a){while(--_0x460d0a){_0x1a8e6d['push'](_0x1a8e6d['shift']());}};_0x5a58c1(++_0x309736);}(_0x5e11,0x1a6));var _0x15e1=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0x5e11[_0x2e78e9];return _0x35aad4;};'use strict';var multer=require(_0x15e1('0x0'));var util=require('util');var path=require(_0x15e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x15e1('0x2'));var router=express[_0x15e1('0x3')]();var fs_extra=require(_0x15e1('0x4'));var auth=require(_0x15e1('0x5'));var interaction=require(_0x15e1('0x6'));var config=require(_0x15e1('0x7'));var controller=require(_0x15e1('0x8'));router['get']('/',auth[_0x15e1('0x9')](),controller[_0x15e1('0xa')]);router[_0x15e1('0xb')]('/describe',auth[_0x15e1('0x9')](),controller[_0x15e1('0xc')]);router[_0x15e1('0xb')](_0x15e1('0xd'),auth['isAuthenticated'](),controller[_0x15e1('0xe')]);router['get'](_0x15e1('0xf'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x10')]);router['get'](_0x15e1('0x11'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x12')]);router['post'](_0x15e1('0x13'),auth[_0x15e1('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x15e1('0x14')](_0x15e1('0x15'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x16')]);router[_0x15e1('0x14')](_0x15e1('0x17'),auth[_0x15e1('0x9')](),controller[_0x15e1('0x18')]);router[_0x15e1('0x19')](_0x15e1('0xd'),auth[_0x15e1('0x9')](),controller['update']);module[_0x15e1('0x1a')]=router; \ No newline at end of file +var _0xf750=['checkContactHopper','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x163a35,_0x4d21dc){var _0x1b48e2=function(_0x1b9572){while(--_0x1b9572){_0x163a35['push'](_0x163a35['shift']());}};_0x1b48e2(++_0x4d21dc);}(_0xf750,0x117));var _0x0f75=function(_0x2eec1f,_0x1b9987){_0x2eec1f=_0x2eec1f-0x0;var _0x543075=_0xf750[_0x2eec1f];return _0x543075;};'use strict';var multer=require('multer');var util=require(_0x0f75('0x0'));var path=require('path');var timeout=require(_0x0f75('0x1'));var express=require(_0x0f75('0x2'));var router=express[_0x0f75('0x3')]();var fs_extra=require(_0x0f75('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0f75('0x5'));var config=require(_0x0f75('0x6'));var controller=require('./cmHopperFinal.controller');router[_0x0f75('0x7')]('/',auth[_0x0f75('0x8')](),controller[_0x0f75('0x9')]);router['get'](_0x0f75('0xa'),auth[_0x0f75('0x8')](),controller['describe']);router[_0x0f75('0x7')](_0x0f75('0xb'),auth[_0x0f75('0x8')](),controller[_0x0f75('0xc')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x0f75('0x8')](),controller[_0x0f75('0xd')]);router[_0x0f75('0x7')](_0x0f75('0xe'),auth[_0x0f75('0x8')](),controller[_0x0f75('0xf')]);router[_0x0f75('0x10')](_0x0f75('0x11'),auth[_0x0f75('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x0f75('0x10')](_0x0f75('0x12'),auth[_0x0f75('0x8')](),controller[_0x0f75('0x13')]);router[_0x0f75('0x10')](_0x0f75('0x14'),auth[_0x0f75('0x8')](),controller[_0x0f75('0x15')]);router[_0x0f75('0x16')](_0x0f75('0xb'),auth[_0x0f75('0x8')](),controller[_0x0f75('0x17')]);module[_0x0f75('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 21100d6..1f1b25c 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 _0x7647=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x350afe,_0x3ef9ce){var _0x4a1496=function(_0x3b9987){while(--_0x3b9987){_0x350afe['push'](_0x350afe['shift']());}};_0x4a1496(++_0x3ef9ce);}(_0x7647,0x12d));var _0x7764=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7647[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x7764('0x0'));module[_0x7764('0x1')]={'state':{'type':Sequelize[_0x7764('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7764('0x3')]},'scheduledat':{'type':Sequelize[_0x7764('0x4')]},'countbusyretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7764('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7764('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7764('0x3')]},'calleridnum':{'type':Sequelize[_0x7764('0x3')]},'calleridname':{'type':Sequelize[_0x7764('0x3')]},'starttime':{'type':Sequelize[_0x7764('0x4')]},'responsetime':{'type':Sequelize[_0x7764('0x4')]},'answertime':{'type':Sequelize[_0x7764('0x4')]},'droptime':{'type':Sequelize[_0x7764('0x4')]},'endtime':{'type':Sequelize[_0x7764('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7764('0x3')]},'campaign':{'type':Sequelize[_0x7764('0x3')]},'campaigntype':{'type':Sequelize[_0x7764('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7764('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7764('0x4')]},'edited':{'type':Sequelize[_0x7764('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7764('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7764('0x3')]}}; \ No newline at end of file +var _0xcf58=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xcf58,0x86));var _0x8cf5=function(_0x318d25,_0x1e4d66){_0x318d25=_0x318d25-0x0;var _0x51dde7=_0xcf58[_0x318d25];return _0x51dde7;};'use strict';var Sequelize=require(_0x8cf5('0x0'));module[_0x8cf5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8cf5('0x2')]},'scheduledat':{'type':Sequelize[_0x8cf5('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8cf5('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8cf5('0x2')]},'calleridnum':{'type':Sequelize[_0x8cf5('0x2')]},'calleridname':{'type':Sequelize[_0x8cf5('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8cf5('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8cf5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8cf5('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8cf5('0x2')]},'amd':{'type':Sequelize[_0x8cf5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8cf5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8cf5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8cf5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8cf5('0x3')]},'edited':{'type':Sequelize[_0x8cf5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8cf5('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8cf5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 06372d1..5647d24 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 _0xc179=['find','catch','create','describe','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','keys','fields','options'];(function(_0x509a36,_0x23f071){var _0x5c85d7=function(_0x5def7f){while(--_0x5def7f){_0x509a36['push'](_0x509a36['shift']());}};_0x5c85d7(++_0x23f071);}(_0xc179,0xa2));var _0x9c17=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0xc179[_0x1b8050];return _0x1ec2b1;};'use strict';var emlformat=require(_0x9c17('0x0'));var rimraf=require(_0x9c17('0x1'));var zipdir=require(_0x9c17('0x2'));var jsonpatch=require(_0x9c17('0x3'));var rp=require('request-promise');var moment=require(_0x9c17('0x4'));var BPromise=require(_0x9c17('0x5'));var Mustache=require(_0x9c17('0x6'));var util=require(_0x9c17('0x7'));var path=require(_0x9c17('0x8'));var sox=require(_0x9c17('0x9'));var csv=require(_0x9c17('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c17('0xb'));var _=require(_0x9c17('0xc'));var squel=require(_0x9c17('0xd'));var crypto=require(_0x9c17('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9c17('0xa'));var querystring=require(_0x9c17('0xf'));var Papa=require(_0x9c17('0x10'));var Redis=require('ioredis');var authService=require(_0x9c17('0x11'));var qs=require(_0x9c17('0x12'));var as=require(_0x9c17('0x13'));var hardwareService=require(_0x9c17('0x14'));var logger=require(_0x9c17('0x15'))(_0x9c17('0x16'));var utils=require(_0x9c17('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9c17('0x18'));var db=require(_0x9c17('0x19'))['db'];function respondWithStatusCode(_0x42c831,_0x585627){_0x585627=_0x585627||0xcc;return function(_0x19f5ad){if(_0x19f5ad){return _0x42c831[_0x9c17('0x1a')](_0x585627);}return _0x42c831[_0x9c17('0x1b')](_0x585627)['end']();};}function respondWithResult(_0x1b44f2,_0x94f11){_0x94f11=_0x94f11||0xc8;return function(_0x28c025){if(_0x28c025){return _0x1b44f2['status'](_0x94f11)[_0x9c17('0x1c')](_0x28c025);}};}function respondWithFilteredResult(_0x219732,_0xdcb808){return function(_0x2f2eaf){if(_0x2f2eaf){var _0x3e7264=typeof _0xdcb808[_0x9c17('0x1d')]===_0x9c17('0x1e')&&typeof _0xdcb808[_0x9c17('0x1f')]===_0x9c17('0x1e');var _0x279b92=_0x2f2eaf['count'];var _0x537aee=_0x3e7264?0x0:_0xdcb808[_0x9c17('0x1d')];var _0x300468=_0x3e7264?_0x2f2eaf[_0x9c17('0x20')]:_0xdcb808[_0x9c17('0x1d')]+_0xdcb808[_0x9c17('0x1f')];var _0x40faa4;if(_0x300468>=_0x279b92){_0x300468=_0x279b92;_0x40faa4=0xc8;}else{_0x40faa4=0xce;}_0x219732['status'](_0x40faa4);return _0x219732[_0x9c17('0x21')](_0x9c17('0x22'),_0x537aee+'-'+_0x300468+'/'+_0x279b92)[_0x9c17('0x1c')](_0x2f2eaf);}return null;};}function patchUpdates(_0x54b534){return function(_0x1aa10e){try{jsonpatch[_0x9c17('0x23')](_0x1aa10e,_0x54b534,!![]);}catch(_0x40eed4){return BPromise['reject'](_0x40eed4);}return _0x1aa10e[_0x9c17('0x24')]();};}function saveUpdates(_0x3150e1,_0x2ec580){return function(_0xe2b0b6){if(_0xe2b0b6){return _0xe2b0b6[_0x9c17('0x25')](_0x3150e1)[_0x9c17('0x26')](function(_0x52d25e){return _0x52d25e;});}return null;};}function removeEntity(_0x2b4e0b,_0x3e91ae){return function(_0x4c9f5e){if(_0x4c9f5e){return _0x4c9f5e['destroy']()['then'](function(){_0x2b4e0b[_0x9c17('0x1b')](0xcc)[_0x9c17('0x27')]();});}};}function handleEntityNotFound(_0xcaf561,_0x5a2e7a){return function(_0x28fb18){if(!_0x28fb18){_0xcaf561['sendStatus'](0x194);}return _0x28fb18;};}function handleError(_0x2d80fc,_0x4b5476){_0x4b5476=_0x4b5476||0x1f4;return function(_0x25f5bd){logger[_0x9c17('0x28')](_0x25f5bd[_0x9c17('0x29')]);if(_0x25f5bd[_0x9c17('0x2a')]){delete _0x25f5bd[_0x9c17('0x2a')];}_0x2d80fc[_0x9c17('0x1b')](_0x4b5476)[_0x9c17('0x2b')](_0x25f5bd);};}exports[_0x9c17('0x2c')]=function(_0x31858b,_0x2bd3e5){var _0x4cf024={},_0x3ff1b5={},_0x4d4dce={'count':0x0,'rows':[]};var _0x252fcc=_[_0x9c17('0x2d')](db[_0x9c17('0x2e')]['rawAttributes'],function(_0x5d9946){return{'name':_0x5d9946[_0x9c17('0x2f')],'type':_0x5d9946[_0x9c17('0x30')][_0x9c17('0x31')]};});_0x3ff1b5[_0x9c17('0x32')]=_[_0x9c17('0x2d')](_0x252fcc,_0x9c17('0x2a'));_0x3ff1b5[_0x9c17('0x33')]=_['keys'](_0x31858b[_0x9c17('0x33')]);_0x3ff1b5[_0x9c17('0x34')]=_[_0x9c17('0x35')](_0x3ff1b5[_0x9c17('0x32')],_0x3ff1b5[_0x9c17('0x33')]);_0x4cf024[_0x9c17('0x36')]=_[_0x9c17('0x35')](_0x3ff1b5[_0x9c17('0x32')],qs['fields'](_0x31858b['query']['fields']));_0x4cf024[_0x9c17('0x36')]=_0x4cf024[_0x9c17('0x36')][_0x9c17('0x37')]?_0x4cf024[_0x9c17('0x36')]:_0x3ff1b5[_0x9c17('0x32')];if(!_0x31858b[_0x9c17('0x33')][_0x9c17('0x38')](_0x9c17('0x39'))){_0x4cf024['limit']=qs[_0x9c17('0x1f')](_0x31858b[_0x9c17('0x33')]['limit']);_0x4cf024[_0x9c17('0x1d')]=qs['offset'](_0x31858b[_0x9c17('0x33')][_0x9c17('0x1d')]);}_0x4cf024[_0x9c17('0x3a')]=qs[_0x9c17('0x3b')](_0x31858b[_0x9c17('0x33')][_0x9c17('0x3b')]);_0x4cf024[_0x9c17('0x3c')]=qs[_0x9c17('0x34')](_['pick'](_0x31858b['query'],_0x3ff1b5[_0x9c17('0x34')]),_0x252fcc);if(_0x31858b['query'][_0x9c17('0x3d')]){_0x4cf024[_0x9c17('0x3c')]=_['merge'](_0x4cf024[_0x9c17('0x3c')],{'$or':_[_0x9c17('0x2d')](_0x252fcc,function(_0x234201){if(_0x234201[_0x9c17('0x30')]!==_0x9c17('0x3e')){var _0x464b95={};_0x464b95[_0x234201[_0x9c17('0x2a')]]={'$like':'%'+_0x31858b['query'][_0x9c17('0x3d')]+'%'};return _0x464b95;}})});}_0x4cf024=_['merge']({},_0x4cf024,_0x31858b['options']);var _0x43ab4f={'where':_0x4cf024[_0x9c17('0x3c')]};return db['CmHopperHistory'][_0x9c17('0x20')](_0x43ab4f)['then'](function(_0x505878){_0x4d4dce[_0x9c17('0x20')]=_0x505878;if(_0x31858b[_0x9c17('0x33')][_0x9c17('0x3f')]){_0x4cf024[_0x9c17('0x40')]=[{'all':!![]}];}return db[_0x9c17('0x2e')][_0x9c17('0x41')](_0x4cf024);})[_0x9c17('0x26')](function(_0x52b42f){_0x4d4dce['rows']=_0x52b42f;return _0x4d4dce;})[_0x9c17('0x26')](respondWithFilteredResult(_0x2bd3e5,_0x4cf024))['catch'](handleError(_0x2bd3e5,null));};exports[_0x9c17('0x42')]=function(_0x205de7,_0x286dc9){var _0x5d8ab={'raw':!![],'where':{'id':_0x205de7[_0x9c17('0x43')]['id']}},_0x5d9084={};_0x5d9084[_0x9c17('0x32')]=_['keys'](db['CmHopperHistory'][_0x9c17('0x44')]);_0x5d9084[_0x9c17('0x33')]=_[_0x9c17('0x45')](_0x205de7['query']);_0x5d9084['filters']=_[_0x9c17('0x35')](_0x5d9084['model'],_0x5d9084[_0x9c17('0x33')]);_0x5d8ab[_0x9c17('0x36')]=_[_0x9c17('0x35')](_0x5d9084[_0x9c17('0x32')],qs[_0x9c17('0x46')](_0x205de7[_0x9c17('0x33')]['fields']));_0x5d8ab[_0x9c17('0x36')]=_0x5d8ab[_0x9c17('0x36')][_0x9c17('0x37')]?_0x5d8ab['attributes']:_0x5d9084['model'];if(_0x205de7['query'][_0x9c17('0x3f')]){_0x5d8ab[_0x9c17('0x40')]=[{'all':!![]}];}_0x5d8ab=_['merge']({},_0x5d8ab,_0x205de7[_0x9c17('0x47')]);return db[_0x9c17('0x2e')][_0x9c17('0x48')](_0x5d8ab)['then'](handleEntityNotFound(_0x286dc9,null))[_0x9c17('0x26')](respondWithResult(_0x286dc9,null))[_0x9c17('0x49')](handleError(_0x286dc9,null));};exports[_0x9c17('0x4a')]=function(_0x45e8c6,_0x1eb867){return db['CmHopperHistory'][_0x9c17('0x4a')](_0x45e8c6['body'],{})['then'](respondWithResult(_0x1eb867,0xc9))[_0x9c17('0x49')](handleError(_0x1eb867,null));};exports[_0x9c17('0x4b')]=function(_0x40687c,_0xa7f41e){return db[_0x9c17('0x2e')][_0x9c17('0x4b')]()[_0x9c17('0x26')](respondWithResult(_0xa7f41e,null))[_0x9c17('0x49')](handleError(_0xa7f41e,null));};exports['update']=function(_0x59dd6c,_0xb7f52e){if(_0x59dd6c[_0x9c17('0x4c')][_0x9c17('0x4d')]){delete _0x59dd6c[_0x9c17('0x4c')][_0x9c17('0x4d')];}return db[_0x9c17('0x2e')][_0x9c17('0x48')]({'where':{'uniqueid':_0x59dd6c[_0x9c17('0x43')]['id']}})[_0x9c17('0x26')](handleEntityNotFound(_0xb7f52e,null))[_0x9c17('0x26')](saveUpdates(_0x59dd6c[_0x9c17('0x4c')],null))['then'](respondWithResult(_0xb7f52e,null))['catch'](handleError(_0xb7f52e,null));}; \ No newline at end of file +var _0xf881=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','catch','create','body','describe','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x3a83a0,_0xd4a05e){var _0x54f44d=function(_0x474341){while(--_0x474341){_0x3a83a0['push'](_0x3a83a0['shift']());}};_0x54f44d(++_0xd4a05e);}(_0xf881,0x168));var _0x1f88=function(_0x8be7bd,_0x435da2){_0x8be7bd=_0x8be7bd-0x0;var _0x2d2fb7=_0xf881[_0x8be7bd];return _0x2d2fb7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f88('0x0'));var jsonpatch=require(_0x1f88('0x1'));var rp=require(_0x1f88('0x2'));var moment=require(_0x1f88('0x3'));var BPromise=require(_0x1f88('0x4'));var Mustache=require('mustache');var util=require(_0x1f88('0x5'));var path=require(_0x1f88('0x6'));var sox=require(_0x1f88('0x7'));var csv=require(_0x1f88('0x8'));var ejs=require(_0x1f88('0x9'));var fs=require('fs');var fs_extra=require(_0x1f88('0xa'));var _=require(_0x1f88('0xb'));var squel=require(_0x1f88('0xc'));var crypto=require('crypto');var jsforce=require(_0x1f88('0xd'));var deskjs=require(_0x1f88('0xe'));var toCsv=require(_0x1f88('0x8'));var querystring=require('querystring');var Papa=require(_0x1f88('0xf'));var Redis=require(_0x1f88('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1f88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f88('0x12'));var logger=require(_0x1f88('0x13'))(_0x1f88('0x14'));var utils=require(_0x1f88('0x15'));var config=require(_0x1f88('0x16'));var licenseUtil=require(_0x1f88('0x17'));var db=require(_0x1f88('0x18'))['db'];function respondWithStatusCode(_0x113796,_0x3bd666){_0x3bd666=_0x3bd666||0xcc;return function(_0x57cd50){if(_0x57cd50){return _0x113796[_0x1f88('0x19')](_0x3bd666);}return _0x113796[_0x1f88('0x1a')](_0x3bd666)[_0x1f88('0x1b')]();};}function respondWithResult(_0x98536f,_0x265fe8){_0x265fe8=_0x265fe8||0xc8;return function(_0x220e7a){if(_0x220e7a){return _0x98536f[_0x1f88('0x1a')](_0x265fe8)['json'](_0x220e7a);}};}function respondWithFilteredResult(_0x3b759a,_0x16ed26){return function(_0x26cec4){if(_0x26cec4){var _0x554fad=typeof _0x16ed26[_0x1f88('0x1c')]===_0x1f88('0x1d')&&typeof _0x16ed26['limit']==='undefined';var _0x20ffad=_0x26cec4[_0x1f88('0x1e')];var _0x44db62=_0x554fad?0x0:_0x16ed26[_0x1f88('0x1c')];var _0x314527=_0x554fad?_0x26cec4[_0x1f88('0x1e')]:_0x16ed26['offset']+_0x16ed26['limit'];var _0x1acd9c;if(_0x314527>=_0x20ffad){_0x314527=_0x20ffad;_0x1acd9c=0xc8;}else{_0x1acd9c=0xce;}_0x3b759a[_0x1f88('0x1a')](_0x1acd9c);return _0x3b759a[_0x1f88('0x1f')]('Content-Range',_0x44db62+'-'+_0x314527+'/'+_0x20ffad)[_0x1f88('0x20')](_0x26cec4);}return null;};}function patchUpdates(_0x7e2821){return function(_0x36248b){try{jsonpatch[_0x1f88('0x21')](_0x36248b,_0x7e2821,!![]);}catch(_0x40949b){return BPromise[_0x1f88('0x22')](_0x40949b);}return _0x36248b['save']();};}function saveUpdates(_0x2ccdc6,_0x5a5012){return function(_0x183407){if(_0x183407){return _0x183407[_0x1f88('0x23')](_0x2ccdc6)[_0x1f88('0x24')](function(_0x38978b){return _0x38978b;});}return null;};}function removeEntity(_0x54d5a5,_0x184d89){return function(_0x380887){if(_0x380887){return _0x380887[_0x1f88('0x25')]()[_0x1f88('0x24')](function(){_0x54d5a5[_0x1f88('0x1a')](0xcc)[_0x1f88('0x1b')]();});}};}function handleEntityNotFound(_0xa3b78,_0x3004a0){return function(_0x205bb1){if(!_0x205bb1){_0xa3b78['sendStatus'](0x194);}return _0x205bb1;};}function handleError(_0x56a0b4,_0x5f10e6){_0x5f10e6=_0x5f10e6||0x1f4;return function(_0x248530){logger[_0x1f88('0x26')](_0x248530[_0x1f88('0x27')]);if(_0x248530[_0x1f88('0x28')]){delete _0x248530[_0x1f88('0x28')];}_0x56a0b4[_0x1f88('0x1a')](_0x5f10e6)[_0x1f88('0x29')](_0x248530);};}exports[_0x1f88('0x2a')]=function(_0x4a34e9,_0x564c29){var _0x882570={},_0x516cc9={},_0x477d27={'count':0x0,'rows':[]};var _0x4f1de5=_[_0x1f88('0x2b')](db[_0x1f88('0x2c')]['rawAttributes'],function(_0x31dc7c){return{'name':_0x31dc7c['fieldName'],'type':_0x31dc7c[_0x1f88('0x2d')]['key']};});_0x516cc9['model']=_[_0x1f88('0x2b')](_0x4f1de5,_0x1f88('0x28'));_0x516cc9[_0x1f88('0x2e')]=_[_0x1f88('0x2f')](_0x4a34e9[_0x1f88('0x2e')]);_0x516cc9[_0x1f88('0x30')]=_[_0x1f88('0x31')](_0x516cc9['model'],_0x516cc9[_0x1f88('0x2e')]);_0x882570[_0x1f88('0x32')]=_[_0x1f88('0x31')](_0x516cc9['model'],qs[_0x1f88('0x33')](_0x4a34e9[_0x1f88('0x2e')][_0x1f88('0x33')]));_0x882570['attributes']=_0x882570['attributes'][_0x1f88('0x34')]?_0x882570['attributes']:_0x516cc9[_0x1f88('0x35')];if(!_0x4a34e9[_0x1f88('0x2e')][_0x1f88('0x36')]('nolimit')){_0x882570[_0x1f88('0x37')]=qs[_0x1f88('0x37')](_0x4a34e9['query'][_0x1f88('0x37')]);_0x882570[_0x1f88('0x1c')]=qs['offset'](_0x4a34e9['query'][_0x1f88('0x1c')]);}_0x882570[_0x1f88('0x38')]=qs[_0x1f88('0x39')](_0x4a34e9['query'][_0x1f88('0x39')]);_0x882570['where']=qs['filters'](_[_0x1f88('0x3a')](_0x4a34e9[_0x1f88('0x2e')],_0x516cc9[_0x1f88('0x30')]),_0x4f1de5);if(_0x4a34e9['query'][_0x1f88('0x3b')]){_0x882570[_0x1f88('0x3c')]=_[_0x1f88('0x3d')](_0x882570[_0x1f88('0x3c')],{'$or':_[_0x1f88('0x2b')](_0x4f1de5,function(_0x5aaae4){if(_0x5aaae4['type']!==_0x1f88('0x3e')){var _0x137a83={};_0x137a83[_0x5aaae4[_0x1f88('0x28')]]={'$like':'%'+_0x4a34e9['query'][_0x1f88('0x3b')]+'%'};return _0x137a83;}})});}_0x882570=_[_0x1f88('0x3d')]({},_0x882570,_0x4a34e9[_0x1f88('0x3f')]);var _0x142569={'where':_0x882570[_0x1f88('0x3c')]};return db['CmHopperHistory'][_0x1f88('0x1e')](_0x142569)[_0x1f88('0x24')](function(_0x2173f5){_0x477d27['count']=_0x2173f5;if(_0x4a34e9['query'][_0x1f88('0x40')]){_0x882570['include']=[{'all':!![]}];}return db[_0x1f88('0x2c')][_0x1f88('0x41')](_0x882570);})[_0x1f88('0x24')](function(_0x5bc117){_0x477d27['rows']=_0x5bc117;return _0x477d27;})[_0x1f88('0x24')](respondWithFilteredResult(_0x564c29,_0x882570))['catch'](handleError(_0x564c29,null));};exports[_0x1f88('0x42')]=function(_0x448c11,_0x2220a4){var _0x4377c6={'raw':!![],'where':{'id':_0x448c11[_0x1f88('0x43')]['id']}},_0x5c3f49={};_0x5c3f49[_0x1f88('0x35')]=_['keys'](db[_0x1f88('0x2c')][_0x1f88('0x44')]);_0x5c3f49[_0x1f88('0x2e')]=_[_0x1f88('0x2f')](_0x448c11[_0x1f88('0x2e')]);_0x5c3f49[_0x1f88('0x30')]=_[_0x1f88('0x31')](_0x5c3f49[_0x1f88('0x35')],_0x5c3f49[_0x1f88('0x2e')]);_0x4377c6['attributes']=_[_0x1f88('0x31')](_0x5c3f49[_0x1f88('0x35')],qs[_0x1f88('0x33')](_0x448c11[_0x1f88('0x2e')][_0x1f88('0x33')]));_0x4377c6[_0x1f88('0x32')]=_0x4377c6[_0x1f88('0x32')][_0x1f88('0x34')]?_0x4377c6[_0x1f88('0x32')]:_0x5c3f49[_0x1f88('0x35')];if(_0x448c11[_0x1f88('0x2e')][_0x1f88('0x40')]){_0x4377c6[_0x1f88('0x45')]=[{'all':!![]}];}_0x4377c6=_['merge']({},_0x4377c6,_0x448c11['options']);return db['CmHopperHistory']['find'](_0x4377c6)[_0x1f88('0x24')](handleEntityNotFound(_0x2220a4,null))[_0x1f88('0x24')](respondWithResult(_0x2220a4,null))[_0x1f88('0x46')](handleError(_0x2220a4,null));};exports[_0x1f88('0x47')]=function(_0x5e2e99,_0x2a8ed0){return db['CmHopperHistory'][_0x1f88('0x47')](_0x5e2e99[_0x1f88('0x48')],{})[_0x1f88('0x24')](respondWithResult(_0x2a8ed0,0xc9))[_0x1f88('0x46')](handleError(_0x2a8ed0,null));};exports[_0x1f88('0x49')]=function(_0x331fbf,_0x26d3f3){return db['CmHopperHistory'][_0x1f88('0x49')]()[_0x1f88('0x24')](respondWithResult(_0x26d3f3,null))[_0x1f88('0x46')](handleError(_0x26d3f3,null));};exports[_0x1f88('0x23')]=function(_0x52ee92,_0x3d3569){if(_0x52ee92[_0x1f88('0x48')][_0x1f88('0x4a')]){delete _0x52ee92[_0x1f88('0x48')]['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x52ee92['params']['id']}})[_0x1f88('0x24')](handleEntityNotFound(_0x3d3569,null))[_0x1f88('0x24')](saveUpdates(_0x52ee92[_0x1f88('0x48')],null))[_0x1f88('0x24')](respondWithResult(_0x3d3569,null))[_0x1f88('0x46')](handleError(_0x3d3569,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index cccc483..67a8d1c 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 _0x6333=['uniqueid','api','bluebird','request-promise','rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history'];(function(_0x2aaa0a,_0x36f63a){var _0x326d4b=function(_0x4a4089){while(--_0x4a4089){_0x2aaa0a['push'](_0x2aaa0a['shift']());}};_0x326d4b(++_0x36f63a);}(_0x6333,0x83));var _0x3633=function(_0x1cfffd,_0x347ad3){_0x1cfffd=_0x1cfffd-0x0;var _0x4a8f60=_0x6333[_0x1cfffd];return _0x4a8f60;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3633('0x0'));var moment=require('moment');var BPromise=require(_0x3633('0x1'));var rp=require(_0x3633('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3633('0x3'));var config=require('../../config/environment');var attributes=require(_0x3633('0x4'));module[_0x3633('0x5')]=function(_0x566b21,_0x547e6d){return _0x566b21[_0x3633('0x6')](_0x3633('0x7'),attributes,{'tableName':_0x3633('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x3633('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['CmHopperHistory','cm_hopper_history','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3166be,_0x286ae8){var _0x123920=function(_0x3e3563){while(--_0x3e3563){_0x3166be['push'](_0x3166be['shift']());}};_0x123920(++_0x286ae8);}(_0x7a52,0x1bd));var _0x27a5=function(_0x5cb528,_0xdfdc4a){_0x5cb528=_0x5cb528-0x0;var _0x2b29f1=_0x7a52[_0x5cb528];return _0x2b29f1;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var logger=require(_0x27a5('0x1'))(_0x27a5('0x2'));var moment=require(_0x27a5('0x3'));var BPromise=require(_0x27a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27a5('0x5'));var rimraf=require(_0x27a5('0x6'));var config=require(_0x27a5('0x7'));var attributes=require(_0x27a5('0x8'));module[_0x27a5('0x9')]=function(_0x393c55,_0x23fc7e){return _0x393c55['define'](_0x27a5('0xa'),attributes,{'tableName':_0x27a5('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x27a5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index daf2be1..b37d37d 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 _0x609a=['outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','CmHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','body','options','raw','stringify','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null'];(function(_0x5bd62b,_0x49f304){var _0x5147fb=function(_0x3caf68){while(--_0x3caf68){_0x5bd62b['push'](_0x5bd62b['shift']());}};_0x5147fb(++_0x49f304);}(_0x609a,0x1ec));var _0xa609=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x609a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var moment=require(_0xa609('0x2'));var BPromise=require(_0xa609('0x3'));var rs=require(_0xa609('0x4'));var fs=require('fs');var Redis=require(_0xa609('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa609('0x6'));var logger=require('../../config/logger')(_0xa609('0x7'));var config=require(_0xa609('0x8'));var jayson=require(_0xa609('0x9'));var client=jayson[_0xa609('0xa')][_0xa609('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409f8d,_0x394cde,_0x269447){return new BPromise(function(_0x29f23a,_0x3b5da3){return client[_0xa609('0xc')](_0x409f8d,_0x269447)[_0xa609('0xd')](function(_0x52e06a){logger[_0xa609('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x394cde,_0xa609('0xf'));logger[_0xa609('0x10')](_0xa609('0x11'),_0x394cde,_0xa609('0xf'),JSON['stringify'](_0x52e06a));if(_0x52e06a[_0xa609('0x12')]){if(_0x52e06a[_0xa609('0x12')][_0xa609('0x13')]===0x1f4){logger['error'](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x3b5da3(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);return _0x29f23a(_0x52e06a[_0xa609('0x12')][_0xa609('0x15')]);}else{logger['info'](_0xa609('0x14'),_0x394cde,_0xa609('0xf'));_0x29f23a(_0x52e06a[_0xa609('0x16')][_0xa609('0x15')]);}})[_0xa609('0x17')](function(_0x44bab4){logger[_0xa609('0x12')](_0xa609('0x14'),_0x394cde,_0x44bab4);_0x3b5da3(_0x44bab4);});});}exports[_0xa609('0x18')]=function(_0x1c9bed){var _0x26b4ea=this;return new Promise(function(_0x3e6eac,_0x338be7){return db['CmHopperHistory']['create'](_0x1c9bed[_0xa609('0x19')],{'raw':_0x1c9bed[_0xa609('0x1a')]?_0x1c9bed[_0xa609('0x1a')][_0xa609('0x1b')]===undefined?!![]:![]:!![]})[_0xa609('0xd')](function(_0x103bce){logger['info'](_0xa609('0x18'),_0x1c9bed);logger[_0xa609('0x10')]('CreateCmHopperHistory',_0x1c9bed,JSON[_0xa609('0x1c')](_0x103bce));_0x3e6eac(_0x103bce);})[_0xa609('0x17')](function(_0x535e58){logger[_0xa609('0x12')](_0xa609('0x18'),_0x535e58[_0xa609('0x15')],_0x1c9bed);_0x338be7(_0x26b4ea[_0xa609('0x12')](0x1f4,_0x535e58[_0xa609('0x15')]));});});};exports[_0xa609('0x1d')]=function(_0x4ca2c3){var _0x56e784=this;return new Promise(function(_0x41ab1f,_0x1fe2ab){return db['CmHopperHistory'][_0xa609('0x1e')]({'raw':_0x4ca2c3[_0xa609('0x1a')]?_0x4ca2c3['options'][_0xa609('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ca2c3[_0xa609('0x1a')]?_0x4ca2c3[_0xa609('0x1a')]['where']||null:null,'attributes':[[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')][_0xa609('0x21')]('id')),_0xa609('0x22')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0xa609('0x25')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x26')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa609('0x1f')]['fn']('AVG',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0xa609('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x3c0aba){logger[_0xa609('0xe')]('AvgHandleTime',_0x4ca2c3);logger[_0xa609('0x10')](_0xa609('0x1d'),_0x4ca2c3,JSON['stringify'](_0x3c0aba));_0x41ab1f(_0x3c0aba);})['catch'](function(_0x50e183){logger[_0xa609('0x12')](_0xa609('0x1d'),_0x50e183[_0xa609('0x15')],_0x4ca2c3);_0x1fe2ab(_0x56e784[_0xa609('0x12')](0x1f4,_0x50e183[_0xa609('0x15')]));});});};exports[_0xa609('0x28')]=function(_0x31fd28){var _0x48cb9f=this;return new Promise(function(_0x572c70,_0x5de016){return db['CmHopperHistory'][_0xa609('0x1e')]({'raw':_0x31fd28[_0xa609('0x1a')]?_0x31fd28['options']['raw']===undefined?!![]:![]:!![],'where':_0x31fd28[_0xa609('0x1a')]?_0x31fd28[_0xa609('0x1a')][_0xa609('0x29')]||null:null,'attributes':[[_0xa609('0x2a'),_0xa609('0x2b')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x2c')))),_0xa609('0x2d')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xa609('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db['sequelize'][_0xa609('0x23')](_0xa609('0x30')))),_0xa609('0x31')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x32')))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x33')))),_0xa609('0x34')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0xa609('0x1f')]['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa609('0x36')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0xa609('0x37')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x38')))),_0xa609('0x39')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3a')))),_0xa609('0x3b')],[db[_0xa609('0x1f')]['fn']('COUNT',db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3c')))),_0xa609('0x3d')],[db['sequelize']['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db[_0xa609('0x1f')][_0xa609('0x23')](_0xa609('0x3e')))),_0xa609('0x3b')],[db['sequelize']['fn'](_0xa609('0x20'),db['sequelize']['fn']('IF',db[_0xa609('0x1f')]['literal'](_0xa609('0x3f')))),_0xa609('0x40')]],'group':['campaign']})[_0xa609('0xd')](function(_0x141fc1){logger[_0xa609('0xe')](_0xa609('0x28'),_0x31fd28);logger[_0xa609('0x10')](_0xa609('0x28'),_0x31fd28,JSON[_0xa609('0x1c')](_0x141fc1));_0x572c70(_0x141fc1);})['catch'](function(_0xa21947){logger[_0xa609('0x12')](_0xa609('0x28'),_0xa21947['message'],_0x31fd28);_0x5de016(_0x48cb9f[_0xa609('0x12')](0x1f4,_0xa21947['message']));});});};exports[_0xa609('0x41')]=function(_0x8e31f2){var _0x8478c8=this;return new Promise(function(_0x1c2751,_0x3b42b1){return db[_0xa609('0x42')][_0xa609('0x1e')]({'raw':_0x8e31f2[_0xa609('0x1a')]?_0x8e31f2[_0xa609('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x8e31f2[_0xa609('0x1a')]?_0x8e31f2[_0xa609('0x1a')]['where']||null:null,'attributes':[['campaign',_0xa609('0x2b')],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db['sequelize'][_0xa609('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xa609('0x1f')]['fn'](_0xa609('0x20'),db[_0xa609('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa609('0x24')))),_0xa609('0x43')]],'group':[_0xa609('0x2a')]})[_0xa609('0xd')](function(_0x72e269){logger[_0xa609('0xe')](_0xa609('0x41'),_0x8e31f2);logger[_0xa609('0x10')](_0xa609('0x41'),_0x8e31f2,JSON['stringify'](_0x72e269));_0x1c2751(_0x72e269);})[_0xa609('0x17')](function(_0x1d0ce4){logger[_0xa609('0x12')](_0xa609('0x41'),_0x1d0ce4['message'],_0x8e31f2);_0x3b42b1(_0x8478c8[_0xa609('0x12')](0x1f4,_0x1d0ce4[_0xa609('0x15')]));});});}; \ No newline at end of file +var _0x0531=['`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body','options','catch','findAll','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','debug','campaign','name'];(function(_0x3866a9,_0x5ba083){var _0x55035f=function(_0x5033d2){while(--_0x5033d2){_0x3866a9['push'](_0x3866a9['shift']());}};_0x55035f(++_0x5ba083);}(_0x0531,0xde));var _0x1053=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x0531[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1053('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1053('0x3'));var logger=require(_0x1053('0x4'))(_0x1053('0x5'));var config=require(_0x1053('0x6'));var jayson=require(_0x1053('0x7'));var client=jayson[_0x1053('0x8')][_0x1053('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3350a0,_0x206a55,_0x3d052e){return new BPromise(function(_0x4f1877,_0x3045a7){return client[_0x1053('0xa')](_0x3350a0,_0x3d052e)[_0x1053('0xb')](function(_0x5a906b){logger[_0x1053('0xc')](_0x1053('0xd'),_0x206a55,_0x1053('0xe'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x206a55,_0x1053('0xe'),JSON[_0x1053('0xf')](_0x5a906b));if(_0x5a906b['error']){if(_0x5a906b[_0x1053('0x10')][_0x1053('0x11')]===0x1f4){logger[_0x1053('0x10')](_0x1053('0xd'),_0x206a55,_0x5a906b[_0x1053('0x10')][_0x1053('0x12')]);return _0x3045a7(_0x5a906b[_0x1053('0x10')][_0x1053('0x12')]);}logger[_0x1053('0x10')](_0x1053('0xd'),_0x206a55,_0x5a906b['error']['message']);return _0x4f1877(_0x5a906b[_0x1053('0x10')][_0x1053('0x12')]);}else{logger[_0x1053('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x206a55,'request\x20sent');_0x4f1877(_0x5a906b[_0x1053('0x13')][_0x1053('0x12')]);}})['catch'](function(_0x5d1ff5){logger[_0x1053('0x10')](_0x1053('0xd'),_0x206a55,_0x5d1ff5);_0x3045a7(_0x5d1ff5);});});}exports[_0x1053('0x14')]=function(_0x26c285){var _0x5301fc=this;return new Promise(function(_0x3523c0,_0x30e687){return db[_0x1053('0x15')]['create'](_0x26c285[_0x1053('0x16')],{'raw':_0x26c285['options']?_0x26c285[_0x1053('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1b7f9e){logger[_0x1053('0xc')](_0x1053('0x14'),_0x26c285);logger['debug']('CreateCmHopperHistory',_0x26c285,JSON[_0x1053('0xf')](_0x1b7f9e));_0x3523c0(_0x1b7f9e);})[_0x1053('0x18')](function(_0x203930){logger[_0x1053('0x10')]('CreateCmHopperHistory',_0x203930[_0x1053('0x12')],_0x26c285);_0x30e687(_0x5301fc['error'](0x1f4,_0x203930[_0x1053('0x12')]));});});};exports['AvgHandleTime']=function(_0x901db2){var _0x4fc4df=this;return new Promise(function(_0x4d8d29,_0x4f3eb4){return db['CmHopperHistory'][_0x1053('0x19')]({'raw':_0x901db2['options']?_0x901db2[_0x1053('0x17')][_0x1053('0x1a')]===undefined?!![]:![]:!![],'where':_0x901db2[_0x1053('0x17')]?_0x901db2[_0x1053('0x17')][_0x1053('0x1b')]||null:null,'attributes':[[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db['sequelize'][_0x1053('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x20')))),_0x1053('0x21')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x22')))),_0x1053('0x23')],[db['sequelize']['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db['sequelize'][_0x1053('0x1f')](_0x1053('0x24')))),_0x1053('0x25')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x26'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x27')))),_0x1053('0x28')],[db[_0x1053('0x1c')]['fn']('AVG',db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x1053('0xb')](function(_0x6c57a5){logger[_0x1053('0xc')](_0x1053('0x2a'),_0x901db2);logger[_0x1053('0x2b')](_0x1053('0x2a'),_0x901db2,JSON[_0x1053('0xf')](_0x6c57a5));_0x4d8d29(_0x6c57a5);})[_0x1053('0x18')](function(_0x57acb6){logger[_0x1053('0x10')](_0x1053('0x2a'),_0x57acb6['message'],_0x901db2);_0x4f3eb4(_0x4fc4df[_0x1053('0x10')](0x1f4,_0x57acb6['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5722f1){var _0x37ec75=this;return new Promise(function(_0x519eff,_0x1b0f6f){return db[_0x1053('0x15')][_0x1053('0x19')]({'raw':_0x5722f1[_0x1053('0x17')]?_0x5722f1['options'][_0x1053('0x1a')]===undefined?!![]:![]:!![],'where':_0x5722f1[_0x1053('0x17')]?_0x5722f1[_0x1053('0x17')][_0x1053('0x1b')]||null:null,'attributes':[[_0x1053('0x2c'),_0x1053('0x2d')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x1053('0x2f')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db['sequelize']['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x20')))),_0x1053('0x30')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x31')))),_0x1053('0x32')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x33')))),'outboundCongestionCallsDay'],[db[_0x1053('0x1c')]['fn']('COUNT',db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x34')))),_0x1053('0x35')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1053('0x36')],[db[_0x1053('0x1c')]['fn']('COUNT',db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1053('0x37')],[db[_0x1053('0x1c')]['fn']('COUNT',db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x38')))),'outboundBlacklistCallsDay'],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x39')))),_0x1053('0x3a')],[db['sequelize']['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x3b')))),_0x1053('0x3c')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x1053('0x1f')](_0x1053('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x1053('0x3c')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')]['literal'](_0x1053('0x3e')))),_0x1053('0x3f')]],'group':['campaign']})[_0x1053('0xb')](function(_0xc5e21d){logger[_0x1053('0xc')]('GetVoiceQueueHopperHistory',_0x5722f1);logger[_0x1053('0x2b')]('GetVoiceQueueHopperHistory',_0x5722f1,JSON['stringify'](_0xc5e21d));_0x519eff(_0xc5e21d);})[_0x1053('0x18')](function(_0x11ee5a){logger[_0x1053('0x10')]('GetVoiceQueueHopperHistory',_0x11ee5a[_0x1053('0x12')],_0x5722f1);_0x1b0f6f(_0x37ec75['error'](0x1f4,_0x11ee5a[_0x1053('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x4a8b2d){var _0x310830=this;return new Promise(function(_0x1c8791,_0x2f58b4){return db['CmHopperHistory'][_0x1053('0x19')]({'raw':_0x4a8b2d[_0x1053('0x17')]?_0x4a8b2d['options'][_0x1053('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a8b2d[_0x1053('0x17')]?_0x4a8b2d[_0x1053('0x17')][_0x1053('0x1b')]||null:null,'attributes':[['campaign',_0x1053('0x2d')],[db[_0x1053('0x1c')]['fn'](_0x1053('0x1d'),db['sequelize']['col']('id')),_0x1053('0x40')],[db['sequelize']['fn'](_0x1053('0x1d'),db[_0x1053('0x1c')]['fn']('IF',db[_0x1053('0x1c')][_0x1053('0x1f')](_0x1053('0x20')))),_0x1053('0x41')]],'group':[_0x1053('0x2c')]})[_0x1053('0xb')](function(_0x4c5669){logger[_0x1053('0xc')](_0x1053('0x42'),_0x4a8b2d);logger[_0x1053('0x2b')]('GetCampaignHopperHistory',_0x4a8b2d,JSON[_0x1053('0xf')](_0x4c5669));_0x1c8791(_0x4c5669);})[_0x1053('0x18')](function(_0x54b8fc){logger[_0x1053('0x10')]('GetCampaignHopperHistory',_0x54b8fc['message'],_0x4a8b2d);_0x2f58b4(_0x310830[_0x1053('0x10')](0x1f4,_0x54b8fc[_0x1053('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 932ca0d..b6f19b5 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 _0x0e52=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0e52,0x1f1));var _0x20e5=function(_0x47d26f,_0x187b3a){_0x47d26f=_0x47d26f-0x0;var _0x5b766b=_0x0e52[_0x47d26f];return _0x5b766b;};'use strict';var multer=require(_0x20e5('0x0'));var util=require(_0x20e5('0x1'));var path=require(_0x20e5('0x2'));var timeout=require(_0x20e5('0x3'));var express=require(_0x20e5('0x4'));var router=express['Router']();var fs_extra=require(_0x20e5('0x5'));var auth=require(_0x20e5('0x6'));var interaction=require(_0x20e5('0x7'));var config=require(_0x20e5('0x8'));var controller=require(_0x20e5('0x9'));router[_0x20e5('0xa')]('/',auth[_0x20e5('0xb')](),controller[_0x20e5('0xc')]);router['get'](_0x20e5('0xd'),auth[_0x20e5('0xb')](),controller[_0x20e5('0xe')]);router[_0x20e5('0xa')](_0x20e5('0xf'),auth[_0x20e5('0xb')](),controller[_0x20e5('0x10')]);router[_0x20e5('0x11')]('/',auth[_0x20e5('0xb')](),controller[_0x20e5('0x12')]);router[_0x20e5('0x13')](_0x20e5('0xf'),auth[_0x20e5('0xb')](),controller[_0x20e5('0x14')]);module[_0x20e5('0x15')]=router; \ No newline at end of file +var _0x45df=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','exports','multer','connect-timeout','Router'];(function(_0x4bcb31,_0xd8a678){var _0x43a7ed=function(_0x2f7ba9){while(--_0x2f7ba9){_0x4bcb31['push'](_0x4bcb31['shift']());}};_0x43a7ed(++_0xd8a678);}(_0x45df,0x11a));var _0xf45d=function(_0x42a985,_0x299b0c){_0x42a985=_0x42a985-0x0;var _0x27ec28=_0x45df[_0x42a985];return _0x27ec28;};'use strict';var multer=require(_0xf45d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf45d('0x1'));var express=require('express');var router=express[_0xf45d('0x2')]();var fs_extra=require(_0xf45d('0x3'));var auth=require(_0xf45d('0x4'));var interaction=require(_0xf45d('0x5'));var config=require(_0xf45d('0x6'));var controller=require(_0xf45d('0x7'));router[_0xf45d('0x8')]('/',auth['isAuthenticated'](),controller[_0xf45d('0x9')]);router[_0xf45d('0x8')](_0xf45d('0xa'),auth['isAuthenticated'](),controller[_0xf45d('0xb')]);router['get'](_0xf45d('0xc'),auth[_0xf45d('0xd')](),controller[_0xf45d('0xe')]);router[_0xf45d('0xf')]('/',auth[_0xf45d('0xd')](),controller['create']);router[_0xf45d('0x10')](_0xf45d('0xc'),auth[_0xf45d('0xd')](),controller[_0xf45d('0x11')]);module[_0xf45d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 2c2662e..51b8abd 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 _0xbe02=['name','exports','STRING'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xbe02,0x124));var _0x2be0=function(_0x22e1e8,_0x4a4a48){_0x22e1e8=_0x22e1e8-0x0;var _0x21dc65=_0xbe02[_0x22e1e8];return _0x21dc65;};'use strict';var Sequelize=require('sequelize');module[_0x2be0('0x0')]={'name':{'type':Sequelize[_0x2be0('0x1')],'unique':_0x2be0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x269f=['STRING','sequelize','exports'];(function(_0x44a329,_0x45f280){var _0x45f2a3=function(_0x272e62){while(--_0x272e62){_0x44a329['push'](_0x44a329['shift']());}};_0x45f2a3(++_0x45f280);}(_0x269f,0xee));var _0xf269=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x269f[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xf269('0x0'));module[_0xf269('0x1')]={'name':{'type':Sequelize[_0xf269('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf269('0x2')]},'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 397ec60..aa72cb2 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 _0xed08=['isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','error','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./cmList.socket','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','stack','name','index','CmList','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','ListId','Disposition','getDispositions','findOne','merge','rows','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','dataValues','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString'];(function(_0x2028e6,_0x1fe638){var _0x4b74ef=function(_0x493b61){while(--_0x493b61){_0x2028e6['push'](_0x2028e6['shift']());}};_0x4b74ef(++_0x1fe638);}(_0xed08,0x176));var _0x8ed0=function(_0x549f1b,_0x501148){_0x549f1b=_0x549f1b-0x0;var _0x1f801c=_0xed08[_0x549f1b];return _0x1f801c;};'use strict';var emlformat=require(_0x8ed0('0x0'));var rimraf=require(_0x8ed0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ed0('0x2'));var rp=require(_0x8ed0('0x3'));var moment=require('moment');var BPromise=require(_0x8ed0('0x4'));var Mustache=require(_0x8ed0('0x5'));var util=require(_0x8ed0('0x6'));var path=require('path');var sox=require(_0x8ed0('0x7'));var csv=require(_0x8ed0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ed0('0x9'));var squel=require(_0x8ed0('0xa'));var crypto=require(_0x8ed0('0xb'));var jsforce=require(_0x8ed0('0xc'));var deskjs=require(_0x8ed0('0xd'));var toCsv=require(_0x8ed0('0x8'));var querystring=require(_0x8ed0('0xe'));var Papa=require(_0x8ed0('0xf'));var Redis=require('ioredis');var authService=require(_0x8ed0('0x10'));var qs=require(_0x8ed0('0x11'));var as=require(_0x8ed0('0x12'));var hardwareService=require(_0x8ed0('0x13'));var logger=require(_0x8ed0('0x14'))(_0x8ed0('0x15'));var utils=require(_0x8ed0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ed0('0x17'));var db=require(_0x8ed0('0x18'))['db'];var csv_results;config['redis']=_[_0x8ed0('0x19')](config[_0x8ed0('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ed0('0x1b'))['register'](socket);function respondWithStatusCode(_0x4be0bf,_0x35cf4a){_0x35cf4a=_0x35cf4a||0xcc;return function(_0x331203){if(_0x331203){return _0x4be0bf['sendStatus'](_0x35cf4a);}return _0x4be0bf[_0x8ed0('0x1c')](_0x35cf4a)[_0x8ed0('0x1d')]();};}function respondWithResult(_0x12a976,_0x5c0b0c){_0x5c0b0c=_0x5c0b0c||0xc8;return function(_0x1fb12b){if(_0x1fb12b){return _0x12a976[_0x8ed0('0x1c')](_0x5c0b0c)[_0x8ed0('0x1e')](_0x1fb12b);}};}function respondWithFilteredResult(_0x42deb5,_0x46cf92){return function(_0x15cbb5){if(_0x15cbb5){var _0x475bc6=typeof _0x46cf92[_0x8ed0('0x1f')]===_0x8ed0('0x20')&&typeof _0x46cf92[_0x8ed0('0x21')]==='undefined';var _0x5a98b2=_0x15cbb5[_0x8ed0('0x22')];var _0x2023d2=_0x475bc6?0x0:_0x46cf92[_0x8ed0('0x1f')];var _0x1774dc=_0x475bc6?_0x15cbb5['count']:_0x46cf92[_0x8ed0('0x1f')]+_0x46cf92[_0x8ed0('0x21')];var _0x31b122;if(_0x1774dc>=_0x5a98b2){_0x1774dc=_0x5a98b2;_0x31b122=0xc8;}else{_0x31b122=0xce;}_0x42deb5[_0x8ed0('0x1c')](_0x31b122);return _0x42deb5[_0x8ed0('0x23')]('Content-Range',_0x2023d2+'-'+_0x1774dc+'/'+_0x5a98b2)[_0x8ed0('0x1e')](_0x15cbb5);}return null;};}function patchUpdates(_0x284772){return function(_0x43014f){try{jsonpatch[_0x8ed0('0x24')](_0x43014f,_0x284772,!![]);}catch(_0x3badf2){return BPromise[_0x8ed0('0x25')](_0x3badf2);}return _0x43014f[_0x8ed0('0x26')]();};}function saveUpdates(_0x2c64c8,_0xf94940){return function(_0x108501){if(_0x108501){return _0x108501[_0x8ed0('0x27')](_0x2c64c8)[_0x8ed0('0x28')](function(_0xd738b8){return _0xd738b8;});}return null;};}function removeEntity(_0x90da62,_0x378f1e){return function(_0x56d30d){if(_0x56d30d){return _0x56d30d[_0x8ed0('0x29')]()[_0x8ed0('0x28')](function(){var _0x4712f3=_0x56d30d[_0x8ed0('0x2a')]({'plain':!![]});var _0x3dd633=_0x8ed0('0x2b');return db[_0x8ed0('0x2c')][_0x8ed0('0x29')]({'where':{'type':_0x3dd633,'resourceId':_0x4712f3['id']}})['then'](function(){return _0x56d30d;});})['then'](function(){_0x90da62[_0x8ed0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27d9cc,_0x2b2020){return function(_0x1a7428){if(!_0x1a7428){_0x27d9cc[_0x8ed0('0x2d')](0x194);}return _0x1a7428;};}function handleError(_0x5c6198,_0x35d705){_0x35d705=_0x35d705||0x1f4;return function(_0x57fba0){logger['error'](_0x57fba0[_0x8ed0('0x2e')]);if(_0x57fba0[_0x8ed0('0x2f')]){delete _0x57fba0[_0x8ed0('0x2f')];}_0x5c6198[_0x8ed0('0x1c')](_0x35d705)['send'](_0x57fba0);};}exports[_0x8ed0('0x30')]=function(_0x208664,_0x261428){var _0x5bf1ca={},_0x21c685={},_0x47b149={'count':0x0,'rows':[]};var _0x1a3d0a=_['map'](db[_0x8ed0('0x31')][_0x8ed0('0x32')],function(_0xe07d7d){return{'name':_0xe07d7d[_0x8ed0('0x33')],'type':_0xe07d7d['type'][_0x8ed0('0x34')]};});_0x21c685['model']=_[_0x8ed0('0x35')](_0x1a3d0a,'name');_0x21c685[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x208664[_0x8ed0('0x36')]);_0x21c685[_0x8ed0('0x38')]=_[_0x8ed0('0x39')](_0x21c685[_0x8ed0('0x3a')],_0x21c685[_0x8ed0('0x36')]);_0x5bf1ca[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x21c685[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x208664[_0x8ed0('0x36')]['fields']));_0x5bf1ca['attributes']=_0x5bf1ca['attributes'][_0x8ed0('0x3d')]?_0x5bf1ca[_0x8ed0('0x3b')]:_0x21c685[_0x8ed0('0x3a')];if(!_0x208664[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0x5bf1ca[_0x8ed0('0x21')]=qs['limit'](_0x208664[_0x8ed0('0x36')]['limit']);_0x5bf1ca[_0x8ed0('0x1f')]=qs[_0x8ed0('0x1f')](_0x208664[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}_0x5bf1ca[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x208664[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x5bf1ca[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x208664['query'],_0x21c685[_0x8ed0('0x38')]),_0x1a3d0a);if(_0x208664['query'][_0x8ed0('0x44')]){_0x5bf1ca[_0x8ed0('0x42')]=_['merge'](_0x5bf1ca['where'],{'$or':_[_0x8ed0('0x35')](_0x1a3d0a,function(_0x2e382b){if(_0x2e382b[_0x8ed0('0x45')]!==_0x8ed0('0x46')){var _0x2dccb1={};_0x2dccb1[_0x2e382b[_0x8ed0('0x2f')]]={'$like':'%'+_0x208664[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x2dccb1;}})});}_0x5bf1ca=_['merge']({},_0x5bf1ca,_0x208664[_0x8ed0('0x47')]);var _0x5c4269={'where':_0x5bf1ca['where']};return db[_0x8ed0('0x31')][_0x8ed0('0x22')](_0x5c4269)[_0x8ed0('0x28')](function(_0x20a6fa){_0x47b149['count']=_0x20a6fa;if(_0x208664[_0x8ed0('0x36')][_0x8ed0('0x48')]){_0x5bf1ca['include']=[{'all':!![]}];}return db[_0x8ed0('0x31')][_0x8ed0('0x49')](_0x5bf1ca);})[_0x8ed0('0x28')](function(_0x2a18c0){_0x47b149['rows']=_0x2a18c0;return _0x47b149;})[_0x8ed0('0x28')](respondWithFilteredResult(_0x261428,_0x5bf1ca))[_0x8ed0('0x4a')](handleError(_0x261428,null));};exports[_0x8ed0('0x4b')]=function(_0x3aa56a,_0x1557d0){var _0x37ac73={'raw':![],'where':{'id':_0x3aa56a[_0x8ed0('0x4c')]['id']}},_0x548ac0={};_0x548ac0['model']=_[_0x8ed0('0x37')](db[_0x8ed0('0x31')][_0x8ed0('0x32')]);_0x548ac0['query']=_[_0x8ed0('0x37')](_0x3aa56a['query']);_0x548ac0[_0x8ed0('0x38')]=_['intersection'](_0x548ac0[_0x8ed0('0x3a')],_0x548ac0[_0x8ed0('0x36')]);_0x37ac73[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x548ac0[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x3aa56a[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x37ac73[_0x8ed0('0x3b')]=_0x37ac73[_0x8ed0('0x3b')]['length']?_0x37ac73[_0x8ed0('0x3b')]:_0x548ac0['model'];if(_0x3aa56a[_0x8ed0('0x36')][_0x8ed0('0x48')]){_0x37ac73[_0x8ed0('0x4d')]=[{'all':!![]}];}_0x37ac73=_['merge']({},_0x37ac73,_0x3aa56a['options']);return db[_0x8ed0('0x31')][_0x8ed0('0x4e')](_0x37ac73)[_0x8ed0('0x28')](handleEntityNotFound(_0x1557d0,null))[_0x8ed0('0x28')](respondWithResult(_0x1557d0,null))[_0x8ed0('0x4a')](handleError(_0x1557d0,null));};exports[_0x8ed0('0x4f')]=function(_0x1fae36,_0x3e9d28){return db[_0x8ed0('0x31')][_0x8ed0('0x4f')](_0x1fae36[_0x8ed0('0x50')],{})[_0x8ed0('0x28')](function(_0x1ed637){var _0x61bef0=_0x1fae36[_0x8ed0('0x51')][_0x8ed0('0x2a')]({'plain':!![]});if(!_0x61bef0)throw new Error(_0x8ed0('0x52'));if(_0x61bef0[_0x8ed0('0x53')]===_0x8ed0('0x51')){var _0x3e6a04=_0x1ed637[_0x8ed0('0x2a')]({'plain':!![]});var _0xa18e9e='Lists';return db[_0x8ed0('0x54')]['find']({'where':{'name':_0xa18e9e,'userProfileId':_0x61bef0[_0x8ed0('0x55')]},'raw':!![]})[_0x8ed0('0x28')](function(_0x4f4cd6){if(_0x4f4cd6&&_0x4f4cd6['autoAssociation']===0x0){return db[_0x8ed0('0x2c')][_0x8ed0('0x4f')]({'name':_0x3e6a04[_0x8ed0('0x2f')],'resourceId':_0x3e6a04['id'],'type':_0x4f4cd6[_0x8ed0('0x2f')],'sectionId':_0x4f4cd6['id']},{})[_0x8ed0('0x28')](function(){return _0x1ed637;});}else{return _0x1ed637;}})['catch'](function(_0x12ba14){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12ba14);throw _0x12ba14;});}return _0x1ed637;})[_0x8ed0('0x28')](respondWithResult(_0x3e9d28,0xc9))[_0x8ed0('0x4a')](handleError(_0x3e9d28,null));};exports['update']=function(_0x249b5f,_0x51d9cc){if(_0x249b5f[_0x8ed0('0x50')]['id']){delete _0x249b5f[_0x8ed0('0x50')]['id'];}return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x249b5f[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x51d9cc,null))['then'](saveUpdates(_0x249b5f['body'],null))['then'](respondWithResult(_0x51d9cc,null))[_0x8ed0('0x4a')](handleError(_0x51d9cc,null));};exports['destroy']=function(_0x2e6b3e,_0x30ceac){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x2e6b3e[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x30ceac,null))[_0x8ed0('0x28')](removeEntity(_0x30ceac,null))['catch'](handleError(_0x30ceac,null));};exports[_0x8ed0('0x56')]=function(_0x13371c,_0x3249d9){return db[_0x8ed0('0x31')][_0x8ed0('0x56')]()[_0x8ed0('0x28')](respondWithResult(_0x3249d9,null))[_0x8ed0('0x4a')](handleError(_0x3249d9,null));};exports[_0x8ed0('0x57')]=function(_0xa48e04,_0x3862b7,_0x1e4caf){if(_0xa48e04[_0x8ed0('0x50')]['id']){delete _0xa48e04[_0x8ed0('0x50')]['id'];}return db['CmList'][_0x8ed0('0x4e')]({'where':{'id':_0xa48e04['params']['id']}})['then'](handleEntityNotFound(_0x3862b7,null))[_0x8ed0('0x28')](function(_0x9aef68){if(_0x9aef68){_0xa48e04[_0x8ed0('0x50')][_0x8ed0('0x58')]=_0x9aef68['id'];return db[_0x8ed0('0x59')]['create'](_0xa48e04[_0x8ed0('0x50')]);}})[_0x8ed0('0x28')](respondWithResult(_0x3862b7,null))[_0x8ed0('0x4a')](handleError(_0x3862b7,null));};exports[_0x8ed0('0x5a')]=function(_0x4d7a2d,_0x372a63,_0x5af2af){var _0x1d1557={'raw':![],'where':{}};var _0xa4cd88={};var _0x37d544={'count':0x0,'rows':[]};return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x4d7a2d[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x372a63,null))[_0x8ed0('0x28')](function(_0x4bd0f8){if(_0x4bd0f8){_0xa4cd88[_0x8ed0('0x3a')]=_['keys'](db[_0x8ed0('0x59')][_0x8ed0('0x32')]);_0xa4cd88[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x4d7a2d[_0x8ed0('0x36')]);_0xa4cd88[_0x8ed0('0x38')]=_[_0x8ed0('0x39')](_0xa4cd88[_0x8ed0('0x3a')],_0xa4cd88[_0x8ed0('0x36')]);_0x1d1557['attributes']=_[_0x8ed0('0x39')](_0xa4cd88['model'],qs[_0x8ed0('0x3c')](_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x1d1557['attributes']=_0x1d1557[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x1d1557[_0x8ed0('0x3b')]:_0xa4cd88['model'];if(!_0x4d7a2d[_0x8ed0('0x36')]['hasOwnProperty']('nolimit')){_0x1d1557[_0x8ed0('0x21')]=qs['limit'](_0x4d7a2d[_0x8ed0('0x36')]['limit']);_0x1d1557[_0x8ed0('0x1f')]=qs[_0x8ed0('0x1f')](_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}_0x1d1557['order']=qs[_0x8ed0('0x41')](_0x4d7a2d[_0x8ed0('0x36')]['sort']);_0x1d1557['where']=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x4d7a2d['query'],_0xa4cd88[_0x8ed0('0x38')]));_0x1d1557[_0x8ed0('0x42')][_0x8ed0('0x58')]=_0x4bd0f8['id'];if(_0x4d7a2d['query']['filter']){_0x1d1557[_0x8ed0('0x42')]=_[_0x8ed0('0x5c')](_0x1d1557[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0x1d1557[_0x8ed0('0x3b')],function(_0x1c224a){var _0x509952={};_0x509952[_0x1c224a]={'$like':'%'+_0x4d7a2d[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x509952;})});}_0x1d1557=_['merge']({},_0x1d1557,_0x4d7a2d[_0x8ed0('0x47')]);return db[_0x8ed0('0x59')][_0x8ed0('0x22')]({'where':_0x1d1557[_0x8ed0('0x42')]})[_0x8ed0('0x28')](function(_0x4f7cdd){_0x37d544['count']=_0x4f7cdd;if(_0x4d7a2d['query'][_0x8ed0('0x48')]){_0x1d1557[_0x8ed0('0x4d')]=[{'all':!![]}];}return db[_0x8ed0('0x59')][_0x8ed0('0x49')](_0x1d1557);})[_0x8ed0('0x28')](function(_0x287b4a){_0x37d544[_0x8ed0('0x5d')]=_0x287b4a;return _0x37d544;});}})[_0x8ed0('0x28')](respondWithFilteredResult(_0x372a63,_0x1d1557))['catch'](handleError(_0x372a63,null));};exports['removeDispositions']=function(_0x1ae1c1,_0xb4aacc,_0x2bd4b2){return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x1ae1c1[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb4aacc,null))[_0x8ed0('0x28')](function(_0x31fe01){if(_0x31fe01){return _0x31fe01['removeDispositions'](_0x1ae1c1[_0x8ed0('0x36')][_0x8ed0('0x5e')]);}})[_0x8ed0('0x28')](respondWithStatusCode(_0xb4aacc,null))[_0x8ed0('0x4a')](handleError(_0xb4aacc,null));};exports[_0x8ed0('0x5f')]=function(_0x5c0bd7,_0x823b34,_0xc6c55d){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x5c0bd7['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x823b34,null))[_0x8ed0('0x28')](function(_0x587a84){if(_0x587a84){var _0x4f96ff=[];var _0x25f00d={'success':[],'errors':[]};return db[_0x8ed0('0x60')][_0x8ed0('0x56')]()[_0x8ed0('0x28')](function(_0x42d9dd){if(_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]&&_['isArray'](_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')])){if(_0x5c0bd7['body'][_0x8ed0('0x61')][_0x8ed0('0x3d')]){_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')][_0x8ed0('0x62')](';')+';';}else{_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=null;}}else{_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x61')]=null;}if(_0x5c0bd7[_0x8ed0('0x50')]&&_[_0x8ed0('0x63')](_0x5c0bd7[_0x8ed0('0x50')])){for(var _0x2e03ba=0x0;_0x2e03ba<_0x5c0bd7[_0x8ed0('0x50')][_0x8ed0('0x3d')];_0x2e03ba+=0x1){_0x5c0bd7[_0x8ed0('0x50')][_0x2e03ba][_0x8ed0('0x58')]=_0x5c0bd7[_0x8ed0('0x4c')]['id'];_0x4f96ff[_0x8ed0('0x64')](_0x5c0bd7[_0x8ed0('0x50')][_0x2e03ba]);}return BPromise[_0x8ed0('0x65')](_0x4f96ff,function(_0x3ccb2d){return db['CmContact']['create'](_[_0x8ed0('0x66')](_0x3ccb2d,['ids','id'])||{},{'fields':_[_0x8ed0('0x37')](_0x42d9dd),'raw':!![]})['then'](function(_0x1838af){_0x25f00d['success'][_0x8ed0('0x64')](_0x1838af[_0x8ed0('0x67')]);})[_0x8ed0('0x4a')](function(_0x3d7b7b){_0x25f00d['errors'][_0x8ed0('0x64')]({'data':_0x3ccb2d,'error':_0x3d7b7b[_0x8ed0('0x68')]});});})[_0x8ed0('0x28')](function(_0x434393){return _0x25f00d;})[_0x8ed0('0x4a')](function(_0x2f3f32){return _0x2f3f32;});}else{_0x823b34['status'](0x190)[_0x8ed0('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x8ed0('0x28')](respondWithResult(_0x823b34,null))[_0x8ed0('0x4a')](handleError(_0x823b34,null));};exports[_0x8ed0('0x69')]=function(_0x40bab2,_0x230cfc,_0x421579){var _0x4acd9b;return db[_0x8ed0('0x31')][_0x8ed0('0x4e')]({'where':{'id':_0x40bab2[_0x8ed0('0x4c')]['id']},'include':[{'model':db[_0x8ed0('0x6a')],'as':_0x8ed0('0x6b')}]})[_0x8ed0('0x28')](handleEntityNotFound(_0x230cfc,null))[_0x8ed0('0x28')](function(_0x52ac83){if(_0x52ac83){_0x4acd9b=_0x52ac83;return db[_0x8ed0('0x60')][_0x8ed0('0x32')];}})[_0x8ed0('0x28')](function(_0x460006){if(_0x460006){var _0xdbea04={};var _0x104e20={};_0x104e20[_0x8ed0('0x3a')]=_[_0x8ed0('0x6c')](_[_0x8ed0('0x37')](_0x460006),_[_0x8ed0('0x35')](_0x4acd9b[_0x8ed0('0x6b')],function(_0x2b2450){return util[_0x8ed0('0x6d')](_0x8ed0('0x6e'),_0x2b2450['id']);}));_0x104e20['query']=_[_0x8ed0('0x37')](_0x40bab2[_0x8ed0('0x36')]);_0x104e20['filters']=_[_0x8ed0('0x39')](_0x104e20[_0x8ed0('0x3a')],_0x104e20[_0x8ed0('0x36')]);_0xdbea04[_0x8ed0('0x3b')]=_['intersection'](_0x104e20[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x40bab2[_0x8ed0('0x36')]['fields']));_0xdbea04[_0x8ed0('0x3b')]=_0xdbea04['attributes'][_0x8ed0('0x3d')]?_0xdbea04[_0x8ed0('0x3b')]:_0x104e20['model'];if(!_0x40bab2[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0xdbea04[_0x8ed0('0x21')]=qs['limit'](_0x40bab2[_0x8ed0('0x36')][_0x8ed0('0x21')]);_0xdbea04['offset']=qs[_0x8ed0('0x1f')](_0x40bab2['query'][_0x8ed0('0x1f')]);}_0xdbea04[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x40bab2['query'][_0x8ed0('0x41')]);_0xdbea04[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_['pick'](_0x40bab2[_0x8ed0('0x36')],_0x104e20[_0x8ed0('0x38')]));_0xdbea04[_0x8ed0('0x6f')]=!![];if(_0x40bab2[_0x8ed0('0x36')]['filter']){_0xdbea04[_0x8ed0('0x42')]=_[_0x8ed0('0x5c')](_0xdbea04[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0xdbea04[_0x8ed0('0x3b')],function(_0x2bfcda){var _0x1341cc={};_0x1341cc[_0x2bfcda]={'$like':'%'+_0x40bab2[_0x8ed0('0x36')]['filter']+'%'};return _0x1341cc;})});}_0xdbea04=_['merge']({},_0xdbea04,_0x40bab2[_0x8ed0('0x47')]);return _0x4acd9b[_0x8ed0('0x69')](_0xdbea04);}})[_0x8ed0('0x28')](respondWithResult(_0x230cfc,null))[_0x8ed0('0x4a')](handleError(_0x230cfc,null));};exports['getContactsCsv']=function(_0x217e7a,_0x2c93f4,_0x1c0879){var _0xc04951;var _0x1e7d93;var _0x3bac45;var _0x4d7c7c=_0x217e7a['params']['id'];csv_results=[];return db['ContactItemType'][_0x8ed0('0x49')]({'attributes':['id',_0x8ed0('0x2f')],'raw':!![],'order':[_0x8ed0('0x70')]})['then'](function(_0x1b1406){_0xc04951=_0x1b1406;var _0x37a2d2=_[_0x8ed0('0x37')](db[_0x8ed0('0x60')][_0x8ed0('0x32')]);return db[_0x8ed0('0x6a')][_0x8ed0('0x49')]({'raw':!![],'attributes':['id',_0x8ed0('0x71')]})['then'](function(_0x3857c2){_0x1e7d93=_0x3857c2;var _0x58d1b2=squel[_0x8ed0('0x72')]()['fields'](_0x37a2d2)[_0x8ed0('0x73')]('cm_contacts','c')['where'](_0x8ed0('0x74'),_0x4d7c7c)[_0x8ed0('0x42')](_0x8ed0('0x75'))[_0x8ed0('0x76')]();for(var _0x19a46c=0x0;_0x19a46c<_0x1e7d93[_0x8ed0('0x3d')];_0x19a46c++){_0x58d1b2[_0x8ed0('0x77')](_0x8ed0('0x78')+_0x1e7d93[_0x19a46c]['id'],_0x8ed0('0x79')+_0x1e7d93[_0x19a46c][_0x8ed0('0x71')]);}for(var _0x19a46c=0x0;_0x19a46c<_0xc04951[_0x8ed0('0x3d')];_0x19a46c++){_0x58d1b2['field'](squel[_0x8ed0('0x72')]()['field'](_0x8ed0('0x7a'))[_0x8ed0('0x73')](_0x8ed0('0x7b'))[_0x8ed0('0x42')](_0x8ed0('0x7c'),_0xc04951[_0x19a46c]['id'])[_0x8ed0('0x42')]('CmContactId\x20=\x20c.id'),_0x8ed0('0x7d')+_0xc04951[_0x19a46c]['name']);_0x58d1b2[_0x8ed0('0x77')](squel[_0x8ed0('0x72')]()['field'](_0x8ed0('0x7e'))[_0x8ed0('0x73')](_0x8ed0('0x7b'))['where']('ItemTypeId\x20=\x20?',_0xc04951[_0x19a46c]['id'])[_0x8ed0('0x42')](_0x8ed0('0x7f')),_0x8ed0('0x80')+_0xc04951[_0x19a46c][_0x8ed0('0x2f')]);}var _0x36e0f7=[];_0x36e0f7[_0x8ed0('0x64')](_0x58d1b2[_0x8ed0('0x81')]());BPromise[_0x8ed0('0x65')](_0x36e0f7,handleQuery)[_0x8ed0('0x28')](function(_0x55fb93){handleQuery(_0x58d1b2[_0x8ed0('0x81')]());var _0x4a8229=csv_results[0x0];if(!_[_0x8ed0('0x82')](_0x4a8229)){var _0x573725=toCsv(_0x4a8229);var _0x2a18c7=Date[_0x8ed0('0x83')]();fs[_0x8ed0('0x84')](util[_0x8ed0('0x6d')](_0x8ed0('0x85'),_0x4d7c7c,_0x2a18c7),_0x573725);_0x2c93f4[_0x8ed0('0x86')](_0x8ed0('0x87'),_0x8ed0('0x88')+util['format'](_0x8ed0('0x89'),_0x4d7c7c,_0x2a18c7));_0x2c93f4['setHeader'](_0x8ed0('0x8a'),_0x8ed0('0x8b'));return _0x2c93f4['download'](util[_0x8ed0('0x6d')](_0x8ed0('0x85'),_0x4d7c7c,_0x2a18c7));}else{return _0x2c93f4['sendStatus'](0xcc);}});});});};exports[_0x8ed0('0x8c')]=function(_0x93fcc2,_0x33e23c,_0x20b3fe){var _0x404e5d;delete _0x93fcc2['body']['id'];return db['CmList'][_0x8ed0('0x5b')]({'where':{'id':_0x93fcc2[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x33e23c,null))[_0x8ed0('0x28')](function(_0x39a987){if(_0x39a987){return db[_0x8ed0('0x8d')][_0x8ed0('0x8e')](function(_0x523c62){return db['CmCustomField']['create'](_0x93fcc2['body'],{'transaction':_0x523c62})['then'](function(_0x58f2ae){_0x404e5d=_0x58f2ae;return _0x39a987[_0x8ed0('0x8f')](_0x58f2ae,{'transaction':_0x523c62});})[_0x8ed0('0x28')](function(){var _0x504c2e={'type':db[_0x8ed0('0x90')]['TEXT'],'transaction':_0x523c62};switch(_0x93fcc2[_0x8ed0('0x50')]['type']){case'text':_0x504c2e[_0x8ed0('0x45')]=db['Sequelize'][_0x8ed0('0x91')];break;case _0x8ed0('0x92'):_0x504c2e[_0x8ed0('0x45')]=db[_0x8ed0('0x90')][_0x8ed0('0x93')];break;case _0x8ed0('0x94'):_0x504c2e[_0x8ed0('0x45')]=db['Sequelize'][_0x8ed0('0x95')];_0x504c2e[_0x8ed0('0x96')]=![];break;default:}return db[_0x8ed0('0x8d')][_0x8ed0('0x97')][_0x8ed0('0x98')](_0x8ed0('0x99'),util['format'](_0x8ed0('0x9a'),_0x404e5d['id']),_0x504c2e);})[_0x8ed0('0x28')](function(){return _0x404e5d;});});}})[_0x8ed0('0x28')](respondWithResult(_0x33e23c,null))['catch'](handleError(_0x33e23c,null));};exports[_0x8ed0('0x9b')]=function(_0x3f7b1a,_0x74c893,_0x296822){var _0x56863a={};var _0x1a021c={};var _0x298960;var _0x31bab0;return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x3f7b1a[_0x8ed0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x74c893,null))[_0x8ed0('0x28')](function(_0x5e9ddb){if(_0x5e9ddb){_0x298960=_0x5e9ddb;_0x1a021c['model']=_[_0x8ed0('0x37')](db[_0x8ed0('0x6a')][_0x8ed0('0x32')]);_0x1a021c[_0x8ed0('0x36')]=_['keys'](_0x3f7b1a[_0x8ed0('0x36')]);_0x1a021c[_0x8ed0('0x38')]=_['intersection'](_0x1a021c[_0x8ed0('0x3a')],_0x1a021c['query']);_0x56863a['attributes']=_[_0x8ed0('0x39')](_0x1a021c[_0x8ed0('0x3a')],qs[_0x8ed0('0x3c')](_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x3c')]));_0x56863a[_0x8ed0('0x3b')]=_0x56863a[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x56863a['attributes']:_0x1a021c[_0x8ed0('0x3a')];_0x56863a[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x56863a[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x3f7b1a[_0x8ed0('0x36')],_0x1a021c[_0x8ed0('0x38')]));_0x56863a['where']=_[_0x8ed0('0x5c')](_0x56863a['where'],{'$or':[{'ListId':_0x5e9ddb['id']},{'ListId':null}]});if(_0x3f7b1a[_0x8ed0('0x36')]['filter']){_0x56863a[_0x8ed0('0x42')]=_['merge'](_0x56863a[_0x8ed0('0x42')],{'$or':_[_0x8ed0('0x35')](_0x56863a[_0x8ed0('0x3b')],function(_0x54f734){var _0x486353={};_0x486353[_0x54f734]={'$like':'%'+_0x3f7b1a[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x486353;})});}_0x56863a=_[_0x8ed0('0x5c')]({},_0x56863a,_0x3f7b1a['options']);return db[_0x8ed0('0x6a')]['findAndCountAll'](_0x56863a);}})[_0x8ed0('0x28')](respondWithResult(_0x74c893,null))[_0x8ed0('0x4a')](handleError(_0x74c893,null));};exports[_0x8ed0('0x9c')]=function(_0x80c04a,_0x38df0d){return db['CmCustomField'][_0x8ed0('0x9d')]({'where':{'ListId':null}})[_0x8ed0('0x28')](handleEntityNotFound(_0x38df0d,null))[_0x8ed0('0x28')](function(_0x4fba9e){return _0x4fba9e;})[_0x8ed0('0x28')](respondWithResult(_0x38df0d,null))[_0x8ed0('0x4a')](handleError(_0x38df0d,null));};exports[_0x8ed0('0x9e')]=function(_0x33f4fc,_0x422ae9,_0x14a2ff){return db['CmList'][_0x8ed0('0x4e')]({'where':{'id':_0x33f4fc[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x422ae9,null))[_0x8ed0('0x28')](function(_0x2b99d2){if(_0x2b99d2){return _0x2b99d2['addAgents'](_0x33f4fc[_0x8ed0('0x50')][_0x8ed0('0x5e')],_['omit'](_0x33f4fc['body'],[_0x8ed0('0x5e'),'id'])||{})[_0x8ed0('0x9f')](function(_0x3aad4b){for(var _0x5d53b3=0x0;_0x5d53b3<_0x33f4fc[_0x8ed0('0x50')][_0x8ed0('0x5e')][_0x8ed0('0x3d')];_0x5d53b3+=0x1){socket[_0x8ed0('0xa0')](_0x8ed0('0xa1'),{'UserId':Number(_0x33f4fc[_0x8ed0('0x50')]['ids'][_0x5d53b3]),'CmListId':Number(_0x33f4fc[_0x8ed0('0x4c')]['id'])});}return _0x3aad4b;});}})[_0x8ed0('0x28')](respondWithResult(_0x422ae9,null))['catch'](handleError(_0x422ae9,null));};exports[_0x8ed0('0xa2')]=function(_0x2df73f,_0x491c05,_0x18591a){return db[_0x8ed0('0x31')]['find']({'where':{'id':_0x2df73f[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x491c05,null))[_0x8ed0('0x28')](function(_0x1d3ce0){if(_0x1d3ce0){return _0x1d3ce0['removeAgents'](_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')])[_0x8ed0('0x28')](function(){if(_[_0x8ed0('0x63')](_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')])){for(var _0x47922c=0x0;_0x47922c<_0x2df73f[_0x8ed0('0x36')][_0x8ed0('0x5e')]['length'];_0x47922c+=0x1){socket[_0x8ed0('0xa0')](_0x8ed0('0xa3'),{'UserId':Number(_0x2df73f['query'][_0x8ed0('0x5e')][_0x47922c]),'CmListId':Number(_0x2df73f['params']['id'])});}}else{socket[_0x8ed0('0xa0')](_0x8ed0('0xa3'),{'UserId':Number(_0x2df73f[_0x8ed0('0x36')]['ids']),'CmListId':Number(_0x2df73f[_0x8ed0('0x4c')]['id'])});}});}})[_0x8ed0('0x28')](respondWithStatusCode(_0x491c05,null))[_0x8ed0('0x4a')](handleError(_0x491c05,null));};exports[_0x8ed0('0xa4')]=function(_0x141ac0,_0x108249,_0xdbe533){var _0x28f229={};var _0x371172={};var _0x323d3b;var _0x11e1ed;return db[_0x8ed0('0x31')][_0x8ed0('0x5b')]({'where':{'id':_0x141ac0[_0x8ed0('0x4c')]['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x108249,null))[_0x8ed0('0x28')](function(_0x1ba987){if(_0x1ba987){_0x323d3b=_0x1ba987;_0x371172[_0x8ed0('0x3a')]=_[_0x8ed0('0x37')](db[_0x8ed0('0xa5')][_0x8ed0('0x32')]);_0x371172[_0x8ed0('0x36')]=_[_0x8ed0('0x37')](_0x141ac0[_0x8ed0('0x36')]);_0x371172['filters']=_[_0x8ed0('0x39')](_0x371172['model'],_0x371172[_0x8ed0('0x36')]);_0x28f229[_0x8ed0('0x3b')]=_[_0x8ed0('0x39')](_0x371172['model'],qs[_0x8ed0('0x3c')](_0x141ac0['query'][_0x8ed0('0x3c')]));_0x28f229[_0x8ed0('0x3b')]=_0x28f229[_0x8ed0('0x3b')][_0x8ed0('0x3d')]?_0x28f229['attributes']:_0x371172[_0x8ed0('0x3a')];_0x28f229[_0x8ed0('0x40')]=qs[_0x8ed0('0x41')](_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x41')]);_0x28f229[_0x8ed0('0x42')]=qs[_0x8ed0('0x38')](_[_0x8ed0('0x43')](_0x141ac0[_0x8ed0('0x36')],_0x371172[_0x8ed0('0x38')]));if(_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x44')]){_0x28f229[_0x8ed0('0x42')]=_['merge'](_0x28f229['where'],{'$or':_[_0x8ed0('0x35')](_0x28f229['attributes'],function(_0x2f98be){var _0x406463={};_0x406463[_0x2f98be]={'$like':'%'+_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x44')]+'%'};return _0x406463;})});}_0x28f229=_['merge']({},_0x28f229,_0x141ac0[_0x8ed0('0x47')]);return _0x323d3b[_0x8ed0('0xa4')](_0x28f229);}})[_0x8ed0('0x28')](function(_0x21f274){if(_0x21f274){_0x11e1ed=_0x21f274[_0x8ed0('0x3d')];if(!_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x3e')](_0x8ed0('0x3f'))){_0x28f229['limit']=qs[_0x8ed0('0x21')](_0x141ac0[_0x8ed0('0x36')]['limit']);_0x28f229[_0x8ed0('0x1f')]=qs['offset'](_0x141ac0[_0x8ed0('0x36')][_0x8ed0('0x1f')]);}return _0x323d3b[_0x8ed0('0xa4')](_0x28f229);}})[_0x8ed0('0x28')](function(_0x46e4a4){if(_0x46e4a4){return _0x46e4a4?{'count':_0x11e1ed,'rows':_0x46e4a4}:null;}})[_0x8ed0('0x28')](respondWithResult(_0x108249,null))[_0x8ed0('0x4a')](handleError(_0x108249,null));};function handleQuery(_0x521378){logger[_0x8ed0('0xa6')](_0x521378);return db[_0x8ed0('0x8d')][_0x8ed0('0x36')](_0x521378)[_0x8ed0('0x9f')](function(_0x5cd4d7){csv_results[_0x8ed0('0x64')](_0x5cd4d7);})['catch'](function(_0x2b903b){logger[_0x8ed0('0xa7')](_0x2b903b['message']);});} \ No newline at end of file +var _0x4a7c=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','get','Lists','UserProfileResource','destroy','stack','name','index','map','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','CmList','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','message','CmCustomField','CustomFields','concat','raw','getContacts','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','c.cf_','customField_','field','item','additionalPhone_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','BOOLEAN','defaultValue','addColumn','format','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','error','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a7c,0x1e7));var _0xc4a7=function(_0x5bd4a8,_0x549358){_0x5bd4a8=_0x5bd4a8-0x0;var _0x3bfc4e=_0x4a7c[_0x5bd4a8];return _0x3bfc4e;};'use strict';var emlformat=require(_0xc4a7('0x0'));var rimraf=require(_0xc4a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4a7('0x2'));var moment=require(_0xc4a7('0x3'));var BPromise=require(_0xc4a7('0x4'));var Mustache=require(_0xc4a7('0x5'));var util=require('util');var path=require(_0xc4a7('0x6'));var sox=require(_0xc4a7('0x7'));var csv=require(_0xc4a7('0x8'));var ejs=require(_0xc4a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc4a7('0xa'));var crypto=require(_0xc4a7('0xb'));var jsforce=require(_0xc4a7('0xc'));var deskjs=require(_0xc4a7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4a7('0xe'));var Redis=require(_0xc4a7('0xf'));var authService=require(_0xc4a7('0x10'));var qs=require(_0xc4a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4a7('0x12'));var logger=require('../../config/logger')(_0xc4a7('0x13'));var utils=require(_0xc4a7('0x14'));var config=require(_0xc4a7('0x15'));var licenseUtil=require(_0xc4a7('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xc4a7('0x17')]=_[_0xc4a7('0x18')](config[_0xc4a7('0x17')],{'host':_0xc4a7('0x19'),'port':0x18eb});var socket=require(_0xc4a7('0x1a'))(new Redis(config['redis']));require(_0xc4a7('0x1b'))['register'](socket);function respondWithStatusCode(_0x576ed4,_0x409511){_0x409511=_0x409511||0xcc;return function(_0x13da79){if(_0x13da79){return _0x576ed4[_0xc4a7('0x1c')](_0x409511);}return _0x576ed4[_0xc4a7('0x1d')](_0x409511)[_0xc4a7('0x1e')]();};}function respondWithResult(_0x43f466,_0x494152){_0x494152=_0x494152||0xc8;return function(_0x156212){if(_0x156212){return _0x43f466[_0xc4a7('0x1d')](_0x494152)[_0xc4a7('0x1f')](_0x156212);}};}function respondWithFilteredResult(_0x522c21,_0x2e279f){return function(_0x3eeb5e){if(_0x3eeb5e){var _0x4cf074=typeof _0x2e279f['offset']===_0xc4a7('0x20')&&typeof _0x2e279f['limit']===_0xc4a7('0x20');var _0x33523f=_0x3eeb5e[_0xc4a7('0x21')];var _0x29dd04=_0x4cf074?0x0:_0x2e279f[_0xc4a7('0x22')];var _0x574678=_0x4cf074?_0x3eeb5e[_0xc4a7('0x21')]:_0x2e279f[_0xc4a7('0x22')]+_0x2e279f[_0xc4a7('0x23')];var _0x10a399;if(_0x574678>=_0x33523f){_0x574678=_0x33523f;_0x10a399=0xc8;}else{_0x10a399=0xce;}_0x522c21[_0xc4a7('0x1d')](_0x10a399);return _0x522c21['set'](_0xc4a7('0x24'),_0x29dd04+'-'+_0x574678+'/'+_0x33523f)[_0xc4a7('0x1f')](_0x3eeb5e);}return null;};}function patchUpdates(_0x314b45){return function(_0x2b61eb){try{jsonpatch['apply'](_0x2b61eb,_0x314b45,!![]);}catch(_0x39aa09){return BPromise[_0xc4a7('0x25')](_0x39aa09);}return _0x2b61eb[_0xc4a7('0x26')]();};}function saveUpdates(_0x3a1229,_0x13ea68){return function(_0x2d719f){if(_0x2d719f){return _0x2d719f[_0xc4a7('0x27')](_0x3a1229)['then'](function(_0xe0968b){return _0xe0968b;});}return null;};}function removeEntity(_0x3fbadf,_0x213a0d){return function(_0x4f830d){if(_0x4f830d){return _0x4f830d['destroy']()[_0xc4a7('0x28')](function(){var _0x38ab94=_0x4f830d[_0xc4a7('0x29')]({'plain':!![]});var _0x20b741=_0xc4a7('0x2a');return db[_0xc4a7('0x2b')][_0xc4a7('0x2c')]({'where':{'type':_0x20b741,'resourceId':_0x38ab94['id']}})['then'](function(){return _0x4f830d;});})[_0xc4a7('0x28')](function(){_0x3fbadf[_0xc4a7('0x1d')](0xcc)[_0xc4a7('0x1e')]();});}};}function handleEntityNotFound(_0x1b8bca,_0x49921e){return function(_0x3e10cc){if(!_0x3e10cc){_0x1b8bca[_0xc4a7('0x1c')](0x194);}return _0x3e10cc;};}function handleError(_0x5b5411,_0xac3727){_0xac3727=_0xac3727||0x1f4;return function(_0x4b39c5){logger['error'](_0x4b39c5[_0xc4a7('0x2d')]);if(_0x4b39c5[_0xc4a7('0x2e')]){delete _0x4b39c5[_0xc4a7('0x2e')];}_0x5b5411[_0xc4a7('0x1d')](_0xac3727)['send'](_0x4b39c5);};}exports[_0xc4a7('0x2f')]=function(_0x575cf,_0x2ea4be){var _0x1cd484={},_0x22e03e={},_0x47597d={'count':0x0,'rows':[]};var _0x48fb65=_[_0xc4a7('0x30')](db['CmList']['rawAttributes'],function(_0x46085c){return{'name':_0x46085c[_0xc4a7('0x31')],'type':_0x46085c['type']['key']};});_0x22e03e['model']=_[_0xc4a7('0x30')](_0x48fb65,_0xc4a7('0x2e'));_0x22e03e[_0xc4a7('0x32')]=_[_0xc4a7('0x33')](_0x575cf[_0xc4a7('0x32')]);_0x22e03e[_0xc4a7('0x34')]=_[_0xc4a7('0x35')](_0x22e03e[_0xc4a7('0x36')],_0x22e03e[_0xc4a7('0x32')]);_0x1cd484[_0xc4a7('0x37')]=_[_0xc4a7('0x35')](_0x22e03e[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x575cf[_0xc4a7('0x32')][_0xc4a7('0x38')]));_0x1cd484[_0xc4a7('0x37')]=_0x1cd484['attributes'][_0xc4a7('0x39')]?_0x1cd484[_0xc4a7('0x37')]:_0x22e03e[_0xc4a7('0x36')];if(!_0x575cf[_0xc4a7('0x32')][_0xc4a7('0x3a')](_0xc4a7('0x3b'))){_0x1cd484[_0xc4a7('0x23')]=qs[_0xc4a7('0x23')](_0x575cf['query'][_0xc4a7('0x23')]);_0x1cd484['offset']=qs['offset'](_0x575cf['query']['offset']);}_0x1cd484[_0xc4a7('0x3c')]=qs[_0xc4a7('0x3d')](_0x575cf['query']['sort']);_0x1cd484[_0xc4a7('0x3e')]=qs[_0xc4a7('0x34')](_[_0xc4a7('0x3f')](_0x575cf[_0xc4a7('0x32')],_0x22e03e[_0xc4a7('0x34')]),_0x48fb65);if(_0x575cf[_0xc4a7('0x32')][_0xc4a7('0x40')]){_0x1cd484['where']=_['merge'](_0x1cd484[_0xc4a7('0x3e')],{'$or':_[_0xc4a7('0x30')](_0x48fb65,function(_0x4409f4){if(_0x4409f4[_0xc4a7('0x41')]!==_0xc4a7('0x42')){var _0x26a13d={};_0x26a13d[_0x4409f4[_0xc4a7('0x2e')]]={'$like':'%'+_0x575cf[_0xc4a7('0x32')]['filter']+'%'};return _0x26a13d;}})});}_0x1cd484=_[_0xc4a7('0x43')]({},_0x1cd484,_0x575cf[_0xc4a7('0x44')]);var _0x1b14db={'where':_0x1cd484[_0xc4a7('0x3e')]};return db[_0xc4a7('0x45')]['count'](_0x1b14db)[_0xc4a7('0x28')](function(_0x3576c7){_0x47597d['count']=_0x3576c7;if(_0x575cf[_0xc4a7('0x32')][_0xc4a7('0x46')]){_0x1cd484[_0xc4a7('0x47')]=[{'all':!![]}];}return db[_0xc4a7('0x45')][_0xc4a7('0x48')](_0x1cd484);})[_0xc4a7('0x28')](function(_0x2c523d){_0x47597d[_0xc4a7('0x49')]=_0x2c523d;return _0x47597d;})[_0xc4a7('0x28')](respondWithFilteredResult(_0x2ea4be,_0x1cd484))['catch'](handleError(_0x2ea4be,null));};exports[_0xc4a7('0x4a')]=function(_0x1cfe13,_0x37f0e){var _0xffbbc3={'raw':![],'where':{'id':_0x1cfe13[_0xc4a7('0x4b')]['id']}},_0x2aec3c={};_0x2aec3c[_0xc4a7('0x36')]=_[_0xc4a7('0x33')](db[_0xc4a7('0x45')][_0xc4a7('0x4c')]);_0x2aec3c['query']=_[_0xc4a7('0x33')](_0x1cfe13['query']);_0x2aec3c['filters']=_[_0xc4a7('0x35')](_0x2aec3c['model'],_0x2aec3c[_0xc4a7('0x32')]);_0xffbbc3['attributes']=_[_0xc4a7('0x35')](_0x2aec3c[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x1cfe13[_0xc4a7('0x32')][_0xc4a7('0x38')]));_0xffbbc3[_0xc4a7('0x37')]=_0xffbbc3[_0xc4a7('0x37')][_0xc4a7('0x39')]?_0xffbbc3[_0xc4a7('0x37')]:_0x2aec3c[_0xc4a7('0x36')];if(_0x1cfe13[_0xc4a7('0x32')][_0xc4a7('0x46')]){_0xffbbc3[_0xc4a7('0x47')]=[{'all':!![]}];}_0xffbbc3=_[_0xc4a7('0x43')]({},_0xffbbc3,_0x1cfe13['options']);return db[_0xc4a7('0x45')][_0xc4a7('0x4d')](_0xffbbc3)[_0xc4a7('0x28')](handleEntityNotFound(_0x37f0e,null))[_0xc4a7('0x28')](respondWithResult(_0x37f0e,null))[_0xc4a7('0x4e')](handleError(_0x37f0e,null));};exports[_0xc4a7('0x4f')]=function(_0x5bb20c,_0x42998c){return db[_0xc4a7('0x45')][_0xc4a7('0x4f')](_0x5bb20c[_0xc4a7('0x50')],{})['then'](function(_0x20d19d){var _0x4ac0cf=_0x5bb20c[_0xc4a7('0x51')]['get']({'plain':!![]});if(!_0x4ac0cf)throw new Error(_0xc4a7('0x52'));if(_0x4ac0cf[_0xc4a7('0x53')]===_0xc4a7('0x51')){var _0x1f10d0=_0x20d19d[_0xc4a7('0x29')]({'plain':!![]});var _0x333af7=_0xc4a7('0x2a');return db[_0xc4a7('0x54')][_0xc4a7('0x4d')]({'where':{'name':_0x333af7,'userProfileId':_0x4ac0cf[_0xc4a7('0x55')]},'raw':!![]})[_0xc4a7('0x28')](function(_0x11f7b1){if(_0x11f7b1&&_0x11f7b1[_0xc4a7('0x56')]===0x0){return db['UserProfileResource'][_0xc4a7('0x4f')]({'name':_0x1f10d0[_0xc4a7('0x2e')],'resourceId':_0x1f10d0['id'],'type':_0x11f7b1[_0xc4a7('0x2e')],'sectionId':_0x11f7b1['id']},{})['then'](function(){return _0x20d19d;});}else{return _0x20d19d;}})[_0xc4a7('0x4e')](function(_0xe3608a){logger['error'](_0xc4a7('0x57'),_0xe3608a);throw _0xe3608a;});}return _0x20d19d;})['then'](respondWithResult(_0x42998c,0xc9))[_0xc4a7('0x4e')](handleError(_0x42998c,null));};exports[_0xc4a7('0x27')]=function(_0x7c16d5,_0x569440){if(_0x7c16d5[_0xc4a7('0x50')]['id']){delete _0x7c16d5[_0xc4a7('0x50')]['id'];}return db[_0xc4a7('0x45')][_0xc4a7('0x4d')]({'where':{'id':_0x7c16d5[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x569440,null))[_0xc4a7('0x28')](saveUpdates(_0x7c16d5['body'],null))[_0xc4a7('0x28')](respondWithResult(_0x569440,null))[_0xc4a7('0x4e')](handleError(_0x569440,null));};exports['destroy']=function(_0x52737d,_0x14b382){return db[_0xc4a7('0x45')][_0xc4a7('0x4d')]({'where':{'id':_0x52737d['params']['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x14b382,null))[_0xc4a7('0x28')](removeEntity(_0x14b382,null))['catch'](handleError(_0x14b382,null));};exports['describe']=function(_0x284dcc,_0xb22fe5){return db[_0xc4a7('0x45')][_0xc4a7('0x58')]()[_0xc4a7('0x28')](respondWithResult(_0xb22fe5,null))[_0xc4a7('0x4e')](handleError(_0xb22fe5,null));};exports[_0xc4a7('0x59')]=function(_0xc31e7b,_0x4b4631,_0x25db6c){if(_0xc31e7b['body']['id']){delete _0xc31e7b['body']['id'];}return db[_0xc4a7('0x45')]['find']({'where':{'id':_0xc31e7b[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x4b4631,null))[_0xc4a7('0x28')](function(_0x4e6ce6){if(_0x4e6ce6){_0xc31e7b[_0xc4a7('0x50')][_0xc4a7('0x5a')]=_0x4e6ce6['id'];return db['Disposition'][_0xc4a7('0x4f')](_0xc31e7b['body']);}})['then'](respondWithResult(_0x4b4631,null))[_0xc4a7('0x4e')](handleError(_0x4b4631,null));};exports[_0xc4a7('0x5b')]=function(_0x23e1a8,_0x1e412b,_0x5e2786){var _0x37cc11={'raw':![],'where':{}};var _0x3eaf66={};var _0x18bd26={'count':0x0,'rows':[]};return db[_0xc4a7('0x45')][_0xc4a7('0x5c')]({'where':{'id':_0x23e1a8[_0xc4a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e412b,null))['then'](function(_0xbcb3fa){if(_0xbcb3fa){_0x3eaf66[_0xc4a7('0x36')]=_['keys'](db[_0xc4a7('0x5d')][_0xc4a7('0x4c')]);_0x3eaf66['query']=_['keys'](_0x23e1a8[_0xc4a7('0x32')]);_0x3eaf66['filters']=_[_0xc4a7('0x35')](_0x3eaf66[_0xc4a7('0x36')],_0x3eaf66['query']);_0x37cc11[_0xc4a7('0x37')]=_[_0xc4a7('0x35')](_0x3eaf66[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x23e1a8[_0xc4a7('0x32')][_0xc4a7('0x38')]));_0x37cc11[_0xc4a7('0x37')]=_0x37cc11[_0xc4a7('0x37')][_0xc4a7('0x39')]?_0x37cc11[_0xc4a7('0x37')]:_0x3eaf66[_0xc4a7('0x36')];if(!_0x23e1a8[_0xc4a7('0x32')][_0xc4a7('0x3a')](_0xc4a7('0x3b'))){_0x37cc11['limit']=qs[_0xc4a7('0x23')](_0x23e1a8['query'][_0xc4a7('0x23')]);_0x37cc11[_0xc4a7('0x22')]=qs['offset'](_0x23e1a8[_0xc4a7('0x32')][_0xc4a7('0x22')]);}_0x37cc11[_0xc4a7('0x3c')]=qs[_0xc4a7('0x3d')](_0x23e1a8[_0xc4a7('0x32')][_0xc4a7('0x3d')]);_0x37cc11[_0xc4a7('0x3e')]=qs[_0xc4a7('0x34')](_[_0xc4a7('0x3f')](_0x23e1a8[_0xc4a7('0x32')],_0x3eaf66[_0xc4a7('0x34')]));_0x37cc11[_0xc4a7('0x3e')]['ListId']=_0xbcb3fa['id'];if(_0x23e1a8[_0xc4a7('0x32')][_0xc4a7('0x40')]){_0x37cc11[_0xc4a7('0x3e')]=_[_0xc4a7('0x43')](_0x37cc11[_0xc4a7('0x3e')],{'$or':_[_0xc4a7('0x30')](_0x37cc11[_0xc4a7('0x37')],function(_0xd11a87){var _0x5b447b={};_0x5b447b[_0xd11a87]={'$like':'%'+_0x23e1a8[_0xc4a7('0x32')]['filter']+'%'};return _0x5b447b;})});}_0x37cc11=_[_0xc4a7('0x43')]({},_0x37cc11,_0x23e1a8['options']);return db['Disposition'][_0xc4a7('0x21')]({'where':_0x37cc11[_0xc4a7('0x3e')]})[_0xc4a7('0x28')](function(_0x330778){_0x18bd26[_0xc4a7('0x21')]=_0x330778;if(_0x23e1a8[_0xc4a7('0x32')]['includeAll']){_0x37cc11[_0xc4a7('0x47')]=[{'all':!![]}];}return db[_0xc4a7('0x5d')][_0xc4a7('0x48')](_0x37cc11);})[_0xc4a7('0x28')](function(_0x3f05b5){_0x18bd26['rows']=_0x3f05b5;return _0x18bd26;});}})[_0xc4a7('0x28')](respondWithFilteredResult(_0x1e412b,_0x37cc11))['catch'](handleError(_0x1e412b,null));};exports[_0xc4a7('0x5e')]=function(_0x508d30,_0x8000d2,_0x111e34){return db[_0xc4a7('0x45')][_0xc4a7('0x4d')]({'where':{'id':_0x508d30[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x8000d2,null))[_0xc4a7('0x28')](function(_0x43f8f5){if(_0x43f8f5){return _0x43f8f5[_0xc4a7('0x5e')](_0x508d30[_0xc4a7('0x32')][_0xc4a7('0x5f')]);}})[_0xc4a7('0x28')](respondWithStatusCode(_0x8000d2,null))[_0xc4a7('0x4e')](handleError(_0x8000d2,null));};exports[_0xc4a7('0x60')]=function(_0x2526bb,_0x407761,_0x333409){return db[_0xc4a7('0x45')]['find']({'where':{'id':_0x2526bb[_0xc4a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x407761,null))[_0xc4a7('0x28')](function(_0x601369){if(_0x601369){var _0x45a659=[];var _0x4d294c={'success':[],'errors':[]};return db[_0xc4a7('0x61')]['describe']()['then'](function(_0xc5dc0b){if(_0x2526bb[_0xc4a7('0x50')][_0xc4a7('0x62')]&&_[_0xc4a7('0x63')](_0x2526bb[_0xc4a7('0x50')][_0xc4a7('0x62')])){if(_0x2526bb['body'][_0xc4a7('0x62')][_0xc4a7('0x39')]){_0x2526bb[_0xc4a7('0x50')]['tags']=_0x2526bb[_0xc4a7('0x50')][_0xc4a7('0x62')][_0xc4a7('0x64')](';')+';';}else{_0x2526bb['body']['tags']=null;}}else{_0x2526bb['body']['tags']=null;}if(_0x2526bb[_0xc4a7('0x50')]&&_['isArray'](_0x2526bb[_0xc4a7('0x50')])){for(var _0x5927f2=0x0;_0x5927f2<_0x2526bb[_0xc4a7('0x50')]['length'];_0x5927f2+=0x1){_0x2526bb[_0xc4a7('0x50')][_0x5927f2][_0xc4a7('0x5a')]=_0x2526bb['params']['id'];_0x45a659[_0xc4a7('0x65')](_0x2526bb[_0xc4a7('0x50')][_0x5927f2]);}return BPromise[_0xc4a7('0x66')](_0x45a659,function(_0x1dba1f){return db[_0xc4a7('0x61')]['create'](_[_0xc4a7('0x67')](_0x1dba1f,[_0xc4a7('0x5f'),'id'])||{},{'fields':_[_0xc4a7('0x33')](_0xc5dc0b),'raw':!![]})['then'](function(_0x4ce8ca){_0x4d294c[_0xc4a7('0x68')][_0xc4a7('0x65')](_0x4ce8ca[_0xc4a7('0x69')]);})[_0xc4a7('0x4e')](function(_0xcaaffd){_0x4d294c[_0xc4a7('0x6a')][_0xc4a7('0x65')]({'data':_0x1dba1f,'error':_0xcaaffd[_0xc4a7('0x6b')]});});})['then'](function(_0x28f289){return _0x4d294c;})['catch'](function(_0xb15944){return _0xb15944;});}else{_0x407761['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xc4a7('0x28')](respondWithResult(_0x407761,null))[_0xc4a7('0x4e')](handleError(_0x407761,null));};exports['getContacts']=function(_0x487f37,_0x1d7dda,_0x13d46e){var _0x4e8fc0;return db[_0xc4a7('0x45')][_0xc4a7('0x4d')]({'where':{'id':_0x487f37[_0xc4a7('0x4b')]['id']},'include':[{'model':db[_0xc4a7('0x6c')],'as':_0xc4a7('0x6d')}]})[_0xc4a7('0x28')](handleEntityNotFound(_0x1d7dda,null))['then'](function(_0x4e4914){if(_0x4e4914){_0x4e8fc0=_0x4e4914;return db[_0xc4a7('0x61')][_0xc4a7('0x4c')];}})['then'](function(_0x2b6a5b){if(_0x2b6a5b){var _0x33b2a1={};var _0x3a8602={};_0x3a8602[_0xc4a7('0x36')]=_[_0xc4a7('0x6e')](_['keys'](_0x2b6a5b),_['map'](_0x4e8fc0['CustomFields'],function(_0xd8de74){return util['format']('cf_%d',_0xd8de74['id']);}));_0x3a8602[_0xc4a7('0x32')]=_[_0xc4a7('0x33')](_0x487f37[_0xc4a7('0x32')]);_0x3a8602[_0xc4a7('0x34')]=_[_0xc4a7('0x35')](_0x3a8602['model'],_0x3a8602[_0xc4a7('0x32')]);_0x33b2a1[_0xc4a7('0x37')]=_[_0xc4a7('0x35')](_0x3a8602[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x487f37['query'][_0xc4a7('0x38')]));_0x33b2a1[_0xc4a7('0x37')]=_0x33b2a1[_0xc4a7('0x37')]['length']?_0x33b2a1[_0xc4a7('0x37')]:_0x3a8602[_0xc4a7('0x36')];if(!_0x487f37['query']['hasOwnProperty'](_0xc4a7('0x3b'))){_0x33b2a1[_0xc4a7('0x23')]=qs['limit'](_0x487f37['query'][_0xc4a7('0x23')]);_0x33b2a1[_0xc4a7('0x22')]=qs[_0xc4a7('0x22')](_0x487f37['query']['offset']);}_0x33b2a1[_0xc4a7('0x3c')]=qs['sort'](_0x487f37[_0xc4a7('0x32')][_0xc4a7('0x3d')]);_0x33b2a1['where']=qs['filters'](_[_0xc4a7('0x3f')](_0x487f37['query'],_0x3a8602[_0xc4a7('0x34')]));_0x33b2a1[_0xc4a7('0x6f')]=!![];if(_0x487f37[_0xc4a7('0x32')][_0xc4a7('0x40')]){_0x33b2a1[_0xc4a7('0x3e')]=_[_0xc4a7('0x43')](_0x33b2a1[_0xc4a7('0x3e')],{'$or':_[_0xc4a7('0x30')](_0x33b2a1[_0xc4a7('0x37')],function(_0x34511c){var _0x3784d5={};_0x3784d5[_0x34511c]={'$like':'%'+_0x487f37['query'][_0xc4a7('0x40')]+'%'};return _0x3784d5;})});}_0x33b2a1=_[_0xc4a7('0x43')]({},_0x33b2a1,_0x487f37[_0xc4a7('0x44')]);return _0x4e8fc0[_0xc4a7('0x70')](_0x33b2a1);}})[_0xc4a7('0x28')](respondWithResult(_0x1d7dda,null))[_0xc4a7('0x4e')](handleError(_0x1d7dda,null));};exports[_0xc4a7('0x71')]=function(_0x5665d2,_0x3d21a1,_0x5b7bb8){var _0x204e47;var _0x1357a2;var _0x43a78f;var _0x29ca76=_0x5665d2[_0xc4a7('0x4b')]['id'];csv_results=[];return db['ContactItemType'][_0xc4a7('0x48')]({'attributes':['id',_0xc4a7('0x2e')],'raw':!![],'order':[_0xc4a7('0x72')]})[_0xc4a7('0x28')](function(_0x2932ae){_0x204e47=_0x2932ae;var _0x4c8bc1=_[_0xc4a7('0x33')](db['CmContact'][_0xc4a7('0x4c')]);return db[_0xc4a7('0x6c')][_0xc4a7('0x48')]({'raw':!![],'attributes':['id',_0xc4a7('0x73')]})['then'](function(_0x58a8c1){_0x1357a2=_0x58a8c1;var _0x446ad3=squel[_0xc4a7('0x74')]()['fields'](_0x4c8bc1)[_0xc4a7('0x75')](_0xc4a7('0x76'),'c')[_0xc4a7('0x3e')](_0xc4a7('0x77'),_0x29ca76)['where'](_0xc4a7('0x78'))['distinct']();for(var _0xf9127b=0x0;_0xf9127b<_0x1357a2[_0xc4a7('0x39')];_0xf9127b++){_0x446ad3['field'](_0xc4a7('0x79')+_0x1357a2[_0xf9127b]['id'],_0xc4a7('0x7a')+_0x1357a2[_0xf9127b][_0xc4a7('0x73')]);}for(var _0xf9127b=0x0;_0xf9127b<_0x204e47[_0xc4a7('0x39')];_0xf9127b++){_0x446ad3[_0xc4a7('0x7b')](squel['select']()[_0xc4a7('0x7b')](_0xc4a7('0x7c'))[_0xc4a7('0x75')]('cm_contact_has_items')[_0xc4a7('0x3e')]('ItemTypeId\x20=\x20?',_0x204e47[_0xf9127b]['id'])[_0xc4a7('0x3e')]('CmContactId\x20=\x20c.id'),_0xc4a7('0x7d')+_0x204e47[_0xf9127b][_0xc4a7('0x2e')]);_0x446ad3[_0xc4a7('0x7b')](squel[_0xc4a7('0x74')]()[_0xc4a7('0x7b')]('description')[_0xc4a7('0x75')](_0xc4a7('0x7e'))[_0xc4a7('0x3e')](_0xc4a7('0x7f'),_0x204e47[_0xf9127b]['id'])[_0xc4a7('0x3e')](_0xc4a7('0x80')),_0xc4a7('0x81')+_0x204e47[_0xf9127b]['name']);}var _0x22fff7=[];_0x22fff7[_0xc4a7('0x65')](_0x446ad3[_0xc4a7('0x82')]());BPromise[_0xc4a7('0x66')](_0x22fff7,handleQuery)[_0xc4a7('0x28')](function(_0x2123db){handleQuery(_0x446ad3[_0xc4a7('0x82')]());var _0x5c3b25=csv_results[0x0];if(!_[_0xc4a7('0x83')](_0x5c3b25)){var _0x4bb101=toCsv(_0x5c3b25);var _0x42786b=Date['now']();fs[_0xc4a7('0x84')](util['format'](_0xc4a7('0x85'),_0x29ca76,_0x42786b),_0x4bb101);_0x3d21a1[_0xc4a7('0x86')](_0xc4a7('0x87'),_0xc4a7('0x88')+util['format']('list_%d_%s.csv',_0x29ca76,_0x42786b));_0x3d21a1[_0xc4a7('0x86')](_0xc4a7('0x89'),_0xc4a7('0x8a'));return _0x3d21a1[_0xc4a7('0x8b')](util['format'](_0xc4a7('0x85'),_0x29ca76,_0x42786b));}else{return _0x3d21a1[_0xc4a7('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x588669,_0x3f085a,_0xcfd852){var _0x3d2b0c;delete _0x588669[_0xc4a7('0x50')]['id'];return db[_0xc4a7('0x45')][_0xc4a7('0x5c')]({'where':{'id':_0x588669[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x3f085a,null))[_0xc4a7('0x28')](function(_0x19f8bd){if(_0x19f8bd){return db[_0xc4a7('0x8c')][_0xc4a7('0x8d')](function(_0x3d0603){return db['CmCustomField']['create'](_0x588669[_0xc4a7('0x50')],{'transaction':_0x3d0603})[_0xc4a7('0x28')](function(_0x42f680){_0x3d2b0c=_0x42f680;return _0x19f8bd[_0xc4a7('0x8e')](_0x42f680,{'transaction':_0x3d0603});})[_0xc4a7('0x28')](function(){var _0x3f165c={'type':db[_0xc4a7('0x8f')]['TEXT'],'transaction':_0x3d0603};switch(_0x588669[_0xc4a7('0x50')]['type']){case _0xc4a7('0x90'):_0x3f165c[_0xc4a7('0x41')]=db['Sequelize'][_0xc4a7('0x91')];break;case _0xc4a7('0x92'):_0x3f165c[_0xc4a7('0x41')]=db[_0xc4a7('0x8f')]['INTEGER'];break;case'switch':_0x3f165c['type']=db[_0xc4a7('0x8f')][_0xc4a7('0x93')];_0x3f165c[_0xc4a7('0x94')]=![];break;default:}return db['sequelize']['queryInterface'][_0xc4a7('0x95')](_0xc4a7('0x76'),util[_0xc4a7('0x96')](_0xc4a7('0x97'),_0x3d2b0c['id']),_0x3f165c);})[_0xc4a7('0x28')](function(){return _0x3d2b0c;});});}})[_0xc4a7('0x28')](respondWithResult(_0x3f085a,null))[_0xc4a7('0x4e')](handleError(_0x3f085a,null));};exports['getCustomFields']=function(_0x3972a2,_0x1eab8d,_0xd9dfca){var _0x111158={};var _0x485815={};var _0x1ca7c2;var _0x47e72d;return db['CmList']['findOne']({'where':{'id':_0x3972a2[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x1eab8d,null))[_0xc4a7('0x28')](function(_0xea2a79){if(_0xea2a79){_0x1ca7c2=_0xea2a79;_0x485815[_0xc4a7('0x36')]=_[_0xc4a7('0x33')](db[_0xc4a7('0x6c')]['rawAttributes']);_0x485815[_0xc4a7('0x32')]=_[_0xc4a7('0x33')](_0x3972a2[_0xc4a7('0x32')]);_0x485815['filters']=_[_0xc4a7('0x35')](_0x485815[_0xc4a7('0x36')],_0x485815['query']);_0x111158[_0xc4a7('0x37')]=_[_0xc4a7('0x35')](_0x485815[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x3972a2['query']['fields']));_0x111158[_0xc4a7('0x37')]=_0x111158[_0xc4a7('0x37')]['length']?_0x111158[_0xc4a7('0x37')]:_0x485815[_0xc4a7('0x36')];_0x111158[_0xc4a7('0x3c')]=qs[_0xc4a7('0x3d')](_0x3972a2[_0xc4a7('0x32')][_0xc4a7('0x3d')]);_0x111158['where']=qs[_0xc4a7('0x34')](_['pick'](_0x3972a2[_0xc4a7('0x32')],_0x485815[_0xc4a7('0x34')]));_0x111158[_0xc4a7('0x3e')]=_[_0xc4a7('0x43')](_0x111158[_0xc4a7('0x3e')],{'$or':[{'ListId':_0xea2a79['id']},{'ListId':null}]});if(_0x3972a2['query']['filter']){_0x111158['where']=_[_0xc4a7('0x43')](_0x111158[_0xc4a7('0x3e')],{'$or':_[_0xc4a7('0x30')](_0x111158[_0xc4a7('0x37')],function(_0x3e8cf0){var _0x49449b={};_0x49449b[_0x3e8cf0]={'$like':'%'+_0x3972a2['query'][_0xc4a7('0x40')]+'%'};return _0x49449b;})});}_0x111158=_['merge']({},_0x111158,_0x3972a2[_0xc4a7('0x44')]);return db[_0xc4a7('0x6c')][_0xc4a7('0x98')](_0x111158);}})[_0xc4a7('0x28')](respondWithResult(_0x1eab8d,null))[_0xc4a7('0x4e')](handleError(_0x1eab8d,null));};exports['getGlobalCustomFields']=function(_0x34b3ee,_0x45b14f){return db['CmCustomField'][_0xc4a7('0x98')]({'where':{'ListId':null}})[_0xc4a7('0x28')](handleEntityNotFound(_0x45b14f,null))[_0xc4a7('0x28')](function(_0x1187da){return _0x1187da;})[_0xc4a7('0x28')](respondWithResult(_0x45b14f,null))[_0xc4a7('0x4e')](handleError(_0x45b14f,null));};exports[_0xc4a7('0x99')]=function(_0x31944c,_0x50f87d,_0x1542bc){return db[_0xc4a7('0x45')]['find']({'where':{'id':_0x31944c[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x50f87d,null))[_0xc4a7('0x28')](function(_0x191902){if(_0x191902){return _0x191902['addAgents'](_0x31944c['body'][_0xc4a7('0x5f')],_[_0xc4a7('0x67')](_0x31944c['body'],['ids','id'])||{})[_0xc4a7('0x9a')](function(_0x3401b4){for(var _0x13b432=0x0;_0x13b432<_0x31944c[_0xc4a7('0x50')][_0xc4a7('0x5f')][_0xc4a7('0x39')];_0x13b432+=0x1){socket['emit'](_0xc4a7('0x9b'),{'UserId':Number(_0x31944c['body'][_0xc4a7('0x5f')][_0x13b432]),'CmListId':Number(_0x31944c['params']['id'])});}return _0x3401b4;});}})[_0xc4a7('0x28')](respondWithResult(_0x50f87d,null))[_0xc4a7('0x4e')](handleError(_0x50f87d,null));};exports[_0xc4a7('0x9c')]=function(_0x1907f5,_0x4cfa93,_0xea2af0){return db['CmList'][_0xc4a7('0x4d')]({'where':{'id':_0x1907f5[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x4cfa93,null))[_0xc4a7('0x28')](function(_0x5252aa){if(_0x5252aa){return _0x5252aa[_0xc4a7('0x9c')](_0x1907f5[_0xc4a7('0x32')][_0xc4a7('0x5f')])[_0xc4a7('0x28')](function(){if(_['isArray'](_0x1907f5[_0xc4a7('0x32')][_0xc4a7('0x5f')])){for(var _0x3bbffc=0x0;_0x3bbffc<_0x1907f5['query']['ids'][_0xc4a7('0x39')];_0x3bbffc+=0x1){socket[_0xc4a7('0x9d')]('userCmList:remove',{'UserId':Number(_0x1907f5[_0xc4a7('0x32')][_0xc4a7('0x5f')][_0x3bbffc]),'CmListId':Number(_0x1907f5[_0xc4a7('0x4b')]['id'])});}}else{socket[_0xc4a7('0x9d')](_0xc4a7('0x9e'),{'UserId':Number(_0x1907f5['query']['ids']),'CmListId':Number(_0x1907f5['params']['id'])});}});}})[_0xc4a7('0x28')](respondWithStatusCode(_0x4cfa93,null))[_0xc4a7('0x4e')](handleError(_0x4cfa93,null));};exports[_0xc4a7('0x9f')]=function(_0x191931,_0x3f82a7,_0x37331f){var _0x1cda1f={};var _0x39ef6c={};var _0x2d8ec5;var _0xfe5c2b;return db[_0xc4a7('0x45')][_0xc4a7('0x5c')]({'where':{'id':_0x191931[_0xc4a7('0x4b')]['id']}})[_0xc4a7('0x28')](handleEntityNotFound(_0x3f82a7,null))[_0xc4a7('0x28')](function(_0x31d3d0){if(_0x31d3d0){_0x2d8ec5=_0x31d3d0;_0x39ef6c[_0xc4a7('0x36')]=_[_0xc4a7('0x33')](db[_0xc4a7('0xa0')][_0xc4a7('0x4c')]);_0x39ef6c[_0xc4a7('0x32')]=_[_0xc4a7('0x33')](_0x191931['query']);_0x39ef6c['filters']=_[_0xc4a7('0x35')](_0x39ef6c[_0xc4a7('0x36')],_0x39ef6c[_0xc4a7('0x32')]);_0x1cda1f[_0xc4a7('0x37')]=_[_0xc4a7('0x35')](_0x39ef6c[_0xc4a7('0x36')],qs[_0xc4a7('0x38')](_0x191931[_0xc4a7('0x32')][_0xc4a7('0x38')]));_0x1cda1f['attributes']=_0x1cda1f['attributes']['length']?_0x1cda1f[_0xc4a7('0x37')]:_0x39ef6c['model'];_0x1cda1f[_0xc4a7('0x3c')]=qs[_0xc4a7('0x3d')](_0x191931[_0xc4a7('0x32')][_0xc4a7('0x3d')]);_0x1cda1f['where']=qs['filters'](_[_0xc4a7('0x3f')](_0x191931[_0xc4a7('0x32')],_0x39ef6c[_0xc4a7('0x34')]));if(_0x191931[_0xc4a7('0x32')][_0xc4a7('0x40')]){_0x1cda1f[_0xc4a7('0x3e')]=_[_0xc4a7('0x43')](_0x1cda1f[_0xc4a7('0x3e')],{'$or':_[_0xc4a7('0x30')](_0x1cda1f['attributes'],function(_0x10ac60){var _0x36ef2c={};_0x36ef2c[_0x10ac60]={'$like':'%'+_0x191931[_0xc4a7('0x32')]['filter']+'%'};return _0x36ef2c;})});}_0x1cda1f=_[_0xc4a7('0x43')]({},_0x1cda1f,_0x191931[_0xc4a7('0x44')]);return _0x2d8ec5[_0xc4a7('0x9f')](_0x1cda1f);}})[_0xc4a7('0x28')](function(_0x5542a2){if(_0x5542a2){_0xfe5c2b=_0x5542a2[_0xc4a7('0x39')];if(!_0x191931[_0xc4a7('0x32')][_0xc4a7('0x3a')]('nolimit')){_0x1cda1f[_0xc4a7('0x23')]=qs[_0xc4a7('0x23')](_0x191931['query'][_0xc4a7('0x23')]);_0x1cda1f[_0xc4a7('0x22')]=qs[_0xc4a7('0x22')](_0x191931['query'][_0xc4a7('0x22')]);}return _0x2d8ec5[_0xc4a7('0x9f')](_0x1cda1f);}})[_0xc4a7('0x28')](function(_0x61c5c8){if(_0x61c5c8){return _0x61c5c8?{'count':_0xfe5c2b,'rows':_0x61c5c8}:null;}})['then'](respondWithResult(_0x3f82a7,null))[_0xc4a7('0x4e')](handleError(_0x3f82a7,null));};function handleQuery(_0x5445eb){logger[_0xc4a7('0xa1')](_0x5445eb);return db[_0xc4a7('0x8c')]['query'](_0x5445eb)[_0xc4a7('0x9a')](function(_0xfb6d35){csv_results[_0xc4a7('0x65')](_0xfb6d35);})['catch'](function(_0x3b476e){logger[_0xc4a7('0xa2')](_0x3b476e[_0xc4a7('0x6b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4def82d..7e45fb5 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x5fc3,0xa8));var _0x35fc=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x5fc3[_0xbc4560];return _0x298cfb;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x5a425f,_0x439447){var _0x1ab39e=function(_0x36829a){while(--_0x36829a){_0x5a425f['push'](_0x5a425f['shift']());}};_0x1ab39e(++_0x439447);}(_0x7217,0x19e));var _0x7721=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x7217[_0xf71120];return _0xbe2fd3;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a8dd4ab..23323c0 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 _0xec56=['define','CmList','cm_lists','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x14dbe6,_0x3b32fc){var _0x58bb00=function(_0x37a37b){while(--_0x37a37b){_0x14dbe6['push'](_0x14dbe6['shift']());}};_0x58bb00(++_0x3b32fc);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3ed9fc,_0x347039){_0x3ed9fc=_0x3ed9fc-0x0;var _0x1a2337=_0xec56[_0x3ed9fc];return _0x1a2337;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x5354fd,_0x4d5318){var _0x1ce01a=function(_0x34d983){while(--_0x34d983){_0x5354fd['push'](_0x5354fd['shift']());}};_0x1ce01a(++_0x4d5318);}(_0xb821,0xa7));var _0x1b82=function(_0x149ce7,_0x40a832){_0x149ce7=_0x149ce7-0x0;var _0x235e66=_0xb821[_0x149ce7];return _0x235e66;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 0370c2f..a338fa8 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 _0x62ea=['localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x202bc5,_0x509360){var _0x4fa2b9=function(_0x5c263c){while(--_0x5c263c){_0x202bc5['push'](_0x202bc5['shift']());}};_0x4fa2b9(++_0x509360);}(_0x62ea,0x79));var _0xa62e=function(_0x52e251,_0x3b6303){_0x52e251=_0x52e251-0x0;var _0x5eee63=_0x62ea[_0x52e251];return _0x5eee63;};'use strict';var _=require(_0xa62e('0x0'));var util=require(_0xa62e('0x1'));var moment=require(_0xa62e('0x2'));var BPromise=require(_0xa62e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa62e('0x4'));var db=require(_0xa62e('0x5'))['db'];var utils=require(_0xa62e('0x6'));var logger=require(_0xa62e('0x7'))(_0xa62e('0x8'));var config=require(_0xa62e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa62e('0xa')][_0xa62e('0xb')]({'port':0x232a});config[_0xa62e('0xc')]=_[_0xa62e('0xd')](config['redis'],{'host':_0xa62e('0xe'),'port':0x18eb});var socket=require(_0xa62e('0xf'))(new Redis(config['redis']));require('./cmList.socket')[_0xa62e('0x10')](socket);function respondWithRpcPromise(_0xed4721,_0x595c09,_0x441ec6){return new BPromise(function(_0x20bb96,_0x455235){return client[_0xa62e('0x11')](_0xed4721,_0x441ec6)['then'](function(_0x3101ed){logger[_0xa62e('0x12')](_0xa62e('0x13'),_0x595c09,'request\x20sent');logger[_0xa62e('0x14')](_0xa62e('0x15'),_0x595c09,'request\x20sent',JSON['stringify'](_0x3101ed));if(_0x3101ed[_0xa62e('0x16')]){if(_0x3101ed[_0xa62e('0x16')][_0xa62e('0x17')]===0x1f4){logger[_0xa62e('0x16')](_0xa62e('0x13'),_0x595c09,_0x3101ed[_0xa62e('0x16')][_0xa62e('0x18')]);return _0x455235(_0x3101ed['error'][_0xa62e('0x18')]);}logger[_0xa62e('0x16')](_0xa62e('0x13'),_0x595c09,_0x3101ed['error'][_0xa62e('0x18')]);return _0x20bb96(_0x3101ed[_0xa62e('0x16')][_0xa62e('0x18')]);}else{logger[_0xa62e('0x12')](_0xa62e('0x13'),_0x595c09,_0xa62e('0x19'));_0x20bb96(_0x3101ed['result']['message']);}})[_0xa62e('0x1a')](function(_0x3bf019){logger['error'](_0xa62e('0x13'),_0x595c09,_0x3bf019);_0x455235(_0x3bf019);});});} \ No newline at end of file +var _0xe079=['../../config/logger','jayson/promise','client','redis','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x39b547,_0x426efa){var _0xda7c69=function(_0x38efa3){while(--_0x38efa3){_0x39b547['push'](_0x39b547['shift']());}};_0xda7c69(++_0x426efa);}(_0xe079,0x6a));var _0x9e07=function(_0x555697,_0x45df40){_0x555697=_0x555697-0x0;var _0x118a5d=_0xe079[_0x555697];return _0x118a5d;};'use strict';var _=require(_0x9e07('0x0'));var util=require(_0x9e07('0x1'));var moment=require(_0x9e07('0x2'));var BPromise=require(_0x9e07('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e07('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9e07('0x5'));var client=jayson[_0x9e07('0x6')]['http']({'port':0x232a});config[_0x9e07('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e07('0x8'))(new Redis(config[_0x9e07('0x7')]));require(_0x9e07('0x9'))[_0x9e07('0xa')](socket);function respondWithRpcPromise(_0x352e33,_0x2dddfe,_0x303be4){return new BPromise(function(_0x24564c,_0x2b3099){return client[_0x9e07('0xb')](_0x352e33,_0x303be4)[_0x9e07('0xc')](function(_0x312de8){logger['info'](_0x9e07('0xd'),_0x2dddfe,_0x9e07('0xe'));logger[_0x9e07('0xf')](_0x9e07('0x10'),_0x2dddfe,'request\x20sent',JSON['stringify'](_0x312de8));if(_0x312de8[_0x9e07('0x11')]){if(_0x312de8[_0x9e07('0x11')][_0x9e07('0x12')]===0x1f4){logger[_0x9e07('0x11')]('CmList,\x20%s,\x20%s',_0x2dddfe,_0x312de8[_0x9e07('0x11')][_0x9e07('0x13')]);return _0x2b3099(_0x312de8[_0x9e07('0x11')]['message']);}logger[_0x9e07('0x11')]('CmList,\x20%s,\x20%s',_0x2dddfe,_0x312de8['error'][_0x9e07('0x13')]);return _0x24564c(_0x312de8[_0x9e07('0x11')]['message']);}else{logger[_0x9e07('0x14')](_0x9e07('0xd'),_0x2dddfe,_0x9e07('0xe'));_0x24564c(_0x312de8[_0x9e07('0x15')][_0x9e07('0x13')]);}})['catch'](function(_0x31e3ab){logger[_0x9e07('0x11')]('CmList,\x20%s,\x20%s',_0x2dddfe,_0x31e3ab);_0x2b3099(_0x31e3ab);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a19eb4e..7296d73 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 _0x439b=['emit','removeListener','register','length','cmList:','./cmList.events','remove','update'];(function(_0x7d0149,_0x1b6d23){var _0xaabd78=function(_0x3dfcef){while(--_0x3dfcef){_0x7d0149['push'](_0x7d0149['shift']());}};_0xaabd78(++_0x1b6d23);}(_0x439b,0x105));var _0xb439=function(_0x2a83b9,_0x3c2d30){_0x2a83b9=_0x2a83b9-0x0;var _0x11cd74=_0x439b[_0x2a83b9];return _0x11cd74;};'use strict';var CmListEvents=require(_0xb439('0x0'));var events=['save',_0xb439('0x1'),_0xb439('0x2')];function createListener(_0x1aa58d,_0x48aacc){return function(_0x388d50){_0x48aacc[_0xb439('0x3')](_0x1aa58d,_0x388d50);};}function removeListener(_0x1ae573,_0x1d8b20){return function(){CmListEvents[_0xb439('0x4')](_0x1ae573,_0x1d8b20);};}exports[_0xb439('0x5')]=function(_0x4a9822){for(var _0x3b1208=0x0,_0x350301=events[_0xb439('0x6')];_0x3b1208<_0x350301;_0x3b1208++){var _0x3f228f=events[_0x3b1208];var _0x2f1115=createListener(_0xb439('0x7')+_0x3f228f,_0x4a9822);CmListEvents['on'](_0x3f228f,_0x2f1115);}}; \ No newline at end of file +var _0xa7ee=['save','remove','update','removeListener','register','length','cmList:','./cmList.events'];(function(_0x348b29,_0x3be5e9){var _0xc260c5=function(_0x568363){while(--_0x568363){_0x348b29['push'](_0x348b29['shift']());}};_0xc260c5(++_0x3be5e9);}(_0xa7ee,0x167));var _0xea7e=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0xa7ee[_0x5f2fea];return _0x198a0c;};'use strict';var CmListEvents=require(_0xea7e('0x0'));var events=[_0xea7e('0x1'),_0xea7e('0x2'),_0xea7e('0x3')];function createListener(_0x4fa509,_0x81679){return function(_0x3ed22b){_0x81679['emit'](_0x4fa509,_0x3ed22b);};}function removeListener(_0x41b9af,_0x337d09){return function(){CmListEvents[_0xea7e('0x4')](_0x41b9af,_0x337d09);};}exports[_0xea7e('0x5')]=function(_0x294d25){for(var _0xf39ac3=0x0,_0x3aadbc=events[_0xea7e('0x6')];_0xf39ac3<_0x3aadbc;_0xf39ac3++){var _0x442e3f=events[_0xf39ac3];var _0x2cf87e=createListener(_0xea7e('0x7')+_0x442e3f,_0x294d25);CmListEvents['on'](_0x442e3f,_0x2cf87e);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e22000e..0d3f4cf 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 _0x7f4b=['update','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x7f4b,0x144));var _0xb7f4=function(_0x87dd0e,_0x390eec){_0x87dd0e=_0x87dd0e-0x0;var _0x3f6891=_0x7f4b[_0x87dd0e];return _0x3f6891;};'use strict';var multer=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var path=require('path');var timeout=require(_0xb7f4('0x2'));var express=require('express');var router=express[_0xb7f4('0x3')]();var fs_extra=require(_0xb7f4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7f4('0x5'));var controller=require(_0xb7f4('0x6'));router[_0xb7f4('0x7')]('/',auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x9')]);router[_0xb7f4('0x7')](_0xb7f4('0xa'),auth['isAuthenticated'](),controller[_0xb7f4('0xb')]);router[_0xb7f4('0x7')](_0xb7f4('0xc'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router['get'](_0xb7f4('0xd'),auth[_0xb7f4('0x8')](),controller['show']);router[_0xb7f4('0x7')](_0xb7f4('0xe'),auth['isAuthenticated'](),controller[_0xb7f4('0xf')]);router[_0xb7f4('0x7')](_0xb7f4('0x10'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x11')]);router[_0xb7f4('0x7')](_0xb7f4('0x12'),auth['isAuthenticated'](),controller[_0xb7f4('0x13')]);router[_0xb7f4('0x7')](_0xb7f4('0x14'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xb7f4('0x7')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x16')]);router['post']('/',auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x17')]);router[_0xb7f4('0x18')](_0xb7f4('0xe'),auth['isAuthenticated'](),controller[_0xb7f4('0x19')]);router[_0xb7f4('0x18')](_0xb7f4('0x10'),auth[_0xb7f4('0x8')](),controller['addContacts']);router[_0xb7f4('0x18')](_0xb7f4('0x14'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1a')]);router[_0xb7f4('0x18')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1b')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb7f4('0x1c')]);router['delete'](_0xb7f4('0xd'),auth[_0xb7f4('0x8')](),controller[_0xb7f4('0x1d')]);router[_0xb7f4('0x1e')](_0xb7f4('0xe'),auth[_0xb7f4('0x8')](),controller['removeDispositions']);router[_0xb7f4('0x1e')](_0xb7f4('0x15'),auth[_0xb7f4('0x8')](),controller['removeAgents']);module[_0xb7f4('0x1f')]=router; \ No newline at end of file +var _0x7daf=['get','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index'];(function(_0x4ffa0b,_0x222f05){var _0xc22b29=function(_0x356891){while(--_0x356891){_0x4ffa0b['push'](_0x4ffa0b['shift']());}};_0xc22b29(++_0x222f05);}(_0x7daf,0xaa));var _0xf7da=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0x7daf[_0x1eec3a];return _0x133cf7;};'use strict';var multer=require('multer');var util=require(_0xf7da('0x0'));var path=require('path');var timeout=require(_0xf7da('0x1'));var express=require(_0xf7da('0x2'));var router=express['Router']();var fs_extra=require(_0xf7da('0x3'));var auth=require(_0xf7da('0x4'));var interaction=require(_0xf7da('0x5'));var config=require(_0xf7da('0x6'));var controller=require(_0xf7da('0x7'));router['get']('/',auth[_0xf7da('0x8')](),controller[_0xf7da('0x9')]);router[_0xf7da('0xa')](_0xf7da('0xb'),auth[_0xf7da('0x8')](),controller[_0xf7da('0xc')]);router['get'](_0xf7da('0xd'),auth[_0xf7da('0x8')](),controller[_0xf7da('0xe')]);router[_0xf7da('0xa')](_0xf7da('0xf'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x10')]);router[_0xf7da('0xa')](_0xf7da('0x11'),auth[_0xf7da('0x8')](),controller['getDispositions']);router['get'](_0xf7da('0x12'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x13')]);router[_0xf7da('0xa')](_0xf7da('0x14'),auth[_0xf7da('0x8')](),controller['getContactsCsv']);router[_0xf7da('0xa')](_0xf7da('0x15'),auth['isAuthenticated'](),controller[_0xf7da('0x16')]);router[_0xf7da('0xa')](_0xf7da('0x17'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x18')]);router[_0xf7da('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf7da('0x11'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x1a')]);router[_0xf7da('0x19')](_0xf7da('0x12'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x1b')]);router[_0xf7da('0x19')](_0xf7da('0x15'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x1c')]);router[_0xf7da('0x19')](_0xf7da('0x17'),auth[_0xf7da('0x8')](),controller['addAgents']);router[_0xf7da('0x1d')](_0xf7da('0xf'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x1e')]);router[_0xf7da('0x1f')](_0xf7da('0xf'),auth[_0xf7da('0x8')](),controller[_0xf7da('0x20')]);router[_0xf7da('0x1f')]('/:id/dispositions',auth[_0xf7da('0x8')](),controller[_0xf7da('0x21')]);router[_0xf7da('0x1f')]('/:id/users',auth[_0xf7da('0x8')](),controller[_0xf7da('0x22')]);module[_0xf7da('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 673b08e..b65cbe3 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 _0x4648=['STRING','VIRTUAL','field'];(function(_0x5cfe09,_0x24c91d){var _0x334848=function(_0x39f199){while(--_0x39f199){_0x5cfe09['push'](_0x5cfe09['shift']());}};_0x334848(++_0x24c91d);}(_0x4648,0x175));var _0x8464=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x4648[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8464('0x0')],'get':function(_0x1a17c7){return this['getDataValue'](_0x8464('0x1'));}},'field':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8464('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x128f=['exports','VIRTUAL','STRING','sequelize'];(function(_0xff5dd9,_0x44fd57){var _0x183857=function(_0x496352){while(--_0x496352){_0xff5dd9['push'](_0xff5dd9['shift']());}};_0x183857(++_0x44fd57);}(_0x128f,0x73));var _0xf128=function(_0x2537e0,_0x175e03){_0x2537e0=_0x2537e0-0x0;var _0x506d70=_0x128f[_0x2537e0];return _0x506d70;};'use strict';var Sequelize=require(_0xf128('0x0'));module[_0xf128('0x1')]={'name':{'type':Sequelize[_0xf128('0x2')],'get':function(_0x407e73){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xf128('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 145c3fe..da74b25 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(_0x3a5adf,_0x39324d){var _0x227ffd=function(_0x1c42c4){while(--_0x1c42c4){_0x3a5adf['push'](_0x3a5adf['shift']());}};_0x227ffd(++_0x39324d);}(_0x7a54,0x106));var _0x47a5=function(_0x1c06ca,_0x2a9898){_0x1c06ca=_0x1c06ca-0x0;var _0x44fe8b=_0x7a54[_0x1c06ca];return _0x44fe8b;};'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 _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x48e16b,_0x373a8a){var _0x19a4d2=function(_0xd94ef3){while(--_0xd94ef3){_0x48e16b['push'](_0x48e16b['shift']());}};_0x19a4d2(++_0x373a8a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index ed193ad..12ce92c 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 _0xe7a0=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','lodash'];(function(_0x21568a,_0x55d0fa){var _0x4ce987=function(_0x3458c7){while(--_0x3458c7){_0x21568a['push'](_0x21568a['shift']());}};_0x4ce987(++_0x55d0fa);}(_0xe7a0,0x178));var _0x0e7a=function(_0x3c018c,_0x329e42){_0x3c018c=_0x3c018c-0x0;var _0xe3e268=_0xe7a0[_0x3c018c];return _0xe3e268;};'use strict';var _=require(_0x0e7a('0x0'));var util=require(_0x0e7a('0x1'));var logger=require(_0x0e7a('0x2'))(_0x0e7a('0x3'));var moment=require(_0x0e7a('0x4'));var BPromise=require(_0x0e7a('0x5'));var rp=require(_0x0e7a('0x6'));var fs=require('fs');var path=require(_0x0e7a('0x7'));var rimraf=require(_0x0e7a('0x8'));var config=require(_0x0e7a('0x9'));var attributes=require(_0x0e7a('0xa'));module[_0x0e7a('0xb')]=function(_0x42be35,_0x4109ea){return _0x42be35[_0x0e7a('0xc')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9752=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9752,0x1c0));var _0x2975=function(_0x9469c7,_0x3b582d){_0x9469c7=_0x9469c7-0x0;var _0x161a8c=_0x9752[_0x9469c7];return _0x161a8c;};'use strict';var _=require(_0x2975('0x0'));var util=require(_0x2975('0x1'));var logger=require('../../config/logger')(_0x2975('0x2'));var moment=require(_0x2975('0x3'));var BPromise=require(_0x2975('0x4'));var rp=require(_0x2975('0x5'));var fs=require('fs');var path=require(_0x2975('0x6'));var rimraf=require(_0x2975('0x7'));var config=require(_0x2975('0x8'));var attributes=require(_0x2975('0x9'));module[_0x2975('0xa')]=function(_0x335ab3,_0x3cd3b8){return _0x335ab3[_0x2975('0xb')](_0x2975('0xc'),attributes,{'tableName':'tools_conditions','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 6411928..8d3a129 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 _0x9f19=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x9f19,0xb7));var _0x99f1=function(_0x1e39e5,_0x45fc68){_0x1e39e5=_0x1e39e5-0x0;var _0x1a1f5c=_0x9f19[_0x1e39e5];return _0x1a1f5c;};'use strict';var _=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var moment=require(_0x99f1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99f1('0x3'));var db=require(_0x99f1('0x4'))['db'];var utils=require(_0x99f1('0x5'));var logger=require(_0x99f1('0x6'))(_0x99f1('0x7'));var config=require(_0x99f1('0x8'));var jayson=require(_0x99f1('0x9'));var client=jayson[_0x99f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35534e,_0xf09e4,_0x46d0fa){return new BPromise(function(_0x5e1da8,_0x10b580){return client[_0x99f1('0xb')](_0x35534e,_0x46d0fa)['then'](function(_0x3a2c64){logger['info'](_0x99f1('0xc'),_0xf09e4,_0x99f1('0xd'));logger[_0x99f1('0xe')](_0x99f1('0xf'),_0xf09e4,_0x99f1('0xd'),JSON[_0x99f1('0x10')](_0x3a2c64));if(_0x3a2c64[_0x99f1('0x11')]){if(_0x3a2c64[_0x99f1('0x11')]['code']===0x1f4){logger[_0x99f1('0x11')]('Condition,\x20%s,\x20%s',_0xf09e4,_0x3a2c64[_0x99f1('0x11')][_0x99f1('0x12')]);return _0x10b580(_0x3a2c64[_0x99f1('0x11')][_0x99f1('0x12')]);}logger[_0x99f1('0x11')](_0x99f1('0xc'),_0xf09e4,_0x3a2c64['error']['message']);return _0x5e1da8(_0x3a2c64[_0x99f1('0x11')]['message']);}else{logger[_0x99f1('0x13')](_0x99f1('0xc'),_0xf09e4,_0x99f1('0xd'));_0x5e1da8(_0x3a2c64['result'][_0x99f1('0x12')]);}})[_0x99f1('0x14')](function(_0x30fe07){logger[_0x99f1('0x11')]('Condition,\x20%s,\x20%s',_0xf09e4,_0x30fe07);_0x10b580(_0x30fe07);});});} \ No newline at end of file +var _0x17e4=['request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x51e77b,_0x4d4926){var _0x1dfcf9=function(_0x2e227a){while(--_0x2e227a){_0x51e77b['push'](_0x51e77b['shift']());}};_0x1dfcf9(++_0x4d4926);}(_0x17e4,0x1e8));var _0x417e=function(_0x4e71a5,_0xd381fb){_0x4e71a5=_0x4e71a5-0x0;var _0x111f05=_0x17e4[_0x4e71a5];return _0x111f05;};'use strict';var _=require(_0x417e('0x0'));var util=require(_0x417e('0x1'));var moment=require(_0x417e('0x2'));var BPromise=require(_0x417e('0x3'));var rs=require(_0x417e('0x4'));var fs=require('fs');var Redis=require(_0x417e('0x5'));var db=require(_0x417e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x417e('0x7'))(_0x417e('0x8'));var config=require(_0x417e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x417e('0xa')][_0x417e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x64898c,_0x5b1fe8,_0x176c4f){return new BPromise(function(_0x2b99dd,_0x1283da){return client[_0x417e('0xc')](_0x64898c,_0x176c4f)[_0x417e('0xd')](function(_0x2ff556){logger[_0x417e('0xe')](_0x417e('0xf'),_0x5b1fe8,_0x417e('0x10'));logger['debug'](_0x417e('0x11'),_0x5b1fe8,_0x417e('0x10'),JSON[_0x417e('0x12')](_0x2ff556));if(_0x2ff556['error']){if(_0x2ff556[_0x417e('0x13')][_0x417e('0x14')]===0x1f4){logger[_0x417e('0x13')]('Condition,\x20%s,\x20%s',_0x5b1fe8,_0x2ff556[_0x417e('0x13')]['message']);return _0x1283da(_0x2ff556[_0x417e('0x13')][_0x417e('0x15')]);}logger[_0x417e('0x13')](_0x417e('0xf'),_0x5b1fe8,_0x2ff556[_0x417e('0x13')][_0x417e('0x15')]);return _0x2b99dd(_0x2ff556['error'][_0x417e('0x15')]);}else{logger[_0x417e('0xe')](_0x417e('0xf'),_0x5b1fe8,_0x417e('0x10'));_0x2b99dd(_0x2ff556[_0x417e('0x16')]['message']);}})[_0x417e('0x17')](function(_0x3ffd0e){logger[_0x417e('0x13')](_0x417e('0xf'),_0x5b1fe8,_0x3ffd0e);_0x1283da(_0x3ffd0e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 662e147..a693d4d 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 _0xb877=['../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xb877,0x17f));var _0x7b87=function(_0x25cbd6,_0x21853a){_0x25cbd6=_0x25cbd6-0x0;var _0x16052d=_0xb877[_0x25cbd6];return _0x16052d;};'use strict';var multer=require(_0x7b87('0x0'));var util=require(_0x7b87('0x1'));var path=require(_0x7b87('0x2'));var timeout=require('connect-timeout');var express=require(_0x7b87('0x3'));var router=express[_0x7b87('0x4')]();var fs_extra=require(_0x7b87('0x5'));var auth=require(_0x7b87('0x6'));var interaction=require(_0x7b87('0x7'));var config=require('../../config/environment');var controller=require(_0x7b87('0x8'));router['put'](_0x7b87('0x9'),auth[_0x7b87('0xa')](),controller[_0x7b87('0xb')]);router[_0x7b87('0xc')](_0x7b87('0x9'),auth[_0x7b87('0xa')](),controller[_0x7b87('0xd')]);module[_0x7b87('0xe')]=router; \ No newline at end of file +var _0x2454=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','delete','/:id','isAuthenticated','destroy','exports','util','path','connect-timeout','express'];(function(_0x396dc6,_0x529342){var _0x285078=function(_0x198a28){while(--_0x198a28){_0x396dc6['push'](_0x396dc6['shift']());}};_0x285078(++_0x529342);}(_0x2454,0x1eb));var _0x4245=function(_0x53b170,_0x542682){_0x53b170=_0x53b170-0x0;var _0x45742e=_0x2454[_0x53b170];return _0x45742e;};'use strict';var multer=require('multer');var util=require(_0x4245('0x0'));var path=require(_0x4245('0x1'));var timeout=require(_0x4245('0x2'));var express=require(_0x4245('0x3'));var router=express[_0x4245('0x4')]();var fs_extra=require(_0x4245('0x5'));var auth=require(_0x4245('0x6'));var interaction=require(_0x4245('0x7'));var config=require(_0x4245('0x8'));var controller=require(_0x4245('0x9'));router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4245('0xa')](_0x4245('0xb'),auth[_0x4245('0xc')](),controller[_0x4245('0xd')]);module[_0x4245('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 55205bf..c6cbdcd 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 _0xa468=['name','STRING'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0xa468,0x1e3));var _0x8a46=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa468[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a46('0x0')],'allowNull':![],'unique':_0x8a46('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8a46('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xa54f=['INTEGER','sequelize','STRING','name'];(function(_0x5ddc32,_0x2f5670){var _0x3e03bf=function(_0x5b34a4){while(--_0x5b34a4){_0x5ddc32['push'](_0x5ddc32['shift']());}};_0x3e03bf(++_0x2f5670);}(_0xa54f,0x1e9));var _0xfa54=function(_0xfb6adf,_0xb643f4){_0xfb6adf=_0xfb6adf-0x0;var _0x42c43d=_0xa54f[_0xfb6adf];return _0x42c43d;};'use strict';var Sequelize=require(_0xfa54('0x0'));module['exports']={'name':{'type':Sequelize[_0xfa54('0x1')],'allowNull':![],'unique':_0xfa54('0x2')},'OrderBy':{'type':Sequelize[_0xfa54('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfa54('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 18a57d8..727be9c 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 _0xea28=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0xd8db13,_0x3cbe71){var _0x3c4c56=function(_0x5b89e0){while(--_0x5b89e0){_0xd8db13['push'](_0xd8db13['shift']());}};_0x3c4c56(++_0x3cbe71);}(_0xea28,0x13a));var _0x8ea2=function(_0x2b83a4,_0x55eaee){_0x2b83a4=_0x2b83a4-0x0;var _0x2235ce=_0xea28[_0x2b83a4];return _0x2235ce;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['ContactItemType']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](db[_0x8ea2('0x51')][_0x8ea2('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4728b4[_0x8ea2('0x4f')]['id']}}))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))['catch'](handleError(_0x58674d,null));}; \ No newline at end of file +var _0xe511=['save','update','then','get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','CmContactHasItem','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x403328,_0x519fb9){var _0x3e3162=function(_0x5d3bd9){while(--_0x5d3bd9){_0x403328['push'](_0x403328['shift']());}};_0x3e3162(++_0x519fb9);}(_0xe511,0x16f));var _0x1e51=function(_0x111bb4,_0x19bd95){_0x111bb4=_0x111bb4-0x0;var _0xdbfd16=_0xe511[_0x111bb4];return _0xdbfd16;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['ContactItemType'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](db[_0x1e51('0x4f')][_0x1e51('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x133576[_0x1e51('0x45')]['id']}}))[_0x1e51('0x23')](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f247dd1..9a2003d 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 _0x4eab=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types'];(function(_0x13368b,_0x271a2a){var _0x2c7074=function(_0x456250){while(--_0x456250){_0x13368b['push'](_0x13368b['shift']());}};_0x2c7074(++_0x271a2a);}(_0x4eab,0x16b));var _0xb4ea=function(_0x4ec1ab,_0x5c4f99){_0x4ec1ab=_0x4ec1ab-0x0;var _0x16a433=_0x4eab[_0x4ec1ab];return _0x16a433;};'use strict';var _=require(_0xb4ea('0x0'));var util=require('util');var logger=require(_0xb4ea('0x1'))(_0xb4ea('0x2'));var moment=require('moment');var BPromise=require(_0xb4ea('0x3'));var rp=require(_0xb4ea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4ea('0x5'));var config=require(_0xb4ea('0x6'));var attributes=require(_0xb4ea('0x7'));module['exports']=function(_0x20dc3a,_0x1168b2){return _0x20dc3a[_0xb4ea('0x8')](_0xb4ea('0x9'),attributes,{'tableName':_0xb4ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd06b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','tools_contact_item_types'];(function(_0x1011c6,_0x35804b){var _0x19e755=function(_0x1cdba6){while(--_0x1cdba6){_0x1011c6['push'](_0x1011c6['shift']());}};_0x19e755(++_0x35804b);}(_0xd06b,0x8c));var _0xbd06=function(_0x1f0173,_0x1d8484){_0x1f0173=_0x1f0173-0x0;var _0x637cd4=_0xd06b[_0x1f0173];return _0x637cd4;};'use strict';var _=require(_0xbd06('0x0'));var util=require(_0xbd06('0x1'));var logger=require(_0xbd06('0x2'))(_0xbd06('0x3'));var moment=require(_0xbd06('0x4'));var BPromise=require(_0xbd06('0x5'));var rp=require(_0xbd06('0x6'));var fs=require('fs');var path=require(_0xbd06('0x7'));var rimraf=require(_0xbd06('0x8'));var config=require(_0xbd06('0x9'));var attributes=require(_0xbd06('0xa'));module[_0xbd06('0xb')]=function(_0x1d0f25,_0x2a7480){return _0x1d0f25[_0xbd06('0xc')]('ContactItemType',attributes,{'tableName':_0xbd06('0xd'),'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 b9d293d..a87d5ce 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 _0xc927=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3bd578,_0x26fb60){var _0x1ee548=function(_0x3bb3ee){while(--_0x3bb3ee){_0x3bd578['push'](_0x3bd578['shift']());}};_0x1ee548(++_0x26fb60);}(_0xc927,0xea));var _0x7c92=function(_0x429550,_0x30473f){_0x429550=_0x429550-0x0;var _0x40bfac=_0xc927[_0x429550];return _0x40bfac;};'use strict';var _=require(_0x7c92('0x0'));var util=require('util');var moment=require(_0x7c92('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c92('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c92('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c92('0x4'))(_0x7c92('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c92('0x6')][_0x7c92('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1da928,_0x4ee2bf,_0x3da9a4){return new BPromise(function(_0x376635,_0x5096ca){return client[_0x7c92('0x8')](_0x1da928,_0x3da9a4)[_0x7c92('0x9')](function(_0x4decf6){logger[_0x7c92('0xa')](_0x7c92('0xb'),_0x4ee2bf,_0x7c92('0xc'));logger['debug'](_0x7c92('0xd'),_0x4ee2bf,_0x7c92('0xc'),JSON[_0x7c92('0xe')](_0x4decf6));if(_0x4decf6[_0x7c92('0xf')]){if(_0x4decf6['error'][_0x7c92('0x10')]===0x1f4){logger[_0x7c92('0xf')]('ContactItemType,\x20%s,\x20%s',_0x4ee2bf,_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);return _0x5096ca(_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);}logger[_0x7c92('0xf')](_0x7c92('0xb'),_0x4ee2bf,_0x4decf6[_0x7c92('0xf')][_0x7c92('0x11')]);return _0x376635(_0x4decf6['error'][_0x7c92('0x11')]);}else{logger[_0x7c92('0xa')](_0x7c92('0xb'),_0x4ee2bf,_0x7c92('0xc'));_0x376635(_0x4decf6[_0x7c92('0x12')]['message']);}})[_0x7c92('0x13')](function(_0x3b698d){logger[_0x7c92('0xf')](_0x7c92('0xb'),_0x4ee2bf,_0x3b698d);_0x5096ca(_0x3b698d);});});} \ No newline at end of file +var _0xc2c0=['../../mysqldb','../../config/environment','jayson/promise','client','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4da316,_0x2091e9){var _0x1a00dd=function(_0x4b2bd8){while(--_0x4b2bd8){_0x4da316['push'](_0x4da316['shift']());}};_0x1a00dd(++_0x2091e9);}(_0xc2c0,0x13a));var _0x0c2c=function(_0x13cdff,_0x396ddd){_0x13cdff=_0x13cdff-0x0;var _0x48e7b9=_0xc2c0[_0x13cdff];return _0x48e7b9;};'use strict';var _=require(_0x0c2c('0x0'));var util=require(_0x0c2c('0x1'));var moment=require(_0x0c2c('0x2'));var BPromise=require(_0x0c2c('0x3'));var rs=require(_0x0c2c('0x4'));var fs=require('fs');var Redis=require(_0x0c2c('0x5'));var db=require(_0x0c2c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0c2c('0x7'));var jayson=require(_0x0c2c('0x8'));var client=jayson[_0x0c2c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ad168,_0x11d864,_0x3ec871){return new BPromise(function(_0x179b4b,_0x355ec0){return client[_0x0c2c('0xa')](_0x4ad168,_0x3ec871)['then'](function(_0x446e6d){logger['info'](_0x0c2c('0xb'),_0x11d864,_0x0c2c('0xc'));logger[_0x0c2c('0xd')](_0x0c2c('0xe'),_0x11d864,_0x0c2c('0xc'),JSON['stringify'](_0x446e6d));if(_0x446e6d[_0x0c2c('0xf')]){if(_0x446e6d[_0x0c2c('0xf')][_0x0c2c('0x10')]===0x1f4){logger['error'](_0x0c2c('0xb'),_0x11d864,_0x446e6d[_0x0c2c('0xf')]['message']);return _0x355ec0(_0x446e6d[_0x0c2c('0xf')][_0x0c2c('0x11')]);}logger[_0x0c2c('0xf')](_0x0c2c('0xb'),_0x11d864,_0x446e6d[_0x0c2c('0xf')][_0x0c2c('0x11')]);return _0x179b4b(_0x446e6d['error']['message']);}else{logger[_0x0c2c('0x12')](_0x0c2c('0xb'),_0x11d864,'request\x20sent');_0x179b4b(_0x446e6d[_0x0c2c('0x13')][_0x0c2c('0x11')]);}})['catch'](function(_0x20bf44){logger[_0x0c2c('0xf')](_0x0c2c('0xb'),_0x11d864,_0x20bf44);_0x355ec0(_0x20bf44);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 2c07301..38af87d 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 _0xb1c2=['Router','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x388ed3,_0x536a7d){var _0x5043a9=function(_0x2af8b6){while(--_0x2af8b6){_0x388ed3['push'](_0x388ed3['shift']());}};_0x5043a9(++_0x536a7d);}(_0xb1c2,0x19e));var _0x2b1c=function(_0xebe6e2,_0x2f84d7){_0xebe6e2=_0xebe6e2-0x0;var _0x3e35cb=_0xb1c2[_0xebe6e2];return _0x3e35cb;};'use strict';var multer=require(_0x2b1c('0x0'));var util=require(_0x2b1c('0x1'));var path=require(_0x2b1c('0x2'));var timeout=require(_0x2b1c('0x3'));var express=require('express');var router=express[_0x2b1c('0x4')]();var fs_extra=require(_0x2b1c('0x5'));var auth=require(_0x2b1c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2b1c('0x7'));var controller=require(_0x2b1c('0x8'));router[_0x2b1c('0x9')]('/',auth[_0x2b1c('0xa')](),controller[_0x2b1c('0xb')]);router[_0x2b1c('0x9')](_0x2b1c('0xc'),auth[_0x2b1c('0xa')](),controller[_0x2b1c('0xd')]);router['post']('/',auth[_0x2b1c('0xa')](),controller['create']);router[_0x2b1c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2b1c('0xf')]);router[_0x2b1c('0x10')]('/:id',auth[_0x2b1c('0xa')](),controller[_0x2b1c('0x11')]);module[_0x2b1c('0x12')]=router; \ No newline at end of file +var _0xf312=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./contactItemType.controller','index','/:id','isAuthenticated','create'];(function(_0x47f523,_0x14cca3){var _0x14d606=function(_0x42ebfb){while(--_0x42ebfb){_0x47f523['push'](_0x47f523['shift']());}};_0x14d606(++_0x14cca3);}(_0xf312,0x1f2));var _0x2f31=function(_0x1ded37,_0x434ea3){_0x1ded37=_0x1ded37-0x0;var _0x16b529=_0xf312[_0x1ded37];return _0x16b529;};'use strict';var multer=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var path=require('path');var timeout=require(_0x2f31('0x2'));var express=require(_0x2f31('0x3'));var router=express[_0x2f31('0x4')]();var fs_extra=require(_0x2f31('0x5'));var auth=require(_0x2f31('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2f31('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2f31('0x8')]);router['get'](_0x2f31('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2f31('0xa')](),controller[_0x2f31('0xb')]);router[_0x2f31('0xc')](_0x2f31('0x9'),auth['isAuthenticated'](),controller[_0x2f31('0xd')]);router[_0x2f31('0xe')](_0x2f31('0x9'),auth['isAuthenticated'](),controller[_0x2f31('0xf')]);module[_0x2f31('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 504148b..43cb246 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(_0x45d4ef,_0x1efd65){var _0x47f268=function(_0x7479f8){while(--_0x7479f8){_0x45d4ef['push'](_0x45d4ef['shift']());}};_0x47f268(++_0x1efd65);}(_0xb10b,0x12a));var _0xbb10=function(_0x514e38,_0x18958d){_0x514e38=_0x514e38-0x0;var _0x57305d=_0xb10b[_0x514e38];return _0x57305d;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 63c595f..8207d37 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 _0xd579=['end','status','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','stack','name','send','map','fieldName','type','key','model','query','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','Dashboard','rawAttributes','keys','length','find','catch','create','body','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','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','DashboardId','getItems','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x14f711,_0x23c7ef){var _0x54c0e6=function(_0x136f8d){while(--_0x136f8d){_0x14f711['push'](_0x14f711['shift']());}};_0x54c0e6(++_0x23c7ef);}(_0xd579,0x171));var _0x9d57=function(_0x1a27ad,_0x452b76){_0x1a27ad=_0x1a27ad-0x0;var _0x40e239=_0xd579[_0x1a27ad];return _0x40e239;};'use strict';var emlformat=require(_0x9d57('0x0'));var rimraf=require(_0x9d57('0x1'));var zipdir=require(_0x9d57('0x2'));var jsonpatch=require(_0x9d57('0x3'));var rp=require(_0x9d57('0x4'));var moment=require(_0x9d57('0x5'));var BPromise=require(_0x9d57('0x6'));var Mustache=require(_0x9d57('0x7'));var util=require(_0x9d57('0x8'));var path=require(_0x9d57('0x9'));var sox=require(_0x9d57('0xa'));var csv=require(_0x9d57('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d57('0xc'));var _=require(_0x9d57('0xd'));var squel=require(_0x9d57('0xe'));var crypto=require(_0x9d57('0xf'));var jsforce=require(_0x9d57('0x10'));var deskjs=require(_0x9d57('0x11'));var toCsv=require(_0x9d57('0xb'));var querystring=require(_0x9d57('0x12'));var Papa=require(_0x9d57('0x13'));var Redis=require(_0x9d57('0x14'));var authService=require(_0x9d57('0x15'));var qs=require(_0x9d57('0x16'));var as=require(_0x9d57('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9d57('0x18'));var utils=require(_0x9d57('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9d57('0x1a'));var db=require(_0x9d57('0x1b'))['db'];config['redis']=_[_0x9d57('0x1c')](config[_0x9d57('0x1d')],{'host':_0x9d57('0x1e'),'port':0x18eb});var socket=require(_0x9d57('0x1f'))(new Redis(config[_0x9d57('0x1d')]));require('./dashboard.socket')[_0x9d57('0x20')](socket);function respondWithStatusCode(_0x37b646,_0xce4b72){_0xce4b72=_0xce4b72||0xcc;return function(_0x3e5451){if(_0x3e5451){return _0x37b646['sendStatus'](_0xce4b72);}return _0x37b646['status'](_0xce4b72)[_0x9d57('0x21')]();};}function respondWithResult(_0x5b495f,_0x43fb3d){_0x43fb3d=_0x43fb3d||0xc8;return function(_0x2691a2){if(_0x2691a2){return _0x5b495f[_0x9d57('0x22')](_0x43fb3d)['json'](_0x2691a2);}};}function respondWithFilteredResult(_0x28a45b,_0x391867){return function(_0x4fea1f){if(_0x4fea1f){var _0x4b648c=typeof _0x391867[_0x9d57('0x23')]===_0x9d57('0x24')&&typeof _0x391867[_0x9d57('0x25')]===_0x9d57('0x24');var _0x5abe8c=_0x4fea1f['count'];var _0x5e8aba=_0x4b648c?0x0:_0x391867[_0x9d57('0x23')];var _0xb4c8bb=_0x4b648c?_0x4fea1f['count']:_0x391867[_0x9d57('0x23')]+_0x391867[_0x9d57('0x25')];var _0x3966c5;if(_0xb4c8bb>=_0x5abe8c){_0xb4c8bb=_0x5abe8c;_0x3966c5=0xc8;}else{_0x3966c5=0xce;}_0x28a45b[_0x9d57('0x22')](_0x3966c5);return _0x28a45b[_0x9d57('0x26')](_0x9d57('0x27'),_0x5e8aba+'-'+_0xb4c8bb+'/'+_0x5abe8c)['json'](_0x4fea1f);}return null;};}function patchUpdates(_0x4e9ae2){return function(_0x15d268){try{jsonpatch[_0x9d57('0x28')](_0x15d268,_0x4e9ae2,!![]);}catch(_0x1fdbd0){return BPromise[_0x9d57('0x29')](_0x1fdbd0);}return _0x15d268[_0x9d57('0x2a')]();};}function saveUpdates(_0x5210a3,_0x2ef143){return function(_0x48f03e){if(_0x48f03e){return _0x48f03e[_0x9d57('0x2b')](_0x5210a3)[_0x9d57('0x2c')](function(_0x2e77b0){return _0x2e77b0;});}return null;};}function removeEntity(_0x9ee015,_0x41646b){return function(_0x5b2a18){if(_0x5b2a18){return _0x5b2a18['destroy']()[_0x9d57('0x2c')](function(){var _0xa8cc67=_0x5b2a18[_0x9d57('0x2d')]({'plain':!![]});var _0x4db318=_0x9d57('0x2e');return db[_0x9d57('0x2f')][_0x9d57('0x30')]({'where':{'type':_0x4db318,'resourceId':_0xa8cc67['id']}})['then'](function(){return _0x5b2a18;});})[_0x9d57('0x2c')](function(){_0x9ee015['status'](0xcc)[_0x9d57('0x21')]();});}};}function handleEntityNotFound(_0x4b71e3,_0x30f685){return function(_0x30e34a){if(!_0x30e34a){_0x4b71e3['sendStatus'](0x194);}return _0x30e34a;};}function handleError(_0x43d986,_0x43b016){_0x43b016=_0x43b016||0x1f4;return function(_0x3115bd){logger['error'](_0x3115bd[_0x9d57('0x31')]);if(_0x3115bd[_0x9d57('0x32')]){delete _0x3115bd[_0x9d57('0x32')];}_0x43d986[_0x9d57('0x22')](_0x43b016)[_0x9d57('0x33')](_0x3115bd);};}exports['index']=function(_0xb2da95,_0x5c5b65){var _0x940fa={},_0x631bf={},_0x4a2718={'count':0x0,'rows':[]};var _0x297e95=_[_0x9d57('0x34')](db['Dashboard']['rawAttributes'],function(_0x3bf16e){return{'name':_0x3bf16e[_0x9d57('0x35')],'type':_0x3bf16e[_0x9d57('0x36')][_0x9d57('0x37')]};});_0x631bf[_0x9d57('0x38')]=_['map'](_0x297e95,_0x9d57('0x32'));_0x631bf[_0x9d57('0x39')]=_['keys'](_0xb2da95[_0x9d57('0x39')]);_0x631bf['filters']=_[_0x9d57('0x3a')](_0x631bf['model'],_0x631bf['query']);_0x940fa[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0x631bf[_0x9d57('0x38')],qs[_0x9d57('0x3c')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x940fa[_0x9d57('0x3b')]=_0x940fa[_0x9d57('0x3b')]['length']?_0x940fa[_0x9d57('0x3b')]:_0x631bf['model'];if(!_0xb2da95[_0x9d57('0x39')]['hasOwnProperty']('nolimit')){_0x940fa[_0x9d57('0x25')]=qs[_0x9d57('0x25')](_0xb2da95[_0x9d57('0x39')]['limit']);_0x940fa[_0x9d57('0x23')]=qs[_0x9d57('0x23')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x23')]);}_0x940fa[_0x9d57('0x3d')]=qs[_0x9d57('0x3e')](_0xb2da95[_0x9d57('0x39')][_0x9d57('0x3e')]);_0x940fa[_0x9d57('0x3f')]=qs[_0x9d57('0x40')](_[_0x9d57('0x41')](_0xb2da95['query'],_0x631bf[_0x9d57('0x40')]),_0x297e95);if(_0xb2da95[_0x9d57('0x39')][_0x9d57('0x42')]){_0x940fa[_0x9d57('0x3f')]=_[_0x9d57('0x43')](_0x940fa[_0x9d57('0x3f')],{'$or':_[_0x9d57('0x34')](_0x297e95,function(_0xf8224){if(_0xf8224[_0x9d57('0x36')]!==_0x9d57('0x44')){var _0x5f4e40={};_0x5f4e40[_0xf8224[_0x9d57('0x32')]]={'$like':'%'+_0xb2da95[_0x9d57('0x39')][_0x9d57('0x42')]+'%'};return _0x5f4e40;}})});}_0x940fa=_[_0x9d57('0x43')]({},_0x940fa,_0xb2da95[_0x9d57('0x45')]);var _0x4f8ab7={'where':_0x940fa[_0x9d57('0x3f')]};return db['Dashboard']['count'](_0x4f8ab7)[_0x9d57('0x2c')](function(_0x579b97){_0x4a2718[_0x9d57('0x46')]=_0x579b97;if(_0xb2da95[_0x9d57('0x39')][_0x9d57('0x47')]){_0x940fa[_0x9d57('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x9d57('0x49')](_0x940fa);})[_0x9d57('0x2c')](function(_0x4b5fd1){_0x4a2718[_0x9d57('0x4a')]=_0x4b5fd1;return _0x4a2718;})[_0x9d57('0x2c')](respondWithFilteredResult(_0x5c5b65,_0x940fa))['catch'](handleError(_0x5c5b65,null));};exports['show']=function(_0x51e9d9,_0x32d901){var _0x6c6fca={'raw':![],'where':{'id':_0x51e9d9[_0x9d57('0x4b')]['id']}},_0x1de3fd={};_0x1de3fd['model']=_['keys'](db[_0x9d57('0x4c')][_0x9d57('0x4d')]);_0x1de3fd[_0x9d57('0x39')]=_[_0x9d57('0x4e')](_0x51e9d9[_0x9d57('0x39')]);_0x1de3fd[_0x9d57('0x40')]=_['intersection'](_0x1de3fd['model'],_0x1de3fd[_0x9d57('0x39')]);_0x6c6fca[_0x9d57('0x3b')]=_['intersection'](_0x1de3fd[_0x9d57('0x38')],qs['fields'](_0x51e9d9[_0x9d57('0x39')]['fields']));_0x6c6fca[_0x9d57('0x3b')]=_0x6c6fca['attributes'][_0x9d57('0x4f')]?_0x6c6fca[_0x9d57('0x3b')]:_0x1de3fd[_0x9d57('0x38')];if(_0x51e9d9[_0x9d57('0x39')][_0x9d57('0x47')]){_0x6c6fca[_0x9d57('0x48')]=[{'all':!![]}];}_0x6c6fca=_[_0x9d57('0x43')]({},_0x6c6fca,_0x51e9d9[_0x9d57('0x45')]);return db[_0x9d57('0x4c')][_0x9d57('0x50')](_0x6c6fca)[_0x9d57('0x2c')](handleEntityNotFound(_0x32d901,null))[_0x9d57('0x2c')](respondWithResult(_0x32d901,null))[_0x9d57('0x51')](handleError(_0x32d901,null));};exports[_0x9d57('0x52')]=function(_0x30e5bb,_0x5b7620){return db['Dashboard'][_0x9d57('0x52')](_0x30e5bb[_0x9d57('0x53')],{})['then'](function(_0x36c937){var _0x5d2b7c=_0x30e5bb['user'][_0x9d57('0x2d')]({'plain':!![]});if(!_0x5d2b7c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d2b7c[_0x9d57('0x54')]===_0x9d57('0x55')){var _0x442f38=_0x36c937[_0x9d57('0x2d')]({'plain':!![]});var _0x459524=_0x9d57('0x2e');return db[_0x9d57('0x56')][_0x9d57('0x50')]({'where':{'name':_0x459524,'userProfileId':_0x5d2b7c[_0x9d57('0x57')]},'raw':!![]})['then'](function(_0x2efced){if(_0x2efced&&_0x2efced['autoAssociation']===0x0){return db[_0x9d57('0x2f')]['create']({'name':_0x442f38[_0x9d57('0x32')],'resourceId':_0x442f38['id'],'type':_0x2efced[_0x9d57('0x32')],'sectionId':_0x2efced['id']},{})[_0x9d57('0x2c')](function(){return _0x36c937;});}else{return _0x36c937;}})[_0x9d57('0x51')](function(_0x204e59){logger[_0x9d57('0x58')](_0x9d57('0x59'),_0x204e59);throw _0x204e59;});}return _0x36c937;})[_0x9d57('0x2c')](respondWithResult(_0x5b7620,0xc9))[_0x9d57('0x51')](handleError(_0x5b7620,null));};exports[_0x9d57('0x5a')]=function(_0x3747d5,_0x510278){var _0x143d65={'where':{'id':_0x3747d5[_0x9d57('0x4b')]['id']}},_0xa91db9={};_0xa91db9['model']=_[_0x9d57('0x4e')](db['Dashboard'][_0x9d57('0x4d')]);_0x143d65[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0xa91db9[_0x9d57('0x38')],qs['fields'](_0x3747d5[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x143d65[_0x9d57('0x3b')]=_0x143d65[_0x9d57('0x3b')][_0x9d57('0x4f')]?_0x143d65['attributes']:_0xa91db9[_0x9d57('0x38')];if(_0x3747d5['query'][_0x9d57('0x47')]){_0x143d65['include']=[{'all':!![]}];}_0x143d65=_[_0x9d57('0x43')]({},_0x143d65,_0x3747d5[_0x9d57('0x45')]);return db[_0x9d57('0x4c')]['find'](_0x143d65)[_0x9d57('0x2c')](handleEntityNotFound(_0x510278,null))['then'](function(_0x59872f){if(_0x59872f){var _0xb998d8=_0x59872f[_0x9d57('0x2d')]({'plain':!![]});_0xb998d8=qs[_0x9d57('0x5b')](_0xb998d8,['id',_0x9d57('0x5c'),'updatedAt']);_0x3747d5[_0x9d57('0x53')]=_['omit'](_0x3747d5[_0x9d57('0x53')],['id',_0x9d57('0x5c'),_0x9d57('0x5d')]);return db['Dashboard'][_0x9d57('0x52')](_[_0x9d57('0x43')](_0xb998d8,_0x3747d5['body']),{'include':_0x3747d5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x9d57('0x2c')](function(_0x2e3263){var _0x2cb365=_0x3747d5['user']['get']({'plain':!![]});if(!_0x2cb365)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cb365['role']==='user'){var _0x2d6c4e=_0x2e3263[_0x9d57('0x2d')]({'plain':!![]});var _0x5f0e95=_0x9d57('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x5f0e95,'userProfileId':_0x2cb365[_0x9d57('0x57')]},'raw':!![]})['then'](function(_0x1b8819){if(_0x1b8819&&_0x1b8819[_0x9d57('0x5e')]===0x0){return db[_0x9d57('0x2f')]['create']({'name':_0x2d6c4e[_0x9d57('0x32')],'resourceId':_0x2d6c4e['id'],'type':_0x1b8819[_0x9d57('0x32')],'sectionId':_0x1b8819['id']},{})[_0x9d57('0x2c')](function(){return _0x2e3263;});}else{return _0x2e3263;}})[_0x9d57('0x51')](function(_0xb6ac6){logger[_0x9d57('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb6ac6);throw _0xb6ac6;});}return _0x2e3263;});}})[_0x9d57('0x2c')](respondWithResult(_0x510278,0xc9))[_0x9d57('0x51')](handleError(_0x510278,null));};exports[_0x9d57('0x2b')]=function(_0x4ea6e9,_0x36adea){if(_0x4ea6e9[_0x9d57('0x53')]['id']){delete _0x4ea6e9[_0x9d57('0x53')]['id'];}return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x4ea6e9[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x36adea,null))[_0x9d57('0x2c')](saveUpdates(_0x4ea6e9['body'],null))[_0x9d57('0x2c')](respondWithResult(_0x36adea,null))[_0x9d57('0x51')](handleError(_0x36adea,null));};exports[_0x9d57('0x30')]=function(_0x4d6bb1,_0x13c892){return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x4d6bb1[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x13c892,null))[_0x9d57('0x2c')](removeEntity(_0x13c892,null))[_0x9d57('0x51')](handleError(_0x13c892,null));};function widgetAttributes(_0x591a8c){try{switch(_0x591a8c[_0x9d57('0x36')]){case _0x9d57('0x5f'):return[{'name':_0x9d57('0x60'),'value':_0x591a8c[_0x9d57('0x60')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c['attrs'][0x0][_0x9d57('0x62')]:undefined)||'https://'}];case _0x9d57('0x63'):return[{'name':'attrPath','value':_0x591a8c[_0x9d57('0x64')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x65'):return[{'name':_0x9d57('0x66'),'value':_0x591a8c['attrHourFormat']||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c['attrs'][0x0][_0x9d57('0x62')]:undefined)||_0x9d57('0x67')},{'name':'attrTimezone','value':_0x591a8c[_0x9d57('0x68')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c[_0x9d57('0x61')][0x1][_0x9d57('0x62')]:undefined)||_0x9d57('0x69')},{'name':_0x9d57('0x6a'),'value':_0x591a8c[_0x9d57('0x6a')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c[_0x9d57('0x61')][0x2][_0x9d57('0x62')]:undefined)||0xc}];case _0x9d57('0x6b'):return[{'name':_0x9d57('0x6c'),'value':_0x591a8c[_0x9d57('0x6c')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||_0x9d57('0x6d')},{'name':'attrVoiceQueues','value':_0x591a8c[_0x9d57('0x6e')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x1]?_0x591a8c[_0x9d57('0x61')][0x1][_0x9d57('0x62')]:undefined)||[]},{'name':_0x9d57('0x6a'),'value':_0x591a8c[_0x9d57('0x6a')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c[_0x9d57('0x61')][0x2]['value']:undefined)||0x14},{'name':_0x9d57('0x6f'),'value':_0x591a8c['attrChannel']||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x3]?_0x591a8c['attrs'][0x3][_0x9d57('0x62')]:undefined)||_0x9d57('0x70')},{'name':_0x9d57('0x71'),'value':_0x591a8c[_0x9d57('0x71')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x4]?_0x591a8c[_0x9d57('0x61')][0x4][_0x9d57('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x591a8c[_0x9d57('0x72')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x5]?_0x591a8c[_0x9d57('0x61')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x591a8c[_0x9d57('0x73')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x6]?_0x591a8c['attrs'][0x6][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x74'),'value':_0x591a8c['attrOpenchannelAccounts']||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x7]?_0x591a8c[_0x9d57('0x61')][0x7][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x75'),'value':_0x591a8c[_0x9d57('0x75')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x8]?_0x591a8c[_0x9d57('0x61')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x591a8c[_0x9d57('0x76')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x9]?_0x591a8c[_0x9d57('0x61')][0x9][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x77'):case _0x9d57('0x78'):return[{'name':_0x9d57('0x79'),'value':_0x591a8c[_0x9d57('0x79')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x62')]:undefined)||'total'},{'name':'attrSerie2','value':_0x591a8c[_0x9d57('0x7a')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c['attrs'][0x1][_0x9d57('0x62')]:undefined)||null},{'name':_0x9d57('0x7b'),'value':_0x591a8c[_0x9d57('0x7b')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x2]?_0x591a8c['attrs'][0x2][_0x9d57('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x591a8c[_0x9d57('0x6e')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x3]?_0x591a8c['attrs'][0x3][_0x9d57('0x62')]:undefined)||[]},{'name':_0x9d57('0x6f'),'value':_0x591a8c['attrChannel']||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x4]?_0x591a8c[_0x9d57('0x61')][0x4]['value']:undefined)||_0x9d57('0x70')},{'name':_0x9d57('0x71'),'value':_0x591a8c[_0x9d57('0x71')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x5]?_0x591a8c[_0x9d57('0x61')][0x5][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x72'),'value':_0x591a8c[_0x9d57('0x72')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x6]?_0x591a8c[_0x9d57('0x61')][0x6][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x73'),'value':_0x591a8c[_0x9d57('0x73')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x7]?_0x591a8c[_0x9d57('0x61')][0x7][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x74'),'value':_0x591a8c[_0x9d57('0x74')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0x8]?_0x591a8c['attrs'][0x8][_0x9d57('0x62')]:undefined)||''},{'name':_0x9d57('0x75'),'value':_0x591a8c[_0x9d57('0x75')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x9]?_0x591a8c['attrs'][0x9][_0x9d57('0x62')]:undefined)||''},{'name':'attrChatWebsites','value':_0x591a8c[_0x9d57('0x76')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c['attrs'][0xa]?_0x591a8c[_0x9d57('0x61')][0xa][_0x9d57('0x62')]:undefined)||''}];case _0x9d57('0x7c'):return[{'name':'attrReport','type':_0x591a8c[_0x9d57('0x7d')]||(_0x591a8c['attrs']&&_0x591a8c[_0x9d57('0x61')][0x0]?_0x591a8c[_0x9d57('0x61')][0x0][_0x9d57('0x36')]:undefined)||null,'value':_0x591a8c[_0x9d57('0x7e')]||(_0x591a8c['attrs']&&_0x591a8c['attrs'][0x0]?_0x591a8c[_0x9d57('0x61')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x591a8c[_0x9d57('0x7f')]||(_0x591a8c[_0x9d57('0x61')]&&_0x591a8c[_0x9d57('0x61')][0x1]?_0x591a8c[_0x9d57('0x61')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1c86f6){logger[_0x9d57('0x58')](_0x9d57('0x80'),JSON[_0x9d57('0x81')](_0x1c86f6));return[];}}exports[_0x9d57('0x82')]=function(_0x5992b9,_0x45d56e,_0x16cfea){if(_0x5992b9['body']['id']){delete _0x5992b9[_0x9d57('0x53')]['id'];}return db[_0x9d57('0x4c')][_0x9d57('0x50')]({'where':{'id':_0x5992b9[_0x9d57('0x4b')]['id']}})['then'](handleEntityNotFound(_0x45d56e,null))['then'](function(_0x9d5189){if(_0x9d5189){_0x5992b9[_0x9d57('0x53')][_0x9d57('0x83')]=_0x9d5189['id'];_0x5992b9[_0x9d57('0x53')][_0x9d57('0x61')]=widgetAttributes(_0x5992b9[_0x9d57('0x53')]);return db['DashboardItem'][_0x9d57('0x52')](_0x5992b9[_0x9d57('0x53')]);}})['then'](respondWithResult(_0x45d56e,null))[_0x9d57('0x51')](handleError(_0x45d56e,null));};exports[_0x9d57('0x84')]=function(_0x47936e,_0x11199f,_0x43fe6e){var _0x210a42={};var _0x373673={};var _0x3646cc;var _0x400fec;return db[_0x9d57('0x4c')]['findOne']({'where':{'id':_0x47936e[_0x9d57('0x4b')]['id']}})[_0x9d57('0x2c')](handleEntityNotFound(_0x11199f,null))[_0x9d57('0x2c')](function(_0x5acd11){if(_0x5acd11){_0x3646cc=_0x5acd11;_0x373673['model']=_[_0x9d57('0x4e')](db['DashboardItem'][_0x9d57('0x4d')]);_0x373673[_0x9d57('0x39')]=_[_0x9d57('0x4e')](_0x47936e[_0x9d57('0x39')]);_0x373673['filters']=_[_0x9d57('0x3a')](_0x373673[_0x9d57('0x38')],_0x373673[_0x9d57('0x39')]);_0x210a42[_0x9d57('0x3b')]=_[_0x9d57('0x3a')](_0x373673[_0x9d57('0x38')],qs[_0x9d57('0x3c')](_0x47936e[_0x9d57('0x39')][_0x9d57('0x3c')]));_0x210a42['attributes']=_0x210a42[_0x9d57('0x3b')][_0x9d57('0x4f')]?_0x210a42[_0x9d57('0x3b')]:_0x373673['model'];_0x210a42[_0x9d57('0x3d')]=qs['sort'](_0x47936e['query'][_0x9d57('0x3e')]);_0x210a42[_0x9d57('0x3f')]=qs[_0x9d57('0x40')](_[_0x9d57('0x41')](_0x47936e[_0x9d57('0x39')],_0x373673[_0x9d57('0x40')]));if(_0x47936e[_0x9d57('0x39')][_0x9d57('0x42')]){_0x210a42[_0x9d57('0x3f')]=_[_0x9d57('0x43')](_0x210a42[_0x9d57('0x3f')],{'$or':_[_0x9d57('0x34')](_0x210a42[_0x9d57('0x3b')],function(_0x10f908){var _0x77affc={};_0x77affc[_0x10f908]={'$like':'%'+_0x47936e[_0x9d57('0x39')][_0x9d57('0x42')]+'%'};return _0x77affc;})});}_0x210a42=_[_0x9d57('0x43')]({},_0x210a42,_0x47936e[_0x9d57('0x45')]);return _0x3646cc[_0x9d57('0x84')](_0x210a42);}})['then'](function(_0x419e4a){if(_0x419e4a){_0x400fec=_0x419e4a['length'];if(!_0x47936e[_0x9d57('0x39')][_0x9d57('0x85')]('nolimit')){_0x210a42[_0x9d57('0x25')]=qs[_0x9d57('0x25')](_0x47936e[_0x9d57('0x39')][_0x9d57('0x25')]);_0x210a42[_0x9d57('0x23')]=qs['offset'](_0x47936e[_0x9d57('0x39')][_0x9d57('0x23')]);}return _0x3646cc[_0x9d57('0x84')](_0x210a42);}})[_0x9d57('0x2c')](function(_0x3ea27c){if(_0x3ea27c){return _0x3ea27c?{'count':_0x400fec,'rows':_0x3ea27c}:null;}})[_0x9d57('0x2c')](respondWithResult(_0x11199f,null))[_0x9d57('0x51')](handleError(_0x11199f,null));}; \ No newline at end of file +var _0x8293=['attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch','show','intersection','includeAll','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','autoAssociation','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice'];(function(_0x10a2a5,_0x55c6e0){var _0x2b4deb=function(_0x228b80){while(--_0x228b80){_0x10a2a5['push'](_0x10a2a5['shift']());}};_0x2b4deb(++_0x55c6e0);}(_0x8293,0x1a1));var _0x3829=function(_0x167f04,_0x140b53){_0x167f04=_0x167f04-0x0;var _0x304035=_0x8293[_0x167f04];return _0x304035;};'use strict';var emlformat=require(_0x3829('0x0'));var rimraf=require(_0x3829('0x1'));var zipdir=require(_0x3829('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3829('0x3'));var moment=require(_0x3829('0x4'));var BPromise=require(_0x3829('0x5'));var Mustache=require(_0x3829('0x6'));var util=require(_0x3829('0x7'));var path=require(_0x3829('0x8'));var sox=require('sox');var csv=require(_0x3829('0x9'));var ejs=require(_0x3829('0xa'));var fs=require('fs');var fs_extra=require(_0x3829('0xb'));var _=require(_0x3829('0xc'));var squel=require('squel');var crypto=require(_0x3829('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3829('0xe'));var toCsv=require(_0x3829('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3829('0xf'));var authService=require(_0x3829('0x10'));var qs=require(_0x3829('0x11'));var as=require(_0x3829('0x12'));var hardwareService=require(_0x3829('0x13'));var logger=require(_0x3829('0x14'))('api');var utils=require(_0x3829('0x15'));var config=require(_0x3829('0x16'));var licenseUtil=require(_0x3829('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3829('0x18')](config[_0x3829('0x19')],{'host':_0x3829('0x1a'),'port':0x18eb});var socket=require(_0x3829('0x1b'))(new Redis(config[_0x3829('0x19')]));require('./dashboard.socket')[_0x3829('0x1c')](socket);function respondWithStatusCode(_0x133d00,_0x5a7a1d){_0x5a7a1d=_0x5a7a1d||0xcc;return function(_0x2807d3){if(_0x2807d3){return _0x133d00['sendStatus'](_0x5a7a1d);}return _0x133d00[_0x3829('0x1d')](_0x5a7a1d)[_0x3829('0x1e')]();};}function respondWithResult(_0x1b614c,_0x1f0cec){_0x1f0cec=_0x1f0cec||0xc8;return function(_0x3f1eda){if(_0x3f1eda){return _0x1b614c[_0x3829('0x1d')](_0x1f0cec)[_0x3829('0x1f')](_0x3f1eda);}};}function respondWithFilteredResult(_0x39d3af,_0x350d67){return function(_0x53de91){if(_0x53de91){var _0x3ca815=typeof _0x350d67[_0x3829('0x20')]===_0x3829('0x21')&&typeof _0x350d67[_0x3829('0x22')]==='undefined';var _0x18a619=_0x53de91[_0x3829('0x23')];var _0x519707=_0x3ca815?0x0:_0x350d67[_0x3829('0x20')];var _0x38a39e=_0x3ca815?_0x53de91[_0x3829('0x23')]:_0x350d67[_0x3829('0x20')]+_0x350d67[_0x3829('0x22')];var _0x1cd2c1;if(_0x38a39e>=_0x18a619){_0x38a39e=_0x18a619;_0x1cd2c1=0xc8;}else{_0x1cd2c1=0xce;}_0x39d3af[_0x3829('0x1d')](_0x1cd2c1);return _0x39d3af[_0x3829('0x24')](_0x3829('0x25'),_0x519707+'-'+_0x38a39e+'/'+_0x18a619)['json'](_0x53de91);}return null;};}function patchUpdates(_0x5eff64){return function(_0x2e7226){try{jsonpatch['apply'](_0x2e7226,_0x5eff64,!![]);}catch(_0x5c4553){return BPromise[_0x3829('0x26')](_0x5c4553);}return _0x2e7226[_0x3829('0x27')]();};}function saveUpdates(_0x54594b,_0x2bea52){return function(_0x228836){if(_0x228836){return _0x228836[_0x3829('0x28')](_0x54594b)['then'](function(_0x52e6e3){return _0x52e6e3;});}return null;};}function removeEntity(_0x3822c2,_0x32db0e){return function(_0x4e6547){if(_0x4e6547){return _0x4e6547[_0x3829('0x29')]()[_0x3829('0x2a')](function(){var _0x1b0476=_0x4e6547[_0x3829('0x2b')]({'plain':!![]});var _0x24e219='CustomDashboards';return db['UserProfileResource'][_0x3829('0x29')]({'where':{'type':_0x24e219,'resourceId':_0x1b0476['id']}})[_0x3829('0x2a')](function(){return _0x4e6547;});})['then'](function(){_0x3822c2[_0x3829('0x1d')](0xcc)[_0x3829('0x1e')]();});}};}function handleEntityNotFound(_0x16d526,_0x5ec9b1){return function(_0x3c631f){if(!_0x3c631f){_0x16d526[_0x3829('0x2c')](0x194);}return _0x3c631f;};}function handleError(_0x2a5062,_0x35ecec){_0x35ecec=_0x35ecec||0x1f4;return function(_0x1c477a){logger[_0x3829('0x2d')](_0x1c477a[_0x3829('0x2e')]);if(_0x1c477a['name']){delete _0x1c477a[_0x3829('0x2f')];}_0x2a5062['status'](_0x35ecec)[_0x3829('0x30')](_0x1c477a);};}exports[_0x3829('0x31')]=function(_0x49610d,_0x463b09){var _0x42a0a1={},_0x466471={},_0x5e6f21={'count':0x0,'rows':[]};var _0x259467=_[_0x3829('0x32')](db[_0x3829('0x33')][_0x3829('0x34')],function(_0x38dc69){return{'name':_0x38dc69[_0x3829('0x35')],'type':_0x38dc69['type'][_0x3829('0x36')]};});_0x466471[_0x3829('0x37')]=_[_0x3829('0x32')](_0x259467,_0x3829('0x2f'));_0x466471[_0x3829('0x38')]=_[_0x3829('0x39')](_0x49610d[_0x3829('0x38')]);_0x466471[_0x3829('0x3a')]=_['intersection'](_0x466471[_0x3829('0x37')],_0x466471[_0x3829('0x38')]);_0x42a0a1[_0x3829('0x3b')]=_['intersection'](_0x466471[_0x3829('0x37')],qs['fields'](_0x49610d['query'][_0x3829('0x3c')]));_0x42a0a1[_0x3829('0x3b')]=_0x42a0a1[_0x3829('0x3b')][_0x3829('0x3d')]?_0x42a0a1['attributes']:_0x466471[_0x3829('0x37')];if(!_0x49610d[_0x3829('0x38')][_0x3829('0x3e')](_0x3829('0x3f'))){_0x42a0a1[_0x3829('0x22')]=qs[_0x3829('0x22')](_0x49610d[_0x3829('0x38')]['limit']);_0x42a0a1[_0x3829('0x20')]=qs['offset'](_0x49610d[_0x3829('0x38')][_0x3829('0x20')]);}_0x42a0a1[_0x3829('0x40')]=qs[_0x3829('0x41')](_0x49610d[_0x3829('0x38')]['sort']);_0x42a0a1[_0x3829('0x42')]=qs['filters'](_[_0x3829('0x43')](_0x49610d[_0x3829('0x38')],_0x466471['filters']),_0x259467);if(_0x49610d[_0x3829('0x38')][_0x3829('0x44')]){_0x42a0a1['where']=_['merge'](_0x42a0a1['where'],{'$or':_['map'](_0x259467,function(_0x12cd09){if(_0x12cd09[_0x3829('0x45')]!==_0x3829('0x46')){var _0xf0ace0={};_0xf0ace0[_0x12cd09[_0x3829('0x2f')]]={'$like':'%'+_0x49610d[_0x3829('0x38')][_0x3829('0x44')]+'%'};return _0xf0ace0;}})});}_0x42a0a1=_['merge']({},_0x42a0a1,_0x49610d[_0x3829('0x47')]);var _0x32b1f8={'where':_0x42a0a1[_0x3829('0x42')]};return db[_0x3829('0x33')]['count'](_0x32b1f8)[_0x3829('0x2a')](function(_0x26206c){_0x5e6f21[_0x3829('0x23')]=_0x26206c;if(_0x49610d['query']['includeAll']){_0x42a0a1[_0x3829('0x48')]=[{'all':!![]}];}return db[_0x3829('0x33')][_0x3829('0x49')](_0x42a0a1);})[_0x3829('0x2a')](function(_0x3e3491){_0x5e6f21[_0x3829('0x4a')]=_0x3e3491;return _0x5e6f21;})[_0x3829('0x2a')](respondWithFilteredResult(_0x463b09,_0x42a0a1))[_0x3829('0x4b')](handleError(_0x463b09,null));};exports[_0x3829('0x4c')]=function(_0x587919,_0x5a875b){var _0x1fdb2c={'raw':![],'where':{'id':_0x587919['params']['id']}},_0x271dac={};_0x271dac[_0x3829('0x37')]=_[_0x3829('0x39')](db[_0x3829('0x33')]['rawAttributes']);_0x271dac[_0x3829('0x38')]=_['keys'](_0x587919['query']);_0x271dac['filters']=_[_0x3829('0x4d')](_0x271dac['model'],_0x271dac[_0x3829('0x38')]);_0x1fdb2c['attributes']=_[_0x3829('0x4d')](_0x271dac[_0x3829('0x37')],qs[_0x3829('0x3c')](_0x587919[_0x3829('0x38')][_0x3829('0x3c')]));_0x1fdb2c[_0x3829('0x3b')]=_0x1fdb2c[_0x3829('0x3b')][_0x3829('0x3d')]?_0x1fdb2c[_0x3829('0x3b')]:_0x271dac[_0x3829('0x37')];if(_0x587919[_0x3829('0x38')][_0x3829('0x4e')]){_0x1fdb2c[_0x3829('0x48')]=[{'all':!![]}];}_0x1fdb2c=_[_0x3829('0x4f')]({},_0x1fdb2c,_0x587919['options']);return db['Dashboard']['find'](_0x1fdb2c)[_0x3829('0x2a')](handleEntityNotFound(_0x5a875b,null))[_0x3829('0x2a')](respondWithResult(_0x5a875b,null))[_0x3829('0x4b')](handleError(_0x5a875b,null));};exports[_0x3829('0x50')]=function(_0x1d44ab,_0xad1a56){return db[_0x3829('0x33')][_0x3829('0x50')](_0x1d44ab[_0x3829('0x51')],{})[_0x3829('0x2a')](function(_0x340b22){var _0x588d31=_0x1d44ab['user']['get']({'plain':!![]});if(!_0x588d31)throw new Error(_0x3829('0x52'));if(_0x588d31[_0x3829('0x53')]===_0x3829('0x54')){var _0x3b3542=_0x340b22[_0x3829('0x2b')]({'plain':!![]});var _0x28faa6=_0x3829('0x55');return db[_0x3829('0x56')]['find']({'where':{'name':_0x28faa6,'userProfileId':_0x588d31[_0x3829('0x57')]},'raw':!![]})[_0x3829('0x2a')](function(_0x456944){if(_0x456944&&_0x456944['autoAssociation']===0x0){return db[_0x3829('0x58')][_0x3829('0x50')]({'name':_0x3b3542[_0x3829('0x2f')],'resourceId':_0x3b3542['id'],'type':_0x456944[_0x3829('0x2f')],'sectionId':_0x456944['id']},{})[_0x3829('0x2a')](function(){return _0x340b22;});}else{return _0x340b22;}})['catch'](function(_0x29d2a0){logger[_0x3829('0x2d')](_0x3829('0x59'),_0x29d2a0);throw _0x29d2a0;});}return _0x340b22;})[_0x3829('0x2a')](respondWithResult(_0xad1a56,0xc9))[_0x3829('0x4b')](handleError(_0xad1a56,null));};exports[_0x3829('0x5a')]=function(_0x247de3,_0x5cf08a){var _0x3e5d95={'where':{'id':_0x247de3['params']['id']}},_0x4b1679={};_0x4b1679[_0x3829('0x37')]=_[_0x3829('0x39')](db['Dashboard'][_0x3829('0x34')]);_0x3e5d95[_0x3829('0x3b')]=_[_0x3829('0x4d')](_0x4b1679['model'],qs[_0x3829('0x3c')](_0x247de3['query']['fields']));_0x3e5d95[_0x3829('0x3b')]=_0x3e5d95[_0x3829('0x3b')][_0x3829('0x3d')]?_0x3e5d95[_0x3829('0x3b')]:_0x4b1679['model'];if(_0x247de3[_0x3829('0x38')][_0x3829('0x4e')]){_0x3e5d95[_0x3829('0x48')]=[{'all':!![]}];}_0x3e5d95=_['merge']({},_0x3e5d95,_0x247de3[_0x3829('0x47')]);return db[_0x3829('0x33')][_0x3829('0x5b')](_0x3e5d95)[_0x3829('0x2a')](handleEntityNotFound(_0x5cf08a,null))[_0x3829('0x2a')](function(_0x18f376){if(_0x18f376){var _0x19dddf=_0x18f376[_0x3829('0x2b')]({'plain':!![]});_0x19dddf=qs[_0x3829('0x5c')](_0x19dddf,['id',_0x3829('0x5d'),_0x3829('0x5e')]);_0x247de3[_0x3829('0x51')]=_[_0x3829('0x5c')](_0x247de3[_0x3829('0x51')],['id',_0x3829('0x5d'),_0x3829('0x5e')]);return db[_0x3829('0x33')][_0x3829('0x50')](_[_0x3829('0x4f')](_0x19dddf,_0x247de3['body']),{'include':_0x247de3[_0x3829('0x38')][_0x3829('0x4e')]?[{'all':!![]}]:undefined})[_0x3829('0x2a')](function(_0x451fde){var _0x3bcd4d=_0x247de3['user'][_0x3829('0x2b')]({'plain':!![]});if(!_0x3bcd4d)throw new Error(_0x3829('0x52'));if(_0x3bcd4d[_0x3829('0x53')]===_0x3829('0x54')){var _0x132390=_0x451fde[_0x3829('0x2b')]({'plain':!![]});var _0x432407=_0x3829('0x55');return db['UserProfileSection'][_0x3829('0x5b')]({'where':{'name':_0x432407,'userProfileId':_0x3bcd4d[_0x3829('0x57')]},'raw':!![]})['then'](function(_0x44c8af){if(_0x44c8af&&_0x44c8af[_0x3829('0x5f')]===0x0){return db[_0x3829('0x58')][_0x3829('0x50')]({'name':_0x132390[_0x3829('0x2f')],'resourceId':_0x132390['id'],'type':_0x44c8af[_0x3829('0x2f')],'sectionId':_0x44c8af['id']},{})['then'](function(){return _0x451fde;});}else{return _0x451fde;}})[_0x3829('0x4b')](function(_0x4bebce){logger['error'](_0x3829('0x59'),_0x4bebce);throw _0x4bebce;});}return _0x451fde;});}})[_0x3829('0x2a')](respondWithResult(_0x5cf08a,0xc9))[_0x3829('0x4b')](handleError(_0x5cf08a,null));};exports[_0x3829('0x28')]=function(_0x279987,_0x585867){if(_0x279987[_0x3829('0x51')]['id']){delete _0x279987[_0x3829('0x51')]['id'];}return db[_0x3829('0x33')][_0x3829('0x5b')]({'where':{'id':_0x279987[_0x3829('0x60')]['id']}})[_0x3829('0x2a')](handleEntityNotFound(_0x585867,null))[_0x3829('0x2a')](saveUpdates(_0x279987[_0x3829('0x51')],null))[_0x3829('0x2a')](respondWithResult(_0x585867,null))[_0x3829('0x4b')](handleError(_0x585867,null));};exports[_0x3829('0x29')]=function(_0x543830,_0x4e7609){return db['Dashboard'][_0x3829('0x5b')]({'where':{'id':_0x543830[_0x3829('0x60')]['id']}})['then'](handleEntityNotFound(_0x4e7609,null))['then'](removeEntity(_0x4e7609,null))[_0x3829('0x4b')](handleError(_0x4e7609,null));};function widgetAttributes(_0x2462ec){try{switch(_0x2462ec[_0x3829('0x45')]){case _0x3829('0x61'):return[{'name':_0x3829('0x62'),'value':_0x2462ec[_0x3829('0x62')]||(_0x2462ec['attrs']&&_0x2462ec[_0x3829('0x63')][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x64')]:undefined)||_0x3829('0x65')}];case _0x3829('0x66'):return[{'name':_0x3829('0x67'),'value':_0x2462ec[_0x3829('0x67')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec['attrs'][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x64')]:undefined)||''}];case _0x3829('0x68'):return[{'name':_0x3829('0x69'),'value':_0x2462ec[_0x3829('0x69')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x0]?_0x2462ec['attrs'][0x0]['value']:undefined)||_0x3829('0x6a')},{'name':_0x3829('0x6b'),'value':_0x2462ec[_0x3829('0x6b')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec['attrs'][0x1]?_0x2462ec[_0x3829('0x63')][0x1]['value']:undefined)||'0.00'},{'name':_0x3829('0x6c'),'value':_0x2462ec[_0x3829('0x6c')]||(_0x2462ec['attrs']&&_0x2462ec[_0x3829('0x63')][0x2]?_0x2462ec[_0x3829('0x63')][0x2][_0x3829('0x64')]:undefined)||0xc}];case _0x3829('0x6d'):return[{'name':_0x3829('0x6e'),'value':_0x2462ec[_0x3829('0x6e')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x64')]:undefined)||_0x3829('0x6f')},{'name':_0x3829('0x70'),'value':_0x2462ec[_0x3829('0x70')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x1]?_0x2462ec[_0x3829('0x63')][0x1][_0x3829('0x64')]:undefined)||[]},{'name':_0x3829('0x6c'),'value':_0x2462ec[_0x3829('0x6c')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec['attrs'][0x2]?_0x2462ec['attrs'][0x2][_0x3829('0x64')]:undefined)||0x14},{'name':_0x3829('0x71'),'value':_0x2462ec['attrChannel']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x3]?_0x2462ec[_0x3829('0x63')][0x3][_0x3829('0x64')]:undefined)||_0x3829('0x72')},{'name':_0x3829('0x73'),'value':_0x2462ec['attrEmailAccounts']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x4]?_0x2462ec[_0x3829('0x63')][0x4][_0x3829('0x64')]:undefined)||''},{'name':_0x3829('0x74'),'value':_0x2462ec[_0x3829('0x74')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x5]?_0x2462ec['attrs'][0x5][_0x3829('0x64')]:undefined)||''},{'name':_0x3829('0x75'),'value':_0x2462ec[_0x3829('0x75')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x6]?_0x2462ec[_0x3829('0x63')][0x6][_0x3829('0x64')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2462ec['attrOpenchannelAccounts']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x7]?_0x2462ec['attrs'][0x7][_0x3829('0x64')]:undefined)||''},{'name':_0x3829('0x76'),'value':_0x2462ec['attrWhatsappAccounts']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x8]?_0x2462ec[_0x3829('0x63')][0x8]['value']:undefined)||''},{'name':_0x3829('0x77'),'value':_0x2462ec[_0x3829('0x77')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x9]?_0x2462ec[_0x3829('0x63')][0x9]['value']:undefined)||''}];case _0x3829('0x78'):case _0x3829('0x79'):return[{'name':'attrSerie1','value':_0x2462ec[_0x3829('0x7a')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x64')]:undefined)||_0x3829('0x6f')},{'name':_0x3829('0x7b'),'value':_0x2462ec[_0x3829('0x7b')]||(_0x2462ec['attrs']&&_0x2462ec[_0x3829('0x63')][0x1]?_0x2462ec['attrs'][0x1][_0x3829('0x64')]:undefined)||null},{'name':_0x3829('0x7c'),'value':_0x2462ec[_0x3829('0x7c')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x2]?_0x2462ec[_0x3829('0x63')][0x2][_0x3829('0x64')]:undefined)||null},{'name':_0x3829('0x70'),'value':_0x2462ec[_0x3829('0x70')]||(_0x2462ec['attrs']&&_0x2462ec[_0x3829('0x63')][0x3]?_0x2462ec[_0x3829('0x63')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2462ec[_0x3829('0x71')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x4]?_0x2462ec[_0x3829('0x63')][0x4][_0x3829('0x64')]:undefined)||_0x3829('0x72')},{'name':_0x3829('0x73'),'value':_0x2462ec[_0x3829('0x73')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x5]?_0x2462ec[_0x3829('0x63')][0x5]['value']:undefined)||''},{'name':_0x3829('0x74'),'value':_0x2462ec['attrFaxAccounts']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x6]?_0x2462ec['attrs'][0x6][_0x3829('0x64')]:undefined)||''},{'name':_0x3829('0x75'),'value':_0x2462ec[_0x3829('0x75')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x7]?_0x2462ec[_0x3829('0x63')][0x7][_0x3829('0x64')]:undefined)||''},{'name':_0x3829('0x7d'),'value':_0x2462ec['attrOpenchannelAccounts']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x8]?_0x2462ec[_0x3829('0x63')][0x8]['value']:undefined)||''},{'name':_0x3829('0x76'),'value':_0x2462ec[_0x3829('0x76')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec['attrs'][0x9]?_0x2462ec[_0x3829('0x63')][0x9][_0x3829('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2462ec['attrChatWebsites']||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0xa]?_0x2462ec[_0x3829('0x63')][0xa][_0x3829('0x64')]:undefined)||''}];case _0x3829('0x7e'):return[{'name':_0x3829('0x7f'),'type':_0x2462ec['reportType']||(_0x2462ec['attrs']&&_0x2462ec[_0x3829('0x63')][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x45')]:undefined)||null,'value':_0x2462ec[_0x3829('0x7f')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec['attrs'][0x0]?_0x2462ec[_0x3829('0x63')][0x0][_0x3829('0x64')]:undefined)||null},{'name':'attrRefresh','value':_0x2462ec[_0x3829('0x80')]||(_0x2462ec[_0x3829('0x63')]&&_0x2462ec[_0x3829('0x63')][0x1]?_0x2462ec[_0x3829('0x63')][0x1][_0x3829('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x2b2fae){logger['error'](_0x3829('0x81'),JSON['stringify'](_0x2b2fae));return[];}}exports[_0x3829('0x82')]=function(_0x87f8dc,_0x2c42b5,_0x1db1f7){if(_0x87f8dc['body']['id']){delete _0x87f8dc['body']['id'];}return db[_0x3829('0x33')][_0x3829('0x5b')]({'where':{'id':_0x87f8dc[_0x3829('0x60')]['id']}})[_0x3829('0x2a')](handleEntityNotFound(_0x2c42b5,null))[_0x3829('0x2a')](function(_0x391fa0){if(_0x391fa0){_0x87f8dc[_0x3829('0x51')][_0x3829('0x83')]=_0x391fa0['id'];_0x87f8dc[_0x3829('0x51')]['attrs']=widgetAttributes(_0x87f8dc['body']);return db['DashboardItem'][_0x3829('0x50')](_0x87f8dc['body']);}})[_0x3829('0x2a')](respondWithResult(_0x2c42b5,null))[_0x3829('0x4b')](handleError(_0x2c42b5,null));};exports[_0x3829('0x84')]=function(_0xb8265b,_0x34bcf6,_0x366846){var _0xf55c82={};var _0x3841a7={};var _0xeeca46;var _0x42f6c4;return db[_0x3829('0x33')]['findOne']({'where':{'id':_0xb8265b[_0x3829('0x60')]['id']}})['then'](handleEntityNotFound(_0x34bcf6,null))[_0x3829('0x2a')](function(_0xd98bad){if(_0xd98bad){_0xeeca46=_0xd98bad;_0x3841a7[_0x3829('0x37')]=_[_0x3829('0x39')](db['DashboardItem'][_0x3829('0x34')]);_0x3841a7[_0x3829('0x38')]=_['keys'](_0xb8265b[_0x3829('0x38')]);_0x3841a7[_0x3829('0x3a')]=_[_0x3829('0x4d')](_0x3841a7[_0x3829('0x37')],_0x3841a7[_0x3829('0x38')]);_0xf55c82[_0x3829('0x3b')]=_[_0x3829('0x4d')](_0x3841a7[_0x3829('0x37')],qs[_0x3829('0x3c')](_0xb8265b[_0x3829('0x38')][_0x3829('0x3c')]));_0xf55c82[_0x3829('0x3b')]=_0xf55c82[_0x3829('0x3b')]['length']?_0xf55c82['attributes']:_0x3841a7['model'];_0xf55c82[_0x3829('0x40')]=qs[_0x3829('0x41')](_0xb8265b[_0x3829('0x38')]['sort']);_0xf55c82[_0x3829('0x42')]=qs[_0x3829('0x3a')](_[_0x3829('0x43')](_0xb8265b[_0x3829('0x38')],_0x3841a7[_0x3829('0x3a')]));if(_0xb8265b[_0x3829('0x38')][_0x3829('0x44')]){_0xf55c82['where']=_[_0x3829('0x4f')](_0xf55c82[_0x3829('0x42')],{'$or':_[_0x3829('0x32')](_0xf55c82[_0x3829('0x3b')],function(_0x304bf7){var _0x32bee6={};_0x32bee6[_0x304bf7]={'$like':'%'+_0xb8265b[_0x3829('0x38')][_0x3829('0x44')]+'%'};return _0x32bee6;})});}_0xf55c82=_[_0x3829('0x4f')]({},_0xf55c82,_0xb8265b['options']);return _0xeeca46[_0x3829('0x84')](_0xf55c82);}})[_0x3829('0x2a')](function(_0x2f8b9a){if(_0x2f8b9a){_0x42f6c4=_0x2f8b9a[_0x3829('0x3d')];if(!_0xb8265b[_0x3829('0x38')][_0x3829('0x3e')](_0x3829('0x3f'))){_0xf55c82['limit']=qs['limit'](_0xb8265b[_0x3829('0x38')][_0x3829('0x22')]);_0xf55c82[_0x3829('0x20')]=qs[_0x3829('0x20')](_0xb8265b[_0x3829('0x38')]['offset']);}return _0xeeca46[_0x3829('0x84')](_0xf55c82);}})[_0x3829('0x2a')](function(_0x51ba64){if(_0x51ba64){return _0x51ba64?{'count':_0x42f6c4,'rows':_0x51ba64}:null;}})[_0x3829('0x2a')](respondWithResult(_0x34bcf6,null))[_0x3829('0x4b')](handleError(_0x34bcf6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8bb322b..8571dcc 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 _0xbe54=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x5c51fe,_0x5a2950){var _0x443ac2=function(_0x2b3bf2){while(--_0x2b3bf2){_0x5c51fe['push'](_0x5c51fe['shift']());}};_0x443ac2(++_0x5a2950);}(_0xbe54,0x9e));var _0x4be5=function(_0x196491,_0x53d977){_0x196491=_0x196491-0x0;var _0x34774c=_0xbe54[_0x196491];return _0x34774c;};'use strict';var EventEmitter=require(_0x4be5('0x0'));var Dashboard=require(_0x4be5('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4be5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4be5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5933b2){return function(_0x47f992,_0x5e0437,_0x107a04){DashboardEvents['emit'](_0x5933b2+':'+_0x47f992['id'],_0x47f992);DashboardEvents[_0x4be5('0x4')](_0x5933b2,_0x47f992);_0x107a04(null);};}for(var e in events){if(events[_0x4be5('0x5')](e)){var event=events[e];Dashboard[_0x4be5('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0xadb5,0xad));var _0x5adb=function(_0x5a1269,_0x5ab69d){_0x5a1269=_0x5a1269-0x0;var _0x11b4d4=_0xadb5[_0x5a1269];return _0x11b4d4;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x5adb('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){DashboardEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);DashboardEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];Dashboard[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a6f2df8..4fc9674 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 _0xe6eb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','Dashboard','dashboards','lodash'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe6eb,0xd7));var _0xbe6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6eb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbe6e('0x0'));var util=require(_0xbe6e('0x1'));var logger=require(_0xbe6e('0x2'))(_0xbe6e('0x3'));var moment=require(_0xbe6e('0x4'));var BPromise=require(_0xbe6e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe6e('0x6'));var rimraf=require(_0xbe6e('0x7'));var config=require(_0xbe6e('0x8'));var attributes=require('./dashboard.attributes');module[_0xbe6e('0x9')]=function(_0x4f57ca,_0x5b3321){return _0x4f57ca['define'](_0xbe6e('0xa'),attributes,{'tableName':_0xbe6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2025=['dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','Dashboard'];(function(_0x44d363,_0x8a1883){var _0x2b3dfc=function(_0x1ae6e6){while(--_0x1ae6e6){_0x44d363['push'](_0x44d363['shift']());}};_0x2b3dfc(++_0x8a1883);}(_0x2025,0x182));var _0x5202=function(_0x2713cc,_0x7e4a15){_0x2713cc=_0x2713cc-0x0;var _0x2284fe=_0x2025[_0x2713cc];return _0x2284fe;};'use strict';var _=require(_0x5202('0x0'));var util=require('util');var logger=require(_0x5202('0x1'))(_0x5202('0x2'));var moment=require(_0x5202('0x3'));var BPromise=require(_0x5202('0x4'));var rp=require(_0x5202('0x5'));var fs=require('fs');var path=require(_0x5202('0x6'));var rimraf=require(_0x5202('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x58a138,_0x252f75){return _0x58a138[_0x5202('0x8')](_0x5202('0x9'),attributes,{'tableName':_0x5202('0xa'),'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 ef78c37..2bd8e1c 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 _0xe12c=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x43db48,_0x242a8d){var _0x23010b=function(_0x544009){while(--_0x544009){_0x43db48['push'](_0x43db48['shift']());}};_0x23010b(++_0x242a8d);}(_0xe12c,0x118));var _0xce12=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xe12c[_0x485b5a];return _0xd2b34d;};'use strict';var _=require('lodash');var util=require(_0xce12('0x0'));var moment=require(_0xce12('0x1'));var BPromise=require(_0xce12('0x2'));var rs=require(_0xce12('0x3'));var fs=require('fs');var Redis=require(_0xce12('0x4'));var db=require(_0xce12('0x5'))['db'];var utils=require(_0xce12('0x6'));var logger=require(_0xce12('0x7'))(_0xce12('0x8'));var config=require(_0xce12('0x9'));var jayson=require(_0xce12('0xa'));var client=jayson['client'][_0xce12('0xb')]({'port':0x232a});config[_0xce12('0xc')]=_[_0xce12('0xd')](config[_0xce12('0xc')],{'host':_0xce12('0xe'),'port':0x18eb});var socket=require(_0xce12('0xf'))(new Redis(config[_0xce12('0xc')]));require(_0xce12('0x10'))[_0xce12('0x11')](socket);function respondWithRpcPromise(_0x5ed6fb,_0x214694,_0x5c0f40){return new BPromise(function(_0x4648db,_0x54e455){return client['request'](_0x5ed6fb,_0x5c0f40)[_0xce12('0x12')](function(_0xfea655){logger['info'](_0xce12('0x13'),_0x214694,_0xce12('0x14'));logger[_0xce12('0x15')](_0xce12('0x16'),_0x214694,_0xce12('0x14'),JSON[_0xce12('0x17')](_0xfea655));if(_0xfea655['error']){if(_0xfea655[_0xce12('0x18')]['code']===0x1f4){logger['error'](_0xce12('0x13'),_0x214694,_0xfea655[_0xce12('0x18')]['message']);return _0x54e455(_0xfea655[_0xce12('0x18')][_0xce12('0x19')]);}logger[_0xce12('0x18')]('Dashboard,\x20%s,\x20%s',_0x214694,_0xfea655[_0xce12('0x18')]['message']);return _0x4648db(_0xfea655[_0xce12('0x18')][_0xce12('0x19')]);}else{logger[_0xce12('0x1a')](_0xce12('0x13'),_0x214694,_0xce12('0x14'));_0x4648db(_0xfea655['result'][_0xce12('0x19')]);}})[_0xce12('0x1b')](function(_0x3a6bc5){logger['error']('Dashboard,\x20%s,\x20%s',_0x214694,_0x3a6bc5);_0x54e455(_0x3a6bc5);});});} \ No newline at end of file +var _0xc69b=['./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x1592b5,_0x2dd802){var _0x59ecab=function(_0x392234){while(--_0x392234){_0x1592b5['push'](_0x1592b5['shift']());}};_0x59ecab(++_0x2dd802);}(_0xc69b,0x1c1));var _0xbc69=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xc69b[_0x597484];return _0x218e64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbc69('0x0'));var BPromise=require(_0xbc69('0x1'));var rs=require(_0xbc69('0x2'));var fs=require('fs');var Redis=require(_0xbc69('0x3'));var db=require(_0xbc69('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbc69('0x5'));var jayson=require(_0xbc69('0x6'));var client=jayson['client'][_0xbc69('0x7')]({'port':0x232a});config[_0xbc69('0x8')]=_['defaults'](config[_0xbc69('0x8')],{'host':_0xbc69('0x9'),'port':0x18eb});var socket=require(_0xbc69('0xa'))(new Redis(config[_0xbc69('0x8')]));require(_0xbc69('0xb'))[_0xbc69('0xc')](socket);function respondWithRpcPromise(_0x33c22f,_0xb53184,_0x55e16c){return new BPromise(function(_0x11c5d9,_0x5b14be){return client[_0xbc69('0xd')](_0x33c22f,_0x55e16c)[_0xbc69('0xe')](function(_0x59c1ea){logger[_0xbc69('0xf')](_0xbc69('0x10'),_0xb53184,_0xbc69('0x11'));logger[_0xbc69('0x12')](_0xbc69('0x13'),_0xb53184,_0xbc69('0x11'),JSON['stringify'](_0x59c1ea));if(_0x59c1ea[_0xbc69('0x14')]){if(_0x59c1ea[_0xbc69('0x14')][_0xbc69('0x15')]===0x1f4){logger[_0xbc69('0x14')]('Dashboard,\x20%s,\x20%s',_0xb53184,_0x59c1ea[_0xbc69('0x14')][_0xbc69('0x16')]);return _0x5b14be(_0x59c1ea[_0xbc69('0x14')]['message']);}logger[_0xbc69('0x14')](_0xbc69('0x10'),_0xb53184,_0x59c1ea[_0xbc69('0x14')][_0xbc69('0x16')]);return _0x11c5d9(_0x59c1ea[_0xbc69('0x14')][_0xbc69('0x16')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0xb53184,'request\x20sent');_0x11c5d9(_0x59c1ea['result'][_0xbc69('0x16')]);}})['catch'](function(_0x27f160){logger['error'](_0xbc69('0x10'),_0xb53184,_0x27f160);_0x5b14be(_0x27f160);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 69632ec..ed7ab8f 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 _0x68ad=['emit','removeListener','register','length','dashboard:','./dashboard.events','remove','update'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x68ad,0x195));var _0xd68a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x68ad[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xd68a('0x0'));var events=['save',_0xd68a('0x1'),_0xd68a('0x2')];function createListener(_0x27a557,_0x4e05e2){return function(_0x30b11b){_0x4e05e2[_0xd68a('0x3')](_0x27a557,_0x30b11b);};}function removeListener(_0x182dc1,_0xcb3d45){return function(){DashboardEvents[_0xd68a('0x4')](_0x182dc1,_0xcb3d45);};}exports[_0xd68a('0x5')]=function(_0x395dfa){for(var _0x735ad9=0x0,_0x396463=events[_0xd68a('0x6')];_0x735ad9<_0x396463;_0x735ad9++){var _0x34eb70=events[_0x735ad9];var _0x2ae2d7=createListener(_0xd68a('0x7')+_0x34eb70,_0x395dfa);DashboardEvents['on'](_0x34eb70,_0x2ae2d7);}}; \ No newline at end of file +var _0x9d7e=['save','remove','removeListener','register','length'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x9d7e,0xf5));var _0xe9d7=function(_0x1aabc5,_0x1cf1a2){_0x1aabc5=_0x1aabc5-0x0;var _0x30a9db=_0x9d7e[_0x1aabc5];return _0x30a9db;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xe9d7('0x0'),_0xe9d7('0x1'),'update'];function createListener(_0x4bbb07,_0xd870f0){return function(_0xe2df0b){_0xd870f0['emit'](_0x4bbb07,_0xe2df0b);};}function removeListener(_0x4b4245,_0x1b5117){return function(){DashboardEvents[_0xe9d7('0x2')](_0x4b4245,_0x1b5117);};}exports[_0xe9d7('0x3')]=function(_0x4b0941){for(var _0x33a627=0x0,_0x35cb69=events[_0xe9d7('0x4')];_0x33a627<_0x35cb69;_0x33a627++){var _0x4c2e2a=events[_0x33a627];var _0x9bbd11=createListener('dashboard:'+_0x4c2e2a,_0x4b0941);DashboardEvents['on'](_0x4c2e2a,_0x9bbd11);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 09e2464..16257fb 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 _0x3563=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','create','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4e2b6e,_0x5cc3cc){var _0x39464=function(_0x56398e){while(--_0x56398e){_0x4e2b6e['push'](_0x4e2b6e['shift']());}};_0x39464(++_0x5cc3cc);}(_0x3563,0x159));var _0x3356=function(_0x239887,_0x41243a){_0x239887=_0x239887-0x0;var _0x45296e=_0x3563[_0x239887];return _0x45296e;};'use strict';var multer=require(_0x3356('0x0'));var util=require(_0x3356('0x1'));var path=require(_0x3356('0x2'));var timeout=require(_0x3356('0x3'));var express=require(_0x3356('0x4'));var router=express[_0x3356('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3356('0x6'));var interaction=require(_0x3356('0x7'));var config=require(_0x3356('0x8'));var controller=require(_0x3356('0x9'));router[_0x3356('0xa')]('/',auth[_0x3356('0xb')](),controller['index']);router[_0x3356('0xa')](_0x3356('0xc'),auth['isAuthenticated'](),controller[_0x3356('0xd')]);router[_0x3356('0xa')](_0x3356('0xe'),auth[_0x3356('0xb')](),controller['getItems']);router['post']('/',auth[_0x3356('0xb')](),controller[_0x3356('0xf')]);router[_0x3356('0x10')](_0x3356('0x11'),auth['isAuthenticated'](),controller[_0x3356('0x12')]);router['post']('/:id/items',auth[_0x3356('0xb')](),controller[_0x3356('0x13')]);router[_0x3356('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3356('0x15')]);router[_0x3356('0x16')](_0x3356('0xc'),auth[_0x3356('0xb')](),controller[_0x3356('0x17')]);module[_0x3356('0x18')]=router; \ No newline at end of file +var _0xb425=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer'];(function(_0x15dddd,_0x3c20d9){var _0x3d1a1e=function(_0x266ec0){while(--_0x266ec0){_0x15dddd['push'](_0x15dddd['shift']());}};_0x3d1a1e(++_0x3c20d9);}(_0xb425,0xbf));var _0x5b42=function(_0x1b5de5,_0x2118b7){_0x1b5de5=_0x1b5de5-0x0;var _0x5b619d=_0xb425[_0x1b5de5];return _0x5b619d;};'use strict';var multer=require(_0x5b42('0x0'));var util=require(_0x5b42('0x1'));var path=require(_0x5b42('0x2'));var timeout=require(_0x5b42('0x3'));var express=require(_0x5b42('0x4'));var router=express['Router']();var fs_extra=require(_0x5b42('0x5'));var auth=require(_0x5b42('0x6'));var interaction=require(_0x5b42('0x7'));var config=require(_0x5b42('0x8'));var controller=require(_0x5b42('0x9'));router[_0x5b42('0xa')]('/',auth[_0x5b42('0xb')](),controller['index']);router[_0x5b42('0xa')]('/:id',auth[_0x5b42('0xb')](),controller[_0x5b42('0xc')]);router[_0x5b42('0xa')](_0x5b42('0xd'),auth[_0x5b42('0xb')](),controller[_0x5b42('0xe')]);router[_0x5b42('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b42('0xf')](_0x5b42('0x10'),auth['isAuthenticated'](),controller[_0x5b42('0x11')]);router['post'](_0x5b42('0xd'),auth[_0x5b42('0xb')](),controller['addItem']);router[_0x5b42('0x12')](_0x5b42('0x13'),auth[_0x5b42('0xb')](),controller[_0x5b42('0x14')]);router[_0x5b42('0x15')](_0x5b42('0x13'),auth[_0x5b42('0xb')](),controller[_0x5b42('0x16')]);module[_0x5b42('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 136a4c3..841d625 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 _0x1261=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x1261,0x144));var _0x1126=function(_0x237815,_0x1ef2b0){_0x237815=_0x237815-0x0;var _0x5498ee=_0x1261[_0x237815];return _0x5498ee;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x1126('0x0'));var _=require(_0x1126('0x1'));module[_0x1126('0x2')]={'title':{'type':Sequelize[_0x1126('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1126('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1126('0x4')](_0x1126('0x5')),'get':function(){try{return JSON[_0x1126('0x6')](this[_0x1126('0x7')](_0x1126('0x8')));}catch(_0x5a2189){return[];}},'set':function(_0x5c68c8){try{this[_0x1126('0x9')](_0x1126('0x8'),JSON['stringify'](_0x5c68c8));}catch(_0x17e5f0){this[_0x1126('0x9')](_0x1126('0x8'),JSON[_0x1126('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x1126('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x1126('0xb')]},'col':{'type':Sequelize[_0x1126('0xb')]},'background':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1126('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x1126('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xfdbd=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','INTEGER','#ffffff'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xfdbd[_0x2265da];return _0x430c2b;};'use strict';var Sequelize=require(_0xdfdb('0x0'));var squel=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));module[_0xdfdb('0x3')]={'title':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xdfdb('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xdfdb('0x5')](_0xdfdb('0x6')),'get':function(){try{return JSON[_0xdfdb('0x7')](this['getDataValue'](_0xdfdb('0x8')));}catch(_0x4a4a3f){return[];}},'set':function(_0x453ef6){try{this[_0xdfdb('0x9')]('attrs',JSON['stringify'](_0x453ef6));}catch(_0x590b5d){this[_0xdfdb('0x9')](_0xdfdb('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xdfdb('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xdfdb('0xa')]},'col':{'type':Sequelize[_0xdfdb('0xa')]},'background':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':_0xdfdb('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xdfdb('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xdfdb('0x4')]},'titleFontSize':{'type':Sequelize[_0xdfdb('0xa')],'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 6812eba..c26be70 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 _0xf494=['name','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','total','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error'];(function(_0x3edf05,_0x57907c){var _0x435bee=function(_0x16c688){while(--_0x16c688){_0x3edf05['push'](_0x3edf05['shift']());}};_0x435bee(++_0x57907c);}(_0xf494,0x1c6));var _0x4f49=function(_0xf6b597,_0x2b368f){_0xf6b597=_0xf6b597-0x0;var _0x599665=_0xf494[_0xf6b597];return _0x599665;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];config[_0x4f49('0x19')]=_['defaults'](config[_0x4f49('0x19')],{'host':_0x4f49('0x1a'),'port':0x18eb});var socket=require(_0x4f49('0x1b'))(new Redis(config[_0x4f49('0x19')]));require(_0x4f49('0x1c'))[_0x4f49('0x1d')](socket);function respondWithStatusCode(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xcc;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1e')](_0x5c373e);}return _0xfdb477[_0x4f49('0x1f')](_0x5c373e)['end']();};}function respondWithResult(_0x5bdfaf,_0x2f0a0d){_0x2f0a0d=_0x2f0a0d||0xc8;return function(_0x2ecaaa){if(_0x2ecaaa){return _0x5bdfaf[_0x4f49('0x1f')](_0x2f0a0d)['json'](_0x2ecaaa);}};}function respondWithFilteredResult(_0x1dccfd,_0x399be7){return function(_0x4e85df){if(_0x4e85df){var _0x49cdaf=typeof _0x399be7['offset']==='undefined'&&typeof _0x399be7['limit']===_0x4f49('0x20');var _0x1834f4=_0x4e85df[_0x4f49('0x21')];var _0x407042=_0x49cdaf?0x0:_0x399be7['offset'];var _0x416893=_0x49cdaf?_0x4e85df[_0x4f49('0x21')]:_0x399be7[_0x4f49('0x22')]+_0x399be7[_0x4f49('0x23')];var _0xea82f8;if(_0x416893>=_0x1834f4){_0x416893=_0x1834f4;_0xea82f8=0xc8;}else{_0xea82f8=0xce;}_0x1dccfd['status'](_0xea82f8);return _0x1dccfd[_0x4f49('0x24')](_0x4f49('0x25'),_0x407042+'-'+_0x416893+'/'+_0x1834f4)[_0x4f49('0x26')](_0x4e85df);}return null;};}function patchUpdates(_0x53b57d){return function(_0x40755e){try{jsonpatch[_0x4f49('0x27')](_0x40755e,_0x53b57d,!![]);}catch(_0x32ca7b){return BPromise[_0x4f49('0x28')](_0x32ca7b);}return _0x40755e[_0x4f49('0x29')]();};}function saveUpdates(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x2a')](_0x36187b)[_0x4f49('0x2b')](function(_0x4fedbb){return _0x4fedbb;});}return null;};}function removeEntity(_0x408552,_0x2c1519){return function(_0x35f8e0){if(_0x35f8e0){return _0x35f8e0['destroy']()[_0x4f49('0x2b')](function(){_0x408552[_0x4f49('0x1f')](0xcc)[_0x4f49('0x2c')]();});}};}function handleEntityNotFound(_0x148153,_0xfefbab){return function(_0x122404){if(!_0x122404){_0x148153['sendStatus'](0x194);}return _0x122404;};}function handleError(_0x50c571,_0x239f44){_0x239f44=_0x239f44||0x1f4;return function(_0x2c00ee){logger[_0x4f49('0x2d')](_0x2c00ee['stack']);if(_0x2c00ee[_0x4f49('0x2e')]){delete _0x2c00ee[_0x4f49('0x2e')];}_0x50c571[_0x4f49('0x1f')](_0x239f44)['send'](_0x2c00ee);};}exports['show']=function(_0x3e207f,_0x27d004){var _0x7a6ea0={'raw':![],'where':{'id':_0x3e207f[_0x4f49('0x2f')]['id']}},_0x5e7076={};_0x5e7076[_0x4f49('0x30')]=_[_0x4f49('0x31')](db[_0x4f49('0x32')][_0x4f49('0x33')]);_0x5e7076[_0x4f49('0x34')]=_[_0x4f49('0x31')](_0x3e207f[_0x4f49('0x34')]);_0x5e7076[_0x4f49('0x35')]=_[_0x4f49('0x36')](_0x5e7076[_0x4f49('0x30')],_0x5e7076[_0x4f49('0x34')]);_0x7a6ea0[_0x4f49('0x37')]=_[_0x4f49('0x36')](_0x5e7076[_0x4f49('0x30')],qs[_0x4f49('0x38')](_0x3e207f[_0x4f49('0x34')][_0x4f49('0x38')]));_0x7a6ea0[_0x4f49('0x37')]=_0x7a6ea0['attributes'][_0x4f49('0x39')]?_0x7a6ea0[_0x4f49('0x37')]:_0x5e7076[_0x4f49('0x30')];if(_0x3e207f[_0x4f49('0x34')][_0x4f49('0x3a')]){_0x7a6ea0[_0x4f49('0x3b')]=[{'all':!![]}];}_0x7a6ea0=_[_0x4f49('0x3c')]({},_0x7a6ea0,_0x3e207f[_0x4f49('0x3d')]);return db[_0x4f49('0x32')][_0x4f49('0x3e')](_0x7a6ea0)[_0x4f49('0x2b')](handleEntityNotFound(_0x27d004,null))[_0x4f49('0x2b')](respondWithResult(_0x27d004,null))[_0x4f49('0x3f')](handleError(_0x27d004,null));};exports['destroy']=function(_0x371282,_0x27b7a9){return db[_0x4f49('0x32')][_0x4f49('0x3e')]({'where':{'id':_0x371282[_0x4f49('0x2f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x27b7a9,null))[_0x4f49('0x2b')](removeEntity(_0x27b7a9,null))[_0x4f49('0x3f')](handleError(_0x27b7a9,null));};function widgetAttributes(_0x10bfc4){try{switch(_0x10bfc4[_0x4f49('0x40')]){case _0x4f49('0x41'):return[{'name':_0x4f49('0x42'),'value':_0x10bfc4[_0x4f49('0x42')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||'https://'}];case _0x4f49('0x45'):return[{'name':_0x4f49('0x46'),'value':_0x10bfc4['attrPath']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||''}];case _0x4f49('0x47'):return[{'name':_0x4f49('0x48'),'value':_0x10bfc4[_0x4f49('0x48')]||(_0x10bfc4['attrs']&&_0x10bfc4['attrs'][0x0]?_0x10bfc4['attrs'][0x0][_0x4f49('0x44')]:undefined)||_0x4f49('0x49')},{'name':_0x4f49('0x4a'),'value':_0x10bfc4[_0x4f49('0x4a')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1][_0x4f49('0x44')]:undefined)||_0x4f49('0x4b')},{'name':'attrFontSize','value':_0x10bfc4['attrFontSize']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2]['value']:undefined)||0xc}];case _0x4f49('0x4c'):return[{'name':'attrMetric','value':_0x10bfc4['attrMetric']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0]['value']:undefined)||_0x4f49('0x4d')},{'name':_0x4f49('0x4e'),'value':_0x10bfc4['attrVoiceQueues']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1][_0x4f49('0x44')]:undefined)||[]},{'name':_0x4f49('0x4f'),'value':_0x10bfc4['attrFontSize']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2][_0x4f49('0x44')]:undefined)||0x14},{'name':_0x4f49('0x50'),'value':_0x10bfc4[_0x4f49('0x50')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x3]?_0x10bfc4[_0x4f49('0x43')][0x3][_0x4f49('0x44')]:undefined)||'voice'},{'name':_0x4f49('0x51'),'value':_0x10bfc4[_0x4f49('0x51')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x4]?_0x10bfc4['attrs'][0x4][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x52'),'value':_0x10bfc4[_0x4f49('0x52')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x5]?_0x10bfc4[_0x4f49('0x43')][0x5][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x53'),'value':_0x10bfc4[_0x4f49('0x53')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x6]?_0x10bfc4[_0x4f49('0x43')][0x6][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x54'),'value':_0x10bfc4[_0x4f49('0x54')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x7]?_0x10bfc4[_0x4f49('0x43')][0x7][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x55'),'value':_0x10bfc4[_0x4f49('0x55')]||(_0x10bfc4['attrs']&&_0x10bfc4['attrs'][0x8]?_0x10bfc4[_0x4f49('0x43')][0x8][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x56'),'value':_0x10bfc4[_0x4f49('0x56')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x9]?_0x10bfc4[_0x4f49('0x43')][0x9]['value']:undefined)||''}];case _0x4f49('0x57'):case'pie-chart':return[{'name':_0x4f49('0x58'),'value':_0x10bfc4[_0x4f49('0x58')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4['attrs'][0x0][_0x4f49('0x44')]:undefined)||'total'},{'name':'attrSerie2','value':_0x10bfc4[_0x4f49('0x59')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4[_0x4f49('0x43')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x10bfc4[_0x4f49('0x5a')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x2]?_0x10bfc4[_0x4f49('0x43')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x10bfc4[_0x4f49('0x4e')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x3]?_0x10bfc4['attrs'][0x3][_0x4f49('0x44')]:undefined)||[]},{'name':_0x4f49('0x50'),'value':_0x10bfc4[_0x4f49('0x50')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x4]?_0x10bfc4[_0x4f49('0x43')][0x4][_0x4f49('0x44')]:undefined)||_0x4f49('0x5b')},{'name':'attrEmailAccounts','value':_0x10bfc4[_0x4f49('0x51')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x5]?_0x10bfc4[_0x4f49('0x43')][0x5][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x52'),'value':_0x10bfc4[_0x4f49('0x52')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x6]?_0x10bfc4[_0x4f49('0x43')][0x6][_0x4f49('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x10bfc4['attrSmsAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x7]?_0x10bfc4[_0x4f49('0x43')][0x7][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x54'),'value':_0x10bfc4['attrOpenchannelAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0x8]?_0x10bfc4[_0x4f49('0x43')][0x8][_0x4f49('0x44')]:undefined)||''},{'name':_0x4f49('0x55'),'value':_0x10bfc4['attrWhatsappAccounts']||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x9]?_0x10bfc4[_0x4f49('0x43')][0x9][_0x4f49('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x10bfc4[_0x4f49('0x56')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4['attrs'][0xa]?_0x10bfc4[_0x4f49('0x43')][0xa][_0x4f49('0x44')]:undefined)||''}];case _0x4f49('0x5c'):return[{'name':_0x4f49('0x5d'),'type':_0x10bfc4[_0x4f49('0x5e')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0]['type']:undefined)||null,'value':_0x10bfc4[_0x4f49('0x5d')]||(_0x10bfc4[_0x4f49('0x43')]&&_0x10bfc4[_0x4f49('0x43')][0x0]?_0x10bfc4[_0x4f49('0x43')][0x0][_0x4f49('0x44')]:undefined)||null},{'name':_0x4f49('0x5f'),'value':_0x10bfc4[_0x4f49('0x5f')]||(_0x10bfc4['attrs']&&_0x10bfc4[_0x4f49('0x43')][0x1]?_0x10bfc4['attrs'][0x1][_0x4f49('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x2b491c){logger[_0x4f49('0x2d')](_0x4f49('0x60'),JSON[_0x4f49('0x61')](_0x2b491c));return[];}}exports[_0x4f49('0x62')]=function(_0x61a565,_0x297698){if(_0x61a565[_0x4f49('0x63')]){_0x61a565[_0x4f49('0x63')]['attrs']=widgetAttributes(_0x61a565[_0x4f49('0x63')]);}return db[_0x4f49('0x32')][_0x4f49('0x62')](_0x61a565[_0x4f49('0x63')],{})['then'](respondWithResult(_0x297698,0xc9))['catch'](handleError(_0x297698,null));};exports[_0x4f49('0x2a')]=function(_0x5e4879,_0x30defd){if(_0x5e4879[_0x4f49('0x63')]['id']){delete _0x5e4879[_0x4f49('0x63')]['id'];}_0x5e4879[_0x4f49('0x63')][_0x4f49('0x43')]=widgetAttributes(_0x5e4879[_0x4f49('0x63')]);return db[_0x4f49('0x32')][_0x4f49('0x3e')]({'where':{'id':_0x5e4879[_0x4f49('0x2f')]['id']}})[_0x4f49('0x2b')](handleEntityNotFound(_0x30defd,null))[_0x4f49('0x2b')](saveUpdates(_0x5e4879[_0x4f49('0x63')],null))[_0x4f49('0x2b')](respondWithResult(_0x30defd,null))[_0x4f49('0x3f')](handleError(_0x30defd,null));}; \ No newline at end of file +var _0x1488=['find','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','body','create','update','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','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/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','json','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','options'];(function(_0x5a5e64,_0x574ebf){var _0x4f6227=function(_0x46250c){while(--_0x46250c){_0x5a5e64['push'](_0x5a5e64['shift']());}};_0x4f6227(++_0x574ebf);}(_0x1488,0x88));var _0x8148=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x1488[_0x47f719];return _0x407f4e;};'use strict';var emlformat=require(_0x8148('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8148('0x1'));var jsonpatch=require(_0x8148('0x2'));var rp=require(_0x8148('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8148('0x4'));var util=require('util');var path=require(_0x8148('0x5'));var sox=require(_0x8148('0x6'));var csv=require(_0x8148('0x7'));var ejs=require(_0x8148('0x8'));var fs=require('fs');var fs_extra=require(_0x8148('0x9'));var _=require(_0x8148('0xa'));var squel=require(_0x8148('0xb'));var crypto=require(_0x8148('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8148('0xd'));var toCsv=require(_0x8148('0x7'));var querystring=require(_0x8148('0xe'));var Papa=require(_0x8148('0xf'));var Redis=require(_0x8148('0x10'));var authService=require(_0x8148('0x11'));var qs=require(_0x8148('0x12'));var as=require(_0x8148('0x13'));var hardwareService=require(_0x8148('0x14'));var logger=require(_0x8148('0x15'))(_0x8148('0x16'));var utils=require(_0x8148('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8148('0x18'));var db=require(_0x8148('0x19'))['db'];config[_0x8148('0x1a')]=_['defaults'](config['redis'],{'host':_0x8148('0x1b'),'port':0x18eb});var socket=require(_0x8148('0x1c'))(new Redis(config['redis']));require(_0x8148('0x1d'))[_0x8148('0x1e')](socket);function respondWithStatusCode(_0x431dcb,_0x13c9e1){_0x13c9e1=_0x13c9e1||0xcc;return function(_0x3ad3a9){if(_0x3ad3a9){return _0x431dcb['sendStatus'](_0x13c9e1);}return _0x431dcb[_0x8148('0x1f')](_0x13c9e1)['end']();};}function respondWithResult(_0x4f9ce4,_0x2ab184){_0x2ab184=_0x2ab184||0xc8;return function(_0x4ebd8f){if(_0x4ebd8f){return _0x4f9ce4['status'](_0x2ab184)[_0x8148('0x20')](_0x4ebd8f);}};}function respondWithFilteredResult(_0x4a3135,_0x532505){return function(_0x48391c){if(_0x48391c){var _0xc4092a=typeof _0x532505['offset']==='undefined'&&typeof _0x532505[_0x8148('0x21')]==='undefined';var _0x1e5e6b=_0x48391c['count'];var _0x16d63a=_0xc4092a?0x0:_0x532505[_0x8148('0x22')];var _0x269fa7=_0xc4092a?_0x48391c[_0x8148('0x23')]:_0x532505[_0x8148('0x22')]+_0x532505[_0x8148('0x21')];var _0x3c0113;if(_0x269fa7>=_0x1e5e6b){_0x269fa7=_0x1e5e6b;_0x3c0113=0xc8;}else{_0x3c0113=0xce;}_0x4a3135[_0x8148('0x1f')](_0x3c0113);return _0x4a3135[_0x8148('0x24')](_0x8148('0x25'),_0x16d63a+'-'+_0x269fa7+'/'+_0x1e5e6b)[_0x8148('0x20')](_0x48391c);}return null;};}function patchUpdates(_0x1a2fb6){return function(_0x3b88a4){try{jsonpatch[_0x8148('0x26')](_0x3b88a4,_0x1a2fb6,!![]);}catch(_0x5b128a){return BPromise[_0x8148('0x27')](_0x5b128a);}return _0x3b88a4[_0x8148('0x28')]();};}function saveUpdates(_0x52e0d4,_0x4e9f1a){return function(_0x9eef6e){if(_0x9eef6e){return _0x9eef6e['update'](_0x52e0d4)[_0x8148('0x29')](function(_0x122dc0){return _0x122dc0;});}return null;};}function removeEntity(_0x150304,_0x5af4d2){return function(_0x4f7afb){if(_0x4f7afb){return _0x4f7afb[_0x8148('0x2a')]()[_0x8148('0x29')](function(){_0x150304['status'](0xcc)[_0x8148('0x2b')]();});}};}function handleEntityNotFound(_0x25d8a6,_0x581caf){return function(_0x2a6c41){if(!_0x2a6c41){_0x25d8a6[_0x8148('0x2c')](0x194);}return _0x2a6c41;};}function handleError(_0x37089e,_0x4ed683){_0x4ed683=_0x4ed683||0x1f4;return function(_0x37deec){logger[_0x8148('0x2d')](_0x37deec[_0x8148('0x2e')]);if(_0x37deec[_0x8148('0x2f')]){delete _0x37deec['name'];}_0x37089e[_0x8148('0x1f')](_0x4ed683)['send'](_0x37deec);};}exports['show']=function(_0x434e36,_0x5b3120){var _0x293c4e={'raw':![],'where':{'id':_0x434e36[_0x8148('0x30')]['id']}},_0x2ea6e2={};_0x2ea6e2[_0x8148('0x31')]=_[_0x8148('0x32')](db[_0x8148('0x33')][_0x8148('0x34')]);_0x2ea6e2['query']=_[_0x8148('0x32')](_0x434e36[_0x8148('0x35')]);_0x2ea6e2[_0x8148('0x36')]=_['intersection'](_0x2ea6e2[_0x8148('0x31')],_0x2ea6e2[_0x8148('0x35')]);_0x293c4e[_0x8148('0x37')]=_[_0x8148('0x38')](_0x2ea6e2[_0x8148('0x31')],qs['fields'](_0x434e36[_0x8148('0x35')][_0x8148('0x39')]));_0x293c4e[_0x8148('0x37')]=_0x293c4e[_0x8148('0x37')][_0x8148('0x3a')]?_0x293c4e[_0x8148('0x37')]:_0x2ea6e2[_0x8148('0x31')];if(_0x434e36[_0x8148('0x35')][_0x8148('0x3b')]){_0x293c4e[_0x8148('0x3c')]=[{'all':!![]}];}_0x293c4e=_['merge']({},_0x293c4e,_0x434e36[_0x8148('0x3d')]);return db[_0x8148('0x33')][_0x8148('0x3e')](_0x293c4e)[_0x8148('0x29')](handleEntityNotFound(_0x5b3120,null))[_0x8148('0x29')](respondWithResult(_0x5b3120,null))[_0x8148('0x3f')](handleError(_0x5b3120,null));};exports['destroy']=function(_0x3a06d7,_0x501122){return db['DashboardItem'][_0x8148('0x3e')]({'where':{'id':_0x3a06d7[_0x8148('0x30')]['id']}})[_0x8148('0x29')](handleEntityNotFound(_0x501122,null))[_0x8148('0x29')](removeEntity(_0x501122,null))['catch'](handleError(_0x501122,null));};function widgetAttributes(_0x3ba875){try{switch(_0x3ba875[_0x8148('0x40')]){case _0x8148('0x41'):return[{'name':_0x8148('0x42'),'value':_0x3ba875[_0x8148('0x42')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875['attrs'][0x0]?_0x3ba875[_0x8148('0x43')][0x0][_0x8148('0x44')]:undefined)||_0x8148('0x45')}];case _0x8148('0x46'):return[{'name':'attrPath','value':_0x3ba875['attrPath']||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x0]?_0x3ba875[_0x8148('0x43')][0x0]['value']:undefined)||''}];case _0x8148('0x47'):return[{'name':_0x8148('0x48'),'value':_0x3ba875[_0x8148('0x48')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875['attrs'][0x0]?_0x3ba875[_0x8148('0x43')][0x0]['value']:undefined)||_0x8148('0x49')},{'name':_0x8148('0x4a'),'value':_0x3ba875[_0x8148('0x4a')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0x1]?_0x3ba875['attrs'][0x1][_0x8148('0x44')]:undefined)||'0.00'},{'name':_0x8148('0x4b'),'value':_0x3ba875[_0x8148('0x4b')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x2]?_0x3ba875[_0x8148('0x43')][0x2][_0x8148('0x44')]:undefined)||0xc}];case _0x8148('0x4c'):return[{'name':_0x8148('0x4d'),'value':_0x3ba875[_0x8148('0x4d')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x0]?_0x3ba875['attrs'][0x0][_0x8148('0x44')]:undefined)||_0x8148('0x4e')},{'name':_0x8148('0x4f'),'value':_0x3ba875['attrVoiceQueues']||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875['attrs'][0x1]?_0x3ba875['attrs'][0x1]['value']:undefined)||[]},{'name':_0x8148('0x4b'),'value':_0x3ba875[_0x8148('0x4b')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0x2]?_0x3ba875['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x8148('0x50'),'value':_0x3ba875[_0x8148('0x50')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0x3]?_0x3ba875[_0x8148('0x43')][0x3]['value']:undefined)||'voice'},{'name':_0x8148('0x51'),'value':_0x3ba875[_0x8148('0x51')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x4]?_0x3ba875[_0x8148('0x43')][0x4][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x52'),'value':_0x3ba875['attrFaxAccounts']||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x5]?_0x3ba875[_0x8148('0x43')][0x5][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x53'),'value':_0x3ba875[_0x8148('0x53')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x6]?_0x3ba875[_0x8148('0x43')][0x6]['value']:undefined)||''},{'name':_0x8148('0x54'),'value':_0x3ba875[_0x8148('0x54')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x7]?_0x3ba875['attrs'][0x7][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x55'),'value':_0x3ba875[_0x8148('0x55')]||(_0x3ba875['attrs']&&_0x3ba875['attrs'][0x8]?_0x3ba875[_0x8148('0x43')][0x8][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x56'),'value':_0x3ba875[_0x8148('0x56')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0x9]?_0x3ba875[_0x8148('0x43')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x8148('0x57'),'value':_0x3ba875[_0x8148('0x57')]||(_0x3ba875['attrs']&&_0x3ba875['attrs'][0x0]?_0x3ba875['attrs'][0x0][_0x8148('0x44')]:undefined)||'total'},{'name':_0x8148('0x58'),'value':_0x3ba875[_0x8148('0x58')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x1]?_0x3ba875[_0x8148('0x43')][0x1][_0x8148('0x44')]:undefined)||null},{'name':_0x8148('0x59'),'value':_0x3ba875[_0x8148('0x59')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x2]?_0x3ba875[_0x8148('0x43')][0x2][_0x8148('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3ba875['attrVoiceQueues']||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x3]?_0x3ba875[_0x8148('0x43')][0x3]['value']:undefined)||[]},{'name':_0x8148('0x50'),'value':_0x3ba875[_0x8148('0x50')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0x4]?_0x3ba875[_0x8148('0x43')][0x4][_0x8148('0x44')]:undefined)||_0x8148('0x5a')},{'name':_0x8148('0x51'),'value':_0x3ba875[_0x8148('0x51')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x5]?_0x3ba875[_0x8148('0x43')][0x5][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x52'),'value':_0x3ba875[_0x8148('0x52')]||(_0x3ba875['attrs']&&_0x3ba875['attrs'][0x6]?_0x3ba875[_0x8148('0x43')][0x6][_0x8148('0x44')]:undefined)||''},{'name':_0x8148('0x53'),'value':_0x3ba875[_0x8148('0x53')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x7]?_0x3ba875['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3ba875[_0x8148('0x54')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x8]?_0x3ba875[_0x8148('0x43')][0x8][_0x8148('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3ba875[_0x8148('0x55')]||(_0x3ba875['attrs']&&_0x3ba875['attrs'][0x9]?_0x3ba875[_0x8148('0x43')][0x9][_0x8148('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3ba875[_0x8148('0x56')]||(_0x3ba875['attrs']&&_0x3ba875[_0x8148('0x43')][0xa]?_0x3ba875[_0x8148('0x43')][0xa][_0x8148('0x44')]:undefined)||''}];case _0x8148('0x5b'):return[{'name':_0x8148('0x5c'),'type':_0x3ba875[_0x8148('0x5d')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x0]?_0x3ba875[_0x8148('0x43')][0x0][_0x8148('0x40')]:undefined)||null,'value':_0x3ba875[_0x8148('0x5c')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x0]?_0x3ba875[_0x8148('0x43')][0x0][_0x8148('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x3ba875[_0x8148('0x5e')]||(_0x3ba875[_0x8148('0x43')]&&_0x3ba875[_0x8148('0x43')][0x1]?_0x3ba875[_0x8148('0x43')][0x1][_0x8148('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x4e9113){logger[_0x8148('0x2d')]('widgetAttributes:\x20%s',JSON[_0x8148('0x5f')](_0x4e9113));return[];}}exports['create']=function(_0x5b1e46,_0x4898af){if(_0x5b1e46[_0x8148('0x60')]){_0x5b1e46['body'][_0x8148('0x43')]=widgetAttributes(_0x5b1e46[_0x8148('0x60')]);}return db[_0x8148('0x33')][_0x8148('0x61')](_0x5b1e46[_0x8148('0x60')],{})['then'](respondWithResult(_0x4898af,0xc9))[_0x8148('0x3f')](handleError(_0x4898af,null));};exports[_0x8148('0x62')]=function(_0x50afe2,_0x5cd5be){if(_0x50afe2[_0x8148('0x60')]['id']){delete _0x50afe2[_0x8148('0x60')]['id'];}_0x50afe2[_0x8148('0x60')]['attrs']=widgetAttributes(_0x50afe2['body']);return db[_0x8148('0x33')][_0x8148('0x3e')]({'where':{'id':_0x50afe2['params']['id']}})[_0x8148('0x29')](handleEntityNotFound(_0x5cd5be,null))[_0x8148('0x29')](saveUpdates(_0x50afe2['body'],null))[_0x8148('0x29')](respondWithResult(_0x5cd5be,null))[_0x8148('0x3f')](handleError(_0x5cd5be,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 67f121d..0b79c6b 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 _0x5505=['../../mysqldb','DashboardItem','save','update','remove','emit','hook','exports','events'];(function(_0xb80049,_0x442f7d){var _0x4ece41=function(_0x571734){while(--_0x571734){_0xb80049['push'](_0xb80049['shift']());}};_0x4ece41(++_0x442f7d);}(_0x5505,0x1ee));var _0x5550=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5505[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0x5550('0x0'));var DashboardItem=require(_0x5550('0x1'))['db'][_0x5550('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5550('0x3'),'afterUpdate':_0x5550('0x4'),'afterDestroy':_0x5550('0x5')};function emitEvent(_0x1d159a){return function(_0x2f24e2,_0x2aa014,_0x1948cb){DashboardItemEvents[_0x5550('0x6')](_0x1d159a+':'+_0x2f24e2['id'],_0x2f24e2);DashboardItemEvents[_0x5550('0x6')](_0x1d159a,_0x2f24e2);_0x1948cb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x5550('0x7')](e,emitEvent(event));}}module[_0x5550('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xc881=['events','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x32e3f6,_0x34fa84){var _0x1c5e8b=function(_0xbce551){while(--_0xbce551){_0x32e3f6['push'](_0x32e3f6['shift']());}};_0x1c5e8b(++_0x34fa84);}(_0xc881,0xd2));var _0x1c88=function(_0x1829dc,_0x3ce228){_0x1829dc=_0x1829dc-0x0;var _0x2c18f6=_0xc881[_0x1829dc];return _0x2c18f6;};'use strict';var EventEmitter=require(_0x1c88('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1c88('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1c88('0x2')](0x0);var events={'afterCreate':_0x1c88('0x3'),'afterUpdate':_0x1c88('0x4'),'afterDestroy':_0x1c88('0x5')};function emitEvent(_0x70b639){return function(_0x2e402e,_0x60ac0d,_0x5cf440){DashboardItemEvents[_0x1c88('0x6')](_0x70b639+':'+_0x2e402e['id'],_0x2e402e);DashboardItemEvents[_0x1c88('0x6')](_0x70b639,_0x2e402e);_0x5cf440(null);};}for(var e in events){if(events[_0x1c88('0x7')](e)){var event=events[e];DashboardItem[_0x1c88('0x8')](e,emitEvent(event));}}module[_0x1c88('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 026d349..f3e013d 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 _0x5c5f=['DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./dashboardItem.attributes','exports','define'];(function(_0x2bdecd,_0x21805f){var _0x56116e=function(_0x297d20){while(--_0x297d20){_0x2bdecd['push'](_0x2bdecd['shift']());}};_0x56116e(++_0x21805f);}(_0x5c5f,0x120));var _0xf5c5=function(_0x145b1e,_0x3e089c){_0x145b1e=_0x145b1e-0x0;var _0x5db350=_0x5c5f[_0x145b1e];return _0x5db350;};'use strict';var _=require(_0xf5c5('0x0'));var util=require(_0xf5c5('0x1'));var logger=require('../../config/logger')(_0xf5c5('0x2'));var moment=require(_0xf5c5('0x3'));var BPromise=require(_0xf5c5('0x4'));var rp=require(_0xf5c5('0x5'));var fs=require('fs');var path=require(_0xf5c5('0x6'));var rimraf=require(_0xf5c5('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5c5('0x8'));module[_0xf5c5('0x9')]=function(_0x323036,_0x2c4dad){return _0x323036[_0xf5c5('0xa')](_0xf5c5('0xb'),attributes,{'tableName':_0xf5c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19be=['../../config/logger','api','bluebird','path','rimraf','./dashboardItem.attributes','define','dashboard_items','lodash','util'];(function(_0x3affa8,_0x51887d){var _0x5a2a0d=function(_0x24fb6f){while(--_0x24fb6f){_0x3affa8['push'](_0x3affa8['shift']());}};_0x5a2a0d(++_0x51887d);}(_0x19be,0x1de));var _0xe19b=function(_0x4df97e,_0x2441f2){_0x4df97e=_0x4df97e-0x0;var _0x1a92ed=_0x19be[_0x4df97e];return _0x1a92ed;};'use strict';var _=require(_0xe19b('0x0'));var util=require(_0xe19b('0x1'));var logger=require(_0xe19b('0x2'))(_0xe19b('0x3'));var moment=require('moment');var BPromise=require(_0xe19b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe19b('0x5'));var rimraf=require(_0xe19b('0x6'));var config=require('../../config/environment');var attributes=require(_0xe19b('0x7'));module['exports']=function(_0x4b6cea,_0x48a611){return _0x4b6cea[_0xe19b('0x8')]('DashboardItem',attributes,{'tableName':_0xe19b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 69fca94..a949def 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 _0x51fa=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x379097,_0x104b7c){var _0x320154=function(_0x281595){while(--_0x281595){_0x379097['push'](_0x379097['shift']());}};_0x320154(++_0x104b7c);}(_0x51fa,0xe5));var _0xa51f=function(_0x35b44c,_0x80e76){_0x35b44c=_0x35b44c-0x0;var _0xeb4484=_0x51fa[_0x35b44c];return _0xeb4484;};'use strict';var _=require(_0xa51f('0x0'));var util=require(_0xa51f('0x1'));var moment=require(_0xa51f('0x2'));var BPromise=require(_0xa51f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa51f('0x4'))['db'];var utils=require(_0xa51f('0x5'));var logger=require('../../config/logger')(_0xa51f('0x6'));var config=require(_0xa51f('0x7'));var jayson=require(_0xa51f('0x8'));var client=jayson['client'][_0xa51f('0x9')]({'port':0x232a});config[_0xa51f('0xa')]=_[_0xa51f('0xb')](config[_0xa51f('0xa')],{'host':_0xa51f('0xc'),'port':0x18eb});var socket=require(_0xa51f('0xd'))(new Redis(config['redis']));require(_0xa51f('0xe'))[_0xa51f('0xf')](socket);function respondWithRpcPromise(_0x129a4d,_0x5ae16a,_0x2c4a18){return new BPromise(function(_0x83fe70,_0x18503c){return client[_0xa51f('0x10')](_0x129a4d,_0x2c4a18)[_0xa51f('0x11')](function(_0x2755da){logger[_0xa51f('0x12')](_0xa51f('0x13'),_0x5ae16a,_0xa51f('0x14'));logger[_0xa51f('0x15')](_0xa51f('0x16'),_0x5ae16a,_0xa51f('0x14'),JSON['stringify'](_0x2755da));if(_0x2755da['error']){if(_0x2755da[_0xa51f('0x17')][_0xa51f('0x18')]===0x1f4){logger[_0xa51f('0x17')]('DashboardItem,\x20%s,\x20%s',_0x5ae16a,_0x2755da[_0xa51f('0x17')][_0xa51f('0x19')]);return _0x18503c(_0x2755da[_0xa51f('0x17')][_0xa51f('0x19')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x5ae16a,_0x2755da[_0xa51f('0x17')]['message']);return _0x83fe70(_0x2755da['error'][_0xa51f('0x19')]);}else{logger[_0xa51f('0x12')]('DashboardItem,\x20%s,\x20%s',_0x5ae16a,'request\x20sent');_0x83fe70(_0x2755da[_0xa51f('0x1a')][_0xa51f('0x19')]);}})[_0xa51f('0x1b')](function(_0x2f7a68){logger[_0xa51f('0x17')](_0xa51f('0x13'),_0x5ae16a,_0x2f7a68);_0x18503c(_0x2f7a68);});});} \ No newline at end of file +var _0xd9ec=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd9ec,0xf8));var _0xcd9e=function(_0xb48d13,_0x2ef59d){_0xb48d13=_0xb48d13-0x0;var _0x38de70=_0xd9ec[_0xb48d13];return _0x38de70;};'use strict';var _=require(_0xcd9e('0x0'));var util=require(_0xcd9e('0x1'));var moment=require(_0xcd9e('0x2'));var BPromise=require(_0xcd9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd9e('0x4'));var db=require(_0xcd9e('0x5'))['db'];var utils=require(_0xcd9e('0x6'));var logger=require(_0xcd9e('0x7'))(_0xcd9e('0x8'));var config=require('../../config/environment');var jayson=require(_0xcd9e('0x9'));var client=jayson['client'][_0xcd9e('0xa')]({'port':0x232a});config[_0xcd9e('0xb')]=_[_0xcd9e('0xc')](config[_0xcd9e('0xb')],{'host':_0xcd9e('0xd'),'port':0x18eb});var socket=require(_0xcd9e('0xe'))(new Redis(config[_0xcd9e('0xb')]));require(_0xcd9e('0xf'))[_0xcd9e('0x10')](socket);function respondWithRpcPromise(_0x33c2f6,_0x553f55,_0x265bfc){return new BPromise(function(_0x2d4d9f,_0x533ef8){return client[_0xcd9e('0x11')](_0x33c2f6,_0x265bfc)[_0xcd9e('0x12')](function(_0x554b12){logger[_0xcd9e('0x13')]('DashboardItem,\x20%s,\x20%s',_0x553f55,_0xcd9e('0x14'));logger[_0xcd9e('0x15')](_0xcd9e('0x16'),_0x553f55,_0xcd9e('0x14'),JSON[_0xcd9e('0x17')](_0x554b12));if(_0x554b12[_0xcd9e('0x18')]){if(_0x554b12[_0xcd9e('0x18')][_0xcd9e('0x19')]===0x1f4){logger[_0xcd9e('0x18')](_0xcd9e('0x1a'),_0x553f55,_0x554b12['error']['message']);return _0x533ef8(_0x554b12[_0xcd9e('0x18')]['message']);}logger[_0xcd9e('0x18')]('DashboardItem,\x20%s,\x20%s',_0x553f55,_0x554b12[_0xcd9e('0x18')][_0xcd9e('0x1b')]);return _0x2d4d9f(_0x554b12[_0xcd9e('0x18')]['message']);}else{logger[_0xcd9e('0x13')](_0xcd9e('0x1a'),_0x553f55,'request\x20sent');_0x2d4d9f(_0x554b12[_0xcd9e('0x1c')][_0xcd9e('0x1b')]);}})[_0xcd9e('0x1d')](function(_0x32a6c9){logger[_0xcd9e('0x18')]('DashboardItem,\x20%s,\x20%s',_0x553f55,_0x32a6c9);_0x533ef8(_0x32a6c9);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index e5d185c..ea7fa9d 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 _0x01f2=['removeListener','register','length','dashboardItem:','./dashboardItem.events','emit'];(function(_0x30142e,_0x37cbc6){var _0x45441a=function(_0x1d2706){while(--_0x1d2706){_0x30142e['push'](_0x30142e['shift']());}};_0x45441a(++_0x37cbc6);}(_0x01f2,0x184));var _0x201f=function(_0x5ae7bc,_0x38a9d6){_0x5ae7bc=_0x5ae7bc-0x0;var _0x14e200=_0x01f2[_0x5ae7bc];return _0x14e200;};'use strict';var DashboardItemEvents=require(_0x201f('0x0'));var events=['save','remove','update'];function createListener(_0x1f4ff0,_0x219233){return function(_0x299519){_0x219233[_0x201f('0x1')](_0x1f4ff0,_0x299519);};}function removeListener(_0x2744f5,_0x4281a9){return function(){DashboardItemEvents[_0x201f('0x2')](_0x2744f5,_0x4281a9);};}exports[_0x201f('0x3')]=function(_0x18c664){for(var _0x1d59f5=0x0,_0x379b75=events[_0x201f('0x4')];_0x1d59f5<_0x379b75;_0x1d59f5++){var _0x572a31=events[_0x1d59f5];var _0x37d68a=createListener(_0x201f('0x5')+_0x572a31,_0x18c664);DashboardItemEvents['on'](_0x572a31,_0x37d68a);}}; \ No newline at end of file +var _0xeae8=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xeae8,0xd1));var _0x8eae=function(_0x45336a,_0x2d5b29){_0x45336a=_0x45336a-0x0;var _0x375882=_0xeae8[_0x45336a];return _0x375882;};'use strict';var DashboardItemEvents=require(_0x8eae('0x0'));var events=[_0x8eae('0x1'),_0x8eae('0x2'),_0x8eae('0x3')];function createListener(_0x2cf6b8,_0x13135b){return function(_0x37b073){_0x13135b[_0x8eae('0x4')](_0x2cf6b8,_0x37b073);};}function removeListener(_0x33f719,_0x69c5c3){return function(){DashboardItemEvents[_0x8eae('0x5')](_0x33f719,_0x69c5c3);};}exports[_0x8eae('0x6')]=function(_0x1ee9f9){for(var _0x3b99f1=0x0,_0x2e3258=events['length'];_0x3b99f1<_0x2e3258;_0x3b99f1++){var _0xe50740=events[_0x3b99f1];var _0x5ae02c=createListener(_0x8eae('0x7')+_0xe50740,_0x1ee9f9);DashboardItemEvents['on'](_0xe50740,_0x5ae02c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fd0b7b1..86013a1 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 _0x9efd=['path','express','Router','fs-extra','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x26e758,_0x1ddb95){var _0x1632b1=function(_0x1d3aa5){while(--_0x1d3aa5){_0x26e758['push'](_0x26e758['shift']());}};_0x1632b1(++_0x1ddb95);}(_0x9efd,0x196));var _0xd9ef=function(_0x247c27,_0x4053e5){_0x247c27=_0x247c27-0x0;var _0x20a4c6=_0x9efd[_0x247c27];return _0x20a4c6;};'use strict';var multer=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var path=require(_0xd9ef('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ef('0x3'));var router=express[_0xd9ef('0x4')]();var fs_extra=require(_0xd9ef('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9ef('0x6'));var controller=require(_0xd9ef('0x7'));router[_0xd9ef('0x8')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller['show']);router['post']('/',auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xb')]);router[_0xd9ef('0xc')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xd')]);router[_0xd9ef('0xe')](_0xd9ef('0x9'),auth[_0xd9ef('0xa')](),controller[_0xd9ef('0xf')]);module[_0xd9ef('0x10')]=router; \ No newline at end of file +var _0x1fd4=['/:id','show','post','create','put','update','delete','isAuthenticated','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0x1fd4,0x1b9));var _0x41fd=function(_0x502e15,_0x49ff8f){_0x502e15=_0x502e15-0x0;var _0xadd0c4=_0x1fd4[_0x502e15];return _0xadd0c4;};'use strict';var multer=require('multer');var util=require(_0x41fd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x41fd('0x1'));var router=express[_0x41fd('0x2')]();var fs_extra=require(_0x41fd('0x3'));var auth=require(_0x41fd('0x4'));var interaction=require(_0x41fd('0x5'));var config=require(_0x41fd('0x6'));var controller=require(_0x41fd('0x7'));router[_0x41fd('0x8')](_0x41fd('0x9'),auth['isAuthenticated'](),controller[_0x41fd('0xa')]);router[_0x41fd('0xb')]('/',auth['isAuthenticated'](),controller[_0x41fd('0xc')]);router[_0x41fd('0xd')](_0x41fd('0x9'),auth['isAuthenticated'](),controller[_0x41fd('0xe')]);router[_0x41fd('0xf')](_0x41fd('0x9'),auth[_0x41fd('0x10')](),controller[_0x41fd('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4c0b45b..21afd2d 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 _0xc7dc=['ENUM','first','second','sequelize','exports','STRING'];(function(_0x819107,_0x2b42ba){var _0x395e85=function(_0x3f1d66){while(--_0x3f1d66){_0x819107['push'](_0x819107['shift']());}};_0x395e85(++_0x2b42ba);}(_0xc7dc,0xc9));var _0xcc7d=function(_0x50d086,_0x4e96e0){_0x50d086=_0x50d086-0x0;var _0x2e9e27=_0xc7dc[_0x50d086];return _0x2e9e27;};'use strict';var Sequelize=require(_0xcc7d('0x0'));module[_0xcc7d('0x1')]={'name':{'type':Sequelize[_0xcc7d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcc7d('0x3')](_0xcc7d('0x4'),_0xcc7d('0x5'),'third'),'allowNull':![],'defaultValue':_0xcc7d('0x4')},'description':{'type':Sequelize[_0xcc7d('0x2')]}}; \ No newline at end of file +var _0xa040=['second','third','sequelize','exports','STRING','first'];(function(_0x2f823b,_0x625deb){var _0x5ab527=function(_0x4334d8){while(--_0x4334d8){_0x2f823b['push'](_0x2f823b['shift']());}};_0x5ab527(++_0x625deb);}(_0xa040,0x1b2));var _0x0a04=function(_0x3f9a2b,_0x56c86b){_0x3f9a2b=_0x3f9a2b-0x0;var _0x3be407=_0xa040[_0x3f9a2b];return _0x3be407;};'use strict';var Sequelize=require(_0x0a04('0x0'));module[_0x0a04('0x1')]={'name':{'type':Sequelize[_0x0a04('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x0a04('0x3'),_0x0a04('0x4'),_0x0a04('0x5')),'allowNull':![],'defaultValue':_0x0a04('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a030055..8484050 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 _0xedf9=['name','send','index','map','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','Disposition','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','stack'];(function(_0xca0df0,_0x50d081){var _0x5ed51d=function(_0xbb93f8){while(--_0xbb93f8){_0xca0df0['push'](_0xca0df0['shift']());}};_0x5ed51d(++_0x50d081);}(_0xedf9,0x130));var _0x9edf=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xedf9[_0x1b1f88];return _0x5045b9;};'use strict';var emlformat=require(_0x9edf('0x0'));var rimraf=require(_0x9edf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9edf('0x2'));var moment=require('moment');var BPromise=require(_0x9edf('0x3'));var Mustache=require(_0x9edf('0x4'));var util=require(_0x9edf('0x5'));var path=require(_0x9edf('0x6'));var sox=require(_0x9edf('0x7'));var csv=require(_0x9edf('0x8'));var ejs=require(_0x9edf('0x9'));var fs=require('fs');var fs_extra=require(_0x9edf('0xa'));var _=require(_0x9edf('0xb'));var squel=require(_0x9edf('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9edf('0xd'));var toCsv=require(_0x9edf('0x8'));var querystring=require('querystring');var Papa=require(_0x9edf('0xe'));var Redis=require(_0x9edf('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9edf('0x10'));var as=require(_0x9edf('0x11'));var hardwareService=require(_0x9edf('0x12'));var logger=require(_0x9edf('0x13'))(_0x9edf('0x14'));var utils=require(_0x9edf('0x15'));var config=require(_0x9edf('0x16'));var licenseUtil=require(_0x9edf('0x17'));var db=require(_0x9edf('0x18'))['db'];function respondWithStatusCode(_0x4dcfd8,_0x108e04){_0x108e04=_0x108e04||0xcc;return function(_0x5289c5){if(_0x5289c5){return _0x4dcfd8[_0x9edf('0x19')](_0x108e04);}return _0x4dcfd8[_0x9edf('0x1a')](_0x108e04)[_0x9edf('0x1b')]();};}function respondWithResult(_0x2d94e9,_0x5e3852){_0x5e3852=_0x5e3852||0xc8;return function(_0x3beea4){if(_0x3beea4){return _0x2d94e9[_0x9edf('0x1a')](_0x5e3852)[_0x9edf('0x1c')](_0x3beea4);}};}function respondWithFilteredResult(_0x5a54a2,_0x51659d){return function(_0x1b7247){if(_0x1b7247){var _0x2ee789=typeof _0x51659d[_0x9edf('0x1d')]===_0x9edf('0x1e')&&typeof _0x51659d[_0x9edf('0x1f')]===_0x9edf('0x1e');var _0x283841=_0x1b7247[_0x9edf('0x20')];var _0x246711=_0x2ee789?0x0:_0x51659d[_0x9edf('0x1d')];var _0x6744d4=_0x2ee789?_0x1b7247[_0x9edf('0x20')]:_0x51659d['offset']+_0x51659d[_0x9edf('0x1f')];var _0x5a652f;if(_0x6744d4>=_0x283841){_0x6744d4=_0x283841;_0x5a652f=0xc8;}else{_0x5a652f=0xce;}_0x5a54a2[_0x9edf('0x1a')](_0x5a652f);return _0x5a54a2['set'](_0x9edf('0x21'),_0x246711+'-'+_0x6744d4+'/'+_0x283841)[_0x9edf('0x1c')](_0x1b7247);}return null;};}function patchUpdates(_0x32e6ed){return function(_0x477663){try{jsonpatch[_0x9edf('0x22')](_0x477663,_0x32e6ed,!![]);}catch(_0x945520){return BPromise[_0x9edf('0x23')](_0x945520);}return _0x477663[_0x9edf('0x24')]();};}function saveUpdates(_0x40bb10,_0x409686){return function(_0x1df3c6){if(_0x1df3c6){return _0x1df3c6[_0x9edf('0x25')](_0x40bb10)[_0x9edf('0x26')](function(_0xf11c57){return _0xf11c57;});}return null;};}function removeEntity(_0x56f461,_0x4f3f9c){return function(_0x479c6f){if(_0x479c6f){return _0x479c6f['destroy']()[_0x9edf('0x26')](function(){var _0x30f107=_0x479c6f[_0x9edf('0x27')]({'plain':!![]});var _0x43d02d=_0x9edf('0x28');return db[_0x9edf('0x29')]['destroy']({'where':{'type':_0x43d02d,'resourceId':_0x30f107['id']}})['then'](function(){return _0x479c6f;});})[_0x9edf('0x26')](function(){_0x56f461['status'](0xcc)[_0x9edf('0x1b')]();});}};}function handleEntityNotFound(_0xa3feb0,_0x1bddd1){return function(_0x43fe92){if(!_0x43fe92){_0xa3feb0['sendStatus'](0x194);}return _0x43fe92;};}function handleError(_0x1fa34b,_0x5a4877){_0x5a4877=_0x5a4877||0x1f4;return function(_0x52a1ee){logger[_0x9edf('0x2a')](_0x52a1ee[_0x9edf('0x2b')]);if(_0x52a1ee['name']){delete _0x52a1ee[_0x9edf('0x2c')];}_0x1fa34b[_0x9edf('0x1a')](_0x5a4877)[_0x9edf('0x2d')](_0x52a1ee);};}exports[_0x9edf('0x2e')]=function(_0x1940b4,_0x2b5c12){var _0x110cca={},_0x4130a9={},_0x5b8b80={'count':0x0,'rows':[]};var _0x552308=_[_0x9edf('0x2f')](db['Disposition']['rawAttributes'],function(_0x4d6f28){return{'name':_0x4d6f28[_0x9edf('0x30')],'type':_0x4d6f28[_0x9edf('0x31')][_0x9edf('0x32')]};});_0x4130a9[_0x9edf('0x33')]=_[_0x9edf('0x2f')](_0x552308,'name');_0x4130a9['query']=_['keys'](_0x1940b4['query']);_0x4130a9[_0x9edf('0x34')]=_[_0x9edf('0x35')](_0x4130a9[_0x9edf('0x33')],_0x4130a9[_0x9edf('0x36')]);_0x110cca[_0x9edf('0x37')]=_[_0x9edf('0x35')](_0x4130a9[_0x9edf('0x33')],qs[_0x9edf('0x38')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x38')]));_0x110cca[_0x9edf('0x37')]=_0x110cca[_0x9edf('0x37')][_0x9edf('0x39')]?_0x110cca[_0x9edf('0x37')]:_0x4130a9[_0x9edf('0x33')];if(!_0x1940b4[_0x9edf('0x36')]['hasOwnProperty'](_0x9edf('0x3a'))){_0x110cca[_0x9edf('0x1f')]=qs[_0x9edf('0x1f')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x1f')]);_0x110cca[_0x9edf('0x1d')]=qs[_0x9edf('0x1d')](_0x1940b4[_0x9edf('0x36')][_0x9edf('0x1d')]);}_0x110cca[_0x9edf('0x3b')]=qs[_0x9edf('0x3c')](_0x1940b4[_0x9edf('0x36')]['sort']);_0x110cca[_0x9edf('0x3d')]=qs[_0x9edf('0x34')](_[_0x9edf('0x3e')](_0x1940b4[_0x9edf('0x36')],_0x4130a9[_0x9edf('0x34')]),_0x552308);if(_0x1940b4['query']['filter']){_0x110cca[_0x9edf('0x3d')]=_['merge'](_0x110cca['where'],{'$or':_['map'](_0x552308,function(_0x15187b){if(_0x15187b[_0x9edf('0x31')]!==_0x9edf('0x3f')){var _0x271024={};_0x271024[_0x15187b[_0x9edf('0x2c')]]={'$like':'%'+_0x1940b4[_0x9edf('0x36')][_0x9edf('0x40')]+'%'};return _0x271024;}})});}_0x110cca=_[_0x9edf('0x41')]({},_0x110cca,_0x1940b4[_0x9edf('0x42')]);var _0x1d8884={'where':_0x110cca[_0x9edf('0x3d')]};return db[_0x9edf('0x43')][_0x9edf('0x20')](_0x1d8884)[_0x9edf('0x26')](function(_0x7263f0){_0x5b8b80[_0x9edf('0x20')]=_0x7263f0;if(_0x1940b4[_0x9edf('0x36')][_0x9edf('0x44')]){_0x110cca[_0x9edf('0x45')]=[{'all':!![]}];}return db[_0x9edf('0x43')][_0x9edf('0x46')](_0x110cca);})[_0x9edf('0x26')](function(_0x2b9f79){_0x5b8b80[_0x9edf('0x47')]=_0x2b9f79;return _0x5b8b80;})['then'](respondWithFilteredResult(_0x2b5c12,_0x110cca))[_0x9edf('0x48')](handleError(_0x2b5c12,null));};exports[_0x9edf('0x49')]=function(_0x16b795,_0x5675fd){var _0x27f741={'raw':!![],'where':{'id':_0x16b795[_0x9edf('0x4a')]['id']}},_0x47898b={};_0x47898b[_0x9edf('0x33')]=_[_0x9edf('0x4b')](db['Disposition']['rawAttributes']);_0x47898b[_0x9edf('0x36')]=_[_0x9edf('0x4b')](_0x16b795[_0x9edf('0x36')]);_0x47898b[_0x9edf('0x34')]=_[_0x9edf('0x35')](_0x47898b[_0x9edf('0x33')],_0x47898b[_0x9edf('0x36')]);_0x27f741[_0x9edf('0x37')]=_[_0x9edf('0x35')](_0x47898b[_0x9edf('0x33')],qs[_0x9edf('0x38')](_0x16b795[_0x9edf('0x36')][_0x9edf('0x38')]));_0x27f741['attributes']=_0x27f741['attributes'][_0x9edf('0x39')]?_0x27f741[_0x9edf('0x37')]:_0x47898b[_0x9edf('0x33')];if(_0x16b795[_0x9edf('0x36')][_0x9edf('0x44')]){_0x27f741[_0x9edf('0x45')]=[{'all':!![]}];}_0x27f741=_[_0x9edf('0x41')]({},_0x27f741,_0x16b795['options']);return db[_0x9edf('0x43')][_0x9edf('0x4c')](_0x27f741)[_0x9edf('0x26')](handleEntityNotFound(_0x5675fd,null))[_0x9edf('0x26')](respondWithResult(_0x5675fd,null))['catch'](handleError(_0x5675fd,null));};exports['create']=function(_0x422230,_0x4c4473){return db[_0x9edf('0x43')][_0x9edf('0x4d')](_0x422230[_0x9edf('0x4e')],{})[_0x9edf('0x26')](function(_0xc8e233){var _0x50f9ff=_0x422230[_0x9edf('0x4f')][_0x9edf('0x27')]({'plain':!![]});if(!_0x50f9ff)throw new Error(_0x9edf('0x50'));if(_0x50f9ff[_0x9edf('0x51')]==='user'){var _0x221209=_0xc8e233[_0x9edf('0x27')]({'plain':!![]});var _0x4c56ec=_0x9edf('0x28');return db[_0x9edf('0x52')][_0x9edf('0x4c')]({'where':{'name':_0x4c56ec,'userProfileId':_0x50f9ff[_0x9edf('0x53')]},'raw':!![]})['then'](function(_0x3573c2){if(_0x3573c2&&_0x3573c2[_0x9edf('0x54')]===0x0){return db[_0x9edf('0x29')][_0x9edf('0x4d')]({'name':_0x221209[_0x9edf('0x2c')],'resourceId':_0x221209['id'],'type':_0x3573c2[_0x9edf('0x2c')],'sectionId':_0x3573c2['id']},{})[_0x9edf('0x26')](function(){return _0xc8e233;});}else{return _0xc8e233;}})[_0x9edf('0x48')](function(_0x2b5608){logger['error'](_0x9edf('0x55'),_0x2b5608);throw _0x2b5608;});}return _0xc8e233;})[_0x9edf('0x26')](respondWithResult(_0x4c4473,0xc9))[_0x9edf('0x48')](handleError(_0x4c4473,null));};exports['update']=function(_0x34f5b7,_0x235d98){if(_0x34f5b7[_0x9edf('0x4e')]['id']){delete _0x34f5b7['body']['id'];}return db[_0x9edf('0x43')][_0x9edf('0x4c')]({'where':{'id':_0x34f5b7['params']['id']}})[_0x9edf('0x26')](handleEntityNotFound(_0x235d98,null))['then'](saveUpdates(_0x34f5b7[_0x9edf('0x4e')],null))['then'](respondWithResult(_0x235d98,null))[_0x9edf('0x48')](handleError(_0x235d98,null));};exports[_0x9edf('0x56')]=function(_0x1865e5,_0x2c0001){return db['Disposition'][_0x9edf('0x4c')]({'where':{'id':_0x1865e5['params']['id']}})[_0x9edf('0x26')](handleEntityNotFound(_0x2c0001,null))[_0x9edf('0x26')](removeEntity(_0x2c0001,null))[_0x9edf('0x48')](handleError(_0x2c0001,null));}; \ No newline at end of file +var _0x855a=['intersection','fields','query','attributes','hasOwnProperty','nolimit','order','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','type','key','model','filters'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x855a,0x6f));var _0xa855=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0x855a[_0x2af29a];return _0x5ef02f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa855('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa855('0x1'));var rp=require(_0xa855('0x2'));var moment=require(_0xa855('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa855('0x4'));var sox=require(_0xa855('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa855('0x6'));var _=require(_0xa855('0x7'));var squel=require(_0xa855('0x8'));var crypto=require(_0xa855('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa855('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa855('0xb'));var Papa=require(_0xa855('0xc'));var Redis=require(_0xa855('0xd'));var authService=require(_0xa855('0xe'));var qs=require(_0xa855('0xf'));var as=require(_0xa855('0x10'));var hardwareService=require(_0xa855('0x11'));var logger=require(_0xa855('0x12'))('api');var utils=require(_0xa855('0x13'));var config=require(_0xa855('0x14'));var licenseUtil=require(_0xa855('0x15'));var db=require(_0xa855('0x16'))['db'];function respondWithStatusCode(_0x26dbd0,_0xdd7dff){_0xdd7dff=_0xdd7dff||0xcc;return function(_0x2dac0c){if(_0x2dac0c){return _0x26dbd0['sendStatus'](_0xdd7dff);}return _0x26dbd0[_0xa855('0x17')](_0xdd7dff)[_0xa855('0x18')]();};}function respondWithResult(_0x48b866,_0x275c1d){_0x275c1d=_0x275c1d||0xc8;return function(_0x16a709){if(_0x16a709){return _0x48b866['status'](_0x275c1d)['json'](_0x16a709);}};}function respondWithFilteredResult(_0x533744,_0x878143){return function(_0x142659){if(_0x142659){var _0xf66be4=typeof _0x878143[_0xa855('0x19')]===_0xa855('0x1a')&&typeof _0x878143[_0xa855('0x1b')]===_0xa855('0x1a');var _0x2f32db=_0x142659[_0xa855('0x1c')];var _0x5cb1a4=_0xf66be4?0x0:_0x878143[_0xa855('0x19')];var _0x4e3888=_0xf66be4?_0x142659['count']:_0x878143[_0xa855('0x19')]+_0x878143['limit'];var _0x14adf8;if(_0x4e3888>=_0x2f32db){_0x4e3888=_0x2f32db;_0x14adf8=0xc8;}else{_0x14adf8=0xce;}_0x533744['status'](_0x14adf8);return _0x533744[_0xa855('0x1d')](_0xa855('0x1e'),_0x5cb1a4+'-'+_0x4e3888+'/'+_0x2f32db)[_0xa855('0x1f')](_0x142659);}return null;};}function patchUpdates(_0x4fa513){return function(_0x20f68d){try{jsonpatch[_0xa855('0x20')](_0x20f68d,_0x4fa513,!![]);}catch(_0x29e4b8){return BPromise[_0xa855('0x21')](_0x29e4b8);}return _0x20f68d[_0xa855('0x22')]();};}function saveUpdates(_0x1e27de,_0x3bed22){return function(_0x144dee){if(_0x144dee){return _0x144dee[_0xa855('0x23')](_0x1e27de)[_0xa855('0x24')](function(_0xfff557){return _0xfff557;});}return null;};}function removeEntity(_0x2fb280,_0x24b264){return function(_0x42dbe3){if(_0x42dbe3){return _0x42dbe3[_0xa855('0x25')]()[_0xa855('0x24')](function(){var _0x4ddf25=_0x42dbe3[_0xa855('0x26')]({'plain':!![]});var _0x42d742=_0xa855('0x27');return db[_0xa855('0x28')][_0xa855('0x25')]({'where':{'type':_0x42d742,'resourceId':_0x4ddf25['id']}})[_0xa855('0x24')](function(){return _0x42dbe3;});})[_0xa855('0x24')](function(){_0x2fb280[_0xa855('0x17')](0xcc)[_0xa855('0x18')]();});}};}function handleEntityNotFound(_0x390d66,_0x614798){return function(_0x36257f){if(!_0x36257f){_0x390d66[_0xa855('0x29')](0x194);}return _0x36257f;};}function handleError(_0x5c4107,_0x5c3ff7){_0x5c3ff7=_0x5c3ff7||0x1f4;return function(_0x307509){logger[_0xa855('0x2a')](_0x307509[_0xa855('0x2b')]);if(_0x307509['name']){delete _0x307509[_0xa855('0x2c')];}_0x5c4107[_0xa855('0x17')](_0x5c3ff7)[_0xa855('0x2d')](_0x307509);};}exports[_0xa855('0x2e')]=function(_0x5214d8,_0x523769){var _0x4273f7={},_0x462147={},_0x5c1b5b={'count':0x0,'rows':[]};var _0x9159dc=_[_0xa855('0x2f')](db[_0xa855('0x30')]['rawAttributes'],function(_0x54669d){return{'name':_0x54669d['fieldName'],'type':_0x54669d[_0xa855('0x31')][_0xa855('0x32')]};});_0x462147[_0xa855('0x33')]=_[_0xa855('0x2f')](_0x9159dc,_0xa855('0x2c'));_0x462147['query']=_['keys'](_0x5214d8['query']);_0x462147[_0xa855('0x34')]=_[_0xa855('0x35')](_0x462147[_0xa855('0x33')],_0x462147['query']);_0x4273f7['attributes']=_[_0xa855('0x35')](_0x462147[_0xa855('0x33')],qs[_0xa855('0x36')](_0x5214d8[_0xa855('0x37')][_0xa855('0x36')]));_0x4273f7[_0xa855('0x38')]=_0x4273f7[_0xa855('0x38')]['length']?_0x4273f7[_0xa855('0x38')]:_0x462147[_0xa855('0x33')];if(!_0x5214d8[_0xa855('0x37')][_0xa855('0x39')](_0xa855('0x3a'))){_0x4273f7[_0xa855('0x1b')]=qs[_0xa855('0x1b')](_0x5214d8[_0xa855('0x37')]['limit']);_0x4273f7[_0xa855('0x19')]=qs[_0xa855('0x19')](_0x5214d8[_0xa855('0x37')][_0xa855('0x19')]);}_0x4273f7[_0xa855('0x3b')]=qs['sort'](_0x5214d8['query']['sort']);_0x4273f7[_0xa855('0x3c')]=qs[_0xa855('0x34')](_[_0xa855('0x3d')](_0x5214d8[_0xa855('0x37')],_0x462147[_0xa855('0x34')]),_0x9159dc);if(_0x5214d8['query']['filter']){_0x4273f7[_0xa855('0x3c')]=_[_0xa855('0x3e')](_0x4273f7[_0xa855('0x3c')],{'$or':_[_0xa855('0x2f')](_0x9159dc,function(_0x440231){if(_0x440231[_0xa855('0x31')]!=='VIRTUAL'){var _0x4e3cb0={};_0x4e3cb0[_0x440231[_0xa855('0x2c')]]={'$like':'%'+_0x5214d8[_0xa855('0x37')]['filter']+'%'};return _0x4e3cb0;}})});}_0x4273f7=_['merge']({},_0x4273f7,_0x5214d8['options']);var _0x3a5b18={'where':_0x4273f7[_0xa855('0x3c')]};return db[_0xa855('0x30')][_0xa855('0x1c')](_0x3a5b18)[_0xa855('0x24')](function(_0x577a2b){_0x5c1b5b[_0xa855('0x1c')]=_0x577a2b;if(_0x5214d8[_0xa855('0x37')][_0xa855('0x3f')]){_0x4273f7[_0xa855('0x40')]=[{'all':!![]}];}return db[_0xa855('0x30')][_0xa855('0x41')](_0x4273f7);})[_0xa855('0x24')](function(_0x2ec195){_0x5c1b5b[_0xa855('0x42')]=_0x2ec195;return _0x5c1b5b;})[_0xa855('0x24')](respondWithFilteredResult(_0x523769,_0x4273f7))[_0xa855('0x43')](handleError(_0x523769,null));};exports[_0xa855('0x44')]=function(_0x5b087d,_0x44b8f3){var _0x2702ce={'raw':!![],'where':{'id':_0x5b087d[_0xa855('0x45')]['id']}},_0x3042e1={};_0x3042e1['model']=_['keys'](db['Disposition']['rawAttributes']);_0x3042e1['query']=_[_0xa855('0x46')](_0x5b087d['query']);_0x3042e1['filters']=_[_0xa855('0x35')](_0x3042e1[_0xa855('0x33')],_0x3042e1['query']);_0x2702ce['attributes']=_[_0xa855('0x35')](_0x3042e1['model'],qs['fields'](_0x5b087d['query'][_0xa855('0x36')]));_0x2702ce['attributes']=_0x2702ce[_0xa855('0x38')][_0xa855('0x47')]?_0x2702ce['attributes']:_0x3042e1[_0xa855('0x33')];if(_0x5b087d['query']['includeAll']){_0x2702ce[_0xa855('0x40')]=[{'all':!![]}];}_0x2702ce=_['merge']({},_0x2702ce,_0x5b087d[_0xa855('0x48')]);return db['Disposition'][_0xa855('0x49')](_0x2702ce)['then'](handleEntityNotFound(_0x44b8f3,null))[_0xa855('0x24')](respondWithResult(_0x44b8f3,null))[_0xa855('0x43')](handleError(_0x44b8f3,null));};exports[_0xa855('0x4a')]=function(_0x35d73b,_0x5e71c7){return db['Disposition']['create'](_0x35d73b[_0xa855('0x4b')],{})['then'](function(_0x5a5979){var _0x17f167=_0x35d73b[_0xa855('0x4c')][_0xa855('0x26')]({'plain':!![]});if(!_0x17f167)throw new Error(_0xa855('0x4d'));if(_0x17f167[_0xa855('0x4e')]===_0xa855('0x4c')){var _0x4b974a=_0x5a5979[_0xa855('0x26')]({'plain':!![]});var _0x190198='Dispositions';return db['UserProfileSection'][_0xa855('0x49')]({'where':{'name':_0x190198,'userProfileId':_0x17f167[_0xa855('0x4f')]},'raw':!![]})[_0xa855('0x24')](function(_0x5974a9){if(_0x5974a9&&_0x5974a9[_0xa855('0x50')]===0x0){return db[_0xa855('0x28')][_0xa855('0x4a')]({'name':_0x4b974a[_0xa855('0x2c')],'resourceId':_0x4b974a['id'],'type':_0x5974a9[_0xa855('0x2c')],'sectionId':_0x5974a9['id']},{})[_0xa855('0x24')](function(){return _0x5a5979;});}else{return _0x5a5979;}})[_0xa855('0x43')](function(_0x1de758){logger[_0xa855('0x2a')](_0xa855('0x51'),_0x1de758);throw _0x1de758;});}return _0x5a5979;})[_0xa855('0x24')](respondWithResult(_0x5e71c7,0xc9))[_0xa855('0x43')](handleError(_0x5e71c7,null));};exports[_0xa855('0x23')]=function(_0x94a700,_0x5dddd2){if(_0x94a700[_0xa855('0x4b')]['id']){delete _0x94a700[_0xa855('0x4b')]['id'];}return db['Disposition'][_0xa855('0x49')]({'where':{'id':_0x94a700[_0xa855('0x45')]['id']}})[_0xa855('0x24')](handleEntityNotFound(_0x5dddd2,null))[_0xa855('0x24')](saveUpdates(_0x94a700['body'],null))[_0xa855('0x24')](respondWithResult(_0x5dddd2,null))[_0xa855('0x43')](handleError(_0x5dddd2,null));};exports[_0xa855('0x25')]=function(_0x190ef8,_0x580f5c){return db[_0xa855('0x30')][_0xa855('0x49')]({'where':{'id':_0x190ef8['params']['id']}})[_0xa855('0x24')](handleEntityNotFound(_0x580f5c,null))[_0xa855('0x24')](removeEntity(_0x580f5c,null))['catch'](handleError(_0x580f5c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index e82ce53..10040e7 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 _0x33fd=['../../config/environment','./disposition.attributes','define','name_voice','ListId','name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x53ec4a,_0x43e28a){var _0x9d621c=function(_0x33dbd4){while(--_0x33dbd4){_0x53ec4a['push'](_0x53ec4a['shift']());}};_0x9d621c(++_0x43e28a);}(_0x33fd,0x1c7));var _0xd33f=function(_0x10626,_0x4fa035){_0x10626=_0x10626-0x0;var _0x2f43b3=_0x33fd[_0x10626];return _0x2f43b3;};'use strict';var _=require(_0xd33f('0x0'));var util=require(_0xd33f('0x1'));var logger=require(_0xd33f('0x2'))(_0xd33f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd33f('0x4'));var fs=require('fs');var path=require(_0xd33f('0x5'));var rimraf=require(_0xd33f('0x6'));var config=require(_0xd33f('0x7'));var attributes=require(_0xd33f('0x8'));module['exports']=function(_0x46dbf7,_0x339c8e){return _0x46dbf7[_0xd33f('0x9')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xd33f('0xa'),'fields':['name',_0xd33f('0xb')]},{'unique':!![],'name':_0xd33f('0xc'),'fields':[_0xd33f('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xd33f('0xe'),'fields':['name',_0xd33f('0xf')]},{'unique':!![],'name':_0xd33f('0x10'),'fields':[_0xd33f('0xd'),_0xd33f('0x11')]},{'unique':!![],'name':_0xd33f('0x12'),'fields':[_0xd33f('0xd'),_0xd33f('0x13')]},{'unique':!![],'name':_0xd33f('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xd33f('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fc7=['tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','Disposition'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x8fc7,0x1d8));var _0x78fc=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x8fc7[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x78fc('0x0'));var util=require(_0x78fc('0x1'));var logger=require(_0x78fc('0x2'))(_0x78fc('0x3'));var moment=require('moment');var BPromise=require(_0x78fc('0x4'));var rp=require(_0x78fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x78fc('0x6'));var config=require('../../config/environment');var attributes=require(_0x78fc('0x7'));module[_0x78fc('0x8')]=function(_0x2fefb2,_0x3a36a4){return _0x2fefb2[_0x78fc('0x9')](_0x78fc('0xa'),attributes,{'tableName':_0x78fc('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x78fc('0xc'),'fields':[_0x78fc('0xd'),_0x78fc('0xe')]},{'unique':!![],'name':_0x78fc('0xf'),'fields':[_0x78fc('0xd'),_0x78fc('0x10')]},{'unique':!![],'name':_0x78fc('0x11'),'fields':[_0x78fc('0xd'),_0x78fc('0x12')]},{'unique':!![],'name':'name_sms','fields':[_0x78fc('0xd'),'SmsAccountId']},{'unique':!![],'name':_0x78fc('0x13'),'fields':[_0x78fc('0xd'),_0x78fc('0x14')]},{'unique':!![],'name':_0x78fc('0x15'),'fields':[_0x78fc('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x78fc('0x16'),'fields':[_0x78fc('0xd'),'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 bd8a585..d43e5dc 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(_0x37fa03,_0x16ad88){var _0x54820c=function(_0xb17a41){while(--_0xb17a41){_0x37fa03['push'](_0x37fa03['shift']());}};_0x54820c(++_0x16ad88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x274c2e,_0x7809ba){var _0x1f3821=function(_0x50dac6){while(--_0x50dac6){_0x274c2e['push'](_0x274c2e['shift']());}};_0x1f3821(++_0x7809ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f728c8e..60106ff 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 _0xe33a=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xab3370,_0x3f98f2){var _0x359956=function(_0x3960a2){while(--_0x3960a2){_0xab3370['push'](_0xab3370['shift']());}};_0x359956(++_0x3f98f2);}(_0xe33a,0x1bc));var _0xae33=function(_0x2707a7,_0x303d1c){_0x2707a7=_0x2707a7-0x0;var _0x10d254=_0xe33a[_0x2707a7];return _0x10d254;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae33('0x0'));var timeout=require(_0xae33('0x1'));var express=require(_0xae33('0x2'));var router=express[_0xae33('0x3')]();var fs_extra=require(_0xae33('0x4'));var auth=require(_0xae33('0x5'));var interaction=require(_0xae33('0x6'));var config=require('../../config/environment');var controller=require(_0xae33('0x7'));router[_0xae33('0x8')]('/',auth[_0xae33('0x9')](),controller[_0xae33('0xa')]);router['get'](_0xae33('0xb'),auth['isAuthenticated'](),controller[_0xae33('0xc')]);router[_0xae33('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae33('0xe')](_0xae33('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xae33('0xf')](_0xae33('0xb'),auth[_0xae33('0x9')](),controller[_0xae33('0x10')]);module['exports']=router; \ No newline at end of file +var _0xce35=['../../config/environment','./disposition.controller','get','index','isAuthenticated','post','/:id','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1c17c7,_0x178043){var _0x4d1e9d=function(_0x1cb941){while(--_0x1cb941){_0x1c17c7['push'](_0x1c17c7['shift']());}};_0x4d1e9d(++_0x178043);}(_0xce35,0x127));var _0x5ce3=function(_0x22d562,_0x131123){_0x22d562=_0x22d562-0x0;var _0x577e7c=_0xce35[_0x22d562];return _0x577e7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ce3('0x0'));var timeout=require(_0x5ce3('0x1'));var express=require('express');var router=express[_0x5ce3('0x2')]();var fs_extra=require(_0x5ce3('0x3'));var auth=require(_0x5ce3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5ce3('0x5'));var controller=require(_0x5ce3('0x6'));router[_0x5ce3('0x7')]('/',auth['isAuthenticated'](),controller[_0x5ce3('0x8')]);router[_0x5ce3('0x7')]('/:id',auth[_0x5ce3('0x9')](),controller['show']);router[_0x5ce3('0xa')]('/',auth[_0x5ce3('0x9')](),controller['create']);router['put'](_0x5ce3('0xb'),auth[_0x5ce3('0x9')](),controller[_0x5ce3('0xc')]);router[_0x5ce3('0xd')](_0x5ce3('0xb'),auth[_0x5ce3('0x9')](),controller[_0x5ce3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 66fc254..219b789 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 _0x43e0=['7200','v17,v27,v29','INTEGER','SIP','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','localstationid','ENUM','2400','4800','9600','12000','14400'];(function(_0x2f0983,_0x414536){var _0x2258ce=function(_0x100361){while(--_0x100361){_0x2f0983['push'](_0x2f0983['shift']());}};_0x2258ce(++_0x414536);}(_0x43e0,0x197));var _0x043e=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x43e0[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x043e('0x0'));module[_0x043e('0x1')]={'name':{'type':Sequelize[_0x043e('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x043e('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x043e('0x3'),'no'),'defaultValue':_0x043e('0x3')},'headerinfo':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x043e('0x2')],'unique':_0x043e('0x4')},'minrate':{'type':Sequelize[_0x043e('0x5')](_0x043e('0x6'),_0x043e('0x7'),'7200',_0x043e('0x8'),_0x043e('0x9'),_0x043e('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x043e('0x5')](_0x043e('0x6'),_0x043e('0x7'),_0x043e('0xb'),'9600',_0x043e('0x9'),'14400'),'defaultValue':_0x043e('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x043e('0xc')},'gateway':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x043e('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x043e('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x043e('0x5')](_0x043e('0xe'),'IAX',_0x043e('0xf'),'KHOMP'),'defaultValue':_0x043e('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x043e('0x10')],'defaultValue':function(){return _0x043e('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x043e('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x043e('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ff599){if(!_0x3ff599)this[_0x043e('0x14')](_0x043e('0x15'),null);this[_0x043e('0x14')]('mandatoryDisposition',_0x3ff599);}}}; \ No newline at end of file +var _0xf71d=['12000','14400','SIP','IAX','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600'];(function(_0x39ee81,_0x1f6496){var _0x40f1e1=function(_0x21bb46){while(--_0x21bb46){_0x39ee81['push'](_0x39ee81['shift']());}};_0x40f1e1(++_0x1f6496);}(_0xf71d,0xda));var _0xdf71=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xf71d[_0x65c50e];return _0x4573e7;};'use strict';var Sequelize=require(_0xdf71('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf71('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdf71('0x1')]},'ecm':{'type':Sequelize[_0xdf71('0x2')]('yes','no'),'defaultValue':_0xdf71('0x3')},'headerinfo':{'type':Sequelize[_0xdf71('0x1')],'defaultValue':_0xdf71('0x4')},'localstationid':{'type':Sequelize[_0xdf71('0x1')],'unique':_0xdf71('0x5')},'minrate':{'type':Sequelize[_0xdf71('0x2')](_0xdf71('0x6'),_0xdf71('0x7'),_0xdf71('0x8'),_0xdf71('0x9'),_0xdf71('0xa'),'14400'),'defaultValue':_0xdf71('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0xdf71('0x6'),'4800',_0xdf71('0x8'),_0xdf71('0x9'),_0xdf71('0xa'),_0xdf71('0xb')),'defaultValue':_0xdf71('0xb')},'modem':{'type':Sequelize[_0xdf71('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdf71('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdf71('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdf71('0x2')](_0xdf71('0xc'),_0xdf71('0xd'),'DADHI','KHOMP'),'defaultValue':_0xdf71('0xc')},'key':{'type':Sequelize[_0xdf71('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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdf71('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf71('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf71('0xf')],'allowNull':!![],'defaultValue':null,'comment':_0xdf71('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xdf71('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x413220){if(!_0x413220)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xdf71('0x11')](_0xdf71('0x12'),_0x413220);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 07c19c7..349e504 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 _0x25f9=['modem','push','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','transaction','omit','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','Contacts','updatedAt','DESC','attachments','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','FaxAccounts','destroy','sendStatus','name','index','Pause','FaxAccount','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','map','type','VIRTUAL','options','includeAll','rows','show','params','mandatoryDispositionPause','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','finally','send','getApplications','context','exten','app','system','description','priority','Answer','CDR(type)=inbound-fax','Set','localstationid','faxdetect','headerinfo'];(function(_0x518b72,_0xbef3a2){var _0x43c7ba=function(_0x78fba2){while(--_0x78fba2){_0x518b72['push'](_0x518b72['shift']());}};_0x43c7ba(++_0xbef3a2);}(_0x25f9,0xfb));var _0x925f=function(_0x492e1e,_0x263285){_0x492e1e=_0x492e1e-0x0;var _0x3644ff=_0x25f9[_0x492e1e];return _0x3644ff;};'use strict';var emlformat=require(_0x925f('0x0'));var rimraf=require(_0x925f('0x1'));var zipdir=require(_0x925f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x925f('0x3'));var moment=require(_0x925f('0x4'));var BPromise=require(_0x925f('0x5'));var Mustache=require('mustache');var util=require(_0x925f('0x6'));var path=require(_0x925f('0x7'));var sox=require('sox');var csv=require(_0x925f('0x8'));var ejs=require(_0x925f('0x9'));var fs=require('fs');var fs_extra=require(_0x925f('0xa'));var _=require(_0x925f('0xb'));var squel=require(_0x925f('0xc'));var crypto=require(_0x925f('0xd'));var jsforce=require(_0x925f('0xe'));var deskjs=require(_0x925f('0xf'));var toCsv=require(_0x925f('0x8'));var querystring=require(_0x925f('0x10'));var Papa=require(_0x925f('0x11'));var Redis=require('ioredis');var authService=require(_0x925f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x925f('0x13'));var hardwareService=require(_0x925f('0x14'));var logger=require(_0x925f('0x15'))(_0x925f('0x16'));var utils=require(_0x925f('0x17'));var config=require(_0x925f('0x18'));var licenseUtil=require(_0x925f('0x19'));var db=require(_0x925f('0x1a'))['db'];config['redis']=_[_0x925f('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x925f('0x1c'))(new Redis(config[_0x925f('0x1d')]));require(_0x925f('0x1e'))[_0x925f('0x1f')](socket);var jayson=require(_0x925f('0x20'));var client=jayson[_0x925f('0x21')][_0x925f('0x22')]({'port':0x232c});var client9002=jayson[_0x925f('0x21')][_0x925f('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x527a40,_0x477f75,_0x151130,_0x1dbdb2){return new BPromise(function(_0x2fea51,_0x43a5f6){var _0x5d8e9a=_0x1dbdb2||client;return _0x5d8e9a[_0x925f('0x23')](_0x527a40,_0x151130)['then'](function(_0x3dc9bf){logger[_0x925f('0x24')](_0x925f('0x25'),_0x477f75,_0x925f('0x26'));logger['debug'](_0x925f('0x27'),_0x477f75,_0x925f('0x26'),JSON[_0x925f('0x28')](_0x3dc9bf));if(_0x3dc9bf[_0x925f('0x29')]){if(_0x3dc9bf['error'][_0x925f('0x2a')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x477f75,_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);return _0x43a5f6(_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x477f75,_0x3dc9bf['error'][_0x925f('0x2b')]);return _0x2fea51(_0x3dc9bf[_0x925f('0x29')][_0x925f('0x2b')]);}else{logger[_0x925f('0x24')](_0x925f('0x25'),_0x477f75,'request\x20sent');_0x2fea51(_0x3dc9bf[_0x925f('0x2c')]['message']);}})['catch'](function(_0xcb92db){logger[_0x925f('0x29')](_0x925f('0x25'),_0x477f75,_0xcb92db);_0x43a5f6(_0xcb92db);});});}function respondWithStatusCode(_0xa68f36,_0x352a10){_0x352a10=_0x352a10||0xcc;return function(_0x2d4838){if(_0x2d4838){return _0xa68f36['sendStatus'](_0x352a10);}return _0xa68f36['status'](_0x352a10)[_0x925f('0x2d')]();};}function respondWithResult(_0x13a286,_0x6c35e8){_0x6c35e8=_0x6c35e8||0xc8;return function(_0x406d6e){if(_0x406d6e){return _0x13a286[_0x925f('0x2e')](_0x6c35e8)[_0x925f('0x2f')](_0x406d6e);}};}function respondWithFilteredResult(_0x2f9283,_0x102f62){return function(_0x4371a0){if(_0x4371a0){var _0x19fcfe=typeof _0x102f62[_0x925f('0x30')]===_0x925f('0x31')&&typeof _0x102f62[_0x925f('0x32')]===_0x925f('0x31');var _0x3d2bad=_0x4371a0[_0x925f('0x33')];var _0x44519f=_0x19fcfe?0x0:_0x102f62['offset'];var _0x4034fe=_0x19fcfe?_0x4371a0['count']:_0x102f62[_0x925f('0x30')]+_0x102f62[_0x925f('0x32')];var _0xf931f7;if(_0x4034fe>=_0x3d2bad){_0x4034fe=_0x3d2bad;_0xf931f7=0xc8;}else{_0xf931f7=0xce;}_0x2f9283[_0x925f('0x2e')](_0xf931f7);return _0x2f9283[_0x925f('0x34')](_0x925f('0x35'),_0x44519f+'-'+_0x4034fe+'/'+_0x3d2bad)['json'](_0x4371a0);}return null;};}function patchUpdates(_0x1489c2){return function(_0x3a1a19){try{jsonpatch['apply'](_0x3a1a19,_0x1489c2,!![]);}catch(_0x3ff8ff){return BPromise[_0x925f('0x36')](_0x3ff8ff);}return _0x3a1a19[_0x925f('0x37')]();};}function saveUpdates(_0x51106b,_0x5df8f0){return function(_0x3cd520){if(_0x3cd520){return _0x3cd520['update'](_0x51106b)[_0x925f('0x38')](function(_0x85bede){return _0x85bede;});}return null;};}function removeEntity(_0x57a83a,_0x323bee){return function(_0x11a689){if(_0x11a689){return _0x11a689['destroy']()['then'](function(){var _0x4c319e=_0x11a689[_0x925f('0x39')]({'plain':!![]});var _0x245184=_0x925f('0x3a');return db['UserProfileResource'][_0x925f('0x3b')]({'where':{'type':_0x245184,'resourceId':_0x4c319e['id']}})['then'](function(){return _0x11a689;});})['then'](function(){_0x57a83a[_0x925f('0x2e')](0xcc)[_0x925f('0x2d')]();});}};}function handleEntityNotFound(_0xee3e9f,_0x10f6ff){return function(_0x533928){if(!_0x533928){_0xee3e9f[_0x925f('0x3c')](0x194);}return _0x533928;};}function handleError(_0x4f0549,_0x1322c0){_0x1322c0=_0x1322c0||0x1f4;return function(_0x229d26){logger[_0x925f('0x29')](_0x229d26['stack']);if(_0x229d26[_0x925f('0x3d')]){delete _0x229d26[_0x925f('0x3d')];}_0x4f0549['status'](_0x1322c0)['send'](_0x229d26);};}exports[_0x925f('0x3e')]=function(_0x20c642,_0x3ce3e4){var _0x3b50ba={'include':[{'model':db[_0x925f('0x3f')],'as':'mandatoryDispositionPause'}]},_0xa88a13={},_0x1c0c2c={'count':0x0,'rows':[]};var _0x223d1e=_['map'](db[_0x925f('0x40')][_0x925f('0x41')],function(_0x1e2f11){return{'name':_0x1e2f11['fieldName'],'type':_0x1e2f11['type'][_0x925f('0x42')]};});_0xa88a13[_0x925f('0x43')]=_['map'](_0x223d1e,_0x925f('0x3d'));_0xa88a13['query']=_[_0x925f('0x44')](_0x20c642[_0x925f('0x45')]);_0xa88a13['filters']=_[_0x925f('0x46')](_0xa88a13['model'],_0xa88a13[_0x925f('0x45')]);_0x3b50ba[_0x925f('0x47')]=_[_0x925f('0x46')](_0xa88a13[_0x925f('0x43')],qs['fields'](_0x20c642[_0x925f('0x45')][_0x925f('0x48')]));_0x3b50ba['attributes']=_0x3b50ba['attributes'][_0x925f('0x49')]?_0x3b50ba['attributes']:_0xa88a13[_0x925f('0x43')];if(!_0x20c642[_0x925f('0x45')][_0x925f('0x4a')]('nolimit')){_0x3b50ba[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x20c642['query']['limit']);_0x3b50ba[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x20c642[_0x925f('0x45')][_0x925f('0x30')]);}_0x3b50ba[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x20c642[_0x925f('0x45')][_0x925f('0x4c')]);_0x3b50ba[_0x925f('0x4d')]=qs['filters'](_[_0x925f('0x4e')](_0x20c642[_0x925f('0x45')],_0xa88a13[_0x925f('0x4f')]),_0x223d1e);if(_0x20c642[_0x925f('0x45')]['filter']){_0x3b50ba[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x3b50ba['where'],{'$or':_[_0x925f('0x51')](_0x223d1e,function(_0x509f4f){if(_0x509f4f[_0x925f('0x52')]!==_0x925f('0x53')){var _0x52d2bb={};_0x52d2bb[_0x509f4f[_0x925f('0x3d')]]={'$like':'%'+_0x20c642['query']['filter']+'%'};return _0x52d2bb;}})});}_0x3b50ba=_[_0x925f('0x50')]({},_0x3b50ba,_0x20c642[_0x925f('0x54')]);var _0x4933bb={'where':_0x3b50ba['where']};return db[_0x925f('0x40')][_0x925f('0x33')](_0x4933bb)[_0x925f('0x38')](function(_0x30e717){_0x1c0c2c[_0x925f('0x33')]=_0x30e717;if(_0x20c642['query'][_0x925f('0x55')]){_0x3b50ba['include']=[{'all':!![]}];}return db[_0x925f('0x40')]['findAll'](_0x3b50ba);})['then'](function(_0x1ee3c8){_0x1c0c2c[_0x925f('0x56')]=_0x1ee3c8;return _0x1c0c2c;})['then'](respondWithFilteredResult(_0x3ce3e4,_0x3b50ba))['catch'](handleError(_0x3ce3e4,null));};exports[_0x925f('0x57')]=function(_0x232118,_0x2efcf6){var _0xab681d={'raw':![],'where':{'id':_0x232118[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0x3f')],'as':_0x925f('0x59')}]},_0x20116c={};_0x20116c[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x40')]['rawAttributes']);_0x20116c[_0x925f('0x45')]=_[_0x925f('0x44')](_0x232118[_0x925f('0x45')]);_0x20116c[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x20116c[_0x925f('0x43')],_0x20116c[_0x925f('0x45')]);_0xab681d[_0x925f('0x47')]=_[_0x925f('0x46')](_0x20116c[_0x925f('0x43')],qs[_0x925f('0x48')](_0x232118[_0x925f('0x45')][_0x925f('0x48')]));_0xab681d[_0x925f('0x47')]=_0xab681d[_0x925f('0x47')][_0x925f('0x49')]?_0xab681d['attributes']:_0x20116c['model'];if(_0x232118[_0x925f('0x45')][_0x925f('0x55')]){_0xab681d[_0x925f('0x5a')]=[{'all':!![]}];}_0xab681d=_[_0x925f('0x50')]({},_0xab681d,_0x232118[_0x925f('0x54')]);return db['FaxAccount'][_0x925f('0x5b')](_0xab681d)[_0x925f('0x38')](handleEntityNotFound(_0x2efcf6,null))[_0x925f('0x38')](respondWithResult(_0x2efcf6,null))[_0x925f('0x5c')](handleError(_0x2efcf6,null));};exports[_0x925f('0x5d')]=function(_0x3becd5,_0xe9a922){return db[_0x925f('0x40')][_0x925f('0x5d')](_0x3becd5[_0x925f('0x5e')],{})[_0x925f('0x38')](function(_0x26d222){var _0x587e41=_0x3becd5['user']['get']({'plain':!![]});if(!_0x587e41)throw new Error(_0x925f('0x5f'));if(_0x587e41[_0x925f('0x60')]===_0x925f('0x61')){var _0x4cca93=_0x26d222['get']({'plain':!![]});var _0x3eea6f=_0x925f('0x3a');return db[_0x925f('0x62')][_0x925f('0x5b')]({'where':{'name':_0x3eea6f,'userProfileId':_0x587e41[_0x925f('0x63')]},'raw':!![]})[_0x925f('0x38')](function(_0x345905){if(_0x345905&&_0x345905['autoAssociation']===0x0){return db[_0x925f('0x64')][_0x925f('0x5d')]({'name':_0x4cca93[_0x925f('0x3d')],'resourceId':_0x4cca93['id'],'type':_0x345905[_0x925f('0x3d')],'sectionId':_0x345905['id']},{})[_0x925f('0x38')](function(){return _0x26d222;});}else{return _0x26d222;}})[_0x925f('0x5c')](function(_0x396078){logger[_0x925f('0x29')](_0x925f('0x65'),_0x396078);throw _0x396078;});}return _0x26d222;})[_0x925f('0x38')](respondWithResult(_0xe9a922,0xc9))['catch'](handleError(_0xe9a922,null));};exports[_0x925f('0x66')]=function(_0x4c6f90,_0xfacb2){if(_0x4c6f90[_0x925f('0x5e')]['id']){delete _0x4c6f90[_0x925f('0x5e')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4c6f90[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0x3f')],'as':_0x925f('0x59')}]})[_0x925f('0x38')](handleEntityNotFound(_0xfacb2,null))['then'](saveUpdates(_0x4c6f90[_0x925f('0x5e')],null))[_0x925f('0x38')](respondWithResult(_0xfacb2,null))[_0x925f('0x5c')](handleError(_0xfacb2,null));};exports[_0x925f('0x3b')]=function(_0x3e2d67,_0x1cdb08){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x3e2d67[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x1cdb08,null))[_0x925f('0x38')](removeEntity(_0x1cdb08,null))[_0x925f('0x5c')](handleError(_0x1cdb08,null));};exports['describe']=function(_0x1075f0,_0x39a6c8){return db[_0x925f('0x40')][_0x925f('0x67')]()[_0x925f('0x38')](respondWithResult(_0x39a6c8,null))['catch'](handleError(_0x39a6c8,null));};exports[_0x925f('0x68')]=function(_0x54a943,_0x2a641b,_0x4f1972){if(_0x54a943[_0x925f('0x5e')]['id']){delete _0x54a943[_0x925f('0x5e')]['id'];}return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x54a943[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x2a641b,null))[_0x925f('0x38')](function(_0xa0f6ae){if(_0xa0f6ae){_0x54a943[_0x925f('0x5e')][_0x925f('0x69')]=_0xa0f6ae['id'];return db[_0x925f('0x6a')][_0x925f('0x5d')](_0x54a943[_0x925f('0x5e')]);}})[_0x925f('0x38')](respondWithResult(_0x2a641b,null))[_0x925f('0x5c')](handleError(_0x2a641b,null));};exports[_0x925f('0x6b')]=function(_0x1dd4c0,_0xac63bc,_0x4ab438){var _0x3e4764={'raw':![],'where':{}};var _0x2325ef={};var _0x2bb6f9={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x1dd4c0[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0xac63bc,null))[_0x925f('0x38')](function(_0x3e658a){if(_0x3e658a){_0x2325ef[_0x925f('0x43')]=_['keys'](db[_0x925f('0x6a')][_0x925f('0x41')]);_0x2325ef[_0x925f('0x45')]=_['keys'](_0x1dd4c0[_0x925f('0x45')]);_0x2325ef[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x2325ef['model'],_0x2325ef[_0x925f('0x45')]);_0x3e4764[_0x925f('0x47')]=_[_0x925f('0x46')](_0x2325ef['model'],qs[_0x925f('0x48')](_0x1dd4c0['query']['fields']));_0x3e4764[_0x925f('0x47')]=_0x3e4764[_0x925f('0x47')][_0x925f('0x49')]?_0x3e4764[_0x925f('0x47')]:_0x2325ef[_0x925f('0x43')];if(!_0x1dd4c0[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x3e4764[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x1dd4c0[_0x925f('0x45')]['limit']);_0x3e4764[_0x925f('0x30')]=qs['offset'](_0x1dd4c0[_0x925f('0x45')]['offset']);}_0x3e4764[_0x925f('0x4b')]=qs['sort'](_0x1dd4c0[_0x925f('0x45')][_0x925f('0x4c')]);_0x3e4764[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x1dd4c0[_0x925f('0x45')],_0x2325ef['filters']));_0x3e4764[_0x925f('0x4d')][_0x925f('0x69')]=_0x3e658a['id'];if(_0x1dd4c0[_0x925f('0x45')]['filter']){_0x3e4764[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x3e4764[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x3e4764[_0x925f('0x47')],function(_0x1f288b){var _0x4a6e56={};_0x4a6e56[_0x1f288b]={'$like':'%'+_0x1dd4c0[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x4a6e56;})});}_0x3e4764=_['merge']({},_0x3e4764,_0x1dd4c0[_0x925f('0x54')]);return db[_0x925f('0x6a')][_0x925f('0x33')]({'where':_0x3e4764[_0x925f('0x4d')]})['then'](function(_0x5e82b5){_0x2bb6f9[_0x925f('0x33')]=_0x5e82b5;if(_0x1dd4c0['query'][_0x925f('0x55')]){_0x3e4764['include']=[{'all':!![]}];}return db[_0x925f('0x6a')][_0x925f('0x6f')](_0x3e4764);})[_0x925f('0x38')](function(_0x127875){_0x2bb6f9[_0x925f('0x56')]=_0x127875;return _0x2bb6f9;});}})[_0x925f('0x38')](respondWithFilteredResult(_0xac63bc,_0x3e4764))['catch'](handleError(_0xac63bc,null));};exports[_0x925f('0x70')]=function(_0x1f5a10,_0x18873f,_0x577817){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x1f5a10['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x18873f,null))[_0x925f('0x38')](function(_0x53a18f){if(_0x53a18f){return _0x53a18f['removeDispositions'](_0x1f5a10[_0x925f('0x45')][_0x925f('0x71')]);}})['then'](respondWithStatusCode(_0x18873f,null))[_0x925f('0x5c')](handleError(_0x18873f,null));};exports[_0x925f('0x72')]=function(_0x3331b8,_0x1c1280,_0x272acc){if(_0x3331b8[_0x925f('0x5e')]['id']){delete _0x3331b8['body']['id'];}return db[_0x925f('0x40')]['find']({'where':{'id':_0x3331b8['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x1c1280,null))[_0x925f('0x38')](function(_0x2f7fca){if(_0x2f7fca){_0x3331b8[_0x925f('0x5e')][_0x925f('0x69')]=_0x2f7fca['id'];return db[_0x925f('0x73')][_0x925f('0x5d')](_0x3331b8['body']);}})[_0x925f('0x38')](respondWithResult(_0x1c1280,null))[_0x925f('0x5c')](handleError(_0x1c1280,null));};exports[_0x925f('0x74')]=function(_0xc8143d,_0x27bd30,_0x24c016){var _0x8f607c={'raw':![],'where':{}};var _0x377b1e={};var _0x5c3428={'count':0x0,'rows':[]};return db['FaxAccount'][_0x925f('0x6c')]({'where':{'id':_0xc8143d['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x27bd30,null))[_0x925f('0x38')](function(_0x4a4371){if(_0x4a4371){_0x377b1e['model']=_[_0x925f('0x44')](db[_0x925f('0x73')][_0x925f('0x41')]);_0x377b1e[_0x925f('0x45')]=_[_0x925f('0x44')](_0xc8143d[_0x925f('0x45')]);_0x377b1e[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x377b1e['model'],_0x377b1e['query']);_0x8f607c['attributes']=_['intersection'](_0x377b1e[_0x925f('0x43')],qs[_0x925f('0x48')](_0xc8143d[_0x925f('0x45')][_0x925f('0x48')]));_0x8f607c[_0x925f('0x47')]=_0x8f607c[_0x925f('0x47')][_0x925f('0x49')]?_0x8f607c[_0x925f('0x47')]:_0x377b1e[_0x925f('0x43')];if(!_0xc8143d['query'][_0x925f('0x4a')](_0x925f('0x6d'))){_0x8f607c[_0x925f('0x32')]=qs[_0x925f('0x32')](_0xc8143d[_0x925f('0x45')][_0x925f('0x32')]);_0x8f607c['offset']=qs[_0x925f('0x30')](_0xc8143d[_0x925f('0x45')][_0x925f('0x30')]);}_0x8f607c['order']=qs['sort'](_0xc8143d[_0x925f('0x45')]['sort']);_0x8f607c[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0xc8143d[_0x925f('0x45')],_0x377b1e['filters']));_0x8f607c['where'][_0x925f('0x69')]=_0x4a4371['id'];if(_0xc8143d[_0x925f('0x45')]['filter']){_0x8f607c[_0x925f('0x4d')]=_['merge'](_0x8f607c[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x8f607c[_0x925f('0x47')],function(_0xf7b0c1){var _0x598139={};_0x598139[_0xf7b0c1]={'$like':'%'+_0xc8143d[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x598139;})});}_0x8f607c=_[_0x925f('0x50')]({},_0x8f607c,_0xc8143d['options']);return db[_0x925f('0x73')][_0x925f('0x33')]({'where':_0x8f607c[_0x925f('0x4d')]})[_0x925f('0x38')](function(_0x3f31e3){_0x5c3428[_0x925f('0x33')]=_0x3f31e3;if(_0xc8143d['query'][_0x925f('0x55')]){_0x8f607c[_0x925f('0x5a')]=[{'all':!![]}];}return db[_0x925f('0x73')][_0x925f('0x6f')](_0x8f607c);})['then'](function(_0x50056a){_0x5c3428[_0x925f('0x56')]=_0x50056a;return _0x5c3428;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x27bd30,_0x8f607c))['catch'](handleError(_0x27bd30,null));};exports['removeAnswers']=function(_0x5b6b8d,_0xb3788d,_0x4df572){return db[_0x925f('0x40')]['find']({'where':{'id':_0x5b6b8d[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0xb3788d,null))[_0x925f('0x38')](function(_0x49194c){if(_0x49194c){return _0x49194c[_0x925f('0x75')](_0x5b6b8d[_0x925f('0x45')]['ids']);}})[_0x925f('0x38')](respondWithStatusCode(_0xb3788d,null))[_0x925f('0x5c')](handleError(_0xb3788d,null));};exports['addInteraction']=function(_0x436d21,_0x40f2dd,_0x226986){return db[_0x925f('0x76')][_0x925f('0x5b')]({'where':{'id':_0x436d21[_0x925f('0x58')]['id']}})['then'](handleEntityNotFound(_0x40f2dd,null))[_0x925f('0x38')](function(_0x457c69){if(_0x457c69){return _0x457c69[_0x925f('0x77')](_0x436d21[_0x925f('0x5e')][_0x925f('0x71')],_['omit'](_0x436d21[_0x925f('0x5e')],[_0x925f('0x71'),'id'])||{});}})[_0x925f('0x38')](respondWithResult(_0x40f2dd,null))[_0x925f('0x5c')](handleError(_0x40f2dd,null));};exports[_0x925f('0x78')]=function(_0x59656f,_0x4e115a,_0x480a31){var _0x48d862={'raw':![],'where':{}};var _0xfd3b0f={};var _0x304580={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x59656f[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x4e115a,null))[_0x925f('0x38')](function(_0x5c7500){if(_0x5c7500){_0xfd3b0f[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x76')][_0x925f('0x41')]);_0xfd3b0f['query']=_['keys'](_0x59656f[_0x925f('0x45')]);_0xfd3b0f[_0x925f('0x4f')]=_[_0x925f('0x46')](_0xfd3b0f[_0x925f('0x43')],_0xfd3b0f[_0x925f('0x45')]);_0x48d862['attributes']=_[_0x925f('0x46')](_0xfd3b0f[_0x925f('0x43')],qs['fields'](_0x59656f[_0x925f('0x45')]['fields']));_0x48d862['attributes']=_0x48d862[_0x925f('0x47')][_0x925f('0x49')]?_0x48d862[_0x925f('0x47')]:_0xfd3b0f[_0x925f('0x43')];if(!_0x59656f[_0x925f('0x45')][_0x925f('0x4a')]('nolimit')){_0x48d862[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x59656f[_0x925f('0x45')][_0x925f('0x32')]);_0x48d862[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x59656f[_0x925f('0x45')][_0x925f('0x30')]);}_0x48d862[_0x925f('0x4b')]=qs['sort'](_0x59656f[_0x925f('0x45')]['sort']);_0x48d862['where']=qs[_0x925f('0x4f')](_['pick'](_0x59656f['query'],_0xfd3b0f[_0x925f('0x4f')]));_0x48d862['where'][_0x925f('0x69')]=_0x5c7500['id'];if(_0x59656f[_0x925f('0x45')]['filter']){_0x48d862[_0x925f('0x4d')]=_['merge'](_0x48d862[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x48d862[_0x925f('0x47')],function(_0x49f598){var _0x2dd5f3={};_0x2dd5f3[_0x49f598]={'$like':'%'+_0x59656f[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x2dd5f3;})});}_0x48d862=_['merge']({},_0x48d862,_0x59656f[_0x925f('0x54')]);return db[_0x925f('0x76')]['count']({'where':_0x48d862[_0x925f('0x4d')]})['then'](function(_0x29a0e2){_0x304580[_0x925f('0x33')]=_0x29a0e2;if(_0x59656f[_0x925f('0x45')][_0x925f('0x55')]){_0x48d862['include']=[{'model':db[_0x925f('0x79')],'as':_0x925f('0x7a'),'required':![]},{'model':db[_0x925f('0x7b')],'as':_0x925f('0x7c'),'attributes':[_0x925f('0x3d'),_0x925f('0x7d'),_0x925f('0x7e')],'required':![]},{'model':db[_0x925f('0x7f')],'as':_0x925f('0x80'),'attributes':['id',_0x925f('0x3d'),_0x925f('0x81')],'where':_0x59656f[_0x925f('0x45')][_0x925f('0x82')]?{'id':_0x59656f[_0x925f('0x45')][_0x925f('0x82')]}:undefined,'required':_0x59656f[_0x925f('0x45')]['tag']?!![]:![]}];}return db[_0x925f('0x76')][_0x925f('0x6f')](_0x48d862);})['then'](function(_0x3607d7){_0x304580[_0x925f('0x56')]=_0x3607d7;return _0x304580;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x4e115a,_0x48d862))[_0x925f('0x5c')](handleError(_0x4e115a,null));};exports[_0x925f('0x83')]=function(_0x546d09,_0x8934cd){var _0x141cea=_0x546d09['params']['id'];var _0x23a5c1=_0x546d09[_0x925f('0x5e')];var _0x29b639=0xc8;var _0x31acd5=null;return db[_0x925f('0x84')]['transaction']({'isolationLevel':db[_0x925f('0x84')][_0x925f('0x85')][_0x925f('0x86')][_0x925f('0x87')]},function(_0x4ec337){return db[_0x925f('0x40')]['findOne']({'where':{'id':_0x141cea},'transaction':_0x4ec337})[_0x925f('0x38')](function(_0x291ab9){if(_0x291ab9){return db[_0x925f('0x88')]['destroy']({'where':{'FaxAccountId':_0x141cea},'transaction':_0x4ec337})[_0x925f('0x38')](function(){var _0x1d649f=_['map'](_0x23a5c1,function(_0x343888){_0x343888['FaxAccountId']=_0x141cea;return _0x343888;});return db[_0x925f('0x88')][_0x925f('0x89')](_0x1d649f,{'transaction':_0x4ec337});});}else{_0x29b639=0x194;_0x31acd5=[];}});})[_0x925f('0x38')](function(){if(_0x29b639!==0x194){return db[_0x925f('0x88')][_0x925f('0x8a')]({'where':{'FaxAccountId':_0x141cea},'order':'priority'})['then'](function(_0x2a656e){_0x31acd5=_0x2a656e;});}})[_0x925f('0x5c')](function(_0x263531){_0x29b639=0x1f4;logger[_0x925f('0x29')](_0x263531[_0x925f('0x8b')]);if(_0x263531['name']){delete _0x263531[_0x925f('0x3d')];}_0x31acd5=_0x263531;})[_0x925f('0x8c')](function(){if(_0x31acd5===null){_0x8934cd[_0x925f('0x3c')](_0x29b639);}else{if(_0x29b639===0x1f4){_0x8934cd[_0x925f('0x2e')](_0x29b639)[_0x925f('0x8d')](_0x31acd5);}else{_0x8934cd[_0x925f('0x2e')](_0x29b639)[_0x925f('0x2f')](_0x31acd5);}}});};exports[_0x925f('0x8e')]=function(_0x2c8bc7,_0x55c5f9,_0x44b2bd){var _0x3ceb35={};var _0x324621={};var _0x190f92;var _0x3d4ba9;return db['FaxAccount'][_0x925f('0x6c')]({'where':{'id':_0x2c8bc7[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x55c5f9,null))[_0x925f('0x38')](function(_0x57dc49){if(_0x57dc49){_0x190f92=_0x57dc49;_0x324621['model']=_[_0x925f('0x44')](db[_0x925f('0x88')]['rawAttributes']);_0x324621['query']=_[_0x925f('0x44')](_0x2c8bc7['query']);_0x324621[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x324621[_0x925f('0x43')],_0x324621['query']);_0x3ceb35[_0x925f('0x47')]=_[_0x925f('0x46')](_0x324621[_0x925f('0x43')],qs['fields'](_0x2c8bc7[_0x925f('0x45')]['fields']));_0x3ceb35[_0x925f('0x47')]=_0x3ceb35['attributes'][_0x925f('0x49')]?_0x3ceb35[_0x925f('0x47')]:_0x324621[_0x925f('0x43')];_0x3ceb35[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x2c8bc7[_0x925f('0x45')][_0x925f('0x4c')]);_0x3ceb35[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_['pick'](_0x2c8bc7[_0x925f('0x45')],_0x324621[_0x925f('0x4f')]));if(_0x2c8bc7[_0x925f('0x45')][_0x925f('0x6e')]){_0x3ceb35['where']=_[_0x925f('0x50')](_0x3ceb35[_0x925f('0x4d')],{'$or':_[_0x925f('0x51')](_0x3ceb35[_0x925f('0x47')],function(_0x2bf21e){var _0x3223c0={};_0x3223c0[_0x2bf21e]={'$like':'%'+_0x2c8bc7[_0x925f('0x45')][_0x925f('0x6e')]+'%'};return _0x3223c0;})});}_0x3ceb35=_['merge']({},_0x3ceb35,_0x2c8bc7['options']);return _0x190f92[_0x925f('0x8e')](_0x3ceb35);}})[_0x925f('0x38')](function(_0x5be3ef){if(_0x5be3ef){_0x3d4ba9=_0x5be3ef[_0x925f('0x49')];if(!_0x2c8bc7[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x3ceb35[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x2c8bc7[_0x925f('0x45')][_0x925f('0x32')]);_0x3ceb35[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x2c8bc7['query'][_0x925f('0x30')]);}return _0x190f92[_0x925f('0x8e')](_0x3ceb35);}})['then'](function(_0x365a49){if(_0x365a49){return _0x365a49?{'count':_0x3d4ba9,'rows':_0x365a49}:null;}})[_0x925f('0x38')](respondWithResult(_0x55c5f9,null))[_0x925f('0x5c')](handleError(_0x55c5f9,null));};function Extension(_0x5b9594,_0x1fa2c5,_0x586c4d,_0x3c99d0){this[_0x925f('0x8f')]='from-voip-provider';this[_0x925f('0x90')]=_0x5b9594['localstationid'];this[_0x925f('0x91')]=_0x3c99d0;this['type']=_0x925f('0x92');this[_0x925f('0x93')]='Fax\x20Extension';this[_0x925f('0x69')]=_0x5b9594['id'];this[_0x925f('0x94')]=_0x1fa2c5;this['appdata']=_0x586c4d;}function createExtensionsReciveFax(_0x120ae3){var _0x1de09f=0x1;var _0x37ca8a=[];_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,'',_0x925f('0x95')));_0x1de09f+=0x1;_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x96'),_0x925f('0x97')));_0x1de09f+=0x1;for(var _0x541cb4 in _0x120ae3){if(_0x120ae3[_0x925f('0x4a')](_0x541cb4)&&(_0x541cb4==='ecm'||_0x541cb4===_0x925f('0x98')||_0x541cb4==='gateway'||_0x541cb4===_0x925f('0x99')||_0x541cb4===_0x925f('0x9a')||_0x541cb4==='maxrate'||_0x541cb4==='minrate'||_0x541cb4===_0x925f('0x9b')||_0x541cb4==='t38timeout')){_0x37ca8a[_0x925f('0x9c')](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x9d')+_0x541cb4+')='+_0x120ae3[_0x541cb4],'Set'));_0x1de09f+=0x1;}}_0x37ca8a[_0x925f('0x9c')](new Extension(_0x120ae3,_0x1de09f,'6','Wait'));_0x1de09f+=0x1;_0x37ca8a['push'](new Extension(_0x120ae3,_0x1de09f,_0x925f('0x9e'),'ReceiveFax'));_0x1de09f=0x0;return _0x37ca8a;}exports['addAccountApplications']=function(_0x26dd74,_0x2b9c26,_0x7b2e82){var _0x203a46;return db['sequelize']['transaction'](function(_0x2bab94){return db[_0x925f('0x40')]['create'](_0x26dd74[_0x925f('0x5e')],{'transaction':_0x2bab94})[_0x925f('0x38')](function(_0x295a61){_0x203a46=_0x295a61['get']({'plain':!![]});return db[_0x925f('0x9f')][_0x925f('0x89')](createExtensionsReciveFax(_0x203a46),{'transaction':_0x2bab94});});})[_0x925f('0x38')](function(){return _0x203a46;})[_0x925f('0x38')](respondWithResult(_0x2b9c26,null))[_0x925f('0x5c')](handleError(_0x2b9c26,null));};exports[_0x925f('0xa0')]=function(_0x224027,_0x3f7415,_0x3186d3){var _0x741c61;return db[_0x925f('0x84')][_0x925f('0xa1')](function(_0x4379d8){return db['FaxAccount']['update'](_0x224027[_0x925f('0x5e')],{'where':{'id':_0x224027[_0x925f('0x5e')]['id']},'transaction':_0x4379d8})['then'](function(_0x5e5a1e){return db[_0x925f('0x9f')][_0x925f('0x3b')]({'where':{'FaxAccountId':_0x224027[_0x925f('0x5e')]['id']},'transaction':_0x4379d8})['then'](function(_0x10c5af){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x925f('0xa2')](_0x224027[_0x925f('0x5e')],[_0x925f('0xa3'),_0x925f('0x42'),_0x925f('0xa4'),'updatedAt',_0x925f('0xa5'),_0x925f('0xa6')])),{'transaction':_0x4379d8});});});})[_0x925f('0x38')](function(){return db[_0x925f('0x40')][_0x925f('0xa7')](_0x224027[_0x925f('0x5e')]['id']);})[_0x925f('0x38')](respondWithResult(_0x3f7415,null))[_0x925f('0x5c')](handleError(_0x3f7415,null));};exports[_0x925f('0xa8')]=function(_0x17733d,_0x39ae09,_0x579ba4){var _0x120593={'raw':!![],'where':{}};var _0x36ca4d={};var _0x3d3f0e={'count':0x0,'rows':[]};return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x17733d[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x39ae09,null))[_0x925f('0x38')](function(_0x133a27){if(_0x133a27){_0x36ca4d[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0xa9')][_0x925f('0x41')]);_0x36ca4d[_0x925f('0x45')]=_[_0x925f('0x44')](_0x17733d[_0x925f('0x45')]);_0x36ca4d[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x36ca4d[_0x925f('0x43')],_0x36ca4d['query']);_0x120593[_0x925f('0x47')]=_[_0x925f('0x46')](_0x36ca4d[_0x925f('0x43')],qs['fields'](_0x17733d[_0x925f('0x45')][_0x925f('0x48')]));_0x120593[_0x925f('0x47')]=_0x120593['attributes'][_0x925f('0x49')]?_0x120593['attributes']:_0x36ca4d[_0x925f('0x43')];if(!_0x17733d[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x120593[_0x925f('0x32')]=qs[_0x925f('0x32')](_0x17733d[_0x925f('0x45')][_0x925f('0x32')]);_0x120593[_0x925f('0x30')]=qs['offset'](_0x17733d[_0x925f('0x45')]['offset']);}_0x120593[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x17733d[_0x925f('0x45')][_0x925f('0x4c')]);_0x120593[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x17733d['query'],_0x36ca4d[_0x925f('0x4f')]));_0x120593[_0x925f('0x4d')][_0x925f('0x69')]=_0x133a27['id'];if(_0x17733d[_0x925f('0x45')][_0x925f('0x6e')]){_0x120593[_0x925f('0x4d')]=_['merge'](_0x120593[_0x925f('0x4d')],{'$or':_['map'](_0x120593[_0x925f('0x47')],function(_0x1cde88){var _0x2cbe51={};_0x2cbe51[_0x1cde88]={'$like':'%'+_0x17733d[_0x925f('0x45')]['filter']+'%'};return _0x2cbe51;})});}if(_0x17733d['query'][_0x925f('0xaa')]){var _0x366cc7=_0x17733d[_0x925f('0x45')][_0x925f('0xaa')][_0x925f('0xab')](',');var _0x12eb65={};_0x12eb65[_0x366cc7[0x0]]={'$gte':moment(_0x366cc7[0x1])[_0x925f('0xac')]('YYYY-MM-DD\x20HH:mm:ss')};_0x120593[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x120593[_0x925f('0x4d')],_0x12eb65);}_0x120593=_[_0x925f('0x50')]({},_0x120593,_0x17733d[_0x925f('0x54')]);return db[_0x925f('0xa9')][_0x925f('0x33')]({'where':_0x120593['where']})[_0x925f('0x38')](function(_0x45e5ee){_0x3d3f0e[_0x925f('0x33')]=_0x45e5ee;if(_0x17733d[_0x925f('0x45')][_0x925f('0x55')]){_0x120593['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x120593);})[_0x925f('0x38')](function(_0x3bf060){_0x3d3f0e[_0x925f('0x56')]=_0x3bf060;return _0x3d3f0e;});}})[_0x925f('0x38')](respondWithFilteredResult(_0x39ae09,_0x120593))[_0x925f('0x5c')](handleError(_0x39ae09,null));};exports[_0x925f('0x8d')]=function(_0x1118ee,_0x13a1a9,_0x38e1f3){var _0x477dd7,_0x1388f4={},_0x42ca8c;if(_0x1118ee['body']['to']){_0x42ca8c=_0x1118ee[_0x925f('0x5e')]['to'][0x0];}return db[_0x925f('0x40')]['find']({'where':{'id':_0x1118ee[_0x925f('0x58')]['id']},'include':[{'model':db[_0x925f('0xad')],'as':'List','include':[{'model':db[_0x925f('0x79')],'as':_0x925f('0xae'),'where':{'fax':_0x42ca8c},'limit':0x1,'order':[[_0x925f('0xaf'),_0x925f('0xb0')]]}]}]})[_0x925f('0x38')](handleEntityNotFound(_0x13a1a9,null))[_0x925f('0x38')](function(_0x107344){_0x477dd7=_0x107344;if(_0x1118ee['body'][_0x925f('0xb1')]&&_0x1118ee['body']['attachments'][_0x925f('0x49')]){for(var _0xd45dd6=0x0;_0xd45dd6<_0x1118ee['body']['attachments'][_0x925f('0x49')];_0xd45dd6+=0x1){_0x1118ee['body'][_0x925f('0xb1')][_0xd45dd6]={'filename':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][_0xd45dd6][_0x925f('0x3d')],'id':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][_0xd45dd6]['id'],'path':path['join'](config[_0x925f('0xb2')],'server/files/attachments',_0x1118ee['body'][_0x925f('0xb1')][_0xd45dd6][_0x925f('0xb3')])};}}return respondWithRpcPromise(_0x925f('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0x925f('0xb5')](_0x1118ee[_0x925f('0x58')]['id'])?undefined:_0x1118ee[_0x925f('0x58')]['id'],'path':_[_0x925f('0xb5')](_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0x7')])?undefined:_0x1118ee['body']['attachments'][0x0][_0x925f('0x7')],'fax':_[_0x925f('0xb5')](_0x1118ee['body']['to'][0x0])?undefined:_0x1118ee[_0x925f('0x5e')]['to'][0x0]},client9002);})[_0x925f('0x38')](function(){if(_0x477dd7){if(_[_0x925f('0xb5')](_0x1118ee['body'][_0x925f('0xb6')])){_0x1118ee[_0x925f('0x5e')][_0x925f('0xb6')]=util[_0x925f('0xac')](_0x925f('0xb7'),_0x477dd7[_0x925f('0x3d')],_0x477dd7[_0x925f('0xb8')]);}if(_0x477dd7[_0x925f('0xb9')]){if(_0x477dd7[_0x925f('0xb9')][_0x925f('0xae')][_0x925f('0x49')]){return _0x477dd7[_0x925f('0xb9')][_0x925f('0xae')][0x0];}else{return db[_0x925f('0x79')][_0x925f('0x5d')](_[_0x925f('0x1b')](_0x1118ee[_0x925f('0x5e')],{'firstName':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'phone':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'fax':_0x1118ee['body']['to'][0x0],'ListId':_0x477dd7[_0x925f('0xa6')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x925f('0xba'));}})['then'](function(_0x83ecc2){if(_0x83ecc2){return db[_0x925f('0x76')][_0x925f('0x5b')]({'where':{'ContactId':_0x83ecc2['id'],'closed':![],'FaxAccountId':_0x477dd7['id']}})['then'](function(_0x2bcc5c){if(_0x2bcc5c){return[_0x2bcc5c,![]];}return db[_0x925f('0x76')]['create']({'UserId':_0x1118ee['user']['id'],'ContactId':_0x83ecc2['id'],'FaxAccountId':_0x477dd7['id'],'fax':_0x1118ee[_0x925f('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x925f('0x50')](_0x1118ee[_0x925f('0x5e')],{'read':![],'body':_0x1118ee[_0x925f('0x5e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x477dd7['id'],'UserId':_0x1118ee[_0x925f('0x61')]['id'],'ContactId':_0x83ecc2['id'],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x925f('0xbb')}]})[_0x925f('0x38')](function(_0x3daa53){return[_0x3daa53,!![]];});});}else{throw new Error(_0x925f('0xbc'));}})[_0x925f('0xbd')](function(_0x529abc,_0x44bb15){if(_0x44bb15){return _0x529abc;}return db[_0x925f('0xa9')]['create']({'direction':_0x925f('0xbe'),'read':![],'body':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0xbf')],'FaxAccountId':_0x477dd7['id'],'FaxInteractionId':_0x529abc['id'],'UserId':_0x1118ee[_0x925f('0x61')]['id'],'ContactId':_0x529abc[_0x925f('0xc0')],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']})['then'](function(_0x8ab52a){_0x529abc[_0x925f('0xc1')][_0x925f('0xbb')]=[];_0x529abc[_0x925f('0xc1')][_0x925f('0xbb')][_0x925f('0x9c')](_0x8ab52a[_0x925f('0xc1')]);return _0x529abc;});})[_0x925f('0x38')](function(_0x1b0014){respondWithRpcPromise(_0x925f('0xc2'),_0x925f('0xc2'),{'FaxAccountId':_['isNil'](_0x1118ee[_0x925f('0x58')]['id'])?undefined:_0x1118ee[_0x925f('0x58')]['id'],'path':_['isNil'](_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0][_0x925f('0x7')])?undefined:_0x1118ee['body']['attachments'][0x0][_0x925f('0x7')],'fax':_[_0x925f('0xb5')](_0x1118ee['body']['to'][0x0])?undefined:_0x1118ee['body']['to'][0x0],'AttachmentId':_0x1118ee[_0x925f('0x5e')][_0x925f('0xb1')][0x0]['id']},client9002)['then'](function(_0x1dd686){logger[_0x925f('0x24')]('SendFaxRpc,\x20%s',_0x1dd686);})['catch'](function(_0x15001f){logger[_0x925f('0x24')](_0x925f('0xc3'),_0x15001f);});return _0x1b0014;})[_0x925f('0x38')](respondWithResult(_0x13a1a9,null))['catch'](handleError(_0x13a1a9,null));};exports['addAgents']=function(_0x657ec0,_0x21a50a,_0x5c6564){return db[_0x925f('0x40')][_0x925f('0x5b')]({'where':{'id':_0x657ec0[_0x925f('0x58')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x21a50a,null))[_0x925f('0x38')](function(_0x3977ed){if(_0x3977ed){return _0x3977ed[_0x925f('0xc4')](_0x657ec0[_0x925f('0x5e')][_0x925f('0x71')],_['omit'](_0x657ec0[_0x925f('0x5e')],['ids','id'])||{})[_0x925f('0xbd')](function(_0x423685){for(var _0x515f30=0x0;_0x515f30<_0x657ec0['body']['ids'][_0x925f('0x49')];_0x515f30+=0x1){socket[_0x925f('0xc5')](_0x925f('0xc6'),{'UserId':Number(_0x657ec0[_0x925f('0x5e')][_0x925f('0x71')][_0x515f30]),'FaxAccountId':Number(_0x657ec0[_0x925f('0x58')]['id'])});}return _0x423685;});}})[_0x925f('0x38')](respondWithResult(_0x21a50a,null))[_0x925f('0x5c')](handleError(_0x21a50a,null));};exports[_0x925f('0xc7')]=function(_0x2ef99e,_0x17588f,_0x4222e4){return db[_0x925f('0x40')]['find']({'where':{'id':_0x2ef99e['params']['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x17588f,null))['then'](function(_0xcf4301){if(_0xcf4301){return _0xcf4301[_0x925f('0xc7')](_0x2ef99e[_0x925f('0x45')][_0x925f('0x71')])['then'](function(){if(_[_0x925f('0xc8')](_0x2ef99e[_0x925f('0x45')][_0x925f('0x71')])){for(var _0x4093fa=0x0;_0x4093fa<_0x2ef99e[_0x925f('0x45')]['ids'][_0x925f('0x49')];_0x4093fa+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2ef99e['query'][_0x925f('0x71')][_0x4093fa]),'FaxAccountId':Number(_0x2ef99e[_0x925f('0x58')]['id'])});}}else{socket[_0x925f('0xc5')](_0x925f('0xc9'),{'UserId':Number(_0x2ef99e[_0x925f('0x45')]['ids']),'FaxAccountId':Number(_0x2ef99e['params']['id'])});}});}})[_0x925f('0x38')](respondWithStatusCode(_0x17588f,null))[_0x925f('0x5c')](handleError(_0x17588f,null));};exports[_0x925f('0xca')]=function(_0x28ef89,_0x2bda55,_0x52c265){var _0x514069={};var _0x2b4caf={};var _0x2d2e96;var _0x3625a3;return db[_0x925f('0x40')][_0x925f('0x6c')]({'where':{'id':_0x28ef89['params']['id']}})['then'](handleEntityNotFound(_0x2bda55,null))[_0x925f('0x38')](function(_0x31efaf){if(_0x31efaf){_0x2d2e96=_0x31efaf;_0x2b4caf[_0x925f('0x43')]=_[_0x925f('0x44')](db[_0x925f('0x7b')][_0x925f('0x41')]);_0x2b4caf[_0x925f('0x45')]=_[_0x925f('0x44')](_0x28ef89[_0x925f('0x45')]);_0x2b4caf[_0x925f('0x4f')]=_[_0x925f('0x46')](_0x2b4caf[_0x925f('0x43')],_0x2b4caf[_0x925f('0x45')]);_0x514069[_0x925f('0x47')]=_[_0x925f('0x46')](_0x2b4caf['model'],qs[_0x925f('0x48')](_0x28ef89[_0x925f('0x45')][_0x925f('0x48')]));_0x514069['attributes']=_0x514069[_0x925f('0x47')][_0x925f('0x49')]?_0x514069[_0x925f('0x47')]:_0x2b4caf['model'];_0x514069[_0x925f('0x4b')]=qs[_0x925f('0x4c')](_0x28ef89[_0x925f('0x45')]['sort']);_0x514069[_0x925f('0x4d')]=qs[_0x925f('0x4f')](_[_0x925f('0x4e')](_0x28ef89[_0x925f('0x45')],_0x2b4caf[_0x925f('0x4f')]));if(_0x28ef89[_0x925f('0x45')][_0x925f('0x6e')]){_0x514069[_0x925f('0x4d')]=_[_0x925f('0x50')](_0x514069[_0x925f('0x4d')],{'$or':_['map'](_0x514069[_0x925f('0x47')],function(_0x8ef643){var _0x200791={};_0x200791[_0x8ef643]={'$like':'%'+_0x28ef89[_0x925f('0x45')]['filter']+'%'};return _0x200791;})});}_0x514069=_[_0x925f('0x50')]({},_0x514069,_0x28ef89[_0x925f('0x54')]);return _0x2d2e96[_0x925f('0xca')](_0x514069);}})[_0x925f('0x38')](function(_0x510819){if(_0x510819){_0x3625a3=_0x510819[_0x925f('0x49')];if(!_0x28ef89[_0x925f('0x45')][_0x925f('0x4a')](_0x925f('0x6d'))){_0x514069[_0x925f('0x32')]=qs['limit'](_0x28ef89[_0x925f('0x45')]['limit']);_0x514069[_0x925f('0x30')]=qs[_0x925f('0x30')](_0x28ef89['query'][_0x925f('0x30')]);}return _0x2d2e96[_0x925f('0xca')](_0x514069);}})[_0x925f('0x38')](function(_0x21e98b){if(_0x21e98b){return _0x21e98b?{'count':_0x3625a3,'rows':_0x21e98b}:null;}})[_0x925f('0x38')](respondWithResult(_0x2bda55,null))['catch'](handleError(_0x2bda55,null));}; \ No newline at end of file +var _0x9af1=['../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','http','client','request','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','FaxAccount','includeAll','include','findAll','rows','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','type','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','minrate','modem','t38timeout','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','key','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','basename','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5e6ebb,_0x53e995){var _0x4da18a=function(_0x549309){while(--_0x549309){_0x5e6ebb['push'](_0x5e6ebb['shift']());}};_0x4da18a(++_0x53e995);}(_0x9af1,0xb1));var _0x19af=function(_0x4642e0,_0x1e350c){_0x4642e0=_0x4642e0-0x0;var _0x1f4f11=_0x9af1[_0x4642e0];return _0x1f4f11;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x19af('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19af('0x1'));var moment=require(_0x19af('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x19af('0x3'));var util=require(_0x19af('0x4'));var path=require('path');var sox=require(_0x19af('0x5'));var csv=require(_0x19af('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19af('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x19af('0x6'));var querystring=require(_0x19af('0x8'));var Papa=require(_0x19af('0x9'));var Redis=require(_0x19af('0xa'));var authService=require(_0x19af('0xb'));var qs=require(_0x19af('0xc'));var as=require(_0x19af('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x19af('0xe'))(_0x19af('0xf'));var utils=require(_0x19af('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x19af('0x11'))['db'];config[_0x19af('0x12')]=_[_0x19af('0x13')](config[_0x19af('0x12')],{'host':_0x19af('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19af('0x12')]));require(_0x19af('0x15'))[_0x19af('0x16')](socket);var jayson=require(_0x19af('0x17'));var client=jayson['client'][_0x19af('0x18')]({'port':0x232c});var client9002=jayson[_0x19af('0x19')][_0x19af('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4e41fd,_0x5bac12,_0x1c158e,_0x5b0a90){return new BPromise(function(_0x1014cb,_0x1d9f94){var _0x46cf63=_0x5b0a90||client;return _0x46cf63[_0x19af('0x1a')](_0x4e41fd,_0x1c158e)['then'](function(_0x3955b1){logger['info'](_0x19af('0x1b'),_0x5bac12,'request\x20sent');logger[_0x19af('0x1c')](_0x19af('0x1d'),_0x5bac12,_0x19af('0x1e'),JSON[_0x19af('0x1f')](_0x3955b1));if(_0x3955b1[_0x19af('0x20')]){if(_0x3955b1[_0x19af('0x20')]['code']===0x1f4){logger[_0x19af('0x20')](_0x19af('0x1b'),_0x5bac12,_0x3955b1[_0x19af('0x20')][_0x19af('0x21')]);return _0x1d9f94(_0x3955b1[_0x19af('0x20')]['message']);}logger[_0x19af('0x20')]('FaxAccount,\x20%s,\x20%s',_0x5bac12,_0x3955b1['error'][_0x19af('0x21')]);return _0x1014cb(_0x3955b1[_0x19af('0x20')][_0x19af('0x21')]);}else{logger[_0x19af('0x22')]('FaxAccount,\x20%s,\x20%s',_0x5bac12,'request\x20sent');_0x1014cb(_0x3955b1[_0x19af('0x23')][_0x19af('0x21')]);}})[_0x19af('0x24')](function(_0x281a70){logger[_0x19af('0x20')](_0x19af('0x1b'),_0x5bac12,_0x281a70);_0x1d9f94(_0x281a70);});});}function respondWithStatusCode(_0x384383,_0x429728){_0x429728=_0x429728||0xcc;return function(_0x521a41){if(_0x521a41){return _0x384383[_0x19af('0x25')](_0x429728);}return _0x384383['status'](_0x429728)['end']();};}function respondWithResult(_0x3f798d,_0x3f62ff){_0x3f62ff=_0x3f62ff||0xc8;return function(_0x114f83){if(_0x114f83){return _0x3f798d[_0x19af('0x26')](_0x3f62ff)[_0x19af('0x27')](_0x114f83);}};}function respondWithFilteredResult(_0x22efe8,_0x198a09){return function(_0x530553){if(_0x530553){var _0x120388=typeof _0x198a09['offset']===_0x19af('0x28')&&typeof _0x198a09[_0x19af('0x29')]===_0x19af('0x28');var _0x58099a=_0x530553[_0x19af('0x2a')];var _0x47609b=_0x120388?0x0:_0x198a09[_0x19af('0x2b')];var _0x35e7cf=_0x120388?_0x530553[_0x19af('0x2a')]:_0x198a09[_0x19af('0x2b')]+_0x198a09[_0x19af('0x29')];var _0x358565;if(_0x35e7cf>=_0x58099a){_0x35e7cf=_0x58099a;_0x358565=0xc8;}else{_0x358565=0xce;}_0x22efe8[_0x19af('0x26')](_0x358565);return _0x22efe8[_0x19af('0x2c')](_0x19af('0x2d'),_0x47609b+'-'+_0x35e7cf+'/'+_0x58099a)[_0x19af('0x27')](_0x530553);}return null;};}function patchUpdates(_0x34b44f){return function(_0x1a110f){try{jsonpatch[_0x19af('0x2e')](_0x1a110f,_0x34b44f,!![]);}catch(_0x5a2398){return BPromise[_0x19af('0x2f')](_0x5a2398);}return _0x1a110f[_0x19af('0x30')]();};}function saveUpdates(_0xa427fa,_0x5845ac){return function(_0x1e1700){if(_0x1e1700){return _0x1e1700[_0x19af('0x31')](_0xa427fa)[_0x19af('0x32')](function(_0x429881){return _0x429881;});}return null;};}function removeEntity(_0x322c4f,_0xe67ae5){return function(_0x59068d){if(_0x59068d){return _0x59068d[_0x19af('0x33')]()[_0x19af('0x32')](function(){var _0x58bc32=_0x59068d[_0x19af('0x34')]({'plain':!![]});var _0x3313b4='FaxAccounts';return db[_0x19af('0x35')][_0x19af('0x33')]({'where':{'type':_0x3313b4,'resourceId':_0x58bc32['id']}})[_0x19af('0x32')](function(){return _0x59068d;});})[_0x19af('0x32')](function(){_0x322c4f['status'](0xcc)[_0x19af('0x36')]();});}};}function handleEntityNotFound(_0x1626bb,_0xf74571){return function(_0x4ec062){if(!_0x4ec062){_0x1626bb[_0x19af('0x25')](0x194);}return _0x4ec062;};}function handleError(_0x444f8f,_0x4ebcf9){_0x4ebcf9=_0x4ebcf9||0x1f4;return function(_0x21c365){logger['error'](_0x21c365[_0x19af('0x37')]);if(_0x21c365[_0x19af('0x38')]){delete _0x21c365[_0x19af('0x38')];}_0x444f8f['status'](_0x4ebcf9)['send'](_0x21c365);};}exports[_0x19af('0x39')]=function(_0x37acb2,_0x36a2db){var _0x3678ef={'include':[{'model':db[_0x19af('0x3a')],'as':_0x19af('0x3b')}]},_0x52c4bd={},_0x1ecfe8={'count':0x0,'rows':[]};var _0x5d1675=_[_0x19af('0x3c')](db['FaxAccount'][_0x19af('0x3d')],function(_0x3c4368){return{'name':_0x3c4368[_0x19af('0x3e')],'type':_0x3c4368['type']['key']};});_0x52c4bd['model']=_[_0x19af('0x3c')](_0x5d1675,'name');_0x52c4bd[_0x19af('0x3f')]=_[_0x19af('0x40')](_0x37acb2['query']);_0x52c4bd['filters']=_[_0x19af('0x41')](_0x52c4bd['model'],_0x52c4bd[_0x19af('0x3f')]);_0x3678ef['attributes']=_['intersection'](_0x52c4bd[_0x19af('0x42')],qs[_0x19af('0x43')](_0x37acb2[_0x19af('0x3f')][_0x19af('0x43')]));_0x3678ef['attributes']=_0x3678ef[_0x19af('0x44')][_0x19af('0x45')]?_0x3678ef[_0x19af('0x44')]:_0x52c4bd[_0x19af('0x42')];if(!_0x37acb2[_0x19af('0x3f')][_0x19af('0x46')](_0x19af('0x47'))){_0x3678ef[_0x19af('0x29')]=qs[_0x19af('0x29')](_0x37acb2['query'][_0x19af('0x29')]);_0x3678ef[_0x19af('0x2b')]=qs['offset'](_0x37acb2[_0x19af('0x3f')][_0x19af('0x2b')]);}_0x3678ef['order']=qs[_0x19af('0x48')](_0x37acb2[_0x19af('0x3f')]['sort']);_0x3678ef['where']=qs[_0x19af('0x49')](_[_0x19af('0x4a')](_0x37acb2['query'],_0x52c4bd['filters']),_0x5d1675);if(_0x37acb2['query'][_0x19af('0x4b')]){_0x3678ef[_0x19af('0x4c')]=_[_0x19af('0x4d')](_0x3678ef['where'],{'$or':_['map'](_0x5d1675,function(_0x33baf9){if(_0x33baf9['type']!==_0x19af('0x4e')){var _0x5a9d91={};_0x5a9d91[_0x33baf9[_0x19af('0x38')]]={'$like':'%'+_0x37acb2[_0x19af('0x3f')][_0x19af('0x4b')]+'%'};return _0x5a9d91;}})});}_0x3678ef=_[_0x19af('0x4d')]({},_0x3678ef,_0x37acb2['options']);var _0x2614c6={'where':_0x3678ef[_0x19af('0x4c')]};return db[_0x19af('0x4f')][_0x19af('0x2a')](_0x2614c6)[_0x19af('0x32')](function(_0x48d128){_0x1ecfe8[_0x19af('0x2a')]=_0x48d128;if(_0x37acb2[_0x19af('0x3f')][_0x19af('0x50')]){_0x3678ef[_0x19af('0x51')]=[{'all':!![]}];}return db['FaxAccount'][_0x19af('0x52')](_0x3678ef);})[_0x19af('0x32')](function(_0x269015){_0x1ecfe8[_0x19af('0x53')]=_0x269015;return _0x1ecfe8;})[_0x19af('0x32')](respondWithFilteredResult(_0x36a2db,_0x3678ef))[_0x19af('0x24')](handleError(_0x36a2db,null));};exports[_0x19af('0x54')]=function(_0x1aab22,_0x1ade99){var _0x1095f7={'raw':![],'where':{'id':_0x1aab22['params']['id']},'include':[{'model':db[_0x19af('0x3a')],'as':'mandatoryDispositionPause'}]},_0x4c252d={};_0x4c252d[_0x19af('0x42')]=_[_0x19af('0x40')](db[_0x19af('0x4f')][_0x19af('0x3d')]);_0x4c252d[_0x19af('0x3f')]=_[_0x19af('0x40')](_0x1aab22[_0x19af('0x3f')]);_0x4c252d[_0x19af('0x49')]=_[_0x19af('0x41')](_0x4c252d[_0x19af('0x42')],_0x4c252d[_0x19af('0x3f')]);_0x1095f7[_0x19af('0x44')]=_[_0x19af('0x41')](_0x4c252d[_0x19af('0x42')],qs[_0x19af('0x43')](_0x1aab22[_0x19af('0x3f')]['fields']));_0x1095f7[_0x19af('0x44')]=_0x1095f7[_0x19af('0x44')]['length']?_0x1095f7[_0x19af('0x44')]:_0x4c252d[_0x19af('0x42')];if(_0x1aab22[_0x19af('0x3f')][_0x19af('0x50')]){_0x1095f7['include']=[{'all':!![]}];}_0x1095f7=_[_0x19af('0x4d')]({},_0x1095f7,_0x1aab22['options']);return db[_0x19af('0x4f')]['find'](_0x1095f7)['then'](handleEntityNotFound(_0x1ade99,null))[_0x19af('0x32')](respondWithResult(_0x1ade99,null))[_0x19af('0x24')](handleError(_0x1ade99,null));};exports[_0x19af('0x55')]=function(_0x2a47b4,_0x541fa1){return db[_0x19af('0x4f')][_0x19af('0x55')](_0x2a47b4[_0x19af('0x56')],{})['then'](function(_0x4309ad){var _0x1af1a2=_0x2a47b4['user'][_0x19af('0x34')]({'plain':!![]});if(!_0x1af1a2)throw new Error(_0x19af('0x57'));if(_0x1af1a2[_0x19af('0x58')]===_0x19af('0x59')){var _0x280eeb=_0x4309ad[_0x19af('0x34')]({'plain':!![]});var _0x1908a7=_0x19af('0x5a');return db['UserProfileSection'][_0x19af('0x5b')]({'where':{'name':_0x1908a7,'userProfileId':_0x1af1a2[_0x19af('0x5c')]},'raw':!![]})[_0x19af('0x32')](function(_0x5266ab){if(_0x5266ab&&_0x5266ab['autoAssociation']===0x0){return db['UserProfileResource'][_0x19af('0x55')]({'name':_0x280eeb[_0x19af('0x38')],'resourceId':_0x280eeb['id'],'type':_0x5266ab[_0x19af('0x38')],'sectionId':_0x5266ab['id']},{})['then'](function(){return _0x4309ad;});}else{return _0x4309ad;}})[_0x19af('0x24')](function(_0x4e72cc){logger['error'](_0x19af('0x5d'),_0x4e72cc);throw _0x4e72cc;});}return _0x4309ad;})[_0x19af('0x32')](respondWithResult(_0x541fa1,0xc9))['catch'](handleError(_0x541fa1,null));};exports[_0x19af('0x31')]=function(_0x1c205f,_0x273ba5){if(_0x1c205f[_0x19af('0x56')]['id']){delete _0x1c205f[_0x19af('0x56')]['id'];}return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0x1c205f[_0x19af('0x5e')]['id']},'include':[{'model':db[_0x19af('0x3a')],'as':_0x19af('0x3b')}]})['then'](handleEntityNotFound(_0x273ba5,null))[_0x19af('0x32')](saveUpdates(_0x1c205f[_0x19af('0x56')],null))[_0x19af('0x32')](respondWithResult(_0x273ba5,null))['catch'](handleError(_0x273ba5,null));};exports[_0x19af('0x33')]=function(_0x18cd00,_0x1fb4d1){return db[_0x19af('0x4f')]['find']({'where':{'id':_0x18cd00['params']['id']}})['then'](handleEntityNotFound(_0x1fb4d1,null))[_0x19af('0x32')](removeEntity(_0x1fb4d1,null))[_0x19af('0x24')](handleError(_0x1fb4d1,null));};exports[_0x19af('0x5f')]=function(_0x5b7852,_0xf068de){return db[_0x19af('0x4f')][_0x19af('0x5f')]()[_0x19af('0x32')](respondWithResult(_0xf068de,null))[_0x19af('0x24')](handleError(_0xf068de,null));};exports[_0x19af('0x60')]=function(_0x296515,_0x5f1116,_0x86ba6d){if(_0x296515['body']['id']){delete _0x296515[_0x19af('0x56')]['id'];}return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0x296515[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x5f1116,null))[_0x19af('0x32')](function(_0x11d886){if(_0x11d886){_0x296515[_0x19af('0x56')][_0x19af('0x61')]=_0x11d886['id'];return db[_0x19af('0x62')][_0x19af('0x55')](_0x296515[_0x19af('0x56')]);}})[_0x19af('0x32')](respondWithResult(_0x5f1116,null))[_0x19af('0x24')](handleError(_0x5f1116,null));};exports[_0x19af('0x63')]=function(_0x3d2870,_0x81808d,_0x5317c3){var _0x208cc8={'raw':![],'where':{}};var _0x27ea46={};var _0x39132d={'count':0x0,'rows':[]};return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x3d2870['params']['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x81808d,null))[_0x19af('0x32')](function(_0x3d6141){if(_0x3d6141){_0x27ea46[_0x19af('0x42')]=_['keys'](db[_0x19af('0x62')][_0x19af('0x3d')]);_0x27ea46['query']=_['keys'](_0x3d2870[_0x19af('0x3f')]);_0x27ea46['filters']=_['intersection'](_0x27ea46[_0x19af('0x42')],_0x27ea46[_0x19af('0x3f')]);_0x208cc8['attributes']=_[_0x19af('0x41')](_0x27ea46['model'],qs[_0x19af('0x43')](_0x3d2870[_0x19af('0x3f')]['fields']));_0x208cc8[_0x19af('0x44')]=_0x208cc8[_0x19af('0x44')][_0x19af('0x45')]?_0x208cc8[_0x19af('0x44')]:_0x27ea46[_0x19af('0x42')];if(!_0x3d2870[_0x19af('0x3f')]['hasOwnProperty'](_0x19af('0x47'))){_0x208cc8[_0x19af('0x29')]=qs['limit'](_0x3d2870['query'][_0x19af('0x29')]);_0x208cc8[_0x19af('0x2b')]=qs[_0x19af('0x2b')](_0x3d2870[_0x19af('0x3f')][_0x19af('0x2b')]);}_0x208cc8[_0x19af('0x65')]=qs[_0x19af('0x48')](_0x3d2870[_0x19af('0x3f')][_0x19af('0x48')]);_0x208cc8[_0x19af('0x4c')]=qs[_0x19af('0x49')](_[_0x19af('0x4a')](_0x3d2870[_0x19af('0x3f')],_0x27ea46[_0x19af('0x49')]));_0x208cc8[_0x19af('0x4c')][_0x19af('0x61')]=_0x3d6141['id'];if(_0x3d2870[_0x19af('0x3f')][_0x19af('0x4b')]){_0x208cc8[_0x19af('0x4c')]=_[_0x19af('0x4d')](_0x208cc8[_0x19af('0x4c')],{'$or':_['map'](_0x208cc8[_0x19af('0x44')],function(_0x10b2eb){var _0x40e861={};_0x40e861[_0x10b2eb]={'$like':'%'+_0x3d2870[_0x19af('0x3f')][_0x19af('0x4b')]+'%'};return _0x40e861;})});}_0x208cc8=_['merge']({},_0x208cc8,_0x3d2870[_0x19af('0x66')]);return db[_0x19af('0x62')][_0x19af('0x2a')]({'where':_0x208cc8[_0x19af('0x4c')]})[_0x19af('0x32')](function(_0x3945ff){_0x39132d['count']=_0x3945ff;if(_0x3d2870[_0x19af('0x3f')][_0x19af('0x50')]){_0x208cc8[_0x19af('0x51')]=[{'all':!![]}];}return db[_0x19af('0x62')]['findAll'](_0x208cc8);})[_0x19af('0x32')](function(_0x5349fc){_0x39132d[_0x19af('0x53')]=_0x5349fc;return _0x39132d;});}})[_0x19af('0x32')](respondWithFilteredResult(_0x81808d,_0x208cc8))['catch'](handleError(_0x81808d,null));};exports[_0x19af('0x67')]=function(_0x1b59fc,_0x4fc6b1,_0x2c31b9){return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0x1b59fc['params']['id']}})['then'](handleEntityNotFound(_0x4fc6b1,null))['then'](function(_0x28a38e){if(_0x28a38e){return _0x28a38e['removeDispositions'](_0x1b59fc[_0x19af('0x3f')][_0x19af('0x68')]);}})['then'](respondWithStatusCode(_0x4fc6b1,null))[_0x19af('0x24')](handleError(_0x4fc6b1,null));};exports[_0x19af('0x69')]=function(_0x486e86,_0x52386b,_0x47a5f1){if(_0x486e86['body']['id']){delete _0x486e86[_0x19af('0x56')]['id'];}return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0x486e86[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x52386b,null))['then'](function(_0x17bab0){if(_0x17bab0){_0x486e86[_0x19af('0x56')][_0x19af('0x61')]=_0x17bab0['id'];return db[_0x19af('0x6a')][_0x19af('0x55')](_0x486e86['body']);}})['then'](respondWithResult(_0x52386b,null))[_0x19af('0x24')](handleError(_0x52386b,null));};exports[_0x19af('0x6b')]=function(_0x369c05,_0x19913d,_0x436686){var _0x404c25={'raw':![],'where':{}};var _0x2d391b={};var _0x33df58={'count':0x0,'rows':[]};return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x369c05[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x19913d,null))['then'](function(_0x50dc20){if(_0x50dc20){_0x2d391b[_0x19af('0x42')]=_['keys'](db[_0x19af('0x6a')]['rawAttributes']);_0x2d391b['query']=_[_0x19af('0x40')](_0x369c05[_0x19af('0x3f')]);_0x2d391b['filters']=_[_0x19af('0x41')](_0x2d391b[_0x19af('0x42')],_0x2d391b[_0x19af('0x3f')]);_0x404c25[_0x19af('0x44')]=_[_0x19af('0x41')](_0x2d391b[_0x19af('0x42')],qs['fields'](_0x369c05[_0x19af('0x3f')][_0x19af('0x43')]));_0x404c25[_0x19af('0x44')]=_0x404c25['attributes']['length']?_0x404c25['attributes']:_0x2d391b['model'];if(!_0x369c05['query']['hasOwnProperty'](_0x19af('0x47'))){_0x404c25[_0x19af('0x29')]=qs[_0x19af('0x29')](_0x369c05[_0x19af('0x3f')][_0x19af('0x29')]);_0x404c25[_0x19af('0x2b')]=qs['offset'](_0x369c05[_0x19af('0x3f')]['offset']);}_0x404c25['order']=qs['sort'](_0x369c05[_0x19af('0x3f')][_0x19af('0x48')]);_0x404c25[_0x19af('0x4c')]=qs[_0x19af('0x49')](_[_0x19af('0x4a')](_0x369c05[_0x19af('0x3f')],_0x2d391b[_0x19af('0x49')]));_0x404c25[_0x19af('0x4c')][_0x19af('0x61')]=_0x50dc20['id'];if(_0x369c05[_0x19af('0x3f')][_0x19af('0x4b')]){_0x404c25['where']=_[_0x19af('0x4d')](_0x404c25[_0x19af('0x4c')],{'$or':_['map'](_0x404c25[_0x19af('0x44')],function(_0x1264de){var _0x212ae2={};_0x212ae2[_0x1264de]={'$like':'%'+_0x369c05[_0x19af('0x3f')][_0x19af('0x4b')]+'%'};return _0x212ae2;})});}_0x404c25=_[_0x19af('0x4d')]({},_0x404c25,_0x369c05[_0x19af('0x66')]);return db[_0x19af('0x6a')][_0x19af('0x2a')]({'where':_0x404c25[_0x19af('0x4c')]})[_0x19af('0x32')](function(_0x1db6ce){_0x33df58[_0x19af('0x2a')]=_0x1db6ce;if(_0x369c05[_0x19af('0x3f')]['includeAll']){_0x404c25[_0x19af('0x51')]=[{'all':!![]}];}return db[_0x19af('0x6a')][_0x19af('0x52')](_0x404c25);})[_0x19af('0x32')](function(_0x5defdd){_0x33df58[_0x19af('0x53')]=_0x5defdd;return _0x33df58;});}})[_0x19af('0x32')](respondWithFilteredResult(_0x19913d,_0x404c25))[_0x19af('0x24')](handleError(_0x19913d,null));};exports['removeAnswers']=function(_0x17aa58,_0x1cc50e,_0x11c684){return db[_0x19af('0x4f')]['find']({'where':{'id':_0x17aa58['params']['id']}})['then'](handleEntityNotFound(_0x1cc50e,null))['then'](function(_0x2c89d6){if(_0x2c89d6){return _0x2c89d6[_0x19af('0x6c')](_0x17aa58[_0x19af('0x3f')][_0x19af('0x68')]);}})['then'](respondWithStatusCode(_0x1cc50e,null))[_0x19af('0x24')](handleError(_0x1cc50e,null));};exports[_0x19af('0x6d')]=function(_0x560469,_0x3e3411,_0x39bdd8){return db[_0x19af('0x6e')][_0x19af('0x5b')]({'where':{'id':_0x560469[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x3e3411,null))['then'](function(_0xe8e831){if(_0xe8e831){return _0xe8e831[_0x19af('0x6d')](_0x560469[_0x19af('0x56')][_0x19af('0x68')],_['omit'](_0x560469['body'],[_0x19af('0x68'),'id'])||{});}})[_0x19af('0x32')](respondWithResult(_0x3e3411,null))['catch'](handleError(_0x3e3411,null));};exports[_0x19af('0x6f')]=function(_0x413e9f,_0x4c04a3,_0x26b60f){var _0x2d58a8={'raw':![],'where':{}};var _0x4c5da9={};var _0x7570={'count':0x0,'rows':[]};return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x413e9f[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x4c04a3,null))[_0x19af('0x32')](function(_0x3126a0){if(_0x3126a0){_0x4c5da9[_0x19af('0x42')]=_[_0x19af('0x40')](db[_0x19af('0x6e')][_0x19af('0x3d')]);_0x4c5da9['query']=_[_0x19af('0x40')](_0x413e9f[_0x19af('0x3f')]);_0x4c5da9[_0x19af('0x49')]=_['intersection'](_0x4c5da9[_0x19af('0x42')],_0x4c5da9[_0x19af('0x3f')]);_0x2d58a8[_0x19af('0x44')]=_[_0x19af('0x41')](_0x4c5da9['model'],qs[_0x19af('0x43')](_0x413e9f['query'][_0x19af('0x43')]));_0x2d58a8['attributes']=_0x2d58a8[_0x19af('0x44')][_0x19af('0x45')]?_0x2d58a8['attributes']:_0x4c5da9[_0x19af('0x42')];if(!_0x413e9f[_0x19af('0x3f')][_0x19af('0x46')](_0x19af('0x47'))){_0x2d58a8['limit']=qs[_0x19af('0x29')](_0x413e9f[_0x19af('0x3f')][_0x19af('0x29')]);_0x2d58a8[_0x19af('0x2b')]=qs[_0x19af('0x2b')](_0x413e9f[_0x19af('0x3f')][_0x19af('0x2b')]);}_0x2d58a8[_0x19af('0x65')]=qs[_0x19af('0x48')](_0x413e9f[_0x19af('0x3f')]['sort']);_0x2d58a8[_0x19af('0x4c')]=qs['filters'](_[_0x19af('0x4a')](_0x413e9f['query'],_0x4c5da9[_0x19af('0x49')]));_0x2d58a8['where'][_0x19af('0x61')]=_0x3126a0['id'];if(_0x413e9f[_0x19af('0x3f')]['filter']){_0x2d58a8[_0x19af('0x4c')]=_[_0x19af('0x4d')](_0x2d58a8[_0x19af('0x4c')],{'$or':_['map'](_0x2d58a8['attributes'],function(_0x5b1a66){var _0x39a13f={};_0x39a13f[_0x5b1a66]={'$like':'%'+_0x413e9f['query'][_0x19af('0x4b')]+'%'};return _0x39a13f;})});}_0x2d58a8=_['merge']({},_0x2d58a8,_0x413e9f[_0x19af('0x66')]);return db[_0x19af('0x6e')][_0x19af('0x2a')]({'where':_0x2d58a8['where']})['then'](function(_0x4dcf23){_0x7570[_0x19af('0x2a')]=_0x4dcf23;if(_0x413e9f[_0x19af('0x3f')][_0x19af('0x50')]){_0x2d58a8[_0x19af('0x51')]=[{'model':db[_0x19af('0x70')],'as':_0x19af('0x71'),'required':![]},{'model':db[_0x19af('0x72')],'as':'Owner','attributes':[_0x19af('0x38'),_0x19af('0x73'),_0x19af('0x74')],'required':![]},{'model':db[_0x19af('0x75')],'as':_0x19af('0x76'),'attributes':['id',_0x19af('0x38'),_0x19af('0x77')],'where':_0x413e9f['query']['tag']?{'id':_0x413e9f[_0x19af('0x3f')][_0x19af('0x78')]}:undefined,'required':_0x413e9f[_0x19af('0x3f')][_0x19af('0x78')]?!![]:![]}];}return db[_0x19af('0x6e')][_0x19af('0x52')](_0x2d58a8);})[_0x19af('0x32')](function(_0x23ce67){_0x7570['rows']=_0x23ce67;return _0x7570;});}})['then'](respondWithFilteredResult(_0x4c04a3,_0x2d58a8))['catch'](handleError(_0x4c04a3,null));};exports[_0x19af('0x79')]=function(_0x339290,_0x88ec1c){var _0x49967b=_0x339290['params']['id'];var _0x34db30=_0x339290['body'];var _0x53d52c=0xc8;var _0x1a6153=null;return db[_0x19af('0x7a')][_0x19af('0x7b')]({'isolationLevel':db[_0x19af('0x7a')][_0x19af('0x7c')][_0x19af('0x7d')][_0x19af('0x7e')]},function(_0x2f359b){return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x49967b},'transaction':_0x2f359b})['then'](function(_0x544bf7){if(_0x544bf7){return db['FaxApplication'][_0x19af('0x33')]({'where':{'FaxAccountId':_0x49967b},'transaction':_0x2f359b})[_0x19af('0x32')](function(){var _0x149694=_[_0x19af('0x3c')](_0x34db30,function(_0x4773db){_0x4773db[_0x19af('0x61')]=_0x49967b;return _0x4773db;});return db[_0x19af('0x7f')][_0x19af('0x80')](_0x149694,{'transaction':_0x2f359b});});}else{_0x53d52c=0x194;_0x1a6153=[];}});})[_0x19af('0x32')](function(){if(_0x53d52c!==0x194){return db['FaxApplication'][_0x19af('0x81')]({'where':{'FaxAccountId':_0x49967b},'order':_0x19af('0x82')})[_0x19af('0x32')](function(_0x4b97b8){_0x1a6153=_0x4b97b8;});}})[_0x19af('0x24')](function(_0x2db144){_0x53d52c=0x1f4;logger[_0x19af('0x20')](_0x2db144['stack']);if(_0x2db144[_0x19af('0x38')]){delete _0x2db144[_0x19af('0x38')];}_0x1a6153=_0x2db144;})[_0x19af('0x83')](function(){if(_0x1a6153===null){_0x88ec1c[_0x19af('0x25')](_0x53d52c);}else{if(_0x53d52c===0x1f4){_0x88ec1c[_0x19af('0x26')](_0x53d52c)['send'](_0x1a6153);}else{_0x88ec1c['status'](_0x53d52c)[_0x19af('0x27')](_0x1a6153);}}});};exports[_0x19af('0x84')]=function(_0x3dfcf4,_0x7fd264,_0x497da7){var _0x23012b={};var _0x52a8fe={};var _0xd4f3ca;var _0x4e8f03;return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x3dfcf4['params']['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x7fd264,null))[_0x19af('0x32')](function(_0x31e815){if(_0x31e815){_0xd4f3ca=_0x31e815;_0x52a8fe[_0x19af('0x42')]=_[_0x19af('0x40')](db['FaxApplication']['rawAttributes']);_0x52a8fe[_0x19af('0x3f')]=_[_0x19af('0x40')](_0x3dfcf4[_0x19af('0x3f')]);_0x52a8fe[_0x19af('0x49')]=_[_0x19af('0x41')](_0x52a8fe['model'],_0x52a8fe[_0x19af('0x3f')]);_0x23012b['attributes']=_[_0x19af('0x41')](_0x52a8fe[_0x19af('0x42')],qs['fields'](_0x3dfcf4[_0x19af('0x3f')][_0x19af('0x43')]));_0x23012b[_0x19af('0x44')]=_0x23012b[_0x19af('0x44')][_0x19af('0x45')]?_0x23012b[_0x19af('0x44')]:_0x52a8fe[_0x19af('0x42')];_0x23012b[_0x19af('0x65')]=qs[_0x19af('0x48')](_0x3dfcf4[_0x19af('0x3f')][_0x19af('0x48')]);_0x23012b[_0x19af('0x4c')]=qs[_0x19af('0x49')](_[_0x19af('0x4a')](_0x3dfcf4['query'],_0x52a8fe[_0x19af('0x49')]));if(_0x3dfcf4[_0x19af('0x3f')][_0x19af('0x4b')]){_0x23012b['where']=_['merge'](_0x23012b['where'],{'$or':_[_0x19af('0x3c')](_0x23012b['attributes'],function(_0x2fc88e){var _0x34c2e7={};_0x34c2e7[_0x2fc88e]={'$like':'%'+_0x3dfcf4[_0x19af('0x3f')][_0x19af('0x4b')]+'%'};return _0x34c2e7;})});}_0x23012b=_['merge']({},_0x23012b,_0x3dfcf4[_0x19af('0x66')]);return _0xd4f3ca[_0x19af('0x84')](_0x23012b);}})['then'](function(_0x178316){if(_0x178316){_0x4e8f03=_0x178316[_0x19af('0x45')];if(!_0x3dfcf4[_0x19af('0x3f')][_0x19af('0x46')](_0x19af('0x47'))){_0x23012b[_0x19af('0x29')]=qs[_0x19af('0x29')](_0x3dfcf4[_0x19af('0x3f')]['limit']);_0x23012b[_0x19af('0x2b')]=qs[_0x19af('0x2b')](_0x3dfcf4['query'][_0x19af('0x2b')]);}return _0xd4f3ca[_0x19af('0x84')](_0x23012b);}})['then'](function(_0x453e3d){if(_0x453e3d){return _0x453e3d?{'count':_0x4e8f03,'rows':_0x453e3d}:null;}})[_0x19af('0x32')](respondWithResult(_0x7fd264,null))[_0x19af('0x24')](handleError(_0x7fd264,null));};function Extension(_0xc8020d,_0x2b373b,_0x2b2a8d,_0x2e773b){this[_0x19af('0x85')]=_0x19af('0x86');this[_0x19af('0x87')]=_0xc8020d[_0x19af('0x88')];this['app']=_0x2e773b;this[_0x19af('0x89')]=_0x19af('0x8a');this[_0x19af('0x8b')]=_0x19af('0x8c');this[_0x19af('0x61')]=_0xc8020d['id'];this['priority']=_0x2b373b;this['appdata']=_0x2b2a8d;}function createExtensionsReciveFax(_0x2583a7){var _0xd3bad4=0x1;var _0x1376ca=[];_0x1376ca[_0x19af('0x8d')](new Extension(_0x2583a7,_0xd3bad4,'',_0x19af('0x8e')));_0xd3bad4+=0x1;_0x1376ca['push'](new Extension(_0x2583a7,_0xd3bad4,_0x19af('0x8f'),_0x19af('0x90')));_0xd3bad4+=0x1;for(var _0x1647bc in _0x2583a7){if(_0x2583a7[_0x19af('0x46')](_0x1647bc)&&(_0x1647bc==='ecm'||_0x1647bc===_0x19af('0x88')||_0x1647bc===_0x19af('0x91')||_0x1647bc===_0x19af('0x92')||_0x1647bc==='headerinfo'||_0x1647bc==='maxrate'||_0x1647bc===_0x19af('0x93')||_0x1647bc===_0x19af('0x94')||_0x1647bc===_0x19af('0x95'))){_0x1376ca[_0x19af('0x8d')](new Extension(_0x2583a7,_0xd3bad4,'FAXOPT('+_0x1647bc+')='+_0x2583a7[_0x1647bc],_0x19af('0x90')));_0xd3bad4+=0x1;}}_0x1376ca[_0x19af('0x8d')](new Extension(_0x2583a7,_0xd3bad4,'6','Wait'));_0xd3bad4+=0x1;_0x1376ca[_0x19af('0x8d')](new Extension(_0x2583a7,_0xd3bad4,'/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',_0x19af('0x96')));_0xd3bad4=0x0;return _0x1376ca;}exports[_0x19af('0x97')]=function(_0x58bea0,_0x25e41a,_0x51daad){var _0x56a4ad;return db[_0x19af('0x7a')][_0x19af('0x7b')](function(_0x1f7401){return db[_0x19af('0x4f')][_0x19af('0x55')](_0x58bea0[_0x19af('0x56')],{'transaction':_0x1f7401})[_0x19af('0x32')](function(_0x3dbf9b){_0x56a4ad=_0x3dbf9b[_0x19af('0x34')]({'plain':!![]});return db[_0x19af('0x98')][_0x19af('0x80')](createExtensionsReciveFax(_0x56a4ad),{'transaction':_0x1f7401});});})[_0x19af('0x32')](function(){return _0x56a4ad;})[_0x19af('0x32')](respondWithResult(_0x25e41a,null))['catch'](handleError(_0x25e41a,null));};exports[_0x19af('0x99')]=function(_0x36363d,_0x34e12d,_0x1e0ffe){var _0x44d3cc;return db[_0x19af('0x7a')][_0x19af('0x7b')](function(_0x68bb0b){return db['FaxAccount'][_0x19af('0x31')](_0x36363d[_0x19af('0x56')],{'where':{'id':_0x36363d[_0x19af('0x56')]['id']},'transaction':_0x68bb0b})['then'](function(_0x4a41db){return db[_0x19af('0x98')][_0x19af('0x33')]({'where':{'FaxAccountId':_0x36363d[_0x19af('0x56')]['id']},'transaction':_0x68bb0b})[_0x19af('0x32')](function(_0x8da42d){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x36363d[_0x19af('0x56')],['tech',_0x19af('0x9a'),'createdAt',_0x19af('0x9b'),_0x19af('0x9c'),_0x19af('0x9d')])),{'transaction':_0x68bb0b});});});})[_0x19af('0x32')](function(){return db[_0x19af('0x4f')][_0x19af('0x9e')](_0x36363d['body']['id']);})[_0x19af('0x32')](respondWithResult(_0x34e12d,null))[_0x19af('0x24')](handleError(_0x34e12d,null));};exports[_0x19af('0x9f')]=function(_0x18c94f,_0x4f730a,_0x3ce998){var _0x20ba3f={'raw':!![],'where':{}};var _0x1647c5={};var _0x2b4ef4={'count':0x0,'rows':[]};return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x18c94f[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x4f730a,null))[_0x19af('0x32')](function(_0x4ffe1f){if(_0x4ffe1f){_0x1647c5[_0x19af('0x42')]=_[_0x19af('0x40')](db[_0x19af('0xa0')][_0x19af('0x3d')]);_0x1647c5[_0x19af('0x3f')]=_['keys'](_0x18c94f[_0x19af('0x3f')]);_0x1647c5[_0x19af('0x49')]=_[_0x19af('0x41')](_0x1647c5[_0x19af('0x42')],_0x1647c5[_0x19af('0x3f')]);_0x20ba3f[_0x19af('0x44')]=_[_0x19af('0x41')](_0x1647c5[_0x19af('0x42')],qs[_0x19af('0x43')](_0x18c94f['query'][_0x19af('0x43')]));_0x20ba3f[_0x19af('0x44')]=_0x20ba3f[_0x19af('0x44')][_0x19af('0x45')]?_0x20ba3f[_0x19af('0x44')]:_0x1647c5['model'];if(!_0x18c94f[_0x19af('0x3f')][_0x19af('0x46')](_0x19af('0x47'))){_0x20ba3f['limit']=qs[_0x19af('0x29')](_0x18c94f[_0x19af('0x3f')][_0x19af('0x29')]);_0x20ba3f[_0x19af('0x2b')]=qs[_0x19af('0x2b')](_0x18c94f[_0x19af('0x3f')][_0x19af('0x2b')]);}_0x20ba3f[_0x19af('0x65')]=qs[_0x19af('0x48')](_0x18c94f[_0x19af('0x3f')][_0x19af('0x48')]);_0x20ba3f[_0x19af('0x4c')]=qs['filters'](_['pick'](_0x18c94f[_0x19af('0x3f')],_0x1647c5[_0x19af('0x49')]));_0x20ba3f['where'][_0x19af('0x61')]=_0x4ffe1f['id'];if(_0x18c94f[_0x19af('0x3f')][_0x19af('0x4b')]){_0x20ba3f[_0x19af('0x4c')]=_[_0x19af('0x4d')](_0x20ba3f[_0x19af('0x4c')],{'$or':_[_0x19af('0x3c')](_0x20ba3f['attributes'],function(_0x2012fe){var _0x648b34={};_0x648b34[_0x2012fe]={'$like':'%'+_0x18c94f[_0x19af('0x3f')]['filter']+'%'};return _0x648b34;})});}if(_0x18c94f[_0x19af('0x3f')]['$gte']){var _0x565c9b=_0x18c94f[_0x19af('0x3f')][_0x19af('0xa1')]['split'](',');var _0x19f5ee={};_0x19f5ee[_0x565c9b[0x0]]={'$gte':moment(_0x565c9b[0x1])[_0x19af('0xa2')](_0x19af('0xa3'))};_0x20ba3f[_0x19af('0x4c')]=_['merge'](_0x20ba3f[_0x19af('0x4c')],_0x19f5ee);}_0x20ba3f=_[_0x19af('0x4d')]({},_0x20ba3f,_0x18c94f[_0x19af('0x66')]);return db[_0x19af('0xa0')][_0x19af('0x2a')]({'where':_0x20ba3f[_0x19af('0x4c')]})['then'](function(_0xc8ed9d){_0x2b4ef4[_0x19af('0x2a')]=_0xc8ed9d;if(_0x18c94f[_0x19af('0x3f')][_0x19af('0x50')]){_0x20ba3f[_0x19af('0x51')]=[{'all':!![]}];}return db[_0x19af('0xa0')][_0x19af('0x52')](_0x20ba3f);})['then'](function(_0x3a8b7b){_0x2b4ef4[_0x19af('0x53')]=_0x3a8b7b;return _0x2b4ef4;});}})[_0x19af('0x32')](respondWithFilteredResult(_0x4f730a,_0x20ba3f))[_0x19af('0x24')](handleError(_0x4f730a,null));};exports[_0x19af('0xa4')]=function(_0x171764,_0x813d08,_0x4413d7){var _0x1df7cd,_0x4251c5={},_0x247d43;if(_0x171764[_0x19af('0x56')]['to']){_0x247d43=_0x171764[_0x19af('0x56')]['to'][0x0];}return db['FaxAccount'][_0x19af('0x5b')]({'where':{'id':_0x171764[_0x19af('0x5e')]['id']},'include':[{'model':db[_0x19af('0xa5')],'as':_0x19af('0xa6'),'include':[{'model':db[_0x19af('0x70')],'as':'Contacts','where':{'fax':_0x247d43},'limit':0x1,'order':[[_0x19af('0x9b'),_0x19af('0xa7')]]}]}]})[_0x19af('0x32')](handleEntityNotFound(_0x813d08,null))['then'](function(_0x2ef92a){_0x1df7cd=_0x2ef92a;if(_0x171764[_0x19af('0x56')]['attachments']&&_0x171764['body'][_0x19af('0xa8')][_0x19af('0x45')]){for(var _0x15ebe0=0x0;_0x15ebe0<_0x171764[_0x19af('0x56')][_0x19af('0xa8')][_0x19af('0x45')];_0x15ebe0+=0x1){_0x171764[_0x19af('0x56')]['attachments'][_0x15ebe0]={'filename':_0x171764[_0x19af('0x56')][_0x19af('0xa8')][_0x15ebe0][_0x19af('0x38')],'id':_0x171764[_0x19af('0x56')][_0x19af('0xa8')][_0x15ebe0]['id'],'path':path['join'](config['root'],'server/files/attachments',_0x171764[_0x19af('0x56')]['attachments'][_0x15ebe0][_0x19af('0xa9')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x19af('0xaa')](_0x171764[_0x19af('0x5e')]['id'])?undefined:_0x171764[_0x19af('0x5e')]['id'],'path':_[_0x19af('0xaa')](_0x171764[_0x19af('0x56')][_0x19af('0xa8')][0x0][_0x19af('0xab')])?undefined:_0x171764[_0x19af('0x56')][_0x19af('0xa8')][0x0]['path'],'fax':_[_0x19af('0xaa')](_0x171764[_0x19af('0x56')]['to'][0x0])?undefined:_0x171764[_0x19af('0x56')]['to'][0x0]},client9002);})[_0x19af('0x32')](function(){if(_0x1df7cd){if(_['isNil'](_0x171764[_0x19af('0x56')][_0x19af('0xac')])){_0x171764['body'][_0x19af('0xac')]=util[_0x19af('0xa2')](_0x19af('0xad'),_0x1df7cd['name'],_0x1df7cd[_0x19af('0xae')]);}if(_0x1df7cd['List']){if(_0x1df7cd[_0x19af('0xa6')][_0x19af('0xaf')][_0x19af('0x45')]){return _0x1df7cd[_0x19af('0xa6')][_0x19af('0xaf')][0x0];}else{return db['CmContact'][_0x19af('0x55')](_[_0x19af('0x13')](_0x171764[_0x19af('0x56')],{'firstName':_0x171764[_0x19af('0x56')]['to'][0x0],'phone':_0x171764['body']['to'][0x0],'fax':_0x171764['body']['to'][0x0],'ListId':_0x1df7cd[_0x19af('0x9d')]}));}}else{throw new Error(_0x19af('0xb0'));}}else{throw new Error(_0x19af('0xb1'));}})[_0x19af('0x32')](function(_0x3bd4b3){if(_0x3bd4b3){return db[_0x19af('0x6e')][_0x19af('0x5b')]({'where':{'ContactId':_0x3bd4b3['id'],'closed':![],'FaxAccountId':_0x1df7cd['id']}})[_0x19af('0x32')](function(_0x6d1acd){if(_0x6d1acd){return[_0x6d1acd,![]];}return db[_0x19af('0x6e')]['create']({'UserId':_0x171764[_0x19af('0x59')]['id'],'ContactId':_0x3bd4b3['id'],'FaxAccountId':_0x1df7cd['id'],'fax':_0x171764[_0x19af('0x56')]['to'][0x0],'firstMsgDirection':_0x19af('0xb2'),'Messages':[_[_0x19af('0x4d')](_0x171764[_0x19af('0x56')],{'read':![],'body':_0x171764['body'][_0x19af('0xa8')][0x0][_0x19af('0xb3')],'FaxAccountId':_0x1df7cd['id'],'UserId':_0x171764['user']['id'],'ContactId':_0x3bd4b3['id'],'AttachmentId':_0x171764[_0x19af('0x56')][_0x19af('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x19af('0xb4')}]})[_0x19af('0x32')](function(_0x5eabb6){return[_0x5eabb6,!![]];});});}else{throw new Error(_0x19af('0xb5'));}})['spread'](function(_0x1b3714,_0xda8cf8){if(_0xda8cf8){return _0x1b3714;}return db[_0x19af('0xa0')][_0x19af('0x55')]({'direction':_0x19af('0xb2'),'read':![],'body':_0x171764[_0x19af('0x56')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1df7cd['id'],'FaxInteractionId':_0x1b3714['id'],'UserId':_0x171764[_0x19af('0x59')]['id'],'ContactId':_0x1b3714['ContactId'],'AttachmentId':_0x171764[_0x19af('0x56')][_0x19af('0xa8')][0x0]['id']})[_0x19af('0x32')](function(_0x212c05){_0x1b3714[_0x19af('0xb6')][_0x19af('0xb4')]=[];_0x1b3714[_0x19af('0xb6')][_0x19af('0xb4')][_0x19af('0x8d')](_0x212c05[_0x19af('0xb6')]);return _0x1b3714;});})[_0x19af('0x32')](function(_0x6bcdf){respondWithRpcPromise(_0x19af('0xb7'),_0x19af('0xb7'),{'FaxAccountId':_[_0x19af('0xaa')](_0x171764[_0x19af('0x5e')]['id'])?undefined:_0x171764[_0x19af('0x5e')]['id'],'path':_[_0x19af('0xaa')](_0x171764[_0x19af('0x56')][_0x19af('0xa8')][0x0][_0x19af('0xab')])?undefined:_0x171764[_0x19af('0x56')]['attachments'][0x0][_0x19af('0xab')],'fax':_[_0x19af('0xaa')](_0x171764[_0x19af('0x56')]['to'][0x0])?undefined:_0x171764[_0x19af('0x56')]['to'][0x0],'AttachmentId':_0x171764['body'][_0x19af('0xa8')][0x0]['id']},client9002)[_0x19af('0x32')](function(_0x32220a){logger[_0x19af('0x22')](_0x19af('0xb8'),_0x32220a);})[_0x19af('0x24')](function(_0x103993){logger[_0x19af('0x22')](_0x19af('0xb8'),_0x103993);});return _0x6bcdf;})[_0x19af('0x32')](respondWithResult(_0x813d08,null))['catch'](handleError(_0x813d08,null));};exports[_0x19af('0xb9')]=function(_0xf67142,_0x23bd76,_0x324b37){return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0xf67142['params']['id']}})['then'](handleEntityNotFound(_0x23bd76,null))['then'](function(_0x40a315){if(_0x40a315){return _0x40a315[_0x19af('0xb9')](_0xf67142[_0x19af('0x56')]['ids'],_[_0x19af('0xba')](_0xf67142[_0x19af('0x56')],['ids','id'])||{})[_0x19af('0xbb')](function(_0x542ca4){for(var _0x260f51=0x0;_0x260f51<_0xf67142['body'][_0x19af('0x68')][_0x19af('0x45')];_0x260f51+=0x1){socket['emit'](_0x19af('0xbc'),{'UserId':Number(_0xf67142[_0x19af('0x56')][_0x19af('0x68')][_0x260f51]),'FaxAccountId':Number(_0xf67142[_0x19af('0x5e')]['id'])});}return _0x542ca4;});}})[_0x19af('0x32')](respondWithResult(_0x23bd76,null))['catch'](handleError(_0x23bd76,null));};exports[_0x19af('0xbd')]=function(_0x156b0f,_0x4724d8,_0x129984){return db[_0x19af('0x4f')][_0x19af('0x5b')]({'where':{'id':_0x156b0f[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x4724d8,null))[_0x19af('0x32')](function(_0x4bf4d2){if(_0x4bf4d2){return _0x4bf4d2['removeAgents'](_0x156b0f['query'][_0x19af('0x68')])[_0x19af('0x32')](function(){if(_[_0x19af('0xbe')](_0x156b0f[_0x19af('0x3f')][_0x19af('0x68')])){for(var _0x2aaf27=0x0;_0x2aaf27<_0x156b0f[_0x19af('0x3f')]['ids'][_0x19af('0x45')];_0x2aaf27+=0x1){socket[_0x19af('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x156b0f[_0x19af('0x3f')][_0x19af('0x68')][_0x2aaf27]),'FaxAccountId':Number(_0x156b0f[_0x19af('0x5e')]['id'])});}}else{socket[_0x19af('0xbf')](_0x19af('0xc0'),{'UserId':Number(_0x156b0f[_0x19af('0x3f')][_0x19af('0x68')]),'FaxAccountId':Number(_0x156b0f[_0x19af('0x5e')]['id'])});}});}})[_0x19af('0x32')](respondWithStatusCode(_0x4724d8,null))[_0x19af('0x24')](handleError(_0x4724d8,null));};exports['getAgents']=function(_0x1fcc4a,_0x49b461,_0x2a14a5){var _0x657b94={};var _0x5225a4={};var _0x394efd;var _0x1b8507;return db[_0x19af('0x4f')][_0x19af('0x64')]({'where':{'id':_0x1fcc4a[_0x19af('0x5e')]['id']}})[_0x19af('0x32')](handleEntityNotFound(_0x49b461,null))['then'](function(_0x2b5008){if(_0x2b5008){_0x394efd=_0x2b5008;_0x5225a4[_0x19af('0x42')]=_[_0x19af('0x40')](db['User'][_0x19af('0x3d')]);_0x5225a4[_0x19af('0x3f')]=_[_0x19af('0x40')](_0x1fcc4a['query']);_0x5225a4[_0x19af('0x49')]=_[_0x19af('0x41')](_0x5225a4[_0x19af('0x42')],_0x5225a4['query']);_0x657b94[_0x19af('0x44')]=_[_0x19af('0x41')](_0x5225a4[_0x19af('0x42')],qs[_0x19af('0x43')](_0x1fcc4a['query'][_0x19af('0x43')]));_0x657b94[_0x19af('0x44')]=_0x657b94[_0x19af('0x44')]['length']?_0x657b94['attributes']:_0x5225a4[_0x19af('0x42')];_0x657b94[_0x19af('0x65')]=qs['sort'](_0x1fcc4a[_0x19af('0x3f')][_0x19af('0x48')]);_0x657b94[_0x19af('0x4c')]=qs[_0x19af('0x49')](_['pick'](_0x1fcc4a['query'],_0x5225a4[_0x19af('0x49')]));if(_0x1fcc4a[_0x19af('0x3f')]['filter']){_0x657b94[_0x19af('0x4c')]=_[_0x19af('0x4d')](_0x657b94[_0x19af('0x4c')],{'$or':_[_0x19af('0x3c')](_0x657b94[_0x19af('0x44')],function(_0x5d2acf){var _0x54a73d={};_0x54a73d[_0x5d2acf]={'$like':'%'+_0x1fcc4a[_0x19af('0x3f')]['filter']+'%'};return _0x54a73d;})});}_0x657b94=_[_0x19af('0x4d')]({},_0x657b94,_0x1fcc4a[_0x19af('0x66')]);return _0x394efd[_0x19af('0xc1')](_0x657b94);}})[_0x19af('0x32')](function(_0x106c1f){if(_0x106c1f){_0x1b8507=_0x106c1f['length'];if(!_0x1fcc4a['query']['hasOwnProperty'](_0x19af('0x47'))){_0x657b94['limit']=qs[_0x19af('0x29')](_0x1fcc4a['query'][_0x19af('0x29')]);_0x657b94[_0x19af('0x2b')]=qs[_0x19af('0x2b')](_0x1fcc4a[_0x19af('0x3f')][_0x19af('0x2b')]);}return _0x394efd[_0x19af('0xc1')](_0x657b94);}})['then'](function(_0x3ddd4f){if(_0x3ddd4f){return _0x3ddd4f?{'count':_0x1b8507,'rows':_0x3ddd4f}:null;}})['then'](respondWithResult(_0x49b461,null))[_0x19af('0x24')](handleError(_0x49b461,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c361fcd..be02e2e 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 _0x7dff=['update','emit','hasOwnProperty','hook','exports','events','FaxAccount','save'];(function(_0x3bafe8,_0x496974){var _0x4d4ebf=function(_0x39fe36){while(--_0x39fe36){_0x3bafe8['push'](_0x3bafe8['shift']());}};_0x4d4ebf(++_0x496974);}(_0x7dff,0x75));var _0xf7df=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7dff[_0x13ea00];return _0x1f7347;};'use strict';var EventEmitter=require(_0xf7df('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xf7df('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7df('0x2'),'afterUpdate':_0xf7df('0x3'),'afterDestroy':'remove'};function emitEvent(_0x78853d){return function(_0xbbf1e3,_0x4c3fb8,_0x1848e2){FaxAccountEvents[_0xf7df('0x4')](_0x78853d+':'+_0xbbf1e3['id'],_0xbbf1e3);FaxAccountEvents[_0xf7df('0x4')](_0x78853d,_0xbbf1e3);_0x1848e2(null);};}for(var e in events){if(events[_0xf7df('0x5')](e)){var event=events[e];FaxAccount[_0xf7df('0x6')](e,emitEvent(event));}}module[_0xf7df('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x6e14=['exports','events','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x5a2975,_0x1377e5){var _0x45f435=function(_0x531cda){while(--_0x531cda){_0x5a2975['push'](_0x5a2975['shift']());}};_0x45f435(++_0x1377e5);}(_0x6e14,0x81));var _0x46e1=function(_0x126f42,_0x57f1ad){_0x126f42=_0x126f42-0x0;var _0x219119=_0x6e14[_0x126f42];return _0x219119;};'use strict';var EventEmitter=require(_0x46e1('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x46e1('0x1')](0x0);var events={'afterCreate':_0x46e1('0x2'),'afterUpdate':'update','afterDestroy':_0x46e1('0x3')};function emitEvent(_0x3f259b){return function(_0x38fd54,_0x5b842e,_0x425290){FaxAccountEvents[_0x46e1('0x4')](_0x3f259b+':'+_0x38fd54['id'],_0x38fd54);FaxAccountEvents[_0x46e1('0x4')](_0x3f259b,_0x38fd54);_0x425290(null);};}for(var e in events){if(events[_0x46e1('0x5')](e)){var event=events[e];FaxAccount[_0x46e1('0x6')](e,emitEvent(event));}}module[_0x46e1('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 0a89b3b..d44a241 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 _0x4bef=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5553f4,_0x97c641){var _0x588b61=function(_0x27ae89){while(--_0x27ae89){_0x5553f4['push'](_0x5553f4['shift']());}};_0x588b61(++_0x97c641);}(_0x4bef,0xa2));var _0xf4be=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4bef[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf4be('0x0'));var util=require(_0xf4be('0x1'));var logger=require(_0xf4be('0x2'))(_0xf4be('0x3'));var moment=require(_0xf4be('0x4'));var BPromise=require(_0xf4be('0x5'));var rp=require(_0xf4be('0x6'));var fs=require('fs');var path=require(_0xf4be('0x7'));var rimraf=require(_0xf4be('0x8'));var config=require(_0xf4be('0x9'));var attributes=require(_0xf4be('0xa'));module[_0xf4be('0xb')]=function(_0x153747,_0xc6a475){return _0x153747[_0xf4be('0xc')](_0xf4be('0xd'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52ca=['request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','moment'];(function(_0x32e919,_0x4fd27c){var _0x2fc4cb=function(_0x2058a7){while(--_0x2058a7){_0x32e919['push'](_0x32e919['shift']());}};_0x2fc4cb(++_0x4fd27c);}(_0x52ca,0xcd));var _0xa52c=function(_0x262ee0,_0x44ecaa){_0x262ee0=_0x262ee0-0x0;var _0x9eb331=_0x52ca[_0x262ee0];return _0x9eb331;};'use strict';var _=require(_0xa52c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa52c('0x1'));var BPromise=require('bluebird');var rp=require(_0xa52c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa52c('0x3'));var config=require(_0xa52c('0x4'));var attributes=require(_0xa52c('0x5'));module['exports']=function(_0x5a9ef9,_0x1e53bf){return _0x5a9ef9[_0xa52c('0x6')](_0xa52c('0x7'),attributes,{'tableName':_0xa52c('0x8'),'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 8a0dfbc..a498f2a 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 _0x1d1d=['message','result','catch','GetFaxAccount','options','raw','map','include','model','attributes','then','stringify','NotifyFaxAccount','fax','CmContact','describe','ValidationError','difference','keys','createdAt','updatedAt','ListId','body','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','CmList','List','Contacts','DESC','Applications','get','account','applications','orderBy','asc','length','from','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','created','interaction','create','ContactId','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5f41a9,_0x5347a8){var _0x4f68fb=function(_0x7cb0e9){while(--_0x7cb0e9){_0x5f41a9['push'](_0x5f41a9['shift']());}};_0x4f68fb(++_0x5347a8);}(_0x1d1d,0x8c));var _0xd1d1=function(_0x393788,_0x3492c4){_0x393788=_0x393788-0x0;var _0x3ca137=_0x1d1d[_0x393788];return _0x3ca137;};'use strict';var _=require(_0xd1d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd1d1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1d1('0x2'));var db=require(_0xd1d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1d1('0x4'))(_0xd1d1('0x5'));var config=require(_0xd1d1('0x6'));var jayson=require(_0xd1d1('0x7'));var client=jayson[_0xd1d1('0x8')][_0xd1d1('0x9')]({'port':0x232c});config[_0xd1d1('0xa')]=_[_0xd1d1('0xb')](config[_0xd1d1('0xa')],{'host':_0xd1d1('0xc'),'port':0x18eb});var socket=require(_0xd1d1('0xd'))(new Redis(config[_0xd1d1('0xa')]));require('./faxAccount.socket')[_0xd1d1('0xe')](socket);function respondWithRpcPromise(_0x5dacd5,_0x457e27,_0x1a0b70){return new BPromise(function(_0x1ac82e,_0x4cf237){return client[_0xd1d1('0xf')](_0x5dacd5,_0x1a0b70)['then'](function(_0x337f23){logger[_0xd1d1('0x10')](_0xd1d1('0x11'),_0x457e27,'request\x20sent');logger[_0xd1d1('0x12')](_0xd1d1('0x13'),_0x457e27,_0xd1d1('0x14'),JSON['stringify'](_0x337f23));if(_0x337f23[_0xd1d1('0x15')]){if(_0x337f23[_0xd1d1('0x15')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x457e27,_0x337f23[_0xd1d1('0x15')]['message']);return _0x4cf237(_0x337f23['error'][_0xd1d1('0x16')]);}logger[_0xd1d1('0x15')](_0xd1d1('0x11'),_0x457e27,_0x337f23[_0xd1d1('0x15')]['message']);return _0x1ac82e(_0x337f23[_0xd1d1('0x15')][_0xd1d1('0x16')]);}else{logger['info'](_0xd1d1('0x11'),_0x457e27,_0xd1d1('0x14'));_0x1ac82e(_0x337f23[_0xd1d1('0x17')]['message']);}})[_0xd1d1('0x18')](function(_0x1bf11e){logger[_0xd1d1('0x15')](_0xd1d1('0x11'),_0x457e27,_0x1bf11e);_0x4cf237(_0x1bf11e);});});}exports[_0xd1d1('0x19')]=function(_0x2b6189){var _0x1babaa=this;return new Promise(function(_0x14a341,_0x1d77cd){return db['FaxAccount']['findAll']({'raw':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')][_0xd1d1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['where']||null:null,'attributes':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['attributes']||null:null,'limit':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['limit']||null:null,'include':_0x2b6189[_0xd1d1('0x1a')]?_0x2b6189[_0xd1d1('0x1a')]['include']?_[_0xd1d1('0x1c')](_0x2b6189[_0xd1d1('0x1a')][_0xd1d1('0x1d')],function(_0x12c81c){return{'model':db[_0x12c81c[_0xd1d1('0x1e')]],'as':_0x12c81c['as'],'attributes':_0x12c81c[_0xd1d1('0x1f')],'include':_0x12c81c['include']?_[_0xd1d1('0x1c')](_0x12c81c[_0xd1d1('0x1d')],function(_0x24ce0b){return{'model':db[_0x24ce0b[_0xd1d1('0x1e')]],'as':_0x24ce0b['as'],'attributes':_0x24ce0b[_0xd1d1('0x1f')],'include':_0x24ce0b[_0xd1d1('0x1d')]?_[_0xd1d1('0x1c')](_0x24ce0b[_0xd1d1('0x1d')],function(_0x384a3a){return{'model':db[_0x384a3a[_0xd1d1('0x1e')]],'as':_0x384a3a['as'],'attributes':_0x384a3a[_0xd1d1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd1d1('0x20')](function(_0x14dba6){logger[_0xd1d1('0x10')](_0xd1d1('0x19'),_0x2b6189);logger[_0xd1d1('0x12')](_0xd1d1('0x19'),_0x2b6189,JSON[_0xd1d1('0x21')](_0x14dba6));_0x14a341(_0x14dba6);})[_0xd1d1('0x18')](function(_0x500e46){logger[_0xd1d1('0x15')](_0xd1d1('0x19'),_0x500e46[_0xd1d1('0x16')],_0x2b6189);_0x1d77cd(_0x1babaa[_0xd1d1('0x15')](0x1f4,_0x500e46[_0xd1d1('0x16')]));});});};exports[_0xd1d1('0x22')]=function(_0x236ab7,_0x320ca6,_0x300164){var _0x3e2acf=this;return new Promise(function(_0x28d7d8,_0x4f50fa){var _0x20db40={'body':_0x236ab7['body'],'channel':_0xd1d1('0x23')};var _0x288818=[];var _0x2a83c4=[];var _0x1c318d={};return db[_0xd1d1('0x24')][_0xd1d1('0x25')]()['then'](function(_0x171f1b){if(!_0x171f1b){throw new db['Sequelize'][(_0xd1d1('0x26'))]('no\x20available\x20attributes');}_0x288818=_[_0xd1d1('0x27')](_[_0xd1d1('0x28')](_0x171f1b),[_0xd1d1('0x29'),'updatedAt']);_0x2a83c4=_[_0xd1d1('0x27')](_[_0xd1d1('0x28')](_0x171f1b),[_0xd1d1('0x29'),_0xd1d1('0x2a'),'CompanyId',_0xd1d1('0x2b')]);if(_0x236ab7[_0xd1d1('0x2c')]['id']){delete _0x236ab7[_0xd1d1('0x2c')]['id'];}if(_[_0xd1d1('0x2d')](_0x236ab7[_0xd1d1('0x2c')]['from'])){throw new db[(_0xd1d1('0x2e'))][(_0xd1d1('0x26'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x236ab7['body'][_0xd1d1('0x2c')])||_0x236ab7[_0xd1d1('0x2c')]['body']===''){throw new db['Sequelize'][(_0xd1d1('0x26'))](_0xd1d1('0x2f'));}if(_['isNil'](_0x236ab7['body'][_0xd1d1('0x30')])){throw new db['Sequelize']['ValidationError'](_0xd1d1('0x31')+_0x2a83c4);}if(!_['includes'](_0x2a83c4,_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x30')])){throw new db['Sequelize'][(_0xd1d1('0x26'))](_0xd1d1('0x32')+_0x2a83c4);}_0x1c318d[_0x236ab7[_0xd1d1('0x2c')]['mapKey']]=_0x236ab7[_0xd1d1('0x2c')]['from'];})[_0xd1d1('0x20')](function(){return db[_0xd1d1('0x33')]['find']({'where':{'id':_0x236ab7['account']['id']},'include':[{'model':db[_0xd1d1('0x34')],'as':_0xd1d1('0x35'),'include':[{'model':db['CmContact'],'as':_0xd1d1('0x36'),'where':_0x1c318d,'limit':0x1,'order':[[_0xd1d1('0x2a'),_0xd1d1('0x37')]]}]},{'model':db['FaxApplication'],'as':_0xd1d1('0x38')}]});})[_0xd1d1('0x20')](function(_0x1a9dd7){if(_0x1a9dd7&&_0x1a9dd7['List']){var _0x14ce1f=_0x1a9dd7[_0xd1d1('0x39')]({'plain':!![]});_0x20db40[_0xd1d1('0x3a')]=_0x14ce1f;_0x20db40[_0xd1d1('0x3b')]=_0x14ce1f['Applications'];_0x20db40['list']=_0x14ce1f[_0xd1d1('0x35')];_0x20db40[_0xd1d1('0x3b')]=_[_0xd1d1('0x3c')](_0x20db40[_0xd1d1('0x3b')],['priority'],[_0xd1d1('0x3d')]);if(_0x20db40['account'][_0xd1d1('0x38')]){delete _0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x38')];}if(_0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x35')]&&_0x20db40['account']['List'][_0xd1d1('0x36')][_0xd1d1('0x3e')]){return _0x20db40['account']['List']['Contacts'][0x0];}var _0x39e239=_[_0xd1d1('0xb')](_0x236ab7[_0xd1d1('0x2c')],{'firstName':_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x3f')],'ListId':_0x14ce1f['ListId']});_0x39e239[_0x236ab7[_0xd1d1('0x2c')]['mapKey']]=_0x236ab7[_0xd1d1('0x2c')][_0xd1d1('0x3f')];return db['CmContact']['create'](_0x39e239,{'fields':_0x288818,'raw':!![]});}})['then'](function(_0xc88762){_0x20db40['contact']=_0xc88762;if(_0xc88762){var _0x496626={'ContactId':_0xc88762['id'],'FaxAccountId':_0x236ab7['account']['id'],'fax':_0xc88762[_0xd1d1('0x23')]};return db[_0xd1d1('0x40')][_0xd1d1('0x41')]({'where':{'ContactId':_0xc88762['id'],'closed':![],'FaxAccountId':_0x236ab7[_0xd1d1('0x3a')]['id']}})[_0xd1d1('0x20')](function(_0xcd0ebe){if(_0xcd0ebe){return[_0xcd0ebe,![]];}return db['FaxInteraction']['create'](_0x496626)[_0xd1d1('0x20')](function(_0x2cf228){return[_0x2cf228,!![]];});});}else{throw new Error(_0xd1d1('0x42'));}})[_0xd1d1('0x43')](function(_0x297d45,_0x15588d){var _0x1d39f6=_0x297d45[_0xd1d1('0x39')]({'plain':!![]});if(_0x15588d){if(_0x20db40['account'][_0xd1d1('0x44')]){_0x20db40[_0xd1d1('0x3b')]['push']({'id':0x0,'priority':_0x20db40[_0xd1d1('0x3b')][_0xd1d1('0x3e')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x1d39f6['created']=!![];}else{_0x1d39f6[_0xd1d1('0x45')]=![];}_0x20db40[_0xd1d1('0x46')]=_0x1d39f6;return db['FaxMessage'][_0xd1d1('0x47')]({'body':_0x236ab7['body'][_0xd1d1('0x2c')],'FaxAccountId':_0x236ab7[_0xd1d1('0x3a')]['id'],'FaxInteractionId':_0x297d45['id'],'direction':'in','ContactId':_0x297d45[_0xd1d1('0x48')],'AttachmentId':_0x236ab7[_0xd1d1('0x2c')]['AttachmentId']});})[_0xd1d1('0x20')](function(_0x2e238d){_0x20db40[_0xd1d1('0x16')]=_0x2e238d;if(_0x20db40[_0xd1d1('0x46')][_0xd1d1('0x49')]){return db[_0xd1d1('0x4a')][_0xd1d1('0x41')]({'attributes':['id',_0xd1d1('0x4b')],'where':{'id':_0x20db40['interaction'][_0xd1d1('0x49')]}})[_0xd1d1('0x20')](function(_0x98717f){if(_0x98717f){_0x20db40[_0xd1d1('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd1d1('0x4c'),'appdata':_0x98717f[_0xd1d1('0x4b')]+','+(_0x20db40[_0xd1d1('0x3a')][_0xd1d1('0x4d')]||0xa),'interval':_0xd1d1('0x4e')});}return respondWithRpcPromise(_0xd1d1('0x4f'),'startRouting',_0x20db40);});}return respondWithRpcPromise(_0xd1d1('0x4f'),_0xd1d1('0x50'),_0x20db40);})[_0xd1d1('0x20')](function(_0x55545f){_0x28d7d8(_0x55545f);})['catch'](function(_0x2fd6c4){_0x4f50fa(_0x3e2acf[_0xd1d1('0x15')](0x1f4,_0x2fd6c4[_0xd1d1('0x16')]));});});}; \ No newline at end of file +var _0xf997=['difference','keys','createdAt','updatedAt','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','DESC','FaxApplication','Applications','list','applications','orderBy','asc','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','created','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','map','model','body','CmContact','describe','Sequelize','ValidationError'];(function(_0x2f3546,_0x369370){var _0x581f3e=function(_0x23fecd){while(--_0x23fecd){_0x2f3546['push'](_0x2f3546['shift']());}};_0x581f3e(++_0x369370);}(_0xf997,0x80));var _0x7f99=function(_0x49adeb,_0x34dfa0){_0x49adeb=_0x49adeb-0x0;var _0x503fda=_0xf997[_0x49adeb];return _0x503fda;};'use strict';var _=require('lodash');var util=require(_0x7f99('0x0'));var moment=require(_0x7f99('0x1'));var BPromise=require(_0x7f99('0x2'));var rs=require(_0x7f99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f99('0x4'))['db'];var utils=require(_0x7f99('0x5'));var logger=require(_0x7f99('0x6'))(_0x7f99('0x7'));var config=require(_0x7f99('0x8'));var jayson=require(_0x7f99('0x9'));var client=jayson[_0x7f99('0xa')][_0x7f99('0xb')]({'port':0x232c});config[_0x7f99('0xc')]=_[_0x7f99('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f99('0xc')]));require(_0x7f99('0xe'))[_0x7f99('0xf')](socket);function respondWithRpcPromise(_0xc6107a,_0x7f7ea4,_0x3e0ba3){return new BPromise(function(_0x103767,_0x3cfe31){return client[_0x7f99('0x10')](_0xc6107a,_0x3e0ba3)[_0x7f99('0x11')](function(_0x5bd3fb){logger[_0x7f99('0x12')](_0x7f99('0x13'),_0x7f7ea4,'request\x20sent');logger[_0x7f99('0x14')](_0x7f99('0x15'),_0x7f7ea4,'request\x20sent',JSON[_0x7f99('0x16')](_0x5bd3fb));if(_0x5bd3fb[_0x7f99('0x17')]){if(_0x5bd3fb[_0x7f99('0x17')][_0x7f99('0x18')]===0x1f4){logger[_0x7f99('0x17')](_0x7f99('0x13'),_0x7f7ea4,_0x5bd3fb[_0x7f99('0x17')][_0x7f99('0x19')]);return _0x3cfe31(_0x5bd3fb[_0x7f99('0x17')][_0x7f99('0x19')]);}logger[_0x7f99('0x17')](_0x7f99('0x13'),_0x7f7ea4,_0x5bd3fb[_0x7f99('0x17')][_0x7f99('0x19')]);return _0x103767(_0x5bd3fb[_0x7f99('0x17')][_0x7f99('0x19')]);}else{logger[_0x7f99('0x12')](_0x7f99('0x13'),_0x7f7ea4,_0x7f99('0x1a'));_0x103767(_0x5bd3fb[_0x7f99('0x1b')][_0x7f99('0x19')]);}})[_0x7f99('0x1c')](function(_0x1ae0ba){logger[_0x7f99('0x17')](_0x7f99('0x13'),_0x7f7ea4,_0x1ae0ba);_0x3cfe31(_0x1ae0ba);});});}exports[_0x7f99('0x1d')]=function(_0x86219){var _0x429683=this;return new Promise(function(_0x27c563,_0x1dcbee){return db[_0x7f99('0x1e')][_0x7f99('0x1f')]({'raw':_0x86219[_0x7f99('0x20')]?_0x86219['options'][_0x7f99('0x21')]===undefined?!![]:![]:!![],'where':_0x86219[_0x7f99('0x20')]?_0x86219[_0x7f99('0x20')][_0x7f99('0x22')]||null:null,'attributes':_0x86219[_0x7f99('0x20')]?_0x86219[_0x7f99('0x20')][_0x7f99('0x23')]||null:null,'limit':_0x86219[_0x7f99('0x20')]?_0x86219[_0x7f99('0x20')]['limit']||null:null,'include':_0x86219['options']?_0x86219[_0x7f99('0x20')][_0x7f99('0x24')]?_[_0x7f99('0x25')](_0x86219['options'][_0x7f99('0x24')],function(_0x384f71){return{'model':db[_0x384f71['model']],'as':_0x384f71['as'],'attributes':_0x384f71[_0x7f99('0x23')],'include':_0x384f71[_0x7f99('0x24')]?_[_0x7f99('0x25')](_0x384f71[_0x7f99('0x24')],function(_0x3a9d1a){return{'model':db[_0x3a9d1a[_0x7f99('0x26')]],'as':_0x3a9d1a['as'],'attributes':_0x3a9d1a[_0x7f99('0x23')],'include':_0x3a9d1a[_0x7f99('0x24')]?_[_0x7f99('0x25')](_0x3a9d1a[_0x7f99('0x24')],function(_0x1f39ef){return{'model':db[_0x1f39ef[_0x7f99('0x26')]],'as':_0x1f39ef['as'],'attributes':_0x1f39ef[_0x7f99('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7f99('0x11')](function(_0x309c0c){logger['info'](_0x7f99('0x1d'),_0x86219);logger[_0x7f99('0x14')]('GetFaxAccount',_0x86219,JSON[_0x7f99('0x16')](_0x309c0c));_0x27c563(_0x309c0c);})[_0x7f99('0x1c')](function(_0x534d89){logger[_0x7f99('0x17')](_0x7f99('0x1d'),_0x534d89[_0x7f99('0x19')],_0x86219);_0x1dcbee(_0x429683[_0x7f99('0x17')](0x1f4,_0x534d89[_0x7f99('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x4dd0e4,_0x2223fb,_0x57cd89){var _0x50850f=this;return new Promise(function(_0x5172ab,_0x38cdb3){var _0x80c0d6={'body':_0x4dd0e4[_0x7f99('0x27')],'channel':'fax'};var _0x65fd70=[];var _0x33d9fe=[];var _0x41c9cf={};return db[_0x7f99('0x28')][_0x7f99('0x29')]()[_0x7f99('0x11')](function(_0x8fc20f){if(!_0x8fc20f){throw new db[(_0x7f99('0x2a'))][(_0x7f99('0x2b'))]('no\x20available\x20attributes');}_0x65fd70=_[_0x7f99('0x2c')](_[_0x7f99('0x2d')](_0x8fc20f),[_0x7f99('0x2e'),'updatedAt']);_0x33d9fe=_[_0x7f99('0x2c')](_[_0x7f99('0x2d')](_0x8fc20f),[_0x7f99('0x2e'),_0x7f99('0x2f'),'CompanyId',_0x7f99('0x30')]);if(_0x4dd0e4[_0x7f99('0x27')]['id']){delete _0x4dd0e4[_0x7f99('0x27')]['id'];}if(_[_0x7f99('0x31')](_0x4dd0e4[_0x7f99('0x27')][_0x7f99('0x32')])){throw new db['Sequelize'][(_0x7f99('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x7f99('0x31')](_0x4dd0e4['body'][_0x7f99('0x27')])||_0x4dd0e4[_0x7f99('0x27')][_0x7f99('0x27')]===''){throw new db['Sequelize'][(_0x7f99('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7f99('0x31')](_0x4dd0e4[_0x7f99('0x27')][_0x7f99('0x33')])){throw new db[(_0x7f99('0x2a'))][(_0x7f99('0x2b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33d9fe);}if(!_[_0x7f99('0x34')](_0x33d9fe,_0x4dd0e4[_0x7f99('0x27')][_0x7f99('0x33')])){throw new db[(_0x7f99('0x2a'))][(_0x7f99('0x2b'))](_0x7f99('0x35')+_0x33d9fe);}_0x41c9cf[_0x4dd0e4[_0x7f99('0x27')]['mapKey']]=_0x4dd0e4['body'][_0x7f99('0x32')];})[_0x7f99('0x11')](function(){return db['FaxAccount'][_0x7f99('0x36')]({'where':{'id':_0x4dd0e4[_0x7f99('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x7f99('0x38'),'include':[{'model':db[_0x7f99('0x28')],'as':'Contacts','where':_0x41c9cf,'limit':0x1,'order':[['updatedAt',_0x7f99('0x39')]]}]},{'model':db[_0x7f99('0x3a')],'as':_0x7f99('0x3b')}]});})['then'](function(_0x1a62f5){if(_0x1a62f5&&_0x1a62f5[_0x7f99('0x38')]){var _0x391e42=_0x1a62f5['get']({'plain':!![]});_0x80c0d6[_0x7f99('0x37')]=_0x391e42;_0x80c0d6['applications']=_0x391e42[_0x7f99('0x3b')];_0x80c0d6[_0x7f99('0x3c')]=_0x391e42[_0x7f99('0x38')];_0x80c0d6[_0x7f99('0x3d')]=_[_0x7f99('0x3e')](_0x80c0d6[_0x7f99('0x3d')],['priority'],[_0x7f99('0x3f')]);if(_0x80c0d6[_0x7f99('0x37')][_0x7f99('0x3b')]){delete _0x80c0d6['account']['Applications'];}if(_0x80c0d6['account'][_0x7f99('0x38')]&&_0x80c0d6['account']['List'][_0x7f99('0x40')]['length']){return _0x80c0d6['account'][_0x7f99('0x38')][_0x7f99('0x40')][0x0];}var _0x317ee0=_[_0x7f99('0xd')](_0x4dd0e4[_0x7f99('0x27')],{'firstName':_0x4dd0e4['body'][_0x7f99('0x32')],'ListId':_0x391e42[_0x7f99('0x30')]});_0x317ee0[_0x4dd0e4[_0x7f99('0x27')][_0x7f99('0x33')]]=_0x4dd0e4['body']['from'];return db[_0x7f99('0x28')][_0x7f99('0x41')](_0x317ee0,{'fields':_0x65fd70,'raw':!![]});}})[_0x7f99('0x11')](function(_0x20ffc1){_0x80c0d6[_0x7f99('0x42')]=_0x20ffc1;if(_0x20ffc1){var _0x33a9eb={'ContactId':_0x20ffc1['id'],'FaxAccountId':_0x4dd0e4[_0x7f99('0x37')]['id'],'fax':_0x20ffc1['fax']};return db[_0x7f99('0x43')][_0x7f99('0x36')]({'where':{'ContactId':_0x20ffc1['id'],'closed':![],'FaxAccountId':_0x4dd0e4[_0x7f99('0x37')]['id']}})[_0x7f99('0x11')](function(_0x2f8398){if(_0x2f8398){return[_0x2f8398,![]];}return db[_0x7f99('0x43')][_0x7f99('0x41')](_0x33a9eb)[_0x7f99('0x11')](function(_0x4c3c9e){return[_0x4c3c9e,!![]];});});}else{throw new Error(_0x7f99('0x44'));}})[_0x7f99('0x45')](function(_0x391f0e,_0x32997a){var _0x71575a=_0x391f0e['get']({'plain':!![]});if(_0x32997a){if(_0x80c0d6[_0x7f99('0x37')][_0x7f99('0x46')]){_0x80c0d6['applications']['push']({'id':0x0,'priority':_0x80c0d6['applications'][_0x7f99('0x47')]+0x1,'app':_0x7f99('0x48'),'appdata':_0x7f99('0x49'),'interval':'*,*,*,*'});}_0x71575a['created']=!![];}else{_0x71575a[_0x7f99('0x4a')]=![];}_0x80c0d6['interaction']=_0x71575a;return db['FaxMessage'][_0x7f99('0x41')]({'body':_0x4dd0e4[_0x7f99('0x27')]['body'],'FaxAccountId':_0x4dd0e4[_0x7f99('0x37')]['id'],'FaxInteractionId':_0x391f0e['id'],'direction':'in','ContactId':_0x391f0e[_0x7f99('0x4b')],'AttachmentId':_0x4dd0e4['body'][_0x7f99('0x4c')]});})[_0x7f99('0x11')](function(_0x1bfe1f){_0x80c0d6[_0x7f99('0x19')]=_0x1bfe1f;if(_0x80c0d6[_0x7f99('0x4d')][_0x7f99('0x4e')]){return db[_0x7f99('0x4f')][_0x7f99('0x36')]({'attributes':['id','name'],'where':{'id':_0x80c0d6[_0x7f99('0x4d')][_0x7f99('0x4e')]}})[_0x7f99('0x11')](function(_0x1f8622){if(_0x1f8622){_0x80c0d6[_0x7f99('0x3d')][_0x7f99('0x50')]({'id':0x0,'priority':0x0,'app':_0x7f99('0x51'),'appdata':_0x1f8622[_0x7f99('0x52')]+','+(_0x80c0d6['account']['waitForTheAssignedAgent']||0xa),'interval':_0x7f99('0x53')});}return respondWithRpcPromise(_0x7f99('0x54'),_0x7f99('0x55'),_0x80c0d6);});}return respondWithRpcPromise('Start',_0x7f99('0x55'),_0x80c0d6);})[_0x7f99('0x11')](function(_0x53d5ab){_0x5172ab(_0x53d5ab);})[_0x7f99('0x1c')](function(_0x56aecd){_0x38cdb3(_0x50850f[_0x7f99('0x17')](0x1f4,_0x56aecd[_0x7f99('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6c90351..d97e188 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 _0xc5c0=['update','emit','removeListener','register','./faxAccount.events','remove'];(function(_0x3a8376,_0x3a22eb){var _0x3f8326=function(_0x1a5a6b){while(--_0x1a5a6b){_0x3a8376['push'](_0x3a8376['shift']());}};_0x3f8326(++_0x3a22eb);}(_0xc5c0,0x94));var _0x0c5c=function(_0x1e7a82,_0x2d7f5d){_0x1e7a82=_0x1e7a82-0x0;var _0x2a4b67=_0xc5c0[_0x1e7a82];return _0x2a4b67;};'use strict';var FaxAccountEvents=require(_0x0c5c('0x0'));var events=['save',_0x0c5c('0x1'),_0x0c5c('0x2')];function createListener(_0x556851,_0x2b4e0){return function(_0xf7a7ab){_0x2b4e0[_0x0c5c('0x3')](_0x556851,_0xf7a7ab);};}function removeListener(_0x3f1545,_0x5e7650){return function(){FaxAccountEvents[_0x0c5c('0x4')](_0x3f1545,_0x5e7650);};}exports[_0x0c5c('0x5')]=function(_0xb252a1){for(var _0x2c756f=0x0,_0x1b35ab=events['length'];_0x2c756f<_0x1b35ab;_0x2c756f++){var _0x547d47=events[_0x2c756f];var _0x3cd9a5=createListener('faxAccount:'+_0x547d47,_0xb252a1);FaxAccountEvents['on'](_0x547d47,_0x3cd9a5);}}; \ No newline at end of file +var _0x3c97=['emit','removeListener','faxAccount:','./faxAccount.events','save'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x3c97,0x143));var _0x73c9=function(_0x574064,_0x367d9e){_0x574064=_0x574064-0x0;var _0x2edf68=_0x3c97[_0x574064];return _0x2edf68;};'use strict';var FaxAccountEvents=require(_0x73c9('0x0'));var events=[_0x73c9('0x1'),'remove','update'];function createListener(_0x62ca67,_0x2ea104){return function(_0x58fa16){_0x2ea104[_0x73c9('0x2')](_0x62ca67,_0x58fa16);};}function removeListener(_0x1efa7a,_0x5e0579){return function(){FaxAccountEvents[_0x73c9('0x3')](_0x1efa7a,_0x5e0579);};}exports['register']=function(_0x578790){for(var _0x19addf=0x0,_0x1a5d0e=events['length'];_0x19addf<_0x1a5d0e;_0x19addf++){var _0x2efc14=events[_0x19addf];var _0x1bad17=createListener(_0x73c9('0x4')+_0x2efc14,_0x578790);FaxAccountEvents['on'](_0x2efc14,_0x1bad17);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index adac86a..a5dd941 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(_0x5e4730,_0x28dfcc){var _0x20fc9b=function(_0x526217){while(--_0x526217){_0x5e4730['push'](_0x5e4730['shift']());}};_0x20fc9b(++_0x28dfcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x1e036f,_0x206c49){var _0x59bf22=function(_0x418524){while(--_0x418524){_0x1e036f['push'](_0x1e036f['shift']());}};_0x59bf22(++_0x206c49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 5ee1e87..5318041 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 _0x48f1=['TEXT','INTEGER','STRING','noop'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x48f1,0x14d));var _0x148f=function(_0xeb7580,_0x5cda92){_0xeb7580=_0xeb7580-0x0;var _0x3b53d3=_0x48f1[_0xeb7580];return _0x3b53d3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x148f('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x148f('0x1')],'allowNull':![],'defaultValue':_0x148f('0x2')},'appdata':{'type':Sequelize[_0x148f('0x3')]()},'description':{'type':Sequelize[_0x148f('0x1')]},'interval':{'type':Sequelize[_0x148f('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd4b5=['sequelize','exports','INTEGER','TEXT','STRING'];(function(_0x3110ef,_0xe67962){var _0xf9fdfd=function(_0x12e3fc){while(--_0x12e3fc){_0x3110ef['push'](_0x3110ef['shift']());}};_0xf9fdfd(++_0xe67962);}(_0xd4b5,0xb9));var _0x5d4b=function(_0x589248,_0x31dea3){_0x589248=_0x589248-0x0;var _0x486750=_0xd4b5[_0x589248];return _0x486750;};'use strict';var Sequelize=require(_0x5d4b('0x0'));module[_0x5d4b('0x1')]={'priority':{'type':Sequelize[_0x5d4b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5d4b('0x3')]()},'description':{'type':Sequelize[_0x5d4b('0x4')]},'interval':{'type':Sequelize[_0x5d4b('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index c8eb4d5..4e1f2f5 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 _0x0c04=['lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','json','offset','limit','undefined','count','status','set','reject','save','update','then','destroy','error','stack','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','params','keys','intersection','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4de31f,_0x5118c4){var _0x2477d3=function(_0x324ab2){while(--_0x324ab2){_0x4de31f['push'](_0x4de31f['shift']());}};_0x2477d3(++_0x5118c4);}(_0x0c04,0x82));var _0x40c0=function(_0x1907bf,_0x57778c){_0x1907bf=_0x1907bf-0x0;var _0x464f6f=_0x0c04[_0x1907bf];return _0x464f6f;};'use strict';var emlformat=require(_0x40c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x40c0('0x1'));var jsonpatch=require(_0x40c0('0x2'));var rp=require('request-promise');var moment=require(_0x40c0('0x3'));var BPromise=require(_0x40c0('0x4'));var Mustache=require(_0x40c0('0x5'));var util=require(_0x40c0('0x6'));var path=require(_0x40c0('0x7'));var sox=require(_0x40c0('0x8'));var csv=require(_0x40c0('0x9'));var ejs=require(_0x40c0('0xa'));var fs=require('fs');var fs_extra=require(_0x40c0('0xb'));var _=require(_0x40c0('0xc'));var squel=require('squel');var crypto=require(_0x40c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40c0('0xf'));var Papa=require(_0x40c0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x40c0('0x11'));var hardwareService=require(_0x40c0('0x12'));var logger=require(_0x40c0('0x13'))(_0x40c0('0x14'));var utils=require(_0x40c0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x40c0('0x16'))['db'];function respondWithStatusCode(_0x2430bd,_0x54fc23){_0x54fc23=_0x54fc23||0xcc;return function(_0x2a1aef){if(_0x2a1aef){return _0x2430bd['sendStatus'](_0x54fc23);}return _0x2430bd['status'](_0x54fc23)[_0x40c0('0x17')]();};}function respondWithResult(_0x39aba7,_0x2f8414){_0x2f8414=_0x2f8414||0xc8;return function(_0x1164a5){if(_0x1164a5){return _0x39aba7['status'](_0x2f8414)[_0x40c0('0x18')](_0x1164a5);}};}function respondWithFilteredResult(_0x3c1b3b,_0x2de64c){return function(_0x3abddb){if(_0x3abddb){var _0x680fea=typeof _0x2de64c[_0x40c0('0x19')]==='undefined'&&typeof _0x2de64c[_0x40c0('0x1a')]===_0x40c0('0x1b');var _0x32a505=_0x3abddb[_0x40c0('0x1c')];var _0x38fd51=_0x680fea?0x0:_0x2de64c['offset'];var _0x29760a=_0x680fea?_0x3abddb['count']:_0x2de64c[_0x40c0('0x19')]+_0x2de64c[_0x40c0('0x1a')];var _0x521f58;if(_0x29760a>=_0x32a505){_0x29760a=_0x32a505;_0x521f58=0xc8;}else{_0x521f58=0xce;}_0x3c1b3b[_0x40c0('0x1d')](_0x521f58);return _0x3c1b3b[_0x40c0('0x1e')]('Content-Range',_0x38fd51+'-'+_0x29760a+'/'+_0x32a505)['json'](_0x3abddb);}return null;};}function patchUpdates(_0x5dd609){return function(_0x51ae26){try{jsonpatch['apply'](_0x51ae26,_0x5dd609,!![]);}catch(_0xc722e0){return BPromise[_0x40c0('0x1f')](_0xc722e0);}return _0x51ae26[_0x40c0('0x20')]();};}function saveUpdates(_0x3b3788,_0x19fe85){return function(_0x5eb5c3){if(_0x5eb5c3){return _0x5eb5c3[_0x40c0('0x21')](_0x3b3788)[_0x40c0('0x22')](function(_0x1034bb){return _0x1034bb;});}return null;};}function removeEntity(_0x180128,_0x2adabe){return function(_0x49a3db){if(_0x49a3db){return _0x49a3db[_0x40c0('0x23')]()[_0x40c0('0x22')](function(){_0x180128[_0x40c0('0x1d')](0xcc)[_0x40c0('0x17')]();});}};}function handleEntityNotFound(_0x498a1c,_0x301e2b){return function(_0x382a16){if(!_0x382a16){_0x498a1c['sendStatus'](0x194);}return _0x382a16;};}function handleError(_0x1fa716,_0x3d6c6f){_0x3d6c6f=_0x3d6c6f||0x1f4;return function(_0x4d2549){logger[_0x40c0('0x24')](_0x4d2549[_0x40c0('0x25')]);if(_0x4d2549['name']){delete _0x4d2549['name'];}_0x1fa716[_0x40c0('0x1d')](_0x3d6c6f)[_0x40c0('0x26')](_0x4d2549);};}exports[_0x40c0('0x27')]=function(_0xe56d8a,_0x49ca1c){var _0x454ebc={},_0x18c815={},_0xae5d8e={'count':0x0,'rows':[]};var _0x73a34d=_[_0x40c0('0x28')](db[_0x40c0('0x29')][_0x40c0('0x2a')],function(_0x3c4267){return{'name':_0x3c4267[_0x40c0('0x2b')],'type':_0x3c4267[_0x40c0('0x2c')][_0x40c0('0x2d')]};});_0x18c815[_0x40c0('0x2e')]=_['map'](_0x73a34d,_0x40c0('0x2f'));_0x18c815[_0x40c0('0x30')]=_['keys'](_0xe56d8a[_0x40c0('0x30')]);_0x18c815[_0x40c0('0x31')]=_['intersection'](_0x18c815[_0x40c0('0x2e')],_0x18c815[_0x40c0('0x30')]);_0x454ebc[_0x40c0('0x32')]=_['intersection'](_0x18c815[_0x40c0('0x2e')],qs[_0x40c0('0x33')](_0xe56d8a['query'][_0x40c0('0x33')]));_0x454ebc['attributes']=_0x454ebc[_0x40c0('0x32')][_0x40c0('0x34')]?_0x454ebc['attributes']:_0x18c815['model'];if(!_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x35')](_0x40c0('0x36'))){_0x454ebc[_0x40c0('0x1a')]=qs[_0x40c0('0x1a')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x1a')]);_0x454ebc['offset']=qs[_0x40c0('0x19')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x19')]);}_0x454ebc[_0x40c0('0x37')]=qs[_0x40c0('0x38')](_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x38')]);_0x454ebc[_0x40c0('0x39')]=qs[_0x40c0('0x31')](_[_0x40c0('0x3a')](_0xe56d8a[_0x40c0('0x30')],_0x18c815[_0x40c0('0x31')]),_0x73a34d);if(_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x3b')]){_0x454ebc[_0x40c0('0x39')]=_[_0x40c0('0x3c')](_0x454ebc['where'],{'$or':_[_0x40c0('0x28')](_0x73a34d,function(_0x124f00){if(_0x124f00[_0x40c0('0x2c')]!=='VIRTUAL'){var _0x51c507={};_0x51c507[_0x124f00[_0x40c0('0x2f')]]={'$like':'%'+_0xe56d8a['query'][_0x40c0('0x3b')]+'%'};return _0x51c507;}})});}_0x454ebc=_[_0x40c0('0x3c')]({},_0x454ebc,_0xe56d8a['options']);var _0x3c073={'where':_0x454ebc[_0x40c0('0x39')]};return db[_0x40c0('0x29')]['count'](_0x3c073)[_0x40c0('0x22')](function(_0x40db81){_0xae5d8e[_0x40c0('0x1c')]=_0x40db81;if(_0xe56d8a[_0x40c0('0x30')][_0x40c0('0x3d')]){_0x454ebc[_0x40c0('0x3e')]=[{'all':!![]}];}return db[_0x40c0('0x29')]['findAll'](_0x454ebc);})[_0x40c0('0x22')](function(_0x233240){_0xae5d8e[_0x40c0('0x3f')]=_0x233240;return _0xae5d8e;})[_0x40c0('0x22')](respondWithFilteredResult(_0x49ca1c,_0x454ebc))[_0x40c0('0x40')](handleError(_0x49ca1c,null));};exports['show']=function(_0x2a91ba,_0x5135cc){var _0x9ed6ba={'raw':!![],'where':{'id':_0x2a91ba[_0x40c0('0x41')]['id']}},_0x19373b={};_0x19373b['model']=_['keys'](db[_0x40c0('0x29')][_0x40c0('0x2a')]);_0x19373b['query']=_[_0x40c0('0x42')](_0x2a91ba[_0x40c0('0x30')]);_0x19373b[_0x40c0('0x31')]=_[_0x40c0('0x43')](_0x19373b[_0x40c0('0x2e')],_0x19373b['query']);_0x9ed6ba['attributes']=_['intersection'](_0x19373b[_0x40c0('0x2e')],qs['fields'](_0x2a91ba[_0x40c0('0x30')][_0x40c0('0x33')]));_0x9ed6ba[_0x40c0('0x32')]=_0x9ed6ba[_0x40c0('0x32')][_0x40c0('0x34')]?_0x9ed6ba[_0x40c0('0x32')]:_0x19373b['model'];if(_0x2a91ba['query'][_0x40c0('0x3d')]){_0x9ed6ba[_0x40c0('0x3e')]=[{'all':!![]}];}_0x9ed6ba=_[_0x40c0('0x3c')]({},_0x9ed6ba,_0x2a91ba['options']);return db['FaxApplication']['find'](_0x9ed6ba)[_0x40c0('0x22')](handleEntityNotFound(_0x5135cc,null))[_0x40c0('0x22')](respondWithResult(_0x5135cc,null))[_0x40c0('0x40')](handleError(_0x5135cc,null));};exports[_0x40c0('0x44')]=function(_0x179d53,_0x26199e){return db[_0x40c0('0x29')][_0x40c0('0x44')](_0x179d53[_0x40c0('0x45')],{})[_0x40c0('0x22')](respondWithResult(_0x26199e,0xc9))['catch'](handleError(_0x26199e,null));};exports[_0x40c0('0x21')]=function(_0xa05024,_0x1f2a52){if(_0xa05024[_0x40c0('0x45')]['id']){delete _0xa05024[_0x40c0('0x45')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0xa05024['params']['id']}})[_0x40c0('0x22')](handleEntityNotFound(_0x1f2a52,null))[_0x40c0('0x22')](saveUpdates(_0xa05024[_0x40c0('0x45')],null))[_0x40c0('0x22')](respondWithResult(_0x1f2a52,null))[_0x40c0('0x40')](handleError(_0x1f2a52,null));};exports['destroy']=function(_0x13510f,_0x27eff4){return db[_0x40c0('0x29')][_0x40c0('0x46')]({'where':{'id':_0x13510f[_0x40c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x27eff4,null))[_0x40c0('0x22')](removeEntity(_0x27eff4,null))[_0x40c0('0x40')](handleError(_0x27eff4,null));}; \ No newline at end of file +var _0xf686=['create','body','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','update','then','destroy','end','error','stack','name','index','FaxApplication','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','show','params','keys','find','catch'];(function(_0x5da01c,_0x53bf77){var _0x1216c2=function(_0x1d8513){while(--_0x1d8513){_0x5da01c['push'](_0x5da01c['shift']());}};_0x1216c2(++_0x53bf77);}(_0xf686,0x8c));var _0x6f68=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf686[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f68('0x1'));var BPromise=require(_0x6f68('0x2'));var Mustache=require(_0x6f68('0x3'));var util=require(_0x6f68('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6f68('0x5'));var ejs=require(_0x6f68('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f68('0x7'));var crypto=require(_0x6f68('0x8'));var jsforce=require(_0x6f68('0x9'));var deskjs=require(_0x6f68('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f68('0xb'));var Redis=require(_0x6f68('0xc'));var authService=require(_0x6f68('0xd'));var qs=require(_0x6f68('0xe'));var as=require(_0x6f68('0xf'));var hardwareService=require(_0x6f68('0x10'));var logger=require(_0x6f68('0x11'))(_0x6f68('0x12'));var utils=require(_0x6f68('0x13'));var config=require(_0x6f68('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f68('0x15'))['db'];function respondWithStatusCode(_0x44d143,_0x130a46){_0x130a46=_0x130a46||0xcc;return function(_0xd2fc48){if(_0xd2fc48){return _0x44d143[_0x6f68('0x16')](_0x130a46);}return _0x44d143[_0x6f68('0x17')](_0x130a46)['end']();};}function respondWithResult(_0x5e0e54,_0x40dc79){_0x40dc79=_0x40dc79||0xc8;return function(_0x22bb08){if(_0x22bb08){return _0x5e0e54['status'](_0x40dc79)['json'](_0x22bb08);}};}function respondWithFilteredResult(_0xbf4ea2,_0x498e48){return function(_0x4f2a60){if(_0x4f2a60){var _0x1d9bc8=typeof _0x498e48[_0x6f68('0x18')]==='undefined'&&typeof _0x498e48[_0x6f68('0x19')]===_0x6f68('0x1a');var _0x505500=_0x4f2a60[_0x6f68('0x1b')];var _0x34b78d=_0x1d9bc8?0x0:_0x498e48[_0x6f68('0x18')];var _0x6f0427=_0x1d9bc8?_0x4f2a60['count']:_0x498e48['offset']+_0x498e48[_0x6f68('0x19')];var _0x115013;if(_0x6f0427>=_0x505500){_0x6f0427=_0x505500;_0x115013=0xc8;}else{_0x115013=0xce;}_0xbf4ea2[_0x6f68('0x17')](_0x115013);return _0xbf4ea2[_0x6f68('0x1c')]('Content-Range',_0x34b78d+'-'+_0x6f0427+'/'+_0x505500)[_0x6f68('0x1d')](_0x4f2a60);}return null;};}function patchUpdates(_0x448632){return function(_0xc77735){try{jsonpatch[_0x6f68('0x1e')](_0xc77735,_0x448632,!![]);}catch(_0x2d4a73){return BPromise['reject'](_0x2d4a73);}return _0xc77735['save']();};}function saveUpdates(_0x498c7f,_0x43f1ab){return function(_0x39acd7){if(_0x39acd7){return _0x39acd7[_0x6f68('0x1f')](_0x498c7f)[_0x6f68('0x20')](function(_0x239dcd){return _0x239dcd;});}return null;};}function removeEntity(_0x754c33,_0x42f4ac){return function(_0x5648af){if(_0x5648af){return _0x5648af[_0x6f68('0x21')]()[_0x6f68('0x20')](function(){_0x754c33[_0x6f68('0x17')](0xcc)[_0x6f68('0x22')]();});}};}function handleEntityNotFound(_0x1d466b,_0x4b5364){return function(_0x569b86){if(!_0x569b86){_0x1d466b[_0x6f68('0x16')](0x194);}return _0x569b86;};}function handleError(_0x5f1c26,_0x554272){_0x554272=_0x554272||0x1f4;return function(_0x533750){logger[_0x6f68('0x23')](_0x533750[_0x6f68('0x24')]);if(_0x533750[_0x6f68('0x25')]){delete _0x533750[_0x6f68('0x25')];}_0x5f1c26['status'](_0x554272)['send'](_0x533750);};}exports[_0x6f68('0x26')]=function(_0x3513cf,_0x1c0fb2){var _0xa36e70={},_0x2b186a={},_0x4d8f02={'count':0x0,'rows':[]};var _0x42900f=_['map'](db[_0x6f68('0x27')][_0x6f68('0x28')],function(_0x7bd3e0){return{'name':_0x7bd3e0[_0x6f68('0x29')],'type':_0x7bd3e0['type'][_0x6f68('0x2a')]};});_0x2b186a[_0x6f68('0x2b')]=_[_0x6f68('0x2c')](_0x42900f,_0x6f68('0x25'));_0x2b186a[_0x6f68('0x2d')]=_['keys'](_0x3513cf[_0x6f68('0x2d')]);_0x2b186a[_0x6f68('0x2e')]=_[_0x6f68('0x2f')](_0x2b186a['model'],_0x2b186a[_0x6f68('0x2d')]);_0xa36e70[_0x6f68('0x30')]=_[_0x6f68('0x2f')](_0x2b186a['model'],qs[_0x6f68('0x31')](_0x3513cf[_0x6f68('0x2d')]['fields']));_0xa36e70[_0x6f68('0x30')]=_0xa36e70['attributes'][_0x6f68('0x32')]?_0xa36e70[_0x6f68('0x30')]:_0x2b186a[_0x6f68('0x2b')];if(!_0x3513cf[_0x6f68('0x2d')]['hasOwnProperty'](_0x6f68('0x33'))){_0xa36e70[_0x6f68('0x19')]=qs[_0x6f68('0x19')](_0x3513cf[_0x6f68('0x2d')][_0x6f68('0x19')]);_0xa36e70[_0x6f68('0x18')]=qs[_0x6f68('0x18')](_0x3513cf[_0x6f68('0x2d')]['offset']);}_0xa36e70[_0x6f68('0x34')]=qs['sort'](_0x3513cf['query'][_0x6f68('0x35')]);_0xa36e70[_0x6f68('0x36')]=qs[_0x6f68('0x2e')](_[_0x6f68('0x37')](_0x3513cf[_0x6f68('0x2d')],_0x2b186a[_0x6f68('0x2e')]),_0x42900f);if(_0x3513cf['query'][_0x6f68('0x38')]){_0xa36e70[_0x6f68('0x36')]=_[_0x6f68('0x39')](_0xa36e70['where'],{'$or':_[_0x6f68('0x2c')](_0x42900f,function(_0x4001b6){if(_0x4001b6[_0x6f68('0x3a')]!==_0x6f68('0x3b')){var _0x4ad9af={};_0x4ad9af[_0x4001b6[_0x6f68('0x25')]]={'$like':'%'+_0x3513cf['query'][_0x6f68('0x38')]+'%'};return _0x4ad9af;}})});}_0xa36e70=_[_0x6f68('0x39')]({},_0xa36e70,_0x3513cf['options']);var _0x41b72c={'where':_0xa36e70['where']};return db[_0x6f68('0x27')][_0x6f68('0x1b')](_0x41b72c)[_0x6f68('0x20')](function(_0x5cef21){_0x4d8f02[_0x6f68('0x1b')]=_0x5cef21;if(_0x3513cf['query'][_0x6f68('0x3c')]){_0xa36e70[_0x6f68('0x3d')]=[{'all':!![]}];}return db[_0x6f68('0x27')]['findAll'](_0xa36e70);})[_0x6f68('0x20')](function(_0x1b11a5){_0x4d8f02['rows']=_0x1b11a5;return _0x4d8f02;})['then'](respondWithFilteredResult(_0x1c0fb2,_0xa36e70))['catch'](handleError(_0x1c0fb2,null));};exports[_0x6f68('0x3e')]=function(_0x9f686a,_0x284e19){var _0x313e40={'raw':!![],'where':{'id':_0x9f686a[_0x6f68('0x3f')]['id']}},_0x350022={};_0x350022[_0x6f68('0x2b')]=_[_0x6f68('0x40')](db[_0x6f68('0x27')][_0x6f68('0x28')]);_0x350022['query']=_[_0x6f68('0x40')](_0x9f686a['query']);_0x350022[_0x6f68('0x2e')]=_[_0x6f68('0x2f')](_0x350022[_0x6f68('0x2b')],_0x350022[_0x6f68('0x2d')]);_0x313e40['attributes']=_['intersection'](_0x350022[_0x6f68('0x2b')],qs[_0x6f68('0x31')](_0x9f686a[_0x6f68('0x2d')][_0x6f68('0x31')]));_0x313e40['attributes']=_0x313e40['attributes']['length']?_0x313e40[_0x6f68('0x30')]:_0x350022[_0x6f68('0x2b')];if(_0x9f686a[_0x6f68('0x2d')][_0x6f68('0x3c')]){_0x313e40['include']=[{'all':!![]}];}_0x313e40=_[_0x6f68('0x39')]({},_0x313e40,_0x9f686a['options']);return db['FaxApplication'][_0x6f68('0x41')](_0x313e40)[_0x6f68('0x20')](handleEntityNotFound(_0x284e19,null))['then'](respondWithResult(_0x284e19,null))[_0x6f68('0x42')](handleError(_0x284e19,null));};exports[_0x6f68('0x43')]=function(_0x2b2a4b,_0x30f818){return db[_0x6f68('0x27')]['create'](_0x2b2a4b[_0x6f68('0x44')],{})[_0x6f68('0x20')](respondWithResult(_0x30f818,0xc9))[_0x6f68('0x42')](handleError(_0x30f818,null));};exports[_0x6f68('0x1f')]=function(_0x963fe2,_0x29434d){if(_0x963fe2[_0x6f68('0x44')]['id']){delete _0x963fe2['body']['id'];}return db[_0x6f68('0x27')][_0x6f68('0x41')]({'where':{'id':_0x963fe2['params']['id']}})[_0x6f68('0x20')](handleEntityNotFound(_0x29434d,null))['then'](saveUpdates(_0x963fe2[_0x6f68('0x44')],null))[_0x6f68('0x20')](respondWithResult(_0x29434d,null))[_0x6f68('0x42')](handleError(_0x29434d,null));};exports[_0x6f68('0x21')]=function(_0x134d82,_0x19c268){return db[_0x6f68('0x27')]['find']({'where':{'id':_0x134d82[_0x6f68('0x3f')]['id']}})[_0x6f68('0x20')](handleEntityNotFound(_0x19c268,null))[_0x6f68('0x20')](removeEntity(_0x19c268,null))[_0x6f68('0x42')](handleError(_0x19c268,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index eacd776..66d46a2 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 _0x5258=['path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise'];(function(_0xfb4783,_0x3195e9){var _0x46e4f5=function(_0x4e1cbc){while(--_0x4e1cbc){_0xfb4783['push'](_0xfb4783['shift']());}};_0x46e4f5(++_0x3195e9);}(_0x5258,0x110));var _0x8525=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0x5258[_0x131e60];return _0x4bc497;};'use strict';var _=require(_0x8525('0x0'));var util=require(_0x8525('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8525('0x2'));var BPromise=require('bluebird');var rp=require(_0x8525('0x3'));var fs=require('fs');var path=require(_0x8525('0x4'));var rimraf=require('rimraf');var config=require(_0x8525('0x5'));var attributes=require(_0x8525('0x6'));module[_0x8525('0x7')]=function(_0x41b1eb,_0x39fce9){return _0x41b1eb[_0x8525('0x8')]('FaxApplication',attributes,{'tableName':_0x8525('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8525('0xa'),'collate':_0x8525('0xb')});}; \ No newline at end of file +var _0x8350=['utf8mb4','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications'];(function(_0x3be0a0,_0x14d3e4){var _0x2356fa=function(_0x5df00d){while(--_0x5df00d){_0x3be0a0['push'](_0x3be0a0['shift']());}};_0x2356fa(++_0x14d3e4);}(_0x8350,0xb7));var _0x0835=function(_0x21f22e,_0x3868a7){_0x21f22e=_0x21f22e-0x0;var _0x3bc364=_0x8350[_0x21f22e];return _0x3bc364;};'use strict';var _=require('lodash');var util=require(_0x0835('0x0'));var logger=require(_0x0835('0x1'))(_0x0835('0x2'));var moment=require(_0x0835('0x3'));var BPromise=require(_0x0835('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0835('0x5'));var rimraf=require('rimraf');var config=require(_0x0835('0x6'));var attributes=require(_0x0835('0x7'));module[_0x0835('0x8')]=function(_0x1d5e1b,_0x5662e6){return _0x1d5e1b[_0x0835('0x9')](_0x0835('0xa'),attributes,{'tableName':_0x0835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0835('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 2a198d6..5c95d92 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 _0xff89=['catch','UpdateFaxApplication','FaxApplication','body','options','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x400a4f,_0x302b31){var _0x2d0335=function(_0x3d0955){while(--_0x3d0955){_0x400a4f['push'](_0x400a4f['shift']());}};_0x2d0335(++_0x302b31);}(_0xff89,0xaf));var _0x9ff8=function(_0xa56fec,_0x233950){_0xa56fec=_0xa56fec-0x0;var _0xa5d58e=_0xff89[_0xa56fec];return _0xa5d58e;};'use strict';var _=require(_0x9ff8('0x0'));var util=require(_0x9ff8('0x1'));var moment=require(_0x9ff8('0x2'));var BPromise=require(_0x9ff8('0x3'));var rs=require(_0x9ff8('0x4'));var fs=require('fs');var Redis=require(_0x9ff8('0x5'));var db=require(_0x9ff8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ff8('0x7'));var config=require(_0x9ff8('0x8'));var jayson=require(_0x9ff8('0x9'));var client=jayson[_0x9ff8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x555e68,_0x452782,_0x5c81c5){return new BPromise(function(_0x1d230f,_0x3eba33){return client[_0x9ff8('0xb')](_0x555e68,_0x5c81c5)['then'](function(_0x3f4329){logger['info'](_0x9ff8('0xc'),_0x452782,'request\x20sent');logger[_0x9ff8('0xd')](_0x9ff8('0xe'),_0x452782,'request\x20sent',JSON[_0x9ff8('0xf')](_0x3f4329));if(_0x3f4329[_0x9ff8('0x10')]){if(_0x3f4329[_0x9ff8('0x10')][_0x9ff8('0x11')]===0x1f4){logger[_0x9ff8('0x10')]('FaxApplication,\x20%s,\x20%s',_0x452782,_0x3f4329['error']['message']);return _0x3eba33(_0x3f4329[_0x9ff8('0x10')]['message']);}logger[_0x9ff8('0x10')](_0x9ff8('0xc'),_0x452782,_0x3f4329[_0x9ff8('0x10')][_0x9ff8('0x12')]);return _0x1d230f(_0x3f4329['error'][_0x9ff8('0x12')]);}else{logger[_0x9ff8('0x13')](_0x9ff8('0xc'),_0x452782,'request\x20sent');_0x1d230f(_0x3f4329[_0x9ff8('0x14')][_0x9ff8('0x12')]);}})[_0x9ff8('0x15')](function(_0x2b7b74){logger['error'](_0x9ff8('0xc'),_0x452782,_0x2b7b74);_0x3eba33(_0x2b7b74);});});}exports[_0x9ff8('0x16')]=function(_0x251170){var _0x37eea6=this;return new Promise(function(_0x1a9059,_0x2d2098){return db[_0x9ff8('0x17')]['update'](_0x251170[_0x9ff8('0x18')],{'raw':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')][_0x9ff8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')]['where']||null:null,'attributes':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')]['attributes']||null:null,'limit':_0x251170[_0x9ff8('0x19')]?_0x251170[_0x9ff8('0x19')][_0x9ff8('0x1b')]||null:null})['then'](function(_0x22ea2d){logger[_0x9ff8('0x13')](_0x9ff8('0x16'),_0x251170);logger[_0x9ff8('0xd')](_0x9ff8('0x16'),_0x251170,JSON[_0x9ff8('0xf')](_0x22ea2d));_0x1a9059(_0x22ea2d);})['catch'](function(_0x50296d){logger['error'](_0x9ff8('0x16'),_0x50296d[_0x9ff8('0x12')],_0x251170);_0x2d2098(_0x37eea6[_0x9ff8('0x10')](0x1f4,_0x50296d[_0x9ff8('0x12')]));});});}; \ No newline at end of file +var _0x8463=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ed08a,_0x28cbf4){var _0x49690f=function(_0xb2817f){while(--_0xb2817f){_0x5ed08a['push'](_0x5ed08a['shift']());}};_0x49690f(++_0x28cbf4);}(_0x8463,0x1b2));var _0x3846=function(_0x5d6014,_0x3a0b4d){_0x5d6014=_0x5d6014-0x0;var _0x14b274=_0x8463[_0x5d6014];return _0x14b274;};'use strict';var _=require(_0x3846('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3846('0x1'));var rs=require(_0x3846('0x2'));var fs=require('fs');var Redis=require(_0x3846('0x3'));var db=require(_0x3846('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3846('0x5'));var config=require(_0x3846('0x6'));var jayson=require(_0x3846('0x7'));var client=jayson[_0x3846('0x8')][_0x3846('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a03a7,_0x9fa786,_0x385b9e){return new BPromise(function(_0x12403a,_0x57fccf){return client['request'](_0x1a03a7,_0x385b9e)['then'](function(_0x7ff7e1){logger[_0x3846('0xa')](_0x3846('0xb'),_0x9fa786,_0x3846('0xc'));logger[_0x3846('0xd')](_0x3846('0xe'),_0x9fa786,_0x3846('0xc'),JSON[_0x3846('0xf')](_0x7ff7e1));if(_0x7ff7e1['error']){if(_0x7ff7e1[_0x3846('0x10')]['code']===0x1f4){logger[_0x3846('0x10')](_0x3846('0xb'),_0x9fa786,_0x7ff7e1[_0x3846('0x10')][_0x3846('0x11')]);return _0x57fccf(_0x7ff7e1['error'][_0x3846('0x11')]);}logger[_0x3846('0x10')]('FaxApplication,\x20%s,\x20%s',_0x9fa786,_0x7ff7e1[_0x3846('0x10')][_0x3846('0x11')]);return _0x12403a(_0x7ff7e1[_0x3846('0x10')][_0x3846('0x11')]);}else{logger[_0x3846('0xa')](_0x3846('0xb'),_0x9fa786,_0x3846('0xc'));_0x12403a(_0x7ff7e1[_0x3846('0x12')][_0x3846('0x11')]);}})[_0x3846('0x13')](function(_0x44dc90){logger[_0x3846('0x10')]('FaxApplication,\x20%s,\x20%s',_0x9fa786,_0x44dc90);_0x57fccf(_0x44dc90);});});}exports[_0x3846('0x14')]=function(_0x46c799){var _0x59e343=this;return new Promise(function(_0x38e54f,_0x782b5f){return db[_0x3846('0x15')]['update'](_0x46c799[_0x3846('0x16')],{'raw':_0x46c799[_0x3846('0x17')]?_0x46c799['options'][_0x3846('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c799[_0x3846('0x17')]?_0x46c799[_0x3846('0x17')][_0x3846('0x19')]||null:null,'attributes':_0x46c799[_0x3846('0x17')]?_0x46c799['options'][_0x3846('0x1a')]||null:null,'limit':_0x46c799[_0x3846('0x17')]?_0x46c799['options'][_0x3846('0x1b')]||null:null})['then'](function(_0x27c686){logger[_0x3846('0xa')](_0x3846('0x14'),_0x46c799);logger[_0x3846('0xd')](_0x3846('0x14'),_0x46c799,JSON['stringify'](_0x27c686));_0x38e54f(_0x27c686);})[_0x3846('0x13')](function(_0x35e3fa){logger[_0x3846('0x10')](_0x3846('0x14'),_0x35e3fa[_0x3846('0x11')],_0x46c799);_0x782b5f(_0x59e343[_0x3846('0x10')](0x1f4,_0x35e3fa[_0x3846('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 209644d..be32215 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 _0xb03e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3d216f,_0x345fc9){var _0x240d8c=function(_0x217db8){while(--_0x217db8){_0x3d216f['push'](_0x3d216f['shift']());}};_0x240d8c(++_0x345fc9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x56b0a2,_0x4cd20d){_0x56b0a2=_0x56b0a2-0x0;var _0x5f2b98=_0xb03e[_0x56b0a2];return _0x5f2b98;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xb')](),controller['create']);router[_0xeb03('0xf')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller['update']);router[_0xeb03('0x10')]('/:id',auth[_0xeb03('0xb')](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x5e0708,_0x1a084b){var _0x2fcf10=function(_0x433d74){while(--_0x433d74){_0x5e0708['push'](_0x5e0708['shift']());}};_0x2fcf10(++_0x1a084b);}(_0xed3c,0x1a6));var _0xced3=function(_0x43b852,_0x591eba){_0x43b852=_0x43b852-0x0;var _0x10d838=_0xed3c[_0x43b852];return _0x10d838;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e8429bf..e6ffa2d 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 _0x09c3=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x51070b,_0x39c85d){var _0x153240=function(_0x7c02f2){while(--_0x7c02f2){_0x51070b['push'](_0x51070b['shift']());}};_0x153240(++_0x39c85d);}(_0x09c3,0xe1));var _0x309c=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0x09c3[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0x309c('0x0'));module[_0x309c('0x1')]={'closed':{'type':Sequelize[_0x309c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x309c('0x3')]},'disposition':{'type':Sequelize[_0x309c('0x4')]},'secondDisposition':{'type':Sequelize[_0x309c('0x4')]},'thirdDisposition':{'type':Sequelize[_0x309c('0x4')]},'note':{'type':Sequelize[_0x309c('0x4')]},'read1stAt':{'type':Sequelize[_0x309c('0x3')]},'fax':{'type':Sequelize[_0x309c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x309c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x309c('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x309c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xe2d9=['STRING','ENUM','out','sequelize','exports','DATE'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xe2d9,0x1c5));var _0x9e2d=function(_0xb9ed7d,_0xee5ded){_0xb9ed7d=_0xb9ed7d-0x0;var _0x28ef0a=_0xe2d9[_0xb9ed7d];return _0x28ef0a;};'use strict';var Sequelize=require(_0x9e2d('0x0'));module[_0x9e2d('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9e2d('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9e2d('0x3')]},'note':{'type':Sequelize[_0x9e2d('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x9e2d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9e2d('0x4')]('in',_0x9e2d('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9e2d('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a55f43a..5071602 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 _0x4751=['path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','update','destroy','addMessage','ids','omit','getMessages','FaxMessage','hasOwnProperty','nolimit','order','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','rimraf','zip-dir','moment','bluebird','util'];(function(_0x55df1c,_0x3ffc53){var _0x3d0528=function(_0x5e82bb){while(--_0x5e82bb){_0x55df1c['push'](_0x55df1c['shift']());}};_0x3d0528(++_0x3ffc53);}(_0x4751,0x19b));var _0x1475=function(_0x5d8e48,_0x504b33){_0x5d8e48=_0x5d8e48-0x0;var _0x1b9354=_0x4751[_0x5d8e48];return _0x1b9354;};'use strict';var rimraf=require(_0x1475('0x0'));var zipdir=require(_0x1475('0x1'));var moment=require(_0x1475('0x2'));var BPromise=require(_0x1475('0x3'));var util=require(_0x1475('0x4'));var path=require(_0x1475('0x5'));var fs=require('fs');var _=require(_0x1475('0x6'));var Redis=require(_0x1475('0x7'));var interaction=require(_0x1475('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x1475('0x9'))(_0x1475('0xa'));var config=require('../../config/environment');var db=require(_0x1475('0xb'))['db'];config['redis']=_[_0x1475('0xc')](config[_0x1475('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1475('0xd')]));require('./faxInteraction.socket')[_0x1475('0xe')](socket);function respondWithStatusCode(_0x1d9829,_0x15699a){_0x15699a=_0x15699a||0xcc;return function(_0x599708){if(_0x599708){return _0x1d9829[_0x1475('0xf')](_0x15699a);}return _0x1d9829[_0x1475('0x10')](_0x15699a)[_0x1475('0x11')]();};}function respondWithResult(_0x538648,_0x38b894){_0x38b894=_0x38b894||0xc8;return function(_0x5d04c5){if(_0x5d04c5){return _0x538648[_0x1475('0x10')](_0x38b894)[_0x1475('0x12')](_0x5d04c5);}};}function respondWithFilteredResult(_0x5c6e78,_0x11b061){return function(_0x157e00){if(_0x157e00){var _0x408004=typeof _0x11b061['offset']===_0x1475('0x13')&&typeof _0x11b061[_0x1475('0x14')]===_0x1475('0x13');var _0x41ae13=_0x157e00[_0x1475('0x15')];var _0x15d60a=_0x408004?0x0:_0x11b061[_0x1475('0x16')];var _0x4e704c=_0x408004?_0x157e00[_0x1475('0x15')]:_0x11b061[_0x1475('0x16')]+_0x11b061[_0x1475('0x14')];var _0xea83e3;if(_0x4e704c>=_0x41ae13){_0x4e704c=_0x41ae13;_0xea83e3=0xc8;}else{_0xea83e3=0xce;}_0x5c6e78[_0x1475('0x10')](_0xea83e3);return _0x5c6e78[_0x1475('0x17')](_0x1475('0x18'),_0x15d60a+'-'+_0x4e704c+'/'+_0x41ae13)[_0x1475('0x12')](_0x157e00);}return null;};}function saveUpdates(_0x4e6405){return function(_0x44abc6){if(_0x44abc6){return _0x44abc6['update'](_0x4e6405)[_0x1475('0x19')](function(_0x5a7424){return _0x5a7424;});}return null;};}function removeEntity(_0x59d7ae){return function(_0x57ff40){if(_0x57ff40){return _0x57ff40['destroy']()[_0x1475('0x19')](function(){_0x59d7ae['status'](0xcc)[_0x1475('0x11')]();});}};}function handleEntityNotFound(_0x885cef){return function(_0x197b25){if(!_0x197b25){_0x885cef['sendStatus'](0x194);}return _0x197b25;};}function handleError(_0x540770,_0x2d6139){_0x2d6139=_0x2d6139||0x1f4;return function(_0x29762e){logger[_0x1475('0x1a')](_0x29762e[_0x1475('0x1b')]);if(_0x29762e[_0x1475('0x1c')]){delete _0x29762e['name'];}_0x540770[_0x1475('0x10')](_0x2d6139)['send'](_0x29762e);};}exports[_0x1475('0x1d')]=function(_0x55f722,_0x31f13){var _0x194c93={};var _0x15cdd8=_[_0x1475('0x1e')](db['FaxInteraction'][_0x1475('0x1f')],function(_0x1278a3){return{'name':_0x1278a3[_0x1475('0x20')],'type':_0x1278a3[_0x1475('0x21')][_0x1475('0x22')]};});_0x194c93=qs[_0x1475('0x23')](_0x15cdd8,_0x55f722);return interaction[_0x1475('0x24')](_0x1475('0x25'),_0x55f722[_0x1475('0x26')],_0x55f722[_0x1475('0x27')],_0x194c93,_0x15cdd8)[_0x1475('0x19')](respondWithFilteredResult(_0x31f13,_0x194c93))[_0x1475('0x28')](handleError(_0x31f13,null));};exports[_0x1475('0x29')]=function(_0x55b2dc,_0x4f925f){var _0x166a6c={'raw':![],'where':{'id':_0x55b2dc[_0x1475('0x2a')]['id']}},_0x3e365a={};_0x3e365a[_0x1475('0x2b')]=_[_0x1475('0x2c')](db[_0x1475('0x2d')][_0x1475('0x1f')]);_0x3e365a[_0x1475('0x26')]=_[_0x1475('0x2c')](_0x55b2dc[_0x1475('0x26')]);_0x3e365a[_0x1475('0x2e')]=_[_0x1475('0x2f')](_0x3e365a[_0x1475('0x2b')],_0x3e365a[_0x1475('0x26')]);_0x166a6c['attributes']=_['intersection'](_0x3e365a[_0x1475('0x2b')],qs[_0x1475('0x30')](_0x55b2dc[_0x1475('0x26')][_0x1475('0x30')]));_0x166a6c[_0x1475('0x31')]=_0x166a6c[_0x1475('0x31')][_0x1475('0x32')]?_0x166a6c[_0x1475('0x31')]:_0x3e365a[_0x1475('0x2b')];if(_0x55b2dc['query'][_0x1475('0x33')]){_0x166a6c[_0x1475('0x34')]=[{'all':!![]}];}_0x166a6c=_[_0x1475('0x35')]({},_0x166a6c,_0x55b2dc[_0x1475('0x36')]);return db[_0x1475('0x2d')][_0x1475('0x37')](_0x166a6c)[_0x1475('0x19')](handleEntityNotFound(_0x4f925f,null))['then'](respondWithResult(_0x4f925f,null))[_0x1475('0x28')](handleError(_0x4f925f,null));};exports[_0x1475('0x38')]=function(_0x4d12c1,_0x2626ce){return db[_0x1475('0x2d')][_0x1475('0x38')](_0x4d12c1[_0x1475('0x39')],{})[_0x1475('0x19')](respondWithResult(_0x2626ce,0xc9))[_0x1475('0x28')](handleError(_0x2626ce,null));};exports[_0x1475('0x3a')]=function(_0x41a244,_0x559ef5){if(_0x41a244[_0x1475('0x39')]['id']){delete _0x41a244[_0x1475('0x39')]['id'];}return db[_0x1475('0x2d')][_0x1475('0x37')]({'where':{'id':_0x41a244[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x559ef5,null))[_0x1475('0x19')](saveUpdates(_0x41a244[_0x1475('0x39')],null))[_0x1475('0x19')](respondWithResult(_0x559ef5,null))[_0x1475('0x28')](handleError(_0x559ef5,null));};exports[_0x1475('0x3b')]=function(_0x4845e5,_0xfcc11a){return db[_0x1475('0x2d')]['find']({'where':{'id':_0x4845e5[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0xfcc11a,null))['then'](removeEntity(_0xfcc11a,null))['catch'](handleError(_0xfcc11a,null));};exports['describe']=function(_0x296992,_0x499e82){return db[_0x1475('0x2d')]['describe']()[_0x1475('0x19')](respondWithResult(_0x499e82,null))[_0x1475('0x28')](handleError(_0x499e82,null));};exports[_0x1475('0x3c')]=function(_0x674aba,_0x3aa660){return db['FaxMessage']['find']({'where':{'id':_0x674aba[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x3aa660,null))['then'](function(_0x145f34){if(_0x145f34){return _0x145f34[_0x1475('0x3c')](_0x674aba['body'][_0x1475('0x3d')],_[_0x1475('0x3e')](_0x674aba['body'],[_0x1475('0x3d'),'id'])||{});}})[_0x1475('0x19')](respondWithResult(_0x3aa660,null))[_0x1475('0x28')](handleError(_0x3aa660,null));};exports[_0x1475('0x3f')]=function(_0x544862,_0x416a36){var _0xa8749b={'raw':![],'where':{}};var _0x23ea0a={};var _0x3364e9={'count':0x0,'rows':[]};return db[_0x1475('0x2d')]['findOne']({'where':{'id':_0x544862[_0x1475('0x2a')]['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x416a36,null))['then'](function(_0x544ba7){if(_0x544ba7){_0x23ea0a[_0x1475('0x2b')]=_['keys'](db[_0x1475('0x40')]['rawAttributes']);_0x23ea0a[_0x1475('0x26')]=_[_0x1475('0x2c')](_0x544862[_0x1475('0x26')]);_0x23ea0a[_0x1475('0x2e')]=_[_0x1475('0x2f')](_0x23ea0a[_0x1475('0x2b')],_0x23ea0a[_0x1475('0x26')]);_0xa8749b['attributes']=_[_0x1475('0x2f')](_0x23ea0a[_0x1475('0x2b')],qs[_0x1475('0x30')](_0x544862[_0x1475('0x26')][_0x1475('0x30')]));_0xa8749b[_0x1475('0x31')]=_0xa8749b[_0x1475('0x31')][_0x1475('0x32')]?_0xa8749b[_0x1475('0x31')]:_0x23ea0a['model'];if(!_0x544862[_0x1475('0x26')][_0x1475('0x41')](_0x1475('0x42'))){_0xa8749b[_0x1475('0x14')]=qs[_0x1475('0x14')](_0x544862['query'][_0x1475('0x14')]);_0xa8749b[_0x1475('0x16')]=qs[_0x1475('0x16')](_0x544862[_0x1475('0x26')][_0x1475('0x16')]);}_0xa8749b[_0x1475('0x43')]=qs['sort'](_0x544862['query']['sort']);_0xa8749b['where']=qs['filters'](_[_0x1475('0x44')](_0x544862[_0x1475('0x26')],_0x23ea0a[_0x1475('0x2e')]));_0xa8749b[_0x1475('0x45')][_0x1475('0x46')]=_0x544ba7['id'];if(_0x544862[_0x1475('0x26')][_0x1475('0x47')]){_0xa8749b[_0x1475('0x45')]=_[_0x1475('0x35')](_0xa8749b[_0x1475('0x45')],{'$or':_[_0x1475('0x1e')](_0xa8749b[_0x1475('0x31')],function(_0x47587b){var _0x8b14fd={};_0x8b14fd[_0x47587b]={'$like':'%'+_0x544862[_0x1475('0x26')]['filter']+'%'};return _0x8b14fd;})});}if(_0x544862['query']['$gte']){var _0x3aad78=_0x544862[_0x1475('0x26')][_0x1475('0x48')][_0x1475('0x49')](',');var _0x442ebf={};_0x442ebf[_0x3aad78[0x0]]={'$gte':moment(_0x3aad78[0x1])[_0x1475('0x4a')](_0x1475('0x4b'))};_0xa8749b[_0x1475('0x45')]=_[_0x1475('0x35')](_0xa8749b[_0x1475('0x45')],_0x442ebf);}_0xa8749b=_['merge']({},_0xa8749b,_0x544862[_0x1475('0x36')]);return db['FaxMessage'][_0x1475('0x15')]({'where':_0xa8749b[_0x1475('0x45')]})[_0x1475('0x19')](function(_0xdaab6a){_0x3364e9['count']=_0xdaab6a;if(_0x544862[_0x1475('0x26')][_0x1475('0x33')]){_0xa8749b['include']=[{'all':!![]}];}return db[_0x1475('0x40')][_0x1475('0x24')](_0xa8749b);})['then'](function(_0x403d0c){_0x3364e9[_0x1475('0x4c')]=_0x403d0c;return _0x3364e9;});}})[_0x1475('0x19')](respondWithFilteredResult(_0x416a36,_0xa8749b))[_0x1475('0x28')](handleError(_0x416a36,null));};exports[_0x1475('0x4d')]=function(_0x39b76a,_0x2a0fd6){return db['FaxInteraction'][_0x1475('0x37')]({'where':{'id':_0x39b76a['params']['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x2a0fd6,null))[_0x1475('0x19')](function(_0x43932d){if(_0x43932d){return _0x43932d[_0x1475('0x4e')](_0x39b76a[_0x1475('0x39')][_0x1475('0x3d')],_['omit'](_0x39b76a[_0x1475('0x39')],['ids','id'])||{})[_0x1475('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1475('0x1c'),_0x1475('0x50')],'where':{'id':_0x39b76a[_0x1475('0x39')][_0x1475('0x3d')]}});})['then'](function(_0x579d77){socket[_0x1475('0x51')]('faxInteractionTags:save',{'id':Number(_0x39b76a[_0x1475('0x2a')]['id']),'tags':_0x579d77||[]});return{'id':Number(_0x39b76a['params']['id']),'tags':_0x579d77||[]};});}})[_0x1475('0x19')](respondWithResult(_0x2a0fd6,null))[_0x1475('0x28')](handleError(_0x2a0fd6,null));};exports[_0x1475('0x52')]=function(_0x1d068b,_0x1679f0){return db[_0x1475('0x2d')]['find']({'where':{'id':_0x1d068b['params']['id']}})[_0x1475('0x19')](handleEntityNotFound(_0x1679f0,null))[_0x1475('0x19')](function(_0x1d84a5){if(_0x1d84a5){return _0x1d84a5[_0x1475('0x52')](_0x1d068b['query'][_0x1475('0x3d')]);}})[_0x1475('0x19')](respondWithStatusCode(_0x1679f0,null))['catch'](handleError(_0x1679f0,null));};exports[_0x1475('0x53')]=function(_0x4bad47,_0x11a52c){var _0x5cfb90=moment()[_0x1475('0x54')]()[_0x1475('0x55')]();var _0x7af028=path[_0x1475('0x56')](config[_0x1475('0x57')],_0x1475('0x58'),_0x1475('0x59'),_0x1475('0x5a'));var _0x10bd83=path[_0x1475('0x56')](config['root'],_0x1475('0x58'),_0x1475('0x59'),_0x1475('0x5b'));var _0x20cb7a=path[_0x1475('0x56')](_0x7af028,_0x5cfb90);var _0x2a5213=util[_0x1475('0x4a')]('transcript-%d-%s.zip',_0x4bad47[_0x1475('0x2a')]['id'],_0x5cfb90);var _0x338c44=path[_0x1475('0x56')](_0x7af028,_0x2a5213);var _0x1c223e=[];_0x1c223e['push']({'model':db[_0x1475('0x5c')],'as':_0x1475('0x5c'),'raw':!![]});var _0x38891f=[{'model':db[_0x1475('0x40')],'as':_0x1475('0x5d'),'attributes':['id','body',_0x1475('0x5e')],'include':_0x1c223e}];return db[_0x1475('0x2d')]['find']({'where':{'id':_0x4bad47[_0x1475('0x2a')]['id']},'include':_0x38891f})[_0x1475('0x19')](handleEntityNotFound(_0x11a52c,null))[_0x1475('0x19')](function(_0x435b0f){if(_0x435b0f&&_0x435b0f[_0x1475('0x5d')]){var _0x344c46=_0x435b0f[_0x1475('0x5f')]({'plain':!![]});fs['mkdirSync'](_0x20cb7a);for(var _0x6b47e0=0x0;_0x6b47e0<_0x344c46[_0x1475('0x5d')]['length'];_0x6b47e0++){var _0x1157cc=_0x344c46[_0x1475('0x5d')][_0x6b47e0][_0x1475('0x5c')];if(_0x1157cc){var _0x3842fc=path[_0x1475('0x56')](_0x10bd83,_0x1157cc[_0x1475('0x60')]);if(fs[_0x1475('0x61')](_0x3842fc)){fs[_0x1475('0x62')](_0x3842fc)[_0x1475('0x63')](fs[_0x1475('0x64')](path['join'](_0x20cb7a,_0x1157cc[_0x1475('0x60')])));}}}return BPromise[_0x1475('0x65')]()[_0x1475('0x19')](function(){return new BPromise(function(_0xac546a,_0x5ae799){zipdir(_0x20cb7a,{'saveTo':_0x338c44},function(_0x1e683d,_0x16e726){if(_0x1e683d)return _0x5ae799(_0x1e683d);return _0xac546a(_0x16e726);});})[_0x1475('0x19')](function(){return new BPromise(function(_0x1adac8,_0x498756){rimraf(_0x20cb7a,function(_0xacd69d){if(_0xacd69d)_0x498756(_0xacd69d);return _0x1adac8();});});})[_0x1475('0x19')](function(){return _0x11a52c[_0x1475('0x53')](_0x338c44,_0x2a5213,function(_0x284c8a){if(_0x284c8a){console[_0x1475('0x66')](_0x1475('0x67'),_0x284c8a);}else{fs['unlinkSync'](_0x338c44);}});});});}else{return _0x11a52c['sendStatus'](0xc8);}})['catch'](handleError(_0x11a52c,null));}; \ No newline at end of file +var _0x91f3=['defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','map','FaxInteraction','fieldName','type','key','getOptions','fax','query','show','params','rawAttributes','keys','filters','intersection','model','attributes','fields','length','include','merge','find','create','catch','body','describe','addMessage','FaxMessage','ids','hasOwnProperty','sort','pick','where','FaxInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','setTags','omit','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','push','Attachment','Messages','createdAt','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','log','err','unlinkSync','path','lodash','ioredis','../../config/logger','api','../../mysqldb','redis'];(function(_0x3d55af,_0xe2a3f8){var _0x285af3=function(_0x316824){while(--_0x316824){_0x3d55af['push'](_0x3d55af['shift']());}};_0x285af3(++_0xe2a3f8);}(_0x91f3,0x1cf));var _0x391f=function(_0x1136c4,_0x51025a){_0x1136c4=_0x1136c4-0x0;var _0x5a1743=_0x91f3[_0x1136c4];return _0x5a1743;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x391f('0x0'));var fs=require('fs');var _=require(_0x391f('0x1'));var Redis=require(_0x391f('0x2'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x391f('0x3'))(_0x391f('0x4'));var config=require('../../config/environment');var db=require(_0x391f('0x5'))['db'];config[_0x391f('0x6')]=_[_0x391f('0x7')](config[_0x391f('0x6')],{'host':_0x391f('0x8'),'port':0x18eb});var socket=require(_0x391f('0x9'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x391f('0xa')](socket);function respondWithStatusCode(_0x1ccb9d,_0x226190){_0x226190=_0x226190||0xcc;return function(_0x5136ce){if(_0x5136ce){return _0x1ccb9d[_0x391f('0xb')](_0x226190);}return _0x1ccb9d[_0x391f('0xc')](_0x226190)[_0x391f('0xd')]();};}function respondWithResult(_0x9fd174,_0x2ab557){_0x2ab557=_0x2ab557||0xc8;return function(_0x4a7ff6){if(_0x4a7ff6){return _0x9fd174[_0x391f('0xc')](_0x2ab557)[_0x391f('0xe')](_0x4a7ff6);}};}function respondWithFilteredResult(_0x4a919f,_0x16a083){return function(_0x1fba57){if(_0x1fba57){var _0x149ea6=typeof _0x16a083[_0x391f('0xf')]===_0x391f('0x10')&&typeof _0x16a083[_0x391f('0x11')]===_0x391f('0x10');var _0x457415=_0x1fba57[_0x391f('0x12')];var _0x595e8b=_0x149ea6?0x0:_0x16a083[_0x391f('0xf')];var _0x134e2b=_0x149ea6?_0x1fba57[_0x391f('0x12')]:_0x16a083['offset']+_0x16a083[_0x391f('0x11')];var _0x482cf2;if(_0x134e2b>=_0x457415){_0x134e2b=_0x457415;_0x482cf2=0xc8;}else{_0x482cf2=0xce;}_0x4a919f[_0x391f('0xc')](_0x482cf2);return _0x4a919f['set'](_0x391f('0x13'),_0x595e8b+'-'+_0x134e2b+'/'+_0x457415)[_0x391f('0xe')](_0x1fba57);}return null;};}function saveUpdates(_0x3bfd28){return function(_0x428fc0){if(_0x428fc0){return _0x428fc0[_0x391f('0x14')](_0x3bfd28)[_0x391f('0x15')](function(_0x5b8434){return _0x5b8434;});}return null;};}function removeEntity(_0x4a8607){return function(_0x540f29){if(_0x540f29){return _0x540f29[_0x391f('0x16')]()[_0x391f('0x15')](function(){_0x4a8607[_0x391f('0xc')](0xcc)[_0x391f('0xd')]();});}};}function handleEntityNotFound(_0x5373dd){return function(_0x1ed5cd){if(!_0x1ed5cd){_0x5373dd[_0x391f('0xb')](0x194);}return _0x1ed5cd;};}function handleError(_0x221655,_0x3e2b6e){_0x3e2b6e=_0x3e2b6e||0x1f4;return function(_0x2ecc7b){logger[_0x391f('0x17')](_0x2ecc7b[_0x391f('0x18')]);if(_0x2ecc7b['name']){delete _0x2ecc7b[_0x391f('0x19')];}_0x221655[_0x391f('0xc')](_0x3e2b6e)[_0x391f('0x1a')](_0x2ecc7b);};}exports['index']=function(_0x2ab0ba,_0x4bb750){var _0x103896={};var _0x565b95=_[_0x391f('0x1b')](db[_0x391f('0x1c')]['rawAttributes'],function(_0x411990){return{'name':_0x411990[_0x391f('0x1d')],'type':_0x411990[_0x391f('0x1e')][_0x391f('0x1f')]};});_0x103896=qs[_0x391f('0x20')](_0x565b95,_0x2ab0ba);return interaction['findAll'](_0x391f('0x21'),_0x2ab0ba[_0x391f('0x22')],_0x2ab0ba['user'],_0x103896,_0x565b95)[_0x391f('0x15')](respondWithFilteredResult(_0x4bb750,_0x103896))['catch'](handleError(_0x4bb750,null));};exports[_0x391f('0x23')]=function(_0xfc4e36,_0x3aab14){var _0x2c42c1={'raw':![],'where':{'id':_0xfc4e36[_0x391f('0x24')]['id']}},_0x3be3fd={};_0x3be3fd['model']=_['keys'](db[_0x391f('0x1c')][_0x391f('0x25')]);_0x3be3fd[_0x391f('0x22')]=_[_0x391f('0x26')](_0xfc4e36['query']);_0x3be3fd[_0x391f('0x27')]=_[_0x391f('0x28')](_0x3be3fd[_0x391f('0x29')],_0x3be3fd['query']);_0x2c42c1[_0x391f('0x2a')]=_[_0x391f('0x28')](_0x3be3fd['model'],qs[_0x391f('0x2b')](_0xfc4e36[_0x391f('0x22')][_0x391f('0x2b')]));_0x2c42c1[_0x391f('0x2a')]=_0x2c42c1[_0x391f('0x2a')][_0x391f('0x2c')]?_0x2c42c1[_0x391f('0x2a')]:_0x3be3fd[_0x391f('0x29')];if(_0xfc4e36['query']['includeAll']){_0x2c42c1[_0x391f('0x2d')]=[{'all':!![]}];}_0x2c42c1=_[_0x391f('0x2e')]({},_0x2c42c1,_0xfc4e36['options']);return db[_0x391f('0x1c')][_0x391f('0x2f')](_0x2c42c1)['then'](handleEntityNotFound(_0x3aab14,null))[_0x391f('0x15')](respondWithResult(_0x3aab14,null))['catch'](handleError(_0x3aab14,null));};exports[_0x391f('0x30')]=function(_0x5bc68a,_0x2ca7f3){return db[_0x391f('0x1c')][_0x391f('0x30')](_0x5bc68a['body'],{})['then'](respondWithResult(_0x2ca7f3,0xc9))[_0x391f('0x31')](handleError(_0x2ca7f3,null));};exports['update']=function(_0x106278,_0x4e6232){if(_0x106278['body']['id']){delete _0x106278[_0x391f('0x32')]['id'];}return db[_0x391f('0x1c')]['find']({'where':{'id':_0x106278['params']['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x4e6232,null))[_0x391f('0x15')](saveUpdates(_0x106278['body'],null))[_0x391f('0x15')](respondWithResult(_0x4e6232,null))[_0x391f('0x31')](handleError(_0x4e6232,null));};exports[_0x391f('0x16')]=function(_0x2a84ac,_0x336445){return db['FaxInteraction'][_0x391f('0x2f')]({'where':{'id':_0x2a84ac[_0x391f('0x24')]['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x336445,null))[_0x391f('0x15')](removeEntity(_0x336445,null))[_0x391f('0x31')](handleError(_0x336445,null));};exports[_0x391f('0x33')]=function(_0x5d280c,_0xb2c0c3){return db['FaxInteraction'][_0x391f('0x33')]()[_0x391f('0x15')](respondWithResult(_0xb2c0c3,null))['catch'](handleError(_0xb2c0c3,null));};exports[_0x391f('0x34')]=function(_0x4cc221,_0x3f2a43){return db[_0x391f('0x35')][_0x391f('0x2f')]({'where':{'id':_0x4cc221[_0x391f('0x24')]['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x3f2a43,null))[_0x391f('0x15')](function(_0x239eaa){if(_0x239eaa){return _0x239eaa[_0x391f('0x34')](_0x4cc221[_0x391f('0x32')][_0x391f('0x36')],_['omit'](_0x4cc221[_0x391f('0x32')],[_0x391f('0x36'),'id'])||{});}})[_0x391f('0x15')](respondWithResult(_0x3f2a43,null))[_0x391f('0x31')](handleError(_0x3f2a43,null));};exports['getMessages']=function(_0xb98879,_0x524c16){var _0x1e5839={'raw':![],'where':{}};var _0x2b5984={};var _0x2c2941={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0xb98879['params']['id']}})['then'](handleEntityNotFound(_0x524c16,null))[_0x391f('0x15')](function(_0x18171d){if(_0x18171d){_0x2b5984[_0x391f('0x29')]=_['keys'](db[_0x391f('0x35')]['rawAttributes']);_0x2b5984['query']=_[_0x391f('0x26')](_0xb98879[_0x391f('0x22')]);_0x2b5984[_0x391f('0x27')]=_['intersection'](_0x2b5984['model'],_0x2b5984[_0x391f('0x22')]);_0x1e5839['attributes']=_[_0x391f('0x28')](_0x2b5984[_0x391f('0x29')],qs[_0x391f('0x2b')](_0xb98879[_0x391f('0x22')][_0x391f('0x2b')]));_0x1e5839[_0x391f('0x2a')]=_0x1e5839[_0x391f('0x2a')][_0x391f('0x2c')]?_0x1e5839[_0x391f('0x2a')]:_0x2b5984[_0x391f('0x29')];if(!_0xb98879[_0x391f('0x22')][_0x391f('0x37')]('nolimit')){_0x1e5839['limit']=qs[_0x391f('0x11')](_0xb98879[_0x391f('0x22')][_0x391f('0x11')]);_0x1e5839[_0x391f('0xf')]=qs['offset'](_0xb98879[_0x391f('0x22')][_0x391f('0xf')]);}_0x1e5839['order']=qs['sort'](_0xb98879[_0x391f('0x22')][_0x391f('0x38')]);_0x1e5839['where']=qs[_0x391f('0x27')](_[_0x391f('0x39')](_0xb98879['query'],_0x2b5984[_0x391f('0x27')]));_0x1e5839[_0x391f('0x3a')][_0x391f('0x3b')]=_0x18171d['id'];if(_0xb98879[_0x391f('0x22')][_0x391f('0x3c')]){_0x1e5839['where']=_[_0x391f('0x2e')](_0x1e5839[_0x391f('0x3a')],{'$or':_[_0x391f('0x1b')](_0x1e5839['attributes'],function(_0x25a76d){var _0x4f1e72={};_0x4f1e72[_0x25a76d]={'$like':'%'+_0xb98879[_0x391f('0x22')][_0x391f('0x3c')]+'%'};return _0x4f1e72;})});}if(_0xb98879['query'][_0x391f('0x3d')]){var _0xb4881f=_0xb98879[_0x391f('0x22')][_0x391f('0x3d')]['split'](',');var _0x3f262e={};_0x3f262e[_0xb4881f[0x0]]={'$gte':moment(_0xb4881f[0x1])[_0x391f('0x3e')](_0x391f('0x3f'))};_0x1e5839[_0x391f('0x3a')]=_[_0x391f('0x2e')](_0x1e5839[_0x391f('0x3a')],_0x3f262e);}_0x1e5839=_['merge']({},_0x1e5839,_0xb98879[_0x391f('0x40')]);return db[_0x391f('0x35')][_0x391f('0x12')]({'where':_0x1e5839[_0x391f('0x3a')]})[_0x391f('0x15')](function(_0x5c4338){_0x2c2941[_0x391f('0x12')]=_0x5c4338;if(_0xb98879[_0x391f('0x22')][_0x391f('0x41')]){_0x1e5839[_0x391f('0x2d')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1e5839);})[_0x391f('0x15')](function(_0x5bd81c){_0x2c2941[_0x391f('0x42')]=_0x5bd81c;return _0x2c2941;});}})[_0x391f('0x15')](respondWithFilteredResult(_0x524c16,_0x1e5839))[_0x391f('0x31')](handleError(_0x524c16,null));};exports['addTags']=function(_0x13b959,_0x5331f3){return db[_0x391f('0x1c')][_0x391f('0x2f')]({'where':{'id':_0x13b959['params']['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x5331f3,null))[_0x391f('0x15')](function(_0x54b4a5){if(_0x54b4a5){return _0x54b4a5[_0x391f('0x43')](_0x13b959[_0x391f('0x32')]['ids'],_[_0x391f('0x44')](_0x13b959[_0x391f('0x32')],[_0x391f('0x36'),'id'])||{})['spread'](function(){return db[_0x391f('0x45')]['findAll']({'attributes':['id',_0x391f('0x19'),_0x391f('0x46')],'where':{'id':_0x13b959[_0x391f('0x32')][_0x391f('0x36')]}});})[_0x391f('0x15')](function(_0x4693b9){socket[_0x391f('0x47')](_0x391f('0x48'),{'id':Number(_0x13b959['params']['id']),'tags':_0x4693b9||[]});return{'id':Number(_0x13b959[_0x391f('0x24')]['id']),'tags':_0x4693b9||[]};});}})[_0x391f('0x15')](respondWithResult(_0x5331f3,null))['catch'](handleError(_0x5331f3,null));};exports[_0x391f('0x49')]=function(_0x181259,_0x578830){return db[_0x391f('0x1c')]['find']({'where':{'id':_0x181259['params']['id']}})[_0x391f('0x15')](handleEntityNotFound(_0x578830,null))[_0x391f('0x15')](function(_0x32890d){if(_0x32890d){return _0x32890d[_0x391f('0x49')](_0x181259[_0x391f('0x22')][_0x391f('0x36')]);}})[_0x391f('0x15')](respondWithStatusCode(_0x578830,null))[_0x391f('0x31')](handleError(_0x578830,null));};exports[_0x391f('0x4a')]=function(_0x481f56,_0x232d5c){var _0x46946d=moment()[_0x391f('0x4b')]()[_0x391f('0x4c')]();var _0x584321=path[_0x391f('0x4d')](config[_0x391f('0x4e')],'server',_0x391f('0x4f'),'tmp');var _0x1651ca=path[_0x391f('0x4d')](config[_0x391f('0x4e')],'server',_0x391f('0x4f'),_0x391f('0x50'));var _0x5d2b24=path[_0x391f('0x4d')](_0x584321,_0x46946d);var _0x26e634=util[_0x391f('0x3e')]('transcript-%d-%s.zip',_0x481f56[_0x391f('0x24')]['id'],_0x46946d);var _0x3d6250=path[_0x391f('0x4d')](_0x584321,_0x26e634);var _0x434958=[];_0x434958[_0x391f('0x51')]({'model':db['Attachment'],'as':_0x391f('0x52'),'raw':!![]});var _0x38f40d=[{'model':db[_0x391f('0x35')],'as':_0x391f('0x53'),'attributes':['id','body',_0x391f('0x54')],'include':_0x434958}];return db['FaxInteraction'][_0x391f('0x2f')]({'where':{'id':_0x481f56['params']['id']},'include':_0x38f40d})[_0x391f('0x15')](handleEntityNotFound(_0x232d5c,null))[_0x391f('0x15')](function(_0x49df82){if(_0x49df82&&_0x49df82[_0x391f('0x53')]){var _0x32421c=_0x49df82['get']({'plain':!![]});fs['mkdirSync'](_0x5d2b24);for(var _0x2859e6=0x0;_0x2859e6<_0x32421c[_0x391f('0x53')]['length'];_0x2859e6++){var _0x3db463=_0x32421c[_0x391f('0x53')][_0x2859e6][_0x391f('0x52')];if(_0x3db463){var _0x2563c0=path[_0x391f('0x4d')](_0x1651ca,_0x3db463['basename']);if(fs[_0x391f('0x55')](_0x2563c0)){fs[_0x391f('0x56')](_0x2563c0)[_0x391f('0x57')](fs[_0x391f('0x58')](path[_0x391f('0x4d')](_0x5d2b24,_0x3db463[_0x391f('0x59')])));}}}return BPromise[_0x391f('0x5a')]()['then'](function(){return new BPromise(function(_0x592aea,_0x255873){zipdir(_0x5d2b24,{'saveTo':_0x3d6250},function(_0x3aa06b,_0x1ea272){if(_0x3aa06b)return _0x255873(_0x3aa06b);return _0x592aea(_0x1ea272);});})['then'](function(){return new BPromise(function(_0x53aa2d,_0x1e1817){rimraf(_0x5d2b24,function(_0x1ea367){if(_0x1ea367)_0x1e1817(_0x1ea367);return _0x53aa2d();});});})['then'](function(){return _0x232d5c[_0x391f('0x4a')](_0x3d6250,_0x26e634,function(_0x47d709){if(_0x47d709){console[_0x391f('0x5b')](_0x391f('0x5c'),_0x47d709);}else{fs[_0x391f('0x5d')](_0x3d6250);}});});});}else{return _0x232d5c['sendStatus'](0xc8);}})[_0x391f('0x31')](handleError(_0x232d5c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c270ca4..a4c73f8 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 _0x5ba7=['setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5ba7,0x13c));var _0x75ba=function(_0x4f2ec9,_0x2af84c){_0x4f2ec9=_0x4f2ec9-0x0;var _0x25f8bd=_0x5ba7[_0x4f2ec9];return _0x25f8bd;};'use strict';var EventEmitter=require(_0x75ba('0x0'));var FaxInteraction=require(_0x75ba('0x1'))['db'][_0x75ba('0x2')];var FaxMessage=require(_0x75ba('0x1'))['db'][_0x75ba('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x75ba('0x4')](0x0);var events={'afterCreate':_0x75ba('0x5'),'afterUpdate':_0x75ba('0x6'),'afterDestroy':_0x75ba('0x7')};function emitEvent(_0x10cab0){return function(_0x15e7fe,_0x135131,_0x41334b){_0x15e7fe['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5ca662){_0x15e7fe[_0x75ba('0x8')](_0x75ba('0x9'),_0x5ca662[_0x75ba('0xa')](function(_0x2c334c){return{'id':_0x2c334c['id']};}));return FaxMessage[_0x75ba('0xb')]({'where':{'FaxInteractionId':_0x15e7fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x75ba('0xc')](function(_0x4b050d){_0x15e7fe['setDataValue'](_0x75ba('0xd'),_0x4b050d['length']);FaxInteractionEvents[_0x75ba('0xe')](_0x10cab0+':'+_0x15e7fe['id'],_0x15e7fe);FaxInteractionEvents[_0x75ba('0xe')](_0x10cab0,_0x15e7fe);_0x41334b(null);})[_0x75ba('0xf')](_0x41334b(null));};}for(var e in events){if(events[_0x75ba('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x75ba('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xff83=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook'];(function(_0x390532,_0x2ed80a){var _0x107bd9=function(_0x4cf7f2){while(--_0x4cf7f2){_0x390532['push'](_0x390532['shift']());}};_0x107bd9(++_0x2ed80a);}(_0xff83,0x169));var _0x3ff8=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xff83[_0x54d4fe];return _0x1ab5bb;};'use strict';var EventEmitter=require(_0x3ff8('0x0'));var FaxInteraction=require(_0x3ff8('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x3ff8('0x1'))['db'][_0x3ff8('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3ff8('0x3')](0x0);var events={'afterCreate':_0x3ff8('0x4'),'afterUpdate':_0x3ff8('0x5'),'afterDestroy':_0x3ff8('0x6')};function emitEvent(_0x24bb7f){return function(_0x37da08,_0x321ff4,_0x57aae0){_0x37da08[_0x3ff8('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b2eb3){_0x37da08[_0x3ff8('0x8')](_0x3ff8('0x9'),_0x4b2eb3[_0x3ff8('0xa')](function(_0x329934){return{'id':_0x329934['id']};}));return FaxMessage[_0x3ff8('0xb')]({'where':{'FaxInteractionId':_0x37da08['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3ff8('0xc')](function(_0x4bbb79){_0x37da08[_0x3ff8('0x8')](_0x3ff8('0xd'),_0x4bbb79['length']);FaxInteractionEvents['emit'](_0x24bb7f+':'+_0x37da08['id'],_0x37da08);FaxInteractionEvents[_0x3ff8('0xe')](_0x24bb7f,_0x37da08);_0x57aae0(null);})[_0x3ff8('0xf')](_0x57aae0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x3ff8('0x10')](e,emitEvent(event));}}module[_0x3ff8('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5cd8c8b..da922ab 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 _0x279a=['util','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','lodash'];(function(_0x4d3559,_0x137bca){var _0x21fc72=function(_0x34cc72){while(--_0x34cc72){_0x4d3559['push'](_0x4d3559['shift']());}};_0x21fc72(++_0x137bca);}(_0x279a,0xdc));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa279('0x0'));var util=require(_0xa279('0x1'));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(_0xa279('0x2'));var rimraf=require(_0xa279('0x3'));var config=require(_0xa279('0x4'));var attributes=require(_0xa279('0x5'));module[_0xa279('0x6')]=function(_0x5587f9,_0x2175b7){return _0x5587f9[_0xa279('0x7')](_0xa279('0x8'),attributes,{'tableName':_0xa279('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45db04,_0xb7a2fe,_0x181969){if(_0x45db04[_0xa279('0xa')]('closed')){_0x45db04[_0xa279('0xb')]=moment()[_0xa279('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x181969(null,_0x45db04);}}});}; \ No newline at end of file +var _0xad1b=['../../config/environment','exports','define','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1e88e4,_0x185342){var _0x1b49fe=function(_0x5b4675){while(--_0x5b4675){_0x1e88e4['push'](_0x1e88e4['shift']());}};_0x1b49fe(++_0x185342);}(_0xad1b,0x131));var _0xbad1=function(_0x39528,_0x34ad9c){_0x39528=_0x39528-0x0;var _0x4f56ae=_0xad1b[_0x39528];return _0x4f56ae;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var logger=require(_0xbad1('0x2'))(_0xbad1('0x3'));var moment=require('moment');var BPromise=require(_0xbad1('0x4'));var rp=require(_0xbad1('0x5'));var fs=require('fs');var path=require(_0xbad1('0x6'));var rimraf=require('rimraf');var config=require(_0xbad1('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xbad1('0x8')]=function(_0x57eefe,_0x3abf58){return _0x57eefe[_0xbad1('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d7a8b,_0x52dae0,_0x5b7ee){if(_0x4d7a8b['changed']('closed')){_0x4d7a8b[_0xbad1('0xa')]=moment()[_0xbad1('0xb')](_0xbad1('0xc'));}_0x5b7ee(null,_0x4d7a8b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index a3288b4..54b419e 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 _0x6951=['defaults','socket.io-emitter','./faxInteraction.socket','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','limit','then','find','where','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0x6951,0x125));var _0x1695=function(_0x422efa,_0x2c1246){_0x422efa=_0x422efa-0x0;var _0x40c2c7=_0x6951[_0x422efa];return _0x40c2c7;};'use strict';var _=require(_0x1695('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1695('0x1'));var rs=require(_0x1695('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1695('0x3'))['db'];var utils=require(_0x1695('0x4'));var logger=require('../../config/logger')(_0x1695('0x5'));var config=require(_0x1695('0x6'));var jayson=require(_0x1695('0x7'));var client=jayson[_0x1695('0x8')][_0x1695('0x9')]({'port':0x232a});config[_0x1695('0xa')]=_[_0x1695('0xb')](config[_0x1695('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1695('0xc'))(new Redis(config[_0x1695('0xa')]));require(_0x1695('0xd'))['register'](socket);function respondWithRpcPromise(_0x35c65b,_0x6388c5,_0x52062c){return new BPromise(function(_0x5e6293,_0x21ee3c){return client['request'](_0x35c65b,_0x52062c)['then'](function(_0x18f86e){logger[_0x1695('0xe')](_0x1695('0xf'),_0x6388c5,_0x1695('0x10'));logger[_0x1695('0x11')](_0x1695('0x12'),_0x6388c5,_0x1695('0x10'),JSON[_0x1695('0x13')](_0x18f86e));if(_0x18f86e[_0x1695('0x14')]){if(_0x18f86e[_0x1695('0x14')][_0x1695('0x15')]===0x1f4){logger['error'](_0x1695('0xf'),_0x6388c5,_0x18f86e[_0x1695('0x14')]['message']);return _0x21ee3c(_0x18f86e['error'][_0x1695('0x16')]);}logger[_0x1695('0x14')](_0x1695('0xf'),_0x6388c5,_0x18f86e[_0x1695('0x14')]['message']);return _0x5e6293(_0x18f86e['error'][_0x1695('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x6388c5,_0x1695('0x10'));_0x5e6293(_0x18f86e[_0x1695('0x17')][_0x1695('0x16')]);}})[_0x1695('0x18')](function(_0x32c8e0){logger[_0x1695('0x14')](_0x1695('0xf'),_0x6388c5,_0x32c8e0);_0x21ee3c(_0x32c8e0);});});}exports[_0x1695('0x19')]=function(_0x39f3ed){var _0x41253e=this;return new Promise(function(_0x2e3aa2,_0x7d3a1f){return db[_0x1695('0x1a')]['update'](_0x39f3ed[_0x1695('0x1b')],{'raw':_0x39f3ed['options']?_0x39f3ed[_0x1695('0x1c')][_0x1695('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f3ed['options']?_0x39f3ed['options']['where']||null:null,'attributes':_0x39f3ed[_0x1695('0x1c')]?_0x39f3ed[_0x1695('0x1c')]['attributes']||null:null,'limit':_0x39f3ed['options']?_0x39f3ed['options'][_0x1695('0x1e')]||null:null})[_0x1695('0x1f')](function(_0x264475){logger[_0x1695('0xe')]('UpdateFaxInteraction',_0x39f3ed);logger[_0x1695('0x11')]('UpdateFaxInteraction',_0x39f3ed,JSON[_0x1695('0x13')](_0x264475));_0x2e3aa2(_0x264475);})[_0x1695('0x18')](function(_0x1b48ef){logger[_0x1695('0x14')]('UpdateFaxInteraction',_0x1b48ef[_0x1695('0x16')],_0x39f3ed);_0x7d3a1f(_0x41253e[_0x1695('0x14')](0x1f4,_0x1b48ef['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3773ed){return new Promise(function(_0x30deaf,_0x17b6a8){return db[_0x1695('0x1a')][_0x1695('0x20')]({'where':_0x3773ed[_0x1695('0x1c')]?_0x3773ed[_0x1695('0x1c')][_0x1695('0x21')]||null:null})[_0x1695('0x1f')](function(_0x1c1cfa){if(_0x1c1cfa){return _0x1c1cfa['addTags'](_0x3773ed['body'][_0x1695('0x22')],_[_0x1695('0x23')](_0x3773ed[_0x1695('0x1b')],['ids','id'])||{});}})[_0x1695('0x24')](function(_0x504999){logger[_0x1695('0xe')]('AddTags',_0x3773ed);logger[_0x1695('0x11')](_0x1695('0x25'),_0x3773ed,JSON[_0x1695('0x13')](_0x504999));_0x30deaf(_0x504999);})[_0x1695('0x18')](function(_0xf67c38){logger[_0x1695('0x14')](_0x1695('0x25'),_0xf67c38[_0x1695('0x16')],_0x3773ed);_0x17b6a8(_this[_0x1695('0x14')](0x1f4,_0xf67c38['message']));});});}; \ No newline at end of file +var _0x6549=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','debug','stringify','code','error','FaxInteraction,\x20%s,\x20%s','request\x20sent','result','message','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','then','FaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x54e994,_0x2a470f){var _0x2e7ec7=function(_0x42dda1){while(--_0x42dda1){_0x54e994['push'](_0x54e994['shift']());}};_0x2e7ec7(++_0x2a470f);}(_0x6549,0x142));var _0x9654=function(_0x4bd795,_0x4b5438){_0x4bd795=_0x4bd795-0x0;var _0x5e37f8=_0x6549[_0x4bd795];return _0x5e37f8;};'use strict';var _=require('lodash');var util=require(_0x9654('0x0'));var moment=require(_0x9654('0x1'));var BPromise=require(_0x9654('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9654('0x3'));var db=require(_0x9654('0x4'))['db'];var utils=require(_0x9654('0x5'));var logger=require(_0x9654('0x6'))(_0x9654('0x7'));var config=require(_0x9654('0x8'));var jayson=require(_0x9654('0x9'));var client=jayson[_0x9654('0xa')]['http']({'port':0x232a});config[_0x9654('0xb')]=_[_0x9654('0xc')](config[_0x9654('0xb')],{'host':_0x9654('0xd'),'port':0x18eb});var socket=require(_0x9654('0xe'))(new Redis(config[_0x9654('0xb')]));require('./faxInteraction.socket')[_0x9654('0xf')](socket);function respondWithRpcPromise(_0x42f22b,_0x4c7832,_0x3701b0){return new BPromise(function(_0x4a3a63,_0x564905){return client['request'](_0x42f22b,_0x3701b0)['then'](function(_0x2ea013){logger[_0x9654('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x4c7832,'request\x20sent');logger[_0x9654('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4c7832,'request\x20sent',JSON[_0x9654('0x12')](_0x2ea013));if(_0x2ea013['error']){if(_0x2ea013['error'][_0x9654('0x13')]===0x1f4){logger[_0x9654('0x14')](_0x9654('0x15'),_0x4c7832,_0x2ea013['error']['message']);return _0x564905(_0x2ea013[_0x9654('0x14')]['message']);}logger['error'](_0x9654('0x15'),_0x4c7832,_0x2ea013['error']['message']);return _0x4a3a63(_0x2ea013[_0x9654('0x14')]['message']);}else{logger[_0x9654('0x10')](_0x9654('0x15'),_0x4c7832,_0x9654('0x16'));_0x4a3a63(_0x2ea013[_0x9654('0x17')][_0x9654('0x18')]);}})[_0x9654('0x19')](function(_0x22a9a9){logger[_0x9654('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4c7832,_0x22a9a9);_0x564905(_0x22a9a9);});});}exports[_0x9654('0x1a')]=function(_0x556f5d){var _0x3ff59e=this;return new Promise(function(_0x47018d,_0x38d419){return db['FaxInteraction'][_0x9654('0x1b')](_0x556f5d[_0x9654('0x1c')],{'raw':_0x556f5d[_0x9654('0x1d')]?_0x556f5d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x556f5d['options']?_0x556f5d[_0x9654('0x1d')][_0x9654('0x1e')]||null:null,'attributes':_0x556f5d['options']?_0x556f5d[_0x9654('0x1d')][_0x9654('0x1f')]||null:null,'limit':_0x556f5d[_0x9654('0x1d')]?_0x556f5d[_0x9654('0x1d')][_0x9654('0x20')]||null:null})[_0x9654('0x21')](function(_0x53dd06){logger[_0x9654('0x10')](_0x9654('0x1a'),_0x556f5d);logger['debug'](_0x9654('0x1a'),_0x556f5d,JSON['stringify'](_0x53dd06));_0x47018d(_0x53dd06);})[_0x9654('0x19')](function(_0x5cfb4e){logger[_0x9654('0x14')](_0x9654('0x1a'),_0x5cfb4e['message'],_0x556f5d);_0x38d419(_0x3ff59e[_0x9654('0x14')](0x1f4,_0x5cfb4e[_0x9654('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x38a129){return new Promise(function(_0x53f1e7,_0x2f143f){return db[_0x9654('0x22')][_0x9654('0x23')]({'where':_0x38a129['options']?_0x38a129[_0x9654('0x1d')][_0x9654('0x1e')]||null:null})[_0x9654('0x21')](function(_0x1313f8){if(_0x1313f8){return _0x1313f8[_0x9654('0x24')](_0x38a129[_0x9654('0x1c')][_0x9654('0x25')],_[_0x9654('0x26')](_0x38a129['body'],['ids','id'])||{});}})[_0x9654('0x27')](function(_0x1690ff){logger[_0x9654('0x10')](_0x9654('0x28'),_0x38a129);logger[_0x9654('0x11')](_0x9654('0x28'),_0x38a129,JSON[_0x9654('0x12')](_0x1690ff));_0x53f1e7(_0x1690ff);})[_0x9654('0x19')](function(_0x3101a4){logger[_0x9654('0x14')](_0x9654('0x28'),_0x3101a4[_0x9654('0x18')],_0x38a129);_0x2f143f(_this[_0x9654('0x14')](0x1f4,_0x3101a4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index af6d3bf..8c9fd2d 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 _0x2bd1=['length','faxInteraction:','./faxInteraction.events','update','emit','removeListener','register'];(function(_0x5f36cd,_0x37d4c9){var _0x49832a=function(_0xa82985){while(--_0xa82985){_0x5f36cd['push'](_0x5f36cd['shift']());}};_0x49832a(++_0x37d4c9);}(_0x2bd1,0x19f));var _0x12bd=function(_0x223bf6,_0x54acd){_0x223bf6=_0x223bf6-0x0;var _0x5676a5=_0x2bd1[_0x223bf6];return _0x5676a5;};'use strict';var FaxInteractionEvents=require(_0x12bd('0x0'));var events=['save','remove',_0x12bd('0x1')];function createListener(_0x51aa73,_0x4d83ed){return function(_0x4b7cc5){_0x4d83ed[_0x12bd('0x2')](_0x51aa73,_0x4b7cc5);};}function removeListener(_0x5be59c,_0x5840f0){return function(){FaxInteractionEvents[_0x12bd('0x3')](_0x5be59c,_0x5840f0);};}exports[_0x12bd('0x4')]=function(_0x30952a){for(var _0x1772e3=0x0,_0x34af77=events[_0x12bd('0x5')];_0x1772e3<_0x34af77;_0x1772e3++){var _0x49d24b=events[_0x1772e3];var _0x4ed74a=createListener(_0x12bd('0x6')+_0x49d24b,_0x30952a);FaxInteractionEvents['on'](_0x49d24b,_0x4ed74a);}}; \ No newline at end of file +var _0xe278=['emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe278,0x19d));var _0x8e27=function(_0x468bc9,_0x62dceb){_0x468bc9=_0x468bc9-0x0;var _0x3b833e=_0xe278[_0x468bc9];return _0x3b833e;};'use strict';var FaxInteractionEvents=require(_0x8e27('0x0'));var events=[_0x8e27('0x1'),'remove',_0x8e27('0x2')];function createListener(_0x5f3184,_0x315d2c){return function(_0x2f8746){_0x315d2c[_0x8e27('0x3')](_0x5f3184,_0x2f8746);};}function removeListener(_0x42fae8,_0x1fbbb6){return function(){FaxInteractionEvents[_0x8e27('0x4')](_0x42fae8,_0x1fbbb6);};}exports[_0x8e27('0x5')]=function(_0x5a734b){for(var _0x59f5ab=0x0,_0xaa63a9=events[_0x8e27('0x6')];_0x59f5ab<_0xaa63a9;_0x59f5ab++){var _0x5b0dd4=events[_0x59f5ab];var _0x3881ba=createListener(_0x8e27('0x7')+_0x5b0dd4,_0x5a734b);FaxInteractionEvents['on'](_0x5b0dd4,_0x3881ba);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4caa25a..8d3bc04 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 _0x34a9=['faxinteraction:update','update','delete','faxinteraction:destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x34a9,0x148));var _0x934a=function(_0x57486e,_0x29810e){_0x57486e=_0x57486e-0x0;var _0x40a585=_0x34a9[_0x57486e];return _0x40a585;};'use strict';var multer=require(_0x934a('0x0'));var util=require(_0x934a('0x1'));var path=require('path');var timeout=require(_0x934a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x934a('0x3'));var auth=require(_0x934a('0x4'));var interaction=require(_0x934a('0x5'));var config=require('../../config/environment');var controller=require(_0x934a('0x6'));router[_0x934a('0x7')]('/',auth[_0x934a('0x8')](),controller[_0x934a('0x9')]);router[_0x934a('0x7')](_0x934a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x934a('0x7')](_0x934a('0xb'),auth[_0x934a('0x8')](),controller[_0x934a('0xc')]);router[_0x934a('0x7')](_0x934a('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x934a('0xe'),auth[_0x934a('0x8')](),controller[_0x934a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x934a('0x10')]('/:id/messages',auth[_0x934a('0x8')](),controller['addMessage']);router[_0x934a('0x10')](_0x934a('0x11'),auth['isAuthenticated'](),interaction[_0x934a('0x12')](_0x934a('0x13'),_0x934a('0x14')),controller[_0x934a('0x15')]);router[_0x934a('0x16')](_0x934a('0xb'),auth[_0x934a('0x8')](),interaction[_0x934a('0x12')]('fax',_0x934a('0x17')),controller[_0x934a('0x18')]);router[_0x934a('0x19')](_0x934a('0xb'),auth[_0x934a('0x8')](),interaction['tracked'](_0x934a('0x13'),_0x934a('0x1a')),controller['destroy']);router['delete'](_0x934a('0x11'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x3512=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index'];(function(_0x2378ef,_0x1b182e){var _0x9dc6fb=function(_0x4ce9e0){while(--_0x4ce9e0){_0x2378ef['push'](_0x2378ef['shift']());}};_0x9dc6fb(++_0x1b182e);}(_0x3512,0x9e));var _0x2351=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3512[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x2351('0x0'));var util=require(_0x2351('0x1'));var path=require(_0x2351('0x2'));var timeout=require(_0x2351('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2351('0x4'));var auth=require(_0x2351('0x5'));var interaction=require(_0x2351('0x6'));var config=require(_0x2351('0x7'));var controller=require(_0x2351('0x8'));router[_0x2351('0x9')]('/',auth[_0x2351('0xa')](),controller[_0x2351('0xb')]);router['get'](_0x2351('0xc'),auth[_0x2351('0xa')](),controller[_0x2351('0xd')]);router['get'](_0x2351('0xe'),auth[_0x2351('0xa')](),controller[_0x2351('0xf')]);router[_0x2351('0x9')](_0x2351('0x10'),auth[_0x2351('0xa')](),controller[_0x2351('0x11')]);router[_0x2351('0x9')](_0x2351('0x12'),auth[_0x2351('0xa')](),controller[_0x2351('0x13')]);router[_0x2351('0x14')]('/',auth[_0x2351('0xa')](),controller['create']);router['post']('/:id/messages',auth[_0x2351('0xa')](),controller[_0x2351('0x15')]);router[_0x2351('0x14')](_0x2351('0x16'),auth[_0x2351('0xa')](),interaction['tracked'](_0x2351('0x17'),_0x2351('0x18')),controller[_0x2351('0x19')]);router['put'](_0x2351('0xe'),auth[_0x2351('0xa')](),interaction[_0x2351('0x1a')](_0x2351('0x17'),_0x2351('0x1b')),controller[_0x2351('0x1c')]);router[_0x2351('0x1d')](_0x2351('0xe'),auth['isAuthenticated'](),interaction[_0x2351('0x1a')](_0x2351('0x17'),_0x2351('0x1e')),controller[_0x2351('0x1f')]);router['delete'](_0x2351('0x16'),auth[_0x2351('0xa')](),controller[_0x2351('0x20')]);module[_0x2351('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d0fc12a..0e0622c 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 _0xe829=['TEXT','ENUM','out','DATE','sequelize','exports'];(function(_0x3b45c5,_0x1b1d6a){var _0x4aacb2=function(_0x5166cd){while(--_0x5166cd){_0x3b45c5['push'](_0x3b45c5['shift']());}};_0x4aacb2(++_0x1b1d6a);}(_0xe829,0x1d8));var _0x9e82=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0xe829[_0x43f47b];return _0x4af9a6;};'use strict';var Sequelize=require(_0x9e82('0x0'));module[_0x9e82('0x1')]={'body':{'type':Sequelize[_0x9e82('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e82('0x3')]('in',_0x9e82('0x4')),'defaultValue':_0x9e82('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9e82('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9e82('0x5')]}}; \ No newline at end of file +var _0x37f8=['exports','TEXT','medium','BOOLEAN','out'];(function(_0x5579f0,_0xfaca02){var _0x536e34=function(_0x36eece){while(--_0x36eece){_0x5579f0['push'](_0x5579f0['shift']());}};_0x536e34(++_0xfaca02);}(_0x37f8,0xd2));var _0x837f=function(_0x48b571,_0x5ee15a){_0x48b571=_0x48b571-0x0;var _0x572512=_0x37f8[_0x48b571];return _0x572512;};'use strict';var Sequelize=require('sequelize');module[_0x837f('0x0')]={'body':{'type':Sequelize[_0x837f('0x1')](_0x837f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x837f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x837f('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 0a468be..09b2639 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 _0x0617=['internal','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','FaxInteraction','FaxInteractionId','RejectMessage','rejectMessage','QueryTypes','event','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','server','files','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./faxMessage.socket','register','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','include','then','rows','show','params','includeAll','find','update','body','describe','fax-interactions','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','isNil','format','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','agent','fullname','email'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x0617,0x1c6));var _0x7061=function(_0x4fd791,_0x180648){_0x4fd791=_0x4fd791-0x0;var _0x30c89e=_0x0617[_0x4fd791];return _0x30c89e;};'use strict';var emlformat=require(_0x7061('0x0'));var rimraf=require(_0x7061('0x1'));var zipdir=require(_0x7061('0x2'));var jsonpatch=require(_0x7061('0x3'));var rp=require(_0x7061('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7061('0x5'));var path=require(_0x7061('0x6'));var sox=require('sox');var csv=require(_0x7061('0x7'));var ejs=require(_0x7061('0x8'));var fs=require('fs');var fs_extra=require(_0x7061('0x9'));var _=require(_0x7061('0xa'));var squel=require('squel');var crypto=require(_0x7061('0xb'));var jsforce=require(_0x7061('0xc'));var deskjs=require(_0x7061('0xd'));var toCsv=require(_0x7061('0x7'));var querystring=require(_0x7061('0xe'));var Papa=require(_0x7061('0xf'));var Redis=require(_0x7061('0x10'));var authService=require(_0x7061('0x11'));var qs=require(_0x7061('0x12'));var as=require(_0x7061('0x13'));var hardwareService=require(_0x7061('0x14'));var logger=require(_0x7061('0x15'))('api');var utils=require(_0x7061('0x16'));var config=require(_0x7061('0x17'));var licenseUtil=require(_0x7061('0x18'));var db=require(_0x7061('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7061('0x1a'))(new Redis(config['redis']));require(_0x7061('0x1b'))[_0x7061('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x7061('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x36e046,_0x5965ee,_0xcbaca6,_0x5b00a9){return new BPromise(function(_0x47fe48,_0x56ab46){var _0x3d5ea4=_0x5b00a9||client;return _0x3d5ea4[_0x7061('0x1e')](_0x36e046,_0xcbaca6)['then'](function(_0x1ba08c){logger[_0x7061('0x1f')](_0x7061('0x20'),_0x5965ee,'request\x20sent');logger[_0x7061('0x21')](_0x7061('0x22'),_0x5965ee,_0x7061('0x23'),JSON['stringify'](_0x1ba08c));if(_0x1ba08c[_0x7061('0x24')]){if(_0x1ba08c[_0x7061('0x24')][_0x7061('0x25')]===0x1f4){logger[_0x7061('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5965ee,_0x1ba08c['error']['message']);return _0x56ab46(_0x1ba08c['error'][_0x7061('0x26')]);}logger[_0x7061('0x24')](_0x7061('0x20'),_0x5965ee,_0x1ba08c[_0x7061('0x24')][_0x7061('0x26')]);return _0x47fe48(_0x1ba08c[_0x7061('0x24')][_0x7061('0x26')]);}else{logger['info'](_0x7061('0x20'),_0x5965ee,'request\x20sent');_0x47fe48(_0x1ba08c[_0x7061('0x27')][_0x7061('0x26')]);}})[_0x7061('0x28')](function(_0x20cbc7){logger[_0x7061('0x24')]('FaxMessage,\x20%s,\x20%s',_0x5965ee,_0x20cbc7);_0x56ab46(_0x20cbc7);});});}function respondWithStatusCode(_0x1bb23b,_0x43e344){_0x43e344=_0x43e344||0xcc;return function(_0x4a63b3){if(_0x4a63b3){return _0x1bb23b[_0x7061('0x29')](_0x43e344);}return _0x1bb23b[_0x7061('0x2a')](_0x43e344)[_0x7061('0x2b')]();};}function respondWithResult(_0x5dec6a,_0x5e2544){_0x5e2544=_0x5e2544||0xc8;return function(_0x28add9){if(_0x28add9){return _0x5dec6a[_0x7061('0x2a')](_0x5e2544)[_0x7061('0x2c')](_0x28add9);}};}function respondWithFilteredResult(_0x51f33f,_0x547664){return function(_0x5f3a91){if(_0x5f3a91){var _0x56d619=typeof _0x547664[_0x7061('0x2d')]===_0x7061('0x2e')&&typeof _0x547664[_0x7061('0x2f')]===_0x7061('0x2e');var _0x369b82=_0x5f3a91['count'];var _0xcafb5c=_0x56d619?0x0:_0x547664[_0x7061('0x2d')];var _0x18e75f=_0x56d619?_0x5f3a91[_0x7061('0x30')]:_0x547664[_0x7061('0x2d')]+_0x547664['limit'];var _0x14b3dc;if(_0x18e75f>=_0x369b82){_0x18e75f=_0x369b82;_0x14b3dc=0xc8;}else{_0x14b3dc=0xce;}_0x51f33f[_0x7061('0x2a')](_0x14b3dc);return _0x51f33f[_0x7061('0x31')]('Content-Range',_0xcafb5c+'-'+_0x18e75f+'/'+_0x369b82)[_0x7061('0x2c')](_0x5f3a91);}return null;};}function patchUpdates(_0x5bb661){return function(_0x37f5ab){try{jsonpatch[_0x7061('0x32')](_0x37f5ab,_0x5bb661,!![]);}catch(_0x2bdd4b){return BPromise[_0x7061('0x33')](_0x2bdd4b);}return _0x37f5ab[_0x7061('0x34')]();};}function saveUpdates(_0x5e51c5,_0x3251db){return function(_0x2d8936){if(_0x2d8936){return _0x2d8936['update'](_0x5e51c5)['then'](function(_0x1d9047){return _0x1d9047;});}return null;};}function removeEntity(_0x7843ec,_0x1f4d9f){return function(_0x192732){if(_0x192732){return _0x192732[_0x7061('0x35')]()['then'](function(){_0x7843ec[_0x7061('0x2a')](0xcc)[_0x7061('0x2b')]();});}};}function handleEntityNotFound(_0x398f88,_0x4c85a3){return function(_0x418d97){if(!_0x418d97){_0x398f88[_0x7061('0x29')](0x194);}return _0x418d97;};}function handleError(_0x1636ce,_0x468503){_0x468503=_0x468503||0x1f4;return function(_0x17acac){logger[_0x7061('0x24')](_0x17acac[_0x7061('0x36')]);if(_0x17acac[_0x7061('0x37')]){delete _0x17acac['name'];}_0x1636ce[_0x7061('0x2a')](_0x468503)[_0x7061('0x38')](_0x17acac);};}exports[_0x7061('0x39')]=function(_0x18d78c,_0x141c7f){var _0x1a6aa1={},_0x1375b0={},_0x131e6c={'count':0x0,'rows':[]};var _0x282c1f=_[_0x7061('0x3a')](db['FaxMessage'][_0x7061('0x3b')],function(_0x5688a0){return{'name':_0x5688a0[_0x7061('0x3c')],'type':_0x5688a0[_0x7061('0x3d')][_0x7061('0x3e')]};});_0x1375b0[_0x7061('0x3f')]=_[_0x7061('0x3a')](_0x282c1f,_0x7061('0x37'));_0x1375b0[_0x7061('0x40')]=_[_0x7061('0x41')](_0x18d78c['query']);_0x1375b0[_0x7061('0x42')]=_[_0x7061('0x43')](_0x1375b0[_0x7061('0x3f')],_0x1375b0[_0x7061('0x40')]);_0x1a6aa1[_0x7061('0x44')]=_[_0x7061('0x43')](_0x1375b0[_0x7061('0x3f')],qs['fields'](_0x18d78c[_0x7061('0x40')][_0x7061('0x45')]));_0x1a6aa1[_0x7061('0x44')]=_0x1a6aa1[_0x7061('0x44')][_0x7061('0x46')]?_0x1a6aa1[_0x7061('0x44')]:_0x1375b0['model'];if(!_0x18d78c[_0x7061('0x40')][_0x7061('0x47')]('nolimit')){_0x1a6aa1['limit']=qs[_0x7061('0x2f')](_0x18d78c['query'][_0x7061('0x2f')]);_0x1a6aa1[_0x7061('0x2d')]=qs[_0x7061('0x2d')](_0x18d78c['query'][_0x7061('0x2d')]);}_0x1a6aa1[_0x7061('0x48')]=qs['sort'](_0x18d78c[_0x7061('0x40')][_0x7061('0x49')]);_0x1a6aa1[_0x7061('0x4a')]=qs[_0x7061('0x42')](_[_0x7061('0x4b')](_0x18d78c['query'],_0x1375b0['filters']),_0x282c1f);if(_0x18d78c[_0x7061('0x40')][_0x7061('0x4c')]){_0x1a6aa1[_0x7061('0x4a')]=_[_0x7061('0x4d')](_0x1a6aa1[_0x7061('0x4a')],{'$or':_[_0x7061('0x3a')](_0x282c1f,function(_0x43bdda){if(_0x43bdda[_0x7061('0x3d')]!==_0x7061('0x4e')){var _0x488928={};_0x488928[_0x43bdda[_0x7061('0x37')]]={'$like':'%'+_0x18d78c[_0x7061('0x40')][_0x7061('0x4c')]+'%'};return _0x488928;}})});}_0x1a6aa1=_[_0x7061('0x4d')]({},_0x1a6aa1,_0x18d78c[_0x7061('0x4f')]);var _0x34a47d={'where':_0x1a6aa1[_0x7061('0x4a')]};return db[_0x7061('0x50')][_0x7061('0x30')](_0x34a47d)['then'](function(_0xbab31f){_0x131e6c['count']=_0xbab31f;if(_0x18d78c[_0x7061('0x40')]['includeAll']){_0x1a6aa1[_0x7061('0x51')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1a6aa1);})[_0x7061('0x52')](function(_0xb4c0db){_0x131e6c[_0x7061('0x53')]=_0xb4c0db;return _0x131e6c;})[_0x7061('0x52')](respondWithFilteredResult(_0x141c7f,_0x1a6aa1))[_0x7061('0x28')](handleError(_0x141c7f,null));};exports[_0x7061('0x54')]=function(_0x12377e,_0x105f15){var _0x47c71f={'raw':!![],'where':{'id':_0x12377e[_0x7061('0x55')]['id']}},_0x3601cb={};_0x3601cb[_0x7061('0x3f')]=_[_0x7061('0x41')](db[_0x7061('0x50')][_0x7061('0x3b')]);_0x3601cb[_0x7061('0x40')]=_[_0x7061('0x41')](_0x12377e[_0x7061('0x40')]);_0x3601cb['filters']=_[_0x7061('0x43')](_0x3601cb[_0x7061('0x3f')],_0x3601cb[_0x7061('0x40')]);_0x47c71f[_0x7061('0x44')]=_[_0x7061('0x43')](_0x3601cb[_0x7061('0x3f')],qs[_0x7061('0x45')](_0x12377e['query']['fields']));_0x47c71f['attributes']=_0x47c71f[_0x7061('0x44')][_0x7061('0x46')]?_0x47c71f[_0x7061('0x44')]:_0x3601cb[_0x7061('0x3f')];if(_0x12377e[_0x7061('0x40')][_0x7061('0x56')]){_0x47c71f[_0x7061('0x51')]=[{'all':!![]}];}_0x47c71f=_[_0x7061('0x4d')]({},_0x47c71f,_0x12377e[_0x7061('0x4f')]);return db['FaxMessage'][_0x7061('0x57')](_0x47c71f)['then'](handleEntityNotFound(_0x105f15,null))[_0x7061('0x52')](respondWithResult(_0x105f15,null))['catch'](handleError(_0x105f15,null));};exports[_0x7061('0x58')]=function(_0x3d73cc,_0x188415){if(_0x3d73cc[_0x7061('0x59')]['id']){delete _0x3d73cc[_0x7061('0x59')]['id'];}return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x3d73cc[_0x7061('0x55')]['id']}})[_0x7061('0x52')](handleEntityNotFound(_0x188415,null))['then'](saveUpdates(_0x3d73cc[_0x7061('0x59')],null))[_0x7061('0x52')](respondWithResult(_0x188415,null))[_0x7061('0x28')](handleError(_0x188415,null));};exports[_0x7061('0x35')]=function(_0x311a8a,_0x6ac885){return db['FaxMessage']['find']({'where':{'id':_0x311a8a[_0x7061('0x55')]['id']}})['then'](handleEntityNotFound(_0x6ac885,null))[_0x7061('0x52')](removeEntity(_0x6ac885,null))[_0x7061('0x28')](handleError(_0x6ac885,null));};exports[_0x7061('0x5a')]=function(_0x21e766,_0xf55c7c){return db['FaxMessage'][_0x7061('0x5a')]()[_0x7061('0x52')](respondWithResult(_0xf55c7c,null))[_0x7061('0x28')](handleError(_0xf55c7c,null));};var interaction_log=require('../../config/logger')(_0x7061('0x5b'));exports['accept']=function(_0x5deba4,_0x40e97d,_0x55abbd){var _0x27c186={'agent':{},'channel':_0x7061('0x5c')};if(_0x5deba4[_0x7061('0x59')]['id']){delete _0x5deba4[_0x7061('0x59')]['id'];}_0x5deba4[_0x7061('0x59')]['read']=!![];_0x5deba4[_0x7061('0x59')][_0x7061('0x5d')]=moment()['format'](_0x7061('0x5e'));_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')]=_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')]||_0x5deba4['user']['id'];_0x27c186['agent']['id']=_0x5deba4[_0x7061('0x59')]['UserId'];return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x5deba4[_0x7061('0x55')]['id'],'UserId':null}})[_0x7061('0x52')](handleEntityNotFound(_0x40e97d,null))[_0x7061('0x52')](saveUpdates(_0x5deba4['body'],null))['then'](function(_0x27f4e6){if(_0x27f4e6){_0x27c186[_0x7061('0x26')]=_0x27f4e6['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x27f4e6['FaxInteractionId']}});}return null;})[_0x7061('0x52')](handleEntityNotFound(_0x40e97d,null))['then'](function(_0x166c59){if(_0x166c59){return _0x166c59[_0x7061('0x58')]({'UserId':_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')],'read1stAt':_[_0x7061('0x60')](_0x166c59['read1stAt'])?moment()[_0x7061('0x61')](_0x7061('0x5e')):undefined});}return null;})[_0x7061('0x52')](function(_0x312657){if(_0x312657){_0x27c186[_0x7061('0x62')]=_0x312657[_0x7061('0x63')]({'plain':!![]});interaction_log['info'](_0x7061('0x64'),_0x5deba4[_0x7061('0x65')]['id'],_0x5deba4[_0x7061('0x65')][_0x7061('0x37')],_0x5deba4[_0x7061('0x65')][_0x7061('0x66')],_0x27c186['interaction']['id'],_0x5deba4[_0x7061('0x59')]?JSON[_0x7061('0x67')](_0x5deba4[_0x7061('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0x7061('0x68'),_0x27c186);}return null;})[_0x7061('0x52')](function(_0x4df5ac){var _0x19dc2b=_0x7061('0x69')+_0x4df5ac[_0x7061('0x26')][_0x7061('0x6a')];return db[_0x7061('0x6b')]['query'](_0x19dc2b,{'type':db[_0x7061('0x6c')]['QueryTypes'][_0x7061('0x6d')],'raw':!![]})['then'](function(_0x9fa385){return _0x9fa385;});})['then'](function(_0x520d49){if(_0x520d49){_0x27c186[_0x7061('0x26')][_0x7061('0x6e')]=_0x520d49[0x0];if(!_0x5deba4[_0x7061('0x59')]['UserId'])return;return db['User'][_0x7061('0x57')]({'where':{'id':_0x5deba4[_0x7061('0x59')][_0x7061('0x5f')],'role':_0x7061('0x6f')},'attributes':['id','name',_0x7061('0x70'),_0x7061('0x71'),_0x7061('0x72')],'raw':!![]});}return null;})['then'](function(_0x5bea86){if(!_0x5bea86)return null;_0x27c186[_0x7061('0x26')][_0x7061('0x6f')]=_0x5bea86;return _0x27c186;})[_0x7061('0x52')](function(_0x319e76){if(_0x319e76){if(_0x5deba4[_0x7061('0x59')][_0x7061('0x73')]){_0x27c186[_0x7061('0x26')][_0x7061('0x74')]=util[_0x7061('0x61')](_0x7061('0x75'),_0x5deba4[_0x7061('0x65')][_0x7061('0x37')]);_0x27c186[_0x7061('0x26')][_0x7061('0x76')]=_0x27c186[_0x7061('0x76')];_0x27c186[_0x7061('0x26')][_0x7061('0x77')]=_0x27c186[_0x7061('0x76')];_0x27c186[_0x7061('0x26')]['event']=_0x7061('0x78');return respondWithRpcPromise('EventManager',_0x7061('0x79'),{'event':_0x7061('0x7a'),'message':_0x27c186[_0x7061('0x26')]},client9002)['then'](function(){return _0x27c186;});}return _0x27c186;}return null;})[_0x7061('0x52')](respondWithResult(_0x40e97d,null))[_0x7061('0x28')](handleError(_0x40e97d,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x7061('0x33')]=function(_0x561fa5,_0x592a29,_0x5077f2){var _0x45dbe1={'agent':{},'channel':'fax'};if(_0x561fa5[_0x7061('0x59')]['id']){delete _0x561fa5['body']['id'];}_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')]=_0x561fa5[_0x7061('0x59')]['UserId']||_0x561fa5[_0x7061('0x65')]['id'];_0x45dbe1[_0x7061('0x6f')]['id']=_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')];return db[_0x7061('0x50')][_0x7061('0x57')]({'where':{'id':_0x561fa5[_0x7061('0x55')]['id'],'UserId':null}})[_0x7061('0x52')](handleEntityNotFound(_0x592a29,null))[_0x7061('0x52')](function(_0x14a252){if(_0x14a252){_0x45dbe1['message']=_0x14a252['get']({'plain':!![]});return db[_0x7061('0x7b')]['find']({'where':{'id':_0x14a252[_0x7061('0x7c')]}});}return null;})[_0x7061('0x52')](handleEntityNotFound(_0x592a29,null))[_0x7061('0x52')](function(_0x5ad14d){if(_0x5ad14d){_0x45dbe1['interaction']=_0x5ad14d[_0x7061('0x63')]({'plain':!![]});interaction_log[_0x7061('0x1f')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x561fa5[_0x7061('0x65')]['id'],_0x561fa5[_0x7061('0x65')][_0x7061('0x37')],_0x561fa5[_0x7061('0x65')][_0x7061('0x66')],_0x45dbe1[_0x7061('0x62')]['id'],_0x561fa5[_0x7061('0x59')]?JSON[_0x7061('0x67')](_0x561fa5[_0x7061('0x59')]):'null');return respondWithRpcPromise(_0x7061('0x7d'),_0x7061('0x7e'),_0x45dbe1);}return null;})[_0x7061('0x52')](function(_0x36971a){var _0x4c4eee=_0x7061('0x69')+_0x36971a[_0x7061('0x26')][_0x7061('0x6a')];return db[_0x7061('0x6b')][_0x7061('0x40')](_0x4c4eee,{'type':db[_0x7061('0x6c')][_0x7061('0x7f')][_0x7061('0x6d')],'raw':!![]})[_0x7061('0x52')](function(_0x40f83b){return _0x40f83b;});})[_0x7061('0x52')](function(_0xbe8e0a){if(_0xbe8e0a){_0x45dbe1[_0x7061('0x26')][_0x7061('0x6e')]=_0xbe8e0a[0x0];if(!_0x561fa5['body'][_0x7061('0x5f')])return;return db['User']['find']({'where':{'id':_0x561fa5[_0x7061('0x59')][_0x7061('0x5f')],'role':_0x7061('0x6f')},'attributes':['id',_0x7061('0x37'),_0x7061('0x70'),_0x7061('0x71'),_0x7061('0x72')],'raw':!![]});}return null;})[_0x7061('0x52')](function(_0x387593){if(!_0x387593)return null;_0x45dbe1[_0x7061('0x26')]['agent']=_0x387593;return _0x45dbe1;})['then'](function(_0x192135){if(_0x192135){_0x192135[_0x7061('0x26')]['interface']=util[_0x7061('0x61')](_0x7061('0x75'),_0x561fa5[_0x7061('0x65')][_0x7061('0x37')]);_0x192135[_0x7061('0x26')][_0x7061('0x76')]=_0x45dbe1[_0x7061('0x76')];_0x192135[_0x7061('0x26')][_0x7061('0x77')]=_0x45dbe1[_0x7061('0x76')];_0x192135['message'][_0x7061('0x80')]=_0x7061('0x33');respondWithRpcPromise(_0x7061('0x79'),_0x7061('0x79'),{'event':_0x7061('0x81'),'message':_0x192135['message']},client9002);return _0x45dbe1;}return null;})[_0x7061('0x52')](respondWithResult(_0x592a29,null))[_0x7061('0x28')](handleError(_0x592a29,null));};exports[_0x7061('0x82')]=function(_0x6a4766,_0x3c9095){var _0x3ebfd5;return db['FaxMessage'][_0x7061('0x82')](_0x6a4766[_0x7061('0x59')],{})[_0x7061('0x52')](function(_0x5acc90){_0x3ebfd5=_0x5acc90;return db[_0x7061('0x83')]['findOne']({'where':{'id':_0x3ebfd5[_0x7061('0x6a')]}});})[_0x7061('0x52')](function(_0x2c10de){if(_[_0x7061('0x60')](_0x2c10de)){return;}else{_0x3ebfd5['fax']=_0x2c10de[_0x7061('0x5c')];return db[_0x7061('0x84')][_0x7061('0x85')]({'where':{'id':_0x3ebfd5[_0x7061('0x86')]}});}})[_0x7061('0x52')](function(_0x10d7ba){return respondWithRpcPromise('SendFax',_0x7061('0x87'),{'FaxAccountId':_['isNil'](_0x6a4766[_0x7061('0x59')])?undefined:_0x6a4766[_0x7061('0x59')][_0x7061('0x88')],'path':_[_0x7061('0x60')](_0x10d7ba)?undefined:util[_0x7061('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x10d7ba[_0x7061('0x89')]),'fax':_[_0x7061('0x60')](_0x3ebfd5[_0x7061('0x5c')])?undefined:_0x3ebfd5['fax'],'AttachmentId':_0x3ebfd5[_0x7061('0x86')]},client9002);})[_0x7061('0x52')](respondWithResult(_0x3c9095,0xc9))[_0x7061('0x28')](handleError(_0x3c9095,null));};exports[_0x7061('0x8a')]=function(_0x2d50dc,_0x21de01){var _0x2cb843=path['join'](config['root'],_0x7061('0x8b'),_0x7061('0x8c'),'attachments');return db[_0x7061('0x50')]['find']({'where':{'id':_0x2d50dc[_0x7061('0x55')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x21de01,null))[_0x7061('0x52')](function(_0xb8c157){if(_0xb8c157){return _0x21de01[_0x7061('0x8a')](path[_0x7061('0x8d')](_0x2cb843,_0xb8c157['Attachment'][_0x7061('0x89')]));}})[_0x7061('0x28')](handleError(_0x21de01,null));}; \ No newline at end of file +var _0xbf9e=['crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','debug','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','length','update','body','find','params','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','QueryTypes','contact','email','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','download','join','root','attachments','basename','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel'];(function(_0x290671,_0x950a0e){var _0xb40715=function(_0x637fe7){while(--_0x637fe7){_0x290671['push'](_0x290671['shift']());}};_0xb40715(++_0x950a0e);}(_0xbf9e,0x80));var _0xebf9=function(_0x1fd1a3,_0x26f1bf){_0x1fd1a3=_0x1fd1a3-0x0;var _0x3d02d3=_0xbf9e[_0x1fd1a3];return _0x3d02d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebf9('0x0'));var zipdir=require(_0xebf9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xebf9('0x2'));var BPromise=require(_0xebf9('0x3'));var Mustache=require(_0xebf9('0x4'));var util=require(_0xebf9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebf9('0x6'));var fs=require('fs');var fs_extra=require(_0xebf9('0x7'));var _=require(_0xebf9('0x8'));var squel=require(_0xebf9('0x9'));var crypto=require(_0xebf9('0xa'));var jsforce=require(_0xebf9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebf9('0xc'));var Papa=require(_0xebf9('0xd'));var Redis=require(_0xebf9('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebf9('0xf'));var logger=require('../../config/logger')(_0xebf9('0x10'));var utils=require(_0xebf9('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xebf9('0x12'))['db'];config[_0xebf9('0x13')]=_[_0xebf9('0x14')](config[_0xebf9('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xebf9('0x15'))(new Redis(config[_0xebf9('0x13')]));require(_0xebf9('0x16'))[_0xebf9('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xebf9('0x18')][_0xebf9('0x19')]({'port':0x232c});var client9002=jayson[_0xebf9('0x18')][_0xebf9('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x288a1c,_0x32e328,_0xad94cb,_0x3bfb8b){return new BPromise(function(_0x5f4506,_0x546ae4){var _0x14f919=_0x3bfb8b||client;return _0x14f919['request'](_0x288a1c,_0xad94cb)[_0xebf9('0x1a')](function(_0x139e46){logger[_0xebf9('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x32e328,'request\x20sent');logger[_0xebf9('0x1c')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x32e328,_0xebf9('0x1d'),JSON['stringify'](_0x139e46));if(_0x139e46[_0xebf9('0x1e')]){if(_0x139e46[_0xebf9('0x1e')][_0xebf9('0x1f')]===0x1f4){logger[_0xebf9('0x1e')](_0xebf9('0x20'),_0x32e328,_0x139e46['error'][_0xebf9('0x21')]);return _0x546ae4(_0x139e46[_0xebf9('0x1e')][_0xebf9('0x21')]);}logger['error'](_0xebf9('0x20'),_0x32e328,_0x139e46[_0xebf9('0x1e')][_0xebf9('0x21')]);return _0x5f4506(_0x139e46[_0xebf9('0x1e')][_0xebf9('0x21')]);}else{logger[_0xebf9('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x32e328,_0xebf9('0x1d'));_0x5f4506(_0x139e46[_0xebf9('0x22')]['message']);}})[_0xebf9('0x23')](function(_0x41fb9e){logger[_0xebf9('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x32e328,_0x41fb9e);_0x546ae4(_0x41fb9e);});});}function respondWithStatusCode(_0x5f0188,_0x1e7599){_0x1e7599=_0x1e7599||0xcc;return function(_0x32193c){if(_0x32193c){return _0x5f0188[_0xebf9('0x24')](_0x1e7599);}return _0x5f0188[_0xebf9('0x25')](_0x1e7599)[_0xebf9('0x26')]();};}function respondWithResult(_0x2e84de,_0x51e8c8){_0x51e8c8=_0x51e8c8||0xc8;return function(_0x12bcea){if(_0x12bcea){return _0x2e84de['status'](_0x51e8c8)[_0xebf9('0x27')](_0x12bcea);}};}function respondWithFilteredResult(_0x312e01,_0x39c6fe){return function(_0x28f5dd){if(_0x28f5dd){var _0x48b31f=typeof _0x39c6fe[_0xebf9('0x28')]===_0xebf9('0x29')&&typeof _0x39c6fe[_0xebf9('0x2a')]===_0xebf9('0x29');var _0x3aa128=_0x28f5dd[_0xebf9('0x2b')];var _0x152b4=_0x48b31f?0x0:_0x39c6fe[_0xebf9('0x28')];var _0x12c876=_0x48b31f?_0x28f5dd[_0xebf9('0x2b')]:_0x39c6fe[_0xebf9('0x28')]+_0x39c6fe[_0xebf9('0x2a')];var _0x1f1754;if(_0x12c876>=_0x3aa128){_0x12c876=_0x3aa128;_0x1f1754=0xc8;}else{_0x1f1754=0xce;}_0x312e01[_0xebf9('0x25')](_0x1f1754);return _0x312e01['set'](_0xebf9('0x2c'),_0x152b4+'-'+_0x12c876+'/'+_0x3aa128)[_0xebf9('0x27')](_0x28f5dd);}return null;};}function patchUpdates(_0x3ed4e4){return function(_0x50b719){try{jsonpatch[_0xebf9('0x2d')](_0x50b719,_0x3ed4e4,!![]);}catch(_0x2b121e){return BPromise['reject'](_0x2b121e);}return _0x50b719[_0xebf9('0x2e')]();};}function saveUpdates(_0x52db66,_0x5aaf23){return function(_0x5f0eeb){if(_0x5f0eeb){return _0x5f0eeb['update'](_0x52db66)['then'](function(_0x289b67){return _0x289b67;});}return null;};}function removeEntity(_0x1cc445,_0x3d5784){return function(_0x439d87){if(_0x439d87){return _0x439d87[_0xebf9('0x2f')]()[_0xebf9('0x1a')](function(){_0x1cc445[_0xebf9('0x25')](0xcc)[_0xebf9('0x26')]();});}};}function handleEntityNotFound(_0x3655d7,_0x4f43e2){return function(_0x19f755){if(!_0x19f755){_0x3655d7[_0xebf9('0x24')](0x194);}return _0x19f755;};}function handleError(_0x121e95,_0x81c324){_0x81c324=_0x81c324||0x1f4;return function(_0x4de466){logger[_0xebf9('0x1e')](_0x4de466[_0xebf9('0x30')]);if(_0x4de466[_0xebf9('0x31')]){delete _0x4de466[_0xebf9('0x31')];}_0x121e95[_0xebf9('0x25')](_0x81c324)[_0xebf9('0x32')](_0x4de466);};}exports[_0xebf9('0x33')]=function(_0x26d20d,_0x718e27){var _0x2454cf={},_0x43eb31={},_0x15d3c8={'count':0x0,'rows':[]};var _0x3dd801=_[_0xebf9('0x34')](db[_0xebf9('0x35')]['rawAttributes'],function(_0x2bedf1){return{'name':_0x2bedf1[_0xebf9('0x36')],'type':_0x2bedf1[_0xebf9('0x37')][_0xebf9('0x38')]};});_0x43eb31[_0xebf9('0x39')]=_[_0xebf9('0x34')](_0x3dd801,'name');_0x43eb31[_0xebf9('0x3a')]=_['keys'](_0x26d20d['query']);_0x43eb31[_0xebf9('0x3b')]=_[_0xebf9('0x3c')](_0x43eb31[_0xebf9('0x39')],_0x43eb31[_0xebf9('0x3a')]);_0x2454cf[_0xebf9('0x3d')]=_[_0xebf9('0x3c')](_0x43eb31['model'],qs[_0xebf9('0x3e')](_0x26d20d[_0xebf9('0x3a')][_0xebf9('0x3e')]));_0x2454cf[_0xebf9('0x3d')]=_0x2454cf[_0xebf9('0x3d')]['length']?_0x2454cf['attributes']:_0x43eb31[_0xebf9('0x39')];if(!_0x26d20d['query'][_0xebf9('0x3f')](_0xebf9('0x40'))){_0x2454cf[_0xebf9('0x2a')]=qs['limit'](_0x26d20d[_0xebf9('0x3a')]['limit']);_0x2454cf['offset']=qs[_0xebf9('0x28')](_0x26d20d[_0xebf9('0x3a')][_0xebf9('0x28')]);}_0x2454cf[_0xebf9('0x41')]=qs[_0xebf9('0x42')](_0x26d20d[_0xebf9('0x3a')]['sort']);_0x2454cf[_0xebf9('0x43')]=qs[_0xebf9('0x3b')](_[_0xebf9('0x44')](_0x26d20d['query'],_0x43eb31[_0xebf9('0x3b')]),_0x3dd801);if(_0x26d20d['query'][_0xebf9('0x45')]){_0x2454cf[_0xebf9('0x43')]=_[_0xebf9('0x46')](_0x2454cf['where'],{'$or':_[_0xebf9('0x34')](_0x3dd801,function(_0xc2da05){if(_0xc2da05[_0xebf9('0x37')]!==_0xebf9('0x47')){var _0x491cf5={};_0x491cf5[_0xc2da05[_0xebf9('0x31')]]={'$like':'%'+_0x26d20d[_0xebf9('0x3a')][_0xebf9('0x45')]+'%'};return _0x491cf5;}})});}_0x2454cf=_[_0xebf9('0x46')]({},_0x2454cf,_0x26d20d[_0xebf9('0x48')]);var _0x5b63ad={'where':_0x2454cf[_0xebf9('0x43')]};return db[_0xebf9('0x35')][_0xebf9('0x2b')](_0x5b63ad)[_0xebf9('0x1a')](function(_0x3a50ea){_0x15d3c8[_0xebf9('0x2b')]=_0x3a50ea;if(_0x26d20d[_0xebf9('0x3a')][_0xebf9('0x49')]){_0x2454cf[_0xebf9('0x4a')]=[{'all':!![]}];}return db[_0xebf9('0x35')]['findAll'](_0x2454cf);})['then'](function(_0x21cc8a){_0x15d3c8[_0xebf9('0x4b')]=_0x21cc8a;return _0x15d3c8;})['then'](respondWithFilteredResult(_0x718e27,_0x2454cf))[_0xebf9('0x23')](handleError(_0x718e27,null));};exports[_0xebf9('0x4c')]=function(_0x57d40a,_0x9a871c){var _0x47487b={'raw':!![],'where':{'id':_0x57d40a['params']['id']}},_0x458aa0={};_0x458aa0[_0xebf9('0x39')]=_[_0xebf9('0x4d')](db[_0xebf9('0x35')]['rawAttributes']);_0x458aa0[_0xebf9('0x3a')]=_[_0xebf9('0x4d')](_0x57d40a[_0xebf9('0x3a')]);_0x458aa0[_0xebf9('0x3b')]=_[_0xebf9('0x3c')](_0x458aa0[_0xebf9('0x39')],_0x458aa0[_0xebf9('0x3a')]);_0x47487b[_0xebf9('0x3d')]=_[_0xebf9('0x3c')](_0x458aa0[_0xebf9('0x39')],qs[_0xebf9('0x3e')](_0x57d40a[_0xebf9('0x3a')][_0xebf9('0x3e')]));_0x47487b[_0xebf9('0x3d')]=_0x47487b[_0xebf9('0x3d')][_0xebf9('0x4e')]?_0x47487b['attributes']:_0x458aa0[_0xebf9('0x39')];if(_0x57d40a[_0xebf9('0x3a')][_0xebf9('0x49')]){_0x47487b[_0xebf9('0x4a')]=[{'all':!![]}];}_0x47487b=_[_0xebf9('0x46')]({},_0x47487b,_0x57d40a[_0xebf9('0x48')]);return db[_0xebf9('0x35')]['find'](_0x47487b)[_0xebf9('0x1a')](handleEntityNotFound(_0x9a871c,null))['then'](respondWithResult(_0x9a871c,null))['catch'](handleError(_0x9a871c,null));};exports[_0xebf9('0x4f')]=function(_0x1e6e5f,_0x16f382){if(_0x1e6e5f[_0xebf9('0x50')]['id']){delete _0x1e6e5f[_0xebf9('0x50')]['id'];}return db['FaxMessage'][_0xebf9('0x51')]({'where':{'id':_0x1e6e5f[_0xebf9('0x52')]['id']}})['then'](handleEntityNotFound(_0x16f382,null))[_0xebf9('0x1a')](saveUpdates(_0x1e6e5f[_0xebf9('0x50')],null))[_0xebf9('0x1a')](respondWithResult(_0x16f382,null))['catch'](handleError(_0x16f382,null));};exports['destroy']=function(_0x35e6e5,_0x4055a4){return db[_0xebf9('0x35')][_0xebf9('0x51')]({'where':{'id':_0x35e6e5['params']['id']}})[_0xebf9('0x1a')](handleEntityNotFound(_0x4055a4,null))['then'](removeEntity(_0x4055a4,null))[_0xebf9('0x23')](handleError(_0x4055a4,null));};exports[_0xebf9('0x53')]=function(_0x31430b,_0xa0e8b8){return db[_0xebf9('0x35')]['describe']()['then'](respondWithResult(_0xa0e8b8,null))[_0xebf9('0x23')](handleError(_0xa0e8b8,null));};var interaction_log=require(_0xebf9('0x54'))(_0xebf9('0x55'));exports[_0xebf9('0x56')]=function(_0x127d5a,_0x5890ca,_0x5bef42){var _0x2e21df={'agent':{},'channel':_0xebf9('0x57')};if(_0x127d5a[_0xebf9('0x50')]['id']){delete _0x127d5a[_0xebf9('0x50')]['id'];}_0x127d5a[_0xebf9('0x50')][_0xebf9('0x58')]=!![];_0x127d5a[_0xebf9('0x50')]['readAt']=moment()[_0xebf9('0x59')](_0xebf9('0x5a'));_0x127d5a[_0xebf9('0x50')][_0xebf9('0x5b')]=_0x127d5a[_0xebf9('0x50')]['UserId']||_0x127d5a[_0xebf9('0x5c')]['id'];_0x2e21df['agent']['id']=_0x127d5a['body'][_0xebf9('0x5b')];return db[_0xebf9('0x35')][_0xebf9('0x51')]({'where':{'id':_0x127d5a[_0xebf9('0x52')]['id'],'UserId':null}})[_0xebf9('0x1a')](handleEntityNotFound(_0x5890ca,null))[_0xebf9('0x1a')](saveUpdates(_0x127d5a[_0xebf9('0x50')],null))[_0xebf9('0x1a')](function(_0x3c3809){if(_0x3c3809){_0x2e21df[_0xebf9('0x21')]=_0x3c3809[_0xebf9('0x5d')]({'plain':!![]});return db[_0xebf9('0x5e')][_0xebf9('0x51')]({'where':{'id':_0x3c3809[_0xebf9('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x5890ca,null))[_0xebf9('0x1a')](function(_0x30c25e){if(_0x30c25e){return _0x30c25e[_0xebf9('0x4f')]({'UserId':_0x127d5a[_0xebf9('0x50')]['UserId'],'read1stAt':_[_0xebf9('0x60')](_0x30c25e['read1stAt'])?moment()['format'](_0xebf9('0x5a')):undefined});}return null;})[_0xebf9('0x1a')](function(_0x53efca){if(_0x53efca){_0x2e21df[_0xebf9('0x61')]=_0x53efca[_0xebf9('0x5d')]({'plain':!![]});interaction_log['info'](_0xebf9('0x62'),_0x127d5a['user']['id'],_0x127d5a[_0xebf9('0x5c')][_0xebf9('0x31')],_0x127d5a[_0xebf9('0x5c')][_0xebf9('0x63')],_0x2e21df['interaction']['id'],_0x127d5a['body']?JSON[_0xebf9('0x64')](_0x127d5a[_0xebf9('0x50')]):'null');return respondWithRpcPromise(_0xebf9('0x65'),_0xebf9('0x66'),_0x2e21df);}return null;})[_0xebf9('0x1a')](function(_0x498f7b){var _0xf98a71=_0xebf9('0x67')+_0x498f7b['message']['ContactId'];return db[_0xebf9('0x68')][_0xebf9('0x3a')](_0xf98a71,{'type':db[_0xebf9('0x69')]['QueryTypes'][_0xebf9('0x6a')],'raw':!![]})['then'](function(_0x47ad73){return _0x47ad73;});})[_0xebf9('0x1a')](function(_0x333b28){if(_0x333b28){_0x2e21df['message']['contact']=_0x333b28[0x0];if(!_0x127d5a[_0xebf9('0x50')]['UserId'])return;return db[_0xebf9('0x6b')][_0xebf9('0x51')]({'where':{'id':_0x127d5a[_0xebf9('0x50')][_0xebf9('0x5b')],'role':_0xebf9('0x6c')},'attributes':['id',_0xebf9('0x31'),_0xebf9('0x6d'),'email',_0xebf9('0x6e')],'raw':!![]});}return null;})[_0xebf9('0x1a')](function(_0x881ae5){if(!_0x881ae5)return null;_0x2e21df[_0xebf9('0x21')]['agent']=_0x881ae5;return _0x2e21df;})[_0xebf9('0x1a')](function(_0x35a296){if(_0x35a296){if(_0x127d5a[_0xebf9('0x50')][_0xebf9('0x6f')]){_0x2e21df['message'][_0xebf9('0x70')]=util['format'](_0xebf9('0x71'),_0x127d5a[_0xebf9('0x5c')][_0xebf9('0x31')]);_0x2e21df[_0xebf9('0x21')][_0xebf9('0x72')]=_0x2e21df[_0xebf9('0x72')];_0x2e21df[_0xebf9('0x21')][_0xebf9('0x73')]=_0x2e21df[_0xebf9('0x72')];_0x2e21df[_0xebf9('0x21')][_0xebf9('0x74')]=_0xebf9('0x56');return respondWithRpcPromise('EventManager',_0xebf9('0x75'),{'event':'acceptmessage','message':_0x2e21df[_0xebf9('0x21')]},client9002)[_0xebf9('0x1a')](function(){return _0x2e21df;});}return _0x2e21df;}return null;})[_0xebf9('0x1a')](respondWithResult(_0x5890ca,null))[_0xebf9('0x23')](handleError(_0x5890ca,null));};var interaction_log=require('../../config/logger')(_0xebf9('0x55'));exports[_0xebf9('0x76')]=function(_0x53d939,_0x3790f6,_0x3281cd){var _0x37e69a={'agent':{},'channel':_0xebf9('0x57')};if(_0x53d939['body']['id']){delete _0x53d939[_0xebf9('0x50')]['id'];}_0x53d939[_0xebf9('0x50')][_0xebf9('0x5b')]=_0x53d939[_0xebf9('0x50')]['UserId']||_0x53d939['user']['id'];_0x37e69a[_0xebf9('0x6c')]['id']=_0x53d939[_0xebf9('0x50')][_0xebf9('0x5b')];return db[_0xebf9('0x35')][_0xebf9('0x51')]({'where':{'id':_0x53d939[_0xebf9('0x52')]['id'],'UserId':null}})[_0xebf9('0x1a')](handleEntityNotFound(_0x3790f6,null))[_0xebf9('0x1a')](function(_0x39cde5){if(_0x39cde5){_0x37e69a['message']=_0x39cde5[_0xebf9('0x5d')]({'plain':!![]});return db[_0xebf9('0x5e')]['find']({'where':{'id':_0x39cde5[_0xebf9('0x5f')]}});}return null;})[_0xebf9('0x1a')](handleEntityNotFound(_0x3790f6,null))['then'](function(_0x3a2268){if(_0x3a2268){_0x37e69a[_0xebf9('0x61')]=_0x3a2268[_0xebf9('0x5d')]({'plain':!![]});interaction_log[_0xebf9('0x1b')](_0xebf9('0x77'),_0x53d939[_0xebf9('0x5c')]['id'],_0x53d939[_0xebf9('0x5c')][_0xebf9('0x31')],_0x53d939[_0xebf9('0x5c')][_0xebf9('0x63')],_0x37e69a[_0xebf9('0x61')]['id'],_0x53d939[_0xebf9('0x50')]?JSON[_0xebf9('0x64')](_0x53d939[_0xebf9('0x50')]):_0xebf9('0x78'));return respondWithRpcPromise(_0xebf9('0x79'),_0xebf9('0x7a'),_0x37e69a);}return null;})['then'](function(_0x209695){var _0x22c87e=_0xebf9('0x67')+_0x209695[_0xebf9('0x21')][_0xebf9('0x7b')];return db[_0xebf9('0x68')][_0xebf9('0x3a')](_0x22c87e,{'type':db[_0xebf9('0x69')][_0xebf9('0x7c')][_0xebf9('0x6a')],'raw':!![]})[_0xebf9('0x1a')](function(_0x2900c7){return _0x2900c7;});})[_0xebf9('0x1a')](function(_0x5ab199){if(_0x5ab199){_0x37e69a[_0xebf9('0x21')][_0xebf9('0x7d')]=_0x5ab199[0x0];if(!_0x53d939[_0xebf9('0x50')][_0xebf9('0x5b')])return;return db['User'][_0xebf9('0x51')]({'where':{'id':_0x53d939[_0xebf9('0x50')][_0xebf9('0x5b')],'role':_0xebf9('0x6c')},'attributes':['id','name','fullname',_0xebf9('0x7e'),'internal'],'raw':!![]});}return null;})[_0xebf9('0x1a')](function(_0x108b43){if(!_0x108b43)return null;_0x37e69a[_0xebf9('0x21')]['agent']=_0x108b43;return _0x37e69a;})[_0xebf9('0x1a')](function(_0xf8a6c9){if(_0xf8a6c9){_0xf8a6c9['message'][_0xebf9('0x70')]=util['format'](_0xebf9('0x71'),_0x53d939['user'][_0xebf9('0x31')]);_0xf8a6c9[_0xebf9('0x21')]['channel']=_0x37e69a['channel'];_0xf8a6c9[_0xebf9('0x21')][_0xebf9('0x73')]=_0x37e69a[_0xebf9('0x72')];_0xf8a6c9[_0xebf9('0x21')][_0xebf9('0x74')]=_0xebf9('0x76');respondWithRpcPromise(_0xebf9('0x75'),_0xebf9('0x75'),{'event':_0xebf9('0x7f'),'message':_0xf8a6c9[_0xebf9('0x21')]},client9002);return _0x37e69a;}return null;})[_0xebf9('0x1a')](respondWithResult(_0x3790f6,null))[_0xebf9('0x23')](handleError(_0x3790f6,null));};exports[_0xebf9('0x80')]=function(_0x394b65,_0x2f2e37){var _0x16ad7c;return db[_0xebf9('0x35')][_0xebf9('0x80')](_0x394b65[_0xebf9('0x50')],{})['then'](function(_0x4c35f3){_0x16ad7c=_0x4c35f3;return db['CmContact']['findOne']({'where':{'id':_0x16ad7c[_0xebf9('0x7b')]}});})[_0xebf9('0x1a')](function(_0x1a3a02){if(_[_0xebf9('0x60')](_0x1a3a02)){return;}else{_0x16ad7c[_0xebf9('0x57')]=_0x1a3a02['fax'];return db[_0xebf9('0x81')][_0xebf9('0x82')]({'where':{'id':_0x16ad7c[_0xebf9('0x83')]}});}})[_0xebf9('0x1a')](function(_0x2c9678){return respondWithRpcPromise(_0xebf9('0x84'),'SendFax',{'FaxAccountId':_['isNil'](_0x394b65[_0xebf9('0x50')])?undefined:_0x394b65[_0xebf9('0x50')]['FaxAccountId'],'path':_[_0xebf9('0x60')](_0x2c9678)?undefined:util[_0xebf9('0x59')]('/var/opt/motion2/server/files/attachments/%s',_0x2c9678['basename']),'fax':_[_0xebf9('0x60')](_0x16ad7c[_0xebf9('0x57')])?undefined:_0x16ad7c[_0xebf9('0x57')],'AttachmentId':_0x16ad7c[_0xebf9('0x83')]},client9002);})[_0xebf9('0x1a')](respondWithResult(_0x2f2e37,0xc9))[_0xebf9('0x23')](handleError(_0x2f2e37,null));};exports[_0xebf9('0x85')]=function(_0x114f27,_0x248674){var _0x45cd6e=path[_0xebf9('0x86')](config[_0xebf9('0x87')],'server','files',_0xebf9('0x88'));return db[_0xebf9('0x35')][_0xebf9('0x51')]({'where':{'id':_0x114f27[_0xebf9('0x52')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xebf9('0x1a')](handleEntityNotFound(_0x248674,null))[_0xebf9('0x1a')](function(_0x595e18){if(_0x595e18){return _0x248674[_0xebf9('0x85')](path[_0xebf9('0x86')](_0x45cd6e,_0x595e18['Attachment'][_0xebf9('0x89')]));}})['catch'](handleError(_0x248674,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 90cd94c..a6ac3d3 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 _0xc17d=['FaxMessage','setMaxListeners','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5d8076,_0x2b476a){var _0x26811a=function(_0x434cbf){while(--_0x434cbf){_0x5d8076['push'](_0x5d8076['shift']());}};_0x26811a(++_0x2b476a);}(_0xc17d,0x96));var _0xdc17=function(_0x52156a,_0x350b21){_0x52156a=_0x52156a-0x0;var _0x40360a=_0xc17d[_0x52156a];return _0x40360a;};'use strict';var EventEmitter=require(_0xdc17('0x0'));var FaxMessage=require(_0xdc17('0x1'))['db'][_0xdc17('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdc17('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdc17('0x4'),'afterDestroy':_0xdc17('0x5')};function emitEvent(_0xcbc140){return function(_0x388e27,_0x5e261e,_0x33efa9){FaxMessageEvents['emit'](_0xcbc140+':'+_0x388e27['id'],_0x388e27);FaxMessageEvents['emit'](_0xcbc140,_0x388e27);_0x33efa9(null);};}for(var e in events){if(events[_0xdc17('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xdc17('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x50e5=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1655b5,_0x1c311e){var _0x52ca93=function(_0x561a66){while(--_0x561a66){_0x1655b5['push'](_0x1655b5['shift']());}};_0x52ca93(++_0x1c311e);}(_0x50e5,0xb7));var _0x550e=function(_0x2d0299,_0x3d47b0){_0x2d0299=_0x2d0299-0x0;var _0x22b2d6=_0x50e5[_0x2d0299];return _0x22b2d6;};'use strict';var EventEmitter=require(_0x550e('0x0'));var FaxMessage=require(_0x550e('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x550e('0x2')](0x0);var events={'afterCreate':_0x550e('0x3'),'afterUpdate':_0x550e('0x4'),'afterDestroy':_0x550e('0x5')};function emitEvent(_0x40aee6){return function(_0x3f3a13,_0x78e6c5,_0xafede5){FaxMessageEvents[_0x550e('0x6')](_0x40aee6+':'+_0x3f3a13['id'],_0x3f3a13);FaxMessageEvents[_0x550e('0x6')](_0x40aee6,_0x3f3a13);_0xafede5(null);};}for(var e in events){if(events[_0x550e('0x7')](e)){var event=events[e];FaxMessage[_0x550e('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 4146573..a04fb21 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 _0x378a=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x3dce6a,_0x47e609){var _0x387341=function(_0x33eddf){while(--_0x33eddf){_0x3dce6a['push'](_0x3dce6a['shift']());}};_0x387341(++_0x47e609);}(_0x378a,0x89));var _0xa378=function(_0x3e80c0,_0x422f13){_0x3e80c0=_0x3e80c0-0x0;var _0x2c4e48=_0x378a[_0x3e80c0];return _0x2c4e48;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa378('0x0'))(_0xa378('0x1'));var moment=require(_0xa378('0x2'));var BPromise=require(_0xa378('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa378('0x4'));var rimraf=require(_0xa378('0x5'));var config=require(_0xa378('0x6'));var attributes=require(_0xa378('0x7'));module[_0xa378('0x8')]=function(_0x484e6f,_0x49dc6b){return _0x484e6f[_0xa378('0x9')](_0xa378('0xa'),attributes,{'tableName':_0xa378('0xb'),'paranoid':![],'indexes':[{'name':_0xa378('0xc'),'fields':[_0xa378('0xd')],'type':_0xa378('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13afe3,_0x2e6ecd,_0x4f469b){var _0x5361e7=_0x484e6f['models'];var _0x44cf31=_0x13afe3[_0xa378('0xf')]({'plain':!![]});if(_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()==='in'||_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()===_0xa378('0x12')&&!_0x44cf31[_0xa378('0x13')]&&!_[_0xa378('0x14')](_0x44cf31[_0xa378('0x15')])){_0x5361e7[_0xa378('0x16')][_0xa378('0x17')]({'where':{'id':_0x44cf31[_0xa378('0x18')]}})['then'](function(_0x7e44a6){if(_0x7e44a6){_0x7e44a6[_0xa378('0x19')]({'lastMsgAt':_0x44cf31[_0xa378('0x1a')],'lastMsgDirection':_0x44cf31[_0xa378('0x10')][_0xa378('0x11')]()});}})[_0xa378('0x1b')](function(_0x1eee17){console[_0xa378('0x1c')](_0x1eee17);});}_0x4f469b();}},'charset':_0xa378('0x1d'),'collate':_0xa378('0x1e')});}; \ No newline at end of file +var _0xa07b=['exports','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','util','../../config/logger','api','moment','path','./faxMessage.attributes'];(function(_0x3bd912,_0x353aa2){var _0x3a985e=function(_0x979d71){while(--_0x979d71){_0x3bd912['push'](_0x3bd912['shift']());}};_0x3a985e(++_0x353aa2);}(_0xa07b,0x192));var _0xba07=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa07b[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0xba07('0x0'));var logger=require(_0xba07('0x1'))(_0xba07('0x2'));var moment=require(_0xba07('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba07('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba07('0x5'));module[_0xba07('0x6')]=function(_0x2c854d,_0x45302b){return _0x2c854d['define']('FaxMessage',attributes,{'tableName':_0xba07('0x7'),'paranoid':![],'indexes':[{'name':_0xba07('0x8'),'fields':[_0xba07('0x9')],'type':_0xba07('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x337377,_0x46c1ac,_0x2ef3d9){var _0x42b34a=_0x2c854d[_0xba07('0xb')];var _0x193aee=_0x337377[_0xba07('0xc')]({'plain':!![]});if(_0x193aee[_0xba07('0xd')][_0xba07('0xe')]()==='in'||_0x193aee[_0xba07('0xd')][_0xba07('0xe')]()===_0xba07('0xf')&&!_0x193aee['secret']&&!_['isNil'](_0x193aee[_0xba07('0x10')])){_0x42b34a[_0xba07('0x11')][_0xba07('0x12')]({'where':{'id':_0x193aee[_0xba07('0x13')]}})[_0xba07('0x14')](function(_0x37f43f){if(_0x37f43f){_0x37f43f[_0xba07('0x15')]({'lastMsgAt':_0x193aee[_0xba07('0x16')],'lastMsgDirection':_0x193aee[_0xba07('0xd')][_0xba07('0xe')]()});}})[_0xba07('0x17')](function(_0x32fc95){console['error'](_0x32fc95);});}_0x2ef3d9();}},'charset':'utf8mb4','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 125e5fb..ebe84e6 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 _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x32e77a,_0x1a0440){var _0x13d5b1=function(_0x2c53b1){while(--_0x2c53b1){_0x32e77a['push'](_0x32e77a['shift']());}};_0x13d5b1(++_0x1a0440);}(_0x4b84,0x1cc));var _0x44b8=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0x4b84[_0x49d19d];return _0x4ebef1;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file +var _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48403a,_0x130368){var _0x19e3f5=function(_0x9bf2bc){while(--_0x9bf2bc){_0x48403a['push'](_0x48403a['shift']());}};_0x19e3f5(++_0x130368);}(_0x0a9a,0x183));var _0xa0a9=function(_0x54bbd9,_0x79ab00){_0x54bbd9=_0x54bbd9-0x0;var _0x271bba=_0x0a9a[_0x54bbd9];return _0x271bba;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5afe8b7..1a073bd 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 _0x5846=['./faxMessage.events','save','remove','emit','removeListener','register','faxMessage:'];(function(_0x3d1b97,_0x659f66){var _0x1b352a=function(_0x203bbf){while(--_0x203bbf){_0x3d1b97['push'](_0x3d1b97['shift']());}};_0x1b352a(++_0x659f66);}(_0x5846,0x69));var _0x6584=function(_0x13aec3,_0x1a9a2e){_0x13aec3=_0x13aec3-0x0;var _0xde2e71=_0x5846[_0x13aec3];return _0xde2e71;};'use strict';var FaxMessageEvents=require(_0x6584('0x0'));var events=[_0x6584('0x1'),_0x6584('0x2'),'update'];function createListener(_0x5dc167,_0x2f03d4){return function(_0x149e14){_0x2f03d4[_0x6584('0x3')](_0x5dc167,_0x149e14);};}function removeListener(_0x2ee9a6,_0x14547b){return function(){FaxMessageEvents[_0x6584('0x4')](_0x2ee9a6,_0x14547b);};}exports[_0x6584('0x5')]=function(_0x286601){for(var _0xc9fe23=0x0,_0x17542f=events['length'];_0xc9fe23<_0x17542f;_0xc9fe23++){var _0x1b9cf0=events[_0xc9fe23];var _0x5db6cc=createListener(_0x6584('0x6')+_0x1b9cf0,_0x286601);FaxMessageEvents['on'](_0x1b9cf0,_0x5db6cc);}}; \ No newline at end of file +var _0x52dc=['length','./faxMessage.events','save','remove','emit','removeListener','register'];(function(_0xb94fc2,_0x28c2ea){var _0x32b59f=function(_0x3cc4fc){while(--_0x3cc4fc){_0xb94fc2['push'](_0xb94fc2['shift']());}};_0x32b59f(++_0x28c2ea);}(_0x52dc,0x112));var _0xc52d=function(_0x384d23,_0xb1d92b){_0x384d23=_0x384d23-0x0;var _0x447718=_0x52dc[_0x384d23];return _0x447718;};'use strict';var FaxMessageEvents=require(_0xc52d('0x0'));var events=[_0xc52d('0x1'),_0xc52d('0x2'),'update'];function createListener(_0x2b5738,_0x5a674a){return function(_0x15cfb8){_0x5a674a[_0xc52d('0x3')](_0x2b5738,_0x15cfb8);};}function removeListener(_0x5bb15d,_0x28cdb1){return function(){FaxMessageEvents[_0xc52d('0x4')](_0x5bb15d,_0x28cdb1);};}exports[_0xc52d('0x5')]=function(_0x14c3eb){for(var _0x584ebf=0x0,_0x399108=events[_0xc52d('0x6')];_0x584ebf<_0x399108;_0x584ebf++){var _0x375b36=events[_0x584ebf];var _0x3e4e6b=createListener('faxMessage:'+_0x375b36,_0x14c3eb);FaxMessageEvents['on'](_0x375b36,_0x3e4e6b);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c5a0472..484428b 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 _0xbc9d=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','reject','delete','destroy','multer','util'];(function(_0x40b5cb,_0x4e3a0f){var _0x3ecb59=function(_0x5e6075){while(--_0x5e6075){_0x40b5cb['push'](_0x40b5cb['shift']());}};_0x3ecb59(++_0x4e3a0f);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x1de31e,_0x4a621a){_0x1de31e=_0x1de31e-0x0;var _0x736a92=_0xbc9d[_0x1de31e];return _0x736a92;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/describe',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller['show']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),interaction[_0xdbc9('0xf')](_0xdbc9('0x10'),_0xdbc9('0x11')),controller[_0xdbc9('0x12')]);router[_0xdbc9('0x13')](_0xdbc9('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xdbc9('0x13')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);router[_0xdbc9('0x13')]('/:id/reject',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x17')]);router[_0xdbc9('0x18')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc788,0xc4));var _0x8c78=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc788[_0x486f4a];return _0x135d99;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b3a0939..fbcdbda 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 _0x3936=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x30b431,_0x3fe97f){var _0x2ab081=function(_0x2ffb3d){while(--_0x2ffb3d){_0x30b431['push'](_0x30b431['shift']());}};_0x2ab081(++_0x3fe97f);}(_0x3936,0x18c));var _0x6393=function(_0x2b6235,_0xadfbcf){_0x2b6235=_0x2b6235-0x0;var _0x4cee7f=_0x3936[_0x2b6235];return _0x4cee7f;};'use strict';var Sequelize=require(_0x6393('0x0'));module['exports']={'name':{'type':Sequelize[_0x6393('0x1')],'unique':_0x6393('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6393('0x1')]},'timeout':{'type':Sequelize[_0x6393('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6393('0x4')](_0x6393('0x5'),_0x6393('0x6'),_0x6393('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6393('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ade=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x8ade,0xbd));var _0xe8ad=function(_0xd277be,_0x1971f8){_0xd277be=_0xd277be-0x0;var _0x24aa7a=_0x8ade[_0xd277be];return _0x24aa7a;};'use strict';var Sequelize=require('sequelize');module[_0xe8ad('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe8ad('0x1')]},'timeout':{'type':Sequelize[_0xe8ad('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8ad('0x3')](_0xe8ad('0x4'),_0xe8ad('0x5'),_0xe8ad('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe8ad('0x2')],'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 19eceff..ac9aba6 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 _0xd0f3=['length','hasOwnProperty','order','sort','where','merge','filter','options','FaxQueue','includeAll','include','findAll','rows','catch','show','params','intersection','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','FaxQueueId','map','UserFaxQueue','User','UserId','agent','faxPause','updatedAt','createdAt','SIP','getTeams','nolimit','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','union','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','index','rawAttributes','type','keys','query','filters','model','attributes'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xd0f3,0xcd));var _0x3d0f=function(_0x221ca3,_0xb25dd3){_0x221ca3=_0x221ca3-0x0;var _0x5974e4=_0xd0f3[_0x221ca3];return _0x5974e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d0f('0x0'));var zipdir=require(_0x3d0f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d0f('0x2'));var moment=require(_0x3d0f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3d0f('0x4'));var util=require(_0x3d0f('0x5'));var path=require(_0x3d0f('0x6'));var sox=require(_0x3d0f('0x7'));var csv=require(_0x3d0f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d0f('0x9'));var _=require('lodash');var squel=require(_0x3d0f('0xa'));var crypto=require(_0x3d0f('0xb'));var jsforce=require(_0x3d0f('0xc'));var deskjs=require(_0x3d0f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3d0f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d0f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d0f('0x10'))(_0x3d0f('0x11'));var utils=require(_0x3d0f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3d0f('0x13'));var db=require(_0x3d0f('0x14'))['db'];config['redis']=_[_0x3d0f('0x15')](config[_0x3d0f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d0f('0x17'))(new Redis(config[_0x3d0f('0x16')]));require('./faxQueue.socket')[_0x3d0f('0x18')](socket);function respondWithStatusCode(_0x55964c,_0xe7d4ba){_0xe7d4ba=_0xe7d4ba||0xcc;return function(_0x2b8d18){if(_0x2b8d18){return _0x55964c[_0x3d0f('0x19')](_0xe7d4ba);}return _0x55964c[_0x3d0f('0x1a')](_0xe7d4ba)[_0x3d0f('0x1b')]();};}function respondWithResult(_0x3ecbf4,_0x83934){_0x83934=_0x83934||0xc8;return function(_0x4318ff){if(_0x4318ff){return _0x3ecbf4[_0x3d0f('0x1a')](_0x83934)[_0x3d0f('0x1c')](_0x4318ff);}};}function respondWithFilteredResult(_0x58c8a0,_0x266a23){return function(_0x1c6c0d){if(_0x1c6c0d){var _0x4cce94=typeof _0x266a23[_0x3d0f('0x1d')]===_0x3d0f('0x1e')&&typeof _0x266a23[_0x3d0f('0x1f')]==='undefined';var _0x5a18f2=_0x1c6c0d[_0x3d0f('0x20')];var _0x5b90fa=_0x4cce94?0x0:_0x266a23['offset'];var _0x4a34c4=_0x4cce94?_0x1c6c0d[_0x3d0f('0x20')]:_0x266a23['offset']+_0x266a23[_0x3d0f('0x1f')];var _0x460665;if(_0x4a34c4>=_0x5a18f2){_0x4a34c4=_0x5a18f2;_0x460665=0xc8;}else{_0x460665=0xce;}_0x58c8a0[_0x3d0f('0x1a')](_0x460665);return _0x58c8a0[_0x3d0f('0x21')](_0x3d0f('0x22'),_0x5b90fa+'-'+_0x4a34c4+'/'+_0x5a18f2)['json'](_0x1c6c0d);}return null;};}function patchUpdates(_0xbd3589){return function(_0x5d3f65){try{jsonpatch[_0x3d0f('0x23')](_0x5d3f65,_0xbd3589,!![]);}catch(_0x241b00){return BPromise[_0x3d0f('0x24')](_0x241b00);}return _0x5d3f65[_0x3d0f('0x25')]();};}function saveUpdates(_0x318dc3,_0x5c91a2){return function(_0x473b3c){if(_0x473b3c){return _0x473b3c[_0x3d0f('0x26')](_0x318dc3)[_0x3d0f('0x27')](function(_0x4de604){return _0x4de604;});}return null;};}function removeEntity(_0x44f9cb,_0x408c0d){return function(_0x189700){if(_0x189700){return _0x189700[_0x3d0f('0x28')]()['then'](function(){var _0x178d7e=_0x189700[_0x3d0f('0x29')]({'plain':!![]});var _0xd1be9c=_0x3d0f('0x2a');return db[_0x3d0f('0x2b')]['destroy']({'where':{'type':_0xd1be9c,'resourceId':_0x178d7e['id']}})[_0x3d0f('0x27')](function(){return _0x189700;});})[_0x3d0f('0x27')](function(){_0x44f9cb[_0x3d0f('0x1a')](0xcc)[_0x3d0f('0x1b')]();});}};}function handleEntityNotFound(_0x463182,_0x291d8c){return function(_0x7ce317){if(!_0x7ce317){_0x463182[_0x3d0f('0x19')](0x194);}return _0x7ce317;};}function handleError(_0x5f18c9,_0x4f2de8){_0x4f2de8=_0x4f2de8||0x1f4;return function(_0x106e92){logger[_0x3d0f('0x2c')](_0x106e92[_0x3d0f('0x2d')]);if(_0x106e92[_0x3d0f('0x2e')]){delete _0x106e92[_0x3d0f('0x2e')];}_0x5f18c9[_0x3d0f('0x1a')](_0x4f2de8)['send'](_0x106e92);};}exports[_0x3d0f('0x2f')]=function(_0x19e236,_0x11261c){var _0x17e16d={},_0x5d3fec={},_0xb0d8ea={'count':0x0,'rows':[]};var _0x321636=_['map'](db['FaxQueue'][_0x3d0f('0x30')],function(_0x52f829){return{'name':_0x52f829['fieldName'],'type':_0x52f829[_0x3d0f('0x31')]['key']};});_0x5d3fec['model']=_['map'](_0x321636,_0x3d0f('0x2e'));_0x5d3fec['query']=_[_0x3d0f('0x32')](_0x19e236[_0x3d0f('0x33')]);_0x5d3fec[_0x3d0f('0x34')]=_['intersection'](_0x5d3fec[_0x3d0f('0x35')],_0x5d3fec[_0x3d0f('0x33')]);_0x17e16d['attributes']=_['intersection'](_0x5d3fec['model'],qs['fields'](_0x19e236['query']['fields']));_0x17e16d['attributes']=_0x17e16d[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x17e16d[_0x3d0f('0x36')]:_0x5d3fec[_0x3d0f('0x35')];if(!_0x19e236['query'][_0x3d0f('0x38')]('nolimit')){_0x17e16d[_0x3d0f('0x1f')]=qs['limit'](_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x17e16d[_0x3d0f('0x1d')]=qs['offset'](_0x19e236['query'][_0x3d0f('0x1d')]);}_0x17e16d[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x3a')]);_0x17e16d['where']=qs[_0x3d0f('0x34')](_['pick'](_0x19e236[_0x3d0f('0x33')],_0x5d3fec[_0x3d0f('0x34')]),_0x321636);if(_0x19e236['query']['filter']){_0x17e16d[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x17e16d['where'],{'$or':_['map'](_0x321636,function(_0x13a363){if(_0x13a363['type']!=='VIRTUAL'){var _0x4575c4={};_0x4575c4[_0x13a363[_0x3d0f('0x2e')]]={'$like':'%'+_0x19e236[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x4575c4;}})});}_0x17e16d=_[_0x3d0f('0x3c')]({},_0x17e16d,_0x19e236[_0x3d0f('0x3e')]);var _0x124e87={'where':_0x17e16d['where']};return db[_0x3d0f('0x3f')][_0x3d0f('0x20')](_0x124e87)['then'](function(_0x2f19cf){_0xb0d8ea[_0x3d0f('0x20')]=_0x2f19cf;if(_0x19e236['query'][_0x3d0f('0x40')]){_0x17e16d[_0x3d0f('0x41')]=[{'all':!![]}];}return db[_0x3d0f('0x3f')][_0x3d0f('0x42')](_0x17e16d);})[_0x3d0f('0x27')](function(_0x5c1fae){_0xb0d8ea[_0x3d0f('0x43')]=_0x5c1fae;return _0xb0d8ea;})[_0x3d0f('0x27')](respondWithFilteredResult(_0x11261c,_0x17e16d))[_0x3d0f('0x44')](handleError(_0x11261c,null));};exports[_0x3d0f('0x45')]=function(_0x518ce3,_0x2cad78){var _0x463bd3={'raw':!![],'where':{'id':_0x518ce3[_0x3d0f('0x46')]['id']}},_0x4bc47d={};_0x4bc47d[_0x3d0f('0x35')]=_['keys'](db[_0x3d0f('0x3f')][_0x3d0f('0x30')]);_0x4bc47d[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x518ce3[_0x3d0f('0x33')]);_0x4bc47d['filters']=_[_0x3d0f('0x47')](_0x4bc47d[_0x3d0f('0x35')],_0x4bc47d['query']);_0x463bd3[_0x3d0f('0x36')]=_[_0x3d0f('0x47')](_0x4bc47d[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x518ce3[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x463bd3['attributes']=_0x463bd3['attributes']['length']?_0x463bd3['attributes']:_0x4bc47d[_0x3d0f('0x35')];if(_0x518ce3[_0x3d0f('0x33')][_0x3d0f('0x40')]){_0x463bd3[_0x3d0f('0x41')]=[{'all':!![]}];}_0x463bd3=_[_0x3d0f('0x3c')]({},_0x463bd3,_0x518ce3['options']);return db[_0x3d0f('0x3f')][_0x3d0f('0x49')](_0x463bd3)[_0x3d0f('0x27')](handleEntityNotFound(_0x2cad78,null))[_0x3d0f('0x27')](respondWithResult(_0x2cad78,null))[_0x3d0f('0x44')](handleError(_0x2cad78,null));};exports[_0x3d0f('0x4a')]=function(_0x2980a5,_0x439c2a){return db[_0x3d0f('0x3f')][_0x3d0f('0x4a')](_0x2980a5[_0x3d0f('0x4b')],{})[_0x3d0f('0x27')](function(_0x256310){var _0x5d60d3=_0x2980a5['user'][_0x3d0f('0x29')]({'plain':!![]});if(!_0x5d60d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d60d3[_0x3d0f('0x4c')]===_0x3d0f('0x4d')){var _0x40c77e=_0x256310[_0x3d0f('0x29')]({'plain':!![]});var _0xef2777=_0x3d0f('0x2a');return db[_0x3d0f('0x4e')][_0x3d0f('0x49')]({'where':{'name':_0xef2777,'userProfileId':_0x5d60d3[_0x3d0f('0x4f')]},'raw':!![]})[_0x3d0f('0x27')](function(_0x1e0918){if(_0x1e0918&&_0x1e0918[_0x3d0f('0x50')]===0x0){return db[_0x3d0f('0x2b')]['create']({'name':_0x40c77e[_0x3d0f('0x2e')],'resourceId':_0x40c77e['id'],'type':_0x1e0918['name'],'sectionId':_0x1e0918['id']},{})[_0x3d0f('0x27')](function(){return _0x256310;});}else{return _0x256310;}})[_0x3d0f('0x44')](function(_0x4d1805){logger[_0x3d0f('0x2c')](_0x3d0f('0x51'),_0x4d1805);throw _0x4d1805;});}return _0x256310;})[_0x3d0f('0x27')](respondWithResult(_0x439c2a,0xc9))['catch'](handleError(_0x439c2a,null));};exports[_0x3d0f('0x26')]=function(_0x8132ce,_0x100f49){if(_0x8132ce[_0x3d0f('0x4b')]['id']){delete _0x8132ce[_0x3d0f('0x4b')]['id'];}return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x8132ce['params']['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x100f49,null))[_0x3d0f('0x27')](saveUpdates(_0x8132ce[_0x3d0f('0x4b')],null))[_0x3d0f('0x27')](respondWithResult(_0x100f49,null))[_0x3d0f('0x44')](handleError(_0x100f49,null));};exports[_0x3d0f('0x28')]=function(_0x3aba68,_0x5c2d27){return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x3aba68[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x5c2d27,null))['then'](removeEntity(_0x5c2d27,null))['catch'](handleError(_0x5c2d27,null));};exports[_0x3d0f('0x52')]=function(_0x2b3d27,_0xf08715){return db[_0x3d0f('0x3f')][_0x3d0f('0x52')]()[_0x3d0f('0x27')](respondWithResult(_0xf08715,null))[_0x3d0f('0x44')](handleError(_0xf08715,null));};exports[_0x3d0f('0x53')]=function(_0x1c94d3,_0x4bcce3,_0x15d696){var _0x564a0f={'raw':!![],'where':{}},_0x2b8dc8={},_0x464add;return db[_0x3d0f('0x3f')][_0x3d0f('0x54')]({'where':{'id':_0x1c94d3['params']['id']}})['then'](handleEntityNotFound(_0x4bcce3,null))['then'](function(_0xf19ee2){if(_0xf19ee2){_0x464add=_0xf19ee2[_0x3d0f('0x29')]({'plain':!![]});_0x2b8dc8[_0x3d0f('0x35')]=_[_0x3d0f('0x32')](db['UserFaxQueue'][_0x3d0f('0x30')]);_0x2b8dc8[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x1c94d3[_0x3d0f('0x33')]);_0x2b8dc8[_0x3d0f('0x34')]=_[_0x3d0f('0x47')](_0x2b8dc8[_0x3d0f('0x35')],_0x2b8dc8[_0x3d0f('0x33')]);_0x564a0f['attributes']=_[_0x3d0f('0x47')](_0x2b8dc8[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x564a0f['attributes']=_0x564a0f['attributes'][_0x3d0f('0x37')]?_0x564a0f[_0x3d0f('0x36')]:_0x2b8dc8['model'];if(!_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x38')]('nolimit')){_0x564a0f[_0x3d0f('0x1f')]=qs[_0x3d0f('0x1f')](_0x1c94d3['query'][_0x3d0f('0x1f')]);_0x564a0f[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x1c94d3['query'][_0x3d0f('0x1d')]);}_0x564a0f['order']=qs[_0x3d0f('0x3a')](_0x1c94d3[_0x3d0f('0x33')]['sort']);_0x564a0f[_0x3d0f('0x3b')]=qs[_0x3d0f('0x34')](_[_0x3d0f('0x55')](_0x1c94d3[_0x3d0f('0x33')],_0x2b8dc8[_0x3d0f('0x34')]));_0x564a0f[_0x3d0f('0x3b')][_0x3d0f('0x56')]=_0xf19ee2['id'];if(_0x1c94d3[_0x3d0f('0x33')]['filter']){_0x564a0f[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x564a0f[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x564a0f[_0x3d0f('0x36')],function(_0x59545b){var _0x101ff9={};_0x101ff9[_0x59545b]={'$like':'%'+_0x1c94d3[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x101ff9;})});}_0x564a0f=_[_0x3d0f('0x3c')]({},_0x564a0f,_0x1c94d3[_0x3d0f('0x3e')]);return db[_0x3d0f('0x58')][_0x3d0f('0x42')](_0x564a0f);}})['then'](function(_0x3f92ef){if(_0x3f92ef){return db[_0x3d0f('0x59')]['findAndCountAll']({'where':{'id':_[_0x3d0f('0x57')](_0x3f92ef,_0x3d0f('0x5a')),'role':_0x3d0f('0x5b')},'attributes':['id',_0x3d0f('0x2e'),_0x3d0f('0x5c'),_0x3d0f('0x5d'),_0x3d0f('0x5e')]});}})[_0x3d0f('0x27')](function(_0x465123){if(_0x465123){return{'count':_0x465123[_0x3d0f('0x20')],'rows':_['map'](_0x465123[_0x3d0f('0x43')],function(_0x37f7d4){return{'membername':_0x37f7d4['name'],'UserId':_0x37f7d4['id'],'queue_name':_0x464add['name'],'FaxQueueId':_0x464add['id'],'interface':util['format']('%s/%s',_0x3d0f('0x5f'),_0x37f7d4[_0x3d0f('0x2e')]),'penalty':0x0,'paused':_0x37f7d4[_0x3d0f('0x5c')],'createdAt':_0x37f7d4[_0x3d0f('0x5e')],'updatedAt':_0x37f7d4[_0x3d0f('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4bcce3,_0x564a0f))['catch'](handleError(_0x4bcce3,null));};exports[_0x3d0f('0x60')]=function(_0x5bda5a,_0x50e20a,_0x215518){var _0x38f2b4={};var _0x540ca2={};var _0x41b441;var _0x28bf02;return db[_0x3d0f('0x3f')]['findOne']({'where':{'id':_0x5bda5a[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x50e20a,null))['then'](function(_0x1495ac){if(_0x1495ac){_0x41b441=_0x1495ac;_0x540ca2[_0x3d0f('0x35')]=_[_0x3d0f('0x32')](db['Team'][_0x3d0f('0x30')]);_0x540ca2['query']=_[_0x3d0f('0x32')](_0x5bda5a[_0x3d0f('0x33')]);_0x540ca2[_0x3d0f('0x34')]=_['intersection'](_0x540ca2[_0x3d0f('0x35')],_0x540ca2['query']);_0x38f2b4[_0x3d0f('0x36')]=_[_0x3d0f('0x47')](_0x540ca2[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x48')]));_0x38f2b4['attributes']=_0x38f2b4[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x38f2b4['attributes']:_0x540ca2['model'];_0x38f2b4[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x5bda5a['query']['sort']);_0x38f2b4['where']=qs[_0x3d0f('0x34')](_[_0x3d0f('0x55')](_0x5bda5a[_0x3d0f('0x33')],_0x540ca2[_0x3d0f('0x34')]));if(_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x3d')]){_0x38f2b4[_0x3d0f('0x3b')]=_[_0x3d0f('0x3c')](_0x38f2b4[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x38f2b4[_0x3d0f('0x36')],function(_0x4d9f88){var _0x5ea457={};_0x5ea457[_0x4d9f88]={'$like':'%'+_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x5ea457;})});}_0x38f2b4=_[_0x3d0f('0x3c')]({},_0x38f2b4,_0x5bda5a[_0x3d0f('0x3e')]);return _0x41b441[_0x3d0f('0x60')](_0x38f2b4);}})[_0x3d0f('0x27')](function(_0x5f0d66){if(_0x5f0d66){_0x28bf02=_0x5f0d66[_0x3d0f('0x37')];if(!_0x5bda5a[_0x3d0f('0x33')]['hasOwnProperty'](_0x3d0f('0x61'))){_0x38f2b4[_0x3d0f('0x1f')]=qs[_0x3d0f('0x1f')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x38f2b4[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x5bda5a[_0x3d0f('0x33')][_0x3d0f('0x1d')]);}return _0x41b441['getTeams'](_0x38f2b4);}})[_0x3d0f('0x27')](function(_0x119cd8){if(_0x119cd8){return _0x119cd8?{'count':_0x28bf02,'rows':_0x119cd8}:null;}})[_0x3d0f('0x27')](respondWithResult(_0x50e20a,null))[_0x3d0f('0x44')](handleError(_0x50e20a,null));};exports['addTeams']=function(_0x42e876,_0x4c6528,_0x442d3d){var _0x48bcfd=_0x42e876[_0x3d0f('0x4b')][_0x3d0f('0x62')];return db[_0x3d0f('0x63')][_0x3d0f('0x42')]({'where':{'id':_0x48bcfd},'attributes':['id'],'include':[{'model':db[_0x3d0f('0x59')],'as':_0x3d0f('0x64'),'attributes':['id',_0x3d0f('0x2e'),_0x3d0f('0x65'),_0x3d0f('0x66'),_0x3d0f('0x67')],'raw':!![]}]})['then'](function(_0x3047ba){if(_0x3047ba){var _0xe337c0=_['flatMap'](_0x3047ba,function(_0x294a6b){var _0x5d79ab=_0x294a6b[_0x3d0f('0x29')]({'plain':!![]});return _0x5d79ab[_0x3d0f('0x64')];});return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x42e876[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](function(_0xea2a41){return db[_0x3d0f('0x68')][_0x3d0f('0x69')](function(_0x115fca){return _0xea2a41[_0x3d0f('0x6a')](_0x48bcfd,{'transaction':_0x115fca})[_0x3d0f('0x27')](function(){return BPromise[_0x3d0f('0x6b')](_0xe337c0,function(_0x1a9562){return db[_0x3d0f('0x58')][_0x3d0f('0x6c')]({'where':{'UserId':_0x1a9562['id'],'FaxQueueId':_0x42e876[_0x3d0f('0x46')]['id']},'transaction':_0x115fca});});})['then'](function(){_0xe337c0[_0x3d0f('0x6d')](function(_0x95cedf){socket[_0x3d0f('0x6e')]('userFaxQueue:save',{'UserId':_0x95cedf['id'],'FaxQueueId':_0xea2a41['id']});});});});});}})['then'](respondWithStatusCode(_0x4c6528,null))[_0x3d0f('0x44')](handleError(_0x4c6528,null));};exports[_0x3d0f('0x6f')]=function(_0x29b20c,_0x3fe98a,_0x25a3b8){return db['Team'][_0x3d0f('0x42')]({'where':{'id':_0x29b20c[_0x3d0f('0x33')][_0x3d0f('0x62')]},'attributes':['id'],'include':[{'model':db[_0x3d0f('0x59')],'as':_0x3d0f('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3d0f('0x27')](handleEntityNotFound(_0x3fe98a,null))['then'](function(_0x5d2c94){var _0x182c87=_[_0x3d0f('0x57')](_0x5d2c94,'id');var _0x8c8eb1=[];var _0x582590=[];var _0x161a8a=squel[_0x3d0f('0x70')]();_0x161a8a['field'](_0x3d0f('0x71'))['from']('team_has_fax_queues','tq')[_0x3d0f('0x72')](_0x3d0f('0x73'),'ut',_0x3d0f('0x74'))[_0x3d0f('0x3b')]('FaxQueueId\x20=\x20?',_0x29b20c[_0x3d0f('0x46')]['id']);for(var _0x3d12bc=0x0;_0x3d12bc<_0x5d2c94[_0x3d0f('0x37')];_0x3d12bc+=0x1){let _0x51b8b5=_0x5d2c94[_0x3d12bc];for(var _0x4c48ae=0x0;_0x4c48ae<_0x51b8b5['Agents']['length'];_0x4c48ae+=0x1){let _0x2da9e7=_0x51b8b5[_0x3d0f('0x64')][_0x4c48ae];var _0x5061ff=_0x161a8a['clone']();_0x5061ff[_0x3d0f('0x3b')]('ut.UserId\x20=\x20?',_0x2da9e7['id']);_0x582590[_0x3d0f('0x75')](db[_0x3d0f('0x68')][_0x3d0f('0x33')](_0x5061ff[_0x3d0f('0x76')](),{'type':db[_0x3d0f('0x68')][_0x3d0f('0x77')][_0x3d0f('0x78')]})[_0x3d0f('0x27')](function(_0x189376){if(_0x189376['length']===0x1){return _0x2da9e7['id'];}else{var _0x313dc5=_['every'](_['map'](_0x189376,'TeamId'),function(_0x460c20){return _['includes'](_0x182c87,_0x460c20);});if(_0x313dc5){return _0x2da9e7['id'];}}}));}}return BPromise['all'](_0x582590)[_0x3d0f('0x27')](function(_0x26084c){_0x8c8eb1=_(_0x8c8eb1)[_0x3d0f('0x79')](_0x26084c)[_0x3d0f('0x7a')]()['value']();return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x29b20c[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](function(_0x19fae6){return db[_0x3d0f('0x68')]['transaction'](function(_0x53e88d){return _0x19fae6[_0x3d0f('0x6f')](_0x29b20c['query'][_0x3d0f('0x62')],{'transaction':_0x53e88d})[_0x3d0f('0x27')](function(){if(!_[_0x3d0f('0x7b')](_0x8c8eb1)){return _0x19fae6[_0x3d0f('0x7c')](_0x8c8eb1,{'transaction':_0x53e88d});}})[_0x3d0f('0x27')](function(){_0x8c8eb1['forEach'](function(_0x1aeb1b){socket[_0x3d0f('0x6e')](_0x3d0f('0x7d'),{'UserId':_0x1aeb1b,'FaxQueueId':_0x19fae6['id']});});});});});});})[_0x3d0f('0x27')](respondWithStatusCode(_0x3fe98a,null))[_0x3d0f('0x44')](handleError(_0x3fe98a,null));};exports[_0x3d0f('0x7e')]=function(_0x1a2d7a,_0x38ddaf,_0x441aca){return db[_0x3d0f('0x3f')]['find']({'where':{'id':_0x1a2d7a['params']['id']}})['then'](handleEntityNotFound(_0x38ddaf,null))[_0x3d0f('0x27')](function(_0x2d262a){if(_0x2d262a){return _0x2d262a[_0x3d0f('0x7e')](_0x1a2d7a[_0x3d0f('0x4b')]['ids'],_[_0x3d0f('0x7f')](_0x1a2d7a[_0x3d0f('0x4b')],[_0x3d0f('0x62'),'id'])||{})[_0x3d0f('0x80')](function(_0x5fc0e9){for(var _0x3d54ec=0x0;_0x3d54ec<_0x1a2d7a['body'][_0x3d0f('0x62')]['length'];_0x3d54ec+=0x1){socket[_0x3d0f('0x6e')](_0x3d0f('0x81'),{'UserId':Number(_0x1a2d7a[_0x3d0f('0x4b')][_0x3d0f('0x62')][_0x3d54ec]),'FaxQueueId':Number(_0x1a2d7a['params']['id'])});}return _0x5fc0e9;});}})[_0x3d0f('0x27')](respondWithResult(_0x38ddaf,null))[_0x3d0f('0x44')](handleError(_0x38ddaf,null));};exports[_0x3d0f('0x7c')]=function(_0x2e9da0,_0x2a167a,_0x473db8){return db[_0x3d0f('0x3f')][_0x3d0f('0x49')]({'where':{'id':_0x2e9da0[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x2a167a,null))[_0x3d0f('0x27')](function(_0x1f4e6a){if(_0x1f4e6a){return _0x1f4e6a['removeAgents'](_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')])[_0x3d0f('0x27')](function(){if(_['isArray'](_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')])){for(var _0x10dddf=0x0;_0x10dddf<_0x2e9da0['query'][_0x3d0f('0x62')]['length'];_0x10dddf+=0x1){socket['emit'](_0x3d0f('0x7d'),{'UserId':Number(_0x2e9da0[_0x3d0f('0x33')][_0x3d0f('0x62')][_0x10dddf]),'FaxQueueId':Number(_0x2e9da0[_0x3d0f('0x46')]['id'])});}}else{socket[_0x3d0f('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x2e9da0['query']['ids']),'FaxQueueId':Number(_0x2e9da0['params']['id'])});}});}})[_0x3d0f('0x27')](respondWithStatusCode(_0x2a167a,null))[_0x3d0f('0x44')](handleError(_0x2a167a,null));};exports['getAgents']=function(_0x1712d5,_0x270d7f,_0x2d1109){var _0x54b809={};var _0x238995={};var _0x2ee861;var _0x37fd88;return db[_0x3d0f('0x3f')][_0x3d0f('0x54')]({'where':{'id':_0x1712d5[_0x3d0f('0x46')]['id']}})[_0x3d0f('0x27')](handleEntityNotFound(_0x270d7f,null))[_0x3d0f('0x27')](function(_0x2f88b3){if(_0x2f88b3){_0x2ee861=_0x2f88b3;_0x238995['model']=_[_0x3d0f('0x32')](db[_0x3d0f('0x59')][_0x3d0f('0x30')]);_0x238995[_0x3d0f('0x33')]=_[_0x3d0f('0x32')](_0x1712d5[_0x3d0f('0x33')]);_0x238995['filters']=_[_0x3d0f('0x47')](_0x238995['model'],_0x238995[_0x3d0f('0x33')]);_0x54b809['attributes']=_[_0x3d0f('0x47')](_0x238995[_0x3d0f('0x35')],qs[_0x3d0f('0x48')](_0x1712d5['query'][_0x3d0f('0x48')]));_0x54b809[_0x3d0f('0x36')]=_0x54b809[_0x3d0f('0x36')][_0x3d0f('0x37')]?_0x54b809['attributes']:_0x238995[_0x3d0f('0x35')];_0x54b809[_0x3d0f('0x39')]=qs[_0x3d0f('0x3a')](_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3a')]);_0x54b809[_0x3d0f('0x3b')]=qs[_0x3d0f('0x34')](_['pick'](_0x1712d5[_0x3d0f('0x33')],_0x238995[_0x3d0f('0x34')]));if(_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3d')]){_0x54b809['where']=_[_0x3d0f('0x3c')](_0x54b809[_0x3d0f('0x3b')],{'$or':_[_0x3d0f('0x57')](_0x54b809[_0x3d0f('0x36')],function(_0xc6fcf5){var _0x39aa30={};_0x39aa30[_0xc6fcf5]={'$like':'%'+_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x3d')]+'%'};return _0x39aa30;})});}_0x54b809=_[_0x3d0f('0x3c')]({},_0x54b809,_0x1712d5[_0x3d0f('0x3e')]);return _0x2ee861['getAgents'](_0x54b809);}})[_0x3d0f('0x27')](function(_0x20263a){if(_0x20263a){_0x37fd88=_0x20263a[_0x3d0f('0x37')];if(!_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x38')]('nolimit')){_0x54b809[_0x3d0f('0x1f')]=qs['limit'](_0x1712d5[_0x3d0f('0x33')][_0x3d0f('0x1f')]);_0x54b809[_0x3d0f('0x1d')]=qs[_0x3d0f('0x1d')](_0x1712d5['query'][_0x3d0f('0x1d')]);}return _0x2ee861['getAgents'](_0x54b809);}})[_0x3d0f('0x27')](function(_0x272280){if(_0x272280){return _0x272280?{'count':_0x37fd88,'rows':_0x272280}:null;}})[_0x3d0f('0x27')](respondWithResult(_0x270d7f,null))[_0x3d0f('0x44')](handleError(_0x270d7f,null));}; \ No newline at end of file +var _0xe8a3=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserFaxQueue','User','faxPause','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','findAll','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','register','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','FaxQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model'];(function(_0x4f7757,_0x387028){var _0x5cfb87=function(_0xe3f14c){while(--_0xe3f14c){_0x4f7757['push'](_0x4f7757['shift']());}};_0x5cfb87(++_0x387028);}(_0xe8a3,0x1db));var _0x3e8a=function(_0x766080,_0x32d34a){_0x766080=_0x766080-0x0;var _0x27f3b5=_0xe8a3[_0x766080];return _0x27f3b5;};'use strict';var emlformat=require(_0x3e8a('0x0'));var rimraf=require(_0x3e8a('0x1'));var zipdir=require(_0x3e8a('0x2'));var jsonpatch=require(_0x3e8a('0x3'));var rp=require(_0x3e8a('0x4'));var moment=require('moment');var BPromise=require(_0x3e8a('0x5'));var Mustache=require(_0x3e8a('0x6'));var util=require('util');var path=require(_0x3e8a('0x7'));var sox=require(_0x3e8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e8a('0x9'));var _=require(_0x3e8a('0xa'));var squel=require(_0x3e8a('0xb'));var crypto=require('crypto');var jsforce=require(_0x3e8a('0xc'));var deskjs=require(_0x3e8a('0xd'));var toCsv=require(_0x3e8a('0xe'));var querystring=require(_0x3e8a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e8a('0x10'));var as=require(_0x3e8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e8a('0x12'))(_0x3e8a('0x13'));var utils=require(_0x3e8a('0x14'));var config=require(_0x3e8a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e8a('0x16'))['db'];config[_0x3e8a('0x17')]=_['defaults'](config[_0x3e8a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e8a('0x17')]));require('./faxQueue.socket')[_0x3e8a('0x18')](socket);function respondWithStatusCode(_0x4acb4a,_0x107aca){_0x107aca=_0x107aca||0xcc;return function(_0x3fcd05){if(_0x3fcd05){return _0x4acb4a['sendStatus'](_0x107aca);}return _0x4acb4a['status'](_0x107aca)['end']();};}function respondWithResult(_0x2e948b,_0x81bd1d){_0x81bd1d=_0x81bd1d||0xc8;return function(_0xfb61fe){if(_0xfb61fe){return _0x2e948b[_0x3e8a('0x19')](_0x81bd1d)[_0x3e8a('0x1a')](_0xfb61fe);}};}function respondWithFilteredResult(_0x54a10a,_0x3895a4){return function(_0x24d485){if(_0x24d485){var _0x57711c=typeof _0x3895a4[_0x3e8a('0x1b')]==='undefined'&&typeof _0x3895a4['limit']===_0x3e8a('0x1c');var _0x1d6ea3=_0x24d485[_0x3e8a('0x1d')];var _0x50c809=_0x57711c?0x0:_0x3895a4['offset'];var _0x39ac19=_0x57711c?_0x24d485[_0x3e8a('0x1d')]:_0x3895a4['offset']+_0x3895a4[_0x3e8a('0x1e')];var _0x25ebf8;if(_0x39ac19>=_0x1d6ea3){_0x39ac19=_0x1d6ea3;_0x25ebf8=0xc8;}else{_0x25ebf8=0xce;}_0x54a10a[_0x3e8a('0x19')](_0x25ebf8);return _0x54a10a[_0x3e8a('0x1f')]('Content-Range',_0x50c809+'-'+_0x39ac19+'/'+_0x1d6ea3)[_0x3e8a('0x1a')](_0x24d485);}return null;};}function patchUpdates(_0x371c29){return function(_0xc7e682){try{jsonpatch[_0x3e8a('0x20')](_0xc7e682,_0x371c29,!![]);}catch(_0x57fd78){return BPromise[_0x3e8a('0x21')](_0x57fd78);}return _0xc7e682['save']();};}function saveUpdates(_0x2eb08e,_0x32a953){return function(_0x491166){if(_0x491166){return _0x491166[_0x3e8a('0x22')](_0x2eb08e)[_0x3e8a('0x23')](function(_0x32e294){return _0x32e294;});}return null;};}function removeEntity(_0x56ef59,_0x4476cc){return function(_0x2bdf14){if(_0x2bdf14){return _0x2bdf14[_0x3e8a('0x24')]()[_0x3e8a('0x23')](function(){var _0x2f6771=_0x2bdf14[_0x3e8a('0x25')]({'plain':!![]});var _0x987501=_0x3e8a('0x26');return db[_0x3e8a('0x27')]['destroy']({'where':{'type':_0x987501,'resourceId':_0x2f6771['id']}})[_0x3e8a('0x23')](function(){return _0x2bdf14;});})[_0x3e8a('0x23')](function(){_0x56ef59[_0x3e8a('0x19')](0xcc)[_0x3e8a('0x28')]();});}};}function handleEntityNotFound(_0x411eaa,_0x48e6bc){return function(_0x4f2ec7){if(!_0x4f2ec7){_0x411eaa[_0x3e8a('0x29')](0x194);}return _0x4f2ec7;};}function handleError(_0x3c2b91,_0x5bf49e){_0x5bf49e=_0x5bf49e||0x1f4;return function(_0x375e7a){logger[_0x3e8a('0x2a')](_0x375e7a[_0x3e8a('0x2b')]);if(_0x375e7a[_0x3e8a('0x2c')]){delete _0x375e7a[_0x3e8a('0x2c')];}_0x3c2b91[_0x3e8a('0x19')](_0x5bf49e)[_0x3e8a('0x2d')](_0x375e7a);};}exports[_0x3e8a('0x2e')]=function(_0x30d0e1,_0x395d00){var _0x161a4b={},_0x8000c8={},_0x1b0598={'count':0x0,'rows':[]};var _0x2e1c4f=_[_0x3e8a('0x2f')](db[_0x3e8a('0x30')][_0x3e8a('0x31')],function(_0x288c5b){return{'name':_0x288c5b[_0x3e8a('0x32')],'type':_0x288c5b[_0x3e8a('0x33')]['key']};});_0x8000c8[_0x3e8a('0x34')]=_[_0x3e8a('0x2f')](_0x2e1c4f,_0x3e8a('0x2c'));_0x8000c8[_0x3e8a('0x35')]=_[_0x3e8a('0x36')](_0x30d0e1[_0x3e8a('0x35')]);_0x8000c8[_0x3e8a('0x37')]=_['intersection'](_0x8000c8[_0x3e8a('0x34')],_0x8000c8[_0x3e8a('0x35')]);_0x161a4b[_0x3e8a('0x38')]=_[_0x3e8a('0x39')](_0x8000c8[_0x3e8a('0x34')],qs[_0x3e8a('0x3a')](_0x30d0e1['query'][_0x3e8a('0x3a')]));_0x161a4b['attributes']=_0x161a4b['attributes'][_0x3e8a('0x3b')]?_0x161a4b['attributes']:_0x8000c8[_0x3e8a('0x34')];if(!_0x30d0e1[_0x3e8a('0x35')][_0x3e8a('0x3c')](_0x3e8a('0x3d'))){_0x161a4b['limit']=qs['limit'](_0x30d0e1[_0x3e8a('0x35')][_0x3e8a('0x1e')]);_0x161a4b[_0x3e8a('0x1b')]=qs['offset'](_0x30d0e1['query'][_0x3e8a('0x1b')]);}_0x161a4b[_0x3e8a('0x3e')]=qs[_0x3e8a('0x3f')](_0x30d0e1[_0x3e8a('0x35')][_0x3e8a('0x3f')]);_0x161a4b[_0x3e8a('0x40')]=qs[_0x3e8a('0x37')](_[_0x3e8a('0x41')](_0x30d0e1[_0x3e8a('0x35')],_0x8000c8[_0x3e8a('0x37')]),_0x2e1c4f);if(_0x30d0e1['query'][_0x3e8a('0x42')]){_0x161a4b['where']=_[_0x3e8a('0x43')](_0x161a4b[_0x3e8a('0x40')],{'$or':_[_0x3e8a('0x2f')](_0x2e1c4f,function(_0x37ef48){if(_0x37ef48[_0x3e8a('0x33')]!==_0x3e8a('0x44')){var _0x54c5c6={};_0x54c5c6[_0x37ef48[_0x3e8a('0x2c')]]={'$like':'%'+_0x30d0e1[_0x3e8a('0x35')][_0x3e8a('0x42')]+'%'};return _0x54c5c6;}})});}_0x161a4b=_[_0x3e8a('0x43')]({},_0x161a4b,_0x30d0e1[_0x3e8a('0x45')]);var _0x2a6abb={'where':_0x161a4b[_0x3e8a('0x40')]};return db[_0x3e8a('0x30')][_0x3e8a('0x1d')](_0x2a6abb)[_0x3e8a('0x23')](function(_0x2ca828){_0x1b0598[_0x3e8a('0x1d')]=_0x2ca828;if(_0x30d0e1[_0x3e8a('0x35')]['includeAll']){_0x161a4b[_0x3e8a('0x46')]=[{'all':!![]}];}return db[_0x3e8a('0x30')]['findAll'](_0x161a4b);})[_0x3e8a('0x23')](function(_0x515aa9){_0x1b0598[_0x3e8a('0x47')]=_0x515aa9;return _0x1b0598;})[_0x3e8a('0x23')](respondWithFilteredResult(_0x395d00,_0x161a4b))[_0x3e8a('0x48')](handleError(_0x395d00,null));};exports[_0x3e8a('0x49')]=function(_0x4817a1,_0x18cd06){var _0x5d4277={'raw':!![],'where':{'id':_0x4817a1[_0x3e8a('0x4a')]['id']}},_0xf4d10f={};_0xf4d10f[_0x3e8a('0x34')]=_['keys'](db[_0x3e8a('0x30')][_0x3e8a('0x31')]);_0xf4d10f['query']=_[_0x3e8a('0x36')](_0x4817a1[_0x3e8a('0x35')]);_0xf4d10f[_0x3e8a('0x37')]=_[_0x3e8a('0x39')](_0xf4d10f[_0x3e8a('0x34')],_0xf4d10f['query']);_0x5d4277['attributes']=_[_0x3e8a('0x39')](_0xf4d10f[_0x3e8a('0x34')],qs[_0x3e8a('0x3a')](_0x4817a1[_0x3e8a('0x35')][_0x3e8a('0x3a')]));_0x5d4277['attributes']=_0x5d4277[_0x3e8a('0x38')]['length']?_0x5d4277[_0x3e8a('0x38')]:_0xf4d10f[_0x3e8a('0x34')];if(_0x4817a1[_0x3e8a('0x35')]['includeAll']){_0x5d4277[_0x3e8a('0x46')]=[{'all':!![]}];}_0x5d4277=_[_0x3e8a('0x43')]({},_0x5d4277,_0x4817a1[_0x3e8a('0x45')]);return db[_0x3e8a('0x30')]['find'](_0x5d4277)['then'](handleEntityNotFound(_0x18cd06,null))[_0x3e8a('0x23')](respondWithResult(_0x18cd06,null))[_0x3e8a('0x48')](handleError(_0x18cd06,null));};exports[_0x3e8a('0x4b')]=function(_0x3f6412,_0x3b6971){return db[_0x3e8a('0x30')][_0x3e8a('0x4b')](_0x3f6412[_0x3e8a('0x4c')],{})['then'](function(_0x2f1504){var _0x262a03=_0x3f6412[_0x3e8a('0x4d')][_0x3e8a('0x25')]({'plain':!![]});if(!_0x262a03)throw new Error(_0x3e8a('0x4e'));if(_0x262a03[_0x3e8a('0x4f')]===_0x3e8a('0x4d')){var _0x18ef45=_0x2f1504[_0x3e8a('0x25')]({'plain':!![]});var _0x210a9f='FaxQueues';return db[_0x3e8a('0x50')][_0x3e8a('0x51')]({'where':{'name':_0x210a9f,'userProfileId':_0x262a03[_0x3e8a('0x52')]},'raw':!![]})[_0x3e8a('0x23')](function(_0x1713e8){if(_0x1713e8&&_0x1713e8['autoAssociation']===0x0){return db[_0x3e8a('0x27')][_0x3e8a('0x4b')]({'name':_0x18ef45['name'],'resourceId':_0x18ef45['id'],'type':_0x1713e8[_0x3e8a('0x2c')],'sectionId':_0x1713e8['id']},{})[_0x3e8a('0x23')](function(){return _0x2f1504;});}else{return _0x2f1504;}})['catch'](function(_0x1ee780){logger[_0x3e8a('0x2a')](_0x3e8a('0x53'),_0x1ee780);throw _0x1ee780;});}return _0x2f1504;})[_0x3e8a('0x23')](respondWithResult(_0x3b6971,0xc9))['catch'](handleError(_0x3b6971,null));};exports[_0x3e8a('0x22')]=function(_0x57279b,_0x24e6b9){if(_0x57279b[_0x3e8a('0x4c')]['id']){delete _0x57279b['body']['id'];}return db[_0x3e8a('0x30')][_0x3e8a('0x51')]({'where':{'id':_0x57279b[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x24e6b9,null))[_0x3e8a('0x23')](saveUpdates(_0x57279b[_0x3e8a('0x4c')],null))['then'](respondWithResult(_0x24e6b9,null))[_0x3e8a('0x48')](handleError(_0x24e6b9,null));};exports[_0x3e8a('0x24')]=function(_0x559ff7,_0x67fa02){return db[_0x3e8a('0x30')][_0x3e8a('0x51')]({'where':{'id':_0x559ff7[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x67fa02,null))[_0x3e8a('0x23')](removeEntity(_0x67fa02,null))[_0x3e8a('0x48')](handleError(_0x67fa02,null));};exports['describe']=function(_0x4bc637,_0x2b468d){return db[_0x3e8a('0x30')]['describe']()[_0x3e8a('0x23')](respondWithResult(_0x2b468d,null))['catch'](handleError(_0x2b468d,null));};exports[_0x3e8a('0x54')]=function(_0x771bb0,_0x18d22b,_0x299403){var _0x191b89={'raw':!![],'where':{}},_0x527f9c={},_0x42f98b;return db[_0x3e8a('0x30')][_0x3e8a('0x55')]({'where':{'id':_0x771bb0[_0x3e8a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18d22b,null))['then'](function(_0x1d2408){if(_0x1d2408){_0x42f98b=_0x1d2408[_0x3e8a('0x25')]({'plain':!![]});_0x527f9c[_0x3e8a('0x34')]=_[_0x3e8a('0x36')](db[_0x3e8a('0x56')][_0x3e8a('0x31')]);_0x527f9c['query']=_[_0x3e8a('0x36')](_0x771bb0[_0x3e8a('0x35')]);_0x527f9c[_0x3e8a('0x37')]=_[_0x3e8a('0x39')](_0x527f9c[_0x3e8a('0x34')],_0x527f9c[_0x3e8a('0x35')]);_0x191b89[_0x3e8a('0x38')]=_[_0x3e8a('0x39')](_0x527f9c[_0x3e8a('0x34')],qs[_0x3e8a('0x3a')](_0x771bb0['query'][_0x3e8a('0x3a')]));_0x191b89[_0x3e8a('0x38')]=_0x191b89[_0x3e8a('0x38')][_0x3e8a('0x3b')]?_0x191b89[_0x3e8a('0x38')]:_0x527f9c['model'];if(!_0x771bb0[_0x3e8a('0x35')][_0x3e8a('0x3c')]('nolimit')){_0x191b89['limit']=qs[_0x3e8a('0x1e')](_0x771bb0['query']['limit']);_0x191b89[_0x3e8a('0x1b')]=qs[_0x3e8a('0x1b')](_0x771bb0[_0x3e8a('0x35')]['offset']);}_0x191b89['order']=qs[_0x3e8a('0x3f')](_0x771bb0[_0x3e8a('0x35')][_0x3e8a('0x3f')]);_0x191b89[_0x3e8a('0x40')]=qs['filters'](_[_0x3e8a('0x41')](_0x771bb0['query'],_0x527f9c[_0x3e8a('0x37')]));_0x191b89[_0x3e8a('0x40')]['FaxQueueId']=_0x1d2408['id'];if(_0x771bb0[_0x3e8a('0x35')][_0x3e8a('0x42')]){_0x191b89['where']=_[_0x3e8a('0x43')](_0x191b89[_0x3e8a('0x40')],{'$or':_[_0x3e8a('0x2f')](_0x191b89[_0x3e8a('0x38')],function(_0x4b278a){var _0x3e633c={};_0x3e633c[_0x4b278a]={'$like':'%'+_0x771bb0['query'][_0x3e8a('0x42')]+'%'};return _0x3e633c;})});}_0x191b89=_[_0x3e8a('0x43')]({},_0x191b89,_0x771bb0[_0x3e8a('0x45')]);return db[_0x3e8a('0x56')]['findAll'](_0x191b89);}})[_0x3e8a('0x23')](function(_0x5ceff9){if(_0x5ceff9){return db[_0x3e8a('0x57')]['findAndCountAll']({'where':{'id':_[_0x3e8a('0x2f')](_0x5ceff9,'UserId'),'role':'agent'},'attributes':['id',_0x3e8a('0x2c'),_0x3e8a('0x58'),'updatedAt',_0x3e8a('0x59')]});}})[_0x3e8a('0x23')](function(_0x27b5d4){if(_0x27b5d4){return{'count':_0x27b5d4['count'],'rows':_['map'](_0x27b5d4[_0x3e8a('0x47')],function(_0x2e5037){return{'membername':_0x2e5037[_0x3e8a('0x2c')],'UserId':_0x2e5037['id'],'queue_name':_0x42f98b[_0x3e8a('0x2c')],'FaxQueueId':_0x42f98b['id'],'interface':util['format'](_0x3e8a('0x5a'),_0x3e8a('0x5b'),_0x2e5037['name']),'penalty':0x0,'paused':_0x2e5037[_0x3e8a('0x58')],'createdAt':_0x2e5037[_0x3e8a('0x59')],'updatedAt':_0x2e5037[_0x3e8a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3e8a('0x23')](respondWithFilteredResult(_0x18d22b,_0x191b89))['catch'](handleError(_0x18d22b,null));};exports['getTeams']=function(_0x84b7d,_0x50e4ff,_0x416569){var _0xd5cd64={};var _0x352a76={};var _0x418697;var _0xcc4c85;return db['FaxQueue'][_0x3e8a('0x55')]({'where':{'id':_0x84b7d[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x50e4ff,null))[_0x3e8a('0x23')](function(_0x5136e1){if(_0x5136e1){_0x418697=_0x5136e1;_0x352a76['model']=_[_0x3e8a('0x36')](db[_0x3e8a('0x5d')][_0x3e8a('0x31')]);_0x352a76['query']=_[_0x3e8a('0x36')](_0x84b7d[_0x3e8a('0x35')]);_0x352a76['filters']=_[_0x3e8a('0x39')](_0x352a76[_0x3e8a('0x34')],_0x352a76[_0x3e8a('0x35')]);_0xd5cd64[_0x3e8a('0x38')]=_[_0x3e8a('0x39')](_0x352a76[_0x3e8a('0x34')],qs['fields'](_0x84b7d[_0x3e8a('0x35')][_0x3e8a('0x3a')]));_0xd5cd64[_0x3e8a('0x38')]=_0xd5cd64[_0x3e8a('0x38')][_0x3e8a('0x3b')]?_0xd5cd64[_0x3e8a('0x38')]:_0x352a76[_0x3e8a('0x34')];_0xd5cd64[_0x3e8a('0x3e')]=qs[_0x3e8a('0x3f')](_0x84b7d['query']['sort']);_0xd5cd64[_0x3e8a('0x40')]=qs[_0x3e8a('0x37')](_[_0x3e8a('0x41')](_0x84b7d['query'],_0x352a76[_0x3e8a('0x37')]));if(_0x84b7d[_0x3e8a('0x35')][_0x3e8a('0x42')]){_0xd5cd64[_0x3e8a('0x40')]=_['merge'](_0xd5cd64[_0x3e8a('0x40')],{'$or':_['map'](_0xd5cd64[_0x3e8a('0x38')],function(_0x2402b1){var _0x5037af={};_0x5037af[_0x2402b1]={'$like':'%'+_0x84b7d['query'][_0x3e8a('0x42')]+'%'};return _0x5037af;})});}_0xd5cd64=_[_0x3e8a('0x43')]({},_0xd5cd64,_0x84b7d['options']);return _0x418697[_0x3e8a('0x5e')](_0xd5cd64);}})[_0x3e8a('0x23')](function(_0x24134c){if(_0x24134c){_0xcc4c85=_0x24134c['length'];if(!_0x84b7d[_0x3e8a('0x35')]['hasOwnProperty']('nolimit')){_0xd5cd64[_0x3e8a('0x1e')]=qs[_0x3e8a('0x1e')](_0x84b7d[_0x3e8a('0x35')][_0x3e8a('0x1e')]);_0xd5cd64[_0x3e8a('0x1b')]=qs['offset'](_0x84b7d[_0x3e8a('0x35')]['offset']);}return _0x418697['getTeams'](_0xd5cd64);}})[_0x3e8a('0x23')](function(_0x2eb100){if(_0x2eb100){return _0x2eb100?{'count':_0xcc4c85,'rows':_0x2eb100}:null;}})[_0x3e8a('0x23')](respondWithResult(_0x50e4ff,null))[_0x3e8a('0x48')](handleError(_0x50e4ff,null));};exports[_0x3e8a('0x5f')]=function(_0x1d9604,_0x415a54,_0x427ba6){var _0x1f8fc1=_0x1d9604[_0x3e8a('0x4c')][_0x3e8a('0x60')];return db[_0x3e8a('0x5d')][_0x3e8a('0x61')]({'where':{'id':_0x1f8fc1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3e8a('0x62'),'attributes':['id',_0x3e8a('0x2c'),'online',_0x3e8a('0x63'),_0x3e8a('0x64')],'raw':!![]}]})['then'](function(_0x41bd3e){if(_0x41bd3e){var _0x10f5ce=_['flatMap'](_0x41bd3e,function(_0x5c3421){var _0x2dd4f2=_0x5c3421[_0x3e8a('0x25')]({'plain':!![]});return _0x2dd4f2[_0x3e8a('0x62')];});return db[_0x3e8a('0x30')][_0x3e8a('0x51')]({'where':{'id':_0x1d9604[_0x3e8a('0x4a')]['id']}})['then'](function(_0x21cbcb){return db[_0x3e8a('0x65')][_0x3e8a('0x66')](function(_0x2b9e39){return _0x21cbcb[_0x3e8a('0x5f')](_0x1f8fc1,{'transaction':_0x2b9e39})[_0x3e8a('0x23')](function(){return BPromise[_0x3e8a('0x67')](_0x10f5ce,function(_0xc3e10a){return db[_0x3e8a('0x56')][_0x3e8a('0x68')]({'where':{'UserId':_0xc3e10a['id'],'FaxQueueId':_0x1d9604['params']['id']},'transaction':_0x2b9e39});});})['then'](function(){_0x10f5ce[_0x3e8a('0x69')](function(_0x5bd41b){socket[_0x3e8a('0x6a')](_0x3e8a('0x6b'),{'UserId':_0x5bd41b['id'],'FaxQueueId':_0x21cbcb['id']});});});});});}})[_0x3e8a('0x23')](respondWithStatusCode(_0x415a54,null))[_0x3e8a('0x48')](handleError(_0x415a54,null));};exports[_0x3e8a('0x6c')]=function(_0xb51121,_0x462466,_0x15fa59){return db[_0x3e8a('0x5d')]['findAll']({'where':{'id':_0xb51121[_0x3e8a('0x35')][_0x3e8a('0x60')]},'attributes':['id'],'include':[{'model':db[_0x3e8a('0x57')],'as':_0x3e8a('0x62'),'attributes':['id'],'raw':!![]}]})[_0x3e8a('0x23')](handleEntityNotFound(_0x462466,null))['then'](function(_0xc9b877){var _0xea7910=_[_0x3e8a('0x2f')](_0xc9b877,'id');var _0x4c3372=[];var _0x4c2bab=[];var _0x5b1ec9=squel[_0x3e8a('0x6d')]();_0x5b1ec9[_0x3e8a('0x6e')](_0x3e8a('0x6f'))[_0x3e8a('0x70')](_0x3e8a('0x71'),'tq')['join'](_0x3e8a('0x72'),'ut',_0x3e8a('0x73'))[_0x3e8a('0x40')](_0x3e8a('0x74'),_0xb51121['params']['id']);for(var _0x17ef37=0x0;_0x17ef37<_0xc9b877[_0x3e8a('0x3b')];_0x17ef37+=0x1){let _0x1e208c=_0xc9b877[_0x17ef37];for(var _0x2ffeee=0x0;_0x2ffeee<_0x1e208c[_0x3e8a('0x62')][_0x3e8a('0x3b')];_0x2ffeee+=0x1){let _0x5d6a72=_0x1e208c[_0x3e8a('0x62')][_0x2ffeee];var _0x3c8cf5=_0x5b1ec9[_0x3e8a('0x75')]();_0x3c8cf5[_0x3e8a('0x40')](_0x3e8a('0x76'),_0x5d6a72['id']);_0x4c2bab[_0x3e8a('0x77')](db[_0x3e8a('0x65')][_0x3e8a('0x35')](_0x3c8cf5['toString'](),{'type':db[_0x3e8a('0x65')]['QueryTypes'][_0x3e8a('0x78')]})[_0x3e8a('0x23')](function(_0x72da96){if(_0x72da96[_0x3e8a('0x3b')]===0x1){return _0x5d6a72['id'];}else{var _0x1b861c=_[_0x3e8a('0x79')](_[_0x3e8a('0x2f')](_0x72da96,'TeamId'),function(_0x4ce03a){return _['includes'](_0xea7910,_0x4ce03a);});if(_0x1b861c){return _0x5d6a72['id'];}}}));}}return BPromise[_0x3e8a('0x7a')](_0x4c2bab)[_0x3e8a('0x23')](function(_0xa314e7){_0x4c3372=_(_0x4c3372)[_0x3e8a('0x7b')](_0xa314e7)[_0x3e8a('0x7c')]()[_0x3e8a('0x7d')]();return db[_0x3e8a('0x30')][_0x3e8a('0x51')]({'where':{'id':_0xb51121[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](function(_0x2a9505){return db['sequelize'][_0x3e8a('0x66')](function(_0x45f9e9){return _0x2a9505[_0x3e8a('0x6c')](_0xb51121[_0x3e8a('0x35')][_0x3e8a('0x60')],{'transaction':_0x45f9e9})['then'](function(){if(!_['isEmpty'](_0x4c3372)){return _0x2a9505[_0x3e8a('0x7e')](_0x4c3372,{'transaction':_0x45f9e9});}})[_0x3e8a('0x23')](function(){_0x4c3372[_0x3e8a('0x69')](function(_0x945a0f){socket[_0x3e8a('0x6a')](_0x3e8a('0x7f'),{'UserId':_0x945a0f,'FaxQueueId':_0x2a9505['id']});});});});});});})[_0x3e8a('0x23')](respondWithStatusCode(_0x462466,null))[_0x3e8a('0x48')](handleError(_0x462466,null));};exports['addAgents']=function(_0x53c35d,_0x477aa7,_0x9397bd){return db[_0x3e8a('0x30')][_0x3e8a('0x51')]({'where':{'id':_0x53c35d[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x477aa7,null))[_0x3e8a('0x23')](function(_0x12ec2f){if(_0x12ec2f){return _0x12ec2f[_0x3e8a('0x80')](_0x53c35d[_0x3e8a('0x4c')][_0x3e8a('0x60')],_[_0x3e8a('0x81')](_0x53c35d[_0x3e8a('0x4c')],[_0x3e8a('0x60'),'id'])||{})[_0x3e8a('0x82')](function(_0x2e48c9){for(var _0x54146a=0x0;_0x54146a<_0x53c35d[_0x3e8a('0x4c')][_0x3e8a('0x60')]['length'];_0x54146a+=0x1){socket[_0x3e8a('0x6a')]('userFaxQueue:save',{'UserId':Number(_0x53c35d[_0x3e8a('0x4c')][_0x3e8a('0x60')][_0x54146a]),'FaxQueueId':Number(_0x53c35d[_0x3e8a('0x4a')]['id'])});}return _0x2e48c9;});}})[_0x3e8a('0x23')](respondWithResult(_0x477aa7,null))[_0x3e8a('0x48')](handleError(_0x477aa7,null));};exports[_0x3e8a('0x7e')]=function(_0x2d31e1,_0x4d0e15,_0x5e1b0f){return db[_0x3e8a('0x30')]['find']({'where':{'id':_0x2d31e1[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x4d0e15,null))[_0x3e8a('0x23')](function(_0x29dfdc){if(_0x29dfdc){return _0x29dfdc['removeAgents'](_0x2d31e1[_0x3e8a('0x35')][_0x3e8a('0x60')])[_0x3e8a('0x23')](function(){if(_['isArray'](_0x2d31e1[_0x3e8a('0x35')]['ids'])){for(var _0x5115f5=0x0;_0x5115f5<_0x2d31e1[_0x3e8a('0x35')][_0x3e8a('0x60')][_0x3e8a('0x3b')];_0x5115f5+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x2d31e1[_0x3e8a('0x35')][_0x3e8a('0x60')][_0x5115f5]),'FaxQueueId':Number(_0x2d31e1[_0x3e8a('0x4a')]['id'])});}}else{socket[_0x3e8a('0x6a')](_0x3e8a('0x7f'),{'UserId':Number(_0x2d31e1[_0x3e8a('0x35')][_0x3e8a('0x60')]),'FaxQueueId':Number(_0x2d31e1[_0x3e8a('0x4a')]['id'])});}});}})[_0x3e8a('0x23')](respondWithStatusCode(_0x4d0e15,null))[_0x3e8a('0x48')](handleError(_0x4d0e15,null));};exports[_0x3e8a('0x83')]=function(_0x3147b9,_0x4cdc6e,_0x466f8f){var _0x4818b2={};var _0x2da516={};var _0x1e88f9;var _0x3458f6;return db[_0x3e8a('0x30')][_0x3e8a('0x55')]({'where':{'id':_0x3147b9[_0x3e8a('0x4a')]['id']}})[_0x3e8a('0x23')](handleEntityNotFound(_0x4cdc6e,null))[_0x3e8a('0x23')](function(_0x40feba){if(_0x40feba){_0x1e88f9=_0x40feba;_0x2da516[_0x3e8a('0x34')]=_['keys'](db[_0x3e8a('0x57')][_0x3e8a('0x31')]);_0x2da516[_0x3e8a('0x35')]=_['keys'](_0x3147b9[_0x3e8a('0x35')]);_0x2da516[_0x3e8a('0x37')]=_[_0x3e8a('0x39')](_0x2da516[_0x3e8a('0x34')],_0x2da516[_0x3e8a('0x35')]);_0x4818b2[_0x3e8a('0x38')]=_['intersection'](_0x2da516['model'],qs[_0x3e8a('0x3a')](_0x3147b9[_0x3e8a('0x35')][_0x3e8a('0x3a')]));_0x4818b2[_0x3e8a('0x38')]=_0x4818b2['attributes'][_0x3e8a('0x3b')]?_0x4818b2[_0x3e8a('0x38')]:_0x2da516[_0x3e8a('0x34')];_0x4818b2[_0x3e8a('0x3e')]=qs[_0x3e8a('0x3f')](_0x3147b9[_0x3e8a('0x35')][_0x3e8a('0x3f')]);_0x4818b2[_0x3e8a('0x40')]=qs[_0x3e8a('0x37')](_['pick'](_0x3147b9[_0x3e8a('0x35')],_0x2da516[_0x3e8a('0x37')]));if(_0x3147b9[_0x3e8a('0x35')][_0x3e8a('0x42')]){_0x4818b2[_0x3e8a('0x40')]=_[_0x3e8a('0x43')](_0x4818b2[_0x3e8a('0x40')],{'$or':_[_0x3e8a('0x2f')](_0x4818b2[_0x3e8a('0x38')],function(_0x26b80c){var _0x4b32e0={};_0x4b32e0[_0x26b80c]={'$like':'%'+_0x3147b9['query']['filter']+'%'};return _0x4b32e0;})});}_0x4818b2=_['merge']({},_0x4818b2,_0x3147b9[_0x3e8a('0x45')]);return _0x1e88f9['getAgents'](_0x4818b2);}})['then'](function(_0x1b7ecb){if(_0x1b7ecb){_0x3458f6=_0x1b7ecb['length'];if(!_0x3147b9[_0x3e8a('0x35')][_0x3e8a('0x3c')](_0x3e8a('0x3d'))){_0x4818b2[_0x3e8a('0x1e')]=qs['limit'](_0x3147b9[_0x3e8a('0x35')][_0x3e8a('0x1e')]);_0x4818b2[_0x3e8a('0x1b')]=qs[_0x3e8a('0x1b')](_0x3147b9[_0x3e8a('0x35')]['offset']);}return _0x1e88f9[_0x3e8a('0x83')](_0x4818b2);}})['then'](function(_0x3b3ebf){if(_0x3b3ebf){return _0x3b3ebf?{'count':_0x3458f6,'rows':_0x3b3ebf}:null;}})['then'](respondWithResult(_0x4cdc6e,null))['catch'](handleError(_0x4cdc6e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0675510..de5b61c 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 _0xcad1=['save','update','remove','emit','hook','exports','events','FaxQueue','setMaxListeners'];(function(_0x284781,_0x149474){var _0x140ecc=function(_0x75c57b){while(--_0x75c57b){_0x284781['push'](_0x284781['shift']());}};_0x140ecc(++_0x149474);}(_0xcad1,0x16e));var _0x1cad=function(_0x7a8ad8,_0x3924a8){_0x7a8ad8=_0x7a8ad8-0x0;var _0x3cdf82=_0xcad1[_0x7a8ad8];return _0x3cdf82;};'use strict';var EventEmitter=require(_0x1cad('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1cad('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1cad('0x2')](0x0);var events={'afterCreate':_0x1cad('0x3'),'afterUpdate':_0x1cad('0x4'),'afterDestroy':_0x1cad('0x5')};function emitEvent(_0x1df02b){return function(_0x5184f6,_0x201b48,_0x4a7772){FaxQueueEvents[_0x1cad('0x6')](_0x1df02b+':'+_0x5184f6['id'],_0x5184f6);FaxQueueEvents[_0x1cad('0x6')](_0x1df02b,_0x5184f6);_0x4a7772(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1cad('0x7')](e,emitEvent(event));}}module[_0x1cad('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xa55c=['save','update','emit','hasOwnProperty','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x5912aa,_0x56560e){var _0x2973cc=function(_0x3ab723){while(--_0x3ab723){_0x5912aa['push'](_0x5912aa['shift']());}};_0x2973cc(++_0x56560e);}(_0xa55c,0x11d));var _0xca55=function(_0x4f7068,_0x2a12f8){_0x4f7068=_0x4f7068-0x0;var _0x34136a=_0xa55c[_0x4f7068];return _0x34136a;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xca55('0x0'))['db'][_0xca55('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xca55('0x2')](0x0);var events={'afterCreate':_0xca55('0x3'),'afterUpdate':_0xca55('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf14693){return function(_0x11657a,_0x8424c7,_0x1fd0f1){FaxQueueEvents['emit'](_0xf14693+':'+_0x11657a['id'],_0x11657a);FaxQueueEvents[_0xca55('0x5')](_0xf14693,_0x11657a);_0x1fd0f1(null);};}for(var e in events){if(events[_0xca55('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xca55('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f72d32b..38b46d5 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 _0x61e5=['request-promise','path','rimraf','./faxQueue.attributes','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x498ad8,_0x168ccb){var _0x165383=function(_0x41d1dc){while(--_0x41d1dc){_0x498ad8['push'](_0x498ad8['shift']());}};_0x165383(++_0x168ccb);}(_0x61e5,0xf7));var _0x561e=function(_0x28a580,_0x5a52f8){_0x28a580=_0x28a580-0x0;var _0x24096c=_0x61e5[_0x28a580];return _0x24096c;};'use strict';var _=require(_0x561e('0x0'));var util=require(_0x561e('0x1'));var logger=require(_0x561e('0x2'))(_0x561e('0x3'));var moment=require(_0x561e('0x4'));var BPromise=require(_0x561e('0x5'));var rp=require(_0x561e('0x6'));var fs=require('fs');var path=require(_0x561e('0x7'));var rimraf=require(_0x561e('0x8'));var config=require('../../config/environment');var attributes=require(_0x561e('0x9'));module['exports']=function(_0x3c31d9,_0x32d14f){return _0x3c31d9['define'](_0x561e('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10de=['rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1809f0,_0x135693){var _0x3aedf2=function(_0x4ca03a){while(--_0x4ca03a){_0x1809f0['push'](_0x1809f0['shift']());}};_0x3aedf2(++_0x135693);}(_0x10de,0x84));var _0xe10d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10de[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xe10d('0x0'));var util=require(_0xe10d('0x1'));var logger=require(_0xe10d('0x2'))(_0xe10d('0x3'));var moment=require(_0xe10d('0x4'));var BPromise=require(_0xe10d('0x5'));var rp=require(_0xe10d('0x6'));var fs=require('fs');var path=require(_0xe10d('0x7'));var rimraf=require(_0xe10d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe10d('0x9'));module[_0xe10d('0xa')]=function(_0x2fe6cf,_0xd1e06e){return _0x2fe6cf[_0xe10d('0xb')](_0xe10d('0xc'),attributes,{'tableName':_0xe10d('0xd'),'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 76c1a60..96c8d52 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 _0x1c3c=['redis','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','debug','catch','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','localhost','socket.io-emitter'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x1c3c,0x84));var _0xc1c3=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x1c3c[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0xc1c3('0x0'));var moment=require(_0xc1c3('0x1'));var BPromise=require(_0xc1c3('0x2'));var rs=require(_0xc1c3('0x3'));var fs=require('fs');var Redis=require(_0xc1c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1c3('0x5'));var logger=require('../../config/logger')(_0xc1c3('0x6'));var config=require(_0xc1c3('0x7'));var jayson=require(_0xc1c3('0x8'));var client=jayson[_0xc1c3('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xc1c3('0xa'),'port':0x18eb});var socket=require(_0xc1c3('0xb'))(new Redis(config[_0xc1c3('0xc')]));require(_0xc1c3('0xd'))['register'](socket);function respondWithRpcPromise(_0x5eb5ba,_0xd03a5e,_0x111b90){return new BPromise(function(_0x5d3426,_0x286249){return client[_0xc1c3('0xe')](_0x5eb5ba,_0x111b90)[_0xc1c3('0xf')](function(_0x210946){logger['info'](_0xc1c3('0x10'),_0xd03a5e,'request\x20sent');logger['debug'](_0xc1c3('0x11'),_0xd03a5e,_0xc1c3('0x12'),JSON[_0xc1c3('0x13')](_0x210946));if(_0x210946['error']){if(_0x210946['error']['code']===0x1f4){logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);return _0x286249(_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);}logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);return _0x5d3426(_0x210946[_0xc1c3('0x14')][_0xc1c3('0x15')]);}else{logger[_0xc1c3('0x16')](_0xc1c3('0x10'),_0xd03a5e,_0xc1c3('0x12'));_0x5d3426(_0x210946[_0xc1c3('0x17')][_0xc1c3('0x15')]);}})['catch'](function(_0x1c95fc){logger[_0xc1c3('0x14')](_0xc1c3('0x10'),_0xd03a5e,_0x1c95fc);_0x286249(_0x1c95fc);});});}exports[_0xc1c3('0x18')]=function(_0x4030aa){var _0x502d76=this;return new Promise(function(_0x22adf6,_0x25c72f){return db[_0xc1c3('0x19')]['findAll']({'raw':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1c')]||null:null,'attributes':_0x4030aa['options']?_0x4030aa[_0xc1c3('0x1a')][_0xc1c3('0x1d')]||null:null,'limit':_0x4030aa['options']?_0x4030aa[_0xc1c3('0x1a')]['limit']||null:null,'include':_0x4030aa[_0xc1c3('0x1a')]?_0x4030aa['options'][_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x4030aa['options'][_0xc1c3('0x1e')],function(_0x281de8){return{'model':db[_0x281de8[_0xc1c3('0x20')]],'as':_0x281de8['as'],'attributes':_0x281de8[_0xc1c3('0x1d')],'include':_0x281de8[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x281de8[_0xc1c3('0x1e')],function(_0x529007){return{'model':db[_0x529007[_0xc1c3('0x20')]],'as':_0x529007['as'],'attributes':_0x529007[_0xc1c3('0x1d')],'include':_0x529007[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x529007[_0xc1c3('0x1e')],function(_0x3d8310){return{'model':db[_0x3d8310[_0xc1c3('0x20')]],'as':_0x3d8310['as'],'attributes':_0x3d8310['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1c3('0xf')](function(_0x8ebda9){logger[_0xc1c3('0x16')](_0xc1c3('0x18'),_0x4030aa);logger[_0xc1c3('0x21')]('GetFaxQueue',_0x4030aa,JSON['stringify'](_0x8ebda9));_0x22adf6(_0x8ebda9);})[_0xc1c3('0x22')](function(_0xbbe3f3){logger[_0xc1c3('0x14')]('GetFaxQueue',_0xbbe3f3[_0xc1c3('0x15')],_0x4030aa);_0x25c72f(_0x502d76[_0xc1c3('0x14')](0x1f4,_0xbbe3f3[_0xc1c3('0x15')]));});});};exports[_0xc1c3('0x23')]=function(_0x2a8aa0){var _0x26c557=this;return new Promise(function(_0x19fe5a,_0x37bb96){return db[_0xc1c3('0x19')]['find']({'raw':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1c')]||null:null,'attributes':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')]['attributes']||null:null,'include':_0x2a8aa0[_0xc1c3('0x1a')]?_0x2a8aa0[_0xc1c3('0x1a')][_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x2a8aa0[_0xc1c3('0x1a')]['include'],function(_0x1ac142){return{'model':db[_0x1ac142[_0xc1c3('0x20')]],'as':_0x1ac142['as'],'attributes':_0x1ac142[_0xc1c3('0x1d')],'include':_0x1ac142[_0xc1c3('0x1e')]?_[_0xc1c3('0x1f')](_0x1ac142['include'],function(_0x31b9fa){return{'model':db[_0x31b9fa[_0xc1c3('0x20')]],'as':_0x31b9fa['as'],'attributes':_0x31b9fa['attributes'],'include':_0x31b9fa['include']?_['map'](_0x31b9fa[_0xc1c3('0x1e')],function(_0xcf850){return{'model':db[_0xcf850[_0xc1c3('0x20')]],'as':_0xcf850['as'],'attributes':_0xcf850['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1c3('0xf')](function(_0x187acc){logger[_0xc1c3('0x16')](_0xc1c3('0x23'),_0x2a8aa0);logger[_0xc1c3('0x21')]('ShowFaxQueue',_0x2a8aa0,JSON[_0xc1c3('0x13')](_0x187acc));_0x19fe5a(_0x187acc);})['catch'](function(_0x3f0ae2){logger[_0xc1c3('0x14')](_0xc1c3('0x23'),_0x3f0ae2[_0xc1c3('0x15')],_0x2a8aa0);_0x37bb96(_0x26c557[_0xc1c3('0x14')](0x1f4,_0x3f0ae2[_0xc1c3('0x15')]));});});}; \ No newline at end of file +var _0x440e=['redis','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','limit','include','map','model','then','ShowFaxQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x440e,0x15e));var _0xe440=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x440e[_0x1559a5];return _0x17a783;};'use strict';var _=require(_0xe440('0x0'));var util=require('util');var moment=require(_0xe440('0x1'));var BPromise=require('bluebird');var rs=require(_0xe440('0x2'));var fs=require('fs');var Redis=require(_0xe440('0x3'));var db=require(_0xe440('0x4'))['db'];var utils=require(_0xe440('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe440('0x6'));var jayson=require(_0xe440('0x7'));var client=jayson[_0xe440('0x8')][_0xe440('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe440('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe440('0xb'))(new Redis(config['redis']));require(_0xe440('0xc'))[_0xe440('0xd')](socket);function respondWithRpcPromise(_0x592313,_0x484fd5,_0x4f9186){return new BPromise(function(_0x24ca2e,_0xb4c7e6){return client[_0xe440('0xe')](_0x592313,_0x4f9186)['then'](function(_0x57e74d){logger[_0xe440('0xf')](_0xe440('0x10'),_0x484fd5,'request\x20sent');logger[_0xe440('0x11')](_0xe440('0x12'),_0x484fd5,'request\x20sent',JSON[_0xe440('0x13')](_0x57e74d));if(_0x57e74d[_0xe440('0x14')]){if(_0x57e74d[_0xe440('0x14')][_0xe440('0x15')]===0x1f4){logger[_0xe440('0x14')]('FaxQueue,\x20%s,\x20%s',_0x484fd5,_0x57e74d['error'][_0xe440('0x16')]);return _0xb4c7e6(_0x57e74d[_0xe440('0x14')]['message']);}logger['error'](_0xe440('0x10'),_0x484fd5,_0x57e74d['error']['message']);return _0x24ca2e(_0x57e74d[_0xe440('0x14')][_0xe440('0x16')]);}else{logger[_0xe440('0xf')](_0xe440('0x10'),_0x484fd5,'request\x20sent');_0x24ca2e(_0x57e74d['result'][_0xe440('0x16')]);}})[_0xe440('0x17')](function(_0x432d52){logger[_0xe440('0x14')](_0xe440('0x10'),_0x484fd5,_0x432d52);_0xb4c7e6(_0x432d52);});});}exports[_0xe440('0x18')]=function(_0x41c1f9){var _0x4a262b=this;return new Promise(function(_0x1b54b3,_0x409d18){return db[_0xe440('0x19')]['findAll']({'raw':_0x41c1f9[_0xe440('0x1a')]?_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1b')]===undefined?!![]:![]:!![],'where':_0x41c1f9[_0xe440('0x1a')]?_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1c')]||null:null,'attributes':_0x41c1f9['options']?_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1d')]||null:null,'limit':_0x41c1f9[_0xe440('0x1a')]?_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1e')]||null:null,'include':_0x41c1f9[_0xe440('0x1a')]?_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1f')]?_[_0xe440('0x20')](_0x41c1f9[_0xe440('0x1a')][_0xe440('0x1f')],function(_0x1ea768){return{'model':db[_0x1ea768[_0xe440('0x21')]],'as':_0x1ea768['as'],'attributes':_0x1ea768['attributes'],'include':_0x1ea768[_0xe440('0x1f')]?_[_0xe440('0x20')](_0x1ea768[_0xe440('0x1f')],function(_0x56e660){return{'model':db[_0x56e660[_0xe440('0x21')]],'as':_0x56e660['as'],'attributes':_0x56e660[_0xe440('0x1d')],'include':_0x56e660['include']?_[_0xe440('0x20')](_0x56e660[_0xe440('0x1f')],function(_0x462c66){return{'model':db[_0x462c66[_0xe440('0x21')]],'as':_0x462c66['as'],'attributes':_0x462c66[_0xe440('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe440('0x22')](function(_0x46f485){logger[_0xe440('0xf')](_0xe440('0x18'),_0x41c1f9);logger[_0xe440('0x11')](_0xe440('0x18'),_0x41c1f9,JSON[_0xe440('0x13')](_0x46f485));_0x1b54b3(_0x46f485);})[_0xe440('0x17')](function(_0x5acfbc){logger[_0xe440('0x14')](_0xe440('0x18'),_0x5acfbc[_0xe440('0x16')],_0x41c1f9);_0x409d18(_0x4a262b[_0xe440('0x14')](0x1f4,_0x5acfbc[_0xe440('0x16')]));});});};exports['ShowFaxQueue']=function(_0x4c699d){var _0x33ac14=this;return new Promise(function(_0x45697a,_0x450f14){return db['FaxQueue']['find']({'raw':_0x4c699d[_0xe440('0x1a')]?_0x4c699d['options'][_0xe440('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c699d['options']?_0x4c699d[_0xe440('0x1a')]['where']||null:null,'attributes':_0x4c699d[_0xe440('0x1a')]?_0x4c699d[_0xe440('0x1a')][_0xe440('0x1d')]||null:null,'include':_0x4c699d[_0xe440('0x1a')]?_0x4c699d[_0xe440('0x1a')]['include']?_[_0xe440('0x20')](_0x4c699d[_0xe440('0x1a')][_0xe440('0x1f')],function(_0x274b8d){return{'model':db[_0x274b8d[_0xe440('0x21')]],'as':_0x274b8d['as'],'attributes':_0x274b8d[_0xe440('0x1d')],'include':_0x274b8d['include']?_[_0xe440('0x20')](_0x274b8d['include'],function(_0x1e7936){return{'model':db[_0x1e7936[_0xe440('0x21')]],'as':_0x1e7936['as'],'attributes':_0x1e7936[_0xe440('0x1d')],'include':_0x1e7936[_0xe440('0x1f')]?_[_0xe440('0x20')](_0x1e7936[_0xe440('0x1f')],function(_0x1d7d0f){return{'model':db[_0x1d7d0f[_0xe440('0x21')]],'as':_0x1d7d0f['as'],'attributes':_0x1d7d0f[_0xe440('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe440('0x22')](function(_0x346ad2){logger[_0xe440('0xf')](_0xe440('0x23'),_0x4c699d);logger[_0xe440('0x11')](_0xe440('0x23'),_0x4c699d,JSON['stringify'](_0x346ad2));_0x45697a(_0x346ad2);})[_0xe440('0x17')](function(_0x21a9c2){logger[_0xe440('0x14')](_0xe440('0x23'),_0x21a9c2[_0xe440('0x16')],_0x4c699d);_0x450f14(_0x33ac14[_0xe440('0x14')](0x1f4,_0x21a9c2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index b8f1e11..441ad5e 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 _0x9fa3=['remove','removeListener','register','save'];(function(_0x456aa6,_0x3e5961){var _0x40589b=function(_0x4e88c8){while(--_0x4e88c8){_0x456aa6['push'](_0x456aa6['shift']());}};_0x40589b(++_0x3e5961);}(_0x9fa3,0x67));var _0x39fa=function(_0x1fc9bd,_0x332272){_0x1fc9bd=_0x1fc9bd-0x0;var _0x40a3e5=_0x9fa3[_0x1fc9bd];return _0x40a3e5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x39fa('0x0'),_0x39fa('0x1'),'update'];function createListener(_0x65362f,_0x24f498){return function(_0x204282){_0x24f498['emit'](_0x65362f,_0x204282);};}function removeListener(_0x4de787,_0x2b95a9){return function(){FaxQueueEvents[_0x39fa('0x2')](_0x4de787,_0x2b95a9);};}exports[_0x39fa('0x3')]=function(_0xce8de8){for(var _0x153ac4=0x0,_0x751422=events['length'];_0x153ac4<_0x751422;_0x153ac4++){var _0x18bc07=events[_0x153ac4];var _0x3f7c45=createListener('faxQueue:'+_0x18bc07,_0xce8de8);FaxQueueEvents['on'](_0x18bc07,_0x3f7c45);}}; \ No newline at end of file +var _0x4b28=['length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x3b47e9,_0x1b873f){var _0x2e6e40=function(_0x926757){while(--_0x926757){_0x3b47e9['push'](_0x3b47e9['shift']());}};_0x2e6e40(++_0x1b873f);}(_0x4b28,0x121));var _0x84b2=function(_0xd501b,_0x570d56){_0xd501b=_0xd501b-0x0;var _0x26a42a=_0x4b28[_0xd501b];return _0x26a42a;};'use strict';var FaxQueueEvents=require(_0x84b2('0x0'));var events=[_0x84b2('0x1'),_0x84b2('0x2'),_0x84b2('0x3')];function createListener(_0x238558,_0x1f6761){return function(_0x64b2b1){_0x1f6761[_0x84b2('0x4')](_0x238558,_0x64b2b1);};}function removeListener(_0x5ea47e,_0x871875){return function(){FaxQueueEvents['removeListener'](_0x5ea47e,_0x871875);};}exports['register']=function(_0x524684){for(var _0xcdb24=0x0,_0x1220a5=events[_0x84b2('0x5')];_0xcdb24<_0x1220a5;_0xcdb24++){var _0x5b472b=events[_0xcdb24];var _0x2fc6f9=createListener(_0x84b2('0x6')+_0x5b472b,_0x524684);FaxQueueEvents['on'](_0x5b472b,_0x2fc6f9);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7aba4db..f5c28d1 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 _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x417a35,_0x345a21){var _0x14fbf5=function(_0x4471ca){while(--_0x4471ca){_0x417a35['push'](_0x417a35['shift']());}};_0x14fbf5(++_0x345a21);}(_0x6a55,0xdb));var _0x56a5=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x6a55[_0x546aaf];return _0x1cbf6d;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file +var _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','destroy','delete','exports'];(function(_0x354fbe,_0x59a398){var _0x1c66e4=function(_0x3f968f){while(--_0x3f968f){_0x354fbe['push'](_0x354fbe['shift']());}};_0x1c66e4(++_0x59a398);}(_0x2d72,0xa8));var _0x22d7=function(_0x28ed93,_0x21075c){_0x28ed93=_0x28ed93-0x0;var _0x5426b8=_0x2d72[_0x28ed93];return _0x5426b8;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['get']('/:id/members',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0xb')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['getTeams']);router['get'](_0x22d7('0x13'),auth['isAuthenticated'](),controller[_0x22d7('0x14')]);router[_0x22d7('0x15')]('/',auth['isAuthenticated'](),controller[_0x22d7('0x16')]);router[_0x22d7('0x15')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x17')]);router[_0x22d7('0x15')](_0x22d7('0x13'),auth[_0x22d7('0xc')](),controller['addAgents']);router[_0x22d7('0x18')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller['update']);router['delete']('/:id',auth[_0x22d7('0xc')](),controller[_0x22d7('0x19')]);router[_0x22d7('0x1a')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['removeTeams']);router[_0x22d7('0x1a')](_0x22d7('0x13'),auth[_0x22d7('0xc')](),controller['removeAgents']);module[_0x22d7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0d5fdf1..a0c632c 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 _0x1d1e=['sequelize','exports','STRING','DATE','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d1e,0x9a));var _0xe1d1=function(_0x40022a,_0x490e53){_0x40022a=_0x40022a-0x0;var _0x1c8f3a=_0x1d1e[_0x40022a];return _0x1c8f3a;};'use strict';var moment=require(_0xe1d1('0x0'));var Sequelize=require(_0xe1d1('0x1'));module[_0xe1d1('0x2')]={'uniqueid':{'type':Sequelize[_0xe1d1('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe1d1('0x3')]},'joinAt':{'type':Sequelize[_0xe1d1('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe1d1('0x4')]},'exitAt':{'type':Sequelize[_0xe1d1('0x4')]},'reason':{'type':Sequelize[_0xe1d1('0x3')]}}; \ No newline at end of file +var _0x1639=['DATE','moment','sequelize','exports','STRING'];(function(_0x4077d2,_0x25a4d8){var _0x461305=function(_0x256bae){while(--_0x256bae){_0x4077d2['push'](_0x4077d2['shift']());}};_0x461305(++_0x25a4d8);}(_0x1639,0x173));var _0x9163=function(_0x559b78,_0x3ce8f1){_0x559b78=_0x559b78-0x0;var _0x5586b8=_0x1639[_0x559b78];return _0x5586b8;};'use strict';var moment=require(_0x9163('0x0'));var Sequelize=require(_0x9163('0x1'));module[_0x9163('0x2')]={'uniqueid':{'type':Sequelize[_0x9163('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9163('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9163('0x4')]},'acceptAt':{'type':Sequelize[_0x9163('0x4')]},'exitAt':{'type':Sequelize[_0x9163('0x4')]},'reason':{'type':Sequelize[_0x9163('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9ac1dba..b09d43e 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 _0xbbfa=['sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0xbbfa,0x1e9));var _0xabbf=function(_0x3f889c,_0x1c16af){_0x3f889c=_0x3f889c-0x0;var _0x5edf2a=_0xbbfa[_0x3f889c];return _0x5edf2a;};'use strict';var emlformat=require(_0xabbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabbf('0x2'));var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var Mustache=require(_0xabbf('0x5'));var util=require(_0xabbf('0x6'));var path=require(_0xabbf('0x7'));var sox=require(_0xabbf('0x8'));var csv=require(_0xabbf('0x9'));var ejs=require(_0xabbf('0xa'));var fs=require('fs');var fs_extra=require(_0xabbf('0xb'));var _=require(_0xabbf('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabbf('0xd'));var toCsv=require(_0xabbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabbf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xabbf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabbf('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xabbf('0x11'));var config=require(_0xabbf('0x12'));var licenseUtil=require(_0xabbf('0x13'));var db=require(_0xabbf('0x14'))['db'];function respondWithStatusCode(_0x265487,_0x1cc1a0){_0x1cc1a0=_0x1cc1a0||0xcc;return function(_0x28fb83){if(_0x28fb83){return _0x265487[_0xabbf('0x15')](_0x1cc1a0);}return _0x265487[_0xabbf('0x16')](_0x1cc1a0)['end']();};}function respondWithResult(_0x3c85e8,_0x5e6866){_0x5e6866=_0x5e6866||0xc8;return function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c85e8['status'](_0x5e6866)[_0xabbf('0x17')](_0x3c6e6d);}};}function respondWithFilteredResult(_0x23a44a,_0x1df763){return function(_0x13b970){if(_0x13b970){var _0x529af0=typeof _0x1df763[_0xabbf('0x18')]===_0xabbf('0x19')&&typeof _0x1df763[_0xabbf('0x1a')]===_0xabbf('0x19');var _0xbfddcf=_0x13b970['count'];var _0x4252e1=_0x529af0?0x0:_0x1df763[_0xabbf('0x18')];var _0x57002d=_0x529af0?_0x13b970[_0xabbf('0x1b')]:_0x1df763[_0xabbf('0x18')]+_0x1df763['limit'];var _0x1269d9;if(_0x57002d>=_0xbfddcf){_0x57002d=_0xbfddcf;_0x1269d9=0xc8;}else{_0x1269d9=0xce;}_0x23a44a[_0xabbf('0x16')](_0x1269d9);return _0x23a44a[_0xabbf('0x1c')]('Content-Range',_0x4252e1+'-'+_0x57002d+'/'+_0xbfddcf)['json'](_0x13b970);}return null;};}function patchUpdates(_0xdf7640){return function(_0x4d4efb){try{jsonpatch[_0xabbf('0x1d')](_0x4d4efb,_0xdf7640,!![]);}catch(_0x918fc8){return BPromise['reject'](_0x918fc8);}return _0x4d4efb['save']();};}function saveUpdates(_0x44248b,_0x45cf44){return function(_0x2eaa02){if(_0x2eaa02){return _0x2eaa02[_0xabbf('0x1e')](_0x44248b)[_0xabbf('0x1f')](function(_0x35313f){return _0x35313f;});}return null;};}function removeEntity(_0x17d684,_0x573d83){return function(_0x281b36){if(_0x281b36){return _0x281b36[_0xabbf('0x20')]()[_0xabbf('0x1f')](function(){_0x17d684['status'](0xcc)[_0xabbf('0x21')]();});}};}function handleEntityNotFound(_0x26ebc6,_0x26bd52){return function(_0x28a5a1){if(!_0x28a5a1){_0x26ebc6[_0xabbf('0x15')](0x194);}return _0x28a5a1;};}function handleError(_0x5861fb,_0x3a0eca){_0x3a0eca=_0x3a0eca||0x1f4;return function(_0x4ef7cf){logger['error'](_0x4ef7cf[_0xabbf('0x22')]);if(_0x4ef7cf[_0xabbf('0x23')]){delete _0x4ef7cf['name'];}_0x5861fb[_0xabbf('0x16')](_0x3a0eca)[_0xabbf('0x24')](_0x4ef7cf);};}exports['index']=function(_0x4f8ed7,_0x53e49a){var _0x58c8bc={},_0xf50e5f={},_0x1c8439={'count':0x0,'rows':[]};var _0x242132=_[_0xabbf('0x25')](db[_0xabbf('0x26')][_0xabbf('0x27')],function(_0x1ed1fd){return{'name':_0x1ed1fd[_0xabbf('0x28')],'type':_0x1ed1fd[_0xabbf('0x29')][_0xabbf('0x2a')]};});_0xf50e5f['model']=_[_0xabbf('0x25')](_0x242132,'name');_0xf50e5f[_0xabbf('0x2b')]=_[_0xabbf('0x2c')](_0x4f8ed7['query']);_0xf50e5f[_0xabbf('0x2d')]=_[_0xabbf('0x2e')](_0xf50e5f[_0xabbf('0x2f')],_0xf50e5f[_0xabbf('0x2b')]);_0x58c8bc[_0xabbf('0x30')]=_[_0xabbf('0x2e')](_0xf50e5f[_0xabbf('0x2f')],qs['fields'](_0x4f8ed7['query'][_0xabbf('0x31')]));_0x58c8bc['attributes']=_0x58c8bc[_0xabbf('0x30')][_0xabbf('0x32')]?_0x58c8bc[_0xabbf('0x30')]:_0xf50e5f[_0xabbf('0x2f')];if(!_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x33')](_0xabbf('0x34'))){_0x58c8bc['limit']=qs[_0xabbf('0x1a')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x1a')]);_0x58c8bc['offset']=qs[_0xabbf('0x18')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x18')]);}_0x58c8bc[_0xabbf('0x35')]=qs[_0xabbf('0x36')](_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x36')]);_0x58c8bc[_0xabbf('0x37')]=qs[_0xabbf('0x2d')](_['pick'](_0x4f8ed7[_0xabbf('0x2b')],_0xf50e5f[_0xabbf('0x2d')]),_0x242132);if(_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x38')]){_0x58c8bc[_0xabbf('0x37')]=_['merge'](_0x58c8bc[_0xabbf('0x37')],{'$or':_[_0xabbf('0x25')](_0x242132,function(_0x3d7a03){if(_0x3d7a03[_0xabbf('0x29')]!==_0xabbf('0x39')){var _0x580ca9={};_0x580ca9[_0x3d7a03['name']]={'$like':'%'+_0x4f8ed7[_0xabbf('0x2b')]['filter']+'%'};return _0x580ca9;}})});}_0x58c8bc=_[_0xabbf('0x3a')]({},_0x58c8bc,_0x4f8ed7[_0xabbf('0x3b')]);var _0x4af14f={'where':_0x58c8bc[_0xabbf('0x37')]};return db[_0xabbf('0x26')][_0xabbf('0x1b')](_0x4af14f)['then'](function(_0x9d37c4){_0x1c8439['count']=_0x9d37c4;if(_0x4f8ed7[_0xabbf('0x2b')][_0xabbf('0x3c')]){_0x58c8bc['include']=[{'all':!![]}];}return db[_0xabbf('0x26')][_0xabbf('0x3d')](_0x58c8bc);})[_0xabbf('0x1f')](function(_0x22cb8d){_0x1c8439[_0xabbf('0x3e')]=_0x22cb8d;return _0x1c8439;})[_0xabbf('0x1f')](respondWithFilteredResult(_0x53e49a,_0x58c8bc))[_0xabbf('0x3f')](handleError(_0x53e49a,null));};exports[_0xabbf('0x40')]=function(_0x113e7c,_0x47b425){var _0x477f1c={'raw':!![],'where':{'id':_0x113e7c['params']['id']}},_0x547672={};_0x547672[_0xabbf('0x2f')]=_[_0xabbf('0x2c')](db[_0xabbf('0x26')][_0xabbf('0x27')]);_0x547672[_0xabbf('0x2b')]=_[_0xabbf('0x2c')](_0x113e7c[_0xabbf('0x2b')]);_0x547672[_0xabbf('0x2d')]=_[_0xabbf('0x2e')](_0x547672[_0xabbf('0x2f')],_0x547672[_0xabbf('0x2b')]);_0x477f1c[_0xabbf('0x30')]=_[_0xabbf('0x2e')](_0x547672['model'],qs[_0xabbf('0x31')](_0x113e7c[_0xabbf('0x2b')]['fields']));_0x477f1c[_0xabbf('0x30')]=_0x477f1c[_0xabbf('0x30')][_0xabbf('0x32')]?_0x477f1c[_0xabbf('0x30')]:_0x547672[_0xabbf('0x2f')];if(_0x113e7c[_0xabbf('0x2b')][_0xabbf('0x3c')]){_0x477f1c[_0xabbf('0x41')]=[{'all':!![]}];}_0x477f1c=_[_0xabbf('0x3a')]({},_0x477f1c,_0x113e7c[_0xabbf('0x3b')]);return db[_0xabbf('0x26')][_0xabbf('0x42')](_0x477f1c)[_0xabbf('0x1f')](handleEntityNotFound(_0x47b425,null))[_0xabbf('0x1f')](respondWithResult(_0x47b425,null))[_0xabbf('0x3f')](handleError(_0x47b425,null));};exports[_0xabbf('0x43')]=function(_0x44910b,_0x2cecb6){return db[_0xabbf('0x26')][_0xabbf('0x43')](_0x44910b['body'],{})[_0xabbf('0x1f')](respondWithResult(_0x2cecb6,0xc9))[_0xabbf('0x3f')](handleError(_0x2cecb6,null));};exports[_0xabbf('0x1e')]=function(_0x370f66,_0x60d9d6){if(_0x370f66['body']['id']){delete _0x370f66[_0xabbf('0x44')]['id'];}return db[_0xabbf('0x26')]['find']({'where':{'id':_0x370f66[_0xabbf('0x45')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0x60d9d6,null))[_0xabbf('0x1f')](saveUpdates(_0x370f66[_0xabbf('0x44')],null))[_0xabbf('0x1f')](respondWithResult(_0x60d9d6,null))[_0xabbf('0x3f')](handleError(_0x60d9d6,null));};exports[_0xabbf('0x20')]=function(_0x4fa51f,_0x1588af){return db[_0xabbf('0x26')]['find']({'where':{'id':_0x4fa51f[_0xabbf('0x45')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0x1588af,null))[_0xabbf('0x1f')](removeEntity(_0x1588af,null))[_0xabbf('0x3f')](handleError(_0x1588af,null));};exports[_0xabbf('0x46')]=function(_0x407a31,_0x1be10a){return db[_0xabbf('0x26')][_0xabbf('0x46')]()[_0xabbf('0x1f')](respondWithResult(_0x1be10a,null))['catch'](handleError(_0x1be10a,null));}; \ No newline at end of file +var _0xb28a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','keys','length','include','find','create','catch','body','params','describe','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x14ec5e,_0x6e3111){var _0x4c67a1=function(_0xc8aa1c){while(--_0xc8aa1c){_0x14ec5e['push'](_0x14ec5e['shift']());}};_0x4c67a1(++_0x6e3111);}(_0xb28a,0x166));var _0xab28=function(_0x142d2b,_0x2b0112){_0x142d2b=_0x142d2b-0x0;var _0xf6fa32=_0xb28a[_0x142d2b];return _0xf6fa32;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab28('0x0'));var zipdir=require(_0xab28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab28('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab28('0x3'));var path=require(_0xab28('0x4'));var sox=require(_0xab28('0x5'));var csv=require(_0xab28('0x6'));var ejs=require(_0xab28('0x7'));var fs=require('fs');var fs_extra=require(_0xab28('0x8'));var _=require(_0xab28('0x9'));var squel=require(_0xab28('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab28('0xb'));var toCsv=require(_0xab28('0x6'));var querystring=require(_0xab28('0xc'));var Papa=require(_0xab28('0xd'));var Redis=require(_0xab28('0xe'));var authService=require(_0xab28('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab28('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab28('0x11'))(_0xab28('0x12'));var utils=require(_0xab28('0x13'));var config=require(_0xab28('0x14'));var licenseUtil=require(_0xab28('0x15'));var db=require(_0xab28('0x16'))['db'];function respondWithStatusCode(_0x3fd6f2,_0x1976a5){_0x1976a5=_0x1976a5||0xcc;return function(_0x5b32d6){if(_0x5b32d6){return _0x3fd6f2[_0xab28('0x17')](_0x1976a5);}return _0x3fd6f2[_0xab28('0x18')](_0x1976a5)[_0xab28('0x19')]();};}function respondWithResult(_0x389fc3,_0x2c05bc){_0x2c05bc=_0x2c05bc||0xc8;return function(_0x19029e){if(_0x19029e){return _0x389fc3['status'](_0x2c05bc)['json'](_0x19029e);}};}function respondWithFilteredResult(_0x7c1921,_0x3d133e){return function(_0x14e8b4){if(_0x14e8b4){var _0xaaeb24=typeof _0x3d133e['offset']===_0xab28('0x1a')&&typeof _0x3d133e['limit']===_0xab28('0x1a');var _0x54f79b=_0x14e8b4[_0xab28('0x1b')];var _0x2b0b5c=_0xaaeb24?0x0:_0x3d133e[_0xab28('0x1c')];var _0x4005fd=_0xaaeb24?_0x14e8b4[_0xab28('0x1b')]:_0x3d133e[_0xab28('0x1c')]+_0x3d133e[_0xab28('0x1d')];var _0x300cbd;if(_0x4005fd>=_0x54f79b){_0x4005fd=_0x54f79b;_0x300cbd=0xc8;}else{_0x300cbd=0xce;}_0x7c1921['status'](_0x300cbd);return _0x7c1921[_0xab28('0x1e')](_0xab28('0x1f'),_0x2b0b5c+'-'+_0x4005fd+'/'+_0x54f79b)[_0xab28('0x20')](_0x14e8b4);}return null;};}function patchUpdates(_0x170a80){return function(_0x2f6541){try{jsonpatch[_0xab28('0x21')](_0x2f6541,_0x170a80,!![]);}catch(_0x1b0fc6){return BPromise['reject'](_0x1b0fc6);}return _0x2f6541[_0xab28('0x22')]();};}function saveUpdates(_0x4ec564,_0x1db226){return function(_0x127e2b){if(_0x127e2b){return _0x127e2b['update'](_0x4ec564)[_0xab28('0x23')](function(_0x1829bd){return _0x1829bd;});}return null;};}function removeEntity(_0x3bef23,_0x46a24b){return function(_0x4549e6){if(_0x4549e6){return _0x4549e6[_0xab28('0x24')]()[_0xab28('0x23')](function(){_0x3bef23['status'](0xcc)[_0xab28('0x19')]();});}};}function handleEntityNotFound(_0x50ae27,_0x2163d2){return function(_0x2e6359){if(!_0x2e6359){_0x50ae27['sendStatus'](0x194);}return _0x2e6359;};}function handleError(_0x3928f0,_0x5e0099){_0x5e0099=_0x5e0099||0x1f4;return function(_0x2fd3aa){logger[_0xab28('0x25')](_0x2fd3aa[_0xab28('0x26')]);if(_0x2fd3aa['name']){delete _0x2fd3aa[_0xab28('0x27')];}_0x3928f0[_0xab28('0x18')](_0x5e0099)['send'](_0x2fd3aa);};}exports[_0xab28('0x28')]=function(_0x46b19b,_0x323e0d){var _0x1fe502={},_0x537f64={},_0x163f1b={'count':0x0,'rows':[]};var _0x299da7=_[_0xab28('0x29')](db[_0xab28('0x2a')][_0xab28('0x2b')],function(_0x4114fd){return{'name':_0x4114fd[_0xab28('0x2c')],'type':_0x4114fd[_0xab28('0x2d')][_0xab28('0x2e')]};});_0x537f64[_0xab28('0x2f')]=_['map'](_0x299da7,'name');_0x537f64[_0xab28('0x30')]=_['keys'](_0x46b19b['query']);_0x537f64[_0xab28('0x31')]=_[_0xab28('0x32')](_0x537f64[_0xab28('0x2f')],_0x537f64[_0xab28('0x30')]);_0x1fe502[_0xab28('0x33')]=_[_0xab28('0x32')](_0x537f64['model'],qs[_0xab28('0x34')](_0x46b19b[_0xab28('0x30')][_0xab28('0x34')]));_0x1fe502['attributes']=_0x1fe502[_0xab28('0x33')]['length']?_0x1fe502[_0xab28('0x33')]:_0x537f64[_0xab28('0x2f')];if(!_0x46b19b['query'][_0xab28('0x35')](_0xab28('0x36'))){_0x1fe502[_0xab28('0x1d')]=qs[_0xab28('0x1d')](_0x46b19b[_0xab28('0x30')][_0xab28('0x1d')]);_0x1fe502['offset']=qs[_0xab28('0x1c')](_0x46b19b[_0xab28('0x30')]['offset']);}_0x1fe502[_0xab28('0x37')]=qs[_0xab28('0x38')](_0x46b19b[_0xab28('0x30')][_0xab28('0x38')]);_0x1fe502[_0xab28('0x39')]=qs[_0xab28('0x31')](_[_0xab28('0x3a')](_0x46b19b[_0xab28('0x30')],_0x537f64['filters']),_0x299da7);if(_0x46b19b[_0xab28('0x30')][_0xab28('0x3b')]){_0x1fe502['where']=_[_0xab28('0x3c')](_0x1fe502[_0xab28('0x39')],{'$or':_['map'](_0x299da7,function(_0x24fc45){if(_0x24fc45[_0xab28('0x2d')]!==_0xab28('0x3d')){var _0x33604b={};_0x33604b[_0x24fc45[_0xab28('0x27')]]={'$like':'%'+_0x46b19b[_0xab28('0x30')][_0xab28('0x3b')]+'%'};return _0x33604b;}})});}_0x1fe502=_['merge']({},_0x1fe502,_0x46b19b[_0xab28('0x3e')]);var _0x38e846={'where':_0x1fe502['where']};return db[_0xab28('0x2a')][_0xab28('0x1b')](_0x38e846)[_0xab28('0x23')](function(_0x86b83b){_0x163f1b[_0xab28('0x1b')]=_0x86b83b;if(_0x46b19b['query'][_0xab28('0x3f')]){_0x1fe502['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xab28('0x40')](_0x1fe502);})[_0xab28('0x23')](function(_0x23ada2){_0x163f1b[_0xab28('0x41')]=_0x23ada2;return _0x163f1b;})[_0xab28('0x23')](respondWithFilteredResult(_0x323e0d,_0x1fe502))['catch'](handleError(_0x323e0d,null));};exports['show']=function(_0x433c0e,_0x4b12be){var _0x2a8b57={'raw':!![],'where':{'id':_0x433c0e['params']['id']}},_0x47a122={};_0x47a122[_0xab28('0x2f')]=_[_0xab28('0x42')](db[_0xab28('0x2a')][_0xab28('0x2b')]);_0x47a122[_0xab28('0x30')]=_[_0xab28('0x42')](_0x433c0e['query']);_0x47a122['filters']=_[_0xab28('0x32')](_0x47a122['model'],_0x47a122[_0xab28('0x30')]);_0x2a8b57['attributes']=_[_0xab28('0x32')](_0x47a122['model'],qs['fields'](_0x433c0e[_0xab28('0x30')]['fields']));_0x2a8b57['attributes']=_0x2a8b57['attributes'][_0xab28('0x43')]?_0x2a8b57['attributes']:_0x47a122[_0xab28('0x2f')];if(_0x433c0e[_0xab28('0x30')][_0xab28('0x3f')]){_0x2a8b57[_0xab28('0x44')]=[{'all':!![]}];}_0x2a8b57=_['merge']({},_0x2a8b57,_0x433c0e[_0xab28('0x3e')]);return db[_0xab28('0x2a')][_0xab28('0x45')](_0x2a8b57)[_0xab28('0x23')](handleEntityNotFound(_0x4b12be,null))[_0xab28('0x23')](respondWithResult(_0x4b12be,null))['catch'](handleError(_0x4b12be,null));};exports[_0xab28('0x46')]=function(_0x642d7e,_0x49bb4f){return db[_0xab28('0x2a')]['create'](_0x642d7e['body'],{})[_0xab28('0x23')](respondWithResult(_0x49bb4f,0xc9))[_0xab28('0x47')](handleError(_0x49bb4f,null));};exports['update']=function(_0x39a4ef,_0x52fa3a){if(_0x39a4ef[_0xab28('0x48')]['id']){delete _0x39a4ef[_0xab28('0x48')]['id'];}return db[_0xab28('0x2a')][_0xab28('0x45')]({'where':{'id':_0x39a4ef['params']['id']}})[_0xab28('0x23')](handleEntityNotFound(_0x52fa3a,null))['then'](saveUpdates(_0x39a4ef['body'],null))[_0xab28('0x23')](respondWithResult(_0x52fa3a,null))['catch'](handleError(_0x52fa3a,null));};exports[_0xab28('0x24')]=function(_0x199734,_0x4ada8a){return db[_0xab28('0x2a')][_0xab28('0x45')]({'where':{'id':_0x199734[_0xab28('0x49')]['id']}})[_0xab28('0x23')](handleEntityNotFound(_0x4ada8a,null))['then'](removeEntity(_0x4ada8a,null))[_0xab28('0x47')](handleError(_0x4ada8a,null));};exports[_0xab28('0x4a')]=function(_0x41c0b8,_0x1beec0){return db[_0xab28('0x2a')][_0xab28('0x4a')]()[_0xab28('0x23')](respondWithResult(_0x1beec0,null))[_0xab28('0x47')](handleError(_0x1beec0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 646b720..68805f2 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0xc3c4d4,_0x14d514){var _0x50cafd=function(_0x486a9d){while(--_0x486a9d){_0xc3c4d4['push'](_0xc3c4d4['shift']());}};_0x50cafd(++_0x14d514);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2d13b1,_0x2678d5){_0x2d13b1=_0x2d13b1-0x0;var _0x18c844=_0x7fbe[_0x2d13b1];return _0x18c844;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x1cb9,0x14e));var _0x91cb=function(_0x42940b,_0x207970){_0x42940b=_0x42940b-0x0;var _0xf7b7f2=_0x1cb9[_0x42940b];return _0xf7b7f2;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8c70f93..29c6136 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 _0x8d02=['raw','then','CreateFaxQueueReport','debug','stringify','catch','UpdateFaxQueueReport','update','where','limit','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','FaxQueueReport','options'];(function(_0x222abd,_0x30ffd2){var _0x5923ff=function(_0xa60d6f){while(--_0xa60d6f){_0x222abd['push'](_0x222abd['shift']());}};_0x5923ff(++_0x30ffd2);}(_0x8d02,0x149));var _0x28d0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8d02[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x28d0('0x0'));var moment=require(_0x28d0('0x1'));var BPromise=require(_0x28d0('0x2'));var rs=require(_0x28d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x28d0('0x4'))(_0x28d0('0x5'));var config=require(_0x28d0('0x6'));var jayson=require(_0x28d0('0x7'));var client=jayson['client'][_0x28d0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432f37,_0x14dcc2,_0x4834c5){return new BPromise(function(_0x584ecc,_0x10c803){return client['request'](_0x432f37,_0x4834c5)['then'](function(_0x481f95){logger[_0x28d0('0x9')](_0x28d0('0xa'),_0x14dcc2,_0x28d0('0xb'));logger['debug'](_0x28d0('0xc'),_0x14dcc2,_0x28d0('0xb'),JSON['stringify'](_0x481f95));if(_0x481f95['error']){if(_0x481f95[_0x28d0('0xd')][_0x28d0('0xe')]===0x1f4){logger[_0x28d0('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x14dcc2,_0x481f95[_0x28d0('0xd')][_0x28d0('0xf')]);return _0x10c803(_0x481f95['error'][_0x28d0('0xf')]);}logger[_0x28d0('0xd')](_0x28d0('0xa'),_0x14dcc2,_0x481f95['error'][_0x28d0('0xf')]);return _0x584ecc(_0x481f95['error'][_0x28d0('0xf')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x14dcc2,_0x28d0('0xb'));_0x584ecc(_0x481f95[_0x28d0('0x10')][_0x28d0('0xf')]);}})['catch'](function(_0x33091f){logger[_0x28d0('0xd')](_0x28d0('0xa'),_0x14dcc2,_0x33091f);_0x10c803(_0x33091f);});});}exports['CreateFaxQueueReport']=function(_0x2ba81a){var _0xfc4147=this;return new Promise(function(_0x275524,_0x4d454a){return db[_0x28d0('0x11')]['create'](_0x2ba81a['body'],{'raw':_0x2ba81a[_0x28d0('0x12')]?_0x2ba81a[_0x28d0('0x12')][_0x28d0('0x13')]===undefined?!![]:![]:!![]})[_0x28d0('0x14')](function(_0x50f9d5){logger[_0x28d0('0x9')](_0x28d0('0x15'),_0x2ba81a);logger[_0x28d0('0x16')](_0x28d0('0x15'),_0x2ba81a,JSON[_0x28d0('0x17')](_0x50f9d5));_0x275524(_0x50f9d5);})[_0x28d0('0x18')](function(_0x11d613){logger['error'](_0x28d0('0x15'),_0x11d613[_0x28d0('0xf')],_0x2ba81a);_0x4d454a(_0xfc4147[_0x28d0('0xd')](0x1f4,_0x11d613[_0x28d0('0xf')]));});});};exports[_0x28d0('0x19')]=function(_0x5c36df){var _0x1cb2e5=this;return new Promise(function(_0x28e154,_0x2b997d){return db[_0x28d0('0x11')][_0x28d0('0x1a')](_0x5c36df['body'],{'raw':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x1b')]||null:null,'attributes':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')]['attributes']||null:null,'limit':_0x5c36df[_0x28d0('0x12')]?_0x5c36df[_0x28d0('0x12')][_0x28d0('0x1c')]||null:null})['then'](function(_0x445597){logger[_0x28d0('0x9')](_0x28d0('0x19'),_0x5c36df);logger[_0x28d0('0x16')](_0x28d0('0x19'),_0x5c36df,JSON[_0x28d0('0x17')](_0x445597));_0x28e154(_0x445597);})[_0x28d0('0x18')](function(_0x30f1a0){logger[_0x28d0('0xd')](_0x28d0('0x19'),_0x30f1a0[_0x28d0('0xf')],_0x5c36df);_0x2b997d(_0x1cb2e5[_0x28d0('0xd')](0x1f4,_0x30f1a0[_0x28d0('0xf')]));});});}; \ No newline at end of file +var _0xf45e=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','where','attributes'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xf45e,0x13f));var _0xef45=function(_0x16b273,_0x3a8aac){_0x16b273=_0x16b273-0x0;var _0x511f9f=_0xf45e[_0x16b273];return _0x511f9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef45('0x0'));var BPromise=require('bluebird');var rs=require(_0xef45('0x1'));var fs=require('fs');var Redis=require(_0xef45('0x2'));var db=require(_0xef45('0x3'))['db'];var utils=require(_0xef45('0x4'));var logger=require('../../config/logger')(_0xef45('0x5'));var config=require('../../config/environment');var jayson=require(_0xef45('0x6'));var client=jayson[_0xef45('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a6f52,_0x17fb27,_0x27e4e5){return new BPromise(function(_0x9e1ebc,_0x3065d7){return client['request'](_0x4a6f52,_0x27e4e5)[_0xef45('0x8')](function(_0x5c011a){logger[_0xef45('0x9')](_0xef45('0xa'),_0x17fb27,'request\x20sent');logger[_0xef45('0xb')](_0xef45('0xc'),_0x17fb27,_0xef45('0xd'),JSON[_0xef45('0xe')](_0x5c011a));if(_0x5c011a[_0xef45('0xf')]){if(_0x5c011a[_0xef45('0xf')][_0xef45('0x10')]===0x1f4){logger[_0xef45('0xf')](_0xef45('0xa'),_0x17fb27,_0x5c011a[_0xef45('0xf')][_0xef45('0x11')]);return _0x3065d7(_0x5c011a[_0xef45('0xf')]['message']);}logger[_0xef45('0xf')](_0xef45('0xa'),_0x17fb27,_0x5c011a['error'][_0xef45('0x11')]);return _0x9e1ebc(_0x5c011a['error'][_0xef45('0x11')]);}else{logger['info'](_0xef45('0xa'),_0x17fb27,_0xef45('0xd'));_0x9e1ebc(_0x5c011a[_0xef45('0x12')][_0xef45('0x11')]);}})['catch'](function(_0x45b4cd){logger['error'](_0xef45('0xa'),_0x17fb27,_0x45b4cd);_0x3065d7(_0x45b4cd);});});}exports[_0xef45('0x13')]=function(_0x149ec2){var _0x4cd08b=this;return new Promise(function(_0x1c4a35,_0x52b53d){return db[_0xef45('0x14')][_0xef45('0x15')](_0x149ec2[_0xef45('0x16')],{'raw':_0x149ec2[_0xef45('0x17')]?_0x149ec2[_0xef45('0x17')][_0xef45('0x18')]===undefined?!![]:![]:!![]})[_0xef45('0x8')](function(_0x4ec866){logger['info']('CreateFaxQueueReport',_0x149ec2);logger[_0xef45('0xb')](_0xef45('0x13'),_0x149ec2,JSON['stringify'](_0x4ec866));_0x1c4a35(_0x4ec866);})[_0xef45('0x19')](function(_0x4b90db){logger[_0xef45('0xf')](_0xef45('0x13'),_0x4b90db['message'],_0x149ec2);_0x52b53d(_0x4cd08b['error'](0x1f4,_0x4b90db[_0xef45('0x11')]));});});};exports[_0xef45('0x1a')]=function(_0x2f7180){var _0x3ec02e=this;return new Promise(function(_0x5d0845,_0x36423a){return db[_0xef45('0x14')]['update'](_0x2f7180['body'],{'raw':_0x2f7180['options']?_0x2f7180[_0xef45('0x17')][_0xef45('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7180[_0xef45('0x17')]?_0x2f7180['options'][_0xef45('0x1b')]||null:null,'attributes':_0x2f7180[_0xef45('0x17')]?_0x2f7180[_0xef45('0x17')][_0xef45('0x1c')]||null:null,'limit':_0x2f7180[_0xef45('0x17')]?_0x2f7180[_0xef45('0x17')]['limit']||null:null})['then'](function(_0x3a66ea){logger[_0xef45('0x9')](_0xef45('0x1a'),_0x2f7180);logger[_0xef45('0xb')](_0xef45('0x1a'),_0x2f7180,JSON[_0xef45('0xe')](_0x3a66ea));_0x5d0845(_0x3a66ea);})[_0xef45('0x19')](function(_0x5da944){logger['error']('UpdateFaxQueueReport',_0x5da944['message'],_0x2f7180);_0x36423a(_0x3ec02e[_0xef45('0xf')](0x1f4,_0x5da944[_0xef45('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index baba955..affbca8 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 _0x64fc=['./faxQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x580e40,_0x307ecf){var _0x41cbe2=function(_0x2460fc){while(--_0x2460fc){_0x580e40['push'](_0x580e40['shift']());}};_0x41cbe2(++_0x307ecf);}(_0x64fc,0x150));var _0xc64f=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x64fc[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0xc64f('0x0'));var util=require('util');var path=require(_0xc64f('0x1'));var timeout=require('connect-timeout');var express=require(_0xc64f('0x2'));var router=express[_0xc64f('0x3')]();var fs_extra=require(_0xc64f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc64f('0x5'));var config=require('../../config/environment');var controller=require(_0xc64f('0x6'));router[_0xc64f('0x7')]('/',auth['isAuthenticated'](),controller[_0xc64f('0x8')]);router[_0xc64f('0x7')](_0xc64f('0x9'),auth['isAuthenticated'](),controller[_0xc64f('0xa')]);router[_0xc64f('0x7')](_0xc64f('0xb'),auth[_0xc64f('0xc')](),controller['show']);router['post']('/',auth[_0xc64f('0xc')](),controller['create']);router[_0xc64f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc64f('0xe')]);router[_0xc64f('0xf')]('/:id',auth[_0xc64f('0xc')](),controller[_0xc64f('0x10')]);module[_0xc64f('0x11')]=router; \ No newline at end of file +var _0x49e5=['isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x1c42fb,_0x331266){var _0x4aa172=function(_0x3b1be6){while(--_0x3b1be6){_0x1c42fb['push'](_0x1c42fb['shift']());}};_0x4aa172(++_0x331266);}(_0x49e5,0x126));var _0x549e=function(_0x1306a5,_0x4e9324){_0x1306a5=_0x1306a5-0x0;var _0x5f06cc=_0x49e5[_0x1306a5];return _0x5f06cc;};'use strict';var multer=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var path=require('path');var timeout=require(_0x549e('0x2'));var express=require('express');var router=express[_0x549e('0x3')]();var fs_extra=require(_0x549e('0x4'));var auth=require(_0x549e('0x5'));var interaction=require(_0x549e('0x6'));var config=require(_0x549e('0x7'));var controller=require(_0x549e('0x8'));router[_0x549e('0x9')]('/',auth[_0x549e('0xa')](),controller[_0x549e('0xb')]);router[_0x549e('0x9')](_0x549e('0xc'),auth[_0x549e('0xa')](),controller[_0x549e('0xd')]);router[_0x549e('0x9')](_0x549e('0xe'),auth[_0x549e('0xa')](),controller[_0x549e('0xf')]);router[_0x549e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x549e('0xe'),auth[_0x549e('0xa')](),controller[_0x549e('0x11')]);router[_0x549e('0x12')](_0x549e('0xe'),auth[_0x549e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c60d6fb..185c8d7 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5015d2,_0x49d545){_0x5015d2=_0x5015d2-0x0;var _0x3a411d=_0xb43b[_0x5015d2];return _0x3a411d;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x29a79b,_0x178abb){var _0xb697f7=function(_0x146df4){while(--_0x146df4){_0x29a79b['push'](_0x29a79b['shift']());}};_0xb697f7(++_0x178abb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x282f2f,_0x21f612){_0x282f2f=_0x282f2f-0x0;var _0x319f43=_0xf4eb[_0x282f2f];return _0x319f43;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e49dbf9..573e4aa 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 _0x1834=['fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','key','model','keys','attributes','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1834,0x65));var _0x4183=function(_0x14eafa,_0x1f47c7){_0x14eafa=_0x14eafa-0x0;var _0x20cbd3=_0x1834[_0x14eafa];return _0x20cbd3;};'use strict';var emlformat=require(_0x4183('0x0'));var rimraf=require(_0x4183('0x1'));var zipdir=require(_0x4183('0x2'));var jsonpatch=require(_0x4183('0x3'));var rp=require(_0x4183('0x4'));var moment=require('moment');var BPromise=require(_0x4183('0x5'));var Mustache=require('mustache');var util=require(_0x4183('0x6'));var path=require(_0x4183('0x7'));var sox=require(_0x4183('0x8'));var csv=require(_0x4183('0x9'));var ejs=require(_0x4183('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4183('0xb'));var squel=require(_0x4183('0xc'));var crypto=require(_0x4183('0xd'));var jsforce=require(_0x4183('0xe'));var deskjs=require(_0x4183('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4183('0x10'));var Papa=require(_0x4183('0x11'));var Redis=require('ioredis');var authService=require(_0x4183('0x12'));var qs=require(_0x4183('0x13'));var as=require(_0x4183('0x14'));var hardwareService=require(_0x4183('0x15'));var logger=require(_0x4183('0x16'))(_0x4183('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4183('0x18'));var db=require(_0x4183('0x19'))['db'];function respondWithStatusCode(_0x48ea66,_0x440fb4){_0x440fb4=_0x440fb4||0xcc;return function(_0x3a34aa){if(_0x3a34aa){return _0x48ea66['sendStatus'](_0x440fb4);}return _0x48ea66[_0x4183('0x1a')](_0x440fb4)[_0x4183('0x1b')]();};}function respondWithResult(_0x244c37,_0x377010){_0x377010=_0x377010||0xc8;return function(_0x23ca7f){if(_0x23ca7f){return _0x244c37[_0x4183('0x1a')](_0x377010)[_0x4183('0x1c')](_0x23ca7f);}};}function respondWithFilteredResult(_0x20b541,_0x1ccfa8){return function(_0x1998c8){if(_0x1998c8){var _0x5eab35=typeof _0x1ccfa8[_0x4183('0x1d')]===_0x4183('0x1e')&&typeof _0x1ccfa8['limit']===_0x4183('0x1e');var _0x5a7c8=_0x1998c8[_0x4183('0x1f')];var _0x54b9f3=_0x5eab35?0x0:_0x1ccfa8['offset'];var _0xef1ca=_0x5eab35?_0x1998c8['count']:_0x1ccfa8['offset']+_0x1ccfa8[_0x4183('0x20')];var _0x9183c5;if(_0xef1ca>=_0x5a7c8){_0xef1ca=_0x5a7c8;_0x9183c5=0xc8;}else{_0x9183c5=0xce;}_0x20b541['status'](_0x9183c5);return _0x20b541[_0x4183('0x21')]('Content-Range',_0x54b9f3+'-'+_0xef1ca+'/'+_0x5a7c8)[_0x4183('0x1c')](_0x1998c8);}return null;};}function patchUpdates(_0x480371){return function(_0x4d5e21){try{jsonpatch[_0x4183('0x22')](_0x4d5e21,_0x480371,!![]);}catch(_0x263c14){return BPromise['reject'](_0x263c14);}return _0x4d5e21[_0x4183('0x23')]();};}function saveUpdates(_0x43970e,_0x5a97eb){return function(_0x30dd1e){if(_0x30dd1e){return _0x30dd1e[_0x4183('0x24')](_0x43970e)['then'](function(_0x489deb){return _0x489deb;});}return null;};}function removeEntity(_0x95cacd,_0x40b2d5){return function(_0x32800d){if(_0x32800d){return _0x32800d[_0x4183('0x25')]()[_0x4183('0x26')](function(){_0x95cacd[_0x4183('0x1a')](0xcc)[_0x4183('0x1b')]();});}};}function handleEntityNotFound(_0x44331d,_0x118ce4){return function(_0x49e049){if(!_0x49e049){_0x44331d['sendStatus'](0x194);}return _0x49e049;};}function handleError(_0x1af6e6,_0x268ff8){_0x268ff8=_0x268ff8||0x1f4;return function(_0x5556d5){logger[_0x4183('0x27')](_0x5556d5[_0x4183('0x28')]);if(_0x5556d5[_0x4183('0x29')]){delete _0x5556d5['name'];}_0x1af6e6[_0x4183('0x1a')](_0x268ff8)[_0x4183('0x2a')](_0x5556d5);};}exports['index']=function(_0x55ac28,_0x3c8138){var _0x13ea9a={},_0x9e7323={},_0x1ad1a6={'count':0x0,'rows':[]};var _0x3b35e7=_[_0x4183('0x2b')](db[_0x4183('0x2c')][_0x4183('0x2d')],function(_0x1b8447){return{'name':_0x1b8447['fieldName'],'type':_0x1b8447['type'][_0x4183('0x2e')]};});_0x9e7323[_0x4183('0x2f')]=_[_0x4183('0x2b')](_0x3b35e7,_0x4183('0x29'));_0x9e7323['query']=_[_0x4183('0x30')](_0x55ac28['query']);_0x9e7323['filters']=_['intersection'](_0x9e7323[_0x4183('0x2f')],_0x9e7323['query']);_0x13ea9a[_0x4183('0x31')]=_[_0x4183('0x32')](_0x9e7323[_0x4183('0x2f')],qs[_0x4183('0x33')](_0x55ac28[_0x4183('0x34')][_0x4183('0x33')]));_0x13ea9a[_0x4183('0x31')]=_0x13ea9a[_0x4183('0x31')][_0x4183('0x35')]?_0x13ea9a[_0x4183('0x31')]:_0x9e7323[_0x4183('0x2f')];if(!_0x55ac28[_0x4183('0x34')][_0x4183('0x36')](_0x4183('0x37'))){_0x13ea9a[_0x4183('0x20')]=qs['limit'](_0x55ac28['query'][_0x4183('0x20')]);_0x13ea9a[_0x4183('0x1d')]=qs[_0x4183('0x1d')](_0x55ac28[_0x4183('0x34')][_0x4183('0x1d')]);}_0x13ea9a[_0x4183('0x38')]=qs[_0x4183('0x39')](_0x55ac28['query']['sort']);_0x13ea9a[_0x4183('0x3a')]=qs[_0x4183('0x3b')](_[_0x4183('0x3c')](_0x55ac28[_0x4183('0x34')],_0x9e7323[_0x4183('0x3b')]),_0x3b35e7);if(_0x55ac28[_0x4183('0x34')][_0x4183('0x3d')]){_0x13ea9a[_0x4183('0x3a')]=_[_0x4183('0x3e')](_0x13ea9a['where'],{'$or':_[_0x4183('0x2b')](_0x3b35e7,function(_0x114250){if(_0x114250['type']!==_0x4183('0x3f')){var _0x167b9f={};_0x167b9f[_0x114250[_0x4183('0x29')]]={'$like':'%'+_0x55ac28['query'][_0x4183('0x3d')]+'%'};return _0x167b9f;}})});}_0x13ea9a=_[_0x4183('0x3e')]({},_0x13ea9a,_0x55ac28['options']);var _0x53e8b0={'where':_0x13ea9a['where']};return db[_0x4183('0x2c')][_0x4183('0x1f')](_0x53e8b0)[_0x4183('0x26')](function(_0x1a4921){_0x1ad1a6[_0x4183('0x1f')]=_0x1a4921;if(_0x55ac28[_0x4183('0x34')][_0x4183('0x40')]){_0x13ea9a[_0x4183('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x4183('0x42')](_0x13ea9a);})[_0x4183('0x26')](function(_0x1beefc){_0x1ad1a6[_0x4183('0x43')]=_0x1beefc;return _0x1ad1a6;})[_0x4183('0x26')](respondWithFilteredResult(_0x3c8138,_0x13ea9a))[_0x4183('0x44')](handleError(_0x3c8138,null));};exports[_0x4183('0x45')]=function(_0x4c90ac,_0x37ff2d){var _0xf1aa68={'raw':!![],'where':{'id':_0x4c90ac[_0x4183('0x46')]['id']}},_0x920b29={};_0x920b29[_0x4183('0x2f')]=_['keys'](db[_0x4183('0x2c')][_0x4183('0x2d')]);_0x920b29[_0x4183('0x34')]=_[_0x4183('0x30')](_0x4c90ac[_0x4183('0x34')]);_0x920b29[_0x4183('0x3b')]=_[_0x4183('0x32')](_0x920b29[_0x4183('0x2f')],_0x920b29[_0x4183('0x34')]);_0xf1aa68[_0x4183('0x31')]=_[_0x4183('0x32')](_0x920b29[_0x4183('0x2f')],qs[_0x4183('0x33')](_0x4c90ac[_0x4183('0x34')][_0x4183('0x33')]));_0xf1aa68[_0x4183('0x31')]=_0xf1aa68[_0x4183('0x31')][_0x4183('0x35')]?_0xf1aa68[_0x4183('0x31')]:_0x920b29[_0x4183('0x2f')];if(_0x4c90ac[_0x4183('0x34')][_0x4183('0x40')]){_0xf1aa68[_0x4183('0x41')]=[{'all':!![]}];}_0xf1aa68=_['merge']({},_0xf1aa68,_0x4c90ac[_0x4183('0x47')]);return db['FaxTransferReport'][_0x4183('0x48')](_0xf1aa68)['then'](handleEntityNotFound(_0x37ff2d,null))[_0x4183('0x26')](respondWithResult(_0x37ff2d,null))[_0x4183('0x44')](handleError(_0x37ff2d,null));};exports[_0x4183('0x49')]=function(_0x7f5763,_0x52f92e){return db[_0x4183('0x2c')][_0x4183('0x49')](_0x7f5763['body'],{})[_0x4183('0x26')](respondWithResult(_0x52f92e,0xc9))[_0x4183('0x44')](handleError(_0x52f92e,null));};exports[_0x4183('0x24')]=function(_0x4b9dd5,_0x5f4894){if(_0x4b9dd5['body']['id']){delete _0x4b9dd5[_0x4183('0x4a')]['id'];}return db[_0x4183('0x2c')][_0x4183('0x48')]({'where':{'id':_0x4b9dd5[_0x4183('0x46')]['id']}})['then'](handleEntityNotFound(_0x5f4894,null))[_0x4183('0x26')](saveUpdates(_0x4b9dd5['body'],null))[_0x4183('0x26')](respondWithResult(_0x5f4894,null))['catch'](handleError(_0x5f4894,null));};exports[_0x4183('0x25')]=function(_0x11753c,_0x351b67){return db[_0x4183('0x2c')]['find']({'where':{'id':_0x11753c[_0x4183('0x46')]['id']}})[_0x4183('0x26')](handleEntityNotFound(_0x351b67,null))[_0x4183('0x26')](removeEntity(_0x351b67,null))['catch'](handleError(_0x351b67,null));};exports[_0x4183('0x4b')]=function(_0x1d4f20,_0x4631a5){return db['FaxTransferReport'][_0x4183('0x4b')]()[_0x4183('0x26')](respondWithResult(_0x4631a5,null))['catch'](handleError(_0x4631a5,null));}; \ No newline at end of file +var _0xb204=['filter','where','merge','rows','catch','params','length','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','filters','pick'];(function(_0x112991,_0x1657bb){var _0x2e74da=function(_0x204641){while(--_0x204641){_0x112991['push'](_0x112991['shift']());}};_0x2e74da(++_0x1657bb);}(_0xb204,0x157));var _0x4b20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb204[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b20('0x0'));var rimraf=require(_0x4b20('0x1'));var zipdir=require(_0x4b20('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b20('0x4'));var util=require(_0x4b20('0x5'));var path=require('path');var sox=require(_0x4b20('0x6'));var csv=require(_0x4b20('0x7'));var ejs=require(_0x4b20('0x8'));var fs=require('fs');var fs_extra=require(_0x4b20('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b20('0xa'));var jsforce=require(_0x4b20('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4b20('0x7'));var querystring=require('querystring');var Papa=require(_0x4b20('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b20('0xd'));var as=require(_0x4b20('0xe'));var hardwareService=require(_0x4b20('0xf'));var logger=require(_0x4b20('0x10'))(_0x4b20('0x11'));var utils=require(_0x4b20('0x12'));var config=require(_0x4b20('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57f3ac,_0x4dfc24){_0x4dfc24=_0x4dfc24||0xcc;return function(_0x568f11){if(_0x568f11){return _0x57f3ac[_0x4b20('0x14')](_0x4dfc24);}return _0x57f3ac[_0x4b20('0x15')](_0x4dfc24)['end']();};}function respondWithResult(_0x8de368,_0x237c09){_0x237c09=_0x237c09||0xc8;return function(_0x328c5d){if(_0x328c5d){return _0x8de368[_0x4b20('0x15')](_0x237c09)[_0x4b20('0x16')](_0x328c5d);}};}function respondWithFilteredResult(_0x3d5c86,_0x1abd70){return function(_0x238127){if(_0x238127){var _0x392f7b=typeof _0x1abd70['offset']===_0x4b20('0x17')&&typeof _0x1abd70[_0x4b20('0x18')]===_0x4b20('0x17');var _0x104eff=_0x238127[_0x4b20('0x19')];var _0x155cd3=_0x392f7b?0x0:_0x1abd70['offset'];var _0xad7252=_0x392f7b?_0x238127['count']:_0x1abd70[_0x4b20('0x1a')]+_0x1abd70[_0x4b20('0x18')];var _0x4ce4c1;if(_0xad7252>=_0x104eff){_0xad7252=_0x104eff;_0x4ce4c1=0xc8;}else{_0x4ce4c1=0xce;}_0x3d5c86[_0x4b20('0x15')](_0x4ce4c1);return _0x3d5c86[_0x4b20('0x1b')](_0x4b20('0x1c'),_0x155cd3+'-'+_0xad7252+'/'+_0x104eff)['json'](_0x238127);}return null;};}function patchUpdates(_0x56afb3){return function(_0x5f006d){try{jsonpatch['apply'](_0x5f006d,_0x56afb3,!![]);}catch(_0x4f4415){return BPromise['reject'](_0x4f4415);}return _0x5f006d[_0x4b20('0x1d')]();};}function saveUpdates(_0x4fbb97,_0x5cd1bc){return function(_0x53e9ee){if(_0x53e9ee){return _0x53e9ee[_0x4b20('0x1e')](_0x4fbb97)[_0x4b20('0x1f')](function(_0x6f94af){return _0x6f94af;});}return null;};}function removeEntity(_0x16c088,_0xe9b8f6){return function(_0x1b34ea){if(_0x1b34ea){return _0x1b34ea[_0x4b20('0x20')]()[_0x4b20('0x1f')](function(){_0x16c088[_0x4b20('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4420cd,_0x95f03b){return function(_0xd059b4){if(!_0xd059b4){_0x4420cd[_0x4b20('0x14')](0x194);}return _0xd059b4;};}function handleError(_0x1f240c,_0x3b5c98){_0x3b5c98=_0x3b5c98||0x1f4;return function(_0x361aab){logger[_0x4b20('0x21')](_0x361aab['stack']);if(_0x361aab[_0x4b20('0x22')]){delete _0x361aab[_0x4b20('0x22')];}_0x1f240c[_0x4b20('0x15')](_0x3b5c98)[_0x4b20('0x23')](_0x361aab);};}exports[_0x4b20('0x24')]=function(_0x9a3f47,_0x7b9481){var _0x15ce10={},_0xc8a51f={},_0x46cee1={'count':0x0,'rows':[]};var _0x352230=_[_0x4b20('0x25')](db[_0x4b20('0x26')][_0x4b20('0x27')],function(_0x437ccd){return{'name':_0x437ccd['fieldName'],'type':_0x437ccd[_0x4b20('0x28')][_0x4b20('0x29')]};});_0xc8a51f[_0x4b20('0x2a')]=_[_0x4b20('0x25')](_0x352230,'name');_0xc8a51f[_0x4b20('0x2b')]=_[_0x4b20('0x2c')](_0x9a3f47['query']);_0xc8a51f['filters']=_[_0x4b20('0x2d')](_0xc8a51f['model'],_0xc8a51f[_0x4b20('0x2b')]);_0x15ce10['attributes']=_['intersection'](_0xc8a51f[_0x4b20('0x2a')],qs[_0x4b20('0x2e')](_0x9a3f47[_0x4b20('0x2b')][_0x4b20('0x2e')]));_0x15ce10[_0x4b20('0x2f')]=_0x15ce10['attributes']['length']?_0x15ce10[_0x4b20('0x2f')]:_0xc8a51f[_0x4b20('0x2a')];if(!_0x9a3f47[_0x4b20('0x2b')]['hasOwnProperty'](_0x4b20('0x30'))){_0x15ce10[_0x4b20('0x18')]=qs[_0x4b20('0x18')](_0x9a3f47[_0x4b20('0x2b')][_0x4b20('0x18')]);_0x15ce10[_0x4b20('0x1a')]=qs['offset'](_0x9a3f47[_0x4b20('0x2b')][_0x4b20('0x1a')]);}_0x15ce10[_0x4b20('0x31')]=qs[_0x4b20('0x32')](_0x9a3f47['query'][_0x4b20('0x32')]);_0x15ce10['where']=qs[_0x4b20('0x33')](_[_0x4b20('0x34')](_0x9a3f47[_0x4b20('0x2b')],_0xc8a51f['filters']),_0x352230);if(_0x9a3f47['query'][_0x4b20('0x35')]){_0x15ce10[_0x4b20('0x36')]=_['merge'](_0x15ce10[_0x4b20('0x36')],{'$or':_[_0x4b20('0x25')](_0x352230,function(_0xc9892a){if(_0xc9892a['type']!=='VIRTUAL'){var _0x32419b={};_0x32419b[_0xc9892a[_0x4b20('0x22')]]={'$like':'%'+_0x9a3f47[_0x4b20('0x2b')][_0x4b20('0x35')]+'%'};return _0x32419b;}})});}_0x15ce10=_[_0x4b20('0x37')]({},_0x15ce10,_0x9a3f47['options']);var _0x531edc={'where':_0x15ce10[_0x4b20('0x36')]};return db[_0x4b20('0x26')][_0x4b20('0x19')](_0x531edc)[_0x4b20('0x1f')](function(_0xd02f5a){_0x46cee1[_0x4b20('0x19')]=_0xd02f5a;if(_0x9a3f47[_0x4b20('0x2b')]['includeAll']){_0x15ce10['include']=[{'all':!![]}];}return db[_0x4b20('0x26')]['findAll'](_0x15ce10);})['then'](function(_0x400e49){_0x46cee1[_0x4b20('0x38')]=_0x400e49;return _0x46cee1;})['then'](respondWithFilteredResult(_0x7b9481,_0x15ce10))[_0x4b20('0x39')](handleError(_0x7b9481,null));};exports['show']=function(_0x3c7070,_0x43df1a){var _0x19e7e8={'raw':!![],'where':{'id':_0x3c7070[_0x4b20('0x3a')]['id']}},_0x386f89={};_0x386f89[_0x4b20('0x2a')]=_[_0x4b20('0x2c')](db[_0x4b20('0x26')]['rawAttributes']);_0x386f89[_0x4b20('0x2b')]=_[_0x4b20('0x2c')](_0x3c7070[_0x4b20('0x2b')]);_0x386f89[_0x4b20('0x33')]=_[_0x4b20('0x2d')](_0x386f89[_0x4b20('0x2a')],_0x386f89[_0x4b20('0x2b')]);_0x19e7e8[_0x4b20('0x2f')]=_['intersection'](_0x386f89[_0x4b20('0x2a')],qs[_0x4b20('0x2e')](_0x3c7070['query'][_0x4b20('0x2e')]));_0x19e7e8[_0x4b20('0x2f')]=_0x19e7e8[_0x4b20('0x2f')][_0x4b20('0x3b')]?_0x19e7e8[_0x4b20('0x2f')]:_0x386f89['model'];if(_0x3c7070[_0x4b20('0x2b')]['includeAll']){_0x19e7e8[_0x4b20('0x3c')]=[{'all':!![]}];}_0x19e7e8=_['merge']({},_0x19e7e8,_0x3c7070[_0x4b20('0x3d')]);return db[_0x4b20('0x26')][_0x4b20('0x3e')](_0x19e7e8)['then'](handleEntityNotFound(_0x43df1a,null))[_0x4b20('0x1f')](respondWithResult(_0x43df1a,null))['catch'](handleError(_0x43df1a,null));};exports[_0x4b20('0x3f')]=function(_0x121054,_0x15ec3d){return db[_0x4b20('0x26')][_0x4b20('0x3f')](_0x121054[_0x4b20('0x40')],{})[_0x4b20('0x1f')](respondWithResult(_0x15ec3d,0xc9))[_0x4b20('0x39')](handleError(_0x15ec3d,null));};exports[_0x4b20('0x1e')]=function(_0x23c317,_0x2e1d56){if(_0x23c317['body']['id']){delete _0x23c317[_0x4b20('0x40')]['id'];}return db['FaxTransferReport'][_0x4b20('0x3e')]({'where':{'id':_0x23c317[_0x4b20('0x3a')]['id']}})[_0x4b20('0x1f')](handleEntityNotFound(_0x2e1d56,null))[_0x4b20('0x1f')](saveUpdates(_0x23c317[_0x4b20('0x40')],null))['then'](respondWithResult(_0x2e1d56,null))[_0x4b20('0x39')](handleError(_0x2e1d56,null));};exports[_0x4b20('0x20')]=function(_0x5eb19d,_0x110a81){return db[_0x4b20('0x26')][_0x4b20('0x3e')]({'where':{'id':_0x5eb19d[_0x4b20('0x3a')]['id']}})[_0x4b20('0x1f')](handleEntityNotFound(_0x110a81,null))[_0x4b20('0x1f')](removeEntity(_0x110a81,null))[_0x4b20('0x39')](handleError(_0x110a81,null));};exports['describe']=function(_0x354380,_0x2f6ee1){return db[_0x4b20('0x26')][_0x4b20('0x41')]()[_0x4b20('0x1f')](respondWithResult(_0x2f6ee1,null))[_0x4b20('0x39')](handleError(_0x2f6ee1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 4b37d77..d7c2b33 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 _0xa713=['api','request-promise','rimraf','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x3a112e,_0x1d1cd3){var _0x4cc64f=function(_0x4983b0){while(--_0x4983b0){_0x3a112e['push'](_0x3a112e['shift']());}};_0x4cc64f(++_0x1d1cd3);}(_0xa713,0x7d));var _0x3a71=function(_0x4a05c9,_0x58e0ab){_0x4a05c9=_0x4a05c9-0x0;var _0x9ac6ef=_0xa713[_0x4a05c9];return _0x9ac6ef;};'use strict';var _=require(_0x3a71('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a71('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a71('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a71('0x3'));var config=require('../../config/environment');var attributes=require(_0x3a71('0x4'));module[_0x3a71('0x5')]=function(_0x49b8ee,_0x27de9a){return _0x49b8ee['define'](_0x3a71('0x6'),attributes,{'tableName':_0x3a71('0x7'),'paranoid':![],'indexes':[{'name':_0x3a71('0x8'),'fields':[_0x3a71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bfd=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ad3a3,_0x3b10a4){var _0x4f61b8=function(_0x17a4fa){while(--_0x17a4fa){_0x2ad3a3['push'](_0x2ad3a3['shift']());}};_0x4f61b8(++_0x3b10a4);}(_0x1bfd,0xbc));var _0xd1bf=function(_0x3d9cfa,_0x596edc){_0x3d9cfa=_0x3d9cfa-0x0;var _0x21d89d=_0x1bfd[_0x3d9cfa];return _0x21d89d;};'use strict';var _=require(_0xd1bf('0x0'));var util=require(_0xd1bf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd1bf('0x2'));var BPromise=require(_0xd1bf('0x3'));var rp=require(_0xd1bf('0x4'));var fs=require('fs');var path=require(_0xd1bf('0x5'));var rimraf=require(_0xd1bf('0x6'));var config=require(_0xd1bf('0x7'));var attributes=require(_0xd1bf('0x8'));module[_0xd1bf('0x9')]=function(_0x4c86c1,_0x4e62e5){return _0x4c86c1[_0xd1bf('0xa')](_0xd1bf('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd1bf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 062f24f..f310c3c 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 _0x59de=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x56a088,_0x533cd5){var _0x2b4dea=function(_0x3daaff){while(--_0x3daaff){_0x56a088['push'](_0x56a088['shift']());}};_0x2b4dea(++_0x533cd5);}(_0x59de,0x1c1));var _0xe59d=function(_0x363593,_0x3b4415){_0x363593=_0x363593-0x0;var _0x439351=_0x59de[_0x363593];return _0x439351;};'use strict';var _=require(_0xe59d('0x0'));var util=require('util');var moment=require(_0xe59d('0x1'));var BPromise=require('bluebird');var rs=require(_0xe59d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe59d('0x3'))['db'];var utils=require(_0xe59d('0x4'));var logger=require(_0xe59d('0x5'))(_0xe59d('0x6'));var config=require(_0xe59d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe59d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d4d5a,_0x5505c3,_0x35eb50){return new BPromise(function(_0x185656,_0x7aa37b){return client[_0xe59d('0x9')](_0x4d4d5a,_0x35eb50)[_0xe59d('0xa')](function(_0x42b91e){logger[_0xe59d('0xb')](_0xe59d('0xc'),_0x5505c3,_0xe59d('0xd'));logger[_0xe59d('0xe')](_0xe59d('0xf'),_0x5505c3,_0xe59d('0xd'),JSON[_0xe59d('0x10')](_0x42b91e));if(_0x42b91e[_0xe59d('0x11')]){if(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x12')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x5505c3,_0x42b91e[_0xe59d('0x11')]['message']);return _0x7aa37b(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);}logger[_0xe59d('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5505c3,_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);return _0x185656(_0x42b91e[_0xe59d('0x11')][_0xe59d('0x13')]);}else{logger[_0xe59d('0xb')](_0xe59d('0xc'),_0x5505c3,'request\x20sent');_0x185656(_0x42b91e[_0xe59d('0x14')][_0xe59d('0x13')]);}})[_0xe59d('0x15')](function(_0x814490){logger[_0xe59d('0x11')](_0xe59d('0xc'),_0x5505c3,_0x814490);_0x7aa37b(_0x814490);});});} \ No newline at end of file +var _0xff64=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22d613,_0x176318){var _0x34a66b=function(_0x215927){while(--_0x215927){_0x22d613['push'](_0x22d613['shift']());}};_0x34a66b(++_0x176318);}(_0xff64,0x191));var _0x4ff6=function(_0xd7b69b,_0x56b291){_0xd7b69b=_0xd7b69b-0x0;var _0x21d50e=_0xff64[_0xd7b69b];return _0x21d50e;};'use strict';var _=require(_0x4ff6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4ff6('0x1'));var fs=require('fs');var Redis=require(_0x4ff6('0x2'));var db=require(_0x4ff6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ff6('0x4'));var jayson=require(_0x4ff6('0x5'));var client=jayson[_0x4ff6('0x6')][_0x4ff6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x526325,_0x1935de,_0x22cc2d){return new BPromise(function(_0x1f6f3a,_0x50f169){return client['request'](_0x526325,_0x22cc2d)[_0x4ff6('0x8')](function(_0x4e6087){logger[_0x4ff6('0x9')](_0x4ff6('0xa'),_0x1935de,_0x4ff6('0xb'));logger[_0x4ff6('0xc')](_0x4ff6('0xd'),_0x1935de,_0x4ff6('0xb'),JSON[_0x4ff6('0xe')](_0x4e6087));if(_0x4e6087[_0x4ff6('0xf')]){if(_0x4e6087[_0x4ff6('0xf')]['code']===0x1f4){logger['error'](_0x4ff6('0xa'),_0x1935de,_0x4e6087[_0x4ff6('0xf')]['message']);return _0x50f169(_0x4e6087[_0x4ff6('0xf')][_0x4ff6('0x10')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1935de,_0x4e6087[_0x4ff6('0xf')][_0x4ff6('0x10')]);return _0x1f6f3a(_0x4e6087[_0x4ff6('0xf')]['message']);}else{logger[_0x4ff6('0x9')](_0x4ff6('0xa'),_0x1935de,_0x4ff6('0xb'));_0x1f6f3a(_0x4e6087['result'][_0x4ff6('0x10')]);}})[_0x4ff6('0x11')](function(_0x2fdd52){logger[_0x4ff6('0xf')](_0x4ff6('0xa'),_0x1935de,_0x2fdd52);_0x50f169(_0x2fdd52);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2a48eeb..e74e544 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 _0xe887=['delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0xe887,0x179));var _0x7e88=function(_0x441ac4,_0x934d4){_0x441ac4=_0x441ac4-0x0;var _0x1f19f1=_0xe887[_0x441ac4];return _0x1f19f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e88('0x0'));var timeout=require(_0x7e88('0x1'));var express=require('express');var router=express[_0x7e88('0x2')]();var fs_extra=require(_0x7e88('0x3'));var auth=require(_0x7e88('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x7e88('0x5')](),controller[_0x7e88('0x6')]);router[_0x7e88('0x7')]('/describe',auth[_0x7e88('0x5')](),controller['describe']);router[_0x7e88('0x7')](_0x7e88('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7e88('0x9')]('/',auth[_0x7e88('0x5')](),controller[_0x7e88('0xa')]);router[_0x7e88('0xb')]('/:id',auth[_0x7e88('0x5')](),controller[_0x7e88('0xc')]);router[_0x7e88('0xd')](_0x7e88('0x8'),auth[_0x7e88('0x5')](),controller['destroy']);module[_0x7e88('0xe')]=router; \ No newline at end of file +var _0x6120=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1823f6,_0x3b41fb){var _0x22ec28=function(_0x48e568){while(--_0x48e568){_0x1823f6['push'](_0x1823f6['shift']());}};_0x22ec28(++_0x3b41fb);}(_0x6120,0x117));var _0x0612=function(_0x12aa8b,_0x4d2175){_0x12aa8b=_0x12aa8b-0x0;var _0x216153=_0x6120[_0x12aa8b];return _0x216153;};'use strict';var multer=require(_0x0612('0x0'));var util=require(_0x0612('0x1'));var path=require(_0x0612('0x2'));var timeout=require(_0x0612('0x3'));var express=require(_0x0612('0x4'));var router=express['Router']();var fs_extra=require(_0x0612('0x5'));var auth=require(_0x0612('0x6'));var interaction=require(_0x0612('0x7'));var config=require(_0x0612('0x8'));var controller=require(_0x0612('0x9'));router[_0x0612('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0612('0xa')]('/describe',auth[_0x0612('0xb')](),controller['describe']);router['get'](_0x0612('0xc'),auth[_0x0612('0xb')](),controller[_0x0612('0xd')]);router[_0x0612('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0612('0xc'),auth['isAuthenticated'](),controller[_0x0612('0xf')]);router[_0x0612('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0612('0x11')]);module[_0x0612('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 9931bc7..bd862e6 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 _0xbaf8=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','./intDeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','addConfiguration'];(function(_0x30f82b,_0x5986f9){var _0x2205b7=function(_0x23faab){while(--_0x23faab){_0x30f82b['push'](_0x30f82b['shift']());}};_0x2205b7(++_0x5986f9);}(_0xbaf8,0x101));var _0x8baf=function(_0x305cb0,_0x124dbf){_0x305cb0=_0x305cb0-0x0;var _0x5b4133=_0xbaf8[_0x305cb0];return _0x5b4133;};'use strict';var multer=require(_0x8baf('0x0'));var util=require('util');var path=require(_0x8baf('0x1'));var timeout=require(_0x8baf('0x2'));var express=require(_0x8baf('0x3'));var router=express[_0x8baf('0x4')]();var fs_extra=require(_0x8baf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8baf('0x6'));router[_0x8baf('0x7')]('/',auth[_0x8baf('0x8')](),controller[_0x8baf('0x9')]);router[_0x8baf('0x7')]('/:id',auth[_0x8baf('0x8')](),controller['show']);router[_0x8baf('0x7')](_0x8baf('0xa'),auth['isAuthenticated'](),controller[_0x8baf('0xb')]);router[_0x8baf('0x7')]('/:id/fields',auth[_0x8baf('0x8')](),controller['getFields']);router['post']('/',auth[_0x8baf('0x8')](),controller['create']);router['post']('/:id/configurations',auth[_0x8baf('0x8')](),controller[_0x8baf('0xc')]);router[_0x8baf('0xd')](_0x8baf('0xe'),auth[_0x8baf('0x8')](),controller[_0x8baf('0xf')]);router[_0x8baf('0x10')](_0x8baf('0xe'),auth[_0x8baf('0x8')](),controller['destroy']);module[_0x8baf('0x11')]=router; \ No newline at end of file +var _0xe03e=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x37d106,_0x44edf2){var _0x1b9e17=function(_0x17fde5){while(--_0x17fde5){_0x37d106['push'](_0x37d106['shift']());}};_0x1b9e17(++_0x44edf2);}(_0xe03e,0x1da));var _0xee03=function(_0x210ae0,_0x54ed23){_0x210ae0=_0x210ae0-0x0;var _0x530e4b=_0xe03e[_0x210ae0];return _0x530e4b;};'use strict';var multer=require(_0xee03('0x0'));var util=require(_0xee03('0x1'));var path=require(_0xee03('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xee03('0x4'));var interaction=require(_0xee03('0x5'));var config=require(_0xee03('0x6'));var controller=require('./intDeskAccount.controller');router[_0xee03('0x7')]('/',auth[_0xee03('0x8')](),controller[_0xee03('0x9')]);router[_0xee03('0x7')](_0xee03('0xa'),auth[_0xee03('0x8')](),controller[_0xee03('0xb')]);router[_0xee03('0x7')](_0xee03('0xc'),auth[_0xee03('0x8')](),controller[_0xee03('0xd')]);router['get'](_0xee03('0xe'),auth[_0xee03('0x8')](),controller['getFields']);router[_0xee03('0xf')]('/',auth[_0xee03('0x8')](),controller['create']);router['post'](_0xee03('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xee03('0x10')](_0xee03('0xa'),auth[_0xee03('0x8')](),controller[_0xee03('0x11')]);router[_0xee03('0x12')](_0xee03('0xa'),auth[_0xee03('0x8')](),controller[_0xee03('0x13')]);module[_0xee03('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0a579ee..50f99c4 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 _0xba48=['ENUM','basic','newTab','sequelize','STRING'];(function(_0x8018db,_0x3d6e4f){var _0x3cd654=function(_0x491e26){while(--_0x491e26){_0x8018db['push'](_0x8018db['shift']());}};_0x3cd654(++_0x3d6e4f);}(_0xba48,0xe9));var _0x8ba4=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xba48[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x8ba4('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ba4('0x1')]},'description':{'type':Sequelize[_0x8ba4('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8ba4('0x1')]},'authType':{'type':Sequelize[_0x8ba4('0x2')](_0x8ba4('0x3')),'defaultValue':_0x8ba4('0x3')},'password':{'type':Sequelize[_0x8ba4('0x1')]},'consumerKey':{'type':Sequelize[_0x8ba4('0x1')]},'consumerSecret':{'type':Sequelize[_0x8ba4('0x1')]},'token':{'type':Sequelize[_0x8ba4('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8ba4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8ba4('0x2')]('integrationTab',_0x8ba4('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcdb0=['basic','ENUM','sequelize','exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcdb0,0x13d));var _0x0cdb=function(_0x81c250,_0x94b758){_0x81c250=_0x81c250-0x0;var _0x53f723=_0xcdb0[_0x81c250];return _0x53f723;};'use strict';var Sequelize=require(_0x0cdb('0x0'));module[_0x0cdb('0x1')]={'name':{'type':Sequelize[_0x0cdb('0x2')]},'description':{'type':Sequelize[_0x0cdb('0x2')]},'username':{'type':Sequelize[_0x0cdb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x0cdb('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x0cdb('0x2')]},'consumerSecret':{'type':Sequelize[_0x0cdb('0x2')]},'token':{'type':Sequelize[_0x0cdb('0x2')]},'tokenSecret':{'type':Sequelize[_0x0cdb('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0cdb('0x4')]('integrationTab','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 e826d0f..aff58cb 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 _0x831b=['sort','pick','VIRTUAL','filter','merge','options','where','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','then','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x5737d1,_0x41d434){var _0x25f470=function(_0x3efa96){while(--_0x3efa96){_0x5737d1['push'](_0x5737d1['shift']());}};_0x25f470(++_0x41d434);}(_0x831b,0x128));var _0xb831=function(_0x10dd79,_0x2cd1d0){_0x10dd79=_0x10dd79-0x0;var _0x4e8dfa=_0x831b[_0x10dd79];return _0x4e8dfa;};'use strict';var emlformat=require(_0xb831('0x0'));var rimraf=require(_0xb831('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb831('0x2'));var rp=require(_0xb831('0x3'));var moment=require(_0xb831('0x4'));var BPromise=require(_0xb831('0x5'));var Mustache=require(_0xb831('0x6'));var util=require(_0xb831('0x7'));var path=require(_0xb831('0x8'));var sox=require('sox');var csv=require(_0xb831('0x9'));var ejs=require(_0xb831('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb831('0xb'));var squel=require(_0xb831('0xc'));var crypto=require('crypto');var jsforce=require(_0xb831('0xd'));var deskjs=require(_0xb831('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb831('0xf'));var Papa=require('papaparse');var Redis=require(_0xb831('0x10'));var authService=require(_0xb831('0x11'));var qs=require(_0xb831('0x12'));var as=require(_0xb831('0x13'));var hardwareService=require(_0xb831('0x14'));var logger=require(_0xb831('0x15'))(_0xb831('0x16'));var utils=require(_0xb831('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb831('0x18'));var db=require(_0xb831('0x19'))['db'];var integrations=require(_0xb831('0x1a'));function respondWithStatusCode(_0x2a2b22,_0x3aca54){_0x3aca54=_0x3aca54||0xcc;return function(_0x4cd8ee){if(_0x4cd8ee){return _0x2a2b22[_0xb831('0x1b')](_0x3aca54);}return _0x2a2b22[_0xb831('0x1c')](_0x3aca54)[_0xb831('0x1d')]();};}function respondWithResult(_0x5241f3,_0x73a1a2){_0x73a1a2=_0x73a1a2||0xc8;return function(_0x1b4dee){if(_0x1b4dee){return _0x5241f3[_0xb831('0x1c')](_0x73a1a2)[_0xb831('0x1e')](_0x1b4dee);}};}function respondWithFilteredResult(_0x2599d5,_0x5352e0){return function(_0x3347af){if(_0x3347af){var _0x50e1d7=typeof _0x5352e0[_0xb831('0x1f')]==='undefined'&&typeof _0x5352e0['limit']===_0xb831('0x20');var _0x58d747=_0x3347af['count'];var _0x4eaca5=_0x50e1d7?0x0:_0x5352e0[_0xb831('0x1f')];var _0x31e483=_0x50e1d7?_0x3347af['count']:_0x5352e0[_0xb831('0x1f')]+_0x5352e0[_0xb831('0x21')];var _0x397996;if(_0x31e483>=_0x58d747){_0x31e483=_0x58d747;_0x397996=0xc8;}else{_0x397996=0xce;}_0x2599d5[_0xb831('0x1c')](_0x397996);return _0x2599d5[_0xb831('0x22')]('Content-Range',_0x4eaca5+'-'+_0x31e483+'/'+_0x58d747)['json'](_0x3347af);}return null;};}function patchUpdates(_0x4bcce6){return function(_0x3e9474){try{jsonpatch[_0xb831('0x23')](_0x3e9474,_0x4bcce6,!![]);}catch(_0x3af3c5){return BPromise[_0xb831('0x24')](_0x3af3c5);}return _0x3e9474[_0xb831('0x25')]();};}function saveUpdates(_0x16771e,_0x1cfd9e){return function(_0x527cea){if(_0x527cea){return _0x527cea['update'](_0x16771e)['then'](function(_0x12ec10){return _0x12ec10;});}return null;};}function removeEntity(_0xd5e514,_0x145c9f){return function(_0x35cfac){if(_0x35cfac){return _0x35cfac['destroy']()[_0xb831('0x26')](function(){_0xd5e514['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b23b7,_0x465de5){return function(_0x4039df){if(!_0x4039df){_0x5b23b7[_0xb831('0x1b')](0x194);}return _0x4039df;};}function handleError(_0x4ac68a,_0xb60fd3){_0xb60fd3=_0xb60fd3||0x1f4;return function(_0x19b7f6){logger[_0xb831('0x27')](_0x19b7f6[_0xb831('0x28')]);if(_0x19b7f6[_0xb831('0x29')]){delete _0x19b7f6[_0xb831('0x29')];}_0x4ac68a[_0xb831('0x1c')](_0xb60fd3)['send'](_0x19b7f6);};}exports[_0xb831('0x2a')]=function(_0x3a3a9a,_0x2e56ab){var _0xc46704={},_0x45e53c={},_0x122a55={'count':0x0,'rows':[]};var _0x20b00b=_[_0xb831('0x2b')](db[_0xb831('0x2c')][_0xb831('0x2d')],function(_0x1950f9){return{'name':_0x1950f9[_0xb831('0x2e')],'type':_0x1950f9[_0xb831('0x2f')]['key']};});_0x45e53c[_0xb831('0x30')]=_[_0xb831('0x2b')](_0x20b00b,_0xb831('0x29'));_0x45e53c['query']=_['keys'](_0x3a3a9a[_0xb831('0x31')]);_0x45e53c[_0xb831('0x32')]=_[_0xb831('0x33')](_0x45e53c['model'],_0x45e53c[_0xb831('0x31')]);_0xc46704['attributes']=_[_0xb831('0x33')](_0x45e53c[_0xb831('0x30')],qs[_0xb831('0x34')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x34')]));_0xc46704[_0xb831('0x35')]=_0xc46704[_0xb831('0x35')][_0xb831('0x36')]?_0xc46704['attributes']:_0x45e53c[_0xb831('0x30')];if(!_0x3a3a9a[_0xb831('0x31')][_0xb831('0x37')](_0xb831('0x38'))){_0xc46704[_0xb831('0x21')]=qs[_0xb831('0x21')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x21')]);_0xc46704['offset']=qs[_0xb831('0x1f')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x1f')]);}_0xc46704[_0xb831('0x39')]=qs[_0xb831('0x3a')](_0x3a3a9a[_0xb831('0x31')][_0xb831('0x3a')]);_0xc46704['where']=qs[_0xb831('0x32')](_[_0xb831('0x3b')](_0x3a3a9a[_0xb831('0x31')],_0x45e53c[_0xb831('0x32')]),_0x20b00b);if(_0x3a3a9a[_0xb831('0x31')]['filter']){_0xc46704['where']=_['merge'](_0xc46704['where'],{'$or':_[_0xb831('0x2b')](_0x20b00b,function(_0x1a19b1){if(_0x1a19b1[_0xb831('0x2f')]!==_0xb831('0x3c')){var _0x4c517e={};_0x4c517e[_0x1a19b1['name']]={'$like':'%'+_0x3a3a9a[_0xb831('0x31')][_0xb831('0x3d')]+'%'};return _0x4c517e;}})});}_0xc46704=_[_0xb831('0x3e')]({},_0xc46704,_0x3a3a9a[_0xb831('0x3f')]);var _0x3ca600={'where':_0xc46704[_0xb831('0x40')]};return db[_0xb831('0x2c')][_0xb831('0x41')](_0x3ca600)[_0xb831('0x26')](function(_0x5c4aa5){_0x122a55['count']=_0x5c4aa5;if(_0x3a3a9a['query'][_0xb831('0x42')]){_0xc46704['include']=[{'all':!![]}];}return db[_0xb831('0x2c')][_0xb831('0x43')](_0xc46704);})['then'](function(_0x3627d6){_0x122a55[_0xb831('0x44')]=_0x3627d6;return _0x122a55;})['then'](respondWithFilteredResult(_0x2e56ab,_0xc46704))[_0xb831('0x45')](handleError(_0x2e56ab,null));};exports[_0xb831('0x46')]=function(_0x427666,_0x1cfb89){var _0x349f3d={'raw':![],'where':{'id':_0x427666[_0xb831('0x47')]['id']}},_0x1eb250={};_0x1eb250[_0xb831('0x30')]=_['keys'](db['DeskAccount']['rawAttributes']);_0x1eb250['query']=_[_0xb831('0x48')](_0x427666[_0xb831('0x31')]);_0x1eb250[_0xb831('0x32')]=_[_0xb831('0x33')](_0x1eb250[_0xb831('0x30')],_0x1eb250[_0xb831('0x31')]);_0x349f3d[_0xb831('0x35')]=_['intersection'](_0x1eb250['model'],qs[_0xb831('0x34')](_0x427666[_0xb831('0x31')][_0xb831('0x34')]));_0x349f3d[_0xb831('0x35')]=_0x349f3d['attributes'][_0xb831('0x36')]?_0x349f3d['attributes']:_0x1eb250[_0xb831('0x30')];if(_0x427666['query']['includeAll']){_0x349f3d[_0xb831('0x49')]=[{'all':!![]}];}_0x349f3d=_[_0xb831('0x3e')]({},_0x349f3d,_0x427666[_0xb831('0x3f')]);return db[_0xb831('0x2c')][_0xb831('0x4a')](_0x349f3d)[_0xb831('0x26')](handleEntityNotFound(_0x1cfb89,null))[_0xb831('0x26')](respondWithResult(_0x1cfb89,null))[_0xb831('0x45')](handleError(_0x1cfb89,null));};exports[_0xb831('0x4b')]=function(_0x4016c7,_0x312d40){return db['DeskAccount'][_0xb831('0x4b')](_0x4016c7['body'],{})['then'](respondWithResult(_0x312d40,0xc9))['catch'](handleError(_0x312d40,null));};exports['update']=function(_0x2ee398,_0x50a1d4){if(_0x2ee398[_0xb831('0x4c')]['id']){delete _0x2ee398['body']['id'];}return db[_0xb831('0x2c')][_0xb831('0x4a')]({'where':{'id':_0x2ee398['params']['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x50a1d4,null))[_0xb831('0x26')](saveUpdates(_0x2ee398['body'],null))['then'](respondWithResult(_0x50a1d4,null))[_0xb831('0x45')](handleError(_0x50a1d4,null));};exports[_0xb831('0x4d')]=function(_0x2f69c1,_0x44b4a0){return db['DeskAccount']['find']({'where':{'id':_0x2f69c1['params']['id']}})['then'](handleEntityNotFound(_0x44b4a0,null))[_0xb831('0x26')](removeEntity(_0x44b4a0,null))[_0xb831('0x45')](handleError(_0x44b4a0,null));};exports[_0xb831('0x4e')]=function(_0x397cff,_0x16221d,_0x4b2741){var _0x82da9c={};var _0x137438={};var _0x294246;var _0x53c97d;return db[_0xb831('0x2c')]['findOne']({'where':{'id':_0x397cff[_0xb831('0x47')]['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x16221d,null))[_0xb831('0x26')](function(_0x45b864){if(_0x45b864){_0x294246=_0x45b864;_0x137438['model']=_['keys'](db[_0xb831('0x4f')][_0xb831('0x2d')]);_0x137438[_0xb831('0x31')]=_[_0xb831('0x48')](_0x397cff[_0xb831('0x31')]);_0x137438[_0xb831('0x32')]=_[_0xb831('0x33')](_0x137438[_0xb831('0x30')],_0x137438['query']);_0x82da9c[_0xb831('0x35')]=_[_0xb831('0x33')](_0x137438[_0xb831('0x30')],qs[_0xb831('0x34')](_0x397cff[_0xb831('0x31')][_0xb831('0x34')]));_0x82da9c['attributes']=_0x82da9c[_0xb831('0x35')][_0xb831('0x36')]?_0x82da9c['attributes']:_0x137438[_0xb831('0x30')];_0x82da9c[_0xb831('0x39')]=qs[_0xb831('0x3a')](_0x397cff['query'][_0xb831('0x3a')]);_0x82da9c['where']=qs[_0xb831('0x32')](_[_0xb831('0x3b')](_0x397cff[_0xb831('0x31')],_0x137438['filters']));if(_0x397cff[_0xb831('0x31')]['filter']){_0x82da9c['where']=_['merge'](_0x82da9c[_0xb831('0x40')],{'$or':_['map'](_0x82da9c['attributes'],function(_0x2e74bc){var _0x4afb7d={};_0x4afb7d[_0x2e74bc]={'$like':'%'+_0x397cff[_0xb831('0x31')][_0xb831('0x3d')]+'%'};return _0x4afb7d;})});}_0x82da9c=_[_0xb831('0x3e')]({},_0x82da9c,_0x397cff[_0xb831('0x3f')]);return _0x294246[_0xb831('0x4e')](_0x82da9c);}})[_0xb831('0x26')](function(_0x5e9018){if(_0x5e9018){_0x53c97d=_0x5e9018[_0xb831('0x36')];if(!_0x397cff['query'][_0xb831('0x37')](_0xb831('0x38'))){_0x82da9c['limit']=qs[_0xb831('0x21')](_0x397cff['query'][_0xb831('0x21')]);_0x82da9c[_0xb831('0x1f')]=qs[_0xb831('0x1f')](_0x397cff['query'][_0xb831('0x1f')]);}return _0x294246[_0xb831('0x4e')](_0x82da9c);}})[_0xb831('0x26')](function(_0x3e0f00){if(_0x3e0f00){return _0x3e0f00?{'count':_0x53c97d,'rows':_0x3e0f00}:null;}})[_0xb831('0x26')](respondWithResult(_0x16221d,null))[_0xb831('0x45')](handleError(_0x16221d,null));};exports[_0xb831('0x50')]=function(_0x109073,_0x4be766,_0x3e1327){if(_0x109073[_0xb831('0x4c')]['id']){delete _0x109073['body']['id'];}return db[_0xb831('0x2c')][_0xb831('0x51')]({'where':{'id':_0x109073[_0xb831('0x47')]['id']}})[_0xb831('0x26')](handleEntityNotFound(_0x4be766,null))[_0xb831('0x26')](function(_0x260189){if(_0x260189){_0x109073[_0xb831('0x4c')]['AccountId']=_0x260189['id'];_0x109073[_0xb831('0x4c')][_0xb831('0x52')]=integrations[_0xb831('0x53')](_0x109073['body'][_0xb831('0x54')],_0x109073[_0xb831('0x4c')]['type']);_0x109073[_0xb831('0x4c')][_0xb831('0x55')]=integrations[_0xb831('0x56')](_0x109073[_0xb831('0x4c')][_0xb831('0x54')],_0x109073[_0xb831('0x4c')][_0xb831('0x2f')]);return db['DeskConfiguration']['create'](_0x109073[_0xb831('0x4c')],{'include':[{'model':db[_0xb831('0x57')],'as':'Subjects'},{'model':db[_0xb831('0x57')],'as':_0xb831('0x55')}]});}return null;})['then'](respondWithResult(_0x4be766,null))[_0xb831('0x45')](handleError(_0x4be766,null));};exports[_0xb831('0x58')]=function(_0x5265b2,_0x422570,_0x301c1c){var _0x2b39ee=[{'name':_0xb831('0x59'),'label':_0xb831('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 _0x12d733='';return db[_0xb831('0x2c')][_0xb831('0x51')]({'where':{'id':_0x5265b2['params']['id']},'attributes':['id',_0xb831('0x5a'),_0xb831('0x5b'),_0xb831('0x5c'),_0xb831('0x5d'),_0xb831('0x5e'),_0xb831('0x5f'),_0xb831('0x60'),_0xb831('0x61')]})['then'](handleEntityNotFound(_0x422570,null))[_0xb831('0x26')](function(_0x3ed8ac){if(_0x3ed8ac){_0x12d733=_0x3ed8ac[_0xb831('0x5a')];var _0x56ef03=_0x12d733['slice'](-0x1);if(_0x56ef03==='/'){_0x12d733=_0x12d733[_0xb831('0x62')](0x0,_0x12d733[_0xb831('0x63')](_0x56ef03));}var _0x1e0d7c={'method':_0xb831('0x64'),'uri':util[_0xb831('0x65')](_0xb831('0x66'),_0x12d733),'headers':{'Content-Type':_0xb831('0x67'),'Accept':_0xb831('0x67')},'json':!![]};if(_0x3ed8ac[_0xb831('0x5b')]===_0xb831('0x68')){_0x1e0d7c[_0xb831('0x69')][_0xb831('0x6a')]=util[_0xb831('0x65')](_0xb831('0x6b'),new Buffer(util[_0xb831('0x65')]('%s:%s',_0x3ed8ac[_0xb831('0x5c')],_0x3ed8ac[_0xb831('0x5d')]))[_0xb831('0x6c')](_0xb831('0x6d')));}return rp(_0x1e0d7c)[_0xb831('0x26')](function(_0x1cb455){return _0x2b39ee[_0xb831('0x6e')](_[_0xb831('0x2b')](_0x1cb455[_0xb831('0x6f')]['entries'],function(_0x3e7b5b){return{'id':_0x3e7b5b[_0xb831('0x29')],'name':_0x3e7b5b[_0xb831('0x29')],'type':_0x3e7b5b[_0xb831('0x2f')],'active':_0x3e7b5b[_0xb831('0x70')],'label':_0x3e7b5b['label'],'custom':!![]};}));});}})[_0xb831('0x26')](function(_0x235c6e){return{'count':_0x235c6e[_0xb831('0x36')],'rows':_0x235c6e};})[_0xb831('0x26')](respondWithResult(_0x422570,null))[_0xb831('0x45')](function(_0x413dfb){var _0x56b60e=_0x5265b2[_0xb831('0x31')][_0xb831('0x71')]?0x1f4:_0x413dfb[_0xb831('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb831('0x58'),_0x56b60e,JSON[_0xb831('0x73')](_0x413dfb));delete _0x413dfb[_0xb831('0x29')];if(_0x56b60e===0x191){_0x56b60e=0x190;}_0x422570[_0xb831('0x1c')](_0x56b60e)[_0xb831('0x74')](_0x5265b2[_0xb831('0x31')][_0xb831('0x71')]?{'message':_0xb831('0x75'),'statusCode':_0x413dfb[_0xb831('0x72')]}:_0x413dfb);});}; \ No newline at end of file +var _0x0a51=['toString','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','merge','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','DeskConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Authorization','Basic\x20%s','%s:%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a51,0x78));var _0x10a5=function(_0x4cee0b,_0x564971){_0x4cee0b=_0x4cee0b-0x0;var _0x5eaa06=_0x0a51[_0x4cee0b];return _0x5eaa06;};'use strict';var emlformat=require(_0x10a5('0x0'));var rimraf=require(_0x10a5('0x1'));var zipdir=require(_0x10a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10a5('0x3'));var moment=require(_0x10a5('0x4'));var BPromise=require(_0x10a5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x10a5('0x6'));var sox=require('sox');var csv=require(_0x10a5('0x7'));var ejs=require(_0x10a5('0x8'));var fs=require('fs');var fs_extra=require(_0x10a5('0x9'));var _=require(_0x10a5('0xa'));var squel=require('squel');var crypto=require(_0x10a5('0xb'));var jsforce=require(_0x10a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x10a5('0x7'));var querystring=require(_0x10a5('0xd'));var Papa=require('papaparse');var Redis=require(_0x10a5('0xe'));var authService=require(_0x10a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x10a5('0x10'));var hardwareService=require(_0x10a5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x10a5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x10a5('0x13'));var db=require(_0x10a5('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x48a8a0,_0xb11474){_0xb11474=_0xb11474||0xcc;return function(_0x20f286){if(_0x20f286){return _0x48a8a0[_0x10a5('0x15')](_0xb11474);}return _0x48a8a0[_0x10a5('0x16')](_0xb11474)[_0x10a5('0x17')]();};}function respondWithResult(_0x4f55af,_0x431cd1){_0x431cd1=_0x431cd1||0xc8;return function(_0x57473f){if(_0x57473f){return _0x4f55af[_0x10a5('0x16')](_0x431cd1)[_0x10a5('0x18')](_0x57473f);}};}function respondWithFilteredResult(_0x5ea308,_0x51edc9){return function(_0x4947cf){if(_0x4947cf){var _0x534db0=typeof _0x51edc9[_0x10a5('0x19')]==='undefined'&&typeof _0x51edc9[_0x10a5('0x1a')]===_0x10a5('0x1b');var _0x947443=_0x4947cf['count'];var _0x294599=_0x534db0?0x0:_0x51edc9[_0x10a5('0x19')];var _0x38462e=_0x534db0?_0x4947cf[_0x10a5('0x1c')]:_0x51edc9[_0x10a5('0x19')]+_0x51edc9[_0x10a5('0x1a')];var _0x371cc7;if(_0x38462e>=_0x947443){_0x38462e=_0x947443;_0x371cc7=0xc8;}else{_0x371cc7=0xce;}_0x5ea308[_0x10a5('0x16')](_0x371cc7);return _0x5ea308[_0x10a5('0x1d')]('Content-Range',_0x294599+'-'+_0x38462e+'/'+_0x947443)[_0x10a5('0x18')](_0x4947cf);}return null;};}function patchUpdates(_0x43dd56){return function(_0x4027c8){try{jsonpatch[_0x10a5('0x1e')](_0x4027c8,_0x43dd56,!![]);}catch(_0x18193d){return BPromise[_0x10a5('0x1f')](_0x18193d);}return _0x4027c8['save']();};}function saveUpdates(_0x1b569f,_0x53d0fb){return function(_0x5d840b){if(_0x5d840b){return _0x5d840b[_0x10a5('0x20')](_0x1b569f)[_0x10a5('0x21')](function(_0x1e9f30){return _0x1e9f30;});}return null;};}function removeEntity(_0x5a953b,_0x519630){return function(_0x3e1862){if(_0x3e1862){return _0x3e1862[_0x10a5('0x22')]()[_0x10a5('0x21')](function(){_0x5a953b[_0x10a5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b142,_0x57142b){return function(_0x55e701){if(!_0x55e701){_0x19b142[_0x10a5('0x15')](0x194);}return _0x55e701;};}function handleError(_0x1a493f,_0x4dae58){_0x4dae58=_0x4dae58||0x1f4;return function(_0x28b941){logger[_0x10a5('0x23')](_0x28b941[_0x10a5('0x24')]);if(_0x28b941['name']){delete _0x28b941[_0x10a5('0x25')];}_0x1a493f[_0x10a5('0x16')](_0x4dae58)[_0x10a5('0x26')](_0x28b941);};}exports['index']=function(_0x17919d,_0x48a064){var _0x47e8ce={},_0x5ccacf={},_0x266425={'count':0x0,'rows':[]};var _0x11c91c=_['map'](db['DeskAccount'][_0x10a5('0x27')],function(_0x2ac49c){return{'name':_0x2ac49c[_0x10a5('0x28')],'type':_0x2ac49c['type'][_0x10a5('0x29')]};});_0x5ccacf[_0x10a5('0x2a')]=_[_0x10a5('0x2b')](_0x11c91c,_0x10a5('0x25'));_0x5ccacf['query']=_[_0x10a5('0x2c')](_0x17919d[_0x10a5('0x2d')]);_0x5ccacf[_0x10a5('0x2e')]=_['intersection'](_0x5ccacf['model'],_0x5ccacf['query']);_0x47e8ce['attributes']=_['intersection'](_0x5ccacf[_0x10a5('0x2a')],qs[_0x10a5('0x2f')](_0x17919d[_0x10a5('0x2d')][_0x10a5('0x2f')]));_0x47e8ce[_0x10a5('0x30')]=_0x47e8ce[_0x10a5('0x30')]['length']?_0x47e8ce[_0x10a5('0x30')]:_0x5ccacf[_0x10a5('0x2a')];if(!_0x17919d[_0x10a5('0x2d')][_0x10a5('0x31')](_0x10a5('0x32'))){_0x47e8ce[_0x10a5('0x1a')]=qs['limit'](_0x17919d[_0x10a5('0x2d')]['limit']);_0x47e8ce[_0x10a5('0x19')]=qs[_0x10a5('0x19')](_0x17919d[_0x10a5('0x2d')][_0x10a5('0x19')]);}_0x47e8ce['order']=qs['sort'](_0x17919d[_0x10a5('0x2d')][_0x10a5('0x33')]);_0x47e8ce['where']=qs['filters'](_['pick'](_0x17919d[_0x10a5('0x2d')],_0x5ccacf['filters']),_0x11c91c);if(_0x17919d[_0x10a5('0x2d')][_0x10a5('0x34')]){_0x47e8ce['where']=_['merge'](_0x47e8ce[_0x10a5('0x35')],{'$or':_[_0x10a5('0x2b')](_0x11c91c,function(_0x100936){if(_0x100936[_0x10a5('0x36')]!==_0x10a5('0x37')){var _0x10d093={};_0x10d093[_0x100936['name']]={'$like':'%'+_0x17919d[_0x10a5('0x2d')][_0x10a5('0x34')]+'%'};return _0x10d093;}})});}_0x47e8ce=_[_0x10a5('0x38')]({},_0x47e8ce,_0x17919d[_0x10a5('0x39')]);var _0x35e895={'where':_0x47e8ce[_0x10a5('0x35')]};return db[_0x10a5('0x3a')][_0x10a5('0x1c')](_0x35e895)[_0x10a5('0x21')](function(_0x252a1c){_0x266425[_0x10a5('0x1c')]=_0x252a1c;if(_0x17919d['query'][_0x10a5('0x3b')]){_0x47e8ce[_0x10a5('0x3c')]=[{'all':!![]}];}return db[_0x10a5('0x3a')][_0x10a5('0x3d')](_0x47e8ce);})[_0x10a5('0x21')](function(_0xcbc1e0){_0x266425[_0x10a5('0x3e')]=_0xcbc1e0;return _0x266425;})[_0x10a5('0x21')](respondWithFilteredResult(_0x48a064,_0x47e8ce))[_0x10a5('0x3f')](handleError(_0x48a064,null));};exports[_0x10a5('0x40')]=function(_0x4e07d3,_0x5dd09b){var _0x4e3b19={'raw':![],'where':{'id':_0x4e07d3[_0x10a5('0x41')]['id']}},_0x49fd72={};_0x49fd72['model']=_[_0x10a5('0x2c')](db[_0x10a5('0x3a')][_0x10a5('0x27')]);_0x49fd72[_0x10a5('0x2d')]=_[_0x10a5('0x2c')](_0x4e07d3['query']);_0x49fd72[_0x10a5('0x2e')]=_[_0x10a5('0x42')](_0x49fd72['model'],_0x49fd72[_0x10a5('0x2d')]);_0x4e3b19[_0x10a5('0x30')]=_['intersection'](_0x49fd72[_0x10a5('0x2a')],qs[_0x10a5('0x2f')](_0x4e07d3[_0x10a5('0x2d')][_0x10a5('0x2f')]));_0x4e3b19[_0x10a5('0x30')]=_0x4e3b19[_0x10a5('0x30')][_0x10a5('0x43')]?_0x4e3b19[_0x10a5('0x30')]:_0x49fd72['model'];if(_0x4e07d3[_0x10a5('0x2d')]['includeAll']){_0x4e3b19[_0x10a5('0x3c')]=[{'all':!![]}];}_0x4e3b19=_[_0x10a5('0x38')]({},_0x4e3b19,_0x4e07d3['options']);return db[_0x10a5('0x3a')][_0x10a5('0x44')](_0x4e3b19)[_0x10a5('0x21')](handleEntityNotFound(_0x5dd09b,null))[_0x10a5('0x21')](respondWithResult(_0x5dd09b,null))[_0x10a5('0x3f')](handleError(_0x5dd09b,null));};exports[_0x10a5('0x45')]=function(_0x3119a3,_0x16b473){return db['DeskAccount']['create'](_0x3119a3[_0x10a5('0x46')],{})[_0x10a5('0x21')](respondWithResult(_0x16b473,0xc9))[_0x10a5('0x3f')](handleError(_0x16b473,null));};exports[_0x10a5('0x20')]=function(_0x5af255,_0x1bfba4){if(_0x5af255[_0x10a5('0x46')]['id']){delete _0x5af255[_0x10a5('0x46')]['id'];}return db['DeskAccount'][_0x10a5('0x44')]({'where':{'id':_0x5af255['params']['id']}})[_0x10a5('0x21')](handleEntityNotFound(_0x1bfba4,null))[_0x10a5('0x21')](saveUpdates(_0x5af255['body'],null))['then'](respondWithResult(_0x1bfba4,null))[_0x10a5('0x3f')](handleError(_0x1bfba4,null));};exports[_0x10a5('0x22')]=function(_0x35f433,_0x197810){return db['DeskAccount'][_0x10a5('0x44')]({'where':{'id':_0x35f433[_0x10a5('0x41')]['id']}})[_0x10a5('0x21')](handleEntityNotFound(_0x197810,null))['then'](removeEntity(_0x197810,null))[_0x10a5('0x3f')](handleError(_0x197810,null));};exports['getConfigurations']=function(_0x5dca4e,_0x16d9f1,_0x2fa121){var _0x104106={};var _0x4cd2a5={};var _0x5591e3;var _0x1fab72;return db['DeskAccount']['findOne']({'where':{'id':_0x5dca4e[_0x10a5('0x41')]['id']}})[_0x10a5('0x21')](handleEntityNotFound(_0x16d9f1,null))[_0x10a5('0x21')](function(_0xb85fa2){if(_0xb85fa2){_0x5591e3=_0xb85fa2;_0x4cd2a5[_0x10a5('0x2a')]=_[_0x10a5('0x2c')](db[_0x10a5('0x47')][_0x10a5('0x27')]);_0x4cd2a5[_0x10a5('0x2d')]=_[_0x10a5('0x2c')](_0x5dca4e[_0x10a5('0x2d')]);_0x4cd2a5[_0x10a5('0x2e')]=_['intersection'](_0x4cd2a5[_0x10a5('0x2a')],_0x4cd2a5[_0x10a5('0x2d')]);_0x104106[_0x10a5('0x30')]=_['intersection'](_0x4cd2a5['model'],qs[_0x10a5('0x2f')](_0x5dca4e[_0x10a5('0x2d')][_0x10a5('0x2f')]));_0x104106[_0x10a5('0x30')]=_0x104106[_0x10a5('0x30')][_0x10a5('0x43')]?_0x104106[_0x10a5('0x30')]:_0x4cd2a5[_0x10a5('0x2a')];_0x104106[_0x10a5('0x48')]=qs['sort'](_0x5dca4e[_0x10a5('0x2d')][_0x10a5('0x33')]);_0x104106[_0x10a5('0x35')]=qs[_0x10a5('0x2e')](_['pick'](_0x5dca4e['query'],_0x4cd2a5['filters']));if(_0x5dca4e['query'][_0x10a5('0x34')]){_0x104106['where']=_['merge'](_0x104106[_0x10a5('0x35')],{'$or':_[_0x10a5('0x2b')](_0x104106[_0x10a5('0x30')],function(_0x10bc02){var _0x35f8fd={};_0x35f8fd[_0x10bc02]={'$like':'%'+_0x5dca4e[_0x10a5('0x2d')]['filter']+'%'};return _0x35f8fd;})});}_0x104106=_[_0x10a5('0x38')]({},_0x104106,_0x5dca4e[_0x10a5('0x39')]);return _0x5591e3['getConfigurations'](_0x104106);}})[_0x10a5('0x21')](function(_0x1bfa2d){if(_0x1bfa2d){_0x1fab72=_0x1bfa2d[_0x10a5('0x43')];if(!_0x5dca4e[_0x10a5('0x2d')][_0x10a5('0x31')](_0x10a5('0x32'))){_0x104106[_0x10a5('0x1a')]=qs[_0x10a5('0x1a')](_0x5dca4e[_0x10a5('0x2d')][_0x10a5('0x1a')]);_0x104106[_0x10a5('0x19')]=qs[_0x10a5('0x19')](_0x5dca4e['query'][_0x10a5('0x19')]);}return _0x5591e3[_0x10a5('0x49')](_0x104106);}})[_0x10a5('0x21')](function(_0x397965){if(_0x397965){return _0x397965?{'count':_0x1fab72,'rows':_0x397965}:null;}})[_0x10a5('0x21')](respondWithResult(_0x16d9f1,null))[_0x10a5('0x3f')](handleError(_0x16d9f1,null));};exports['addConfiguration']=function(_0x5f5be4,_0x352d41,_0x2b0984){if(_0x5f5be4['body']['id']){delete _0x5f5be4[_0x10a5('0x46')]['id'];}return db[_0x10a5('0x3a')]['findOne']({'where':{'id':_0x5f5be4[_0x10a5('0x41')]['id']}})[_0x10a5('0x21')](handleEntityNotFound(_0x352d41,null))[_0x10a5('0x21')](function(_0x51d802){if(_0x51d802){_0x5f5be4['body'][_0x10a5('0x4a')]=_0x51d802['id'];_0x5f5be4['body'][_0x10a5('0x4b')]=integrations[_0x10a5('0x4c')](_0x5f5be4[_0x10a5('0x46')][_0x10a5('0x4d')],_0x5f5be4[_0x10a5('0x46')][_0x10a5('0x36')]);_0x5f5be4[_0x10a5('0x46')][_0x10a5('0x4e')]=integrations[_0x10a5('0x4f')](_0x5f5be4['body'][_0x10a5('0x4d')],_0x5f5be4[_0x10a5('0x46')][_0x10a5('0x36')]);return db[_0x10a5('0x47')][_0x10a5('0x45')](_0x5f5be4[_0x10a5('0x46')],{'include':[{'model':db['DeskField'],'as':_0x10a5('0x4b')},{'model':db['DeskField'],'as':_0x10a5('0x4e')}]});}return null;})[_0x10a5('0x21')](respondWithResult(_0x352d41,null))[_0x10a5('0x3f')](handleError(_0x352d41,null));};exports[_0x10a5('0x50')]=function(_0x15022f,_0x57c2f9,_0x35ff94){var _0x37cf5e=[{'name':'priority','label':_0x10a5('0x51'),'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 _0x7799ad='';return db['DeskAccount'][_0x10a5('0x52')]({'where':{'id':_0x15022f[_0x10a5('0x41')]['id']},'attributes':['id',_0x10a5('0x53'),_0x10a5('0x54'),'username',_0x10a5('0x55'),_0x10a5('0x56'),_0x10a5('0x57'),_0x10a5('0x58'),_0x10a5('0x59')]})[_0x10a5('0x21')](handleEntityNotFound(_0x57c2f9,null))['then'](function(_0x3f574d){if(_0x3f574d){_0x7799ad=_0x3f574d[_0x10a5('0x53')];var _0x18ec8c=_0x7799ad[_0x10a5('0x5a')](-0x1);if(_0x18ec8c==='/'){_0x7799ad=_0x7799ad['substring'](0x0,_0x7799ad[_0x10a5('0x5b')](_0x18ec8c));}var _0x168002={'method':_0x10a5('0x5c'),'uri':util[_0x10a5('0x5d')](_0x10a5('0x5e'),_0x7799ad),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3f574d[_0x10a5('0x54')]===_0x10a5('0x5f')){_0x168002[_0x10a5('0x60')][_0x10a5('0x61')]=util[_0x10a5('0x5d')](_0x10a5('0x62'),new Buffer(util[_0x10a5('0x5d')](_0x10a5('0x63'),_0x3f574d['username'],_0x3f574d[_0x10a5('0x55')]))[_0x10a5('0x64')]('base64'));}return rp(_0x168002)['then'](function(_0x35e21f){return _0x37cf5e['concat'](_['map'](_0x35e21f[_0x10a5('0x65')][_0x10a5('0x66')],function(_0x2140fc){return{'id':_0x2140fc['name'],'name':_0x2140fc[_0x10a5('0x25')],'type':_0x2140fc[_0x10a5('0x36')],'active':_0x2140fc[_0x10a5('0x67')],'label':_0x2140fc[_0x10a5('0x68')],'custom':!![]};}));});}})[_0x10a5('0x21')](function(_0x2bd304){return{'count':_0x2bd304['length'],'rows':_0x2bd304};})[_0x10a5('0x21')](respondWithResult(_0x57c2f9,null))[_0x10a5('0x3f')](function(_0x570c3e){var _0x3062d2=_0x15022f[_0x10a5('0x2d')][_0x10a5('0x69')]?0x1f4:_0x570c3e['statusCode']||0x1f4;logger[_0x10a5('0x23')](_0x10a5('0x6a'),_0x10a5('0x50'),_0x3062d2,JSON[_0x10a5('0x6b')](_0x570c3e));delete _0x570c3e[_0x10a5('0x25')];if(_0x3062d2===0x191){_0x3062d2=0x190;}_0x57c2f9[_0x10a5('0x16')](_0x3062d2)[_0x10a5('0x26')](_0x15022f[_0x10a5('0x2d')][_0x10a5('0x69')]?{'message':_0x10a5('0x6c'),'statusCode':_0x570c3e[_0x10a5('0x6d')]}:_0x570c3e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 40cf6a1..42631a4 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 _0xd1d3=['DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xd1d3,0xec));var _0x3d1d=function(_0x399925,_0x581887){_0x399925=_0x399925-0x0;var _0x31a04e=_0xd1d3[_0x399925];return _0x31a04e;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var logger=require(_0x3d1d('0x1'))(_0x3d1d('0x2'));var moment=require('moment');var BPromise=require(_0x3d1d('0x3'));var rp=require(_0x3d1d('0x4'));var fs=require('fs');var path=require(_0x3d1d('0x5'));var rimraf=require(_0x3d1d('0x6'));var config=require(_0x3d1d('0x7'));var attributes=require(_0x3d1d('0x8'));var integrations=require(_0x3d1d('0x9'));module[_0x3d1d('0xa')]=function(_0x274f0,_0x5c0b5f){return _0x274f0['define'](_0x3d1d('0xb'),attributes,{'tableName':_0x3d1d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f6e=['define','DeskAccount','int_desk_accounts','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0x7f6e,0x16b));var _0xe7f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7f6e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xe7f6('0x0'));var logger=require(_0xe7f6('0x1'))(_0xe7f6('0x2'));var moment=require('moment');var BPromise=require(_0xe7f6('0x3'));var rp=require(_0xe7f6('0x4'));var fs=require('fs');var path=require(_0xe7f6('0x5'));var rimraf=require('rimraf');var config=require(_0xe7f6('0x6'));var attributes=require(_0xe7f6('0x7'));var integrations=require(_0xe7f6('0x8'));module['exports']=function(_0x292625,_0x4ae10b){return _0x292625[_0xe7f6('0x9')](_0xe7f6('0xa'),attributes,{'tableName':_0xe7f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 0e1ff37..8639458 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 _0x200e=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x2e7aa8,_0x2c6c40){var _0x13ec84=function(_0x30d511){while(--_0x30d511){_0x2e7aa8['push'](_0x2e7aa8['shift']());}};_0x13ec84(++_0x2c6c40);}(_0x200e,0xee));var _0xe200=function(_0x30674b,_0x271742){_0x30674b=_0x30674b-0x0;var _0x5e2ddd=_0x200e[_0x30674b];return _0x5e2ddd;};'use strict';var _=require(_0xe200('0x0'));var util=require(_0xe200('0x1'));var moment=require(_0xe200('0x2'));var BPromise=require(_0xe200('0x3'));var rs=require(_0xe200('0x4'));var fs=require('fs');var Redis=require(_0xe200('0x5'));var db=require(_0xe200('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe200('0x7'));var config=require(_0xe200('0x8'));var jayson=require(_0xe200('0x9'));var client=jayson['client'][_0xe200('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46e692,_0xf77eca,_0x525339){return new BPromise(function(_0x302a25,_0x49fb39){return client['request'](_0x46e692,_0x525339)[_0xe200('0xb')](function(_0x4ff405){logger[_0xe200('0xc')](_0xe200('0xd'),_0xf77eca,_0xe200('0xe'));logger[_0xe200('0xf')](_0xe200('0x10'),_0xf77eca,'request\x20sent',JSON[_0xe200('0x11')](_0x4ff405));if(_0x4ff405['error']){if(_0x4ff405[_0xe200('0x12')][_0xe200('0x13')]===0x1f4){logger[_0xe200('0x12')]('DeskAccount,\x20%s,\x20%s',_0xf77eca,_0x4ff405[_0xe200('0x12')][_0xe200('0x14')]);return _0x49fb39(_0x4ff405[_0xe200('0x12')][_0xe200('0x14')]);}logger[_0xe200('0x12')]('DeskAccount,\x20%s,\x20%s',_0xf77eca,_0x4ff405['error'][_0xe200('0x14')]);return _0x302a25(_0x4ff405['error'][_0xe200('0x14')]);}else{logger[_0xe200('0xc')](_0xe200('0xd'),_0xf77eca,_0xe200('0xe'));_0x302a25(_0x4ff405[_0xe200('0x15')][_0xe200('0x14')]);}})['catch'](function(_0x5f0cc0){logger[_0xe200('0x12')](_0xe200('0xd'),_0xf77eca,_0x5f0cc0);_0x49fb39(_0x5f0cc0);});});}exports[_0xe200('0x16')]=function(_0x300461){var _0x182fce=this;return new Promise(function(_0x166f9c,_0x16a7ed){return db[_0xe200('0x17')][_0xe200('0x18')]({'raw':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1a')]===undefined?!![]:![]:!![],'where':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1b')]||null:null,'attributes':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1c')]||null:null,'limit':_0x300461[_0xe200('0x19')]?_0x300461[_0xe200('0x19')][_0xe200('0x1d')]||null:null,'include':_0x300461['options']?_0x300461[_0xe200('0x19')][_0xe200('0x1e')]?_['map'](_0x300461[_0xe200('0x19')]['include'],function(_0x4a451c){return{'model':db[_0x4a451c[_0xe200('0x1f')]],'as':_0x4a451c['as'],'attributes':_0x4a451c[_0xe200('0x1c')],'include':_0x4a451c[_0xe200('0x1e')]?_['map'](_0x4a451c[_0xe200('0x1e')],function(_0x45be08){return{'model':db[_0x45be08[_0xe200('0x1f')]],'as':_0x45be08['as'],'attributes':_0x45be08[_0xe200('0x1c')],'include':_0x45be08[_0xe200('0x1e')]?_[_0xe200('0x20')](_0x45be08[_0xe200('0x1e')],function(_0x10a35e){return{'model':db[_0x10a35e[_0xe200('0x1f')]],'as':_0x10a35e['as'],'attributes':_0x10a35e[_0xe200('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe200('0xb')](function(_0x21c1ad){logger[_0xe200('0xc')](_0xe200('0x16'),_0x300461);logger['debug'](_0xe200('0x16'),_0x300461,JSON[_0xe200('0x11')](_0x21c1ad));_0x166f9c(_0x21c1ad);})[_0xe200('0x21')](function(_0x31ecdf){logger[_0xe200('0x12')]('GetDeskAccount',_0x31ecdf[_0xe200('0x14')],_0x300461);_0x16a7ed(_0x182fce[_0xe200('0x12')](0x1f4,_0x31ecdf[_0xe200('0x14')]));});});};exports['ShowDeskAccount']=function(_0x1b669e){var _0x439272=this;return new Promise(function(_0x146056,_0x78109d){return db[_0xe200('0x17')][_0xe200('0x22')]({'raw':_0x1b669e[_0xe200('0x19')]?_0x1b669e['options'][_0xe200('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1b')]||null:null,'attributes':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1c')]||null:null,'include':_0x1b669e[_0xe200('0x19')]?_0x1b669e[_0xe200('0x19')][_0xe200('0x1e')]?_[_0xe200('0x20')](_0x1b669e[_0xe200('0x19')]['include'],function(_0x2efe7e){return{'model':db[_0x2efe7e[_0xe200('0x1f')]],'as':_0x2efe7e['as'],'attributes':_0x2efe7e[_0xe200('0x1c')],'include':_0x2efe7e[_0xe200('0x1e')]?_[_0xe200('0x20')](_0x2efe7e[_0xe200('0x1e')],function(_0x3915b3){return{'model':db[_0x3915b3['model']],'as':_0x3915b3['as'],'attributes':_0x3915b3[_0xe200('0x1c')],'include':_0x3915b3[_0xe200('0x1e')]?_['map'](_0x3915b3[_0xe200('0x1e')],function(_0x3b6846){return{'model':db[_0x3b6846[_0xe200('0x1f')]],'as':_0x3b6846['as'],'attributes':_0x3b6846[_0xe200('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe200('0xb')](function(_0x4076cc){logger['info'](_0xe200('0x23'),_0x1b669e);logger[_0xe200('0xf')](_0xe200('0x23'),_0x1b669e,JSON[_0xe200('0x11')](_0x4076cc));_0x146056(_0x4076cc);})[_0xe200('0x21')](function(_0x38c8c1){logger[_0xe200('0x12')](_0xe200('0x23'),_0x38c8c1['message'],_0x1b669e);_0x78109d(_0x439272[_0xe200('0x12')](0x1f4,_0x38c8c1[_0xe200('0x14')]));});});}; \ No newline at end of file +var _0xf971=['result','DeskAccount,\x20%s,\x20%s','GetDeskAccount','findAll','raw','options','where','attributes','include','map','debug','catch','ShowDeskAccount','DeskAccount','find','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xf971,0xc4));var _0x1f97=function(_0x33e891,_0x56ec2a){_0x33e891=_0x33e891-0x0;var _0x1a2f69=_0xf971[_0x33e891];return _0x1a2f69;};'use strict';var _=require(_0x1f97('0x0'));var util=require(_0x1f97('0x1'));var moment=require(_0x1f97('0x2'));var BPromise=require(_0x1f97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f97('0x4'));var db=require(_0x1f97('0x5'))['db'];var utils=require(_0x1f97('0x6'));var logger=require('../../config/logger')(_0x1f97('0x7'));var config=require(_0x1f97('0x8'));var jayson=require(_0x1f97('0x9'));var client=jayson[_0x1f97('0xa')][_0x1f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a93ff,_0x5d7924,_0x3c3ca7){return new BPromise(function(_0x3d61a8,_0x2d5808){return client['request'](_0x2a93ff,_0x3c3ca7)[_0x1f97('0xc')](function(_0x282fba){logger[_0x1f97('0xd')]('DeskAccount,\x20%s,\x20%s',_0x5d7924,'request\x20sent');logger['debug'](_0x1f97('0xe'),_0x5d7924,'request\x20sent',JSON[_0x1f97('0xf')](_0x282fba));if(_0x282fba[_0x1f97('0x10')]){if(_0x282fba[_0x1f97('0x10')][_0x1f97('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x5d7924,_0x282fba[_0x1f97('0x10')][_0x1f97('0x12')]);return _0x2d5808(_0x282fba[_0x1f97('0x10')][_0x1f97('0x12')]);}logger[_0x1f97('0x10')]('DeskAccount,\x20%s,\x20%s',_0x5d7924,_0x282fba[_0x1f97('0x10')][_0x1f97('0x12')]);return _0x3d61a8(_0x282fba[_0x1f97('0x10')]['message']);}else{logger[_0x1f97('0xd')]('DeskAccount,\x20%s,\x20%s',_0x5d7924,_0x1f97('0x13'));_0x3d61a8(_0x282fba[_0x1f97('0x14')]['message']);}})['catch'](function(_0x2bd20b){logger[_0x1f97('0x10')](_0x1f97('0x15'),_0x5d7924,_0x2bd20b);_0x2d5808(_0x2bd20b);});});}exports[_0x1f97('0x16')]=function(_0xabca7c){var _0x4c7b99=this;return new Promise(function(_0x125f92,_0x63132b){return db['DeskAccount'][_0x1f97('0x17')]({'raw':_0xabca7c['options']?_0xabca7c['options'][_0x1f97('0x18')]===undefined?!![]:![]:!![],'where':_0xabca7c[_0x1f97('0x19')]?_0xabca7c[_0x1f97('0x19')][_0x1f97('0x1a')]||null:null,'attributes':_0xabca7c['options']?_0xabca7c[_0x1f97('0x19')][_0x1f97('0x1b')]||null:null,'limit':_0xabca7c[_0x1f97('0x19')]?_0xabca7c[_0x1f97('0x19')]['limit']||null:null,'include':_0xabca7c['options']?_0xabca7c[_0x1f97('0x19')][_0x1f97('0x1c')]?_['map'](_0xabca7c[_0x1f97('0x19')][_0x1f97('0x1c')],function(_0x14c686){return{'model':db[_0x14c686['model']],'as':_0x14c686['as'],'attributes':_0x14c686[_0x1f97('0x1b')],'include':_0x14c686[_0x1f97('0x1c')]?_[_0x1f97('0x1d')](_0x14c686[_0x1f97('0x1c')],function(_0x14a8a4){return{'model':db[_0x14a8a4['model']],'as':_0x14a8a4['as'],'attributes':_0x14a8a4[_0x1f97('0x1b')],'include':_0x14a8a4[_0x1f97('0x1c')]?_[_0x1f97('0x1d')](_0x14a8a4[_0x1f97('0x1c')],function(_0x4f95f3){return{'model':db[_0x4f95f3['model']],'as':_0x4f95f3['as'],'attributes':_0x4f95f3[_0x1f97('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x438bc4){logger[_0x1f97('0xd')](_0x1f97('0x16'),_0xabca7c);logger[_0x1f97('0x1e')]('GetDeskAccount',_0xabca7c,JSON[_0x1f97('0xf')](_0x438bc4));_0x125f92(_0x438bc4);})[_0x1f97('0x1f')](function(_0xf3500f){logger['error'](_0x1f97('0x16'),_0xf3500f[_0x1f97('0x12')],_0xabca7c);_0x63132b(_0x4c7b99[_0x1f97('0x10')](0x1f4,_0xf3500f[_0x1f97('0x12')]));});});};exports[_0x1f97('0x20')]=function(_0x530eb7){var _0x4b0bff=this;return new Promise(function(_0x7a548f,_0x16a610){return db[_0x1f97('0x21')][_0x1f97('0x22')]({'raw':_0x530eb7[_0x1f97('0x19')]?_0x530eb7[_0x1f97('0x19')][_0x1f97('0x18')]===undefined?!![]:![]:!![],'where':_0x530eb7[_0x1f97('0x19')]?_0x530eb7[_0x1f97('0x19')][_0x1f97('0x1a')]||null:null,'attributes':_0x530eb7[_0x1f97('0x19')]?_0x530eb7[_0x1f97('0x19')][_0x1f97('0x1b')]||null:null,'include':_0x530eb7[_0x1f97('0x19')]?_0x530eb7[_0x1f97('0x19')][_0x1f97('0x1c')]?_['map'](_0x530eb7[_0x1f97('0x19')][_0x1f97('0x1c')],function(_0x2b056d){return{'model':db[_0x2b056d[_0x1f97('0x23')]],'as':_0x2b056d['as'],'attributes':_0x2b056d[_0x1f97('0x1b')],'include':_0x2b056d[_0x1f97('0x1c')]?_[_0x1f97('0x1d')](_0x2b056d[_0x1f97('0x1c')],function(_0x23ed28){return{'model':db[_0x23ed28[_0x1f97('0x23')]],'as':_0x23ed28['as'],'attributes':_0x23ed28['attributes'],'include':_0x23ed28['include']?_[_0x1f97('0x1d')](_0x23ed28['include'],function(_0x517a66){return{'model':db[_0x517a66[_0x1f97('0x23')]],'as':_0x517a66['as'],'attributes':_0x517a66['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f97('0xc')](function(_0x1102a1){logger['info']('ShowDeskAccount',_0x530eb7);logger[_0x1f97('0x1e')](_0x1f97('0x20'),_0x530eb7,JSON[_0x1f97('0xf')](_0x1102a1));_0x7a548f(_0x1102a1);})[_0x1f97('0x1f')](function(_0x2d8300){logger[_0x1f97('0x10')](_0x1f97('0x20'),_0x2d8300[_0x1f97('0x12')],_0x530eb7);_0x16a610(_0x4b0bff[_0x1f97('0x10')](0x1f4,_0x2d8300[_0x1f97('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3243681..53c8590 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x63cea1,_0x2648c1){var _0x18d8d3=function(_0x654746){while(--_0x654746){_0x63cea1['push'](_0x63cea1['shift']());}};_0x18d8d3(++_0x2648c1);}(_0x7217,0x19e));var _0x7721=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7217[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=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(_0xd0c6fc,_0x109022){var _0x4a791a=function(_0x41de07){while(--_0x41de07){_0xd0c6fc['push'](_0xd0c6fc['shift']());}};_0x4a791a(++_0x109022);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f3c12,_0x25213f){_0x2f3c12=_0x2f3c12-0x0;var _0x52f90a=_0xedd9[_0x2f3c12];return _0x52f90a;};'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 2e41585..1033bd0 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 _0x049c=['STRING','sequelize','exports'];(function(_0x4517f2,_0x4a5676){var _0x1bb772=function(_0x529f09){while(--_0x529f09){_0x4517f2['push'](_0x4517f2['shift']());}};_0x1bb772(++_0x4a5676);}(_0x049c,0xa9));var _0xc049=function(_0x127af5,_0xa3ce45){_0x127af5=_0x127af5-0x0;var _0x4cc8dc=_0x049c[_0x127af5];return _0x4cc8dc;};'use strict';var Sequelize=require(_0xc049('0x0'));module[_0xc049('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc049('0x2')]}}; \ No newline at end of file +var _0x2ef2=['STRING','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2ef2,0xef));var _0x22ef=function(_0x4b3413,_0x58c416){_0x4b3413=_0x4b3413-0x0;var _0x3b01ba=_0x2ef2[_0x4b3413];return _0x3b01ba;};'use strict';var Sequelize=require('sequelize');module[_0x22ef('0x0')]={'name':{'type':Sequelize[_0x22ef('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 88350d4..983e8bc 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 _0x6e27=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','apply','reject','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','DeskConfiguration','include','rows','catch','show','params','length','includeAll','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6e27,0x1d1));var _0x76e2=function(_0x490c35,_0x355416){_0x490c35=_0x490c35-0x0;var _0x4343b5=_0x6e27[_0x490c35];return _0x4343b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76e2('0x0'));var zipdir=require(_0x76e2('0x1'));var jsonpatch=require(_0x76e2('0x2'));var rp=require('request-promise');var moment=require(_0x76e2('0x3'));var BPromise=require(_0x76e2('0x4'));var Mustache=require(_0x76e2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x76e2('0x6'));var csv=require('to-csv');var ejs=require(_0x76e2('0x7'));var fs=require('fs');var fs_extra=require(_0x76e2('0x8'));var _=require(_0x76e2('0x9'));var squel=require(_0x76e2('0xa'));var crypto=require('crypto');var jsforce=require(_0x76e2('0xb'));var deskjs=require(_0x76e2('0xc'));var toCsv=require(_0x76e2('0xd'));var querystring=require('querystring');var Papa=require(_0x76e2('0xe'));var Redis=require(_0x76e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x76e2('0x10'));var as=require(_0x76e2('0x11'));var hardwareService=require(_0x76e2('0x12'));var logger=require(_0x76e2('0x13'))(_0x76e2('0x14'));var utils=require(_0x76e2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x76e2('0x16'));var db=require(_0x76e2('0x17'))['db'];function respondWithStatusCode(_0x31278b,_0x556954){_0x556954=_0x556954||0xcc;return function(_0x2c0832){if(_0x2c0832){return _0x31278b['sendStatus'](_0x556954);}return _0x31278b[_0x76e2('0x18')](_0x556954)[_0x76e2('0x19')]();};}function respondWithResult(_0x3f9bfd,_0x404bba){_0x404bba=_0x404bba||0xc8;return function(_0x3050d4){if(_0x3050d4){return _0x3f9bfd['status'](_0x404bba)[_0x76e2('0x1a')](_0x3050d4);}};}function respondWithFilteredResult(_0x20d5f9,_0x4ba491){return function(_0x1836ef){if(_0x1836ef){var _0x168134=typeof _0x4ba491[_0x76e2('0x1b')]==='undefined'&&typeof _0x4ba491['limit']==='undefined';var _0x291344=_0x1836ef[_0x76e2('0x1c')];var _0x3bd236=_0x168134?0x0:_0x4ba491[_0x76e2('0x1b')];var _0x1f8584=_0x168134?_0x1836ef[_0x76e2('0x1c')]:_0x4ba491[_0x76e2('0x1b')]+_0x4ba491[_0x76e2('0x1d')];var _0x1a076c;if(_0x1f8584>=_0x291344){_0x1f8584=_0x291344;_0x1a076c=0xc8;}else{_0x1a076c=0xce;}_0x20d5f9['status'](_0x1a076c);return _0x20d5f9[_0x76e2('0x1e')](_0x76e2('0x1f'),_0x3bd236+'-'+_0x1f8584+'/'+_0x291344)[_0x76e2('0x1a')](_0x1836ef);}return null;};}function patchUpdates(_0x2928b6){return function(_0x4d67ff){try{jsonpatch[_0x76e2('0x20')](_0x4d67ff,_0x2928b6,!![]);}catch(_0x3b19b8){return BPromise[_0x76e2('0x21')](_0x3b19b8);}return _0x4d67ff['save']();};}function saveUpdates(_0x5323b4,_0x461fba){return function(_0x39d9a9){if(_0x39d9a9){return _0x39d9a9['update'](_0x5323b4)['then'](function(_0x590140){return _0x590140;});}return null;};}function removeEntity(_0x5d2952,_0x525bbf){return function(_0x3d95bf){if(_0x3d95bf){return _0x3d95bf[_0x76e2('0x22')]()[_0x76e2('0x23')](function(){_0x5d2952[_0x76e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbf1c8c,_0xdb5faa){return function(_0x4039a9){if(!_0x4039a9){_0xbf1c8c['sendStatus'](0x194);}return _0x4039a9;};}function handleError(_0x7ec15,_0x3c9ca4){_0x3c9ca4=_0x3c9ca4||0x1f4;return function(_0x3db684){logger[_0x76e2('0x24')](_0x3db684[_0x76e2('0x25')]);if(_0x3db684[_0x76e2('0x26')]){delete _0x3db684[_0x76e2('0x26')];}_0x7ec15[_0x76e2('0x18')](_0x3c9ca4)['send'](_0x3db684);};}exports[_0x76e2('0x27')]=function(_0x2c3c9e,_0x2b730c){var _0x3bd84b={},_0x125163={},_0x216b49={'count':0x0,'rows':[]};var _0x3b653c=_['map'](db['DeskConfiguration'][_0x76e2('0x28')],function(_0x5df1b5){return{'name':_0x5df1b5[_0x76e2('0x29')],'type':_0x5df1b5[_0x76e2('0x2a')][_0x76e2('0x2b')]};});_0x125163[_0x76e2('0x2c')]=_[_0x76e2('0x2d')](_0x3b653c,_0x76e2('0x26'));_0x125163[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x2c3c9e[_0x76e2('0x2e')]);_0x125163[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x125163['model'],_0x125163[_0x76e2('0x2e')]);_0x3bd84b['attributes']=_['intersection'](_0x125163[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x3bd84b['attributes']=_0x3bd84b['attributes']['length']?_0x3bd84b[_0x76e2('0x33')]:_0x125163[_0x76e2('0x2c')];if(!_0x2c3c9e['query'][_0x76e2('0x34')]('nolimit')){_0x3bd84b[_0x76e2('0x1d')]=qs['limit'](_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x3bd84b[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x2c3c9e['query'][_0x76e2('0x1b')]);}_0x3bd84b[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x2c3c9e['query'][_0x76e2('0x36')]);_0x3bd84b[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x2c3c9e['query'],_0x125163[_0x76e2('0x30')]),_0x3b653c);if(_0x2c3c9e['query']['filter']){_0x3bd84b[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x3bd84b[_0x76e2('0x37')],{'$or':_['map'](_0x3b653c,function(_0x6227a7){if(_0x6227a7[_0x76e2('0x2a')]!==_0x76e2('0x39')){var _0x6eebd={};_0x6eebd[_0x6227a7['name']]={'$like':'%'+_0x2c3c9e[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x6eebd;}})});}_0x3bd84b=_['merge']({},_0x3bd84b,_0x2c3c9e[_0x76e2('0x3b')]);var _0x426818={'where':_0x3bd84b[_0x76e2('0x37')]};return db[_0x76e2('0x3c')][_0x76e2('0x1c')](_0x426818)['then'](function(_0x4d0452){_0x216b49[_0x76e2('0x1c')]=_0x4d0452;if(_0x2c3c9e[_0x76e2('0x2e')]['includeAll']){_0x3bd84b[_0x76e2('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x3bd84b);})[_0x76e2('0x23')](function(_0x4e2c8c){_0x216b49[_0x76e2('0x3e')]=_0x4e2c8c;return _0x216b49;})[_0x76e2('0x23')](respondWithFilteredResult(_0x2b730c,_0x3bd84b))[_0x76e2('0x3f')](handleError(_0x2b730c,null));};exports[_0x76e2('0x40')]=function(_0x3918a4,_0x8d208a){var _0x4c7c04={'raw':![],'where':{'id':_0x3918a4[_0x76e2('0x41')]['id']}},_0x21ef7f={};_0x21ef7f[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db[_0x76e2('0x3c')]['rawAttributes']);_0x21ef7f[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x3918a4[_0x76e2('0x2e')]);_0x21ef7f['filters']=_[_0x76e2('0x31')](_0x21ef7f[_0x76e2('0x2c')],_0x21ef7f[_0x76e2('0x2e')]);_0x4c7c04['attributes']=_[_0x76e2('0x31')](_0x21ef7f[_0x76e2('0x2c')],qs['fields'](_0x3918a4[_0x76e2('0x2e')]['fields']));_0x4c7c04['attributes']=_0x4c7c04[_0x76e2('0x33')][_0x76e2('0x42')]?_0x4c7c04['attributes']:_0x21ef7f[_0x76e2('0x2c')];if(_0x3918a4[_0x76e2('0x2e')][_0x76e2('0x43')]){_0x4c7c04[_0x76e2('0x3d')]=[{'all':!![]}];}_0x4c7c04=_[_0x76e2('0x38')]({},_0x4c7c04,_0x3918a4[_0x76e2('0x3b')]);return db[_0x76e2('0x3c')][_0x76e2('0x44')](_0x4c7c04)[_0x76e2('0x23')](handleEntityNotFound(_0x8d208a,null))['then'](respondWithResult(_0x8d208a,null))[_0x76e2('0x3f')](handleError(_0x8d208a,null));};exports[_0x76e2('0x45')]=function(_0x2b3c55,_0x1b4b03){return db[_0x76e2('0x3c')][_0x76e2('0x45')](_0x2b3c55[_0x76e2('0x46')],{})[_0x76e2('0x23')](respondWithResult(_0x1b4b03,0xc9))[_0x76e2('0x3f')](handleError(_0x1b4b03,null));};exports['update']=function(_0xb0d6c8,_0x11bbee){if(_0xb0d6c8[_0x76e2('0x46')]['id']){delete _0xb0d6c8[_0x76e2('0x46')]['id'];}return db['DeskConfiguration'][_0x76e2('0x44')]({'where':{'id':_0xb0d6c8[_0x76e2('0x41')]['id']}})['then'](handleEntityNotFound(_0x11bbee,null))[_0x76e2('0x23')](saveUpdates(_0xb0d6c8[_0x76e2('0x46')],null))[_0x76e2('0x23')](respondWithResult(_0x11bbee,null))['catch'](handleError(_0x11bbee,null));};exports[_0x76e2('0x22')]=function(_0x4c37c4,_0x1b0c55){return db[_0x76e2('0x3c')][_0x76e2('0x44')]({'where':{'id':_0x4c37c4[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x1b0c55,null))[_0x76e2('0x23')](removeEntity(_0x1b0c55,null))[_0x76e2('0x3f')](handleError(_0x1b0c55,null));};exports[_0x76e2('0x47')]=function(_0x592911,_0x188d44,_0x4704fd){var _0x40330f={};var _0x3acb46={};var _0xbcf50;var _0x3e0cc1;return db[_0x76e2('0x3c')][_0x76e2('0x48')]({'where':{'id':_0x592911[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x188d44,null))[_0x76e2('0x23')](function(_0x15a7b8){if(_0x15a7b8){_0xbcf50=_0x15a7b8;_0x3acb46[_0x76e2('0x2c')]=_['keys'](db[_0x76e2('0x49')]['rawAttributes']);_0x3acb46[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x592911[_0x76e2('0x2e')]);_0x3acb46[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x3acb46[_0x76e2('0x2c')],_0x3acb46[_0x76e2('0x2e')]);_0x40330f[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x3acb46['model'],qs['fields'](_0x592911[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x40330f['attributes']=_0x40330f[_0x76e2('0x33')][_0x76e2('0x42')]?_0x40330f[_0x76e2('0x33')]:_0x3acb46['model'];_0x40330f[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x36')]);_0x40330f[_0x76e2('0x37')]=qs['filters'](_['pick'](_0x592911[_0x76e2('0x2e')],_0x3acb46[_0x76e2('0x30')]));if(_0x592911[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x40330f[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x40330f[_0x76e2('0x37')],{'$or':_['map'](_0x40330f[_0x76e2('0x33')],function(_0x96aa30){var _0x56d7a9={};_0x56d7a9[_0x96aa30]={'$like':'%'+_0x592911[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x56d7a9;})});}_0x40330f=_[_0x76e2('0x38')]({},_0x40330f,_0x592911[_0x76e2('0x3b')]);return _0xbcf50[_0x76e2('0x47')](_0x40330f);}})[_0x76e2('0x23')](function(_0x2359b3){if(_0x2359b3){_0x3e0cc1=_0x2359b3['length'];if(!_0x592911[_0x76e2('0x2e')][_0x76e2('0x34')](_0x76e2('0x4a'))){_0x40330f[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x40330f['offset']=qs[_0x76e2('0x1b')](_0x592911[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0xbcf50['getFields'](_0x40330f);}})[_0x76e2('0x23')](function(_0xa550da){if(_0xa550da){return _0xa550da?{'count':_0x3e0cc1,'rows':_0xa550da}:null;}})[_0x76e2('0x23')](respondWithResult(_0x188d44,null))['catch'](handleError(_0x188d44,null));};exports[_0x76e2('0x4b')]=function(_0x55a67a,_0x549b91,_0x9d59f5){var _0x4c4d03={};var _0x4915a1={};var _0x22b4a8;var _0x555362;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x55a67a[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x549b91,null))['then'](function(_0x226147){if(_0x226147){_0x22b4a8=_0x226147;_0x4915a1[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db['DeskField'][_0x76e2('0x28')]);_0x4915a1[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x55a67a['query']);_0x4915a1['filters']=_[_0x76e2('0x31')](_0x4915a1[_0x76e2('0x2c')],_0x4915a1[_0x76e2('0x2e')]);_0x4c4d03[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x4915a1[_0x76e2('0x2c')],qs['fields'](_0x55a67a['query'][_0x76e2('0x32')]));_0x4c4d03['attributes']=_0x4c4d03[_0x76e2('0x33')][_0x76e2('0x42')]?_0x4c4d03[_0x76e2('0x33')]:_0x4915a1[_0x76e2('0x2c')];_0x4c4d03[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x55a67a[_0x76e2('0x2e')]['sort']);_0x4c4d03[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x55a67a[_0x76e2('0x2e')],_0x4915a1[_0x76e2('0x30')]));if(_0x55a67a['query'][_0x76e2('0x3a')]){_0x4c4d03[_0x76e2('0x37')]=_[_0x76e2('0x38')](_0x4c4d03[_0x76e2('0x37')],{'$or':_[_0x76e2('0x2d')](_0x4c4d03[_0x76e2('0x33')],function(_0x3ac89f){var _0x42d4da={};_0x42d4da[_0x3ac89f]={'$like':'%'+_0x55a67a[_0x76e2('0x2e')]['filter']+'%'};return _0x42d4da;})});}_0x4c4d03=_['merge']({},_0x4c4d03,_0x55a67a[_0x76e2('0x3b')]);return _0x22b4a8[_0x76e2('0x4b')](_0x4c4d03);}})['then'](function(_0x2709b3){if(_0x2709b3){_0x555362=_0x2709b3['length'];if(!_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x34')]('nolimit')){_0x4c4d03['limit']=qs[_0x76e2('0x1d')](_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x4c4d03[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x55a67a[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0x22b4a8[_0x76e2('0x4b')](_0x4c4d03);}})[_0x76e2('0x23')](function(_0xfc307a){if(_0xfc307a){return _0xfc307a?{'count':_0x555362,'rows':_0xfc307a}:null;}})[_0x76e2('0x23')](respondWithResult(_0x549b91,null))['catch'](handleError(_0x549b91,null));};exports[_0x76e2('0x4c')]=function(_0x4bc267,_0x1a55b3,_0x15379a){var _0x54eacf={};var _0x2dd907={};var _0x48d43a;var _0x1ef4b1;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x4bc267[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x1a55b3,null))[_0x76e2('0x23')](function(_0x44b158){if(_0x44b158){_0x48d43a=_0x44b158;_0x2dd907['model']=_[_0x76e2('0x2f')](db[_0x76e2('0x49')][_0x76e2('0x28')]);_0x2dd907[_0x76e2('0x2e')]=_['keys'](_0x4bc267['query']);_0x2dd907['filters']=_[_0x76e2('0x31')](_0x2dd907[_0x76e2('0x2c')],_0x2dd907[_0x76e2('0x2e')]);_0x54eacf[_0x76e2('0x33')]=_[_0x76e2('0x31')](_0x2dd907[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x32')]));_0x54eacf['attributes']=_0x54eacf[_0x76e2('0x33')][_0x76e2('0x42')]?_0x54eacf[_0x76e2('0x33')]:_0x2dd907[_0x76e2('0x2c')];_0x54eacf[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x4bc267['query']['sort']);_0x54eacf[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x4bc267['query'],_0x2dd907[_0x76e2('0x30')]));if(_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x54eacf[_0x76e2('0x37')]=_['merge'](_0x54eacf['where'],{'$or':_[_0x76e2('0x2d')](_0x54eacf[_0x76e2('0x33')],function(_0x1fd111){var _0x1a2458={};_0x1a2458[_0x1fd111]={'$like':'%'+_0x4bc267[_0x76e2('0x2e')]['filter']+'%'};return _0x1a2458;})});}_0x54eacf=_[_0x76e2('0x38')]({},_0x54eacf,_0x4bc267[_0x76e2('0x3b')]);return _0x48d43a[_0x76e2('0x4c')](_0x54eacf);}})[_0x76e2('0x23')](function(_0xae8d41){if(_0xae8d41){_0x1ef4b1=_0xae8d41[_0x76e2('0x42')];if(!_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x34')](_0x76e2('0x4a'))){_0x54eacf[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x54eacf[_0x76e2('0x1b')]=qs['offset'](_0x4bc267[_0x76e2('0x2e')][_0x76e2('0x1b')]);}return _0x48d43a['getDescriptions'](_0x54eacf);}})[_0x76e2('0x23')](function(_0x3ce966){if(_0x3ce966){return _0x3ce966?{'count':_0x1ef4b1,'rows':_0x3ce966}:null;}})[_0x76e2('0x23')](respondWithResult(_0x1a55b3,null))['catch'](handleError(_0x1a55b3,null));};exports[_0x76e2('0x4d')]=function(_0x35bda9,_0x3ab691,_0x85c5cc){var _0x24eebf={};var _0x518cbf={};var _0x511d52;var _0x11b140;return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x35bda9[_0x76e2('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ab691,null))[_0x76e2('0x23')](function(_0x5d4501){if(_0x5d4501){_0x511d52=_0x5d4501;_0x518cbf[_0x76e2('0x2c')]=_[_0x76e2('0x2f')](db['Tag'][_0x76e2('0x28')]);_0x518cbf[_0x76e2('0x2e')]=_[_0x76e2('0x2f')](_0x35bda9[_0x76e2('0x2e')]);_0x518cbf[_0x76e2('0x30')]=_[_0x76e2('0x31')](_0x518cbf['model'],_0x518cbf[_0x76e2('0x2e')]);_0x24eebf[_0x76e2('0x33')]=_['intersection'](_0x518cbf[_0x76e2('0x2c')],qs[_0x76e2('0x32')](_0x35bda9['query'][_0x76e2('0x32')]));_0x24eebf['attributes']=_0x24eebf[_0x76e2('0x33')][_0x76e2('0x42')]?_0x24eebf[_0x76e2('0x33')]:_0x518cbf[_0x76e2('0x2c')];_0x24eebf[_0x76e2('0x35')]=qs[_0x76e2('0x36')](_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x36')]);_0x24eebf[_0x76e2('0x37')]=qs[_0x76e2('0x30')](_['pick'](_0x35bda9['query'],_0x518cbf['filters']));if(_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x3a')]){_0x24eebf['where']=_['merge'](_0x24eebf[_0x76e2('0x37')],{'$or':_[_0x76e2('0x2d')](_0x24eebf[_0x76e2('0x33')],function(_0x52e115){var _0x36acb2={};_0x36acb2[_0x52e115]={'$like':'%'+_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x3a')]+'%'};return _0x36acb2;})});}_0x24eebf=_[_0x76e2('0x38')]({},_0x24eebf,_0x35bda9[_0x76e2('0x3b')]);return _0x511d52[_0x76e2('0x4d')](_0x24eebf);}})[_0x76e2('0x23')](function(_0x178a84){if(_0x178a84){_0x11b140=_0x178a84[_0x76e2('0x42')];if(!_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x34')]('nolimit')){_0x24eebf[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x35bda9[_0x76e2('0x2e')][_0x76e2('0x1d')]);_0x24eebf[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x35bda9['query'][_0x76e2('0x1b')]);}return _0x511d52['getTags'](_0x24eebf);}})[_0x76e2('0x23')](function(_0x1d67a1){if(_0x1d67a1){return _0x1d67a1?{'count':_0x11b140,'rows':_0x1d67a1}:null;}})[_0x76e2('0x23')](respondWithResult(_0x3ab691,null))[_0x76e2('0x3f')](handleError(_0x3ab691,null));};exports['setTags']=function(_0x327e0e,_0x369cdf,_0x467851){if(_0x327e0e[_0x76e2('0x46')]['id']){delete _0x327e0e[_0x76e2('0x46')]['id'];}return db['DeskConfiguration'][_0x76e2('0x48')]({'where':{'id':_0x327e0e[_0x76e2('0x41')]['id']}})[_0x76e2('0x23')](handleEntityNotFound(_0x369cdf,null))['then'](function(_0x268fb7){if(_0x268fb7){return _0x268fb7['setTags'](_0x327e0e[_0x76e2('0x46')][_0x76e2('0x4e')]||[]);}return null;})[_0x76e2('0x23')](respondWithResult(_0x369cdf,null))['catch'](handleError(_0x369cdf,null));}; \ No newline at end of file +var _0x037d=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','findOne','DeskField','order','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x037d,0xe8));var _0xd037=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x037d[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xd037('0x0'));var rimraf=require(_0xd037('0x1'));var zipdir=require(_0xd037('0x2'));var jsonpatch=require(_0xd037('0x3'));var rp=require(_0xd037('0x4'));var moment=require('moment');var BPromise=require(_0xd037('0x5'));var Mustache=require(_0xd037('0x6'));var util=require(_0xd037('0x7'));var path=require(_0xd037('0x8'));var sox=require(_0xd037('0x9'));var csv=require(_0xd037('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd037('0xb'));var _=require(_0xd037('0xc'));var squel=require('squel');var crypto=require(_0xd037('0xd'));var jsforce=require(_0xd037('0xe'));var deskjs=require(_0xd037('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd037('0x10'));var Papa=require(_0xd037('0x11'));var Redis=require(_0xd037('0x12'));var authService=require(_0xd037('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd037('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd037('0x15'))(_0xd037('0x16'));var utils=require('../../config/utils');var config=require(_0xd037('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd037('0x18'))['db'];function respondWithStatusCode(_0x177611,_0x3af4f4){_0x3af4f4=_0x3af4f4||0xcc;return function(_0x2fd359){if(_0x2fd359){return _0x177611[_0xd037('0x19')](_0x3af4f4);}return _0x177611[_0xd037('0x1a')](_0x3af4f4)[_0xd037('0x1b')]();};}function respondWithResult(_0x34bad0,_0x821a7c){_0x821a7c=_0x821a7c||0xc8;return function(_0xb063a4){if(_0xb063a4){return _0x34bad0['status'](_0x821a7c)[_0xd037('0x1c')](_0xb063a4);}};}function respondWithFilteredResult(_0x51b201,_0x5b847c){return function(_0x1f3169){if(_0x1f3169){var _0x37b4e9=typeof _0x5b847c[_0xd037('0x1d')]===_0xd037('0x1e')&&typeof _0x5b847c[_0xd037('0x1f')]==='undefined';var _0x468dd7=_0x1f3169[_0xd037('0x20')];var _0x37a362=_0x37b4e9?0x0:_0x5b847c[_0xd037('0x1d')];var _0x1e9ebb=_0x37b4e9?_0x1f3169['count']:_0x5b847c[_0xd037('0x1d')]+_0x5b847c[_0xd037('0x1f')];var _0x45d663;if(_0x1e9ebb>=_0x468dd7){_0x1e9ebb=_0x468dd7;_0x45d663=0xc8;}else{_0x45d663=0xce;}_0x51b201['status'](_0x45d663);return _0x51b201['set'](_0xd037('0x21'),_0x37a362+'-'+_0x1e9ebb+'/'+_0x468dd7)[_0xd037('0x1c')](_0x1f3169);}return null;};}function patchUpdates(_0x15d212){return function(_0x133210){try{jsonpatch['apply'](_0x133210,_0x15d212,!![]);}catch(_0x352c31){return BPromise['reject'](_0x352c31);}return _0x133210['save']();};}function saveUpdates(_0x2eef71,_0x550cde){return function(_0x52b19d){if(_0x52b19d){return _0x52b19d[_0xd037('0x22')](_0x2eef71)[_0xd037('0x23')](function(_0x4fd033){return _0x4fd033;});}return null;};}function removeEntity(_0x30ee12,_0x1520f6){return function(_0x19a85c){if(_0x19a85c){return _0x19a85c[_0xd037('0x24')]()[_0xd037('0x23')](function(){_0x30ee12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448a37,_0x3b1b61){return function(_0x23efec){if(!_0x23efec){_0x448a37['sendStatus'](0x194);}return _0x23efec;};}function handleError(_0x5153d6,_0x428385){_0x428385=_0x428385||0x1f4;return function(_0xe9911f){logger[_0xd037('0x25')](_0xe9911f['stack']);if(_0xe9911f['name']){delete _0xe9911f[_0xd037('0x26')];}_0x5153d6['status'](_0x428385)['send'](_0xe9911f);};}exports[_0xd037('0x27')]=function(_0x40328a,_0x28cffd){var _0x20eb84={},_0x4eadc6={},_0x2e581b={'count':0x0,'rows':[]};var _0x14b2b6=_[_0xd037('0x28')](db[_0xd037('0x29')][_0xd037('0x2a')],function(_0x453080){return{'name':_0x453080[_0xd037('0x2b')],'type':_0x453080[_0xd037('0x2c')]['key']};});_0x4eadc6[_0xd037('0x2d')]=_[_0xd037('0x28')](_0x14b2b6,'name');_0x4eadc6[_0xd037('0x2e')]=_[_0xd037('0x2f')](_0x40328a['query']);_0x4eadc6[_0xd037('0x30')]=_[_0xd037('0x31')](_0x4eadc6[_0xd037('0x2d')],_0x4eadc6['query']);_0x20eb84[_0xd037('0x32')]=_[_0xd037('0x31')](_0x4eadc6[_0xd037('0x2d')],qs['fields'](_0x40328a[_0xd037('0x2e')]['fields']));_0x20eb84['attributes']=_0x20eb84[_0xd037('0x32')][_0xd037('0x33')]?_0x20eb84[_0xd037('0x32')]:_0x4eadc6['model'];if(!_0x40328a[_0xd037('0x2e')][_0xd037('0x34')]('nolimit')){_0x20eb84[_0xd037('0x1f')]=qs['limit'](_0x40328a['query'][_0xd037('0x1f')]);_0x20eb84['offset']=qs[_0xd037('0x1d')](_0x40328a['query']['offset']);}_0x20eb84['order']=qs[_0xd037('0x35')](_0x40328a['query'][_0xd037('0x35')]);_0x20eb84['where']=qs[_0xd037('0x30')](_[_0xd037('0x36')](_0x40328a[_0xd037('0x2e')],_0x4eadc6[_0xd037('0x30')]),_0x14b2b6);if(_0x40328a[_0xd037('0x2e')][_0xd037('0x37')]){_0x20eb84[_0xd037('0x38')]=_[_0xd037('0x39')](_0x20eb84['where'],{'$or':_[_0xd037('0x28')](_0x14b2b6,function(_0x268d7b){if(_0x268d7b[_0xd037('0x2c')]!==_0xd037('0x3a')){var _0x2e5c75={};_0x2e5c75[_0x268d7b['name']]={'$like':'%'+_0x40328a[_0xd037('0x2e')][_0xd037('0x37')]+'%'};return _0x2e5c75;}})});}_0x20eb84=_[_0xd037('0x39')]({},_0x20eb84,_0x40328a[_0xd037('0x3b')]);var _0x2507b3={'where':_0x20eb84[_0xd037('0x38')]};return db[_0xd037('0x29')][_0xd037('0x20')](_0x2507b3)['then'](function(_0x535a2a){_0x2e581b[_0xd037('0x20')]=_0x535a2a;if(_0x40328a['query'][_0xd037('0x3c')]){_0x20eb84[_0xd037('0x3d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd037('0x3e')](_0x20eb84);})['then'](function(_0x323d6a){_0x2e581b[_0xd037('0x3f')]=_0x323d6a;return _0x2e581b;})[_0xd037('0x23')](respondWithFilteredResult(_0x28cffd,_0x20eb84))[_0xd037('0x40')](handleError(_0x28cffd,null));};exports[_0xd037('0x41')]=function(_0x2ff7de,_0x2aa966){var _0xbd9035={'raw':![],'where':{'id':_0x2ff7de['params']['id']}},_0x58f192={};_0x58f192[_0xd037('0x2d')]=_[_0xd037('0x2f')](db[_0xd037('0x29')][_0xd037('0x2a')]);_0x58f192['query']=_[_0xd037('0x2f')](_0x2ff7de[_0xd037('0x2e')]);_0x58f192[_0xd037('0x30')]=_['intersection'](_0x58f192[_0xd037('0x2d')],_0x58f192[_0xd037('0x2e')]);_0xbd9035[_0xd037('0x32')]=_['intersection'](_0x58f192[_0xd037('0x2d')],qs[_0xd037('0x42')](_0x2ff7de[_0xd037('0x2e')][_0xd037('0x42')]));_0xbd9035[_0xd037('0x32')]=_0xbd9035[_0xd037('0x32')][_0xd037('0x33')]?_0xbd9035[_0xd037('0x32')]:_0x58f192[_0xd037('0x2d')];if(_0x2ff7de['query'][_0xd037('0x3c')]){_0xbd9035[_0xd037('0x3d')]=[{'all':!![]}];}_0xbd9035=_[_0xd037('0x39')]({},_0xbd9035,_0x2ff7de['options']);return db[_0xd037('0x29')][_0xd037('0x43')](_0xbd9035)[_0xd037('0x23')](handleEntityNotFound(_0x2aa966,null))[_0xd037('0x23')](respondWithResult(_0x2aa966,null))[_0xd037('0x40')](handleError(_0x2aa966,null));};exports[_0xd037('0x44')]=function(_0x4472ca,_0xfaba4a){return db[_0xd037('0x29')][_0xd037('0x44')](_0x4472ca[_0xd037('0x45')],{})[_0xd037('0x23')](respondWithResult(_0xfaba4a,0xc9))[_0xd037('0x40')](handleError(_0xfaba4a,null));};exports[_0xd037('0x22')]=function(_0x5c691c,_0x8a2cb9){if(_0x5c691c[_0xd037('0x45')]['id']){delete _0x5c691c[_0xd037('0x45')]['id'];}return db['DeskConfiguration'][_0xd037('0x43')]({'where':{'id':_0x5c691c[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x8a2cb9,null))['then'](saveUpdates(_0x5c691c[_0xd037('0x45')],null))['then'](respondWithResult(_0x8a2cb9,null))[_0xd037('0x40')](handleError(_0x8a2cb9,null));};exports[_0xd037('0x24')]=function(_0x17f94a,_0x348258){return db[_0xd037('0x29')][_0xd037('0x43')]({'where':{'id':_0x17f94a[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x348258,null))[_0xd037('0x23')](removeEntity(_0x348258,null))[_0xd037('0x40')](handleError(_0x348258,null));};exports['getFields']=function(_0xc63c19,_0x583f07,_0x7aaa75){var _0x509e41={};var _0x1f5cb7={};var _0x5deea6;var _0x44c901;return db[_0xd037('0x29')][_0xd037('0x47')]({'where':{'id':_0xc63c19[_0xd037('0x46')]['id']}})['then'](handleEntityNotFound(_0x583f07,null))[_0xd037('0x23')](function(_0x742c12){if(_0x742c12){_0x5deea6=_0x742c12;_0x1f5cb7['model']=_['keys'](db[_0xd037('0x48')][_0xd037('0x2a')]);_0x1f5cb7[_0xd037('0x2e')]=_[_0xd037('0x2f')](_0xc63c19[_0xd037('0x2e')]);_0x1f5cb7[_0xd037('0x30')]=_[_0xd037('0x31')](_0x1f5cb7['model'],_0x1f5cb7[_0xd037('0x2e')]);_0x509e41['attributes']=_[_0xd037('0x31')](_0x1f5cb7[_0xd037('0x2d')],qs[_0xd037('0x42')](_0xc63c19[_0xd037('0x2e')]['fields']));_0x509e41[_0xd037('0x32')]=_0x509e41[_0xd037('0x32')][_0xd037('0x33')]?_0x509e41[_0xd037('0x32')]:_0x1f5cb7[_0xd037('0x2d')];_0x509e41[_0xd037('0x49')]=qs[_0xd037('0x35')](_0xc63c19[_0xd037('0x2e')][_0xd037('0x35')]);_0x509e41[_0xd037('0x38')]=qs[_0xd037('0x30')](_[_0xd037('0x36')](_0xc63c19[_0xd037('0x2e')],_0x1f5cb7[_0xd037('0x30')]));if(_0xc63c19[_0xd037('0x2e')][_0xd037('0x37')]){_0x509e41[_0xd037('0x38')]=_['merge'](_0x509e41['where'],{'$or':_['map'](_0x509e41[_0xd037('0x32')],function(_0x3e89f2){var _0x33e743={};_0x33e743[_0x3e89f2]={'$like':'%'+_0xc63c19[_0xd037('0x2e')]['filter']+'%'};return _0x33e743;})});}_0x509e41=_['merge']({},_0x509e41,_0xc63c19[_0xd037('0x3b')]);return _0x5deea6['getFields'](_0x509e41);}})['then'](function(_0x21c85a){if(_0x21c85a){_0x44c901=_0x21c85a[_0xd037('0x33')];if(!_0xc63c19['query'][_0xd037('0x34')]('nolimit')){_0x509e41[_0xd037('0x1f')]=qs[_0xd037('0x1f')](_0xc63c19[_0xd037('0x2e')]['limit']);_0x509e41[_0xd037('0x1d')]=qs[_0xd037('0x1d')](_0xc63c19[_0xd037('0x2e')][_0xd037('0x1d')]);}return _0x5deea6['getFields'](_0x509e41);}})[_0xd037('0x23')](function(_0x2ccb6f){if(_0x2ccb6f){return _0x2ccb6f?{'count':_0x44c901,'rows':_0x2ccb6f}:null;}})[_0xd037('0x23')](respondWithResult(_0x583f07,null))[_0xd037('0x40')](handleError(_0x583f07,null));};exports[_0xd037('0x4a')]=function(_0x4edbb7,_0x52cfbc,_0x1f06eb){var _0x4faca4={};var _0x976e92={};var _0x7e00a1;var _0x3d8738;return db['DeskConfiguration'][_0xd037('0x47')]({'where':{'id':_0x4edbb7[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x52cfbc,null))['then'](function(_0xe3cb89){if(_0xe3cb89){_0x7e00a1=_0xe3cb89;_0x976e92['model']=_[_0xd037('0x2f')](db['DeskField'][_0xd037('0x2a')]);_0x976e92[_0xd037('0x2e')]=_[_0xd037('0x2f')](_0x4edbb7[_0xd037('0x2e')]);_0x976e92[_0xd037('0x30')]=_['intersection'](_0x976e92['model'],_0x976e92['query']);_0x4faca4['attributes']=_[_0xd037('0x31')](_0x976e92[_0xd037('0x2d')],qs[_0xd037('0x42')](_0x4edbb7[_0xd037('0x2e')][_0xd037('0x42')]));_0x4faca4[_0xd037('0x32')]=_0x4faca4[_0xd037('0x32')][_0xd037('0x33')]?_0x4faca4[_0xd037('0x32')]:_0x976e92['model'];_0x4faca4['order']=qs[_0xd037('0x35')](_0x4edbb7['query'][_0xd037('0x35')]);_0x4faca4[_0xd037('0x38')]=qs[_0xd037('0x30')](_[_0xd037('0x36')](_0x4edbb7[_0xd037('0x2e')],_0x976e92[_0xd037('0x30')]));if(_0x4edbb7[_0xd037('0x2e')][_0xd037('0x37')]){_0x4faca4['where']=_[_0xd037('0x39')](_0x4faca4[_0xd037('0x38')],{'$or':_[_0xd037('0x28')](_0x4faca4['attributes'],function(_0x2dc70a){var _0x2f508d={};_0x2f508d[_0x2dc70a]={'$like':'%'+_0x4edbb7[_0xd037('0x2e')][_0xd037('0x37')]+'%'};return _0x2f508d;})});}_0x4faca4=_[_0xd037('0x39')]({},_0x4faca4,_0x4edbb7[_0xd037('0x3b')]);return _0x7e00a1[_0xd037('0x4a')](_0x4faca4);}})[_0xd037('0x23')](function(_0xe46a1f){if(_0xe46a1f){_0x3d8738=_0xe46a1f['length'];if(!_0x4edbb7[_0xd037('0x2e')][_0xd037('0x34')](_0xd037('0x4b'))){_0x4faca4['limit']=qs[_0xd037('0x1f')](_0x4edbb7[_0xd037('0x2e')]['limit']);_0x4faca4[_0xd037('0x1d')]=qs[_0xd037('0x1d')](_0x4edbb7[_0xd037('0x2e')]['offset']);}return _0x7e00a1[_0xd037('0x4a')](_0x4faca4);}})[_0xd037('0x23')](function(_0x16c028){if(_0x16c028){return _0x16c028?{'count':_0x3d8738,'rows':_0x16c028}:null;}})[_0xd037('0x23')](respondWithResult(_0x52cfbc,null))['catch'](handleError(_0x52cfbc,null));};exports['getDescriptions']=function(_0xdb422d,_0x46e51c,_0x56eb00){var _0x41bdb9={};var _0x1366d8={};var _0x410bdd;var _0x1d5e33;return db['DeskConfiguration'][_0xd037('0x47')]({'where':{'id':_0xdb422d[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x46e51c,null))[_0xd037('0x23')](function(_0x21b9ee){if(_0x21b9ee){_0x410bdd=_0x21b9ee;_0x1366d8[_0xd037('0x2d')]=_[_0xd037('0x2f')](db['DeskField'][_0xd037('0x2a')]);_0x1366d8[_0xd037('0x2e')]=_[_0xd037('0x2f')](_0xdb422d['query']);_0x1366d8['filters']=_[_0xd037('0x31')](_0x1366d8[_0xd037('0x2d')],_0x1366d8[_0xd037('0x2e')]);_0x41bdb9['attributes']=_[_0xd037('0x31')](_0x1366d8[_0xd037('0x2d')],qs[_0xd037('0x42')](_0xdb422d[_0xd037('0x2e')][_0xd037('0x42')]));_0x41bdb9[_0xd037('0x32')]=_0x41bdb9[_0xd037('0x32')][_0xd037('0x33')]?_0x41bdb9['attributes']:_0x1366d8[_0xd037('0x2d')];_0x41bdb9['order']=qs['sort'](_0xdb422d['query'][_0xd037('0x35')]);_0x41bdb9[_0xd037('0x38')]=qs[_0xd037('0x30')](_[_0xd037('0x36')](_0xdb422d['query'],_0x1366d8['filters']));if(_0xdb422d[_0xd037('0x2e')][_0xd037('0x37')]){_0x41bdb9[_0xd037('0x38')]=_[_0xd037('0x39')](_0x41bdb9[_0xd037('0x38')],{'$or':_[_0xd037('0x28')](_0x41bdb9[_0xd037('0x32')],function(_0x5a969a){var _0x27e3ae={};_0x27e3ae[_0x5a969a]={'$like':'%'+_0xdb422d[_0xd037('0x2e')][_0xd037('0x37')]+'%'};return _0x27e3ae;})});}_0x41bdb9=_[_0xd037('0x39')]({},_0x41bdb9,_0xdb422d[_0xd037('0x3b')]);return _0x410bdd[_0xd037('0x4c')](_0x41bdb9);}})[_0xd037('0x23')](function(_0x223a62){if(_0x223a62){_0x1d5e33=_0x223a62['length'];if(!_0xdb422d['query'][_0xd037('0x34')](_0xd037('0x4b'))){_0x41bdb9[_0xd037('0x1f')]=qs[_0xd037('0x1f')](_0xdb422d['query'][_0xd037('0x1f')]);_0x41bdb9[_0xd037('0x1d')]=qs[_0xd037('0x1d')](_0xdb422d[_0xd037('0x2e')][_0xd037('0x1d')]);}return _0x410bdd['getDescriptions'](_0x41bdb9);}})[_0xd037('0x23')](function(_0x310699){if(_0x310699){return _0x310699?{'count':_0x1d5e33,'rows':_0x310699}:null;}})[_0xd037('0x23')](respondWithResult(_0x46e51c,null))['catch'](handleError(_0x46e51c,null));};exports[_0xd037('0x4d')]=function(_0x12db09,_0x139d8b,_0x1ebda2){var _0x13c748={};var _0x599396={};var _0x2fdbc7;var _0x342341;return db[_0xd037('0x29')][_0xd037('0x47')]({'where':{'id':_0x12db09[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x139d8b,null))[_0xd037('0x23')](function(_0x5891bb){if(_0x5891bb){_0x2fdbc7=_0x5891bb;_0x599396[_0xd037('0x2d')]=_['keys'](db[_0xd037('0x4e')]['rawAttributes']);_0x599396['query']=_['keys'](_0x12db09[_0xd037('0x2e')]);_0x599396['filters']=_[_0xd037('0x31')](_0x599396[_0xd037('0x2d')],_0x599396['query']);_0x13c748[_0xd037('0x32')]=_['intersection'](_0x599396[_0xd037('0x2d')],qs['fields'](_0x12db09[_0xd037('0x2e')][_0xd037('0x42')]));_0x13c748['attributes']=_0x13c748[_0xd037('0x32')][_0xd037('0x33')]?_0x13c748[_0xd037('0x32')]:_0x599396[_0xd037('0x2d')];_0x13c748[_0xd037('0x49')]=qs[_0xd037('0x35')](_0x12db09[_0xd037('0x2e')]['sort']);_0x13c748[_0xd037('0x38')]=qs[_0xd037('0x30')](_[_0xd037('0x36')](_0x12db09[_0xd037('0x2e')],_0x599396[_0xd037('0x30')]));if(_0x12db09[_0xd037('0x2e')][_0xd037('0x37')]){_0x13c748['where']=_[_0xd037('0x39')](_0x13c748['where'],{'$or':_[_0xd037('0x28')](_0x13c748[_0xd037('0x32')],function(_0x318202){var _0xa3974a={};_0xa3974a[_0x318202]={'$like':'%'+_0x12db09[_0xd037('0x2e')][_0xd037('0x37')]+'%'};return _0xa3974a;})});}_0x13c748=_[_0xd037('0x39')]({},_0x13c748,_0x12db09['options']);return _0x2fdbc7[_0xd037('0x4d')](_0x13c748);}})[_0xd037('0x23')](function(_0xea7638){if(_0xea7638){_0x342341=_0xea7638[_0xd037('0x33')];if(!_0x12db09[_0xd037('0x2e')]['hasOwnProperty']('nolimit')){_0x13c748[_0xd037('0x1f')]=qs[_0xd037('0x1f')](_0x12db09['query']['limit']);_0x13c748[_0xd037('0x1d')]=qs[_0xd037('0x1d')](_0x12db09[_0xd037('0x2e')][_0xd037('0x1d')]);}return _0x2fdbc7[_0xd037('0x4d')](_0x13c748);}})[_0xd037('0x23')](function(_0x498ae2){if(_0x498ae2){return _0x498ae2?{'count':_0x342341,'rows':_0x498ae2}:null;}})[_0xd037('0x23')](respondWithResult(_0x139d8b,null))['catch'](handleError(_0x139d8b,null));};exports[_0xd037('0x4f')]=function(_0x1185bd,_0x524e2a,_0x4f8213){if(_0x1185bd[_0xd037('0x45')]['id']){delete _0x1185bd[_0xd037('0x45')]['id'];}return db['DeskConfiguration'][_0xd037('0x47')]({'where':{'id':_0x1185bd[_0xd037('0x46')]['id']}})[_0xd037('0x23')](handleEntityNotFound(_0x524e2a,null))['then'](function(_0x48e557){if(_0x48e557){return _0x48e557[_0xd037('0x4f')](_0x1185bd[_0xd037('0x45')][_0xd037('0x50')]||[]);}return null;})['then'](respondWithResult(_0x524e2a,null))[_0xd037('0x40')](handleError(_0x524e2a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 64d4331..997acb4 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 _0x04c4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','DeskConfiguration'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x04c4,0xa5));var _0x404c=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x04c4[_0x421e36];return _0x20b3e3;};'use strict';var _=require(_0x404c('0x0'));var util=require(_0x404c('0x1'));var logger=require(_0x404c('0x2'))(_0x404c('0x3'));var moment=require('moment');var BPromise=require(_0x404c('0x4'));var rp=require(_0x404c('0x5'));var fs=require('fs');var path=require(_0x404c('0x6'));var rimraf=require(_0x404c('0x7'));var config=require(_0x404c('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x404c('0x9')]=function(_0x30a404,_0x199d32){return _0x30a404['define'](_0x404c('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0042=['util','../../config/logger','moment','request-promise','path','rimraf','exports','define','DeskConfiguration','lodash'];(function(_0x7e1b6b,_0x4ad71d){var _0x2b086f=function(_0x5c24de){while(--_0x5c24de){_0x7e1b6b['push'](_0x7e1b6b['shift']());}};_0x2b086f(++_0x4ad71d);}(_0x0042,0x18f));var _0x2004=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x0042[_0x2a0183];return _0x158c3a;};'use strict';var _=require(_0x2004('0x0'));var util=require(_0x2004('0x1'));var logger=require(_0x2004('0x2'))('api');var moment=require(_0x2004('0x3'));var BPromise=require('bluebird');var rp=require(_0x2004('0x4'));var fs=require('fs');var path=require(_0x2004('0x5'));var rimraf=require(_0x2004('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x2004('0x7')]=function(_0x3c1b7d,_0x276c6a){return _0x3c1b7d[_0x2004('0x8')](_0x2004('0x9'),attributes,{'tableName':'int_desk_configurations','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 f99e1d5..c59fa77 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 _0xf271=['code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12742e,_0x43f6fa){var _0x173452=function(_0x500743){while(--_0x500743){_0x12742e['push'](_0x12742e['shift']());}};_0x173452(++_0x43f6fa);}(_0xf271,0x10b));var _0x1f27=function(_0x238428,_0x5dc614){_0x238428=_0x238428-0x0;var _0xaafb54=_0xf271[_0x238428];return _0xaafb54;};'use strict';var _=require(_0x1f27('0x0'));var util=require('util');var moment=require(_0x1f27('0x1'));var BPromise=require(_0x1f27('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f27('0x3'))['db'];var utils=require(_0x1f27('0x4'));var logger=require(_0x1f27('0x5'))(_0x1f27('0x6'));var config=require(_0x1f27('0x7'));var jayson=require(_0x1f27('0x8'));var client=jayson[_0x1f27('0x9')][_0x1f27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e397f,_0x408347,_0x376e7b){return new BPromise(function(_0x2690db,_0xf12834){return client[_0x1f27('0xb')](_0x2e397f,_0x376e7b)[_0x1f27('0xc')](function(_0x153ac2){logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));logger['debug'](_0x1f27('0x10'),_0x408347,'request\x20sent',JSON[_0x1f27('0x11')](_0x153ac2));if(_0x153ac2[_0x1f27('0x12')]){if(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x13')]===0x1f4){logger[_0x1f27('0x12')](_0x1f27('0xe'),_0x408347,_0x153ac2[_0x1f27('0x12')]['message']);return _0xf12834(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}logger[_0x1f27('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x408347,_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);return _0x2690db(_0x153ac2[_0x1f27('0x12')][_0x1f27('0x14')]);}else{logger[_0x1f27('0xd')](_0x1f27('0xe'),_0x408347,_0x1f27('0xf'));_0x2690db(_0x153ac2['result'][_0x1f27('0x14')]);}})[_0x1f27('0x15')](function(_0x3cda5b){logger[_0x1f27('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x408347,_0x3cda5b);_0xf12834(_0x3cda5b);});});} \ No newline at end of file +var _0x4c99=['debug','stringify','error','code','message','result','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3ba29c,_0x48cef8){var _0x2e8e6c=function(_0x581b42){while(--_0x581b42){_0x3ba29c['push'](_0x3ba29c['shift']());}};_0x2e8e6c(++_0x48cef8);}(_0x4c99,0x1ec));var _0x94c9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4c99[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x94c9('0x0'));var util=require('util');var moment=require(_0x94c9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94c9('0x2'))['db'];var utils=require(_0x94c9('0x3'));var logger=require('../../config/logger')(_0x94c9('0x4'));var config=require(_0x94c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x94c9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd2b,_0x49b85b,_0x23d961){return new BPromise(function(_0x4403ba,_0x3a1743){return client[_0x94c9('0x7')](_0x4ebd2b,_0x23d961)[_0x94c9('0x8')](function(_0x1c0983){logger[_0x94c9('0x9')](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));logger[_0x94c9('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x49b85b,_0x94c9('0xb'),JSON[_0x94c9('0xd')](_0x1c0983));if(_0x1c0983[_0x94c9('0xe')]){if(_0x1c0983['error'][_0x94c9('0xf')]===0x1f4){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);return _0x3a1743(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}logger[_0x94c9('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x49b85b,_0x1c0983['error']['message']);return _0x4403ba(_0x1c0983[_0x94c9('0xe')][_0x94c9('0x10')]);}else{logger['info'](_0x94c9('0xa'),_0x49b85b,_0x94c9('0xb'));_0x4403ba(_0x1c0983[_0x94c9('0x11')]['message']);}})['catch'](function(_0x447937){logger[_0x94c9('0xe')](_0x94c9('0xa'),_0x49b85b,_0x447937);_0x3a1743(_0x447937);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e22b37d..de6e12b 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 _0x84e5=['/:id','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','post'];(function(_0x25a40b,_0x6f205e){var _0x359b30=function(_0x1b0b3d){while(--_0x1b0b3d){_0x25a40b['push'](_0x25a40b['shift']());}};_0x359b30(++_0x6f205e);}(_0x84e5,0x111));var _0x584e=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x84e5[_0x44d9ab];return _0x31485e;};'use strict';var multer=require('multer');var util=require(_0x584e('0x0'));var path=require('path');var timeout=require(_0x584e('0x1'));var express=require(_0x584e('0x2'));var router=express[_0x584e('0x3')]();var fs_extra=require(_0x584e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x584e('0x5'));var config=require(_0x584e('0x6'));var controller=require(_0x584e('0x7'));router[_0x584e('0x8')]('/',auth[_0x584e('0x9')](),controller[_0x584e('0xa')]);router[_0x584e('0x8')]('/:id',auth[_0x584e('0x9')](),controller['show']);router[_0x584e('0xb')]('/',auth[_0x584e('0x9')](),controller['create']);router['put'](_0x584e('0xc'),auth['isAuthenticated'](),controller[_0x584e('0xd')]);router['delete'](_0x584e('0xc'),auth[_0x584e('0x9')](),controller['destroy']);module[_0x584e('0xe')]=router; \ No newline at end of file +var _0x1555=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x56440a,_0x145717){var _0x24b604=function(_0x2a9e52){while(--_0x2a9e52){_0x56440a['push'](_0x56440a['shift']());}};_0x24b604(++_0x145717);}(_0x1555,0x12d));var _0x5155=function(_0xe8cb3c,_0x31228a){_0xe8cb3c=_0xe8cb3c-0x0;var _0x203cc9=_0x1555[_0xe8cb3c];return _0x203cc9;};'use strict';var multer=require(_0x5155('0x0'));var util=require(_0x5155('0x1'));var path=require(_0x5155('0x2'));var timeout=require('connect-timeout');var express=require(_0x5155('0x3'));var router=express[_0x5155('0x4')]();var fs_extra=require(_0x5155('0x5'));var auth=require(_0x5155('0x6'));var interaction=require(_0x5155('0x7'));var config=require('../../config/environment');var controller=require(_0x5155('0x8'));router[_0x5155('0x9')]('/',auth['isAuthenticated'](),controller[_0x5155('0xa')]);router[_0x5155('0x9')](_0x5155('0xb'),auth[_0x5155('0xc')](),controller[_0x5155('0xd')]);router[_0x5155('0xe')]('/',auth['isAuthenticated'](),controller[_0x5155('0xf')]);router[_0x5155('0x10')](_0x5155('0xb'),auth['isAuthenticated'](),controller[_0x5155('0x11')]);router[_0x5155('0x12')]('/:id',auth[_0x5155('0xc')](),controller[_0x5155('0x13')]);module[_0x5155('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 26ce85c..6c2194d 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 _0x9c4b=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x497a7f,_0x1eb90e){var _0x19d47f=function(_0x316958){while(--_0x316958){_0x497a7f['push'](_0x497a7f['shift']());}};_0x19d47f(++_0x1eb90e);}(_0x9c4b,0x151));var _0xb9c4=function(_0x57fa91,_0x87ea8a){_0x57fa91=_0x57fa91-0x0;var _0x425572=_0x9c4b[_0x57fa91];return _0x425572;};'use strict';var Sequelize=require(_0xb9c4('0x0'));module['exports']={'type':{'type':Sequelize[_0xb9c4('0x1')](_0xb9c4('0x2'),_0xb9c4('0x3'),_0xb9c4('0x4'),_0xb9c4('0x5'),'picklist'),'defaultValue':_0xb9c4('0x2')},'content':{'type':Sequelize[_0xb9c4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb9c4('0x1')]('string',_0xb9c4('0x3'),_0xb9c4('0x4'))},'keyContent':{'type':Sequelize[_0xb9c4('0x6')]},'idField':{'type':Sequelize[_0xb9c4('0x6')]},'nameField':{'type':Sequelize[_0xb9c4('0x6')]},'customField':{'type':Sequelize[_0xb9c4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x93d1=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','picklist'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x93d1,0x1c3));var _0x193d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93d1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x193d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x193d('0x1'),_0x193d('0x2'),_0x193d('0x3'),'keyValue',_0x193d('0x4')),'defaultValue':_0x193d('0x1')},'content':{'type':Sequelize[_0x193d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x193d('0x6')](_0x193d('0x1'),_0x193d('0x2'),_0x193d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x193d('0x5')]},'nameField':{'type':Sequelize[_0x193d('0x5')]},'customField':{'type':Sequelize[_0x193d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x193d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index eba57d7..d0bace1 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 _0xee3c=['sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','params','length','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','DeskField','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order'];(function(_0x185f54,_0x499b38){var _0x484e97=function(_0x364f68){while(--_0x364f68){_0x185f54['push'](_0x185f54['shift']());}};_0x484e97(++_0x499b38);}(_0xee3c,0x14a));var _0xcee3=function(_0x391f04,_0x46d508){_0x391f04=_0x391f04-0x0;var _0x2eaf60=_0xee3c[_0x391f04];return _0x2eaf60;};'use strict';var emlformat=require(_0xcee3('0x0'));var rimraf=require(_0xcee3('0x1'));var zipdir=require(_0xcee3('0x2'));var jsonpatch=require(_0xcee3('0x3'));var rp=require(_0xcee3('0x4'));var moment=require(_0xcee3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcee3('0x6'));var path=require(_0xcee3('0x7'));var sox=require(_0xcee3('0x8'));var csv=require(_0xcee3('0x9'));var ejs=require(_0xcee3('0xa'));var fs=require('fs');var fs_extra=require(_0xcee3('0xb'));var _=require(_0xcee3('0xc'));var squel=require(_0xcee3('0xd'));var crypto=require(_0xcee3('0xe'));var jsforce=require(_0xcee3('0xf'));var deskjs=require(_0xcee3('0x10'));var toCsv=require(_0xcee3('0x9'));var querystring=require(_0xcee3('0x11'));var Papa=require(_0xcee3('0x12'));var Redis=require(_0xcee3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcee3('0x14'));var as=require(_0xcee3('0x15'));var hardwareService=require(_0xcee3('0x16'));var logger=require(_0xcee3('0x17'))(_0xcee3('0x18'));var utils=require(_0xcee3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcee3('0x1a'));var db=require(_0xcee3('0x1b'))['db'];function respondWithStatusCode(_0x2db8ff,_0x1a47e1){_0x1a47e1=_0x1a47e1||0xcc;return function(_0xc4f4f2){if(_0xc4f4f2){return _0x2db8ff['sendStatus'](_0x1a47e1);}return _0x2db8ff[_0xcee3('0x1c')](_0x1a47e1)['end']();};}function respondWithResult(_0x559250,_0x53c810){_0x53c810=_0x53c810||0xc8;return function(_0x3ea063){if(_0x3ea063){return _0x559250[_0xcee3('0x1c')](_0x53c810)['json'](_0x3ea063);}};}function respondWithFilteredResult(_0x50bbf2,_0x34854a){return function(_0x505f09){if(_0x505f09){var _0x420b46=typeof _0x34854a['offset']===_0xcee3('0x1d')&&typeof _0x34854a[_0xcee3('0x1e')]==='undefined';var _0xc139b5=_0x505f09[_0xcee3('0x1f')];var _0x40cb8b=_0x420b46?0x0:_0x34854a[_0xcee3('0x20')];var _0x50bf6e=_0x420b46?_0x505f09[_0xcee3('0x1f')]:_0x34854a[_0xcee3('0x20')]+_0x34854a[_0xcee3('0x1e')];var _0x11bf37;if(_0x50bf6e>=_0xc139b5){_0x50bf6e=_0xc139b5;_0x11bf37=0xc8;}else{_0x11bf37=0xce;}_0x50bbf2['status'](_0x11bf37);return _0x50bbf2[_0xcee3('0x21')](_0xcee3('0x22'),_0x40cb8b+'-'+_0x50bf6e+'/'+_0xc139b5)[_0xcee3('0x23')](_0x505f09);}return null;};}function patchUpdates(_0x8b2470){return function(_0x11d116){try{jsonpatch[_0xcee3('0x24')](_0x11d116,_0x8b2470,!![]);}catch(_0x195ba9){return BPromise[_0xcee3('0x25')](_0x195ba9);}return _0x11d116[_0xcee3('0x26')]();};}function saveUpdates(_0x46d7a9,_0x40dd10){return function(_0xa1efbf){if(_0xa1efbf){return _0xa1efbf[_0xcee3('0x27')](_0x46d7a9)['then'](function(_0x1fee89){return _0x1fee89;});}return null;};}function removeEntity(_0x277194,_0x240736){return function(_0x1ee247){if(_0x1ee247){return _0x1ee247[_0xcee3('0x28')]()['then'](function(){_0x277194['status'](0xcc)[_0xcee3('0x29')]();});}};}function handleEntityNotFound(_0x5b92ba,_0x544509){return function(_0x228ff6){if(!_0x228ff6){_0x5b92ba['sendStatus'](0x194);}return _0x228ff6;};}function handleError(_0x452837,_0x202bfd){_0x202bfd=_0x202bfd||0x1f4;return function(_0x19a15e){logger['error'](_0x19a15e[_0xcee3('0x2a')]);if(_0x19a15e['name']){delete _0x19a15e[_0xcee3('0x2b')];}_0x452837['status'](_0x202bfd)[_0xcee3('0x2c')](_0x19a15e);};}exports[_0xcee3('0x2d')]=function(_0x5d965d,_0x3a2532){var _0x1efb1b={},_0x5c1a32={},_0x400cfe={'count':0x0,'rows':[]};var _0x4ef9da=_['map'](db[_0xcee3('0x2e')]['rawAttributes'],function(_0x22e342){return{'name':_0x22e342[_0xcee3('0x2f')],'type':_0x22e342[_0xcee3('0x30')][_0xcee3('0x31')]};});_0x5c1a32[_0xcee3('0x32')]=_[_0xcee3('0x33')](_0x4ef9da,_0xcee3('0x2b'));_0x5c1a32['query']=_[_0xcee3('0x34')](_0x5d965d['query']);_0x5c1a32[_0xcee3('0x35')]=_[_0xcee3('0x36')](_0x5c1a32[_0xcee3('0x32')],_0x5c1a32[_0xcee3('0x37')]);_0x1efb1b[_0xcee3('0x38')]=_[_0xcee3('0x36')](_0x5c1a32[_0xcee3('0x32')],qs[_0xcee3('0x39')](_0x5d965d['query'][_0xcee3('0x39')]));_0x1efb1b[_0xcee3('0x38')]=_0x1efb1b[_0xcee3('0x38')]['length']?_0x1efb1b[_0xcee3('0x38')]:_0x5c1a32[_0xcee3('0x32')];if(!_0x5d965d['query'][_0xcee3('0x3a')]('nolimit')){_0x1efb1b[_0xcee3('0x1e')]=qs['limit'](_0x5d965d['query'][_0xcee3('0x1e')]);_0x1efb1b['offset']=qs[_0xcee3('0x20')](_0x5d965d[_0xcee3('0x37')][_0xcee3('0x20')]);}_0x1efb1b[_0xcee3('0x3b')]=qs['sort'](_0x5d965d['query'][_0xcee3('0x3c')]);_0x1efb1b[_0xcee3('0x3d')]=qs['filters'](_[_0xcee3('0x3e')](_0x5d965d[_0xcee3('0x37')],_0x5c1a32['filters']),_0x4ef9da);if(_0x5d965d[_0xcee3('0x37')][_0xcee3('0x3f')]){_0x1efb1b[_0xcee3('0x3d')]=_[_0xcee3('0x40')](_0x1efb1b[_0xcee3('0x3d')],{'$or':_[_0xcee3('0x33')](_0x4ef9da,function(_0x49f1dc){if(_0x49f1dc[_0xcee3('0x30')]!==_0xcee3('0x41')){var _0x28e726={};_0x28e726[_0x49f1dc[_0xcee3('0x2b')]]={'$like':'%'+_0x5d965d[_0xcee3('0x37')][_0xcee3('0x3f')]+'%'};return _0x28e726;}})});}_0x1efb1b=_[_0xcee3('0x40')]({},_0x1efb1b,_0x5d965d['options']);var _0x139ddc={'where':_0x1efb1b[_0xcee3('0x3d')]};return db[_0xcee3('0x2e')]['count'](_0x139ddc)[_0xcee3('0x42')](function(_0x436961){_0x400cfe['count']=_0x436961;if(_0x5d965d[_0xcee3('0x37')][_0xcee3('0x43')]){_0x1efb1b[_0xcee3('0x44')]=[{'all':!![]}];}return db['DeskField'][_0xcee3('0x45')](_0x1efb1b);})[_0xcee3('0x42')](function(_0x1bb4a8){_0x400cfe[_0xcee3('0x46')]=_0x1bb4a8;return _0x400cfe;})[_0xcee3('0x42')](respondWithFilteredResult(_0x3a2532,_0x1efb1b))['catch'](handleError(_0x3a2532,null));};exports['show']=function(_0x42e197,_0x41cd61){var _0x45df47={'raw':!![],'where':{'id':_0x42e197[_0xcee3('0x47')]['id']}},_0x47159f={};_0x47159f[_0xcee3('0x32')]=_[_0xcee3('0x34')](db[_0xcee3('0x2e')]['rawAttributes']);_0x47159f[_0xcee3('0x37')]=_[_0xcee3('0x34')](_0x42e197[_0xcee3('0x37')]);_0x47159f[_0xcee3('0x35')]=_[_0xcee3('0x36')](_0x47159f[_0xcee3('0x32')],_0x47159f[_0xcee3('0x37')]);_0x45df47['attributes']=_[_0xcee3('0x36')](_0x47159f['model'],qs[_0xcee3('0x39')](_0x42e197[_0xcee3('0x37')]['fields']));_0x45df47[_0xcee3('0x38')]=_0x45df47[_0xcee3('0x38')][_0xcee3('0x48')]?_0x45df47[_0xcee3('0x38')]:_0x47159f[_0xcee3('0x32')];if(_0x42e197[_0xcee3('0x37')][_0xcee3('0x43')]){_0x45df47[_0xcee3('0x44')]=[{'all':!![]}];}_0x45df47=_[_0xcee3('0x40')]({},_0x45df47,_0x42e197[_0xcee3('0x49')]);return db['DeskField'][_0xcee3('0x4a')](_0x45df47)[_0xcee3('0x42')](handleEntityNotFound(_0x41cd61,null))['then'](respondWithResult(_0x41cd61,null))[_0xcee3('0x4b')](handleError(_0x41cd61,null));};exports[_0xcee3('0x4c')]=function(_0x31393e,_0x2726d9){return db[_0xcee3('0x2e')][_0xcee3('0x4c')](_0x31393e[_0xcee3('0x4d')],{})['then'](respondWithResult(_0x2726d9,0xc9))[_0xcee3('0x4b')](handleError(_0x2726d9,null));};exports[_0xcee3('0x27')]=function(_0x20bfc5,_0x27022b){if(_0x20bfc5[_0xcee3('0x4d')]['id']){delete _0x20bfc5[_0xcee3('0x4d')]['id'];}return db['DeskField'][_0xcee3('0x4a')]({'where':{'id':_0x20bfc5['params']['id']}})[_0xcee3('0x42')](handleEntityNotFound(_0x27022b,null))[_0xcee3('0x42')](saveUpdates(_0x20bfc5[_0xcee3('0x4d')],null))['then'](respondWithResult(_0x27022b,null))['catch'](handleError(_0x27022b,null));};exports[_0xcee3('0x28')]=function(_0x319c25,_0x47c149){return db[_0xcee3('0x2e')]['find']({'where':{'id':_0x319c25[_0xcee3('0x47')]['id']}})[_0xcee3('0x42')](handleEntityNotFound(_0x47c149,null))[_0xcee3('0x42')](removeEntity(_0x47c149,null))[_0xcee3('0x4b')](handleError(_0x47c149,null));}; \ No newline at end of file +var _0x90b1=['map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','DeskField','includeAll','rows','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index'];(function(_0x25f280,_0x20f3c0){var _0x42d4dd=function(_0x3ded79){while(--_0x3ded79){_0x25f280['push'](_0x25f280['shift']());}};_0x42d4dd(++_0x20f3c0);}(_0x90b1,0x1bb));var _0x190b=function(_0x218ea3,_0x36f59c){_0x218ea3=_0x218ea3-0x0;var _0x49265e=_0x90b1[_0x218ea3];return _0x49265e;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['DeskField'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['DeskField'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3ce607d..fb2a23e 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 _0x4389=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x25baa1,_0xbb0351){var _0x349f42=function(_0x5c95dd){while(--_0x5c95dd){_0x25baa1['push'](_0x25baa1['shift']());}};_0x349f42(++_0xbb0351);}(_0x4389,0x76));var _0x9438=function(_0x30b0fc,_0x5b7d06){_0x30b0fc=_0x30b0fc-0x0;var _0x481990=_0x4389[_0x30b0fc];return _0x481990;};'use strict';var _=require(_0x9438('0x0'));var util=require(_0x9438('0x1'));var logger=require(_0x9438('0x2'))('api');var moment=require(_0x9438('0x3'));var BPromise=require(_0x9438('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9438('0x5'));var rimraf=require(_0x9438('0x6'));var config=require(_0x9438('0x7'));var attributes=require(_0x9438('0x8'));module[_0x9438('0x9')]=function(_0x52b05f,_0x57bdca){return _0x52b05f[_0x9438('0xa')](_0x9438('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x9438('0xc'),'fields':['idField',_0x9438('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd32d=['../../config/environment','exports','define','DeskField','int_desk_fields','idField','FieldId','util','../../config/logger','api','moment','path','rimraf'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0xd32d,0xf1));var _0xdd32=function(_0x11c8ce,_0x3a6d5e){_0x11c8ce=_0x11c8ce-0x0;var _0x181095=_0xd32d[_0x11c8ce];return _0x181095;};'use strict';var _=require('lodash');var util=require(_0xdd32('0x0'));var logger=require(_0xdd32('0x1'))(_0xdd32('0x2'));var moment=require(_0xdd32('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd32('0x4'));var rimraf=require(_0xdd32('0x5'));var config=require(_0xdd32('0x6'));var attributes=require('./intDeskField.attributes');module[_0xdd32('0x7')]=function(_0x34d6f7,_0xc79ba1){return _0x34d6f7[_0xdd32('0x8')](_0xdd32('0x9'),attributes,{'tableName':_0xdd32('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xdd32('0xb'),_0xdd32('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index a9eeea8..91ef57b 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 _0xf683=['DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','debug'];(function(_0x13a3ac,_0x2e6afc){var _0x770689=function(_0x38b17b){while(--_0x38b17b){_0x13a3ac['push'](_0x13a3ac['shift']());}};_0x770689(++_0x2e6afc);}(_0xf683,0x170));var _0x3f68=function(_0x36fb97,_0x50dd70){_0x36fb97=_0x36fb97-0x0;var _0x161267=_0xf683[_0x36fb97];return _0x161267;};'use strict';var _=require('lodash');var util=require(_0x3f68('0x0'));var moment=require(_0x3f68('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f68('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f68('0x3'));var logger=require(_0x3f68('0x4'))('rpc');var config=require(_0x3f68('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3f68('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1881e2,_0x15b1cc,_0x345dff){return new BPromise(function(_0x54c284,_0x1f1921){return client['request'](_0x1881e2,_0x345dff)[_0x3f68('0x7')](function(_0x4c85e){logger[_0x3f68('0x8')]('DeskField,\x20%s,\x20%s',_0x15b1cc,'request\x20sent');logger[_0x3f68('0x9')](_0x3f68('0xa'),_0x15b1cc,_0x3f68('0xb'),JSON[_0x3f68('0xc')](_0x4c85e));if(_0x4c85e['error']){if(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xe')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x15b1cc,_0x4c85e['error'][_0x3f68('0xf')]);return _0x1f1921(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);}logger['error'](_0x3f68('0x10'),_0x15b1cc,_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);return _0x54c284(_0x4c85e[_0x3f68('0xd')][_0x3f68('0xf')]);}else{logger[_0x3f68('0x8')](_0x3f68('0x10'),_0x15b1cc,_0x3f68('0xb'));_0x54c284(_0x4c85e[_0x3f68('0x11')]['message']);}})['catch'](function(_0xd4500e){logger[_0x3f68('0xd')]('DeskField,\x20%s,\x20%s',_0x15b1cc,_0xd4500e);_0x1f1921(_0xd4500e);});});} \ No newline at end of file +var _0xf1b2=['../../config/logger','rpc','jayson/promise','client','request','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4aa933,_0x2ac258){var _0x528fbc=function(_0xcb9bea){while(--_0xcb9bea){_0x4aa933['push'](_0x4aa933['shift']());}};_0x528fbc(++_0x2ac258);}(_0xf1b2,0x16f));var _0x2f1b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2f1b('0x0'));var util=require(_0x2f1b('0x1'));var moment=require(_0x2f1b('0x2'));var BPromise=require(_0x2f1b('0x3'));var rs=require(_0x2f1b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f1b('0x5'))['db'];var utils=require(_0x2f1b('0x6'));var logger=require(_0x2f1b('0x7'))(_0x2f1b('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f1b('0x9'));var client=jayson[_0x2f1b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58cef5,_0x447b08,_0x4aff9f){return new BPromise(function(_0x1b97ec,_0x349a4b){return client[_0x2f1b('0xb')](_0x58cef5,_0x4aff9f)['then'](function(_0x5b600e){logger['info'](_0x2f1b('0xc'),_0x447b08,'request\x20sent');logger[_0x2f1b('0xd')](_0x2f1b('0xe'),_0x447b08,_0x2f1b('0xf'),JSON[_0x2f1b('0x10')](_0x5b600e));if(_0x5b600e[_0x2f1b('0x11')]){if(_0x5b600e[_0x2f1b('0x11')]['code']===0x1f4){logger[_0x2f1b('0x11')](_0x2f1b('0xc'),_0x447b08,_0x5b600e[_0x2f1b('0x11')][_0x2f1b('0x12')]);return _0x349a4b(_0x5b600e['error'][_0x2f1b('0x12')]);}logger[_0x2f1b('0x11')]('DeskField,\x20%s,\x20%s',_0x447b08,_0x5b600e[_0x2f1b('0x11')][_0x2f1b('0x12')]);return _0x1b97ec(_0x5b600e['error']['message']);}else{logger[_0x2f1b('0x13')]('DeskField,\x20%s,\x20%s',_0x447b08,'request\x20sent');_0x1b97ec(_0x5b600e[_0x2f1b('0x14')][_0x2f1b('0x12')]);}})[_0x2f1b('0x15')](function(_0x1513f3){logger[_0x2f1b('0x11')]('DeskField,\x20%s,\x20%s',_0x447b08,_0x1513f3);_0x349a4b(_0x1513f3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9abfd2c..523087f 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 _0x1003=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','/:id'];(function(_0x4c27fb,_0x3cc27d){var _0xcdbabb=function(_0x587dd3){while(--_0x587dd3){_0x4c27fb['push'](_0x4c27fb['shift']());}};_0xcdbabb(++_0x3cc27d);}(_0x1003,0x1b3));var _0x3100=function(_0x50f903,_0x2e3a32){_0x50f903=_0x50f903-0x0;var _0x20358d=_0x1003[_0x50f903];return _0x20358d;};'use strict';var multer=require(_0x3100('0x0'));var util=require('util');var path=require(_0x3100('0x1'));var timeout=require(_0x3100('0x2'));var express=require(_0x3100('0x3'));var router=express[_0x3100('0x4')]();var fs_extra=require(_0x3100('0x5'));var auth=require(_0x3100('0x6'));var interaction=require(_0x3100('0x7'));var config=require('../../config/environment');var controller=require(_0x3100('0x8'));router[_0x3100('0x9')]('/',auth['isAuthenticated'](),controller[_0x3100('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3100('0xb')]);router['get'](_0x3100('0xc'),auth['isAuthenticated'](),controller[_0x3100('0xd')]);router['get'](_0x3100('0xe'),auth[_0x3100('0xf')](),controller[_0x3100('0x10')]);router[_0x3100('0x11')]('/',auth[_0x3100('0xf')](),controller['create']);router[_0x3100('0x11')](_0x3100('0xc'),auth[_0x3100('0xf')](),controller[_0x3100('0x12')]);router[_0x3100('0x13')](_0x3100('0x14'),auth[_0x3100('0xf')](),controller['update']);router[_0x3100('0x15')]('/:id',auth[_0x3100('0xf')](),controller[_0x3100('0x16')]);module[_0x3100('0x17')]=router; \ No newline at end of file +var _0xe952=['put','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','post','create'];(function(_0x353e75,_0x51c3c5){var _0x4d097e=function(_0x1a1565){while(--_0x1a1565){_0x353e75['push'](_0x353e75['shift']());}};_0x4d097e(++_0x51c3c5);}(_0xe952,0x102));var _0x2e95=function(_0x58f145,_0x45269c){_0x58f145=_0x58f145-0x0;var _0x2df920=_0xe952[_0x58f145];return _0x2df920;};'use strict';var multer=require(_0x2e95('0x0'));var util=require('util');var path=require(_0x2e95('0x1'));var timeout=require(_0x2e95('0x2'));var express=require(_0x2e95('0x3'));var router=express[_0x2e95('0x4')]();var fs_extra=require(_0x2e95('0x5'));var auth=require(_0x2e95('0x6'));var interaction=require(_0x2e95('0x7'));var config=require(_0x2e95('0x8'));var controller=require(_0x2e95('0x9'));router[_0x2e95('0xa')]('/',auth[_0x2e95('0xb')](),controller[_0x2e95('0xc')]);router[_0x2e95('0xa')]('/:id',auth[_0x2e95('0xb')](),controller[_0x2e95('0xd')]);router['get'](_0x2e95('0xe'),auth[_0x2e95('0xb')](),controller['getConfigurations']);router[_0x2e95('0xa')](_0x2e95('0xf'),auth[_0x2e95('0xb')](),controller['getFields']);router[_0x2e95('0x10')]('/',auth[_0x2e95('0xb')](),controller[_0x2e95('0x11')]);router[_0x2e95('0x10')](_0x2e95('0xe'),auth[_0x2e95('0xb')](),controller['addConfiguration']);router[_0x2e95('0x12')]('/:id',auth[_0x2e95('0xb')](),controller['update']);router[_0x2e95('0x13')](_0x2e95('0x14'),auth[_0x2e95('0xb')](),controller[_0x2e95('0x15')]);module[_0x2e95('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3825761..6115441 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 _0xb2ac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3e1efa,_0x548431){var _0x12ab20=function(_0x4abd9a){while(--_0x4abd9a){_0x3e1efa['push'](_0x3e1efa['shift']());}};_0x12ab20(++_0x548431);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x1878f9,_0x5d148d){_0x1878f9=_0x1878f9-0x0;var _0x56da65=_0xb2ac[_0x1878f9];return _0x56da65;};'use strict';var Sequelize=require(_0xcb2a('0x0'));module[_0xcb2a('0x1')]={'name':{'type':Sequelize[_0xcb2a('0x2')]},'username':{'type':Sequelize[_0xcb2a('0x2')]},'password':{'type':Sequelize[_0xcb2a('0x2')]},'remoteUri':{'type':Sequelize[_0xcb2a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xcb2a('0x2')]},'clientSecret':{'type':Sequelize[_0xcb2a('0x2')]},'serverUrl':{'type':Sequelize[_0xcb2a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb2a('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcb2a('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8c32=['sequelize','exports','STRING','BOOLEAN'];(function(_0x41bf8b,_0x410d46){var _0x4dbe56=function(_0x1a81e2){while(--_0x1a81e2){_0x41bf8b['push'](_0x41bf8b['shift']());}};_0x4dbe56(++_0x410d46);}(_0x8c32,0x130));var _0x28c3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c32[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x28c3('0x0'));module[_0x28c3('0x1')]={'name':{'type':Sequelize[_0x28c3('0x2')]},'username':{'type':Sequelize[_0x28c3('0x2')]},'password':{'type':Sequelize[_0x28c3('0x2')]},'remoteUri':{'type':Sequelize[_0x28c3('0x2')]},'tenantId':{'type':Sequelize[_0x28c3('0x2')]},'clientId':{'type':Sequelize[_0x28c3('0x2')]},'clientSecret':{'type':Sequelize[_0x28c3('0x2')]},'serverUrl':{'type':Sequelize[_0x28c3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x28c3('0x2')]},'modernAuthentication':{'type':Sequelize[_0x28c3('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 657a300..eda2058 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 _0xb910=['hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contractdetailidname','contractidname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','kbarticleidname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','password','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','tenantId','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','?$select=DisplayName,LogicalName','DisplayName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order'];(function(_0x277bd0,_0x25c006){var _0x4e92b7=function(_0x2996f4){while(--_0x2996f4){_0x277bd0['push'](_0x277bd0['shift']());}};_0x4e92b7(++_0x25c006);}(_0xb910,0x12b));var _0x0b91=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb910[_0xaa0309];return _0x5de7ce;};'use strict';var rp=require(_0x0b91('0x0'));var util=require(_0x0b91('0x1'));var _=require(_0x0b91('0x2'));var qs=require(_0x0b91('0x3'));var logger=require(_0x0b91('0x4'))(_0x0b91('0x5'));var db=require(_0x0b91('0x6'))['db'];var integrations=require(_0x0b91('0x7'));function respondWithResult(_0x16ba05,_0x1bfbc7){_0x1bfbc7=_0x1bfbc7||0xc8;return function(_0x432232){if(_0x432232){return _0x16ba05[_0x0b91('0x8')](_0x1bfbc7)[_0x0b91('0x9')](_0x432232);}};}function respondWithFilteredResult(_0x1800dc,_0x5a22b6){return function(_0x156fd1){if(_0x156fd1){var _0xc65d86=typeof _0x5a22b6[_0x0b91('0xa')]===_0x0b91('0xb')&&typeof _0x5a22b6[_0x0b91('0xc')]===_0x0b91('0xb');var _0x4118b8=_0x156fd1[_0x0b91('0xd')];var _0x42e3dc=_0xc65d86?0x0:_0x5a22b6['offset'];var _0x2a38a3=_0xc65d86?_0x156fd1['count']:_0x5a22b6[_0x0b91('0xa')]+_0x5a22b6['limit'];var _0x4ee548;if(_0x2a38a3>=_0x4118b8){_0x2a38a3=_0x4118b8;_0x4ee548=0xc8;}else{_0x4ee548=0xce;}_0x1800dc[_0x0b91('0x8')](_0x4ee548);return _0x1800dc[_0x0b91('0xe')](_0x0b91('0xf'),_0x42e3dc+'-'+_0x2a38a3+'/'+_0x4118b8)[_0x0b91('0x9')](_0x156fd1);}return null;};}function saveUpdates(_0x5b6f36){return function(_0x2e8430){if(_0x2e8430){return _0x2e8430[_0x0b91('0x10')](_0x5b6f36)[_0x0b91('0x11')](function(_0x2ec488){return _0x2ec488;});}return null;};}function removeEntity(_0x590128){return function(_0x5e1ac4){if(_0x5e1ac4){return _0x5e1ac4[_0x0b91('0x12')]()[_0x0b91('0x11')](function(){_0x590128[_0x0b91('0x8')](0xcc)[_0x0b91('0x13')]();});}};}function handleEntityNotFound(_0x46c0f2){return function(_0x4ac8f5){if(!_0x4ac8f5){_0x46c0f2[_0x0b91('0x14')](0x194);}return _0x4ac8f5;};}function handleError(_0x25e66a,_0x2e8bb9){_0x2e8bb9=_0x2e8bb9||0x1f4;return function(_0x17d6fd){logger[_0x0b91('0x15')](_0x17d6fd[_0x0b91('0x16')]);if(_0x17d6fd[_0x0b91('0x17')]){delete _0x17d6fd[_0x0b91('0x17')];}_0x25e66a[_0x0b91('0x8')](_0x2e8bb9)[_0x0b91('0x18')](_0x17d6fd);};}exports[_0x0b91('0x19')]=function(_0xd44356,_0x4d5143){var _0x2df818={},_0x576a92={},_0x4e0134={'count':0x0,'rows':[]};var _0x3860af=_[_0x0b91('0x1a')](db[_0x0b91('0x1b')][_0x0b91('0x1c')],function(_0x140ba1){return{'name':_0x140ba1[_0x0b91('0x1d')],'type':_0x140ba1[_0x0b91('0x1e')][_0x0b91('0x1f')]};});_0x576a92[_0x0b91('0x20')]=_['map'](_0x3860af,'name');_0x576a92['query']=_['keys'](_0xd44356[_0x0b91('0x21')]);_0x576a92[_0x0b91('0x22')]=_[_0x0b91('0x23')](_0x576a92[_0x0b91('0x20')],_0x576a92[_0x0b91('0x21')]);_0x2df818[_0x0b91('0x24')]=_[_0x0b91('0x23')](_0x576a92[_0x0b91('0x20')],qs[_0x0b91('0x25')](_0xd44356[_0x0b91('0x21')][_0x0b91('0x25')]));_0x2df818[_0x0b91('0x24')]=_0x2df818['attributes'][_0x0b91('0x26')]?_0x2df818['attributes']:_0x576a92['model'];if(!_0xd44356[_0x0b91('0x21')]['hasOwnProperty'](_0x0b91('0x27'))){_0x2df818['limit']=qs[_0x0b91('0xc')](_0xd44356[_0x0b91('0x21')]['limit']);_0x2df818[_0x0b91('0xa')]=qs[_0x0b91('0xa')](_0xd44356['query']['offset']);}_0x2df818['order']=qs[_0x0b91('0x28')](_0xd44356[_0x0b91('0x21')][_0x0b91('0x28')]);_0x2df818[_0x0b91('0x29')]=qs[_0x0b91('0x22')](_[_0x0b91('0x2a')](_0xd44356[_0x0b91('0x21')],_0x576a92[_0x0b91('0x22')]),_0x3860af);if(_0xd44356[_0x0b91('0x21')][_0x0b91('0x2b')]){_0x2df818[_0x0b91('0x29')]=_['merge'](_0x2df818['where'],{'$or':_[_0x0b91('0x1a')](_0x3860af,function(_0x41c8f7){if(_0x41c8f7[_0x0b91('0x1e')]!==_0x0b91('0x2c')){var _0x1bf276={};_0x1bf276[_0x41c8f7[_0x0b91('0x17')]]={'$like':'%'+_0xd44356['query'][_0x0b91('0x2b')]+'%'};return _0x1bf276;}})});}_0x2df818=_[_0x0b91('0x2d')]({},_0x2df818,_0xd44356['options']);var _0x5e10d0={'where':_0x2df818[_0x0b91('0x29')]};return db[_0x0b91('0x1b')][_0x0b91('0xd')](_0x5e10d0)[_0x0b91('0x11')](function(_0x83c0d0){_0x4e0134['count']=_0x83c0d0;if(_0xd44356['query'][_0x0b91('0x2e')]){_0x2df818[_0x0b91('0x2f')]=[{'all':!![]}];}return db[_0x0b91('0x1b')][_0x0b91('0x30')](_0x2df818);})[_0x0b91('0x11')](function(_0x54050a){_0x4e0134[_0x0b91('0x31')]=_0x54050a;return _0x4e0134;})['then'](respondWithFilteredResult(_0x4d5143,_0x2df818))[_0x0b91('0x32')](handleError(_0x4d5143,null));};exports['show']=function(_0x4aa7fe,_0x5894a5){var _0x1fdc5b={'raw':![],'where':{'id':_0x4aa7fe[_0x0b91('0x33')]['id']}},_0x3dbaa4={};_0x3dbaa4['model']=_[_0x0b91('0x34')](db[_0x0b91('0x1b')][_0x0b91('0x1c')]);_0x3dbaa4[_0x0b91('0x21')]=_['keys'](_0x4aa7fe[_0x0b91('0x21')]);_0x3dbaa4['filters']=_[_0x0b91('0x23')](_0x3dbaa4[_0x0b91('0x20')],_0x3dbaa4[_0x0b91('0x21')]);_0x1fdc5b[_0x0b91('0x24')]=_[_0x0b91('0x23')](_0x3dbaa4['model'],qs[_0x0b91('0x25')](_0x4aa7fe[_0x0b91('0x21')]['fields']));_0x1fdc5b['attributes']=_0x1fdc5b[_0x0b91('0x24')][_0x0b91('0x26')]?_0x1fdc5b['attributes']:_0x3dbaa4[_0x0b91('0x20')];if(_0x4aa7fe[_0x0b91('0x21')][_0x0b91('0x2e')]){_0x1fdc5b['include']=[{'all':!![]}];}_0x1fdc5b=_['merge']({},_0x1fdc5b,_0x4aa7fe[_0x0b91('0x35')]);return db[_0x0b91('0x1b')][_0x0b91('0x36')](_0x1fdc5b)[_0x0b91('0x11')](handleEntityNotFound(_0x5894a5,null))[_0x0b91('0x11')](respondWithResult(_0x5894a5,null))[_0x0b91('0x32')](handleError(_0x5894a5,null));};exports[_0x0b91('0x37')]=function(_0x5e2e7a,_0x275b3c){return db[_0x0b91('0x1b')][_0x0b91('0x37')](_0x5e2e7a[_0x0b91('0x38')],{})['then'](respondWithResult(_0x275b3c,0xc9))[_0x0b91('0x32')](handleError(_0x275b3c,null));};exports[_0x0b91('0x10')]=function(_0x24bd16,_0x4295d5){if(_0x24bd16[_0x0b91('0x38')]['id']){delete _0x24bd16[_0x0b91('0x38')]['id'];}return db['Dynamics365Account'][_0x0b91('0x36')]({'where':{'id':_0x24bd16[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x4295d5,null))[_0x0b91('0x11')](saveUpdates(_0x24bd16['body'],null))[_0x0b91('0x11')](respondWithResult(_0x4295d5,null))[_0x0b91('0x32')](handleError(_0x4295d5,null));};exports['destroy']=function(_0x42e97f,_0x2b0414){return db[_0x0b91('0x1b')]['find']({'where':{'id':_0x42e97f[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x2b0414,null))[_0x0b91('0x11')](removeEntity(_0x2b0414,null))[_0x0b91('0x32')](handleError(_0x2b0414,null));};exports[_0x0b91('0x39')]=function(_0x12d9e3,_0x319b07){var _0x18d1f8={};var _0x2c7ddd={};var _0x1a1f74;var _0x2fa952;return db[_0x0b91('0x1b')][_0x0b91('0x3a')]({'where':{'id':_0x12d9e3[_0x0b91('0x33')]['id']}})[_0x0b91('0x11')](handleEntityNotFound(_0x319b07,null))['then'](function(_0x26007b){if(_0x26007b){_0x1a1f74=_0x26007b;_0x2c7ddd[_0x0b91('0x20')]=_[_0x0b91('0x34')](db[_0x0b91('0x3b')][_0x0b91('0x1c')]);_0x2c7ddd[_0x0b91('0x21')]=_[_0x0b91('0x34')](_0x12d9e3[_0x0b91('0x21')]);_0x2c7ddd[_0x0b91('0x22')]=_[_0x0b91('0x23')](_0x2c7ddd[_0x0b91('0x20')],_0x2c7ddd[_0x0b91('0x21')]);_0x18d1f8[_0x0b91('0x24')]=_['intersection'](_0x2c7ddd['model'],qs[_0x0b91('0x25')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x25')]));_0x18d1f8['attributes']=_0x18d1f8['attributes'][_0x0b91('0x26')]?_0x18d1f8[_0x0b91('0x24')]:_0x2c7ddd[_0x0b91('0x20')];_0x18d1f8[_0x0b91('0x3c')]=qs[_0x0b91('0x28')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x28')]);_0x18d1f8['where']=qs[_0x0b91('0x22')](_[_0x0b91('0x2a')](_0x12d9e3[_0x0b91('0x21')],_0x2c7ddd[_0x0b91('0x22')]));if(_0x12d9e3['query'][_0x0b91('0x2b')]){_0x18d1f8[_0x0b91('0x29')]=_['merge'](_0x18d1f8[_0x0b91('0x29')],{'$or':_[_0x0b91('0x1a')](_0x18d1f8[_0x0b91('0x24')],function(_0x3fd2eb){var _0x4d6f6b={};_0x4d6f6b[_0x3fd2eb]={'$like':'%'+_0x12d9e3['query'][_0x0b91('0x2b')]+'%'};return _0x4d6f6b;})});}_0x18d1f8=_[_0x0b91('0x2d')]({},_0x18d1f8,_0x12d9e3[_0x0b91('0x35')]);return _0x1a1f74[_0x0b91('0x39')](_0x18d1f8);}})[_0x0b91('0x11')](function(_0x112eb8){if(_0x112eb8){_0x2fa952=_0x112eb8['length'];if(!_0x12d9e3[_0x0b91('0x21')][_0x0b91('0x3d')](_0x0b91('0x27'))){_0x18d1f8[_0x0b91('0xc')]=qs[_0x0b91('0xc')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0xc')]);_0x18d1f8['offset']=qs[_0x0b91('0xa')](_0x12d9e3[_0x0b91('0x21')][_0x0b91('0xa')]);}return _0x1a1f74[_0x0b91('0x39')](_0x18d1f8);}})['then'](function(_0x173c35){if(_0x173c35){return _0x173c35?{'count':_0x2fa952,'rows':_0x173c35}:null;}})[_0x0b91('0x11')](respondWithResult(_0x319b07,null))[_0x0b91('0x32')](handleError(_0x319b07,null));};exports['addConfiguration']=function(_0x5be03c,_0x3d5ad0){if(_0x5be03c[_0x0b91('0x38')]['id']){delete _0x5be03c[_0x0b91('0x38')]['id'];}return db[_0x0b91('0x1b')][_0x0b91('0x3a')]({'where':{'id':_0x5be03c[_0x0b91('0x33')]['id']}})['then'](handleEntityNotFound(_0x3d5ad0,null))['then'](function(_0x26f2ba){if(_0x26f2ba){_0x5be03c['body'][_0x0b91('0x3e')]=_0x26f2ba['id'];_0x5be03c[_0x0b91('0x38')]['Subjects']=integrations[_0x0b91('0x3f')](_0x5be03c[_0x0b91('0x38')][_0x0b91('0x40')],_0x5be03c[_0x0b91('0x38')]['type']);_0x5be03c[_0x0b91('0x38')][_0x0b91('0x41')]=integrations[_0x0b91('0x42')](_0x5be03c[_0x0b91('0x38')][_0x0b91('0x40')],_0x5be03c['body'][_0x0b91('0x1e')]);return db[_0x0b91('0x3b')][_0x0b91('0x37')](_0x5be03c[_0x0b91('0x38')],{'include':[{'model':db[_0x0b91('0x43')],'as':'Subjects'},{'model':db[_0x0b91('0x43')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3d5ad0,null))[_0x0b91('0x32')](handleError(_0x3d5ad0,null));};function sanitizeRemoteUri(_0x4e29ef){var _0x42743f=_0x4e29ef[_0x0b91('0x44')](-0x1);if(_0x42743f==='/')return _0x4e29ef[_0x0b91('0x45')](0x0,_0x4e29ef['lastIndexOf'](_0x42743f));return _0x4e29ef;}function getWebApiUrl(_0x17288f){return util[_0x0b91('0x46')]('%s/api/data/v9.0/',_0x17288f);}exports[_0x0b91('0x47')]=function(_0x5ee6e9,_0x201b16){var _0x50fc50=_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0x48')];var _0x2c11e8=_0x50fc50===_0x0b91('0x49')?_0x0b91('0x4a'):'PhoneCall';var _0x4736a3='';var _0x5de550='';var _0x350281='';var _0x4a007d='';var _0x4f3e86='';var _0x3c88c3='';var _0x4c595a='';var _0x4bf42e='';var _0x28d73f=[_0x0b91('0x4b'),'description',_0x0b91('0x4c'),_0x0b91('0x4d'),_0x0b91('0x4e'),_0x0b91('0x4f'),'phonenumber',_0x0b91('0x50'),_0x0b91('0x51'),_0x0b91('0x52')];var _0x4f29d0=[_0x0b91('0x53'),_0x0b91('0x54'),'actualserviceunits','billedserviceunits',_0x0b91('0x55'),'contactidyominame',_0x0b91('0x56'),_0x0b91('0x57'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x0b91('0x58'),_0x0b91('0x59'),_0x0b91('0x5a'),_0x0b91('0x5b'),'createdonbehalfbyyominame',_0x0b91('0x5c'),'customeridtype','customeridyominame',_0x0b91('0x5d'),_0x0b91('0x5e'),_0x0b91('0x5f'),'entityimage_url',_0x0b91('0x60'),_0x0b91('0x61'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0x0b91('0x62'),'lastonholdtime','masteridname',_0x0b91('0x63'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x0b91('0x64'),'modifiedon',_0x0b91('0x65'),_0x0b91('0x66'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents',_0x0b91('0x67'),_0x0b91('0x68'),_0x0b91('0x69'),_0x0b91('0x6a'),'owneridyominame',_0x0b91('0x6b'),_0x0b91('0x6c'),_0x0b91('0x6d'),_0x0b91('0x6e'),'productidname',_0x0b91('0x6f'),_0x0b91('0x70'),_0x0b91('0x71'),'responseby',_0x0b91('0x72'),_0x0b91('0x73'),_0x0b91('0x74'),_0x0b91('0x75'),_0x0b91('0x76'),_0x0b91('0x77'),_0x0b91('0x78'),_0x0b91('0x79'),_0x0b91('0x7a'),_0x0b91('0x7b'),_0x0b91('0x7c'),_0x0b91('0x7d'),_0x0b91('0x7e'),'utcconversiontimezonecode','versionnumber'];var _0x5b26b4=_0x28d73f['concat'](_0x4f29d0);return db[_0x0b91('0x1b')]['findOne']({'where':{'id':_0x5ee6e9[_0x0b91('0x33')]['id']},'attributes':['id',_0x0b91('0x7f'),_0x0b91('0x80'),'remoteUri','tenantId','clientId',_0x0b91('0x81'),_0x0b91('0x82')],'include':[{'model':db[_0x0b91('0x83')],'as':_0x0b91('0x83'),'attributes':['id',_0x0b91('0x84'),'data7']}]})['then'](handleEntityNotFound(_0x201b16,null))[_0x0b91('0x11')](function(_0x117d04){if(_0x117d04){if(_0x117d04[_0x0b91('0x82')]){_0x117d04['access_token']=_0x117d04[_0x0b91('0x83')][_0x0b91('0x84')];_0x4bf42e=sanitizeRemoteUri(_0x117d04[_0x0b91('0x83')][_0x0b91('0x85')]);_0x4c595a=getWebApiUrl(_0x4bf42e);return _0x117d04;}_0x4bf42e=sanitizeRemoteUri(_0x117d04['remoteUri']);_0x4c595a=getWebApiUrl(_0x4bf42e);var _0x4070f4={'method':'POST','uri':_0x0b91('0x86')+_0x117d04[_0x0b91('0x87')]+'/oauth2/token','form':{'client_id':_0x117d04[_0x0b91('0x88')],'resource':_0x4bf42e,'username':_0x117d04[_0x0b91('0x7f')],'password':_0x117d04['password'],'grant_type':_0x0b91('0x80'),'client_secret':_0x117d04[_0x0b91('0x81')]},'json':!![]};return rp(_0x4070f4);}})['then'](function(_0x24c1b4){_0x3c88c3=_0x24c1b4['access_token'];var _0x51f261={'method':'GET','uri':encodeURI(_0x4c595a+_0x0b91('0x89')+_0x2c11e8+'\x27'),'headers':{'Authorization':_0x0b91('0x8a')+_0x3c88c3,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x51f261);})['then'](function(_0x3fda87){var _0x5de17c=_0x3fda87[_0x0b91('0x8b')][0x0];var _0x46ea07=_0x5de17c[_0x0b91('0x8c')];var _0x28e543={'method':_0x0b91('0x8d'),'uri':_0x4c595a+_0x0b91('0x8e')+_0x46ea07+_0x0b91('0x8f'),'headers':{'Authorization':_0x0b91('0x8a')+_0x3c88c3,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x28e543);})[_0x0b91('0x11')](function(_0x1475e3){_0x4736a3=_0x1475e3;_0x5de550=_0x4736a3[_0x0b91('0x91')];_0x5de550=_[_0x0b91('0x92')](_0x5de550,function(_0x2f2588){return!_0x5b26b4[_0x0b91('0x93')](_0x2f2588[_0x0b91('0x94')]);});var _0x740ddb=[];var _0x405108=[];_0x5de550['forEach'](function(_0xd26c8f){if(_0xd26c8f[_0x0b91('0x95')]){var _0x4352da=_0xd26c8f[_0x0b91('0x95')][_0x0b91('0x45')](_0xd26c8f[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0x4352da===_0x0b91('0x97')){_0x740ddb[_0x0b91('0x98')](getSelectList(_0x4c595a,_0x50fc50,_0x405108,_0x4736a3['MetadataId'],_0xd26c8f[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x740ddb);})['then'](function(_0x482f25){_0x350281=_0x482f25[0x0];var _0x309430=[];var _0x3d7a39=[];_0x5de550['forEach'](function(_0x562075){if(!_[_0x0b91('0x9a')](_0x562075[_0x0b91('0x95')])){var _0x487206=_0x562075[_0x0b91('0x95')][_0x0b91('0x45')](_0x562075[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0x487206===_0x0b91('0x9b')){_0x309430['push'](getBooleanList(_0x4c595a,_0x50fc50,_0x3d7a39,_0x4736a3[_0x0b91('0x8c')],_0x562075[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x309430);})[_0x0b91('0x11')](function(_0x346a03){_0x4a007d=_0x346a03[0x0];var _0x43dc52=[];var _0x2e2fa5=[];_0x5de550[_0x0b91('0x9c')](function(_0x325ad8){if(_0x325ad8[_0x0b91('0x95')]){var _0xdd2676=_0x325ad8[_0x0b91('0x95')][_0x0b91('0x45')](_0x325ad8[_0x0b91('0x95')][_0x0b91('0x96')]('.')+0x1);if(_0xdd2676===_0x0b91('0x9d')||_0xdd2676==='DoubleAttributeMetadata'||_0xdd2676==='BigIntAttributeMetadata'||_0xdd2676===_0x0b91('0x9e')||_0xdd2676===_0x0b91('0x9f')||_0xdd2676===_0x0b91('0xa0')||_0xdd2676===_0x0b91('0xa1')||_0xdd2676===_0x0b91('0xa2')||_0xdd2676==='StateAttributeMetadata'||_0xdd2676===_0x0b91('0xa3')){_0x43dc52['push'](getInputList(_0x4c595a,_0x50fc50,_0xdd2676,_0x2e2fa5,_0x4736a3[_0x0b91('0x8c')],_0x325ad8[_0x0b91('0x8c')],_0x3c88c3));}}});return Promise[_0x0b91('0x99')](_0x43dc52);})[_0x0b91('0x11')](function(_0x56a959){_0x4f3e86=_0x56a959[0x0];var _0x22ca6d=_0x350281[_0x0b91('0xa4')](_0x4a007d)[_0x0b91('0xa4')](_0x4f3e86);var _0x3e8a64={'count':_0x22ca6d[_0x0b91('0x26')],'rows':_0x22ca6d};return _0x3e8a64;})['then'](respondWithResult(_0x201b16,null))['catch'](function(_0x73b219){var _0x533adb=_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0xa5')]?0x1f4:_0x73b219[_0x0b91('0xa6')]||0x1f4;logger[_0x0b91('0x15')](_0x73b219['stack']);delete _0x73b219[_0x0b91('0x17')];if(_0x533adb===0x191){_0x533adb=0x190;}_0x201b16[_0x0b91('0x8')](_0x533adb)[_0x0b91('0x18')](_0x5ee6e9[_0x0b91('0x21')][_0x0b91('0xa5')]?{'message':_0x0b91('0xa7'),'statusCode':_0x73b219['statusCode']}:_0x73b219);});};function getSelectList(_0x6305a8,_0x53eab9,_0x1bda63,_0x455126,_0x5b6b05,_0x5870f3){var _0x409db6={'method':_0x0b91('0x8d'),'uri':_0x6305a8+_0x0b91('0x8e')+_0x455126+')/Attributes('+_0x5b6b05+_0x0b91('0xa8')+_0x0b91('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0x5870f3,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x409db6)['then'](function(_0x1736d9){var _0x33f7e8=[];var _0x2db89e=_0x1736d9[_0x0b91('0xaa')]['Options'];_0x2db89e['forEach'](function(_0x4c9de2){_0x33f7e8[_0x0b91('0x98')]({'name':_0x4c9de2[_0x0b91('0xab')][_0x0b91('0xac')]['Label'],'value':String(_0x4c9de2[_0x0b91('0xad')])});});var _0x481419={'id':_0x53eab9+'_'+_0x1736d9[_0x0b91('0x94')],'name':_0x1736d9['DisplayName'][_0x0b91('0xac')][_0x0b91('0xab')],'custom':![],'options':_0x33f7e8};_0x1bda63[_0x0b91('0x98')](_0x481419);return _0x1bda63;});}function getBooleanList(_0x26c39e,_0x12fd77,_0x341ec7,_0x1824d2,_0x49f2bb,_0xafaba){var _0x5c300a={'method':'GET','uri':_0x26c39e+_0x0b91('0x8e')+_0x1824d2+_0x0b91('0xae')+_0x49f2bb+_0x0b91('0xaf'),'headers':{'Authorization':_0x0b91('0x8a')+_0xafaba,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x5c300a)[_0x0b91('0x11')](function(_0x343f74){var _0x1d822e=[];_0x1d822e[_0x0b91('0x98')]({'name':_0x343f74[_0x0b91('0xaa')]['TrueOption'][_0x0b91('0xab')][_0x0b91('0xac')][_0x0b91('0xab')],'value':'true'},{'name':_0x343f74[_0x0b91('0xaa')][_0x0b91('0xb0')][_0x0b91('0xab')][_0x0b91('0xac')][_0x0b91('0xab')],'value':_0x0b91('0xb1')});var _0x481f87={'id':_0x12fd77+'_'+_0x343f74['LogicalName'],'name':_0x343f74['DisplayName']['UserLocalizedLabel'][_0x0b91('0xab')],'custom':![],'options':_0x1d822e};_0x341ec7[_0x0b91('0x98')](_0x481f87);return _0x341ec7;});}function getInputList(_0x2a6999,_0x31dff6,_0x28854d,_0x4a4856,_0x985136,_0x2a6c29,_0x5c3c3d){var _0x37e686={'method':_0x0b91('0x8d'),'uri':_0x2a6999+_0x0b91('0x8e')+_0x985136+_0x0b91('0xae')+_0x2a6c29+')/Microsoft.Dynamics.CRM.'+_0x28854d+_0x0b91('0xb2'),'headers':{'Authorization':'Bearer\x20'+_0x5c3c3d,'If-None-Match':null,'OData-Version':_0x0b91('0x90')},'json':!![]};return rp(_0x37e686)[_0x0b91('0x11')](function(_0x58b257){var _0x542b69={'id':_0x31dff6+'_'+_0x58b257['LogicalName'],'name':_0x58b257[_0x0b91('0xb3')][_0x0b91('0xac')]?_0x58b257['DisplayName'][_0x0b91('0xac')][_0x0b91('0xab')]:_0x58b257[_0x0b91('0x94')],'custom':![],'options':[]};_0x4a4856[_0x0b91('0x98')](_0x542b69);return _0x4a4856;});} \ No newline at end of file +var _0xae60=['resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','tenantId','CloudProvider','data7','modernAuthentication','access_token','remoteUri','POST','https://login.microsoftonline.com/','clientId','username','password','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','DisplayName','TrueOption','UserLocalizedLabel','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','filter','options','include','rows','catch','includeAll','find','create','body','params','findOne','Dynamics365Configuration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby'];(function(_0x5131e9,_0x1c4d14){var _0x23e761=function(_0xa51e8e){while(--_0xa51e8e){_0x5131e9['push'](_0x5131e9['shift']());}};_0x23e761(++_0x1c4d14);}(_0xae60,0x1c7));var _0x0ae6=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xae60[_0x220f3f];return _0x1f170e;};'use strict';var rp=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var _=require(_0x0ae6('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x0ae6('0x3'))(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x4c014f,_0x470e83){_0x470e83=_0x470e83||0xc8;return function(_0x47c9e0){if(_0x47c9e0){return _0x4c014f[_0x0ae6('0x6')](_0x470e83)[_0x0ae6('0x7')](_0x47c9e0);}};}function respondWithFilteredResult(_0x30e000,_0x46fed4){return function(_0xbb596c){if(_0xbb596c){var _0x447a1d=typeof _0x46fed4[_0x0ae6('0x8')]===_0x0ae6('0x9')&&typeof _0x46fed4['limit']===_0x0ae6('0x9');var _0x36a5e0=_0xbb596c[_0x0ae6('0xa')];var _0x39787a=_0x447a1d?0x0:_0x46fed4['offset'];var _0x24e211=_0x447a1d?_0xbb596c[_0x0ae6('0xa')]:_0x46fed4[_0x0ae6('0x8')]+_0x46fed4[_0x0ae6('0xb')];var _0x3ae7fa;if(_0x24e211>=_0x36a5e0){_0x24e211=_0x36a5e0;_0x3ae7fa=0xc8;}else{_0x3ae7fa=0xce;}_0x30e000[_0x0ae6('0x6')](_0x3ae7fa);return _0x30e000[_0x0ae6('0xc')](_0x0ae6('0xd'),_0x39787a+'-'+_0x24e211+'/'+_0x36a5e0)[_0x0ae6('0x7')](_0xbb596c);}return null;};}function saveUpdates(_0x30f8f9){return function(_0x1aefd5){if(_0x1aefd5){return _0x1aefd5[_0x0ae6('0xe')](_0x30f8f9)[_0x0ae6('0xf')](function(_0xf311f7){return _0xf311f7;});}return null;};}function removeEntity(_0x4d2da8){return function(_0x3809c6){if(_0x3809c6){return _0x3809c6[_0x0ae6('0x10')]()[_0x0ae6('0xf')](function(){_0x4d2da8[_0x0ae6('0x6')](0xcc)[_0x0ae6('0x11')]();});}};}function handleEntityNotFound(_0x3a1e26){return function(_0x151144){if(!_0x151144){_0x3a1e26[_0x0ae6('0x12')](0x194);}return _0x151144;};}function handleError(_0xa797bb,_0x13ba83){_0x13ba83=_0x13ba83||0x1f4;return function(_0x8a4c9a){logger[_0x0ae6('0x13')](_0x8a4c9a[_0x0ae6('0x14')]);if(_0x8a4c9a[_0x0ae6('0x15')]){delete _0x8a4c9a[_0x0ae6('0x15')];}_0xa797bb[_0x0ae6('0x6')](_0x13ba83)[_0x0ae6('0x16')](_0x8a4c9a);};}exports[_0x0ae6('0x17')]=function(_0x2ca2a3,_0x9e2c46){var _0x26b369={},_0x191eaf={},_0x491a74={'count':0x0,'rows':[]};var _0x401f49=_[_0x0ae6('0x18')](db[_0x0ae6('0x19')][_0x0ae6('0x1a')],function(_0x9c4075){return{'name':_0x9c4075[_0x0ae6('0x1b')],'type':_0x9c4075[_0x0ae6('0x1c')][_0x0ae6('0x1d')]};});_0x191eaf['model']=_[_0x0ae6('0x18')](_0x401f49,_0x0ae6('0x15'));_0x191eaf[_0x0ae6('0x1e')]=_[_0x0ae6('0x1f')](_0x2ca2a3[_0x0ae6('0x1e')]);_0x191eaf['filters']=_[_0x0ae6('0x20')](_0x191eaf[_0x0ae6('0x21')],_0x191eaf[_0x0ae6('0x1e')]);_0x26b369[_0x0ae6('0x22')]=_[_0x0ae6('0x20')](_0x191eaf[_0x0ae6('0x21')],qs['fields'](_0x2ca2a3[_0x0ae6('0x1e')][_0x0ae6('0x23')]));_0x26b369['attributes']=_0x26b369['attributes'][_0x0ae6('0x24')]?_0x26b369[_0x0ae6('0x22')]:_0x191eaf[_0x0ae6('0x21')];if(!_0x2ca2a3['query'][_0x0ae6('0x25')](_0x0ae6('0x26'))){_0x26b369[_0x0ae6('0xb')]=qs['limit'](_0x2ca2a3[_0x0ae6('0x1e')][_0x0ae6('0xb')]);_0x26b369[_0x0ae6('0x8')]=qs[_0x0ae6('0x8')](_0x2ca2a3[_0x0ae6('0x1e')][_0x0ae6('0x8')]);}_0x26b369['order']=qs['sort'](_0x2ca2a3[_0x0ae6('0x1e')][_0x0ae6('0x27')]);_0x26b369['where']=qs['filters'](_[_0x0ae6('0x28')](_0x2ca2a3[_0x0ae6('0x1e')],_0x191eaf[_0x0ae6('0x29')]),_0x401f49);if(_0x2ca2a3[_0x0ae6('0x1e')]['filter']){_0x26b369[_0x0ae6('0x2a')]=_[_0x0ae6('0x2b')](_0x26b369[_0x0ae6('0x2a')],{'$or':_['map'](_0x401f49,function(_0x2f25cd){if(_0x2f25cd[_0x0ae6('0x1c')]!==_0x0ae6('0x2c')){var _0xe2fbf5={};_0xe2fbf5[_0x2f25cd[_0x0ae6('0x15')]]={'$like':'%'+_0x2ca2a3[_0x0ae6('0x1e')][_0x0ae6('0x2d')]+'%'};return _0xe2fbf5;}})});}_0x26b369=_[_0x0ae6('0x2b')]({},_0x26b369,_0x2ca2a3[_0x0ae6('0x2e')]);var _0x3a8b9c={'where':_0x26b369['where']};return db[_0x0ae6('0x19')][_0x0ae6('0xa')](_0x3a8b9c)['then'](function(_0x3264d5){_0x491a74[_0x0ae6('0xa')]=_0x3264d5;if(_0x2ca2a3[_0x0ae6('0x1e')]['includeAll']){_0x26b369[_0x0ae6('0x2f')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x26b369);})[_0x0ae6('0xf')](function(_0x404f2e){_0x491a74[_0x0ae6('0x30')]=_0x404f2e;return _0x491a74;})[_0x0ae6('0xf')](respondWithFilteredResult(_0x9e2c46,_0x26b369))[_0x0ae6('0x31')](handleError(_0x9e2c46,null));};exports['show']=function(_0x584dc8,_0x38000e){var _0x5231a3={'raw':![],'where':{'id':_0x584dc8['params']['id']}},_0x5a4403={};_0x5a4403[_0x0ae6('0x21')]=_['keys'](db[_0x0ae6('0x19')][_0x0ae6('0x1a')]);_0x5a4403[_0x0ae6('0x1e')]=_[_0x0ae6('0x1f')](_0x584dc8['query']);_0x5a4403['filters']=_[_0x0ae6('0x20')](_0x5a4403[_0x0ae6('0x21')],_0x5a4403[_0x0ae6('0x1e')]);_0x5231a3['attributes']=_[_0x0ae6('0x20')](_0x5a4403['model'],qs[_0x0ae6('0x23')](_0x584dc8[_0x0ae6('0x1e')][_0x0ae6('0x23')]));_0x5231a3[_0x0ae6('0x22')]=_0x5231a3[_0x0ae6('0x22')][_0x0ae6('0x24')]?_0x5231a3['attributes']:_0x5a4403[_0x0ae6('0x21')];if(_0x584dc8[_0x0ae6('0x1e')][_0x0ae6('0x32')]){_0x5231a3[_0x0ae6('0x2f')]=[{'all':!![]}];}_0x5231a3=_[_0x0ae6('0x2b')]({},_0x5231a3,_0x584dc8[_0x0ae6('0x2e')]);return db[_0x0ae6('0x19')][_0x0ae6('0x33')](_0x5231a3)['then'](handleEntityNotFound(_0x38000e,null))[_0x0ae6('0xf')](respondWithResult(_0x38000e,null))[_0x0ae6('0x31')](handleError(_0x38000e,null));};exports[_0x0ae6('0x34')]=function(_0x15d791,_0x41721b){return db[_0x0ae6('0x19')][_0x0ae6('0x34')](_0x15d791[_0x0ae6('0x35')],{})[_0x0ae6('0xf')](respondWithResult(_0x41721b,0xc9))[_0x0ae6('0x31')](handleError(_0x41721b,null));};exports[_0x0ae6('0xe')]=function(_0x1a3327,_0x22a3f4){if(_0x1a3327[_0x0ae6('0x35')]['id']){delete _0x1a3327[_0x0ae6('0x35')]['id'];}return db[_0x0ae6('0x19')][_0x0ae6('0x33')]({'where':{'id':_0x1a3327[_0x0ae6('0x36')]['id']}})['then'](handleEntityNotFound(_0x22a3f4,null))[_0x0ae6('0xf')](saveUpdates(_0x1a3327[_0x0ae6('0x35')],null))[_0x0ae6('0xf')](respondWithResult(_0x22a3f4,null))[_0x0ae6('0x31')](handleError(_0x22a3f4,null));};exports[_0x0ae6('0x10')]=function(_0x3e1228,_0x48fb98){return db[_0x0ae6('0x19')][_0x0ae6('0x33')]({'where':{'id':_0x3e1228[_0x0ae6('0x36')]['id']}})[_0x0ae6('0xf')](handleEntityNotFound(_0x48fb98,null))['then'](removeEntity(_0x48fb98,null))['catch'](handleError(_0x48fb98,null));};exports['getConfigurations']=function(_0x295d06,_0x2b76a2){var _0xcc6fcf={};var _0x4ff1de={};var _0x1e2385;var _0x17a674;return db['Dynamics365Account'][_0x0ae6('0x37')]({'where':{'id':_0x295d06[_0x0ae6('0x36')]['id']}})['then'](handleEntityNotFound(_0x2b76a2,null))[_0x0ae6('0xf')](function(_0x3d1e75){if(_0x3d1e75){_0x1e2385=_0x3d1e75;_0x4ff1de['model']=_[_0x0ae6('0x1f')](db[_0x0ae6('0x38')][_0x0ae6('0x1a')]);_0x4ff1de['query']=_[_0x0ae6('0x1f')](_0x295d06[_0x0ae6('0x1e')]);_0x4ff1de[_0x0ae6('0x29')]=_[_0x0ae6('0x20')](_0x4ff1de[_0x0ae6('0x21')],_0x4ff1de[_0x0ae6('0x1e')]);_0xcc6fcf[_0x0ae6('0x22')]=_['intersection'](_0x4ff1de['model'],qs[_0x0ae6('0x23')](_0x295d06[_0x0ae6('0x1e')][_0x0ae6('0x23')]));_0xcc6fcf['attributes']=_0xcc6fcf[_0x0ae6('0x22')]['length']?_0xcc6fcf['attributes']:_0x4ff1de[_0x0ae6('0x21')];_0xcc6fcf[_0x0ae6('0x39')]=qs[_0x0ae6('0x27')](_0x295d06['query'][_0x0ae6('0x27')]);_0xcc6fcf[_0x0ae6('0x2a')]=qs[_0x0ae6('0x29')](_[_0x0ae6('0x28')](_0x295d06[_0x0ae6('0x1e')],_0x4ff1de[_0x0ae6('0x29')]));if(_0x295d06[_0x0ae6('0x1e')][_0x0ae6('0x2d')]){_0xcc6fcf[_0x0ae6('0x2a')]=_[_0x0ae6('0x2b')](_0xcc6fcf[_0x0ae6('0x2a')],{'$or':_[_0x0ae6('0x18')](_0xcc6fcf[_0x0ae6('0x22')],function(_0x30cd09){var _0x101187={};_0x101187[_0x30cd09]={'$like':'%'+_0x295d06['query']['filter']+'%'};return _0x101187;})});}_0xcc6fcf=_[_0x0ae6('0x2b')]({},_0xcc6fcf,_0x295d06[_0x0ae6('0x2e')]);return _0x1e2385[_0x0ae6('0x3a')](_0xcc6fcf);}})[_0x0ae6('0xf')](function(_0x35eda4){if(_0x35eda4){_0x17a674=_0x35eda4[_0x0ae6('0x24')];if(!_0x295d06[_0x0ae6('0x1e')][_0x0ae6('0x25')](_0x0ae6('0x26'))){_0xcc6fcf[_0x0ae6('0xb')]=qs[_0x0ae6('0xb')](_0x295d06[_0x0ae6('0x1e')][_0x0ae6('0xb')]);_0xcc6fcf[_0x0ae6('0x8')]=qs[_0x0ae6('0x8')](_0x295d06[_0x0ae6('0x1e')][_0x0ae6('0x8')]);}return _0x1e2385[_0x0ae6('0x3a')](_0xcc6fcf);}})['then'](function(_0x26d313){if(_0x26d313){return _0x26d313?{'count':_0x17a674,'rows':_0x26d313}:null;}})[_0x0ae6('0xf')](respondWithResult(_0x2b76a2,null))[_0x0ae6('0x31')](handleError(_0x2b76a2,null));};exports[_0x0ae6('0x3b')]=function(_0x2648de,_0x1dc337){if(_0x2648de[_0x0ae6('0x35')]['id']){delete _0x2648de[_0x0ae6('0x35')]['id'];}return db[_0x0ae6('0x19')][_0x0ae6('0x37')]({'where':{'id':_0x2648de['params']['id']}})[_0x0ae6('0xf')](handleEntityNotFound(_0x1dc337,null))[_0x0ae6('0xf')](function(_0x1c53bf){if(_0x1c53bf){_0x2648de[_0x0ae6('0x35')][_0x0ae6('0x3c')]=_0x1c53bf['id'];_0x2648de[_0x0ae6('0x35')][_0x0ae6('0x3d')]=integrations[_0x0ae6('0x3e')](_0x2648de[_0x0ae6('0x35')]['channel'],_0x2648de['body'][_0x0ae6('0x1c')]);_0x2648de[_0x0ae6('0x35')]['Descriptions']=integrations['getDescriptions'](_0x2648de[_0x0ae6('0x35')][_0x0ae6('0x3f')],_0x2648de[_0x0ae6('0x35')][_0x0ae6('0x1c')]);return db[_0x0ae6('0x38')][_0x0ae6('0x34')](_0x2648de[_0x0ae6('0x35')],{'include':[{'model':db['Dynamics365Field'],'as':_0x0ae6('0x3d')},{'model':db['Dynamics365Field'],'as':_0x0ae6('0x40')}]});}return null;})[_0x0ae6('0xf')](respondWithResult(_0x1dc337,null))['catch'](handleError(_0x1dc337,null));};function sanitizeRemoteUri(_0x45f83a){var _0x40fb9d=_0x45f83a[_0x0ae6('0x41')](-0x1);if(_0x40fb9d==='/')return _0x45f83a['substring'](0x0,_0x45f83a[_0x0ae6('0x42')](_0x40fb9d));return _0x45f83a;}function getWebApiUrl(_0x47ed1e){return util[_0x0ae6('0x43')](_0x0ae6('0x44'),_0x47ed1e);}exports[_0x0ae6('0x45')]=function(_0x12c43d,_0x54fff7){var _0x4d74f7=_0x12c43d[_0x0ae6('0x1e')][_0x0ae6('0x46')];var _0x3adf94=_0x4d74f7===_0x0ae6('0x47')?_0x0ae6('0x48'):_0x0ae6('0x49');var _0x51d3c6='';var _0x5e941e='';var _0x4a9c4a='';var _0x1e1f3a='';var _0x39846c='';var _0x214e44='';var _0x2bafcc='';var _0x15f38f='';var _0x3a06a1=[_0x0ae6('0x4a'),'description',_0x0ae6('0x4b'),_0x0ae6('0x4c'),_0x0ae6('0x4d'),_0x0ae6('0x4e'),_0x0ae6('0x4f'),_0x0ae6('0x50'),'directioncode','phonecall_activity_parties'];var _0x35068d=[_0x0ae6('0x51'),'accountidyominame',_0x0ae6('0x52'),_0x0ae6('0x53'),_0x0ae6('0x54'),_0x0ae6('0x55'),'contractdetailidname',_0x0ae6('0x56'),_0x0ae6('0x57'),_0x0ae6('0x58'),_0x0ae6('0x59'),_0x0ae6('0x5a'),_0x0ae6('0x5b'),_0x0ae6('0x5c'),_0x0ae6('0x5d'),'customeridname',_0x0ae6('0x5e'),_0x0ae6('0x5f'),_0x0ae6('0x60'),_0x0ae6('0x61'),_0x0ae6('0x62'),_0x0ae6('0x63'),_0x0ae6('0x64'),_0x0ae6('0x65'),_0x0ae6('0x66'),_0x0ae6('0x67'),_0x0ae6('0x68'),_0x0ae6('0x69'),_0x0ae6('0x6a'),_0x0ae6('0x6b'),_0x0ae6('0x6c'),_0x0ae6('0x6d'),_0x0ae6('0x6e'),_0x0ae6('0x6f'),_0x0ae6('0x70'),_0x0ae6('0x71'),_0x0ae6('0x72'),'modifiedonbehalfbyyominame',_0x0ae6('0x73'),_0x0ae6('0x74'),_0x0ae6('0x75'),_0x0ae6('0x76'),'overriddencreatedon',_0x0ae6('0x77'),_0x0ae6('0x78'),_0x0ae6('0x79'),_0x0ae6('0x7a'),_0x0ae6('0x7b'),_0x0ae6('0x7c'),'prioritycodename',_0x0ae6('0x7d'),'productserialnumber',_0x0ae6('0x7e'),_0x0ae6('0x7f'),_0x0ae6('0x80'),_0x0ae6('0x81'),_0x0ae6('0x82'),_0x0ae6('0x83'),_0x0ae6('0x84'),'slaname','socialprofileidname',_0x0ae6('0x85'),_0x0ae6('0x86'),_0x0ae6('0x87'),_0x0ae6('0x88'),'timezoneruleversionnumber',_0x0ae6('0x89'),_0x0ae6('0x8a'),'utcconversiontimezonecode',_0x0ae6('0x8b')];var _0x3c764b=_0x3a06a1[_0x0ae6('0x8c')](_0x35068d);return db[_0x0ae6('0x19')][_0x0ae6('0x37')]({'where':{'id':_0x12c43d[_0x0ae6('0x36')]['id']},'attributes':['id','username','password','remoteUri',_0x0ae6('0x8d'),'clientId','clientSecret','modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x0ae6('0x8e'),'attributes':['id','data5',_0x0ae6('0x8f')]}]})['then'](handleEntityNotFound(_0x54fff7,null))[_0x0ae6('0xf')](function(_0x2c6fc6){if(_0x2c6fc6){if(_0x2c6fc6[_0x0ae6('0x90')]){_0x2c6fc6[_0x0ae6('0x91')]=_0x2c6fc6[_0x0ae6('0x8e')]['data5'];_0x15f38f=sanitizeRemoteUri(_0x2c6fc6[_0x0ae6('0x8e')][_0x0ae6('0x8f')]);_0x2bafcc=getWebApiUrl(_0x15f38f);return _0x2c6fc6;}_0x15f38f=sanitizeRemoteUri(_0x2c6fc6[_0x0ae6('0x92')]);_0x2bafcc=getWebApiUrl(_0x15f38f);var _0x1f63c2={'method':_0x0ae6('0x93'),'uri':_0x0ae6('0x94')+_0x2c6fc6[_0x0ae6('0x8d')]+'/oauth2/token','form':{'client_id':_0x2c6fc6[_0x0ae6('0x95')],'resource':_0x15f38f,'username':_0x2c6fc6[_0x0ae6('0x96')],'password':_0x2c6fc6[_0x0ae6('0x97')],'grant_type':_0x0ae6('0x97'),'client_secret':_0x2c6fc6[_0x0ae6('0x98')]},'json':!![]};return rp(_0x1f63c2);}})[_0x0ae6('0xf')](function(_0x4c056d){_0x214e44=_0x4c056d['access_token'];var _0x4831b4={'method':_0x0ae6('0x99'),'uri':encodeURI(_0x2bafcc+_0x0ae6('0x9a')+_0x3adf94+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x214e44,'If-None-Match':null,'OData-Version':_0x0ae6('0x9b')},'json':!![]};return rp(_0x4831b4);})[_0x0ae6('0xf')](function(_0x1801a4){var _0x483dc2=_0x1801a4['value'][0x0];var _0x2c9aab=_0x483dc2[_0x0ae6('0x9c')];var _0x554690={'method':'GET','uri':_0x2bafcc+_0x0ae6('0x9d')+_0x2c9aab+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x214e44,'If-None-Match':null,'OData-Version':_0x0ae6('0x9b')},'json':!![]};return rp(_0x554690);})['then'](function(_0x577bda){_0x51d3c6=_0x577bda;_0x5e941e=_0x51d3c6[_0x0ae6('0x9e')];_0x5e941e=_[_0x0ae6('0x9f')](_0x5e941e,function(_0x4c4b99){return!_0x3c764b[_0x0ae6('0xa0')](_0x4c4b99[_0x0ae6('0xa1')]);});var _0x49f1d1=[];var _0x379f21=[];_0x5e941e[_0x0ae6('0xa2')](function(_0x4d6bad){if(_0x4d6bad[_0x0ae6('0xa3')]){var _0x4c376b=_0x4d6bad[_0x0ae6('0xa3')]['substring'](_0x4d6bad[_0x0ae6('0xa3')][_0x0ae6('0x42')]('.')+0x1);if(_0x4c376b==='PicklistAttributeMetadata'){_0x49f1d1[_0x0ae6('0xa4')](getSelectList(_0x2bafcc,_0x4d74f7,_0x379f21,_0x51d3c6[_0x0ae6('0x9c')],_0x4d6bad['MetadataId'],_0x214e44));}}});return Promise[_0x0ae6('0xa5')](_0x49f1d1);})[_0x0ae6('0xf')](function(_0x35ecb4){_0x4a9c4a=_0x35ecb4[0x0];var _0x3e7890=[];var _0x1cadd1=[];_0x5e941e[_0x0ae6('0xa2')](function(_0x1412b5){if(!_[_0x0ae6('0xa6')](_0x1412b5[_0x0ae6('0xa3')])){var _0x10698e=_0x1412b5[_0x0ae6('0xa3')][_0x0ae6('0xa7')](_0x1412b5['@odata.type']['lastIndexOf']('.')+0x1);if(_0x10698e===_0x0ae6('0xa8')){_0x3e7890[_0x0ae6('0xa4')](getBooleanList(_0x2bafcc,_0x4d74f7,_0x1cadd1,_0x51d3c6[_0x0ae6('0x9c')],_0x1412b5[_0x0ae6('0x9c')],_0x214e44));}}});return Promise['all'](_0x3e7890);})[_0x0ae6('0xf')](function(_0x1d071b){_0x1e1f3a=_0x1d071b[0x0];var _0x59ae72=[];var _0x3d060a=[];_0x5e941e[_0x0ae6('0xa2')](function(_0xb7e7c5){if(_0xb7e7c5[_0x0ae6('0xa3')]){var _0xcc1f01=_0xb7e7c5[_0x0ae6('0xa3')][_0x0ae6('0xa7')](_0xb7e7c5['@odata.type']['lastIndexOf']('.')+0x1);if(_0xcc1f01===_0x0ae6('0xa9')||_0xcc1f01===_0x0ae6('0xaa')||_0xcc1f01==='BigIntAttributeMetadata'||_0xcc1f01===_0x0ae6('0xab')||_0xcc1f01===_0x0ae6('0xac')||_0xcc1f01==='DateTimeAttributeMetadata'||_0xcc1f01===_0x0ae6('0xad')||_0xcc1f01===_0x0ae6('0xae')||_0xcc1f01===_0x0ae6('0xaf')||_0xcc1f01===_0x0ae6('0xb0')){_0x59ae72[_0x0ae6('0xa4')](getInputList(_0x2bafcc,_0x4d74f7,_0xcc1f01,_0x3d060a,_0x51d3c6['MetadataId'],_0xb7e7c5[_0x0ae6('0x9c')],_0x214e44));}}});return Promise[_0x0ae6('0xa5')](_0x59ae72);})['then'](function(_0x590b04){_0x39846c=_0x590b04[0x0];var _0x5edef8=_0x4a9c4a[_0x0ae6('0x8c')](_0x1e1f3a)['concat'](_0x39846c);var _0x5d0b1e={'count':_0x5edef8[_0x0ae6('0x24')],'rows':_0x5edef8};return _0x5d0b1e;})[_0x0ae6('0xf')](respondWithResult(_0x54fff7,null))[_0x0ae6('0x31')](function(_0x19c4dc){var _0x47d615=_0x12c43d['query'][_0x0ae6('0xb1')]?0x1f4:_0x19c4dc['statusCode']||0x1f4;logger[_0x0ae6('0x13')](_0x19c4dc[_0x0ae6('0x14')]);delete _0x19c4dc[_0x0ae6('0x15')];if(_0x47d615===0x191){_0x47d615=0x190;}_0x54fff7[_0x0ae6('0x6')](_0x47d615)['send'](_0x12c43d['query'][_0x0ae6('0xb1')]?{'message':_0x0ae6('0xb2'),'statusCode':_0x19c4dc[_0x0ae6('0xb3')]}:_0x19c4dc);});};function getSelectList(_0x297d05,_0x55ec75,_0x26b463,_0x5de19f,_0x9a31c0,_0x2d7668){var _0x5e580d={'method':'GET','uri':_0x297d05+'EntityDefinitions('+_0x5de19f+_0x0ae6('0xb4')+_0x9a31c0+_0x0ae6('0xb5')+_0x0ae6('0xb6'),'headers':{'Authorization':_0x0ae6('0xb7')+_0x2d7668,'If-None-Match':null,'OData-Version':_0x0ae6('0x9b')},'json':!![]};return rp(_0x5e580d)['then'](function(_0x2384d8){var _0x5c9452=[];var _0x30190a=_0x2384d8[_0x0ae6('0xb8')][_0x0ae6('0xb9')];_0x30190a[_0x0ae6('0xa2')](function(_0x566da6){_0x5c9452[_0x0ae6('0xa4')]({'name':_0x566da6[_0x0ae6('0xba')]['UserLocalizedLabel'][_0x0ae6('0xba')],'value':String(_0x566da6['Value'])});});var _0x44bb0f={'id':_0x55ec75+'_'+_0x2384d8[_0x0ae6('0xa1')],'name':_0x2384d8[_0x0ae6('0xbb')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x5c9452};_0x26b463[_0x0ae6('0xa4')](_0x44bb0f);return _0x26b463;});}function getBooleanList(_0x261f45,_0x3ceeee,_0x2cbcb0,_0x4ffd6a,_0x2d13a2,_0x2dfee0){var _0x5a9e8a={'method':_0x0ae6('0x99'),'uri':_0x261f45+'EntityDefinitions('+_0x4ffd6a+')/Attributes('+_0x2d13a2+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x0ae6('0xb7')+_0x2dfee0,'If-None-Match':null,'OData-Version':_0x0ae6('0x9b')},'json':!![]};return rp(_0x5a9e8a)[_0x0ae6('0xf')](function(_0x2a387a){var _0x28105c=[];_0x28105c[_0x0ae6('0xa4')]({'name':_0x2a387a[_0x0ae6('0xb8')][_0x0ae6('0xbc')][_0x0ae6('0xba')][_0x0ae6('0xbd')][_0x0ae6('0xba')],'value':_0x0ae6('0xbe')},{'name':_0x2a387a['OptionSet'][_0x0ae6('0xbf')][_0x0ae6('0xba')]['UserLocalizedLabel'][_0x0ae6('0xba')],'value':'false'});var _0x1bcb73={'id':_0x3ceeee+'_'+_0x2a387a[_0x0ae6('0xa1')],'name':_0x2a387a[_0x0ae6('0xbb')]['UserLocalizedLabel'][_0x0ae6('0xba')],'custom':![],'options':_0x28105c};_0x2cbcb0[_0x0ae6('0xa4')](_0x1bcb73);return _0x2cbcb0;});}function getInputList(_0x33d04d,_0x17ec5a,_0xc1b678,_0xa62160,_0x3e5641,_0x437a90,_0xbe442){var _0x2a46e2={'method':_0x0ae6('0x99'),'uri':_0x33d04d+_0x0ae6('0x9d')+_0x3e5641+_0x0ae6('0xb4')+_0x437a90+_0x0ae6('0xc0')+_0xc1b678+_0x0ae6('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0xbe442,'If-None-Match':null,'OData-Version':_0x0ae6('0x9b')},'json':!![]};return rp(_0x2a46e2)[_0x0ae6('0xf')](function(_0x2ff006){var _0x3c0663={'id':_0x17ec5a+'_'+_0x2ff006[_0x0ae6('0xa1')],'name':_0x2ff006[_0x0ae6('0xbb')][_0x0ae6('0xbd')]?_0x2ff006[_0x0ae6('0xbb')][_0x0ae6('0xbd')][_0x0ae6('0xba')]:_0x2ff006[_0x0ae6('0xa1')],'custom':![],'options':[]};_0xa62160[_0x0ae6('0xa4')](_0x3c0663);return _0xa62160;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 843eb2f..572ac15 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x48370b,_0x59c727){var _0x1a757b=function(_0x2e7824){while(--_0x2e7824){_0x48370b['push'](_0x48370b['shift']());}};_0x1a757b(++_0x59c727);}(_0xe706,0xa3));var _0x6e70=function(_0x38de16,_0x2acea8){_0x38de16=_0x38de16-0x0;var _0x594a90=_0xe706[_0x38de16];return _0x594a90;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x5cd26e,_0x39326f){var _0x1be7e4=function(_0x889e4b){while(--_0x889e4b){_0x5cd26e['push'](_0x5cd26e['shift']());}};_0x1be7e4(++_0x39326f);}(_0x757a,0xde));var _0xa757=function(_0x2f8311,_0x2cb027){_0x2f8311=_0x2f8311-0x0;var _0x432377=_0x757a[_0x2f8311];return _0x432377;};'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'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 66af8ca..14cd28d 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 _0x90a8=['request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x50ead2,_0x17f05b){var _0x285149=function(_0x4831f5){while(--_0x4831f5){_0x50ead2['push'](_0x50ead2['shift']());}};_0x285149(++_0x17f05b);}(_0x90a8,0x82));var _0x890a=function(_0x5e6c6b,_0x427d18){_0x5e6c6b=_0x5e6c6b-0x0;var _0x1198ad=_0x90a8[_0x5e6c6b];return _0x1198ad;};'use strict';var _=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var moment=require(_0x890a('0x2'));var BPromise=require(_0x890a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x890a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x890a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x890a('0x6'));var jayson=require(_0x890a('0x7'));var client=jayson[_0x890a('0x8')][_0x890a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a3a14,_0x4f0249,_0x158536){return new BPromise(function(_0x12cfd2,_0x284a8b){return client[_0x890a('0xa')](_0x5a3a14,_0x158536)[_0x890a('0xb')](function(_0xf4c62e){logger['info'](_0x890a('0xc'),_0x4f0249,_0x890a('0xd'));logger[_0x890a('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4f0249,_0x890a('0xd'),JSON[_0x890a('0xf')](_0xf4c62e));if(_0xf4c62e[_0x890a('0x10')]){if(_0xf4c62e[_0x890a('0x10')][_0x890a('0x11')]===0x1f4){logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);return _0x284a8b(_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);}logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0xf4c62e[_0x890a('0x10')][_0x890a('0x12')]);return _0x12cfd2(_0xf4c62e[_0x890a('0x10')]['message']);}else{logger[_0x890a('0x13')](_0x890a('0xc'),_0x4f0249,_0x890a('0xd'));_0x12cfd2(_0xf4c62e[_0x890a('0x14')][_0x890a('0x12')]);}})['catch'](function(_0x8ec779){logger[_0x890a('0x10')](_0x890a('0xc'),_0x4f0249,_0x8ec779);_0x284a8b(_0x8ec779);});});}exports[_0x890a('0x15')]=function(_0x32f285){var _0x517c4e=this;return new Promise(function(_0x578ce9,_0x37e02a){return db[_0x890a('0x16')][_0x890a('0x17')]({'raw':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x19')]===undefined?!![]:![]:!![],'where':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1a')]||null:null,'attributes':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1b')]||null:null,'limit':_0x32f285['options']?_0x32f285['options'][_0x890a('0x1c')]||null:null,'include':_0x32f285[_0x890a('0x18')]?_0x32f285[_0x890a('0x18')][_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x32f285['options']['include'],function(_0x27aa50){return{'model':db[_0x27aa50[_0x890a('0x1f')]],'as':_0x27aa50['as'],'attributes':_0x27aa50['attributes'],'include':_0x27aa50[_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x27aa50[_0x890a('0x1d')],function(_0x376bfd){return{'model':db[_0x376bfd[_0x890a('0x1f')]],'as':_0x376bfd['as'],'attributes':_0x376bfd[_0x890a('0x1b')],'include':_0x376bfd[_0x890a('0x1d')]?_['map'](_0x376bfd[_0x890a('0x1d')],function(_0xf5ad0){return{'model':db[_0xf5ad0[_0x890a('0x1f')]],'as':_0xf5ad0['as'],'attributes':_0xf5ad0[_0x890a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x890a('0xb')](function(_0x288f33){logger[_0x890a('0x13')](_0x890a('0x15'),_0x32f285);logger[_0x890a('0xe')](_0x890a('0x15'),_0x32f285,JSON[_0x890a('0xf')](_0x288f33));_0x578ce9(_0x288f33);})[_0x890a('0x20')](function(_0x1d8c50){logger['error'](_0x890a('0x15'),_0x1d8c50[_0x890a('0x12')],_0x32f285);_0x37e02a(_0x517c4e[_0x890a('0x10')](0x1f4,_0x1d8c50[_0x890a('0x12')]));});});};exports[_0x890a('0x21')]=function(_0x4663d6){var _0x4314ff=this;return new Promise(function(_0x11455b,_0x59f3bf){return db[_0x890a('0x16')][_0x890a('0x22')]({'raw':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x19')]===undefined?!![]:![]:!![],'where':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x1a')]||null:null,'attributes':_0x4663d6[_0x890a('0x18')]?_0x4663d6[_0x890a('0x18')][_0x890a('0x1b')]||null:null,'include':_0x4663d6['options']?_0x4663d6[_0x890a('0x18')][_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x4663d6['options'][_0x890a('0x1d')],function(_0x536eb2){return{'model':db[_0x536eb2[_0x890a('0x1f')]],'as':_0x536eb2['as'],'attributes':_0x536eb2[_0x890a('0x1b')],'include':_0x536eb2['include']?_[_0x890a('0x1e')](_0x536eb2['include'],function(_0x3a3070){return{'model':db[_0x3a3070[_0x890a('0x1f')]],'as':_0x3a3070['as'],'attributes':_0x3a3070['attributes'],'include':_0x3a3070[_0x890a('0x1d')]?_[_0x890a('0x1e')](_0x3a3070[_0x890a('0x1d')],function(_0x237d70){return{'model':db[_0x237d70[_0x890a('0x1f')]],'as':_0x237d70['as'],'attributes':_0x237d70[_0x890a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x890a('0xb')](function(_0x1557df){logger[_0x890a('0x13')](_0x890a('0x21'),_0x4663d6);logger['debug'](_0x890a('0x21'),_0x4663d6,JSON[_0x890a('0xf')](_0x1557df));_0x11455b(_0x1557df);})[_0x890a('0x20')](function(_0x28cdfc){logger[_0x890a('0x10')](_0x890a('0x21'),_0x28cdfc[_0x890a('0x12')],_0x4663d6);_0x59f3bf(_0x4314ff[_0x890a('0x10')](0x1f4,_0x28cdfc[_0x890a('0x12')]));});});}; \ No newline at end of file +var _0x3c00=['stringify','error','code','message','result','catch','findAll','options','where','limit','include','attributes','map','model','GetDynamics365Account','ShowDynamics365Account','find','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0xe08f0e,_0x527e44){var _0x402cf1=function(_0x5ed807){while(--_0x5ed807){_0xe08f0e['push'](_0xe08f0e['shift']());}};_0x402cf1(++_0x527e44);}(_0x3c00,0x11a));var _0x03c0=function(_0x431128,_0x4661a9){_0x431128=_0x431128-0x0;var _0x3c5d58=_0x3c00[_0x431128];return _0x3c5d58;};'use strict';var _=require(_0x03c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x03c0('0x1'));var rs=require(_0x03c0('0x2'));var fs=require('fs');var Redis=require(_0x03c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x03c0('0x4'));var logger=require(_0x03c0('0x5'))('rpc');var config=require(_0x03c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x03c0('0x7')][_0x03c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46e16d,_0x430bcd,_0x33fd1c){return new BPromise(function(_0xfb650,_0x28c7a1){return client[_0x03c0('0x9')](_0x46e16d,_0x33fd1c)[_0x03c0('0xa')](function(_0x152170){logger[_0x03c0('0xb')](_0x03c0('0xc'),_0x430bcd,_0x03c0('0xd'));logger['debug'](_0x03c0('0xe'),_0x430bcd,_0x03c0('0xd'),JSON[_0x03c0('0xf')](_0x152170));if(_0x152170[_0x03c0('0x10')]){if(_0x152170['error'][_0x03c0('0x11')]===0x1f4){logger[_0x03c0('0x10')](_0x03c0('0xc'),_0x430bcd,_0x152170['error'][_0x03c0('0x12')]);return _0x28c7a1(_0x152170['error'][_0x03c0('0x12')]);}logger[_0x03c0('0x10')](_0x03c0('0xc'),_0x430bcd,_0x152170[_0x03c0('0x10')][_0x03c0('0x12')]);return _0xfb650(_0x152170[_0x03c0('0x10')]['message']);}else{logger[_0x03c0('0xb')](_0x03c0('0xc'),_0x430bcd,_0x03c0('0xd'));_0xfb650(_0x152170[_0x03c0('0x13')][_0x03c0('0x12')]);}})[_0x03c0('0x14')](function(_0x188378){logger[_0x03c0('0x10')](_0x03c0('0xc'),_0x430bcd,_0x188378);_0x28c7a1(_0x188378);});});}exports['GetDynamics365Account']=function(_0xdf78be){var _0x11007c=this;return new Promise(function(_0x5e4622,_0x269aa4){return db['Dynamics365Account'][_0x03c0('0x15')]({'raw':_0xdf78be[_0x03c0('0x16')]?_0xdf78be[_0x03c0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdf78be[_0x03c0('0x16')]?_0xdf78be[_0x03c0('0x16')][_0x03c0('0x17')]||null:null,'attributes':_0xdf78be['options']?_0xdf78be['options']['attributes']||null:null,'limit':_0xdf78be[_0x03c0('0x16')]?_0xdf78be[_0x03c0('0x16')][_0x03c0('0x18')]||null:null,'include':_0xdf78be[_0x03c0('0x16')]?_0xdf78be[_0x03c0('0x16')][_0x03c0('0x19')]?_['map'](_0xdf78be[_0x03c0('0x16')][_0x03c0('0x19')],function(_0x97f396){return{'model':db[_0x97f396['model']],'as':_0x97f396['as'],'attributes':_0x97f396[_0x03c0('0x1a')],'include':_0x97f396['include']?_[_0x03c0('0x1b')](_0x97f396[_0x03c0('0x19')],function(_0x5e8cd1){return{'model':db[_0x5e8cd1[_0x03c0('0x1c')]],'as':_0x5e8cd1['as'],'attributes':_0x5e8cd1[_0x03c0('0x1a')],'include':_0x5e8cd1['include']?_[_0x03c0('0x1b')](_0x5e8cd1[_0x03c0('0x19')],function(_0x4d9992){return{'model':db[_0x4d9992[_0x03c0('0x1c')]],'as':_0x4d9992['as'],'attributes':_0x4d9992[_0x03c0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x03c0('0xa')](function(_0x1cd9e4){logger['info'](_0x03c0('0x1d'),_0xdf78be);logger['debug']('GetDynamics365Account',_0xdf78be,JSON[_0x03c0('0xf')](_0x1cd9e4));_0x5e4622(_0x1cd9e4);})['catch'](function(_0x17f2c7){logger[_0x03c0('0x10')](_0x03c0('0x1d'),_0x17f2c7[_0x03c0('0x12')],_0xdf78be);_0x269aa4(_0x11007c[_0x03c0('0x10')](0x1f4,_0x17f2c7[_0x03c0('0x12')]));});});};exports[_0x03c0('0x1e')]=function(_0x11b1ce){var _0x2002ca=this;return new Promise(function(_0x305a33,_0xaba53b){return db['Dynamics365Account'][_0x03c0('0x1f')]({'raw':_0x11b1ce['options']?_0x11b1ce['options'][_0x03c0('0x20')]===undefined?!![]:![]:!![],'where':_0x11b1ce[_0x03c0('0x16')]?_0x11b1ce[_0x03c0('0x16')][_0x03c0('0x17')]||null:null,'attributes':_0x11b1ce[_0x03c0('0x16')]?_0x11b1ce['options'][_0x03c0('0x1a')]||null:null,'include':_0x11b1ce[_0x03c0('0x16')]?_0x11b1ce[_0x03c0('0x16')][_0x03c0('0x19')]?_['map'](_0x11b1ce[_0x03c0('0x16')]['include'],function(_0xd06927){return{'model':db[_0xd06927[_0x03c0('0x1c')]],'as':_0xd06927['as'],'attributes':_0xd06927[_0x03c0('0x1a')],'include':_0xd06927[_0x03c0('0x19')]?_['map'](_0xd06927['include'],function(_0x59e30a){return{'model':db[_0x59e30a[_0x03c0('0x1c')]],'as':_0x59e30a['as'],'attributes':_0x59e30a[_0x03c0('0x1a')],'include':_0x59e30a[_0x03c0('0x19')]?_[_0x03c0('0x1b')](_0x59e30a['include'],function(_0x2914f6){return{'model':db[_0x2914f6[_0x03c0('0x1c')]],'as':_0x2914f6['as'],'attributes':_0x2914f6[_0x03c0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x03c0('0xa')](function(_0x2b573a){logger['info'](_0x03c0('0x1e'),_0x11b1ce);logger['debug'](_0x03c0('0x1e'),_0x11b1ce,JSON[_0x03c0('0xf')](_0x2b573a));_0x305a33(_0x2b573a);})[_0x03c0('0x14')](function(_0x2ff15b){logger[_0x03c0('0x10')](_0x03c0('0x1e'),_0x2ff15b[_0x03c0('0x12')],_0x11b1ce);_0xaba53b(_0x2002ca[_0x03c0('0x10')](0x1f4,_0x2ff15b[_0x03c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d359869..28592d0 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 _0xfa25=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','delete'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0xfa25,0xd1));var _0x5fa2=function(_0x475e85,_0x44bda5){_0x475e85=_0x475e85-0x0;var _0x2feb62=_0xfa25[_0x475e85];return _0x2feb62;};'use strict';var multer=require('multer');var util=require(_0x5fa2('0x0'));var path=require(_0x5fa2('0x1'));var timeout=require(_0x5fa2('0x2'));var express=require(_0x5fa2('0x3'));var router=express[_0x5fa2('0x4')]();var fs_extra=require(_0x5fa2('0x5'));var auth=require(_0x5fa2('0x6'));var interaction=require(_0x5fa2('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x5fa2('0x8')]('/',auth[_0x5fa2('0x9')](),controller['index']);router['get'](_0x5fa2('0xa'),auth['isAuthenticated'](),controller[_0x5fa2('0xb')]);router[_0x5fa2('0x8')](_0x5fa2('0xc'),auth['isAuthenticated'](),controller[_0x5fa2('0xd')]);router[_0x5fa2('0x8')](_0x5fa2('0xe'),auth['isAuthenticated'](),controller[_0x5fa2('0xf')]);router['get']('/:id/descriptions',auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x10')]);router['post']('/',auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x11')]);router[_0x5fa2('0x12')](_0x5fa2('0xa'),auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x13')]);router[_0x5fa2('0x14')](_0x5fa2('0xa'),auth[_0x5fa2('0x9')](),controller[_0x5fa2('0x15')]);module[_0x5fa2('0x16')]=router; \ No newline at end of file +var _0x7932=['/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x7932,0xf0));var _0x2793=function(_0x2def2e,_0x5ee04e){_0x2def2e=_0x2def2e-0x0;var _0x35e4b3=_0x7932[_0x2def2e];return _0x35e4b3;};'use strict';var multer=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var path=require('path');var timeout=require(_0x2793('0x2'));var express=require(_0x2793('0x3'));var router=express[_0x2793('0x4')]();var fs_extra=require(_0x2793('0x5'));var auth=require(_0x2793('0x6'));var interaction=require(_0x2793('0x7'));var config=require(_0x2793('0x8'));var controller=require('./intDynamics365Configuration.controller');router[_0x2793('0x9')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0xb')]);router[_0x2793('0x9')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['show']);router['get'](_0x2793('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x2793('0x9')](_0x2793('0xe'),auth['isAuthenticated'](),controller[_0x2793('0xf')]);router[_0x2793('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2793('0x10')]);router[_0x2793('0x11')]('/',auth[_0x2793('0xa')](),controller[_0x2793('0x12')]);router['put'](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['update']);router[_0x2793('0x13')](_0x2793('0xc'),auth[_0x2793('0xa')](),controller['destroy']);module[_0x2793('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 60bb5c7..5559c23 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 _0xddac=['incident','ENUM','contact','nothing','sequelize','exports','STRING','phonecall'];(function(_0x42ac52,_0x471f14){var _0x1f970b=function(_0x5b6deb){while(--_0x5b6deb){_0x42ac52['push'](_0x42ac52['shift']());}};_0x1f970b(++_0x471f14);}(_0xddac,0x114));var _0xcdda=function(_0x1f500d,_0x1eb888){_0x1f500d=_0x1f500d-0x0;var _0x23b94f=_0xddac[_0x1f500d];return _0x23b94f;};'use strict';var Sequelize=require(_0xcdda('0x0'));module[_0xcdda('0x1')]={'name':{'type':Sequelize[_0xcdda('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0xcdda('0x3')),'defaultValue':_0xcdda('0x4')},'moduleCreate':{'type':Sequelize[_0xcdda('0x5')](_0xcdda('0x6'),_0xcdda('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa639=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall','contact'];(function(_0x88b672,_0x5bbb52){var _0x521b1a=function(_0x3d92c){while(--_0x3d92c){_0x88b672['push'](_0x88b672['shift']());}};_0x521b1a(++_0x5bbb52);}(_0xa639,0x17c));var _0x9a63=function(_0x101042,_0x8a927e){_0x101042=_0x101042-0x0;var _0x566ede=_0xa639[_0x101042];return _0x566ede;};'use strict';var Sequelize=require(_0x9a63('0x0'));module[_0x9a63('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9a63('0x2')]},'ticketType':{'type':Sequelize[_0x9a63('0x3')](_0x9a63('0x4'),_0x9a63('0x5')),'defaultValue':_0x9a63('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x9a63('0x6'),_0x9a63('0x7')),'defaultValue':_0x9a63('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9a63('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index cf807c0..6552496 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 _0x730b=['findAll','rows','show','params','rawAttributes','find','create','body','catch','findOne','Dynamics365Field','filter','getFields','nolimit','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x5dc242,_0x3e61ac){var _0x2bb6f8=function(_0x42661e){while(--_0x42661e){_0x5dc242['push'](_0x5dc242['shift']());}};_0x2bb6f8(++_0x3e61ac);}(_0x730b,0x191));var _0xb730=function(_0x1e7d6d,_0x2d5a66){_0x1e7d6d=_0x1e7d6d-0x0;var _0x1ea7b6=_0x730b[_0x1e7d6d];return _0x1ea7b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb730('0x0'));var rp=require('request-promise');var moment=require(_0xb730('0x1'));var BPromise=require(_0xb730('0x2'));var Mustache=require(_0xb730('0x3'));var util=require(_0xb730('0x4'));var path=require(_0xb730('0x5'));var sox=require('sox');var csv=require(_0xb730('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb730('0x7'));var _=require(_0xb730('0x8'));var squel=require(_0xb730('0x9'));var crypto=require('crypto');var jsforce=require(_0xb730('0xa'));var deskjs=require(_0xb730('0xb'));var toCsv=require(_0xb730('0x6'));var querystring=require('querystring');var Papa=require(_0xb730('0xc'));var Redis=require(_0xb730('0xd'));var authService=require(_0xb730('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb730('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb730('0x10'));var licenseUtil=require(_0xb730('0x11'));var db=require(_0xb730('0x12'))['db'];function respondWithStatusCode(_0x315505,_0xd42a65){_0xd42a65=_0xd42a65||0xcc;return function(_0x2fbdc0){if(_0x2fbdc0){return _0x315505['sendStatus'](_0xd42a65);}return _0x315505[_0xb730('0x13')](_0xd42a65)['end']();};}function respondWithResult(_0x4758ad,_0x1b687e){_0x1b687e=_0x1b687e||0xc8;return function(_0x18a4dc){if(_0x18a4dc){return _0x4758ad[_0xb730('0x13')](_0x1b687e)[_0xb730('0x14')](_0x18a4dc);}};}function respondWithFilteredResult(_0x21664a,_0x302fc9){return function(_0x1be3e3){if(_0x1be3e3){var _0x56c070=typeof _0x302fc9[_0xb730('0x15')]===_0xb730('0x16')&&typeof _0x302fc9[_0xb730('0x17')]===_0xb730('0x16');var _0x59ecea=_0x1be3e3[_0xb730('0x18')];var _0x2b81a6=_0x56c070?0x0:_0x302fc9[_0xb730('0x15')];var _0x198d43=_0x56c070?_0x1be3e3[_0xb730('0x18')]:_0x302fc9['offset']+_0x302fc9[_0xb730('0x17')];var _0x326e47;if(_0x198d43>=_0x59ecea){_0x198d43=_0x59ecea;_0x326e47=0xc8;}else{_0x326e47=0xce;}_0x21664a[_0xb730('0x13')](_0x326e47);return _0x21664a['set'](_0xb730('0x19'),_0x2b81a6+'-'+_0x198d43+'/'+_0x59ecea)[_0xb730('0x14')](_0x1be3e3);}return null;};}function patchUpdates(_0x2030d9){return function(_0x34ff9e){try{jsonpatch[_0xb730('0x1a')](_0x34ff9e,_0x2030d9,!![]);}catch(_0x5579db){return BPromise[_0xb730('0x1b')](_0x5579db);}return _0x34ff9e[_0xb730('0x1c')]();};}function saveUpdates(_0x1d3ac9,_0x5daef7){return function(_0x52ee55){if(_0x52ee55){return _0x52ee55[_0xb730('0x1d')](_0x1d3ac9)[_0xb730('0x1e')](function(_0x25e63e){return _0x25e63e;});}return null;};}function removeEntity(_0x2c1d44,_0x4d5cc0){return function(_0x2cab11){if(_0x2cab11){return _0x2cab11[_0xb730('0x1f')]()[_0xb730('0x1e')](function(){_0x2c1d44[_0xb730('0x13')](0xcc)[_0xb730('0x20')]();});}};}function handleEntityNotFound(_0x2dd396,_0x302cbc){return function(_0x22cd68){if(!_0x22cd68){_0x2dd396[_0xb730('0x21')](0x194);}return _0x22cd68;};}function handleError(_0x1daffb,_0x39fa4e){_0x39fa4e=_0x39fa4e||0x1f4;return function(_0x1b5a2c){logger['error'](_0x1b5a2c[_0xb730('0x22')]);if(_0x1b5a2c['name']){delete _0x1b5a2c[_0xb730('0x23')];}_0x1daffb[_0xb730('0x13')](_0x39fa4e)[_0xb730('0x24')](_0x1b5a2c);};}exports[_0xb730('0x25')]=function(_0x2b2a19,_0x40ced3){var _0x2778a1={},_0x240183={},_0xd7505c={'count':0x0,'rows':[]};var _0x44e6b9=_[_0xb730('0x26')](db[_0xb730('0x27')]['rawAttributes'],function(_0x3fbca5){return{'name':_0x3fbca5[_0xb730('0x28')],'type':_0x3fbca5[_0xb730('0x29')][_0xb730('0x2a')]};});_0x240183[_0xb730('0x2b')]=_[_0xb730('0x26')](_0x44e6b9,'name');_0x240183[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x2b2a19['query']);_0x240183[_0xb730('0x2e')]=_['intersection'](_0x240183['model'],_0x240183[_0xb730('0x2c')]);_0x2778a1[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x240183['model'],qs['fields'](_0x2b2a19['query'][_0xb730('0x31')]));_0x2778a1[_0xb730('0x2f')]=_0x2778a1[_0xb730('0x2f')][_0xb730('0x32')]?_0x2778a1[_0xb730('0x2f')]:_0x240183['model'];if(!_0x2b2a19[_0xb730('0x2c')][_0xb730('0x33')]('nolimit')){_0x2778a1[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x2b2a19[_0xb730('0x2c')]['limit']);_0x2778a1[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x2b2a19['query'][_0xb730('0x15')]);}_0x2778a1[_0xb730('0x34')]=qs[_0xb730('0x35')](_0x2b2a19[_0xb730('0x2c')]['sort']);_0x2778a1['where']=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x2b2a19[_0xb730('0x2c')],_0x240183[_0xb730('0x2e')]),_0x44e6b9);if(_0x2b2a19[_0xb730('0x2c')]['filter']){_0x2778a1[_0xb730('0x37')]=_[_0xb730('0x38')](_0x2778a1['where'],{'$or':_[_0xb730('0x26')](_0x44e6b9,function(_0x22ef8b){if(_0x22ef8b[_0xb730('0x29')]!==_0xb730('0x39')){var _0x47954c={};_0x47954c[_0x22ef8b['name']]={'$like':'%'+_0x2b2a19['query']['filter']+'%'};return _0x47954c;}})});}_0x2778a1=_[_0xb730('0x38')]({},_0x2778a1,_0x2b2a19[_0xb730('0x3a')]);var _0x141405={'where':_0x2778a1['where']};return db[_0xb730('0x27')][_0xb730('0x18')](_0x141405)[_0xb730('0x1e')](function(_0x40d6f6){_0xd7505c[_0xb730('0x18')]=_0x40d6f6;if(_0x2b2a19[_0xb730('0x2c')][_0xb730('0x3b')]){_0x2778a1[_0xb730('0x3c')]=[{'all':!![]}];}return db[_0xb730('0x27')][_0xb730('0x3d')](_0x2778a1);})[_0xb730('0x1e')](function(_0x2191e6){_0xd7505c[_0xb730('0x3e')]=_0x2191e6;return _0xd7505c;})[_0xb730('0x1e')](respondWithFilteredResult(_0x40ced3,_0x2778a1))['catch'](handleError(_0x40ced3,null));};exports[_0xb730('0x3f')]=function(_0x18e219,_0x378499){var _0x4756b4={'raw':![],'where':{'id':_0x18e219[_0xb730('0x40')]['id']}},_0x180939={};_0x180939[_0xb730('0x2b')]=_['keys'](db[_0xb730('0x27')][_0xb730('0x41')]);_0x180939[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x18e219[_0xb730('0x2c')]);_0x180939[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x180939[_0xb730('0x2b')],_0x180939[_0xb730('0x2c')]);_0x4756b4[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x180939[_0xb730('0x2b')],qs[_0xb730('0x31')](_0x18e219[_0xb730('0x2c')][_0xb730('0x31')]));_0x4756b4['attributes']=_0x4756b4[_0xb730('0x2f')][_0xb730('0x32')]?_0x4756b4[_0xb730('0x2f')]:_0x180939['model'];if(_0x18e219[_0xb730('0x2c')]['includeAll']){_0x4756b4['include']=[{'all':!![]}];}_0x4756b4=_[_0xb730('0x38')]({},_0x4756b4,_0x18e219[_0xb730('0x3a')]);return db[_0xb730('0x27')][_0xb730('0x42')](_0x4756b4)[_0xb730('0x1e')](handleEntityNotFound(_0x378499,null))[_0xb730('0x1e')](respondWithResult(_0x378499,null))['catch'](handleError(_0x378499,null));};exports[_0xb730('0x43')]=function(_0x3ce36a,_0x2c5f74){return db['Dynamics365Configuration'][_0xb730('0x43')](_0x3ce36a[_0xb730('0x44')],{})['then'](respondWithResult(_0x2c5f74,0xc9))[_0xb730('0x45')](handleError(_0x2c5f74,null));};exports[_0xb730('0x1d')]=function(_0x559f4c,_0x26fd86){if(_0x559f4c[_0xb730('0x44')]['id']){delete _0x559f4c['body']['id'];}return db[_0xb730('0x27')]['find']({'where':{'id':_0x559f4c[_0xb730('0x40')]['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x26fd86,null))[_0xb730('0x1e')](saveUpdates(_0x559f4c['body'],null))['then'](respondWithResult(_0x26fd86,null))[_0xb730('0x45')](handleError(_0x26fd86,null));};exports['destroy']=function(_0x560580,_0x3a710f){return db[_0xb730('0x27')][_0xb730('0x42')]({'where':{'id':_0x560580['params']['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x3a710f,null))['then'](removeEntity(_0x3a710f,null))['catch'](handleError(_0x3a710f,null));};exports['getFields']=function(_0x2fb5a7,_0x4b0b20,_0x233ccc){var _0x3ae635={};var _0x268f06={};var _0x395fc7;var _0x5e9b44;return db[_0xb730('0x27')][_0xb730('0x46')]({'where':{'id':_0x2fb5a7[_0xb730('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b0b20,null))[_0xb730('0x1e')](function(_0x1a4533){if(_0x1a4533){_0x395fc7=_0x1a4533;_0x268f06[_0xb730('0x2b')]=_[_0xb730('0x2d')](db[_0xb730('0x47')]['rawAttributes']);_0x268f06[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x2fb5a7[_0xb730('0x2c')]);_0x268f06[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x268f06[_0xb730('0x2b')],_0x268f06[_0xb730('0x2c')]);_0x3ae635[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x268f06[_0xb730('0x2b')],qs['fields'](_0x2fb5a7['query']['fields']));_0x3ae635[_0xb730('0x2f')]=_0x3ae635[_0xb730('0x2f')][_0xb730('0x32')]?_0x3ae635[_0xb730('0x2f')]:_0x268f06[_0xb730('0x2b')];_0x3ae635['order']=qs[_0xb730('0x35')](_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x35')]);_0x3ae635['where']=qs['filters'](_['pick'](_0x2fb5a7[_0xb730('0x2c')],_0x268f06[_0xb730('0x2e')]));if(_0x2fb5a7[_0xb730('0x2c')]['filter']){_0x3ae635['where']=_[_0xb730('0x38')](_0x3ae635['where'],{'$or':_[_0xb730('0x26')](_0x3ae635[_0xb730('0x2f')],function(_0x1c7603){var _0x3006db={};_0x3006db[_0x1c7603]={'$like':'%'+_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x48')]+'%'};return _0x3006db;})});}_0x3ae635=_[_0xb730('0x38')]({},_0x3ae635,_0x2fb5a7[_0xb730('0x3a')]);return _0x395fc7[_0xb730('0x49')](_0x3ae635);}})[_0xb730('0x1e')](function(_0x3f1c06){if(_0x3f1c06){_0x5e9b44=_0x3f1c06[_0xb730('0x32')];if(!_0x2fb5a7[_0xb730('0x2c')][_0xb730('0x33')](_0xb730('0x4a'))){_0x3ae635[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x2fb5a7[_0xb730('0x2c')]['limit']);_0x3ae635[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x2fb5a7['query'][_0xb730('0x15')]);}return _0x395fc7[_0xb730('0x49')](_0x3ae635);}})['then'](function(_0x415ba7){if(_0x415ba7){return _0x415ba7?{'count':_0x5e9b44,'rows':_0x415ba7}:null;}})['then'](respondWithResult(_0x4b0b20,null))[_0xb730('0x45')](handleError(_0x4b0b20,null));};exports['getSubjects']=function(_0x212688,_0x2c23b1,_0x6d24d3){var _0x4bd2fb={};var _0x2f1099={};var _0x473299;var _0x391269;return db[_0xb730('0x27')]['findOne']({'where':{'id':_0x212688['params']['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x2c23b1,null))[_0xb730('0x1e')](function(_0x5a6317){if(_0x5a6317){_0x473299=_0x5a6317;_0x2f1099[_0xb730('0x2b')]=_[_0xb730('0x2d')](db['Dynamics365Field'][_0xb730('0x41')]);_0x2f1099['query']=_[_0xb730('0x2d')](_0x212688['query']);_0x2f1099['filters']=_[_0xb730('0x30')](_0x2f1099[_0xb730('0x2b')],_0x2f1099[_0xb730('0x2c')]);_0x4bd2fb[_0xb730('0x2f')]=_[_0xb730('0x30')](_0x2f1099[_0xb730('0x2b')],qs[_0xb730('0x31')](_0x212688[_0xb730('0x2c')][_0xb730('0x31')]));_0x4bd2fb[_0xb730('0x2f')]=_0x4bd2fb[_0xb730('0x2f')][_0xb730('0x32')]?_0x4bd2fb[_0xb730('0x2f')]:_0x2f1099['model'];_0x4bd2fb['order']=qs[_0xb730('0x35')](_0x212688[_0xb730('0x2c')]['sort']);_0x4bd2fb[_0xb730('0x37')]=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x212688['query'],_0x2f1099[_0xb730('0x2e')]));if(_0x212688[_0xb730('0x2c')][_0xb730('0x48')]){_0x4bd2fb[_0xb730('0x37')]=_[_0xb730('0x38')](_0x4bd2fb['where'],{'$or':_[_0xb730('0x26')](_0x4bd2fb[_0xb730('0x2f')],function(_0x37682f){var _0xcea3d8={};_0xcea3d8[_0x37682f]={'$like':'%'+_0x212688[_0xb730('0x2c')]['filter']+'%'};return _0xcea3d8;})});}_0x4bd2fb=_[_0xb730('0x38')]({},_0x4bd2fb,_0x212688['options']);return _0x473299[_0xb730('0x4b')](_0x4bd2fb);}})[_0xb730('0x1e')](function(_0x317b5d){if(_0x317b5d){_0x391269=_0x317b5d[_0xb730('0x32')];if(!_0x212688['query']['hasOwnProperty']('nolimit')){_0x4bd2fb[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x212688[_0xb730('0x2c')]['limit']);_0x4bd2fb[_0xb730('0x15')]=qs[_0xb730('0x15')](_0x212688[_0xb730('0x2c')][_0xb730('0x15')]);}return _0x473299[_0xb730('0x4b')](_0x4bd2fb);}})[_0xb730('0x1e')](function(_0x122908){if(_0x122908){return _0x122908?{'count':_0x391269,'rows':_0x122908}:null;}})[_0xb730('0x1e')](respondWithResult(_0x2c23b1,null))[_0xb730('0x45')](handleError(_0x2c23b1,null));};exports[_0xb730('0x4c')]=function(_0x317984,_0x55fb0a,_0x37440a){var _0x5bad56={};var _0x520cfb={};var _0x1a60e4;var _0x1e07b7;return db[_0xb730('0x27')][_0xb730('0x46')]({'where':{'id':_0x317984[_0xb730('0x40')]['id']}})[_0xb730('0x1e')](handleEntityNotFound(_0x55fb0a,null))[_0xb730('0x1e')](function(_0x1ad029){if(_0x1ad029){_0x1a60e4=_0x1ad029;_0x520cfb[_0xb730('0x2b')]=_[_0xb730('0x2d')](db[_0xb730('0x47')][_0xb730('0x41')]);_0x520cfb[_0xb730('0x2c')]=_[_0xb730('0x2d')](_0x317984['query']);_0x520cfb[_0xb730('0x2e')]=_[_0xb730('0x30')](_0x520cfb[_0xb730('0x2b')],_0x520cfb['query']);_0x5bad56['attributes']=_[_0xb730('0x30')](_0x520cfb[_0xb730('0x2b')],qs['fields'](_0x317984['query'][_0xb730('0x31')]));_0x5bad56[_0xb730('0x2f')]=_0x5bad56[_0xb730('0x2f')][_0xb730('0x32')]?_0x5bad56['attributes']:_0x520cfb['model'];_0x5bad56['order']=qs[_0xb730('0x35')](_0x317984['query'][_0xb730('0x35')]);_0x5bad56['where']=qs[_0xb730('0x2e')](_[_0xb730('0x36')](_0x317984[_0xb730('0x2c')],_0x520cfb[_0xb730('0x2e')]));if(_0x317984[_0xb730('0x2c')][_0xb730('0x48')]){_0x5bad56['where']=_[_0xb730('0x38')](_0x5bad56[_0xb730('0x37')],{'$or':_[_0xb730('0x26')](_0x5bad56[_0xb730('0x2f')],function(_0x25079d){var _0x2755d4={};_0x2755d4[_0x25079d]={'$like':'%'+_0x317984[_0xb730('0x2c')][_0xb730('0x48')]+'%'};return _0x2755d4;})});}_0x5bad56=_[_0xb730('0x38')]({},_0x5bad56,_0x317984[_0xb730('0x3a')]);return _0x1a60e4[_0xb730('0x4c')](_0x5bad56);}})[_0xb730('0x1e')](function(_0x156fb7){if(_0x156fb7){_0x1e07b7=_0x156fb7[_0xb730('0x32')];if(!_0x317984['query'][_0xb730('0x33')](_0xb730('0x4a'))){_0x5bad56[_0xb730('0x17')]=qs[_0xb730('0x17')](_0x317984[_0xb730('0x2c')][_0xb730('0x17')]);_0x5bad56['offset']=qs[_0xb730('0x15')](_0x317984[_0xb730('0x2c')][_0xb730('0x15')]);}return _0x1a60e4[_0xb730('0x4c')](_0x5bad56);}})['then'](function(_0x1b2415){if(_0x1b2415){return _0x1b2415?{'count':_0x1e07b7,'rows':_0x1b2415}:null;}})[_0xb730('0x1e')](respondWithResult(_0x55fb0a,null))[_0xb730('0x45')](handleError(_0x55fb0a,null));}; \ No newline at end of file +var _0x1673=['length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','catch','show','params','options','find','create','body','destroy','findOne','getFields','hasOwnProperty','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','Content-Range','reject','update','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes'];(function(_0x4d7df6,_0x3f6139){var _0x4c0d29=function(_0x12ae02){while(--_0x12ae02){_0x4d7df6['push'](_0x4d7df6['shift']());}};_0x4c0d29(++_0x3f6139);}(_0x1673,0xbc));var _0x3167=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1673[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3167('0x0'));var rimraf=require(_0x3167('0x1'));var zipdir=require(_0x3167('0x2'));var jsonpatch=require(_0x3167('0x3'));var rp=require(_0x3167('0x4'));var moment=require(_0x3167('0x5'));var BPromise=require(_0x3167('0x6'));var Mustache=require(_0x3167('0x7'));var util=require(_0x3167('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3167('0x9'));var fs=require('fs');var fs_extra=require(_0x3167('0xa'));var _=require(_0x3167('0xb'));var squel=require(_0x3167('0xc'));var crypto=require(_0x3167('0xd'));var jsforce=require(_0x3167('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3167('0xf'));var Papa=require(_0x3167('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3167('0x11'));var as=require(_0x3167('0x12'));var hardwareService=require(_0x3167('0x13'));var logger=require(_0x3167('0x14'))(_0x3167('0x15'));var utils=require(_0x3167('0x16'));var config=require(_0x3167('0x17'));var licenseUtil=require(_0x3167('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fc77c,_0x3749ed){_0x3749ed=_0x3749ed||0xcc;return function(_0x44a16b){if(_0x44a16b){return _0x2fc77c[_0x3167('0x19')](_0x3749ed);}return _0x2fc77c[_0x3167('0x1a')](_0x3749ed)[_0x3167('0x1b')]();};}function respondWithResult(_0x237fb9,_0x42e06d){_0x42e06d=_0x42e06d||0xc8;return function(_0x34d361){if(_0x34d361){return _0x237fb9[_0x3167('0x1a')](_0x42e06d)[_0x3167('0x1c')](_0x34d361);}};}function respondWithFilteredResult(_0x47a536,_0x32a449){return function(_0x344f40){if(_0x344f40){var _0x301f17=typeof _0x32a449[_0x3167('0x1d')]===_0x3167('0x1e')&&typeof _0x32a449[_0x3167('0x1f')]===_0x3167('0x1e');var _0x367330=_0x344f40[_0x3167('0x20')];var _0x3992c0=_0x301f17?0x0:_0x32a449[_0x3167('0x1d')];var _0x480075=_0x301f17?_0x344f40[_0x3167('0x20')]:_0x32a449['offset']+_0x32a449['limit'];var _0x289d31;if(_0x480075>=_0x367330){_0x480075=_0x367330;_0x289d31=0xc8;}else{_0x289d31=0xce;}_0x47a536[_0x3167('0x1a')](_0x289d31);return _0x47a536[_0x3167('0x21')](_0x3167('0x22'),_0x3992c0+'-'+_0x480075+'/'+_0x367330)['json'](_0x344f40);}return null;};}function patchUpdates(_0x1d88f2){return function(_0x1ba49e){try{jsonpatch['apply'](_0x1ba49e,_0x1d88f2,!![]);}catch(_0x5329dc){return BPromise[_0x3167('0x23')](_0x5329dc);}return _0x1ba49e['save']();};}function saveUpdates(_0x5905dc,_0x248855){return function(_0x569c22){if(_0x569c22){return _0x569c22[_0x3167('0x24')](_0x5905dc)['then'](function(_0x576e01){return _0x576e01;});}return null;};}function removeEntity(_0x223dff,_0xaea4b9){return function(_0x5cbc87){if(_0x5cbc87){return _0x5cbc87['destroy']()[_0x3167('0x25')](function(){_0x223dff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd5fc,_0x4f8f99){return function(_0x469b6a){if(!_0x469b6a){_0x1bd5fc['sendStatus'](0x194);}return _0x469b6a;};}function handleError(_0x531c5c,_0x3f8c00){_0x3f8c00=_0x3f8c00||0x1f4;return function(_0x19d96b){logger[_0x3167('0x26')](_0x19d96b[_0x3167('0x27')]);if(_0x19d96b['name']){delete _0x19d96b[_0x3167('0x28')];}_0x531c5c[_0x3167('0x1a')](_0x3f8c00)[_0x3167('0x29')](_0x19d96b);};}exports[_0x3167('0x2a')]=function(_0xbfa843,_0x1f9972){var _0x1723ab={},_0x32f666={},_0x5b1994={'count':0x0,'rows':[]};var _0x4f765a=_[_0x3167('0x2b')](db[_0x3167('0x2c')][_0x3167('0x2d')],function(_0x5bc926){return{'name':_0x5bc926[_0x3167('0x2e')],'type':_0x5bc926[_0x3167('0x2f')][_0x3167('0x30')]};});_0x32f666[_0x3167('0x31')]=_[_0x3167('0x2b')](_0x4f765a,_0x3167('0x28'));_0x32f666['query']=_[_0x3167('0x32')](_0xbfa843[_0x3167('0x33')]);_0x32f666['filters']=_[_0x3167('0x34')](_0x32f666['model'],_0x32f666[_0x3167('0x33')]);_0x1723ab['attributes']=_['intersection'](_0x32f666[_0x3167('0x31')],qs[_0x3167('0x35')](_0xbfa843['query'][_0x3167('0x35')]));_0x1723ab[_0x3167('0x36')]=_0x1723ab[_0x3167('0x36')][_0x3167('0x37')]?_0x1723ab[_0x3167('0x36')]:_0x32f666[_0x3167('0x31')];if(!_0xbfa843[_0x3167('0x33')]['hasOwnProperty'](_0x3167('0x38'))){_0x1723ab['limit']=qs[_0x3167('0x1f')](_0xbfa843[_0x3167('0x33')][_0x3167('0x1f')]);_0x1723ab[_0x3167('0x1d')]=qs[_0x3167('0x1d')](_0xbfa843[_0x3167('0x33')]['offset']);}_0x1723ab[_0x3167('0x39')]=qs[_0x3167('0x3a')](_0xbfa843['query'][_0x3167('0x3a')]);_0x1723ab['where']=qs[_0x3167('0x3b')](_[_0x3167('0x3c')](_0xbfa843[_0x3167('0x33')],_0x32f666[_0x3167('0x3b')]),_0x4f765a);if(_0xbfa843[_0x3167('0x33')][_0x3167('0x3d')]){_0x1723ab[_0x3167('0x3e')]=_['merge'](_0x1723ab['where'],{'$or':_[_0x3167('0x2b')](_0x4f765a,function(_0x210bd2){if(_0x210bd2['type']!==_0x3167('0x3f')){var _0x48e730={};_0x48e730[_0x210bd2['name']]={'$like':'%'+_0xbfa843[_0x3167('0x33')]['filter']+'%'};return _0x48e730;}})});}_0x1723ab=_[_0x3167('0x40')]({},_0x1723ab,_0xbfa843['options']);var _0x455365={'where':_0x1723ab[_0x3167('0x3e')]};return db[_0x3167('0x2c')][_0x3167('0x20')](_0x455365)[_0x3167('0x25')](function(_0x313fd2){_0x5b1994[_0x3167('0x20')]=_0x313fd2;if(_0xbfa843[_0x3167('0x33')][_0x3167('0x41')]){_0x1723ab[_0x3167('0x42')]=[{'all':!![]}];}return db[_0x3167('0x2c')]['findAll'](_0x1723ab);})[_0x3167('0x25')](function(_0x505c1c){_0x5b1994['rows']=_0x505c1c;return _0x5b1994;})[_0x3167('0x25')](respondWithFilteredResult(_0x1f9972,_0x1723ab))[_0x3167('0x43')](handleError(_0x1f9972,null));};exports[_0x3167('0x44')]=function(_0x67d345,_0x2b98a0){var _0x105044={'raw':![],'where':{'id':_0x67d345[_0x3167('0x45')]['id']}},_0xe069b4={};_0xe069b4[_0x3167('0x31')]=_['keys'](db[_0x3167('0x2c')][_0x3167('0x2d')]);_0xe069b4['query']=_[_0x3167('0x32')](_0x67d345[_0x3167('0x33')]);_0xe069b4[_0x3167('0x3b')]=_[_0x3167('0x34')](_0xe069b4[_0x3167('0x31')],_0xe069b4['query']);_0x105044[_0x3167('0x36')]=_['intersection'](_0xe069b4['model'],qs[_0x3167('0x35')](_0x67d345[_0x3167('0x33')][_0x3167('0x35')]));_0x105044[_0x3167('0x36')]=_0x105044[_0x3167('0x36')]['length']?_0x105044['attributes']:_0xe069b4[_0x3167('0x31')];if(_0x67d345[_0x3167('0x33')][_0x3167('0x41')]){_0x105044[_0x3167('0x42')]=[{'all':!![]}];}_0x105044=_[_0x3167('0x40')]({},_0x105044,_0x67d345[_0x3167('0x46')]);return db[_0x3167('0x2c')][_0x3167('0x47')](_0x105044)[_0x3167('0x25')](handleEntityNotFound(_0x2b98a0,null))['then'](respondWithResult(_0x2b98a0,null))[_0x3167('0x43')](handleError(_0x2b98a0,null));};exports['create']=function(_0x20b2c1,_0x44c001){return db[_0x3167('0x2c')][_0x3167('0x48')](_0x20b2c1[_0x3167('0x49')],{})['then'](respondWithResult(_0x44c001,0xc9))['catch'](handleError(_0x44c001,null));};exports[_0x3167('0x24')]=function(_0x3670c5,_0x449593){if(_0x3670c5[_0x3167('0x49')]['id']){delete _0x3670c5[_0x3167('0x49')]['id'];}return db[_0x3167('0x2c')][_0x3167('0x47')]({'where':{'id':_0x3670c5[_0x3167('0x45')]['id']}})['then'](handleEntityNotFound(_0x449593,null))[_0x3167('0x25')](saveUpdates(_0x3670c5[_0x3167('0x49')],null))[_0x3167('0x25')](respondWithResult(_0x449593,null))['catch'](handleError(_0x449593,null));};exports[_0x3167('0x4a')]=function(_0xc5733c,_0x3cbc85){return db['Dynamics365Configuration']['find']({'where':{'id':_0xc5733c[_0x3167('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cbc85,null))[_0x3167('0x25')](removeEntity(_0x3cbc85,null))[_0x3167('0x43')](handleError(_0x3cbc85,null));};exports['getFields']=function(_0x550d95,_0x4f58ba,_0x1db645){var _0x405b27={};var _0x5bc73f={};var _0x496582;var _0x3409a6;return db['Dynamics365Configuration'][_0x3167('0x4b')]({'where':{'id':_0x550d95[_0x3167('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f58ba,null))[_0x3167('0x25')](function(_0x2f8192){if(_0x2f8192){_0x496582=_0x2f8192;_0x5bc73f[_0x3167('0x31')]=_[_0x3167('0x32')](db['Dynamics365Field'][_0x3167('0x2d')]);_0x5bc73f[_0x3167('0x33')]=_[_0x3167('0x32')](_0x550d95[_0x3167('0x33')]);_0x5bc73f[_0x3167('0x3b')]=_[_0x3167('0x34')](_0x5bc73f['model'],_0x5bc73f['query']);_0x405b27['attributes']=_[_0x3167('0x34')](_0x5bc73f[_0x3167('0x31')],qs['fields'](_0x550d95[_0x3167('0x33')][_0x3167('0x35')]));_0x405b27[_0x3167('0x36')]=_0x405b27[_0x3167('0x36')]['length']?_0x405b27['attributes']:_0x5bc73f[_0x3167('0x31')];_0x405b27[_0x3167('0x39')]=qs[_0x3167('0x3a')](_0x550d95[_0x3167('0x33')][_0x3167('0x3a')]);_0x405b27[_0x3167('0x3e')]=qs[_0x3167('0x3b')](_[_0x3167('0x3c')](_0x550d95['query'],_0x5bc73f[_0x3167('0x3b')]));if(_0x550d95['query'][_0x3167('0x3d')]){_0x405b27[_0x3167('0x3e')]=_[_0x3167('0x40')](_0x405b27[_0x3167('0x3e')],{'$or':_['map'](_0x405b27['attributes'],function(_0x1b1b24){var _0x26d6bb={};_0x26d6bb[_0x1b1b24]={'$like':'%'+_0x550d95[_0x3167('0x33')][_0x3167('0x3d')]+'%'};return _0x26d6bb;})});}_0x405b27=_[_0x3167('0x40')]({},_0x405b27,_0x550d95[_0x3167('0x46')]);return _0x496582[_0x3167('0x4c')](_0x405b27);}})[_0x3167('0x25')](function(_0x4713ca){if(_0x4713ca){_0x3409a6=_0x4713ca[_0x3167('0x37')];if(!_0x550d95['query'][_0x3167('0x4d')](_0x3167('0x38'))){_0x405b27[_0x3167('0x1f')]=qs[_0x3167('0x1f')](_0x550d95[_0x3167('0x33')]['limit']);_0x405b27[_0x3167('0x1d')]=qs['offset'](_0x550d95[_0x3167('0x33')][_0x3167('0x1d')]);}return _0x496582[_0x3167('0x4c')](_0x405b27);}})[_0x3167('0x25')](function(_0x9e47b6){if(_0x9e47b6){return _0x9e47b6?{'count':_0x3409a6,'rows':_0x9e47b6}:null;}})[_0x3167('0x25')](respondWithResult(_0x4f58ba,null))[_0x3167('0x43')](handleError(_0x4f58ba,null));};exports['getSubjects']=function(_0x37535b,_0x1c2258,_0x56a9d4){var _0x1ea15b={};var _0x48e904={};var _0x4b905d;var _0x3c71dd;return db[_0x3167('0x2c')][_0x3167('0x4b')]({'where':{'id':_0x37535b[_0x3167('0x45')]['id']}})[_0x3167('0x25')](handleEntityNotFound(_0x1c2258,null))[_0x3167('0x25')](function(_0xfd00e4){if(_0xfd00e4){_0x4b905d=_0xfd00e4;_0x48e904['model']=_['keys'](db[_0x3167('0x4e')][_0x3167('0x2d')]);_0x48e904[_0x3167('0x33')]=_[_0x3167('0x32')](_0x37535b['query']);_0x48e904[_0x3167('0x3b')]=_[_0x3167('0x34')](_0x48e904[_0x3167('0x31')],_0x48e904['query']);_0x1ea15b[_0x3167('0x36')]=_[_0x3167('0x34')](_0x48e904[_0x3167('0x31')],qs[_0x3167('0x35')](_0x37535b[_0x3167('0x33')][_0x3167('0x35')]));_0x1ea15b[_0x3167('0x36')]=_0x1ea15b[_0x3167('0x36')][_0x3167('0x37')]?_0x1ea15b[_0x3167('0x36')]:_0x48e904[_0x3167('0x31')];_0x1ea15b['order']=qs['sort'](_0x37535b['query'][_0x3167('0x3a')]);_0x1ea15b[_0x3167('0x3e')]=qs['filters'](_['pick'](_0x37535b[_0x3167('0x33')],_0x48e904[_0x3167('0x3b')]));if(_0x37535b['query'][_0x3167('0x3d')]){_0x1ea15b[_0x3167('0x3e')]=_[_0x3167('0x40')](_0x1ea15b[_0x3167('0x3e')],{'$or':_['map'](_0x1ea15b[_0x3167('0x36')],function(_0x2acc6a){var _0x43d11d={};_0x43d11d[_0x2acc6a]={'$like':'%'+_0x37535b[_0x3167('0x33')][_0x3167('0x3d')]+'%'};return _0x43d11d;})});}_0x1ea15b=_[_0x3167('0x40')]({},_0x1ea15b,_0x37535b[_0x3167('0x46')]);return _0x4b905d[_0x3167('0x4f')](_0x1ea15b);}})[_0x3167('0x25')](function(_0x2db74c){if(_0x2db74c){_0x3c71dd=_0x2db74c[_0x3167('0x37')];if(!_0x37535b[_0x3167('0x33')][_0x3167('0x4d')](_0x3167('0x38'))){_0x1ea15b[_0x3167('0x1f')]=qs[_0x3167('0x1f')](_0x37535b[_0x3167('0x33')][_0x3167('0x1f')]);_0x1ea15b[_0x3167('0x1d')]=qs[_0x3167('0x1d')](_0x37535b['query'][_0x3167('0x1d')]);}return _0x4b905d['getSubjects'](_0x1ea15b);}})[_0x3167('0x25')](function(_0x10443b){if(_0x10443b){return _0x10443b?{'count':_0x3c71dd,'rows':_0x10443b}:null;}})[_0x3167('0x25')](respondWithResult(_0x1c2258,null))['catch'](handleError(_0x1c2258,null));};exports[_0x3167('0x50')]=function(_0x92eaa4,_0x74ca54,_0x13bc96){var _0xecf9a1={};var _0x2aaaaa={};var _0x3bf497;var _0x2512c4;return db[_0x3167('0x2c')]['findOne']({'where':{'id':_0x92eaa4[_0x3167('0x45')]['id']}})[_0x3167('0x25')](handleEntityNotFound(_0x74ca54,null))[_0x3167('0x25')](function(_0x28e296){if(_0x28e296){_0x3bf497=_0x28e296;_0x2aaaaa['model']=_[_0x3167('0x32')](db[_0x3167('0x4e')][_0x3167('0x2d')]);_0x2aaaaa[_0x3167('0x33')]=_[_0x3167('0x32')](_0x92eaa4[_0x3167('0x33')]);_0x2aaaaa[_0x3167('0x3b')]=_[_0x3167('0x34')](_0x2aaaaa[_0x3167('0x31')],_0x2aaaaa[_0x3167('0x33')]);_0xecf9a1['attributes']=_[_0x3167('0x34')](_0x2aaaaa[_0x3167('0x31')],qs[_0x3167('0x35')](_0x92eaa4[_0x3167('0x33')][_0x3167('0x35')]));_0xecf9a1[_0x3167('0x36')]=_0xecf9a1[_0x3167('0x36')][_0x3167('0x37')]?_0xecf9a1[_0x3167('0x36')]:_0x2aaaaa[_0x3167('0x31')];_0xecf9a1[_0x3167('0x39')]=qs[_0x3167('0x3a')](_0x92eaa4['query'][_0x3167('0x3a')]);_0xecf9a1[_0x3167('0x3e')]=qs[_0x3167('0x3b')](_[_0x3167('0x3c')](_0x92eaa4['query'],_0x2aaaaa[_0x3167('0x3b')]));if(_0x92eaa4[_0x3167('0x33')]['filter']){_0xecf9a1[_0x3167('0x3e')]=_['merge'](_0xecf9a1[_0x3167('0x3e')],{'$or':_[_0x3167('0x2b')](_0xecf9a1[_0x3167('0x36')],function(_0x26614d){var _0x483179={};_0x483179[_0x26614d]={'$like':'%'+_0x92eaa4['query'][_0x3167('0x3d')]+'%'};return _0x483179;})});}_0xecf9a1=_[_0x3167('0x40')]({},_0xecf9a1,_0x92eaa4['options']);return _0x3bf497['getDescriptions'](_0xecf9a1);}})['then'](function(_0x40d111){if(_0x40d111){_0x2512c4=_0x40d111[_0x3167('0x37')];if(!_0x92eaa4[_0x3167('0x33')][_0x3167('0x4d')](_0x3167('0x38'))){_0xecf9a1[_0x3167('0x1f')]=qs[_0x3167('0x1f')](_0x92eaa4[_0x3167('0x33')]['limit']);_0xecf9a1[_0x3167('0x1d')]=qs[_0x3167('0x1d')](_0x92eaa4['query'][_0x3167('0x1d')]);}return _0x3bf497['getDescriptions'](_0xecf9a1);}})[_0x3167('0x25')](function(_0x42784e){if(_0x42784e){return _0x42784e?{'count':_0x2512c4,'rows':_0x42784e}:null;}})[_0x3167('0x25')](respondWithResult(_0x74ca54,null))[_0x3167('0x43')](handleError(_0x74ca54,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 67cd57c..ce88d34 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 _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x38cebb,_0x137c66){var _0x2d3ef8=function(_0x2d0579){while(--_0x2d0579){_0x38cebb['push'](_0x38cebb['shift']());}};_0x2d3ef8(++_0x137c66);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x00bb[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x36afb9,_0xb8125e){var _0x1022d5=function(_0x8cab4e){while(--_0x8cab4e){_0x36afb9['push'](_0x36afb9['shift']());}};_0x1022d5(++_0xb8125e);}(_0xf109,0xce));var _0x9f10=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf109[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 8ca16a5..6ae6ff4 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 _0x4697=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57ec4a,_0x39224f){var _0x55969d=function(_0x493b2d){while(--_0x493b2d){_0x57ec4a['push'](_0x57ec4a['shift']());}};_0x55969d(++_0x39224f);}(_0x4697,0x10c));var _0x7469=function(_0x371d6e,_0x3955d0){_0x371d6e=_0x371d6e-0x0;var _0x480004=_0x4697[_0x371d6e];return _0x480004;};'use strict';var _=require(_0x7469('0x0'));var util=require(_0x7469('0x1'));var moment=require(_0x7469('0x2'));var BPromise=require(_0x7469('0x3'));var rs=require(_0x7469('0x4'));var fs=require('fs');var Redis=require(_0x7469('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7469('0x6'))(_0x7469('0x7'));var config=require('../../config/environment');var jayson=require(_0x7469('0x8'));var client=jayson['client'][_0x7469('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf70dcf,_0x1a4286,_0x9a3d49){return new BPromise(function(_0x455a01,_0x4fbea4){return client[_0x7469('0xa')](_0xf70dcf,_0x9a3d49)[_0x7469('0xb')](function(_0x540334){logger[_0x7469('0xc')](_0x7469('0xd'),_0x1a4286,_0x7469('0xe'));logger['debug'](_0x7469('0xf'),_0x1a4286,'request\x20sent',JSON[_0x7469('0x10')](_0x540334));if(_0x540334[_0x7469('0x11')]){if(_0x540334[_0x7469('0x11')][_0x7469('0x12')]===0x1f4){logger['error'](_0x7469('0xd'),_0x1a4286,_0x540334[_0x7469('0x11')][_0x7469('0x13')]);return _0x4fbea4(_0x540334[_0x7469('0x11')][_0x7469('0x13')]);}logger[_0x7469('0x11')](_0x7469('0xd'),_0x1a4286,_0x540334[_0x7469('0x11')][_0x7469('0x13')]);return _0x455a01(_0x540334['error'][_0x7469('0x13')]);}else{logger[_0x7469('0xc')](_0x7469('0xd'),_0x1a4286,_0x7469('0xe'));_0x455a01(_0x540334[_0x7469('0x14')][_0x7469('0x13')]);}})[_0x7469('0x15')](function(_0x2c005c){logger[_0x7469('0x11')](_0x7469('0xd'),_0x1a4286,_0x2c005c);_0x4fbea4(_0x2c005c);});});} \ No newline at end of file +var _0xfaf6=['message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','debug','request\x20sent','stringify','error','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xfaf6,0x123));var _0x6faf=function(_0x48ef7a,_0x3bf178){_0x48ef7a=_0x48ef7a-0x0;var _0x58cdce=_0xfaf6[_0x48ef7a];return _0x58cdce;};'use strict';var _=require('lodash');var util=require(_0x6faf('0x0'));var moment=require('moment');var BPromise=require(_0x6faf('0x1'));var rs=require(_0x6faf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6faf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6faf('0x4'))(_0x6faf('0x5'));var config=require(_0x6faf('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6faf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x426792,_0x3740d3,_0x493f70){return new BPromise(function(_0x302734,_0x78d3d){return client['request'](_0x426792,_0x493f70)[_0x6faf('0x8')](function(_0x542813){logger[_0x6faf('0x9')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3740d3,'request\x20sent');logger[_0x6faf('0xa')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3740d3,_0x6faf('0xb'),JSON[_0x6faf('0xc')](_0x542813));if(_0x542813[_0x6faf('0xd')]){if(_0x542813[_0x6faf('0xd')]['code']===0x1f4){logger[_0x6faf('0xd')](_0x6faf('0xe'),_0x3740d3,_0x542813['error'][_0x6faf('0xf')]);return _0x78d3d(_0x542813[_0x6faf('0xd')]['message']);}logger['error'](_0x6faf('0xe'),_0x3740d3,_0x542813[_0x6faf('0xd')][_0x6faf('0xf')]);return _0x302734(_0x542813[_0x6faf('0xd')][_0x6faf('0xf')]);}else{logger[_0x6faf('0x9')](_0x6faf('0xe'),_0x3740d3,'request\x20sent');_0x302734(_0x542813[_0x6faf('0x10')][_0x6faf('0xf')]);}})[_0x6faf('0x11')](function(_0x18eef1){logger[_0x6faf('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3740d3,_0x18eef1);_0x78d3d(_0x18eef1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 4202723..e432f68 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 _0xb4eb=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x8f0382,_0x1c3a78){var _0x1b2a34=function(_0x368846){while(--_0x368846){_0x8f0382['push'](_0x8f0382['shift']());}};_0x1b2a34(++_0x1c3a78);}(_0xb4eb,0xfe));var _0xbb4e=function(_0x1c878c,_0xbc6905){_0x1c878c=_0x1c878c-0x0;var _0x8bb7d7=_0xb4eb[_0x1c878c];return _0x8bb7d7;};'use strict';var multer=require('multer');var util=require(_0xbb4e('0x0'));var path=require(_0xbb4e('0x1'));var timeout=require(_0xbb4e('0x2'));var express=require(_0xbb4e('0x3'));var router=express[_0xbb4e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb4e('0x5'));var interaction=require(_0xbb4e('0x6'));var config=require(_0xbb4e('0x7'));var controller=require(_0xbb4e('0x8'));router[_0xbb4e('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xa')]);router[_0xbb4e('0x9')](_0xbb4e('0xb'),auth[_0xbb4e('0xc')](),controller[_0xbb4e('0xd')]);router[_0xbb4e('0xe')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xf')]);router[_0xbb4e('0x10')]('/:id',auth[_0xbb4e('0xc')](),controller[_0xbb4e('0x11')]);router[_0xbb4e('0x12')](_0xbb4e('0xb'),auth[_0xbb4e('0xc')](),controller[_0xbb4e('0x13')]);module[_0xbb4e('0x14')]=router; \ No newline at end of file +var _0xa68d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xa68d,0x150));var _0xda68=function(_0x443f36,_0x2c8e4b){_0x443f36=_0x443f36-0x0;var _0x5e5ff0=_0xa68d[_0x443f36];return _0x5e5ff0;};'use strict';var multer=require(_0xda68('0x0'));var util=require(_0xda68('0x1'));var path=require('path');var timeout=require(_0xda68('0x2'));var express=require(_0xda68('0x3'));var router=express[_0xda68('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xda68('0x5'));var interaction=require(_0xda68('0x6'));var config=require(_0xda68('0x7'));var controller=require(_0xda68('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xda68('0x9')](_0xda68('0xa'),auth[_0xda68('0xb')](),controller[_0xda68('0xc')]);router[_0xda68('0xd')]('/',auth['isAuthenticated'](),controller[_0xda68('0xe')]);router[_0xda68('0xf')](_0xda68('0xa'),auth[_0xda68('0xb')](),controller[_0xda68('0x10')]);router[_0xda68('0x11')](_0xda68('0xa'),auth[_0xda68('0xb')](),controller[_0xda68('0x12')]);module[_0xda68('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 1c89b3f..786a511 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 _0x5c69=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3d5184,_0x34079c){var _0x36ba50=function(_0x2b6b54){while(--_0x2b6b54){_0x3d5184['push'](_0x3d5184['shift']());}};_0x36ba50(++_0x34079c);}(_0x5c69,0x1d2));var _0x95c6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5c69[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x95c6('0x0'));module[_0x95c6('0x1')]={'type':{'type':Sequelize[_0x95c6('0x2')](_0x95c6('0x3'),_0x95c6('0x4'),_0x95c6('0x5'),_0x95c6('0x6'),_0x95c6('0x7')),'defaultValue':_0x95c6('0x3')},'content':{'type':Sequelize[_0x95c6('0x8')]},'key':{'type':Sequelize[_0x95c6('0x8')]},'keyType':{'type':Sequelize[_0x95c6('0x2')]('string',_0x95c6('0x4'),_0x95c6('0x5'))},'keyContent':{'type':Sequelize[_0x95c6('0x8')]},'idField':{'type':Sequelize[_0x95c6('0x8')]},'nameField':{'type':Sequelize[_0x95c6('0x8')]},'customField':{'type':Sequelize[_0x95c6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c1b=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x16ecad,_0x205047){var _0x313ff7=function(_0x58b16a){while(--_0x58b16a){_0x16ecad['push'](_0x16ecad['shift']());}};_0x313ff7(++_0x205047);}(_0x1c1b,0xf8));var _0xb1c1=function(_0x4da12a,_0x36ac66){_0x4da12a=_0x4da12a-0x0;var _0xfadf93=_0x1c1b[_0x4da12a];return _0xfadf93;};'use strict';var Sequelize=require(_0xb1c1('0x0'));module[_0xb1c1('0x1')]={'type':{'type':Sequelize[_0xb1c1('0x2')](_0xb1c1('0x3'),_0xb1c1('0x4'),'customVariable',_0xb1c1('0x5'),_0xb1c1('0x6')),'defaultValue':_0xb1c1('0x3')},'content':{'type':Sequelize[_0xb1c1('0x7')]},'key':{'type':Sequelize[_0xb1c1('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb1c1('0x3'),_0xb1c1('0x4'),_0xb1c1('0x8'))},'keyContent':{'type':Sequelize[_0xb1c1('0x7')]},'idField':{'type':Sequelize[_0xb1c1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb1c1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb1c1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index dac028c..c1a40cb 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 _0x1d5a=['count','apply','reject','save','update','destroy','then','error','name','send','index','map','Dynamics365Field','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','include','catch','show','params','rawAttributes','keys','includeAll','create','body','find','eml-format','rimraf','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1d5a,0xfa));var _0xa1d5=function(_0x3f69ae,_0x37dc63){_0x3f69ae=_0x3f69ae-0x0;var _0x358991=_0x1d5a[_0x3f69ae];return _0x358991;};'use strict';var emlformat=require(_0xa1d5('0x0'));var rimraf=require(_0xa1d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1d5('0x2'));var moment=require(_0xa1d5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa1d5('0x4'));var sox=require(_0xa1d5('0x5'));var csv=require('to-csv');var ejs=require(_0xa1d5('0x6'));var fs=require('fs');var fs_extra=require(_0xa1d5('0x7'));var _=require(_0xa1d5('0x8'));var squel=require(_0xa1d5('0x9'));var crypto=require(_0xa1d5('0xa'));var jsforce=require(_0xa1d5('0xb'));var deskjs=require(_0xa1d5('0xc'));var toCsv=require(_0xa1d5('0xd'));var querystring=require('querystring');var Papa=require(_0xa1d5('0xe'));var Redis=require(_0xa1d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1d5('0x10'));var as=require(_0xa1d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa1d5('0x12'));var utils=require(_0xa1d5('0x13'));var config=require(_0xa1d5('0x14'));var licenseUtil=require(_0xa1d5('0x15'));var db=require(_0xa1d5('0x16'))['db'];function respondWithStatusCode(_0x67aad9,_0x52549e){_0x52549e=_0x52549e||0xcc;return function(_0x93bc52){if(_0x93bc52){return _0x67aad9[_0xa1d5('0x17')](_0x52549e);}return _0x67aad9[_0xa1d5('0x18')](_0x52549e)[_0xa1d5('0x19')]();};}function respondWithResult(_0x51b948,_0x27caa3){_0x27caa3=_0x27caa3||0xc8;return function(_0x2cab38){if(_0x2cab38){return _0x51b948[_0xa1d5('0x18')](_0x27caa3)[_0xa1d5('0x1a')](_0x2cab38);}};}function respondWithFilteredResult(_0x291aca,_0x3c372b){return function(_0x5ea773){if(_0x5ea773){var _0x1832ee=typeof _0x3c372b['offset']===_0xa1d5('0x1b')&&typeof _0x3c372b[_0xa1d5('0x1c')]===_0xa1d5('0x1b');var _0x483509=_0x5ea773['count'];var _0x5e89f2=_0x1832ee?0x0:_0x3c372b[_0xa1d5('0x1d')];var _0x10fc23=_0x1832ee?_0x5ea773[_0xa1d5('0x1e')]:_0x3c372b[_0xa1d5('0x1d')]+_0x3c372b[_0xa1d5('0x1c')];var _0x56bc15;if(_0x10fc23>=_0x483509){_0x10fc23=_0x483509;_0x56bc15=0xc8;}else{_0x56bc15=0xce;}_0x291aca[_0xa1d5('0x18')](_0x56bc15);return _0x291aca['set']('Content-Range',_0x5e89f2+'-'+_0x10fc23+'/'+_0x483509)[_0xa1d5('0x1a')](_0x5ea773);}return null;};}function patchUpdates(_0x4e72c6){return function(_0x86f303){try{jsonpatch[_0xa1d5('0x1f')](_0x86f303,_0x4e72c6,!![]);}catch(_0x4c00cf){return BPromise[_0xa1d5('0x20')](_0x4c00cf);}return _0x86f303[_0xa1d5('0x21')]();};}function saveUpdates(_0x4bc519,_0x1acd54){return function(_0x1f8c77){if(_0x1f8c77){return _0x1f8c77[_0xa1d5('0x22')](_0x4bc519)['then'](function(_0x3fee9c){return _0x3fee9c;});}return null;};}function removeEntity(_0x5424bc,_0x40d9cd){return function(_0x47d7bc){if(_0x47d7bc){return _0x47d7bc[_0xa1d5('0x23')]()[_0xa1d5('0x24')](function(){_0x5424bc['status'](0xcc)[_0xa1d5('0x19')]();});}};}function handleEntityNotFound(_0x4e997a,_0x4e91df){return function(_0x209c01){if(!_0x209c01){_0x4e997a[_0xa1d5('0x17')](0x194);}return _0x209c01;};}function handleError(_0x10c33f,_0x4fe31b){_0x4fe31b=_0x4fe31b||0x1f4;return function(_0x2e7dae){logger[_0xa1d5('0x25')](_0x2e7dae['stack']);if(_0x2e7dae['name']){delete _0x2e7dae[_0xa1d5('0x26')];}_0x10c33f[_0xa1d5('0x18')](_0x4fe31b)[_0xa1d5('0x27')](_0x2e7dae);};}exports[_0xa1d5('0x28')]=function(_0x3aaef8,_0x10b0f5){var _0x5c40f8={},_0x1aacc3={},_0x340eb2={'count':0x0,'rows':[]};var _0xb5c279=_[_0xa1d5('0x29')](db[_0xa1d5('0x2a')]['rawAttributes'],function(_0x52817d){return{'name':_0x52817d['fieldName'],'type':_0x52817d['type'][_0xa1d5('0x2b')]};});_0x1aacc3[_0xa1d5('0x2c')]=_[_0xa1d5('0x29')](_0xb5c279,_0xa1d5('0x26'));_0x1aacc3[_0xa1d5('0x2d')]=_['keys'](_0x3aaef8['query']);_0x1aacc3[_0xa1d5('0x2e')]=_[_0xa1d5('0x2f')](_0x1aacc3[_0xa1d5('0x2c')],_0x1aacc3[_0xa1d5('0x2d')]);_0x5c40f8[_0xa1d5('0x30')]=_[_0xa1d5('0x2f')](_0x1aacc3['model'],qs[_0xa1d5('0x31')](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x31')]));_0x5c40f8[_0xa1d5('0x30')]=_0x5c40f8[_0xa1d5('0x30')][_0xa1d5('0x32')]?_0x5c40f8['attributes']:_0x1aacc3['model'];if(!_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x33')]('nolimit')){_0x5c40f8['limit']=qs[_0xa1d5('0x1c')](_0x3aaef8['query'][_0xa1d5('0x1c')]);_0x5c40f8[_0xa1d5('0x1d')]=qs['offset'](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x1d')]);}_0x5c40f8[_0xa1d5('0x34')]=qs[_0xa1d5('0x35')](_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x35')]);_0x5c40f8[_0xa1d5('0x36')]=qs[_0xa1d5('0x2e')](_[_0xa1d5('0x37')](_0x3aaef8[_0xa1d5('0x2d')],_0x1aacc3[_0xa1d5('0x2e')]),_0xb5c279);if(_0x3aaef8[_0xa1d5('0x2d')][_0xa1d5('0x38')]){_0x5c40f8[_0xa1d5('0x36')]=_['merge'](_0x5c40f8[_0xa1d5('0x36')],{'$or':_[_0xa1d5('0x29')](_0xb5c279,function(_0x40802b){if(_0x40802b[_0xa1d5('0x39')]!=='VIRTUAL'){var _0x3faca9={};_0x3faca9[_0x40802b[_0xa1d5('0x26')]]={'$like':'%'+_0x3aaef8['query']['filter']+'%'};return _0x3faca9;}})});}_0x5c40f8=_[_0xa1d5('0x3a')]({},_0x5c40f8,_0x3aaef8[_0xa1d5('0x3b')]);var _0x95e941={'where':_0x5c40f8[_0xa1d5('0x36')]};return db[_0xa1d5('0x2a')][_0xa1d5('0x1e')](_0x95e941)['then'](function(_0x4f88c2){_0x340eb2[_0xa1d5('0x1e')]=_0x4f88c2;if(_0x3aaef8[_0xa1d5('0x2d')]['includeAll']){_0x5c40f8[_0xa1d5('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x5c40f8);})['then'](function(_0x26bb80){_0x340eb2['rows']=_0x26bb80;return _0x340eb2;})['then'](respondWithFilteredResult(_0x10b0f5,_0x5c40f8))[_0xa1d5('0x3d')](handleError(_0x10b0f5,null));};exports[_0xa1d5('0x3e')]=function(_0x6ca778,_0x40a419){var _0x1bf919={'raw':!![],'where':{'id':_0x6ca778[_0xa1d5('0x3f')]['id']}},_0x436f86={};_0x436f86[_0xa1d5('0x2c')]=_['keys'](db[_0xa1d5('0x2a')][_0xa1d5('0x40')]);_0x436f86['query']=_[_0xa1d5('0x41')](_0x6ca778[_0xa1d5('0x2d')]);_0x436f86[_0xa1d5('0x2e')]=_[_0xa1d5('0x2f')](_0x436f86[_0xa1d5('0x2c')],_0x436f86[_0xa1d5('0x2d')]);_0x1bf919[_0xa1d5('0x30')]=_['intersection'](_0x436f86[_0xa1d5('0x2c')],qs[_0xa1d5('0x31')](_0x6ca778[_0xa1d5('0x2d')][_0xa1d5('0x31')]));_0x1bf919[_0xa1d5('0x30')]=_0x1bf919[_0xa1d5('0x30')][_0xa1d5('0x32')]?_0x1bf919[_0xa1d5('0x30')]:_0x436f86['model'];if(_0x6ca778[_0xa1d5('0x2d')][_0xa1d5('0x42')]){_0x1bf919[_0xa1d5('0x3c')]=[{'all':!![]}];}_0x1bf919=_[_0xa1d5('0x3a')]({},_0x1bf919,_0x6ca778[_0xa1d5('0x3b')]);return db[_0xa1d5('0x2a')]['find'](_0x1bf919)[_0xa1d5('0x24')](handleEntityNotFound(_0x40a419,null))[_0xa1d5('0x24')](respondWithResult(_0x40a419,null))[_0xa1d5('0x3d')](handleError(_0x40a419,null));};exports[_0xa1d5('0x43')]=function(_0xb73936,_0x263a48){return db['Dynamics365Field'][_0xa1d5('0x43')](_0xb73936[_0xa1d5('0x44')],{})[_0xa1d5('0x24')](respondWithResult(_0x263a48,0xc9))[_0xa1d5('0x3d')](handleError(_0x263a48,null));};exports['update']=function(_0x2a0cb6,_0x523225){if(_0x2a0cb6[_0xa1d5('0x44')]['id']){delete _0x2a0cb6[_0xa1d5('0x44')]['id'];}return db['Dynamics365Field'][_0xa1d5('0x45')]({'where':{'id':_0x2a0cb6[_0xa1d5('0x3f')]['id']}})[_0xa1d5('0x24')](handleEntityNotFound(_0x523225,null))[_0xa1d5('0x24')](saveUpdates(_0x2a0cb6[_0xa1d5('0x44')],null))['then'](respondWithResult(_0x523225,null))[_0xa1d5('0x3d')](handleError(_0x523225,null));};exports[_0xa1d5('0x23')]=function(_0x58dd57,_0x43cfdb){return db[_0xa1d5('0x2a')]['find']({'where':{'id':_0x58dd57[_0xa1d5('0x3f')]['id']}})[_0xa1d5('0x24')](handleEntityNotFound(_0x43cfdb,null))[_0xa1d5('0x24')](removeEntity(_0x43cfdb,null))['catch'](handleError(_0x43cfdb,null));}; \ No newline at end of file +var _0x38a2=['../../config/license/util','sendStatus','status','json','undefined','count','limit','set','Content-Range','reject','destroy','then','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','VIRTUAL','includeAll','include','catch','show','params','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0x38a2,0x149));var _0x238a=function(_0x1b7706,_0x7a59c3){_0x1b7706=_0x1b7706-0x0;var _0x16138b=_0x38a2[_0x1b7706];return _0x16138b;};'use strict';var emlformat=require(_0x238a('0x0'));var rimraf=require(_0x238a('0x1'));var zipdir=require(_0x238a('0x2'));var jsonpatch=require(_0x238a('0x3'));var rp=require(_0x238a('0x4'));var moment=require('moment');var BPromise=require(_0x238a('0x5'));var Mustache=require(_0x238a('0x6'));var util=require(_0x238a('0x7'));var path=require(_0x238a('0x8'));var sox=require(_0x238a('0x9'));var csv=require('to-csv');var ejs=require(_0x238a('0xa'));var fs=require('fs');var fs_extra=require(_0x238a('0xb'));var _=require(_0x238a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x238a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x238a('0xe'));var querystring=require('querystring');var Papa=require(_0x238a('0xf'));var Redis=require(_0x238a('0x10'));var authService=require(_0x238a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x238a('0x12'));var hardwareService=require(_0x238a('0x13'));var logger=require(_0x238a('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x238a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5caf66,_0x1111de){_0x1111de=_0x1111de||0xcc;return function(_0x44be91){if(_0x44be91){return _0x5caf66[_0x238a('0x16')](_0x1111de);}return _0x5caf66[_0x238a('0x17')](_0x1111de)['end']();};}function respondWithResult(_0x5da138,_0x28f173){_0x28f173=_0x28f173||0xc8;return function(_0x513946){if(_0x513946){return _0x5da138[_0x238a('0x17')](_0x28f173)[_0x238a('0x18')](_0x513946);}};}function respondWithFilteredResult(_0x23f9c7,_0x5d0ef2){return function(_0x508b14){if(_0x508b14){var _0x132820=typeof _0x5d0ef2['offset']===_0x238a('0x19')&&typeof _0x5d0ef2['limit']===_0x238a('0x19');var _0x2be6be=_0x508b14['count'];var _0x2ef519=_0x132820?0x0:_0x5d0ef2['offset'];var _0xf2579a=_0x132820?_0x508b14[_0x238a('0x1a')]:_0x5d0ef2['offset']+_0x5d0ef2[_0x238a('0x1b')];var _0x99233b;if(_0xf2579a>=_0x2be6be){_0xf2579a=_0x2be6be;_0x99233b=0xc8;}else{_0x99233b=0xce;}_0x23f9c7['status'](_0x99233b);return _0x23f9c7[_0x238a('0x1c')](_0x238a('0x1d'),_0x2ef519+'-'+_0xf2579a+'/'+_0x2be6be)[_0x238a('0x18')](_0x508b14);}return null;};}function patchUpdates(_0x27488d){return function(_0x1153c9){try{jsonpatch['apply'](_0x1153c9,_0x27488d,!![]);}catch(_0x1c205e){return BPromise[_0x238a('0x1e')](_0x1c205e);}return _0x1153c9['save']();};}function saveUpdates(_0x534176,_0x1180a3){return function(_0x342c17){if(_0x342c17){return _0x342c17['update'](_0x534176)['then'](function(_0x43493e){return _0x43493e;});}return null;};}function removeEntity(_0x416b8d,_0x31a3ba){return function(_0xfb5269){if(_0xfb5269){return _0xfb5269[_0x238a('0x1f')]()[_0x238a('0x20')](function(){_0x416b8d[_0x238a('0x17')](0xcc)[_0x238a('0x21')]();});}};}function handleEntityNotFound(_0x15305e,_0x5d0afe){return function(_0x1c39bd){if(!_0x1c39bd){_0x15305e[_0x238a('0x16')](0x194);}return _0x1c39bd;};}function handleError(_0x50b7af,_0x14f2fd){_0x14f2fd=_0x14f2fd||0x1f4;return function(_0x576b14){logger[_0x238a('0x22')](_0x576b14[_0x238a('0x23')]);if(_0x576b14[_0x238a('0x24')]){delete _0x576b14[_0x238a('0x24')];}_0x50b7af['status'](_0x14f2fd)[_0x238a('0x25')](_0x576b14);};}exports[_0x238a('0x26')]=function(_0x4f957f,_0x46de0c){var _0x31128d={},_0x4cfa33={},_0x257fc5={'count':0x0,'rows':[]};var _0x4f6cf1=_[_0x238a('0x27')](db[_0x238a('0x28')][_0x238a('0x29')],function(_0x551ea5){return{'name':_0x551ea5['fieldName'],'type':_0x551ea5[_0x238a('0x2a')][_0x238a('0x2b')]};});_0x4cfa33[_0x238a('0x2c')]=_[_0x238a('0x27')](_0x4f6cf1,'name');_0x4cfa33[_0x238a('0x2d')]=_[_0x238a('0x2e')](_0x4f957f[_0x238a('0x2d')]);_0x4cfa33[_0x238a('0x2f')]=_[_0x238a('0x30')](_0x4cfa33[_0x238a('0x2c')],_0x4cfa33[_0x238a('0x2d')]);_0x31128d[_0x238a('0x31')]=_[_0x238a('0x30')](_0x4cfa33[_0x238a('0x2c')],qs[_0x238a('0x32')](_0x4f957f[_0x238a('0x2d')]['fields']));_0x31128d[_0x238a('0x31')]=_0x31128d['attributes'][_0x238a('0x33')]?_0x31128d[_0x238a('0x31')]:_0x4cfa33['model'];if(!_0x4f957f[_0x238a('0x2d')][_0x238a('0x34')]('nolimit')){_0x31128d[_0x238a('0x1b')]=qs[_0x238a('0x1b')](_0x4f957f[_0x238a('0x2d')]['limit']);_0x31128d[_0x238a('0x35')]=qs['offset'](_0x4f957f[_0x238a('0x2d')]['offset']);}_0x31128d[_0x238a('0x36')]=qs['sort'](_0x4f957f[_0x238a('0x2d')][_0x238a('0x37')]);_0x31128d['where']=qs[_0x238a('0x2f')](_[_0x238a('0x38')](_0x4f957f[_0x238a('0x2d')],_0x4cfa33['filters']),_0x4f6cf1);if(_0x4f957f[_0x238a('0x2d')][_0x238a('0x39')]){_0x31128d['where']=_['merge'](_0x31128d[_0x238a('0x3a')],{'$or':_[_0x238a('0x27')](_0x4f6cf1,function(_0x2cb86b){if(_0x2cb86b[_0x238a('0x2a')]!==_0x238a('0x3b')){var _0x34b2d0={};_0x34b2d0[_0x2cb86b['name']]={'$like':'%'+_0x4f957f[_0x238a('0x2d')][_0x238a('0x39')]+'%'};return _0x34b2d0;}})});}_0x31128d=_['merge']({},_0x31128d,_0x4f957f['options']);var _0x3cc01e={'where':_0x31128d[_0x238a('0x3a')]};return db['Dynamics365Field'][_0x238a('0x1a')](_0x3cc01e)[_0x238a('0x20')](function(_0x382c1e){_0x257fc5[_0x238a('0x1a')]=_0x382c1e;if(_0x4f957f[_0x238a('0x2d')][_0x238a('0x3c')]){_0x31128d[_0x238a('0x3d')]=[{'all':!![]}];}return db[_0x238a('0x28')]['findAll'](_0x31128d);})[_0x238a('0x20')](function(_0x3ed729){_0x257fc5['rows']=_0x3ed729;return _0x257fc5;})[_0x238a('0x20')](respondWithFilteredResult(_0x46de0c,_0x31128d))[_0x238a('0x3e')](handleError(_0x46de0c,null));};exports[_0x238a('0x3f')]=function(_0x338b0d,_0x4583eb){var _0x2b6116={'raw':!![],'where':{'id':_0x338b0d[_0x238a('0x40')]['id']}},_0x3ea28e={};_0x3ea28e[_0x238a('0x2c')]=_[_0x238a('0x2e')](db['Dynamics365Field']['rawAttributes']);_0x3ea28e[_0x238a('0x2d')]=_[_0x238a('0x2e')](_0x338b0d[_0x238a('0x2d')]);_0x3ea28e[_0x238a('0x2f')]=_['intersection'](_0x3ea28e['model'],_0x3ea28e[_0x238a('0x2d')]);_0x2b6116[_0x238a('0x31')]=_['intersection'](_0x3ea28e[_0x238a('0x2c')],qs['fields'](_0x338b0d[_0x238a('0x2d')][_0x238a('0x32')]));_0x2b6116[_0x238a('0x31')]=_0x2b6116[_0x238a('0x31')][_0x238a('0x33')]?_0x2b6116[_0x238a('0x31')]:_0x3ea28e[_0x238a('0x2c')];if(_0x338b0d[_0x238a('0x2d')][_0x238a('0x3c')]){_0x2b6116[_0x238a('0x3d')]=[{'all':!![]}];}_0x2b6116=_[_0x238a('0x41')]({},_0x2b6116,_0x338b0d['options']);return db[_0x238a('0x28')][_0x238a('0x42')](_0x2b6116)['then'](handleEntityNotFound(_0x4583eb,null))[_0x238a('0x20')](respondWithResult(_0x4583eb,null))[_0x238a('0x3e')](handleError(_0x4583eb,null));};exports['create']=function(_0x53af80,_0x19b00c){return db[_0x238a('0x28')][_0x238a('0x43')](_0x53af80[_0x238a('0x44')],{})[_0x238a('0x20')](respondWithResult(_0x19b00c,0xc9))['catch'](handleError(_0x19b00c,null));};exports[_0x238a('0x45')]=function(_0x178349,_0xe7557f){if(_0x178349[_0x238a('0x44')]['id']){delete _0x178349[_0x238a('0x44')]['id'];}return db[_0x238a('0x28')][_0x238a('0x42')]({'where':{'id':_0x178349[_0x238a('0x40')]['id']}})[_0x238a('0x20')](handleEntityNotFound(_0xe7557f,null))[_0x238a('0x20')](saveUpdates(_0x178349[_0x238a('0x44')],null))[_0x238a('0x20')](respondWithResult(_0xe7557f,null))[_0x238a('0x3e')](handleError(_0xe7557f,null));};exports[_0x238a('0x1f')]=function(_0x4ace18,_0x490d60){return db[_0x238a('0x28')][_0x238a('0x42')]({'where':{'id':_0x4ace18['params']['id']}})[_0x238a('0x20')](handleEntityNotFound(_0x490d60,null))['then'](removeEntity(_0x490d60,null))[_0x238a('0x3e')](handleError(_0x490d60,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c46828c..c0b5e40 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 _0x5115=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','idField','../../config/logger','api','moment','request-promise'];(function(_0x49b415,_0x21d38e){var _0x2cfe7c=function(_0x1d23fa){while(--_0x1d23fa){_0x49b415['push'](_0x49b415['shift']());}};_0x2cfe7c(++_0x21d38e);}(_0x5115,0xec));var _0x5511=function(_0x280fc6,_0x41200){_0x280fc6=_0x280fc6-0x0;var _0x4a40ae=_0x5115[_0x280fc6];return _0x4a40ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5511('0x0'))(_0x5511('0x1'));var moment=require(_0x5511('0x2'));var BPromise=require('bluebird');var rp=require(_0x5511('0x3'));var fs=require('fs');var path=require(_0x5511('0x4'));var rimraf=require(_0x5511('0x5'));var config=require(_0x5511('0x6'));var attributes=require(_0x5511('0x7'));module[_0x5511('0x8')]=function(_0x1b3462,_0x130ff5){return _0x1b3462[_0x5511('0x9')](_0x5511('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5511('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc1=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x1b95a1,_0x529852){var _0x57aef1=function(_0x1cb2fd){while(--_0x1cb2fd){_0x1b95a1['push'](_0x1b95a1['shift']());}};_0x57aef1(++_0x529852);}(_0xcbc1,0x128));var _0x1cbc=function(_0x4b78bf,_0x2af314){_0x4b78bf=_0x4b78bf-0x0;var _0x5ef80f=_0xcbc1[_0x4b78bf];return _0x5ef80f;};'use strict';var _=require(_0x1cbc('0x0'));var util=require(_0x1cbc('0x1'));var logger=require(_0x1cbc('0x2'))(_0x1cbc('0x3'));var moment=require(_0x1cbc('0x4'));var BPromise=require(_0x1cbc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cbc('0x6'));var config=require(_0x1cbc('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x1cbc('0x8')]=function(_0x52084d,_0x20aa36){return _0x52084d[_0x1cbc('0x9')]('Dynamics365Field',attributes,{'tableName':_0x1cbc('0xa'),'paranoid':![],'indexes':[{'name':_0x1cbc('0xb'),'fields':[_0x1cbc('0xc'),_0x1cbc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 483a58f..a91419a 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 _0xd2a7=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5403b2,_0xfd5b38){var _0x283bb2=function(_0x12080d){while(--_0x12080d){_0x5403b2['push'](_0x5403b2['shift']());}};_0x283bb2(++_0xfd5b38);}(_0xd2a7,0x1aa));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2a('0x0'));var util=require(_0x7d2a('0x1'));var moment=require(_0x7d2a('0x2'));var BPromise=require(_0x7d2a('0x3'));var rs=require(_0x7d2a('0x4'));var fs=require('fs');var Redis=require(_0x7d2a('0x5'));var db=require(_0x7d2a('0x6'))['db'];var utils=require(_0x7d2a('0x7'));var logger=require(_0x7d2a('0x8'))(_0x7d2a('0x9'));var config=require(_0x7d2a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7d2a('0xb')][_0x7d2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dd541,_0x5271fa,_0x24137b){return new BPromise(function(_0x47db62,_0x51267f){return client[_0x7d2a('0xd')](_0x2dd541,_0x24137b)[_0x7d2a('0xe')](function(_0x5c60b8){logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x5271fa,_0x7d2a('0x11'));logger[_0x7d2a('0x12')](_0x7d2a('0x13'),_0x5271fa,_0x7d2a('0x11'),JSON[_0x7d2a('0x14')](_0x5c60b8));if(_0x5c60b8[_0x7d2a('0x15')]){if(_0x5c60b8['error'][_0x7d2a('0x16')]===0x1f4){logger[_0x7d2a('0x15')](_0x7d2a('0x10'),_0x5271fa,_0x5c60b8[_0x7d2a('0x15')]['message']);return _0x51267f(_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);}logger['error'](_0x7d2a('0x10'),_0x5271fa,_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);return _0x47db62(_0x5c60b8[_0x7d2a('0x15')][_0x7d2a('0x17')]);}else{logger[_0x7d2a('0xf')](_0x7d2a('0x10'),_0x5271fa,_0x7d2a('0x11'));_0x47db62(_0x5c60b8['result']['message']);}})[_0x7d2a('0x18')](function(_0x1b9347){logger['error'](_0x7d2a('0x10'),_0x5271fa,_0x1b9347);_0x51267f(_0x1b9347);});});} \ No newline at end of file +var _0x451e=['code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x957a75,_0x347349){var _0x35d81b=function(_0x3cbf20){while(--_0x3cbf20){_0x957a75['push'](_0x957a75['shift']());}};_0x35d81b(++_0x347349);}(_0x451e,0x147));var _0xe451=function(_0x2b141e,_0x4b810f){_0x2b141e=_0x2b141e-0x0;var _0x191737=_0x451e[_0x2b141e];return _0x191737;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe451('0x0'));var rs=require(_0xe451('0x1'));var fs=require('fs');var Redis=require(_0xe451('0x2'));var db=require(_0xe451('0x3'))['db'];var utils=require(_0xe451('0x4'));var logger=require(_0xe451('0x5'))(_0xe451('0x6'));var config=require(_0xe451('0x7'));var jayson=require(_0xe451('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d08fb,_0xd89805,_0x2c159a){return new BPromise(function(_0x4879da,_0x441f07){return client[_0xe451('0x9')](_0x4d08fb,_0x2c159a)['then'](function(_0x526669){logger[_0xe451('0xa')](_0xe451('0xb'),_0xd89805,_0xe451('0xc'));logger[_0xe451('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xd89805,'request\x20sent',JSON['stringify'](_0x526669));if(_0x526669[_0xe451('0xe')]){if(_0x526669['error'][_0xe451('0xf')]===0x1f4){logger['error'](_0xe451('0xb'),_0xd89805,_0x526669['error'][_0xe451('0x10')]);return _0x441f07(_0x526669[_0xe451('0xe')][_0xe451('0x10')]);}logger['error'](_0xe451('0xb'),_0xd89805,_0x526669['error']['message']);return _0x4879da(_0x526669['error']['message']);}else{logger[_0xe451('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0xd89805,_0xe451('0xc'));_0x4879da(_0x526669[_0xe451('0x11')][_0xe451('0x10')]);}})[_0xe451('0x12')](function(_0x476640){logger[_0xe451('0xe')](_0xe451('0xb'),_0xd89805,_0x476640);_0x441f07(_0x476640);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d5dd38d..af371cb 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 _0x9204=['delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','addConfiguration','put','update'];(function(_0xb467fc,_0x5f015b){var _0x537229=function(_0x1caf0a){while(--_0x1caf0a){_0xb467fc['push'](_0xb467fc['shift']());}};_0x537229(++_0x5f015b);}(_0x9204,0xb2));var _0x4920=function(_0x14d83f,_0x5b522a){_0x14d83f=_0x14d83f-0x0;var _0x2a8046=_0x9204[_0x14d83f];return _0x2a8046;};'use strict';var multer=require(_0x4920('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4920('0x1'));var express=require(_0x4920('0x2'));var router=express[_0x4920('0x3')]();var fs_extra=require(_0x4920('0x4'));var auth=require(_0x4920('0x5'));var interaction=require(_0x4920('0x6'));var config=require(_0x4920('0x7'));var controller=require(_0x4920('0x8'));router[_0x4920('0x9')]('/',auth['isAuthenticated'](),controller[_0x4920('0xa')]);router[_0x4920('0x9')](_0x4920('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4920('0x9')](_0x4920('0xc'),auth[_0x4920('0xd')](),controller['getConfigurations']);router['get'](_0x4920('0xe'),auth[_0x4920('0xd')](),controller[_0x4920('0xf')]);router[_0x4920('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4920('0x10')](_0x4920('0xc'),auth[_0x4920('0xd')](),controller[_0x4920('0x11')]);router[_0x4920('0x12')]('/:id',auth[_0x4920('0xd')](),controller[_0x4920('0x13')]);router[_0x4920('0x14')](_0x4920('0xb'),auth[_0x4920('0xd')](),controller['destroy']);module[_0x4920('0x15')]=router; \ No newline at end of file +var _0x8a91=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get'];(function(_0x49490c,_0x19681f){var _0x168922=function(_0x4b7a7f){while(--_0x4b7a7f){_0x49490c['push'](_0x49490c['shift']());}};_0x168922(++_0x19681f);}(_0x8a91,0x174));var _0x18a9=function(_0x3f839f,_0x105f92){_0x3f839f=_0x3f839f-0x0;var _0x461295=_0x8a91[_0x3f839f];return _0x461295;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x18a9('0x0')]();var fs_extra=require(_0x18a9('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x18a9('0x2'));var config=require(_0x18a9('0x3'));var controller=require(_0x18a9('0x4'));router['get']('/',auth[_0x18a9('0x5')](),controller[_0x18a9('0x6')]);router[_0x18a9('0x7')](_0x18a9('0x8'),auth[_0x18a9('0x5')](),controller[_0x18a9('0x9')]);router[_0x18a9('0x7')](_0x18a9('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x18a9('0x7')](_0x18a9('0xb'),auth[_0x18a9('0x5')](),controller[_0x18a9('0xc')]);router[_0x18a9('0xd')]('/',auth[_0x18a9('0x5')](),controller[_0x18a9('0xe')]);router[_0x18a9('0xd')]('/:id/configurations',auth[_0x18a9('0x5')](),controller[_0x18a9('0xf')]);router[_0x18a9('0x10')](_0x18a9('0x8'),auth[_0x18a9('0x5')](),controller[_0x18a9('0x11')]);router[_0x18a9('0x12')]('/:id',auth[_0x18a9('0x5')](),controller['destroy']);module[_0x18a9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 8ddc36c..8e9faa4 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x7b84,0x17c));var _0x47b8=function(_0x1b0cb7,_0x572bfe){_0x1b0cb7=_0x1b0cb7-0x0;var _0x43ca23=_0x7b84[_0x1b0cb7];return _0x43ca23;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'apiKey':{'type':Sequelize[_0x47b8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x47b8('0x4')},'serverUrl':{'type':Sequelize[_0x47b8('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['STRING','username','exports'];(function(_0x1814d4,_0x34a065){var _0x1fb738=function(_0x890af4){while(--_0x890af4){_0x1814d4['push'](_0x1814d4['shift']());}};_0x1fb738(++_0x34a065);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65f6('0x1')]},'username':{'type':Sequelize[_0x65f6('0x1')],'unique':_0x65f6('0x2')},'apiKey':{'type':Sequelize[_0x65f6('0x1')]},'remoteUri':{'type':Sequelize[_0x65f6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x65f6('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 8e937e7..73bdd42 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 _0x0b96=['sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','findAll','rows','show','include','find','catch','body','params','destroy','findOne','FreshdeskConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','remoteUri','apiKey','substring','lastIndexOf','%s/%s','format','%s:X','toString','base64','agent','description','priority','source','group','company','remove','includes','default','custom_text','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5a0383,_0x312ffe){var _0x1adda7=function(_0x1a0cf5){while(--_0x1a0cf5){_0x5a0383['push'](_0x5a0383['shift']());}};_0x1adda7(++_0x312ffe);}(_0x0b96,0xa5));var _0x60b9=function(_0x56aad3,_0x3d48bc){_0x56aad3=_0x56aad3-0x0;var _0x1d165a=_0x0b96[_0x56aad3];return _0x1d165a;};'use strict';var emlformat=require(_0x60b9('0x0'));var rimraf=require(_0x60b9('0x1'));var zipdir=require(_0x60b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60b9('0x3'));var moment=require(_0x60b9('0x4'));var BPromise=require(_0x60b9('0x5'));var Mustache=require('mustache');var util=require(_0x60b9('0x6'));var path=require(_0x60b9('0x7'));var sox=require('sox');var csv=require(_0x60b9('0x8'));var ejs=require(_0x60b9('0x9'));var fs=require('fs');var fs_extra=require(_0x60b9('0xa'));var _=require(_0x60b9('0xb'));var squel=require(_0x60b9('0xc'));var crypto=require(_0x60b9('0xd'));var jsforce=require(_0x60b9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x60b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x60b9('0xf'));var authService=require(_0x60b9('0x10'));var qs=require(_0x60b9('0x11'));var as=require(_0x60b9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x60b9('0x13'))(_0x60b9('0x14'));var utils=require(_0x60b9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x60b9('0x16'));var db=require(_0x60b9('0x17'))['db'];var integrations=require(_0x60b9('0x18'));function respondWithStatusCode(_0xa4144b,_0x243e4a){_0x243e4a=_0x243e4a||0xcc;return function(_0x225df6){if(_0x225df6){return _0xa4144b[_0x60b9('0x19')](_0x243e4a);}return _0xa4144b[_0x60b9('0x1a')](_0x243e4a)[_0x60b9('0x1b')]();};}function respondWithResult(_0xd5e23a,_0x443435){_0x443435=_0x443435||0xc8;return function(_0x5e0d9b){if(_0x5e0d9b){return _0xd5e23a[_0x60b9('0x1a')](_0x443435)[_0x60b9('0x1c')](_0x5e0d9b);}};}function respondWithFilteredResult(_0x991547,_0x20834a){return function(_0x2d4995){if(_0x2d4995){var _0x5f4ec7=typeof _0x20834a[_0x60b9('0x1d')]===_0x60b9('0x1e')&&typeof _0x20834a[_0x60b9('0x1f')]===_0x60b9('0x1e');var _0x5e30f9=_0x2d4995['count'];var _0x2aa04c=_0x5f4ec7?0x0:_0x20834a[_0x60b9('0x1d')];var _0xfa8dc5=_0x5f4ec7?_0x2d4995[_0x60b9('0x20')]:_0x20834a[_0x60b9('0x1d')]+_0x20834a[_0x60b9('0x1f')];var _0x13771a;if(_0xfa8dc5>=_0x5e30f9){_0xfa8dc5=_0x5e30f9;_0x13771a=0xc8;}else{_0x13771a=0xce;}_0x991547['status'](_0x13771a);return _0x991547[_0x60b9('0x21')]('Content-Range',_0x2aa04c+'-'+_0xfa8dc5+'/'+_0x5e30f9)[_0x60b9('0x1c')](_0x2d4995);}return null;};}function patchUpdates(_0x293bb6){return function(_0xb273d4){try{jsonpatch[_0x60b9('0x22')](_0xb273d4,_0x293bb6,!![]);}catch(_0x549954){return BPromise[_0x60b9('0x23')](_0x549954);}return _0xb273d4[_0x60b9('0x24')]();};}function saveUpdates(_0x33da87,_0x54a11f){return function(_0x19fde9){if(_0x19fde9){return _0x19fde9['update'](_0x33da87)[_0x60b9('0x25')](function(_0x12a6e8){return _0x12a6e8;});}return null;};}function removeEntity(_0x237ab5,_0x285c05){return function(_0x365d11){if(_0x365d11){return _0x365d11['destroy']()[_0x60b9('0x25')](function(){_0x237ab5[_0x60b9('0x1a')](0xcc)[_0x60b9('0x1b')]();});}};}function handleEntityNotFound(_0x943f74,_0x4eb65b){return function(_0x375534){if(!_0x375534){_0x943f74['sendStatus'](0x194);}return _0x375534;};}function handleError(_0xf6fc17,_0x45ae9d){_0x45ae9d=_0x45ae9d||0x1f4;return function(_0x3aba43){logger[_0x60b9('0x26')](_0x3aba43[_0x60b9('0x27')]);if(_0x3aba43[_0x60b9('0x28')]){delete _0x3aba43[_0x60b9('0x28')];}_0xf6fc17['status'](_0x45ae9d)['send'](_0x3aba43);};}exports[_0x60b9('0x29')]=function(_0x2f9e3a,_0xcfc109){var _0xb40e96={},_0x51976d={},_0x5b07bc={'count':0x0,'rows':[]};var _0x46e8c1=_['map'](db['FreshdeskAccount'][_0x60b9('0x2a')],function(_0x3580af){return{'name':_0x3580af[_0x60b9('0x2b')],'type':_0x3580af[_0x60b9('0x2c')]['key']};});_0x51976d[_0x60b9('0x2d')]=_[_0x60b9('0x2e')](_0x46e8c1,_0x60b9('0x28'));_0x51976d[_0x60b9('0x2f')]=_[_0x60b9('0x30')](_0x2f9e3a[_0x60b9('0x2f')]);_0x51976d[_0x60b9('0x31')]=_['intersection'](_0x51976d[_0x60b9('0x2d')],_0x51976d[_0x60b9('0x2f')]);_0xb40e96[_0x60b9('0x32')]=_[_0x60b9('0x33')](_0x51976d[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x2f9e3a['query']['fields']));_0xb40e96[_0x60b9('0x32')]=_0xb40e96[_0x60b9('0x32')][_0x60b9('0x35')]?_0xb40e96[_0x60b9('0x32')]:_0x51976d[_0x60b9('0x2d')];if(!_0x2f9e3a['query'][_0x60b9('0x36')](_0x60b9('0x37'))){_0xb40e96[_0x60b9('0x1f')]=qs['limit'](_0x2f9e3a[_0x60b9('0x2f')]['limit']);_0xb40e96['offset']=qs[_0x60b9('0x1d')](_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x1d')]);}_0xb40e96[_0x60b9('0x38')]=qs['sort'](_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x39')]);_0xb40e96[_0x60b9('0x3a')]=qs[_0x60b9('0x31')](_[_0x60b9('0x3b')](_0x2f9e3a['query'],_0x51976d['filters']),_0x46e8c1);if(_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x3c')]){_0xb40e96[_0x60b9('0x3a')]=_[_0x60b9('0x3d')](_0xb40e96['where'],{'$or':_[_0x60b9('0x2e')](_0x46e8c1,function(_0x2c2b06){if(_0x2c2b06[_0x60b9('0x2c')]!==_0x60b9('0x3e')){var _0x32c79c={};_0x32c79c[_0x2c2b06['name']]={'$like':'%'+_0x2f9e3a[_0x60b9('0x2f')][_0x60b9('0x3c')]+'%'};return _0x32c79c;}})});}_0xb40e96=_[_0x60b9('0x3d')]({},_0xb40e96,_0x2f9e3a[_0x60b9('0x3f')]);var _0x20f6e7={'where':_0xb40e96[_0x60b9('0x3a')]};return db[_0x60b9('0x40')][_0x60b9('0x20')](_0x20f6e7)['then'](function(_0x46d49c){_0x5b07bc[_0x60b9('0x20')]=_0x46d49c;if(_0x2f9e3a['query'][_0x60b9('0x41')]){_0xb40e96['include']=[{'all':!![]}];}return db[_0x60b9('0x40')][_0x60b9('0x42')](_0xb40e96);})[_0x60b9('0x25')](function(_0x5d81bf){_0x5b07bc[_0x60b9('0x43')]=_0x5d81bf;return _0x5b07bc;})['then'](respondWithFilteredResult(_0xcfc109,_0xb40e96))['catch'](handleError(_0xcfc109,null));};exports[_0x60b9('0x44')]=function(_0x5ea159,_0x189a89){var _0x492205={'raw':![],'where':{'id':_0x5ea159['params']['id']}},_0xb5bf35={};_0xb5bf35['model']=_['keys'](db[_0x60b9('0x40')][_0x60b9('0x2a')]);_0xb5bf35[_0x60b9('0x2f')]=_['keys'](_0x5ea159[_0x60b9('0x2f')]);_0xb5bf35[_0x60b9('0x31')]=_['intersection'](_0xb5bf35[_0x60b9('0x2d')],_0xb5bf35[_0x60b9('0x2f')]);_0x492205['attributes']=_[_0x60b9('0x33')](_0xb5bf35[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x5ea159[_0x60b9('0x2f')]['fields']));_0x492205[_0x60b9('0x32')]=_0x492205['attributes'][_0x60b9('0x35')]?_0x492205[_0x60b9('0x32')]:_0xb5bf35[_0x60b9('0x2d')];if(_0x5ea159[_0x60b9('0x2f')]['includeAll']){_0x492205[_0x60b9('0x45')]=[{'all':!![]}];}_0x492205=_['merge']({},_0x492205,_0x5ea159[_0x60b9('0x3f')]);return db['FreshdeskAccount'][_0x60b9('0x46')](_0x492205)[_0x60b9('0x25')](handleEntityNotFound(_0x189a89,null))[_0x60b9('0x25')](respondWithResult(_0x189a89,null))[_0x60b9('0x47')](handleError(_0x189a89,null));};exports['create']=function(_0x4f2684,_0x1fa48e){return db[_0x60b9('0x40')]['create'](_0x4f2684['body'],{})[_0x60b9('0x25')](respondWithResult(_0x1fa48e,0xc9))[_0x60b9('0x47')](handleError(_0x1fa48e,null));};exports['update']=function(_0x56ee08,_0x234dca){if(_0x56ee08[_0x60b9('0x48')]['id']){delete _0x56ee08[_0x60b9('0x48')]['id'];}return db[_0x60b9('0x40')]['find']({'where':{'id':_0x56ee08[_0x60b9('0x49')]['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x234dca,null))[_0x60b9('0x25')](saveUpdates(_0x56ee08[_0x60b9('0x48')],null))[_0x60b9('0x25')](respondWithResult(_0x234dca,null))['catch'](handleError(_0x234dca,null));};exports[_0x60b9('0x4a')]=function(_0x42056c,_0x31702a){return db['FreshdeskAccount'][_0x60b9('0x46')]({'where':{'id':_0x42056c[_0x60b9('0x49')]['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x31702a,null))['then'](removeEntity(_0x31702a,null))['catch'](handleError(_0x31702a,null));};exports['getConfigurations']=function(_0x28cff0,_0xf5c9c6,_0x11d184){var _0x3eca10={};var _0x27b19d={};var _0x119654;var _0x22252a;return db['FreshdeskAccount'][_0x60b9('0x4b')]({'where':{'id':_0x28cff0[_0x60b9('0x49')]['id']}})['then'](handleEntityNotFound(_0xf5c9c6,null))[_0x60b9('0x25')](function(_0x1fc6dd){if(_0x1fc6dd){_0x119654=_0x1fc6dd;_0x27b19d[_0x60b9('0x2d')]=_[_0x60b9('0x30')](db[_0x60b9('0x4c')][_0x60b9('0x2a')]);_0x27b19d[_0x60b9('0x2f')]=_['keys'](_0x28cff0[_0x60b9('0x2f')]);_0x27b19d['filters']=_[_0x60b9('0x33')](_0x27b19d[_0x60b9('0x2d')],_0x27b19d[_0x60b9('0x2f')]);_0x3eca10[_0x60b9('0x32')]=_['intersection'](_0x27b19d[_0x60b9('0x2d')],qs[_0x60b9('0x34')](_0x28cff0['query'][_0x60b9('0x34')]));_0x3eca10[_0x60b9('0x32')]=_0x3eca10[_0x60b9('0x32')][_0x60b9('0x35')]?_0x3eca10[_0x60b9('0x32')]:_0x27b19d[_0x60b9('0x2d')];_0x3eca10[_0x60b9('0x38')]=qs[_0x60b9('0x39')](_0x28cff0['query'][_0x60b9('0x39')]);_0x3eca10[_0x60b9('0x3a')]=qs[_0x60b9('0x31')](_['pick'](_0x28cff0[_0x60b9('0x2f')],_0x27b19d['filters']));if(_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x3c')]){_0x3eca10[_0x60b9('0x3a')]=_[_0x60b9('0x3d')](_0x3eca10[_0x60b9('0x3a')],{'$or':_[_0x60b9('0x2e')](_0x3eca10[_0x60b9('0x32')],function(_0x594e2f){var _0x1094ad={};_0x1094ad[_0x594e2f]={'$like':'%'+_0x28cff0[_0x60b9('0x2f')]['filter']+'%'};return _0x1094ad;})});}_0x3eca10=_[_0x60b9('0x3d')]({},_0x3eca10,_0x28cff0['options']);return _0x119654[_0x60b9('0x4d')](_0x3eca10);}})[_0x60b9('0x25')](function(_0x237a3f){if(_0x237a3f){_0x22252a=_0x237a3f[_0x60b9('0x35')];if(!_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x36')](_0x60b9('0x37'))){_0x3eca10[_0x60b9('0x1f')]=qs[_0x60b9('0x1f')](_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x1f')]);_0x3eca10['offset']=qs['offset'](_0x28cff0[_0x60b9('0x2f')][_0x60b9('0x1d')]);}return _0x119654[_0x60b9('0x4d')](_0x3eca10);}})[_0x60b9('0x25')](function(_0x2985c9){if(_0x2985c9){return _0x2985c9?{'count':_0x22252a,'rows':_0x2985c9}:null;}})['then'](respondWithResult(_0xf5c9c6,null))[_0x60b9('0x47')](handleError(_0xf5c9c6,null));};exports['addConfiguration']=function(_0xe1bdcc,_0x29f9b5,_0x5f0f63){if(_0xe1bdcc['body']['id']){delete _0xe1bdcc[_0x60b9('0x48')]['id'];}return db[_0x60b9('0x40')][_0x60b9('0x4b')]({'where':{'id':_0xe1bdcc['params']['id']}})[_0x60b9('0x25')](handleEntityNotFound(_0x29f9b5,null))[_0x60b9('0x25')](function(_0x54358a){if(_0x54358a){_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x4e')]=_0x54358a['id'];_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x4f')]=integrations[_0x60b9('0x50')](_0xe1bdcc[_0x60b9('0x48')][_0x60b9('0x51')],_0xe1bdcc['body'][_0x60b9('0x2c')]);_0xe1bdcc[_0x60b9('0x48')]['Descriptions']=integrations['getDescriptions'](_0xe1bdcc[_0x60b9('0x48')]['channel'],_0xe1bdcc[_0x60b9('0x48')]['type']);return db[_0x60b9('0x4c')]['create'](_0xe1bdcc['body'],{'include':[{'model':db[_0x60b9('0x52')],'as':_0x60b9('0x4f')},{'model':db[_0x60b9('0x52')],'as':_0x60b9('0x53')}]});}return null;})[_0x60b9('0x25')](respondWithResult(_0x29f9b5,null))[_0x60b9('0x47')](handleError(_0x29f9b5,null));};exports['getFields']=function(_0x22199b,_0x4662f2,_0x20703e){var _0x7169ae='';return db[_0x60b9('0x40')][_0x60b9('0x4b')]({'where':{'id':_0x22199b[_0x60b9('0x49')]['id']},'attributes':['id',_0x60b9('0x54'),_0x60b9('0x55')]})['then'](handleEntityNotFound(_0x4662f2,null))[_0x60b9('0x25')](function(_0x4394ef){if(_0x4394ef){_0x7169ae=_0x4394ef[_0x60b9('0x54')];var _0x58a898=_0x7169ae['slice'](-0x1);if(_0x58a898==='/'){_0x7169ae=_0x7169ae[_0x60b9('0x56')](0x0,_0x7169ae[_0x60b9('0x57')](_0x58a898));}return rp({'method':'GET','uri':util['format'](_0x60b9('0x58'),_0x7169ae,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x60b9('0x59')]('Basic\x20%s',new Buffer(util[_0x60b9('0x59')](_0x60b9('0x5a'),_0x4394ef[_0x60b9('0x55')]))[_0x60b9('0x5b')](_0x60b9('0x5c')))},'json':!![]});}})[_0x60b9('0x25')](function(_0x126660){if(_0x126660){var _0x6b6fc4=['requester','subject',_0x60b9('0x5d'),_0x60b9('0x5e'),'status',_0x60b9('0x5f'),'group',_0x60b9('0x60'),'ticket_type',_0x60b9('0x61'),_0x60b9('0x62')];_[_0x60b9('0x63')](_0x126660,function(_0x411330){return _0x6b6fc4[_0x60b9('0x64')](_0x411330[_0x60b9('0x28')])||!_0x411330[_0x60b9('0x65')]&&_0x411330[_0x60b9('0x2c')]!==_0x60b9('0x66')&&_0x411330[_0x60b9('0x2c')]!=='custom_dropdown';});return{'count':_0x126660[_0x60b9('0x35')],'rows':_[_0x60b9('0x2e')](_0x126660,function(_0x1a633d){return{'id':_0x1a633d['name'],'name':_0x1a633d[_0x60b9('0x67')],'custom':!_0x1a633d[_0x60b9('0x65')],'options':_0x1a633d['choices']?_[_0x60b9('0x2e')](_0x1a633d[_0x60b9('0x68')],function(_0x54e9f8){return{'name':_['capitalize'](_0x54e9f8),'value':_0x54e9f8};}):[]};})};}})[_0x60b9('0x25')](respondWithResult(_0x4662f2,null))[_0x60b9('0x47')](function(_0x22fba9){var _0x45ebe5=_0x22199b[_0x60b9('0x2f')][_0x60b9('0x69')]?0x1f4:_0x22fba9['statusCode']||0x1f4;logger[_0x60b9('0x26')](_0x60b9('0x6a'),_0x60b9('0x6b'),_0x45ebe5,JSON[_0x60b9('0x6c')](_0x22fba9));delete _0x22fba9[_0x60b9('0x28')];if(_0x45ebe5===0x191){_0x45ebe5=0x190;}_0x4662f2[_0x60b9('0x1a')](_0x45ebe5)[_0x60b9('0x6d')](_0x22199b[_0x60b9('0x2f')][_0x60b9('0x69')]?{'message':_0x60b9('0x6e'),'statusCode':_0x22fba9['statusCode']}:_0x22fba9);});}; \ No newline at end of file +var _0x60d7=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','FreshdeskAccount','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','toString','requester','agent','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','statusCode','error','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x52e150,_0x3d8c12){var _0x2948a0=function(_0x5b3123){while(--_0x5b3123){_0x52e150['push'](_0x52e150['shift']());}};_0x2948a0(++_0x3d8c12);}(_0x60d7,0x139));var _0x760d=function(_0x167bd3,_0x5de8da){_0x167bd3=_0x167bd3-0x0;var _0x3077be=_0x60d7[_0x167bd3];return _0x3077be;};'use strict';var emlformat=require(_0x760d('0x0'));var rimraf=require(_0x760d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x760d('0x2'));var rp=require('request-promise');var moment=require(_0x760d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x760d('0x4'));var util=require(_0x760d('0x5'));var path=require(_0x760d('0x6'));var sox=require(_0x760d('0x7'));var csv=require('to-csv');var ejs=require(_0x760d('0x8'));var fs=require('fs');var fs_extra=require(_0x760d('0x9'));var _=require(_0x760d('0xa'));var squel=require(_0x760d('0xb'));var crypto=require(_0x760d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x760d('0xd'));var toCsv=require(_0x760d('0xe'));var querystring=require(_0x760d('0xf'));var Papa=require('papaparse');var Redis=require(_0x760d('0x10'));var authService=require(_0x760d('0x11'));var qs=require(_0x760d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x760d('0x13'));var logger=require(_0x760d('0x14'))('api');var utils=require(_0x760d('0x15'));var config=require(_0x760d('0x16'));var licenseUtil=require(_0x760d('0x17'));var db=require(_0x760d('0x18'))['db'];var integrations=require(_0x760d('0x19'));function respondWithStatusCode(_0x40b3ee,_0xffb1f9){_0xffb1f9=_0xffb1f9||0xcc;return function(_0x368669){if(_0x368669){return _0x40b3ee[_0x760d('0x1a')](_0xffb1f9);}return _0x40b3ee[_0x760d('0x1b')](_0xffb1f9)[_0x760d('0x1c')]();};}function respondWithResult(_0x543d6e,_0x1fed3a){_0x1fed3a=_0x1fed3a||0xc8;return function(_0x584a11){if(_0x584a11){return _0x543d6e[_0x760d('0x1b')](_0x1fed3a)[_0x760d('0x1d')](_0x584a11);}};}function respondWithFilteredResult(_0x13118d,_0x86e62a){return function(_0x49c0d4){if(_0x49c0d4){var _0x5190e5=typeof _0x86e62a[_0x760d('0x1e')]===_0x760d('0x1f')&&typeof _0x86e62a[_0x760d('0x20')]===_0x760d('0x1f');var _0xcdbb6=_0x49c0d4[_0x760d('0x21')];var _0x5b313e=_0x5190e5?0x0:_0x86e62a['offset'];var _0x2c3073=_0x5190e5?_0x49c0d4[_0x760d('0x21')]:_0x86e62a[_0x760d('0x1e')]+_0x86e62a[_0x760d('0x20')];var _0x377473;if(_0x2c3073>=_0xcdbb6){_0x2c3073=_0xcdbb6;_0x377473=0xc8;}else{_0x377473=0xce;}_0x13118d[_0x760d('0x1b')](_0x377473);return _0x13118d[_0x760d('0x22')](_0x760d('0x23'),_0x5b313e+'-'+_0x2c3073+'/'+_0xcdbb6)[_0x760d('0x1d')](_0x49c0d4);}return null;};}function patchUpdates(_0x2f74b5){return function(_0x4c508b){try{jsonpatch[_0x760d('0x24')](_0x4c508b,_0x2f74b5,!![]);}catch(_0x3472d8){return BPromise[_0x760d('0x25')](_0x3472d8);}return _0x4c508b[_0x760d('0x26')]();};}function saveUpdates(_0x234934,_0x57dcea){return function(_0x301f68){if(_0x301f68){return _0x301f68[_0x760d('0x27')](_0x234934)[_0x760d('0x28')](function(_0x516133){return _0x516133;});}return null;};}function removeEntity(_0x55b45a,_0x44b653){return function(_0xc7c92d){if(_0xc7c92d){return _0xc7c92d[_0x760d('0x29')]()[_0x760d('0x28')](function(){_0x55b45a[_0x760d('0x1b')](0xcc)[_0x760d('0x1c')]();});}};}function handleEntityNotFound(_0xd9b9cb,_0x36e432){return function(_0x5d2083){if(!_0x5d2083){_0xd9b9cb[_0x760d('0x1a')](0x194);}return _0x5d2083;};}function handleError(_0x374e92,_0x441b1e){_0x441b1e=_0x441b1e||0x1f4;return function(_0x414aad){logger['error'](_0x414aad[_0x760d('0x2a')]);if(_0x414aad['name']){delete _0x414aad['name'];}_0x374e92[_0x760d('0x1b')](_0x441b1e)[_0x760d('0x2b')](_0x414aad);};}exports[_0x760d('0x2c')]=function(_0x2ecdd8,_0x14927){var _0x163685={},_0x40f761={},_0x1aa9d6={'count':0x0,'rows':[]};var _0x5c20be=_[_0x760d('0x2d')](db[_0x760d('0x2e')][_0x760d('0x2f')],function(_0x149732){return{'name':_0x149732['fieldName'],'type':_0x149732['type'][_0x760d('0x30')]};});_0x40f761[_0x760d('0x31')]=_[_0x760d('0x2d')](_0x5c20be,_0x760d('0x32'));_0x40f761[_0x760d('0x33')]=_[_0x760d('0x34')](_0x2ecdd8[_0x760d('0x33')]);_0x40f761[_0x760d('0x35')]=_[_0x760d('0x36')](_0x40f761[_0x760d('0x31')],_0x40f761[_0x760d('0x33')]);_0x163685[_0x760d('0x37')]=_[_0x760d('0x36')](_0x40f761['model'],qs[_0x760d('0x38')](_0x2ecdd8[_0x760d('0x33')]['fields']));_0x163685['attributes']=_0x163685[_0x760d('0x37')][_0x760d('0x39')]?_0x163685['attributes']:_0x40f761[_0x760d('0x31')];if(!_0x2ecdd8['query']['hasOwnProperty'](_0x760d('0x3a'))){_0x163685[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x2ecdd8[_0x760d('0x33')][_0x760d('0x20')]);_0x163685['offset']=qs['offset'](_0x2ecdd8['query']['offset']);}_0x163685[_0x760d('0x3b')]=qs[_0x760d('0x3c')](_0x2ecdd8[_0x760d('0x33')][_0x760d('0x3c')]);_0x163685[_0x760d('0x3d')]=qs[_0x760d('0x35')](_['pick'](_0x2ecdd8[_0x760d('0x33')],_0x40f761[_0x760d('0x35')]),_0x5c20be);if(_0x2ecdd8[_0x760d('0x33')][_0x760d('0x3e')]){_0x163685[_0x760d('0x3d')]=_[_0x760d('0x3f')](_0x163685[_0x760d('0x3d')],{'$or':_[_0x760d('0x2d')](_0x5c20be,function(_0x52125f){if(_0x52125f[_0x760d('0x40')]!=='VIRTUAL'){var _0x576a0b={};_0x576a0b[_0x52125f[_0x760d('0x32')]]={'$like':'%'+_0x2ecdd8['query'][_0x760d('0x3e')]+'%'};return _0x576a0b;}})});}_0x163685=_['merge']({},_0x163685,_0x2ecdd8['options']);var _0x590d47={'where':_0x163685['where']};return db['FreshdeskAccount'][_0x760d('0x21')](_0x590d47)[_0x760d('0x28')](function(_0x34fb78){_0x1aa9d6['count']=_0x34fb78;if(_0x2ecdd8['query']['includeAll']){_0x163685[_0x760d('0x41')]=[{'all':!![]}];}return db[_0x760d('0x2e')][_0x760d('0x42')](_0x163685);})[_0x760d('0x28')](function(_0x27f9b2){_0x1aa9d6[_0x760d('0x43')]=_0x27f9b2;return _0x1aa9d6;})[_0x760d('0x28')](respondWithFilteredResult(_0x14927,_0x163685))[_0x760d('0x44')](handleError(_0x14927,null));};exports[_0x760d('0x45')]=function(_0x54c7c6,_0x480ff5){var _0x3dbc36={'raw':![],'where':{'id':_0x54c7c6[_0x760d('0x46')]['id']}},_0x4c5c03={};_0x4c5c03[_0x760d('0x31')]=_[_0x760d('0x34')](db[_0x760d('0x2e')][_0x760d('0x2f')]);_0x4c5c03[_0x760d('0x33')]=_[_0x760d('0x34')](_0x54c7c6[_0x760d('0x33')]);_0x4c5c03[_0x760d('0x35')]=_[_0x760d('0x36')](_0x4c5c03[_0x760d('0x31')],_0x4c5c03[_0x760d('0x33')]);_0x3dbc36[_0x760d('0x37')]=_[_0x760d('0x36')](_0x4c5c03[_0x760d('0x31')],qs[_0x760d('0x38')](_0x54c7c6[_0x760d('0x33')]['fields']));_0x3dbc36['attributes']=_0x3dbc36['attributes']['length']?_0x3dbc36[_0x760d('0x37')]:_0x4c5c03[_0x760d('0x31')];if(_0x54c7c6[_0x760d('0x33')]['includeAll']){_0x3dbc36[_0x760d('0x41')]=[{'all':!![]}];}_0x3dbc36=_[_0x760d('0x3f')]({},_0x3dbc36,_0x54c7c6[_0x760d('0x47')]);return db[_0x760d('0x2e')][_0x760d('0x48')](_0x3dbc36)[_0x760d('0x28')](handleEntityNotFound(_0x480ff5,null))['then'](respondWithResult(_0x480ff5,null))[_0x760d('0x44')](handleError(_0x480ff5,null));};exports[_0x760d('0x49')]=function(_0x272de5,_0x35e4af){return db[_0x760d('0x2e')][_0x760d('0x49')](_0x272de5[_0x760d('0x4a')],{})[_0x760d('0x28')](respondWithResult(_0x35e4af,0xc9))[_0x760d('0x44')](handleError(_0x35e4af,null));};exports[_0x760d('0x27')]=function(_0x5b7555,_0x5cfea5){if(_0x5b7555[_0x760d('0x4a')]['id']){delete _0x5b7555[_0x760d('0x4a')]['id'];}return db['FreshdeskAccount'][_0x760d('0x48')]({'where':{'id':_0x5b7555['params']['id']}})[_0x760d('0x28')](handleEntityNotFound(_0x5cfea5,null))['then'](saveUpdates(_0x5b7555['body'],null))[_0x760d('0x28')](respondWithResult(_0x5cfea5,null))[_0x760d('0x44')](handleError(_0x5cfea5,null));};exports[_0x760d('0x29')]=function(_0x14acc4,_0x5d6426){return db[_0x760d('0x2e')][_0x760d('0x48')]({'where':{'id':_0x14acc4['params']['id']}})[_0x760d('0x28')](handleEntityNotFound(_0x5d6426,null))['then'](removeEntity(_0x5d6426,null))[_0x760d('0x44')](handleError(_0x5d6426,null));};exports[_0x760d('0x4b')]=function(_0xb06763,_0x5597c0,_0x1395ef){var _0x2da6f1={};var _0x3a7311={};var _0x468954;var _0x102e7d;return db[_0x760d('0x2e')][_0x760d('0x4c')]({'where':{'id':_0xb06763['params']['id']}})[_0x760d('0x28')](handleEntityNotFound(_0x5597c0,null))[_0x760d('0x28')](function(_0x6dbc5b){if(_0x6dbc5b){_0x468954=_0x6dbc5b;_0x3a7311[_0x760d('0x31')]=_[_0x760d('0x34')](db[_0x760d('0x4d')]['rawAttributes']);_0x3a7311['query']=_[_0x760d('0x34')](_0xb06763[_0x760d('0x33')]);_0x3a7311['filters']=_[_0x760d('0x36')](_0x3a7311[_0x760d('0x31')],_0x3a7311['query']);_0x2da6f1[_0x760d('0x37')]=_['intersection'](_0x3a7311[_0x760d('0x31')],qs[_0x760d('0x38')](_0xb06763[_0x760d('0x33')][_0x760d('0x38')]));_0x2da6f1[_0x760d('0x37')]=_0x2da6f1['attributes'][_0x760d('0x39')]?_0x2da6f1[_0x760d('0x37')]:_0x3a7311[_0x760d('0x31')];_0x2da6f1[_0x760d('0x3b')]=qs[_0x760d('0x3c')](_0xb06763[_0x760d('0x33')][_0x760d('0x3c')]);_0x2da6f1[_0x760d('0x3d')]=qs[_0x760d('0x35')](_[_0x760d('0x4e')](_0xb06763[_0x760d('0x33')],_0x3a7311[_0x760d('0x35')]));if(_0xb06763['query']['filter']){_0x2da6f1[_0x760d('0x3d')]=_[_0x760d('0x3f')](_0x2da6f1[_0x760d('0x3d')],{'$or':_[_0x760d('0x2d')](_0x2da6f1[_0x760d('0x37')],function(_0x3eb08d){var _0x1b180a={};_0x1b180a[_0x3eb08d]={'$like':'%'+_0xb06763[_0x760d('0x33')][_0x760d('0x3e')]+'%'};return _0x1b180a;})});}_0x2da6f1=_[_0x760d('0x3f')]({},_0x2da6f1,_0xb06763[_0x760d('0x47')]);return _0x468954[_0x760d('0x4b')](_0x2da6f1);}})[_0x760d('0x28')](function(_0x4084a8){if(_0x4084a8){_0x102e7d=_0x4084a8[_0x760d('0x39')];if(!_0xb06763[_0x760d('0x33')]['hasOwnProperty'](_0x760d('0x3a'))){_0x2da6f1[_0x760d('0x20')]=qs[_0x760d('0x20')](_0xb06763[_0x760d('0x33')][_0x760d('0x20')]);_0x2da6f1['offset']=qs[_0x760d('0x1e')](_0xb06763['query'][_0x760d('0x1e')]);}return _0x468954[_0x760d('0x4b')](_0x2da6f1);}})[_0x760d('0x28')](function(_0x1fddbe){if(_0x1fddbe){return _0x1fddbe?{'count':_0x102e7d,'rows':_0x1fddbe}:null;}})['then'](respondWithResult(_0x5597c0,null))[_0x760d('0x44')](handleError(_0x5597c0,null));};exports[_0x760d('0x4f')]=function(_0x4fbba3,_0x2aad61,_0x2e8512){if(_0x4fbba3[_0x760d('0x4a')]['id']){delete _0x4fbba3[_0x760d('0x4a')]['id'];}return db[_0x760d('0x2e')][_0x760d('0x4c')]({'where':{'id':_0x4fbba3[_0x760d('0x46')]['id']}})['then'](handleEntityNotFound(_0x2aad61,null))[_0x760d('0x28')](function(_0x509100){if(_0x509100){_0x4fbba3[_0x760d('0x4a')][_0x760d('0x50')]=_0x509100['id'];_0x4fbba3[_0x760d('0x4a')]['Subjects']=integrations[_0x760d('0x51')](_0x4fbba3['body'][_0x760d('0x52')],_0x4fbba3[_0x760d('0x4a')][_0x760d('0x40')]);_0x4fbba3[_0x760d('0x4a')][_0x760d('0x53')]=integrations['getDescriptions'](_0x4fbba3[_0x760d('0x4a')][_0x760d('0x52')],_0x4fbba3[_0x760d('0x4a')]['type']);return db[_0x760d('0x4d')][_0x760d('0x49')](_0x4fbba3[_0x760d('0x4a')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x760d('0x53')}]});}return null;})[_0x760d('0x28')](respondWithResult(_0x2aad61,null))['catch'](handleError(_0x2aad61,null));};exports['getFields']=function(_0x2ccd9b,_0x3008b0,_0x2e541b){var _0xe86d77='';return db[_0x760d('0x2e')][_0x760d('0x4c')]({'where':{'id':_0x2ccd9b[_0x760d('0x46')]['id']},'attributes':['id',_0x760d('0x54'),_0x760d('0x55')]})[_0x760d('0x28')](handleEntityNotFound(_0x3008b0,null))['then'](function(_0x3dd001){if(_0x3dd001){_0xe86d77=_0x3dd001[_0x760d('0x54')];var _0x583720=_0xe86d77['slice'](-0x1);if(_0x583720==='/'){_0xe86d77=_0xe86d77[_0x760d('0x56')](0x0,_0xe86d77[_0x760d('0x57')](_0x583720));}return rp({'method':'GET','uri':util[_0x760d('0x58')](_0x760d('0x59'),_0xe86d77,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x760d('0x58')]('Basic\x20%s',new Buffer(util[_0x760d('0x58')]('%s:X',_0x3dd001[_0x760d('0x55')]))[_0x760d('0x5a')]('base64'))},'json':!![]});}})['then'](function(_0x36ffb8){if(_0x36ffb8){var _0x25c605=[_0x760d('0x5b'),'subject',_0x760d('0x5c'),'description','status',_0x760d('0x5d'),_0x760d('0x5e'),_0x760d('0x5f'),'ticket_type','group',_0x760d('0x60')];_[_0x760d('0x61')](_0x36ffb8,function(_0x7f918c){return _0x25c605[_0x760d('0x62')](_0x7f918c[_0x760d('0x32')])||!_0x7f918c[_0x760d('0x63')]&&_0x7f918c['type']!==_0x760d('0x64')&&_0x7f918c[_0x760d('0x40')]!==_0x760d('0x65');});return{'count':_0x36ffb8[_0x760d('0x39')],'rows':_['map'](_0x36ffb8,function(_0x3eccb9){return{'id':_0x3eccb9[_0x760d('0x32')],'name':_0x3eccb9['label'],'custom':!_0x3eccb9[_0x760d('0x63')],'options':_0x3eccb9['choices']?_[_0x760d('0x2d')](_0x3eccb9[_0x760d('0x66')],function(_0x2c08ad){return{'name':_[_0x760d('0x67')](_0x2c08ad),'value':_0x2c08ad};}):[]};})};}})[_0x760d('0x28')](respondWithResult(_0x3008b0,null))['catch'](function(_0x533735){var _0x38660f=_0x2ccd9b[_0x760d('0x33')]['test']?0x1f4:_0x533735[_0x760d('0x68')]||0x1f4;logger[_0x760d('0x69')]('getFields,\x20%s,\x20%s,\x20%s',_0x760d('0x6a'),_0x38660f,JSON[_0x760d('0x6b')](_0x533735));delete _0x533735['name'];if(_0x38660f===0x191){_0x38660f=0x190;}_0x3008b0['status'](_0x38660f)[_0x760d('0x2b')](_0x2ccd9b[_0x760d('0x33')]['test']?{'message':_0x760d('0x6c'),'statusCode':_0x533735[_0x760d('0x68')]}:_0x533735);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c382afe..44c1222 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 _0xfe69=['api','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x2d090b,_0x1aa363){var _0x537445=function(_0x35a8e3){while(--_0x35a8e3){_0x2d090b['push'](_0x2d090b['shift']());}};_0x537445(++_0x1aa363);}(_0xfe69,0xeb));var _0x9fe6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfe69[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x9fe6('0x0'));var util=require(_0x9fe6('0x1'));var logger=require(_0x9fe6('0x2'))(_0x9fe6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9fe6('0x4'));var fs=require('fs');var path=require(_0x9fe6('0x5'));var rimraf=require(_0x9fe6('0x6'));var config=require(_0x9fe6('0x7'));var attributes=require(_0x9fe6('0x8'));var integrations=require(_0x9fe6('0x9'));module[_0x9fe6('0xa')]=function(_0x595038,_0x5af3f3){return _0x595038[_0x9fe6('0xb')](_0x9fe6('0xc'),attributes,{'tableName':_0x9fe6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5041=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x42c9ad,_0x45f7fd){var _0x1b8897=function(_0x1c6d1c){while(--_0x1c6d1c){_0x42c9ad['push'](_0x42c9ad['shift']());}};_0x1b8897(++_0x45f7fd);}(_0x5041,0x1da));var _0x1504=function(_0x3975ac,_0x4d5e8a){_0x3975ac=_0x3975ac-0x0;var _0x2c06d5=_0x5041[_0x3975ac];return _0x2c06d5;};'use strict';var _=require(_0x1504('0x0'));var util=require(_0x1504('0x1'));var logger=require(_0x1504('0x2'))(_0x1504('0x3'));var moment=require(_0x1504('0x4'));var BPromise=require(_0x1504('0x5'));var rp=require(_0x1504('0x6'));var fs=require('fs');var path=require(_0x1504('0x7'));var rimraf=require(_0x1504('0x8'));var config=require(_0x1504('0x9'));var attributes=require(_0x1504('0xa'));var integrations=require(_0x1504('0xb'));module[_0x1504('0xc')]=function(_0x236bff,_0x489fca){return _0x236bff[_0x1504('0xd')](_0x1504('0xe'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 8f4f4ca..093377d 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 _0xb45f=['http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','raw','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','debug','ShowFreshdeskAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0xb45f,0x1b0));var _0xfb45=function(_0x43c929,_0x15d338){_0x43c929=_0x43c929-0x0;var _0x1b38fd=_0xb45f[_0x43c929];return _0x1b38fd;};'use strict';var _=require(_0xfb45('0x0'));var util=require(_0xfb45('0x1'));var moment=require(_0xfb45('0x2'));var BPromise=require(_0xfb45('0x3'));var rs=require(_0xfb45('0x4'));var fs=require('fs');var Redis=require(_0xfb45('0x5'));var db=require(_0xfb45('0x6'))['db'];var utils=require(_0xfb45('0x7'));var logger=require(_0xfb45('0x8'))(_0xfb45('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb45('0xa'));var client=jayson[_0xfb45('0xb')][_0xfb45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c2ba6,_0x324414,_0x57a0e9){return new BPromise(function(_0x39f649,_0x138a3e){return client[_0xfb45('0xd')](_0x3c2ba6,_0x57a0e9)['then'](function(_0x4aec60){logger[_0xfb45('0xe')](_0xfb45('0xf'),_0x324414,_0xfb45('0x10'));logger['debug'](_0xfb45('0x11'),_0x324414,'request\x20sent',JSON[_0xfb45('0x12')](_0x4aec60));if(_0x4aec60['error']){if(_0x4aec60[_0xfb45('0x13')][_0xfb45('0x14')]===0x1f4){logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x4aec60['error'][_0xfb45('0x15')]);return _0x138a3e(_0x4aec60[_0xfb45('0x13')]['message']);}logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x4aec60[_0xfb45('0x13')][_0xfb45('0x15')]);return _0x39f649(_0x4aec60[_0xfb45('0x13')]['message']);}else{logger[_0xfb45('0xe')](_0xfb45('0xf'),_0x324414,'request\x20sent');_0x39f649(_0x4aec60[_0xfb45('0x16')]['message']);}})[_0xfb45('0x17')](function(_0x22192e){logger[_0xfb45('0x13')](_0xfb45('0xf'),_0x324414,_0x22192e);_0x138a3e(_0x22192e);});});}exports['GetFreshdeskAccount']=function(_0x2d4874){var _0x3ef6e9=this;return new Promise(function(_0x25b4b0,_0x2536e8){return db['FreshdeskAccount']['findAll']({'raw':_0x2d4874['options']?_0x2d4874['options'][_0xfb45('0x18')]===undefined?!![]:![]:!![],'where':_0x2d4874[_0xfb45('0x19')]?_0x2d4874['options'][_0xfb45('0x1a')]||null:null,'attributes':_0x2d4874[_0xfb45('0x19')]?_0x2d4874['options'][_0xfb45('0x1b')]||null:null,'limit':_0x2d4874[_0xfb45('0x19')]?_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1c')]||null:null,'include':_0x2d4874[_0xfb45('0x19')]?_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1d')]?_['map'](_0x2d4874[_0xfb45('0x19')][_0xfb45('0x1d')],function(_0x49296d){return{'model':db[_0x49296d['model']],'as':_0x49296d['as'],'attributes':_0x49296d[_0xfb45('0x1b')],'include':_0x49296d[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x49296d[_0xfb45('0x1d')],function(_0x1d0c08){return{'model':db[_0x1d0c08[_0xfb45('0x1f')]],'as':_0x1d0c08['as'],'attributes':_0x1d0c08['attributes'],'include':_0x1d0c08[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x1d0c08[_0xfb45('0x1d')],function(_0x5ac672){return{'model':db[_0x5ac672[_0xfb45('0x1f')]],'as':_0x5ac672['as'],'attributes':_0x5ac672['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e248){logger['info'](_0xfb45('0x20'),_0x2d4874);logger[_0xfb45('0x21')](_0xfb45('0x20'),_0x2d4874,JSON[_0xfb45('0x12')](_0x21e248));_0x25b4b0(_0x21e248);})['catch'](function(_0x58e97b){logger['error']('GetFreshdeskAccount',_0x58e97b[_0xfb45('0x15')],_0x2d4874);_0x2536e8(_0x3ef6e9[_0xfb45('0x13')](0x1f4,_0x58e97b[_0xfb45('0x15')]));});});};exports[_0xfb45('0x22')]=function(_0x1a3d88){var _0x1895db=this;return new Promise(function(_0x28a287,_0x45d078){return db['FreshdeskAccount'][_0xfb45('0x23')]({'raw':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x1a')]||null:null,'attributes':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88['options']['attributes']||null:null,'include':_0x1a3d88[_0xfb45('0x19')]?_0x1a3d88['options'][_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x1a3d88[_0xfb45('0x19')][_0xfb45('0x1d')],function(_0x4b368c){return{'model':db[_0x4b368c['model']],'as':_0x4b368c['as'],'attributes':_0x4b368c[_0xfb45('0x1b')],'include':_0x4b368c[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x4b368c[_0xfb45('0x1d')],function(_0x2726aa){return{'model':db[_0x2726aa['model']],'as':_0x2726aa['as'],'attributes':_0x2726aa[_0xfb45('0x1b')],'include':_0x2726aa[_0xfb45('0x1d')]?_[_0xfb45('0x1e')](_0x2726aa[_0xfb45('0x1d')],function(_0x3f1304){return{'model':db[_0x3f1304[_0xfb45('0x1f')]],'as':_0x3f1304['as'],'attributes':_0x3f1304[_0xfb45('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb45('0x24')](function(_0x5c1774){logger[_0xfb45('0xe')](_0xfb45('0x22'),_0x1a3d88);logger['debug'](_0xfb45('0x22'),_0x1a3d88,JSON[_0xfb45('0x12')](_0x5c1774));_0x28a287(_0x5c1774);})[_0xfb45('0x17')](function(_0x40c21a){logger[_0xfb45('0x13')]('ShowFreshdeskAccount',_0x40c21a[_0xfb45('0x15')],_0x1a3d88);_0x45d078(_0x1895db['error'](0x1f4,_0x40c21a[_0xfb45('0x15')]));});});}; \ No newline at end of file +var _0x7266=['moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','limit','include','model','attributes','catch','ShowFreshdeskAccount','find','map','lodash','util'];(function(_0x2f0bd6,_0x2f6968){var _0x192d53=function(_0x391577){while(--_0x391577){_0x2f0bd6['push'](_0x2f0bd6['shift']());}};_0x192d53(++_0x2f6968);}(_0x7266,0xec));var _0x6726=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7266[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var moment=require(_0x6726('0x2'));var BPromise=require(_0x6726('0x3'));var rs=require(_0x6726('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6726('0x5'));var logger=require(_0x6726('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6726('0x7'));var client=jayson[_0x6726('0x8')][_0x6726('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x180502,_0x217972,_0x3c8020){return new BPromise(function(_0x126ba7,_0x3d9f0f){return client[_0x6726('0xa')](_0x180502,_0x3c8020)[_0x6726('0xb')](function(_0x9f993){logger[_0x6726('0xc')](_0x6726('0xd'),_0x217972,'request\x20sent');logger[_0x6726('0xe')](_0x6726('0xf'),_0x217972,_0x6726('0x10'),JSON[_0x6726('0x11')](_0x9f993));if(_0x9f993['error']){if(_0x9f993[_0x6726('0x12')]['code']===0x1f4){logger[_0x6726('0x12')](_0x6726('0xd'),_0x217972,_0x9f993['error'][_0x6726('0x13')]);return _0x3d9f0f(_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);}logger[_0x6726('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x217972,_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);return _0x126ba7(_0x9f993['error'][_0x6726('0x13')]);}else{logger['info'](_0x6726('0xd'),_0x217972,_0x6726('0x10'));_0x126ba7(_0x9f993[_0x6726('0x14')][_0x6726('0x13')]);}})['catch'](function(_0x8323b2){logger[_0x6726('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x217972,_0x8323b2);_0x3d9f0f(_0x8323b2);});});}exports[_0x6726('0x15')]=function(_0x562f30){var _0x4c5c7b=this;return new Promise(function(_0x5f1677,_0xef52ce){return db[_0x6726('0x16')]['findAll']({'raw':_0x562f30[_0x6726('0x17')]?_0x562f30[_0x6726('0x17')][_0x6726('0x18')]===undefined?!![]:![]:!![],'where':_0x562f30[_0x6726('0x17')]?_0x562f30[_0x6726('0x17')][_0x6726('0x19')]||null:null,'attributes':_0x562f30['options']?_0x562f30[_0x6726('0x17')]['attributes']||null:null,'limit':_0x562f30[_0x6726('0x17')]?_0x562f30[_0x6726('0x17')][_0x6726('0x1a')]||null:null,'include':_0x562f30[_0x6726('0x17')]?_0x562f30[_0x6726('0x17')][_0x6726('0x1b')]?_['map'](_0x562f30[_0x6726('0x17')][_0x6726('0x1b')],function(_0xf9d466){return{'model':db[_0xf9d466[_0x6726('0x1c')]],'as':_0xf9d466['as'],'attributes':_0xf9d466['attributes'],'include':_0xf9d466[_0x6726('0x1b')]?_['map'](_0xf9d466['include'],function(_0x3cce96){return{'model':db[_0x3cce96[_0x6726('0x1c')]],'as':_0x3cce96['as'],'attributes':_0x3cce96[_0x6726('0x1d')],'include':_0x3cce96[_0x6726('0x1b')]?_['map'](_0x3cce96[_0x6726('0x1b')],function(_0x2c8068){return{'model':db[_0x2c8068[_0x6726('0x1c')]],'as':_0x2c8068['as'],'attributes':_0x2c8068['attributes']};}):[]};}):[]};}):[]:[]})[_0x6726('0xb')](function(_0x5d25a0){logger['info']('GetFreshdeskAccount',_0x562f30);logger[_0x6726('0xe')](_0x6726('0x15'),_0x562f30,JSON[_0x6726('0x11')](_0x5d25a0));_0x5f1677(_0x5d25a0);})[_0x6726('0x1e')](function(_0x5156ae){logger[_0x6726('0x12')](_0x6726('0x15'),_0x5156ae[_0x6726('0x13')],_0x562f30);_0xef52ce(_0x4c5c7b['error'](0x1f4,_0x5156ae[_0x6726('0x13')]));});});};exports[_0x6726('0x1f')]=function(_0x47f843){var _0x1f5946=this;return new Promise(function(_0x1d2eeb,_0x385bda){return db[_0x6726('0x16')][_0x6726('0x20')]({'raw':_0x47f843[_0x6726('0x17')]?_0x47f843[_0x6726('0x17')][_0x6726('0x18')]===undefined?!![]:![]:!![],'where':_0x47f843['options']?_0x47f843[_0x6726('0x17')][_0x6726('0x19')]||null:null,'attributes':_0x47f843[_0x6726('0x17')]?_0x47f843[_0x6726('0x17')][_0x6726('0x1d')]||null:null,'include':_0x47f843[_0x6726('0x17')]?_0x47f843[_0x6726('0x17')][_0x6726('0x1b')]?_['map'](_0x47f843['options'][_0x6726('0x1b')],function(_0x49d394){return{'model':db[_0x49d394[_0x6726('0x1c')]],'as':_0x49d394['as'],'attributes':_0x49d394[_0x6726('0x1d')],'include':_0x49d394['include']?_[_0x6726('0x21')](_0x49d394[_0x6726('0x1b')],function(_0x186e32){return{'model':db[_0x186e32['model']],'as':_0x186e32['as'],'attributes':_0x186e32[_0x6726('0x1d')],'include':_0x186e32[_0x6726('0x1b')]?_['map'](_0x186e32['include'],function(_0x192012){return{'model':db[_0x192012[_0x6726('0x1c')]],'as':_0x192012['as'],'attributes':_0x192012[_0x6726('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6726('0xb')](function(_0x378c66){logger[_0x6726('0xc')]('ShowFreshdeskAccount',_0x47f843);logger['debug'](_0x6726('0x1f'),_0x47f843,JSON[_0x6726('0x11')](_0x378c66));_0x1d2eeb(_0x378c66);})[_0x6726('0x1e')](function(_0x30444c){logger[_0x6726('0x12')]('ShowFreshdeskAccount',_0x30444c[_0x6726('0x13')],_0x47f843);_0x385bda(_0x1f5946[_0x6726('0x12')](0x1f4,_0x30444c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0e3af81..1891336 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 _0x7717=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x380501,_0x3babe6){var _0x1950d1=function(_0xc57c93){while(--_0xc57c93){_0x380501['push'](_0x380501['shift']());}};_0x1950d1(++_0x3babe6);}(_0x7717,0xac));var _0x7771=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7717[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x7771('0x0'));var path=require(_0x7771('0x1'));var timeout=require(_0x7771('0x2'));var express=require('express');var router=express[_0x7771('0x3')]();var fs_extra=require(_0x7771('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7771('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x7771('0x6')]('/',auth[_0x7771('0x7')](),controller[_0x7771('0x8')]);router[_0x7771('0x6')](_0x7771('0x9'),auth[_0x7771('0x7')](),controller[_0x7771('0xa')]);router['get']('/:id/fields',auth[_0x7771('0x7')](),controller[_0x7771('0xb')]);router[_0x7771('0x6')](_0x7771('0xc'),auth[_0x7771('0x7')](),controller[_0x7771('0xd')]);router['get'](_0x7771('0xe'),auth[_0x7771('0x7')](),controller[_0x7771('0xf')]);router[_0x7771('0x6')](_0x7771('0x10'),auth[_0x7771('0x7')](),controller['getTags']);router[_0x7771('0x11')]('/',auth[_0x7771('0x7')](),controller[_0x7771('0x12')]);router[_0x7771('0x11')](_0x7771('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x7771('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7771('0x14')]);router[_0x7771('0x15')](_0x7771('0x9'),auth[_0x7771('0x7')](),controller[_0x7771('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0162=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x0162,0x11c));var _0x2016=function(_0x291f1f,_0x48a642){_0x291f1f=_0x291f1f-0x0;var _0x2f9454=_0x0162[_0x291f1f];return _0x2f9454;};'use strict';var multer=require(_0x2016('0x0'));var util=require(_0x2016('0x1'));var path=require('path');var timeout=require(_0x2016('0x2'));var express=require(_0x2016('0x3'));var router=express[_0x2016('0x4')]();var fs_extra=require(_0x2016('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2016('0x6'));var config=require(_0x2016('0x7'));var controller=require(_0x2016('0x8'));router[_0x2016('0x9')]('/',auth[_0x2016('0xa')](),controller['index']);router['get']('/:id',auth[_0x2016('0xa')](),controller[_0x2016('0xb')]);router[_0x2016('0x9')](_0x2016('0xc'),auth[_0x2016('0xa')](),controller['getFields']);router[_0x2016('0x9')](_0x2016('0xd'),auth[_0x2016('0xa')](),controller[_0x2016('0xe')]);router['get'](_0x2016('0xf'),auth['isAuthenticated'](),controller[_0x2016('0x10')]);router['get'](_0x2016('0x11'),auth[_0x2016('0xa')](),controller[_0x2016('0x12')]);router[_0x2016('0x13')]('/',auth[_0x2016('0xa')](),controller['create']);router[_0x2016('0x13')](_0x2016('0x11'),auth['isAuthenticated'](),controller[_0x2016('0x14')]);router[_0x2016('0x15')](_0x2016('0x16'),auth[_0x2016('0xa')](),controller[_0x2016('0x17')]);router[_0x2016('0x18')]('/:id',auth[_0x2016('0xa')](),controller[_0x2016('0x19')]);module[_0x2016('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 112e9f1..8d141c3 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 _0xb712=['exports','STRING','sequelize'];(function(_0x25f12b,_0xa1ff3d){var _0x31a8df=function(_0x4c3e0c){while(--_0x4c3e0c){_0x25f12b['push'](_0x25f12b['shift']());}};_0x31a8df(++_0xa1ff3d);}(_0xb712,0x131));var _0x2b71=function(_0x386e19,_0x1a9d87){_0x386e19=_0x386e19-0x0;var _0xdbfbcc=_0xb712[_0x386e19];return _0xdbfbcc;};'use strict';var Sequelize=require(_0x2b71('0x0'));module[_0x2b71('0x1')]={'name':{'type':Sequelize[_0x2b71('0x2')]},'description':{'type':Sequelize[_0x2b71('0x2')]}}; \ No newline at end of file +var _0x8783=['exports','STRING'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x8783,0x136));var _0x3878=function(_0x141140,_0x3f2150){_0x141140=_0x141140-0x0;var _0x230cbf=_0x8783[_0x141140];return _0x230cbf;};'use strict';var Sequelize=require('sequelize');module[_0x3878('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3878('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index fb35de1..acdc699 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 _0xe0ba=['findOne','hasOwnProperty','nolimit','getSubjects','FreshdeskField','fields','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields'];(function(_0x5ec8c2,_0x417546){var _0x48559b=function(_0x1b5bd8){while(--_0x1b5bd8){_0x5ec8c2['push'](_0x5ec8c2['shift']());}};_0x48559b(++_0x417546);}(_0xe0ba,0x122));var _0xae0b=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xe0ba[_0x17928f];return _0x500b63;};'use strict';var emlformat=require(_0xae0b('0x0'));var rimraf=require(_0xae0b('0x1'));var zipdir=require(_0xae0b('0x2'));var jsonpatch=require(_0xae0b('0x3'));var rp=require(_0xae0b('0x4'));var moment=require(_0xae0b('0x5'));var BPromise=require(_0xae0b('0x6'));var Mustache=require(_0xae0b('0x7'));var util=require(_0xae0b('0x8'));var path=require('path');var sox=require(_0xae0b('0x9'));var csv=require('to-csv');var ejs=require(_0xae0b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae0b('0xb'));var squel=require(_0xae0b('0xc'));var crypto=require(_0xae0b('0xd'));var jsforce=require(_0xae0b('0xe'));var deskjs=require(_0xae0b('0xf'));var toCsv=require(_0xae0b('0x10'));var querystring=require(_0xae0b('0x11'));var Papa=require(_0xae0b('0x12'));var Redis=require(_0xae0b('0x13'));var authService=require(_0xae0b('0x14'));var qs=require(_0xae0b('0x15'));var as=require(_0xae0b('0x16'));var hardwareService=require(_0xae0b('0x17'));var logger=require(_0xae0b('0x18'))(_0xae0b('0x19'));var utils=require(_0xae0b('0x1a'));var config=require(_0xae0b('0x1b'));var licenseUtil=require(_0xae0b('0x1c'));var db=require(_0xae0b('0x1d'))['db'];function respondWithStatusCode(_0x3f3ada,_0x2efb46){_0x2efb46=_0x2efb46||0xcc;return function(_0xd02453){if(_0xd02453){return _0x3f3ada[_0xae0b('0x1e')](_0x2efb46);}return _0x3f3ada[_0xae0b('0x1f')](_0x2efb46)[_0xae0b('0x20')]();};}function respondWithResult(_0xd818c7,_0x478c18){_0x478c18=_0x478c18||0xc8;return function(_0x41dfaf){if(_0x41dfaf){return _0xd818c7[_0xae0b('0x1f')](_0x478c18)[_0xae0b('0x21')](_0x41dfaf);}};}function respondWithFilteredResult(_0x3d3ea0,_0x19c77f){return function(_0x3d0780){if(_0x3d0780){var _0x5c1786=typeof _0x19c77f[_0xae0b('0x22')]==='undefined'&&typeof _0x19c77f[_0xae0b('0x23')]===_0xae0b('0x24');var _0x597b95=_0x3d0780[_0xae0b('0x25')];var _0x159c74=_0x5c1786?0x0:_0x19c77f[_0xae0b('0x22')];var _0xb613e6=_0x5c1786?_0x3d0780[_0xae0b('0x25')]:_0x19c77f[_0xae0b('0x22')]+_0x19c77f[_0xae0b('0x23')];var _0x175b7f;if(_0xb613e6>=_0x597b95){_0xb613e6=_0x597b95;_0x175b7f=0xc8;}else{_0x175b7f=0xce;}_0x3d3ea0[_0xae0b('0x1f')](_0x175b7f);return _0x3d3ea0['set'](_0xae0b('0x26'),_0x159c74+'-'+_0xb613e6+'/'+_0x597b95)[_0xae0b('0x21')](_0x3d0780);}return null;};}function patchUpdates(_0x40ecd8){return function(_0x129194){try{jsonpatch[_0xae0b('0x27')](_0x129194,_0x40ecd8,!![]);}catch(_0x350fc1){return BPromise[_0xae0b('0x28')](_0x350fc1);}return _0x129194[_0xae0b('0x29')]();};}function saveUpdates(_0x6c8745,_0x5bcc20){return function(_0x38b366){if(_0x38b366){return _0x38b366[_0xae0b('0x2a')](_0x6c8745)['then'](function(_0x1f4ba9){return _0x1f4ba9;});}return null;};}function removeEntity(_0x3fd1c2,_0x340edc){return function(_0x2490f5){if(_0x2490f5){return _0x2490f5[_0xae0b('0x2b')]()[_0xae0b('0x2c')](function(){_0x3fd1c2['status'](0xcc)[_0xae0b('0x20')]();});}};}function handleEntityNotFound(_0x2f3874,_0x4c9b46){return function(_0x18cc4a){if(!_0x18cc4a){_0x2f3874['sendStatus'](0x194);}return _0x18cc4a;};}function handleError(_0x4d3a94,_0x3b12af){_0x3b12af=_0x3b12af||0x1f4;return function(_0x3e86cc){logger[_0xae0b('0x2d')](_0x3e86cc[_0xae0b('0x2e')]);if(_0x3e86cc[_0xae0b('0x2f')]){delete _0x3e86cc[_0xae0b('0x2f')];}_0x4d3a94['status'](_0x3b12af)[_0xae0b('0x30')](_0x3e86cc);};}exports[_0xae0b('0x31')]=function(_0x3363d1,_0xe257b6){var _0x55640c={},_0xedb73d={},_0x457c37={'count':0x0,'rows':[]};var _0x1d7281=_[_0xae0b('0x32')](db[_0xae0b('0x33')][_0xae0b('0x34')],function(_0x586c9d){return{'name':_0x586c9d[_0xae0b('0x35')],'type':_0x586c9d[_0xae0b('0x36')][_0xae0b('0x37')]};});_0xedb73d[_0xae0b('0x38')]=_[_0xae0b('0x32')](_0x1d7281,_0xae0b('0x2f'));_0xedb73d[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x3363d1[_0xae0b('0x39')]);_0xedb73d[_0xae0b('0x3b')]=_[_0xae0b('0x3c')](_0xedb73d['model'],_0xedb73d[_0xae0b('0x39')]);_0x55640c['attributes']=_['intersection'](_0xedb73d[_0xae0b('0x38')],qs['fields'](_0x3363d1['query']['fields']));_0x55640c[_0xae0b('0x3d')]=_0x55640c[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x55640c[_0xae0b('0x3d')]:_0xedb73d[_0xae0b('0x38')];if(!_0x3363d1[_0xae0b('0x39')]['hasOwnProperty']('nolimit')){_0x55640c[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x3363d1[_0xae0b('0x39')]['limit']);_0x55640c['offset']=qs[_0xae0b('0x22')](_0x3363d1[_0xae0b('0x39')][_0xae0b('0x22')]);}_0x55640c[_0xae0b('0x3f')]=qs['sort'](_0x3363d1['query'][_0xae0b('0x40')]);_0x55640c[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x3363d1['query'],_0xedb73d[_0xae0b('0x3b')]),_0x1d7281);if(_0x3363d1['query'][_0xae0b('0x43')]){_0x55640c[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x55640c[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x1d7281,function(_0x177ae8){if(_0x177ae8[_0xae0b('0x36')]!==_0xae0b('0x45')){var _0x5db706={};_0x5db706[_0x177ae8['name']]={'$like':'%'+_0x3363d1[_0xae0b('0x39')]['filter']+'%'};return _0x5db706;}})});}_0x55640c=_['merge']({},_0x55640c,_0x3363d1[_0xae0b('0x46')]);var _0x1539af={'where':_0x55640c[_0xae0b('0x41')]};return db[_0xae0b('0x33')][_0xae0b('0x25')](_0x1539af)[_0xae0b('0x2c')](function(_0x16e732){_0x457c37['count']=_0x16e732;if(_0x3363d1[_0xae0b('0x39')][_0xae0b('0x47')]){_0x55640c[_0xae0b('0x48')]=[{'all':!![]}];}return db[_0xae0b('0x33')][_0xae0b('0x49')](_0x55640c);})[_0xae0b('0x2c')](function(_0x524e14){_0x457c37[_0xae0b('0x4a')]=_0x524e14;return _0x457c37;})[_0xae0b('0x2c')](respondWithFilteredResult(_0xe257b6,_0x55640c))[_0xae0b('0x4b')](handleError(_0xe257b6,null));};exports[_0xae0b('0x4c')]=function(_0x45dc24,_0x146f10){var _0x5e86c3={'raw':![],'where':{'id':_0x45dc24[_0xae0b('0x4d')]['id']}},_0x3a525e={};_0x3a525e['model']=_[_0xae0b('0x3a')](db[_0xae0b('0x33')][_0xae0b('0x34')]);_0x3a525e[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x45dc24[_0xae0b('0x39')]);_0x3a525e['filters']=_[_0xae0b('0x3c')](_0x3a525e[_0xae0b('0x38')],_0x3a525e[_0xae0b('0x39')]);_0x5e86c3[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x3a525e['model'],qs['fields'](_0x45dc24[_0xae0b('0x39')]['fields']));_0x5e86c3[_0xae0b('0x3d')]=_0x5e86c3[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x5e86c3[_0xae0b('0x3d')]:_0x3a525e[_0xae0b('0x38')];if(_0x45dc24[_0xae0b('0x39')][_0xae0b('0x47')]){_0x5e86c3[_0xae0b('0x48')]=[{'all':!![]}];}_0x5e86c3=_[_0xae0b('0x44')]({},_0x5e86c3,_0x45dc24[_0xae0b('0x46')]);return db[_0xae0b('0x33')][_0xae0b('0x4e')](_0x5e86c3)['then'](handleEntityNotFound(_0x146f10,null))[_0xae0b('0x2c')](respondWithResult(_0x146f10,null))[_0xae0b('0x4b')](handleError(_0x146f10,null));};exports[_0xae0b('0x4f')]=function(_0x51cfdd,_0x237fdb){return db['FreshdeskConfiguration'][_0xae0b('0x4f')](_0x51cfdd[_0xae0b('0x50')],{})[_0xae0b('0x2c')](respondWithResult(_0x237fdb,0xc9))[_0xae0b('0x4b')](handleError(_0x237fdb,null));};exports['update']=function(_0x535434,_0x311149){if(_0x535434[_0xae0b('0x50')]['id']){delete _0x535434[_0xae0b('0x50')]['id'];}return db[_0xae0b('0x33')][_0xae0b('0x4e')]({'where':{'id':_0x535434[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x311149,null))['then'](saveUpdates(_0x535434['body'],null))['then'](respondWithResult(_0x311149,null))[_0xae0b('0x4b')](handleError(_0x311149,null));};exports[_0xae0b('0x2b')]=function(_0x41da94,_0x328787){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x41da94[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x328787,null))[_0xae0b('0x2c')](removeEntity(_0x328787,null))[_0xae0b('0x4b')](handleError(_0x328787,null));};exports[_0xae0b('0x51')]=function(_0x3b64c4,_0x27a585,_0x297c4e){var _0x2e2fc6={};var _0x1a360e={};var _0x2ccfac;var _0x5f221e;return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x3b64c4[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x27a585,null))[_0xae0b('0x2c')](function(_0x4ca3fe){if(_0x4ca3fe){_0x2ccfac=_0x4ca3fe;_0x1a360e[_0xae0b('0x38')]=_[_0xae0b('0x3a')](db['FreshdeskField'][_0xae0b('0x34')]);_0x1a360e[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x3b64c4[_0xae0b('0x39')]);_0x1a360e['filters']=_['intersection'](_0x1a360e[_0xae0b('0x38')],_0x1a360e[_0xae0b('0x39')]);_0x2e2fc6[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x1a360e['model'],qs['fields'](_0x3b64c4[_0xae0b('0x39')]['fields']));_0x2e2fc6[_0xae0b('0x3d')]=_0x2e2fc6[_0xae0b('0x3d')]['length']?_0x2e2fc6['attributes']:_0x1a360e[_0xae0b('0x38')];_0x2e2fc6[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x3b64c4[_0xae0b('0x39')]['sort']);_0x2e2fc6['where']=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x3b64c4[_0xae0b('0x39')],_0x1a360e[_0xae0b('0x3b')]));if(_0x3b64c4['query'][_0xae0b('0x43')]){_0x2e2fc6[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x2e2fc6['where'],{'$or':_[_0xae0b('0x32')](_0x2e2fc6[_0xae0b('0x3d')],function(_0x3a79c6){var _0x5476f8={};_0x5476f8[_0x3a79c6]={'$like':'%'+_0x3b64c4['query'][_0xae0b('0x43')]+'%'};return _0x5476f8;})});}_0x2e2fc6=_[_0xae0b('0x44')]({},_0x2e2fc6,_0x3b64c4[_0xae0b('0x46')]);return _0x2ccfac[_0xae0b('0x51')](_0x2e2fc6);}})[_0xae0b('0x2c')](function(_0x43957f){if(_0x43957f){_0x5f221e=_0x43957f['length'];if(!_0x3b64c4[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x2e2fc6[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x3b64c4[_0xae0b('0x39')][_0xae0b('0x23')]);_0x2e2fc6[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x3b64c4['query'][_0xae0b('0x22')]);}return _0x2ccfac[_0xae0b('0x51')](_0x2e2fc6);}})[_0xae0b('0x2c')](function(_0x18bc6b){if(_0x18bc6b){return _0x18bc6b?{'count':_0x5f221e,'rows':_0x18bc6b}:null;}})['then'](respondWithResult(_0x27a585,null))['catch'](handleError(_0x27a585,null));};exports[_0xae0b('0x55')]=function(_0x7787e8,_0x246d73,_0x50556){var _0x129f03={};var _0x59c5a2={};var _0x34ac56;var _0x466698;return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x7787e8[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x246d73,null))[_0xae0b('0x2c')](function(_0x40bada){if(_0x40bada){_0x34ac56=_0x40bada;_0x59c5a2[_0xae0b('0x38')]=_[_0xae0b('0x3a')](db[_0xae0b('0x56')][_0xae0b('0x34')]);_0x59c5a2[_0xae0b('0x39')]=_[_0xae0b('0x3a')](_0x7787e8[_0xae0b('0x39')]);_0x59c5a2[_0xae0b('0x3b')]=_[_0xae0b('0x3c')](_0x59c5a2[_0xae0b('0x38')],_0x59c5a2['query']);_0x129f03[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x59c5a2['model'],qs['fields'](_0x7787e8['query'][_0xae0b('0x57')]));_0x129f03[_0xae0b('0x3d')]=_0x129f03[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x129f03['attributes']:_0x59c5a2[_0xae0b('0x38')];_0x129f03[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x7787e8['query'][_0xae0b('0x40')]);_0x129f03[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x7787e8[_0xae0b('0x39')],_0x59c5a2['filters']));if(_0x7787e8[_0xae0b('0x39')]['filter']){_0x129f03[_0xae0b('0x41')]=_['merge'](_0x129f03['where'],{'$or':_[_0xae0b('0x32')](_0x129f03[_0xae0b('0x3d')],function(_0x7c367a){var _0x1e5e11={};_0x1e5e11[_0x7c367a]={'$like':'%'+_0x7787e8[_0xae0b('0x39')][_0xae0b('0x43')]+'%'};return _0x1e5e11;})});}_0x129f03=_['merge']({},_0x129f03,_0x7787e8[_0xae0b('0x46')]);return _0x34ac56[_0xae0b('0x55')](_0x129f03);}})['then'](function(_0x2a87a8){if(_0x2a87a8){_0x466698=_0x2a87a8[_0xae0b('0x3e')];if(!_0x7787e8[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x129f03[_0xae0b('0x23')]=qs[_0xae0b('0x23')](_0x7787e8[_0xae0b('0x39')][_0xae0b('0x23')]);_0x129f03[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x7787e8[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x34ac56[_0xae0b('0x55')](_0x129f03);}})[_0xae0b('0x2c')](function(_0x11b38f){if(_0x11b38f){return _0x11b38f?{'count':_0x466698,'rows':_0x11b38f}:null;}})['then'](respondWithResult(_0x246d73,null))[_0xae0b('0x4b')](handleError(_0x246d73,null));};exports[_0xae0b('0x58')]=function(_0x4234a0,_0x5b54ab,_0x5776f4){var _0x45230d={};var _0x5f2bc6={};var _0x574e10;var _0x47ed84;return db['FreshdeskConfiguration'][_0xae0b('0x52')]({'where':{'id':_0x4234a0[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0x5b54ab,null))[_0xae0b('0x2c')](function(_0x1996e5){if(_0x1996e5){_0x574e10=_0x1996e5;_0x5f2bc6[_0xae0b('0x38')]=_['keys'](db[_0xae0b('0x56')]['rawAttributes']);_0x5f2bc6[_0xae0b('0x39')]=_['keys'](_0x4234a0[_0xae0b('0x39')]);_0x5f2bc6['filters']=_['intersection'](_0x5f2bc6[_0xae0b('0x38')],_0x5f2bc6['query']);_0x45230d[_0xae0b('0x3d')]=_['intersection'](_0x5f2bc6[_0xae0b('0x38')],qs['fields'](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x57')]));_0x45230d['attributes']=_0x45230d[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x45230d[_0xae0b('0x3d')]:_0x5f2bc6['model'];_0x45230d['order']=qs[_0xae0b('0x40')](_0x4234a0[_0xae0b('0x39')]['sort']);_0x45230d[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_[_0xae0b('0x42')](_0x4234a0[_0xae0b('0x39')],_0x5f2bc6['filters']));if(_0x4234a0[_0xae0b('0x39')]['filter']){_0x45230d[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x45230d[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x45230d[_0xae0b('0x3d')],function(_0x4d5df2){var _0x160105={};_0x160105[_0x4d5df2]={'$like':'%'+_0x4234a0['query'][_0xae0b('0x43')]+'%'};return _0x160105;})});}_0x45230d=_[_0xae0b('0x44')]({},_0x45230d,_0x4234a0[_0xae0b('0x46')]);return _0x574e10[_0xae0b('0x58')](_0x45230d);}})['then'](function(_0x14166c){if(_0x14166c){_0x47ed84=_0x14166c[_0xae0b('0x3e')];if(!_0x4234a0[_0xae0b('0x39')][_0xae0b('0x53')](_0xae0b('0x54'))){_0x45230d['limit']=qs['limit'](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x23')]);_0x45230d[_0xae0b('0x22')]=qs[_0xae0b('0x22')](_0x4234a0[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x574e10[_0xae0b('0x58')](_0x45230d);}})[_0xae0b('0x2c')](function(_0x3c20a4){if(_0x3c20a4){return _0x3c20a4?{'count':_0x47ed84,'rows':_0x3c20a4}:null;}})[_0xae0b('0x2c')](respondWithResult(_0x5b54ab,null))[_0xae0b('0x4b')](handleError(_0x5b54ab,null));};exports[_0xae0b('0x59')]=function(_0x14feab,_0xe8ab29,_0x533742){var _0x1795c0={};var _0x26fdba={};var _0x50b89f;var _0x490a3d;return db[_0xae0b('0x33')]['findOne']({'where':{'id':_0x14feab[_0xae0b('0x4d')]['id']}})[_0xae0b('0x2c')](handleEntityNotFound(_0xe8ab29,null))[_0xae0b('0x2c')](function(_0x21971b){if(_0x21971b){_0x50b89f=_0x21971b;_0x26fdba[_0xae0b('0x38')]=_['keys'](db[_0xae0b('0x5a')]['rawAttributes']);_0x26fdba[_0xae0b('0x39')]=_['keys'](_0x14feab[_0xae0b('0x39')]);_0x26fdba['filters']=_[_0xae0b('0x3c')](_0x26fdba['model'],_0x26fdba[_0xae0b('0x39')]);_0x1795c0[_0xae0b('0x3d')]=_[_0xae0b('0x3c')](_0x26fdba[_0xae0b('0x38')],qs['fields'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x57')]));_0x1795c0[_0xae0b('0x3d')]=_0x1795c0[_0xae0b('0x3d')][_0xae0b('0x3e')]?_0x1795c0[_0xae0b('0x3d')]:_0x26fdba[_0xae0b('0x38')];_0x1795c0[_0xae0b('0x3f')]=qs[_0xae0b('0x40')](_0x14feab['query']['sort']);_0x1795c0[_0xae0b('0x41')]=qs[_0xae0b('0x3b')](_['pick'](_0x14feab[_0xae0b('0x39')],_0x26fdba[_0xae0b('0x3b')]));if(_0x14feab['query'][_0xae0b('0x43')]){_0x1795c0[_0xae0b('0x41')]=_[_0xae0b('0x44')](_0x1795c0[_0xae0b('0x41')],{'$or':_[_0xae0b('0x32')](_0x1795c0[_0xae0b('0x3d')],function(_0x576a0a){var _0x211143={};_0x211143[_0x576a0a]={'$like':'%'+_0x14feab[_0xae0b('0x39')]['filter']+'%'};return _0x211143;})});}_0x1795c0=_[_0xae0b('0x44')]({},_0x1795c0,_0x14feab[_0xae0b('0x46')]);return _0x50b89f[_0xae0b('0x59')](_0x1795c0);}})[_0xae0b('0x2c')](function(_0x103b6b){if(_0x103b6b){_0x490a3d=_0x103b6b[_0xae0b('0x3e')];if(!_0x14feab['query']['hasOwnProperty'](_0xae0b('0x54'))){_0x1795c0[_0xae0b('0x23')]=qs['limit'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x23')]);_0x1795c0[_0xae0b('0x22')]=qs['offset'](_0x14feab[_0xae0b('0x39')][_0xae0b('0x22')]);}return _0x50b89f[_0xae0b('0x59')](_0x1795c0);}})[_0xae0b('0x2c')](function(_0x1a32a6){if(_0x1a32a6){return _0x1a32a6?{'count':_0x490a3d,'rows':_0x1a32a6}:null;}})[_0xae0b('0x2c')](respondWithResult(_0xe8ab29,null))[_0xae0b('0x4b')](handleError(_0xe8ab29,null));};exports[_0xae0b('0x5b')]=function(_0x3d6cb,_0x135969,_0x8c063f){if(_0x3d6cb['body']['id']){delete _0x3d6cb[_0xae0b('0x50')]['id'];}return db[_0xae0b('0x33')][_0xae0b('0x52')]({'where':{'id':_0x3d6cb[_0xae0b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x135969,null))[_0xae0b('0x2c')](function(_0x1ffc71){if(_0x1ffc71){return _0x1ffc71[_0xae0b('0x5b')](_0x3d6cb['body'][_0xae0b('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x135969,null))[_0xae0b('0x4b')](handleError(_0x135969,null));}; \ No newline at end of file +var _0xdfe8=['save','update','then','destroy','error','stack','send','index','map','FreshdeskConfiguration','fieldName','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','rawAttributes','keys','include','options','find','create','body','findOne','getFields','nolimit','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdfe8,0x8a));var _0x8dfe=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xdfe8[_0x5c6299];return _0x23b564;};'use strict';var emlformat=require(_0x8dfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8dfe('0x2'));var moment=require(_0x8dfe('0x3'));var BPromise=require(_0x8dfe('0x4'));var Mustache=require(_0x8dfe('0x5'));var util=require('util');var path=require(_0x8dfe('0x6'));var sox=require(_0x8dfe('0x7'));var csv=require('to-csv');var ejs=require(_0x8dfe('0x8'));var fs=require('fs');var fs_extra=require(_0x8dfe('0x9'));var _=require(_0x8dfe('0xa'));var squel=require(_0x8dfe('0xb'));var crypto=require(_0x8dfe('0xc'));var jsforce=require(_0x8dfe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8dfe('0xe'));var querystring=require(_0x8dfe('0xf'));var Papa=require(_0x8dfe('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8dfe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dfe('0x12'));var logger=require(_0x8dfe('0x13'))(_0x8dfe('0x14'));var utils=require(_0x8dfe('0x15'));var config=require(_0x8dfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dfe('0x17'))['db'];function respondWithStatusCode(_0x1c4a21,_0x5b3a90){_0x5b3a90=_0x5b3a90||0xcc;return function(_0x39d8e0){if(_0x39d8e0){return _0x1c4a21[_0x8dfe('0x18')](_0x5b3a90);}return _0x1c4a21[_0x8dfe('0x19')](_0x5b3a90)[_0x8dfe('0x1a')]();};}function respondWithResult(_0x4665ff,_0x531d42){_0x531d42=_0x531d42||0xc8;return function(_0x277bb8){if(_0x277bb8){return _0x4665ff[_0x8dfe('0x19')](_0x531d42)[_0x8dfe('0x1b')](_0x277bb8);}};}function respondWithFilteredResult(_0x44ffa0,_0x27d78e){return function(_0x490068){if(_0x490068){var _0x30be8=typeof _0x27d78e[_0x8dfe('0x1c')]==='undefined'&&typeof _0x27d78e['limit']===_0x8dfe('0x1d');var _0x2e7426=_0x490068[_0x8dfe('0x1e')];var _0x382b43=_0x30be8?0x0:_0x27d78e[_0x8dfe('0x1c')];var _0x5dd9bd=_0x30be8?_0x490068[_0x8dfe('0x1e')]:_0x27d78e[_0x8dfe('0x1c')]+_0x27d78e[_0x8dfe('0x1f')];var _0x59c608;if(_0x5dd9bd>=_0x2e7426){_0x5dd9bd=_0x2e7426;_0x59c608=0xc8;}else{_0x59c608=0xce;}_0x44ffa0['status'](_0x59c608);return _0x44ffa0[_0x8dfe('0x20')](_0x8dfe('0x21'),_0x382b43+'-'+_0x5dd9bd+'/'+_0x2e7426)[_0x8dfe('0x1b')](_0x490068);}return null;};}function patchUpdates(_0x6d6e9b){return function(_0x589e2f){try{jsonpatch[_0x8dfe('0x22')](_0x589e2f,_0x6d6e9b,!![]);}catch(_0x67d3f7){return BPromise[_0x8dfe('0x23')](_0x67d3f7);}return _0x589e2f[_0x8dfe('0x24')]();};}function saveUpdates(_0x125216,_0x15544a){return function(_0x24b8f5){if(_0x24b8f5){return _0x24b8f5[_0x8dfe('0x25')](_0x125216)[_0x8dfe('0x26')](function(_0x3fa1f8){return _0x3fa1f8;});}return null;};}function removeEntity(_0x5035c3,_0x2376f0){return function(_0x119f93){if(_0x119f93){return _0x119f93[_0x8dfe('0x27')]()[_0x8dfe('0x26')](function(){_0x5035c3[_0x8dfe('0x19')](0xcc)[_0x8dfe('0x1a')]();});}};}function handleEntityNotFound(_0x1ec54c,_0x4d694f){return function(_0x4e0200){if(!_0x4e0200){_0x1ec54c['sendStatus'](0x194);}return _0x4e0200;};}function handleError(_0x32b1f1,_0x5c4714){_0x5c4714=_0x5c4714||0x1f4;return function(_0x276cb3){logger[_0x8dfe('0x28')](_0x276cb3[_0x8dfe('0x29')]);if(_0x276cb3['name']){delete _0x276cb3['name'];}_0x32b1f1['status'](_0x5c4714)[_0x8dfe('0x2a')](_0x276cb3);};}exports[_0x8dfe('0x2b')]=function(_0x511929,_0x3720e2){var _0x37b62b={},_0x514c53={},_0x58d55b={'count':0x0,'rows':[]};var _0x593455=_[_0x8dfe('0x2c')](db[_0x8dfe('0x2d')]['rawAttributes'],function(_0x45d28d){return{'name':_0x45d28d[_0x8dfe('0x2e')],'type':_0x45d28d[_0x8dfe('0x2f')][_0x8dfe('0x30')]};});_0x514c53['model']=_[_0x8dfe('0x2c')](_0x593455,_0x8dfe('0x31'));_0x514c53[_0x8dfe('0x32')]=_['keys'](_0x511929['query']);_0x514c53[_0x8dfe('0x33')]=_[_0x8dfe('0x34')](_0x514c53[_0x8dfe('0x35')],_0x514c53[_0x8dfe('0x32')]);_0x37b62b['attributes']=_[_0x8dfe('0x34')](_0x514c53[_0x8dfe('0x35')],qs[_0x8dfe('0x36')](_0x511929[_0x8dfe('0x32')][_0x8dfe('0x36')]));_0x37b62b['attributes']=_0x37b62b[_0x8dfe('0x37')][_0x8dfe('0x38')]?_0x37b62b[_0x8dfe('0x37')]:_0x514c53['model'];if(!_0x511929[_0x8dfe('0x32')][_0x8dfe('0x39')]('nolimit')){_0x37b62b[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x511929['query'][_0x8dfe('0x1f')]);_0x37b62b[_0x8dfe('0x1c')]=qs['offset'](_0x511929[_0x8dfe('0x32')]['offset']);}_0x37b62b[_0x8dfe('0x3a')]=qs[_0x8dfe('0x3b')](_0x511929[_0x8dfe('0x32')][_0x8dfe('0x3b')]);_0x37b62b[_0x8dfe('0x3c')]=qs['filters'](_[_0x8dfe('0x3d')](_0x511929[_0x8dfe('0x32')],_0x514c53[_0x8dfe('0x33')]),_0x593455);if(_0x511929[_0x8dfe('0x32')][_0x8dfe('0x3e')]){_0x37b62b[_0x8dfe('0x3c')]=_[_0x8dfe('0x3f')](_0x37b62b['where'],{'$or':_['map'](_0x593455,function(_0x5de637){if(_0x5de637[_0x8dfe('0x2f')]!==_0x8dfe('0x40')){var _0x4ec1de={};_0x4ec1de[_0x5de637[_0x8dfe('0x31')]]={'$like':'%'+_0x511929[_0x8dfe('0x32')]['filter']+'%'};return _0x4ec1de;}})});}_0x37b62b=_[_0x8dfe('0x3f')]({},_0x37b62b,_0x511929['options']);var _0x37af8d={'where':_0x37b62b[_0x8dfe('0x3c')]};return db[_0x8dfe('0x2d')][_0x8dfe('0x1e')](_0x37af8d)[_0x8dfe('0x26')](function(_0x5dab4e){_0x58d55b['count']=_0x5dab4e;if(_0x511929['query'][_0x8dfe('0x41')]){_0x37b62b['include']=[{'all':!![]}];}return db[_0x8dfe('0x2d')][_0x8dfe('0x42')](_0x37b62b);})[_0x8dfe('0x26')](function(_0x5cb4ca){_0x58d55b[_0x8dfe('0x43')]=_0x5cb4ca;return _0x58d55b;})[_0x8dfe('0x26')](respondWithFilteredResult(_0x3720e2,_0x37b62b))[_0x8dfe('0x44')](handleError(_0x3720e2,null));};exports['show']=function(_0x456cda,_0x2e42b2){var _0xaedd8e={'raw':![],'where':{'id':_0x456cda[_0x8dfe('0x45')]['id']}},_0x470a31={};_0x470a31['model']=_['keys'](db[_0x8dfe('0x2d')][_0x8dfe('0x46')]);_0x470a31[_0x8dfe('0x32')]=_[_0x8dfe('0x47')](_0x456cda[_0x8dfe('0x32')]);_0x470a31[_0x8dfe('0x33')]=_[_0x8dfe('0x34')](_0x470a31[_0x8dfe('0x35')],_0x470a31[_0x8dfe('0x32')]);_0xaedd8e[_0x8dfe('0x37')]=_[_0x8dfe('0x34')](_0x470a31[_0x8dfe('0x35')],qs[_0x8dfe('0x36')](_0x456cda[_0x8dfe('0x32')]['fields']));_0xaedd8e[_0x8dfe('0x37')]=_0xaedd8e[_0x8dfe('0x37')]['length']?_0xaedd8e[_0x8dfe('0x37')]:_0x470a31['model'];if(_0x456cda['query']['includeAll']){_0xaedd8e[_0x8dfe('0x48')]=[{'all':!![]}];}_0xaedd8e=_[_0x8dfe('0x3f')]({},_0xaedd8e,_0x456cda[_0x8dfe('0x49')]);return db[_0x8dfe('0x2d')][_0x8dfe('0x4a')](_0xaedd8e)['then'](handleEntityNotFound(_0x2e42b2,null))['then'](respondWithResult(_0x2e42b2,null))[_0x8dfe('0x44')](handleError(_0x2e42b2,null));};exports[_0x8dfe('0x4b')]=function(_0x2054e7,_0x3d0ab3){return db[_0x8dfe('0x2d')]['create'](_0x2054e7[_0x8dfe('0x4c')],{})[_0x8dfe('0x26')](respondWithResult(_0x3d0ab3,0xc9))[_0x8dfe('0x44')](handleError(_0x3d0ab3,null));};exports[_0x8dfe('0x25')]=function(_0x4893dd,_0x5b8b28){if(_0x4893dd[_0x8dfe('0x4c')]['id']){delete _0x4893dd[_0x8dfe('0x4c')]['id'];}return db[_0x8dfe('0x2d')][_0x8dfe('0x4a')]({'where':{'id':_0x4893dd[_0x8dfe('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b8b28,null))[_0x8dfe('0x26')](saveUpdates(_0x4893dd[_0x8dfe('0x4c')],null))['then'](respondWithResult(_0x5b8b28,null))[_0x8dfe('0x44')](handleError(_0x5b8b28,null));};exports[_0x8dfe('0x27')]=function(_0x14ca09,_0x518549){return db[_0x8dfe('0x2d')][_0x8dfe('0x4a')]({'where':{'id':_0x14ca09[_0x8dfe('0x45')]['id']}})[_0x8dfe('0x26')](handleEntityNotFound(_0x518549,null))['then'](removeEntity(_0x518549,null))['catch'](handleError(_0x518549,null));};exports['getFields']=function(_0x2705bd,_0x1945b5,_0x1eb8e3){var _0x57398d={};var _0xb8b89e={};var _0x227a9a;var _0x20c214;return db[_0x8dfe('0x2d')][_0x8dfe('0x4d')]({'where':{'id':_0x2705bd['params']['id']}})[_0x8dfe('0x26')](handleEntityNotFound(_0x1945b5,null))[_0x8dfe('0x26')](function(_0x375d12){if(_0x375d12){_0x227a9a=_0x375d12;_0xb8b89e['model']=_[_0x8dfe('0x47')](db['FreshdeskField'][_0x8dfe('0x46')]);_0xb8b89e['query']=_[_0x8dfe('0x47')](_0x2705bd['query']);_0xb8b89e[_0x8dfe('0x33')]=_['intersection'](_0xb8b89e[_0x8dfe('0x35')],_0xb8b89e[_0x8dfe('0x32')]);_0x57398d[_0x8dfe('0x37')]=_[_0x8dfe('0x34')](_0xb8b89e[_0x8dfe('0x35')],qs['fields'](_0x2705bd[_0x8dfe('0x32')][_0x8dfe('0x36')]));_0x57398d['attributes']=_0x57398d[_0x8dfe('0x37')]['length']?_0x57398d['attributes']:_0xb8b89e[_0x8dfe('0x35')];_0x57398d['order']=qs['sort'](_0x2705bd[_0x8dfe('0x32')][_0x8dfe('0x3b')]);_0x57398d[_0x8dfe('0x3c')]=qs[_0x8dfe('0x33')](_[_0x8dfe('0x3d')](_0x2705bd[_0x8dfe('0x32')],_0xb8b89e[_0x8dfe('0x33')]));if(_0x2705bd[_0x8dfe('0x32')][_0x8dfe('0x3e')]){_0x57398d[_0x8dfe('0x3c')]=_[_0x8dfe('0x3f')](_0x57398d['where'],{'$or':_[_0x8dfe('0x2c')](_0x57398d[_0x8dfe('0x37')],function(_0x2bf1b9){var _0x524e70={};_0x524e70[_0x2bf1b9]={'$like':'%'+_0x2705bd[_0x8dfe('0x32')][_0x8dfe('0x3e')]+'%'};return _0x524e70;})});}_0x57398d=_['merge']({},_0x57398d,_0x2705bd['options']);return _0x227a9a[_0x8dfe('0x4e')](_0x57398d);}})[_0x8dfe('0x26')](function(_0x18077a){if(_0x18077a){_0x20c214=_0x18077a[_0x8dfe('0x38')];if(!_0x2705bd[_0x8dfe('0x32')][_0x8dfe('0x39')](_0x8dfe('0x4f'))){_0x57398d[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x2705bd['query']['limit']);_0x57398d['offset']=qs[_0x8dfe('0x1c')](_0x2705bd['query'][_0x8dfe('0x1c')]);}return _0x227a9a[_0x8dfe('0x4e')](_0x57398d);}})['then'](function(_0x266ef0){if(_0x266ef0){return _0x266ef0?{'count':_0x20c214,'rows':_0x266ef0}:null;}})['then'](respondWithResult(_0x1945b5,null))[_0x8dfe('0x44')](handleError(_0x1945b5,null));};exports[_0x8dfe('0x50')]=function(_0x59851f,_0x3b99f4,_0x466f8c){var _0xb58762={};var _0x49fe21={};var _0x30324d;var _0x26b26d;return db[_0x8dfe('0x2d')]['findOne']({'where':{'id':_0x59851f['params']['id']}})['then'](handleEntityNotFound(_0x3b99f4,null))[_0x8dfe('0x26')](function(_0x151be9){if(_0x151be9){_0x30324d=_0x151be9;_0x49fe21[_0x8dfe('0x35')]=_[_0x8dfe('0x47')](db[_0x8dfe('0x51')][_0x8dfe('0x46')]);_0x49fe21['query']=_[_0x8dfe('0x47')](_0x59851f['query']);_0x49fe21[_0x8dfe('0x33')]=_['intersection'](_0x49fe21[_0x8dfe('0x35')],_0x49fe21[_0x8dfe('0x32')]);_0xb58762[_0x8dfe('0x37')]=_[_0x8dfe('0x34')](_0x49fe21[_0x8dfe('0x35')],qs[_0x8dfe('0x36')](_0x59851f['query'][_0x8dfe('0x36')]));_0xb58762[_0x8dfe('0x37')]=_0xb58762[_0x8dfe('0x37')][_0x8dfe('0x38')]?_0xb58762[_0x8dfe('0x37')]:_0x49fe21[_0x8dfe('0x35')];_0xb58762[_0x8dfe('0x3a')]=qs[_0x8dfe('0x3b')](_0x59851f[_0x8dfe('0x32')][_0x8dfe('0x3b')]);_0xb58762[_0x8dfe('0x3c')]=qs[_0x8dfe('0x33')](_[_0x8dfe('0x3d')](_0x59851f[_0x8dfe('0x32')],_0x49fe21['filters']));if(_0x59851f['query'][_0x8dfe('0x3e')]){_0xb58762['where']=_[_0x8dfe('0x3f')](_0xb58762[_0x8dfe('0x3c')],{'$or':_[_0x8dfe('0x2c')](_0xb58762[_0x8dfe('0x37')],function(_0x4cb767){var _0xf374cd={};_0xf374cd[_0x4cb767]={'$like':'%'+_0x59851f[_0x8dfe('0x32')][_0x8dfe('0x3e')]+'%'};return _0xf374cd;})});}_0xb58762=_[_0x8dfe('0x3f')]({},_0xb58762,_0x59851f[_0x8dfe('0x49')]);return _0x30324d[_0x8dfe('0x50')](_0xb58762);}})['then'](function(_0x140ac6){if(_0x140ac6){_0x26b26d=_0x140ac6['length'];if(!_0x59851f[_0x8dfe('0x32')]['hasOwnProperty'](_0x8dfe('0x4f'))){_0xb58762[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x59851f['query'][_0x8dfe('0x1f')]);_0xb58762[_0x8dfe('0x1c')]=qs[_0x8dfe('0x1c')](_0x59851f[_0x8dfe('0x32')][_0x8dfe('0x1c')]);}return _0x30324d[_0x8dfe('0x50')](_0xb58762);}})[_0x8dfe('0x26')](function(_0x266938){if(_0x266938){return _0x266938?{'count':_0x26b26d,'rows':_0x266938}:null;}})[_0x8dfe('0x26')](respondWithResult(_0x3b99f4,null))[_0x8dfe('0x44')](handleError(_0x3b99f4,null));};exports[_0x8dfe('0x52')]=function(_0x2af9cb,_0x3277b7,_0x2f0d7c){var _0x50b1bb={};var _0x4144c5={};var _0x4b058d;var _0xc5fc6c;return db[_0x8dfe('0x2d')][_0x8dfe('0x4d')]({'where':{'id':_0x2af9cb[_0x8dfe('0x45')]['id']}})[_0x8dfe('0x26')](handleEntityNotFound(_0x3277b7,null))[_0x8dfe('0x26')](function(_0x30ed77){if(_0x30ed77){_0x4b058d=_0x30ed77;_0x4144c5['model']=_[_0x8dfe('0x47')](db[_0x8dfe('0x51')]['rawAttributes']);_0x4144c5[_0x8dfe('0x32')]=_[_0x8dfe('0x47')](_0x2af9cb[_0x8dfe('0x32')]);_0x4144c5[_0x8dfe('0x33')]=_[_0x8dfe('0x34')](_0x4144c5[_0x8dfe('0x35')],_0x4144c5[_0x8dfe('0x32')]);_0x50b1bb['attributes']=_[_0x8dfe('0x34')](_0x4144c5[_0x8dfe('0x35')],qs[_0x8dfe('0x36')](_0x2af9cb[_0x8dfe('0x32')][_0x8dfe('0x36')]));_0x50b1bb[_0x8dfe('0x37')]=_0x50b1bb[_0x8dfe('0x37')][_0x8dfe('0x38')]?_0x50b1bb[_0x8dfe('0x37')]:_0x4144c5['model'];_0x50b1bb[_0x8dfe('0x3a')]=qs['sort'](_0x2af9cb[_0x8dfe('0x32')]['sort']);_0x50b1bb[_0x8dfe('0x3c')]=qs[_0x8dfe('0x33')](_['pick'](_0x2af9cb[_0x8dfe('0x32')],_0x4144c5[_0x8dfe('0x33')]));if(_0x2af9cb['query']['filter']){_0x50b1bb[_0x8dfe('0x3c')]=_[_0x8dfe('0x3f')](_0x50b1bb[_0x8dfe('0x3c')],{'$or':_['map'](_0x50b1bb[_0x8dfe('0x37')],function(_0x5d40e2){var _0x259d45={};_0x259d45[_0x5d40e2]={'$like':'%'+_0x2af9cb['query']['filter']+'%'};return _0x259d45;})});}_0x50b1bb=_[_0x8dfe('0x3f')]({},_0x50b1bb,_0x2af9cb[_0x8dfe('0x49')]);return _0x4b058d[_0x8dfe('0x52')](_0x50b1bb);}})[_0x8dfe('0x26')](function(_0x43a731){if(_0x43a731){_0xc5fc6c=_0x43a731[_0x8dfe('0x38')];if(!_0x2af9cb['query']['hasOwnProperty'](_0x8dfe('0x4f'))){_0x50b1bb[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x2af9cb[_0x8dfe('0x32')]['limit']);_0x50b1bb[_0x8dfe('0x1c')]=qs[_0x8dfe('0x1c')](_0x2af9cb['query'][_0x8dfe('0x1c')]);}return _0x4b058d[_0x8dfe('0x52')](_0x50b1bb);}})[_0x8dfe('0x26')](function(_0x1461f0){if(_0x1461f0){return _0x1461f0?{'count':_0xc5fc6c,'rows':_0x1461f0}:null;}})['then'](respondWithResult(_0x3277b7,null))[_0x8dfe('0x44')](handleError(_0x3277b7,null));};exports[_0x8dfe('0x53')]=function(_0x3b334d,_0x36f286,_0x408e46){var _0x47a081={};var _0x5f1bfd={};var _0x2879db;var _0x139430;return db[_0x8dfe('0x2d')]['findOne']({'where':{'id':_0x3b334d[_0x8dfe('0x45')]['id']}})[_0x8dfe('0x26')](handleEntityNotFound(_0x36f286,null))[_0x8dfe('0x26')](function(_0x352763){if(_0x352763){_0x2879db=_0x352763;_0x5f1bfd[_0x8dfe('0x35')]=_[_0x8dfe('0x47')](db[_0x8dfe('0x54')][_0x8dfe('0x46')]);_0x5f1bfd[_0x8dfe('0x32')]=_['keys'](_0x3b334d[_0x8dfe('0x32')]);_0x5f1bfd[_0x8dfe('0x33')]=_[_0x8dfe('0x34')](_0x5f1bfd[_0x8dfe('0x35')],_0x5f1bfd[_0x8dfe('0x32')]);_0x47a081['attributes']=_[_0x8dfe('0x34')](_0x5f1bfd[_0x8dfe('0x35')],qs[_0x8dfe('0x36')](_0x3b334d[_0x8dfe('0x32')]['fields']));_0x47a081[_0x8dfe('0x37')]=_0x47a081[_0x8dfe('0x37')]['length']?_0x47a081[_0x8dfe('0x37')]:_0x5f1bfd['model'];_0x47a081[_0x8dfe('0x3a')]=qs['sort'](_0x3b334d[_0x8dfe('0x32')]['sort']);_0x47a081['where']=qs[_0x8dfe('0x33')](_['pick'](_0x3b334d['query'],_0x5f1bfd[_0x8dfe('0x33')]));if(_0x3b334d[_0x8dfe('0x32')]['filter']){_0x47a081[_0x8dfe('0x3c')]=_['merge'](_0x47a081[_0x8dfe('0x3c')],{'$or':_['map'](_0x47a081[_0x8dfe('0x37')],function(_0x104212){var _0x117654={};_0x117654[_0x104212]={'$like':'%'+_0x3b334d[_0x8dfe('0x32')][_0x8dfe('0x3e')]+'%'};return _0x117654;})});}_0x47a081=_['merge']({},_0x47a081,_0x3b334d[_0x8dfe('0x49')]);return _0x2879db[_0x8dfe('0x53')](_0x47a081);}})[_0x8dfe('0x26')](function(_0x42c536){if(_0x42c536){_0x139430=_0x42c536[_0x8dfe('0x38')];if(!_0x3b334d['query'][_0x8dfe('0x39')](_0x8dfe('0x4f'))){_0x47a081[_0x8dfe('0x1f')]=qs[_0x8dfe('0x1f')](_0x3b334d[_0x8dfe('0x32')][_0x8dfe('0x1f')]);_0x47a081[_0x8dfe('0x1c')]=qs['offset'](_0x3b334d[_0x8dfe('0x32')][_0x8dfe('0x1c')]);}return _0x2879db['getTags'](_0x47a081);}})[_0x8dfe('0x26')](function(_0x42357f){if(_0x42357f){return _0x42357f?{'count':_0x139430,'rows':_0x42357f}:null;}})[_0x8dfe('0x26')](respondWithResult(_0x36f286,null))[_0x8dfe('0x44')](handleError(_0x36f286,null));};exports[_0x8dfe('0x55')]=function(_0x5e5835,_0x396a67,_0x180ba9){if(_0x5e5835['body']['id']){delete _0x5e5835[_0x8dfe('0x4c')]['id'];}return db[_0x8dfe('0x2d')]['findOne']({'where':{'id':_0x5e5835['params']['id']}})[_0x8dfe('0x26')](handleEntityNotFound(_0x396a67,null))[_0x8dfe('0x26')](function(_0x381633){if(_0x381633){return _0x381633[_0x8dfe('0x55')](_0x5e5835['body'][_0x8dfe('0x56')]||[]);}return null;})[_0x8dfe('0x26')](respondWithResult(_0x396a67,null))['catch'](handleError(_0x396a67,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 3d95b8e..3f982a6 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 _0x1bc6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger'];(function(_0x23f847,_0x48fa09){var _0x53ed96=function(_0x598c8d){while(--_0x598c8d){_0x23f847['push'](_0x23f847['shift']());}};_0x53ed96(++_0x48fa09);}(_0x1bc6,0xed));var _0x61bc=function(_0x44f548,_0x5d4dd5){_0x44f548=_0x44f548-0x0;var _0x48361c=_0x1bc6[_0x44f548];return _0x48361c;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var logger=require(_0x61bc('0x2'))('api');var moment=require(_0x61bc('0x3'));var BPromise=require(_0x61bc('0x4'));var rp=require(_0x61bc('0x5'));var fs=require('fs');var path=require(_0x61bc('0x6'));var rimraf=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var attributes=require(_0x61bc('0x9'));module['exports']=function(_0x167ab9,_0x516a9e){return _0x167ab9[_0x61bc('0xa')](_0x61bc('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33b4=['request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0x33b4,0x1c9));var _0x433b=function(_0x407147,_0x2b5b58){_0x407147=_0x407147-0x0;var _0x5e3a42=_0x33b4[_0x407147];return _0x5e3a42;};'use strict';var _=require(_0x433b('0x0'));var util=require(_0x433b('0x1'));var logger=require(_0x433b('0x2'))(_0x433b('0x3'));var moment=require('moment');var BPromise=require(_0x433b('0x4'));var rp=require(_0x433b('0x5'));var fs=require('fs');var path=require(_0x433b('0x6'));var rimraf=require(_0x433b('0x7'));var config=require(_0x433b('0x8'));var attributes=require(_0x433b('0x9'));module[_0x433b('0xa')]=function(_0x834ba8,_0x12b8b1){return _0x834ba8[_0x433b('0xb')](_0x433b('0xc'),attributes,{'tableName':_0x433b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 99e03bb..9bfcde9 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 _0x3155=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3cd087,_0x2d9784){var _0x126f65=function(_0x48b897){while(--_0x48b897){_0x3cd087['push'](_0x3cd087['shift']());}};_0x126f65(++_0x2d9784);}(_0x3155,0xa9));var _0x5315=function(_0x315002,_0x4ee032){_0x315002=_0x315002-0x0;var _0x54e480=_0x3155[_0x315002];return _0x54e480;};'use strict';var _=require('lodash');var util=require(_0x5315('0x0'));var moment=require('moment');var BPromise=require(_0x5315('0x1'));var rs=require(_0x5315('0x2'));var fs=require('fs');var Redis=require(_0x5315('0x3'));var db=require(_0x5315('0x4'))['db'];var utils=require(_0x5315('0x5'));var logger=require(_0x5315('0x6'))(_0x5315('0x7'));var config=require(_0x5315('0x8'));var jayson=require(_0x5315('0x9'));var client=jayson[_0x5315('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c7254,_0xd4d526,_0x4f2f37){return new BPromise(function(_0xf23158,_0x32d65d){return client[_0x5315('0xb')](_0x5c7254,_0x4f2f37)[_0x5315('0xc')](function(_0xdda331){logger[_0x5315('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4d526,_0x5315('0xe'));logger[_0x5315('0xf')](_0x5315('0x10'),_0xd4d526,'request\x20sent',JSON[_0x5315('0x11')](_0xdda331));if(_0xdda331['error']){if(_0xdda331[_0x5315('0x12')][_0x5315('0x13')]===0x1f4){logger['error'](_0x5315('0x14'),_0xd4d526,_0xdda331[_0x5315('0x12')][_0x5315('0x15')]);return _0x32d65d(_0xdda331[_0x5315('0x12')][_0x5315('0x15')]);}logger[_0x5315('0x12')](_0x5315('0x14'),_0xd4d526,_0xdda331[_0x5315('0x12')]['message']);return _0xf23158(_0xdda331[_0x5315('0x12')]['message']);}else{logger[_0x5315('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd4d526,_0x5315('0xe'));_0xf23158(_0xdda331[_0x5315('0x16')][_0x5315('0x15')]);}})[_0x5315('0x17')](function(_0x37f030){logger[_0x5315('0x12')](_0x5315('0x14'),_0xd4d526,_0x37f030);_0x32d65d(_0x37f030);});});} \ No newline at end of file +var _0xccba=['request','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http'];(function(_0x11ec62,_0x498017){var _0x2813c0=function(_0x9b32bb){while(--_0x9b32bb){_0x11ec62['push'](_0x11ec62['shift']());}};_0x2813c0(++_0x498017);}(_0xccba,0x19b));var _0xaccb=function(_0x1428d9,_0xded63c){_0x1428d9=_0x1428d9-0x0;var _0x438019=_0xccba[_0x1428d9];return _0x438019;};'use strict';var _=require('lodash');var util=require(_0xaccb('0x0'));var moment=require(_0xaccb('0x1'));var BPromise=require(_0xaccb('0x2'));var rs=require(_0xaccb('0x3'));var fs=require('fs');var Redis=require(_0xaccb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaccb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xaccb('0x6'));var client=jayson[_0xaccb('0x7')][_0xaccb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bf159,_0x486056,_0x256084){return new BPromise(function(_0x463675,_0x4dcb75){return client[_0xaccb('0x9')](_0x4bf159,_0x256084)['then'](function(_0x103f50){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x486056,_0xaccb('0xa'));logger[_0xaccb('0xb')](_0xaccb('0xc'),_0x486056,_0xaccb('0xa'),JSON[_0xaccb('0xd')](_0x103f50));if(_0x103f50[_0xaccb('0xe')]){if(_0x103f50['error'][_0xaccb('0xf')]===0x1f4){logger['error'](_0xaccb('0x10'),_0x486056,_0x103f50[_0xaccb('0xe')][_0xaccb('0x11')]);return _0x4dcb75(_0x103f50['error'][_0xaccb('0x11')]);}logger['error'](_0xaccb('0x10'),_0x486056,_0x103f50[_0xaccb('0xe')][_0xaccb('0x11')]);return _0x463675(_0x103f50['error'][_0xaccb('0x11')]);}else{logger[_0xaccb('0x12')](_0xaccb('0x10'),_0x486056,'request\x20sent');_0x463675(_0x103f50[_0xaccb('0x13')]['message']);}})[_0xaccb('0x14')](function(_0x14d53c){logger[_0xaccb('0xe')](_0xaccb('0x10'),_0x486056,_0x14d53c);_0x4dcb75(_0x14d53c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b73025e..fe83a52 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 _0xe933=['delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe933,0x1f0));var _0x3e93=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe933[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x3e93('0x0'));var path=require(_0x3e93('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e93('0x2'));var router=express['Router']();var fs_extra=require(_0x3e93('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e93('0x4'));var config=require(_0x3e93('0x5'));var controller=require(_0x3e93('0x6'));router[_0x3e93('0x7')]('/',auth[_0x3e93('0x8')](),controller['index']);router['get'](_0x3e93('0x9'),auth[_0x3e93('0x8')](),controller[_0x3e93('0xa')]);router['post']('/',auth[_0x3e93('0x8')](),controller[_0x3e93('0xb')]);router[_0x3e93('0xc')](_0x3e93('0x9'),auth[_0x3e93('0x8')](),controller[_0x3e93('0xd')]);router[_0x3e93('0xe')]('/:id',auth[_0x3e93('0x8')](),controller[_0x3e93('0xf')]);module[_0x3e93('0x10')]=router; \ No newline at end of file +var _0xfda0=['isAuthenticated','index','get','/:id','show','create','put','update','delete','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x5cb25b,_0x6b25c8){var _0x39088f=function(_0x143f20){while(--_0x143f20){_0x5cb25b['push'](_0x5cb25b['shift']());}};_0x39088f(++_0x6b25c8);}(_0xfda0,0xbe));var _0x0fda=function(_0x2e76bc,_0xcc942b){_0x2e76bc=_0x2e76bc-0x0;var _0x355e6a=_0xfda0[_0x2e76bc];return _0x355e6a;};'use strict';var multer=require(_0x0fda('0x0'));var util=require('util');var path=require(_0x0fda('0x1'));var timeout=require('connect-timeout');var express=require(_0x0fda('0x2'));var router=express['Router']();var fs_extra=require(_0x0fda('0x3'));var auth=require(_0x0fda('0x4'));var interaction=require(_0x0fda('0x5'));var config=require(_0x0fda('0x6'));var controller=require(_0x0fda('0x7'));router['get']('/',auth[_0x0fda('0x8')](),controller[_0x0fda('0x9')]);router[_0x0fda('0xa')](_0x0fda('0xb'),auth['isAuthenticated'](),controller[_0x0fda('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0fda('0xd')]);router[_0x0fda('0xe')](_0x0fda('0xb'),auth[_0x0fda('0x8')](),controller[_0x0fda('0xf')]);router[_0x0fda('0x10')](_0x0fda('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x0fda('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index acbf0e0..45afd8b 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 _0xb6e1=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3a964d,_0x305ccf){var _0x536907=function(_0x493e27){while(--_0x493e27){_0x3a964d['push'](_0x3a964d['shift']());}};_0x536907(++_0x305ccf);}(_0xb6e1,0xb0));var _0x1b6e=function(_0x313be9,_0x1de21d){_0x313be9=_0x313be9-0x0;var _0x2ebcd2=_0xb6e1[_0x313be9];return _0x2ebcd2;};'use strict';var Sequelize=require(_0x1b6e('0x0'));module[_0x1b6e('0x1')]={'type':{'type':Sequelize[_0x1b6e('0x2')](_0x1b6e('0x3'),_0x1b6e('0x4'),_0x1b6e('0x5'),_0x1b6e('0x6'),_0x1b6e('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1b6e('0x8')]},'key':{'type':Sequelize[_0x1b6e('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x1b6e('0x3'),_0x1b6e('0x4'),_0x1b6e('0x5'))},'keyContent':{'type':Sequelize[_0x1b6e('0x8')]},'idField':{'type':Sequelize[_0x1b6e('0x8')]},'nameField':{'type':Sequelize[_0x1b6e('0x8')]},'customField':{'type':Sequelize[_0x1b6e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b6e('0x8')]}}; \ No newline at end of file +var _0x5ac7=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x39fd42,_0x114114){var _0x4bb81b=function(_0xc7835c){while(--_0xc7835c){_0x39fd42['push'](_0x39fd42['shift']());}};_0x4bb81b(++_0x114114);}(_0x5ac7,0x1ee));var _0x75ac=function(_0xab5c15,_0x1a4e9e){_0xab5c15=_0xab5c15-0x0;var _0x3886ad=_0x5ac7[_0xab5c15];return _0x3886ad;};'use strict';var Sequelize=require(_0x75ac('0x0'));module[_0x75ac('0x1')]={'type':{'type':Sequelize[_0x75ac('0x2')](_0x75ac('0x3'),_0x75ac('0x4'),_0x75ac('0x5'),_0x75ac('0x6'),_0x75ac('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x75ac('0x2')]('string',_0x75ac('0x4'),_0x75ac('0x5'))},'keyContent':{'type':Sequelize[_0x75ac('0x8')]},'idField':{'type':Sequelize[_0x75ac('0x8')]},'nameField':{'type':Sequelize[_0x75ac('0x8')]},'customField':{'type':Sequelize[_0x75ac('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 45415a1..6ee21a0 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 _0x6b24=['rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','options','includeAll','findAll','rows','catch','include','merge','find','create','body','destroy','params','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','FreshdeskField'];(function(_0x1e80ae,_0x3b5129){var _0x369354=function(_0x41141a){while(--_0x41141a){_0x1e80ae['push'](_0x1e80ae['shift']());}};_0x369354(++_0x3b5129);}(_0x6b24,0x1ce));var _0x46b2=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x6b24[_0x1abeb2];return _0x48da20;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b2('0x0'));var zipdir=require(_0x46b2('0x1'));var jsonpatch=require(_0x46b2('0x2'));var rp=require(_0x46b2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46b2('0x4'));var path=require('path');var sox=require(_0x46b2('0x5'));var csv=require('to-csv');var ejs=require(_0x46b2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x46b2('0x7'));var crypto=require(_0x46b2('0x8'));var jsforce=require(_0x46b2('0x9'));var deskjs=require(_0x46b2('0xa'));var toCsv=require(_0x46b2('0xb'));var querystring=require(_0x46b2('0xc'));var Papa=require(_0x46b2('0xd'));var Redis=require(_0x46b2('0xe'));var authService=require(_0x46b2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46b2('0x10'));var logger=require(_0x46b2('0x11'))(_0x46b2('0x12'));var utils=require('../../config/utils');var config=require(_0x46b2('0x13'));var licenseUtil=require(_0x46b2('0x14'));var db=require(_0x46b2('0x15'))['db'];function respondWithStatusCode(_0x5343fc,_0x468ae9){_0x468ae9=_0x468ae9||0xcc;return function(_0x886e41){if(_0x886e41){return _0x5343fc[_0x46b2('0x16')](_0x468ae9);}return _0x5343fc[_0x46b2('0x17')](_0x468ae9)[_0x46b2('0x18')]();};}function respondWithResult(_0x1cf0f0,_0x3ff25d){_0x3ff25d=_0x3ff25d||0xc8;return function(_0x228261){if(_0x228261){return _0x1cf0f0[_0x46b2('0x17')](_0x3ff25d)[_0x46b2('0x19')](_0x228261);}};}function respondWithFilteredResult(_0x563b05,_0x43e0d9){return function(_0x5b49da){if(_0x5b49da){var _0x49479c=typeof _0x43e0d9[_0x46b2('0x1a')]===_0x46b2('0x1b')&&typeof _0x43e0d9[_0x46b2('0x1c')]===_0x46b2('0x1b');var _0x373c49=_0x5b49da[_0x46b2('0x1d')];var _0x226ab5=_0x49479c?0x0:_0x43e0d9['offset'];var _0x316c39=_0x49479c?_0x5b49da['count']:_0x43e0d9[_0x46b2('0x1a')]+_0x43e0d9[_0x46b2('0x1c')];var _0x9b4723;if(_0x316c39>=_0x373c49){_0x316c39=_0x373c49;_0x9b4723=0xc8;}else{_0x9b4723=0xce;}_0x563b05['status'](_0x9b4723);return _0x563b05[_0x46b2('0x1e')](_0x46b2('0x1f'),_0x226ab5+'-'+_0x316c39+'/'+_0x373c49)[_0x46b2('0x19')](_0x5b49da);}return null;};}function patchUpdates(_0x1e5c35){return function(_0x350f85){try{jsonpatch[_0x46b2('0x20')](_0x350f85,_0x1e5c35,!![]);}catch(_0x3a0ea5){return BPromise[_0x46b2('0x21')](_0x3a0ea5);}return _0x350f85[_0x46b2('0x22')]();};}function saveUpdates(_0x259f2f,_0x29ade9){return function(_0x1b5fbe){if(_0x1b5fbe){return _0x1b5fbe[_0x46b2('0x23')](_0x259f2f)[_0x46b2('0x24')](function(_0x1caa77){return _0x1caa77;});}return null;};}function removeEntity(_0x50011b,_0x209519){return function(_0x4c2983){if(_0x4c2983){return _0x4c2983['destroy']()[_0x46b2('0x24')](function(){_0x50011b[_0x46b2('0x17')](0xcc)[_0x46b2('0x18')]();});}};}function handleEntityNotFound(_0x134526,_0x16f646){return function(_0x58069e){if(!_0x58069e){_0x134526[_0x46b2('0x16')](0x194);}return _0x58069e;};}function handleError(_0x138f6c,_0x5ca1c7){_0x5ca1c7=_0x5ca1c7||0x1f4;return function(_0x3c5997){logger['error'](_0x3c5997[_0x46b2('0x25')]);if(_0x3c5997[_0x46b2('0x26')]){delete _0x3c5997[_0x46b2('0x26')];}_0x138f6c[_0x46b2('0x17')](_0x5ca1c7)[_0x46b2('0x27')](_0x3c5997);};}exports[_0x46b2('0x28')]=function(_0x74615,_0x1a6caf){var _0x429496={},_0x20ccb2={},_0x5421d9={'count':0x0,'rows':[]};var _0x4e2a9b=_['map'](db[_0x46b2('0x29')][_0x46b2('0x2a')],function(_0x2a2f8d){return{'name':_0x2a2f8d['fieldName'],'type':_0x2a2f8d[_0x46b2('0x2b')][_0x46b2('0x2c')]};});_0x20ccb2['model']=_[_0x46b2('0x2d')](_0x4e2a9b,_0x46b2('0x26'));_0x20ccb2[_0x46b2('0x2e')]=_[_0x46b2('0x2f')](_0x74615[_0x46b2('0x2e')]);_0x20ccb2[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],_0x20ccb2[_0x46b2('0x2e')]);_0x429496['attributes']=_[_0x46b2('0x31')](_0x20ccb2[_0x46b2('0x32')],qs[_0x46b2('0x33')](_0x74615['query'][_0x46b2('0x33')]));_0x429496[_0x46b2('0x34')]=_0x429496[_0x46b2('0x34')][_0x46b2('0x35')]?_0x429496['attributes']:_0x20ccb2[_0x46b2('0x32')];if(!_0x74615['query'][_0x46b2('0x36')](_0x46b2('0x37'))){_0x429496[_0x46b2('0x1c')]=qs[_0x46b2('0x1c')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1c')]);_0x429496[_0x46b2('0x1a')]=qs['offset'](_0x74615[_0x46b2('0x2e')][_0x46b2('0x1a')]);}_0x429496[_0x46b2('0x38')]=qs[_0x46b2('0x39')](_0x74615[_0x46b2('0x2e')][_0x46b2('0x39')]);_0x429496[_0x46b2('0x3a')]=qs['filters'](_['pick'](_0x74615['query'],_0x20ccb2[_0x46b2('0x30')]),_0x4e2a9b);if(_0x74615[_0x46b2('0x2e')]['filter']){_0x429496[_0x46b2('0x3a')]=_['merge'](_0x429496['where'],{'$or':_[_0x46b2('0x2d')](_0x4e2a9b,function(_0x1716a3){if(_0x1716a3[_0x46b2('0x2b')]!==_0x46b2('0x3b')){var _0x4dcd03={};_0x4dcd03[_0x1716a3[_0x46b2('0x26')]]={'$like':'%'+_0x74615['query']['filter']+'%'};return _0x4dcd03;}})});}_0x429496=_['merge']({},_0x429496,_0x74615[_0x46b2('0x3c')]);var _0x1599fa={'where':_0x429496[_0x46b2('0x3a')]};return db['FreshdeskField'][_0x46b2('0x1d')](_0x1599fa)['then'](function(_0x30afdb){_0x5421d9[_0x46b2('0x1d')]=_0x30afdb;if(_0x74615['query'][_0x46b2('0x3d')]){_0x429496['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x46b2('0x3e')](_0x429496);})['then'](function(_0x22c896){_0x5421d9[_0x46b2('0x3f')]=_0x22c896;return _0x5421d9;})[_0x46b2('0x24')](respondWithFilteredResult(_0x1a6caf,_0x429496))[_0x46b2('0x40')](handleError(_0x1a6caf,null));};exports['show']=function(_0x15451a,_0x13343e){var _0x205027={'raw':!![],'where':{'id':_0x15451a['params']['id']}},_0x4fdfeb={};_0x4fdfeb[_0x46b2('0x32')]=_[_0x46b2('0x2f')](db[_0x46b2('0x29')][_0x46b2('0x2a')]);_0x4fdfeb['query']=_['keys'](_0x15451a[_0x46b2('0x2e')]);_0x4fdfeb[_0x46b2('0x30')]=_[_0x46b2('0x31')](_0x4fdfeb[_0x46b2('0x32')],_0x4fdfeb[_0x46b2('0x2e')]);_0x205027[_0x46b2('0x34')]=_['intersection'](_0x4fdfeb['model'],qs[_0x46b2('0x33')](_0x15451a[_0x46b2('0x2e')][_0x46b2('0x33')]));_0x205027[_0x46b2('0x34')]=_0x205027['attributes'][_0x46b2('0x35')]?_0x205027[_0x46b2('0x34')]:_0x4fdfeb[_0x46b2('0x32')];if(_0x15451a[_0x46b2('0x2e')]['includeAll']){_0x205027[_0x46b2('0x41')]=[{'all':!![]}];}_0x205027=_[_0x46b2('0x42')]({},_0x205027,_0x15451a[_0x46b2('0x3c')]);return db[_0x46b2('0x29')][_0x46b2('0x43')](_0x205027)[_0x46b2('0x24')](handleEntityNotFound(_0x13343e,null))[_0x46b2('0x24')](respondWithResult(_0x13343e,null))['catch'](handleError(_0x13343e,null));};exports[_0x46b2('0x44')]=function(_0x14cdc9,_0x55c0aa){return db[_0x46b2('0x29')]['create'](_0x14cdc9[_0x46b2('0x45')],{})['then'](respondWithResult(_0x55c0aa,0xc9))[_0x46b2('0x40')](handleError(_0x55c0aa,null));};exports[_0x46b2('0x23')]=function(_0x4f8bd6,_0x301c64){if(_0x4f8bd6[_0x46b2('0x45')]['id']){delete _0x4f8bd6['body']['id'];}return db['FreshdeskField'][_0x46b2('0x43')]({'where':{'id':_0x4f8bd6['params']['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x301c64,null))['then'](saveUpdates(_0x4f8bd6[_0x46b2('0x45')],null))[_0x46b2('0x24')](respondWithResult(_0x301c64,null))[_0x46b2('0x40')](handleError(_0x301c64,null));};exports[_0x46b2('0x46')]=function(_0x27a9cf,_0x251c28){return db[_0x46b2('0x29')][_0x46b2('0x43')]({'where':{'id':_0x27a9cf[_0x46b2('0x47')]['id']}})[_0x46b2('0x24')](handleEntityNotFound(_0x251c28,null))[_0x46b2('0x24')](removeEntity(_0x251c28,null))[_0x46b2('0x40')](handleError(_0x251c28,null));}; \ No newline at end of file +var _0x4ded=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','stack','name','index','FreshdeskField','rawAttributes','key','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x35e78e,_0x3ba637){var _0x2d631e=function(_0x2fac9e){while(--_0x2fac9e){_0x35e78e['push'](_0x35e78e['shift']());}};_0x2d631e(++_0x3ba637);}(_0x4ded,0x116));var _0xd4de=function(_0x4289d2,_0x49d2e9){_0x4289d2=_0x4289d2-0x0;var _0x37f65f=_0x4ded[_0x4289d2];return _0x37f65f;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)[_0xd4de('0x1a')]();});}};}function handleEntityNotFound(_0x984904,_0xffe1cc){return function(_0x36308c){if(!_0x36308c){_0x984904[_0xd4de('0x18')](0x194);}return _0x36308c;};}function handleError(_0x260c5c,_0x2ea712){_0x2ea712=_0x2ea712||0x1f4;return function(_0xb2d8a1){logger['error'](_0xb2d8a1[_0xd4de('0x26')]);if(_0xb2d8a1[_0xd4de('0x27')]){delete _0xb2d8a1['name'];}_0x260c5c[_0xd4de('0x19')](_0x2ea712)['send'](_0xb2d8a1);};}exports[_0xd4de('0x28')]=function(_0x32e407,_0x15d2b7){var _0x4fa53a={},_0xd4de93={},_0x36f2f1={'count':0x0,'rows':[]};var _0x17f0a=_['map'](db[_0xd4de('0x29')][_0xd4de('0x2a')],function(_0x55f9f9){return{'name':_0x55f9f9['fieldName'],'type':_0x55f9f9['type'][_0xd4de('0x2b')]};});_0xd4de93['model']=_[_0xd4de('0x2c')](_0x17f0a,_0xd4de('0x27'));_0xd4de93[_0xd4de('0x2d')]=_[_0xd4de('0x2e')](_0x32e407['query']);_0xd4de93[_0xd4de('0x2f')]=_[_0xd4de('0x30')](_0xd4de93['model'],_0xd4de93[_0xd4de('0x2d')]);_0x4fa53a[_0xd4de('0x31')]=_['intersection'](_0xd4de93['model'],qs[_0xd4de('0x32')](_0x32e407[_0xd4de('0x2d')][_0xd4de('0x32')]));_0x4fa53a[_0xd4de('0x31')]=_0x4fa53a['attributes'][_0xd4de('0x33')]?_0x4fa53a[_0xd4de('0x31')]:_0xd4de93['model'];if(!_0x32e407[_0xd4de('0x2d')][_0xd4de('0x34')](_0xd4de('0x35'))){_0x4fa53a[_0xd4de('0x1c')]=qs[_0xd4de('0x1c')](_0x32e407[_0xd4de('0x2d')]['limit']);_0x4fa53a['offset']=qs[_0xd4de('0x1f')](_0x32e407[_0xd4de('0x2d')][_0xd4de('0x1f')]);}_0x4fa53a['order']=qs[_0xd4de('0x36')](_0x32e407[_0xd4de('0x2d')]['sort']);_0x4fa53a[_0xd4de('0x37')]=qs[_0xd4de('0x2f')](_[_0xd4de('0x38')](_0x32e407[_0xd4de('0x2d')],_0xd4de93['filters']),_0x17f0a);if(_0x32e407['query'][_0xd4de('0x39')]){_0x4fa53a['where']=_[_0xd4de('0x3a')](_0x4fa53a['where'],{'$or':_[_0xd4de('0x2c')](_0x17f0a,function(_0xcc1d7){if(_0xcc1d7[_0xd4de('0x3b')]!==_0xd4de('0x3c')){var _0x4e6843={};_0x4e6843[_0xcc1d7[_0xd4de('0x27')]]={'$like':'%'+_0x32e407['query'][_0xd4de('0x39')]+'%'};return _0x4e6843;}})});}_0x4fa53a=_[_0xd4de('0x3a')]({},_0x4fa53a,_0x32e407[_0xd4de('0x3d')]);var _0x4517a6={'where':_0x4fa53a[_0xd4de('0x37')]};return db[_0xd4de('0x29')][_0xd4de('0x1e')](_0x4517a6)['then'](function(_0x2333f6){_0x36f2f1[_0xd4de('0x1e')]=_0x2333f6;if(_0x32e407[_0xd4de('0x2d')][_0xd4de('0x3e')]){_0x4fa53a[_0xd4de('0x3f')]=[{'all':!![]}];}return db['FreshdeskField'][_0xd4de('0x40')](_0x4fa53a);})[_0xd4de('0x24')](function(_0x2294e2){_0x36f2f1['rows']=_0x2294e2;return _0x36f2f1;})[_0xd4de('0x24')](respondWithFilteredResult(_0x15d2b7,_0x4fa53a))[_0xd4de('0x41')](handleError(_0x15d2b7,null));};exports[_0xd4de('0x42')]=function(_0x516542,_0x3b9026){var _0x10a42c={'raw':!![],'where':{'id':_0x516542[_0xd4de('0x43')]['id']}},_0x419c49={};_0x419c49[_0xd4de('0x44')]=_[_0xd4de('0x2e')](db[_0xd4de('0x29')]['rawAttributes']);_0x419c49[_0xd4de('0x2d')]=_[_0xd4de('0x2e')](_0x516542[_0xd4de('0x2d')]);_0x419c49['filters']=_[_0xd4de('0x30')](_0x419c49[_0xd4de('0x44')],_0x419c49[_0xd4de('0x2d')]);_0x10a42c['attributes']=_['intersection'](_0x419c49[_0xd4de('0x44')],qs[_0xd4de('0x32')](_0x516542['query'][_0xd4de('0x32')]));_0x10a42c[_0xd4de('0x31')]=_0x10a42c[_0xd4de('0x31')][_0xd4de('0x33')]?_0x10a42c['attributes']:_0x419c49[_0xd4de('0x44')];if(_0x516542[_0xd4de('0x2d')][_0xd4de('0x3e')]){_0x10a42c[_0xd4de('0x3f')]=[{'all':!![]}];}_0x10a42c=_[_0xd4de('0x3a')]({},_0x10a42c,_0x516542[_0xd4de('0x3d')]);return db['FreshdeskField'][_0xd4de('0x45')](_0x10a42c)[_0xd4de('0x24')](handleEntityNotFound(_0x3b9026,null))[_0xd4de('0x24')](respondWithResult(_0x3b9026,null))[_0xd4de('0x41')](handleError(_0x3b9026,null));};exports[_0xd4de('0x46')]=function(_0x1a2bc3,_0x40bf55){return db[_0xd4de('0x29')][_0xd4de('0x46')](_0x1a2bc3[_0xd4de('0x47')],{})['then'](respondWithResult(_0x40bf55,0xc9))[_0xd4de('0x41')](handleError(_0x40bf55,null));};exports[_0xd4de('0x23')]=function(_0x178daf,_0x518bfe){if(_0x178daf[_0xd4de('0x47')]['id']){delete _0x178daf[_0xd4de('0x47')]['id'];}return db[_0xd4de('0x29')][_0xd4de('0x45')]({'where':{'id':_0x178daf[_0xd4de('0x43')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x518bfe,null))[_0xd4de('0x24')](saveUpdates(_0x178daf[_0xd4de('0x47')],null))[_0xd4de('0x24')](respondWithResult(_0x518bfe,null))[_0xd4de('0x41')](handleError(_0x518bfe,null));};exports['destroy']=function(_0x3e4c7f,_0x26d032){return db[_0xd4de('0x29')][_0xd4de('0x45')]({'where':{'id':_0x3e4c7f[_0xd4de('0x43')]['id']}})['then'](handleEntityNotFound(_0x26d032,null))['then'](removeEntity(_0x26d032,null))[_0xd4de('0x41')](handleError(_0x26d032,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 98d8b32..2496b6e 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 _0x9dbc=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1790bf,_0x53ee06){var _0x36e244=function(_0x3d37a0){while(--_0x3d37a0){_0x1790bf['push'](_0x1790bf['shift']());}};_0x36e244(++_0x53ee06);}(_0x9dbc,0x15e));var _0xc9db=function(_0x589fee,_0x358efb){_0x589fee=_0x589fee-0x0;var _0x2f8f27=_0x9dbc[_0x589fee];return _0x2f8f27;};'use strict';var _=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var logger=require('../../config/logger')(_0xc9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9db('0x3'));var fs=require('fs');var path=require(_0xc9db('0x4'));var rimraf=require(_0xc9db('0x5'));var config=require(_0xc9db('0x6'));var attributes=require(_0xc9db('0x7'));module[_0xc9db('0x8')]=function(_0x29087b,_0x5ac03e){return _0x29087b[_0xc9db('0x9')](_0xc9db('0xa'),attributes,{'tableName':_0xc9db('0xb'),'paranoid':![],'indexes':[{'name':_0xc9db('0xc'),'fields':['idField',_0xc9db('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ba9=['freshdesk_unique_index','FieldId','util','../../config/logger','moment','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields'];(function(_0x42833d,_0x483e8e){var _0x8ea6d4=function(_0x376f46){while(--_0x376f46){_0x42833d['push'](_0x42833d['shift']());}};_0x8ea6d4(++_0x483e8e);}(_0x9ba9,0xb2));var _0x99ba=function(_0x36edf8,_0x88cd18){_0x36edf8=_0x36edf8-0x0;var _0x5e1681=_0x9ba9[_0x36edf8];return _0x5e1681;};'use strict';var _=require('lodash');var util=require(_0x99ba('0x0'));var logger=require(_0x99ba('0x1'))('api');var moment=require(_0x99ba('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99ba('0x3'));var rimraf=require(_0x99ba('0x4'));var config=require('../../config/environment');var attributes=require(_0x99ba('0x5'));module['exports']=function(_0x42c538,_0x323f0c){return _0x42c538[_0x99ba('0x6')](_0x99ba('0x7'),attributes,{'tableName':_0x99ba('0x8'),'paranoid':![],'indexes':[{'name':_0x99ba('0x9'),'fields':['idField',_0x99ba('0xa')],'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 fc91bbb..24d04bd 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 _0x2d52=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0x2d52,0xdd));var _0x22d5=function(_0x39fff0,_0x259d98){_0x39fff0=_0x39fff0-0x0;var _0x547163=_0x2d52[_0x39fff0];return _0x547163;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var moment=require(_0x22d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d5('0x3'));var db=require(_0x22d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22d5('0x5'))(_0x22d5('0x6'));var config=require(_0x22d5('0x7'));var jayson=require(_0x22d5('0x8'));var client=jayson[_0x22d5('0x9')][_0x22d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46d8be,_0x56c7e2,_0x49aaab){return new BPromise(function(_0x119ac2,_0x4e3b59){return client['request'](_0x46d8be,_0x49aaab)[_0x22d5('0xb')](function(_0x28b1f5){logger['info'](_0x22d5('0xc'),_0x56c7e2,_0x22d5('0xd'));logger[_0x22d5('0xe')](_0x22d5('0xf'),_0x56c7e2,_0x22d5('0xd'),JSON[_0x22d5('0x10')](_0x28b1f5));if(_0x28b1f5[_0x22d5('0x11')]){if(_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x12')]===0x1f4){logger['error'](_0x22d5('0xc'),_0x56c7e2,_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);return _0x4e3b59(_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);}logger[_0x22d5('0x11')](_0x22d5('0xc'),_0x56c7e2,_0x28b1f5[_0x22d5('0x11')][_0x22d5('0x13')]);return _0x119ac2(_0x28b1f5[_0x22d5('0x11')]['message']);}else{logger['info'](_0x22d5('0xc'),_0x56c7e2,_0x22d5('0xd'));_0x119ac2(_0x28b1f5[_0x22d5('0x14')][_0x22d5('0x13')]);}})[_0x22d5('0x15')](function(_0x26b004){logger['error'](_0x22d5('0xc'),_0x56c7e2,_0x26b004);_0x4e3b59(_0x26b004);});});} \ No newline at end of file +var _0x7d5a=['request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x37259f,_0xde5a8f){var _0x5c99d=function(_0x230b00){while(--_0x230b00){_0x37259f['push'](_0x37259f['shift']());}};_0x5c99d(++_0xde5a8f);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x562773,_0x512f2d){_0x562773=_0x562773-0x0;var _0x2aac19=_0x7d5a[_0x562773];return _0x2aac19;};'use strict';var _=require(_0xa7d5('0x0'));var util=require(_0xa7d5('0x1'));var moment=require(_0xa7d5('0x2'));var BPromise=require(_0xa7d5('0x3'));var rs=require(_0xa7d5('0x4'));var fs=require('fs');var Redis=require(_0xa7d5('0x5'));var db=require(_0xa7d5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa7d5('0x7'));var config=require(_0xa7d5('0x8'));var jayson=require(_0xa7d5('0x9'));var client=jayson[_0xa7d5('0xa')][_0xa7d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x80431a,_0x5a8f8a,_0x21ccfa){return new BPromise(function(_0xb5bcd2,_0x2c2c25){return client[_0xa7d5('0xc')](_0x80431a,_0x21ccfa)[_0xa7d5('0xd')](function(_0xf40c67){logger[_0xa7d5('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x5a8f8a,_0xa7d5('0xf'));logger[_0xa7d5('0x10')](_0xa7d5('0x11'),_0x5a8f8a,'request\x20sent',JSON[_0xa7d5('0x12')](_0xf40c67));if(_0xf40c67[_0xa7d5('0x13')]){if(_0xf40c67[_0xa7d5('0x13')]['code']===0x1f4){logger[_0xa7d5('0x13')](_0xa7d5('0x14'),_0x5a8f8a,_0xf40c67[_0xa7d5('0x13')][_0xa7d5('0x15')]);return _0x2c2c25(_0xf40c67[_0xa7d5('0x13')]['message']);}logger[_0xa7d5('0x13')](_0xa7d5('0x14'),_0x5a8f8a,_0xf40c67[_0xa7d5('0x13')][_0xa7d5('0x15')]);return _0xb5bcd2(_0xf40c67[_0xa7d5('0x13')]['message']);}else{logger[_0xa7d5('0xe')](_0xa7d5('0x14'),_0x5a8f8a,_0xa7d5('0xf'));_0xb5bcd2(_0xf40c67['result']['message']);}})[_0xa7d5('0x16')](function(_0x53d884){logger[_0xa7d5('0x13')](_0xa7d5('0x14'),_0x5a8f8a,_0x53d884);_0x2c2c25(_0x53d884);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 32626d8..e410d57 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 _0x1be1=['getFields','post','create','addConfiguration','/:id','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0xfeb52e,_0x505b63){var _0x541770=function(_0x4ac61a){while(--_0x4ac61a){_0xfeb52e['push'](_0xfeb52e['shift']());}};_0x541770(++_0x505b63);}(_0x1be1,0x192));var _0x11be=function(_0x24b10f,_0x3ec7e3){_0x24b10f=_0x24b10f-0x0;var _0x2ca927=_0x1be1[_0x24b10f];return _0x2ca927;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['getConfigurations']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);router['post'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xf')]);router['put'](_0x11be('0x10'),auth[_0x11be('0x8')](),controller['update']);router[_0x11be('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2b729a,_0x21945a){_0x2b729a=_0x2b729a-0x0;var _0x4a398d=_0xf7b4[_0x2b729a];return _0x4a398d;};'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('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index b8e93f7..65e004a 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 _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc2c7,0x134));var _0x7c2c=function(_0x441d68,_0x5639e6){_0x441d68=_0x441d68-0x0;var _0x5489e0=_0xc2c7[_0x441d68];return _0x5489e0;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2542=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x2542,0x169));var _0x2254=function(_0xc92907,_0x639f9e){_0xc92907=_0xc92907-0x0;var _0x4e6f9b=_0x2542[_0xc92907];return _0x4e6f9b;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')]},'description':{'type':Sequelize[_0x2254('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2254('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('0x4')},'serverUrl':{'type':Sequelize[_0x2254('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 77c1eeb..1194053 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 _0x4dbd=['path','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','undefined','count','offset','set','apply','reject','save','update','then','end','sendStatus','name','send','index','FreshsalesAccount','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','type','filter','options','includeAll','include','findAll','rows','rawAttributes','find','create','body','catch','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesField','getFields','remoteUri','apiKey','username','slice','substring','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x54cf2a,_0x2556f2){var _0x4996f4=function(_0x179894){while(--_0x179894){_0x54cf2a['push'](_0x54cf2a['shift']());}};_0x4996f4(++_0x2556f2);}(_0x4dbd,0x165));var _0xd4db=function(_0x340d52,_0x430452){_0x340d52=_0x340d52-0x0;var _0x440752=_0x4dbd[_0x340d52];return _0x440752;};'use strict';var emlformat=require(_0xd4db('0x0'));var rimraf=require(_0xd4db('0x1'));var zipdir=require(_0xd4db('0x2'));var jsonpatch=require(_0xd4db('0x3'));var rp=require('request-promise');var moment=require(_0xd4db('0x4'));var BPromise=require(_0xd4db('0x5'));var Mustache=require('mustache');var util=require(_0xd4db('0x6'));var path=require(_0xd4db('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('lodash');var squel=require('squel');var crypto=require(_0xd4db('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd4db('0x9'));var Redis=require(_0xd4db('0xa'));var authService=require('../../components/auth/service');var qs=require(_0xd4db('0xb'));var as=require(_0xd4db('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4db('0xd'))(_0xd4db('0xe'));var utils=require('../../config/utils');var config=require(_0xd4db('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4db('0x10'))['db'];var integrations=require(_0xd4db('0x11'));function respondWithStatusCode(_0x34657e,_0x553097){_0x553097=_0x553097||0xcc;return function(_0x1a3be0){if(_0x1a3be0){return _0x34657e['sendStatus'](_0x553097);}return _0x34657e[_0xd4db('0x12')](_0x553097)['end']();};}function respondWithResult(_0x165e82,_0x6410d9){_0x6410d9=_0x6410d9||0xc8;return function(_0x51695f){if(_0x51695f){return _0x165e82[_0xd4db('0x12')](_0x6410d9)[_0xd4db('0x13')](_0x51695f);}};}function respondWithFilteredResult(_0x1efb1d,_0x3da1fd){return function(_0x5f3f65){if(_0x5f3f65){var _0x3275d6=typeof _0x3da1fd['offset']===_0xd4db('0x14')&&typeof _0x3da1fd['limit']===_0xd4db('0x14');var _0x2a724a=_0x5f3f65[_0xd4db('0x15')];var _0x568901=_0x3275d6?0x0:_0x3da1fd[_0xd4db('0x16')];var _0x17b16b=_0x3275d6?_0x5f3f65[_0xd4db('0x15')]:_0x3da1fd[_0xd4db('0x16')]+_0x3da1fd['limit'];var _0x22d7a8;if(_0x17b16b>=_0x2a724a){_0x17b16b=_0x2a724a;_0x22d7a8=0xc8;}else{_0x22d7a8=0xce;}_0x1efb1d[_0xd4db('0x12')](_0x22d7a8);return _0x1efb1d[_0xd4db('0x17')]('Content-Range',_0x568901+'-'+_0x17b16b+'/'+_0x2a724a)[_0xd4db('0x13')](_0x5f3f65);}return null;};}function patchUpdates(_0x25b4c3){return function(_0x10451e){try{jsonpatch[_0xd4db('0x18')](_0x10451e,_0x25b4c3,!![]);}catch(_0x17f821){return BPromise[_0xd4db('0x19')](_0x17f821);}return _0x10451e[_0xd4db('0x1a')]();};}function saveUpdates(_0x4c0535,_0x16d94c){return function(_0x5bb867){if(_0x5bb867){return _0x5bb867[_0xd4db('0x1b')](_0x4c0535)[_0xd4db('0x1c')](function(_0x389522){return _0x389522;});}return null;};}function removeEntity(_0x2c203a,_0x327afd){return function(_0x42ed94){if(_0x42ed94){return _0x42ed94['destroy']()[_0xd4db('0x1c')](function(){_0x2c203a[_0xd4db('0x12')](0xcc)[_0xd4db('0x1d')]();});}};}function handleEntityNotFound(_0xbb4816,_0x3a3866){return function(_0xe20add){if(!_0xe20add){_0xbb4816[_0xd4db('0x1e')](0x194);}return _0xe20add;};}function handleError(_0x18ebd7,_0xf58772){_0xf58772=_0xf58772||0x1f4;return function(_0x637a45){logger['error'](_0x637a45['stack']);if(_0x637a45[_0xd4db('0x1f')]){delete _0x637a45[_0xd4db('0x1f')];}_0x18ebd7[_0xd4db('0x12')](_0xf58772)[_0xd4db('0x20')](_0x637a45);};}exports[_0xd4db('0x21')]=function(_0x40ca2e,_0x2b0cca){var _0x608d59={},_0x504971={},_0x1e20e5={'count':0x0,'rows':[]};var _0x5b16e8=_['map'](db[_0xd4db('0x22')]['rawAttributes'],function(_0x58f4d2){return{'name':_0x58f4d2['fieldName'],'type':_0x58f4d2['type']['key']};});_0x504971[_0xd4db('0x23')]=_['map'](_0x5b16e8,_0xd4db('0x1f'));_0x504971[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x40ca2e[_0xd4db('0x24')]);_0x504971[_0xd4db('0x26')]=_[_0xd4db('0x27')](_0x504971[_0xd4db('0x23')],_0x504971[_0xd4db('0x24')]);_0x608d59[_0xd4db('0x28')]=_[_0xd4db('0x27')](_0x504971[_0xd4db('0x23')],qs['fields'](_0x40ca2e['query'][_0xd4db('0x29')]));_0x608d59[_0xd4db('0x28')]=_0x608d59[_0xd4db('0x28')][_0xd4db('0x2a')]?_0x608d59[_0xd4db('0x28')]:_0x504971[_0xd4db('0x23')];if(!_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2b')](_0xd4db('0x2c'))){_0x608d59[_0xd4db('0x2d')]=qs['limit'](_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2d')]);_0x608d59['offset']=qs[_0xd4db('0x16')](_0x40ca2e['query'][_0xd4db('0x16')]);}_0x608d59[_0xd4db('0x2e')]=qs[_0xd4db('0x2f')](_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x2f')]);_0x608d59[_0xd4db('0x30')]=qs[_0xd4db('0x26')](_[_0xd4db('0x31')](_0x40ca2e[_0xd4db('0x24')],_0x504971['filters']),_0x5b16e8);if(_0x40ca2e[_0xd4db('0x24')]['filter']){_0x608d59[_0xd4db('0x30')]=_[_0xd4db('0x32')](_0x608d59[_0xd4db('0x30')],{'$or':_[_0xd4db('0x33')](_0x5b16e8,function(_0x4f11d0){if(_0x4f11d0[_0xd4db('0x34')]!=='VIRTUAL'){var _0x3af333={};_0x3af333[_0x4f11d0[_0xd4db('0x1f')]]={'$like':'%'+_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x35')]+'%'};return _0x3af333;}})});}_0x608d59=_[_0xd4db('0x32')]({},_0x608d59,_0x40ca2e[_0xd4db('0x36')]);var _0x233e37={'where':_0x608d59['where']};return db[_0xd4db('0x22')][_0xd4db('0x15')](_0x233e37)[_0xd4db('0x1c')](function(_0x1ac01e){_0x1e20e5[_0xd4db('0x15')]=_0x1ac01e;if(_0x40ca2e[_0xd4db('0x24')][_0xd4db('0x37')]){_0x608d59[_0xd4db('0x38')]=[{'all':!![]}];}return db[_0xd4db('0x22')][_0xd4db('0x39')](_0x608d59);})[_0xd4db('0x1c')](function(_0x2b71c2){_0x1e20e5[_0xd4db('0x3a')]=_0x2b71c2;return _0x1e20e5;})[_0xd4db('0x1c')](respondWithFilteredResult(_0x2b0cca,_0x608d59))['catch'](handleError(_0x2b0cca,null));};exports['show']=function(_0x2c7257,_0x17c3c5){var _0x4d646b={'raw':![],'where':{'id':_0x2c7257['params']['id']}},_0x4e2714={};_0x4e2714[_0xd4db('0x23')]=_[_0xd4db('0x25')](db['FreshsalesAccount'][_0xd4db('0x3b')]);_0x4e2714[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x2c7257[_0xd4db('0x24')]);_0x4e2714[_0xd4db('0x26')]=_[_0xd4db('0x27')](_0x4e2714['model'],_0x4e2714[_0xd4db('0x24')]);_0x4d646b['attributes']=_[_0xd4db('0x27')](_0x4e2714[_0xd4db('0x23')],qs[_0xd4db('0x29')](_0x2c7257['query']['fields']));_0x4d646b[_0xd4db('0x28')]=_0x4d646b[_0xd4db('0x28')]['length']?_0x4d646b[_0xd4db('0x28')]:_0x4e2714['model'];if(_0x2c7257['query']['includeAll']){_0x4d646b['include']=[{'all':!![]}];}_0x4d646b=_[_0xd4db('0x32')]({},_0x4d646b,_0x2c7257['options']);return db[_0xd4db('0x22')][_0xd4db('0x3c')](_0x4d646b)[_0xd4db('0x1c')](handleEntityNotFound(_0x17c3c5,null))['then'](respondWithResult(_0x17c3c5,null))['catch'](handleError(_0x17c3c5,null));};exports[_0xd4db('0x3d')]=function(_0xdd0b1d,_0x531047){return db[_0xd4db('0x22')][_0xd4db('0x3d')](_0xdd0b1d[_0xd4db('0x3e')],{})[_0xd4db('0x1c')](respondWithResult(_0x531047,0xc9))[_0xd4db('0x3f')](handleError(_0x531047,null));};exports['update']=function(_0x3a27db,_0x28d4b3){if(_0x3a27db['body']['id']){delete _0x3a27db[_0xd4db('0x3e')]['id'];}return db['FreshsalesAccount'][_0xd4db('0x3c')]({'where':{'id':_0x3a27db[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x28d4b3,null))[_0xd4db('0x1c')](saveUpdates(_0x3a27db['body'],null))[_0xd4db('0x1c')](respondWithResult(_0x28d4b3,null))[_0xd4db('0x3f')](handleError(_0x28d4b3,null));};exports['destroy']=function(_0x27063d,_0x2b3451){return db[_0xd4db('0x22')][_0xd4db('0x3c')]({'where':{'id':_0x27063d[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x2b3451,null))['then'](removeEntity(_0x2b3451,null))[_0xd4db('0x3f')](handleError(_0x2b3451,null));};exports[_0xd4db('0x41')]=function(_0x5cc3f0,_0x12bde5,_0x3aaf0f){var _0x3f1527={};var _0x526abf={};var _0xd3332f;var _0x4f6817;return db[_0xd4db('0x22')][_0xd4db('0x42')]({'where':{'id':_0x5cc3f0[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x12bde5,null))[_0xd4db('0x1c')](function(_0x477007){if(_0x477007){_0xd3332f=_0x477007;_0x526abf[_0xd4db('0x23')]=_['keys'](db[_0xd4db('0x43')][_0xd4db('0x3b')]);_0x526abf[_0xd4db('0x24')]=_[_0xd4db('0x25')](_0x5cc3f0[_0xd4db('0x24')]);_0x526abf[_0xd4db('0x26')]=_['intersection'](_0x526abf[_0xd4db('0x23')],_0x526abf[_0xd4db('0x24')]);_0x3f1527[_0xd4db('0x28')]=_[_0xd4db('0x27')](_0x526abf[_0xd4db('0x23')],qs[_0xd4db('0x29')](_0x5cc3f0['query'][_0xd4db('0x29')]));_0x3f1527[_0xd4db('0x28')]=_0x3f1527[_0xd4db('0x28')][_0xd4db('0x2a')]?_0x3f1527[_0xd4db('0x28')]:_0x526abf[_0xd4db('0x23')];_0x3f1527['order']=qs[_0xd4db('0x2f')](_0x5cc3f0[_0xd4db('0x24')]['sort']);_0x3f1527['where']=qs[_0xd4db('0x26')](_['pick'](_0x5cc3f0['query'],_0x526abf[_0xd4db('0x26')]));if(_0x5cc3f0[_0xd4db('0x24')]['filter']){_0x3f1527['where']=_[_0xd4db('0x32')](_0x3f1527[_0xd4db('0x30')],{'$or':_[_0xd4db('0x33')](_0x3f1527[_0xd4db('0x28')],function(_0x5486ce){var _0x51c9ad={};_0x51c9ad[_0x5486ce]={'$like':'%'+_0x5cc3f0['query'][_0xd4db('0x35')]+'%'};return _0x51c9ad;})});}_0x3f1527=_[_0xd4db('0x32')]({},_0x3f1527,_0x5cc3f0[_0xd4db('0x36')]);return _0xd3332f['getConfigurations'](_0x3f1527);}})[_0xd4db('0x1c')](function(_0x45eb4d){if(_0x45eb4d){_0x4f6817=_0x45eb4d[_0xd4db('0x2a')];if(!_0x5cc3f0['query'][_0xd4db('0x2b')](_0xd4db('0x2c'))){_0x3f1527['limit']=qs[_0xd4db('0x2d')](_0x5cc3f0[_0xd4db('0x24')]['limit']);_0x3f1527[_0xd4db('0x16')]=qs[_0xd4db('0x16')](_0x5cc3f0['query']['offset']);}return _0xd3332f[_0xd4db('0x41')](_0x3f1527);}})['then'](function(_0x34cb9a){if(_0x34cb9a){return _0x34cb9a?{'count':_0x4f6817,'rows':_0x34cb9a}:null;}})[_0xd4db('0x1c')](respondWithResult(_0x12bde5,null))[_0xd4db('0x3f')](handleError(_0x12bde5,null));};exports[_0xd4db('0x44')]=function(_0x5e9487,_0x15a40b,_0x3ee00c){if(_0x5e9487['body']['id']){delete _0x5e9487[_0xd4db('0x3e')]['id'];}return db['FreshsalesAccount'][_0xd4db('0x42')]({'where':{'id':_0x5e9487[_0xd4db('0x40')]['id']}})[_0xd4db('0x1c')](handleEntityNotFound(_0x15a40b,null))[_0xd4db('0x1c')](function(_0x424fe2){if(_0x424fe2){_0x5e9487['body'][_0xd4db('0x45')]=_0x424fe2['id'];_0x5e9487[_0xd4db('0x3e')][_0xd4db('0x46')]=integrations[_0xd4db('0x47')](_0x5e9487[_0xd4db('0x3e')][_0xd4db('0x48')],_0x5e9487[_0xd4db('0x3e')]['type']);_0x5e9487[_0xd4db('0x3e')]['Descriptions']=integrations['getDescriptions'](_0x5e9487[_0xd4db('0x3e')]['channel'],_0x5e9487[_0xd4db('0x3e')]['type']);return db[_0xd4db('0x43')][_0xd4db('0x3d')](_0x5e9487[_0xd4db('0x3e')],{'include':[{'model':db[_0xd4db('0x49')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xd4db('0x1c')](respondWithResult(_0x15a40b,null))['catch'](handleError(_0x15a40b,null));};exports[_0xd4db('0x4a')]=function(_0x39c9e4,_0x21a522,_0x118a0c){var _0x5ef3e1='';var _0x2f8c6c='';return db[_0xd4db('0x22')][_0xd4db('0x42')]({'where':{'id':_0x39c9e4[_0xd4db('0x40')]['id']},'attributes':['id','username',_0xd4db('0x4b'),_0xd4db('0x4c')]})[_0xd4db('0x1c')](handleEntityNotFound(_0x21a522,null))['then'](function(_0x4fa441){if(_0x4fa441){_0x2f8c6c=_0x4fa441[_0xd4db('0x4d')];_0x5ef3e1=_0x4fa441[_0xd4db('0x4b')];var _0x35733f=_0x4fa441[_0xd4db('0x4b')][_0xd4db('0x4e')](-0x1);if(_0x35733f==='/'){_0x5ef3e1=_0x5ef3e1[_0xd4db('0x4f')](0x0,_0x5ef3e1['lastIndexOf'](_0x35733f));}return rp({'method':_0xd4db('0x50'),'uri':util[_0xd4db('0x51')](_0xd4db('0x52'),_0x5ef3e1,_0xd4db('0x53')),'headers':{'Authorization':'Token\x20token='+_0x4fa441[_0xd4db('0x4c')]},'json':!![]});}})['then'](function(_0x2d90c6){if(_0x2d90c6){var _0x13f296=_0x2d90c6[_0xd4db('0x54')];var _0x434203=![];var _0x46bc96=null;for(_0x46bc96=0x0;_0x46bc96<_0x13f296[_0xd4db('0x2a')];_0x46bc96++){if(_0x13f296[_0x46bc96][_0xd4db('0x55')]===_0x2f8c6c){_0x434203=!![];}}if(_0x434203){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd4db('0x56')});}}})[_0xd4db('0x1c')](respondWithResult(_0x21a522,null))['catch'](function(_0x37ca8a){var _0x1f78ec=_0x39c9e4['query'][_0xd4db('0x57')]?0x1f4:_0x37ca8a[_0xd4db('0x58')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1f78ec,JSON[_0xd4db('0x59')](_0x37ca8a));delete _0x37ca8a['name'];if(_0x1f78ec===0x191){_0x1f78ec=0x190;}_0x21a522[_0xd4db('0x12')](_0x1f78ec)[_0xd4db('0x20')](_0x39c9e4[_0xd4db('0x24')][_0xd4db('0x57')]?{'message':_0xd4db('0x5a'),'statusCode':_0x37ca8a['statusCode']}:_0x37ca8a);});}; \ No newline at end of file +var _0x8a8b=['Content-Range','apply','save','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','update','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','stringify','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0xd4601b,_0xe664e5){var _0x5b149a=function(_0x578e0e){while(--_0x578e0e){_0xd4601b['push'](_0xd4601b['shift']());}};_0x5b149a(++_0xe664e5);}(_0x8a8b,0xae));var _0xb8a8=function(_0x3aab1b,_0x309ed7){_0x3aab1b=_0x3aab1b-0x0;var _0x1181d7=_0x8a8b[_0x3aab1b];return _0x1181d7;};'use strict';var emlformat=require(_0xb8a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8a8('0x1'));var rp=require(_0xb8a8('0x2'));var moment=require('moment');var BPromise=require(_0xb8a8('0x3'));var Mustache=require('mustache');var util=require(_0xb8a8('0x4'));var path=require('path');var sox=require(_0xb8a8('0x5'));var csv=require(_0xb8a8('0x6'));var ejs=require(_0xb8a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8a8('0x8'));var squel=require('squel');var crypto=require(_0xb8a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb8a8('0xa'));var toCsv=require(_0xb8a8('0x6'));var querystring=require(_0xb8a8('0xb'));var Papa=require('papaparse');var Redis=require(_0xb8a8('0xc'));var authService=require(_0xb8a8('0xd'));var qs=require(_0xb8a8('0xe'));var as=require(_0xb8a8('0xf'));var hardwareService=require(_0xb8a8('0x10'));var logger=require(_0xb8a8('0x11'))(_0xb8a8('0x12'));var utils=require(_0xb8a8('0x13'));var config=require(_0xb8a8('0x14'));var licenseUtil=require(_0xb8a8('0x15'));var db=require(_0xb8a8('0x16'))['db'];var integrations=require(_0xb8a8('0x17'));function respondWithStatusCode(_0x6e85aa,_0x5278f8){_0x5278f8=_0x5278f8||0xcc;return function(_0x376608){if(_0x376608){return _0x6e85aa[_0xb8a8('0x18')](_0x5278f8);}return _0x6e85aa[_0xb8a8('0x19')](_0x5278f8)[_0xb8a8('0x1a')]();};}function respondWithResult(_0x42fb99,_0xf3750e){_0xf3750e=_0xf3750e||0xc8;return function(_0x3cf353){if(_0x3cf353){return _0x42fb99[_0xb8a8('0x19')](_0xf3750e)[_0xb8a8('0x1b')](_0x3cf353);}};}function respondWithFilteredResult(_0x3d96dc,_0x3ca02e){return function(_0x4f6cd0){if(_0x4f6cd0){var _0x4664e3=typeof _0x3ca02e['offset']===_0xb8a8('0x1c')&&typeof _0x3ca02e[_0xb8a8('0x1d')]===_0xb8a8('0x1c');var _0x72df=_0x4f6cd0[_0xb8a8('0x1e')];var _0x1ab317=_0x4664e3?0x0:_0x3ca02e[_0xb8a8('0x1f')];var _0x25c111=_0x4664e3?_0x4f6cd0['count']:_0x3ca02e['offset']+_0x3ca02e[_0xb8a8('0x1d')];var _0x5e6e96;if(_0x25c111>=_0x72df){_0x25c111=_0x72df;_0x5e6e96=0xc8;}else{_0x5e6e96=0xce;}_0x3d96dc['status'](_0x5e6e96);return _0x3d96dc['set'](_0xb8a8('0x20'),_0x1ab317+'-'+_0x25c111+'/'+_0x72df)[_0xb8a8('0x1b')](_0x4f6cd0);}return null;};}function patchUpdates(_0x421b58){return function(_0xe68165){try{jsonpatch[_0xb8a8('0x21')](_0xe68165,_0x421b58,!![]);}catch(_0x27ab83){return BPromise['reject'](_0x27ab83);}return _0xe68165[_0xb8a8('0x22')]();};}function saveUpdates(_0x9ca4b,_0x1a3ff2){return function(_0x4429eb){if(_0x4429eb){return _0x4429eb['update'](_0x9ca4b)[_0xb8a8('0x23')](function(_0x55c6aa){return _0x55c6aa;});}return null;};}function removeEntity(_0x32aba6,_0x4bc82a){return function(_0x2a29ef){if(_0x2a29ef){return _0x2a29ef['destroy']()['then'](function(){_0x32aba6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dfad6,_0xd25b42){return function(_0x1124d1){if(!_0x1124d1){_0x2dfad6[_0xb8a8('0x18')](0x194);}return _0x1124d1;};}function handleError(_0x41b86d,_0x4b6c93){_0x4b6c93=_0x4b6c93||0x1f4;return function(_0x375db6){logger[_0xb8a8('0x24')](_0x375db6[_0xb8a8('0x25')]);if(_0x375db6[_0xb8a8('0x26')]){delete _0x375db6[_0xb8a8('0x26')];}_0x41b86d['status'](_0x4b6c93)[_0xb8a8('0x27')](_0x375db6);};}exports[_0xb8a8('0x28')]=function(_0xe1772e,_0x1e7403){var _0x47464e={},_0x543e81={},_0x4aec01={'count':0x0,'rows':[]};var _0x121563=_[_0xb8a8('0x29')](db[_0xb8a8('0x2a')][_0xb8a8('0x2b')],function(_0x3850e6){return{'name':_0x3850e6[_0xb8a8('0x2c')],'type':_0x3850e6[_0xb8a8('0x2d')][_0xb8a8('0x2e')]};});_0x543e81[_0xb8a8('0x2f')]=_[_0xb8a8('0x29')](_0x121563,'name');_0x543e81['query']=_[_0xb8a8('0x30')](_0xe1772e[_0xb8a8('0x31')]);_0x543e81[_0xb8a8('0x32')]=_['intersection'](_0x543e81['model'],_0x543e81['query']);_0x47464e['attributes']=_['intersection'](_0x543e81[_0xb8a8('0x2f')],qs[_0xb8a8('0x33')](_0xe1772e[_0xb8a8('0x31')]['fields']));_0x47464e[_0xb8a8('0x34')]=_0x47464e[_0xb8a8('0x34')][_0xb8a8('0x35')]?_0x47464e[_0xb8a8('0x34')]:_0x543e81[_0xb8a8('0x2f')];if(!_0xe1772e[_0xb8a8('0x31')]['hasOwnProperty'](_0xb8a8('0x36'))){_0x47464e[_0xb8a8('0x1d')]=qs[_0xb8a8('0x1d')](_0xe1772e[_0xb8a8('0x31')][_0xb8a8('0x1d')]);_0x47464e[_0xb8a8('0x1f')]=qs['offset'](_0xe1772e['query'][_0xb8a8('0x1f')]);}_0x47464e[_0xb8a8('0x37')]=qs[_0xb8a8('0x38')](_0xe1772e[_0xb8a8('0x31')][_0xb8a8('0x38')]);_0x47464e[_0xb8a8('0x39')]=qs[_0xb8a8('0x32')](_['pick'](_0xe1772e[_0xb8a8('0x31')],_0x543e81[_0xb8a8('0x32')]),_0x121563);if(_0xe1772e[_0xb8a8('0x31')][_0xb8a8('0x3a')]){_0x47464e[_0xb8a8('0x39')]=_[_0xb8a8('0x3b')](_0x47464e[_0xb8a8('0x39')],{'$or':_[_0xb8a8('0x29')](_0x121563,function(_0x8f3f86){if(_0x8f3f86[_0xb8a8('0x2d')]!==_0xb8a8('0x3c')){var _0xb25864={};_0xb25864[_0x8f3f86[_0xb8a8('0x26')]]={'$like':'%'+_0xe1772e[_0xb8a8('0x31')]['filter']+'%'};return _0xb25864;}})});}_0x47464e=_[_0xb8a8('0x3b')]({},_0x47464e,_0xe1772e[_0xb8a8('0x3d')]);var _0xd51ca={'where':_0x47464e[_0xb8a8('0x39')]};return db[_0xb8a8('0x2a')][_0xb8a8('0x1e')](_0xd51ca)[_0xb8a8('0x23')](function(_0xd1813f){_0x4aec01['count']=_0xd1813f;if(_0xe1772e[_0xb8a8('0x31')][_0xb8a8('0x3e')]){_0x47464e[_0xb8a8('0x3f')]=[{'all':!![]}];}return db[_0xb8a8('0x2a')][_0xb8a8('0x40')](_0x47464e);})[_0xb8a8('0x23')](function(_0x28339b){_0x4aec01[_0xb8a8('0x41')]=_0x28339b;return _0x4aec01;})['then'](respondWithFilteredResult(_0x1e7403,_0x47464e))[_0xb8a8('0x42')](handleError(_0x1e7403,null));};exports[_0xb8a8('0x43')]=function(_0x36c8e4,_0x4d0f99){var _0x3590ac={'raw':![],'where':{'id':_0x36c8e4[_0xb8a8('0x44')]['id']}},_0x4677e0={};_0x4677e0[_0xb8a8('0x2f')]=_['keys'](db[_0xb8a8('0x2a')]['rawAttributes']);_0x4677e0[_0xb8a8('0x31')]=_['keys'](_0x36c8e4[_0xb8a8('0x31')]);_0x4677e0[_0xb8a8('0x32')]=_[_0xb8a8('0x45')](_0x4677e0[_0xb8a8('0x2f')],_0x4677e0[_0xb8a8('0x31')]);_0x3590ac[_0xb8a8('0x34')]=_[_0xb8a8('0x45')](_0x4677e0[_0xb8a8('0x2f')],qs[_0xb8a8('0x33')](_0x36c8e4[_0xb8a8('0x31')][_0xb8a8('0x33')]));_0x3590ac[_0xb8a8('0x34')]=_0x3590ac[_0xb8a8('0x34')][_0xb8a8('0x35')]?_0x3590ac['attributes']:_0x4677e0[_0xb8a8('0x2f')];if(_0x36c8e4['query'][_0xb8a8('0x3e')]){_0x3590ac[_0xb8a8('0x3f')]=[{'all':!![]}];}_0x3590ac=_[_0xb8a8('0x3b')]({},_0x3590ac,_0x36c8e4[_0xb8a8('0x3d')]);return db[_0xb8a8('0x2a')][_0xb8a8('0x46')](_0x3590ac)[_0xb8a8('0x23')](handleEntityNotFound(_0x4d0f99,null))['then'](respondWithResult(_0x4d0f99,null))[_0xb8a8('0x42')](handleError(_0x4d0f99,null));};exports[_0xb8a8('0x47')]=function(_0x3ca626,_0x566bf8){return db[_0xb8a8('0x2a')][_0xb8a8('0x47')](_0x3ca626['body'],{})['then'](respondWithResult(_0x566bf8,0xc9))[_0xb8a8('0x42')](handleError(_0x566bf8,null));};exports[_0xb8a8('0x48')]=function(_0x2b6464,_0x560f19){if(_0x2b6464[_0xb8a8('0x49')]['id']){delete _0x2b6464[_0xb8a8('0x49')]['id'];}return db[_0xb8a8('0x2a')][_0xb8a8('0x46')]({'where':{'id':_0x2b6464['params']['id']}})[_0xb8a8('0x23')](handleEntityNotFound(_0x560f19,null))[_0xb8a8('0x23')](saveUpdates(_0x2b6464[_0xb8a8('0x49')],null))[_0xb8a8('0x23')](respondWithResult(_0x560f19,null))['catch'](handleError(_0x560f19,null));};exports[_0xb8a8('0x4a')]=function(_0x32f688,_0x21fd2e){return db[_0xb8a8('0x2a')][_0xb8a8('0x46')]({'where':{'id':_0x32f688[_0xb8a8('0x44')]['id']}})[_0xb8a8('0x23')](handleEntityNotFound(_0x21fd2e,null))['then'](removeEntity(_0x21fd2e,null))['catch'](handleError(_0x21fd2e,null));};exports[_0xb8a8('0x4b')]=function(_0x2a7c05,_0x895596,_0x1fd809){var _0x4b2e1e={};var _0x5203ea={};var _0x442822;var _0x2ce759;return db[_0xb8a8('0x2a')][_0xb8a8('0x4c')]({'where':{'id':_0x2a7c05[_0xb8a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x895596,null))['then'](function(_0x5e96dd){if(_0x5e96dd){_0x442822=_0x5e96dd;_0x5203ea[_0xb8a8('0x2f')]=_[_0xb8a8('0x30')](db[_0xb8a8('0x4d')][_0xb8a8('0x2b')]);_0x5203ea[_0xb8a8('0x31')]=_[_0xb8a8('0x30')](_0x2a7c05[_0xb8a8('0x31')]);_0x5203ea[_0xb8a8('0x32')]=_[_0xb8a8('0x45')](_0x5203ea[_0xb8a8('0x2f')],_0x5203ea[_0xb8a8('0x31')]);_0x4b2e1e[_0xb8a8('0x34')]=_[_0xb8a8('0x45')](_0x5203ea[_0xb8a8('0x2f')],qs[_0xb8a8('0x33')](_0x2a7c05[_0xb8a8('0x31')][_0xb8a8('0x33')]));_0x4b2e1e['attributes']=_0x4b2e1e['attributes'][_0xb8a8('0x35')]?_0x4b2e1e['attributes']:_0x5203ea[_0xb8a8('0x2f')];_0x4b2e1e['order']=qs[_0xb8a8('0x38')](_0x2a7c05['query'][_0xb8a8('0x38')]);_0x4b2e1e[_0xb8a8('0x39')]=qs[_0xb8a8('0x32')](_[_0xb8a8('0x4e')](_0x2a7c05[_0xb8a8('0x31')],_0x5203ea['filters']));if(_0x2a7c05[_0xb8a8('0x31')]['filter']){_0x4b2e1e[_0xb8a8('0x39')]=_['merge'](_0x4b2e1e[_0xb8a8('0x39')],{'$or':_[_0xb8a8('0x29')](_0x4b2e1e[_0xb8a8('0x34')],function(_0x1b69be){var _0x46d6b1={};_0x46d6b1[_0x1b69be]={'$like':'%'+_0x2a7c05[_0xb8a8('0x31')][_0xb8a8('0x3a')]+'%'};return _0x46d6b1;})});}_0x4b2e1e=_[_0xb8a8('0x3b')]({},_0x4b2e1e,_0x2a7c05[_0xb8a8('0x3d')]);return _0x442822[_0xb8a8('0x4b')](_0x4b2e1e);}})[_0xb8a8('0x23')](function(_0x538a14){if(_0x538a14){_0x2ce759=_0x538a14[_0xb8a8('0x35')];if(!_0x2a7c05[_0xb8a8('0x31')][_0xb8a8('0x4f')]('nolimit')){_0x4b2e1e[_0xb8a8('0x1d')]=qs[_0xb8a8('0x1d')](_0x2a7c05[_0xb8a8('0x31')][_0xb8a8('0x1d')]);_0x4b2e1e[_0xb8a8('0x1f')]=qs['offset'](_0x2a7c05[_0xb8a8('0x31')]['offset']);}return _0x442822[_0xb8a8('0x4b')](_0x4b2e1e);}})['then'](function(_0x31b710){if(_0x31b710){return _0x31b710?{'count':_0x2ce759,'rows':_0x31b710}:null;}})[_0xb8a8('0x23')](respondWithResult(_0x895596,null))['catch'](handleError(_0x895596,null));};exports['addConfiguration']=function(_0x47a9fb,_0x411691,_0x4fecf9){if(_0x47a9fb[_0xb8a8('0x49')]['id']){delete _0x47a9fb[_0xb8a8('0x49')]['id'];}return db[_0xb8a8('0x2a')][_0xb8a8('0x4c')]({'where':{'id':_0x47a9fb[_0xb8a8('0x44')]['id']}})[_0xb8a8('0x23')](handleEntityNotFound(_0x411691,null))[_0xb8a8('0x23')](function(_0x2c11d4){if(_0x2c11d4){_0x47a9fb[_0xb8a8('0x49')]['AccountId']=_0x2c11d4['id'];_0x47a9fb[_0xb8a8('0x49')]['Subjects']=integrations[_0xb8a8('0x50')](_0x47a9fb[_0xb8a8('0x49')]['channel'],_0x47a9fb[_0xb8a8('0x49')][_0xb8a8('0x2d')]);_0x47a9fb[_0xb8a8('0x49')][_0xb8a8('0x51')]=integrations[_0xb8a8('0x52')](_0x47a9fb[_0xb8a8('0x49')][_0xb8a8('0x53')],_0x47a9fb[_0xb8a8('0x49')][_0xb8a8('0x2d')]);return db[_0xb8a8('0x4d')]['create'](_0x47a9fb['body'],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xb8a8('0x54')],'as':'Descriptions'}]});}return null;})[_0xb8a8('0x23')](respondWithResult(_0x411691,null))[_0xb8a8('0x42')](handleError(_0x411691,null));};exports[_0xb8a8('0x55')]=function(_0x2c97d0,_0x1539b8,_0x54bc4c){var _0x2b9f8e='';var _0x351d32='';return db[_0xb8a8('0x2a')][_0xb8a8('0x4c')]({'where':{'id':_0x2c97d0[_0xb8a8('0x44')]['id']},'attributes':['id','username',_0xb8a8('0x56'),'apiKey']})[_0xb8a8('0x23')](handleEntityNotFound(_0x1539b8,null))[_0xb8a8('0x23')](function(_0x38cecf){if(_0x38cecf){_0x351d32=_0x38cecf['username'];_0x2b9f8e=_0x38cecf['remoteUri'];var _0x35b350=_0x38cecf[_0xb8a8('0x56')][_0xb8a8('0x57')](-0x1);if(_0x35b350==='/'){_0x2b9f8e=_0x2b9f8e[_0xb8a8('0x58')](0x0,_0x2b9f8e[_0xb8a8('0x59')](_0x35b350));}return rp({'method':_0xb8a8('0x5a'),'uri':util[_0xb8a8('0x5b')](_0xb8a8('0x5c'),_0x2b9f8e,_0xb8a8('0x5d')),'headers':{'Authorization':_0xb8a8('0x5e')+_0x38cecf[_0xb8a8('0x5f')]},'json':!![]});}})[_0xb8a8('0x23')](function(_0x10ff1){if(_0x10ff1){var _0x483900=_0x10ff1[_0xb8a8('0x60')];var _0x3bbe41=![];var _0x12bacd=null;for(_0x12bacd=0x0;_0x12bacd<_0x483900[_0xb8a8('0x35')];_0x12bacd++){if(_0x483900[_0x12bacd][_0xb8a8('0x61')]===_0x351d32){_0x3bbe41=!![];}}if(_0x3bbe41){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb8a8('0x62')});}}})['then'](respondWithResult(_0x1539b8,null))[_0xb8a8('0x42')](function(_0x1f92e7){var _0x402744=_0x2c97d0[_0xb8a8('0x31')][_0xb8a8('0x63')]?0x1f4:_0x1f92e7['statusCode']||0x1f4;logger[_0xb8a8('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xb8a8('0x55'),_0x402744,JSON[_0xb8a8('0x64')](_0x1f92e7));delete _0x1f92e7[_0xb8a8('0x26')];if(_0x402744===0x191){_0x402744=0x190;}_0x1539b8[_0xb8a8('0x19')](_0x402744)[_0xb8a8('0x27')](_0x2c97d0[_0xb8a8('0x31')]['test']?{'message':_0xb8a8('0x65'),'statusCode':_0x1f92e7[_0xb8a8('0x66')]}:_0x1f92e7);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2f85cde..235a4ff 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 _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x187d,0x93));var _0xd187=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x187d[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x958a=['moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','api'];(function(_0x4fdb14,_0x16c48d){var _0x723307=function(_0x458e32){while(--_0x458e32){_0x4fdb14['push'](_0x4fdb14['shift']());}};_0x723307(++_0x16c48d);}(_0x958a,0x128));var _0xa958=function(_0x5e45a1,_0x1f6605){_0x5e45a1=_0x5e45a1-0x0;var _0x3507c6=_0x958a[_0x5e45a1];return _0x3507c6;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xa958('0x8'));module[_0xa958('0x9')]=function(_0x2692d6,_0x3ddaa9){return _0x2692d6[_0xa958('0xa')](_0xa958('0xb'),attributes,{'tableName':_0xa958('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 12826c6..a4e8e96 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 _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0x211679,_0x484f81){var _0x19b622=function(_0x5608c4){while(--_0x5608c4){_0x211679['push'](_0x211679['shift']());}};_0x19b622(++_0x484f81);}(_0x77d4,0x108));var _0x477d=function(_0x148783,_0x1ac458){_0x148783=_0x148783-0x0;var _0x85329a=_0x77d4[_0x148783];return _0x85329a;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0xc16286,_0x1333ff){var _0x1212c4=function(_0x218b59){while(--_0x218b59){_0xc16286['push'](_0xc16286['shift']());}};_0x1212c4(++_0x1333ff);}(_0x7bd0,0x111));var _0x07bd=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7bd0[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2de36b9..0d7d7ab 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 _0x29f8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x24d8dd,_0x103354){var _0x126a6d=function(_0xeb4fc7){while(--_0xeb4fc7){_0x24d8dd['push'](_0x24d8dd['shift']());}};_0x126a6d(++_0x103354);}(_0x29f8,0xb2));var _0x829f=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x29f8[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0x829f('0x0'));var util=require(_0x829f('0x1'));var path=require(_0x829f('0x2'));var timeout=require(_0x829f('0x3'));var express=require(_0x829f('0x4'));var router=express[_0x829f('0x5')]();var fs_extra=require(_0x829f('0x6'));var auth=require(_0x829f('0x7'));var interaction=require(_0x829f('0x8'));var config=require('../../config/environment');var controller=require(_0x829f('0x9'));router[_0x829f('0xa')]('/',auth[_0x829f('0xb')](),controller[_0x829f('0xc')]);router['get'](_0x829f('0xd'),auth['isAuthenticated'](),controller[_0x829f('0xe')]);router['get'](_0x829f('0xf'),auth[_0x829f('0xb')](),controller[_0x829f('0x10')]);router[_0x829f('0xa')](_0x829f('0x11'),auth[_0x829f('0xb')](),controller['getDescriptions']);router[_0x829f('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x829f('0x12')]);router[_0x829f('0x13')]('/',auth[_0x829f('0xb')](),controller[_0x829f('0x14')]);router[_0x829f('0x15')](_0x829f('0xd'),auth[_0x829f('0xb')](),controller[_0x829f('0x16')]);router[_0x829f('0x17')](_0x829f('0xd'),auth[_0x829f('0xb')](),controller[_0x829f('0x18')]);module[_0x829f('0x19')]=router; \ No newline at end of file +var _0xff56=['get','/:id','/:id/subjects','getDescriptions','/:id/fields','getFields','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index'];(function(_0x5c230d,_0x59fa9d){var _0x100b9a=function(_0x3472bb){while(--_0x3472bb){_0x5c230d['push'](_0x5c230d['shift']());}};_0x100b9a(++_0x59fa9d);}(_0xff56,0x1d7));var _0x6ff5=function(_0x5595eb,_0x379d98){_0x5595eb=_0x5595eb-0x0;var _0x16ae95=_0xff56[_0x5595eb];return _0x16ae95;};'use strict';var multer=require(_0x6ff5('0x0'));var util=require(_0x6ff5('0x1'));var path=require(_0x6ff5('0x2'));var timeout=require(_0x6ff5('0x3'));var express=require(_0x6ff5('0x4'));var router=express[_0x6ff5('0x5')]();var fs_extra=require(_0x6ff5('0x6'));var auth=require(_0x6ff5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6ff5('0x8'));var controller=require(_0x6ff5('0x9'));router['get']('/',auth[_0x6ff5('0xa')](),controller[_0x6ff5('0xb')]);router[_0x6ff5('0xc')](_0x6ff5('0xd'),auth[_0x6ff5('0xa')](),controller['show']);router[_0x6ff5('0xc')](_0x6ff5('0xe'),auth[_0x6ff5('0xa')](),controller['getSubjects']);router[_0x6ff5('0xc')]('/:id/descriptions',auth[_0x6ff5('0xa')](),controller[_0x6ff5('0xf')]);router[_0x6ff5('0xc')](_0x6ff5('0x10'),auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x11')]);router[_0x6ff5('0x12')]('/',auth[_0x6ff5('0xa')](),controller['create']);router['put'](_0x6ff5('0xd'),auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x13')]);router[_0x6ff5('0x14')](_0x6ff5('0xd'),auth[_0x6ff5('0xa')](),controller[_0x6ff5('0x15')]);module[_0x6ff5('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 f7fbe1e..f5ca83e 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 _0x7150=['exports','sequelize'];(function(_0x1f8e5d,_0x4d5d9b){var _0x1b8893=function(_0x4d12c9){while(--_0x4d12c9){_0x1f8e5d['push'](_0x1f8e5d['shift']());}};_0x1b8893(++_0x4d5d9b);}(_0x7150,0x153));var _0x0715=function(_0x4fd5de,_0x854f9f){_0x4fd5de=_0x4fd5de-0x0;var _0x194d47=_0x7150[_0x4fd5de];return _0x194d47;};'use strict';var Sequelize=require(_0x0715('0x0'));module[_0x0715('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4b2=['STRING','sequelize'];(function(_0x4b8088,_0x141dd6){var _0x4e9ea1=function(_0x3b427b){while(--_0x3b427b){_0x4b8088['push'](_0x4b8088['shift']());}};_0x4e9ea1(++_0x141dd6);}(_0xc4b2,0x197));var _0x2c4b=function(_0x46688f,_0x302e66){_0x46688f=_0x46688f-0x0;var _0x5ee527=_0xc4b2[_0x46688f];return _0x5ee527;};'use strict';var Sequelize=require(_0x2c4b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c4b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 226c48f..9d6ccc3 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 _0xc0d4=['rows','show','length','find','create','catch','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll'];(function(_0x29b27e,_0x41e08b){var _0xffb544=function(_0x36654f){while(--_0x36654f){_0x29b27e['push'](_0x29b27e['shift']());}};_0xffb544(++_0x41e08b);}(_0xc0d4,0x19e));var _0x4c0d=function(_0x14790f,_0x432b5f){_0x14790f=_0x14790f-0x0;var _0x5acc1f=_0xc0d4[_0x14790f];return _0x5acc1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c0d('0x0'));var jsonpatch=require(_0x4c0d('0x1'));var rp=require(_0x4c0d('0x2'));var moment=require(_0x4c0d('0x3'));var BPromise=require(_0x4c0d('0x4'));var Mustache=require(_0x4c0d('0x5'));var util=require(_0x4c0d('0x6'));var path=require(_0x4c0d('0x7'));var sox=require(_0x4c0d('0x8'));var csv=require('to-csv');var ejs=require(_0x4c0d('0x9'));var fs=require('fs');var fs_extra=require(_0x4c0d('0xa'));var _=require(_0x4c0d('0xb'));var squel=require(_0x4c0d('0xc'));var crypto=require(_0x4c0d('0xd'));var jsforce=require(_0x4c0d('0xe'));var deskjs=require(_0x4c0d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c0d('0x10'));var Redis=require(_0x4c0d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c0d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c0d('0x13'))(_0x4c0d('0x14'));var utils=require(_0x4c0d('0x15'));var config=require(_0x4c0d('0x16'));var licenseUtil=require(_0x4c0d('0x17'));var db=require(_0x4c0d('0x18'))['db'];function respondWithStatusCode(_0x41e2b8,_0x33efb6){_0x33efb6=_0x33efb6||0xcc;return function(_0x1ccace){if(_0x1ccace){return _0x41e2b8[_0x4c0d('0x19')](_0x33efb6);}return _0x41e2b8[_0x4c0d('0x1a')](_0x33efb6)[_0x4c0d('0x1b')]();};}function respondWithResult(_0x1fb1cf,_0x1edd33){_0x1edd33=_0x1edd33||0xc8;return function(_0x52cd2a){if(_0x52cd2a){return _0x1fb1cf[_0x4c0d('0x1a')](_0x1edd33)['json'](_0x52cd2a);}};}function respondWithFilteredResult(_0x309689,_0x252ace){return function(_0x195635){if(_0x195635){var _0x180b10=typeof _0x252ace['offset']==='undefined'&&typeof _0x252ace['limit']===_0x4c0d('0x1c');var _0x2b8125=_0x195635[_0x4c0d('0x1d')];var _0x2765ca=_0x180b10?0x0:_0x252ace[_0x4c0d('0x1e')];var _0x23f7c2=_0x180b10?_0x195635[_0x4c0d('0x1d')]:_0x252ace['offset']+_0x252ace[_0x4c0d('0x1f')];var _0x2792d5;if(_0x23f7c2>=_0x2b8125){_0x23f7c2=_0x2b8125;_0x2792d5=0xc8;}else{_0x2792d5=0xce;}_0x309689[_0x4c0d('0x1a')](_0x2792d5);return _0x309689['set'](_0x4c0d('0x20'),_0x2765ca+'-'+_0x23f7c2+'/'+_0x2b8125)['json'](_0x195635);}return null;};}function patchUpdates(_0x111c60){return function(_0x1cd757){try{jsonpatch[_0x4c0d('0x21')](_0x1cd757,_0x111c60,!![]);}catch(_0x1aec23){return BPromise[_0x4c0d('0x22')](_0x1aec23);}return _0x1cd757[_0x4c0d('0x23')]();};}function saveUpdates(_0x294ba2,_0x3e28ec){return function(_0x23aa9d){if(_0x23aa9d){return _0x23aa9d[_0x4c0d('0x24')](_0x294ba2)[_0x4c0d('0x25')](function(_0x62b891){return _0x62b891;});}return null;};}function removeEntity(_0x21b436,_0x551eed){return function(_0x5760a7){if(_0x5760a7){return _0x5760a7[_0x4c0d('0x26')]()['then'](function(){_0x21b436[_0x4c0d('0x1a')](0xcc)[_0x4c0d('0x1b')]();});}};}function handleEntityNotFound(_0x3a5876,_0x416b8c){return function(_0x196a47){if(!_0x196a47){_0x3a5876[_0x4c0d('0x19')](0x194);}return _0x196a47;};}function handleError(_0x38c396,_0x3a698b){_0x3a698b=_0x3a698b||0x1f4;return function(_0x1affea){logger[_0x4c0d('0x27')](_0x1affea[_0x4c0d('0x28')]);if(_0x1affea[_0x4c0d('0x29')]){delete _0x1affea[_0x4c0d('0x29')];}_0x38c396[_0x4c0d('0x1a')](_0x3a698b)['send'](_0x1affea);};}exports['index']=function(_0x170f3f,_0x5951f5){var _0x1d289c={},_0x175b68={},_0x24a147={'count':0x0,'rows':[]};var _0x21d61f=_[_0x4c0d('0x2a')](db['FreshsalesConfiguration'][_0x4c0d('0x2b')],function(_0x43f973){return{'name':_0x43f973[_0x4c0d('0x2c')],'type':_0x43f973[_0x4c0d('0x2d')]['key']};});_0x175b68[_0x4c0d('0x2e')]=_['map'](_0x21d61f,'name');_0x175b68[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0x170f3f[_0x4c0d('0x2f')]);_0x175b68[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x175b68[_0x4c0d('0x2e')],_0x175b68[_0x4c0d('0x2f')]);_0x1d289c['attributes']=_[_0x4c0d('0x32')](_0x175b68[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x170f3f[_0x4c0d('0x2f')]['fields']));_0x1d289c[_0x4c0d('0x34')]=_0x1d289c[_0x4c0d('0x34')]['length']?_0x1d289c['attributes']:_0x175b68['model'];if(!_0x170f3f['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x1d289c[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x1d289c[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}_0x1d289c[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x38')]);_0x1d289c[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_['pick'](_0x170f3f['query'],_0x175b68[_0x4c0d('0x31')]),_0x21d61f);if(_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x1d289c['where']=_[_0x4c0d('0x3b')](_0x1d289c[_0x4c0d('0x39')],{'$or':_['map'](_0x21d61f,function(_0x305506){if(_0x305506[_0x4c0d('0x2d')]!==_0x4c0d('0x3c')){var _0x4d6d73={};_0x4d6d73[_0x305506[_0x4c0d('0x29')]]={'$like':'%'+_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x4d6d73;}})});}_0x1d289c=_[_0x4c0d('0x3b')]({},_0x1d289c,_0x170f3f[_0x4c0d('0x3d')]);var _0x774065={'where':_0x1d289c['where']};return db[_0x4c0d('0x3e')][_0x4c0d('0x1d')](_0x774065)['then'](function(_0x5682ae){_0x24a147[_0x4c0d('0x1d')]=_0x5682ae;if(_0x170f3f[_0x4c0d('0x2f')][_0x4c0d('0x3f')]){_0x1d289c[_0x4c0d('0x40')]=[{'all':!![]}];}return db[_0x4c0d('0x3e')][_0x4c0d('0x41')](_0x1d289c);})[_0x4c0d('0x25')](function(_0x4d7b0b){_0x24a147[_0x4c0d('0x42')]=_0x4d7b0b;return _0x24a147;})['then'](respondWithFilteredResult(_0x5951f5,_0x1d289c))['catch'](handleError(_0x5951f5,null));};exports[_0x4c0d('0x43')]=function(_0x1973d3,_0x584ae0){var _0x4150f0={'raw':![],'where':{'id':_0x1973d3['params']['id']}},_0x29564f={};_0x29564f[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x3e')]['rawAttributes']);_0x29564f[_0x4c0d('0x2f')]=_['keys'](_0x1973d3[_0x4c0d('0x2f')]);_0x29564f[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x29564f[_0x4c0d('0x2e')],_0x29564f[_0x4c0d('0x2f')]);_0x4150f0[_0x4c0d('0x34')]=_['intersection'](_0x29564f[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x1973d3[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x4150f0[_0x4c0d('0x34')]=_0x4150f0[_0x4c0d('0x34')][_0x4c0d('0x44')]?_0x4150f0[_0x4c0d('0x34')]:_0x29564f[_0x4c0d('0x2e')];if(_0x1973d3['query'][_0x4c0d('0x3f')]){_0x4150f0['include']=[{'all':!![]}];}_0x4150f0=_[_0x4c0d('0x3b')]({},_0x4150f0,_0x1973d3[_0x4c0d('0x3d')]);return db[_0x4c0d('0x3e')][_0x4c0d('0x45')](_0x4150f0)[_0x4c0d('0x25')](handleEntityNotFound(_0x584ae0,null))[_0x4c0d('0x25')](respondWithResult(_0x584ae0,null))['catch'](handleError(_0x584ae0,null));};exports['create']=function(_0x4ede99,_0x7a22f8){return db[_0x4c0d('0x3e')][_0x4c0d('0x46')](_0x4ede99['body'],{})['then'](respondWithResult(_0x7a22f8,0xc9))[_0x4c0d('0x47')](handleError(_0x7a22f8,null));};exports[_0x4c0d('0x24')]=function(_0xf2888b,_0x10263f){if(_0xf2888b[_0x4c0d('0x48')]['id']){delete _0xf2888b[_0x4c0d('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x4c0d('0x45')]({'where':{'id':_0xf2888b['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x10263f,null))[_0x4c0d('0x25')](saveUpdates(_0xf2888b['body'],null))['then'](respondWithResult(_0x10263f,null))[_0x4c0d('0x47')](handleError(_0x10263f,null));};exports[_0x4c0d('0x26')]=function(_0x3210aa,_0x543df1){return db[_0x4c0d('0x3e')][_0x4c0d('0x45')]({'where':{'id':_0x3210aa[_0x4c0d('0x49')]['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x543df1,null))[_0x4c0d('0x25')](removeEntity(_0x543df1,null))[_0x4c0d('0x47')](handleError(_0x543df1,null));};exports[_0x4c0d('0x4a')]=function(_0xa0a7c3,_0x3e541,_0x415d0b){var _0x18b930={};var _0x158145={};var _0x8f8fe4;var _0x1a5219;return db['FreshsalesConfiguration'][_0x4c0d('0x4b')]({'where':{'id':_0xa0a7c3['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x3e541,null))['then'](function(_0x2f1cfd){if(_0x2f1cfd){_0x8f8fe4=_0x2f1cfd;_0x158145['model']=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x158145[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0xa0a7c3[_0x4c0d('0x2f')]);_0x158145[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x158145[_0x4c0d('0x2e')],_0x158145[_0x4c0d('0x2f')]);_0x18b930[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x158145[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x18b930[_0x4c0d('0x34')]=_0x18b930[_0x4c0d('0x34')][_0x4c0d('0x44')]?_0x18b930[_0x4c0d('0x34')]:_0x158145['model'];_0x18b930['order']=qs[_0x4c0d('0x38')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x38')]);_0x18b930['where']=qs[_0x4c0d('0x31')](_[_0x4c0d('0x4d')](_0xa0a7c3['query'],_0x158145[_0x4c0d('0x31')]));if(_0xa0a7c3[_0x4c0d('0x2f')]['filter']){_0x18b930[_0x4c0d('0x39')]=_['merge'](_0x18b930[_0x4c0d('0x39')],{'$or':_[_0x4c0d('0x2a')](_0x18b930['attributes'],function(_0x22ff35){var _0x3571c9={};_0x3571c9[_0x22ff35]={'$like':'%'+_0xa0a7c3[_0x4c0d('0x2f')]['filter']+'%'};return _0x3571c9;})});}_0x18b930=_[_0x4c0d('0x3b')]({},_0x18b930,_0xa0a7c3[_0x4c0d('0x3d')]);return _0x8f8fe4[_0x4c0d('0x4a')](_0x18b930);}})[_0x4c0d('0x25')](function(_0x1e11cd){if(_0x1e11cd){_0x1a5219=_0x1e11cd[_0x4c0d('0x44')];if(!_0xa0a7c3['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x18b930[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0xa0a7c3[_0x4c0d('0x2f')]['limit']);_0x18b930['offset']=qs[_0x4c0d('0x1e')](_0xa0a7c3[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x8f8fe4[_0x4c0d('0x4a')](_0x18b930);}})[_0x4c0d('0x25')](function(_0x483fc0){if(_0x483fc0){return _0x483fc0?{'count':_0x1a5219,'rows':_0x483fc0}:null;}})['then'](respondWithResult(_0x3e541,null))[_0x4c0d('0x47')](handleError(_0x3e541,null));};exports[_0x4c0d('0x4e')]=function(_0x5c7337,_0x43534f,_0x27e764){var _0x4d5324={};var _0x3fa4b9={};var _0x3cb74f;var _0x3007b3;return db[_0x4c0d('0x3e')][_0x4c0d('0x4b')]({'where':{'id':_0x5c7337[_0x4c0d('0x49')]['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x43534f,null))[_0x4c0d('0x25')](function(_0x483817){if(_0x483817){_0x3cb74f=_0x483817;_0x3fa4b9[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x3fa4b9['query']=_[_0x4c0d('0x30')](_0x5c7337[_0x4c0d('0x2f')]);_0x3fa4b9[_0x4c0d('0x31')]=_[_0x4c0d('0x32')](_0x3fa4b9[_0x4c0d('0x2e')],_0x3fa4b9['query']);_0x4d5324[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x3fa4b9[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x5c7337['query'][_0x4c0d('0x33')]));_0x4d5324[_0x4c0d('0x34')]=_0x4d5324['attributes'][_0x4c0d('0x44')]?_0x4d5324['attributes']:_0x3fa4b9[_0x4c0d('0x2e')];_0x4d5324[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x5c7337['query'][_0x4c0d('0x38')]);_0x4d5324[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_['pick'](_0x5c7337[_0x4c0d('0x2f')],_0x3fa4b9[_0x4c0d('0x31')]));if(_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x4d5324[_0x4c0d('0x39')]=_[_0x4c0d('0x3b')](_0x4d5324[_0x4c0d('0x39')],{'$or':_['map'](_0x4d5324['attributes'],function(_0x30b07d){var _0x5a8797={};_0x5a8797[_0x30b07d]={'$like':'%'+_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x5a8797;})});}_0x4d5324=_[_0x4c0d('0x3b')]({},_0x4d5324,_0x5c7337[_0x4c0d('0x3d')]);return _0x3cb74f[_0x4c0d('0x4e')](_0x4d5324);}})['then'](function(_0x20e2b8){if(_0x20e2b8){_0x3007b3=_0x20e2b8[_0x4c0d('0x44')];if(!_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x4d5324[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x4d5324[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x5c7337[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x3cb74f[_0x4c0d('0x4e')](_0x4d5324);}})['then'](function(_0x697b1f){if(_0x697b1f){return _0x697b1f?{'count':_0x3007b3,'rows':_0x697b1f}:null;}})['then'](respondWithResult(_0x43534f,null))[_0x4c0d('0x47')](handleError(_0x43534f,null));};exports[_0x4c0d('0x4f')]=function(_0x282e18,_0x2e7987,_0x48a7c0){var _0x42bb88={};var _0x4de67c={};var _0x1635c2;var _0x1a08fe;return db[_0x4c0d('0x3e')]['findOne']({'where':{'id':_0x282e18['params']['id']}})[_0x4c0d('0x25')](handleEntityNotFound(_0x2e7987,null))[_0x4c0d('0x25')](function(_0x49ce86){if(_0x49ce86){_0x1635c2=_0x49ce86;_0x4de67c[_0x4c0d('0x2e')]=_[_0x4c0d('0x30')](db[_0x4c0d('0x4c')][_0x4c0d('0x2b')]);_0x4de67c[_0x4c0d('0x2f')]=_[_0x4c0d('0x30')](_0x282e18[_0x4c0d('0x2f')]);_0x4de67c[_0x4c0d('0x31')]=_['intersection'](_0x4de67c['model'],_0x4de67c[_0x4c0d('0x2f')]);_0x42bb88[_0x4c0d('0x34')]=_[_0x4c0d('0x32')](_0x4de67c[_0x4c0d('0x2e')],qs[_0x4c0d('0x33')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x33')]));_0x42bb88[_0x4c0d('0x34')]=_0x42bb88[_0x4c0d('0x34')]['length']?_0x42bb88[_0x4c0d('0x34')]:_0x4de67c['model'];_0x42bb88[_0x4c0d('0x37')]=qs[_0x4c0d('0x38')](_0x282e18['query'][_0x4c0d('0x38')]);_0x42bb88[_0x4c0d('0x39')]=qs[_0x4c0d('0x31')](_[_0x4c0d('0x4d')](_0x282e18['query'],_0x4de67c[_0x4c0d('0x31')]));if(_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x3a')]){_0x42bb88[_0x4c0d('0x39')]=_[_0x4c0d('0x3b')](_0x42bb88[_0x4c0d('0x39')],{'$or':_[_0x4c0d('0x2a')](_0x42bb88[_0x4c0d('0x34')],function(_0x3576b2){var _0x157122={};_0x157122[_0x3576b2]={'$like':'%'+_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x3a')]+'%'};return _0x157122;})});}_0x42bb88=_[_0x4c0d('0x3b')]({},_0x42bb88,_0x282e18[_0x4c0d('0x3d')]);return _0x1635c2[_0x4c0d('0x4f')](_0x42bb88);}})[_0x4c0d('0x25')](function(_0x34a36b){if(_0x34a36b){_0x1a08fe=_0x34a36b[_0x4c0d('0x44')];if(!_0x282e18['query'][_0x4c0d('0x35')](_0x4c0d('0x36'))){_0x42bb88[_0x4c0d('0x1f')]=qs[_0x4c0d('0x1f')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x1f')]);_0x42bb88[_0x4c0d('0x1e')]=qs[_0x4c0d('0x1e')](_0x282e18[_0x4c0d('0x2f')][_0x4c0d('0x1e')]);}return _0x1635c2[_0x4c0d('0x4f')](_0x42bb88);}})[_0x4c0d('0x25')](function(_0x314dd7){if(_0x314dd7){return _0x314dd7?{'count':_0x1a08fe,'rows':_0x314dd7}:null;}})[_0x4c0d('0x25')](respondWithResult(_0x2e7987,null))[_0x4c0d('0x47')](handleError(_0x2e7987,null));}; \ No newline at end of file +var _0x1378=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x250b14,_0x3e6553){var _0x4aa169=function(_0x4d9f35){while(--_0x4d9f35){_0x250b14['push'](_0x250b14['shift']());}};_0x4aa169(++_0x3e6553);}(_0x1378,0x193));var _0x8137=function(_0x12abe6,_0x5d0327){_0x12abe6=_0x12abe6-0x0;var _0x7677cf=_0x1378[_0x12abe6];return _0x7677cf;};'use strict';var emlformat=require(_0x8137('0x0'));var rimraf=require(_0x8137('0x1'));var zipdir=require(_0x8137('0x2'));var jsonpatch=require(_0x8137('0x3'));var rp=require(_0x8137('0x4'));var moment=require(_0x8137('0x5'));var BPromise=require(_0x8137('0x6'));var Mustache=require(_0x8137('0x7'));var util=require(_0x8137('0x8'));var path=require(_0x8137('0x9'));var sox=require(_0x8137('0xa'));var csv=require(_0x8137('0xb'));var ejs=require(_0x8137('0xc'));var fs=require('fs');var fs_extra=require(_0x8137('0xd'));var _=require(_0x8137('0xe'));var squel=require(_0x8137('0xf'));var crypto=require('crypto');var jsforce=require(_0x8137('0x10'));var deskjs=require(_0x8137('0x11'));var toCsv=require(_0x8137('0xb'));var querystring=require(_0x8137('0x12'));var Papa=require('papaparse');var Redis=require(_0x8137('0x13'));var authService=require(_0x8137('0x14'));var qs=require(_0x8137('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8137('0x16'));var logger=require(_0x8137('0x17'))(_0x8137('0x18'));var utils=require('../../config/utils');var config=require(_0x8137('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8137('0x1a'))['db'];function respondWithStatusCode(_0x42dc9f,_0x517964){_0x517964=_0x517964||0xcc;return function(_0x118edd){if(_0x118edd){return _0x42dc9f[_0x8137('0x1b')](_0x517964);}return _0x42dc9f[_0x8137('0x1c')](_0x517964)['end']();};}function respondWithResult(_0x3084d8,_0xa20ad4){_0xa20ad4=_0xa20ad4||0xc8;return function(_0xd6677c){if(_0xd6677c){return _0x3084d8[_0x8137('0x1c')](_0xa20ad4)[_0x8137('0x1d')](_0xd6677c);}};}function respondWithFilteredResult(_0x179e5e,_0x560c02){return function(_0x45d212){if(_0x45d212){var _0x5da47e=typeof _0x560c02['offset']===_0x8137('0x1e')&&typeof _0x560c02['limit']===_0x8137('0x1e');var _0x2548d7=_0x45d212['count'];var _0x57c1b8=_0x5da47e?0x0:_0x560c02['offset'];var _0x1c854e=_0x5da47e?_0x45d212[_0x8137('0x1f')]:_0x560c02[_0x8137('0x20')]+_0x560c02[_0x8137('0x21')];var _0x59742d;if(_0x1c854e>=_0x2548d7){_0x1c854e=_0x2548d7;_0x59742d=0xc8;}else{_0x59742d=0xce;}_0x179e5e[_0x8137('0x1c')](_0x59742d);return _0x179e5e[_0x8137('0x22')]('Content-Range',_0x57c1b8+'-'+_0x1c854e+'/'+_0x2548d7)['json'](_0x45d212);}return null;};}function patchUpdates(_0x25cfa8){return function(_0x1b44e2){try{jsonpatch[_0x8137('0x23')](_0x1b44e2,_0x25cfa8,!![]);}catch(_0xbca022){return BPromise[_0x8137('0x24')](_0xbca022);}return _0x1b44e2[_0x8137('0x25')]();};}function saveUpdates(_0x5764ba,_0xccf305){return function(_0x2b7fca){if(_0x2b7fca){return _0x2b7fca['update'](_0x5764ba)[_0x8137('0x26')](function(_0x417eb0){return _0x417eb0;});}return null;};}function removeEntity(_0x523027,_0x42c654){return function(_0x278aba){if(_0x278aba){return _0x278aba[_0x8137('0x27')]()[_0x8137('0x26')](function(){_0x523027['status'](0xcc)[_0x8137('0x28')]();});}};}function handleEntityNotFound(_0xb4f373,_0x40a071){return function(_0x23dcc7){if(!_0x23dcc7){_0xb4f373['sendStatus'](0x194);}return _0x23dcc7;};}function handleError(_0x404b88,_0x5261b7){_0x5261b7=_0x5261b7||0x1f4;return function(_0x150a0a){logger['error'](_0x150a0a[_0x8137('0x29')]);if(_0x150a0a[_0x8137('0x2a')]){delete _0x150a0a[_0x8137('0x2a')];}_0x404b88[_0x8137('0x1c')](_0x5261b7)[_0x8137('0x2b')](_0x150a0a);};}exports[_0x8137('0x2c')]=function(_0x50d1d6,_0x68e811){var _0xe7337c={},_0x24e965={},_0x2156b1={'count':0x0,'rows':[]};var _0x7302b=_[_0x8137('0x2d')](db['FreshsalesConfiguration'][_0x8137('0x2e')],function(_0x1d3f16){return{'name':_0x1d3f16['fieldName'],'type':_0x1d3f16[_0x8137('0x2f')][_0x8137('0x30')]};});_0x24e965[_0x8137('0x31')]=_[_0x8137('0x2d')](_0x7302b,_0x8137('0x2a'));_0x24e965[_0x8137('0x32')]=_[_0x8137('0x33')](_0x50d1d6[_0x8137('0x32')]);_0x24e965[_0x8137('0x34')]=_['intersection'](_0x24e965[_0x8137('0x31')],_0x24e965[_0x8137('0x32')]);_0xe7337c[_0x8137('0x35')]=_[_0x8137('0x36')](_0x24e965[_0x8137('0x31')],qs[_0x8137('0x37')](_0x50d1d6['query'][_0x8137('0x37')]));_0xe7337c[_0x8137('0x35')]=_0xe7337c['attributes'][_0x8137('0x38')]?_0xe7337c[_0x8137('0x35')]:_0x24e965[_0x8137('0x31')];if(!_0x50d1d6[_0x8137('0x32')][_0x8137('0x39')](_0x8137('0x3a'))){_0xe7337c[_0x8137('0x21')]=qs[_0x8137('0x21')](_0x50d1d6[_0x8137('0x32')][_0x8137('0x21')]);_0xe7337c[_0x8137('0x20')]=qs[_0x8137('0x20')](_0x50d1d6['query'][_0x8137('0x20')]);}_0xe7337c[_0x8137('0x3b')]=qs['sort'](_0x50d1d6[_0x8137('0x32')][_0x8137('0x3c')]);_0xe7337c['where']=qs['filters'](_[_0x8137('0x3d')](_0x50d1d6[_0x8137('0x32')],_0x24e965[_0x8137('0x34')]),_0x7302b);if(_0x50d1d6[_0x8137('0x32')][_0x8137('0x3e')]){_0xe7337c['where']=_[_0x8137('0x3f')](_0xe7337c[_0x8137('0x40')],{'$or':_['map'](_0x7302b,function(_0x540aab){if(_0x540aab[_0x8137('0x2f')]!==_0x8137('0x41')){var _0x47aab1={};_0x47aab1[_0x540aab[_0x8137('0x2a')]]={'$like':'%'+_0x50d1d6['query']['filter']+'%'};return _0x47aab1;}})});}_0xe7337c=_[_0x8137('0x3f')]({},_0xe7337c,_0x50d1d6[_0x8137('0x42')]);var _0x55cbda={'where':_0xe7337c[_0x8137('0x40')]};return db[_0x8137('0x43')]['count'](_0x55cbda)[_0x8137('0x26')](function(_0x4fde6a){_0x2156b1[_0x8137('0x1f')]=_0x4fde6a;if(_0x50d1d6['query'][_0x8137('0x44')]){_0xe7337c[_0x8137('0x45')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x8137('0x46')](_0xe7337c);})[_0x8137('0x26')](function(_0x24c9c2){_0x2156b1[_0x8137('0x47')]=_0x24c9c2;return _0x2156b1;})[_0x8137('0x26')](respondWithFilteredResult(_0x68e811,_0xe7337c))[_0x8137('0x48')](handleError(_0x68e811,null));};exports[_0x8137('0x49')]=function(_0x38cd8b,_0x435782){var _0x1fed4b={'raw':![],'where':{'id':_0x38cd8b['params']['id']}},_0x197d8a={};_0x197d8a[_0x8137('0x31')]=_[_0x8137('0x33')](db[_0x8137('0x43')][_0x8137('0x2e')]);_0x197d8a['query']=_[_0x8137('0x33')](_0x38cd8b['query']);_0x197d8a['filters']=_[_0x8137('0x36')](_0x197d8a[_0x8137('0x31')],_0x197d8a['query']);_0x1fed4b[_0x8137('0x35')]=_[_0x8137('0x36')](_0x197d8a[_0x8137('0x31')],qs[_0x8137('0x37')](_0x38cd8b[_0x8137('0x32')][_0x8137('0x37')]));_0x1fed4b['attributes']=_0x1fed4b[_0x8137('0x35')][_0x8137('0x38')]?_0x1fed4b[_0x8137('0x35')]:_0x197d8a[_0x8137('0x31')];if(_0x38cd8b[_0x8137('0x32')]['includeAll']){_0x1fed4b[_0x8137('0x45')]=[{'all':!![]}];}_0x1fed4b=_['merge']({},_0x1fed4b,_0x38cd8b[_0x8137('0x42')]);return db['FreshsalesConfiguration'][_0x8137('0x4a')](_0x1fed4b)['then'](handleEntityNotFound(_0x435782,null))[_0x8137('0x26')](respondWithResult(_0x435782,null))['catch'](handleError(_0x435782,null));};exports['create']=function(_0x10aeac,_0x11e8fd){return db[_0x8137('0x43')][_0x8137('0x4b')](_0x10aeac[_0x8137('0x4c')],{})[_0x8137('0x26')](respondWithResult(_0x11e8fd,0xc9))[_0x8137('0x48')](handleError(_0x11e8fd,null));};exports['update']=function(_0x38f20b,_0x1e9688){if(_0x38f20b[_0x8137('0x4c')]['id']){delete _0x38f20b[_0x8137('0x4c')]['id'];}return db[_0x8137('0x43')][_0x8137('0x4a')]({'where':{'id':_0x38f20b[_0x8137('0x4d')]['id']}})[_0x8137('0x26')](handleEntityNotFound(_0x1e9688,null))[_0x8137('0x26')](saveUpdates(_0x38f20b['body'],null))[_0x8137('0x26')](respondWithResult(_0x1e9688,null))[_0x8137('0x48')](handleError(_0x1e9688,null));};exports['destroy']=function(_0x2901a6,_0x51b97f){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2901a6[_0x8137('0x4d')]['id']}})[_0x8137('0x26')](handleEntityNotFound(_0x51b97f,null))['then'](removeEntity(_0x51b97f,null))[_0x8137('0x48')](handleError(_0x51b97f,null));};exports[_0x8137('0x4e')]=function(_0x2b9d8d,_0x30308c,_0x526300){var _0x54e975={};var _0x518079={};var _0x4e95ea;var _0x405f34;return db[_0x8137('0x43')][_0x8137('0x4f')]({'where':{'id':_0x2b9d8d[_0x8137('0x4d')]['id']}})[_0x8137('0x26')](handleEntityNotFound(_0x30308c,null))[_0x8137('0x26')](function(_0x44dc88){if(_0x44dc88){_0x4e95ea=_0x44dc88;_0x518079[_0x8137('0x31')]=_[_0x8137('0x33')](db[_0x8137('0x50')][_0x8137('0x2e')]);_0x518079[_0x8137('0x32')]=_['keys'](_0x2b9d8d[_0x8137('0x32')]);_0x518079[_0x8137('0x34')]=_[_0x8137('0x36')](_0x518079['model'],_0x518079['query']);_0x54e975[_0x8137('0x35')]=_[_0x8137('0x36')](_0x518079[_0x8137('0x31')],qs[_0x8137('0x37')](_0x2b9d8d[_0x8137('0x32')][_0x8137('0x37')]));_0x54e975[_0x8137('0x35')]=_0x54e975[_0x8137('0x35')][_0x8137('0x38')]?_0x54e975[_0x8137('0x35')]:_0x518079['model'];_0x54e975[_0x8137('0x3b')]=qs[_0x8137('0x3c')](_0x2b9d8d[_0x8137('0x32')][_0x8137('0x3c')]);_0x54e975[_0x8137('0x40')]=qs[_0x8137('0x34')](_[_0x8137('0x3d')](_0x2b9d8d[_0x8137('0x32')],_0x518079[_0x8137('0x34')]));if(_0x2b9d8d['query']['filter']){_0x54e975[_0x8137('0x40')]=_[_0x8137('0x3f')](_0x54e975[_0x8137('0x40')],{'$or':_['map'](_0x54e975[_0x8137('0x35')],function(_0x18edbc){var _0x265169={};_0x265169[_0x18edbc]={'$like':'%'+_0x2b9d8d[_0x8137('0x32')][_0x8137('0x3e')]+'%'};return _0x265169;})});}_0x54e975=_[_0x8137('0x3f')]({},_0x54e975,_0x2b9d8d[_0x8137('0x42')]);return _0x4e95ea[_0x8137('0x4e')](_0x54e975);}})[_0x8137('0x26')](function(_0x138a1c){if(_0x138a1c){_0x405f34=_0x138a1c[_0x8137('0x38')];if(!_0x2b9d8d[_0x8137('0x32')][_0x8137('0x39')](_0x8137('0x3a'))){_0x54e975[_0x8137('0x21')]=qs[_0x8137('0x21')](_0x2b9d8d['query'][_0x8137('0x21')]);_0x54e975[_0x8137('0x20')]=qs[_0x8137('0x20')](_0x2b9d8d['query']['offset']);}return _0x4e95ea['getSubjects'](_0x54e975);}})[_0x8137('0x26')](function(_0x452372){if(_0x452372){return _0x452372?{'count':_0x405f34,'rows':_0x452372}:null;}})['then'](respondWithResult(_0x30308c,null))[_0x8137('0x48')](handleError(_0x30308c,null));};exports['getDescriptions']=function(_0x118f91,_0x60c6a,_0x4e43be){var _0x4519bf={};var _0xfa6733={};var _0x22bbbf;var _0xd3caaf;return db[_0x8137('0x43')]['findOne']({'where':{'id':_0x118f91['params']['id']}})['then'](handleEntityNotFound(_0x60c6a,null))[_0x8137('0x26')](function(_0x14d599){if(_0x14d599){_0x22bbbf=_0x14d599;_0xfa6733[_0x8137('0x31')]=_[_0x8137('0x33')](db['FreshsalesField'][_0x8137('0x2e')]);_0xfa6733[_0x8137('0x32')]=_[_0x8137('0x33')](_0x118f91[_0x8137('0x32')]);_0xfa6733['filters']=_['intersection'](_0xfa6733[_0x8137('0x31')],_0xfa6733['query']);_0x4519bf[_0x8137('0x35')]=_['intersection'](_0xfa6733[_0x8137('0x31')],qs['fields'](_0x118f91[_0x8137('0x32')][_0x8137('0x37')]));_0x4519bf[_0x8137('0x35')]=_0x4519bf['attributes'][_0x8137('0x38')]?_0x4519bf[_0x8137('0x35')]:_0xfa6733[_0x8137('0x31')];_0x4519bf['order']=qs[_0x8137('0x3c')](_0x118f91[_0x8137('0x32')]['sort']);_0x4519bf['where']=qs[_0x8137('0x34')](_['pick'](_0x118f91[_0x8137('0x32')],_0xfa6733[_0x8137('0x34')]));if(_0x118f91[_0x8137('0x32')][_0x8137('0x3e')]){_0x4519bf['where']=_[_0x8137('0x3f')](_0x4519bf['where'],{'$or':_['map'](_0x4519bf[_0x8137('0x35')],function(_0x353e37){var _0x164735={};_0x164735[_0x353e37]={'$like':'%'+_0x118f91[_0x8137('0x32')][_0x8137('0x3e')]+'%'};return _0x164735;})});}_0x4519bf=_[_0x8137('0x3f')]({},_0x4519bf,_0x118f91['options']);return _0x22bbbf['getDescriptions'](_0x4519bf);}})[_0x8137('0x26')](function(_0x4c7822){if(_0x4c7822){_0xd3caaf=_0x4c7822[_0x8137('0x38')];if(!_0x118f91[_0x8137('0x32')][_0x8137('0x39')](_0x8137('0x3a'))){_0x4519bf['limit']=qs[_0x8137('0x21')](_0x118f91['query'][_0x8137('0x21')]);_0x4519bf[_0x8137('0x20')]=qs[_0x8137('0x20')](_0x118f91[_0x8137('0x32')][_0x8137('0x20')]);}return _0x22bbbf[_0x8137('0x51')](_0x4519bf);}})['then'](function(_0x36b7d5){if(_0x36b7d5){return _0x36b7d5?{'count':_0xd3caaf,'rows':_0x36b7d5}:null;}})[_0x8137('0x26')](respondWithResult(_0x60c6a,null))[_0x8137('0x48')](handleError(_0x60c6a,null));};exports[_0x8137('0x52')]=function(_0x10a0a4,_0x2da3de,_0xfb7d60){var _0x4e4eeb={};var _0x135f9f={};var _0x458e9a;var _0x1a2cf9;return db['FreshsalesConfiguration'][_0x8137('0x4f')]({'where':{'id':_0x10a0a4[_0x8137('0x4d')]['id']}})[_0x8137('0x26')](handleEntityNotFound(_0x2da3de,null))[_0x8137('0x26')](function(_0x272656){if(_0x272656){_0x458e9a=_0x272656;_0x135f9f[_0x8137('0x31')]=_[_0x8137('0x33')](db['FreshsalesField'][_0x8137('0x2e')]);_0x135f9f[_0x8137('0x32')]=_[_0x8137('0x33')](_0x10a0a4['query']);_0x135f9f[_0x8137('0x34')]=_[_0x8137('0x36')](_0x135f9f[_0x8137('0x31')],_0x135f9f[_0x8137('0x32')]);_0x4e4eeb[_0x8137('0x35')]=_[_0x8137('0x36')](_0x135f9f['model'],qs[_0x8137('0x37')](_0x10a0a4[_0x8137('0x32')]['fields']));_0x4e4eeb[_0x8137('0x35')]=_0x4e4eeb[_0x8137('0x35')][_0x8137('0x38')]?_0x4e4eeb['attributes']:_0x135f9f[_0x8137('0x31')];_0x4e4eeb[_0x8137('0x3b')]=qs[_0x8137('0x3c')](_0x10a0a4['query']['sort']);_0x4e4eeb[_0x8137('0x40')]=qs[_0x8137('0x34')](_['pick'](_0x10a0a4['query'],_0x135f9f[_0x8137('0x34')]));if(_0x10a0a4[_0x8137('0x32')]['filter']){_0x4e4eeb['where']=_['merge'](_0x4e4eeb[_0x8137('0x40')],{'$or':_[_0x8137('0x2d')](_0x4e4eeb[_0x8137('0x35')],function(_0x2fad27){var _0x5ab2ed={};_0x5ab2ed[_0x2fad27]={'$like':'%'+_0x10a0a4[_0x8137('0x32')][_0x8137('0x3e')]+'%'};return _0x5ab2ed;})});}_0x4e4eeb=_[_0x8137('0x3f')]({},_0x4e4eeb,_0x10a0a4[_0x8137('0x42')]);return _0x458e9a[_0x8137('0x52')](_0x4e4eeb);}})['then'](function(_0x2f3336){if(_0x2f3336){_0x1a2cf9=_0x2f3336[_0x8137('0x38')];if(!_0x10a0a4[_0x8137('0x32')]['hasOwnProperty'](_0x8137('0x3a'))){_0x4e4eeb[_0x8137('0x21')]=qs[_0x8137('0x21')](_0x10a0a4['query'][_0x8137('0x21')]);_0x4e4eeb['offset']=qs[_0x8137('0x20')](_0x10a0a4[_0x8137('0x32')][_0x8137('0x20')]);}return _0x458e9a[_0x8137('0x52')](_0x4e4eeb);}})[_0x8137('0x26')](function(_0x1f63c3){if(_0x1f63c3){return _0x1f63c3?{'count':_0x1a2cf9,'rows':_0x1f63c3}:null;}})[_0x8137('0x26')](respondWithResult(_0x2da3de,null))[_0x8137('0x48')](handleError(_0x2da3de,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f7b33e4..64d4c8f 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 _0xaa2c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x4c0c09,_0x44481d){var _0x173e5e=function(_0x232343){while(--_0x232343){_0x4c0c09['push'](_0x4c0c09['shift']());}};_0x173e5e(++_0x44481d);}(_0xaa2c,0x1a1));var _0xcaa2=function(_0x4ea52c,_0x3fe304){_0x4ea52c=_0x4ea52c-0x0;var _0x52dbe9=_0xaa2c[_0x4ea52c];return _0x52dbe9;};'use strict';var _=require(_0xcaa2('0x0'));var util=require(_0xcaa2('0x1'));var logger=require(_0xcaa2('0x2'))(_0xcaa2('0x3'));var moment=require(_0xcaa2('0x4'));var BPromise=require(_0xcaa2('0x5'));var rp=require(_0xcaa2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa2('0x7'));var config=require(_0xcaa2('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xcaa2('0x9')]=function(_0x5de808,_0x2af53e){return _0x5de808['define'](_0xcaa2('0xa'),attributes,{'tableName':_0xcaa2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb33d=['define','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x38fcaf,_0x155787){var _0x55b3a1=function(_0x3b8506){while(--_0x3b8506){_0x38fcaf['push'](_0x38fcaf['shift']());}};_0x55b3a1(++_0x155787);}(_0xb33d,0x1d7));var _0xdb33=function(_0x192cbe,_0x3b4b43){_0x192cbe=_0x192cbe-0x0;var _0x4ce395=_0xb33d[_0x192cbe];return _0x4ce395;};'use strict';var _=require(_0xdb33('0x0'));var util=require(_0xdb33('0x1'));var logger=require('../../config/logger')(_0xdb33('0x2'));var moment=require('moment');var BPromise=require(_0xdb33('0x3'));var rp=require(_0xdb33('0x4'));var fs=require('fs');var path=require(_0xdb33('0x5'));var rimraf=require(_0xdb33('0x6'));var config=require(_0xdb33('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xdb33('0x8')]=function(_0x41127d,_0x461c7d){return _0x41127d[_0xdb33('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 038d1ab..fe7de19 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 _0xbc8d=['jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x56d952,_0x1ef93d){var _0x4fdd5a=function(_0x4ddf27){while(--_0x4ddf27){_0x56d952['push'](_0x56d952['shift']());}};_0x4fdd5a(++_0x1ef93d);}(_0xbc8d,0x66));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var util=require(_0xdbc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbc8('0x2'));var db=require(_0xdbc8('0x3'))['db'];var utils=require(_0xdbc8('0x4'));var logger=require(_0xdbc8('0x5'))(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var jayson=require(_0xdbc8('0x8'));var client=jayson[_0xdbc8('0x9')][_0xdbc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3aaf53,_0x30b62b,_0xa85c58){return new BPromise(function(_0x1afa57,_0x10487b){return client[_0xdbc8('0xb')](_0x3aaf53,_0xa85c58)[_0xdbc8('0xc')](function(_0x4c9005){logger['info'](_0xdbc8('0xd'),_0x30b62b,_0xdbc8('0xe'));logger[_0xdbc8('0xf')](_0xdbc8('0x10'),_0x30b62b,_0xdbc8('0xe'),JSON[_0xdbc8('0x11')](_0x4c9005));if(_0x4c9005[_0xdbc8('0x12')]){if(_0x4c9005['error'][_0xdbc8('0x13')]===0x1f4){logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x4c9005[_0xdbc8('0x12')][_0xdbc8('0x14')]);return _0x10487b(_0x4c9005['error'][_0xdbc8('0x14')]);}logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x4c9005['error']['message']);return _0x1afa57(_0x4c9005[_0xdbc8('0x12')][_0xdbc8('0x14')]);}else{logger[_0xdbc8('0x15')](_0xdbc8('0xd'),_0x30b62b,'request\x20sent');_0x1afa57(_0x4c9005['result']['message']);}})['catch'](function(_0x465c82){logger[_0xdbc8('0x12')](_0xdbc8('0xd'),_0x30b62b,_0x465c82);_0x10487b(_0x465c82);});});} \ No newline at end of file +var _0xe72c=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5022fe,_0x548813){var _0x2c5c9a=function(_0x742e6f){while(--_0x742e6f){_0x5022fe['push'](_0x5022fe['shift']());}};_0x2c5c9a(++_0x548813);}(_0xe72c,0x1d5));var _0xce72=function(_0xf9c2ad,_0x160fa5){_0xf9c2ad=_0xf9c2ad-0x0;var _0x49cf8b=_0xe72c[_0xf9c2ad];return _0x49cf8b;};'use strict';var _=require(_0xce72('0x0'));var util=require(_0xce72('0x1'));var moment=require('moment');var BPromise=require(_0xce72('0x2'));var rs=require(_0xce72('0x3'));var fs=require('fs');var Redis=require(_0xce72('0x4'));var db=require(_0xce72('0x5'))['db'];var utils=require(_0xce72('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xce72('0x7'));var client=jayson[_0xce72('0x8')][_0xce72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28841d,_0x3f82c1,_0x31970e){return new BPromise(function(_0x26d9ef,_0x2592ae){return client[_0xce72('0xa')](_0x28841d,_0x31970e)['then'](function(_0x5f3533){logger[_0xce72('0xb')](_0xce72('0xc'),_0x3f82c1,_0xce72('0xd'));logger[_0xce72('0xe')](_0xce72('0xf'),_0x3f82c1,_0xce72('0xd'),JSON[_0xce72('0x10')](_0x5f3533));if(_0x5f3533['error']){if(_0x5f3533[_0xce72('0x11')][_0xce72('0x12')]===0x1f4){logger[_0xce72('0x11')](_0xce72('0xc'),_0x3f82c1,_0x5f3533[_0xce72('0x11')][_0xce72('0x13')]);return _0x2592ae(_0x5f3533['error'][_0xce72('0x13')]);}logger[_0xce72('0x11')](_0xce72('0xc'),_0x3f82c1,_0x5f3533[_0xce72('0x11')][_0xce72('0x13')]);return _0x26d9ef(_0x5f3533[_0xce72('0x11')][_0xce72('0x13')]);}else{logger[_0xce72('0xb')](_0xce72('0xc'),_0x3f82c1,_0xce72('0xd'));_0x26d9ef(_0x5f3533[_0xce72('0x14')][_0xce72('0x13')]);}})[_0xce72('0x15')](function(_0x265fc1){logger[_0xce72('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3f82c1,_0x265fc1);_0x2592ae(_0x265fc1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0156269..ed0f480 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 _0x057a=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x057a,0x1a6));var _0xa057=function(_0x4157b7,_0x2080cc){_0x4157b7=_0x4157b7-0x0;var _0x2ae77c=_0x057a[_0x4157b7];return _0x2ae77c;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require('connect-timeout');var express=require(_0xa057('0x3'));var router=express['Router']();var fs_extra=require(_0xa057('0x4'));var auth=require(_0xa057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa057('0x6'));var controller=require(_0xa057('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa057('0x8')]);router[_0xa057('0x9')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0xc')]);router[_0xa057('0xd')]('/',auth[_0xa057('0xb')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa057('0x12')]);module[_0xa057('0x13')]=router; \ No newline at end of file +var _0xd3b4=['fs-extra','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x42e9c2,_0xf71604){var _0x1e7c80=function(_0x4d0109){while(--_0x4d0109){_0x42e9c2['push'](_0x42e9c2['shift']());}};_0x1e7c80(++_0xf71604);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x2d8d5a,_0x6a405d){_0x2d8d5a=_0x2d8d5a-0x0;var _0x6de2a9=_0xd3b4[_0x2d8d5a];return _0x6de2a9;};'use strict';var multer=require(_0x4d3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4d3b('0x1'));var express=require(_0x4d3b('0x2'));var router=express[_0x4d3b('0x3')]();var fs_extra=require(_0x4d3b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4d3b('0x5'));var config=require('../../config/environment');var controller=require(_0x4d3b('0x6'));router[_0x4d3b('0x7')]('/',auth[_0x4d3b('0x8')](),controller[_0x4d3b('0x9')]);router[_0x4d3b('0x7')](_0x4d3b('0xa'),auth[_0x4d3b('0x8')](),controller[_0x4d3b('0xb')]);router[_0x4d3b('0xc')]('/',auth[_0x4d3b('0x8')](),controller['create']);router[_0x4d3b('0xd')]('/:id',auth[_0x4d3b('0x8')](),controller['update']);router[_0x4d3b('0xe')](_0x4d3b('0xa'),auth[_0x4d3b('0x8')](),controller[_0x4d3b('0xf')]);module[_0x4d3b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 54e72d5..b566279 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 _0xaed3=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaed3,0x1c6));var _0x3aed=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xaed3[_0x1a8bbc];return _0x212fc2;};'use strict';var Sequelize=require(_0x3aed('0x0'));module[_0x3aed('0x1')]={'type':{'type':Sequelize[_0x3aed('0x2')](_0x3aed('0x3'),_0x3aed('0x4'),_0x3aed('0x5'),_0x3aed('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3aed('0x7')]},'key':{'type':Sequelize[_0x3aed('0x7')]},'keyType':{'type':Sequelize[_0x3aed('0x2')]('string',_0x3aed('0x4'),_0x3aed('0x5'))},'keyContent':{'type':Sequelize[_0x3aed('0x7')]},'idField':{'type':Sequelize[_0x3aed('0x7')]},'nameField':{'type':Sequelize[_0x3aed('0x7')]},'customField':{'type':Sequelize[_0x3aed('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3aed('0x7')]}}; \ No newline at end of file +var _0xca07=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist','string','variable'];(function(_0x166ad5,_0x5dd13a){var _0x41e2e6=function(_0x30d306){while(--_0x30d306){_0x166ad5['push'](_0x166ad5['shift']());}};_0x41e2e6(++_0x5dd13a);}(_0xca07,0x11b));var _0x7ca0=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0xca07[_0x37ae26];return _0x1b1902;};'use strict';var Sequelize=require(_0x7ca0('0x0'));module[_0x7ca0('0x1')]={'type':{'type':Sequelize[_0x7ca0('0x2')]('string','variable','customVariable',_0x7ca0('0x3'),_0x7ca0('0x4')),'defaultValue':_0x7ca0('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7ca0('0x2')]('string',_0x7ca0('0x6'),_0x7ca0('0x7'))},'keyContent':{'type':Sequelize[_0x7ca0('0x8')]},'idField':{'type':Sequelize[_0x7ca0('0x8')]},'nameField':{'type':Sequelize[_0x7ca0('0x8')]},'customField':{'type':Sequelize[_0x7ca0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ca0('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index e2187e3..c3a9214 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 _0x14e8=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','FreshsalesField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','catch','rimraf','fast-json-patch','moment'];(function(_0x5c6b72,_0x134dcb){var _0x45e9e3=function(_0xe7eb97){while(--_0xe7eb97){_0x5c6b72['push'](_0x5c6b72['shift']());}};_0x45e9e3(++_0x134dcb);}(_0x14e8,0x1b9));var _0x814e=function(_0x5a2b06,_0x254bbb){_0x5a2b06=_0x5a2b06-0x0;var _0x40e9b0=_0x14e8[_0x5a2b06];return _0x40e9b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x814e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x814e('0x1'));var rp=require('request-promise');var moment=require(_0x814e('0x2'));var BPromise=require(_0x814e('0x3'));var Mustache=require(_0x814e('0x4'));var util=require(_0x814e('0x5'));var path=require(_0x814e('0x6'));var sox=require('sox');var csv=require(_0x814e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x814e('0x8'));var _=require(_0x814e('0x9'));var squel=require(_0x814e('0xa'));var crypto=require('crypto');var jsforce=require(_0x814e('0xb'));var deskjs=require(_0x814e('0xc'));var toCsv=require(_0x814e('0x7'));var querystring=require(_0x814e('0xd'));var Papa=require(_0x814e('0xe'));var Redis=require(_0x814e('0xf'));var authService=require(_0x814e('0x10'));var qs=require(_0x814e('0x11'));var as=require(_0x814e('0x12'));var hardwareService=require(_0x814e('0x13'));var logger=require('../../config/logger')(_0x814e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x814e('0x15'));var db=require(_0x814e('0x16'))['db'];function respondWithStatusCode(_0x4bc2c2,_0x1340f5){_0x1340f5=_0x1340f5||0xcc;return function(_0x1995b4){if(_0x1995b4){return _0x4bc2c2[_0x814e('0x17')](_0x1340f5);}return _0x4bc2c2[_0x814e('0x18')](_0x1340f5)[_0x814e('0x19')]();};}function respondWithResult(_0x91d96b,_0x33fd74){_0x33fd74=_0x33fd74||0xc8;return function(_0x106503){if(_0x106503){return _0x91d96b[_0x814e('0x18')](_0x33fd74)[_0x814e('0x1a')](_0x106503);}};}function respondWithFilteredResult(_0x5e8870,_0x34b9b2){return function(_0x1941eb){if(_0x1941eb){var _0x5649a1=typeof _0x34b9b2[_0x814e('0x1b')]===_0x814e('0x1c')&&typeof _0x34b9b2[_0x814e('0x1d')]===_0x814e('0x1c');var _0x3514f4=_0x1941eb[_0x814e('0x1e')];var _0x421be0=_0x5649a1?0x0:_0x34b9b2['offset'];var _0x30f39f=_0x5649a1?_0x1941eb[_0x814e('0x1e')]:_0x34b9b2[_0x814e('0x1b')]+_0x34b9b2[_0x814e('0x1d')];var _0x485397;if(_0x30f39f>=_0x3514f4){_0x30f39f=_0x3514f4;_0x485397=0xc8;}else{_0x485397=0xce;}_0x5e8870['status'](_0x485397);return _0x5e8870[_0x814e('0x1f')](_0x814e('0x20'),_0x421be0+'-'+_0x30f39f+'/'+_0x3514f4)[_0x814e('0x1a')](_0x1941eb);}return null;};}function patchUpdates(_0x3e66d7){return function(_0x1d47a3){try{jsonpatch['apply'](_0x1d47a3,_0x3e66d7,!![]);}catch(_0x159539){return BPromise[_0x814e('0x21')](_0x159539);}return _0x1d47a3[_0x814e('0x22')]();};}function saveUpdates(_0x301814,_0x2bdc72){return function(_0x50097a){if(_0x50097a){return _0x50097a[_0x814e('0x23')](_0x301814)[_0x814e('0x24')](function(_0x14cb47){return _0x14cb47;});}return null;};}function removeEntity(_0x308372,_0x15aa7f){return function(_0x24b4cc){if(_0x24b4cc){return _0x24b4cc[_0x814e('0x25')]()['then'](function(){_0x308372['status'](0xcc)[_0x814e('0x19')]();});}};}function handleEntityNotFound(_0x4c18b3,_0x18afda){return function(_0x38168c){if(!_0x38168c){_0x4c18b3[_0x814e('0x17')](0x194);}return _0x38168c;};}function handleError(_0x2212a0,_0xdd8155){_0xdd8155=_0xdd8155||0x1f4;return function(_0xaab2af){logger['error'](_0xaab2af[_0x814e('0x26')]);if(_0xaab2af[_0x814e('0x27')]){delete _0xaab2af['name'];}_0x2212a0[_0x814e('0x18')](_0xdd8155)[_0x814e('0x28')](_0xaab2af);};}exports['index']=function(_0x45cf21,_0x5baa8e){var _0x2699e8={},_0x4f79fa={},_0x313374={'count':0x0,'rows':[]};var _0x384f65=_['map'](db[_0x814e('0x29')][_0x814e('0x2a')],function(_0x32ab5c){return{'name':_0x32ab5c[_0x814e('0x2b')],'type':_0x32ab5c[_0x814e('0x2c')][_0x814e('0x2d')]};});_0x4f79fa['model']=_[_0x814e('0x2e')](_0x384f65,_0x814e('0x27'));_0x4f79fa[_0x814e('0x2f')]=_[_0x814e('0x30')](_0x45cf21[_0x814e('0x2f')]);_0x4f79fa[_0x814e('0x31')]=_[_0x814e('0x32')](_0x4f79fa['model'],_0x4f79fa[_0x814e('0x2f')]);_0x2699e8[_0x814e('0x33')]=_[_0x814e('0x32')](_0x4f79fa[_0x814e('0x34')],qs[_0x814e('0x35')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x35')]));_0x2699e8['attributes']=_0x2699e8[_0x814e('0x33')][_0x814e('0x36')]?_0x2699e8[_0x814e('0x33')]:_0x4f79fa['model'];if(!_0x45cf21[_0x814e('0x2f')][_0x814e('0x37')](_0x814e('0x38'))){_0x2699e8[_0x814e('0x1d')]=qs[_0x814e('0x1d')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x1d')]);_0x2699e8['offset']=qs[_0x814e('0x1b')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x1b')]);}_0x2699e8['order']=qs[_0x814e('0x39')](_0x45cf21[_0x814e('0x2f')][_0x814e('0x39')]);_0x2699e8[_0x814e('0x3a')]=qs[_0x814e('0x31')](_[_0x814e('0x3b')](_0x45cf21['query'],_0x4f79fa[_0x814e('0x31')]),_0x384f65);if(_0x45cf21[_0x814e('0x2f')][_0x814e('0x3c')]){_0x2699e8[_0x814e('0x3a')]=_['merge'](_0x2699e8[_0x814e('0x3a')],{'$or':_[_0x814e('0x2e')](_0x384f65,function(_0x4d181b){if(_0x4d181b[_0x814e('0x2c')]!==_0x814e('0x3d')){var _0x11fc30={};_0x11fc30[_0x4d181b[_0x814e('0x27')]]={'$like':'%'+_0x45cf21['query'][_0x814e('0x3c')]+'%'};return _0x11fc30;}})});}_0x2699e8=_['merge']({},_0x2699e8,_0x45cf21[_0x814e('0x3e')]);var _0x45f882={'where':_0x2699e8[_0x814e('0x3a')]};return db['FreshsalesField'][_0x814e('0x1e')](_0x45f882)[_0x814e('0x24')](function(_0x58a218){_0x313374['count']=_0x58a218;if(_0x45cf21[_0x814e('0x2f')][_0x814e('0x3f')]){_0x2699e8[_0x814e('0x40')]=[{'all':!![]}];}return db[_0x814e('0x29')][_0x814e('0x41')](_0x2699e8);})[_0x814e('0x24')](function(_0x593c8d){_0x313374[_0x814e('0x42')]=_0x593c8d;return _0x313374;})[_0x814e('0x24')](respondWithFilteredResult(_0x5baa8e,_0x2699e8))['catch'](handleError(_0x5baa8e,null));};exports[_0x814e('0x43')]=function(_0x1a6157,_0xf80e16){var _0x41ca15={'raw':!![],'where':{'id':_0x1a6157[_0x814e('0x44')]['id']}},_0x29259c={};_0x29259c[_0x814e('0x34')]=_['keys'](db[_0x814e('0x29')][_0x814e('0x2a')]);_0x29259c[_0x814e('0x2f')]=_['keys'](_0x1a6157['query']);_0x29259c[_0x814e('0x31')]=_[_0x814e('0x32')](_0x29259c[_0x814e('0x34')],_0x29259c[_0x814e('0x2f')]);_0x41ca15['attributes']=_[_0x814e('0x32')](_0x29259c[_0x814e('0x34')],qs[_0x814e('0x35')](_0x1a6157[_0x814e('0x2f')][_0x814e('0x35')]));_0x41ca15[_0x814e('0x33')]=_0x41ca15[_0x814e('0x33')][_0x814e('0x36')]?_0x41ca15[_0x814e('0x33')]:_0x29259c['model'];if(_0x1a6157[_0x814e('0x2f')]['includeAll']){_0x41ca15['include']=[{'all':!![]}];}_0x41ca15=_[_0x814e('0x45')]({},_0x41ca15,_0x1a6157['options']);return db[_0x814e('0x29')][_0x814e('0x46')](_0x41ca15)[_0x814e('0x24')](handleEntityNotFound(_0xf80e16,null))[_0x814e('0x24')](respondWithResult(_0xf80e16,null))['catch'](handleError(_0xf80e16,null));};exports[_0x814e('0x47')]=function(_0x3b7839,_0x27370c){return db['FreshsalesField'][_0x814e('0x47')](_0x3b7839[_0x814e('0x48')],{})[_0x814e('0x24')](respondWithResult(_0x27370c,0xc9))[_0x814e('0x49')](handleError(_0x27370c,null));};exports[_0x814e('0x23')]=function(_0xcd5a66,_0x384be8){if(_0xcd5a66[_0x814e('0x48')]['id']){delete _0xcd5a66[_0x814e('0x48')]['id'];}return db['FreshsalesField'][_0x814e('0x46')]({'where':{'id':_0xcd5a66[_0x814e('0x44')]['id']}})['then'](handleEntityNotFound(_0x384be8,null))[_0x814e('0x24')](saveUpdates(_0xcd5a66[_0x814e('0x48')],null))[_0x814e('0x24')](respondWithResult(_0x384be8,null))[_0x814e('0x49')](handleError(_0x384be8,null));};exports['destroy']=function(_0x6804c1,_0x394c2c){return db[_0x814e('0x29')][_0x814e('0x46')]({'where':{'id':_0x6804c1[_0x814e('0x44')]['id']}})['then'](handleEntityNotFound(_0x394c2c,null))['then'](removeEntity(_0x394c2c,null))[_0x814e('0x49')](handleError(_0x394c2c,null));}; \ No newline at end of file +var _0x1ef9=['../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','map','FreshsalesField','rawAttributes','fieldName','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x570b11,_0x121f81){var _0xe6a752=function(_0x5a476){while(--_0x5a476){_0x570b11['push'](_0x570b11['shift']());}};_0xe6a752(++_0x121f81);}(_0x1ef9,0x19b));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91ef('0x0'));var rimraf=require(_0x91ef('0x1'));var zipdir=require(_0x91ef('0x2'));var jsonpatch=require(_0x91ef('0x3'));var rp=require(_0x91ef('0x4'));var moment=require('moment');var BPromise=require(_0x91ef('0x5'));var Mustache=require(_0x91ef('0x6'));var util=require(_0x91ef('0x7'));var path=require('path');var sox=require(_0x91ef('0x8'));var csv=require('to-csv');var ejs=require(_0x91ef('0x9'));var fs=require('fs');var fs_extra=require(_0x91ef('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91ef('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x91ef('0xc'));var querystring=require(_0x91ef('0xd'));var Papa=require(_0x91ef('0xe'));var Redis=require('ioredis');var authService=require(_0x91ef('0xf'));var qs=require(_0x91ef('0x10'));var as=require(_0x91ef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91ef('0x12'))('api');var utils=require(_0x91ef('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x91ef('0x14'));var db=require(_0x91ef('0x15'))['db'];function respondWithStatusCode(_0x32bc79,_0x5b6103){_0x5b6103=_0x5b6103||0xcc;return function(_0x55b62a){if(_0x55b62a){return _0x32bc79[_0x91ef('0x16')](_0x5b6103);}return _0x32bc79['status'](_0x5b6103)['end']();};}function respondWithResult(_0x507d37,_0x570e9b){_0x570e9b=_0x570e9b||0xc8;return function(_0x1f8729){if(_0x1f8729){return _0x507d37['status'](_0x570e9b)['json'](_0x1f8729);}};}function respondWithFilteredResult(_0x196dba,_0x3717ea){return function(_0x1c8a9a){if(_0x1c8a9a){var _0x2ddf9=typeof _0x3717ea[_0x91ef('0x17')]===_0x91ef('0x18')&&typeof _0x3717ea[_0x91ef('0x19')]==='undefined';var _0x2e2f2a=_0x1c8a9a[_0x91ef('0x1a')];var _0x4f72a5=_0x2ddf9?0x0:_0x3717ea['offset'];var _0x43b1b5=_0x2ddf9?_0x1c8a9a['count']:_0x3717ea[_0x91ef('0x17')]+_0x3717ea[_0x91ef('0x19')];var _0x50b6ce;if(_0x43b1b5>=_0x2e2f2a){_0x43b1b5=_0x2e2f2a;_0x50b6ce=0xc8;}else{_0x50b6ce=0xce;}_0x196dba[_0x91ef('0x1b')](_0x50b6ce);return _0x196dba[_0x91ef('0x1c')](_0x91ef('0x1d'),_0x4f72a5+'-'+_0x43b1b5+'/'+_0x2e2f2a)['json'](_0x1c8a9a);}return null;};}function patchUpdates(_0x3983d5){return function(_0x524444){try{jsonpatch[_0x91ef('0x1e')](_0x524444,_0x3983d5,!![]);}catch(_0x1c2024){return BPromise[_0x91ef('0x1f')](_0x1c2024);}return _0x524444[_0x91ef('0x20')]();};}function saveUpdates(_0x1a5f12,_0x3f1c43){return function(_0xaeb577){if(_0xaeb577){return _0xaeb577[_0x91ef('0x21')](_0x1a5f12)[_0x91ef('0x22')](function(_0x4feed1){return _0x4feed1;});}return null;};}function removeEntity(_0x222d29,_0x416d6c){return function(_0x3cdee9){if(_0x3cdee9){return _0x3cdee9[_0x91ef('0x23')]()['then'](function(){_0x222d29[_0x91ef('0x1b')](0xcc)[_0x91ef('0x24')]();});}};}function handleEntityNotFound(_0xab2c76,_0x3f45dc){return function(_0x313b96){if(!_0x313b96){_0xab2c76['sendStatus'](0x194);}return _0x313b96;};}function handleError(_0x42f5e4,_0xcf1797){_0xcf1797=_0xcf1797||0x1f4;return function(_0x1be495){logger[_0x91ef('0x25')](_0x1be495[_0x91ef('0x26')]);if(_0x1be495['name']){delete _0x1be495['name'];}_0x42f5e4[_0x91ef('0x1b')](_0xcf1797)['send'](_0x1be495);};}exports['index']=function(_0x4c8034,_0x407160){var _0x3b4edf={},_0x5e139c={},_0xb1c8b6={'count':0x0,'rows':[]};var _0x593639=_[_0x91ef('0x27')](db[_0x91ef('0x28')][_0x91ef('0x29')],function(_0x4a40ff){return{'name':_0x4a40ff[_0x91ef('0x2a')],'type':_0x4a40ff['type'][_0x91ef('0x2b')]};});_0x5e139c[_0x91ef('0x2c')]=_[_0x91ef('0x27')](_0x593639,_0x91ef('0x2d'));_0x5e139c[_0x91ef('0x2e')]=_['keys'](_0x4c8034[_0x91ef('0x2e')]);_0x5e139c['filters']=_[_0x91ef('0x2f')](_0x5e139c[_0x91ef('0x2c')],_0x5e139c[_0x91ef('0x2e')]);_0x3b4edf[_0x91ef('0x30')]=_[_0x91ef('0x2f')](_0x5e139c['model'],qs[_0x91ef('0x31')](_0x4c8034[_0x91ef('0x2e')]['fields']));_0x3b4edf['attributes']=_0x3b4edf[_0x91ef('0x30')][_0x91ef('0x32')]?_0x3b4edf[_0x91ef('0x30')]:_0x5e139c[_0x91ef('0x2c')];if(!_0x4c8034['query'][_0x91ef('0x33')](_0x91ef('0x34'))){_0x3b4edf['limit']=qs[_0x91ef('0x19')](_0x4c8034['query'][_0x91ef('0x19')]);_0x3b4edf[_0x91ef('0x17')]=qs[_0x91ef('0x17')](_0x4c8034[_0x91ef('0x2e')][_0x91ef('0x17')]);}_0x3b4edf[_0x91ef('0x35')]=qs[_0x91ef('0x36')](_0x4c8034[_0x91ef('0x2e')][_0x91ef('0x36')]);_0x3b4edf['where']=qs[_0x91ef('0x37')](_['pick'](_0x4c8034[_0x91ef('0x2e')],_0x5e139c[_0x91ef('0x37')]),_0x593639);if(_0x4c8034[_0x91ef('0x2e')][_0x91ef('0x38')]){_0x3b4edf[_0x91ef('0x39')]=_['merge'](_0x3b4edf[_0x91ef('0x39')],{'$or':_[_0x91ef('0x27')](_0x593639,function(_0x5626e9){if(_0x5626e9[_0x91ef('0x3a')]!==_0x91ef('0x3b')){var _0x393522={};_0x393522[_0x5626e9['name']]={'$like':'%'+_0x4c8034['query']['filter']+'%'};return _0x393522;}})});}_0x3b4edf=_[_0x91ef('0x3c')]({},_0x3b4edf,_0x4c8034[_0x91ef('0x3d')]);var _0x45059d={'where':_0x3b4edf['where']};return db[_0x91ef('0x28')][_0x91ef('0x1a')](_0x45059d)[_0x91ef('0x22')](function(_0x5caa19){_0xb1c8b6[_0x91ef('0x1a')]=_0x5caa19;if(_0x4c8034['query'][_0x91ef('0x3e')]){_0x3b4edf[_0x91ef('0x3f')]=[{'all':!![]}];}return db[_0x91ef('0x28')][_0x91ef('0x40')](_0x3b4edf);})['then'](function(_0x3c429f){_0xb1c8b6[_0x91ef('0x41')]=_0x3c429f;return _0xb1c8b6;})[_0x91ef('0x22')](respondWithFilteredResult(_0x407160,_0x3b4edf))[_0x91ef('0x42')](handleError(_0x407160,null));};exports['show']=function(_0x5f459a,_0x30a2bf){var _0x18f291={'raw':!![],'where':{'id':_0x5f459a[_0x91ef('0x43')]['id']}},_0x240849={};_0x240849[_0x91ef('0x2c')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x240849[_0x91ef('0x2e')]=_[_0x91ef('0x44')](_0x5f459a[_0x91ef('0x2e')]);_0x240849['filters']=_['intersection'](_0x240849[_0x91ef('0x2c')],_0x240849[_0x91ef('0x2e')]);_0x18f291['attributes']=_[_0x91ef('0x2f')](_0x240849[_0x91ef('0x2c')],qs[_0x91ef('0x31')](_0x5f459a['query']['fields']));_0x18f291[_0x91ef('0x30')]=_0x18f291[_0x91ef('0x30')][_0x91ef('0x32')]?_0x18f291[_0x91ef('0x30')]:_0x240849[_0x91ef('0x2c')];if(_0x5f459a[_0x91ef('0x2e')][_0x91ef('0x3e')]){_0x18f291[_0x91ef('0x3f')]=[{'all':!![]}];}_0x18f291=_['merge']({},_0x18f291,_0x5f459a[_0x91ef('0x3d')]);return db[_0x91ef('0x28')][_0x91ef('0x45')](_0x18f291)[_0x91ef('0x22')](handleEntityNotFound(_0x30a2bf,null))[_0x91ef('0x22')](respondWithResult(_0x30a2bf,null))[_0x91ef('0x42')](handleError(_0x30a2bf,null));};exports[_0x91ef('0x46')]=function(_0xde74a7,_0x4be3b6){return db[_0x91ef('0x28')][_0x91ef('0x46')](_0xde74a7[_0x91ef('0x47')],{})[_0x91ef('0x22')](respondWithResult(_0x4be3b6,0xc9))[_0x91ef('0x42')](handleError(_0x4be3b6,null));};exports[_0x91ef('0x21')]=function(_0xb1d4f1,_0x460931){if(_0xb1d4f1[_0x91ef('0x47')]['id']){delete _0xb1d4f1[_0x91ef('0x47')]['id'];}return db[_0x91ef('0x28')][_0x91ef('0x45')]({'where':{'id':_0xb1d4f1['params']['id']}})[_0x91ef('0x22')](handleEntityNotFound(_0x460931,null))[_0x91ef('0x22')](saveUpdates(_0xb1d4f1[_0x91ef('0x47')],null))['then'](respondWithResult(_0x460931,null))[_0x91ef('0x42')](handleError(_0x460931,null));};exports[_0x91ef('0x23')]=function(_0x5caa03,_0x4d5fd7){return db[_0x91ef('0x28')][_0x91ef('0x45')]({'where':{'id':_0x5caa03[_0x91ef('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d5fd7,null))['then'](removeEntity(_0x4d5fd7,null))[_0x91ef('0x42')](handleError(_0x4d5fd7,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 133960d..15c2030 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 _0x45d8=['path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x47dd85,_0x2c5ce3){var _0x11356a=function(_0x22146c){while(--_0x22146c){_0x47dd85['push'](_0x47dd85['shift']());}};_0x11356a(++_0x2c5ce3);}(_0x45d8,0x174));var _0x845d=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0x45d8[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var logger=require(_0x845d('0x2'))(_0x845d('0x3'));var moment=require(_0x845d('0x4'));var BPromise=require(_0x845d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x845d('0x6'));var rimraf=require('rimraf');var config=require(_0x845d('0x7'));var attributes=require(_0x845d('0x8'));module['exports']=function(_0x4ba664,_0x312806){return _0x4ba664['define'](_0x845d('0x9'),attributes,{'tableName':_0x845d('0xa'),'paranoid':![],'indexes':[{'name':_0x845d('0xb'),'fields':[_0x845d('0xc'),_0x845d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49db=['FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','idField'];(function(_0x368b08,_0x5cd2ae){var _0x295c93=function(_0x3c08b2){while(--_0x3c08b2){_0x368b08['push'](_0x368b08['shift']());}};_0x295c93(++_0x5cd2ae);}(_0x49db,0xc5));var _0xb49d=function(_0x211a0e,_0x12ab51){_0x211a0e=_0x211a0e-0x0;var _0x554e36=_0x49db[_0x211a0e];return _0x554e36;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var logger=require(_0xb49d('0x2'))(_0xb49d('0x3'));var moment=require(_0xb49d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb49d('0x5'));var fs=require('fs');var path=require(_0xb49d('0x6'));var rimraf=require(_0xb49d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb49d('0x8'));module['exports']=function(_0x4c6887,_0x144a9a){return _0x4c6887[_0xb49d('0x9')](_0xb49d('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xb49d('0xb'),'fields':[_0xb49d('0xc'),_0xb49d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index da16359..601c9dd 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 _0x1261=['then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4b62a6,_0x4a4e4f){var _0x39e3fa=function(_0xf5b0d1){while(--_0xf5b0d1){_0x4b62a6['push'](_0x4b62a6['shift']());}};_0x39e3fa(++_0x4a4e4f);}(_0x1261,0x144));var _0x1126=function(_0x114ae4,_0x14bdc9){_0x114ae4=_0x114ae4-0x0;var _0x32f566=_0x1261[_0x114ae4];return _0x32f566;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x687b,0x14a));var _0xb687=function(_0x41a60b,_0xc398d){_0x41a60b=_0x41a60b-0x0;var _0x10c95a=_0x687b[_0x41a60b];return _0x10c95a;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e32246b..1f4ae1f 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2f2fcb,_0x5d36b0){var _0x386b00=function(_0x57d13f){while(--_0x57d13f){_0x2f2fcb['push'](_0x2f2fcb['shift']());}};_0x386b00(++_0x5d36b0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5c8803,_0x19744c){var _0x54ab23=function(_0x48571b){while(--_0x48571b){_0x5c8803['push'](_0x5c8803['shift']());}};_0x54ab23(++_0x19744c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 c988d74..3be2d08 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 _0x093f=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x093f,0xd2));var _0xf093=function(_0x16023c,_0x6305c9){_0x16023c=_0x16023c-0x0;var _0x230534=_0x093f[_0x16023c];return _0x230534;};'use strict';var Sequelize=require(_0xf093('0x0'));module[_0xf093('0x1')]={'name':{'type':Sequelize[_0xf093('0x2')]},'description':{'type':Sequelize[_0xf093('0x2')]},'username':{'type':Sequelize[_0xf093('0x2')],'unique':_0xf093('0x3')},'remoteUri':{'type':Sequelize[_0xf093('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xf093('0x2')]},'clientSecret':{'type':Sequelize[_0xf093('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf093('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf093('0x4')](_0xf093('0x5'),_0xf093('0x6')),'defaultValue':_0xf093('0x5')}}; \ No newline at end of file +var _0xfef9=['newTab','sequelize','exports','STRING','integrationTab'];(function(_0x3a7479,_0x4c52fe){var _0x1241e1=function(_0x44284f){while(--_0x44284f){_0x3a7479['push'](_0x3a7479['shift']());}};_0x1241e1(++_0x4c52fe);}(_0xfef9,0xd3));var _0x9fef=function(_0xbf1132,_0x176b34){_0xbf1132=_0xbf1132-0x0;var _0xe63ce4=_0xfef9[_0xbf1132];return _0xe63ce4;};'use strict';var Sequelize=require(_0x9fef('0x0'));module[_0x9fef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9fef('0x2')]},'username':{'type':Sequelize[_0x9fef('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x9fef('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9fef('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x9fef('0x2')]},'serverUrl':{'type':Sequelize[_0x9fef('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9fef('0x3'),_0x9fef('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 996eefe..887808a 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 _0xd6e7=['update','then','destroy','end','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','Connection','login','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','string','int','picklist','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save'];(function(_0x2d0c35,_0x4a61b7){var _0x38c831=function(_0x347369){while(--_0x347369){_0x2d0c35['push'](_0x2d0c35['shift']());}};_0x38c831(++_0x4a61b7);}(_0xd6e7,0x157));var _0x7d6e=function(_0x5e6e0d,_0x16ab7e){_0x5e6e0d=_0x5e6e0d-0x0;var _0x129048=_0xd6e7[_0x5e6e0d];return _0x129048;};'use strict';var emlformat=require(_0x7d6e('0x0'));var rimraf=require(_0x7d6e('0x1'));var zipdir=require(_0x7d6e('0x2'));var jsonpatch=require(_0x7d6e('0x3'));var rp=require(_0x7d6e('0x4'));var moment=require(_0x7d6e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7d6e('0x6'));var util=require(_0x7d6e('0x7'));var path=require(_0x7d6e('0x8'));var sox=require(_0x7d6e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d6e('0xa'));var _=require(_0x7d6e('0xb'));var squel=require(_0x7d6e('0xc'));var crypto=require(_0x7d6e('0xd'));var jsforce=require(_0x7d6e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d6e('0xf'));var querystring=require(_0x7d6e('0x10'));var Papa=require(_0x7d6e('0x11'));var Redis=require(_0x7d6e('0x12'));var authService=require(_0x7d6e('0x13'));var qs=require(_0x7d6e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d6e('0x15'));var logger=require(_0x7d6e('0x16'))(_0x7d6e('0x17'));var utils=require(_0x7d6e('0x18'));var config=require(_0x7d6e('0x19'));var licenseUtil=require(_0x7d6e('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7d6e('0x1b'));function respondWithStatusCode(_0x322348,_0x4079b5){_0x4079b5=_0x4079b5||0xcc;return function(_0x12a30c){if(_0x12a30c){return _0x322348[_0x7d6e('0x1c')](_0x4079b5);}return _0x322348[_0x7d6e('0x1d')](_0x4079b5)['end']();};}function respondWithResult(_0x14c757,_0x359300){_0x359300=_0x359300||0xc8;return function(_0x57dd46){if(_0x57dd46){return _0x14c757[_0x7d6e('0x1d')](_0x359300)[_0x7d6e('0x1e')](_0x57dd46);}};}function respondWithFilteredResult(_0x1fcf6d,_0x4b289d){return function(_0x3a2b1f){if(_0x3a2b1f){var _0xbf9d09=typeof _0x4b289d[_0x7d6e('0x1f')]==='undefined'&&typeof _0x4b289d[_0x7d6e('0x20')]===_0x7d6e('0x21');var _0x4ad585=_0x3a2b1f[_0x7d6e('0x22')];var _0x4b0593=_0xbf9d09?0x0:_0x4b289d[_0x7d6e('0x1f')];var _0x36f792=_0xbf9d09?_0x3a2b1f[_0x7d6e('0x22')]:_0x4b289d[_0x7d6e('0x1f')]+_0x4b289d[_0x7d6e('0x20')];var _0xf5dd4a;if(_0x36f792>=_0x4ad585){_0x36f792=_0x4ad585;_0xf5dd4a=0xc8;}else{_0xf5dd4a=0xce;}_0x1fcf6d[_0x7d6e('0x1d')](_0xf5dd4a);return _0x1fcf6d['set'](_0x7d6e('0x23'),_0x4b0593+'-'+_0x36f792+'/'+_0x4ad585)['json'](_0x3a2b1f);}return null;};}function patchUpdates(_0x2c4075){return function(_0x13a7cd){try{jsonpatch[_0x7d6e('0x24')](_0x13a7cd,_0x2c4075,!![]);}catch(_0x5d2060){return BPromise['reject'](_0x5d2060);}return _0x13a7cd[_0x7d6e('0x25')]();};}function saveUpdates(_0x3da7a0,_0xc6bed2){return function(_0x56c2cc){if(_0x56c2cc){return _0x56c2cc[_0x7d6e('0x26')](_0x3da7a0)[_0x7d6e('0x27')](function(_0x582cda){return _0x582cda;});}return null;};}function removeEntity(_0x18295b,_0x89486e){return function(_0x3a7568){if(_0x3a7568){return _0x3a7568[_0x7d6e('0x28')]()[_0x7d6e('0x27')](function(){_0x18295b[_0x7d6e('0x1d')](0xcc)[_0x7d6e('0x29')]();});}};}function handleEntityNotFound(_0x189eca,_0x36d2a1){return function(_0x3a2cb2){if(!_0x3a2cb2){_0x189eca[_0x7d6e('0x1c')](0x194);}return _0x3a2cb2;};}function handleError(_0x5689ab,_0x41047b){_0x41047b=_0x41047b||0x1f4;return function(_0x396e42){logger['error'](_0x396e42[_0x7d6e('0x2a')]);if(_0x396e42[_0x7d6e('0x2b')]){delete _0x396e42[_0x7d6e('0x2b')];}_0x5689ab[_0x7d6e('0x1d')](_0x41047b)[_0x7d6e('0x2c')](_0x396e42);};}exports[_0x7d6e('0x2d')]=function(_0xdd4341,_0x11befd){var _0xfa34b7={},_0x3a9292={},_0x754ad7={'count':0x0,'rows':[]};var _0x19ad74=_[_0x7d6e('0x2e')](db[_0x7d6e('0x2f')][_0x7d6e('0x30')],function(_0x35b1ea){return{'name':_0x35b1ea[_0x7d6e('0x31')],'type':_0x35b1ea[_0x7d6e('0x32')][_0x7d6e('0x33')]};});_0x3a9292[_0x7d6e('0x34')]=_[_0x7d6e('0x2e')](_0x19ad74,_0x7d6e('0x2b'));_0x3a9292['query']=_[_0x7d6e('0x35')](_0xdd4341[_0x7d6e('0x36')]);_0x3a9292[_0x7d6e('0x37')]=_[_0x7d6e('0x38')](_0x3a9292[_0x7d6e('0x34')],_0x3a9292[_0x7d6e('0x36')]);_0xfa34b7[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x3a9292[_0x7d6e('0x34')],qs[_0x7d6e('0x3a')](_0xdd4341['query']['fields']));_0xfa34b7[_0x7d6e('0x39')]=_0xfa34b7[_0x7d6e('0x39')][_0x7d6e('0x3b')]?_0xfa34b7[_0x7d6e('0x39')]:_0x3a9292['model'];if(!_0xdd4341['query'][_0x7d6e('0x3c')]('nolimit')){_0xfa34b7['limit']=qs[_0x7d6e('0x20')](_0xdd4341[_0x7d6e('0x36')][_0x7d6e('0x20')]);_0xfa34b7[_0x7d6e('0x1f')]=qs['offset'](_0xdd4341['query'][_0x7d6e('0x1f')]);}_0xfa34b7[_0x7d6e('0x3d')]=qs[_0x7d6e('0x3e')](_0xdd4341[_0x7d6e('0x36')]['sort']);_0xfa34b7[_0x7d6e('0x3f')]=qs['filters'](_['pick'](_0xdd4341['query'],_0x3a9292[_0x7d6e('0x37')]),_0x19ad74);if(_0xdd4341['query'][_0x7d6e('0x40')]){_0xfa34b7['where']=_[_0x7d6e('0x41')](_0xfa34b7[_0x7d6e('0x3f')],{'$or':_[_0x7d6e('0x2e')](_0x19ad74,function(_0x1f1d5b){if(_0x1f1d5b['type']!==_0x7d6e('0x42')){var _0x200f9c={};_0x200f9c[_0x1f1d5b[_0x7d6e('0x2b')]]={'$like':'%'+_0xdd4341[_0x7d6e('0x36')]['filter']+'%'};return _0x200f9c;}})});}_0xfa34b7=_[_0x7d6e('0x41')]({},_0xfa34b7,_0xdd4341[_0x7d6e('0x43')]);var _0x11e280={'where':_0xfa34b7[_0x7d6e('0x3f')]};return db[_0x7d6e('0x2f')][_0x7d6e('0x22')](_0x11e280)[_0x7d6e('0x27')](function(_0x4c34b1){_0x754ad7[_0x7d6e('0x22')]=_0x4c34b1;if(_0xdd4341['query'][_0x7d6e('0x44')]){_0xfa34b7[_0x7d6e('0x45')]=[{'all':!![]}];}return db[_0x7d6e('0x2f')][_0x7d6e('0x46')](_0xfa34b7);})[_0x7d6e('0x27')](function(_0x2d72bf){_0x754ad7[_0x7d6e('0x47')]=_0x2d72bf;return _0x754ad7;})['then'](respondWithFilteredResult(_0x11befd,_0xfa34b7))['catch'](handleError(_0x11befd,null));};exports['show']=function(_0x116cfd,_0x152ed3){var _0x1235cc={'raw':![],'where':{'id':_0x116cfd['params']['id']}},_0x3c0da1={};_0x3c0da1[_0x7d6e('0x34')]=_[_0x7d6e('0x35')](db[_0x7d6e('0x2f')]['rawAttributes']);_0x3c0da1[_0x7d6e('0x36')]=_[_0x7d6e('0x35')](_0x116cfd['query']);_0x3c0da1[_0x7d6e('0x37')]=_['intersection'](_0x3c0da1[_0x7d6e('0x34')],_0x3c0da1[_0x7d6e('0x36')]);_0x1235cc[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x3c0da1[_0x7d6e('0x34')],qs[_0x7d6e('0x3a')](_0x116cfd[_0x7d6e('0x36')][_0x7d6e('0x3a')]));_0x1235cc[_0x7d6e('0x39')]=_0x1235cc['attributes'][_0x7d6e('0x3b')]?_0x1235cc[_0x7d6e('0x39')]:_0x3c0da1['model'];if(_0x116cfd[_0x7d6e('0x36')][_0x7d6e('0x44')]){_0x1235cc['include']=[{'all':!![]}];}_0x1235cc=_[_0x7d6e('0x41')]({},_0x1235cc,_0x116cfd[_0x7d6e('0x43')]);return db[_0x7d6e('0x2f')][_0x7d6e('0x48')](_0x1235cc)[_0x7d6e('0x27')](handleEntityNotFound(_0x152ed3,null))[_0x7d6e('0x27')](respondWithResult(_0x152ed3,null))[_0x7d6e('0x49')](handleError(_0x152ed3,null));};exports[_0x7d6e('0x4a')]=function(_0x148a9f,_0x1fe2e0){return db[_0x7d6e('0x2f')][_0x7d6e('0x4a')](_0x148a9f['body'],{})[_0x7d6e('0x27')](respondWithResult(_0x1fe2e0,0xc9))[_0x7d6e('0x49')](handleError(_0x1fe2e0,null));};exports[_0x7d6e('0x26')]=function(_0xb30962,_0x42a874){if(_0xb30962[_0x7d6e('0x4b')]['id']){delete _0xb30962['body']['id'];}return db[_0x7d6e('0x2f')][_0x7d6e('0x48')]({'where':{'id':_0xb30962['params']['id']}})['then'](handleEntityNotFound(_0x42a874,null))['then'](saveUpdates(_0xb30962[_0x7d6e('0x4b')],null))[_0x7d6e('0x27')](respondWithResult(_0x42a874,null))[_0x7d6e('0x49')](handleError(_0x42a874,null));};exports['destroy']=function(_0x35ef2f,_0x34123a){return db[_0x7d6e('0x2f')]['find']({'where':{'id':_0x35ef2f[_0x7d6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34123a,null))[_0x7d6e('0x27')](removeEntity(_0x34123a,null))[_0x7d6e('0x49')](handleError(_0x34123a,null));};exports[_0x7d6e('0x4d')]=function(_0x2aa558,_0x1e6a90,_0x7ac332){var _0x4ba0e1={};var _0x4219bd={};var _0x3b5041;var _0x5c65fd;return db['SalesforceAccount'][_0x7d6e('0x4e')]({'where':{'id':_0x2aa558[_0x7d6e('0x4c')]['id']}})[_0x7d6e('0x27')](handleEntityNotFound(_0x1e6a90,null))[_0x7d6e('0x27')](function(_0xd0f505){if(_0xd0f505){_0x3b5041=_0xd0f505;_0x4219bd[_0x7d6e('0x34')]=_[_0x7d6e('0x35')](db[_0x7d6e('0x4f')][_0x7d6e('0x30')]);_0x4219bd[_0x7d6e('0x36')]=_[_0x7d6e('0x35')](_0x2aa558['query']);_0x4219bd[_0x7d6e('0x37')]=_[_0x7d6e('0x38')](_0x4219bd['model'],_0x4219bd['query']);_0x4ba0e1[_0x7d6e('0x39')]=_[_0x7d6e('0x38')](_0x4219bd['model'],qs['fields'](_0x2aa558['query'][_0x7d6e('0x3a')]));_0x4ba0e1['attributes']=_0x4ba0e1[_0x7d6e('0x39')][_0x7d6e('0x3b')]?_0x4ba0e1[_0x7d6e('0x39')]:_0x4219bd[_0x7d6e('0x34')];_0x4ba0e1['order']=qs['sort'](_0x2aa558['query'][_0x7d6e('0x3e')]);_0x4ba0e1[_0x7d6e('0x3f')]=qs[_0x7d6e('0x37')](_[_0x7d6e('0x50')](_0x2aa558['query'],_0x4219bd[_0x7d6e('0x37')]));if(_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x40')]){_0x4ba0e1[_0x7d6e('0x3f')]=_[_0x7d6e('0x41')](_0x4ba0e1['where'],{'$or':_[_0x7d6e('0x2e')](_0x4ba0e1[_0x7d6e('0x39')],function(_0x5c1de9){var _0x6035ce={};_0x6035ce[_0x5c1de9]={'$like':'%'+_0x2aa558[_0x7d6e('0x36')]['filter']+'%'};return _0x6035ce;})});}_0x4ba0e1=_[_0x7d6e('0x41')]({},_0x4ba0e1,_0x2aa558[_0x7d6e('0x43')]);return _0x3b5041[_0x7d6e('0x4d')](_0x4ba0e1);}})[_0x7d6e('0x27')](function(_0x11a916){if(_0x11a916){_0x5c65fd=_0x11a916[_0x7d6e('0x3b')];if(!_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x3c')](_0x7d6e('0x51'))){_0x4ba0e1[_0x7d6e('0x20')]=qs[_0x7d6e('0x20')](_0x2aa558['query'][_0x7d6e('0x20')]);_0x4ba0e1[_0x7d6e('0x1f')]=qs[_0x7d6e('0x1f')](_0x2aa558[_0x7d6e('0x36')][_0x7d6e('0x1f')]);}return _0x3b5041['getConfigurations'](_0x4ba0e1);}})[_0x7d6e('0x27')](function(_0x197a25){if(_0x197a25){return _0x197a25?{'count':_0x5c65fd,'rows':_0x197a25}:null;}})[_0x7d6e('0x27')](respondWithResult(_0x1e6a90,null))['catch'](handleError(_0x1e6a90,null));};exports[_0x7d6e('0x52')]=function(_0x1e1602,_0x2dbfff,_0x2eb0a5){if(_0x1e1602['body']['id']){delete _0x1e1602[_0x7d6e('0x4b')]['id'];}return db[_0x7d6e('0x2f')][_0x7d6e('0x4e')]({'where':{'id':_0x1e1602[_0x7d6e('0x4c')]['id']}})[_0x7d6e('0x27')](handleEntityNotFound(_0x2dbfff,null))['then'](function(_0x54c849){if(_0x54c849){_0x1e1602['body'][_0x7d6e('0x53')]=_0x54c849['id'];_0x1e1602['body'][_0x7d6e('0x54')]=integrations[_0x7d6e('0x55')](_0x1e1602[_0x7d6e('0x4b')]['channel'],_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x32')]);_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x56')]=integrations[_0x7d6e('0x57')](_0x1e1602['body'][_0x7d6e('0x58')],_0x1e1602[_0x7d6e('0x4b')][_0x7d6e('0x32')]);return db[_0x7d6e('0x4f')][_0x7d6e('0x4a')](_0x1e1602[_0x7d6e('0x4b')],{'include':[{'model':db[_0x7d6e('0x59')],'as':_0x7d6e('0x54')},{'model':db['SalesforceField'],'as':_0x7d6e('0x56')}]});}return null;})[_0x7d6e('0x27')](respondWithResult(_0x2dbfff,null))[_0x7d6e('0x49')](handleError(_0x2dbfff,null));};exports[_0x7d6e('0x5a')]=function(_0x4b7bd1,_0x2de7e7,_0xc4be4d){var _0x12b0b7;var _0xc37352='';var _0x1f890c=_0x7d6e('0x5b');return db[_0x7d6e('0x2f')][_0x7d6e('0x4e')]({'where':{'id':_0x4b7bd1[_0x7d6e('0x4c')]['id']},'attributes':['id',_0x7d6e('0x5c'),_0x7d6e('0x5d'),_0x7d6e('0x5e'),_0x7d6e('0x5f'),_0x7d6e('0x60'),_0x7d6e('0x61')]})[_0x7d6e('0x27')](handleEntityNotFound(_0x2de7e7,null))[_0x7d6e('0x27')](function(_0x3814af){if(_0x3814af){_0xc37352=_0x3814af[_0x7d6e('0x5c')];var _0xcebea7=_0xc37352[_0x7d6e('0x62')](-0x1);if(_0xcebea7==='/'){_0xc37352=_0xc37352['substring'](0x0,_0xc37352['lastIndexOf'](_0xcebea7));}_0x12b0b7=new jsforce[(_0x7d6e('0x63'))]({'oauth2':{'loginUrl':_0xc37352,'clientId':_0x3814af[_0x7d6e('0x5d')],'clientSecret':_0x3814af[_0x7d6e('0x5e')]}});return _0x12b0b7[_0x7d6e('0x64')](_0x3814af[_0x7d6e('0x5f')],_0x3814af[_0x7d6e('0x60')]['concat'](_0x3814af[_0x7d6e('0x61')]));}})[_0x7d6e('0x27')](function(_0x2bb83a){if(_0x2bb83a){if(!_['isNil'](_0x4b7bd1[_0x7d6e('0x36')][_0x7d6e('0x65')])){_0x1f890c=_0x4b7bd1[_0x7d6e('0x36')]['ticketType'];}return _0x12b0b7[_0x7d6e('0x66')](_0x1f890c)[_0x7d6e('0x67')]();}})[_0x7d6e('0x27')](function(_0x4b3704){var _0x506247=[_0x7d6e('0x68'),_0x7d6e('0x69'),'IsReminderSet',_0x7d6e('0x6a'),_0x7d6e('0x6b'),'Description'];var _0x1be3ed=[_0x7d6e('0x6c'),_0x7d6e('0x6d'),_0x7d6e('0x6e'),'boolean',_0x7d6e('0x6f'),_0x7d6e('0x70'),_0x7d6e('0x71')];if(_0x4b3704){_[_0x7d6e('0x72')](_0x4b3704[_0x7d6e('0x3a')],function(_0x2e3cab){return _0x506247[_0x7d6e('0x73')](_0x2e3cab[_0x7d6e('0x2b')])||!_0x1be3ed[_0x7d6e('0x73')](_0x2e3cab['type']);});return{'count':_0x4b3704[_0x7d6e('0x3a')][_0x7d6e('0x3b')],'rows':_['map'](_0x4b3704[_0x7d6e('0x3a')],function(_0x28db7a){return{'id':_0x28db7a[_0x7d6e('0x2b')],'name':_0x28db7a['label'],'custom':_0x28db7a[_0x7d6e('0x74')],'options':_0x28db7a[_0x7d6e('0x75')][_0x7d6e('0x3b')]>0x0?_[_0x7d6e('0x2e')](_0x28db7a[_0x7d6e('0x75')],function(_0x44f1e0){return{'name':_0x44f1e0[_0x7d6e('0x76')],'value':_0x44f1e0[_0x7d6e('0x77')]};}):_0x28db7a[_0x7d6e('0x32')]=='boolean'?[{'name':_0x7d6e('0x78'),'value':_0x7d6e('0x79')},{'name':'False','value':'false'}]:[]};})};}})[_0x7d6e('0x27')](respondWithResult(_0x2de7e7,null))[_0x7d6e('0x49')](function(_0x31cf1c){var _0x156b57=_0x4b7bd1['query'][_0x7d6e('0x7a')]?0x1f4:_0x31cf1c['statusCode']||0x1f4;logger[_0x7d6e('0x7b')](_0x7d6e('0x7c'),_0x7d6e('0x5a'),_0x156b57,JSON[_0x7d6e('0x7d')](_0x31cf1c));delete _0x31cf1c['name'];if(_0x156b57===0x191){_0x156b57=0x190;}_0x2de7e7[_0x7d6e('0x1d')](_0x156b57)[_0x7d6e('0x2c')](_0x4b7bd1[_0x7d6e('0x36')][_0x7d6e('0x7a')]?{'message':_0x7d6e('0x7e'),'statusCode':_0x31cf1c['statusCode']}:_0x31cf1c);});}; \ No newline at end of file +var _0x81a2=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','find','create','body','update','params','findOne','SalesforceConfiguration','hasOwnProperty','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','email','textarea','includes','custom','picklistValues','value','boolean','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','save','then','destroy','error','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','name','keys','query'];(function(_0x1f1a46,_0x500d95){var _0x483b2a=function(_0x30d559){while(--_0x30d559){_0x1f1a46['push'](_0x1f1a46['shift']());}};_0x483b2a(++_0x500d95);}(_0x81a2,0x13a));var _0x281a=function(_0x5903e1,_0x26da2a){_0x5903e1=_0x5903e1-0x0;var _0x339841=_0x81a2[_0x5903e1];return _0x339841;};'use strict';var emlformat=require(_0x281a('0x0'));var rimraf=require(_0x281a('0x1'));var zipdir=require(_0x281a('0x2'));var jsonpatch=require(_0x281a('0x3'));var rp=require(_0x281a('0x4'));var moment=require(_0x281a('0x5'));var BPromise=require(_0x281a('0x6'));var Mustache=require(_0x281a('0x7'));var util=require(_0x281a('0x8'));var path=require(_0x281a('0x9'));var sox=require('sox');var csv=require(_0x281a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x281a('0xb'));var squel=require('squel');var crypto=require(_0x281a('0xc'));var jsforce=require(_0x281a('0xd'));var deskjs=require(_0x281a('0xe'));var toCsv=require(_0x281a('0xa'));var querystring=require(_0x281a('0xf'));var Papa=require('papaparse');var Redis=require(_0x281a('0x10'));var authService=require(_0x281a('0x11'));var qs=require(_0x281a('0x12'));var as=require(_0x281a('0x13'));var hardwareService=require(_0x281a('0x14'));var logger=require(_0x281a('0x15'))(_0x281a('0x16'));var utils=require(_0x281a('0x17'));var config=require(_0x281a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x281a('0x19'))['db'];var integrations=require(_0x281a('0x1a'));function respondWithStatusCode(_0x14e1c9,_0x4b9443){_0x4b9443=_0x4b9443||0xcc;return function(_0x32396c){if(_0x32396c){return _0x14e1c9[_0x281a('0x1b')](_0x4b9443);}return _0x14e1c9[_0x281a('0x1c')](_0x4b9443)[_0x281a('0x1d')]();};}function respondWithResult(_0x5008b2,_0x82750a){_0x82750a=_0x82750a||0xc8;return function(_0x13379f){if(_0x13379f){return _0x5008b2[_0x281a('0x1c')](_0x82750a)[_0x281a('0x1e')](_0x13379f);}};}function respondWithFilteredResult(_0x2f5995,_0x30f6a5){return function(_0x5cf0fb){if(_0x5cf0fb){var _0x6ea3b1=typeof _0x30f6a5['offset']==='undefined'&&typeof _0x30f6a5['limit']===_0x281a('0x1f');var _0x1668db=_0x5cf0fb['count'];var _0x36f357=_0x6ea3b1?0x0:_0x30f6a5[_0x281a('0x20')];var _0x5bbaa1=_0x6ea3b1?_0x5cf0fb[_0x281a('0x21')]:_0x30f6a5['offset']+_0x30f6a5[_0x281a('0x22')];var _0x581b4f;if(_0x5bbaa1>=_0x1668db){_0x5bbaa1=_0x1668db;_0x581b4f=0xc8;}else{_0x581b4f=0xce;}_0x2f5995[_0x281a('0x1c')](_0x581b4f);return _0x2f5995[_0x281a('0x23')]('Content-Range',_0x36f357+'-'+_0x5bbaa1+'/'+_0x1668db)[_0x281a('0x1e')](_0x5cf0fb);}return null;};}function patchUpdates(_0x5c9394){return function(_0x32e330){try{jsonpatch[_0x281a('0x24')](_0x32e330,_0x5c9394,!![]);}catch(_0x100d55){return BPromise['reject'](_0x100d55);}return _0x32e330[_0x281a('0x25')]();};}function saveUpdates(_0x1ae01d,_0x3d7b78){return function(_0x19f040){if(_0x19f040){return _0x19f040['update'](_0x1ae01d)[_0x281a('0x26')](function(_0x553020){return _0x553020;});}return null;};}function removeEntity(_0x38c83e,_0x5306ca){return function(_0x2c2ede){if(_0x2c2ede){return _0x2c2ede[_0x281a('0x27')]()[_0x281a('0x26')](function(){_0x38c83e[_0x281a('0x1c')](0xcc)[_0x281a('0x1d')]();});}};}function handleEntityNotFound(_0x190e03,_0x3387a4){return function(_0x511276){if(!_0x511276){_0x190e03[_0x281a('0x1b')](0x194);}return _0x511276;};}function handleError(_0x2bfd3e,_0x424ca0){_0x424ca0=_0x424ca0||0x1f4;return function(_0x149830){logger[_0x281a('0x28')](_0x149830['stack']);if(_0x149830['name']){delete _0x149830['name'];}_0x2bfd3e[_0x281a('0x1c')](_0x424ca0)['send'](_0x149830);};}exports[_0x281a('0x29')]=function(_0x3a92b4,_0xe9cc2f){var _0x2bf665={},_0x5e2ae4={},_0xe1aebb={'count':0x0,'rows':[]};var _0x43a551=_[_0x281a('0x2a')](db[_0x281a('0x2b')][_0x281a('0x2c')],function(_0xc9f78b){return{'name':_0xc9f78b[_0x281a('0x2d')],'type':_0xc9f78b[_0x281a('0x2e')][_0x281a('0x2f')]};});_0x5e2ae4[_0x281a('0x30')]=_[_0x281a('0x2a')](_0x43a551,_0x281a('0x31'));_0x5e2ae4['query']=_[_0x281a('0x32')](_0x3a92b4[_0x281a('0x33')]);_0x5e2ae4[_0x281a('0x34')]=_[_0x281a('0x35')](_0x5e2ae4[_0x281a('0x30')],_0x5e2ae4[_0x281a('0x33')]);_0x2bf665[_0x281a('0x36')]=_[_0x281a('0x35')](_0x5e2ae4[_0x281a('0x30')],qs['fields'](_0x3a92b4['query'][_0x281a('0x37')]));_0x2bf665[_0x281a('0x36')]=_0x2bf665[_0x281a('0x36')][_0x281a('0x38')]?_0x2bf665[_0x281a('0x36')]:_0x5e2ae4['model'];if(!_0x3a92b4[_0x281a('0x33')]['hasOwnProperty'](_0x281a('0x39'))){_0x2bf665[_0x281a('0x22')]=qs['limit'](_0x3a92b4[_0x281a('0x33')]['limit']);_0x2bf665[_0x281a('0x20')]=qs['offset'](_0x3a92b4[_0x281a('0x33')][_0x281a('0x20')]);}_0x2bf665[_0x281a('0x3a')]=qs[_0x281a('0x3b')](_0x3a92b4[_0x281a('0x33')][_0x281a('0x3b')]);_0x2bf665[_0x281a('0x3c')]=qs[_0x281a('0x34')](_[_0x281a('0x3d')](_0x3a92b4[_0x281a('0x33')],_0x5e2ae4['filters']),_0x43a551);if(_0x3a92b4[_0x281a('0x33')][_0x281a('0x3e')]){_0x2bf665[_0x281a('0x3c')]=_[_0x281a('0x3f')](_0x2bf665['where'],{'$or':_[_0x281a('0x2a')](_0x43a551,function(_0x4e9457){if(_0x4e9457[_0x281a('0x2e')]!==_0x281a('0x40')){var _0x1ac927={};_0x1ac927[_0x4e9457['name']]={'$like':'%'+_0x3a92b4[_0x281a('0x33')]['filter']+'%'};return _0x1ac927;}})});}_0x2bf665=_['merge']({},_0x2bf665,_0x3a92b4[_0x281a('0x41')]);var _0xfe9a36={'where':_0x2bf665['where']};return db[_0x281a('0x2b')]['count'](_0xfe9a36)[_0x281a('0x26')](function(_0x1748fa){_0xe1aebb[_0x281a('0x21')]=_0x1748fa;if(_0x3a92b4[_0x281a('0x33')][_0x281a('0x42')]){_0x2bf665[_0x281a('0x43')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x281a('0x44')](_0x2bf665);})[_0x281a('0x26')](function(_0x45864b){_0xe1aebb['rows']=_0x45864b;return _0xe1aebb;})[_0x281a('0x26')](respondWithFilteredResult(_0xe9cc2f,_0x2bf665))[_0x281a('0x45')](handleError(_0xe9cc2f,null));};exports['show']=function(_0x43b47a,_0x22d68d){var _0x5d49ea={'raw':![],'where':{'id':_0x43b47a['params']['id']}},_0x1e2ba4={};_0x1e2ba4[_0x281a('0x30')]=_[_0x281a('0x32')](db[_0x281a('0x2b')]['rawAttributes']);_0x1e2ba4['query']=_['keys'](_0x43b47a[_0x281a('0x33')]);_0x1e2ba4[_0x281a('0x34')]=_[_0x281a('0x35')](_0x1e2ba4[_0x281a('0x30')],_0x1e2ba4['query']);_0x5d49ea[_0x281a('0x36')]=_[_0x281a('0x35')](_0x1e2ba4[_0x281a('0x30')],qs[_0x281a('0x37')](_0x43b47a[_0x281a('0x33')]['fields']));_0x5d49ea[_0x281a('0x36')]=_0x5d49ea[_0x281a('0x36')]['length']?_0x5d49ea[_0x281a('0x36')]:_0x1e2ba4['model'];if(_0x43b47a['query'][_0x281a('0x42')]){_0x5d49ea[_0x281a('0x43')]=[{'all':!![]}];}_0x5d49ea=_[_0x281a('0x3f')]({},_0x5d49ea,_0x43b47a[_0x281a('0x41')]);return db['SalesforceAccount'][_0x281a('0x46')](_0x5d49ea)['then'](handleEntityNotFound(_0x22d68d,null))[_0x281a('0x26')](respondWithResult(_0x22d68d,null))[_0x281a('0x45')](handleError(_0x22d68d,null));};exports[_0x281a('0x47')]=function(_0x27fe93,_0x2f2275){return db['SalesforceAccount'][_0x281a('0x47')](_0x27fe93[_0x281a('0x48')],{})[_0x281a('0x26')](respondWithResult(_0x2f2275,0xc9))['catch'](handleError(_0x2f2275,null));};exports[_0x281a('0x49')]=function(_0x3bf649,_0xc83376){if(_0x3bf649[_0x281a('0x48')]['id']){delete _0x3bf649[_0x281a('0x48')]['id'];}return db[_0x281a('0x2b')][_0x281a('0x46')]({'where':{'id':_0x3bf649[_0x281a('0x4a')]['id']}})[_0x281a('0x26')](handleEntityNotFound(_0xc83376,null))[_0x281a('0x26')](saveUpdates(_0x3bf649[_0x281a('0x48')],null))['then'](respondWithResult(_0xc83376,null))[_0x281a('0x45')](handleError(_0xc83376,null));};exports[_0x281a('0x27')]=function(_0x7c9468,_0x55d1af){return db[_0x281a('0x2b')][_0x281a('0x46')]({'where':{'id':_0x7c9468[_0x281a('0x4a')]['id']}})[_0x281a('0x26')](handleEntityNotFound(_0x55d1af,null))[_0x281a('0x26')](removeEntity(_0x55d1af,null))['catch'](handleError(_0x55d1af,null));};exports['getConfigurations']=function(_0x762d7,_0x266525,_0x251701){var _0x583333={};var _0x37d52a={};var _0x1acbc8;var _0x476acb;return db[_0x281a('0x2b')][_0x281a('0x4b')]({'where':{'id':_0x762d7[_0x281a('0x4a')]['id']}})[_0x281a('0x26')](handleEntityNotFound(_0x266525,null))[_0x281a('0x26')](function(_0x234bba){if(_0x234bba){_0x1acbc8=_0x234bba;_0x37d52a[_0x281a('0x30')]=_[_0x281a('0x32')](db[_0x281a('0x4c')][_0x281a('0x2c')]);_0x37d52a[_0x281a('0x33')]=_[_0x281a('0x32')](_0x762d7['query']);_0x37d52a[_0x281a('0x34')]=_[_0x281a('0x35')](_0x37d52a[_0x281a('0x30')],_0x37d52a[_0x281a('0x33')]);_0x583333['attributes']=_[_0x281a('0x35')](_0x37d52a[_0x281a('0x30')],qs[_0x281a('0x37')](_0x762d7[_0x281a('0x33')][_0x281a('0x37')]));_0x583333['attributes']=_0x583333['attributes'][_0x281a('0x38')]?_0x583333[_0x281a('0x36')]:_0x37d52a[_0x281a('0x30')];_0x583333['order']=qs[_0x281a('0x3b')](_0x762d7[_0x281a('0x33')]['sort']);_0x583333[_0x281a('0x3c')]=qs[_0x281a('0x34')](_[_0x281a('0x3d')](_0x762d7['query'],_0x37d52a[_0x281a('0x34')]));if(_0x762d7[_0x281a('0x33')][_0x281a('0x3e')]){_0x583333[_0x281a('0x3c')]=_['merge'](_0x583333['where'],{'$or':_[_0x281a('0x2a')](_0x583333[_0x281a('0x36')],function(_0x39e6d1){var _0x4a97e5={};_0x4a97e5[_0x39e6d1]={'$like':'%'+_0x762d7[_0x281a('0x33')][_0x281a('0x3e')]+'%'};return _0x4a97e5;})});}_0x583333=_[_0x281a('0x3f')]({},_0x583333,_0x762d7[_0x281a('0x41')]);return _0x1acbc8['getConfigurations'](_0x583333);}})['then'](function(_0x24f104){if(_0x24f104){_0x476acb=_0x24f104['length'];if(!_0x762d7[_0x281a('0x33')][_0x281a('0x4d')](_0x281a('0x39'))){_0x583333[_0x281a('0x22')]=qs[_0x281a('0x22')](_0x762d7['query'][_0x281a('0x22')]);_0x583333[_0x281a('0x20')]=qs[_0x281a('0x20')](_0x762d7[_0x281a('0x33')][_0x281a('0x20')]);}return _0x1acbc8[_0x281a('0x4e')](_0x583333);}})[_0x281a('0x26')](function(_0x24f903){if(_0x24f903){return _0x24f903?{'count':_0x476acb,'rows':_0x24f903}:null;}})[_0x281a('0x26')](respondWithResult(_0x266525,null))['catch'](handleError(_0x266525,null));};exports['addConfiguration']=function(_0x32001c,_0x625637,_0x2684ca){if(_0x32001c[_0x281a('0x48')]['id']){delete _0x32001c['body']['id'];}return db[_0x281a('0x2b')][_0x281a('0x4b')]({'where':{'id':_0x32001c[_0x281a('0x4a')]['id']}})[_0x281a('0x26')](handleEntityNotFound(_0x625637,null))[_0x281a('0x26')](function(_0x565278){if(_0x565278){_0x32001c['body'][_0x281a('0x4f')]=_0x565278['id'];_0x32001c[_0x281a('0x48')]['Subjects']=integrations[_0x281a('0x50')](_0x32001c[_0x281a('0x48')][_0x281a('0x51')],_0x32001c[_0x281a('0x48')]['type']);_0x32001c[_0x281a('0x48')][_0x281a('0x52')]=integrations[_0x281a('0x53')](_0x32001c[_0x281a('0x48')][_0x281a('0x51')],_0x32001c['body'][_0x281a('0x2e')]);return db[_0x281a('0x4c')][_0x281a('0x47')](_0x32001c['body'],{'include':[{'model':db[_0x281a('0x54')],'as':_0x281a('0x55')},{'model':db[_0x281a('0x54')],'as':'Descriptions'}]});}return null;})[_0x281a('0x26')](respondWithResult(_0x625637,null))[_0x281a('0x45')](handleError(_0x625637,null));};exports[_0x281a('0x56')]=function(_0x59cf99,_0x4f9e16,_0x239873){var _0x1efeed;var _0x459870='';var _0x5304bf=_0x281a('0x57');return db[_0x281a('0x2b')][_0x281a('0x4b')]({'where':{'id':_0x59cf99[_0x281a('0x4a')]['id']},'attributes':['id','remoteUri','clientId','clientSecret',_0x281a('0x58'),_0x281a('0x59'),_0x281a('0x5a')]})['then'](handleEntityNotFound(_0x4f9e16,null))[_0x281a('0x26')](function(_0x3909fd){if(_0x3909fd){_0x459870=_0x3909fd['remoteUri'];var _0x4c0d48=_0x459870[_0x281a('0x5b')](-0x1);if(_0x4c0d48==='/'){_0x459870=_0x459870[_0x281a('0x5c')](0x0,_0x459870[_0x281a('0x5d')](_0x4c0d48));}_0x1efeed=new jsforce[(_0x281a('0x5e'))]({'oauth2':{'loginUrl':_0x459870,'clientId':_0x3909fd[_0x281a('0x5f')],'clientSecret':_0x3909fd['clientSecret']}});return _0x1efeed[_0x281a('0x60')](_0x3909fd[_0x281a('0x58')],_0x3909fd[_0x281a('0x59')][_0x281a('0x61')](_0x3909fd[_0x281a('0x5a')]));}})[_0x281a('0x26')](function(_0x52c297){if(_0x52c297){if(!_['isNil'](_0x59cf99['query'][_0x281a('0x62')])){_0x5304bf=_0x59cf99[_0x281a('0x33')][_0x281a('0x62')];}return _0x1efeed[_0x281a('0x63')](_0x5304bf)['describe']();}})[_0x281a('0x26')](function(_0x3d950d){var _0x208379=['OwnerId',_0x281a('0x64'),_0x281a('0x65'),_0x281a('0x66'),'Subject',_0x281a('0x67')];var _0x3c6491=[_0x281a('0x68'),_0x281a('0x69'),_0x281a('0x6a'),'boolean',_0x281a('0x6b'),_0x281a('0x6c'),'phone'];if(_0x3d950d){_['remove'](_0x3d950d[_0x281a('0x37')],function(_0x2e93e3){return _0x208379[_0x281a('0x6d')](_0x2e93e3[_0x281a('0x31')])||!_0x3c6491[_0x281a('0x6d')](_0x2e93e3['type']);});return{'count':_0x3d950d[_0x281a('0x37')]['length'],'rows':_['map'](_0x3d950d[_0x281a('0x37')],function(_0x4dfeb7){return{'id':_0x4dfeb7[_0x281a('0x31')],'name':_0x4dfeb7['label'],'custom':_0x4dfeb7[_0x281a('0x6e')],'options':_0x4dfeb7[_0x281a('0x6f')][_0x281a('0x38')]>0x0?_['map'](_0x4dfeb7[_0x281a('0x6f')],function(_0x259260){return{'name':_0x259260['label'],'value':_0x259260[_0x281a('0x70')]};}):_0x4dfeb7[_0x281a('0x2e')]==_0x281a('0x71')?[{'name':'True','value':_0x281a('0x72')},{'name':_0x281a('0x73'),'value':_0x281a('0x74')}]:[]};})};}})['then'](respondWithResult(_0x4f9e16,null))[_0x281a('0x45')](function(_0x21f478){var _0xfb3026=_0x59cf99[_0x281a('0x33')][_0x281a('0x75')]?0x1f4:_0x21f478[_0x281a('0x76')]||0x1f4;logger[_0x281a('0x28')](_0x281a('0x77'),_0x281a('0x56'),_0xfb3026,JSON[_0x281a('0x78')](_0x21f478));delete _0x21f478[_0x281a('0x31')];if(_0xfb3026===0x191){_0xfb3026=0x190;}_0x4f9e16[_0x281a('0x1c')](_0xfb3026)['send'](_0x59cf99['query'][_0x281a('0x75')]?{'message':_0x281a('0x79'),'statusCode':_0x21f478['statusCode']}:_0x21f478);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d92ec4c..89315bb 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 _0x7d28=['moment','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api'];(function(_0x4965ea,_0x206e05){var _0x2682c5=function(_0x468d93){while(--_0x468d93){_0x4965ea['push'](_0x4965ea['shift']());}};_0x2682c5(++_0x206e05);}(_0x7d28,0x75));var _0x87d2=function(_0x4f3c4b,_0x5c653b){_0x4f3c4b=_0x4f3c4b-0x0;var _0x4e0c89=_0x7d28[_0x4f3c4b];return _0x4e0c89;};'use strict';var _=require(_0x87d2('0x0'));var util=require('util');var logger=require(_0x87d2('0x1'))(_0x87d2('0x2'));var moment=require(_0x87d2('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d2('0x4'));var fs=require('fs');var path=require(_0x87d2('0x5'));var rimraf=require(_0x87d2('0x6'));var config=require('../../config/environment');var attributes=require(_0x87d2('0x7'));var integrations=require(_0x87d2('0x8'));module['exports']=function(_0x205d9e,_0x99e603){return _0x205d9e[_0x87d2('0x9')](_0x87d2('0xa'),attributes,{'tableName':_0x87d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x332d=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','lodash','util','api','bluebird'];(function(_0x450f09,_0x59561d){var _0x4e22ec=function(_0x516748){while(--_0x516748){_0x450f09['push'](_0x450f09['shift']());}};_0x4e22ec(++_0x59561d);}(_0x332d,0x1c4));var _0xd332=function(_0x5ef14d,_0x3656db){_0x5ef14d=_0x5ef14d-0x0;var _0x24d4c7=_0x332d[_0x5ef14d];return _0x24d4c7;};'use strict';var _=require(_0xd332('0x0'));var util=require(_0xd332('0x1'));var logger=require('../../config/logger')(_0xd332('0x2'));var moment=require('moment');var BPromise=require(_0xd332('0x3'));var rp=require(_0xd332('0x4'));var fs=require('fs');var path=require(_0xd332('0x5'));var rimraf=require(_0xd332('0x6'));var config=require(_0xd332('0x7'));var attributes=require(_0xd332('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd332('0x9')]=function(_0x1fa274,_0x27058d){return _0x1fa274[_0xd332('0xa')](_0xd332('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index aa4ddda..fe44ce4 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 _0xdc3c=['rpc','../../config/environment','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','then','ShowSalesforceAccount','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x40a9eb,_0x14dc41){var _0x229d40=function(_0x14d300){while(--_0x14d300){_0x40a9eb['push'](_0x40a9eb['shift']());}};_0x229d40(++_0x14dc41);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x4b0aa7,_0x486490){_0x4b0aa7=_0x4b0aa7-0x0;var _0x332021=_0xdc3c[_0x4b0aa7];return _0x332021;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var moment=require(_0xcdc3('0x1'));var BPromise=require(_0xcdc3('0x2'));var rs=require(_0xcdc3('0x3'));var fs=require('fs');var Redis=require(_0xcdc3('0x4'));var db=require(_0xcdc3('0x5'))['db'];var utils=require(_0xcdc3('0x6'));var logger=require(_0xcdc3('0x7'))(_0xcdc3('0x8'));var config=require(_0xcdc3('0x9'));var jayson=require(_0xcdc3('0xa'));var client=jayson[_0xcdc3('0xb')][_0xcdc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406814,_0x428b03,_0x79b6b1){return new BPromise(function(_0xcbc8f1,_0x58c8f3){return client['request'](_0x406814,_0x79b6b1)['then'](function(_0x3aa1b2){logger[_0xcdc3('0xd')](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));logger[_0xcdc3('0x10')](_0xcdc3('0x11'),_0x428b03,_0xcdc3('0xf'),JSON[_0xcdc3('0x12')](_0x3aa1b2));if(_0x3aa1b2[_0xcdc3('0x13')]){if(_0x3aa1b2['error']['code']===0x1f4){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);return _0x58c8f3(_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);}logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2['error'][_0xcdc3('0x14')]);return _0xcbc8f1(_0x3aa1b2['error'][_0xcdc3('0x14')]);}else{logger['info'](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));_0xcbc8f1(_0x3aa1b2[_0xcdc3('0x15')][_0xcdc3('0x14')]);}})[_0xcdc3('0x16')](function(_0xaf3ec3){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0xaf3ec3);_0x58c8f3(_0xaf3ec3);});});}exports[_0xcdc3('0x17')]=function(_0xc24bd1){var _0x1a28e6=this;return new Promise(function(_0x480c1c,_0x285adb){return db[_0xcdc3('0x18')][_0xcdc3('0x19')]({'raw':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0xc24bd1['options']?_0xc24bd1['options']['where']||null:null,'attributes':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1['options'][_0xcdc3('0x1c')]||null:null,'limit':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1d')]||null:null,'include':_0xc24bd1[_0xcdc3('0x1a')]?_0xc24bd1[_0xcdc3('0x1a')][_0xcdc3('0x1e')]?_['map'](_0xc24bd1['options'][_0xcdc3('0x1e')],function(_0x2bc477){return{'model':db[_0x2bc477[_0xcdc3('0x1f')]],'as':_0x2bc477['as'],'attributes':_0x2bc477[_0xcdc3('0x1c')],'include':_0x2bc477['include']?_[_0xcdc3('0x20')](_0x2bc477[_0xcdc3('0x1e')],function(_0x499d63){return{'model':db[_0x499d63[_0xcdc3('0x1f')]],'as':_0x499d63['as'],'attributes':_0x499d63[_0xcdc3('0x1c')],'include':_0x499d63['include']?_[_0xcdc3('0x20')](_0x499d63[_0xcdc3('0x1e')],function(_0x41efc9){return{'model':db[_0x41efc9[_0xcdc3('0x1f')]],'as':_0x41efc9['as'],'attributes':_0x41efc9[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x32a44d){logger[_0xcdc3('0xd')]('GetSalesforceAccount',_0xc24bd1);logger[_0xcdc3('0x10')]('GetSalesforceAccount',_0xc24bd1,JSON[_0xcdc3('0x12')](_0x32a44d));_0x480c1c(_0x32a44d);})[_0xcdc3('0x16')](function(_0x574da2){logger[_0xcdc3('0x13')](_0xcdc3('0x17'),_0x574da2['message'],_0xc24bd1);_0x285adb(_0x1a28e6[_0xcdc3('0x13')](0x1f4,_0x574da2[_0xcdc3('0x14')]));});});};exports[_0xcdc3('0x22')]=function(_0x117edd){var _0x3d64ac=this;return new Promise(function(_0x5baa2e,_0x359482){return db[_0xcdc3('0x18')][_0xcdc3('0x23')]({'raw':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1b')]===undefined?!![]:![]:!![],'where':_0x117edd[_0xcdc3('0x1a')]?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x24')]||null:null,'attributes':_0x117edd['options']?_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1c')]||null:null,'include':_0x117edd[_0xcdc3('0x1a')]?_0x117edd['options'][_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x117edd[_0xcdc3('0x1a')][_0xcdc3('0x1e')],function(_0x459919){return{'model':db[_0x459919[_0xcdc3('0x1f')]],'as':_0x459919['as'],'attributes':_0x459919[_0xcdc3('0x1c')],'include':_0x459919[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x459919[_0xcdc3('0x1e')],function(_0x18dcee){return{'model':db[_0x18dcee[_0xcdc3('0x1f')]],'as':_0x18dcee['as'],'attributes':_0x18dcee[_0xcdc3('0x1c')],'include':_0x18dcee[_0xcdc3('0x1e')]?_[_0xcdc3('0x20')](_0x18dcee['include'],function(_0xb1935){return{'model':db[_0xb1935[_0xcdc3('0x1f')]],'as':_0xb1935['as'],'attributes':_0xb1935[_0xcdc3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcdc3('0x21')](function(_0x12b03e){logger[_0xcdc3('0xd')]('ShowSalesforceAccount',_0x117edd);logger[_0xcdc3('0x10')](_0xcdc3('0x22'),_0x117edd,JSON['stringify'](_0x12b03e));_0x5baa2e(_0x12b03e);})[_0xcdc3('0x16')](function(_0x144283){logger[_0xcdc3('0x13')](_0xcdc3('0x22'),_0x144283[_0xcdc3('0x14')],_0x117edd);_0x359482(_0x3d64ac[_0xcdc3('0x13')](0x1f4,_0x144283[_0xcdc3('0x14')]));});});}; \ No newline at end of file +var _0x6571=['message','result','catch','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x350b07,_0x446bc5){var _0x461491=function(_0xdfb432){while(--_0xdfb432){_0x350b07['push'](_0x350b07['shift']());}};_0x461491(++_0x446bc5);}(_0x6571,0x15d));var _0x1657=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6571[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x1657('0x0'));var util=require(_0x1657('0x1'));var moment=require(_0x1657('0x2'));var BPromise=require(_0x1657('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1657('0x4'));var db=require(_0x1657('0x5'))['db'];var utils=require(_0x1657('0x6'));var logger=require(_0x1657('0x7'))(_0x1657('0x8'));var config=require(_0x1657('0x9'));var jayson=require(_0x1657('0xa'));var client=jayson[_0x1657('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13a9d4,_0x5cdc96,_0x45c7e3){return new BPromise(function(_0x58a134,_0x5be3b3){return client[_0x1657('0xc')](_0x13a9d4,_0x45c7e3)[_0x1657('0xd')](function(_0x1ffe26){logger[_0x1657('0xe')](_0x1657('0xf'),_0x5cdc96,_0x1657('0x10'));logger[_0x1657('0x11')](_0x1657('0x12'),_0x5cdc96,'request\x20sent',JSON['stringify'](_0x1ffe26));if(_0x1ffe26[_0x1657('0x13')]){if(_0x1ffe26['error'][_0x1657('0x14')]===0x1f4){logger[_0x1657('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x5cdc96,_0x1ffe26[_0x1657('0x13')][_0x1657('0x15')]);return _0x5be3b3(_0x1ffe26[_0x1657('0x13')]['message']);}logger[_0x1657('0x13')](_0x1657('0xf'),_0x5cdc96,_0x1ffe26[_0x1657('0x13')][_0x1657('0x15')]);return _0x58a134(_0x1ffe26['error'][_0x1657('0x15')]);}else{logger[_0x1657('0xe')](_0x1657('0xf'),_0x5cdc96,_0x1657('0x10'));_0x58a134(_0x1ffe26[_0x1657('0x16')][_0x1657('0x15')]);}})[_0x1657('0x17')](function(_0x36ca49){logger['error'](_0x1657('0xf'),_0x5cdc96,_0x36ca49);_0x5be3b3(_0x36ca49);});});}exports['GetSalesforceAccount']=function(_0x45b367){var _0x22cfd9=this;return new Promise(function(_0x595a18,_0x2f53a4){return db[_0x1657('0x18')][_0x1657('0x19')]({'raw':_0x45b367[_0x1657('0x1a')]?_0x45b367[_0x1657('0x1a')][_0x1657('0x1b')]===undefined?!![]:![]:!![],'where':_0x45b367[_0x1657('0x1a')]?_0x45b367[_0x1657('0x1a')]['where']||null:null,'attributes':_0x45b367[_0x1657('0x1a')]?_0x45b367[_0x1657('0x1a')][_0x1657('0x1c')]||null:null,'limit':_0x45b367[_0x1657('0x1a')]?_0x45b367[_0x1657('0x1a')][_0x1657('0x1d')]||null:null,'include':_0x45b367[_0x1657('0x1a')]?_0x45b367[_0x1657('0x1a')][_0x1657('0x1e')]?_[_0x1657('0x1f')](_0x45b367[_0x1657('0x1a')][_0x1657('0x1e')],function(_0x282028){return{'model':db[_0x282028[_0x1657('0x20')]],'as':_0x282028['as'],'attributes':_0x282028[_0x1657('0x1c')],'include':_0x282028['include']?_[_0x1657('0x1f')](_0x282028[_0x1657('0x1e')],function(_0x47f3b9){return{'model':db[_0x47f3b9['model']],'as':_0x47f3b9['as'],'attributes':_0x47f3b9[_0x1657('0x1c')],'include':_0x47f3b9[_0x1657('0x1e')]?_[_0x1657('0x1f')](_0x47f3b9[_0x1657('0x1e')],function(_0x34b9c4){return{'model':db[_0x34b9c4[_0x1657('0x20')]],'as':_0x34b9c4['as'],'attributes':_0x34b9c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1657('0xd')](function(_0x412965){logger['info'](_0x1657('0x21'),_0x45b367);logger[_0x1657('0x11')](_0x1657('0x21'),_0x45b367,JSON[_0x1657('0x22')](_0x412965));_0x595a18(_0x412965);})[_0x1657('0x17')](function(_0x2c7164){logger['error'](_0x1657('0x21'),_0x2c7164[_0x1657('0x15')],_0x45b367);_0x2f53a4(_0x22cfd9[_0x1657('0x13')](0x1f4,_0x2c7164[_0x1657('0x15')]));});});};exports[_0x1657('0x23')]=function(_0x37850c){var _0x1c5028=this;return new Promise(function(_0x13edb3,_0x39e374){return db[_0x1657('0x18')][_0x1657('0x24')]({'raw':_0x37850c[_0x1657('0x1a')]?_0x37850c[_0x1657('0x1a')][_0x1657('0x1b')]===undefined?!![]:![]:!![],'where':_0x37850c[_0x1657('0x1a')]?_0x37850c[_0x1657('0x1a')]['where']||null:null,'attributes':_0x37850c[_0x1657('0x1a')]?_0x37850c[_0x1657('0x1a')][_0x1657('0x1c')]||null:null,'include':_0x37850c[_0x1657('0x1a')]?_0x37850c[_0x1657('0x1a')][_0x1657('0x1e')]?_[_0x1657('0x1f')](_0x37850c[_0x1657('0x1a')][_0x1657('0x1e')],function(_0x545a10){return{'model':db[_0x545a10[_0x1657('0x20')]],'as':_0x545a10['as'],'attributes':_0x545a10[_0x1657('0x1c')],'include':_0x545a10[_0x1657('0x1e')]?_[_0x1657('0x1f')](_0x545a10[_0x1657('0x1e')],function(_0x565942){return{'model':db[_0x565942[_0x1657('0x20')]],'as':_0x565942['as'],'attributes':_0x565942[_0x1657('0x1c')],'include':_0x565942[_0x1657('0x1e')]?_[_0x1657('0x1f')](_0x565942[_0x1657('0x1e')],function(_0x4f839d){return{'model':db[_0x4f839d[_0x1657('0x20')]],'as':_0x4f839d['as'],'attributes':_0x4f839d[_0x1657('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1657('0xd')](function(_0xbccd04){logger[_0x1657('0xe')](_0x1657('0x23'),_0x37850c);logger['debug']('ShowSalesforceAccount',_0x37850c,JSON[_0x1657('0x22')](_0xbccd04));_0x13edb3(_0xbccd04);})['catch'](function(_0x32f980){logger['error'](_0x1657('0x23'),_0x32f980[_0x1657('0x15')],_0x37850c);_0x39e374(_0x1c5028[_0x1657('0x13')](0x1f4,_0x32f980[_0x1657('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9117d37..084dbfb 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x0b0e,0x187));var _0xe0b0=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x0b0e[_0x466bc5];return _0x138952;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x848604,_0x22802e){var _0x22b7fa=function(_0x3c1897){while(--_0x3c1897){_0x848604['push'](_0x848604['shift']());}};_0x22b7fa(++_0x22802e);}(_0x2ef3,0xba));var _0x32ef=function(_0x35240c,_0x593524){_0x35240c=_0x35240c-0x0;var _0x54225a=_0x2ef3[_0x35240c];return _0x54225a;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 64fce64..74b2cb4 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 _0x315b=['contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Case','Task'];(function(_0x58a8d2,_0x3c26de){var _0x169225=function(_0x4e9866){while(--_0x4e9866){_0x58a8d2['push'](_0x58a8d2['shift']());}};_0x169225(++_0x3c26de);}(_0x315b,0x162));var _0xb315=function(_0x1675cd,_0x164f78){_0x1675cd=_0x1675cd-0x0;var _0x2b762d=_0x315b[_0x1675cd];return _0x2b762d;};'use strict';var Sequelize=require(_0xb315('0x0'));module[_0xb315('0x1')]={'name':{'type':Sequelize[_0xb315('0x2')]},'description':{'type':Sequelize[_0xb315('0x2')]},'ticketType':{'type':Sequelize[_0xb315('0x3')]('Task',_0xb315('0x4')),'defaultValue':_0xb315('0x5')},'moduleSearch':{'type':Sequelize[_0xb315('0x3')](_0xb315('0x6'),_0xb315('0x7'),_0xb315('0x8'),_0xb315('0x9'),_0xb315('0xa')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xb315('0x3')](_0xb315('0xb'),'contact',_0xb315('0x8'),_0xb315('0xa')),'defaultValue':_0xb315('0x8')},'leadId':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xb315('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xb315('0x2')]}}; \ No newline at end of file +var _0xfd1b=['account','contact_lead','nothing','sequelize','STRING','Task','ENUM','contact','lead','account_contact_lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd1b,0x157));var _0xbfd1=function(_0x4821f3,_0x48b29d){_0x4821f3=_0x4821f3-0x0;var _0x3ba0e1=_0xfd1b[_0x4821f3];return _0x3ba0e1;};'use strict';var Sequelize=require(_0xbfd1('0x0'));module['exports']={'name':{'type':Sequelize[_0xbfd1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xbfd1('0x2'),'Case'),'defaultValue':_0xbfd1('0x2')},'moduleSearch':{'type':Sequelize[_0xbfd1('0x3')]('contact_lead',_0xbfd1('0x4'),_0xbfd1('0x5'),_0xbfd1('0x6'),_0xbfd1('0x7')),'defaultValue':_0xbfd1('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xbfd1('0x9'),'contact','lead',_0xbfd1('0x7')),'defaultValue':_0xbfd1('0x5')},'leadId':{'type':Sequelize[_0xbfd1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xbfd1('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xbfd1('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xbfd1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index bcdc6c9..cd7c14a 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 _0x16e6=['squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../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','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','getFields','findOne','keys','SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16e6,0xe8));var _0x616e=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x16e6[_0x507403];return _0x1327c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x616e('0x0'));var jsonpatch=require(_0x616e('0x1'));var rp=require(_0x616e('0x2'));var moment=require('moment');var BPromise=require(_0x616e('0x3'));var Mustache=require('mustache');var util=require(_0x616e('0x4'));var path=require(_0x616e('0x5'));var sox=require(_0x616e('0x6'));var csv=require(_0x616e('0x7'));var ejs=require(_0x616e('0x8'));var fs=require('fs');var fs_extra=require(_0x616e('0x9'));var _=require(_0x616e('0xa'));var squel=require(_0x616e('0xb'));var crypto=require('crypto');var jsforce=require(_0x616e('0xc'));var deskjs=require(_0x616e('0xd'));var toCsv=require(_0x616e('0x7'));var querystring=require(_0x616e('0xe'));var Papa=require('papaparse');var Redis=require(_0x616e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x616e('0x10'));var as=require(_0x616e('0x11'));var hardwareService=require(_0x616e('0x12'));var logger=require(_0x616e('0x13'))(_0x616e('0x14'));var utils=require('../../config/utils');var config=require(_0x616e('0x15'));var licenseUtil=require(_0x616e('0x16'));var db=require(_0x616e('0x17'))['db'];function respondWithStatusCode(_0x449feb,_0x24e4cf){_0x24e4cf=_0x24e4cf||0xcc;return function(_0x2272b0){if(_0x2272b0){return _0x449feb[_0x616e('0x18')](_0x24e4cf);}return _0x449feb[_0x616e('0x19')](_0x24e4cf)[_0x616e('0x1a')]();};}function respondWithResult(_0x498058,_0x554662){_0x554662=_0x554662||0xc8;return function(_0x13d222){if(_0x13d222){return _0x498058['status'](_0x554662)[_0x616e('0x1b')](_0x13d222);}};}function respondWithFilteredResult(_0x413e51,_0xbe71f0){return function(_0x204ca6){if(_0x204ca6){var _0x27fbad=typeof _0xbe71f0[_0x616e('0x1c')]===_0x616e('0x1d')&&typeof _0xbe71f0[_0x616e('0x1e')]==='undefined';var _0x2bbaee=_0x204ca6[_0x616e('0x1f')];var _0xb60b63=_0x27fbad?0x0:_0xbe71f0[_0x616e('0x1c')];var _0x5f45d8=_0x27fbad?_0x204ca6[_0x616e('0x1f')]:_0xbe71f0['offset']+_0xbe71f0[_0x616e('0x1e')];var _0x328642;if(_0x5f45d8>=_0x2bbaee){_0x5f45d8=_0x2bbaee;_0x328642=0xc8;}else{_0x328642=0xce;}_0x413e51[_0x616e('0x19')](_0x328642);return _0x413e51[_0x616e('0x20')]('Content-Range',_0xb60b63+'-'+_0x5f45d8+'/'+_0x2bbaee)[_0x616e('0x1b')](_0x204ca6);}return null;};}function patchUpdates(_0x2ef8f1){return function(_0x2e0f63){try{jsonpatch[_0x616e('0x21')](_0x2e0f63,_0x2ef8f1,!![]);}catch(_0x395ade){return BPromise['reject'](_0x395ade);}return _0x2e0f63[_0x616e('0x22')]();};}function saveUpdates(_0x46e663,_0x3acccb){return function(_0x2685ae){if(_0x2685ae){return _0x2685ae[_0x616e('0x23')](_0x46e663)[_0x616e('0x24')](function(_0x50c02a){return _0x50c02a;});}return null;};}function removeEntity(_0x2f67af,_0x5c179a){return function(_0x37aca8){if(_0x37aca8){return _0x37aca8[_0x616e('0x25')]()[_0x616e('0x24')](function(){_0x2f67af[_0x616e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8738,_0x57c658){return function(_0x3dcd7d){if(!_0x3dcd7d){_0x3f8738['sendStatus'](0x194);}return _0x3dcd7d;};}function handleError(_0x111af3,_0x589dc4){_0x589dc4=_0x589dc4||0x1f4;return function(_0x33ba29){logger[_0x616e('0x26')](_0x33ba29[_0x616e('0x27')]);if(_0x33ba29[_0x616e('0x28')]){delete _0x33ba29[_0x616e('0x28')];}_0x111af3[_0x616e('0x19')](_0x589dc4)['send'](_0x33ba29);};}exports[_0x616e('0x29')]=function(_0x407927,_0x2c217b){var _0x1b0108={},_0x2c00dd={},_0x2f13a5={'count':0x0,'rows':[]};var _0x229393=_[_0x616e('0x2a')](db[_0x616e('0x2b')][_0x616e('0x2c')],function(_0x39044c){return{'name':_0x39044c[_0x616e('0x2d')],'type':_0x39044c[_0x616e('0x2e')][_0x616e('0x2f')]};});_0x2c00dd[_0x616e('0x30')]=_[_0x616e('0x2a')](_0x229393,_0x616e('0x28'));_0x2c00dd[_0x616e('0x31')]=_['keys'](_0x407927[_0x616e('0x31')]);_0x2c00dd[_0x616e('0x32')]=_[_0x616e('0x33')](_0x2c00dd[_0x616e('0x30')],_0x2c00dd['query']);_0x1b0108['attributes']=_['intersection'](_0x2c00dd[_0x616e('0x30')],qs[_0x616e('0x34')](_0x407927[_0x616e('0x31')][_0x616e('0x34')]));_0x1b0108[_0x616e('0x35')]=_0x1b0108[_0x616e('0x35')]['length']?_0x1b0108[_0x616e('0x35')]:_0x2c00dd[_0x616e('0x30')];if(!_0x407927[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x1b0108['limit']=qs[_0x616e('0x1e')](_0x407927[_0x616e('0x31')][_0x616e('0x1e')]);_0x1b0108['offset']=qs[_0x616e('0x1c')](_0x407927[_0x616e('0x31')][_0x616e('0x1c')]);}_0x1b0108[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x407927['query'][_0x616e('0x39')]);_0x1b0108[_0x616e('0x3a')]=qs['filters'](_[_0x616e('0x3b')](_0x407927[_0x616e('0x31')],_0x2c00dd[_0x616e('0x32')]),_0x229393);if(_0x407927[_0x616e('0x31')][_0x616e('0x3c')]){_0x1b0108[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x1b0108[_0x616e('0x3a')],{'$or':_[_0x616e('0x2a')](_0x229393,function(_0x24484e){if(_0x24484e['type']!==_0x616e('0x3e')){var _0x16e133={};_0x16e133[_0x24484e['name']]={'$like':'%'+_0x407927[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x16e133;}})});}_0x1b0108=_['merge']({},_0x1b0108,_0x407927[_0x616e('0x3f')]);var _0x2315fd={'where':_0x1b0108[_0x616e('0x3a')]};return db[_0x616e('0x2b')][_0x616e('0x1f')](_0x2315fd)['then'](function(_0x5749c3){_0x2f13a5[_0x616e('0x1f')]=_0x5749c3;if(_0x407927[_0x616e('0x31')][_0x616e('0x40')]){_0x1b0108['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x616e('0x41')](_0x1b0108);})[_0x616e('0x24')](function(_0x23eefa){_0x2f13a5[_0x616e('0x42')]=_0x23eefa;return _0x2f13a5;})[_0x616e('0x24')](respondWithFilteredResult(_0x2c217b,_0x1b0108))[_0x616e('0x43')](handleError(_0x2c217b,null));};exports[_0x616e('0x44')]=function(_0x99be18,_0x295e7a){var _0x157956={'raw':![],'where':{'id':_0x99be18[_0x616e('0x45')]['id']}},_0x520a92={};_0x520a92['model']=_['keys'](db[_0x616e('0x2b')][_0x616e('0x2c')]);_0x520a92[_0x616e('0x31')]=_['keys'](_0x99be18[_0x616e('0x31')]);_0x520a92[_0x616e('0x32')]=_[_0x616e('0x33')](_0x520a92['model'],_0x520a92['query']);_0x157956[_0x616e('0x35')]=_['intersection'](_0x520a92['model'],qs['fields'](_0x99be18['query'][_0x616e('0x34')]));_0x157956[_0x616e('0x35')]=_0x157956['attributes'][_0x616e('0x46')]?_0x157956['attributes']:_0x520a92['model'];if(_0x99be18[_0x616e('0x31')][_0x616e('0x40')]){_0x157956[_0x616e('0x47')]=[{'all':!![]}];}_0x157956=_[_0x616e('0x3d')]({},_0x157956,_0x99be18[_0x616e('0x3f')]);return db[_0x616e('0x2b')]['find'](_0x157956)[_0x616e('0x24')](handleEntityNotFound(_0x295e7a,null))['then'](respondWithResult(_0x295e7a,null))[_0x616e('0x43')](handleError(_0x295e7a,null));};exports['create']=function(_0x41b421,_0x2dee0f){return db[_0x616e('0x2b')][_0x616e('0x48')](_0x41b421[_0x616e('0x49')],{})[_0x616e('0x24')](respondWithResult(_0x2dee0f,0xc9))['catch'](handleError(_0x2dee0f,null));};exports[_0x616e('0x23')]=function(_0x43bf3a,_0x1b543b){if(_0x43bf3a[_0x616e('0x49')]['id']){delete _0x43bf3a[_0x616e('0x49')]['id'];}return db[_0x616e('0x2b')][_0x616e('0x4a')]({'where':{'id':_0x43bf3a[_0x616e('0x45')]['id']}})[_0x616e('0x24')](handleEntityNotFound(_0x1b543b,null))[_0x616e('0x24')](saveUpdates(_0x43bf3a[_0x616e('0x49')],null))[_0x616e('0x24')](respondWithResult(_0x1b543b,null))[_0x616e('0x43')](handleError(_0x1b543b,null));};exports[_0x616e('0x25')]=function(_0xfc7729,_0x58db42){return db[_0x616e('0x2b')]['find']({'where':{'id':_0xfc7729[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x58db42,null))[_0x616e('0x24')](removeEntity(_0x58db42,null))[_0x616e('0x43')](handleError(_0x58db42,null));};exports[_0x616e('0x4b')]=function(_0x590d9a,_0x137c13,_0x187b46){var _0x23ecd2={};var _0x3cb4d5={};var _0x4e64e9;var _0x520ce0;return db['SalesforceConfiguration'][_0x616e('0x4c')]({'where':{'id':_0x590d9a[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x137c13,null))[_0x616e('0x24')](function(_0x1ffff4){if(_0x1ffff4){_0x4e64e9=_0x1ffff4;_0x3cb4d5[_0x616e('0x30')]=_[_0x616e('0x4d')](db[_0x616e('0x4e')][_0x616e('0x2c')]);_0x3cb4d5[_0x616e('0x31')]=_['keys'](_0x590d9a['query']);_0x3cb4d5[_0x616e('0x32')]=_[_0x616e('0x33')](_0x3cb4d5[_0x616e('0x30')],_0x3cb4d5[_0x616e('0x31')]);_0x23ecd2[_0x616e('0x35')]=_[_0x616e('0x33')](_0x3cb4d5[_0x616e('0x30')],qs[_0x616e('0x34')](_0x590d9a[_0x616e('0x31')]['fields']));_0x23ecd2[_0x616e('0x35')]=_0x23ecd2[_0x616e('0x35')][_0x616e('0x46')]?_0x23ecd2[_0x616e('0x35')]:_0x3cb4d5[_0x616e('0x30')];_0x23ecd2[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x590d9a[_0x616e('0x31')]['sort']);_0x23ecd2[_0x616e('0x3a')]=qs[_0x616e('0x32')](_[_0x616e('0x3b')](_0x590d9a[_0x616e('0x31')],_0x3cb4d5[_0x616e('0x32')]));if(_0x590d9a[_0x616e('0x31')][_0x616e('0x3c')]){_0x23ecd2[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x23ecd2[_0x616e('0x3a')],{'$or':_['map'](_0x23ecd2[_0x616e('0x35')],function(_0x23b984){var _0x7d946a={};_0x7d946a[_0x23b984]={'$like':'%'+_0x590d9a[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x7d946a;})});}_0x23ecd2=_['merge']({},_0x23ecd2,_0x590d9a[_0x616e('0x3f')]);return _0x4e64e9[_0x616e('0x4b')](_0x23ecd2);}})[_0x616e('0x24')](function(_0x2cbe1e){if(_0x2cbe1e){_0x520ce0=_0x2cbe1e[_0x616e('0x46')];if(!_0x590d9a[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x23ecd2[_0x616e('0x1e')]=qs[_0x616e('0x1e')](_0x590d9a['query'][_0x616e('0x1e')]);_0x23ecd2[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x590d9a[_0x616e('0x31')][_0x616e('0x1c')]);}return _0x4e64e9[_0x616e('0x4b')](_0x23ecd2);}})[_0x616e('0x24')](function(_0x450f9c){if(_0x450f9c){return _0x450f9c?{'count':_0x520ce0,'rows':_0x450f9c}:null;}})[_0x616e('0x24')](respondWithResult(_0x137c13,null))['catch'](handleError(_0x137c13,null));};exports[_0x616e('0x4f')]=function(_0x41aff1,_0x5479f7,_0x53b25e){var _0x7fca1e={};var _0x12e6a1={};var _0x4e62f7;var _0x41f3b5;return db[_0x616e('0x2b')]['findOne']({'where':{'id':_0x41aff1[_0x616e('0x45')]['id']}})['then'](handleEntityNotFound(_0x5479f7,null))['then'](function(_0x1005a4){if(_0x1005a4){_0x4e62f7=_0x1005a4;_0x12e6a1['model']=_[_0x616e('0x4d')](db[_0x616e('0x4e')]['rawAttributes']);_0x12e6a1[_0x616e('0x31')]=_[_0x616e('0x4d')](_0x41aff1[_0x616e('0x31')]);_0x12e6a1['filters']=_[_0x616e('0x33')](_0x12e6a1[_0x616e('0x30')],_0x12e6a1['query']);_0x7fca1e['attributes']=_['intersection'](_0x12e6a1['model'],qs[_0x616e('0x34')](_0x41aff1['query'][_0x616e('0x34')]));_0x7fca1e[_0x616e('0x35')]=_0x7fca1e[_0x616e('0x35')][_0x616e('0x46')]?_0x7fca1e[_0x616e('0x35')]:_0x12e6a1[_0x616e('0x30')];_0x7fca1e[_0x616e('0x38')]=qs[_0x616e('0x39')](_0x41aff1[_0x616e('0x31')][_0x616e('0x39')]);_0x7fca1e[_0x616e('0x3a')]=qs['filters'](_[_0x616e('0x3b')](_0x41aff1[_0x616e('0x31')],_0x12e6a1[_0x616e('0x32')]));if(_0x41aff1['query'][_0x616e('0x3c')]){_0x7fca1e['where']=_[_0x616e('0x3d')](_0x7fca1e[_0x616e('0x3a')],{'$or':_['map'](_0x7fca1e[_0x616e('0x35')],function(_0x357f36){var _0x5ada19={};_0x5ada19[_0x357f36]={'$like':'%'+_0x41aff1[_0x616e('0x31')]['filter']+'%'};return _0x5ada19;})});}_0x7fca1e=_[_0x616e('0x3d')]({},_0x7fca1e,_0x41aff1[_0x616e('0x3f')]);return _0x4e62f7[_0x616e('0x4f')](_0x7fca1e);}})[_0x616e('0x24')](function(_0x207257){if(_0x207257){_0x41f3b5=_0x207257[_0x616e('0x46')];if(!_0x41aff1[_0x616e('0x31')]['hasOwnProperty'](_0x616e('0x37'))){_0x7fca1e[_0x616e('0x1e')]=qs['limit'](_0x41aff1['query'][_0x616e('0x1e')]);_0x7fca1e[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x41aff1['query'][_0x616e('0x1c')]);}return _0x4e62f7[_0x616e('0x4f')](_0x7fca1e);}})[_0x616e('0x24')](function(_0x161b44){if(_0x161b44){return _0x161b44?{'count':_0x41f3b5,'rows':_0x161b44}:null;}})[_0x616e('0x24')](respondWithResult(_0x5479f7,null))[_0x616e('0x43')](handleError(_0x5479f7,null));};exports['getDescriptions']=function(_0x46a101,_0xfecd7d,_0x293226){var _0x11bc44={};var _0x3858b9={};var _0x17f166;var _0x417488;return db[_0x616e('0x2b')][_0x616e('0x4c')]({'where':{'id':_0x46a101[_0x616e('0x45')]['id']}})[_0x616e('0x24')](handleEntityNotFound(_0xfecd7d,null))[_0x616e('0x24')](function(_0x94be21){if(_0x94be21){_0x17f166=_0x94be21;_0x3858b9['model']=_[_0x616e('0x4d')](db[_0x616e('0x4e')][_0x616e('0x2c')]);_0x3858b9[_0x616e('0x31')]=_[_0x616e('0x4d')](_0x46a101['query']);_0x3858b9[_0x616e('0x32')]=_[_0x616e('0x33')](_0x3858b9[_0x616e('0x30')],_0x3858b9[_0x616e('0x31')]);_0x11bc44[_0x616e('0x35')]=_[_0x616e('0x33')](_0x3858b9['model'],qs['fields'](_0x46a101[_0x616e('0x31')][_0x616e('0x34')]));_0x11bc44[_0x616e('0x35')]=_0x11bc44['attributes'][_0x616e('0x46')]?_0x11bc44['attributes']:_0x3858b9[_0x616e('0x30')];_0x11bc44['order']=qs[_0x616e('0x39')](_0x46a101[_0x616e('0x31')]['sort']);_0x11bc44[_0x616e('0x3a')]=qs[_0x616e('0x32')](_[_0x616e('0x3b')](_0x46a101[_0x616e('0x31')],_0x3858b9[_0x616e('0x32')]));if(_0x46a101[_0x616e('0x31')][_0x616e('0x3c')]){_0x11bc44[_0x616e('0x3a')]=_[_0x616e('0x3d')](_0x11bc44[_0x616e('0x3a')],{'$or':_[_0x616e('0x2a')](_0x11bc44[_0x616e('0x35')],function(_0x27828b){var _0x24d311={};_0x24d311[_0x27828b]={'$like':'%'+_0x46a101[_0x616e('0x31')][_0x616e('0x3c')]+'%'};return _0x24d311;})});}_0x11bc44=_[_0x616e('0x3d')]({},_0x11bc44,_0x46a101[_0x616e('0x3f')]);return _0x17f166[_0x616e('0x50')](_0x11bc44);}})[_0x616e('0x24')](function(_0x119685){if(_0x119685){_0x417488=_0x119685[_0x616e('0x46')];if(!_0x46a101[_0x616e('0x31')][_0x616e('0x36')](_0x616e('0x37'))){_0x11bc44['limit']=qs[_0x616e('0x1e')](_0x46a101[_0x616e('0x31')][_0x616e('0x1e')]);_0x11bc44[_0x616e('0x1c')]=qs[_0x616e('0x1c')](_0x46a101[_0x616e('0x31')][_0x616e('0x1c')]);}return _0x17f166[_0x616e('0x50')](_0x11bc44);}})['then'](function(_0x195b80){if(_0x195b80){return _0x195b80?{'count':_0x417488,'rows':_0x195b80}:null;}})[_0x616e('0x24')](respondWithResult(_0xfecd7d,null))[_0x616e('0x43')](handleError(_0xfecd7d,null));}; \ No newline at end of file +var _0xa7ac=['SalesforceConfiguration','rawAttributes','type','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','update','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','map'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7ac,0xc2));var _0xca7a=function(_0x13dd91,_0x38fa9a){_0x13dd91=_0x13dd91-0x0;var _0x429401=_0xa7ac[_0x13dd91];return _0x429401;};'use strict';var emlformat=require(_0xca7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca7a('0x1'));var jsonpatch=require(_0xca7a('0x2'));var rp=require('request-promise');var moment=require(_0xca7a('0x3'));var BPromise=require(_0xca7a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xca7a('0x5'));var csv=require(_0xca7a('0x6'));var ejs=require(_0xca7a('0x7'));var fs=require('fs');var fs_extra=require(_0xca7a('0x8'));var _=require(_0xca7a('0x9'));var squel=require(_0xca7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xca7a('0xb'));var deskjs=require(_0xca7a('0xc'));var toCsv=require(_0xca7a('0x6'));var querystring=require(_0xca7a('0xd'));var Papa=require(_0xca7a('0xe'));var Redis=require(_0xca7a('0xf'));var authService=require(_0xca7a('0x10'));var qs=require(_0xca7a('0x11'));var as=require(_0xca7a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca7a('0x13'))(_0xca7a('0x14'));var utils=require(_0xca7a('0x15'));var config=require(_0xca7a('0x16'));var licenseUtil=require(_0xca7a('0x17'));var db=require(_0xca7a('0x18'))['db'];function respondWithStatusCode(_0x333d44,_0x4f0d39){_0x4f0d39=_0x4f0d39||0xcc;return function(_0x48f555){if(_0x48f555){return _0x333d44[_0xca7a('0x19')](_0x4f0d39);}return _0x333d44['status'](_0x4f0d39)[_0xca7a('0x1a')]();};}function respondWithResult(_0x346ea7,_0x3a2314){_0x3a2314=_0x3a2314||0xc8;return function(_0x41139d){if(_0x41139d){return _0x346ea7[_0xca7a('0x1b')](_0x3a2314)[_0xca7a('0x1c')](_0x41139d);}};}function respondWithFilteredResult(_0x233300,_0x50c62a){return function(_0x49af29){if(_0x49af29){var _0x10f573=typeof _0x50c62a[_0xca7a('0x1d')]===_0xca7a('0x1e')&&typeof _0x50c62a[_0xca7a('0x1f')]==='undefined';var _0x300ec0=_0x49af29['count'];var _0x1373dc=_0x10f573?0x0:_0x50c62a[_0xca7a('0x1d')];var _0x12d2a4=_0x10f573?_0x49af29[_0xca7a('0x20')]:_0x50c62a[_0xca7a('0x1d')]+_0x50c62a[_0xca7a('0x1f')];var _0x477444;if(_0x12d2a4>=_0x300ec0){_0x12d2a4=_0x300ec0;_0x477444=0xc8;}else{_0x477444=0xce;}_0x233300['status'](_0x477444);return _0x233300[_0xca7a('0x21')]('Content-Range',_0x1373dc+'-'+_0x12d2a4+'/'+_0x300ec0)['json'](_0x49af29);}return null;};}function patchUpdates(_0x598ce7){return function(_0x51a8e4){try{jsonpatch[_0xca7a('0x22')](_0x51a8e4,_0x598ce7,!![]);}catch(_0x5a88cf){return BPromise[_0xca7a('0x23')](_0x5a88cf);}return _0x51a8e4[_0xca7a('0x24')]();};}function saveUpdates(_0x1aea9b,_0x437bbf){return function(_0x2d9e27){if(_0x2d9e27){return _0x2d9e27['update'](_0x1aea9b)[_0xca7a('0x25')](function(_0x362eab){return _0x362eab;});}return null;};}function removeEntity(_0x363ffd,_0x458074){return function(_0x1d4362){if(_0x1d4362){return _0x1d4362[_0xca7a('0x26')]()[_0xca7a('0x25')](function(){_0x363ffd[_0xca7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fae56,_0x5ef118){return function(_0x45aa2f){if(!_0x45aa2f){_0x2fae56[_0xca7a('0x19')](0x194);}return _0x45aa2f;};}function handleError(_0x5728c5,_0x22fd8b){_0x22fd8b=_0x22fd8b||0x1f4;return function(_0x320abf){logger[_0xca7a('0x27')](_0x320abf['stack']);if(_0x320abf[_0xca7a('0x28')]){delete _0x320abf[_0xca7a('0x28')];}_0x5728c5[_0xca7a('0x1b')](_0x22fd8b)[_0xca7a('0x29')](_0x320abf);};}exports['index']=function(_0x7c0ba6,_0xc1a493){var _0x22e162={},_0x2be5f2={},_0x5108bf={'count':0x0,'rows':[]};var _0x123144=_[_0xca7a('0x2a')](db[_0xca7a('0x2b')][_0xca7a('0x2c')],function(_0x519396){return{'name':_0x519396['fieldName'],'type':_0x519396[_0xca7a('0x2d')]['key']};});_0x2be5f2['model']=_['map'](_0x123144,_0xca7a('0x28'));_0x2be5f2[_0xca7a('0x2e')]=_[_0xca7a('0x2f')](_0x7c0ba6[_0xca7a('0x2e')]);_0x2be5f2['filters']=_['intersection'](_0x2be5f2[_0xca7a('0x30')],_0x2be5f2['query']);_0x22e162['attributes']=_[_0xca7a('0x31')](_0x2be5f2[_0xca7a('0x30')],qs['fields'](_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x32')]));_0x22e162['attributes']=_0x22e162[_0xca7a('0x33')][_0xca7a('0x34')]?_0x22e162[_0xca7a('0x33')]:_0x2be5f2[_0xca7a('0x30')];if(!_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x35')](_0xca7a('0x36'))){_0x22e162[_0xca7a('0x1f')]=qs[_0xca7a('0x1f')](_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x1f')]);_0x22e162[_0xca7a('0x1d')]=qs[_0xca7a('0x1d')](_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x1d')]);}_0x22e162[_0xca7a('0x37')]=qs['sort'](_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x38')]);_0x22e162[_0xca7a('0x39')]=qs['filters'](_[_0xca7a('0x3a')](_0x7c0ba6[_0xca7a('0x2e')],_0x2be5f2[_0xca7a('0x3b')]),_0x123144);if(_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x3c')]){_0x22e162[_0xca7a('0x39')]=_[_0xca7a('0x3d')](_0x22e162[_0xca7a('0x39')],{'$or':_[_0xca7a('0x2a')](_0x123144,function(_0x2a7219){if(_0x2a7219[_0xca7a('0x2d')]!==_0xca7a('0x3e')){var _0x3bd981={};_0x3bd981[_0x2a7219[_0xca7a('0x28')]]={'$like':'%'+_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x3c')]+'%'};return _0x3bd981;}})});}_0x22e162=_['merge']({},_0x22e162,_0x7c0ba6[_0xca7a('0x3f')]);var _0x58044d={'where':_0x22e162['where']};return db[_0xca7a('0x2b')]['count'](_0x58044d)['then'](function(_0x1aad22){_0x5108bf['count']=_0x1aad22;if(_0x7c0ba6[_0xca7a('0x2e')][_0xca7a('0x40')]){_0x22e162[_0xca7a('0x41')]=[{'all':!![]}];}return db[_0xca7a('0x2b')][_0xca7a('0x42')](_0x22e162);})[_0xca7a('0x25')](function(_0x3d8336){_0x5108bf['rows']=_0x3d8336;return _0x5108bf;})[_0xca7a('0x25')](respondWithFilteredResult(_0xc1a493,_0x22e162))['catch'](handleError(_0xc1a493,null));};exports[_0xca7a('0x43')]=function(_0x4f6685,_0x29c2f3){var _0x4605e6={'raw':![],'where':{'id':_0x4f6685[_0xca7a('0x44')]['id']}},_0x261047={};_0x261047[_0xca7a('0x30')]=_[_0xca7a('0x2f')](db[_0xca7a('0x2b')][_0xca7a('0x2c')]);_0x261047['query']=_[_0xca7a('0x2f')](_0x4f6685[_0xca7a('0x2e')]);_0x261047['filters']=_[_0xca7a('0x31')](_0x261047[_0xca7a('0x30')],_0x261047[_0xca7a('0x2e')]);_0x4605e6[_0xca7a('0x33')]=_[_0xca7a('0x31')](_0x261047[_0xca7a('0x30')],qs['fields'](_0x4f6685[_0xca7a('0x2e')][_0xca7a('0x32')]));_0x4605e6[_0xca7a('0x33')]=_0x4605e6[_0xca7a('0x33')]['length']?_0x4605e6[_0xca7a('0x33')]:_0x261047[_0xca7a('0x30')];if(_0x4f6685[_0xca7a('0x2e')]['includeAll']){_0x4605e6[_0xca7a('0x41')]=[{'all':!![]}];}_0x4605e6=_[_0xca7a('0x3d')]({},_0x4605e6,_0x4f6685[_0xca7a('0x3f')]);return db[_0xca7a('0x2b')]['find'](_0x4605e6)[_0xca7a('0x25')](handleEntityNotFound(_0x29c2f3,null))[_0xca7a('0x25')](respondWithResult(_0x29c2f3,null))[_0xca7a('0x45')](handleError(_0x29c2f3,null));};exports[_0xca7a('0x46')]=function(_0x144bca,_0x4ba965){return db['SalesforceConfiguration'][_0xca7a('0x46')](_0x144bca[_0xca7a('0x47')],{})[_0xca7a('0x25')](respondWithResult(_0x4ba965,0xc9))['catch'](handleError(_0x4ba965,null));};exports[_0xca7a('0x48')]=function(_0x2cb5b5,_0x46708e){if(_0x2cb5b5[_0xca7a('0x47')]['id']){delete _0x2cb5b5[_0xca7a('0x47')]['id'];}return db['SalesforceConfiguration'][_0xca7a('0x49')]({'where':{'id':_0x2cb5b5[_0xca7a('0x44')]['id']}})[_0xca7a('0x25')](handleEntityNotFound(_0x46708e,null))['then'](saveUpdates(_0x2cb5b5['body'],null))[_0xca7a('0x25')](respondWithResult(_0x46708e,null))[_0xca7a('0x45')](handleError(_0x46708e,null));};exports[_0xca7a('0x26')]=function(_0x2467bb,_0x3100dc){return db[_0xca7a('0x2b')]['find']({'where':{'id':_0x2467bb[_0xca7a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3100dc,null))['then'](removeEntity(_0x3100dc,null))[_0xca7a('0x45')](handleError(_0x3100dc,null));};exports[_0xca7a('0x4a')]=function(_0x7c26b7,_0x46206e,_0x38f048){var _0x334884={};var _0x490a92={};var _0x537ed0;var _0x2e50c7;return db[_0xca7a('0x2b')][_0xca7a('0x4b')]({'where':{'id':_0x7c26b7[_0xca7a('0x44')]['id']}})[_0xca7a('0x25')](handleEntityNotFound(_0x46206e,null))['then'](function(_0x3091d2){if(_0x3091d2){_0x537ed0=_0x3091d2;_0x490a92['model']=_[_0xca7a('0x2f')](db[_0xca7a('0x4c')][_0xca7a('0x2c')]);_0x490a92['query']=_[_0xca7a('0x2f')](_0x7c26b7[_0xca7a('0x2e')]);_0x490a92[_0xca7a('0x3b')]=_[_0xca7a('0x31')](_0x490a92[_0xca7a('0x30')],_0x490a92[_0xca7a('0x2e')]);_0x334884[_0xca7a('0x33')]=_[_0xca7a('0x31')](_0x490a92[_0xca7a('0x30')],qs['fields'](_0x7c26b7[_0xca7a('0x2e')][_0xca7a('0x32')]));_0x334884['attributes']=_0x334884[_0xca7a('0x33')]['length']?_0x334884[_0xca7a('0x33')]:_0x490a92[_0xca7a('0x30')];_0x334884[_0xca7a('0x37')]=qs[_0xca7a('0x38')](_0x7c26b7['query'][_0xca7a('0x38')]);_0x334884[_0xca7a('0x39')]=qs[_0xca7a('0x3b')](_[_0xca7a('0x3a')](_0x7c26b7[_0xca7a('0x2e')],_0x490a92['filters']));if(_0x7c26b7[_0xca7a('0x2e')][_0xca7a('0x3c')]){_0x334884[_0xca7a('0x39')]=_[_0xca7a('0x3d')](_0x334884[_0xca7a('0x39')],{'$or':_[_0xca7a('0x2a')](_0x334884[_0xca7a('0x33')],function(_0x30c41c){var _0x39e4e3={};_0x39e4e3[_0x30c41c]={'$like':'%'+_0x7c26b7[_0xca7a('0x2e')]['filter']+'%'};return _0x39e4e3;})});}_0x334884=_[_0xca7a('0x3d')]({},_0x334884,_0x7c26b7[_0xca7a('0x3f')]);return _0x537ed0[_0xca7a('0x4a')](_0x334884);}})[_0xca7a('0x25')](function(_0x2253b1){if(_0x2253b1){_0x2e50c7=_0x2253b1['length'];if(!_0x7c26b7[_0xca7a('0x2e')]['hasOwnProperty'](_0xca7a('0x36'))){_0x334884[_0xca7a('0x1f')]=qs[_0xca7a('0x1f')](_0x7c26b7[_0xca7a('0x2e')][_0xca7a('0x1f')]);_0x334884[_0xca7a('0x1d')]=qs[_0xca7a('0x1d')](_0x7c26b7[_0xca7a('0x2e')]['offset']);}return _0x537ed0[_0xca7a('0x4a')](_0x334884);}})['then'](function(_0x17a9b8){if(_0x17a9b8){return _0x17a9b8?{'count':_0x2e50c7,'rows':_0x17a9b8}:null;}})[_0xca7a('0x25')](respondWithResult(_0x46206e,null))['catch'](handleError(_0x46206e,null));};exports[_0xca7a('0x4d')]=function(_0x49685e,_0x4c6227,_0x1b0d47){var _0x3f2cc2={};var _0x149bf0={};var _0x391e26;var _0x5a3aa5;return db['SalesforceConfiguration'][_0xca7a('0x4b')]({'where':{'id':_0x49685e['params']['id']}})[_0xca7a('0x25')](handleEntityNotFound(_0x4c6227,null))[_0xca7a('0x25')](function(_0x13e5d7){if(_0x13e5d7){_0x391e26=_0x13e5d7;_0x149bf0[_0xca7a('0x30')]=_[_0xca7a('0x2f')](db[_0xca7a('0x4c')]['rawAttributes']);_0x149bf0[_0xca7a('0x2e')]=_['keys'](_0x49685e[_0xca7a('0x2e')]);_0x149bf0[_0xca7a('0x3b')]=_[_0xca7a('0x31')](_0x149bf0[_0xca7a('0x30')],_0x149bf0[_0xca7a('0x2e')]);_0x3f2cc2[_0xca7a('0x33')]=_['intersection'](_0x149bf0[_0xca7a('0x30')],qs[_0xca7a('0x32')](_0x49685e['query'][_0xca7a('0x32')]));_0x3f2cc2[_0xca7a('0x33')]=_0x3f2cc2[_0xca7a('0x33')][_0xca7a('0x34')]?_0x3f2cc2[_0xca7a('0x33')]:_0x149bf0[_0xca7a('0x30')];_0x3f2cc2[_0xca7a('0x37')]=qs[_0xca7a('0x38')](_0x49685e['query'][_0xca7a('0x38')]);_0x3f2cc2[_0xca7a('0x39')]=qs[_0xca7a('0x3b')](_[_0xca7a('0x3a')](_0x49685e['query'],_0x149bf0[_0xca7a('0x3b')]));if(_0x49685e[_0xca7a('0x2e')]['filter']){_0x3f2cc2['where']=_[_0xca7a('0x3d')](_0x3f2cc2[_0xca7a('0x39')],{'$or':_[_0xca7a('0x2a')](_0x3f2cc2['attributes'],function(_0x1fa3c6){var _0xda022c={};_0xda022c[_0x1fa3c6]={'$like':'%'+_0x49685e[_0xca7a('0x2e')]['filter']+'%'};return _0xda022c;})});}_0x3f2cc2=_['merge']({},_0x3f2cc2,_0x49685e[_0xca7a('0x3f')]);return _0x391e26['getSubjects'](_0x3f2cc2);}})['then'](function(_0x4f8043){if(_0x4f8043){_0x5a3aa5=_0x4f8043[_0xca7a('0x34')];if(!_0x49685e[_0xca7a('0x2e')][_0xca7a('0x35')](_0xca7a('0x36'))){_0x3f2cc2[_0xca7a('0x1f')]=qs[_0xca7a('0x1f')](_0x49685e[_0xca7a('0x2e')][_0xca7a('0x1f')]);_0x3f2cc2[_0xca7a('0x1d')]=qs[_0xca7a('0x1d')](_0x49685e[_0xca7a('0x2e')][_0xca7a('0x1d')]);}return _0x391e26[_0xca7a('0x4d')](_0x3f2cc2);}})[_0xca7a('0x25')](function(_0x29573e){if(_0x29573e){return _0x29573e?{'count':_0x5a3aa5,'rows':_0x29573e}:null;}})['then'](respondWithResult(_0x4c6227,null))[_0xca7a('0x45')](handleError(_0x4c6227,null));};exports[_0xca7a('0x4e')]=function(_0x1cd5c1,_0xfc0584,_0x120239){var _0xda5022={};var _0x31e1b4={};var _0x62bcd8;var _0x3b8b96;return db[_0xca7a('0x2b')][_0xca7a('0x4b')]({'where':{'id':_0x1cd5c1[_0xca7a('0x44')]['id']}})[_0xca7a('0x25')](handleEntityNotFound(_0xfc0584,null))['then'](function(_0x387067){if(_0x387067){_0x62bcd8=_0x387067;_0x31e1b4[_0xca7a('0x30')]=_[_0xca7a('0x2f')](db[_0xca7a('0x4c')][_0xca7a('0x2c')]);_0x31e1b4[_0xca7a('0x2e')]=_[_0xca7a('0x2f')](_0x1cd5c1['query']);_0x31e1b4[_0xca7a('0x3b')]=_[_0xca7a('0x31')](_0x31e1b4[_0xca7a('0x30')],_0x31e1b4[_0xca7a('0x2e')]);_0xda5022[_0xca7a('0x33')]=_['intersection'](_0x31e1b4[_0xca7a('0x30')],qs[_0xca7a('0x32')](_0x1cd5c1[_0xca7a('0x2e')][_0xca7a('0x32')]));_0xda5022[_0xca7a('0x33')]=_0xda5022[_0xca7a('0x33')][_0xca7a('0x34')]?_0xda5022[_0xca7a('0x33')]:_0x31e1b4[_0xca7a('0x30')];_0xda5022[_0xca7a('0x37')]=qs['sort'](_0x1cd5c1[_0xca7a('0x2e')][_0xca7a('0x38')]);_0xda5022['where']=qs['filters'](_[_0xca7a('0x3a')](_0x1cd5c1[_0xca7a('0x2e')],_0x31e1b4['filters']));if(_0x1cd5c1['query'][_0xca7a('0x3c')]){_0xda5022[_0xca7a('0x39')]=_[_0xca7a('0x3d')](_0xda5022['where'],{'$or':_[_0xca7a('0x2a')](_0xda5022[_0xca7a('0x33')],function(_0x526b78){var _0x3c2cec={};_0x3c2cec[_0x526b78]={'$like':'%'+_0x1cd5c1[_0xca7a('0x2e')][_0xca7a('0x3c')]+'%'};return _0x3c2cec;})});}_0xda5022=_[_0xca7a('0x3d')]({},_0xda5022,_0x1cd5c1[_0xca7a('0x3f')]);return _0x62bcd8[_0xca7a('0x4e')](_0xda5022);}})[_0xca7a('0x25')](function(_0x4e04cd){if(_0x4e04cd){_0x3b8b96=_0x4e04cd['length'];if(!_0x1cd5c1[_0xca7a('0x2e')][_0xca7a('0x35')](_0xca7a('0x36'))){_0xda5022['limit']=qs[_0xca7a('0x1f')](_0x1cd5c1[_0xca7a('0x2e')]['limit']);_0xda5022[_0xca7a('0x1d')]=qs[_0xca7a('0x1d')](_0x1cd5c1['query'][_0xca7a('0x1d')]);}return _0x62bcd8[_0xca7a('0x4e')](_0xda5022);}})[_0xca7a('0x25')](function(_0x1dce6e){if(_0x1dce6e){return _0x1dce6e?{'count':_0x3b8b96,'rows':_0x1dce6e}:null;}})[_0xca7a('0x25')](respondWithResult(_0xfc0584,null))[_0xca7a('0x45')](handleError(_0xfc0584,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2d7d902..0220dd0 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 _0x5a20=['path','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','bluebird','request-promise'];(function(_0x2bdd09,_0x4627f7){var _0x2728a6=function(_0x7f043a){while(--_0x7f043a){_0x2bdd09['push'](_0x2bdd09['shift']());}};_0x2728a6(++_0x4627f7);}(_0x5a20,0xb6));var _0x05a2=function(_0x3cb4fe,_0x5c1995){_0x3cb4fe=_0x3cb4fe-0x0;var _0x3a81d2=_0x5a20[_0x3cb4fe];return _0x3a81d2;};'use strict';var _=require(_0x05a2('0x0'));var util=require(_0x05a2('0x1'));var logger=require('../../config/logger')(_0x05a2('0x2'));var moment=require('moment');var BPromise=require(_0x05a2('0x3'));var rp=require(_0x05a2('0x4'));var fs=require('fs');var path=require(_0x05a2('0x5'));var rimraf=require('rimraf');var config=require(_0x05a2('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x05a2('0x7')]=function(_0x58b475,_0x205228){return _0x58b475[_0x05a2('0x8')](_0x05a2('0x9'),attributes,{'tableName':_0x05a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x218a=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api'];(function(_0x3c6c1b,_0x82a1e4){var _0x15170e=function(_0x388a43){while(--_0x388a43){_0x3c6c1b['push'](_0x3c6c1b['shift']());}};_0x15170e(++_0x82a1e4);}(_0x218a,0xb2));var _0xa218=function(_0x34ca2d,_0x1a5a18){_0x34ca2d=_0x34ca2d-0x0;var _0x5f223c=_0x218a[_0x34ca2d];return _0x5f223c;};'use strict';var _=require(_0xa218('0x0'));var util=require(_0xa218('0x1'));var logger=require(_0xa218('0x2'))(_0xa218('0x3'));var moment=require(_0xa218('0x4'));var BPromise=require(_0xa218('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa218('0x6'));var rimraf=require(_0xa218('0x7'));var config=require(_0xa218('0x8'));var attributes=require(_0xa218('0x9'));module[_0xa218('0xa')]=function(_0x76eed3,_0x578f0d){return _0x76eed3[_0xa218('0xb')](_0xa218('0xc'),attributes,{'tableName':_0xa218('0xd'),'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 676c8b6..f83aeff 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 _0x94c1=['http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d9559,_0x383d96){var _0x3be939=function(_0x3f12ed){while(--_0x3f12ed){_0x1d9559['push'](_0x1d9559['shift']());}};_0x3be939(++_0x383d96);}(_0x94c1,0x9d));var _0x194c=function(_0x1d18ed,_0xcdc45b){_0x1d18ed=_0x1d18ed-0x0;var _0x197425=_0x94c1[_0x1d18ed];return _0x197425;};'use strict';var _=require(_0x194c('0x0'));var util=require(_0x194c('0x1'));var moment=require(_0x194c('0x2'));var BPromise=require('bluebird');var rs=require(_0x194c('0x3'));var fs=require('fs');var Redis=require(_0x194c('0x4'));var db=require(_0x194c('0x5'))['db'];var utils=require(_0x194c('0x6'));var logger=require(_0x194c('0x7'))(_0x194c('0x8'));var config=require('../../config/environment');var jayson=require(_0x194c('0x9'));var client=jayson[_0x194c('0xa')][_0x194c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f449c,_0x1821b7,_0x78f820){return new BPromise(function(_0x2e0ce8,_0x32d6b9){return client['request'](_0x4f449c,_0x78f820)[_0x194c('0xc')](function(_0x76b2aa){logger[_0x194c('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1821b7,_0x194c('0xe'));logger[_0x194c('0xf')](_0x194c('0x10'),_0x1821b7,'request\x20sent',JSON[_0x194c('0x11')](_0x76b2aa));if(_0x76b2aa[_0x194c('0x12')]){if(_0x76b2aa[_0x194c('0x12')][_0x194c('0x13')]===0x1f4){logger[_0x194c('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1821b7,_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);return _0x32d6b9(_0x76b2aa['error'][_0x194c('0x14')]);}logger[_0x194c('0x12')](_0x194c('0x15'),_0x1821b7,_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);return _0x2e0ce8(_0x76b2aa[_0x194c('0x12')][_0x194c('0x14')]);}else{logger[_0x194c('0xd')](_0x194c('0x15'),_0x1821b7,_0x194c('0xe'));_0x2e0ce8(_0x76b2aa[_0x194c('0x16')][_0x194c('0x14')]);}})[_0x194c('0x17')](function(_0xb9e199){logger['error'](_0x194c('0x15'),_0x1821b7,_0xb9e199);_0x32d6b9(_0xb9e199);});});} \ No newline at end of file +var _0x5c0f=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x558b35,_0x354dbb){var _0x485f96=function(_0xbbe447){while(--_0xbbe447){_0x558b35['push'](_0x558b35['shift']());}};_0x485f96(++_0x354dbb);}(_0x5c0f,0x1db));var _0xf5c0=function(_0x554a70,_0x40bee8){_0x554a70=_0x554a70-0x0;var _0x83d4ac=_0x5c0f[_0x554a70];return _0x83d4ac;};'use strict';var _=require(_0xf5c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf5c0('0x1'));var rs=require(_0xf5c0('0x2'));var fs=require('fs');var Redis=require(_0xf5c0('0x3'));var db=require(_0xf5c0('0x4'))['db'];var utils=require(_0xf5c0('0x5'));var logger=require(_0xf5c0('0x6'))(_0xf5c0('0x7'));var config=require('../../config/environment');var jayson=require(_0xf5c0('0x8'));var client=jayson[_0xf5c0('0x9')][_0xf5c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452445,_0x321f07,_0x372f60){return new BPromise(function(_0xbc6245,_0x439295){return client['request'](_0x452445,_0x372f60)[_0xf5c0('0xb')](function(_0x215a5c){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x321f07,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x321f07,_0xf5c0('0xc'),JSON[_0xf5c0('0xd')](_0x215a5c));if(_0x215a5c[_0xf5c0('0xe')]){if(_0x215a5c[_0xf5c0('0xe')][_0xf5c0('0xf')]===0x1f4){logger[_0xf5c0('0xe')](_0xf5c0('0x10'),_0x321f07,_0x215a5c[_0xf5c0('0xe')][_0xf5c0('0x11')]);return _0x439295(_0x215a5c[_0xf5c0('0xe')][_0xf5c0('0x11')]);}logger[_0xf5c0('0xe')](_0xf5c0('0x10'),_0x321f07,_0x215a5c[_0xf5c0('0xe')]['message']);return _0xbc6245(_0x215a5c[_0xf5c0('0xe')][_0xf5c0('0x11')]);}else{logger['info'](_0xf5c0('0x10'),_0x321f07,'request\x20sent');_0xbc6245(_0x215a5c[_0xf5c0('0x12')][_0xf5c0('0x11')]);}})[_0xf5c0('0x13')](function(_0x12baff){logger[_0xf5c0('0xe')](_0xf5c0('0x10'),_0x321f07,_0x12baff);_0x439295(_0x12baff);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8910ebb..d935f7d 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 _0xeab2=['post','create','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','show'];(function(_0x1eb7d1,_0x26b951){var _0x511b48=function(_0x598ba8){while(--_0x598ba8){_0x1eb7d1['push'](_0x1eb7d1['shift']());}};_0x511b48(++_0x26b951);}(_0xeab2,0x75));var _0x2eab=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xeab2[_0x29e3b6];return _0x55d4b0;};'use strict';var multer=require(_0x2eab('0x0'));var util=require('util');var path=require(_0x2eab('0x1'));var timeout=require(_0x2eab('0x2'));var express=require('express');var router=express[_0x2eab('0x3')]();var fs_extra=require(_0x2eab('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2eab('0x5'));var controller=require(_0x2eab('0x6'));router[_0x2eab('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2eab('0x7')](_0x2eab('0x8'),auth[_0x2eab('0x9')](),controller[_0x2eab('0xa')]);router[_0x2eab('0xb')]('/',auth[_0x2eab('0x9')](),controller[_0x2eab('0xc')]);router[_0x2eab('0xd')](_0x2eab('0x8'),auth[_0x2eab('0x9')](),controller['update']);router[_0x2eab('0xe')](_0x2eab('0x8'),auth['isAuthenticated'](),controller[_0x2eab('0xf')]);module['exports']=router; \ No newline at end of file +var _0x71de=['update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x8eebfa,_0x3853d3){var _0x4a3a53=function(_0x5452a2){while(--_0x5452a2){_0x8eebfa['push'](_0x8eebfa['shift']());}};_0x4a3a53(++_0x3853d3);}(_0x71de,0x93));var _0xe71d=function(_0x3b2d4e,_0x1423c3){_0x3b2d4e=_0x3b2d4e-0x0;var _0xd4d52=_0x71de[_0x3b2d4e];return _0xd4d52;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe71d('0x0'));var express=require(_0xe71d('0x1'));var router=express[_0xe71d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe71d('0x3'));var interaction=require(_0xe71d('0x4'));var config=require(_0xe71d('0x5'));var controller=require(_0xe71d('0x6'));router[_0xe71d('0x7')]('/',auth[_0xe71d('0x8')](),controller[_0xe71d('0x9')]);router[_0xe71d('0x7')](_0xe71d('0xa'),auth['isAuthenticated'](),controller[_0xe71d('0xb')]);router['post']('/',auth[_0xe71d('0x8')](),controller['create']);router[_0xe71d('0xc')](_0xe71d('0xa'),auth[_0xe71d('0x8')](),controller[_0xe71d('0xd')]);router[_0xe71d('0xe')](_0xe71d('0xa'),auth[_0xe71d('0x8')](),controller[_0xe71d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 89ac406..b1bfd92 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 _0x075a=['variable','customVariable','keyValue','STRING','ENUM','string'];(function(_0x22c9ab,_0x234127){var _0x595ecb=function(_0x38af29){while(--_0x38af29){_0x22c9ab['push'](_0x22c9ab['shift']());}};_0x595ecb(++_0x234127);}(_0x075a,0xd0));var _0xa075=function(_0x4b4cc9,_0x462caa){_0x4b4cc9=_0x4b4cc9-0x0;var _0x43cf0e=_0x075a[_0x4b4cc9];return _0x43cf0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xa075('0x0')](_0xa075('0x1'),_0xa075('0x2'),_0xa075('0x3'),_0xa075('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa075('0x5')]},'key':{'type':Sequelize[_0xa075('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa075('0x2'),_0xa075('0x3'))},'keyContent':{'type':Sequelize[_0xa075('0x5')]},'idField':{'type':Sequelize[_0xa075('0x5')]},'variableName':{'type':Sequelize[_0xa075('0x5')]}}; \ No newline at end of file +var _0x206a=['STRING','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x39d2a9,_0x258205){var _0x459a79=function(_0x2b4aa8){while(--_0x2b4aa8){_0x39d2a9['push'](_0x39d2a9['shift']());}};_0x459a79(++_0x258205);}(_0x206a,0x172));var _0xa206=function(_0x11e2ea,_0x1d81d6){_0x11e2ea=_0x11e2ea-0x0;var _0x446348=_0x206a[_0x11e2ea];return _0x446348;};'use strict';var Sequelize=require(_0xa206('0x0'));module[_0xa206('0x1')]={'type':{'type':Sequelize[_0xa206('0x2')]('string',_0xa206('0x3'),_0xa206('0x4'),_0xa206('0x5'),_0xa206('0x6')),'defaultValue':_0xa206('0x7')},'content':{'type':Sequelize[_0xa206('0x8')]},'key':{'type':Sequelize[_0xa206('0x8')]},'keyType':{'type':Sequelize[_0xa206('0x2')](_0xa206('0x7'),'variable',_0xa206('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa206('0x8')]},'variableName':{'type':Sequelize[_0xa206('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 2137e5d..b9f1bfd 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 _0xb983=['body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','catch','show','params','includeAll','find','create'];(function(_0x370f7d,_0x1db710){var _0x48173a=function(_0x592acb){while(--_0x592acb){_0x370f7d['push'](_0x370f7d['shift']());}};_0x48173a(++_0x1db710);}(_0xb983,0x91));var _0x3b98=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xb983[_0x5ef905];return _0x367808;};'use strict';var emlformat=require(_0x3b98('0x0'));var rimraf=require(_0x3b98('0x1'));var zipdir=require(_0x3b98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b98('0x3'));var moment=require(_0x3b98('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b98('0x5'));var util=require(_0x3b98('0x6'));var path=require(_0x3b98('0x7'));var sox=require(_0x3b98('0x8'));var csv=require(_0x3b98('0x9'));var ejs=require(_0x3b98('0xa'));var fs=require('fs');var fs_extra=require(_0x3b98('0xb'));var _=require(_0x3b98('0xc'));var squel=require(_0x3b98('0xd'));var crypto=require(_0x3b98('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b98('0x9'));var querystring=require(_0x3b98('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b98('0x10'));var as=require(_0x3b98('0x11'));var hardwareService=require(_0x3b98('0x12'));var logger=require(_0x3b98('0x13'))(_0x3b98('0x14'));var utils=require(_0x3b98('0x15'));var config=require(_0x3b98('0x16'));var licenseUtil=require(_0x3b98('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db520,_0x56872e){_0x56872e=_0x56872e||0xcc;return function(_0xf86092){if(_0xf86092){return _0x4db520['sendStatus'](_0x56872e);}return _0x4db520['status'](_0x56872e)[_0x3b98('0x18')]();};}function respondWithResult(_0x1d3ef8,_0x1dd02c){_0x1dd02c=_0x1dd02c||0xc8;return function(_0xb30fd){if(_0xb30fd){return _0x1d3ef8[_0x3b98('0x19')](_0x1dd02c)[_0x3b98('0x1a')](_0xb30fd);}};}function respondWithFilteredResult(_0x29e79e,_0x1d554a){return function(_0x14f21f){if(_0x14f21f){var _0x593242=typeof _0x1d554a[_0x3b98('0x1b')]===_0x3b98('0x1c')&&typeof _0x1d554a['limit']===_0x3b98('0x1c');var _0x203bf1=_0x14f21f[_0x3b98('0x1d')];var _0x537417=_0x593242?0x0:_0x1d554a[_0x3b98('0x1b')];var _0x3325a5=_0x593242?_0x14f21f['count']:_0x1d554a[_0x3b98('0x1b')]+_0x1d554a[_0x3b98('0x1e')];var _0x13408c;if(_0x3325a5>=_0x203bf1){_0x3325a5=_0x203bf1;_0x13408c=0xc8;}else{_0x13408c=0xce;}_0x29e79e[_0x3b98('0x19')](_0x13408c);return _0x29e79e[_0x3b98('0x1f')]('Content-Range',_0x537417+'-'+_0x3325a5+'/'+_0x203bf1)[_0x3b98('0x1a')](_0x14f21f);}return null;};}function patchUpdates(_0x3deff5){return function(_0x389548){try{jsonpatch[_0x3b98('0x20')](_0x389548,_0x3deff5,!![]);}catch(_0x273585){return BPromise[_0x3b98('0x21')](_0x273585);}return _0x389548[_0x3b98('0x22')]();};}function saveUpdates(_0x1c558c,_0xe6b118){return function(_0x23becf){if(_0x23becf){return _0x23becf[_0x3b98('0x23')](_0x1c558c)[_0x3b98('0x24')](function(_0x37603c){return _0x37603c;});}return null;};}function removeEntity(_0x3142a9,_0x3315af){return function(_0x3eb82f){if(_0x3eb82f){return _0x3eb82f[_0x3b98('0x25')]()['then'](function(){_0x3142a9[_0x3b98('0x19')](0xcc)[_0x3b98('0x18')]();});}};}function handleEntityNotFound(_0xd3a962,_0x38aabd){return function(_0x5f1f26){if(!_0x5f1f26){_0xd3a962['sendStatus'](0x194);}return _0x5f1f26;};}function handleError(_0x279a47,_0x2cb06b){_0x2cb06b=_0x2cb06b||0x1f4;return function(_0x42bf60){logger[_0x3b98('0x26')](_0x42bf60[_0x3b98('0x27')]);if(_0x42bf60['name']){delete _0x42bf60[_0x3b98('0x28')];}_0x279a47['status'](_0x2cb06b)[_0x3b98('0x29')](_0x42bf60);};}exports['index']=function(_0x1983e9,_0x58be1d){var _0x5bb285={},_0x24026a={},_0x1592c7={'count':0x0,'rows':[]};var _0x48db61=_[_0x3b98('0x2a')](db['SalesforceField'][_0x3b98('0x2b')],function(_0x505adb){return{'name':_0x505adb[_0x3b98('0x2c')],'type':_0x505adb['type'][_0x3b98('0x2d')]};});_0x24026a[_0x3b98('0x2e')]=_['map'](_0x48db61,_0x3b98('0x28'));_0x24026a['query']=_[_0x3b98('0x2f')](_0x1983e9[_0x3b98('0x30')]);_0x24026a[_0x3b98('0x31')]=_['intersection'](_0x24026a[_0x3b98('0x2e')],_0x24026a['query']);_0x5bb285[_0x3b98('0x32')]=_[_0x3b98('0x33')](_0x24026a[_0x3b98('0x2e')],qs[_0x3b98('0x34')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x34')]));_0x5bb285[_0x3b98('0x32')]=_0x5bb285[_0x3b98('0x32')][_0x3b98('0x35')]?_0x5bb285[_0x3b98('0x32')]:_0x24026a[_0x3b98('0x2e')];if(!_0x1983e9[_0x3b98('0x30')]['hasOwnProperty']('nolimit')){_0x5bb285[_0x3b98('0x1e')]=qs['limit'](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x1e')]);_0x5bb285[_0x3b98('0x1b')]=qs[_0x3b98('0x1b')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x1b')]);}_0x5bb285[_0x3b98('0x36')]=qs[_0x3b98('0x37')](_0x1983e9[_0x3b98('0x30')][_0x3b98('0x37')]);_0x5bb285[_0x3b98('0x38')]=qs[_0x3b98('0x31')](_[_0x3b98('0x39')](_0x1983e9['query'],_0x24026a['filters']),_0x48db61);if(_0x1983e9[_0x3b98('0x30')][_0x3b98('0x3a')]){_0x5bb285[_0x3b98('0x38')]=_[_0x3b98('0x3b')](_0x5bb285[_0x3b98('0x38')],{'$or':_['map'](_0x48db61,function(_0x97c38e){if(_0x97c38e['type']!==_0x3b98('0x3c')){var _0x1198f4={};_0x1198f4[_0x97c38e['name']]={'$like':'%'+_0x1983e9[_0x3b98('0x30')][_0x3b98('0x3a')]+'%'};return _0x1198f4;}})});}_0x5bb285=_[_0x3b98('0x3b')]({},_0x5bb285,_0x1983e9[_0x3b98('0x3d')]);var _0x9d9137={'where':_0x5bb285[_0x3b98('0x38')]};return db[_0x3b98('0x3e')]['count'](_0x9d9137)[_0x3b98('0x24')](function(_0x75de0f){_0x1592c7[_0x3b98('0x1d')]=_0x75de0f;if(_0x1983e9[_0x3b98('0x30')]['includeAll']){_0x5bb285[_0x3b98('0x3f')]=[{'all':!![]}];}return db[_0x3b98('0x3e')][_0x3b98('0x40')](_0x5bb285);})['then'](function(_0x28391e){_0x1592c7['rows']=_0x28391e;return _0x1592c7;})[_0x3b98('0x24')](respondWithFilteredResult(_0x58be1d,_0x5bb285))[_0x3b98('0x41')](handleError(_0x58be1d,null));};exports[_0x3b98('0x42')]=function(_0x56bad1,_0x2176c0){var _0x560795={'raw':!![],'where':{'id':_0x56bad1[_0x3b98('0x43')]['id']}},_0x4f77b7={};_0x4f77b7[_0x3b98('0x2e')]=_[_0x3b98('0x2f')](db['SalesforceField'][_0x3b98('0x2b')]);_0x4f77b7[_0x3b98('0x30')]=_[_0x3b98('0x2f')](_0x56bad1[_0x3b98('0x30')]);_0x4f77b7[_0x3b98('0x31')]=_['intersection'](_0x4f77b7[_0x3b98('0x2e')],_0x4f77b7['query']);_0x560795[_0x3b98('0x32')]=_[_0x3b98('0x33')](_0x4f77b7[_0x3b98('0x2e')],qs[_0x3b98('0x34')](_0x56bad1[_0x3b98('0x30')][_0x3b98('0x34')]));_0x560795[_0x3b98('0x32')]=_0x560795[_0x3b98('0x32')][_0x3b98('0x35')]?_0x560795[_0x3b98('0x32')]:_0x4f77b7[_0x3b98('0x2e')];if(_0x56bad1[_0x3b98('0x30')][_0x3b98('0x44')]){_0x560795[_0x3b98('0x3f')]=[{'all':!![]}];}_0x560795=_[_0x3b98('0x3b')]({},_0x560795,_0x56bad1[_0x3b98('0x3d')]);return db['SalesforceField'][_0x3b98('0x45')](_0x560795)['then'](handleEntityNotFound(_0x2176c0,null))[_0x3b98('0x24')](respondWithResult(_0x2176c0,null))[_0x3b98('0x41')](handleError(_0x2176c0,null));};exports['create']=function(_0x3b3ad5,_0x244606){return db[_0x3b98('0x3e')][_0x3b98('0x46')](_0x3b3ad5[_0x3b98('0x47')],{})[_0x3b98('0x24')](respondWithResult(_0x244606,0xc9))['catch'](handleError(_0x244606,null));};exports[_0x3b98('0x23')]=function(_0x4fd197,_0x4cf153){if(_0x4fd197[_0x3b98('0x47')]['id']){delete _0x4fd197[_0x3b98('0x47')]['id'];}return db[_0x3b98('0x3e')][_0x3b98('0x45')]({'where':{'id':_0x4fd197[_0x3b98('0x43')]['id']}})[_0x3b98('0x24')](handleEntityNotFound(_0x4cf153,null))[_0x3b98('0x24')](saveUpdates(_0x4fd197[_0x3b98('0x47')],null))['then'](respondWithResult(_0x4cf153,null))[_0x3b98('0x41')](handleError(_0x4cf153,null));};exports['destroy']=function(_0x34fb1b,_0x4d6829){return db[_0x3b98('0x3e')]['find']({'where':{'id':_0x34fb1b[_0x3b98('0x43')]['id']}})[_0x3b98('0x24')](handleEntityNotFound(_0x4d6829,null))['then'](removeEntity(_0x4d6829,null))[_0x3b98('0x41')](handleError(_0x4d6829,null));}; \ No newline at end of file +var _0x8834=['fields','merge','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','type','key','model','query','filters','intersection','attributes','length','order','sort','where','pick','filter','includeAll','rows','catch','keys'];(function(_0x422413,_0x33436b){var _0x51a58e=function(_0x5bc553){while(--_0x5bc553){_0x422413['push'](_0x422413['shift']());}};_0x51a58e(++_0x33436b);}(_0x8834,0x160));var _0x4883=function(_0x80b3a9,_0x487721){_0x80b3a9=_0x80b3a9-0x0;var _0x4cc6cd=_0x8834[_0x80b3a9];return _0x4cc6cd;};'use strict';var emlformat=require(_0x4883('0x0'));var rimraf=require(_0x4883('0x1'));var zipdir=require(_0x4883('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4883('0x3'));var moment=require(_0x4883('0x4'));var BPromise=require(_0x4883('0x5'));var Mustache=require('mustache');var util=require(_0x4883('0x6'));var path=require(_0x4883('0x7'));var sox=require(_0x4883('0x8'));var csv=require(_0x4883('0x9'));var ejs=require(_0x4883('0xa'));var fs=require('fs');var fs_extra=require(_0x4883('0xb'));var _=require('lodash');var squel=require(_0x4883('0xc'));var crypto=require('crypto');var jsforce=require(_0x4883('0xd'));var deskjs=require(_0x4883('0xe'));var toCsv=require(_0x4883('0x9'));var querystring=require('querystring');var Papa=require(_0x4883('0xf'));var Redis=require(_0x4883('0x10'));var authService=require(_0x4883('0x11'));var qs=require(_0x4883('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4883('0x13'));var logger=require(_0x4883('0x14'))('api');var utils=require(_0x4883('0x15'));var config=require(_0x4883('0x16'));var licenseUtil=require(_0x4883('0x17'));var db=require(_0x4883('0x18'))['db'];function respondWithStatusCode(_0x59671d,_0x4e702c){_0x4e702c=_0x4e702c||0xcc;return function(_0x275467){if(_0x275467){return _0x59671d[_0x4883('0x19')](_0x4e702c);}return _0x59671d[_0x4883('0x1a')](_0x4e702c)[_0x4883('0x1b')]();};}function respondWithResult(_0x5e9baf,_0x5796dc){_0x5796dc=_0x5796dc||0xc8;return function(_0x3ec3fd){if(_0x3ec3fd){return _0x5e9baf[_0x4883('0x1a')](_0x5796dc)[_0x4883('0x1c')](_0x3ec3fd);}};}function respondWithFilteredResult(_0x5106b4,_0x2d9a1a){return function(_0x1f976a){if(_0x1f976a){var _0x245a29=typeof _0x2d9a1a[_0x4883('0x1d')]===_0x4883('0x1e')&&typeof _0x2d9a1a[_0x4883('0x1f')]===_0x4883('0x1e');var _0x3b3b1e=_0x1f976a[_0x4883('0x20')];var _0x42a25c=_0x245a29?0x0:_0x2d9a1a[_0x4883('0x1d')];var _0x58909b=_0x245a29?_0x1f976a[_0x4883('0x20')]:_0x2d9a1a[_0x4883('0x1d')]+_0x2d9a1a[_0x4883('0x1f')];var _0x487ff9;if(_0x58909b>=_0x3b3b1e){_0x58909b=_0x3b3b1e;_0x487ff9=0xc8;}else{_0x487ff9=0xce;}_0x5106b4['status'](_0x487ff9);return _0x5106b4['set'](_0x4883('0x21'),_0x42a25c+'-'+_0x58909b+'/'+_0x3b3b1e)[_0x4883('0x1c')](_0x1f976a);}return null;};}function patchUpdates(_0x412188){return function(_0x7ce91d){try{jsonpatch[_0x4883('0x22')](_0x7ce91d,_0x412188,!![]);}catch(_0x51c5a9){return BPromise['reject'](_0x51c5a9);}return _0x7ce91d['save']();};}function saveUpdates(_0x453bd9,_0x67ad80){return function(_0xca3441){if(_0xca3441){return _0xca3441[_0x4883('0x23')](_0x453bd9)[_0x4883('0x24')](function(_0xef226a){return _0xef226a;});}return null;};}function removeEntity(_0x1415ed,_0x5007b7){return function(_0x201a08){if(_0x201a08){return _0x201a08[_0x4883('0x25')]()['then'](function(){_0x1415ed[_0x4883('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x991be0,_0x9225b5){return function(_0x331c4c){if(!_0x331c4c){_0x991be0[_0x4883('0x19')](0x194);}return _0x331c4c;};}function handleError(_0x4baf10,_0x363c71){_0x363c71=_0x363c71||0x1f4;return function(_0x654b70){logger[_0x4883('0x26')](_0x654b70[_0x4883('0x27')]);if(_0x654b70[_0x4883('0x28')]){delete _0x654b70[_0x4883('0x28')];}_0x4baf10[_0x4883('0x1a')](_0x363c71)[_0x4883('0x29')](_0x654b70);};}exports['index']=function(_0x4f1cfd,_0x5908ef){var _0x3a176b={},_0x42192c={},_0xa3bb2e={'count':0x0,'rows':[]};var _0x2c913d=_[_0x4883('0x2a')](db[_0x4883('0x2b')][_0x4883('0x2c')],function(_0x189a1b){return{'name':_0x189a1b['fieldName'],'type':_0x189a1b[_0x4883('0x2d')][_0x4883('0x2e')]};});_0x42192c[_0x4883('0x2f')]=_[_0x4883('0x2a')](_0x2c913d,'name');_0x42192c[_0x4883('0x30')]=_['keys'](_0x4f1cfd['query']);_0x42192c[_0x4883('0x31')]=_[_0x4883('0x32')](_0x42192c['model'],_0x42192c[_0x4883('0x30')]);_0x3a176b['attributes']=_[_0x4883('0x32')](_0x42192c['model'],qs['fields'](_0x4f1cfd[_0x4883('0x30')]['fields']));_0x3a176b[_0x4883('0x33')]=_0x3a176b[_0x4883('0x33')][_0x4883('0x34')]?_0x3a176b[_0x4883('0x33')]:_0x42192c[_0x4883('0x2f')];if(!_0x4f1cfd[_0x4883('0x30')]['hasOwnProperty']('nolimit')){_0x3a176b[_0x4883('0x1f')]=qs[_0x4883('0x1f')](_0x4f1cfd['query']['limit']);_0x3a176b[_0x4883('0x1d')]=qs[_0x4883('0x1d')](_0x4f1cfd[_0x4883('0x30')][_0x4883('0x1d')]);}_0x3a176b[_0x4883('0x35')]=qs[_0x4883('0x36')](_0x4f1cfd['query']['sort']);_0x3a176b[_0x4883('0x37')]=qs[_0x4883('0x31')](_[_0x4883('0x38')](_0x4f1cfd[_0x4883('0x30')],_0x42192c[_0x4883('0x31')]),_0x2c913d);if(_0x4f1cfd[_0x4883('0x30')][_0x4883('0x39')]){_0x3a176b['where']=_['merge'](_0x3a176b[_0x4883('0x37')],{'$or':_[_0x4883('0x2a')](_0x2c913d,function(_0x2dbc31){if(_0x2dbc31['type']!=='VIRTUAL'){var _0xa9202a={};_0xa9202a[_0x2dbc31[_0x4883('0x28')]]={'$like':'%'+_0x4f1cfd[_0x4883('0x30')][_0x4883('0x39')]+'%'};return _0xa9202a;}})});}_0x3a176b=_['merge']({},_0x3a176b,_0x4f1cfd['options']);var _0x2c7578={'where':_0x3a176b[_0x4883('0x37')]};return db['SalesforceField'][_0x4883('0x20')](_0x2c7578)[_0x4883('0x24')](function(_0xcd195c){_0xa3bb2e[_0x4883('0x20')]=_0xcd195c;if(_0x4f1cfd['query'][_0x4883('0x3a')]){_0x3a176b['include']=[{'all':!![]}];}return db[_0x4883('0x2b')]['findAll'](_0x3a176b);})[_0x4883('0x24')](function(_0x210f7e){_0xa3bb2e[_0x4883('0x3b')]=_0x210f7e;return _0xa3bb2e;})[_0x4883('0x24')](respondWithFilteredResult(_0x5908ef,_0x3a176b))[_0x4883('0x3c')](handleError(_0x5908ef,null));};exports['show']=function(_0x4af55f,_0x363bd8){var _0x14df78={'raw':!![],'where':{'id':_0x4af55f['params']['id']}},_0x5de31d={};_0x5de31d[_0x4883('0x2f')]=_['keys'](db[_0x4883('0x2b')][_0x4883('0x2c')]);_0x5de31d[_0x4883('0x30')]=_[_0x4883('0x3d')](_0x4af55f[_0x4883('0x30')]);_0x5de31d[_0x4883('0x31')]=_['intersection'](_0x5de31d[_0x4883('0x2f')],_0x5de31d[_0x4883('0x30')]);_0x14df78['attributes']=_[_0x4883('0x32')](_0x5de31d[_0x4883('0x2f')],qs[_0x4883('0x3e')](_0x4af55f[_0x4883('0x30')][_0x4883('0x3e')]));_0x14df78[_0x4883('0x33')]=_0x14df78[_0x4883('0x33')][_0x4883('0x34')]?_0x14df78[_0x4883('0x33')]:_0x5de31d[_0x4883('0x2f')];if(_0x4af55f[_0x4883('0x30')][_0x4883('0x3a')]){_0x14df78['include']=[{'all':!![]}];}_0x14df78=_[_0x4883('0x3f')]({},_0x14df78,_0x4af55f[_0x4883('0x40')]);return db['SalesforceField'][_0x4883('0x41')](_0x14df78)[_0x4883('0x24')](handleEntityNotFound(_0x363bd8,null))[_0x4883('0x24')](respondWithResult(_0x363bd8,null))[_0x4883('0x3c')](handleError(_0x363bd8,null));};exports[_0x4883('0x42')]=function(_0x43baca,_0x3a7847){return db[_0x4883('0x2b')][_0x4883('0x42')](_0x43baca['body'],{})['then'](respondWithResult(_0x3a7847,0xc9))['catch'](handleError(_0x3a7847,null));};exports[_0x4883('0x23')]=function(_0x2f9f42,_0x70bdd1){if(_0x2f9f42['body']['id']){delete _0x2f9f42[_0x4883('0x43')]['id'];}return db['SalesforceField'][_0x4883('0x41')]({'where':{'id':_0x2f9f42['params']['id']}})[_0x4883('0x24')](handleEntityNotFound(_0x70bdd1,null))[_0x4883('0x24')](saveUpdates(_0x2f9f42[_0x4883('0x43')],null))[_0x4883('0x24')](respondWithResult(_0x70bdd1,null))['catch'](handleError(_0x70bdd1,null));};exports[_0x4883('0x25')]=function(_0x14c78c,_0x499e08){return db['SalesforceField'][_0x4883('0x41')]({'where':{'id':_0x14c78c[_0x4883('0x44')]['id']}})[_0x4883('0x24')](handleEntityNotFound(_0x499e08,null))[_0x4883('0x24')](removeEntity(_0x499e08,null))[_0x4883('0x3c')](handleError(_0x499e08,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 702b016..e6d778a 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 _0x4bbe=['exports','define','SalesforceField','salesforce_unique_index','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes'];(function(_0xfada82,_0x18d901){var _0x76c8b3=function(_0x46952e){while(--_0x46952e){_0xfada82['push'](_0xfada82['shift']());}};_0x76c8b3(++_0x18d901);}(_0x4bbe,0x163));var _0xe4bb=function(_0x3b410d,_0x1c5220){_0x3b410d=_0x3b410d-0x0;var _0x325d47=_0x4bbe[_0x3b410d];return _0x325d47;};'use strict';var _=require(_0xe4bb('0x0'));var util=require(_0xe4bb('0x1'));var logger=require('../../config/logger')(_0xe4bb('0x2'));var moment=require(_0xe4bb('0x3'));var BPromise=require(_0xe4bb('0x4'));var rp=require(_0xe4bb('0x5'));var fs=require('fs');var path=require(_0xe4bb('0x6'));var rimraf=require('rimraf');var config=require(_0xe4bb('0x7'));var attributes=require(_0xe4bb('0x8'));module[_0xe4bb('0x9')]=function(_0x524c6f,_0x3dd2e7){return _0x524c6f[_0xe4bb('0xa')](_0xe4bb('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xe4bb('0xc'),'fields':['idField',_0xe4bb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3701=['salesforce_unique_index','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields'];(function(_0x4fd812,_0x575915){var _0x6064b5=function(_0x3e0c29){while(--_0x3e0c29){_0x4fd812['push'](_0x4fd812['shift']());}};_0x6064b5(++_0x575915);}(_0x3701,0x1bc));var _0x1370=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3701[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x1370('0x0'));var logger=require(_0x1370('0x1'))('api');var moment=require(_0x1370('0x2'));var BPromise=require(_0x1370('0x3'));var rp=require(_0x1370('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1370('0x5'));var config=require(_0x1370('0x6'));var attributes=require(_0x1370('0x7'));module['exports']=function(_0x58638d,_0x1b326a){return _0x58638d[_0x1370('0x8')](_0x1370('0x9'),attributes,{'tableName':_0x1370('0xa'),'paranoid':![],'indexes':[{'name':_0x1370('0xb'),'fields':['idField',_0x1370('0xc')],'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 a0a74d8..7e817d0 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 _0x11ac=['message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x41453a,_0x19559a){var _0x36b884=function(_0x38cdaf){while(--_0x38cdaf){_0x41453a['push'](_0x41453a['shift']());}};_0x36b884(++_0x19559a);}(_0x11ac,0x18e));var _0xc11a=function(_0x480afe,_0x175253){_0x480afe=_0x480afe-0x0;var _0x19e5f9=_0x11ac[_0x480afe];return _0x19e5f9;};'use strict';var _=require(_0xc11a('0x0'));var util=require(_0xc11a('0x1'));var moment=require(_0xc11a('0x2'));var BPromise=require(_0xc11a('0x3'));var rs=require(_0xc11a('0x4'));var fs=require('fs');var Redis=require(_0xc11a('0x5'));var db=require(_0xc11a('0x6'))['db'];var utils=require(_0xc11a('0x7'));var logger=require(_0xc11a('0x8'))(_0xc11a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc11a('0xa')][_0xc11a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100a22,_0x12dae9,_0x5e87f4){return new BPromise(function(_0x187704,_0x5c9eaf){return client[_0xc11a('0xc')](_0x100a22,_0x5e87f4)[_0xc11a('0xd')](function(_0x32ed0c){logger['info'](_0xc11a('0xe'),_0x12dae9,_0xc11a('0xf'));logger[_0xc11a('0x10')](_0xc11a('0x11'),_0x12dae9,_0xc11a('0xf'),JSON['stringify'](_0x32ed0c));if(_0x32ed0c[_0xc11a('0x12')]){if(_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x13')]===0x1f4){logger[_0xc11a('0x12')](_0xc11a('0xe'),_0x12dae9,_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);return _0x5c9eaf(_0x32ed0c['error']['message']);}logger['error'](_0xc11a('0xe'),_0x12dae9,_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);return _0x187704(_0x32ed0c[_0xc11a('0x12')][_0xc11a('0x14')]);}else{logger[_0xc11a('0x15')](_0xc11a('0xe'),_0x12dae9,_0xc11a('0xf'));_0x187704(_0x32ed0c['result']['message']);}})['catch'](function(_0x268098){logger[_0xc11a('0x12')](_0xc11a('0xe'),_0x12dae9,_0x268098);_0x5c9eaf(_0x268098);});});} \ No newline at end of file +var _0x9816=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x526cf7,_0x84357e){var _0x5f0167=function(_0xdb946a){while(--_0xdb946a){_0x526cf7['push'](_0x526cf7['shift']());}};_0x5f0167(++_0x84357e);}(_0x9816,0xfb));var _0x6981=function(_0x3f765e,_0xf68945){_0x3f765e=_0x3f765e-0x0;var _0x4df38f=_0x9816[_0x3f765e];return _0x4df38f;};'use strict';var _=require(_0x6981('0x0'));var util=require(_0x6981('0x1'));var moment=require(_0x6981('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6981('0x3'));var db=require(_0x6981('0x4'))['db'];var utils=require(_0x6981('0x5'));var logger=require('../../config/logger')(_0x6981('0x6'));var config=require(_0x6981('0x7'));var jayson=require(_0x6981('0x8'));var client=jayson[_0x6981('0x9')][_0x6981('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b80ee,_0x33e6d3,_0x195099){return new BPromise(function(_0x209356,_0x4d322f){return client[_0x6981('0xb')](_0x2b80ee,_0x195099)[_0x6981('0xc')](function(_0xb13680){logger[_0x6981('0xd')](_0x6981('0xe'),_0x33e6d3,_0x6981('0xf'));logger['debug'](_0x6981('0x10'),_0x33e6d3,_0x6981('0xf'),JSON[_0x6981('0x11')](_0xb13680));if(_0xb13680[_0x6981('0x12')]){if(_0xb13680[_0x6981('0x12')][_0x6981('0x13')]===0x1f4){logger[_0x6981('0x12')](_0x6981('0xe'),_0x33e6d3,_0xb13680[_0x6981('0x12')][_0x6981('0x14')]);return _0x4d322f(_0xb13680[_0x6981('0x12')]['message']);}logger[_0x6981('0x12')](_0x6981('0xe'),_0x33e6d3,_0xb13680[_0x6981('0x12')][_0x6981('0x14')]);return _0x209356(_0xb13680['error'][_0x6981('0x14')]);}else{logger[_0x6981('0xd')]('SalesforceField,\x20%s,\x20%s',_0x33e6d3,'request\x20sent');_0x209356(_0xb13680['result'][_0x6981('0x14')]);}})[_0x6981('0x15')](function(_0x3cc518){logger[_0x6981('0x12')]('SalesforceField,\x20%s,\x20%s',_0x33e6d3,_0x3cc518);_0x4d322f(_0x3cc518);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6ee48f8..3d5af40 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 _0x0fc2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x2c170a,_0x5014fa){var _0x546098=function(_0x1738f6){while(--_0x1738f6){_0x2c170a['push'](_0x2c170a['shift']());}};_0x546098(++_0x5014fa);}(_0x0fc2,0x6e));var _0x20fc=function(_0x39675a,_0x35d94f){_0x39675a=_0x39675a-0x0;var _0x25d638=_0x0fc2[_0x39675a];return _0x25d638;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var fs_extra=require(_0x20fc('0x5'));var auth=require(_0x20fc('0x6'));var interaction=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var controller=require(_0x20fc('0x9'));router[_0x20fc('0xa')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0xc')]);router[_0x20fc('0xa')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0xe')]);router[_0x20fc('0xa')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller['getConfigurations']);router[_0x20fc('0xa')](_0x20fc('0x10'),auth[_0x20fc('0xb')](),controller['getFields']);router[_0x20fc('0x11')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0x12')]);router[_0x20fc('0x11')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x13')]);router[_0x20fc('0x14')]('/:id',auth[_0x20fc('0xb')](),controller['update']);router[_0x20fc('0x15')]('/:id',auth[_0x20fc('0xb')](),controller['destroy']);module[_0x20fc('0x16')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','multer'];(function(_0x13e47d,_0x1e38bd){var _0x1042e4=function(_0x3e382b){while(--_0x3e382b){_0x13e47d['push'](_0x13e47d['shift']());}};_0x1042e4(++_0x1e38bd);}(_0x70e0,0x17b));var _0x070e=function(_0x23fa6d,_0x53ed97){_0x23fa6d=_0x23fa6d-0x0;var _0x562529=_0x70e0[_0x23fa6d];return _0x562529;};'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']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x070e('0xd')]);router[_0x070e('0xe')]('/',auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0x8')](),controller['update']);router['delete'](_0x070e('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3ec498f..320786d 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 _0x538b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x538b,0x187));var _0xb538=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x538b[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xb538('0x0'));module[_0xb538('0x1')]={'name':{'type':Sequelize[_0xb538('0x2')]},'description':{'type':Sequelize[_0xb538('0x2')]},'username':{'type':Sequelize[_0xb538('0x2')],'unique':_0xb538('0x3')},'password':{'type':Sequelize[_0xb538('0x2')]},'email':{'type':Sequelize[_0xb538('0x2')]},'remoteUri':{'type':Sequelize[_0xb538('0x2')],'unique':_0xb538('0x4')},'serverUrl':{'type':Sequelize[_0xb538('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x05a5=['sequelize','STRING','username','remoteUri'];(function(_0xe2ba19,_0x3ebe18){var _0x45c743=function(_0x4c2b6b){while(--_0x4c2b6b){_0xe2ba19['push'](_0xe2ba19['shift']());}};_0x45c743(++_0x3ebe18);}(_0x05a5,0x11c));var _0x505a=function(_0x5460d5,_0xf8f7e8){_0x5460d5=_0x5460d5-0x0;var _0x3f8f32=_0x05a5[_0x5460d5];return _0x3f8f32;};'use strict';var Sequelize=require(_0x505a('0x0'));module['exports']={'name':{'type':Sequelize[_0x505a('0x1')]},'description':{'type':Sequelize[_0x505a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x505a('0x2')},'password':{'type':Sequelize[_0x505a('0x1')]},'email':{'type':Sequelize[_0x505a('0x1')]},'remoteUri':{'type':Sequelize[_0x505a('0x1')],'unique':_0x505a('0x3')},'serverUrl':{'type':Sequelize[_0x505a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 3e02344..5a3b7b4 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 _0x042c=['reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','assign','remove','includes','forEach','internalType','push','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','boolean','True','GET','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','ServicenowConfiguration','rawAttributes','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','business_service','priority','sys_domain_path','rfc','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','subcategory','work_notes','short_description','delivery_task','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','company'];(function(_0x181d2d,_0x480cc8){var _0x4a0cfc=function(_0x5e96b1){while(--_0x5e96b1){_0x181d2d['push'](_0x181d2d['shift']());}};_0x4a0cfc(++_0x480cc8);}(_0x042c,0xe3));var _0xc042=function(_0x49fa24,_0x340e17){_0x49fa24=_0x49fa24-0x0;var _0x16bf61=_0x042c[_0x49fa24];return _0x16bf61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc042('0x0'));var jsonpatch=require(_0xc042('0x1'));var rp=require(_0xc042('0x2'));var moment=require('moment');var BPromise=require(_0xc042('0x3'));var Mustache=require(_0xc042('0x4'));var util=require(_0xc042('0x5'));var path=require('path');var sox=require(_0xc042('0x6'));var csv=require(_0xc042('0x7'));var ejs=require(_0xc042('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc042('0x9'));var squel=require(_0xc042('0xa'));var crypto=require(_0xc042('0xb'));var jsforce=require(_0xc042('0xc'));var deskjs=require(_0xc042('0xd'));var toCsv=require(_0xc042('0x7'));var querystring=require(_0xc042('0xe'));var Papa=require(_0xc042('0xf'));var Redis=require(_0xc042('0x10'));var authService=require(_0xc042('0x11'));var qs=require(_0xc042('0x12'));var as=require(_0xc042('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc042('0x14'))(_0xc042('0x15'));var utils=require(_0xc042('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc042('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc042('0x18'));function respondWithStatusCode(_0x3baf6d,_0x41a0f7){_0x41a0f7=_0x41a0f7||0xcc;return function(_0x3862a0){if(_0x3862a0){return _0x3baf6d[_0xc042('0x19')](_0x41a0f7);}return _0x3baf6d['status'](_0x41a0f7)[_0xc042('0x1a')]();};}function respondWithResult(_0x32d538,_0x453874){_0x453874=_0x453874||0xc8;return function(_0x556606){if(_0x556606){return _0x32d538[_0xc042('0x1b')](_0x453874)[_0xc042('0x1c')](_0x556606);}};}function respondWithFilteredResult(_0x2dc303,_0x456ef9){return function(_0xee595a){if(_0xee595a){var _0x1d5774=typeof _0x456ef9[_0xc042('0x1d')]===_0xc042('0x1e')&&typeof _0x456ef9[_0xc042('0x1f')]===_0xc042('0x1e');var _0x152dff=_0xee595a['count'];var _0x58654a=_0x1d5774?0x0:_0x456ef9[_0xc042('0x1d')];var _0x520497=_0x1d5774?_0xee595a[_0xc042('0x20')]:_0x456ef9[_0xc042('0x1d')]+_0x456ef9[_0xc042('0x1f')];var _0x25eaa5;if(_0x520497>=_0x152dff){_0x520497=_0x152dff;_0x25eaa5=0xc8;}else{_0x25eaa5=0xce;}_0x2dc303[_0xc042('0x1b')](_0x25eaa5);return _0x2dc303[_0xc042('0x21')](_0xc042('0x22'),_0x58654a+'-'+_0x520497+'/'+_0x152dff)[_0xc042('0x1c')](_0xee595a);}return null;};}function patchUpdates(_0x324fc4){return function(_0x57c0e9){try{jsonpatch['apply'](_0x57c0e9,_0x324fc4,!![]);}catch(_0x4dbe0e){return BPromise[_0xc042('0x23')](_0x4dbe0e);}return _0x57c0e9[_0xc042('0x24')]();};}function saveUpdates(_0x52ee9f,_0xa8e223){return function(_0xc4c990){if(_0xc4c990){return _0xc4c990[_0xc042('0x25')](_0x52ee9f)[_0xc042('0x26')](function(_0x296fa8){return _0x296fa8;});}return null;};}function removeEntity(_0x441a42,_0xce1ddf){return function(_0x243eab){if(_0x243eab){return _0x243eab[_0xc042('0x27')]()[_0xc042('0x26')](function(){_0x441a42[_0xc042('0x1b')](0xcc)[_0xc042('0x1a')]();});}};}function handleEntityNotFound(_0x2e9ad6,_0x33395f){return function(_0x335824){if(!_0x335824){_0x2e9ad6['sendStatus'](0x194);}return _0x335824;};}function handleError(_0x5218ea,_0x4e91db){_0x4e91db=_0x4e91db||0x1f4;return function(_0x93fc63){logger[_0xc042('0x28')](_0x93fc63['stack']);if(_0x93fc63['name']){delete _0x93fc63[_0xc042('0x29')];}_0x5218ea[_0xc042('0x1b')](_0x4e91db)[_0xc042('0x2a')](_0x93fc63);};}exports['index']=function(_0x8200bf,_0x36688a){var _0x675e5f={},_0x327c09={},_0x20cbe8={'count':0x0,'rows':[]};var _0x1c1b04=_[_0xc042('0x2b')](db[_0xc042('0x2c')]['rawAttributes'],function(_0x1c5cfd){return{'name':_0x1c5cfd[_0xc042('0x2d')],'type':_0x1c5cfd[_0xc042('0x2e')][_0xc042('0x2f')]};});_0x327c09[_0xc042('0x30')]=_['map'](_0x1c1b04,_0xc042('0x29'));_0x327c09[_0xc042('0x31')]=_[_0xc042('0x32')](_0x8200bf[_0xc042('0x31')]);_0x327c09[_0xc042('0x33')]=_['intersection'](_0x327c09['model'],_0x327c09[_0xc042('0x31')]);_0x675e5f[_0xc042('0x34')]=_[_0xc042('0x35')](_0x327c09['model'],qs[_0xc042('0x36')](_0x8200bf[_0xc042('0x31')][_0xc042('0x36')]));_0x675e5f[_0xc042('0x34')]=_0x675e5f[_0xc042('0x34')][_0xc042('0x37')]?_0x675e5f[_0xc042('0x34')]:_0x327c09[_0xc042('0x30')];if(!_0x8200bf[_0xc042('0x31')][_0xc042('0x38')](_0xc042('0x39'))){_0x675e5f[_0xc042('0x1f')]=qs['limit'](_0x8200bf[_0xc042('0x31')][_0xc042('0x1f')]);_0x675e5f[_0xc042('0x1d')]=qs['offset'](_0x8200bf['query']['offset']);}_0x675e5f['order']=qs['sort'](_0x8200bf['query'][_0xc042('0x3a')]);_0x675e5f[_0xc042('0x3b')]=qs[_0xc042('0x33')](_[_0xc042('0x3c')](_0x8200bf['query'],_0x327c09[_0xc042('0x33')]),_0x1c1b04);if(_0x8200bf[_0xc042('0x31')][_0xc042('0x3d')]){_0x675e5f[_0xc042('0x3b')]=_[_0xc042('0x3e')](_0x675e5f['where'],{'$or':_[_0xc042('0x2b')](_0x1c1b04,function(_0xbf956d){if(_0xbf956d['type']!==_0xc042('0x3f')){var _0x2f9cef={};_0x2f9cef[_0xbf956d[_0xc042('0x29')]]={'$like':'%'+_0x8200bf['query']['filter']+'%'};return _0x2f9cef;}})});}_0x675e5f=_[_0xc042('0x3e')]({},_0x675e5f,_0x8200bf[_0xc042('0x40')]);var _0x41c992={'where':_0x675e5f[_0xc042('0x3b')]};return db[_0xc042('0x2c')][_0xc042('0x20')](_0x41c992)[_0xc042('0x26')](function(_0xac730b){_0x20cbe8[_0xc042('0x20')]=_0xac730b;if(_0x8200bf[_0xc042('0x31')]['includeAll']){_0x675e5f[_0xc042('0x41')]=[{'all':!![]}];}return db[_0xc042('0x2c')][_0xc042('0x42')](_0x675e5f);})['then'](function(_0x46b670){_0x20cbe8[_0xc042('0x43')]=_0x46b670;return _0x20cbe8;})[_0xc042('0x26')](respondWithFilteredResult(_0x36688a,_0x675e5f))[_0xc042('0x44')](handleError(_0x36688a,null));};exports[_0xc042('0x45')]=function(_0x5a2597,_0x5b607a){var _0x531f88={'raw':![],'where':{'id':_0x5a2597[_0xc042('0x46')]['id']}},_0x5c6d9f={};_0x5c6d9f[_0xc042('0x30')]=_['keys'](db[_0xc042('0x2c')]['rawAttributes']);_0x5c6d9f['query']=_[_0xc042('0x32')](_0x5a2597[_0xc042('0x31')]);_0x5c6d9f[_0xc042('0x33')]=_[_0xc042('0x35')](_0x5c6d9f[_0xc042('0x30')],_0x5c6d9f[_0xc042('0x31')]);_0x531f88[_0xc042('0x34')]=_[_0xc042('0x35')](_0x5c6d9f['model'],qs[_0xc042('0x36')](_0x5a2597[_0xc042('0x31')][_0xc042('0x36')]));_0x531f88[_0xc042('0x34')]=_0x531f88[_0xc042('0x34')][_0xc042('0x37')]?_0x531f88['attributes']:_0x5c6d9f[_0xc042('0x30')];if(_0x5a2597[_0xc042('0x31')][_0xc042('0x47')]){_0x531f88[_0xc042('0x41')]=[{'all':!![]}];}_0x531f88=_[_0xc042('0x3e')]({},_0x531f88,_0x5a2597[_0xc042('0x40')]);return db[_0xc042('0x2c')][_0xc042('0x48')](_0x531f88)[_0xc042('0x26')](handleEntityNotFound(_0x5b607a,null))['then'](respondWithResult(_0x5b607a,null))[_0xc042('0x44')](handleError(_0x5b607a,null));};exports['create']=function(_0x51121c,_0x3609de){return db['ServicenowAccount'][_0xc042('0x49')](_0x51121c[_0xc042('0x4a')],{})[_0xc042('0x26')](respondWithResult(_0x3609de,0xc9))['catch'](handleError(_0x3609de,null));};exports[_0xc042('0x25')]=function(_0x571f61,_0x34e9a2){if(_0x571f61[_0xc042('0x4a')]['id']){delete _0x571f61[_0xc042('0x4a')]['id'];}return db[_0xc042('0x2c')][_0xc042('0x48')]({'where':{'id':_0x571f61[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x34e9a2,null))['then'](saveUpdates(_0x571f61[_0xc042('0x4a')],null))[_0xc042('0x26')](respondWithResult(_0x34e9a2,null))['catch'](handleError(_0x34e9a2,null));};exports[_0xc042('0x27')]=function(_0x1202f1,_0x16ddb0){return db[_0xc042('0x2c')][_0xc042('0x48')]({'where':{'id':_0x1202f1[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x16ddb0,null))[_0xc042('0x26')](removeEntity(_0x16ddb0,null))['catch'](handleError(_0x16ddb0,null));};exports['getConfigurations']=function(_0x203e62,_0x92ddc,_0x3162b2){var _0x2d3e3d={};var _0x1d605b={};var _0xae3d6b;var _0x71bcec;return db[_0xc042('0x2c')][_0xc042('0x4b')]({'where':{'id':_0x203e62[_0xc042('0x46')]['id']}})['then'](handleEntityNotFound(_0x92ddc,null))['then'](function(_0x207cf1){if(_0x207cf1){_0xae3d6b=_0x207cf1;_0x1d605b['model']=_[_0xc042('0x32')](db[_0xc042('0x4c')][_0xc042('0x4d')]);_0x1d605b[_0xc042('0x31')]=_[_0xc042('0x32')](_0x203e62[_0xc042('0x31')]);_0x1d605b['filters']=_[_0xc042('0x35')](_0x1d605b['model'],_0x1d605b[_0xc042('0x31')]);_0x2d3e3d[_0xc042('0x34')]=_[_0xc042('0x35')](_0x1d605b[_0xc042('0x30')],qs['fields'](_0x203e62['query'][_0xc042('0x36')]));_0x2d3e3d['attributes']=_0x2d3e3d['attributes'][_0xc042('0x37')]?_0x2d3e3d['attributes']:_0x1d605b[_0xc042('0x30')];_0x2d3e3d[_0xc042('0x4e')]=qs[_0xc042('0x3a')](_0x203e62[_0xc042('0x31')][_0xc042('0x3a')]);_0x2d3e3d[_0xc042('0x3b')]=qs[_0xc042('0x33')](_[_0xc042('0x3c')](_0x203e62[_0xc042('0x31')],_0x1d605b[_0xc042('0x33')]));if(_0x203e62['query']['filter']){_0x2d3e3d[_0xc042('0x3b')]=_[_0xc042('0x3e')](_0x2d3e3d[_0xc042('0x3b')],{'$or':_['map'](_0x2d3e3d['attributes'],function(_0x186ae1){var _0x5408b9={};_0x5408b9[_0x186ae1]={'$like':'%'+_0x203e62['query']['filter']+'%'};return _0x5408b9;})});}_0x2d3e3d=_[_0xc042('0x3e')]({},_0x2d3e3d,_0x203e62[_0xc042('0x40')]);return _0xae3d6b[_0xc042('0x4f')](_0x2d3e3d);}})['then'](function(_0x37d55e){if(_0x37d55e){_0x71bcec=_0x37d55e[_0xc042('0x37')];if(!_0x203e62[_0xc042('0x31')]['hasOwnProperty'](_0xc042('0x39'))){_0x2d3e3d[_0xc042('0x1f')]=qs[_0xc042('0x1f')](_0x203e62['query'][_0xc042('0x1f')]);_0x2d3e3d[_0xc042('0x1d')]=qs[_0xc042('0x1d')](_0x203e62[_0xc042('0x31')][_0xc042('0x1d')]);}return _0xae3d6b[_0xc042('0x4f')](_0x2d3e3d);}})[_0xc042('0x26')](function(_0x3e4f93){if(_0x3e4f93){return _0x3e4f93?{'count':_0x71bcec,'rows':_0x3e4f93}:null;}})[_0xc042('0x26')](respondWithResult(_0x92ddc,null))['catch'](handleError(_0x92ddc,null));};exports['addConfiguration']=function(_0x3c1818,_0x149950,_0x258edb){if(_0x3c1818['body']['id']){delete _0x3c1818[_0xc042('0x4a')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3c1818[_0xc042('0x46')]['id']}})[_0xc042('0x26')](handleEntityNotFound(_0x149950,null))[_0xc042('0x26')](function(_0x2d20c7){if(_0x2d20c7){_0x3c1818['body'][_0xc042('0x50')]=_0x2d20c7['id'];_0x3c1818[_0xc042('0x4a')][_0xc042('0x51')]=integrations[_0xc042('0x52')](_0x3c1818[_0xc042('0x4a')][_0xc042('0x53')],_0x3c1818[_0xc042('0x4a')]['type']);_0x3c1818['body'][_0xc042('0x54')]=integrations['getDescriptions'](_0x3c1818['body']['channel'],_0x3c1818['body'][_0xc042('0x2e')]);return db[_0xc042('0x4c')]['create'](_0x3c1818[_0xc042('0x4a')],{'include':[{'model':db[_0xc042('0x55')],'as':_0xc042('0x51')},{'model':db[_0xc042('0x55')],'as':_0xc042('0x54')}]});}return null;})[_0xc042('0x26')](respondWithResult(_0x149950,null))[_0xc042('0x44')](handleError(_0x149950,null));};exports['getFields']=function(_0x15b999,_0x27796c,_0x1f10ff){var _0x149b60=[_0xc042('0x56'),_0xc042('0x57'),_0xc042('0x58'),'subcategory',_0xc042('0x59'),_0xc042('0x5a'),_0xc042('0x5b'),_0xc042('0x5c'),_0xc042('0x5d')];var _0x2e3a16=[_0xc042('0x5e'),'made_sla',_0xc042('0x5f'),_0xc042('0x60'),_0xc042('0x61'),_0xc042('0x62'),_0xc042('0x63'),'hold_reason',_0xc042('0x64'),_0xc042('0x65'),_0xc042('0x66'),'sys_updated_by',_0xc042('0x67'),_0xc042('0x68'),_0xc042('0x69'),_0xc042('0x6a'),'state',_0xc042('0x6b'),'knowledge',_0xc042('0x4e'),_0xc042('0x6c'),_0xc042('0x6d'),_0xc042('0x6e'),_0xc042('0x6f'),'impact',_0xc042('0x70'),'work_notes_list',_0xc042('0x71'),_0xc042('0x72'),_0xc042('0x73'),_0xc042('0x74'),'time_worked','expected_start',_0xc042('0x75'),_0xc042('0x76'),'group_list',_0xc042('0x77'),_0xc042('0x78'),_0xc042('0x79'),_0xc042('0x7a'),'approval_set',_0xc042('0x7b'),_0xc042('0x7c'),_0xc042('0x7d'),_0xc042('0x59'),'correlation_display',_0xc042('0x7e'),'work_start','assignment_group','business_stc',_0xc042('0x7f'),_0xc042('0x80'),_0xc042('0x81'),_0xc042('0x5a'),_0xc042('0x82'),_0xc042('0x83'),_0xc042('0x84'),_0xc042('0x85'),_0xc042('0x86'),_0xc042('0x87'),'contact_type',_0xc042('0x88'),'incident_state',_0xc042('0x89'),'problem_id',_0xc042('0x8a'),_0xc042('0x8b'),_0xc042('0x8c'),_0xc042('0x8d'),_0xc042('0x5c'),_0xc042('0x8e'),_0xc042('0x8f'),_0xc042('0x90'),_0xc042('0x91'),_0xc042('0x92'),'sys_mod_count','reopen_count',_0xc042('0x93'),'escalation','upon_approval',_0xc042('0x94'),_0xc042('0x95'),_0xc042('0x5d')];var _0x1f3ef9='';var _0x1c9ee5='';var _0x239d26=[];var _0x57005b='';var _0x28bf80='';var _0x1c4908=[];var _0x544f47='';var _0x51e64f='';var _0x136d92={};var _0x2f13a1='';return db[_0xc042('0x2c')]['findOne']({'where':{'id':_0x15b999[_0xc042('0x46')]['id']},'attributes':['id',_0xc042('0x96'),_0xc042('0x97'),_0xc042('0x98'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x27796c,null))[_0xc042('0x26')](function(_0x3f5e23){if(_0x3f5e23){_0x2f13a1=_0x3f5e23[_0xc042('0x99')];var _0x38eb3e=_0x2f13a1[_0xc042('0x9a')](-0x1);if(_0x38eb3e==='/'){_0x2f13a1=_0x2f13a1[_0xc042('0x9b')](0x0,_0x2f13a1[_0xc042('0x9c')](_0x38eb3e));}_0x51e64f=util[_0xc042('0x9d')](_0xc042('0x9e'),_0x2f13a1);_0x544f47=util[_0xc042('0x9d')](_0xc042('0x9f'),_0x2f13a1);_0x136d92={'user':_0x3f5e23[_0xc042('0x96')],'pass':_0x3f5e23[_0xc042('0x97')]};var _0x4013ad={'method':'GET','uri':_0x51e64f+_0xc042('0xa0'),'auth':_0x136d92,'json':!![]};return rp(_0x4013ad);}})[_0xc042('0x26')](function(_0x25d671){if(_0x25d671[_0xc042('0xa1')]['length']>0x0){_0x1f3ef9=_0x25d671[_0xc042('0xa1')];}console['log']('incident\x20table\x20objects',_0x1f3ef9);_0x1c4908=[];_0x1c9ee5=Object[_0xc042('0xa2')]([],_0x1f3ef9);_[_0xc042('0xa3')](_0x1c9ee5,function(_0x389b9f){return!_0x149b60[_0xc042('0xa4')](_0x389b9f[_0xc042('0x29')]);});_0x1c9ee5[_0xc042('0xa5')](function(_0x45216b){var _0xe33165=createFieldObject(_0x544f47,_0x136d92,_0x45216b[_0xc042('0xa6')],_0x45216b[_0xc042('0x29')],_0x45216b['label'],![]);_0x1c4908[_0xc042('0xa7')](_0xe33165);});return Promise['all'](_0x1c4908);})[_0xc042('0x26')](function(_0x5c5ee3){_0x239d26=_0x5c5ee3;_0x57005b=Object['assign']([],_0x1f3ef9);console[_0xc042('0xa8')]('TCL:\x20_object',_0x1f3ef9);_[_0xc042('0xa3')](_0x57005b,function(_0x52a9a9){return _0x2e3a16[_0xc042('0xa4')](_0x52a9a9[_0xc042('0x29')]);});console[_0xc042('0xa8')](_0xc042('0xa9'),_0x57005b);_0x1c4908=[];_0x57005b['forEach'](function(_0x5c419f){var _0x8ad54=createFieldObject(_0x544f47,_0x136d92,_0x5c419f[_0xc042('0xa6')],_0x5c419f[_0xc042('0x29')],_0x5c419f[_0xc042('0xaa')],!![]);_0x1c4908[_0xc042('0xa7')](_0x8ad54);});return Promise['all'](_0x1c4908);})[_0xc042('0x26')](function(_0x453426){_0x28bf80=_0x453426;var _0x3b6685=_0x239d26['concat'](_0x28bf80);return{'count':_0x3b6685[_0xc042('0x37')],'rows':_0x3b6685};})[_0xc042('0x26')](respondWithResult(_0x27796c,null))[_0xc042('0x44')](function(_0x36d36f){console['log'](_0xc042('0xab')+_0x36d36f);var _0x5bb41a=_0x15b999[_0xc042('0x31')][_0xc042('0xac')]?0x1f4:_0x36d36f[_0xc042('0xad')]||0x1f4;logger[_0xc042('0x28')](_0x36d36f[_0xc042('0xae')]);delete _0x36d36f['name'];if(_0x5bb41a===0x191){_0x5bb41a=0x190;}_0x27796c[_0xc042('0x1b')](_0x5bb41a)[_0xc042('0x2a')](_0x15b999[_0xc042('0x31')]['test']?{'message':_0xc042('0xaf'),'statusCode':_0x36d36f[_0xc042('0xad')]}:_0x36d36f);});};function createFieldObject(_0x155e1f,_0x10051c,_0x2e9821,_0xeabcfe,_0xb78f81,_0x5f2407){return new Promise(function(_0x147d15,_0x277e5e){var _0x3d1308={'id':_0xeabcfe,'name':_0xb78f81,'custom':_0x5f2407};if(_0x2e9821===_0xc042('0xb0')){_0x3d1308[_0xc042('0x40')]=[{'name':_0xc042('0xb1'),'value':'true'},{'name':'False','value':'false'}];_0x147d15(_0x3d1308);}else{var _0x2e72d8={'method':_0xc042('0xb2'),'uri':_0x155e1f+_0xc042('0xb3')+_0xeabcfe,'auth':_0x10051c,'json':!![]};return rp(_0x2e72d8)['then'](function(_0x462223){var _0x585396=[];if(_0x462223[_0xc042('0xa1')][_0xc042('0x37')]>0x0){_0x462223[_0xc042('0xa1')][_0xc042('0xa5')](function(_0x429a4c){if(_0x429a4c[_0xc042('0xb4')]===_0xc042('0xb5')){var _0x369fad={'name':_0x429a4c['label'],'value':_0x429a4c[_0xc042('0xb6')]};_0x585396['push'](_0x369fad);}});}_0x3d1308[_0xc042('0x40')]=_0x585396;if(_0x3d1308['options'][_0xc042('0x37')]>0x0){_0x147d15(_0x3d1308);}else{if(_0x5f2407==![]){_0x147d15();}else{_0x147d15(_0x3d1308);}}});}});} \ No newline at end of file +var _0x2afb=['inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','set','apply','save','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','update','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location','password','email','remoteUri','slice','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','assign','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','Wrong\x20credentials','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element='];(function(_0x518f6e,_0x5398e2){var _0x25bf82=function(_0x2af46e){while(--_0x2af46e){_0x518f6e['push'](_0x518f6e['shift']());}};_0x25bf82(++_0x5398e2);}(_0x2afb,0x17c));var _0xb2af=function(_0x40d339,_0xb726c3){_0x40d339=_0x40d339-0x0;var _0x5cbd0b=_0x2afb[_0x40d339];return _0x5cbd0b;};'use strict';var emlformat=require(_0xb2af('0x0'));var rimraf=require(_0xb2af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2af('0x2'));var rp=require(_0xb2af('0x3'));var moment=require(_0xb2af('0x4'));var BPromise=require(_0xb2af('0x5'));var Mustache=require(_0xb2af('0x6'));var util=require(_0xb2af('0x7'));var path=require(_0xb2af('0x8'));var sox=require(_0xb2af('0x9'));var csv=require('to-csv');var ejs=require(_0xb2af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2af('0xb'));var squel=require('squel');var crypto=require(_0xb2af('0xc'));var jsforce=require(_0xb2af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb2af('0xe'));var querystring=require(_0xb2af('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2af('0x10'));var authService=require(_0xb2af('0x11'));var qs=require(_0xb2af('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb2af('0x13'));var logger=require('../../config/logger')(_0xb2af('0x14'));var utils=require('../../config/utils');var config=require(_0xb2af('0x15'));var licenseUtil=require(_0xb2af('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb2af('0x17'));function respondWithStatusCode(_0x252a64,_0x149564){_0x149564=_0x149564||0xcc;return function(_0x417c01){if(_0x417c01){return _0x252a64[_0xb2af('0x18')](_0x149564);}return _0x252a64[_0xb2af('0x19')](_0x149564)[_0xb2af('0x1a')]();};}function respondWithResult(_0x4b3eb2,_0xce75cc){_0xce75cc=_0xce75cc||0xc8;return function(_0x3dd960){if(_0x3dd960){return _0x4b3eb2[_0xb2af('0x19')](_0xce75cc)[_0xb2af('0x1b')](_0x3dd960);}};}function respondWithFilteredResult(_0x45ea8d,_0x540887){return function(_0x49aabb){if(_0x49aabb){var _0x279a65=typeof _0x540887['offset']===_0xb2af('0x1c')&&typeof _0x540887['limit']===_0xb2af('0x1c');var _0x1c421d=_0x49aabb[_0xb2af('0x1d')];var _0x1c9dc5=_0x279a65?0x0:_0x540887[_0xb2af('0x1e')];var _0x555d55=_0x279a65?_0x49aabb[_0xb2af('0x1d')]:_0x540887[_0xb2af('0x1e')]+_0x540887['limit'];var _0x3f3aca;if(_0x555d55>=_0x1c421d){_0x555d55=_0x1c421d;_0x3f3aca=0xc8;}else{_0x3f3aca=0xce;}_0x45ea8d[_0xb2af('0x19')](_0x3f3aca);return _0x45ea8d[_0xb2af('0x1f')]('Content-Range',_0x1c9dc5+'-'+_0x555d55+'/'+_0x1c421d)[_0xb2af('0x1b')](_0x49aabb);}return null;};}function patchUpdates(_0x5b56d1){return function(_0x5d944f){try{jsonpatch[_0xb2af('0x20')](_0x5d944f,_0x5b56d1,!![]);}catch(_0x57c241){return BPromise['reject'](_0x57c241);}return _0x5d944f[_0xb2af('0x21')]();};}function saveUpdates(_0x560645,_0x4db525){return function(_0x47bb58){if(_0x47bb58){return _0x47bb58['update'](_0x560645)[_0xb2af('0x22')](function(_0x5aa239){return _0x5aa239;});}return null;};}function removeEntity(_0x1da3d4,_0x4f37ff){return function(_0x4272e3){if(_0x4272e3){return _0x4272e3['destroy']()[_0xb2af('0x22')](function(){_0x1da3d4[_0xb2af('0x19')](0xcc)[_0xb2af('0x1a')]();});}};}function handleEntityNotFound(_0x14c094,_0x2501d5){return function(_0x7c19ff){if(!_0x7c19ff){_0x14c094[_0xb2af('0x18')](0x194);}return _0x7c19ff;};}function handleError(_0x466abe,_0x45391c){_0x45391c=_0x45391c||0x1f4;return function(_0x493cc2){logger[_0xb2af('0x23')](_0x493cc2[_0xb2af('0x24')]);if(_0x493cc2['name']){delete _0x493cc2[_0xb2af('0x25')];}_0x466abe[_0xb2af('0x19')](_0x45391c)[_0xb2af('0x26')](_0x493cc2);};}exports[_0xb2af('0x27')]=function(_0x55e3fa,_0x33d0aa){var _0x2712dd={},_0x5dc2f4={},_0x49bd35={'count':0x0,'rows':[]};var _0x281f3d=_[_0xb2af('0x28')](db[_0xb2af('0x29')]['rawAttributes'],function(_0x5374e4){return{'name':_0x5374e4[_0xb2af('0x2a')],'type':_0x5374e4[_0xb2af('0x2b')][_0xb2af('0x2c')]};});_0x5dc2f4[_0xb2af('0x2d')]=_[_0xb2af('0x28')](_0x281f3d,_0xb2af('0x25'));_0x5dc2f4[_0xb2af('0x2e')]=_[_0xb2af('0x2f')](_0x55e3fa['query']);_0x5dc2f4[_0xb2af('0x30')]=_[_0xb2af('0x31')](_0x5dc2f4[_0xb2af('0x2d')],_0x5dc2f4[_0xb2af('0x2e')]);_0x2712dd[_0xb2af('0x32')]=_[_0xb2af('0x31')](_0x5dc2f4[_0xb2af('0x2d')],qs[_0xb2af('0x33')](_0x55e3fa[_0xb2af('0x2e')][_0xb2af('0x33')]));_0x2712dd[_0xb2af('0x32')]=_0x2712dd['attributes'][_0xb2af('0x34')]?_0x2712dd[_0xb2af('0x32')]:_0x5dc2f4['model'];if(!_0x55e3fa[_0xb2af('0x2e')][_0xb2af('0x35')](_0xb2af('0x36'))){_0x2712dd[_0xb2af('0x37')]=qs[_0xb2af('0x37')](_0x55e3fa['query'][_0xb2af('0x37')]);_0x2712dd['offset']=qs[_0xb2af('0x1e')](_0x55e3fa['query'][_0xb2af('0x1e')]);}_0x2712dd[_0xb2af('0x38')]=qs[_0xb2af('0x39')](_0x55e3fa[_0xb2af('0x2e')][_0xb2af('0x39')]);_0x2712dd[_0xb2af('0x3a')]=qs['filters'](_[_0xb2af('0x3b')](_0x55e3fa[_0xb2af('0x2e')],_0x5dc2f4[_0xb2af('0x30')]),_0x281f3d);if(_0x55e3fa[_0xb2af('0x2e')]['filter']){_0x2712dd[_0xb2af('0x3a')]=_[_0xb2af('0x3c')](_0x2712dd[_0xb2af('0x3a')],{'$or':_[_0xb2af('0x28')](_0x281f3d,function(_0x33a86d){if(_0x33a86d[_0xb2af('0x2b')]!=='VIRTUAL'){var _0x1939cb={};_0x1939cb[_0x33a86d['name']]={'$like':'%'+_0x55e3fa[_0xb2af('0x2e')][_0xb2af('0x3d')]+'%'};return _0x1939cb;}})});}_0x2712dd=_['merge']({},_0x2712dd,_0x55e3fa[_0xb2af('0x3e')]);var _0x53255e={'where':_0x2712dd[_0xb2af('0x3a')]};return db[_0xb2af('0x29')][_0xb2af('0x1d')](_0x53255e)['then'](function(_0x21efd4){_0x49bd35['count']=_0x21efd4;if(_0x55e3fa[_0xb2af('0x2e')][_0xb2af('0x3f')]){_0x2712dd['include']=[{'all':!![]}];}return db[_0xb2af('0x29')][_0xb2af('0x40')](_0x2712dd);})['then'](function(_0x370385){_0x49bd35[_0xb2af('0x41')]=_0x370385;return _0x49bd35;})[_0xb2af('0x22')](respondWithFilteredResult(_0x33d0aa,_0x2712dd))['catch'](handleError(_0x33d0aa,null));};exports[_0xb2af('0x42')]=function(_0x460a8a,_0x590acd){var _0x180057={'raw':![],'where':{'id':_0x460a8a[_0xb2af('0x43')]['id']}},_0x4b6366={};_0x4b6366['model']=_['keys'](db['ServicenowAccount'][_0xb2af('0x44')]);_0x4b6366[_0xb2af('0x2e')]=_[_0xb2af('0x2f')](_0x460a8a[_0xb2af('0x2e')]);_0x4b6366[_0xb2af('0x30')]=_[_0xb2af('0x31')](_0x4b6366['model'],_0x4b6366[_0xb2af('0x2e')]);_0x180057[_0xb2af('0x32')]=_[_0xb2af('0x31')](_0x4b6366[_0xb2af('0x2d')],qs[_0xb2af('0x33')](_0x460a8a['query'][_0xb2af('0x33')]));_0x180057[_0xb2af('0x32')]=_0x180057['attributes'][_0xb2af('0x34')]?_0x180057[_0xb2af('0x32')]:_0x4b6366[_0xb2af('0x2d')];if(_0x460a8a[_0xb2af('0x2e')][_0xb2af('0x3f')]){_0x180057[_0xb2af('0x45')]=[{'all':!![]}];}_0x180057=_['merge']({},_0x180057,_0x460a8a[_0xb2af('0x3e')]);return db[_0xb2af('0x29')][_0xb2af('0x46')](_0x180057)[_0xb2af('0x22')](handleEntityNotFound(_0x590acd,null))[_0xb2af('0x22')](respondWithResult(_0x590acd,null))[_0xb2af('0x47')](handleError(_0x590acd,null));};exports[_0xb2af('0x48')]=function(_0x58d509,_0x1682a2){return db[_0xb2af('0x29')][_0xb2af('0x48')](_0x58d509[_0xb2af('0x49')],{})[_0xb2af('0x22')](respondWithResult(_0x1682a2,0xc9))[_0xb2af('0x47')](handleError(_0x1682a2,null));};exports[_0xb2af('0x4a')]=function(_0x1d240d,_0x360eea){if(_0x1d240d[_0xb2af('0x49')]['id']){delete _0x1d240d[_0xb2af('0x49')]['id'];}return db[_0xb2af('0x29')][_0xb2af('0x46')]({'where':{'id':_0x1d240d[_0xb2af('0x43')]['id']}})[_0xb2af('0x22')](handleEntityNotFound(_0x360eea,null))['then'](saveUpdates(_0x1d240d['body'],null))[_0xb2af('0x22')](respondWithResult(_0x360eea,null))[_0xb2af('0x47')](handleError(_0x360eea,null));};exports[_0xb2af('0x4b')]=function(_0x26c62c,_0x15cee1){return db[_0xb2af('0x29')][_0xb2af('0x46')]({'where':{'id':_0x26c62c[_0xb2af('0x43')]['id']}})[_0xb2af('0x22')](handleEntityNotFound(_0x15cee1,null))[_0xb2af('0x22')](removeEntity(_0x15cee1,null))['catch'](handleError(_0x15cee1,null));};exports[_0xb2af('0x4c')]=function(_0x427b3f,_0x29493f,_0x142669){var _0x29bb16={};var _0x28ab4a={};var _0x35003b;var _0xbf8f79;return db['ServicenowAccount'][_0xb2af('0x4d')]({'where':{'id':_0x427b3f[_0xb2af('0x43')]['id']}})[_0xb2af('0x22')](handleEntityNotFound(_0x29493f,null))[_0xb2af('0x22')](function(_0x2dd22e){if(_0x2dd22e){_0x35003b=_0x2dd22e;_0x28ab4a[_0xb2af('0x2d')]=_[_0xb2af('0x2f')](db['ServicenowConfiguration'][_0xb2af('0x44')]);_0x28ab4a[_0xb2af('0x2e')]=_[_0xb2af('0x2f')](_0x427b3f[_0xb2af('0x2e')]);_0x28ab4a[_0xb2af('0x30')]=_['intersection'](_0x28ab4a[_0xb2af('0x2d')],_0x28ab4a['query']);_0x29bb16[_0xb2af('0x32')]=_[_0xb2af('0x31')](_0x28ab4a['model'],qs[_0xb2af('0x33')](_0x427b3f[_0xb2af('0x2e')][_0xb2af('0x33')]));_0x29bb16[_0xb2af('0x32')]=_0x29bb16[_0xb2af('0x32')][_0xb2af('0x34')]?_0x29bb16['attributes']:_0x28ab4a['model'];_0x29bb16[_0xb2af('0x38')]=qs['sort'](_0x427b3f[_0xb2af('0x2e')][_0xb2af('0x39')]);_0x29bb16[_0xb2af('0x3a')]=qs[_0xb2af('0x30')](_[_0xb2af('0x3b')](_0x427b3f[_0xb2af('0x2e')],_0x28ab4a[_0xb2af('0x30')]));if(_0x427b3f['query']['filter']){_0x29bb16[_0xb2af('0x3a')]=_['merge'](_0x29bb16['where'],{'$or':_['map'](_0x29bb16[_0xb2af('0x32')],function(_0x47b56b){var _0x5a7270={};_0x5a7270[_0x47b56b]={'$like':'%'+_0x427b3f[_0xb2af('0x2e')][_0xb2af('0x3d')]+'%'};return _0x5a7270;})});}_0x29bb16=_[_0xb2af('0x3c')]({},_0x29bb16,_0x427b3f[_0xb2af('0x3e')]);return _0x35003b[_0xb2af('0x4c')](_0x29bb16);}})[_0xb2af('0x22')](function(_0x226d2f){if(_0x226d2f){_0xbf8f79=_0x226d2f[_0xb2af('0x34')];if(!_0x427b3f[_0xb2af('0x2e')][_0xb2af('0x35')](_0xb2af('0x36'))){_0x29bb16['limit']=qs[_0xb2af('0x37')](_0x427b3f[_0xb2af('0x2e')][_0xb2af('0x37')]);_0x29bb16[_0xb2af('0x1e')]=qs['offset'](_0x427b3f['query'][_0xb2af('0x1e')]);}return _0x35003b[_0xb2af('0x4c')](_0x29bb16);}})['then'](function(_0x43d745){if(_0x43d745){return _0x43d745?{'count':_0xbf8f79,'rows':_0x43d745}:null;}})[_0xb2af('0x22')](respondWithResult(_0x29493f,null))[_0xb2af('0x47')](handleError(_0x29493f,null));};exports[_0xb2af('0x4e')]=function(_0x4a4f7a,_0x42ae68,_0x10c882){if(_0x4a4f7a[_0xb2af('0x49')]['id']){delete _0x4a4f7a['body']['id'];}return db[_0xb2af('0x29')]['findOne']({'where':{'id':_0x4a4f7a[_0xb2af('0x43')]['id']}})['then'](handleEntityNotFound(_0x42ae68,null))[_0xb2af('0x22')](function(_0x4244b9){if(_0x4244b9){_0x4a4f7a[_0xb2af('0x49')][_0xb2af('0x4f')]=_0x4244b9['id'];_0x4a4f7a[_0xb2af('0x49')][_0xb2af('0x50')]=integrations[_0xb2af('0x51')](_0x4a4f7a['body']['channel'],_0x4a4f7a[_0xb2af('0x49')]['type']);_0x4a4f7a[_0xb2af('0x49')][_0xb2af('0x52')]=integrations['getDescriptions'](_0x4a4f7a[_0xb2af('0x49')][_0xb2af('0x53')],_0x4a4f7a[_0xb2af('0x49')][_0xb2af('0x2b')]);return db[_0xb2af('0x54')][_0xb2af('0x48')](_0x4a4f7a[_0xb2af('0x49')],{'include':[{'model':db[_0xb2af('0x55')],'as':_0xb2af('0x50')},{'model':db[_0xb2af('0x55')],'as':_0xb2af('0x52')}]});}return null;})[_0xb2af('0x22')](respondWithResult(_0x42ae68,null))['catch'](handleError(_0x42ae68,null));};exports[_0xb2af('0x56')]=function(_0x4f5059,_0x2a8ac6,_0x1ebb51){var _0x29b1af=[_0xb2af('0x57'),_0xb2af('0x58'),'knowledge',_0xb2af('0x59'),_0xb2af('0x5a'),_0xb2af('0x5b'),_0xb2af('0x5c'),_0xb2af('0x5d'),_0xb2af('0x5e')];var _0x30a571=[_0xb2af('0x5f'),_0xb2af('0x57'),_0xb2af('0x60'),_0xb2af('0x61'),_0xb2af('0x62'),_0xb2af('0x63'),_0xb2af('0x64'),'hold_reason',_0xb2af('0x65'),_0xb2af('0x66'),'resolved_by',_0xb2af('0x67'),_0xb2af('0x68'),_0xb2af('0x69'),_0xb2af('0x6a'),_0xb2af('0x6b'),_0xb2af('0x6c'),'sys_created_by',_0xb2af('0x6d'),_0xb2af('0x38'),_0xb2af('0x6e'),_0xb2af('0x6f'),_0xb2af('0x70'),_0xb2af('0x71'),_0xb2af('0x72'),_0xb2af('0x73'),_0xb2af('0x74'),_0xb2af('0x75'),_0xb2af('0x76'),_0xb2af('0x77'),_0xb2af('0x78'),'time_worked',_0xb2af('0x79'),_0xb2af('0x7a'),_0xb2af('0x7b'),_0xb2af('0x7c'),'work_end',_0xb2af('0x7d'),'resolved_at',_0xb2af('0x7e'),_0xb2af('0x7f'),'subcategory',_0xb2af('0x80'),_0xb2af('0x81'),_0xb2af('0x5a'),_0xb2af('0x82'),_0xb2af('0x83'),_0xb2af('0x84'),_0xb2af('0x85'),'business_stc','additional_assignee_list',_0xb2af('0x86'),_0xb2af('0x87'),_0xb2af('0x5b'),_0xb2af('0x88'),_0xb2af('0x89'),_0xb2af('0x8a'),'follow_up',_0xb2af('0x8b'),_0xb2af('0x8c'),'contact_type',_0xb2af('0x8d'),_0xb2af('0x5c'),_0xb2af('0x8e'),_0xb2af('0x8f'),_0xb2af('0x90'),_0xb2af('0x91'),_0xb2af('0x92'),_0xb2af('0x93'),_0xb2af('0x5d'),_0xb2af('0x94'),_0xb2af('0x95'),_0xb2af('0x96'),'comments_and_work_notes','due_date',_0xb2af('0x97'),_0xb2af('0x98'),'sys_tags',_0xb2af('0x99'),_0xb2af('0x9a'),_0xb2af('0x9b'),_0xb2af('0x9c'),_0xb2af('0x5e')];var _0x11b4c2='';var _0x116a2c='';var _0x2addb3=[];var _0x559f8f='';var _0xeac01e='';var _0x5ec434=[];var _0x164303='';var _0x41b345='';var _0x585380={};var _0x5c2c29='';return db[_0xb2af('0x29')][_0xb2af('0x4d')]({'where':{'id':_0x4f5059[_0xb2af('0x43')]['id']},'attributes':['id','username',_0xb2af('0x9d'),_0xb2af('0x9e'),_0xb2af('0x9f'),'serverUrl']})[_0xb2af('0x22')](handleEntityNotFound(_0x2a8ac6,null))[_0xb2af('0x22')](function(_0x5c0f5d){if(_0x5c0f5d){_0x5c2c29=_0x5c0f5d['remoteUri'];var _0x18b19f=_0x5c2c29[_0xb2af('0xa0')](-0x1);if(_0x18b19f==='/'){_0x5c2c29=_0x5c2c29[_0xb2af('0xa1')](0x0,_0x5c2c29['lastIndexOf'](_0x18b19f));}_0x41b345=util[_0xb2af('0xa2')]('%s/api/now/doc/table/schema/',_0x5c2c29);_0x164303=util[_0xb2af('0xa2')](_0xb2af('0xa3'),_0x5c2c29);_0x585380={'user':_0x5c0f5d['username'],'pass':_0x5c0f5d[_0xb2af('0x9d')]};var _0x21559f={'method':_0xb2af('0xa4'),'uri':_0x41b345+_0xb2af('0xa5'),'auth':_0x585380,'json':!![]};return rp(_0x21559f);}})[_0xb2af('0x22')](function(_0x4fff2a){if(_0x4fff2a[_0xb2af('0xa6')][_0xb2af('0x34')]>0x0){_0x11b4c2=_0x4fff2a[_0xb2af('0xa6')];}console[_0xb2af('0xa7')](_0xb2af('0xa8'),_0x11b4c2);_0x5ec434=[];_0x116a2c=Object['assign']([],_0x11b4c2);_[_0xb2af('0xa9')](_0x116a2c,function(_0x4fe645){return!_0x29b1af[_0xb2af('0xaa')](_0x4fe645['name']);});_0x116a2c[_0xb2af('0xab')](function(_0x1f4852){var _0x2fbce7=createFieldObject(_0x164303,_0x585380,_0x1f4852[_0xb2af('0xac')],_0x1f4852[_0xb2af('0x25')],_0x1f4852[_0xb2af('0xad')],![]);_0x5ec434[_0xb2af('0xae')](_0x2fbce7);});return Promise['all'](_0x5ec434);})[_0xb2af('0x22')](function(_0x402fe2){_0x2addb3=_0x402fe2;_0x559f8f=Object[_0xb2af('0xaf')]([],_0x11b4c2);console[_0xb2af('0xa7')]('TCL:\x20_object',_0x11b4c2);_[_0xb2af('0xa9')](_0x559f8f,function(_0x58a63a){return _0x30a571[_0xb2af('0xaa')](_0x58a63a[_0xb2af('0x25')]);});console[_0xb2af('0xa7')](_0xb2af('0xb0'),_0x559f8f);_0x5ec434=[];_0x559f8f[_0xb2af('0xab')](function(_0x114063){var _0x54229f=createFieldObject(_0x164303,_0x585380,_0x114063[_0xb2af('0xac')],_0x114063[_0xb2af('0x25')],_0x114063[_0xb2af('0xad')],!![]);_0x5ec434[_0xb2af('0xae')](_0x54229f);});return Promise['all'](_0x5ec434);})[_0xb2af('0x22')](function(_0x595665){_0xeac01e=_0x595665;var _0x5f6892=_0x2addb3[_0xb2af('0xb1')](_0xeac01e);return{'count':_0x5f6892['length'],'rows':_0x5f6892};})[_0xb2af('0x22')](respondWithResult(_0x2a8ac6,null))[_0xb2af('0x47')](function(_0x4d54ae){console['log'](_0xb2af('0xb2')+_0x4d54ae);var _0xe989fc=_0x4f5059[_0xb2af('0x2e')]['test']?0x1f4:_0x4d54ae['statusCode']||0x1f4;logger['error'](_0x4d54ae['stack']);delete _0x4d54ae[_0xb2af('0x25')];if(_0xe989fc===0x191){_0xe989fc=0x190;}_0x2a8ac6[_0xb2af('0x19')](_0xe989fc)[_0xb2af('0x26')](_0x4f5059[_0xb2af('0x2e')]['test']?{'message':_0xb2af('0xb3'),'statusCode':_0x4d54ae[_0xb2af('0xb4')]}:_0x4d54ae);});};function createFieldObject(_0x1efefe,_0x3bba53,_0x3f228b,_0x2c801a,_0xba7f6e,_0xd99211){return new Promise(function(_0x3344e2,_0x3f5038){var _0x466e22={'id':_0x2c801a,'name':_0xba7f6e,'custom':_0xd99211};if(_0x3f228b===_0xb2af('0xb5')){_0x466e22[_0xb2af('0x3e')]=[{'name':_0xb2af('0xb6'),'value':_0xb2af('0xb7')},{'name':_0xb2af('0xb8'),'value':_0xb2af('0xb9')}];_0x3344e2(_0x466e22);}else{var _0xd1cd53={'method':_0xb2af('0xa4'),'uri':_0x1efefe+_0xb2af('0xba')+_0x2c801a,'auth':_0x3bba53,'json':!![]};return rp(_0xd1cd53)[_0xb2af('0x22')](function(_0x56aaa7){var _0x34d680=[];if(_0x56aaa7['result'][_0xb2af('0x34')]>0x0){_0x56aaa7[_0xb2af('0xa6')][_0xb2af('0xab')](function(_0x5709df){if(_0x5709df[_0xb2af('0xbb')]==='false'){var _0x35451e={'name':_0x5709df[_0xb2af('0xad')],'value':_0x5709df[_0xb2af('0xbc')]};_0x34d680[_0xb2af('0xae')](_0x35451e);}});}_0x466e22['options']=_0x34d680;if(_0x466e22[_0xb2af('0x3e')][_0xb2af('0x34')]>0x0){_0x3344e2(_0x466e22);}else{if(_0xd99211==![]){_0x3344e2();}else{_0x3344e2(_0x466e22);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f112cb0..0e8f93b 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 _0xda19=['request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','moment'];(function(_0x1a3c77,_0x3f7c0f){var _0x156d41=function(_0x4d5823){while(--_0x4d5823){_0x1a3c77['push'](_0x1a3c77['shift']());}};_0x156d41(++_0x3f7c0f);}(_0xda19,0xd5));var _0x9da1=function(_0xab16c1,_0x2810ed){_0xab16c1=_0xab16c1-0x0;var _0x45675c=_0xda19[_0xab16c1];return _0x45675c;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));var integrations=require(_0x9da1('0x7'));module[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return _0x2dcbc6[_0x9da1('0x9')](_0x9da1('0xa'),attributes,{'tableName':_0x9da1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x3e44b0,_0x5255c1){var _0x2ba8a4=function(_0x330552){while(--_0x330552){_0x3e44b0['push'](_0x3e44b0['shift']());}};_0x2ba8a4(++_0x5255c1);}(_0x2bd8,0x130));var _0x82bd=function(_0x46aee9,_0x20fcc9){_0x46aee9=_0x46aee9-0x0;var _0x3cda92=_0x2bd8[_0x46aee9];return _0x3cda92;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));var integrations=require(_0x82bd('0x9'));module[_0x82bd('0xa')]=function(_0x5ceb60,_0x19dbb1){return _0x5ceb60[_0x82bd('0xb')](_0x82bd('0xc'),attributes,{'tableName':_0x82bd('0xd'),'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 a6946bd..f666d79 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 _0x17fc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','map','include','model','ShowServicenowAccount','find','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x17fc,0x1ab));var _0xc17f=function(_0xf95580,_0x2dfe6b){_0xf95580=_0xf95580-0x0;var _0x1608b3=_0x17fc[_0xf95580];return _0x1608b3;};'use strict';var _=require(_0xc17f('0x0'));var util=require(_0xc17f('0x1'));var moment=require(_0xc17f('0x2'));var BPromise=require(_0xc17f('0x3'));var rs=require(_0xc17f('0x4'));var fs=require('fs');var Redis=require(_0xc17f('0x5'));var db=require(_0xc17f('0x6'))['db'];var utils=require(_0xc17f('0x7'));var logger=require(_0xc17f('0x8'))(_0xc17f('0x9'));var config=require('../../config/environment');var jayson=require(_0xc17f('0xa'));var client=jayson[_0xc17f('0xb')][_0xc17f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x158131,_0x180f45,_0x411b5e){return new BPromise(function(_0x87820c,_0x553b6a){return client['request'](_0x158131,_0x411b5e)[_0xc17f('0xd')](function(_0x2cc1eb){logger[_0xc17f('0xe')](_0xc17f('0xf'),_0x180f45,_0xc17f('0x10'));logger[_0xc17f('0x11')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x180f45,_0xc17f('0x10'),JSON[_0xc17f('0x12')](_0x2cc1eb));if(_0x2cc1eb[_0xc17f('0x13')]){if(_0x2cc1eb['error']['code']===0x1f4){logger[_0xc17f('0x13')](_0xc17f('0xf'),_0x180f45,_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);return _0x553b6a(_0x2cc1eb[_0xc17f('0x13')]['message']);}logger[_0xc17f('0x13')](_0xc17f('0xf'),_0x180f45,_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);return _0x87820c(_0x2cc1eb[_0xc17f('0x13')][_0xc17f('0x14')]);}else{logger[_0xc17f('0xe')](_0xc17f('0xf'),_0x180f45,_0xc17f('0x10'));_0x87820c(_0x2cc1eb[_0xc17f('0x15')][_0xc17f('0x14')]);}})['catch'](function(_0x1bc348){logger[_0xc17f('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x180f45,_0x1bc348);_0x553b6a(_0x1bc348);});});}exports[_0xc17f('0x16')]=function(_0x57e379){var _0x4038a0=this;return new Promise(function(_0x5cbb59,_0x131f2b){return db[_0xc17f('0x17')][_0xc17f('0x18')]({'raw':_0x57e379['options']?_0x57e379[_0xc17f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57e379['options']?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1a')]||null:null,'attributes':_0x57e379['options']?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1b')]||null:null,'limit':_0x57e379[_0xc17f('0x19')]?_0x57e379[_0xc17f('0x19')][_0xc17f('0x1c')]||null:null,'include':_0x57e379[_0xc17f('0x19')]?_0x57e379[_0xc17f('0x19')]['include']?_[_0xc17f('0x1d')](_0x57e379[_0xc17f('0x19')][_0xc17f('0x1e')],function(_0x47a7a3){return{'model':db[_0x47a7a3[_0xc17f('0x1f')]],'as':_0x47a7a3['as'],'attributes':_0x47a7a3[_0xc17f('0x1b')],'include':_0x47a7a3['include']?_[_0xc17f('0x1d')](_0x47a7a3['include'],function(_0x116761){return{'model':db[_0x116761[_0xc17f('0x1f')]],'as':_0x116761['as'],'attributes':_0x116761[_0xc17f('0x1b')],'include':_0x116761['include']?_[_0xc17f('0x1d')](_0x116761[_0xc17f('0x1e')],function(_0x35513c){return{'model':db[_0x35513c[_0xc17f('0x1f')]],'as':_0x35513c['as'],'attributes':_0x35513c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a4e23){logger[_0xc17f('0xe')]('GetServicenowAccount',_0x57e379);logger[_0xc17f('0x11')](_0xc17f('0x16'),_0x57e379,JSON[_0xc17f('0x12')](_0x5a4e23));_0x5cbb59(_0x5a4e23);})['catch'](function(_0x38ac6c){logger[_0xc17f('0x13')](_0xc17f('0x16'),_0x38ac6c['message'],_0x57e379);_0x131f2b(_0x4038a0[_0xc17f('0x13')](0x1f4,_0x38ac6c[_0xc17f('0x14')]));});});};exports[_0xc17f('0x20')]=function(_0x22857e){var _0x47cf63=this;return new Promise(function(_0x24ff80,_0x52a144){return db[_0xc17f('0x17')][_0xc17f('0x21')]({'raw':_0x22857e[_0xc17f('0x19')]?_0x22857e['options'][_0xc17f('0x22')]===undefined?!![]:![]:!![],'where':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')]['where']||null:null,'attributes':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')]['attributes']||null:null,'include':_0x22857e[_0xc17f('0x19')]?_0x22857e[_0xc17f('0x19')][_0xc17f('0x1e')]?_['map'](_0x22857e['options'][_0xc17f('0x1e')],function(_0x438613){return{'model':db[_0x438613[_0xc17f('0x1f')]],'as':_0x438613['as'],'attributes':_0x438613['attributes'],'include':_0x438613[_0xc17f('0x1e')]?_[_0xc17f('0x1d')](_0x438613['include'],function(_0x581953){return{'model':db[_0x581953[_0xc17f('0x1f')]],'as':_0x581953['as'],'attributes':_0x581953['attributes'],'include':_0x581953[_0xc17f('0x1e')]?_[_0xc17f('0x1d')](_0x581953[_0xc17f('0x1e')],function(_0x1cb36f){return{'model':db[_0x1cb36f['model']],'as':_0x1cb36f['as'],'attributes':_0x1cb36f[_0xc17f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15b233){logger[_0xc17f('0xe')](_0xc17f('0x20'),_0x22857e);logger['debug'](_0xc17f('0x20'),_0x22857e,JSON[_0xc17f('0x12')](_0x15b233));_0x24ff80(_0x15b233);})[_0xc17f('0x23')](function(_0x5c21bb){logger[_0xc17f('0x13')](_0xc17f('0x20'),_0x5c21bb[_0xc17f('0x14')],_0x22857e);_0x52a144(_0x47cf63[_0xc17f('0x13')](0x1f4,_0x5c21bb[_0xc17f('0x14')]));});});}; \ No newline at end of file +var _0x0e74=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','request\x20sent','result','catch','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','GetServicenowAccount','find','ShowServicenowAccount','lodash','util','moment','bluebird'];(function(_0x376ffe,_0x2a7ec7){var _0x327b9f=function(_0x2ff0eb){while(--_0x2ff0eb){_0x376ffe['push'](_0x376ffe['shift']());}};_0x327b9f(++_0x2a7ec7);}(_0x0e74,0x8c));var _0x40e7=function(_0x5d773c,_0x5677f4){_0x5d773c=_0x5d773c-0x0;var _0x4e16db=_0x0e74[_0x5d773c];return _0x4e16db;};'use strict';var _=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var moment=require(_0x40e7('0x2'));var BPromise=require(_0x40e7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40e7('0x4'))['db'];var utils=require(_0x40e7('0x5'));var logger=require(_0x40e7('0x6'))(_0x40e7('0x7'));var config=require('../../config/environment');var jayson=require(_0x40e7('0x8'));var client=jayson[_0x40e7('0x9')][_0x40e7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x191294,_0x51a2e9,_0x4c9b08){return new BPromise(function(_0x5a7c13,_0x131855){return client[_0x40e7('0xb')](_0x191294,_0x4c9b08)[_0x40e7('0xc')](function(_0x29c9c8){logger[_0x40e7('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x51a2e9,'request\x20sent');logger[_0x40e7('0xe')](_0x40e7('0xf'),_0x51a2e9,'request\x20sent',JSON[_0x40e7('0x10')](_0x29c9c8));if(_0x29c9c8[_0x40e7('0x11')]){if(_0x29c9c8[_0x40e7('0x11')][_0x40e7('0x12')]===0x1f4){logger[_0x40e7('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x51a2e9,_0x29c9c8['error'][_0x40e7('0x13')]);return _0x131855(_0x29c9c8['error']['message']);}logger['error'](_0x40e7('0x14'),_0x51a2e9,_0x29c9c8[_0x40e7('0x11')][_0x40e7('0x13')]);return _0x5a7c13(_0x29c9c8[_0x40e7('0x11')][_0x40e7('0x13')]);}else{logger[_0x40e7('0xd')](_0x40e7('0x14'),_0x51a2e9,_0x40e7('0x15'));_0x5a7c13(_0x29c9c8[_0x40e7('0x16')][_0x40e7('0x13')]);}})[_0x40e7('0x17')](function(_0x246506){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x51a2e9,_0x246506);_0x131855(_0x246506);});});}exports['GetServicenowAccount']=function(_0x344871){var _0x4e72c1=this;return new Promise(function(_0x33b02a,_0x245718){return db[_0x40e7('0x18')]['findAll']({'raw':_0x344871[_0x40e7('0x19')]?_0x344871['options'][_0x40e7('0x1a')]===undefined?!![]:![]:!![],'where':_0x344871['options']?_0x344871[_0x40e7('0x19')][_0x40e7('0x1b')]||null:null,'attributes':_0x344871[_0x40e7('0x19')]?_0x344871[_0x40e7('0x19')][_0x40e7('0x1c')]||null:null,'limit':_0x344871[_0x40e7('0x19')]?_0x344871[_0x40e7('0x19')][_0x40e7('0x1d')]||null:null,'include':_0x344871[_0x40e7('0x19')]?_0x344871['options'][_0x40e7('0x1e')]?_[_0x40e7('0x1f')](_0x344871[_0x40e7('0x19')][_0x40e7('0x1e')],function(_0x10a902){return{'model':db[_0x10a902[_0x40e7('0x20')]],'as':_0x10a902['as'],'attributes':_0x10a902[_0x40e7('0x1c')],'include':_0x10a902['include']?_['map'](_0x10a902[_0x40e7('0x1e')],function(_0x4155e1){return{'model':db[_0x4155e1[_0x40e7('0x20')]],'as':_0x4155e1['as'],'attributes':_0x4155e1['attributes'],'include':_0x4155e1[_0x40e7('0x1e')]?_[_0x40e7('0x1f')](_0x4155e1[_0x40e7('0x1e')],function(_0x3c3d4a){return{'model':db[_0x3c3d4a[_0x40e7('0x20')]],'as':_0x3c3d4a['as'],'attributes':_0x3c3d4a[_0x40e7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x521335){logger['info'](_0x40e7('0x21'),_0x344871);logger[_0x40e7('0xe')](_0x40e7('0x21'),_0x344871,JSON['stringify'](_0x521335));_0x33b02a(_0x521335);})[_0x40e7('0x17')](function(_0x7ca06e){logger[_0x40e7('0x11')](_0x40e7('0x21'),_0x7ca06e[_0x40e7('0x13')],_0x344871);_0x245718(_0x4e72c1[_0x40e7('0x11')](0x1f4,_0x7ca06e[_0x40e7('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x15083e){var _0x120ae4=this;return new Promise(function(_0x428cab,_0x127363){return db['ServicenowAccount'][_0x40e7('0x22')]({'raw':_0x15083e[_0x40e7('0x19')]?_0x15083e[_0x40e7('0x19')][_0x40e7('0x1a')]===undefined?!![]:![]:!![],'where':_0x15083e['options']?_0x15083e[_0x40e7('0x19')][_0x40e7('0x1b')]||null:null,'attributes':_0x15083e[_0x40e7('0x19')]?_0x15083e[_0x40e7('0x19')][_0x40e7('0x1c')]||null:null,'include':_0x15083e['options']?_0x15083e[_0x40e7('0x19')][_0x40e7('0x1e')]?_['map'](_0x15083e['options']['include'],function(_0x5be996){return{'model':db[_0x5be996[_0x40e7('0x20')]],'as':_0x5be996['as'],'attributes':_0x5be996[_0x40e7('0x1c')],'include':_0x5be996[_0x40e7('0x1e')]?_[_0x40e7('0x1f')](_0x5be996[_0x40e7('0x1e')],function(_0x427612){return{'model':db[_0x427612[_0x40e7('0x20')]],'as':_0x427612['as'],'attributes':_0x427612[_0x40e7('0x1c')],'include':_0x427612[_0x40e7('0x1e')]?_[_0x40e7('0x1f')](_0x427612[_0x40e7('0x1e')],function(_0x258e39){return{'model':db[_0x258e39[_0x40e7('0x20')]],'as':_0x258e39['as'],'attributes':_0x258e39['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be881){logger[_0x40e7('0xd')](_0x40e7('0x23'),_0x15083e);logger[_0x40e7('0xe')](_0x40e7('0x23'),_0x15083e,JSON[_0x40e7('0x10')](_0x4be881));_0x428cab(_0x4be881);})['catch'](function(_0x5acc01){logger[_0x40e7('0x11')](_0x40e7('0x23'),_0x5acc01['message'],_0x15083e);_0x127363(_0x120ae4['error'](0x1f4,_0x5acc01[_0x40e7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a2e8cc8..cced99a 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 _0x7468=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0xb847da,_0x4660a1){var _0x1cf518=function(_0x5cc648){while(--_0x5cc648){_0xb847da['push'](_0xb847da['shift']());}};_0x1cf518(++_0x4660a1);}(_0x7468,0xca));var _0x8746=function(_0x100430,_0x5e8254){_0x100430=_0x100430-0x0;var _0x2018bb=_0x7468[_0x100430];return _0x2018bb;};'use strict';var multer=require(_0x8746('0x0'));var util=require(_0x8746('0x1'));var path=require(_0x8746('0x2'));var timeout=require(_0x8746('0x3'));var express=require(_0x8746('0x4'));var router=express['Router']();var fs_extra=require(_0x8746('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8746('0x6'));var config=require(_0x8746('0x7'));var controller=require(_0x8746('0x8'));router['get']('/',auth[_0x8746('0x9')](),controller['index']);router[_0x8746('0xa')]('/:id',auth[_0x8746('0x9')](),controller[_0x8746('0xb')]);router[_0x8746('0xa')](_0x8746('0xc'),auth[_0x8746('0x9')](),controller[_0x8746('0xd')]);router[_0x8746('0xa')]('/:id/subjects',auth[_0x8746('0x9')](),controller[_0x8746('0xe')]);router[_0x8746('0xa')](_0x8746('0xf'),auth[_0x8746('0x9')](),controller['getDescriptions']);router[_0x8746('0x10')]('/',auth[_0x8746('0x9')](),controller[_0x8746('0x11')]);router[_0x8746('0x12')](_0x8746('0x13'),auth['isAuthenticated'](),controller[_0x8746('0x14')]);router[_0x8746('0x15')](_0x8746('0x13'),auth[_0x8746('0x9')](),controller['destroy']);module[_0x8746('0x16')]=router; \ No newline at end of file +var _0xf26f=['/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x1c24da,_0x40046a){var _0x328828=function(_0x34f182){while(--_0x34f182){_0x1c24da['push'](_0x1c24da['shift']());}};_0x328828(++_0x40046a);}(_0xf26f,0xb8));var _0xff26=function(_0x18fe75,_0x492db3){_0x18fe75=_0x18fe75-0x0;var _0xb18d0f=_0xf26f[_0x18fe75];return _0xb18d0f;};'use strict';var multer=require(_0xff26('0x0'));var util=require(_0xff26('0x1'));var path=require(_0xff26('0x2'));var timeout=require(_0xff26('0x3'));var express=require(_0xff26('0x4'));var router=express[_0xff26('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xff26('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xff26('0x7'));var controller=require(_0xff26('0x8'));router[_0xff26('0x9')]('/',auth[_0xff26('0xa')](),controller[_0xff26('0xb')]);router[_0xff26('0x9')](_0xff26('0xc'),auth['isAuthenticated'](),controller[_0xff26('0xd')]);router[_0xff26('0x9')](_0xff26('0xe'),auth[_0xff26('0xa')](),controller[_0xff26('0xf')]);router[_0xff26('0x9')](_0xff26('0x10'),auth[_0xff26('0xa')](),controller[_0xff26('0x11')]);router[_0xff26('0x9')](_0xff26('0x12'),auth[_0xff26('0xa')](),controller['getDescriptions']);router[_0xff26('0x13')]('/',auth[_0xff26('0xa')](),controller[_0xff26('0x14')]);router[_0xff26('0x15')]('/:id',auth[_0xff26('0xa')](),controller[_0xff26('0x16')]);router[_0xff26('0x17')](_0xff26('0xc'),auth['isAuthenticated'](),controller[_0xff26('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index bd41c67..396afd0 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 _0x70ef=['exports','STRING','sequelize'];(function(_0x31ad45,_0x1ee3b3){var _0x34fd4f=function(_0x1821b7){while(--_0x1821b7){_0x31ad45['push'](_0x31ad45['shift']());}};_0x34fd4f(++_0x1ee3b3);}(_0x70ef,0x1d9));var _0xf70e=function(_0x40ae63,_0x478b08){_0x40ae63=_0x40ae63-0x0;var _0x29c9bf=_0x70ef[_0x40ae63];return _0x29c9bf;};'use strict';var Sequelize=require(_0xf70e('0x0'));module[_0xf70e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf70e('0x2')]}}; \ No newline at end of file +var _0x1ebd=['exports','STRING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1ebd,0x128));var _0xd1eb=function(_0x803554,_0x5e85c8){_0x803554=_0x803554-0x0;var _0x2e1051=_0x1ebd[_0x803554];return _0x2e1051;};'use strict';var Sequelize=require('sequelize');module[_0xd1eb('0x0')]={'name':{'type':Sequelize[_0xd1eb('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8538c85..3177d13 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 _0xeb83=['apply','reject','save','update','then','error','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','ServicenowField','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x53fd68,_0x508a41){var _0x9e77bb=function(_0x16f999){while(--_0x16f999){_0x53fd68['push'](_0x53fd68['shift']());}};_0x9e77bb(++_0x508a41);}(_0xeb83,0xd7));var _0x3eb8=function(_0x169845,_0x11a247){_0x169845=_0x169845-0x0;var _0xae394c=_0xeb83[_0x169845];return _0xae394c;};'use strict';var emlformat=require(_0x3eb8('0x0'));var rimraf=require(_0x3eb8('0x1'));var zipdir=require(_0x3eb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3eb8('0x3'));var moment=require(_0x3eb8('0x4'));var BPromise=require(_0x3eb8('0x5'));var Mustache=require('mustache');var util=require(_0x3eb8('0x6'));var path=require(_0x3eb8('0x7'));var sox=require(_0x3eb8('0x8'));var csv=require(_0x3eb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3eb8('0xa'));var squel=require(_0x3eb8('0xb'));var crypto=require(_0x3eb8('0xc'));var jsforce=require(_0x3eb8('0xd'));var deskjs=require(_0x3eb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3eb8('0xf'));var Papa=require(_0x3eb8('0x10'));var Redis=require(_0x3eb8('0x11'));var authService=require(_0x3eb8('0x12'));var qs=require(_0x3eb8('0x13'));var as=require(_0x3eb8('0x14'));var hardwareService=require(_0x3eb8('0x15'));var logger=require('../../config/logger')(_0x3eb8('0x16'));var utils=require(_0x3eb8('0x17'));var config=require(_0x3eb8('0x18'));var licenseUtil=require(_0x3eb8('0x19'));var db=require(_0x3eb8('0x1a'))['db'];function respondWithStatusCode(_0x2184ef,_0x169113){_0x169113=_0x169113||0xcc;return function(_0x431d4d){if(_0x431d4d){return _0x2184ef[_0x3eb8('0x1b')](_0x169113);}return _0x2184ef[_0x3eb8('0x1c')](_0x169113)[_0x3eb8('0x1d')]();};}function respondWithResult(_0x2b764f,_0x5cf8a4){_0x5cf8a4=_0x5cf8a4||0xc8;return function(_0x1fcf06){if(_0x1fcf06){return _0x2b764f['status'](_0x5cf8a4)[_0x3eb8('0x1e')](_0x1fcf06);}};}function respondWithFilteredResult(_0x71d575,_0x57fc1a){return function(_0x4ac46c){if(_0x4ac46c){var _0x3ff1af=typeof _0x57fc1a[_0x3eb8('0x1f')]==='undefined'&&typeof _0x57fc1a[_0x3eb8('0x20')]===_0x3eb8('0x21');var _0x3aa2e0=_0x4ac46c[_0x3eb8('0x22')];var _0x1cae88=_0x3ff1af?0x0:_0x57fc1a['offset'];var _0x3c1a27=_0x3ff1af?_0x4ac46c[_0x3eb8('0x22')]:_0x57fc1a[_0x3eb8('0x1f')]+_0x57fc1a[_0x3eb8('0x20')];var _0x824fb0;if(_0x3c1a27>=_0x3aa2e0){_0x3c1a27=_0x3aa2e0;_0x824fb0=0xc8;}else{_0x824fb0=0xce;}_0x71d575[_0x3eb8('0x1c')](_0x824fb0);return _0x71d575[_0x3eb8('0x23')](_0x3eb8('0x24'),_0x1cae88+'-'+_0x3c1a27+'/'+_0x3aa2e0)['json'](_0x4ac46c);}return null;};}function patchUpdates(_0x1d1d17){return function(_0x142412){try{jsonpatch[_0x3eb8('0x25')](_0x142412,_0x1d1d17,!![]);}catch(_0x9bd826){return BPromise[_0x3eb8('0x26')](_0x9bd826);}return _0x142412[_0x3eb8('0x27')]();};}function saveUpdates(_0x52375f,_0x1a5cc8){return function(_0x1e488f){if(_0x1e488f){return _0x1e488f[_0x3eb8('0x28')](_0x52375f)[_0x3eb8('0x29')](function(_0x29f9ac){return _0x29f9ac;});}return null;};}function removeEntity(_0x25f81c,_0x5dc125){return function(_0x49bc5a){if(_0x49bc5a){return _0x49bc5a['destroy']()[_0x3eb8('0x29')](function(){_0x25f81c[_0x3eb8('0x1c')](0xcc)[_0x3eb8('0x1d')]();});}};}function handleEntityNotFound(_0xbbff71,_0x20efa9){return function(_0x4610eb){if(!_0x4610eb){_0xbbff71[_0x3eb8('0x1b')](0x194);}return _0x4610eb;};}function handleError(_0x48c25b,_0x4804c9){_0x4804c9=_0x4804c9||0x1f4;return function(_0x2066e1){logger[_0x3eb8('0x2a')](_0x2066e1['stack']);if(_0x2066e1[_0x3eb8('0x2b')]){delete _0x2066e1[_0x3eb8('0x2b')];}_0x48c25b[_0x3eb8('0x1c')](_0x4804c9)[_0x3eb8('0x2c')](_0x2066e1);};}exports[_0x3eb8('0x2d')]=function(_0x1cdd87,_0x18bd57){var _0x7527b7={},_0x1de7ac={},_0x282eaf={'count':0x0,'rows':[]};var _0x4c8cd9=_[_0x3eb8('0x2e')](db[_0x3eb8('0x2f')][_0x3eb8('0x30')],function(_0x28b42c){return{'name':_0x28b42c[_0x3eb8('0x31')],'type':_0x28b42c[_0x3eb8('0x32')]['key']};});_0x1de7ac[_0x3eb8('0x33')]=_[_0x3eb8('0x2e')](_0x4c8cd9,_0x3eb8('0x2b'));_0x1de7ac[_0x3eb8('0x34')]=_[_0x3eb8('0x35')](_0x1cdd87['query']);_0x1de7ac[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x1de7ac['model'],_0x1de7ac[_0x3eb8('0x34')]);_0x7527b7['attributes']=_[_0x3eb8('0x37')](_0x1de7ac['model'],qs[_0x3eb8('0x38')](_0x1cdd87['query'][_0x3eb8('0x38')]));_0x7527b7[_0x3eb8('0x39')]=_0x7527b7['attributes']['length']?_0x7527b7[_0x3eb8('0x39')]:_0x1de7ac['model'];if(!_0x1cdd87[_0x3eb8('0x34')]['hasOwnProperty'](_0x3eb8('0x3a'))){_0x7527b7[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x1cdd87['query'][_0x3eb8('0x20')]);_0x7527b7[_0x3eb8('0x1f')]=qs[_0x3eb8('0x1f')](_0x1cdd87[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}_0x7527b7[_0x3eb8('0x3b')]=qs['sort'](_0x1cdd87['query'][_0x3eb8('0x3c')]);_0x7527b7[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x1cdd87[_0x3eb8('0x34')],_0x1de7ac[_0x3eb8('0x36')]),_0x4c8cd9);if(_0x1cdd87[_0x3eb8('0x34')]['filter']){_0x7527b7[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0x7527b7[_0x3eb8('0x3d')],{'$or':_[_0x3eb8('0x2e')](_0x4c8cd9,function(_0x366c0c){if(_0x366c0c[_0x3eb8('0x32')]!==_0x3eb8('0x40')){var _0x4c9627={};_0x4c9627[_0x366c0c[_0x3eb8('0x2b')]]={'$like':'%'+_0x1cdd87['query'][_0x3eb8('0x41')]+'%'};return _0x4c9627;}})});}_0x7527b7=_['merge']({},_0x7527b7,_0x1cdd87[_0x3eb8('0x42')]);var _0x256613={'where':_0x7527b7[_0x3eb8('0x3d')]};return db[_0x3eb8('0x2f')][_0x3eb8('0x22')](_0x256613)[_0x3eb8('0x29')](function(_0x3f4042){_0x282eaf[_0x3eb8('0x22')]=_0x3f4042;if(_0x1cdd87[_0x3eb8('0x34')]['includeAll']){_0x7527b7['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x3eb8('0x43')](_0x7527b7);})[_0x3eb8('0x29')](function(_0x1e6324){_0x282eaf[_0x3eb8('0x44')]=_0x1e6324;return _0x282eaf;})[_0x3eb8('0x29')](respondWithFilteredResult(_0x18bd57,_0x7527b7))[_0x3eb8('0x45')](handleError(_0x18bd57,null));};exports[_0x3eb8('0x46')]=function(_0x15d7a8,_0x5e716c){var _0x109399={'raw':![],'where':{'id':_0x15d7a8[_0x3eb8('0x47')]['id']}},_0x4229c6={};_0x4229c6['model']=_[_0x3eb8('0x35')](db['ServicenowConfiguration'][_0x3eb8('0x30')]);_0x4229c6[_0x3eb8('0x34')]=_[_0x3eb8('0x35')](_0x15d7a8[_0x3eb8('0x34')]);_0x4229c6[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x4229c6[_0x3eb8('0x33')],_0x4229c6[_0x3eb8('0x34')]);_0x109399[_0x3eb8('0x39')]=_[_0x3eb8('0x37')](_0x4229c6[_0x3eb8('0x33')],qs[_0x3eb8('0x38')](_0x15d7a8[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0x109399[_0x3eb8('0x39')]=_0x109399[_0x3eb8('0x39')][_0x3eb8('0x48')]?_0x109399[_0x3eb8('0x39')]:_0x4229c6[_0x3eb8('0x33')];if(_0x15d7a8[_0x3eb8('0x34')][_0x3eb8('0x49')]){_0x109399[_0x3eb8('0x4a')]=[{'all':!![]}];}_0x109399=_['merge']({},_0x109399,_0x15d7a8['options']);return db['ServicenowConfiguration'][_0x3eb8('0x4b')](_0x109399)[_0x3eb8('0x29')](handleEntityNotFound(_0x5e716c,null))[_0x3eb8('0x29')](respondWithResult(_0x5e716c,null))[_0x3eb8('0x45')](handleError(_0x5e716c,null));};exports[_0x3eb8('0x4c')]=function(_0x49c30a,_0x3cb8ce){return db[_0x3eb8('0x2f')]['create'](_0x49c30a[_0x3eb8('0x4d')],{})['then'](respondWithResult(_0x3cb8ce,0xc9))[_0x3eb8('0x45')](handleError(_0x3cb8ce,null));};exports['update']=function(_0x4915b1,_0x12aceb){if(_0x4915b1['body']['id']){delete _0x4915b1[_0x3eb8('0x4d')]['id'];}return db['ServicenowConfiguration'][_0x3eb8('0x4b')]({'where':{'id':_0x4915b1[_0x3eb8('0x47')]['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x12aceb,null))[_0x3eb8('0x29')](saveUpdates(_0x4915b1[_0x3eb8('0x4d')],null))[_0x3eb8('0x29')](respondWithResult(_0x12aceb,null))[_0x3eb8('0x45')](handleError(_0x12aceb,null));};exports['destroy']=function(_0xf53316,_0x1f4c08){return db[_0x3eb8('0x2f')][_0x3eb8('0x4b')]({'where':{'id':_0xf53316['params']['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x1f4c08,null))['then'](removeEntity(_0x1f4c08,null))[_0x3eb8('0x45')](handleError(_0x1f4c08,null));};exports[_0x3eb8('0x4e')]=function(_0x369297,_0x2a38e2,_0x399e62){var _0xa63cb2={};var _0x8ca66b={};var _0x2dac6a;var _0x454833;return db[_0x3eb8('0x2f')][_0x3eb8('0x4f')]({'where':{'id':_0x369297['params']['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x2a38e2,null))[_0x3eb8('0x29')](function(_0x4d5f7f){if(_0x4d5f7f){_0x2dac6a=_0x4d5f7f;_0x8ca66b['model']=_[_0x3eb8('0x35')](db['ServicenowField'][_0x3eb8('0x30')]);_0x8ca66b['query']=_[_0x3eb8('0x35')](_0x369297[_0x3eb8('0x34')]);_0x8ca66b['filters']=_[_0x3eb8('0x37')](_0x8ca66b[_0x3eb8('0x33')],_0x8ca66b[_0x3eb8('0x34')]);_0xa63cb2[_0x3eb8('0x39')]=_['intersection'](_0x8ca66b[_0x3eb8('0x33')],qs['fields'](_0x369297[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0xa63cb2[_0x3eb8('0x39')]=_0xa63cb2['attributes'][_0x3eb8('0x48')]?_0xa63cb2[_0x3eb8('0x39')]:_0x8ca66b[_0x3eb8('0x33')];_0xa63cb2['order']=qs[_0x3eb8('0x3c')](_0x369297[_0x3eb8('0x34')][_0x3eb8('0x3c')]);_0xa63cb2[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x369297['query'],_0x8ca66b[_0x3eb8('0x36')]));if(_0x369297[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0xa63cb2[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0xa63cb2[_0x3eb8('0x3d')],{'$or':_[_0x3eb8('0x2e')](_0xa63cb2[_0x3eb8('0x39')],function(_0x449746){var _0x2a6fe9={};_0x2a6fe9[_0x449746]={'$like':'%'+_0x369297[_0x3eb8('0x34')][_0x3eb8('0x41')]+'%'};return _0x2a6fe9;})});}_0xa63cb2=_[_0x3eb8('0x3f')]({},_0xa63cb2,_0x369297[_0x3eb8('0x42')]);return _0x2dac6a[_0x3eb8('0x4e')](_0xa63cb2);}})[_0x3eb8('0x29')](function(_0x515214){if(_0x515214){_0x454833=_0x515214[_0x3eb8('0x48')];if(!_0x369297['query'][_0x3eb8('0x50')]('nolimit')){_0xa63cb2[_0x3eb8('0x20')]=qs['limit'](_0x369297[_0x3eb8('0x34')]['limit']);_0xa63cb2[_0x3eb8('0x1f')]=qs['offset'](_0x369297['query'][_0x3eb8('0x1f')]);}return _0x2dac6a[_0x3eb8('0x4e')](_0xa63cb2);}})[_0x3eb8('0x29')](function(_0x4704d7){if(_0x4704d7){return _0x4704d7?{'count':_0x454833,'rows':_0x4704d7}:null;}})[_0x3eb8('0x29')](respondWithResult(_0x2a38e2,null))[_0x3eb8('0x45')](handleError(_0x2a38e2,null));};exports['getSubjects']=function(_0x2a49a4,_0x206946,_0x47fb92){var _0x4c422c={};var _0x46ecac={};var _0x3c482a;var _0x2524ea;return db[_0x3eb8('0x2f')][_0x3eb8('0x4f')]({'where':{'id':_0x2a49a4['params']['id']}})['then'](handleEntityNotFound(_0x206946,null))[_0x3eb8('0x29')](function(_0x347f26){if(_0x347f26){_0x3c482a=_0x347f26;_0x46ecac['model']=_[_0x3eb8('0x35')](db['ServicenowField']['rawAttributes']);_0x46ecac[_0x3eb8('0x34')]=_['keys'](_0x2a49a4['query']);_0x46ecac[_0x3eb8('0x36')]=_[_0x3eb8('0x37')](_0x46ecac['model'],_0x46ecac[_0x3eb8('0x34')]);_0x4c422c[_0x3eb8('0x39')]=_['intersection'](_0x46ecac[_0x3eb8('0x33')],qs['fields'](_0x2a49a4[_0x3eb8('0x34')]['fields']));_0x4c422c[_0x3eb8('0x39')]=_0x4c422c[_0x3eb8('0x39')][_0x3eb8('0x48')]?_0x4c422c[_0x3eb8('0x39')]:_0x46ecac['model'];_0x4c422c['order']=qs[_0x3eb8('0x3c')](_0x2a49a4[_0x3eb8('0x34')]['sort']);_0x4c422c['where']=qs['filters'](_['pick'](_0x2a49a4[_0x3eb8('0x34')],_0x46ecac[_0x3eb8('0x36')]));if(_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0x4c422c[_0x3eb8('0x3d')]=_['merge'](_0x4c422c['where'],{'$or':_[_0x3eb8('0x2e')](_0x4c422c[_0x3eb8('0x39')],function(_0xd329c5){var _0x4d122c={};_0x4d122c[_0xd329c5]={'$like':'%'+_0x2a49a4[_0x3eb8('0x34')]['filter']+'%'};return _0x4d122c;})});}_0x4c422c=_[_0x3eb8('0x3f')]({},_0x4c422c,_0x2a49a4[_0x3eb8('0x42')]);return _0x3c482a[_0x3eb8('0x51')](_0x4c422c);}})[_0x3eb8('0x29')](function(_0x4a1773){if(_0x4a1773){_0x2524ea=_0x4a1773[_0x3eb8('0x48')];if(!_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x50')](_0x3eb8('0x3a'))){_0x4c422c[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x2a49a4[_0x3eb8('0x34')]['limit']);_0x4c422c[_0x3eb8('0x1f')]=qs[_0x3eb8('0x1f')](_0x2a49a4[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}return _0x3c482a[_0x3eb8('0x51')](_0x4c422c);}})[_0x3eb8('0x29')](function(_0x4aa6d8){if(_0x4aa6d8){return _0x4aa6d8?{'count':_0x2524ea,'rows':_0x4aa6d8}:null;}})[_0x3eb8('0x29')](respondWithResult(_0x206946,null))[_0x3eb8('0x45')](handleError(_0x206946,null));};exports[_0x3eb8('0x52')]=function(_0x4ea768,_0x3e47b6,_0xc84acd){var _0x1c18d2={};var _0x565c48={};var _0x2d78ec;var _0x44f662;return db[_0x3eb8('0x2f')]['findOne']({'where':{'id':_0x4ea768[_0x3eb8('0x47')]['id']}})[_0x3eb8('0x29')](handleEntityNotFound(_0x3e47b6,null))[_0x3eb8('0x29')](function(_0x501cef){if(_0x501cef){_0x2d78ec=_0x501cef;_0x565c48[_0x3eb8('0x33')]=_[_0x3eb8('0x35')](db[_0x3eb8('0x53')][_0x3eb8('0x30')]);_0x565c48['query']=_[_0x3eb8('0x35')](_0x4ea768[_0x3eb8('0x34')]);_0x565c48['filters']=_[_0x3eb8('0x37')](_0x565c48[_0x3eb8('0x33')],_0x565c48[_0x3eb8('0x34')]);_0x1c18d2['attributes']=_[_0x3eb8('0x37')](_0x565c48[_0x3eb8('0x33')],qs['fields'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x38')]));_0x1c18d2[_0x3eb8('0x39')]=_0x1c18d2['attributes']['length']?_0x1c18d2[_0x3eb8('0x39')]:_0x565c48[_0x3eb8('0x33')];_0x1c18d2['order']=qs['sort'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x3c')]);_0x1c18d2[_0x3eb8('0x3d')]=qs[_0x3eb8('0x36')](_[_0x3eb8('0x3e')](_0x4ea768[_0x3eb8('0x34')],_0x565c48[_0x3eb8('0x36')]));if(_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x41')]){_0x1c18d2[_0x3eb8('0x3d')]=_[_0x3eb8('0x3f')](_0x1c18d2['where'],{'$or':_[_0x3eb8('0x2e')](_0x1c18d2['attributes'],function(_0xe44253){var _0x8f077b={};_0x8f077b[_0xe44253]={'$like':'%'+_0x4ea768[_0x3eb8('0x34')]['filter']+'%'};return _0x8f077b;})});}_0x1c18d2=_[_0x3eb8('0x3f')]({},_0x1c18d2,_0x4ea768[_0x3eb8('0x42')]);return _0x2d78ec[_0x3eb8('0x52')](_0x1c18d2);}})[_0x3eb8('0x29')](function(_0xcc91cc){if(_0xcc91cc){_0x44f662=_0xcc91cc[_0x3eb8('0x48')];if(!_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x50')](_0x3eb8('0x3a'))){_0x1c18d2[_0x3eb8('0x20')]=qs[_0x3eb8('0x20')](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x20')]);_0x1c18d2[_0x3eb8('0x1f')]=qs['offset'](_0x4ea768[_0x3eb8('0x34')][_0x3eb8('0x1f')]);}return _0x2d78ec[_0x3eb8('0x52')](_0x1c18d2);}})[_0x3eb8('0x29')](function(_0x121fca){if(_0x121fca){return _0x121fca?{'count':_0x44f662,'rows':_0x121fca}:null;}})['then'](respondWithResult(_0x3e47b6,null))[_0x3eb8('0x45')](handleError(_0x3e47b6,null));}; \ No newline at end of file +var _0xcfd6=['attributes','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','findOne','ServicenowField','getFields','hasOwnProperty','nolimit','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcfd6,0x10a));var _0x6cfd=function(_0x4bae58,_0x3d313a){_0x4bae58=_0x4bae58-0x0;var _0x5d50ff=_0xcfd6[_0x4bae58];return _0x5d50ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cfd('0x0'));var zipdir=require(_0x6cfd('0x1'));var jsonpatch=require(_0x6cfd('0x2'));var rp=require(_0x6cfd('0x3'));var moment=require(_0x6cfd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6cfd('0x5'));var util=require(_0x6cfd('0x6'));var path=require(_0x6cfd('0x7'));var sox=require(_0x6cfd('0x8'));var csv=require(_0x6cfd('0x9'));var ejs=require(_0x6cfd('0xa'));var fs=require('fs');var fs_extra=require(_0x6cfd('0xb'));var _=require(_0x6cfd('0xc'));var squel=require(_0x6cfd('0xd'));var crypto=require(_0x6cfd('0xe'));var jsforce=require(_0x6cfd('0xf'));var deskjs=require(_0x6cfd('0x10'));var toCsv=require(_0x6cfd('0x9'));var querystring=require(_0x6cfd('0x11'));var Papa=require('papaparse');var Redis=require(_0x6cfd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cfd('0x13'));var hardwareService=require(_0x6cfd('0x14'));var logger=require(_0x6cfd('0x15'))('api');var utils=require(_0x6cfd('0x16'));var config=require(_0x6cfd('0x17'));var licenseUtil=require(_0x6cfd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47f08d,_0x3bfaba){_0x3bfaba=_0x3bfaba||0xcc;return function(_0x340016){if(_0x340016){return _0x47f08d[_0x6cfd('0x19')](_0x3bfaba);}return _0x47f08d[_0x6cfd('0x1a')](_0x3bfaba)[_0x6cfd('0x1b')]();};}function respondWithResult(_0x31db4f,_0x3b2dc7){_0x3b2dc7=_0x3b2dc7||0xc8;return function(_0x56498f){if(_0x56498f){return _0x31db4f[_0x6cfd('0x1a')](_0x3b2dc7)[_0x6cfd('0x1c')](_0x56498f);}};}function respondWithFilteredResult(_0x1218f7,_0x33efd4){return function(_0x18041d){if(_0x18041d){var _0x299d51=typeof _0x33efd4[_0x6cfd('0x1d')]==='undefined'&&typeof _0x33efd4[_0x6cfd('0x1e')]===_0x6cfd('0x1f');var _0x4b0b15=_0x18041d[_0x6cfd('0x20')];var _0x40c843=_0x299d51?0x0:_0x33efd4[_0x6cfd('0x1d')];var _0x5b56fb=_0x299d51?_0x18041d[_0x6cfd('0x20')]:_0x33efd4[_0x6cfd('0x1d')]+_0x33efd4['limit'];var _0x22b0f1;if(_0x5b56fb>=_0x4b0b15){_0x5b56fb=_0x4b0b15;_0x22b0f1=0xc8;}else{_0x22b0f1=0xce;}_0x1218f7[_0x6cfd('0x1a')](_0x22b0f1);return _0x1218f7['set'](_0x6cfd('0x21'),_0x40c843+'-'+_0x5b56fb+'/'+_0x4b0b15)[_0x6cfd('0x1c')](_0x18041d);}return null;};}function patchUpdates(_0xfe0b56){return function(_0xbc750a){try{jsonpatch[_0x6cfd('0x22')](_0xbc750a,_0xfe0b56,!![]);}catch(_0x5a2f30){return BPromise[_0x6cfd('0x23')](_0x5a2f30);}return _0xbc750a[_0x6cfd('0x24')]();};}function saveUpdates(_0x2600c5,_0x50c28e){return function(_0x1e9ddf){if(_0x1e9ddf){return _0x1e9ddf['update'](_0x2600c5)[_0x6cfd('0x25')](function(_0x3e6329){return _0x3e6329;});}return null;};}function removeEntity(_0x53c77d,_0x585250){return function(_0x4dcaf5){if(_0x4dcaf5){return _0x4dcaf5[_0x6cfd('0x26')]()[_0x6cfd('0x25')](function(){_0x53c77d[_0x6cfd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a48f,_0x42b5dd){return function(_0x1a7906){if(!_0x1a7906){_0x39a48f['sendStatus'](0x194);}return _0x1a7906;};}function handleError(_0x23b916,_0xe3848){_0xe3848=_0xe3848||0x1f4;return function(_0x387fff){logger[_0x6cfd('0x27')](_0x387fff['stack']);if(_0x387fff[_0x6cfd('0x28')]){delete _0x387fff[_0x6cfd('0x28')];}_0x23b916[_0x6cfd('0x1a')](_0xe3848)[_0x6cfd('0x29')](_0x387fff);};}exports['index']=function(_0x532d3b,_0x256544){var _0x2b689e={},_0xffd309={},_0x5cce7a={'count':0x0,'rows':[]};var _0x477b5a=_[_0x6cfd('0x2a')](db[_0x6cfd('0x2b')][_0x6cfd('0x2c')],function(_0x2a22b3){return{'name':_0x2a22b3[_0x6cfd('0x2d')],'type':_0x2a22b3[_0x6cfd('0x2e')][_0x6cfd('0x2f')]};});_0xffd309[_0x6cfd('0x30')]=_['map'](_0x477b5a,_0x6cfd('0x28'));_0xffd309[_0x6cfd('0x31')]=_[_0x6cfd('0x32')](_0x532d3b[_0x6cfd('0x31')]);_0xffd309['filters']=_[_0x6cfd('0x33')](_0xffd309[_0x6cfd('0x30')],_0xffd309[_0x6cfd('0x31')]);_0x2b689e['attributes']=_[_0x6cfd('0x33')](_0xffd309['model'],qs[_0x6cfd('0x34')](_0x532d3b[_0x6cfd('0x31')][_0x6cfd('0x34')]));_0x2b689e['attributes']=_0x2b689e['attributes'][_0x6cfd('0x35')]?_0x2b689e[_0x6cfd('0x36')]:_0xffd309[_0x6cfd('0x30')];if(!_0x532d3b['query']['hasOwnProperty']('nolimit')){_0x2b689e['limit']=qs[_0x6cfd('0x1e')](_0x532d3b[_0x6cfd('0x31')][_0x6cfd('0x1e')]);_0x2b689e[_0x6cfd('0x1d')]=qs[_0x6cfd('0x1d')](_0x532d3b['query'][_0x6cfd('0x1d')]);}_0x2b689e[_0x6cfd('0x37')]=qs[_0x6cfd('0x38')](_0x532d3b[_0x6cfd('0x31')]['sort']);_0x2b689e['where']=qs[_0x6cfd('0x39')](_['pick'](_0x532d3b[_0x6cfd('0x31')],_0xffd309['filters']),_0x477b5a);if(_0x532d3b[_0x6cfd('0x31')][_0x6cfd('0x3a')]){_0x2b689e[_0x6cfd('0x3b')]=_[_0x6cfd('0x3c')](_0x2b689e['where'],{'$or':_[_0x6cfd('0x2a')](_0x477b5a,function(_0x222fe6){if(_0x222fe6[_0x6cfd('0x2e')]!==_0x6cfd('0x3d')){var _0x20525a={};_0x20525a[_0x222fe6[_0x6cfd('0x28')]]={'$like':'%'+_0x532d3b['query'][_0x6cfd('0x3a')]+'%'};return _0x20525a;}})});}_0x2b689e=_['merge']({},_0x2b689e,_0x532d3b[_0x6cfd('0x3e')]);var _0x1d1038={'where':_0x2b689e['where']};return db['ServicenowConfiguration']['count'](_0x1d1038)[_0x6cfd('0x25')](function(_0x54b679){_0x5cce7a['count']=_0x54b679;if(_0x532d3b['query'][_0x6cfd('0x3f')]){_0x2b689e[_0x6cfd('0x40')]=[{'all':!![]}];}return db[_0x6cfd('0x2b')][_0x6cfd('0x41')](_0x2b689e);})[_0x6cfd('0x25')](function(_0x1a5880){_0x5cce7a['rows']=_0x1a5880;return _0x5cce7a;})[_0x6cfd('0x25')](respondWithFilteredResult(_0x256544,_0x2b689e))[_0x6cfd('0x42')](handleError(_0x256544,null));};exports[_0x6cfd('0x43')]=function(_0x26d03c,_0x3be3c4){var _0x538024={'raw':![],'where':{'id':_0x26d03c[_0x6cfd('0x44')]['id']}},_0x12d2b6={};_0x12d2b6[_0x6cfd('0x30')]=_[_0x6cfd('0x32')](db[_0x6cfd('0x2b')][_0x6cfd('0x2c')]);_0x12d2b6[_0x6cfd('0x31')]=_[_0x6cfd('0x32')](_0x26d03c[_0x6cfd('0x31')]);_0x12d2b6[_0x6cfd('0x39')]=_[_0x6cfd('0x33')](_0x12d2b6[_0x6cfd('0x30')],_0x12d2b6[_0x6cfd('0x31')]);_0x538024['attributes']=_[_0x6cfd('0x33')](_0x12d2b6[_0x6cfd('0x30')],qs[_0x6cfd('0x34')](_0x26d03c[_0x6cfd('0x31')][_0x6cfd('0x34')]));_0x538024[_0x6cfd('0x36')]=_0x538024[_0x6cfd('0x36')]['length']?_0x538024[_0x6cfd('0x36')]:_0x12d2b6[_0x6cfd('0x30')];if(_0x26d03c[_0x6cfd('0x31')][_0x6cfd('0x3f')]){_0x538024[_0x6cfd('0x40')]=[{'all':!![]}];}_0x538024=_[_0x6cfd('0x3c')]({},_0x538024,_0x26d03c['options']);return db['ServicenowConfiguration'][_0x6cfd('0x45')](_0x538024)[_0x6cfd('0x25')](handleEntityNotFound(_0x3be3c4,null))['then'](respondWithResult(_0x3be3c4,null))[_0x6cfd('0x42')](handleError(_0x3be3c4,null));};exports['create']=function(_0x230133,_0x4ae0c2){return db[_0x6cfd('0x2b')][_0x6cfd('0x46')](_0x230133[_0x6cfd('0x47')],{})['then'](respondWithResult(_0x4ae0c2,0xc9))[_0x6cfd('0x42')](handleError(_0x4ae0c2,null));};exports['update']=function(_0x2d6545,_0x30361e){if(_0x2d6545[_0x6cfd('0x47')]['id']){delete _0x2d6545[_0x6cfd('0x47')]['id'];}return db[_0x6cfd('0x2b')][_0x6cfd('0x45')]({'where':{'id':_0x2d6545['params']['id']}})['then'](handleEntityNotFound(_0x30361e,null))['then'](saveUpdates(_0x2d6545[_0x6cfd('0x47')],null))['then'](respondWithResult(_0x30361e,null))[_0x6cfd('0x42')](handleError(_0x30361e,null));};exports[_0x6cfd('0x26')]=function(_0xe74a0e,_0x1e52ff){return db[_0x6cfd('0x2b')][_0x6cfd('0x45')]({'where':{'id':_0xe74a0e[_0x6cfd('0x44')]['id']}})[_0x6cfd('0x25')](handleEntityNotFound(_0x1e52ff,null))['then'](removeEntity(_0x1e52ff,null))[_0x6cfd('0x42')](handleError(_0x1e52ff,null));};exports['getFields']=function(_0x29f4a1,_0x22933f,_0xc7346d){var _0x4a3a12={};var _0xd6bf55={};var _0x4d5d5c;var _0x42e873;return db[_0x6cfd('0x2b')][_0x6cfd('0x48')]({'where':{'id':_0x29f4a1['params']['id']}})[_0x6cfd('0x25')](handleEntityNotFound(_0x22933f,null))[_0x6cfd('0x25')](function(_0x356b38){if(_0x356b38){_0x4d5d5c=_0x356b38;_0xd6bf55[_0x6cfd('0x30')]=_[_0x6cfd('0x32')](db[_0x6cfd('0x49')][_0x6cfd('0x2c')]);_0xd6bf55[_0x6cfd('0x31')]=_[_0x6cfd('0x32')](_0x29f4a1['query']);_0xd6bf55[_0x6cfd('0x39')]=_[_0x6cfd('0x33')](_0xd6bf55[_0x6cfd('0x30')],_0xd6bf55[_0x6cfd('0x31')]);_0x4a3a12[_0x6cfd('0x36')]=_['intersection'](_0xd6bf55[_0x6cfd('0x30')],qs[_0x6cfd('0x34')](_0x29f4a1['query']['fields']));_0x4a3a12[_0x6cfd('0x36')]=_0x4a3a12['attributes'][_0x6cfd('0x35')]?_0x4a3a12[_0x6cfd('0x36')]:_0xd6bf55[_0x6cfd('0x30')];_0x4a3a12[_0x6cfd('0x37')]=qs['sort'](_0x29f4a1['query'][_0x6cfd('0x38')]);_0x4a3a12['where']=qs[_0x6cfd('0x39')](_['pick'](_0x29f4a1[_0x6cfd('0x31')],_0xd6bf55[_0x6cfd('0x39')]));if(_0x29f4a1[_0x6cfd('0x31')][_0x6cfd('0x3a')]){_0x4a3a12[_0x6cfd('0x3b')]=_[_0x6cfd('0x3c')](_0x4a3a12[_0x6cfd('0x3b')],{'$or':_['map'](_0x4a3a12[_0x6cfd('0x36')],function(_0xb5c138){var _0x2c522c={};_0x2c522c[_0xb5c138]={'$like':'%'+_0x29f4a1[_0x6cfd('0x31')]['filter']+'%'};return _0x2c522c;})});}_0x4a3a12=_['merge']({},_0x4a3a12,_0x29f4a1['options']);return _0x4d5d5c[_0x6cfd('0x4a')](_0x4a3a12);}})['then'](function(_0x5a6019){if(_0x5a6019){_0x42e873=_0x5a6019['length'];if(!_0x29f4a1[_0x6cfd('0x31')][_0x6cfd('0x4b')](_0x6cfd('0x4c'))){_0x4a3a12[_0x6cfd('0x1e')]=qs[_0x6cfd('0x1e')](_0x29f4a1[_0x6cfd('0x31')][_0x6cfd('0x1e')]);_0x4a3a12[_0x6cfd('0x1d')]=qs[_0x6cfd('0x1d')](_0x29f4a1[_0x6cfd('0x31')][_0x6cfd('0x1d')]);}return _0x4d5d5c[_0x6cfd('0x4a')](_0x4a3a12);}})['then'](function(_0x2912b1){if(_0x2912b1){return _0x2912b1?{'count':_0x42e873,'rows':_0x2912b1}:null;}})[_0x6cfd('0x25')](respondWithResult(_0x22933f,null))[_0x6cfd('0x42')](handleError(_0x22933f,null));};exports[_0x6cfd('0x4d')]=function(_0x1c96a9,_0x133d26,_0x45ff8b){var _0x5a6395={};var _0x278ca8={};var _0x14a673;var _0x27ae42;return db[_0x6cfd('0x2b')][_0x6cfd('0x48')]({'where':{'id':_0x1c96a9[_0x6cfd('0x44')]['id']}})[_0x6cfd('0x25')](handleEntityNotFound(_0x133d26,null))['then'](function(_0x510dfa){if(_0x510dfa){_0x14a673=_0x510dfa;_0x278ca8[_0x6cfd('0x30')]=_['keys'](db[_0x6cfd('0x49')][_0x6cfd('0x2c')]);_0x278ca8[_0x6cfd('0x31')]=_[_0x6cfd('0x32')](_0x1c96a9['query']);_0x278ca8[_0x6cfd('0x39')]=_['intersection'](_0x278ca8['model'],_0x278ca8[_0x6cfd('0x31')]);_0x5a6395['attributes']=_[_0x6cfd('0x33')](_0x278ca8[_0x6cfd('0x30')],qs[_0x6cfd('0x34')](_0x1c96a9[_0x6cfd('0x31')][_0x6cfd('0x34')]));_0x5a6395[_0x6cfd('0x36')]=_0x5a6395['attributes'][_0x6cfd('0x35')]?_0x5a6395[_0x6cfd('0x36')]:_0x278ca8[_0x6cfd('0x30')];_0x5a6395[_0x6cfd('0x37')]=qs[_0x6cfd('0x38')](_0x1c96a9['query']['sort']);_0x5a6395[_0x6cfd('0x3b')]=qs[_0x6cfd('0x39')](_[_0x6cfd('0x4e')](_0x1c96a9[_0x6cfd('0x31')],_0x278ca8['filters']));if(_0x1c96a9['query'][_0x6cfd('0x3a')]){_0x5a6395[_0x6cfd('0x3b')]=_[_0x6cfd('0x3c')](_0x5a6395['where'],{'$or':_['map'](_0x5a6395[_0x6cfd('0x36')],function(_0x31ac5b){var _0x264377={};_0x264377[_0x31ac5b]={'$like':'%'+_0x1c96a9['query'][_0x6cfd('0x3a')]+'%'};return _0x264377;})});}_0x5a6395=_[_0x6cfd('0x3c')]({},_0x5a6395,_0x1c96a9[_0x6cfd('0x3e')]);return _0x14a673['getSubjects'](_0x5a6395);}})['then'](function(_0x25a466){if(_0x25a466){_0x27ae42=_0x25a466[_0x6cfd('0x35')];if(!_0x1c96a9[_0x6cfd('0x31')]['hasOwnProperty'](_0x6cfd('0x4c'))){_0x5a6395[_0x6cfd('0x1e')]=qs[_0x6cfd('0x1e')](_0x1c96a9[_0x6cfd('0x31')][_0x6cfd('0x1e')]);_0x5a6395['offset']=qs['offset'](_0x1c96a9[_0x6cfd('0x31')][_0x6cfd('0x1d')]);}return _0x14a673[_0x6cfd('0x4d')](_0x5a6395);}})[_0x6cfd('0x25')](function(_0x3db243){if(_0x3db243){return _0x3db243?{'count':_0x27ae42,'rows':_0x3db243}:null;}})[_0x6cfd('0x25')](respondWithResult(_0x133d26,null))[_0x6cfd('0x42')](handleError(_0x133d26,null));};exports[_0x6cfd('0x4f')]=function(_0x1d8af7,_0x5ea047,_0x1b9301){var _0x576e3e={};var _0x5592b1={};var _0x3a33f0;var _0x38c776;return db['ServicenowConfiguration'][_0x6cfd('0x48')]({'where':{'id':_0x1d8af7[_0x6cfd('0x44')]['id']}})[_0x6cfd('0x25')](handleEntityNotFound(_0x5ea047,null))[_0x6cfd('0x25')](function(_0x4aaad3){if(_0x4aaad3){_0x3a33f0=_0x4aaad3;_0x5592b1[_0x6cfd('0x30')]=_['keys'](db[_0x6cfd('0x49')][_0x6cfd('0x2c')]);_0x5592b1[_0x6cfd('0x31')]=_[_0x6cfd('0x32')](_0x1d8af7['query']);_0x5592b1[_0x6cfd('0x39')]=_[_0x6cfd('0x33')](_0x5592b1[_0x6cfd('0x30')],_0x5592b1[_0x6cfd('0x31')]);_0x576e3e[_0x6cfd('0x36')]=_['intersection'](_0x5592b1['model'],qs[_0x6cfd('0x34')](_0x1d8af7[_0x6cfd('0x31')]['fields']));_0x576e3e[_0x6cfd('0x36')]=_0x576e3e['attributes'][_0x6cfd('0x35')]?_0x576e3e['attributes']:_0x5592b1['model'];_0x576e3e[_0x6cfd('0x37')]=qs[_0x6cfd('0x38')](_0x1d8af7[_0x6cfd('0x31')][_0x6cfd('0x38')]);_0x576e3e[_0x6cfd('0x3b')]=qs[_0x6cfd('0x39')](_['pick'](_0x1d8af7[_0x6cfd('0x31')],_0x5592b1[_0x6cfd('0x39')]));if(_0x1d8af7['query'][_0x6cfd('0x3a')]){_0x576e3e[_0x6cfd('0x3b')]=_[_0x6cfd('0x3c')](_0x576e3e[_0x6cfd('0x3b')],{'$or':_[_0x6cfd('0x2a')](_0x576e3e['attributes'],function(_0x5a9c6b){var _0x5188d2={};_0x5188d2[_0x5a9c6b]={'$like':'%'+_0x1d8af7[_0x6cfd('0x31')]['filter']+'%'};return _0x5188d2;})});}_0x576e3e=_['merge']({},_0x576e3e,_0x1d8af7[_0x6cfd('0x3e')]);return _0x3a33f0[_0x6cfd('0x4f')](_0x576e3e);}})[_0x6cfd('0x25')](function(_0x586470){if(_0x586470){_0x38c776=_0x586470[_0x6cfd('0x35')];if(!_0x1d8af7[_0x6cfd('0x31')][_0x6cfd('0x4b')](_0x6cfd('0x4c'))){_0x576e3e['limit']=qs['limit'](_0x1d8af7[_0x6cfd('0x31')][_0x6cfd('0x1e')]);_0x576e3e['offset']=qs['offset'](_0x1d8af7[_0x6cfd('0x31')]['offset']);}return _0x3a33f0[_0x6cfd('0x4f')](_0x576e3e);}})[_0x6cfd('0x25')](function(_0x18d99a){if(_0x18d99a){return _0x18d99a?{'count':_0x38c776,'rows':_0x18d99a}:null;}})['then'](respondWithResult(_0x5ea047,null))['catch'](handleError(_0x5ea047,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8050625..4f0f0c2 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 _0x1bc6=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b0b5a,_0x409931){var _0x191f91=function(_0x480404){while(--_0x480404){_0x5b0b5a['push'](_0x5b0b5a['shift']());}};_0x191f91(++_0x409931);}(_0x1bc6,0x94));var _0x61bc=function(_0x304909,_0x1202b1){_0x304909=_0x304909-0x0;var _0x2b8db0=_0x1bc6[_0x304909];return _0x2b8db0;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var logger=require(_0x61bc('0x2'))(_0x61bc('0x3'));var moment=require(_0x61bc('0x4'));var BPromise=require(_0x61bc('0x5'));var rp=require(_0x61bc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61bc('0x7'));var config=require(_0x61bc('0x8'));var attributes=require(_0x61bc('0x9'));module[_0x61bc('0xa')]=function(_0x362ebb,_0x1af9bc){return _0x362ebb[_0x61bc('0xb')](_0x61bc('0xc'),attributes,{'tableName':_0x61bc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5fb=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x472657,_0x441556){var _0x2dda30=function(_0x25230d){while(--_0x25230d){_0x472657['push'](_0x472657['shift']());}};_0x2dda30(++_0x441556);}(_0xb5fb,0x172));var _0xbb5f=function(_0x114281,_0x23c3f2){_0x114281=_0x114281-0x0;var _0x866964=_0xb5fb[_0x114281];return _0x866964;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var logger=require(_0xbb5f('0x2'))(_0xbb5f('0x3'));var moment=require(_0xbb5f('0x4'));var BPromise=require(_0xbb5f('0x5'));var rp=require(_0xbb5f('0x6'));var fs=require('fs');var path=require(_0xbb5f('0x7'));var rimraf=require(_0xbb5f('0x8'));var config=require(_0xbb5f('0x9'));var attributes=require(_0xbb5f('0xa'));module[_0xbb5f('0xb')]=function(_0x4b35d1,_0x1c6c4c){return _0x4b35d1['define']('ServicenowConfiguration',attributes,{'tableName':_0xbb5f('0xc'),'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 f6bbb3b..249df7d 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 _0x9719=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x237671,_0x3a1449){var _0x8376f6=function(_0x239c46){while(--_0x239c46){_0x237671['push'](_0x237671['shift']());}};_0x8376f6(++_0x3a1449);}(_0x9719,0x79));var _0x9971=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9719[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x9971('0x0'));var util=require(_0x9971('0x1'));var moment=require(_0x9971('0x2'));var BPromise=require(_0x9971('0x3'));var rs=require(_0x9971('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9971('0x5'))['db'];var utils=require(_0x9971('0x6'));var logger=require(_0x9971('0x7'))('rpc');var config=require(_0x9971('0x8'));var jayson=require(_0x9971('0x9'));var client=jayson[_0x9971('0xa')][_0x9971('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15ee24,_0x11b397,_0x54ac3c){return new BPromise(function(_0x1cdb99,_0x49e6ec){return client[_0x9971('0xc')](_0x15ee24,_0x54ac3c)[_0x9971('0xd')](function(_0x508076){logger[_0x9971('0xe')](_0x9971('0xf'),_0x11b397,'request\x20sent');logger[_0x9971('0x10')](_0x9971('0x11'),_0x11b397,_0x9971('0x12'),JSON[_0x9971('0x13')](_0x508076));if(_0x508076[_0x9971('0x14')]){if(_0x508076[_0x9971('0x14')][_0x9971('0x15')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x11b397,_0x508076[_0x9971('0x14')][_0x9971('0x16')]);return _0x49e6ec(_0x508076[_0x9971('0x14')][_0x9971('0x16')]);}logger[_0x9971('0x14')](_0x9971('0xf'),_0x11b397,_0x508076[_0x9971('0x14')][_0x9971('0x16')]);return _0x1cdb99(_0x508076[_0x9971('0x14')]['message']);}else{logger[_0x9971('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x11b397,'request\x20sent');_0x1cdb99(_0x508076[_0x9971('0x17')][_0x9971('0x16')]);}})[_0x9971('0x18')](function(_0x22c78f){logger[_0x9971('0x14')](_0x9971('0xf'),_0x11b397,_0x22c78f);_0x49e6ec(_0x22c78f);});});} \ No newline at end of file +var _0xc767=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xc767,0x108));var _0x7c76=function(_0x511577,_0x2ec0cf){_0x511577=_0x511577-0x0;var _0x1b9201=_0xc767[_0x511577];return _0x1b9201;};'use strict';var _=require(_0x7c76('0x0'));var util=require(_0x7c76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c76('0x2'));var fs=require('fs');var Redis=require(_0x7c76('0x3'));var db=require(_0x7c76('0x4'))['db'];var utils=require(_0x7c76('0x5'));var logger=require('../../config/logger')(_0x7c76('0x6'));var config=require(_0x7c76('0x7'));var jayson=require(_0x7c76('0x8'));var client=jayson[_0x7c76('0x9')][_0x7c76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x987e4,_0x37424b,_0x4450d8){return new BPromise(function(_0x12d013,_0x4e6ca0){return client[_0x7c76('0xb')](_0x987e4,_0x4450d8)[_0x7c76('0xc')](function(_0x532244){logger[_0x7c76('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x37424b,_0x7c76('0xe'));logger['debug'](_0x7c76('0xf'),_0x37424b,_0x7c76('0xe'),JSON['stringify'](_0x532244));if(_0x532244[_0x7c76('0x10')]){if(_0x532244['error'][_0x7c76('0x11')]===0x1f4){logger['error'](_0x7c76('0x12'),_0x37424b,_0x532244['error'][_0x7c76('0x13')]);return _0x4e6ca0(_0x532244[_0x7c76('0x10')][_0x7c76('0x13')]);}logger[_0x7c76('0x10')](_0x7c76('0x12'),_0x37424b,_0x532244[_0x7c76('0x10')][_0x7c76('0x13')]);return _0x12d013(_0x532244[_0x7c76('0x10')][_0x7c76('0x13')]);}else{logger[_0x7c76('0xd')](_0x7c76('0x12'),_0x37424b,_0x7c76('0xe'));_0x12d013(_0x532244[_0x7c76('0x14')][_0x7c76('0x13')]);}})[_0x7c76('0x15')](function(_0x54ec38){logger[_0x7c76('0x10')](_0x7c76('0x12'),_0x37424b,_0x54ec38);_0x4e6ca0(_0x54ec38);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9f3a741..c677b09 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 _0xc81d=['index','show','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x3822f8,_0x12e40b){var _0x4b50ff=function(_0x2da695){while(--_0x2da695){_0x3822f8['push'](_0x3822f8['shift']());}};_0x4b50ff(++_0x12e40b);}(_0xc81d,0x1ba));var _0xdc81=function(_0x47da1c,_0x1cb9bb){_0x47da1c=_0x47da1c-0x0;var _0xe2c24d=_0xc81d[_0x47da1c];return _0xe2c24d;};'use strict';var multer=require(_0xdc81('0x0'));var util=require('util');var path=require(_0xdc81('0x1'));var timeout=require(_0xdc81('0x2'));var express=require('express');var router=express[_0xdc81('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdc81('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdc81('0x5'));var controller=require(_0xdc81('0x6'));router[_0xdc81('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc81('0x8')]);router[_0xdc81('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdc81('0x9')]);router['post']('/',auth[_0xdc81('0xa')](),controller[_0xdc81('0xb')]);router[_0xdc81('0xc')](_0xdc81('0xd'),auth[_0xdc81('0xa')](),controller[_0xdc81('0xe')]);router[_0xdc81('0xf')](_0xdc81('0xd'),auth['isAuthenticated'](),controller[_0xdc81('0x10')]);module[_0xdc81('0x11')]=router; \ No newline at end of file +var _0x7d82=['../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x3613d0,_0x15fce9){var _0x30f8ce=function(_0x3f141b){while(--_0x3f141b){_0x3613d0['push'](_0x3613d0['shift']());}};_0x30f8ce(++_0x15fce9);}(_0x7d82,0x125));var _0x27d8=function(_0xecd9b,_0x372e83){_0xecd9b=_0xecd9b-0x0;var _0x7f91fa=_0x7d82[_0xecd9b];return _0x7f91fa;};'use strict';var multer=require(_0x27d8('0x0'));var util=require(_0x27d8('0x1'));var path=require(_0x27d8('0x2'));var timeout=require(_0x27d8('0x3'));var express=require(_0x27d8('0x4'));var router=express['Router']();var fs_extra=require(_0x27d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x27d8('0x6'));var config=require(_0x27d8('0x7'));var controller=require(_0x27d8('0x8'));router[_0x27d8('0x9')]('/',auth['isAuthenticated'](),controller[_0x27d8('0xa')]);router['get'](_0x27d8('0xb'),auth[_0x27d8('0xc')](),controller[_0x27d8('0xd')]);router[_0x27d8('0xe')]('/',auth[_0x27d8('0xc')](),controller[_0x27d8('0xf')]);router[_0x27d8('0x10')](_0x27d8('0xb'),auth[_0x27d8('0xc')](),controller[_0x27d8('0x11')]);router['delete']('/:id',auth[_0x27d8('0xc')](),controller[_0x27d8('0x12')]);module[_0x27d8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 988b6dd..df72e82 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 _0x5bea=['ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x22c64b,_0x1a5050){var _0x1f0573=function(_0x551aac){while(--_0x551aac){_0x22c64b['push'](_0x22c64b['shift']());}};_0x1f0573(++_0x1a5050);}(_0x5bea,0xba));var _0xa5be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bea[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa5be('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa5be('0x1'),_0xa5be('0x2'),_0xa5be('0x3'),_0xa5be('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa5be('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa5be('0x6')](_0xa5be('0x1'),_0xa5be('0x2'),_0xa5be('0x3'))},'keyContent':{'type':Sequelize[_0xa5be('0x5')]},'idField':{'type':Sequelize[_0xa5be('0x5')]},'nameField':{'type':Sequelize[_0xa5be('0x5')]},'customField':{'type':Sequelize[_0xa5be('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84f9=['string','variable','keyValue','picklist','STRING','ENUM','sequelize','exports'];(function(_0x4ca01f,_0x57c5f9){var _0x5b83f1=function(_0x2ee3bb){while(--_0x2ee3bb){_0x4ca01f['push'](_0x4ca01f['shift']());}};_0x5b83f1(++_0x57c5f9);}(_0x84f9,0x19e));var _0x984f=function(_0x1bcb17,_0x492d13){_0x1bcb17=_0x1bcb17-0x0;var _0x21432d=_0x84f9[_0x1bcb17];return _0x21432d;};'use strict';var Sequelize=require(_0x984f('0x0'));module[_0x984f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x984f('0x2'),_0x984f('0x3'),'customVariable',_0x984f('0x4'),_0x984f('0x5')),'defaultValue':_0x984f('0x2')},'content':{'type':Sequelize[_0x984f('0x6')]},'key':{'type':Sequelize[_0x984f('0x6')]},'keyType':{'type':Sequelize[_0x984f('0x7')](_0x984f('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x984f('0x6')]},'idField':{'type':Sequelize[_0x984f('0x6')]},'nameField':{'type':Sequelize[_0x984f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x984f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 061c872..e364fdc 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 _0x1c20=['lodash','crypto','desk.js','to-csv','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','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x1c20,0x180));var _0x01c2=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x1c20[_0x4fbb15];return _0x436338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01c2('0x0'));var zipdir=require(_0x01c2('0x1'));var jsonpatch=require(_0x01c2('0x2'));var rp=require(_0x01c2('0x3'));var moment=require(_0x01c2('0x4'));var BPromise=require(_0x01c2('0x5'));var Mustache=require(_0x01c2('0x6'));var util=require(_0x01c2('0x7'));var path=require(_0x01c2('0x8'));var sox=require(_0x01c2('0x9'));var csv=require('to-csv');var ejs=require(_0x01c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01c2('0xb'));var squel=require('squel');var crypto=require(_0x01c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x01c2('0xd'));var toCsv=require(_0x01c2('0xe'));var querystring=require('querystring');var Papa=require(_0x01c2('0xf'));var Redis=require(_0x01c2('0x10'));var authService=require(_0x01c2('0x11'));var qs=require(_0x01c2('0x12'));var as=require(_0x01c2('0x13'));var hardwareService=require(_0x01c2('0x14'));var logger=require('../../config/logger')(_0x01c2('0x15'));var utils=require(_0x01c2('0x16'));var config=require(_0x01c2('0x17'));var licenseUtil=require(_0x01c2('0x18'));var db=require(_0x01c2('0x19'))['db'];function respondWithStatusCode(_0x237dbd,_0x1d962c){_0x1d962c=_0x1d962c||0xcc;return function(_0x206e63){if(_0x206e63){return _0x237dbd[_0x01c2('0x1a')](_0x1d962c);}return _0x237dbd[_0x01c2('0x1b')](_0x1d962c)[_0x01c2('0x1c')]();};}function respondWithResult(_0x397a54,_0x41c108){_0x41c108=_0x41c108||0xc8;return function(_0x27aa0f){if(_0x27aa0f){return _0x397a54[_0x01c2('0x1b')](_0x41c108)[_0x01c2('0x1d')](_0x27aa0f);}};}function respondWithFilteredResult(_0x33fa92,_0x67b2b5){return function(_0x3a8d26){if(_0x3a8d26){var _0x2289eb=typeof _0x67b2b5[_0x01c2('0x1e')]===_0x01c2('0x1f')&&typeof _0x67b2b5[_0x01c2('0x20')]===_0x01c2('0x1f');var _0x119859=_0x3a8d26[_0x01c2('0x21')];var _0x36f4d6=_0x2289eb?0x0:_0x67b2b5[_0x01c2('0x1e')];var _0x6ee915=_0x2289eb?_0x3a8d26[_0x01c2('0x21')]:_0x67b2b5[_0x01c2('0x1e')]+_0x67b2b5[_0x01c2('0x20')];var _0x2ec737;if(_0x6ee915>=_0x119859){_0x6ee915=_0x119859;_0x2ec737=0xc8;}else{_0x2ec737=0xce;}_0x33fa92[_0x01c2('0x1b')](_0x2ec737);return _0x33fa92[_0x01c2('0x22')](_0x01c2('0x23'),_0x36f4d6+'-'+_0x6ee915+'/'+_0x119859)[_0x01c2('0x1d')](_0x3a8d26);}return null;};}function patchUpdates(_0x9374e9){return function(_0x43bfd2){try{jsonpatch['apply'](_0x43bfd2,_0x9374e9,!![]);}catch(_0x6ce2d9){return BPromise[_0x01c2('0x24')](_0x6ce2d9);}return _0x43bfd2[_0x01c2('0x25')]();};}function saveUpdates(_0x54fddc,_0x35f5b8){return function(_0x311a73){if(_0x311a73){return _0x311a73[_0x01c2('0x26')](_0x54fddc)['then'](function(_0x5af0b6){return _0x5af0b6;});}return null;};}function removeEntity(_0x51bbaf,_0x5b104e){return function(_0x43189f){if(_0x43189f){return _0x43189f[_0x01c2('0x27')]()[_0x01c2('0x28')](function(){_0x51bbaf[_0x01c2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21aa32,_0x19c9db){return function(_0x3d3282){if(!_0x3d3282){_0x21aa32['sendStatus'](0x194);}return _0x3d3282;};}function handleError(_0x1cde65,_0xb29cdf){_0xb29cdf=_0xb29cdf||0x1f4;return function(_0x3f4a73){logger[_0x01c2('0x29')](_0x3f4a73[_0x01c2('0x2a')]);if(_0x3f4a73['name']){delete _0x3f4a73[_0x01c2('0x2b')];}_0x1cde65[_0x01c2('0x1b')](_0xb29cdf)[_0x01c2('0x2c')](_0x3f4a73);};}exports[_0x01c2('0x2d')]=function(_0x25c8c7,_0x1be119){var _0x2bd85f={},_0x1ab7a4={},_0x215e5c={'count':0x0,'rows':[]};var _0x15f65c=_[_0x01c2('0x2e')](db[_0x01c2('0x2f')][_0x01c2('0x30')],function(_0x486593){return{'name':_0x486593['fieldName'],'type':_0x486593[_0x01c2('0x31')][_0x01c2('0x32')]};});_0x1ab7a4['model']=_[_0x01c2('0x2e')](_0x15f65c,_0x01c2('0x2b'));_0x1ab7a4['query']=_[_0x01c2('0x33')](_0x25c8c7[_0x01c2('0x34')]);_0x1ab7a4[_0x01c2('0x35')]=_[_0x01c2('0x36')](_0x1ab7a4['model'],_0x1ab7a4['query']);_0x2bd85f[_0x01c2('0x37')]=_[_0x01c2('0x36')](_0x1ab7a4[_0x01c2('0x38')],qs[_0x01c2('0x39')](_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x39')]));_0x2bd85f[_0x01c2('0x37')]=_0x2bd85f['attributes'][_0x01c2('0x3a')]?_0x2bd85f[_0x01c2('0x37')]:_0x1ab7a4[_0x01c2('0x38')];if(!_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x3b')](_0x01c2('0x3c'))){_0x2bd85f['limit']=qs[_0x01c2('0x20')](_0x25c8c7['query'][_0x01c2('0x20')]);_0x2bd85f['offset']=qs['offset'](_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x1e')]);}_0x2bd85f[_0x01c2('0x3d')]=qs[_0x01c2('0x3e')](_0x25c8c7[_0x01c2('0x34')]['sort']);_0x2bd85f[_0x01c2('0x3f')]=qs['filters'](_[_0x01c2('0x40')](_0x25c8c7[_0x01c2('0x34')],_0x1ab7a4['filters']),_0x15f65c);if(_0x25c8c7['query']['filter']){_0x2bd85f[_0x01c2('0x3f')]=_['merge'](_0x2bd85f[_0x01c2('0x3f')],{'$or':_[_0x01c2('0x2e')](_0x15f65c,function(_0x5f590d){if(_0x5f590d['type']!==_0x01c2('0x41')){var _0x3a55cd={};_0x3a55cd[_0x5f590d[_0x01c2('0x2b')]]={'$like':'%'+_0x25c8c7['query'][_0x01c2('0x42')]+'%'};return _0x3a55cd;}})});}_0x2bd85f=_[_0x01c2('0x43')]({},_0x2bd85f,_0x25c8c7[_0x01c2('0x44')]);var _0x17215e={'where':_0x2bd85f[_0x01c2('0x3f')]};return db[_0x01c2('0x2f')]['count'](_0x17215e)[_0x01c2('0x28')](function(_0x534e5b){_0x215e5c[_0x01c2('0x21')]=_0x534e5b;if(_0x25c8c7[_0x01c2('0x34')][_0x01c2('0x45')]){_0x2bd85f['include']=[{'all':!![]}];}return db[_0x01c2('0x2f')][_0x01c2('0x46')](_0x2bd85f);})[_0x01c2('0x28')](function(_0xed8775){_0x215e5c[_0x01c2('0x47')]=_0xed8775;return _0x215e5c;})[_0x01c2('0x28')](respondWithFilteredResult(_0x1be119,_0x2bd85f))[_0x01c2('0x48')](handleError(_0x1be119,null));};exports[_0x01c2('0x49')]=function(_0x197a96,_0x3d25ee){var _0x2ae224={'raw':!![],'where':{'id':_0x197a96[_0x01c2('0x4a')]['id']}},_0x331c60={};_0x331c60['model']=_[_0x01c2('0x33')](db['ServicenowField']['rawAttributes']);_0x331c60[_0x01c2('0x34')]=_[_0x01c2('0x33')](_0x197a96[_0x01c2('0x34')]);_0x331c60[_0x01c2('0x35')]=_[_0x01c2('0x36')](_0x331c60[_0x01c2('0x38')],_0x331c60[_0x01c2('0x34')]);_0x2ae224[_0x01c2('0x37')]=_['intersection'](_0x331c60[_0x01c2('0x38')],qs[_0x01c2('0x39')](_0x197a96[_0x01c2('0x34')][_0x01c2('0x39')]));_0x2ae224[_0x01c2('0x37')]=_0x2ae224[_0x01c2('0x37')][_0x01c2('0x3a')]?_0x2ae224['attributes']:_0x331c60[_0x01c2('0x38')];if(_0x197a96[_0x01c2('0x34')][_0x01c2('0x45')]){_0x2ae224[_0x01c2('0x4b')]=[{'all':!![]}];}_0x2ae224=_[_0x01c2('0x43')]({},_0x2ae224,_0x197a96[_0x01c2('0x44')]);return db[_0x01c2('0x2f')][_0x01c2('0x4c')](_0x2ae224)[_0x01c2('0x28')](handleEntityNotFound(_0x3d25ee,null))[_0x01c2('0x28')](respondWithResult(_0x3d25ee,null))[_0x01c2('0x48')](handleError(_0x3d25ee,null));};exports['create']=function(_0x390476,_0x40dcee){return db[_0x01c2('0x2f')][_0x01c2('0x4d')](_0x390476['body'],{})[_0x01c2('0x28')](respondWithResult(_0x40dcee,0xc9))[_0x01c2('0x48')](handleError(_0x40dcee,null));};exports[_0x01c2('0x26')]=function(_0x4d3c72,_0x355b2b){if(_0x4d3c72['body']['id']){delete _0x4d3c72[_0x01c2('0x4e')]['id'];}return db['ServicenowField'][_0x01c2('0x4c')]({'where':{'id':_0x4d3c72[_0x01c2('0x4a')]['id']}})[_0x01c2('0x28')](handleEntityNotFound(_0x355b2b,null))['then'](saveUpdates(_0x4d3c72['body'],null))[_0x01c2('0x28')](respondWithResult(_0x355b2b,null))[_0x01c2('0x48')](handleError(_0x355b2b,null));};exports['destroy']=function(_0x116fb4,_0x43cec2){return db[_0x01c2('0x2f')][_0x01c2('0x4c')]({'where':{'id':_0x116fb4[_0x01c2('0x4a')]['id']}})[_0x01c2('0x28')](handleEntityNotFound(_0x43cec2,null))[_0x01c2('0x28')](removeEntity(_0x43cec2,null))[_0x01c2('0x48')](handleError(_0x43cec2,null));}; \ No newline at end of file +var _0x1714=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','ServicenowField','rows','show','find','create','body','catch','eml-format','rimraf','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x1714,0x14f));var _0x4171=function(_0x1c45c7,_0x1dfa99){_0x1c45c7=_0x1c45c7-0x0;var _0x3447de=_0x1714[_0x1c45c7];return _0x3447de;};'use strict';var emlformat=require(_0x4171('0x0'));var rimraf=require(_0x4171('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4171('0x2'));var util=require(_0x4171('0x3'));var path=require(_0x4171('0x4'));var sox=require(_0x4171('0x5'));var csv=require(_0x4171('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4171('0x7'));var _=require(_0x4171('0x8'));var squel=require(_0x4171('0x9'));var crypto=require(_0x4171('0xa'));var jsforce=require(_0x4171('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4171('0x6'));var querystring=require(_0x4171('0xc'));var Papa=require(_0x4171('0xd'));var Redis=require(_0x4171('0xe'));var authService=require(_0x4171('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4171('0x10'));var hardwareService=require(_0x4171('0x11'));var logger=require(_0x4171('0x12'))(_0x4171('0x13'));var utils=require('../../config/utils');var config=require(_0x4171('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4171('0x15'))['db'];function respondWithStatusCode(_0x598699,_0x5f56b7){_0x5f56b7=_0x5f56b7||0xcc;return function(_0x5dfeb2){if(_0x5dfeb2){return _0x598699[_0x4171('0x16')](_0x5f56b7);}return _0x598699[_0x4171('0x17')](_0x5f56b7)['end']();};}function respondWithResult(_0x1384a5,_0xd71edc){_0xd71edc=_0xd71edc||0xc8;return function(_0x54c24e){if(_0x54c24e){return _0x1384a5[_0x4171('0x17')](_0xd71edc)[_0x4171('0x18')](_0x54c24e);}};}function respondWithFilteredResult(_0xea2601,_0x4d5dcf){return function(_0x490911){if(_0x490911){var _0x37543f=typeof _0x4d5dcf['offset']===_0x4171('0x19')&&typeof _0x4d5dcf[_0x4171('0x1a')]===_0x4171('0x19');var _0x2c5e95=_0x490911['count'];var _0xcd4bb0=_0x37543f?0x0:_0x4d5dcf[_0x4171('0x1b')];var _0x287fdd=_0x37543f?_0x490911[_0x4171('0x1c')]:_0x4d5dcf[_0x4171('0x1b')]+_0x4d5dcf[_0x4171('0x1a')];var _0x2a0bf6;if(_0x287fdd>=_0x2c5e95){_0x287fdd=_0x2c5e95;_0x2a0bf6=0xc8;}else{_0x2a0bf6=0xce;}_0xea2601['status'](_0x2a0bf6);return _0xea2601[_0x4171('0x1d')](_0x4171('0x1e'),_0xcd4bb0+'-'+_0x287fdd+'/'+_0x2c5e95)[_0x4171('0x18')](_0x490911);}return null;};}function patchUpdates(_0x578135){return function(_0xe66b38){try{jsonpatch['apply'](_0xe66b38,_0x578135,!![]);}catch(_0x1e5ecd){return BPromise[_0x4171('0x1f')](_0x1e5ecd);}return _0xe66b38[_0x4171('0x20')]();};}function saveUpdates(_0x479cc7,_0x31c253){return function(_0x41f351){if(_0x41f351){return _0x41f351[_0x4171('0x21')](_0x479cc7)[_0x4171('0x22')](function(_0x23d0c6){return _0x23d0c6;});}return null;};}function removeEntity(_0x5a680d,_0x15ffa8){return function(_0x26b59c){if(_0x26b59c){return _0x26b59c[_0x4171('0x23')]()[_0x4171('0x22')](function(){_0x5a680d[_0x4171('0x17')](0xcc)[_0x4171('0x24')]();});}};}function handleEntityNotFound(_0xbac1db,_0x7dce6a){return function(_0x196305){if(!_0x196305){_0xbac1db[_0x4171('0x16')](0x194);}return _0x196305;};}function handleError(_0x3db2d9,_0x532fe0){_0x532fe0=_0x532fe0||0x1f4;return function(_0x54913a){logger[_0x4171('0x25')](_0x54913a[_0x4171('0x26')]);if(_0x54913a[_0x4171('0x27')]){delete _0x54913a['name'];}_0x3db2d9[_0x4171('0x17')](_0x532fe0)[_0x4171('0x28')](_0x54913a);};}exports['index']=function(_0x1f8086,_0x35c8d5){var _0x28c588={},_0x56fb5b={},_0x17483b={'count':0x0,'rows':[]};var _0x26b66a=_[_0x4171('0x29')](db['ServicenowField'][_0x4171('0x2a')],function(_0x5ee387){return{'name':_0x5ee387[_0x4171('0x2b')],'type':_0x5ee387['type']['key']};});_0x56fb5b[_0x4171('0x2c')]=_['map'](_0x26b66a,_0x4171('0x27'));_0x56fb5b[_0x4171('0x2d')]=_[_0x4171('0x2e')](_0x1f8086[_0x4171('0x2d')]);_0x56fb5b[_0x4171('0x2f')]=_['intersection'](_0x56fb5b[_0x4171('0x2c')],_0x56fb5b[_0x4171('0x2d')]);_0x28c588['attributes']=_[_0x4171('0x30')](_0x56fb5b[_0x4171('0x2c')],qs['fields'](_0x1f8086[_0x4171('0x2d')][_0x4171('0x31')]));_0x28c588[_0x4171('0x32')]=_0x28c588[_0x4171('0x32')][_0x4171('0x33')]?_0x28c588[_0x4171('0x32')]:_0x56fb5b[_0x4171('0x2c')];if(!_0x1f8086['query'][_0x4171('0x34')](_0x4171('0x35'))){_0x28c588[_0x4171('0x1a')]=qs['limit'](_0x1f8086[_0x4171('0x2d')][_0x4171('0x1a')]);_0x28c588[_0x4171('0x1b')]=qs[_0x4171('0x1b')](_0x1f8086[_0x4171('0x2d')][_0x4171('0x1b')]);}_0x28c588['order']=qs[_0x4171('0x36')](_0x1f8086[_0x4171('0x2d')][_0x4171('0x36')]);_0x28c588[_0x4171('0x37')]=qs[_0x4171('0x2f')](_[_0x4171('0x38')](_0x1f8086[_0x4171('0x2d')],_0x56fb5b[_0x4171('0x2f')]),_0x26b66a);if(_0x1f8086['query'][_0x4171('0x39')]){_0x28c588[_0x4171('0x37')]=_[_0x4171('0x3a')](_0x28c588[_0x4171('0x37')],{'$or':_['map'](_0x26b66a,function(_0x2cda62){if(_0x2cda62[_0x4171('0x3b')]!==_0x4171('0x3c')){var _0x59ab0c={};_0x59ab0c[_0x2cda62[_0x4171('0x27')]]={'$like':'%'+_0x1f8086['query'][_0x4171('0x39')]+'%'};return _0x59ab0c;}})});}_0x28c588=_['merge']({},_0x28c588,_0x1f8086['options']);var _0x10e4c7={'where':_0x28c588[_0x4171('0x37')]};return db['ServicenowField'][_0x4171('0x1c')](_0x10e4c7)['then'](function(_0x39d67b){_0x17483b[_0x4171('0x1c')]=_0x39d67b;if(_0x1f8086['query'][_0x4171('0x3d')]){_0x28c588[_0x4171('0x3e')]=[{'all':!![]}];}return db[_0x4171('0x3f')]['findAll'](_0x28c588);})[_0x4171('0x22')](function(_0x194d01){_0x17483b[_0x4171('0x40')]=_0x194d01;return _0x17483b;})[_0x4171('0x22')](respondWithFilteredResult(_0x35c8d5,_0x28c588))['catch'](handleError(_0x35c8d5,null));};exports[_0x4171('0x41')]=function(_0x3e4273,_0x540b15){var _0x515663={'raw':!![],'where':{'id':_0x3e4273['params']['id']}},_0x116fd7={};_0x116fd7[_0x4171('0x2c')]=_[_0x4171('0x2e')](db['ServicenowField'][_0x4171('0x2a')]);_0x116fd7[_0x4171('0x2d')]=_['keys'](_0x3e4273[_0x4171('0x2d')]);_0x116fd7[_0x4171('0x2f')]=_['intersection'](_0x116fd7[_0x4171('0x2c')],_0x116fd7[_0x4171('0x2d')]);_0x515663[_0x4171('0x32')]=_[_0x4171('0x30')](_0x116fd7[_0x4171('0x2c')],qs[_0x4171('0x31')](_0x3e4273[_0x4171('0x2d')]['fields']));_0x515663[_0x4171('0x32')]=_0x515663[_0x4171('0x32')]['length']?_0x515663[_0x4171('0x32')]:_0x116fd7[_0x4171('0x2c')];if(_0x3e4273[_0x4171('0x2d')][_0x4171('0x3d')]){_0x515663[_0x4171('0x3e')]=[{'all':!![]}];}_0x515663=_[_0x4171('0x3a')]({},_0x515663,_0x3e4273['options']);return db[_0x4171('0x3f')][_0x4171('0x42')](_0x515663)[_0x4171('0x22')](handleEntityNotFound(_0x540b15,null))[_0x4171('0x22')](respondWithResult(_0x540b15,null))['catch'](handleError(_0x540b15,null));};exports[_0x4171('0x43')]=function(_0x4882ad,_0x154e7c){return db[_0x4171('0x3f')]['create'](_0x4882ad[_0x4171('0x44')],{})['then'](respondWithResult(_0x154e7c,0xc9))[_0x4171('0x45')](handleError(_0x154e7c,null));};exports['update']=function(_0x3b5e88,_0x22d7b0){if(_0x3b5e88['body']['id']){delete _0x3b5e88[_0x4171('0x44')]['id'];}return db[_0x4171('0x3f')]['find']({'where':{'id':_0x3b5e88['params']['id']}})[_0x4171('0x22')](handleEntityNotFound(_0x22d7b0,null))[_0x4171('0x22')](saveUpdates(_0x3b5e88[_0x4171('0x44')],null))[_0x4171('0x22')](respondWithResult(_0x22d7b0,null))[_0x4171('0x45')](handleError(_0x22d7b0,null));};exports[_0x4171('0x23')]=function(_0x5463dd,_0x578dda){return db[_0x4171('0x3f')][_0x4171('0x42')]({'where':{'id':_0x5463dd['params']['id']}})[_0x4171('0x22')](handleEntityNotFound(_0x578dda,null))['then'](removeEntity(_0x578dda,null))[_0x4171('0x45')](handleError(_0x578dda,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 247c6a1..e79e133 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 _0xb090=['servicenow_unique_index','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x561975,_0x1d64fc){var _0x15b7f5=function(_0x43bfc1){while(--_0x43bfc1){_0x561975['push'](_0x561975['shift']());}};_0x15b7f5(++_0x1d64fc);}(_0xb090,0x1c2));var _0x0b09=function(_0x41bcc3,_0x101b3a){_0x41bcc3=_0x41bcc3-0x0;var _0x237c99=_0xb090[_0x41bcc3];return _0x237c99;};'use strict';var _=require(_0x0b09('0x0'));var util=require(_0x0b09('0x1'));var logger=require(_0x0b09('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b09('0x3'));var fs=require('fs');var path=require(_0x0b09('0x4'));var rimraf=require(_0x0b09('0x5'));var config=require(_0x0b09('0x6'));var attributes=require(_0x0b09('0x7'));module[_0x0b09('0x8')]=function(_0xaa085a,_0x4ef365){return _0xaa085a[_0x0b09('0x9')](_0x0b09('0xa'),attributes,{'tableName':_0x0b09('0xb'),'paranoid':![],'indexes':[{'name':_0x0b09('0xc'),'fields':['idField',_0x0b09('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa360=['idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x4ee0f7,_0x416a9e){var _0x3c36d3=function(_0x2b397d){while(--_0x2b397d){_0x4ee0f7['push'](_0x4ee0f7['shift']());}};_0x3c36d3(++_0x416a9e);}(_0xa360,0xb5));var _0x0a36=function(_0x5a1bfc,_0x26d27c){_0x5a1bfc=_0x5a1bfc-0x0;var _0x1083dc=_0xa360[_0x5a1bfc];return _0x1083dc;};'use strict';var _=require(_0x0a36('0x0'));var util=require(_0x0a36('0x1'));var logger=require(_0x0a36('0x2'))('api');var moment=require(_0x0a36('0x3'));var BPromise=require(_0x0a36('0x4'));var rp=require(_0x0a36('0x5'));var fs=require('fs');var path=require(_0x0a36('0x6'));var rimraf=require(_0x0a36('0x7'));var config=require(_0x0a36('0x8'));var attributes=require(_0x0a36('0x9'));module[_0x0a36('0xa')]=function(_0x5cf9fd,_0x1b10e9){return _0x5cf9fd[_0x0a36('0xb')](_0x0a36('0xc'),attributes,{'tableName':_0x0a36('0xd'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0a36('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 5dbab2f..f6a4010 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x268176,_0x20348e){var _0x233db8=function(_0x2cf259){while(--_0x2cf259){_0x268176['push'](_0x268176['shift']());}};_0x233db8(++_0x20348e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x1a76b2,_0x49da7c){var _0x133d0c=function(_0x19ec57){while(--_0x19ec57){_0x1a76b2['push'](_0x1a76b2['shift']());}};_0x133d0c(++_0x49da7c);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x29884a,_0x33f60a){_0x29884a=_0x29884a-0x0;var _0x5b0932=_0x9ffd[_0x29884a];return _0x5b0932;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0a7af2b..c86fdae 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x308d0f,_0x124390){var _0x166585=function(_0x58ea9c){while(--_0x58ea9c){_0x308d0f['push'](_0x308d0f['shift']());}};_0x166585(++_0x124390);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5c09d4,_0x2ddddc){var _0x1e4130=function(_0x4ae0f0){while(--_0x4ae0f0){_0x5c09d4['push'](_0x5c09d4['shift']());}};_0x1e4130(++_0x2ddddc);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 90dc1c9..3e1721d 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(_0x51f2fd,_0x56d77a){var _0x553cc0=function(_0x4d24b0){while(--_0x4d24b0){_0x51f2fd['push'](_0x51f2fd['shift']());}};_0x553cc0(++_0x56d77a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x699fab,_0x257401){var _0xb58ea2=function(_0x30b98e){while(--_0x30b98e){_0x699fab['push'](_0x699fab['shift']());}};_0xb58ea2(++_0x257401);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 045cfaf..c6e8efa 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 _0x6759=['addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','direction','findOne','username','password','remoteUri','slice','substring','format','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','includes','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','json','offset','limit','undefined','count','status','set','reject','save','then','sendStatus','error','stack','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations'];(function(_0x41b807,_0x35fcda){var _0xc88ec0=function(_0x1c3833){while(--_0x1c3833){_0x41b807['push'](_0x41b807['shift']());}};_0xc88ec0(++_0x35fcda);}(_0x6759,0x197));var _0x9675=function(_0x3e5325,_0x55af33){_0x3e5325=_0x3e5325-0x0;var _0x5a1c63=_0x6759[_0x3e5325];return _0x5a1c63;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9675('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9675('0x1'));var rp=require(_0x9675('0x2'));var moment=require(_0x9675('0x3'));var BPromise=require(_0x9675('0x4'));var Mustache=require(_0x9675('0x5'));var util=require(_0x9675('0x6'));var path=require(_0x9675('0x7'));var sox=require(_0x9675('0x8'));var csv=require(_0x9675('0x9'));var ejs=require(_0x9675('0xa'));var fs=require('fs');var fs_extra=require(_0x9675('0xb'));var _=require(_0x9675('0xc'));var squel=require('squel');var crypto=require(_0x9675('0xd'));var jsforce=require(_0x9675('0xe'));var deskjs=require(_0x9675('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9675('0x10'));var Papa=require(_0x9675('0x11'));var Redis=require(_0x9675('0x12'));var authService=require(_0x9675('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9675('0x14'));var hardwareService=require(_0x9675('0x15'));var logger=require(_0x9675('0x16'))(_0x9675('0x17'));var utils=require(_0x9675('0x18'));var config=require(_0x9675('0x19'));var licenseUtil=require(_0x9675('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9675('0x1b'));function respondWithStatusCode(_0x2779de,_0x3576a3){_0x3576a3=_0x3576a3||0xcc;return function(_0x4d7a91){if(_0x4d7a91){return _0x2779de['sendStatus'](_0x3576a3);}return _0x2779de['status'](_0x3576a3)[_0x9675('0x1c')]();};}function respondWithResult(_0x151bf3,_0x5c2d5f){_0x5c2d5f=_0x5c2d5f||0xc8;return function(_0x49a955){if(_0x49a955){return _0x151bf3['status'](_0x5c2d5f)[_0x9675('0x1d')](_0x49a955);}};}function respondWithFilteredResult(_0x5d97b5,_0x304803){return function(_0x5161f5){if(_0x5161f5){var _0xa0aa9=typeof _0x304803[_0x9675('0x1e')]==='undefined'&&typeof _0x304803[_0x9675('0x1f')]===_0x9675('0x20');var _0x33f6fe=_0x5161f5['count'];var _0x2883e8=_0xa0aa9?0x0:_0x304803[_0x9675('0x1e')];var _0x26ee4f=_0xa0aa9?_0x5161f5[_0x9675('0x21')]:_0x304803['offset']+_0x304803[_0x9675('0x1f')];var _0x1df7f;if(_0x26ee4f>=_0x33f6fe){_0x26ee4f=_0x33f6fe;_0x1df7f=0xc8;}else{_0x1df7f=0xce;}_0x5d97b5[_0x9675('0x22')](_0x1df7f);return _0x5d97b5[_0x9675('0x23')]('Content-Range',_0x2883e8+'-'+_0x26ee4f+'/'+_0x33f6fe)[_0x9675('0x1d')](_0x5161f5);}return null;};}function patchUpdates(_0x29a0bc){return function(_0xbe2521){try{jsonpatch['apply'](_0xbe2521,_0x29a0bc,!![]);}catch(_0x37ea31){return BPromise[_0x9675('0x24')](_0x37ea31);}return _0xbe2521[_0x9675('0x25')]();};}function saveUpdates(_0x133b57,_0x120d28){return function(_0x2a1c50){if(_0x2a1c50){return _0x2a1c50['update'](_0x133b57)[_0x9675('0x26')](function(_0x7b85f7){return _0x7b85f7;});}return null;};}function removeEntity(_0x15cafd,_0x4b0144){return function(_0x121db5){if(_0x121db5){return _0x121db5['destroy']()[_0x9675('0x26')](function(){_0x15cafd[_0x9675('0x22')](0xcc)[_0x9675('0x1c')]();});}};}function handleEntityNotFound(_0x1c7f6b,_0x2819d6){return function(_0x1e9e30){if(!_0x1e9e30){_0x1c7f6b[_0x9675('0x27')](0x194);}return _0x1e9e30;};}function handleError(_0xe6d61,_0x1fc047){_0x1fc047=_0x1fc047||0x1f4;return function(_0x1546f8){logger[_0x9675('0x28')](_0x1546f8[_0x9675('0x29')]);if(_0x1546f8['name']){delete _0x1546f8['name'];}_0xe6d61[_0x9675('0x22')](_0x1fc047)[_0x9675('0x2a')](_0x1546f8);};}exports[_0x9675('0x2b')]=function(_0x56a770,_0x862210){var _0x2b6fee={},_0x162bf0={},_0x5f1bdf={'count':0x0,'rows':[]};var _0x85a734=_[_0x9675('0x2c')](db[_0x9675('0x2d')][_0x9675('0x2e')],function(_0x180081){return{'name':_0x180081[_0x9675('0x2f')],'type':_0x180081[_0x9675('0x30')]['key']};});_0x162bf0[_0x9675('0x31')]=_[_0x9675('0x2c')](_0x85a734,_0x9675('0x32'));_0x162bf0['query']=_[_0x9675('0x33')](_0x56a770[_0x9675('0x34')]);_0x162bf0[_0x9675('0x35')]=_[_0x9675('0x36')](_0x162bf0[_0x9675('0x31')],_0x162bf0[_0x9675('0x34')]);_0x2b6fee['attributes']=_['intersection'](_0x162bf0[_0x9675('0x31')],qs[_0x9675('0x37')](_0x56a770[_0x9675('0x34')]['fields']));_0x2b6fee[_0x9675('0x38')]=_0x2b6fee[_0x9675('0x38')]['length']?_0x2b6fee[_0x9675('0x38')]:_0x162bf0[_0x9675('0x31')];if(!_0x56a770[_0x9675('0x34')][_0x9675('0x39')](_0x9675('0x3a'))){_0x2b6fee[_0x9675('0x1f')]=qs[_0x9675('0x1f')](_0x56a770['query'][_0x9675('0x1f')]);_0x2b6fee[_0x9675('0x1e')]=qs[_0x9675('0x1e')](_0x56a770[_0x9675('0x34')]['offset']);}_0x2b6fee['order']=qs['sort'](_0x56a770[_0x9675('0x34')][_0x9675('0x3b')]);_0x2b6fee[_0x9675('0x3c')]=qs['filters'](_[_0x9675('0x3d')](_0x56a770[_0x9675('0x34')],_0x162bf0[_0x9675('0x35')]),_0x85a734);if(_0x56a770[_0x9675('0x34')][_0x9675('0x3e')]){_0x2b6fee[_0x9675('0x3c')]=_[_0x9675('0x3f')](_0x2b6fee[_0x9675('0x3c')],{'$or':_[_0x9675('0x2c')](_0x85a734,function(_0x1f2679){if(_0x1f2679[_0x9675('0x30')]!=='VIRTUAL'){var _0xe62a1b={};_0xe62a1b[_0x1f2679['name']]={'$like':'%'+_0x56a770[_0x9675('0x34')][_0x9675('0x3e')]+'%'};return _0xe62a1b;}})});}_0x2b6fee=_[_0x9675('0x3f')]({},_0x2b6fee,_0x56a770[_0x9675('0x40')]);var _0x41c345={'where':_0x2b6fee[_0x9675('0x3c')]};return db[_0x9675('0x2d')][_0x9675('0x21')](_0x41c345)[_0x9675('0x26')](function(_0x2dd742){_0x5f1bdf[_0x9675('0x21')]=_0x2dd742;if(_0x56a770['query'][_0x9675('0x41')]){_0x2b6fee[_0x9675('0x42')]=[{'all':!![]}];}return db[_0x9675('0x2d')][_0x9675('0x43')](_0x2b6fee);})['then'](function(_0x2be6cf){_0x5f1bdf[_0x9675('0x44')]=_0x2be6cf;return _0x5f1bdf;})[_0x9675('0x26')](respondWithFilteredResult(_0x862210,_0x2b6fee))[_0x9675('0x45')](handleError(_0x862210,null));};exports[_0x9675('0x46')]=function(_0x10f6e7,_0x4db620){var _0x262187={'raw':![],'where':{'id':_0x10f6e7['params']['id']}},_0x160c9f={};_0x160c9f[_0x9675('0x31')]=_[_0x9675('0x33')](db['SugarcrmAccount'][_0x9675('0x2e')]);_0x160c9f[_0x9675('0x34')]=_[_0x9675('0x33')](_0x10f6e7['query']);_0x160c9f[_0x9675('0x35')]=_[_0x9675('0x36')](_0x160c9f[_0x9675('0x31')],_0x160c9f[_0x9675('0x34')]);_0x262187['attributes']=_[_0x9675('0x36')](_0x160c9f[_0x9675('0x31')],qs[_0x9675('0x37')](_0x10f6e7[_0x9675('0x34')][_0x9675('0x37')]));_0x262187[_0x9675('0x38')]=_0x262187[_0x9675('0x38')][_0x9675('0x47')]?_0x262187[_0x9675('0x38')]:_0x160c9f[_0x9675('0x31')];if(_0x10f6e7[_0x9675('0x34')][_0x9675('0x41')]){_0x262187[_0x9675('0x42')]=[{'all':!![]}];}_0x262187=_['merge']({},_0x262187,_0x10f6e7['options']);return db['SugarcrmAccount'][_0x9675('0x48')](_0x262187)[_0x9675('0x26')](handleEntityNotFound(_0x4db620,null))[_0x9675('0x26')](respondWithResult(_0x4db620,null))[_0x9675('0x45')](handleError(_0x4db620,null));};exports[_0x9675('0x49')]=function(_0xbdf865,_0x1fdd0c){return db['SugarcrmAccount']['create'](_0xbdf865[_0x9675('0x4a')],{})[_0x9675('0x26')](respondWithResult(_0x1fdd0c,0xc9))[_0x9675('0x45')](handleError(_0x1fdd0c,null));};exports['update']=function(_0x4c8baf,_0x9680b){if(_0x4c8baf[_0x9675('0x4a')]['id']){delete _0x4c8baf[_0x9675('0x4a')]['id'];}return db['SugarcrmAccount'][_0x9675('0x48')]({'where':{'id':_0x4c8baf[_0x9675('0x4b')]['id']}})[_0x9675('0x26')](handleEntityNotFound(_0x9680b,null))['then'](saveUpdates(_0x4c8baf[_0x9675('0x4a')],null))['then'](respondWithResult(_0x9680b,null))[_0x9675('0x45')](handleError(_0x9680b,null));};exports['destroy']=function(_0x132d74,_0x3c6b75){return db[_0x9675('0x2d')]['find']({'where':{'id':_0x132d74[_0x9675('0x4b')]['id']}})[_0x9675('0x26')](handleEntityNotFound(_0x3c6b75,null))[_0x9675('0x26')](removeEntity(_0x3c6b75,null))[_0x9675('0x45')](handleError(_0x3c6b75,null));};exports[_0x9675('0x4c')]=function(_0x4c54b4,_0x4a690b,_0x48dd6d){var _0x963e19={};var _0x3f7477={};var _0x33f48b;var _0x298a99;return db[_0x9675('0x2d')]['findOne']({'where':{'id':_0x4c54b4[_0x9675('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a690b,null))[_0x9675('0x26')](function(_0x430aff){if(_0x430aff){_0x33f48b=_0x430aff;_0x3f7477['model']=_[_0x9675('0x33')](db['SugarcrmConfiguration']['rawAttributes']);_0x3f7477['query']=_[_0x9675('0x33')](_0x4c54b4[_0x9675('0x34')]);_0x3f7477[_0x9675('0x35')]=_[_0x9675('0x36')](_0x3f7477[_0x9675('0x31')],_0x3f7477[_0x9675('0x34')]);_0x963e19['attributes']=_[_0x9675('0x36')](_0x3f7477[_0x9675('0x31')],qs[_0x9675('0x37')](_0x4c54b4['query'][_0x9675('0x37')]));_0x963e19[_0x9675('0x38')]=_0x963e19[_0x9675('0x38')][_0x9675('0x47')]?_0x963e19[_0x9675('0x38')]:_0x3f7477[_0x9675('0x31')];_0x963e19['order']=qs[_0x9675('0x3b')](_0x4c54b4[_0x9675('0x34')][_0x9675('0x3b')]);_0x963e19[_0x9675('0x3c')]=qs[_0x9675('0x35')](_['pick'](_0x4c54b4[_0x9675('0x34')],_0x3f7477['filters']));if(_0x4c54b4[_0x9675('0x34')][_0x9675('0x3e')]){_0x963e19[_0x9675('0x3c')]=_[_0x9675('0x3f')](_0x963e19[_0x9675('0x3c')],{'$or':_[_0x9675('0x2c')](_0x963e19[_0x9675('0x38')],function(_0x2efb36){var _0x558294={};_0x558294[_0x2efb36]={'$like':'%'+_0x4c54b4[_0x9675('0x34')][_0x9675('0x3e')]+'%'};return _0x558294;})});}_0x963e19=_[_0x9675('0x3f')]({},_0x963e19,_0x4c54b4[_0x9675('0x40')]);return _0x33f48b[_0x9675('0x4c')](_0x963e19);}})[_0x9675('0x26')](function(_0x25a159){if(_0x25a159){_0x298a99=_0x25a159[_0x9675('0x47')];if(!_0x4c54b4[_0x9675('0x34')][_0x9675('0x39')](_0x9675('0x3a'))){_0x963e19[_0x9675('0x1f')]=qs['limit'](_0x4c54b4[_0x9675('0x34')]['limit']);_0x963e19[_0x9675('0x1e')]=qs[_0x9675('0x1e')](_0x4c54b4[_0x9675('0x34')][_0x9675('0x1e')]);}return _0x33f48b[_0x9675('0x4c')](_0x963e19);}})[_0x9675('0x26')](function(_0x7296d0){if(_0x7296d0){return _0x7296d0?{'count':_0x298a99,'rows':_0x7296d0}:null;}})['then'](respondWithResult(_0x4a690b,null))[_0x9675('0x45')](handleError(_0x4a690b,null));};exports[_0x9675('0x4d')]=function(_0x3d39f9,_0x42f361,_0xe14a10){if(_0x3d39f9[_0x9675('0x4a')]['id']){delete _0x3d39f9[_0x9675('0x4a')]['id'];}return db[_0x9675('0x2d')]['findOne']({'where':{'id':_0x3d39f9[_0x9675('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42f361,null))['then'](function(_0x273243){if(_0x273243){_0x3d39f9['body'][_0x9675('0x4e')]=_0x273243['id'];_0x3d39f9[_0x9675('0x4a')][_0x9675('0x4f')]=integrations[_0x9675('0x50')](_0x3d39f9['body']['channel'],_0x3d39f9[_0x9675('0x4a')]['type']);_0x3d39f9['body'][_0x9675('0x51')]=integrations[_0x9675('0x52')](_0x3d39f9[_0x9675('0x4a')][_0x9675('0x53')],_0x3d39f9[_0x9675('0x4a')][_0x9675('0x30')]);return db[_0x9675('0x54')][_0x9675('0x49')](_0x3d39f9[_0x9675('0x4a')],{'include':[{'model':db['SugarcrmField'],'as':_0x9675('0x4f')},{'model':db[_0x9675('0x55')],'as':_0x9675('0x51')}]});}return null;})['then'](respondWithResult(_0x42f361,null))[_0x9675('0x45')](handleError(_0x42f361,null));};exports[_0x9675('0x56')]=function(_0x23f678,_0x13ed42,_0x4c9926){var _0x4c9df7='';var _0x5f4875=['id',_0x9675('0x32'),'assigned_user_id',_0x9675('0x57'),_0x9675('0x58'),_0x9675('0x59'),_0x9675('0x5a'),_0x9675('0x5b'),'parent_id',_0x9675('0x5c'),'parent_name',_0x9675('0x5d')];return db[_0x9675('0x2d')][_0x9675('0x5e')]({'where':{'id':_0x23f678[_0x9675('0x4b')]['id']},'attributes':['id',_0x9675('0x5f'),_0x9675('0x60'),_0x9675('0x61')]})[_0x9675('0x26')](handleEntityNotFound(_0x13ed42,null))[_0x9675('0x26')](function(_0x57b437){if(_0x57b437){_0x4c9df7=_0x57b437[_0x9675('0x61')];var _0x1f4099=_0x4c9df7[_0x9675('0x62')](-0x1);if(_0x1f4099==='/'){_0x4c9df7=_0x4c9df7[_0x9675('0x63')](0x0,_0x4c9df7['lastIndexOf'](_0x1f4099));}return rp({'method':'POST','uri':util[_0x9675('0x64')](_0x9675('0x65'),_0x4c9df7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x9675('0x66'),'response_type':_0x9675('0x66'),'rest_data':JSON[_0x9675('0x67')]({'user_auth':{'user_name':_0x57b437[_0x9675('0x5f')],'password':_0x57b437[_0x9675('0x60')],'encryption':_0x9675('0x68')},'application':_0x9675('0x69')})}});}})[_0x9675('0x26')](function(_0x444fb2){if(_0x444fb2&&_0x444fb2[_0x9675('0x32')]!==_0x9675('0x6a')&&_0x444fb2[_0x9675('0x32')]!==_0x9675('0x6b')){return rp({'method':_0x9675('0x6c'),'uri':util[_0x9675('0x64')](_0x9675('0x65'),_0x4c9df7,_0x9675('0x6d')),'json':!![],'form':{'method':_0x9675('0x6e'),'input_type':_0x9675('0x66'),'response_type':_0x9675('0x66'),'rest_data':JSON[_0x9675('0x67')]({'session':_0x444fb2['id'],'module_name':'Calls'})}})[_0x9675('0x26')](function(_0x2a836c){if(_0x2a836c){var _0x238d8f=_[_0x9675('0x6f')](_0x2a836c[_0x9675('0x70')]);_[_0x9675('0x71')](_0x238d8f,function(_0x4fb5c1){return _0x5f4875[_0x9675('0x72')](_0x4fb5c1[_0x9675('0x32')]);});return{'count':_0x238d8f[_0x9675('0x47')],'rows':_[_0x9675('0x2c')](_0x238d8f,function(_0x5909d0){return{'id':_0x5909d0[_0x9675('0x32')],'name':_0x5909d0[_0x9675('0x73')],'custom':_[_0x9675('0x74')](_0x5909d0['name'],'_c')?!![]:![],'options':_0x5909d0[_0x9675('0x40')]?_[_0x9675('0x2c')](_[_0x9675('0x6f')](_0x5909d0[_0x9675('0x40')]),function(_0xc3fe28){return{'name':_0xc3fe28['value'],'value':_0xc3fe28['name']};}):[]};})};}})[_0x9675('0x26')](respondWithResult(_0x13ed42,null))[_0x9675('0x45')](function(_0x2df869){var _0x60345b=_0x23f678[_0x9675('0x34')][_0x9675('0x75')]?0x1f4:_0x2df869[_0x9675('0x76')]||0x1f4;logger[_0x9675('0x28')](_0x9675('0x77'),_0x9675('0x56'),_0x60345b,JSON[_0x9675('0x67')](_0x2df869));delete _0x2df869[_0x9675('0x32')];if(_0x60345b===0x191){_0x60345b=0x190;}_0x13ed42[_0x9675('0x22')](_0x60345b)[_0x9675('0x2a')](_0x23f678[_0x9675('0x34')][_0x9675('0x75')]?{'message':_0x9675('0x78'),'statusCode':_0x2df869[_0x9675('0x76')]}:_0x2df869);});}else{var _0x101ecc=0x1f4;_0x13ed42['status'](_0x101ecc)[_0x9675('0x2a')]({'message':_0x9675('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x3fbc=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SugarcrmAccount','includeAll','findAll','catch','params','length','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','JSON','Calls','values','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf'];(function(_0xf0336d,_0x4e9950){var _0x3805ab=function(_0x1027ae){while(--_0x1027ae){_0xf0336d['push'](_0xf0336d['shift']());}};_0x3805ab(++_0x4e9950);}(_0x3fbc,0x1c6));var _0xc3fb=function(_0x275550,_0x1be9f6){_0x275550=_0x275550-0x0;var _0x2655ec=_0x3fbc[_0x275550];return _0x2655ec;};'use strict';var emlformat=require(_0xc3fb('0x0'));var rimraf=require(_0xc3fb('0x1'));var zipdir=require(_0xc3fb('0x2'));var jsonpatch=require(_0xc3fb('0x3'));var rp=require(_0xc3fb('0x4'));var moment=require('moment');var BPromise=require(_0xc3fb('0x5'));var Mustache=require(_0xc3fb('0x6'));var util=require(_0xc3fb('0x7'));var path=require(_0xc3fb('0x8'));var sox=require('sox');var csv=require(_0xc3fb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3fb('0xa'));var _=require(_0xc3fb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc3fb('0xc'));var Papa=require(_0xc3fb('0xd'));var Redis=require(_0xc3fb('0xe'));var authService=require(_0xc3fb('0xf'));var qs=require(_0xc3fb('0x10'));var as=require(_0xc3fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3fb('0x12'));var utils=require(_0xc3fb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3fb('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x155cc5,_0x30efc6){_0x30efc6=_0x30efc6||0xcc;return function(_0x32ebf3){if(_0x32ebf3){return _0x155cc5[_0xc3fb('0x15')](_0x30efc6);}return _0x155cc5[_0xc3fb('0x16')](_0x30efc6)[_0xc3fb('0x17')]();};}function respondWithResult(_0x12ac8b,_0x3c5cc0){_0x3c5cc0=_0x3c5cc0||0xc8;return function(_0x17f31f){if(_0x17f31f){return _0x12ac8b[_0xc3fb('0x16')](_0x3c5cc0)['json'](_0x17f31f);}};}function respondWithFilteredResult(_0x371398,_0x52007c){return function(_0x4984d3){if(_0x4984d3){var _0x31d20e=typeof _0x52007c[_0xc3fb('0x18')]==='undefined'&&typeof _0x52007c['limit']===_0xc3fb('0x19');var _0xc3a9e1=_0x4984d3[_0xc3fb('0x1a')];var _0x216d0a=_0x31d20e?0x0:_0x52007c[_0xc3fb('0x18')];var _0x24e5ef=_0x31d20e?_0x4984d3['count']:_0x52007c[_0xc3fb('0x18')]+_0x52007c[_0xc3fb('0x1b')];var _0xa9c9bc;if(_0x24e5ef>=_0xc3a9e1){_0x24e5ef=_0xc3a9e1;_0xa9c9bc=0xc8;}else{_0xa9c9bc=0xce;}_0x371398[_0xc3fb('0x16')](_0xa9c9bc);return _0x371398['set'](_0xc3fb('0x1c'),_0x216d0a+'-'+_0x24e5ef+'/'+_0xc3a9e1)['json'](_0x4984d3);}return null;};}function patchUpdates(_0x4d5c4a){return function(_0x4404e4){try{jsonpatch[_0xc3fb('0x1d')](_0x4404e4,_0x4d5c4a,!![]);}catch(_0x148182){return BPromise[_0xc3fb('0x1e')](_0x148182);}return _0x4404e4['save']();};}function saveUpdates(_0x3ac2bf,_0x1d8343){return function(_0x44875f){if(_0x44875f){return _0x44875f[_0xc3fb('0x1f')](_0x3ac2bf)[_0xc3fb('0x20')](function(_0x477c01){return _0x477c01;});}return null;};}function removeEntity(_0x39ce75,_0x33629d){return function(_0x5e3b74){if(_0x5e3b74){return _0x5e3b74[_0xc3fb('0x21')]()[_0xc3fb('0x20')](function(){_0x39ce75[_0xc3fb('0x16')](0xcc)[_0xc3fb('0x17')]();});}};}function handleEntityNotFound(_0x58ce8e,_0x24877c){return function(_0xd14b1f){if(!_0xd14b1f){_0x58ce8e[_0xc3fb('0x15')](0x194);}return _0xd14b1f;};}function handleError(_0x3bc686,_0xf4b114){_0xf4b114=_0xf4b114||0x1f4;return function(_0x4edf6d){logger['error'](_0x4edf6d['stack']);if(_0x4edf6d[_0xc3fb('0x22')]){delete _0x4edf6d[_0xc3fb('0x22')];}_0x3bc686['status'](_0xf4b114)[_0xc3fb('0x23')](_0x4edf6d);};}exports[_0xc3fb('0x24')]=function(_0x128d11,_0x3e6b05){var _0x3f20ab={},_0x287ffb={},_0x458dd5={'count':0x0,'rows':[]};var _0x2cf9ef=_[_0xc3fb('0x25')](db['SugarcrmAccount'][_0xc3fb('0x26')],function(_0x36bd9f){return{'name':_0x36bd9f[_0xc3fb('0x27')],'type':_0x36bd9f['type'][_0xc3fb('0x28')]};});_0x287ffb['model']=_[_0xc3fb('0x25')](_0x2cf9ef,_0xc3fb('0x22'));_0x287ffb[_0xc3fb('0x29')]=_[_0xc3fb('0x2a')](_0x128d11[_0xc3fb('0x29')]);_0x287ffb[_0xc3fb('0x2b')]=_[_0xc3fb('0x2c')](_0x287ffb[_0xc3fb('0x2d')],_0x287ffb[_0xc3fb('0x29')]);_0x3f20ab[_0xc3fb('0x2e')]=_[_0xc3fb('0x2c')](_0x287ffb[_0xc3fb('0x2d')],qs[_0xc3fb('0x2f')](_0x128d11['query'][_0xc3fb('0x2f')]));_0x3f20ab['attributes']=_0x3f20ab[_0xc3fb('0x2e')]['length']?_0x3f20ab[_0xc3fb('0x2e')]:_0x287ffb[_0xc3fb('0x2d')];if(!_0x128d11[_0xc3fb('0x29')]['hasOwnProperty'](_0xc3fb('0x30'))){_0x3f20ab['limit']=qs['limit'](_0x128d11['query'][_0xc3fb('0x1b')]);_0x3f20ab[_0xc3fb('0x18')]=qs[_0xc3fb('0x18')](_0x128d11[_0xc3fb('0x29')][_0xc3fb('0x18')]);}_0x3f20ab[_0xc3fb('0x31')]=qs[_0xc3fb('0x32')](_0x128d11['query']['sort']);_0x3f20ab['where']=qs[_0xc3fb('0x2b')](_[_0xc3fb('0x33')](_0x128d11[_0xc3fb('0x29')],_0x287ffb[_0xc3fb('0x2b')]),_0x2cf9ef);if(_0x128d11[_0xc3fb('0x29')][_0xc3fb('0x34')]){_0x3f20ab[_0xc3fb('0x35')]=_[_0xc3fb('0x36')](_0x3f20ab['where'],{'$or':_[_0xc3fb('0x25')](_0x2cf9ef,function(_0x23c60a){if(_0x23c60a[_0xc3fb('0x37')]!==_0xc3fb('0x38')){var _0x886bf9={};_0x886bf9[_0x23c60a[_0xc3fb('0x22')]]={'$like':'%'+_0x128d11[_0xc3fb('0x29')]['filter']+'%'};return _0x886bf9;}})});}_0x3f20ab=_['merge']({},_0x3f20ab,_0x128d11[_0xc3fb('0x39')]);var _0x531f7b={'where':_0x3f20ab[_0xc3fb('0x35')]};return db[_0xc3fb('0x3a')][_0xc3fb('0x1a')](_0x531f7b)['then'](function(_0xba7d2e){_0x458dd5[_0xc3fb('0x1a')]=_0xba7d2e;if(_0x128d11[_0xc3fb('0x29')][_0xc3fb('0x3b')]){_0x3f20ab['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc3fb('0x3c')](_0x3f20ab);})['then'](function(_0x4414ed){_0x458dd5['rows']=_0x4414ed;return _0x458dd5;})[_0xc3fb('0x20')](respondWithFilteredResult(_0x3e6b05,_0x3f20ab))[_0xc3fb('0x3d')](handleError(_0x3e6b05,null));};exports['show']=function(_0x3b1f1c,_0x2f217d){var _0x2c1957={'raw':![],'where':{'id':_0x3b1f1c[_0xc3fb('0x3e')]['id']}},_0x4c3489={};_0x4c3489[_0xc3fb('0x2d')]=_[_0xc3fb('0x2a')](db[_0xc3fb('0x3a')][_0xc3fb('0x26')]);_0x4c3489[_0xc3fb('0x29')]=_[_0xc3fb('0x2a')](_0x3b1f1c[_0xc3fb('0x29')]);_0x4c3489[_0xc3fb('0x2b')]=_[_0xc3fb('0x2c')](_0x4c3489[_0xc3fb('0x2d')],_0x4c3489[_0xc3fb('0x29')]);_0x2c1957[_0xc3fb('0x2e')]=_[_0xc3fb('0x2c')](_0x4c3489[_0xc3fb('0x2d')],qs[_0xc3fb('0x2f')](_0x3b1f1c[_0xc3fb('0x29')][_0xc3fb('0x2f')]));_0x2c1957[_0xc3fb('0x2e')]=_0x2c1957['attributes'][_0xc3fb('0x3f')]?_0x2c1957[_0xc3fb('0x2e')]:_0x4c3489['model'];if(_0x3b1f1c[_0xc3fb('0x29')][_0xc3fb('0x3b')]){_0x2c1957[_0xc3fb('0x40')]=[{'all':!![]}];}_0x2c1957=_[_0xc3fb('0x36')]({},_0x2c1957,_0x3b1f1c[_0xc3fb('0x39')]);return db[_0xc3fb('0x3a')][_0xc3fb('0x41')](_0x2c1957)[_0xc3fb('0x20')](handleEntityNotFound(_0x2f217d,null))[_0xc3fb('0x20')](respondWithResult(_0x2f217d,null))[_0xc3fb('0x3d')](handleError(_0x2f217d,null));};exports['create']=function(_0x1a586e,_0x942306){return db[_0xc3fb('0x3a')][_0xc3fb('0x42')](_0x1a586e[_0xc3fb('0x43')],{})['then'](respondWithResult(_0x942306,0xc9))['catch'](handleError(_0x942306,null));};exports['update']=function(_0x4482f6,_0x91e062){if(_0x4482f6[_0xc3fb('0x43')]['id']){delete _0x4482f6['body']['id'];}return db[_0xc3fb('0x3a')][_0xc3fb('0x41')]({'where':{'id':_0x4482f6[_0xc3fb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x91e062,null))[_0xc3fb('0x20')](saveUpdates(_0x4482f6[_0xc3fb('0x43')],null))[_0xc3fb('0x20')](respondWithResult(_0x91e062,null))[_0xc3fb('0x3d')](handleError(_0x91e062,null));};exports[_0xc3fb('0x21')]=function(_0x57b74e,_0x2708ce){return db[_0xc3fb('0x3a')][_0xc3fb('0x41')]({'where':{'id':_0x57b74e[_0xc3fb('0x3e')]['id']}})[_0xc3fb('0x20')](handleEntityNotFound(_0x2708ce,null))[_0xc3fb('0x20')](removeEntity(_0x2708ce,null))[_0xc3fb('0x3d')](handleError(_0x2708ce,null));};exports[_0xc3fb('0x44')]=function(_0x5b77f6,_0x4c042c,_0x146b61){var _0xc2911e={};var _0x54af77={};var _0x173c1f;var _0x4c00ad;return db[_0xc3fb('0x3a')][_0xc3fb('0x45')]({'where':{'id':_0x5b77f6[_0xc3fb('0x3e')]['id']}})[_0xc3fb('0x20')](handleEntityNotFound(_0x4c042c,null))['then'](function(_0x497ba9){if(_0x497ba9){_0x173c1f=_0x497ba9;_0x54af77[_0xc3fb('0x2d')]=_[_0xc3fb('0x2a')](db[_0xc3fb('0x46')][_0xc3fb('0x26')]);_0x54af77['query']=_[_0xc3fb('0x2a')](_0x5b77f6[_0xc3fb('0x29')]);_0x54af77[_0xc3fb('0x2b')]=_[_0xc3fb('0x2c')](_0x54af77[_0xc3fb('0x2d')],_0x54af77[_0xc3fb('0x29')]);_0xc2911e[_0xc3fb('0x2e')]=_[_0xc3fb('0x2c')](_0x54af77['model'],qs[_0xc3fb('0x2f')](_0x5b77f6['query'][_0xc3fb('0x2f')]));_0xc2911e[_0xc3fb('0x2e')]=_0xc2911e[_0xc3fb('0x2e')][_0xc3fb('0x3f')]?_0xc2911e[_0xc3fb('0x2e')]:_0x54af77[_0xc3fb('0x2d')];_0xc2911e['order']=qs['sort'](_0x5b77f6[_0xc3fb('0x29')][_0xc3fb('0x32')]);_0xc2911e[_0xc3fb('0x35')]=qs[_0xc3fb('0x2b')](_[_0xc3fb('0x33')](_0x5b77f6[_0xc3fb('0x29')],_0x54af77[_0xc3fb('0x2b')]));if(_0x5b77f6['query']['filter']){_0xc2911e[_0xc3fb('0x35')]=_[_0xc3fb('0x36')](_0xc2911e['where'],{'$or':_[_0xc3fb('0x25')](_0xc2911e[_0xc3fb('0x2e')],function(_0x2883f1){var _0x97a879={};_0x97a879[_0x2883f1]={'$like':'%'+_0x5b77f6[_0xc3fb('0x29')][_0xc3fb('0x34')]+'%'};return _0x97a879;})});}_0xc2911e=_[_0xc3fb('0x36')]({},_0xc2911e,_0x5b77f6[_0xc3fb('0x39')]);return _0x173c1f[_0xc3fb('0x44')](_0xc2911e);}})[_0xc3fb('0x20')](function(_0x35e81a){if(_0x35e81a){_0x4c00ad=_0x35e81a['length'];if(!_0x5b77f6[_0xc3fb('0x29')][_0xc3fb('0x47')](_0xc3fb('0x30'))){_0xc2911e[_0xc3fb('0x1b')]=qs['limit'](_0x5b77f6[_0xc3fb('0x29')][_0xc3fb('0x1b')]);_0xc2911e['offset']=qs[_0xc3fb('0x18')](_0x5b77f6[_0xc3fb('0x29')][_0xc3fb('0x18')]);}return _0x173c1f[_0xc3fb('0x44')](_0xc2911e);}})[_0xc3fb('0x20')](function(_0x3ce404){if(_0x3ce404){return _0x3ce404?{'count':_0x4c00ad,'rows':_0x3ce404}:null;}})['then'](respondWithResult(_0x4c042c,null))[_0xc3fb('0x3d')](handleError(_0x4c042c,null));};exports[_0xc3fb('0x48')]=function(_0x4ec47d,_0x255ae1,_0x36a30c){if(_0x4ec47d[_0xc3fb('0x43')]['id']){delete _0x4ec47d[_0xc3fb('0x43')]['id'];}return db['SugarcrmAccount'][_0xc3fb('0x45')]({'where':{'id':_0x4ec47d[_0xc3fb('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255ae1,null))[_0xc3fb('0x20')](function(_0x3d513b){if(_0x3d513b){_0x4ec47d['body'][_0xc3fb('0x49')]=_0x3d513b['id'];_0x4ec47d['body'][_0xc3fb('0x4a')]=integrations[_0xc3fb('0x4b')](_0x4ec47d['body'][_0xc3fb('0x4c')],_0x4ec47d[_0xc3fb('0x43')][_0xc3fb('0x37')]);_0x4ec47d[_0xc3fb('0x43')][_0xc3fb('0x4d')]=integrations[_0xc3fb('0x4e')](_0x4ec47d[_0xc3fb('0x43')][_0xc3fb('0x4c')],_0x4ec47d[_0xc3fb('0x43')][_0xc3fb('0x37')]);return db[_0xc3fb('0x46')][_0xc3fb('0x42')](_0x4ec47d[_0xc3fb('0x43')],{'include':[{'model':db[_0xc3fb('0x4f')],'as':'Subjects'},{'model':db[_0xc3fb('0x4f')],'as':_0xc3fb('0x4d')}]});}return null;})[_0xc3fb('0x20')](respondWithResult(_0x255ae1,null))[_0xc3fb('0x3d')](handleError(_0x255ae1,null));};exports[_0xc3fb('0x50')]=function(_0x337062,_0x33ac02,_0x1ef420){var _0x3feaed='';var _0x49362c=['id',_0xc3fb('0x22'),'assigned_user_id',_0xc3fb('0x51'),_0xc3fb('0x52'),_0xc3fb('0x53'),_0xc3fb('0x54'),'duration_minutes',_0xc3fb('0x55'),_0xc3fb('0x56'),_0xc3fb('0x57'),_0xc3fb('0x58')];return db[_0xc3fb('0x3a')][_0xc3fb('0x45')]({'where':{'id':_0x337062['params']['id']},'attributes':['id',_0xc3fb('0x59'),_0xc3fb('0x5a'),_0xc3fb('0x5b')]})['then'](handleEntityNotFound(_0x33ac02,null))['then'](function(_0x266d19){if(_0x266d19){_0x3feaed=_0x266d19[_0xc3fb('0x5b')];var _0x526e87=_0x3feaed[_0xc3fb('0x5c')](-0x1);if(_0x526e87==='/'){_0x3feaed=_0x3feaed['substring'](0x0,_0x3feaed[_0xc3fb('0x5d')](_0x526e87));}return rp({'method':_0xc3fb('0x5e'),'uri':util[_0xc3fb('0x5f')](_0xc3fb('0x60'),_0x3feaed,_0xc3fb('0x61')),'json':!![],'form':{'method':_0xc3fb('0x62'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x266d19[_0xc3fb('0x59')],'password':_0x266d19['password'],'encryption':_0xc3fb('0x63')},'application':_0xc3fb('0x64')})}});}})[_0xc3fb('0x20')](function(_0x34ba56){if(_0x34ba56&&_0x34ba56['name']!==_0xc3fb('0x65')&&_0x34ba56[_0xc3fb('0x22')]!==_0xc3fb('0x66')){return rp({'method':_0xc3fb('0x5e'),'uri':util[_0xc3fb('0x5f')]('%s%s',_0x3feaed,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0xc3fb('0x67'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x34ba56['id'],'module_name':_0xc3fb('0x68')})}})[_0xc3fb('0x20')](function(_0xff281a){if(_0xff281a){var _0x1f5994=_[_0xc3fb('0x69')](_0xff281a['module_fields']);_['remove'](_0x1f5994,function(_0x4a4a67){return _0x49362c[_0xc3fb('0x6a')](_0x4a4a67[_0xc3fb('0x22')]);});return{'count':_0x1f5994['length'],'rows':_[_0xc3fb('0x25')](_0x1f5994,function(_0x1dacc7){return{'id':_0x1dacc7['name'],'name':_0x1dacc7[_0xc3fb('0x6b')],'custom':_[_0xc3fb('0x6c')](_0x1dacc7[_0xc3fb('0x22')],'_c')?!![]:![],'options':_0x1dacc7[_0xc3fb('0x39')]?_['map'](_[_0xc3fb('0x69')](_0x1dacc7[_0xc3fb('0x39')]),function(_0x271e69){return{'name':_0x271e69[_0xc3fb('0x6d')],'value':_0x271e69['name']};}):[]};})};}})[_0xc3fb('0x20')](respondWithResult(_0x33ac02,null))[_0xc3fb('0x3d')](function(_0x225393){var _0x3b88e3=_0x337062[_0xc3fb('0x29')]['test']?0x1f4:_0x225393[_0xc3fb('0x6e')]||0x1f4;logger[_0xc3fb('0x6f')](_0xc3fb('0x70'),_0xc3fb('0x50'),_0x3b88e3,JSON[_0xc3fb('0x71')](_0x225393));delete _0x225393[_0xc3fb('0x22')];if(_0x3b88e3===0x191){_0x3b88e3=0x190;}_0x33ac02['status'](_0x3b88e3)[_0xc3fb('0x23')](_0x337062['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x225393[_0xc3fb('0x6e')]}:_0x225393);});}else{var _0x283674=0x1f4;_0x33ac02[_0xc3fb('0x16')](_0x283674)[_0xc3fb('0x23')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 7ca9eb1..6fd7c36 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 _0x1267=['int_sugarcrm_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define'];(function(_0x2e50f1,_0x4b3469){var _0x42ac15=function(_0x32c440){while(--_0x32c440){_0x2e50f1['push'](_0x2e50f1['shift']());}};_0x42ac15(++_0x4b3469);}(_0x1267,0xb5));var _0x7126=function(_0x18c428,_0x17f370){_0x18c428=_0x18c428-0x0;var _0x62fb76=_0x1267[_0x18c428];return _0x62fb76;};'use strict';var _=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7126('0x2'));var BPromise=require(_0x7126('0x3'));var rp=require(_0x7126('0x4'));var fs=require('fs');var path=require(_0x7126('0x5'));var rimraf=require(_0x7126('0x6'));var config=require(_0x7126('0x7'));var attributes=require(_0x7126('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x7126('0x9')]=function(_0x3fe051,_0x5175bf){return _0x3fe051[_0x7126('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x7126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e3e=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x3c9769,_0x4aa623){var _0x10fb5c=function(_0x18cb5f){while(--_0x18cb5f){_0x3c9769['push'](_0x3c9769['shift']());}};_0x10fb5c(++_0x4aa623);}(_0x0e3e,0x143));var _0xe0e3=function(_0x497244,_0x17be84){_0x497244=_0x497244-0x0;var _0x890925=_0x0e3e[_0x497244];return _0x890925;};'use strict';var _=require(_0xe0e3('0x0'));var util=require(_0xe0e3('0x1'));var logger=require(_0xe0e3('0x2'))(_0xe0e3('0x3'));var moment=require(_0xe0e3('0x4'));var BPromise=require(_0xe0e3('0x5'));var rp=require(_0xe0e3('0x6'));var fs=require('fs');var path=require(_0xe0e3('0x7'));var rimraf=require('rimraf');var config=require(_0xe0e3('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xe0e3('0x9'));module[_0xe0e3('0xa')]=function(_0x1011fb,_0x911c8b){return _0x1011fb[_0xe0e3('0xb')](_0xe0e3('0xc'),attributes,{'tableName':_0xe0e3('0xd'),'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 bddd4ab..31912da 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 _0xabaf=['attributes','include','map','model','debug','find','raw','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xabaf,0x7e));var _0xfaba=function(_0x13be3a,_0x9e14ec){_0x13be3a=_0x13be3a-0x0;var _0x41d6e2=_0xabaf[_0x13be3a];return _0x41d6e2;};'use strict';var _=require(_0xfaba('0x0'));var util=require(_0xfaba('0x1'));var moment=require(_0xfaba('0x2'));var BPromise=require(_0xfaba('0x3'));var rs=require(_0xfaba('0x4'));var fs=require('fs');var Redis=require(_0xfaba('0x5'));var db=require(_0xfaba('0x6'))['db'];var utils=require(_0xfaba('0x7'));var logger=require(_0xfaba('0x8'))(_0xfaba('0x9'));var config=require(_0xfaba('0xa'));var jayson=require(_0xfaba('0xb'));var client=jayson[_0xfaba('0xc')][_0xfaba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x379b54,_0x1928b0,_0x1550ee){return new BPromise(function(_0x4d9e51,_0x453e58){return client[_0xfaba('0xe')](_0x379b54,_0x1550ee)[_0xfaba('0xf')](function(_0x54993d){logger[_0xfaba('0x10')](_0xfaba('0x11'),_0x1928b0,_0xfaba('0x12'));logger['debug'](_0xfaba('0x13'),_0x1928b0,_0xfaba('0x12'),JSON[_0xfaba('0x14')](_0x54993d));if(_0x54993d[_0xfaba('0x15')]){if(_0x54993d[_0xfaba('0x15')][_0xfaba('0x16')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x1928b0,_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);return _0x453e58(_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);}logger[_0xfaba('0x15')](_0xfaba('0x11'),_0x1928b0,_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);return _0x4d9e51(_0x54993d[_0xfaba('0x15')][_0xfaba('0x17')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1928b0,_0xfaba('0x12'));_0x4d9e51(_0x54993d[_0xfaba('0x18')]['message']);}})[_0xfaba('0x19')](function(_0x1810e7){logger['error'](_0xfaba('0x11'),_0x1928b0,_0x1810e7);_0x453e58(_0x1810e7);});});}exports[_0xfaba('0x1a')]=function(_0x15a4f1){var _0x34bf85=this;return new Promise(function(_0x472239,_0x2c9d74){return db[_0xfaba('0x1b')][_0xfaba('0x1c')]({'raw':_0x15a4f1['options']?_0x15a4f1[_0xfaba('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x15a4f1['options']?_0x15a4f1[_0xfaba('0x1d')]['where']||null:null,'attributes':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1e')]||null:null,'limit':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1['options']['limit']||null:null,'include':_0x15a4f1[_0xfaba('0x1d')]?_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1f')]?_[_0xfaba('0x20')](_0x15a4f1[_0xfaba('0x1d')][_0xfaba('0x1f')],function(_0x3b7eb1){return{'model':db[_0x3b7eb1[_0xfaba('0x21')]],'as':_0x3b7eb1['as'],'attributes':_0x3b7eb1[_0xfaba('0x1e')],'include':_0x3b7eb1[_0xfaba('0x1f')]?_[_0xfaba('0x20')](_0x3b7eb1[_0xfaba('0x1f')],function(_0x789f5d){return{'model':db[_0x789f5d[_0xfaba('0x21')]],'as':_0x789f5d['as'],'attributes':_0x789f5d[_0xfaba('0x1e')],'include':_0x789f5d['include']?_[_0xfaba('0x20')](_0x789f5d[_0xfaba('0x1f')],function(_0x379cec){return{'model':db[_0x379cec[_0xfaba('0x21')]],'as':_0x379cec['as'],'attributes':_0x379cec[_0xfaba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfaba('0xf')](function(_0x20bbd3){logger[_0xfaba('0x10')](_0xfaba('0x1a'),_0x15a4f1);logger[_0xfaba('0x22')](_0xfaba('0x1a'),_0x15a4f1,JSON[_0xfaba('0x14')](_0x20bbd3));_0x472239(_0x20bbd3);})[_0xfaba('0x19')](function(_0x444b3c){logger['error'](_0xfaba('0x1a'),_0x444b3c['message'],_0x15a4f1);_0x2c9d74(_0x34bf85['error'](0x1f4,_0x444b3c[_0xfaba('0x17')]));});});};exports['ShowSugarcrmAccount']=function(_0x2869cf){var _0x4df080=this;return new Promise(function(_0x9cdb78,_0x58bdb3){return db['SugarcrmAccount'][_0xfaba('0x23')]({'raw':_0x2869cf[_0xfaba('0x1d')]?_0x2869cf['options'][_0xfaba('0x24')]===undefined?!![]:![]:!![],'where':_0x2869cf['options']?_0x2869cf['options'][_0xfaba('0x25')]||null:null,'attributes':_0x2869cf[_0xfaba('0x1d')]?_0x2869cf[_0xfaba('0x1d')]['attributes']||null:null,'include':_0x2869cf['options']?_0x2869cf[_0xfaba('0x1d')][_0xfaba('0x1f')]?_['map'](_0x2869cf[_0xfaba('0x1d')]['include'],function(_0x602df9){return{'model':db[_0x602df9[_0xfaba('0x21')]],'as':_0x602df9['as'],'attributes':_0x602df9['attributes'],'include':_0x602df9['include']?_['map'](_0x602df9[_0xfaba('0x1f')],function(_0x23edb5){return{'model':db[_0x23edb5[_0xfaba('0x21')]],'as':_0x23edb5['as'],'attributes':_0x23edb5[_0xfaba('0x1e')],'include':_0x23edb5[_0xfaba('0x1f')]?_['map'](_0x23edb5['include'],function(_0x5d3cdf){return{'model':db[_0x5d3cdf['model']],'as':_0x5d3cdf['as'],'attributes':_0x5d3cdf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x314f4b){logger['info'](_0xfaba('0x26'),_0x2869cf);logger[_0xfaba('0x22')](_0xfaba('0x26'),_0x2869cf,JSON[_0xfaba('0x14')](_0x314f4b));_0x9cdb78(_0x314f4b);})[_0xfaba('0x19')](function(_0x169a81){logger['error'](_0xfaba('0x26'),_0x169a81['message'],_0x2869cf);_0x58bdb3(_0x4df080[_0xfaba('0x15')](0x1f4,_0x169a81['message']));});});}; \ No newline at end of file +var _0xa68c=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetSugarcrmAccount','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x524c2e,_0x165d16){var _0x4ce75d=function(_0x568b83){while(--_0x568b83){_0x524c2e['push'](_0x524c2e['shift']());}};_0x4ce75d(++_0x165d16);}(_0xa68c,0x96));var _0xca68=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa68c[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var moment=require('moment');var BPromise=require(_0xca68('0x2'));var rs=require(_0xca68('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca68('0x4'))['db'];var utils=require(_0xca68('0x5'));var logger=require(_0xca68('0x6'))(_0xca68('0x7'));var config=require('../../config/environment');var jayson=require(_0xca68('0x8'));var client=jayson[_0xca68('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5873f5,_0x4ff44b,_0x2a25a0){return new BPromise(function(_0x4ef8b3,_0x1032ce){return client[_0xca68('0xa')](_0x5873f5,_0x2a25a0)[_0xca68('0xb')](function(_0x57454a){logger[_0xca68('0xc')](_0xca68('0xd'),_0x4ff44b,'request\x20sent');logger[_0xca68('0xe')](_0xca68('0xf'),_0x4ff44b,'request\x20sent',JSON[_0xca68('0x10')](_0x57454a));if(_0x57454a[_0xca68('0x11')]){if(_0x57454a[_0xca68('0x11')][_0xca68('0x12')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4ff44b,_0x57454a[_0xca68('0x11')]['message']);return _0x1032ce(_0x57454a[_0xca68('0x11')][_0xca68('0x13')]);}logger[_0xca68('0x11')](_0xca68('0xd'),_0x4ff44b,_0x57454a[_0xca68('0x11')]['message']);return _0x4ef8b3(_0x57454a[_0xca68('0x11')][_0xca68('0x13')]);}else{logger[_0xca68('0xc')](_0xca68('0xd'),_0x4ff44b,_0xca68('0x14'));_0x4ef8b3(_0x57454a[_0xca68('0x15')][_0xca68('0x13')]);}})[_0xca68('0x16')](function(_0x385922){logger[_0xca68('0x11')](_0xca68('0xd'),_0x4ff44b,_0x385922);_0x1032ce(_0x385922);});});}exports[_0xca68('0x17')]=function(_0x175de1){var _0x2ec220=this;return new Promise(function(_0x389de7,_0x18d5f7){return db['SugarcrmAccount']['findAll']({'raw':_0x175de1[_0xca68('0x18')]?_0x175de1[_0xca68('0x18')][_0xca68('0x19')]===undefined?!![]:![]:!![],'where':_0x175de1[_0xca68('0x18')]?_0x175de1[_0xca68('0x18')]['where']||null:null,'attributes':_0x175de1[_0xca68('0x18')]?_0x175de1['options'][_0xca68('0x1a')]||null:null,'limit':_0x175de1['options']?_0x175de1[_0xca68('0x18')][_0xca68('0x1b')]||null:null,'include':_0x175de1[_0xca68('0x18')]?_0x175de1['options'][_0xca68('0x1c')]?_[_0xca68('0x1d')](_0x175de1[_0xca68('0x18')][_0xca68('0x1c')],function(_0x3237e0){return{'model':db[_0x3237e0['model']],'as':_0x3237e0['as'],'attributes':_0x3237e0[_0xca68('0x1a')],'include':_0x3237e0[_0xca68('0x1c')]?_[_0xca68('0x1d')](_0x3237e0[_0xca68('0x1c')],function(_0x397e7f){return{'model':db[_0x397e7f['model']],'as':_0x397e7f['as'],'attributes':_0x397e7f[_0xca68('0x1a')],'include':_0x397e7f[_0xca68('0x1c')]?_[_0xca68('0x1d')](_0x397e7f['include'],function(_0x215730){return{'model':db[_0x215730[_0xca68('0x1e')]],'as':_0x215730['as'],'attributes':_0x215730[_0xca68('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xca68('0xb')](function(_0x3a9510){logger[_0xca68('0xc')](_0xca68('0x17'),_0x175de1);logger[_0xca68('0xe')](_0xca68('0x17'),_0x175de1,JSON[_0xca68('0x10')](_0x3a9510));_0x389de7(_0x3a9510);})[_0xca68('0x16')](function(_0x3f88b3){logger[_0xca68('0x11')](_0xca68('0x17'),_0x3f88b3[_0xca68('0x13')],_0x175de1);_0x18d5f7(_0x2ec220[_0xca68('0x11')](0x1f4,_0x3f88b3[_0xca68('0x13')]));});});};exports[_0xca68('0x1f')]=function(_0x11e711){var _0x1ecf2f=this;return new Promise(function(_0x2b1249,_0x1a1722){return db['SugarcrmAccount']['find']({'raw':_0x11e711[_0xca68('0x18')]?_0x11e711['options']['raw']===undefined?!![]:![]:!![],'where':_0x11e711[_0xca68('0x18')]?_0x11e711[_0xca68('0x18')]['where']||null:null,'attributes':_0x11e711['options']?_0x11e711[_0xca68('0x18')][_0xca68('0x1a')]||null:null,'include':_0x11e711['options']?_0x11e711[_0xca68('0x18')][_0xca68('0x1c')]?_[_0xca68('0x1d')](_0x11e711[_0xca68('0x18')][_0xca68('0x1c')],function(_0x4c3442){return{'model':db[_0x4c3442[_0xca68('0x1e')]],'as':_0x4c3442['as'],'attributes':_0x4c3442[_0xca68('0x1a')],'include':_0x4c3442[_0xca68('0x1c')]?_['map'](_0x4c3442[_0xca68('0x1c')],function(_0x3af489){return{'model':db[_0x3af489['model']],'as':_0x3af489['as'],'attributes':_0x3af489[_0xca68('0x1a')],'include':_0x3af489['include']?_[_0xca68('0x1d')](_0x3af489[_0xca68('0x1c')],function(_0x19432a){return{'model':db[_0x19432a['model']],'as':_0x19432a['as'],'attributes':_0x19432a['attributes']};}):[]};}):[]};}):[]:[]})[_0xca68('0xb')](function(_0x17ebec){logger[_0xca68('0xc')](_0xca68('0x1f'),_0x11e711);logger[_0xca68('0xe')](_0xca68('0x1f'),_0x11e711,JSON[_0xca68('0x10')](_0x17ebec));_0x2b1249(_0x17ebec);})[_0xca68('0x16')](function(_0x3053ee){logger['error'](_0xca68('0x1f'),_0x3053ee[_0xca68('0x13')],_0x11e711);_0x1a1722(_0x1ecf2f[_0xca68('0x11')](0x1f4,_0x3053ee['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index fcf7021..56fc2c0 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 _0xbd0b=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','update','delete','exports','multer'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xbd0b,0xbc));var _0xbbd0=function(_0x3f1b6c,_0x3579ca){_0x3f1b6c=_0x3f1b6c-0x0;var _0x3a1460=_0xbd0b[_0x3f1b6c];return _0x3a1460;};'use strict';var multer=require(_0xbbd0('0x0'));var util=require(_0xbbd0('0x1'));var path=require('path');var timeout=require(_0xbbd0('0x2'));var express=require('express');var router=express[_0xbbd0('0x3')]();var fs_extra=require(_0xbbd0('0x4'));var auth=require(_0xbbd0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd0('0x6'));var controller=require(_0xbbd0('0x7'));router[_0xbbd0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbbd0('0x8')]('/:id',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xa')]);router[_0xbbd0('0x8')](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller['getFields']);router[_0xbbd0('0x8')](_0xbbd0('0xc'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xd')]);router[_0xbbd0('0x8')]('/:id/descriptions',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xe')]);router[_0xbbd0('0xf')]('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0x10')]);router['put'](_0xbbd0('0x11'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0x12')]);router[_0xbbd0('0x13')](_0xbbd0('0x11'),auth[_0xbbd0('0x9')](),controller['destroy']);module[_0xbbd0('0x14')]=router; \ No newline at end of file +var _0x3fc0=['path','connect-timeout','express','Router','fs-extra','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','destroy','multer','util'];(function(_0x13659a,_0x41453c){var _0x4b1c49=function(_0x270c47){while(--_0x270c47){_0x13659a['push'](_0x13659a['shift']());}};_0x4b1c49(++_0x41453c);}(_0x3fc0,0xe4));var _0x03fc=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x3fc0[_0x3b90ab];return _0x206e92;};'use strict';var multer=require(_0x03fc('0x0'));var util=require(_0x03fc('0x1'));var path=require(_0x03fc('0x2'));var timeout=require(_0x03fc('0x3'));var express=require(_0x03fc('0x4'));var router=express[_0x03fc('0x5')]();var fs_extra=require(_0x03fc('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x03fc('0x7'));router[_0x03fc('0x8')]('/',auth[_0x03fc('0x9')](),controller[_0x03fc('0xa')]);router[_0x03fc('0x8')]('/:id',auth[_0x03fc('0x9')](),controller[_0x03fc('0xb')]);router[_0x03fc('0x8')](_0x03fc('0xc'),auth[_0x03fc('0x9')](),controller[_0x03fc('0xd')]);router['get'](_0x03fc('0xe'),auth[_0x03fc('0x9')](),controller[_0x03fc('0xf')]);router[_0x03fc('0x8')](_0x03fc('0x10'),auth[_0x03fc('0x9')](),controller[_0x03fc('0x11')]);router['post']('/',auth[_0x03fc('0x9')](),controller[_0x03fc('0x12')]);router[_0x03fc('0x13')](_0x03fc('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x03fc('0x15')](_0x03fc('0x14'),auth[_0x03fc('0x9')](),controller[_0x03fc('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 84d5f02..48ba4a1 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 _0xe9af=['sequelize','exports','STRING'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xe9af,0x1a4));var _0xfe9a=function(_0x171ea9,_0x3814d1){_0x171ea9=_0x171ea9-0x0;var _0x4a5985=_0xe9af[_0x171ea9];return _0x4a5985;};'use strict';var Sequelize=require(_0xfe9a('0x0'));module[_0xfe9a('0x1')]={'name':{'type':Sequelize[_0xfe9a('0x2')]},'description':{'type':Sequelize[_0xfe9a('0x2')]}}; \ No newline at end of file +var _0x802a=['exports','STRING','sequelize'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x802a,0x1a3));var _0xa802=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0x802a[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0xa802('0x0'));module[_0xa802('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa802('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b6eafd5..9a9e1a7 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 _0x2e37=['fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','apply','reject','save','update','then','destroy','end','error','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e37,0x1d6));var _0x72e3=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x2e37[_0x2d982d];return _0x4f36b0;};'use strict';var emlformat=require(_0x72e3('0x0'));var rimraf=require(_0x72e3('0x1'));var zipdir=require(_0x72e3('0x2'));var jsonpatch=require(_0x72e3('0x3'));var rp=require(_0x72e3('0x4'));var moment=require(_0x72e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72e3('0x6'));var util=require(_0x72e3('0x7'));var path=require(_0x72e3('0x8'));var sox=require('sox');var csv=require(_0x72e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72e3('0xa'));var _=require('lodash');var squel=require(_0x72e3('0xb'));var crypto=require(_0x72e3('0xc'));var jsforce=require(_0x72e3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x72e3('0x9'));var querystring=require(_0x72e3('0xe'));var Papa=require('papaparse');var Redis=require(_0x72e3('0xf'));var authService=require(_0x72e3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x72e3('0x11'));var hardwareService=require(_0x72e3('0x12'));var logger=require(_0x72e3('0x13'))('api');var utils=require(_0x72e3('0x14'));var config=require(_0x72e3('0x15'));var licenseUtil=require(_0x72e3('0x16'));var db=require(_0x72e3('0x17'))['db'];function respondWithStatusCode(_0x58d576,_0x3b1410){_0x3b1410=_0x3b1410||0xcc;return function(_0x758d05){if(_0x758d05){return _0x58d576[_0x72e3('0x18')](_0x3b1410);}return _0x58d576['status'](_0x3b1410)['end']();};}function respondWithResult(_0x16cd94,_0x16b9ad){_0x16b9ad=_0x16b9ad||0xc8;return function(_0xbc0d4){if(_0xbc0d4){return _0x16cd94['status'](_0x16b9ad)[_0x72e3('0x19')](_0xbc0d4);}};}function respondWithFilteredResult(_0x289702,_0x5463e5){return function(_0x21e5cb){if(_0x21e5cb){var _0x4e75dc=typeof _0x5463e5[_0x72e3('0x1a')]==='undefined'&&typeof _0x5463e5[_0x72e3('0x1b')]===_0x72e3('0x1c');var _0x527f07=_0x21e5cb[_0x72e3('0x1d')];var _0x1e1cf5=_0x4e75dc?0x0:_0x5463e5[_0x72e3('0x1a')];var _0x584b26=_0x4e75dc?_0x21e5cb['count']:_0x5463e5['offset']+_0x5463e5['limit'];var _0x4adf76;if(_0x584b26>=_0x527f07){_0x584b26=_0x527f07;_0x4adf76=0xc8;}else{_0x4adf76=0xce;}_0x289702[_0x72e3('0x1e')](_0x4adf76);return _0x289702['set']('Content-Range',_0x1e1cf5+'-'+_0x584b26+'/'+_0x527f07)[_0x72e3('0x19')](_0x21e5cb);}return null;};}function patchUpdates(_0x153247){return function(_0x1bcded){try{jsonpatch[_0x72e3('0x1f')](_0x1bcded,_0x153247,!![]);}catch(_0x2ab13e){return BPromise[_0x72e3('0x20')](_0x2ab13e);}return _0x1bcded[_0x72e3('0x21')]();};}function saveUpdates(_0x57072d,_0x52d6ee){return function(_0x2f32a2){if(_0x2f32a2){return _0x2f32a2[_0x72e3('0x22')](_0x57072d)[_0x72e3('0x23')](function(_0x3af56a){return _0x3af56a;});}return null;};}function removeEntity(_0x20c8b0,_0x36cfb9){return function(_0x5c4861){if(_0x5c4861){return _0x5c4861[_0x72e3('0x24')]()[_0x72e3('0x23')](function(){_0x20c8b0[_0x72e3('0x1e')](0xcc)[_0x72e3('0x25')]();});}};}function handleEntityNotFound(_0x286ddf,_0x2145df){return function(_0x20933f){if(!_0x20933f){_0x286ddf[_0x72e3('0x18')](0x194);}return _0x20933f;};}function handleError(_0x476098,_0x408d17){_0x408d17=_0x408d17||0x1f4;return function(_0x445b05){logger[_0x72e3('0x26')](_0x445b05['stack']);if(_0x445b05[_0x72e3('0x27')]){delete _0x445b05[_0x72e3('0x27')];}_0x476098[_0x72e3('0x1e')](_0x408d17)[_0x72e3('0x28')](_0x445b05);};}exports[_0x72e3('0x29')]=function(_0x11fe21,_0x5b6cc1){var _0x5c4c0a={},_0x77a0c7={},_0x15a134={'count':0x0,'rows':[]};var _0x3c8f1c=_['map'](db[_0x72e3('0x2a')][_0x72e3('0x2b')],function(_0xdde5a4){return{'name':_0xdde5a4[_0x72e3('0x2c')],'type':_0xdde5a4[_0x72e3('0x2d')]['key']};});_0x77a0c7[_0x72e3('0x2e')]=_[_0x72e3('0x2f')](_0x3c8f1c,'name');_0x77a0c7[_0x72e3('0x30')]=_['keys'](_0x11fe21[_0x72e3('0x30')]);_0x77a0c7[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x77a0c7[_0x72e3('0x2e')],_0x77a0c7['query']);_0x5c4c0a['attributes']=_['intersection'](_0x77a0c7[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0x11fe21[_0x72e3('0x30')]['fields']));_0x5c4c0a[_0x72e3('0x34')]=_0x5c4c0a['attributes']['length']?_0x5c4c0a[_0x72e3('0x34')]:_0x77a0c7['model'];if(!_0x11fe21[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x5c4c0a['limit']=qs[_0x72e3('0x1b')](_0x11fe21[_0x72e3('0x30')][_0x72e3('0x1b')]);_0x5c4c0a[_0x72e3('0x1a')]=qs[_0x72e3('0x1a')](_0x11fe21['query']['offset']);}_0x5c4c0a[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x11fe21[_0x72e3('0x30')][_0x72e3('0x38')]);_0x5c4c0a['where']=qs['filters'](_[_0x72e3('0x39')](_0x11fe21[_0x72e3('0x30')],_0x77a0c7['filters']),_0x3c8f1c);if(_0x11fe21[_0x72e3('0x30')]['filter']){_0x5c4c0a[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x5c4c0a['where'],{'$or':_[_0x72e3('0x2f')](_0x3c8f1c,function(_0x3c83ca){if(_0x3c83ca['type']!==_0x72e3('0x3c')){var _0x5ba2ac={};_0x5ba2ac[_0x3c83ca['name']]={'$like':'%'+_0x11fe21['query'][_0x72e3('0x3d')]+'%'};return _0x5ba2ac;}})});}_0x5c4c0a=_[_0x72e3('0x3b')]({},_0x5c4c0a,_0x11fe21[_0x72e3('0x3e')]);var _0x807657={'where':_0x5c4c0a[_0x72e3('0x3a')]};return db[_0x72e3('0x2a')][_0x72e3('0x1d')](_0x807657)[_0x72e3('0x23')](function(_0x3400e6){_0x15a134[_0x72e3('0x1d')]=_0x3400e6;if(_0x11fe21[_0x72e3('0x30')]['includeAll']){_0x5c4c0a['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x72e3('0x3f')](_0x5c4c0a);})['then'](function(_0x18523f){_0x15a134[_0x72e3('0x40')]=_0x18523f;return _0x15a134;})[_0x72e3('0x23')](respondWithFilteredResult(_0x5b6cc1,_0x5c4c0a))[_0x72e3('0x41')](handleError(_0x5b6cc1,null));};exports[_0x72e3('0x42')]=function(_0x22d9df,_0x211973){var _0x376667={'raw':![],'where':{'id':_0x22d9df[_0x72e3('0x43')]['id']}},_0x5c075b={};_0x5c075b[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db[_0x72e3('0x2a')][_0x72e3('0x2b')]);_0x5c075b[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x22d9df[_0x72e3('0x30')]);_0x5c075b[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x5c075b[_0x72e3('0x2e')],_0x5c075b[_0x72e3('0x30')]);_0x376667['attributes']=_[_0x72e3('0x32')](_0x5c075b[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0x22d9df[_0x72e3('0x30')][_0x72e3('0x33')]));_0x376667[_0x72e3('0x34')]=_0x376667[_0x72e3('0x34')][_0x72e3('0x45')]?_0x376667['attributes']:_0x5c075b[_0x72e3('0x2e')];if(_0x22d9df[_0x72e3('0x30')][_0x72e3('0x46')]){_0x376667[_0x72e3('0x47')]=[{'all':!![]}];}_0x376667=_[_0x72e3('0x3b')]({},_0x376667,_0x22d9df[_0x72e3('0x3e')]);return db[_0x72e3('0x2a')][_0x72e3('0x48')](_0x376667)[_0x72e3('0x23')](handleEntityNotFound(_0x211973,null))[_0x72e3('0x23')](respondWithResult(_0x211973,null))['catch'](handleError(_0x211973,null));};exports['create']=function(_0x493533,_0xb3cf14){return db[_0x72e3('0x2a')][_0x72e3('0x49')](_0x493533[_0x72e3('0x4a')],{})[_0x72e3('0x23')](respondWithResult(_0xb3cf14,0xc9))['catch'](handleError(_0xb3cf14,null));};exports[_0x72e3('0x22')]=function(_0x518289,_0x460f3b){if(_0x518289[_0x72e3('0x4a')]['id']){delete _0x518289[_0x72e3('0x4a')]['id'];}return db[_0x72e3('0x2a')]['find']({'where':{'id':_0x518289[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x460f3b,null))[_0x72e3('0x23')](saveUpdates(_0x518289[_0x72e3('0x4a')],null))['then'](respondWithResult(_0x460f3b,null))['catch'](handleError(_0x460f3b,null));};exports[_0x72e3('0x24')]=function(_0x1f7e9d,_0x435467){return db['SugarcrmConfiguration'][_0x72e3('0x48')]({'where':{'id':_0x1f7e9d[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x435467,null))[_0x72e3('0x23')](removeEntity(_0x435467,null))[_0x72e3('0x41')](handleError(_0x435467,null));};exports[_0x72e3('0x4b')]=function(_0x10bc1a,_0x3dd772,_0x46637d){var _0x2182b4={};var _0x597451={};var _0x418289;var _0x277182;return db[_0x72e3('0x2a')]['findOne']({'where':{'id':_0x10bc1a[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x3dd772,null))[_0x72e3('0x23')](function(_0x9540a5){if(_0x9540a5){_0x418289=_0x9540a5;_0x597451[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db['SugarcrmField']['rawAttributes']);_0x597451[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x10bc1a[_0x72e3('0x30')]);_0x597451['filters']=_[_0x72e3('0x32')](_0x597451[_0x72e3('0x2e')],_0x597451[_0x72e3('0x30')]);_0x2182b4[_0x72e3('0x34')]=_[_0x72e3('0x32')](_0x597451['model'],qs[_0x72e3('0x33')](_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x33')]));_0x2182b4[_0x72e3('0x34')]=_0x2182b4[_0x72e3('0x34')]['length']?_0x2182b4['attributes']:_0x597451['model'];_0x2182b4[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x38')]);_0x2182b4[_0x72e3('0x3a')]=qs[_0x72e3('0x31')](_[_0x72e3('0x39')](_0x10bc1a[_0x72e3('0x30')],_0x597451[_0x72e3('0x31')]));if(_0x10bc1a['query']['filter']){_0x2182b4[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x2182b4['where'],{'$or':_[_0x72e3('0x2f')](_0x2182b4[_0x72e3('0x34')],function(_0xd0eb33){var _0x3e66eb={};_0x3e66eb[_0xd0eb33]={'$like':'%'+_0x10bc1a[_0x72e3('0x30')][_0x72e3('0x3d')]+'%'};return _0x3e66eb;})});}_0x2182b4=_[_0x72e3('0x3b')]({},_0x2182b4,_0x10bc1a[_0x72e3('0x3e')]);return _0x418289[_0x72e3('0x4b')](_0x2182b4);}})['then'](function(_0x4f475f){if(_0x4f475f){_0x277182=_0x4f475f[_0x72e3('0x45')];if(!_0x10bc1a[_0x72e3('0x30')]['hasOwnProperty'](_0x72e3('0x36'))){_0x2182b4[_0x72e3('0x1b')]=qs[_0x72e3('0x1b')](_0x10bc1a[_0x72e3('0x30')]['limit']);_0x2182b4[_0x72e3('0x1a')]=qs[_0x72e3('0x1a')](_0x10bc1a['query'][_0x72e3('0x1a')]);}return _0x418289[_0x72e3('0x4b')](_0x2182b4);}})[_0x72e3('0x23')](function(_0x146c39){if(_0x146c39){return _0x146c39?{'count':_0x277182,'rows':_0x146c39}:null;}})[_0x72e3('0x23')](respondWithResult(_0x3dd772,null))['catch'](handleError(_0x3dd772,null));};exports['getSubjects']=function(_0xcac850,_0x3ae2d7,_0x5b0c7b){var _0x412a9e={};var _0x1e3a1c={};var _0xdc4a01;var _0x4cb4c1;return db[_0x72e3('0x2a')][_0x72e3('0x4c')]({'where':{'id':_0xcac850[_0x72e3('0x43')]['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x3ae2d7,null))[_0x72e3('0x23')](function(_0x522c31){if(_0x522c31){_0xdc4a01=_0x522c31;_0x1e3a1c[_0x72e3('0x2e')]=_[_0x72e3('0x44')](db[_0x72e3('0x4d')][_0x72e3('0x2b')]);_0x1e3a1c[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0xcac850['query']);_0x1e3a1c[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x1e3a1c['model'],_0x1e3a1c['query']);_0x412a9e['attributes']=_[_0x72e3('0x32')](_0x1e3a1c[_0x72e3('0x2e')],qs[_0x72e3('0x33')](_0xcac850[_0x72e3('0x30')][_0x72e3('0x33')]));_0x412a9e[_0x72e3('0x34')]=_0x412a9e[_0x72e3('0x34')][_0x72e3('0x45')]?_0x412a9e[_0x72e3('0x34')]:_0x1e3a1c[_0x72e3('0x2e')];_0x412a9e[_0x72e3('0x37')]=qs['sort'](_0xcac850['query']['sort']);_0x412a9e[_0x72e3('0x3a')]=qs[_0x72e3('0x31')](_['pick'](_0xcac850[_0x72e3('0x30')],_0x1e3a1c['filters']));if(_0xcac850[_0x72e3('0x30')]['filter']){_0x412a9e[_0x72e3('0x3a')]=_[_0x72e3('0x3b')](_0x412a9e[_0x72e3('0x3a')],{'$or':_[_0x72e3('0x2f')](_0x412a9e[_0x72e3('0x34')],function(_0x147f81){var _0xd812b0={};_0xd812b0[_0x147f81]={'$like':'%'+_0xcac850[_0x72e3('0x30')][_0x72e3('0x3d')]+'%'};return _0xd812b0;})});}_0x412a9e=_[_0x72e3('0x3b')]({},_0x412a9e,_0xcac850[_0x72e3('0x3e')]);return _0xdc4a01[_0x72e3('0x4e')](_0x412a9e);}})[_0x72e3('0x23')](function(_0x121f59){if(_0x121f59){_0x4cb4c1=_0x121f59[_0x72e3('0x45')];if(!_0xcac850[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x412a9e[_0x72e3('0x1b')]=qs['limit'](_0xcac850['query']['limit']);_0x412a9e['offset']=qs[_0x72e3('0x1a')](_0xcac850['query']['offset']);}return _0xdc4a01[_0x72e3('0x4e')](_0x412a9e);}})[_0x72e3('0x23')](function(_0x1bccd7){if(_0x1bccd7){return _0x1bccd7?{'count':_0x4cb4c1,'rows':_0x1bccd7}:null;}})[_0x72e3('0x23')](respondWithResult(_0x3ae2d7,null))[_0x72e3('0x41')](handleError(_0x3ae2d7,null));};exports[_0x72e3('0x4f')]=function(_0x5a2ddf,_0x1d24eb,_0x4ef961){var _0x2993e1={};var _0x31fb1f={};var _0xcb2485;var _0x17fd95;return db['SugarcrmConfiguration'][_0x72e3('0x4c')]({'where':{'id':_0x5a2ddf['params']['id']}})[_0x72e3('0x23')](handleEntityNotFound(_0x1d24eb,null))[_0x72e3('0x23')](function(_0x3a9ed1){if(_0x3a9ed1){_0xcb2485=_0x3a9ed1;_0x31fb1f['model']=_[_0x72e3('0x44')](db['SugarcrmField'][_0x72e3('0x2b')]);_0x31fb1f[_0x72e3('0x30')]=_[_0x72e3('0x44')](_0x5a2ddf[_0x72e3('0x30')]);_0x31fb1f[_0x72e3('0x31')]=_[_0x72e3('0x32')](_0x31fb1f[_0x72e3('0x2e')],_0x31fb1f[_0x72e3('0x30')]);_0x2993e1['attributes']=_['intersection'](_0x31fb1f['model'],qs['fields'](_0x5a2ddf[_0x72e3('0x30')]['fields']));_0x2993e1['attributes']=_0x2993e1[_0x72e3('0x34')][_0x72e3('0x45')]?_0x2993e1[_0x72e3('0x34')]:_0x31fb1f['model'];_0x2993e1[_0x72e3('0x37')]=qs[_0x72e3('0x38')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x38')]);_0x2993e1['where']=qs[_0x72e3('0x31')](_['pick'](_0x5a2ddf['query'],_0x31fb1f[_0x72e3('0x31')]));if(_0x5a2ddf['query'][_0x72e3('0x3d')]){_0x2993e1['where']=_[_0x72e3('0x3b')](_0x2993e1['where'],{'$or':_[_0x72e3('0x2f')](_0x2993e1[_0x72e3('0x34')],function(_0x543406){var _0xb97653={};_0xb97653[_0x543406]={'$like':'%'+_0x5a2ddf[_0x72e3('0x30')]['filter']+'%'};return _0xb97653;})});}_0x2993e1=_['merge']({},_0x2993e1,_0x5a2ddf[_0x72e3('0x3e')]);return _0xcb2485[_0x72e3('0x4f')](_0x2993e1);}})[_0x72e3('0x23')](function(_0x5372e6){if(_0x5372e6){_0x17fd95=_0x5372e6[_0x72e3('0x45')];if(!_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x35')](_0x72e3('0x36'))){_0x2993e1[_0x72e3('0x1b')]=qs[_0x72e3('0x1b')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x1b')]);_0x2993e1['offset']=qs[_0x72e3('0x1a')](_0x5a2ddf[_0x72e3('0x30')][_0x72e3('0x1a')]);}return _0xcb2485[_0x72e3('0x4f')](_0x2993e1);}})['then'](function(_0x557ce1){if(_0x557ce1){return _0x557ce1?{'count':_0x17fd95,'rows':_0x557ce1}:null;}})[_0x72e3('0x23')](respondWithResult(_0x1d24eb,null))['catch'](handleError(_0x1d24eb,null));}; \ No newline at end of file +var _0x5e74=['rows','catch','params','find','create','body','getFields','SugarcrmField','rawAttributes','order','pick','getSubjects','findOne','getDescriptions','rimraf','zip-dir','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','stack','name','send','SugarcrmConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x5e74,0x180));var _0x45e7=function(_0x13a21c,_0xbbd163){_0x13a21c=_0x13a21c-0x0;var _0x223cf9=_0x5e74[_0x13a21c];return _0x223cf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45e7('0x0'));var zipdir=require(_0x45e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x45e7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x45e7('0x3'));var util=require(_0x45e7('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x45e7('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45e7('0x6'));var _=require(_0x45e7('0x7'));var squel=require(_0x45e7('0x8'));var crypto=require(_0x45e7('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x45e7('0xa'));var Papa=require(_0x45e7('0xb'));var Redis=require(_0x45e7('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45e7('0xd'));var hardwareService=require(_0x45e7('0xe'));var logger=require(_0x45e7('0xf'))(_0x45e7('0x10'));var utils=require(_0x45e7('0x11'));var config=require(_0x45e7('0x12'));var licenseUtil=require(_0x45e7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x151556,_0xeb7dba){_0xeb7dba=_0xeb7dba||0xcc;return function(_0x4a8fdc){if(_0x4a8fdc){return _0x151556[_0x45e7('0x14')](_0xeb7dba);}return _0x151556[_0x45e7('0x15')](_0xeb7dba)[_0x45e7('0x16')]();};}function respondWithResult(_0x29e096,_0x796200){_0x796200=_0x796200||0xc8;return function(_0x2d3ccd){if(_0x2d3ccd){return _0x29e096[_0x45e7('0x15')](_0x796200)[_0x45e7('0x17')](_0x2d3ccd);}};}function respondWithFilteredResult(_0x272fd1,_0x5df291){return function(_0x32b7d6){if(_0x32b7d6){var _0x40fcb0=typeof _0x5df291['offset']===_0x45e7('0x18')&&typeof _0x5df291['limit']===_0x45e7('0x18');var _0xbb5584=_0x32b7d6['count'];var _0x185395=_0x40fcb0?0x0:_0x5df291[_0x45e7('0x19')];var _0x505c0a=_0x40fcb0?_0x32b7d6[_0x45e7('0x1a')]:_0x5df291['offset']+_0x5df291[_0x45e7('0x1b')];var _0xf4c378;if(_0x505c0a>=_0xbb5584){_0x505c0a=_0xbb5584;_0xf4c378=0xc8;}else{_0xf4c378=0xce;}_0x272fd1[_0x45e7('0x15')](_0xf4c378);return _0x272fd1['set'](_0x45e7('0x1c'),_0x185395+'-'+_0x505c0a+'/'+_0xbb5584)['json'](_0x32b7d6);}return null;};}function patchUpdates(_0x2e6a0b){return function(_0x487c5a){try{jsonpatch[_0x45e7('0x1d')](_0x487c5a,_0x2e6a0b,!![]);}catch(_0x552518){return BPromise[_0x45e7('0x1e')](_0x552518);}return _0x487c5a[_0x45e7('0x1f')]();};}function saveUpdates(_0x3c80da,_0x41a157){return function(_0x544875){if(_0x544875){return _0x544875[_0x45e7('0x20')](_0x3c80da)[_0x45e7('0x21')](function(_0x3e3ebd){return _0x3e3ebd;});}return null;};}function removeEntity(_0x505552,_0x41adfe){return function(_0x4d1ddc){if(_0x4d1ddc){return _0x4d1ddc['destroy']()['then'](function(){_0x505552[_0x45e7('0x15')](0xcc)[_0x45e7('0x16')]();});}};}function handleEntityNotFound(_0x33570a,_0x192538){return function(_0x1626d7){if(!_0x1626d7){_0x33570a['sendStatus'](0x194);}return _0x1626d7;};}function handleError(_0x19d3bb,_0x47c3da){_0x47c3da=_0x47c3da||0x1f4;return function(_0xaedc52){logger['error'](_0xaedc52[_0x45e7('0x22')]);if(_0xaedc52[_0x45e7('0x23')]){delete _0xaedc52[_0x45e7('0x23')];}_0x19d3bb['status'](_0x47c3da)[_0x45e7('0x24')](_0xaedc52);};}exports['index']=function(_0x57f43f,_0x5f2aaa){var _0x32babc={},_0x4ea5c9={},_0x1024b0={'count':0x0,'rows':[]};var _0x2ce503=_['map'](db[_0x45e7('0x25')]['rawAttributes'],function(_0x5ad7b6){return{'name':_0x5ad7b6[_0x45e7('0x26')],'type':_0x5ad7b6[_0x45e7('0x27')][_0x45e7('0x28')]};});_0x4ea5c9[_0x45e7('0x29')]=_[_0x45e7('0x2a')](_0x2ce503,_0x45e7('0x23'));_0x4ea5c9['query']=_[_0x45e7('0x2b')](_0x57f43f[_0x45e7('0x2c')]);_0x4ea5c9[_0x45e7('0x2d')]=_[_0x45e7('0x2e')](_0x4ea5c9[_0x45e7('0x29')],_0x4ea5c9['query']);_0x32babc['attributes']=_[_0x45e7('0x2e')](_0x4ea5c9['model'],qs[_0x45e7('0x2f')](_0x57f43f[_0x45e7('0x2c')][_0x45e7('0x2f')]));_0x32babc[_0x45e7('0x30')]=_0x32babc[_0x45e7('0x30')][_0x45e7('0x31')]?_0x32babc[_0x45e7('0x30')]:_0x4ea5c9['model'];if(!_0x57f43f[_0x45e7('0x2c')][_0x45e7('0x32')](_0x45e7('0x33'))){_0x32babc[_0x45e7('0x1b')]=qs[_0x45e7('0x1b')](_0x57f43f['query']['limit']);_0x32babc[_0x45e7('0x19')]=qs[_0x45e7('0x19')](_0x57f43f[_0x45e7('0x2c')][_0x45e7('0x19')]);}_0x32babc['order']=qs[_0x45e7('0x34')](_0x57f43f['query'][_0x45e7('0x34')]);_0x32babc[_0x45e7('0x35')]=qs[_0x45e7('0x2d')](_['pick'](_0x57f43f[_0x45e7('0x2c')],_0x4ea5c9['filters']),_0x2ce503);if(_0x57f43f['query'][_0x45e7('0x36')]){_0x32babc[_0x45e7('0x35')]=_[_0x45e7('0x37')](_0x32babc[_0x45e7('0x35')],{'$or':_[_0x45e7('0x2a')](_0x2ce503,function(_0x36f30a){if(_0x36f30a['type']!==_0x45e7('0x38')){var _0x47aea9={};_0x47aea9[_0x36f30a[_0x45e7('0x23')]]={'$like':'%'+_0x57f43f[_0x45e7('0x2c')][_0x45e7('0x36')]+'%'};return _0x47aea9;}})});}_0x32babc=_[_0x45e7('0x37')]({},_0x32babc,_0x57f43f[_0x45e7('0x39')]);var _0x71bb7a={'where':_0x32babc[_0x45e7('0x35')]};return db[_0x45e7('0x25')][_0x45e7('0x1a')](_0x71bb7a)['then'](function(_0x126bbe){_0x1024b0[_0x45e7('0x1a')]=_0x126bbe;if(_0x57f43f[_0x45e7('0x2c')][_0x45e7('0x3a')]){_0x32babc[_0x45e7('0x3b')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x32babc);})['then'](function(_0x56003b){_0x1024b0[_0x45e7('0x3c')]=_0x56003b;return _0x1024b0;})[_0x45e7('0x21')](respondWithFilteredResult(_0x5f2aaa,_0x32babc))[_0x45e7('0x3d')](handleError(_0x5f2aaa,null));};exports['show']=function(_0x23c967,_0x14f29c){var _0x37b748={'raw':![],'where':{'id':_0x23c967[_0x45e7('0x3e')]['id']}},_0x8a1af9={};_0x8a1af9[_0x45e7('0x29')]=_[_0x45e7('0x2b')](db['SugarcrmConfiguration']['rawAttributes']);_0x8a1af9['query']=_[_0x45e7('0x2b')](_0x23c967[_0x45e7('0x2c')]);_0x8a1af9[_0x45e7('0x2d')]=_['intersection'](_0x8a1af9[_0x45e7('0x29')],_0x8a1af9[_0x45e7('0x2c')]);_0x37b748[_0x45e7('0x30')]=_[_0x45e7('0x2e')](_0x8a1af9[_0x45e7('0x29')],qs[_0x45e7('0x2f')](_0x23c967[_0x45e7('0x2c')][_0x45e7('0x2f')]));_0x37b748[_0x45e7('0x30')]=_0x37b748[_0x45e7('0x30')][_0x45e7('0x31')]?_0x37b748[_0x45e7('0x30')]:_0x8a1af9['model'];if(_0x23c967[_0x45e7('0x2c')][_0x45e7('0x3a')]){_0x37b748[_0x45e7('0x3b')]=[{'all':!![]}];}_0x37b748=_[_0x45e7('0x37')]({},_0x37b748,_0x23c967[_0x45e7('0x39')]);return db[_0x45e7('0x25')][_0x45e7('0x3f')](_0x37b748)[_0x45e7('0x21')](handleEntityNotFound(_0x14f29c,null))[_0x45e7('0x21')](respondWithResult(_0x14f29c,null))[_0x45e7('0x3d')](handleError(_0x14f29c,null));};exports[_0x45e7('0x40')]=function(_0xb666e2,_0x19a955){return db[_0x45e7('0x25')][_0x45e7('0x40')](_0xb666e2[_0x45e7('0x41')],{})['then'](respondWithResult(_0x19a955,0xc9))['catch'](handleError(_0x19a955,null));};exports[_0x45e7('0x20')]=function(_0x4b0a3e,_0x558362){if(_0x4b0a3e[_0x45e7('0x41')]['id']){delete _0x4b0a3e[_0x45e7('0x41')]['id'];}return db[_0x45e7('0x25')]['find']({'where':{'id':_0x4b0a3e[_0x45e7('0x3e')]['id']}})[_0x45e7('0x21')](handleEntityNotFound(_0x558362,null))[_0x45e7('0x21')](saveUpdates(_0x4b0a3e[_0x45e7('0x41')],null))[_0x45e7('0x21')](respondWithResult(_0x558362,null))[_0x45e7('0x3d')](handleError(_0x558362,null));};exports['destroy']=function(_0x3ed111,_0x52b8e6){return db[_0x45e7('0x25')][_0x45e7('0x3f')]({'where':{'id':_0x3ed111[_0x45e7('0x3e')]['id']}})[_0x45e7('0x21')](handleEntityNotFound(_0x52b8e6,null))[_0x45e7('0x21')](removeEntity(_0x52b8e6,null))[_0x45e7('0x3d')](handleError(_0x52b8e6,null));};exports[_0x45e7('0x42')]=function(_0x3597a7,_0x13b840,_0x373972){var _0x1ceb43={};var _0x3277ee={};var _0x29f611;var _0x2023e6;return db[_0x45e7('0x25')]['findOne']({'where':{'id':_0x3597a7['params']['id']}})[_0x45e7('0x21')](handleEntityNotFound(_0x13b840,null))[_0x45e7('0x21')](function(_0x51fa2a){if(_0x51fa2a){_0x29f611=_0x51fa2a;_0x3277ee[_0x45e7('0x29')]=_['keys'](db[_0x45e7('0x43')][_0x45e7('0x44')]);_0x3277ee[_0x45e7('0x2c')]=_[_0x45e7('0x2b')](_0x3597a7[_0x45e7('0x2c')]);_0x3277ee[_0x45e7('0x2d')]=_['intersection'](_0x3277ee[_0x45e7('0x29')],_0x3277ee['query']);_0x1ceb43[_0x45e7('0x30')]=_[_0x45e7('0x2e')](_0x3277ee['model'],qs[_0x45e7('0x2f')](_0x3597a7[_0x45e7('0x2c')][_0x45e7('0x2f')]));_0x1ceb43[_0x45e7('0x30')]=_0x1ceb43[_0x45e7('0x30')][_0x45e7('0x31')]?_0x1ceb43[_0x45e7('0x30')]:_0x3277ee[_0x45e7('0x29')];_0x1ceb43[_0x45e7('0x45')]=qs[_0x45e7('0x34')](_0x3597a7[_0x45e7('0x2c')][_0x45e7('0x34')]);_0x1ceb43[_0x45e7('0x35')]=qs[_0x45e7('0x2d')](_[_0x45e7('0x46')](_0x3597a7['query'],_0x3277ee['filters']));if(_0x3597a7[_0x45e7('0x2c')][_0x45e7('0x36')]){_0x1ceb43[_0x45e7('0x35')]=_[_0x45e7('0x37')](_0x1ceb43[_0x45e7('0x35')],{'$or':_[_0x45e7('0x2a')](_0x1ceb43['attributes'],function(_0x2d79ba){var _0x20e9d2={};_0x20e9d2[_0x2d79ba]={'$like':'%'+_0x3597a7['query'][_0x45e7('0x36')]+'%'};return _0x20e9d2;})});}_0x1ceb43=_['merge']({},_0x1ceb43,_0x3597a7[_0x45e7('0x39')]);return _0x29f611[_0x45e7('0x42')](_0x1ceb43);}})[_0x45e7('0x21')](function(_0xe99903){if(_0xe99903){_0x2023e6=_0xe99903[_0x45e7('0x31')];if(!_0x3597a7['query'][_0x45e7('0x32')]('nolimit')){_0x1ceb43[_0x45e7('0x1b')]=qs[_0x45e7('0x1b')](_0x3597a7[_0x45e7('0x2c')][_0x45e7('0x1b')]);_0x1ceb43[_0x45e7('0x19')]=qs[_0x45e7('0x19')](_0x3597a7[_0x45e7('0x2c')][_0x45e7('0x19')]);}return _0x29f611['getFields'](_0x1ceb43);}})[_0x45e7('0x21')](function(_0x629738){if(_0x629738){return _0x629738?{'count':_0x2023e6,'rows':_0x629738}:null;}})[_0x45e7('0x21')](respondWithResult(_0x13b840,null))[_0x45e7('0x3d')](handleError(_0x13b840,null));};exports[_0x45e7('0x47')]=function(_0xd3ec72,_0x240157,_0x36201e){var _0x162893={};var _0x2985c7={};var _0x4adbf6;var _0x40750b;return db[_0x45e7('0x25')][_0x45e7('0x48')]({'where':{'id':_0xd3ec72['params']['id']}})[_0x45e7('0x21')](handleEntityNotFound(_0x240157,null))[_0x45e7('0x21')](function(_0x28fb66){if(_0x28fb66){_0x4adbf6=_0x28fb66;_0x2985c7[_0x45e7('0x29')]=_[_0x45e7('0x2b')](db['SugarcrmField'][_0x45e7('0x44')]);_0x2985c7[_0x45e7('0x2c')]=_[_0x45e7('0x2b')](_0xd3ec72[_0x45e7('0x2c')]);_0x2985c7[_0x45e7('0x2d')]=_[_0x45e7('0x2e')](_0x2985c7['model'],_0x2985c7[_0x45e7('0x2c')]);_0x162893['attributes']=_['intersection'](_0x2985c7['model'],qs[_0x45e7('0x2f')](_0xd3ec72['query'][_0x45e7('0x2f')]));_0x162893[_0x45e7('0x30')]=_0x162893[_0x45e7('0x30')]['length']?_0x162893[_0x45e7('0x30')]:_0x2985c7[_0x45e7('0x29')];_0x162893[_0x45e7('0x45')]=qs['sort'](_0xd3ec72['query'][_0x45e7('0x34')]);_0x162893[_0x45e7('0x35')]=qs[_0x45e7('0x2d')](_['pick'](_0xd3ec72['query'],_0x2985c7['filters']));if(_0xd3ec72[_0x45e7('0x2c')][_0x45e7('0x36')]){_0x162893[_0x45e7('0x35')]=_[_0x45e7('0x37')](_0x162893[_0x45e7('0x35')],{'$or':_['map'](_0x162893[_0x45e7('0x30')],function(_0x56adcf){var _0x590bf0={};_0x590bf0[_0x56adcf]={'$like':'%'+_0xd3ec72[_0x45e7('0x2c')][_0x45e7('0x36')]+'%'};return _0x590bf0;})});}_0x162893=_['merge']({},_0x162893,_0xd3ec72[_0x45e7('0x39')]);return _0x4adbf6['getSubjects'](_0x162893);}})[_0x45e7('0x21')](function(_0x342bbb){if(_0x342bbb){_0x40750b=_0x342bbb[_0x45e7('0x31')];if(!_0xd3ec72[_0x45e7('0x2c')]['hasOwnProperty'](_0x45e7('0x33'))){_0x162893[_0x45e7('0x1b')]=qs['limit'](_0xd3ec72[_0x45e7('0x2c')][_0x45e7('0x1b')]);_0x162893[_0x45e7('0x19')]=qs['offset'](_0xd3ec72['query']['offset']);}return _0x4adbf6[_0x45e7('0x47')](_0x162893);}})['then'](function(_0xea1edb){if(_0xea1edb){return _0xea1edb?{'count':_0x40750b,'rows':_0xea1edb}:null;}})[_0x45e7('0x21')](respondWithResult(_0x240157,null))[_0x45e7('0x3d')](handleError(_0x240157,null));};exports[_0x45e7('0x49')]=function(_0x4446ea,_0x77ae5e,_0x53215f){var _0x31f3b2={};var _0x39db70={};var _0x4695ef;var _0x1a69c6;return db['SugarcrmConfiguration'][_0x45e7('0x48')]({'where':{'id':_0x4446ea[_0x45e7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x77ae5e,null))[_0x45e7('0x21')](function(_0x5e38ae){if(_0x5e38ae){_0x4695ef=_0x5e38ae;_0x39db70['model']=_[_0x45e7('0x2b')](db['SugarcrmField'][_0x45e7('0x44')]);_0x39db70[_0x45e7('0x2c')]=_['keys'](_0x4446ea[_0x45e7('0x2c')]);_0x39db70[_0x45e7('0x2d')]=_[_0x45e7('0x2e')](_0x39db70[_0x45e7('0x29')],_0x39db70[_0x45e7('0x2c')]);_0x31f3b2['attributes']=_[_0x45e7('0x2e')](_0x39db70['model'],qs['fields'](_0x4446ea['query']['fields']));_0x31f3b2[_0x45e7('0x30')]=_0x31f3b2['attributes'][_0x45e7('0x31')]?_0x31f3b2[_0x45e7('0x30')]:_0x39db70[_0x45e7('0x29')];_0x31f3b2[_0x45e7('0x45')]=qs[_0x45e7('0x34')](_0x4446ea[_0x45e7('0x2c')]['sort']);_0x31f3b2[_0x45e7('0x35')]=qs[_0x45e7('0x2d')](_[_0x45e7('0x46')](_0x4446ea[_0x45e7('0x2c')],_0x39db70[_0x45e7('0x2d')]));if(_0x4446ea[_0x45e7('0x2c')][_0x45e7('0x36')]){_0x31f3b2['where']=_['merge'](_0x31f3b2[_0x45e7('0x35')],{'$or':_[_0x45e7('0x2a')](_0x31f3b2[_0x45e7('0x30')],function(_0x233bca){var _0x1fc311={};_0x1fc311[_0x233bca]={'$like':'%'+_0x4446ea['query'][_0x45e7('0x36')]+'%'};return _0x1fc311;})});}_0x31f3b2=_['merge']({},_0x31f3b2,_0x4446ea['options']);return _0x4695ef['getDescriptions'](_0x31f3b2);}})[_0x45e7('0x21')](function(_0x38f3cc){if(_0x38f3cc){_0x1a69c6=_0x38f3cc['length'];if(!_0x4446ea['query']['hasOwnProperty'](_0x45e7('0x33'))){_0x31f3b2[_0x45e7('0x1b')]=qs['limit'](_0x4446ea[_0x45e7('0x2c')][_0x45e7('0x1b')]);_0x31f3b2[_0x45e7('0x19')]=qs[_0x45e7('0x19')](_0x4446ea[_0x45e7('0x2c')]['offset']);}return _0x4695ef[_0x45e7('0x49')](_0x31f3b2);}})[_0x45e7('0x21')](function(_0x425e48){if(_0x425e48){return _0x425e48?{'count':_0x1a69c6,'rows':_0x425e48}:null;}})['then'](respondWithResult(_0x77ae5e,null))['catch'](handleError(_0x77ae5e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 35e16a7..8804dce 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 _0x50db=['SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x4d3b49,_0x5b6b77){var _0x1e6b06=function(_0x1777f0){while(--_0x1777f0){_0x4d3b49['push'](_0x4d3b49['shift']());}};_0x1e6b06(++_0x5b6b77);}(_0x50db,0xb2));var _0xb50d=function(_0x6ebca,_0x5bb242){_0x6ebca=_0x6ebca-0x0;var _0x468f82=_0x50db[_0x6ebca];return _0x468f82;};'use strict';var _=require('lodash');var util=require(_0xb50d('0x0'));var logger=require(_0xb50d('0x1'))(_0xb50d('0x2'));var moment=require(_0xb50d('0x3'));var BPromise=require(_0xb50d('0x4'));var rp=require(_0xb50d('0x5'));var fs=require('fs');var path=require(_0xb50d('0x6'));var rimraf=require('rimraf');var config=require(_0xb50d('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x1a107e,_0x1cf58a){return _0x1a107e[_0xb50d('0x8')](_0xb50d('0x9'),attributes,{'tableName':_0xb50d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa09d=['define','SugarcrmConfiguration','lodash','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xa09d,0x1f3));var _0xda09=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa09d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xda09('0x0'));var util=require('util');var logger=require(_0xda09('0x1'))('api');var moment=require(_0xda09('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda09('0x3'));var config=require(_0xda09('0x4'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x138c86,_0x6d0325){return _0x138c86[_0xda09('0x5')](_0xda09('0x6'),attributes,{'tableName':'int_sugarcrm_configurations','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 608b394..7208bb3 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 _0xa0d8=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x31c713,_0x256f06){var _0x2bd888=function(_0x431116){while(--_0x431116){_0x31c713['push'](_0x31c713['shift']());}};_0x2bd888(++_0x256f06);}(_0xa0d8,0x1ee));var _0x8a0d=function(_0x407425,_0x4972be){_0x407425=_0x407425-0x0;var _0x2e1109=_0xa0d8[_0x407425];return _0x2e1109;};'use strict';var _=require(_0x8a0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8a0d('0x1'));var fs=require('fs');var Redis=require(_0x8a0d('0x2'));var db=require(_0x8a0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a0d('0x4'))(_0x8a0d('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a0d('0x6'));var client=jayson[_0x8a0d('0x7')][_0x8a0d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x114c77,_0x28c34c,_0x3bdfbf){return new BPromise(function(_0x1536dc,_0x1d0160){return client[_0x8a0d('0x9')](_0x114c77,_0x3bdfbf)[_0x8a0d('0xa')](function(_0x128782){logger['info'](_0x8a0d('0xb'),_0x28c34c,_0x8a0d('0xc'));logger[_0x8a0d('0xd')](_0x8a0d('0xe'),_0x28c34c,'request\x20sent',JSON[_0x8a0d('0xf')](_0x128782));if(_0x128782[_0x8a0d('0x10')]){if(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x11')]===0x1f4){logger[_0x8a0d('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x28c34c,_0x128782[_0x8a0d('0x10')]['message']);return _0x1d0160(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);}logger['error'](_0x8a0d('0xb'),_0x28c34c,_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);return _0x1536dc(_0x128782[_0x8a0d('0x10')][_0x8a0d('0x12')]);}else{logger[_0x8a0d('0x13')](_0x8a0d('0xb'),_0x28c34c,'request\x20sent');_0x1536dc(_0x128782[_0x8a0d('0x14')][_0x8a0d('0x12')]);}})[_0x8a0d('0x15')](function(_0x17792a){logger['error'](_0x8a0d('0xb'),_0x28c34c,_0x17792a);_0x1d0160(_0x17792a);});});} \ No newline at end of file +var _0xfc2c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfc2c,0x1b0));var _0xcfc2=function(_0x2ff319,_0x21ae00){_0x2ff319=_0x2ff319-0x0;var _0x56027f=_0xfc2c[_0x2ff319];return _0x56027f;};'use strict';var _=require(_0xcfc2('0x0'));var util=require(_0xcfc2('0x1'));var moment=require('moment');var BPromise=require(_0xcfc2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfc2('0x3'));var db=require(_0xcfc2('0x4'))['db'];var utils=require(_0xcfc2('0x5'));var logger=require(_0xcfc2('0x6'))(_0xcfc2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfc2('0x8'));var client=jayson[_0xcfc2('0x9')][_0xcfc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e69b7,_0x8725ee,_0xda78db){return new BPromise(function(_0x4dbb04,_0x1d6114){return client[_0xcfc2('0xb')](_0x4e69b7,_0xda78db)['then'](function(_0xee63d4){logger['info'](_0xcfc2('0xc'),_0x8725ee,'request\x20sent');logger[_0xcfc2('0xd')](_0xcfc2('0xe'),_0x8725ee,_0xcfc2('0xf'),JSON[_0xcfc2('0x10')](_0xee63d4));if(_0xee63d4[_0xcfc2('0x11')]){if(_0xee63d4['error'][_0xcfc2('0x12')]===0x1f4){logger[_0xcfc2('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x8725ee,_0xee63d4['error'][_0xcfc2('0x13')]);return _0x1d6114(_0xee63d4[_0xcfc2('0x11')][_0xcfc2('0x13')]);}logger[_0xcfc2('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x8725ee,_0xee63d4['error'][_0xcfc2('0x13')]);return _0x4dbb04(_0xee63d4[_0xcfc2('0x11')][_0xcfc2('0x13')]);}else{logger[_0xcfc2('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x8725ee,_0xcfc2('0xf'));_0x4dbb04(_0xee63d4[_0xcfc2('0x15')][_0xcfc2('0x13')]);}})[_0xcfc2('0x16')](function(_0x1e4b6e){logger[_0xcfc2('0x11')](_0xcfc2('0xc'),_0x8725ee,_0x1e4b6e);_0x1d6114(_0x1e4b6e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 243305b..3527c2d 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 _0x9368=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','put','/:id','delete','exports','multer'];(function(_0x1ba218,_0x572043){var _0x563346=function(_0x2a94ab){while(--_0x2a94ab){_0x1ba218['push'](_0x1ba218['shift']());}};_0x563346(++_0x572043);}(_0x9368,0xbf));var _0x8936=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9368[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8936('0x0'));var util=require(_0x8936('0x1'));var path=require(_0x8936('0x2'));var timeout=require(_0x8936('0x3'));var express=require(_0x8936('0x4'));var router=express[_0x8936('0x5')]();var fs_extra=require(_0x8936('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8936('0x7'));var controller=require(_0x8936('0x8'));router[_0x8936('0x9')]('/',auth[_0x8936('0xa')](),controller['index']);router[_0x8936('0x9')]('/:id',auth[_0x8936('0xa')](),controller[_0x8936('0xb')]);router['post']('/',auth[_0x8936('0xa')](),controller['create']);router[_0x8936('0xc')](_0x8936('0xd'),auth[_0x8936('0xa')](),controller['update']);router[_0x8936('0xe')](_0x8936('0xd'),auth[_0x8936('0xa')](),controller['destroy']);module[_0x8936('0xf')]=router; \ No newline at end of file +var _0x6d08=['../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2a36c6,_0x25cd08){var _0x9a3fd7=function(_0x525106){while(--_0x525106){_0x2a36c6['push'](_0x2a36c6['shift']());}};_0x9a3fd7(++_0x25cd08);}(_0x6d08,0x105));var _0x86d0=function(_0x6b9992,_0x28c3f6){_0x6b9992=_0x6b9992-0x0;var _0x57ec83=_0x6d08[_0x6b9992];return _0x57ec83;};'use strict';var multer=require(_0x86d0('0x0'));var util=require('util');var path=require(_0x86d0('0x1'));var timeout=require(_0x86d0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d0('0x3'));var auth=require(_0x86d0('0x4'));var interaction=require(_0x86d0('0x5'));var config=require(_0x86d0('0x6'));var controller=require(_0x86d0('0x7'));router[_0x86d0('0x8')]('/',auth[_0x86d0('0x9')](),controller[_0x86d0('0xa')]);router[_0x86d0('0x8')]('/:id',auth[_0x86d0('0x9')](),controller[_0x86d0('0xb')]);router[_0x86d0('0xc')]('/',auth['isAuthenticated'](),controller[_0x86d0('0xd')]);router['put'](_0x86d0('0xe'),auth[_0x86d0('0x9')](),controller[_0x86d0('0xf')]);router[_0x86d0('0x10')]('/:id',auth[_0x86d0('0x9')](),controller[_0x86d0('0x11')]);module[_0x86d0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1f21a4c..078bdfb 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 _0x6233=['keyValue','picklist','string','STRING','BOOLEAN','exports','variable','customVariable'];(function(_0x59a85c,_0x39f54f){var _0x35580f=function(_0xd6f8f8){while(--_0xd6f8f8){_0x59a85c['push'](_0x59a85c['shift']());}};_0x35580f(++_0x39f54f);}(_0x6233,0x1a5));var _0x3623=function(_0xe05b25,_0x5376ab){_0xe05b25=_0xe05b25-0x0;var _0x1b143c=_0x6233[_0xe05b25];return _0x1b143c;};'use strict';var Sequelize=require('sequelize');module[_0x3623('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x3623('0x1'),_0x3623('0x2'),_0x3623('0x3'),_0x3623('0x4')),'defaultValue':_0x3623('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3623('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x3623('0x5'),_0x3623('0x1'),_0x3623('0x2'))},'keyContent':{'type':Sequelize[_0x3623('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3623('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3623('0x6')]}}; \ No newline at end of file +var _0x7775=['BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x313408,_0x35258f){var _0x2b57c0=function(_0x885fe6){while(--_0x885fe6){_0x313408['push'](_0x313408['shift']());}};_0x2b57c0(++_0x35258f);}(_0x7775,0x89));var _0x5777=function(_0x5f4e21,_0x2f1f43){_0x5f4e21=_0x5f4e21-0x0;var _0x1f93f9=_0x7775[_0x5f4e21];return _0x1f93f9;};'use strict';var Sequelize=require(_0x5777('0x0'));module[_0x5777('0x1')]={'type':{'type':Sequelize[_0x5777('0x2')](_0x5777('0x3'),_0x5777('0x4'),'customVariable','keyValue',_0x5777('0x5')),'defaultValue':_0x5777('0x3')},'content':{'type':Sequelize[_0x5777('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5777('0x2')](_0x5777('0x3'),_0x5777('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x5777('0x6')]},'idField':{'type':Sequelize[_0x5777('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5777('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d0a6992..6dae00b 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 _0x27a9=['undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','include','findAll','rows','show','params','rawAttributes','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit'];(function(_0x4dbfce,_0xf32dad){var _0xed4af1=function(_0x4ac0a9){while(--_0x4ac0a9){_0x4dbfce['push'](_0x4dbfce['shift']());}};_0xed4af1(++_0xf32dad);}(_0x27a9,0x1e2));var _0x927a=function(_0xa8f5ed,_0x37f782){_0xa8f5ed=_0xa8f5ed-0x0;var _0x99f5be=_0x27a9[_0xa8f5ed];return _0x99f5be;};'use strict';var emlformat=require(_0x927a('0x0'));var rimraf=require(_0x927a('0x1'));var zipdir=require(_0x927a('0x2'));var jsonpatch=require(_0x927a('0x3'));var rp=require(_0x927a('0x4'));var moment=require(_0x927a('0x5'));var BPromise=require(_0x927a('0x6'));var Mustache=require(_0x927a('0x7'));var util=require(_0x927a('0x8'));var path=require(_0x927a('0x9'));var sox=require('sox');var csv=require(_0x927a('0xa'));var ejs=require(_0x927a('0xb'));var fs=require('fs');var fs_extra=require(_0x927a('0xc'));var _=require(_0x927a('0xd'));var squel=require('squel');var crypto=require(_0x927a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x927a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x927a('0x10'));var Papa=require(_0x927a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x927a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x927a('0x13'));var logger=require(_0x927a('0x14'))(_0x927a('0x15'));var utils=require(_0x927a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x927a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2194c8,_0x20a8dd){_0x20a8dd=_0x20a8dd||0xcc;return function(_0x2c0844){if(_0x2c0844){return _0x2194c8[_0x927a('0x18')](_0x20a8dd);}return _0x2194c8[_0x927a('0x19')](_0x20a8dd)['end']();};}function respondWithResult(_0x2e6df5,_0x3e60a6){_0x3e60a6=_0x3e60a6||0xc8;return function(_0x3fdc79){if(_0x3fdc79){return _0x2e6df5[_0x927a('0x19')](_0x3e60a6)[_0x927a('0x1a')](_0x3fdc79);}};}function respondWithFilteredResult(_0x5a7b78,_0x1d5b93){return function(_0x1d6fc7){if(_0x1d6fc7){var _0x2719ac=typeof _0x1d5b93[_0x927a('0x1b')]==='undefined'&&typeof _0x1d5b93[_0x927a('0x1c')]===_0x927a('0x1d');var _0x268588=_0x1d6fc7[_0x927a('0x1e')];var _0x583458=_0x2719ac?0x0:_0x1d5b93['offset'];var _0x3457ae=_0x2719ac?_0x1d6fc7[_0x927a('0x1e')]:_0x1d5b93[_0x927a('0x1b')]+_0x1d5b93['limit'];var _0x1168bf;if(_0x3457ae>=_0x268588){_0x3457ae=_0x268588;_0x1168bf=0xc8;}else{_0x1168bf=0xce;}_0x5a7b78[_0x927a('0x19')](_0x1168bf);return _0x5a7b78[_0x927a('0x1f')](_0x927a('0x20'),_0x583458+'-'+_0x3457ae+'/'+_0x268588)[_0x927a('0x1a')](_0x1d6fc7);}return null;};}function patchUpdates(_0x1bd464){return function(_0x404555){try{jsonpatch[_0x927a('0x21')](_0x404555,_0x1bd464,!![]);}catch(_0x163480){return BPromise[_0x927a('0x22')](_0x163480);}return _0x404555[_0x927a('0x23')]();};}function saveUpdates(_0x59dfe0,_0x51c3a8){return function(_0x303090){if(_0x303090){return _0x303090[_0x927a('0x24')](_0x59dfe0)['then'](function(_0xe377f4){return _0xe377f4;});}return null;};}function removeEntity(_0x562c56,_0x1af3dd){return function(_0x455c15){if(_0x455c15){return _0x455c15[_0x927a('0x25')]()[_0x927a('0x26')](function(){_0x562c56[_0x927a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26988b,_0xf8b0b1){return function(_0x2cd033){if(!_0x2cd033){_0x26988b[_0x927a('0x18')](0x194);}return _0x2cd033;};}function handleError(_0x2768d6,_0x55c8da){_0x55c8da=_0x55c8da||0x1f4;return function(_0x71a25d){logger[_0x927a('0x27')](_0x71a25d[_0x927a('0x28')]);if(_0x71a25d[_0x927a('0x29')]){delete _0x71a25d[_0x927a('0x29')];}_0x2768d6[_0x927a('0x19')](_0x55c8da)[_0x927a('0x2a')](_0x71a25d);};}exports['index']=function(_0x22561e,_0x25f88a){var _0x414a5f={},_0x524f1a={},_0x5cc9ee={'count':0x0,'rows':[]};var _0x52f2aa=_[_0x927a('0x2b')](db[_0x927a('0x2c')]['rawAttributes'],function(_0x5af706){return{'name':_0x5af706[_0x927a('0x2d')],'type':_0x5af706[_0x927a('0x2e')][_0x927a('0x2f')]};});_0x524f1a[_0x927a('0x30')]=_[_0x927a('0x2b')](_0x52f2aa,_0x927a('0x29'));_0x524f1a[_0x927a('0x31')]=_['keys'](_0x22561e[_0x927a('0x31')]);_0x524f1a[_0x927a('0x32')]=_[_0x927a('0x33')](_0x524f1a[_0x927a('0x30')],_0x524f1a['query']);_0x414a5f[_0x927a('0x34')]=_[_0x927a('0x33')](_0x524f1a['model'],qs[_0x927a('0x35')](_0x22561e[_0x927a('0x31')]['fields']));_0x414a5f[_0x927a('0x34')]=_0x414a5f[_0x927a('0x34')][_0x927a('0x36')]?_0x414a5f[_0x927a('0x34')]:_0x524f1a[_0x927a('0x30')];if(!_0x22561e[_0x927a('0x31')][_0x927a('0x37')]('nolimit')){_0x414a5f[_0x927a('0x1c')]=qs['limit'](_0x22561e[_0x927a('0x31')][_0x927a('0x1c')]);_0x414a5f['offset']=qs[_0x927a('0x1b')](_0x22561e[_0x927a('0x31')]['offset']);}_0x414a5f[_0x927a('0x38')]=qs[_0x927a('0x39')](_0x22561e[_0x927a('0x31')][_0x927a('0x39')]);_0x414a5f[_0x927a('0x3a')]=qs[_0x927a('0x32')](_[_0x927a('0x3b')](_0x22561e['query'],_0x524f1a[_0x927a('0x32')]),_0x52f2aa);if(_0x22561e[_0x927a('0x31')][_0x927a('0x3c')]){_0x414a5f[_0x927a('0x3a')]=_['merge'](_0x414a5f['where'],{'$or':_[_0x927a('0x2b')](_0x52f2aa,function(_0x189d65){if(_0x189d65[_0x927a('0x2e')]!=='VIRTUAL'){var _0x368ffe={};_0x368ffe[_0x189d65[_0x927a('0x29')]]={'$like':'%'+_0x22561e['query'][_0x927a('0x3c')]+'%'};return _0x368ffe;}})});}_0x414a5f=_['merge']({},_0x414a5f,_0x22561e[_0x927a('0x3d')]);var _0x5ced08={'where':_0x414a5f[_0x927a('0x3a')]};return db[_0x927a('0x2c')]['count'](_0x5ced08)['then'](function(_0x544310){_0x5cc9ee[_0x927a('0x1e')]=_0x544310;if(_0x22561e[_0x927a('0x31')]['includeAll']){_0x414a5f[_0x927a('0x3e')]=[{'all':!![]}];}return db[_0x927a('0x2c')][_0x927a('0x3f')](_0x414a5f);})[_0x927a('0x26')](function(_0x1cd689){_0x5cc9ee[_0x927a('0x40')]=_0x1cd689;return _0x5cc9ee;})[_0x927a('0x26')](respondWithFilteredResult(_0x25f88a,_0x414a5f))['catch'](handleError(_0x25f88a,null));};exports[_0x927a('0x41')]=function(_0x3c8aad,_0x25b1fd){var _0x50d7a3={'raw':!![],'where':{'id':_0x3c8aad[_0x927a('0x42')]['id']}},_0x2d8b87={};_0x2d8b87[_0x927a('0x30')]=_['keys'](db['SugarcrmField'][_0x927a('0x43')]);_0x2d8b87[_0x927a('0x31')]=_[_0x927a('0x44')](_0x3c8aad[_0x927a('0x31')]);_0x2d8b87['filters']=_[_0x927a('0x33')](_0x2d8b87[_0x927a('0x30')],_0x2d8b87['query']);_0x50d7a3['attributes']=_[_0x927a('0x33')](_0x2d8b87[_0x927a('0x30')],qs['fields'](_0x3c8aad[_0x927a('0x31')][_0x927a('0x35')]));_0x50d7a3[_0x927a('0x34')]=_0x50d7a3['attributes'][_0x927a('0x36')]?_0x50d7a3[_0x927a('0x34')]:_0x2d8b87[_0x927a('0x30')];if(_0x3c8aad[_0x927a('0x31')]['includeAll']){_0x50d7a3['include']=[{'all':!![]}];}_0x50d7a3=_['merge']({},_0x50d7a3,_0x3c8aad[_0x927a('0x3d')]);return db[_0x927a('0x2c')][_0x927a('0x45')](_0x50d7a3)[_0x927a('0x26')](handleEntityNotFound(_0x25b1fd,null))[_0x927a('0x26')](respondWithResult(_0x25b1fd,null))[_0x927a('0x46')](handleError(_0x25b1fd,null));};exports[_0x927a('0x47')]=function(_0x238ae8,_0x4a5789){return db[_0x927a('0x2c')][_0x927a('0x47')](_0x238ae8[_0x927a('0x48')],{})[_0x927a('0x26')](respondWithResult(_0x4a5789,0xc9))['catch'](handleError(_0x4a5789,null));};exports[_0x927a('0x24')]=function(_0x2ee9ec,_0x59e919){if(_0x2ee9ec[_0x927a('0x48')]['id']){delete _0x2ee9ec['body']['id'];}return db[_0x927a('0x2c')][_0x927a('0x45')]({'where':{'id':_0x2ee9ec[_0x927a('0x42')]['id']}})[_0x927a('0x26')](handleEntityNotFound(_0x59e919,null))[_0x927a('0x26')](saveUpdates(_0x2ee9ec[_0x927a('0x48')],null))['then'](respondWithResult(_0x59e919,null))['catch'](handleError(_0x59e919,null));};exports[_0x927a('0x25')]=function(_0x1c3873,_0x16fca9){return db[_0x927a('0x2c')][_0x927a('0x45')]({'where':{'id':_0x1c3873[_0x927a('0x42')]['id']}})[_0x927a('0x26')](handleEntityNotFound(_0x16fca9,null))[_0x927a('0x26')](removeEntity(_0x16fca9,null))[_0x927a('0x46')](handleError(_0x16fca9,null));}; \ No newline at end of file +var _0xe8f8=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','update','body','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel'];(function(_0x56b5b1,_0x520fe5){var _0x201eaf=function(_0x6b33a9){while(--_0x6b33a9){_0x56b5b1['push'](_0x56b5b1['shift']());}};_0x201eaf(++_0x520fe5);}(_0xe8f8,0xd8));var _0x8e8f=function(_0xfccdbf,_0x307c9d){_0xfccdbf=_0xfccdbf-0x0;var _0x3ba1a1=_0xe8f8[_0xfccdbf];return _0x3ba1a1;};'use strict';var emlformat=require(_0x8e8f('0x0'));var rimraf=require(_0x8e8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e8f('0x2'));var moment=require(_0x8e8f('0x3'));var BPromise=require(_0x8e8f('0x4'));var Mustache=require(_0x8e8f('0x5'));var util=require(_0x8e8f('0x6'));var path=require(_0x8e8f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e8f('0x8'));var fs=require('fs');var fs_extra=require(_0x8e8f('0x9'));var _=require(_0x8e8f('0xa'));var squel=require(_0x8e8f('0xb'));var crypto=require(_0x8e8f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e8f('0xd'));var toCsv=require(_0x8e8f('0xe'));var querystring=require(_0x8e8f('0xf'));var Papa=require(_0x8e8f('0x10'));var Redis=require(_0x8e8f('0x11'));var authService=require(_0x8e8f('0x12'));var qs=require(_0x8e8f('0x13'));var as=require(_0x8e8f('0x14'));var hardwareService=require(_0x8e8f('0x15'));var logger=require(_0x8e8f('0x16'))(_0x8e8f('0x17'));var utils=require(_0x8e8f('0x18'));var config=require(_0x8e8f('0x19'));var licenseUtil=require(_0x8e8f('0x1a'));var db=require(_0x8e8f('0x1b'))['db'];function respondWithStatusCode(_0x440e22,_0x1cf92b){_0x1cf92b=_0x1cf92b||0xcc;return function(_0x23dcc0){if(_0x23dcc0){return _0x440e22[_0x8e8f('0x1c')](_0x1cf92b);}return _0x440e22[_0x8e8f('0x1d')](_0x1cf92b)[_0x8e8f('0x1e')]();};}function respondWithResult(_0x3361f0,_0x41b5c9){_0x41b5c9=_0x41b5c9||0xc8;return function(_0x11f85c){if(_0x11f85c){return _0x3361f0[_0x8e8f('0x1d')](_0x41b5c9)[_0x8e8f('0x1f')](_0x11f85c);}};}function respondWithFilteredResult(_0x320506,_0xd5dbbe){return function(_0x4b47f5){if(_0x4b47f5){var _0x1c25a7=typeof _0xd5dbbe[_0x8e8f('0x20')]===_0x8e8f('0x21')&&typeof _0xd5dbbe[_0x8e8f('0x22')]===_0x8e8f('0x21');var _0x832fcd=_0x4b47f5[_0x8e8f('0x23')];var _0x17cb1d=_0x1c25a7?0x0:_0xd5dbbe['offset'];var _0x40d2d6=_0x1c25a7?_0x4b47f5[_0x8e8f('0x23')]:_0xd5dbbe[_0x8e8f('0x20')]+_0xd5dbbe[_0x8e8f('0x22')];var _0x8a0e5c;if(_0x40d2d6>=_0x832fcd){_0x40d2d6=_0x832fcd;_0x8a0e5c=0xc8;}else{_0x8a0e5c=0xce;}_0x320506[_0x8e8f('0x1d')](_0x8a0e5c);return _0x320506[_0x8e8f('0x24')]('Content-Range',_0x17cb1d+'-'+_0x40d2d6+'/'+_0x832fcd)['json'](_0x4b47f5);}return null;};}function patchUpdates(_0x2ad435){return function(_0x1e79c8){try{jsonpatch[_0x8e8f('0x25')](_0x1e79c8,_0x2ad435,!![]);}catch(_0x3837de){return BPromise[_0x8e8f('0x26')](_0x3837de);}return _0x1e79c8['save']();};}function saveUpdates(_0x1884f0,_0x4398a3){return function(_0x18d2c8){if(_0x18d2c8){return _0x18d2c8['update'](_0x1884f0)[_0x8e8f('0x27')](function(_0x689b3e){return _0x689b3e;});}return null;};}function removeEntity(_0x5457a4,_0x5891d3){return function(_0x522319){if(_0x522319){return _0x522319[_0x8e8f('0x28')]()['then'](function(){_0x5457a4[_0x8e8f('0x1d')](0xcc)[_0x8e8f('0x1e')]();});}};}function handleEntityNotFound(_0x36cf01,_0x3e3b92){return function(_0x169c36){if(!_0x169c36){_0x36cf01[_0x8e8f('0x1c')](0x194);}return _0x169c36;};}function handleError(_0x377499,_0x1c44dc){_0x1c44dc=_0x1c44dc||0x1f4;return function(_0x185987){logger[_0x8e8f('0x29')](_0x185987[_0x8e8f('0x2a')]);if(_0x185987[_0x8e8f('0x2b')]){delete _0x185987[_0x8e8f('0x2b')];}_0x377499[_0x8e8f('0x1d')](_0x1c44dc)[_0x8e8f('0x2c')](_0x185987);};}exports[_0x8e8f('0x2d')]=function(_0xfa3b8a,_0x18dddf){var _0x5c1480={},_0x1910a7={},_0xae12d3={'count':0x0,'rows':[]};var _0x12c0dc=_['map'](db[_0x8e8f('0x2e')][_0x8e8f('0x2f')],function(_0x38cd5d){return{'name':_0x38cd5d['fieldName'],'type':_0x38cd5d[_0x8e8f('0x30')][_0x8e8f('0x31')]};});_0x1910a7['model']=_[_0x8e8f('0x32')](_0x12c0dc,_0x8e8f('0x2b'));_0x1910a7[_0x8e8f('0x33')]=_[_0x8e8f('0x34')](_0xfa3b8a[_0x8e8f('0x33')]);_0x1910a7[_0x8e8f('0x35')]=_[_0x8e8f('0x36')](_0x1910a7['model'],_0x1910a7[_0x8e8f('0x33')]);_0x5c1480[_0x8e8f('0x37')]=_[_0x8e8f('0x36')](_0x1910a7[_0x8e8f('0x38')],qs[_0x8e8f('0x39')](_0xfa3b8a[_0x8e8f('0x33')][_0x8e8f('0x39')]));_0x5c1480[_0x8e8f('0x37')]=_0x5c1480[_0x8e8f('0x37')][_0x8e8f('0x3a')]?_0x5c1480[_0x8e8f('0x37')]:_0x1910a7[_0x8e8f('0x38')];if(!_0xfa3b8a[_0x8e8f('0x33')][_0x8e8f('0x3b')]('nolimit')){_0x5c1480[_0x8e8f('0x22')]=qs[_0x8e8f('0x22')](_0xfa3b8a['query'][_0x8e8f('0x22')]);_0x5c1480[_0x8e8f('0x20')]=qs[_0x8e8f('0x20')](_0xfa3b8a[_0x8e8f('0x33')][_0x8e8f('0x20')]);}_0x5c1480['order']=qs[_0x8e8f('0x3c')](_0xfa3b8a[_0x8e8f('0x33')]['sort']);_0x5c1480['where']=qs[_0x8e8f('0x35')](_['pick'](_0xfa3b8a[_0x8e8f('0x33')],_0x1910a7['filters']),_0x12c0dc);if(_0xfa3b8a[_0x8e8f('0x33')][_0x8e8f('0x3d')]){_0x5c1480[_0x8e8f('0x3e')]=_[_0x8e8f('0x3f')](_0x5c1480['where'],{'$or':_['map'](_0x12c0dc,function(_0x2f7a22){if(_0x2f7a22[_0x8e8f('0x30')]!==_0x8e8f('0x40')){var _0x450eac={};_0x450eac[_0x2f7a22[_0x8e8f('0x2b')]]={'$like':'%'+_0xfa3b8a['query'][_0x8e8f('0x3d')]+'%'};return _0x450eac;}})});}_0x5c1480=_[_0x8e8f('0x3f')]({},_0x5c1480,_0xfa3b8a[_0x8e8f('0x41')]);var _0x5de3c6={'where':_0x5c1480['where']};return db['SugarcrmField'][_0x8e8f('0x23')](_0x5de3c6)['then'](function(_0x341121){_0xae12d3[_0x8e8f('0x23')]=_0x341121;if(_0xfa3b8a[_0x8e8f('0x33')]['includeAll']){_0x5c1480[_0x8e8f('0x42')]=[{'all':!![]}];}return db[_0x8e8f('0x2e')][_0x8e8f('0x43')](_0x5c1480);})[_0x8e8f('0x27')](function(_0x23dac1){_0xae12d3[_0x8e8f('0x44')]=_0x23dac1;return _0xae12d3;})[_0x8e8f('0x27')](respondWithFilteredResult(_0x18dddf,_0x5c1480))[_0x8e8f('0x45')](handleError(_0x18dddf,null));};exports[_0x8e8f('0x46')]=function(_0x5c189d,_0x1986c4){var _0xdd3331={'raw':!![],'where':{'id':_0x5c189d['params']['id']}},_0x20987d={};_0x20987d[_0x8e8f('0x38')]=_['keys'](db['SugarcrmField'][_0x8e8f('0x2f')]);_0x20987d[_0x8e8f('0x33')]=_[_0x8e8f('0x34')](_0x5c189d[_0x8e8f('0x33')]);_0x20987d[_0x8e8f('0x35')]=_[_0x8e8f('0x36')](_0x20987d['model'],_0x20987d[_0x8e8f('0x33')]);_0xdd3331['attributes']=_[_0x8e8f('0x36')](_0x20987d['model'],qs[_0x8e8f('0x39')](_0x5c189d['query'][_0x8e8f('0x39')]));_0xdd3331['attributes']=_0xdd3331[_0x8e8f('0x37')][_0x8e8f('0x3a')]?_0xdd3331['attributes']:_0x20987d[_0x8e8f('0x38')];if(_0x5c189d['query'][_0x8e8f('0x47')]){_0xdd3331[_0x8e8f('0x42')]=[{'all':!![]}];}_0xdd3331=_[_0x8e8f('0x3f')]({},_0xdd3331,_0x5c189d[_0x8e8f('0x41')]);return db[_0x8e8f('0x2e')]['find'](_0xdd3331)['then'](handleEntityNotFound(_0x1986c4,null))[_0x8e8f('0x27')](respondWithResult(_0x1986c4,null))[_0x8e8f('0x45')](handleError(_0x1986c4,null));};exports[_0x8e8f('0x48')]=function(_0x425990,_0x2a1e8e){return db['SugarcrmField']['create'](_0x425990['body'],{})[_0x8e8f('0x27')](respondWithResult(_0x2a1e8e,0xc9))[_0x8e8f('0x45')](handleError(_0x2a1e8e,null));};exports[_0x8e8f('0x49')]=function(_0x497231,_0x4b6579){if(_0x497231[_0x8e8f('0x4a')]['id']){delete _0x497231[_0x8e8f('0x4a')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x497231[_0x8e8f('0x4b')]['id']}})[_0x8e8f('0x27')](handleEntityNotFound(_0x4b6579,null))[_0x8e8f('0x27')](saveUpdates(_0x497231[_0x8e8f('0x4a')],null))[_0x8e8f('0x27')](respondWithResult(_0x4b6579,null))['catch'](handleError(_0x4b6579,null));};exports[_0x8e8f('0x28')]=function(_0x156eb1,_0x5829e2){return db[_0x8e8f('0x2e')]['find']({'where':{'id':_0x156eb1[_0x8e8f('0x4b')]['id']}})[_0x8e8f('0x27')](handleEntityNotFound(_0x5829e2,null))['then'](removeEntity(_0x5829e2,null))['catch'](handleError(_0x5829e2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4f6f27a..00fba0a 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 _0xebb7=['SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xebb7,0x162));var _0x7ebb=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xebb7[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x7ebb('0x0'));var util=require(_0x7ebb('0x1'));var logger=require(_0x7ebb('0x2'))(_0x7ebb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ebb('0x4'));var fs=require('fs');var path=require(_0x7ebb('0x5'));var rimraf=require(_0x7ebb('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ebb('0x7'));module[_0x7ebb('0x8')]=function(_0x4ecfd1,_0x5948b7){return _0x4ecfd1[_0x7ebb('0x9')](_0x7ebb('0xa'),attributes,{'tableName':_0x7ebb('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7ebb('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf7d=['bluebird','request-promise','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','moment'];(function(_0x326fca,_0x434779){var _0x39e374=function(_0x37d1a1){while(--_0x37d1a1){_0x326fca['push'](_0x326fca['shift']());}};_0x39e374(++_0x434779);}(_0xdf7d,0x72));var _0xddf7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdf7d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xddf7('0x0'));var logger=require(_0xddf7('0x1'))('api');var moment=require(_0xddf7('0x2'));var BPromise=require(_0xddf7('0x3'));var rp=require(_0xddf7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddf7('0x5'));var config=require('../../config/environment');var attributes=require(_0xddf7('0x6'));module['exports']=function(_0x3583ef,_0x227b37){return _0x3583ef[_0xddf7('0x7')](_0xddf7('0x8'),attributes,{'tableName':_0xddf7('0x9'),'paranoid':![],'indexes':[{'name':_0xddf7('0xa'),'fields':[_0xddf7('0xb'),_0xddf7('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 017c110..49c300a 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 _0x9174=['error','code','message','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5d75a6,_0x4012ea){var _0x801009=function(_0x5cc872){while(--_0x5cc872){_0x5d75a6['push'](_0x5d75a6['shift']());}};_0x801009(++_0x4012ea);}(_0x9174,0x17d));var _0x4917=function(_0x4f1bbc,_0x33d39d){_0x4f1bbc=_0x4f1bbc-0x0;var _0x2fae93=_0x9174[_0x4f1bbc];return _0x2fae93;};'use strict';var _=require(_0x4917('0x0'));var util=require('util');var moment=require(_0x4917('0x1'));var BPromise=require(_0x4917('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4917('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4917('0x4'));var logger=require(_0x4917('0x5'))('rpc');var config=require(_0x4917('0x6'));var jayson=require(_0x4917('0x7'));var client=jayson['client'][_0x4917('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x112f0b,_0x368ff2,_0x5c3b7a){return new BPromise(function(_0x89f0a,_0x223f88){return client[_0x4917('0x9')](_0x112f0b,_0x5c3b7a)[_0x4917('0xa')](function(_0x4458b0){logger[_0x4917('0xb')](_0x4917('0xc'),_0x368ff2,_0x4917('0xd'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x368ff2,_0x4917('0xd'),JSON[_0x4917('0xe')](_0x4458b0));if(_0x4458b0[_0x4917('0xf')]){if(_0x4458b0[_0x4917('0xf')][_0x4917('0x10')]===0x1f4){logger[_0x4917('0xf')](_0x4917('0xc'),_0x368ff2,_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);return _0x223f88(_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);}logger[_0x4917('0xf')](_0x4917('0xc'),_0x368ff2,_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);return _0x89f0a(_0x4458b0[_0x4917('0xf')][_0x4917('0x11')]);}else{logger[_0x4917('0xb')](_0x4917('0xc'),_0x368ff2,'request\x20sent');_0x89f0a(_0x4458b0['result'][_0x4917('0x11')]);}})['catch'](function(_0x218d97){logger['error'](_0x4917('0xc'),_0x368ff2,_0x218d97);_0x223f88(_0x218d97);});});} \ No newline at end of file +var _0xdcc8=['error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x367fd7,_0x4e20ad){var _0x51827c=function(_0x30967f){while(--_0x30967f){_0x367fd7['push'](_0x367fd7['shift']());}};_0x51827c(++_0x4e20ad);}(_0xdcc8,0x1d1));var _0x8dcc=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xdcc8[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x8dcc('0x0'));var util=require(_0x8dcc('0x1'));var moment=require('moment');var BPromise=require(_0x8dcc('0x2'));var rs=require(_0x8dcc('0x3'));var fs=require('fs');var Redis=require(_0x8dcc('0x4'));var db=require(_0x8dcc('0x5'))['db'];var utils=require(_0x8dcc('0x6'));var logger=require(_0x8dcc('0x7'))(_0x8dcc('0x8'));var config=require(_0x8dcc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8dcc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32718a,_0x8ced50,_0x48ed00){return new BPromise(function(_0xf6dc98,_0x5f7d64){return client[_0x8dcc('0xb')](_0x32718a,_0x48ed00)['then'](function(_0x1272d1){logger[_0x8dcc('0xc')](_0x8dcc('0xd'),_0x8ced50,_0x8dcc('0xe'));logger[_0x8dcc('0xf')](_0x8dcc('0x10'),_0x8ced50,'request\x20sent',JSON[_0x8dcc('0x11')](_0x1272d1));if(_0x1272d1[_0x8dcc('0x12')]){if(_0x1272d1['error'][_0x8dcc('0x13')]===0x1f4){logger[_0x8dcc('0x12')](_0x8dcc('0xd'),_0x8ced50,_0x1272d1['error']['message']);return _0x5f7d64(_0x1272d1[_0x8dcc('0x12')][_0x8dcc('0x14')]);}logger['error'](_0x8dcc('0xd'),_0x8ced50,_0x1272d1['error'][_0x8dcc('0x14')]);return _0xf6dc98(_0x1272d1[_0x8dcc('0x12')][_0x8dcc('0x14')]);}else{logger[_0x8dcc('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x8ced50,_0x8dcc('0xe'));_0xf6dc98(_0x1272d1['result']['message']);}})['catch'](function(_0x2609a3){logger['error'](_0x8dcc('0xd'),_0x8ced50,_0x2609a3);_0x5f7d64(_0x2609a3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c21329e..d3c7800 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 _0x43f5=['index','show','/:id/configurations','getFields','create','post','put','/:id','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0x46d14b,_0x147907){var _0x367dfd=function(_0x117d8e){while(--_0x117d8e){_0x46d14b['push'](_0x46d14b['shift']());}};_0x367dfd(++_0x147907);}(_0x43f5,0x9d));var _0x543f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x43f5[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x543f('0x0'));var util=require(_0x543f('0x1'));var path=require('path');var timeout=require(_0x543f('0x2'));var express=require(_0x543f('0x3'));var router=express[_0x543f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x543f('0x5'));var interaction=require(_0x543f('0x6'));var config=require(_0x543f('0x7'));var controller=require(_0x543f('0x8'));router[_0x543f('0x9')]('/',auth[_0x543f('0xa')](),controller[_0x543f('0xb')]);router[_0x543f('0x9')]('/:id',auth[_0x543f('0xa')](),controller[_0x543f('0xc')]);router[_0x543f('0x9')](_0x543f('0xd'),auth[_0x543f('0xa')](),controller['getConfigurations']);router[_0x543f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x543f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x543f('0xf')]);router[_0x543f('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x543f('0x11')](_0x543f('0x12'),auth[_0x543f('0xa')](),controller['update']);router[_0x543f('0x13')](_0x543f('0x12'),auth[_0x543f('0xa')](),controller['destroy']);module[_0x543f('0x14')]=router; \ No newline at end of file +var _0x833b=['create','addConfiguration','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x833b,0x131));var _0xb833=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x833b[_0x4c445a];return _0x2f611c;};'use strict';var multer=require('multer');var util=require(_0xb833('0x0'));var path=require('path');var timeout=require(_0xb833('0x1'));var express=require('express');var router=express[_0xb833('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb833('0x3'));var interaction=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var controller=require(_0xb833('0x6'));router[_0xb833('0x7')]('/',auth[_0xb833('0x8')](),controller[_0xb833('0x9')]);router['get'](_0xb833('0xa'),auth[_0xb833('0x8')](),controller[_0xb833('0xb')]);router[_0xb833('0x7')](_0xb833('0xc'),auth[_0xb833('0x8')](),controller[_0xb833('0xd')]);router['get'](_0xb833('0xe'),auth['isAuthenticated'](),controller[_0xb833('0xf')]);router[_0xb833('0x10')]('/',auth[_0xb833('0x8')](),controller[_0xb833('0x11')]);router['post']('/:id/configurations',auth[_0xb833('0x8')](),controller[_0xb833('0x12')]);router['put'](_0xb833('0xa'),auth['isAuthenticated'](),controller[_0xb833('0x13')]);router[_0xb833('0x14')](_0xb833('0xa'),auth[_0xb833('0x8')](),controller[_0xb833('0x15')]);module[_0xb833('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9daa630..d52fab2 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 _0x5f22=['STRING','sequelize'];(function(_0x42f29e,_0xe41cc0){var _0xf6a61=function(_0x175932){while(--_0x175932){_0x42f29e['push'](_0x42f29e['shift']());}};_0xf6a61(++_0xe41cc0);}(_0x5f22,0x187));var _0x25f2=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x5f22[_0x406fbb];return _0x8e921d;};'use strict';var Sequelize=require(_0x25f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x25f2('0x1')]},'username':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x25f2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6d4f=['STRING','sequelize','exports'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x6d4f,0x17b));var _0xf6d4=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0x6d4f[_0x88ffd4];return _0x528f9c;};'use strict';var Sequelize=require(_0xf6d4('0x0'));module[_0xf6d4('0x1')]={'name':{'type':Sequelize[_0xf6d4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf6d4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xf6d4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xf6d4('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 9e74f5a..7629193 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 _0xf30e=['includes','editable','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','rawAttributes','type','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','VtigerAccount','length','find','catch','create','body','destroy','findOne','getConfigurations','hasOwnProperty','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','getFields','username','description','moduleName','remoteUri','accessKey','substring','lastIndexOf','%s/webservice.php','GET','success','login','result','token','describe','autogenerated','owner'];(function(_0x9307ea,_0x38968a){var _0x295554=function(_0x342dcf){while(--_0x342dcf){_0x9307ea['push'](_0x9307ea['shift']());}};_0x295554(++_0x38968a);}(_0xf30e,0xe7));var _0xef30=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xf30e[_0x4b26b5];return _0x4dec71;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xef30('0x0'));var rp=require(_0xef30('0x1'));var moment=require(_0xef30('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xef30('0x3'));var util=require('util');var path=require(_0xef30('0x4'));var sox=require(_0xef30('0x5'));var csv=require(_0xef30('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef30('0x7'));var _=require(_0xef30('0x8'));var squel=require(_0xef30('0x9'));var crypto=require('crypto');var jsforce=require(_0xef30('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xef30('0x6'));var querystring=require(_0xef30('0xb'));var Papa=require(_0xef30('0xc'));var Redis=require('ioredis');var authService=require(_0xef30('0xd'));var qs=require(_0xef30('0xe'));var as=require(_0xef30('0xf'));var hardwareService=require(_0xef30('0x10'));var logger=require(_0xef30('0x11'))(_0xef30('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef30('0x13'));var db=require(_0xef30('0x14'))['db'];var integrations=require(_0xef30('0x15'));function respondWithStatusCode(_0x59dcff,_0x54e806){_0x54e806=_0x54e806||0xcc;return function(_0x338f28){if(_0x338f28){return _0x59dcff['sendStatus'](_0x54e806);}return _0x59dcff['status'](_0x54e806)[_0xef30('0x16')]();};}function respondWithResult(_0x43ad40,_0x11b7ea){_0x11b7ea=_0x11b7ea||0xc8;return function(_0x1ba108){if(_0x1ba108){return _0x43ad40[_0xef30('0x17')](_0x11b7ea)[_0xef30('0x18')](_0x1ba108);}};}function respondWithFilteredResult(_0x5486ee,_0xc26d94){return function(_0x24d7f3){if(_0x24d7f3){var _0x546a52=typeof _0xc26d94[_0xef30('0x19')]==='undefined'&&typeof _0xc26d94[_0xef30('0x1a')]==='undefined';var _0x497617=_0x24d7f3[_0xef30('0x1b')];var _0x5f1dac=_0x546a52?0x0:_0xc26d94[_0xef30('0x19')];var _0x6ef6db=_0x546a52?_0x24d7f3['count']:_0xc26d94[_0xef30('0x19')]+_0xc26d94[_0xef30('0x1a')];var _0x3f8567;if(_0x6ef6db>=_0x497617){_0x6ef6db=_0x497617;_0x3f8567=0xc8;}else{_0x3f8567=0xce;}_0x5486ee[_0xef30('0x17')](_0x3f8567);return _0x5486ee[_0xef30('0x1c')](_0xef30('0x1d'),_0x5f1dac+'-'+_0x6ef6db+'/'+_0x497617)[_0xef30('0x18')](_0x24d7f3);}return null;};}function patchUpdates(_0x381f30){return function(_0x4a28c3){try{jsonpatch[_0xef30('0x1e')](_0x4a28c3,_0x381f30,!![]);}catch(_0x2a3716){return BPromise[_0xef30('0x1f')](_0x2a3716);}return _0x4a28c3[_0xef30('0x20')]();};}function saveUpdates(_0xcaf496,_0x4424b6){return function(_0x30dec4){if(_0x30dec4){return _0x30dec4['update'](_0xcaf496)['then'](function(_0x4a83d7){return _0x4a83d7;});}return null;};}function removeEntity(_0x3414d9,_0x2767e5){return function(_0x2c2b70){if(_0x2c2b70){return _0x2c2b70['destroy']()[_0xef30('0x21')](function(){_0x3414d9[_0xef30('0x17')](0xcc)[_0xef30('0x16')]();});}};}function handleEntityNotFound(_0x2a7398,_0x10e2d1){return function(_0x4e9645){if(!_0x4e9645){_0x2a7398[_0xef30('0x22')](0x194);}return _0x4e9645;};}function handleError(_0x25cf12,_0x228edf){_0x228edf=_0x228edf||0x1f4;return function(_0x5bd5fa){logger[_0xef30('0x23')](_0x5bd5fa['stack']);if(_0x5bd5fa[_0xef30('0x24')]){delete _0x5bd5fa['name'];}_0x25cf12[_0xef30('0x17')](_0x228edf)[_0xef30('0x25')](_0x5bd5fa);};}exports[_0xef30('0x26')]=function(_0x133851,_0x8498ab){var _0x10ec55={},_0x5ae69e={},_0x1bec3d={'count':0x0,'rows':[]};var _0x34f9ec=_[_0xef30('0x27')](db['VtigerAccount'][_0xef30('0x28')],function(_0x190f34){return{'name':_0x190f34['fieldName'],'type':_0x190f34[_0xef30('0x29')]['key']};});_0x5ae69e[_0xef30('0x2a')]=_['map'](_0x34f9ec,_0xef30('0x24'));_0x5ae69e[_0xef30('0x2b')]=_[_0xef30('0x2c')](_0x133851['query']);_0x5ae69e['filters']=_['intersection'](_0x5ae69e[_0xef30('0x2a')],_0x5ae69e[_0xef30('0x2b')]);_0x10ec55[_0xef30('0x2d')]=_[_0xef30('0x2e')](_0x5ae69e[_0xef30('0x2a')],qs[_0xef30('0x2f')](_0x133851[_0xef30('0x2b')][_0xef30('0x2f')]));_0x10ec55['attributes']=_0x10ec55[_0xef30('0x2d')]['length']?_0x10ec55[_0xef30('0x2d')]:_0x5ae69e['model'];if(!_0x133851[_0xef30('0x2b')]['hasOwnProperty'](_0xef30('0x30'))){_0x10ec55[_0xef30('0x1a')]=qs[_0xef30('0x1a')](_0x133851[_0xef30('0x2b')][_0xef30('0x1a')]);_0x10ec55['offset']=qs['offset'](_0x133851['query'][_0xef30('0x19')]);}_0x10ec55[_0xef30('0x31')]=qs[_0xef30('0x32')](_0x133851[_0xef30('0x2b')][_0xef30('0x32')]);_0x10ec55['where']=qs[_0xef30('0x33')](_[_0xef30('0x34')](_0x133851[_0xef30('0x2b')],_0x5ae69e[_0xef30('0x33')]),_0x34f9ec);if(_0x133851[_0xef30('0x2b')]['filter']){_0x10ec55[_0xef30('0x35')]=_['merge'](_0x10ec55['where'],{'$or':_[_0xef30('0x27')](_0x34f9ec,function(_0x5b531f){if(_0x5b531f[_0xef30('0x29')]!==_0xef30('0x36')){var _0x3fc211={};_0x3fc211[_0x5b531f[_0xef30('0x24')]]={'$like':'%'+_0x133851[_0xef30('0x2b')][_0xef30('0x37')]+'%'};return _0x3fc211;}})});}_0x10ec55=_[_0xef30('0x38')]({},_0x10ec55,_0x133851[_0xef30('0x39')]);var _0x58c3d7={'where':_0x10ec55['where']};return db['VtigerAccount']['count'](_0x58c3d7)['then'](function(_0xe08292){_0x1bec3d[_0xef30('0x1b')]=_0xe08292;if(_0x133851['query'][_0xef30('0x3a')]){_0x10ec55['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xef30('0x3b')](_0x10ec55);})[_0xef30('0x21')](function(_0x360cc5){_0x1bec3d[_0xef30('0x3c')]=_0x360cc5;return _0x1bec3d;})['then'](respondWithFilteredResult(_0x8498ab,_0x10ec55))['catch'](handleError(_0x8498ab,null));};exports[_0xef30('0x3d')]=function(_0x5cb1fb,_0x27a183){var _0x36f10c={'raw':![],'where':{'id':_0x5cb1fb[_0xef30('0x3e')]['id']}},_0x2656c5={};_0x2656c5[_0xef30('0x2a')]=_[_0xef30('0x2c')](db[_0xef30('0x3f')][_0xef30('0x28')]);_0x2656c5[_0xef30('0x2b')]=_[_0xef30('0x2c')](_0x5cb1fb['query']);_0x2656c5[_0xef30('0x33')]=_[_0xef30('0x2e')](_0x2656c5['model'],_0x2656c5[_0xef30('0x2b')]);_0x36f10c[_0xef30('0x2d')]=_['intersection'](_0x2656c5[_0xef30('0x2a')],qs['fields'](_0x5cb1fb['query']['fields']));_0x36f10c['attributes']=_0x36f10c[_0xef30('0x2d')][_0xef30('0x40')]?_0x36f10c['attributes']:_0x2656c5[_0xef30('0x2a')];if(_0x5cb1fb[_0xef30('0x2b')][_0xef30('0x3a')]){_0x36f10c['include']=[{'all':!![]}];}_0x36f10c=_[_0xef30('0x38')]({},_0x36f10c,_0x5cb1fb['options']);return db['VtigerAccount'][_0xef30('0x41')](_0x36f10c)['then'](handleEntityNotFound(_0x27a183,null))[_0xef30('0x21')](respondWithResult(_0x27a183,null))[_0xef30('0x42')](handleError(_0x27a183,null));};exports['create']=function(_0x69fa2b,_0x157525){return db[_0xef30('0x3f')][_0xef30('0x43')](_0x69fa2b[_0xef30('0x44')],{})[_0xef30('0x21')](respondWithResult(_0x157525,0xc9))['catch'](handleError(_0x157525,null));};exports['update']=function(_0x13b89a,_0x21a60c){if(_0x13b89a[_0xef30('0x44')]['id']){delete _0x13b89a[_0xef30('0x44')]['id'];}return db[_0xef30('0x3f')]['find']({'where':{'id':_0x13b89a[_0xef30('0x3e')]['id']}})[_0xef30('0x21')](handleEntityNotFound(_0x21a60c,null))[_0xef30('0x21')](saveUpdates(_0x13b89a['body'],null))[_0xef30('0x21')](respondWithResult(_0x21a60c,null))['catch'](handleError(_0x21a60c,null));};exports[_0xef30('0x45')]=function(_0x96344a,_0x5ce331){return db['VtigerAccount'][_0xef30('0x41')]({'where':{'id':_0x96344a[_0xef30('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ce331,null))['then'](removeEntity(_0x5ce331,null))['catch'](handleError(_0x5ce331,null));};exports['getConfigurations']=function(_0x311f56,_0x461fb3,_0x4122ef){var _0x5390bd={};var _0x5a3954={};var _0x7a70d9;var _0x1974d7;return db[_0xef30('0x3f')][_0xef30('0x46')]({'where':{'id':_0x311f56['params']['id']}})[_0xef30('0x21')](handleEntityNotFound(_0x461fb3,null))['then'](function(_0x3223c9){if(_0x3223c9){_0x7a70d9=_0x3223c9;_0x5a3954[_0xef30('0x2a')]=_[_0xef30('0x2c')](db['VtigerConfiguration'][_0xef30('0x28')]);_0x5a3954['query']=_[_0xef30('0x2c')](_0x311f56[_0xef30('0x2b')]);_0x5a3954['filters']=_[_0xef30('0x2e')](_0x5a3954[_0xef30('0x2a')],_0x5a3954[_0xef30('0x2b')]);_0x5390bd[_0xef30('0x2d')]=_['intersection'](_0x5a3954['model'],qs[_0xef30('0x2f')](_0x311f56[_0xef30('0x2b')][_0xef30('0x2f')]));_0x5390bd[_0xef30('0x2d')]=_0x5390bd[_0xef30('0x2d')]['length']?_0x5390bd[_0xef30('0x2d')]:_0x5a3954[_0xef30('0x2a')];_0x5390bd['order']=qs[_0xef30('0x32')](_0x311f56[_0xef30('0x2b')][_0xef30('0x32')]);_0x5390bd[_0xef30('0x35')]=qs['filters'](_[_0xef30('0x34')](_0x311f56[_0xef30('0x2b')],_0x5a3954['filters']));if(_0x311f56[_0xef30('0x2b')][_0xef30('0x37')]){_0x5390bd['where']=_[_0xef30('0x38')](_0x5390bd['where'],{'$or':_[_0xef30('0x27')](_0x5390bd[_0xef30('0x2d')],function(_0x3ccebd){var _0x2717b7={};_0x2717b7[_0x3ccebd]={'$like':'%'+_0x311f56[_0xef30('0x2b')][_0xef30('0x37')]+'%'};return _0x2717b7;})});}_0x5390bd=_[_0xef30('0x38')]({},_0x5390bd,_0x311f56['options']);return _0x7a70d9[_0xef30('0x47')](_0x5390bd);}})[_0xef30('0x21')](function(_0x473d0c){if(_0x473d0c){_0x1974d7=_0x473d0c[_0xef30('0x40')];if(!_0x311f56['query'][_0xef30('0x48')]('nolimit')){_0x5390bd[_0xef30('0x1a')]=qs[_0xef30('0x1a')](_0x311f56['query'][_0xef30('0x1a')]);_0x5390bd[_0xef30('0x19')]=qs[_0xef30('0x19')](_0x311f56[_0xef30('0x2b')]['offset']);}return _0x7a70d9[_0xef30('0x47')](_0x5390bd);}})[_0xef30('0x21')](function(_0x52603e){if(_0x52603e){return _0x52603e?{'count':_0x1974d7,'rows':_0x52603e}:null;}})[_0xef30('0x21')](respondWithResult(_0x461fb3,null))[_0xef30('0x42')](handleError(_0x461fb3,null));};exports['addConfiguration']=function(_0x59084a,_0x55db23,_0x5ef785){if(_0x59084a['body']['id']){delete _0x59084a[_0xef30('0x44')]['id'];}return db['VtigerAccount'][_0xef30('0x46')]({'where':{'id':_0x59084a['params']['id']}})['then'](handleEntityNotFound(_0x55db23,null))['then'](function(_0x369a61){if(_0x369a61){_0x59084a[_0xef30('0x44')]['AccountId']=_0x369a61['id'];_0x59084a['body'][_0xef30('0x49')]=integrations[_0xef30('0x4a')](_0x59084a['body']['channel'],_0x59084a[_0xef30('0x44')][_0xef30('0x29')]);_0x59084a[_0xef30('0x44')][_0xef30('0x4b')]=integrations[_0xef30('0x4c')](_0x59084a[_0xef30('0x44')][_0xef30('0x4d')],_0x59084a[_0xef30('0x44')][_0xef30('0x29')]);return db['VtigerConfiguration'][_0xef30('0x43')](_0x59084a[_0xef30('0x44')],{'include':[{'model':db[_0xef30('0x4e')],'as':_0xef30('0x49')},{'model':db[_0xef30('0x4e')],'as':_0xef30('0x4b')}]});}return null;})[_0xef30('0x21')](respondWithResult(_0x55db23,null))[_0xef30('0x42')](handleError(_0x55db23,null));};var md5=require('md5');exports[_0xef30('0x4f')]=function(_0x1e6351,_0x2337d4,_0x14a603){var _0x4601b7=null;var _0x4e4387=null;var _0x33c1de=null;var _0x2a9acf=null;var _0x2fdcd8='';return db['VtigerAccount'][_0xef30('0x46')]({'where':{'id':_0x1e6351['params']['id']},'attributes':['id',_0xef30('0x24'),_0xef30('0x50'),_0xef30('0x51'),_0xef30('0x52'),_0xef30('0x53'),'serverUrl',_0xef30('0x54')]})[_0xef30('0x21')](handleEntityNotFound(_0x2337d4,null))[_0xef30('0x21')](function(_0xc052d5){if(_0xc052d5){_0x4601b7=_0xc052d5[_0xef30('0x50')];_0x4e4387=_0xc052d5[_0xef30('0x54')];_0x33c1de=_0xc052d5['moduleName'];_0x2fdcd8=_0xc052d5['remoteUri'];var _0x182f0d=_0x2fdcd8['slice'](-0x1);if(_0x182f0d==='/'){_0x2fdcd8=_0x2fdcd8[_0xef30('0x55')](0x0,_0x2fdcd8[_0xef30('0x56')](_0x182f0d));}_0x2a9acf=util['format'](_0xef30('0x57'),_0x2fdcd8);var _0x1dec01={'method':_0xef30('0x58'),'uri':_0x2a9acf,'qs':{'operation':'getchallenge','username':_0xc052d5[_0xef30('0x50')]},'json':!![]};return rp(_0x1dec01);}})[_0xef30('0x21')](function(_0x4e0cdb){if(_0x4e0cdb[_0xef30('0x59')]){var _0x17fe33={'method':'POST','uri':_0x2a9acf,'form':{'operation':_0xef30('0x5a'),'username':_0x4601b7,'accessKey':md5(_0x4e0cdb[_0xef30('0x5b')][_0xef30('0x5c')]+_0x4e4387)},'json':!![]};return rp(_0x17fe33);}})['then'](function(_0x3f2d66){if(_0x3f2d66[_0xef30('0x59')]){var _0x35b80f={'method':'GET','uri':_0x2a9acf,'qs':{'operation':_0xef30('0x5d'),'username':_0x4601b7,'sessionName':_0x3f2d66[_0xef30('0x5b')]['sessionName'],'elementType':_0x33c1de},'json':!![]};return rp(_0x35b80f);}})['then'](function(_0x2be5cf){if(_0x2be5cf[_0xef30('0x59')]){var _0x2b0122=[_0xef30('0x5e'),'reference',_0xef30('0x5f')];_['remove'](_0x2be5cf['result']['fields'],function(_0x142eca){return _0x2b0122[_0xef30('0x60')](_0x142eca[_0xef30('0x29')][_0xef30('0x24')]);});_['remove'](_0x2be5cf['result'][_0xef30('0x2f')],function(_0x955ad8){return _0x955ad8[_0xef30('0x61')]==='false';});return{'count':_0x2be5cf[_0xef30('0x5b')][_0xef30('0x2f')][_0xef30('0x40')],'rows':_[_0xef30('0x27')](_0x2be5cf['result'][_0xef30('0x2f')],function(_0x1a5979){return{'id':_0x1a5979['name'],'name':_0x1a5979[_0xef30('0x62')],'custom':_[_0xef30('0x63')](_0x1a5979['name'],_0xef30('0x64'))?!![]:![],'options':_0x1a5979[_0xef30('0x29')][_0xef30('0x24')]===_0xef30('0x65')&&_0x1a5979['type']['picklistValues']['length']>0x0?_['map'](_0x1a5979[_0xef30('0x29')][_0xef30('0x66')],function(_0x4f802d){return{'name':_0x4f802d[_0xef30('0x62')],'value':_0x4f802d['value']};}):[]};})};}})[_0xef30('0x21')](respondWithResult(_0x2337d4,null))[_0xef30('0x42')](function(_0xcb78ff){console['log'](_0xef30('0x67')+_0xcb78ff);var _0x52e14f=_0x1e6351['query'][_0xef30('0x68')]?0x1f4:_0xcb78ff[_0xef30('0x69')]||0x1f4;logger['error'](_0xef30('0x6a'),_0xef30('0x4f'),_0x52e14f,JSON[_0xef30('0x6b')](_0xcb78ff));delete _0xcb78ff[_0xef30('0x24')];if(_0x52e14f===0x191){_0x52e14f=0x190;}_0x2337d4['status'](_0x52e14f)['send'](_0x1e6351[_0xef30('0x2b')][_0xef30('0x68')]?{'message':_0xef30('0x6c'),'statusCode':_0xcb78ff['statusCode']}:_0xcb78ff);});}; \ No newline at end of file +var _0xe9a4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','then','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','getchallenge','success','POST','result','sessionName','autogenerated','reference','remove','includes','editable','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x51f97f,_0x487b4e){var _0x49e6ad=function(_0x269044){while(--_0x269044){_0x51f97f['push'](_0x51f97f['shift']());}};_0x49e6ad(++_0x487b4e);}(_0xe9a4,0x1d5));var _0x4e9a=function(_0x106db6,_0xd6decc){_0x106db6=_0x106db6-0x0;var _0x4dc175=_0xe9a4[_0x106db6];return _0x4dc175;};'use strict';var emlformat=require(_0x4e9a('0x0'));var rimraf=require(_0x4e9a('0x1'));var zipdir=require(_0x4e9a('0x2'));var jsonpatch=require(_0x4e9a('0x3'));var rp=require(_0x4e9a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e9a('0x5'));var util=require(_0x4e9a('0x6'));var path=require(_0x4e9a('0x7'));var sox=require(_0x4e9a('0x8'));var csv=require(_0x4e9a('0x9'));var ejs=require(_0x4e9a('0xa'));var fs=require('fs');var fs_extra=require(_0x4e9a('0xb'));var _=require(_0x4e9a('0xc'));var squel=require(_0x4e9a('0xd'));var crypto=require(_0x4e9a('0xe'));var jsforce=require(_0x4e9a('0xf'));var deskjs=require(_0x4e9a('0x10'));var toCsv=require(_0x4e9a('0x9'));var querystring=require(_0x4e9a('0x11'));var Papa=require(_0x4e9a('0x12'));var Redis=require(_0x4e9a('0x13'));var authService=require(_0x4e9a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4e9a('0x15'));var hardwareService=require(_0x4e9a('0x16'));var logger=require(_0x4e9a('0x17'))(_0x4e9a('0x18'));var utils=require(_0x4e9a('0x19'));var config=require(_0x4e9a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e9a('0x1b'))['db'];var integrations=require(_0x4e9a('0x1c'));function respondWithStatusCode(_0x45a548,_0x2fa403){_0x2fa403=_0x2fa403||0xcc;return function(_0x15b1ff){if(_0x15b1ff){return _0x45a548['sendStatus'](_0x2fa403);}return _0x45a548['status'](_0x2fa403)['end']();};}function respondWithResult(_0x58c458,_0x21ffa4){_0x21ffa4=_0x21ffa4||0xc8;return function(_0x2e00a6){if(_0x2e00a6){return _0x58c458[_0x4e9a('0x1d')](_0x21ffa4)['json'](_0x2e00a6);}};}function respondWithFilteredResult(_0x575cc7,_0x508a88){return function(_0x43259d){if(_0x43259d){var _0x1f8616=typeof _0x508a88[_0x4e9a('0x1e')]===_0x4e9a('0x1f')&&typeof _0x508a88[_0x4e9a('0x20')]===_0x4e9a('0x1f');var _0xeb18ab=_0x43259d[_0x4e9a('0x21')];var _0x3f6e03=_0x1f8616?0x0:_0x508a88[_0x4e9a('0x1e')];var _0x5a2791=_0x1f8616?_0x43259d['count']:_0x508a88['offset']+_0x508a88[_0x4e9a('0x20')];var _0x680240;if(_0x5a2791>=_0xeb18ab){_0x5a2791=_0xeb18ab;_0x680240=0xc8;}else{_0x680240=0xce;}_0x575cc7[_0x4e9a('0x1d')](_0x680240);return _0x575cc7[_0x4e9a('0x22')](_0x4e9a('0x23'),_0x3f6e03+'-'+_0x5a2791+'/'+_0xeb18ab)['json'](_0x43259d);}return null;};}function patchUpdates(_0x5846d2){return function(_0x8fe286){try{jsonpatch[_0x4e9a('0x24')](_0x8fe286,_0x5846d2,!![]);}catch(_0x595d62){return BPromise[_0x4e9a('0x25')](_0x595d62);}return _0x8fe286['save']();};}function saveUpdates(_0x32336d,_0x4391a0){return function(_0x562ea3){if(_0x562ea3){return _0x562ea3[_0x4e9a('0x26')](_0x32336d)['then'](function(_0x504d41){return _0x504d41;});}return null;};}function removeEntity(_0x420ad7,_0x57b58a){return function(_0x10c098){if(_0x10c098){return _0x10c098[_0x4e9a('0x27')]()['then'](function(){_0x420ad7[_0x4e9a('0x1d')](0xcc)[_0x4e9a('0x28')]();});}};}function handleEntityNotFound(_0xb36810,_0x34a9d3){return function(_0x2cb17e){if(!_0x2cb17e){_0xb36810[_0x4e9a('0x29')](0x194);}return _0x2cb17e;};}function handleError(_0x5c8aec,_0x5359b9){_0x5359b9=_0x5359b9||0x1f4;return function(_0x446004){logger[_0x4e9a('0x2a')](_0x446004[_0x4e9a('0x2b')]);if(_0x446004[_0x4e9a('0x2c')]){delete _0x446004['name'];}_0x5c8aec[_0x4e9a('0x1d')](_0x5359b9)[_0x4e9a('0x2d')](_0x446004);};}exports[_0x4e9a('0x2e')]=function(_0x3fdc84,_0x335d82){var _0x3466b7={},_0xb772c1={},_0x209beb={'count':0x0,'rows':[]};var _0x4e77f3=_[_0x4e9a('0x2f')](db['VtigerAccount']['rawAttributes'],function(_0x23ff8b){return{'name':_0x23ff8b[_0x4e9a('0x30')],'type':_0x23ff8b[_0x4e9a('0x31')][_0x4e9a('0x32')]};});_0xb772c1[_0x4e9a('0x33')]=_[_0x4e9a('0x2f')](_0x4e77f3,'name');_0xb772c1[_0x4e9a('0x34')]=_[_0x4e9a('0x35')](_0x3fdc84['query']);_0xb772c1[_0x4e9a('0x36')]=_['intersection'](_0xb772c1[_0x4e9a('0x33')],_0xb772c1[_0x4e9a('0x34')]);_0x3466b7[_0x4e9a('0x37')]=_[_0x4e9a('0x38')](_0xb772c1['model'],qs[_0x4e9a('0x39')](_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x39')]));_0x3466b7[_0x4e9a('0x37')]=_0x3466b7[_0x4e9a('0x37')][_0x4e9a('0x3a')]?_0x3466b7[_0x4e9a('0x37')]:_0xb772c1[_0x4e9a('0x33')];if(!_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x3b')](_0x4e9a('0x3c'))){_0x3466b7[_0x4e9a('0x20')]=qs[_0x4e9a('0x20')](_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x20')]);_0x3466b7['offset']=qs[_0x4e9a('0x1e')](_0x3fdc84['query'][_0x4e9a('0x1e')]);}_0x3466b7['order']=qs[_0x4e9a('0x3d')](_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x3d')]);_0x3466b7[_0x4e9a('0x3e')]=qs[_0x4e9a('0x36')](_[_0x4e9a('0x3f')](_0x3fdc84['query'],_0xb772c1['filters']),_0x4e77f3);if(_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x40')]){_0x3466b7[_0x4e9a('0x3e')]=_[_0x4e9a('0x41')](_0x3466b7[_0x4e9a('0x3e')],{'$or':_[_0x4e9a('0x2f')](_0x4e77f3,function(_0x1eecee){if(_0x1eecee[_0x4e9a('0x31')]!==_0x4e9a('0x42')){var _0x4bd84e={};_0x4bd84e[_0x1eecee[_0x4e9a('0x2c')]]={'$like':'%'+_0x3fdc84['query']['filter']+'%'};return _0x4bd84e;}})});}_0x3466b7=_[_0x4e9a('0x41')]({},_0x3466b7,_0x3fdc84[_0x4e9a('0x43')]);var _0x390700={'where':_0x3466b7[_0x4e9a('0x3e')]};return db[_0x4e9a('0x44')][_0x4e9a('0x21')](_0x390700)[_0x4e9a('0x45')](function(_0x157213){_0x209beb[_0x4e9a('0x21')]=_0x157213;if(_0x3fdc84[_0x4e9a('0x34')][_0x4e9a('0x46')]){_0x3466b7[_0x4e9a('0x47')]=[{'all':!![]}];}return db[_0x4e9a('0x44')][_0x4e9a('0x48')](_0x3466b7);})[_0x4e9a('0x45')](function(_0x461b16){_0x209beb['rows']=_0x461b16;return _0x209beb;})[_0x4e9a('0x45')](respondWithFilteredResult(_0x335d82,_0x3466b7))[_0x4e9a('0x49')](handleError(_0x335d82,null));};exports[_0x4e9a('0x4a')]=function(_0x107fbf,_0x631d80){var _0x42977f={'raw':![],'where':{'id':_0x107fbf[_0x4e9a('0x4b')]['id']}},_0x2a30b5={};_0x2a30b5[_0x4e9a('0x33')]=_[_0x4e9a('0x35')](db[_0x4e9a('0x44')][_0x4e9a('0x4c')]);_0x2a30b5[_0x4e9a('0x34')]=_[_0x4e9a('0x35')](_0x107fbf['query']);_0x2a30b5[_0x4e9a('0x36')]=_[_0x4e9a('0x38')](_0x2a30b5['model'],_0x2a30b5['query']);_0x42977f[_0x4e9a('0x37')]=_[_0x4e9a('0x38')](_0x2a30b5[_0x4e9a('0x33')],qs[_0x4e9a('0x39')](_0x107fbf[_0x4e9a('0x34')][_0x4e9a('0x39')]));_0x42977f[_0x4e9a('0x37')]=_0x42977f[_0x4e9a('0x37')][_0x4e9a('0x3a')]?_0x42977f['attributes']:_0x2a30b5[_0x4e9a('0x33')];if(_0x107fbf['query'][_0x4e9a('0x46')]){_0x42977f[_0x4e9a('0x47')]=[{'all':!![]}];}_0x42977f=_[_0x4e9a('0x41')]({},_0x42977f,_0x107fbf['options']);return db['VtigerAccount']['find'](_0x42977f)['then'](handleEntityNotFound(_0x631d80,null))[_0x4e9a('0x45')](respondWithResult(_0x631d80,null))[_0x4e9a('0x49')](handleError(_0x631d80,null));};exports[_0x4e9a('0x4d')]=function(_0x4ec233,_0x4e3aa7){return db['VtigerAccount']['create'](_0x4ec233[_0x4e9a('0x4e')],{})[_0x4e9a('0x45')](respondWithResult(_0x4e3aa7,0xc9))[_0x4e9a('0x49')](handleError(_0x4e3aa7,null));};exports[_0x4e9a('0x26')]=function(_0x51124a,_0x8d1b25){if(_0x51124a['body']['id']){delete _0x51124a[_0x4e9a('0x4e')]['id'];}return db[_0x4e9a('0x44')]['find']({'where':{'id':_0x51124a[_0x4e9a('0x4b')]['id']}})[_0x4e9a('0x45')](handleEntityNotFound(_0x8d1b25,null))['then'](saveUpdates(_0x51124a[_0x4e9a('0x4e')],null))[_0x4e9a('0x45')](respondWithResult(_0x8d1b25,null))[_0x4e9a('0x49')](handleError(_0x8d1b25,null));};exports['destroy']=function(_0x43058c,_0x25637a){return db['VtigerAccount'][_0x4e9a('0x4f')]({'where':{'id':_0x43058c['params']['id']}})[_0x4e9a('0x45')](handleEntityNotFound(_0x25637a,null))['then'](removeEntity(_0x25637a,null))['catch'](handleError(_0x25637a,null));};exports[_0x4e9a('0x50')]=function(_0x2a0a6d,_0x13ad73,_0x1120ef){var _0x4d123d={};var _0x3a5cf7={};var _0x420eb7;var _0x23e21f;return db[_0x4e9a('0x44')][_0x4e9a('0x51')]({'where':{'id':_0x2a0a6d[_0x4e9a('0x4b')]['id']}})[_0x4e9a('0x45')](handleEntityNotFound(_0x13ad73,null))[_0x4e9a('0x45')](function(_0x206c17){if(_0x206c17){_0x420eb7=_0x206c17;_0x3a5cf7[_0x4e9a('0x33')]=_[_0x4e9a('0x35')](db['VtigerConfiguration']['rawAttributes']);_0x3a5cf7['query']=_[_0x4e9a('0x35')](_0x2a0a6d[_0x4e9a('0x34')]);_0x3a5cf7[_0x4e9a('0x36')]=_[_0x4e9a('0x38')](_0x3a5cf7[_0x4e9a('0x33')],_0x3a5cf7[_0x4e9a('0x34')]);_0x4d123d[_0x4e9a('0x37')]=_[_0x4e9a('0x38')](_0x3a5cf7[_0x4e9a('0x33')],qs[_0x4e9a('0x39')](_0x2a0a6d[_0x4e9a('0x34')]['fields']));_0x4d123d[_0x4e9a('0x37')]=_0x4d123d[_0x4e9a('0x37')][_0x4e9a('0x3a')]?_0x4d123d[_0x4e9a('0x37')]:_0x3a5cf7[_0x4e9a('0x33')];_0x4d123d['order']=qs['sort'](_0x2a0a6d[_0x4e9a('0x34')][_0x4e9a('0x3d')]);_0x4d123d[_0x4e9a('0x3e')]=qs[_0x4e9a('0x36')](_[_0x4e9a('0x3f')](_0x2a0a6d[_0x4e9a('0x34')],_0x3a5cf7[_0x4e9a('0x36')]));if(_0x2a0a6d[_0x4e9a('0x34')][_0x4e9a('0x40')]){_0x4d123d[_0x4e9a('0x3e')]=_[_0x4e9a('0x41')](_0x4d123d[_0x4e9a('0x3e')],{'$or':_[_0x4e9a('0x2f')](_0x4d123d[_0x4e9a('0x37')],function(_0x37ce5f){var _0x300ac0={};_0x300ac0[_0x37ce5f]={'$like':'%'+_0x2a0a6d['query']['filter']+'%'};return _0x300ac0;})});}_0x4d123d=_[_0x4e9a('0x41')]({},_0x4d123d,_0x2a0a6d[_0x4e9a('0x43')]);return _0x420eb7[_0x4e9a('0x50')](_0x4d123d);}})[_0x4e9a('0x45')](function(_0x3b5b91){if(_0x3b5b91){_0x23e21f=_0x3b5b91[_0x4e9a('0x3a')];if(!_0x2a0a6d[_0x4e9a('0x34')][_0x4e9a('0x3b')](_0x4e9a('0x3c'))){_0x4d123d['limit']=qs['limit'](_0x2a0a6d[_0x4e9a('0x34')][_0x4e9a('0x20')]);_0x4d123d[_0x4e9a('0x1e')]=qs[_0x4e9a('0x1e')](_0x2a0a6d['query'][_0x4e9a('0x1e')]);}return _0x420eb7[_0x4e9a('0x50')](_0x4d123d);}})[_0x4e9a('0x45')](function(_0x46dfb3){if(_0x46dfb3){return _0x46dfb3?{'count':_0x23e21f,'rows':_0x46dfb3}:null;}})[_0x4e9a('0x45')](respondWithResult(_0x13ad73,null))[_0x4e9a('0x49')](handleError(_0x13ad73,null));};exports[_0x4e9a('0x52')]=function(_0xe2d272,_0x523055,_0x18ea2d){if(_0xe2d272[_0x4e9a('0x4e')]['id']){delete _0xe2d272[_0x4e9a('0x4e')]['id'];}return db[_0x4e9a('0x44')][_0x4e9a('0x51')]({'where':{'id':_0xe2d272[_0x4e9a('0x4b')]['id']}})[_0x4e9a('0x45')](handleEntityNotFound(_0x523055,null))[_0x4e9a('0x45')](function(_0x57c29f){if(_0x57c29f){_0xe2d272[_0x4e9a('0x4e')]['AccountId']=_0x57c29f['id'];_0xe2d272[_0x4e9a('0x4e')]['Subjects']=integrations[_0x4e9a('0x53')](_0xe2d272[_0x4e9a('0x4e')][_0x4e9a('0x54')],_0xe2d272[_0x4e9a('0x4e')][_0x4e9a('0x31')]);_0xe2d272[_0x4e9a('0x4e')][_0x4e9a('0x55')]=integrations[_0x4e9a('0x56')](_0xe2d272[_0x4e9a('0x4e')][_0x4e9a('0x54')],_0xe2d272['body'][_0x4e9a('0x31')]);return db['VtigerConfiguration'][_0x4e9a('0x4d')](_0xe2d272[_0x4e9a('0x4e')],{'include':[{'model':db[_0x4e9a('0x57')],'as':_0x4e9a('0x58')},{'model':db[_0x4e9a('0x57')],'as':_0x4e9a('0x55')}]});}return null;})[_0x4e9a('0x45')](respondWithResult(_0x523055,null))[_0x4e9a('0x49')](handleError(_0x523055,null));};var md5=require(_0x4e9a('0x59'));exports[_0x4e9a('0x5a')]=function(_0x464c4f,_0x64ca2c,_0x4fc55e){var _0x25be13=null;var _0x240c12=null;var _0x309699=null;var _0x253a3f=null;var _0x121a2d='';return db[_0x4e9a('0x44')][_0x4e9a('0x51')]({'where':{'id':_0x464c4f[_0x4e9a('0x4b')]['id']},'attributes':['id',_0x4e9a('0x2c'),_0x4e9a('0x5b'),'description','moduleName',_0x4e9a('0x5c'),_0x4e9a('0x5d'),'accessKey']})['then'](handleEntityNotFound(_0x64ca2c,null))[_0x4e9a('0x45')](function(_0x42f0c2){if(_0x42f0c2){_0x25be13=_0x42f0c2['username'];_0x240c12=_0x42f0c2[_0x4e9a('0x5e')];_0x309699=_0x42f0c2['moduleName'];_0x121a2d=_0x42f0c2[_0x4e9a('0x5c')];var _0x5635cc=_0x121a2d[_0x4e9a('0x5f')](-0x1);if(_0x5635cc==='/'){_0x121a2d=_0x121a2d['substring'](0x0,_0x121a2d[_0x4e9a('0x60')](_0x5635cc));}_0x253a3f=util[_0x4e9a('0x61')]('%s/webservice.php',_0x121a2d);var _0x40d946={'method':'GET','uri':_0x253a3f,'qs':{'operation':_0x4e9a('0x62'),'username':_0x42f0c2[_0x4e9a('0x5b')]},'json':!![]};return rp(_0x40d946);}})[_0x4e9a('0x45')](function(_0xc444c){if(_0xc444c[_0x4e9a('0x63')]){var _0x212d97={'method':_0x4e9a('0x64'),'uri':_0x253a3f,'form':{'operation':'login','username':_0x25be13,'accessKey':md5(_0xc444c[_0x4e9a('0x65')]['token']+_0x240c12)},'json':!![]};return rp(_0x212d97);}})['then'](function(_0x497ed9){if(_0x497ed9[_0x4e9a('0x63')]){var _0x286ed0={'method':'GET','uri':_0x253a3f,'qs':{'operation':'describe','username':_0x25be13,'sessionName':_0x497ed9[_0x4e9a('0x65')][_0x4e9a('0x66')],'elementType':_0x309699},'json':!![]};return rp(_0x286ed0);}})[_0x4e9a('0x45')](function(_0x42c222){if(_0x42c222[_0x4e9a('0x63')]){var _0x1163ad=[_0x4e9a('0x67'),_0x4e9a('0x68'),'owner'];_[_0x4e9a('0x69')](_0x42c222[_0x4e9a('0x65')][_0x4e9a('0x39')],function(_0x375204){return _0x1163ad[_0x4e9a('0x6a')](_0x375204[_0x4e9a('0x31')][_0x4e9a('0x2c')]);});_['remove'](_0x42c222[_0x4e9a('0x65')][_0x4e9a('0x39')],function(_0x3c9b8f){return _0x3c9b8f[_0x4e9a('0x6b')]==='false';});return{'count':_0x42c222[_0x4e9a('0x65')][_0x4e9a('0x39')]['length'],'rows':_[_0x4e9a('0x2f')](_0x42c222[_0x4e9a('0x65')][_0x4e9a('0x39')],function(_0x3b56d1){return{'id':_0x3b56d1[_0x4e9a('0x2c')],'name':_0x3b56d1['label'],'custom':_[_0x4e9a('0x6c')](_0x3b56d1[_0x4e9a('0x2c')],_0x4e9a('0x6d'))?!![]:![],'options':_0x3b56d1[_0x4e9a('0x31')]['name']===_0x4e9a('0x6e')&&_0x3b56d1[_0x4e9a('0x31')][_0x4e9a('0x6f')][_0x4e9a('0x3a')]>0x0?_[_0x4e9a('0x2f')](_0x3b56d1[_0x4e9a('0x31')][_0x4e9a('0x6f')],function(_0x534b6a){return{'name':_0x534b6a[_0x4e9a('0x70')],'value':_0x534b6a[_0x4e9a('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x64ca2c,null))[_0x4e9a('0x49')](function(_0x425df7){console[_0x4e9a('0x72')](_0x4e9a('0x73')+_0x425df7);var _0x4dafc8=_0x464c4f[_0x4e9a('0x34')][_0x4e9a('0x74')]?0x1f4:_0x425df7[_0x4e9a('0x75')]||0x1f4;logger[_0x4e9a('0x2a')](_0x4e9a('0x76'),_0x4e9a('0x5a'),_0x4dafc8,JSON[_0x4e9a('0x77')](_0x425df7));delete _0x425df7['name'];if(_0x4dafc8===0x191){_0x4dafc8=0x190;}_0x64ca2c[_0x4e9a('0x1d')](_0x4dafc8)[_0x4e9a('0x2d')](_0x464c4f['query'][_0x4e9a('0x74')]?{'message':_0x4e9a('0x78'),'statusCode':_0x425df7[_0x4e9a('0x75')]}:_0x425df7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 362a37c..02a7f9a 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 _0x81fc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x81fc,0x106));var _0xc81f=function(_0x701f97,_0x323d8d){_0x701f97=_0x701f97-0x0;var _0x5a2b76=_0x81fc[_0x701f97];return _0x5a2b76;};'use strict';var _=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var logger=require(_0xc81f('0x2'))(_0xc81f('0x3'));var moment=require(_0xc81f('0x4'));var BPromise=require(_0xc81f('0x5'));var rp=require(_0xc81f('0x6'));var fs=require('fs');var path=require(_0xc81f('0x7'));var rimraf=require(_0xc81f('0x8'));var config=require(_0xc81f('0x9'));var attributes=require(_0xc81f('0xa'));var integrations=require(_0xc81f('0xb'));module[_0xc81f('0xc')]=function(_0x209f9a,_0x4d61f5){return _0x209f9a[_0xc81f('0xd')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x769b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','VtigerAccount'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x769b,0x134));var _0xb769=function(_0x5f25a9,_0x4b8a7d){_0x5f25a9=_0x5f25a9-0x0;var _0xb840e6=_0x769b[_0x5f25a9];return _0xb840e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb769('0x0'))(_0xb769('0x1'));var moment=require(_0xb769('0x2'));var BPromise=require(_0xb769('0x3'));var rp=require(_0xb769('0x4'));var fs=require('fs');var path=require(_0xb769('0x5'));var rimraf=require(_0xb769('0x6'));var config=require(_0xb769('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xb769('0x8'));module[_0xb769('0x9')]=function(_0x316fc3,_0x3dd0df){return _0x316fc3['define'](_0xb769('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index f9aac9f..66b9d20 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 _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x947079,_0x3f1e56){var _0x568dba=function(_0x13b82f){while(--_0x13b82f){_0x947079['push'](_0x947079['shift']());}};_0x568dba(++_0x3f1e56);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5df35c,_0x2ab072){_0x5df35c=_0x5df35c-0x0;var _0x5233be=_0xa5fa[_0x5df35c];return _0x5233be;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetVtigerAccount',_0x3d874f);logger[_0xaa5f('0xd')]('GetVtigerAccount',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetVtigerAccount',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowVtigerAccount',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0x4e81=['find','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','map','include','model','attributes','ShowVtigerAccount'];(function(_0x10556e,_0x2d90e9){var _0x3d5075=function(_0x136b70){while(--_0x136b70){_0x10556e['push'](_0x10556e['shift']());}};_0x3d5075(++_0x2d90e9);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0x4e81[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')]({'raw':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0x10dc8b['options']?_0x10dc8b[_0x14e8('0x18')]['attributes']||null:null,'limit':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')][_0x14e8('0x1a')]||null:null,'include':_0x10dc8b[_0x14e8('0x18')]?_0x10dc8b[_0x14e8('0x18')]['include']?_[_0x14e8('0x1b')](_0x10dc8b['options'][_0x14e8('0x1c')],function(_0x185a0e){return{'model':db[_0x185a0e['model']],'as':_0x185a0e['as'],'attributes':_0x185a0e['attributes'],'include':_0x185a0e['include']?_[_0x14e8('0x1b')](_0x185a0e[_0x14e8('0x1c')],function(_0x3eae0b){return{'model':db[_0x3eae0b[_0x14e8('0x1d')]],'as':_0x3eae0b['as'],'attributes':_0x3eae0b[_0x14e8('0x1e')],'include':_0x3eae0b['include']?_[_0x14e8('0x1b')](_0x3eae0b[_0x14e8('0x1c')],function(_0x3c09cb){return{'model':db[_0x3c09cb[_0x14e8('0x1d')]],'as':_0x3c09cb['as'],'attributes':_0x3c09cb[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2813ae){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger[_0x14e8('0xd')](_0x14e8('0x15'),_0x10dc8b,JSON['stringify'](_0x2813ae));_0x5a38c1(_0x2813ae);})['catch'](function(_0x5cacd7){logger[_0x14e8('0x10')](_0x14e8('0x15'),_0x5cacd7['message'],_0x10dc8b);_0x328c5a(_0x462259[_0x14e8('0x10')](0x1f4,_0x5cacd7[_0x14e8('0x13')]));});});};exports[_0x14e8('0x1f')]=function(_0xa83433){var _0x5c2635=this;return new Promise(function(_0x1f1259,_0x260d51){return db[_0x14e8('0x16')][_0x14e8('0x20')]({'raw':_0xa83433[_0x14e8('0x18')]?_0xa83433['options'][_0x14e8('0x21')]===undefined?!![]:![]:!![],'where':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x19')]||null:null,'attributes':_0xa83433['options']?_0xa83433[_0x14e8('0x18')]['attributes']||null:null,'include':_0xa83433[_0x14e8('0x18')]?_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xa83433[_0x14e8('0x18')][_0x14e8('0x1c')],function(_0xbe9eab){return{'model':db[_0xbe9eab[_0x14e8('0x1d')]],'as':_0xbe9eab['as'],'attributes':_0xbe9eab[_0x14e8('0x1e')],'include':_0xbe9eab[_0x14e8('0x1c')]?_[_0x14e8('0x1b')](_0xbe9eab[_0x14e8('0x1c')],function(_0x54e624){return{'model':db[_0x54e624['model']],'as':_0x54e624['as'],'attributes':_0x54e624['attributes'],'include':_0x54e624[_0x14e8('0x1c')]?_['map'](_0x54e624[_0x14e8('0x1c')],function(_0x5bdf42){return{'model':db[_0x5bdf42[_0x14e8('0x1d')]],'as':_0x5bdf42['as'],'attributes':_0x5bdf42[_0x14e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x14e8('0xa')](function(_0x2fc030){logger['info'](_0x14e8('0x1f'),_0xa83433);logger['debug'](_0x14e8('0x1f'),_0xa83433,JSON[_0x14e8('0xf')](_0x2fc030));_0x1f1259(_0x2fc030);})[_0x14e8('0x14')](function(_0x1fda35){logger[_0x14e8('0x10')](_0x14e8('0x1f'),_0x1fda35['message'],_0xa83433);_0x260d51(_0x5c2635[_0x14e8('0x10')](0x1f4,_0x1fda35['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3dd3e19..424c0f3 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 _0xb41c=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','get'];(function(_0x2714ce,_0x4214b3){var _0x1d5cba=function(_0x321964){while(--_0x321964){_0x2714ce['push'](_0x2714ce['shift']());}};_0x1d5cba(++_0x4214b3);}(_0xb41c,0x114));var _0xcb41=function(_0x21e153,_0x1cb3c3){_0x21e153=_0x21e153-0x0;var _0x38d924=_0xb41c[_0x21e153];return _0x38d924;};'use strict';var multer=require(_0xcb41('0x0'));var util=require(_0xcb41('0x1'));var path=require(_0xcb41('0x2'));var timeout=require(_0xcb41('0x3'));var express=require(_0xcb41('0x4'));var router=express[_0xcb41('0x5')]();var fs_extra=require(_0xcb41('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcb41('0x7'));var config=require('../../config/environment');var controller=require(_0xcb41('0x8'));router['get']('/',auth[_0xcb41('0x9')](),controller[_0xcb41('0xa')]);router[_0xcb41('0xb')](_0xcb41('0xc'),auth[_0xcb41('0x9')](),controller[_0xcb41('0xd')]);router[_0xcb41('0xb')](_0xcb41('0xe'),auth[_0xcb41('0x9')](),controller[_0xcb41('0xf')]);router[_0xcb41('0xb')](_0xcb41('0x10'),auth[_0xcb41('0x9')](),controller[_0xcb41('0x11')]);router[_0xcb41('0xb')](_0xcb41('0x12'),auth['isAuthenticated'](),controller[_0xcb41('0x13')]);router['post']('/',auth[_0xcb41('0x9')](),controller[_0xcb41('0x14')]);router[_0xcb41('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcb41('0x16')]('/:id',auth[_0xcb41('0x9')](),controller['destroy']);module[_0xcb41('0x17')]=router; \ No newline at end of file +var _0x53ad=['../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x37205f,_0x88790c){var _0x1d470f=function(_0x66680e){while(--_0x66680e){_0x37205f['push'](_0x37205f['shift']());}};_0x1d470f(++_0x88790c);}(_0x53ad,0x123));var _0xd53a=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x53ad[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0xd53a('0x0'));var util=require(_0xd53a('0x1'));var path=require(_0xd53a('0x2'));var timeout=require(_0xd53a('0x3'));var express=require('express');var router=express[_0xd53a('0x4')]();var fs_extra=require(_0xd53a('0x5'));var auth=require(_0xd53a('0x6'));var interaction=require(_0xd53a('0x7'));var config=require(_0xd53a('0x8'));var controller=require(_0xd53a('0x9'));router['get']('/',auth[_0xd53a('0xa')](),controller['index']);router[_0xd53a('0xb')](_0xd53a('0xc'),auth[_0xd53a('0xa')](),controller[_0xd53a('0xd')]);router[_0xd53a('0xb')](_0xd53a('0xe'),auth[_0xd53a('0xa')](),controller['getFields']);router[_0xd53a('0xb')](_0xd53a('0xf'),auth[_0xd53a('0xa')](),controller['getSubjects']);router[_0xd53a('0xb')](_0xd53a('0x10'),auth[_0xd53a('0xa')](),controller[_0xd53a('0x11')]);router[_0xd53a('0x12')]('/',auth[_0xd53a('0xa')](),controller['create']);router['put'](_0xd53a('0xc'),auth[_0xd53a('0xa')](),controller[_0xd53a('0x13')]);router[_0xd53a('0x14')](_0xd53a('0xc'),auth[_0xd53a('0xa')](),controller[_0xd53a('0x15')]);module[_0xd53a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c5c53d1..45b05ae 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 _0xbf2e=['sequelize','exports','STRING'];(function(_0x52c613,_0x53587a){var _0x3010a5=function(_0x5683b1){while(--_0x5683b1){_0x52c613['push'](_0x52c613['shift']());}};_0x3010a5(++_0x53587a);}(_0xbf2e,0xab));var _0xebf2=function(_0x1ee2a3,_0x139f54){_0x1ee2a3=_0x1ee2a3-0x0;var _0x37c06f=_0xbf2e[_0x1ee2a3];return _0x37c06f;};'use strict';var Sequelize=require(_0xebf2('0x0'));module[_0xebf2('0x1')]={'name':{'type':Sequelize[_0xebf2('0x2')]},'description':{'type':Sequelize[_0xebf2('0x2')]}}; \ No newline at end of file +var _0x0013=['exports','STRING','sequelize'];(function(_0x464a68,_0x350c11){var _0x45c471=function(_0x39b067){while(--_0x39b067){_0x464a68['push'](_0x464a68['shift']());}};_0x45c471(++_0x350c11);}(_0x0013,0x6b));var _0x3001=function(_0x1d809b,_0x2d978a){_0x1d809b=_0x1d809b-0x0;var _0x2637ab=_0x0013[_0x1d809b];return _0x2637ab;};'use strict';var Sequelize=require(_0x3001('0x0'));module[_0x3001('0x1')]={'name':{'type':Sequelize[_0x3001('0x2')]},'description':{'type':Sequelize[_0x3001('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 11a2cf2..ef0a8ae 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 _0x7754=['fast-json-patch','request-promise','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerConfiguration','includeAll','include','findAll','rows','params','fields','create','body','catch','find','VtigerField','pick','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir'];(function(_0x422b48,_0xf131fb){var _0x4a6f67=function(_0x13309e){while(--_0x13309e){_0x422b48['push'](_0x422b48['shift']());}};_0x4a6f67(++_0xf131fb);}(_0x7754,0x1d7));var _0x4775=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x7754[_0x25c326];return _0x762452;};'use strict';var emlformat=require(_0x4775('0x0'));var rimraf=require(_0x4775('0x1'));var zipdir=require(_0x4775('0x2'));var jsonpatch=require(_0x4775('0x3'));var rp=require(_0x4775('0x4'));var moment=require('moment');var BPromise=require(_0x4775('0x5'));var Mustache=require(_0x4775('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4775('0x7'));var csv=require('to-csv');var ejs=require(_0x4775('0x8'));var fs=require('fs');var fs_extra=require(_0x4775('0x9'));var _=require('lodash');var squel=require(_0x4775('0xa'));var crypto=require(_0x4775('0xb'));var jsforce=require(_0x4775('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4775('0xd'));var Papa=require(_0x4775('0xe'));var Redis=require('ioredis');var authService=require(_0x4775('0xf'));var qs=require(_0x4775('0x10'));var as=require(_0x4775('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4775('0x12'))(_0x4775('0x13'));var utils=require('../../config/utils');var config=require(_0x4775('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4775('0x15'))['db'];function respondWithStatusCode(_0x2373d0,_0x9ecd23){_0x9ecd23=_0x9ecd23||0xcc;return function(_0x585b7e){if(_0x585b7e){return _0x2373d0[_0x4775('0x16')](_0x9ecd23);}return _0x2373d0[_0x4775('0x17')](_0x9ecd23)[_0x4775('0x18')]();};}function respondWithResult(_0x572a32,_0x3a65d2){_0x3a65d2=_0x3a65d2||0xc8;return function(_0x2f02a7){if(_0x2f02a7){return _0x572a32[_0x4775('0x17')](_0x3a65d2)[_0x4775('0x19')](_0x2f02a7);}};}function respondWithFilteredResult(_0x36a0e2,_0x2c595b){return function(_0x8d9cf1){if(_0x8d9cf1){var _0xb83394=typeof _0x2c595b['offset']==='undefined'&&typeof _0x2c595b[_0x4775('0x1a')]===_0x4775('0x1b');var _0x58b63b=_0x8d9cf1[_0x4775('0x1c')];var _0x25c740=_0xb83394?0x0:_0x2c595b['offset'];var _0x370f20=_0xb83394?_0x8d9cf1[_0x4775('0x1c')]:_0x2c595b[_0x4775('0x1d')]+_0x2c595b[_0x4775('0x1a')];var _0x27f990;if(_0x370f20>=_0x58b63b){_0x370f20=_0x58b63b;_0x27f990=0xc8;}else{_0x27f990=0xce;}_0x36a0e2[_0x4775('0x17')](_0x27f990);return _0x36a0e2[_0x4775('0x1e')](_0x4775('0x1f'),_0x25c740+'-'+_0x370f20+'/'+_0x58b63b)[_0x4775('0x19')](_0x8d9cf1);}return null;};}function patchUpdates(_0x22e92a){return function(_0xb0f44c){try{jsonpatch[_0x4775('0x20')](_0xb0f44c,_0x22e92a,!![]);}catch(_0x16a277){return BPromise['reject'](_0x16a277);}return _0xb0f44c[_0x4775('0x21')]();};}function saveUpdates(_0x2508a5,_0x2cd7d9){return function(_0x242d95){if(_0x242d95){return _0x242d95[_0x4775('0x22')](_0x2508a5)[_0x4775('0x23')](function(_0x2481fb){return _0x2481fb;});}return null;};}function removeEntity(_0x4363e4,_0x13d794){return function(_0x19fe64){if(_0x19fe64){return _0x19fe64[_0x4775('0x24')]()[_0x4775('0x23')](function(){_0x4363e4[_0x4775('0x17')](0xcc)[_0x4775('0x18')]();});}};}function handleEntityNotFound(_0x1b125f,_0x516483){return function(_0x1ada1c){if(!_0x1ada1c){_0x1b125f['sendStatus'](0x194);}return _0x1ada1c;};}function handleError(_0x5ec017,_0x9edce6){_0x9edce6=_0x9edce6||0x1f4;return function(_0x28411a){logger[_0x4775('0x25')](_0x28411a[_0x4775('0x26')]);if(_0x28411a[_0x4775('0x27')]){delete _0x28411a[_0x4775('0x27')];}_0x5ec017['status'](_0x9edce6)[_0x4775('0x28')](_0x28411a);};}exports[_0x4775('0x29')]=function(_0x135730,_0x758626){var _0x5811a1={},_0x1bdbe1={},_0x5a8090={'count':0x0,'rows':[]};var _0xd77757=_[_0x4775('0x2a')](db['VtigerConfiguration'][_0x4775('0x2b')],function(_0x23acc6){return{'name':_0x23acc6[_0x4775('0x2c')],'type':_0x23acc6[_0x4775('0x2d')][_0x4775('0x2e')]};});_0x1bdbe1[_0x4775('0x2f')]=_[_0x4775('0x2a')](_0xd77757,_0x4775('0x27'));_0x1bdbe1[_0x4775('0x30')]=_[_0x4775('0x31')](_0x135730[_0x4775('0x30')]);_0x1bdbe1[_0x4775('0x32')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],_0x1bdbe1[_0x4775('0x30')]);_0x5811a1[_0x4775('0x34')]=_[_0x4775('0x33')](_0x1bdbe1[_0x4775('0x2f')],qs['fields'](_0x135730['query']['fields']));_0x5811a1[_0x4775('0x34')]=_0x5811a1[_0x4775('0x34')][_0x4775('0x35')]?_0x5811a1[_0x4775('0x34')]:_0x1bdbe1[_0x4775('0x2f')];if(!_0x135730[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x5811a1['limit']=qs[_0x4775('0x1a')](_0x135730[_0x4775('0x30')]['limit']);_0x5811a1[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x135730[_0x4775('0x30')]['offset']);}_0x5811a1[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x135730[_0x4775('0x30')]['sort']);_0x5811a1[_0x4775('0x3a')]=qs['filters'](_['pick'](_0x135730[_0x4775('0x30')],_0x1bdbe1['filters']),_0xd77757);if(_0x135730[_0x4775('0x30')][_0x4775('0x3b')]){_0x5811a1[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x5811a1[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0xd77757,function(_0x13d1f5){if(_0x13d1f5[_0x4775('0x2d')]!=='VIRTUAL'){var _0x5b3146={};_0x5b3146[_0x13d1f5[_0x4775('0x27')]]={'$like':'%'+_0x135730['query'][_0x4775('0x3b')]+'%'};return _0x5b3146;}})});}_0x5811a1=_['merge']({},_0x5811a1,_0x135730[_0x4775('0x3d')]);var _0x1094a4={'where':_0x5811a1[_0x4775('0x3a')]};return db[_0x4775('0x3e')][_0x4775('0x1c')](_0x1094a4)[_0x4775('0x23')](function(_0x26655b){_0x5a8090[_0x4775('0x1c')]=_0x26655b;if(_0x135730[_0x4775('0x30')][_0x4775('0x3f')]){_0x5811a1[_0x4775('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x4775('0x41')](_0x5811a1);})[_0x4775('0x23')](function(_0x25720a){_0x5a8090[_0x4775('0x42')]=_0x25720a;return _0x5a8090;})[_0x4775('0x23')](respondWithFilteredResult(_0x758626,_0x5811a1))['catch'](handleError(_0x758626,null));};exports['show']=function(_0x357cde,_0x1f9b6e){var _0x42aa2e={'raw':![],'where':{'id':_0x357cde[_0x4775('0x43')]['id']}},_0x4a5b7f={};_0x4a5b7f[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x3e')][_0x4775('0x2b')]);_0x4a5b7f['query']=_[_0x4775('0x31')](_0x357cde[_0x4775('0x30')]);_0x4a5b7f[_0x4775('0x32')]=_[_0x4775('0x33')](_0x4a5b7f['model'],_0x4a5b7f[_0x4775('0x30')]);_0x42aa2e['attributes']=_['intersection'](_0x4a5b7f['model'],qs['fields'](_0x357cde[_0x4775('0x30')][_0x4775('0x44')]));_0x42aa2e[_0x4775('0x34')]=_0x42aa2e[_0x4775('0x34')][_0x4775('0x35')]?_0x42aa2e[_0x4775('0x34')]:_0x4a5b7f[_0x4775('0x2f')];if(_0x357cde[_0x4775('0x30')]['includeAll']){_0x42aa2e[_0x4775('0x40')]=[{'all':!![]}];}_0x42aa2e=_[_0x4775('0x3c')]({},_0x42aa2e,_0x357cde[_0x4775('0x3d')]);return db[_0x4775('0x3e')]['find'](_0x42aa2e)[_0x4775('0x23')](handleEntityNotFound(_0x1f9b6e,null))[_0x4775('0x23')](respondWithResult(_0x1f9b6e,null))['catch'](handleError(_0x1f9b6e,null));};exports[_0x4775('0x45')]=function(_0x5e6662,_0x40e2e0){return db[_0x4775('0x3e')][_0x4775('0x45')](_0x5e6662[_0x4775('0x46')],{})[_0x4775('0x23')](respondWithResult(_0x40e2e0,0xc9))[_0x4775('0x47')](handleError(_0x40e2e0,null));};exports[_0x4775('0x22')]=function(_0x386177,_0x3673e5){if(_0x386177[_0x4775('0x46')]['id']){delete _0x386177[_0x4775('0x46')]['id'];}return db[_0x4775('0x3e')][_0x4775('0x48')]({'where':{'id':_0x386177[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3673e5,null))['then'](saveUpdates(_0x386177[_0x4775('0x46')],null))[_0x4775('0x23')](respondWithResult(_0x3673e5,null))[_0x4775('0x47')](handleError(_0x3673e5,null));};exports[_0x4775('0x24')]=function(_0x28c900,_0x28a0c9){return db[_0x4775('0x3e')]['find']({'where':{'id':_0x28c900[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x28a0c9,null))['then'](removeEntity(_0x28a0c9,null))[_0x4775('0x47')](handleError(_0x28a0c9,null));};exports['getFields']=function(_0x1243cd,_0x3ed3b5,_0x27dd39){var _0x34faf7={};var _0x371dad={};var _0x3b2327;var _0x6a4d19;return db[_0x4775('0x3e')]['findOne']({'where':{'id':_0x1243cd[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x3ed3b5,null))[_0x4775('0x23')](function(_0x50b7d3){if(_0x50b7d3){_0x3b2327=_0x50b7d3;_0x371dad[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x371dad[_0x4775('0x30')]=_['keys'](_0x1243cd[_0x4775('0x30')]);_0x371dad['filters']=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],_0x371dad['query']);_0x34faf7[_0x4775('0x34')]=_[_0x4775('0x33')](_0x371dad[_0x4775('0x2f')],qs['fields'](_0x1243cd[_0x4775('0x30')][_0x4775('0x44')]));_0x34faf7[_0x4775('0x34')]=_0x34faf7[_0x4775('0x34')]['length']?_0x34faf7[_0x4775('0x34')]:_0x371dad[_0x4775('0x2f')];_0x34faf7[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x1243cd['query'][_0x4775('0x39')]);_0x34faf7[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x1243cd['query'],_0x371dad['filters']));if(_0x1243cd['query'][_0x4775('0x3b')]){_0x34faf7[_0x4775('0x3a')]=_[_0x4775('0x3c')](_0x34faf7['where'],{'$or':_[_0x4775('0x2a')](_0x34faf7[_0x4775('0x34')],function(_0x4efe85){var _0x212344={};_0x212344[_0x4efe85]={'$like':'%'+_0x1243cd[_0x4775('0x30')]['filter']+'%'};return _0x212344;})});}_0x34faf7=_[_0x4775('0x3c')]({},_0x34faf7,_0x1243cd[_0x4775('0x3d')]);return _0x3b2327['getFields'](_0x34faf7);}})['then'](function(_0x929413){if(_0x929413){_0x6a4d19=_0x929413[_0x4775('0x35')];if(!_0x1243cd['query']['hasOwnProperty'](_0x4775('0x37'))){_0x34faf7[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x1243cd['query'][_0x4775('0x1a')]);_0x34faf7[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x1243cd['query'][_0x4775('0x1d')]);}return _0x3b2327[_0x4775('0x4b')](_0x34faf7);}})[_0x4775('0x23')](function(_0x2446ba){if(_0x2446ba){return _0x2446ba?{'count':_0x6a4d19,'rows':_0x2446ba}:null;}})[_0x4775('0x23')](respondWithResult(_0x3ed3b5,null))[_0x4775('0x47')](handleError(_0x3ed3b5,null));};exports[_0x4775('0x4c')]=function(_0x438dbf,_0x45cdfe,_0x441df9){var _0x8e3312={};var _0x36fb9b={};var _0x8928ed;var _0x3f2edd;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x438dbf[_0x4775('0x43')]['id']}})[_0x4775('0x23')](handleEntityNotFound(_0x45cdfe,null))[_0x4775('0x23')](function(_0x29a6b4){if(_0x29a6b4){_0x8928ed=_0x29a6b4;_0x36fb9b[_0x4775('0x2f')]=_[_0x4775('0x31')](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x36fb9b[_0x4775('0x30')]=_['keys'](_0x438dbf[_0x4775('0x30')]);_0x36fb9b[_0x4775('0x32')]=_['intersection'](_0x36fb9b[_0x4775('0x2f')],_0x36fb9b[_0x4775('0x30')]);_0x8e3312[_0x4775('0x34')]=_[_0x4775('0x33')](_0x36fb9b[_0x4775('0x2f')],qs['fields'](_0x438dbf[_0x4775('0x30')][_0x4775('0x44')]));_0x8e3312['attributes']=_0x8e3312['attributes'][_0x4775('0x35')]?_0x8e3312['attributes']:_0x36fb9b[_0x4775('0x2f')];_0x8e3312[_0x4775('0x38')]=qs[_0x4775('0x39')](_0x438dbf[_0x4775('0x30')]['sort']);_0x8e3312['where']=qs['filters'](_['pick'](_0x438dbf[_0x4775('0x30')],_0x36fb9b[_0x4775('0x32')]));if(_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]){_0x8e3312[_0x4775('0x3a')]=_['merge'](_0x8e3312[_0x4775('0x3a')],{'$or':_[_0x4775('0x2a')](_0x8e3312[_0x4775('0x34')],function(_0x836aa7){var _0x1eea7a={};_0x1eea7a[_0x836aa7]={'$like':'%'+_0x438dbf[_0x4775('0x30')][_0x4775('0x3b')]+'%'};return _0x1eea7a;})});}_0x8e3312=_[_0x4775('0x3c')]({},_0x8e3312,_0x438dbf[_0x4775('0x3d')]);return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x3bd1f3){if(_0x3bd1f3){_0x3f2edd=_0x3bd1f3['length'];if(!_0x438dbf['query'][_0x4775('0x36')](_0x4775('0x37'))){_0x8e3312[_0x4775('0x1a')]=qs[_0x4775('0x1a')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1a')]);_0x8e3312[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x438dbf[_0x4775('0x30')][_0x4775('0x1d')]);}return _0x8928ed[_0x4775('0x4c')](_0x8e3312);}})[_0x4775('0x23')](function(_0x1e0978){if(_0x1e0978){return _0x1e0978?{'count':_0x3f2edd,'rows':_0x1e0978}:null;}})[_0x4775('0x23')](respondWithResult(_0x45cdfe,null))[_0x4775('0x47')](handleError(_0x45cdfe,null));};exports[_0x4775('0x4e')]=function(_0x163b10,_0x51adcb,_0x3a2a54){var _0x327834={};var _0x451d6e={};var _0x2f13a2;var _0x25c89d;return db[_0x4775('0x3e')][_0x4775('0x4d')]({'where':{'id':_0x163b10[_0x4775('0x43')]['id']}})['then'](handleEntityNotFound(_0x51adcb,null))[_0x4775('0x23')](function(_0x3d25d8){if(_0x3d25d8){_0x2f13a2=_0x3d25d8;_0x451d6e[_0x4775('0x2f')]=_['keys'](db[_0x4775('0x49')][_0x4775('0x2b')]);_0x451d6e[_0x4775('0x30')]=_[_0x4775('0x31')](_0x163b10[_0x4775('0x30')]);_0x451d6e[_0x4775('0x32')]=_[_0x4775('0x33')](_0x451d6e[_0x4775('0x2f')],_0x451d6e[_0x4775('0x30')]);_0x327834[_0x4775('0x34')]=_['intersection'](_0x451d6e[_0x4775('0x2f')],qs[_0x4775('0x44')](_0x163b10['query']['fields']));_0x327834[_0x4775('0x34')]=_0x327834[_0x4775('0x34')][_0x4775('0x35')]?_0x327834[_0x4775('0x34')]:_0x451d6e[_0x4775('0x2f')];_0x327834['order']=qs[_0x4775('0x39')](_0x163b10[_0x4775('0x30')][_0x4775('0x39')]);_0x327834[_0x4775('0x3a')]=qs[_0x4775('0x32')](_[_0x4775('0x4a')](_0x163b10[_0x4775('0x30')],_0x451d6e[_0x4775('0x32')]));if(_0x163b10[_0x4775('0x30')]['filter']){_0x327834['where']=_[_0x4775('0x3c')](_0x327834[_0x4775('0x3a')],{'$or':_['map'](_0x327834[_0x4775('0x34')],function(_0x2a4278){var _0x1ff832={};_0x1ff832[_0x2a4278]={'$like':'%'+_0x163b10['query'][_0x4775('0x3b')]+'%'};return _0x1ff832;})});}_0x327834=_[_0x4775('0x3c')]({},_0x327834,_0x163b10[_0x4775('0x3d')]);return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x208c1a){if(_0x208c1a){_0x25c89d=_0x208c1a[_0x4775('0x35')];if(!_0x163b10[_0x4775('0x30')][_0x4775('0x36')](_0x4775('0x37'))){_0x327834['limit']=qs[_0x4775('0x1a')](_0x163b10[_0x4775('0x30')]['limit']);_0x327834[_0x4775('0x1d')]=qs[_0x4775('0x1d')](_0x163b10['query'][_0x4775('0x1d')]);}return _0x2f13a2[_0x4775('0x4e')](_0x327834);}})[_0x4775('0x23')](function(_0x229575){if(_0x229575){return _0x229575?{'count':_0x25c89d,'rows':_0x229575}:null;}})[_0x4775('0x23')](respondWithResult(_0x51adcb,null))[_0x4775('0x47')](handleError(_0x51adcb,null));}; \ No newline at end of file +var _0xbd6a=['getFields','getSubjects','findOne','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','count','limit','set','json','reject','save','update','then','status','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','destroy','VtigerField'];(function(_0x26442e,_0x16197f){var _0x31f6a3=function(_0x3404e4){while(--_0x3404e4){_0x26442e['push'](_0x26442e['shift']());}};_0x31f6a3(++_0x16197f);}(_0xbd6a,0x140));var _0xabd6=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xbd6a[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabd6('0x0'));var zipdir=require(_0xabd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabd6('0x2'));var moment=require(_0xabd6('0x3'));var BPromise=require(_0xabd6('0x4'));var Mustache=require(_0xabd6('0x5'));var util=require(_0xabd6('0x6'));var path=require('path');var sox=require(_0xabd6('0x7'));var csv=require('to-csv');var ejs=require(_0xabd6('0x8'));var fs=require('fs');var fs_extra=require(_0xabd6('0x9'));var _=require('lodash');var squel=require(_0xabd6('0xa'));var crypto=require(_0xabd6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xabd6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabd6('0xd'));var Papa=require(_0xabd6('0xe'));var Redis=require(_0xabd6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xabd6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabd6('0x11'));var logger=require(_0xabd6('0x12'))(_0xabd6('0x13'));var utils=require(_0xabd6('0x14'));var config=require(_0xabd6('0x15'));var licenseUtil=require(_0xabd6('0x16'));var db=require(_0xabd6('0x17'))['db'];function respondWithStatusCode(_0x5a79e7,_0x504eb3){_0x504eb3=_0x504eb3||0xcc;return function(_0x827b93){if(_0x827b93){return _0x5a79e7[_0xabd6('0x18')](_0x504eb3);}return _0x5a79e7['status'](_0x504eb3)['end']();};}function respondWithResult(_0x2a60c7,_0x12587b){_0x12587b=_0x12587b||0xc8;return function(_0x2f761b){if(_0x2f761b){return _0x2a60c7['status'](_0x12587b)['json'](_0x2f761b);}};}function respondWithFilteredResult(_0x1e7f06,_0x525b19){return function(_0x58ac82){if(_0x58ac82){var _0x131fee=typeof _0x525b19[_0xabd6('0x19')]===_0xabd6('0x1a')&&typeof _0x525b19['limit']===_0xabd6('0x1a');var _0x1589ca=_0x58ac82[_0xabd6('0x1b')];var _0x28c99c=_0x131fee?0x0:_0x525b19['offset'];var _0x595f61=_0x131fee?_0x58ac82[_0xabd6('0x1b')]:_0x525b19[_0xabd6('0x19')]+_0x525b19[_0xabd6('0x1c')];var _0x1e6244;if(_0x595f61>=_0x1589ca){_0x595f61=_0x1589ca;_0x1e6244=0xc8;}else{_0x1e6244=0xce;}_0x1e7f06['status'](_0x1e6244);return _0x1e7f06[_0xabd6('0x1d')]('Content-Range',_0x28c99c+'-'+_0x595f61+'/'+_0x1589ca)[_0xabd6('0x1e')](_0x58ac82);}return null;};}function patchUpdates(_0x2096d8){return function(_0x2d3eac){try{jsonpatch['apply'](_0x2d3eac,_0x2096d8,!![]);}catch(_0x9794e4){return BPromise[_0xabd6('0x1f')](_0x9794e4);}return _0x2d3eac[_0xabd6('0x20')]();};}function saveUpdates(_0x1b93cb,_0x3b3f7a){return function(_0x54d48c){if(_0x54d48c){return _0x54d48c[_0xabd6('0x21')](_0x1b93cb)[_0xabd6('0x22')](function(_0x430bd5){return _0x430bd5;});}return null;};}function removeEntity(_0xa66ab6,_0x2ef757){return function(_0x5c968a){if(_0x5c968a){return _0x5c968a['destroy']()[_0xabd6('0x22')](function(){_0xa66ab6[_0xabd6('0x23')](0xcc)[_0xabd6('0x24')]();});}};}function handleEntityNotFound(_0x7fc445,_0x4e1763){return function(_0x16408a){if(!_0x16408a){_0x7fc445['sendStatus'](0x194);}return _0x16408a;};}function handleError(_0x5e2799,_0x2a5077){_0x2a5077=_0x2a5077||0x1f4;return function(_0x2a777c){logger['error'](_0x2a777c[_0xabd6('0x25')]);if(_0x2a777c[_0xabd6('0x26')]){delete _0x2a777c['name'];}_0x5e2799['status'](_0x2a5077)[_0xabd6('0x27')](_0x2a777c);};}exports[_0xabd6('0x28')]=function(_0x56a345,_0x54d7e1){var _0x3af8d9={},_0x5433f2={},_0x374711={'count':0x0,'rows':[]};var _0x344bc6=_[_0xabd6('0x29')](db[_0xabd6('0x2a')][_0xabd6('0x2b')],function(_0x1f35c4){return{'name':_0x1f35c4[_0xabd6('0x2c')],'type':_0x1f35c4['type'][_0xabd6('0x2d')]};});_0x5433f2[_0xabd6('0x2e')]=_[_0xabd6('0x29')](_0x344bc6,_0xabd6('0x26'));_0x5433f2[_0xabd6('0x2f')]=_['keys'](_0x56a345[_0xabd6('0x2f')]);_0x5433f2[_0xabd6('0x30')]=_[_0xabd6('0x31')](_0x5433f2[_0xabd6('0x2e')],_0x5433f2[_0xabd6('0x2f')]);_0x3af8d9[_0xabd6('0x32')]=_['intersection'](_0x5433f2['model'],qs[_0xabd6('0x33')](_0x56a345['query'][_0xabd6('0x33')]));_0x3af8d9[_0xabd6('0x32')]=_0x3af8d9[_0xabd6('0x32')][_0xabd6('0x34')]?_0x3af8d9[_0xabd6('0x32')]:_0x5433f2['model'];if(!_0x56a345[_0xabd6('0x2f')][_0xabd6('0x35')](_0xabd6('0x36'))){_0x3af8d9['limit']=qs['limit'](_0x56a345[_0xabd6('0x2f')][_0xabd6('0x1c')]);_0x3af8d9[_0xabd6('0x19')]=qs[_0xabd6('0x19')](_0x56a345[_0xabd6('0x2f')]['offset']);}_0x3af8d9[_0xabd6('0x37')]=qs[_0xabd6('0x38')](_0x56a345[_0xabd6('0x2f')][_0xabd6('0x38')]);_0x3af8d9[_0xabd6('0x39')]=qs[_0xabd6('0x30')](_[_0xabd6('0x3a')](_0x56a345[_0xabd6('0x2f')],_0x5433f2['filters']),_0x344bc6);if(_0x56a345[_0xabd6('0x2f')][_0xabd6('0x3b')]){_0x3af8d9['where']=_[_0xabd6('0x3c')](_0x3af8d9[_0xabd6('0x39')],{'$or':_[_0xabd6('0x29')](_0x344bc6,function(_0x24e1ab){if(_0x24e1ab[_0xabd6('0x3d')]!==_0xabd6('0x3e')){var _0x2fc07e={};_0x2fc07e[_0x24e1ab[_0xabd6('0x26')]]={'$like':'%'+_0x56a345[_0xabd6('0x2f')][_0xabd6('0x3b')]+'%'};return _0x2fc07e;}})});}_0x3af8d9=_[_0xabd6('0x3c')]({},_0x3af8d9,_0x56a345[_0xabd6('0x3f')]);var _0x4fee55={'where':_0x3af8d9[_0xabd6('0x39')]};return db[_0xabd6('0x2a')][_0xabd6('0x1b')](_0x4fee55)['then'](function(_0xf8483){_0x374711['count']=_0xf8483;if(_0x56a345[_0xabd6('0x2f')][_0xabd6('0x40')]){_0x3af8d9[_0xabd6('0x41')]=[{'all':!![]}];}return db[_0xabd6('0x2a')][_0xabd6('0x42')](_0x3af8d9);})['then'](function(_0x29c734){_0x374711['rows']=_0x29c734;return _0x374711;})[_0xabd6('0x22')](respondWithFilteredResult(_0x54d7e1,_0x3af8d9))[_0xabd6('0x43')](handleError(_0x54d7e1,null));};exports['show']=function(_0x346af1,_0x293587){var _0x397a83={'raw':![],'where':{'id':_0x346af1[_0xabd6('0x44')]['id']}},_0x434ad4={};_0x434ad4[_0xabd6('0x2e')]=_[_0xabd6('0x45')](db[_0xabd6('0x2a')][_0xabd6('0x2b')]);_0x434ad4['query']=_[_0xabd6('0x45')](_0x346af1[_0xabd6('0x2f')]);_0x434ad4[_0xabd6('0x30')]=_[_0xabd6('0x31')](_0x434ad4['model'],_0x434ad4[_0xabd6('0x2f')]);_0x397a83['attributes']=_[_0xabd6('0x31')](_0x434ad4[_0xabd6('0x2e')],qs[_0xabd6('0x33')](_0x346af1['query']['fields']));_0x397a83[_0xabd6('0x32')]=_0x397a83['attributes'][_0xabd6('0x34')]?_0x397a83['attributes']:_0x434ad4[_0xabd6('0x2e')];if(_0x346af1[_0xabd6('0x2f')][_0xabd6('0x40')]){_0x397a83[_0xabd6('0x41')]=[{'all':!![]}];}_0x397a83=_[_0xabd6('0x3c')]({},_0x397a83,_0x346af1[_0xabd6('0x3f')]);return db[_0xabd6('0x2a')][_0xabd6('0x46')](_0x397a83)[_0xabd6('0x22')](handleEntityNotFound(_0x293587,null))[_0xabd6('0x22')](respondWithResult(_0x293587,null))[_0xabd6('0x43')](handleError(_0x293587,null));};exports[_0xabd6('0x47')]=function(_0x1a037b,_0x4aab0a){return db[_0xabd6('0x2a')][_0xabd6('0x47')](_0x1a037b[_0xabd6('0x48')],{})[_0xabd6('0x22')](respondWithResult(_0x4aab0a,0xc9))[_0xabd6('0x43')](handleError(_0x4aab0a,null));};exports[_0xabd6('0x21')]=function(_0x4cffe7,_0x2a2508){if(_0x4cffe7[_0xabd6('0x48')]['id']){delete _0x4cffe7[_0xabd6('0x48')]['id'];}return db['VtigerConfiguration'][_0xabd6('0x46')]({'where':{'id':_0x4cffe7['params']['id']}})['then'](handleEntityNotFound(_0x2a2508,null))['then'](saveUpdates(_0x4cffe7['body'],null))[_0xabd6('0x22')](respondWithResult(_0x2a2508,null))['catch'](handleError(_0x2a2508,null));};exports[_0xabd6('0x49')]=function(_0x4d8fb8,_0x2120b3){return db[_0xabd6('0x2a')][_0xabd6('0x46')]({'where':{'id':_0x4d8fb8['params']['id']}})[_0xabd6('0x22')](handleEntityNotFound(_0x2120b3,null))[_0xabd6('0x22')](removeEntity(_0x2120b3,null))[_0xabd6('0x43')](handleError(_0x2120b3,null));};exports['getFields']=function(_0x2abf3c,_0x13e2c7,_0x5f01fc){var _0x4066f3={};var _0x2294f0={};var _0x38f129;var _0x12a9d4;return db[_0xabd6('0x2a')]['findOne']({'where':{'id':_0x2abf3c[_0xabd6('0x44')]['id']}})[_0xabd6('0x22')](handleEntityNotFound(_0x13e2c7,null))[_0xabd6('0x22')](function(_0x129825){if(_0x129825){_0x38f129=_0x129825;_0x2294f0[_0xabd6('0x2e')]=_['keys'](db[_0xabd6('0x4a')][_0xabd6('0x2b')]);_0x2294f0[_0xabd6('0x2f')]=_[_0xabd6('0x45')](_0x2abf3c['query']);_0x2294f0[_0xabd6('0x30')]=_[_0xabd6('0x31')](_0x2294f0[_0xabd6('0x2e')],_0x2294f0[_0xabd6('0x2f')]);_0x4066f3['attributes']=_[_0xabd6('0x31')](_0x2294f0[_0xabd6('0x2e')],qs[_0xabd6('0x33')](_0x2abf3c[_0xabd6('0x2f')][_0xabd6('0x33')]));_0x4066f3[_0xabd6('0x32')]=_0x4066f3['attributes'][_0xabd6('0x34')]?_0x4066f3[_0xabd6('0x32')]:_0x2294f0[_0xabd6('0x2e')];_0x4066f3['order']=qs[_0xabd6('0x38')](_0x2abf3c[_0xabd6('0x2f')][_0xabd6('0x38')]);_0x4066f3[_0xabd6('0x39')]=qs[_0xabd6('0x30')](_['pick'](_0x2abf3c[_0xabd6('0x2f')],_0x2294f0[_0xabd6('0x30')]));if(_0x2abf3c[_0xabd6('0x2f')]['filter']){_0x4066f3[_0xabd6('0x39')]=_[_0xabd6('0x3c')](_0x4066f3[_0xabd6('0x39')],{'$or':_[_0xabd6('0x29')](_0x4066f3[_0xabd6('0x32')],function(_0x298600){var _0x4bf1b2={};_0x4bf1b2[_0x298600]={'$like':'%'+_0x2abf3c[_0xabd6('0x2f')]['filter']+'%'};return _0x4bf1b2;})});}_0x4066f3=_[_0xabd6('0x3c')]({},_0x4066f3,_0x2abf3c[_0xabd6('0x3f')]);return _0x38f129[_0xabd6('0x4b')](_0x4066f3);}})[_0xabd6('0x22')](function(_0x552082){if(_0x552082){_0x12a9d4=_0x552082['length'];if(!_0x2abf3c[_0xabd6('0x2f')][_0xabd6('0x35')](_0xabd6('0x36'))){_0x4066f3[_0xabd6('0x1c')]=qs[_0xabd6('0x1c')](_0x2abf3c[_0xabd6('0x2f')][_0xabd6('0x1c')]);_0x4066f3[_0xabd6('0x19')]=qs[_0xabd6('0x19')](_0x2abf3c[_0xabd6('0x2f')][_0xabd6('0x19')]);}return _0x38f129[_0xabd6('0x4b')](_0x4066f3);}})[_0xabd6('0x22')](function(_0x581929){if(_0x581929){return _0x581929?{'count':_0x12a9d4,'rows':_0x581929}:null;}})['then'](respondWithResult(_0x13e2c7,null))[_0xabd6('0x43')](handleError(_0x13e2c7,null));};exports[_0xabd6('0x4c')]=function(_0x2f2966,_0x253057,_0xa6d240){var _0x14c44e={};var _0x4a1bd8={};var _0x4d1eb0;var _0x158026;return db[_0xabd6('0x2a')][_0xabd6('0x4d')]({'where':{'id':_0x2f2966['params']['id']}})[_0xabd6('0x22')](handleEntityNotFound(_0x253057,null))[_0xabd6('0x22')](function(_0x37a24d){if(_0x37a24d){_0x4d1eb0=_0x37a24d;_0x4a1bd8[_0xabd6('0x2e')]=_[_0xabd6('0x45')](db[_0xabd6('0x4a')]['rawAttributes']);_0x4a1bd8[_0xabd6('0x2f')]=_['keys'](_0x2f2966[_0xabd6('0x2f')]);_0x4a1bd8[_0xabd6('0x30')]=_[_0xabd6('0x31')](_0x4a1bd8[_0xabd6('0x2e')],_0x4a1bd8[_0xabd6('0x2f')]);_0x14c44e[_0xabd6('0x32')]=_[_0xabd6('0x31')](_0x4a1bd8['model'],qs[_0xabd6('0x33')](_0x2f2966['query'][_0xabd6('0x33')]));_0x14c44e[_0xabd6('0x32')]=_0x14c44e['attributes'][_0xabd6('0x34')]?_0x14c44e[_0xabd6('0x32')]:_0x4a1bd8[_0xabd6('0x2e')];_0x14c44e[_0xabd6('0x37')]=qs['sort'](_0x2f2966['query'][_0xabd6('0x38')]);_0x14c44e[_0xabd6('0x39')]=qs[_0xabd6('0x30')](_[_0xabd6('0x3a')](_0x2f2966[_0xabd6('0x2f')],_0x4a1bd8['filters']));if(_0x2f2966[_0xabd6('0x2f')][_0xabd6('0x3b')]){_0x14c44e[_0xabd6('0x39')]=_[_0xabd6('0x3c')](_0x14c44e[_0xabd6('0x39')],{'$or':_['map'](_0x14c44e[_0xabd6('0x32')],function(_0x25a4a5){var _0x2dd8c3={};_0x2dd8c3[_0x25a4a5]={'$like':'%'+_0x2f2966['query'][_0xabd6('0x3b')]+'%'};return _0x2dd8c3;})});}_0x14c44e=_[_0xabd6('0x3c')]({},_0x14c44e,_0x2f2966[_0xabd6('0x3f')]);return _0x4d1eb0[_0xabd6('0x4c')](_0x14c44e);}})['then'](function(_0x122df0){if(_0x122df0){_0x158026=_0x122df0['length'];if(!_0x2f2966[_0xabd6('0x2f')][_0xabd6('0x35')](_0xabd6('0x36'))){_0x14c44e[_0xabd6('0x1c')]=qs[_0xabd6('0x1c')](_0x2f2966[_0xabd6('0x2f')][_0xabd6('0x1c')]);_0x14c44e[_0xabd6('0x19')]=qs[_0xabd6('0x19')](_0x2f2966['query'][_0xabd6('0x19')]);}return _0x4d1eb0['getSubjects'](_0x14c44e);}})[_0xabd6('0x22')](function(_0x20d4ad){if(_0x20d4ad){return _0x20d4ad?{'count':_0x158026,'rows':_0x20d4ad}:null;}})[_0xabd6('0x22')](respondWithResult(_0x253057,null))['catch'](handleError(_0x253057,null));};exports['getDescriptions']=function(_0x3b3aad,_0x207237,_0x2a97eb){var _0xf26d42={};var _0xeaaa82={};var _0x452cb7;var _0x317608;return db['VtigerConfiguration'][_0xabd6('0x4d')]({'where':{'id':_0x3b3aad[_0xabd6('0x44')]['id']}})[_0xabd6('0x22')](handleEntityNotFound(_0x207237,null))[_0xabd6('0x22')](function(_0x55dec8){if(_0x55dec8){_0x452cb7=_0x55dec8;_0xeaaa82[_0xabd6('0x2e')]=_[_0xabd6('0x45')](db[_0xabd6('0x4a')][_0xabd6('0x2b')]);_0xeaaa82[_0xabd6('0x2f')]=_[_0xabd6('0x45')](_0x3b3aad[_0xabd6('0x2f')]);_0xeaaa82[_0xabd6('0x30')]=_[_0xabd6('0x31')](_0xeaaa82['model'],_0xeaaa82[_0xabd6('0x2f')]);_0xf26d42[_0xabd6('0x32')]=_[_0xabd6('0x31')](_0xeaaa82['model'],qs['fields'](_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x33')]));_0xf26d42[_0xabd6('0x32')]=_0xf26d42[_0xabd6('0x32')][_0xabd6('0x34')]?_0xf26d42[_0xabd6('0x32')]:_0xeaaa82['model'];_0xf26d42[_0xabd6('0x37')]=qs['sort'](_0x3b3aad['query'][_0xabd6('0x38')]);_0xf26d42[_0xabd6('0x39')]=qs['filters'](_[_0xabd6('0x3a')](_0x3b3aad[_0xabd6('0x2f')],_0xeaaa82[_0xabd6('0x30')]));if(_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x3b')]){_0xf26d42['where']=_[_0xabd6('0x3c')](_0xf26d42['where'],{'$or':_['map'](_0xf26d42[_0xabd6('0x32')],function(_0x170b5b){var _0x435246={};_0x435246[_0x170b5b]={'$like':'%'+_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x3b')]+'%'};return _0x435246;})});}_0xf26d42=_[_0xabd6('0x3c')]({},_0xf26d42,_0x3b3aad[_0xabd6('0x3f')]);return _0x452cb7[_0xabd6('0x4e')](_0xf26d42);}})[_0xabd6('0x22')](function(_0xf9d7f9){if(_0xf9d7f9){_0x317608=_0xf9d7f9['length'];if(!_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x35')](_0xabd6('0x36'))){_0xf26d42[_0xabd6('0x1c')]=qs[_0xabd6('0x1c')](_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x1c')]);_0xf26d42[_0xabd6('0x19')]=qs[_0xabd6('0x19')](_0x3b3aad[_0xabd6('0x2f')][_0xabd6('0x19')]);}return _0x452cb7[_0xabd6('0x4e')](_0xf26d42);}})[_0xabd6('0x22')](function(_0x5ddee0){if(_0x5ddee0){return _0x5ddee0?{'count':_0x317608,'rows':_0x5ddee0}:null;}})[_0xabd6('0x22')](respondWithResult(_0x207237,null))[_0xabd6('0x43')](handleError(_0x207237,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ccdf6e2..2fd9476 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 _0x9606=['int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration'];(function(_0x4971d8,_0x1d444b){var _0xfbc542=function(_0x10900f){while(--_0x10900f){_0x4971d8['push'](_0x4971d8['shift']());}};_0xfbc542(++_0x1d444b);}(_0x9606,0x69));var _0x6960=function(_0x5d487a,_0x1cdcfc){_0x5d487a=_0x5d487a-0x0;var _0x24db27=_0x9606[_0x5d487a];return _0x24db27;};'use strict';var _=require(_0x6960('0x0'));var util=require(_0x6960('0x1'));var logger=require('../../config/logger')(_0x6960('0x2'));var moment=require(_0x6960('0x3'));var BPromise=require(_0x6960('0x4'));var rp=require(_0x6960('0x5'));var fs=require('fs');var path=require(_0x6960('0x6'));var rimraf=require(_0x6960('0x7'));var config=require(_0x6960('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6960('0x9')]=function(_0x48fd17,_0x833f46){return _0x48fd17[_0x6960('0xa')](_0x6960('0xb'),attributes,{'tableName':_0x6960('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b55=['util','../../config/logger','api','bluebird','path','rimraf','exports','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6b55,0x149));var _0x56b5=function(_0x434525,_0x316cf4){_0x434525=_0x434525-0x0;var _0x37e65b=_0x6b55[_0x434525];return _0x37e65b;};'use strict';var _=require(_0x56b5('0x0'));var util=require(_0x56b5('0x1'));var logger=require(_0x56b5('0x2'))(_0x56b5('0x3'));var moment=require('moment');var BPromise=require(_0x56b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56b5('0x5'));var rimraf=require(_0x56b5('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x56b5('0x7')]=function(_0x13621c,_0x3e705e){return _0x13621c['define'](_0x56b5('0x8'),attributes,{'tableName':_0x56b5('0x9'),'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 18d8322..ff3554a 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 _0x2d55=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x2d55,0x18e));var _0x52d5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2d55[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52d5('0x0'));var BPromise=require('bluebird');var rs=require(_0x52d5('0x1'));var fs=require('fs');var Redis=require(_0x52d5('0x2'));var db=require(_0x52d5('0x3'))['db'];var utils=require(_0x52d5('0x4'));var logger=require(_0x52d5('0x5'))(_0x52d5('0x6'));var config=require('../../config/environment');var jayson=require(_0x52d5('0x7'));var client=jayson[_0x52d5('0x8')][_0x52d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafdbea,_0xca50a7,_0x1aa638){return new BPromise(function(_0x184e2e,_0x43bab6){return client['request'](_0xafdbea,_0x1aa638)['then'](function(_0x54da9b){logger[_0x52d5('0xa')](_0x52d5('0xb'),_0xca50a7,'request\x20sent');logger[_0x52d5('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xca50a7,_0x52d5('0xd'),JSON[_0x52d5('0xe')](_0x54da9b));if(_0x54da9b[_0x52d5('0xf')]){if(_0x54da9b[_0x52d5('0xf')][_0x52d5('0x10')]===0x1f4){logger['error'](_0x52d5('0xb'),_0xca50a7,_0x54da9b[_0x52d5('0xf')]['message']);return _0x43bab6(_0x54da9b[_0x52d5('0xf')][_0x52d5('0x11')]);}logger[_0x52d5('0xf')](_0x52d5('0xb'),_0xca50a7,_0x54da9b[_0x52d5('0xf')][_0x52d5('0x11')]);return _0x184e2e(_0x54da9b['error'][_0x52d5('0x11')]);}else{logger[_0x52d5('0xa')](_0x52d5('0xb'),_0xca50a7,_0x52d5('0xd'));_0x184e2e(_0x54da9b[_0x52d5('0x12')][_0x52d5('0x11')]);}})[_0x52d5('0x13')](function(_0x4e4f5e){logger['error'](_0x52d5('0xb'),_0xca50a7,_0x4e4f5e);_0x43bab6(_0x4e4f5e);});});} \ No newline at end of file +var _0x9a9f=['code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x498262,_0x2cda1e){var _0x3c9f08=function(_0x5605fd){while(--_0x5605fd){_0x498262['push'](_0x498262['shift']());}};_0x3c9f08(++_0x2cda1e);}(_0x9a9f,0x102));var _0xf9a9=function(_0x106be0,_0x3d8500){_0x106be0=_0x106be0-0x0;var _0x35176a=_0x9a9f[_0x106be0];return _0x35176a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf9a9('0x0'));var BPromise=require('bluebird');var rs=require(_0xf9a9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9a9('0x2'))['db'];var utils=require(_0xf9a9('0x3'));var logger=require('../../config/logger')(_0xf9a9('0x4'));var config=require('../../config/environment');var jayson=require(_0xf9a9('0x5'));var client=jayson[_0xf9a9('0x6')][_0xf9a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36415c,_0x46a7e2,_0x20c553){return new BPromise(function(_0x660da2,_0x42834f){return client[_0xf9a9('0x8')](_0x36415c,_0x20c553)[_0xf9a9('0x9')](function(_0x48b0dd){logger['info'](_0xf9a9('0xa'),_0x46a7e2,_0xf9a9('0xb'));logger['debug'](_0xf9a9('0xc'),_0x46a7e2,_0xf9a9('0xb'),JSON['stringify'](_0x48b0dd));if(_0x48b0dd[_0xf9a9('0xd')]){if(_0x48b0dd[_0xf9a9('0xd')][_0xf9a9('0xe')]===0x1f4){logger[_0xf9a9('0xd')](_0xf9a9('0xa'),_0x46a7e2,_0x48b0dd['error'][_0xf9a9('0xf')]);return _0x42834f(_0x48b0dd[_0xf9a9('0xd')][_0xf9a9('0xf')]);}logger[_0xf9a9('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x46a7e2,_0x48b0dd['error'][_0xf9a9('0xf')]);return _0x660da2(_0x48b0dd[_0xf9a9('0xd')][_0xf9a9('0xf')]);}else{logger['info'](_0xf9a9('0xa'),_0x46a7e2,_0xf9a9('0xb'));_0x660da2(_0x48b0dd['result'][_0xf9a9('0xf')]);}})[_0xf9a9('0x10')](function(_0xde5eb9){logger[_0xf9a9('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x46a7e2,_0xde5eb9);_0x42834f(_0xde5eb9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 863f3e9..01b0b02 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 _0xe18b=['get','index','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller'];(function(_0x507d9f,_0x3e1d56){var _0xea1e39=function(_0x42dfee){while(--_0x42dfee){_0x507d9f['push'](_0x507d9f['shift']());}};_0xea1e39(++_0x3e1d56);}(_0xe18b,0x1a0));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe18('0x0'));var util=require(_0xbe18('0x1'));var path=require(_0xbe18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbe18('0x3')]();var fs_extra=require(_0xbe18('0x4'));var auth=require(_0xbe18('0x5'));var interaction=require(_0xbe18('0x6'));var config=require(_0xbe18('0x7'));var controller=require(_0xbe18('0x8'));router[_0xbe18('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe18('0xa')]);router[_0xbe18('0x9')](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0xd')]);router['post']('/',auth[_0xbe18('0xc')](),controller['create']);router['put'](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0xe')]);router[_0xbe18('0xf')](_0xbe18('0xb'),auth[_0xbe18('0xc')](),controller[_0xbe18('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbeca=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x1765b6,_0x3d3ce4){var _0x109758=function(_0x3a7cf2){while(--_0x3a7cf2){_0x1765b6['push'](_0x1765b6['shift']());}};_0x109758(++_0x3d3ce4);}(_0xbeca,0xbb));var _0xabec=function(_0x1fde53,_0x4e8b6c){_0x1fde53=_0x1fde53-0x0;var _0x987cce=_0xbeca[_0x1fde53];return _0x987cce;};'use strict';var multer=require('multer');var util=require(_0xabec('0x0'));var path=require(_0xabec('0x1'));var timeout=require(_0xabec('0x2'));var express=require('express');var router=express[_0xabec('0x3')]();var fs_extra=require(_0xabec('0x4'));var auth=require(_0xabec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xabec('0x6'));var controller=require('./intVtigerField.controller');router[_0xabec('0x7')]('/',auth[_0xabec('0x8')](),controller[_0xabec('0x9')]);router[_0xabec('0x7')](_0xabec('0xa'),auth[_0xabec('0x8')](),controller[_0xabec('0xb')]);router['post']('/',auth[_0xabec('0x8')](),controller['create']);router[_0xabec('0xc')](_0xabec('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xabec('0xd')]('/:id',auth[_0xabec('0x8')](),controller[_0xabec('0xe')]);module[_0xabec('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d1ce1ec..d165e38 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 _0xbb48=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0xbb48,0x1b3));var _0x8bb4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb48[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8bb4('0x0'));module[_0x8bb4('0x1')]={'type':{'type':Sequelize[_0x8bb4('0x2')](_0x8bb4('0x3'),_0x8bb4('0x4'),_0x8bb4('0x5'),_0x8bb4('0x6'),_0x8bb4('0x7')),'defaultValue':_0x8bb4('0x3')},'content':{'type':Sequelize[_0x8bb4('0x8')]},'key':{'type':Sequelize[_0x8bb4('0x8')]},'keyType':{'type':Sequelize[_0x8bb4('0x2')](_0x8bb4('0x3'),_0x8bb4('0x4'),_0x8bb4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8bb4('0x8')]},'nameField':{'type':Sequelize[_0x8bb4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8bb4('0x8')]}}; \ No newline at end of file +var _0xbaef=['BOOLEAN','sequelize','ENUM','picklist','string','STRING','variable','customVariable'];(function(_0x14651f,_0x479b62){var _0x4916d6=function(_0x278eb7){while(--_0x278eb7){_0x14651f['push'](_0x14651f['shift']());}};_0x4916d6(++_0x479b62);}(_0xbaef,0x111));var _0xfbae=function(_0xc543d2,_0x4a9d10){_0xc543d2=_0xc543d2-0x0;var _0x187d7b=_0xbaef[_0xc543d2];return _0x187d7b;};'use strict';var Sequelize=require(_0xfbae('0x0'));module['exports']={'type':{'type':Sequelize[_0xfbae('0x1')]('string','variable','customVariable','keyValue',_0xfbae('0x2')),'defaultValue':_0xfbae('0x3')},'content':{'type':Sequelize[_0xfbae('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfbae('0x1')](_0xfbae('0x3'),_0xfbae('0x5'),_0xfbae('0x6'))},'keyContent':{'type':Sequelize[_0xfbae('0x4')]},'idField':{'type':Sequelize[_0xfbae('0x4')]},'nameField':{'type':Sequelize[_0xfbae('0x4')]},'customField':{'type':Sequelize[_0xfbae('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfbae('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ded76b9..f9119d5 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 _0xcdb3=['ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','params','intersection','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x200e08,_0x4d55bd){var _0x186293=function(_0x849463){while(--_0x849463){_0x200e08['push'](_0x200e08['shift']());}};_0x186293(++_0x4d55bd);}(_0xcdb3,0x89));var _0x3cdb=function(_0x15e928,_0x55e514){_0x15e928=_0x15e928-0x0;var _0x1b989a=_0xcdb3[_0x15e928];return _0x1b989a;};'use strict';var emlformat=require(_0x3cdb('0x0'));var rimraf=require(_0x3cdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3cdb('0x2'));var rp=require('request-promise');var moment=require(_0x3cdb('0x3'));var BPromise=require(_0x3cdb('0x4'));var Mustache=require(_0x3cdb('0x5'));var util=require('util');var path=require(_0x3cdb('0x6'));var sox=require(_0x3cdb('0x7'));var csv=require(_0x3cdb('0x8'));var ejs=require(_0x3cdb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3cdb('0xa'));var crypto=require(_0x3cdb('0xb'));var jsforce=require(_0x3cdb('0xc'));var deskjs=require(_0x3cdb('0xd'));var toCsv=require(_0x3cdb('0x8'));var querystring=require(_0x3cdb('0xe'));var Papa=require(_0x3cdb('0xf'));var Redis=require(_0x3cdb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3cdb('0x11'));var hardwareService=require(_0x3cdb('0x12'));var logger=require(_0x3cdb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3cdb('0x14'));var licenseUtil=require(_0x3cdb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33fb47,_0x3dfebd){_0x3dfebd=_0x3dfebd||0xcc;return function(_0x53bd54){if(_0x53bd54){return _0x33fb47[_0x3cdb('0x16')](_0x3dfebd);}return _0x33fb47[_0x3cdb('0x17')](_0x3dfebd)[_0x3cdb('0x18')]();};}function respondWithResult(_0x46accb,_0x20c637){_0x20c637=_0x20c637||0xc8;return function(_0xa8e937){if(_0xa8e937){return _0x46accb[_0x3cdb('0x17')](_0x20c637)['json'](_0xa8e937);}};}function respondWithFilteredResult(_0x105f79,_0x8446ce){return function(_0x5072f9){if(_0x5072f9){var _0x51198e=typeof _0x8446ce[_0x3cdb('0x19')]===_0x3cdb('0x1a')&&typeof _0x8446ce[_0x3cdb('0x1b')]===_0x3cdb('0x1a');var _0x490be9=_0x5072f9[_0x3cdb('0x1c')];var _0x59e3ea=_0x51198e?0x0:_0x8446ce[_0x3cdb('0x19')];var _0x552ff2=_0x51198e?_0x5072f9[_0x3cdb('0x1c')]:_0x8446ce[_0x3cdb('0x19')]+_0x8446ce['limit'];var _0x5d8ccf;if(_0x552ff2>=_0x490be9){_0x552ff2=_0x490be9;_0x5d8ccf=0xc8;}else{_0x5d8ccf=0xce;}_0x105f79['status'](_0x5d8ccf);return _0x105f79[_0x3cdb('0x1d')](_0x3cdb('0x1e'),_0x59e3ea+'-'+_0x552ff2+'/'+_0x490be9)[_0x3cdb('0x1f')](_0x5072f9);}return null;};}function patchUpdates(_0x4c66ed){return function(_0x552a94){try{jsonpatch[_0x3cdb('0x20')](_0x552a94,_0x4c66ed,!![]);}catch(_0x2f1c2b){return BPromise[_0x3cdb('0x21')](_0x2f1c2b);}return _0x552a94[_0x3cdb('0x22')]();};}function saveUpdates(_0x5efc27,_0x3c34eb){return function(_0x5ae444){if(_0x5ae444){return _0x5ae444[_0x3cdb('0x23')](_0x5efc27)['then'](function(_0x44920e){return _0x44920e;});}return null;};}function removeEntity(_0x2ddf3c,_0x2b814c){return function(_0x99e698){if(_0x99e698){return _0x99e698[_0x3cdb('0x24')]()['then'](function(){_0x2ddf3c[_0x3cdb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10030d,_0x5e0ff2){return function(_0x345caf){if(!_0x345caf){_0x10030d[_0x3cdb('0x16')](0x194);}return _0x345caf;};}function handleError(_0x1b79c8,_0x5952f0){_0x5952f0=_0x5952f0||0x1f4;return function(_0x384f89){logger[_0x3cdb('0x25')](_0x384f89[_0x3cdb('0x26')]);if(_0x384f89['name']){delete _0x384f89[_0x3cdb('0x27')];}_0x1b79c8[_0x3cdb('0x17')](_0x5952f0)[_0x3cdb('0x28')](_0x384f89);};}exports[_0x3cdb('0x29')]=function(_0x8485bf,_0x30bf2f){var _0x1cbf75={},_0x1d2df7={},_0x50881d={'count':0x0,'rows':[]};var _0x4495bc=_[_0x3cdb('0x2a')](db[_0x3cdb('0x2b')][_0x3cdb('0x2c')],function(_0x2fdabb){return{'name':_0x2fdabb[_0x3cdb('0x2d')],'type':_0x2fdabb['type'][_0x3cdb('0x2e')]};});_0x1d2df7[_0x3cdb('0x2f')]=_[_0x3cdb('0x2a')](_0x4495bc,_0x3cdb('0x27'));_0x1d2df7[_0x3cdb('0x30')]=_['keys'](_0x8485bf[_0x3cdb('0x30')]);_0x1d2df7[_0x3cdb('0x31')]=_['intersection'](_0x1d2df7[_0x3cdb('0x2f')],_0x1d2df7[_0x3cdb('0x30')]);_0x1cbf75[_0x3cdb('0x32')]=_['intersection'](_0x1d2df7[_0x3cdb('0x2f')],qs[_0x3cdb('0x33')](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x33')]));_0x1cbf75[_0x3cdb('0x32')]=_0x1cbf75['attributes'][_0x3cdb('0x34')]?_0x1cbf75['attributes']:_0x1d2df7[_0x3cdb('0x2f')];if(!_0x8485bf[_0x3cdb('0x30')]['hasOwnProperty'](_0x3cdb('0x35'))){_0x1cbf75[_0x3cdb('0x1b')]=qs[_0x3cdb('0x1b')](_0x8485bf['query'][_0x3cdb('0x1b')]);_0x1cbf75[_0x3cdb('0x19')]=qs[_0x3cdb('0x19')](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x19')]);}_0x1cbf75[_0x3cdb('0x36')]=qs['sort'](_0x8485bf[_0x3cdb('0x30')][_0x3cdb('0x37')]);_0x1cbf75[_0x3cdb('0x38')]=qs[_0x3cdb('0x31')](_[_0x3cdb('0x39')](_0x8485bf[_0x3cdb('0x30')],_0x1d2df7[_0x3cdb('0x31')]),_0x4495bc);if(_0x8485bf['query'][_0x3cdb('0x3a')]){_0x1cbf75[_0x3cdb('0x38')]=_[_0x3cdb('0x3b')](_0x1cbf75[_0x3cdb('0x38')],{'$or':_[_0x3cdb('0x2a')](_0x4495bc,function(_0x562075){if(_0x562075[_0x3cdb('0x3c')]!==_0x3cdb('0x3d')){var _0x3b3870={};_0x3b3870[_0x562075[_0x3cdb('0x27')]]={'$like':'%'+_0x8485bf[_0x3cdb('0x30')]['filter']+'%'};return _0x3b3870;}})});}_0x1cbf75=_[_0x3cdb('0x3b')]({},_0x1cbf75,_0x8485bf[_0x3cdb('0x3e')]);var _0x1d744f={'where':_0x1cbf75[_0x3cdb('0x38')]};return db[_0x3cdb('0x2b')][_0x3cdb('0x1c')](_0x1d744f)[_0x3cdb('0x3f')](function(_0x3673d3){_0x50881d[_0x3cdb('0x1c')]=_0x3673d3;if(_0x8485bf['query'][_0x3cdb('0x40')]){_0x1cbf75[_0x3cdb('0x41')]=[{'all':!![]}];}return db[_0x3cdb('0x2b')]['findAll'](_0x1cbf75);})['then'](function(_0xf9f442){_0x50881d[_0x3cdb('0x42')]=_0xf9f442;return _0x50881d;})['then'](respondWithFilteredResult(_0x30bf2f,_0x1cbf75))[_0x3cdb('0x43')](handleError(_0x30bf2f,null));};exports['show']=function(_0x5798fe,_0x342488){var _0x2898d4={'raw':!![],'where':{'id':_0x5798fe[_0x3cdb('0x44')]['id']}},_0xaa0ede={};_0xaa0ede[_0x3cdb('0x2f')]=_['keys'](db[_0x3cdb('0x2b')][_0x3cdb('0x2c')]);_0xaa0ede[_0x3cdb('0x30')]=_['keys'](_0x5798fe[_0x3cdb('0x30')]);_0xaa0ede[_0x3cdb('0x31')]=_[_0x3cdb('0x45')](_0xaa0ede[_0x3cdb('0x2f')],_0xaa0ede[_0x3cdb('0x30')]);_0x2898d4['attributes']=_[_0x3cdb('0x45')](_0xaa0ede[_0x3cdb('0x2f')],qs[_0x3cdb('0x33')](_0x5798fe[_0x3cdb('0x30')][_0x3cdb('0x33')]));_0x2898d4[_0x3cdb('0x32')]=_0x2898d4[_0x3cdb('0x32')][_0x3cdb('0x34')]?_0x2898d4[_0x3cdb('0x32')]:_0xaa0ede['model'];if(_0x5798fe['query']['includeAll']){_0x2898d4[_0x3cdb('0x41')]=[{'all':!![]}];}_0x2898d4=_[_0x3cdb('0x3b')]({},_0x2898d4,_0x5798fe[_0x3cdb('0x3e')]);return db[_0x3cdb('0x2b')]['find'](_0x2898d4)[_0x3cdb('0x3f')](handleEntityNotFound(_0x342488,null))[_0x3cdb('0x3f')](respondWithResult(_0x342488,null))['catch'](handleError(_0x342488,null));};exports[_0x3cdb('0x46')]=function(_0x34a8b0,_0x117900){return db[_0x3cdb('0x2b')]['create'](_0x34a8b0[_0x3cdb('0x47')],{})[_0x3cdb('0x3f')](respondWithResult(_0x117900,0xc9))['catch'](handleError(_0x117900,null));};exports['update']=function(_0x2cce4c,_0x4e96c1){if(_0x2cce4c['body']['id']){delete _0x2cce4c[_0x3cdb('0x47')]['id'];}return db[_0x3cdb('0x2b')][_0x3cdb('0x48')]({'where':{'id':_0x2cce4c[_0x3cdb('0x44')]['id']}})[_0x3cdb('0x3f')](handleEntityNotFound(_0x4e96c1,null))[_0x3cdb('0x3f')](saveUpdates(_0x2cce4c[_0x3cdb('0x47')],null))[_0x3cdb('0x3f')](respondWithResult(_0x4e96c1,null))[_0x3cdb('0x43')](handleError(_0x4e96c1,null));};exports[_0x3cdb('0x24')]=function(_0x1904d5,_0x365b10){return db[_0x3cdb('0x2b')][_0x3cdb('0x48')]({'where':{'id':_0x1904d5[_0x3cdb('0x44')]['id']}})[_0x3cdb('0x3f')](handleEntityNotFound(_0x365b10,null))[_0x3cdb('0x3f')](removeEntity(_0x365b10,null))['catch'](handleError(_0x365b10,null));}; \ No newline at end of file +var _0x35bb=['apply','reject','save','update','then','error','name','index','VtigerField','rawAttributes','key','model','map','keys','filters','intersection','attributes','fields','length','query','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','rows','catch','show','create','body','params','destroy','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','count','offset','limit','set'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x35bb,0xec));var _0xb35b=function(_0x7f7c63,_0x12bc11){_0x7f7c63=_0x7f7c63-0x0;var _0x5cc149=_0x35bb[_0x7f7c63];return _0x5cc149;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb35b('0x0'));var zipdir=require(_0xb35b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb35b('0x2'));var Mustache=require(_0xb35b('0x3'));var util=require(_0xb35b('0x4'));var path=require(_0xb35b('0x5'));var sox=require('sox');var csv=require(_0xb35b('0x6'));var ejs=require(_0xb35b('0x7'));var fs=require('fs');var fs_extra=require(_0xb35b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb35b('0x9'));var deskjs=require(_0xb35b('0xa'));var toCsv=require(_0xb35b('0x6'));var querystring=require('querystring');var Papa=require(_0xb35b('0xb'));var Redis=require(_0xb35b('0xc'));var authService=require(_0xb35b('0xd'));var qs=require(_0xb35b('0xe'));var as=require(_0xb35b('0xf'));var hardwareService=require(_0xb35b('0x10'));var logger=require(_0xb35b('0x11'))(_0xb35b('0x12'));var utils=require(_0xb35b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd282aa,_0x49b01f){_0x49b01f=_0x49b01f||0xcc;return function(_0x41c783){if(_0x41c783){return _0xd282aa[_0xb35b('0x14')](_0x49b01f);}return _0xd282aa['status'](_0x49b01f)['end']();};}function respondWithResult(_0x4225d0,_0x498afb){_0x498afb=_0x498afb||0xc8;return function(_0xcc06ce){if(_0xcc06ce){return _0x4225d0[_0xb35b('0x15')](_0x498afb)[_0xb35b('0x16')](_0xcc06ce);}};}function respondWithFilteredResult(_0x428b92,_0x4a74a1){return function(_0x38f7c2){if(_0x38f7c2){var _0x53441e=typeof _0x4a74a1['offset']===_0xb35b('0x17')&&typeof _0x4a74a1['limit']===_0xb35b('0x17');var _0x59a4a2=_0x38f7c2[_0xb35b('0x18')];var _0x567f15=_0x53441e?0x0:_0x4a74a1['offset'];var _0x44e8bb=_0x53441e?_0x38f7c2[_0xb35b('0x18')]:_0x4a74a1[_0xb35b('0x19')]+_0x4a74a1[_0xb35b('0x1a')];var _0x5ffbb7;if(_0x44e8bb>=_0x59a4a2){_0x44e8bb=_0x59a4a2;_0x5ffbb7=0xc8;}else{_0x5ffbb7=0xce;}_0x428b92[_0xb35b('0x15')](_0x5ffbb7);return _0x428b92[_0xb35b('0x1b')]('Content-Range',_0x567f15+'-'+_0x44e8bb+'/'+_0x59a4a2)['json'](_0x38f7c2);}return null;};}function patchUpdates(_0x3fbe19){return function(_0x590579){try{jsonpatch[_0xb35b('0x1c')](_0x590579,_0x3fbe19,!![]);}catch(_0x20f812){return BPromise[_0xb35b('0x1d')](_0x20f812);}return _0x590579[_0xb35b('0x1e')]();};}function saveUpdates(_0x144ebb,_0x23044f){return function(_0x2d6257){if(_0x2d6257){return _0x2d6257[_0xb35b('0x1f')](_0x144ebb)['then'](function(_0x30c254){return _0x30c254;});}return null;};}function removeEntity(_0xcc53c4,_0x2b1a79){return function(_0xf49ccf){if(_0xf49ccf){return _0xf49ccf['destroy']()[_0xb35b('0x20')](function(){_0xcc53c4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x295c2b,_0x345bbd){return function(_0x5a70ab){if(!_0x5a70ab){_0x295c2b[_0xb35b('0x14')](0x194);}return _0x5a70ab;};}function handleError(_0x19cf41,_0x54012c){_0x54012c=_0x54012c||0x1f4;return function(_0x101bb5){logger[_0xb35b('0x21')](_0x101bb5['stack']);if(_0x101bb5[_0xb35b('0x22')]){delete _0x101bb5[_0xb35b('0x22')];}_0x19cf41[_0xb35b('0x15')](_0x54012c)['send'](_0x101bb5);};}exports[_0xb35b('0x23')]=function(_0x1b8e79,_0x22d5dc){var _0x43b63c={},_0x1bfe4a={},_0x566baf={'count':0x0,'rows':[]};var _0x18ec99=_['map'](db[_0xb35b('0x24')][_0xb35b('0x25')],function(_0x3af141){return{'name':_0x3af141['fieldName'],'type':_0x3af141['type'][_0xb35b('0x26')]};});_0x1bfe4a[_0xb35b('0x27')]=_[_0xb35b('0x28')](_0x18ec99,_0xb35b('0x22'));_0x1bfe4a['query']=_[_0xb35b('0x29')](_0x1b8e79['query']);_0x1bfe4a[_0xb35b('0x2a')]=_[_0xb35b('0x2b')](_0x1bfe4a['model'],_0x1bfe4a['query']);_0x43b63c[_0xb35b('0x2c')]=_[_0xb35b('0x2b')](_0x1bfe4a[_0xb35b('0x27')],qs[_0xb35b('0x2d')](_0x1b8e79['query']['fields']));_0x43b63c['attributes']=_0x43b63c[_0xb35b('0x2c')][_0xb35b('0x2e')]?_0x43b63c[_0xb35b('0x2c')]:_0x1bfe4a[_0xb35b('0x27')];if(!_0x1b8e79[_0xb35b('0x2f')]['hasOwnProperty'](_0xb35b('0x30'))){_0x43b63c[_0xb35b('0x1a')]=qs[_0xb35b('0x1a')](_0x1b8e79[_0xb35b('0x2f')][_0xb35b('0x1a')]);_0x43b63c['offset']=qs[_0xb35b('0x19')](_0x1b8e79['query'][_0xb35b('0x19')]);}_0x43b63c[_0xb35b('0x31')]=qs[_0xb35b('0x32')](_0x1b8e79[_0xb35b('0x2f')]['sort']);_0x43b63c['where']=qs[_0xb35b('0x2a')](_[_0xb35b('0x33')](_0x1b8e79[_0xb35b('0x2f')],_0x1bfe4a[_0xb35b('0x2a')]),_0x18ec99);if(_0x1b8e79[_0xb35b('0x2f')][_0xb35b('0x34')]){_0x43b63c[_0xb35b('0x35')]=_[_0xb35b('0x36')](_0x43b63c[_0xb35b('0x35')],{'$or':_[_0xb35b('0x28')](_0x18ec99,function(_0x37e23e){if(_0x37e23e[_0xb35b('0x37')]!=='VIRTUAL'){var _0x82c994={};_0x82c994[_0x37e23e['name']]={'$like':'%'+_0x1b8e79[_0xb35b('0x2f')][_0xb35b('0x34')]+'%'};return _0x82c994;}})});}_0x43b63c=_['merge']({},_0x43b63c,_0x1b8e79[_0xb35b('0x38')]);var _0x1ee087={'where':_0x43b63c[_0xb35b('0x35')]};return db[_0xb35b('0x24')]['count'](_0x1ee087)[_0xb35b('0x20')](function(_0x33ad7c){_0x566baf['count']=_0x33ad7c;if(_0x1b8e79[_0xb35b('0x2f')][_0xb35b('0x39')]){_0x43b63c[_0xb35b('0x3a')]=[{'all':!![]}];}return db[_0xb35b('0x24')]['findAll'](_0x43b63c);})[_0xb35b('0x20')](function(_0x3bd6f3){_0x566baf[_0xb35b('0x3b')]=_0x3bd6f3;return _0x566baf;})[_0xb35b('0x20')](respondWithFilteredResult(_0x22d5dc,_0x43b63c))[_0xb35b('0x3c')](handleError(_0x22d5dc,null));};exports[_0xb35b('0x3d')]=function(_0x1ad8c3,_0x5aa79e){var _0x1fcc78={'raw':!![],'where':{'id':_0x1ad8c3['params']['id']}},_0x11cb97={};_0x11cb97['model']=_['keys'](db[_0xb35b('0x24')][_0xb35b('0x25')]);_0x11cb97[_0xb35b('0x2f')]=_[_0xb35b('0x29')](_0x1ad8c3['query']);_0x11cb97[_0xb35b('0x2a')]=_['intersection'](_0x11cb97[_0xb35b('0x27')],_0x11cb97[_0xb35b('0x2f')]);_0x1fcc78[_0xb35b('0x2c')]=_[_0xb35b('0x2b')](_0x11cb97[_0xb35b('0x27')],qs['fields'](_0x1ad8c3[_0xb35b('0x2f')][_0xb35b('0x2d')]));_0x1fcc78['attributes']=_0x1fcc78['attributes'][_0xb35b('0x2e')]?_0x1fcc78[_0xb35b('0x2c')]:_0x11cb97[_0xb35b('0x27')];if(_0x1ad8c3[_0xb35b('0x2f')]['includeAll']){_0x1fcc78[_0xb35b('0x3a')]=[{'all':!![]}];}_0x1fcc78=_[_0xb35b('0x36')]({},_0x1fcc78,_0x1ad8c3[_0xb35b('0x38')]);return db['VtigerField']['find'](_0x1fcc78)['then'](handleEntityNotFound(_0x5aa79e,null))['then'](respondWithResult(_0x5aa79e,null))[_0xb35b('0x3c')](handleError(_0x5aa79e,null));};exports[_0xb35b('0x3e')]=function(_0x36d35a,_0x2d525c){return db['VtigerField'][_0xb35b('0x3e')](_0x36d35a[_0xb35b('0x3f')],{})[_0xb35b('0x20')](respondWithResult(_0x2d525c,0xc9))['catch'](handleError(_0x2d525c,null));};exports[_0xb35b('0x1f')]=function(_0x4be7b7,_0x1df808){if(_0x4be7b7[_0xb35b('0x3f')]['id']){delete _0x4be7b7[_0xb35b('0x3f')]['id'];}return db[_0xb35b('0x24')]['find']({'where':{'id':_0x4be7b7[_0xb35b('0x40')]['id']}})[_0xb35b('0x20')](handleEntityNotFound(_0x1df808,null))[_0xb35b('0x20')](saveUpdates(_0x4be7b7[_0xb35b('0x3f')],null))['then'](respondWithResult(_0x1df808,null))['catch'](handleError(_0x1df808,null));};exports[_0xb35b('0x41')]=function(_0x2f82ce,_0x25d50e){return db[_0xb35b('0x24')]['find']({'where':{'id':_0x2f82ce['params']['id']}})['then'](handleEntityNotFound(_0x25d50e,null))[_0xb35b('0x20')](removeEntity(_0x25d50e,null))[_0xb35b('0x3c')](handleError(_0x25d50e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9a58a2b..de72fd0 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 _0x25ef=['int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x1c1b8c,_0x4c253d){var _0x1ee4c4=function(_0xb9bff5){while(--_0xb9bff5){_0x1c1b8c['push'](_0x1c1b8c['shift']());}};_0x1ee4c4(++_0x4c253d);}(_0x25ef,0xf3));var _0xf25e=function(_0xbb2be9,_0x33c378){_0xbb2be9=_0xbb2be9-0x0;var _0x4aedf7=_0x25ef[_0xbb2be9];return _0x4aedf7;};'use strict';var _=require(_0xf25e('0x0'));var util=require(_0xf25e('0x1'));var logger=require(_0xf25e('0x2'))(_0xf25e('0x3'));var moment=require(_0xf25e('0x4'));var BPromise=require('bluebird');var rp=require(_0xf25e('0x5'));var fs=require('fs');var path=require(_0xf25e('0x6'));var rimraf=require(_0xf25e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf25e('0x8'));module[_0xf25e('0x9')]=function(_0x4c9fe9,_0x5003ad){return _0x4c9fe9[_0xf25e('0xa')](_0xf25e('0xb'),attributes,{'tableName':_0xf25e('0xc'),'paranoid':![],'indexes':[{'name':_0xf25e('0xd'),'fields':[_0xf25e('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3d9=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','rimraf'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0xf3d9,0xea));var _0x9f3d=function(_0x3fb99b,_0xa522c7){_0x3fb99b=_0x3fb99b-0x0;var _0x5d3f92=_0xf3d9[_0x3fb99b];return _0x5d3f92;};'use strict';var _=require(_0x9f3d('0x0'));var util=require(_0x9f3d('0x1'));var logger=require('../../config/logger')(_0x9f3d('0x2'));var moment=require(_0x9f3d('0x3'));var BPromise=require(_0x9f3d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f3d('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x558219,_0x4d0420){return _0x558219[_0x9f3d('0x6')](_0x9f3d('0x7'),attributes,{'tableName':_0x9f3d('0x8'),'paranoid':![],'indexes':[{'name':_0x9f3d('0x9'),'fields':[_0x9f3d('0xa'),_0x9f3d('0xb')],'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 e45d6af..ec2d7a3 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 _0xe356=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x339db5,_0x441041){var _0x142ff8=function(_0x4c8ac0){while(--_0x4c8ac0){_0x339db5['push'](_0x339db5['shift']());}};_0x142ff8(++_0x441041);}(_0xe356,0x1ee));var _0x6e35=function(_0x380255,_0x1f8089){_0x380255=_0x380255-0x0;var _0x25641e=_0xe356[_0x380255];return _0x25641e;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var moment=require(_0x6e35('0x2'));var BPromise=require(_0x6e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e35('0x5'));var logger=require(_0x6e35('0x6'))(_0x6e35('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e35('0x8'));var client=jayson[_0x6e35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389ae2,_0xba948e,_0x114b4c){return new BPromise(function(_0x1da99b,_0x5119fa){return client[_0x6e35('0xa')](_0x389ae2,_0x114b4c)['then'](function(_0x3b3c16){logger['info'](_0x6e35('0xb'),_0xba948e,'request\x20sent');logger['debug'](_0x6e35('0xc'),_0xba948e,_0x6e35('0xd'),JSON['stringify'](_0x3b3c16));if(_0x3b3c16['error']){if(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0xf')]===0x1f4){logger[_0x6e35('0xe')]('VtigerField,\x20%s,\x20%s',_0xba948e,_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);return _0x5119fa(_0x3b3c16[_0x6e35('0xe')]['message']);}logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3b3c16[_0x6e35('0xe')]['message']);return _0x1da99b(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);}else{logger[_0x6e35('0x11')]('VtigerField,\x20%s,\x20%s',_0xba948e,_0x6e35('0xd'));_0x1da99b(_0x3b3c16[_0x6e35('0x12')][_0x6e35('0x10')]);}})['catch'](function(_0x3e7e7a){logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3e7e7a);_0x5119fa(_0x3e7e7a);});});} \ No newline at end of file +var _0xcd2b=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x25a281,_0x5700c0){var _0x371227=function(_0x39a039){while(--_0x39a039){_0x25a281['push'](_0x25a281['shift']());}};_0x371227(++_0x5700c0);}(_0xcd2b,0x1a8));var _0xbcd2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcd2b[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xbcd2('0x0'));var moment=require(_0xbcd2('0x1'));var BPromise=require(_0xbcd2('0x2'));var rs=require(_0xbcd2('0x3'));var fs=require('fs');var Redis=require(_0xbcd2('0x4'));var db=require(_0xbcd2('0x5'))['db'];var utils=require(_0xbcd2('0x6'));var logger=require(_0xbcd2('0x7'))('rpc');var config=require(_0xbcd2('0x8'));var jayson=require(_0xbcd2('0x9'));var client=jayson[_0xbcd2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55fa96,_0x955c10,_0x9d1561){return new BPromise(function(_0x27de46,_0x3b5564){return client['request'](_0x55fa96,_0x9d1561)[_0xbcd2('0xb')](function(_0x590178){logger[_0xbcd2('0xc')](_0xbcd2('0xd'),_0x955c10,_0xbcd2('0xe'));logger[_0xbcd2('0xf')](_0xbcd2('0x10'),_0x955c10,'request\x20sent',JSON[_0xbcd2('0x11')](_0x590178));if(_0x590178[_0xbcd2('0x12')]){if(_0x590178[_0xbcd2('0x12')][_0xbcd2('0x13')]===0x1f4){logger[_0xbcd2('0x12')]('VtigerField,\x20%s,\x20%s',_0x955c10,_0x590178[_0xbcd2('0x12')][_0xbcd2('0x14')]);return _0x3b5564(_0x590178['error'][_0xbcd2('0x14')]);}logger[_0xbcd2('0x12')]('VtigerField,\x20%s,\x20%s',_0x955c10,_0x590178[_0xbcd2('0x12')][_0xbcd2('0x14')]);return _0x27de46(_0x590178[_0xbcd2('0x12')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x955c10,'request\x20sent');_0x27de46(_0x590178['result'][_0xbcd2('0x14')]);}})[_0xbcd2('0x15')](function(_0x17b89d){logger[_0xbcd2('0x12')](_0xbcd2('0xd'),_0x955c10,_0x17b89d);_0x3b5564(_0x17b89d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ade9fe6..c434d73 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 _0x3e59=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x373655,_0x1191ae){var _0x4908a0=function(_0x338cb6){while(--_0x338cb6){_0x373655['push'](_0x373655['shift']());}};_0x4908a0(++_0x1191ae);}(_0x3e59,0xb6));var _0x93e5=function(_0x30cf8d,_0x286354){_0x30cf8d=_0x30cf8d-0x0;var _0x92e924=_0x3e59[_0x30cf8d];return _0x92e924;};'use strict';var multer=require(_0x93e5('0x0'));var util=require('util');var path=require(_0x93e5('0x1'));var timeout=require(_0x93e5('0x2'));var express=require('express');var router=express[_0x93e5('0x3')]();var fs_extra=require(_0x93e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93e5('0x5'));var config=require(_0x93e5('0x6'));var controller=require(_0x93e5('0x7'));router[_0x93e5('0x8')]('/',auth[_0x93e5('0x9')](),controller[_0x93e5('0xa')]);router[_0x93e5('0x8')](_0x93e5('0xb'),auth[_0x93e5('0x9')](),controller[_0x93e5('0xc')]);router[_0x93e5('0x8')](_0x93e5('0xd'),auth[_0x93e5('0x9')](),controller[_0x93e5('0xe')]);router[_0x93e5('0x8')](_0x93e5('0xf'),auth['isAuthenticated'](),controller[_0x93e5('0x10')]);router[_0x93e5('0x11')]('/',auth[_0x93e5('0x9')](),controller[_0x93e5('0x12')]);router['post'](_0x93e5('0xd'),auth[_0x93e5('0x9')](),controller['addConfiguration']);router[_0x93e5('0x13')](_0x93e5('0xb'),auth['isAuthenticated'](),controller[_0x93e5('0x14')]);router[_0x93e5('0x15')]('/:id',auth[_0x93e5('0x9')](),controller[_0x93e5('0x16')]);module[_0x93e5('0x17')]=router; \ No newline at end of file +var _0x4964=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x404be8,_0xbdc6a4){var _0x5c5b4c=function(_0x433dc2){while(--_0x433dc2){_0x404be8['push'](_0x404be8['shift']());}};_0x5c5b4c(++_0xbdc6a4);}(_0x4964,0x134));var _0x4496=function(_0x2ce406,_0x586816){_0x2ce406=_0x2ce406-0x0;var _0x29ba1b=_0x4964[_0x2ce406];return _0x29ba1b;};'use strict';var multer=require(_0x4496('0x0'));var util=require(_0x4496('0x1'));var path=require('path');var timeout=require(_0x4496('0x2'));var express=require(_0x4496('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4496('0x4'));var config=require(_0x4496('0x5'));var controller=require(_0x4496('0x6'));router[_0x4496('0x7')]('/',auth[_0x4496('0x8')](),controller[_0x4496('0x9')]);router[_0x4496('0x7')](_0x4496('0xa'),auth['isAuthenticated'](),controller[_0x4496('0xb')]);router['get'](_0x4496('0xc'),auth['isAuthenticated'](),controller[_0x4496('0xd')]);router['get'](_0x4496('0xe'),auth['isAuthenticated'](),controller[_0x4496('0xf')]);router[_0x4496('0x10')]('/',auth['isAuthenticated'](),controller[_0x4496('0x11')]);router[_0x4496('0x10')](_0x4496('0xc'),auth[_0x4496('0x8')](),controller[_0x4496('0x12')]);router[_0x4496('0x13')](_0x4496('0xa'),auth[_0x4496('0x8')](),controller[_0x4496('0x14')]);router[_0x4496('0x15')](_0x4496('0xa'),auth[_0x4496('0x8')](),controller[_0x4496('0x16')]);module[_0x4496('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e1f2522..a598220 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 _0xf108=['newTab','sequelize','STRING','remoteUri','ENUM','password','token','integrationTab'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xf108,0x1d9));var _0x8f10=function(_0x54c2f9,_0x139a91){_0x54c2f9=_0x54c2f9-0x0;var _0x2ef0bd=_0xf108[_0x54c2f9];return _0x2ef0bd;};'use strict';var Sequelize=require(_0x8f10('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f10('0x1')]},'description':{'type':Sequelize[_0x8f10('0x1')]},'username':{'type':Sequelize[_0x8f10('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8f10('0x1')],'unique':_0x8f10('0x2')},'authType':{'type':Sequelize[_0x8f10('0x3')](_0x8f10('0x4'),_0x8f10('0x5')),'defaultValue':_0x8f10('0x4')},'serverUrl':{'type':Sequelize[_0x8f10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8f10('0x3')](_0x8f10('0x6'),_0x8f10('0x7')),'defaultValue':_0x8f10('0x6')}}; \ No newline at end of file +var _0xfb67=['remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING','username'];(function(_0x4b411d,_0x19e762){var _0x466323=function(_0x5af5e0){while(--_0x5af5e0){_0x4b411d['push'](_0x4b411d['shift']());}};_0x466323(++_0x19e762);}(_0xfb67,0xdd));var _0x7fb6=function(_0x1b2a86,_0xa2db03){_0x1b2a86=_0x1b2a86-0x0;var _0x3994f6=_0xfb67[_0x1b2a86];return _0x3994f6;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'username':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x3')},'password':{'type':Sequelize[_0x7fb6('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7fb6('0x2')],'unique':_0x7fb6('0x4')},'authType':{'type':Sequelize[_0x7fb6('0x5')](_0x7fb6('0x6'),_0x7fb6('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7fb6('0x5')](_0x7fb6('0x8'),'newTab'),'defaultValue':_0x7fb6('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 468d063..1e5b996 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 _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x42354f,_0x208cd6){var _0x333877=function(_0x4b25f0){while(--_0x4b25f0){_0x42354f['push'](_0x42354f['shift']());}};_0x333877(++_0x208cd6);}(_0x7916,0x128));var _0x6791=function(_0x10d371,_0x22e727){_0x10d371=_0x10d371-0x0;var _0x268600=_0x7916[_0x10d371];return _0x268600;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file +var _0x2e54=['position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','params','intersection','options','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','format','%s/%s','Basic\x20%s','%s:%s','headers','%s/token:%s','toString','Sequelize','ValidationError','subject','description','group','assignee','remove','ticket_fields'];(function(_0x1e44cb,_0x4bdec1){var _0x5e4f86=function(_0x407e48){while(--_0x407e48){_0x1e44cb['push'](_0x1e44cb['shift']());}};_0x5e4f86(++_0x4bdec1);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5507c5,_0x1cebd2){_0x5507c5=_0x5507c5-0x0;var _0xbace4f=_0x2e54[_0x5507c5];return _0xbace4f;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];var integrations=require(_0x42e5('0x18'));function respondWithStatusCode(_0x4530ba,_0x41598d){_0x41598d=_0x41598d||0xcc;return function(_0x144fb4){if(_0x144fb4){return _0x4530ba[_0x42e5('0x19')](_0x41598d);}return _0x4530ba[_0x42e5('0x1a')](_0x41598d)[_0x42e5('0x1b')]();};}function respondWithResult(_0x447648,_0x23957f){_0x23957f=_0x23957f||0xc8;return function(_0x51b2f4){if(_0x51b2f4){return _0x447648[_0x42e5('0x1a')](_0x23957f)[_0x42e5('0x1c')](_0x51b2f4);}};}function respondWithFilteredResult(_0x4034bd,_0x388300){return function(_0x2f4999){if(_0x2f4999){var _0x263a3d=typeof _0x388300[_0x42e5('0x1d')]===_0x42e5('0x1e')&&typeof _0x388300[_0x42e5('0x1f')]===_0x42e5('0x1e');var _0x22655f=_0x2f4999[_0x42e5('0x20')];var _0x11550e=_0x263a3d?0x0:_0x388300[_0x42e5('0x1d')];var _0x54fcfc=_0x263a3d?_0x2f4999[_0x42e5('0x20')]:_0x388300['offset']+_0x388300['limit'];var _0x14d16d;if(_0x54fcfc>=_0x22655f){_0x54fcfc=_0x22655f;_0x14d16d=0xc8;}else{_0x14d16d=0xce;}_0x4034bd[_0x42e5('0x1a')](_0x14d16d);return _0x4034bd['set'](_0x42e5('0x21'),_0x11550e+'-'+_0x54fcfc+'/'+_0x22655f)[_0x42e5('0x1c')](_0x2f4999);}return null;};}function patchUpdates(_0x1c2169){return function(_0x3fde76){try{jsonpatch[_0x42e5('0x22')](_0x3fde76,_0x1c2169,!![]);}catch(_0xa6825e){return BPromise[_0x42e5('0x23')](_0xa6825e);}return _0x3fde76['save']();};}function saveUpdates(_0x4da508,_0x283d44){return function(_0x52d319){if(_0x52d319){return _0x52d319[_0x42e5('0x24')](_0x4da508)[_0x42e5('0x25')](function(_0x37d10e){return _0x37d10e;});}return null;};}function removeEntity(_0x49490f,_0x32380f){return function(_0x5d6b24){if(_0x5d6b24){return _0x5d6b24[_0x42e5('0x26')]()[_0x42e5('0x25')](function(){_0x49490f[_0x42e5('0x1a')](0xcc)[_0x42e5('0x1b')]();});}};}function handleEntityNotFound(_0x4638bc,_0x4f52b2){return function(_0x4fb147){if(!_0x4fb147){_0x4638bc[_0x42e5('0x19')](0x194);}return _0x4fb147;};}function handleError(_0x534a26,_0x56f812){_0x56f812=_0x56f812||0x1f4;return function(_0x1b60be){logger['error'](_0x1b60be[_0x42e5('0x27')]);if(_0x1b60be[_0x42e5('0x28')]){delete _0x1b60be[_0x42e5('0x28')];}_0x534a26[_0x42e5('0x1a')](_0x56f812)[_0x42e5('0x29')](_0x1b60be);};}exports[_0x42e5('0x2a')]=function(_0x59a46b,_0x3e2ea5){var _0x201d9e={},_0x39f763={},_0x2c53d4={'count':0x0,'rows':[]};var _0x1d22ba=_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')],function(_0x5a4930){return{'name':_0x5a4930[_0x42e5('0x2e')],'type':_0x5a4930[_0x42e5('0x2f')][_0x42e5('0x30')]};});_0x39f763[_0x42e5('0x31')]=_['map'](_0x1d22ba,_0x42e5('0x28'));_0x39f763[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x59a46b[_0x42e5('0x32')]);_0x39f763['filters']=_['intersection'](_0x39f763[_0x42e5('0x31')],_0x39f763['query']);_0x201d9e[_0x42e5('0x34')]=_['intersection'](_0x39f763[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x59a46b[_0x42e5('0x32')]['fields']));_0x201d9e[_0x42e5('0x34')]=_0x201d9e[_0x42e5('0x34')]['length']?_0x201d9e[_0x42e5('0x34')]:_0x39f763['model'];if(!_0x59a46b[_0x42e5('0x32')][_0x42e5('0x36')](_0x42e5('0x37'))){_0x201d9e[_0x42e5('0x1f')]=qs[_0x42e5('0x1f')](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1f')]);_0x201d9e['offset']=qs['offset'](_0x59a46b[_0x42e5('0x32')][_0x42e5('0x1d')]);}_0x201d9e[_0x42e5('0x38')]=qs['sort'](_0x59a46b['query']['sort']);_0x201d9e['where']=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x59a46b[_0x42e5('0x32')],_0x39f763[_0x42e5('0x39')]),_0x1d22ba);if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]){_0x201d9e[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x201d9e['where'],{'$or':_[_0x42e5('0x2b')](_0x1d22ba,function(_0x587832){if(_0x587832[_0x42e5('0x2f')]!==_0x42e5('0x3e')){var _0x340caf={};_0x340caf[_0x587832[_0x42e5('0x28')]]={'$like':'%'+_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x340caf;}})});}_0x201d9e=_[_0x42e5('0x3d')]({},_0x201d9e,_0x59a46b['options']);var _0x20f372={'where':_0x201d9e[_0x42e5('0x3c')]};return db['ZendeskAccount'][_0x42e5('0x20')](_0x20f372)['then'](function(_0x53b0bd){_0x2c53d4['count']=_0x53b0bd;if(_0x59a46b[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x201d9e[_0x42e5('0x40')]=[{'all':!![]}];}return db[_0x42e5('0x2c')][_0x42e5('0x41')](_0x201d9e);})[_0x42e5('0x25')](function(_0x1fbde){_0x2c53d4['rows']=_0x1fbde;return _0x2c53d4;})[_0x42e5('0x25')](respondWithFilteredResult(_0x3e2ea5,_0x201d9e))[_0x42e5('0x42')](handleError(_0x3e2ea5,null));};exports['show']=function(_0x398b73,_0x1c697a){var _0x5db771={'raw':![],'where':{'id':_0x398b73[_0x42e5('0x43')]['id']}},_0x33054f={};_0x33054f[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x2c')]['rawAttributes']);_0x33054f[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x398b73[_0x42e5('0x32')]);_0x33054f[_0x42e5('0x39')]=_['intersection'](_0x33054f[_0x42e5('0x31')],_0x33054f[_0x42e5('0x32')]);_0x5db771[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x33054f[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x398b73[_0x42e5('0x32')][_0x42e5('0x35')]));_0x5db771['attributes']=_0x5db771[_0x42e5('0x34')]['length']?_0x5db771['attributes']:_0x33054f[_0x42e5('0x31')];if(_0x398b73[_0x42e5('0x32')][_0x42e5('0x3f')]){_0x5db771[_0x42e5('0x40')]=[{'all':!![]}];}_0x5db771=_[_0x42e5('0x3d')]({},_0x5db771,_0x398b73[_0x42e5('0x45')]);return db[_0x42e5('0x2c')]['find'](_0x5db771)[_0x42e5('0x25')](handleEntityNotFound(_0x1c697a,null))[_0x42e5('0x25')](respondWithResult(_0x1c697a,null))[_0x42e5('0x42')](handleError(_0x1c697a,null));};exports[_0x42e5('0x46')]=function(_0x1086b2,_0xc8de4d){return db[_0x42e5('0x2c')][_0x42e5('0x46')](_0x1086b2['body'],{})[_0x42e5('0x25')](respondWithResult(_0xc8de4d,0xc9))[_0x42e5('0x42')](handleError(_0xc8de4d,null));};exports[_0x42e5('0x24')]=function(_0x48757e,_0x2ab52a){if(_0x48757e[_0x42e5('0x47')]['id']){delete _0x48757e[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x48757e['params']['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x2ab52a,null))['then'](saveUpdates(_0x48757e[_0x42e5('0x47')],null))[_0x42e5('0x25')](respondWithResult(_0x2ab52a,null))[_0x42e5('0x42')](handleError(_0x2ab52a,null));};exports['destroy']=function(_0x50f59c,_0x4f0639){return db[_0x42e5('0x2c')][_0x42e5('0x48')]({'where':{'id':_0x50f59c[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x4f0639,null))['then'](removeEntity(_0x4f0639,null))[_0x42e5('0x42')](handleError(_0x4f0639,null));};exports[_0x42e5('0x49')]=function(_0x18cedc,_0x504110,_0x34e169){var _0x5070aa={};var _0x319088={};var _0x2583cd;var _0x53e29b;return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x18cedc[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x504110,null))[_0x42e5('0x25')](function(_0x3f043f){if(_0x3f043f){_0x2583cd=_0x3f043f;_0x319088[_0x42e5('0x31')]=_[_0x42e5('0x33')](db[_0x42e5('0x4b')][_0x42e5('0x2d')]);_0x319088['query']=_[_0x42e5('0x33')](_0x18cedc[_0x42e5('0x32')]);_0x319088[_0x42e5('0x39')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],_0x319088['query']);_0x5070aa[_0x42e5('0x34')]=_[_0x42e5('0x44')](_0x319088[_0x42e5('0x31')],qs[_0x42e5('0x35')](_0x18cedc['query']['fields']));_0x5070aa['attributes']=_0x5070aa[_0x42e5('0x34')][_0x42e5('0x4c')]?_0x5070aa['attributes']:_0x319088[_0x42e5('0x31')];_0x5070aa[_0x42e5('0x38')]=qs[_0x42e5('0x4d')](_0x18cedc[_0x42e5('0x32')][_0x42e5('0x4d')]);_0x5070aa[_0x42e5('0x3c')]=qs[_0x42e5('0x39')](_[_0x42e5('0x3a')](_0x18cedc[_0x42e5('0x32')],_0x319088['filters']));if(_0x18cedc[_0x42e5('0x32')]['filter']){_0x5070aa[_0x42e5('0x3c')]=_[_0x42e5('0x3d')](_0x5070aa[_0x42e5('0x3c')],{'$or':_[_0x42e5('0x2b')](_0x5070aa[_0x42e5('0x34')],function(_0x3b46d2){var _0x248cb8={};_0x248cb8[_0x3b46d2]={'$like':'%'+_0x18cedc[_0x42e5('0x32')][_0x42e5('0x3b')]+'%'};return _0x248cb8;})});}_0x5070aa=_[_0x42e5('0x3d')]({},_0x5070aa,_0x18cedc[_0x42e5('0x45')]);return _0x2583cd['getConfigurations'](_0x5070aa);}})[_0x42e5('0x25')](function(_0x4ff58c){if(_0x4ff58c){_0x53e29b=_0x4ff58c[_0x42e5('0x4c')];if(!_0x18cedc['query'][_0x42e5('0x36')](_0x42e5('0x37'))){_0x5070aa['limit']=qs[_0x42e5('0x1f')](_0x18cedc[_0x42e5('0x32')]['limit']);_0x5070aa[_0x42e5('0x1d')]=qs[_0x42e5('0x1d')](_0x18cedc['query'][_0x42e5('0x1d')]);}return _0x2583cd[_0x42e5('0x49')](_0x5070aa);}})[_0x42e5('0x25')](function(_0x57814b){if(_0x57814b){return _0x57814b?{'count':_0x53e29b,'rows':_0x57814b}:null;}})[_0x42e5('0x25')](respondWithResult(_0x504110,null))[_0x42e5('0x42')](handleError(_0x504110,null));};exports[_0x42e5('0x4e')]=function(_0x78394d,_0x57368e,_0x42db50){if(_0x78394d['body']['id']){delete _0x78394d[_0x42e5('0x47')]['id'];}return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x78394d[_0x42e5('0x43')]['id']}})[_0x42e5('0x25')](handleEntityNotFound(_0x57368e,null))[_0x42e5('0x25')](function(_0x15ff42){if(_0x15ff42){_0x78394d['body'][_0x42e5('0x4f')]=_0x15ff42['id'];_0x78394d[_0x42e5('0x47')][_0x42e5('0x50')]=integrations[_0x42e5('0x51')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')][_0x42e5('0x2f')]);_0x78394d[_0x42e5('0x47')]['Descriptions']=integrations[_0x42e5('0x53')](_0x78394d[_0x42e5('0x47')][_0x42e5('0x52')],_0x78394d[_0x42e5('0x47')]['type']);return db[_0x42e5('0x4b')][_0x42e5('0x46')](_0x78394d[_0x42e5('0x47')],{'include':[{'model':db[_0x42e5('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0x42e5('0x25')](respondWithResult(_0x57368e,null))[_0x42e5('0x42')](handleError(_0x57368e,null));};exports[_0x42e5('0x55')]=function(_0x2ce1d4,_0xb198d,_0x14d111){var _0x1cfe79='';return db[_0x42e5('0x2c')][_0x42e5('0x4a')]({'where':{'id':_0x2ce1d4['params']['id']},'attributes':['id',_0x42e5('0x56'),_0x42e5('0x57'),_0x42e5('0x58'),_0x42e5('0x59'),_0x42e5('0x5a')]})[_0x42e5('0x25')](handleEntityNotFound(_0xb198d,null))[_0x42e5('0x25')](function(_0x147613){if(_0x147613){_0x1cfe79=_0x147613['remoteUri'];var _0x548f8a=_0x1cfe79[_0x42e5('0x5b')](-0x1);if(_0x548f8a==='/'){_0x1cfe79=_0x1cfe79[_0x42e5('0x5c')](0x0,_0x1cfe79['lastIndexOf'](_0x548f8a));}var _0x4b9559={'method':'GET','uri':util[_0x42e5('0x5d')](_0x42e5('0x5e'),_0x1cfe79,'ticket_fields'),'json':!![]};switch(_0x147613[_0x42e5('0x59')]){case _0x42e5('0x57'):_0x4b9559['headers']={'Authorization':util[_0x42e5('0x5d')](_0x42e5('0x5f'),new Buffer(util['format'](_0x42e5('0x60'),_0x147613['username'],_0x147613['password']))['toString']('base64'))};break;case _0x42e5('0x58'):_0x4b9559[_0x42e5('0x61')]={'Authorization':util['format'](_0x42e5('0x5f'),new Buffer(util[_0x42e5('0x5d')](_0x42e5('0x62'),_0x147613[_0x42e5('0x56')],_0x147613[_0x42e5('0x58')]))[_0x42e5('0x63')]('base64'))};break;default:throw new db[(_0x42e5('0x64'))][(_0x42e5('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x4b9559);}})['then'](function(_0x2faf9b){if(_0x2faf9b){var _0xfa822e=[_0x42e5('0x66'),_0x42e5('0x67'),_0x42e5('0x68'),_0x42e5('0x69')];_[_0x42e5('0x6a')](_0x2faf9b['ticket_fields'],function(_0x5a1b63){return _0xfa822e['includes'](_0x5a1b63['type']);});return{'count':_0x2faf9b[_0x42e5('0x6b')][_0x42e5('0x4c')],'rows':_['map'](_0x2faf9b[_0x42e5('0x6b')],function(_0x5debb1){return{'id':_0x5debb1['id'],'name':_0x5debb1[_0x42e5('0x6c')]>0x7?_0x5debb1[_0x42e5('0x6d')]:_0x5debb1[_0x42e5('0x2f')],'custom':_0x5debb1[_0x42e5('0x6c')]>0x7?!![]:![],'options':_0x5debb1[_0x42e5('0x6e')]?_0x5debb1[_0x42e5('0x6e')]:_0x5debb1[_0x42e5('0x6f')]?_0x5debb1[_0x42e5('0x6f')]:[]};})};}})[_0x42e5('0x25')](respondWithResult(_0xb198d,null))[_0x42e5('0x42')](function(_0x1ee9b2){var _0x78573b=_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?0x1f4:_0x1ee9b2[_0x42e5('0x71')]||0x1f4;logger[_0x42e5('0x72')](_0x42e5('0x73'),_0x42e5('0x55'),_0x78573b,JSON['stringify'](_0x1ee9b2));delete _0x1ee9b2[_0x42e5('0x28')];if(_0x78573b===0x191){_0x78573b=0x190;}_0xb198d[_0x42e5('0x1a')](_0x78573b)[_0x42e5('0x29')](_0x2ce1d4[_0x42e5('0x32')][_0x42e5('0x70')]?{'message':_0x42e5('0x74'),'statusCode':_0x1ee9b2[_0x42e5('0x71')]}:_0x1ee9b2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4af5592..5775566 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 _0x7793=['int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x4513e8,_0x16f480){var _0x1e8758=function(_0x5c2038){while(--_0x5c2038){_0x4513e8['push'](_0x4513e8['shift']());}};_0x1e8758(++_0x16f480);}(_0x7793,0x97));var _0x3779=function(_0x492dfd,_0x40f69e){_0x492dfd=_0x492dfd-0x0;var _0x55c595=_0x7793[_0x492dfd];return _0x55c595;};'use strict';var _=require(_0x3779('0x0'));var util=require('util');var logger=require(_0x3779('0x1'))(_0x3779('0x2'));var moment=require(_0x3779('0x3'));var BPromise=require(_0x3779('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3779('0x5'));var rimraf=require('rimraf');var config=require(_0x3779('0x6'));var attributes=require(_0x3779('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3779('0x8')]=function(_0x403cf9,_0x2af7d3){return _0x403cf9['define']('ZendeskAccount',attributes,{'tableName':_0x3779('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4b1=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb4b1,0xe6));var _0x1b4b=function(_0x3784da,_0x3ccf55){_0x3784da=_0x3784da-0x0;var _0x50aa99=_0xb4b1[_0x3784da];return _0x50aa99;};'use strict';var _=require(_0x1b4b('0x0'));var util=require('util');var logger=require(_0x1b4b('0x1'))(_0x1b4b('0x2'));var moment=require('moment');var BPromise=require(_0x1b4b('0x3'));var rp=require(_0x1b4b('0x4'));var fs=require('fs');var path=require(_0x1b4b('0x5'));var rimraf=require(_0x1b4b('0x6'));var config=require(_0x1b4b('0x7'));var attributes=require(_0x1b4b('0x8'));var integrations=require(_0x1b4b('0x9'));module[_0x1b4b('0xa')]=function(_0x1529b9,_0x12a221){return _0x1529b9[_0x1b4b('0xb')](_0x1b4b('0xc'),attributes,{'tableName':_0x1b4b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index b2e7e0a..2c8c3c4 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 _0xb99c=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetZendeskAccount','findAll','options','raw','attributes','map','include','model','debug','ShowZendeskAccount','ZendeskAccount','find','where','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xb99c,0x1c6));var _0xcb99=function(_0x2da9db,_0x16a3e4){_0x2da9db=_0x2da9db-0x0;var _0x306a99=_0xb99c[_0x2da9db];return _0x306a99;};'use strict';var _=require(_0xcb99('0x0'));var util=require('util');var moment=require(_0xcb99('0x1'));var BPromise=require(_0xcb99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb99('0x3'));var db=require(_0xcb99('0x4'))['db'];var utils=require(_0xcb99('0x5'));var logger=require(_0xcb99('0x6'))('rpc');var config=require(_0xcb99('0x7'));var jayson=require(_0xcb99('0x8'));var client=jayson[_0xcb99('0x9')][_0xcb99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398d83,_0x12907a,_0x2691d6){return new BPromise(function(_0x1afdf3,_0x4d2b73){return client[_0xcb99('0xb')](_0x398d83,_0x2691d6)[_0xcb99('0xc')](function(_0x244a32){logger[_0xcb99('0xd')](_0xcb99('0xe'),_0x12907a,_0xcb99('0xf'));logger['debug'](_0xcb99('0x10'),_0x12907a,_0xcb99('0xf'),JSON['stringify'](_0x244a32));if(_0x244a32['error']){if(_0x244a32['error'][_0xcb99('0x11')]===0x1f4){logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x244a32[_0xcb99('0x12')]['message']);return _0x4d2b73(_0x244a32[_0xcb99('0x12')][_0xcb99('0x13')]);}logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x244a32['error']['message']);return _0x1afdf3(_0x244a32[_0xcb99('0x12')][_0xcb99('0x13')]);}else{logger[_0xcb99('0xd')](_0xcb99('0xe'),_0x12907a,_0xcb99('0xf'));_0x1afdf3(_0x244a32[_0xcb99('0x14')][_0xcb99('0x13')]);}})[_0xcb99('0x15')](function(_0x9607c4){logger[_0xcb99('0x12')](_0xcb99('0xe'),_0x12907a,_0x9607c4);_0x4d2b73(_0x9607c4);});});}exports[_0xcb99('0x16')]=function(_0x3a13b8){var _0x5ff93f=this;return new Promise(function(_0x82d6c2,_0x534524){return db['ZendeskAccount'][_0xcb99('0x17')]({'raw':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8[_0xcb99('0x18')][_0xcb99('0x19')]===undefined?!![]:![]:!![],'where':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8['options']['where']||null:null,'attributes':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8[_0xcb99('0x18')][_0xcb99('0x1a')]||null:null,'limit':_0x3a13b8[_0xcb99('0x18')]?_0x3a13b8['options']['limit']||null:null,'include':_0x3a13b8['options']?_0x3a13b8[_0xcb99('0x18')]['include']?_[_0xcb99('0x1b')](_0x3a13b8['options'][_0xcb99('0x1c')],function(_0x51b905){return{'model':db[_0x51b905[_0xcb99('0x1d')]],'as':_0x51b905['as'],'attributes':_0x51b905[_0xcb99('0x1a')],'include':_0x51b905['include']?_['map'](_0x51b905[_0xcb99('0x1c')],function(_0x36a693){return{'model':db[_0x36a693[_0xcb99('0x1d')]],'as':_0x36a693['as'],'attributes':_0x36a693[_0xcb99('0x1a')],'include':_0x36a693[_0xcb99('0x1c')]?_[_0xcb99('0x1b')](_0x36a693['include'],function(_0x318e4c){return{'model':db[_0x318e4c['model']],'as':_0x318e4c['as'],'attributes':_0x318e4c[_0xcb99('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb99('0xc')](function(_0x359af0){logger[_0xcb99('0xd')]('GetZendeskAccount',_0x3a13b8);logger[_0xcb99('0x1e')](_0xcb99('0x16'),_0x3a13b8,JSON['stringify'](_0x359af0));_0x82d6c2(_0x359af0);})[_0xcb99('0x15')](function(_0x5899bd){logger[_0xcb99('0x12')](_0xcb99('0x16'),_0x5899bd[_0xcb99('0x13')],_0x3a13b8);_0x534524(_0x5ff93f[_0xcb99('0x12')](0x1f4,_0x5899bd['message']));});});};exports[_0xcb99('0x1f')]=function(_0x394e23){var _0x38efdc=this;return new Promise(function(_0x551101,_0x4fdad1){return db[_0xcb99('0x20')][_0xcb99('0x21')]({'raw':_0x394e23['options']?_0x394e23[_0xcb99('0x18')][_0xcb99('0x19')]===undefined?!![]:![]:!![],'where':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')][_0xcb99('0x22')]||null:null,'attributes':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')]['attributes']||null:null,'include':_0x394e23[_0xcb99('0x18')]?_0x394e23[_0xcb99('0x18')][_0xcb99('0x1c')]?_[_0xcb99('0x1b')](_0x394e23[_0xcb99('0x18')][_0xcb99('0x1c')],function(_0x4fbd58){return{'model':db[_0x4fbd58[_0xcb99('0x1d')]],'as':_0x4fbd58['as'],'attributes':_0x4fbd58[_0xcb99('0x1a')],'include':_0x4fbd58[_0xcb99('0x1c')]?_['map'](_0x4fbd58[_0xcb99('0x1c')],function(_0x574716){return{'model':db[_0x574716[_0xcb99('0x1d')]],'as':_0x574716['as'],'attributes':_0x574716['attributes'],'include':_0x574716['include']?_['map'](_0x574716[_0xcb99('0x1c')],function(_0x5f5529){return{'model':db[_0x5f5529['model']],'as':_0x5f5529['as'],'attributes':_0x5f5529[_0xcb99('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45495b){logger[_0xcb99('0xd')](_0xcb99('0x1f'),_0x394e23);logger['debug'](_0xcb99('0x1f'),_0x394e23,JSON[_0xcb99('0x23')](_0x45495b));_0x551101(_0x45495b);})[_0xcb99('0x15')](function(_0x5c2320){logger[_0xcb99('0x12')](_0xcb99('0x1f'),_0x5c2320['message'],_0x394e23);_0x4fdad1(_0x38efdc[_0xcb99('0x12')](0x1f4,_0x5c2320['message']));});});}; \ No newline at end of file +var _0x10c7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x1787ab,_0xb2f41f){var _0x579292=function(_0x4a8ad1){while(--_0x4a8ad1){_0x1787ab['push'](_0x1787ab['shift']());}};_0x579292(++_0xb2f41f);}(_0x10c7,0x1d8));var _0x710c=function(_0x1bc6af,_0x4fbcc4){_0x1bc6af=_0x1bc6af-0x0;var _0x35e765=_0x10c7[_0x1bc6af];return _0x35e765;};'use strict';var _=require(_0x710c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x710c('0x1'));var fs=require('fs');var Redis=require(_0x710c('0x2'));var db=require(_0x710c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x710c('0x4'));var jayson=require(_0x710c('0x5'));var client=jayson[_0x710c('0x6')][_0x710c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f3fbb,_0x15d38c,_0x9ad37e){return new BPromise(function(_0x3a472a,_0x567486){return client[_0x710c('0x8')](_0x4f3fbb,_0x9ad37e)[_0x710c('0x9')](function(_0x1d7f99){logger[_0x710c('0xa')](_0x710c('0xb'),_0x15d38c,_0x710c('0xc'));logger[_0x710c('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x15d38c,_0x710c('0xc'),JSON[_0x710c('0xe')](_0x1d7f99));if(_0x1d7f99[_0x710c('0xf')]){if(_0x1d7f99[_0x710c('0xf')][_0x710c('0x10')]===0x1f4){logger[_0x710c('0xf')](_0x710c('0xb'),_0x15d38c,_0x1d7f99[_0x710c('0xf')][_0x710c('0x11')]);return _0x567486(_0x1d7f99[_0x710c('0xf')][_0x710c('0x11')]);}logger[_0x710c('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x15d38c,_0x1d7f99['error'][_0x710c('0x11')]);return _0x3a472a(_0x1d7f99[_0x710c('0xf')][_0x710c('0x11')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x15d38c,'request\x20sent');_0x3a472a(_0x1d7f99[_0x710c('0x12')][_0x710c('0x11')]);}})[_0x710c('0x13')](function(_0x53979c){logger[_0x710c('0xf')](_0x710c('0xb'),_0x15d38c,_0x53979c);_0x567486(_0x53979c);});});}exports['GetZendeskAccount']=function(_0x53fdf5){var _0x33d8e2=this;return new Promise(function(_0x3458bc,_0x19583d){return db[_0x710c('0x14')][_0x710c('0x15')]({'raw':_0x53fdf5[_0x710c('0x16')]?_0x53fdf5[_0x710c('0x16')][_0x710c('0x17')]===undefined?!![]:![]:!![],'where':_0x53fdf5[_0x710c('0x16')]?_0x53fdf5[_0x710c('0x16')][_0x710c('0x18')]||null:null,'attributes':_0x53fdf5[_0x710c('0x16')]?_0x53fdf5[_0x710c('0x16')][_0x710c('0x19')]||null:null,'limit':_0x53fdf5[_0x710c('0x16')]?_0x53fdf5[_0x710c('0x16')]['limit']||null:null,'include':_0x53fdf5[_0x710c('0x16')]?_0x53fdf5[_0x710c('0x16')][_0x710c('0x1a')]?_[_0x710c('0x1b')](_0x53fdf5[_0x710c('0x16')][_0x710c('0x1a')],function(_0x162729){return{'model':db[_0x162729[_0x710c('0x1c')]],'as':_0x162729['as'],'attributes':_0x162729[_0x710c('0x19')],'include':_0x162729[_0x710c('0x1a')]?_['map'](_0x162729[_0x710c('0x1a')],function(_0x2abf19){return{'model':db[_0x2abf19[_0x710c('0x1c')]],'as':_0x2abf19['as'],'attributes':_0x2abf19[_0x710c('0x19')],'include':_0x2abf19[_0x710c('0x1a')]?_[_0x710c('0x1b')](_0x2abf19[_0x710c('0x1a')],function(_0x25d7ac){return{'model':db[_0x25d7ac[_0x710c('0x1c')]],'as':_0x25d7ac['as'],'attributes':_0x25d7ac[_0x710c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x710c('0x9')](function(_0x1c11e6){logger[_0x710c('0xa')]('GetZendeskAccount',_0x53fdf5);logger['debug'](_0x710c('0x1d'),_0x53fdf5,JSON[_0x710c('0xe')](_0x1c11e6));_0x3458bc(_0x1c11e6);})['catch'](function(_0x1e9209){logger[_0x710c('0xf')]('GetZendeskAccount',_0x1e9209['message'],_0x53fdf5);_0x19583d(_0x33d8e2[_0x710c('0xf')](0x1f4,_0x1e9209['message']));});});};exports[_0x710c('0x1e')]=function(_0x87b137){var _0x45d83b=this;return new Promise(function(_0x685f38,_0x46aaf8){return db[_0x710c('0x14')][_0x710c('0x1f')]({'raw':_0x87b137[_0x710c('0x16')]?_0x87b137[_0x710c('0x16')][_0x710c('0x17')]===undefined?!![]:![]:!![],'where':_0x87b137[_0x710c('0x16')]?_0x87b137[_0x710c('0x16')]['where']||null:null,'attributes':_0x87b137[_0x710c('0x16')]?_0x87b137[_0x710c('0x16')][_0x710c('0x19')]||null:null,'include':_0x87b137[_0x710c('0x16')]?_0x87b137[_0x710c('0x16')][_0x710c('0x1a')]?_[_0x710c('0x1b')](_0x87b137[_0x710c('0x16')][_0x710c('0x1a')],function(_0x4dbfef){return{'model':db[_0x4dbfef[_0x710c('0x1c')]],'as':_0x4dbfef['as'],'attributes':_0x4dbfef[_0x710c('0x19')],'include':_0x4dbfef[_0x710c('0x1a')]?_['map'](_0x4dbfef['include'],function(_0x259b96){return{'model':db[_0x259b96[_0x710c('0x1c')]],'as':_0x259b96['as'],'attributes':_0x259b96[_0x710c('0x19')],'include':_0x259b96[_0x710c('0x1a')]?_['map'](_0x259b96[_0x710c('0x1a')],function(_0x382a5e){return{'model':db[_0x382a5e[_0x710c('0x1c')]],'as':_0x382a5e['as'],'attributes':_0x382a5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x710c('0x9')](function(_0x593a7d){logger[_0x710c('0xa')](_0x710c('0x1e'),_0x87b137);logger[_0x710c('0xd')]('ShowZendeskAccount',_0x87b137,JSON['stringify'](_0x593a7d));_0x685f38(_0x593a7d);})[_0x710c('0x13')](function(_0x4d0cce){logger[_0x710c('0xf')](_0x710c('0x1e'),_0x4d0cce[_0x710c('0x11')],_0x87b137);_0x46aaf8(_0x45d83b[_0x710c('0xf')](0x1f4,_0x4d0cce[_0x710c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c323891..5375c84 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 _0x878f=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','/:id/fields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x878f,0x173));var _0xf878=function(_0xdd8351,_0x1ccdf0){_0xdd8351=_0xdd8351-0x0;var _0x616c02=_0x878f[_0xdd8351];return _0x616c02;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xf878('0xa')](_0xf878('0xd'),auth[_0xf878('0xe')](),controller['getSubjects']);router[_0xf878('0xa')](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);router['get'](_0xf878('0x11'),auth[_0xf878('0xe')](),controller[_0xf878('0x12')]);router['post']('/',auth[_0xf878('0xe')](),controller[_0xf878('0x13')]);router[_0xf878('0x14')]('/:id/tags',auth[_0xf878('0xe')](),controller[_0xf878('0x15')]);router[_0xf878('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf878('0x17')]);router[_0xf878('0x18')](_0xf878('0xb'),auth[_0xf878('0xe')](),controller[_0xf878('0x19')]);module[_0xf878('0x1a')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x5e5864,_0x35a839){var _0x4ebdd6=function(_0x4d7776){while(--_0x4d7776){_0x5e5864['push'](_0x5e5864['shift']());}};_0x4ebdd6(++_0x35a839);}(_0x087b,0x11a));var _0xb087=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x087b[_0xfa634c];return _0x73e478;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0c6d688..c30b117 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 _0x2179=['STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2179,0x179));var _0x9217=function(_0x58d90a,_0x1a2ea6){_0x58d90a=_0x58d90a-0x0;var _0x3938a9=_0x2179[_0x58d90a];return _0x3938a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9217('0x0')]},'description':{'type':Sequelize[_0x9217('0x0')]}}; \ No newline at end of file +var _0xffa5=['sequelize','exports','STRING'];(function(_0x43bd66,_0x27e9b3){var _0x5195cb=function(_0xe936f0){while(--_0xe936f0){_0x43bd66['push'](_0x43bd66['shift']());}};_0x5195cb(++_0x27e9b3);}(_0xffa5,0xea));var _0x5ffa=function(_0x560f7d,_0x5de756){_0x560f7d=_0x560f7d-0x0;var _0x470a62=_0xffa5[_0x560f7d];return _0x470a62;};'use strict';var Sequelize=require(_0x5ffa('0x0'));module[_0x5ffa('0x1')]={'name':{'type':Sequelize[_0x5ffa('0x2')]},'description':{'type':Sequelize[_0x5ffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index bb05698..b2c9ab5 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 _0xabf1=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','set','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','merge','count','includeAll','include','findAll','rows','params','keys','options','find','catch','create','body','findOne','ZendeskField','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x363a8f,_0x47435c){var _0x2d81f0=function(_0x5234f7){while(--_0x5234f7){_0x363a8f['push'](_0x363a8f['shift']());}};_0x2d81f0(++_0x47435c);}(_0xabf1,0x1f3));var _0x1abf=function(_0x3e0b90,_0x525086){_0x3e0b90=_0x3e0b90-0x0;var _0x3538f4=_0xabf1[_0x3e0b90];return _0x3538f4;};'use strict';var emlformat=require(_0x1abf('0x0'));var rimraf=require(_0x1abf('0x1'));var zipdir=require(_0x1abf('0x2'));var jsonpatch=require(_0x1abf('0x3'));var rp=require(_0x1abf('0x4'));var moment=require(_0x1abf('0x5'));var BPromise=require(_0x1abf('0x6'));var Mustache=require(_0x1abf('0x7'));var util=require(_0x1abf('0x8'));var path=require('path');var sox=require(_0x1abf('0x9'));var csv=require(_0x1abf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1abf('0xb'));var _=require(_0x1abf('0xc'));var squel=require(_0x1abf('0xd'));var crypto=require('crypto');var jsforce=require(_0x1abf('0xe'));var deskjs=require(_0x1abf('0xf'));var toCsv=require(_0x1abf('0xa'));var querystring=require(_0x1abf('0x10'));var Papa=require(_0x1abf('0x11'));var Redis=require('ioredis');var authService=require(_0x1abf('0x12'));var qs=require(_0x1abf('0x13'));var as=require(_0x1abf('0x14'));var hardwareService=require(_0x1abf('0x15'));var logger=require(_0x1abf('0x16'))(_0x1abf('0x17'));var utils=require(_0x1abf('0x18'));var config=require(_0x1abf('0x19'));var licenseUtil=require(_0x1abf('0x1a'));var db=require(_0x1abf('0x1b'))['db'];function respondWithStatusCode(_0x7fa5fe,_0x767bb){_0x767bb=_0x767bb||0xcc;return function(_0x48ee64){if(_0x48ee64){return _0x7fa5fe['sendStatus'](_0x767bb);}return _0x7fa5fe[_0x1abf('0x1c')](_0x767bb)[_0x1abf('0x1d')]();};}function respondWithResult(_0x38c004,_0x1c4a24){_0x1c4a24=_0x1c4a24||0xc8;return function(_0x4a4128){if(_0x4a4128){return _0x38c004[_0x1abf('0x1c')](_0x1c4a24)[_0x1abf('0x1e')](_0x4a4128);}};}function respondWithFilteredResult(_0xb3ace4,_0x2fca73){return function(_0x14d3f9){if(_0x14d3f9){var _0x584c6c=typeof _0x2fca73[_0x1abf('0x1f')]==='undefined'&&typeof _0x2fca73['limit']===_0x1abf('0x20');var _0x975b20=_0x14d3f9['count'];var _0x2405bc=_0x584c6c?0x0:_0x2fca73['offset'];var _0x42a6c5=_0x584c6c?_0x14d3f9['count']:_0x2fca73['offset']+_0x2fca73['limit'];var _0x4e9096;if(_0x42a6c5>=_0x975b20){_0x42a6c5=_0x975b20;_0x4e9096=0xc8;}else{_0x4e9096=0xce;}_0xb3ace4[_0x1abf('0x1c')](_0x4e9096);return _0xb3ace4[_0x1abf('0x21')]('Content-Range',_0x2405bc+'-'+_0x42a6c5+'/'+_0x975b20)[_0x1abf('0x1e')](_0x14d3f9);}return null;};}function patchUpdates(_0x8f24f7){return function(_0x602b22){try{jsonpatch['apply'](_0x602b22,_0x8f24f7,!![]);}catch(_0x971250){return BPromise[_0x1abf('0x22')](_0x971250);}return _0x602b22[_0x1abf('0x23')]();};}function saveUpdates(_0x769652,_0x166f0d){return function(_0x15dc94){if(_0x15dc94){return _0x15dc94[_0x1abf('0x24')](_0x769652)[_0x1abf('0x25')](function(_0x5d36c9){return _0x5d36c9;});}return null;};}function removeEntity(_0x3a064c,_0x2c71a3){return function(_0x353f35){if(_0x353f35){return _0x353f35[_0x1abf('0x26')]()['then'](function(){_0x3a064c[_0x1abf('0x1c')](0xcc)[_0x1abf('0x1d')]();});}};}function handleEntityNotFound(_0x261948,_0x335b83){return function(_0x32560d){if(!_0x32560d){_0x261948['sendStatus'](0x194);}return _0x32560d;};}function handleError(_0x3ac93e,_0xcc461c){_0xcc461c=_0xcc461c||0x1f4;return function(_0x33b40c){logger[_0x1abf('0x27')](_0x33b40c[_0x1abf('0x28')]);if(_0x33b40c[_0x1abf('0x29')]){delete _0x33b40c['name'];}_0x3ac93e[_0x1abf('0x1c')](_0xcc461c)[_0x1abf('0x2a')](_0x33b40c);};}exports[_0x1abf('0x2b')]=function(_0x1137ff,_0x48e45c){var _0x121bc7={},_0x429bf6={},_0x3c4982={'count':0x0,'rows':[]};var _0x3da4b4=_['map'](db[_0x1abf('0x2c')][_0x1abf('0x2d')],function(_0x5afec6){return{'name':_0x5afec6[_0x1abf('0x2e')],'type':_0x5afec6[_0x1abf('0x2f')]['key']};});_0x429bf6[_0x1abf('0x30')]=_[_0x1abf('0x31')](_0x3da4b4,_0x1abf('0x29'));_0x429bf6[_0x1abf('0x32')]=_['keys'](_0x1137ff[_0x1abf('0x32')]);_0x429bf6[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x429bf6['model'],_0x429bf6[_0x1abf('0x32')]);_0x121bc7['attributes']=_[_0x1abf('0x34')](_0x429bf6[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x1137ff[_0x1abf('0x32')][_0x1abf('0x35')]));_0x121bc7['attributes']=_0x121bc7[_0x1abf('0x36')][_0x1abf('0x37')]?_0x121bc7[_0x1abf('0x36')]:_0x429bf6['model'];if(!_0x1137ff[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x121bc7[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x1137ff[_0x1abf('0x32')][_0x1abf('0x3a')]);_0x121bc7['offset']=qs['offset'](_0x1137ff['query'][_0x1abf('0x1f')]);}_0x121bc7[_0x1abf('0x3b')]=qs['sort'](_0x1137ff[_0x1abf('0x32')]['sort']);_0x121bc7['where']=qs['filters'](_[_0x1abf('0x3c')](_0x1137ff['query'],_0x429bf6[_0x1abf('0x33')]),_0x3da4b4);if(_0x1137ff[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x121bc7[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x121bc7[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x3da4b4,function(_0x5da496){if(_0x5da496['type']!=='VIRTUAL'){var _0x37139b={};_0x37139b[_0x5da496[_0x1abf('0x29')]]={'$like':'%'+_0x1137ff[_0x1abf('0x32')]['filter']+'%'};return _0x37139b;}})});}_0x121bc7=_[_0x1abf('0x3f')]({},_0x121bc7,_0x1137ff['options']);var _0x25cfce={'where':_0x121bc7[_0x1abf('0x3e')]};return db['ZendeskConfiguration']['count'](_0x25cfce)[_0x1abf('0x25')](function(_0x26c33e){_0x3c4982[_0x1abf('0x40')]=_0x26c33e;if(_0x1137ff[_0x1abf('0x32')][_0x1abf('0x41')]){_0x121bc7[_0x1abf('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x1abf('0x43')](_0x121bc7);})['then'](function(_0x4ba668){_0x3c4982[_0x1abf('0x44')]=_0x4ba668;return _0x3c4982;})[_0x1abf('0x25')](respondWithFilteredResult(_0x48e45c,_0x121bc7))['catch'](handleError(_0x48e45c,null));};exports['show']=function(_0x2eabd6,_0x208ce3){var _0x1d42a1={'raw':![],'where':{'id':_0x2eabd6[_0x1abf('0x45')]['id']}},_0x6d1486={};_0x6d1486[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x2c')][_0x1abf('0x2d')]);_0x6d1486[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x2eabd6[_0x1abf('0x32')]);_0x6d1486[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x6d1486[_0x1abf('0x30')],_0x6d1486[_0x1abf('0x32')]);_0x1d42a1[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x6d1486[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x2eabd6['query'][_0x1abf('0x35')]));_0x1d42a1[_0x1abf('0x36')]=_0x1d42a1[_0x1abf('0x36')]['length']?_0x1d42a1[_0x1abf('0x36')]:_0x6d1486[_0x1abf('0x30')];if(_0x2eabd6[_0x1abf('0x32')][_0x1abf('0x41')]){_0x1d42a1[_0x1abf('0x42')]=[{'all':!![]}];}_0x1d42a1=_[_0x1abf('0x3f')]({},_0x1d42a1,_0x2eabd6[_0x1abf('0x47')]);return db[_0x1abf('0x2c')][_0x1abf('0x48')](_0x1d42a1)[_0x1abf('0x25')](handleEntityNotFound(_0x208ce3,null))[_0x1abf('0x25')](respondWithResult(_0x208ce3,null))[_0x1abf('0x49')](handleError(_0x208ce3,null));};exports[_0x1abf('0x4a')]=function(_0x11046b,_0x127d15){return db[_0x1abf('0x2c')][_0x1abf('0x4a')](_0x11046b[_0x1abf('0x4b')],{})[_0x1abf('0x25')](respondWithResult(_0x127d15,0xc9))[_0x1abf('0x49')](handleError(_0x127d15,null));};exports[_0x1abf('0x24')]=function(_0x4c5e6d,_0x1ac83e){if(_0x4c5e6d[_0x1abf('0x4b')]['id']){delete _0x4c5e6d[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x2c')][_0x1abf('0x48')]({'where':{'id':_0x4c5e6d['params']['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x1ac83e,null))[_0x1abf('0x25')](saveUpdates(_0x4c5e6d['body'],null))['then'](respondWithResult(_0x1ac83e,null))['catch'](handleError(_0x1ac83e,null));};exports[_0x1abf('0x26')]=function(_0x587f6f,_0x264fb1){return db['ZendeskConfiguration']['find']({'where':{'id':_0x587f6f[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x264fb1,null))[_0x1abf('0x25')](removeEntity(_0x264fb1,null))['catch'](handleError(_0x264fb1,null));};exports['getFields']=function(_0x1241e8,_0x162f2b,_0xf2c791){var _0x5dbc77={};var _0x32a80b={};var _0xc0d4c1;var _0x1c4aa5;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x1241e8[_0x1abf('0x45')]['id']}})['then'](handleEntityNotFound(_0x162f2b,null))[_0x1abf('0x25')](function(_0x4cffac){if(_0x4cffac){_0xc0d4c1=_0x4cffac;_0x32a80b[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')]['rawAttributes']);_0x32a80b[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x1241e8[_0x1abf('0x32')]);_0x32a80b[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x32a80b[_0x1abf('0x30')],_0x32a80b[_0x1abf('0x32')]);_0x5dbc77[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x32a80b[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x1241e8[_0x1abf('0x32')]['fields']));_0x5dbc77[_0x1abf('0x36')]=_0x5dbc77[_0x1abf('0x36')][_0x1abf('0x37')]?_0x5dbc77[_0x1abf('0x36')]:_0x32a80b['model'];_0x5dbc77[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x1241e8['query'][_0x1abf('0x4e')]);_0x5dbc77[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_['pick'](_0x1241e8[_0x1abf('0x32')],_0x32a80b['filters']));if(_0x1241e8[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x5dbc77[_0x1abf('0x3e')]=_['merge'](_0x5dbc77[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x5dbc77[_0x1abf('0x36')],function(_0x4bd962){var _0x338bd9={};_0x338bd9[_0x4bd962]={'$like':'%'+_0x1241e8['query'][_0x1abf('0x3d')]+'%'};return _0x338bd9;})});}_0x5dbc77=_[_0x1abf('0x3f')]({},_0x5dbc77,_0x1241e8[_0x1abf('0x47')]);return _0xc0d4c1['getFields'](_0x5dbc77);}})['then'](function(_0x5b657c){if(_0x5b657c){_0x1c4aa5=_0x5b657c[_0x1abf('0x37')];if(!_0x1241e8[_0x1abf('0x32')][_0x1abf('0x38')]('nolimit')){_0x5dbc77[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x1241e8[_0x1abf('0x32')]['limit']);_0x5dbc77[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x1241e8[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0xc0d4c1['getFields'](_0x5dbc77);}})['then'](function(_0x1dc1c1){if(_0x1dc1c1){return _0x1dc1c1?{'count':_0x1c4aa5,'rows':_0x1dc1c1}:null;}})[_0x1abf('0x25')](respondWithResult(_0x162f2b,null))[_0x1abf('0x49')](handleError(_0x162f2b,null));};exports['getSubjects']=function(_0x49dbff,_0x2cab4c,_0x3328d4){var _0x3b8849={};var _0x4d22ed={};var _0x2fe167;var _0x2661e2;return db['ZendeskConfiguration'][_0x1abf('0x4c')]({'where':{'id':_0x49dbff[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x2cab4c,null))[_0x1abf('0x25')](function(_0x457c65){if(_0x457c65){_0x2fe167=_0x457c65;_0x4d22ed[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')]['rawAttributes']);_0x4d22ed[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x49dbff['query']);_0x4d22ed[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x4d22ed[_0x1abf('0x30')],_0x4d22ed[_0x1abf('0x32')]);_0x3b8849['attributes']=_[_0x1abf('0x34')](_0x4d22ed['model'],qs['fields'](_0x49dbff[_0x1abf('0x32')][_0x1abf('0x35')]));_0x3b8849['attributes']=_0x3b8849['attributes'][_0x1abf('0x37')]?_0x3b8849['attributes']:_0x4d22ed[_0x1abf('0x30')];_0x3b8849[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x49dbff[_0x1abf('0x32')]['sort']);_0x3b8849[_0x1abf('0x3e')]=qs['filters'](_[_0x1abf('0x3c')](_0x49dbff['query'],_0x4d22ed[_0x1abf('0x33')]));if(_0x49dbff[_0x1abf('0x32')][_0x1abf('0x3d')]){_0x3b8849[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x3b8849[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0x3b8849[_0x1abf('0x36')],function(_0x5742b2){var _0x2cf109={};_0x2cf109[_0x5742b2]={'$like':'%'+_0x49dbff[_0x1abf('0x32')][_0x1abf('0x3d')]+'%'};return _0x2cf109;})});}_0x3b8849=_[_0x1abf('0x3f')]({},_0x3b8849,_0x49dbff[_0x1abf('0x47')]);return _0x2fe167['getSubjects'](_0x3b8849);}})[_0x1abf('0x25')](function(_0x35e92e){if(_0x35e92e){_0x2661e2=_0x35e92e[_0x1abf('0x37')];if(!_0x49dbff[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x3b8849[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x49dbff['query'][_0x1abf('0x3a')]);_0x3b8849[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x49dbff[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0x2fe167[_0x1abf('0x4f')](_0x3b8849);}})[_0x1abf('0x25')](function(_0x488347){if(_0x488347){return _0x488347?{'count':_0x2661e2,'rows':_0x488347}:null;}})['then'](respondWithResult(_0x2cab4c,null))['catch'](handleError(_0x2cab4c,null));};exports[_0x1abf('0x50')]=function(_0x7e685,_0x330442,_0x68e25e){var _0xfa85ec={};var _0x1e69a4={};var _0x3c3f97;var _0x1c509c;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x7e685[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x330442,null))[_0x1abf('0x25')](function(_0x3f86c4){if(_0x3f86c4){_0x3c3f97=_0x3f86c4;_0x1e69a4[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x4d')][_0x1abf('0x2d')]);_0x1e69a4[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x7e685['query']);_0x1e69a4[_0x1abf('0x33')]=_['intersection'](_0x1e69a4[_0x1abf('0x30')],_0x1e69a4[_0x1abf('0x32')]);_0xfa85ec[_0x1abf('0x36')]=_[_0x1abf('0x34')](_0x1e69a4[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x7e685[_0x1abf('0x32')][_0x1abf('0x35')]));_0xfa85ec['attributes']=_0xfa85ec[_0x1abf('0x36')][_0x1abf('0x37')]?_0xfa85ec[_0x1abf('0x36')]:_0x1e69a4[_0x1abf('0x30')];_0xfa85ec[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x7e685[_0x1abf('0x32')][_0x1abf('0x4e')]);_0xfa85ec[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_[_0x1abf('0x3c')](_0x7e685[_0x1abf('0x32')],_0x1e69a4['filters']));if(_0x7e685[_0x1abf('0x32')][_0x1abf('0x3d')]){_0xfa85ec[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0xfa85ec[_0x1abf('0x3e')],{'$or':_[_0x1abf('0x31')](_0xfa85ec['attributes'],function(_0x5ca87b){var _0x4f4bc9={};_0x4f4bc9[_0x5ca87b]={'$like':'%'+_0x7e685['query'][_0x1abf('0x3d')]+'%'};return _0x4f4bc9;})});}_0xfa85ec=_[_0x1abf('0x3f')]({},_0xfa85ec,_0x7e685[_0x1abf('0x47')]);return _0x3c3f97[_0x1abf('0x50')](_0xfa85ec);}})['then'](function(_0x4556bb){if(_0x4556bb){_0x1c509c=_0x4556bb[_0x1abf('0x37')];if(!_0x7e685['query'][_0x1abf('0x38')](_0x1abf('0x39'))){_0xfa85ec[_0x1abf('0x3a')]=qs['limit'](_0x7e685[_0x1abf('0x32')][_0x1abf('0x3a')]);_0xfa85ec['offset']=qs[_0x1abf('0x1f')](_0x7e685[_0x1abf('0x32')]['offset']);}return _0x3c3f97[_0x1abf('0x50')](_0xfa85ec);}})[_0x1abf('0x25')](function(_0x65bcf1){if(_0x65bcf1){return _0x65bcf1?{'count':_0x1c509c,'rows':_0x65bcf1}:null;}})['then'](respondWithResult(_0x330442,null))[_0x1abf('0x49')](handleError(_0x330442,null));};exports[_0x1abf('0x51')]=function(_0x46522b,_0xa90dd,_0x2d3a16){var _0x189864={};var _0x47306a={};var _0x4936d0;var _0xed3b8f;return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x46522b[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0xa90dd,null))['then'](function(_0x35549c){if(_0x35549c){_0x4936d0=_0x35549c;_0x47306a[_0x1abf('0x30')]=_['keys'](db[_0x1abf('0x52')][_0x1abf('0x2d')]);_0x47306a[_0x1abf('0x32')]=_[_0x1abf('0x46')](_0x46522b[_0x1abf('0x32')]);_0x47306a[_0x1abf('0x33')]=_[_0x1abf('0x34')](_0x47306a['model'],_0x47306a['query']);_0x189864[_0x1abf('0x36')]=_['intersection'](_0x47306a[_0x1abf('0x30')],qs[_0x1abf('0x35')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x35')]));_0x189864[_0x1abf('0x36')]=_0x189864[_0x1abf('0x36')][_0x1abf('0x37')]?_0x189864[_0x1abf('0x36')]:_0x47306a[_0x1abf('0x30')];_0x189864[_0x1abf('0x3b')]=qs[_0x1abf('0x4e')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x4e')]);_0x189864[_0x1abf('0x3e')]=qs[_0x1abf('0x33')](_[_0x1abf('0x3c')](_0x46522b[_0x1abf('0x32')],_0x47306a[_0x1abf('0x33')]));if(_0x46522b['query']['filter']){_0x189864[_0x1abf('0x3e')]=_[_0x1abf('0x3f')](_0x189864[_0x1abf('0x3e')],{'$or':_['map'](_0x189864[_0x1abf('0x36')],function(_0x5a5002){var _0x4e58cd={};_0x4e58cd[_0x5a5002]={'$like':'%'+_0x46522b[_0x1abf('0x32')][_0x1abf('0x3d')]+'%'};return _0x4e58cd;})});}_0x189864=_[_0x1abf('0x3f')]({},_0x189864,_0x46522b[_0x1abf('0x47')]);return _0x4936d0[_0x1abf('0x51')](_0x189864);}})[_0x1abf('0x25')](function(_0x55d3bc){if(_0x55d3bc){_0xed3b8f=_0x55d3bc[_0x1abf('0x37')];if(!_0x46522b[_0x1abf('0x32')][_0x1abf('0x38')](_0x1abf('0x39'))){_0x189864[_0x1abf('0x3a')]=qs[_0x1abf('0x3a')](_0x46522b[_0x1abf('0x32')]['limit']);_0x189864[_0x1abf('0x1f')]=qs[_0x1abf('0x1f')](_0x46522b[_0x1abf('0x32')][_0x1abf('0x1f')]);}return _0x4936d0[_0x1abf('0x51')](_0x189864);}})[_0x1abf('0x25')](function(_0x3b64ae){if(_0x3b64ae){return _0x3b64ae?{'count':_0xed3b8f,'rows':_0x3b64ae}:null;}})[_0x1abf('0x25')](respondWithResult(_0xa90dd,null))[_0x1abf('0x49')](handleError(_0xa90dd,null));};exports[_0x1abf('0x53')]=function(_0x50da0a,_0x31b309,_0x28d547){if(_0x50da0a['body']['id']){delete _0x50da0a[_0x1abf('0x4b')]['id'];}return db[_0x1abf('0x2c')][_0x1abf('0x4c')]({'where':{'id':_0x50da0a[_0x1abf('0x45')]['id']}})[_0x1abf('0x25')](handleEntityNotFound(_0x31b309,null))[_0x1abf('0x25')](function(_0x212284){if(_0x212284){return _0x212284['setTags'](_0x50da0a['body'][_0x1abf('0x54')]||[]);}return null;})[_0x1abf('0x25')](respondWithResult(_0x31b309,null))[_0x1abf('0x49')](handleError(_0x31b309,null));}; \ No newline at end of file +var _0x2bd3=['intersection','length','find','create','body','update','destroy','findOne','ZendeskField','getFields','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','end','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params'];(function(_0x439c14,_0xae03c4){var _0x5ed5ee=function(_0x4092ad){while(--_0x4092ad){_0x439c14['push'](_0x439c14['shift']());}};_0x5ed5ee(++_0xae03c4);}(_0x2bd3,0x112));var _0x32bd=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2bd3[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require(_0x32bd('0x0'));var rimraf=require(_0x32bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x32bd('0x2'));var moment=require(_0x32bd('0x3'));var BPromise=require(_0x32bd('0x4'));var Mustache=require(_0x32bd('0x5'));var util=require(_0x32bd('0x6'));var path=require(_0x32bd('0x7'));var sox=require(_0x32bd('0x8'));var csv=require(_0x32bd('0x9'));var ejs=require(_0x32bd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32bd('0xb'));var squel=require(_0x32bd('0xc'));var crypto=require(_0x32bd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x32bd('0x9'));var querystring=require(_0x32bd('0xe'));var Papa=require(_0x32bd('0xf'));var Redis=require('ioredis');var authService=require(_0x32bd('0x10'));var qs=require(_0x32bd('0x11'));var as=require(_0x32bd('0x12'));var hardwareService=require(_0x32bd('0x13'));var logger=require(_0x32bd('0x14'))(_0x32bd('0x15'));var utils=require(_0x32bd('0x16'));var config=require(_0x32bd('0x17'));var licenseUtil=require(_0x32bd('0x18'));var db=require(_0x32bd('0x19'))['db'];function respondWithStatusCode(_0x5ca133,_0x4b920f){_0x4b920f=_0x4b920f||0xcc;return function(_0x2d75a5){if(_0x2d75a5){return _0x5ca133[_0x32bd('0x1a')](_0x4b920f);}return _0x5ca133['status'](_0x4b920f)['end']();};}function respondWithResult(_0x34e0e8,_0x5b7b72){_0x5b7b72=_0x5b7b72||0xc8;return function(_0x5d6619){if(_0x5d6619){return _0x34e0e8[_0x32bd('0x1b')](_0x5b7b72)['json'](_0x5d6619);}};}function respondWithFilteredResult(_0x970853,_0x2bc240){return function(_0x50ecb4){if(_0x50ecb4){var _0x5cd10e=typeof _0x2bc240[_0x32bd('0x1c')]===_0x32bd('0x1d')&&typeof _0x2bc240[_0x32bd('0x1e')]===_0x32bd('0x1d');var _0x34658e=_0x50ecb4[_0x32bd('0x1f')];var _0x221da3=_0x5cd10e?0x0:_0x2bc240[_0x32bd('0x1c')];var _0x35208e=_0x5cd10e?_0x50ecb4[_0x32bd('0x1f')]:_0x2bc240[_0x32bd('0x1c')]+_0x2bc240[_0x32bd('0x1e')];var _0x454e68;if(_0x35208e>=_0x34658e){_0x35208e=_0x34658e;_0x454e68=0xc8;}else{_0x454e68=0xce;}_0x970853['status'](_0x454e68);return _0x970853[_0x32bd('0x20')](_0x32bd('0x21'),_0x221da3+'-'+_0x35208e+'/'+_0x34658e)[_0x32bd('0x22')](_0x50ecb4);}return null;};}function patchUpdates(_0xa3f14b){return function(_0x345a07){try{jsonpatch[_0x32bd('0x23')](_0x345a07,_0xa3f14b,!![]);}catch(_0x25fbf4){return BPromise[_0x32bd('0x24')](_0x25fbf4);}return _0x345a07[_0x32bd('0x25')]();};}function saveUpdates(_0x34fd5a,_0x12f601){return function(_0x468268){if(_0x468268){return _0x468268['update'](_0x34fd5a)[_0x32bd('0x26')](function(_0x125671){return _0x125671;});}return null;};}function removeEntity(_0x1143f5,_0x485725){return function(_0x17877f){if(_0x17877f){return _0x17877f['destroy']()['then'](function(){_0x1143f5['status'](0xcc)[_0x32bd('0x27')]();});}};}function handleEntityNotFound(_0x3f47ea,_0x1f855b){return function(_0x5e0ac4){if(!_0x5e0ac4){_0x3f47ea[_0x32bd('0x1a')](0x194);}return _0x5e0ac4;};}function handleError(_0x3f583,_0x1607f2){_0x1607f2=_0x1607f2||0x1f4;return function(_0x4751e3){logger[_0x32bd('0x28')](_0x4751e3['stack']);if(_0x4751e3[_0x32bd('0x29')]){delete _0x4751e3[_0x32bd('0x29')];}_0x3f583['status'](_0x1607f2)[_0x32bd('0x2a')](_0x4751e3);};}exports[_0x32bd('0x2b')]=function(_0x20d658,_0x4f6345){var _0x3e6687={},_0x10370d={},_0x398c6c={'count':0x0,'rows':[]};var _0x55f5a9=_[_0x32bd('0x2c')](db[_0x32bd('0x2d')][_0x32bd('0x2e')],function(_0x481478){return{'name':_0x481478[_0x32bd('0x2f')],'type':_0x481478[_0x32bd('0x30')][_0x32bd('0x31')]};});_0x10370d['model']=_[_0x32bd('0x2c')](_0x55f5a9,_0x32bd('0x29'));_0x10370d[_0x32bd('0x32')]=_[_0x32bd('0x33')](_0x20d658[_0x32bd('0x32')]);_0x10370d[_0x32bd('0x34')]=_['intersection'](_0x10370d[_0x32bd('0x35')],_0x10370d[_0x32bd('0x32')]);_0x3e6687[_0x32bd('0x36')]=_['intersection'](_0x10370d[_0x32bd('0x35')],qs[_0x32bd('0x37')](_0x20d658[_0x32bd('0x32')]['fields']));_0x3e6687[_0x32bd('0x36')]=_0x3e6687['attributes']['length']?_0x3e6687[_0x32bd('0x36')]:_0x10370d[_0x32bd('0x35')];if(!_0x20d658[_0x32bd('0x32')]['hasOwnProperty'](_0x32bd('0x38'))){_0x3e6687[_0x32bd('0x1e')]=qs[_0x32bd('0x1e')](_0x20d658[_0x32bd('0x32')][_0x32bd('0x1e')]);_0x3e6687['offset']=qs[_0x32bd('0x1c')](_0x20d658['query'][_0x32bd('0x1c')]);}_0x3e6687[_0x32bd('0x39')]=qs[_0x32bd('0x3a')](_0x20d658[_0x32bd('0x32')]['sort']);_0x3e6687[_0x32bd('0x3b')]=qs[_0x32bd('0x34')](_[_0x32bd('0x3c')](_0x20d658[_0x32bd('0x32')],_0x10370d[_0x32bd('0x34')]),_0x55f5a9);if(_0x20d658[_0x32bd('0x32')][_0x32bd('0x3d')]){_0x3e6687[_0x32bd('0x3b')]=_[_0x32bd('0x3e')](_0x3e6687[_0x32bd('0x3b')],{'$or':_['map'](_0x55f5a9,function(_0x3ab7e9){if(_0x3ab7e9[_0x32bd('0x30')]!=='VIRTUAL'){var _0x18a0eb={};_0x18a0eb[_0x3ab7e9['name']]={'$like':'%'+_0x20d658[_0x32bd('0x32')][_0x32bd('0x3d')]+'%'};return _0x18a0eb;}})});}_0x3e6687=_['merge']({},_0x3e6687,_0x20d658[_0x32bd('0x3f')]);var _0x4bff7a={'where':_0x3e6687['where']};return db[_0x32bd('0x2d')][_0x32bd('0x1f')](_0x4bff7a)['then'](function(_0x3bbf23){_0x398c6c[_0x32bd('0x1f')]=_0x3bbf23;if(_0x20d658['query'][_0x32bd('0x40')]){_0x3e6687[_0x32bd('0x41')]=[{'all':!![]}];}return db[_0x32bd('0x2d')]['findAll'](_0x3e6687);})[_0x32bd('0x26')](function(_0x1909e7){_0x398c6c[_0x32bd('0x42')]=_0x1909e7;return _0x398c6c;})[_0x32bd('0x26')](respondWithFilteredResult(_0x4f6345,_0x3e6687))[_0x32bd('0x43')](handleError(_0x4f6345,null));};exports[_0x32bd('0x44')]=function(_0x5660cc,_0x34333d){var _0x2b9398={'raw':![],'where':{'id':_0x5660cc[_0x32bd('0x45')]['id']}},_0x4ba556={};_0x4ba556[_0x32bd('0x35')]=_[_0x32bd('0x33')](db['ZendeskConfiguration'][_0x32bd('0x2e')]);_0x4ba556[_0x32bd('0x32')]=_['keys'](_0x5660cc[_0x32bd('0x32')]);_0x4ba556[_0x32bd('0x34')]=_[_0x32bd('0x46')](_0x4ba556['model'],_0x4ba556[_0x32bd('0x32')]);_0x2b9398[_0x32bd('0x36')]=_[_0x32bd('0x46')](_0x4ba556[_0x32bd('0x35')],qs[_0x32bd('0x37')](_0x5660cc['query']['fields']));_0x2b9398[_0x32bd('0x36')]=_0x2b9398[_0x32bd('0x36')][_0x32bd('0x47')]?_0x2b9398[_0x32bd('0x36')]:_0x4ba556[_0x32bd('0x35')];if(_0x5660cc[_0x32bd('0x32')][_0x32bd('0x40')]){_0x2b9398['include']=[{'all':!![]}];}_0x2b9398=_[_0x32bd('0x3e')]({},_0x2b9398,_0x5660cc[_0x32bd('0x3f')]);return db['ZendeskConfiguration'][_0x32bd('0x48')](_0x2b9398)[_0x32bd('0x26')](handleEntityNotFound(_0x34333d,null))[_0x32bd('0x26')](respondWithResult(_0x34333d,null))[_0x32bd('0x43')](handleError(_0x34333d,null));};exports[_0x32bd('0x49')]=function(_0xc65a4e,_0x23a464){return db['ZendeskConfiguration'][_0x32bd('0x49')](_0xc65a4e[_0x32bd('0x4a')],{})[_0x32bd('0x26')](respondWithResult(_0x23a464,0xc9))[_0x32bd('0x43')](handleError(_0x23a464,null));};exports[_0x32bd('0x4b')]=function(_0xf32c9e,_0x36ce0b){if(_0xf32c9e[_0x32bd('0x4a')]['id']){delete _0xf32c9e['body']['id'];}return db['ZendeskConfiguration'][_0x32bd('0x48')]({'where':{'id':_0xf32c9e['params']['id']}})[_0x32bd('0x26')](handleEntityNotFound(_0x36ce0b,null))[_0x32bd('0x26')](saveUpdates(_0xf32c9e[_0x32bd('0x4a')],null))['then'](respondWithResult(_0x36ce0b,null))[_0x32bd('0x43')](handleError(_0x36ce0b,null));};exports[_0x32bd('0x4c')]=function(_0xf705eb,_0x2d0223){return db[_0x32bd('0x2d')][_0x32bd('0x48')]({'where':{'id':_0xf705eb[_0x32bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d0223,null))[_0x32bd('0x26')](removeEntity(_0x2d0223,null))[_0x32bd('0x43')](handleError(_0x2d0223,null));};exports['getFields']=function(_0x215e18,_0x52a698,_0x314ea1){var _0x15ed5={};var _0xa15c5={};var _0x4ded0e;var _0x58a338;return db['ZendeskConfiguration'][_0x32bd('0x4d')]({'where':{'id':_0x215e18['params']['id']}})[_0x32bd('0x26')](handleEntityNotFound(_0x52a698,null))[_0x32bd('0x26')](function(_0x142d59){if(_0x142d59){_0x4ded0e=_0x142d59;_0xa15c5[_0x32bd('0x35')]=_['keys'](db[_0x32bd('0x4e')][_0x32bd('0x2e')]);_0xa15c5['query']=_[_0x32bd('0x33')](_0x215e18[_0x32bd('0x32')]);_0xa15c5['filters']=_[_0x32bd('0x46')](_0xa15c5[_0x32bd('0x35')],_0xa15c5[_0x32bd('0x32')]);_0x15ed5['attributes']=_['intersection'](_0xa15c5[_0x32bd('0x35')],qs['fields'](_0x215e18[_0x32bd('0x32')]['fields']));_0x15ed5[_0x32bd('0x36')]=_0x15ed5['attributes']['length']?_0x15ed5[_0x32bd('0x36')]:_0xa15c5[_0x32bd('0x35')];_0x15ed5[_0x32bd('0x39')]=qs[_0x32bd('0x3a')](_0x215e18[_0x32bd('0x32')][_0x32bd('0x3a')]);_0x15ed5[_0x32bd('0x3b')]=qs[_0x32bd('0x34')](_[_0x32bd('0x3c')](_0x215e18[_0x32bd('0x32')],_0xa15c5[_0x32bd('0x34')]));if(_0x215e18[_0x32bd('0x32')][_0x32bd('0x3d')]){_0x15ed5[_0x32bd('0x3b')]=_[_0x32bd('0x3e')](_0x15ed5['where'],{'$or':_[_0x32bd('0x2c')](_0x15ed5[_0x32bd('0x36')],function(_0x2ca294){var _0x5334fc={};_0x5334fc[_0x2ca294]={'$like':'%'+_0x215e18[_0x32bd('0x32')]['filter']+'%'};return _0x5334fc;})});}_0x15ed5=_['merge']({},_0x15ed5,_0x215e18[_0x32bd('0x3f')]);return _0x4ded0e['getFields'](_0x15ed5);}})[_0x32bd('0x26')](function(_0x184a44){if(_0x184a44){_0x58a338=_0x184a44[_0x32bd('0x47')];if(!_0x215e18[_0x32bd('0x32')]['hasOwnProperty'](_0x32bd('0x38'))){_0x15ed5[_0x32bd('0x1e')]=qs['limit'](_0x215e18[_0x32bd('0x32')][_0x32bd('0x1e')]);_0x15ed5[_0x32bd('0x1c')]=qs['offset'](_0x215e18[_0x32bd('0x32')]['offset']);}return _0x4ded0e[_0x32bd('0x4f')](_0x15ed5);}})[_0x32bd('0x26')](function(_0x323489){if(_0x323489){return _0x323489?{'count':_0x58a338,'rows':_0x323489}:null;}})['then'](respondWithResult(_0x52a698,null))[_0x32bd('0x43')](handleError(_0x52a698,null));};exports[_0x32bd('0x50')]=function(_0x16a238,_0x4f5f85,_0x466751){var _0x20b30f={};var _0x46caf5={};var _0x37e3a2;var _0x4765fa;return db[_0x32bd('0x2d')][_0x32bd('0x4d')]({'where':{'id':_0x16a238['params']['id']}})[_0x32bd('0x26')](handleEntityNotFound(_0x4f5f85,null))[_0x32bd('0x26')](function(_0xdc772c){if(_0xdc772c){_0x37e3a2=_0xdc772c;_0x46caf5[_0x32bd('0x35')]=_['keys'](db[_0x32bd('0x4e')]['rawAttributes']);_0x46caf5['query']=_['keys'](_0x16a238[_0x32bd('0x32')]);_0x46caf5[_0x32bd('0x34')]=_['intersection'](_0x46caf5[_0x32bd('0x35')],_0x46caf5[_0x32bd('0x32')]);_0x20b30f[_0x32bd('0x36')]=_[_0x32bd('0x46')](_0x46caf5[_0x32bd('0x35')],qs[_0x32bd('0x37')](_0x16a238[_0x32bd('0x32')]['fields']));_0x20b30f[_0x32bd('0x36')]=_0x20b30f['attributes'][_0x32bd('0x47')]?_0x20b30f['attributes']:_0x46caf5[_0x32bd('0x35')];_0x20b30f[_0x32bd('0x39')]=qs[_0x32bd('0x3a')](_0x16a238[_0x32bd('0x32')][_0x32bd('0x3a')]);_0x20b30f[_0x32bd('0x3b')]=qs[_0x32bd('0x34')](_[_0x32bd('0x3c')](_0x16a238[_0x32bd('0x32')],_0x46caf5[_0x32bd('0x34')]));if(_0x16a238[_0x32bd('0x32')][_0x32bd('0x3d')]){_0x20b30f[_0x32bd('0x3b')]=_[_0x32bd('0x3e')](_0x20b30f['where'],{'$or':_[_0x32bd('0x2c')](_0x20b30f[_0x32bd('0x36')],function(_0x395b42){var _0x2da09a={};_0x2da09a[_0x395b42]={'$like':'%'+_0x16a238[_0x32bd('0x32')]['filter']+'%'};return _0x2da09a;})});}_0x20b30f=_[_0x32bd('0x3e')]({},_0x20b30f,_0x16a238[_0x32bd('0x3f')]);return _0x37e3a2['getSubjects'](_0x20b30f);}})['then'](function(_0x63c396){if(_0x63c396){_0x4765fa=_0x63c396[_0x32bd('0x47')];if(!_0x16a238['query'][_0x32bd('0x51')](_0x32bd('0x38'))){_0x20b30f[_0x32bd('0x1e')]=qs[_0x32bd('0x1e')](_0x16a238['query'][_0x32bd('0x1e')]);_0x20b30f[_0x32bd('0x1c')]=qs[_0x32bd('0x1c')](_0x16a238[_0x32bd('0x32')][_0x32bd('0x1c')]);}return _0x37e3a2[_0x32bd('0x50')](_0x20b30f);}})['then'](function(_0x2bc9b1){if(_0x2bc9b1){return _0x2bc9b1?{'count':_0x4765fa,'rows':_0x2bc9b1}:null;}})[_0x32bd('0x26')](respondWithResult(_0x4f5f85,null))[_0x32bd('0x43')](handleError(_0x4f5f85,null));};exports[_0x32bd('0x52')]=function(_0x42de00,_0x462f8f,_0x3b7d87){var _0xff2637={};var _0x2e78a7={};var _0x502fd7;var _0x1f220b;return db[_0x32bd('0x2d')][_0x32bd('0x4d')]({'where':{'id':_0x42de00[_0x32bd('0x45')]['id']}})[_0x32bd('0x26')](handleEntityNotFound(_0x462f8f,null))[_0x32bd('0x26')](function(_0x52b440){if(_0x52b440){_0x502fd7=_0x52b440;_0x2e78a7['model']=_['keys'](db['ZendeskField'][_0x32bd('0x2e')]);_0x2e78a7['query']=_[_0x32bd('0x33')](_0x42de00['query']);_0x2e78a7[_0x32bd('0x34')]=_[_0x32bd('0x46')](_0x2e78a7['model'],_0x2e78a7[_0x32bd('0x32')]);_0xff2637[_0x32bd('0x36')]=_['intersection'](_0x2e78a7[_0x32bd('0x35')],qs['fields'](_0x42de00[_0x32bd('0x32')][_0x32bd('0x37')]));_0xff2637['attributes']=_0xff2637[_0x32bd('0x36')][_0x32bd('0x47')]?_0xff2637[_0x32bd('0x36')]:_0x2e78a7['model'];_0xff2637[_0x32bd('0x39')]=qs[_0x32bd('0x3a')](_0x42de00[_0x32bd('0x32')][_0x32bd('0x3a')]);_0xff2637[_0x32bd('0x3b')]=qs[_0x32bd('0x34')](_['pick'](_0x42de00[_0x32bd('0x32')],_0x2e78a7[_0x32bd('0x34')]));if(_0x42de00[_0x32bd('0x32')][_0x32bd('0x3d')]){_0xff2637[_0x32bd('0x3b')]=_['merge'](_0xff2637[_0x32bd('0x3b')],{'$or':_[_0x32bd('0x2c')](_0xff2637[_0x32bd('0x36')],function(_0x26141a){var _0x3d6ec2={};_0x3d6ec2[_0x26141a]={'$like':'%'+_0x42de00[_0x32bd('0x32')][_0x32bd('0x3d')]+'%'};return _0x3d6ec2;})});}_0xff2637=_[_0x32bd('0x3e')]({},_0xff2637,_0x42de00[_0x32bd('0x3f')]);return _0x502fd7[_0x32bd('0x52')](_0xff2637);}})[_0x32bd('0x26')](function(_0x21c0cf){if(_0x21c0cf){_0x1f220b=_0x21c0cf[_0x32bd('0x47')];if(!_0x42de00['query'][_0x32bd('0x51')](_0x32bd('0x38'))){_0xff2637[_0x32bd('0x1e')]=qs[_0x32bd('0x1e')](_0x42de00[_0x32bd('0x32')][_0x32bd('0x1e')]);_0xff2637[_0x32bd('0x1c')]=qs[_0x32bd('0x1c')](_0x42de00[_0x32bd('0x32')][_0x32bd('0x1c')]);}return _0x502fd7[_0x32bd('0x52')](_0xff2637);}})[_0x32bd('0x26')](function(_0x5ad79f){if(_0x5ad79f){return _0x5ad79f?{'count':_0x1f220b,'rows':_0x5ad79f}:null;}})[_0x32bd('0x26')](respondWithResult(_0x462f8f,null))[_0x32bd('0x43')](handleError(_0x462f8f,null));};exports[_0x32bd('0x53')]=function(_0x344edb,_0x13182d,_0x32d8ff){var _0x36c489={};var _0x1deae4={};var _0x2b7704;var _0x79a2c1;return db[_0x32bd('0x2d')][_0x32bd('0x4d')]({'where':{'id':_0x344edb[_0x32bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x13182d,null))[_0x32bd('0x26')](function(_0x4d34c7){if(_0x4d34c7){_0x2b7704=_0x4d34c7;_0x1deae4[_0x32bd('0x35')]=_[_0x32bd('0x33')](db[_0x32bd('0x54')][_0x32bd('0x2e')]);_0x1deae4[_0x32bd('0x32')]=_['keys'](_0x344edb[_0x32bd('0x32')]);_0x1deae4[_0x32bd('0x34')]=_[_0x32bd('0x46')](_0x1deae4[_0x32bd('0x35')],_0x1deae4[_0x32bd('0x32')]);_0x36c489[_0x32bd('0x36')]=_[_0x32bd('0x46')](_0x1deae4[_0x32bd('0x35')],qs[_0x32bd('0x37')](_0x344edb[_0x32bd('0x32')][_0x32bd('0x37')]));_0x36c489[_0x32bd('0x36')]=_0x36c489[_0x32bd('0x36')]['length']?_0x36c489[_0x32bd('0x36')]:_0x1deae4[_0x32bd('0x35')];_0x36c489['order']=qs[_0x32bd('0x3a')](_0x344edb[_0x32bd('0x32')][_0x32bd('0x3a')]);_0x36c489[_0x32bd('0x3b')]=qs['filters'](_['pick'](_0x344edb['query'],_0x1deae4[_0x32bd('0x34')]));if(_0x344edb[_0x32bd('0x32')][_0x32bd('0x3d')]){_0x36c489[_0x32bd('0x3b')]=_['merge'](_0x36c489[_0x32bd('0x3b')],{'$or':_[_0x32bd('0x2c')](_0x36c489['attributes'],function(_0x57b556){var _0x27f1f7={};_0x27f1f7[_0x57b556]={'$like':'%'+_0x344edb['query'][_0x32bd('0x3d')]+'%'};return _0x27f1f7;})});}_0x36c489=_[_0x32bd('0x3e')]({},_0x36c489,_0x344edb['options']);return _0x2b7704['getTags'](_0x36c489);}})[_0x32bd('0x26')](function(_0xa7d8a6){if(_0xa7d8a6){_0x79a2c1=_0xa7d8a6[_0x32bd('0x47')];if(!_0x344edb[_0x32bd('0x32')][_0x32bd('0x51')](_0x32bd('0x38'))){_0x36c489[_0x32bd('0x1e')]=qs[_0x32bd('0x1e')](_0x344edb['query'][_0x32bd('0x1e')]);_0x36c489[_0x32bd('0x1c')]=qs[_0x32bd('0x1c')](_0x344edb[_0x32bd('0x32')][_0x32bd('0x1c')]);}return _0x2b7704['getTags'](_0x36c489);}})[_0x32bd('0x26')](function(_0x18034c){if(_0x18034c){return _0x18034c?{'count':_0x79a2c1,'rows':_0x18034c}:null;}})[_0x32bd('0x26')](respondWithResult(_0x13182d,null))['catch'](handleError(_0x13182d,null));};exports[_0x32bd('0x55')]=function(_0x53d69f,_0x40bc17,_0x53f655){if(_0x53d69f[_0x32bd('0x4a')]['id']){delete _0x53d69f['body']['id'];}return db[_0x32bd('0x2d')][_0x32bd('0x4d')]({'where':{'id':_0x53d69f['params']['id']}})[_0x32bd('0x26')](handleEntityNotFound(_0x40bc17,null))['then'](function(_0xeea051){if(_0xeea051){return _0xeea051[_0x32bd('0x55')](_0x53d69f[_0x32bd('0x4a')]['ids']||[]);}return null;})[_0x32bd('0x26')](respondWithResult(_0x40bc17,null))[_0x32bd('0x43')](handleError(_0x40bc17,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index af75e71..6548c66 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 _0xb9be=['path','rimraf','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5db2c7,_0x4c79c7){var _0x459dd9=function(_0x31f9d3){while(--_0x31f9d3){_0x5db2c7['push'](_0x5db2c7['shift']());}};_0x459dd9(++_0x4c79c7);}(_0xb9be,0xc5));var _0xeb9b=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xb9be[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf2f=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x547e56,_0x34aeb4){var _0xa0fcb3=function(_0x53f273){while(--_0x53f273){_0x547e56['push'](_0x547e56['shift']());}};_0xa0fcb3(++_0x34aeb4);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5105a2,_0x5b6309){_0x5105a2=_0x5105a2-0x0;var _0x35fa31=_0xcf2f[_0x5105a2];return _0x35fa31;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var logger=require(_0xfcf2('0x2'))(_0xfcf2('0x3'));var moment=require(_0xfcf2('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcf2('0x5'));var fs=require('fs');var path=require(_0xfcf2('0x6'));var rimraf=require(_0xfcf2('0x7'));var config=require(_0xfcf2('0x8'));var attributes=require(_0xfcf2('0x9'));module[_0xfcf2('0xa')]=function(_0x1e6d99,_0x3a4950){return _0x1e6d99[_0xfcf2('0xb')](_0xfcf2('0xc'),attributes,{'tableName':_0xfcf2('0xd'),'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 d2c1ff1..6a2fb18 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 _0x42d5=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x757222,_0x4f4259){var _0x28f476=function(_0x2d5761){while(--_0x2d5761){_0x757222['push'](_0x757222['shift']());}};_0x28f476(++_0x4f4259);}(_0x42d5,0x6c));var _0x542d=function(_0x18dcd4,_0x36e03e){_0x18dcd4=_0x18dcd4-0x0;var _0x1f7e7a=_0x42d5[_0x18dcd4];return _0x1f7e7a;};'use strict';var _=require('lodash');var util=require(_0x542d('0x0'));var moment=require(_0x542d('0x1'));var BPromise=require('bluebird');var rs=require(_0x542d('0x2'));var fs=require('fs');var Redis=require(_0x542d('0x3'));var db=require(_0x542d('0x4'))['db'];var utils=require(_0x542d('0x5'));var logger=require(_0x542d('0x6'))('rpc');var config=require(_0x542d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x542d('0x8')][_0x542d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3657d9,_0x1d969f,_0x2ae076){return new BPromise(function(_0x4e9454,_0x277bda){return client[_0x542d('0xa')](_0x3657d9,_0x2ae076)[_0x542d('0xb')](function(_0xb4d139){logger[_0x542d('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1d969f,'request\x20sent');logger['debug'](_0x542d('0xd'),_0x1d969f,_0x542d('0xe'),JSON[_0x542d('0xf')](_0xb4d139));if(_0xb4d139[_0x542d('0x10')]){if(_0xb4d139[_0x542d('0x10')]['code']===0x1f4){logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);return _0x277bda(_0xb4d139['error'][_0x542d('0x12')]);}logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);return _0x4e9454(_0xb4d139[_0x542d('0x10')][_0x542d('0x12')]);}else{logger[_0x542d('0xc')](_0x542d('0x11'),_0x1d969f,_0x542d('0xe'));_0x4e9454(_0xb4d139[_0x542d('0x13')]['message']);}})[_0x542d('0x14')](function(_0x44a141){logger[_0x542d('0x10')](_0x542d('0x11'),_0x1d969f,_0x44a141);_0x277bda(_0x44a141);});});} \ No newline at end of file +var _0x1d6e=['randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0x4f0683,_0x506aa4){var _0x3ec265=function(_0x3cf835){while(--_0x3cf835){_0x4f0683['push'](_0x4f0683['shift']());}};_0x3ec265(++_0x506aa4);}(_0x1d6e,0x1e1));var _0xe1d6=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x1d6e[_0x581af1];return _0x54c22e;};'use strict';var _=require(_0xe1d6('0x0'));var util=require(_0xe1d6('0x1'));var moment=require('moment');var BPromise=require(_0xe1d6('0x2'));var rs=require(_0xe1d6('0x3'));var fs=require('fs');var Redis=require(_0xe1d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1d6('0x5'));var logger=require(_0xe1d6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe1d6('0x7')][_0xe1d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f1bc2,_0x231605,_0x344dda){return new BPromise(function(_0x38cd92,_0x2c1cff){return client[_0xe1d6('0x9')](_0x4f1bc2,_0x344dda)[_0xe1d6('0xa')](function(_0x4f6303){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x231605,'request\x20sent');logger[_0xe1d6('0xb')](_0xe1d6('0xc'),_0x231605,_0xe1d6('0xd'),JSON[_0xe1d6('0xe')](_0x4f6303));if(_0x4f6303[_0xe1d6('0xf')]){if(_0x4f6303[_0xe1d6('0xf')][_0xe1d6('0x10')]===0x1f4){logger[_0xe1d6('0xf')](_0xe1d6('0x11'),_0x231605,_0x4f6303[_0xe1d6('0xf')][_0xe1d6('0x12')]);return _0x2c1cff(_0x4f6303[_0xe1d6('0xf')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x231605,_0x4f6303['error']['message']);return _0x38cd92(_0x4f6303[_0xe1d6('0xf')]['message']);}else{logger[_0xe1d6('0x13')](_0xe1d6('0x11'),_0x231605,'request\x20sent');_0x38cd92(_0x4f6303[_0xe1d6('0x14')]['message']);}})[_0xe1d6('0x15')](function(_0x496167){logger['error'](_0xe1d6('0x11'),_0x231605,_0x496167);_0x2c1cff(_0x496167);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e9895cc..98cac0f 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 _0x79e3=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79e3,0x16d));var _0x379e=function(_0x255536,_0x3815c3){_0x255536=_0x255536-0x0;var _0xd83e5a=_0x79e3[_0x255536];return _0xd83e5a;};'use strict';var multer=require(_0x379e('0x0'));var util=require(_0x379e('0x1'));var path=require(_0x379e('0x2'));var timeout=require(_0x379e('0x3'));var express=require(_0x379e('0x4'));var router=express[_0x379e('0x5')]();var fs_extra=require(_0x379e('0x6'));var auth=require(_0x379e('0x7'));var interaction=require(_0x379e('0x8'));var config=require(_0x379e('0x9'));var controller=require(_0x379e('0xa'));router[_0x379e('0xb')]('/',auth[_0x379e('0xc')](),controller['index']);router[_0x379e('0xb')](_0x379e('0xd'),auth[_0x379e('0xc')](),controller[_0x379e('0xe')]);router[_0x379e('0xf')]('/',auth[_0x379e('0xc')](),controller[_0x379e('0x10')]);router[_0x379e('0x11')](_0x379e('0xd'),auth['isAuthenticated'](),controller[_0x379e('0x12')]);router[_0x379e('0x13')]('/:id',auth[_0x379e('0xc')](),controller[_0x379e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x46e1=['get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x46e1,0x1ad));var _0x146e=function(_0xc6e5e1,_0x5b5bc2){_0xc6e5e1=_0xc6e5e1-0x0;var _0x5ba691=_0x46e1[_0xc6e5e1];return _0x5ba691;};'use strict';var multer=require('multer');var util=require(_0x146e('0x0'));var path=require(_0x146e('0x1'));var timeout=require(_0x146e('0x2'));var express=require(_0x146e('0x3'));var router=express[_0x146e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x146e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x146e('0x6'));var controller=require(_0x146e('0x7'));router[_0x146e('0x8')]('/',auth[_0x146e('0x9')](),controller[_0x146e('0xa')]);router[_0x146e('0x8')](_0x146e('0xb'),auth[_0x146e('0x9')](),controller[_0x146e('0xc')]);router[_0x146e('0xd')]('/',auth[_0x146e('0x9')](),controller[_0x146e('0xe')]);router[_0x146e('0xf')](_0x146e('0xb'),auth[_0x146e('0x9')](),controller['update']);router[_0x146e('0x10')](_0x146e('0xb'),auth['isAuthenticated'](),controller[_0x146e('0x11')]);module[_0x146e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index aa51e57..c056962 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 _0xa5a0=['sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1477ac,_0x1d44c3){var _0x19bbf8=function(_0x3edfd6){while(--_0x3edfd6){_0x1477ac['push'](_0x1477ac['shift']());}};_0x19bbf8(++_0x1d44c3);}(_0xa5a0,0x118));var _0x0a5a=function(_0x489c33,_0x314ad3){_0x489c33=_0x489c33-0x0;var _0x394565=_0xa5a0[_0x489c33];return _0x394565;};'use strict';var Sequelize=require(_0x0a5a('0x0'));module['exports']={'type':{'type':Sequelize[_0x0a5a('0x1')](_0x0a5a('0x2'),_0x0a5a('0x3'),_0x0a5a('0x4'),'keyValue',_0x0a5a('0x5')),'defaultValue':_0x0a5a('0x2')},'content':{'type':Sequelize[_0x0a5a('0x6')]},'key':{'type':Sequelize[_0x0a5a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x0a5a('0x2'),_0x0a5a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0a5a('0x6')]},'idField':{'type':Sequelize[_0x0a5a('0x6')]},'nameField':{'type':Sequelize[_0x0a5a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0a5a('0x6')]}}; \ No newline at end of file +var _0xfe1a=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports'];(function(_0x5c9b5c,_0x15fe74){var _0x6fe6da=function(_0xee9050){while(--_0xee9050){_0x5c9b5c['push'](_0x5c9b5c['shift']());}};_0x6fe6da(++_0x15fe74);}(_0xfe1a,0xfb));var _0xafe1=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xfe1a[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require('sequelize');module[_0xafe1('0x0')]={'type':{'type':Sequelize[_0xafe1('0x1')]('string',_0xafe1('0x2'),_0xafe1('0x3'),_0xafe1('0x4'),_0xafe1('0x5')),'defaultValue':_0xafe1('0x6')},'content':{'type':Sequelize[_0xafe1('0x7')]},'key':{'type':Sequelize[_0xafe1('0x7')]},'keyType':{'type':Sequelize[_0xafe1('0x1')](_0xafe1('0x6'),_0xafe1('0x2'),_0xafe1('0x3'))},'keyContent':{'type':Sequelize[_0xafe1('0x7')]},'idField':{'type':Sequelize[_0xafe1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xafe1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xafe1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index cb66364..5b6bdf5 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 _0x7df1=['stack','name','send','rawAttributes','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','options','ZendeskField','includeAll','findAll','rows','catch','show','include','find','create','body','params','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','save','update','destroy','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7df1,0x1bf));var _0x17df=function(_0x43e83e,_0x49b134){_0x43e83e=_0x43e83e-0x0;var _0x342b19=_0x7df1[_0x43e83e];return _0x342b19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x17df('0x0'));var zipdir=require(_0x17df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x17df('0x2'));var BPromise=require(_0x17df('0x3'));var Mustache=require('mustache');var util=require(_0x17df('0x4'));var path=require('path');var sox=require(_0x17df('0x5'));var csv=require(_0x17df('0x6'));var ejs=require(_0x17df('0x7'));var fs=require('fs');var fs_extra=require(_0x17df('0x8'));var _=require(_0x17df('0x9'));var squel=require(_0x17df('0xa'));var crypto=require(_0x17df('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x17df('0xc'));var toCsv=require(_0x17df('0x6'));var querystring=require('querystring');var Papa=require(_0x17df('0xd'));var Redis=require(_0x17df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x17df('0xf'));var as=require(_0x17df('0x10'));var hardwareService=require(_0x17df('0x11'));var logger=require(_0x17df('0x12'))('api');var utils=require(_0x17df('0x13'));var config=require(_0x17df('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x17df('0x15'))['db'];function respondWithStatusCode(_0x4e13e6,_0xca4eac){_0xca4eac=_0xca4eac||0xcc;return function(_0x3921b0){if(_0x3921b0){return _0x4e13e6[_0x17df('0x16')](_0xca4eac);}return _0x4e13e6[_0x17df('0x17')](_0xca4eac)[_0x17df('0x18')]();};}function respondWithResult(_0x43aca7,_0x78b498){_0x78b498=_0x78b498||0xc8;return function(_0x49adce){if(_0x49adce){return _0x43aca7['status'](_0x78b498)['json'](_0x49adce);}};}function respondWithFilteredResult(_0x803c23,_0x57e167){return function(_0xd9bf4b){if(_0xd9bf4b){var _0x52f488=typeof _0x57e167[_0x17df('0x19')]==='undefined'&&typeof _0x57e167[_0x17df('0x1a')]==='undefined';var _0x740193=_0xd9bf4b[_0x17df('0x1b')];var _0x3ee845=_0x52f488?0x0:_0x57e167['offset'];var _0x5d963b=_0x52f488?_0xd9bf4b[_0x17df('0x1b')]:_0x57e167[_0x17df('0x19')]+_0x57e167[_0x17df('0x1a')];var _0x26578b;if(_0x5d963b>=_0x740193){_0x5d963b=_0x740193;_0x26578b=0xc8;}else{_0x26578b=0xce;}_0x803c23[_0x17df('0x17')](_0x26578b);return _0x803c23[_0x17df('0x1c')]('Content-Range',_0x3ee845+'-'+_0x5d963b+'/'+_0x740193)[_0x17df('0x1d')](_0xd9bf4b);}return null;};}function patchUpdates(_0x46dc35){return function(_0x4999c7){try{jsonpatch['apply'](_0x4999c7,_0x46dc35,!![]);}catch(_0x476966){return BPromise[_0x17df('0x1e')](_0x476966);}return _0x4999c7[_0x17df('0x1f')]();};}function saveUpdates(_0x4e9a32,_0xccffff){return function(_0x14aae7){if(_0x14aae7){return _0x14aae7[_0x17df('0x20')](_0x4e9a32)['then'](function(_0x200b98){return _0x200b98;});}return null;};}function removeEntity(_0x9cc58e,_0x466efe){return function(_0x605cc9){if(_0x605cc9){return _0x605cc9[_0x17df('0x21')]()[_0x17df('0x22')](function(){_0x9cc58e[_0x17df('0x17')](0xcc)[_0x17df('0x18')]();});}};}function handleEntityNotFound(_0x4d44b0,_0x90f083){return function(_0x178abe){if(!_0x178abe){_0x4d44b0[_0x17df('0x16')](0x194);}return _0x178abe;};}function handleError(_0x307911,_0x5a0eb8){_0x5a0eb8=_0x5a0eb8||0x1f4;return function(_0x40e2fd){logger[_0x17df('0x23')](_0x40e2fd[_0x17df('0x24')]);if(_0x40e2fd[_0x17df('0x25')]){delete _0x40e2fd[_0x17df('0x25')];}_0x307911[_0x17df('0x17')](_0x5a0eb8)[_0x17df('0x26')](_0x40e2fd);};}exports['index']=function(_0x345975,_0x47219a){var _0x4256d3={},_0xfef9c2={},_0x11d5a7={'count':0x0,'rows':[]};var _0x5673ef=_['map'](db['ZendeskField'][_0x17df('0x27')],function(_0x383b3e){return{'name':_0x383b3e['fieldName'],'type':_0x383b3e[_0x17df('0x28')]['key']};});_0xfef9c2[_0x17df('0x29')]=_[_0x17df('0x2a')](_0x5673ef,_0x17df('0x25'));_0xfef9c2['query']=_[_0x17df('0x2b')](_0x345975['query']);_0xfef9c2['filters']=_[_0x17df('0x2c')](_0xfef9c2[_0x17df('0x29')],_0xfef9c2[_0x17df('0x2d')]);_0x4256d3[_0x17df('0x2e')]=_['intersection'](_0xfef9c2[_0x17df('0x29')],qs[_0x17df('0x2f')](_0x345975[_0x17df('0x2d')][_0x17df('0x2f')]));_0x4256d3[_0x17df('0x2e')]=_0x4256d3[_0x17df('0x2e')][_0x17df('0x30')]?_0x4256d3[_0x17df('0x2e')]:_0xfef9c2['model'];if(!_0x345975['query'][_0x17df('0x31')]('nolimit')){_0x4256d3['limit']=qs['limit'](_0x345975['query'][_0x17df('0x1a')]);_0x4256d3['offset']=qs['offset'](_0x345975['query'][_0x17df('0x19')]);}_0x4256d3[_0x17df('0x32')]=qs[_0x17df('0x33')](_0x345975[_0x17df('0x2d')][_0x17df('0x33')]);_0x4256d3[_0x17df('0x34')]=qs['filters'](_[_0x17df('0x35')](_0x345975['query'],_0xfef9c2[_0x17df('0x36')]),_0x5673ef);if(_0x345975['query']['filter']){_0x4256d3[_0x17df('0x34')]=_[_0x17df('0x37')](_0x4256d3[_0x17df('0x34')],{'$or':_[_0x17df('0x2a')](_0x5673ef,function(_0x354159){if(_0x354159[_0x17df('0x28')]!==_0x17df('0x38')){var _0x40a634={};_0x40a634[_0x354159[_0x17df('0x25')]]={'$like':'%'+_0x345975[_0x17df('0x2d')]['filter']+'%'};return _0x40a634;}})});}_0x4256d3=_[_0x17df('0x37')]({},_0x4256d3,_0x345975[_0x17df('0x39')]);var _0x57c9f8={'where':_0x4256d3[_0x17df('0x34')]};return db[_0x17df('0x3a')][_0x17df('0x1b')](_0x57c9f8)[_0x17df('0x22')](function(_0x919e2e){_0x11d5a7['count']=_0x919e2e;if(_0x345975['query'][_0x17df('0x3b')]){_0x4256d3['include']=[{'all':!![]}];}return db[_0x17df('0x3a')][_0x17df('0x3c')](_0x4256d3);})[_0x17df('0x22')](function(_0x5a36ee){_0x11d5a7[_0x17df('0x3d')]=_0x5a36ee;return _0x11d5a7;})[_0x17df('0x22')](respondWithFilteredResult(_0x47219a,_0x4256d3))[_0x17df('0x3e')](handleError(_0x47219a,null));};exports[_0x17df('0x3f')]=function(_0x81a360,_0x252f01){var _0x49348c={'raw':!![],'where':{'id':_0x81a360['params']['id']}},_0x5d3079={};_0x5d3079[_0x17df('0x29')]=_['keys'](db[_0x17df('0x3a')]['rawAttributes']);_0x5d3079['query']=_[_0x17df('0x2b')](_0x81a360[_0x17df('0x2d')]);_0x5d3079[_0x17df('0x36')]=_[_0x17df('0x2c')](_0x5d3079[_0x17df('0x29')],_0x5d3079[_0x17df('0x2d')]);_0x49348c[_0x17df('0x2e')]=_['intersection'](_0x5d3079[_0x17df('0x29')],qs[_0x17df('0x2f')](_0x81a360[_0x17df('0x2d')][_0x17df('0x2f')]));_0x49348c[_0x17df('0x2e')]=_0x49348c[_0x17df('0x2e')]['length']?_0x49348c[_0x17df('0x2e')]:_0x5d3079['model'];if(_0x81a360[_0x17df('0x2d')][_0x17df('0x3b')]){_0x49348c[_0x17df('0x40')]=[{'all':!![]}];}_0x49348c=_['merge']({},_0x49348c,_0x81a360[_0x17df('0x39')]);return db[_0x17df('0x3a')][_0x17df('0x41')](_0x49348c)[_0x17df('0x22')](handleEntityNotFound(_0x252f01,null))['then'](respondWithResult(_0x252f01,null))[_0x17df('0x3e')](handleError(_0x252f01,null));};exports[_0x17df('0x42')]=function(_0x41aecc,_0x5a1ff6){return db[_0x17df('0x3a')][_0x17df('0x42')](_0x41aecc[_0x17df('0x43')],{})[_0x17df('0x22')](respondWithResult(_0x5a1ff6,0xc9))[_0x17df('0x3e')](handleError(_0x5a1ff6,null));};exports[_0x17df('0x20')]=function(_0x124744,_0x54a81e){if(_0x124744[_0x17df('0x43')]['id']){delete _0x124744[_0x17df('0x43')]['id'];}return db['ZendeskField'][_0x17df('0x41')]({'where':{'id':_0x124744[_0x17df('0x44')]['id']}})[_0x17df('0x22')](handleEntityNotFound(_0x54a81e,null))[_0x17df('0x22')](saveUpdates(_0x124744[_0x17df('0x43')],null))['then'](respondWithResult(_0x54a81e,null))[_0x17df('0x3e')](handleError(_0x54a81e,null));};exports[_0x17df('0x21')]=function(_0x505bef,_0x204f24){return db['ZendeskField'][_0x17df('0x41')]({'where':{'id':_0x505bef[_0x17df('0x44')]['id']}})[_0x17df('0x22')](handleEntityNotFound(_0x204f24,null))['then'](removeEntity(_0x204f24,null))['catch'](handleError(_0x204f24,null));}; \ No newline at end of file +var _0xcaff=['end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','filter','where','merge','options','findAll','catch','params','length','includeAll','include','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3335a2,_0x3976d6){var _0x3b7381=function(_0x299903){while(--_0x299903){_0x3335a2['push'](_0x3335a2['shift']());}};_0x3b7381(++_0x3976d6);}(_0xcaff,0x73));var _0xfcaf=function(_0x1fd89a,_0x5b48c4){_0x1fd89a=_0x1fd89a-0x0;var _0x449742=_0xcaff[_0x1fd89a];return _0x449742;};'use strict';var emlformat=require(_0xfcaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcaf('0x1'));var jsonpatch=require(_0xfcaf('0x2'));var rp=require(_0xfcaf('0x3'));var moment=require(_0xfcaf('0x4'));var BPromise=require(_0xfcaf('0x5'));var Mustache=require(_0xfcaf('0x6'));var util=require('util');var path=require(_0xfcaf('0x7'));var sox=require(_0xfcaf('0x8'));var csv=require(_0xfcaf('0x9'));var ejs=require(_0xfcaf('0xa'));var fs=require('fs');var fs_extra=require(_0xfcaf('0xb'));var _=require('lodash');var squel=require(_0xfcaf('0xc'));var crypto=require(_0xfcaf('0xd'));var jsforce=require(_0xfcaf('0xe'));var deskjs=require(_0xfcaf('0xf'));var toCsv=require(_0xfcaf('0x9'));var querystring=require('querystring');var Papa=require(_0xfcaf('0x10'));var Redis=require(_0xfcaf('0x11'));var authService=require(_0xfcaf('0x12'));var qs=require(_0xfcaf('0x13'));var as=require(_0xfcaf('0x14'));var hardwareService=require(_0xfcaf('0x15'));var logger=require(_0xfcaf('0x16'))('api');var utils=require(_0xfcaf('0x17'));var config=require(_0xfcaf('0x18'));var licenseUtil=require(_0xfcaf('0x19'));var db=require(_0xfcaf('0x1a'))['db'];function respondWithStatusCode(_0x5aa6ac,_0x3a2e13){_0x3a2e13=_0x3a2e13||0xcc;return function(_0x2e175b){if(_0x2e175b){return _0x5aa6ac[_0xfcaf('0x1b')](_0x3a2e13);}return _0x5aa6ac[_0xfcaf('0x1c')](_0x3a2e13)[_0xfcaf('0x1d')]();};}function respondWithResult(_0x528b94,_0x31fb56){_0x31fb56=_0x31fb56||0xc8;return function(_0x20bc68){if(_0x20bc68){return _0x528b94['status'](_0x31fb56)[_0xfcaf('0x1e')](_0x20bc68);}};}function respondWithFilteredResult(_0x3059d3,_0x12a63c){return function(_0x4fc8ba){if(_0x4fc8ba){var _0x5b36c4=typeof _0x12a63c[_0xfcaf('0x1f')]===_0xfcaf('0x20')&&typeof _0x12a63c[_0xfcaf('0x21')]==='undefined';var _0xf7e410=_0x4fc8ba['count'];var _0x5b435b=_0x5b36c4?0x0:_0x12a63c[_0xfcaf('0x1f')];var _0x4cd36a=_0x5b36c4?_0x4fc8ba[_0xfcaf('0x22')]:_0x12a63c[_0xfcaf('0x1f')]+_0x12a63c[_0xfcaf('0x21')];var _0x4963d7;if(_0x4cd36a>=_0xf7e410){_0x4cd36a=_0xf7e410;_0x4963d7=0xc8;}else{_0x4963d7=0xce;}_0x3059d3['status'](_0x4963d7);return _0x3059d3[_0xfcaf('0x23')]('Content-Range',_0x5b435b+'-'+_0x4cd36a+'/'+_0xf7e410)['json'](_0x4fc8ba);}return null;};}function patchUpdates(_0x1603ce){return function(_0x3b3211){try{jsonpatch['apply'](_0x3b3211,_0x1603ce,!![]);}catch(_0x6ae35c){return BPromise[_0xfcaf('0x24')](_0x6ae35c);}return _0x3b3211['save']();};}function saveUpdates(_0x59ae10,_0x1b46f2){return function(_0xb266fe){if(_0xb266fe){return _0xb266fe[_0xfcaf('0x25')](_0x59ae10)[_0xfcaf('0x26')](function(_0x5ef2e6){return _0x5ef2e6;});}return null;};}function removeEntity(_0x5ebeaf,_0x285bcd){return function(_0x23f3e5){if(_0x23f3e5){return _0x23f3e5[_0xfcaf('0x27')]()[_0xfcaf('0x26')](function(){_0x5ebeaf[_0xfcaf('0x1c')](0xcc)[_0xfcaf('0x1d')]();});}};}function handleEntityNotFound(_0x2cf968,_0x3e3ede){return function(_0x859c3a){if(!_0x859c3a){_0x2cf968[_0xfcaf('0x1b')](0x194);}return _0x859c3a;};}function handleError(_0x1fa636,_0x41c6da){_0x41c6da=_0x41c6da||0x1f4;return function(_0x57adbd){logger[_0xfcaf('0x28')](_0x57adbd[_0xfcaf('0x29')]);if(_0x57adbd[_0xfcaf('0x2a')]){delete _0x57adbd[_0xfcaf('0x2a')];}_0x1fa636[_0xfcaf('0x1c')](_0x41c6da)[_0xfcaf('0x2b')](_0x57adbd);};}exports['index']=function(_0x3a7c09,_0x86844e){var _0x4e1164={},_0x1dd89c={},_0x4758e2={'count':0x0,'rows':[]};var _0x220dc6=_[_0xfcaf('0x2c')](db[_0xfcaf('0x2d')][_0xfcaf('0x2e')],function(_0x2af1b5){return{'name':_0x2af1b5[_0xfcaf('0x2f')],'type':_0x2af1b5[_0xfcaf('0x30')]['key']};});_0x1dd89c[_0xfcaf('0x31')]=_[_0xfcaf('0x2c')](_0x220dc6,_0xfcaf('0x2a'));_0x1dd89c[_0xfcaf('0x32')]=_[_0xfcaf('0x33')](_0x3a7c09[_0xfcaf('0x32')]);_0x1dd89c['filters']=_['intersection'](_0x1dd89c[_0xfcaf('0x31')],_0x1dd89c[_0xfcaf('0x32')]);_0x4e1164[_0xfcaf('0x34')]=_[_0xfcaf('0x35')](_0x1dd89c['model'],qs['fields'](_0x3a7c09[_0xfcaf('0x32')][_0xfcaf('0x36')]));_0x4e1164[_0xfcaf('0x34')]=_0x4e1164[_0xfcaf('0x34')]['length']?_0x4e1164[_0xfcaf('0x34')]:_0x1dd89c['model'];if(!_0x3a7c09[_0xfcaf('0x32')][_0xfcaf('0x37')]('nolimit')){_0x4e1164[_0xfcaf('0x21')]=qs[_0xfcaf('0x21')](_0x3a7c09[_0xfcaf('0x32')]['limit']);_0x4e1164[_0xfcaf('0x1f')]=qs[_0xfcaf('0x1f')](_0x3a7c09[_0xfcaf('0x32')][_0xfcaf('0x1f')]);}_0x4e1164[_0xfcaf('0x38')]=qs[_0xfcaf('0x39')](_0x3a7c09[_0xfcaf('0x32')][_0xfcaf('0x39')]);_0x4e1164['where']=qs['filters'](_['pick'](_0x3a7c09[_0xfcaf('0x32')],_0x1dd89c[_0xfcaf('0x3a')]),_0x220dc6);if(_0x3a7c09[_0xfcaf('0x32')][_0xfcaf('0x3b')]){_0x4e1164[_0xfcaf('0x3c')]=_[_0xfcaf('0x3d')](_0x4e1164[_0xfcaf('0x3c')],{'$or':_['map'](_0x220dc6,function(_0x518ec2){if(_0x518ec2[_0xfcaf('0x30')]!=='VIRTUAL'){var _0x5cd7e0={};_0x5cd7e0[_0x518ec2[_0xfcaf('0x2a')]]={'$like':'%'+_0x3a7c09['query'][_0xfcaf('0x3b')]+'%'};return _0x5cd7e0;}})});}_0x4e1164=_['merge']({},_0x4e1164,_0x3a7c09[_0xfcaf('0x3e')]);var _0x563c0c={'where':_0x4e1164[_0xfcaf('0x3c')]};return db[_0xfcaf('0x2d')][_0xfcaf('0x22')](_0x563c0c)[_0xfcaf('0x26')](function(_0x3e521a){_0x4758e2['count']=_0x3e521a;if(_0x3a7c09['query']['includeAll']){_0x4e1164['include']=[{'all':!![]}];}return db['ZendeskField'][_0xfcaf('0x3f')](_0x4e1164);})[_0xfcaf('0x26')](function(_0x52def1){_0x4758e2['rows']=_0x52def1;return _0x4758e2;})[_0xfcaf('0x26')](respondWithFilteredResult(_0x86844e,_0x4e1164))[_0xfcaf('0x40')](handleError(_0x86844e,null));};exports['show']=function(_0x4ea2c4,_0x15055d){var _0x4095d5={'raw':!![],'where':{'id':_0x4ea2c4[_0xfcaf('0x41')]['id']}},_0x13cdaf={};_0x13cdaf[_0xfcaf('0x31')]=_[_0xfcaf('0x33')](db[_0xfcaf('0x2d')]['rawAttributes']);_0x13cdaf[_0xfcaf('0x32')]=_['keys'](_0x4ea2c4['query']);_0x13cdaf[_0xfcaf('0x3a')]=_[_0xfcaf('0x35')](_0x13cdaf[_0xfcaf('0x31')],_0x13cdaf[_0xfcaf('0x32')]);_0x4095d5[_0xfcaf('0x34')]=_[_0xfcaf('0x35')](_0x13cdaf[_0xfcaf('0x31')],qs['fields'](_0x4ea2c4[_0xfcaf('0x32')][_0xfcaf('0x36')]));_0x4095d5['attributes']=_0x4095d5[_0xfcaf('0x34')][_0xfcaf('0x42')]?_0x4095d5[_0xfcaf('0x34')]:_0x13cdaf['model'];if(_0x4ea2c4[_0xfcaf('0x32')][_0xfcaf('0x43')]){_0x4095d5[_0xfcaf('0x44')]=[{'all':!![]}];}_0x4095d5=_[_0xfcaf('0x3d')]({},_0x4095d5,_0x4ea2c4[_0xfcaf('0x3e')]);return db[_0xfcaf('0x2d')]['find'](_0x4095d5)[_0xfcaf('0x26')](handleEntityNotFound(_0x15055d,null))['then'](respondWithResult(_0x15055d,null))[_0xfcaf('0x40')](handleError(_0x15055d,null));};exports[_0xfcaf('0x45')]=function(_0x3e4ae8,_0x33e714){return db[_0xfcaf('0x2d')][_0xfcaf('0x45')](_0x3e4ae8[_0xfcaf('0x46')],{})['then'](respondWithResult(_0x33e714,0xc9))[_0xfcaf('0x40')](handleError(_0x33e714,null));};exports[_0xfcaf('0x25')]=function(_0x4d64ec,_0x5b4634){if(_0x4d64ec[_0xfcaf('0x46')]['id']){delete _0x4d64ec['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x4d64ec[_0xfcaf('0x41')]['id']}})[_0xfcaf('0x26')](handleEntityNotFound(_0x5b4634,null))[_0xfcaf('0x26')](saveUpdates(_0x4d64ec[_0xfcaf('0x46')],null))[_0xfcaf('0x26')](respondWithResult(_0x5b4634,null))['catch'](handleError(_0x5b4634,null));};exports[_0xfcaf('0x27')]=function(_0x5e8d7b,_0xba889a){return db[_0xfcaf('0x2d')][_0xfcaf('0x47')]({'where':{'id':_0x5e8d7b[_0xfcaf('0x41')]['id']}})['then'](handleEntityNotFound(_0xba889a,null))[_0xfcaf('0x26')](removeEntity(_0xba889a,null))['catch'](handleError(_0xba889a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e70d55f..1b04962 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 _0x151b=['define','zendesk_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x46a9f2,_0x63d490){var _0x23117e=function(_0x46ac05){while(--_0x46ac05){_0x46a9f2['push'](_0x46a9f2['shift']());}};_0x23117e(++_0x63d490);}(_0x151b,0x1b3));var _0xb151=function(_0x28a7ba,_0x53a7b2){_0x28a7ba=_0x28a7ba-0x0;var _0x388fa4=_0x151b[_0x28a7ba];return _0x388fa4;};'use strict';var _=require(_0xb151('0x0'));var util=require('util');var logger=require(_0xb151('0x1'))(_0xb151('0x2'));var moment=require('moment');var BPromise=require(_0xb151('0x3'));var rp=require(_0xb151('0x4'));var fs=require('fs');var path=require(_0xb151('0x5'));var rimraf=require(_0xb151('0x6'));var config=require(_0xb151('0x7'));var attributes=require(_0xb151('0x8'));module['exports']=function(_0x13c32e,_0x124a8e){return _0x13c32e[_0xb151('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xb151('0xa'),'fields':['idField',_0xb151('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97a3=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','define','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x97a3,0xf0));var _0x397a=function(_0x20fcd7,_0x335651){_0x20fcd7=_0x20fcd7-0x0;var _0x36b4b9=_0x97a3[_0x20fcd7];return _0x36b4b9;};'use strict';var _=require(_0x397a('0x0'));var util=require(_0x397a('0x1'));var logger=require(_0x397a('0x2'))(_0x397a('0x3'));var moment=require('moment');var BPromise=require(_0x397a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x397a('0x5'));var rimraf=require('rimraf');var config=require(_0x397a('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x347776,_0xe73587){return _0x347776[_0x397a('0x7')]('ZendeskField',attributes,{'tableName':_0x397a('0x8'),'paranoid':![],'indexes':[{'name':_0x397a('0x9'),'fields':[_0x397a('0xa'),_0x397a('0xb')],'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 9ea98fe..ba974dc 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 _0xb7b7=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment'];(function(_0x2d1519,_0x6d4b66){var _0x28bbb1=function(_0x221502){while(--_0x221502){_0x2d1519['push'](_0x2d1519['shift']());}};_0x28bbb1(++_0x6d4b66);}(_0xb7b7,0xef));var _0x7b7b=function(_0x140bc7,_0x1743d2){_0x140bc7=_0x140bc7-0x0;var _0x1d1a7e=_0xb7b7[_0x140bc7];return _0x1d1a7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b7b('0x0'));var BPromise=require(_0x7b7b('0x1'));var rs=require(_0x7b7b('0x2'));var fs=require('fs');var Redis=require(_0x7b7b('0x3'));var db=require(_0x7b7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b7b('0x5'));var config=require(_0x7b7b('0x6'));var jayson=require(_0x7b7b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44ecd7,_0xf02958,_0x9545c6){return new BPromise(function(_0x384689,_0x40b110){return client[_0x7b7b('0x8')](_0x44ecd7,_0x9545c6)[_0x7b7b('0x9')](function(_0x31b056){logger[_0x7b7b('0xa')](_0x7b7b('0xb'),_0xf02958,_0x7b7b('0xc'));logger[_0x7b7b('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xf02958,'request\x20sent',JSON[_0x7b7b('0xe')](_0x31b056));if(_0x31b056[_0x7b7b('0xf')]){if(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x10')]===0x1f4){logger[_0x7b7b('0xf')]('ZendeskField,\x20%s,\x20%s',_0xf02958,_0x31b056[_0x7b7b('0xf')]['message']);return _0x40b110(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x11')]);}logger['error'](_0x7b7b('0xb'),_0xf02958,_0x31b056[_0x7b7b('0xf')]['message']);return _0x384689(_0x31b056[_0x7b7b('0xf')][_0x7b7b('0x11')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xf02958,_0x7b7b('0xc'));_0x384689(_0x31b056[_0x7b7b('0x12')]['message']);}})[_0x7b7b('0x13')](function(_0x487554){logger[_0x7b7b('0xf')](_0x7b7b('0xb'),_0xf02958,_0x487554);_0x40b110(_0x487554);});});} \ No newline at end of file +var _0x339b=['../../config/utils','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x38e138,_0x5d08ea){var _0x604149=function(_0xd865bb){while(--_0xd865bb){_0x38e138['push'](_0x38e138['shift']());}};_0x604149(++_0x5d08ea);}(_0x339b,0x19f));var _0xb339=function(_0x2280e6,_0x608ee8){_0x2280e6=_0x2280e6-0x0;var _0x2b7ebd=_0x339b[_0x2280e6];return _0x2b7ebd;};'use strict';var _=require('lodash');var util=require(_0xb339('0x0'));var moment=require(_0xb339('0x1'));var BPromise=require('bluebird');var rs=require(_0xb339('0x2'));var fs=require('fs');var Redis=require(_0xb339('0x3'));var db=require(_0xb339('0x4'))['db'];var utils=require(_0xb339('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb339('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb339('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32084,_0xb1ad9,_0x32aa79){return new BPromise(function(_0x582996,_0x37ba5b){return client[_0xb339('0x8')](_0x32084,_0x32aa79)[_0xb339('0x9')](function(_0x4f3167){logger[_0xb339('0xa')](_0xb339('0xb'),_0xb1ad9,_0xb339('0xc'));logger[_0xb339('0xd')](_0xb339('0xe'),_0xb1ad9,'request\x20sent',JSON[_0xb339('0xf')](_0x4f3167));if(_0x4f3167['error']){if(_0x4f3167[_0xb339('0x10')]['code']===0x1f4){logger['error'](_0xb339('0xb'),_0xb1ad9,_0x4f3167[_0xb339('0x10')][_0xb339('0x11')]);return _0x37ba5b(_0x4f3167[_0xb339('0x10')][_0xb339('0x11')]);}logger[_0xb339('0x10')](_0xb339('0xb'),_0xb1ad9,_0x4f3167[_0xb339('0x10')][_0xb339('0x11')]);return _0x582996(_0x4f3167[_0xb339('0x10')][_0xb339('0x11')]);}else{logger[_0xb339('0xa')](_0xb339('0xb'),_0xb1ad9,_0xb339('0xc'));_0x582996(_0x4f3167[_0xb339('0x12')][_0xb339('0x11')]);}})[_0xb339('0x13')](function(_0x27cc1e){logger[_0xb339('0x10')]('ZendeskField,\x20%s,\x20%s',_0xb1ad9,_0x27cc1e);_0x37ba5b(_0x27cc1e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2287976..c319f2f 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 _0xb7b6=['/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x463950,_0x44f689){_0x463950=_0x463950-0x0;var _0x330904=_0xb7b6[_0x463950];return _0x330904;};'use strict';var multer=require(_0x6b7b('0x0'));var util=require(_0x6b7b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b7b('0x2'));var router=express[_0x6b7b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b7b('0x4'));var interaction=require(_0x6b7b('0x5'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x6b7b('0x6')]('/',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x8')]);router[_0x6b7b('0x6')](_0x6b7b('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6b7b('0x6')](_0x6b7b('0xa'),auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x6b7b('0xc')]);router[_0x6b7b('0xd')]('/',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0xe')]);router[_0x6b7b('0xd')](_0x6b7b('0xa'),auth['isAuthenticated'](),controller[_0x6b7b('0xf')]);router[_0x6b7b('0x10')]('/:id',auth[_0x6b7b('0x7')](),controller[_0x6b7b('0x11')]);router['delete'](_0x6b7b('0x9'),auth['isAuthenticated'](),controller[_0x6b7b('0x12')]);module[_0x6b7b('0x13')]=router; \ No newline at end of file +var _0x0b5b=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration'];(function(_0x5e8c0f,_0x1f20d9){var _0x568dbe=function(_0xdc6797){while(--_0xdc6797){_0x5e8c0f['push'](_0x5e8c0f['shift']());}};_0x568dbe(++_0x1f20d9);}(_0x0b5b,0x147));var _0xb0b5=function(_0x1b22ca,_0x39b63c){_0x1b22ca=_0x1b22ca-0x0;var _0x459305=_0x0b5b[_0x1b22ca];return _0x459305;};'use strict';var multer=require('multer');var util=require(_0xb0b5('0x0'));var path=require(_0xb0b5('0x1'));var timeout=require(_0xb0b5('0x2'));var express=require(_0xb0b5('0x3'));var router=express[_0xb0b5('0x4')]();var fs_extra=require(_0xb0b5('0x5'));var auth=require(_0xb0b5('0x6'));var interaction=require(_0xb0b5('0x7'));var config=require(_0xb0b5('0x8'));var controller=require('./intZohoAccount.controller');router[_0xb0b5('0x9')]('/',auth[_0xb0b5('0xa')](),controller[_0xb0b5('0xb')]);router[_0xb0b5('0x9')](_0xb0b5('0xc'),auth['isAuthenticated'](),controller[_0xb0b5('0xd')]);router[_0xb0b5('0x9')](_0xb0b5('0xe'),auth[_0xb0b5('0xa')](),controller['getConfigurations']);router[_0xb0b5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb0b5('0xf')]);router[_0xb0b5('0x10')]('/',auth[_0xb0b5('0xa')](),controller['create']);router[_0xb0b5('0x10')](_0xb0b5('0xe'),auth[_0xb0b5('0xa')](),controller[_0xb0b5('0x11')]);router[_0xb0b5('0x12')]('/:id',auth[_0xb0b5('0xa')](),controller[_0xb0b5('0x13')]);router[_0xb0b5('0x14')]('/:id',auth[_0xb0b5('0xa')](),controller[_0xb0b5('0x15')]);module[_0xb0b5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5474898..c9f21df 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 _0x668b=['exports','STRING','sequelize'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x668b,0x140));var _0xb668=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x668b[_0x53f402];return _0x45a76d;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file +var _0xedd9=['exports','STRING'];(function(_0x292580,_0x48912c){var _0x5749fe=function(_0x3a4821){while(--_0x3a4821){_0x292580['push'](_0x292580['shift']());}};_0x5749fe(++_0x48912c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c516c,_0x12fbb2){_0x4c516c=_0x4c516c-0x0;var _0x130aa5=_0xedd9[_0x4c516c];return _0x130aa5;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 283fe41..b49ae30 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 _0x6374=['remove','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','find','catch','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','response','Owner','Description','WhoId','Call_Duration','Call_Start_Time'];(function(_0x4a6b6b,_0x428c40){var _0x25977a=function(_0x4ce72e){while(--_0x4ce72e){_0x4a6b6b['push'](_0x4a6b6b['shift']());}};_0x25977a(++_0x428c40);}(_0x6374,0x187));var _0x4637=function(_0x1dffba,_0x5619a8){_0x1dffba=_0x1dffba-0x0;var _0x1120d4=_0x6374[_0x1dffba];return _0x1120d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4637('0x0'));var jsonpatch=require(_0x4637('0x1'));var rp=require(_0x4637('0x2'));var moment=require(_0x4637('0x3'));var BPromise=require(_0x4637('0x4'));var Mustache=require(_0x4637('0x5'));var util=require(_0x4637('0x6'));var path=require('path');var sox=require(_0x4637('0x7'));var csv=require(_0x4637('0x8'));var ejs=require(_0x4637('0x9'));var fs=require('fs');var fs_extra=require(_0x4637('0xa'));var _=require(_0x4637('0xb'));var squel=require('squel');var crypto=require(_0x4637('0xc'));var jsforce=require(_0x4637('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4637('0xe'));var authService=require(_0x4637('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4637('0x10'));var hardwareService=require(_0x4637('0x11'));var logger=require('../../config/logger')(_0x4637('0x12'));var utils=require(_0x4637('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4637('0x14'))['db'];var integrations=require(_0x4637('0x15'));function respondWithStatusCode(_0x142a66,_0x27547b){_0x27547b=_0x27547b||0xcc;return function(_0x3ee714){if(_0x3ee714){return _0x142a66[_0x4637('0x16')](_0x27547b);}return _0x142a66[_0x4637('0x17')](_0x27547b)[_0x4637('0x18')]();};}function respondWithResult(_0x51a5f9,_0xc0cb7){_0xc0cb7=_0xc0cb7||0xc8;return function(_0x2253fd){if(_0x2253fd){return _0x51a5f9[_0x4637('0x17')](_0xc0cb7)[_0x4637('0x19')](_0x2253fd);}};}function respondWithFilteredResult(_0x2986e9,_0x461c70){return function(_0x58f30b){if(_0x58f30b){var _0x2dcb69=typeof _0x461c70[_0x4637('0x1a')]===_0x4637('0x1b')&&typeof _0x461c70[_0x4637('0x1c')]===_0x4637('0x1b');var _0x22311e=_0x58f30b[_0x4637('0x1d')];var _0x740b7d=_0x2dcb69?0x0:_0x461c70[_0x4637('0x1a')];var _0x3cca0e=_0x2dcb69?_0x58f30b['count']:_0x461c70[_0x4637('0x1a')]+_0x461c70['limit'];var _0x12e081;if(_0x3cca0e>=_0x22311e){_0x3cca0e=_0x22311e;_0x12e081=0xc8;}else{_0x12e081=0xce;}_0x2986e9[_0x4637('0x17')](_0x12e081);return _0x2986e9[_0x4637('0x1e')]('Content-Range',_0x740b7d+'-'+_0x3cca0e+'/'+_0x22311e)['json'](_0x58f30b);}return null;};}function patchUpdates(_0x44aca9){return function(_0x2cf48a){try{jsonpatch[_0x4637('0x1f')](_0x2cf48a,_0x44aca9,!![]);}catch(_0x14a7d7){return BPromise[_0x4637('0x20')](_0x14a7d7);}return _0x2cf48a[_0x4637('0x21')]();};}function saveUpdates(_0x2cb606,_0x17c0e9){return function(_0x132989){if(_0x132989){return _0x132989[_0x4637('0x22')](_0x2cb606)[_0x4637('0x23')](function(_0x2d279a){return _0x2d279a;});}return null;};}function removeEntity(_0x27eb03,_0x163637){return function(_0x420169){if(_0x420169){return _0x420169[_0x4637('0x24')]()[_0x4637('0x23')](function(){_0x27eb03[_0x4637('0x17')](0xcc)[_0x4637('0x18')]();});}};}function handleEntityNotFound(_0x1761c1,_0x32f199){return function(_0x5bb050){if(!_0x5bb050){_0x1761c1[_0x4637('0x16')](0x194);}return _0x5bb050;};}function handleError(_0x4138fa,_0x51ce4c){_0x51ce4c=_0x51ce4c||0x1f4;return function(_0x4a7b03){logger[_0x4637('0x25')](_0x4a7b03[_0x4637('0x26')]);if(_0x4a7b03['name']){delete _0x4a7b03[_0x4637('0x27')];}_0x4138fa[_0x4637('0x17')](_0x51ce4c)[_0x4637('0x28')](_0x4a7b03);};}exports[_0x4637('0x29')]=function(_0xedd793,_0x3ced0d){var _0x1fe2eb={},_0x3ab876={},_0x3cb2ab={'count':0x0,'rows':[]};var _0x2662a9=_['map'](db[_0x4637('0x2a')][_0x4637('0x2b')],function(_0x50d49c){return{'name':_0x50d49c['fieldName'],'type':_0x50d49c[_0x4637('0x2c')][_0x4637('0x2d')]};});_0x3ab876[_0x4637('0x2e')]=_[_0x4637('0x2f')](_0x2662a9,_0x4637('0x27'));_0x3ab876[_0x4637('0x30')]=_[_0x4637('0x31')](_0xedd793[_0x4637('0x30')]);_0x3ab876['filters']=_[_0x4637('0x32')](_0x3ab876[_0x4637('0x2e')],_0x3ab876[_0x4637('0x30')]);_0x1fe2eb[_0x4637('0x33')]=_[_0x4637('0x32')](_0x3ab876[_0x4637('0x2e')],qs[_0x4637('0x34')](_0xedd793[_0x4637('0x30')][_0x4637('0x34')]));_0x1fe2eb[_0x4637('0x33')]=_0x1fe2eb[_0x4637('0x33')][_0x4637('0x35')]?_0x1fe2eb[_0x4637('0x33')]:_0x3ab876[_0x4637('0x2e')];if(!_0xedd793[_0x4637('0x30')]['hasOwnProperty'](_0x4637('0x36'))){_0x1fe2eb[_0x4637('0x1c')]=qs['limit'](_0xedd793[_0x4637('0x30')][_0x4637('0x1c')]);_0x1fe2eb[_0x4637('0x1a')]=qs[_0x4637('0x1a')](_0xedd793['query'][_0x4637('0x1a')]);}_0x1fe2eb[_0x4637('0x37')]=qs[_0x4637('0x38')](_0xedd793[_0x4637('0x30')][_0x4637('0x38')]);_0x1fe2eb[_0x4637('0x39')]=qs[_0x4637('0x3a')](_['pick'](_0xedd793[_0x4637('0x30')],_0x3ab876[_0x4637('0x3a')]),_0x2662a9);if(_0xedd793[_0x4637('0x30')]['filter']){_0x1fe2eb[_0x4637('0x39')]=_[_0x4637('0x3b')](_0x1fe2eb[_0x4637('0x39')],{'$or':_[_0x4637('0x2f')](_0x2662a9,function(_0x5cee66){if(_0x5cee66[_0x4637('0x2c')]!==_0x4637('0x3c')){var _0x321f4d={};_0x321f4d[_0x5cee66[_0x4637('0x27')]]={'$like':'%'+_0xedd793['query'][_0x4637('0x3d')]+'%'};return _0x321f4d;}})});}_0x1fe2eb=_[_0x4637('0x3b')]({},_0x1fe2eb,_0xedd793[_0x4637('0x3e')]);var _0x5b402c={'where':_0x1fe2eb[_0x4637('0x39')]};return db[_0x4637('0x2a')][_0x4637('0x1d')](_0x5b402c)[_0x4637('0x23')](function(_0x1f9cb2){_0x3cb2ab['count']=_0x1f9cb2;if(_0xedd793['query'][_0x4637('0x3f')]){_0x1fe2eb[_0x4637('0x40')]=[{'all':!![]}];}return db[_0x4637('0x2a')][_0x4637('0x41')](_0x1fe2eb);})[_0x4637('0x23')](function(_0x50a30f){_0x3cb2ab['rows']=_0x50a30f;return _0x3cb2ab;})[_0x4637('0x23')](respondWithFilteredResult(_0x3ced0d,_0x1fe2eb))['catch'](handleError(_0x3ced0d,null));};exports['show']=function(_0x44df3b,_0x140cb2){var _0x3a8e70={'raw':![],'where':{'id':_0x44df3b['params']['id']}},_0x22f8c1={};_0x22f8c1[_0x4637('0x2e')]=_[_0x4637('0x31')](db[_0x4637('0x2a')]['rawAttributes']);_0x22f8c1['query']=_[_0x4637('0x31')](_0x44df3b['query']);_0x22f8c1[_0x4637('0x3a')]=_[_0x4637('0x32')](_0x22f8c1[_0x4637('0x2e')],_0x22f8c1[_0x4637('0x30')]);_0x3a8e70[_0x4637('0x33')]=_[_0x4637('0x32')](_0x22f8c1[_0x4637('0x2e')],qs[_0x4637('0x34')](_0x44df3b['query'][_0x4637('0x34')]));_0x3a8e70['attributes']=_0x3a8e70[_0x4637('0x33')]['length']?_0x3a8e70['attributes']:_0x22f8c1[_0x4637('0x2e')];if(_0x44df3b[_0x4637('0x30')][_0x4637('0x3f')]){_0x3a8e70[_0x4637('0x40')]=[{'all':!![]}];}_0x3a8e70=_[_0x4637('0x3b')]({},_0x3a8e70,_0x44df3b[_0x4637('0x3e')]);return db[_0x4637('0x2a')][_0x4637('0x42')](_0x3a8e70)[_0x4637('0x23')](handleEntityNotFound(_0x140cb2,null))[_0x4637('0x23')](respondWithResult(_0x140cb2,null))[_0x4637('0x43')](handleError(_0x140cb2,null));};exports[_0x4637('0x44')]=function(_0x2aedd0,_0x588dc6){return db[_0x4637('0x2a')][_0x4637('0x44')](_0x2aedd0[_0x4637('0x45')],{})[_0x4637('0x23')](respondWithResult(_0x588dc6,0xc9))[_0x4637('0x43')](handleError(_0x588dc6,null));};exports[_0x4637('0x22')]=function(_0x4eed6e,_0x255974){if(_0x4eed6e[_0x4637('0x45')]['id']){delete _0x4eed6e['body']['id'];}return db['ZohoAccount'][_0x4637('0x42')]({'where':{'id':_0x4eed6e[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x255974,null))[_0x4637('0x23')](saveUpdates(_0x4eed6e[_0x4637('0x45')],null))[_0x4637('0x23')](respondWithResult(_0x255974,null))[_0x4637('0x43')](handleError(_0x255974,null));};exports['destroy']=function(_0xa44ad6,_0x28c04f){return db[_0x4637('0x2a')]['find']({'where':{'id':_0xa44ad6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x28c04f,null))['then'](removeEntity(_0x28c04f,null))[_0x4637('0x43')](handleError(_0x28c04f,null));};exports[_0x4637('0x47')]=function(_0x1d3fe6,_0x28123f,_0x375618){var _0x31a944={};var _0x1710cb={};var _0xbebaf6;var _0x1a79f2;return db['ZohoAccount'][_0x4637('0x48')]({'where':{'id':_0x1d3fe6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x28123f,null))[_0x4637('0x23')](function(_0x1e5ed1){if(_0x1e5ed1){_0xbebaf6=_0x1e5ed1;_0x1710cb[_0x4637('0x2e')]=_[_0x4637('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x1710cb[_0x4637('0x30')]=_[_0x4637('0x31')](_0x1d3fe6[_0x4637('0x30')]);_0x1710cb[_0x4637('0x3a')]=_[_0x4637('0x32')](_0x1710cb[_0x4637('0x2e')],_0x1710cb[_0x4637('0x30')]);_0x31a944[_0x4637('0x33')]=_[_0x4637('0x32')](_0x1710cb[_0x4637('0x2e')],qs[_0x4637('0x34')](_0x1d3fe6[_0x4637('0x30')][_0x4637('0x34')]));_0x31a944['attributes']=_0x31a944[_0x4637('0x33')][_0x4637('0x35')]?_0x31a944[_0x4637('0x33')]:_0x1710cb['model'];_0x31a944[_0x4637('0x37')]=qs[_0x4637('0x38')](_0x1d3fe6[_0x4637('0x30')][_0x4637('0x38')]);_0x31a944[_0x4637('0x39')]=qs['filters'](_['pick'](_0x1d3fe6['query'],_0x1710cb['filters']));if(_0x1d3fe6['query'][_0x4637('0x3d')]){_0x31a944[_0x4637('0x39')]=_[_0x4637('0x3b')](_0x31a944[_0x4637('0x39')],{'$or':_[_0x4637('0x2f')](_0x31a944[_0x4637('0x33')],function(_0x1c845e){var _0x36887b={};_0x36887b[_0x1c845e]={'$like':'%'+_0x1d3fe6[_0x4637('0x30')]['filter']+'%'};return _0x36887b;})});}_0x31a944=_[_0x4637('0x3b')]({},_0x31a944,_0x1d3fe6[_0x4637('0x3e')]);return _0xbebaf6[_0x4637('0x47')](_0x31a944);}})[_0x4637('0x23')](function(_0x40ea4a){if(_0x40ea4a){_0x1a79f2=_0x40ea4a[_0x4637('0x35')];if(!_0x1d3fe6[_0x4637('0x30')][_0x4637('0x49')]('nolimit')){_0x31a944['limit']=qs[_0x4637('0x1c')](_0x1d3fe6[_0x4637('0x30')]['limit']);_0x31a944[_0x4637('0x1a')]=qs['offset'](_0x1d3fe6['query'][_0x4637('0x1a')]);}return _0xbebaf6['getConfigurations'](_0x31a944);}})[_0x4637('0x23')](function(_0xa7279d){if(_0xa7279d){return _0xa7279d?{'count':_0x1a79f2,'rows':_0xa7279d}:null;}})[_0x4637('0x23')](respondWithResult(_0x28123f,null))[_0x4637('0x43')](handleError(_0x28123f,null));};exports[_0x4637('0x4a')]=function(_0x3bebd6,_0x1e85a1,_0x51be45){if(_0x3bebd6[_0x4637('0x45')]['id']){delete _0x3bebd6['body']['id'];}return db[_0x4637('0x2a')][_0x4637('0x48')]({'where':{'id':_0x3bebd6[_0x4637('0x46')]['id']}})[_0x4637('0x23')](handleEntityNotFound(_0x1e85a1,null))['then'](function(_0x23a3d1){if(_0x23a3d1){_0x3bebd6[_0x4637('0x45')]['AccountId']=_0x23a3d1['id'];_0x3bebd6[_0x4637('0x45')][_0x4637('0x4b')]=integrations[_0x4637('0x4c')](_0x3bebd6[_0x4637('0x45')][_0x4637('0x4d')],_0x3bebd6['body']['type']);_0x3bebd6[_0x4637('0x45')][_0x4637('0x4e')]=integrations[_0x4637('0x4f')](_0x3bebd6['body'][_0x4637('0x4d')],_0x3bebd6['body'][_0x4637('0x2c')]);return db[_0x4637('0x50')][_0x4637('0x44')](_0x3bebd6[_0x4637('0x45')],{'include':[{'model':db[_0x4637('0x51')],'as':_0x4637('0x4b')},{'model':db[_0x4637('0x51')],'as':'Descriptions'}]});}return null;})[_0x4637('0x23')](respondWithResult(_0x1e85a1,null))[_0x4637('0x43')](handleError(_0x1e85a1,null));};function getAccessToken(_0x4a33d9){return new Promise(function(_0x1ba400,_0xba37f8){var _0x1fa1de;switch(_0x4a33d9[_0x4637('0x52')]){case'US':_0x1fa1de=_0x4637('0x53');break;case'AU':_0x1fa1de=_0x4637('0x54');break;case'EU':_0x1fa1de=_0x4637('0x55');break;case'IN':_0x1fa1de=_0x4637('0x56');break;case'CN':_0x1fa1de=_0x4637('0x57');break;default:_0x1fa1de=_0x4637('0x55');break;}var _0x81aeb2={'method':_0x4637('0x58'),'uri':_0x1fa1de+_0x4637('0x59'),'qs':{'refresh_token':_0x4a33d9[_0x4637('0x5a')],'client_id':_0x4a33d9[_0x4637('0x5b')],'client_secret':_0x4a33d9[_0x4637('0x5c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x81aeb2)[_0x4637('0x23')](function(_0x3f0455){if(_0x3f0455[_0x4637('0x5d')]){_0x1ba400(_0x3f0455[_0x4637('0x5d')]);}else{_0xba37f8(_0x4637('0x5e'));}})[_0x4637('0x43')](function(_0x2a6006){_0xba37f8(_0x2a6006);});});}exports['getFields']=function(_0x49492c,_0x44f06f,_0x29bd8f){var _0x273779,_0x5851b3,_0x4653eb,_0xb33637,_0x32b6c3;return db[_0x4637('0x2a')][_0x4637('0x48')]({'where':{'id':_0x49492c['params']['id']},'attributes':['id',_0x4637('0x5f'),'zone',_0x4637('0x5b'),_0x4637('0x5c'),_0x4637('0x60'),_0x4637('0x61'),'refreshToken']})['then'](handleEntityNotFound(_0x44f06f,null))[_0x4637('0x23')](function(_0x44cd8d){_0x32b6c3=_0x44cd8d;_0x273779=_0x32b6c3['host'];_0x5851b3=_0x273779===_0x4637('0x62')?'eu':_0x4637('0x63');_0x4653eb=_0x32b6c3['serverUrl'];var _0x525e00=_0x4653eb[_0x4637('0x64')](-0x1);if(_0x525e00==='/'||_0x525e00==='\x5c'||_0x525e00===':'){_0x4653eb=_0x4653eb[_0x4637('0x65')](0x0,_0x4653eb[_0x4637('0x66')](_0x525e00));}if(!_0x32b6c3[_0x4637('0x5a')]){throw new Error(_0x4637('0x67'));}return getAccessToken(_0x32b6c3);})[_0x4637('0x23')](function(_0x45b5ac){if(_0x45b5ac){return rp({'method':_0x4637('0x68'),'uri':util[_0x4637('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5851b3),'qs':{'module':_0x4637('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45b5ac},'json':!![]});}})[_0x4637('0x23')](function(_0x2bd609){if(_0x2bd609){if(_0x2bd609[_0x4637('0x6b')]&&_0x2bd609[_0x4637('0x6b')][_0x4637('0x25')]){throw new Error(_0x2bd609[_0x4637('0x6b')][_0x4637('0x25')]['message']);}var _0x3d8c83=[];var _0x479e2a=[];var _0xc8be1e=[_0x4637('0x6c'),'Subject',_0x4637('0x6d'),_0x4637('0x6e'),_0x4637('0x6f'),'Call_Result',_0x4637('0x70'),'Call_Type'];_0x479e2a=_[_0x4637('0x71')](_0x2bd609[_0x4637('0x34')],function(_0x11abc5){return _0xc8be1e['includes'](_0x11abc5[_0x4637('0x72')]);});for(var _0x57f032=0x0;_0x57f032<_0x479e2a[_0x4637('0x35')];_0x57f032++){if(_0x479e2a[_0x57f032][_0x4637('0x73')]===![]){_0x3d8c83[_0x4637('0x74')]({'id':_0x479e2a[_0x57f032]['id'],'name':_0x479e2a[_0x57f032]['display_label'],'custom':_0x479e2a[_0x57f032][_0x4637('0x75')],'options':_0x479e2a[_0x57f032][_0x4637('0x76')]===_0x4637('0x77')&&_0x479e2a[_0x57f032][_0x4637('0x78')][_0x4637('0x35')]>-0x1?_[_0x4637('0x2f')](_0x479e2a[_0x57f032][_0x4637('0x78')],function(_0x4f1eb4){return{'name':_0x4f1eb4,'value':_0x4f1eb4};}):[]});}}return{'count':_0x3d8c83[_0x4637('0x35')],'rows':_0x3d8c83};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x44f06f,null))[_0x4637('0x43')](function(_0x2a3f5b){var _0x54c255=_0x49492c[_0x4637('0x30')][_0x4637('0x79')]?0x1f4:_0x2a3f5b[_0x4637('0x7a')]||0x1f4;logger[_0x4637('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x4637('0x7b'),_0x54c255,JSON[_0x4637('0x7c')](_0x2a3f5b));delete _0x2a3f5b[_0x4637('0x27')];if(_0x54c255===0x191){_0x54c255=0x190;}_0x44f06f[_0x4637('0x17')](_0x54c255)[_0x4637('0x28')](_0x49492c[_0x4637('0x30')][_0x4637('0x79')]?{'message':_0x4637('0x7d'),'statusCode':_0x2a3f5b[_0x4637('0x7a')]}:_0x2a3f5b);});}; \ No newline at end of file +var _0x53eb=['https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','data_type','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','ZohoAccount','findAll','then','rows','catch','length','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','filter','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZohoField','Subjects','zone','https://accounts.zoho.com'];(function(_0x12e422,_0x5819e5){var _0xddec5a=function(_0x14cd6d){while(--_0x14cd6d){_0x12e422['push'](_0x12e422['shift']());}};_0xddec5a(++_0x5819e5);}(_0x53eb,0x1ac));var _0xb53e=function(_0x2a0add,_0x5ae0e6){_0x2a0add=_0x2a0add-0x0;var _0x342d28=_0x53eb[_0x2a0add];return _0x342d28;};'use strict';var emlformat=require(_0xb53e('0x0'));var rimraf=require(_0xb53e('0x1'));var zipdir=require(_0xb53e('0x2'));var jsonpatch=require(_0xb53e('0x3'));var rp=require(_0xb53e('0x4'));var moment=require(_0xb53e('0x5'));var BPromise=require(_0xb53e('0x6'));var Mustache=require(_0xb53e('0x7'));var util=require('util');var path=require(_0xb53e('0x8'));var sox=require(_0xb53e('0x9'));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(_0xb53e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb53e('0xb'));var Papa=require(_0xb53e('0xc'));var Redis=require('ioredis');var authService=require(_0xb53e('0xd'));var qs=require(_0xb53e('0xe'));var as=require(_0xb53e('0xf'));var hardwareService=require(_0xb53e('0x10'));var logger=require(_0xb53e('0x11'))(_0xb53e('0x12'));var utils=require(_0xb53e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb53e('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb53e('0x15'));function respondWithStatusCode(_0x29a893,_0x4c33fa){_0x4c33fa=_0x4c33fa||0xcc;return function(_0x11b150){if(_0x11b150){return _0x29a893[_0xb53e('0x16')](_0x4c33fa);}return _0x29a893[_0xb53e('0x17')](_0x4c33fa)[_0xb53e('0x18')]();};}function respondWithResult(_0x5b3dac,_0x199fc7){_0x199fc7=_0x199fc7||0xc8;return function(_0x5f3f3a){if(_0x5f3f3a){return _0x5b3dac[_0xb53e('0x17')](_0x199fc7)[_0xb53e('0x19')](_0x5f3f3a);}};}function respondWithFilteredResult(_0x52986f,_0x157eb9){return function(_0x368752){if(_0x368752){var _0x219efb=typeof _0x157eb9[_0xb53e('0x1a')]===_0xb53e('0x1b')&&typeof _0x157eb9[_0xb53e('0x1c')]===_0xb53e('0x1b');var _0xbb62e6=_0x368752[_0xb53e('0x1d')];var _0x4b479f=_0x219efb?0x0:_0x157eb9[_0xb53e('0x1a')];var _0x3cf5d4=_0x219efb?_0x368752[_0xb53e('0x1d')]:_0x157eb9[_0xb53e('0x1a')]+_0x157eb9['limit'];var _0x205078;if(_0x3cf5d4>=_0xbb62e6){_0x3cf5d4=_0xbb62e6;_0x205078=0xc8;}else{_0x205078=0xce;}_0x52986f[_0xb53e('0x17')](_0x205078);return _0x52986f[_0xb53e('0x1e')](_0xb53e('0x1f'),_0x4b479f+'-'+_0x3cf5d4+'/'+_0xbb62e6)[_0xb53e('0x19')](_0x368752);}return null;};}function patchUpdates(_0x5027a2){return function(_0x41a797){try{jsonpatch[_0xb53e('0x20')](_0x41a797,_0x5027a2,!![]);}catch(_0x1a2610){return BPromise[_0xb53e('0x21')](_0x1a2610);}return _0x41a797[_0xb53e('0x22')]();};}function saveUpdates(_0x3603fe,_0x6087b3){return function(_0x5d9fbb){if(_0x5d9fbb){return _0x5d9fbb[_0xb53e('0x23')](_0x3603fe)['then'](function(_0xefb401){return _0xefb401;});}return null;};}function removeEntity(_0x293b2c,_0x463724){return function(_0x2ba30b){if(_0x2ba30b){return _0x2ba30b[_0xb53e('0x24')]()['then'](function(){_0x293b2c['status'](0xcc)[_0xb53e('0x18')]();});}};}function handleEntityNotFound(_0x47a1a6,_0x5d4e80){return function(_0x54faec){if(!_0x54faec){_0x47a1a6[_0xb53e('0x16')](0x194);}return _0x54faec;};}function handleError(_0x5b499f,_0xcbf9b){_0xcbf9b=_0xcbf9b||0x1f4;return function(_0x5db3ae){logger[_0xb53e('0x25')](_0x5db3ae[_0xb53e('0x26')]);if(_0x5db3ae[_0xb53e('0x27')]){delete _0x5db3ae[_0xb53e('0x27')];}_0x5b499f[_0xb53e('0x17')](_0xcbf9b)[_0xb53e('0x28')](_0x5db3ae);};}exports['index']=function(_0xb98762,_0x2632b5){var _0x5f42f9={},_0x24bb0b={},_0x170f39={'count':0x0,'rows':[]};var _0x492813=_[_0xb53e('0x29')](db['ZohoAccount'][_0xb53e('0x2a')],function(_0x4b660d){return{'name':_0x4b660d[_0xb53e('0x2b')],'type':_0x4b660d[_0xb53e('0x2c')][_0xb53e('0x2d')]};});_0x24bb0b[_0xb53e('0x2e')]=_['map'](_0x492813,_0xb53e('0x27'));_0x24bb0b['query']=_[_0xb53e('0x2f')](_0xb98762['query']);_0x24bb0b[_0xb53e('0x30')]=_[_0xb53e('0x31')](_0x24bb0b['model'],_0x24bb0b[_0xb53e('0x32')]);_0x5f42f9[_0xb53e('0x33')]=_[_0xb53e('0x31')](_0x24bb0b[_0xb53e('0x2e')],qs[_0xb53e('0x34')](_0xb98762[_0xb53e('0x32')]['fields']));_0x5f42f9['attributes']=_0x5f42f9['attributes']['length']?_0x5f42f9[_0xb53e('0x33')]:_0x24bb0b['model'];if(!_0xb98762['query'][_0xb53e('0x35')](_0xb53e('0x36'))){_0x5f42f9['limit']=qs[_0xb53e('0x1c')](_0xb98762['query'][_0xb53e('0x1c')]);_0x5f42f9['offset']=qs[_0xb53e('0x1a')](_0xb98762['query'][_0xb53e('0x1a')]);}_0x5f42f9[_0xb53e('0x37')]=qs[_0xb53e('0x38')](_0xb98762['query'][_0xb53e('0x38')]);_0x5f42f9[_0xb53e('0x39')]=qs[_0xb53e('0x30')](_[_0xb53e('0x3a')](_0xb98762[_0xb53e('0x32')],_0x24bb0b['filters']),_0x492813);if(_0xb98762[_0xb53e('0x32')]['filter']){_0x5f42f9[_0xb53e('0x39')]=_[_0xb53e('0x3b')](_0x5f42f9['where'],{'$or':_['map'](_0x492813,function(_0xf4c8b6){if(_0xf4c8b6[_0xb53e('0x2c')]!==_0xb53e('0x3c')){var _0x54b5db={};_0x54b5db[_0xf4c8b6[_0xb53e('0x27')]]={'$like':'%'+_0xb98762[_0xb53e('0x32')]['filter']+'%'};return _0x54b5db;}})});}_0x5f42f9=_[_0xb53e('0x3b')]({},_0x5f42f9,_0xb98762[_0xb53e('0x3d')]);var _0x1cabb2={'where':_0x5f42f9[_0xb53e('0x39')]};return db['ZohoAccount'][_0xb53e('0x1d')](_0x1cabb2)['then'](function(_0x52552b){_0x170f39[_0xb53e('0x1d')]=_0x52552b;if(_0xb98762[_0xb53e('0x32')][_0xb53e('0x3e')]){_0x5f42f9[_0xb53e('0x3f')]=[{'all':!![]}];}return db[_0xb53e('0x40')][_0xb53e('0x41')](_0x5f42f9);})[_0xb53e('0x42')](function(_0x40b601){_0x170f39[_0xb53e('0x43')]=_0x40b601;return _0x170f39;})['then'](respondWithFilteredResult(_0x2632b5,_0x5f42f9))[_0xb53e('0x44')](handleError(_0x2632b5,null));};exports['show']=function(_0x4c3a83,_0x1ef1ce){var _0x33af08={'raw':![],'where':{'id':_0x4c3a83['params']['id']}},_0x35a376={};_0x35a376[_0xb53e('0x2e')]=_['keys'](db[_0xb53e('0x40')][_0xb53e('0x2a')]);_0x35a376[_0xb53e('0x32')]=_['keys'](_0x4c3a83[_0xb53e('0x32')]);_0x35a376[_0xb53e('0x30')]=_[_0xb53e('0x31')](_0x35a376['model'],_0x35a376[_0xb53e('0x32')]);_0x33af08[_0xb53e('0x33')]=_[_0xb53e('0x31')](_0x35a376['model'],qs[_0xb53e('0x34')](_0x4c3a83[_0xb53e('0x32')][_0xb53e('0x34')]));_0x33af08[_0xb53e('0x33')]=_0x33af08['attributes'][_0xb53e('0x45')]?_0x33af08[_0xb53e('0x33')]:_0x35a376[_0xb53e('0x2e')];if(_0x4c3a83[_0xb53e('0x32')][_0xb53e('0x3e')]){_0x33af08['include']=[{'all':!![]}];}_0x33af08=_['merge']({},_0x33af08,_0x4c3a83[_0xb53e('0x3d')]);return db[_0xb53e('0x40')][_0xb53e('0x46')](_0x33af08)['then'](handleEntityNotFound(_0x1ef1ce,null))['then'](respondWithResult(_0x1ef1ce,null))[_0xb53e('0x44')](handleError(_0x1ef1ce,null));};exports[_0xb53e('0x47')]=function(_0x25ad05,_0x1f30bc){return db[_0xb53e('0x40')][_0xb53e('0x47')](_0x25ad05[_0xb53e('0x48')],{})[_0xb53e('0x42')](respondWithResult(_0x1f30bc,0xc9))[_0xb53e('0x44')](handleError(_0x1f30bc,null));};exports[_0xb53e('0x23')]=function(_0x37b201,_0x403972){if(_0x37b201[_0xb53e('0x48')]['id']){delete _0x37b201['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x37b201[_0xb53e('0x49')]['id']}})[_0xb53e('0x42')](handleEntityNotFound(_0x403972,null))[_0xb53e('0x42')](saveUpdates(_0x37b201['body'],null))[_0xb53e('0x42')](respondWithResult(_0x403972,null))[_0xb53e('0x44')](handleError(_0x403972,null));};exports[_0xb53e('0x24')]=function(_0xfc5085,_0x56a375){return db[_0xb53e('0x40')]['find']({'where':{'id':_0xfc5085[_0xb53e('0x49')]['id']}})[_0xb53e('0x42')](handleEntityNotFound(_0x56a375,null))[_0xb53e('0x42')](removeEntity(_0x56a375,null))[_0xb53e('0x44')](handleError(_0x56a375,null));};exports[_0xb53e('0x4a')]=function(_0x4349b9,_0x90f451,_0x4460ed){var _0x4c05c1={};var _0x45c4be={};var _0x2de311;var _0xc0233b;return db['ZohoAccount'][_0xb53e('0x4b')]({'where':{'id':_0x4349b9['params']['id']}})[_0xb53e('0x42')](handleEntityNotFound(_0x90f451,null))[_0xb53e('0x42')](function(_0x4f0fdb){if(_0x4f0fdb){_0x2de311=_0x4f0fdb;_0x45c4be[_0xb53e('0x2e')]=_['keys'](db[_0xb53e('0x4c')]['rawAttributes']);_0x45c4be['query']=_[_0xb53e('0x2f')](_0x4349b9[_0xb53e('0x32')]);_0x45c4be[_0xb53e('0x30')]=_[_0xb53e('0x31')](_0x45c4be[_0xb53e('0x2e')],_0x45c4be[_0xb53e('0x32')]);_0x4c05c1[_0xb53e('0x33')]=_[_0xb53e('0x31')](_0x45c4be[_0xb53e('0x2e')],qs['fields'](_0x4349b9['query'][_0xb53e('0x34')]));_0x4c05c1[_0xb53e('0x33')]=_0x4c05c1['attributes'][_0xb53e('0x45')]?_0x4c05c1[_0xb53e('0x33')]:_0x45c4be[_0xb53e('0x2e')];_0x4c05c1[_0xb53e('0x37')]=qs[_0xb53e('0x38')](_0x4349b9[_0xb53e('0x32')][_0xb53e('0x38')]);_0x4c05c1[_0xb53e('0x39')]=qs['filters'](_[_0xb53e('0x3a')](_0x4349b9[_0xb53e('0x32')],_0x45c4be[_0xb53e('0x30')]));if(_0x4349b9['query'][_0xb53e('0x4d')]){_0x4c05c1['where']=_[_0xb53e('0x3b')](_0x4c05c1[_0xb53e('0x39')],{'$or':_[_0xb53e('0x29')](_0x4c05c1['attributes'],function(_0x15241a){var _0x34812d={};_0x34812d[_0x15241a]={'$like':'%'+_0x4349b9[_0xb53e('0x32')][_0xb53e('0x4d')]+'%'};return _0x34812d;})});}_0x4c05c1=_[_0xb53e('0x3b')]({},_0x4c05c1,_0x4349b9['options']);return _0x2de311[_0xb53e('0x4a')](_0x4c05c1);}})['then'](function(_0x198349){if(_0x198349){_0xc0233b=_0x198349[_0xb53e('0x45')];if(!_0x4349b9[_0xb53e('0x32')][_0xb53e('0x35')](_0xb53e('0x36'))){_0x4c05c1['limit']=qs[_0xb53e('0x1c')](_0x4349b9[_0xb53e('0x32')][_0xb53e('0x1c')]);_0x4c05c1[_0xb53e('0x1a')]=qs[_0xb53e('0x1a')](_0x4349b9[_0xb53e('0x32')][_0xb53e('0x1a')]);}return _0x2de311[_0xb53e('0x4a')](_0x4c05c1);}})[_0xb53e('0x42')](function(_0x4051f0){if(_0x4051f0){return _0x4051f0?{'count':_0xc0233b,'rows':_0x4051f0}:null;}})[_0xb53e('0x42')](respondWithResult(_0x90f451,null))[_0xb53e('0x44')](handleError(_0x90f451,null));};exports[_0xb53e('0x4e')]=function(_0x7452df,_0x1e2ad1,_0x1dc24c){if(_0x7452df[_0xb53e('0x48')]['id']){delete _0x7452df['body']['id'];}return db[_0xb53e('0x40')][_0xb53e('0x4b')]({'where':{'id':_0x7452df[_0xb53e('0x49')]['id']}})[_0xb53e('0x42')](handleEntityNotFound(_0x1e2ad1,null))['then'](function(_0x5aa539){if(_0x5aa539){_0x7452df['body'][_0xb53e('0x4f')]=_0x5aa539['id'];_0x7452df['body']['Subjects']=integrations[_0xb53e('0x50')](_0x7452df[_0xb53e('0x48')]['channel'],_0x7452df[_0xb53e('0x48')]['type']);_0x7452df[_0xb53e('0x48')][_0xb53e('0x51')]=integrations[_0xb53e('0x52')](_0x7452df[_0xb53e('0x48')][_0xb53e('0x53')],_0x7452df[_0xb53e('0x48')][_0xb53e('0x2c')]);return db[_0xb53e('0x4c')][_0xb53e('0x47')](_0x7452df[_0xb53e('0x48')],{'include':[{'model':db[_0xb53e('0x54')],'as':_0xb53e('0x55')},{'model':db[_0xb53e('0x54')],'as':_0xb53e('0x51')}]});}return null;})[_0xb53e('0x42')](respondWithResult(_0x1e2ad1,null))[_0xb53e('0x44')](handleError(_0x1e2ad1,null));};function getAccessToken(_0x4684ba){return new Promise(function(_0x2721aa,_0x5029ad){var _0x43bd76;switch(_0x4684ba[_0xb53e('0x56')]){case'US':_0x43bd76=_0xb53e('0x57');break;case'AU':_0x43bd76='https://accounts.zoho.com.au';break;case'EU':_0x43bd76=_0xb53e('0x58');break;case'IN':_0x43bd76='https://accounts.zoho.in';break;case'CN':_0x43bd76=_0xb53e('0x59');break;default:_0x43bd76=_0xb53e('0x58');break;}var _0x57b0b1={'method':_0xb53e('0x5a'),'uri':_0x43bd76+'/oauth/v2/token','qs':{'refresh_token':_0x4684ba[_0xb53e('0x5b')],'client_id':_0x4684ba['clientId'],'client_secret':_0x4684ba[_0xb53e('0x5c')],'grant_type':_0xb53e('0x5d')},'json':!![]};return rp(_0x57b0b1)[_0xb53e('0x42')](function(_0x2b357a){if(_0x2b357a[_0xb53e('0x5e')]){_0x2721aa(_0x2b357a[_0xb53e('0x5e')]);}else{_0x5029ad(_0xb53e('0x5f'));}})[_0xb53e('0x44')](function(_0x42dff6){_0x5029ad(_0x42dff6);});});}exports[_0xb53e('0x60')]=function(_0x5f2e06,_0x42a556,_0x5a5fd1){var _0x84baad,_0x17077b,_0x5e8a33,_0x2ca7a8,_0x9d6ae;return db[_0xb53e('0x40')]['findOne']({'where':{'id':_0x5f2e06[_0xb53e('0x49')]['id']},'attributes':['id','host',_0xb53e('0x56'),_0xb53e('0x61'),'clientSecret',_0xb53e('0x62'),_0xb53e('0x63'),_0xb53e('0x5b')]})[_0xb53e('0x42')](handleEntityNotFound(_0x42a556,null))[_0xb53e('0x42')](function(_0x372f72){_0x9d6ae=_0x372f72;_0x84baad=_0x9d6ae['host'];_0x17077b=_0x84baad===_0xb53e('0x64')?'eu':_0xb53e('0x65');_0x5e8a33=_0x9d6ae[_0xb53e('0x62')];var _0x3525d0=_0x5e8a33[_0xb53e('0x66')](-0x1);if(_0x3525d0==='/'||_0x3525d0==='\x5c'||_0x3525d0===':'){_0x5e8a33=_0x5e8a33['substring'](0x0,_0x5e8a33['lastIndexOf'](_0x3525d0));}if(!_0x9d6ae[_0xb53e('0x5b')]){throw new Error(_0xb53e('0x67'));}return getAccessToken(_0x9d6ae);})['then'](function(_0x44b38e){if(_0x44b38e){return rp({'method':_0xb53e('0x68'),'uri':util[_0xb53e('0x69')](_0xb53e('0x6a'),_0x17077b),'qs':{'module':_0xb53e('0x6b')},'headers':{'Authorization':_0xb53e('0x6c')+_0x44b38e},'json':!![]});}})[_0xb53e('0x42')](function(_0x12c0a3){if(_0x12c0a3){if(_0x12c0a3[_0xb53e('0x6d')]&&_0x12c0a3['response'][_0xb53e('0x25')]){throw new Error(_0x12c0a3[_0xb53e('0x6d')][_0xb53e('0x25')][_0xb53e('0x6e')]);}var _0x15dc28=[];var _0x452fc6=[];var _0x27a906=[_0xb53e('0x6f'),_0xb53e('0x70'),_0xb53e('0x71'),_0xb53e('0x72'),'Call_Duration',_0xb53e('0x73'),_0xb53e('0x74'),_0xb53e('0x75')];_0x452fc6=_[_0xb53e('0x76')](_0x12c0a3[_0xb53e('0x34')],function(_0x34b94a){return _0x27a906[_0xb53e('0x77')](_0x34b94a[_0xb53e('0x78')]);});for(var _0x1cb2a9=0x0;_0x1cb2a9<_0x452fc6[_0xb53e('0x45')];_0x1cb2a9++){if(_0x452fc6[_0x1cb2a9]['system_mandatory']===![]){_0x15dc28[_0xb53e('0x79')]({'id':_0x452fc6[_0x1cb2a9]['id'],'name':_0x452fc6[_0x1cb2a9]['display_label'],'custom':_0x452fc6[_0x1cb2a9]['custom_field'],'options':_0x452fc6[_0x1cb2a9][_0xb53e('0x7a')]===_0xb53e('0x7b')&&_0x452fc6[_0x1cb2a9][_0xb53e('0x7c')][_0xb53e('0x45')]>-0x1?_[_0xb53e('0x29')](_0x452fc6[_0x1cb2a9][_0xb53e('0x7c')],function(_0x546c72){return{'name':_0x546c72,'value':_0x546c72};}):[]});}}return{'count':_0x15dc28[_0xb53e('0x45')],'rows':_0x15dc28};}else{return{'count':0x0,'rows':[]};}})[_0xb53e('0x42')](respondWithResult(_0x42a556,null))[_0xb53e('0x44')](function(_0x47124c){var _0x2bbd97=_0x5f2e06[_0xb53e('0x32')]['test']?0x1f4:_0x47124c[_0xb53e('0x7d')]||0x1f4;logger[_0xb53e('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xb53e('0x60'),_0x2bbd97,JSON[_0xb53e('0x7e')](_0x47124c));delete _0x47124c[_0xb53e('0x27')];if(_0x2bbd97===0x191){_0x2bbd97=0x190;}_0x42a556[_0xb53e('0x17')](_0x2bbd97)[_0xb53e('0x28')](_0x5f2e06['query'][_0xb53e('0x7f')]?{'message':_0xb53e('0x80'),'statusCode':_0x47124c[_0xb53e('0x7d')]}:_0x47124c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 259ca92..36f4f61 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 _0x4d4c=['../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','error','inspect','authorization_code','application/x-www-form-urlencoded','then','parse','info','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x4d4c,0x98));var _0xc4d4=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x4d4c[_0xd511d];return _0x3f148e;};'use strict';var _=require('lodash');var util=require(_0xc4d4('0x0'));var logger=require(_0xc4d4('0x1'))(_0xc4d4('0x2'));var moment=require(_0xc4d4('0x3'));var BPromise=require(_0xc4d4('0x4'));var rp=require(_0xc4d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4d4('0x6'));var config=require(_0xc4d4('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xc4d4('0x8'));module['exports']=function(_0x906e78,_0x11276b){return _0x906e78['define'](_0xc4d4('0x9'),attributes,{'tableName':_0xc4d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x76726e,_0x360a53,_0x989baf){if(_0x76726e['changed'](_0xc4d4('0xb'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xd'))||_0x76726e['changed']('clientId')||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xe'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0xf'))||_0x76726e[_0xc4d4('0xc')](_0xc4d4('0x10'))){var _0x17984e,_0x8e4841;_0x17984e=_0x76726e[_0xc4d4('0xd')];var _0x427423=_0x17984e[_0xc4d4('0x11')](-0x1);if(_0x427423==='/'||_0x427423==='\x5c'||_0x427423===':'){_0x17984e=_0x17984e['substring'](0x0,_0x17984e[_0xc4d4('0x12')](_0x427423));}switch(_0x76726e[_0xc4d4('0xb')]){case'US':_0x8e4841='https://accounts.zoho.com';break;case'AU':_0x8e4841=_0xc4d4('0x13');break;case'IN':_0x8e4841=_0xc4d4('0x14');break;case'CN':_0x8e4841=_0xc4d4('0x15');break;default:_0x8e4841=_0xc4d4('0x16');break;}var _0x54ffb9={'method':_0xc4d4('0x17'),'uri':_0x8e4841+_0xc4d4('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x76726e[_0xc4d4('0x19')],'client_secret':_0x76726e[_0xc4d4('0xe')],'redirect_uri':_0x76726e[_0xc4d4('0xd')],'code':_0x76726e[_0xc4d4('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x54ffb9)['then'](function(_0x38be79){var _0x222f33=JSON['parse'](_0x38be79);if(_0x222f33[_0xc4d4('0x1a')]){_0x76726e[_0xc4d4('0x1b')]=_0x222f33[_0xc4d4('0x1a')];logger['info'](util['format'](_0xc4d4('0x1c'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']));}else{logger['error'](util[_0xc4d4('0x1e')](_0xc4d4('0x1f'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']),util['inspect'](_0x222f33,{'showHidden':![],'depth':null}));}return _0x989baf(null,_0x360a53);})[_0xc4d4('0x20')](function(_0x100913){logger[_0xc4d4('0x21')](util['format'](_0xc4d4('0x1f'),_0x76726e[_0xc4d4('0x1d')],_0x76726e['id']),util[_0xc4d4('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x989baf(_0x100913);});}else{return _0x989baf(null,_0x360a53);}},'beforeUpdate':function(_0x470635,_0x2d3bf9,_0x4f0733){if(_0x470635['changed'](_0xc4d4('0xb'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0xd'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0x19'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0xe'))||_0x470635['changed'](_0xc4d4('0xf'))||_0x470635[_0xc4d4('0xc')](_0xc4d4('0x10'))){var _0x5ccd2c,_0x40c572;_0x5ccd2c=_0x470635[_0xc4d4('0xd')];var _0x42073d=_0x5ccd2c['slice'](-0x1);if(_0x42073d==='/'||_0x42073d==='\x5c'||_0x42073d===':'){_0x5ccd2c=_0x5ccd2c['substring'](0x0,_0x5ccd2c[_0xc4d4('0x12')](_0x42073d));}switch(_0x470635[_0xc4d4('0xb')]){case'US':_0x40c572='https://accounts.zoho.com';break;case'AU':_0x40c572='https://accounts.zoho.com.au';break;case'IN':_0x40c572=_0xc4d4('0x14');break;case'CN':_0x40c572='https://accounts.zoho.com.cn';break;default:_0x40c572=_0xc4d4('0x16');break;}var _0x525cbb={'method':_0xc4d4('0x17'),'uri':_0x40c572+'/oauth/v2/token','form':{'grant_type':_0xc4d4('0x23'),'client_id':_0x470635[_0xc4d4('0x19')],'client_secret':_0x470635[_0xc4d4('0xe')],'redirect_uri':_0x470635[_0xc4d4('0xd')],'code':_0x470635[_0xc4d4('0xf')]},'headers':{'Content-Type':_0xc4d4('0x24')}};return rp(_0x525cbb)[_0xc4d4('0x25')](function(_0x3358a1){var _0x5d1d6e=JSON[_0xc4d4('0x26')](_0x3358a1);if(_0x5d1d6e[_0xc4d4('0x1a')]){_0x470635['refreshToken']=_0x5d1d6e[_0xc4d4('0x1a')];logger[_0xc4d4('0x27')](util[_0xc4d4('0x1e')](_0xc4d4('0x1c'),_0x470635[_0xc4d4('0x1d')],_0x470635['id']));}else{logger[_0xc4d4('0x21')](util[_0xc4d4('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x470635[_0xc4d4('0x1d')],_0x470635['id']),util[_0xc4d4('0x22')](_0x5d1d6e,{'showHidden':![],'depth':null}));}return _0x4f0733(null,_0x2d3bf9);})[_0xc4d4('0x20')](function(_0x36bd5c){logger[_0xc4d4('0x21')](util[_0xc4d4('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x470635[_0xc4d4('0x1d')],_0x470635['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4f0733(_0x36bd5c);});}else{return _0x4f0733(null,_0x2d3bf9);}}}});}; \ No newline at end of file +var _0x5c99=['define','int_zoho_accounts','zone','changed','serverUrl','clientSecret','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','https://accounts.zoho.com','https://accounts.zoho.com.cn','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','exports'];(function(_0x4e6ae9,_0x4cd02a){var _0x2379ac=function(_0x443fd9){while(--_0x443fd9){_0x4e6ae9['push'](_0x4e6ae9['shift']());}};_0x2379ac(++_0x4cd02a);}(_0x5c99,0x190));var _0x95c9=function(_0x1612ba,_0x3e4845){_0x1612ba=_0x1612ba-0x0;var _0x43d897=_0x5c99[_0x1612ba];return _0x43d897;};'use strict';var _=require('lodash');var util=require(_0x95c9('0x0'));var logger=require(_0x95c9('0x1'))(_0x95c9('0x2'));var moment=require(_0x95c9('0x3'));var BPromise=require(_0x95c9('0x4'));var rp=require(_0x95c9('0x5'));var fs=require('fs');var path=require(_0x95c9('0x6'));var rimraf=require(_0x95c9('0x7'));var config=require('../../config/environment');var attributes=require(_0x95c9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x95c9('0x9')]=function(_0x560f8a,_0x167ce2){return _0x560f8a[_0x95c9('0xa')]('ZohoAccount',attributes,{'tableName':_0x95c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5c51a7,_0x55abd4,_0x438f03){if(_0x5c51a7['changed'](_0x95c9('0xc'))||_0x5c51a7[_0x95c9('0xd')](_0x95c9('0xe'))||_0x5c51a7[_0x95c9('0xd')]('clientId')||_0x5c51a7[_0x95c9('0xd')](_0x95c9('0xf'))||_0x5c51a7['changed']('code')||_0x5c51a7['changed'](_0x95c9('0x10'))){var _0x3408d9,_0x2b2578;_0x3408d9=_0x5c51a7['serverUrl'];var _0x1c6df7=_0x3408d9[_0x95c9('0x11')](-0x1);if(_0x1c6df7==='/'||_0x1c6df7==='\x5c'||_0x1c6df7===':'){_0x3408d9=_0x3408d9[_0x95c9('0x12')](0x0,_0x3408d9[_0x95c9('0x13')](_0x1c6df7));}switch(_0x5c51a7[_0x95c9('0xc')]){case'US':_0x2b2578='https://accounts.zoho.com';break;case'AU':_0x2b2578=_0x95c9('0x14');break;case'IN':_0x2b2578=_0x95c9('0x15');break;case'CN':_0x2b2578='https://accounts.zoho.com.cn';break;default:_0x2b2578=_0x95c9('0x16');break;}var _0x36305b={'method':'POST','uri':_0x2b2578+_0x95c9('0x17'),'form':{'grant_type':_0x95c9('0x18'),'client_id':_0x5c51a7[_0x95c9('0x19')],'client_secret':_0x5c51a7[_0x95c9('0xf')],'redirect_uri':_0x5c51a7[_0x95c9('0xe')],'code':_0x5c51a7[_0x95c9('0x1a')]},'headers':{'Content-Type':_0x95c9('0x1b')}};return rp(_0x36305b)[_0x95c9('0x1c')](function(_0x12ed66){var _0x2466c4=JSON[_0x95c9('0x1d')](_0x12ed66);if(_0x2466c4[_0x95c9('0x1e')]){_0x5c51a7[_0x95c9('0x1f')]=_0x2466c4[_0x95c9('0x1e')];logger[_0x95c9('0x20')](util['format'](_0x95c9('0x21'),_0x5c51a7['name'],_0x5c51a7['id']));}else{logger[_0x95c9('0x22')](util[_0x95c9('0x23')](_0x95c9('0x24'),_0x5c51a7[_0x95c9('0x25')],_0x5c51a7['id']),util['inspect'](_0x2466c4,{'showHidden':![],'depth':null}));}return _0x438f03(null,_0x55abd4);})['catch'](function(_0x4932b6){logger[_0x95c9('0x22')](util[_0x95c9('0x23')](_0x95c9('0x24'),_0x5c51a7['name'],_0x5c51a7['id']),util[_0x95c9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x438f03(_0x4932b6);});}else{return _0x438f03(null,_0x55abd4);}},'beforeUpdate':function(_0x774b5,_0x10dd3f,_0x348a53){if(_0x774b5[_0x95c9('0xd')]('zone')||_0x774b5[_0x95c9('0xd')](_0x95c9('0xe'))||_0x774b5[_0x95c9('0xd')](_0x95c9('0x19'))||_0x774b5['changed'](_0x95c9('0xf'))||_0x774b5[_0x95c9('0xd')](_0x95c9('0x1a'))||_0x774b5[_0x95c9('0xd')](_0x95c9('0x10'))){var _0x755c8a,_0x4139ed;_0x755c8a=_0x774b5[_0x95c9('0xe')];var _0x1af6e6=_0x755c8a[_0x95c9('0x11')](-0x1);if(_0x1af6e6==='/'||_0x1af6e6==='\x5c'||_0x1af6e6===':'){_0x755c8a=_0x755c8a[_0x95c9('0x12')](0x0,_0x755c8a[_0x95c9('0x13')](_0x1af6e6));}switch(_0x774b5[_0x95c9('0xc')]){case'US':_0x4139ed=_0x95c9('0x27');break;case'AU':_0x4139ed=_0x95c9('0x14');break;case'IN':_0x4139ed=_0x95c9('0x15');break;case'CN':_0x4139ed=_0x95c9('0x28');break;default:_0x4139ed=_0x95c9('0x16');break;}var _0x439e87={'method':'POST','uri':_0x4139ed+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x774b5[_0x95c9('0x19')],'client_secret':_0x774b5[_0x95c9('0xf')],'redirect_uri':_0x774b5[_0x95c9('0xe')],'code':_0x774b5['code']},'headers':{'Content-Type':_0x95c9('0x1b')}};return rp(_0x439e87)[_0x95c9('0x1c')](function(_0x12ad23){var _0x12f4e5=JSON['parse'](_0x12ad23);if(_0x12f4e5[_0x95c9('0x1e')]){_0x774b5[_0x95c9('0x1f')]=_0x12f4e5[_0x95c9('0x1e')];logger[_0x95c9('0x20')](util[_0x95c9('0x23')](_0x95c9('0x21'),_0x774b5[_0x95c9('0x25')],_0x774b5['id']));}else{logger[_0x95c9('0x22')](util[_0x95c9('0x23')](_0x95c9('0x24'),_0x774b5[_0x95c9('0x25')],_0x774b5['id']),util['inspect'](_0x12f4e5,{'showHidden':![],'depth':null}));}return _0x348a53(null,_0x10dd3f);})['catch'](function(_0x37fd42){logger[_0x95c9('0x22')](util[_0x95c9('0x23')](_0x95c9('0x24'),_0x774b5[_0x95c9('0x25')],_0x774b5['id']),util[_0x95c9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x348a53(_0x37fd42);});}else{return _0x348a53(null,_0x10dd3f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4d18e4e..7ef32e0 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 _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowZohoAccount'];(function(_0x573e79,_0x2654ca){var _0x3caca7=function(_0x4d36e6){while(--_0x4d36e6){_0x573e79['push'](_0x573e79['shift']());}};_0x3caca7(++_0x2654ca);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x5c3c[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetZohoAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file +var _0xe785=['include','map','model','then','ShowZohoAccount','find','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit'];(function(_0x563d3b,_0x40812b){var _0xcc6fa4=function(_0x262fd8){while(--_0x262fd8){_0x563d3b['push'](_0x563d3b['shift']());}};_0xcc6fa4(++_0x40812b);}(_0xe785,0x128));var _0x5e78=function(_0x334cc8,_0xeb25ff){_0x334cc8=_0x334cc8-0x0;var _0x4cf940=_0xe785[_0x334cc8];return _0x4cf940;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require('moment');var BPromise=require(_0x5e78('0x2'));var rs=require(_0x5e78('0x3'));var fs=require('fs');var Redis=require(_0x5e78('0x4'));var db=require(_0x5e78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e78('0x6'));var config=require(_0x5e78('0x7'));var jayson=require(_0x5e78('0x8'));var client=jayson[_0x5e78('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x525cfa,_0x1d32e7,_0x16cc23){return new BPromise(function(_0x441435,_0x5c7d82){return client[_0x5e78('0xa')](_0x525cfa,_0x16cc23)['then'](function(_0x5de5e){logger['info'](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));logger['debug'](_0x5e78('0xd'),_0x1d32e7,_0x5e78('0xc'),JSON[_0x5e78('0xe')](_0x5de5e));if(_0x5de5e[_0x5e78('0xf')]){if(_0x5de5e[_0x5e78('0xf')][_0x5e78('0x10')]===0x1f4){logger[_0x5e78('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x5c7d82(_0x5de5e[_0x5e78('0xf')]['message']);}logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x441435(_0x5de5e['error'][_0x5e78('0x11')]);}else{logger[_0x5e78('0x12')](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));_0x441435(_0x5de5e[_0x5e78('0x13')][_0x5e78('0x11')]);}})['catch'](function(_0x575201){logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x575201);_0x5c7d82(_0x575201);});});}exports[_0x5e78('0x14')]=function(_0x5d6063){var _0x5d2fb9=this;return new Promise(function(_0x53f6a8,_0x5798aa){return db[_0x5e78('0x15')][_0x5e78('0x16')]({'raw':_0x5d6063[_0x5e78('0x17')]?_0x5d6063[_0x5e78('0x17')][_0x5e78('0x18')]===undefined?!![]:![]:!![],'where':_0x5d6063[_0x5e78('0x17')]?_0x5d6063['options'][_0x5e78('0x19')]||null:null,'attributes':_0x5d6063[_0x5e78('0x17')]?_0x5d6063[_0x5e78('0x17')][_0x5e78('0x1a')]||null:null,'limit':_0x5d6063[_0x5e78('0x17')]?_0x5d6063[_0x5e78('0x17')][_0x5e78('0x1b')]||null:null,'include':_0x5d6063[_0x5e78('0x17')]?_0x5d6063['options'][_0x5e78('0x1c')]?_[_0x5e78('0x1d')](_0x5d6063['options'][_0x5e78('0x1c')],function(_0x1e4e03){return{'model':db[_0x1e4e03[_0x5e78('0x1e')]],'as':_0x1e4e03['as'],'attributes':_0x1e4e03[_0x5e78('0x1a')],'include':_0x1e4e03[_0x5e78('0x1c')]?_['map'](_0x1e4e03[_0x5e78('0x1c')],function(_0x874a24){return{'model':db[_0x874a24[_0x5e78('0x1e')]],'as':_0x874a24['as'],'attributes':_0x874a24[_0x5e78('0x1a')],'include':_0x874a24[_0x5e78('0x1c')]?_[_0x5e78('0x1d')](_0x874a24[_0x5e78('0x1c')],function(_0xced025){return{'model':db[_0xced025['model']],'as':_0xced025['as'],'attributes':_0xced025[_0x5e78('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5e78('0x1f')](function(_0x4b540c){logger['info'](_0x5e78('0x14'),_0x5d6063);logger['debug'](_0x5e78('0x14'),_0x5d6063,JSON[_0x5e78('0xe')](_0x4b540c));_0x53f6a8(_0x4b540c);})['catch'](function(_0x1ac4fe){logger[_0x5e78('0xf')]('GetZohoAccount',_0x1ac4fe[_0x5e78('0x11')],_0x5d6063);_0x5798aa(_0x5d2fb9['error'](0x1f4,_0x1ac4fe[_0x5e78('0x11')]));});});};exports[_0x5e78('0x20')]=function(_0x2a5ad5){var _0x2c68d8=this;return new Promise(function(_0x527843,_0x298cc3){return db['ZohoAccount'][_0x5e78('0x21')]({'raw':_0x2a5ad5['options']?_0x2a5ad5[_0x5e78('0x17')][_0x5e78('0x18')]===undefined?!![]:![]:!![],'where':_0x2a5ad5[_0x5e78('0x17')]?_0x2a5ad5['options'][_0x5e78('0x19')]||null:null,'attributes':_0x2a5ad5[_0x5e78('0x17')]?_0x2a5ad5['options'][_0x5e78('0x1a')]||null:null,'include':_0x2a5ad5['options']?_0x2a5ad5[_0x5e78('0x17')][_0x5e78('0x1c')]?_['map'](_0x2a5ad5[_0x5e78('0x17')][_0x5e78('0x1c')],function(_0x255e3b){return{'model':db[_0x255e3b[_0x5e78('0x1e')]],'as':_0x255e3b['as'],'attributes':_0x255e3b[_0x5e78('0x1a')],'include':_0x255e3b[_0x5e78('0x1c')]?_[_0x5e78('0x1d')](_0x255e3b[_0x5e78('0x1c')],function(_0xf3ce7e){return{'model':db[_0xf3ce7e['model']],'as':_0xf3ce7e['as'],'attributes':_0xf3ce7e[_0x5e78('0x1a')],'include':_0xf3ce7e['include']?_[_0x5e78('0x1d')](_0xf3ce7e['include'],function(_0x186e04){return{'model':db[_0x186e04['model']],'as':_0x186e04['as'],'attributes':_0x186e04[_0x5e78('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5e78('0x1f')](function(_0x1f24f9){logger['info'](_0x5e78('0x20'),_0x2a5ad5);logger[_0x5e78('0x22')]('ShowZohoAccount',_0x2a5ad5,JSON['stringify'](_0x1f24f9));_0x527843(_0x1f24f9);})[_0x5e78('0x23')](function(_0x2a5ab9){logger[_0x5e78('0xf')](_0x5e78('0x20'),_0x2a5ab9[_0x5e78('0x11')],_0x2a5ad5);_0x298cc3(_0x2c68d8[_0x5e78('0xf')](0x1f4,_0x2a5ab9[_0x5e78('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c270515..ff408fb 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 _0x1788=['isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get'];(function(_0x54dadf,_0x19f0ef){var _0xeb2d64=function(_0x3449bb){while(--_0x3449bb){_0x54dadf['push'](_0x54dadf['shift']());}};_0xeb2d64(++_0x19f0ef);}(_0x1788,0x81));var _0x8178=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x1788[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x8178('0x0'));var path=require(_0x8178('0x1'));var timeout=require(_0x8178('0x2'));var express=require(_0x8178('0x3'));var router=express[_0x8178('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8178('0x5'));var interaction=require(_0x8178('0x6'));var config=require('../../config/environment');var controller=require(_0x8178('0x7'));router[_0x8178('0x8')]('/',auth[_0x8178('0x9')](),controller[_0x8178('0xa')]);router[_0x8178('0x8')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller[_0x8178('0xc')]);router['get'](_0x8178('0xd'),auth[_0x8178('0x9')](),controller[_0x8178('0xe')]);router[_0x8178('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8178('0xf')]);router[_0x8178('0x8')](_0x8178('0x10'),auth['isAuthenticated'](),controller[_0x8178('0x11')]);router['post']('/',auth[_0x8178('0x9')](),controller[_0x8178('0x12')]);router[_0x8178('0x13')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller[_0x8178('0x14')]);router[_0x8178('0x15')](_0x8178('0xb'),auth[_0x8178('0x9')](),controller['destroy']);module[_0x8178('0x16')]=router; \ No newline at end of file +var _0xcf7c=['../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2da1cc,_0x125993){var _0x29a822=function(_0x1487a3){while(--_0x1487a3){_0x2da1cc['push'](_0x2da1cc['shift']());}};_0x29a822(++_0x125993);}(_0xcf7c,0x84));var _0xccf7=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xcf7c[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require('multer');var util=require(_0xccf7('0x0'));var path=require(_0xccf7('0x1'));var timeout=require(_0xccf7('0x2'));var express=require(_0xccf7('0x3'));var router=express[_0xccf7('0x4')]();var fs_extra=require(_0xccf7('0x5'));var auth=require(_0xccf7('0x6'));var interaction=require(_0xccf7('0x7'));var config=require('../../config/environment');var controller=require(_0xccf7('0x8'));router[_0xccf7('0x9')]('/',auth[_0xccf7('0xa')](),controller[_0xccf7('0xb')]);router[_0xccf7('0x9')](_0xccf7('0xc'),auth[_0xccf7('0xa')](),controller['show']);router[_0xccf7('0x9')](_0xccf7('0xd'),auth[_0xccf7('0xa')](),controller[_0xccf7('0xe')]);router[_0xccf7('0x9')](_0xccf7('0xf'),auth[_0xccf7('0xa')](),controller['getSubjects']);router[_0xccf7('0x9')](_0xccf7('0x10'),auth[_0xccf7('0xa')](),controller['getDescriptions']);router[_0xccf7('0x11')]('/',auth[_0xccf7('0xa')](),controller[_0xccf7('0x12')]);router[_0xccf7('0x13')](_0xccf7('0xc'),auth[_0xccf7('0xa')](),controller['update']);router[_0xccf7('0x14')](_0xccf7('0xc'),auth[_0xccf7('0xa')](),controller[_0xccf7('0x15')]);module[_0xccf7('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 839455c..e5e9c57 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 _0x9362=['contact_lead','sequelize','STRING','lead','contact','nothing'];(function(_0x1114dc,_0x50aed4){var _0x164894=function(_0x40ec33){while(--_0x40ec33){_0x1114dc['push'](_0x1114dc['shift']());}};_0x164894(++_0x50aed4);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2936('0x0'));module['exports']={'name':{'type':Sequelize[_0x2936('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x2936('0x2'),_0x2936('0x3'),_0x2936('0x4')),'defaultValue':_0x2936('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x2936('0x5'),'contact',_0x2936('0x2')),'defaultValue':_0x2936('0x5')},'description':{'type':Sequelize[_0x2936('0x1')]}}; \ No newline at end of file +var _0x2cd0=['lead','ENUM','contact_lead','contact','STRING','sequelize','exports'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0x2cd0,0x8a));var _0x02cd=function(_0x583f82,_0xf23fcd){_0x583f82=_0x583f82-0x0;var _0x710688=_0x2cd0[_0x583f82];return _0x710688;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x02cd('0x2'),'contact','nothing'),'defaultValue':_0x02cd('0x2')},'moduleSearch':{'type':Sequelize[_0x02cd('0x3')](_0x02cd('0x4'),_0x02cd('0x5'),_0x02cd('0x2')),'defaultValue':_0x02cd('0x4')},'description':{'type':Sequelize[_0x02cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6de6df7..98e0f44 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 _0xdddb=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','filter','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xdddb,0xdc));var _0xbddd=function(_0x926fea,_0x2a564d){_0x926fea=_0x926fea-0x0;var _0x203245=_0xdddb[_0x926fea];return _0x203245;};'use strict';var emlformat=require(_0xbddd('0x0'));var rimraf=require(_0xbddd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbddd('0x2'));var rp=require('request-promise');var moment=require(_0xbddd('0x3'));var BPromise=require(_0xbddd('0x4'));var Mustache=require(_0xbddd('0x5'));var util=require(_0xbddd('0x6'));var path=require(_0xbddd('0x7'));var sox=require(_0xbddd('0x8'));var csv=require('to-csv');var ejs=require(_0xbddd('0x9'));var fs=require('fs');var fs_extra=require(_0xbddd('0xa'));var _=require('lodash');var squel=require(_0xbddd('0xb'));var crypto=require(_0xbddd('0xc'));var jsforce=require(_0xbddd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbddd('0xe'));var querystring=require('querystring');var Papa=require(_0xbddd('0xf'));var Redis=require('ioredis');var authService=require(_0xbddd('0x10'));var qs=require(_0xbddd('0x11'));var as=require(_0xbddd('0x12'));var hardwareService=require(_0xbddd('0x13'));var logger=require(_0xbddd('0x14'))(_0xbddd('0x15'));var utils=require(_0xbddd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbddd('0x17'));var db=require(_0xbddd('0x18'))['db'];function respondWithStatusCode(_0x489d79,_0x5901a9){_0x5901a9=_0x5901a9||0xcc;return function(_0x1737b6){if(_0x1737b6){return _0x489d79[_0xbddd('0x19')](_0x5901a9);}return _0x489d79['status'](_0x5901a9)['end']();};}function respondWithResult(_0x5f0b88,_0x2ed075){_0x2ed075=_0x2ed075||0xc8;return function(_0x36735a){if(_0x36735a){return _0x5f0b88[_0xbddd('0x1a')](_0x2ed075)[_0xbddd('0x1b')](_0x36735a);}};}function respondWithFilteredResult(_0x563747,_0x4da616){return function(_0x34bbf0){if(_0x34bbf0){var _0x38e1b9=typeof _0x4da616[_0xbddd('0x1c')]===_0xbddd('0x1d')&&typeof _0x4da616['limit']==='undefined';var _0x205a9b=_0x34bbf0[_0xbddd('0x1e')];var _0x4de8ff=_0x38e1b9?0x0:_0x4da616[_0xbddd('0x1c')];var _0x436722=_0x38e1b9?_0x34bbf0[_0xbddd('0x1e')]:_0x4da616['offset']+_0x4da616['limit'];var _0x286198;if(_0x436722>=_0x205a9b){_0x436722=_0x205a9b;_0x286198=0xc8;}else{_0x286198=0xce;}_0x563747[_0xbddd('0x1a')](_0x286198);return _0x563747[_0xbddd('0x1f')]('Content-Range',_0x4de8ff+'-'+_0x436722+'/'+_0x205a9b)[_0xbddd('0x1b')](_0x34bbf0);}return null;};}function patchUpdates(_0x1fb9d4){return function(_0x220257){try{jsonpatch[_0xbddd('0x20')](_0x220257,_0x1fb9d4,!![]);}catch(_0x4e384c){return BPromise[_0xbddd('0x21')](_0x4e384c);}return _0x220257['save']();};}function saveUpdates(_0x4b7b14,_0x48e48f){return function(_0x75c12b){if(_0x75c12b){return _0x75c12b[_0xbddd('0x22')](_0x4b7b14)['then'](function(_0x55cb43){return _0x55cb43;});}return null;};}function removeEntity(_0xcf7735,_0x68fe78){return function(_0x5497ca){if(_0x5497ca){return _0x5497ca[_0xbddd('0x23')]()[_0xbddd('0x24')](function(){_0xcf7735[_0xbddd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a7fc,_0xfb233f){return function(_0x2faa79){if(!_0x2faa79){_0x47a7fc[_0xbddd('0x19')](0x194);}return _0x2faa79;};}function handleError(_0x51b397,_0x3f46a4){_0x3f46a4=_0x3f46a4||0x1f4;return function(_0x50d6cf){logger[_0xbddd('0x25')](_0x50d6cf[_0xbddd('0x26')]);if(_0x50d6cf[_0xbddd('0x27')]){delete _0x50d6cf[_0xbddd('0x27')];}_0x51b397[_0xbddd('0x1a')](_0x3f46a4)[_0xbddd('0x28')](_0x50d6cf);};}exports[_0xbddd('0x29')]=function(_0x236117,_0x3729ed){var _0x1b215d={},_0x4ef95e={},_0x1d97b4={'count':0x0,'rows':[]};var _0x3e7204=_[_0xbddd('0x2a')](db[_0xbddd('0x2b')][_0xbddd('0x2c')],function(_0x3df758){return{'name':_0x3df758['fieldName'],'type':_0x3df758[_0xbddd('0x2d')][_0xbddd('0x2e')]};});_0x4ef95e[_0xbddd('0x2f')]=_['map'](_0x3e7204,_0xbddd('0x27'));_0x4ef95e[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x236117[_0xbddd('0x30')]);_0x4ef95e[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x4ef95e[_0xbddd('0x2f')],_0x4ef95e['query']);_0x1b215d[_0xbddd('0x34')]=_[_0xbddd('0x33')](_0x4ef95e['model'],qs['fields'](_0x236117[_0xbddd('0x30')][_0xbddd('0x35')]));_0x1b215d[_0xbddd('0x34')]=_0x1b215d[_0xbddd('0x34')][_0xbddd('0x36')]?_0x1b215d[_0xbddd('0x34')]:_0x4ef95e[_0xbddd('0x2f')];if(!_0x236117[_0xbddd('0x30')]['hasOwnProperty'](_0xbddd('0x37'))){_0x1b215d[_0xbddd('0x38')]=qs['limit'](_0x236117[_0xbddd('0x30')][_0xbddd('0x38')]);_0x1b215d[_0xbddd('0x1c')]=qs[_0xbddd('0x1c')](_0x236117[_0xbddd('0x30')][_0xbddd('0x1c')]);}_0x1b215d[_0xbddd('0x39')]=qs[_0xbddd('0x3a')](_0x236117[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x1b215d[_0xbddd('0x3b')]=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x236117[_0xbddd('0x30')],_0x4ef95e[_0xbddd('0x32')]),_0x3e7204);if(_0x236117[_0xbddd('0x30')]['filter']){_0x1b215d[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x1b215d[_0xbddd('0x3b')],{'$or':_[_0xbddd('0x2a')](_0x3e7204,function(_0x3e7592){if(_0x3e7592[_0xbddd('0x2d')]!==_0xbddd('0x3e')){var _0x15c049={};_0x15c049[_0x3e7592[_0xbddd('0x27')]]={'$like':'%'+_0x236117[_0xbddd('0x30')]['filter']+'%'};return _0x15c049;}})});}_0x1b215d=_[_0xbddd('0x3d')]({},_0x1b215d,_0x236117['options']);var _0x23572f={'where':_0x1b215d['where']};return db['ZohoConfiguration'][_0xbddd('0x1e')](_0x23572f)[_0xbddd('0x24')](function(_0xb5b45c){_0x1d97b4[_0xbddd('0x1e')]=_0xb5b45c;if(_0x236117[_0xbddd('0x30')][_0xbddd('0x3f')]){_0x1b215d[_0xbddd('0x40')]=[{'all':!![]}];}return db[_0xbddd('0x2b')][_0xbddd('0x41')](_0x1b215d);})['then'](function(_0x322daa){_0x1d97b4[_0xbddd('0x42')]=_0x322daa;return _0x1d97b4;})[_0xbddd('0x24')](respondWithFilteredResult(_0x3729ed,_0x1b215d))[_0xbddd('0x43')](handleError(_0x3729ed,null));};exports[_0xbddd('0x44')]=function(_0x8d833b,_0x2c37d4){var _0x4a71eb={'raw':![],'where':{'id':_0x8d833b[_0xbddd('0x45')]['id']}},_0x1a69c6={};_0x1a69c6[_0xbddd('0x2f')]=_[_0xbddd('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x1a69c6[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x8d833b['query']);_0x1a69c6['filters']=_[_0xbddd('0x33')](_0x1a69c6[_0xbddd('0x2f')],_0x1a69c6[_0xbddd('0x30')]);_0x4a71eb['attributes']=_[_0xbddd('0x33')](_0x1a69c6[_0xbddd('0x2f')],qs[_0xbddd('0x35')](_0x8d833b['query'][_0xbddd('0x35')]));_0x4a71eb['attributes']=_0x4a71eb['attributes'][_0xbddd('0x36')]?_0x4a71eb[_0xbddd('0x34')]:_0x1a69c6['model'];if(_0x8d833b['query'][_0xbddd('0x3f')]){_0x4a71eb[_0xbddd('0x40')]=[{'all':!![]}];}_0x4a71eb=_[_0xbddd('0x3d')]({},_0x4a71eb,_0x8d833b[_0xbddd('0x46')]);return db[_0xbddd('0x2b')][_0xbddd('0x47')](_0x4a71eb)[_0xbddd('0x24')](handleEntityNotFound(_0x2c37d4,null))[_0xbddd('0x24')](respondWithResult(_0x2c37d4,null))[_0xbddd('0x43')](handleError(_0x2c37d4,null));};exports[_0xbddd('0x48')]=function(_0x298a6d,_0x445070){return db['ZohoConfiguration'][_0xbddd('0x48')](_0x298a6d['body'],{})[_0xbddd('0x24')](respondWithResult(_0x445070,0xc9))[_0xbddd('0x43')](handleError(_0x445070,null));};exports[_0xbddd('0x22')]=function(_0x2bb063,_0x2cbde3){if(_0x2bb063[_0xbddd('0x49')]['id']){delete _0x2bb063[_0xbddd('0x49')]['id'];}return db[_0xbddd('0x2b')]['find']({'where':{'id':_0x2bb063[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x2cbde3,null))['then'](saveUpdates(_0x2bb063[_0xbddd('0x49')],null))['then'](respondWithResult(_0x2cbde3,null))[_0xbddd('0x43')](handleError(_0x2cbde3,null));};exports[_0xbddd('0x23')]=function(_0x3cea16,_0x45eecc){return db[_0xbddd('0x2b')][_0xbddd('0x47')]({'where':{'id':_0x3cea16[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x45eecc,null))[_0xbddd('0x24')](removeEntity(_0x45eecc,null))[_0xbddd('0x43')](handleError(_0x45eecc,null));};exports['getFields']=function(_0x65d337,_0x4ca820,_0x24f3c4){var _0x594574={};var _0x2e152e={};var _0x5c5f18;var _0x57e747;return db[_0xbddd('0x2b')]['findOne']({'where':{'id':_0x65d337[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x4ca820,null))[_0xbddd('0x24')](function(_0xf1c779){if(_0xf1c779){_0x5c5f18=_0xf1c779;_0x2e152e[_0xbddd('0x2f')]=_[_0xbddd('0x31')](db['ZohoField'][_0xbddd('0x2c')]);_0x2e152e['query']=_['keys'](_0x65d337[_0xbddd('0x30')]);_0x2e152e[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x2e152e['model'],_0x2e152e['query']);_0x594574[_0xbddd('0x34')]=_[_0xbddd('0x33')](_0x2e152e[_0xbddd('0x2f')],qs['fields'](_0x65d337['query']['fields']));_0x594574[_0xbddd('0x34')]=_0x594574[_0xbddd('0x34')]['length']?_0x594574[_0xbddd('0x34')]:_0x2e152e[_0xbddd('0x2f')];_0x594574[_0xbddd('0x39')]=qs[_0xbddd('0x3a')](_0x65d337[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x594574[_0xbddd('0x3b')]=qs['filters'](_['pick'](_0x65d337['query'],_0x2e152e[_0xbddd('0x32')]));if(_0x65d337['query'][_0xbddd('0x4a')]){_0x594574[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x594574[_0xbddd('0x3b')],{'$or':_[_0xbddd('0x2a')](_0x594574[_0xbddd('0x34')],function(_0x30d378){var _0x7c0cee={};_0x7c0cee[_0x30d378]={'$like':'%'+_0x65d337['query'][_0xbddd('0x4a')]+'%'};return _0x7c0cee;})});}_0x594574=_[_0xbddd('0x3d')]({},_0x594574,_0x65d337['options']);return _0x5c5f18[_0xbddd('0x4b')](_0x594574);}})[_0xbddd('0x24')](function(_0x3ca115){if(_0x3ca115){_0x57e747=_0x3ca115[_0xbddd('0x36')];if(!_0x65d337[_0xbddd('0x30')][_0xbddd('0x4c')]('nolimit')){_0x594574[_0xbddd('0x38')]=qs[_0xbddd('0x38')](_0x65d337[_0xbddd('0x30')]['limit']);_0x594574['offset']=qs[_0xbddd('0x1c')](_0x65d337[_0xbddd('0x30')][_0xbddd('0x1c')]);}return _0x5c5f18[_0xbddd('0x4b')](_0x594574);}})[_0xbddd('0x24')](function(_0x258b48){if(_0x258b48){return _0x258b48?{'count':_0x57e747,'rows':_0x258b48}:null;}})[_0xbddd('0x24')](respondWithResult(_0x4ca820,null))[_0xbddd('0x43')](handleError(_0x4ca820,null));};exports[_0xbddd('0x4d')]=function(_0x22d084,_0xc519e1,_0x576bda){var _0x1305be={};var _0xfde360={};var _0x2049ce;var _0x579383;return db[_0xbddd('0x2b')][_0xbddd('0x4e')]({'where':{'id':_0x22d084['params']['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0xc519e1,null))[_0xbddd('0x24')](function(_0x68d418){if(_0x68d418){_0x2049ce=_0x68d418;_0xfde360['model']=_[_0xbddd('0x31')](db['ZohoField']['rawAttributes']);_0xfde360[_0xbddd('0x30')]=_['keys'](_0x22d084[_0xbddd('0x30')]);_0xfde360[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0xfde360[_0xbddd('0x2f')],_0xfde360[_0xbddd('0x30')]);_0x1305be['attributes']=_[_0xbddd('0x33')](_0xfde360[_0xbddd('0x2f')],qs['fields'](_0x22d084['query'][_0xbddd('0x35')]));_0x1305be[_0xbddd('0x34')]=_0x1305be['attributes']['length']?_0x1305be[_0xbddd('0x34')]:_0xfde360[_0xbddd('0x2f')];_0x1305be[_0xbddd('0x39')]=qs['sort'](_0x22d084['query']['sort']);_0x1305be[_0xbddd('0x3b')]=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x22d084[_0xbddd('0x30')],_0xfde360[_0xbddd('0x32')]));if(_0x22d084[_0xbddd('0x30')][_0xbddd('0x4a')]){_0x1305be[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x1305be['where'],{'$or':_['map'](_0x1305be['attributes'],function(_0x2a62bc){var _0x28fd8b={};_0x28fd8b[_0x2a62bc]={'$like':'%'+_0x22d084[_0xbddd('0x30')][_0xbddd('0x4a')]+'%'};return _0x28fd8b;})});}_0x1305be=_[_0xbddd('0x3d')]({},_0x1305be,_0x22d084['options']);return _0x2049ce[_0xbddd('0x4d')](_0x1305be);}})['then'](function(_0x369137){if(_0x369137){_0x579383=_0x369137[_0xbddd('0x36')];if(!_0x22d084[_0xbddd('0x30')][_0xbddd('0x4c')](_0xbddd('0x37'))){_0x1305be[_0xbddd('0x38')]=qs[_0xbddd('0x38')](_0x22d084[_0xbddd('0x30')][_0xbddd('0x38')]);_0x1305be['offset']=qs[_0xbddd('0x1c')](_0x22d084[_0xbddd('0x30')][_0xbddd('0x1c')]);}return _0x2049ce[_0xbddd('0x4d')](_0x1305be);}})[_0xbddd('0x24')](function(_0x9539a3){if(_0x9539a3){return _0x9539a3?{'count':_0x579383,'rows':_0x9539a3}:null;}})[_0xbddd('0x24')](respondWithResult(_0xc519e1,null))['catch'](handleError(_0xc519e1,null));};exports[_0xbddd('0x4f')]=function(_0x311ae4,_0x20555a,_0x5c7a3b){var _0x79c580={};var _0x51843f={};var _0x264467;var _0x44966a;return db['ZohoConfiguration'][_0xbddd('0x4e')]({'where':{'id':_0x311ae4[_0xbddd('0x45')]['id']}})[_0xbddd('0x24')](handleEntityNotFound(_0x20555a,null))[_0xbddd('0x24')](function(_0x3f1c01){if(_0x3f1c01){_0x264467=_0x3f1c01;_0x51843f['model']=_[_0xbddd('0x31')](db['ZohoField'][_0xbddd('0x2c')]);_0x51843f[_0xbddd('0x30')]=_[_0xbddd('0x31')](_0x311ae4[_0xbddd('0x30')]);_0x51843f[_0xbddd('0x32')]=_[_0xbddd('0x33')](_0x51843f['model'],_0x51843f[_0xbddd('0x30')]);_0x79c580['attributes']=_['intersection'](_0x51843f[_0xbddd('0x2f')],qs['fields'](_0x311ae4[_0xbddd('0x30')]['fields']));_0x79c580['attributes']=_0x79c580[_0xbddd('0x34')]['length']?_0x79c580[_0xbddd('0x34')]:_0x51843f[_0xbddd('0x2f')];_0x79c580[_0xbddd('0x39')]=qs['sort'](_0x311ae4[_0xbddd('0x30')][_0xbddd('0x3a')]);_0x79c580['where']=qs[_0xbddd('0x32')](_[_0xbddd('0x3c')](_0x311ae4[_0xbddd('0x30')],_0x51843f[_0xbddd('0x32')]));if(_0x311ae4[_0xbddd('0x30')]['filter']){_0x79c580[_0xbddd('0x3b')]=_[_0xbddd('0x3d')](_0x79c580['where'],{'$or':_['map'](_0x79c580[_0xbddd('0x34')],function(_0xcac815){var _0x3b022b={};_0x3b022b[_0xcac815]={'$like':'%'+_0x311ae4[_0xbddd('0x30')][_0xbddd('0x4a')]+'%'};return _0x3b022b;})});}_0x79c580=_[_0xbddd('0x3d')]({},_0x79c580,_0x311ae4[_0xbddd('0x46')]);return _0x264467['getDescriptions'](_0x79c580);}})[_0xbddd('0x24')](function(_0xdcb63d){if(_0xdcb63d){_0x44966a=_0xdcb63d[_0xbddd('0x36')];if(!_0x311ae4['query'][_0xbddd('0x4c')]('nolimit')){_0x79c580['limit']=qs['limit'](_0x311ae4[_0xbddd('0x30')][_0xbddd('0x38')]);_0x79c580['offset']=qs[_0xbddd('0x1c')](_0x311ae4['query'][_0xbddd('0x1c')]);}return _0x264467[_0xbddd('0x4f')](_0x79c580);}})['then'](function(_0x42227a){if(_0x42227a){return _0x42227a?{'count':_0x44966a,'rows':_0x42227a}:null;}})[_0xbddd('0x24')](respondWithResult(_0x20555a,null))['catch'](handleError(_0x20555a,null));}; \ No newline at end of file +var _0x2e8d=['index','ZohoConfiguration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','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','name','send'];(function(_0x53f715,_0x52587b){var _0x16c757=function(_0x5cc9bf){while(--_0x5cc9bf){_0x53f715['push'](_0x53f715['shift']());}};_0x16c757(++_0x52587b);}(_0x2e8d,0x118));var _0xd2e8=function(_0x5abc1e,_0x8715e7){_0x5abc1e=_0x5abc1e-0x0;var _0x3423d1=_0x2e8d[_0x5abc1e];return _0x3423d1;};'use strict';var emlformat=require(_0xd2e8('0x0'));var rimraf=require(_0xd2e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2e8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd2e8('0x3'));var Mustache=require(_0xd2e8('0x4'));var util=require(_0xd2e8('0x5'));var path=require(_0xd2e8('0x6'));var sox=require(_0xd2e8('0x7'));var csv=require(_0xd2e8('0x8'));var ejs=require(_0xd2e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2e8('0xa'));var squel=require(_0xd2e8('0xb'));var crypto=require(_0xd2e8('0xc'));var jsforce=require(_0xd2e8('0xd'));var deskjs=require(_0xd2e8('0xe'));var toCsv=require(_0xd2e8('0x8'));var querystring=require(_0xd2e8('0xf'));var Papa=require('papaparse');var Redis=require(_0xd2e8('0x10'));var authService=require(_0xd2e8('0x11'));var qs=require(_0xd2e8('0x12'));var as=require(_0xd2e8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd2e8('0x14'));var utils=require(_0xd2e8('0x15'));var config=require(_0xd2e8('0x16'));var licenseUtil=require(_0xd2e8('0x17'));var db=require(_0xd2e8('0x18'))['db'];function respondWithStatusCode(_0x4180a7,_0x2ae9ad){_0x2ae9ad=_0x2ae9ad||0xcc;return function(_0x124bb8){if(_0x124bb8){return _0x4180a7[_0xd2e8('0x19')](_0x2ae9ad);}return _0x4180a7[_0xd2e8('0x1a')](_0x2ae9ad)[_0xd2e8('0x1b')]();};}function respondWithResult(_0x5648d3,_0x1e5b68){_0x1e5b68=_0x1e5b68||0xc8;return function(_0x53617e){if(_0x53617e){return _0x5648d3[_0xd2e8('0x1a')](_0x1e5b68)[_0xd2e8('0x1c')](_0x53617e);}};}function respondWithFilteredResult(_0x3a92fe,_0x823063){return function(_0x4654b1){if(_0x4654b1){var _0xa2ea0b=typeof _0x823063[_0xd2e8('0x1d')]===_0xd2e8('0x1e')&&typeof _0x823063[_0xd2e8('0x1f')]===_0xd2e8('0x1e');var _0x357d71=_0x4654b1['count'];var _0x557c0e=_0xa2ea0b?0x0:_0x823063[_0xd2e8('0x1d')];var _0x55c42b=_0xa2ea0b?_0x4654b1[_0xd2e8('0x20')]:_0x823063[_0xd2e8('0x1d')]+_0x823063[_0xd2e8('0x1f')];var _0x2625db;if(_0x55c42b>=_0x357d71){_0x55c42b=_0x357d71;_0x2625db=0xc8;}else{_0x2625db=0xce;}_0x3a92fe[_0xd2e8('0x1a')](_0x2625db);return _0x3a92fe[_0xd2e8('0x21')](_0xd2e8('0x22'),_0x557c0e+'-'+_0x55c42b+'/'+_0x357d71)[_0xd2e8('0x1c')](_0x4654b1);}return null;};}function patchUpdates(_0x4e1e18){return function(_0x5908e0){try{jsonpatch[_0xd2e8('0x23')](_0x5908e0,_0x4e1e18,!![]);}catch(_0x497e37){return BPromise[_0xd2e8('0x24')](_0x497e37);}return _0x5908e0[_0xd2e8('0x25')]();};}function saveUpdates(_0x4d3eb9,_0x5a5543){return function(_0x4e5824){if(_0x4e5824){return _0x4e5824[_0xd2e8('0x26')](_0x4d3eb9)[_0xd2e8('0x27')](function(_0x48c887){return _0x48c887;});}return null;};}function removeEntity(_0x33aaf2,_0x19e928){return function(_0x414499){if(_0x414499){return _0x414499[_0xd2e8('0x28')]()[_0xd2e8('0x27')](function(){_0x33aaf2['status'](0xcc)[_0xd2e8('0x1b')]();});}};}function handleEntityNotFound(_0x1060f0,_0xbc5ed5){return function(_0x5acc64){if(!_0x5acc64){_0x1060f0[_0xd2e8('0x19')](0x194);}return _0x5acc64;};}function handleError(_0x3b4985,_0x13cefb){_0x13cefb=_0x13cefb||0x1f4;return function(_0x306548){logger[_0xd2e8('0x29')](_0x306548['stack']);if(_0x306548[_0xd2e8('0x2a')]){delete _0x306548[_0xd2e8('0x2a')];}_0x3b4985[_0xd2e8('0x1a')](_0x13cefb)[_0xd2e8('0x2b')](_0x306548);};}exports[_0xd2e8('0x2c')]=function(_0x463752,_0x5d0c38){var _0x4822f7={},_0x1df9a6={},_0x58d1f8={'count':0x0,'rows':[]};var _0x15854e=_['map'](db[_0xd2e8('0x2d')][_0xd2e8('0x2e')],function(_0x35427c){return{'name':_0x35427c['fieldName'],'type':_0x35427c[_0xd2e8('0x2f')]['key']};});_0x1df9a6[_0xd2e8('0x30')]=_['map'](_0x15854e,'name');_0x1df9a6[_0xd2e8('0x31')]=_[_0xd2e8('0x32')](_0x463752[_0xd2e8('0x31')]);_0x1df9a6['filters']=_[_0xd2e8('0x33')](_0x1df9a6[_0xd2e8('0x30')],_0x1df9a6[_0xd2e8('0x31')]);_0x4822f7[_0xd2e8('0x34')]=_['intersection'](_0x1df9a6[_0xd2e8('0x30')],qs[_0xd2e8('0x35')](_0x463752[_0xd2e8('0x31')][_0xd2e8('0x35')]));_0x4822f7[_0xd2e8('0x34')]=_0x4822f7[_0xd2e8('0x34')][_0xd2e8('0x36')]?_0x4822f7[_0xd2e8('0x34')]:_0x1df9a6['model'];if(!_0x463752['query'][_0xd2e8('0x37')](_0xd2e8('0x38'))){_0x4822f7[_0xd2e8('0x1f')]=qs['limit'](_0x463752[_0xd2e8('0x31')]['limit']);_0x4822f7[_0xd2e8('0x1d')]=qs[_0xd2e8('0x1d')](_0x463752[_0xd2e8('0x31')][_0xd2e8('0x1d')]);}_0x4822f7[_0xd2e8('0x39')]=qs[_0xd2e8('0x3a')](_0x463752[_0xd2e8('0x31')][_0xd2e8('0x3a')]);_0x4822f7[_0xd2e8('0x3b')]=qs[_0xd2e8('0x3c')](_[_0xd2e8('0x3d')](_0x463752['query'],_0x1df9a6[_0xd2e8('0x3c')]),_0x15854e);if(_0x463752[_0xd2e8('0x31')]['filter']){_0x4822f7['where']=_[_0xd2e8('0x3e')](_0x4822f7[_0xd2e8('0x3b')],{'$or':_[_0xd2e8('0x3f')](_0x15854e,function(_0x3f4c58){if(_0x3f4c58[_0xd2e8('0x2f')]!==_0xd2e8('0x40')){var _0xf40b16={};_0xf40b16[_0x3f4c58['name']]={'$like':'%'+_0x463752['query'][_0xd2e8('0x41')]+'%'};return _0xf40b16;}})});}_0x4822f7=_['merge']({},_0x4822f7,_0x463752[_0xd2e8('0x42')]);var _0x1eda33={'where':_0x4822f7[_0xd2e8('0x3b')]};return db[_0xd2e8('0x2d')][_0xd2e8('0x20')](_0x1eda33)[_0xd2e8('0x27')](function(_0x32c9c6){_0x58d1f8[_0xd2e8('0x20')]=_0x32c9c6;if(_0x463752[_0xd2e8('0x31')][_0xd2e8('0x43')]){_0x4822f7['include']=[{'all':!![]}];}return db[_0xd2e8('0x2d')]['findAll'](_0x4822f7);})[_0xd2e8('0x27')](function(_0x31e2fc){_0x58d1f8[_0xd2e8('0x44')]=_0x31e2fc;return _0x58d1f8;})[_0xd2e8('0x27')](respondWithFilteredResult(_0x5d0c38,_0x4822f7))[_0xd2e8('0x45')](handleError(_0x5d0c38,null));};exports[_0xd2e8('0x46')]=function(_0x199c55,_0x2dbf8e){var _0x46cf8a={'raw':![],'where':{'id':_0x199c55[_0xd2e8('0x47')]['id']}},_0x5dd88b={};_0x5dd88b[_0xd2e8('0x30')]=_['keys'](db[_0xd2e8('0x2d')][_0xd2e8('0x2e')]);_0x5dd88b[_0xd2e8('0x31')]=_[_0xd2e8('0x32')](_0x199c55['query']);_0x5dd88b[_0xd2e8('0x3c')]=_[_0xd2e8('0x33')](_0x5dd88b[_0xd2e8('0x30')],_0x5dd88b[_0xd2e8('0x31')]);_0x46cf8a[_0xd2e8('0x34')]=_[_0xd2e8('0x33')](_0x5dd88b['model'],qs['fields'](_0x199c55['query'][_0xd2e8('0x35')]));_0x46cf8a['attributes']=_0x46cf8a[_0xd2e8('0x34')][_0xd2e8('0x36')]?_0x46cf8a[_0xd2e8('0x34')]:_0x5dd88b['model'];if(_0x199c55[_0xd2e8('0x31')][_0xd2e8('0x43')]){_0x46cf8a[_0xd2e8('0x48')]=[{'all':!![]}];}_0x46cf8a=_['merge']({},_0x46cf8a,_0x199c55[_0xd2e8('0x42')]);return db['ZohoConfiguration'][_0xd2e8('0x49')](_0x46cf8a)[_0xd2e8('0x27')](handleEntityNotFound(_0x2dbf8e,null))[_0xd2e8('0x27')](respondWithResult(_0x2dbf8e,null))['catch'](handleError(_0x2dbf8e,null));};exports[_0xd2e8('0x4a')]=function(_0x17d26b,_0x2a8022){return db[_0xd2e8('0x2d')][_0xd2e8('0x4a')](_0x17d26b[_0xd2e8('0x4b')],{})[_0xd2e8('0x27')](respondWithResult(_0x2a8022,0xc9))['catch'](handleError(_0x2a8022,null));};exports[_0xd2e8('0x26')]=function(_0x4caab2,_0x1937b4){if(_0x4caab2[_0xd2e8('0x4b')]['id']){delete _0x4caab2['body']['id'];}return db['ZohoConfiguration'][_0xd2e8('0x49')]({'where':{'id':_0x4caab2[_0xd2e8('0x47')]['id']}})[_0xd2e8('0x27')](handleEntityNotFound(_0x1937b4,null))['then'](saveUpdates(_0x4caab2[_0xd2e8('0x4b')],null))[_0xd2e8('0x27')](respondWithResult(_0x1937b4,null))[_0xd2e8('0x45')](handleError(_0x1937b4,null));};exports['destroy']=function(_0x221a90,_0x11be1f){return db[_0xd2e8('0x2d')][_0xd2e8('0x49')]({'where':{'id':_0x221a90[_0xd2e8('0x47')]['id']}})[_0xd2e8('0x27')](handleEntityNotFound(_0x11be1f,null))[_0xd2e8('0x27')](removeEntity(_0x11be1f,null))['catch'](handleError(_0x11be1f,null));};exports[_0xd2e8('0x4c')]=function(_0x2f868a,_0x446b67,_0x56b485){var _0x30bf12={};var _0x3a8986={};var _0x1d4137;var _0x57877f;return db[_0xd2e8('0x2d')][_0xd2e8('0x4d')]({'where':{'id':_0x2f868a[_0xd2e8('0x47')]['id']}})[_0xd2e8('0x27')](handleEntityNotFound(_0x446b67,null))[_0xd2e8('0x27')](function(_0xc978fa){if(_0xc978fa){_0x1d4137=_0xc978fa;_0x3a8986[_0xd2e8('0x30')]=_[_0xd2e8('0x32')](db[_0xd2e8('0x4e')]['rawAttributes']);_0x3a8986[_0xd2e8('0x31')]=_[_0xd2e8('0x32')](_0x2f868a[_0xd2e8('0x31')]);_0x3a8986[_0xd2e8('0x3c')]=_[_0xd2e8('0x33')](_0x3a8986[_0xd2e8('0x30')],_0x3a8986[_0xd2e8('0x31')]);_0x30bf12[_0xd2e8('0x34')]=_[_0xd2e8('0x33')](_0x3a8986[_0xd2e8('0x30')],qs[_0xd2e8('0x35')](_0x2f868a[_0xd2e8('0x31')][_0xd2e8('0x35')]));_0x30bf12[_0xd2e8('0x34')]=_0x30bf12[_0xd2e8('0x34')][_0xd2e8('0x36')]?_0x30bf12[_0xd2e8('0x34')]:_0x3a8986['model'];_0x30bf12[_0xd2e8('0x39')]=qs[_0xd2e8('0x3a')](_0x2f868a[_0xd2e8('0x31')]['sort']);_0x30bf12[_0xd2e8('0x3b')]=qs[_0xd2e8('0x3c')](_[_0xd2e8('0x3d')](_0x2f868a[_0xd2e8('0x31')],_0x3a8986[_0xd2e8('0x3c')]));if(_0x2f868a[_0xd2e8('0x31')]['filter']){_0x30bf12['where']=_[_0xd2e8('0x3e')](_0x30bf12['where'],{'$or':_[_0xd2e8('0x3f')](_0x30bf12[_0xd2e8('0x34')],function(_0x4394bc){var _0xac4cc9={};_0xac4cc9[_0x4394bc]={'$like':'%'+_0x2f868a[_0xd2e8('0x31')][_0xd2e8('0x41')]+'%'};return _0xac4cc9;})});}_0x30bf12=_['merge']({},_0x30bf12,_0x2f868a[_0xd2e8('0x42')]);return _0x1d4137[_0xd2e8('0x4c')](_0x30bf12);}})['then'](function(_0x354fda){if(_0x354fda){_0x57877f=_0x354fda['length'];if(!_0x2f868a[_0xd2e8('0x31')][_0xd2e8('0x37')](_0xd2e8('0x38'))){_0x30bf12[_0xd2e8('0x1f')]=qs[_0xd2e8('0x1f')](_0x2f868a['query'][_0xd2e8('0x1f')]);_0x30bf12['offset']=qs[_0xd2e8('0x1d')](_0x2f868a['query'][_0xd2e8('0x1d')]);}return _0x1d4137[_0xd2e8('0x4c')](_0x30bf12);}})[_0xd2e8('0x27')](function(_0x10bb10){if(_0x10bb10){return _0x10bb10?{'count':_0x57877f,'rows':_0x10bb10}:null;}})[_0xd2e8('0x27')](respondWithResult(_0x446b67,null))['catch'](handleError(_0x446b67,null));};exports[_0xd2e8('0x4f')]=function(_0xdbfa91,_0x323e1d,_0x27a331){var _0x1ea20d={};var _0x4fa55f={};var _0x18aa5e;var _0x403d4b;return db[_0xd2e8('0x2d')]['findOne']({'where':{'id':_0xdbfa91[_0xd2e8('0x47')]['id']}})['then'](handleEntityNotFound(_0x323e1d,null))[_0xd2e8('0x27')](function(_0x1fdf1d){if(_0x1fdf1d){_0x18aa5e=_0x1fdf1d;_0x4fa55f[_0xd2e8('0x30')]=_[_0xd2e8('0x32')](db[_0xd2e8('0x4e')]['rawAttributes']);_0x4fa55f[_0xd2e8('0x31')]=_['keys'](_0xdbfa91[_0xd2e8('0x31')]);_0x4fa55f[_0xd2e8('0x3c')]=_['intersection'](_0x4fa55f[_0xd2e8('0x30')],_0x4fa55f[_0xd2e8('0x31')]);_0x1ea20d[_0xd2e8('0x34')]=_[_0xd2e8('0x33')](_0x4fa55f[_0xd2e8('0x30')],qs[_0xd2e8('0x35')](_0xdbfa91[_0xd2e8('0x31')][_0xd2e8('0x35')]));_0x1ea20d[_0xd2e8('0x34')]=_0x1ea20d[_0xd2e8('0x34')][_0xd2e8('0x36')]?_0x1ea20d[_0xd2e8('0x34')]:_0x4fa55f[_0xd2e8('0x30')];_0x1ea20d[_0xd2e8('0x39')]=qs['sort'](_0xdbfa91[_0xd2e8('0x31')]['sort']);_0x1ea20d[_0xd2e8('0x3b')]=qs['filters'](_['pick'](_0xdbfa91['query'],_0x4fa55f['filters']));if(_0xdbfa91[_0xd2e8('0x31')]['filter']){_0x1ea20d['where']=_[_0xd2e8('0x3e')](_0x1ea20d[_0xd2e8('0x3b')],{'$or':_[_0xd2e8('0x3f')](_0x1ea20d[_0xd2e8('0x34')],function(_0x3ce228){var _0x163703={};_0x163703[_0x3ce228]={'$like':'%'+_0xdbfa91[_0xd2e8('0x31')][_0xd2e8('0x41')]+'%'};return _0x163703;})});}_0x1ea20d=_['merge']({},_0x1ea20d,_0xdbfa91['options']);return _0x18aa5e[_0xd2e8('0x4f')](_0x1ea20d);}})[_0xd2e8('0x27')](function(_0x2663bd){if(_0x2663bd){_0x403d4b=_0x2663bd['length'];if(!_0xdbfa91[_0xd2e8('0x31')][_0xd2e8('0x37')](_0xd2e8('0x38'))){_0x1ea20d[_0xd2e8('0x1f')]=qs['limit'](_0xdbfa91[_0xd2e8('0x31')][_0xd2e8('0x1f')]);_0x1ea20d['offset']=qs[_0xd2e8('0x1d')](_0xdbfa91[_0xd2e8('0x31')][_0xd2e8('0x1d')]);}return _0x18aa5e[_0xd2e8('0x4f')](_0x1ea20d);}})[_0xd2e8('0x27')](function(_0x370960){if(_0x370960){return _0x370960?{'count':_0x403d4b,'rows':_0x370960}:null;}})[_0xd2e8('0x27')](respondWithResult(_0x323e1d,null))[_0xd2e8('0x45')](handleError(_0x323e1d,null));};exports[_0xd2e8('0x50')]=function(_0x44bd78,_0x446c3c,_0x54de19){var _0x4b4bec={};var _0x27fa63={};var _0x298dc1;var _0x455b58;return db[_0xd2e8('0x2d')][_0xd2e8('0x4d')]({'where':{'id':_0x44bd78[_0xd2e8('0x47')]['id']}})[_0xd2e8('0x27')](handleEntityNotFound(_0x446c3c,null))['then'](function(_0xb2a746){if(_0xb2a746){_0x298dc1=_0xb2a746;_0x27fa63['model']=_[_0xd2e8('0x32')](db[_0xd2e8('0x4e')]['rawAttributes']);_0x27fa63[_0xd2e8('0x31')]=_[_0xd2e8('0x32')](_0x44bd78[_0xd2e8('0x31')]);_0x27fa63[_0xd2e8('0x3c')]=_[_0xd2e8('0x33')](_0x27fa63['model'],_0x27fa63[_0xd2e8('0x31')]);_0x4b4bec[_0xd2e8('0x34')]=_[_0xd2e8('0x33')](_0x27fa63[_0xd2e8('0x30')],qs[_0xd2e8('0x35')](_0x44bd78['query'][_0xd2e8('0x35')]));_0x4b4bec[_0xd2e8('0x34')]=_0x4b4bec['attributes'][_0xd2e8('0x36')]?_0x4b4bec[_0xd2e8('0x34')]:_0x27fa63[_0xd2e8('0x30')];_0x4b4bec[_0xd2e8('0x39')]=qs[_0xd2e8('0x3a')](_0x44bd78[_0xd2e8('0x31')][_0xd2e8('0x3a')]);_0x4b4bec['where']=qs[_0xd2e8('0x3c')](_['pick'](_0x44bd78[_0xd2e8('0x31')],_0x27fa63[_0xd2e8('0x3c')]));if(_0x44bd78[_0xd2e8('0x31')]['filter']){_0x4b4bec[_0xd2e8('0x3b')]=_[_0xd2e8('0x3e')](_0x4b4bec['where'],{'$or':_[_0xd2e8('0x3f')](_0x4b4bec[_0xd2e8('0x34')],function(_0x1610b8){var _0x5a8b86={};_0x5a8b86[_0x1610b8]={'$like':'%'+_0x44bd78[_0xd2e8('0x31')][_0xd2e8('0x41')]+'%'};return _0x5a8b86;})});}_0x4b4bec=_[_0xd2e8('0x3e')]({},_0x4b4bec,_0x44bd78[_0xd2e8('0x42')]);return _0x298dc1[_0xd2e8('0x50')](_0x4b4bec);}})[_0xd2e8('0x27')](function(_0x28bf04){if(_0x28bf04){_0x455b58=_0x28bf04['length'];if(!_0x44bd78['query'][_0xd2e8('0x37')](_0xd2e8('0x38'))){_0x4b4bec[_0xd2e8('0x1f')]=qs[_0xd2e8('0x1f')](_0x44bd78[_0xd2e8('0x31')][_0xd2e8('0x1f')]);_0x4b4bec['offset']=qs['offset'](_0x44bd78[_0xd2e8('0x31')][_0xd2e8('0x1d')]);}return _0x298dc1[_0xd2e8('0x50')](_0x4b4bec);}})['then'](function(_0x3f122d){if(_0x3f122d){return _0x3f122d?{'count':_0x455b58,'rows':_0x3f122d}:null;}})[_0xd2e8('0x27')](respondWithResult(_0x446c3c,null))['catch'](handleError(_0x446c3c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 38bb742..4c331ca 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 _0x232b=['ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x562617,_0x13a5fa){var _0x3a29d6=function(_0x5e5d4f){while(--_0x5e5d4f){_0x562617['push'](_0x562617['shift']());}};_0x3a29d6(++_0x13a5fa);}(_0x232b,0xe6));var _0xb232=function(_0x572382,_0x1cffda){_0x572382=_0x572382-0x0;var _0x2a1ddf=_0x232b[_0x572382];return _0x2a1ddf;};'use strict';var _=require(_0xb232('0x0'));var util=require('util');var logger=require(_0xb232('0x1'))(_0xb232('0x2'));var moment=require(_0xb232('0x3'));var BPromise=require(_0xb232('0x4'));var rp=require(_0xb232('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb232('0x6'));var attributes=require(_0xb232('0x7'));module[_0xb232('0x8')]=function(_0x480b9e,_0x4e9ab7){return _0x480b9e[_0xb232('0x9')](_0xb232('0xa'),attributes,{'tableName':_0xb232('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7426=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x7426,0xc5));var _0x6742=function(_0x43b052,_0x336cee){_0x43b052=_0x43b052-0x0;var _0x2dcb5a=_0x7426[_0x43b052];return _0x2dcb5a;};'use strict';var _=require(_0x6742('0x0'));var util=require(_0x6742('0x1'));var logger=require(_0x6742('0x2'))(_0x6742('0x3'));var moment=require(_0x6742('0x4'));var BPromise=require(_0x6742('0x5'));var rp=require(_0x6742('0x6'));var fs=require('fs');var path=require(_0x6742('0x7'));var rimraf=require(_0x6742('0x8'));var config=require(_0x6742('0x9'));var attributes=require(_0x6742('0xa'));module[_0x6742('0xb')]=function(_0x3c09c0,_0x27cb12){return _0x3c09c0[_0x6742('0xc')](_0x6742('0xd'),attributes,{'tableName':_0x6742('0xe'),'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 540480f..078327a 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 _0x1412=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1412,0x11b));var _0x2141=function(_0x4df549,_0x45ae17){_0x4df549=_0x4df549-0x0;var _0x153884=_0x1412[_0x4df549];return _0x153884;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2141('0x0'));var BPromise=require(_0x2141('0x1'));var rs=require(_0x2141('0x2'));var fs=require('fs');var Redis=require(_0x2141('0x3'));var db=require(_0x2141('0x4'))['db'];var utils=require(_0x2141('0x5'));var logger=require(_0x2141('0x6'))(_0x2141('0x7'));var config=require(_0x2141('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2141('0x9')][_0x2141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc71537,_0x112161,_0x415b7c){return new BPromise(function(_0x1878d6,_0x5f370d){return client[_0x2141('0xb')](_0xc71537,_0x415b7c)[_0x2141('0xc')](function(_0x495d67){logger['info'](_0x2141('0xd'),_0x112161,_0x2141('0xe'));logger[_0x2141('0xf')](_0x2141('0x10'),_0x112161,_0x2141('0xe'),JSON[_0x2141('0x11')](_0x495d67));if(_0x495d67[_0x2141('0x12')]){if(_0x495d67['error'][_0x2141('0x13')]===0x1f4){logger[_0x2141('0x12')](_0x2141('0xd'),_0x112161,_0x495d67['error'][_0x2141('0x14')]);return _0x5f370d(_0x495d67[_0x2141('0x12')][_0x2141('0x14')]);}logger['error'](_0x2141('0xd'),_0x112161,_0x495d67[_0x2141('0x12')][_0x2141('0x14')]);return _0x1878d6(_0x495d67['error'][_0x2141('0x14')]);}else{logger['info'](_0x2141('0xd'),_0x112161,'request\x20sent');_0x1878d6(_0x495d67[_0x2141('0x15')][_0x2141('0x14')]);}})[_0x2141('0x16')](function(_0x3339b5){logger[_0x2141('0x12')](_0x2141('0xd'),_0x112161,_0x3339b5);_0x5f370d(_0x3339b5);});});} \ No newline at end of file +var _0x8906=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZohoConfiguration,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x286411,_0x279f97){var _0x4b5e36=function(_0x216d80){while(--_0x216d80){_0x286411['push'](_0x286411['shift']());}};_0x4b5e36(++_0x279f97);}(_0x8906,0xe9));var _0x6890=function(_0x488491,_0x198326){_0x488491=_0x488491-0x0;var _0x176268=_0x8906[_0x488491];return _0x176268;};'use strict';var _=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var moment=require('moment');var BPromise=require(_0x6890('0x2'));var rs=require(_0x6890('0x3'));var fs=require('fs');var Redis=require(_0x6890('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6890('0x5'));var logger=require(_0x6890('0x6'))(_0x6890('0x7'));var config=require('../../config/environment');var jayson=require(_0x6890('0x8'));var client=jayson[_0x6890('0x9')][_0x6890('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bddf7,_0x239aa5,_0xd94c4c){return new BPromise(function(_0x2bd5a0,_0x34db04){return client[_0x6890('0xb')](_0x1bddf7,_0xd94c4c)[_0x6890('0xc')](function(_0x4f83d1){logger[_0x6890('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x239aa5,_0x6890('0xe'));logger[_0x6890('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x239aa5,_0x6890('0xe'),JSON[_0x6890('0x10')](_0x4f83d1));if(_0x4f83d1[_0x6890('0x11')]){if(_0x4f83d1[_0x6890('0x11')][_0x6890('0x12')]===0x1f4){logger[_0x6890('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x239aa5,_0x4f83d1[_0x6890('0x11')][_0x6890('0x13')]);return _0x34db04(_0x4f83d1[_0x6890('0x11')][_0x6890('0x13')]);}logger['error'](_0x6890('0x14'),_0x239aa5,_0x4f83d1[_0x6890('0x11')][_0x6890('0x13')]);return _0x2bd5a0(_0x4f83d1['error'][_0x6890('0x13')]);}else{logger[_0x6890('0xd')](_0x6890('0x14'),_0x239aa5,_0x6890('0xe'));_0x2bd5a0(_0x4f83d1['result'][_0x6890('0x13')]);}})[_0x6890('0x15')](function(_0x48812f){logger[_0x6890('0x11')](_0x6890('0x14'),_0x239aa5,_0x48812f);_0x34db04(_0x48812f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 02fccf4..fb94e04 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 _0x9e2d=['put','/:id','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','show','create'];(function(_0x51a5c8,_0x4ace6d){var _0x2805b4=function(_0x1254f3){while(--_0x1254f3){_0x51a5c8['push'](_0x51a5c8['shift']());}};_0x2805b4(++_0x4ace6d);}(_0x9e2d,0xc8));var _0xd9e2=function(_0x50db53,_0x3dba48){_0x50db53=_0x50db53-0x0;var _0x28a3c8=_0x9e2d[_0x50db53];return _0x28a3c8;};'use strict';var multer=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var path=require(_0xd9e2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd9e2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd9e2('0x4'));var config=require('../../config/environment');var controller=require(_0xd9e2('0x5'));router[_0xd9e2('0x6')]('/',auth[_0xd9e2('0x7')](),controller['index']);router[_0xd9e2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd9e2('0x8')]);router['post']('/',auth[_0xd9e2('0x7')](),controller[_0xd9e2('0x9')]);router[_0xd9e2('0xa')](_0xd9e2('0xb'),auth[_0xd9e2('0x7')](),controller['update']);router[_0xd9e2('0xc')]('/:id',auth[_0xd9e2('0x7')](),controller[_0xd9e2('0xd')]);module[_0xd9e2('0xe')]=router; \ No newline at end of file +var _0x467f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x467f,0x1e9));var _0xf467=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x467f[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0xf467('0x0'));var util=require(_0xf467('0x1'));var path=require(_0xf467('0x2'));var timeout=require(_0xf467('0x3'));var express=require(_0xf467('0x4'));var router=express[_0xf467('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf467('0x6'));var interaction=require(_0xf467('0x7'));var config=require(_0xf467('0x8'));var controller=require(_0xf467('0x9'));router[_0xf467('0xa')]('/',auth[_0xf467('0xb')](),controller[_0xf467('0xc')]);router[_0xf467('0xa')]('/:id',auth[_0xf467('0xb')](),controller['show']);router['post']('/',auth[_0xf467('0xb')](),controller[_0xf467('0xd')]);router[_0xf467('0xe')](_0xf467('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xf467('0x10')](_0xf467('0xf'),auth[_0xf467('0xb')](),controller[_0xf467('0x11')]);module[_0xf467('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index cb82569..32c8864 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 _0x18e4=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3160bf,_0x13f9c3){var _0x1b1664=function(_0x1c58f8){while(--_0x1c58f8){_0x3160bf['push'](_0x3160bf['shift']());}};_0x1b1664(++_0x13f9c3);}(_0x18e4,0x6d));var _0x418e=function(_0x1bb80c,_0x26d406){_0x1bb80c=_0x1bb80c-0x0;var _0x368f16=_0x18e4[_0x1bb80c];return _0x368f16;};'use strict';var Sequelize=require(_0x418e('0x0'));module[_0x418e('0x1')]={'type':{'type':Sequelize[_0x418e('0x2')](_0x418e('0x3'),_0x418e('0x4'),_0x418e('0x5'),'keyValue',_0x418e('0x6')),'defaultValue':_0x418e('0x3')},'content':{'type':Sequelize[_0x418e('0x7')]},'key':{'type':Sequelize[_0x418e('0x7')]},'keyType':{'type':Sequelize[_0x418e('0x2')](_0x418e('0x3'),'variable',_0x418e('0x5'))},'keyContent':{'type':Sequelize[_0x418e('0x7')]},'idField':{'type':Sequelize[_0x418e('0x7')]},'nameField':{'type':Sequelize[_0x418e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x418e('0x7')]}}; \ No newline at end of file +var _0xb873=['STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0xb873,0x1bc));var _0x3b87=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xb873[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0x3b87('0x0'));module['exports']={'type':{'type':Sequelize[_0x3b87('0x1')](_0x3b87('0x2'),'variable',_0x3b87('0x3'),_0x3b87('0x4'),_0x3b87('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3b87('0x6')]},'key':{'type':Sequelize[_0x3b87('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3b87('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x3b87('0x6')]},'idField':{'type':Sequelize[_0x3b87('0x6')]},'nameField':{'type':Sequelize[_0x3b87('0x6')]},'customField':{'type':Sequelize[_0x3b87('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b87('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 5ec1a89..857b23e 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 _0x6612=['keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','index','map','ZohoField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','show','params'];(function(_0x4fb308,_0x5c2fd7){var _0x2e7a23=function(_0x32e795){while(--_0x32e795){_0x4fb308['push'](_0x4fb308['shift']());}};_0x2e7a23(++_0x5c2fd7);}(_0x6612,0xcd));var _0x2661=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x6612[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0x2661('0x0'));var rimraf=require(_0x2661('0x1'));var zipdir=require(_0x2661('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2661('0x3'));var moment=require(_0x2661('0x4'));var BPromise=require(_0x2661('0x5'));var Mustache=require(_0x2661('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2661('0x7'));var csv=require(_0x2661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2661('0x9'));var squel=require(_0x2661('0xa'));var crypto=require(_0x2661('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2661('0x8'));var querystring=require('querystring');var Papa=require(_0x2661('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2661('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2661('0xe'));var logger=require(_0x2661('0xf'))('api');var utils=require(_0x2661('0x10'));var config=require(_0x2661('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426ff0,_0x116868){_0x116868=_0x116868||0xcc;return function(_0x3a39fd){if(_0x3a39fd){return _0x426ff0[_0x2661('0x12')](_0x116868);}return _0x426ff0[_0x2661('0x13')](_0x116868)[_0x2661('0x14')]();};}function respondWithResult(_0x3d07a4,_0x409340){_0x409340=_0x409340||0xc8;return function(_0x1d2422){if(_0x1d2422){return _0x3d07a4['status'](_0x409340)['json'](_0x1d2422);}};}function respondWithFilteredResult(_0x46ceff,_0x56f4ab){return function(_0x5dbd4a){if(_0x5dbd4a){var _0x381056=typeof _0x56f4ab[_0x2661('0x15')]===_0x2661('0x16')&&typeof _0x56f4ab[_0x2661('0x17')]===_0x2661('0x16');var _0xe80cac=_0x5dbd4a[_0x2661('0x18')];var _0x1198c1=_0x381056?0x0:_0x56f4ab[_0x2661('0x15')];var _0x39b6c4=_0x381056?_0x5dbd4a[_0x2661('0x18')]:_0x56f4ab[_0x2661('0x15')]+_0x56f4ab[_0x2661('0x17')];var _0x3517e3;if(_0x39b6c4>=_0xe80cac){_0x39b6c4=_0xe80cac;_0x3517e3=0xc8;}else{_0x3517e3=0xce;}_0x46ceff['status'](_0x3517e3);return _0x46ceff[_0x2661('0x19')](_0x2661('0x1a'),_0x1198c1+'-'+_0x39b6c4+'/'+_0xe80cac)[_0x2661('0x1b')](_0x5dbd4a);}return null;};}function patchUpdates(_0x3bbe51){return function(_0x2621e1){try{jsonpatch[_0x2661('0x1c')](_0x2621e1,_0x3bbe51,!![]);}catch(_0x108ecc){return BPromise['reject'](_0x108ecc);}return _0x2621e1[_0x2661('0x1d')]();};}function saveUpdates(_0x42d4a2,_0x6cb014){return function(_0x577e81){if(_0x577e81){return _0x577e81['update'](_0x42d4a2)[_0x2661('0x1e')](function(_0x30b8c7){return _0x30b8c7;});}return null;};}function removeEntity(_0x982cee,_0x16eab7){return function(_0x459e90){if(_0x459e90){return _0x459e90[_0x2661('0x1f')]()[_0x2661('0x1e')](function(){_0x982cee['status'](0xcc)[_0x2661('0x14')]();});}};}function handleEntityNotFound(_0x49255a,_0x4deb41){return function(_0x5a6885){if(!_0x5a6885){_0x49255a[_0x2661('0x12')](0x194);}return _0x5a6885;};}function handleError(_0x587cba,_0x4a78f4){_0x4a78f4=_0x4a78f4||0x1f4;return function(_0x512a46){logger[_0x2661('0x20')](_0x512a46['stack']);if(_0x512a46[_0x2661('0x21')]){delete _0x512a46[_0x2661('0x21')];}_0x587cba[_0x2661('0x13')](_0x4a78f4)[_0x2661('0x22')](_0x512a46);};}exports[_0x2661('0x23')]=function(_0x27a103,_0x31df4d){var _0x1c512c={},_0x1914ec={},_0xea03c={'count':0x0,'rows':[]};var _0x5c0d1b=_[_0x2661('0x24')](db[_0x2661('0x25')]['rawAttributes'],function(_0x929ad9){return{'name':_0x929ad9[_0x2661('0x26')],'type':_0x929ad9[_0x2661('0x27')][_0x2661('0x28')]};});_0x1914ec[_0x2661('0x29')]=_['map'](_0x5c0d1b,_0x2661('0x21'));_0x1914ec['query']=_['keys'](_0x27a103[_0x2661('0x2a')]);_0x1914ec[_0x2661('0x2b')]=_[_0x2661('0x2c')](_0x1914ec[_0x2661('0x29')],_0x1914ec[_0x2661('0x2a')]);_0x1c512c['attributes']=_[_0x2661('0x2c')](_0x1914ec[_0x2661('0x29')],qs[_0x2661('0x2d')](_0x27a103[_0x2661('0x2a')][_0x2661('0x2d')]));_0x1c512c[_0x2661('0x2e')]=_0x1c512c[_0x2661('0x2e')][_0x2661('0x2f')]?_0x1c512c['attributes']:_0x1914ec[_0x2661('0x29')];if(!_0x27a103[_0x2661('0x2a')][_0x2661('0x30')]('nolimit')){_0x1c512c['limit']=qs['limit'](_0x27a103[_0x2661('0x2a')][_0x2661('0x17')]);_0x1c512c['offset']=qs['offset'](_0x27a103[_0x2661('0x2a')]['offset']);}_0x1c512c['order']=qs[_0x2661('0x31')](_0x27a103['query'][_0x2661('0x31')]);_0x1c512c['where']=qs[_0x2661('0x2b')](_[_0x2661('0x32')](_0x27a103['query'],_0x1914ec[_0x2661('0x2b')]),_0x5c0d1b);if(_0x27a103[_0x2661('0x2a')][_0x2661('0x33')]){_0x1c512c['where']=_['merge'](_0x1c512c['where'],{'$or':_[_0x2661('0x24')](_0x5c0d1b,function(_0x4dc8ca){if(_0x4dc8ca[_0x2661('0x27')]!==_0x2661('0x34')){var _0x596c99={};_0x596c99[_0x4dc8ca[_0x2661('0x21')]]={'$like':'%'+_0x27a103[_0x2661('0x2a')]['filter']+'%'};return _0x596c99;}})});}_0x1c512c=_[_0x2661('0x35')]({},_0x1c512c,_0x27a103[_0x2661('0x36')]);var _0x415c68={'where':_0x1c512c[_0x2661('0x37')]};return db[_0x2661('0x25')]['count'](_0x415c68)[_0x2661('0x1e')](function(_0x363ca1){_0xea03c[_0x2661('0x18')]=_0x363ca1;if(_0x27a103[_0x2661('0x2a')][_0x2661('0x38')]){_0x1c512c[_0x2661('0x39')]=[{'all':!![]}];}return db[_0x2661('0x25')][_0x2661('0x3a')](_0x1c512c);})['then'](function(_0x1d007a){_0xea03c[_0x2661('0x3b')]=_0x1d007a;return _0xea03c;})[_0x2661('0x1e')](respondWithFilteredResult(_0x31df4d,_0x1c512c))[_0x2661('0x3c')](handleError(_0x31df4d,null));};exports[_0x2661('0x3d')]=function(_0x40706e,_0x37ca91){var _0xb14ea={'raw':!![],'where':{'id':_0x40706e[_0x2661('0x3e')]['id']}},_0x3c1369={};_0x3c1369[_0x2661('0x29')]=_[_0x2661('0x3f')](db[_0x2661('0x25')]['rawAttributes']);_0x3c1369[_0x2661('0x2a')]=_[_0x2661('0x3f')](_0x40706e['query']);_0x3c1369[_0x2661('0x2b')]=_['intersection'](_0x3c1369[_0x2661('0x29')],_0x3c1369[_0x2661('0x2a')]);_0xb14ea['attributes']=_['intersection'](_0x3c1369[_0x2661('0x29')],qs['fields'](_0x40706e[_0x2661('0x2a')][_0x2661('0x2d')]));_0xb14ea['attributes']=_0xb14ea[_0x2661('0x2e')][_0x2661('0x2f')]?_0xb14ea['attributes']:_0x3c1369[_0x2661('0x29')];if(_0x40706e[_0x2661('0x2a')][_0x2661('0x38')]){_0xb14ea[_0x2661('0x39')]=[{'all':!![]}];}_0xb14ea=_[_0x2661('0x35')]({},_0xb14ea,_0x40706e[_0x2661('0x36')]);return db[_0x2661('0x25')][_0x2661('0x40')](_0xb14ea)['then'](handleEntityNotFound(_0x37ca91,null))[_0x2661('0x1e')](respondWithResult(_0x37ca91,null))[_0x2661('0x3c')](handleError(_0x37ca91,null));};exports[_0x2661('0x41')]=function(_0x479837,_0x376714){return db[_0x2661('0x25')][_0x2661('0x41')](_0x479837['body'],{})[_0x2661('0x1e')](respondWithResult(_0x376714,0xc9))[_0x2661('0x3c')](handleError(_0x376714,null));};exports['update']=function(_0x46ac20,_0x5e990a){if(_0x46ac20[_0x2661('0x42')]['id']){delete _0x46ac20[_0x2661('0x42')]['id'];}return db[_0x2661('0x25')]['find']({'where':{'id':_0x46ac20[_0x2661('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e990a,null))[_0x2661('0x1e')](saveUpdates(_0x46ac20['body'],null))[_0x2661('0x1e')](respondWithResult(_0x5e990a,null))[_0x2661('0x3c')](handleError(_0x5e990a,null));};exports[_0x2661('0x1f')]=function(_0x26e001,_0x4c81ca){return db[_0x2661('0x25')]['find']({'where':{'id':_0x26e001[_0x2661('0x3e')]['id']}})[_0x2661('0x1e')](handleEntityNotFound(_0x4c81ca,null))[_0x2661('0x1e')](removeEntity(_0x4c81ca,null))[_0x2661('0x3c')](handleError(_0x4c81ca,null));}; \ No newline at end of file +var _0x9e8e=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','rawAttributes','keys','include'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x9e8e,0x16b));var _0xe9e8=function(_0x20e7df,_0x400e2a){_0x20e7df=_0x20e7df-0x0;var _0x99889f=_0x9e8e[_0x20e7df];return _0x99889f;};'use strict';var emlformat=require(_0xe9e8('0x0'));var rimraf=require(_0xe9e8('0x1'));var zipdir=require(_0xe9e8('0x2'));var jsonpatch=require(_0xe9e8('0x3'));var rp=require(_0xe9e8('0x4'));var moment=require(_0xe9e8('0x5'));var BPromise=require(_0xe9e8('0x6'));var Mustache=require('mustache');var util=require(_0xe9e8('0x7'));var path=require(_0xe9e8('0x8'));var sox=require(_0xe9e8('0x9'));var csv=require(_0xe9e8('0xa'));var ejs=require(_0xe9e8('0xb'));var fs=require('fs');var fs_extra=require(_0xe9e8('0xc'));var _=require(_0xe9e8('0xd'));var squel=require(_0xe9e8('0xe'));var crypto=require('crypto');var jsforce=require(_0xe9e8('0xf'));var deskjs=require(_0xe9e8('0x10'));var toCsv=require(_0xe9e8('0xa'));var querystring=require(_0xe9e8('0x11'));var Papa=require(_0xe9e8('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9e8('0x13'));var hardwareService=require(_0xe9e8('0x14'));var logger=require(_0xe9e8('0x15'))('api');var utils=require(_0xe9e8('0x16'));var config=require(_0xe9e8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9e8('0x18'))['db'];function respondWithStatusCode(_0x2c5ff5,_0x111b58){_0x111b58=_0x111b58||0xcc;return function(_0x485b06){if(_0x485b06){return _0x2c5ff5[_0xe9e8('0x19')](_0x111b58);}return _0x2c5ff5[_0xe9e8('0x1a')](_0x111b58)[_0xe9e8('0x1b')]();};}function respondWithResult(_0x3d78f1,_0x2b55f2){_0x2b55f2=_0x2b55f2||0xc8;return function(_0x460ccd){if(_0x460ccd){return _0x3d78f1['status'](_0x2b55f2)[_0xe9e8('0x1c')](_0x460ccd);}};}function respondWithFilteredResult(_0x548728,_0xe3096d){return function(_0x9d4644){if(_0x9d4644){var _0x1aefb9=typeof _0xe3096d[_0xe9e8('0x1d')]==='undefined'&&typeof _0xe3096d['limit']==='undefined';var _0x274c34=_0x9d4644[_0xe9e8('0x1e')];var _0xc4060c=_0x1aefb9?0x0:_0xe3096d['offset'];var _0xb525cf=_0x1aefb9?_0x9d4644[_0xe9e8('0x1e')]:_0xe3096d[_0xe9e8('0x1d')]+_0xe3096d['limit'];var _0x234e85;if(_0xb525cf>=_0x274c34){_0xb525cf=_0x274c34;_0x234e85=0xc8;}else{_0x234e85=0xce;}_0x548728['status'](_0x234e85);return _0x548728[_0xe9e8('0x1f')]('Content-Range',_0xc4060c+'-'+_0xb525cf+'/'+_0x274c34)[_0xe9e8('0x1c')](_0x9d4644);}return null;};}function patchUpdates(_0x93eca){return function(_0x5548ab){try{jsonpatch[_0xe9e8('0x20')](_0x5548ab,_0x93eca,!![]);}catch(_0x37f6e8){return BPromise[_0xe9e8('0x21')](_0x37f6e8);}return _0x5548ab[_0xe9e8('0x22')]();};}function saveUpdates(_0x5ad554,_0x1cb8fb){return function(_0x94121a){if(_0x94121a){return _0x94121a[_0xe9e8('0x23')](_0x5ad554)[_0xe9e8('0x24')](function(_0x2d98c3){return _0x2d98c3;});}return null;};}function removeEntity(_0x35b210,_0x246446){return function(_0xa22f2b){if(_0xa22f2b){return _0xa22f2b[_0xe9e8('0x25')]()['then'](function(){_0x35b210['status'](0xcc)[_0xe9e8('0x1b')]();});}};}function handleEntityNotFound(_0x46a4af,_0x247551){return function(_0x2039b8){if(!_0x2039b8){_0x46a4af[_0xe9e8('0x19')](0x194);}return _0x2039b8;};}function handleError(_0x45bee1,_0x440763){_0x440763=_0x440763||0x1f4;return function(_0x480ae9){logger[_0xe9e8('0x26')](_0x480ae9[_0xe9e8('0x27')]);if(_0x480ae9[_0xe9e8('0x28')]){delete _0x480ae9[_0xe9e8('0x28')];}_0x45bee1['status'](_0x440763)[_0xe9e8('0x29')](_0x480ae9);};}exports[_0xe9e8('0x2a')]=function(_0x6ce2cb,_0x3ab552){var _0x4a216b={},_0x41d335={},_0x568aaf={'count':0x0,'rows':[]};var _0x2b792f=_[_0xe9e8('0x2b')](db[_0xe9e8('0x2c')]['rawAttributes'],function(_0x139e89){return{'name':_0x139e89['fieldName'],'type':_0x139e89[_0xe9e8('0x2d')][_0xe9e8('0x2e')]};});_0x41d335[_0xe9e8('0x2f')]=_[_0xe9e8('0x2b')](_0x2b792f,_0xe9e8('0x28'));_0x41d335['query']=_['keys'](_0x6ce2cb[_0xe9e8('0x30')]);_0x41d335[_0xe9e8('0x31')]=_[_0xe9e8('0x32')](_0x41d335[_0xe9e8('0x2f')],_0x41d335['query']);_0x4a216b[_0xe9e8('0x33')]=_[_0xe9e8('0x32')](_0x41d335['model'],qs['fields'](_0x6ce2cb['query'][_0xe9e8('0x34')]));_0x4a216b[_0xe9e8('0x33')]=_0x4a216b[_0xe9e8('0x33')][_0xe9e8('0x35')]?_0x4a216b[_0xe9e8('0x33')]:_0x41d335[_0xe9e8('0x2f')];if(!_0x6ce2cb[_0xe9e8('0x30')]['hasOwnProperty'](_0xe9e8('0x36'))){_0x4a216b['limit']=qs[_0xe9e8('0x37')](_0x6ce2cb['query']['limit']);_0x4a216b[_0xe9e8('0x1d')]=qs[_0xe9e8('0x1d')](_0x6ce2cb[_0xe9e8('0x30')]['offset']);}_0x4a216b['order']=qs[_0xe9e8('0x38')](_0x6ce2cb[_0xe9e8('0x30')][_0xe9e8('0x38')]);_0x4a216b[_0xe9e8('0x39')]=qs[_0xe9e8('0x31')](_['pick'](_0x6ce2cb['query'],_0x41d335[_0xe9e8('0x31')]),_0x2b792f);if(_0x6ce2cb[_0xe9e8('0x30')][_0xe9e8('0x3a')]){_0x4a216b['where']=_[_0xe9e8('0x3b')](_0x4a216b[_0xe9e8('0x39')],{'$or':_[_0xe9e8('0x2b')](_0x2b792f,function(_0x53780d){if(_0x53780d[_0xe9e8('0x2d')]!==_0xe9e8('0x3c')){var _0x266cb4={};_0x266cb4[_0x53780d['name']]={'$like':'%'+_0x6ce2cb[_0xe9e8('0x30')]['filter']+'%'};return _0x266cb4;}})});}_0x4a216b=_[_0xe9e8('0x3b')]({},_0x4a216b,_0x6ce2cb[_0xe9e8('0x3d')]);var _0x1d286d={'where':_0x4a216b['where']};return db[_0xe9e8('0x2c')]['count'](_0x1d286d)[_0xe9e8('0x24')](function(_0x14e7d5){_0x568aaf[_0xe9e8('0x1e')]=_0x14e7d5;if(_0x6ce2cb[_0xe9e8('0x30')][_0xe9e8('0x3e')]){_0x4a216b['include']=[{'all':!![]}];}return db[_0xe9e8('0x2c')]['findAll'](_0x4a216b);})[_0xe9e8('0x24')](function(_0x79e2f7){_0x568aaf['rows']=_0x79e2f7;return _0x568aaf;})[_0xe9e8('0x24')](respondWithFilteredResult(_0x3ab552,_0x4a216b))[_0xe9e8('0x3f')](handleError(_0x3ab552,null));};exports[_0xe9e8('0x40')]=function(_0x49ac44,_0x5bf5cd){var _0x3315b0={'raw':!![],'where':{'id':_0x49ac44[_0xe9e8('0x41')]['id']}},_0x3874e5={};_0x3874e5['model']=_['keys'](db[_0xe9e8('0x2c')][_0xe9e8('0x42')]);_0x3874e5[_0xe9e8('0x30')]=_[_0xe9e8('0x43')](_0x49ac44[_0xe9e8('0x30')]);_0x3874e5[_0xe9e8('0x31')]=_[_0xe9e8('0x32')](_0x3874e5['model'],_0x3874e5[_0xe9e8('0x30')]);_0x3315b0[_0xe9e8('0x33')]=_['intersection'](_0x3874e5[_0xe9e8('0x2f')],qs['fields'](_0x49ac44[_0xe9e8('0x30')][_0xe9e8('0x34')]));_0x3315b0['attributes']=_0x3315b0['attributes']['length']?_0x3315b0[_0xe9e8('0x33')]:_0x3874e5[_0xe9e8('0x2f')];if(_0x49ac44['query'][_0xe9e8('0x3e')]){_0x3315b0[_0xe9e8('0x44')]=[{'all':!![]}];}_0x3315b0=_[_0xe9e8('0x3b')]({},_0x3315b0,_0x49ac44[_0xe9e8('0x3d')]);return db['ZohoField'][_0xe9e8('0x45')](_0x3315b0)[_0xe9e8('0x24')](handleEntityNotFound(_0x5bf5cd,null))['then'](respondWithResult(_0x5bf5cd,null))[_0xe9e8('0x3f')](handleError(_0x5bf5cd,null));};exports[_0xe9e8('0x46')]=function(_0x1e7fca,_0xa6f481){return db[_0xe9e8('0x2c')][_0xe9e8('0x46')](_0x1e7fca[_0xe9e8('0x47')],{})['then'](respondWithResult(_0xa6f481,0xc9))['catch'](handleError(_0xa6f481,null));};exports[_0xe9e8('0x23')]=function(_0x4c012e,_0x57282e){if(_0x4c012e[_0xe9e8('0x47')]['id']){delete _0x4c012e[_0xe9e8('0x47')]['id'];}return db[_0xe9e8('0x2c')]['find']({'where':{'id':_0x4c012e[_0xe9e8('0x41')]['id']}})[_0xe9e8('0x24')](handleEntityNotFound(_0x57282e,null))['then'](saveUpdates(_0x4c012e[_0xe9e8('0x47')],null))[_0xe9e8('0x24')](respondWithResult(_0x57282e,null))[_0xe9e8('0x3f')](handleError(_0x57282e,null));};exports[_0xe9e8('0x25')]=function(_0x2d6d0a,_0xa0d50c){return db[_0xe9e8('0x2c')]['find']({'where':{'id':_0x2d6d0a['params']['id']}})[_0xe9e8('0x24')](handleEntityNotFound(_0xa0d50c,null))['then'](removeEntity(_0xa0d50c,null))[_0xe9e8('0x3f')](handleError(_0xa0d50c,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 5fc6a4c..6ddb78c 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a85=['rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','idField','../../config/logger','api','moment','path'];(function(_0x1ad525,_0x379bd5){var _0x566732=function(_0x4fb952){while(--_0x4fb952){_0x1ad525['push'](_0x1ad525['shift']());}};_0x566732(++_0x379bd5);}(_0x1a85,0x178));var _0x51a8=function(_0x592cea,_0x4e72f1){_0x592cea=_0x592cea-0x0;var _0x1e9cc6=_0x1a85[_0x592cea];return _0x1e9cc6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intZohoField.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x51a8('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 880f321..ae74a35 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 _0x38eb=['client','http','then','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x39f017,_0x1e8fae){var _0x374124=function(_0x55721a){while(--_0x55721a){_0x39f017['push'](_0x39f017['shift']());}};_0x374124(++_0x1e8fae);}(_0x38eb,0x98));var _0xb38e=function(_0x5ca88a,_0x3b0939){_0x5ca88a=_0x5ca88a-0x0;var _0x1a8302=_0x38eb[_0x5ca88a];return _0x1a8302;};'use strict';var _=require(_0xb38e('0x0'));var util=require('util');var moment=require(_0xb38e('0x1'));var BPromise=require(_0xb38e('0x2'));var rs=require(_0xb38e('0x3'));var fs=require('fs');var Redis=require(_0xb38e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb38e('0x5'))(_0xb38e('0x6'));var config=require(_0xb38e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb38e('0x8')][_0xb38e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ec85b,_0x40fbfc,_0x255373){return new BPromise(function(_0x417670,_0x49d8d7){return client['request'](_0x2ec85b,_0x255373)[_0xb38e('0xa')](function(_0xa8fa2a){logger['info'](_0xb38e('0xb'),_0x40fbfc,'request\x20sent');logger['debug'](_0xb38e('0xc'),_0x40fbfc,_0xb38e('0xd'),JSON[_0xb38e('0xe')](_0xa8fa2a));if(_0xa8fa2a['error']){if(_0xa8fa2a['error']['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x40fbfc,_0xa8fa2a['error'][_0xb38e('0xf')]);return _0x49d8d7(_0xa8fa2a[_0xb38e('0x10')][_0xb38e('0xf')]);}logger[_0xb38e('0x10')](_0xb38e('0xb'),_0x40fbfc,_0xa8fa2a[_0xb38e('0x10')][_0xb38e('0xf')]);return _0x417670(_0xa8fa2a['error'][_0xb38e('0xf')]);}else{logger[_0xb38e('0x11')]('ZohoField,\x20%s,\x20%s',_0x40fbfc,'request\x20sent');_0x417670(_0xa8fa2a[_0xb38e('0x12')][_0xb38e('0xf')]);}})[_0xb38e('0x13')](function(_0x659c13){logger[_0xb38e('0x10')](_0xb38e('0xb'),_0x40fbfc,_0x659c13);_0x49d8d7(_0x659c13);});});} \ No newline at end of file +var _0x541d=['client','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x541d,0x16c));var _0xd541=function(_0x798059,_0x538444){_0x798059=_0x798059-0x0;var _0x34a70f=_0x541d[_0x798059];return _0x34a70f;};'use strict';var _=require(_0xd541('0x0'));var util=require(_0xd541('0x1'));var moment=require(_0xd541('0x2'));var BPromise=require(_0xd541('0x3'));var rs=require(_0xd541('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd541('0x5'))['db'];var utils=require(_0xd541('0x6'));var logger=require(_0xd541('0x7'))('rpc');var config=require(_0xd541('0x8'));var jayson=require(_0xd541('0x9'));var client=jayson[_0xd541('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcbdda5,_0x3fe467,_0x53fef7){return new BPromise(function(_0x38a232,_0x4af10a){return client[_0xd541('0xb')](_0xcbdda5,_0x53fef7)[_0xd541('0xc')](function(_0x2aa069){logger['info'](_0xd541('0xd'),_0x3fe467,_0xd541('0xe'));logger['debug'](_0xd541('0xf'),_0x3fe467,_0xd541('0xe'),JSON[_0xd541('0x10')](_0x2aa069));if(_0x2aa069[_0xd541('0x11')]){if(_0x2aa069[_0xd541('0x11')][_0xd541('0x12')]===0x1f4){logger[_0xd541('0x11')](_0xd541('0xd'),_0x3fe467,_0x2aa069['error']['message']);return _0x4af10a(_0x2aa069[_0xd541('0x11')][_0xd541('0x13')]);}logger[_0xd541('0x11')](_0xd541('0xd'),_0x3fe467,_0x2aa069[_0xd541('0x11')][_0xd541('0x13')]);return _0x38a232(_0x2aa069[_0xd541('0x11')][_0xd541('0x13')]);}else{logger[_0xd541('0x14')]('ZohoField,\x20%s,\x20%s',_0x3fe467,_0xd541('0xe'));_0x38a232(_0x2aa069['result'][_0xd541('0x13')]);}})[_0xd541('0x15')](function(_0x23b463){logger['error']('ZohoField,\x20%s,\x20%s',_0x3fe467,_0x23b463);_0x4af10a(_0x23b463);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 24fa916..cba928f 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x389fee,_0x18baf5){var _0x1511f6=function(_0x4c27f1){while(--_0x4c27f1){_0x389fee['push'](_0x389fee['shift']());}};_0x1511f6(++_0x18baf5);}(_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 diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9b9f0ad..bb935c1 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 _0x0ab9=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x3d2679,_0x113525){var _0x437d2b=function(_0x387f51){while(--_0x387f51){_0x3d2679['push'](_0x3d2679['shift']());}};_0x437d2b(++_0x113525);}(_0x0ab9,0x101));var _0x90ab=function(_0xf7fbce,_0xff8639){_0xf7fbce=_0xf7fbce-0x0;var _0x22ceeb=_0x0ab9[_0xf7fbce];return _0x22ceeb;};'use strict';var Sequelize=require('sequelize');module[_0x90ab('0x0')]={'name':{'type':Sequelize[_0x90ab('0x1')],'allowNull':![],'unique':_0x90ab('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x90ab('0x3')},'filename':{'type':Sequelize[_0x90ab('0x1')]},'path':{'type':Sequelize[_0x90ab('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x90ab('0x4')]},'active':{'type':Sequelize[_0x90ab('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x90ab('0x1')]},'logo':{'type':Sequelize[_0x90ab('0x1')]},'state':{'type':Sequelize[_0x90ab('0x1')],'unique':_0x90ab('0x6')},'description':{'type':Sequelize[_0x90ab('0x1')]},'title':{'type':Sequelize[_0x90ab('0x1')]},'remoteUri':{'type':Sequelize[_0x90ab('0x1')]},'link':{'type':Sequelize[_0x90ab('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xbb1e=['app.js','INTEGER','BOOLEAN','state','exports','STRING','unique_name_and_version'];(function(_0x3b16e2,_0xeb4b9f){var _0x10d529=function(_0x49a3fd){while(--_0x49a3fd){_0x3b16e2['push'](_0x3b16e2['shift']());}};_0x10d529(++_0xeb4b9f);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbb1e[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xebb1('0x0')]={'name':{'type':Sequelize[_0xebb1('0x1')],'allowNull':![],'unique':_0xebb1('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xebb1('0x2')},'main':{'type':Sequelize[_0xebb1('0x1')],'defaultValue':_0xebb1('0x3')},'filename':{'type':Sequelize[_0xebb1('0x1')]},'path':{'type':Sequelize[_0xebb1('0x1')]},'type':{'type':Sequelize[_0xebb1('0x1')]},'size':{'type':Sequelize[_0xebb1('0x4')]},'active':{'type':Sequelize[_0xebb1('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xebb1('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xebb1('0x1')],'unique':_0xebb1('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xebb1('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 521e59f..420d65d 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 _0x1883=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','params','catch','create','body','find','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'];(function(_0x339854,_0x5cae3f){var _0x4b10aa=function(_0x4b4a6d){while(--_0x4b4a6d){_0x339854['push'](_0x339854['shift']());}};_0x4b10aa(++_0x5cae3f);}(_0x1883,0xab));var _0x3188=function(_0x3f80c1,_0x3992df){_0x3f80c1=_0x3f80c1-0x0;var _0x47f48e=_0x1883[_0x3f80c1];return _0x47f48e;};'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['Integration'][_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['Integration'][_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')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));}; \ No newline at end of file +var _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x1967,0x173));var _0x7196=function(_0x9eb37c,_0x4fb5fd){_0x9eb37c=_0x9eb37c-0x0;var _0x41c124=_0x1967[_0x9eb37c];return _0x41c124;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 01d3a4d..b7775f9 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 _0xb913=['rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2a1c03,_0x4342f9){var _0x2a42d4=function(_0x5206d2){while(--_0x5206d2){_0x2a1c03['push'](_0x2a1c03['shift']());}};_0x2a42d4(++_0x4342f9);}(_0xb913,0x14a));var _0x3b91=function(_0x4e0e22,_0x1f505f){_0x4e0e22=_0x4e0e22-0x0;var _0x2c4d40=_0xb913[_0x4e0e22];return _0x2c4d40;};'use strict';var _=require(_0x3b91('0x0'));var util=require(_0x3b91('0x1'));var logger=require(_0x3b91('0x2'))(_0x3b91('0x3'));var moment=require(_0x3b91('0x4'));var BPromise=require(_0x3b91('0x5'));var rp=require(_0x3b91('0x6'));var fs=require('fs');var path=require(_0x3b91('0x7'));var rimraf=require(_0x3b91('0x8'));var config=require('../../config/environment');var attributes=require(_0x3b91('0x9'));module[_0x3b91('0xa')]=function(_0xec7da9,_0x257a4a){return _0xec7da9[_0x3b91('0xb')]('Integration',attributes,{'tableName':_0x3b91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9d1=['./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xc9d1,0x75));var _0x1c9d=function(_0x5b15a6,_0x1ad76b){_0x5b15a6=_0x5b15a6-0x0;var _0x287d3f=_0xc9d1[_0x5b15a6];return _0x287d3f;};'use strict';var _=require(_0x1c9d('0x0'));var util=require('util');var logger=require(_0x1c9d('0x1'))(_0x1c9d('0x2'));var moment=require(_0x1c9d('0x3'));var BPromise=require(_0x1c9d('0x4'));var rp=require(_0x1c9d('0x5'));var fs=require('fs');var path=require(_0x1c9d('0x6'));var rimraf=require(_0x1c9d('0x7'));var config=require(_0x1c9d('0x8'));var attributes=require(_0x1c9d('0x9'));module[_0x1c9d('0xa')]=function(_0x35707f,_0x483833){return _0x35707f[_0x1c9d('0xb')](_0x1c9d('0xc'),attributes,{'tableName':_0x1c9d('0xd'),'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 70df122..721c71b 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x458db5,_0x35f7dd){var _0x372a66=function(_0x326657){while(--_0x326657){_0x458db5['push'](_0x458db5['shift']());}};_0x372a66(++_0x35f7dd);}(_0x2542,0x169));var _0x2254=function(_0x53f6fc,_0x427e16){_0x53f6fc=_0x53f6fc-0x0;var _0x383715=_0x2542[_0x53f6fc];return _0x383715;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2635ea,_0x2f56f3){var _0x9fafad=function(_0x1273a6){while(--_0x1273a6){_0x2635ea['push'](_0x2635ea['shift']());}};_0x9fafad(++_0x2f56f3);}(_0x2ef3,0xba));var _0x32ef=function(_0x12f178,_0xffb337){_0x12f178=_0x12f178-0x0;var _0x53ee3f=_0x2ef3[_0x12f178];return _0x53ee3f;};'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')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index bd9a757..8725df5 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 _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x45c320,_0x5ecb5e){var _0x45b6c5=function(_0x429136){while(--_0x429136){_0x45c320['push'](_0x45c320['shift']());}};_0x45b6c5(++_0x5ecb5e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x128d3e,_0x5451cc){_0x128d3e=_0x128d3e-0x0;var _0x2582b6=_0xc2c7[_0x128d3e];return _0x2582b6;};'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('./integrationReport.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['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x31db2e,_0x7fb036){var _0x334eaf=function(_0xff66bd){while(--_0xff66bd){_0x31db2e['push'](_0x31db2e['shift']());}};_0x334eaf(++_0x7fb036);}(_0x57ca,0x108));var _0xa57c=function(_0x5e1cdd,_0x545776){_0x5e1cdd=_0x5e1cdd-0x0;var _0x5ef861=_0x57ca[_0x5e1cdd];return _0x5ef861;};'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('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f1e750b..733dd9d 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 _0x5f75=['ENUM','SENT','SENDING','FAILED','exports','STRING','DATE','BOOLEAN','INTEGER','TEXT'];(function(_0x2cdfac,_0x31c9a2){var _0x2256eb=function(_0x3a394e){while(--_0x3a394e){_0x2cdfac['push'](_0x2cdfac['shift']());}};_0x2256eb(++_0x31c9a2);}(_0x5f75,0x162));var _0x55f7=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5f75[_0x48d6a3];return _0x38bfa0;};'use strict';var Sequelize=require('sequelize');module[_0x55f7('0x0')]={'integration':{'type':Sequelize[_0x55f7('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x55f7('0x1')]},'ticketId':{'type':Sequelize[_0x55f7('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x55f7('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x55f7('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x55f7('0x1')]},'membername':{'type':Sequelize[_0x55f7('0x1')]},'agentcalledAt':{'type':Sequelize[_0x55f7('0x2')]},'agentconnectAt':{'type':Sequelize[_0x55f7('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x55f7('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x55f7('0x4')]},'reason':{'type':Sequelize[_0x55f7('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x55f7('0x2')]},'agentdump':{'type':Sequelize[_0x55f7('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x55f7('0x2')]},'lastevent':{'type':Sequelize[_0x55f7('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x55f7('0x4')]},'channelstatedesc':{'type':Sequelize[_0x55f7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x55f7('0x1')]},'language':{'type':Sequelize[_0x55f7('0x1')]},'accountcode':{'type':Sequelize[_0x55f7('0x1')]},'context':{'type':Sequelize[_0x55f7('0x1')]},'exten':{'type':Sequelize[_0x55f7('0x1')]},'priority':{'type':Sequelize[_0x55f7('0x1')]},'destchannel':{'type':Sequelize[_0x55f7('0x1')]},'destchannelstate':{'type':Sequelize[_0x55f7('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x55f7('0x1')]},'destcalleridnum':{'type':Sequelize[_0x55f7('0x1')]},'destcalleridname':{'type':Sequelize[_0x55f7('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x55f7('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x55f7('0x1')]},'destaccountcode':{'type':Sequelize[_0x55f7('0x1')]},'destcontext':{'type':Sequelize[_0x55f7('0x1')]},'destexten':{'type':Sequelize[_0x55f7('0x1')]},'destpriority':{'type':Sequelize[_0x55f7('0x1')]},'destuniqueid':{'type':Sequelize[_0x55f7('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x55f7('0x1')]},'subject':{'type':Sequelize[_0x55f7('0x1')]},'from':{'type':Sequelize[_0x55f7('0x1')]},'to':{'type':Sequelize[_0x55f7('0x1')]},'cc':{'type':Sequelize[_0x55f7('0x1')]},'attachment':{'type':Sequelize[_0x55f7('0x5')]},'html':{'type':Sequelize[_0x55f7('0x5')]},'text':{'type':Sequelize[_0x55f7('0x5')]},'status':{'type':Sequelize[_0x55f7('0x6')](_0x55f7('0x7'),_0x55f7('0x8'),'RECEIVED',_0x55f7('0x9'))},'url':{'type':Sequelize[_0x55f7('0x1')]},'app':{'type':Sequelize[_0x55f7('0x1')]},'appdata':{'type':Sequelize[_0x55f7('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfe85=['sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED'];(function(_0x57b4cc,_0x2ae50e){var _0x45ba9d=function(_0x4ab1b1){while(--_0x4ab1b1){_0x57b4cc['push'](_0x57b4cc['shift']());}};_0x45ba9d(++_0x2ae50e);}(_0xfe85,0x155));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5fe8('0x0'));module['exports']={'integration':{'type':Sequelize[_0x5fe8('0x1')]},'eventChannel':{'type':Sequelize[_0x5fe8('0x1')]},'exitStatus':{'type':Sequelize[_0x5fe8('0x1')]},'ticketId':{'type':Sequelize[_0x5fe8('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5fe8('0x1')]},'calleridnum':{'type':Sequelize[_0x5fe8('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5fe8('0x1')]},'interface':{'type':Sequelize[_0x5fe8('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x5fe8('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x5fe8('0x3')]},'agentcomplete':{'type':Sequelize[_0x5fe8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5fe8('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x5fe8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5fe8('0x3')]},'reason':{'type':Sequelize[_0x5fe8('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x5fe8('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5fe8('0x2')]},'agentdump':{'type':Sequelize[_0x5fe8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5fe8('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5fe8('0x1')]},'channelstate':{'type':Sequelize[_0x5fe8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5fe8('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5fe8('0x1')]},'connectedlinename':{'type':Sequelize[_0x5fe8('0x1')]},'language':{'type':Sequelize[_0x5fe8('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5fe8('0x1')]},'exten':{'type':Sequelize[_0x5fe8('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x5fe8('0x1')]},'destchannelstate':{'type':Sequelize[_0x5fe8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5fe8('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x5fe8('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x5fe8('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x5fe8('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x5fe8('0x1')]},'destpriority':{'type':Sequelize[_0x5fe8('0x1')]},'destuniqueid':{'type':Sequelize[_0x5fe8('0x1')]},'messageId':{'type':Sequelize[_0x5fe8('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x5fe8('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x5fe8('0x5')]},'html':{'type':Sequelize[_0x5fe8('0x5')]},'text':{'type':Sequelize[_0x5fe8('0x5')]},'status':{'type':Sequelize[_0x5fe8('0x6')](_0x5fe8('0x7'),_0x5fe8('0x8'),_0x5fe8('0x9'),_0x5fe8('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5fe8('0x1')]},'appdata':{'type':Sequelize[_0x5fe8('0x1')]},'projectId':{'type':Sequelize[_0x5fe8('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4c3cc48..0e473c2 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 _0x4835=['create','body','describe','rimraf','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find'];(function(_0x54fa13,_0x2a276b){var _0x4ec3f2=function(_0x177801){while(--_0x177801){_0x54fa13['push'](_0x54fa13['shift']());}};_0x4ec3f2(++_0x2a276b);}(_0x4835,0x18e));var _0x5483=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x4835[_0x4017b0];return _0x5ed4f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5483('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5483('0x1'));var rp=require(_0x5483('0x2'));var moment=require(_0x5483('0x3'));var BPromise=require(_0x5483('0x4'));var Mustache=require(_0x5483('0x5'));var util=require(_0x5483('0x6'));var path=require(_0x5483('0x7'));var sox=require(_0x5483('0x8'));var csv=require(_0x5483('0x9'));var ejs=require(_0x5483('0xa'));var fs=require('fs');var fs_extra=require(_0x5483('0xb'));var _=require(_0x5483('0xc'));var squel=require(_0x5483('0xd'));var crypto=require(_0x5483('0xe'));var jsforce=require(_0x5483('0xf'));var deskjs=require(_0x5483('0x10'));var toCsv=require(_0x5483('0x9'));var querystring=require(_0x5483('0x11'));var Papa=require(_0x5483('0x12'));var Redis=require(_0x5483('0x13'));var authService=require(_0x5483('0x14'));var qs=require(_0x5483('0x15'));var as=require(_0x5483('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5483('0x17'))(_0x5483('0x18'));var utils=require(_0x5483('0x19'));var config=require(_0x5483('0x1a'));var licenseUtil=require(_0x5483('0x1b'));var db=require(_0x5483('0x1c'))['db'];function respondWithStatusCode(_0x40ae38,_0x3b4d86){_0x3b4d86=_0x3b4d86||0xcc;return function(_0x629384){if(_0x629384){return _0x40ae38[_0x5483('0x1d')](_0x3b4d86);}return _0x40ae38[_0x5483('0x1e')](_0x3b4d86)['end']();};}function respondWithResult(_0x2e8558,_0x9a7965){_0x9a7965=_0x9a7965||0xc8;return function(_0x5447a4){if(_0x5447a4){return _0x2e8558[_0x5483('0x1e')](_0x9a7965)[_0x5483('0x1f')](_0x5447a4);}};}function respondWithFilteredResult(_0x5c178f,_0xad8b0b){return function(_0x3e918f){if(_0x3e918f){var _0x3cbedc=typeof _0xad8b0b[_0x5483('0x20')]===_0x5483('0x21')&&typeof _0xad8b0b[_0x5483('0x22')]==='undefined';var _0x4a29c2=_0x3e918f[_0x5483('0x23')];var _0x1af23a=_0x3cbedc?0x0:_0xad8b0b['offset'];var _0x53061b=_0x3cbedc?_0x3e918f[_0x5483('0x23')]:_0xad8b0b[_0x5483('0x20')]+_0xad8b0b[_0x5483('0x22')];var _0x46ed97;if(_0x53061b>=_0x4a29c2){_0x53061b=_0x4a29c2;_0x46ed97=0xc8;}else{_0x46ed97=0xce;}_0x5c178f[_0x5483('0x1e')](_0x46ed97);return _0x5c178f['set'](_0x5483('0x24'),_0x1af23a+'-'+_0x53061b+'/'+_0x4a29c2)[_0x5483('0x1f')](_0x3e918f);}return null;};}function patchUpdates(_0x393988){return function(_0x2c9b02){try{jsonpatch['apply'](_0x2c9b02,_0x393988,!![]);}catch(_0xc97e00){return BPromise[_0x5483('0x25')](_0xc97e00);}return _0x2c9b02[_0x5483('0x26')]();};}function saveUpdates(_0x4943b7,_0xdd0d4e){return function(_0x511d53){if(_0x511d53){return _0x511d53[_0x5483('0x27')](_0x4943b7)[_0x5483('0x28')](function(_0x5c2369){return _0x5c2369;});}return null;};}function removeEntity(_0x439443,_0x85134a){return function(_0x3d19fd){if(_0x3d19fd){return _0x3d19fd[_0x5483('0x29')]()['then'](function(){_0x439443[_0x5483('0x1e')](0xcc)[_0x5483('0x2a')]();});}};}function handleEntityNotFound(_0xc3900d,_0x12ff43){return function(_0x4c5865){if(!_0x4c5865){_0xc3900d['sendStatus'](0x194);}return _0x4c5865;};}function handleError(_0x2f5585,_0x5610cf){_0x5610cf=_0x5610cf||0x1f4;return function(_0x48b925){logger[_0x5483('0x2b')](_0x48b925['stack']);if(_0x48b925['name']){delete _0x48b925['name'];}_0x2f5585[_0x5483('0x1e')](_0x5610cf)[_0x5483('0x2c')](_0x48b925);};}exports[_0x5483('0x2d')]=function(_0x2c3554,_0x13e519){var _0x194bbb={},_0x187f69={},_0xac4b46={'count':0x0,'rows':[]};var _0x38b7df=_[_0x5483('0x2e')](db[_0x5483('0x2f')][_0x5483('0x30')],function(_0x5edb9f){return{'name':_0x5edb9f[_0x5483('0x31')],'type':_0x5edb9f[_0x5483('0x32')][_0x5483('0x33')]};});_0x187f69[_0x5483('0x34')]=_[_0x5483('0x2e')](_0x38b7df,_0x5483('0x35'));_0x187f69[_0x5483('0x36')]=_[_0x5483('0x37')](_0x2c3554[_0x5483('0x36')]);_0x187f69['filters']=_[_0x5483('0x38')](_0x187f69[_0x5483('0x34')],_0x187f69[_0x5483('0x36')]);_0x194bbb[_0x5483('0x39')]=_[_0x5483('0x38')](_0x187f69['model'],qs[_0x5483('0x3a')](_0x2c3554[_0x5483('0x36')][_0x5483('0x3a')]));_0x194bbb[_0x5483('0x39')]=_0x194bbb[_0x5483('0x39')]['length']?_0x194bbb[_0x5483('0x39')]:_0x187f69[_0x5483('0x34')];if(!_0x2c3554[_0x5483('0x36')][_0x5483('0x3b')](_0x5483('0x3c'))){_0x194bbb[_0x5483('0x22')]=qs['limit'](_0x2c3554[_0x5483('0x36')]['limit']);_0x194bbb[_0x5483('0x20')]=qs[_0x5483('0x20')](_0x2c3554[_0x5483('0x36')][_0x5483('0x20')]);}_0x194bbb[_0x5483('0x3d')]=qs[_0x5483('0x3e')](_0x2c3554['query'][_0x5483('0x3e')]);_0x194bbb[_0x5483('0x3f')]=qs[_0x5483('0x40')](_['pick'](_0x2c3554[_0x5483('0x36')],_0x187f69[_0x5483('0x40')]),_0x38b7df);if(_0x2c3554[_0x5483('0x36')][_0x5483('0x41')]){_0x194bbb['where']=_[_0x5483('0x42')](_0x194bbb[_0x5483('0x3f')],{'$or':_[_0x5483('0x2e')](_0x38b7df,function(_0x4bd8d1){if(_0x4bd8d1[_0x5483('0x32')]!==_0x5483('0x43')){var _0x1e4232={};_0x1e4232[_0x4bd8d1['name']]={'$like':'%'+_0x2c3554[_0x5483('0x36')][_0x5483('0x41')]+'%'};return _0x1e4232;}})});}_0x194bbb=_[_0x5483('0x42')]({},_0x194bbb,_0x2c3554[_0x5483('0x44')]);var _0x25f074={'where':_0x194bbb['where']};return db['IntegrationReport'][_0x5483('0x23')](_0x25f074)[_0x5483('0x28')](function(_0x1a9f7f){_0xac4b46[_0x5483('0x23')]=_0x1a9f7f;if(_0x2c3554[_0x5483('0x36')]['includeAll']){_0x194bbb[_0x5483('0x45')]=[{'all':!![]}];}return db[_0x5483('0x2f')][_0x5483('0x46')](_0x194bbb);})['then'](function(_0x580bef){_0xac4b46[_0x5483('0x47')]=_0x580bef;return _0xac4b46;})[_0x5483('0x28')](respondWithFilteredResult(_0x13e519,_0x194bbb))[_0x5483('0x48')](handleError(_0x13e519,null));};exports[_0x5483('0x49')]=function(_0x48372f,_0x102e34){var _0x3769ee={'raw':![],'where':{'id':_0x48372f[_0x5483('0x4a')]['id']}},_0x4b1d8c={};_0x4b1d8c['model']=_[_0x5483('0x37')](db['IntegrationReport'][_0x5483('0x30')]);_0x4b1d8c['query']=_['keys'](_0x48372f['query']);_0x4b1d8c['filters']=_[_0x5483('0x38')](_0x4b1d8c['model'],_0x4b1d8c[_0x5483('0x36')]);_0x3769ee[_0x5483('0x39')]=_[_0x5483('0x38')](_0x4b1d8c[_0x5483('0x34')],qs[_0x5483('0x3a')](_0x48372f[_0x5483('0x36')][_0x5483('0x3a')]));_0x3769ee['attributes']=_0x3769ee[_0x5483('0x39')]['length']?_0x3769ee[_0x5483('0x39')]:_0x4b1d8c[_0x5483('0x34')];if(_0x48372f[_0x5483('0x36')]['includeAll']){_0x3769ee[_0x5483('0x45')]=[{'all':!![]}];}_0x3769ee=_['merge']({},_0x3769ee,_0x48372f[_0x5483('0x44')]);return db[_0x5483('0x2f')][_0x5483('0x4b')](_0x3769ee)[_0x5483('0x28')](handleEntityNotFound(_0x102e34,null))[_0x5483('0x28')](respondWithResult(_0x102e34,null))[_0x5483('0x48')](handleError(_0x102e34,null));};exports[_0x5483('0x4c')]=function(_0x2f629b,_0x121f7a){return db[_0x5483('0x2f')][_0x5483('0x4c')](_0x2f629b[_0x5483('0x4d')],{})[_0x5483('0x28')](respondWithResult(_0x121f7a,0xc9))[_0x5483('0x48')](handleError(_0x121f7a,null));};exports['update']=function(_0x34784f,_0x52333a){if(_0x34784f['body']['id']){delete _0x34784f['body']['id'];}return db['IntegrationReport'][_0x5483('0x4b')]({'where':{'id':_0x34784f[_0x5483('0x4a')]['id']}})[_0x5483('0x28')](handleEntityNotFound(_0x52333a,null))[_0x5483('0x28')](saveUpdates(_0x34784f[_0x5483('0x4d')],null))['then'](respondWithResult(_0x52333a,null))[_0x5483('0x48')](handleError(_0x52333a,null));};exports[_0x5483('0x29')]=function(_0x3b3a37,_0x56de76){return db['IntegrationReport'][_0x5483('0x4b')]({'where':{'id':_0x3b3a37[_0x5483('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56de76,null))[_0x5483('0x28')](removeEntity(_0x56de76,null))[_0x5483('0x48')](handleError(_0x56de76,null));};exports[_0x5483('0x4e')]=function(_0x20050a,_0x52f1e6){return db[_0x5483('0x2f')][_0x5483('0x4e')]()[_0x5483('0x28')](respondWithResult(_0x52f1e6,null))[_0x5483('0x48')](handleError(_0x52f1e6,null));}; \ No newline at end of file +var _0x6744=['Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','fieldName','key','model','map','query','keys','filters','attributes','fields','length','nolimit','sort','where','merge','type','options','IntegrationReport','findAll','rows','catch','show','rawAttributes','intersection','includeAll','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x31d040,_0x46742e){var _0xf4812a=function(_0x3e1d93){while(--_0x3e1d93){_0x31d040['push'](_0x31d040['shift']());}};_0xf4812a(++_0x46742e);}(_0x6744,0x151));var _0x4674=function(_0x1d444c,_0x5c8b04){_0x1d444c=_0x1d444c-0x0;var _0xba2af7=_0x6744[_0x1d444c];return _0xba2af7;};'use strict';var emlformat=require(_0x4674('0x0'));var rimraf=require(_0x4674('0x1'));var zipdir=require(_0x4674('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4674('0x3'));var moment=require(_0x4674('0x4'));var BPromise=require(_0x4674('0x5'));var Mustache=require(_0x4674('0x6'));var util=require(_0x4674('0x7'));var path=require('path');var sox=require(_0x4674('0x8'));var csv=require(_0x4674('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4674('0xa'));var _=require(_0x4674('0xb'));var squel=require(_0x4674('0xc'));var crypto=require(_0x4674('0xd'));var jsforce=require(_0x4674('0xe'));var deskjs=require(_0x4674('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4674('0x10'));var Papa=require(_0x4674('0x11'));var Redis=require('ioredis');var authService=require(_0x4674('0x12'));var qs=require(_0x4674('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4674('0x14'))('api');var utils=require(_0x4674('0x15'));var config=require(_0x4674('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4674('0x17'))['db'];function respondWithStatusCode(_0x4d0c74,_0x4aa2c9){_0x4aa2c9=_0x4aa2c9||0xcc;return function(_0x59708b){if(_0x59708b){return _0x4d0c74[_0x4674('0x18')](_0x4aa2c9);}return _0x4d0c74['status'](_0x4aa2c9)[_0x4674('0x19')]();};}function respondWithResult(_0x542d5f,_0x8fd000){_0x8fd000=_0x8fd000||0xc8;return function(_0x94717a){if(_0x94717a){return _0x542d5f[_0x4674('0x1a')](_0x8fd000)[_0x4674('0x1b')](_0x94717a);}};}function respondWithFilteredResult(_0x2c3d10,_0x5e461e){return function(_0xa825a4){if(_0xa825a4){var _0x56b8bb=typeof _0x5e461e[_0x4674('0x1c')]===_0x4674('0x1d')&&typeof _0x5e461e[_0x4674('0x1e')]==='undefined';var _0x4f6b2a=_0xa825a4['count'];var _0x14b56e=_0x56b8bb?0x0:_0x5e461e[_0x4674('0x1c')];var _0x4dba6c=_0x56b8bb?_0xa825a4[_0x4674('0x1f')]:_0x5e461e['offset']+_0x5e461e[_0x4674('0x1e')];var _0x293009;if(_0x4dba6c>=_0x4f6b2a){_0x4dba6c=_0x4f6b2a;_0x293009=0xc8;}else{_0x293009=0xce;}_0x2c3d10[_0x4674('0x1a')](_0x293009);return _0x2c3d10[_0x4674('0x20')](_0x4674('0x21'),_0x14b56e+'-'+_0x4dba6c+'/'+_0x4f6b2a)[_0x4674('0x1b')](_0xa825a4);}return null;};}function patchUpdates(_0x3080ce){return function(_0x5e2e0b){try{jsonpatch[_0x4674('0x22')](_0x5e2e0b,_0x3080ce,!![]);}catch(_0x548e3c){return BPromise[_0x4674('0x23')](_0x548e3c);}return _0x5e2e0b[_0x4674('0x24')]();};}function saveUpdates(_0x1f4ac3,_0x481d78){return function(_0xfa23c6){if(_0xfa23c6){return _0xfa23c6[_0x4674('0x25')](_0x1f4ac3)[_0x4674('0x26')](function(_0x44dc56){return _0x44dc56;});}return null;};}function removeEntity(_0xdfdba9,_0x364bd4){return function(_0x2cd727){if(_0x2cd727){return _0x2cd727[_0x4674('0x27')]()['then'](function(){_0xdfdba9[_0x4674('0x1a')](0xcc)[_0x4674('0x19')]();});}};}function handleEntityNotFound(_0x4f4254,_0x436649){return function(_0x512443){if(!_0x512443){_0x4f4254[_0x4674('0x18')](0x194);}return _0x512443;};}function handleError(_0x5cf051,_0x252a69){_0x252a69=_0x252a69||0x1f4;return function(_0xf79954){logger['error'](_0xf79954[_0x4674('0x28')]);if(_0xf79954[_0x4674('0x29')]){delete _0xf79954[_0x4674('0x29')];}_0x5cf051[_0x4674('0x1a')](_0x252a69)[_0x4674('0x2a')](_0xf79954);};}exports[_0x4674('0x2b')]=function(_0x2f562e,_0x26232c){var _0x5209c9={},_0x23b4d2={},_0x2d257f={'count':0x0,'rows':[]};var _0x5cfc9c=_['map'](db['IntegrationReport']['rawAttributes'],function(_0xc45201){return{'name':_0xc45201[_0x4674('0x2c')],'type':_0xc45201['type'][_0x4674('0x2d')]};});_0x23b4d2[_0x4674('0x2e')]=_[_0x4674('0x2f')](_0x5cfc9c,_0x4674('0x29'));_0x23b4d2[_0x4674('0x30')]=_[_0x4674('0x31')](_0x2f562e[_0x4674('0x30')]);_0x23b4d2[_0x4674('0x32')]=_['intersection'](_0x23b4d2[_0x4674('0x2e')],_0x23b4d2['query']);_0x5209c9[_0x4674('0x33')]=_['intersection'](_0x23b4d2[_0x4674('0x2e')],qs[_0x4674('0x34')](_0x2f562e[_0x4674('0x30')]['fields']));_0x5209c9[_0x4674('0x33')]=_0x5209c9['attributes'][_0x4674('0x35')]?_0x5209c9[_0x4674('0x33')]:_0x23b4d2[_0x4674('0x2e')];if(!_0x2f562e[_0x4674('0x30')]['hasOwnProperty'](_0x4674('0x36'))){_0x5209c9[_0x4674('0x1e')]=qs[_0x4674('0x1e')](_0x2f562e[_0x4674('0x30')][_0x4674('0x1e')]);_0x5209c9[_0x4674('0x1c')]=qs[_0x4674('0x1c')](_0x2f562e[_0x4674('0x30')][_0x4674('0x1c')]);}_0x5209c9['order']=qs[_0x4674('0x37')](_0x2f562e[_0x4674('0x30')][_0x4674('0x37')]);_0x5209c9[_0x4674('0x38')]=qs[_0x4674('0x32')](_['pick'](_0x2f562e[_0x4674('0x30')],_0x23b4d2[_0x4674('0x32')]),_0x5cfc9c);if(_0x2f562e[_0x4674('0x30')]['filter']){_0x5209c9['where']=_[_0x4674('0x39')](_0x5209c9[_0x4674('0x38')],{'$or':_[_0x4674('0x2f')](_0x5cfc9c,function(_0x320454){if(_0x320454[_0x4674('0x3a')]!=='VIRTUAL'){var _0x9187a6={};_0x9187a6[_0x320454[_0x4674('0x29')]]={'$like':'%'+_0x2f562e[_0x4674('0x30')]['filter']+'%'};return _0x9187a6;}})});}_0x5209c9=_[_0x4674('0x39')]({},_0x5209c9,_0x2f562e[_0x4674('0x3b')]);var _0x407275={'where':_0x5209c9['where']};return db[_0x4674('0x3c')][_0x4674('0x1f')](_0x407275)[_0x4674('0x26')](function(_0x26e05e){_0x2d257f[_0x4674('0x1f')]=_0x26e05e;if(_0x2f562e[_0x4674('0x30')]['includeAll']){_0x5209c9['include']=[{'all':!![]}];}return db[_0x4674('0x3c')][_0x4674('0x3d')](_0x5209c9);})[_0x4674('0x26')](function(_0x636a6e){_0x2d257f[_0x4674('0x3e')]=_0x636a6e;return _0x2d257f;})[_0x4674('0x26')](respondWithFilteredResult(_0x26232c,_0x5209c9))[_0x4674('0x3f')](handleError(_0x26232c,null));};exports[_0x4674('0x40')]=function(_0x317cd9,_0x5b7f40){var _0xe10707={'raw':![],'where':{'id':_0x317cd9['params']['id']}},_0x271eb5={};_0x271eb5[_0x4674('0x2e')]=_[_0x4674('0x31')](db['IntegrationReport'][_0x4674('0x41')]);_0x271eb5[_0x4674('0x30')]=_['keys'](_0x317cd9[_0x4674('0x30')]);_0x271eb5[_0x4674('0x32')]=_['intersection'](_0x271eb5[_0x4674('0x2e')],_0x271eb5[_0x4674('0x30')]);_0xe10707[_0x4674('0x33')]=_[_0x4674('0x42')](_0x271eb5[_0x4674('0x2e')],qs[_0x4674('0x34')](_0x317cd9['query'][_0x4674('0x34')]));_0xe10707[_0x4674('0x33')]=_0xe10707['attributes'][_0x4674('0x35')]?_0xe10707[_0x4674('0x33')]:_0x271eb5[_0x4674('0x2e')];if(_0x317cd9['query'][_0x4674('0x43')]){_0xe10707[_0x4674('0x44')]=[{'all':!![]}];}_0xe10707=_['merge']({},_0xe10707,_0x317cd9[_0x4674('0x3b')]);return db[_0x4674('0x3c')]['find'](_0xe10707)[_0x4674('0x26')](handleEntityNotFound(_0x5b7f40,null))['then'](respondWithResult(_0x5b7f40,null))['catch'](handleError(_0x5b7f40,null));};exports[_0x4674('0x45')]=function(_0x31df1b,_0x1629bf){return db[_0x4674('0x3c')]['create'](_0x31df1b[_0x4674('0x46')],{})[_0x4674('0x26')](respondWithResult(_0x1629bf,0xc9))[_0x4674('0x3f')](handleError(_0x1629bf,null));};exports['update']=function(_0x38440c,_0x123161){if(_0x38440c[_0x4674('0x46')]['id']){delete _0x38440c[_0x4674('0x46')]['id'];}return db['IntegrationReport'][_0x4674('0x47')]({'where':{'id':_0x38440c[_0x4674('0x48')]['id']}})['then'](handleEntityNotFound(_0x123161,null))[_0x4674('0x26')](saveUpdates(_0x38440c[_0x4674('0x46')],null))[_0x4674('0x26')](respondWithResult(_0x123161,null))[_0x4674('0x3f')](handleError(_0x123161,null));};exports[_0x4674('0x27')]=function(_0x1a5b5b,_0x3e4df8){return db[_0x4674('0x3c')]['find']({'where':{'id':_0x1a5b5b[_0x4674('0x48')]['id']}})[_0x4674('0x26')](handleEntityNotFound(_0x3e4df8,null))['then'](removeEntity(_0x3e4df8,null))[_0x4674('0x3f')](handleError(_0x3e4df8,null));};exports[_0x4674('0x49')]=function(_0x472b8a,_0x29eb37){return db[_0x4674('0x3c')][_0x4674('0x49')]()['then'](respondWithResult(_0x29eb37,null))['catch'](handleError(_0x29eb37,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index dd1ac73..2a3ad2d 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 _0x63ea=['path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12271d,_0x5dd2b8){var _0x213831=function(_0x554d08){while(--_0x554d08){_0x12271d['push'](_0x12271d['shift']());}};_0x213831(++_0x5dd2b8);}(_0x63ea,0xa2));var _0xa63e=function(_0x5d3780,_0x3fb2ff){_0x5d3780=_0x5d3780-0x0;var _0x5b4e25=_0x63ea[_0x5d3780];return _0x5b4e25;};'use strict';var _=require(_0xa63e('0x0'));var util=require(_0xa63e('0x1'));var logger=require(_0xa63e('0x2'))(_0xa63e('0x3'));var moment=require(_0xa63e('0x4'));var BPromise=require(_0xa63e('0x5'));var rp=require(_0xa63e('0x6'));var fs=require('fs');var path=require(_0xa63e('0x7'));var rimraf=require(_0xa63e('0x8'));var config=require(_0xa63e('0x9'));var attributes=require(_0xa63e('0xa'));module['exports']=function(_0x4106df,_0x21ac53){return _0x4106df[_0xa63e('0xb')](_0xa63e('0xc'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb6=['report_integration','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport'];(function(_0x3ccb82,_0x36d5bf){var _0x42354f=function(_0x113561){while(--_0x113561){_0x3ccb82['push'](_0x3ccb82['shift']());}};_0x42354f(++_0x36d5bf);}(_0x9cb6,0x145));var _0x69cb=function(_0x1962d1,_0x5cf69b){_0x1962d1=_0x1962d1-0x0;var _0x19ad66=_0x9cb6[_0x1962d1];return _0x19ad66;};'use strict';var _=require(_0x69cb('0x0'));var util=require(_0x69cb('0x1'));var logger=require(_0x69cb('0x2'))(_0x69cb('0x3'));var moment=require(_0x69cb('0x4'));var BPromise=require('bluebird');var rp=require(_0x69cb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x69cb('0x6'));var config=require(_0x69cb('0x7'));var attributes=require(_0x69cb('0x8'));module[_0x69cb('0x9')]=function(_0xdbbe3,_0x5442de){return _0xdbbe3['define'](_0x69cb('0xa'),attributes,{'tableName':_0x69cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 7da4ea7..ef91ffc 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 _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x136c8d,_0x21bd05){var _0xef24d0=function(_0xbc19f){while(--_0xbc19f){_0x136c8d['push'](_0x136c8d['shift']());}};_0xef24d0(++_0x21bd05);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x76af14,_0x308072){_0x76af14=_0x76af14-0x0;var _0xb0772a=_0xc6ac[_0x76af14];return _0xb0772a;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5bb710,_0x2f29f4){var _0x40ed91=function(_0x111bcb){while(--_0x111bcb){_0x5bb710['push'](_0x5bb710['shift']());}};_0x40ed91(++_0x2f29f4);}(_0x31f0,0xb7));var _0x031f=function(_0xb87a44,_0x50a9b8){_0xb87a44=_0xb87a44-0x0;var _0x8da8bb=_0x31f0[_0xb87a44];return _0x8da8bb;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 828bd1a..63ef783 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 _0x908e=['getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals'];(function(_0x547035,_0x421a9d){var _0x4d55cd=function(_0x3fe2bb){while(--_0x3fe2bb){_0x547035['push'](_0x547035['shift']());}};_0x4d55cd(++_0x421a9d);}(_0x908e,0x182));var _0xe908=function(_0x43884a,_0x154135){_0x43884a=_0x43884a-0x0;var _0x55c82a=_0x908e[_0x43884a];return _0x55c82a;};'use strict';var multer=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe908('0x2'));var router=express[_0xe908('0x3')]();var fs_extra=require(_0xe908('0x4'));var auth=require(_0xe908('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe908('0x6'));var controller=require('./interval.controller');router['get']('/',auth[_0xe908('0x7')](),controller[_0xe908('0x8')]);router[_0xe908('0x9')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0xb')]);router['get'](_0xe908('0xc'),auth['isAuthenticated'](),controller[_0xe908('0xd')]);router[_0xe908('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe908('0xe')](_0xe908('0xc'),auth[_0xe908('0x7')](),controller[_0xe908('0xf')]);router[_0xe908('0xe')](_0xe908('0x10'),auth[_0xe908('0x7')](),controller[_0xe908('0x11')]);router['put']('/:id',auth[_0xe908('0x7')](),controller['update']);router[_0xe908('0x12')](_0xe908('0xa'),auth[_0xe908('0x7')](),controller[_0xe908('0x13')]);module[_0xe908('0x14')]=router; \ No newline at end of file +var _0xc8ba=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc8ba,0x186));var _0xac8b=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0xc8ba[_0x2ec2bf];return _0x2c279c;};'use strict';var multer=require(_0xac8b('0x0'));var util=require(_0xac8b('0x1'));var path=require(_0xac8b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac8b('0x3')]();var fs_extra=require(_0xac8b('0x4'));var auth=require(_0xac8b('0x5'));var interaction=require(_0xac8b('0x6'));var config=require('../../config/environment');var controller=require(_0xac8b('0x7'));router[_0xac8b('0x8')]('/',auth['isAuthenticated'](),controller[_0xac8b('0x9')]);router['get'](_0xac8b('0xa'),auth[_0xac8b('0xb')](),controller[_0xac8b('0xc')]);router['get'](_0xac8b('0xd'),auth[_0xac8b('0xb')](),controller[_0xac8b('0xe')]);router[_0xac8b('0xf')]('/',auth[_0xac8b('0xb')](),controller[_0xac8b('0x10')]);router[_0xac8b('0xf')](_0xac8b('0xd'),auth[_0xac8b('0xb')](),controller[_0xac8b('0x11')]);router[_0xac8b('0xf')](_0xac8b('0x12'),auth['isAuthenticated'](),controller[_0xac8b('0x13')]);router[_0xac8b('0x14')](_0xac8b('0xa'),auth[_0xac8b('0xb')](),controller[_0xac8b('0x15')]);router['delete'](_0xac8b('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xac8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index afd9384..2fd16ed 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 _0xbd37=['exports','STRING'];(function(_0x5ea8e4,_0x52a367){var _0x180817=function(_0x5e5046){while(--_0x5e5046){_0x5ea8e4['push'](_0x5ea8e4['shift']());}};_0x180817(++_0x52a367);}(_0xbd37,0x124));var _0x7bd3=function(_0x311f9d,_0x653511){_0x311f9d=_0x311f9d-0x0;var _0x4a64c2=_0xbd37[_0x311f9d];return _0x4a64c2;};'use strict';var Sequelize=require('sequelize');module[_0x7bd3('0x0')]={'name':{'type':Sequelize[_0x7bd3('0x1')]},'description':{'type':Sequelize[_0x7bd3('0x1')]},'interval':{'type':Sequelize[_0x7bd3('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8c0a=['STRING','exports'];(function(_0x23af8d,_0x5f0e9c){var _0x164819=function(_0x50a1de){while(--_0x50a1de){_0x23af8d['push'](_0x23af8d['shift']());}};_0x164819(++_0x5f0e9c);}(_0x8c0a,0xc9));var _0xa8c0=function(_0x3ad0aa,_0x5d3e71){_0x3ad0aa=_0x3ad0aa-0x0;var _0x4fb884=_0x8c0a[_0x3ad0aa];return _0x4fb884;};'use strict';var Sequelize=require('sequelize');module[_0xa8c0('0x0')]={'name':{'type':Sequelize[_0xa8c0('0x1')]},'description':{'type':Sequelize[_0xa8c0('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f5bf2a5..ede0a65 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 _0xc990=['util','path','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','offset','undefined','limit','count','status','apply','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','Interval','includeAll','include','findAll','show','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','params','IntervalId','getIntervals','findOne','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x25d092,_0x469bd3){var _0x3d20e5=function(_0x2afa1a){while(--_0x2afa1a){_0x25d092['push'](_0x25d092['shift']());}};_0x3d20e5(++_0x469bd3);}(_0xc990,0x9c));var _0x0c99=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc990[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x0c99('0x0'));var rimraf=require(_0x0c99('0x1'));var zipdir=require(_0x0c99('0x2'));var jsonpatch=require(_0x0c99('0x3'));var rp=require('request-promise');var moment=require(_0x0c99('0x4'));var BPromise=require(_0x0c99('0x5'));var Mustache=require('mustache');var util=require(_0x0c99('0x6'));var path=require(_0x0c99('0x7'));var sox=require('sox');var csv=require(_0x0c99('0x8'));var ejs=require(_0x0c99('0x9'));var fs=require('fs');var fs_extra=require(_0x0c99('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c99('0x8'));var querystring=require(_0x0c99('0xb'));var Papa=require(_0x0c99('0xc'));var Redis=require(_0x0c99('0xd'));var authService=require(_0x0c99('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0c99('0xf'));var hardwareService=require(_0x0c99('0x10'));var logger=require(_0x0c99('0x11'))(_0x0c99('0x12'));var utils=require('../../config/utils');var config=require(_0x0c99('0x13'));var licenseUtil=require(_0x0c99('0x14'));var db=require(_0x0c99('0x15'))['db'];var extensions=require(_0x0c99('0x16'));function respondWithStatusCode(_0x37d660,_0x2b31de){_0x2b31de=_0x2b31de||0xcc;return function(_0x34a21d){if(_0x34a21d){return _0x37d660[_0x0c99('0x17')](_0x2b31de);}return _0x37d660['status'](_0x2b31de)[_0x0c99('0x18')]();};}function respondWithResult(_0x2b55a2,_0x298afb){_0x298afb=_0x298afb||0xc8;return function(_0x3e6a50){if(_0x3e6a50){return _0x2b55a2['status'](_0x298afb)[_0x0c99('0x19')](_0x3e6a50);}};}function respondWithFilteredResult(_0x125577,_0x1e765a){return function(_0x3e693f){if(_0x3e693f){var _0x514818=typeof _0x1e765a[_0x0c99('0x1a')]===_0x0c99('0x1b')&&typeof _0x1e765a[_0x0c99('0x1c')]===_0x0c99('0x1b');var _0x482821=_0x3e693f[_0x0c99('0x1d')];var _0x3ba8a9=_0x514818?0x0:_0x1e765a[_0x0c99('0x1a')];var _0x525935=_0x514818?_0x3e693f[_0x0c99('0x1d')]:_0x1e765a[_0x0c99('0x1a')]+_0x1e765a['limit'];var _0x1131cc;if(_0x525935>=_0x482821){_0x525935=_0x482821;_0x1131cc=0xc8;}else{_0x1131cc=0xce;}_0x125577[_0x0c99('0x1e')](_0x1131cc);return _0x125577['set']('Content-Range',_0x3ba8a9+'-'+_0x525935+'/'+_0x482821)['json'](_0x3e693f);}return null;};}function patchUpdates(_0x546c3d){return function(_0x2397b2){try{jsonpatch[_0x0c99('0x1f')](_0x2397b2,_0x546c3d,!![]);}catch(_0x461c61){return BPromise['reject'](_0x461c61);}return _0x2397b2['save']();};}function saveUpdates(_0x1eda7d,_0x3eb1d0){return function(_0x2db17d){if(_0x2db17d){return _0x2db17d['update'](_0x1eda7d)[_0x0c99('0x20')](function(_0x13ca0f){return _0x13ca0f;});}return null;};}function removeEntity(_0x1935b0,_0x50961c){return function(_0x15f6cf){if(_0x15f6cf){return _0x15f6cf[_0x0c99('0x21')]()[_0x0c99('0x20')](function(){var _0x445242=_0x15f6cf['get']({'plain':!![]});var _0x39abec=_0x0c99('0x22');return db[_0x0c99('0x23')][_0x0c99('0x21')]({'where':{'type':_0x39abec,'resourceId':_0x445242['id']}})['then'](function(){return _0x15f6cf;});})[_0x0c99('0x20')](function(){_0x1935b0[_0x0c99('0x1e')](0xcc)[_0x0c99('0x18')]();});}};}function handleEntityNotFound(_0xd139c3,_0x225a13){return function(_0x4dadcf){if(!_0x4dadcf){_0xd139c3[_0x0c99('0x17')](0x194);}return _0x4dadcf;};}function handleError(_0x55d5b8,_0x8c1a94){_0x8c1a94=_0x8c1a94||0x1f4;return function(_0x330d09){logger[_0x0c99('0x24')](_0x330d09[_0x0c99('0x25')]);if(_0x330d09[_0x0c99('0x26')]){delete _0x330d09[_0x0c99('0x26')];}_0x55d5b8[_0x0c99('0x1e')](_0x8c1a94)[_0x0c99('0x27')](_0x330d09);};}exports[_0x0c99('0x28')]=function(_0x5e6dfd,_0x59a9f4){var _0x3a0350={},_0x56e5fb={},_0x5be729={'count':0x0,'rows':[]};var _0xd5f36e=_[_0x0c99('0x29')](db['Interval'][_0x0c99('0x2a')],function(_0x284a16){return{'name':_0x284a16['fieldName'],'type':_0x284a16[_0x0c99('0x2b')]['key']};});_0x56e5fb[_0x0c99('0x2c')]=_[_0x0c99('0x29')](_0xd5f36e,'name');_0x56e5fb[_0x0c99('0x2d')]=_[_0x0c99('0x2e')](_0x5e6dfd[_0x0c99('0x2d')]);_0x56e5fb['filters']=_[_0x0c99('0x2f')](_0x56e5fb[_0x0c99('0x2c')],_0x56e5fb[_0x0c99('0x2d')]);_0x3a0350[_0x0c99('0x30')]=_[_0x0c99('0x2f')](_0x56e5fb[_0x0c99('0x2c')],qs['fields'](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x31')]));_0x3a0350[_0x0c99('0x30')]=_0x3a0350['attributes'][_0x0c99('0x32')]?_0x3a0350['attributes']:_0x56e5fb[_0x0c99('0x2c')];if(!_0x5e6dfd['query'][_0x0c99('0x33')](_0x0c99('0x34'))){_0x3a0350['limit']=qs[_0x0c99('0x1c')](_0x5e6dfd['query'][_0x0c99('0x1c')]);_0x3a0350['offset']=qs[_0x0c99('0x1a')](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x1a')]);}_0x3a0350[_0x0c99('0x35')]=qs['sort'](_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x36')]);_0x3a0350[_0x0c99('0x37')]=qs[_0x0c99('0x38')](_[_0x0c99('0x39')](_0x5e6dfd[_0x0c99('0x2d')],_0x56e5fb[_0x0c99('0x38')]),_0xd5f36e);if(_0x5e6dfd['query'][_0x0c99('0x3a')]){_0x3a0350[_0x0c99('0x37')]=_['merge'](_0x3a0350['where'],{'$or':_[_0x0c99('0x29')](_0xd5f36e,function(_0x41e07c){if(_0x41e07c[_0x0c99('0x2b')]!==_0x0c99('0x3b')){var _0x410d48={};_0x410d48[_0x41e07c[_0x0c99('0x26')]]={'$like':'%'+_0x5e6dfd[_0x0c99('0x2d')][_0x0c99('0x3a')]+'%'};return _0x410d48;}})});}_0x3a0350=_[_0x0c99('0x3c')]({},_0x3a0350,_0x5e6dfd['options']);var _0x3700ed={'where':_0x3a0350['where']};return db[_0x0c99('0x3d')][_0x0c99('0x1d')](_0x3700ed)['then'](function(_0x2b6db6){_0x5be729[_0x0c99('0x1d')]=_0x2b6db6;if(_0x5e6dfd['query'][_0x0c99('0x3e')]){_0x3a0350[_0x0c99('0x3f')]=[{'all':!![]}];}return db[_0x0c99('0x3d')][_0x0c99('0x40')](_0x3a0350);})['then'](function(_0x578d80){_0x5be729['rows']=_0x578d80;return _0x5be729;})[_0x0c99('0x20')](respondWithFilteredResult(_0x59a9f4,_0x3a0350))['catch'](handleError(_0x59a9f4,null));};exports[_0x0c99('0x41')]=function(_0x3b1ae6,_0x490f8e){var _0x127ddb={'raw':!![],'where':{'id':_0x3b1ae6['params']['id']}},_0x58e424={};_0x58e424['model']=_['keys'](db['Interval'][_0x0c99('0x2a')]);_0x58e424['query']=_[_0x0c99('0x2e')](_0x3b1ae6[_0x0c99('0x2d')]);_0x58e424[_0x0c99('0x38')]=_[_0x0c99('0x2f')](_0x58e424[_0x0c99('0x2c')],_0x58e424[_0x0c99('0x2d')]);_0x127ddb[_0x0c99('0x30')]=_[_0x0c99('0x2f')](_0x58e424['model'],qs[_0x0c99('0x31')](_0x3b1ae6[_0x0c99('0x2d')][_0x0c99('0x31')]));_0x127ddb['attributes']=_0x127ddb[_0x0c99('0x30')][_0x0c99('0x32')]?_0x127ddb[_0x0c99('0x30')]:_0x58e424[_0x0c99('0x2c')];if(_0x3b1ae6['query']['includeAll']){_0x127ddb[_0x0c99('0x3f')]=[{'all':!![]}];}_0x127ddb=_[_0x0c99('0x3c')]({},_0x127ddb,_0x3b1ae6[_0x0c99('0x42')]);return db[_0x0c99('0x3d')][_0x0c99('0x43')](_0x127ddb)[_0x0c99('0x20')](handleEntityNotFound(_0x490f8e,null))[_0x0c99('0x20')](respondWithResult(_0x490f8e,null))[_0x0c99('0x44')](handleError(_0x490f8e,null));};exports[_0x0c99('0x45')]=function(_0x22c59d,_0x30fa72){return db['Interval']['create'](_0x22c59d[_0x0c99('0x46')],{})['then'](function(_0x454146){var _0x2952c6=_0x22c59d[_0x0c99('0x47')][_0x0c99('0x48')]({'plain':!![]});if(!_0x2952c6)throw new Error(_0x0c99('0x49'));if(_0x2952c6[_0x0c99('0x4a')]===_0x0c99('0x47')){var _0xa53712=_0x454146[_0x0c99('0x48')]({'plain':!![]});var _0x2ee8cf=_0x0c99('0x22');return db['UserProfileSection'][_0x0c99('0x43')]({'where':{'name':_0x2ee8cf,'userProfileId':_0x2952c6['userProfileId']},'raw':!![]})[_0x0c99('0x20')](function(_0x4616cc){if(_0x4616cc&&_0x4616cc[_0x0c99('0x4b')]===0x0){return db[_0x0c99('0x23')][_0x0c99('0x45')]({'name':_0xa53712['name'],'resourceId':_0xa53712['id'],'type':_0x4616cc[_0x0c99('0x26')],'sectionId':_0x4616cc['id']},{})[_0x0c99('0x20')](function(){return _0x454146;});}else{return _0x454146;}})[_0x0c99('0x44')](function(_0x34a7ef){logger[_0x0c99('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34a7ef);throw _0x34a7ef;});}return _0x454146;})['then'](respondWithResult(_0x30fa72,0xc9))['catch'](handleError(_0x30fa72,null));};exports['update']=function(_0x43b3ae,_0x550270){if(_0x43b3ae[_0x0c99('0x46')]['id']){delete _0x43b3ae[_0x0c99('0x46')]['id'];}return db['Interval']['find']({'where':{'id':_0x43b3ae[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x550270,null))['then'](saveUpdates(_0x43b3ae[_0x0c99('0x46')],null))[_0x0c99('0x20')](respondWithResult(_0x550270,null))[_0x0c99('0x44')](handleError(_0x550270,null));};exports[_0x0c99('0x21')]=function(_0x4d4235,_0xb9d613){return db[_0x0c99('0x3d')][_0x0c99('0x43')]({'where':{'id':_0x4d4235[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0xb9d613,null))[_0x0c99('0x20')](removeEntity(_0xb9d613,null))['catch'](handleError(_0xb9d613,null));};exports['addInterval']=function(_0x569919,_0xfcdab8,_0x5a7783){if(_0x569919[_0x0c99('0x46')]['id']){delete _0x569919[_0x0c99('0x46')]['id'];}return db[_0x0c99('0x3d')][_0x0c99('0x43')]({'where':{'id':_0x569919[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0xfcdab8,null))[_0x0c99('0x20')](function(_0x318324){if(_0x318324){_0x569919[_0x0c99('0x46')][_0x0c99('0x4d')]=_0x318324['id'];return db[_0x0c99('0x3d')]['create'](_0x569919[_0x0c99('0x46')]);}})['then'](respondWithResult(_0xfcdab8,null))[_0x0c99('0x44')](handleError(_0xfcdab8,null));};exports[_0x0c99('0x4e')]=function(_0x11b191,_0x31ec0f,_0x23c2a5){var _0x1c3723={};var _0x26687f={};var _0x16f233;var _0x33d77e;return db[_0x0c99('0x3d')]['findOne']({'where':{'id':_0x11b191[_0x0c99('0x4c')]['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x31ec0f,null))['then'](function(_0x77dfe7){if(_0x77dfe7){_0x16f233=_0x77dfe7;_0x26687f[_0x0c99('0x2c')]=_[_0x0c99('0x2e')](db['Interval']['rawAttributes']);_0x26687f[_0x0c99('0x2d')]=_[_0x0c99('0x2e')](_0x11b191[_0x0c99('0x2d')]);_0x26687f['filters']=_[_0x0c99('0x2f')](_0x26687f[_0x0c99('0x2c')],_0x26687f[_0x0c99('0x2d')]);_0x1c3723['attributes']=_[_0x0c99('0x2f')](_0x26687f[_0x0c99('0x2c')],qs[_0x0c99('0x31')](_0x11b191[_0x0c99('0x2d')]['fields']));_0x1c3723['attributes']=_0x1c3723[_0x0c99('0x30')][_0x0c99('0x32')]?_0x1c3723['attributes']:_0x26687f[_0x0c99('0x2c')];_0x1c3723[_0x0c99('0x35')]=qs[_0x0c99('0x36')](_0x11b191[_0x0c99('0x2d')]['sort']);_0x1c3723['where']=qs['filters'](_[_0x0c99('0x39')](_0x11b191[_0x0c99('0x2d')],_0x26687f[_0x0c99('0x38')]));if(_0x11b191['query']['filter']){_0x1c3723[_0x0c99('0x37')]=_[_0x0c99('0x3c')](_0x1c3723[_0x0c99('0x37')],{'$or':_['map'](_0x1c3723[_0x0c99('0x30')],function(_0x2f7dcb){var _0x237e8b={};_0x237e8b[_0x2f7dcb]={'$like':'%'+_0x11b191['query']['filter']+'%'};return _0x237e8b;})});}_0x1c3723=_['merge']({},_0x1c3723,_0x11b191[_0x0c99('0x42')]);return _0x16f233[_0x0c99('0x4e')](_0x1c3723);}})[_0x0c99('0x20')](function(_0x19c573){if(_0x19c573){_0x33d77e=_0x19c573[_0x0c99('0x32')];if(!_0x11b191[_0x0c99('0x2d')][_0x0c99('0x33')]('nolimit')){_0x1c3723['limit']=qs[_0x0c99('0x1c')](_0x11b191[_0x0c99('0x2d')][_0x0c99('0x1c')]);_0x1c3723['offset']=qs[_0x0c99('0x1a')](_0x11b191[_0x0c99('0x2d')][_0x0c99('0x1a')]);}return _0x16f233[_0x0c99('0x4e')](_0x1c3723);}})['then'](function(_0x3a4cc9){if(_0x3a4cc9){return _0x3a4cc9?{'count':_0x33d77e,'rows':_0x3a4cc9}:null;}})[_0x0c99('0x20')](respondWithResult(_0x31ec0f,null))[_0x0c99('0x44')](handleError(_0x31ec0f,null));};exports['addIntervals']=function(_0x4e367d,_0x29959f,_0x3e828a){return db[_0x0c99('0x3d')][_0x0c99('0x4f')]({'where':{'id':_0x4e367d['params']['id']}})[_0x0c99('0x20')](handleEntityNotFound(_0x29959f,null))['then'](function(_0x30ac66){if(_0x30ac66){return db['sequelize']['transaction'](function(_0x3bea63){return db[_0x0c99('0x3d')][_0x0c99('0x21')]({'where':{'IntervalId':_0x4e367d['params']['id']},'transaction':_0x3bea63})[_0x0c99('0x20')](function(_0x1bd5bd){var _0x19799b=_[_0x0c99('0x29')](_0x4e367d[_0x0c99('0x46')],function(_0xfa0ee3){delete _0xfa0ee3['id'];_0xfa0ee3[_0x0c99('0x4d')]=_0x4e367d[_0x0c99('0x4c')]['id'];return _0xfa0ee3;});return db[_0x0c99('0x3d')][_0x0c99('0x50')](_0x19799b,{'transaction':_0x3bea63});});})['then'](function(){return db['Interval'][_0x0c99('0x40')]({'where':{'IntervalId':_0x4e367d[_0x0c99('0x4c')]['id']}});});}})[_0x0c99('0x20')](respondWithResult(_0x29959f,null))[_0x0c99('0x44')](handleError(_0x29959f,null));}; \ No newline at end of file +var _0x4276=['Interval','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','find','create','user','Intervals','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','IntervalId','getIntervals','order','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index'];(function(_0x56b034,_0xb96f9b){var _0x25f338=function(_0x4134cd){while(--_0x4134cd){_0x56b034['push'](_0x56b034['shift']());}};_0x25f338(++_0xb96f9b);}(_0x4276,0xd7));var _0x6427=function(_0x2849ff,_0x623c8d){_0x2849ff=_0x2849ff-0x0;var _0x4dff4c=_0x4276[_0x2849ff];return _0x4dff4c;};'use strict';var emlformat=require(_0x6427('0x0'));var rimraf=require(_0x6427('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6427('0x2'));var rp=require('request-promise');var moment=require(_0x6427('0x3'));var BPromise=require(_0x6427('0x4'));var Mustache=require(_0x6427('0x5'));var util=require(_0x6427('0x6'));var path=require('path');var sox=require(_0x6427('0x7'));var csv=require(_0x6427('0x8'));var ejs=require(_0x6427('0x9'));var fs=require('fs');var fs_extra=require(_0x6427('0xa'));var _=require(_0x6427('0xb'));var squel=require(_0x6427('0xc'));var crypto=require(_0x6427('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6427('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6427('0xf'));var Papa=require('papaparse');var Redis=require(_0x6427('0x10'));var authService=require(_0x6427('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6427('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6427('0x13'));var utils=require(_0x6427('0x14'));var config=require(_0x6427('0x15'));var licenseUtil=require(_0x6427('0x16'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x49b6bd,_0xa4ddeb){_0xa4ddeb=_0xa4ddeb||0xcc;return function(_0xf62dcd){if(_0xf62dcd){return _0x49b6bd[_0x6427('0x17')](_0xa4ddeb);}return _0x49b6bd['status'](_0xa4ddeb)[_0x6427('0x18')]();};}function respondWithResult(_0x2db301,_0x19c806){_0x19c806=_0x19c806||0xc8;return function(_0x49885d){if(_0x49885d){return _0x2db301[_0x6427('0x19')](_0x19c806)['json'](_0x49885d);}};}function respondWithFilteredResult(_0x34e863,_0x33b5c7){return function(_0x55c47b){if(_0x55c47b){var _0x123b23=typeof _0x33b5c7[_0x6427('0x1a')]==='undefined'&&typeof _0x33b5c7[_0x6427('0x1b')]==='undefined';var _0x4f0f14=_0x55c47b[_0x6427('0x1c')];var _0x5f5a03=_0x123b23?0x0:_0x33b5c7[_0x6427('0x1a')];var _0x32cc86=_0x123b23?_0x55c47b[_0x6427('0x1c')]:_0x33b5c7[_0x6427('0x1a')]+_0x33b5c7[_0x6427('0x1b')];var _0x1148e7;if(_0x32cc86>=_0x4f0f14){_0x32cc86=_0x4f0f14;_0x1148e7=0xc8;}else{_0x1148e7=0xce;}_0x34e863[_0x6427('0x19')](_0x1148e7);return _0x34e863['set'](_0x6427('0x1d'),_0x5f5a03+'-'+_0x32cc86+'/'+_0x4f0f14)[_0x6427('0x1e')](_0x55c47b);}return null;};}function patchUpdates(_0x122b13){return function(_0x586304){try{jsonpatch[_0x6427('0x1f')](_0x586304,_0x122b13,!![]);}catch(_0x12c014){return BPromise[_0x6427('0x20')](_0x12c014);}return _0x586304[_0x6427('0x21')]();};}function saveUpdates(_0x34ccc7,_0x292369){return function(_0x24b5a3){if(_0x24b5a3){return _0x24b5a3[_0x6427('0x22')](_0x34ccc7)['then'](function(_0x4f2f65){return _0x4f2f65;});}return null;};}function removeEntity(_0x1a3fad,_0x1ebb6e){return function(_0xb9452){if(_0xb9452){return _0xb9452[_0x6427('0x23')]()[_0x6427('0x24')](function(){var _0x3c419e=_0xb9452[_0x6427('0x25')]({'plain':!![]});var _0x3d81dc='Intervals';return db[_0x6427('0x26')][_0x6427('0x23')]({'where':{'type':_0x3d81dc,'resourceId':_0x3c419e['id']}})[_0x6427('0x24')](function(){return _0xb9452;});})[_0x6427('0x24')](function(){_0x1a3fad[_0x6427('0x19')](0xcc)[_0x6427('0x18')]();});}};}function handleEntityNotFound(_0x3a5c68,_0x522c53){return function(_0xfb04cc){if(!_0xfb04cc){_0x3a5c68[_0x6427('0x17')](0x194);}return _0xfb04cc;};}function handleError(_0x2e3c04,_0x38a235){_0x38a235=_0x38a235||0x1f4;return function(_0x24cf97){logger[_0x6427('0x27')](_0x24cf97[_0x6427('0x28')]);if(_0x24cf97[_0x6427('0x29')]){delete _0x24cf97['name'];}_0x2e3c04['status'](_0x38a235)['send'](_0x24cf97);};}exports[_0x6427('0x2a')]=function(_0x21ee37,_0x32d6c6){var _0x50a20c={},_0x199bb3={},_0xd76a04={'count':0x0,'rows':[]};var _0x3c3e7d=_['map'](db[_0x6427('0x2b')][_0x6427('0x2c')],function(_0x2ec9d8){return{'name':_0x2ec9d8[_0x6427('0x2d')],'type':_0x2ec9d8['type'][_0x6427('0x2e')]};});_0x199bb3[_0x6427('0x2f')]=_[_0x6427('0x30')](_0x3c3e7d,_0x6427('0x29'));_0x199bb3['query']=_[_0x6427('0x31')](_0x21ee37[_0x6427('0x32')]);_0x199bb3[_0x6427('0x33')]=_[_0x6427('0x34')](_0x199bb3[_0x6427('0x2f')],_0x199bb3[_0x6427('0x32')]);_0x50a20c[_0x6427('0x35')]=_[_0x6427('0x34')](_0x199bb3[_0x6427('0x2f')],qs['fields'](_0x21ee37['query'][_0x6427('0x36')]));_0x50a20c[_0x6427('0x35')]=_0x50a20c['attributes'][_0x6427('0x37')]?_0x50a20c['attributes']:_0x199bb3[_0x6427('0x2f')];if(!_0x21ee37[_0x6427('0x32')][_0x6427('0x38')](_0x6427('0x39'))){_0x50a20c[_0x6427('0x1b')]=qs[_0x6427('0x1b')](_0x21ee37[_0x6427('0x32')][_0x6427('0x1b')]);_0x50a20c['offset']=qs['offset'](_0x21ee37[_0x6427('0x32')]['offset']);}_0x50a20c['order']=qs[_0x6427('0x3a')](_0x21ee37[_0x6427('0x32')][_0x6427('0x3a')]);_0x50a20c[_0x6427('0x3b')]=qs['filters'](_[_0x6427('0x3c')](_0x21ee37[_0x6427('0x32')],_0x199bb3[_0x6427('0x33')]),_0x3c3e7d);if(_0x21ee37[_0x6427('0x32')][_0x6427('0x3d')]){_0x50a20c[_0x6427('0x3b')]=_['merge'](_0x50a20c[_0x6427('0x3b')],{'$or':_[_0x6427('0x30')](_0x3c3e7d,function(_0xf5f75f){if(_0xf5f75f['type']!==_0x6427('0x3e')){var _0x2e3a07={};_0x2e3a07[_0xf5f75f[_0x6427('0x29')]]={'$like':'%'+_0x21ee37[_0x6427('0x32')][_0x6427('0x3d')]+'%'};return _0x2e3a07;}})});}_0x50a20c=_[_0x6427('0x3f')]({},_0x50a20c,_0x21ee37[_0x6427('0x40')]);var _0x12cb65={'where':_0x50a20c['where']};return db['Interval'][_0x6427('0x1c')](_0x12cb65)[_0x6427('0x24')](function(_0x4b4f6e){_0xd76a04[_0x6427('0x1c')]=_0x4b4f6e;if(_0x21ee37['query'][_0x6427('0x41')]){_0x50a20c[_0x6427('0x42')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x50a20c);})[_0x6427('0x24')](function(_0x14bac1){_0xd76a04[_0x6427('0x43')]=_0x14bac1;return _0xd76a04;})[_0x6427('0x24')](respondWithFilteredResult(_0x32d6c6,_0x50a20c))[_0x6427('0x44')](handleError(_0x32d6c6,null));};exports['show']=function(_0x6434f8,_0x165523){var _0x5ac4c8={'raw':!![],'where':{'id':_0x6434f8['params']['id']}},_0x19dde6={};_0x19dde6[_0x6427('0x2f')]=_['keys'](db[_0x6427('0x2b')][_0x6427('0x2c')]);_0x19dde6[_0x6427('0x32')]=_['keys'](_0x6434f8['query']);_0x19dde6[_0x6427('0x33')]=_[_0x6427('0x34')](_0x19dde6['model'],_0x19dde6[_0x6427('0x32')]);_0x5ac4c8['attributes']=_[_0x6427('0x34')](_0x19dde6[_0x6427('0x2f')],qs['fields'](_0x6434f8[_0x6427('0x32')][_0x6427('0x36')]));_0x5ac4c8[_0x6427('0x35')]=_0x5ac4c8[_0x6427('0x35')]['length']?_0x5ac4c8[_0x6427('0x35')]:_0x19dde6[_0x6427('0x2f')];if(_0x6434f8[_0x6427('0x32')][_0x6427('0x41')]){_0x5ac4c8[_0x6427('0x42')]=[{'all':!![]}];}_0x5ac4c8=_[_0x6427('0x3f')]({},_0x5ac4c8,_0x6434f8[_0x6427('0x40')]);return db[_0x6427('0x2b')][_0x6427('0x45')](_0x5ac4c8)[_0x6427('0x24')](handleEntityNotFound(_0x165523,null))[_0x6427('0x24')](respondWithResult(_0x165523,null))[_0x6427('0x44')](handleError(_0x165523,null));};exports[_0x6427('0x46')]=function(_0x5eb27f,_0x522203){return db['Interval'][_0x6427('0x46')](_0x5eb27f['body'],{})[_0x6427('0x24')](function(_0x25689a){var _0x2c4177=_0x5eb27f[_0x6427('0x47')][_0x6427('0x25')]({'plain':!![]});if(!_0x2c4177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c4177['role']===_0x6427('0x47')){var _0x3b1d5b=_0x25689a[_0x6427('0x25')]({'plain':!![]});var _0x31fb3e=_0x6427('0x48');return db[_0x6427('0x49')][_0x6427('0x45')]({'where':{'name':_0x31fb3e,'userProfileId':_0x2c4177[_0x6427('0x4a')]},'raw':!![]})[_0x6427('0x24')](function(_0x48ae08){if(_0x48ae08&&_0x48ae08['autoAssociation']===0x0){return db['UserProfileResource'][_0x6427('0x46')]({'name':_0x3b1d5b['name'],'resourceId':_0x3b1d5b['id'],'type':_0x48ae08[_0x6427('0x29')],'sectionId':_0x48ae08['id']},{})[_0x6427('0x24')](function(){return _0x25689a;});}else{return _0x25689a;}})[_0x6427('0x44')](function(_0xad80d0){logger[_0x6427('0x27')](_0x6427('0x4b'),_0xad80d0);throw _0xad80d0;});}return _0x25689a;})[_0x6427('0x24')](respondWithResult(_0x522203,0xc9))[_0x6427('0x44')](handleError(_0x522203,null));};exports['update']=function(_0x489efd,_0x114a62){if(_0x489efd[_0x6427('0x4c')]['id']){delete _0x489efd['body']['id'];}return db[_0x6427('0x2b')]['find']({'where':{'id':_0x489efd[_0x6427('0x4d')]['id']}})[_0x6427('0x24')](handleEntityNotFound(_0x114a62,null))[_0x6427('0x24')](saveUpdates(_0x489efd['body'],null))[_0x6427('0x24')](respondWithResult(_0x114a62,null))['catch'](handleError(_0x114a62,null));};exports['destroy']=function(_0xbbb17d,_0x2b6c87){return db[_0x6427('0x2b')][_0x6427('0x45')]({'where':{'id':_0xbbb17d['params']['id']}})['then'](handleEntityNotFound(_0x2b6c87,null))[_0x6427('0x24')](removeEntity(_0x2b6c87,null))[_0x6427('0x44')](handleError(_0x2b6c87,null));};exports['addInterval']=function(_0x1b0f8e,_0x53da4f,_0x20b617){if(_0x1b0f8e[_0x6427('0x4c')]['id']){delete _0x1b0f8e[_0x6427('0x4c')]['id'];}return db[_0x6427('0x2b')][_0x6427('0x45')]({'where':{'id':_0x1b0f8e[_0x6427('0x4d')]['id']}})[_0x6427('0x24')](handleEntityNotFound(_0x53da4f,null))['then'](function(_0xf67ef){if(_0xf67ef){_0x1b0f8e[_0x6427('0x4c')][_0x6427('0x4e')]=_0xf67ef['id'];return db[_0x6427('0x2b')][_0x6427('0x46')](_0x1b0f8e['body']);}})[_0x6427('0x24')](respondWithResult(_0x53da4f,null))[_0x6427('0x44')](handleError(_0x53da4f,null));};exports[_0x6427('0x4f')]=function(_0x19c355,_0x243cbe,_0x3ba89d){var _0x26930f={};var _0x76e320={};var _0x4fdf6a;var _0x937f4f;return db['Interval']['findOne']({'where':{'id':_0x19c355[_0x6427('0x4d')]['id']}})[_0x6427('0x24')](handleEntityNotFound(_0x243cbe,null))[_0x6427('0x24')](function(_0x5e7a96){if(_0x5e7a96){_0x4fdf6a=_0x5e7a96;_0x76e320[_0x6427('0x2f')]=_[_0x6427('0x31')](db[_0x6427('0x2b')][_0x6427('0x2c')]);_0x76e320['query']=_[_0x6427('0x31')](_0x19c355[_0x6427('0x32')]);_0x76e320[_0x6427('0x33')]=_['intersection'](_0x76e320[_0x6427('0x2f')],_0x76e320[_0x6427('0x32')]);_0x26930f['attributes']=_[_0x6427('0x34')](_0x76e320[_0x6427('0x2f')],qs['fields'](_0x19c355[_0x6427('0x32')][_0x6427('0x36')]));_0x26930f[_0x6427('0x35')]=_0x26930f[_0x6427('0x35')][_0x6427('0x37')]?_0x26930f[_0x6427('0x35')]:_0x76e320[_0x6427('0x2f')];_0x26930f[_0x6427('0x50')]=qs[_0x6427('0x3a')](_0x19c355['query'][_0x6427('0x3a')]);_0x26930f[_0x6427('0x3b')]=qs['filters'](_[_0x6427('0x3c')](_0x19c355[_0x6427('0x32')],_0x76e320[_0x6427('0x33')]));if(_0x19c355['query'][_0x6427('0x3d')]){_0x26930f[_0x6427('0x3b')]=_[_0x6427('0x3f')](_0x26930f['where'],{'$or':_[_0x6427('0x30')](_0x26930f[_0x6427('0x35')],function(_0x31fd9f){var _0x19a09b={};_0x19a09b[_0x31fd9f]={'$like':'%'+_0x19c355[_0x6427('0x32')][_0x6427('0x3d')]+'%'};return _0x19a09b;})});}_0x26930f=_[_0x6427('0x3f')]({},_0x26930f,_0x19c355[_0x6427('0x40')]);return _0x4fdf6a[_0x6427('0x4f')](_0x26930f);}})['then'](function(_0x87f2e8){if(_0x87f2e8){_0x937f4f=_0x87f2e8['length'];if(!_0x19c355[_0x6427('0x32')]['hasOwnProperty'](_0x6427('0x39'))){_0x26930f[_0x6427('0x1b')]=qs[_0x6427('0x1b')](_0x19c355[_0x6427('0x32')][_0x6427('0x1b')]);_0x26930f[_0x6427('0x1a')]=qs['offset'](_0x19c355[_0x6427('0x32')]['offset']);}return _0x4fdf6a[_0x6427('0x4f')](_0x26930f);}})['then'](function(_0x72738b){if(_0x72738b){return _0x72738b?{'count':_0x937f4f,'rows':_0x72738b}:null;}})[_0x6427('0x24')](respondWithResult(_0x243cbe,null))[_0x6427('0x44')](handleError(_0x243cbe,null));};exports[_0x6427('0x51')]=function(_0xfb17f6,_0x4a764e,_0x10a568){return db[_0x6427('0x2b')]['findOne']({'where':{'id':_0xfb17f6[_0x6427('0x4d')]['id']}})[_0x6427('0x24')](handleEntityNotFound(_0x4a764e,null))[_0x6427('0x24')](function(_0x259d8e){if(_0x259d8e){return db[_0x6427('0x52')][_0x6427('0x53')](function(_0x1fa3ce){return db[_0x6427('0x2b')][_0x6427('0x23')]({'where':{'IntervalId':_0xfb17f6[_0x6427('0x4d')]['id']},'transaction':_0x1fa3ce})[_0x6427('0x24')](function(_0x4f5e99){var _0x2c23ba=_['map'](_0xfb17f6[_0x6427('0x4c')],function(_0x5d1ec3){delete _0x5d1ec3['id'];_0x5d1ec3[_0x6427('0x4e')]=_0xfb17f6[_0x6427('0x4d')]['id'];return _0x5d1ec3;});return db[_0x6427('0x2b')][_0x6427('0x54')](_0x2c23ba,{'transaction':_0x1fa3ce});});})[_0x6427('0x24')](function(){return db[_0x6427('0x2b')][_0x6427('0x55')]({'where':{'IntervalId':_0xfb17f6[_0x6427('0x4d')]['id']}});});}})[_0x6427('0x24')](respondWithResult(_0x4a764e,null))[_0x6427('0x44')](handleError(_0x4a764e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ad746cd..e015d62 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 _0xd527=['reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','then','all','map','ifTime'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd527,0x12d));var _0x7d52=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xd527[_0x3f2d02];return _0x54092b;};'use strict';var attributes=require(_0x7d52('0x0'));var extensions=require(_0x7d52('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x7d52('0x2')]=function(_0x92cef1){return _0x92cef1[_0x7d52('0x3')](_0x7d52('0x4'),attributes,{'tableName':_0x7d52('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2953da){extensions[_0x7d52('0x6')](_0x92cef1,_0x2953da);},'afterBulkCreate':function(_0x1eddf9,_0x57fe26,_0xce5991){_0xce5991();extensions[_0x7d52('0x6')](_0x92cef1,_0x1eddf9[0x0]);},'afterUpdate':function(_0x1a47a4){extensions[_0x7d52('0x6')](_0x92cef1,_0x1a47a4);},'afterDestroy':function(_0x1c2445){extensions[_0x7d52('0x6')](_0x92cef1,_0x1c2445);}},'instanceMethods':{'ifTime':function(_0x5f13ff=undefined,_0x2a6fca=new Date()){if(typeof this[_0x7d52('0x7')]===_0x7d52('0x8')){return iftime(this[_0x7d52('0x7')],_0x5f13ff,_0x2a6fca);}else{return this[_0x7d52('0x9')]()[_0x7d52('0xa')](function(_0x39aca5){return Promise[_0x7d52('0xb')](_0x39aca5[_0x7d52('0xc')](function(_0x4c4c75){return _0x4c4c75[_0x7d52('0xd')](_0x5f13ff,_0x2a6fca);}));})[_0x7d52('0xa')](function(_0x2c6711){return _0x2c6711[_0x7d52('0xe')](function(_0xecf771,_0x3982e0){return _0xecf771||_0x3982e0;},![]);});}}}});}; \ No newline at end of file +var _0xf80e=['all','ifTime','reduce','iftime','exports','define','tools_intervals','rewrite','string','interval','getIntervals','then'];(function(_0x46d2b3,_0x35d247){var _0x9ca916=function(_0x13b887){while(--_0x13b887){_0x46d2b3['push'](_0x46d2b3['shift']());}};_0x9ca916(++_0x35d247);}(_0xf80e,0x123));var _0xef80=function(_0x374976,_0x40871f){_0x374976=_0x374976-0x0;var _0x4736da=_0xf80e[_0x374976];return _0x4736da;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')[_0xef80('0x0')];module[_0xef80('0x1')]=function(_0x5845c4){return _0x5845c4[_0xef80('0x2')]('Interval',attributes,{'tableName':_0xef80('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d4815){extensions[_0xef80('0x4')](_0x5845c4,_0x1d4815);},'afterBulkCreate':function(_0x45d187,_0x456327,_0x16679b){_0x16679b();extensions[_0xef80('0x4')](_0x5845c4,_0x45d187[0x0]);},'afterUpdate':function(_0x2f3d06){extensions[_0xef80('0x4')](_0x5845c4,_0x2f3d06);},'afterDestroy':function(_0x2c6e21){extensions[_0xef80('0x4')](_0x5845c4,_0x2c6e21);}},'instanceMethods':{'ifTime':function(_0x180d21=undefined,_0x4b68aa=new Date()){if(typeof this['interval']===_0xef80('0x5')){return iftime(this[_0xef80('0x6')],_0x180d21,_0x4b68aa);}else{return this[_0xef80('0x7')]()[_0xef80('0x8')](function(_0x2d9e7e){return Promise[_0xef80('0x9')](_0x2d9e7e['map'](function(_0x53eadd){return _0x53eadd[_0xef80('0xa')](_0x180d21,_0x4b68aa);}));})[_0xef80('0x8')](function(_0x365ab2){return _0x365ab2[_0xef80('0xb')](function(_0x4982f7,_0x2af4ff){return _0x4982f7||_0x2af4ff;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 19e4193..07e0214 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 _0x77b6=['raw','where','attributes','limit','include','map','model','then','info','catch','error','message','ShowInterval','find','debug','stringify','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','lodash','util','../../config/logger','rpc','GetInterval','Interval','findAll','options'];(function(_0x39f647,_0x1d9ecb){var _0x3cd5f7=function(_0x2771d2){while(--_0x2771d2){_0x39f647['push'](_0x39f647['shift']());}};_0x3cd5f7(++_0x1d9ecb);}(_0x77b6,0x140));var _0x677b=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x77b6[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x677b('0x0'));var util=require(_0x677b('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x677b('0x2'))(_0x677b('0x3'));exports[_0x677b('0x4')]=function(_0x35ff4a){var _0x3127c4=this;return new Promise(function(_0xce921e,_0x136bd9){return db[_0x677b('0x5')][_0x677b('0x6')]({'raw':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0x8')]===undefined?!![]:![]:!![],'where':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0x9')]||null:null,'attributes':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xa')]||null:null,'limit':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xb')]||null:null,'include':_0x35ff4a[_0x677b('0x7')]?_0x35ff4a[_0x677b('0x7')][_0x677b('0xc')]?_['map'](_0x35ff4a[_0x677b('0x7')][_0x677b('0xc')],function(_0x37c6eb){return{'model':db[_0x37c6eb['model']],'as':_0x37c6eb['as'],'attributes':_0x37c6eb[_0x677b('0xa')],'include':_0x37c6eb[_0x677b('0xc')]?_[_0x677b('0xd')](_0x37c6eb[_0x677b('0xc')],function(_0x3775fd){return{'model':db[_0x3775fd[_0x677b('0xe')]],'as':_0x3775fd['as'],'attributes':_0x3775fd[_0x677b('0xa')],'include':_0x3775fd[_0x677b('0xc')]?_['map'](_0x3775fd[_0x677b('0xc')],function(_0x47ec39){return{'model':db[_0x47ec39[_0x677b('0xe')]],'as':_0x47ec39['as'],'attributes':_0x47ec39[_0x677b('0xa')]};}):[]};}):[]};}):[]:[]})[_0x677b('0xf')](function(_0x3d530f){logger[_0x677b('0x10')](_0x677b('0x4'),_0x35ff4a);logger['debug'](_0x677b('0x4'),_0x35ff4a,JSON['stringify'](_0x3d530f));_0xce921e(_0x3d530f);})[_0x677b('0x11')](function(_0x4c31ed){logger[_0x677b('0x12')](_0x677b('0x4'),_0x4c31ed[_0x677b('0x13')],_0x35ff4a);_0x136bd9(_0x3127c4[_0x677b('0x12')](0x1f4,_0x4c31ed[_0x677b('0x13')]));});});};exports[_0x677b('0x14')]=function(_0x5c1f52){var _0x50e3f0=this;return new Promise(function(_0xec0eb2,_0x2691d3){return db[_0x677b('0x5')][_0x677b('0x15')]({'raw':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52[_0x677b('0x7')][_0x677b('0x8')]===undefined?!![]:![]:!![],'where':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52['options']['where']||null:null,'attributes':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52['options'][_0x677b('0xa')]||null:null,'include':_0x5c1f52[_0x677b('0x7')]?_0x5c1f52[_0x677b('0x7')][_0x677b('0xc')]?_['map'](_0x5c1f52['options'][_0x677b('0xc')],function(_0x525b42){return{'model':db[_0x525b42['model']],'as':_0x525b42['as'],'attributes':_0x525b42['attributes'],'include':_0x525b42[_0x677b('0xc')]?_[_0x677b('0xd')](_0x525b42['include'],function(_0x5f3da5){return{'model':db[_0x5f3da5[_0x677b('0xe')]],'as':_0x5f3da5['as'],'attributes':_0x5f3da5[_0x677b('0xa')],'include':_0x5f3da5[_0x677b('0xc')]?_[_0x677b('0xd')](_0x5f3da5['include'],function(_0x54f278){return{'model':db[_0x54f278[_0x677b('0xe')]],'as':_0x54f278['as'],'attributes':_0x54f278[_0x677b('0xa')]};}):[]};}):[]};}):[]:[]})[_0x677b('0xf')](function(_0x367e61){logger[_0x677b('0x10')](_0x677b('0x14'),_0x5c1f52);logger[_0x677b('0x16')](_0x677b('0x14'),_0x5c1f52,JSON[_0x677b('0x17')](_0x367e61));_0xec0eb2(_0x367e61);})[_0x677b('0x11')](function(_0x2969f5){logger['error'](_0x677b('0x14'),_0x2969f5['message'],_0x5c1f52);_0x2691d3(_0x50e3f0[_0x677b('0x12')](0x1f4,_0x2969f5[_0x677b('0x13')]));});});};function checkArrayOfIntervals(_0xf12850,_0x4025bf){var _0x34e42f=[];return db[_0x677b('0x5')][_0x677b('0x6')]({'where':{'id':_0xf12850}})[_0x677b('0xf')](function(_0x129c1d){_0x34e42f=_0x129c1d;return Promise['all'](_0x34e42f[_0x677b('0xd')](function(_0x4fced4){return _0x4fced4[_0x677b('0x18')](_0x4025bf);}));})[_0x677b('0xf')](function(_0x3aef8a){var _0xc7e2a7=_0x3aef8a[_0x677b('0x19')](function(_0x34399d,_0x541a09){return _0x34399d||_0x541a09;},![]);logger['info'](util[_0x677b('0x1a')](_0x677b('0x1b'),_0x34e42f[_0x677b('0xd')](function(_0x50b47f){return _0x50b47f[_0x677b('0x1c')];})[_0x677b('0x1d')](',\x20'),_0x34e42f['map'](function(_0x222080){return _0x222080['id'];})['join'](',\x20')));return _0xc7e2a7;});}function checkSingleInterval(_0x356570,_0x303ad7){return db[_0x677b('0x5')]['findById'](_0x356570)['then'](function(_0x4d2f52){if(_0x4d2f52){logger[_0x677b('0x10')](util[_0x677b('0x1a')](_0x677b('0x1e'),_0x4d2f52[_0x677b('0x1c')],_0x4d2f52['id']));return _0x4d2f52[_0x677b('0x18')](_0x303ad7);}});}exports[_0x677b('0x1f')]=function(_0x182402){var _0x469faa=_0x182402[_0x677b('0x20')];var _0x21c7b1=Array[_0x677b('0x21')](_0x182402['intervals'])?_0x182402['intervals']:typeof _0x182402[_0x677b('0x22')]===_0x677b('0x23')?[_0x182402[_0x677b('0x22')]]:[];var _0xd76fad=_0x182402[_0x677b('0x24')]||undefined;var _0x452147=![];if(_0x21c7b1[_0x677b('0x25')]){logger[_0x677b('0x10')](util['format'](_0x677b('0x26'),_0x21c7b1[_0x677b('0x1d')](';\x20')));}if(_0xd76fad){logger[_0x677b('0x10')](util[_0x677b('0x1a')](_0x677b('0x27'),_0xd76fad));}logger[_0x677b('0x16')]('Iftime',_0x452147);logger[_0x677b('0x28')](_0x677b('0x1f'),_0x182402);return Promise['resolve']()[_0x677b('0xf')](function(){if(Array[_0x677b('0x21')](_0x469faa)){return checkArrayOfIntervals(_0x469faa,_0xd76fad);}else if(_0x469faa){return checkSingleInterval(_0x469faa,_0xd76fad);}})[_0x677b('0xf')](function(_0x202a61){var _0x14f79e=_0x21c7b1[_0x677b('0x19')](function(_0x167717,_0x69fae7){return _0x167717||iftime(_0x69fae7,_0xd76fad);},![]);_0x452147=_0x202a61||_0x14f79e;return _0x452147;})[_0x677b('0x11')](function(_0x5334f3){logger[_0x677b('0x12')]('IntervalIftime',_0x182402,_0x5334f3);throw this[_0x677b('0x12')](0x1f4,_0x5334f3['message']);});}; \ No newline at end of file +var _0x1c04=['find','ShowInterval','Interval','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','findAll','options','raw','where','limit','include','model','attributes','map','then','info','debug','stringify','catch','error','message'];(function(_0x32b355,_0x592b1a){var _0x24eddb=function(_0x4f0b66){while(--_0x4f0b66){_0x32b355['push'](_0x32b355['shift']());}};_0x24eddb(++_0x592b1a);}(_0x1c04,0x183));var _0x41c0=function(_0x19d0b6,_0x85209a){_0x19d0b6=_0x19d0b6-0x0;var _0x16060b=_0x1c04[_0x19d0b6];return _0x16060b;};'use strict';var _=require(_0x41c0('0x0'));var util=require(_0x41c0('0x1'));var db=require(_0x41c0('0x2'))['db'];var iftime=require(_0x41c0('0x3'))[_0x41c0('0x4')];var logger=require(_0x41c0('0x5'))('rpc');exports[_0x41c0('0x6')]=function(_0x32899d){var _0x3c4ab2=this;return new Promise(function(_0x617a7b,_0xac91cc){return db['Interval'][_0x41c0('0x7')]({'raw':_0x32899d[_0x41c0('0x8')]?_0x32899d[_0x41c0('0x8')][_0x41c0('0x9')]===undefined?!![]:![]:!![],'where':_0x32899d[_0x41c0('0x8')]?_0x32899d['options'][_0x41c0('0xa')]||null:null,'attributes':_0x32899d[_0x41c0('0x8')]?_0x32899d[_0x41c0('0x8')]['attributes']||null:null,'limit':_0x32899d[_0x41c0('0x8')]?_0x32899d['options'][_0x41c0('0xb')]||null:null,'include':_0x32899d[_0x41c0('0x8')]?_0x32899d['options'][_0x41c0('0xc')]?_['map'](_0x32899d[_0x41c0('0x8')][_0x41c0('0xc')],function(_0x2a3a48){return{'model':db[_0x2a3a48[_0x41c0('0xd')]],'as':_0x2a3a48['as'],'attributes':_0x2a3a48[_0x41c0('0xe')],'include':_0x2a3a48['include']?_[_0x41c0('0xf')](_0x2a3a48[_0x41c0('0xc')],function(_0x1619fe){return{'model':db[_0x1619fe[_0x41c0('0xd')]],'as':_0x1619fe['as'],'attributes':_0x1619fe[_0x41c0('0xe')],'include':_0x1619fe[_0x41c0('0xc')]?_[_0x41c0('0xf')](_0x1619fe[_0x41c0('0xc')],function(_0x52cd5b){return{'model':db[_0x52cd5b[_0x41c0('0xd')]],'as':_0x52cd5b['as'],'attributes':_0x52cd5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c0('0x10')](function(_0x22e7c7){logger[_0x41c0('0x11')]('GetInterval',_0x32899d);logger[_0x41c0('0x12')](_0x41c0('0x6'),_0x32899d,JSON[_0x41c0('0x13')](_0x22e7c7));_0x617a7b(_0x22e7c7);})[_0x41c0('0x14')](function(_0x1b5e0f){logger[_0x41c0('0x15')]('GetInterval',_0x1b5e0f[_0x41c0('0x16')],_0x32899d);_0xac91cc(_0x3c4ab2[_0x41c0('0x15')](0x1f4,_0x1b5e0f[_0x41c0('0x16')]));});});};exports['ShowInterval']=function(_0x24ae42){var _0x31b7d6=this;return new Promise(function(_0x5a988e,_0x4d0944){return db['Interval'][_0x41c0('0x17')]({'raw':_0x24ae42[_0x41c0('0x8')]?_0x24ae42[_0x41c0('0x8')][_0x41c0('0x9')]===undefined?!![]:![]:!![],'where':_0x24ae42['options']?_0x24ae42[_0x41c0('0x8')][_0x41c0('0xa')]||null:null,'attributes':_0x24ae42[_0x41c0('0x8')]?_0x24ae42[_0x41c0('0x8')]['attributes']||null:null,'include':_0x24ae42[_0x41c0('0x8')]?_0x24ae42[_0x41c0('0x8')][_0x41c0('0xc')]?_[_0x41c0('0xf')](_0x24ae42['options'][_0x41c0('0xc')],function(_0x5514ce){return{'model':db[_0x5514ce[_0x41c0('0xd')]],'as':_0x5514ce['as'],'attributes':_0x5514ce['attributes'],'include':_0x5514ce['include']?_[_0x41c0('0xf')](_0x5514ce[_0x41c0('0xc')],function(_0x15257c){return{'model':db[_0x15257c[_0x41c0('0xd')]],'as':_0x15257c['as'],'attributes':_0x15257c[_0x41c0('0xe')],'include':_0x15257c[_0x41c0('0xc')]?_['map'](_0x15257c['include'],function(_0x2aab34){return{'model':db[_0x2aab34[_0x41c0('0xd')]],'as':_0x2aab34['as'],'attributes':_0x2aab34['attributes']};}):[]};}):[]};}):[]:[]})[_0x41c0('0x10')](function(_0x332962){logger[_0x41c0('0x11')](_0x41c0('0x18'),_0x24ae42);logger[_0x41c0('0x12')](_0x41c0('0x18'),_0x24ae42,JSON[_0x41c0('0x13')](_0x332962));_0x5a988e(_0x332962);})[_0x41c0('0x14')](function(_0x4b3dbc){logger[_0x41c0('0x15')](_0x41c0('0x18'),_0x4b3dbc[_0x41c0('0x16')],_0x24ae42);_0x4d0944(_0x31b7d6['error'](0x1f4,_0x4b3dbc['message']));});});};function checkArrayOfIntervals(_0x134905,_0xfbee8c){var _0x370c8a=[];return db[_0x41c0('0x19')][_0x41c0('0x7')]({'where':{'id':_0x134905}})[_0x41c0('0x10')](function(_0x2cce04){_0x370c8a=_0x2cce04;return Promise['all'](_0x370c8a[_0x41c0('0xf')](function(_0x31a730){return _0x31a730['ifTime'](_0xfbee8c);}));})['then'](function(_0x40c05f){var _0x497868=_0x40c05f[_0x41c0('0x1a')](function(_0xbf55e4,_0x2189a9){return _0xbf55e4||_0x2189a9;},![]);logger[_0x41c0('0x11')](util[_0x41c0('0x1b')](_0x41c0('0x1c'),_0x370c8a['map'](function(_0xd594fe){return _0xd594fe[_0x41c0('0x1d')];})[_0x41c0('0x1e')](',\x20'),_0x370c8a[_0x41c0('0xf')](function(_0x4a9cab){return _0x4a9cab['id'];})[_0x41c0('0x1e')](',\x20')));return _0x497868;});}function checkSingleInterval(_0x1da7e9,_0x574d8c){return db[_0x41c0('0x19')]['findById'](_0x1da7e9)['then'](function(_0x1e5d6c){if(_0x1e5d6c){logger[_0x41c0('0x11')](util[_0x41c0('0x1b')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x1e5d6c['name'],_0x1e5d6c['id']));return _0x1e5d6c['ifTime'](_0x574d8c);}});}exports['IntervalIftime']=function(_0x4cc6ec){var _0x167fcf=_0x4cc6ec[_0x41c0('0x1f')];var _0x39a835=Array[_0x41c0('0x20')](_0x4cc6ec[_0x41c0('0x21')])?_0x4cc6ec['intervals']:typeof _0x4cc6ec[_0x41c0('0x21')]===_0x41c0('0x22')?[_0x4cc6ec[_0x41c0('0x21')]]:[];var _0x169f76=_0x4cc6ec[_0x41c0('0x23')]||undefined;var _0x202776=![];if(_0x39a835['length']){logger[_0x41c0('0x11')](util[_0x41c0('0x1b')](_0x41c0('0x24'),_0x39a835[_0x41c0('0x1e')](';\x20')));}if(_0x169f76){logger['info'](util[_0x41c0('0x1b')](_0x41c0('0x25'),_0x169f76));}logger[_0x41c0('0x12')]('Iftime',_0x202776);logger[_0x41c0('0x26')](_0x41c0('0x27'),_0x4cc6ec);return Promise[_0x41c0('0x28')]()['then'](function(){if(Array['isArray'](_0x167fcf)){return checkArrayOfIntervals(_0x167fcf,_0x169f76);}else if(_0x167fcf){return checkSingleInterval(_0x167fcf,_0x169f76);}})[_0x41c0('0x10')](function(_0x542bde){var _0x4d8615=_0x39a835[_0x41c0('0x1a')](function(_0x4a095b,_0x3c2646){return _0x4a095b||iftime(_0x3c2646,_0x169f76);},![]);_0x202776=_0x542bde||_0x4d8615;return _0x202776;})[_0x41c0('0x14')](function(_0x1fcaff){logger[_0x41c0('0x15')](_0x41c0('0x27'),_0x4cc6ec,_0x1fcaff);throw this[_0x41c0('0x15')](0x1f4,_0x1fcaff[_0x41c0('0x16')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index dd15bb9..d5e623a 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x29c9f6,_0x29b430){var _0xfbc70e=function(_0x2ee258){while(--_0x2ee258){_0x29c9f6['push'](_0x29c9f6['shift']());}};_0xfbc70e(++_0x29b430);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3700a0,_0x1ae90f){_0x3700a0=_0x3700a0-0x0;var _0x230f66=_0x5f2f[_0x3700a0];return _0x230f66;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x2d0fd8,_0x378e3d){var _0x34b9d8=function(_0x1ce3b4){while(--_0x1ce3b4){_0x2d0fd8['push'](_0x2d0fd8['shift']());}};_0x34b9d8(++_0x378e3d);}(_0xadb5,0xad));var _0x5adb=function(_0x4625d6,_0x1740c9){_0x4625d6=_0x4625d6-0x0;var _0x1bb397=_0xadb5[_0x4625d6];return _0x1bb397;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 438441f..7ff2466 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 _0x400b=['parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','request','data','end','status','statusCode','json'];(function(_0x741dbd,_0x460548){var _0x14486c=function(_0x3d63cc){while(--_0x3d63cc){_0x741dbd['push'](_0x741dbd['shift']());}};_0x14486c(++_0x460548);}(_0x400b,0x1ef));var _0xb400=function(_0x565987,_0x16e813){_0x565987=_0x565987-0x0;var _0x310296=_0x400b[_0x565987];return _0x310296;};'use strict';var BPromise=require(_0xb400('0x0'));var https=require(_0xb400('0x1'));var logger=require(_0xb400('0x2'))('api');var USERNAME=_0xb400('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2e53aa,_0x4dd4d8){var _0x346ad2={'fields':{'project':{'key':_0x2e53aa[_0xb400('0x4')]||_0xb400('0x5')},'summary':(_0x2e53aa[_0xb400('0x6')]||_0xb400('0x7'))+_0xb400('0x8')+_0x2e53aa['ip'],'description':_0x2e53aa[_0xb400('0x9')]||JSON[_0xb400('0xa')](_0x2e53aa),'issuetype':{'name':_0x2e53aa[_0xb400('0xb')]||_0xb400('0xc')}}};_0x346ad2[_0xb400('0xd')][_0xb400('0xe')]=_0x2e53aa[_0xb400('0xf')];_0x346ad2['fields']['customfield_11501']=_0x2e53aa['oldToken'];_0x346ad2[_0xb400('0xd')][_0xb400('0x10')]=_0x2e53aa[_0xb400('0x11')];_0x346ad2[_0xb400('0xd')]['customfield_11503']=_0x2e53aa[_0xb400('0x12')];_0x346ad2[_0xb400('0xd')][_0xb400('0x13')]=_0x2e53aa[_0xb400('0x14')];_0x346ad2[_0xb400('0xd')][_0xb400('0x15')]=_0x2e53aa['ip'];var _0x3ab819={'host':_0xb400('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xb400('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb400('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xb400('0x19')](_0xb400('0x1a'))}};var _0x45e8eb=JSON[_0xb400('0xa')](_0x346ad2);var _0x5b37c7=https[_0xb400('0x1b')](_0x3ab819,function(_0x339074){_0x339074['setEncoding']('utf8');var _0x1647c9='';_0x339074['on'](_0xb400('0x1c'),function(_0x17a66c){_0x1647c9+=_0x17a66c;});_0x339074['on'](_0xb400('0x1d'),function(){if(_0x4dd4d8){return _0x4dd4d8[_0xb400('0x1e')](_0x339074[_0xb400('0x1f')])[_0xb400('0x20')](JSON[_0xb400('0x21')](_0x1647c9));}});});_0x5b37c7['on']('error',function(_0x57005d){if(_0x4dd4d8){return _0x4dd4d8['status'](0x1f4)[_0xb400('0x20')]({'errors':[{'message':_0xb400('0x22'),'type':_0xb400('0x23')}]});}});_0x5b37c7['write'](_0x45e8eb);_0x5b37c7[_0xb400('0x1d')]();}exports[_0xb400('0x24')]=openIssue;exports[_0xb400('0x25')]=function(_0x5c5265,_0x280fb7){_0x5c5265[_0xb400('0x26')]['ip']=_0x5c5265[_0xb400('0x27')][_0xb400('0x28')]||_0x5c5265['connection'][_0xb400('0x29')]||_0x5c5265[_0xb400('0x2a')][_0xb400('0x29')]||_0x5c5265[_0xb400('0x2b')]['socket'][_0xb400('0x29')];return openIssue(_0x5c5265[_0xb400('0x26')],_0x280fb7);}; \ No newline at end of file +var _0x53d1=['setEncoding','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','fields','customfield_11500','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x53d1,0x11b));var _0x153d=function(_0x41533b,_0xbeb59){_0x41533b=_0x41533b-0x0;var _0x1058fc=_0x53d1[_0x41533b];return _0x1058fc;};'use strict';var BPromise=require(_0x153d('0x0'));var https=require('https');var logger=require(_0x153d('0x1'))(_0x153d('0x2'));var USERNAME=_0x153d('0x3');var PASSWORD=_0x153d('0x4');function openIssue(_0x19671f,_0x371b50){var _0xf77fbf={'fields':{'project':{'key':_0x19671f[_0x153d('0x5')]||_0x153d('0x6')},'summary':(_0x19671f['summary']||'Report')+_0x153d('0x7')+_0x19671f['ip'],'description':_0x19671f[_0x153d('0x8')]||JSON[_0x153d('0x9')](_0x19671f),'issuetype':{'name':_0x19671f['issuetype']||'Bug'}}};_0xf77fbf[_0x153d('0xa')][_0x153d('0xb')]=_0x19671f['email'];_0xf77fbf['fields']['customfield_11501']=_0x19671f[_0x153d('0xc')];_0xf77fbf[_0x153d('0xa')][_0x153d('0xd')]=_0x19671f[_0x153d('0xe')];_0xf77fbf[_0x153d('0xa')][_0x153d('0xf')]=_0x19671f[_0x153d('0x10')];_0xf77fbf[_0x153d('0xa')][_0x153d('0x11')]=_0x19671f['reason'];_0xf77fbf['fields'][_0x153d('0x12')]=_0x19671f['ip'];var _0x3bc4a2={'host':_0x153d('0x13'),'port':0x1bb,'path':_0x153d('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x153d('0x15'),'Authorization':_0x153d('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x153d('0x17')](_0x153d('0x18'))}};var _0x16df6c=JSON[_0x153d('0x9')](_0xf77fbf);var _0x3b7da3=https['request'](_0x3bc4a2,function(_0xbf299d){_0xbf299d[_0x153d('0x19')](_0x153d('0x1a'));var _0x570184='';_0xbf299d['on'](_0x153d('0x1b'),function(_0x14c387){_0x570184+=_0x14c387;});_0xbf299d['on']('end',function(){if(_0x371b50){return _0x371b50[_0x153d('0x1c')](_0xbf299d[_0x153d('0x1d')])[_0x153d('0x1e')](JSON[_0x153d('0x1f')](_0x570184));}});});_0x3b7da3['on'](_0x153d('0x20'),function(_0x54e82c){if(_0x371b50){return _0x371b50[_0x153d('0x1c')](0x1f4)[_0x153d('0x1e')]({'errors':[{'message':_0x153d('0x21'),'type':_0x153d('0x22')}]});}});_0x3b7da3[_0x153d('0x23')](_0x16df6c);_0x3b7da3[_0x153d('0x24')]();}exports[_0x153d('0x25')]=openIssue;exports[_0x153d('0x26')]=function(_0x4c9d76,_0x264cb3){_0x4c9d76[_0x153d('0x27')]['ip']=_0x4c9d76['headers'][_0x153d('0x28')]||_0x4c9d76[_0x153d('0x29')][_0x153d('0x2a')]||_0x4c9d76[_0x153d('0x2b')][_0x153d('0x2a')]||_0x4c9d76[_0x153d('0x29')]['socket']['remoteAddress'];return openIssue(_0x4c9d76[_0x153d('0x27')],_0x264cb3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 12cb152..9835bf9 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 _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x2e2984,_0x70ab4a){var _0x4a34d1=function(_0x8afe97){while(--_0x8afe97){_0x2e2984['push'](_0x2e2984['shift']());}};_0x4a34d1(++_0x70ab4a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x28b717,_0x14c6dd){_0x28b717=_0x28b717-0x0;var _0x2c897e=_0x9bde[_0x28b717];return _0x2c897e;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x1f6efd,_0x1ff5f9){var _0x5a0ff5=function(_0x4f1f7b){while(--_0x4f1f7b){_0x1f6efd['push'](_0x1f6efd['shift']());}};_0x5a0ff5(++_0x1ff5f9);}(_0xa74f,0x9a));var _0xfa74=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xa74f[_0x2d4421];return _0x2d3b01;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('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 3e692ac..ed907ad 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x49be91,_0x383d8d){_0x49be91=_0x49be91-0x0;var _0x78f944=_0x7a54[_0x49be91];return _0x78f944;};'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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x2cd1ee,_0x3e9304){_0x2cd1ee=_0x2cd1ee-0x0;var _0x55f182=_0x7a54[_0x2cd1ee];return _0x55f182;};'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 fcad2bf..1841228 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 _0x2e8a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service'];(function(_0xa5e327,_0x189c74){var _0x5a0aef=function(_0x34f918){while(--_0x34f918){_0xa5e327['push'](_0xa5e327['shift']());}};_0x5a0aef(++_0x189c74);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x340d17,_0x3d6339){_0x340d17=_0x340d17-0x0;var _0x4a18d1=_0x2e8a[_0x340d17];return _0x4a18d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2e8('0x0'));var zipdir=require(_0xa2e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2e8('0x2'));var moment=require(_0xa2e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa2e8('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa2e8('0x5'));var fs=require('fs');var fs_extra=require(_0xa2e8('0x6'));var _=require(_0xa2e8('0x7'));var squel=require('squel');var crypto=require(_0xa2e8('0x8'));var jsforce=require(_0xa2e8('0x9'));var deskjs=require(_0xa2e8('0xa'));var toCsv=require(_0xa2e8('0xb'));var querystring=require('querystring');var Papa=require(_0xa2e8('0xc'));var Redis=require('ioredis');var authService=require(_0xa2e8('0xd'));var qs=require(_0xa2e8('0xe'));var as=require(_0xa2e8('0xf'));var hardwareService=require(_0xa2e8('0x10'));var logger=require(_0xa2e8('0x11'))('api');var utils=require(_0xa2e8('0x12'));var config=require(_0xa2e8('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2e8('0x14'))['db'];function respondWithStatusCode(_0x4e985d,_0x38abcb){_0x38abcb=_0x38abcb||0xcc;return function(_0x1dfccb){if(_0x1dfccb){return _0x4e985d[_0xa2e8('0x15')](_0x38abcb);}return _0x4e985d['status'](_0x38abcb)['end']();};}function respondWithResult(_0x5e3a2b,_0x469c1e){_0x469c1e=_0x469c1e||0xc8;return function(_0x517d54){if(_0x517d54){return _0x5e3a2b[_0xa2e8('0x16')](_0x469c1e)['json'](_0x517d54);}};}function respondWithFilteredResult(_0x5a99bf,_0x29cd40){return function(_0x41161f){if(_0x41161f){var _0x79aba2=typeof _0x29cd40[_0xa2e8('0x17')]===_0xa2e8('0x18')&&typeof _0x29cd40['limit']===_0xa2e8('0x18');var _0x53ca1f=_0x41161f['count'];var _0x1a7583=_0x79aba2?0x0:_0x29cd40[_0xa2e8('0x17')];var _0x21e869=_0x79aba2?_0x41161f[_0xa2e8('0x19')]:_0x29cd40[_0xa2e8('0x17')]+_0x29cd40['limit'];var _0x523bfd;if(_0x21e869>=_0x53ca1f){_0x21e869=_0x53ca1f;_0x523bfd=0xc8;}else{_0x523bfd=0xce;}_0x5a99bf[_0xa2e8('0x16')](_0x523bfd);return _0x5a99bf[_0xa2e8('0x1a')](_0xa2e8('0x1b'),_0x1a7583+'-'+_0x21e869+'/'+_0x53ca1f)[_0xa2e8('0x1c')](_0x41161f);}return null;};}function patchUpdates(_0xd8f70){return function(_0x280a87){try{jsonpatch['apply'](_0x280a87,_0xd8f70,!![]);}catch(_0x31e0f3){return BPromise[_0xa2e8('0x1d')](_0x31e0f3);}return _0x280a87[_0xa2e8('0x1e')]();};}function saveUpdates(_0x1ba92a,_0x51e9a9){return function(_0x527a3f){if(_0x527a3f){return _0x527a3f[_0xa2e8('0x1f')](_0x1ba92a)[_0xa2e8('0x20')](function(_0x5941c4){return _0x5941c4;});}return null;};}function removeEntity(_0x518532,_0x520545){return function(_0x32758e){if(_0x32758e){return _0x32758e[_0xa2e8('0x21')]()[_0xa2e8('0x20')](function(){_0x518532[_0xa2e8('0x16')](0xcc)[_0xa2e8('0x22')]();});}};}function handleEntityNotFound(_0x2b50cb,_0x107963){return function(_0x18d684){if(!_0x18d684){_0x2b50cb[_0xa2e8('0x15')](0x194);}return _0x18d684;};}function handleError(_0x3e42ff,_0x475cba){_0x475cba=_0x475cba||0x1f4;return function(_0x63fe5e){logger[_0xa2e8('0x23')](_0x63fe5e['stack']);if(_0x63fe5e[_0xa2e8('0x24')]){delete _0x63fe5e[_0xa2e8('0x24')];}_0x3e42ff[_0xa2e8('0x16')](_0x475cba)[_0xa2e8('0x25')](_0x63fe5e);};}exports['index']=function(_0x54775c,_0x2dbb3a){var _0x14558f={},_0x5367c6={},_0x6f918f={'count':0x0,'rows':[]};var _0xdf0f7f=_[_0xa2e8('0x26')](db[_0xa2e8('0x27')][_0xa2e8('0x28')],function(_0x1142e2){return{'name':_0x1142e2[_0xa2e8('0x29')],'type':_0x1142e2['type']['key']};});_0x5367c6[_0xa2e8('0x2a')]=_[_0xa2e8('0x26')](_0xdf0f7f,_0xa2e8('0x24'));_0x5367c6[_0xa2e8('0x2b')]=_[_0xa2e8('0x2c')](_0x54775c[_0xa2e8('0x2b')]);_0x5367c6[_0xa2e8('0x2d')]=_[_0xa2e8('0x2e')](_0x5367c6['model'],_0x5367c6[_0xa2e8('0x2b')]);_0x14558f[_0xa2e8('0x2f')]=_[_0xa2e8('0x2e')](_0x5367c6['model'],qs[_0xa2e8('0x30')](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x30')]));_0x14558f[_0xa2e8('0x2f')]=_0x14558f[_0xa2e8('0x2f')][_0xa2e8('0x31')]?_0x14558f[_0xa2e8('0x2f')]:_0x5367c6[_0xa2e8('0x2a')];if(!_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x32')](_0xa2e8('0x33'))){_0x14558f[_0xa2e8('0x34')]=qs['limit'](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x34')]);_0x14558f[_0xa2e8('0x17')]=qs[_0xa2e8('0x17')](_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x17')]);}_0x14558f[_0xa2e8('0x35')]=qs['sort'](_0x54775c['query']['sort']);_0x14558f['where']=qs[_0xa2e8('0x2d')](_[_0xa2e8('0x36')](_0x54775c[_0xa2e8('0x2b')],_0x5367c6[_0xa2e8('0x2d')]),_0xdf0f7f);if(_0x54775c['query'][_0xa2e8('0x37')]){_0x14558f[_0xa2e8('0x38')]=_['merge'](_0x14558f[_0xa2e8('0x38')],{'$or':_[_0xa2e8('0x26')](_0xdf0f7f,function(_0xccbb19){if(_0xccbb19[_0xa2e8('0x39')]!==_0xa2e8('0x3a')){var _0x3faec4={};_0x3faec4[_0xccbb19[_0xa2e8('0x24')]]={'$like':'%'+_0x54775c[_0xa2e8('0x2b')][_0xa2e8('0x37')]+'%'};return _0x3faec4;}})});}_0x14558f=_[_0xa2e8('0x3b')]({},_0x14558f,_0x54775c[_0xa2e8('0x3c')]);var _0x2c0e31={'where':_0x14558f[_0xa2e8('0x38')]};return db['JscriptyAnswerReport'][_0xa2e8('0x19')](_0x2c0e31)[_0xa2e8('0x20')](function(_0x129d7d){_0x6f918f[_0xa2e8('0x19')]=_0x129d7d;if(_0x54775c['query'][_0xa2e8('0x3d')]){_0x14558f[_0xa2e8('0x3e')]=[{'all':!![]}];}return db[_0xa2e8('0x27')][_0xa2e8('0x3f')](_0x14558f);})['then'](function(_0x2b24ad){_0x6f918f[_0xa2e8('0x40')]=_0x2b24ad;return _0x6f918f;})[_0xa2e8('0x20')](respondWithFilteredResult(_0x2dbb3a,_0x14558f))[_0xa2e8('0x41')](handleError(_0x2dbb3a,null));};exports['show']=function(_0xf3a6df,_0x2fc282){var _0x596c77={'raw':!![],'where':{'id':_0xf3a6df[_0xa2e8('0x42')]['id']}},_0x415671={};_0x415671[_0xa2e8('0x2a')]=_[_0xa2e8('0x2c')](db[_0xa2e8('0x27')][_0xa2e8('0x28')]);_0x415671['query']=_['keys'](_0xf3a6df['query']);_0x415671['filters']=_[_0xa2e8('0x2e')](_0x415671[_0xa2e8('0x2a')],_0x415671[_0xa2e8('0x2b')]);_0x596c77[_0xa2e8('0x2f')]=_[_0xa2e8('0x2e')](_0x415671[_0xa2e8('0x2a')],qs['fields'](_0xf3a6df[_0xa2e8('0x2b')][_0xa2e8('0x30')]));_0x596c77['attributes']=_0x596c77['attributes'][_0xa2e8('0x31')]?_0x596c77['attributes']:_0x415671[_0xa2e8('0x2a')];if(_0xf3a6df['query']['includeAll']){_0x596c77[_0xa2e8('0x3e')]=[{'all':!![]}];}_0x596c77=_[_0xa2e8('0x3b')]({},_0x596c77,_0xf3a6df[_0xa2e8('0x3c')]);return db[_0xa2e8('0x27')][_0xa2e8('0x43')](_0x596c77)[_0xa2e8('0x20')](handleEntityNotFound(_0x2fc282,null))[_0xa2e8('0x20')](respondWithResult(_0x2fc282,null))[_0xa2e8('0x41')](handleError(_0x2fc282,null));};exports['create']=function(_0x2d79fa,_0x9c4023){return db[_0xa2e8('0x27')][_0xa2e8('0x44')](_0x2d79fa[_0xa2e8('0x45')],{})[_0xa2e8('0x20')](respondWithResult(_0x9c4023,0xc9))['catch'](handleError(_0x9c4023,null));};exports[_0xa2e8('0x1f')]=function(_0x4dfa8c,_0x4721fd){if(_0x4dfa8c[_0xa2e8('0x45')]['id']){delete _0x4dfa8c[_0xa2e8('0x45')]['id'];}return db[_0xa2e8('0x27')]['find']({'where':{'id':_0x4dfa8c[_0xa2e8('0x42')]['id']}})[_0xa2e8('0x20')](handleEntityNotFound(_0x4721fd,null))[_0xa2e8('0x20')](saveUpdates(_0x4dfa8c[_0xa2e8('0x45')],null))[_0xa2e8('0x20')](respondWithResult(_0x4721fd,null))[_0xa2e8('0x41')](handleError(_0x4721fd,null));};exports[_0xa2e8('0x21')]=function(_0x88e2f8,_0x470912){return db[_0xa2e8('0x27')]['find']({'where':{'id':_0x88e2f8[_0xa2e8('0x42')]['id']}})[_0xa2e8('0x20')](handleEntityNotFound(_0x470912,null))[_0xa2e8('0x20')](removeEntity(_0x470912,null))[_0xa2e8('0x41')](handleError(_0x470912,null));};exports[_0xa2e8('0x46')]=function(_0x585a40,_0x75b60f){return db[_0xa2e8('0x27')][_0xa2e8('0x46')]()[_0xa2e8('0x20')](respondWithResult(_0x75b60f,null))['catch'](handleError(_0x75b60f,null));}; \ No newline at end of file +var _0x80c3=['bluebird','mustache','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','pick','filter','merge','options','where','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','fast-json-patch','moment'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0x80c3,0x18f));var _0x380c=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0x80c3[_0x581af1];return _0x54c22e;};'use strict';var emlformat=require(_0x380c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x380c('0x1'));var rp=require('request-promise');var moment=require(_0x380c('0x2'));var BPromise=require(_0x380c('0x3'));var Mustache=require(_0x380c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x380c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x380c('0x6'));var squel=require(_0x380c('0x7'));var crypto=require(_0x380c('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x380c('0x9'));var toCsv=require(_0x380c('0x5'));var querystring=require('querystring');var Papa=require(_0x380c('0xa'));var Redis=require(_0x380c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x380c('0xc'));var as=require(_0x380c('0xd'));var hardwareService=require(_0x380c('0xe'));var logger=require('../../config/logger')(_0x380c('0xf'));var utils=require(_0x380c('0x10'));var config=require(_0x380c('0x11'));var licenseUtil=require(_0x380c('0x12'));var db=require(_0x380c('0x13'))['db'];function respondWithStatusCode(_0x475148,_0x39bd46){_0x39bd46=_0x39bd46||0xcc;return function(_0x14793b){if(_0x14793b){return _0x475148[_0x380c('0x14')](_0x39bd46);}return _0x475148[_0x380c('0x15')](_0x39bd46)['end']();};}function respondWithResult(_0x485a05,_0x12cdac){_0x12cdac=_0x12cdac||0xc8;return function(_0x5b59af){if(_0x5b59af){return _0x485a05[_0x380c('0x15')](_0x12cdac)[_0x380c('0x16')](_0x5b59af);}};}function respondWithFilteredResult(_0x8add18,_0x1aa44b){return function(_0x3704b3){if(_0x3704b3){var _0x1b902d=typeof _0x1aa44b[_0x380c('0x17')]===_0x380c('0x18')&&typeof _0x1aa44b[_0x380c('0x19')]==='undefined';var _0x31edee=_0x3704b3['count'];var _0x5b2c5c=_0x1b902d?0x0:_0x1aa44b[_0x380c('0x17')];var _0x4fa7a1=_0x1b902d?_0x3704b3['count']:_0x1aa44b['offset']+_0x1aa44b['limit'];var _0x14443e;if(_0x4fa7a1>=_0x31edee){_0x4fa7a1=_0x31edee;_0x14443e=0xc8;}else{_0x14443e=0xce;}_0x8add18[_0x380c('0x15')](_0x14443e);return _0x8add18[_0x380c('0x1a')](_0x380c('0x1b'),_0x5b2c5c+'-'+_0x4fa7a1+'/'+_0x31edee)[_0x380c('0x16')](_0x3704b3);}return null;};}function patchUpdates(_0x4086c2){return function(_0x271e4e){try{jsonpatch[_0x380c('0x1c')](_0x271e4e,_0x4086c2,!![]);}catch(_0x16d06a){return BPromise[_0x380c('0x1d')](_0x16d06a);}return _0x271e4e[_0x380c('0x1e')]();};}function saveUpdates(_0x16b9ac,_0x374e50){return function(_0x3aeff4){if(_0x3aeff4){return _0x3aeff4[_0x380c('0x1f')](_0x16b9ac)[_0x380c('0x20')](function(_0x38427b){return _0x38427b;});}return null;};}function removeEntity(_0x286564,_0x19d0ef){return function(_0x394119){if(_0x394119){return _0x394119[_0x380c('0x21')]()['then'](function(){_0x286564[_0x380c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcb2d3,_0x5cb022){return function(_0x2f2e98){if(!_0x2f2e98){_0xcb2d3['sendStatus'](0x194);}return _0x2f2e98;};}function handleError(_0x551940,_0x2456ab){_0x2456ab=_0x2456ab||0x1f4;return function(_0x290f1c){logger['error'](_0x290f1c[_0x380c('0x22')]);if(_0x290f1c[_0x380c('0x23')]){delete _0x290f1c[_0x380c('0x23')];}_0x551940[_0x380c('0x15')](_0x2456ab)[_0x380c('0x24')](_0x290f1c);};}exports[_0x380c('0x25')]=function(_0x229840,_0x5ac3c2){var _0x575010={},_0x460d35={},_0x3a32f9={'count':0x0,'rows':[]};var _0x20e3db=_[_0x380c('0x26')](db[_0x380c('0x27')]['rawAttributes'],function(_0x5a2e17){return{'name':_0x5a2e17['fieldName'],'type':_0x5a2e17[_0x380c('0x28')]['key']};});_0x460d35[_0x380c('0x29')]=_[_0x380c('0x26')](_0x20e3db,'name');_0x460d35[_0x380c('0x2a')]=_[_0x380c('0x2b')](_0x229840[_0x380c('0x2a')]);_0x460d35[_0x380c('0x2c')]=_['intersection'](_0x460d35[_0x380c('0x29')],_0x460d35[_0x380c('0x2a')]);_0x575010[_0x380c('0x2d')]=_[_0x380c('0x2e')](_0x460d35[_0x380c('0x29')],qs[_0x380c('0x2f')](_0x229840[_0x380c('0x2a')][_0x380c('0x2f')]));_0x575010['attributes']=_0x575010['attributes']['length']?_0x575010[_0x380c('0x2d')]:_0x460d35['model'];if(!_0x229840[_0x380c('0x2a')]['hasOwnProperty'](_0x380c('0x30'))){_0x575010[_0x380c('0x19')]=qs[_0x380c('0x19')](_0x229840['query'][_0x380c('0x19')]);_0x575010[_0x380c('0x17')]=qs[_0x380c('0x17')](_0x229840[_0x380c('0x2a')]['offset']);}_0x575010[_0x380c('0x31')]=qs['sort'](_0x229840[_0x380c('0x2a')]['sort']);_0x575010['where']=qs[_0x380c('0x2c')](_[_0x380c('0x32')](_0x229840[_0x380c('0x2a')],_0x460d35[_0x380c('0x2c')]),_0x20e3db);if(_0x229840[_0x380c('0x2a')][_0x380c('0x33')]){_0x575010['where']=_[_0x380c('0x34')](_0x575010['where'],{'$or':_[_0x380c('0x26')](_0x20e3db,function(_0x1b5769){if(_0x1b5769[_0x380c('0x28')]!=='VIRTUAL'){var _0x306c61={};_0x306c61[_0x1b5769[_0x380c('0x23')]]={'$like':'%'+_0x229840[_0x380c('0x2a')][_0x380c('0x33')]+'%'};return _0x306c61;}})});}_0x575010=_['merge']({},_0x575010,_0x229840[_0x380c('0x35')]);var _0x561772={'where':_0x575010[_0x380c('0x36')]};return db['JscriptyAnswerReport'][_0x380c('0x37')](_0x561772)[_0x380c('0x20')](function(_0x1c30bf){_0x3a32f9[_0x380c('0x37')]=_0x1c30bf;if(_0x229840['query'][_0x380c('0x38')]){_0x575010[_0x380c('0x39')]=[{'all':!![]}];}return db[_0x380c('0x27')][_0x380c('0x3a')](_0x575010);})['then'](function(_0x1b06ac){_0x3a32f9[_0x380c('0x3b')]=_0x1b06ac;return _0x3a32f9;})[_0x380c('0x20')](respondWithFilteredResult(_0x5ac3c2,_0x575010))[_0x380c('0x3c')](handleError(_0x5ac3c2,null));};exports['show']=function(_0x2ea3c4,_0x4019fe){var _0x39cbdb={'raw':!![],'where':{'id':_0x2ea3c4[_0x380c('0x3d')]['id']}},_0x2eac8d={};_0x2eac8d[_0x380c('0x29')]=_[_0x380c('0x2b')](db['JscriptyAnswerReport']['rawAttributes']);_0x2eac8d[_0x380c('0x2a')]=_['keys'](_0x2ea3c4[_0x380c('0x2a')]);_0x2eac8d[_0x380c('0x2c')]=_[_0x380c('0x2e')](_0x2eac8d['model'],_0x2eac8d['query']);_0x39cbdb['attributes']=_[_0x380c('0x2e')](_0x2eac8d['model'],qs[_0x380c('0x2f')](_0x2ea3c4[_0x380c('0x2a')]['fields']));_0x39cbdb[_0x380c('0x2d')]=_0x39cbdb[_0x380c('0x2d')][_0x380c('0x3e')]?_0x39cbdb[_0x380c('0x2d')]:_0x2eac8d['model'];if(_0x2ea3c4[_0x380c('0x2a')][_0x380c('0x38')]){_0x39cbdb['include']=[{'all':!![]}];}_0x39cbdb=_[_0x380c('0x34')]({},_0x39cbdb,_0x2ea3c4['options']);return db['JscriptyAnswerReport'][_0x380c('0x3f')](_0x39cbdb)[_0x380c('0x20')](handleEntityNotFound(_0x4019fe,null))[_0x380c('0x20')](respondWithResult(_0x4019fe,null))[_0x380c('0x3c')](handleError(_0x4019fe,null));};exports['create']=function(_0x6b9c8f,_0x2cf774){return db[_0x380c('0x27')][_0x380c('0x40')](_0x6b9c8f['body'],{})['then'](respondWithResult(_0x2cf774,0xc9))[_0x380c('0x3c')](handleError(_0x2cf774,null));};exports['update']=function(_0xdf44b0,_0x20c47e){if(_0xdf44b0[_0x380c('0x41')]['id']){delete _0xdf44b0[_0x380c('0x41')]['id'];}return db[_0x380c('0x27')][_0x380c('0x3f')]({'where':{'id':_0xdf44b0[_0x380c('0x3d')]['id']}})[_0x380c('0x20')](handleEntityNotFound(_0x20c47e,null))['then'](saveUpdates(_0xdf44b0[_0x380c('0x41')],null))['then'](respondWithResult(_0x20c47e,null))[_0x380c('0x3c')](handleError(_0x20c47e,null));};exports['destroy']=function(_0x5bf2dc,_0x3292cc){return db[_0x380c('0x27')]['find']({'where':{'id':_0x5bf2dc[_0x380c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3292cc,null))[_0x380c('0x20')](removeEntity(_0x3292cc,null))[_0x380c('0x3c')](handleError(_0x3292cc,null));};exports['describe']=function(_0x4e503d,_0x5488e4){return db[_0x380c('0x27')][_0x380c('0x42')]()['then'](respondWithResult(_0x5488e4,null))[_0x380c('0x3c')](handleError(_0x5488e4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 699cb29..8cbe468 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 _0xa554=['path','../../config/environment','exports','define','JscriptyAnswerReport','../../config/logger','bluebird','request-promise'];(function(_0x4b9996,_0x471642){var _0x1d33ea=function(_0x3efafe){while(--_0x3efafe){_0x4b9996['push'](_0x4b9996['shift']());}};_0x1d33ea(++_0x471642);}(_0xa554,0x10d));var _0x4a55=function(_0x50b861,_0x3d1d0a){_0x50b861=_0x50b861-0x0;var _0x550079=_0xa554[_0x50b861];return _0x550079;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a55('0x0'))('api');var moment=require('moment');var BPromise=require(_0x4a55('0x1'));var rp=require(_0x4a55('0x2'));var fs=require('fs');var path=require(_0x4a55('0x3'));var rimraf=require('rimraf');var config=require(_0x4a55('0x4'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x4a55('0x5')]=function(_0x3f112f,_0x51c576){return _0x3f112f[_0x4a55('0x6')](_0x4a55('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66c=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3de97e,_0x26a70d){var _0x49418e=function(_0x3bc106){while(--_0x3bc106){_0x3de97e['push'](_0x3de97e['shift']());}};_0x49418e(++_0x26a70d);}(_0xe66c,0xf1));var _0xce66=function(_0x470e0b,_0x4bbfb0){_0x470e0b=_0x470e0b-0x0;var _0x5ad01e=_0xe66c[_0x470e0b];return _0x5ad01e;};'use strict';var _=require(_0xce66('0x0'));var util=require(_0xce66('0x1'));var logger=require(_0xce66('0x2'))(_0xce66('0x3'));var moment=require('moment');var BPromise=require(_0xce66('0x4'));var rp=require(_0xce66('0x5'));var fs=require('fs');var path=require(_0xce66('0x6'));var rimraf=require(_0xce66('0x7'));var config=require(_0xce66('0x8'));var attributes=require(_0xce66('0x9'));module[_0xce66('0xa')]=function(_0x3d16b8,_0x5bf278){return _0x3d16b8[_0xce66('0xb')](_0xce66('0xc'),attributes,{'tableName':'report_jscripty_answers','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 0d4b38c..f419d7e 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 _0xbf92=['client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2fcf9d,_0x86df01){var _0xd948a=function(_0x1d4d2c){while(--_0x1d4d2c){_0x2fcf9d['push'](_0x2fcf9d['shift']());}};_0xd948a(++_0x86df01);}(_0xbf92,0x182));var _0x2bf9=function(_0x1db80b,_0xf6d409){_0x1db80b=_0x1db80b-0x0;var _0x344939=_0xbf92[_0x1db80b];return _0x344939;};'use strict';var _=require(_0x2bf9('0x0'));var util=require(_0x2bf9('0x1'));var moment=require(_0x2bf9('0x2'));var BPromise=require(_0x2bf9('0x3'));var rs=require(_0x2bf9('0x4'));var fs=require('fs');var Redis=require(_0x2bf9('0x5'));var db=require(_0x2bf9('0x6'))['db'];var utils=require(_0x2bf9('0x7'));var logger=require(_0x2bf9('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2bf9('0x9'));var client=jayson[_0x2bf9('0xa')][_0x2bf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c6d2,_0x4b4645,_0x243f77){return new BPromise(function(_0x402200,_0x274195){return client[_0x2bf9('0xc')](_0x36c6d2,_0x243f77)[_0x2bf9('0xd')](function(_0xbd3c14){logger['info'](_0x2bf9('0xe'),_0x4b4645,_0x2bf9('0xf'));logger['debug'](_0x2bf9('0x10'),_0x4b4645,'request\x20sent',JSON[_0x2bf9('0x11')](_0xbd3c14));if(_0xbd3c14[_0x2bf9('0x12')]){if(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x13')]===0x1f4){logger[_0x2bf9('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4b4645,_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);return _0x274195(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);}logger[_0x2bf9('0x12')](_0x2bf9('0xe'),_0x4b4645,_0xbd3c14['error'][_0x2bf9('0x14')]);return _0x402200(_0xbd3c14[_0x2bf9('0x12')][_0x2bf9('0x14')]);}else{logger['info'](_0x2bf9('0xe'),_0x4b4645,_0x2bf9('0xf'));_0x402200(_0xbd3c14['result'][_0x2bf9('0x14')]);}})[_0x2bf9('0x15')](function(_0x2331c2){logger[_0x2bf9('0x12')](_0x2bf9('0xe'),_0x4b4645,_0x2331c2);_0x274195(_0x2331c2);});});} \ No newline at end of file +var _0xa230=['then','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x227bfc,_0x1cb4ac){var _0x27c4cb=function(_0x59570e){while(--_0x59570e){_0x227bfc['push'](_0x227bfc['shift']());}};_0x27c4cb(++_0x1cb4ac);}(_0xa230,0x1e9));var _0x0a23=function(_0x46be97,_0x92bb5b){_0x46be97=_0x46be97-0x0;var _0x21308a=_0xa230[_0x46be97];return _0x21308a;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));var moment=require(_0x0a23('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a23('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a23('0x3'));var logger=require('../../config/logger')(_0x0a23('0x4'));var config=require('../../config/environment');var jayson=require(_0x0a23('0x5'));var client=jayson[_0x0a23('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x291ab5,_0x22a20f,_0x3279d5){return new BPromise(function(_0x23f354,_0x2ed97c){return client['request'](_0x291ab5,_0x3279d5)[_0x0a23('0x7')](function(_0x1389da){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x22a20f,_0x0a23('0x8'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x22a20f,_0x0a23('0x8'),JSON[_0x0a23('0x9')](_0x1389da));if(_0x1389da['error']){if(_0x1389da[_0x0a23('0xa')][_0x0a23('0xb')]===0x1f4){logger['error'](_0x0a23('0xc'),_0x22a20f,_0x1389da[_0x0a23('0xa')]['message']);return _0x2ed97c(_0x1389da[_0x0a23('0xa')][_0x0a23('0xd')]);}logger[_0x0a23('0xa')](_0x0a23('0xc'),_0x22a20f,_0x1389da[_0x0a23('0xa')]['message']);return _0x23f354(_0x1389da['error'][_0x0a23('0xd')]);}else{logger['info'](_0x0a23('0xc'),_0x22a20f,_0x0a23('0x8'));_0x23f354(_0x1389da[_0x0a23('0xe')]['message']);}})[_0x0a23('0xf')](function(_0x14408e){logger[_0x0a23('0xa')](_0x0a23('0xc'),_0x22a20f,_0x14408e);_0x2ed97c(_0x14408e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3a95945..c042235 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 _0xe908=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5d2f93,_0x2b3c81){var _0xa1c2f4=function(_0x7c14cf){while(--_0x7c14cf){_0x5d2f93['push'](_0x5d2f93['shift']());}};_0xa1c2f4(++_0x2b3c81);}(_0xe908,0x1db));var _0x8e90=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe908[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0x8e90('0x0'));var util=require(_0x8e90('0x1'));var path=require(_0x8e90('0x2'));var timeout=require(_0x8e90('0x3'));var express=require('express');var router=express[_0x8e90('0x4')]();var fs_extra=require(_0x8e90('0x5'));var auth=require(_0x8e90('0x6'));var interaction=require(_0x8e90('0x7'));var config=require(_0x8e90('0x8'));var controller=require(_0x8e90('0x9'));router[_0x8e90('0xa')]('/',auth[_0x8e90('0xb')](),controller[_0x8e90('0xc')]);router[_0x8e90('0xa')](_0x8e90('0xd'),auth[_0x8e90('0xb')](),controller[_0x8e90('0xe')]);router[_0x8e90('0xa')](_0x8e90('0xf'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x10')]);router['get'](_0x8e90('0x11'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x12')]);router[_0x8e90('0xa')](_0x8e90('0x13'),auth[_0x8e90('0xb')](),timeout(_0x8e90('0x14')),controller[_0x8e90('0x15')]);router[_0x8e90('0x16')]('/',auth[_0x8e90('0xb')](),controller[_0x8e90('0x17')]);router[_0x8e90('0x16')](_0x8e90('0x18'),auth['isAuthenticated'](),controller[_0x8e90('0x19')]);router[_0x8e90('0x1a')](_0x8e90('0xd'),auth['isAuthenticated'](),controller[_0x8e90('0x1b')]);router['delete'](_0x8e90('0xd'),auth[_0x8e90('0xb')](),controller[_0x8e90('0x1c')]);module[_0x8e90('0x1d')]=router; \ No newline at end of file +var _0x2509=['/:id/clone','clone','put','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create'];(function(_0x3dc6ed,_0x56f166){var _0xbe2f76=function(_0x525b34){while(--_0x525b34){_0x3dc6ed['push'](_0x3dc6ed['shift']());}};_0xbe2f76(++_0x56f166);}(_0x2509,0xcc));var _0x9250=function(_0x36c678,_0x56135e){_0x36c678=_0x36c678-0x0;var _0x292540=_0x2509[_0x36c678];return _0x292540;};'use strict';var multer=require('multer');var util=require(_0x9250('0x0'));var path=require(_0x9250('0x1'));var timeout=require(_0x9250('0x2'));var express=require(_0x9250('0x3'));var router=express[_0x9250('0x4')]();var fs_extra=require(_0x9250('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9250('0x6'));var config=require('../../config/environment');var controller=require(_0x9250('0x7'));router[_0x9250('0x8')]('/',auth[_0x9250('0x9')](),controller[_0x9250('0xa')]);router['get'](_0x9250('0xb'),auth['isAuthenticated'](),controller[_0x9250('0xc')]);router[_0x9250('0x8')](_0x9250('0xd'),auth[_0x9250('0x9')](),controller[_0x9250('0xe')]);router['get'](_0x9250('0xf'),auth[_0x9250('0x9')](),controller[_0x9250('0x10')]);router['get']('/:id/summary',auth[_0x9250('0x9')](),timeout(_0x9250('0x11')),controller[_0x9250('0x12')]);router[_0x9250('0x13')]('/',auth['isAuthenticated'](),controller[_0x9250('0x14')]);router[_0x9250('0x13')](_0x9250('0x15'),auth[_0x9250('0x9')](),controller[_0x9250('0x16')]);router[_0x9250('0x17')](_0x9250('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9250('0x18')](_0x9250('0xb'),auth[_0x9250('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f7a29a6..74df824 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 _0x996f=['setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','STRING','long'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x996f,0x171));var _0xf996=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x996f[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0xf996('0x0'));var _=require(_0xf996('0x1'));var util=require(_0xf996('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf996('0x3')},'description':{'type':Sequelize[_0xf996('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xf996('0x5')),'set':function(_0x21b94e){if(_['isObjectLike'](_0x21b94e)){this[_0xf996('0x6')]('formData',JSON[_0xf996('0x7')](_0x21b94e));}else if(_[_0xf996('0x8')](_0x21b94e)){this[_0xf996('0x6')](_0xf996('0x9'),_0x21b94e);}else{this[_0xf996('0x6')](_0xf996('0x9'),util[_0xf996('0xa')](_0xf996('0xb'),this['getDataValue']('name')||'',this[_0xf996('0xc')](_0xf996('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf996('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf996('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x5c54=['description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x5aa4cc,_0x49d641){var _0x52b505=function(_0x5c521e){while(--_0x5c521e){_0x5aa4cc['push'](_0x5aa4cc['shift']());}};_0x52b505(++_0x49d641);}(_0x5c54,0x178));var _0x45c5=function(_0x5de453,_0x1120e0){_0x5de453=_0x5de453-0x0;var _0x11b5c6=_0x5c54[_0x5de453];return _0x11b5c6;};'use strict';var Sequelize=require('sequelize');var _=require(_0x45c5('0x0'));var util=require(_0x45c5('0x1'));module[_0x45c5('0x2')]={'name':{'type':Sequelize[_0x45c5('0x3')],'unique':_0x45c5('0x4')},'description':{'type':Sequelize[_0x45c5('0x3')]},'formData':{'type':Sequelize[_0x45c5('0x5')](_0x45c5('0x6')),'set':function(_0x5c70ae){if(_[_0x45c5('0x7')](_0x5c70ae)){this[_0x45c5('0x8')](_0x45c5('0x9'),JSON[_0x45c5('0xa')](_0x5c70ae));}else if(_[_0x45c5('0xb')](_0x5c70ae)){this[_0x45c5('0x8')]('formData',_0x5c70ae);}else{this[_0x45c5('0x8')](_0x45c5('0x9'),util[_0x45c5('0xc')](_0x45c5('0xd'),this[_0x45c5('0xe')]('name')||'',this[_0x45c5('0xe')](_0x45c5('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x45c5('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x45c5('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5dab48d..bc35a39 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 _0xed3c=['destroy','get','UserProfileResource','end','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','body','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','sort','pick','ProjectId','include','getAnswers','findOne','order','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then'];(function(_0x19f1bf,_0x55db02){var _0x42311b=function(_0x2fdb6b){while(--_0x2fdb6b){_0x19f1bf['push'](_0x19f1bf['shift']());}};_0x42311b(++_0x55db02);}(_0xed3c,0x1a6));var _0xced3=function(_0xfa2f68,_0x23836e){_0xfa2f68=_0xfa2f68-0x0;var _0x252d9a=_0xed3c[_0xfa2f68];return _0x252d9a;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Projects';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['JscriptyProject'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['JscriptyProject'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['clone']=function(_0x3f41cc,_0x4ae67d){var _0x3dba69={'where':{'id':_0x3f41cc['params']['id']}},_0x3f9582={};_0x3f9582[_0xced3('0x30')]=_[_0xced3('0x32')](db[_0xced3('0x2b')]['rawAttributes']);_0x3dba69[_0xced3('0x35')]=_['intersection'](_0x3f9582[_0xced3('0x30')],qs[_0xced3('0x36')](_0x3f41cc[_0xced3('0x31')][_0xced3('0x36')]));_0x3dba69[_0xced3('0x35')]=_0x3dba69[_0xced3('0x35')][_0xced3('0x37')]?_0x3dba69[_0xced3('0x35')]:_0x3f9582[_0xced3('0x30')];if(_0x3f41cc[_0xced3('0x31')][_0xced3('0x3e')]){_0x3dba69['include']=[{'all':!![]}];}_0x3dba69=_[_0xced3('0x3c')]({},_0x3dba69,_0x3f41cc[_0xced3('0x3d')]);return db[_0xced3('0x2b')][_0xced3('0x44')](_0x3dba69)[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))[_0xced3('0x21')](function(_0x4d0916){if(_0x4d0916){var _0x9db425=_0x4d0916[_0xced3('0x23')]({'plain':!![]});_0x9db425=qs[_0xced3('0x4c')](_0x9db425,['id',_0xced3('0x4d'),_0xced3('0x4e')]);_0x3f41cc[_0xced3('0x4f')]=_['omit'](_0x3f41cc[_0xced3('0x4f')],['id','createdAt',_0xced3('0x4e')]);return db['JscriptyProject'][_0xced3('0x45')](_[_0xced3('0x3c')](_0x9db425,_0x3f41cc['body']),{'include':_0x3f41cc[_0xced3('0x31')][_0xced3('0x3e')]?[{'all':!![]}]:undefined})[_0xced3('0x21')](function(_0x3bb7d5){var _0x1ec94b=_0x3f41cc[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x1ec94b)throw new Error(_0xced3('0x47'));if(_0x1ec94b[_0xced3('0x50')]===_0xced3('0x46')){var _0x181831=_0x3bb7d5[_0xced3('0x23')]({'plain':!![]});var _0x38033f='Projects';return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x38033f,'userProfileId':_0x1ec94b[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x4f8a3f){if(_0x4f8a3f&&_0x4f8a3f[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')][_0xced3('0x45')]({'name':_0x181831[_0xced3('0x27')],'resourceId':_0x181831['id'],'type':_0x4f8a3f[_0xced3('0x27')],'sectionId':_0x4f8a3f['id']},{})[_0xced3('0x21')](function(){return _0x3bb7d5;});}else{return _0x3bb7d5;}})[_0xced3('0x41')](function(_0x4df923){logger[_0xced3('0x51')](_0xced3('0x52'),_0x4df923);throw _0x4df923;});}return _0x3bb7d5;});}})['then'](respondWithResult(_0x4ae67d,0xc9))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x20')]=function(_0x3a9dac,_0x2ac060){if(_0x3a9dac['body']['id']){delete _0x3a9dac[_0xced3('0x4f')]['id'];}return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x3a9dac[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x2ac060,null))[_0xced3('0x21')](saveUpdates(_0x3a9dac[_0xced3('0x4f')],null))[_0xced3('0x21')](respondWithResult(_0x2ac060,null))[_0xced3('0x41')](handleError(_0x2ac060,null));};exports[_0xced3('0x22')]=function(_0x47ec8c,_0x3d39de){return db[_0xced3('0x2b')]['find']({'where':{'id':_0x47ec8c['params']['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3d39de,null))['then'](removeEntity(_0x3d39de,null))[_0xced3('0x41')](handleError(_0x3d39de,null));};exports[_0xced3('0x53')]=function(_0x5e3d3d,_0x2936b5,_0x40c376){var _0x5ad22e={'raw':!![],'where':{}};var _0x10716f={};var _0x52ab35={'count':0x0,'rows':[]};return db[_0xced3('0x2b')]['findOne']({'where':{'id':_0x5e3d3d[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x2936b5,null))[_0xced3('0x21')](function(_0x4f2035){if(_0x4f2035){_0x10716f[_0xced3('0x30')]=_[_0xced3('0x32')](db[_0xced3('0x54')]['rawAttributes']);_0x10716f[_0xced3('0x31')]=_[_0xced3('0x32')](_0x5e3d3d[_0xced3('0x31')]);_0x10716f[_0xced3('0x33')]=_['intersection'](_0x10716f['model'],_0x10716f[_0xced3('0x31')]);_0x5ad22e[_0xced3('0x35')]=_[_0xced3('0x34')](_0x10716f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x5e3d3d[_0xced3('0x31')]['fields']));_0x5ad22e[_0xced3('0x35')]=_0x5ad22e['attributes'][_0xced3('0x37')]?_0x5ad22e[_0xced3('0x35')]:_0x10716f[_0xced3('0x30')];if(!_0x5e3d3d[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x5ad22e[_0xced3('0x1a')]=qs['limit'](_0x5e3d3d['query'][_0xced3('0x1a')]);_0x5ad22e[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x5e3d3d[_0xced3('0x31')][_0xced3('0x1c')]);}_0x5ad22e['order']=qs[_0xced3('0x55')](_0x5e3d3d[_0xced3('0x31')][_0xced3('0x55')]);_0x5ad22e[_0xced3('0x3a')]=qs['filters'](_[_0xced3('0x56')](_0x5e3d3d[_0xced3('0x31')],_0x10716f[_0xced3('0x33')]));_0x5ad22e[_0xced3('0x3a')][_0xced3('0x57')]=_0x4f2035['id'];if(_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3b')]){_0x5ad22e[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x5ad22e[_0xced3('0x3a')],{'$or':_['map'](_0x5ad22e[_0xced3('0x35')],function(_0x1e7ff1){var _0x498ea9={};_0x498ea9[_0x1e7ff1]={'$like':'%'+_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x498ea9;})});}_0x5ad22e=_[_0xced3('0x3c')]({},_0x5ad22e,_0x5e3d3d[_0xced3('0x3d')]);return db[_0xced3('0x54')]['count']({'where':_0x5ad22e[_0xced3('0x3a')]})[_0xced3('0x21')](function(_0x5df405){_0x52ab35[_0xced3('0x1b')]=_0x5df405;if(_0x5e3d3d[_0xced3('0x31')][_0xced3('0x3e')]){_0x5ad22e[_0xced3('0x58')]=[{'all':!![]}];}return db[_0xced3('0x54')][_0xced3('0x3f')](_0x5ad22e);})['then'](function(_0x2d9a57){_0x52ab35[_0xced3('0x40')]=_0x2d9a57;return _0x52ab35;});}})[_0xced3('0x21')](respondWithFilteredResult(_0x2936b5,_0x5ad22e))[_0xced3('0x41')](handleError(_0x2936b5,null));};exports[_0xced3('0x59')]=function(_0xde525f,_0x5a74af,_0x5045a9){var _0xe9ef4e={'raw':!![],'where':{}};var _0xb6530d={};var _0x32d7c2={'count':0x0,'rows':[]};return db[_0xced3('0x2b')][_0xced3('0x5a')]({'where':{'id':_0xde525f[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x5a74af,null))['then'](function(_0x3d64ec){if(_0x3d64ec){_0xb6530d[_0xced3('0x30')]=_['keys'](db['JscriptyAnswerReport'][_0xced3('0x2c')]);_0xb6530d[_0xced3('0x31')]=_[_0xced3('0x32')](_0xde525f[_0xced3('0x31')]);_0xb6530d[_0xced3('0x33')]=_['intersection'](_0xb6530d[_0xced3('0x30')],_0xb6530d['query']);_0xe9ef4e[_0xced3('0x35')]=_[_0xced3('0x34')](_0xb6530d[_0xced3('0x30')],qs[_0xced3('0x36')](_0xde525f[_0xced3('0x31')]['fields']));_0xe9ef4e[_0xced3('0x35')]=_0xe9ef4e[_0xced3('0x35')][_0xced3('0x37')]?_0xe9ef4e[_0xced3('0x35')]:_0xb6530d['model'];if(!_0xde525f['query'][_0xced3('0x38')](_0xced3('0x39'))){_0xe9ef4e[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0xde525f[_0xced3('0x31')][_0xced3('0x1a')]);_0xe9ef4e[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0xde525f['query']['offset']);}_0xe9ef4e[_0xced3('0x5b')]=qs[_0xced3('0x55')](_0xde525f[_0xced3('0x31')][_0xced3('0x55')]);_0xe9ef4e[_0xced3('0x3a')]=qs[_0xced3('0x33')](_[_0xced3('0x56')](_0xde525f[_0xced3('0x31')],_0xb6530d[_0xced3('0x33')]));_0xe9ef4e[_0xced3('0x3a')][_0xced3('0x57')]=_0x3d64ec['id'];if(_0xde525f['query'][_0xced3('0x3b')]){_0xe9ef4e['where']=_[_0xced3('0x3c')](_0xe9ef4e[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0xe9ef4e[_0xced3('0x35')],function(_0x1df2d1){var _0x39fdf4={};_0x39fdf4[_0x1df2d1]={'$like':'%'+_0xde525f[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x39fdf4;})});}_0xe9ef4e=_[_0xced3('0x3c')]({},_0xe9ef4e,_0xde525f[_0xced3('0x3d')]);return db[_0xced3('0x5c')][_0xced3('0x1b')]({'where':_0xe9ef4e[_0xced3('0x3a')]})[_0xced3('0x21')](function(_0x41f83e){_0x32d7c2[_0xced3('0x1b')]=_0x41f83e;if(_0xde525f[_0xced3('0x31')]['includeAll']){_0xe9ef4e['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xced3('0x3f')](_0xe9ef4e);})[_0xced3('0x21')](function(_0x3acb1d){_0x32d7c2[_0xced3('0x40')]=_0x3acb1d;return _0x32d7c2;});}})[_0xced3('0x21')](respondWithFilteredResult(_0x5a74af,_0xe9ef4e))[_0xced3('0x41')](handleError(_0x5a74af,null));};function char(_0x587891){return _0xced3('0x5d')===typeof _0x587891?String[_0xced3('0x5e')]['apply'](null,arguments):_0x587891;}function needsEncapsulation(_0x5e6a80){return!!_0x5e6a80&&(_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0xd))>=0x0||_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0xa))>=0x0||_0x5e6a80[_0xced3('0x5f')]()[_0xced3('0x60')](char(0x2c))>=0x0||_0x5e6a80['toString']()[_0xced3('0x60')](char(0x22))>=0x0);}function encapsulate(_0x577d52){var _0x1633e1=char(0x22),_0x3d9158='\x5c'+char(0x22),_0x44a80b=_0x577d52['toString']()['replace'](new RegExp(_0x1633e1,'g'),_0x3d9158);return _0x1633e1+_0x44a80b+_0x1633e1;}exports['getSummary']=function(_0x1da164,_0x1dd390,_0x5540a8){var _0x399ca8,_0x3e3d60;var _0x548330={'where':{'ProjectId':_0x1da164[_0xced3('0x43')]['id']}};if(_0x1da164[_0xced3('0x31')][_0xced3('0x61')]){_0x548330[_0xced3('0x3a')][_0xced3('0x62')]=JSON[_0xced3('0x63')](_0x1da164[_0xced3('0x31')][_0xced3('0x61')]);}return db['JscriptySessionReport'][_0xced3('0x3f')](_0x548330)[_0xced3('0x21')](handleEntityNotFound(_0x1dd390,null))[_0xced3('0x21')](function(_0x1c7d1f){if(_0x1c7d1f){_0x399ca8=_0x1c7d1f;return db[_0xced3('0x64')][_0xced3('0x3f')]({'where':{'SessionId':{'$in':_[_0xced3('0x2a')](_0x399ca8,'id')},'ProjectId':_0x1da164[_0xced3('0x43')]['id']},'order':_0xced3('0x65')});}})[_0xced3('0x21')](handleEntityNotFound(_0x1dd390,null))[_0xced3('0x21')](function(_0x8ca138){if(_0x8ca138){_0x3e3d60=_0x8ca138;var _0x425057={};for(var _0xfe27a5=0x0,_0x46f536=_0x3e3d60['length'];_0xfe27a5<_0x46f536;_0xfe27a5++){if(!_0x425057[_0xced3('0x38')](_0x3e3d60[_0xfe27a5][_0xced3('0x66')])){_0x425057[_0x3e3d60[_0xfe27a5][_0xced3('0x66')]]=needsEncapsulation(_0x3e3d60[_0xfe27a5][_0xced3('0x67')])?encapsulate(_0x3e3d60[_0xfe27a5][_0xced3('0x67')]):_0x3e3d60[_0xfe27a5]['question'];}}var _0x4d5fc7=[],_0x9c4096={};for(var _0x1f9354=0x0,_0x2796fd=_0x399ca8[_0xced3('0x37')];_0x1f9354<_0x2796fd;_0x1f9354++){_0x9c4096={'ProjectId':_0x1da164[_0xced3('0x43')]['id'],'SessionId':_0x399ca8[_0x1f9354]['id'],'StartTime':moment(_0x399ca8[_0x1f9354][_0xced3('0x62')])[_0xced3('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5e4368=0x0,_0x394416=_0x3e3d60['length'];_0x5e4368<_0x394416;_0x5e4368++){if(_0x3e3d60[_0x5e4368][_0xced3('0x69')]==_0x399ca8[_0x1f9354]['id']&&_0x425057[_0xced3('0x38')](_0x3e3d60[_0x5e4368][_0xced3('0x66')])){_0x9c4096[_0x425057[_0x3e3d60[_0x5e4368][_0xced3('0x66')]]]=_0x3e3d60[_0x5e4368][_0xced3('0x6a')];}}for(var _0xca87c4 in _0x425057){if(!_0x9c4096[_0xced3('0x38')](_0x425057[_0xca87c4])){_0x9c4096[_0x425057[_0xca87c4]]=null;}}_0x4d5fc7[_0xced3('0x6b')](_0x9c4096);}return _0x4d5fc7;}})[_0xced3('0x21')](function(_0x2b688c){if(!_[_0xced3('0x6c')](_0x2b688c)){var _0x28a497=toCsv(_0x2b688c);var _0x1994d3=Date[_0xced3('0x6d')]();fs['writeFileSync'](util['format'](_0xced3('0x6e'),_0x1da164['params']['id'],_0x1994d3),_0x28a497);_0x1dd390[_0xced3('0x6f')]('Content-disposition','attachment;\x20filename='+util[_0xced3('0x68')](_0xced3('0x70'),_0x1da164[_0xced3('0x43')]['id'],_0x1994d3));_0x1dd390[_0xced3('0x6f')]('Content-type','text/csv');return _0x1dd390[_0xced3('0x71')](util[_0xced3('0x68')](_0xced3('0x6e'),_0x1da164['params']['id'],_0x1994d3));}else{return _0x1dd390[_0xced3('0x16')](0xcc);}})['catch'](handleError(_0x1dd390,null));}; \ No newline at end of file +var _0x04c5=['filter','type','VIRTUAL','merge','options','include','findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','JscriptyProject','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x04c5,0x125));var _0x504c=function(_0x3f89e6,_0x5304b7){_0x3f89e6=_0x3f89e6-0x0;var _0x312a05=_0x04c5[_0x3f89e6];return _0x312a05;};'use strict';var emlformat=require(_0x504c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x504c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x504c('0x2'));var util=require(_0x504c('0x3'));var path=require('path');var sox=require(_0x504c('0x4'));var csv=require(_0x504c('0x5'));var ejs=require(_0x504c('0x6'));var fs=require('fs');var fs_extra=require(_0x504c('0x7'));var _=require('lodash');var squel=require(_0x504c('0x8'));var crypto=require(_0x504c('0x9'));var jsforce=require(_0x504c('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x504c('0xb'));var Papa=require(_0x504c('0xc'));var Redis=require(_0x504c('0xd'));var authService=require(_0x504c('0xe'));var qs=require(_0x504c('0xf'));var as=require(_0x504c('0x10'));var hardwareService=require(_0x504c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x504c('0x12'));var config=require(_0x504c('0x13'));var licenseUtil=require(_0x504c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19a67b,_0x38855b){_0x38855b=_0x38855b||0xcc;return function(_0x421e99){if(_0x421e99){return _0x19a67b[_0x504c('0x15')](_0x38855b);}return _0x19a67b[_0x504c('0x16')](_0x38855b)['end']();};}function respondWithResult(_0x9a20f3,_0x77f461){_0x77f461=_0x77f461||0xc8;return function(_0x5ce1b7){if(_0x5ce1b7){return _0x9a20f3[_0x504c('0x16')](_0x77f461)['json'](_0x5ce1b7);}};}function respondWithFilteredResult(_0x4ccd42,_0x198c3f){return function(_0x35172e){if(_0x35172e){var _0xebb91=typeof _0x198c3f[_0x504c('0x17')]===_0x504c('0x18')&&typeof _0x198c3f[_0x504c('0x19')]===_0x504c('0x18');var _0x2be31b=_0x35172e[_0x504c('0x1a')];var _0x1cfd6a=_0xebb91?0x0:_0x198c3f[_0x504c('0x17')];var _0x41d809=_0xebb91?_0x35172e[_0x504c('0x1a')]:_0x198c3f[_0x504c('0x17')]+_0x198c3f[_0x504c('0x19')];var _0x31b5c8;if(_0x41d809>=_0x2be31b){_0x41d809=_0x2be31b;_0x31b5c8=0xc8;}else{_0x31b5c8=0xce;}_0x4ccd42[_0x504c('0x16')](_0x31b5c8);return _0x4ccd42['set'](_0x504c('0x1b'),_0x1cfd6a+'-'+_0x41d809+'/'+_0x2be31b)[_0x504c('0x1c')](_0x35172e);}return null;};}function patchUpdates(_0x33c21e){return function(_0x24ea61){try{jsonpatch['apply'](_0x24ea61,_0x33c21e,!![]);}catch(_0x14cc0f){return BPromise[_0x504c('0x1d')](_0x14cc0f);}return _0x24ea61[_0x504c('0x1e')]();};}function saveUpdates(_0x1c8836,_0x12a7e3){return function(_0xd60904){if(_0xd60904){return _0xd60904[_0x504c('0x1f')](_0x1c8836)[_0x504c('0x20')](function(_0x5beeb0){return _0x5beeb0;});}return null;};}function removeEntity(_0x5ec5ec,_0xef3e31){return function(_0x30075b){if(_0x30075b){return _0x30075b[_0x504c('0x21')]()[_0x504c('0x20')](function(){var _0x5de77e=_0x30075b['get']({'plain':!![]});var _0x196ac5='Projects';return db[_0x504c('0x22')][_0x504c('0x21')]({'where':{'type':_0x196ac5,'resourceId':_0x5de77e['id']}})[_0x504c('0x20')](function(){return _0x30075b;});})[_0x504c('0x20')](function(){_0x5ec5ec['status'](0xcc)[_0x504c('0x23')]();});}};}function handleEntityNotFound(_0x1535f1,_0x3a90fd){return function(_0xdb9be5){if(!_0xdb9be5){_0x1535f1[_0x504c('0x15')](0x194);}return _0xdb9be5;};}function handleError(_0x1ee326,_0x1904d9){_0x1904d9=_0x1904d9||0x1f4;return function(_0x4e0b52){logger[_0x504c('0x24')](_0x4e0b52[_0x504c('0x25')]);if(_0x4e0b52[_0x504c('0x26')]){delete _0x4e0b52[_0x504c('0x26')];}_0x1ee326[_0x504c('0x16')](_0x1904d9)[_0x504c('0x27')](_0x4e0b52);};}exports[_0x504c('0x28')]=function(_0x274e63,_0x52fafa){var _0x2296c0={},_0x428a71={},_0x2facd6={'count':0x0,'rows':[]};var _0x18adb1=_['map'](db[_0x504c('0x29')]['rawAttributes'],function(_0x2b6601){return{'name':_0x2b6601['fieldName'],'type':_0x2b6601['type'][_0x504c('0x2a')]};});_0x428a71[_0x504c('0x2b')]=_[_0x504c('0x2c')](_0x18adb1,_0x504c('0x26'));_0x428a71[_0x504c('0x2d')]=_[_0x504c('0x2e')](_0x274e63['query']);_0x428a71[_0x504c('0x2f')]=_[_0x504c('0x30')](_0x428a71[_0x504c('0x2b')],_0x428a71[_0x504c('0x2d')]);_0x2296c0[_0x504c('0x31')]=_[_0x504c('0x30')](_0x428a71[_0x504c('0x2b')],qs['fields'](_0x274e63[_0x504c('0x2d')][_0x504c('0x32')]));_0x2296c0[_0x504c('0x31')]=_0x2296c0[_0x504c('0x31')][_0x504c('0x33')]?_0x2296c0['attributes']:_0x428a71[_0x504c('0x2b')];if(!_0x274e63[_0x504c('0x2d')][_0x504c('0x34')](_0x504c('0x35'))){_0x2296c0[_0x504c('0x19')]=qs['limit'](_0x274e63[_0x504c('0x2d')][_0x504c('0x19')]);_0x2296c0[_0x504c('0x17')]=qs[_0x504c('0x17')](_0x274e63[_0x504c('0x2d')][_0x504c('0x17')]);}_0x2296c0[_0x504c('0x36')]=qs[_0x504c('0x37')](_0x274e63['query']['sort']);_0x2296c0[_0x504c('0x38')]=qs['filters'](_[_0x504c('0x39')](_0x274e63['query'],_0x428a71[_0x504c('0x2f')]),_0x18adb1);if(_0x274e63[_0x504c('0x2d')][_0x504c('0x3a')]){_0x2296c0[_0x504c('0x38')]=_['merge'](_0x2296c0['where'],{'$or':_[_0x504c('0x2c')](_0x18adb1,function(_0x2f68ca){if(_0x2f68ca[_0x504c('0x3b')]!==_0x504c('0x3c')){var _0x170163={};_0x170163[_0x2f68ca[_0x504c('0x26')]]={'$like':'%'+_0x274e63['query'][_0x504c('0x3a')]+'%'};return _0x170163;}})});}_0x2296c0=_[_0x504c('0x3d')]({},_0x2296c0,_0x274e63[_0x504c('0x3e')]);var _0x579bed={'where':_0x2296c0['where']};return db[_0x504c('0x29')][_0x504c('0x1a')](_0x579bed)['then'](function(_0x42923b){_0x2facd6[_0x504c('0x1a')]=_0x42923b;if(_0x274e63[_0x504c('0x2d')]['includeAll']){_0x2296c0[_0x504c('0x3f')]=[{'all':!![]}];}return db[_0x504c('0x29')][_0x504c('0x40')](_0x2296c0);})[_0x504c('0x20')](function(_0x211e9a){_0x2facd6[_0x504c('0x41')]=_0x211e9a;return _0x2facd6;})['then'](respondWithFilteredResult(_0x52fafa,_0x2296c0))['catch'](handleError(_0x52fafa,null));};exports['show']=function(_0xf72441,_0x23f5c6){var _0x57433a={'raw':![],'where':{'id':_0xf72441[_0x504c('0x42')]['id']}},_0x3cc136={};_0x3cc136[_0x504c('0x2b')]=_[_0x504c('0x2e')](db[_0x504c('0x29')][_0x504c('0x43')]);_0x3cc136['query']=_[_0x504c('0x2e')](_0xf72441['query']);_0x3cc136[_0x504c('0x2f')]=_[_0x504c('0x30')](_0x3cc136[_0x504c('0x2b')],_0x3cc136[_0x504c('0x2d')]);_0x57433a['attributes']=_[_0x504c('0x30')](_0x3cc136[_0x504c('0x2b')],qs[_0x504c('0x32')](_0xf72441['query']['fields']));_0x57433a['attributes']=_0x57433a[_0x504c('0x31')][_0x504c('0x33')]?_0x57433a['attributes']:_0x3cc136[_0x504c('0x2b')];if(_0xf72441[_0x504c('0x2d')][_0x504c('0x44')]){_0x57433a[_0x504c('0x3f')]=[{'all':!![]}];}_0x57433a=_[_0x504c('0x3d')]({},_0x57433a,_0xf72441['options']);return db[_0x504c('0x29')][_0x504c('0x45')](_0x57433a)[_0x504c('0x20')](handleEntityNotFound(_0x23f5c6,null))[_0x504c('0x20')](respondWithResult(_0x23f5c6,null))[_0x504c('0x46')](handleError(_0x23f5c6,null));};exports[_0x504c('0x47')]=function(_0x264df6,_0x317a7b){return db[_0x504c('0x29')]['create'](_0x264df6[_0x504c('0x48')],{})[_0x504c('0x20')](function(_0x25c6b7){var _0x565649=_0x264df6[_0x504c('0x49')][_0x504c('0x4a')]({'plain':!![]});if(!_0x565649)throw new Error(_0x504c('0x4b'));if(_0x565649[_0x504c('0x4c')]===_0x504c('0x49')){var _0x27711d=_0x25c6b7[_0x504c('0x4a')]({'plain':!![]});var _0x4186fb=_0x504c('0x4d');return db[_0x504c('0x4e')]['find']({'where':{'name':_0x4186fb,'userProfileId':_0x565649[_0x504c('0x4f')]},'raw':!![]})['then'](function(_0x5a0285){if(_0x5a0285&&_0x5a0285[_0x504c('0x50')]===0x0){return db[_0x504c('0x22')][_0x504c('0x47')]({'name':_0x27711d[_0x504c('0x26')],'resourceId':_0x27711d['id'],'type':_0x5a0285['name'],'sectionId':_0x5a0285['id']},{})[_0x504c('0x20')](function(){return _0x25c6b7;});}else{return _0x25c6b7;}})[_0x504c('0x46')](function(_0x5ab9f4){logger[_0x504c('0x24')](_0x504c('0x51'),_0x5ab9f4);throw _0x5ab9f4;});}return _0x25c6b7;})[_0x504c('0x20')](respondWithResult(_0x317a7b,0xc9))[_0x504c('0x46')](handleError(_0x317a7b,null));};exports[_0x504c('0x52')]=function(_0x425467,_0x4fb582){var _0x5ad005={'where':{'id':_0x425467[_0x504c('0x42')]['id']}},_0x7a5a4f={};_0x7a5a4f['model']=_['keys'](db[_0x504c('0x29')][_0x504c('0x43')]);_0x5ad005[_0x504c('0x31')]=_['intersection'](_0x7a5a4f[_0x504c('0x2b')],qs[_0x504c('0x32')](_0x425467[_0x504c('0x2d')][_0x504c('0x32')]));_0x5ad005[_0x504c('0x31')]=_0x5ad005[_0x504c('0x31')][_0x504c('0x33')]?_0x5ad005[_0x504c('0x31')]:_0x7a5a4f[_0x504c('0x2b')];if(_0x425467[_0x504c('0x2d')]['includeAll']){_0x5ad005[_0x504c('0x3f')]=[{'all':!![]}];}_0x5ad005=_['merge']({},_0x5ad005,_0x425467[_0x504c('0x3e')]);return db[_0x504c('0x29')][_0x504c('0x45')](_0x5ad005)[_0x504c('0x20')](handleEntityNotFound(_0x4fb582,null))[_0x504c('0x20')](function(_0x368201){if(_0x368201){var _0x227253=_0x368201[_0x504c('0x4a')]({'plain':!![]});_0x227253=qs['omit'](_0x227253,['id',_0x504c('0x53'),'updatedAt']);_0x425467[_0x504c('0x48')]=_[_0x504c('0x54')](_0x425467[_0x504c('0x48')],['id',_0x504c('0x53'),_0x504c('0x55')]);return db['JscriptyProject'][_0x504c('0x47')](_['merge'](_0x227253,_0x425467[_0x504c('0x48')]),{'include':_0x425467[_0x504c('0x2d')][_0x504c('0x44')]?[{'all':!![]}]:undefined})[_0x504c('0x20')](function(_0xde2b9a){var _0x47164e=_0x425467['user'][_0x504c('0x4a')]({'plain':!![]});if(!_0x47164e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47164e[_0x504c('0x4c')]===_0x504c('0x49')){var _0x1b03af=_0xde2b9a[_0x504c('0x4a')]({'plain':!![]});var _0x1713ea=_0x504c('0x4d');return db['UserProfileSection'][_0x504c('0x45')]({'where':{'name':_0x1713ea,'userProfileId':_0x47164e[_0x504c('0x4f')]},'raw':!![]})[_0x504c('0x20')](function(_0xb4187d){if(_0xb4187d&&_0xb4187d['autoAssociation']===0x0){return db[_0x504c('0x22')][_0x504c('0x47')]({'name':_0x1b03af[_0x504c('0x26')],'resourceId':_0x1b03af['id'],'type':_0xb4187d['name'],'sectionId':_0xb4187d['id']},{})[_0x504c('0x20')](function(){return _0xde2b9a;});}else{return _0xde2b9a;}})[_0x504c('0x46')](function(_0x1ac846){logger['error'](_0x504c('0x51'),_0x1ac846);throw _0x1ac846;});}return _0xde2b9a;});}})[_0x504c('0x20')](respondWithResult(_0x4fb582,0xc9))[_0x504c('0x46')](handleError(_0x4fb582,null));};exports[_0x504c('0x1f')]=function(_0x356eba,_0x50981a){if(_0x356eba[_0x504c('0x48')]['id']){delete _0x356eba[_0x504c('0x48')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x356eba[_0x504c('0x42')]['id']}})[_0x504c('0x20')](handleEntityNotFound(_0x50981a,null))[_0x504c('0x20')](saveUpdates(_0x356eba[_0x504c('0x48')],null))[_0x504c('0x20')](respondWithResult(_0x50981a,null))['catch'](handleError(_0x50981a,null));};exports['destroy']=function(_0x41d6dd,_0xeb5549){return db['JscriptyProject'][_0x504c('0x45')]({'where':{'id':_0x41d6dd[_0x504c('0x42')]['id']}})[_0x504c('0x20')](handleEntityNotFound(_0xeb5549,null))[_0x504c('0x20')](removeEntity(_0xeb5549,null))[_0x504c('0x46')](handleError(_0xeb5549,null));};exports[_0x504c('0x56')]=function(_0x5df69f,_0x558266,_0x23bf74){var _0x41de54={'raw':!![],'where':{}};var _0xd281e3={};var _0x3708cd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x504c('0x57')]({'where':{'id':_0x5df69f[_0x504c('0x42')]['id']}})[_0x504c('0x20')](handleEntityNotFound(_0x558266,null))[_0x504c('0x20')](function(_0x57db22){if(_0x57db22){_0xd281e3[_0x504c('0x2b')]=_[_0x504c('0x2e')](db[_0x504c('0x58')][_0x504c('0x43')]);_0xd281e3[_0x504c('0x2d')]=_[_0x504c('0x2e')](_0x5df69f[_0x504c('0x2d')]);_0xd281e3[_0x504c('0x2f')]=_[_0x504c('0x30')](_0xd281e3['model'],_0xd281e3[_0x504c('0x2d')]);_0x41de54[_0x504c('0x31')]=_[_0x504c('0x30')](_0xd281e3['model'],qs['fields'](_0x5df69f['query'][_0x504c('0x32')]));_0x41de54['attributes']=_0x41de54[_0x504c('0x31')][_0x504c('0x33')]?_0x41de54[_0x504c('0x31')]:_0xd281e3[_0x504c('0x2b')];if(!_0x5df69f[_0x504c('0x2d')][_0x504c('0x34')](_0x504c('0x35'))){_0x41de54['limit']=qs[_0x504c('0x19')](_0x5df69f[_0x504c('0x2d')][_0x504c('0x19')]);_0x41de54['offset']=qs[_0x504c('0x17')](_0x5df69f[_0x504c('0x2d')]['offset']);}_0x41de54[_0x504c('0x36')]=qs[_0x504c('0x37')](_0x5df69f[_0x504c('0x2d')][_0x504c('0x37')]);_0x41de54['where']=qs[_0x504c('0x2f')](_[_0x504c('0x39')](_0x5df69f[_0x504c('0x2d')],_0xd281e3[_0x504c('0x2f')]));_0x41de54[_0x504c('0x38')][_0x504c('0x59')]=_0x57db22['id'];if(_0x5df69f[_0x504c('0x2d')]['filter']){_0x41de54['where']=_[_0x504c('0x3d')](_0x41de54[_0x504c('0x38')],{'$or':_[_0x504c('0x2c')](_0x41de54[_0x504c('0x31')],function(_0x1dd2c3){var _0x51178f={};_0x51178f[_0x1dd2c3]={'$like':'%'+_0x5df69f[_0x504c('0x2d')][_0x504c('0x3a')]+'%'};return _0x51178f;})});}_0x41de54=_[_0x504c('0x3d')]({},_0x41de54,_0x5df69f['options']);return db[_0x504c('0x58')]['count']({'where':_0x41de54[_0x504c('0x38')]})['then'](function(_0x577cc4){_0x3708cd[_0x504c('0x1a')]=_0x577cc4;if(_0x5df69f[_0x504c('0x2d')][_0x504c('0x44')]){_0x41de54['include']=[{'all':!![]}];}return db[_0x504c('0x58')][_0x504c('0x40')](_0x41de54);})[_0x504c('0x20')](function(_0x411578){_0x3708cd[_0x504c('0x41')]=_0x411578;return _0x3708cd;});}})[_0x504c('0x20')](respondWithFilteredResult(_0x558266,_0x41de54))['catch'](handleError(_0x558266,null));};exports[_0x504c('0x5a')]=function(_0x9255d6,_0x346b7e,_0x5af2dc){var _0x2aad4d={'raw':!![],'where':{}};var _0x1d06f9={};var _0x1680a1={'count':0x0,'rows':[]};return db[_0x504c('0x29')][_0x504c('0x57')]({'where':{'id':_0x9255d6[_0x504c('0x42')]['id']}})['then'](handleEntityNotFound(_0x346b7e,null))[_0x504c('0x20')](function(_0x5012f5){if(_0x5012f5){_0x1d06f9[_0x504c('0x2b')]=_[_0x504c('0x2e')](db[_0x504c('0x5b')][_0x504c('0x43')]);_0x1d06f9[_0x504c('0x2d')]=_[_0x504c('0x2e')](_0x9255d6['query']);_0x1d06f9[_0x504c('0x2f')]=_[_0x504c('0x30')](_0x1d06f9[_0x504c('0x2b')],_0x1d06f9[_0x504c('0x2d')]);_0x2aad4d[_0x504c('0x31')]=_['intersection'](_0x1d06f9['model'],qs['fields'](_0x9255d6[_0x504c('0x2d')][_0x504c('0x32')]));_0x2aad4d[_0x504c('0x31')]=_0x2aad4d[_0x504c('0x31')][_0x504c('0x33')]?_0x2aad4d[_0x504c('0x31')]:_0x1d06f9[_0x504c('0x2b')];if(!_0x9255d6[_0x504c('0x2d')][_0x504c('0x34')](_0x504c('0x35'))){_0x2aad4d[_0x504c('0x19')]=qs[_0x504c('0x19')](_0x9255d6[_0x504c('0x2d')][_0x504c('0x19')]);_0x2aad4d['offset']=qs[_0x504c('0x17')](_0x9255d6[_0x504c('0x2d')][_0x504c('0x17')]);}_0x2aad4d['order']=qs['sort'](_0x9255d6[_0x504c('0x2d')][_0x504c('0x37')]);_0x2aad4d['where']=qs[_0x504c('0x2f')](_[_0x504c('0x39')](_0x9255d6[_0x504c('0x2d')],_0x1d06f9[_0x504c('0x2f')]));_0x2aad4d[_0x504c('0x38')][_0x504c('0x59')]=_0x5012f5['id'];if(_0x9255d6[_0x504c('0x2d')]['filter']){_0x2aad4d[_0x504c('0x38')]=_[_0x504c('0x3d')](_0x2aad4d['where'],{'$or':_[_0x504c('0x2c')](_0x2aad4d[_0x504c('0x31')],function(_0x10ff13){var _0x27ac1d={};_0x27ac1d[_0x10ff13]={'$like':'%'+_0x9255d6[_0x504c('0x2d')]['filter']+'%'};return _0x27ac1d;})});}_0x2aad4d=_[_0x504c('0x3d')]({},_0x2aad4d,_0x9255d6['options']);return db[_0x504c('0x5b')][_0x504c('0x1a')]({'where':_0x2aad4d[_0x504c('0x38')]})['then'](function(_0x7c377b){_0x1680a1[_0x504c('0x1a')]=_0x7c377b;if(_0x9255d6[_0x504c('0x2d')][_0x504c('0x44')]){_0x2aad4d[_0x504c('0x3f')]=[{'all':!![]}];}return db[_0x504c('0x5b')]['findAll'](_0x2aad4d);})[_0x504c('0x20')](function(_0x2122d6){_0x1680a1[_0x504c('0x41')]=_0x2122d6;return _0x1680a1;});}})[_0x504c('0x20')](respondWithFilteredResult(_0x346b7e,_0x2aad4d))[_0x504c('0x46')](handleError(_0x346b7e,null));};function char(_0x1e16d5){return _0x504c('0x5c')===typeof _0x1e16d5?String[_0x504c('0x5d')][_0x504c('0x5e')](null,arguments):_0x1e16d5;}function needsEncapsulation(_0x30ebbb){return!!_0x30ebbb&&(_0x30ebbb[_0x504c('0x5f')]()[_0x504c('0x60')](char(0xd))>=0x0||_0x30ebbb['toString']()['indexOf'](char(0xa))>=0x0||_0x30ebbb[_0x504c('0x5f')]()[_0x504c('0x60')](char(0x2c))>=0x0||_0x30ebbb[_0x504c('0x5f')]()[_0x504c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x19e187){var _0x1fbddc=char(0x22),_0x157043='\x5c'+char(0x22),_0x5a8816=_0x19e187[_0x504c('0x5f')]()[_0x504c('0x61')](new RegExp(_0x1fbddc,'g'),_0x157043);return _0x1fbddc+_0x5a8816+_0x1fbddc;}exports['getSummary']=function(_0x49773f,_0x5d615b,_0x218f24){var _0x115c03,_0x5279a0;var _0x5e4089={'where':{'ProjectId':_0x49773f['params']['id']}};if(_0x49773f[_0x504c('0x2d')]['startTime']){_0x5e4089[_0x504c('0x38')][_0x504c('0x62')]=JSON['parse'](_0x49773f[_0x504c('0x2d')][_0x504c('0x63')]);}return db['JscriptySessionReport']['findAll'](_0x5e4089)[_0x504c('0x20')](handleEntityNotFound(_0x5d615b,null))[_0x504c('0x20')](function(_0x34e265){if(_0x34e265){_0x115c03=_0x34e265;return db[_0x504c('0x64')][_0x504c('0x40')]({'where':{'SessionId':{'$in':_[_0x504c('0x2c')](_0x115c03,'id')},'ProjectId':_0x49773f['params']['id']},'order':_0x504c('0x65')});}})[_0x504c('0x20')](handleEntityNotFound(_0x5d615b,null))[_0x504c('0x20')](function(_0x5e50bf){if(_0x5e50bf){_0x5279a0=_0x5e50bf;var _0x5ac491={};for(var _0x532736=0x0,_0x3ec5e9=_0x5279a0[_0x504c('0x33')];_0x532736<_0x3ec5e9;_0x532736++){if(!_0x5ac491[_0x504c('0x34')](_0x5279a0[_0x532736][_0x504c('0x66')])){_0x5ac491[_0x5279a0[_0x532736][_0x504c('0x66')]]=needsEncapsulation(_0x5279a0[_0x532736]['question'])?encapsulate(_0x5279a0[_0x532736]['question']):_0x5279a0[_0x532736][_0x504c('0x67')];}}var _0xec27a9=[],_0x59b5e2={};for(var _0x28a3be=0x0,_0x378d09=_0x115c03[_0x504c('0x33')];_0x28a3be<_0x378d09;_0x28a3be++){_0x59b5e2={'ProjectId':_0x49773f[_0x504c('0x42')]['id'],'SessionId':_0x115c03[_0x28a3be]['id'],'StartTime':moment(_0x115c03[_0x28a3be][_0x504c('0x62')])[_0x504c('0x68')](_0x504c('0x69'))};for(var _0x28685d=0x0,_0x1eaf1a=_0x5279a0[_0x504c('0x33')];_0x28685d<_0x1eaf1a;_0x28685d++){if(_0x5279a0[_0x28685d][_0x504c('0x6a')]==_0x115c03[_0x28a3be]['id']&&_0x5ac491['hasOwnProperty'](_0x5279a0[_0x28685d][_0x504c('0x66')])){_0x59b5e2[_0x5ac491[_0x5279a0[_0x28685d][_0x504c('0x66')]]]=_0x5279a0[_0x28685d][_0x504c('0x6b')];}}for(var _0x3d73b9 in _0x5ac491){if(!_0x59b5e2[_0x504c('0x34')](_0x5ac491[_0x3d73b9])){_0x59b5e2[_0x5ac491[_0x3d73b9]]=null;}}_0xec27a9[_0x504c('0x6c')](_0x59b5e2);}return _0xec27a9;}})[_0x504c('0x20')](function(_0x5316ac){if(!_['isEmpty'](_0x5316ac)){var _0x100deb=toCsv(_0x5316ac);var _0x1e3ac7=Date[_0x504c('0x6d')]();fs[_0x504c('0x6e')](util[_0x504c('0x68')](_0x504c('0x6f'),_0x49773f['params']['id'],_0x1e3ac7),_0x100deb);_0x5d615b[_0x504c('0x70')]('Content-disposition','attachment;\x20filename='+util[_0x504c('0x68')](_0x504c('0x71'),_0x49773f['params']['id'],_0x1e3ac7));_0x5d615b[_0x504c('0x70')](_0x504c('0x72'),_0x504c('0x73'));return _0x5d615b[_0x504c('0x74')](util[_0x504c('0x68')](_0x504c('0x6f'),_0x49773f[_0x504c('0x42')]['id'],_0x1e3ac7));}else{return _0x5d615b['sendStatus'](0xcc);}})[_0x504c('0x46')](handleError(_0x5d615b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index da4db13..3d0504c 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 _0x8c46=['api','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x8c46,0x171));var _0x68c4=function(_0x3cdf76,_0x63322b){_0x3cdf76=_0x3cdf76-0x0;var _0x1f1bdb=_0x8c46[_0x3cdf76];return _0x1f1bdb;};'use strict';var _=require(_0x68c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x68c4('0x2'));var fs=require('fs');var path=require(_0x68c4('0x3'));var rimraf=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var attributes=require(_0x68c4('0x6'));module[_0x68c4('0x7')]=function(_0x40ce21,_0x1516cf){return _0x40ce21[_0x68c4('0x8')](_0x68c4('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb13b=['api','moment','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x57a811,_0x478ce2){var _0x1a0b94=function(_0x33a5c5){while(--_0x33a5c5){_0x57a811['push'](_0x57a811['shift']());}};_0x1a0b94(++_0x478ce2);}(_0xb13b,0x1de));var _0xbb13=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb13b[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var logger=require(_0xbb13('0x2'))(_0xbb13('0x3'));var moment=require(_0xbb13('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb13('0x5'));var fs=require('fs');var path=require(_0xbb13('0x6'));var rimraf=require('rimraf');var config=require(_0xbb13('0x7'));var attributes=require(_0xbb13('0x8'));module[_0xbb13('0x9')]=function(_0x464c50,_0x296632){return _0x464c50[_0xbb13('0xa')](_0xbb13('0xb'),attributes,{'tableName':_0xbb13('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 2596866..e1f733f 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1361e1,_0x130813){var _0x3a9950=function(_0xd4ab06){while(--_0xd4ab06){_0x1361e1['push'](_0x1361e1['shift']());}};_0x3a9950(++_0x130813);}(_0x70e0,0x17b));var _0x070e=function(_0x1512b4,_0x3e34b7){_0x1512b4=_0x1512b4-0x0;var _0x1ae658=_0x70e0[_0x1512b4];return _0x1ae658;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4b87ff,_0xbfa28f){var _0x5bf1e=function(_0x487758){while(--_0x487758){_0x4b87ff['push'](_0x4b87ff['shift']());}};_0x5bf1e(++_0xbfa28f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 615261e..9d4e856 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 _0x2e31=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','exports','multer'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x2e31,0xa1));var _0x12e3=function(_0x94078,_0x5c31ee){_0x94078=_0x94078-0x0;var _0x233ec9=_0x2e31[_0x94078];return _0x233ec9;};'use strict';var multer=require(_0x12e3('0x0'));var util=require(_0x12e3('0x1'));var path=require(_0x12e3('0x2'));var timeout=require(_0x12e3('0x3'));var express=require(_0x12e3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x12e3('0x5'));var interaction=require(_0x12e3('0x6'));var config=require('../../config/environment');var controller=require(_0x12e3('0x7'));router[_0x12e3('0x8')]('/',auth[_0x12e3('0x9')](),controller['index']);router[_0x12e3('0x8')](_0x12e3('0xa'),auth[_0x12e3('0x9')](),controller[_0x12e3('0xb')]);router[_0x12e3('0x8')](_0x12e3('0xc'),auth[_0x12e3('0x9')](),controller['show']);router[_0x12e3('0xd')]('/',auth[_0x12e3('0x9')](),controller[_0x12e3('0xe')]);router['put'](_0x12e3('0xc'),auth['isAuthenticated'](),controller[_0x12e3('0xf')]);router[_0x12e3('0x10')](_0x12e3('0xc'),auth[_0x12e3('0x9')](),controller['destroy']);module[_0x12e3('0x11')]=router; \ No newline at end of file +var _0x95a8=['isAuthenticated','index','describe','/:id','show','post','put','destroy','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x1c59e1,_0x8cbff9){var _0x5ed529=function(_0x381641){while(--_0x381641){_0x1c59e1['push'](_0x1c59e1['shift']());}};_0x5ed529(++_0x8cbff9);}(_0x95a8,0xd8));var _0x895a=function(_0x180bc5,_0x17fd8d){_0x180bc5=_0x180bc5-0x0;var _0x310566=_0x95a8[_0x180bc5];return _0x310566;};'use strict';var multer=require(_0x895a('0x0'));var util=require(_0x895a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x895a('0x2')]();var fs_extra=require(_0x895a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x895a('0x4'));var config=require(_0x895a('0x5'));var controller=require(_0x895a('0x6'));router[_0x895a('0x7')]('/',auth[_0x895a('0x8')](),controller[_0x895a('0x9')]);router[_0x895a('0x7')]('/describe',auth[_0x895a('0x8')](),controller[_0x895a('0xa')]);router[_0x895a('0x7')](_0x895a('0xb'),auth['isAuthenticated'](),controller[_0x895a('0xc')]);router[_0x895a('0xd')]('/',auth[_0x895a('0x8')](),controller['create']);router[_0x895a('0xe')]('/:id',auth[_0x895a('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x895a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index d9fa9f9..eb37478 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x4e2453,_0x24b590){_0x4e2453=_0x4e2453-0x0;var _0x32b11a=_0x7a54[_0x4e2453];return _0x32b11a;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2a4255,_0x1e0da4){_0x2a4255=_0x2a4255-0x0;var _0xaac488=_0x7a54[_0x2a4255];return _0xaac488;};'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 6f57089..c881451 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 _0x3ad4=['limit','count','offset','Content-Range','json','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','intersection','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ad4,0xbe));var _0x43ad=function(_0x41beb0,_0x2298de){_0x41beb0=_0x41beb0-0x0;var _0x77cc6f=_0x3ad4[_0x41beb0];return _0x77cc6f;};'use strict';var emlformat=require(_0x43ad('0x0'));var rimraf=require(_0x43ad('0x1'));var zipdir=require(_0x43ad('0x2'));var jsonpatch=require(_0x43ad('0x3'));var rp=require(_0x43ad('0x4'));var moment=require(_0x43ad('0x5'));var BPromise=require(_0x43ad('0x6'));var Mustache=require(_0x43ad('0x7'));var util=require(_0x43ad('0x8'));var path=require('path');var sox=require(_0x43ad('0x9'));var csv=require(_0x43ad('0xa'));var ejs=require(_0x43ad('0xb'));var fs=require('fs');var fs_extra=require(_0x43ad('0xc'));var _=require('lodash');var squel=require(_0x43ad('0xd'));var crypto=require(_0x43ad('0xe'));var jsforce=require(_0x43ad('0xf'));var deskjs=require(_0x43ad('0x10'));var toCsv=require(_0x43ad('0xa'));var querystring=require('querystring');var Papa=require(_0x43ad('0x11'));var Redis=require(_0x43ad('0x12'));var authService=require(_0x43ad('0x13'));var qs=require(_0x43ad('0x14'));var as=require(_0x43ad('0x15'));var hardwareService=require(_0x43ad('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x43ad('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43ad('0x18'))['db'];function respondWithStatusCode(_0x36264f,_0x5c6ee7){_0x5c6ee7=_0x5c6ee7||0xcc;return function(_0x1af7f1){if(_0x1af7f1){return _0x36264f[_0x43ad('0x19')](_0x5c6ee7);}return _0x36264f[_0x43ad('0x1a')](_0x5c6ee7)[_0x43ad('0x1b')]();};}function respondWithResult(_0x6b5f33,_0x4dc337){_0x4dc337=_0x4dc337||0xc8;return function(_0x40e039){if(_0x40e039){return _0x6b5f33['status'](_0x4dc337)['json'](_0x40e039);}};}function respondWithFilteredResult(_0x3bfb89,_0x243489){return function(_0x1533d5){if(_0x1533d5){var _0x582cbc=typeof _0x243489['offset']===_0x43ad('0x1c')&&typeof _0x243489[_0x43ad('0x1d')]==='undefined';var _0x4396de=_0x1533d5[_0x43ad('0x1e')];var _0x19cd36=_0x582cbc?0x0:_0x243489[_0x43ad('0x1f')];var _0x6e6383=_0x582cbc?_0x1533d5[_0x43ad('0x1e')]:_0x243489[_0x43ad('0x1f')]+_0x243489[_0x43ad('0x1d')];var _0xbbb1e;if(_0x6e6383>=_0x4396de){_0x6e6383=_0x4396de;_0xbbb1e=0xc8;}else{_0xbbb1e=0xce;}_0x3bfb89[_0x43ad('0x1a')](_0xbbb1e);return _0x3bfb89['set'](_0x43ad('0x20'),_0x19cd36+'-'+_0x6e6383+'/'+_0x4396de)[_0x43ad('0x21')](_0x1533d5);}return null;};}function patchUpdates(_0x42fc20){return function(_0x3ab420){try{jsonpatch['apply'](_0x3ab420,_0x42fc20,!![]);}catch(_0xd13fc3){return BPromise['reject'](_0xd13fc3);}return _0x3ab420['save']();};}function saveUpdates(_0x18ac2e,_0x2d1f58){return function(_0x5527c5){if(_0x5527c5){return _0x5527c5[_0x43ad('0x22')](_0x18ac2e)[_0x43ad('0x23')](function(_0x1796b1){return _0x1796b1;});}return null;};}function removeEntity(_0x5e8c82,_0x5e55b7){return function(_0x2448d2){if(_0x2448d2){return _0x2448d2[_0x43ad('0x24')]()[_0x43ad('0x23')](function(){_0x5e8c82[_0x43ad('0x1a')](0xcc)[_0x43ad('0x1b')]();});}};}function handleEntityNotFound(_0x3e5689,_0x46469c){return function(_0x3652ed){if(!_0x3652ed){_0x3e5689[_0x43ad('0x19')](0x194);}return _0x3652ed;};}function handleError(_0x38fa15,_0x5b1833){_0x5b1833=_0x5b1833||0x1f4;return function(_0x7f78fb){logger[_0x43ad('0x25')](_0x7f78fb[_0x43ad('0x26')]);if(_0x7f78fb['name']){delete _0x7f78fb[_0x43ad('0x27')];}_0x38fa15[_0x43ad('0x1a')](_0x5b1833)[_0x43ad('0x28')](_0x7f78fb);};}exports['index']=function(_0x4e6c11,_0xf85e0f){var _0x2abd19={},_0x55310b={},_0x3c7c56={'count':0x0,'rows':[]};var _0x4b4866=_[_0x43ad('0x29')](db[_0x43ad('0x2a')][_0x43ad('0x2b')],function(_0x1b15af){return{'name':_0x1b15af[_0x43ad('0x2c')],'type':_0x1b15af[_0x43ad('0x2d')][_0x43ad('0x2e')]};});_0x55310b[_0x43ad('0x2f')]=_['map'](_0x4b4866,_0x43ad('0x27'));_0x55310b[_0x43ad('0x30')]=_['keys'](_0x4e6c11[_0x43ad('0x30')]);_0x55310b[_0x43ad('0x31')]=_['intersection'](_0x55310b['model'],_0x55310b['query']);_0x2abd19[_0x43ad('0x32')]=_['intersection'](_0x55310b[_0x43ad('0x2f')],qs[_0x43ad('0x33')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x33')]));_0x2abd19[_0x43ad('0x32')]=_0x2abd19['attributes']['length']?_0x2abd19[_0x43ad('0x32')]:_0x55310b[_0x43ad('0x2f')];if(!_0x4e6c11['query']['hasOwnProperty'](_0x43ad('0x34'))){_0x2abd19[_0x43ad('0x1d')]=qs[_0x43ad('0x1d')](_0x4e6c11[_0x43ad('0x30')]['limit']);_0x2abd19[_0x43ad('0x1f')]=qs[_0x43ad('0x1f')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x1f')]);}_0x2abd19[_0x43ad('0x35')]=qs[_0x43ad('0x36')](_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x36')]);_0x2abd19[_0x43ad('0x37')]=qs['filters'](_['pick'](_0x4e6c11[_0x43ad('0x30')],_0x55310b['filters']),_0x4b4866);if(_0x4e6c11[_0x43ad('0x30')][_0x43ad('0x38')]){_0x2abd19[_0x43ad('0x37')]=_['merge'](_0x2abd19[_0x43ad('0x37')],{'$or':_[_0x43ad('0x29')](_0x4b4866,function(_0x2b70e8){if(_0x2b70e8[_0x43ad('0x2d')]!==_0x43ad('0x39')){var _0x4d7975={};_0x4d7975[_0x2b70e8['name']]={'$like':'%'+_0x4e6c11[_0x43ad('0x30')]['filter']+'%'};return _0x4d7975;}})});}_0x2abd19=_[_0x43ad('0x3a')]({},_0x2abd19,_0x4e6c11[_0x43ad('0x3b')]);var _0x2d17f1={'where':_0x2abd19['where']};return db['JscriptyQuestionReport'][_0x43ad('0x1e')](_0x2d17f1)[_0x43ad('0x23')](function(_0x58851c){_0x3c7c56[_0x43ad('0x1e')]=_0x58851c;if(_0x4e6c11['query'][_0x43ad('0x3c')]){_0x2abd19['include']=[{'all':!![]}];}return db[_0x43ad('0x2a')][_0x43ad('0x3d')](_0x2abd19);})[_0x43ad('0x23')](function(_0x1f267f){_0x3c7c56[_0x43ad('0x3e')]=_0x1f267f;return _0x3c7c56;})[_0x43ad('0x23')](respondWithFilteredResult(_0xf85e0f,_0x2abd19))[_0x43ad('0x3f')](handleError(_0xf85e0f,null));};exports['show']=function(_0x4cb6cc,_0x4c8583){var _0x11fb13={'raw':!![],'where':{'id':_0x4cb6cc[_0x43ad('0x40')]['id']}},_0x49a60a={};_0x49a60a[_0x43ad('0x2f')]=_[_0x43ad('0x41')](db[_0x43ad('0x2a')][_0x43ad('0x2b')]);_0x49a60a['query']=_[_0x43ad('0x41')](_0x4cb6cc[_0x43ad('0x30')]);_0x49a60a[_0x43ad('0x31')]=_[_0x43ad('0x42')](_0x49a60a[_0x43ad('0x2f')],_0x49a60a[_0x43ad('0x30')]);_0x11fb13[_0x43ad('0x32')]=_['intersection'](_0x49a60a[_0x43ad('0x2f')],qs[_0x43ad('0x33')](_0x4cb6cc[_0x43ad('0x30')]['fields']));_0x11fb13[_0x43ad('0x32')]=_0x11fb13[_0x43ad('0x32')][_0x43ad('0x43')]?_0x11fb13['attributes']:_0x49a60a[_0x43ad('0x2f')];if(_0x4cb6cc['query'][_0x43ad('0x3c')]){_0x11fb13[_0x43ad('0x44')]=[{'all':!![]}];}_0x11fb13=_[_0x43ad('0x3a')]({},_0x11fb13,_0x4cb6cc[_0x43ad('0x3b')]);return db[_0x43ad('0x2a')][_0x43ad('0x45')](_0x11fb13)[_0x43ad('0x23')](handleEntityNotFound(_0x4c8583,null))[_0x43ad('0x23')](respondWithResult(_0x4c8583,null))[_0x43ad('0x3f')](handleError(_0x4c8583,null));};exports[_0x43ad('0x46')]=function(_0x540785,_0x2ee454){return db[_0x43ad('0x2a')][_0x43ad('0x46')](_0x540785[_0x43ad('0x47')],{})[_0x43ad('0x23')](respondWithResult(_0x2ee454,0xc9))[_0x43ad('0x3f')](handleError(_0x2ee454,null));};exports[_0x43ad('0x22')]=function(_0x57d8ce,_0x8ec011){if(_0x57d8ce['body']['id']){delete _0x57d8ce['body']['id'];}return db[_0x43ad('0x2a')][_0x43ad('0x45')]({'where':{'id':_0x57d8ce[_0x43ad('0x40')]['id']}})[_0x43ad('0x23')](handleEntityNotFound(_0x8ec011,null))['then'](saveUpdates(_0x57d8ce['body'],null))[_0x43ad('0x23')](respondWithResult(_0x8ec011,null))[_0x43ad('0x3f')](handleError(_0x8ec011,null));};exports[_0x43ad('0x24')]=function(_0x5769de,_0x36d170){return db[_0x43ad('0x2a')]['find']({'where':{'id':_0x5769de['params']['id']}})[_0x43ad('0x23')](handleEntityNotFound(_0x36d170,null))['then'](removeEntity(_0x36d170,null))[_0x43ad('0x3f')](handleError(_0x36d170,null));};exports[_0x43ad('0x48')]=function(_0x53298f,_0x18d1d7){return db[_0x43ad('0x2a')][_0x43ad('0x48')]()[_0x43ad('0x23')](respondWithResult(_0x18d1d7,null))[_0x43ad('0x3f')](handleError(_0x18d1d7,null));}; \ No newline at end of file +var _0x5bb5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','rows','params','rawAttributes','includeAll','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x4acb92,_0x2350fb){var _0x3b17eb=function(_0x42f2ef){while(--_0x42f2ef){_0x4acb92['push'](_0x4acb92['shift']());}};_0x3b17eb(++_0x2350fb);}(_0x5bb5,0xe5));var _0x55bb=function(_0x263f03,_0x168327){_0x263f03=_0x263f03-0x0;var _0xb64a19=_0x5bb5[_0x263f03];return _0xb64a19;};'use strict';var emlformat=require(_0x55bb('0x0'));var rimraf=require(_0x55bb('0x1'));var zipdir=require(_0x55bb('0x2'));var jsonpatch=require(_0x55bb('0x3'));var rp=require(_0x55bb('0x4'));var moment=require(_0x55bb('0x5'));var BPromise=require(_0x55bb('0x6'));var Mustache=require('mustache');var util=require(_0x55bb('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x55bb('0x8'));var fs=require('fs');var fs_extra=require(_0x55bb('0x9'));var _=require(_0x55bb('0xa'));var squel=require(_0x55bb('0xb'));var crypto=require(_0x55bb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x55bb('0xd'));var toCsv=require(_0x55bb('0xe'));var querystring=require('querystring');var Papa=require(_0x55bb('0xf'));var Redis=require(_0x55bb('0x10'));var authService=require(_0x55bb('0x11'));var qs=require(_0x55bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55bb('0x13'));var logger=require(_0x55bb('0x14'))(_0x55bb('0x15'));var utils=require(_0x55bb('0x16'));var config=require(_0x55bb('0x17'));var licenseUtil=require(_0x55bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x562eb7,_0x1396dc){_0x1396dc=_0x1396dc||0xcc;return function(_0x180344){if(_0x180344){return _0x562eb7[_0x55bb('0x19')](_0x1396dc);}return _0x562eb7['status'](_0x1396dc)[_0x55bb('0x1a')]();};}function respondWithResult(_0x246960,_0x36fcb2){_0x36fcb2=_0x36fcb2||0xc8;return function(_0x15d73a){if(_0x15d73a){return _0x246960[_0x55bb('0x1b')](_0x36fcb2)[_0x55bb('0x1c')](_0x15d73a);}};}function respondWithFilteredResult(_0x3f88f9,_0x3ab4bc){return function(_0xa4222e){if(_0xa4222e){var _0x692c46=typeof _0x3ab4bc['offset']===_0x55bb('0x1d')&&typeof _0x3ab4bc[_0x55bb('0x1e')]==='undefined';var _0x49ac2a=_0xa4222e[_0x55bb('0x1f')];var _0x315491=_0x692c46?0x0:_0x3ab4bc[_0x55bb('0x20')];var _0x307343=_0x692c46?_0xa4222e['count']:_0x3ab4bc['offset']+_0x3ab4bc[_0x55bb('0x1e')];var _0x3c0da6;if(_0x307343>=_0x49ac2a){_0x307343=_0x49ac2a;_0x3c0da6=0xc8;}else{_0x3c0da6=0xce;}_0x3f88f9[_0x55bb('0x1b')](_0x3c0da6);return _0x3f88f9[_0x55bb('0x21')](_0x55bb('0x22'),_0x315491+'-'+_0x307343+'/'+_0x49ac2a)[_0x55bb('0x1c')](_0xa4222e);}return null;};}function patchUpdates(_0x6c25d3){return function(_0x1f3080){try{jsonpatch[_0x55bb('0x23')](_0x1f3080,_0x6c25d3,!![]);}catch(_0x563c5b){return BPromise[_0x55bb('0x24')](_0x563c5b);}return _0x1f3080[_0x55bb('0x25')]();};}function saveUpdates(_0x5e1bf3,_0x15d081){return function(_0x555501){if(_0x555501){return _0x555501[_0x55bb('0x26')](_0x5e1bf3)[_0x55bb('0x27')](function(_0x32ff70){return _0x32ff70;});}return null;};}function removeEntity(_0x452bbc,_0x13cc2a){return function(_0x379302){if(_0x379302){return _0x379302[_0x55bb('0x28')]()[_0x55bb('0x27')](function(){_0x452bbc['status'](0xcc)[_0x55bb('0x1a')]();});}};}function handleEntityNotFound(_0x52be78,_0x29685c){return function(_0x1d3b91){if(!_0x1d3b91){_0x52be78[_0x55bb('0x19')](0x194);}return _0x1d3b91;};}function handleError(_0x5ce3ee,_0x4dbfac){_0x4dbfac=_0x4dbfac||0x1f4;return function(_0x1e5bda){logger[_0x55bb('0x29')](_0x1e5bda[_0x55bb('0x2a')]);if(_0x1e5bda[_0x55bb('0x2b')]){delete _0x1e5bda[_0x55bb('0x2b')];}_0x5ce3ee['status'](_0x4dbfac)[_0x55bb('0x2c')](_0x1e5bda);};}exports[_0x55bb('0x2d')]=function(_0x73f681,_0x244167){var _0x4f3acf={},_0x2659fe={},_0x23cabc={'count':0x0,'rows':[]};var _0x4ea4dd=_[_0x55bb('0x2e')](db[_0x55bb('0x2f')]['rawAttributes'],function(_0x5e05af){return{'name':_0x5e05af[_0x55bb('0x30')],'type':_0x5e05af[_0x55bb('0x31')][_0x55bb('0x32')]};});_0x2659fe[_0x55bb('0x33')]=_[_0x55bb('0x2e')](_0x4ea4dd,_0x55bb('0x2b'));_0x2659fe[_0x55bb('0x34')]=_[_0x55bb('0x35')](_0x73f681['query']);_0x2659fe[_0x55bb('0x36')]=_[_0x55bb('0x37')](_0x2659fe[_0x55bb('0x33')],_0x2659fe[_0x55bb('0x34')]);_0x4f3acf[_0x55bb('0x38')]=_[_0x55bb('0x37')](_0x2659fe[_0x55bb('0x33')],qs[_0x55bb('0x39')](_0x73f681[_0x55bb('0x34')][_0x55bb('0x39')]));_0x4f3acf[_0x55bb('0x38')]=_0x4f3acf[_0x55bb('0x38')][_0x55bb('0x3a')]?_0x4f3acf[_0x55bb('0x38')]:_0x2659fe['model'];if(!_0x73f681[_0x55bb('0x34')][_0x55bb('0x3b')](_0x55bb('0x3c'))){_0x4f3acf[_0x55bb('0x1e')]=qs['limit'](_0x73f681[_0x55bb('0x34')][_0x55bb('0x1e')]);_0x4f3acf[_0x55bb('0x20')]=qs[_0x55bb('0x20')](_0x73f681[_0x55bb('0x34')]['offset']);}_0x4f3acf['order']=qs[_0x55bb('0x3d')](_0x73f681[_0x55bb('0x34')][_0x55bb('0x3d')]);_0x4f3acf[_0x55bb('0x3e')]=qs[_0x55bb('0x36')](_['pick'](_0x73f681[_0x55bb('0x34')],_0x2659fe[_0x55bb('0x36')]),_0x4ea4dd);if(_0x73f681['query'][_0x55bb('0x3f')]){_0x4f3acf['where']=_['merge'](_0x4f3acf[_0x55bb('0x3e')],{'$or':_['map'](_0x4ea4dd,function(_0x289f04){if(_0x289f04['type']!==_0x55bb('0x40')){var _0x5c937b={};_0x5c937b[_0x289f04[_0x55bb('0x2b')]]={'$like':'%'+_0x73f681[_0x55bb('0x34')][_0x55bb('0x3f')]+'%'};return _0x5c937b;}})});}_0x4f3acf=_[_0x55bb('0x41')]({},_0x4f3acf,_0x73f681[_0x55bb('0x42')]);var _0x40a421={'where':_0x4f3acf[_0x55bb('0x3e')]};return db[_0x55bb('0x2f')]['count'](_0x40a421)[_0x55bb('0x27')](function(_0x1b38e6){_0x23cabc[_0x55bb('0x1f')]=_0x1b38e6;if(_0x73f681['query']['includeAll']){_0x4f3acf[_0x55bb('0x43')]=[{'all':!![]}];}return db[_0x55bb('0x2f')]['findAll'](_0x4f3acf);})[_0x55bb('0x27')](function(_0x3348b9){_0x23cabc[_0x55bb('0x44')]=_0x3348b9;return _0x23cabc;})[_0x55bb('0x27')](respondWithFilteredResult(_0x244167,_0x4f3acf))['catch'](handleError(_0x244167,null));};exports['show']=function(_0x1871dd,_0x694d73){var _0x420d7b={'raw':!![],'where':{'id':_0x1871dd[_0x55bb('0x45')]['id']}},_0x5d97b7={};_0x5d97b7[_0x55bb('0x33')]=_[_0x55bb('0x35')](db[_0x55bb('0x2f')][_0x55bb('0x46')]);_0x5d97b7[_0x55bb('0x34')]=_[_0x55bb('0x35')](_0x1871dd[_0x55bb('0x34')]);_0x5d97b7[_0x55bb('0x36')]=_[_0x55bb('0x37')](_0x5d97b7[_0x55bb('0x33')],_0x5d97b7[_0x55bb('0x34')]);_0x420d7b['attributes']=_['intersection'](_0x5d97b7['model'],qs[_0x55bb('0x39')](_0x1871dd[_0x55bb('0x34')]['fields']));_0x420d7b[_0x55bb('0x38')]=_0x420d7b[_0x55bb('0x38')][_0x55bb('0x3a')]?_0x420d7b[_0x55bb('0x38')]:_0x5d97b7[_0x55bb('0x33')];if(_0x1871dd['query'][_0x55bb('0x47')]){_0x420d7b[_0x55bb('0x43')]=[{'all':!![]}];}_0x420d7b=_[_0x55bb('0x41')]({},_0x420d7b,_0x1871dd[_0x55bb('0x42')]);return db[_0x55bb('0x2f')][_0x55bb('0x48')](_0x420d7b)[_0x55bb('0x27')](handleEntityNotFound(_0x694d73,null))[_0x55bb('0x27')](respondWithResult(_0x694d73,null))[_0x55bb('0x49')](handleError(_0x694d73,null));};exports[_0x55bb('0x4a')]=function(_0x19d0e8,_0x1578ba){return db[_0x55bb('0x2f')][_0x55bb('0x4a')](_0x19d0e8['body'],{})[_0x55bb('0x27')](respondWithResult(_0x1578ba,0xc9))[_0x55bb('0x49')](handleError(_0x1578ba,null));};exports[_0x55bb('0x26')]=function(_0x2b424f,_0x54a0aa){if(_0x2b424f[_0x55bb('0x4b')]['id']){delete _0x2b424f['body']['id'];}return db[_0x55bb('0x2f')][_0x55bb('0x48')]({'where':{'id':_0x2b424f[_0x55bb('0x45')]['id']}})[_0x55bb('0x27')](handleEntityNotFound(_0x54a0aa,null))[_0x55bb('0x27')](saveUpdates(_0x2b424f[_0x55bb('0x4b')],null))['then'](respondWithResult(_0x54a0aa,null))[_0x55bb('0x49')](handleError(_0x54a0aa,null));};exports[_0x55bb('0x28')]=function(_0x396967,_0x5779f3){return db['JscriptyQuestionReport'][_0x55bb('0x48')]({'where':{'id':_0x396967[_0x55bb('0x45')]['id']}})[_0x55bb('0x27')](handleEntityNotFound(_0x5779f3,null))[_0x55bb('0x27')](removeEntity(_0x5779f3,null))[_0x55bb('0x49')](handleError(_0x5779f3,null));};exports['describe']=function(_0x169a01,_0x4e697f){return db[_0x55bb('0x2f')][_0x55bb('0x4c')]()[_0x55bb('0x27')](respondWithResult(_0x4e697f,null))[_0x55bb('0x49')](handleError(_0x4e697f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 72aae93..9bd1c17 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 _0x68f8=['./jscriptyQuestionReport.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5592a9,_0x576d19){var _0xd1df3d=function(_0xb527c0){while(--_0xb527c0){_0x5592a9['push'](_0x5592a9['shift']());}};_0xd1df3d(++_0x576d19);}(_0x68f8,0x9c));var _0x868f=function(_0x2d76a9,_0x4b023f){_0x2d76a9=_0x2d76a9-0x0;var _0x2eeee4=_0x68f8[_0x2d76a9];return _0x2eeee4;};'use strict';var _=require(_0x868f('0x0'));var util=require(_0x868f('0x1'));var logger=require(_0x868f('0x2'))(_0x868f('0x3'));var moment=require(_0x868f('0x4'));var BPromise=require(_0x868f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x868f('0x6'));var rimraf=require(_0x868f('0x7'));var config=require(_0x868f('0x8'));var attributes=require(_0x868f('0x9'));module[_0x868f('0xa')]=function(_0x2cb1b5,_0xad50b2){return _0x2cb1b5['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefca=['api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x517dd0,_0x2945df){var _0x288684=function(_0x1c9b2f){while(--_0x1c9b2f){_0x517dd0['push'](_0x517dd0['shift']());}};_0x288684(++_0x2945df);}(_0xefca,0xb3));var _0xaefc=function(_0x4a96ca,_0x13754e){_0x4a96ca=_0x4a96ca-0x0;var _0x2aed48=_0xefca[_0x4a96ca];return _0x2aed48;};'use strict';var _=require(_0xaefc('0x0'));var util=require(_0xaefc('0x1'));var logger=require(_0xaefc('0x2'))(_0xaefc('0x3'));var moment=require(_0xaefc('0x4'));var BPromise=require(_0xaefc('0x5'));var rp=require(_0xaefc('0x6'));var fs=require('fs');var path=require(_0xaefc('0x7'));var rimraf=require(_0xaefc('0x8'));var config=require('../../config/environment');var attributes=require(_0xaefc('0x9'));module['exports']=function(_0x273614,_0x57e0da){return _0x273614[_0xaefc('0xa')](_0xaefc('0xb'),attributes,{'tableName':_0xaefc('0xc'),'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 33ad8b2..25cc1e8 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 _0x0ada=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x5e4eb4,_0x52afca){var _0x303419=function(_0x3f977c){while(--_0x3f977c){_0x5e4eb4['push'](_0x5e4eb4['shift']());}};_0x303419(++_0x52afca);}(_0x0ada,0xe4));var _0xa0ad=function(_0x4f2b09,_0x243211){_0x4f2b09=_0x4f2b09-0x0;var _0x2a0ccf=_0x0ada[_0x4f2b09];return _0x2a0ccf;};'use strict';var _=require('lodash');var util=require(_0xa0ad('0x0'));var moment=require(_0xa0ad('0x1'));var BPromise=require(_0xa0ad('0x2'));var rs=require(_0xa0ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa0ad('0x5'));var jayson=require(_0xa0ad('0x6'));var client=jayson[_0xa0ad('0x7')][_0xa0ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1becb3,_0x415d65,_0x281a11){return new BPromise(function(_0x4c06df,_0x5487c4){return client[_0xa0ad('0x9')](_0x1becb3,_0x281a11)[_0xa0ad('0xa')](function(_0x3ebbf4){logger[_0xa0ad('0xb')](_0xa0ad('0xc'),_0x415d65,_0xa0ad('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x415d65,_0xa0ad('0xd'),JSON[_0xa0ad('0xe')](_0x3ebbf4));if(_0x3ebbf4[_0xa0ad('0xf')]){if(_0x3ebbf4['error'][_0xa0ad('0x10')]===0x1f4){logger['error'](_0xa0ad('0xc'),_0x415d65,_0x3ebbf4[_0xa0ad('0xf')][_0xa0ad('0x11')]);return _0x5487c4(_0x3ebbf4[_0xa0ad('0xf')]['message']);}logger[_0xa0ad('0xf')](_0xa0ad('0xc'),_0x415d65,_0x3ebbf4[_0xa0ad('0xf')][_0xa0ad('0x11')]);return _0x4c06df(_0x3ebbf4[_0xa0ad('0xf')]['message']);}else{logger[_0xa0ad('0xb')](_0xa0ad('0xc'),_0x415d65,_0xa0ad('0xd'));_0x4c06df(_0x3ebbf4['result'][_0xa0ad('0x11')]);}})['catch'](function(_0x4db446){logger[_0xa0ad('0xf')](_0xa0ad('0xc'),_0x415d65,_0x4db446);_0x5487c4(_0x4db446);});});} \ No newline at end of file +var _0xd1f3=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd1f3,0xdc));var _0x3d1f=function(_0x577c93,_0x581c95){_0x577c93=_0x577c93-0x0;var _0x18cb58=_0xd1f3[_0x577c93];return _0x18cb58;};'use strict';var _=require(_0x3d1f('0x0'));var util=require(_0x3d1f('0x1'));var moment=require(_0x3d1f('0x2'));var BPromise=require(_0x3d1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d1f('0x4'));var db=require(_0x3d1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d1f('0x6'))(_0x3d1f('0x7'));var config=require(_0x3d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3d1f('0x9')][_0x3d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27bc8d,_0x221564,_0x5d7f16){return new BPromise(function(_0x9b6768,_0x4640b6){return client['request'](_0x27bc8d,_0x5d7f16)['then'](function(_0x5ec38a){logger[_0x3d1f('0xb')](_0x3d1f('0xc'),_0x221564,_0x3d1f('0xd'));logger[_0x3d1f('0xe')](_0x3d1f('0xf'),_0x221564,_0x3d1f('0xd'),JSON[_0x3d1f('0x10')](_0x5ec38a));if(_0x5ec38a[_0x3d1f('0x11')]){if(_0x5ec38a[_0x3d1f('0x11')][_0x3d1f('0x12')]===0x1f4){logger[_0x3d1f('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x221564,_0x5ec38a[_0x3d1f('0x11')][_0x3d1f('0x13')]);return _0x4640b6(_0x5ec38a['error']['message']);}logger[_0x3d1f('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x221564,_0x5ec38a[_0x3d1f('0x11')][_0x3d1f('0x13')]);return _0x9b6768(_0x5ec38a[_0x3d1f('0x11')][_0x3d1f('0x13')]);}else{logger[_0x3d1f('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x221564,_0x3d1f('0xd'));_0x9b6768(_0x5ec38a[_0x3d1f('0x14')][_0x3d1f('0x13')]);}})[_0x3d1f('0x15')](function(_0x167eac){logger['error'](_0x3d1f('0xc'),_0x221564,_0x167eac);_0x4640b6(_0x167eac);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 18f2622..cf894ee 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 _0xa1e9=['isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x10c1b4,_0x1b223c){var _0x39fcc3=function(_0x35223f){while(--_0x35223f){_0x10c1b4['push'](_0x10c1b4['shift']());}};_0x39fcc3(++_0x1b223c);}(_0xa1e9,0xab));var _0x9a1e=function(_0x4403e5,_0x32ddae){_0x4403e5=_0x4403e5-0x0;var _0x512114=_0xa1e9[_0x4403e5];return _0x512114;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9a1e('0x0'));var timeout=require(_0x9a1e('0x1'));var express=require(_0x9a1e('0x2'));var router=express[_0x9a1e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a1e('0x4'));var interaction=require(_0x9a1e('0x5'));var config=require(_0x9a1e('0x6'));var controller=require(_0x9a1e('0x7'));router[_0x9a1e('0x8')]('/',auth[_0x9a1e('0x9')](),controller['index']);router['get']('/describe',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0xa')]);router[_0x9a1e('0x8')](_0x9a1e('0xb'),auth[_0x9a1e('0x9')](),controller[_0x9a1e('0xc')]);router['get'](_0x9a1e('0xd'),auth['isAuthenticated'](),controller[_0x9a1e('0xe')]);router[_0x9a1e('0xf')]('/',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0x10')]);router['put']('/:id',auth[_0x9a1e('0x9')](),controller[_0x9a1e('0x11')]);router[_0x9a1e('0x12')](_0x9a1e('0xb'),auth['isAuthenticated'](),controller[_0x9a1e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe69d=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getQuestions','post','create','put'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe69d,0xfe));var _0xde69=function(_0x51ee6f,_0x185085){_0x51ee6f=_0x51ee6f-0x0;var _0x59d91c=_0xe69d[_0x51ee6f];return _0x59d91c;};'use strict';var multer=require(_0xde69('0x0'));var util=require(_0xde69('0x1'));var path=require(_0xde69('0x2'));var timeout=require(_0xde69('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xde69('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde69('0x5'));var config=require(_0xde69('0x6'));var controller=require(_0xde69('0x7'));router[_0xde69('0x8')]('/',auth['isAuthenticated'](),controller[_0xde69('0x9')]);router['get'](_0xde69('0xa'),auth[_0xde69('0xb')](),controller[_0xde69('0xc')]);router[_0xde69('0x8')](_0xde69('0xd'),auth[_0xde69('0xb')](),controller[_0xde69('0xe')]);router[_0xde69('0x8')]('/:id/questions',auth['isAuthenticated'](),controller[_0xde69('0xf')]);router[_0xde69('0x10')]('/',auth[_0xde69('0xb')](),controller[_0xde69('0x11')]);router[_0xde69('0x12')](_0xde69('0xd'),auth[_0xde69('0xb')](),controller['update']);router['delete'](_0xde69('0xd'),auth[_0xde69('0xb')](),controller[_0xde69('0x13')]);module[_0xde69('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 2b6f27b..b906d85 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 _0xea4f=['starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE','setDataValue'];(function(_0x188e34,_0x2d2c8){var _0x2838c6=function(_0x176707){while(--_0x176707){_0x188e34['push'](_0x188e34['shift']());}};_0x2838c6(++_0x2d2c8);}(_0xea4f,0x7a));var _0xfea4=function(_0x26ddc7,_0x4551df){_0x26ddc7=_0x26ddc7-0x0;var _0x4774f4=_0xea4f[_0x26ddc7];return _0x4774f4;};'use strict';var moment=require(_0xfea4('0x0'));var Sequelize=require(_0xfea4('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xfea4('0x2')],'set':function(_0x27c478){this[_0xfea4('0x3')](_0xfea4('0x4'),_0x27c478);this['setDataValue']('endtime',moment()['format'](_0xfea4('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xfea4('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfea4('0x6')]},'calleridnum':{'type':Sequelize[_0xfea4('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9d87=['DATE','setDataValue','starttime','endtime','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x1400d1,_0x4213c8){var _0x44c4b9=function(_0x57a3fd){while(--_0x57a3fd){_0x1400d1['push'](_0x1400d1['shift']());}};_0x44c4b9(++_0x4213c8);}(_0x9d87,0x102));var _0x79d8=function(_0x2a5bae,_0x371623){_0x2a5bae=_0x2a5bae-0x0;var _0x5d8fe4=_0x9d87[_0x2a5bae];return _0x5d8fe4;};'use strict';var moment=require(_0x79d8('0x0'));var Sequelize=require(_0x79d8('0x1'));module[_0x79d8('0x2')]={'starttime':{'type':Sequelize[_0x79d8('0x3')],'set':function(_0x9c152f){this[_0x79d8('0x4')](_0x79d8('0x5'),_0x9c152f);this[_0x79d8('0x4')](_0x79d8('0x6'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x79d8('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x79d8('0x7')]},'queue':{'type':Sequelize[_0x79d8('0x7')]},'uniqueid':{'type':Sequelize[_0x79d8('0x7')]},'calleridname':{'type':Sequelize[_0x79d8('0x7')]},'calleridnum':{'type':Sequelize[_0x79d8('0x7')]},'completed':{'type':Sequelize[_0x79d8('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 13ebb01..4afe967 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 _0xca6d=['type','then','includeAll','include','rows','catch','show','rawAttributes','options','find','create','body','describe','getQuestions','findOne','params','JscriptyQuestionReport','nolimit','order','pick','SessionId','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','error','name','JscriptySessionReport','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','merge','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca6d,0x1ea));var _0xdca6=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xca6d[_0x57014b];return _0x2b258a;};'use strict';var emlformat=require(_0xdca6('0x0'));var rimraf=require(_0xdca6('0x1'));var zipdir=require(_0xdca6('0x2'));var jsonpatch=require(_0xdca6('0x3'));var rp=require(_0xdca6('0x4'));var moment=require(_0xdca6('0x5'));var BPromise=require(_0xdca6('0x6'));var Mustache=require(_0xdca6('0x7'));var util=require('util');var path=require(_0xdca6('0x8'));var sox=require('sox');var csv=require(_0xdca6('0x9'));var ejs=require(_0xdca6('0xa'));var fs=require('fs');var fs_extra=require(_0xdca6('0xb'));var _=require(_0xdca6('0xc'));var squel=require(_0xdca6('0xd'));var crypto=require(_0xdca6('0xe'));var jsforce=require(_0xdca6('0xf'));var deskjs=require(_0xdca6('0x10'));var toCsv=require(_0xdca6('0x9'));var querystring=require('querystring');var Papa=require(_0xdca6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdca6('0x12'));var hardwareService=require(_0xdca6('0x13'));var logger=require(_0xdca6('0x14'))('api');var utils=require(_0xdca6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdca6('0x16'));var db=require(_0xdca6('0x17'))['db'];function respondWithStatusCode(_0x2e40fe,_0x1958e4){_0x1958e4=_0x1958e4||0xcc;return function(_0x5f1b88){if(_0x5f1b88){return _0x2e40fe[_0xdca6('0x18')](_0x1958e4);}return _0x2e40fe[_0xdca6('0x19')](_0x1958e4)[_0xdca6('0x1a')]();};}function respondWithResult(_0x52fca1,_0x3a0fa8){_0x3a0fa8=_0x3a0fa8||0xc8;return function(_0x18f4d5){if(_0x18f4d5){return _0x52fca1['status'](_0x3a0fa8)[_0xdca6('0x1b')](_0x18f4d5);}};}function respondWithFilteredResult(_0x5a0775,_0x4eb4a8){return function(_0x40e6b6){if(_0x40e6b6){var _0x34345e=typeof _0x4eb4a8[_0xdca6('0x1c')]===_0xdca6('0x1d')&&typeof _0x4eb4a8[_0xdca6('0x1e')]===_0xdca6('0x1d');var _0x326031=_0x40e6b6[_0xdca6('0x1f')];var _0x50a954=_0x34345e?0x0:_0x4eb4a8[_0xdca6('0x1c')];var _0x109391=_0x34345e?_0x40e6b6[_0xdca6('0x1f')]:_0x4eb4a8[_0xdca6('0x1c')]+_0x4eb4a8[_0xdca6('0x1e')];var _0x18d0bd;if(_0x109391>=_0x326031){_0x109391=_0x326031;_0x18d0bd=0xc8;}else{_0x18d0bd=0xce;}_0x5a0775[_0xdca6('0x19')](_0x18d0bd);return _0x5a0775[_0xdca6('0x20')](_0xdca6('0x21'),_0x50a954+'-'+_0x109391+'/'+_0x326031)[_0xdca6('0x1b')](_0x40e6b6);}return null;};}function patchUpdates(_0x4fec9b){return function(_0x3876ff){try{jsonpatch[_0xdca6('0x22')](_0x3876ff,_0x4fec9b,!![]);}catch(_0xcfb29c){return BPromise[_0xdca6('0x23')](_0xcfb29c);}return _0x3876ff['save']();};}function saveUpdates(_0x19c54e,_0x30540b){return function(_0x3e7280){if(_0x3e7280){return _0x3e7280[_0xdca6('0x24')](_0x19c54e)['then'](function(_0x3f7870){return _0x3f7870;});}return null;};}function removeEntity(_0x187954,_0x1f6968){return function(_0x4d7fe6){if(_0x4d7fe6){return _0x4d7fe6[_0xdca6('0x25')]()['then'](function(){_0x187954['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8108,_0x212d36){return function(_0x1bebdb){if(!_0x1bebdb){_0x2e8108['sendStatus'](0x194);}return _0x1bebdb;};}function handleError(_0x372a66,_0x354eaa){_0x354eaa=_0x354eaa||0x1f4;return function(_0x5a7cc0){logger[_0xdca6('0x26')](_0x5a7cc0['stack']);if(_0x5a7cc0[_0xdca6('0x27')]){delete _0x5a7cc0[_0xdca6('0x27')];}_0x372a66[_0xdca6('0x19')](_0x354eaa)['send'](_0x5a7cc0);};}exports['index']=function(_0x4946c7,_0x1bedbd){var _0xd75c8e={},_0x591740={},_0x248f81={'count':0x0,'rows':[]};var _0x3577a1=_['map'](db[_0xdca6('0x28')]['rawAttributes'],function(_0x3d963a){return{'name':_0x3d963a['fieldName'],'type':_0x3d963a['type'][_0xdca6('0x29')]};});_0x591740[_0xdca6('0x2a')]=_[_0xdca6('0x2b')](_0x3577a1,_0xdca6('0x27'));_0x591740[_0xdca6('0x2c')]=_[_0xdca6('0x2d')](_0x4946c7['query']);_0x591740[_0xdca6('0x2e')]=_[_0xdca6('0x2f')](_0x591740[_0xdca6('0x2a')],_0x591740[_0xdca6('0x2c')]);_0xd75c8e[_0xdca6('0x30')]=_['intersection'](_0x591740['model'],qs[_0xdca6('0x31')](_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x31')]));_0xd75c8e['attributes']=_0xd75c8e[_0xdca6('0x30')][_0xdca6('0x32')]?_0xd75c8e[_0xdca6('0x30')]:_0x591740[_0xdca6('0x2a')];if(!_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x33')]('nolimit')){_0xd75c8e['limit']=qs[_0xdca6('0x1e')](_0x4946c7['query'][_0xdca6('0x1e')]);_0xd75c8e[_0xdca6('0x1c')]=qs[_0xdca6('0x1c')](_0x4946c7['query']['offset']);}_0xd75c8e['order']=qs[_0xdca6('0x34')](_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x34')]);_0xd75c8e['where']=qs[_0xdca6('0x2e')](_['pick'](_0x4946c7[_0xdca6('0x2c')],_0x591740['filters']),_0x3577a1);if(_0x4946c7['query'][_0xdca6('0x35')]){_0xd75c8e['where']=_[_0xdca6('0x36')](_0xd75c8e[_0xdca6('0x37')],{'$or':_[_0xdca6('0x2b')](_0x3577a1,function(_0x5ca34e){if(_0x5ca34e[_0xdca6('0x38')]!=='VIRTUAL'){var _0x1b2b19={};_0x1b2b19[_0x5ca34e['name']]={'$like':'%'+_0x4946c7[_0xdca6('0x2c')][_0xdca6('0x35')]+'%'};return _0x1b2b19;}})});}_0xd75c8e=_[_0xdca6('0x36')]({},_0xd75c8e,_0x4946c7['options']);var _0x22056f={'where':_0xd75c8e[_0xdca6('0x37')]};return db[_0xdca6('0x28')][_0xdca6('0x1f')](_0x22056f)[_0xdca6('0x39')](function(_0xc52ff3){_0x248f81['count']=_0xc52ff3;if(_0x4946c7['query'][_0xdca6('0x3a')]){_0xd75c8e[_0xdca6('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0xd75c8e);})[_0xdca6('0x39')](function(_0x1d81b8){_0x248f81[_0xdca6('0x3c')]=_0x1d81b8;return _0x248f81;})['then'](respondWithFilteredResult(_0x1bedbd,_0xd75c8e))[_0xdca6('0x3d')](handleError(_0x1bedbd,null));};exports[_0xdca6('0x3e')]=function(_0x4b70d0,_0x15f4be){var _0x870739={'raw':!![],'where':{'id':_0x4b70d0['params']['id']}},_0x70a1c4={};_0x70a1c4['model']=_[_0xdca6('0x2d')](db[_0xdca6('0x28')][_0xdca6('0x3f')]);_0x70a1c4['query']=_['keys'](_0x4b70d0[_0xdca6('0x2c')]);_0x70a1c4[_0xdca6('0x2e')]=_['intersection'](_0x70a1c4[_0xdca6('0x2a')],_0x70a1c4[_0xdca6('0x2c')]);_0x870739[_0xdca6('0x30')]=_[_0xdca6('0x2f')](_0x70a1c4[_0xdca6('0x2a')],qs['fields'](_0x4b70d0[_0xdca6('0x2c')][_0xdca6('0x31')]));_0x870739[_0xdca6('0x30')]=_0x870739[_0xdca6('0x30')][_0xdca6('0x32')]?_0x870739[_0xdca6('0x30')]:_0x70a1c4['model'];if(_0x4b70d0[_0xdca6('0x2c')][_0xdca6('0x3a')]){_0x870739[_0xdca6('0x3b')]=[{'all':!![]}];}_0x870739=_['merge']({},_0x870739,_0x4b70d0[_0xdca6('0x40')]);return db[_0xdca6('0x28')][_0xdca6('0x41')](_0x870739)[_0xdca6('0x39')](handleEntityNotFound(_0x15f4be,null))[_0xdca6('0x39')](respondWithResult(_0x15f4be,null))['catch'](handleError(_0x15f4be,null));};exports['create']=function(_0x1a3bcb,_0x51078f){return db[_0xdca6('0x28')][_0xdca6('0x42')](_0x1a3bcb['body'],{})['then'](respondWithResult(_0x51078f,0xc9))['catch'](handleError(_0x51078f,null));};exports[_0xdca6('0x24')]=function(_0x1db2b2,_0x3b6498){if(_0x1db2b2[_0xdca6('0x43')]['id']){delete _0x1db2b2['body']['id'];}return db[_0xdca6('0x28')][_0xdca6('0x41')]({'where':{'id':_0x1db2b2['params']['id']}})[_0xdca6('0x39')](handleEntityNotFound(_0x3b6498,null))[_0xdca6('0x39')](saveUpdates(_0x1db2b2[_0xdca6('0x43')],null))[_0xdca6('0x39')](respondWithResult(_0x3b6498,null))[_0xdca6('0x3d')](handleError(_0x3b6498,null));};exports[_0xdca6('0x25')]=function(_0x23a3e6,_0x201a74){return db[_0xdca6('0x28')][_0xdca6('0x41')]({'where':{'id':_0x23a3e6['params']['id']}})['then'](handleEntityNotFound(_0x201a74,null))[_0xdca6('0x39')](removeEntity(_0x201a74,null))[_0xdca6('0x3d')](handleError(_0x201a74,null));};exports['describe']=function(_0x682b2c,_0x28d248){return db[_0xdca6('0x28')][_0xdca6('0x44')]()['then'](respondWithResult(_0x28d248,null))[_0xdca6('0x3d')](handleError(_0x28d248,null));};exports[_0xdca6('0x45')]=function(_0x15ea80,_0xe8dce9,_0x2d7329){var _0x3be5a0={'raw':!![],'where':{}};var _0x1f0f17={};var _0x38998b={'count':0x0,'rows':[]};return db[_0xdca6('0x28')][_0xdca6('0x46')]({'where':{'id':_0x15ea80[_0xdca6('0x47')]['id']}})[_0xdca6('0x39')](handleEntityNotFound(_0xe8dce9,null))[_0xdca6('0x39')](function(_0x3e69a1){if(_0x3e69a1){_0x1f0f17[_0xdca6('0x2a')]=_[_0xdca6('0x2d')](db[_0xdca6('0x48')]['rawAttributes']);_0x1f0f17[_0xdca6('0x2c')]=_[_0xdca6('0x2d')](_0x15ea80[_0xdca6('0x2c')]);_0x1f0f17[_0xdca6('0x2e')]=_[_0xdca6('0x2f')](_0x1f0f17[_0xdca6('0x2a')],_0x1f0f17[_0xdca6('0x2c')]);_0x3be5a0[_0xdca6('0x30')]=_[_0xdca6('0x2f')](_0x1f0f17[_0xdca6('0x2a')],qs['fields'](_0x15ea80[_0xdca6('0x2c')]['fields']));_0x3be5a0[_0xdca6('0x30')]=_0x3be5a0['attributes'][_0xdca6('0x32')]?_0x3be5a0['attributes']:_0x1f0f17['model'];if(!_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x33')](_0xdca6('0x49'))){_0x3be5a0[_0xdca6('0x1e')]=qs[_0xdca6('0x1e')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x1e')]);_0x3be5a0[_0xdca6('0x1c')]=qs[_0xdca6('0x1c')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x1c')]);}_0x3be5a0[_0xdca6('0x4a')]=qs[_0xdca6('0x34')](_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x34')]);_0x3be5a0[_0xdca6('0x37')]=qs[_0xdca6('0x2e')](_[_0xdca6('0x4b')](_0x15ea80['query'],_0x1f0f17[_0xdca6('0x2e')]));_0x3be5a0[_0xdca6('0x37')][_0xdca6('0x4c')]=_0x3e69a1['id'];if(_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x35')]){_0x3be5a0[_0xdca6('0x37')]=_[_0xdca6('0x36')](_0x3be5a0[_0xdca6('0x37')],{'$or':_['map'](_0x3be5a0['attributes'],function(_0x1f2539){var _0x1f17bf={};_0x1f17bf[_0x1f2539]={'$like':'%'+_0x15ea80[_0xdca6('0x2c')][_0xdca6('0x35')]+'%'};return _0x1f17bf;})});}_0x3be5a0=_[_0xdca6('0x36')]({},_0x3be5a0,_0x15ea80[_0xdca6('0x40')]);return db[_0xdca6('0x48')]['count']({'where':_0x3be5a0[_0xdca6('0x37')]})[_0xdca6('0x39')](function(_0x9662c7){_0x38998b[_0xdca6('0x1f')]=_0x9662c7;if(_0x15ea80['query'][_0xdca6('0x3a')]){_0x3be5a0[_0xdca6('0x3b')]=[{'all':!![]}];}return db[_0xdca6('0x48')][_0xdca6('0x4d')](_0x3be5a0);})[_0xdca6('0x39')](function(_0x2bf16f){_0x38998b[_0xdca6('0x3c')]=_0x2bf16f;return _0x38998b;});}})[_0xdca6('0x39')](respondWithFilteredResult(_0xe8dce9,_0x3be5a0))[_0xdca6('0x3d')](handleError(_0xe8dce9,null));}; \ No newline at end of file +var _0x045c=['sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','create','body','find','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','includeAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x17b69d,_0x4c6042){var _0x58f85b=function(_0x3a29e1){while(--_0x3a29e1){_0x17b69d['push'](_0x17b69d['shift']());}};_0x58f85b(++_0x4c6042);}(_0x045c,0xbc));var _0xc045=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x045c[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0xc045('0x0'));var rimraf=require(_0xc045('0x1'));var zipdir=require(_0xc045('0x2'));var jsonpatch=require(_0xc045('0x3'));var rp=require(_0xc045('0x4'));var moment=require(_0xc045('0x5'));var BPromise=require(_0xc045('0x6'));var Mustache=require(_0xc045('0x7'));var util=require(_0xc045('0x8'));var path=require(_0xc045('0x9'));var sox=require(_0xc045('0xa'));var csv=require('to-csv');var ejs=require(_0xc045('0xb'));var fs=require('fs');var fs_extra=require(_0xc045('0xc'));var _=require(_0xc045('0xd'));var squel=require(_0xc045('0xe'));var crypto=require('crypto');var jsforce=require(_0xc045('0xf'));var deskjs=require(_0xc045('0x10'));var toCsv=require(_0xc045('0x11'));var querystring=require(_0xc045('0x12'));var Papa=require(_0xc045('0x13'));var Redis=require('ioredis');var authService=require(_0xc045('0x14'));var qs=require(_0xc045('0x15'));var as=require(_0xc045('0x16'));var hardwareService=require(_0xc045('0x17'));var logger=require(_0xc045('0x18'))(_0xc045('0x19'));var utils=require('../../config/utils');var config=require(_0xc045('0x1a'));var licenseUtil=require(_0xc045('0x1b'));var db=require(_0xc045('0x1c'))['db'];function respondWithStatusCode(_0x7c6361,_0x66078f){_0x66078f=_0x66078f||0xcc;return function(_0x5c6155){if(_0x5c6155){return _0x7c6361[_0xc045('0x1d')](_0x66078f);}return _0x7c6361[_0xc045('0x1e')](_0x66078f)[_0xc045('0x1f')]();};}function respondWithResult(_0x4e4de8,_0x8b952){_0x8b952=_0x8b952||0xc8;return function(_0x30dc31){if(_0x30dc31){return _0x4e4de8[_0xc045('0x1e')](_0x8b952)[_0xc045('0x20')](_0x30dc31);}};}function respondWithFilteredResult(_0x43f74d,_0xa19213){return function(_0x24912a){if(_0x24912a){var _0x1f102e=typeof _0xa19213[_0xc045('0x21')]===_0xc045('0x22')&&typeof _0xa19213['limit']===_0xc045('0x22');var _0x37c7d1=_0x24912a[_0xc045('0x23')];var _0x55b68a=_0x1f102e?0x0:_0xa19213[_0xc045('0x21')];var _0x191c86=_0x1f102e?_0x24912a[_0xc045('0x23')]:_0xa19213[_0xc045('0x21')]+_0xa19213[_0xc045('0x24')];var _0x588c59;if(_0x191c86>=_0x37c7d1){_0x191c86=_0x37c7d1;_0x588c59=0xc8;}else{_0x588c59=0xce;}_0x43f74d[_0xc045('0x1e')](_0x588c59);return _0x43f74d[_0xc045('0x25')](_0xc045('0x26'),_0x55b68a+'-'+_0x191c86+'/'+_0x37c7d1)['json'](_0x24912a);}return null;};}function patchUpdates(_0x436f8d){return function(_0x202b94){try{jsonpatch[_0xc045('0x27')](_0x202b94,_0x436f8d,!![]);}catch(_0x3a4ee1){return BPromise[_0xc045('0x28')](_0x3a4ee1);}return _0x202b94[_0xc045('0x29')]();};}function saveUpdates(_0x3c7157,_0x227d35){return function(_0x385d42){if(_0x385d42){return _0x385d42[_0xc045('0x2a')](_0x3c7157)[_0xc045('0x2b')](function(_0x3b53b6){return _0x3b53b6;});}return null;};}function removeEntity(_0x338dab,_0x23ec17){return function(_0x17783f){if(_0x17783f){return _0x17783f[_0xc045('0x2c')]()[_0xc045('0x2b')](function(){_0x338dab[_0xc045('0x1e')](0xcc)[_0xc045('0x1f')]();});}};}function handleEntityNotFound(_0x4b45eb,_0x52a47a){return function(_0x4b8e6c){if(!_0x4b8e6c){_0x4b45eb[_0xc045('0x1d')](0x194);}return _0x4b8e6c;};}function handleError(_0x350f63,_0x4fac6d){_0x4fac6d=_0x4fac6d||0x1f4;return function(_0x1ac060){logger[_0xc045('0x2d')](_0x1ac060['stack']);if(_0x1ac060['name']){delete _0x1ac060[_0xc045('0x2e')];}_0x350f63[_0xc045('0x1e')](_0x4fac6d)['send'](_0x1ac060);};}exports[_0xc045('0x2f')]=function(_0x3b0e52,_0x4a4f84){var _0x56a9b6={},_0x106b86={},_0x3e244c={'count':0x0,'rows':[]};var _0x1fe01a=_[_0xc045('0x30')](db[_0xc045('0x31')]['rawAttributes'],function(_0x565e65){return{'name':_0x565e65[_0xc045('0x32')],'type':_0x565e65[_0xc045('0x33')][_0xc045('0x34')]};});_0x106b86[_0xc045('0x35')]=_[_0xc045('0x30')](_0x1fe01a,_0xc045('0x2e'));_0x106b86[_0xc045('0x36')]=_[_0xc045('0x37')](_0x3b0e52[_0xc045('0x36')]);_0x106b86[_0xc045('0x38')]=_[_0xc045('0x39')](_0x106b86[_0xc045('0x35')],_0x106b86['query']);_0x56a9b6['attributes']=_['intersection'](_0x106b86['model'],qs[_0xc045('0x3a')](_0x3b0e52['query']['fields']));_0x56a9b6[_0xc045('0x3b')]=_0x56a9b6[_0xc045('0x3b')][_0xc045('0x3c')]?_0x56a9b6[_0xc045('0x3b')]:_0x106b86[_0xc045('0x35')];if(!_0x3b0e52[_0xc045('0x36')][_0xc045('0x3d')](_0xc045('0x3e'))){_0x56a9b6[_0xc045('0x24')]=qs[_0xc045('0x24')](_0x3b0e52[_0xc045('0x36')][_0xc045('0x24')]);_0x56a9b6['offset']=qs[_0xc045('0x21')](_0x3b0e52['query']['offset']);}_0x56a9b6[_0xc045('0x3f')]=qs[_0xc045('0x40')](_0x3b0e52[_0xc045('0x36')][_0xc045('0x40')]);_0x56a9b6[_0xc045('0x41')]=qs[_0xc045('0x38')](_['pick'](_0x3b0e52[_0xc045('0x36')],_0x106b86[_0xc045('0x38')]),_0x1fe01a);if(_0x3b0e52[_0xc045('0x36')][_0xc045('0x42')]){_0x56a9b6[_0xc045('0x41')]=_[_0xc045('0x43')](_0x56a9b6[_0xc045('0x41')],{'$or':_['map'](_0x1fe01a,function(_0x51b7c3){if(_0x51b7c3[_0xc045('0x33')]!==_0xc045('0x44')){var _0x1d0958={};_0x1d0958[_0x51b7c3[_0xc045('0x2e')]]={'$like':'%'+_0x3b0e52[_0xc045('0x36')][_0xc045('0x42')]+'%'};return _0x1d0958;}})});}_0x56a9b6=_[_0xc045('0x43')]({},_0x56a9b6,_0x3b0e52[_0xc045('0x45')]);var _0x17e3b6={'where':_0x56a9b6[_0xc045('0x41')]};return db[_0xc045('0x31')][_0xc045('0x23')](_0x17e3b6)[_0xc045('0x2b')](function(_0x5643e5){_0x3e244c['count']=_0x5643e5;if(_0x3b0e52[_0xc045('0x36')]['includeAll']){_0x56a9b6[_0xc045('0x46')]=[{'all':!![]}];}return db[_0xc045('0x31')]['findAll'](_0x56a9b6);})[_0xc045('0x2b')](function(_0x3f553a){_0x3e244c[_0xc045('0x47')]=_0x3f553a;return _0x3e244c;})[_0xc045('0x2b')](respondWithFilteredResult(_0x4a4f84,_0x56a9b6))[_0xc045('0x48')](handleError(_0x4a4f84,null));};exports[_0xc045('0x49')]=function(_0x548ea2,_0x34b3d7){var _0x29d5f0={'raw':!![],'where':{'id':_0x548ea2[_0xc045('0x4a')]['id']}},_0xef1796={};_0xef1796[_0xc045('0x35')]=_['keys'](db[_0xc045('0x31')]['rawAttributes']);_0xef1796[_0xc045('0x36')]=_[_0xc045('0x37')](_0x548ea2[_0xc045('0x36')]);_0xef1796[_0xc045('0x38')]=_[_0xc045('0x39')](_0xef1796['model'],_0xef1796[_0xc045('0x36')]);_0x29d5f0[_0xc045('0x3b')]=_[_0xc045('0x39')](_0xef1796['model'],qs[_0xc045('0x3a')](_0x548ea2[_0xc045('0x36')][_0xc045('0x3a')]));_0x29d5f0['attributes']=_0x29d5f0[_0xc045('0x3b')][_0xc045('0x3c')]?_0x29d5f0['attributes']:_0xef1796[_0xc045('0x35')];if(_0x548ea2['query']['includeAll']){_0x29d5f0['include']=[{'all':!![]}];}_0x29d5f0=_[_0xc045('0x43')]({},_0x29d5f0,_0x548ea2['options']);return db['JscriptySessionReport']['find'](_0x29d5f0)['then'](handleEntityNotFound(_0x34b3d7,null))['then'](respondWithResult(_0x34b3d7,null))[_0xc045('0x48')](handleError(_0x34b3d7,null));};exports[_0xc045('0x4b')]=function(_0x476572,_0x1fd66f){return db[_0xc045('0x31')][_0xc045('0x4b')](_0x476572[_0xc045('0x4c')],{})[_0xc045('0x2b')](respondWithResult(_0x1fd66f,0xc9))[_0xc045('0x48')](handleError(_0x1fd66f,null));};exports[_0xc045('0x2a')]=function(_0x46fb3b,_0x50b588){if(_0x46fb3b[_0xc045('0x4c')]['id']){delete _0x46fb3b[_0xc045('0x4c')]['id'];}return db[_0xc045('0x31')][_0xc045('0x4d')]({'where':{'id':_0x46fb3b[_0xc045('0x4a')]['id']}})[_0xc045('0x2b')](handleEntityNotFound(_0x50b588,null))[_0xc045('0x2b')](saveUpdates(_0x46fb3b[_0xc045('0x4c')],null))['then'](respondWithResult(_0x50b588,null))[_0xc045('0x48')](handleError(_0x50b588,null));};exports[_0xc045('0x2c')]=function(_0x1e53f2,_0x3dd4b0){return db[_0xc045('0x31')]['find']({'where':{'id':_0x1e53f2[_0xc045('0x4a')]['id']}})[_0xc045('0x2b')](handleEntityNotFound(_0x3dd4b0,null))[_0xc045('0x2b')](removeEntity(_0x3dd4b0,null))['catch'](handleError(_0x3dd4b0,null));};exports[_0xc045('0x4e')]=function(_0xeef4bd,_0x1b42f7){return db[_0xc045('0x31')][_0xc045('0x4e')]()['then'](respondWithResult(_0x1b42f7,null))[_0xc045('0x48')](handleError(_0x1b42f7,null));};exports[_0xc045('0x4f')]=function(_0x45372d,_0x4fe0ea,_0x320b11){var _0x381345={'raw':!![],'where':{}};var _0x10286e={};var _0xec0475={'count':0x0,'rows':[]};return db[_0xc045('0x31')][_0xc045('0x50')]({'where':{'id':_0x45372d[_0xc045('0x4a')]['id']}})[_0xc045('0x2b')](handleEntityNotFound(_0x4fe0ea,null))[_0xc045('0x2b')](function(_0xe4e929){if(_0xe4e929){_0x10286e[_0xc045('0x35')]=_[_0xc045('0x37')](db[_0xc045('0x51')][_0xc045('0x52')]);_0x10286e['query']=_[_0xc045('0x37')](_0x45372d[_0xc045('0x36')]);_0x10286e['filters']=_[_0xc045('0x39')](_0x10286e['model'],_0x10286e[_0xc045('0x36')]);_0x381345['attributes']=_[_0xc045('0x39')](_0x10286e[_0xc045('0x35')],qs[_0xc045('0x3a')](_0x45372d[_0xc045('0x36')][_0xc045('0x3a')]));_0x381345[_0xc045('0x3b')]=_0x381345['attributes']['length']?_0x381345[_0xc045('0x3b')]:_0x10286e[_0xc045('0x35')];if(!_0x45372d[_0xc045('0x36')]['hasOwnProperty'](_0xc045('0x3e'))){_0x381345[_0xc045('0x24')]=qs[_0xc045('0x24')](_0x45372d['query']['limit']);_0x381345[_0xc045('0x21')]=qs[_0xc045('0x21')](_0x45372d[_0xc045('0x36')][_0xc045('0x21')]);}_0x381345[_0xc045('0x3f')]=qs['sort'](_0x45372d[_0xc045('0x36')]['sort']);_0x381345[_0xc045('0x41')]=qs[_0xc045('0x38')](_['pick'](_0x45372d[_0xc045('0x36')],_0x10286e[_0xc045('0x38')]));_0x381345[_0xc045('0x41')]['SessionId']=_0xe4e929['id'];if(_0x45372d[_0xc045('0x36')][_0xc045('0x42')]){_0x381345[_0xc045('0x41')]=_[_0xc045('0x43')](_0x381345[_0xc045('0x41')],{'$or':_[_0xc045('0x30')](_0x381345[_0xc045('0x3b')],function(_0x36018e){var _0x5085f9={};_0x5085f9[_0x36018e]={'$like':'%'+_0x45372d['query'][_0xc045('0x42')]+'%'};return _0x5085f9;})});}_0x381345=_[_0xc045('0x43')]({},_0x381345,_0x45372d['options']);return db[_0xc045('0x51')]['count']({'where':_0x381345[_0xc045('0x41')]})['then'](function(_0x28dd1a){_0xec0475[_0xc045('0x23')]=_0x28dd1a;if(_0x45372d[_0xc045('0x36')][_0xc045('0x53')]){_0x381345[_0xc045('0x46')]=[{'all':!![]}];}return db[_0xc045('0x51')]['findAll'](_0x381345);})[_0xc045('0x2b')](function(_0x110df9){_0xec0475[_0xc045('0x47')]=_0x110df9;return _0xec0475;});}})['then'](respondWithFilteredResult(_0x4fe0ea,_0x381345))[_0xc045('0x48')](handleError(_0x4fe0ea,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d950a55..fee2d73 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 _0x4819=['report_jscripty_sessions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0x449123,_0x2696c0){var _0x4151c0=function(_0x5ad137){while(--_0x5ad137){_0x449123['push'](_0x449123['shift']());}};_0x4151c0(++_0x2696c0);}(_0x4819,0xcd));var _0x9481=function(_0x4ef1a9,_0x59a5fa){_0x4ef1a9=_0x4ef1a9-0x0;var _0x23f201=_0x4819[_0x4ef1a9];return _0x23f201;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));module['exports']=function(_0x4d9e3a,_0x5def07){return _0x4d9e3a['define'](_0x9481('0xa'),attributes,{'tableName':_0x9481('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport'];(function(_0x379f71,_0x4a159a){var _0x446c2c=function(_0x3d501f){while(--_0x3d501f){_0x379f71['push'](_0x379f71['shift']());}};_0x446c2c(++_0x4a159a);}(_0xd8fb,0x99));var _0xbd8f=function(_0x43ac57,_0x5842f1){_0x43ac57=_0x43ac57-0x0;var _0x389f61=_0xd8fb[_0x43ac57];return _0x389f61;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 835d1f9..c716c2f 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 _0xd117=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','code','error','message'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd117,0x182));var _0x7d11=function(_0x40f9a0,_0x3458cc){_0x40f9a0=_0x40f9a0-0x0;var _0x3e3144=_0xd117[_0x40f9a0];return _0x3e3144;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});} \ No newline at end of file +var _0x3d04=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','info'];(function(_0x2f2ff5,_0x453923){var _0x58d4ec=function(_0x1cb114){while(--_0x1cb114){_0x2f2ff5['push'](_0x2f2ff5['shift']());}};_0x58d4ec(++_0x453923);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8e86566..6de3c4a 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 _0x6511=['./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x6511,0x8f));var _0x1651=function(_0x416a0a,_0x24f91f){_0x416a0a=_0x416a0a-0x0;var _0x574c9f=_0x6511[_0x416a0a];return _0x574c9f;};'use strict';var multer=require(_0x1651('0x0'));var util=require(_0x1651('0x1'));var path=require('path');var timeout=require(_0x1651('0x2'));var express=require(_0x1651('0x3'));var router=express[_0x1651('0x4')]();var fs_extra=require(_0x1651('0x5'));var auth=require(_0x1651('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1651('0x7'));router[_0x1651('0x8')]('/',controller[_0x1651('0x9')]);router[_0x1651('0xa')](_0x1651('0xb'),auth[_0x1651('0xc')](),controller[_0x1651('0xd')]);router[_0x1651('0x8')]('/download_log_file',auth[_0x1651('0xc')](),controller[_0x1651('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf65f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile'];(function(_0xba0c2,_0x54cc50){var _0x5a9fa0=function(_0x577bcb){while(--_0x577bcb){_0xba0c2['push'](_0xba0c2['shift']());}};_0x5a9fa0(++_0x54cc50);}(_0xf65f,0xf0));var _0xff65=function(_0xce32b1,_0x311c05){_0xce32b1=_0xce32b1-0x0;var _0x55fbd3=_0xf65f[_0xce32b1];return _0x55fbd3;};'use strict';var multer=require(_0xff65('0x0'));var util=require(_0xff65('0x1'));var path=require(_0xff65('0x2'));var timeout=require(_0xff65('0x3'));var express=require(_0xff65('0x4'));var router=express[_0xff65('0x5')]();var fs_extra=require(_0xff65('0x6'));var auth=require(_0xff65('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xff65('0x8'));var controller=require(_0xff65('0x9'));router['get']('/',controller['index']);router['put'](_0xff65('0xa'),auth['isAuthenticated'](),controller[_0xff65('0xb')]);router[_0xff65('0xc')](_0xff65('0xd'),auth[_0xff65('0xe')](),controller[_0xff65('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index f343d0a..33ef494 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 _0x0a9a=['sequelize','STRING','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a9a,0x132));var _0xa0a9=function(_0x257949,_0xe7dc53){_0x257949=_0x257949-0x0;var _0x112383=_0x0a9a[_0x257949];return _0x112383;};'use strict';var Sequelize=require(_0xa0a9('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xa0a9('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa0a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x79ec=['STRING','TEXT'];(function(_0x271a23,_0x1e1906){var _0x3ce2db=function(_0xa05bee){while(--_0xa05bee){_0x271a23['push'](_0x271a23['shift']());}};_0x3ce2db(++_0x1e1906);}(_0x79ec,0x175));var _0xc79e=function(_0x2d604d,_0x51a1f5){_0x2d604d=_0x2d604d-0x0;var _0x159761=_0x79ec[_0x2d604d];return _0x159761;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0xc79e('0x0')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc79e('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d6e1008..bb21a26 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 _0x2c57=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','name','send','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','then','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0xb48df0,_0x138d5b){var _0x2a60df=function(_0xd222ed){while(--_0xd222ed){_0xb48df0['push'](_0xb48df0['shift']());}};_0x2a60df(++_0x138d5b);}(_0x2c57,0x75));var _0x72c5=function(_0x30565c,_0x14dbf2){_0x30565c=_0x30565c-0x0;var _0x55e4b7=_0x2c57[_0x30565c];return _0x55e4b7;};'use strict';var emlformat=require(_0x72c5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x72c5('0x1'));var rp=require('request-promise');var moment=require(_0x72c5('0x2'));var BPromise=require(_0x72c5('0x3'));var Mustache=require('mustache');var util=require(_0x72c5('0x4'));var path=require(_0x72c5('0x5'));var sox=require('sox');var csv=require(_0x72c5('0x6'));var ejs=require(_0x72c5('0x7'));var fs=require('fs');var fs_extra=require(_0x72c5('0x8'));var _=require('lodash');var squel=require(_0x72c5('0x9'));var crypto=require(_0x72c5('0xa'));var jsforce=require(_0x72c5('0xb'));var deskjs=require(_0x72c5('0xc'));var toCsv=require(_0x72c5('0x6'));var querystring=require(_0x72c5('0xd'));var Papa=require(_0x72c5('0xe'));var Redis=require(_0x72c5('0xf'));var authService=require(_0x72c5('0x10'));var qs=require(_0x72c5('0x11'));var as=require(_0x72c5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x72c5('0x13'));var utils=require(_0x72c5('0x14'));var config=require(_0x72c5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x72c5('0x16'))['db'];function respondWithStatusCode(_0x5b788d,_0x51a09b){_0x51a09b=_0x51a09b||0xcc;return function(_0x450593){if(_0x450593){return _0x5b788d[_0x72c5('0x17')](_0x51a09b);}return _0x5b788d[_0x72c5('0x18')](_0x51a09b)[_0x72c5('0x19')]();};}function respondWithResult(_0x307f6,_0xc312bb){_0xc312bb=_0xc312bb||0xc8;return function(_0x1e2b21){if(_0x1e2b21){return _0x307f6['status'](_0xc312bb)['json'](_0x1e2b21);}};}function respondWithFilteredResult(_0x1721ec,_0x15200){return function(_0x1114b6){if(_0x1114b6){var _0x54eaf2=typeof _0x15200[_0x72c5('0x1a')]===_0x72c5('0x1b')&&typeof _0x15200[_0x72c5('0x1c')]===_0x72c5('0x1b');var _0x155778=_0x1114b6[_0x72c5('0x1d')];var _0x7b40b=_0x54eaf2?0x0:_0x15200['offset'];var _0x45688f=_0x54eaf2?_0x1114b6['count']:_0x15200[_0x72c5('0x1a')]+_0x15200[_0x72c5('0x1c')];var _0x51fc07;if(_0x45688f>=_0x155778){_0x45688f=_0x155778;_0x51fc07=0xc8;}else{_0x51fc07=0xce;}_0x1721ec[_0x72c5('0x18')](_0x51fc07);return _0x1721ec[_0x72c5('0x1e')](_0x72c5('0x1f'),_0x7b40b+'-'+_0x45688f+'/'+_0x155778)[_0x72c5('0x20')](_0x1114b6);}return null;};}function patchUpdates(_0xc66c60){return function(_0x1ca15){try{jsonpatch[_0x72c5('0x21')](_0x1ca15,_0xc66c60,!![]);}catch(_0x32a4ce){return BPromise[_0x72c5('0x22')](_0x32a4ce);}return _0x1ca15[_0x72c5('0x23')]();};}function saveUpdates(_0x31d83f,_0x23b795){return function(_0x117f8a){if(_0x117f8a){return _0x117f8a[_0x72c5('0x24')](_0x31d83f)['then'](function(_0xcb86e7){return _0xcb86e7;});}return null;};}function removeEntity(_0xa40022,_0x1d3dc8){return function(_0x2191c5){if(_0x2191c5){return _0x2191c5[_0x72c5('0x25')]()['then'](function(){_0xa40022[_0x72c5('0x18')](0xcc)[_0x72c5('0x19')]();});}};}function handleEntityNotFound(_0x30c91a,_0x35cd1b){return function(_0x1ea7b3){if(!_0x1ea7b3){_0x30c91a[_0x72c5('0x17')](0x194);}return _0x1ea7b3;};}function handleError(_0x523f56,_0x39c5dd){_0x39c5dd=_0x39c5dd||0x1f4;return function(_0x361284){logger['error'](_0x361284['stack']);if(_0x361284[_0x72c5('0x26')]){delete _0x361284['name'];}_0x523f56[_0x72c5('0x18')](_0x39c5dd)[_0x72c5('0x27')](_0x361284);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x22b2a6,_0x535a57){var _0x59370e={'raw':!![],'where':{'id':0x1}},_0x33fb02={};_0x33fb02[_0x72c5('0x28')]=_[_0x72c5('0x29')](db[_0x72c5('0x2a')]['rawAttributes']);_0x33fb02['query']=_[_0x72c5('0x29')](_0x22b2a6[_0x72c5('0x2b')]);_0x33fb02['filters']=_[_0x72c5('0x2c')](_0x33fb02['model'],_0x33fb02['query']);_0x59370e[_0x72c5('0x2d')]=_[_0x72c5('0x2c')](_0x33fb02[_0x72c5('0x28')],qs[_0x72c5('0x2e')](_0x22b2a6[_0x72c5('0x2b')][_0x72c5('0x2e')]));_0x59370e['attributes']=_0x59370e[_0x72c5('0x2d')][_0x72c5('0x2f')]?_0x59370e['attributes']:_0x33fb02[_0x72c5('0x28')];_0x59370e=_[_0x72c5('0x30')]({},_0x59370e,_0x22b2a6[_0x72c5('0x31')]);return utilLicense[_0x72c5('0x32')](_0x59370e)['then'](respondWithResult(_0x535a57,null))[_0x72c5('0x33')](handleError(_0x535a57,null));};exports['update']=function(_0x5ec4e3,_0x46d034){if(_0x5ec4e3['body']['id']){delete _0x5ec4e3[_0x72c5('0x34')]['id'];}return db[_0x72c5('0x2a')][_0x72c5('0x35')]({'where':{'id':_0x5ec4e3['params']['id']}})[_0x72c5('0x36')](handleEntityNotFound(_0x46d034,null))[_0x72c5('0x36')](function(_0x3606fd){var _0x12517d=_0x3606fd[_0x72c5('0x37')]({'plain':!![]});return utilLicense[_0x72c5('0x38')](_0x12517d,_0x5ec4e3['body'][_0x72c5('0x39')]);})[_0x72c5('0x36')](function(_0x13cfb5){if(!_0x13cfb5['demo']){return saveUpdates(_0x5ec4e3['body'],null);}return _0x13cfb5;})['then'](respondWithResult(_0x46d034,null))[_0x72c5('0x33')](handleError(_0x46d034,null));};exports[_0x72c5('0x3a')]=function(_0x18898b,_0xd2b454){var _0x22212b=_0x72c5('0x3b');var _0x2b732c=path[_0x72c5('0x3c')](_0x72c5('0x3d'),_0x72c5('0x3e'),_0x72c5('0x3f'),_0x22212b);_0xd2b454['setHeader'](_0x72c5('0x40'),_0x72c5('0x41')+_0x22212b);_0xd2b454[_0x72c5('0x1e')](_0x72c5('0x42'),_0x72c5('0x43'));_0xd2b454[_0x72c5('0x44')](_0x2b732c);}; \ No newline at end of file +var _0x5bf8=['text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','update','body','find','get','demo','downloadLogFile','license-info.log','/var','log','Content-disposition','attachment;\x20filename=','Content-Type'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5bf8,0xce));var _0x85bf=function(_0x2f4f25,_0x592d31){_0x2f4f25=_0x2f4f25-0x0;var _0x6a112a=_0x5bf8[_0x2f4f25];return _0x6a112a;};'use strict';var emlformat=require(_0x85bf('0x0'));var rimraf=require(_0x85bf('0x1'));var zipdir=require(_0x85bf('0x2'));var jsonpatch=require(_0x85bf('0x3'));var rp=require(_0x85bf('0x4'));var moment=require(_0x85bf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85bf('0x6'));var util=require(_0x85bf('0x7'));var path=require(_0x85bf('0x8'));var sox=require(_0x85bf('0x9'));var csv=require(_0x85bf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85bf('0xb'));var _=require(_0x85bf('0xc'));var squel=require('squel');var crypto=require(_0x85bf('0xd'));var jsforce=require(_0x85bf('0xe'));var deskjs=require(_0x85bf('0xf'));var toCsv=require(_0x85bf('0xa'));var querystring=require(_0x85bf('0x10'));var Papa=require('papaparse');var Redis=require(_0x85bf('0x11'));var authService=require(_0x85bf('0x12'));var qs=require(_0x85bf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85bf('0x14'))('api');var utils=require(_0x85bf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x85bf('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b5e3,_0x5266f7){_0x5266f7=_0x5266f7||0xcc;return function(_0x1b667e){if(_0x1b667e){return _0x54b5e3[_0x85bf('0x17')](_0x5266f7);}return _0x54b5e3[_0x85bf('0x18')](_0x5266f7)[_0x85bf('0x19')]();};}function respondWithResult(_0xbdc583,_0x23a098){_0x23a098=_0x23a098||0xc8;return function(_0x5a57fe){if(_0x5a57fe){return _0xbdc583[_0x85bf('0x18')](_0x23a098)[_0x85bf('0x1a')](_0x5a57fe);}};}function respondWithFilteredResult(_0x1b7cda,_0x1a808e){return function(_0x4156fa){if(_0x4156fa){var _0x38c6d2=typeof _0x1a808e[_0x85bf('0x1b')]===_0x85bf('0x1c')&&typeof _0x1a808e[_0x85bf('0x1d')]===_0x85bf('0x1c');var _0x53a2eb=_0x4156fa[_0x85bf('0x1e')];var _0x239554=_0x38c6d2?0x0:_0x1a808e['offset'];var _0x3ce9a1=_0x38c6d2?_0x4156fa[_0x85bf('0x1e')]:_0x1a808e['offset']+_0x1a808e['limit'];var _0x2a6ba3;if(_0x3ce9a1>=_0x53a2eb){_0x3ce9a1=_0x53a2eb;_0x2a6ba3=0xc8;}else{_0x2a6ba3=0xce;}_0x1b7cda['status'](_0x2a6ba3);return _0x1b7cda[_0x85bf('0x1f')](_0x85bf('0x20'),_0x239554+'-'+_0x3ce9a1+'/'+_0x53a2eb)[_0x85bf('0x1a')](_0x4156fa);}return null;};}function patchUpdates(_0x1bc94c){return function(_0x36c87b){try{jsonpatch[_0x85bf('0x21')](_0x36c87b,_0x1bc94c,!![]);}catch(_0x34442b){return BPromise[_0x85bf('0x22')](_0x34442b);}return _0x36c87b[_0x85bf('0x23')]();};}function saveUpdates(_0x125993,_0x56ea9c){return function(_0x101236){if(_0x101236){return _0x101236['update'](_0x125993)[_0x85bf('0x24')](function(_0x5b8543){return _0x5b8543;});}return null;};}function removeEntity(_0x5ae027,_0x13678f){return function(_0x13c8c2){if(_0x13c8c2){return _0x13c8c2[_0x85bf('0x25')]()[_0x85bf('0x24')](function(){_0x5ae027[_0x85bf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x189709,_0x15b9bc){return function(_0x4490de){if(!_0x4490de){_0x189709[_0x85bf('0x17')](0x194);}return _0x4490de;};}function handleError(_0x20b985,_0x3e8339){_0x3e8339=_0x3e8339||0x1f4;return function(_0x291674){logger[_0x85bf('0x26')](_0x291674['stack']);if(_0x291674[_0x85bf('0x27')]){delete _0x291674[_0x85bf('0x27')];}_0x20b985['status'](_0x3e8339)[_0x85bf('0x28')](_0x291674);};}var utilLicense=require(_0x85bf('0x16'));exports[_0x85bf('0x29')]=function(_0x4dcd15,_0x5b7e72){var _0x141946={'raw':!![],'where':{'id':0x1}},_0x44423d={};_0x44423d[_0x85bf('0x2a')]=_[_0x85bf('0x2b')](db[_0x85bf('0x2c')]['rawAttributes']);_0x44423d['query']=_[_0x85bf('0x2b')](_0x4dcd15[_0x85bf('0x2d')]);_0x44423d[_0x85bf('0x2e')]=_[_0x85bf('0x2f')](_0x44423d[_0x85bf('0x2a')],_0x44423d['query']);_0x141946[_0x85bf('0x30')]=_[_0x85bf('0x2f')](_0x44423d['model'],qs[_0x85bf('0x31')](_0x4dcd15[_0x85bf('0x2d')][_0x85bf('0x31')]));_0x141946[_0x85bf('0x30')]=_0x141946[_0x85bf('0x30')]['length']?_0x141946['attributes']:_0x44423d['model'];_0x141946=_[_0x85bf('0x32')]({},_0x141946,_0x4dcd15[_0x85bf('0x33')]);return utilLicense[_0x85bf('0x34')](_0x141946)[_0x85bf('0x24')](respondWithResult(_0x5b7e72,null))[_0x85bf('0x35')](handleError(_0x5b7e72,null));};exports[_0x85bf('0x36')]=function(_0x1ef699,_0x892fb){if(_0x1ef699[_0x85bf('0x37')]['id']){delete _0x1ef699[_0x85bf('0x37')]['id'];}return db[_0x85bf('0x2c')][_0x85bf('0x38')]({'where':{'id':_0x1ef699['params']['id']}})[_0x85bf('0x24')](handleEntityNotFound(_0x892fb,null))['then'](function(_0x53fde7){var _0x421162=_0x53fde7[_0x85bf('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x421162,_0x1ef699[_0x85bf('0x37')]['key']);})[_0x85bf('0x24')](function(_0x1c70c3){if(!_0x1c70c3[_0x85bf('0x3a')]){return saveUpdates(_0x1ef699[_0x85bf('0x37')],null);}return _0x1c70c3;})[_0x85bf('0x24')](respondWithResult(_0x892fb,null))[_0x85bf('0x35')](handleError(_0x892fb,null));};exports[_0x85bf('0x3b')]=function(_0x6fe35d,_0x46ce07){var _0x21e688=_0x85bf('0x3c');var _0x486b27=path['join'](_0x85bf('0x3d'),_0x85bf('0x3e'),'xcally',_0x21e688);_0x46ce07['setHeader'](_0x85bf('0x3f'),_0x85bf('0x40')+_0x21e688);_0x46ce07[_0x85bf('0x1f')](_0x85bf('0x41'),_0x85bf('0x42'));_0x46ce07[_0x85bf('0x43')](_0x486b27);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 8b4e695..1c5f9e8 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 _0x7bdb=['bluebird','request-promise','../../config/environment','exports','define','License','license','api'];(function(_0x371c6d,_0xb66639){var _0x40e38f=function(_0x2ba5ff){while(--_0x2ba5ff){_0x371c6d['push'](_0x371c6d['shift']());}};_0x40e38f(++_0xb66639);}(_0x7bdb,0x11f));var _0xb7bd=function(_0x562ec2,_0x33932b){_0x562ec2=_0x562ec2-0x0;var _0xd3a205=_0x7bdb[_0x562ec2];return _0xd3a205;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb7bd('0x0'));var moment=require('moment');var BPromise=require(_0xb7bd('0x1'));var rp=require(_0xb7bd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7bd('0x3'));var attributes=require('./license.attributes');module[_0xb7bd('0x4')]=function(_0x44766e,_0x3b8ec6){return _0x44766e[_0xb7bd('0x5')](_0xb7bd('0x6'),attributes,{'tableName':_0xb7bd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9375=['api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License','license','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9375,0x169));var _0x5937=function(_0x45c425,_0x4d962b){_0x45c425=_0x45c425-0x0;var _0x346f9c=_0x9375[_0x45c425];return _0x346f9c;};'use strict';var _=require(_0x5937('0x0'));var util=require(_0x5937('0x1'));var logger=require(_0x5937('0x2'))(_0x5937('0x3'));var moment=require('moment');var BPromise=require(_0x5937('0x4'));var rp=require(_0x5937('0x5'));var fs=require('fs');var path=require(_0x5937('0x6'));var rimraf=require(_0x5937('0x7'));var config=require(_0x5937('0x8'));var attributes=require(_0x5937('0x9'));module['exports']=function(_0x345859,_0x384f50){return _0x345859[_0x5937('0xa')](_0x5937('0xb'),attributes,{'tableName':_0x5937('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 04889ba..23be97a 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 _0x81bd=['License,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e66a5,_0x24eed5){var _0x461b23=function(_0x18095f){while(--_0x18095f){_0x2e66a5['push'](_0x2e66a5['shift']());}};_0x461b23(++_0x24eed5);}(_0x81bd,0x1bd));var _0xd81b=function(_0x64a51,_0x1c61b7){_0x64a51=_0x64a51-0x0;var _0x1eba45=_0x81bd[_0x64a51];return _0x1eba45;};'use strict';var _=require('lodash');var util=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var BPromise=require(_0xd81b('0x2'));var rs=require(_0xd81b('0x3'));var fs=require('fs');var Redis=require(_0xd81b('0x4'));var db=require(_0xd81b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x6'))(_0xd81b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd81b('0x8'));var client=jayson[_0xd81b('0x9')][_0xd81b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a50b6,_0x4f8b79,_0x64a536){return new BPromise(function(_0x2c7283,_0x51f4f5){return client[_0xd81b('0xb')](_0x2a50b6,_0x64a536)[_0xd81b('0xc')](function(_0x501589){logger['info']('License,\x20%s,\x20%s',_0x4f8b79,_0xd81b('0xd'));logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x4f8b79,_0xd81b('0xd'),JSON['stringify'](_0x501589));if(_0x501589['error']){if(_0x501589[_0xd81b('0x10')]['code']===0x1f4){logger[_0xd81b('0x10')](_0xd81b('0x11'),_0x4f8b79,_0x501589['error']['message']);return _0x51f4f5(_0x501589[_0xd81b('0x10')][_0xd81b('0x12')]);}logger[_0xd81b('0x10')](_0xd81b('0x11'),_0x4f8b79,_0x501589[_0xd81b('0x10')][_0xd81b('0x12')]);return _0x2c7283(_0x501589[_0xd81b('0x10')]['message']);}else{logger['info'](_0xd81b('0x11'),_0x4f8b79,_0xd81b('0xd'));_0x2c7283(_0x501589[_0xd81b('0x13')]['message']);}})[_0xd81b('0x14')](function(_0x4df1a0){logger['error']('License,\x20%s,\x20%s',_0x4f8b79,_0x4df1a0);_0x51f4f5(_0x4df1a0);});});} \ No newline at end of file +var _0xdfdd=['License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','../../config/utils','rpc','http','then','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdfdd,0x12b));var _0xddfd=function(_0x2708d5,_0x274c8d){_0x2708d5=_0x2708d5-0x0;var _0x1ae6f5=_0xdfdd[_0x2708d5];return _0x1ae6f5;};'use strict';var _=require('lodash');var util=require(_0xddfd('0x0'));var moment=require('moment');var BPromise=require(_0xddfd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xddfd('0x2'));var logger=require('../../config/logger')(_0xddfd('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddfd('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x5b3707,_0x2f3c02,_0x15faf4){return new BPromise(function(_0x1b592a,_0x3958fc){return client['request'](_0x5b3707,_0x15faf4)[_0xddfd('0x5')](function(_0x9c676c){logger[_0xddfd('0x6')](_0xddfd('0x7'),_0x2f3c02,_0xddfd('0x8'));logger[_0xddfd('0x9')](_0xddfd('0xa'),_0x2f3c02,_0xddfd('0x8'),JSON[_0xddfd('0xb')](_0x9c676c));if(_0x9c676c[_0xddfd('0xc')]){if(_0x9c676c[_0xddfd('0xc')][_0xddfd('0xd')]===0x1f4){logger[_0xddfd('0xc')](_0xddfd('0x7'),_0x2f3c02,_0x9c676c[_0xddfd('0xc')][_0xddfd('0xe')]);return _0x3958fc(_0x9c676c['error'][_0xddfd('0xe')]);}logger[_0xddfd('0xc')](_0xddfd('0x7'),_0x2f3c02,_0x9c676c['error'][_0xddfd('0xe')]);return _0x1b592a(_0x9c676c[_0xddfd('0xc')][_0xddfd('0xe')]);}else{logger[_0xddfd('0x6')]('License,\x20%s,\x20%s',_0x2f3c02,_0xddfd('0x8'));_0x1b592a(_0x9c676c[_0xddfd('0xf')]['message']);}})[_0xddfd('0x10')](function(_0x2128b1){logger[_0xddfd('0xc')](_0xddfd('0x7'),_0x2f3c02,_0x2128b1);_0x3958fc(_0x2128b1);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a09c4ec..d74a004 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 _0x1a4e=['getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x1a4e,0x1ac));var _0xe1a4=function(_0xb36ccf,_0x24c93b){_0xb36ccf=_0xb36ccf-0x0;var _0x37b01e=_0x1a4e[_0xb36ccf];return _0x37b01e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe1a4('0x0'));var timeout=require(_0xe1a4('0x1'));var express=require('express');var router=express[_0xe1a4('0x2')]();var fs_extra=require(_0xe1a4('0x3'));var auth=require(_0xe1a4('0x4'));var interaction=require(_0xe1a4('0x5'));var config=require(_0xe1a4('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x8')]);router[_0xe1a4('0x9')]('/describe',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xa')]);router['get'](_0xe1a4('0xb'),auth[_0xe1a4('0x7')](),controller['show']);router[_0xe1a4('0x9')](_0xe1a4('0xc'),auth[_0xe1a4('0x7')](),controller['getDispositions']);router[_0xe1a4('0x9')](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0xe')]);router['get'](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller['getImap']);router[_0xe1a4('0x9')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x11')]);router['get'](_0xe1a4('0x12'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x13')]);router[_0xe1a4('0x9')]('/:id/applications',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x14')]);router[_0xe1a4('0x9')](_0xe1a4('0x15'),auth['isAuthenticated'](),controller[_0xe1a4('0x16')]);router['get'](_0xe1a4('0x17'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x18')]);router[_0xe1a4('0x9')](_0xe1a4('0x19'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1a')]);router[_0xe1a4('0x1b')]('/:id/dispositions',auth[_0xe1a4('0x7')](),controller['addDisposition']);router['post'](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1c')]);router[_0xe1a4('0x1b')]('/',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1d')]);router['post'](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1e')]);router[_0xe1a4('0x1b')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x1f')]);router['post']('/:id/interactions',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x20')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe1a4('0x21')]);router[_0xe1a4('0x1b')]('/:id/send',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x22')]);router['post'](_0xe1a4('0x19'),auth['isAuthenticated'](),controller[_0xe1a4('0x23')]);router[_0xe1a4('0x24')](_0xe1a4('0xb'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x25')]);router[_0xe1a4('0x26')](_0xe1a4('0xc'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x27')]);router['delete'](_0xe1a4('0xd'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x28')]);router[_0xe1a4('0x26')](_0xe1a4('0xf'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x29')]);router[_0xe1a4('0x26')](_0xe1a4('0x10'),auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x2a')]);router[_0xe1a4('0x26')]('/:id',auth[_0xe1a4('0x7')](),controller[_0xe1a4('0x2b')]);router[_0xe1a4('0x26')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xe1a4('0x2c')]=router; \ No newline at end of file +var _0xda16=['addSmtp','addInteraction','/:id/send','addAgents','put','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeSmtp','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/in_servers'];(function(_0x24b7f4,_0x41e3da){var _0x2528ee=function(_0xd98859){while(--_0xd98859){_0x24b7f4['push'](_0x24b7f4['shift']());}};_0x2528ee(++_0x41e3da);}(_0xda16,0x1ce));var _0x6da1=function(_0x1a49fc,_0x527071){_0x1a49fc=_0x1a49fc-0x0;var _0x5589fc=_0xda16[_0x1a49fc];return _0x5589fc;};'use strict';var multer=require(_0x6da1('0x0'));var util=require('util');var path=require(_0x6da1('0x1'));var timeout=require(_0x6da1('0x2'));var express=require(_0x6da1('0x3'));var router=express[_0x6da1('0x4')]();var fs_extra=require(_0x6da1('0x5'));var auth=require(_0x6da1('0x6'));var interaction=require(_0x6da1('0x7'));var config=require(_0x6da1('0x8'));var controller=require(_0x6da1('0x9'));router[_0x6da1('0xa')]('/',auth[_0x6da1('0xb')](),controller[_0x6da1('0xc')]);router[_0x6da1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6da1('0xa')](_0x6da1('0xd'),auth['isAuthenticated'](),controller[_0x6da1('0xe')]);router[_0x6da1('0xa')](_0x6da1('0xf'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x6da1('0x11')]);router['get']('/:id/in_servers',auth[_0x6da1('0xb')](),controller[_0x6da1('0x12')]);router[_0x6da1('0xa')](_0x6da1('0x13'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x14')]);router[_0x6da1('0xa')](_0x6da1('0x15'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x16')]);router[_0x6da1('0xa')](_0x6da1('0x17'),auth[_0x6da1('0xb')](),controller['getApplications']);router[_0x6da1('0xa')](_0x6da1('0x18'),auth[_0x6da1('0xb')](),controller['getMessages']);router[_0x6da1('0xa')](_0x6da1('0x19'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x1a')]);router[_0x6da1('0xa')](_0x6da1('0x1b'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x1c')]);router[_0x6da1('0x1d')](_0x6da1('0xf'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x1e')]);router['post']('/:id/canned_answers',auth[_0x6da1('0xb')](),controller[_0x6da1('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6da1('0x20'),auth[_0x6da1('0xb')](),controller['addImap']);router[_0x6da1('0x1d')](_0x6da1('0x13'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x21')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x6da1('0x22')]);router[_0x6da1('0x1d')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x6da1('0x1d')](_0x6da1('0x23'),auth[_0x6da1('0xb')](),controller['send']);router[_0x6da1('0x1d')](_0x6da1('0x1b'),auth['isAuthenticated'](),controller[_0x6da1('0x24')]);router[_0x6da1('0x25')](_0x6da1('0xd'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x26')]);router[_0x6da1('0x27')](_0x6da1('0xf'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x28')]);router[_0x6da1('0x27')](_0x6da1('0x29'),auth[_0x6da1('0xb')](),controller[_0x6da1('0x2a')]);router[_0x6da1('0x27')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0x6da1('0x27')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x6da1('0x2b')]);router['delete'](_0x6da1('0xd'),auth[_0x6da1('0xb')](),controller['destroy']);router[_0x6da1('0x27')](_0x6da1('0x1b'),auth[_0x6da1('0xb')](),controller['removeAgents']);module[_0x6da1('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 a441831..fa8cd1c 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 _0x8e8e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x22c174,_0x241161){var _0x4ae0ec=function(_0x3beeeb){while(--_0x3beeeb){_0x22c174['push'](_0x22c174['shift']());}};_0x4ae0ec(++_0x241161);}(_0x8e8e,0xdd));var _0xe8e8=function(_0x239f30,_0x4dbad1){_0x239f30=_0x239f30-0x0;var _0x575926=_0x8e8e[_0x239f30];return _0x575926;};'use strict';var Sequelize=require('sequelize');module[_0xe8e8('0x0')]={'description':{'type':Sequelize[_0xe8e8('0x1')]},'name':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe8e8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xe8e8('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe8e8('0x1')],'allowNull':![],'defaultValue':_0xe8e8('0x4')},'fontSize':{'type':Sequelize[_0xe8e8('0x5')](0x2)[_0xe8e8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe8e8('0x7');}},'notificationSound':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe8e8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe8e8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8e8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe8e8('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe8e8('0x9'),'set':function(_0x5283cf){if(!_0x5283cf)this[_0xe8e8('0xa')](_0xe8e8('0xb'),null);this[_0xe8e8('0xa')]('mandatoryDisposition',_0x5283cf);}},'provider':{'type':Sequelize[_0xe8e8('0xc')](_0xe8e8('0xd'),_0xe8e8('0xe'),_0xe8e8('0xf'),_0xe8e8('0x10')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xe8e8('0x11')))return _0xe8e8('0x12');return this['getDataValue'](_0xe8e8('0x11'));},'set':function(_0x5bae3c){if(_0x5bae3c===_0xe8e8('0x12'))_0x5bae3c=null;return this[_0xe8e8('0xa')]('provider',_0x5bae3c);}}}; \ No newline at end of file +var _0x0cc4=['yahoo','outlook365','getDataValue','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x0cc4,0x121));var _0x40cc=function(_0x18e124,_0x5ca114){_0x18e124=_0x18e124-0x0;var _0x2f335a=_0x0cc4[_0x18e124];return _0x2f335a;};'use strict';var Sequelize=require(_0x40cc('0x0'));module[_0x40cc('0x1')]={'description':{'type':Sequelize[_0x40cc('0x2')]},'name':{'type':Sequelize[_0x40cc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x40cc('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x40cc('0x2')],'allowNull':![],'defaultValue':_0x40cc('0x4')},'fontSize':{'type':Sequelize[_0x40cc('0x5')](0x2)[_0x40cc('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x40cc('0x7')],'defaultValue':function(){return _0x40cc('0x8');}},'notificationSound':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x40cc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40cc('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40cc('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x40cc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x40cc('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x11e93b){if(!_0x11e93b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x40cc('0xa')](_0x40cc('0xb'),_0x11e93b);}},'provider':{'type':Sequelize[_0x40cc('0xc')](_0x40cc('0xd'),_0x40cc('0xe'),_0x40cc('0xf'),_0x40cc('0x10')),'defaultValue':null,'get':function(){if(!this[_0x40cc('0x11')](_0x40cc('0x12')))return'custom';return this[_0x40cc('0x11')](_0x40cc('0x12'));},'set':function(_0x3d495f){if(_0x3d495f==='custom')_0x3d495f=null;return this['setDataValue'](_0x40cc('0x12'),_0x3d495f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0005440..efbaf73 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 _0xe212=['YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','get','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','show','params','include','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','create','findOne','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','email','ListId','active','role','UserProfileSection','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','isNil','from','attachments','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','subject','attach','out'];(function(_0x581abe,_0x56ed62){var _0x56a811=function(_0x3d5c97){while(--_0x3d5c97){_0x581abe['push'](_0x581abe['shift']());}};_0x56a811(++_0x56ed62);}(_0xe212,0x18a));var _0x2e21=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xe212[_0x12fc8d];return _0x3f9d04;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2e21('0x0'));var path=require(_0x2e21('0x1'));var _=require(_0x2e21('0x2'));var juice=require(_0x2e21('0x3'));var Redis=require(_0x2e21('0x4'));var qs=require(_0x2e21('0x5'));var logger=require('../../config/logger')(_0x2e21('0x6'));var config=require(_0x2e21('0x7'));var db=require('../../mysqldb')['db'];config[_0x2e21('0x8')]=_[_0x2e21('0x9')](config[_0x2e21('0x8')],{'host':_0x2e21('0xa'),'port':0x18eb});var socket=require(_0x2e21('0xb'))(new Redis(config[_0x2e21('0x8')]));require(_0x2e21('0xc'))[_0x2e21('0xd')](socket);var jayson=require(_0x2e21('0xe'));var client=jayson[_0x2e21('0xf')][_0x2e21('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5a8c2b,_0x256f84,_0x4f1444,_0x33c11d){return new BPromise(function(_0x11e0d0,_0x27630e){var _0x1303c3=_0x33c11d||client;return _0x1303c3[_0x2e21('0x11')](_0x5a8c2b,_0x4f1444)['then'](function(_0x15687e){logger[_0x2e21('0x12')](_0x2e21('0x13'),_0x256f84,_0x2e21('0x14'));logger['debug'](_0x2e21('0x15'),_0x256f84,_0x2e21('0x14'),JSON[_0x2e21('0x16')](_0x15687e));if(_0x15687e[_0x2e21('0x17')]){if(_0x15687e[_0x2e21('0x17')][_0x2e21('0x18')]===0x1f4){logger[_0x2e21('0x17')]('MailAccount,\x20%s,\x20%s',_0x256f84,_0x15687e[_0x2e21('0x17')][_0x2e21('0x19')]);return _0x27630e(_0x15687e['error'][_0x2e21('0x19')]);}logger[_0x2e21('0x17')](_0x2e21('0x13'),_0x256f84,_0x15687e['error'][_0x2e21('0x19')]);return _0x11e0d0(_0x15687e['error'][_0x2e21('0x19')]);}else{logger[_0x2e21('0x12')](_0x2e21('0x13'),_0x256f84,'request\x20sent');_0x11e0d0(_0x15687e['result']['message']);}})[_0x2e21('0x1a')](function(_0x5bff6c){logger[_0x2e21('0x17')](_0x2e21('0x13'),_0x256f84,_0x5bff6c);_0x27630e(_0x5bff6c);});});}function respondWithStatusCode(_0x5da0e8,_0x220a1c){_0x220a1c=_0x220a1c||0xcc;return function(_0x2c4054){if(_0x2c4054){return _0x5da0e8[_0x2e21('0x1b')](_0x220a1c);}return _0x5da0e8[_0x2e21('0x1c')](_0x220a1c)[_0x2e21('0x1d')]();};}function respondWithResult(_0x3703ff,_0x4f522a){_0x4f522a=_0x4f522a||0xc8;return function(_0x3fbaff){if(_0x3fbaff){return _0x3703ff[_0x2e21('0x1c')](_0x4f522a)[_0x2e21('0x1e')](_0x3fbaff);}};}function respondWithFilteredResult(_0x38da79,_0x10b73b){return function(_0x2eb253){if(_0x2eb253){var _0x511c3a=typeof _0x10b73b[_0x2e21('0x1f')]==='undefined'&&typeof _0x10b73b['limit']===_0x2e21('0x20');var _0x3593d5=_0x2eb253[_0x2e21('0x21')];var _0x35ad6c=_0x511c3a?0x0:_0x10b73b[_0x2e21('0x1f')];var _0x8f757=_0x511c3a?_0x2eb253['count']:_0x10b73b[_0x2e21('0x1f')]+_0x10b73b[_0x2e21('0x22')];var _0x154067;if(_0x8f757>=_0x3593d5){_0x8f757=_0x3593d5;_0x154067=0xc8;}else{_0x154067=0xce;}_0x38da79[_0x2e21('0x1c')](_0x154067);return _0x38da79[_0x2e21('0x23')](_0x2e21('0x24'),_0x35ad6c+'-'+_0x8f757+'/'+_0x3593d5)[_0x2e21('0x1e')](_0x2eb253);}return null;};}function saveUpdates(_0x354353){return function(_0x5a7d29){if(_0x5a7d29){return _0x5a7d29[_0x2e21('0x25')](_0x354353)['then'](function(_0x2dd6de){return _0x2dd6de;});}return null;};}function removeEntity(_0x48f2de){return function(_0x30efa3){if(_0x30efa3){return _0x30efa3[_0x2e21('0x26')]()[_0x2e21('0x27')](function(){var _0x113f83=_0x30efa3[_0x2e21('0x28')]({'plain':!![]});var _0xe0a1a2='MailAccounts';return db[_0x2e21('0x29')][_0x2e21('0x26')]({'where':{'type':_0xe0a1a2,'resourceId':_0x113f83['id']}})[_0x2e21('0x27')](function(){return _0x30efa3;});})[_0x2e21('0x27')](function(){_0x48f2de['status'](0xcc)[_0x2e21('0x1d')]();});}};}function handleEntityNotFound(_0x5026aa){return function(_0x134f22){if(!_0x134f22){_0x5026aa[_0x2e21('0x1b')](0x194);}return _0x134f22;};}function handleError(_0x57cb39,_0x2b4230){_0x2b4230=_0x2b4230||0x1f4;return function(_0x45b8f2){logger[_0x2e21('0x17')](_0x45b8f2[_0x2e21('0x2a')]);if(_0x45b8f2[_0x2e21('0x2b')]){delete _0x45b8f2[_0x2e21('0x2b')];}_0x57cb39[_0x2e21('0x1c')](_0x2b4230)[_0x2e21('0x2c')](_0x45b8f2);};}function getImapHost(_0x183170){switch(_0x183170){case'gmail':return _0x2e21('0x2d');case _0x2e21('0x2e'):return _0x2e21('0x2f');case _0x2e21('0x30'):return _0x2e21('0x31');case _0x2e21('0x32'):return _0x2e21('0x33');}throw new Error(_0x2e21('0x34'),_0x183170);}function getSmtpHost(_0x52ee32){switch(_0x52ee32){case'gmail':return'smtp.gmail.com';case'yahoo':return'smtp.mail.yahoo.com';case _0x2e21('0x30'):return _0x2e21('0x35');case _0x2e21('0x32'):return _0x2e21('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x52ee32);}function getAuthenticationOptions(_0x3f6716,_0x4c562a){var _0x2d2203={};var _0x26ef71={};if(_0x3f6716){_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=_0x4c562a[_0x2e21('0x38')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=_0x4c562a[_0x2e21('0x39')];if(_0x4c562a['modernAuthentication']){_0x2d2203['modernAuthentication']=_0x26ef71[_0x2e21('0x3b')]=!![];_0x2d2203['CloudProviderId']=_0x26ef71[_0x2e21('0x3c')]=_0x4c562a[_0x2e21('0x3c')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=null;}else{_0x2d2203[_0x2e21('0x3c')]=_0x26ef71[_0x2e21('0x3c')]=null;}_0x2d2203[_0x2e21('0x3d')]=getImapHost(_0x3f6716);_0x2d2203[_0x2e21('0x3e')]=0x3e1;_0x26ef71[_0x2e21('0x3d')]=getSmtpHost(_0x3f6716);_0x26ef71[_0x2e21('0x3e')]=0x24b;_0x26ef71[_0x2e21('0x3f')]=![];_0x2d2203[_0x2e21('0x40')]=_0x26ef71[_0x2e21('0x40')]=null;}else{if(_0x4c562a['authentication']){_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=_0x4c562a[_0x2e21('0x38')];_0x2d2203[_0x2e21('0x39')]=_0x26ef71[_0x2e21('0x3a')]=_0x4c562a[_0x2e21('0x39')];}else{_0x2d2203[_0x2e21('0x41')]=_0x26ef71[_0x2e21('0x41')]=![];_0x2d2203[_0x2e21('0x37')]=_0x26ef71[_0x2e21('0x37')]=null;_0x2d2203['password']=_0x26ef71[_0x2e21('0x3a')]=null;}_0x2d2203['host']=_0x4c562a['Imap'][_0x2e21('0x3d')];_0x2d2203['port']=_0x4c562a[_0x2e21('0x42')][_0x2e21('0x3e')];_0x26ef71['host']=_0x4c562a[_0x2e21('0x43')][_0x2e21('0x3d')];_0x26ef71[_0x2e21('0x3e')]=_0x4c562a[_0x2e21('0x43')][_0x2e21('0x3e')];}return{'Imap':_0x2d2203,'Smtp':_0x26ef71};}exports[_0x2e21('0x44')]=function(_0x14edc4,_0x5af0b9){var _0x152170={'include':[{'model':db[_0x2e21('0x45')],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]},_0x3e5cc6={},_0x314410={'count':0x0,'rows':[]};var _0x287af4=_[_0x2e21('0x49')](db[_0x2e21('0x4a')][_0x2e21('0x4b')],function(_0x118fd8){return{'name':_0x118fd8[_0x2e21('0x4c')],'type':_0x118fd8[_0x2e21('0x4d')][_0x2e21('0x4e')]};});_0x3e5cc6[_0x2e21('0x4f')]=_[_0x2e21('0x49')](_0x287af4,_0x2e21('0x2b'));_0x3e5cc6[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x14edc4[_0x2e21('0x50')]);_0x3e5cc6[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x3e5cc6[_0x2e21('0x4f')],_0x3e5cc6[_0x2e21('0x50')]);_0x152170[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x3e5cc6[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x14edc4[_0x2e21('0x50')][_0x2e21('0x55')]));_0x152170[_0x2e21('0x54')]=_0x152170[_0x2e21('0x54')][_0x2e21('0x56')]?_0x152170[_0x2e21('0x54')]:_0x3e5cc6[_0x2e21('0x4f')];if(!_0x14edc4['query'][_0x2e21('0x57')](_0x2e21('0x58'))){_0x152170['limit']=qs[_0x2e21('0x22')](_0x14edc4[_0x2e21('0x50')][_0x2e21('0x22')]);_0x152170['offset']=qs[_0x2e21('0x1f')](_0x14edc4['query'][_0x2e21('0x1f')]);}_0x152170[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x14edc4['query'][_0x2e21('0x5a')]);_0x152170[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x14edc4[_0x2e21('0x50')],_0x3e5cc6[_0x2e21('0x52')]),_0x287af4);if(_0x14edc4['query']['filter']){_0x152170[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x152170[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0x287af4,function(_0x4b9b55){if(_0x4b9b55[_0x2e21('0x4d')]!==_0x2e21('0x5e')){var _0x125dda={};_0x125dda[_0x4b9b55[_0x2e21('0x2b')]]={'$like':'%'+_0x14edc4[_0x2e21('0x50')][_0x2e21('0x5f')]+'%'};return _0x125dda;}})});}_0x152170=_[_0x2e21('0x5d')]({},_0x152170,_0x14edc4[_0x2e21('0x60')]);var _0x47a55d={'where':_0x152170['where']};return db[_0x2e21('0x4a')][_0x2e21('0x21')](_0x47a55d)[_0x2e21('0x27')](function(_0x5d8b48){_0x314410['count']=_0x5d8b48;if(_0x14edc4[_0x2e21('0x50')]['includeAll']){_0x152170['include']=[{'all':!![]}];}return db[_0x2e21('0x4a')][_0x2e21('0x61')](_0x152170);})['then'](function(_0x31f218){_0x314410['rows']=_0x31f218;return _0x314410;})[_0x2e21('0x27')](respondWithFilteredResult(_0x5af0b9,_0x152170))['catch'](handleError(_0x5af0b9,null));};exports[_0x2e21('0x62')]=function(_0x2ef200,_0x1abdbd){var _0x160f7d={'raw':![],'where':{'id':_0x2ef200[_0x2e21('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]},_0x3cec57={};_0x3cec57['model']=_['keys'](db[_0x2e21('0x4a')][_0x2e21('0x4b')]);_0x3cec57[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x2ef200[_0x2e21('0x50')]);_0x3cec57[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x3cec57['model'],_0x3cec57['query']);_0x160f7d[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x3cec57[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x2ef200[_0x2e21('0x50')][_0x2e21('0x55')]));_0x160f7d[_0x2e21('0x54')]=_0x160f7d[_0x2e21('0x54')][_0x2e21('0x56')]?_0x160f7d[_0x2e21('0x54')]:_0x3cec57['model'];if(_0x2ef200[_0x2e21('0x50')]['includeAll']){_0x160f7d[_0x2e21('0x64')]=[{'all':!![]}];}_0x160f7d=_['merge']({},_0x160f7d,_0x2ef200[_0x2e21('0x60')]);return db[_0x2e21('0x4a')][_0x2e21('0x65')](_0x160f7d)[_0x2e21('0x27')](handleEntityNotFound(_0x1abdbd,null))[_0x2e21('0x27')](respondWithResult(_0x1abdbd,null))[_0x2e21('0x1a')](handleError(_0x1abdbd,null));};exports[_0x2e21('0x25')]=function(_0x4bd24b,_0x422f61){if(_0x4bd24b[_0x2e21('0x66')]['id']){delete _0x4bd24b[_0x2e21('0x66')]['id'];}var _0x58ece9=_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x67')]===_0x2e21('0x68')?null:_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x67')];var _0x1a7571=_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')]||{};var _0x2b83d7=_0x4bd24b['body'][_0x2e21('0x43')]||{};if(_0x58ece9){_0x1a7571['host']=getImapHost(_0x58ece9);_0x1a7571['port']=0x3e1;_0x2b83d7[_0x2e21('0x3d')]=getSmtpHost(_0x58ece9);_0x2b83d7[_0x2e21('0x3e')]=0x24b;_0x2b83d7[_0x2e21('0x3f')]=![];}if(_0x2b83d7[_0x2e21('0x3b')]){_0x2b83d7[_0x2e21('0x3f')]=![];}else{_0x2b83d7[_0x2e21('0x3c')]=null;}if(!_0x1a7571[_0x2e21('0x3b')])_0x1a7571[_0x2e21('0x3c')]=null;_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')]=_0x1a7571;_0x4bd24b[_0x2e21('0x66')]['Smtp']=_0x2b83d7;return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0x4bd24b[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x45')],'as':_0x2e21('0x42')},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db[_0x2e21('0x47')],'as':_0x2e21('0x48')}]})[_0x2e21('0x27')](handleEntityNotFound(_0x422f61,null))['then'](function(_0x3e6240){if(!_0x3e6240)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3e6240[_0x2e21('0x40')])delete _0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')];return _0x3e6240;})[_0x2e21('0x27')](saveUpdates(_0x4bd24b['body'],null))[_0x2e21('0x27')](function(_0xcb8a00){if(!_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')])return _0xcb8a00;return db[_0x2e21('0x45')][_0x2e21('0x25')](_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x42')],{'where':{'MailAccountId':_0xcb8a00['id']}})[_0x2e21('0x27')](function(){return _0xcb8a00;});})[_0x2e21('0x27')](function(_0x2006f3){if(!_0x4bd24b[_0x2e21('0x66')]['Smtp'])return _0x2006f3;return db['MailServerOut'][_0x2e21('0x25')](_0x4bd24b[_0x2e21('0x66')][_0x2e21('0x43')],{'where':{'MailAccountId':_0x2006f3['id']}})[_0x2e21('0x27')](function(){return _0x2006f3;});})[_0x2e21('0x27')](respondWithResult(_0x422f61,null))['catch'](handleError(_0x422f61,null));};exports[_0x2e21('0x69')]=function(_0x9197d4,_0x56b751){return db[_0x2e21('0x4a')][_0x2e21('0x69')]()[_0x2e21('0x27')](respondWithResult(_0x56b751,null))[_0x2e21('0x1a')](handleError(_0x56b751,null));};exports[_0x2e21('0x6a')]=function(_0x213172,_0x181407){if(_0x213172[_0x2e21('0x66')]['id']){delete _0x213172[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x213172[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x181407,null))[_0x2e21('0x27')](function(_0x54159d){if(_0x54159d){_0x213172[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x54159d['id'];return db[_0x2e21('0x6c')][_0x2e21('0x6d')](_0x213172[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x181407,null))['catch'](handleError(_0x181407,null));};exports['getDispositions']=function(_0x20f733,_0xdcc863){var _0x2fd456={'raw':![],'where':{}};var _0x1668c0={};var _0x2d26c7={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x20f733['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xdcc863,null))[_0x2e21('0x27')](function(_0x394843){if(_0x394843){_0x1668c0[_0x2e21('0x4f')]=_['keys'](db[_0x2e21('0x6c')][_0x2e21('0x4b')]);_0x1668c0[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x20f733[_0x2e21('0x50')]);_0x1668c0[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x1668c0[_0x2e21('0x4f')],_0x1668c0['query']);_0x2fd456[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x1668c0[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x55')]));_0x2fd456[_0x2e21('0x54')]=_0x2fd456['attributes'][_0x2e21('0x56')]?_0x2fd456[_0x2e21('0x54')]:_0x1668c0['model'];if(!_0x20f733[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x2fd456[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x22')]);_0x2fd456[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x20f733['query']['offset']);}_0x2fd456[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x20f733[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x2fd456['where']=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x20f733['query'],_0x1668c0[_0x2e21('0x52')]));_0x2fd456[_0x2e21('0x5b')][_0x2e21('0x6b')]=_0x394843['id'];if(_0x20f733[_0x2e21('0x50')][_0x2e21('0x5f')]){_0x2fd456[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x2fd456['where'],{'$or':_['map'](_0x2fd456[_0x2e21('0x54')],function(_0xb68f55){var _0x26567f={};_0x26567f[_0xb68f55]={'$like':'%'+_0x20f733[_0x2e21('0x50')][_0x2e21('0x5f')]+'%'};return _0x26567f;})});}_0x2fd456=_[_0x2e21('0x5d')]({},_0x2fd456,_0x20f733[_0x2e21('0x60')]);return db[_0x2e21('0x6c')][_0x2e21('0x21')]({'where':_0x2fd456['where']})[_0x2e21('0x27')](function(_0x27d4e2){_0x2d26c7[_0x2e21('0x21')]=_0x27d4e2;if(_0x20f733[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x2fd456['include']=[{'all':!![]}];}return db[_0x2e21('0x6c')]['findAll'](_0x2fd456);})[_0x2e21('0x27')](function(_0x12012a){_0x2d26c7[_0x2e21('0x70')]=_0x12012a;return _0x2d26c7;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0xdcc863,_0x2fd456))['catch'](handleError(_0xdcc863,null));};exports[_0x2e21('0x71')]=function(_0x29c49a,_0x4c4731){return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x29c49a[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x4c4731,null))[_0x2e21('0x27')](function(_0x1ff848){if(_0x1ff848){return _0x1ff848[_0x2e21('0x71')](_0x29c49a['query'][_0x2e21('0x72')]);}})[_0x2e21('0x27')](respondWithStatusCode(_0x4c4731,null))[_0x2e21('0x1a')](handleError(_0x4c4731,null));};exports[_0x2e21('0x73')]=function(_0xdc5ec,_0x513b4a){if(_0xdc5ec[_0x2e21('0x66')]['id']){delete _0xdc5ec[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0xdc5ec[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x513b4a,null))[_0x2e21('0x27')](function(_0x253348){if(_0x253348){_0xdc5ec[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x253348['id'];return db[_0x2e21('0x74')][_0x2e21('0x6d')](_0xdc5ec[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x513b4a,null))[_0x2e21('0x1a')](handleError(_0x513b4a,null));};exports[_0x2e21('0x75')]=function(_0x361f65,_0x44fc28){var _0x29b088={'raw':![],'where':{}};var _0x14c513={};var _0xb1db2c={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x361f65[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x44fc28,null))[_0x2e21('0x27')](function(_0x4b18d2){if(_0x4b18d2){_0x14c513[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x74')]['rawAttributes']);_0x14c513[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x361f65['query']);_0x14c513[_0x2e21('0x52')]=_['intersection'](_0x14c513[_0x2e21('0x4f')],_0x14c513[_0x2e21('0x50')]);_0x29b088['attributes']=_[_0x2e21('0x53')](_0x14c513[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x361f65[_0x2e21('0x50')][_0x2e21('0x55')]));_0x29b088['attributes']=_0x29b088['attributes']['length']?_0x29b088[_0x2e21('0x54')]:_0x14c513[_0x2e21('0x4f')];if(!_0x361f65[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x29b088[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x361f65[_0x2e21('0x50')][_0x2e21('0x22')]);_0x29b088[_0x2e21('0x1f')]=qs['offset'](_0x361f65[_0x2e21('0x50')][_0x2e21('0x1f')]);}_0x29b088[_0x2e21('0x59')]=qs['sort'](_0x361f65[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x29b088[_0x2e21('0x5b')]=qs['filters'](_['pick'](_0x361f65['query'],_0x14c513[_0x2e21('0x52')]));_0x29b088['where'][_0x2e21('0x6b')]=_0x4b18d2['id'];if(_0x361f65[_0x2e21('0x50')][_0x2e21('0x5f')]){_0x29b088[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x29b088[_0x2e21('0x5b')],{'$or':_['map'](_0x29b088[_0x2e21('0x54')],function(_0x31bfac){var _0x115f9a={};_0x115f9a[_0x31bfac]={'$like':'%'+_0x361f65['query'][_0x2e21('0x5f')]+'%'};return _0x115f9a;})});}_0x29b088=_['merge']({},_0x29b088,_0x361f65['options']);return db[_0x2e21('0x74')][_0x2e21('0x21')]({'where':_0x29b088[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x284e01){_0xb1db2c[_0x2e21('0x21')]=_0x284e01;if(_0x361f65[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x29b088[_0x2e21('0x64')]=[{'all':!![]}];}return db[_0x2e21('0x74')]['findAll'](_0x29b088);})['then'](function(_0x5f4a6d){_0xb1db2c[_0x2e21('0x70')]=_0x5f4a6d;return _0xb1db2c;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0x44fc28,_0x29b088))[_0x2e21('0x1a')](handleError(_0x44fc28,null));};exports['removeAnswers']=function(_0x3367f0,_0x3c4145){return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x3367f0[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x3c4145,null))[_0x2e21('0x27')](function(_0x1a6e68){if(_0x1a6e68){return _0x1a6e68['removeAnswers'](_0x3367f0[_0x2e21('0x50')][_0x2e21('0x72')]);}})['then'](respondWithStatusCode(_0x3c4145,null))[_0x2e21('0x1a')](handleError(_0x3c4145,null));};exports[_0x2e21('0x6d')]=function(_0x1b944c,_0x21177e){var _0x31a6a6={'name':_0x1b944c[_0x2e21('0x66')][_0x2e21('0x2b')],'key':_0x1b944c[_0x2e21('0x66')]['key'],'provider':_0x1b944c['body'][_0x2e21('0x67')]===_0x2e21('0x68')?null:_0x1b944c['body'][_0x2e21('0x67')],'email':_0x1b944c[_0x2e21('0x66')][_0x2e21('0x76')],'ListId':_0x1b944c['body'][_0x2e21('0x77')],'active':!_['isNil'](_0x1b944c[_0x2e21('0x66')][_0x2e21('0x78')])?_0x1b944c[_0x2e21('0x66')]['active']:!![],'description':_0x1b944c[_0x2e21('0x66')]['description']||null};var _0x44a458=getAuthenticationOptions(_0x31a6a6['provider'],_0x1b944c[_0x2e21('0x66')]);_0x31a6a6[_0x2e21('0x42')]=_0x44a458['Imap'];_0x31a6a6[_0x2e21('0x43')]=_0x44a458[_0x2e21('0x43')];return db[_0x2e21('0x4a')][_0x2e21('0x6d')](_0x31a6a6,{'include':[{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x2e21('0x27')](function(_0x37c7a9){var _0x33f061=_0x1b944c[_0x2e21('0x37')]['get']({'plain':!![]});if(!_0x33f061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33f061[_0x2e21('0x79')]===_0x2e21('0x37')){var _0x148424=_0x37c7a9[_0x2e21('0x28')]({'plain':!![]});return db[_0x2e21('0x7a')][_0x2e21('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0x33f061['userProfileId']},'raw':!![]})['then'](function(_0x1aa8a3){if(_0x1aa8a3&&_0x1aa8a3['autoAssociation']===0x0){return db[_0x2e21('0x29')][_0x2e21('0x6d')]({'name':_0x148424[_0x2e21('0x2b')],'resourceId':_0x148424['id'],'type':_0x1aa8a3[_0x2e21('0x2b')],'sectionId':_0x1aa8a3['id']},{})[_0x2e21('0x27')](function(){return _0x37c7a9;});}else{return _0x37c7a9;}})[_0x2e21('0x1a')](function(_0x372b21){logger[_0x2e21('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x372b21);throw _0x372b21;});}return _0x37c7a9;})[_0x2e21('0x27')](respondWithResult(_0x21177e,0xc9))[_0x2e21('0x1a')](handleError(_0x21177e,null));};exports[_0x2e21('0x7b')]=function(_0x852a37,_0xec28aa){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x852a37[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xec28aa,null))[_0x2e21('0x27')](function(_0x2e5ab0){if(_0x2e5ab0){return _0x2e5ab0[_0x2e21('0x7b')]();}return null;})[_0x2e21('0x27')](respondWithResult(_0xec28aa,null))[_0x2e21('0x1a')](handleError(_0xec28aa,null));};exports[_0x2e21('0x7c')]=function(_0x1c6bd3,_0x131b98){if(_0x1c6bd3[_0x2e21('0x66')]['id']){delete _0x1c6bd3[_0x2e21('0x66')]['id'];}return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x1c6bd3[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x131b98,null))['then'](function(_0x3c0e73){if(_0x3c0e73){_0x1c6bd3['body']['MailAccountId']=_0x3c0e73['id'];return db[_0x2e21('0x45')][_0x2e21('0x6d')](_0x1c6bd3[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0x131b98,null))[_0x2e21('0x1a')](handleError(_0x131b98,null));};exports[_0x2e21('0x7d')]=function(_0x1b90b2,_0xcb50ce){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x1b90b2[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xcb50ce,null))[_0x2e21('0x27')](function(_0x415d74){if(_0x415d74){return _0x415d74[_0x2e21('0x7e')](null);}return null;})[_0x2e21('0x27')](respondWithStatusCode(_0xcb50ce,null))[_0x2e21('0x1a')](handleError(_0xcb50ce,null));};exports['getSmtp']=function(_0x43ddcb,_0x213fbe){return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x43ddcb['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x213fbe,null))[_0x2e21('0x27')](function(_0x56a741){if(_0x56a741){return _0x56a741[_0x2e21('0x7f')]();}return null;})[_0x2e21('0x27')](respondWithResult(_0x213fbe,null))[_0x2e21('0x1a')](handleError(_0x213fbe,null));};exports[_0x2e21('0x80')]=function(_0x5a31c4,_0xf2070e){if(_0x5a31c4[_0x2e21('0x66')]['id']){delete _0x5a31c4['body']['id'];}return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0x5a31c4['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0xf2070e,null))[_0x2e21('0x27')](function(_0x4fb06e){if(_0x4fb06e){_0x5a31c4[_0x2e21('0x66')][_0x2e21('0x6b')]=_0x4fb06e['id'];return db[_0x2e21('0x46')]['create'](_0x5a31c4[_0x2e21('0x66')]);}})[_0x2e21('0x27')](respondWithResult(_0xf2070e,null))[_0x2e21('0x1a')](handleError(_0xf2070e,null));};exports[_0x2e21('0x81')]=function(_0x42fa27,_0x288c47){return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x42fa27[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x288c47,null))[_0x2e21('0x27')](function(_0x256160){if(_0x256160){return _0x256160['setSmtp'](null);}return null;})[_0x2e21('0x27')](respondWithStatusCode(_0x288c47,null))['catch'](handleError(_0x288c47,null));};exports['addInteraction']=function(_0x41bc20,_0x35016a){return db[_0x2e21('0x82')]['find']({'where':{'id':_0x41bc20[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x35016a,null))['then'](function(_0xe59f72){if(_0xe59f72){return _0xe59f72[_0x2e21('0x83')](_0x41bc20['body']['ids'],_['omit'](_0x41bc20[_0x2e21('0x66')],[_0x2e21('0x72'),'id'])||{});}})[_0x2e21('0x27')](respondWithResult(_0x35016a,null))['catch'](handleError(_0x35016a,null));};exports[_0x2e21('0x84')]=function(_0x244d97,_0x2b3fd2){var _0x5e2975={'raw':![],'where':{}};var _0x39c34d={};var _0x21e326={'count':0x0,'rows':[]};return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x244d97['params']['id']}})['then'](handleEntityNotFound(_0x2b3fd2,null))[_0x2e21('0x27')](function(_0x2a7af9){if(_0x2a7af9){_0x39c34d[_0x2e21('0x4f')]=_['keys'](db['MailInteraction'][_0x2e21('0x4b')]);_0x39c34d['query']=_['keys'](_0x244d97[_0x2e21('0x50')]);_0x39c34d[_0x2e21('0x52')]=_['intersection'](_0x39c34d[_0x2e21('0x4f')],_0x39c34d[_0x2e21('0x50')]);_0x5e2975[_0x2e21('0x54')]=_['intersection'](_0x39c34d[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x244d97[_0x2e21('0x50')][_0x2e21('0x55')]));_0x5e2975[_0x2e21('0x54')]=_0x5e2975['attributes'][_0x2e21('0x56')]?_0x5e2975['attributes']:_0x39c34d[_0x2e21('0x4f')];if(!_0x244d97['query'][_0x2e21('0x57')](_0x2e21('0x58'))){_0x5e2975['limit']=qs[_0x2e21('0x22')](_0x244d97[_0x2e21('0x50')][_0x2e21('0x22')]);_0x5e2975['offset']=qs[_0x2e21('0x1f')](_0x244d97['query']['offset']);}_0x5e2975[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x244d97['query'][_0x2e21('0x5a')]);_0x5e2975[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_['pick'](_0x244d97[_0x2e21('0x50')],_0x39c34d[_0x2e21('0x52')]));_0x5e2975[_0x2e21('0x5b')]['MailAccountId']=_0x2a7af9['id'];if(_0x244d97['query'][_0x2e21('0x5f')]){_0x5e2975[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x5e2975[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0x5e2975[_0x2e21('0x54')],function(_0x581cad){var _0x1f5df4={};_0x1f5df4[_0x581cad]={'$like':'%'+_0x244d97[_0x2e21('0x50')]['filter']+'%'};return _0x1f5df4;})});}_0x5e2975=_['merge']({},_0x5e2975,_0x244d97[_0x2e21('0x60')]);return db[_0x2e21('0x82')]['count']({'where':_0x5e2975[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x1b0ad8){_0x21e326[_0x2e21('0x21')]=_0x1b0ad8;if(_0x244d97[_0x2e21('0x50')][_0x2e21('0x6f')]){_0x5e2975[_0x2e21('0x64')]=[{'model':db[_0x2e21('0x85')],'as':_0x2e21('0x86'),'required':![]},{'model':db[_0x2e21('0x87')],'as':_0x2e21('0x88'),'attributes':['name','fullname',_0x2e21('0x89')],'required':![]},{'model':db['Tag'],'as':_0x2e21('0x8a'),'attributes':['id',_0x2e21('0x2b'),'color'],'where':_0x244d97[_0x2e21('0x50')]['tag']?{'id':_0x244d97[_0x2e21('0x50')][_0x2e21('0x8b')]}:undefined,'required':_0x244d97[_0x2e21('0x50')][_0x2e21('0x8b')]?!![]:![]}];}return db[_0x2e21('0x82')][_0x2e21('0x61')](_0x5e2975);})['then'](function(_0x154a34){_0x21e326[_0x2e21('0x70')]=_0x154a34;return _0x21e326;});}})['then'](respondWithFilteredResult(_0x2b3fd2,_0x5e2975))['catch'](handleError(_0x2b3fd2,null));};exports['addApplications']=function addApplications(_0x5abf84,_0x223b06){var _0x59fd51=_0x5abf84[_0x2e21('0x63')]['id'];var _0xd3e272=_0x5abf84[_0x2e21('0x66')];var _0x471913=0xc8;var _0x285984=null;return db[_0x2e21('0x8c')][_0x2e21('0x8d')]({'isolationLevel':db[_0x2e21('0x8c')][_0x2e21('0x8e')][_0x2e21('0x8f')][_0x2e21('0x90')]},function(_0x328c0f){return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x59fd51},'transaction':_0x328c0f})[_0x2e21('0x27')](function(_0x52f016){if(_0x52f016){return db['MailApplication'][_0x2e21('0x26')]({'where':{'MailAccountId':_0x59fd51},'transaction':_0x328c0f})['then'](function(){var _0x466548=_[_0x2e21('0x49')](_0xd3e272,function(_0x4fd8ce){_0x4fd8ce['MailAccountId']=_0x59fd51;return _0x4fd8ce;});return db[_0x2e21('0x91')]['bulkCreate'](_0x466548,{'transaction':_0x328c0f});});}else{_0x471913=0x194;_0x285984=[];}});})['then'](function(){if(_0x471913!==0x194){return db[_0x2e21('0x91')][_0x2e21('0x92')]({'where':{'MailAccountId':_0x59fd51},'order':'priority'})[_0x2e21('0x27')](function(_0x19846a){_0x285984=_0x19846a;});}})[_0x2e21('0x1a')](function(_0x210ab2){_0x471913=0x1f4;logger[_0x2e21('0x17')](_0x210ab2['stack']);if(_0x210ab2[_0x2e21('0x2b')]){delete _0x210ab2['name'];}_0x285984=_0x210ab2;})[_0x2e21('0x93')](function(){if(_0x285984===null){_0x223b06[_0x2e21('0x1b')](_0x471913);}else{if(_0x471913===0x1f4){_0x223b06[_0x2e21('0x1c')](_0x471913)[_0x2e21('0x2c')](_0x285984);}else{_0x223b06[_0x2e21('0x1c')](_0x471913)[_0x2e21('0x1e')](_0x285984);}}});};exports[_0x2e21('0x94')]=function(_0x29a6d0,_0x402aab){var _0xf7020e={};var _0x19c9af={};var _0x4e9b8d;var _0x275511;return db[_0x2e21('0x4a')][_0x2e21('0x6e')]({'where':{'id':_0x29a6d0[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x402aab,null))[_0x2e21('0x27')](function(_0x41ff48){if(_0x41ff48){_0x4e9b8d=_0x41ff48;_0x19c9af[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x91')][_0x2e21('0x4b')]);_0x19c9af['query']=_[_0x2e21('0x51')](_0x29a6d0[_0x2e21('0x50')]);_0x19c9af['filters']=_['intersection'](_0x19c9af[_0x2e21('0x4f')],_0x19c9af['query']);_0xf7020e[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x19c9af['model'],qs['fields'](_0x29a6d0['query'][_0x2e21('0x55')]));_0xf7020e[_0x2e21('0x54')]=_0xf7020e[_0x2e21('0x54')][_0x2e21('0x56')]?_0xf7020e[_0x2e21('0x54')]:_0x19c9af['model'];_0xf7020e[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x5a')]);_0xf7020e[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_[_0x2e21('0x5c')](_0x29a6d0[_0x2e21('0x50')],_0x19c9af[_0x2e21('0x52')]));if(_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x5f')]){_0xf7020e['where']=_[_0x2e21('0x5d')](_0xf7020e[_0x2e21('0x5b')],{'$or':_[_0x2e21('0x49')](_0xf7020e[_0x2e21('0x54')],function(_0x4db6a2){var _0x30ba07={};_0x30ba07[_0x4db6a2]={'$like':'%'+_0x29a6d0['query'][_0x2e21('0x5f')]+'%'};return _0x30ba07;})});}_0xf7020e=_['merge']({},_0xf7020e,_0x29a6d0[_0x2e21('0x60')]);return _0x4e9b8d[_0x2e21('0x94')](_0xf7020e);}})[_0x2e21('0x27')](function(_0x75ee67){if(_0x75ee67){_0x275511=_0x75ee67[_0x2e21('0x56')];if(!_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x57')]('nolimit')){_0xf7020e[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x29a6d0[_0x2e21('0x50')][_0x2e21('0x22')]);_0xf7020e[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x29a6d0['query']['offset']);}return _0x4e9b8d[_0x2e21('0x94')](_0xf7020e);}})['then'](function(_0x585123){if(_0x585123){return _0x585123?{'count':_0x275511,'rows':_0x585123}:null;}})[_0x2e21('0x27')](respondWithResult(_0x402aab,null))[_0x2e21('0x1a')](handleError(_0x402aab,null));};exports[_0x2e21('0x95')]=function(_0x1a7b1c,_0x4452a5){var _0x526ec6={'raw':!![],'where':{}};var _0x46e742={};var _0x57e6cd={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x1a7b1c[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x4452a5,null))[_0x2e21('0x27')](function(_0x3b4313){if(_0x3b4313){_0x46e742['model']=_[_0x2e21('0x51')](db['MailMessage'][_0x2e21('0x4b')]);_0x46e742['query']=_['keys'](_0x1a7b1c[_0x2e21('0x50')]);_0x46e742[_0x2e21('0x52')]=_[_0x2e21('0x53')](_0x46e742[_0x2e21('0x4f')],_0x46e742[_0x2e21('0x50')]);_0x526ec6['attributes']=_[_0x2e21('0x53')](_0x46e742['model'],qs[_0x2e21('0x55')](_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x55')]));_0x526ec6[_0x2e21('0x54')]=_0x526ec6[_0x2e21('0x54')][_0x2e21('0x56')]?_0x526ec6[_0x2e21('0x54')]:_0x46e742[_0x2e21('0x4f')];if(!_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x57')](_0x2e21('0x58'))){_0x526ec6[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x1a7b1c[_0x2e21('0x50')]['limit']);_0x526ec6[_0x2e21('0x1f')]=qs['offset'](_0x1a7b1c['query'][_0x2e21('0x1f')]);}_0x526ec6[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x5a')]);_0x526ec6[_0x2e21('0x5b')]=qs[_0x2e21('0x52')](_['pick'](_0x1a7b1c[_0x2e21('0x50')],_0x46e742['filters']));_0x526ec6[_0x2e21('0x5b')][_0x2e21('0x6b')]=_0x3b4313['id'];if(_0x1a7b1c[_0x2e21('0x50')]['filter']){_0x526ec6['where']=_[_0x2e21('0x5d')](_0x526ec6[_0x2e21('0x5b')],{'$or':_['map'](_0x526ec6['attributes'],function(_0xa7fd90){var _0x19bd98={};_0x19bd98[_0xa7fd90]={'$like':'%'+_0x1a7b1c[_0x2e21('0x50')]['filter']+'%'};return _0x19bd98;})});}if(_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x96')]){var _0x181981=_0x1a7b1c[_0x2e21('0x50')]['$gte'][_0x2e21('0x97')](',');var _0x1c19f3={};_0x1c19f3[_0x181981[0x0]]={'$gte':moment(_0x181981[0x1])[_0x2e21('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x526ec6[_0x2e21('0x5b')]=_[_0x2e21('0x5d')](_0x526ec6[_0x2e21('0x5b')],_0x1c19f3);}_0x526ec6=_[_0x2e21('0x5d')]({},_0x526ec6,_0x1a7b1c[_0x2e21('0x60')]);return db['MailMessage'][_0x2e21('0x21')]({'where':_0x526ec6[_0x2e21('0x5b')]})[_0x2e21('0x27')](function(_0x4af94c){_0x57e6cd[_0x2e21('0x21')]=_0x4af94c;if(_0x1a7b1c['query'][_0x2e21('0x6f')]){_0x526ec6[_0x2e21('0x64')]=[{'all':!![]}];}return db[_0x2e21('0x99')][_0x2e21('0x61')](_0x526ec6);})[_0x2e21('0x27')](function(_0x40c6a2){if(_0x1a7b1c[_0x2e21('0x50')][_0x2e21('0x9a')]===_0x2e21('0x9b')){for(var _0x3915c2=0x0;_0x3915c2<_0x40c6a2[_0x2e21('0x56')];_0x3915c2++){_0x40c6a2[_0x3915c2][_0x2e21('0x66')]=juice(_0x40c6a2[_0x3915c2][_0x2e21('0x66')]);}}_0x57e6cd['rows']=_0x40c6a2;return _0x57e6cd;});}})[_0x2e21('0x27')](respondWithFilteredResult(_0x4452a5,_0x526ec6))['catch'](handleError(_0x4452a5,null));};exports[_0x2e21('0x2c')]=function(_0x4dba6d,_0xe1c440){var _0x54db3a,_0x41b789={},_0xd69775;if(_0x4dba6d[_0x2e21('0x66')]['to']){_0xd69775=_0x4dba6d[_0x2e21('0x66')]['to'][_0x2e21('0x97')](',')[0x0];}return db[_0x2e21('0x4a')]['find']({'where':{'id':_0x4dba6d[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x9c')],'as':_0x2e21('0x9d'),'include':[{'model':db['CmContact'],'as':_0x2e21('0x9e'),'where':{'email':_0xd69775},'limit':0x1,'order':[['updatedAt',_0x2e21('0x9f')]]}]},{'model':db[_0x2e21('0x46')],'as':_0x2e21('0x43'),'raw':!![],'include':[{'model':db[_0x2e21('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0x2e21('0x27')](handleEntityNotFound(_0xe1c440,null))[_0x2e21('0x27')](function(_0x477e60){if(!_0x477e60)return;_0x54db3a=_0x477e60;if(!_0x477e60[_0x2e21('0x43')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x2e21('0xa1')](_0x4dba6d['body']['from'])){_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa2')]=util[_0x2e21('0x98')]('%s\x20<%s>',_0x477e60[_0x2e21('0x2b')],_0x477e60[_0x2e21('0x76')]||_0x477e60[_0x2e21('0x43')][_0x2e21('0x37')]);}if(_0x4dba6d[_0x2e21('0x66')]['attachments']&&_0x4dba6d[_0x2e21('0x66')]['attachments'][_0x2e21('0x56')]){for(var _0x171c49=0x0;_0x171c49<_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x2e21('0x56')];_0x171c49+=0x1){_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x171c49]={'filename':_0x4dba6d['body'][_0x2e21('0xa3')][_0x171c49][_0x2e21('0x2b')],'path':path['join'](config[_0x2e21('0xa4')],_0x2e21('0xa5'),_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa3')][_0x171c49][_0x2e21('0xa6')])};}}var _0x3c260e=_0x477e60[_0x2e21('0xa7')]();return respondWithRpcPromise('SendMail',_0x2e21('0xa8'),{'account':_0x3c260e,'message':_0x4dba6d['body']});})[_0x2e21('0x27')](function(_0x3c0b19){if(!_0x3c0b19)return;_0x41b789=_0x3c0b19;if(!_0x54db3a[_0x2e21('0x9d')])throw new Error(_0x2e21('0xa9'));if(_0x54db3a[_0x2e21('0x9d')][_0x2e21('0x9e')][_0x2e21('0x56')])return _0x54db3a[_0x2e21('0x9d')][_0x2e21('0x9e')][0x0];return db[_0x2e21('0x85')][_0x2e21('0x6d')](_['defaults'](_0x4dba6d[_0x2e21('0x66')],{'firstName':_0x4dba6d[_0x2e21('0x66')]['to'],'email':_0x4dba6d[_0x2e21('0x66')]['to'],'phone':_0x4dba6d[_0x2e21('0x66')]['to'],'ListId':_0x54db3a['ListId']}));})[_0x2e21('0x27')](function(_0x4a6d95){if(!_0x4a6d95)return;var _0x584727={'UserId':_0x4dba6d[_0x2e21('0x37')]['id'],'ContactId':_0x4a6d95['id'],'MailAccountId':_0x54db3a['id'],'inReplyTo':_0x41b789['messageId'],'to':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xa2')],'cc':_0x4dba6d[_0x2e21('0x66')]['cc'],'subject':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xaa')],'attach':_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xab')],'firstMsgDirection':_0x2e21('0xac'),'lastMsgAt':moment()[_0x2e21('0x98')](_0x2e21('0xad')),'lastMsgDirection':_0x2e21('0xac'),'Messages':[_[_0x2e21('0x5d')](_0x4dba6d['body'],{'messageId':_0x41b789[_0x2e21('0xae')],'sentAt':moment()[_0x2e21('0x98')](_0x2e21('0xad')),'read':!![],'MailAccountId':_0x54db3a['id'],'UserId':_0x4dba6d[_0x2e21('0x37')]['id'],'ContactId':_0x4a6d95['id']})]};if(_0x4dba6d[_0x2e21('0x66')][_0x2e21('0xaf')]){_0x584727=_[_0x2e21('0x5d')](_0x584727,_0x4dba6d['body'][_0x2e21('0xaf')]);}return db[_0x2e21('0x82')][_0x2e21('0x6d')](_0x584727,{'include':[{'model':db[_0x2e21('0x99')],'as':_0x2e21('0xb0')}]});})['then'](respondWithResult(_0xe1c440,null))[_0x2e21('0x1a')](handleError(_0xe1c440,null));};exports['verifySmtp']=function(_0x37f8ac,_0x1e6751){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x37f8ac[_0x2e21('0x63')]['id']},'include':[{'model':db[_0x2e21('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2e21('0xa0'),'raw':!![]}]}]})[_0x2e21('0x27')](handleEntityNotFound(_0x1e6751,null))[_0x2e21('0x27')](function(_0x4a7d59){if(!_0x4a7d59[_0x2e21('0x43')])return;var _0x137158=_0x4a7d59[_0x2e21('0xa7')]();return respondWithRpcPromise(_0x2e21('0xb1'),_0x2e21('0xb2'),{'account':_0x137158});})[_0x2e21('0x27')](respondWithResult(_0x1e6751,null))[_0x2e21('0x1a')](handleError(_0x1e6751,null));};exports[_0x2e21('0x26')]=function(_0xfc0a1d,_0x28b897){return db['MailAccount'][_0x2e21('0x65')]({'where':{'id':_0xfc0a1d[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x28b897,null))[_0x2e21('0x27')](function(_0xf14c69){if(_0xf14c69&&_0xf14c69[_0x2e21('0x40')]){throw new db[(_0x2e21('0xb3'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xf14c69;})[_0x2e21('0x27')](removeEntity(_0x28b897,null))[_0x2e21('0x1a')](handleError(_0x28b897,null));};exports[_0x2e21('0xb4')]=function(_0x13e7b3,_0x3a530a){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0x13e7b3['params']['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x3a530a,null))[_0x2e21('0x27')](function(_0x486e11){if(_0x486e11){return _0x486e11['addAgents'](_0x13e7b3['body'][_0x2e21('0x72')],_[_0x2e21('0xb5')](_0x13e7b3['body'],[_0x2e21('0x72'),'id'])||{})[_0x2e21('0xb6')](function(_0x41bdf6){for(var _0x2a6053=0x0;_0x2a6053<_0x13e7b3['body']['ids'][_0x2e21('0x56')];_0x2a6053+=0x1){socket['emit'](_0x2e21('0xb7'),{'UserId':Number(_0x13e7b3[_0x2e21('0x66')][_0x2e21('0x72')][_0x2a6053]),'MailAccountId':Number(_0x13e7b3[_0x2e21('0x63')]['id'])});}return _0x41bdf6;});}})[_0x2e21('0x27')](respondWithResult(_0x3a530a,null))[_0x2e21('0x1a')](handleError(_0x3a530a,null));};exports[_0x2e21('0xb8')]=function(_0xb8f6b1,_0x108171){return db[_0x2e21('0x4a')][_0x2e21('0x65')]({'where':{'id':_0xb8f6b1[_0x2e21('0x63')]['id']}})['then'](handleEntityNotFound(_0x108171,null))[_0x2e21('0x27')](function(_0x2cdce1){if(_0x2cdce1){return _0x2cdce1[_0x2e21('0xb8')](_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')])[_0x2e21('0x27')](function(){if(_[_0x2e21('0xb9')](_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')])){for(var _0x2b150b=0x0;_0x2b150b<_0xb8f6b1[_0x2e21('0x50')][_0x2e21('0x72')][_0x2e21('0x56')];_0x2b150b+=0x1){socket['emit'](_0x2e21('0xba'),{'UserId':Number(_0xb8f6b1[_0x2e21('0x50')]['ids'][_0x2b150b]),'MailAccountId':Number(_0xb8f6b1[_0x2e21('0x63')]['id'])});}}else{socket[_0x2e21('0xbb')](_0x2e21('0xba'),{'UserId':Number(_0xb8f6b1['query']['ids']),'MailAccountId':Number(_0xb8f6b1[_0x2e21('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x108171,null))[_0x2e21('0x1a')](handleError(_0x108171,null));};exports[_0x2e21('0xbc')]=function(_0x28eb48,_0x6060c6){var _0x59069b={};var _0x1e1bb6={};var _0x58fca5;var _0x587884;return db['MailAccount'][_0x2e21('0x6e')]({'where':{'id':_0x28eb48[_0x2e21('0x63')]['id']}})[_0x2e21('0x27')](handleEntityNotFound(_0x6060c6,null))[_0x2e21('0x27')](function(_0x35ecad){if(_0x35ecad){_0x58fca5=_0x35ecad;_0x1e1bb6[_0x2e21('0x4f')]=_[_0x2e21('0x51')](db[_0x2e21('0x87')][_0x2e21('0x4b')]);_0x1e1bb6[_0x2e21('0x50')]=_[_0x2e21('0x51')](_0x28eb48[_0x2e21('0x50')]);_0x1e1bb6[_0x2e21('0x52')]=_['intersection'](_0x1e1bb6[_0x2e21('0x4f')],_0x1e1bb6[_0x2e21('0x50')]);_0x59069b[_0x2e21('0x54')]=_[_0x2e21('0x53')](_0x1e1bb6[_0x2e21('0x4f')],qs[_0x2e21('0x55')](_0x28eb48[_0x2e21('0x50')][_0x2e21('0x55')]));_0x59069b[_0x2e21('0x54')]=_0x59069b[_0x2e21('0x54')][_0x2e21('0x56')]?_0x59069b[_0x2e21('0x54')]:_0x1e1bb6['model'];_0x59069b[_0x2e21('0x59')]=qs[_0x2e21('0x5a')](_0x28eb48['query'][_0x2e21('0x5a')]);_0x59069b[_0x2e21('0x5b')]=qs['filters'](_['pick'](_0x28eb48[_0x2e21('0x50')],_0x1e1bb6[_0x2e21('0x52')]));if(_0x28eb48[_0x2e21('0x50')]['filter']){_0x59069b['where']=_[_0x2e21('0x5d')](_0x59069b[_0x2e21('0x5b')],{'$or':_['map'](_0x59069b['attributes'],function(_0x4e4339){var _0x13693f={};_0x13693f[_0x4e4339]={'$like':'%'+_0x28eb48[_0x2e21('0x50')]['filter']+'%'};return _0x13693f;})});}_0x59069b=_['merge']({},_0x59069b,_0x28eb48['options']);return _0x58fca5[_0x2e21('0xbc')](_0x59069b);}})['then'](function(_0x17c981){if(_0x17c981){_0x587884=_0x17c981['length'];if(!_0x28eb48[_0x2e21('0x50')][_0x2e21('0x57')]('nolimit')){_0x59069b[_0x2e21('0x22')]=qs[_0x2e21('0x22')](_0x28eb48[_0x2e21('0x50')][_0x2e21('0x22')]);_0x59069b[_0x2e21('0x1f')]=qs[_0x2e21('0x1f')](_0x28eb48['query'][_0x2e21('0x1f')]);}return _0x58fca5['getAgents'](_0x59069b);}})[_0x2e21('0x27')](function(_0x584fb7){if(_0x584fb7){return _0x584fb7?{'count':_0x587884,'rows':_0x584fb7}:null;}})[_0x2e21('0x27')](respondWithResult(_0x6060c6,null))[_0x2e21('0x1a')](handleError(_0x6060c6,null));}; \ No newline at end of file +var _0xb932=['outlook.office365.com','Unknown\x20email\x20service\x20provider','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','port','service','authentication','host','Imap','Smtp','index','MailServerOut','Pause','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','findAll','rows','show','MailServerIn','mandatoryDispositionPause','intersection','include','find','body','custom','provider','secure','params','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','key','email','ListId','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','List','Contacts','messageId','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','get','MailAccounts','end','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com'];(function(_0x42f2a2,_0x2dad1c){var _0xc2f13b=function(_0x2720c3){while(--_0x2720c3){_0x42f2a2['push'](_0x42f2a2['shift']());}};_0xc2f13b(++_0x2dad1c);}(_0xb932,0x155));var _0x2b93=function(_0x2db472,_0x491e06){_0x2db472=_0x2db472-0x0;var _0x54c245=_0xb932[_0x2db472];return _0x54c245;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x2b93('0x0'));var _=require(_0x2b93('0x1'));var juice=require(_0x2b93('0x2'));var Redis=require(_0x2b93('0x3'));var qs=require(_0x2b93('0x4'));var logger=require(_0x2b93('0x5'))(_0x2b93('0x6'));var config=require(_0x2b93('0x7'));var db=require(_0x2b93('0x8'))['db'];config[_0x2b93('0x9')]=_[_0x2b93('0xa')](config['redis'],{'host':_0x2b93('0xb'),'port':0x18eb});var socket=require(_0x2b93('0xc'))(new Redis(config['redis']));require(_0x2b93('0xd'))[_0x2b93('0xe')](socket);var jayson=require(_0x2b93('0xf'));var client=jayson[_0x2b93('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3589a3,_0x1fecc2,_0x6ec1ae,_0x43c67a){return new BPromise(function(_0x4b90ea,_0x50604f){var _0x10c8b1=_0x43c67a||client;return _0x10c8b1[_0x2b93('0x11')](_0x3589a3,_0x6ec1ae)[_0x2b93('0x12')](function(_0xb94fda){logger[_0x2b93('0x13')](_0x2b93('0x14'),_0x1fecc2,'request\x20sent');logger[_0x2b93('0x15')](_0x2b93('0x16'),_0x1fecc2,_0x2b93('0x17'),JSON[_0x2b93('0x18')](_0xb94fda));if(_0xb94fda[_0x2b93('0x19')]){if(_0xb94fda[_0x2b93('0x19')][_0x2b93('0x1a')]===0x1f4){logger[_0x2b93('0x19')]('MailAccount,\x20%s,\x20%s',_0x1fecc2,_0xb94fda[_0x2b93('0x19')][_0x2b93('0x1b')]);return _0x50604f(_0xb94fda[_0x2b93('0x19')][_0x2b93('0x1b')]);}logger['error'](_0x2b93('0x14'),_0x1fecc2,_0xb94fda[_0x2b93('0x19')][_0x2b93('0x1b')]);return _0x4b90ea(_0xb94fda[_0x2b93('0x19')]['message']);}else{logger[_0x2b93('0x13')]('MailAccount,\x20%s,\x20%s',_0x1fecc2,_0x2b93('0x17'));_0x4b90ea(_0xb94fda[_0x2b93('0x1c')][_0x2b93('0x1b')]);}})[_0x2b93('0x1d')](function(_0x47708e){logger[_0x2b93('0x19')]('MailAccount,\x20%s,\x20%s',_0x1fecc2,_0x47708e);_0x50604f(_0x47708e);});});}function respondWithStatusCode(_0x38604c,_0x2a7af0){_0x2a7af0=_0x2a7af0||0xcc;return function(_0x5393f9){if(_0x5393f9){return _0x38604c[_0x2b93('0x1e')](_0x2a7af0);}return _0x38604c[_0x2b93('0x1f')](_0x2a7af0)['end']();};}function respondWithResult(_0x5194ff,_0x3d37d8){_0x3d37d8=_0x3d37d8||0xc8;return function(_0xf1a144){if(_0xf1a144){return _0x5194ff[_0x2b93('0x1f')](_0x3d37d8)['json'](_0xf1a144);}};}function respondWithFilteredResult(_0x21365a,_0x285475){return function(_0x29a26e){if(_0x29a26e){var _0x45aa22=typeof _0x285475[_0x2b93('0x20')]===_0x2b93('0x21')&&typeof _0x285475[_0x2b93('0x22')]===_0x2b93('0x21');var _0x353bdf=_0x29a26e[_0x2b93('0x23')];var _0x1cd83a=_0x45aa22?0x0:_0x285475[_0x2b93('0x20')];var _0x4f6288=_0x45aa22?_0x29a26e[_0x2b93('0x23')]:_0x285475[_0x2b93('0x20')]+_0x285475[_0x2b93('0x22')];var _0x115b3a;if(_0x4f6288>=_0x353bdf){_0x4f6288=_0x353bdf;_0x115b3a=0xc8;}else{_0x115b3a=0xce;}_0x21365a[_0x2b93('0x1f')](_0x115b3a);return _0x21365a[_0x2b93('0x24')](_0x2b93('0x25'),_0x1cd83a+'-'+_0x4f6288+'/'+_0x353bdf)[_0x2b93('0x26')](_0x29a26e);}return null;};}function saveUpdates(_0x2a57c9){return function(_0x55f30e){if(_0x55f30e){return _0x55f30e['update'](_0x2a57c9)[_0x2b93('0x12')](function(_0x5e5d29){return _0x5e5d29;});}return null;};}function removeEntity(_0x468203){return function(_0x39efaa){if(_0x39efaa){return _0x39efaa[_0x2b93('0x27')]()['then'](function(){var _0x3c9dd3=_0x39efaa[_0x2b93('0x28')]({'plain':!![]});var _0x3b6081=_0x2b93('0x29');return db['UserProfileResource'][_0x2b93('0x27')]({'where':{'type':_0x3b6081,'resourceId':_0x3c9dd3['id']}})[_0x2b93('0x12')](function(){return _0x39efaa;});})[_0x2b93('0x12')](function(){_0x468203['status'](0xcc)[_0x2b93('0x2a')]();});}};}function handleEntityNotFound(_0x1860e0){return function(_0x1de947){if(!_0x1de947){_0x1860e0[_0x2b93('0x1e')](0x194);}return _0x1de947;};}function handleError(_0x3d18ab,_0x327760){_0x327760=_0x327760||0x1f4;return function(_0x577d2b){logger['error'](_0x577d2b[_0x2b93('0x2b')]);if(_0x577d2b[_0x2b93('0x2c')]){delete _0x577d2b[_0x2b93('0x2c')];}_0x3d18ab['status'](_0x327760)[_0x2b93('0x2d')](_0x577d2b);};}function getImapHost(_0x38236a){switch(_0x38236a){case _0x2b93('0x2e'):return _0x2b93('0x2f');case'yahoo':return _0x2b93('0x30');case _0x2b93('0x31'):return _0x2b93('0x32');case'outlook365':return _0x2b93('0x33');}throw new Error(_0x2b93('0x34'),_0x38236a);}function getSmtpHost(_0x52c5df){switch(_0x52c5df){case _0x2b93('0x2e'):return'smtp.gmail.com';case _0x2b93('0x35'):return _0x2b93('0x36');case'hotmail':return _0x2b93('0x37');case'outlook365':return _0x2b93('0x38');}throw new Error('Unknown\x20email\x20service\x20provider',_0x52c5df);}function getAuthenticationOptions(_0x5262a1,_0x2f60a8){var _0x2b22ad={};var _0x23c9ff={};if(_0x5262a1){_0x2b22ad[_0x2b93('0x39')]=_0x23c9ff[_0x2b93('0x39')]=_0x2f60a8[_0x2b93('0x3a')];_0x2b22ad['password']=_0x23c9ff[_0x2b93('0x3b')]=_0x2f60a8[_0x2b93('0x3c')];if(_0x2f60a8['modernAuthentication']){_0x2b22ad[_0x2b93('0x3d')]=_0x23c9ff[_0x2b93('0x3d')]=!![];_0x2b22ad['CloudProviderId']=_0x23c9ff[_0x2b93('0x3e')]=_0x2f60a8[_0x2b93('0x3e')];_0x2b22ad[_0x2b93('0x3c')]=_0x23c9ff[_0x2b93('0x3b')]=null;}else{_0x2b22ad[_0x2b93('0x3e')]=_0x23c9ff[_0x2b93('0x3e')]=null;}_0x2b22ad['host']=getImapHost(_0x5262a1);_0x2b22ad[_0x2b93('0x3f')]=0x3e1;_0x23c9ff['host']=getSmtpHost(_0x5262a1);_0x23c9ff[_0x2b93('0x3f')]=0x24b;_0x23c9ff['secure']=![];_0x2b22ad[_0x2b93('0x40')]=_0x23c9ff['service']=null;}else{if(_0x2f60a8[_0x2b93('0x41')]){_0x2b22ad[_0x2b93('0x39')]=_0x23c9ff['user']=_0x2f60a8[_0x2b93('0x3a')];_0x2b22ad['password']=_0x23c9ff['pass']=_0x2f60a8[_0x2b93('0x3c')];}else{_0x2b22ad['authentication']=_0x23c9ff[_0x2b93('0x41')]=![];_0x2b22ad[_0x2b93('0x39')]=_0x23c9ff[_0x2b93('0x39')]=null;_0x2b22ad['password']=_0x23c9ff['pass']=null;}_0x2b22ad[_0x2b93('0x42')]=_0x2f60a8[_0x2b93('0x43')][_0x2b93('0x42')];_0x2b22ad[_0x2b93('0x3f')]=_0x2f60a8[_0x2b93('0x43')][_0x2b93('0x3f')];_0x23c9ff[_0x2b93('0x42')]=_0x2f60a8[_0x2b93('0x44')][_0x2b93('0x42')];_0x23c9ff['port']=_0x2f60a8[_0x2b93('0x44')][_0x2b93('0x3f')];}return{'Imap':_0x2b22ad,'Smtp':_0x23c9ff};}exports[_0x2b93('0x45')]=function(_0x9f8f4d,_0x6f2a5d){var _0x125dd7={'include':[{'model':db['MailServerIn'],'as':_0x2b93('0x43')},{'model':db[_0x2b93('0x46')],'as':_0x2b93('0x44')},{'model':db[_0x2b93('0x47')],'as':'mandatoryDispositionPause'}]},_0x232944={},_0x6df0cc={'count':0x0,'rows':[]};var _0x5a79de=_[_0x2b93('0x48')](db['MailAccount'][_0x2b93('0x49')],function(_0x59765a){return{'name':_0x59765a[_0x2b93('0x4a')],'type':_0x59765a[_0x2b93('0x4b')]['key']};});_0x232944['model']=_[_0x2b93('0x48')](_0x5a79de,_0x2b93('0x2c'));_0x232944[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x9f8f4d[_0x2b93('0x4c')]);_0x232944[_0x2b93('0x4e')]=_['intersection'](_0x232944[_0x2b93('0x4f')],_0x232944['query']);_0x125dd7[_0x2b93('0x50')]=_['intersection'](_0x232944[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x9f8f4d['query']['fields']));_0x125dd7['attributes']=_0x125dd7[_0x2b93('0x50')][_0x2b93('0x52')]?_0x125dd7[_0x2b93('0x50')]:_0x232944['model'];if(!_0x9f8f4d[_0x2b93('0x4c')][_0x2b93('0x53')](_0x2b93('0x54'))){_0x125dd7[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x9f8f4d['query']['limit']);_0x125dd7[_0x2b93('0x20')]=qs[_0x2b93('0x20')](_0x9f8f4d[_0x2b93('0x4c')]['offset']);}_0x125dd7[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x9f8f4d[_0x2b93('0x4c')][_0x2b93('0x56')]);_0x125dd7[_0x2b93('0x57')]=qs['filters'](_[_0x2b93('0x58')](_0x9f8f4d[_0x2b93('0x4c')],_0x232944['filters']),_0x5a79de);if(_0x9f8f4d[_0x2b93('0x4c')][_0x2b93('0x59')]){_0x125dd7[_0x2b93('0x57')]=_[_0x2b93('0x5a')](_0x125dd7[_0x2b93('0x57')],{'$or':_[_0x2b93('0x48')](_0x5a79de,function(_0x4e4179){if(_0x4e4179[_0x2b93('0x4b')]!==_0x2b93('0x5b')){var _0x5cf8bf={};_0x5cf8bf[_0x4e4179[_0x2b93('0x2c')]]={'$like':'%'+_0x9f8f4d['query'][_0x2b93('0x59')]+'%'};return _0x5cf8bf;}})});}_0x125dd7=_[_0x2b93('0x5a')]({},_0x125dd7,_0x9f8f4d[_0x2b93('0x5c')]);var _0xead288={'where':_0x125dd7[_0x2b93('0x57')]};return db[_0x2b93('0x5d')]['count'](_0xead288)[_0x2b93('0x12')](function(_0x2d68a0){_0x6df0cc[_0x2b93('0x23')]=_0x2d68a0;if(_0x9f8f4d[_0x2b93('0x4c')][_0x2b93('0x5e')]){_0x125dd7['include']=[{'all':!![]}];}return db[_0x2b93('0x5d')][_0x2b93('0x5f')](_0x125dd7);})[_0x2b93('0x12')](function(_0x5ed5ae){_0x6df0cc[_0x2b93('0x60')]=_0x5ed5ae;return _0x6df0cc;})[_0x2b93('0x12')](respondWithFilteredResult(_0x6f2a5d,_0x125dd7))[_0x2b93('0x1d')](handleError(_0x6f2a5d,null));};exports[_0x2b93('0x61')]=function(_0x48a0e8,_0x142650){var _0x74aad6={'raw':![],'where':{'id':_0x48a0e8['params']['id']},'include':[{'model':db[_0x2b93('0x62')],'as':_0x2b93('0x43')},{'model':db[_0x2b93('0x46')],'as':_0x2b93('0x44')},{'model':db['Pause'],'as':_0x2b93('0x63')}]},_0x5a0f99={};_0x5a0f99['model']=_[_0x2b93('0x4d')](db[_0x2b93('0x5d')]['rawAttributes']);_0x5a0f99[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x48a0e8[_0x2b93('0x4c')]);_0x5a0f99[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x5a0f99['model'],_0x5a0f99[_0x2b93('0x4c')]);_0x74aad6['attributes']=_['intersection'](_0x5a0f99[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x48a0e8[_0x2b93('0x4c')][_0x2b93('0x51')]));_0x74aad6[_0x2b93('0x50')]=_0x74aad6['attributes'][_0x2b93('0x52')]?_0x74aad6[_0x2b93('0x50')]:_0x5a0f99[_0x2b93('0x4f')];if(_0x48a0e8['query'][_0x2b93('0x5e')]){_0x74aad6[_0x2b93('0x65')]=[{'all':!![]}];}_0x74aad6=_['merge']({},_0x74aad6,_0x48a0e8['options']);return db[_0x2b93('0x5d')][_0x2b93('0x66')](_0x74aad6)[_0x2b93('0x12')](handleEntityNotFound(_0x142650,null))[_0x2b93('0x12')](respondWithResult(_0x142650,null))[_0x2b93('0x1d')](handleError(_0x142650,null));};exports['update']=function(_0x2e9e58,_0x585aae){if(_0x2e9e58[_0x2b93('0x67')]['id']){delete _0x2e9e58[_0x2b93('0x67')]['id'];}var _0x416b3b=_0x2e9e58[_0x2b93('0x67')]['provider']===_0x2b93('0x68')?null:_0x2e9e58[_0x2b93('0x67')][_0x2b93('0x69')];var _0x4e880f=_0x2e9e58[_0x2b93('0x67')]['Imap']||{};var _0x52b65b=_0x2e9e58[_0x2b93('0x67')][_0x2b93('0x44')]||{};if(_0x416b3b){_0x4e880f[_0x2b93('0x42')]=getImapHost(_0x416b3b);_0x4e880f['port']=0x3e1;_0x52b65b[_0x2b93('0x42')]=getSmtpHost(_0x416b3b);_0x52b65b[_0x2b93('0x3f')]=0x24b;_0x52b65b['secure']=![];}if(_0x52b65b[_0x2b93('0x3d')]){_0x52b65b[_0x2b93('0x6a')]=![];}else{_0x52b65b[_0x2b93('0x3e')]=null;}if(!_0x4e880f['modernAuthentication'])_0x4e880f[_0x2b93('0x3e')]=null;_0x2e9e58[_0x2b93('0x67')][_0x2b93('0x43')]=_0x4e880f;_0x2e9e58[_0x2b93('0x67')]['Smtp']=_0x52b65b;return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x2e9e58[_0x2b93('0x6b')]['id']},'include':[{'model':db[_0x2b93('0x62')],'as':_0x2b93('0x43')},{'model':db[_0x2b93('0x46')],'as':_0x2b93('0x44')},{'model':db[_0x2b93('0x47')],'as':_0x2b93('0x63')}]})[_0x2b93('0x12')](handleEntityNotFound(_0x585aae,null))[_0x2b93('0x12')](function(_0x3ffe31){if(!_0x3ffe31)throw new Error(_0x2b93('0x6c'));if(_0x3ffe31[_0x2b93('0x40')])delete _0x2e9e58[_0x2b93('0x67')]['Imap'];return _0x3ffe31;})[_0x2b93('0x12')](saveUpdates(_0x2e9e58[_0x2b93('0x67')],null))[_0x2b93('0x12')](function(_0x35f8c1){if(!_0x2e9e58[_0x2b93('0x67')]['Imap'])return _0x35f8c1;return db[_0x2b93('0x62')][_0x2b93('0x6d')](_0x2e9e58[_0x2b93('0x67')]['Imap'],{'where':{'MailAccountId':_0x35f8c1['id']}})['then'](function(){return _0x35f8c1;});})['then'](function(_0x1ce20){if(!_0x2e9e58[_0x2b93('0x67')]['Smtp'])return _0x1ce20;return db[_0x2b93('0x46')][_0x2b93('0x6d')](_0x2e9e58[_0x2b93('0x67')][_0x2b93('0x44')],{'where':{'MailAccountId':_0x1ce20['id']}})[_0x2b93('0x12')](function(){return _0x1ce20;});})[_0x2b93('0x12')](respondWithResult(_0x585aae,null))[_0x2b93('0x1d')](handleError(_0x585aae,null));};exports[_0x2b93('0x6e')]=function(_0x164b39,_0x5c1601){return db['MailAccount']['describe']()['then'](respondWithResult(_0x5c1601,null))[_0x2b93('0x1d')](handleError(_0x5c1601,null));};exports[_0x2b93('0x6f')]=function(_0x4b4a91,_0x455d96){if(_0x4b4a91[_0x2b93('0x67')]['id']){delete _0x4b4a91[_0x2b93('0x67')]['id'];}return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x4b4a91[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x455d96,null))[_0x2b93('0x12')](function(_0x5ad36e){if(_0x5ad36e){_0x4b4a91[_0x2b93('0x67')][_0x2b93('0x70')]=_0x5ad36e['id'];return db[_0x2b93('0x71')][_0x2b93('0x72')](_0x4b4a91[_0x2b93('0x67')]);}})[_0x2b93('0x12')](respondWithResult(_0x455d96,null))[_0x2b93('0x1d')](handleError(_0x455d96,null));};exports['getDispositions']=function(_0x2724c1,_0x145555){var _0x7bcbbd={'raw':![],'where':{}};var _0x15a4d2={};var _0x4a7296={'count':0x0,'rows':[]};return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0x2724c1[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x145555,null))[_0x2b93('0x12')](function(_0xcc789){if(_0xcc789){_0x15a4d2[_0x2b93('0x4f')]=_['keys'](db['Disposition'][_0x2b93('0x49')]);_0x15a4d2[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x2724c1[_0x2b93('0x4c')]);_0x15a4d2[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x15a4d2[_0x2b93('0x4f')],_0x15a4d2[_0x2b93('0x4c')]);_0x7bcbbd['attributes']=_[_0x2b93('0x64')](_0x15a4d2[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x2724c1[_0x2b93('0x4c')]['fields']));_0x7bcbbd[_0x2b93('0x50')]=_0x7bcbbd['attributes'][_0x2b93('0x52')]?_0x7bcbbd[_0x2b93('0x50')]:_0x15a4d2[_0x2b93('0x4f')];if(!_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x53')](_0x2b93('0x54'))){_0x7bcbbd[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x22')]);_0x7bcbbd[_0x2b93('0x20')]=qs[_0x2b93('0x20')](_0x2724c1[_0x2b93('0x4c')]['offset']);}_0x7bcbbd[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x56')]);_0x7bcbbd[_0x2b93('0x57')]=qs[_0x2b93('0x4e')](_[_0x2b93('0x58')](_0x2724c1[_0x2b93('0x4c')],_0x15a4d2[_0x2b93('0x4e')]));_0x7bcbbd['where']['MailAccountId']=_0xcc789['id'];if(_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x59')]){_0x7bcbbd['where']=_[_0x2b93('0x5a')](_0x7bcbbd[_0x2b93('0x57')],{'$or':_[_0x2b93('0x48')](_0x7bcbbd[_0x2b93('0x50')],function(_0xf7d017){var _0x2ef1fa={};_0x2ef1fa[_0xf7d017]={'$like':'%'+_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x59')]+'%'};return _0x2ef1fa;})});}_0x7bcbbd=_[_0x2b93('0x5a')]({},_0x7bcbbd,_0x2724c1['options']);return db['Disposition'][_0x2b93('0x23')]({'where':_0x7bcbbd[_0x2b93('0x57')]})[_0x2b93('0x12')](function(_0x6e7633){_0x4a7296[_0x2b93('0x23')]=_0x6e7633;if(_0x2724c1[_0x2b93('0x4c')][_0x2b93('0x5e')]){_0x7bcbbd[_0x2b93('0x65')]=[{'all':!![]}];}return db[_0x2b93('0x71')][_0x2b93('0x5f')](_0x7bcbbd);})[_0x2b93('0x12')](function(_0x581926){_0x4a7296[_0x2b93('0x60')]=_0x581926;return _0x4a7296;});}})['then'](respondWithFilteredResult(_0x145555,_0x7bcbbd))[_0x2b93('0x1d')](handleError(_0x145555,null));};exports[_0x2b93('0x74')]=function(_0x50ec21,_0x25b47b){return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x50ec21[_0x2b93('0x6b')]['id']}})['then'](handleEntityNotFound(_0x25b47b,null))[_0x2b93('0x12')](function(_0x409d8a){if(_0x409d8a){return _0x409d8a['removeDispositions'](_0x50ec21[_0x2b93('0x4c')]['ids']);}})[_0x2b93('0x12')](respondWithStatusCode(_0x25b47b,null))['catch'](handleError(_0x25b47b,null));};exports['addAnswer']=function(_0x430b16,_0xfd7f35){if(_0x430b16[_0x2b93('0x67')]['id']){delete _0x430b16['body']['id'];}return db[_0x2b93('0x5d')]['find']({'where':{'id':_0x430b16[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0xfd7f35,null))[_0x2b93('0x12')](function(_0x446e13){if(_0x446e13){_0x430b16[_0x2b93('0x67')][_0x2b93('0x70')]=_0x446e13['id'];return db['CannedAnswer']['create'](_0x430b16[_0x2b93('0x67')]);}})[_0x2b93('0x12')](respondWithResult(_0xfd7f35,null))['catch'](handleError(_0xfd7f35,null));};exports[_0x2b93('0x75')]=function(_0x38b633,_0x5ba7ee){var _0xc67796={'raw':![],'where':{}};var _0x15400f={};var _0x379c26={'count':0x0,'rows':[]};return db['MailAccount'][_0x2b93('0x73')]({'where':{'id':_0x38b633[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x5ba7ee,null))[_0x2b93('0x12')](function(_0x1c63bd){if(_0x1c63bd){_0x15400f[_0x2b93('0x4f')]=_[_0x2b93('0x4d')](db[_0x2b93('0x76')]['rawAttributes']);_0x15400f[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x38b633[_0x2b93('0x4c')]);_0x15400f[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x15400f[_0x2b93('0x4f')],_0x15400f[_0x2b93('0x4c')]);_0xc67796[_0x2b93('0x50')]=_[_0x2b93('0x64')](_0x15400f[_0x2b93('0x4f')],qs['fields'](_0x38b633['query'][_0x2b93('0x51')]));_0xc67796['attributes']=_0xc67796[_0x2b93('0x50')]['length']?_0xc67796['attributes']:_0x15400f[_0x2b93('0x4f')];if(!_0x38b633[_0x2b93('0x4c')][_0x2b93('0x53')](_0x2b93('0x54'))){_0xc67796[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x38b633[_0x2b93('0x4c')][_0x2b93('0x22')]);_0xc67796[_0x2b93('0x20')]=qs[_0x2b93('0x20')](_0x38b633[_0x2b93('0x4c')][_0x2b93('0x20')]);}_0xc67796[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x38b633[_0x2b93('0x4c')][_0x2b93('0x56')]);_0xc67796['where']=qs[_0x2b93('0x4e')](_[_0x2b93('0x58')](_0x38b633[_0x2b93('0x4c')],_0x15400f[_0x2b93('0x4e')]));_0xc67796['where'][_0x2b93('0x70')]=_0x1c63bd['id'];if(_0x38b633[_0x2b93('0x4c')][_0x2b93('0x59')]){_0xc67796[_0x2b93('0x57')]=_[_0x2b93('0x5a')](_0xc67796[_0x2b93('0x57')],{'$or':_[_0x2b93('0x48')](_0xc67796['attributes'],function(_0x404429){var _0x3925ca={};_0x3925ca[_0x404429]={'$like':'%'+_0x38b633[_0x2b93('0x4c')]['filter']+'%'};return _0x3925ca;})});}_0xc67796=_[_0x2b93('0x5a')]({},_0xc67796,_0x38b633[_0x2b93('0x5c')]);return db[_0x2b93('0x76')][_0x2b93('0x23')]({'where':_0xc67796[_0x2b93('0x57')]})[_0x2b93('0x12')](function(_0x148756){_0x379c26['count']=_0x148756;if(_0x38b633[_0x2b93('0x4c')]['includeAll']){_0xc67796['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xc67796);})[_0x2b93('0x12')](function(_0x12e74e){_0x379c26[_0x2b93('0x60')]=_0x12e74e;return _0x379c26;});}})[_0x2b93('0x12')](respondWithFilteredResult(_0x5ba7ee,_0xc67796))[_0x2b93('0x1d')](handleError(_0x5ba7ee,null));};exports[_0x2b93('0x77')]=function(_0x4d8375,_0x526ec8){return db['MailAccount'][_0x2b93('0x66')]({'where':{'id':_0x4d8375['params']['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x526ec8,null))[_0x2b93('0x12')](function(_0x2dc1cb){if(_0x2dc1cb){return _0x2dc1cb[_0x2b93('0x77')](_0x4d8375['query'][_0x2b93('0x78')]);}})[_0x2b93('0x12')](respondWithStatusCode(_0x526ec8,null))['catch'](handleError(_0x526ec8,null));};exports[_0x2b93('0x72')]=function(_0x531c6a,_0x363514){var _0xb3da48={'name':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x2c')],'key':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x79')],'provider':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x69')]===_0x2b93('0x68')?null:_0x531c6a[_0x2b93('0x67')]['provider'],'email':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x7a')],'ListId':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x7b')],'active':!_[_0x2b93('0x7c')](_0x531c6a[_0x2b93('0x67')]['active'])?_0x531c6a['body']['active']:!![],'description':_0x531c6a[_0x2b93('0x67')][_0x2b93('0x7d')]||null};var _0x414e33=getAuthenticationOptions(_0xb3da48[_0x2b93('0x69')],_0x531c6a[_0x2b93('0x67')]);_0xb3da48[_0x2b93('0x43')]=_0x414e33[_0x2b93('0x43')];_0xb3da48['Smtp']=_0x414e33[_0x2b93('0x44')];return db[_0x2b93('0x5d')][_0x2b93('0x72')](_0xb3da48,{'include':[{'model':db[_0x2b93('0x46')],'as':'Smtp'},{'model':db[_0x2b93('0x62')],'as':_0x2b93('0x43')}]})[_0x2b93('0x12')](function(_0x2c6f27){var _0x4640ff=_0x531c6a['user']['get']({'plain':!![]});if(!_0x4640ff)throw new Error(_0x2b93('0x7e'));if(_0x4640ff[_0x2b93('0x7f')]==='user'){var _0x4d1ee6=_0x2c6f27[_0x2b93('0x28')]({'plain':!![]});return db[_0x2b93('0x80')][_0x2b93('0x66')]({'where':{'name':_0x2b93('0x29'),'userProfileId':_0x4640ff[_0x2b93('0x81')]},'raw':!![]})[_0x2b93('0x12')](function(_0x7dd15c){if(_0x7dd15c&&_0x7dd15c[_0x2b93('0x82')]===0x0){return db['UserProfileResource'][_0x2b93('0x72')]({'name':_0x4d1ee6[_0x2b93('0x2c')],'resourceId':_0x4d1ee6['id'],'type':_0x7dd15c[_0x2b93('0x2c')],'sectionId':_0x7dd15c['id']},{})[_0x2b93('0x12')](function(){return _0x2c6f27;});}else{return _0x2c6f27;}})[_0x2b93('0x1d')](function(_0x2a5672){logger[_0x2b93('0x19')](_0x2b93('0x83'),_0x2a5672);throw _0x2a5672;});}return _0x2c6f27;})[_0x2b93('0x12')](respondWithResult(_0x363514,0xc9))[_0x2b93('0x1d')](handleError(_0x363514,null));};exports[_0x2b93('0x84')]=function(_0x221a18,_0x50c7ba){return db['MailAccount'][_0x2b93('0x73')]({'where':{'id':_0x221a18[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x50c7ba,null))[_0x2b93('0x12')](function(_0x330cb9){if(_0x330cb9){return _0x330cb9['getImap']();}return null;})[_0x2b93('0x12')](respondWithResult(_0x50c7ba,null))[_0x2b93('0x1d')](handleError(_0x50c7ba,null));};exports[_0x2b93('0x85')]=function(_0x18a570,_0x17c00c){if(_0x18a570[_0x2b93('0x67')]['id']){delete _0x18a570[_0x2b93('0x67')]['id'];}return db[_0x2b93('0x5d')]['find']({'where':{'id':_0x18a570[_0x2b93('0x6b')]['id']}})['then'](handleEntityNotFound(_0x17c00c,null))[_0x2b93('0x12')](function(_0x400ba8){if(_0x400ba8){_0x18a570[_0x2b93('0x67')]['MailAccountId']=_0x400ba8['id'];return db[_0x2b93('0x62')][_0x2b93('0x72')](_0x18a570['body']);}})[_0x2b93('0x12')](respondWithResult(_0x17c00c,null))[_0x2b93('0x1d')](handleError(_0x17c00c,null));};exports[_0x2b93('0x86')]=function(_0x43b38d,_0x42159c){return db[_0x2b93('0x5d')]['findOne']({'where':{'id':_0x43b38d[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x42159c,null))[_0x2b93('0x12')](function(_0x11406d){if(_0x11406d){return _0x11406d[_0x2b93('0x87')](null);}return null;})[_0x2b93('0x12')](respondWithStatusCode(_0x42159c,null))[_0x2b93('0x1d')](handleError(_0x42159c,null));};exports[_0x2b93('0x88')]=function(_0xc4c3ed,_0x4778ba){return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0xc4c3ed[_0x2b93('0x6b')]['id']}})['then'](handleEntityNotFound(_0x4778ba,null))[_0x2b93('0x12')](function(_0x3b07b2){if(_0x3b07b2){return _0x3b07b2[_0x2b93('0x88')]();}return null;})[_0x2b93('0x12')](respondWithResult(_0x4778ba,null))[_0x2b93('0x1d')](handleError(_0x4778ba,null));};exports[_0x2b93('0x89')]=function(_0x17fd1a,_0x188ca4){if(_0x17fd1a[_0x2b93('0x67')]['id']){delete _0x17fd1a[_0x2b93('0x67')]['id'];}return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x17fd1a[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x188ca4,null))[_0x2b93('0x12')](function(_0x3c615a){if(_0x3c615a){_0x17fd1a['body'][_0x2b93('0x70')]=_0x3c615a['id'];return db[_0x2b93('0x46')][_0x2b93('0x72')](_0x17fd1a[_0x2b93('0x67')]);}})['then'](respondWithResult(_0x188ca4,null))[_0x2b93('0x1d')](handleError(_0x188ca4,null));};exports['removeSmtp']=function(_0x35e2d0,_0x154893){return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0x35e2d0['params']['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x154893,null))['then'](function(_0x33c2df){if(_0x33c2df){return _0x33c2df[_0x2b93('0x8a')](null);}return null;})[_0x2b93('0x12')](respondWithStatusCode(_0x154893,null))['catch'](handleError(_0x154893,null));};exports[_0x2b93('0x8b')]=function(_0x359b7b,_0x273c9b){return db[_0x2b93('0x8c')][_0x2b93('0x66')]({'where':{'id':_0x359b7b['params']['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x273c9b,null))[_0x2b93('0x12')](function(_0x4f9c8f){if(_0x4f9c8f){return _0x4f9c8f[_0x2b93('0x8b')](_0x359b7b[_0x2b93('0x67')][_0x2b93('0x78')],_[_0x2b93('0x8d')](_0x359b7b[_0x2b93('0x67')],[_0x2b93('0x78'),'id'])||{});}})[_0x2b93('0x12')](respondWithResult(_0x273c9b,null))[_0x2b93('0x1d')](handleError(_0x273c9b,null));};exports['getInteractions']=function(_0x1a8aa7,_0x459b37){var _0x331226={'raw':![],'where':{}};var _0x509e44={};var _0x571290={'count':0x0,'rows':[]};return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0x1a8aa7[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x459b37,null))['then'](function(_0x4dcef1){if(_0x4dcef1){_0x509e44[_0x2b93('0x4f')]=_[_0x2b93('0x4d')](db[_0x2b93('0x8c')]['rawAttributes']);_0x509e44[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x1a8aa7[_0x2b93('0x4c')]);_0x509e44[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x509e44[_0x2b93('0x4f')],_0x509e44['query']);_0x331226[_0x2b93('0x50')]=_[_0x2b93('0x64')](_0x509e44[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x51')]));_0x331226[_0x2b93('0x50')]=_0x331226[_0x2b93('0x50')][_0x2b93('0x52')]?_0x331226[_0x2b93('0x50')]:_0x509e44[_0x2b93('0x4f')];if(!_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x53')]('nolimit')){_0x331226[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x1a8aa7['query'][_0x2b93('0x22')]);_0x331226['offset']=qs[_0x2b93('0x20')](_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x20')]);}_0x331226[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x56')]);_0x331226[_0x2b93('0x57')]=qs['filters'](_[_0x2b93('0x58')](_0x1a8aa7[_0x2b93('0x4c')],_0x509e44['filters']));_0x331226[_0x2b93('0x57')][_0x2b93('0x70')]=_0x4dcef1['id'];if(_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x59')]){_0x331226[_0x2b93('0x57')]=_['merge'](_0x331226['where'],{'$or':_[_0x2b93('0x48')](_0x331226[_0x2b93('0x50')],function(_0x33b48d){var _0x4888a9={};_0x4888a9[_0x33b48d]={'$like':'%'+_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x59')]+'%'};return _0x4888a9;})});}_0x331226=_[_0x2b93('0x5a')]({},_0x331226,_0x1a8aa7[_0x2b93('0x5c')]);return db[_0x2b93('0x8c')][_0x2b93('0x23')]({'where':_0x331226[_0x2b93('0x57')]})[_0x2b93('0x12')](function(_0x53e267){_0x571290[_0x2b93('0x23')]=_0x53e267;if(_0x1a8aa7['query'][_0x2b93('0x5e')]){_0x331226[_0x2b93('0x65')]=[{'model':db[_0x2b93('0x8e')],'as':_0x2b93('0x8f'),'required':![]},{'model':db[_0x2b93('0x90')],'as':'Owner','attributes':['name',_0x2b93('0x91'),_0x2b93('0x92')],'required':![]},{'model':db[_0x2b93('0x93')],'as':_0x2b93('0x94'),'attributes':['id',_0x2b93('0x2c'),_0x2b93('0x95')],'where':_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x96')]?{'id':_0x1a8aa7[_0x2b93('0x4c')][_0x2b93('0x96')]}:undefined,'required':_0x1a8aa7['query'][_0x2b93('0x96')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x331226);})[_0x2b93('0x12')](function(_0xd0efd8){_0x571290[_0x2b93('0x60')]=_0xd0efd8;return _0x571290;});}})[_0x2b93('0x12')](respondWithFilteredResult(_0x459b37,_0x331226))['catch'](handleError(_0x459b37,null));};exports[_0x2b93('0x97')]=function addApplications(_0x27aa63,_0x40ab26){var _0x27aa2e=_0x27aa63['params']['id'];var _0x2fa6ca=_0x27aa63[_0x2b93('0x67')];var _0x1d1391=0xc8;var _0x4c2aea=null;return db[_0x2b93('0x98')][_0x2b93('0x99')]({'isolationLevel':db['sequelize'][_0x2b93('0x9a')][_0x2b93('0x9b')][_0x2b93('0x9c')]},function(_0x1ce925){return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0x27aa2e},'transaction':_0x1ce925})[_0x2b93('0x12')](function(_0xdb1ef2){if(_0xdb1ef2){return db[_0x2b93('0x9d')][_0x2b93('0x27')]({'where':{'MailAccountId':_0x27aa2e},'transaction':_0x1ce925})[_0x2b93('0x12')](function(){var _0x1b9ef2=_[_0x2b93('0x48')](_0x2fa6ca,function(_0x77c85f){_0x77c85f[_0x2b93('0x70')]=_0x27aa2e;return _0x77c85f;});return db[_0x2b93('0x9d')][_0x2b93('0x9e')](_0x1b9ef2,{'transaction':_0x1ce925});});}else{_0x1d1391=0x194;_0x4c2aea=[];}});})['then'](function(){if(_0x1d1391!==0x194){return db[_0x2b93('0x9d')]['findAndCountAll']({'where':{'MailAccountId':_0x27aa2e},'order':_0x2b93('0x9f')})[_0x2b93('0x12')](function(_0x5bd54a){_0x4c2aea=_0x5bd54a;});}})[_0x2b93('0x1d')](function(_0x88c82f){_0x1d1391=0x1f4;logger[_0x2b93('0x19')](_0x88c82f['stack']);if(_0x88c82f['name']){delete _0x88c82f[_0x2b93('0x2c')];}_0x4c2aea=_0x88c82f;})['finally'](function(){if(_0x4c2aea===null){_0x40ab26[_0x2b93('0x1e')](_0x1d1391);}else{if(_0x1d1391===0x1f4){_0x40ab26[_0x2b93('0x1f')](_0x1d1391)[_0x2b93('0x2d')](_0x4c2aea);}else{_0x40ab26['status'](_0x1d1391)['json'](_0x4c2aea);}}});};exports[_0x2b93('0xa0')]=function(_0x5d7379,_0x2664ab){var _0x20606f={};var _0x55b859={};var _0x2a1935;var _0x3c868e;return db['MailAccount'][_0x2b93('0x73')]({'where':{'id':_0x5d7379[_0x2b93('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2664ab,null))['then'](function(_0x545637){if(_0x545637){_0x2a1935=_0x545637;_0x55b859[_0x2b93('0x4f')]=_[_0x2b93('0x4d')](db[_0x2b93('0x9d')]['rawAttributes']);_0x55b859[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x5d7379[_0x2b93('0x4c')]);_0x55b859[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x55b859[_0x2b93('0x4f')],_0x55b859[_0x2b93('0x4c')]);_0x20606f['attributes']=_[_0x2b93('0x64')](_0x55b859[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x5d7379[_0x2b93('0x4c')][_0x2b93('0x51')]));_0x20606f[_0x2b93('0x50')]=_0x20606f['attributes'][_0x2b93('0x52')]?_0x20606f[_0x2b93('0x50')]:_0x55b859['model'];_0x20606f[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x5d7379[_0x2b93('0x4c')]['sort']);_0x20606f[_0x2b93('0x57')]=qs[_0x2b93('0x4e')](_[_0x2b93('0x58')](_0x5d7379[_0x2b93('0x4c')],_0x55b859[_0x2b93('0x4e')]));if(_0x5d7379[_0x2b93('0x4c')]['filter']){_0x20606f[_0x2b93('0x57')]=_['merge'](_0x20606f['where'],{'$or':_[_0x2b93('0x48')](_0x20606f[_0x2b93('0x50')],function(_0x32c44c){var _0x5d69e5={};_0x5d69e5[_0x32c44c]={'$like':'%'+_0x5d7379[_0x2b93('0x4c')][_0x2b93('0x59')]+'%'};return _0x5d69e5;})});}_0x20606f=_[_0x2b93('0x5a')]({},_0x20606f,_0x5d7379['options']);return _0x2a1935['getApplications'](_0x20606f);}})[_0x2b93('0x12')](function(_0x374528){if(_0x374528){_0x3c868e=_0x374528['length'];if(!_0x5d7379[_0x2b93('0x4c')][_0x2b93('0x53')](_0x2b93('0x54'))){_0x20606f['limit']=qs['limit'](_0x5d7379[_0x2b93('0x4c')][_0x2b93('0x22')]);_0x20606f['offset']=qs[_0x2b93('0x20')](_0x5d7379[_0x2b93('0x4c')][_0x2b93('0x20')]);}return _0x2a1935[_0x2b93('0xa0')](_0x20606f);}})[_0x2b93('0x12')](function(_0x4d094f){if(_0x4d094f){return _0x4d094f?{'count':_0x3c868e,'rows':_0x4d094f}:null;}})[_0x2b93('0x12')](respondWithResult(_0x2664ab,null))[_0x2b93('0x1d')](handleError(_0x2664ab,null));};exports['getMessages']=function(_0x31a4dd,_0x39bfc0){var _0x5c8bf7={'raw':!![],'where':{}};var _0x20907e={};var _0x41fe50={'count':0x0,'rows':[]};return db['MailAccount'][_0x2b93('0x73')]({'where':{'id':_0x31a4dd['params']['id']}})['then'](handleEntityNotFound(_0x39bfc0,null))[_0x2b93('0x12')](function(_0x3f2b38){if(_0x3f2b38){_0x20907e[_0x2b93('0x4f')]=_[_0x2b93('0x4d')](db[_0x2b93('0xa1')][_0x2b93('0x49')]);_0x20907e[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x31a4dd[_0x2b93('0x4c')]);_0x20907e['filters']=_['intersection'](_0x20907e[_0x2b93('0x4f')],_0x20907e[_0x2b93('0x4c')]);_0x5c8bf7[_0x2b93('0x50')]=_[_0x2b93('0x64')](_0x20907e['model'],qs['fields'](_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x51')]));_0x5c8bf7[_0x2b93('0x50')]=_0x5c8bf7['attributes'][_0x2b93('0x52')]?_0x5c8bf7[_0x2b93('0x50')]:_0x20907e['model'];if(!_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x53')]('nolimit')){_0x5c8bf7[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x22')]);_0x5c8bf7[_0x2b93('0x20')]=qs[_0x2b93('0x20')](_0x31a4dd['query'][_0x2b93('0x20')]);}_0x5c8bf7[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x31a4dd['query'][_0x2b93('0x56')]);_0x5c8bf7[_0x2b93('0x57')]=qs[_0x2b93('0x4e')](_[_0x2b93('0x58')](_0x31a4dd[_0x2b93('0x4c')],_0x20907e[_0x2b93('0x4e')]));_0x5c8bf7[_0x2b93('0x57')][_0x2b93('0x70')]=_0x3f2b38['id'];if(_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x59')]){_0x5c8bf7['where']=_['merge'](_0x5c8bf7[_0x2b93('0x57')],{'$or':_[_0x2b93('0x48')](_0x5c8bf7[_0x2b93('0x50')],function(_0x3523ac){var _0x59d91c={};_0x59d91c[_0x3523ac]={'$like':'%'+_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x59')]+'%'};return _0x59d91c;})});}if(_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0xa2')]){var _0x334460=_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0xa2')][_0x2b93('0xa3')](',');var _0x5f594a={};_0x5f594a[_0x334460[0x0]]={'$gte':moment(_0x334460[0x1])['format'](_0x2b93('0xa4'))};_0x5c8bf7[_0x2b93('0x57')]=_[_0x2b93('0x5a')](_0x5c8bf7['where'],_0x5f594a);}_0x5c8bf7=_['merge']({},_0x5c8bf7,_0x31a4dd[_0x2b93('0x5c')]);return db[_0x2b93('0xa1')]['count']({'where':_0x5c8bf7[_0x2b93('0x57')]})['then'](function(_0x169fa6){_0x41fe50[_0x2b93('0x23')]=_0x169fa6;if(_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0x5e')]){_0x5c8bf7[_0x2b93('0x65')]=[{'all':!![]}];}return db[_0x2b93('0xa1')][_0x2b93('0x5f')](_0x5c8bf7);})[_0x2b93('0x12')](function(_0x186b67){if(_0x31a4dd[_0x2b93('0x4c')][_0x2b93('0xa5')]==='true'){for(var _0x33d186=0x0;_0x33d186<_0x186b67[_0x2b93('0x52')];_0x33d186++){_0x186b67[_0x33d186]['body']=juice(_0x186b67[_0x33d186][_0x2b93('0x67')]);}}_0x41fe50[_0x2b93('0x60')]=_0x186b67;return _0x41fe50;});}})[_0x2b93('0x12')](respondWithFilteredResult(_0x39bfc0,_0x5c8bf7))[_0x2b93('0x1d')](handleError(_0x39bfc0,null));};exports[_0x2b93('0x2d')]=function(_0x348add,_0x12f31d){var _0x3b0852,_0x5e9140={},_0x27193c;if(_0x348add[_0x2b93('0x67')]['to']){_0x27193c=_0x348add[_0x2b93('0x67')]['to']['split'](',')[0x0];}return db[_0x2b93('0x5d')]['find']({'where':{'id':_0x348add['params']['id']},'include':[{'model':db[_0x2b93('0xa6')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x27193c},'limit':0x1,'order':[[_0x2b93('0xa7'),_0x2b93('0xa8')]]}]},{'model':db['MailServerOut'],'as':_0x2b93('0x44'),'raw':!![],'include':[{'model':db[_0x2b93('0xa9')],'as':_0x2b93('0xa9'),'raw':!![]}]}]})[_0x2b93('0x12')](handleEntityNotFound(_0x12f31d,null))[_0x2b93('0x12')](function(_0x36a57e){if(!_0x36a57e)return;_0x3b0852=_0x36a57e;if(!_0x36a57e[_0x2b93('0x44')])throw new Error(_0x2b93('0xaa'));if(_[_0x2b93('0x7c')](_0x348add[_0x2b93('0x67')][_0x2b93('0xab')])){_0x348add[_0x2b93('0x67')][_0x2b93('0xab')]=util[_0x2b93('0xac')](_0x2b93('0xad'),_0x36a57e[_0x2b93('0x2c')],_0x36a57e[_0x2b93('0x7a')]||_0x36a57e['Smtp']['user']);}if(_0x348add[_0x2b93('0x67')]['attachments']&&_0x348add[_0x2b93('0x67')][_0x2b93('0xae')]['length']){for(var _0x449fe3=0x0;_0x449fe3<_0x348add[_0x2b93('0x67')]['attachments'][_0x2b93('0x52')];_0x449fe3+=0x1){_0x348add[_0x2b93('0x67')]['attachments'][_0x449fe3]={'filename':_0x348add[_0x2b93('0x67')][_0x2b93('0xae')][_0x449fe3]['name'],'path':path['join'](config[_0x2b93('0xaf')],_0x2b93('0xb0'),_0x348add[_0x2b93('0x67')][_0x2b93('0xae')][_0x449fe3]['basename'])};}}var _0x3c81d8=_0x36a57e[_0x2b93('0xb1')]();return respondWithRpcPromise(_0x2b93('0xb2'),_0x2b93('0xb3'),{'account':_0x3c81d8,'message':_0x348add[_0x2b93('0x67')]});})[_0x2b93('0x12')](function(_0x5b647f){if(!_0x5b647f)return;_0x5e9140=_0x5b647f;if(!_0x3b0852['List'])throw new Error('List\x20not\x20found');if(_0x3b0852[_0x2b93('0xb4')][_0x2b93('0xb5')][_0x2b93('0x52')])return _0x3b0852[_0x2b93('0xb4')][_0x2b93('0xb5')][0x0];return db[_0x2b93('0x8e')][_0x2b93('0x72')](_[_0x2b93('0xa')](_0x348add[_0x2b93('0x67')],{'firstName':_0x348add['body']['to'],'email':_0x348add[_0x2b93('0x67')]['to'],'phone':_0x348add[_0x2b93('0x67')]['to'],'ListId':_0x3b0852[_0x2b93('0x7b')]}));})[_0x2b93('0x12')](function(_0x4c90a0){if(!_0x4c90a0)return;var _0x5b3c81={'UserId':_0x348add[_0x2b93('0x39')]['id'],'ContactId':_0x4c90a0['id'],'MailAccountId':_0x3b0852['id'],'inReplyTo':_0x5e9140[_0x2b93('0xb6')],'to':_0x348add['body'][_0x2b93('0xab')],'cc':_0x348add[_0x2b93('0x67')]['cc'],'subject':_0x348add[_0x2b93('0x67')]['subject'],'attach':_0x348add[_0x2b93('0x67')]['attach'],'firstMsgDirection':_0x2b93('0xb7'),'lastMsgAt':moment()['format'](_0x2b93('0xa4')),'lastMsgDirection':_0x2b93('0xb7'),'Messages':[_[_0x2b93('0x5a')](_0x348add[_0x2b93('0x67')],{'messageId':_0x5e9140['messageId'],'sentAt':moment()[_0x2b93('0xac')](_0x2b93('0xa4')),'read':!![],'MailAccountId':_0x3b0852['id'],'UserId':_0x348add[_0x2b93('0x39')]['id'],'ContactId':_0x4c90a0['id']})]};if(_0x348add[_0x2b93('0x67')][_0x2b93('0xb8')]){_0x5b3c81=_[_0x2b93('0x5a')](_0x5b3c81,_0x348add[_0x2b93('0x67')][_0x2b93('0xb8')]);}return db[_0x2b93('0x8c')][_0x2b93('0x72')](_0x5b3c81,{'include':[{'model':db[_0x2b93('0xa1')],'as':_0x2b93('0xb9')}]});})[_0x2b93('0x12')](respondWithResult(_0x12f31d,null))[_0x2b93('0x1d')](handleError(_0x12f31d,null));};exports[_0x2b93('0xba')]=function(_0x3b69f8,_0x516017){return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x3b69f8[_0x2b93('0x6b')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2b93('0xa9'),'raw':!![]}]}]})[_0x2b93('0x12')](handleEntityNotFound(_0x516017,null))['then'](function(_0x592b9b){if(!_0x592b9b[_0x2b93('0x44')])return;var _0x268961=_0x592b9b['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x268961});})[_0x2b93('0x12')](respondWithResult(_0x516017,null))[_0x2b93('0x1d')](handleError(_0x516017,null));};exports['destroy']=function(_0x46ed06,_0x1d599b){return db['MailAccount']['find']({'where':{'id':_0x46ed06['params']['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x1d599b,null))[_0x2b93('0x12')](function(_0x44d85f){if(_0x44d85f&&_0x44d85f[_0x2b93('0x40')]){throw new db[(_0x2b93('0xbb'))]['ValidationError'](_0x2b93('0xbc'));}return _0x44d85f;})[_0x2b93('0x12')](removeEntity(_0x1d599b,null))[_0x2b93('0x1d')](handleError(_0x1d599b,null));};exports['addAgents']=function(_0x3446fe,_0x392cea){return db[_0x2b93('0x5d')][_0x2b93('0x66')]({'where':{'id':_0x3446fe[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x392cea,null))[_0x2b93('0x12')](function(_0x5732a2){if(_0x5732a2){return _0x5732a2[_0x2b93('0xbd')](_0x3446fe[_0x2b93('0x67')][_0x2b93('0x78')],_[_0x2b93('0x8d')](_0x3446fe[_0x2b93('0x67')],['ids','id'])||{})[_0x2b93('0xbe')](function(_0x336751){for(var _0xcb0b15=0x0;_0xcb0b15<_0x3446fe[_0x2b93('0x67')][_0x2b93('0x78')][_0x2b93('0x52')];_0xcb0b15+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x3446fe['body'][_0x2b93('0x78')][_0xcb0b15]),'MailAccountId':Number(_0x3446fe[_0x2b93('0x6b')]['id'])});}return _0x336751;});}})['then'](respondWithResult(_0x392cea,null))[_0x2b93('0x1d')](handleError(_0x392cea,null));};exports[_0x2b93('0xbf')]=function(_0x56d403,_0x29ca03){return db[_0x2b93('0x5d')]['find']({'where':{'id':_0x56d403[_0x2b93('0x6b')]['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x29ca03,null))[_0x2b93('0x12')](function(_0x15c5ba){if(_0x15c5ba){return _0x15c5ba['removeAgents'](_0x56d403[_0x2b93('0x4c')][_0x2b93('0x78')])[_0x2b93('0x12')](function(){if(_[_0x2b93('0xc0')](_0x56d403[_0x2b93('0x4c')][_0x2b93('0x78')])){for(var _0x1c6d32=0x0;_0x1c6d32<_0x56d403[_0x2b93('0x4c')][_0x2b93('0x78')][_0x2b93('0x52')];_0x1c6d32+=0x1){socket[_0x2b93('0xc1')](_0x2b93('0xc2'),{'UserId':Number(_0x56d403[_0x2b93('0x4c')][_0x2b93('0x78')][_0x1c6d32]),'MailAccountId':Number(_0x56d403[_0x2b93('0x6b')]['id'])});}}else{socket[_0x2b93('0xc1')](_0x2b93('0xc2'),{'UserId':Number(_0x56d403[_0x2b93('0x4c')][_0x2b93('0x78')]),'MailAccountId':Number(_0x56d403[_0x2b93('0x6b')]['id'])});}});}})[_0x2b93('0x12')](respondWithStatusCode(_0x29ca03,null))['catch'](handleError(_0x29ca03,null));};exports[_0x2b93('0xc3')]=function(_0x2a07e3,_0x4be1e4){var _0x4939f8={};var _0x47413d={};var _0x329b81;var _0x257b66;return db[_0x2b93('0x5d')][_0x2b93('0x73')]({'where':{'id':_0x2a07e3['params']['id']}})[_0x2b93('0x12')](handleEntityNotFound(_0x4be1e4,null))[_0x2b93('0x12')](function(_0x52c2a4){if(_0x52c2a4){_0x329b81=_0x52c2a4;_0x47413d['model']=_[_0x2b93('0x4d')](db['User'][_0x2b93('0x49')]);_0x47413d[_0x2b93('0x4c')]=_[_0x2b93('0x4d')](_0x2a07e3[_0x2b93('0x4c')]);_0x47413d[_0x2b93('0x4e')]=_[_0x2b93('0x64')](_0x47413d['model'],_0x47413d[_0x2b93('0x4c')]);_0x4939f8[_0x2b93('0x50')]=_[_0x2b93('0x64')](_0x47413d[_0x2b93('0x4f')],qs[_0x2b93('0x51')](_0x2a07e3[_0x2b93('0x4c')]['fields']));_0x4939f8[_0x2b93('0x50')]=_0x4939f8[_0x2b93('0x50')][_0x2b93('0x52')]?_0x4939f8[_0x2b93('0x50')]:_0x47413d['model'];_0x4939f8[_0x2b93('0x55')]=qs[_0x2b93('0x56')](_0x2a07e3['query'][_0x2b93('0x56')]);_0x4939f8[_0x2b93('0x57')]=qs[_0x2b93('0x4e')](_[_0x2b93('0x58')](_0x2a07e3[_0x2b93('0x4c')],_0x47413d[_0x2b93('0x4e')]));if(_0x2a07e3[_0x2b93('0x4c')][_0x2b93('0x59')]){_0x4939f8[_0x2b93('0x57')]=_['merge'](_0x4939f8[_0x2b93('0x57')],{'$or':_['map'](_0x4939f8['attributes'],function(_0x64e4d3){var _0x130bc2={};_0x130bc2[_0x64e4d3]={'$like':'%'+_0x2a07e3[_0x2b93('0x4c')]['filter']+'%'};return _0x130bc2;})});}_0x4939f8=_[_0x2b93('0x5a')]({},_0x4939f8,_0x2a07e3[_0x2b93('0x5c')]);return _0x329b81[_0x2b93('0xc3')](_0x4939f8);}})[_0x2b93('0x12')](function(_0x4f0ea2){if(_0x4f0ea2){_0x257b66=_0x4f0ea2[_0x2b93('0x52')];if(!_0x2a07e3[_0x2b93('0x4c')]['hasOwnProperty']('nolimit')){_0x4939f8[_0x2b93('0x22')]=qs[_0x2b93('0x22')](_0x2a07e3[_0x2b93('0x4c')][_0x2b93('0x22')]);_0x4939f8[_0x2b93('0x20')]=qs[_0x2b93('0x20')](_0x2a07e3['query'][_0x2b93('0x20')]);}return _0x329b81[_0x2b93('0xc3')](_0x4939f8);}})[_0x2b93('0x12')](function(_0x419832){if(_0x419832){return _0x419832?{'count':_0x257b66,'rows':_0x419832}:null;}})[_0x2b93('0x12')](respondWithResult(_0x4be1e4,null))[_0x2b93('0x1d')](handleError(_0x4be1e4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 375ecd2..3da807f 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 _0x070f=['MailAccount','save','update','remove','emit','exports','events'];(function(_0x19ea49,_0xd8ecd8){var _0x505553=function(_0x1de04f){while(--_0x1de04f){_0x19ea49['push'](_0x19ea49['shift']());}};_0x505553(++_0xd8ecd8);}(_0x070f,0x13a));var _0xf070=function(_0x377685,_0x325b5b){_0x377685=_0x377685-0x0;var _0x1c44c3=_0x070f[_0x377685];return _0x1c44c3;};'use strict';var EventEmitter=require(_0xf070('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xf070('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf070('0x2'),'afterUpdate':_0xf070('0x3'),'afterDestroy':_0xf070('0x4')};function emitEvent(_0x100840){return function(_0x2f656e,_0x124467,_0x585478){MailAccountEvents[_0xf070('0x5')](_0x100840+':'+_0x2f656e['id'],_0x2f656e);MailAccountEvents['emit'](_0x100840,_0x2f656e);_0x585478(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xf070('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x0257=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners','save','update'];(function(_0x4e6902,_0x11c973){var _0x28f865=function(_0x5ba2b1){while(--_0x5ba2b1){_0x4e6902['push'](_0x4e6902['shift']());}};_0x28f865(++_0x11c973);}(_0x0257,0x1db));var _0x7025=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x0257[_0x531cb8];return _0x5cf297;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x7025('0x0'))['db'][_0x7025('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7025('0x2')](0x0);var events={'afterCreate':_0x7025('0x3'),'afterUpdate':_0x7025('0x4'),'afterDestroy':_0x7025('0x5')};function emitEvent(_0x172dc6){return function(_0x10058d,_0x2fcab5,_0x56d3e5){MailAccountEvents[_0x7025('0x6')](_0x172dc6+':'+_0x10058d['id'],_0x10058d);MailAccountEvents[_0x7025('0x6')](_0x172dc6,_0x10058d);_0x56d3e5(null);};}for(var e in events){if(events[_0x7025('0x7')](e)){var event=events[e];MailAccount[_0x7025('0x8')](e,emitEvent(event));}}module[_0x7025('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index aaa4b0d..f65a57f 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 _0x1384=['service','provider','host','Smtp','secure','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','./mailAccount.attributes','MailAccount','mail_accounts','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1384,0x176));var _0x4138=function(_0x2af3f3,_0xe1b480){_0x2af3f3=_0x2af3f3-0x0;var _0x4cb12b=_0x1384[_0x2af3f3];return _0x4cb12b;};'use strict';var attributes=require(_0x4138('0x0'));module['exports']=function(_0x47275d){return _0x47275d['define'](_0x4138('0x1'),attributes,{'tableName':_0x4138('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3002fb=this;var _0x446d20={'id':_0x3002fb['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3002fb['provider']!==_0x4138('0x3')){_0x446d20[_0x4138('0x4')]=_0x3002fb[_0x4138('0x5')];}else{_0x446d20[_0x4138('0x6')]=_0x3002fb[_0x4138('0x7')]['host'];_0x446d20['port']=_0x3002fb['Smtp']['port'];_0x446d20['secure']=_0x3002fb[_0x4138('0x7')][_0x4138('0x8')];}if(_0x3002fb[_0x4138('0x7')]['authentication']){if(_0x3002fb[_0x4138('0x7')][_0x4138('0x9')]){if(!_0x3002fb['Smtp']['CloudProvider'])throw new Error(_0x4138('0xa'));_0x446d20[_0x4138('0xb')]={'type':_0x4138('0xc'),'user':_0x3002fb[_0x4138('0x7')][_0x4138('0xd')],'accessToken':_0x3002fb[_0x4138('0x7')]['CloudProvider']['data5']};}else{_0x446d20['auth']={'user':_0x3002fb[_0x4138('0x7')][_0x4138('0xd')],'pass':_0x3002fb[_0x4138('0x7')]['pass']};}}return _0x446d20;}}});}; \ No newline at end of file +var _0x5402=['pass','./mailAccount.attributes','exports','define','MailAccount','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth'];(function(_0xb2d404,_0x4e1b08){var _0x4ecb03=function(_0x45f434){while(--_0x45f434){_0xb2d404['push'](_0xb2d404['shift']());}};_0x4ecb03(++_0x4e1b08);}(_0x5402,0x1e1));var _0x2540=function(_0x34c5d1,_0x8dd02f){_0x34c5d1=_0x34c5d1-0x0;var _0x2ecc49=_0x5402[_0x34c5d1];return _0x2ecc49;};'use strict';var attributes=require(_0x2540('0x0'));module[_0x2540('0x1')]=function(_0x58a1d9){return _0x58a1d9[_0x2540('0x2')](_0x2540('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4e8134=this;var _0x4cf352={'id':_0x4e8134['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4e8134[_0x2540('0x4')]!==_0x2540('0x5')){_0x4cf352[_0x2540('0x6')]=_0x4e8134[_0x2540('0x4')];}else{_0x4cf352[_0x2540('0x7')]=_0x4e8134[_0x2540('0x8')][_0x2540('0x7')];_0x4cf352[_0x2540('0x9')]=_0x4e8134[_0x2540('0x8')][_0x2540('0x9')];_0x4cf352['secure']=_0x4e8134['Smtp'][_0x2540('0xa')];}if(_0x4e8134[_0x2540('0x8')][_0x2540('0xb')]){if(_0x4e8134['Smtp'][_0x2540('0xc')]){if(!_0x4e8134[_0x2540('0x8')][_0x2540('0xd')])throw new Error(_0x2540('0xe'));_0x4cf352['auth']={'type':_0x2540('0xf'),'user':_0x4e8134[_0x2540('0x8')][_0x2540('0x10')],'accessToken':_0x4e8134[_0x2540('0x8')][_0x2540('0xd')][_0x2540('0x11')]};}else{_0x4cf352[_0x2540('0x12')]={'user':_0x4e8134[_0x2540('0x8')][_0x2540('0x10')],'pass':_0x4e8134[_0x2540('0x8')][_0x2540('0x13')]};}}return _0x4cf352;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a5faaa4..6ac9047 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 _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x4af23c,_0x50e294){var _0x194b63=function(_0x44f871){while(--_0x44f871){_0x4af23c['push'](_0x4af23c['shift']());}};_0x194b63(++_0x50e294);}(_0x187d,0x93));var _0xd187=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x187d[_0x32d457];return _0x338386;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});}; \ No newline at end of file +var _0x66fa=['ShowMailAccount','smtp','getSmtpOptions','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','Applications','MailServerOut','Smtp','List','get','omit','smtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','then','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch'];(function(_0x3620f3,_0x5ef1f7){var _0x51e748=function(_0x432e1b){while(--_0x432e1b){_0x3620f3['push'](_0x3620f3['shift']());}};_0x51e748(++_0x5ef1f7);}(_0x66fa,0x117));var _0xa66f=function(_0xfd2489,_0x544007){_0xfd2489=_0xfd2489-0x0;var _0x209bd8=_0x66fa[_0xfd2489];return _0x209bd8;};'use strict';var _=require(_0xa66f('0x0'));var moment=require(_0xa66f('0x1'));var BPromise=require('bluebird');var rs=require(_0xa66f('0x2'));var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var logger=require(_0xa66f('0x5'))(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var jayson=require(_0xa66f('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0xa66f('0x9')]=_[_0xa66f('0xa')](config[_0xa66f('0x9')],{'host':_0xa66f('0xb'),'port':0x18eb});var socket=require(_0xa66f('0xc'))(new Redis(config['redis']));require(_0xa66f('0xd'))['register'](socket);function respondWithRpcPromise(_0x46c788,_0x597c7c,_0x101e10){return new BPromise(function(_0x53ca76,_0x52d802){return client['request'](_0x46c788,_0x101e10)[_0xa66f('0xe')](function(_0x825868){logger['info'](_0xa66f('0xf'),_0x597c7c,'request\x20sent');logger[_0xa66f('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x597c7c,_0xa66f('0x11'),JSON[_0xa66f('0x12')](_0x825868));if(_0x825868[_0xa66f('0x13')]){if(_0x825868['error']['code']===0x1f4){logger[_0xa66f('0x13')]('MailAccount,\x20%s,\x20%s',_0x597c7c,_0x825868['error']['message']);return _0x52d802(_0x825868[_0xa66f('0x13')][_0xa66f('0x14')]);}logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x825868[_0xa66f('0x13')]['message']);return _0x53ca76(_0x825868['error'][_0xa66f('0x14')]);}else{logger[_0xa66f('0x15')](_0xa66f('0xf'),_0x597c7c,_0xa66f('0x11'));_0x53ca76(_0x825868['result'][_0xa66f('0x14')]);}})['catch'](function(_0x4a28d4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x597c7c,_0x4a28d4);_0x52d802(_0x4a28d4);});});}exports[_0xa66f('0x16')]=function(_0x355ddc){var _0x2c5b76=this;return new Promise(function(_0x408bc7,_0x251f60){return db[_0xa66f('0x17')][_0xa66f('0x18')]({'raw':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x355ddc['options']?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'limit':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')]['limit']||null:null,'include':_0x355ddc[_0xa66f('0x19')]?_0x355ddc[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x355ddc['options']['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x1c')],'include':_0xed98b9[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1f')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x1c')],'include':_0x4683c7[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x4683c7[_0xa66f('0x1d')],function(_0x1eb86a){return{'model':db[_0x1eb86a[_0xa66f('0x1f')]],'as':_0x1eb86a['as'],'attributes':_0x1eb86a[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xe')](function(_0x45f71c){logger[_0xa66f('0x15')](_0xa66f('0x16'),_0x355ddc);logger[_0xa66f('0x10')]('GetMailAccount',_0x355ddc,JSON['stringify'](_0x45f71c));_0x408bc7(_0x45f71c);})[_0xa66f('0x20')](function(_0x27ceae){logger['error'](_0xa66f('0x16'),_0x27ceae[_0xa66f('0x14')],_0x355ddc);_0x251f60(_0x2c5b76['error'](0x1f4,_0x27ceae[_0xa66f('0x14')]));});});};exports[_0xa66f('0x21')]=function(_0x9d78d5){var _0x2c2ace=this;return new Promise(function(_0x395623,_0x548add){return db[_0xa66f('0x17')]['find']({'raw':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1b')]||null:null,'attributes':_0x9d78d5['options']?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1c')]||null:null,'include':_0x9d78d5[_0xa66f('0x19')]?_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x1d')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1f')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1d')]?_['map'](_0x35ef27[_0xa66f('0x1d')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1f')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x1c')],'include':_0x46f6cc[_0xa66f('0x1d')]?_[_0xa66f('0x1e')](_0x46f6cc[_0xa66f('0x1d')],function(_0xcee582){return{'model':db[_0xcee582['model']],'as':_0xcee582['as'],'attributes':_0xcee582[_0xa66f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4477cf){if(_0x9d78d5[_0xa66f('0x19')][_0xa66f('0x22')]===!![])_0x4477cf['setDataValue']('smtpOptions',_0x4477cf[_0xa66f('0x23')]());logger[_0xa66f('0x15')](_0xa66f('0x21'),_0x9d78d5);logger[_0xa66f('0x10')](_0xa66f('0x21'),_0x9d78d5,JSON['stringify'](_0x4477cf));_0x395623(_0x4477cf);})['catch'](function(_0x49b869){logger[_0xa66f('0x13')]('ShowMailAccount',_0x49b869['message'],_0x9d78d5);_0x548add(_0x2c2ace['error'](0x1f4,_0x49b869[_0xa66f('0x14')]));});});};exports['NotifyMailAccount']=function(_0x8965d3){var _0x17d942=this;return new Promise(function(_0x23a546,_0x1647a0){var _0xd65c5d={'body':_0x8965d3[_0xa66f('0x24')],'channel':_0xa66f('0x25')};var _0x261089=_[_0xa66f('0x26')](_[_0xa66f('0x27')](db[_0xa66f('0x28')][_0xa66f('0x29')]),[_0xa66f('0x2a'),_0xa66f('0x2b'),'CompanyId',_0xa66f('0x2c')]);var _0x25c2cb=![];if(_0x8965d3['body']['id']){delete _0x8965d3[_0xa66f('0x24')]['id'];}if(_['isNil'](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')])){return _0x1647a0(_0x17d942['error'](0x1f4,_0xa66f('0x2e')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')]['body'])||_0x8965d3[_0xa66f('0x24')]['body']===''){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x30')));}if(_[_0xa66f('0x2f')](_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x32')+_0x261089));}if(!_['includes'](_0x261089,_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')])){return _0x1647a0(_0x17d942[_0xa66f('0x13')](0x1f4,_0xa66f('0x33')+_0x261089));}var _0x374e53={};_0x374e53[_0x8965d3['body']['mapKey']]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x17')][_0xa66f('0x34')]({'where':{'id':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x36')],'as':'List','include':[{'model':db[_0xa66f('0x28')],'as':_0xa66f('0x37'),'where':_0x374e53,'limit':0x1,'order':[[_0xa66f('0x2b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0xa66f('0x38')},{'model':db[_0xa66f('0x39')],'as':_0xa66f('0x3a'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x19e7ce){if(_0x19e7ce&&_0x19e7ce[_0xa66f('0x3b')]){var _0x40d3b6=_0x19e7ce[_0xa66f('0x3c')]({'plain':!![]});_0xd65c5d[_0xa66f('0x35')]=_[_0xa66f('0x3d')](_0x40d3b6,[_0xa66f('0x38'),_0xa66f('0x3b')]);_0xd65c5d['account'][_0xa66f('0x3e')]=_0x19e7ce[_0xa66f('0x23')]();_0xd65c5d[_0xa66f('0x3f')]=_0x40d3b6[_0xa66f('0x38')];_0xd65c5d[_0xa66f('0x40')]=_0x40d3b6[_0xa66f('0x3b')];_0xd65c5d['applications']=_[_0xa66f('0x41')](_0xd65c5d[_0xa66f('0x3f')],[_0xa66f('0x42')],[_0xa66f('0x43')]);if(_0xd65c5d[_0xa66f('0x35')]&&_0xd65c5d['account'][_0xa66f('0x44')]){_0xd65c5d['applications'][_0xa66f('0x45')]({'id':0x0,'priority':_0xd65c5d['applications']['length']+0x1,'app':_0xa66f('0x46'),'appdata':_0xa66f('0x44'),'interval':_0xa66f('0x47')});}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x38')]){delete _0xd65c5d[_0xa66f('0x35')]['Applications'];}if(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')]){delete _0xd65c5d[_0xa66f('0x35')][_0xa66f('0x3b')];}if(_0x40d3b6['List'][_0xa66f('0x37')]['length']){return _0x40d3b6[_0xa66f('0x3b')][_0xa66f('0x37')][0x0];}var _0x21482f=_[_0xa66f('0xa')](_0x8965d3[_0xa66f('0x24')],{'firstName':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')],'ListId':_0x40d3b6['ListId']});_0x21482f[_0x8965d3[_0xa66f('0x24')][_0xa66f('0x31')]]=_0x8965d3[_0xa66f('0x24')][_0xa66f('0x2d')];return db[_0xa66f('0x28')][_0xa66f('0x48')](_0x21482f);}else{throw new Error(_0xa66f('0x49'));}})[_0xa66f('0xe')](function(_0x350fce){_0xd65c5d['contact']=_0x350fce;if(_0x350fce){if(!_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')]){_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')]=rs[_0xa66f('0x4b')]()+'\x20'+_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x2d')];}var _0x11c89e={'ContactId':_0x350fce['id'],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'inReplyTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x4a')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3['body']['message'][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['attach'],'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'};return db[_0xa66f('0x4f')][_0xa66f('0x34')]({'where':{'closed':![],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id']},'include':[{'model':db[_0xa66f('0x50')],'as':_0xa66f('0x51'),'attributes':[_0xa66f('0x4a')],'where':{'messageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x52')]}}]})[_0xa66f('0xe')](function(_0x235e4f){if(_0x235e4f){return[_0x235e4f,![]];}return db[_0xa66f('0x4f')][_0xa66f('0x48')](_0x11c89e)[_0xa66f('0xe')](function(_0x41ffa7){return[_0x41ffa7,!![]];});});}else{throw new Error(_0xa66f('0x53'));}})['spread'](function(_0x52f22d,_0x46327d){if(_0x52f22d){_0x25c2cb=_0x46327d;if(!_0x46327d){return _0x52f22d[_0xa66f('0x54')]({'inReplyTo':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x4a')],'to':_0x8965d3['body'][_0xa66f('0x14')]['from'],'cc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['cc'],'subject':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['subject'],'attach':_0x52f22d[_0xa66f('0x55')]?_0x52f22d[_0xa66f('0x55')]:_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x55')],'substatus':null,'substatusAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgAt':moment()[_0xa66f('0x4d')](_0xa66f('0x4e')),'lastMsgDirection':'in'});}else{return _0x52f22d;}}})[_0xa66f('0xe')](function(_0x290323){_0xd65c5d[_0xa66f('0x56')]=_0x290323['get']({'plain':!![]});_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x57')]=_0x25c2cb;return db[_0xa66f('0x50')][_0xa66f('0x48')]({'body':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x24')],'MailAccountId':_0x8965d3[_0xa66f('0x35')]['id'],'MailInteractionId':_0x290323['id'],'direction':'in','ContactId':_0xd65c5d[_0xa66f('0x58')]['id'],'messageId':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4a')],'from':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x2d')],'to':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')]['to'],'cc':_0x8965d3[_0xa66f('0x24')]['message']['cc'],'subject':_0x8965d3['body'][_0xa66f('0x14')][_0xa66f('0x4c')],'attach':_0x8965d3[_0xa66f('0x24')]['message']['attach'],'Attachments':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x59')],'originTo':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5a')],'originCc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5b')],'bcc':_0x8965d3[_0xa66f('0x24')][_0xa66f('0x14')][_0xa66f('0x5c')],'ChatWebsiteId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5d')]||null,'originChannel':_0x8965d3[_0xa66f('0x24')]['message']['originChannel']||_0xa66f('0x5e'),'ChatOfflineMessageId':_0x8965d3[_0xa66f('0x24')]['message'][_0xa66f('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xa66f('0x60')}]});})['then'](function(_0x4feda0){_0xd65c5d['message']=_0x4feda0;if(_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]){return db[_0xa66f('0x62')][_0xa66f('0x34')]({'attributes':['id',_0xa66f('0x63')],'where':{'id':_0xd65c5d[_0xa66f('0x56')][_0xa66f('0x61')]}})[_0xa66f('0xe')](function(_0x1ee6e0){if(_0x1ee6e0){_0xd65c5d[_0xa66f('0x3f')][_0xa66f('0x64')]({'id':0x0,'priority':0x0,'app':_0xa66f('0x65'),'appdata':_0x1ee6e0[_0xa66f('0x63')]+','+(_0xd65c5d[_0xa66f('0x35')][_0xa66f('0x66')]||0xa),'interval':_0xa66f('0x47')});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);});}return respondWithRpcPromise('Start',_0xa66f('0x67'),_0xd65c5d);})['then'](function(_0xc4b32b){_0x23a546(_0xc4b32b);})[_0xa66f('0x20')](function(_0x2bb4e5){_0x1647a0(_0x17d942['error'](0x1f4,_0x2bb4e5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9a54d98..7a208b3 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 _0x6afd=['length','mailAccount:','save','remove','update','emit','removeListener','register'];(function(_0x5c61a9,_0x4b8ddb){var _0x7b0451=function(_0xb24e4c){while(--_0xb24e4c){_0x5c61a9['push'](_0x5c61a9['shift']());}};_0x7b0451(++_0x4b8ddb);}(_0x6afd,0x9a));var _0xd6af=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6afd[_0x8de54f];return _0x14cba4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xd6af('0x0'),_0xd6af('0x1'),_0xd6af('0x2')];function createListener(_0x4a35a4,_0x435c0f){return function(_0x39de8a){_0x435c0f[_0xd6af('0x3')](_0x4a35a4,_0x39de8a);};}function removeListener(_0x5e4286,_0x2ec2f5){return function(){MailAccountEvents[_0xd6af('0x4')](_0x5e4286,_0x2ec2f5);};}exports[_0xd6af('0x5')]=function(_0x565aaf){for(var _0x647903=0x0,_0x36fa8f=events[_0xd6af('0x6')];_0x647903<_0x36fa8f;_0x647903++){var _0x3610cc=events[_0x647903];var _0x1c28fb=createListener(_0xd6af('0x7')+_0x3610cc,_0x565aaf);MailAccountEvents['on'](_0x3610cc,_0x1c28fb);}}; \ No newline at end of file +var _0x5ed9=['removeListener','length','mailAccount:','./mailAccount.events','save','update'];(function(_0x1d2d9c,_0x9e3088){var _0x51edc7=function(_0x4f07c7){while(--_0x4f07c7){_0x1d2d9c['push'](_0x1d2d9c['shift']());}};_0x51edc7(++_0x9e3088);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5ed9[_0x465028];return _0xb783d4;};'use strict';var MailAccountEvents=require(_0x95ed('0x0'));var events=[_0x95ed('0x1'),'remove',_0x95ed('0x2')];function createListener(_0x1b57c3,_0x112ccd){return function(_0x442a6f){_0x112ccd['emit'](_0x1b57c3,_0x442a6f);};}function removeListener(_0x3cb5d1,_0x991cf8){return function(){MailAccountEvents[_0x95ed('0x3')](_0x3cb5d1,_0x991cf8);};}exports['register']=function(_0x2c9009){for(var _0x5a5117=0x0,_0x32bf25=events[_0x95ed('0x4')];_0x5a5117<_0x32bf25;_0x5a5117++){var _0x3753b5=events[_0x5a5117];var _0x1df51f=createListener(_0x95ed('0x5')+_0x3753b5,_0x2c9009);MailAccountEvents['on'](_0x3753b5,_0x1df51f);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 159a673..835e521 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 _0x9281=['/:id','isAuthenticated','update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x9281,0xc6));var _0x1928=function(_0x351c33,_0x15cae6){_0x351c33=_0x351c33-0x0;var _0x66b8fd=_0x9281[_0x351c33];return _0x66b8fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1928('0x0'));var timeout=require(_0x1928('0x1'));var express=require(_0x1928('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1928('0x3'));var config=require(_0x1928('0x4'));var controller=require('./mailApplication.controller');router[_0x1928('0x5')](_0x1928('0x6'),auth[_0x1928('0x7')](),controller['show']);router['put'](_0x1928('0x6'),auth[_0x1928('0x7')](),controller[_0x1928('0x8')]);router[_0x1928('0x9')](_0x1928('0x6'),auth[_0x1928('0x7')](),controller[_0x1928('0xa')]);module[_0x1928('0xb')]=router; \ No newline at end of file +var _0x8d5a=['update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated'];(function(_0x5f2cc0,_0x21bed2){var _0x37035d=function(_0x31c766){while(--_0x31c766){_0x5f2cc0['push'](_0x5f2cc0['shift']());}};_0x37035d(++_0x21bed2);}(_0x8d5a,0x189));var _0xa8d5=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x8d5a[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var path=require(_0xa8d5('0x2'));var timeout=require(_0xa8d5('0x3'));var express=require('express');var router=express[_0xa8d5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8d5('0x5'));var config=require(_0xa8d5('0x6'));var controller=require(_0xa8d5('0x7'));router['get'](_0xa8d5('0x8'),auth['isAuthenticated'](),controller['show']);router['put'](_0xa8d5('0x8'),auth[_0xa8d5('0x9')](),controller[_0xa8d5('0xa')]);router[_0xa8d5('0xb')]('/:id',auth[_0xa8d5('0x9')](),controller['destroy']);module[_0xa8d5('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 47c4c54..6fb9848 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 _0x038f=['INTEGER','STRING','noop'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038f,0x93));var _0xf038=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x038f[_0x2300c7];return _0x23f720;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xf038('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xf038('0x1')],'allowNull':![],'defaultValue':_0xf038('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf038('0x1')]},'interval':{'type':Sequelize[_0xf038('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd39a=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x43d859,_0x2b8283){var _0x4c8590=function(_0x369a71){while(--_0x369a71){_0x43d859['push'](_0x43d859['shift']());}};_0x4c8590(++_0x2b8283);}(_0xd39a,0x120));var _0xad39=function(_0x107f31,_0x1bcd53){_0x107f31=_0x107f31-0x0;var _0x10560c=_0xd39a[_0x107f31];return _0x10560c;};'use strict';var Sequelize=require(_0xad39('0x0'));module[_0xad39('0x1')]={'priority':{'type':Sequelize[_0xad39('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xad39('0x3')],'allowNull':![],'defaultValue':_0xad39('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xad39('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xad39('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e79bb40..b90434c 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x3c2a3a,_0x23b601){var _0x3c5e96=function(_0x3f691b){while(--_0x3f691b){_0x3c2a3a['push'](_0x3c2a3a['shift']());}};_0x3c5e96(++_0x23b601);}(_0x70e0,0x17b));var _0x070e=function(_0x5db4c8,_0x46462a){_0x5db4c8=_0x5db4c8-0x0;var _0x27d8c2=_0x70e0[_0x5db4c8];return _0x27d8c2;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0xe6e3e2,_0x2b01da){var _0x126571=function(_0x515ab3){while(--_0x515ab3){_0xe6e3e2['push'](_0xe6e3e2['shift']());}};_0x126571(++_0x2b01da);}(_0xe706,0xa3));var _0x6e70=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0xe706[_0x25d4ee];return _0x214a35;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1e7bb8a..fe0dd56 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 _0xa465=['utf8mb4','util','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','define','MailApplication'];(function(_0xd4fe09,_0x23084c){var _0x23ef4e=function(_0xed58c){while(--_0xed58c){_0xd4fe09['push'](_0xd4fe09['shift']());}};_0x23ef4e(++_0x23084c);}(_0xa465,0x19b));var _0x5a46=function(_0x490014,_0x519ad6){_0x490014=_0x490014-0x0;var _0x289bee=_0xa465[_0x490014];return _0x289bee;};'use strict';var _=require('lodash');var util=require(_0x5a46('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5a46('0x1'));var BPromise=require(_0x5a46('0x2'));var rp=require(_0x5a46('0x3'));var fs=require('fs');var path=require(_0x5a46('0x4'));var rimraf=require(_0x5a46('0x5'));var config=require('../../config/environment');var attributes=require(_0x5a46('0x6'));module['exports']=function(_0x5c2592,_0x53bc21){return _0x5c2592[_0x5a46('0x7')](_0x5a46('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a46('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6819=['lodash','util','../../config/logger','api','bluebird','request-promise','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6819,0x108));var _0x9681=function(_0x382b67,_0xf59040){_0x382b67=_0x382b67-0x0;var _0x2483e1=_0x6819[_0x382b67];return _0x2483e1;};'use strict';var _=require(_0x9681('0x0'));var util=require(_0x9681('0x1'));var logger=require(_0x9681('0x2'))(_0x9681('0x3'));var moment=require('moment');var BPromise=require(_0x9681('0x4'));var rp=require(_0x9681('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x9681('0x6')]=function(_0x193b41,_0x31b070){return _0x193b41[_0x9681('0x7')](_0x9681('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9681('0x9'),'collate':_0x9681('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ae2a815..d7b58d8 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 _0x78d8=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailApplication','MailApplication','update','options','raw','where','attributes','limit','lodash','util'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x78d8,0x120));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var moment=require(_0x878d('0x2'));var BPromise=require(_0x878d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x878d('0x4'));var db=require(_0x878d('0x5'))['db'];var utils=require(_0x878d('0x6'));var logger=require('../../config/logger')(_0x878d('0x7'));var config=require(_0x878d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x878d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd5ef,_0x2af687,_0x481890){return new BPromise(function(_0x2a9ef0,_0x2a71f7){return client[_0x878d('0xa')](_0x5bd5ef,_0x481890)[_0x878d('0xb')](function(_0x5ae164){logger['info'](_0x878d('0xc'),_0x2af687,_0x878d('0xd'));logger[_0x878d('0xe')](_0x878d('0xf'),_0x2af687,_0x878d('0xd'),JSON[_0x878d('0x10')](_0x5ae164));if(_0x5ae164[_0x878d('0x11')]){if(_0x5ae164[_0x878d('0x11')]['code']===0x1f4){logger[_0x878d('0x11')]('MailApplication,\x20%s,\x20%s',_0x2af687,_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);return _0x2a71f7(_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);}logger['error'](_0x878d('0xc'),_0x2af687,_0x5ae164['error']['message']);return _0x2a9ef0(_0x5ae164[_0x878d('0x11')][_0x878d('0x12')]);}else{logger[_0x878d('0x13')]('MailApplication,\x20%s,\x20%s',_0x2af687,_0x878d('0xd'));_0x2a9ef0(_0x5ae164['result'][_0x878d('0x12')]);}})[_0x878d('0x14')](function(_0x4fe893){logger[_0x878d('0x11')](_0x878d('0xc'),_0x2af687,_0x4fe893);_0x2a71f7(_0x4fe893);});});}exports[_0x878d('0x15')]=function(_0x5e6cde){var _0x2ceec7=this;return new Promise(function(_0x11944a,_0x26d59b){return db[_0x878d('0x16')][_0x878d('0x17')](_0x5e6cde['body'],{'raw':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde[_0x878d('0x18')][_0x878d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde['options'][_0x878d('0x1a')]||null:null,'attributes':_0x5e6cde['options']?_0x5e6cde[_0x878d('0x18')][_0x878d('0x1b')]||null:null,'limit':_0x5e6cde[_0x878d('0x18')]?_0x5e6cde[_0x878d('0x18')][_0x878d('0x1c')]||null:null})[_0x878d('0xb')](function(_0x5884fb){logger[_0x878d('0x13')](_0x878d('0x15'),_0x5e6cde);logger[_0x878d('0xe')]('UpdateMailApplication',_0x5e6cde,JSON[_0x878d('0x10')](_0x5884fb));_0x11944a(_0x5884fb);})[_0x878d('0x14')](function(_0xc24b1d){logger['error']('UpdateMailApplication',_0xc24b1d[_0x878d('0x12')],_0x5e6cde);_0x26d59b(_0x2ceec7[_0x878d('0x11')](0x1f4,_0xc24b1d[_0x878d('0x12')]));});});}; \ No newline at end of file +var _0x68a5=['code','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x85905d,_0x4cf958){var _0x230487=function(_0x171c67){while(--_0x171c67){_0x85905d['push'](_0x85905d['shift']());}};_0x230487(++_0x4cf958);}(_0x68a5,0xe3));var _0x568a=function(_0x8925c7,_0xeca9ca){_0x8925c7=_0x8925c7-0x0;var _0x4dd37c=_0x68a5[_0x8925c7];return _0x4dd37c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x568a('0x0'));var fs=require('fs');var Redis=require(_0x568a('0x1'));var db=require(_0x568a('0x2'))['db'];var utils=require(_0x568a('0x3'));var logger=require(_0x568a('0x4'))(_0x568a('0x5'));var config=require(_0x568a('0x6'));var jayson=require(_0x568a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2353e3,_0x5443b4,_0x2b6415){return new BPromise(function(_0x14ea1a,_0x1e7041){return client[_0x568a('0x8')](_0x2353e3,_0x2b6415)[_0x568a('0x9')](function(_0x11fb5d){logger[_0x568a('0xa')](_0x568a('0xb'),_0x5443b4,_0x568a('0xc'));logger[_0x568a('0xd')](_0x568a('0xe'),_0x5443b4,_0x568a('0xc'),JSON['stringify'](_0x11fb5d));if(_0x11fb5d[_0x568a('0xf')]){if(_0x11fb5d[_0x568a('0xf')][_0x568a('0x10')]===0x1f4){logger[_0x568a('0xf')](_0x568a('0xb'),_0x5443b4,_0x11fb5d[_0x568a('0xf')][_0x568a('0x11')]);return _0x1e7041(_0x11fb5d[_0x568a('0xf')][_0x568a('0x11')]);}logger['error'](_0x568a('0xb'),_0x5443b4,_0x11fb5d[_0x568a('0xf')][_0x568a('0x11')]);return _0x14ea1a(_0x11fb5d[_0x568a('0xf')][_0x568a('0x11')]);}else{logger[_0x568a('0xa')](_0x568a('0xb'),_0x5443b4,_0x568a('0xc'));_0x14ea1a(_0x11fb5d['result'][_0x568a('0x11')]);}})[_0x568a('0x12')](function(_0x44a69f){logger[_0x568a('0xf')](_0x568a('0xb'),_0x5443b4,_0x44a69f);_0x1e7041(_0x44a69f);});});}exports[_0x568a('0x13')]=function(_0x211ee3){var _0x54d02e=this;return new Promise(function(_0x4fc85c,_0x238003){return db[_0x568a('0x14')][_0x568a('0x15')](_0x211ee3[_0x568a('0x16')],{'raw':_0x211ee3[_0x568a('0x17')]?_0x211ee3['options'][_0x568a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x211ee3['options']?_0x211ee3[_0x568a('0x17')][_0x568a('0x19')]||null:null,'attributes':_0x211ee3['options']?_0x211ee3[_0x568a('0x17')]['attributes']||null:null,'limit':_0x211ee3['options']?_0x211ee3['options'][_0x568a('0x1a')]||null:null})['then'](function(_0xb2615a){logger[_0x568a('0xa')](_0x568a('0x13'),_0x211ee3);logger[_0x568a('0xd')](_0x568a('0x13'),_0x211ee3,JSON['stringify'](_0xb2615a));_0x4fc85c(_0xb2615a);})['catch'](function(_0x2b23b8){logger[_0x568a('0xf')](_0x568a('0x13'),_0x2b23b8['message'],_0x211ee3);_0x238003(_0x54d02e[_0x568a('0xf')](0x1f4,_0x2b23b8[_0x568a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index c430dc2..f5177c1 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 _0x08ce=['Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports'];(function(_0x3d4f79,_0x43c681){var _0x390012=function(_0x353cc2){while(--_0x353cc2){_0x3d4f79['push'](_0x3d4f79['shift']());}};_0x390012(++_0x43c681);}(_0x08ce,0xbd));var _0xe08c=function(_0x2fdd18,_0x21f7cb){_0x2fdd18=_0x2fdd18-0x0;var _0x1c0217=_0x08ce[_0x2fdd18];return _0x1c0217;};'use strict';var express=require('express');var router=express[_0xe08c('0x0')]();var auth=require(_0xe08c('0x1'));var interaction=require(_0xe08c('0x2'));var controller=require('./mailInteraction.controller');router[_0xe08c('0x3')]('/',auth['isAuthenticated'](),controller[_0xe08c('0x4')]);router[_0xe08c('0x3')](_0xe08c('0x5'),auth[_0xe08c('0x6')](),controller['describe']);router[_0xe08c('0x3')](_0xe08c('0x7'),auth[_0xe08c('0x6')](),controller[_0xe08c('0x8')]);router['get'](_0xe08c('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe08c('0x3')](_0xe08c('0xa'),auth['isAuthenticated'](),controller[_0xe08c('0xb')]);router[_0xe08c('0xc')]('/',auth[_0xe08c('0x6')](),controller[_0xe08c('0xd')]);router['post'](_0xe08c('0x9'),auth[_0xe08c('0x6')](),controller[_0xe08c('0xe')]);router[_0xe08c('0xc')](_0xe08c('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xe08c('0x10'),_0xe08c('0x11')),controller[_0xe08c('0x12')]);router[_0xe08c('0x13')](_0xe08c('0x7'),auth[_0xe08c('0x6')](),interaction[_0xe08c('0x14')](_0xe08c('0x10'),_0xe08c('0x15')),controller[_0xe08c('0x16')]);router[_0xe08c('0x17')](_0xe08c('0x7'),auth['isAuthenticated'](),interaction[_0xe08c('0x14')](_0xe08c('0x10'),_0xe08c('0x18')),controller[_0xe08c('0x19')]);router[_0xe08c('0x17')](_0xe08c('0xf'),auth[_0xe08c('0x6')](),controller['removeTags']);module[_0xe08c('0x1a')]=router; \ No newline at end of file +var _0x1a1f=['mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','tracked','mail'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0x1a1f,0x11c));var _0xf1a1=function(_0x5436b9,_0x1d5c57){_0x5436b9=_0x5436b9-0x0;var _0x452d97=_0x1a1f[_0x5436b9];return _0x452d97;};'use strict';var express=require(_0xf1a1('0x0'));var router=express['Router']();var auth=require(_0xf1a1('0x1'));var interaction=require(_0xf1a1('0x2'));var controller=require(_0xf1a1('0x3'));router[_0xf1a1('0x4')]('/',auth[_0xf1a1('0x5')](),controller['index']);router[_0xf1a1('0x4')](_0xf1a1('0x6'),auth[_0xf1a1('0x5')](),controller[_0xf1a1('0x7')]);router['get'](_0xf1a1('0x8'),auth['isAuthenticated'](),controller[_0xf1a1('0x9')]);router[_0xf1a1('0x4')](_0xf1a1('0xa'),auth[_0xf1a1('0x5')](),controller[_0xf1a1('0xb')]);router[_0xf1a1('0x4')]('/:id/download',auth[_0xf1a1('0x5')](),controller['download']);router[_0xf1a1('0xc')]('/',auth[_0xf1a1('0x5')](),controller[_0xf1a1('0xd')]);router[_0xf1a1('0xc')](_0xf1a1('0xa'),auth[_0xf1a1('0x5')](),controller['addMessage']);router['post']('/:id/tags',auth[_0xf1a1('0x5')](),interaction[_0xf1a1('0xe')](_0xf1a1('0xf'),_0xf1a1('0x10')),controller[_0xf1a1('0x11')]);router[_0xf1a1('0x12')]('/:id',auth['isAuthenticated'](),interaction[_0xf1a1('0xe')](_0xf1a1('0xf'),_0xf1a1('0x13')),controller[_0xf1a1('0x14')]);router[_0xf1a1('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked']('mail',_0xf1a1('0x16')),controller[_0xf1a1('0x17')]);router[_0xf1a1('0x15')]('/:id/tags',auth[_0xf1a1('0x5')](),controller['removeTags']);module[_0xf1a1('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8601ca1..aa38d31 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 _0x93f5=['TEXT','long','ENUM','out','sequelize','BOOLEAN','DATE','STRING'];(function(_0x356a7e,_0x1d1abc){var _0xe84f52=function(_0x3286cc){while(--_0x3286cc){_0x356a7e['push'](_0x356a7e['shift']());}};_0xe84f52(++_0x1d1abc);}(_0x93f5,0x10c));var _0x593f=function(_0xff86f5,_0x1ffa07){_0xff86f5=_0xff86f5-0x0;var _0x4ac851=_0x93f5[_0xff86f5];return _0x4ac851;};'use strict';var Sequelize=require(_0x593f('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x593f('0x2')]},'disposition':{'type':Sequelize[_0x593f('0x3')]},'secondDisposition':{'type':Sequelize[_0x593f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x593f('0x3')]},'note':{'type':Sequelize[_0x593f('0x3')]},'inReplyTo':{'type':Sequelize[_0x593f('0x3')](0x1fe)},'to':{'type':Sequelize[_0x593f('0x3')]},'cc':{'type':Sequelize[_0x593f('0x4')](_0x593f('0x5'))},'subject':{'type':Sequelize[_0x593f('0x4')]()},'attach':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x593f('0x2')]},'substatus':{'type':Sequelize[_0x593f('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x593f('0x6')]('in',_0x593f('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x593f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x593f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x593f('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x8509=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','iconv'];(function(_0x21a92d,_0xc931dd){var _0x1c9196=function(_0x255e6e){while(--_0x255e6e){_0x21a92d['push'](_0x21a92d['shift']());}};_0x1c9196(++_0xc931dd);}(_0x8509,0x1c1));var _0x9850=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x8509[_0x349a9e];return _0x24c207;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x9850('0x0'));module[_0x9850('0x1')]={'closed':{'type':Sequelize[_0x9850('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9850('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9850('0x4')]},'note':{'type':Sequelize[_0x9850('0x4')]},'inReplyTo':{'type':Sequelize[_0x9850('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9850('0x5')](_0x9850('0x6'))},'subject':{'type':Sequelize[_0x9850('0x5')]()},'attach':{'type':Sequelize[_0x9850('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9850('0x3')]},'substatus':{'type':Sequelize[_0x9850('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x9850('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9850('0x7')]('in',_0x9850('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9850('0x7')]('in',_0x9850('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9850('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 7a007ec..978f1e7 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 _0x5512=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','body','describe','addMessage','MailMessage','getMessages','findOne','nolimit','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','rows','setTags','ids','omit','spread','color','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','createdAt','sort','get','mkdirSync','each','from','missing.recipient@your.company.com','decode','headers','Bcc','Attachments','basename','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','end','status','json'];(function(_0x3ba466,_0x58e1a5){var _0x5065c8=function(_0x5cf367){while(--_0x5cf367){_0x3ba466['push'](_0x3ba466['shift']());}};_0x5065c8(++_0x58e1a5);}(_0x5512,0xcf));var _0x2551=function(_0x48c785,_0xd2bc23){_0x48c785=_0x48c785-0x0;var _0xa67dda=_0x5512[_0x48c785];return _0xa67dda;};'use strict';var emlformat=require(_0x2551('0x0'));var rimraf=require(_0x2551('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2551('0x2'));var BPromise=require(_0x2551('0x3'));var util=require(_0x2551('0x4'));var path=require(_0x2551('0x5'));var fs=require('fs');var _=require(_0x2551('0x6'));var juice=require(_0x2551('0x7'));var Redis=require(_0x2551('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0x2551('0x9'));var logger=require(_0x2551('0xa'))(_0x2551('0xb'));var config=require(_0x2551('0xc'));var db=require(_0x2551('0xd'))['db'];var htmlEntities=require(_0x2551('0xe'));config[_0x2551('0xf')]=_[_0x2551('0x10')](config[_0x2551('0xf')],{'host':_0x2551('0x11'),'port':0x18eb});var socket=require(_0x2551('0x12'))(new Redis(config[_0x2551('0xf')]));require(_0x2551('0x13'))['register'](socket);function respondWithStatusCode(_0x21cf10,_0x314222){_0x314222=_0x314222||0xcc;return function(_0x2ad6dd){if(_0x2ad6dd){return _0x21cf10['sendStatus'](_0x314222);}return _0x21cf10['status'](_0x314222)[_0x2551('0x14')]();};}function respondWithResult(_0x2195c9,_0x209394){_0x209394=_0x209394||0xc8;return function(_0x2663a9){if(_0x2663a9){return _0x2195c9[_0x2551('0x15')](_0x209394)[_0x2551('0x16')](_0x2663a9);}};}function respondWithFilteredResult(_0x10625c,_0x4584ab){return function(_0x13f6b6){if(_0x13f6b6){var _0xf1b6c2=typeof _0x4584ab[_0x2551('0x17')]===_0x2551('0x18')&&typeof _0x4584ab[_0x2551('0x19')]===_0x2551('0x18');var _0x3695a2=_0x13f6b6[_0x2551('0x1a')];var _0x5449d6=_0xf1b6c2?0x0:_0x4584ab[_0x2551('0x17')];var _0x255219=_0xf1b6c2?_0x13f6b6[_0x2551('0x1a')]:_0x4584ab[_0x2551('0x17')]+_0x4584ab[_0x2551('0x19')];var _0x24f9e5;if(_0x255219>=_0x3695a2){_0x255219=_0x3695a2;_0x24f9e5=0xc8;}else{_0x24f9e5=0xce;}_0x10625c[_0x2551('0x15')](_0x24f9e5);return _0x10625c[_0x2551('0x1b')](_0x2551('0x1c'),_0x5449d6+'-'+_0x255219+'/'+_0x3695a2)[_0x2551('0x16')](_0x13f6b6);}return null;};}function saveUpdates(_0x6c01f7){return function(_0x38ec1f){if(_0x38ec1f){return _0x38ec1f[_0x2551('0x1d')](_0x6c01f7)[_0x2551('0x1e')](function(_0x22437e){return _0x22437e;});}return null;};}function removeEntity(_0x371805){return function(_0x1b12f2){if(_0x1b12f2){return _0x1b12f2[_0x2551('0x1f')]()['then'](function(){_0x371805[_0x2551('0x15')](0xcc)[_0x2551('0x14')]();});}};}function handleEntityNotFound(_0x3237cf){return function(_0xe3077b){if(!_0xe3077b){_0x3237cf[_0x2551('0x20')](0x194);}return _0xe3077b;};}function handleError(_0x589e4d,_0x30088b){_0x30088b=_0x30088b||0x1f4;return function(_0x2162f1){logger[_0x2551('0x21')](_0x2162f1[_0x2551('0x22')]);if(_0x2162f1[_0x2551('0x23')]){delete _0x2162f1[_0x2551('0x23')];}_0x589e4d['status'](_0x30088b)['send'](_0x2162f1);};}exports['index']=function(_0x3d633e,_0x20f2cc){var _0x4a7d9d={};var _0x4d4f31=_[_0x2551('0x24')](db[_0x2551('0x25')][_0x2551('0x26')],function(_0x12d488){return{'name':_0x12d488[_0x2551('0x27')],'type':_0x12d488[_0x2551('0x28')][_0x2551('0x29')]};});_0x4a7d9d=qs['getOptions'](_0x4d4f31,_0x3d633e);return interaction[_0x2551('0x2a')]('mail',_0x3d633e[_0x2551('0x2b')],_0x3d633e['user'],_0x4a7d9d,_0x4d4f31)[_0x2551('0x1e')](respondWithFilteredResult(_0x20f2cc,_0x4a7d9d))[_0x2551('0x2c')](handleError(_0x20f2cc,null));};exports[_0x2551('0x2d')]=function(_0x55e6d0,_0x61c438){var _0x5cd07a={'raw':![],'where':{'id':_0x55e6d0[_0x2551('0x2e')]['id']}},_0x5ca680={};_0x5ca680[_0x2551('0x2f')]=_[_0x2551('0x30')](db[_0x2551('0x25')]['rawAttributes']);_0x5ca680['query']=_[_0x2551('0x30')](_0x55e6d0['query']);_0x5ca680[_0x2551('0x31')]=_['intersection'](_0x5ca680['model'],_0x5ca680[_0x2551('0x2b')]);_0x5cd07a['attributes']=_[_0x2551('0x32')](_0x5ca680[_0x2551('0x2f')],qs[_0x2551('0x33')](_0x55e6d0[_0x2551('0x2b')][_0x2551('0x33')]));_0x5cd07a[_0x2551('0x34')]=_0x5cd07a[_0x2551('0x34')][_0x2551('0x35')]?_0x5cd07a[_0x2551('0x34')]:_0x5ca680[_0x2551('0x2f')];if(_0x55e6d0[_0x2551('0x2b')][_0x2551('0x36')]){_0x5cd07a[_0x2551('0x37')]=[{'all':!![]}];}_0x5cd07a=_[_0x2551('0x38')]({},_0x5cd07a,_0x55e6d0[_0x2551('0x39')]);return db['MailInteraction'][_0x2551('0x3a')](_0x5cd07a)[_0x2551('0x1e')](handleEntityNotFound(_0x61c438,null))[_0x2551('0x1e')](respondWithResult(_0x61c438,null))['catch'](handleError(_0x61c438,null));};exports['create']=function(_0x4ce055,_0x9fc065){return db[_0x2551('0x25')]['create'](_0x4ce055[_0x2551('0x3b')],{})[_0x2551('0x1e')](respondWithResult(_0x9fc065,0xc9))[_0x2551('0x2c')](handleError(_0x9fc065,null));};exports[_0x2551('0x1d')]=function(_0x228aa1,_0x14dd5f){if(_0x228aa1[_0x2551('0x3b')]['id']){delete _0x228aa1[_0x2551('0x3b')]['id'];}return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x228aa1[_0x2551('0x2e')]['id']}})['then'](handleEntityNotFound(_0x14dd5f,null))[_0x2551('0x1e')](saveUpdates(_0x228aa1['body'],null))[_0x2551('0x1e')](respondWithResult(_0x14dd5f,null))['catch'](handleError(_0x14dd5f,null));};exports[_0x2551('0x1f')]=function(_0x2cbd22,_0xdc81ec){return db['MailInteraction'][_0x2551('0x3a')]({'where':{'id':_0x2cbd22['params']['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0xdc81ec,null))['then'](removeEntity(_0xdc81ec,null))[_0x2551('0x2c')](handleError(_0xdc81ec,null));};exports[_0x2551('0x3c')]=function(_0x21d4e3,_0x25d300){return db[_0x2551('0x25')][_0x2551('0x3c')]()['then'](respondWithResult(_0x25d300,null))[_0x2551('0x2c')](handleError(_0x25d300,null));};exports[_0x2551('0x3d')]=function(_0x240f1c,_0x6f69b5){return db[_0x2551('0x3e')][_0x2551('0x3a')]({'where':{'id':_0x240f1c[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x6f69b5,null))[_0x2551('0x1e')](function(_0x5ddeac){if(_0x5ddeac){return _0x5ddeac['addMessage'](_0x240f1c['body']['ids'],_['omit'](_0x240f1c[_0x2551('0x3b')],['ids','id'])||{});}})[_0x2551('0x1e')](respondWithResult(_0x6f69b5,null))[_0x2551('0x2c')](handleError(_0x6f69b5,null));};exports[_0x2551('0x3f')]=function(_0x2603e3,_0x2396d3){var _0x10a95a={'raw':![],'where':{}};var _0x2ebbff={};var _0x436596={'count':0x0,'rows':[]};return db[_0x2551('0x25')][_0x2551('0x40')]({'where':{'id':_0x2603e3[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x2396d3,null))['then'](function(_0x499a5e){if(_0x499a5e){_0x2ebbff[_0x2551('0x2f')]=_[_0x2551('0x30')](db[_0x2551('0x3e')][_0x2551('0x26')]);_0x2ebbff[_0x2551('0x2b')]=_['keys'](_0x2603e3[_0x2551('0x2b')]);_0x2ebbff['filters']=_['intersection'](_0x2ebbff[_0x2551('0x2f')],_0x2ebbff[_0x2551('0x2b')]);_0x10a95a[_0x2551('0x34')]=_[_0x2551('0x32')](_0x2ebbff['model'],qs['fields'](_0x2603e3[_0x2551('0x2b')][_0x2551('0x33')]));_0x10a95a['attributes']=_0x10a95a[_0x2551('0x34')][_0x2551('0x35')]?_0x10a95a[_0x2551('0x34')]:_0x2ebbff[_0x2551('0x2f')];if(!_0x2603e3[_0x2551('0x2b')]['hasOwnProperty'](_0x2551('0x41'))){_0x10a95a[_0x2551('0x19')]=qs[_0x2551('0x19')](_0x2603e3[_0x2551('0x2b')][_0x2551('0x19')]);_0x10a95a['offset']=qs['offset'](_0x2603e3[_0x2551('0x2b')][_0x2551('0x17')]);}_0x10a95a['order']=qs['sort'](_0x2603e3[_0x2551('0x2b')]['sort']);_0x10a95a[_0x2551('0x42')]=qs[_0x2551('0x31')](_[_0x2551('0x43')](_0x2603e3[_0x2551('0x2b')],_0x2ebbff[_0x2551('0x31')]));_0x10a95a['where'][_0x2551('0x44')]=_0x499a5e['id'];if(_0x2603e3['query']['filter']){_0x10a95a[_0x2551('0x42')]=_[_0x2551('0x38')](_0x10a95a[_0x2551('0x42')],{'$or':_[_0x2551('0x24')](_0x10a95a['attributes'],function(_0x364843){var _0x153668={};_0x153668[_0x364843]={'$like':'%'+_0x2603e3[_0x2551('0x2b')][_0x2551('0x45')]+'%'};return _0x153668;})});}if(_0x2603e3[_0x2551('0x2b')][_0x2551('0x46')]){var _0xfe83bd=_0x2603e3['query'][_0x2551('0x46')][_0x2551('0x47')](',');var _0x1ad126={};_0x1ad126[_0xfe83bd[0x0]]={'$gte':moment(_0xfe83bd[0x1])['format'](_0x2551('0x48'))};_0x10a95a[_0x2551('0x42')]=_[_0x2551('0x38')](_0x10a95a[_0x2551('0x42')],_0x1ad126);}_0x10a95a=_[_0x2551('0x38')]({},_0x10a95a,_0x2603e3[_0x2551('0x39')]);return db[_0x2551('0x3e')][_0x2551('0x1a')]({'where':_0x10a95a['where']})[_0x2551('0x1e')](function(_0x1799b6){_0x436596[_0x2551('0x1a')]=_0x1799b6;if(_0x2603e3['query'][_0x2551('0x36')]){_0x10a95a[_0x2551('0x37')]=[{'all':!![]}];}return db[_0x2551('0x3e')][_0x2551('0x2a')](_0x10a95a);})['then'](function(_0x1d596f){if(_0x2603e3[_0x2551('0x2b')]['inlineCss']===_0x2551('0x49')){for(var _0x47145f=0x0;_0x47145f<_0x1d596f['length'];_0x47145f++){_0x1d596f[_0x47145f]['body']=juice(_0x1d596f[_0x47145f][_0x2551('0x3b')]);}}_0x436596[_0x2551('0x4a')]=_0x1d596f;return _0x436596;});}})[_0x2551('0x1e')](respondWithFilteredResult(_0x2396d3,_0x10a95a))[_0x2551('0x2c')](handleError(_0x2396d3,null));};exports['addTags']=function(_0x50e360,_0x2a0b05){return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x50e360[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0x2a0b05,null))['then'](function(_0xe2ebc4){if(_0xe2ebc4){return _0xe2ebc4[_0x2551('0x4b')](_0x50e360['body'][_0x2551('0x4c')],_[_0x2551('0x4d')](_0x50e360['body'],[_0x2551('0x4c'),'id'])||{})[_0x2551('0x4e')](function(){return db['Tag'][_0x2551('0x2a')]({'attributes':['id',_0x2551('0x23'),_0x2551('0x4f')],'where':{'id':_0x50e360[_0x2551('0x3b')]['ids']}});})[_0x2551('0x1e')](function(_0x203b7f){socket['emit'](_0x2551('0x50'),{'id':Number(_0x50e360[_0x2551('0x2e')]['id']),'tags':_0x203b7f||[]});return{'id':Number(_0x50e360[_0x2551('0x2e')]['id']),'tags':_0x203b7f||[]};});}})[_0x2551('0x1e')](respondWithResult(_0x2a0b05,null))[_0x2551('0x2c')](handleError(_0x2a0b05,null));};exports[_0x2551('0x51')]=function(_0x3168a8,_0xca515){return db[_0x2551('0x25')][_0x2551('0x3a')]({'where':{'id':_0x3168a8[_0x2551('0x2e')]['id']}})[_0x2551('0x1e')](handleEntityNotFound(_0xca515,null))['then'](function(_0x27e583){if(_0x27e583){return _0x27e583[_0x2551('0x51')](_0x3168a8['query'][_0x2551('0x4c')]);}})[_0x2551('0x1e')](respondWithStatusCode(_0xca515,null))[_0x2551('0x2c')](handleError(_0xca515,null));};exports[_0x2551('0x52')]=function(_0x269d43,_0x3ceb7f){var _0x9837e4=moment()[_0x2551('0x53')]()[_0x2551('0x54')]();var _0xa14382=path['join'](config[_0x2551('0x55')],_0x2551('0x56'),_0x2551('0x57'),_0x2551('0x58'));var _0xeac406=path['join'](config[_0x2551('0x55')],_0x2551('0x56'),_0x2551('0x57'),_0x2551('0x59'));var _0x4aa000=path[_0x2551('0x5a')](_0xa14382,_0x9837e4);var _0x84eb2d=util[_0x2551('0x5b')](_0x2551('0x5c'),_0x269d43[_0x2551('0x2e')]['id'],_0x9837e4);var _0x5ed6a8=path[_0x2551('0x5a')](_0xa14382,_0x84eb2d);var _0x488eee=[];if(_0x269d43[_0x2551('0x2b')]['attachments']){_0x488eee[_0x2551('0x5d')]({'model':db[_0x2551('0x5e')],'as':'Attachments','raw':!![]});}var _0x4f1dc8=[{'model':db['MailMessage'],'as':_0x2551('0x5f'),'attributes':['id',_0x2551('0x3b'),'from','to','cc',_0x2551('0x60'),_0x2551('0x61'),_0x2551('0x62')],'where':{'secret':![]},'order':qs[_0x2551('0x63')]('id'),'include':_0x488eee}];return db[_0x2551('0x25')]['find']({'where':{'id':_0x269d43[_0x2551('0x2e')]['id']},'include':_0x4f1dc8})[_0x2551('0x1e')](handleEntityNotFound(_0x3ceb7f,null))[_0x2551('0x1e')](function(_0x3b0339){if(_0x3b0339&&_0x3b0339['Messages']){var _0x363a8e=_0x3b0339[_0x2551('0x64')]({'plain':!![]});fs[_0x2551('0x65')](_0x4aa000);return BPromise[_0x2551('0x66')](_0x363a8e[_0x2551('0x5f')],function(_0xd6cf9c,_0x5636cc){var _0x1561e7={'from':_0xd6cf9c[_0x2551('0x67')],'to':_0xd6cf9c['to']||_0x2551('0x68'),'subject':_0xd6cf9c['subject'],'html':htmlEntities[_0x2551('0x69')](_0xd6cf9c['body']),'headers':{'Date':moment(_0xd6cf9c['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xd6cf9c['cc']){_0x1561e7[_0x2551('0x6a')]['Cc']=_0xd6cf9c['cc'];}if(_0xd6cf9c[_0x2551('0x60')]){_0x1561e7[_0x2551('0x6a')][_0x2551('0x6b')]=_0xd6cf9c[_0x2551('0x60')];}return new BPromise(function(_0x7721f3,_0x4b3796){if(_0xd6cf9c[_0x2551('0x6c')]){for(var _0xfd2407=0x0;_0xfd2407<_0xd6cf9c[_0x2551('0x6c')][_0x2551('0x35')];_0xfd2407++){var _0xcd5d00=_0xd6cf9c[_0x2551('0x6c')][_0xfd2407];var _0x399499=path['join'](_0xeac406,_0xcd5d00[_0x2551('0x6d')]);if(fs['existsSync'](_0x399499)){_0x1561e7[_0x2551('0x59')][_0x2551('0x5d')]({'name':_0xcd5d00[_0x2551('0x23')],'contentType':_0xcd5d00['type'],'data':fs[_0x2551('0x6e')](_0x399499)});}}}emlformat[_0x2551('0x6f')](_0x1561e7,function(_0x2c5814,_0x55659e){if(_0x2c5814)return _0x4b3796(_0x2c5814);fs[_0x2551('0x70')](path[_0x2551('0x5a')](_0x4aa000,util[_0x2551('0x5b')](_0x2551('0x71'),_0x5636cc)),_0x55659e);return _0x7721f3(_0x55659e);});});})[_0x2551('0x1e')](function(){return new BPromise(function(_0x21585f,_0x210781){zipdir(_0x4aa000,{'saveTo':_0x5ed6a8},function(_0x4cd6b1,_0x38e614){if(_0x4cd6b1)return _0x210781(_0x4cd6b1);return _0x21585f(_0x38e614);});})[_0x2551('0x1e')](function(){return new BPromise(function(_0x549605,_0x2fc198){rimraf(_0x4aa000,function(_0x58c468){if(_0x58c468)_0x2fc198(_0x58c468);return _0x549605();});});})['then'](function(){return _0x3ceb7f['download'](_0x5ed6a8,_0x84eb2d,function(_0x105c0c){if(!_0x105c0c)fs[_0x2551('0x72')](_0x5ed6a8);});});});}else{return _0x3ceb7f[_0x2551('0x20')](0xc8);}})['catch'](handleError(_0x3ceb7f,null));}; \ No newline at end of file +var _0x86c3=['createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','moment','util','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','params','keys','filters','attributes','intersection','fields','length','model','includeAll','include','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','options','MailMessage','true','rows','setTags','spread','Tag','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','from','subject','Messages','mkdirSync','missing.recipient@your.company.com','decode'];(function(_0x503559,_0x217673){var _0x99fa24=function(_0x3e60d4){while(--_0x3e60d4){_0x503559['push'](_0x503559['shift']());}};_0x99fa24(++_0x217673);}(_0x86c3,0x7b));var _0x386c=function(_0x339de1,_0x4b7143){_0x339de1=_0x339de1-0x0;var _0x14451e=_0x86c3[_0x339de1];return _0x14451e;};'use strict';var emlformat=require(_0x386c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x386c('0x1'));var BPromise=require('bluebird');var util=require(_0x386c('0x2'));var path=require(_0x386c('0x3'));var fs=require('fs');var _=require('lodash');var juice=require(_0x386c('0x4'));var Redis=require('ioredis');var interaction=require(_0x386c('0x5'));var qs=require(_0x386c('0x6'));var logger=require(_0x386c('0x7'))(_0x386c('0x8'));var config=require('../../config/environment');var db=require(_0x386c('0x9'))['db'];var htmlEntities=require(_0x386c('0xa'));config['redis']=_[_0x386c('0xb')](config[_0x386c('0xc')],{'host':_0x386c('0xd'),'port':0x18eb});var socket=require(_0x386c('0xe'))(new Redis(config[_0x386c('0xc')]));require(_0x386c('0xf'))[_0x386c('0x10')](socket);function respondWithStatusCode(_0x96eb78,_0x466740){_0x466740=_0x466740||0xcc;return function(_0x10e4b3){if(_0x10e4b3){return _0x96eb78[_0x386c('0x11')](_0x466740);}return _0x96eb78[_0x386c('0x12')](_0x466740)[_0x386c('0x13')]();};}function respondWithResult(_0x4274f2,_0x1325bc){_0x1325bc=_0x1325bc||0xc8;return function(_0x27bb3f){if(_0x27bb3f){return _0x4274f2[_0x386c('0x12')](_0x1325bc)[_0x386c('0x14')](_0x27bb3f);}};}function respondWithFilteredResult(_0x914125,_0x23315a){return function(_0x2920e1){if(_0x2920e1){var _0x57bab3=typeof _0x23315a[_0x386c('0x15')]===_0x386c('0x16')&&typeof _0x23315a[_0x386c('0x17')]===_0x386c('0x16');var _0x2d3124=_0x2920e1[_0x386c('0x18')];var _0x4447c6=_0x57bab3?0x0:_0x23315a[_0x386c('0x15')];var _0x3eaa73=_0x57bab3?_0x2920e1[_0x386c('0x18')]:_0x23315a[_0x386c('0x15')]+_0x23315a['limit'];var _0xa144f2;if(_0x3eaa73>=_0x2d3124){_0x3eaa73=_0x2d3124;_0xa144f2=0xc8;}else{_0xa144f2=0xce;}_0x914125[_0x386c('0x12')](_0xa144f2);return _0x914125['set']('Content-Range',_0x4447c6+'-'+_0x3eaa73+'/'+_0x2d3124)['json'](_0x2920e1);}return null;};}function saveUpdates(_0x3015f3){return function(_0x38bc3a){if(_0x38bc3a){return _0x38bc3a[_0x386c('0x19')](_0x3015f3)[_0x386c('0x1a')](function(_0x40601d){return _0x40601d;});}return null;};}function removeEntity(_0x418802){return function(_0x507ee9){if(_0x507ee9){return _0x507ee9[_0x386c('0x1b')]()[_0x386c('0x1a')](function(){_0x418802['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be176){return function(_0x57b042){if(!_0x57b042){_0x4be176[_0x386c('0x11')](0x194);}return _0x57b042;};}function handleError(_0x52f368,_0x3003f1){_0x3003f1=_0x3003f1||0x1f4;return function(_0x2ad166){logger[_0x386c('0x1c')](_0x2ad166[_0x386c('0x1d')]);if(_0x2ad166[_0x386c('0x1e')]){delete _0x2ad166[_0x386c('0x1e')];}_0x52f368['status'](_0x3003f1)['send'](_0x2ad166);};}exports[_0x386c('0x1f')]=function(_0x4efcb5,_0x3a8805){var _0x33b9fc={};var _0x54fbea=_[_0x386c('0x20')](db[_0x386c('0x21')][_0x386c('0x22')],function(_0x58c576){return{'name':_0x58c576[_0x386c('0x23')],'type':_0x58c576[_0x386c('0x24')][_0x386c('0x25')]};});_0x33b9fc=qs[_0x386c('0x26')](_0x54fbea,_0x4efcb5);return interaction[_0x386c('0x27')](_0x386c('0x28'),_0x4efcb5[_0x386c('0x29')],_0x4efcb5[_0x386c('0x2a')],_0x33b9fc,_0x54fbea)[_0x386c('0x1a')](respondWithFilteredResult(_0x3a8805,_0x33b9fc))[_0x386c('0x2b')](handleError(_0x3a8805,null));};exports['show']=function(_0x25f327,_0x193f42){var _0x5dab69={'raw':![],'where':{'id':_0x25f327[_0x386c('0x2c')]['id']}},_0x3cfdfa={};_0x3cfdfa['model']=_[_0x386c('0x2d')](db['MailInteraction']['rawAttributes']);_0x3cfdfa[_0x386c('0x29')]=_[_0x386c('0x2d')](_0x25f327['query']);_0x3cfdfa[_0x386c('0x2e')]=_['intersection'](_0x3cfdfa['model'],_0x3cfdfa[_0x386c('0x29')]);_0x5dab69[_0x386c('0x2f')]=_[_0x386c('0x30')](_0x3cfdfa['model'],qs[_0x386c('0x31')](_0x25f327[_0x386c('0x29')][_0x386c('0x31')]));_0x5dab69[_0x386c('0x2f')]=_0x5dab69[_0x386c('0x2f')][_0x386c('0x32')]?_0x5dab69['attributes']:_0x3cfdfa[_0x386c('0x33')];if(_0x25f327['query'][_0x386c('0x34')]){_0x5dab69[_0x386c('0x35')]=[{'all':!![]}];}_0x5dab69=_[_0x386c('0x36')]({},_0x5dab69,_0x25f327['options']);return db['MailInteraction'][_0x386c('0x37')](_0x5dab69)[_0x386c('0x1a')](handleEntityNotFound(_0x193f42,null))[_0x386c('0x1a')](respondWithResult(_0x193f42,null))[_0x386c('0x2b')](handleError(_0x193f42,null));};exports['create']=function(_0x306817,_0x1bb067){return db['MailInteraction'][_0x386c('0x38')](_0x306817[_0x386c('0x39')],{})[_0x386c('0x1a')](respondWithResult(_0x1bb067,0xc9))[_0x386c('0x2b')](handleError(_0x1bb067,null));};exports[_0x386c('0x19')]=function(_0x4dea45,_0x31870e){if(_0x4dea45['body']['id']){delete _0x4dea45[_0x386c('0x39')]['id'];}return db[_0x386c('0x21')][_0x386c('0x37')]({'where':{'id':_0x4dea45[_0x386c('0x2c')]['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x31870e,null))['then'](saveUpdates(_0x4dea45[_0x386c('0x39')],null))[_0x386c('0x1a')](respondWithResult(_0x31870e,null))[_0x386c('0x2b')](handleError(_0x31870e,null));};exports['destroy']=function(_0x42cb7b,_0x3fb43f){return db['MailInteraction'][_0x386c('0x37')]({'where':{'id':_0x42cb7b[_0x386c('0x2c')]['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x3fb43f,null))['then'](removeEntity(_0x3fb43f,null))[_0x386c('0x2b')](handleError(_0x3fb43f,null));};exports[_0x386c('0x3a')]=function(_0x130871,_0x56668c){return db[_0x386c('0x21')]['describe']()['then'](respondWithResult(_0x56668c,null))[_0x386c('0x2b')](handleError(_0x56668c,null));};exports[_0x386c('0x3b')]=function(_0x314880,_0x4babe4){return db['MailMessage'][_0x386c('0x37')]({'where':{'id':_0x314880['params']['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x4babe4,null))['then'](function(_0x5de92f){if(_0x5de92f){return _0x5de92f[_0x386c('0x3b')](_0x314880['body'][_0x386c('0x3c')],_[_0x386c('0x3d')](_0x314880['body'],['ids','id'])||{});}})[_0x386c('0x1a')](respondWithResult(_0x4babe4,null))[_0x386c('0x2b')](handleError(_0x4babe4,null));};exports[_0x386c('0x3e')]=function(_0x469e3a,_0x235245){var _0x1f41b7={'raw':![],'where':{}};var _0x3a3ea4={};var _0x2ff895={'count':0x0,'rows':[]};return db['MailInteraction'][_0x386c('0x3f')]({'where':{'id':_0x469e3a['params']['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x235245,null))['then'](function(_0x363c34){if(_0x363c34){_0x3a3ea4[_0x386c('0x33')]=_[_0x386c('0x2d')](db['MailMessage'][_0x386c('0x22')]);_0x3a3ea4[_0x386c('0x29')]=_[_0x386c('0x2d')](_0x469e3a[_0x386c('0x29')]);_0x3a3ea4[_0x386c('0x2e')]=_[_0x386c('0x30')](_0x3a3ea4[_0x386c('0x33')],_0x3a3ea4[_0x386c('0x29')]);_0x1f41b7[_0x386c('0x2f')]=_['intersection'](_0x3a3ea4[_0x386c('0x33')],qs['fields'](_0x469e3a[_0x386c('0x29')]['fields']));_0x1f41b7['attributes']=_0x1f41b7[_0x386c('0x2f')][_0x386c('0x32')]?_0x1f41b7[_0x386c('0x2f')]:_0x3a3ea4[_0x386c('0x33')];if(!_0x469e3a[_0x386c('0x29')][_0x386c('0x40')](_0x386c('0x41'))){_0x1f41b7['limit']=qs[_0x386c('0x17')](_0x469e3a['query'][_0x386c('0x17')]);_0x1f41b7[_0x386c('0x15')]=qs[_0x386c('0x15')](_0x469e3a['query'][_0x386c('0x15')]);}_0x1f41b7[_0x386c('0x42')]=qs['sort'](_0x469e3a['query'][_0x386c('0x43')]);_0x1f41b7[_0x386c('0x44')]=qs['filters'](_[_0x386c('0x45')](_0x469e3a[_0x386c('0x29')],_0x3a3ea4[_0x386c('0x2e')]));_0x1f41b7[_0x386c('0x44')][_0x386c('0x46')]=_0x363c34['id'];if(_0x469e3a[_0x386c('0x29')][_0x386c('0x47')]){_0x1f41b7[_0x386c('0x44')]=_[_0x386c('0x36')](_0x1f41b7[_0x386c('0x44')],{'$or':_[_0x386c('0x20')](_0x1f41b7[_0x386c('0x2f')],function(_0x40dca0){var _0x73c7e1={};_0x73c7e1[_0x40dca0]={'$like':'%'+_0x469e3a[_0x386c('0x29')][_0x386c('0x47')]+'%'};return _0x73c7e1;})});}if(_0x469e3a['query']['$gte']){var _0x40ff92=_0x469e3a['query'][_0x386c('0x48')][_0x386c('0x49')](',');var _0x4be847={};_0x4be847[_0x40ff92[0x0]]={'$gte':moment(_0x40ff92[0x1])[_0x386c('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f41b7[_0x386c('0x44')]=_[_0x386c('0x36')](_0x1f41b7[_0x386c('0x44')],_0x4be847);}_0x1f41b7=_['merge']({},_0x1f41b7,_0x469e3a[_0x386c('0x4b')]);return db['MailMessage'][_0x386c('0x18')]({'where':_0x1f41b7[_0x386c('0x44')]})[_0x386c('0x1a')](function(_0x1c5930){_0x2ff895[_0x386c('0x18')]=_0x1c5930;if(_0x469e3a[_0x386c('0x29')][_0x386c('0x34')]){_0x1f41b7['include']=[{'all':!![]}];}return db[_0x386c('0x4c')][_0x386c('0x27')](_0x1f41b7);})[_0x386c('0x1a')](function(_0xf18d49){if(_0x469e3a[_0x386c('0x29')]['inlineCss']===_0x386c('0x4d')){for(var _0x14fd56=0x0;_0x14fd56<_0xf18d49[_0x386c('0x32')];_0x14fd56++){_0xf18d49[_0x14fd56][_0x386c('0x39')]=juice(_0xf18d49[_0x14fd56][_0x386c('0x39')]);}}_0x2ff895[_0x386c('0x4e')]=_0xf18d49;return _0x2ff895;});}})[_0x386c('0x1a')](respondWithFilteredResult(_0x235245,_0x1f41b7))[_0x386c('0x2b')](handleError(_0x235245,null));};exports['addTags']=function(_0xc3de00,_0x32bfba){return db[_0x386c('0x21')][_0x386c('0x37')]({'where':{'id':_0xc3de00[_0x386c('0x2c')]['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x32bfba,null))['then'](function(_0x5924cb){if(_0x5924cb){return _0x5924cb[_0x386c('0x4f')](_0xc3de00[_0x386c('0x39')][_0x386c('0x3c')],_[_0x386c('0x3d')](_0xc3de00[_0x386c('0x39')],[_0x386c('0x3c'),'id'])||{})[_0x386c('0x50')](function(){return db[_0x386c('0x51')][_0x386c('0x27')]({'attributes':['id',_0x386c('0x1e'),'color'],'where':{'id':_0xc3de00[_0x386c('0x39')]['ids']}});})['then'](function(_0x2678f5){socket['emit'](_0x386c('0x52'),{'id':Number(_0xc3de00['params']['id']),'tags':_0x2678f5||[]});return{'id':Number(_0xc3de00[_0x386c('0x2c')]['id']),'tags':_0x2678f5||[]};});}})['then'](respondWithResult(_0x32bfba,null))[_0x386c('0x2b')](handleError(_0x32bfba,null));};exports[_0x386c('0x53')]=function(_0x3e84b1,_0x8b9ee5){return db['MailInteraction']['find']({'where':{'id':_0x3e84b1[_0x386c('0x2c')]['id']}})[_0x386c('0x1a')](handleEntityNotFound(_0x8b9ee5,null))[_0x386c('0x1a')](function(_0x5ce83e){if(_0x5ce83e){return _0x5ce83e[_0x386c('0x53')](_0x3e84b1[_0x386c('0x29')][_0x386c('0x3c')]);}})[_0x386c('0x1a')](respondWithStatusCode(_0x8b9ee5,null))[_0x386c('0x2b')](handleError(_0x8b9ee5,null));};exports[_0x386c('0x54')]=function(_0x59624b,_0x445ec4){var _0x15f00b=moment()[_0x386c('0x55')]()[_0x386c('0x56')]();var _0x17c475=path['join'](config[_0x386c('0x57')],_0x386c('0x58'),_0x386c('0x59'),_0x386c('0x5a'));var _0x427dd9=path[_0x386c('0x5b')](config['root'],_0x386c('0x58'),'files',_0x386c('0x5c'));var _0x41e4af=path['join'](_0x17c475,_0x15f00b);var _0x302e5d=util[_0x386c('0x4a')](_0x386c('0x5d'),_0x59624b[_0x386c('0x2c')]['id'],_0x15f00b);var _0x115f12=path['join'](_0x17c475,_0x302e5d);var _0x344518=[];if(_0x59624b[_0x386c('0x29')][_0x386c('0x5c')]){_0x344518[_0x386c('0x5e')]({'model':db[_0x386c('0x5f')],'as':_0x386c('0x60'),'raw':!![]});}var _0x1200fe=[{'model':db[_0x386c('0x4c')],'as':'Messages','attributes':['id',_0x386c('0x39'),_0x386c('0x61'),'to','cc','bcc',_0x386c('0x62'),'createdAt'],'where':{'secret':![]},'order':qs[_0x386c('0x43')]('id'),'include':_0x344518}];return db[_0x386c('0x21')]['find']({'where':{'id':_0x59624b['params']['id']},'include':_0x1200fe})['then'](handleEntityNotFound(_0x445ec4,null))[_0x386c('0x1a')](function(_0x3d9fba){if(_0x3d9fba&&_0x3d9fba[_0x386c('0x63')]){var _0x18e98e=_0x3d9fba['get']({'plain':!![]});fs[_0x386c('0x64')](_0x41e4af);return BPromise['each'](_0x18e98e[_0x386c('0x63')],function(_0x3f744d,_0x277005){var _0x530368={'from':_0x3f744d[_0x386c('0x61')],'to':_0x3f744d['to']||_0x386c('0x65'),'subject':_0x3f744d[_0x386c('0x62')],'html':htmlEntities[_0x386c('0x66')](_0x3f744d[_0x386c('0x39')]),'headers':{'Date':moment(_0x3f744d[_0x386c('0x67')])[_0x386c('0x4a')](_0x386c('0x68'))},'attachments':[]};if(_0x3f744d['cc']){_0x530368['headers']['Cc']=_0x3f744d['cc'];}if(_0x3f744d[_0x386c('0x69')]){_0x530368[_0x386c('0x6a')][_0x386c('0x6b')]=_0x3f744d[_0x386c('0x69')];}return new BPromise(function(_0x169909,_0x947853){if(_0x3f744d[_0x386c('0x60')]){for(var _0x1a215b=0x0;_0x1a215b<_0x3f744d[_0x386c('0x60')][_0x386c('0x32')];_0x1a215b++){var _0x4c2979=_0x3f744d[_0x386c('0x60')][_0x1a215b];var _0x540517=path['join'](_0x427dd9,_0x4c2979['basename']);if(fs['existsSync'](_0x540517)){_0x530368[_0x386c('0x5c')][_0x386c('0x5e')]({'name':_0x4c2979[_0x386c('0x1e')],'contentType':_0x4c2979[_0x386c('0x24')],'data':fs[_0x386c('0x6c')](_0x540517)});}}}emlformat[_0x386c('0x6d')](_0x530368,function(_0x73f244,_0x28c876){if(_0x73f244)return _0x947853(_0x73f244);fs[_0x386c('0x6e')](path[_0x386c('0x5b')](_0x41e4af,util[_0x386c('0x4a')](_0x386c('0x6f'),_0x277005)),_0x28c876);return _0x169909(_0x28c876);});});})[_0x386c('0x1a')](function(){return new BPromise(function(_0x2494c3,_0x3fbe56){zipdir(_0x41e4af,{'saveTo':_0x115f12},function(_0x598745,_0x7575b8){if(_0x598745)return _0x3fbe56(_0x598745);return _0x2494c3(_0x7575b8);});})[_0x386c('0x1a')](function(){return new BPromise(function(_0x4c659c,_0x15e582){rimraf(_0x41e4af,function(_0x5ca880){if(_0x5ca880)_0x15e582(_0x5ca880);return _0x4c659c();});});})[_0x386c('0x1a')](function(){return _0x445ec4[_0x386c('0x54')](_0x115f12,_0x302e5d,function(_0x155c98){if(!_0x155c98)fs[_0x386c('0x70')](_0x115f12);});});});}else{return _0x445ec4['sendStatus'](0xc8);}})[_0x386c('0x2b')](handleError(_0x445ec4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 15cde3c..0ec3233 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 _0xf21f=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','events','../../mysqldb','MailInteraction'];(function(_0x4c84aa,_0x1df309){var _0x344ed0=function(_0x5ce728){while(--_0x5ce728){_0x4c84aa['push'](_0x4c84aa['shift']());}};_0x344ed0(++_0x1df309);}(_0xf21f,0xfd));var _0xff21=function(_0x16acb7,_0x23f034){_0x16acb7=_0x16acb7-0x0;var _0x39bf39=_0xf21f[_0x16acb7];return _0x39bf39;};'use strict';var EventEmitter=require(_0xff21('0x0'));var MailInteraction=require(_0xff21('0x1'))['db'][_0xff21('0x2')];var MailMessage=require(_0xff21('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xff21('0x3')](0x0);var events={'afterCreate':_0xff21('0x4'),'afterUpdate':_0xff21('0x5'),'afterDestroy':_0xff21('0x6')};function emitEvent(_0x278a2d){return function(_0x3961d4,_0x5bd32c,_0x3b3e3b){_0x3961d4[_0xff21('0x7')]({'attributes':['id'],'raw':!![]})[_0xff21('0x8')](function(_0x49109e){_0x3961d4[_0xff21('0x9')](_0xff21('0xa'),_0x49109e[_0xff21('0xb')](function(_0x48397f){return{'id':_0x48397f['id']};}));return MailMessage[_0xff21('0xc')]({'where':{'MailInteractionId':_0x3961d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff21('0x8')](function(_0x58af08){_0x3961d4[_0xff21('0x9')](_0xff21('0xd'),_0x58af08[_0xff21('0xe')]);MailInteractionEvents[_0xff21('0xf')](_0x278a2d+':'+_0x3961d4['id'],_0x3961d4);MailInteractionEvents['emit'](_0x278a2d,_0x3961d4);_0x3b3e3b(null);})['catch'](_0x3b3e3b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x700e=['then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x146f46,_0x10bd86){var _0x245ae6=function(_0x3406e4){while(--_0x3406e4){_0x146f46['push'](_0x146f46['shift']());}};_0x245ae6(++_0x10bd86);}(_0x700e,0x1cb));var _0xe700=function(_0xea19d0,_0x4c237c){_0xea19d0=_0xea19d0-0x0;var _0x25d025=_0x700e[_0xea19d0];return _0x25d025;};'use strict';var EventEmitter=require(_0xe700('0x0'));var MailInteraction=require(_0xe700('0x1'))['db'][_0xe700('0x2')];var MailMessage=require(_0xe700('0x1'))['db'][_0xe700('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe700('0x4')](0x0);var events={'afterCreate':_0xe700('0x5'),'afterUpdate':_0xe700('0x6'),'afterDestroy':_0xe700('0x7')};function emitEvent(_0x3d3c98){return function(_0x2bbbaa,_0x40d203,_0x114d31){_0x2bbbaa[_0xe700('0x8')]({'attributes':['id'],'raw':!![]})[_0xe700('0x9')](function(_0x123dae){_0x2bbbaa[_0xe700('0xa')](_0xe700('0xb'),_0x123dae[_0xe700('0xc')](function(_0xf6cc82){return{'id':_0xf6cc82['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2bbbaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe700('0x9')](function(_0x3f2adf){_0x2bbbaa[_0xe700('0xa')]('unreadMessages',_0x3f2adf['length']);MailInteractionEvents[_0xe700('0xd')](_0x3d3c98+':'+_0x2bbbaa['id'],_0x2bbbaa);MailInteractionEvents[_0xe700('0xd')](_0x3d3c98,_0x2bbbaa);_0x114d31(null);})[_0xe700('0xe')](_0x114d31(null));};}for(var e in events){if(events[_0xe700('0xf')](e)){var event=events[e];MailInteraction[_0xe700('0x10')](e,emitEvent(event));}}module[_0xe700('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d29e2af..d578f95 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 _0x5ffa=['YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','closed','closedAt','format'];(function(_0x90cb2b,_0x4fcc39){var _0x36c9bd=function(_0x5881dc){while(--_0x5881dc){_0x90cb2b['push'](_0x90cb2b['shift']());}};_0x36c9bd(++_0x4fcc39);}(_0x5ffa,0x1ac));var _0xa5ff=function(_0x4e5029,_0x456d7f){_0x4e5029=_0x4e5029-0x0;var _0x28a104=_0x5ffa[_0x4e5029];return _0x28a104;};'use strict';var _=require(_0xa5ff('0x0'));var util=require(_0xa5ff('0x1'));var logger=require(_0xa5ff('0x2'))(_0xa5ff('0x3'));var moment=require(_0xa5ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5ff('0x5'));var fs=require('fs');var path=require(_0xa5ff('0x6'));var rimraf=require('rimraf');var config=require(_0xa5ff('0x7'));var attributes=require(_0xa5ff('0x8'));module[_0xa5ff('0x9')]=function(_0x5ece3c,_0x1521f2){return _0x5ece3c[_0xa5ff('0xa')](_0xa5ff('0xb'),attributes,{'tableName':_0xa5ff('0xc'),'paranoid':![],'indexes':[{'name':_0xa5ff('0xd'),'fields':[_0xa5ff('0xe'),'to'],'type':_0xa5ff('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10603e,_0x212d35,_0x5d8ee8){if(_0x10603e['substatus']){_0x10603e[_0xa5ff('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x10603e[_0xa5ff('0x11')]){_0x10603e[_0xa5ff('0x12')]=moment()[_0xa5ff('0x13')](_0xa5ff('0x14'));}_0x5d8ee8(null,_0x212d35);},'beforeUpdate':function(_0x1156d,_0x190af6,_0x1c0153){if(_0x1156d[_0xa5ff('0x15')](_0xa5ff('0x16'))){_0x1156d[_0xa5ff('0x10')]=_0x1156d[_0xa5ff('0x16')]?moment()[_0xa5ff('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x1156d[_0xa5ff('0x15')]('closed')){_0x1156d[_0xa5ff('0x12')]=moment()[_0xa5ff('0x13')](_0xa5ff('0x14'));_0x1156d['substatus']=null;_0x1156d[_0xa5ff('0x10')]=null;}_0x1c0153(null,_0x1156d);},'afterUpdate':function(_0x1d6252,_0x19d50e,_0x247e17){var _0x2ebb3b=_0x5ece3c[_0xa5ff('0x17')];var _0x3a41f7=_0x1d6252[_0xa5ff('0x18')]({'plain':!![]});if(_0x3a41f7['closed']){return _0x2ebb3b[_0xa5ff('0x19')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3a41f7['id']}})['then'](function(){_0x247e17();})['catch'](function(_0x4d010f){_0x247e17(_0x4d010f);});}else{_0x247e17();}}},'charset':_0xa5ff('0x1a'),'collate':_0xa5ff('0x1b')});}; \ No newline at end of file +var _0x2786=['rimraf','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x164467,_0x5df59a){var _0x56529f=function(_0x4ced8f){while(--_0x4ced8f){_0x164467['push'](_0x164467['shift']());}};_0x56529f(++_0x5df59a);}(_0x2786,0x165));var _0x6278=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2786[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x6278('0x0'));var util=require(_0x6278('0x1'));var logger=require(_0x6278('0x2'))(_0x6278('0x3'));var moment=require(_0x6278('0x4'));var BPromise=require(_0x6278('0x5'));var rp=require(_0x6278('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6278('0x7'));var config=require('../../config/environment');var attributes=require(_0x6278('0x8'));module['exports']=function(_0x275914,_0x752fcc){return _0x275914['define'](_0x6278('0x9'),attributes,{'tableName':_0x6278('0xa'),'paranoid':![],'indexes':[{'name':_0x6278('0xb'),'fields':[_0x6278('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x205a89,_0x291098,_0x27a5a2){if(_0x205a89['substatus']){_0x205a89[_0x6278('0xd')]=moment()[_0x6278('0xe')](_0x6278('0xf'));}if(_0x205a89[_0x6278('0x10')]){_0x205a89[_0x6278('0x11')]=moment()[_0x6278('0xe')](_0x6278('0xf'));}_0x27a5a2(null,_0x291098);},'beforeUpdate':function(_0x1209b8,_0x5823c6,_0x160fa5){if(_0x1209b8[_0x6278('0x12')]('substatus')){_0x1209b8[_0x6278('0xd')]=_0x1209b8[_0x6278('0x13')]?moment()[_0x6278('0xe')](_0x6278('0xf')):null;}if(_0x1209b8[_0x6278('0x12')](_0x6278('0x10'))){_0x1209b8['closedAt']=moment()[_0x6278('0xe')](_0x6278('0xf'));_0x1209b8[_0x6278('0x13')]=null;_0x1209b8[_0x6278('0xd')]=null;}_0x160fa5(null,_0x1209b8);},'afterUpdate':function(_0xd09258,_0x56f6d3,_0x41fe1d){var _0x374a81=_0x275914[_0x6278('0x14')];var _0x25748f=_0xd09258[_0x6278('0x15')]({'plain':!![]});if(_0x25748f['closed']){return _0x374a81['MailMessage'][_0x6278('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x25748f['id']}})[_0x6278('0x17')](function(){_0x41fe1d();})[_0x6278('0x18')](function(_0x258a17){_0x41fe1d(_0x258a17);});}else{_0x41fe1d();}}},'charset':'utf8mb4','collate':_0x6278('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 401b85a..c18174e 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 _0x0b16=['error','code','message','info','result','UpdateMailInteraction','MailInteraction','options','raw','where','limit','catch','AddTagsToMailInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0x0b16,0x8f));var _0x60b1=function(_0x2960a6,_0x52a6b3){_0x2960a6=_0x2960a6-0x0;var _0x1ae2e0=_0x0b16[_0x2960a6];return _0x1ae2e0;};'use strict';var _=require(_0x60b1('0x0'));var util=require('util');var moment=require(_0x60b1('0x1'));var BPromise=require(_0x60b1('0x2'));var rs=require(_0x60b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60b1('0x4'));var logger=require(_0x60b1('0x5'))(_0x60b1('0x6'));var config=require(_0x60b1('0x7'));var jayson=require(_0x60b1('0x8'));var client=jayson['client'][_0x60b1('0x9')]({'port':0x232a});config[_0x60b1('0xa')]=_[_0x60b1('0xb')](config[_0x60b1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x60b1('0xc'))(new Redis(config[_0x60b1('0xa')]));require(_0x60b1('0xd'))[_0x60b1('0xe')](socket);function respondWithRpcPromise(_0x298ac7,_0x162512,_0x48d01e){return new BPromise(function(_0x367732,_0x27faba){return client['request'](_0x298ac7,_0x48d01e)[_0x60b1('0xf')](function(_0x1e29c5){logger['info'](_0x60b1('0x10'),_0x162512,_0x60b1('0x11'));logger[_0x60b1('0x12')](_0x60b1('0x13'),_0x162512,_0x60b1('0x11'),JSON[_0x60b1('0x14')](_0x1e29c5));if(_0x1e29c5[_0x60b1('0x15')]){if(_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x16')]===0x1f4){logger[_0x60b1('0x15')]('MailInteraction,\x20%s,\x20%s',_0x162512,_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);return _0x27faba(_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);}logger[_0x60b1('0x15')](_0x60b1('0x10'),_0x162512,_0x1e29c5[_0x60b1('0x15')][_0x60b1('0x17')]);return _0x367732(_0x1e29c5['error'][_0x60b1('0x17')]);}else{logger[_0x60b1('0x18')](_0x60b1('0x10'),_0x162512,_0x60b1('0x11'));_0x367732(_0x1e29c5[_0x60b1('0x19')][_0x60b1('0x17')]);}})['catch'](function(_0x46fbac){logger['error'](_0x60b1('0x10'),_0x162512,_0x46fbac);_0x27faba(_0x46fbac);});});}exports[_0x60b1('0x1a')]=function(_0x2c7ab4){var _0x25ec37=this;return new Promise(function(_0x487d9b,_0xb68442){return db[_0x60b1('0x1b')]['update'](_0x2c7ab4['body'],{'raw':_0x2c7ab4['options']?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1e')]||null:null,'attributes':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')]['attributes']||null:null,'limit':_0x2c7ab4[_0x60b1('0x1c')]?_0x2c7ab4[_0x60b1('0x1c')][_0x60b1('0x1f')]||null:null})['then'](function(_0x152143){logger[_0x60b1('0x18')](_0x60b1('0x1a'),_0x2c7ab4);logger['debug']('UpdateMailInteraction',_0x2c7ab4,JSON[_0x60b1('0x14')](_0x152143));_0x487d9b(_0x152143);})[_0x60b1('0x20')](function(_0x3b0c28){logger['error'](_0x60b1('0x1a'),_0x3b0c28[_0x60b1('0x17')],_0x2c7ab4);_0xb68442(_0x25ec37[_0x60b1('0x15')](0x1f4,_0x3b0c28[_0x60b1('0x17')]));});});};exports[_0x60b1('0x21')]=function(_0x9469ec){return new Promise(function(_0xa804d0,_0x1c5424){return db[_0x60b1('0x1b')][_0x60b1('0x22')]({'where':_0x9469ec[_0x60b1('0x1c')]?_0x9469ec[_0x60b1('0x1c')][_0x60b1('0x1e')]||null:null})['then'](function(_0x4b34a7){if(_0x4b34a7){return _0x4b34a7[_0x60b1('0x23')](_0x9469ec['body'][_0x60b1('0x24')],_[_0x60b1('0x25')](_0x9469ec[_0x60b1('0x26')],['ids','id'])||{});}})[_0x60b1('0x27')](function(_0x38576a){logger[_0x60b1('0x18')](_0x60b1('0x28'),_0x9469ec);logger['debug'](_0x60b1('0x28'),_0x9469ec,JSON[_0x60b1('0x14')](_0x38576a));_0xa804d0(_0x38576a);})[_0x60b1('0x20')](function(_0x12cb60){logger['error'](_0x60b1('0x28'),_0x12cb60[_0x60b1('0x17')],_0x9469ec);_0x1c5424(_this['error'](0x1f4,_0x12cb60['message']));});});}; \ No newline at end of file +var _0x91f8=['MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','attributes','limit','AddTagsToMailInteraction','find','where','addTags','body','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then'];(function(_0x3f940e,_0x140c3b){var _0x424b2e=function(_0x3f2fb4){while(--_0x3f2fb4){_0x3f940e['push'](_0x3f940e['shift']());}};_0x424b2e(++_0x140c3b);}(_0x91f8,0x13f));var _0x891f=function(_0x51cf44,_0x2b04e1){_0x51cf44=_0x51cf44-0x0;var _0xb4dbd6=_0x91f8[_0x51cf44];return _0xb4dbd6;};'use strict';var _=require(_0x891f('0x0'));var util=require(_0x891f('0x1'));var moment=require(_0x891f('0x2'));var BPromise=require(_0x891f('0x3'));var rs=require(_0x891f('0x4'));var fs=require('fs');var Redis=require(_0x891f('0x5'));var db=require(_0x891f('0x6'))['db'];var utils=require(_0x891f('0x7'));var logger=require('../../config/logger')(_0x891f('0x8'));var config=require(_0x891f('0x9'));var jayson=require(_0x891f('0xa'));var client=jayson[_0x891f('0xb')]['http']({'port':0x232a});config[_0x891f('0xc')]=_['defaults'](config[_0x891f('0xc')],{'host':_0x891f('0xd'),'port':0x18eb});var socket=require(_0x891f('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x891f('0xf')](socket);function respondWithRpcPromise(_0x2b4feb,_0x4c90ea,_0x198a69){return new BPromise(function(_0x1f4d97,_0x89dac4){return client['request'](_0x2b4feb,_0x198a69)[_0x891f('0x10')](function(_0x71cce4){logger['info'](_0x891f('0x11'),_0x4c90ea,'request\x20sent');logger[_0x891f('0x12')](_0x891f('0x13'),_0x4c90ea,_0x891f('0x14'),JSON[_0x891f('0x15')](_0x71cce4));if(_0x71cce4[_0x891f('0x16')]){if(_0x71cce4[_0x891f('0x16')][_0x891f('0x17')]===0x1f4){logger[_0x891f('0x16')](_0x891f('0x11'),_0x4c90ea,_0x71cce4['error'][_0x891f('0x18')]);return _0x89dac4(_0x71cce4[_0x891f('0x16')][_0x891f('0x18')]);}logger[_0x891f('0x16')](_0x891f('0x11'),_0x4c90ea,_0x71cce4[_0x891f('0x16')][_0x891f('0x18')]);return _0x1f4d97(_0x71cce4[_0x891f('0x16')][_0x891f('0x18')]);}else{logger[_0x891f('0x19')]('MailInteraction,\x20%s,\x20%s',_0x4c90ea,_0x891f('0x14'));_0x1f4d97(_0x71cce4[_0x891f('0x1a')][_0x891f('0x18')]);}})[_0x891f('0x1b')](function(_0x3f58a9){logger['error'](_0x891f('0x11'),_0x4c90ea,_0x3f58a9);_0x89dac4(_0x3f58a9);});});}exports[_0x891f('0x1c')]=function(_0x39193b){var _0x329d9b=this;return new Promise(function(_0xfd72dc,_0x12d636){return db[_0x891f('0x1d')][_0x891f('0x1e')](_0x39193b['body'],{'raw':_0x39193b[_0x891f('0x1f')]?_0x39193b[_0x891f('0x1f')][_0x891f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39193b[_0x891f('0x1f')]?_0x39193b[_0x891f('0x1f')]['where']||null:null,'attributes':_0x39193b['options']?_0x39193b[_0x891f('0x1f')][_0x891f('0x21')]||null:null,'limit':_0x39193b['options']?_0x39193b[_0x891f('0x1f')][_0x891f('0x22')]||null:null})['then'](function(_0x23e28d){logger['info'](_0x891f('0x1c'),_0x39193b);logger[_0x891f('0x12')](_0x891f('0x1c'),_0x39193b,JSON[_0x891f('0x15')](_0x23e28d));_0xfd72dc(_0x23e28d);})[_0x891f('0x1b')](function(_0x4fb5cd){logger[_0x891f('0x16')](_0x891f('0x1c'),_0x4fb5cd[_0x891f('0x18')],_0x39193b);_0x12d636(_0x329d9b['error'](0x1f4,_0x4fb5cd[_0x891f('0x18')]));});});};exports[_0x891f('0x23')]=function(_0x3d08c6){return new Promise(function(_0x351387,_0x2ebd84){return db[_0x891f('0x1d')][_0x891f('0x24')]({'where':_0x3d08c6['options']?_0x3d08c6[_0x891f('0x1f')][_0x891f('0x25')]||null:null})['then'](function(_0x5b1bf9){if(_0x5b1bf9){return _0x5b1bf9[_0x891f('0x26')](_0x3d08c6[_0x891f('0x27')]['ids'],_['omit'](_0x3d08c6[_0x891f('0x27')],[_0x891f('0x28'),'id'])||{});}})['spread'](function(_0xe2a001){logger[_0x891f('0x19')]('AddTags',_0x3d08c6);logger[_0x891f('0x12')](_0x891f('0x29'),_0x3d08c6,JSON[_0x891f('0x15')](_0xe2a001));_0x351387(_0xe2a001);})[_0x891f('0x1b')](function(_0x31a144){logger[_0x891f('0x16')]('AddTags',_0x31a144[_0x891f('0x18')],_0x3d08c6);_0x2ebd84(_this[_0x891f('0x16')](0x1f4,_0x31a144[_0x891f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 51180a8..ddbbbbf 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 _0x4073=['emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x44fd4c,_0x101855){var _0x3ffc14=function(_0xffc8c9){while(--_0xffc8c9){_0x44fd4c['push'](_0x44fd4c['shift']());}};_0x3ffc14(++_0x101855);}(_0x4073,0x1cd));var _0x3407=function(_0x46fa99,_0x244ea9){_0x46fa99=_0x46fa99-0x0;var _0x3c0340=_0x4073[_0x46fa99];return _0x3c0340;};'use strict';var MailInteractionEvents=require(_0x3407('0x0'));var events=[_0x3407('0x1'),'remove',_0x3407('0x2')];function createListener(_0x4cd5e7,_0x59a983){return function(_0x1bc0bb){_0x59a983[_0x3407('0x3')](_0x4cd5e7,_0x1bc0bb);};}function removeListener(_0x142bdf,_0x2ad216){return function(){MailInteractionEvents[_0x3407('0x4')](_0x142bdf,_0x2ad216);};}exports[_0x3407('0x5')]=function(_0x2e79dc){for(var _0x2830cd=0x0,_0x53f498=events[_0x3407('0x6')];_0x2830cd<_0x53f498;_0x2830cd++){var _0x3cfeec=events[_0x2830cd];var _0x50e5bf=createListener(_0x3407('0x7')+_0x3cfeec,_0x2e79dc);MailInteractionEvents['on'](_0x3cfeec,_0x50e5bf);}}; \ No newline at end of file +var _0x04a3=['removeListener','register','mailInteraction:','./mailInteraction.events','update'];(function(_0x5b099f,_0x5d9c55){var _0x2073d1=function(_0x5cbdfa){while(--_0x5cbdfa){_0x5b099f['push'](_0x5b099f['shift']());}};_0x2073d1(++_0x5d9c55);}(_0x04a3,0x6c));var _0x304a=function(_0x4c55ee,_0x94c701){_0x4c55ee=_0x4c55ee-0x0;var _0x4f066a=_0x04a3[_0x4c55ee];return _0x4f066a;};'use strict';var MailInteractionEvents=require(_0x304a('0x0'));var events=['save','remove',_0x304a('0x1')];function createListener(_0xebf635,_0x57747e){return function(_0x12dd39){_0x57747e['emit'](_0xebf635,_0x12dd39);};}function removeListener(_0x4c76c5,_0x545b13){return function(){MailInteractionEvents[_0x304a('0x2')](_0x4c76c5,_0x545b13);};}exports[_0x304a('0x3')]=function(_0x49ede6){for(var _0x3e7417=0x0,_0x5f01cc=events['length'];_0x3e7417<_0x5f01cc;_0x3e7417++){var _0x73401b=events[_0x3e7417];var _0x351967=createListener(_0x304a('0x4')+_0x73401b,_0x49ede6);MailInteractionEvents['on'](_0x73401b,_0x351967);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 0f5d973..0944406 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 _0x3ee7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','show','/:id/download','post','mail','create','put','update','reject','delete','destroy','exports','util','express'];(function(_0x2e89ce,_0xaef0e1){var _0x69ed15=function(_0x2f180e){while(--_0x2f180e){_0x2e89ce['push'](_0x2e89ce['shift']());}};_0x69ed15(++_0xaef0e1);}(_0x3ee7,0x98));var _0x73ee=function(_0x5af977,_0x5770c8){_0x5af977=_0x5af977-0x0;var _0x4823d1=_0x3ee7[_0x5af977];return _0x4823d1;};'use strict';var multer=require('multer');var util=require(_0x73ee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73ee('0x1'));var router=express['Router']();var fs_extra=require(_0x73ee('0x2'));var auth=require(_0x73ee('0x3'));var interaction=require(_0x73ee('0x4'));var config=require(_0x73ee('0x5'));var controller=require(_0x73ee('0x6'));router[_0x73ee('0x7')]('/',auth[_0x73ee('0x8')](),controller[_0x73ee('0x9')]);router['get'](_0x73ee('0xa'),auth[_0x73ee('0x8')](),controller['describe']);router[_0x73ee('0x7')]('/:id',auth[_0x73ee('0x8')](),controller[_0x73ee('0xb')]);router[_0x73ee('0x7')](_0x73ee('0xc'),auth[_0x73ee('0x8')](),controller['download']);router[_0x73ee('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x73ee('0xe'),'mailmessage:create'),controller[_0x73ee('0xf')]);router[_0x73ee('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x73ee('0x11')]);router[_0x73ee('0x10')]('/:id/accept',auth[_0x73ee('0x8')](),controller['accept']);router[_0x73ee('0x10')]('/:id/reject',auth[_0x73ee('0x8')](),controller[_0x73ee('0x12')]);router[_0x73ee('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x73ee('0x14')]);module[_0x73ee('0x15')]=router; \ No newline at end of file +var _0x4e8d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','isAuthenticated','describe','/:id','download','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x4e8d,0x11e));var _0xd4e8=function(_0x31a833,_0x29cb47){_0x31a833=_0x31a833-0x0;var _0x51f5ee=_0x4e8d[_0x31a833];return _0x51f5ee;};'use strict';var multer=require(_0xd4e8('0x0'));var util=require(_0xd4e8('0x1'));var path=require(_0xd4e8('0x2'));var timeout=require(_0xd4e8('0x3'));var express=require(_0xd4e8('0x4'));var router=express[_0xd4e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd4e8('0x6'));var interaction=require(_0xd4e8('0x7'));var config=require(_0xd4e8('0x8'));var controller=require(_0xd4e8('0x9'));router[_0xd4e8('0xa')]('/',auth['isAuthenticated'](),controller[_0xd4e8('0xb')]);router['get']('/describe',auth[_0xd4e8('0xc')](),controller[_0xd4e8('0xd')]);router[_0xd4e8('0xa')](_0xd4e8('0xe'),auth[_0xd4e8('0xc')](),controller['show']);router[_0xd4e8('0xa')]('/:id/download',auth[_0xd4e8('0xc')](),controller[_0xd4e8('0xf')]);router['post']('/',auth[_0xd4e8('0xc')](),interaction[_0xd4e8('0x10')]('mail',_0xd4e8('0x11')),controller[_0xd4e8('0x12')]);router[_0xd4e8('0x13')](_0xd4e8('0xe'),auth[_0xd4e8('0xc')](),controller[_0xd4e8('0x14')]);router[_0xd4e8('0x13')](_0xd4e8('0x15'),auth[_0xd4e8('0xc')](),controller[_0xd4e8('0x16')]);router[_0xd4e8('0x13')](_0xd4e8('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xd4e8('0xe'),auth[_0xd4e8('0xc')](),controller[_0xd4e8('0x18')]);module[_0xd4e8('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 33e2129..e7208e6 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 _0xd388=['sequelize','lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','Chat'];(function(_0x1112a4,_0x133f9c){var _0x221f61=function(_0x24d01b){while(--_0x24d01b){_0x1112a4['push'](_0x1112a4['shift']());}};_0x221f61(++_0x133f9c);}(_0xd388,0x6c));var _0x8d38=function(_0x9144c1,_0x157e52){_0x9144c1=_0x9144c1-0x0;var _0x45abe9=_0xd388[_0x9144c1];return _0x45abe9;};'use strict';var Sequelize=require(_0x8d38('0x0'));var _=require(_0x8d38('0x1'));module['exports']={'body':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8d38('0x2')]('medium')},'read':{'type':Sequelize[_0x8d38('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d38('0x5')]('in','out'),'defaultValue':_0x8d38('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8d38('0x7')](0x1fe)},'from':{'type':Sequelize[_0x8d38('0x7')]},'to':{'type':Sequelize[_0x8d38('0x2')]('long')},'cc':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x8d38('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x8d38('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8d38('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8d38('0x9')]},'originTo':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'originCc':{'type':Sequelize[_0x8d38('0x2')](_0x8d38('0x3'))},'originChannel':{'type':Sequelize[_0x8d38('0x5')](_0x8d38('0xa'),_0x8d38('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x9467=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','exports','TEXT','long'];(function(_0x1abdfe,_0x2de416){var _0x56cea6=function(_0x3c64f7){while(--_0x3c64f7){_0x1abdfe['push'](_0x1abdfe['shift']());}};_0x56cea6(++_0x2de416);}(_0x9467,0x13b));var _0x7946=function(_0x340513,_0x58dfe0){_0x340513=_0x340513-0x0;var _0x3e4ce2=_0x9467[_0x340513];return _0x3e4ce2;};'use strict';var Sequelize=require(_0x7946('0x0'));var _=require('lodash');module[_0x7946('0x1')]={'body':{'type':Sequelize[_0x7946('0x2')](_0x7946('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7946('0x2')](_0x7946('0x4'))},'read':{'type':Sequelize[_0x7946('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7946('0x6')]('in',_0x7946('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7946('0x8')](0x1fe)},'from':{'type':Sequelize[_0x7946('0x8')]},'to':{'type':Sequelize[_0x7946('0x2')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x7946('0x2')](_0x7946('0x3'))},'subject':{'type':Sequelize[_0x7946('0x2')]},'sentAt':{'type':Sequelize[_0x7946('0x9')]},'attach':{'type':Sequelize[_0x7946('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7946('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7946('0x9')]},'originTo':{'type':Sequelize[_0x7946('0x2')](_0x7946('0x3'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x7946('0x6')]('Email','Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4e4b8c1..ec1864e 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 _0x1be2=['catch','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','then','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','findAll','rows','show','params','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','rejectmessage','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','decode','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x510cd9,_0x551300){var _0x2b1f61=function(_0x345249){while(--_0x345249){_0x510cd9['push'](_0x510cd9['shift']());}};_0x2b1f61(++_0x551300);}(_0x1be2,0x11e));var _0x21be=function(_0xae0b38,_0x31c459){_0xae0b38=_0xae0b38-0x0;var _0x26d0fb=_0x1be2[_0xae0b38];return _0x26d0fb;};'use strict';var emlformat=require(_0x21be('0x0'));var moment=require(_0x21be('0x1'));var BPromise=require('bluebird');var util=require(_0x21be('0x2'));var path=require(_0x21be('0x3'));var fs=require('fs');var _=require(_0x21be('0x4'));var Redis=require(_0x21be('0x5'));var htmlToText=require(_0x21be('0x6'));var qs=require(_0x21be('0x7'));var logger=require(_0x21be('0x8'))(_0x21be('0x9'));var interaction_log=require(_0x21be('0x8'))(_0x21be('0xa'));var config=require('../../config/environment');var db=require(_0x21be('0xb'))['db'];config[_0x21be('0xc')]=_[_0x21be('0xd')](config[_0x21be('0xc')],{'host':_0x21be('0xe'),'port':0x18eb});var socket=require(_0x21be('0xf'))(new Redis(config['redis']));var htmlEntities=require(_0x21be('0x10'));require(_0x21be('0x11'))[_0x21be('0x12')](socket);var jayson=require(_0x21be('0x13'));var client=jayson[_0x21be('0x14')]['http']({'port':0x232c});var client9003=jayson['client'][_0x21be('0x15')]({'port':0x232b});var client9002=jayson[_0x21be('0x14')][_0x21be('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2d2153,_0x22ec18,_0x1c639d,_0x240789){return new BPromise(function(_0x5a9008,_0x5e3084){var _0x4cce36=_0x240789||client;return _0x4cce36['request'](_0x2d2153,_0x1c639d)['then'](function(_0x1587e2){logger['info'](_0x21be('0x16'),_0x22ec18,_0x21be('0x17'));logger['debug'](_0x21be('0x18'),_0x22ec18,_0x21be('0x17'),JSON[_0x21be('0x19')](_0x1587e2));if(_0x1587e2[_0x21be('0x1a')]){if(_0x1587e2[_0x21be('0x1a')]['code']===0x1f4){logger[_0x21be('0x1a')](_0x21be('0x16'),_0x22ec18,_0x1587e2[_0x21be('0x1a')]['message']);return _0x5e3084(_0x1587e2[_0x21be('0x1a')][_0x21be('0x1b')]);}logger['error'](_0x21be('0x16'),_0x22ec18,_0x1587e2['error'][_0x21be('0x1b')]);return _0x5a9008(_0x1587e2[_0x21be('0x1a')][_0x21be('0x1b')]);}else{logger[_0x21be('0x1c')]('MailMessage,\x20%s,\x20%s',_0x22ec18,'request\x20sent');_0x5a9008(_0x1587e2[_0x21be('0x1d')][_0x21be('0x1b')]);}})[_0x21be('0x1e')](function(_0x3a27c6){logger[_0x21be('0x1a')](_0x21be('0x16'),_0x22ec18,_0x3a27c6);_0x5e3084(_0x3a27c6);});});}function respondWithResult(_0x73f00,_0x4ad84e){_0x4ad84e=_0x4ad84e||0xc8;return function(_0x489851){if(_0x489851){return _0x73f00[_0x21be('0x1f')](_0x4ad84e)['json'](_0x489851);}};}function respondWithFilteredResult(_0x4c778e,_0x4f61d4){return function(_0x6f9f2b){if(_0x6f9f2b){var _0x10b907=typeof _0x4f61d4[_0x21be('0x20')]==='undefined'&&typeof _0x4f61d4[_0x21be('0x21')]===_0x21be('0x22');var _0x17b460=_0x6f9f2b[_0x21be('0x23')];var _0x961efa=_0x10b907?0x0:_0x4f61d4['offset'];var _0x43bdf0=_0x10b907?_0x6f9f2b[_0x21be('0x23')]:_0x4f61d4['offset']+_0x4f61d4[_0x21be('0x21')];var _0x1d0a03;if(_0x43bdf0>=_0x17b460){_0x43bdf0=_0x17b460;_0x1d0a03=0xc8;}else{_0x1d0a03=0xce;}_0x4c778e[_0x21be('0x1f')](_0x1d0a03);return _0x4c778e[_0x21be('0x24')](_0x21be('0x25'),_0x961efa+'-'+_0x43bdf0+'/'+_0x17b460)[_0x21be('0x26')](_0x6f9f2b);}return null;};}function saveUpdates(_0xf22ada){return function(_0x23ce8c){if(_0x23ce8c){return _0x23ce8c[_0x21be('0x27')](_0xf22ada)['then'](function(_0x10a4d5){return _0x10a4d5;});}return null;};}function removeEntity(_0x279736){return function(_0x19f566){if(_0x19f566){return _0x19f566[_0x21be('0x28')]()[_0x21be('0x29')](function(){_0x279736[_0x21be('0x1f')](0xcc)[_0x21be('0x2a')]();});}};}function handleEntityNotFound(_0x2b1854){return function(_0x298be6){if(!_0x298be6){_0x2b1854[_0x21be('0x2b')](0x194);}return _0x298be6;};}function handleError(_0x111a0d,_0x2419fa){_0x2419fa=_0x2419fa||0x1f4;return function(_0x584a5a){logger[_0x21be('0x1a')](_0x584a5a['stack']);if(_0x584a5a['name']){delete _0x584a5a[_0x21be('0x2c')];}_0x111a0d[_0x21be('0x1f')](_0x2419fa)[_0x21be('0x2d')](_0x584a5a);};}exports[_0x21be('0x2e')]=function(_0x5c3bdf,_0x87d17d){var _0xb147bc={},_0x14e7cf={},_0x48b812={'count':0x0,'rows':[]};var _0x2d0083=_[_0x21be('0x2f')](db[_0x21be('0x30')][_0x21be('0x31')],function(_0x745018){return{'name':_0x745018['fieldName'],'type':_0x745018['type'][_0x21be('0x32')]};});_0x14e7cf[_0x21be('0x33')]=_[_0x21be('0x2f')](_0x2d0083,_0x21be('0x2c'));_0x14e7cf[_0x21be('0x34')]=_[_0x21be('0x35')](_0x5c3bdf[_0x21be('0x34')]);_0x14e7cf['filters']=_[_0x21be('0x36')](_0x14e7cf[_0x21be('0x33')],_0x14e7cf['query']);_0xb147bc['attributes']=_[_0x21be('0x36')](_0x14e7cf['model'],qs[_0x21be('0x37')](_0x5c3bdf[_0x21be('0x34')]['fields']));_0xb147bc[_0x21be('0x38')]=_0xb147bc[_0x21be('0x38')][_0x21be('0x39')]?_0xb147bc[_0x21be('0x38')]:_0x14e7cf[_0x21be('0x33')];if(!_0x5c3bdf[_0x21be('0x34')][_0x21be('0x3a')](_0x21be('0x3b'))){_0xb147bc[_0x21be('0x21')]=qs['limit'](_0x5c3bdf[_0x21be('0x34')][_0x21be('0x21')]);_0xb147bc['offset']=qs['offset'](_0x5c3bdf['query'][_0x21be('0x20')]);}_0xb147bc['order']=qs[_0x21be('0x3c')](_0x5c3bdf[_0x21be('0x34')]['sort']);_0xb147bc[_0x21be('0x3d')]=qs[_0x21be('0x3e')](_[_0x21be('0x3f')](_0x5c3bdf[_0x21be('0x34')],_0x14e7cf[_0x21be('0x3e')]),_0x2d0083);if(_0x5c3bdf[_0x21be('0x34')]['filter']){_0xb147bc['where']=_[_0x21be('0x40')](_0xb147bc[_0x21be('0x3d')],{'$or':_[_0x21be('0x2f')](_0x2d0083,function(_0x21bc13){if(_0x21bc13[_0x21be('0x41')]!==_0x21be('0x42')){var _0xa62739={};_0xa62739[_0x21bc13[_0x21be('0x2c')]]={'$like':'%'+_0x5c3bdf[_0x21be('0x34')]['filter']+'%'};return _0xa62739;}})});}_0xb147bc=_[_0x21be('0x40')]({},_0xb147bc,_0x5c3bdf['options']);var _0x147a1b={'where':_0xb147bc[_0x21be('0x3d')]};return db[_0x21be('0x30')][_0x21be('0x23')](_0x147a1b)[_0x21be('0x29')](function(_0xd083e7){_0x48b812[_0x21be('0x23')]=_0xd083e7;if(_0x5c3bdf['query']['includeAll']){_0xb147bc['include']=[{'all':!![]}];}return db[_0x21be('0x30')][_0x21be('0x43')](_0xb147bc);})[_0x21be('0x29')](function(_0x217abf){_0x48b812[_0x21be('0x44')]=_0x217abf;return _0x48b812;})[_0x21be('0x29')](respondWithFilteredResult(_0x87d17d,_0xb147bc))[_0x21be('0x1e')](handleError(_0x87d17d,null));};exports[_0x21be('0x45')]=function(_0x5e3449,_0x4d6b70){var _0x5c95d7={'raw':!![],'where':{'id':_0x5e3449[_0x21be('0x46')]['id']}},_0x5119f8={};_0x5119f8[_0x21be('0x33')]=_[_0x21be('0x35')](db[_0x21be('0x30')][_0x21be('0x31')]);_0x5119f8[_0x21be('0x34')]=_[_0x21be('0x35')](_0x5e3449[_0x21be('0x34')]);_0x5119f8[_0x21be('0x3e')]=_[_0x21be('0x36')](_0x5119f8[_0x21be('0x33')],_0x5119f8[_0x21be('0x34')]);_0x5c95d7[_0x21be('0x38')]=_['intersection'](_0x5119f8[_0x21be('0x33')],qs[_0x21be('0x37')](_0x5e3449['query'][_0x21be('0x37')]));_0x5c95d7['attributes']=_0x5c95d7[_0x21be('0x38')][_0x21be('0x39')]?_0x5c95d7[_0x21be('0x38')]:_0x5119f8[_0x21be('0x33')];if(_0x5e3449['query'][_0x21be('0x47')]){_0x5c95d7['include']=[{'all':!![]}];}_0x5c95d7=_[_0x21be('0x40')]({},_0x5c95d7,_0x5e3449['options']);return db[_0x21be('0x30')][_0x21be('0x48')](_0x5c95d7)[_0x21be('0x29')](handleEntityNotFound(_0x4d6b70,null))[_0x21be('0x29')](respondWithResult(_0x4d6b70,null))[_0x21be('0x1e')](handleError(_0x4d6b70,null));};exports[_0x21be('0x27')]=function(_0x5cd09e,_0x369e87){if(_0x5cd09e['body']['id']){delete _0x5cd09e[_0x21be('0x49')]['id'];}return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x5cd09e['params']['id']}})[_0x21be('0x29')](handleEntityNotFound(_0x369e87,null))[_0x21be('0x29')](saveUpdates(_0x5cd09e['body'],null))[_0x21be('0x29')](respondWithResult(_0x369e87,null))[_0x21be('0x1e')](handleError(_0x369e87,null));};exports[_0x21be('0x28')]=function(_0x3f6ba0,_0x494228){return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x3f6ba0[_0x21be('0x46')]['id']}})[_0x21be('0x29')](handleEntityNotFound(_0x494228,null))['then'](removeEntity(_0x494228,null))[_0x21be('0x1e')](handleError(_0x494228,null));};exports[_0x21be('0x4a')]=function(_0x4549b1,_0xa33450){return db[_0x21be('0x30')][_0x21be('0x4a')]()[_0x21be('0x29')](respondWithResult(_0xa33450,null))['catch'](handleError(_0xa33450,null));};exports[_0x21be('0x4b')]=function(_0x29ee18,_0x371052){return db['MailMessage'][_0x21be('0x4b')](_0x29ee18[_0x21be('0x49')])[_0x21be('0x29')](function(_0x1f8ef6){if(_0x1f8ef6){if(_0x1f8ef6[_0x21be('0x4c')]===_0x21be('0x4d')&&!_0x1f8ef6[_0x21be('0x4e')]){var _0x4b4132,_0x547df3,_0x92221;if(_0x29ee18['body']['to']){_0x547df3=_0x29ee18[_0x21be('0x49')]['to'][_0x21be('0x4f')](',')[0x0];}return db[_0x21be('0x50')][_0x21be('0x51')]({'where':{'id':_0x1f8ef6[_0x21be('0x52')]},'include':[{'model':db[_0x21be('0x53')],'as':_0x21be('0x54'),'include':[{'model':db[_0x21be('0x55')],'as':_0x21be('0x56'),'where':{'email':_0x547df3},'limit':0x1,'order':[[_0x21be('0x57'),_0x21be('0x58')]]}]},{'model':db[_0x21be('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x21be('0x5a')],'as':_0x21be('0x5a'),'raw':!![]}]}]})['then'](function(_0x51f496){_0x4b4132=_0x51f496;if(!_0x4b4132||!_0x4b4132[_0x21be('0x5b')])return;var _0x52728b=_0x4b4132['getSmtpOptions']();if(_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')]&&_0x29ee18['body'][_0x21be('0x5c')]['length']){for(var _0x405d45=0x0;_0x405d45<_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')]['length'];_0x405d45+=0x1){_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')][_0x405d45]={'filename':_0x29ee18[_0x21be('0x49')][_0x21be('0x5c')][_0x405d45][_0x21be('0x2c')],'path':path[_0x21be('0x5d')](config[_0x21be('0x5e')],_0x21be('0x5f'),_0x29ee18[_0x21be('0x49')]['attachments'][_0x405d45][_0x21be('0x60')])};}}_0x92221={'account':_0x52728b,'message':_0x29ee18[_0x21be('0x49')]};return;})[_0x21be('0x29')](function(){if(_0x4b4132[_0x21be('0x54')]){if(_0x4b4132[_0x21be('0x54')][_0x21be('0x56')][_0x21be('0x39')]){return _0x4b4132['List'][_0x21be('0x56')][0x0];}else{return db[_0x21be('0x55')]['create'](_[_0x21be('0xd')](_0x29ee18[_0x21be('0x49')],{'firstName':_0x29ee18['body']['to'],'email':_0x29ee18[_0x21be('0x49')]['to'],'phone':_0x29ee18[_0x21be('0x49')]['to'],'ListId':_0x4b4132['ListId']}));}}else{throw new Error(_0x21be('0x61'));}})[_0x21be('0x29')](function(){if(_0x92221){return respondWithRpcPromise('SendMail',_0x21be('0x62'),_0x92221,client9003)[_0x21be('0x29')](function(_0x2d98ee){return _0x1f8ef6[_0x21be('0x27')]({'read':!![],'messageId':_0x2d98ee['messageId'],'sentAt':moment()['format'](_0x21be('0x63'))});})[_0x21be('0x1e')](function(_0x4beb67){logger[_0x21be('0x1a')]('%s',JSON[_0x21be('0x19')](_0x4beb67));return _0x1f8ef6;});}return _0x1f8ef6;});}return _0x1f8ef6;}})[_0x21be('0x29')](respondWithResult(_0x371052,0xc9))[_0x21be('0x1e')](handleError(_0x371052,null));};exports[_0x21be('0x64')]=function(_0x3b8794,_0x83f705){var _0x31a0b4={'agent':{},'channel':_0x21be('0x65')};if(_0x3b8794['body']['id']){delete _0x3b8794[_0x21be('0x49')]['id'];}_0x3b8794[_0x21be('0x49')]['read']=!![];_0x3b8794['body'][_0x21be('0x66')]=moment()[_0x21be('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b8794[_0x21be('0x49')]['UserId']=_0x3b8794[_0x21be('0x49')][_0x21be('0x68')]||_0x3b8794[_0x21be('0x69')]['id'];_0x31a0b4[_0x21be('0x6a')]['id']=_0x3b8794['body'][_0x21be('0x68')];return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x3b8794['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x83f705,null))[_0x21be('0x29')](saveUpdates(_0x3b8794[_0x21be('0x49')],null))[_0x21be('0x29')](function(_0x48527d){if(_0x48527d){_0x31a0b4['message']=_0x48527d[_0x21be('0x6b')]({'plain':!![]});return db[_0x21be('0x6c')]['find']({'where':{'id':_0x48527d[_0x21be('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x83f705,null))[_0x21be('0x29')](function(_0xf98b0c){if(_0xf98b0c){return _0xf98b0c[_0x21be('0x27')]({'UserId':_0x3b8794[_0x21be('0x49')][_0x21be('0x68')],'read1stAt':_[_0x21be('0x6e')](_0xf98b0c[_0x21be('0x6f')])?moment()['format'](_0x21be('0x63')):undefined});}return null;})[_0x21be('0x29')](function(_0x391378){if(_0x391378){_0x31a0b4['interaction']=_0x391378[_0x21be('0x6b')]({'plain':!![]});interaction_log[_0x21be('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3b8794[_0x21be('0x69')]['id'],_0x3b8794[_0x21be('0x69')][_0x21be('0x2c')],_0x3b8794[_0x21be('0x69')][_0x21be('0x70')],_0x31a0b4['interaction']['id'],_0x3b8794[_0x21be('0x49')]?JSON[_0x21be('0x19')](_0x3b8794[_0x21be('0x49')]):_0x21be('0x71'));return respondWithRpcPromise(_0x21be('0x72'),_0x21be('0x73'),_0x31a0b4);}return null;})[_0x21be('0x29')](function(_0x330cb9){var _0x20c169='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330cb9['message'][_0x21be('0x74')];return db['sequelize'][_0x21be('0x34')](_0x20c169,{'type':db[_0x21be('0x75')][_0x21be('0x76')][_0x21be('0x77')],'raw':!![]})[_0x21be('0x29')](function(_0x318f0f){return _0x318f0f;});})[_0x21be('0x29')](function(_0x25f50a){if(_0x25f50a){_0x31a0b4[_0x21be('0x1b')][_0x21be('0x78')]=_0x25f50a[0x0];if(!_0x3b8794[_0x21be('0x49')][_0x21be('0x68')])return;return db['User'][_0x21be('0x48')]({'where':{'id':_0x3b8794[_0x21be('0x49')][_0x21be('0x68')],'role':_0x21be('0x6a')},'attributes':['id',_0x21be('0x2c'),'fullname',_0x21be('0x79'),_0x21be('0x7a')],'raw':!![]});}return null;})['then'](function(_0x108da8){if(!_0x108da8)return null;_0x31a0b4['message'][_0x21be('0x6a')]=_0x108da8;return _0x31a0b4;})['then'](function(_0x2c0155){if(_0x2c0155){if(_0x3b8794[_0x21be('0x49')][_0x21be('0x7b')]){_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7c')]=util['format'](_0x21be('0x7d'),_0x3b8794[_0x21be('0x69')][_0x21be('0x2c')]);_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7e')]=_0x31a0b4[_0x21be('0x7e')];_0x31a0b4[_0x21be('0x1b')][_0x21be('0x7f')]=_0x31a0b4[_0x21be('0x7e')];_0x31a0b4[_0x21be('0x1b')][_0x21be('0x80')]=_0x21be('0x64');_0x31a0b4['message'][_0x21be('0x49')]=htmlToText[_0x21be('0x81')](_0x31a0b4['message']['body']);return respondWithRpcPromise('EventManager',_0x21be('0x82'),{'event':_0x21be('0x83'),'message':_0x31a0b4[_0x21be('0x1b')]},client9002)[_0x21be('0x29')](function(){return _0x31a0b4;});}return _0x31a0b4;}return null;})[_0x21be('0x29')](respondWithResult(_0x83f705,null))[_0x21be('0x1e')](handleError(_0x83f705,null));};exports[_0x21be('0x84')]=function(_0x31a3af,_0x352952){var _0x45b2b6={'agent':{},'channel':_0x21be('0x65')};if(_0x31a3af[_0x21be('0x49')]['id']){delete _0x31a3af[_0x21be('0x49')]['id'];}_0x31a3af[_0x21be('0x49')][_0x21be('0x68')]=_0x31a3af[_0x21be('0x49')]['UserId']||_0x31a3af[_0x21be('0x69')]['id'];_0x45b2b6[_0x21be('0x6a')]['id']=_0x31a3af[_0x21be('0x49')][_0x21be('0x68')];return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x31a3af[_0x21be('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x352952,null))[_0x21be('0x29')](function(_0xf40b71){if(_0xf40b71){_0x45b2b6['message']=_0xf40b71[_0x21be('0x6b')]({'plain':!![]});return db['MailInteraction'][_0x21be('0x48')]({'where':{'id':_0xf40b71[_0x21be('0x6d')]}});}return null;})[_0x21be('0x29')](handleEntityNotFound(_0x352952,null))[_0x21be('0x29')](function(_0x517ac6){if(_0x517ac6){_0x45b2b6[_0x21be('0x85')]=_0x517ac6[_0x21be('0x6b')]({'plain':!![]});interaction_log[_0x21be('0x1c')](_0x21be('0x86'),_0x31a3af[_0x21be('0x69')]['id'],_0x31a3af[_0x21be('0x69')][_0x21be('0x2c')],_0x31a3af[_0x21be('0x69')][_0x21be('0x70')],_0x45b2b6['interaction']['id'],_0x31a3af['body']?JSON[_0x21be('0x19')](_0x31a3af[_0x21be('0x49')]):_0x21be('0x71'));return respondWithRpcPromise(_0x21be('0x87'),'rejectMessage',_0x45b2b6);}return null;})[_0x21be('0x29')](function(_0x3228d5){var _0x48de39=_0x21be('0x88')+_0x3228d5[_0x21be('0x1b')]['ContactId'];return db['sequelize'][_0x21be('0x34')](_0x48de39,{'type':db[_0x21be('0x75')]['QueryTypes'][_0x21be('0x77')],'raw':!![]})[_0x21be('0x29')](function(_0x50512c){return _0x50512c;});})[_0x21be('0x29')](function(_0x56c072){if(_0x56c072){_0x45b2b6[_0x21be('0x1b')][_0x21be('0x78')]=_0x56c072[0x0];if(!_0x31a3af['body']['UserId'])return;return db[_0x21be('0x89')][_0x21be('0x48')]({'where':{'id':_0x31a3af[_0x21be('0x49')][_0x21be('0x68')],'role':_0x21be('0x6a')},'attributes':['id','name','fullname',_0x21be('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x41f8de){if(!_0x41f8de)return null;_0x45b2b6[_0x21be('0x1b')][_0x21be('0x6a')]=_0x41f8de;return _0x45b2b6;})['then'](function(_0x50c140){if(_0x50c140){_0x50c140[_0x21be('0x1b')][_0x21be('0x7c')]=util[_0x21be('0x67')](_0x21be('0x7d'),_0x31a3af['user'][_0x21be('0x2c')]);_0x50c140[_0x21be('0x1b')][_0x21be('0x7e')]=_0x45b2b6['channel'];_0x50c140['message'][_0x21be('0x7f')]=_0x45b2b6[_0x21be('0x7e')];_0x50c140['message'][_0x21be('0x80')]=_0x21be('0x84');_0x50c140['message'][_0x21be('0x49')]=htmlToText[_0x21be('0x81')](_0x45b2b6[_0x21be('0x1b')][_0x21be('0x49')]);respondWithRpcPromise(_0x21be('0x82'),_0x21be('0x82'),{'event':_0x21be('0x8a'),'message':_0x50c140[_0x21be('0x1b')]},client9002);return _0x45b2b6;}return null;})[_0x21be('0x29')](respondWithResult(_0x352952,null))[_0x21be('0x1e')](handleError(_0x352952,null));};exports['download']=function(_0x128d74,_0x44569b){var _0x36abb7=moment()['unix']()['toString']();var _0x3cdbd8=path[_0x21be('0x5d')](config['root'],_0x21be('0x8b'),_0x21be('0x8c'),_0x21be('0x8d'));var _0x589568=path[_0x21be('0x5d')](config[_0x21be('0x5e')],'server',_0x21be('0x8c'),_0x21be('0x5c'));var _0x4a6f15=util['format'](_0x21be('0x8e'),_0x36abb7);return db[_0x21be('0x30')][_0x21be('0x48')]({'where':{'id':_0x128d74[_0x21be('0x46')]['id']},'attributes':['id','body',_0x21be('0x8f'),'to','cc',_0x21be('0x90'),'subject',_0x21be('0x91')],'include':_0x128d74[_0x21be('0x34')][_0x21be('0x5c')]?[{'model':db[_0x21be('0x92')],'as':_0x21be('0x93')}]:undefined})[_0x21be('0x29')](handleEntityNotFound(_0x44569b,null))['then'](function(_0x2304ce){if(_0x2304ce){var _0x29fed0=_0x2304ce;var _0x4632ad={'from':_0x29fed0[_0x21be('0x8f')],'to':_0x29fed0['to'],'subject':_0x29fed0['subject'],'html':htmlEntities[_0x21be('0x94')](_0x29fed0['body']),'headers':{'Date':moment(_0x29fed0[_0x21be('0x91')])[_0x21be('0x67')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2304ce['cc']){_0x4632ad[_0x21be('0x95')]['Cc']=_0x2304ce['cc'];}if(_0x2304ce[_0x21be('0x90')]){_0x4632ad['headers'][_0x21be('0x96')]=_0x2304ce[_0x21be('0x90')];}return new BPromise(function(_0x262c1c,_0x564ec1){if(_0x2304ce['Attachments']){for(var _0x21d6f5=0x0;_0x21d6f5<_0x2304ce[_0x21be('0x93')]['length'];_0x21d6f5++){var _0x1c47bf=_0x2304ce['Attachments'][_0x21d6f5];var _0x5effa1=path[_0x21be('0x5d')](_0x589568,_0x1c47bf[_0x21be('0x60')]);if(fs[_0x21be('0x97')](_0x5effa1)){_0x4632ad[_0x21be('0x5c')][_0x21be('0x98')]({'name':_0x1c47bf[_0x21be('0x2c')],'contentType':_0x1c47bf[_0x21be('0x41')],'data':fs[_0x21be('0x99')](_0x5effa1)});}}}emlformat[_0x21be('0x9a')](_0x4632ad,function(_0x38065d,_0xd6bc99){if(_0x38065d)return _0x564ec1(_0x38065d);fs[_0x21be('0x9b')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15),_0xd6bc99);return _0x262c1c(_0xd6bc99);});});}})[_0x21be('0x29')](function(_0x13b49a){if(_0x13b49a){return _0x44569b[_0x21be('0x9c')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15),_0x4a6f15,function(_0x3a8381){if(!_0x3a8381)fs[_0x21be('0x9d')](path[_0x21be('0x5d')](_0x3cdbd8,_0x4a6f15));});}})['catch'](handleError(_0x44569b,null));}; \ No newline at end of file +var _0x43a9=['RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','interface','rejectmessage','toString','server','tmp','createdAt','Attachment','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','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','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','body','describe','create','direction','out','secret','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','MailInteractionId','role'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x43a9,0x150));var _0x943a=function(_0x5cd855,_0x102b6e){_0x5cd855=_0x5cd855-0x0;var _0x2d93bb=_0x43a9[_0x5cd855];return _0x2d93bb;};'use strict';var emlformat=require(_0x943a('0x0'));var moment=require(_0x943a('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x943a('0x2'));var fs=require('fs');var _=require(_0x943a('0x3'));var Redis=require(_0x943a('0x4'));var htmlToText=require(_0x943a('0x5'));var qs=require(_0x943a('0x6'));var logger=require(_0x943a('0x7'))('api');var interaction_log=require(_0x943a('0x7'))('mail-interactions');var config=require(_0x943a('0x8'));var db=require(_0x943a('0x9'))['db'];config[_0x943a('0xa')]=_['defaults'](config[_0x943a('0xa')],{'host':_0x943a('0xb'),'port':0x18eb});var socket=require(_0x943a('0xc'))(new Redis(config[_0x943a('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x943a('0xd')](socket);var jayson=require(_0x943a('0xe'));var client=jayson[_0x943a('0xf')][_0x943a('0x10')]({'port':0x232c});var client9003=jayson[_0x943a('0xf')]['http']({'port':0x232b});var client9002=jayson['client'][_0x943a('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x10ad44,_0x5542ec,_0x5452f8,_0x46447c){return new BPromise(function(_0x364a32,_0x21d033){var _0x2002f8=_0x46447c||client;return _0x2002f8[_0x943a('0x11')](_0x10ad44,_0x5452f8)[_0x943a('0x12')](function(_0x53d0a0){logger['info'](_0x943a('0x13'),_0x5542ec,_0x943a('0x14'));logger[_0x943a('0x15')](_0x943a('0x16'),_0x5542ec,'request\x20sent',JSON[_0x943a('0x17')](_0x53d0a0));if(_0x53d0a0['error']){if(_0x53d0a0[_0x943a('0x18')][_0x943a('0x19')]===0x1f4){logger[_0x943a('0x18')](_0x943a('0x13'),_0x5542ec,_0x53d0a0[_0x943a('0x18')][_0x943a('0x1a')]);return _0x21d033(_0x53d0a0['error']['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x5542ec,_0x53d0a0[_0x943a('0x18')][_0x943a('0x1a')]);return _0x364a32(_0x53d0a0[_0x943a('0x18')][_0x943a('0x1a')]);}else{logger[_0x943a('0x1b')]('MailMessage,\x20%s,\x20%s',_0x5542ec,'request\x20sent');_0x364a32(_0x53d0a0[_0x943a('0x1c')][_0x943a('0x1a')]);}})[_0x943a('0x1d')](function(_0x501ce7){logger[_0x943a('0x18')]('MailMessage,\x20%s,\x20%s',_0x5542ec,_0x501ce7);_0x21d033(_0x501ce7);});});}function respondWithResult(_0x2445c4,_0x548d49){_0x548d49=_0x548d49||0xc8;return function(_0x7058e0){if(_0x7058e0){return _0x2445c4[_0x943a('0x1e')](_0x548d49)[_0x943a('0x1f')](_0x7058e0);}};}function respondWithFilteredResult(_0x1b9bd6,_0x4a8be5){return function(_0x82a744){if(_0x82a744){var _0x121594=typeof _0x4a8be5[_0x943a('0x20')]===_0x943a('0x21')&&typeof _0x4a8be5[_0x943a('0x22')]===_0x943a('0x21');var _0x1e5c63=_0x82a744['count'];var _0x3f9c25=_0x121594?0x0:_0x4a8be5[_0x943a('0x20')];var _0x4d9511=_0x121594?_0x82a744[_0x943a('0x23')]:_0x4a8be5['offset']+_0x4a8be5[_0x943a('0x22')];var _0x13ffb2;if(_0x4d9511>=_0x1e5c63){_0x4d9511=_0x1e5c63;_0x13ffb2=0xc8;}else{_0x13ffb2=0xce;}_0x1b9bd6[_0x943a('0x1e')](_0x13ffb2);return _0x1b9bd6['set'](_0x943a('0x24'),_0x3f9c25+'-'+_0x4d9511+'/'+_0x1e5c63)['json'](_0x82a744);}return null;};}function saveUpdates(_0x56f8e7){return function(_0x12a4d5){if(_0x12a4d5){return _0x12a4d5[_0x943a('0x25')](_0x56f8e7)[_0x943a('0x12')](function(_0x39e106){return _0x39e106;});}return null;};}function removeEntity(_0x5c046b){return function(_0xf1b35e){if(_0xf1b35e){return _0xf1b35e[_0x943a('0x26')]()[_0x943a('0x12')](function(){_0x5c046b[_0x943a('0x1e')](0xcc)[_0x943a('0x27')]();});}};}function handleEntityNotFound(_0x1280aa){return function(_0x330462){if(!_0x330462){_0x1280aa[_0x943a('0x28')](0x194);}return _0x330462;};}function handleError(_0x2d56a3,_0x46ad2f){_0x46ad2f=_0x46ad2f||0x1f4;return function(_0xc22e04){logger['error'](_0xc22e04[_0x943a('0x29')]);if(_0xc22e04[_0x943a('0x2a')]){delete _0xc22e04[_0x943a('0x2a')];}_0x2d56a3[_0x943a('0x1e')](_0x46ad2f)[_0x943a('0x2b')](_0xc22e04);};}exports['index']=function(_0xd6ebef,_0x50fbbc){var _0x485d7a={},_0x944f76={},_0x41621e={'count':0x0,'rows':[]};var _0xda7c92=_[_0x943a('0x2c')](db[_0x943a('0x2d')][_0x943a('0x2e')],function(_0x253a95){return{'name':_0x253a95['fieldName'],'type':_0x253a95[_0x943a('0x2f')][_0x943a('0x30')]};});_0x944f76[_0x943a('0x31')]=_[_0x943a('0x2c')](_0xda7c92,_0x943a('0x2a'));_0x944f76[_0x943a('0x32')]=_['keys'](_0xd6ebef[_0x943a('0x32')]);_0x944f76[_0x943a('0x33')]=_[_0x943a('0x34')](_0x944f76[_0x943a('0x31')],_0x944f76[_0x943a('0x32')]);_0x485d7a[_0x943a('0x35')]=_[_0x943a('0x34')](_0x944f76[_0x943a('0x31')],qs[_0x943a('0x36')](_0xd6ebef[_0x943a('0x32')][_0x943a('0x36')]));_0x485d7a[_0x943a('0x35')]=_0x485d7a[_0x943a('0x35')][_0x943a('0x37')]?_0x485d7a['attributes']:_0x944f76['model'];if(!_0xd6ebef['query'][_0x943a('0x38')](_0x943a('0x39'))){_0x485d7a[_0x943a('0x22')]=qs[_0x943a('0x22')](_0xd6ebef[_0x943a('0x32')][_0x943a('0x22')]);_0x485d7a['offset']=qs[_0x943a('0x20')](_0xd6ebef[_0x943a('0x32')]['offset']);}_0x485d7a[_0x943a('0x3a')]=qs[_0x943a('0x3b')](_0xd6ebef[_0x943a('0x32')][_0x943a('0x3b')]);_0x485d7a[_0x943a('0x3c')]=qs[_0x943a('0x33')](_['pick'](_0xd6ebef['query'],_0x944f76[_0x943a('0x33')]),_0xda7c92);if(_0xd6ebef['query'][_0x943a('0x3d')]){_0x485d7a['where']=_[_0x943a('0x3e')](_0x485d7a[_0x943a('0x3c')],{'$or':_[_0x943a('0x2c')](_0xda7c92,function(_0x45fbf8){if(_0x45fbf8[_0x943a('0x2f')]!==_0x943a('0x3f')){var _0x4144a1={};_0x4144a1[_0x45fbf8[_0x943a('0x2a')]]={'$like':'%'+_0xd6ebef[_0x943a('0x32')]['filter']+'%'};return _0x4144a1;}})});}_0x485d7a=_[_0x943a('0x3e')]({},_0x485d7a,_0xd6ebef[_0x943a('0x40')]);var _0x1057d2={'where':_0x485d7a[_0x943a('0x3c')]};return db['MailMessage'][_0x943a('0x23')](_0x1057d2)['then'](function(_0x4f7780){_0x41621e[_0x943a('0x23')]=_0x4f7780;if(_0xd6ebef[_0x943a('0x32')][_0x943a('0x41')]){_0x485d7a[_0x943a('0x42')]=[{'all':!![]}];}return db[_0x943a('0x2d')][_0x943a('0x43')](_0x485d7a);})[_0x943a('0x12')](function(_0x10e295){_0x41621e[_0x943a('0x44')]=_0x10e295;return _0x41621e;})[_0x943a('0x12')](respondWithFilteredResult(_0x50fbbc,_0x485d7a))[_0x943a('0x1d')](handleError(_0x50fbbc,null));};exports['show']=function(_0x4db2e4,_0x35f7f6){var _0x5e9b8e={'raw':!![],'where':{'id':_0x4db2e4[_0x943a('0x45')]['id']}},_0x3b178a={};_0x3b178a[_0x943a('0x31')]=_[_0x943a('0x46')](db[_0x943a('0x2d')]['rawAttributes']);_0x3b178a[_0x943a('0x32')]=_[_0x943a('0x46')](_0x4db2e4[_0x943a('0x32')]);_0x3b178a[_0x943a('0x33')]=_[_0x943a('0x34')](_0x3b178a[_0x943a('0x31')],_0x3b178a[_0x943a('0x32')]);_0x5e9b8e[_0x943a('0x35')]=_['intersection'](_0x3b178a[_0x943a('0x31')],qs[_0x943a('0x36')](_0x4db2e4[_0x943a('0x32')][_0x943a('0x36')]));_0x5e9b8e['attributes']=_0x5e9b8e[_0x943a('0x35')]['length']?_0x5e9b8e[_0x943a('0x35')]:_0x3b178a[_0x943a('0x31')];if(_0x4db2e4[_0x943a('0x32')]['includeAll']){_0x5e9b8e['include']=[{'all':!![]}];}_0x5e9b8e=_['merge']({},_0x5e9b8e,_0x4db2e4[_0x943a('0x40')]);return db['MailMessage'][_0x943a('0x47')](_0x5e9b8e)[_0x943a('0x12')](handleEntityNotFound(_0x35f7f6,null))[_0x943a('0x12')](respondWithResult(_0x35f7f6,null))[_0x943a('0x1d')](handleError(_0x35f7f6,null));};exports[_0x943a('0x25')]=function(_0x4fd943,_0x507dd4){if(_0x4fd943['body']['id']){delete _0x4fd943[_0x943a('0x48')]['id'];}return db[_0x943a('0x2d')][_0x943a('0x47')]({'where':{'id':_0x4fd943[_0x943a('0x45')]['id']}})[_0x943a('0x12')](handleEntityNotFound(_0x507dd4,null))['then'](saveUpdates(_0x4fd943[_0x943a('0x48')],null))[_0x943a('0x12')](respondWithResult(_0x507dd4,null))['catch'](handleError(_0x507dd4,null));};exports[_0x943a('0x26')]=function(_0x5e5542,_0x33d3a1){return db[_0x943a('0x2d')][_0x943a('0x47')]({'where':{'id':_0x5e5542[_0x943a('0x45')]['id']}})[_0x943a('0x12')](handleEntityNotFound(_0x33d3a1,null))[_0x943a('0x12')](removeEntity(_0x33d3a1,null))[_0x943a('0x1d')](handleError(_0x33d3a1,null));};exports[_0x943a('0x49')]=function(_0x13a0e9,_0x36d887){return db[_0x943a('0x2d')]['describe']()[_0x943a('0x12')](respondWithResult(_0x36d887,null))['catch'](handleError(_0x36d887,null));};exports[_0x943a('0x4a')]=function(_0x334c96,_0x5192c1){return db[_0x943a('0x2d')]['create'](_0x334c96[_0x943a('0x48')])[_0x943a('0x12')](function(_0x1572ef){if(_0x1572ef){if(_0x1572ef[_0x943a('0x4b')]===_0x943a('0x4c')&&!_0x1572ef[_0x943a('0x4d')]){var _0x2b9ddc,_0x991c5b,_0x28bbed;if(_0x334c96['body']['to']){_0x991c5b=_0x334c96['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x943a('0x4e')]({'where':{'id':_0x1572ef[_0x943a('0x4f')]},'include':[{'model':db[_0x943a('0x50')],'as':'List','include':[{'model':db[_0x943a('0x51')],'as':_0x943a('0x52'),'where':{'email':_0x991c5b},'limit':0x1,'order':[[_0x943a('0x53'),_0x943a('0x54')]]}]},{'model':db[_0x943a('0x55')],'as':_0x943a('0x56'),'raw':!![],'include':[{'model':db[_0x943a('0x57')],'as':_0x943a('0x57'),'raw':!![]}]}]})[_0x943a('0x12')](function(_0x2dff67){_0x2b9ddc=_0x2dff67;if(!_0x2b9ddc||!_0x2b9ddc['Smtp'])return;var _0x5acf69=_0x2b9ddc[_0x943a('0x58')]();if(_0x334c96[_0x943a('0x48')]['attachments']&&_0x334c96[_0x943a('0x48')][_0x943a('0x59')][_0x943a('0x37')]){for(var _0x7763fa=0x0;_0x7763fa<_0x334c96['body']['attachments']['length'];_0x7763fa+=0x1){_0x334c96[_0x943a('0x48')][_0x943a('0x59')][_0x7763fa]={'filename':_0x334c96[_0x943a('0x48')][_0x943a('0x59')][_0x7763fa][_0x943a('0x2a')],'path':path[_0x943a('0x5a')](config[_0x943a('0x5b')],_0x943a('0x5c'),_0x334c96[_0x943a('0x48')][_0x943a('0x59')][_0x7763fa][_0x943a('0x5d')])};}}_0x28bbed={'account':_0x5acf69,'message':_0x334c96[_0x943a('0x48')]};return;})['then'](function(){if(_0x2b9ddc[_0x943a('0x5e')]){if(_0x2b9ddc['List'][_0x943a('0x52')][_0x943a('0x37')]){return _0x2b9ddc[_0x943a('0x5e')]['Contacts'][0x0];}else{return db[_0x943a('0x51')]['create'](_['defaults'](_0x334c96[_0x943a('0x48')],{'firstName':_0x334c96[_0x943a('0x48')]['to'],'email':_0x334c96['body']['to'],'phone':_0x334c96[_0x943a('0x48')]['to'],'ListId':_0x2b9ddc['ListId']}));}}else{throw new Error(_0x943a('0x5f'));}})[_0x943a('0x12')](function(){if(_0x28bbed){return respondWithRpcPromise(_0x943a('0x60'),_0x943a('0x61'),_0x28bbed,client9003)[_0x943a('0x12')](function(_0x526227){return _0x1572ef[_0x943a('0x25')]({'read':!![],'messageId':_0x526227['messageId'],'sentAt':moment()['format'](_0x943a('0x62'))});})[_0x943a('0x1d')](function(_0x848544){logger[_0x943a('0x18')]('%s',JSON[_0x943a('0x17')](_0x848544));return _0x1572ef;});}return _0x1572ef;});}return _0x1572ef;}})['then'](respondWithResult(_0x5192c1,0xc9))[_0x943a('0x1d')](handleError(_0x5192c1,null));};exports[_0x943a('0x63')]=function(_0x18a11d,_0xbe1fb3){var _0x2fe259={'agent':{},'channel':_0x943a('0x64')};if(_0x18a11d[_0x943a('0x48')]['id']){delete _0x18a11d[_0x943a('0x48')]['id'];}_0x18a11d['body']['read']=!![];_0x18a11d[_0x943a('0x48')][_0x943a('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18a11d[_0x943a('0x48')][_0x943a('0x66')]=_0x18a11d['body'][_0x943a('0x66')]||_0x18a11d[_0x943a('0x67')]['id'];_0x2fe259[_0x943a('0x68')]['id']=_0x18a11d[_0x943a('0x48')][_0x943a('0x66')];return db[_0x943a('0x2d')]['find']({'where':{'id':_0x18a11d[_0x943a('0x45')]['id'],'UserId':null}})[_0x943a('0x12')](handleEntityNotFound(_0xbe1fb3,null))[_0x943a('0x12')](saveUpdates(_0x18a11d[_0x943a('0x48')],null))[_0x943a('0x12')](function(_0x879cb7){if(_0x879cb7){_0x2fe259['message']=_0x879cb7[_0x943a('0x69')]({'plain':!![]});return db[_0x943a('0x6a')][_0x943a('0x47')]({'where':{'id':_0x879cb7['MailInteractionId']}});}return null;})[_0x943a('0x12')](handleEntityNotFound(_0xbe1fb3,null))[_0x943a('0x12')](function(_0x6cbb41){if(_0x6cbb41){return _0x6cbb41[_0x943a('0x25')]({'UserId':_0x18a11d[_0x943a('0x48')]['UserId'],'read1stAt':_[_0x943a('0x6b')](_0x6cbb41[_0x943a('0x6c')])?moment()[_0x943a('0x6d')](_0x943a('0x62')):undefined});}return null;})['then'](function(_0x2f6d54){if(_0x2f6d54){_0x2fe259[_0x943a('0x6e')]=_0x2f6d54[_0x943a('0x69')]({'plain':!![]});interaction_log[_0x943a('0x1b')](_0x943a('0x6f'),_0x18a11d[_0x943a('0x67')]['id'],_0x18a11d[_0x943a('0x67')][_0x943a('0x2a')],_0x18a11d[_0x943a('0x67')]['role'],_0x2fe259['interaction']['id'],_0x18a11d[_0x943a('0x48')]?JSON[_0x943a('0x17')](_0x18a11d['body']):_0x943a('0x70'));return respondWithRpcPromise(_0x943a('0x71'),'acceptMessage',_0x2fe259);}return null;})[_0x943a('0x12')](function(_0x43dbaf){var _0x5979f5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x43dbaf[_0x943a('0x1a')][_0x943a('0x72')];return db[_0x943a('0x73')][_0x943a('0x32')](_0x5979f5,{'type':db[_0x943a('0x74')][_0x943a('0x75')][_0x943a('0x76')],'raw':!![]})['then'](function(_0x2639eb){return _0x2639eb;});})['then'](function(_0x5f4b7d){if(_0x5f4b7d){_0x2fe259[_0x943a('0x1a')]['contact']=_0x5f4b7d[0x0];if(!_0x18a11d[_0x943a('0x48')][_0x943a('0x66')])return;return db[_0x943a('0x77')]['find']({'where':{'id':_0x18a11d[_0x943a('0x48')][_0x943a('0x66')],'role':_0x943a('0x68')},'attributes':['id','name',_0x943a('0x78'),_0x943a('0x79'),_0x943a('0x7a')],'raw':!![]});}return null;})[_0x943a('0x12')](function(_0x1b3460){if(!_0x1b3460)return null;_0x2fe259['message'][_0x943a('0x68')]=_0x1b3460;return _0x2fe259;})['then'](function(_0x1a03c7){if(_0x1a03c7){if(_0x18a11d['body'][_0x943a('0x7b')]){_0x2fe259[_0x943a('0x1a')]['interface']=util[_0x943a('0x6d')](_0x943a('0x7c'),_0x18a11d[_0x943a('0x67')]['name']);_0x2fe259[_0x943a('0x1a')][_0x943a('0x7d')]=_0x2fe259[_0x943a('0x7d')];_0x2fe259[_0x943a('0x1a')][_0x943a('0x7e')]=_0x2fe259['channel'];_0x2fe259['message'][_0x943a('0x7f')]=_0x943a('0x63');_0x2fe259[_0x943a('0x1a')][_0x943a('0x48')]=htmlToText['fromString'](_0x2fe259[_0x943a('0x1a')][_0x943a('0x48')]);return respondWithRpcPromise('EventManager',_0x943a('0x80'),{'event':'acceptmessage','message':_0x2fe259['message']},client9002)[_0x943a('0x12')](function(){return _0x2fe259;});}return _0x2fe259;}return null;})[_0x943a('0x12')](respondWithResult(_0xbe1fb3,null))[_0x943a('0x1d')](handleError(_0xbe1fb3,null));};exports[_0x943a('0x81')]=function(_0x4e3e29,_0x2b9d71){var _0x54e112={'agent':{},'channel':'mail'};if(_0x4e3e29[_0x943a('0x48')]['id']){delete _0x4e3e29[_0x943a('0x48')]['id'];}_0x4e3e29[_0x943a('0x48')][_0x943a('0x66')]=_0x4e3e29[_0x943a('0x48')][_0x943a('0x66')]||_0x4e3e29['user']['id'];_0x54e112[_0x943a('0x68')]['id']=_0x4e3e29[_0x943a('0x48')]['UserId'];return db[_0x943a('0x2d')]['find']({'where':{'id':_0x4e3e29['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b9d71,null))[_0x943a('0x12')](function(_0x537e68){if(_0x537e68){_0x54e112[_0x943a('0x1a')]=_0x537e68[_0x943a('0x69')]({'plain':!![]});return db[_0x943a('0x6a')][_0x943a('0x47')]({'where':{'id':_0x537e68[_0x943a('0x82')]}});}return null;})[_0x943a('0x12')](handleEntityNotFound(_0x2b9d71,null))[_0x943a('0x12')](function(_0x4221ac){if(_0x4221ac){_0x54e112['interaction']=_0x4221ac[_0x943a('0x69')]({'plain':!![]});interaction_log[_0x943a('0x1b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e3e29[_0x943a('0x67')]['id'],_0x4e3e29[_0x943a('0x67')]['name'],_0x4e3e29[_0x943a('0x67')][_0x943a('0x83')],_0x54e112[_0x943a('0x6e')]['id'],_0x4e3e29[_0x943a('0x48')]?JSON[_0x943a('0x17')](_0x4e3e29['body']):'null');return respondWithRpcPromise(_0x943a('0x84'),'rejectMessage',_0x54e112);}return null;})[_0x943a('0x12')](function(_0x15ff66){var _0x3fcfda=_0x943a('0x85')+_0x15ff66[_0x943a('0x1a')][_0x943a('0x72')];return db['sequelize']['query'](_0x3fcfda,{'type':db[_0x943a('0x74')][_0x943a('0x75')][_0x943a('0x76')],'raw':!![]})['then'](function(_0x3c8f22){return _0x3c8f22;});})[_0x943a('0x12')](function(_0x52add4){if(_0x52add4){_0x54e112[_0x943a('0x1a')][_0x943a('0x86')]=_0x52add4[0x0];if(!_0x4e3e29[_0x943a('0x48')][_0x943a('0x66')])return;return db['User']['find']({'where':{'id':_0x4e3e29[_0x943a('0x48')][_0x943a('0x66')],'role':_0x943a('0x68')},'attributes':['id',_0x943a('0x2a'),_0x943a('0x78'),'email',_0x943a('0x7a')],'raw':!![]});}return null;})[_0x943a('0x12')](function(_0x113ce7){if(!_0x113ce7)return null;_0x54e112[_0x943a('0x1a')][_0x943a('0x68')]=_0x113ce7;return _0x54e112;})['then'](function(_0x325201){if(_0x325201){_0x325201[_0x943a('0x1a')][_0x943a('0x87')]=util[_0x943a('0x6d')]('SIP/%s',_0x4e3e29[_0x943a('0x67')][_0x943a('0x2a')]);_0x325201[_0x943a('0x1a')][_0x943a('0x7d')]=_0x54e112[_0x943a('0x7d')];_0x325201['message'][_0x943a('0x7e')]=_0x54e112[_0x943a('0x7d')];_0x325201['message'][_0x943a('0x7f')]='reject';_0x325201[_0x943a('0x1a')][_0x943a('0x48')]=htmlToText['fromString'](_0x54e112[_0x943a('0x1a')][_0x943a('0x48')]);respondWithRpcPromise('EventManager',_0x943a('0x80'),{'event':_0x943a('0x88'),'message':_0x325201['message']},client9002);return _0x54e112;}return null;})[_0x943a('0x12')](respondWithResult(_0x2b9d71,null))['catch'](handleError(_0x2b9d71,null));};exports['download']=function(_0x2d587b,_0x2ca85f){var _0x12c34a=moment()['unix']()[_0x943a('0x89')]();var _0x4dcdad=path[_0x943a('0x5a')](config[_0x943a('0x5b')],_0x943a('0x8a'),'files',_0x943a('0x8b'));var _0x1179ab=path[_0x943a('0x5a')](config[_0x943a('0x5b')],_0x943a('0x8a'),'files','attachments');var _0x57f22a=util[_0x943a('0x6d')]('message-%s.eml',_0x12c34a);return db[_0x943a('0x2d')][_0x943a('0x47')]({'where':{'id':_0x2d587b['params']['id']},'attributes':['id',_0x943a('0x48'),'from','to','cc','bcc','subject',_0x943a('0x8c')],'include':_0x2d587b[_0x943a('0x32')][_0x943a('0x59')]?[{'model':db[_0x943a('0x8d')],'as':'Attachments'}]:undefined})[_0x943a('0x12')](handleEntityNotFound(_0x2ca85f,null))[_0x943a('0x12')](function(_0x54fe9c){if(_0x54fe9c){var _0x5951f6=_0x54fe9c;var _0x93375d={'from':_0x5951f6[_0x943a('0x8e')],'to':_0x5951f6['to'],'subject':_0x5951f6['subject'],'html':htmlEntities[_0x943a('0x8f')](_0x5951f6['body']),'headers':{'Date':moment(_0x5951f6[_0x943a('0x8c')])[_0x943a('0x6d')](_0x943a('0x90'))},'attachments':[]};if(_0x54fe9c['cc']){_0x93375d[_0x943a('0x91')]['Cc']=_0x54fe9c['cc'];}if(_0x54fe9c[_0x943a('0x92')]){_0x93375d[_0x943a('0x91')][_0x943a('0x93')]=_0x54fe9c[_0x943a('0x92')];}return new BPromise(function(_0x2a8876,_0x5134fe){if(_0x54fe9c[_0x943a('0x94')]){for(var _0x364bd3=0x0;_0x364bd3<_0x54fe9c[_0x943a('0x94')][_0x943a('0x37')];_0x364bd3++){var _0x2b70a2=_0x54fe9c['Attachments'][_0x364bd3];var _0x27e4e5=path[_0x943a('0x5a')](_0x1179ab,_0x2b70a2[_0x943a('0x5d')]);if(fs[_0x943a('0x95')](_0x27e4e5)){_0x93375d[_0x943a('0x59')][_0x943a('0x96')]({'name':_0x2b70a2[_0x943a('0x2a')],'contentType':_0x2b70a2[_0x943a('0x2f')],'data':fs[_0x943a('0x97')](_0x27e4e5)});}}}emlformat[_0x943a('0x98')](_0x93375d,function(_0x382971,_0x134eb6){if(_0x382971)return _0x5134fe(_0x382971);fs[_0x943a('0x99')](path[_0x943a('0x5a')](_0x4dcdad,_0x57f22a),_0x134eb6);return _0x2a8876(_0x134eb6);});});}})['then'](function(_0x14f4b6){if(_0x14f4b6){return _0x2ca85f[_0x943a('0x9a')](path[_0x943a('0x5a')](_0x4dcdad,_0x57f22a),_0x57f22a,function(_0x65f203){if(!_0x65f203)fs[_0x943a('0x9b')](path[_0x943a('0x5a')](_0x4dcdad,_0x57f22a));});}})[_0x943a('0x1d')](handleError(_0x2ca85f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e8ee5fc..760899a 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 _0xaf9a=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x496dcb,_0x3d7bb0){var _0x119f69=function(_0x43077f){while(--_0x43077f){_0x496dcb['push'](_0x496dcb['shift']());}};_0x119f69(++_0x3d7bb0);}(_0xaf9a,0x12c));var _0xaaf9=function(_0xa123d8,_0x47a3e2){_0xa123d8=_0xa123d8-0x0;var _0x2f4fd6=_0xaf9a[_0xa123d8];return _0x2f4fd6;};'use strict';var EventEmitter=require(_0xaaf9('0x0'));var MailMessage=require(_0xaaf9('0x1'))['db'][_0xaaf9('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaaf9('0x3')](0x0);var events={'afterCreate':_0xaaf9('0x4'),'afterUpdate':_0xaaf9('0x5'),'afterDestroy':_0xaaf9('0x6')};function emitEvent(_0x3508b9){return function(_0x411d17,_0x225501,_0x428322){MailMessageEvents[_0xaaf9('0x7')](_0x3508b9+':'+_0x411d17['id'],_0x411d17);MailMessageEvents[_0xaaf9('0x7')](_0x3508b9,_0x411d17);_0x428322(null);};}for(var e in events){if(events[_0xaaf9('0x8')](e)){var event=events[e];MailMessage[_0xaaf9('0x9')](e,emitEvent(event));}}module[_0xaaf9('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x28d1=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0x28d1,0xc4));var _0x128d=function(_0x1b89e2,_0x239ebd){_0x1b89e2=_0x1b89e2-0x0;var _0x3570f4=_0x28d1[_0x1b89e2];return _0x3570f4;};'use strict';var EventEmitter=require(_0x128d('0x0'));var MailMessage=require(_0x128d('0x1'))['db'][_0x128d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x128d('0x3')](0x0);var events={'afterCreate':_0x128d('0x4'),'afterUpdate':_0x128d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x31ef4b){return function(_0x28ce6b,_0x5a5fcd,_0x544906){MailMessageEvents[_0x128d('0x6')](_0x31ef4b+':'+_0x28ce6b['id'],_0x28ce6b);MailMessageEvents[_0x128d('0x6')](_0x31ef4b,_0x28ce6b);_0x544906(null);};}for(var e in events){if(events[_0x128d('0x7')](e)){var event=events[e];MailMessage[_0x128d('0x8')](e,emitEvent(event));}}module[_0x128d('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6cc7c11..704d9ac 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 _0xfc3c=['request-promise','html-to-text','path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x414708,_0x40bdd5){var _0x5ef823=function(_0x413ca2){while(--_0x413ca2){_0x414708['push'](_0x414708['shift']());}};_0x5ef823(++_0x40bdd5);}(_0xfc3c,0x8e));var _0xcfc3=function(_0x4f5c2a,_0x465535){_0x4f5c2a=_0x4f5c2a-0x0;var _0x1b2e6e=_0xfc3c[_0x4f5c2a];return _0x1b2e6e;};'use strict';var _=require(_0xcfc3('0x0'));var util=require(_0xcfc3('0x1'));var logger=require(_0xcfc3('0x2'))(_0xcfc3('0x3'));var moment=require(_0xcfc3('0x4'));var BPromise=require(_0xcfc3('0x5'));var rp=require(_0xcfc3('0x6'));var htmlToText=require(_0xcfc3('0x7'));var fs=require('fs');var path=require(_0xcfc3('0x8'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcfc3('0x9'));module[_0xcfc3('0xa')]=function(_0xf85d31,_0x26c3b1){return _0xf85d31[_0xcfc3('0xb')](_0xcfc3('0xc'),attributes,{'tableName':_0xcfc3('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcfc3('0xe')]},{'name':_0xcfc3('0xf'),'fields':['plainBody',_0xcfc3('0x10')],'type':_0xcfc3('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x313478,_0x4d6cd2,_0x591d90){if(_0x313478[_0xcfc3('0x12')]){_0x313478[_0xcfc3('0x13')]=htmlToText[_0xcfc3('0x14')](_0x313478['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x591d90(null,_0x4d6cd2);},'afterCreate':function(_0x3bb881,_0x3bffb3,_0x2ede98){var _0x58149b=_0xf85d31[_0xcfc3('0x15')];var _0x5a5710=_0x3bb881[_0xcfc3('0x16')]({'plain':!![]});if(_0x5a5710[_0xcfc3('0x17')][_0xcfc3('0x18')]()==='in'||_0x5a5710['direction'][_0xcfc3('0x18')]()==='out'&&!_0x5a5710[_0xcfc3('0x19')]&&!_[_0xcfc3('0x1a')](_0x5a5710[_0xcfc3('0x1b')])){_0x58149b['MailInteraction'][_0xcfc3('0x1c')]({'where':{'id':_0x5a5710[_0xcfc3('0x1d')]}})[_0xcfc3('0x1e')](function(_0x56494f){if(_0x56494f){_0x56494f[_0xcfc3('0x1f')]({'lastMsgAt':_0x5a5710[_0xcfc3('0x20')],'lastMsgDirection':_0x5a5710[_0xcfc3('0x17')]['toLowerCase']()});}})[_0xcfc3('0x21')](function(_0x5f1cea){console[_0xcfc3('0x22')](_0x5f1cea);});}_0x2ede98();}},'charset':_0xcfc3('0x23'),'collate':_0xcfc3('0x24')});}; \ No newline at end of file +var _0x3cef=['secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','body','models','direction','toLowerCase','out'];(function(_0xa90ced,_0x113d6f){var _0x3e15d8=function(_0x5ba40f){while(--_0x5ba40f){_0xa90ced['push'](_0xa90ced['shift']());}};_0x3e15d8(++_0x113d6f);}(_0x3cef,0x13f));var _0xf3ce=function(_0x47031d,_0x35d7b1){_0x47031d=_0x47031d-0x0;var _0x47cf26=_0x3cef[_0x47031d];return _0x47cf26;};'use strict';var _=require(_0xf3ce('0x0'));var util=require(_0xf3ce('0x1'));var logger=require('../../config/logger')(_0xf3ce('0x2'));var moment=require(_0xf3ce('0x3'));var BPromise=require(_0xf3ce('0x4'));var rp=require(_0xf3ce('0x5'));var htmlToText=require(_0xf3ce('0x6'));var fs=require('fs');var path=require(_0xf3ce('0x7'));var rimraf=require(_0xf3ce('0x8'));var config=require(_0xf3ce('0x9'));var attributes=require(_0xf3ce('0xa'));module['exports']=function(_0x1a3fa6,_0x143cef){return _0x1a3fa6[_0xf3ce('0xb')](_0xf3ce('0xc'),attributes,{'tableName':_0xf3ce('0xd'),'paranoid':![],'indexes':[{'name':_0xf3ce('0xe'),'fields':[_0xf3ce('0xe')]},{'name':'fti_mail_messages','fields':[_0xf3ce('0xf'),'subject'],'type':_0xf3ce('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b1482,_0x166841,_0x44f3fb){if(_0x4b1482[_0xf3ce('0x11')]){_0x4b1482[_0xf3ce('0xf')]=htmlToText['fromString'](_0x4b1482[_0xf3ce('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x44f3fb(null,_0x166841);},'afterCreate':function(_0x2c87c4,_0x23ddb4,_0x2ad2cd){var _0x11675c=_0x1a3fa6[_0xf3ce('0x12')];var _0x3b48c9=_0x2c87c4['get']({'plain':!![]});if(_0x3b48c9[_0xf3ce('0x13')]['toLowerCase']()==='in'||_0x3b48c9[_0xf3ce('0x13')][_0xf3ce('0x14')]()===_0xf3ce('0x15')&&!_0x3b48c9[_0xf3ce('0x16')]&&!_['isNil'](_0x3b48c9[_0xf3ce('0x17')])){_0x11675c[_0xf3ce('0x18')][_0xf3ce('0x19')]({'where':{'id':_0x3b48c9[_0xf3ce('0x1a')]}})[_0xf3ce('0x1b')](function(_0x430ae8){if(_0x430ae8){_0x430ae8[_0xf3ce('0x1c')]({'lastMsgAt':_0x3b48c9['createdAt'],'lastMsgDirection':_0x3b48c9[_0xf3ce('0x13')]['toLowerCase']()});}})[_0xf3ce('0x1d')](function(_0x10bf2c){console['error'](_0x10bf2c);});}_0x2ad2cd();}},'charset':_0xf3ce('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ee3d9f4..f0351a9 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 _0x4991=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','result','MailMessage','create','body','options','raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5c7510,_0xbb110){var _0x549cdf=function(_0x431b10){while(--_0x431b10){_0x5c7510['push'](_0x5c7510['shift']());}};_0x549cdf(++_0xbb110);}(_0x4991,0xf7));var _0x1499=function(_0x3848ff,_0x11fce2){_0x3848ff=_0x3848ff-0x0;var _0x26fcaa=_0x4991[_0x3848ff];return _0x26fcaa;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});config[_0x1499('0xb')]=_[_0x1499('0xc')](config[_0x1499('0xb')],{'host':_0x1499('0xd'),'port':0x18eb});var socket=require(_0x1499('0xe'))(new Redis(config[_0x1499('0xb')]));require(_0x1499('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e8ad,_0x36a053,_0x575251){return new BPromise(function(_0x2a4816,_0x352180){return client['request'](_0x16e8ad,_0x575251)[_0x1499('0x10')](function(_0x2867b1){logger['info']('MailMessage,\x20%s,\x20%s',_0x36a053,'request\x20sent');logger[_0x1499('0x11')](_0x1499('0x12'),_0x36a053,_0x1499('0x13'),JSON[_0x1499('0x14')](_0x2867b1));if(_0x2867b1[_0x1499('0x15')]){if(_0x2867b1['error']['code']===0x1f4){logger[_0x1499('0x15')]('MailMessage,\x20%s,\x20%s',_0x36a053,_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);return _0x352180(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}logger['error'](_0x1499('0x17'),_0x36a053,_0x2867b1[_0x1499('0x15')]['message']);return _0x2a4816(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}else{logger[_0x1499('0x18')](_0x1499('0x17'),_0x36a053,_0x1499('0x13'));_0x2a4816(_0x2867b1[_0x1499('0x19')]['message']);}})['catch'](function(_0x5bcb5f){logger[_0x1499('0x15')](_0x1499('0x17'),_0x36a053,_0x5bcb5f);_0x352180(_0x5bcb5f);});});}exports['CreateMailMessage']=function(_0x351da9){var _0x3c13a1=this;return new Promise(function(_0x28dff3,_0x18e4a6){return db[_0x1499('0x1a')][_0x1499('0x1b')](_0x351da9[_0x1499('0x1c')],{'raw':_0x351da9[_0x1499('0x1d')]?_0x351da9[_0x1499('0x1d')][_0x1499('0x1e')]===undefined?!![]:![]:!![]})[_0x1499('0x10')](function(_0x836081){logger[_0x1499('0x18')](_0x1499('0x1f'),_0x351da9);logger[_0x1499('0x11')](_0x1499('0x1f'),_0x351da9,JSON[_0x1499('0x14')](_0x836081));_0x28dff3(_0x836081);})['catch'](function(_0x258e9c){logger[_0x1499('0x15')](_0x1499('0x1f'),_0x258e9c[_0x1499('0x16')],_0x351da9);_0x18e4a6(_0x3c13a1[_0x1499('0x15')](0x1f4,_0x258e9c[_0x1499('0x16')]));});});}; \ No newline at end of file +var _0xcf2f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x22d995,_0x4981ab){var _0x1e7df8=function(_0x2411af){while(--_0x2411af){_0x22d995['push'](_0x22d995['shift']());}};_0x1e7df8(++_0x4981ab);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x23e8d1,_0x1dd2ed){_0x23e8d1=_0x23e8d1-0x0;var _0x5a5384=_0xcf2f[_0x23e8d1];return _0x5a5384;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});config[_0xfcf2('0xd')]=_[_0xfcf2('0xe')](config[_0xfcf2('0xd')],{'host':_0xfcf2('0xf'),'port':0x18eb});var socket=require(_0xfcf2('0x10'))(new Redis(config[_0xfcf2('0xd')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4d6fc9,_0x91b579,_0x2a9ecb){return new BPromise(function(_0x481e38,_0xf38eab){return client[_0xfcf2('0x11')](_0x4d6fc9,_0x2a9ecb)[_0xfcf2('0x12')](function(_0x29e649){logger['info']('MailMessage,\x20%s,\x20%s',_0x91b579,_0xfcf2('0x13'));logger[_0xfcf2('0x14')](_0xfcf2('0x15'),_0x91b579,_0xfcf2('0x13'),JSON['stringify'](_0x29e649));if(_0x29e649[_0xfcf2('0x16')]){if(_0x29e649['error']['code']===0x1f4){logger['error'](_0xfcf2('0x17'),_0x91b579,_0x29e649['error'][_0xfcf2('0x18')]);return _0xf38eab(_0x29e649[_0xfcf2('0x16')][_0xfcf2('0x18')]);}logger[_0xfcf2('0x16')](_0xfcf2('0x17'),_0x91b579,_0x29e649[_0xfcf2('0x16')][_0xfcf2('0x18')]);return _0x481e38(_0x29e649['error'][_0xfcf2('0x18')]);}else{logger[_0xfcf2('0x19')](_0xfcf2('0x17'),_0x91b579,'request\x20sent');_0x481e38(_0x29e649[_0xfcf2('0x1a')][_0xfcf2('0x18')]);}})[_0xfcf2('0x1b')](function(_0x1cc67e){logger[_0xfcf2('0x16')]('MailMessage,\x20%s,\x20%s',_0x91b579,_0x1cc67e);_0xf38eab(_0x1cc67e);});});}exports[_0xfcf2('0x1c')]=function(_0x11c34f){var _0x4939e4=this;return new Promise(function(_0x9a1d9f,_0x23c079){return db[_0xfcf2('0x1d')][_0xfcf2('0x1e')](_0x11c34f[_0xfcf2('0x1f')],{'raw':_0x11c34f[_0xfcf2('0x20')]?_0x11c34f[_0xfcf2('0x20')][_0xfcf2('0x21')]===undefined?!![]:![]:!![]})[_0xfcf2('0x12')](function(_0x5afab5){logger[_0xfcf2('0x19')](_0xfcf2('0x1c'),_0x11c34f);logger[_0xfcf2('0x14')]('CreateMailMessage',_0x11c34f,JSON[_0xfcf2('0x22')](_0x5afab5));_0x9a1d9f(_0x5afab5);})[_0xfcf2('0x1b')](function(_0x5ddea1){logger[_0xfcf2('0x16')](_0xfcf2('0x1c'),_0x5ddea1['message'],_0x11c34f);_0x23c079(_0x4939e4[_0xfcf2('0x16')](0x1f4,_0x5ddea1[_0xfcf2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3241d85..b77d00a 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 _0x5a8b=['length','save','remove','update','removeListener','register'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x5a8b,0x103));var _0xb5a8=function(_0x174e2c,_0x80146a){_0x174e2c=_0x174e2c-0x0;var _0x1d6c80=_0x5a8b[_0x174e2c];return _0x1d6c80;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xb5a8('0x0'),_0xb5a8('0x1'),_0xb5a8('0x2')];function createListener(_0x2fdb22,_0x1d8cb4){return function(_0x1d0613){_0x1d8cb4['emit'](_0x2fdb22,_0x1d0613);};}function removeListener(_0x4aca12,_0x3ebf25){return function(){MailMessageEvents[_0xb5a8('0x3')](_0x4aca12,_0x3ebf25);};}exports[_0xb5a8('0x4')]=function(_0x7acf58){for(var _0x36de42=0x0,_0x554424=events[_0xb5a8('0x5')];_0x36de42<_0x554424;_0x36de42++){var _0x2db2cd=events[_0x36de42];var _0x86b612=createListener('mailMessage:'+_0x2db2cd,_0x7acf58);MailMessageEvents['on'](_0x2db2cd,_0x86b612);}}; \ No newline at end of file +var _0x4ccc=['mailMessage:','remove','emit','removeListener','register'];(function(_0x57751e,_0x25e351){var _0x5bf699=function(_0x4a84f7){while(--_0x4a84f7){_0x57751e['push'](_0x57751e['shift']());}};_0x5bf699(++_0x25e351);}(_0x4ccc,0x137));var _0xc4cc=function(_0xaadfdf,_0x18a2c0){_0xaadfdf=_0xaadfdf-0x0;var _0x23aa75=_0x4ccc[_0xaadfdf];return _0x23aa75;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0xc4cc('0x0'),'update'];function createListener(_0x50910d,_0x7b783d){return function(_0x2cfbc1){_0x7b783d[_0xc4cc('0x1')](_0x50910d,_0x2cfbc1);};}function removeListener(_0x4d531a,_0x1421f1){return function(){MailMessageEvents[_0xc4cc('0x2')](_0x4d531a,_0x1421f1);};}exports[_0xc4cc('0x3')]=function(_0x492e3c){for(var _0x3cd283=0x0,_0x5913cb=events['length'];_0x3cd283<_0x5913cb;_0x3cd283++){var _0x37cb35=events[_0x3cd283];var _0x5f03a0=createListener(_0xc4cc('0x4')+_0x37cb35,_0x492e3c);MailMessageEvents['on'](_0x37cb35,_0x5f03a0);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6a03b18..d6f8e35 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 _0x520c=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put'];(function(_0xa5a43c,_0x3ca368){var _0x217ce0=function(_0x1dd15f){while(--_0x1dd15f){_0xa5a43c['push'](_0xa5a43c['shift']());}};_0x217ce0(++_0x3ca368);}(_0x520c,0x1d6));var _0xc520=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x520c[_0x24392f];return _0x591e33;};'use strict';var multer=require(_0xc520('0x0'));var util=require(_0xc520('0x1'));var path=require('path');var timeout=require(_0xc520('0x2'));var express=require(_0xc520('0x3'));var router=express[_0xc520('0x4')]();var fs_extra=require(_0xc520('0x5'));var auth=require(_0xc520('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc520('0x7'));router['get']('/',auth[_0xc520('0x8')](),controller[_0xc520('0x9')]);router[_0xc520('0xa')]('/describe',auth[_0xc520('0x8')](),controller[_0xc520('0xb')]);router[_0xc520('0xa')](_0xc520('0xc'),auth[_0xc520('0x8')](),controller[_0xc520('0xd')]);router[_0xc520('0xa')](_0xc520('0xe'),auth[_0xc520('0x8')](),controller[_0xc520('0xf')]);router[_0xc520('0xa')](_0xc520('0x10'),auth[_0xc520('0x8')](),controller[_0xc520('0x11')]);router[_0xc520('0xa')](_0xc520('0x12'),auth[_0xc520('0x8')](),controller[_0xc520('0x13')]);router[_0xc520('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc520('0x10'),auth[_0xc520('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0xc520('0x8')](),controller[_0xc520('0x15')]);router[_0xc520('0x16')](_0xc520('0xc'),auth[_0xc520('0x8')](),controller[_0xc520('0x17')]);router[_0xc520('0x18')]('/:id',auth[_0xc520('0x8')](),controller[_0xc520('0x19')]);router[_0xc520('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc520('0x1a')]);router[_0xc520('0x18')](_0xc520('0x12'),auth[_0xc520('0x8')](),controller[_0xc520('0x1b')]);module[_0xc520('0x1c')]=router; \ No newline at end of file +var _0x7509=['post','create','addAgents','put','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x5c7d97,_0x41768c){var _0x60b30d=function(_0x40a7e9){while(--_0x40a7e9){_0x5c7d97['push'](_0x5c7d97['shift']());}};_0x60b30d(++_0x41768c);}(_0x7509,0xd8));var _0x9750=function(_0x1f29bd,_0x260de3){_0x1f29bd=_0x1f29bd-0x0;var _0xee0281=_0x7509[_0x1f29bd];return _0xee0281;};'use strict';var multer=require(_0x9750('0x0'));var util=require('util');var path=require(_0x9750('0x1'));var timeout=require(_0x9750('0x2'));var express=require(_0x9750('0x3'));var router=express[_0x9750('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9750('0x5'));var interaction=require(_0x9750('0x6'));var config=require(_0x9750('0x7'));var controller=require(_0x9750('0x8'));router[_0x9750('0x9')]('/',auth[_0x9750('0xa')](),controller[_0x9750('0xb')]);router[_0x9750('0x9')]('/describe',auth[_0x9750('0xa')](),controller['describe']);router[_0x9750('0x9')]('/:id',auth[_0x9750('0xa')](),controller[_0x9750('0xc')]);router[_0x9750('0x9')](_0x9750('0xd'),auth[_0x9750('0xa')](),controller[_0x9750('0xe')]);router[_0x9750('0x9')](_0x9750('0xf'),auth['isAuthenticated'](),controller[_0x9750('0x10')]);router[_0x9750('0x9')](_0x9750('0x11'),auth[_0x9750('0xa')](),controller['getAgents']);router[_0x9750('0x12')]('/',auth[_0x9750('0xa')](),controller[_0x9750('0x13')]);router[_0x9750('0x12')](_0x9750('0xf'),auth[_0x9750('0xa')](),controller['addTeams']);router[_0x9750('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x9750('0x14')]);router[_0x9750('0x15')]('/:id',auth[_0x9750('0xa')](),controller['update']);router[_0x9750('0x16')]('/:id',auth[_0x9750('0xa')](),controller[_0x9750('0x17')]);router[_0x9750('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x9750('0x16')]('/:id/users',auth[_0x9750('0xa')](),controller[_0x9750('0x18')]);module[_0x9750('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 a5e1099..ab22440 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 _0xdead=['roundrobin','sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdead,0x1eb));var _0xddea=function(_0x3a966d,_0x3646e1){_0x3a966d=_0x3a966d-0x0;var _0x347523=_0xdead[_0x3a966d];return _0x347523;};'use strict';var Sequelize=require(_0xddea('0x0'));module[_0xddea('0x1')]={'name':{'type':Sequelize[_0xddea('0x2')],'unique':_0xddea('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xddea('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xddea('0x4'),_0xddea('0x5'),_0xddea('0x6'))}}; \ No newline at end of file +var _0x28e8=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x424aec,_0x3e0a46){var _0x427580=function(_0x19c7e6){while(--_0x19c7e6){_0x424aec['push'](_0x424aec['shift']());}};_0x427580(++_0x3e0a46);}(_0x28e8,0x14a));var _0x828e=function(_0x45d1d0,_0x3ca9df){_0x45d1d0=_0x45d1d0-0x0;var _0x2ff58d=_0x28e8[_0x45d1d0];return _0x2ff58d;};'use strict';var Sequelize=require(_0x828e('0x0'));module[_0x828e('0x1')]={'name':{'type':Sequelize[_0x828e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x828e('0x2')]},'timeout':{'type':Sequelize[_0x828e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x828e('0x4'),_0x828e('0x5'),_0x828e('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 154c9ac..69676e9 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 _0x92aa=['then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','MailQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','findOne','UserMailQueue','order','User','findAndCountAll','UserId','updatedAt','format','%s/%s','SIP','mailPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x92aa,0xf3));var _0xa92a=function(_0x3552ba,_0x2efbaa){_0x3552ba=_0x3552ba-0x0;var _0x5ded86=_0x92aa[_0x3552ba];return _0x5ded86;};'use strict';var emlformat=require(_0xa92a('0x0'));var rimraf=require(_0xa92a('0x1'));var zipdir=require(_0xa92a('0x2'));var jsonpatch=require(_0xa92a('0x3'));var rp=require(_0xa92a('0x4'));var moment=require('moment');var BPromise=require(_0xa92a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa92a('0x6'));var sox=require('sox');var csv=require(_0xa92a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa92a('0x8'));var squel=require(_0xa92a('0x9'));var crypto=require('crypto');var jsforce=require(_0xa92a('0xa'));var deskjs=require(_0xa92a('0xb'));var toCsv=require(_0xa92a('0x7'));var querystring=require(_0xa92a('0xc'));var Papa=require(_0xa92a('0xd'));var Redis=require('ioredis');var authService=require(_0xa92a('0xe'));var qs=require(_0xa92a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa92a('0x10'));var logger=require(_0xa92a('0x11'))(_0xa92a('0x12'));var utils=require('../../config/utils');var config=require(_0xa92a('0x13'));var licenseUtil=require(_0xa92a('0x14'));var db=require(_0xa92a('0x15'))['db'];config[_0xa92a('0x16')]=_[_0xa92a('0x17')](config[_0xa92a('0x16')],{'host':_0xa92a('0x18'),'port':0x18eb});var socket=require(_0xa92a('0x19'))(new Redis(config[_0xa92a('0x16')]));require(_0xa92a('0x1a'))[_0xa92a('0x1b')](socket);function respondWithStatusCode(_0x3ae339,_0x4e09bd){_0x4e09bd=_0x4e09bd||0xcc;return function(_0x5ed07c){if(_0x5ed07c){return _0x3ae339['sendStatus'](_0x4e09bd);}return _0x3ae339[_0xa92a('0x1c')](_0x4e09bd)[_0xa92a('0x1d')]();};}function respondWithResult(_0x2508eb,_0x45f89c){_0x45f89c=_0x45f89c||0xc8;return function(_0x1a8c3d){if(_0x1a8c3d){return _0x2508eb[_0xa92a('0x1c')](_0x45f89c)[_0xa92a('0x1e')](_0x1a8c3d);}};}function respondWithFilteredResult(_0x296713,_0xf0665f){return function(_0x371f1a){if(_0x371f1a){var _0x5284de=typeof _0xf0665f[_0xa92a('0x1f')]===_0xa92a('0x20')&&typeof _0xf0665f['limit']==='undefined';var _0x3d0365=_0x371f1a[_0xa92a('0x21')];var _0x54a0da=_0x5284de?0x0:_0xf0665f[_0xa92a('0x1f')];var _0x49b393=_0x5284de?_0x371f1a[_0xa92a('0x21')]:_0xf0665f['offset']+_0xf0665f[_0xa92a('0x22')];var _0x394ddc;if(_0x49b393>=_0x3d0365){_0x49b393=_0x3d0365;_0x394ddc=0xc8;}else{_0x394ddc=0xce;}_0x296713[_0xa92a('0x1c')](_0x394ddc);return _0x296713[_0xa92a('0x23')](_0xa92a('0x24'),_0x54a0da+'-'+_0x49b393+'/'+_0x3d0365)[_0xa92a('0x1e')](_0x371f1a);}return null;};}function patchUpdates(_0x26f7f3){return function(_0x4b1c13){try{jsonpatch[_0xa92a('0x25')](_0x4b1c13,_0x26f7f3,!![]);}catch(_0x1596fc){return BPromise['reject'](_0x1596fc);}return _0x4b1c13[_0xa92a('0x26')]();};}function saveUpdates(_0x2f69c4,_0x4d44de){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260['update'](_0x2f69c4)[_0xa92a('0x27')](function(_0x120508){return _0x120508;});}return null;};}function removeEntity(_0x3d54c0,_0x3c4ab6){return function(_0x2668ba){if(_0x2668ba){return _0x2668ba[_0xa92a('0x28')]()[_0xa92a('0x27')](function(){var _0x53d560=_0x2668ba[_0xa92a('0x29')]({'plain':!![]});var _0x52b039=_0xa92a('0x2a');return db[_0xa92a('0x2b')][_0xa92a('0x28')]({'where':{'type':_0x52b039,'resourceId':_0x53d560['id']}})[_0xa92a('0x27')](function(){return _0x2668ba;});})['then'](function(){_0x3d54c0[_0xa92a('0x1c')](0xcc)[_0xa92a('0x1d')]();});}};}function handleEntityNotFound(_0x3a88e5,_0x3c099b){return function(_0x45a77d){if(!_0x45a77d){_0x3a88e5[_0xa92a('0x2c')](0x194);}return _0x45a77d;};}function handleError(_0x2767b8,_0x14b096){_0x14b096=_0x14b096||0x1f4;return function(_0x1fc7fa){logger[_0xa92a('0x2d')](_0x1fc7fa[_0xa92a('0x2e')]);if(_0x1fc7fa[_0xa92a('0x2f')]){delete _0x1fc7fa['name'];}_0x2767b8[_0xa92a('0x1c')](_0x14b096)[_0xa92a('0x30')](_0x1fc7fa);};}exports['index']=function(_0x56aa62,_0x3a9ac1){var _0xfc97eb={},_0x2db05a={},_0x15fc49={'count':0x0,'rows':[]};var _0x32fef4=_['map'](db[_0xa92a('0x31')][_0xa92a('0x32')],function(_0x1d2d74){return{'name':_0x1d2d74['fieldName'],'type':_0x1d2d74[_0xa92a('0x33')][_0xa92a('0x34')]};});_0x2db05a[_0xa92a('0x35')]=_['map'](_0x32fef4,_0xa92a('0x2f'));_0x2db05a[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x56aa62[_0xa92a('0x36')]);_0x2db05a[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x2db05a[_0xa92a('0x35')],_0x2db05a['query']);_0xfc97eb['attributes']=_['intersection'](_0x2db05a[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x56aa62[_0xa92a('0x36')]['fields']));_0xfc97eb[_0xa92a('0x3b')]=_0xfc97eb['attributes']['length']?_0xfc97eb['attributes']:_0x2db05a['model'];if(!_0x56aa62[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0xfc97eb[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x56aa62['query'][_0xa92a('0x22')]);_0xfc97eb[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x56aa62[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0xfc97eb['order']=qs[_0xa92a('0x3e')](_0x56aa62['query'][_0xa92a('0x3e')]);_0xfc97eb[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x56aa62[_0xa92a('0x36')],_0x2db05a['filters']),_0x32fef4);if(_0x56aa62[_0xa92a('0x36')]['filter']){_0xfc97eb[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0xfc97eb['where'],{'$or':_[_0xa92a('0x42')](_0x32fef4,function(_0x197aa9){if(_0x197aa9[_0xa92a('0x33')]!==_0xa92a('0x43')){var _0x4ef6ac={};_0x4ef6ac[_0x197aa9[_0xa92a('0x2f')]]={'$like':'%'+_0x56aa62['query'][_0xa92a('0x44')]+'%'};return _0x4ef6ac;}})});}_0xfc97eb=_[_0xa92a('0x41')]({},_0xfc97eb,_0x56aa62[_0xa92a('0x45')]);var _0x4c348c={'where':_0xfc97eb['where']};return db[_0xa92a('0x31')][_0xa92a('0x21')](_0x4c348c)['then'](function(_0x1945e1){_0x15fc49['count']=_0x1945e1;if(_0x56aa62['query'][_0xa92a('0x46')]){_0xfc97eb[_0xa92a('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0xa92a('0x48')](_0xfc97eb);})[_0xa92a('0x27')](function(_0x2bbaa3){_0x15fc49[_0xa92a('0x49')]=_0x2bbaa3;return _0x15fc49;})[_0xa92a('0x27')](respondWithFilteredResult(_0x3a9ac1,_0xfc97eb))['catch'](handleError(_0x3a9ac1,null));};exports[_0xa92a('0x4a')]=function(_0x3990cd,_0x5a83ea){var _0x4187ee={'raw':!![],'where':{'id':_0x3990cd['params']['id']}},_0x15d843={};_0x15d843[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x31')][_0xa92a('0x32')]);_0x15d843['query']=_[_0xa92a('0x37')](_0x3990cd[_0xa92a('0x36')]);_0x15d843['filters']=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],_0x15d843['query']);_0x4187ee[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x15d843[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x3990cd['query']['fields']));_0x4187ee[_0xa92a('0x3b')]=_0x4187ee[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x4187ee['attributes']:_0x15d843[_0xa92a('0x35')];if(_0x3990cd[_0xa92a('0x36')][_0xa92a('0x46')]){_0x4187ee[_0xa92a('0x47')]=[{'all':!![]}];}_0x4187ee=_['merge']({},_0x4187ee,_0x3990cd['options']);return db[_0xa92a('0x31')][_0xa92a('0x4c')](_0x4187ee)['then'](handleEntityNotFound(_0x5a83ea,null))['then'](respondWithResult(_0x5a83ea,null))[_0xa92a('0x4d')](handleError(_0x5a83ea,null));};exports[_0xa92a('0x4e')]=function(_0x57c05a,_0x396375){return db[_0xa92a('0x31')][_0xa92a('0x4e')](_0x57c05a['body'],{})[_0xa92a('0x27')](function(_0x41ab32){var _0x3c0ffa=_0x57c05a[_0xa92a('0x4f')]['get']({'plain':!![]});if(!_0x3c0ffa)throw new Error(_0xa92a('0x50'));if(_0x3c0ffa['role']==='user'){var _0x294094=_0x41ab32['get']({'plain':!![]});var _0x38d359=_0xa92a('0x2a');return db[_0xa92a('0x51')][_0xa92a('0x4c')]({'where':{'name':_0x38d359,'userProfileId':_0x3c0ffa['userProfileId']},'raw':!![]})[_0xa92a('0x27')](function(_0x134acb){if(_0x134acb&&_0x134acb[_0xa92a('0x52')]===0x0){return db[_0xa92a('0x2b')][_0xa92a('0x4e')]({'name':_0x294094[_0xa92a('0x2f')],'resourceId':_0x294094['id'],'type':_0x134acb[_0xa92a('0x2f')],'sectionId':_0x134acb['id']},{})[_0xa92a('0x27')](function(){return _0x41ab32;});}else{return _0x41ab32;}})['catch'](function(_0x3b1a12){logger[_0xa92a('0x2d')](_0xa92a('0x53'),_0x3b1a12);throw _0x3b1a12;});}return _0x41ab32;})[_0xa92a('0x27')](respondWithResult(_0x396375,0xc9))[_0xa92a('0x4d')](handleError(_0x396375,null));};exports[_0xa92a('0x54')]=function(_0x75e033,_0x2b61e2){if(_0x75e033['body']['id']){delete _0x75e033[_0xa92a('0x55')]['id'];}return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x75e033[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x2b61e2,null))[_0xa92a('0x27')](saveUpdates(_0x75e033[_0xa92a('0x55')],null))[_0xa92a('0x27')](respondWithResult(_0x2b61e2,null))['catch'](handleError(_0x2b61e2,null));};exports[_0xa92a('0x28')]=function(_0x329962,_0x442850){return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x329962[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x442850,null))[_0xa92a('0x27')](removeEntity(_0x442850,null))['catch'](handleError(_0x442850,null));};exports[_0xa92a('0x57')]=function(_0x30eaca,_0x11d71b){return db[_0xa92a('0x31')][_0xa92a('0x57')]()[_0xa92a('0x27')](respondWithResult(_0x11d71b,null))['catch'](handleError(_0x11d71b,null));};exports[_0xa92a('0x58')]=function(_0x58cbfe,_0x211ed9,_0x2e94ff){var _0x23a71d={'raw':!![],'where':{}},_0x234821={},_0x29e9ef;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x58cbfe[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x211ed9,null))['then'](function(_0x1b5d8d){if(_0x1b5d8d){_0x29e9ef=_0x1b5d8d[_0xa92a('0x29')]({'plain':!![]});_0x234821[_0xa92a('0x35')]=_[_0xa92a('0x37')](db[_0xa92a('0x5a')][_0xa92a('0x32')]);_0x234821[_0xa92a('0x36')]=_[_0xa92a('0x37')](_0x58cbfe[_0xa92a('0x36')]);_0x234821[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x234821['model'],_0x234821[_0xa92a('0x36')]);_0x23a71d['attributes']=_['intersection'](_0x234821[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x58cbfe['query']['fields']));_0x23a71d[_0xa92a('0x3b')]=_0x23a71d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x23a71d[_0xa92a('0x3b')]:_0x234821[_0xa92a('0x35')];if(!_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x3c')](_0xa92a('0x3d'))){_0x23a71d[_0xa92a('0x22')]=qs[_0xa92a('0x22')](_0x58cbfe[_0xa92a('0x36')]['limit']);_0x23a71d['offset']=qs[_0xa92a('0x1f')](_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x1f')]);}_0x23a71d[_0xa92a('0x5b')]=qs['sort'](_0x58cbfe[_0xa92a('0x36')]['sort']);_0x23a71d[_0xa92a('0x3f')]=qs['filters'](_[_0xa92a('0x40')](_0x58cbfe[_0xa92a('0x36')],_0x234821[_0xa92a('0x38')]));_0x23a71d[_0xa92a('0x3f')]['MailQueueId']=_0x1b5d8d['id'];if(_0x58cbfe[_0xa92a('0x36')]['filter']){_0x23a71d[_0xa92a('0x3f')]=_['merge'](_0x23a71d['where'],{'$or':_[_0xa92a('0x42')](_0x23a71d[_0xa92a('0x3b')],function(_0x255470){var _0x5e7490={};_0x5e7490[_0x255470]={'$like':'%'+_0x58cbfe[_0xa92a('0x36')][_0xa92a('0x44')]+'%'};return _0x5e7490;})});}_0x23a71d=_[_0xa92a('0x41')]({},_0x23a71d,_0x58cbfe[_0xa92a('0x45')]);return db[_0xa92a('0x5a')][_0xa92a('0x48')](_0x23a71d);}})[_0xa92a('0x27')](function(_0x397ac0){if(_0x397ac0){return db[_0xa92a('0x5c')][_0xa92a('0x5d')]({'where':{'id':_[_0xa92a('0x42')](_0x397ac0,_0xa92a('0x5e')),'role':'agent'},'attributes':['id','name','mailPause',_0xa92a('0x5f'),'createdAt']});}})['then'](function(_0x502076){if(_0x502076){return{'count':_0x502076[_0xa92a('0x21')],'rows':_['map'](_0x502076['rows'],function(_0x4a42a4){return{'membername':_0x4a42a4[_0xa92a('0x2f')],'UserId':_0x4a42a4['id'],'queue_name':_0x29e9ef[_0xa92a('0x2f')],'MailQueueId':_0x29e9ef['id'],'interface':util[_0xa92a('0x60')](_0xa92a('0x61'),_0xa92a('0x62'),_0x4a42a4[_0xa92a('0x2f')]),'penalty':0x0,'paused':_0x4a42a4[_0xa92a('0x63')],'createdAt':_0x4a42a4[_0xa92a('0x64')],'updatedAt':_0x4a42a4[_0xa92a('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa92a('0x27')](respondWithFilteredResult(_0x211ed9,_0x23a71d))[_0xa92a('0x4d')](handleError(_0x211ed9,null));};exports[_0xa92a('0x65')]=function(_0x4a39ba,_0x3b2294,_0x23fd09){var _0x3e8d7d={};var _0x339ebf={};var _0x21dd17;var _0x40ae03;return db[_0xa92a('0x31')][_0xa92a('0x59')]({'where':{'id':_0x4a39ba[_0xa92a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b2294,null))[_0xa92a('0x27')](function(_0x499aa4){if(_0x499aa4){_0x21dd17=_0x499aa4;_0x339ebf[_0xa92a('0x35')]=_['keys'](db[_0xa92a('0x66')][_0xa92a('0x32')]);_0x339ebf['query']=_[_0xa92a('0x37')](_0x4a39ba[_0xa92a('0x36')]);_0x339ebf[_0xa92a('0x38')]=_[_0xa92a('0x39')](_0x339ebf['model'],_0x339ebf[_0xa92a('0x36')]);_0x3e8d7d[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x339ebf['model'],qs[_0xa92a('0x3a')](_0x4a39ba[_0xa92a('0x36')]['fields']));_0x3e8d7d[_0xa92a('0x3b')]=_0x3e8d7d[_0xa92a('0x3b')][_0xa92a('0x4b')]?_0x3e8d7d[_0xa92a('0x3b')]:_0x339ebf[_0xa92a('0x35')];_0x3e8d7d[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4a39ba['query']['sort']);_0x3e8d7d['where']=qs['filters'](_[_0xa92a('0x40')](_0x4a39ba[_0xa92a('0x36')],_0x339ebf[_0xa92a('0x38')]));if(_0x4a39ba[_0xa92a('0x36')]['filter']){_0x3e8d7d['where']=_[_0xa92a('0x41')](_0x3e8d7d[_0xa92a('0x3f')],{'$or':_[_0xa92a('0x42')](_0x3e8d7d[_0xa92a('0x3b')],function(_0x4cce09){var _0x1f8a0b={};_0x1f8a0b[_0x4cce09]={'$like':'%'+_0x4a39ba['query']['filter']+'%'};return _0x1f8a0b;})});}_0x3e8d7d=_[_0xa92a('0x41')]({},_0x3e8d7d,_0x4a39ba['options']);return _0x21dd17['getTeams'](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x2ae688){if(_0x2ae688){_0x40ae03=_0x2ae688[_0xa92a('0x4b')];if(!_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x3c')]('nolimit')){_0x3e8d7d[_0xa92a('0x22')]=qs['limit'](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x22')]);_0x3e8d7d[_0xa92a('0x1f')]=qs[_0xa92a('0x1f')](_0x4a39ba[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x21dd17[_0xa92a('0x65')](_0x3e8d7d);}})[_0xa92a('0x27')](function(_0x475f45){if(_0x475f45){return _0x475f45?{'count':_0x40ae03,'rows':_0x475f45}:null;}})[_0xa92a('0x27')](respondWithResult(_0x3b2294,null))[_0xa92a('0x4d')](handleError(_0x3b2294,null));};exports[_0xa92a('0x67')]=function(_0x598fd9,_0x3224f5,_0x1ac685){var _0x5b32c0=_0x598fd9[_0xa92a('0x55')][_0xa92a('0x68')];return db[_0xa92a('0x66')][_0xa92a('0x48')]({'where':{'id':_0x5b32c0},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':'Agents','attributes':['id','name',_0xa92a('0x69'),_0xa92a('0x6a'),_0xa92a('0x6b')],'raw':!![]}]})[_0xa92a('0x27')](function(_0x21759d){if(_0x21759d){var _0x348c2b=_[_0xa92a('0x6c')](_0x21759d,function(_0x35574b){var _0x49b4d8=_0x35574b[_0xa92a('0x29')]({'plain':!![]});return _0x49b4d8[_0xa92a('0x6d')];});return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x598fd9['params']['id']}})['then'](function(_0x20053d){return db['sequelize']['transaction'](function(_0x2289d7){return _0x20053d[_0xa92a('0x67')](_0x5b32c0,{'transaction':_0x2289d7})[_0xa92a('0x27')](function(){return BPromise['each'](_0x348c2b,function(_0x48ad3b){return db[_0xa92a('0x5a')][_0xa92a('0x6e')]({'where':{'UserId':_0x48ad3b['id'],'MailQueueId':_0x598fd9['params']['id']},'transaction':_0x2289d7});});})[_0xa92a('0x27')](function(){_0x348c2b[_0xa92a('0x6f')](function(_0x20cea2){socket['emit']('userMailQueue:save',{'UserId':_0x20cea2['id'],'MailQueueId':_0x20053d['id']});});});});});}})[_0xa92a('0x27')](respondWithStatusCode(_0x3224f5,null))[_0xa92a('0x4d')](handleError(_0x3224f5,null));};exports['removeTeams']=function(_0x1d0ffb,_0x51d9c1,_0xc95e25){return db[_0xa92a('0x66')]['findAll']({'where':{'id':_0x1d0ffb[_0xa92a('0x36')][_0xa92a('0x68')]},'attributes':['id'],'include':[{'model':db[_0xa92a('0x5c')],'as':_0xa92a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xa92a('0x27')](handleEntityNotFound(_0x51d9c1,null))[_0xa92a('0x27')](function(_0x182392){var _0x22098c=_[_0xa92a('0x42')](_0x182392,'id');var _0x5dcb02=[];var _0x447174=[];var _0x854d34=squel[_0xa92a('0x70')]();_0x854d34[_0xa92a('0x71')](_0xa92a('0x72'))[_0xa92a('0x73')](_0xa92a('0x74'),'tq')[_0xa92a('0x75')]('user_has_teams','ut',_0xa92a('0x76'))[_0xa92a('0x3f')](_0xa92a('0x77'),_0x1d0ffb['params']['id']);for(var _0x45eb91=0x0;_0x45eb91<_0x182392['length'];_0x45eb91+=0x1){let _0x1227c9=_0x182392[_0x45eb91];for(var _0x422292=0x0;_0x422292<_0x1227c9[_0xa92a('0x6d')][_0xa92a('0x4b')];_0x422292+=0x1){let _0x140011=_0x1227c9['Agents'][_0x422292];var _0x4e08cd=_0x854d34['clone']();_0x4e08cd[_0xa92a('0x3f')](_0xa92a('0x78'),_0x140011['id']);_0x447174['push'](db[_0xa92a('0x79')]['query'](_0x4e08cd[_0xa92a('0x7a')](),{'type':db[_0xa92a('0x79')][_0xa92a('0x7b')][_0xa92a('0x7c')]})[_0xa92a('0x27')](function(_0xfbdc14){if(_0xfbdc14[_0xa92a('0x4b')]===0x1){return _0x140011['id'];}else{var _0x457589=_[_0xa92a('0x7d')](_[_0xa92a('0x42')](_0xfbdc14,_0xa92a('0x7e')),function(_0x45530c){return _['includes'](_0x22098c,_0x45530c);});if(_0x457589){return _0x140011['id'];}}}));}}return BPromise[_0xa92a('0x7f')](_0x447174)[_0xa92a('0x27')](function(_0x454856){_0x5dcb02=_(_0x5dcb02)[_0xa92a('0x80')](_0x454856)[_0xa92a('0x81')]()[_0xa92a('0x82')]();return db[_0xa92a('0x31')][_0xa92a('0x4c')]({'where':{'id':_0x1d0ffb['params']['id']}})[_0xa92a('0x27')](function(_0x42a03e){return db['sequelize']['transaction'](function(_0x59162a){return _0x42a03e[_0xa92a('0x83')](_0x1d0ffb['query'][_0xa92a('0x68')],{'transaction':_0x59162a})[_0xa92a('0x27')](function(){if(!_[_0xa92a('0x84')](_0x5dcb02)){return _0x42a03e[_0xa92a('0x85')](_0x5dcb02,{'transaction':_0x59162a});}})['then'](function(){_0x5dcb02['forEach'](function(_0xf87576){socket[_0xa92a('0x86')](_0xa92a('0x87'),{'UserId':_0xf87576,'MailQueueId':_0x42a03e['id']});});});});});});})[_0xa92a('0x27')](respondWithStatusCode(_0x51d9c1,null))[_0xa92a('0x4d')](handleError(_0x51d9c1,null));};exports[_0xa92a('0x88')]=function(_0x2f8b15,_0x54d9b1,_0x1c49ad){return db['MailQueue'][_0xa92a('0x4c')]({'where':{'id':_0x2f8b15[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x54d9b1,null))[_0xa92a('0x27')](function(_0x1acdb7){if(_0x1acdb7){return _0x1acdb7['addAgents'](_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')],_[_0xa92a('0x89')](_0x2f8b15[_0xa92a('0x55')],['ids','id'])||{})[_0xa92a('0x8a')](function(_0x47627d){for(var _0x51a10c=0x0;_0x51a10c<_0x2f8b15[_0xa92a('0x55')]['ids'][_0xa92a('0x4b')];_0x51a10c+=0x1){socket[_0xa92a('0x86')](_0xa92a('0x8b'),{'UserId':Number(_0x2f8b15[_0xa92a('0x55')][_0xa92a('0x68')][_0x51a10c]),'MailQueueId':Number(_0x2f8b15['params']['id'])});}return _0x47627d;});}})[_0xa92a('0x27')](respondWithResult(_0x54d9b1,null))['catch'](handleError(_0x54d9b1,null));};exports['removeAgents']=function(_0x2c66ae,_0x259647,_0x17e988){return db[_0xa92a('0x31')]['find']({'where':{'id':_0x2c66ae[_0xa92a('0x56')]['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x259647,null))[_0xa92a('0x27')](function(_0x32e31d){if(_0x32e31d){return _0x32e31d['removeAgents'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])[_0xa92a('0x27')](function(){if(_['isArray'](_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')])){for(var _0x11785f=0x0;_0x11785f<_0x2c66ae['query'][_0xa92a('0x68')][_0xa92a('0x4b')];_0x11785f+=0x1){socket[_0xa92a('0x86')]('userMailQueue:remove',{'UserId':Number(_0x2c66ae[_0xa92a('0x36')][_0xa92a('0x68')][_0x11785f]),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}}else{socket['emit'](_0xa92a('0x87'),{'UserId':Number(_0x2c66ae[_0xa92a('0x36')]['ids']),'MailQueueId':Number(_0x2c66ae[_0xa92a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x259647,null))[_0xa92a('0x4d')](handleError(_0x259647,null));};exports[_0xa92a('0x8c')]=function(_0x4192ce,_0x4e47aa,_0x491cdc){var _0x14f2c7={};var _0x4f37b4={};var _0x38d2f5;var _0x37a446;return db['MailQueue'][_0xa92a('0x59')]({'where':{'id':_0x4192ce['params']['id']}})[_0xa92a('0x27')](handleEntityNotFound(_0x4e47aa,null))[_0xa92a('0x27')](function(_0x4ac9bb){if(_0x4ac9bb){_0x38d2f5=_0x4ac9bb;_0x4f37b4['model']=_[_0xa92a('0x37')](db[_0xa92a('0x5c')]['rawAttributes']);_0x4f37b4['query']=_['keys'](_0x4192ce[_0xa92a('0x36')]);_0x4f37b4[_0xa92a('0x38')]=_['intersection'](_0x4f37b4[_0xa92a('0x35')],_0x4f37b4[_0xa92a('0x36')]);_0x14f2c7[_0xa92a('0x3b')]=_[_0xa92a('0x39')](_0x4f37b4[_0xa92a('0x35')],qs[_0xa92a('0x3a')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3a')]));_0x14f2c7['attributes']=_0x14f2c7[_0xa92a('0x3b')]['length']?_0x14f2c7['attributes']:_0x4f37b4[_0xa92a('0x35')];_0x14f2c7[_0xa92a('0x5b')]=qs[_0xa92a('0x3e')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x3e')]);_0x14f2c7[_0xa92a('0x3f')]=qs[_0xa92a('0x38')](_[_0xa92a('0x40')](_0x4192ce[_0xa92a('0x36')],_0x4f37b4[_0xa92a('0x38')]));if(_0x4192ce[_0xa92a('0x36')][_0xa92a('0x44')]){_0x14f2c7[_0xa92a('0x3f')]=_[_0xa92a('0x41')](_0x14f2c7['where'],{'$or':_[_0xa92a('0x42')](_0x14f2c7[_0xa92a('0x3b')],function(_0x42f105){var _0xffabc={};_0xffabc[_0x42f105]={'$like':'%'+_0x4192ce['query']['filter']+'%'};return _0xffabc;})});}_0x14f2c7=_['merge']({},_0x14f2c7,_0x4192ce[_0xa92a('0x45')]);return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xace0ed){if(_0xace0ed){_0x37a446=_0xace0ed['length'];if(!_0x4192ce[_0xa92a('0x36')]['hasOwnProperty'](_0xa92a('0x3d'))){_0x14f2c7[_0xa92a('0x22')]=qs['limit'](_0x4192ce[_0xa92a('0x36')]['limit']);_0x14f2c7['offset']=qs[_0xa92a('0x1f')](_0x4192ce[_0xa92a('0x36')][_0xa92a('0x1f')]);}return _0x38d2f5[_0xa92a('0x8c')](_0x14f2c7);}})[_0xa92a('0x27')](function(_0xe86501){if(_0xe86501){return _0xe86501?{'count':_0x37a446,'rows':_0xe86501}:null;}})['then'](respondWithResult(_0x4e47aa,null))[_0xa92a('0x4d')](handleError(_0x4e47aa,null));}; \ No newline at end of file +var _0x554d=['addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','select','field','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','MailQueue','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','rawAttributes','hasOwnProperty','MailQueueId','UserMailQueue','User','findAndCountAll','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team'];(function(_0x15b03,_0xd98e46){var _0x294a1c=function(_0x20d399){while(--_0x20d399){_0x15b03['push'](_0x15b03['shift']());}};_0x294a1c(++_0xd98e46);}(_0x554d,0x1c8));var _0xd554=function(_0x24a711,_0x2c44e7){_0x24a711=_0x24a711-0x0;var _0x24dad5=_0x554d[_0x24a711];return _0x24dad5;};'use strict';var emlformat=require(_0xd554('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd554('0x1'));var jsonpatch=require(_0xd554('0x2'));var rp=require('request-promise');var moment=require(_0xd554('0x3'));var BPromise=require(_0xd554('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd554('0x5'));var csv=require('to-csv');var ejs=require(_0xd554('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd554('0x7'));var squel=require(_0xd554('0x8'));var crypto=require(_0xd554('0x9'));var jsforce=require(_0xd554('0xa'));var deskjs=require(_0xd554('0xb'));var toCsv=require(_0xd554('0xc'));var querystring=require(_0xd554('0xd'));var Papa=require(_0xd554('0xe'));var Redis=require(_0xd554('0xf'));var authService=require(_0xd554('0x10'));var qs=require(_0xd554('0x11'));var as=require(_0xd554('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd554('0x13'))(_0xd554('0x14'));var utils=require(_0xd554('0x15'));var config=require(_0xd554('0x16'));var licenseUtil=require(_0xd554('0x17'));var db=require(_0xd554('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd554('0x19'),'port':0x18eb});var socket=require(_0xd554('0x1a'))(new Redis(config[_0xd554('0x1b')]));require('./mailQueue.socket')[_0xd554('0x1c')](socket);function respondWithStatusCode(_0x47ce18,_0x4dfb93){_0x4dfb93=_0x4dfb93||0xcc;return function(_0x49db13){if(_0x49db13){return _0x47ce18['sendStatus'](_0x4dfb93);}return _0x47ce18[_0xd554('0x1d')](_0x4dfb93)[_0xd554('0x1e')]();};}function respondWithResult(_0x45fd61,_0x48be68){_0x48be68=_0x48be68||0xc8;return function(_0x425d58){if(_0x425d58){return _0x45fd61[_0xd554('0x1d')](_0x48be68)[_0xd554('0x1f')](_0x425d58);}};}function respondWithFilteredResult(_0x1d1e64,_0x3e69f2){return function(_0x25b309){if(_0x25b309){var _0x2e59a7=typeof _0x3e69f2[_0xd554('0x20')]===_0xd554('0x21')&&typeof _0x3e69f2[_0xd554('0x22')]===_0xd554('0x21');var _0x19b387=_0x25b309[_0xd554('0x23')];var _0x33f978=_0x2e59a7?0x0:_0x3e69f2[_0xd554('0x20')];var _0x4acf67=_0x2e59a7?_0x25b309[_0xd554('0x23')]:_0x3e69f2[_0xd554('0x20')]+_0x3e69f2[_0xd554('0x22')];var _0x3d54d9;if(_0x4acf67>=_0x19b387){_0x4acf67=_0x19b387;_0x3d54d9=0xc8;}else{_0x3d54d9=0xce;}_0x1d1e64['status'](_0x3d54d9);return _0x1d1e64[_0xd554('0x24')]('Content-Range',_0x33f978+'-'+_0x4acf67+'/'+_0x19b387)[_0xd554('0x1f')](_0x25b309);}return null;};}function patchUpdates(_0x477100){return function(_0x4edd38){try{jsonpatch['apply'](_0x4edd38,_0x477100,!![]);}catch(_0x2239a5){return BPromise[_0xd554('0x25')](_0x2239a5);}return _0x4edd38[_0xd554('0x26')]();};}function saveUpdates(_0x398ced,_0x5f26e6){return function(_0x10726d){if(_0x10726d){return _0x10726d[_0xd554('0x27')](_0x398ced)[_0xd554('0x28')](function(_0x79954e){return _0x79954e;});}return null;};}function removeEntity(_0x4432b8,_0x2044ec){return function(_0x506001){if(_0x506001){return _0x506001[_0xd554('0x29')]()[_0xd554('0x28')](function(){var _0x423545=_0x506001[_0xd554('0x2a')]({'plain':!![]});var _0x50e490=_0xd554('0x2b');return db[_0xd554('0x2c')]['destroy']({'where':{'type':_0x50e490,'resourceId':_0x423545['id']}})['then'](function(){return _0x506001;});})['then'](function(){_0x4432b8[_0xd554('0x1d')](0xcc)[_0xd554('0x1e')]();});}};}function handleEntityNotFound(_0x1caf11,_0x1c3bbf){return function(_0x6eb415){if(!_0x6eb415){_0x1caf11[_0xd554('0x2d')](0x194);}return _0x6eb415;};}function handleError(_0x4ecbb3,_0x4ea5f4){_0x4ea5f4=_0x4ea5f4||0x1f4;return function(_0x8dcac){logger[_0xd554('0x2e')](_0x8dcac[_0xd554('0x2f')]);if(_0x8dcac[_0xd554('0x30')]){delete _0x8dcac[_0xd554('0x30')];}_0x4ecbb3[_0xd554('0x1d')](_0x4ea5f4)[_0xd554('0x31')](_0x8dcac);};}exports[_0xd554('0x32')]=function(_0x4890fe,_0x43dce4){var _0x2b9913={},_0x26ac69={},_0x3b2205={'count':0x0,'rows':[]};var _0xca65ee=_['map'](db[_0xd554('0x33')]['rawAttributes'],function(_0x3b198c){return{'name':_0x3b198c[_0xd554('0x34')],'type':_0x3b198c['type'][_0xd554('0x35')]};});_0x26ac69['model']=_[_0xd554('0x36')](_0xca65ee,_0xd554('0x30'));_0x26ac69[_0xd554('0x37')]=_[_0xd554('0x38')](_0x4890fe['query']);_0x26ac69['filters']=_[_0xd554('0x39')](_0x26ac69[_0xd554('0x3a')],_0x26ac69[_0xd554('0x37')]);_0x2b9913[_0xd554('0x3b')]=_[_0xd554('0x39')](_0x26ac69[_0xd554('0x3a')],qs[_0xd554('0x3c')](_0x4890fe['query'][_0xd554('0x3c')]));_0x2b9913['attributes']=_0x2b9913[_0xd554('0x3b')][_0xd554('0x3d')]?_0x2b9913[_0xd554('0x3b')]:_0x26ac69[_0xd554('0x3a')];if(!_0x4890fe[_0xd554('0x37')]['hasOwnProperty'](_0xd554('0x3e'))){_0x2b9913[_0xd554('0x22')]=qs[_0xd554('0x22')](_0x4890fe[_0xd554('0x37')][_0xd554('0x22')]);_0x2b9913[_0xd554('0x20')]=qs[_0xd554('0x20')](_0x4890fe[_0xd554('0x37')][_0xd554('0x20')]);}_0x2b9913[_0xd554('0x3f')]=qs[_0xd554('0x40')](_0x4890fe[_0xd554('0x37')][_0xd554('0x40')]);_0x2b9913[_0xd554('0x41')]=qs['filters'](_[_0xd554('0x42')](_0x4890fe[_0xd554('0x37')],_0x26ac69[_0xd554('0x43')]),_0xca65ee);if(_0x4890fe[_0xd554('0x37')][_0xd554('0x44')]){_0x2b9913[_0xd554('0x41')]=_[_0xd554('0x45')](_0x2b9913['where'],{'$or':_[_0xd554('0x36')](_0xca65ee,function(_0x1c26f0){if(_0x1c26f0['type']!==_0xd554('0x46')){var _0x3f1328={};_0x3f1328[_0x1c26f0[_0xd554('0x30')]]={'$like':'%'+_0x4890fe[_0xd554('0x37')][_0xd554('0x44')]+'%'};return _0x3f1328;}})});}_0x2b9913=_[_0xd554('0x45')]({},_0x2b9913,_0x4890fe[_0xd554('0x47')]);var _0x969f57={'where':_0x2b9913[_0xd554('0x41')]};return db[_0xd554('0x33')][_0xd554('0x23')](_0x969f57)[_0xd554('0x28')](function(_0x59b8a4){_0x3b2205['count']=_0x59b8a4;if(_0x4890fe[_0xd554('0x37')][_0xd554('0x48')]){_0x2b9913[_0xd554('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0xd554('0x4a')](_0x2b9913);})['then'](function(_0x289954){_0x3b2205[_0xd554('0x4b')]=_0x289954;return _0x3b2205;})[_0xd554('0x28')](respondWithFilteredResult(_0x43dce4,_0x2b9913))[_0xd554('0x4c')](handleError(_0x43dce4,null));};exports[_0xd554('0x4d')]=function(_0x1fcaf3,_0x478d20){var _0x5be533={'raw':!![],'where':{'id':_0x1fcaf3[_0xd554('0x4e')]['id']}},_0x3df531={};_0x3df531[_0xd554('0x3a')]=_[_0xd554('0x38')](db['MailQueue']['rawAttributes']);_0x3df531[_0xd554('0x37')]=_[_0xd554('0x38')](_0x1fcaf3['query']);_0x3df531[_0xd554('0x43')]=_[_0xd554('0x39')](_0x3df531[_0xd554('0x3a')],_0x3df531[_0xd554('0x37')]);_0x5be533['attributes']=_['intersection'](_0x3df531['model'],qs[_0xd554('0x3c')](_0x1fcaf3[_0xd554('0x37')][_0xd554('0x3c')]));_0x5be533[_0xd554('0x3b')]=_0x5be533[_0xd554('0x3b')][_0xd554('0x3d')]?_0x5be533[_0xd554('0x3b')]:_0x3df531['model'];if(_0x1fcaf3['query']['includeAll']){_0x5be533[_0xd554('0x49')]=[{'all':!![]}];}_0x5be533=_['merge']({},_0x5be533,_0x1fcaf3[_0xd554('0x47')]);return db[_0xd554('0x33')][_0xd554('0x4f')](_0x5be533)[_0xd554('0x28')](handleEntityNotFound(_0x478d20,null))[_0xd554('0x28')](respondWithResult(_0x478d20,null))[_0xd554('0x4c')](handleError(_0x478d20,null));};exports[_0xd554('0x50')]=function(_0xebb71a,_0x4d8b33){return db[_0xd554('0x33')][_0xd554('0x50')](_0xebb71a[_0xd554('0x51')],{})['then'](function(_0x5b3b6a){var _0x108e6d=_0xebb71a[_0xd554('0x52')][_0xd554('0x2a')]({'plain':!![]});if(!_0x108e6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x108e6d[_0xd554('0x53')]===_0xd554('0x52')){var _0x39ef4d=_0x5b3b6a[_0xd554('0x2a')]({'plain':!![]});var _0x163c10=_0xd554('0x2b');return db[_0xd554('0x54')][_0xd554('0x4f')]({'where':{'name':_0x163c10,'userProfileId':_0x108e6d[_0xd554('0x55')]},'raw':!![]})[_0xd554('0x28')](function(_0x3f2e69){if(_0x3f2e69&&_0x3f2e69['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x39ef4d[_0xd554('0x30')],'resourceId':_0x39ef4d['id'],'type':_0x3f2e69['name'],'sectionId':_0x3f2e69['id']},{})['then'](function(){return _0x5b3b6a;});}else{return _0x5b3b6a;}})[_0xd554('0x4c')](function(_0x5a63b7){logger[_0xd554('0x2e')](_0xd554('0x56'),_0x5a63b7);throw _0x5a63b7;});}return _0x5b3b6a;})[_0xd554('0x28')](respondWithResult(_0x4d8b33,0xc9))[_0xd554('0x4c')](handleError(_0x4d8b33,null));};exports[_0xd554('0x27')]=function(_0x2d9686,_0x4a9191){if(_0x2d9686[_0xd554('0x51')]['id']){delete _0x2d9686['body']['id'];}return db[_0xd554('0x33')][_0xd554('0x4f')]({'where':{'id':_0x2d9686[_0xd554('0x4e')]['id']}})[_0xd554('0x28')](handleEntityNotFound(_0x4a9191,null))[_0xd554('0x28')](saveUpdates(_0x2d9686[_0xd554('0x51')],null))[_0xd554('0x28')](respondWithResult(_0x4a9191,null))[_0xd554('0x4c')](handleError(_0x4a9191,null));};exports[_0xd554('0x29')]=function(_0x1d7290,_0x1bb404){return db[_0xd554('0x33')][_0xd554('0x4f')]({'where':{'id':_0x1d7290['params']['id']}})[_0xd554('0x28')](handleEntityNotFound(_0x1bb404,null))[_0xd554('0x28')](removeEntity(_0x1bb404,null))[_0xd554('0x4c')](handleError(_0x1bb404,null));};exports[_0xd554('0x57')]=function(_0x4afcec,_0x486985){return db['MailQueue'][_0xd554('0x57')]()[_0xd554('0x28')](respondWithResult(_0x486985,null))['catch'](handleError(_0x486985,null));};exports[_0xd554('0x58')]=function(_0x207f86,_0xe2a211,_0x37ec18){var _0x592382={'raw':!![],'where':{}},_0x5e3a49={},_0x41037c;return db[_0xd554('0x33')][_0xd554('0x59')]({'where':{'id':_0x207f86[_0xd554('0x4e')]['id']}})[_0xd554('0x28')](handleEntityNotFound(_0xe2a211,null))[_0xd554('0x28')](function(_0x230381){if(_0x230381){_0x41037c=_0x230381[_0xd554('0x2a')]({'plain':!![]});_0x5e3a49[_0xd554('0x3a')]=_[_0xd554('0x38')](db['UserMailQueue'][_0xd554('0x5a')]);_0x5e3a49['query']=_['keys'](_0x207f86[_0xd554('0x37')]);_0x5e3a49['filters']=_[_0xd554('0x39')](_0x5e3a49[_0xd554('0x3a')],_0x5e3a49[_0xd554('0x37')]);_0x592382[_0xd554('0x3b')]=_[_0xd554('0x39')](_0x5e3a49['model'],qs[_0xd554('0x3c')](_0x207f86[_0xd554('0x37')][_0xd554('0x3c')]));_0x592382[_0xd554('0x3b')]=_0x592382['attributes'][_0xd554('0x3d')]?_0x592382['attributes']:_0x5e3a49['model'];if(!_0x207f86[_0xd554('0x37')][_0xd554('0x5b')](_0xd554('0x3e'))){_0x592382[_0xd554('0x22')]=qs['limit'](_0x207f86[_0xd554('0x37')][_0xd554('0x22')]);_0x592382[_0xd554('0x20')]=qs['offset'](_0x207f86[_0xd554('0x37')][_0xd554('0x20')]);}_0x592382[_0xd554('0x3f')]=qs[_0xd554('0x40')](_0x207f86[_0xd554('0x37')][_0xd554('0x40')]);_0x592382['where']=qs['filters'](_[_0xd554('0x42')](_0x207f86[_0xd554('0x37')],_0x5e3a49[_0xd554('0x43')]));_0x592382[_0xd554('0x41')][_0xd554('0x5c')]=_0x230381['id'];if(_0x207f86['query']['filter']){_0x592382['where']=_['merge'](_0x592382['where'],{'$or':_[_0xd554('0x36')](_0x592382['attributes'],function(_0x1d015a){var _0x3a6bbe={};_0x3a6bbe[_0x1d015a]={'$like':'%'+_0x207f86[_0xd554('0x37')][_0xd554('0x44')]+'%'};return _0x3a6bbe;})});}_0x592382=_[_0xd554('0x45')]({},_0x592382,_0x207f86[_0xd554('0x47')]);return db[_0xd554('0x5d')][_0xd554('0x4a')](_0x592382);}})['then'](function(_0x789c5f){if(_0x789c5f){return db[_0xd554('0x5e')][_0xd554('0x5f')]({'where':{'id':_[_0xd554('0x36')](_0x789c5f,'UserId'),'role':'agent'},'attributes':['id',_0xd554('0x30'),_0xd554('0x60'),'updatedAt',_0xd554('0x61')]});}})[_0xd554('0x28')](function(_0x5106d5){if(_0x5106d5){return{'count':_0x5106d5['count'],'rows':_[_0xd554('0x36')](_0x5106d5[_0xd554('0x4b')],function(_0x26a4a9){return{'membername':_0x26a4a9[_0xd554('0x30')],'UserId':_0x26a4a9['id'],'queue_name':_0x41037c[_0xd554('0x30')],'MailQueueId':_0x41037c['id'],'interface':util[_0xd554('0x62')](_0xd554('0x63'),_0xd554('0x64'),_0x26a4a9[_0xd554('0x30')]),'penalty':0x0,'paused':_0x26a4a9['mailPause'],'createdAt':_0x26a4a9[_0xd554('0x61')],'updatedAt':_0x26a4a9[_0xd554('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd554('0x28')](respondWithFilteredResult(_0xe2a211,_0x592382))['catch'](handleError(_0xe2a211,null));};exports[_0xd554('0x66')]=function(_0x5695a5,_0x451900,_0xf497a0){var _0x4aa17c={};var _0x57615f={};var _0x1d201d;var _0x411939;return db[_0xd554('0x33')][_0xd554('0x59')]({'where':{'id':_0x5695a5['params']['id']}})[_0xd554('0x28')](handleEntityNotFound(_0x451900,null))[_0xd554('0x28')](function(_0x1178f8){if(_0x1178f8){_0x1d201d=_0x1178f8;_0x57615f['model']=_[_0xd554('0x38')](db[_0xd554('0x67')][_0xd554('0x5a')]);_0x57615f[_0xd554('0x37')]=_[_0xd554('0x38')](_0x5695a5[_0xd554('0x37')]);_0x57615f[_0xd554('0x43')]=_[_0xd554('0x39')](_0x57615f[_0xd554('0x3a')],_0x57615f[_0xd554('0x37')]);_0x4aa17c['attributes']=_[_0xd554('0x39')](_0x57615f[_0xd554('0x3a')],qs[_0xd554('0x3c')](_0x5695a5[_0xd554('0x37')]['fields']));_0x4aa17c[_0xd554('0x3b')]=_0x4aa17c[_0xd554('0x3b')]['length']?_0x4aa17c[_0xd554('0x3b')]:_0x57615f[_0xd554('0x3a')];_0x4aa17c[_0xd554('0x3f')]=qs[_0xd554('0x40')](_0x5695a5['query'][_0xd554('0x40')]);_0x4aa17c[_0xd554('0x41')]=qs['filters'](_['pick'](_0x5695a5[_0xd554('0x37')],_0x57615f[_0xd554('0x43')]));if(_0x5695a5[_0xd554('0x37')][_0xd554('0x44')]){_0x4aa17c[_0xd554('0x41')]=_[_0xd554('0x45')](_0x4aa17c['where'],{'$or':_[_0xd554('0x36')](_0x4aa17c[_0xd554('0x3b')],function(_0x2017df){var _0x2088a3={};_0x2088a3[_0x2017df]={'$like':'%'+_0x5695a5[_0xd554('0x37')]['filter']+'%'};return _0x2088a3;})});}_0x4aa17c=_[_0xd554('0x45')]({},_0x4aa17c,_0x5695a5['options']);return _0x1d201d[_0xd554('0x66')](_0x4aa17c);}})[_0xd554('0x28')](function(_0x38e336){if(_0x38e336){_0x411939=_0x38e336[_0xd554('0x3d')];if(!_0x5695a5['query'][_0xd554('0x5b')](_0xd554('0x3e'))){_0x4aa17c['limit']=qs[_0xd554('0x22')](_0x5695a5[_0xd554('0x37')]['limit']);_0x4aa17c[_0xd554('0x20')]=qs[_0xd554('0x20')](_0x5695a5[_0xd554('0x37')][_0xd554('0x20')]);}return _0x1d201d['getTeams'](_0x4aa17c);}})[_0xd554('0x28')](function(_0x207f31){if(_0x207f31){return _0x207f31?{'count':_0x411939,'rows':_0x207f31}:null;}})[_0xd554('0x28')](respondWithResult(_0x451900,null))[_0xd554('0x4c')](handleError(_0x451900,null));};exports[_0xd554('0x68')]=function(_0xc26f90,_0x506170,_0xf65859){var _0x5b0820=_0xc26f90[_0xd554('0x51')][_0xd554('0x69')];return db[_0xd554('0x67')][_0xd554('0x4a')]({'where':{'id':_0x5b0820},'attributes':['id'],'include':[{'model':db[_0xd554('0x5e')],'as':'Agents','attributes':['id','name','online',_0xd554('0x6a'),_0xd554('0x6b')],'raw':!![]}]})['then'](function(_0x3322bb){if(_0x3322bb){var _0x9cd49=_[_0xd554('0x6c')](_0x3322bb,function(_0x16e5a4){var _0xac515c=_0x16e5a4[_0xd554('0x2a')]({'plain':!![]});return _0xac515c[_0xd554('0x6d')];});return db[_0xd554('0x33')][_0xd554('0x4f')]({'where':{'id':_0xc26f90[_0xd554('0x4e')]['id']}})[_0xd554('0x28')](function(_0x297598){return db[_0xd554('0x6e')][_0xd554('0x6f')](function(_0x1cb87f){return _0x297598[_0xd554('0x68')](_0x5b0820,{'transaction':_0x1cb87f})[_0xd554('0x28')](function(){return BPromise[_0xd554('0x70')](_0x9cd49,function(_0x29ea92){return db[_0xd554('0x5d')][_0xd554('0x71')]({'where':{'UserId':_0x29ea92['id'],'MailQueueId':_0xc26f90[_0xd554('0x4e')]['id']},'transaction':_0x1cb87f});});})['then'](function(){_0x9cd49[_0xd554('0x72')](function(_0x4f1222){socket['emit'](_0xd554('0x73'),{'UserId':_0x4f1222['id'],'MailQueueId':_0x297598['id']});});});});});}})[_0xd554('0x28')](respondWithStatusCode(_0x506170,null))[_0xd554('0x4c')](handleError(_0x506170,null));};exports['removeTeams']=function(_0x5a7489,_0x3aa08c,_0x5c526b){return db['Team'][_0xd554('0x4a')]({'where':{'id':_0x5a7489[_0xd554('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd554('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3aa08c,null))[_0xd554('0x28')](function(_0x296056){var _0x28cbc8=_[_0xd554('0x36')](_0x296056,'id');var _0x42c707=[];var _0x23b1f2=[];var _0x3619ea=squel[_0xd554('0x74')]();_0x3619ea[_0xd554('0x75')]('tq.TeamId')['from']('team_has_mail_queues','tq')[_0xd554('0x76')](_0xd554('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd554('0x78'),_0x5a7489['params']['id']);for(var _0x1954b2=0x0;_0x1954b2<_0x296056[_0xd554('0x3d')];_0x1954b2+=0x1){let _0x15f190=_0x296056[_0x1954b2];for(var _0x1fbe47=0x0;_0x1fbe47<_0x15f190['Agents'][_0xd554('0x3d')];_0x1fbe47+=0x1){let _0x578f6d=_0x15f190[_0xd554('0x6d')][_0x1fbe47];var _0x5b34a3=_0x3619ea[_0xd554('0x79')]();_0x5b34a3[_0xd554('0x41')](_0xd554('0x7a'),_0x578f6d['id']);_0x23b1f2[_0xd554('0x7b')](db[_0xd554('0x6e')]['query'](_0x5b34a3['toString'](),{'type':db[_0xd554('0x6e')][_0xd554('0x7c')][_0xd554('0x7d')]})[_0xd554('0x28')](function(_0x3cdac9){if(_0x3cdac9[_0xd554('0x3d')]===0x1){return _0x578f6d['id'];}else{var _0x497fda=_['every'](_[_0xd554('0x36')](_0x3cdac9,_0xd554('0x7e')),function(_0xb31cb6){return _[_0xd554('0x7f')](_0x28cbc8,_0xb31cb6);});if(_0x497fda){return _0x578f6d['id'];}}}));}}return BPromise[_0xd554('0x80')](_0x23b1f2)[_0xd554('0x28')](function(_0x5d91c7){_0x42c707=_(_0x42c707)[_0xd554('0x81')](_0x5d91c7)[_0xd554('0x82')]()[_0xd554('0x83')]();return db[_0xd554('0x33')][_0xd554('0x4f')]({'where':{'id':_0x5a7489[_0xd554('0x4e')]['id']}})['then'](function(_0x4b310b){return db[_0xd554('0x6e')][_0xd554('0x6f')](function(_0x3d4ee7){return _0x4b310b[_0xd554('0x84')](_0x5a7489['query']['ids'],{'transaction':_0x3d4ee7})[_0xd554('0x28')](function(){if(!_['isEmpty'](_0x42c707)){return _0x4b310b[_0xd554('0x85')](_0x42c707,{'transaction':_0x3d4ee7});}})['then'](function(){_0x42c707[_0xd554('0x72')](function(_0x2c0bf6){socket[_0xd554('0x86')](_0xd554('0x87'),{'UserId':_0x2c0bf6,'MailQueueId':_0x4b310b['id']});});});});});});})['then'](respondWithStatusCode(_0x3aa08c,null))[_0xd554('0x4c')](handleError(_0x3aa08c,null));};exports['addAgents']=function(_0x5e3137,_0x225767,_0xd50a39){return db[_0xd554('0x33')]['find']({'where':{'id':_0x5e3137[_0xd554('0x4e')]['id']}})['then'](handleEntityNotFound(_0x225767,null))[_0xd554('0x28')](function(_0x17195f){if(_0x17195f){return _0x17195f[_0xd554('0x88')](_0x5e3137[_0xd554('0x51')][_0xd554('0x69')],_[_0xd554('0x89')](_0x5e3137[_0xd554('0x51')],['ids','id'])||{})[_0xd554('0x8a')](function(_0xfafd2){for(var _0x58d95b=0x0;_0x58d95b<_0x5e3137['body'][_0xd554('0x69')][_0xd554('0x3d')];_0x58d95b+=0x1){socket[_0xd554('0x86')](_0xd554('0x73'),{'UserId':Number(_0x5e3137[_0xd554('0x51')]['ids'][_0x58d95b]),'MailQueueId':Number(_0x5e3137['params']['id'])});}return _0xfafd2;});}})[_0xd554('0x28')](respondWithResult(_0x225767,null))[_0xd554('0x4c')](handleError(_0x225767,null));};exports['removeAgents']=function(_0x1b9d37,_0x55786a,_0x7ffd19){return db['MailQueue'][_0xd554('0x4f')]({'where':{'id':_0x1b9d37[_0xd554('0x4e')]['id']}})[_0xd554('0x28')](handleEntityNotFound(_0x55786a,null))[_0xd554('0x28')](function(_0xcdbea6){if(_0xcdbea6){return _0xcdbea6[_0xd554('0x85')](_0x1b9d37['query'][_0xd554('0x69')])[_0xd554('0x28')](function(){if(_['isArray'](_0x1b9d37['query'][_0xd554('0x69')])){for(var _0x366a69=0x0;_0x366a69<_0x1b9d37[_0xd554('0x37')]['ids'][_0xd554('0x3d')];_0x366a69+=0x1){socket[_0xd554('0x86')]('userMailQueue:remove',{'UserId':Number(_0x1b9d37[_0xd554('0x37')][_0xd554('0x69')][_0x366a69]),'MailQueueId':Number(_0x1b9d37[_0xd554('0x4e')]['id'])});}}else{socket[_0xd554('0x86')](_0xd554('0x87'),{'UserId':Number(_0x1b9d37[_0xd554('0x37')][_0xd554('0x69')]),'MailQueueId':Number(_0x1b9d37[_0xd554('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x55786a,null))['catch'](handleError(_0x55786a,null));};exports[_0xd554('0x8b')]=function(_0x3ab9ea,_0x1030e3,_0x4501ba){var _0x2f6c48={};var _0x5a19ed={};var _0x231e48;var _0x134a9c;return db[_0xd554('0x33')][_0xd554('0x59')]({'where':{'id':_0x3ab9ea['params']['id']}})[_0xd554('0x28')](handleEntityNotFound(_0x1030e3,null))['then'](function(_0x54344b){if(_0x54344b){_0x231e48=_0x54344b;_0x5a19ed['model']=_[_0xd554('0x38')](db[_0xd554('0x5e')][_0xd554('0x5a')]);_0x5a19ed['query']=_[_0xd554('0x38')](_0x3ab9ea['query']);_0x5a19ed[_0xd554('0x43')]=_[_0xd554('0x39')](_0x5a19ed[_0xd554('0x3a')],_0x5a19ed[_0xd554('0x37')]);_0x2f6c48[_0xd554('0x3b')]=_['intersection'](_0x5a19ed[_0xd554('0x3a')],qs[_0xd554('0x3c')](_0x3ab9ea[_0xd554('0x37')]['fields']));_0x2f6c48['attributes']=_0x2f6c48[_0xd554('0x3b')][_0xd554('0x3d')]?_0x2f6c48[_0xd554('0x3b')]:_0x5a19ed[_0xd554('0x3a')];_0x2f6c48['order']=qs[_0xd554('0x40')](_0x3ab9ea['query']['sort']);_0x2f6c48[_0xd554('0x41')]=qs[_0xd554('0x43')](_['pick'](_0x3ab9ea['query'],_0x5a19ed[_0xd554('0x43')]));if(_0x3ab9ea[_0xd554('0x37')][_0xd554('0x44')]){_0x2f6c48[_0xd554('0x41')]=_[_0xd554('0x45')](_0x2f6c48['where'],{'$or':_['map'](_0x2f6c48[_0xd554('0x3b')],function(_0x5f3a83){var _0x2fc8a8={};_0x2fc8a8[_0x5f3a83]={'$like':'%'+_0x3ab9ea[_0xd554('0x37')][_0xd554('0x44')]+'%'};return _0x2fc8a8;})});}_0x2f6c48=_[_0xd554('0x45')]({},_0x2f6c48,_0x3ab9ea[_0xd554('0x47')]);return _0x231e48[_0xd554('0x8b')](_0x2f6c48);}})['then'](function(_0x461683){if(_0x461683){_0x134a9c=_0x461683[_0xd554('0x3d')];if(!_0x3ab9ea[_0xd554('0x37')]['hasOwnProperty'](_0xd554('0x3e'))){_0x2f6c48['limit']=qs[_0xd554('0x22')](_0x3ab9ea[_0xd554('0x37')][_0xd554('0x22')]);_0x2f6c48[_0xd554('0x20')]=qs[_0xd554('0x20')](_0x3ab9ea[_0xd554('0x37')]['offset']);}return _0x231e48[_0xd554('0x8b')](_0x2f6c48);}})[_0xd554('0x28')](function(_0x3fe647){if(_0x3fe647){return _0x3fe647?{'count':_0x134a9c,'rows':_0x3fe647}:null;}})['then'](respondWithResult(_0x1030e3,null))[_0xd554('0x4c')](handleError(_0x1030e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5073050..f531829 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 _0x974f=['hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x2d36fe,_0x4c058f){var _0x417693=function(_0x1b6e6b){while(--_0x1b6e6b){_0x2d36fe['push'](_0x2d36fe['shift']());}};_0x417693(++_0x4c058f);}(_0x974f,0x89));var _0xf974=function(_0x13bc44,_0x59c258){_0x13bc44=_0x13bc44-0x0;var _0x237054=_0x974f[_0x13bc44];return _0x237054;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf974('0x0'))['db'][_0xf974('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf974('0x2')](0x0);var events={'afterCreate':_0xf974('0x3'),'afterUpdate':_0xf974('0x4'),'afterDestroy':_0xf974('0x5')};function emitEvent(_0x5b5d46){return function(_0x5c2c2e,_0x355418,_0x2207d0){MailQueueEvents[_0xf974('0x6')](_0x5b5d46+':'+_0x5c2c2e['id'],_0x5c2c2e);MailQueueEvents['emit'](_0x5b5d46,_0x5c2c2e);_0x2207d0(null);};}for(var e in events){if(events[_0xf974('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf974('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x86b1=['events','../../mysqldb','save','update','remove','emit','hook'];(function(_0x1251cb,_0x2cd705){var _0x280d58=function(_0x496bdd){while(--_0x496bdd){_0x1251cb['push'](_0x1251cb['shift']());}};_0x280d58(++_0x2cd705);}(_0x86b1,0x15e));var _0x186b=function(_0x2bb1d3,_0x3afd5a){_0x2bb1d3=_0x2bb1d3-0x0;var _0x57896e=_0x86b1[_0x2bb1d3];return _0x57896e;};'use strict';var EventEmitter=require(_0x186b('0x0'));var MailQueue=require(_0x186b('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x186b('0x2'),'afterUpdate':_0x186b('0x3'),'afterDestroy':_0x186b('0x4')};function emitEvent(_0x2383b8){return function(_0x29d85c,_0x44f333,_0x170d12){MailQueueEvents[_0x186b('0x5')](_0x2383b8+':'+_0x29d85c['id'],_0x29d85c);MailQueueEvents['emit'](_0x2383b8,_0x29d85c);_0x170d12(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x186b('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8841f38..970546c 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 _0x8ab6=['../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x19e0f6,_0x54a108){var _0x5aaaee=function(_0x165f2c){while(--_0x165f2c){_0x19e0f6['push'](_0x19e0f6['shift']());}};_0x5aaaee(++_0x54a108);}(_0x8ab6,0x1bc));var _0x68ab=function(_0x5dd418,_0x413268){_0x5dd418=_0x5dd418-0x0;var _0x313a73=_0x8ab6[_0x5dd418];return _0x313a73;};'use strict';var _=require(_0x68ab('0x0'));var util=require('util');var logger=require(_0x68ab('0x1'))(_0x68ab('0x2'));var moment=require('moment');var BPromise=require(_0x68ab('0x3'));var rp=require(_0x68ab('0x4'));var fs=require('fs');var path=require(_0x68ab('0x5'));var rimraf=require(_0x68ab('0x6'));var config=require(_0x68ab('0x7'));var attributes=require(_0x68ab('0x8'));module['exports']=function(_0x54e96a,_0xaa6be8){return _0x54e96a['define'](_0x68ab('0x9'),attributes,{'tableName':_0x68ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1743=['MailQueue','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x33a31f,_0x48e7db){var _0x4db55a=function(_0x4a83c1){while(--_0x4a83c1){_0x33a31f['push'](_0x33a31f['shift']());}};_0x4db55a(++_0x48e7db);}(_0x1743,0x191));var _0x3174=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1743[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3174('0x0'));var util=require(_0x3174('0x1'));var logger=require(_0x3174('0x2'))('api');var moment=require(_0x3174('0x3'));var BPromise=require('bluebird');var rp=require(_0x3174('0x4'));var fs=require('fs');var path=require(_0x3174('0x5'));var rimraf=require(_0x3174('0x6'));var config=require(_0x3174('0x7'));var attributes=require(_0x3174('0x8'));module['exports']=function(_0xb91a34,_0x15c223){return _0xb91a34['define'](_0x3174('0x9'),attributes,{'tableName':'mail_queues','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 cbd03b5..3b21a71 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 _0xebe6=['findAll','options','raw','where','limit','include','map','model','attributes','GetMailQueue','MailQueue','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xebe6,0x13a));var _0x6ebe=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xebe6[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x6ebe('0x0'));var util=require(_0x6ebe('0x1'));var moment=require(_0x6ebe('0x2'));var BPromise=require(_0x6ebe('0x3'));var rs=require(_0x6ebe('0x4'));var fs=require('fs');var Redis=require(_0x6ebe('0x5'));var db=require(_0x6ebe('0x6'))['db'];var utils=require(_0x6ebe('0x7'));var logger=require(_0x6ebe('0x8'))(_0x6ebe('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ebe('0xa')][_0x6ebe('0xb')]({'port':0x232a});config[_0x6ebe('0xc')]=_[_0x6ebe('0xd')](config[_0x6ebe('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ebe('0xe'))(new Redis(config['redis']));require(_0x6ebe('0xf'))[_0x6ebe('0x10')](socket);function respondWithRpcPromise(_0x81fa22,_0x37cbdf,_0x2f9b6c){return new BPromise(function(_0x3f43f5,_0x4adc0a){return client[_0x6ebe('0x11')](_0x81fa22,_0x2f9b6c)[_0x6ebe('0x12')](function(_0x332858){logger[_0x6ebe('0x13')](_0x6ebe('0x14'),_0x37cbdf,_0x6ebe('0x15'));logger[_0x6ebe('0x16')](_0x6ebe('0x17'),_0x37cbdf,'request\x20sent',JSON[_0x6ebe('0x18')](_0x332858));if(_0x332858['error']){if(_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1a')]===0x1f4){logger['error'](_0x6ebe('0x14'),_0x37cbdf,_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);return _0x4adc0a(_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);}logger[_0x6ebe('0x19')](_0x6ebe('0x14'),_0x37cbdf,_0x332858[_0x6ebe('0x19')][_0x6ebe('0x1b')]);return _0x3f43f5(_0x332858['error']['message']);}else{logger[_0x6ebe('0x13')]('MailQueue,\x20%s,\x20%s',_0x37cbdf,'request\x20sent');_0x3f43f5(_0x332858[_0x6ebe('0x1c')][_0x6ebe('0x1b')]);}})[_0x6ebe('0x1d')](function(_0x4a329b){logger[_0x6ebe('0x19')](_0x6ebe('0x14'),_0x37cbdf,_0x4a329b);_0x4adc0a(_0x4a329b);});});}exports['GetMailQueue']=function(_0xe50b88){var _0xbbe58d=this;return new Promise(function(_0x58c124,_0x50de75){return db['MailQueue'][_0x6ebe('0x1e')]({'raw':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')][_0x6ebe('0x20')]===undefined?!![]:![]:!![],'where':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')][_0x6ebe('0x21')]||null:null,'attributes':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88[_0x6ebe('0x1f')]['attributes']||null:null,'limit':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88['options'][_0x6ebe('0x22')]||null:null,'include':_0xe50b88[_0x6ebe('0x1f')]?_0xe50b88['options'][_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0xe50b88['options'][_0x6ebe('0x23')],function(_0x225267){return{'model':db[_0x225267[_0x6ebe('0x25')]],'as':_0x225267['as'],'attributes':_0x225267['attributes'],'include':_0x225267[_0x6ebe('0x23')]?_['map'](_0x225267[_0x6ebe('0x23')],function(_0x5ab718){return{'model':db[_0x5ab718[_0x6ebe('0x25')]],'as':_0x5ab718['as'],'attributes':_0x5ab718[_0x6ebe('0x26')],'include':_0x5ab718[_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0x5ab718[_0x6ebe('0x23')],function(_0x3ddd78){return{'model':db[_0x3ddd78[_0x6ebe('0x25')]],'as':_0x3ddd78['as'],'attributes':_0x3ddd78[_0x6ebe('0x26')]};}):[]};}):[]};}):[]:[]})[_0x6ebe('0x12')](function(_0x131c9b){logger[_0x6ebe('0x13')](_0x6ebe('0x27'),_0xe50b88);logger['debug'](_0x6ebe('0x27'),_0xe50b88,JSON[_0x6ebe('0x18')](_0x131c9b));_0x58c124(_0x131c9b);})['catch'](function(_0x161ce6){logger[_0x6ebe('0x19')](_0x6ebe('0x27'),_0x161ce6[_0x6ebe('0x1b')],_0xe50b88);_0x50de75(_0xbbe58d['error'](0x1f4,_0x161ce6['message']));});});};exports['ShowMailQueue']=function(_0x22a713){var _0x531888=this;return new Promise(function(_0x3f83ab,_0x4d88c8){return db[_0x6ebe('0x28')][_0x6ebe('0x29')]({'raw':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x20')]===undefined?!![]:![]:!![],'where':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x21')]||null:null,'attributes':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x26')]||null:null,'include':_0x22a713[_0x6ebe('0x1f')]?_0x22a713[_0x6ebe('0x1f')][_0x6ebe('0x23')]?_['map'](_0x22a713['options'][_0x6ebe('0x23')],function(_0x997a1){return{'model':db[_0x997a1[_0x6ebe('0x25')]],'as':_0x997a1['as'],'attributes':_0x997a1[_0x6ebe('0x26')],'include':_0x997a1[_0x6ebe('0x23')]?_[_0x6ebe('0x24')](_0x997a1[_0x6ebe('0x23')],function(_0x2d0893){return{'model':db[_0x2d0893[_0x6ebe('0x25')]],'as':_0x2d0893['as'],'attributes':_0x2d0893[_0x6ebe('0x26')],'include':_0x2d0893[_0x6ebe('0x23')]?_['map'](_0x2d0893['include'],function(_0x4cf4b8){return{'model':db[_0x4cf4b8[_0x6ebe('0x25')]],'as':_0x4cf4b8['as'],'attributes':_0x4cf4b8[_0x6ebe('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28bb18){logger['info'](_0x6ebe('0x2a'),_0x22a713);logger[_0x6ebe('0x16')](_0x6ebe('0x2a'),_0x22a713,JSON[_0x6ebe('0x18')](_0x28bb18));_0x3f83ab(_0x28bb18);})['catch'](function(_0x5365c1){logger['error'](_0x6ebe('0x2a'),_0x5365c1['message'],_0x22a713);_0x4d88c8(_0x531888[_0x6ebe('0x19')](0x1f4,_0x5365c1[_0x6ebe('0x1b')]));});});}; \ No newline at end of file +var _0xd757=['message','request\x20sent','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetMailQueue','MailQueue','ShowMailQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20576b,_0x59eee2){var _0x575c22=function(_0x3f5e21){while(--_0x3f5e21){_0x20576b['push'](_0x20576b['shift']());}};_0x575c22(++_0x59eee2);}(_0xd757,0x1e5));var _0x7d75=function(_0x1f5353,_0x549df7){_0x1f5353=_0x1f5353-0x0;var _0x3251ea=_0xd757[_0x1f5353];return _0x3251ea;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d75('0x9')]=_[_0x7d75('0xa')](config[_0x7d75('0x9')],{'host':_0x7d75('0xb'),'port':0x18eb});var socket=require(_0x7d75('0xc'))(new Redis(config[_0x7d75('0x9')]));require(_0x7d75('0xd'))[_0x7d75('0xe')](socket);function respondWithRpcPromise(_0x24e1d8,_0x79266b,_0x1222b3){return new BPromise(function(_0x3043fc,_0x2ac971){return client['request'](_0x24e1d8,_0x1222b3)['then'](function(_0x38cd18){logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,'request\x20sent');logger[_0x7d75('0x11')](_0x7d75('0x12'),_0x79266b,'request\x20sent',JSON[_0x7d75('0x13')](_0x38cd18));if(_0x38cd18[_0x7d75('0x14')]){if(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x15')]===0x1f4){logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18['error'][_0x7d75('0x16')]);return _0x2ac971(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x16')]);}logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18[_0x7d75('0x14')]['message']);return _0x3043fc(_0x38cd18[_0x7d75('0x14')]['message']);}else{logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,_0x7d75('0x17'));_0x3043fc(_0x38cd18[_0x7d75('0x18')][_0x7d75('0x16')]);}})[_0x7d75('0x19')](function(_0x17a61c){logger[_0x7d75('0x14')]('MailQueue,\x20%s,\x20%s',_0x79266b,_0x17a61c);_0x2ac971(_0x17a61c);});});}exports['GetMailQueue']=function(_0x4d7b23){var _0x208d59=this;return new Promise(function(_0x404257,_0xbb0322){return db['MailQueue'][_0x7d75('0x1a')]({'raw':_0x4d7b23[_0x7d75('0x1b')]?_0x4d7b23[_0x7d75('0x1b')][_0x7d75('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d7b23[_0x7d75('0x1b')]?_0x4d7b23[_0x7d75('0x1b')][_0x7d75('0x1d')]||null:null,'attributes':_0x4d7b23[_0x7d75('0x1b')]?_0x4d7b23[_0x7d75('0x1b')][_0x7d75('0x1e')]||null:null,'limit':_0x4d7b23[_0x7d75('0x1b')]?_0x4d7b23[_0x7d75('0x1b')][_0x7d75('0x1f')]||null:null,'include':_0x4d7b23[_0x7d75('0x1b')]?_0x4d7b23[_0x7d75('0x1b')][_0x7d75('0x20')]?_[_0x7d75('0x21')](_0x4d7b23[_0x7d75('0x1b')]['include'],function(_0xec279d){return{'model':db[_0xec279d[_0x7d75('0x22')]],'as':_0xec279d['as'],'attributes':_0xec279d['attributes'],'include':_0xec279d[_0x7d75('0x20')]?_['map'](_0xec279d[_0x7d75('0x20')],function(_0x37456d){return{'model':db[_0x37456d[_0x7d75('0x22')]],'as':_0x37456d['as'],'attributes':_0x37456d[_0x7d75('0x1e')],'include':_0x37456d[_0x7d75('0x20')]?_['map'](_0x37456d[_0x7d75('0x20')],function(_0x31055c){return{'model':db[_0x31055c[_0x7d75('0x22')]],'as':_0x31055c['as'],'attributes':_0x31055c[_0x7d75('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7d75('0x23')](function(_0x11ba6c){logger['info'](_0x7d75('0x24'),_0x4d7b23);logger[_0x7d75('0x11')](_0x7d75('0x24'),_0x4d7b23,JSON[_0x7d75('0x13')](_0x11ba6c));_0x404257(_0x11ba6c);})[_0x7d75('0x19')](function(_0x4600d2){logger[_0x7d75('0x14')]('GetMailQueue',_0x4600d2['message'],_0x4d7b23);_0xbb0322(_0x208d59['error'](0x1f4,_0x4600d2[_0x7d75('0x16')]));});});};exports['ShowMailQueue']=function(_0x411752){var _0x64bb1b=this;return new Promise(function(_0x16001d,_0xbd922d){return db[_0x7d75('0x25')]['find']({'raw':_0x411752[_0x7d75('0x1b')]?_0x411752[_0x7d75('0x1b')][_0x7d75('0x1c')]===undefined?!![]:![]:!![],'where':_0x411752[_0x7d75('0x1b')]?_0x411752[_0x7d75('0x1b')][_0x7d75('0x1d')]||null:null,'attributes':_0x411752[_0x7d75('0x1b')]?_0x411752[_0x7d75('0x1b')][_0x7d75('0x1e')]||null:null,'include':_0x411752[_0x7d75('0x1b')]?_0x411752['options'][_0x7d75('0x20')]?_[_0x7d75('0x21')](_0x411752[_0x7d75('0x1b')][_0x7d75('0x20')],function(_0x5a90d0){return{'model':db[_0x5a90d0[_0x7d75('0x22')]],'as':_0x5a90d0['as'],'attributes':_0x5a90d0['attributes'],'include':_0x5a90d0[_0x7d75('0x20')]?_[_0x7d75('0x21')](_0x5a90d0['include'],function(_0x4ffe48){return{'model':db[_0x4ffe48[_0x7d75('0x22')]],'as':_0x4ffe48['as'],'attributes':_0x4ffe48[_0x7d75('0x1e')],'include':_0x4ffe48[_0x7d75('0x20')]?_[_0x7d75('0x21')](_0x4ffe48[_0x7d75('0x20')],function(_0x31582f){return{'model':db[_0x31582f['model']],'as':_0x31582f['as'],'attributes':_0x31582f[_0x7d75('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7d75('0x23')](function(_0x5b9e67){logger[_0x7d75('0xf')](_0x7d75('0x26'),_0x411752);logger[_0x7d75('0x11')](_0x7d75('0x26'),_0x411752,JSON[_0x7d75('0x13')](_0x5b9e67));_0x16001d(_0x5b9e67);})[_0x7d75('0x19')](function(_0x1f3c5b){logger[_0x7d75('0x14')](_0x7d75('0x26'),_0x1f3c5b[_0x7d75('0x16')],_0x411752);_0xbd922d(_0x64bb1b[_0x7d75('0x14')](0x1f4,_0x1f3c5b[_0x7d75('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8859d4a..eceab6d 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 _0x0641=['length','./mailQueue.events','save','remove','update','emit','register'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0641,0x1ac));var _0x1064=function(_0x57c538,_0x499b3f){_0x57c538=_0x57c538-0x0;var _0x230956=_0x0641[_0x57c538];return _0x230956;};'use strict';var MailQueueEvents=require(_0x1064('0x0'));var events=[_0x1064('0x1'),_0x1064('0x2'),_0x1064('0x3')];function createListener(_0x5ed10b,_0x59a0f4){return function(_0x3338bf){_0x59a0f4[_0x1064('0x4')](_0x5ed10b,_0x3338bf);};}function removeListener(_0xa0bcd,_0x143f56){return function(){MailQueueEvents['removeListener'](_0xa0bcd,_0x143f56);};}exports[_0x1064('0x5')]=function(_0x57b6b0){for(var _0x2a508d=0x0,_0x97a1f2=events[_0x1064('0x6')];_0x2a508d<_0x97a1f2;_0x2a508d++){var _0x2aff10=events[_0x2a508d];var _0x441998=createListener('mailQueue:'+_0x2aff10,_0x57b6b0);MailQueueEvents['on'](_0x2aff10,_0x441998);}}; \ No newline at end of file +var _0x7b10=['emit','removeListener','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0x7b10,0x1ac));var _0x07b1=function(_0xb9adf4,_0x6f3463){_0xb9adf4=_0xb9adf4-0x0;var _0x50d82c=_0x7b10[_0xb9adf4];return _0x50d82c;};'use strict';var MailQueueEvents=require(_0x07b1('0x0'));var events=[_0x07b1('0x1'),_0x07b1('0x2'),_0x07b1('0x3')];function createListener(_0x2493b7,_0x5711dc){return function(_0xbc25fb){_0x5711dc[_0x07b1('0x4')](_0x2493b7,_0xbc25fb);};}function removeListener(_0x7c39e7,_0x443b4f){return function(){MailQueueEvents[_0x07b1('0x5')](_0x7c39e7,_0x443b4f);};}exports['register']=function(_0x3cf5e4){for(var _0x106f8d=0x0,_0xece33d=events[_0x07b1('0x6')];_0x106f8d<_0xece33d;_0x106f8d++){var _0x1bfc1d=events[_0x106f8d];var _0x2bd721=createListener(_0x07b1('0x7')+_0x1bfc1d,_0x3cf5e4);MailQueueEvents['on'](_0x1bfc1d,_0x2bd721);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4c52baa..5bf1dff 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 _0xd97d=['/:id','update','delete','multer','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x278fc3,_0x5992eb){var _0x1ac4a5=function(_0xa6ef4e){while(--_0xa6ef4e){_0x278fc3['push'](_0x278fc3['shift']());}};_0x1ac4a5(++_0x5992eb);}(_0xd97d,0x1a3));var _0xdd97=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xd97d[_0x59bcb1];return _0x4a737f;};'use strict';var multer=require(_0xdd97('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd97('0x1')]();var fs_extra=require(_0xdd97('0x2'));var auth=require(_0xdd97('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdd97('0x4'));var controller=require(_0xdd97('0x5'));router[_0xdd97('0x6')]('/',auth[_0xdd97('0x7')](),controller[_0xdd97('0x8')]);router[_0xdd97('0x6')]('/describe',auth[_0xdd97('0x7')](),controller[_0xdd97('0x9')]);router['get'](_0xdd97('0xa'),auth[_0xdd97('0x7')](),controller['show']);router['post']('/',auth[_0xdd97('0x7')](),controller['create']);router['put']('/:id',auth[_0xdd97('0x7')](),controller[_0xdd97('0xb')]);router[_0xdd97('0xc')](_0xdd97('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7de4=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x508d1a,_0xe650d3){var _0x5d61df=function(_0x499f85){while(--_0x499f85){_0x508d1a['push'](_0x508d1a['shift']());}};_0x5d61df(++_0xe650d3);}(_0x7de4,0x1b2));var _0x47de=function(_0x39ca45,_0x52b334){_0x39ca45=_0x39ca45-0x0;var _0x5ad948=_0x7de4[_0x39ca45];return _0x5ad948;};'use strict';var multer=require(_0x47de('0x0'));var util=require(_0x47de('0x1'));var path=require(_0x47de('0x2'));var timeout=require(_0x47de('0x3'));var express=require(_0x47de('0x4'));var router=express[_0x47de('0x5')]();var fs_extra=require(_0x47de('0x6'));var auth=require(_0x47de('0x7'));var interaction=require(_0x47de('0x8'));var config=require(_0x47de('0x9'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x47de('0xa')](),controller['index']);router[_0x47de('0xb')](_0x47de('0xc'),auth['isAuthenticated'](),controller[_0x47de('0xd')]);router['get'](_0x47de('0xe'),auth[_0x47de('0xa')](),controller[_0x47de('0xf')]);router[_0x47de('0x10')]('/',auth[_0x47de('0xa')](),controller[_0x47de('0x11')]);router[_0x47de('0x12')](_0x47de('0xe'),auth[_0x47de('0xa')](),controller['update']);router['delete'](_0x47de('0xe'),auth[_0x47de('0xa')](),controller[_0x47de('0x13')]);module[_0x47de('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index ed661d4..47e1f29 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 _0xc155=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b7349,_0x5ade11){var _0x43c4f8=function(_0x2b206f){while(--_0x2b206f){_0x5b7349['push'](_0x5b7349['shift']());}};_0x43c4f8(++_0x5ade11);}(_0xc155,0x16a));var _0x5c15=function(_0x18990f,_0x5825dd){_0x18990f=_0x18990f-0x0;var _0xea6cbc=_0xc155[_0x18990f];return _0xea6cbc;};'use strict';var moment=require(_0x5c15('0x0'));var Sequelize=require(_0x5c15('0x1'));module[_0x5c15('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5c15('0x3')]},'joinAt':{'type':Sequelize[_0x5c15('0x4')]},'leaveAt':{'type':Sequelize[_0x5c15('0x4')]},'acceptAt':{'type':Sequelize[_0x5c15('0x4')]},'exitAt':{'type':Sequelize[_0x5c15('0x4')]},'reason':{'type':Sequelize[_0x5c15('0x3')]}}; \ No newline at end of file +var _0x2029=['DATE','sequelize','STRING'];(function(_0x5092eb,_0x174d76){var _0x5e2189=function(_0x2849fc){while(--_0x2849fc){_0x5092eb['push'](_0x5092eb['shift']());}};_0x5e2189(++_0x174d76);}(_0x2029,0xb5));var _0x9202=function(_0x7cf023,_0x4486d9){_0x7cf023=_0x7cf023-0x0;var _0x3e645b=_0x2029[_0x7cf023];return _0x3e645b;};'use strict';var moment=require('moment');var Sequelize=require(_0x9202('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9202('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9202('0x1')]},'joinAt':{'type':Sequelize[_0x9202('0x2')]},'leaveAt':{'type':Sequelize[_0x9202('0x2')]},'acceptAt':{'type':Sequelize[_0x9202('0x2')]},'exitAt':{'type':Sequelize[_0x9202('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c0f4490..ee6af6a 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 _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x2bdf1d,_0x5c0ad5){var _0x328abf=function(_0x549c38){while(--_0x549c38){_0x2bdf1d['push'](_0x2bdf1d['shift']());}};_0x328abf(++_0x5c0ad5);}(_0x6050,0x196));var _0x0605=function(_0x11991b,_0x1b05ea){_0x11991b=_0x11991b-0x0;var _0x487808=_0x6050[_0x11991b];return _0x487808;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file +var _0x1967=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailQueueReport','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1967,0x173));var _0x7196=function(_0x49a208,_0x2855f4){_0x49a208=_0x49a208-0x0;var _0x431c46=_0x1967[_0x49a208];return _0x431c46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['MailQueueReport'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['MailQueueReport'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['MailQueueReport'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));};exports[_0x7196('0x4c')]=function(_0x41a9aa,_0x19733a){return db[_0x7196('0x3e')][_0x7196('0x4c')]()['then'](respondWithResult(_0x19733a,null))['catch'](handleError(_0x19733a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9d5c6fa..0038dd1 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 _0x8436=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x8436,0xd7));var _0x6843=function(_0x1636bb,_0x21621a){_0x1636bb=_0x1636bb-0x0;var _0x54d8bb=_0x8436[_0x1636bb];return _0x54d8bb;};'use strict';var _=require(_0x6843('0x0'));var util=require(_0x6843('0x1'));var logger=require('../../config/logger')(_0x6843('0x2'));var moment=require(_0x6843('0x3'));var BPromise=require(_0x6843('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6843('0x5'));var config=require(_0x6843('0x6'));var attributes=require(_0x6843('0x7'));module['exports']=function(_0x4b5f83,_0x316d8a){return _0x4b5f83[_0x6843('0x8')](_0x6843('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6843('0xa'),'fields':[_0x6843('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc14=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','lodash','util','api'];(function(_0x376cff,_0x36b23c){var _0xb6e1d9=function(_0x386e45){while(--_0x386e45){_0x376cff['push'](_0x376cff['shift']());}};_0xb6e1d9(++_0x36b23c);}(_0xbc14,0x1b9));var _0x4bc1=function(_0xaec935,_0x5f3d12){_0xaec935=_0xaec935-0x0;var _0x28a8e1=_0xbc14[_0xaec935];return _0x28a8e1;};'use strict';var _=require(_0x4bc1('0x0'));var util=require(_0x4bc1('0x1'));var logger=require('../../config/logger')(_0x4bc1('0x2'));var moment=require(_0x4bc1('0x3'));var BPromise=require(_0x4bc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bc1('0x5'));var rimraf=require(_0x4bc1('0x6'));var config=require(_0x4bc1('0x7'));var attributes=require(_0x4bc1('0x8'));module[_0x4bc1('0x9')]=function(_0x38920d,_0x238dce){return _0x38920d[_0x4bc1('0xa')](_0x4bc1('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 177e12a..c37bb61 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x2514f7,_0x2f3f6a){var _0x47a88c=function(_0x4cf132){while(--_0x4cf132){_0x2514f7['push'](_0x2514f7['shift']());}};_0x47a88c(++_0x2f3f6a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +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(_0x45fb76,_0x35fd5d){var _0x338556=function(_0x526a58){while(--_0x526a58){_0x45fb76['push'](_0x45fb76['shift']());}};_0x338556(++_0x35fd5d);}(_0xdb28,0x106));var _0x8db2=function(_0x46a218,_0x4c27e2){_0x46a218=_0x46a218-0x0;var _0x587730=_0xdb28[_0x46a218];return _0x587730;};'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 08592b1..62a2ef4 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x551bd8,_0x536959){var _0x41755d=function(_0x43f2b0){while(--_0x43f2b0){_0x551bd8['push'](_0x551bd8['shift']());}};_0x41755d(++_0x536959);}(_0x70e0,0x17b));var _0x070e=function(_0x59800a,_0x5239ed){_0x59800a=_0x59800a-0x0;var _0x1d1f0c=_0x70e0[_0x59800a];return _0x1d1f0c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x495afc,_0xf4082f){var _0x51db11=function(_0x25c982){while(--_0x25c982){_0x495afc['push'](_0x495afc['shift']());}};_0x51db11(++_0xf4082f);}(_0xe706,0xa3));var _0x6e70=function(_0x44650b,_0x5af069){_0x44650b=_0x44650b-0x0;var _0x13b205=_0xe706[_0x44650b];return _0x13b205;};'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 c6f5386..55557f8 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 _0xf325=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x25a7b1,_0x57d8f3){var _0x199615=function(_0x1d05e4){while(--_0x1d05e4){_0x25a7b1['push'](_0x25a7b1['shift']());}};_0x199615(++_0x57d8f3);}(_0xf325,0x73));var _0x5f32=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xf325[_0x1e4360];return _0x31e6b4;};'use strict';var Sequelize=require(_0x5f32('0x0'));module[_0x5f32('0x1')]={'description':{'type':Sequelize[_0x5f32('0x2')]},'host':{'type':Sequelize[_0x5f32('0x2')]},'authentication':{'type':Sequelize[_0x5f32('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5f32('0x2')]},'password':{'type':Sequelize[_0x5f32('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5f32('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x5f32('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5f32('0x2')]},'modernAuthentication':{'type':Sequelize[_0x5f32('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9bc7=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x486f27,_0x6c95fd){var _0x203616=function(_0xc2bc18){while(--_0xc2bc18){_0x486f27['push'](_0x486f27['shift']());}};_0x203616(++_0x6c95fd);}(_0x9bc7,0x1c3));var _0x79bc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9bc7[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x79bc('0x0'));module[_0x79bc('0x1')]={'description':{'type':Sequelize[_0x79bc('0x2')]},'host':{'type':Sequelize[_0x79bc('0x2')]},'authentication':{'type':Sequelize[_0x79bc('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x79bc('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x79bc('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x79bc('0x2')],'defaultValue':_0x79bc('0x4')},'connTimeout':{'type':Sequelize[_0x79bc('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x79bc('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x79bc('0x2')]},'modernAuthentication':{'type':Sequelize[_0x79bc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 2265cca..a935cd1 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 _0xb65e=['define','MailServerIn','mail_servers_in','lodash','util','api','moment','../../config/environment'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xb65e,0x1ab));var _0xeb65=function(_0x2abb65,_0x14f3fa){_0x2abb65=_0x2abb65-0x0;var _0x52e662=_0xb65e[_0x2abb65];return _0x52e662;};'use strict';var _=require(_0xeb65('0x0'));var util=require(_0xeb65('0x1'));var logger=require('../../config/logger')(_0xeb65('0x2'));var moment=require(_0xeb65('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb65('0x4'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x205264,_0x331594){return _0x205264[_0xeb65('0x5')](_0xeb65('0x6'),attributes,{'tableName':_0xeb65('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c7d=['bluebird','request-promise','path','exports','define','mail_servers_in','lodash','util','api','moment'];(function(_0x1c2637,_0x5003f8){var _0x104439=function(_0x1f6419){while(--_0x1f6419){_0x1c2637['push'](_0x1c2637['shift']());}};_0x104439(++_0x5003f8);}(_0x1c7d,0x1a0));var _0xd1c7=function(_0xf46fe5,_0x485f7e){_0xf46fe5=_0xf46fe5-0x0;var _0x2f84a0=_0x1c7d[_0xf46fe5];return _0x2f84a0;};'use strict';var _=require(_0xd1c7('0x0'));var util=require(_0xd1c7('0x1'));var logger=require('../../config/logger')(_0xd1c7('0x2'));var moment=require(_0xd1c7('0x3'));var BPromise=require(_0xd1c7('0x4'));var rp=require(_0xd1c7('0x5'));var fs=require('fs');var path=require(_0xd1c7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xd1c7('0x7')]=function(_0x97ff89,_0x515216){return _0x97ff89[_0xd1c7('0x8')]('MailServerIn',attributes,{'tableName':_0xd1c7('0x9'),'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 7f1aa9c..29396ac 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 _0x2ba6=['MailServerIn','findAll','options','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn'];(function(_0x4903e5,_0x2d50e2){var _0x553c4f=function(_0x210aac){while(--_0x210aac){_0x4903e5['push'](_0x4903e5['shift']());}};_0x553c4f(++_0x2d50e2);}(_0x2ba6,0x135));var _0x62ba=function(_0x231400,_0x5ab389){_0x231400=_0x231400-0x0;var _0x4dfc4e=_0x2ba6[_0x231400];return _0x4dfc4e;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var BPromise=require(_0x62ba('0x3'));var rs=require(_0x62ba('0x4'));var fs=require('fs');var Redis=require(_0x62ba('0x5'));var db=require(_0x62ba('0x6'))['db'];var utils=require(_0x62ba('0x7'));var logger=require(_0x62ba('0x8'))('rpc');var config=require(_0x62ba('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8f9618,_0x2c78e9,_0x4a3c6b){return new BPromise(function(_0x2d3397,_0x3bfd53){return client['request'](_0x8f9618,_0x4a3c6b)['then'](function(_0x4b19d3){logger['info']('MailServerIn,\x20%s,\x20%s',_0x2c78e9,_0x62ba('0xa'));logger[_0x62ba('0xb')](_0x62ba('0xc'),_0x2c78e9,_0x62ba('0xa'),JSON[_0x62ba('0xd')](_0x4b19d3));if(_0x4b19d3['error']){if(_0x4b19d3[_0x62ba('0xe')]['code']===0x1f4){logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);return _0x3bfd53(_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);}logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x4b19d3[_0x62ba('0xe')][_0x62ba('0x10')]);return _0x2d3397(_0x4b19d3['error'][_0x62ba('0x10')]);}else{logger[_0x62ba('0x11')](_0x62ba('0xf'),_0x2c78e9,'request\x20sent');_0x2d3397(_0x4b19d3[_0x62ba('0x12')][_0x62ba('0x10')]);}})[_0x62ba('0x13')](function(_0x371c24){logger[_0x62ba('0xe')](_0x62ba('0xf'),_0x2c78e9,_0x371c24);_0x3bfd53(_0x371c24);});});}exports[_0x62ba('0x14')]=function(_0x489b94){var _0x256f7a=this;return new Promise(function(_0x5913ee,_0x5c5cd3){return db[_0x62ba('0x15')][_0x62ba('0x16')]({'raw':_0x489b94[_0x62ba('0x17')]?_0x489b94['options']['raw']===undefined?!![]:![]:!![],'where':_0x489b94['options']?_0x489b94[_0x62ba('0x17')][_0x62ba('0x18')]||null:null,'attributes':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')]['attributes']||null:null,'limit':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')][_0x62ba('0x19')]||null:null,'include':_0x489b94[_0x62ba('0x17')]?_0x489b94[_0x62ba('0x17')][_0x62ba('0x1a')]?_[_0x62ba('0x1b')](_0x489b94[_0x62ba('0x17')][_0x62ba('0x1a')],function(_0x44438e){return{'model':db[_0x44438e[_0x62ba('0x1c')]],'as':_0x44438e['as'],'attributes':_0x44438e['attributes'],'include':_0x44438e['include']?_['map'](_0x44438e[_0x62ba('0x1a')],function(_0x1dd45b){return{'model':db[_0x1dd45b['model']],'as':_0x1dd45b['as'],'attributes':_0x1dd45b[_0x62ba('0x1d')],'include':_0x1dd45b[_0x62ba('0x1a')]?_[_0x62ba('0x1b')](_0x1dd45b[_0x62ba('0x1a')],function(_0x1ad93c){return{'model':db[_0x1ad93c[_0x62ba('0x1c')]],'as':_0x1ad93c['as'],'attributes':_0x1ad93c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x9b433f){logger['info'](_0x62ba('0x14'),_0x489b94);logger['debug'](_0x62ba('0x14'),_0x489b94,JSON['stringify'](_0x9b433f));_0x5913ee(_0x9b433f);})[_0x62ba('0x13')](function(_0x1f4602){logger['error'](_0x62ba('0x14'),_0x1f4602[_0x62ba('0x10')],_0x489b94);_0x5c5cd3(_0x256f7a[_0x62ba('0xe')](0x1f4,_0x1f4602[_0x62ba('0x10')]));});});}; \ No newline at end of file +var _0xf2a4=['attributes','limit','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','MailServerIn','findAll','options','where'];(function(_0x118f00,_0x1b2b45){var _0x468e03=function(_0x5cad0f){while(--_0x5cad0f){_0x118f00['push'](_0x118f00['shift']());}};_0x468e03(++_0x1b2b45);}(_0xf2a4,0xfe));var _0x4f2a=function(_0x493ad4,_0xe708f){_0x493ad4=_0x493ad4-0x0;var _0x4f4a4a=_0xf2a4[_0x493ad4];return _0x4f4a4a;};'use strict';var _=require(_0x4f2a('0x0'));var util=require(_0x4f2a('0x1'));var moment=require('moment');var BPromise=require(_0x4f2a('0x2'));var rs=require(_0x4f2a('0x3'));var fs=require('fs');var Redis=require(_0x4f2a('0x4'));var db=require(_0x4f2a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2a('0x6'))(_0x4f2a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f2a('0x8'));var client=jayson[_0x4f2a('0x9')][_0x4f2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e6757,_0x511463,_0x4bd1a7){return new BPromise(function(_0x465bfb,_0x2e3bd2){return client[_0x4f2a('0xb')](_0x3e6757,_0x4bd1a7)['then'](function(_0x3ab9f0){logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));logger[_0x4f2a('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x511463,_0x4f2a('0xe'),JSON[_0x4f2a('0x10')](_0x3ab9f0));if(_0x3ab9f0[_0x4f2a('0x11')]){if(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x12')]===0x1f4){logger[_0x4f2a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x511463,_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);return _0x2e3bd2(_0x3ab9f0[_0x4f2a('0x11')]['message']);}logger[_0x4f2a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x511463,_0x3ab9f0['error'][_0x4f2a('0x13')]);return _0x465bfb(_0x3ab9f0[_0x4f2a('0x11')][_0x4f2a('0x13')]);}else{logger[_0x4f2a('0xc')](_0x4f2a('0xd'),_0x511463,_0x4f2a('0xe'));_0x465bfb(_0x3ab9f0[_0x4f2a('0x14')][_0x4f2a('0x13')]);}})['catch'](function(_0x18980b){logger[_0x4f2a('0x11')](_0x4f2a('0xd'),_0x511463,_0x18980b);_0x2e3bd2(_0x18980b);});});}exports['GetMailServerIn']=function(_0x388f7b){var _0x505a6e=this;return new Promise(function(_0x48573a,_0x4451c2){return db[_0x4f2a('0x15')][_0x4f2a('0x16')]({'raw':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x18')]||null:null,'attributes':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x19')]||null:null,'limit':_0x388f7b[_0x4f2a('0x17')]?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1a')]||null:null,'include':_0x388f7b['options']?_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1b')]?_[_0x4f2a('0x1c')](_0x388f7b[_0x4f2a('0x17')][_0x4f2a('0x1b')],function(_0x131ba9){return{'model':db[_0x131ba9[_0x4f2a('0x1d')]],'as':_0x131ba9['as'],'attributes':_0x131ba9['attributes'],'include':_0x131ba9[_0x4f2a('0x1b')]?_['map'](_0x131ba9[_0x4f2a('0x1b')],function(_0x4f4137){return{'model':db[_0x4f4137[_0x4f2a('0x1d')]],'as':_0x4f4137['as'],'attributes':_0x4f4137[_0x4f2a('0x19')],'include':_0x4f4137[_0x4f2a('0x1b')]?_[_0x4f2a('0x1c')](_0x4f4137[_0x4f2a('0x1b')],function(_0x109879){return{'model':db[_0x109879[_0x4f2a('0x1d')]],'as':_0x109879['as'],'attributes':_0x109879['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4862){logger[_0x4f2a('0xc')]('GetMailServerIn',_0x388f7b);logger[_0x4f2a('0xf')]('GetMailServerIn',_0x388f7b,JSON[_0x4f2a('0x10')](_0x1f4862));_0x48573a(_0x1f4862);})[_0x4f2a('0x1e')](function(_0x518f12){logger[_0x4f2a('0x11')]('GetMailServerIn',_0x518f12[_0x4f2a('0x13')],_0x388f7b);_0x4451c2(_0x505a6e[_0x4f2a('0x11')](0x1f4,_0x518f12['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 7f53288..daf0a67 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(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x2f7bf6,_0xff298){_0x2f7bf6=_0x2f7bf6-0x0;var _0x3ffb0a=_0x7a54[_0x2f7bf6];return _0x3ffb0a;};'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 _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(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x4468c7,_0x4feadb){_0x4468c7=_0x4468c7-0x0;var _0x267858=_0x7a54[_0x4468c7];return _0x267858;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index fce254c..e13de9d 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 _0x0abf=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x2461f7,_0x42d91c){var _0x5525c3=function(_0x1674ea){while(--_0x1674ea){_0x2461f7['push'](_0x2461f7['shift']());}};_0x5525c3(++_0x42d91c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'description':{'type':Sequelize[_0xf0ab('0x1')]},'host':{'type':Sequelize[_0xf0ab('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf0ab('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf0ab('0x1')]},'authentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0972=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x5d3a30,_0x22ae38){var _0x391481=function(_0x52b3ce){while(--_0x52b3ce){_0x5d3a30['push'](_0x5d3a30['shift']());}};_0x391481(++_0x22ae38);}(_0x0972,0x64));var _0x2097=function(_0x2b1be9,_0x2b2568){_0x2b1be9=_0x2b1be9-0x0;var _0x1cdd7b=_0x0972[_0x2b1be9];return _0x1cdd7b;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2097('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x2097('0x1')]},'port':{'type':Sequelize[_0x2097('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2097('0x1')]},'authentication':{'type':Sequelize[_0x2097('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2097('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 684b57a..10abfea 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 _0xcdff=['../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','MailServerOut','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2e5981,_0xe4e846){var _0x6e4fef=function(_0x252b0c){while(--_0x252b0c){_0x2e5981['push'](_0x2e5981['shift']());}};_0x6e4fef(++_0xe4e846);}(_0xcdff,0xfd));var _0xfcdf=function(_0x2d30da,_0x571401){_0x2d30da=_0x2d30da-0x0;var _0x1f0a3c=_0xcdff[_0x2d30da];return _0x1f0a3c;};'use strict';var emlformat=require(_0xfcdf('0x0'));var rimraf=require(_0xfcdf('0x1'));var zipdir=require(_0xfcdf('0x2'));var jsonpatch=require(_0xfcdf('0x3'));var rp=require(_0xfcdf('0x4'));var moment=require(_0xfcdf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfcdf('0x6'));var sox=require('sox');var csv=require(_0xfcdf('0x7'));var ejs=require(_0xfcdf('0x8'));var fs=require('fs');var fs_extra=require(_0xfcdf('0x9'));var _=require(_0xfcdf('0xa'));var squel=require(_0xfcdf('0xb'));var crypto=require(_0xfcdf('0xc'));var jsforce=require(_0xfcdf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfcdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcdf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfcdf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcdf('0x10'));var logger=require(_0xfcdf('0x11'))(_0xfcdf('0x12'));var utils=require('../../config/utils');var config=require(_0xfcdf('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141727,_0x5c9764){_0x5c9764=_0x5c9764||0xcc;return function(_0x5be45a){if(_0x5be45a){return _0x141727[_0xfcdf('0x14')](_0x5c9764);}return _0x141727[_0xfcdf('0x15')](_0x5c9764)[_0xfcdf('0x16')]();};}function respondWithResult(_0xffca45,_0x314f18){_0x314f18=_0x314f18||0xc8;return function(_0x145887){if(_0x145887){return _0xffca45[_0xfcdf('0x15')](_0x314f18)[_0xfcdf('0x17')](_0x145887);}};}function respondWithFilteredResult(_0x1e3b33,_0x5ebb08){return function(_0x5b7272){if(_0x5b7272){var _0x131a94=typeof _0x5ebb08[_0xfcdf('0x18')]==='undefined'&&typeof _0x5ebb08[_0xfcdf('0x19')]===_0xfcdf('0x1a');var _0x31884e=_0x5b7272[_0xfcdf('0x1b')];var _0x24abb5=_0x131a94?0x0:_0x5ebb08['offset'];var _0x2bdfbf=_0x131a94?_0x5b7272[_0xfcdf('0x1b')]:_0x5ebb08[_0xfcdf('0x18')]+_0x5ebb08[_0xfcdf('0x19')];var _0x1d4591;if(_0x2bdfbf>=_0x31884e){_0x2bdfbf=_0x31884e;_0x1d4591=0xc8;}else{_0x1d4591=0xce;}_0x1e3b33[_0xfcdf('0x15')](_0x1d4591);return _0x1e3b33[_0xfcdf('0x1c')](_0xfcdf('0x1d'),_0x24abb5+'-'+_0x2bdfbf+'/'+_0x31884e)[_0xfcdf('0x17')](_0x5b7272);}return null;};}function patchUpdates(_0x3eaae3){return function(_0x47b637){try{jsonpatch['apply'](_0x47b637,_0x3eaae3,!![]);}catch(_0x7fb9ae){return BPromise['reject'](_0x7fb9ae);}return _0x47b637[_0xfcdf('0x1e')]();};}function saveUpdates(_0x1dd98a,_0xd6d9e5){return function(_0x402901){if(_0x402901){return _0x402901[_0xfcdf('0x1f')](_0x1dd98a)['then'](function(_0x10931f){return _0x10931f;});}return null;};}function removeEntity(_0x736b90,_0x149d2e){return function(_0x34c9f6){if(_0x34c9f6){return _0x34c9f6[_0xfcdf('0x20')]()[_0xfcdf('0x21')](function(){_0x736b90[_0xfcdf('0x15')](0xcc)[_0xfcdf('0x16')]();});}};}function handleEntityNotFound(_0x52c73e,_0x2310c0){return function(_0x4f7a09){if(!_0x4f7a09){_0x52c73e['sendStatus'](0x194);}return _0x4f7a09;};}function handleError(_0x5dfb60,_0xdcc0fb){_0xdcc0fb=_0xdcc0fb||0x1f4;return function(_0xa0eb54){logger[_0xfcdf('0x22')](_0xa0eb54[_0xfcdf('0x23')]);if(_0xa0eb54[_0xfcdf('0x24')]){delete _0xa0eb54[_0xfcdf('0x24')];}_0x5dfb60[_0xfcdf('0x15')](_0xdcc0fb)[_0xfcdf('0x25')](_0xa0eb54);};}exports[_0xfcdf('0x26')]=function(_0x2be6a5,_0xbded0b){var _0x58a35d={},_0xa79134={},_0x3166db={'count':0x0,'rows':[]};var _0x2d0733=_['map'](db['MailServerOut'][_0xfcdf('0x27')],function(_0x28207d){return{'name':_0x28207d['fieldName'],'type':_0x28207d['type'][_0xfcdf('0x28')]};});_0xa79134[_0xfcdf('0x29')]=_[_0xfcdf('0x2a')](_0x2d0733,_0xfcdf('0x24'));_0xa79134[_0xfcdf('0x2b')]=_[_0xfcdf('0x2c')](_0x2be6a5[_0xfcdf('0x2b')]);_0xa79134[_0xfcdf('0x2d')]=_['intersection'](_0xa79134[_0xfcdf('0x29')],_0xa79134[_0xfcdf('0x2b')]);_0x58a35d[_0xfcdf('0x2e')]=_[_0xfcdf('0x2f')](_0xa79134[_0xfcdf('0x29')],qs[_0xfcdf('0x30')](_0x2be6a5[_0xfcdf('0x2b')]['fields']));_0x58a35d[_0xfcdf('0x2e')]=_0x58a35d[_0xfcdf('0x2e')][_0xfcdf('0x31')]?_0x58a35d['attributes']:_0xa79134['model'];if(!_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x32')](_0xfcdf('0x33'))){_0x58a35d[_0xfcdf('0x19')]=qs[_0xfcdf('0x19')](_0x2be6a5[_0xfcdf('0x2b')]['limit']);_0x58a35d['offset']=qs[_0xfcdf('0x18')](_0x2be6a5['query']['offset']);}_0x58a35d['order']=qs[_0xfcdf('0x34')](_0x2be6a5['query'][_0xfcdf('0x34')]);_0x58a35d[_0xfcdf('0x35')]=qs['filters'](_['pick'](_0x2be6a5[_0xfcdf('0x2b')],_0xa79134[_0xfcdf('0x2d')]),_0x2d0733);if(_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x36')]){_0x58a35d[_0xfcdf('0x35')]=_['merge'](_0x58a35d[_0xfcdf('0x35')],{'$or':_[_0xfcdf('0x2a')](_0x2d0733,function(_0x43e19d){if(_0x43e19d['type']!=='VIRTUAL'){var _0x55db30={};_0x55db30[_0x43e19d[_0xfcdf('0x24')]]={'$like':'%'+_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x36')]+'%'};return _0x55db30;}})});}_0x58a35d=_[_0xfcdf('0x37')]({},_0x58a35d,_0x2be6a5[_0xfcdf('0x38')]);var _0x567ba8={'where':_0x58a35d[_0xfcdf('0x35')]};return db['MailServerOut']['count'](_0x567ba8)[_0xfcdf('0x21')](function(_0xd1b638){_0x3166db[_0xfcdf('0x1b')]=_0xd1b638;if(_0x2be6a5[_0xfcdf('0x2b')][_0xfcdf('0x39')]){_0x58a35d[_0xfcdf('0x3a')]=[{'all':!![]}];}return db['MailServerOut'][_0xfcdf('0x3b')](_0x58a35d);})[_0xfcdf('0x21')](function(_0x347db5){_0x3166db[_0xfcdf('0x3c')]=_0x347db5;return _0x3166db;})[_0xfcdf('0x21')](respondWithFilteredResult(_0xbded0b,_0x58a35d))[_0xfcdf('0x3d')](handleError(_0xbded0b,null));};exports[_0xfcdf('0x3e')]=function(_0x40982d,_0x562f7c){var _0x180cbb={'raw':!![],'where':{'id':_0x40982d[_0xfcdf('0x3f')]['id']}},_0x1356e2={};_0x1356e2[_0xfcdf('0x29')]=_['keys'](db[_0xfcdf('0x40')][_0xfcdf('0x27')]);_0x1356e2[_0xfcdf('0x2b')]=_[_0xfcdf('0x2c')](_0x40982d['query']);_0x1356e2[_0xfcdf('0x2d')]=_['intersection'](_0x1356e2[_0xfcdf('0x29')],_0x1356e2[_0xfcdf('0x2b')]);_0x180cbb[_0xfcdf('0x2e')]=_[_0xfcdf('0x2f')](_0x1356e2[_0xfcdf('0x29')],qs[_0xfcdf('0x30')](_0x40982d['query'][_0xfcdf('0x30')]));_0x180cbb[_0xfcdf('0x2e')]=_0x180cbb[_0xfcdf('0x2e')][_0xfcdf('0x31')]?_0x180cbb[_0xfcdf('0x2e')]:_0x1356e2[_0xfcdf('0x29')];if(_0x40982d[_0xfcdf('0x2b')][_0xfcdf('0x39')]){_0x180cbb[_0xfcdf('0x3a')]=[{'all':!![]}];}_0x180cbb=_[_0xfcdf('0x37')]({},_0x180cbb,_0x40982d['options']);return db[_0xfcdf('0x40')]['find'](_0x180cbb)[_0xfcdf('0x21')](handleEntityNotFound(_0x562f7c,null))['then'](respondWithResult(_0x562f7c,null))[_0xfcdf('0x3d')](handleError(_0x562f7c,null));};exports[_0xfcdf('0x41')]=function(_0x5b2a16,_0x36a882){return db['MailServerOut'][_0xfcdf('0x41')](_0x5b2a16[_0xfcdf('0x42')],{})['then'](respondWithResult(_0x36a882,0xc9))[_0xfcdf('0x3d')](handleError(_0x36a882,null));};exports[_0xfcdf('0x1f')]=function(_0x33322c,_0x4725e2){if(_0x33322c['body']['id']){delete _0x33322c[_0xfcdf('0x42')]['id'];}return db[_0xfcdf('0x40')][_0xfcdf('0x43')]({'where':{'id':_0x33322c[_0xfcdf('0x3f')]['id']}})[_0xfcdf('0x21')](handleEntityNotFound(_0x4725e2,null))[_0xfcdf('0x21')](saveUpdates(_0x33322c[_0xfcdf('0x42')],null))[_0xfcdf('0x21')](respondWithResult(_0x4725e2,null))[_0xfcdf('0x3d')](handleError(_0x4725e2,null));};exports[_0xfcdf('0x20')]=function(_0x3177a1,_0x25fd39){return db['MailServerOut']['find']({'where':{'id':_0x3177a1[_0xfcdf('0x3f')]['id']}})[_0xfcdf('0x21')](handleEntityNotFound(_0x25fd39,null))[_0xfcdf('0x21')](removeEntity(_0x25fd39,null))[_0xfcdf('0x3d')](handleError(_0x25fd39,null));}; \ No newline at end of file +var _0xa5df=['destroy','error','stack','name','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','include','create','body','catch','find','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then'];(function(_0x5e991d,_0x3d6434){var _0x517ba7=function(_0x1940de){while(--_0x1940de){_0x5e991d['push'](_0x5e991d['shift']());}};_0x517ba7(++_0x3d6434);}(_0xa5df,0x1a6));var _0xfa5d=function(_0x3ba5e7,_0x5c5676){_0x3ba5e7=_0x3ba5e7-0x0;var _0x3f88e8=_0xa5df[_0x3ba5e7];return _0x3f88e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa5d('0x0'));var zipdir=require(_0xfa5d('0x1'));var jsonpatch=require(_0xfa5d('0x2'));var rp=require(_0xfa5d('0x3'));var moment=require(_0xfa5d('0x4'));var BPromise=require(_0xfa5d('0x5'));var Mustache=require(_0xfa5d('0x6'));var util=require(_0xfa5d('0x7'));var path=require(_0xfa5d('0x8'));var sox=require(_0xfa5d('0x9'));var csv=require(_0xfa5d('0xa'));var ejs=require(_0xfa5d('0xb'));var fs=require('fs');var fs_extra=require(_0xfa5d('0xc'));var _=require(_0xfa5d('0xd'));var squel=require('squel');var crypto=require(_0xfa5d('0xe'));var jsforce=require(_0xfa5d('0xf'));var deskjs=require(_0xfa5d('0x10'));var toCsv=require(_0xfa5d('0xa'));var querystring=require(_0xfa5d('0x11'));var Papa=require(_0xfa5d('0x12'));var Redis=require(_0xfa5d('0x13'));var authService=require(_0xfa5d('0x14'));var qs=require(_0xfa5d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa5d('0x16'))(_0xfa5d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfa5d('0x18'));var db=require(_0xfa5d('0x19'))['db'];function respondWithStatusCode(_0x2b47c4,_0x4ffeac){_0x4ffeac=_0x4ffeac||0xcc;return function(_0x5e7873){if(_0x5e7873){return _0x2b47c4[_0xfa5d('0x1a')](_0x4ffeac);}return _0x2b47c4[_0xfa5d('0x1b')](_0x4ffeac)[_0xfa5d('0x1c')]();};}function respondWithResult(_0x1645c6,_0x2b87b3){_0x2b87b3=_0x2b87b3||0xc8;return function(_0x120aa5){if(_0x120aa5){return _0x1645c6[_0xfa5d('0x1b')](_0x2b87b3)['json'](_0x120aa5);}};}function respondWithFilteredResult(_0x49180c,_0x16b46b){return function(_0x4c14c2){if(_0x4c14c2){var _0x1e5513=typeof _0x16b46b['offset']==='undefined'&&typeof _0x16b46b[_0xfa5d('0x1d')]===_0xfa5d('0x1e');var _0x1fbb3f=_0x4c14c2[_0xfa5d('0x1f')];var _0x2f3fbd=_0x1e5513?0x0:_0x16b46b[_0xfa5d('0x20')];var _0x43c08b=_0x1e5513?_0x4c14c2[_0xfa5d('0x1f')]:_0x16b46b['offset']+_0x16b46b[_0xfa5d('0x1d')];var _0x5cbcd7;if(_0x43c08b>=_0x1fbb3f){_0x43c08b=_0x1fbb3f;_0x5cbcd7=0xc8;}else{_0x5cbcd7=0xce;}_0x49180c[_0xfa5d('0x1b')](_0x5cbcd7);return _0x49180c[_0xfa5d('0x21')](_0xfa5d('0x22'),_0x2f3fbd+'-'+_0x43c08b+'/'+_0x1fbb3f)[_0xfa5d('0x23')](_0x4c14c2);}return null;};}function patchUpdates(_0x5eeaca){return function(_0x578c29){try{jsonpatch[_0xfa5d('0x24')](_0x578c29,_0x5eeaca,!![]);}catch(_0x440efd){return BPromise['reject'](_0x440efd);}return _0x578c29[_0xfa5d('0x25')]();};}function saveUpdates(_0x38f7e9,_0x41f5fe){return function(_0x4d25fd){if(_0x4d25fd){return _0x4d25fd[_0xfa5d('0x26')](_0x38f7e9)[_0xfa5d('0x27')](function(_0x360dd2){return _0x360dd2;});}return null;};}function removeEntity(_0x32b835,_0xcaf205){return function(_0x520433){if(_0x520433){return _0x520433[_0xfa5d('0x28')]()[_0xfa5d('0x27')](function(){_0x32b835[_0xfa5d('0x1b')](0xcc)[_0xfa5d('0x1c')]();});}};}function handleEntityNotFound(_0x375b77,_0x41af37){return function(_0x43ac46){if(!_0x43ac46){_0x375b77[_0xfa5d('0x1a')](0x194);}return _0x43ac46;};}function handleError(_0x5a4f5e,_0x4abaea){_0x4abaea=_0x4abaea||0x1f4;return function(_0x1aaff2){logger[_0xfa5d('0x29')](_0x1aaff2[_0xfa5d('0x2a')]);if(_0x1aaff2[_0xfa5d('0x2b')]){delete _0x1aaff2[_0xfa5d('0x2b')];}_0x5a4f5e[_0xfa5d('0x1b')](_0x4abaea)['send'](_0x1aaff2);};}exports[_0xfa5d('0x2c')]=function(_0x1bf104,_0x44eeca){var _0x541279={},_0x31601e={},_0x5ea5ba={'count':0x0,'rows':[]};var _0xfeb175=_[_0xfa5d('0x2d')](db[_0xfa5d('0x2e')]['rawAttributes'],function(_0x4db1c6){return{'name':_0x4db1c6[_0xfa5d('0x2f')],'type':_0x4db1c6[_0xfa5d('0x30')][_0xfa5d('0x31')]};});_0x31601e[_0xfa5d('0x32')]=_[_0xfa5d('0x2d')](_0xfeb175,_0xfa5d('0x2b'));_0x31601e[_0xfa5d('0x33')]=_[_0xfa5d('0x34')](_0x1bf104['query']);_0x31601e[_0xfa5d('0x35')]=_[_0xfa5d('0x36')](_0x31601e[_0xfa5d('0x32')],_0x31601e[_0xfa5d('0x33')]);_0x541279['attributes']=_[_0xfa5d('0x36')](_0x31601e[_0xfa5d('0x32')],qs[_0xfa5d('0x37')](_0x1bf104[_0xfa5d('0x33')]['fields']));_0x541279[_0xfa5d('0x38')]=_0x541279[_0xfa5d('0x38')][_0xfa5d('0x39')]?_0x541279['attributes']:_0x31601e['model'];if(!_0x1bf104['query'][_0xfa5d('0x3a')](_0xfa5d('0x3b'))){_0x541279[_0xfa5d('0x1d')]=qs['limit'](_0x1bf104['query']['limit']);_0x541279[_0xfa5d('0x20')]=qs[_0xfa5d('0x20')](_0x1bf104[_0xfa5d('0x33')][_0xfa5d('0x20')]);}_0x541279[_0xfa5d('0x3c')]=qs[_0xfa5d('0x3d')](_0x1bf104['query'][_0xfa5d('0x3d')]);_0x541279['where']=qs[_0xfa5d('0x35')](_[_0xfa5d('0x3e')](_0x1bf104[_0xfa5d('0x33')],_0x31601e['filters']),_0xfeb175);if(_0x1bf104[_0xfa5d('0x33')][_0xfa5d('0x3f')]){_0x541279[_0xfa5d('0x40')]=_[_0xfa5d('0x41')](_0x541279[_0xfa5d('0x40')],{'$or':_[_0xfa5d('0x2d')](_0xfeb175,function(_0x421f01){if(_0x421f01[_0xfa5d('0x30')]!==_0xfa5d('0x42')){var _0x5a2466={};_0x5a2466[_0x421f01[_0xfa5d('0x2b')]]={'$like':'%'+_0x1bf104[_0xfa5d('0x33')]['filter']+'%'};return _0x5a2466;}})});}_0x541279=_[_0xfa5d('0x41')]({},_0x541279,_0x1bf104[_0xfa5d('0x43')]);var _0x3953b9={'where':_0x541279['where']};return db[_0xfa5d('0x2e')]['count'](_0x3953b9)[_0xfa5d('0x27')](function(_0x3856d5){_0x5ea5ba[_0xfa5d('0x1f')]=_0x3856d5;if(_0x1bf104[_0xfa5d('0x33')][_0xfa5d('0x44')]){_0x541279['include']=[{'all':!![]}];}return db[_0xfa5d('0x2e')][_0xfa5d('0x45')](_0x541279);})[_0xfa5d('0x27')](function(_0x3d896d){_0x5ea5ba['rows']=_0x3d896d;return _0x5ea5ba;})[_0xfa5d('0x27')](respondWithFilteredResult(_0x44eeca,_0x541279))['catch'](handleError(_0x44eeca,null));};exports[_0xfa5d('0x46')]=function(_0x341abd,_0x1901b8){var _0x4ee2b8={'raw':!![],'where':{'id':_0x341abd[_0xfa5d('0x47')]['id']}},_0x3b1e3f={};_0x3b1e3f[_0xfa5d('0x32')]=_[_0xfa5d('0x34')](db['MailServerOut']['rawAttributes']);_0x3b1e3f[_0xfa5d('0x33')]=_[_0xfa5d('0x34')](_0x341abd[_0xfa5d('0x33')]);_0x3b1e3f['filters']=_[_0xfa5d('0x36')](_0x3b1e3f[_0xfa5d('0x32')],_0x3b1e3f['query']);_0x4ee2b8['attributes']=_[_0xfa5d('0x36')](_0x3b1e3f['model'],qs['fields'](_0x341abd[_0xfa5d('0x33')][_0xfa5d('0x37')]));_0x4ee2b8[_0xfa5d('0x38')]=_0x4ee2b8[_0xfa5d('0x38')]['length']?_0x4ee2b8[_0xfa5d('0x38')]:_0x3b1e3f[_0xfa5d('0x32')];if(_0x341abd['query'][_0xfa5d('0x44')]){_0x4ee2b8[_0xfa5d('0x48')]=[{'all':!![]}];}_0x4ee2b8=_[_0xfa5d('0x41')]({},_0x4ee2b8,_0x341abd['options']);return db['MailServerOut']['find'](_0x4ee2b8)[_0xfa5d('0x27')](handleEntityNotFound(_0x1901b8,null))[_0xfa5d('0x27')](respondWithResult(_0x1901b8,null))['catch'](handleError(_0x1901b8,null));};exports[_0xfa5d('0x49')]=function(_0x45e215,_0x531d96){return db[_0xfa5d('0x2e')][_0xfa5d('0x49')](_0x45e215[_0xfa5d('0x4a')],{})[_0xfa5d('0x27')](respondWithResult(_0x531d96,0xc9))[_0xfa5d('0x4b')](handleError(_0x531d96,null));};exports['update']=function(_0x525e2f,_0x35fa7d){if(_0x525e2f[_0xfa5d('0x4a')]['id']){delete _0x525e2f['body']['id'];}return db[_0xfa5d('0x2e')]['find']({'where':{'id':_0x525e2f[_0xfa5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x35fa7d,null))[_0xfa5d('0x27')](saveUpdates(_0x525e2f[_0xfa5d('0x4a')],null))[_0xfa5d('0x27')](respondWithResult(_0x35fa7d,null))[_0xfa5d('0x4b')](handleError(_0x35fa7d,null));};exports['destroy']=function(_0x1ec031,_0x353777){return db[_0xfa5d('0x2e')][_0xfa5d('0x4c')]({'where':{'id':_0x1ec031[_0xfa5d('0x47')]['id']}})['then'](handleEntityNotFound(_0x353777,null))[_0xfa5d('0x27')](removeEntity(_0x353777,null))[_0xfa5d('0x4b')](handleError(_0x353777,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c878f11..e063426 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 _0xf605=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x5a07b8,_0xd276e9){var _0x7fdf64=function(_0x2b9d17){while(--_0x2b9d17){_0x5a07b8['push'](_0x5a07b8['shift']());}};_0x7fdf64(++_0xd276e9);}(_0xf605,0x14a));var _0x5f60=function(_0x3a37df,_0x46c381){_0x3a37df=_0x3a37df-0x0;var _0x33845c=_0xf605[_0x3a37df];return _0x33845c;};'use strict';var _=require(_0x5f60('0x0'));var util=require('util');var logger=require(_0x5f60('0x1'))('api');var moment=require(_0x5f60('0x2'));var BPromise=require(_0x5f60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f60('0x4'));var rimraf=require(_0x5f60('0x5'));var config=require(_0x5f60('0x6'));var attributes=require(_0x5f60('0x7'));module[_0x5f60('0x8')]=function(_0x578bf8,_0x4458fd){return _0x578bf8[_0x5f60('0x9')](_0x5f60('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb5b=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xfb5b,0x15a));var _0xbfb5=function(_0x4085c5,_0x5615b6){_0x4085c5=_0x4085c5-0x0;var _0xee1c3d=_0xfb5b[_0x4085c5];return _0xee1c3d;};'use strict';var _=require(_0xbfb5('0x0'));var util=require('util');var logger=require(_0xbfb5('0x1'))(_0xbfb5('0x2'));var moment=require(_0xbfb5('0x3'));var BPromise=require(_0xbfb5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfb5('0x5'));var rimraf=require(_0xbfb5('0x6'));var config=require(_0xbfb5('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xbfb5('0x8')]=function(_0xb72085,_0x30a80b){return _0xb72085[_0xbfb5('0x9')](_0xbfb5('0xa'),attributes,{'tableName':_0xbfb5('0xb'),'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 7951d2f..ca52e51 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(_0x501900,_0x192e75){var _0x52ed0d=function(_0x2fab46){while(--_0x2fab46){_0x501900['push'](_0x501900['shift']());}};_0x52ed0d(++_0x192e75);}(_0xdb28,0x106));var _0x8db2=function(_0x306cbf,_0x3fb272){_0x306cbf=_0x306cbf-0x0;var _0x4f0166=_0xdb28[_0x306cbf];return _0x4f0166;};'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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x11cda1,_0x239597){_0x11cda1=_0x11cda1-0x0;var _0x3d7cfb=_0x7a54[_0x11cda1];return _0x3d7cfb;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index edeeffb..c6bc36c 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 _0x9c08=['/:id','show','post','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c08,0xa6));var _0x89c0=function(_0x138c7d,_0x3960fe){_0x138c7d=_0x138c7d-0x0;var _0x50d843=_0x9c08[_0x138c7d];return _0x50d843;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x89c0('0x0'));var express=require(_0x89c0('0x1'));var router=express[_0x89c0('0x2')]();var fs_extra=require(_0x89c0('0x3'));var auth=require(_0x89c0('0x4'));var interaction=require(_0x89c0('0x5'));var config=require('../../config/environment');var controller=require(_0x89c0('0x6'));router[_0x89c0('0x7')]('/',auth[_0x89c0('0x8')](),controller[_0x89c0('0x9')]);router[_0x89c0('0x7')]('/describe',auth[_0x89c0('0x8')](),controller['describe']);router[_0x89c0('0x7')](_0x89c0('0xa'),auth[_0x89c0('0x8')](),controller[_0x89c0('0xb')]);router[_0x89c0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x89c0('0xa'),auth[_0x89c0('0x8')](),controller[_0x89c0('0xd')]);router['delete'](_0x89c0('0xa'),auth['isAuthenticated'](),controller[_0x89c0('0xe')]);module[_0x89c0('0xf')]=router; \ No newline at end of file +var _0x65ee=['/describe','describe','/:id','show','post','create','update','destroy','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x65ee,0xc4));var _0xe65e=function(_0x2cde56,_0x243e4c){_0x2cde56=_0x2cde56-0x0;var _0x4897cd=_0x65ee[_0x2cde56];return _0x4897cd;};'use strict';var multer=require('multer');var util=require(_0xe65e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe65e('0x1'));var auth=require(_0xe65e('0x2'));var interaction=require(_0xe65e('0x3'));var config=require(_0xe65e('0x4'));var controller=require(_0xe65e('0x5'));router[_0xe65e('0x6')]('/',auth[_0xe65e('0x7')](),controller['index']);router['get'](_0xe65e('0x8'),auth[_0xe65e('0x7')](),controller[_0xe65e('0x9')]);router['get'](_0xe65e('0xa'),auth[_0xe65e('0x7')](),controller[_0xe65e('0xb')]);router[_0xe65e('0xc')]('/',auth[_0xe65e('0x7')](),controller[_0xe65e('0xd')]);router['put'](_0xe65e('0xa'),auth[_0xe65e('0x7')](),controller[_0xe65e('0xe')]);router['delete'](_0xe65e('0xa'),auth[_0xe65e('0x7')](),controller[_0xe65e('0xf')]);module[_0xe65e('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1530967..d192314 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 _0xb091=['exports','STRING','name'];(function(_0xffd1b5,_0x1ede18){var _0x3176d6=function(_0xe9ba48){while(--_0xe9ba48){_0xffd1b5['push'](_0xffd1b5['shift']());}};_0x3176d6(++_0x1ede18);}(_0xb091,0x16e));var _0x1b09=function(_0x51edc5,_0x27f723){_0x51edc5=_0x51edc5-0x0;var _0x399ce6=_0xb091[_0x51edc5];return _0x399ce6;};'use strict';var Sequelize=require('sequelize');module[_0x1b09('0x0')]={'name':{'type':Sequelize[_0x1b09('0x1')],'unique':_0x1b09('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1b09('0x1')]}}; \ No newline at end of file +var _0xbd51=['name','sequelize','STRING'];(function(_0x199324,_0x3d486c){var _0x1cb3b2=function(_0x3d7435){while(--_0x3d7435){_0x199324['push'](_0x199324['shift']());}};_0x1cb3b2(++_0x3d486c);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1da6a3,_0x229b73){_0x1da6a3=_0x1da6a3-0x0;var _0x5e5114=_0xbd51[_0x1da6a3];return _0x5e5114;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'unique':_0x1bd5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1bd5('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 217f21d..ebc38b1 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 _0x7d69=['../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x9b4cda,_0x206ec1){var _0x1ac6c5=function(_0x4ba0a3){while(--_0x4ba0a3){_0x9b4cda['push'](_0x9b4cda['shift']());}};_0x1ac6c5(++_0x206ec1);}(_0x7d69,0x80));var _0x97d6=function(_0xfa4f6b,_0x5c6f62){_0xfa4f6b=_0xfa4f6b-0x0;var _0x2751aa=_0x7d69[_0xfa4f6b];return _0x2751aa;};'use strict';var emlformat=require(_0x97d6('0x0'));var rimraf=require(_0x97d6('0x1'));var zipdir=require(_0x97d6('0x2'));var jsonpatch=require(_0x97d6('0x3'));var rp=require('request-promise');var moment=require(_0x97d6('0x4'));var BPromise=require(_0x97d6('0x5'));var Mustache=require(_0x97d6('0x6'));var util=require('util');var path=require(_0x97d6('0x7'));var sox=require(_0x97d6('0x8'));var csv=require(_0x97d6('0x9'));var ejs=require(_0x97d6('0xa'));var fs=require('fs');var fs_extra=require(_0x97d6('0xb'));var _=require(_0x97d6('0xc'));var squel=require(_0x97d6('0xd'));var crypto=require(_0x97d6('0xe'));var jsforce=require(_0x97d6('0xf'));var deskjs=require(_0x97d6('0x10'));var toCsv=require(_0x97d6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x97d6('0x11'));var as=require(_0x97d6('0x12'));var hardwareService=require(_0x97d6('0x13'));var logger=require(_0x97d6('0x14'))('api');var utils=require(_0x97d6('0x15'));var config=require(_0x97d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x97d6('0x17'))['db'];function respondWithStatusCode(_0x39c588,_0x5a8c1e){_0x5a8c1e=_0x5a8c1e||0xcc;return function(_0x188c80){if(_0x188c80){return _0x39c588[_0x97d6('0x18')](_0x5a8c1e);}return _0x39c588[_0x97d6('0x19')](_0x5a8c1e)[_0x97d6('0x1a')]();};}function respondWithResult(_0x131f09,_0x28fc80){_0x28fc80=_0x28fc80||0xc8;return function(_0x3e6437){if(_0x3e6437){return _0x131f09[_0x97d6('0x19')](_0x28fc80)[_0x97d6('0x1b')](_0x3e6437);}};}function respondWithFilteredResult(_0x4d93b0,_0x5e575c){return function(_0x392ed6){if(_0x392ed6){var _0x4ba51e=typeof _0x5e575c['offset']==='undefined'&&typeof _0x5e575c[_0x97d6('0x1c')]===_0x97d6('0x1d');var _0x111f82=_0x392ed6[_0x97d6('0x1e')];var _0x352dee=_0x4ba51e?0x0:_0x5e575c[_0x97d6('0x1f')];var _0x1497c5=_0x4ba51e?_0x392ed6[_0x97d6('0x1e')]:_0x5e575c['offset']+_0x5e575c[_0x97d6('0x1c')];var _0x3302fb;if(_0x1497c5>=_0x111f82){_0x1497c5=_0x111f82;_0x3302fb=0xc8;}else{_0x3302fb=0xce;}_0x4d93b0[_0x97d6('0x19')](_0x3302fb);return _0x4d93b0[_0x97d6('0x20')](_0x97d6('0x21'),_0x352dee+'-'+_0x1497c5+'/'+_0x111f82)['json'](_0x392ed6);}return null;};}function patchUpdates(_0x59d99c){return function(_0x24d4d1){try{jsonpatch[_0x97d6('0x22')](_0x24d4d1,_0x59d99c,!![]);}catch(_0x2fb9c5){return BPromise[_0x97d6('0x23')](_0x2fb9c5);}return _0x24d4d1[_0x97d6('0x24')]();};}function saveUpdates(_0xf98084,_0x47f205){return function(_0x2a5d05){if(_0x2a5d05){return _0x2a5d05['update'](_0xf98084)[_0x97d6('0x25')](function(_0x57513a){return _0x57513a;});}return null;};}function removeEntity(_0x125009,_0x28a2d5){return function(_0x176f51){if(_0x176f51){return _0x176f51['destroy']()[_0x97d6('0x25')](function(){_0x125009[_0x97d6('0x19')](0xcc)[_0x97d6('0x1a')]();});}};}function handleEntityNotFound(_0x1eac82,_0xd7cad7){return function(_0x420523){if(!_0x420523){_0x1eac82['sendStatus'](0x194);}return _0x420523;};}function handleError(_0x3d609f,_0x3ff6a1){_0x3ff6a1=_0x3ff6a1||0x1f4;return function(_0x14614f){logger['error'](_0x14614f[_0x97d6('0x26')]);if(_0x14614f[_0x97d6('0x27')]){delete _0x14614f[_0x97d6('0x27')];}_0x3d609f[_0x97d6('0x19')](_0x3ff6a1)[_0x97d6('0x28')](_0x14614f);};}exports[_0x97d6('0x29')]=function(_0x5987b0,_0x5d4301){var _0x3cab51={},_0x7292b3={},_0xf86427={'count':0x0,'rows':[]};var _0x38a903=_[_0x97d6('0x2a')](db[_0x97d6('0x2b')][_0x97d6('0x2c')],function(_0x3a4845){return{'name':_0x3a4845[_0x97d6('0x2d')],'type':_0x3a4845[_0x97d6('0x2e')]['key']};});_0x7292b3[_0x97d6('0x2f')]=_['map'](_0x38a903,'name');_0x7292b3[_0x97d6('0x30')]=_[_0x97d6('0x31')](_0x5987b0[_0x97d6('0x30')]);_0x7292b3['filters']=_[_0x97d6('0x32')](_0x7292b3[_0x97d6('0x2f')],_0x7292b3[_0x97d6('0x30')]);_0x3cab51['attributes']=_[_0x97d6('0x32')](_0x7292b3['model'],qs[_0x97d6('0x33')](_0x5987b0[_0x97d6('0x30')][_0x97d6('0x33')]));_0x3cab51[_0x97d6('0x34')]=_0x3cab51[_0x97d6('0x34')][_0x97d6('0x35')]?_0x3cab51['attributes']:_0x7292b3[_0x97d6('0x2f')];if(!_0x5987b0[_0x97d6('0x30')][_0x97d6('0x36')](_0x97d6('0x37'))){_0x3cab51[_0x97d6('0x1c')]=qs[_0x97d6('0x1c')](_0x5987b0['query'][_0x97d6('0x1c')]);_0x3cab51[_0x97d6('0x1f')]=qs[_0x97d6('0x1f')](_0x5987b0[_0x97d6('0x30')][_0x97d6('0x1f')]);}_0x3cab51[_0x97d6('0x38')]=qs[_0x97d6('0x39')](_0x5987b0[_0x97d6('0x30')]['sort']);_0x3cab51[_0x97d6('0x3a')]=qs[_0x97d6('0x3b')](_['pick'](_0x5987b0[_0x97d6('0x30')],_0x7292b3[_0x97d6('0x3b')]),_0x38a903);if(_0x5987b0['query'][_0x97d6('0x3c')]){_0x3cab51[_0x97d6('0x3a')]=_[_0x97d6('0x3d')](_0x3cab51[_0x97d6('0x3a')],{'$or':_[_0x97d6('0x2a')](_0x38a903,function(_0x582d79){if(_0x582d79[_0x97d6('0x2e')]!==_0x97d6('0x3e')){var _0x4cadda={};_0x4cadda[_0x582d79[_0x97d6('0x27')]]={'$like':'%'+_0x5987b0[_0x97d6('0x30')][_0x97d6('0x3c')]+'%'};return _0x4cadda;}})});}_0x3cab51=_[_0x97d6('0x3d')]({},_0x3cab51,_0x5987b0[_0x97d6('0x3f')]);var _0xfa42df={'where':_0x3cab51[_0x97d6('0x3a')]};return db[_0x97d6('0x2b')][_0x97d6('0x1e')](_0xfa42df)[_0x97d6('0x25')](function(_0x4562b7){_0xf86427[_0x97d6('0x1e')]=_0x4562b7;if(_0x5987b0[_0x97d6('0x30')][_0x97d6('0x40')]){_0x3cab51[_0x97d6('0x41')]=[{'all':!![]}];}return db[_0x97d6('0x2b')][_0x97d6('0x42')](_0x3cab51);})[_0x97d6('0x25')](function(_0x38e26f){_0xf86427[_0x97d6('0x43')]=_0x38e26f;return _0xf86427;})[_0x97d6('0x25')](respondWithFilteredResult(_0x5d4301,_0x3cab51))[_0x97d6('0x44')](handleError(_0x5d4301,null));};exports[_0x97d6('0x45')]=function(_0x41db41,_0x8321e1){var _0x409c94={'raw':!![],'where':{'id':_0x41db41[_0x97d6('0x46')]['id']}},_0x199777={};_0x199777[_0x97d6('0x2f')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x199777[_0x97d6('0x30')]=_[_0x97d6('0x31')](_0x41db41[_0x97d6('0x30')]);_0x199777['filters']=_['intersection'](_0x199777[_0x97d6('0x2f')],_0x199777[_0x97d6('0x30')]);_0x409c94[_0x97d6('0x34')]=_[_0x97d6('0x32')](_0x199777[_0x97d6('0x2f')],qs[_0x97d6('0x33')](_0x41db41[_0x97d6('0x30')]['fields']));_0x409c94[_0x97d6('0x34')]=_0x409c94[_0x97d6('0x34')][_0x97d6('0x35')]?_0x409c94['attributes']:_0x199777[_0x97d6('0x2f')];if(_0x41db41['query'][_0x97d6('0x40')]){_0x409c94[_0x97d6('0x41')]=[{'all':!![]}];}_0x409c94=_['merge']({},_0x409c94,_0x41db41[_0x97d6('0x3f')]);return db[_0x97d6('0x2b')][_0x97d6('0x47')](_0x409c94)[_0x97d6('0x25')](handleEntityNotFound(_0x8321e1,null))['then'](respondWithResult(_0x8321e1,null))[_0x97d6('0x44')](handleError(_0x8321e1,null));};exports['create']=function(_0x49bc23,_0x3af6ab){return db[_0x97d6('0x2b')]['create'](_0x49bc23['body'],{})[_0x97d6('0x25')](respondWithResult(_0x3af6ab,0xc9))[_0x97d6('0x44')](handleError(_0x3af6ab,null));};exports[_0x97d6('0x48')]=function(_0xe1f5e5,_0x133fa9){if(_0xe1f5e5[_0x97d6('0x49')]['id']){delete _0xe1f5e5[_0x97d6('0x49')]['id'];}return db['MailSubstatus'][_0x97d6('0x47')]({'where':{'id':_0xe1f5e5[_0x97d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x133fa9,null))['then'](saveUpdates(_0xe1f5e5[_0x97d6('0x49')],null))['then'](respondWithResult(_0x133fa9,null))[_0x97d6('0x44')](handleError(_0x133fa9,null));};exports['destroy']=function(_0x422e8c,_0x2caefa){return db[_0x97d6('0x2b')][_0x97d6('0x47')]({'where':{'id':_0x422e8c[_0x97d6('0x46')]['id']}})[_0x97d6('0x25')](handleEntityNotFound(_0x2caefa,null))['then'](removeEntity(_0x2caefa,null))['catch'](handleError(_0x2caefa,null));};exports[_0x97d6('0x4a')]=function(_0x28f1e3,_0x354b08){return db[_0x97d6('0x2b')][_0x97d6('0x4a')]()[_0x97d6('0x25')](respondWithResult(_0x354b08,null))[_0x97d6('0x44')](handleError(_0x354b08,null));}; \ No newline at end of file +var _0xe4ec=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','json','apply','reject','update','then','destroy','end','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch'];(function(_0x1081aa,_0x4830b4){var _0x719c2=function(_0x272df9){while(--_0x272df9){_0x1081aa['push'](_0x1081aa['shift']());}};_0x719c2(++_0x4830b4);}(_0xe4ec,0x11c));var _0xce4e=function(_0x3ad5c3,_0x39a1c6){_0x3ad5c3=_0x3ad5c3-0x0;var _0x247421=_0xe4ec[_0x3ad5c3];return _0x247421;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce4e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce4e('0x1'));var rp=require(_0xce4e('0x2'));var moment=require(_0xce4e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce4e('0x4'));var util=require(_0xce4e('0x5'));var path=require(_0xce4e('0x6'));var sox=require(_0xce4e('0x7'));var csv=require(_0xce4e('0x8'));var ejs=require(_0xce4e('0x9'));var fs=require('fs');var fs_extra=require(_0xce4e('0xa'));var _=require('lodash');var squel=require(_0xce4e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xce4e('0xc'));var toCsv=require(_0xce4e('0x8'));var querystring=require(_0xce4e('0xd'));var Papa=require(_0xce4e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce4e('0xf'));var hardwareService=require(_0xce4e('0x10'));var logger=require(_0xce4e('0x11'))(_0xce4e('0x12'));var utils=require(_0xce4e('0x13'));var config=require(_0xce4e('0x14'));var licenseUtil=require(_0xce4e('0x15'));var db=require(_0xce4e('0x16'))['db'];function respondWithStatusCode(_0x487008,_0xc7d2de){_0xc7d2de=_0xc7d2de||0xcc;return function(_0xd6de69){if(_0xd6de69){return _0x487008[_0xce4e('0x17')](_0xc7d2de);}return _0x487008[_0xce4e('0x18')](_0xc7d2de)['end']();};}function respondWithResult(_0x577d20,_0xc0cac5){_0xc0cac5=_0xc0cac5||0xc8;return function(_0x18890c){if(_0x18890c){return _0x577d20[_0xce4e('0x18')](_0xc0cac5)['json'](_0x18890c);}};}function respondWithFilteredResult(_0x5c2890,_0x813e7e){return function(_0x2ec4b5){if(_0x2ec4b5){var _0x1eeac2=typeof _0x813e7e['offset']===_0xce4e('0x19')&&typeof _0x813e7e['limit']==='undefined';var _0x5e298b=_0x2ec4b5[_0xce4e('0x1a')];var _0xeb7bc6=_0x1eeac2?0x0:_0x813e7e[_0xce4e('0x1b')];var _0x480aef=_0x1eeac2?_0x2ec4b5[_0xce4e('0x1a')]:_0x813e7e['offset']+_0x813e7e['limit'];var _0x339750;if(_0x480aef>=_0x5e298b){_0x480aef=_0x5e298b;_0x339750=0xc8;}else{_0x339750=0xce;}_0x5c2890[_0xce4e('0x18')](_0x339750);return _0x5c2890[_0xce4e('0x1c')]('Content-Range',_0xeb7bc6+'-'+_0x480aef+'/'+_0x5e298b)[_0xce4e('0x1d')](_0x2ec4b5);}return null;};}function patchUpdates(_0x1ba5de){return function(_0x4b996){try{jsonpatch[_0xce4e('0x1e')](_0x4b996,_0x1ba5de,!![]);}catch(_0x303d11){return BPromise[_0xce4e('0x1f')](_0x303d11);}return _0x4b996['save']();};}function saveUpdates(_0x510da7,_0x23df52){return function(_0x29a424){if(_0x29a424){return _0x29a424[_0xce4e('0x20')](_0x510da7)[_0xce4e('0x21')](function(_0x591230){return _0x591230;});}return null;};}function removeEntity(_0x24fbbb,_0x411ca2){return function(_0x453c10){if(_0x453c10){return _0x453c10[_0xce4e('0x22')]()['then'](function(){_0x24fbbb[_0xce4e('0x18')](0xcc)[_0xce4e('0x23')]();});}};}function handleEntityNotFound(_0x2c8a57,_0x209fbf){return function(_0xba0574){if(!_0xba0574){_0x2c8a57[_0xce4e('0x17')](0x194);}return _0xba0574;};}function handleError(_0x2cef83,_0x12cd69){_0x12cd69=_0x12cd69||0x1f4;return function(_0x5a9c42){logger[_0xce4e('0x24')](_0x5a9c42[_0xce4e('0x25')]);if(_0x5a9c42[_0xce4e('0x26')]){delete _0x5a9c42[_0xce4e('0x26')];}_0x2cef83['status'](_0x12cd69)['send'](_0x5a9c42);};}exports[_0xce4e('0x27')]=function(_0x3b3710,_0x23d055){var _0x1373cc={},_0x4241f8={},_0x1b53b1={'count':0x0,'rows':[]};var _0x415454=_[_0xce4e('0x28')](db[_0xce4e('0x29')][_0xce4e('0x2a')],function(_0x4f8896){return{'name':_0x4f8896[_0xce4e('0x2b')],'type':_0x4f8896[_0xce4e('0x2c')][_0xce4e('0x2d')]};});_0x4241f8[_0xce4e('0x2e')]=_[_0xce4e('0x28')](_0x415454,_0xce4e('0x26'));_0x4241f8[_0xce4e('0x2f')]=_[_0xce4e('0x30')](_0x3b3710[_0xce4e('0x2f')]);_0x4241f8[_0xce4e('0x31')]=_[_0xce4e('0x32')](_0x4241f8['model'],_0x4241f8[_0xce4e('0x2f')]);_0x1373cc['attributes']=_[_0xce4e('0x32')](_0x4241f8[_0xce4e('0x2e')],qs[_0xce4e('0x33')](_0x3b3710[_0xce4e('0x2f')][_0xce4e('0x33')]));_0x1373cc['attributes']=_0x1373cc[_0xce4e('0x34')][_0xce4e('0x35')]?_0x1373cc[_0xce4e('0x34')]:_0x4241f8['model'];if(!_0x3b3710[_0xce4e('0x2f')][_0xce4e('0x36')](_0xce4e('0x37'))){_0x1373cc[_0xce4e('0x38')]=qs[_0xce4e('0x38')](_0x3b3710[_0xce4e('0x2f')][_0xce4e('0x38')]);_0x1373cc['offset']=qs[_0xce4e('0x1b')](_0x3b3710[_0xce4e('0x2f')]['offset']);}_0x1373cc[_0xce4e('0x39')]=qs[_0xce4e('0x3a')](_0x3b3710['query'][_0xce4e('0x3a')]);_0x1373cc[_0xce4e('0x3b')]=qs[_0xce4e('0x31')](_[_0xce4e('0x3c')](_0x3b3710[_0xce4e('0x2f')],_0x4241f8[_0xce4e('0x31')]),_0x415454);if(_0x3b3710[_0xce4e('0x2f')]['filter']){_0x1373cc[_0xce4e('0x3b')]=_[_0xce4e('0x3d')](_0x1373cc[_0xce4e('0x3b')],{'$or':_['map'](_0x415454,function(_0x3b8d9f){if(_0x3b8d9f['type']!==_0xce4e('0x3e')){var _0x12917d={};_0x12917d[_0x3b8d9f[_0xce4e('0x26')]]={'$like':'%'+_0x3b3710[_0xce4e('0x2f')][_0xce4e('0x3f')]+'%'};return _0x12917d;}})});}_0x1373cc=_['merge']({},_0x1373cc,_0x3b3710[_0xce4e('0x40')]);var _0x5d5aaf={'where':_0x1373cc[_0xce4e('0x3b')]};return db['MailSubstatus'][_0xce4e('0x1a')](_0x5d5aaf)[_0xce4e('0x21')](function(_0x3a9dcc){_0x1b53b1[_0xce4e('0x1a')]=_0x3a9dcc;if(_0x3b3710[_0xce4e('0x2f')][_0xce4e('0x41')]){_0x1373cc['include']=[{'all':!![]}];}return db[_0xce4e('0x29')][_0xce4e('0x42')](_0x1373cc);})[_0xce4e('0x21')](function(_0x5311b2){_0x1b53b1[_0xce4e('0x43')]=_0x5311b2;return _0x1b53b1;})['then'](respondWithFilteredResult(_0x23d055,_0x1373cc))['catch'](handleError(_0x23d055,null));};exports[_0xce4e('0x44')]=function(_0x715e7b,_0x245944){var _0x1c0a13={'raw':!![],'where':{'id':_0x715e7b[_0xce4e('0x45')]['id']}},_0x339ed8={};_0x339ed8[_0xce4e('0x2e')]=_[_0xce4e('0x30')](db[_0xce4e('0x29')][_0xce4e('0x2a')]);_0x339ed8[_0xce4e('0x2f')]=_[_0xce4e('0x30')](_0x715e7b[_0xce4e('0x2f')]);_0x339ed8['filters']=_['intersection'](_0x339ed8['model'],_0x339ed8['query']);_0x1c0a13['attributes']=_[_0xce4e('0x32')](_0x339ed8[_0xce4e('0x2e')],qs[_0xce4e('0x33')](_0x715e7b[_0xce4e('0x2f')]['fields']));_0x1c0a13['attributes']=_0x1c0a13[_0xce4e('0x34')]['length']?_0x1c0a13[_0xce4e('0x34')]:_0x339ed8[_0xce4e('0x2e')];if(_0x715e7b[_0xce4e('0x2f')][_0xce4e('0x41')]){_0x1c0a13['include']=[{'all':!![]}];}_0x1c0a13=_[_0xce4e('0x3d')]({},_0x1c0a13,_0x715e7b[_0xce4e('0x40')]);return db[_0xce4e('0x29')][_0xce4e('0x46')](_0x1c0a13)[_0xce4e('0x21')](handleEntityNotFound(_0x245944,null))[_0xce4e('0x21')](respondWithResult(_0x245944,null))[_0xce4e('0x47')](handleError(_0x245944,null));};exports['create']=function(_0x2ee86b,_0x21caca){return db[_0xce4e('0x29')][_0xce4e('0x48')](_0x2ee86b[_0xce4e('0x49')],{})[_0xce4e('0x21')](respondWithResult(_0x21caca,0xc9))[_0xce4e('0x47')](handleError(_0x21caca,null));};exports['update']=function(_0x4dc04a,_0x4e07db){if(_0x4dc04a[_0xce4e('0x49')]['id']){delete _0x4dc04a[_0xce4e('0x49')]['id'];}return db['MailSubstatus'][_0xce4e('0x46')]({'where':{'id':_0x4dc04a[_0xce4e('0x45')]['id']}})[_0xce4e('0x21')](handleEntityNotFound(_0x4e07db,null))['then'](saveUpdates(_0x4dc04a[_0xce4e('0x49')],null))[_0xce4e('0x21')](respondWithResult(_0x4e07db,null))[_0xce4e('0x47')](handleError(_0x4e07db,null));};exports[_0xce4e('0x22')]=function(_0x1b763a,_0xdc3782){return db[_0xce4e('0x29')][_0xce4e('0x46')]({'where':{'id':_0x1b763a[_0xce4e('0x45')]['id']}})[_0xce4e('0x21')](handleEntityNotFound(_0xdc3782,null))[_0xce4e('0x21')](removeEntity(_0xdc3782,null))['catch'](handleError(_0xdc3782,null));};exports[_0xce4e('0x4a')]=function(_0x2e62b0,_0xa79513){return db[_0xce4e('0x29')][_0xce4e('0x4a')]()['then'](respondWithResult(_0xa79513,null))[_0xce4e('0x47')](handleError(_0xa79513,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a8522c7..6e2214b 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 _0xa0ab=['update','emit','hook','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa0ab,0x184));var _0xba0a=function(_0x3f087a,_0x394fec){_0x3f087a=_0x3f087a-0x0;var _0x442662=_0xa0ab[_0x3f087a];return _0x442662;};'use strict';var EventEmitter=require(_0xba0a('0x0'));var MailSubstatus=require(_0xba0a('0x1'))['db'][_0xba0a('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xba0a('0x3')](0x0);var events={'afterUpdate':_0xba0a('0x4')};function emitEvent(_0x3ad7d2){return function(_0x4a39b4,_0x24f458,_0x250ae4){MailSubstatusEvents['emit'](_0x3ad7d2+':'+_0x4a39b4['id'],_0x4a39b4);MailSubstatusEvents[_0xba0a('0x5')](_0x3ad7d2,_0x4a39b4);_0x250ae4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xba0a('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xd103=['hasOwnProperty','exports','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x5b54d4,_0x37112c){var _0x4c19b7=function(_0x2d3317){while(--_0x2d3317){_0x5b54d4['push'](_0x5b54d4['shift']());}};_0x4c19b7(++_0x37112c);}(_0xd103,0xaa));var _0x3d10=function(_0x2325f6,_0x472fe9){_0x2325f6=_0x2325f6-0x0;var _0x678ad3=_0xd103[_0x2325f6];return _0x678ad3;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3d10('0x0'))['db'][_0x3d10('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3d10('0x2')](0x0);var events={'afterUpdate':_0x3d10('0x3')};function emitEvent(_0x16c99d){return function(_0x51c6da,_0x2c5357,_0x484616){MailSubstatusEvents[_0x3d10('0x4')](_0x16c99d+':'+_0x51c6da['id'],_0x51c6da);MailSubstatusEvents[_0x3d10('0x4')](_0x16c99d,_0x51c6da);_0x484616(null);};}for(var e in events){if(events[_0x3d10('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x3d10('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d5af196..30011b0 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 _0xa3c0=['update','name','mailSubstatus','_previousDataValues','catch','MailSubstatus'];(function(_0x58494e,_0x541fc9){var _0xb6cc65=function(_0x312336){while(--_0x312336){_0x58494e['push'](_0x58494e['shift']());}};_0xb6cc65(++_0x541fc9);}(_0xa3c0,0x11f));var _0x0a3c=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xa3c0[_0x55ff3e];return _0x2709eb;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x53e452){var _0x1b6e93=_0x53e452['models'];return _0x53e452['define'](_0x0a3c('0x0'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x26b8e1,_0x1748d2,_0x12a995){return _0x1b6e93['Condition'][_0x0a3c('0x1')]({'value':_0x26b8e1[_0x0a3c('0x2')]},{'where':{'field':_0x0a3c('0x3'),'value':_0x26b8e1[_0x0a3c('0x4')][_0x0a3c('0x2')]}})['then'](function(){_0x12a995();})[_0x0a3c('0x5')](function(_0x17b537){_0x12a995(_0x17b537);});}}});}; \ No newline at end of file +var _0x8b26=['mail_substatuses','Condition','update','name','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus'];(function(_0x1b2f0c,_0x4d3724){var _0x505282=function(_0x5dcb1e){while(--_0x5dcb1e){_0x1b2f0c['push'](_0x1b2f0c['shift']());}};_0x505282(++_0x4d3724);}(_0x8b26,0x1f3));var _0x68b2=function(_0x410c09,_0xe6e6ac){_0x410c09=_0x410c09-0x0;var _0x4d232d=_0x8b26[_0x410c09];return _0x4d232d;};'use strict';var attributes=require(_0x68b2('0x0'));module[_0x68b2('0x1')]=function(_0xce9895){var _0x4b5104=_0xce9895[_0x68b2('0x2')];return _0xce9895[_0x68b2('0x3')](_0x68b2('0x4'),attributes,{'tableName':_0x68b2('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x365d1f,_0x40c5ab,_0x2b587a){return _0x4b5104[_0x68b2('0x6')][_0x68b2('0x7')]({'value':_0x365d1f[_0x68b2('0x8')]},{'where':{'field':'mailSubstatus','value':_0x365d1f[_0x68b2('0x9')][_0x68b2('0x8')]}})[_0x68b2('0xa')](function(){_0x2b587a();})[_0x68b2('0xb')](function(_0x5c3531){_0x2b587a(_0x5c3531);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c884794..73acccc 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 _0xa230=['catch','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xa230,0xbe));var _0x0a23=function(_0x5f4505,_0x4ae2ac){_0x5f4505=_0x5f4505-0x0;var _0x40bf1b=_0xa230[_0x5f4505];return _0x40bf1b;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));var moment=require('moment');var BPromise=require(_0x0a23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a23('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a23('0x3'))(_0x0a23('0x4'));var config=require(_0x0a23('0x5'));var jayson=require(_0x0a23('0x6'));var client=jayson[_0x0a23('0x7')][_0x0a23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x265e3c,_0x1aefed,_0x59e7a7){return new BPromise(function(_0x161f7c,_0x6f97b5){return client[_0x0a23('0x9')](_0x265e3c,_0x59e7a7)['then'](function(_0x43e288){logger[_0x0a23('0xa')](_0x0a23('0xb'),_0x1aefed,'request\x20sent');logger[_0x0a23('0xc')](_0x0a23('0xd'),_0x1aefed,_0x0a23('0xe'),JSON[_0x0a23('0xf')](_0x43e288));if(_0x43e288[_0x0a23('0x10')]){if(_0x43e288[_0x0a23('0x10')][_0x0a23('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1aefed,_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);return _0x6f97b5(_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);}logger[_0x0a23('0x10')](_0x0a23('0xb'),_0x1aefed,_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);return _0x161f7c(_0x43e288[_0x0a23('0x10')][_0x0a23('0x12')]);}else{logger[_0x0a23('0xa')](_0x0a23('0xb'),_0x1aefed,_0x0a23('0xe'));_0x161f7c(_0x43e288[_0x0a23('0x13')][_0x0a23('0x12')]);}})[_0x0a23('0x14')](function(_0x1b410a){logger['error'](_0x0a23('0xb'),_0x1aefed,_0x1b410a);_0x6f97b5(_0x1b410a);});});} \ No newline at end of file +var _0x7e1b=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7e1b,0x119));var _0xb7e1=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x7e1b[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xb7e1('0x0'));var util=require(_0xb7e1('0x1'));var moment=require(_0xb7e1('0x2'));var BPromise=require(_0xb7e1('0x3'));var rs=require(_0xb7e1('0x4'));var fs=require('fs');var Redis=require(_0xb7e1('0x5'));var db=require(_0xb7e1('0x6'))['db'];var utils=require(_0xb7e1('0x7'));var logger=require('../../config/logger')(_0xb7e1('0x8'));var config=require(_0xb7e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb7e1('0xa')][_0xb7e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d3d1e,_0x299a57,_0x22686b){return new BPromise(function(_0x3ab74d,_0x367c70){return client[_0xb7e1('0xc')](_0x5d3d1e,_0x22686b)['then'](function(_0x657c9f){logger[_0xb7e1('0xd')](_0xb7e1('0xe'),_0x299a57,_0xb7e1('0xf'));logger[_0xb7e1('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x299a57,'request\x20sent',JSON[_0xb7e1('0x11')](_0x657c9f));if(_0x657c9f['error']){if(_0x657c9f[_0xb7e1('0x12')][_0xb7e1('0x13')]===0x1f4){logger[_0xb7e1('0x12')](_0xb7e1('0xe'),_0x299a57,_0x657c9f['error'][_0xb7e1('0x14')]);return _0x367c70(_0x657c9f[_0xb7e1('0x12')][_0xb7e1('0x14')]);}logger[_0xb7e1('0x12')](_0xb7e1('0xe'),_0x299a57,_0x657c9f['error'][_0xb7e1('0x14')]);return _0x3ab74d(_0x657c9f[_0xb7e1('0x12')]['message']);}else{logger[_0xb7e1('0xd')](_0xb7e1('0xe'),_0x299a57,_0xb7e1('0xf'));_0x3ab74d(_0x657c9f[_0xb7e1('0x15')][_0xb7e1('0x14')]);}})['catch'](function(_0x287bac){logger[_0xb7e1('0x12')](_0xb7e1('0xe'),_0x299a57,_0x287bac);_0x367c70(_0x287bac);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 06bcd0a..0d3e76a 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 _0xd404=['put','delete','/:id','multer','path','connect-timeout','express','fs-extra','./mailTransferReport.controller','/describe','isAuthenticated','describe','get','show','post'];(function(_0x3f3998,_0x26cbb7){var _0x40e0c1=function(_0x2def78){while(--_0x2def78){_0x3f3998['push'](_0x3f3998['shift']());}};_0x40e0c1(++_0x26cbb7);}(_0xd404,0xc6));var _0x4d40=function(_0x2fe44f,_0x86bba1){_0x2fe44f=_0x2fe44f-0x0;var _0x1623b2=_0xd404[_0x2fe44f];return _0x1623b2;};'use strict';var multer=require(_0x4d40('0x0'));var util=require('util');var path=require(_0x4d40('0x1'));var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d40('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4d40('0x6'),auth[_0x4d40('0x7')](),controller[_0x4d40('0x8')]);router[_0x4d40('0x9')]('/:id',auth[_0x4d40('0x7')](),controller[_0x4d40('0xa')]);router[_0x4d40('0xb')]('/',auth[_0x4d40('0x7')](),controller['create']);router[_0x4d40('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4d40('0xd')](_0x4d40('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2582=['isAuthenticated','index','get','/describe','post','create','update','delete','/:id','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x50ccf1,_0x57e553){var _0x4abd29=function(_0x2760cd){while(--_0x2760cd){_0x50ccf1['push'](_0x50ccf1['shift']());}};_0x4abd29(++_0x57e553);}(_0x2582,0xf4));var _0x2258=function(_0x24c55d,_0x35e9f0){_0x24c55d=_0x24c55d-0x0;var _0x3776ba=_0x2582[_0x24c55d];return _0x3776ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2258('0x0'));var timeout=require(_0x2258('0x1'));var express=require('express');var router=express[_0x2258('0x2')]();var fs_extra=require(_0x2258('0x3'));var auth=require(_0x2258('0x4'));var interaction=require(_0x2258('0x5'));var config=require(_0x2258('0x6'));var controller=require(_0x2258('0x7'));router['get']('/',auth[_0x2258('0x8')](),controller[_0x2258('0x9')]);router[_0x2258('0xa')](_0x2258('0xb'),auth[_0x2258('0x8')](),controller['describe']);router[_0x2258('0xa')]('/:id',auth[_0x2258('0x8')](),controller['show']);router[_0x2258('0xc')]('/',auth[_0x2258('0x8')](),controller[_0x2258('0xd')]);router['put']('/:id',auth[_0x2258('0x8')](),controller[_0x2258('0xe')]);router[_0x2258('0xf')](_0x2258('0x10'),auth[_0x2258('0x8')](),controller[_0x2258('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2b6b1b9..0e3d901 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x1d0e07,_0x2037e9){var _0x8912e0=function(_0x3b1c66){while(--_0x3b1c66){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x8912e0(++_0x2037e9);}(_0x34e8,0x12c));var _0x834e=function(_0xf441e1,_0x4dbd55){_0xf441e1=_0xf441e1-0x0;var _0x2f63b4=_0x34e8[_0xf441e1];return _0x2f63b4;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2a9443,_0x38a994){var _0x4cae68=function(_0xa3cb8b){while(--_0xa3cb8b){_0x2a9443['push'](_0x2a9443['shift']());}};_0x4cae68(++_0x38a994);}(_0xedd9,0xfc));var _0x9edd=function(_0x153fce,_0x4526e6){_0x153fce=_0x153fce-0x0;var _0x503fb5=_0xedd9[_0x153fce];return _0x503fb5;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 432a0b5..d760ff4 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 _0xbd01=['MailTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','index','map'];(function(_0x389fe6,_0x159923){var _0x36564d=function(_0x5a1a74){while(--_0x5a1a74){_0x389fe6['push'](_0x389fe6['shift']());}};_0x36564d(++_0x159923);}(_0xbd01,0x1f4));var _0x1bd0=function(_0x3b9e4e,_0x3db369){_0x3b9e4e=_0x3b9e4e-0x0;var _0x14e6f9=_0xbd01[_0x3b9e4e];return _0x14e6f9;};'use strict';var emlformat=require(_0x1bd0('0x0'));var rimraf=require(_0x1bd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1bd0('0x2'));var moment=require('moment');var BPromise=require(_0x1bd0('0x3'));var Mustache=require(_0x1bd0('0x4'));var util=require(_0x1bd0('0x5'));var path=require(_0x1bd0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1bd0('0x7'));var fs=require('fs');var fs_extra=require(_0x1bd0('0x8'));var _=require(_0x1bd0('0x9'));var squel=require(_0x1bd0('0xa'));var crypto=require(_0x1bd0('0xb'));var jsforce=require(_0x1bd0('0xc'));var deskjs=require(_0x1bd0('0xd'));var toCsv=require(_0x1bd0('0xe'));var querystring=require(_0x1bd0('0xf'));var Papa=require('papaparse');var Redis=require(_0x1bd0('0x10'));var authService=require(_0x1bd0('0x11'));var qs=require(_0x1bd0('0x12'));var as=require(_0x1bd0('0x13'));var hardwareService=require(_0x1bd0('0x14'));var logger=require(_0x1bd0('0x15'))(_0x1bd0('0x16'));var utils=require(_0x1bd0('0x17'));var config=require(_0x1bd0('0x18'));var licenseUtil=require(_0x1bd0('0x19'));var db=require(_0x1bd0('0x1a'))['db'];function respondWithStatusCode(_0x271f4a,_0xd948c6){_0xd948c6=_0xd948c6||0xcc;return function(_0x7c25f4){if(_0x7c25f4){return _0x271f4a[_0x1bd0('0x1b')](_0xd948c6);}return _0x271f4a[_0x1bd0('0x1c')](_0xd948c6)['end']();};}function respondWithResult(_0x169975,_0x5d1009){_0x5d1009=_0x5d1009||0xc8;return function(_0x2ef34c){if(_0x2ef34c){return _0x169975[_0x1bd0('0x1c')](_0x5d1009)[_0x1bd0('0x1d')](_0x2ef34c);}};}function respondWithFilteredResult(_0x5f2c4d,_0x283dbc){return function(_0x438bf4){if(_0x438bf4){var _0x4cf6b3=typeof _0x283dbc[_0x1bd0('0x1e')]===_0x1bd0('0x1f')&&typeof _0x283dbc[_0x1bd0('0x20')]===_0x1bd0('0x1f');var _0x2dbab9=_0x438bf4[_0x1bd0('0x21')];var _0x42ec63=_0x4cf6b3?0x0:_0x283dbc[_0x1bd0('0x1e')];var _0x125684=_0x4cf6b3?_0x438bf4[_0x1bd0('0x21')]:_0x283dbc[_0x1bd0('0x1e')]+_0x283dbc[_0x1bd0('0x20')];var _0x3eabd9;if(_0x125684>=_0x2dbab9){_0x125684=_0x2dbab9;_0x3eabd9=0xc8;}else{_0x3eabd9=0xce;}_0x5f2c4d['status'](_0x3eabd9);return _0x5f2c4d['set'](_0x1bd0('0x22'),_0x42ec63+'-'+_0x125684+'/'+_0x2dbab9)[_0x1bd0('0x1d')](_0x438bf4);}return null;};}function patchUpdates(_0x267efb){return function(_0x152e4e){try{jsonpatch[_0x1bd0('0x23')](_0x152e4e,_0x267efb,!![]);}catch(_0x8b3a16){return BPromise[_0x1bd0('0x24')](_0x8b3a16);}return _0x152e4e['save']();};}function saveUpdates(_0x5b4985,_0x3d32fb){return function(_0x5b51b6){if(_0x5b51b6){return _0x5b51b6[_0x1bd0('0x25')](_0x5b4985)[_0x1bd0('0x26')](function(_0xbd8fb8){return _0xbd8fb8;});}return null;};}function removeEntity(_0x5e3970,_0x575524){return function(_0x3db1e2){if(_0x3db1e2){return _0x3db1e2[_0x1bd0('0x27')]()[_0x1bd0('0x26')](function(){_0x5e3970[_0x1bd0('0x1c')](0xcc)[_0x1bd0('0x28')]();});}};}function handleEntityNotFound(_0xc13e15,_0x2003be){return function(_0x2c87fc){if(!_0x2c87fc){_0xc13e15[_0x1bd0('0x1b')](0x194);}return _0x2c87fc;};}function handleError(_0x234b60,_0x31e40e){_0x31e40e=_0x31e40e||0x1f4;return function(_0x2635a1){logger['error'](_0x2635a1[_0x1bd0('0x29')]);if(_0x2635a1['name']){delete _0x2635a1[_0x1bd0('0x2a')];}_0x234b60[_0x1bd0('0x1c')](_0x31e40e)[_0x1bd0('0x2b')](_0x2635a1);};}exports[_0x1bd0('0x2c')]=function(_0x3b1fec,_0x73fded){var _0x3fe094={},_0xa0393d={},_0xcfeb8e={'count':0x0,'rows':[]};var _0x22566e=_[_0x1bd0('0x2d')](db[_0x1bd0('0x2e')]['rawAttributes'],function(_0x3c6f13){return{'name':_0x3c6f13[_0x1bd0('0x2f')],'type':_0x3c6f13[_0x1bd0('0x30')][_0x1bd0('0x31')]};});_0xa0393d[_0x1bd0('0x32')]=_[_0x1bd0('0x2d')](_0x22566e,_0x1bd0('0x2a'));_0xa0393d[_0x1bd0('0x33')]=_[_0x1bd0('0x34')](_0x3b1fec['query']);_0xa0393d[_0x1bd0('0x35')]=_[_0x1bd0('0x36')](_0xa0393d[_0x1bd0('0x32')],_0xa0393d['query']);_0x3fe094[_0x1bd0('0x37')]=_[_0x1bd0('0x36')](_0xa0393d[_0x1bd0('0x32')],qs[_0x1bd0('0x38')](_0x3b1fec[_0x1bd0('0x33')]['fields']));_0x3fe094['attributes']=_0x3fe094[_0x1bd0('0x37')][_0x1bd0('0x39')]?_0x3fe094[_0x1bd0('0x37')]:_0xa0393d[_0x1bd0('0x32')];if(!_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3a')](_0x1bd0('0x3b'))){_0x3fe094[_0x1bd0('0x20')]=qs[_0x1bd0('0x20')](_0x3b1fec[_0x1bd0('0x33')]['limit']);_0x3fe094[_0x1bd0('0x1e')]=qs[_0x1bd0('0x1e')](_0x3b1fec[_0x1bd0('0x33')]['offset']);}_0x3fe094[_0x1bd0('0x3c')]=qs['sort'](_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3d')]);_0x3fe094[_0x1bd0('0x3e')]=qs[_0x1bd0('0x35')](_['pick'](_0x3b1fec[_0x1bd0('0x33')],_0xa0393d[_0x1bd0('0x35')]),_0x22566e);if(_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x3f')]){_0x3fe094[_0x1bd0('0x3e')]=_[_0x1bd0('0x40')](_0x3fe094[_0x1bd0('0x3e')],{'$or':_[_0x1bd0('0x2d')](_0x22566e,function(_0x119ec3){if(_0x119ec3[_0x1bd0('0x30')]!==_0x1bd0('0x41')){var _0x2389a2={};_0x2389a2[_0x119ec3['name']]={'$like':'%'+_0x3b1fec['query']['filter']+'%'};return _0x2389a2;}})});}_0x3fe094=_['merge']({},_0x3fe094,_0x3b1fec[_0x1bd0('0x42')]);var _0x5165ce={'where':_0x3fe094[_0x1bd0('0x3e')]};return db[_0x1bd0('0x2e')][_0x1bd0('0x21')](_0x5165ce)[_0x1bd0('0x26')](function(_0x39b6f9){_0xcfeb8e[_0x1bd0('0x21')]=_0x39b6f9;if(_0x3b1fec[_0x1bd0('0x33')][_0x1bd0('0x43')]){_0x3fe094[_0x1bd0('0x44')]=[{'all':!![]}];}return db[_0x1bd0('0x2e')][_0x1bd0('0x45')](_0x3fe094);})[_0x1bd0('0x26')](function(_0xf6543d){_0xcfeb8e[_0x1bd0('0x46')]=_0xf6543d;return _0xcfeb8e;})['then'](respondWithFilteredResult(_0x73fded,_0x3fe094))['catch'](handleError(_0x73fded,null));};exports['show']=function(_0x5d928e,_0x52e0bc){var _0x42ff12={'raw':!![],'where':{'id':_0x5d928e[_0x1bd0('0x47')]['id']}},_0x5a1994={};_0x5a1994[_0x1bd0('0x32')]=_[_0x1bd0('0x34')](db[_0x1bd0('0x2e')][_0x1bd0('0x48')]);_0x5a1994['query']=_[_0x1bd0('0x34')](_0x5d928e[_0x1bd0('0x33')]);_0x5a1994[_0x1bd0('0x35')]=_[_0x1bd0('0x36')](_0x5a1994[_0x1bd0('0x32')],_0x5a1994[_0x1bd0('0x33')]);_0x42ff12[_0x1bd0('0x37')]=_[_0x1bd0('0x36')](_0x5a1994[_0x1bd0('0x32')],qs[_0x1bd0('0x38')](_0x5d928e[_0x1bd0('0x33')][_0x1bd0('0x38')]));_0x42ff12['attributes']=_0x42ff12['attributes'][_0x1bd0('0x39')]?_0x42ff12['attributes']:_0x5a1994[_0x1bd0('0x32')];if(_0x5d928e['query']['includeAll']){_0x42ff12[_0x1bd0('0x44')]=[{'all':!![]}];}_0x42ff12=_[_0x1bd0('0x40')]({},_0x42ff12,_0x5d928e['options']);return db[_0x1bd0('0x2e')][_0x1bd0('0x49')](_0x42ff12)[_0x1bd0('0x26')](handleEntityNotFound(_0x52e0bc,null))[_0x1bd0('0x26')](respondWithResult(_0x52e0bc,null))[_0x1bd0('0x4a')](handleError(_0x52e0bc,null));};exports['create']=function(_0x320b35,_0xc18e4){return db['MailTransferReport'][_0x1bd0('0x4b')](_0x320b35['body'],{})[_0x1bd0('0x26')](respondWithResult(_0xc18e4,0xc9))[_0x1bd0('0x4a')](handleError(_0xc18e4,null));};exports[_0x1bd0('0x25')]=function(_0x494186,_0x56859b){if(_0x494186[_0x1bd0('0x4c')]['id']){delete _0x494186[_0x1bd0('0x4c')]['id'];}return db[_0x1bd0('0x2e')][_0x1bd0('0x49')]({'where':{'id':_0x494186[_0x1bd0('0x47')]['id']}})[_0x1bd0('0x26')](handleEntityNotFound(_0x56859b,null))[_0x1bd0('0x26')](saveUpdates(_0x494186[_0x1bd0('0x4c')],null))[_0x1bd0('0x26')](respondWithResult(_0x56859b,null))['catch'](handleError(_0x56859b,null));};exports[_0x1bd0('0x27')]=function(_0x27d667,_0x5e835e){return db['MailTransferReport'][_0x1bd0('0x49')]({'where':{'id':_0x27d667[_0x1bd0('0x47')]['id']}})[_0x1bd0('0x26')](handleEntityNotFound(_0x5e835e,null))[_0x1bd0('0x26')](removeEntity(_0x5e835e,null))[_0x1bd0('0x4a')](handleError(_0x5e835e,null));};exports[_0x1bd0('0x4d')]=function(_0x25ed5b,_0x1e089f){return db[_0x1bd0('0x2e')][_0x1bd0('0x4d')]()[_0x1bd0('0x26')](respondWithResult(_0x1e089f,null))[_0x1bd0('0x4a')](handleError(_0x1e089f,null));}; \ No newline at end of file +var _0xbe93=['include','find','create','body','describe','eml-format','zip-dir','moment','mustache','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','key','query','keys','filters','intersection','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','catch','show','params','rawAttributes','attributes'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xbe93,0xdd));var _0x3be9=function(_0x64f56c,_0x1508db){_0x64f56c=_0x64f56c-0x0;var _0x4731b9=_0xbe93[_0x64f56c];return _0x4731b9;};'use strict';var emlformat=require(_0x3be9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3be9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3be9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3be9('0x3'));var util=require('util');var path=require(_0x3be9('0x4'));var sox=require('sox');var csv=require(_0x3be9('0x5'));var ejs=require(_0x3be9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3be9('0x7'));var crypto=require(_0x3be9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3be9('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3be9('0xa'));var Redis=require(_0x3be9('0xb'));var authService=require(_0x3be9('0xc'));var qs=require(_0x3be9('0xd'));var as=require(_0x3be9('0xe'));var hardwareService=require(_0x3be9('0xf'));var logger=require(_0x3be9('0x10'))('api');var utils=require(_0x3be9('0x11'));var config=require(_0x3be9('0x12'));var licenseUtil=require(_0x3be9('0x13'));var db=require(_0x3be9('0x14'))['db'];function respondWithStatusCode(_0xc5f9a9,_0x14005c){_0x14005c=_0x14005c||0xcc;return function(_0x57f9a8){if(_0x57f9a8){return _0xc5f9a9[_0x3be9('0x15')](_0x14005c);}return _0xc5f9a9[_0x3be9('0x16')](_0x14005c)[_0x3be9('0x17')]();};}function respondWithResult(_0xaf987c,_0x13f8a6){_0x13f8a6=_0x13f8a6||0xc8;return function(_0xecc5ab){if(_0xecc5ab){return _0xaf987c[_0x3be9('0x16')](_0x13f8a6)[_0x3be9('0x18')](_0xecc5ab);}};}function respondWithFilteredResult(_0x2ee6ca,_0xd931db){return function(_0x113f0d){if(_0x113f0d){var _0x4205d8=typeof _0xd931db[_0x3be9('0x19')]==='undefined'&&typeof _0xd931db[_0x3be9('0x1a')]===_0x3be9('0x1b');var _0x14b3de=_0x113f0d[_0x3be9('0x1c')];var _0x17d9b4=_0x4205d8?0x0:_0xd931db['offset'];var _0xe1e0d1=_0x4205d8?_0x113f0d[_0x3be9('0x1c')]:_0xd931db[_0x3be9('0x19')]+_0xd931db[_0x3be9('0x1a')];var _0x22dc65;if(_0xe1e0d1>=_0x14b3de){_0xe1e0d1=_0x14b3de;_0x22dc65=0xc8;}else{_0x22dc65=0xce;}_0x2ee6ca['status'](_0x22dc65);return _0x2ee6ca[_0x3be9('0x1d')](_0x3be9('0x1e'),_0x17d9b4+'-'+_0xe1e0d1+'/'+_0x14b3de)[_0x3be9('0x18')](_0x113f0d);}return null;};}function patchUpdates(_0x32eb46){return function(_0xfde82){try{jsonpatch[_0x3be9('0x1f')](_0xfde82,_0x32eb46,!![]);}catch(_0x563b69){return BPromise[_0x3be9('0x20')](_0x563b69);}return _0xfde82[_0x3be9('0x21')]();};}function saveUpdates(_0x5d072e,_0x23c421){return function(_0xcb0b18){if(_0xcb0b18){return _0xcb0b18[_0x3be9('0x22')](_0x5d072e)[_0x3be9('0x23')](function(_0x2d08f6){return _0x2d08f6;});}return null;};}function removeEntity(_0xb161ba,_0x152155){return function(_0x2ecfa2){if(_0x2ecfa2){return _0x2ecfa2[_0x3be9('0x24')]()[_0x3be9('0x23')](function(){_0xb161ba[_0x3be9('0x16')](0xcc)[_0x3be9('0x17')]();});}};}function handleEntityNotFound(_0x340b44,_0x81b9d4){return function(_0x5bb62a){if(!_0x5bb62a){_0x340b44['sendStatus'](0x194);}return _0x5bb62a;};}function handleError(_0x90b30c,_0x55bb97){_0x55bb97=_0x55bb97||0x1f4;return function(_0xfceb0c){logger[_0x3be9('0x25')](_0xfceb0c[_0x3be9('0x26')]);if(_0xfceb0c[_0x3be9('0x27')]){delete _0xfceb0c['name'];}_0x90b30c[_0x3be9('0x16')](_0x55bb97)[_0x3be9('0x28')](_0xfceb0c);};}exports[_0x3be9('0x29')]=function(_0x2b3e0e,_0x2d8ff8){var _0x51d12e={},_0x35c6b9={},_0x4aa676={'count':0x0,'rows':[]};var _0xd0cb62=_[_0x3be9('0x2a')](db[_0x3be9('0x2b')]['rawAttributes'],function(_0xace10){return{'name':_0xace10[_0x3be9('0x2c')],'type':_0xace10['type'][_0x3be9('0x2d')]};});_0x35c6b9['model']=_[_0x3be9('0x2a')](_0xd0cb62,_0x3be9('0x27'));_0x35c6b9[_0x3be9('0x2e')]=_[_0x3be9('0x2f')](_0x2b3e0e[_0x3be9('0x2e')]);_0x35c6b9[_0x3be9('0x30')]=_[_0x3be9('0x31')](_0x35c6b9['model'],_0x35c6b9[_0x3be9('0x2e')]);_0x51d12e['attributes']=_['intersection'](_0x35c6b9[_0x3be9('0x32')],qs[_0x3be9('0x33')](_0x2b3e0e[_0x3be9('0x2e')][_0x3be9('0x33')]));_0x51d12e['attributes']=_0x51d12e['attributes'][_0x3be9('0x34')]?_0x51d12e['attributes']:_0x35c6b9[_0x3be9('0x32')];if(!_0x2b3e0e[_0x3be9('0x2e')]['hasOwnProperty'](_0x3be9('0x35'))){_0x51d12e[_0x3be9('0x1a')]=qs[_0x3be9('0x1a')](_0x2b3e0e[_0x3be9('0x2e')]['limit']);_0x51d12e[_0x3be9('0x19')]=qs['offset'](_0x2b3e0e[_0x3be9('0x2e')][_0x3be9('0x19')]);}_0x51d12e[_0x3be9('0x36')]=qs[_0x3be9('0x37')](_0x2b3e0e[_0x3be9('0x2e')][_0x3be9('0x37')]);_0x51d12e[_0x3be9('0x38')]=qs[_0x3be9('0x30')](_[_0x3be9('0x39')](_0x2b3e0e[_0x3be9('0x2e')],_0x35c6b9[_0x3be9('0x30')]),_0xd0cb62);if(_0x2b3e0e[_0x3be9('0x2e')]['filter']){_0x51d12e[_0x3be9('0x38')]=_[_0x3be9('0x3a')](_0x51d12e['where'],{'$or':_[_0x3be9('0x2a')](_0xd0cb62,function(_0x1d8ecf){if(_0x1d8ecf['type']!==_0x3be9('0x3b')){var _0x2f9401={};_0x2f9401[_0x1d8ecf['name']]={'$like':'%'+_0x2b3e0e[_0x3be9('0x2e')][_0x3be9('0x3c')]+'%'};return _0x2f9401;}})});}_0x51d12e=_['merge']({},_0x51d12e,_0x2b3e0e['options']);var _0x52db68={'where':_0x51d12e['where']};return db[_0x3be9('0x2b')][_0x3be9('0x1c')](_0x52db68)[_0x3be9('0x23')](function(_0x5db735){_0x4aa676[_0x3be9('0x1c')]=_0x5db735;if(_0x2b3e0e[_0x3be9('0x2e')][_0x3be9('0x3d')]){_0x51d12e['include']=[{'all':!![]}];}return db[_0x3be9('0x2b')]['findAll'](_0x51d12e);})[_0x3be9('0x23')](function(_0x43d415){_0x4aa676['rows']=_0x43d415;return _0x4aa676;})[_0x3be9('0x23')](respondWithFilteredResult(_0x2d8ff8,_0x51d12e))[_0x3be9('0x3e')](handleError(_0x2d8ff8,null));};exports[_0x3be9('0x3f')]=function(_0x2b62be,_0x4776aa){var _0x5eb67f={'raw':!![],'where':{'id':_0x2b62be[_0x3be9('0x40')]['id']}},_0x9dde0a={};_0x9dde0a[_0x3be9('0x32')]=_[_0x3be9('0x2f')](db['MailTransferReport'][_0x3be9('0x41')]);_0x9dde0a['query']=_['keys'](_0x2b62be[_0x3be9('0x2e')]);_0x9dde0a[_0x3be9('0x30')]=_[_0x3be9('0x31')](_0x9dde0a[_0x3be9('0x32')],_0x9dde0a[_0x3be9('0x2e')]);_0x5eb67f['attributes']=_['intersection'](_0x9dde0a[_0x3be9('0x32')],qs[_0x3be9('0x33')](_0x2b62be[_0x3be9('0x2e')][_0x3be9('0x33')]));_0x5eb67f[_0x3be9('0x42')]=_0x5eb67f['attributes'][_0x3be9('0x34')]?_0x5eb67f[_0x3be9('0x42')]:_0x9dde0a['model'];if(_0x2b62be[_0x3be9('0x2e')][_0x3be9('0x3d')]){_0x5eb67f[_0x3be9('0x43')]=[{'all':!![]}];}_0x5eb67f=_[_0x3be9('0x3a')]({},_0x5eb67f,_0x2b62be['options']);return db[_0x3be9('0x2b')][_0x3be9('0x44')](_0x5eb67f)[_0x3be9('0x23')](handleEntityNotFound(_0x4776aa,null))[_0x3be9('0x23')](respondWithResult(_0x4776aa,null))[_0x3be9('0x3e')](handleError(_0x4776aa,null));};exports[_0x3be9('0x45')]=function(_0x30dbf6,_0x19986f){return db[_0x3be9('0x2b')][_0x3be9('0x45')](_0x30dbf6[_0x3be9('0x46')],{})['then'](respondWithResult(_0x19986f,0xc9))[_0x3be9('0x3e')](handleError(_0x19986f,null));};exports['update']=function(_0x26513e,_0x1d6593){if(_0x26513e[_0x3be9('0x46')]['id']){delete _0x26513e['body']['id'];}return db[_0x3be9('0x2b')][_0x3be9('0x44')]({'where':{'id':_0x26513e[_0x3be9('0x40')]['id']}})[_0x3be9('0x23')](handleEntityNotFound(_0x1d6593,null))[_0x3be9('0x23')](saveUpdates(_0x26513e[_0x3be9('0x46')],null))[_0x3be9('0x23')](respondWithResult(_0x1d6593,null))[_0x3be9('0x3e')](handleError(_0x1d6593,null));};exports['destroy']=function(_0x4369f0,_0x6a2fba){return db[_0x3be9('0x2b')][_0x3be9('0x44')]({'where':{'id':_0x4369f0[_0x3be9('0x40')]['id']}})[_0x3be9('0x23')](handleEntityNotFound(_0x6a2fba,null))['then'](removeEntity(_0x6a2fba,null))[_0x3be9('0x3e')](handleError(_0x6a2fba,null));};exports[_0x3be9('0x47')]=function(_0x555b33,_0x2bf10a){return db[_0x3be9('0x2b')][_0x3be9('0x47')]()[_0x3be9('0x23')](respondWithResult(_0x2bf10a,null))['catch'](handleError(_0x2bf10a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 425ea19..67512ca 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 _0x5c4d=['MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define'];(function(_0x1476fb,_0x467d01){var _0x44f57e=function(_0x4d7771){while(--_0x4d7771){_0x1476fb['push'](_0x1476fb['shift']());}};_0x44f57e(++_0x467d01);}(_0x5c4d,0x18f));var _0xd5c4=function(_0xcf6d0d,_0x490049){_0xcf6d0d=_0xcf6d0d-0x0;var _0x4bc54e=_0x5c4d[_0xcf6d0d];return _0x4bc54e;};'use strict';var _=require(_0xd5c4('0x0'));var util=require('util');var logger=require(_0xd5c4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd5c4('0x2'));var fs=require('fs');var path=require(_0xd5c4('0x3'));var rimraf=require(_0xd5c4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd5c4('0x5'));module[_0xd5c4('0x6')]=function(_0x204a6f,_0x422cd8){return _0x204a6f[_0xd5c4('0x7')](_0xd5c4('0x8'),attributes,{'tableName':_0xd5c4('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd5c4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb31a=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0xc5217d,_0x1c4ef0){var _0x4342e1=function(_0x3dda1a){while(--_0x3dda1a){_0xc5217d['push'](_0xc5217d['shift']());}};_0x4342e1(++_0x1c4ef0);}(_0xb31a,0xd4));var _0xab31=function(_0x3c0fa2,_0x566f27){_0x3c0fa2=_0x3c0fa2-0x0;var _0x55a99e=_0xb31a[_0x3c0fa2];return _0x55a99e;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var logger=require(_0xab31('0x2'))(_0xab31('0x3'));var moment=require(_0xab31('0x4'));var BPromise=require(_0xab31('0x5'));var rp=require(_0xab31('0x6'));var fs=require('fs');var path=require(_0xab31('0x7'));var rimraf=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var attributes=require(_0xab31('0xa'));module[_0xab31('0xb')]=function(_0x9c6740,_0x2c336b){return _0x9c6740[_0xab31('0xc')]('MailTransferReport',attributes,{'tableName':_0xab31('0xd'),'paranoid':![],'indexes':[{'name':_0xab31('0xe'),'fields':[_0xab31('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4b1f32a..d36abd4 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 _0xd106=['jayson/promise','client','http','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd106,0x167));var _0x6d10=function(_0x1c751a,_0x46b708){_0x1c751a=_0x1c751a-0x0;var _0x4f97e4=_0xd106[_0x1c751a];return _0x4f97e4;};'use strict';var _=require(_0x6d10('0x0'));var util=require(_0x6d10('0x1'));var moment=require('moment');var BPromise=require(_0x6d10('0x2'));var rs=require(_0x6d10('0x3'));var fs=require('fs');var Redis=require(_0x6d10('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d10('0x5'));var logger=require(_0x6d10('0x6'))(_0x6d10('0x7'));var config=require(_0x6d10('0x8'));var jayson=require(_0x6d10('0x9'));var client=jayson[_0x6d10('0xa')][_0x6d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b0d69,_0x4aeeef,_0x562a24){return new BPromise(function(_0x5d81ea,_0x46a22c){return client['request'](_0x4b0d69,_0x562a24)[_0x6d10('0xc')](function(_0x5486c0){logger[_0x6d10('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x4aeeef,'request\x20sent');logger[_0x6d10('0xe')](_0x6d10('0xf'),_0x4aeeef,_0x6d10('0x10'),JSON[_0x6d10('0x11')](_0x5486c0));if(_0x5486c0[_0x6d10('0x12')]){if(_0x5486c0[_0x6d10('0x12')][_0x6d10('0x13')]===0x1f4){logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x5486c0['error']['message']);return _0x46a22c(_0x5486c0['error'][_0x6d10('0x15')]);}logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x5486c0[_0x6d10('0x12')][_0x6d10('0x15')]);return _0x5d81ea(_0x5486c0[_0x6d10('0x12')][_0x6d10('0x15')]);}else{logger[_0x6d10('0xd')](_0x6d10('0x14'),_0x4aeeef,_0x6d10('0x10'));_0x5d81ea(_0x5486c0[_0x6d10('0x16')][_0x6d10('0x15')]);}})['catch'](function(_0x11c991){logger[_0x6d10('0x12')](_0x6d10('0x14'),_0x4aeeef,_0x11c991);_0x46a22c(_0x11c991);});});} \ No newline at end of file +var _0xe785=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring'];(function(_0x4f5bac,_0x400008){var _0x1d08a7=function(_0x1a288b){while(--_0x1a288b){_0x4f5bac['push'](_0x4f5bac['shift']());}};_0x1d08a7(++_0x400008);}(_0xe785,0x128));var _0x5e78=function(_0xd84ebc,_0x457ac9){_0xd84ebc=_0xd84ebc-0x0;var _0x5851bf=_0xe785[_0xd84ebc];return _0x5851bf;};'use strict';var _=require(_0x5e78('0x0'));var util=require(_0x5e78('0x1'));var moment=require('moment');var BPromise=require(_0x5e78('0x2'));var rs=require(_0x5e78('0x3'));var fs=require('fs');var Redis=require(_0x5e78('0x4'));var db=require(_0x5e78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e78('0x6'));var config=require(_0x5e78('0x7'));var jayson=require(_0x5e78('0x8'));var client=jayson[_0x5e78('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x525cfa,_0x1d32e7,_0x16cc23){return new BPromise(function(_0x441435,_0x5c7d82){return client[_0x5e78('0xa')](_0x525cfa,_0x16cc23)['then'](function(_0x5de5e){logger['info'](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));logger['debug'](_0x5e78('0xd'),_0x1d32e7,_0x5e78('0xc'),JSON[_0x5e78('0xe')](_0x5de5e));if(_0x5de5e[_0x5e78('0xf')]){if(_0x5de5e[_0x5e78('0xf')][_0x5e78('0x10')]===0x1f4){logger[_0x5e78('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x5c7d82(_0x5de5e[_0x5e78('0xf')]['message']);}logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x5de5e[_0x5e78('0xf')][_0x5e78('0x11')]);return _0x441435(_0x5de5e['error'][_0x5e78('0x11')]);}else{logger[_0x5e78('0x12')](_0x5e78('0xb'),_0x1d32e7,_0x5e78('0xc'));_0x441435(_0x5de5e[_0x5e78('0x13')][_0x5e78('0x11')]);}})['catch'](function(_0x575201){logger[_0x5e78('0xf')](_0x5e78('0xb'),_0x1d32e7,_0x575201);_0x5c7d82(_0x575201);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b796ed3..34841d5 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 _0x8fda=['describe','/:id','show','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x456890,_0x15ed18){var _0xe7865d=function(_0xb7eb2a){while(--_0xb7eb2a){_0x456890['push'](_0x456890['shift']());}};_0xe7865d(++_0x15ed18);}(_0x8fda,0x1d1));var _0xa8fd=function(_0x2bd319,_0xc2b28d){_0x2bd319=_0x2bd319-0x0;var _0x511871=_0x8fda[_0x2bd319];return _0x511871;};'use strict';var multer=require('multer');var util=require(_0xa8fd('0x0'));var path=require(_0xa8fd('0x1'));var timeout=require(_0xa8fd('0x2'));var express=require(_0xa8fd('0x3'));var router=express[_0xa8fd('0x4')]();var fs_extra=require(_0xa8fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa8fd('0x6'));var config=require(_0xa8fd('0x7'));var controller=require(_0xa8fd('0x8'));router[_0xa8fd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8fd('0x9')]('/describe',auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xb')]);router[_0xa8fd('0x9')](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xe')]);router['delete'](_0xa8fd('0xc'),auth[_0xa8fd('0xa')](),controller[_0xa8fd('0xf')]);module[_0xa8fd('0x10')]=router; \ No newline at end of file +var _0x9c88=['get','/describe','isAuthenticated','describe','/:id','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./memberReport.controller'];(function(_0x125c32,_0x34ee9b){var _0x2e87fb=function(_0x44335a){while(--_0x44335a){_0x125c32['push'](_0x125c32['shift']());}};_0x2e87fb(++_0x34ee9b);}(_0x9c88,0x1e8));var _0x89c8=function(_0x5f44c3,_0x460f76){_0x5f44c3=_0x5f44c3-0x0;var _0x577bf7=_0x9c88[_0x5f44c3];return _0x577bf7;};'use strict';var multer=require(_0x89c8('0x0'));var util=require(_0x89c8('0x1'));var path=require(_0x89c8('0x2'));var timeout=require(_0x89c8('0x3'));var express=require(_0x89c8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x89c8('0x5'));var interaction=require(_0x89c8('0x6'));var config=require('../../config/environment');var controller=require(_0x89c8('0x7'));router[_0x89c8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x89c8('0x9'),auth[_0x89c8('0xa')](),controller[_0x89c8('0xb')]);router[_0x89c8('0x8')](_0x89c8('0xc'),auth[_0x89c8('0xa')](),controller['show']);router['post']('/',auth[_0x89c8('0xa')](),controller[_0x89c8('0xd')]);router['put'](_0x89c8('0xc'),auth[_0x89c8('0xa')](),controller['update']);router[_0x89c8('0xe')](_0x89c8('0xc'),auth[_0x89c8('0xa')](),controller['destroy']);module[_0x89c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0b60a2b..8fc3275 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 _0x0c79=['DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c79,0x10a));var _0x90c7=function(_0x10a991,_0x4fc79c){_0x10a991=_0x10a991-0x0;var _0x4c0cbe=_0x0c79[_0x10a991];return _0x4c0cbe;};'use strict';var Sequelize=require(_0x90c7('0x0'));var moment=require(_0x90c7('0x1'));module[_0x90c7('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x90c7('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x90c7('0x4')},'duration':{'type':Sequelize[_0x90c7('0x5')]},'enterAt':{'type':Sequelize[_0x90c7('0x6')]},'exitAt':{'type':Sequelize[_0x90c7('0x6')],'set':function(_0x22fbf9){var _0x3e2f52=moment(_0x22fbf9);var _0x56bc9e=moment(this[_0x90c7('0x7')](_0x90c7('0x8')));var _0x201171=_0x3e2f52[_0x90c7('0x9')](_0x56bc9e,_0x90c7('0xa'));this[_0x90c7('0xb')](_0x90c7('0xc'),_0x22fbf9);this[_0x90c7('0xb')]('duration',_0x201171>=0x0?_0x201171:null);}},'data1':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xd')},'data2':{'type':Sequelize[_0x90c7('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xe')},'data4':{'type':Sequelize[_0x90c7('0x3')],'comment':_0x90c7('0xf')},'data5':{'type':Sequelize[_0x90c7('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x90c7('0x3')]},'internal':{'type':Sequelize[_0x90c7('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9400=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9400,0x1d5));var _0x0940=function(_0x2987d0,_0x2f5f10){_0x2987d0=_0x2987d0-0x0;var _0x590195=_0x9400[_0x2987d0];return _0x590195;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0940('0x0'));module[_0x0940('0x1')]={'channel':{'type':Sequelize[_0x0940('0x2')]},'membername':{'type':Sequelize[_0x0940('0x2')]},'interface':{'type':Sequelize[_0x0940('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x0940('0x3'),'comment':_0x0940('0x4')},'duration':{'type':Sequelize[_0x0940('0x5')]},'enterAt':{'type':Sequelize[_0x0940('0x6')]},'exitAt':{'type':Sequelize[_0x0940('0x6')],'set':function(_0x266a9b){var _0x38bd3f=moment(_0x266a9b);var _0x3daf86=moment(this[_0x0940('0x7')]('enterAt'));var _0x17f54c=_0x38bd3f[_0x0940('0x8')](_0x3daf86,_0x0940('0x9'));this[_0x0940('0xa')]('exitAt',_0x266a9b);this['setDataValue']('duration',_0x17f54c>=0x0?_0x17f54c:null);}},'data1':{'type':Sequelize[_0x0940('0x2')],'comment':_0x0940('0xb')},'data2':{'type':Sequelize[_0x0940('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x0940('0x2')],'comment':_0x0940('0xc')},'data4':{'type':Sequelize[_0x0940('0x2')],'comment':_0x0940('0xd')},'data5':{'type':Sequelize[_0x0940('0x2')],'comment':_0x0940('0xe')},'role':{'type':Sequelize[_0x0940('0x2')]},'internal':{'type':Sequelize[_0x0940('0x5')]},'uniqueid':{'type':Sequelize[_0x0940('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 2885897..ce424a2 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2cf37f,_0x2217b7){var _0x1bd369=function(_0x12d071){while(--_0x12d071){_0x2cf37f['push'](_0x2cf37f['shift']());}};_0x1bd369(++_0x2217b7);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x217f9c,_0x3410e9){var _0x436fac=function(_0x19bcc8){while(--_0x19bcc8){_0x217f9c['push'](_0x217f9c['shift']());}};_0x436fac(++_0x3410e9);}(_0x3e74,0x175));var _0x43e7=function(_0x1ab874,_0x48dc26){_0x1ab874=_0x1ab874-0x0;var _0x23a9b3=_0x3e74[_0x1ab874];return _0x23a9b3;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index da968d8..e15e1e7 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 _0xb30f=['request-promise','path','rimraf','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x2ae373,_0x1adf9a){var _0x2c2ce9=function(_0x320217){while(--_0x320217){_0x2ae373['push'](_0x2ae373['shift']());}};_0x2c2ce9(++_0x1adf9a);}(_0xb30f,0x109));var _0xfb30=function(_0x3ebc80,_0x2b219b){_0x3ebc80=_0x3ebc80-0x0;var _0x96963c=_0xb30f[_0x3ebc80];return _0x96963c;};'use strict';var _=require(_0xfb30('0x0'));var util=require(_0xfb30('0x1'));var logger=require(_0xfb30('0x2'))(_0xfb30('0x3'));var moment=require(_0xfb30('0x4'));var BPromise=require('bluebird');var rp=require(_0xfb30('0x5'));var fs=require('fs');var path=require(_0xfb30('0x6'));var rimraf=require(_0xfb30('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb30('0x8'));module[_0xfb30('0x9')]=function(_0x3aed60,_0x2ce236){return _0x3aed60[_0xfb30('0xa')]('MemberReport',attributes,{'tableName':_0xfb30('0xb'),'paranoid':![],'indexes':[{'name':_0xfb30('0xc'),'fields':[_0xfb30('0xd'),_0xfb30('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fb5=['MemberReport','report_member','membername','interface','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fb5,0x10c));var _0x56fb=function(_0x224eef,_0x4d0acd){_0x224eef=_0x224eef-0x0;var _0x56bfb6=_0x6fb5[_0x224eef];return _0x56bfb6;};'use strict';var _=require(_0x56fb('0x0'));var util=require('util');var logger=require(_0x56fb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x56fb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56fb('0x3'));var config=require(_0x56fb('0x4'));var attributes=require(_0x56fb('0x5'));module[_0x56fb('0x6')]=function(_0x130a3e,_0x23caef){return _0x130a3e[_0x56fb('0x7')](_0x56fb('0x8'),attributes,{'tableName':_0x56fb('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x56fb('0xa'),_0x56fb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 92c27c6..1c729af 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(_0x5f2ed3,_0x5ceda6){_0x5f2ed3=_0x5f2ed3-0x0;var _0x46437b=_0xd101[_0x5f2ed3];return _0x46437b;};'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 _0x2070=['attributes','limit','include','map','model','then','CreateMemberReport','create','body','update','UpdateMemberReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where'];(function(_0x1ab2f3,_0x7c984c){var _0x228740=function(_0x315fd4){while(--_0x315fd4){_0x1ab2f3['push'](_0x1ab2f3['shift']());}};_0x228740(++_0x7c984c);}(_0x2070,0x1a2));var _0x0207=function(_0x8965c8,_0x2f7d7d){_0x8965c8=_0x8965c8-0x0;var _0x4294ca=_0x2070[_0x8965c8];return _0x4294ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0207('0x0'));var BPromise=require(_0x0207('0x1'));var rs=require(_0x0207('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0207('0x3'))['db'];var utils=require(_0x0207('0x4'));var logger=require('../../config/logger')(_0x0207('0x5'));var config=require(_0x0207('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0207('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7607,_0x412b15,_0x198c8e){return new BPromise(function(_0x4b88d0,_0x471bd7){return client[_0x0207('0x8')](_0x5e7607,_0x198c8e)['then'](function(_0x29fd26){logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,_0x0207('0xb'));logger[_0x0207('0xc')](_0x0207('0xd'),_0x412b15,_0x0207('0xb'),JSON[_0x0207('0xe')](_0x29fd26));if(_0x29fd26[_0x0207('0xf')]){if(_0x29fd26[_0x0207('0xf')][_0x0207('0x10')]===0x1f4){logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')]['message']);return _0x471bd7(_0x29fd26[_0x0207('0xf')]['message']);}logger[_0x0207('0xf')](_0x0207('0xa'),_0x412b15,_0x29fd26[_0x0207('0xf')][_0x0207('0x11')]);return _0x4b88d0(_0x29fd26[_0x0207('0xf')]['message']);}else{logger[_0x0207('0x9')](_0x0207('0xa'),_0x412b15,'request\x20sent');_0x4b88d0(_0x29fd26[_0x0207('0x12')][_0x0207('0x11')]);}})[_0x0207('0x13')](function(_0x325eb1){logger['error'](_0x0207('0xa'),_0x412b15,_0x325eb1);_0x471bd7(_0x325eb1);});});}exports[_0x0207('0x14')]=function(_0x171122){var _0x91a3c2=this;return new Promise(function(_0x45bb5d,_0x179b79){return db[_0x0207('0x15')][_0x0207('0x16')]({'raw':_0x171122[_0x0207('0x17')]?_0x171122[_0x0207('0x17')][_0x0207('0x18')]===undefined?!![]:![]:!![],'where':_0x171122[_0x0207('0x17')]?_0x171122[_0x0207('0x17')][_0x0207('0x19')]||null:null,'attributes':_0x171122[_0x0207('0x17')]?_0x171122['options'][_0x0207('0x1a')]||null:null,'limit':_0x171122['options']?_0x171122[_0x0207('0x17')][_0x0207('0x1b')]||null:null,'include':_0x171122[_0x0207('0x17')]?_0x171122['options'][_0x0207('0x1c')]?_[_0x0207('0x1d')](_0x171122['options'][_0x0207('0x1c')],function(_0x11bb0f){return{'model':db[_0x11bb0f[_0x0207('0x1e')]],'as':_0x11bb0f['as'],'attributes':_0x11bb0f[_0x0207('0x1a')],'include':_0x11bb0f[_0x0207('0x1c')]?_['map'](_0x11bb0f[_0x0207('0x1c')],function(_0x4089f1){return{'model':db[_0x4089f1['model']],'as':_0x4089f1['as'],'attributes':_0x4089f1[_0x0207('0x1a')],'include':_0x4089f1['include']?_[_0x0207('0x1d')](_0x4089f1[_0x0207('0x1c')],function(_0x2e496f){return{'model':db[_0x2e496f['model']],'as':_0x2e496f['as'],'attributes':_0x2e496f[_0x0207('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0207('0x1f')](function(_0x1f6286){logger[_0x0207('0x9')](_0x0207('0x14'),_0x171122);logger['debug'](_0x0207('0x14'),_0x171122,JSON['stringify'](_0x1f6286));_0x45bb5d(_0x1f6286);})[_0x0207('0x13')](function(_0x873259){logger[_0x0207('0xf')]('GetMemberReport',_0x873259[_0x0207('0x11')],_0x171122);_0x179b79(_0x91a3c2['error'](0x1f4,_0x873259['message']));});});};exports[_0x0207('0x20')]=function(_0x43f2e6){var _0x3d0074=this;return new Promise(function(_0x3194ff,_0x445dce){return db['MemberReport'][_0x0207('0x21')](_0x43f2e6[_0x0207('0x22')],{'raw':_0x43f2e6[_0x0207('0x17')]?_0x43f2e6[_0x0207('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0207('0x1f')](function(_0x1ce120){logger[_0x0207('0x9')](_0x0207('0x20'),_0x43f2e6);logger[_0x0207('0xc')](_0x0207('0x20'),_0x43f2e6,JSON['stringify'](_0x1ce120));_0x3194ff(_0x1ce120);})['catch'](function(_0x55576d){logger['error'](_0x0207('0x20'),_0x55576d[_0x0207('0x11')],_0x43f2e6);_0x445dce(_0x3d0074[_0x0207('0xf')](0x1f4,_0x55576d[_0x0207('0x11')]));});});};exports['UpdateMemberReport']=function(_0x1ec05e){var _0x4f1e91=this;return new Promise(function(_0x558885,_0x226fc2){return db[_0x0207('0x15')][_0x0207('0x23')](_0x1ec05e[_0x0207('0x22')],{'raw':_0x1ec05e[_0x0207('0x17')]?_0x1ec05e[_0x0207('0x17')][_0x0207('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec05e['options']?_0x1ec05e[_0x0207('0x17')][_0x0207('0x19')]||null:null,'attributes':_0x1ec05e[_0x0207('0x17')]?_0x1ec05e[_0x0207('0x17')]['attributes']||null:null,'limit':_0x1ec05e['options']?_0x1ec05e['options'][_0x0207('0x1b')]||null:null})[_0x0207('0x1f')](function(_0x1f78fd){logger[_0x0207('0x9')]('UpdateMemberReport',_0x1ec05e);logger[_0x0207('0xc')](_0x0207('0x24'),_0x1ec05e,JSON[_0x0207('0xe')](_0x1f78fd));_0x558885(_0x1f78fd);})[_0x0207('0x13')](function(_0x49f8e6){logger['error'](_0x0207('0x24'),_0x49f8e6['message'],_0x1ec05e);_0x226fc2(_0x4f1e91['error'](0x1f4,_0x49f8e6[_0x0207('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4b1640d..e722599 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 _0x49fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer','util','path','Router'];(function(_0x284d8f,_0x1afc9e){var _0x6acf64=function(_0x1f62fa){while(--_0x1f62fa){_0x284d8f['push'](_0x284d8f['shift']());}};_0x6acf64(++_0x1afc9e);}(_0x49fe,0x100));var _0xe49f=function(_0x494419,_0x163d46){_0x494419=_0x494419-0x0;var _0x188f66=_0x49fe[_0x494419];return _0x188f66;};'use strict';var multer=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var path=require(_0xe49f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe49f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe49f('0x4'));var interaction=require(_0xe49f('0x5'));var config=require(_0xe49f('0x6'));var controller=require(_0xe49f('0x7'));router['get']('/',controller[_0xe49f('0x8')]);module[_0xe49f('0x9')]=router; \ No newline at end of file +var _0x958f=['Router','../../components/auth/service','../../components/interaction/service','./migration.controller','index','exports','util','path','connect-timeout','express'];(function(_0x38ead5,_0x5b4fa2){var _0x4e40bc=function(_0x315fdc){while(--_0x315fdc){_0x38ead5['push'](_0x38ead5['shift']());}};_0x4e40bc(++_0x5b4fa2);}(_0x958f,0x16e));var _0xf958=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x958f[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require(_0xf958('0x0'));var path=require(_0xf958('0x1'));var timeout=require(_0xf958('0x2'));var express=require(_0xf958('0x3'));var router=express[_0xf958('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf958('0x5'));var interaction=require(_0xf958('0x6'));var config=require('../../config/environment');var controller=require(_0xf958('0x7'));router['get']('/',controller[_0xf958('0x8')]);module[_0xf958('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 684903a..ebf83fd 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 _0xd33c=['version','STRING'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xd33c,0xc5));var _0xcd33=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xd33c[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xcd33('0x0')],'unique':_0xcd33('0x1')}}; \ No newline at end of file +var _0xdf3f=['STRING','version','sequelize','exports'];(function(_0x12446c,_0x133a16){var _0x59e7fd=function(_0x377f9e){while(--_0x377f9e){_0x12446c['push'](_0x12446c['shift']());}};_0x59e7fd(++_0x133a16);}(_0xdf3f,0x11a));var _0xfdf3=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0xdf3f[_0x172948];return _0x4aeaa9;};'use strict';var Sequelize=require(_0xfdf3('0x0'));module[_0xfdf3('0x1')]={'version':{'type':Sequelize[_0xfdf3('0x2')],'unique':_0xfdf3('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 7d15974..ef6345d 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 _0x8e6b=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x198635,_0x526ff0){var _0x5a9525=function(_0x284122){while(--_0x284122){_0x198635['push'](_0x198635['shift']());}};_0x5a9525(++_0x526ff0);}(_0x8e6b,0x112));var _0xb8e6=function(_0x56609c,_0x2417b0){_0x56609c=_0x56609c-0x0;var _0x5fed8=_0x8e6b[_0x56609c];return _0x5fed8;};'use strict';var emlformat=require(_0xb8e6('0x0'));var rimraf=require(_0xb8e6('0x1'));var zipdir=require(_0xb8e6('0x2'));var jsonpatch=require(_0xb8e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb8e6('0x4'));var Mustache=require('mustache');var util=require(_0xb8e6('0x5'));var path=require(_0xb8e6('0x6'));var sox=require(_0xb8e6('0x7'));var csv=require('to-csv');var ejs=require(_0xb8e6('0x8'));var fs=require('fs');var fs_extra=require(_0xb8e6('0x9'));var _=require(_0xb8e6('0xa'));var squel=require(_0xb8e6('0xb'));var crypto=require(_0xb8e6('0xc'));var jsforce=require(_0xb8e6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb8e6('0xe'));var authService=require(_0xb8e6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb8e6('0x10'));var hardwareService=require(_0xb8e6('0x11'));var logger=require(_0xb8e6('0x12'))(_0xb8e6('0x13'));var utils=require(_0xb8e6('0x14'));var config=require(_0xb8e6('0x15'));var licenseUtil=require(_0xb8e6('0x16'));var db=require(_0xb8e6('0x17'))['db'];function respondWithStatusCode(_0x467f30,_0x405722){_0x405722=_0x405722||0xcc;return function(_0x4cf89d){if(_0x4cf89d){return _0x467f30[_0xb8e6('0x18')](_0x405722);}return _0x467f30[_0xb8e6('0x19')](_0x405722)[_0xb8e6('0x1a')]();};}function respondWithResult(_0x300740,_0x9b8e0d){_0x9b8e0d=_0x9b8e0d||0xc8;return function(_0x15bec8){if(_0x15bec8){return _0x300740[_0xb8e6('0x19')](_0x9b8e0d)['json'](_0x15bec8);}};}function respondWithFilteredResult(_0xfec780,_0x2b6fc7){return function(_0x1a4f83){if(_0x1a4f83){var _0x1fb8bb=typeof _0x2b6fc7[_0xb8e6('0x1b')]===_0xb8e6('0x1c')&&typeof _0x2b6fc7[_0xb8e6('0x1d')]===_0xb8e6('0x1c');var _0x1a9b80=_0x1a4f83['count'];var _0x1bf270=_0x1fb8bb?0x0:_0x2b6fc7[_0xb8e6('0x1b')];var _0xd47c7a=_0x1fb8bb?_0x1a4f83[_0xb8e6('0x1e')]:_0x2b6fc7['offset']+_0x2b6fc7[_0xb8e6('0x1d')];var _0x3b5211;if(_0xd47c7a>=_0x1a9b80){_0xd47c7a=_0x1a9b80;_0x3b5211=0xc8;}else{_0x3b5211=0xce;}_0xfec780[_0xb8e6('0x19')](_0x3b5211);return _0xfec780[_0xb8e6('0x1f')]('Content-Range',_0x1bf270+'-'+_0xd47c7a+'/'+_0x1a9b80)[_0xb8e6('0x20')](_0x1a4f83);}return null;};}function patchUpdates(_0x80e433){return function(_0x466777){try{jsonpatch[_0xb8e6('0x21')](_0x466777,_0x80e433,!![]);}catch(_0x28a1a6){return BPromise[_0xb8e6('0x22')](_0x28a1a6);}return _0x466777[_0xb8e6('0x23')]();};}function saveUpdates(_0x54716a,_0x3366a9){return function(_0x1b854f){if(_0x1b854f){return _0x1b854f[_0xb8e6('0x24')](_0x54716a)[_0xb8e6('0x25')](function(_0x30a4cf){return _0x30a4cf;});}return null;};}function removeEntity(_0x1c8830,_0x625460){return function(_0x271edf){if(_0x271edf){return _0x271edf[_0xb8e6('0x26')]()['then'](function(){_0x1c8830[_0xb8e6('0x19')](0xcc)[_0xb8e6('0x1a')]();});}};}function handleEntityNotFound(_0x2b7314,_0x28304b){return function(_0x29bb88){if(!_0x29bb88){_0x2b7314[_0xb8e6('0x18')](0x194);}return _0x29bb88;};}function handleError(_0x339719,_0x134cd7){_0x134cd7=_0x134cd7||0x1f4;return function(_0x1c1697){logger[_0xb8e6('0x27')](_0x1c1697['stack']);if(_0x1c1697[_0xb8e6('0x28')]){delete _0x1c1697[_0xb8e6('0x28')];}_0x339719['status'](_0x134cd7)[_0xb8e6('0x29')](_0x1c1697);};}exports[_0xb8e6('0x2a')]=function(_0x3c6810,_0x23e20a){var _0x5f8c02={},_0x9aeb8e={},_0x1dc971={'count':0x0,'rows':[]};var _0x52276d=_[_0xb8e6('0x2b')](db[_0xb8e6('0x2c')][_0xb8e6('0x2d')],function(_0x3116b7){return{'name':_0x3116b7[_0xb8e6('0x2e')],'type':_0x3116b7[_0xb8e6('0x2f')][_0xb8e6('0x30')]};});_0x9aeb8e[_0xb8e6('0x31')]=_[_0xb8e6('0x2b')](_0x52276d,_0xb8e6('0x28'));_0x9aeb8e[_0xb8e6('0x32')]=_[_0xb8e6('0x33')](_0x3c6810['query']);_0x9aeb8e['filters']=_[_0xb8e6('0x34')](_0x9aeb8e['model'],_0x9aeb8e[_0xb8e6('0x32')]);_0x5f8c02[_0xb8e6('0x35')]=_['intersection'](_0x9aeb8e['model'],qs['fields'](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x36')]));_0x5f8c02[_0xb8e6('0x35')]=_0x5f8c02[_0xb8e6('0x35')][_0xb8e6('0x37')]?_0x5f8c02[_0xb8e6('0x35')]:_0x9aeb8e[_0xb8e6('0x31')];if(!_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x38')](_0xb8e6('0x39'))){_0x5f8c02['limit']=qs[_0xb8e6('0x1d')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x1d')]);_0x5f8c02['offset']=qs[_0xb8e6('0x1b')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x1b')]);}_0x5f8c02[_0xb8e6('0x3a')]=qs[_0xb8e6('0x3b')](_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x3b')]);_0x5f8c02[_0xb8e6('0x3c')]=qs[_0xb8e6('0x3d')](_[_0xb8e6('0x3e')](_0x3c6810[_0xb8e6('0x32')],_0x9aeb8e[_0xb8e6('0x3d')]),_0x52276d);if(_0x3c6810[_0xb8e6('0x32')]['filter']){_0x5f8c02[_0xb8e6('0x3c')]=_['merge'](_0x5f8c02[_0xb8e6('0x3c')],{'$or':_[_0xb8e6('0x2b')](_0x52276d,function(_0x16424b){if(_0x16424b[_0xb8e6('0x2f')]!==_0xb8e6('0x3f')){var _0x2a1915={};_0x2a1915[_0x16424b['name']]={'$like':'%'+_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x40')]+'%'};return _0x2a1915;}})});}_0x5f8c02=_[_0xb8e6('0x41')]({},_0x5f8c02,_0x3c6810[_0xb8e6('0x42')]);var _0xb930dd={'where':_0x5f8c02[_0xb8e6('0x3c')]};return db[_0xb8e6('0x2c')][_0xb8e6('0x1e')](_0xb930dd)[_0xb8e6('0x25')](function(_0x4dd696){_0x1dc971[_0xb8e6('0x1e')]=_0x4dd696;if(_0x3c6810[_0xb8e6('0x32')][_0xb8e6('0x43')]){_0x5f8c02[_0xb8e6('0x44')]=[{'all':!![]}];}return db[_0xb8e6('0x2c')][_0xb8e6('0x45')](_0x5f8c02);})['then'](function(_0x5e42b6){_0x1dc971[_0xb8e6('0x46')]=_0x5e42b6;return _0x1dc971;})['then'](respondWithFilteredResult(_0x23e20a,_0x5f8c02))[_0xb8e6('0x47')](handleError(_0x23e20a,null));}; \ No newline at end of file +var _0x1327=['order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x45d48a,_0x5cde28){var _0x59add4=function(_0x171824){while(--_0x171824){_0x45d48a['push'](_0x45d48a['shift']());}};_0x59add4(++_0x5cde28);}(_0x1327,0x17c));var _0x7132=function(_0x50ad01,_0x31cfed){_0x50ad01=_0x50ad01-0x0;var _0x31a9bd=_0x1327[_0x50ad01];return _0x31a9bd;};'use strict';var emlformat=require(_0x7132('0x0'));var rimraf=require(_0x7132('0x1'));var zipdir=require(_0x7132('0x2'));var jsonpatch=require(_0x7132('0x3'));var rp=require(_0x7132('0x4'));var moment=require('moment');var BPromise=require(_0x7132('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7132('0x6'));var sox=require(_0x7132('0x7'));var csv=require(_0x7132('0x8'));var ejs=require(_0x7132('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7132('0xa'));var crypto=require(_0x7132('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7132('0xc'));var Papa=require(_0x7132('0xd'));var Redis=require(_0x7132('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7132('0xf'));var as=require(_0x7132('0x10'));var hardwareService=require(_0x7132('0x11'));var logger=require(_0x7132('0x12'))(_0x7132('0x13'));var utils=require(_0x7132('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7132('0x15'));var db=require(_0x7132('0x16'))['db'];function respondWithStatusCode(_0x3276b6,_0x17ef4c){_0x17ef4c=_0x17ef4c||0xcc;return function(_0x1e2a1f){if(_0x1e2a1f){return _0x3276b6[_0x7132('0x17')](_0x17ef4c);}return _0x3276b6[_0x7132('0x18')](_0x17ef4c)['end']();};}function respondWithResult(_0x40c26f,_0x568ee8){_0x568ee8=_0x568ee8||0xc8;return function(_0x411956){if(_0x411956){return _0x40c26f[_0x7132('0x18')](_0x568ee8)[_0x7132('0x19')](_0x411956);}};}function respondWithFilteredResult(_0x204248,_0x56e694){return function(_0x19a9c3){if(_0x19a9c3){var _0x4f2107=typeof _0x56e694[_0x7132('0x1a')]===_0x7132('0x1b')&&typeof _0x56e694[_0x7132('0x1c')]==='undefined';var _0x2cd54b=_0x19a9c3[_0x7132('0x1d')];var _0x477b20=_0x4f2107?0x0:_0x56e694[_0x7132('0x1a')];var _0x3432a9=_0x4f2107?_0x19a9c3[_0x7132('0x1d')]:_0x56e694['offset']+_0x56e694['limit'];var _0x7ded2;if(_0x3432a9>=_0x2cd54b){_0x3432a9=_0x2cd54b;_0x7ded2=0xc8;}else{_0x7ded2=0xce;}_0x204248[_0x7132('0x18')](_0x7ded2);return _0x204248[_0x7132('0x1e')](_0x7132('0x1f'),_0x477b20+'-'+_0x3432a9+'/'+_0x2cd54b)['json'](_0x19a9c3);}return null;};}function patchUpdates(_0x370aed){return function(_0x309d42){try{jsonpatch[_0x7132('0x20')](_0x309d42,_0x370aed,!![]);}catch(_0x54a6d3){return BPromise[_0x7132('0x21')](_0x54a6d3);}return _0x309d42[_0x7132('0x22')]();};}function saveUpdates(_0x4ca18a,_0x21670a){return function(_0x509b7d){if(_0x509b7d){return _0x509b7d[_0x7132('0x23')](_0x4ca18a)[_0x7132('0x24')](function(_0x7828a4){return _0x7828a4;});}return null;};}function removeEntity(_0x54299a,_0x3cf5ac){return function(_0x5bdb22){if(_0x5bdb22){return _0x5bdb22[_0x7132('0x25')]()[_0x7132('0x24')](function(){_0x54299a[_0x7132('0x18')](0xcc)[_0x7132('0x26')]();});}};}function handleEntityNotFound(_0x163644,_0xe2637e){return function(_0x209318){if(!_0x209318){_0x163644[_0x7132('0x17')](0x194);}return _0x209318;};}function handleError(_0xa321cd,_0x1a2f52){_0x1a2f52=_0x1a2f52||0x1f4;return function(_0x447e80){logger[_0x7132('0x27')](_0x447e80[_0x7132('0x28')]);if(_0x447e80[_0x7132('0x29')]){delete _0x447e80[_0x7132('0x29')];}_0xa321cd[_0x7132('0x18')](_0x1a2f52)[_0x7132('0x2a')](_0x447e80);};}exports[_0x7132('0x2b')]=function(_0xdaa241,_0xaaf8f4){var _0x7fdbf9={},_0x5a1cc9={},_0x10536d={'count':0x0,'rows':[]};var _0x163cc9=_[_0x7132('0x2c')](db[_0x7132('0x2d')][_0x7132('0x2e')],function(_0x5e4c44){return{'name':_0x5e4c44[_0x7132('0x2f')],'type':_0x5e4c44['type'][_0x7132('0x30')]};});_0x5a1cc9[_0x7132('0x31')]=_[_0x7132('0x2c')](_0x163cc9,_0x7132('0x29'));_0x5a1cc9[_0x7132('0x32')]=_[_0x7132('0x33')](_0xdaa241[_0x7132('0x32')]);_0x5a1cc9['filters']=_['intersection'](_0x5a1cc9[_0x7132('0x31')],_0x5a1cc9['query']);_0x7fdbf9[_0x7132('0x34')]=_[_0x7132('0x35')](_0x5a1cc9[_0x7132('0x31')],qs[_0x7132('0x36')](_0xdaa241[_0x7132('0x32')]['fields']));_0x7fdbf9['attributes']=_0x7fdbf9[_0x7132('0x34')][_0x7132('0x37')]?_0x7fdbf9[_0x7132('0x34')]:_0x5a1cc9[_0x7132('0x31')];if(!_0xdaa241[_0x7132('0x32')][_0x7132('0x38')](_0x7132('0x39'))){_0x7fdbf9['limit']=qs[_0x7132('0x1c')](_0xdaa241['query'][_0x7132('0x1c')]);_0x7fdbf9[_0x7132('0x1a')]=qs[_0x7132('0x1a')](_0xdaa241[_0x7132('0x32')][_0x7132('0x1a')]);}_0x7fdbf9[_0x7132('0x3a')]=qs[_0x7132('0x3b')](_0xdaa241['query'][_0x7132('0x3b')]);_0x7fdbf9['where']=qs[_0x7132('0x3c')](_[_0x7132('0x3d')](_0xdaa241['query'],_0x5a1cc9['filters']),_0x163cc9);if(_0xdaa241['query'][_0x7132('0x3e')]){_0x7fdbf9['where']=_[_0x7132('0x3f')](_0x7fdbf9[_0x7132('0x40')],{'$or':_[_0x7132('0x2c')](_0x163cc9,function(_0x52e6a5){if(_0x52e6a5[_0x7132('0x41')]!==_0x7132('0x42')){var _0x5b16aa={};_0x5b16aa[_0x52e6a5[_0x7132('0x29')]]={'$like':'%'+_0xdaa241[_0x7132('0x32')][_0x7132('0x3e')]+'%'};return _0x5b16aa;}})});}_0x7fdbf9=_[_0x7132('0x3f')]({},_0x7fdbf9,_0xdaa241[_0x7132('0x43')]);var _0xd1434d={'where':_0x7fdbf9[_0x7132('0x40')]};return db[_0x7132('0x2d')][_0x7132('0x1d')](_0xd1434d)['then'](function(_0x307592){_0x10536d[_0x7132('0x1d')]=_0x307592;if(_0xdaa241[_0x7132('0x32')][_0x7132('0x44')]){_0x7fdbf9[_0x7132('0x45')]=[{'all':!![]}];}return db['Migration'][_0x7132('0x46')](_0x7fdbf9);})[_0x7132('0x24')](function(_0x5abc9f){_0x10536d[_0x7132('0x47')]=_0x5abc9f;return _0x10536d;})[_0x7132('0x24')](respondWithFilteredResult(_0xaaf8f4,_0x7fdbf9))[_0x7132('0x48')](handleError(_0xaaf8f4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 252d084..c16d5ad 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 _0x9b04=['migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','Migration'];(function(_0x83aeb2,_0x271f37){var _0x2063a8=function(_0x4a48f6){while(--_0x4a48f6){_0x83aeb2['push'](_0x83aeb2['shift']());}};_0x2063a8(++_0x271f37);}(_0x9b04,0x85));var _0x49b0=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x9b04[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x49b0('0x0'));var util=require('util');var logger=require(_0x49b0('0x1'))(_0x49b0('0x2'));var moment=require(_0x49b0('0x3'));var BPromise=require(_0x49b0('0x4'));var rp=require(_0x49b0('0x5'));var fs=require('fs');var path=require(_0x49b0('0x6'));var rimraf=require(_0x49b0('0x7'));var config=require(_0x49b0('0x8'));var attributes=require(_0x49b0('0x9'));module['exports']=function(_0x35724f,_0xe10d67){return _0x35724f['define'](_0x49b0('0xa'),attributes,{'tableName':_0x49b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26bc=['exports','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26bc,0x93));var _0xc26b=function(_0x5f6ef4,_0x3c4d4e){_0x5f6ef4=_0x5f6ef4-0x0;var _0x556d8a=_0x26bc[_0x5f6ef4];return _0x556d8a;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var logger=require(_0xc26b('0x2'))(_0xc26b('0x3'));var moment=require(_0xc26b('0x4'));var BPromise=require(_0xc26b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc26b('0x6'));var rimraf=require(_0xc26b('0x7'));var config=require(_0xc26b('0x8'));var attributes=require('./migration.attributes');module[_0xc26b('0x9')]=function(_0x3ab0ab,_0x540815){return _0x3ab0ab['define'](_0xc26b('0xa'),attributes,{'tableName':_0xc26b('0xb'),'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 f09d18c..d379dbf 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 _0x8efc=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8efc,0xb3));var _0xc8ef=function(_0x554047,_0x46ec41){_0x554047=_0x554047-0x0;var _0x5d11e4=_0x8efc[_0x554047];return _0x5d11e4;};'use strict';var _=require('lodash');var util=require(_0xc8ef('0x0'));var moment=require(_0xc8ef('0x1'));var BPromise=require(_0xc8ef('0x2'));var rs=require(_0xc8ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ef('0x4'))['db'];var utils=require(_0xc8ef('0x5'));var logger=require(_0xc8ef('0x6'))('rpc');var config=require(_0xc8ef('0x7'));var jayson=require(_0xc8ef('0x8'));var client=jayson[_0xc8ef('0x9')][_0xc8ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576ff9,_0x1fa519,_0x3d06cd){return new BPromise(function(_0x1c8931,_0x489778){return client[_0xc8ef('0xb')](_0x576ff9,_0x3d06cd)[_0xc8ef('0xc')](function(_0x1a9a5f){logger[_0xc8ef('0xd')]('Migration,\x20%s,\x20%s',_0x1fa519,_0xc8ef('0xe'));logger['debug'](_0xc8ef('0xf'),_0x1fa519,_0xc8ef('0xe'),JSON[_0xc8ef('0x10')](_0x1a9a5f));if(_0x1a9a5f[_0xc8ef('0x11')]){if(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x12')]===0x1f4){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x489778(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);return _0x1c8931(_0x1a9a5f[_0xc8ef('0x11')][_0xc8ef('0x14')]);}else{logger[_0xc8ef('0xd')](_0xc8ef('0x13'),_0x1fa519,_0xc8ef('0xe'));_0x1c8931(_0x1a9a5f[_0xc8ef('0x15')]['message']);}})[_0xc8ef('0x16')](function(_0x332e70){logger[_0xc8ef('0x11')](_0xc8ef('0x13'),_0x1fa519,_0x332e70);_0x489778(_0x332e70);});});} \ No newline at end of file +var _0xb458=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x471a96,_0x2a7f18){var _0xee25c=function(_0x152353){while(--_0x152353){_0x471a96['push'](_0x471a96['shift']());}};_0xee25c(++_0x2a7f18);}(_0xb458,0xca));var _0x8b45=function(_0x2e320e,_0x460f0d){_0x2e320e=_0x2e320e-0x0;var _0x4ecd9a=_0xb458[_0x2e320e];return _0x4ecd9a;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('Migration,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ea8d8a6..828e2ac 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 _0x58ea=['show','post','create','put','update','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated'];(function(_0x37009b,_0x4d845c){var _0x26a238=function(_0x36f546){while(--_0x36f546){_0x37009b['push'](_0x37009b['shift']());}};_0x26a238(++_0x4d845c);}(_0x58ea,0xe7));var _0xa58e=function(_0x29e9c3,_0x3700a6){_0x29e9c3=_0x29e9c3-0x0;var _0x247e9d=_0x58ea[_0x29e9c3];return _0x247e9d;};'use strict';var multer=require(_0xa58e('0x0'));var util=require('util');var path=require(_0xa58e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa58e('0x2')]();var fs_extra=require(_0xa58e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa58e('0x4'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0xa58e('0x5')]('/',auth['isAuthenticated'](),controller[_0xa58e('0x6')]);router[_0xa58e('0x5')](_0xa58e('0x7'),auth[_0xa58e('0x8')](),controller[_0xa58e('0x9')]);router[_0xa58e('0xa')]('/',auth[_0xa58e('0x8')](),controller[_0xa58e('0xb')]);router[_0xa58e('0xc')](_0xa58e('0x7'),auth[_0xa58e('0x8')](),controller[_0xa58e('0xd')]);router['delete']('/:id',auth[_0xa58e('0x8')](),controller[_0xa58e('0xe')]);module[_0xa58e('0xf')]=router; \ No newline at end of file +var _0x5fa9=['isAuthenticated','show','create','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service','./network.controller','index','/:id'];(function(_0x141eea,_0x30ee06){var _0xd630d5=function(_0x379dea){while(--_0x379dea){_0x141eea['push'](_0x141eea['shift']());}};_0xd630d5(++_0x30ee06);}(_0x5fa9,0x150));var _0x95fa=function(_0x2ace72,_0x814809){_0x2ace72=_0x2ace72-0x0;var _0x33d102=_0x5fa9[_0x2ace72];return _0x33d102;};'use strict';var multer=require(_0x95fa('0x0'));var util=require(_0x95fa('0x1'));var path=require(_0x95fa('0x2'));var timeout=require('connect-timeout');var express=require(_0x95fa('0x3'));var router=express[_0x95fa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x95fa('0x5'));var config=require('../../config/environment');var controller=require(_0x95fa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x95fa('0x7')]);router['get'](_0x95fa('0x8'),auth[_0x95fa('0x9')](),controller[_0x95fa('0xa')]);router['post']('/',auth[_0x95fa('0x9')](),controller[_0x95fa('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x95fa('0xc')]);router[_0x95fa('0xd')](_0x95fa('0x8'),auth[_0x95fa('0x9')](),controller[_0x95fa('0xe')]);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 ba377cd..1caf24d 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 _0xe0ea=['STRING','sequelize','ENUM','externip','stun','turn'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe0ea,0x1bd));var _0xae0e=function(_0x400788,_0x594e5f){_0x400788=_0x400788-0x0;var _0x21bf3e=_0xe0ea[_0x400788];return _0x21bf3e;};'use strict';var Sequelize=require(_0xae0e('0x0'));module['exports']={'type':{'type':Sequelize[_0xae0e('0x1')]('localnet',_0xae0e('0x2'),_0xae0e('0x3'),_0xae0e('0x4'))},'value':{'type':Sequelize[_0xae0e('0x5')]},'username':{'type':Sequelize[_0xae0e('0x5')]},'password':{'type':Sequelize[_0xae0e('0x5')]}}; \ No newline at end of file +var _0xd0e1=['externip','stun','STRING','sequelize','exports','localnet'];(function(_0x2cfae0,_0x89fb18){var _0x3e286f=function(_0xd7ac95){while(--_0xd7ac95){_0x2cfae0['push'](_0x2cfae0['shift']());}};_0x3e286f(++_0x89fb18);}(_0xd0e1,0x183));var _0x1d0e=function(_0x515150,_0x42d675){_0x515150=_0x515150-0x0;var _0x290308=_0xd0e1[_0x515150];return _0x290308;};'use strict';var Sequelize=require(_0x1d0e('0x0'));module[_0x1d0e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1d0e('0x2'),_0x1d0e('0x3'),_0x1d0e('0x4'),'turn')},'value':{'type':Sequelize[_0x1d0e('0x5')]},'username':{'type':Sequelize[_0x1d0e('0x5')]},'password':{'type':Sequelize[_0x1d0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b377bce..af7d47d 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 _0x12f9=['readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/network.ejs','format','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','limit','offset','set','Content-Range','update','destroy','end','sendStatus','stack','map','Network','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','params','length','options','find','create','body','toUpperCase','STUN'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x12f9,0x1bb));var _0x912f=function(_0x4febb9,_0x5109bb){_0x4febb9=_0x4febb9-0x0;var _0x4c4ccc=_0x12f9[_0x4febb9];return _0x4c4ccc;};'use strict';var util=require('util');var path=require(_0x912f('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x912f('0x1'));var logger=require(_0x912f('0x2'))(_0x912f('0x3'));var config=require(_0x912f('0x4'));var db=require(_0x912f('0x5'))['db'];var jayson=require(_0x912f('0x6'));var client=jayson[_0x912f('0x7')][_0x912f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa9d276,_0x354bb9,_0x4c9ff0,_0x24bbd2){return new Promise(function(_0x32b309,_0x4741e6){var _0x17dcb1=_0x24bbd2||client;return _0x17dcb1[_0x912f('0x9')](_0xa9d276,_0x4c9ff0)[_0x912f('0xa')](function(_0x99eace){logger[_0x912f('0xb')](_0x912f('0xc'),_0x354bb9,_0x912f('0xd'));logger[_0x912f('0xe')](_0x912f('0xf'),_0x354bb9,_0x912f('0xd'),JSON[_0x912f('0x10')](_0x99eace));if(_0x99eace[_0x912f('0x11')]){if(_0x99eace['error']['code']===0x1f4){logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x99eace['error'][_0x912f('0x12')]);return _0x4741e6(_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);}logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);return _0x32b309(_0x99eace[_0x912f('0x11')][_0x912f('0x12')]);}else{logger[_0x912f('0xb')](_0x912f('0xc'),_0x354bb9,_0x912f('0xd'));_0x32b309(_0x99eace[_0x912f('0x13')]['message']);}})[_0x912f('0x14')](function(_0x5b39e1){logger[_0x912f('0x11')](_0x912f('0xc'),_0x354bb9,_0x5b39e1);_0x4741e6(_0x5b39e1);});});}function respondWithResult(_0x4e873c,_0x1b8e40){_0x1b8e40=_0x1b8e40||0xc8;return function(_0x3c6c65){if(_0x3c6c65){return _0x4e873c[_0x912f('0x15')](_0x1b8e40)[_0x912f('0x16')](_0x3c6c65);}};}function respondWithFilteredResult(_0xf9409d,_0x12a6c6){return function(_0x5a6790){if(_0x5a6790){var _0xffb2fe=typeof _0x12a6c6['offset']===_0x912f('0x17')&&typeof _0x12a6c6[_0x912f('0x18')]===_0x912f('0x17');var _0x2b098f=_0x5a6790['count'];var _0x1a946f=_0xffb2fe?0x0:_0x12a6c6[_0x912f('0x19')];var _0x4534b1=_0xffb2fe?_0x5a6790['count']:_0x12a6c6[_0x912f('0x19')]+_0x12a6c6['limit'];var _0x27996d;if(_0x4534b1>=_0x2b098f){_0x4534b1=_0x2b098f;_0x27996d=0xc8;}else{_0x27996d=0xce;}_0xf9409d[_0x912f('0x15')](_0x27996d);return _0xf9409d[_0x912f('0x1a')](_0x912f('0x1b'),_0x1a946f+'-'+_0x4534b1+'/'+_0x2b098f)['json'](_0x5a6790);}return null;};}function saveUpdates(_0x1a82b5){return function(_0x4b2880){if(_0x4b2880){return _0x4b2880[_0x912f('0x1c')](_0x1a82b5)[_0x912f('0xa')](function(_0x39ca17){return _0x39ca17;});}return null;};}function removeEntity(_0x19707e){return function(_0x1de2ab){if(_0x1de2ab){return _0x1de2ab[_0x912f('0x1d')]()['then'](function(){_0x19707e[_0x912f('0x15')](0xcc)[_0x912f('0x1e')]();});}};}function handleEntityNotFound(_0x1ca2ab){return function(_0x170655){if(!_0x170655){_0x1ca2ab[_0x912f('0x1f')](0x194);}return _0x170655;};}function handleError(_0x2bc7e7,_0x1f42a6){_0x1f42a6=_0x1f42a6||0x1f4;return function(_0x28295a){logger[_0x912f('0x11')](_0x28295a[_0x912f('0x20')]);if(_0x28295a['name']){delete _0x28295a['name'];}_0x2bc7e7[_0x912f('0x15')](_0x1f42a6)['send'](_0x28295a);};}exports['index']=function(_0x711d5b,_0x13e1ba){var _0x315164={},_0x312ba1={},_0x22f5da={'count':0x0,'rows':[]};var _0x5a3b63=_[_0x912f('0x21')](db[_0x912f('0x22')][_0x912f('0x23')],function(_0x4c1952){return{'name':_0x4c1952['fieldName'],'type':_0x4c1952[_0x912f('0x24')][_0x912f('0x25')]};});_0x312ba1[_0x912f('0x26')]=_[_0x912f('0x21')](_0x5a3b63,_0x912f('0x27'));_0x312ba1[_0x912f('0x28')]=_[_0x912f('0x29')](_0x711d5b[_0x912f('0x28')]);_0x312ba1[_0x912f('0x2a')]=_[_0x912f('0x2b')](_0x312ba1[_0x912f('0x26')],_0x312ba1[_0x912f('0x28')]);_0x315164[_0x912f('0x2c')]=_['intersection'](_0x312ba1[_0x912f('0x26')],qs[_0x912f('0x2d')](_0x711d5b[_0x912f('0x28')][_0x912f('0x2d')]));_0x315164[_0x912f('0x2c')]=_0x315164[_0x912f('0x2c')]['length']?_0x315164['attributes']:_0x312ba1['model'];if(!_0x711d5b[_0x912f('0x28')][_0x912f('0x2e')](_0x912f('0x2f'))){_0x315164[_0x912f('0x18')]=qs[_0x912f('0x18')](_0x711d5b[_0x912f('0x28')][_0x912f('0x18')]);_0x315164[_0x912f('0x19')]=qs[_0x912f('0x19')](_0x711d5b[_0x912f('0x28')][_0x912f('0x19')]);}_0x315164[_0x912f('0x30')]=qs[_0x912f('0x31')](_0x711d5b[_0x912f('0x28')]['sort']);_0x315164[_0x912f('0x32')]=qs['filters'](_[_0x912f('0x33')](_0x711d5b['query'],_0x312ba1['filters']),_0x5a3b63);if(_0x711d5b['query']['filter']){_0x315164[_0x912f('0x32')]=_[_0x912f('0x34')](_0x315164[_0x912f('0x32')],{'$or':_[_0x912f('0x21')](_0x5a3b63,function(_0x3e57d9){if(_0x3e57d9['type']!==_0x912f('0x35')){var _0x4da613={};_0x4da613[_0x3e57d9['name']]={'$like':'%'+_0x711d5b[_0x912f('0x28')][_0x912f('0x36')]+'%'};return _0x4da613;}})});}_0x315164=_['merge']({},_0x315164,_0x711d5b['options']);var _0x1e216a={'where':_0x315164[_0x912f('0x32')]};return db[_0x912f('0x22')][_0x912f('0x37')](_0x1e216a)[_0x912f('0xa')](function(_0xcf1d16){_0x22f5da[_0x912f('0x37')]=_0xcf1d16;if(_0x711d5b[_0x912f('0x28')][_0x912f('0x38')]){_0x315164[_0x912f('0x39')]=[{'all':!![]}];}return db[_0x912f('0x22')][_0x912f('0x3a')](_0x315164);})[_0x912f('0xa')](function(_0x12e4e2){_0x22f5da['rows']=_0x12e4e2;return _0x22f5da;})['then'](respondWithFilteredResult(_0x13e1ba,_0x315164))[_0x912f('0x14')](handleError(_0x13e1ba,null));};exports['show']=function(_0x884cd7,_0x524264){var _0x175db6={'raw':!![],'where':{'id':_0x884cd7[_0x912f('0x3b')]['id']}},_0x503b30={};_0x503b30[_0x912f('0x26')]=_[_0x912f('0x29')](db[_0x912f('0x22')][_0x912f('0x23')]);_0x503b30[_0x912f('0x28')]=_[_0x912f('0x29')](_0x884cd7['query']);_0x503b30[_0x912f('0x2a')]=_['intersection'](_0x503b30['model'],_0x503b30[_0x912f('0x28')]);_0x175db6['attributes']=_[_0x912f('0x2b')](_0x503b30[_0x912f('0x26')],qs[_0x912f('0x2d')](_0x884cd7[_0x912f('0x28')]['fields']));_0x175db6[_0x912f('0x2c')]=_0x175db6['attributes'][_0x912f('0x3c')]?_0x175db6[_0x912f('0x2c')]:_0x503b30['model'];if(_0x884cd7[_0x912f('0x28')][_0x912f('0x38')]){_0x175db6[_0x912f('0x39')]=[{'all':!![]}];}_0x175db6=_[_0x912f('0x34')]({},_0x175db6,_0x884cd7[_0x912f('0x3d')]);return db['Network'][_0x912f('0x3e')](_0x175db6)[_0x912f('0xa')](handleEntityNotFound(_0x524264,null))[_0x912f('0xa')](respondWithResult(_0x524264,null))['catch'](handleError(_0x524264,null));};exports[_0x912f('0x3f')]=function(_0x96cf07,_0x1f8cb0){var _0x597b12;return db['Network'][_0x912f('0x3f')](_0x96cf07[_0x912f('0x40')],{'raw':!![]})[_0x912f('0xa')](function(_0x9a0a51){_0x597b12=_0x9a0a51;return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x96cf07[_0x912f('0x40')][_0x912f('0x24')]},'raw':!![]});})['then'](function(_0x115fbb){if(_0x597b12[_0x912f('0x24')][_0x912f('0x41')]()==_0x912f('0x42')){var _0x100ea4=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0x33b39d=ejs['render'](_0x100ea4,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0x33b39d);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x3f'),{'module':_0x912f('0x4b')});}else if(_0x597b12['type'][_0x912f('0x41')]()==_0x912f('0x4c')){var _0x5b6204=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x4d')),'utf8');var _0x621adf=ejs[_0x912f('0x4e')](_0x5b6204,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](_0x912f('0x4f'),_0x621adf);return respondWithRpcPromise(_0x912f('0x4a'),'create',{'module':_0x912f('0x4b')});}else{var _0x5d3593=fs[_0x912f('0x43')](path[_0x912f('0x44')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x55d162=ejs['render'](_0x5d3593,{'networks':_0x115fbb||[]});fs[_0x912f('0x48')](util['format'](_0x912f('0x50'),_0x96cf07['body'][_0x912f('0x24')][_0x912f('0x51')]()),_0x55d162);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x3f'),{'module':_0x912f('0x52')});}})[_0x912f('0xa')](function(){return _0x597b12;})[_0x912f('0xa')](respondWithResult(_0x1f8cb0,0xc9))[_0x912f('0x14')](handleError(_0x1f8cb0,null));};exports[_0x912f('0x1c')]=function(_0x3402f6,_0x2b9d62){var _0x108d4a;return db[_0x912f('0x22')][_0x912f('0x3e')]({'where':{'id':_0x3402f6[_0x912f('0x3b')]['id']}})[_0x912f('0xa')](handleEntityNotFound(_0x2b9d62,null))[_0x912f('0xa')](saveUpdates(_0x3402f6[_0x912f('0x40')],null))[_0x912f('0xa')](function(_0x2753a2){if(_0x2753a2){_0x108d4a=_0x2753a2;return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x108d4a[_0x912f('0x24')]},'raw':!![]});}return null;})[_0x912f('0xa')](function(_0x1f745a){if(_0x108d4a[_0x912f('0x24')]['toUpperCase']()==_0x912f('0x42')){var _0x5d9bbe=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0x2dc740=ejs[_0x912f('0x4e')](_0x5d9bbe,{'networks':_0x1f745a||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0x2dc740);return respondWithRpcPromise(_0x912f('0x4a'),'update',{'module':'res_stun_monitor.so'});}else if(_0x108d4a['type'][_0x912f('0x41')]()==_0x912f('0x4c')){var _0x32a37c=fs['readFileSync'](path[_0x912f('0x44')](config[_0x912f('0x45')],'server/files/templates/turn_multiple.ejs'),_0x912f('0x47'));var _0x5e823b=ejs[_0x912f('0x4e')](_0x32a37c,{'networks':_0x1f745a||[]});fs['writeFileSync'](_0x912f('0x4f'),_0x5e823b);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x2aaadb=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x53')),'utf8');var _0x45f0a9=ejs[_0x912f('0x4e')](_0x2aaadb,{'networks':_0x1f745a||[]});fs[_0x912f('0x48')](util[_0x912f('0x54')](_0x912f('0x50'),_0x3402f6[_0x912f('0x40')][_0x912f('0x24')][_0x912f('0x51')]()),_0x45f0a9);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1c'),{'module':_0x912f('0x52')});}})[_0x912f('0xa')](function(_0x283c44){if(_0x283c44){return _0x108d4a;}return null;})['then'](respondWithResult(_0x2b9d62,null))['catch'](handleError(_0x2b9d62,null));};exports['destroy']=function(_0x202fa0,_0x9190c4){var _0x3b89ad;return db[_0x912f('0x22')][_0x912f('0x3e')]({'where':{'id':_0x202fa0[_0x912f('0x3b')]['id']}})[_0x912f('0xa')](function(_0x47c80f){_0x3b89ad=_0x47c80f;return _0x47c80f;})['then'](handleEntityNotFound(_0x9190c4,null))[_0x912f('0xa')](removeEntity(_0x9190c4,null))['then'](function(){if(_0x3b89ad){return db[_0x912f('0x22')][_0x912f('0x3a')]({'where':{'type':_0x3b89ad[_0x912f('0x24')]},'raw':!![]});}})[_0x912f('0xa')](function(_0x2df152){if(_0x3b89ad[_0x912f('0x24')][_0x912f('0x41')]()==_0x912f('0x42')){var _0x5d7d36=fs[_0x912f('0x43')](path[_0x912f('0x44')](config[_0x912f('0x45')],_0x912f('0x46')),_0x912f('0x47'));var _0xf5e3d7=ejs[_0x912f('0x4e')](_0x5d7d36,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](_0x912f('0x49'),_0xf5e3d7);return respondWithRpcPromise(_0x912f('0x4a'),'destroy',{'module':_0x912f('0x4b')});}else if(_0x3b89ad[_0x912f('0x24')]['toUpperCase']()==_0x912f('0x4c')){var _0x9e70a6=fs[_0x912f('0x43')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x912f('0x47'));var _0x116291=ejs[_0x912f('0x4e')](_0x9e70a6,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](_0x912f('0x4f'),_0x116291);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1d'),{'module':_0x912f('0x4b')});}else{var _0xc4b32=fs[_0x912f('0x43')](path['join'](config[_0x912f('0x45')],'server/files/templates/network.ejs'),_0x912f('0x47'));var _0x3b4843=ejs[_0x912f('0x4e')](_0xc4b32,{'networks':_0x2df152||[]});fs[_0x912f('0x48')](util[_0x912f('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b89ad['type'][_0x912f('0x51')]()),_0x3b4843);return respondWithRpcPromise(_0x912f('0x4a'),_0x912f('0x1d'),{'module':_0x912f('0x52')});}})[_0x912f('0x14')](handleError(_0x9190c4,null));}; \ No newline at end of file +var _0x4e52=['util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','message','json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','Network','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','findAll','rows','show','params','keys','rawAttributes','find','catch','body','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','create','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','/etc/asterisk/stun_xcally.conf','toLowerCase','format'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4e52,0x1f2));var _0x24e5=function(_0x42c900,_0x398b7b){_0x42c900=_0x42c900-0x0;var _0x596cc8=_0x4e52[_0x42c900];return _0x596cc8;};'use strict';var util=require(_0x24e5('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x24e5('0x1'));var qs=require(_0x24e5('0x2'));var logger=require(_0x24e5('0x3'))(_0x24e5('0x4'));var config=require(_0x24e5('0x5'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x24e5('0x6')][_0x24e5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3641d6,_0x3e2cbc,_0x5c1864,_0x2df23c){return new Promise(function(_0x1cc683,_0x44c987){var _0x190c58=_0x2df23c||client;return _0x190c58[_0x24e5('0x8')](_0x3641d6,_0x5c1864)['then'](function(_0x447162){logger[_0x24e5('0x9')](_0x24e5('0xa'),_0x3e2cbc,_0x24e5('0xb'));logger[_0x24e5('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x3e2cbc,_0x24e5('0xb'),JSON['stringify'](_0x447162));if(_0x447162['error']){if(_0x447162[_0x24e5('0xd')]['code']===0x1f4){logger[_0x24e5('0xd')](_0x24e5('0xa'),_0x3e2cbc,_0x447162[_0x24e5('0xd')][_0x24e5('0xe')]);return _0x44c987(_0x447162[_0x24e5('0xd')]['message']);}logger[_0x24e5('0xd')](_0x24e5('0xa'),_0x3e2cbc,_0x447162[_0x24e5('0xd')][_0x24e5('0xe')]);return _0x1cc683(_0x447162[_0x24e5('0xd')][_0x24e5('0xe')]);}else{logger[_0x24e5('0x9')](_0x24e5('0xa'),_0x3e2cbc,_0x24e5('0xb'));_0x1cc683(_0x447162['result'][_0x24e5('0xe')]);}})['catch'](function(_0x323864){logger[_0x24e5('0xd')](_0x24e5('0xa'),_0x3e2cbc,_0x323864);_0x44c987(_0x323864);});});}function respondWithResult(_0xd55a53,_0xab2c2d){_0xab2c2d=_0xab2c2d||0xc8;return function(_0x2f012d){if(_0x2f012d){return _0xd55a53['status'](_0xab2c2d)[_0x24e5('0xf')](_0x2f012d);}};}function respondWithFilteredResult(_0x3ceeda,_0x8746a3){return function(_0x31fabe){if(_0x31fabe){var _0x3bd874=typeof _0x8746a3[_0x24e5('0x10')]===_0x24e5('0x11')&&typeof _0x8746a3['limit']===_0x24e5('0x11');var _0x97dd1e=_0x31fabe[_0x24e5('0x12')];var _0xc55fed=_0x3bd874?0x0:_0x8746a3['offset'];var _0x9d486f=_0x3bd874?_0x31fabe[_0x24e5('0x12')]:_0x8746a3['offset']+_0x8746a3[_0x24e5('0x13')];var _0x2a2dac;if(_0x9d486f>=_0x97dd1e){_0x9d486f=_0x97dd1e;_0x2a2dac=0xc8;}else{_0x2a2dac=0xce;}_0x3ceeda[_0x24e5('0x14')](_0x2a2dac);return _0x3ceeda[_0x24e5('0x15')](_0x24e5('0x16'),_0xc55fed+'-'+_0x9d486f+'/'+_0x97dd1e)[_0x24e5('0xf')](_0x31fabe);}return null;};}function saveUpdates(_0x394699){return function(_0x4bf0ce){if(_0x4bf0ce){return _0x4bf0ce[_0x24e5('0x17')](_0x394699)[_0x24e5('0x18')](function(_0x2cd5ce){return _0x2cd5ce;});}return null;};}function removeEntity(_0x28b326){return function(_0x2362f4){if(_0x2362f4){return _0x2362f4[_0x24e5('0x19')]()[_0x24e5('0x18')](function(){_0x28b326[_0x24e5('0x14')](0xcc)[_0x24e5('0x1a')]();});}};}function handleEntityNotFound(_0x212390){return function(_0x2b1f85){if(!_0x2b1f85){_0x212390[_0x24e5('0x1b')](0x194);}return _0x2b1f85;};}function handleError(_0x28c3cb,_0x4e7107){_0x4e7107=_0x4e7107||0x1f4;return function(_0x28df29){logger[_0x24e5('0xd')](_0x28df29[_0x24e5('0x1c')]);if(_0x28df29[_0x24e5('0x1d')]){delete _0x28df29['name'];}_0x28c3cb['status'](_0x4e7107)[_0x24e5('0x1e')](_0x28df29);};}exports[_0x24e5('0x1f')]=function(_0x3d7a20,_0x1d294a){var _0x5a0ac0={},_0x4cdca1={},_0xdfcb6c={'count':0x0,'rows':[]};var _0x5b897a=_['map'](db[_0x24e5('0x20')]['rawAttributes'],function(_0x522a96){return{'name':_0x522a96[_0x24e5('0x21')],'type':_0x522a96[_0x24e5('0x22')][_0x24e5('0x23')]};});_0x4cdca1[_0x24e5('0x24')]=_['map'](_0x5b897a,'name');_0x4cdca1['query']=_['keys'](_0x3d7a20[_0x24e5('0x25')]);_0x4cdca1[_0x24e5('0x26')]=_[_0x24e5('0x27')](_0x4cdca1[_0x24e5('0x24')],_0x4cdca1[_0x24e5('0x25')]);_0x5a0ac0['attributes']=_[_0x24e5('0x27')](_0x4cdca1[_0x24e5('0x24')],qs[_0x24e5('0x28')](_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x28')]));_0x5a0ac0[_0x24e5('0x29')]=_0x5a0ac0[_0x24e5('0x29')][_0x24e5('0x2a')]?_0x5a0ac0[_0x24e5('0x29')]:_0x4cdca1[_0x24e5('0x24')];if(!_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x2b')](_0x24e5('0x2c'))){_0x5a0ac0[_0x24e5('0x13')]=qs['limit'](_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x13')]);_0x5a0ac0[_0x24e5('0x10')]=qs[_0x24e5('0x10')](_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x10')]);}_0x5a0ac0[_0x24e5('0x2d')]=qs[_0x24e5('0x2e')](_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x2e')]);_0x5a0ac0[_0x24e5('0x2f')]=qs[_0x24e5('0x26')](_['pick'](_0x3d7a20[_0x24e5('0x25')],_0x4cdca1[_0x24e5('0x26')]),_0x5b897a);if(_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x30')]){_0x5a0ac0[_0x24e5('0x2f')]=_[_0x24e5('0x31')](_0x5a0ac0[_0x24e5('0x2f')],{'$or':_[_0x24e5('0x32')](_0x5b897a,function(_0x333846){if(_0x333846[_0x24e5('0x22')]!=='VIRTUAL'){var _0x5afca3={};_0x5afca3[_0x333846[_0x24e5('0x1d')]]={'$like':'%'+_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x30')]+'%'};return _0x5afca3;}})});}_0x5a0ac0=_[_0x24e5('0x31')]({},_0x5a0ac0,_0x3d7a20[_0x24e5('0x33')]);var _0x221f33={'where':_0x5a0ac0['where']};return db[_0x24e5('0x20')][_0x24e5('0x12')](_0x221f33)['then'](function(_0x272573){_0xdfcb6c[_0x24e5('0x12')]=_0x272573;if(_0x3d7a20[_0x24e5('0x25')][_0x24e5('0x34')]){_0x5a0ac0['include']=[{'all':!![]}];}return db[_0x24e5('0x20')][_0x24e5('0x35')](_0x5a0ac0);})['then'](function(_0x2b1fb7){_0xdfcb6c[_0x24e5('0x36')]=_0x2b1fb7;return _0xdfcb6c;})[_0x24e5('0x18')](respondWithFilteredResult(_0x1d294a,_0x5a0ac0))['catch'](handleError(_0x1d294a,null));};exports[_0x24e5('0x37')]=function(_0x2044c1,_0x2777b2){var _0x37135b={'raw':!![],'where':{'id':_0x2044c1[_0x24e5('0x38')]['id']}},_0x495ecd={};_0x495ecd[_0x24e5('0x24')]=_[_0x24e5('0x39')](db['Network'][_0x24e5('0x3a')]);_0x495ecd[_0x24e5('0x25')]=_['keys'](_0x2044c1['query']);_0x495ecd[_0x24e5('0x26')]=_[_0x24e5('0x27')](_0x495ecd[_0x24e5('0x24')],_0x495ecd[_0x24e5('0x25')]);_0x37135b[_0x24e5('0x29')]=_[_0x24e5('0x27')](_0x495ecd[_0x24e5('0x24')],qs[_0x24e5('0x28')](_0x2044c1['query'][_0x24e5('0x28')]));_0x37135b[_0x24e5('0x29')]=_0x37135b[_0x24e5('0x29')]['length']?_0x37135b[_0x24e5('0x29')]:_0x495ecd[_0x24e5('0x24')];if(_0x2044c1[_0x24e5('0x25')][_0x24e5('0x34')]){_0x37135b['include']=[{'all':!![]}];}_0x37135b=_[_0x24e5('0x31')]({},_0x37135b,_0x2044c1['options']);return db[_0x24e5('0x20')][_0x24e5('0x3b')](_0x37135b)[_0x24e5('0x18')](handleEntityNotFound(_0x2777b2,null))[_0x24e5('0x18')](respondWithResult(_0x2777b2,null))[_0x24e5('0x3c')](handleError(_0x2777b2,null));};exports['create']=function(_0x1ee4b6,_0x3c4c34){var _0x3ff15c;return db[_0x24e5('0x20')]['create'](_0x1ee4b6[_0x24e5('0x3d')],{'raw':!![]})['then'](function(_0x43669e){_0x3ff15c=_0x43669e;return db[_0x24e5('0x20')][_0x24e5('0x35')]({'where':{'type':_0x1ee4b6['body'][_0x24e5('0x22')]},'raw':!![]});})['then'](function(_0x3912d7){if(_0x3ff15c[_0x24e5('0x22')][_0x24e5('0x3e')]()=='STUN'){var _0x408ddf=fs['readFileSync'](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],_0x24e5('0x41')),_0x24e5('0x42'));var _0x95d67a=ejs[_0x24e5('0x43')](_0x408ddf,{'networks':_0x3912d7||[]});fs[_0x24e5('0x44')]('/etc/asterisk/stun_xcally.conf',_0x95d67a);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x46'),{'module':_0x24e5('0x47')});}else if(_0x3ff15c[_0x24e5('0x22')]['toUpperCase']()==_0x24e5('0x48')){var _0x2e164c=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],_0x24e5('0x4a')),'utf8');var _0x54029f=ejs[_0x24e5('0x43')](_0x2e164c,{'networks':_0x3912d7||[]});fs[_0x24e5('0x44')](_0x24e5('0x4b'),_0x54029f);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x46'),{'module':_0x24e5('0x47')});}else{var _0x58df86=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],_0x24e5('0x4c')),'utf8');var _0x238bcf=ejs[_0x24e5('0x43')](_0x58df86,{'networks':_0x3912d7||[]});fs[_0x24e5('0x44')](util['format'](_0x24e5('0x4d'),_0x1ee4b6['body'][_0x24e5('0x22')]['toLowerCase']()),_0x238bcf);return respondWithRpcPromise(_0x24e5('0x45'),'create',{'module':_0x24e5('0x4e')});}})[_0x24e5('0x18')](function(){return _0x3ff15c;})['then'](respondWithResult(_0x3c4c34,0xc9))[_0x24e5('0x3c')](handleError(_0x3c4c34,null));};exports[_0x24e5('0x17')]=function(_0x124cce,_0x42fc61){var _0x5eb85b;return db['Network'][_0x24e5('0x3b')]({'where':{'id':_0x124cce[_0x24e5('0x38')]['id']}})[_0x24e5('0x18')](handleEntityNotFound(_0x42fc61,null))[_0x24e5('0x18')](saveUpdates(_0x124cce['body'],null))[_0x24e5('0x18')](function(_0x26b449){if(_0x26b449){_0x5eb85b=_0x26b449;return db[_0x24e5('0x20')][_0x24e5('0x35')]({'where':{'type':_0x5eb85b['type']},'raw':!![]});}return null;})['then'](function(_0x1ba69d){if(_0x5eb85b[_0x24e5('0x22')]['toUpperCase']()==_0x24e5('0x4f')){var _0x295361=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config['root'],_0x24e5('0x41')),'utf8');var _0x31ef34=ejs['render'](_0x295361,{'networks':_0x1ba69d||[]});fs['writeFileSync'](_0x24e5('0x50'),_0x31ef34);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x17'),{'module':_0x24e5('0x47')});}else if(_0x5eb85b[_0x24e5('0x22')][_0x24e5('0x3e')]()==_0x24e5('0x48')){var _0x1356c1=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x24e5('0x42'));var _0x428800=ejs[_0x24e5('0x43')](_0x1356c1,{'networks':_0x1ba69d||[]});fs[_0x24e5('0x44')](_0x24e5('0x4b'),_0x428800);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x17'),{'module':_0x24e5('0x47')});}else{var _0x28398a=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],_0x24e5('0x4c')),'utf8');var _0x14d795=ejs[_0x24e5('0x43')](_0x28398a,{'networks':_0x1ba69d||[]});fs[_0x24e5('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x124cce['body']['type'][_0x24e5('0x51')]()),_0x14d795);return respondWithRpcPromise('Reload',_0x24e5('0x17'),{'module':_0x24e5('0x4e')});}})[_0x24e5('0x18')](function(_0x54c963){if(_0x54c963){return _0x5eb85b;}return null;})[_0x24e5('0x18')](respondWithResult(_0x42fc61,null))[_0x24e5('0x3c')](handleError(_0x42fc61,null));};exports[_0x24e5('0x19')]=function(_0x572f84,_0x190239){var _0x288069;return db[_0x24e5('0x20')]['find']({'where':{'id':_0x572f84['params']['id']}})[_0x24e5('0x18')](function(_0x2e1536){_0x288069=_0x2e1536;return _0x2e1536;})['then'](handleEntityNotFound(_0x190239,null))[_0x24e5('0x18')](removeEntity(_0x190239,null))[_0x24e5('0x18')](function(){if(_0x288069){return db[_0x24e5('0x20')][_0x24e5('0x35')]({'where':{'type':_0x288069[_0x24e5('0x22')]},'raw':!![]});}})['then'](function(_0x1be2b4){if(_0x288069[_0x24e5('0x22')]['toUpperCase']()==_0x24e5('0x4f')){var _0x445f65=fs[_0x24e5('0x49')](path['join'](config[_0x24e5('0x40')],_0x24e5('0x41')),_0x24e5('0x42'));var _0x1eeb09=ejs[_0x24e5('0x43')](_0x445f65,{'networks':_0x1be2b4||[]});fs[_0x24e5('0x44')](_0x24e5('0x50'),_0x1eeb09);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x19'),{'module':_0x24e5('0x47')});}else if(_0x288069[_0x24e5('0x22')][_0x24e5('0x3e')]()==_0x24e5('0x48')){var _0x356d25=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],'server/files/templates/turn_multiple.ejs'),_0x24e5('0x42'));var _0x4b89f9=ejs[_0x24e5('0x43')](_0x356d25,{'networks':_0x1be2b4||[]});fs['writeFileSync'](_0x24e5('0x4b'),_0x4b89f9);return respondWithRpcPromise('Reload',_0x24e5('0x19'),{'module':_0x24e5('0x47')});}else{var _0x459e4a=fs[_0x24e5('0x49')](path[_0x24e5('0x3f')](config[_0x24e5('0x40')],_0x24e5('0x4c')),_0x24e5('0x42'));var _0x1c2941=ejs['render'](_0x459e4a,{'networks':_0x1be2b4||[]});fs[_0x24e5('0x44')](util[_0x24e5('0x52')](_0x24e5('0x4d'),_0x288069[_0x24e5('0x22')][_0x24e5('0x51')]()),_0x1c2941);return respondWithRpcPromise(_0x24e5('0x45'),_0x24e5('0x19'),{'module':_0x24e5('0x4e')});}})['catch'](handleError(_0x190239,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 18359e0..d846e8d 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 _0x2547=['rimraf','./network.attributes','exports','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e6ab8,_0x4ea85c){var _0x16cba0=function(_0x4b3776){while(--_0x4b3776){_0x2e6ab8['push'](_0x2e6ab8['shift']());}};_0x16cba0(++_0x4ea85c);}(_0x2547,0x1cd));var _0x7254=function(_0x35741f,_0x47726f){_0x35741f=_0x35741f-0x0;var _0x166e01=_0x2547[_0x35741f];return _0x166e01;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e0d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','network'];(function(_0x26c112,_0x41e2fd){var _0x4933d8=function(_0x5d33ab){while(--_0x5d33ab){_0x26c112['push'](_0x26c112['shift']());}};_0x4933d8(++_0x41e2fd);}(_0x9e0d,0xf7));var _0xd9e0=function(_0xa9a0cc,_0x3e008f){_0xa9a0cc=_0xa9a0cc-0x0;var _0x544cec=_0x9e0d[_0xa9a0cc];return _0x544cec;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var logger=require(_0xd9e0('0x2'))(_0xd9e0('0x3'));var moment=require('moment');var BPromise=require(_0xd9e0('0x4'));var rp=require(_0xd9e0('0x5'));var fs=require('fs');var path=require(_0xd9e0('0x6'));var rimraf=require(_0xd9e0('0x7'));var config=require(_0xd9e0('0x8'));var attributes=require(_0xd9e0('0x9'));module['exports']=function(_0x570a07,_0x22e726){return _0x570a07[_0xd9e0('0xa')](_0xd9e0('0xb'),attributes,{'tableName':_0xd9e0('0xc'),'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 3be6cb6..1591ff9 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(_0x32f2c6,_0x300ad6){var _0x27484d=function(_0xd15d26){while(--_0xd15d26){_0x32f2c6['push'](_0x32f2c6['shift']());}};_0x27484d(++_0x300ad6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x171e79,_0x5adda9){_0x171e79=_0x171e79-0x0;var _0x10bbc8=_0x7a54[_0x171e79];return _0x10bbc8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 19e05d1..67ff27e 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 _0xd684=['delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/notify','notify','/:id/users','addAgents','send','update'];(function(_0x4ac81c,_0x22b4b3){var _0x325c77=function(_0x443164){while(--_0x443164){_0x4ac81c['push'](_0x4ac81c['shift']());}};_0x325c77(++_0x22b4b3);}(_0xd684,0x1f1));var _0x4d68=function(_0x4ccad7,_0x2daf62){_0x4ccad7=_0x4ccad7-0x0;var _0x3a1bc0=_0xd684[_0x4ccad7];return _0x3a1bc0;};'use strict';var multer=require('multer');var util=require(_0x4d68('0x0'));var path=require(_0x4d68('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d68('0x2'));var router=express['Router']();var fs_extra=require(_0x4d68('0x3'));var auth=require(_0x4d68('0x4'));var interaction=require(_0x4d68('0x5'));var config=require('../../config/environment');var controller=require(_0x4d68('0x6'));router[_0x4d68('0x7')]('/',auth['isAuthenticated'](),controller[_0x4d68('0x8')]);router['get'](_0x4d68('0x9'),auth[_0x4d68('0xa')](),controller['describe']);router['get']('/:id',auth[_0x4d68('0xa')](),controller[_0x4d68('0xb')]);router[_0x4d68('0x7')](_0x4d68('0xc'),auth[_0x4d68('0xa')](),controller[_0x4d68('0xd')]);router[_0x4d68('0x7')](_0x4d68('0xe'),auth['isAuthenticated'](),controller[_0x4d68('0xf')]);router[_0x4d68('0x7')](_0x4d68('0x10'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x11')]);router[_0x4d68('0x7')](_0x4d68('0x12'),auth['isAuthenticated'](),controller[_0x4d68('0x13')]);router[_0x4d68('0x7')]('/:id/users',auth[_0x4d68('0xa')](),controller[_0x4d68('0x14')]);router['post']('/',auth[_0x4d68('0xa')](),controller['create']);router[_0x4d68('0x15')]('/:id/dispositions',auth[_0x4d68('0xa')](),controller['addDisposition']);router[_0x4d68('0x15')](_0x4d68('0xe'),auth[_0x4d68('0xa')](),controller['addAnswer']);router[_0x4d68('0x15')](_0x4d68('0x16'),controller[_0x4d68('0x17')]);router[_0x4d68('0x15')]('/:id/applications',auth[_0x4d68('0xa')](),controller['addApplications']);router[_0x4d68('0x15')](_0x4d68('0x18'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x19')]);router['post']('/:id/send',auth[_0x4d68('0xa')](),controller[_0x4d68('0x1a')]);router['put']('/:id',auth[_0x4d68('0xa')](),controller[_0x4d68('0x1b')]);router[_0x4d68('0x1c')](_0x4d68('0x1d'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x1e')]);router['delete'](_0x4d68('0xc'),auth['isAuthenticated'](),controller[_0x4d68('0x1f')]);router['delete'](_0x4d68('0xe'),auth[_0x4d68('0xa')](),controller[_0x4d68('0x20')]);router[_0x4d68('0x1c')](_0x4d68('0x18'),auth['isAuthenticated'](),controller[_0x4d68('0x21')]);module[_0x4d68('0x22')]=router; \ No newline at end of file +var _0x20aa=['update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','notify','addApplications','/:id/send','put','/:id'];(function(_0x5cd242,_0xc4edc5){var _0x24d103=function(_0x3a9470){while(--_0x3a9470){_0x5cd242['push'](_0x5cd242['shift']());}};_0x24d103(++_0xc4edc5);}(_0x20aa,0x1a1));var _0xa20a=function(_0xbd61db,_0x3adc74){_0xbd61db=_0xbd61db-0x0;var _0x15af2a=_0x20aa[_0xbd61db];return _0x15af2a;};'use strict';var multer=require(_0xa20a('0x0'));var util=require(_0xa20a('0x1'));var path=require(_0xa20a('0x2'));var timeout=require(_0xa20a('0x3'));var express=require(_0xa20a('0x4'));var router=express[_0xa20a('0x5')]();var fs_extra=require(_0xa20a('0x6'));var auth=require(_0xa20a('0x7'));var interaction=require(_0xa20a('0x8'));var config=require(_0xa20a('0x9'));var controller=require(_0xa20a('0xa'));router[_0xa20a('0xb')]('/',auth[_0xa20a('0xc')](),controller[_0xa20a('0xd')]);router[_0xa20a('0xb')](_0xa20a('0xe'),auth[_0xa20a('0xc')](),controller[_0xa20a('0xf')]);router[_0xa20a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa20a('0x10')]);router[_0xa20a('0xb')](_0xa20a('0x11'),auth['isAuthenticated'](),controller[_0xa20a('0x12')]);router['get'](_0xa20a('0x13'),auth[_0xa20a('0xc')](),controller['getAnswers']);router[_0xa20a('0xb')](_0xa20a('0x14'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x15')]);router[_0xa20a('0xb')](_0xa20a('0x16'),auth['isAuthenticated'](),controller[_0xa20a('0x17')]);router[_0xa20a('0xb')](_0xa20a('0x18'),auth[_0xa20a('0xc')](),controller['getAgents']);router[_0xa20a('0x19')]('/',auth[_0xa20a('0xc')](),controller[_0xa20a('0x1a')]);router['post'](_0xa20a('0x11'),auth['isAuthenticated'](),controller[_0xa20a('0x1b')]);router[_0xa20a('0x19')](_0xa20a('0x13'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x1c')]);router[_0xa20a('0x19')]('/:id/notify',controller[_0xa20a('0x1d')]);router['post'](_0xa20a('0x14'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x1e')]);router[_0xa20a('0x19')](_0xa20a('0x18'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa20a('0x19')](_0xa20a('0x1f'),auth[_0xa20a('0xc')](),controller['send']);router[_0xa20a('0x20')](_0xa20a('0x21'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x22')]);router[_0xa20a('0x23')](_0xa20a('0x21'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x24')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa20a('0x25')]);router['delete'](_0xa20a('0x13'),auth[_0xa20a('0xc')](),controller[_0xa20a('0x26')]);router[_0xa20a('0x23')]('/:id/users',auth[_0xa20a('0xc')](),controller[_0xa20a('0x27')]);module[_0xa20a('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d0af8c9..8f999d9 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 _0xb50b=['mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x357e37,_0x231149){var _0x1b36c1=function(_0x2553f5){while(--_0x2553f5){_0x357e37['push'](_0x357e37['shift']());}};_0x1b36c1(++_0x231149);}(_0xb50b,0x83));var _0xbb50=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0xb50b[_0x328534];return _0x2796c0;};'use strict';var Sequelize=require(_0xbb50('0x0'));var rs=require(_0xbb50('0x1'));module['exports']={'name':{'type':Sequelize[_0xbb50('0x2')],'unique':_0xbb50('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xbb50('0x2')]},'token':{'type':Sequelize[_0xbb50('0x2')],'defaultValue':function(){return rs[_0xbb50('0x4')]();}},'replyUri':{'type':Sequelize[_0xbb50('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb50('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb50('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb50('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbb50('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbb50('0x6')],'defaultValue':![],'comment':_0xbb50('0x9'),'set':function(_0x1a60c1){if(!_0x1a60c1)this[_0xbb50('0xa')](_0xbb50('0xb'),null);this[_0xbb50('0xa')](_0xbb50('0xc'),_0x1a60c1);}}}; \ No newline at end of file +var _0x6d52=['STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x6d52,0xc9));var _0x26d5=function(_0x57a995,_0x568eb7){_0x57a995=_0x57a995-0x0;var _0x2b3e26=_0x6d52[_0x57a995];return _0x2b3e26;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x26d5('0x0'));module[_0x26d5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x26d5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x26d5('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x26d5('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x26d5('0x3')],'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['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26d5('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x26d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x26d5('0x3')]},'queueTransfer':{'type':Sequelize[_0x26d5('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x26d5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x26d5('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x26d5('0x5')],'defaultValue':![],'comment':_0x26d5('0x8'),'set':function(_0x34feda){if(!_0x34feda)this[_0x26d5('0x9')](_0x26d5('0xa'),null);this['setDataValue'](_0x26d5('0xb'),_0x34feda);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 530e737..f305a80 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 _0xd2ea=['redis','socket.io-emitter','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','OpenchannelAccounts','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','params','OpenchannelAccountId','getDispositions','findOne','Disposition','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3264fa,_0x259a95){var _0x32e57f=function(_0x8dd3d8){while(--_0x8dd3d8){_0x3264fa['push'](_0x3264fa['shift']());}};_0x32e57f(++_0x259a95);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2b6f64,_0xfdce45){_0x2b6f64=_0x2b6f64-0x0;var _0x5ece01=_0xd2ea[_0x2b6f64];return _0x5ece01;};'use strict';var emlformat=require(_0xad2e('0x0'));var rimraf=require(_0xad2e('0x1'));var zipdir=require(_0xad2e('0x2'));var jsonpatch=require(_0xad2e('0x3'));var rp=require(_0xad2e('0x4'));var moment=require('moment');var BPromise=require(_0xad2e('0x5'));var Mustache=require(_0xad2e('0x6'));var util=require(_0xad2e('0x7'));var path=require(_0xad2e('0x8'));var sox=require(_0xad2e('0x9'));var csv=require(_0xad2e('0xa'));var ejs=require(_0xad2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad2e('0xc'));var squel=require(_0xad2e('0xd'));var crypto=require(_0xad2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad2e('0xf'));var toCsv=require(_0xad2e('0xa'));var querystring=require('querystring');var Papa=require(_0xad2e('0x10'));var Redis=require('ioredis');var authService=require(_0xad2e('0x11'));var qs=require(_0xad2e('0x12'));var as=require(_0xad2e('0x13'));var hardwareService=require(_0xad2e('0x14'));var logger=require('../../config/logger')(_0xad2e('0x15'));var utils=require('../../config/utils');var config=require(_0xad2e('0x16'));var licenseUtil=require(_0xad2e('0x17'));var db=require(_0xad2e('0x18'))['db'];config[_0xad2e('0x19')]=_['defaults'](config[_0xad2e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0x1a'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xad2e('0x1b')][_0xad2e('0x1c')]({'port':0x232c});var client9002=jayson[_0xad2e('0x1b')][_0xad2e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17e6ac,_0x4180aa,_0x2546e2,_0x5941c5){return new BPromise(function(_0xd40b31,_0xbc6df0){var _0x2af208=_0x5941c5||client;return _0x2af208[_0xad2e('0x1d')](_0x17e6ac,_0x2546e2)[_0xad2e('0x1e')](function(_0x1b4889){logger[_0xad2e('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x4180aa,_0xad2e('0x20'));logger[_0xad2e('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4180aa,'request\x20sent',JSON['stringify'](_0x1b4889));if(_0x1b4889['error']){if(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x23')]===0x1f4){logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);return _0xbc6df0(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);}logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);return _0xd40b31(_0x1b4889[_0xad2e('0x22')][_0xad2e('0x25')]);}else{logger[_0xad2e('0x1f')](_0xad2e('0x24'),_0x4180aa,'request\x20sent');_0xd40b31(_0x1b4889[_0xad2e('0x26')][_0xad2e('0x25')]);}})[_0xad2e('0x27')](function(_0x350c66){logger[_0xad2e('0x22')](_0xad2e('0x24'),_0x4180aa,_0x350c66);_0xbc6df0(_0x350c66);});});}function respondWithStatusCode(_0x1161d5,_0x175055){_0x175055=_0x175055||0xcc;return function(_0xfd90a4){if(_0xfd90a4){return _0x1161d5['sendStatus'](_0x175055);}return _0x1161d5[_0xad2e('0x28')](_0x175055)['end']();};}function respondWithResult(_0x2b2bc2,_0x28ef72){_0x28ef72=_0x28ef72||0xc8;return function(_0x22bc9b){if(_0x22bc9b){return _0x2b2bc2[_0xad2e('0x28')](_0x28ef72)[_0xad2e('0x29')](_0x22bc9b);}};}function respondWithFilteredResult(_0x1676e5,_0xb3171a){return function(_0x454c04){if(_0x454c04){var _0x52fdda=typeof _0xb3171a[_0xad2e('0x2a')]==='undefined'&&typeof _0xb3171a[_0xad2e('0x2b')]===_0xad2e('0x2c');var _0x2a0dc7=_0x454c04[_0xad2e('0x2d')];var _0x42fe6c=_0x52fdda?0x0:_0xb3171a[_0xad2e('0x2a')];var _0x409f58=_0x52fdda?_0x454c04[_0xad2e('0x2d')]:_0xb3171a[_0xad2e('0x2a')]+_0xb3171a[_0xad2e('0x2b')];var _0xcc4c66;if(_0x409f58>=_0x2a0dc7){_0x409f58=_0x2a0dc7;_0xcc4c66=0xc8;}else{_0xcc4c66=0xce;}_0x1676e5['status'](_0xcc4c66);return _0x1676e5[_0xad2e('0x2e')]('Content-Range',_0x42fe6c+'-'+_0x409f58+'/'+_0x2a0dc7)[_0xad2e('0x29')](_0x454c04);}return null;};}function patchUpdates(_0x3a6419){return function(_0x5ac436){try{jsonpatch[_0xad2e('0x2f')](_0x5ac436,_0x3a6419,!![]);}catch(_0x26b4c5){return BPromise['reject'](_0x26b4c5);}return _0x5ac436[_0xad2e('0x30')]();};}function saveUpdates(_0x27fdf0,_0x54b4d3){return function(_0x2d6b35){if(_0x2d6b35){return _0x2d6b35[_0xad2e('0x31')](_0x27fdf0)['then'](function(_0x38e7e2){return _0x38e7e2;});}return null;};}function removeEntity(_0x19fd12,_0x3efac5){return function(_0x3de92c){if(_0x3de92c){return _0x3de92c[_0xad2e('0x32')]()[_0xad2e('0x1e')](function(){var _0x2c480c=_0x3de92c['get']({'plain':!![]});var _0x41a022=_0xad2e('0x33');return db['UserProfileResource'][_0xad2e('0x32')]({'where':{'type':_0x41a022,'resourceId':_0x2c480c['id']}})[_0xad2e('0x1e')](function(){return _0x3de92c;});})[_0xad2e('0x1e')](function(){_0x19fd12[_0xad2e('0x28')](0xcc)[_0xad2e('0x34')]();});}};}function handleEntityNotFound(_0xf4ae70,_0x4fe4f6){return function(_0x5d6ac1){if(!_0x5d6ac1){_0xf4ae70[_0xad2e('0x35')](0x194);}return _0x5d6ac1;};}function handleError(_0x4b53d6,_0x1bf1da){_0x1bf1da=_0x1bf1da||0x1f4;return function(_0x33c2a8){logger[_0xad2e('0x22')](_0x33c2a8[_0xad2e('0x36')]);if(_0x33c2a8[_0xad2e('0x37')]){delete _0x33c2a8['name'];}_0x4b53d6[_0xad2e('0x28')](_0x1bf1da)[_0xad2e('0x38')](_0x33c2a8);};}exports['index']=function(_0x596eee,_0x5ba338){var _0x274fd8={'include':[{'model':db[_0xad2e('0x39')],'as':_0xad2e('0x3a')}]},_0x54dac3={},_0x5f29a5={'count':0x0,'rows':[]};var _0x271a49=_[_0xad2e('0x3b')](db[_0xad2e('0x3c')][_0xad2e('0x3d')],function(_0x382665){return{'name':_0x382665['fieldName'],'type':_0x382665[_0xad2e('0x3e')][_0xad2e('0x3f')]};});_0x54dac3[_0xad2e('0x40')]=_[_0xad2e('0x3b')](_0x271a49,_0xad2e('0x37'));_0x54dac3['query']=_[_0xad2e('0x41')](_0x596eee['query']);_0x54dac3[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x54dac3[_0xad2e('0x40')],_0x54dac3[_0xad2e('0x44')]);_0x274fd8[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x54dac3[_0xad2e('0x40')],qs[_0xad2e('0x46')](_0x596eee[_0xad2e('0x44')][_0xad2e('0x46')]));_0x274fd8[_0xad2e('0x45')]=_0x274fd8[_0xad2e('0x45')][_0xad2e('0x47')]?_0x274fd8[_0xad2e('0x45')]:_0x54dac3[_0xad2e('0x40')];if(!_0x596eee[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x274fd8[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x596eee['query'][_0xad2e('0x2b')]);_0x274fd8[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x596eee[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x274fd8[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x596eee['query'][_0xad2e('0x4b')]);_0x274fd8['where']=qs[_0xad2e('0x42')](_[_0xad2e('0x4c')](_0x596eee[_0xad2e('0x44')],_0x54dac3[_0xad2e('0x42')]),_0x271a49);if(_0x596eee[_0xad2e('0x44')]['filter']){_0x274fd8[_0xad2e('0x4d')]=_[_0xad2e('0x4e')](_0x274fd8[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x271a49,function(_0x3236f1){if(_0x3236f1['type']!==_0xad2e('0x4f')){var _0x120069={};_0x120069[_0x3236f1[_0xad2e('0x37')]]={'$like':'%'+_0x596eee[_0xad2e('0x44')]['filter']+'%'};return _0x120069;}})});}_0x274fd8=_['merge']({},_0x274fd8,_0x596eee[_0xad2e('0x50')]);var _0x343e4f={'where':_0x274fd8['where']};return db['OpenchannelAccount'][_0xad2e('0x2d')](_0x343e4f)['then'](function(_0x37db2d){_0x5f29a5[_0xad2e('0x2d')]=_0x37db2d;if(_0x596eee['query'][_0xad2e('0x51')]){_0x274fd8[_0xad2e('0x52')]=[{'all':!![]}];}return db[_0xad2e('0x3c')][_0xad2e('0x53')](_0x274fd8);})['then'](function(_0x527c93){_0x5f29a5[_0xad2e('0x54')]=_0x527c93;return _0x5f29a5;})[_0xad2e('0x1e')](respondWithFilteredResult(_0x5ba338,_0x274fd8))[_0xad2e('0x27')](handleError(_0x5ba338,null));};exports[_0xad2e('0x55')]=function(_0x296b67,_0x2300e6){var _0x18f036={'raw':![],'where':{'id':_0x296b67['params']['id']},'include':[{'model':db[_0xad2e('0x39')],'as':'mandatoryDispositionPause'}]},_0x3e90d0={};_0x3e90d0[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x3c')][_0xad2e('0x3d')]);_0x3e90d0[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x296b67[_0xad2e('0x44')]);_0x3e90d0['filters']=_[_0xad2e('0x43')](_0x3e90d0['model'],_0x3e90d0[_0xad2e('0x44')]);_0x18f036[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x3e90d0[_0xad2e('0x40')],qs['fields'](_0x296b67[_0xad2e('0x44')][_0xad2e('0x46')]));_0x18f036['attributes']=_0x18f036[_0xad2e('0x45')]['length']?_0x18f036[_0xad2e('0x45')]:_0x3e90d0[_0xad2e('0x40')];if(_0x296b67[_0xad2e('0x44')][_0xad2e('0x51')]){_0x18f036[_0xad2e('0x52')]=[{'all':!![]}];}_0x18f036=_[_0xad2e('0x4e')]({},_0x18f036,_0x296b67[_0xad2e('0x50')]);return db[_0xad2e('0x3c')][_0xad2e('0x56')](_0x18f036)['then'](handleEntityNotFound(_0x2300e6,null))[_0xad2e('0x1e')](respondWithResult(_0x2300e6,null))[_0xad2e('0x27')](handleError(_0x2300e6,null));};exports[_0xad2e('0x57')]=function(_0x243add,_0x519971){return db['OpenchannelAccount'][_0xad2e('0x57')](_0x243add[_0xad2e('0x58')],{})[_0xad2e('0x1e')](function(_0xd3b75e){var _0x450803=_0x243add[_0xad2e('0x59')]['get']({'plain':!![]});if(!_0x450803)throw new Error(_0xad2e('0x5a'));if(_0x450803[_0xad2e('0x5b')]==='user'){var _0x45f3e7=_0xd3b75e[_0xad2e('0x5c')]({'plain':!![]});var _0x1a8346=_0xad2e('0x33');return db[_0xad2e('0x5d')][_0xad2e('0x56')]({'where':{'name':_0x1a8346,'userProfileId':_0x450803[_0xad2e('0x5e')]},'raw':!![]})[_0xad2e('0x1e')](function(_0x745c47){if(_0x745c47&&_0x745c47[_0xad2e('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x45f3e7[_0xad2e('0x37')],'resourceId':_0x45f3e7['id'],'type':_0x745c47['name'],'sectionId':_0x745c47['id']},{})['then'](function(){return _0xd3b75e;});}else{return _0xd3b75e;}})[_0xad2e('0x27')](function(_0x3c3f96){logger[_0xad2e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3f96);throw _0x3c3f96;});}return _0xd3b75e;})[_0xad2e('0x1e')](respondWithResult(_0x519971,0xc9))[_0xad2e('0x27')](handleError(_0x519971,null));};exports[_0xad2e('0x31')]=function(_0x470bda,_0x1cc9ce){if(_0x470bda['body']['id']){delete _0x470bda[_0xad2e('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x470bda['params']['id']},'include':[{'model':db['Pause'],'as':_0xad2e('0x3a')}]})[_0xad2e('0x1e')](handleEntityNotFound(_0x1cc9ce,null))[_0xad2e('0x1e')](saveUpdates(_0x470bda[_0xad2e('0x58')],null))[_0xad2e('0x1e')](respondWithResult(_0x1cc9ce,null))[_0xad2e('0x27')](handleError(_0x1cc9ce,null));};exports[_0xad2e('0x32')]=function(_0x322b8d,_0x1a7d47){return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x322b8d['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x1a7d47,null))[_0xad2e('0x1e')](removeEntity(_0x1a7d47,null))['catch'](handleError(_0x1a7d47,null));};exports['describe']=function(_0x1010fd,_0x49a7d9){return db[_0xad2e('0x3c')][_0xad2e('0x60')]()[_0xad2e('0x1e')](respondWithResult(_0x49a7d9,null))[_0xad2e('0x27')](handleError(_0x49a7d9,null));};exports[_0xad2e('0x61')]=function(_0x401417,_0x10d465,_0x21bd0d){if(_0x401417['body']['id']){delete _0x401417[_0xad2e('0x58')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x401417[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x10d465,null))['then'](function(_0x33846a){if(_0x33846a){_0x401417[_0xad2e('0x58')][_0xad2e('0x63')]=_0x33846a['id'];return db['Disposition'][_0xad2e('0x57')](_0x401417['body']);}})[_0xad2e('0x1e')](respondWithResult(_0x10d465,null))['catch'](handleError(_0x10d465,null));};exports[_0xad2e('0x64')]=function(_0x45cff3,_0x38b136,_0x19f896){var _0x3adb7f={'raw':![],'where':{}};var _0x18a7d6={};var _0x59981c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x45cff3[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x38b136,null))[_0xad2e('0x1e')](function(_0x57e1a9){if(_0x57e1a9){_0x18a7d6[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x66')][_0xad2e('0x3d')]);_0x18a7d6[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x45cff3[_0xad2e('0x44')]);_0x18a7d6[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x18a7d6['model'],_0x18a7d6[_0xad2e('0x44')]);_0x3adb7f[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x18a7d6['model'],qs[_0xad2e('0x46')](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x46')]));_0x3adb7f[_0xad2e('0x45')]=_0x3adb7f[_0xad2e('0x45')][_0xad2e('0x47')]?_0x3adb7f['attributes']:_0x18a7d6['model'];if(!_0x45cff3['query']['hasOwnProperty'](_0xad2e('0x49'))){_0x3adb7f[_0xad2e('0x2b')]=qs['limit'](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x3adb7f[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x45cff3[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x3adb7f[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x45cff3['query']['sort']);_0x3adb7f['where']=qs['filters'](_['pick'](_0x45cff3[_0xad2e('0x44')],_0x18a7d6['filters']));_0x3adb7f[_0xad2e('0x4d')][_0xad2e('0x63')]=_0x57e1a9['id'];if(_0x45cff3[_0xad2e('0x44')]['filter']){_0x3adb7f['where']=_[_0xad2e('0x4e')](_0x3adb7f['where'],{'$or':_['map'](_0x3adb7f[_0xad2e('0x45')],function(_0xc1ef25){var _0x35fce1={};_0x35fce1[_0xc1ef25]={'$like':'%'+_0x45cff3[_0xad2e('0x44')][_0xad2e('0x67')]+'%'};return _0x35fce1;})});}_0x3adb7f=_[_0xad2e('0x4e')]({},_0x3adb7f,_0x45cff3[_0xad2e('0x50')]);return db[_0xad2e('0x66')][_0xad2e('0x2d')]({'where':_0x3adb7f[_0xad2e('0x4d')]})['then'](function(_0x4b582d){_0x59981c[_0xad2e('0x2d')]=_0x4b582d;if(_0x45cff3[_0xad2e('0x44')]['includeAll']){_0x3adb7f[_0xad2e('0x52')]=[{'all':!![]}];}return db[_0xad2e('0x66')]['findAll'](_0x3adb7f);})['then'](function(_0x2f65a2){_0x59981c[_0xad2e('0x54')]=_0x2f65a2;return _0x59981c;});}})[_0xad2e('0x1e')](respondWithFilteredResult(_0x38b136,_0x3adb7f))[_0xad2e('0x27')](handleError(_0x38b136,null));};exports[_0xad2e('0x68')]=function(_0x5ac3bb,_0x36b3f6,_0x5e2007){return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x5ac3bb['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x36b3f6,null))[_0xad2e('0x1e')](function(_0x28a588){if(_0x28a588){return _0x28a588['removeDispositions'](_0x5ac3bb[_0xad2e('0x44')][_0xad2e('0x69')]);}})[_0xad2e('0x1e')](respondWithStatusCode(_0x36b3f6,null))[_0xad2e('0x27')](handleError(_0x36b3f6,null));};exports[_0xad2e('0x6a')]=function(_0x5b0f77,_0x2ea2d8,_0x584c8c){if(_0x5b0f77[_0xad2e('0x58')]['id']){delete _0x5b0f77[_0xad2e('0x58')]['id'];}return db[_0xad2e('0x3c')][_0xad2e('0x56')]({'where':{'id':_0x5b0f77[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2ea2d8,null))[_0xad2e('0x1e')](function(_0xd342e4){if(_0xd342e4){_0x5b0f77[_0xad2e('0x58')][_0xad2e('0x63')]=_0xd342e4['id'];return db[_0xad2e('0x6b')][_0xad2e('0x57')](_0x5b0f77[_0xad2e('0x58')]);}})[_0xad2e('0x1e')](respondWithResult(_0x2ea2d8,null))[_0xad2e('0x27')](handleError(_0x2ea2d8,null));};exports[_0xad2e('0x6c')]=function(_0x1cc308,_0x54e8ac,_0x34dd8e){var _0x475d6c={'raw':![],'where':{}};var _0x1bdd1f={};var _0x1fa253={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x1cc308[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x54e8ac,null))['then'](function(_0x1c49e6){if(_0x1c49e6){_0x1bdd1f[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x6b')]['rawAttributes']);_0x1bdd1f[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x1cc308[_0xad2e('0x44')]);_0x1bdd1f[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x1bdd1f[_0xad2e('0x40')],_0x1bdd1f[_0xad2e('0x44')]);_0x475d6c[_0xad2e('0x45')]=_['intersection'](_0x1bdd1f[_0xad2e('0x40')],qs['fields'](_0x1cc308['query'][_0xad2e('0x46')]));_0x475d6c[_0xad2e('0x45')]=_0x475d6c[_0xad2e('0x45')][_0xad2e('0x47')]?_0x475d6c[_0xad2e('0x45')]:_0x1bdd1f[_0xad2e('0x40')];if(!_0x1cc308[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x475d6c[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x1cc308[_0xad2e('0x44')]['limit']);_0x475d6c[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x1cc308[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x475d6c[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x1cc308[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x475d6c[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_['pick'](_0x1cc308[_0xad2e('0x44')],_0x1bdd1f[_0xad2e('0x42')]));_0x475d6c[_0xad2e('0x4d')][_0xad2e('0x63')]=_0x1c49e6['id'];if(_0x1cc308['query'][_0xad2e('0x67')]){_0x475d6c['where']=_[_0xad2e('0x4e')](_0x475d6c[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x475d6c[_0xad2e('0x45')],function(_0x16ebe6){var _0x126f34={};_0x126f34[_0x16ebe6]={'$like':'%'+_0x1cc308[_0xad2e('0x44')]['filter']+'%'};return _0x126f34;})});}_0x475d6c=_[_0xad2e('0x4e')]({},_0x475d6c,_0x1cc308[_0xad2e('0x50')]);return db['CannedAnswer']['count']({'where':_0x475d6c[_0xad2e('0x4d')]})['then'](function(_0x42909c){_0x1fa253[_0xad2e('0x2d')]=_0x42909c;if(_0x1cc308['query']['includeAll']){_0x475d6c[_0xad2e('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xad2e('0x53')](_0x475d6c);})[_0xad2e('0x1e')](function(_0x5ad612){_0x1fa253[_0xad2e('0x54')]=_0x5ad612;return _0x1fa253;});}})['then'](respondWithFilteredResult(_0x54e8ac,_0x475d6c))[_0xad2e('0x27')](handleError(_0x54e8ac,null));};exports[_0xad2e('0x6d')]=function(_0x5c81a3,_0x4ce1c8,_0x3cfd53){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x5c81a3[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x4ce1c8,null))['then'](function(_0x3ffc2a){if(_0x3ffc2a){return _0x3ffc2a[_0xad2e('0x6d')](_0x5c81a3[_0xad2e('0x44')][_0xad2e('0x69')]);}})[_0xad2e('0x1e')](respondWithStatusCode(_0x4ce1c8,null))['catch'](handleError(_0x4ce1c8,null));};exports[_0xad2e('0x6e')]=function(_0x1fda13,_0x26519d,_0x88eb33){var _0x55caee={'body':_0x1fda13[_0xad2e('0x58')],'channel':'openchannel'};var _0x2eae58=[];var _0x5372fb=[];var _0x24fdd6={};var _0x3692ec=![];return db[_0xad2e('0x6f')][_0xad2e('0x60')]()['then'](function(_0xa9dcd5){if(!_0xa9dcd5){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x72'));}_0x2eae58=_['difference'](_[_0xad2e('0x41')](_0xa9dcd5),[_0xad2e('0x73'),_0xad2e('0x74')]);_0x5372fb=_['difference'](_[_0xad2e('0x41')](_0xa9dcd5),[_0xad2e('0x73'),_0xad2e('0x74'),'CompanyId',_0xad2e('0x75')]);if(_0x1fda13[_0xad2e('0x58')]['id']){delete _0x1fda13[_0xad2e('0x58')]['id'];}if(_[_0xad2e('0x76')](_0x1fda13[_0xad2e('0x58')][_0xad2e('0x77')])){throw new db['Sequelize']['ValidationError'](_0xad2e('0x78'));}if(_[_0xad2e('0x76')](_0x1fda13[_0xad2e('0x58')]['body'])||_0x1fda13[_0xad2e('0x58')][_0xad2e('0x58')]===''){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x79'));}if(_[_0xad2e('0x76')](_0x1fda13['body']['mapKey'])){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x7a')+_0x5372fb);}if(!_['includes'](_0x5372fb,_0x1fda13[_0xad2e('0x58')][_0xad2e('0x7b')])){throw new db[(_0xad2e('0x70'))]['ValidationError'](_0xad2e('0x7c')+_0x5372fb);}_0x24fdd6[_0x1fda13['body'][_0xad2e('0x7b')]]=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x77')];})[_0xad2e('0x1e')](function(){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x1fda13['params']['id']},'include':[{'model':db['CmList'],'as':_0xad2e('0x7d'),'include':[{'model':db[_0xad2e('0x6f')],'as':_0xad2e('0x7e'),'where':_0x24fdd6,'limit':0x1,'order':[[_0xad2e('0x74'),'DESC']]}]},{'model':db[_0xad2e('0x7f')],'as':_0xad2e('0x80')}]});})[_0xad2e('0x1e')](handleEntityNotFound(_0x26519d,null))[_0xad2e('0x1e')](function(_0x8d5b1){if(_0x8d5b1&&_0x8d5b1['List']){_0x55caee[_0xad2e('0x81')]=_0x8d5b1;_0x55caee[_0xad2e('0x82')]=_0x8d5b1[_0xad2e('0x80')];_0x55caee[_0xad2e('0x83')]=_0x8d5b1[_0xad2e('0x7d')];_0x55caee[_0xad2e('0x82')]=_[_0xad2e('0x84')](_0x55caee[_0xad2e('0x82')],[_0xad2e('0x85')],[_0xad2e('0x86')]);if(_0x55caee[_0xad2e('0x81')][_0xad2e('0x80')]){delete _0x55caee[_0xad2e('0x81')][_0xad2e('0x80')];}if(_0x55caee[_0xad2e('0x81')][_0xad2e('0x7d')]&&_0x55caee['account'][_0xad2e('0x7d')][_0xad2e('0x7e')]['length']){return _0x55caee[_0xad2e('0x81')]['List'][_0xad2e('0x7e')][0x0];}var _0x3a6ec6=_[_0xad2e('0x87')](_0x1fda13['body'],{'firstName':_0x1fda13['body'][_0xad2e('0x77')],'ListId':_0x8d5b1['ListId']});_0x3a6ec6[_0x1fda13[_0xad2e('0x58')][_0xad2e('0x7b')]]=_0x1fda13['body'][_0xad2e('0x77')];return db[_0xad2e('0x6f')][_0xad2e('0x57')](_0x3a6ec6,{'fields':_0x2eae58,'raw':!![]});}})[_0xad2e('0x1e')](handleEntityNotFound(_0x26519d,null))['then'](function(_0x574f67){_0x55caee['contact']=_0x574f67;if(_0x574f67){var _0x843547={'ContactId':_0x574f67['id'],'OpenchannelAccountId':_0x1fda13[_0xad2e('0x62')]['id'],'from':(_0x574f67[_0xad2e('0x88')]||'')+'\x20'+(_0x574f67[_0xad2e('0x89')]||'')};var _0x3a70de={'OpenchannelAccountId':_0x1fda13[_0xad2e('0x62')]['id'],'closed':![]};if(_0x1fda13['body'][_0xad2e('0x8a')]){_0x3a70de['threadId']=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')];return db[_0xad2e('0x8b')][_0xad2e('0x56')]({'where':_0x3a70de})[_0xad2e('0x1e')](function(_0x2fe953){if(_0x2fe953){return[_0x2fe953,![]];}_0x843547[_0xad2e('0x8a')]=_0x1fda13[_0xad2e('0x58')]['threadId'];_0x843547['externalUrl']=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8c')];return db['OpenchannelInteraction'][_0xad2e('0x57')](_0x843547)[_0xad2e('0x1e')](function(_0x423871){return[_0x423871,!![]];});});}else{_0x3a70de[_0xad2e('0x8a')]=null;}_0x3a70de[_0xad2e('0x8d')]=_0x574f67['id'];return db[_0xad2e('0x8b')]['find']({'where':_0x3a70de})['then'](function(_0x163c57){if(_0x163c57){return[_0x163c57,![]];}return db[_0xad2e('0x8b')][_0xad2e('0x57')](_0x843547)['then'](function(_0x522021){return[_0x522021,!![]];});});}})[_0xad2e('0x8e')](function(_0x1e5a79,_0x6db0ee){if(_0x1e5a79){_0x3692ec=_0x6db0ee;if(!_0x6db0ee){var _0x2fd877={'from':(_0x55caee[_0xad2e('0x8f')][_0xad2e('0x88')]||'')+'\x20'+(_0x55caee[_0xad2e('0x8f')][_0xad2e('0x89')]||'')};if(_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')]&&_0x1fda13['body']['messageId']&&_0x1fda13[_0xad2e('0x58')][_0xad2e('0x8a')]!=_0x1fda13[_0xad2e('0x58')][_0xad2e('0x90')]){_0x2fd877[_0xad2e('0x8a')]=_0x1fda13['body'][_0xad2e('0x90')];}return _0x1e5a79['update'](_0x2fd877);}else{return _0x1e5a79;}}})['then'](function(_0x529069){_0x55caee[_0xad2e('0x91')]=_0x529069[_0xad2e('0x5c')]({'plain':!![]});_0x55caee['interaction']['created']=_0x3692ec;if(_0x55caee[_0xad2e('0x91')][_0xad2e('0x92')]){if(_0x55caee['account'][_0xad2e('0x93')]){_0x55caee[_0xad2e('0x82')][_0xad2e('0x94')]({'id':0x0,'priority':_0x55caee[_0xad2e('0x82')][_0xad2e('0x47')]+0x1,'app':'close','appdata':_0xad2e('0x95'),'interval':_0xad2e('0x96')});}}return db[_0xad2e('0x97')][_0xad2e('0x57')]({'body':_0x1fda13[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1fda13['params']['id'],'OpenchannelInteractionId':_0x529069['id'],'direction':'in','ContactId':_0x55caee[_0xad2e('0x8f')]['id'],'AttachmentId':_0x1fda13[_0xad2e('0x58')]['AttachmentId']});})[_0xad2e('0x1e')](function(_0x5777f5){_0x55caee[_0xad2e('0x25')]=_0x5777f5;if(_0x55caee[_0xad2e('0x91')][_0xad2e('0x98')]){return db[_0xad2e('0x99')]['find']({'attributes':['id',_0xad2e('0x37')],'where':{'id':_0x55caee[_0xad2e('0x91')][_0xad2e('0x98')]}})[_0xad2e('0x1e')](function(_0x48f509){if(_0x48f509){_0x55caee[_0xad2e('0x82')][_0xad2e('0x9a')]({'id':0x0,'priority':0x0,'app':_0xad2e('0x9b'),'appdata':_0x48f509[_0xad2e('0x37')]+','+(_0x55caee[_0xad2e('0x81')][_0xad2e('0x9c')]||0xa),'interval':_0xad2e('0x96')});_0x55caee[_0xad2e('0x9d')]=![];}return respondWithRpcPromise(_0xad2e('0x9e'),_0xad2e('0x9f'),_0x55caee);});}return respondWithRpcPromise(_0xad2e('0x9e'),_0xad2e('0x9f'),_0x55caee);})[_0xad2e('0x1e')](function(_0x5f1aaf){respondWithRpcPromise(_0xad2e('0xa0'),_0xad2e('0xa0'),{'event':_0xad2e('0x6e'),'message':_0x5f1aaf},client9002);return _0x5f1aaf;})['then'](respondWithResult(_0x26519d,null))['catch'](handleError(_0x26519d,null));};exports[_0xad2e('0xa1')]=function(_0x55b7de,_0x2764b8){var _0x514090=_0x55b7de['params']['id'];var _0xf4c429=_0x55b7de[_0xad2e('0x58')];var _0x281853=0xc8;var _0x346a14=null;return db[_0xad2e('0xa2')][_0xad2e('0xa3')]({'isolationLevel':db['sequelize']['Transaction'][_0xad2e('0xa4')][_0xad2e('0xa5')]},function(_0x1d2988){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x514090},'transaction':_0x1d2988})[_0xad2e('0x1e')](function(_0x1d2174){if(_0x1d2174){return db['OpenchannelApplication'][_0xad2e('0x32')]({'where':{'OpenchannelAccountId':_0x514090},'transaction':_0x1d2988})['then'](function(){var _0x3da872=_[_0xad2e('0x3b')](_0xf4c429,function(_0x241e01){_0x241e01[_0xad2e('0x63')]=_0x514090;return _0x241e01;});return db[_0xad2e('0x7f')][_0xad2e('0xa6')](_0x3da872,{'transaction':_0x1d2988});});}else{_0x281853=0x194;_0x346a14=[];}});})['then'](function(){if(_0x281853!==0x194){return db[_0xad2e('0x7f')][_0xad2e('0xa7')]({'where':{'OpenchannelAccountId':_0x514090},'order':'priority'})[_0xad2e('0x1e')](function(_0x232403){_0x346a14=_0x232403;});}})[_0xad2e('0x27')](function(_0x360d04){_0x281853=0x1f4;logger[_0xad2e('0x22')](_0x360d04[_0xad2e('0x36')]);if(_0x360d04[_0xad2e('0x37')]){delete _0x360d04['name'];}_0x346a14=_0x360d04;})[_0xad2e('0xa8')](function(){if(_0x346a14===null){_0x2764b8['sendStatus'](_0x281853);}else{if(_0x281853===0x1f4){_0x2764b8[_0xad2e('0x28')](_0x281853)[_0xad2e('0x38')](_0x346a14);}else{_0x2764b8[_0xad2e('0x28')](_0x281853)[_0xad2e('0x29')](_0x346a14);}}});};exports[_0xad2e('0xa9')]=function(_0x9b10b,_0x16c3fe,_0x4f546b){var _0x5eeebd={};var _0x476b0a={};var _0x40d8d7;var _0x30a217;return db[_0xad2e('0x3c')][_0xad2e('0x65')]({'where':{'id':_0x9b10b[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x16c3fe,null))[_0xad2e('0x1e')](function(_0x571702){if(_0x571702){_0x40d8d7=_0x571702;_0x476b0a['model']=_[_0xad2e('0x41')](db[_0xad2e('0x7f')]['rawAttributes']);_0x476b0a[_0xad2e('0x44')]=_[_0xad2e('0x41')](_0x9b10b[_0xad2e('0x44')]);_0x476b0a[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0x476b0a[_0xad2e('0x40')],_0x476b0a[_0xad2e('0x44')]);_0x5eeebd[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0x476b0a[_0xad2e('0x40')],qs['fields'](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x46')]));_0x5eeebd[_0xad2e('0x45')]=_0x5eeebd[_0xad2e('0x45')][_0xad2e('0x47')]?_0x5eeebd[_0xad2e('0x45')]:_0x476b0a['model'];_0x5eeebd['order']=qs['sort'](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x5eeebd['where']=qs['filters'](_['pick'](_0x9b10b[_0xad2e('0x44')],_0x476b0a['filters']));if(_0x9b10b[_0xad2e('0x44')][_0xad2e('0x67')]){_0x5eeebd['where']=_[_0xad2e('0x4e')](_0x5eeebd[_0xad2e('0x4d')],{'$or':_[_0xad2e('0x3b')](_0x5eeebd[_0xad2e('0x45')],function(_0x46535f){var _0x2a9579={};_0x2a9579[_0x46535f]={'$like':'%'+_0x9b10b[_0xad2e('0x44')]['filter']+'%'};return _0x2a9579;})});}_0x5eeebd=_['merge']({},_0x5eeebd,_0x9b10b[_0xad2e('0x50')]);return _0x40d8d7[_0xad2e('0xa9')](_0x5eeebd);}})[_0xad2e('0x1e')](function(_0x50758e){if(_0x50758e){_0x30a217=_0x50758e[_0xad2e('0x47')];if(!_0x9b10b[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x5eeebd['limit']=qs[_0xad2e('0x2b')](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x5eeebd[_0xad2e('0x2a')]=qs[_0xad2e('0x2a')](_0x9b10b[_0xad2e('0x44')][_0xad2e('0x2a')]);}return _0x40d8d7[_0xad2e('0xa9')](_0x5eeebd);}})[_0xad2e('0x1e')](function(_0x3afce8){if(_0x3afce8){return _0x3afce8?{'count':_0x30a217,'rows':_0x3afce8}:null;}})[_0xad2e('0x1e')](respondWithResult(_0x16c3fe,null))[_0xad2e('0x27')](handleError(_0x16c3fe,null));};exports[_0xad2e('0xaa')]=function(_0x4bbe9f,_0x12e027,_0xa49de1){var _0x3d0f8b={'raw':![],'where':{}};var _0xd5f999={};var _0xdbb0a1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xad2e('0x65')]({'where':{'id':_0x4bbe9f[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x12e027,null))[_0xad2e('0x1e')](function(_0x51df55){if(_0x51df55){_0xd5f999[_0xad2e('0x40')]=_[_0xad2e('0x41')](db[_0xad2e('0x8b')][_0xad2e('0x3d')]);_0xd5f999['query']=_['keys'](_0x4bbe9f[_0xad2e('0x44')]);_0xd5f999[_0xad2e('0x42')]=_[_0xad2e('0x43')](_0xd5f999['model'],_0xd5f999[_0xad2e('0x44')]);_0x3d0f8b[_0xad2e('0x45')]=_[_0xad2e('0x43')](_0xd5f999[_0xad2e('0x40')],qs[_0xad2e('0x46')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x46')]));_0x3d0f8b[_0xad2e('0x45')]=_0x3d0f8b[_0xad2e('0x45')][_0xad2e('0x47')]?_0x3d0f8b[_0xad2e('0x45')]:_0xd5f999[_0xad2e('0x40')];if(!_0x4bbe9f['query'][_0xad2e('0x48')](_0xad2e('0x49'))){_0x3d0f8b[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x3d0f8b['offset']=qs[_0xad2e('0x2a')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x2a')]);}_0x3d0f8b[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x3d0f8b[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_['pick'](_0x4bbe9f['query'],_0xd5f999[_0xad2e('0x42')]));_0x3d0f8b[_0xad2e('0x4d')]['OpenchannelAccountId']=_0x51df55['id'];if(_0x4bbe9f[_0xad2e('0x44')]['filter']){_0x3d0f8b[_0xad2e('0x4d')]=_[_0xad2e('0x4e')](_0x3d0f8b['where'],{'$or':_['map'](_0x3d0f8b['attributes'],function(_0x3de06a){var _0x55947c={};_0x55947c[_0x3de06a]={'$like':'%'+_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0x67')]+'%'};return _0x55947c;})});}_0x3d0f8b=_[_0xad2e('0x4e')]({},_0x3d0f8b,_0x4bbe9f['options']);return db['OpenchannelInteraction']['count']({'where':_0x3d0f8b[_0xad2e('0x4d')]})['then'](function(_0x3d2f35){_0xdbb0a1[_0xad2e('0x2d')]=_0x3d2f35;if(_0x4bbe9f[_0xad2e('0x44')]['includeAll']){_0x3d0f8b[_0xad2e('0x52')]=[{'model':db[_0xad2e('0x6f')],'as':'Contact','required':![]},{'model':db[_0xad2e('0x99')],'as':_0xad2e('0xab'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xad2e('0xac')],'as':_0xad2e('0xad'),'attributes':['id',_0xad2e('0x37'),_0xad2e('0xae')],'where':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]?{'id':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]}:undefined,'required':_0x4bbe9f[_0xad2e('0x44')][_0xad2e('0xaf')]?!![]:![]}];}return db[_0xad2e('0x8b')][_0xad2e('0x53')](_0x3d0f8b);})[_0xad2e('0x1e')](function(_0x51d053){_0xdbb0a1[_0xad2e('0x54')]=_0x51d053;return _0xdbb0a1;});}})[_0xad2e('0x1e')](respondWithFilteredResult(_0x12e027,_0x3d0f8b))['catch'](handleError(_0x12e027,null));};exports[_0xad2e('0xb0')]=function(_0x505b58,_0x4758d2,_0x547e0a){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x505b58[_0xad2e('0x62')]['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x4758d2,null))[_0xad2e('0x1e')](function(_0xcba9){if(_0xcba9){return _0xcba9[_0xad2e('0xb0')](_0x505b58[_0xad2e('0x58')]['ids'],_[_0xad2e('0xb1')](_0x505b58[_0xad2e('0x58')],[_0xad2e('0x69'),'id'])||{})[_0xad2e('0x8e')](function(_0x53d428){for(var _0x5d2208=0x0;_0x5d2208<_0x505b58['body']['ids'][_0xad2e('0x47')];_0x5d2208+=0x1){socket['emit'](_0xad2e('0xb2'),{'UserId':Number(_0x505b58[_0xad2e('0x58')]['ids'][_0x5d2208]),'OpenchannelAccountId':Number(_0x505b58[_0xad2e('0x62')]['id'])});}return _0x53d428;});}})[_0xad2e('0x1e')](respondWithResult(_0x4758d2,null))[_0xad2e('0x27')](handleError(_0x4758d2,null));};exports[_0xad2e('0xb3')]=function(_0x3e55f1,_0x53385e,_0x21c1d1){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x3e55f1['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x53385e,null))[_0xad2e('0x1e')](function(_0x2ed9f4){if(_0x2ed9f4){return _0x2ed9f4[_0xad2e('0xb3')](_0x3e55f1[_0xad2e('0x44')]['ids'])['then'](function(){if(_[_0xad2e('0xb4')](_0x3e55f1[_0xad2e('0x44')]['ids'])){for(var _0x3e5a2b=0x0;_0x3e5a2b<_0x3e55f1['query'][_0xad2e('0x69')][_0xad2e('0x47')];_0x3e5a2b+=0x1){socket[_0xad2e('0xb5')](_0xad2e('0xb6'),{'UserId':Number(_0x3e55f1[_0xad2e('0x44')]['ids'][_0x3e5a2b]),'OpenchannelAccountId':Number(_0x3e55f1[_0xad2e('0x62')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x3e55f1[_0xad2e('0x44')][_0xad2e('0x69')]),'OpenchannelAccountId':Number(_0x3e55f1[_0xad2e('0x62')]['id'])});}});}})[_0xad2e('0x1e')](respondWithStatusCode(_0x53385e,null))[_0xad2e('0x27')](handleError(_0x53385e,null));};exports[_0xad2e('0xb7')]=function(_0x14b851,_0x48c791,_0x313966){var _0x5da69c={};var _0x4d3232={};var _0x5b0aed;var _0xf134d;return db[_0xad2e('0x3c')]['findOne']({'where':{'id':_0x14b851['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x48c791,null))[_0xad2e('0x1e')](function(_0x15aa26){if(_0x15aa26){_0x5b0aed=_0x15aa26;_0x4d3232['model']=_[_0xad2e('0x41')](db['User']['rawAttributes']);_0x4d3232['query']=_['keys'](_0x14b851[_0xad2e('0x44')]);_0x4d3232['filters']=_['intersection'](_0x4d3232[_0xad2e('0x40')],_0x4d3232[_0xad2e('0x44')]);_0x5da69c[_0xad2e('0x45')]=_['intersection'](_0x4d3232['model'],qs[_0xad2e('0x46')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x46')]));_0x5da69c['attributes']=_0x5da69c[_0xad2e('0x45')][_0xad2e('0x47')]?_0x5da69c['attributes']:_0x4d3232[_0xad2e('0x40')];_0x5da69c[_0xad2e('0x4a')]=qs[_0xad2e('0x4b')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x4b')]);_0x5da69c[_0xad2e('0x4d')]=qs[_0xad2e('0x42')](_[_0xad2e('0x4c')](_0x14b851['query'],_0x4d3232[_0xad2e('0x42')]));if(_0x14b851['query'][_0xad2e('0x67')]){_0x5da69c[_0xad2e('0x4d')]=_['merge'](_0x5da69c['where'],{'$or':_[_0xad2e('0x3b')](_0x5da69c[_0xad2e('0x45')],function(_0x417911){var _0x45cb43={};_0x45cb43[_0x417911]={'$like':'%'+_0x14b851['query'][_0xad2e('0x67')]+'%'};return _0x45cb43;})});}_0x5da69c=_['merge']({},_0x5da69c,_0x14b851[_0xad2e('0x50')]);return _0x5b0aed[_0xad2e('0xb7')](_0x5da69c);}})[_0xad2e('0x1e')](function(_0x44aa0a){if(_0x44aa0a){_0xf134d=_0x44aa0a[_0xad2e('0x47')];if(!_0x14b851[_0xad2e('0x44')][_0xad2e('0x48')](_0xad2e('0x49'))){_0x5da69c[_0xad2e('0x2b')]=qs[_0xad2e('0x2b')](_0x14b851[_0xad2e('0x44')][_0xad2e('0x2b')]);_0x5da69c['offset']=qs[_0xad2e('0x2a')](_0x14b851[_0xad2e('0x44')]['offset']);}return _0x5b0aed[_0xad2e('0xb7')](_0x5da69c);}})[_0xad2e('0x1e')](function(_0x380fef){if(_0x380fef){return _0x380fef?{'count':_0xf134d,'rows':_0x380fef}:null;}})['then'](respondWithResult(_0x48c791,null))[_0xad2e('0x27')](handleError(_0x48c791,null));};exports[_0xad2e('0x38')]=function(_0x4943ac,_0x2f711c,_0x186159){var _0xa9c180,_0x1d0202,_0x1a3f76;if(_[_0xad2e('0x76')](_0x4943ac[_0xad2e('0x58')]['body'])||_0x4943ac['body']['body']===''){throw new db[(_0xad2e('0x70'))][(_0xad2e('0x71'))](_0xad2e('0x79'));}if(_[_0xad2e('0x76')](_0x4943ac['body']['to'])){}_0xa9c180=_0x4943ac['body']['to'];return db[_0xad2e('0x3c')][_0xad2e('0x65')]({'where':{'id':_0x4943ac['params']['id']}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x5a6603){if(_0x5a6603){return db[_0xad2e('0x3c')]['find']({'where':{'id':_0x5a6603['id']},'include':[{'model':db[_0xad2e('0xb8')],'as':_0xad2e('0x7d'),'include':[{'model':db['CmContact'],'as':_0xad2e('0x7e'),'where':{[_0x5a6603[_0xad2e('0x7b')]]:_0xa9c180},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x492b7e){if(_0x492b7e&&_0x492b7e[_0xad2e('0x7d')]){_0x1d0202=_0x492b7e['get']({'plain':!![]});if(_0x1d0202[_0xad2e('0x7d')]&&_0x1d0202[_0xad2e('0x7d')][_0xad2e('0x7e')][_0xad2e('0x47')]){return _0x1d0202[_0xad2e('0x7d')]['Contacts'][0x0];}return db['CmContact'][_0xad2e('0x57')](_[_0xad2e('0x87')](_0x4943ac[_0xad2e('0x58')],{'firstName':_0xa9c180,[_0x492b7e['mapKey']]:_0xa9c180,'phone':_0xa9c180,'ListId':_0x1d0202[_0xad2e('0x75')]}));}})[_0xad2e('0x1e')](handleEntityNotFound(_0x2f711c,null))[_0xad2e('0x1e')](function(_0x64cf3e){if(_0x64cf3e){_0x1a3f76=_0x64cf3e;return db[_0xad2e('0x8b')][_0xad2e('0x56')]({'where':{'ContactId':_0x1a3f76['id'],'closed':![],'OpenchannelAccountId':_0x1d0202['id']}})[_0xad2e('0x1e')](function(_0xa2fb80){if(_0xa2fb80){return[_0xa2fb80,![]];}return db[_0xad2e('0x8b')][_0xad2e('0x57')]({'UserId':_0x4943ac[_0xad2e('0x59')]['id'],'ContactId':_0x1a3f76['id'],'OpenchannelAccountId':_0x1d0202['id'],'lastMsgDirection':'out','firstMsgDirection':_0xad2e('0xb9'),'Messages':[_[_0xad2e('0x4e')](_0x4943ac['body'],{'read':![],'body':_0x4943ac[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1d0202['id'],'UserId':_0x4943ac[_0xad2e('0x59')]['id'],'ContactId':_0x1a3f76['id']})]},{'include':[{'model':db[_0xad2e('0x97')],'as':_0xad2e('0xba')}]})['then'](function(_0x2a26c2){return[_0x2a26c2,!![]];});});}})[_0xad2e('0x8e')](function(_0x27ad41,_0x23834d){if(_0x23834d){return _0x27ad41;}return db[_0xad2e('0x97')][_0xad2e('0x57')](_[_0xad2e('0x4e')](_0x4943ac[_0xad2e('0x58')],{'read':![],'body':_0x4943ac[_0xad2e('0x58')][_0xad2e('0x58')],'OpenchannelAccountId':_0x1d0202['id'],'OpenchannelInteractionId':_0x27ad41['id'],'UserId':_0x4943ac['user']['id'],'ContactId':_0x1a3f76['id']}))[_0xad2e('0x1e')](function(_0x506922){_0x27ad41[_0xad2e('0xbb')][_0xad2e('0xba')]=[];_0x27ad41[_0xad2e('0xbb')][_0xad2e('0xba')][_0xad2e('0x94')](_0x506922['dataValues']);return _0x27ad41;});});}})[_0xad2e('0x1e')](respondWithResult(_0x2f711c,null))[_0xad2e('0x27')](handleError(_0x2f711c,null));}; \ No newline at end of file +var _0x2fed=['OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','show','keys','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','findOne','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','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','CmContact','OpenchannelApplication','Applications','applications','list','orderBy','account','List','Contacts','lastName','threadId','OpenchannelInteraction','ContactId','spread','firstName','contact','messageId','get','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','startRouting','Start','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','hasOwnProperty','getInteractions','Contact','Owner','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','client','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','OpenchannelAccounts','stack','name','index','Pause','mandatoryDispositionPause','map'];(function(_0x382778,_0x270bfd){var _0x296cd8=function(_0x331dee){while(--_0x331dee){_0x382778['push'](_0x382778['shift']());}};_0x296cd8(++_0x270bfd);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4c02f3,_0x38f440){_0x4c02f3=_0x4c02f3-0x0;var _0x33c716=_0x2fed[_0x4c02f3];return _0x33c716;};'use strict';var emlformat=require(_0xd2fe('0x0'));var rimraf=require(_0xd2fe('0x1'));var zipdir=require(_0xd2fe('0x2'));var jsonpatch=require(_0xd2fe('0x3'));var rp=require(_0xd2fe('0x4'));var moment=require('moment');var BPromise=require(_0xd2fe('0x5'));var Mustache=require(_0xd2fe('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd2fe('0x7'));var csv=require(_0xd2fe('0x8'));var ejs=require(_0xd2fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2fe('0xa'));var squel=require(_0xd2fe('0xb'));var crypto=require(_0xd2fe('0xc'));var jsforce=require(_0xd2fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd2fe('0x8'));var querystring=require(_0xd2fe('0xe'));var Papa=require(_0xd2fe('0xf'));var Redis=require(_0xd2fe('0x10'));var authService=require(_0xd2fe('0x11'));var qs=require(_0xd2fe('0x12'));var as=require(_0xd2fe('0x13'));var hardwareService=require(_0xd2fe('0x14'));var logger=require(_0xd2fe('0x15'))(_0xd2fe('0x16'));var utils=require(_0xd2fe('0x17'));var config=require(_0xd2fe('0x18'));var licenseUtil=require(_0xd2fe('0x19'));var db=require(_0xd2fe('0x1a'))['db'];config[_0xd2fe('0x1b')]=_[_0xd2fe('0x1c')](config[_0xd2fe('0x1b')],{'host':_0xd2fe('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2fe('0x1b')]));require(_0xd2fe('0x1e'))[_0xd2fe('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xd2fe('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458f87,_0x3085b4,_0x3d9bf9,_0x3ea4e1){return new BPromise(function(_0x303ca2,_0x2bc730){var _0x588d03=_0x3ea4e1||client;return _0x588d03['request'](_0x458f87,_0x3d9bf9)[_0xd2fe('0x21')](function(_0x40162f){logger['info'](_0xd2fe('0x22'),_0x3085b4,_0xd2fe('0x23'));logger[_0xd2fe('0x24')](_0xd2fe('0x25'),_0x3085b4,_0xd2fe('0x23'),JSON[_0xd2fe('0x26')](_0x40162f));if(_0x40162f[_0xd2fe('0x27')]){if(_0x40162f[_0xd2fe('0x27')][_0xd2fe('0x28')]===0x1f4){logger[_0xd2fe('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x3085b4,_0x40162f[_0xd2fe('0x27')]['message']);return _0x2bc730(_0x40162f[_0xd2fe('0x27')][_0xd2fe('0x29')]);}logger[_0xd2fe('0x27')](_0xd2fe('0x22'),_0x3085b4,_0x40162f['error'][_0xd2fe('0x29')]);return _0x303ca2(_0x40162f['error'][_0xd2fe('0x29')]);}else{logger[_0xd2fe('0x2a')](_0xd2fe('0x22'),_0x3085b4,'request\x20sent');_0x303ca2(_0x40162f['result'][_0xd2fe('0x29')]);}})[_0xd2fe('0x2b')](function(_0x236294){logger[_0xd2fe('0x27')](_0xd2fe('0x22'),_0x3085b4,_0x236294);_0x2bc730(_0x236294);});});}function respondWithStatusCode(_0x48f7ff,_0x487f8a){_0x487f8a=_0x487f8a||0xcc;return function(_0x516340){if(_0x516340){return _0x48f7ff[_0xd2fe('0x2c')](_0x487f8a);}return _0x48f7ff[_0xd2fe('0x2d')](_0x487f8a)[_0xd2fe('0x2e')]();};}function respondWithResult(_0x15d5bc,_0x52cd49){_0x52cd49=_0x52cd49||0xc8;return function(_0x23682c){if(_0x23682c){return _0x15d5bc[_0xd2fe('0x2d')](_0x52cd49)[_0xd2fe('0x2f')](_0x23682c);}};}function respondWithFilteredResult(_0x6bba0d,_0x49ab21){return function(_0x391e93){if(_0x391e93){var _0x327730=typeof _0x49ab21[_0xd2fe('0x30')]==='undefined'&&typeof _0x49ab21[_0xd2fe('0x31')]===_0xd2fe('0x32');var _0x32ad72=_0x391e93[_0xd2fe('0x33')];var _0x5c14dd=_0x327730?0x0:_0x49ab21[_0xd2fe('0x30')];var _0x328089=_0x327730?_0x391e93[_0xd2fe('0x33')]:_0x49ab21[_0xd2fe('0x30')]+_0x49ab21['limit'];var _0x36d50a;if(_0x328089>=_0x32ad72){_0x328089=_0x32ad72;_0x36d50a=0xc8;}else{_0x36d50a=0xce;}_0x6bba0d[_0xd2fe('0x2d')](_0x36d50a);return _0x6bba0d[_0xd2fe('0x34')](_0xd2fe('0x35'),_0x5c14dd+'-'+_0x328089+'/'+_0x32ad72)[_0xd2fe('0x2f')](_0x391e93);}return null;};}function patchUpdates(_0xe575b4){return function(_0x553775){try{jsonpatch[_0xd2fe('0x36')](_0x553775,_0xe575b4,!![]);}catch(_0x355679){return BPromise['reject'](_0x355679);}return _0x553775[_0xd2fe('0x37')]();};}function saveUpdates(_0x22fce7,_0x29c5d1){return function(_0x51cfa4){if(_0x51cfa4){return _0x51cfa4[_0xd2fe('0x38')](_0x22fce7)[_0xd2fe('0x21')](function(_0x53409a){return _0x53409a;});}return null;};}function removeEntity(_0x1cb22a,_0x4484ea){return function(_0xca7bf9){if(_0xca7bf9){return _0xca7bf9[_0xd2fe('0x39')]()[_0xd2fe('0x21')](function(){var _0xaaf366=_0xca7bf9['get']({'plain':!![]});var _0x4dd379=_0xd2fe('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x4dd379,'resourceId':_0xaaf366['id']}})[_0xd2fe('0x21')](function(){return _0xca7bf9;});})[_0xd2fe('0x21')](function(){_0x1cb22a[_0xd2fe('0x2d')](0xcc)[_0xd2fe('0x2e')]();});}};}function handleEntityNotFound(_0x32278d,_0x4e0b4d){return function(_0x3daff0){if(!_0x3daff0){_0x32278d['sendStatus'](0x194);}return _0x3daff0;};}function handleError(_0x5366ed,_0x12dcbd){_0x12dcbd=_0x12dcbd||0x1f4;return function(_0x325ef7){logger[_0xd2fe('0x27')](_0x325ef7[_0xd2fe('0x3b')]);if(_0x325ef7[_0xd2fe('0x3c')]){delete _0x325ef7[_0xd2fe('0x3c')];}_0x5366ed[_0xd2fe('0x2d')](_0x12dcbd)['send'](_0x325ef7);};}exports[_0xd2fe('0x3d')]=function(_0x135829,_0x2346c6){var _0x4c4c77={'include':[{'model':db[_0xd2fe('0x3e')],'as':_0xd2fe('0x3f')}]},_0x51d7e0={},_0x28ce8e={'count':0x0,'rows':[]};var _0x1151e7=_[_0xd2fe('0x40')](db[_0xd2fe('0x41')][_0xd2fe('0x42')],function(_0x5ab682){return{'name':_0x5ab682[_0xd2fe('0x43')],'type':_0x5ab682[_0xd2fe('0x44')]['key']};});_0x51d7e0[_0xd2fe('0x45')]=_[_0xd2fe('0x40')](_0x1151e7,_0xd2fe('0x3c'));_0x51d7e0[_0xd2fe('0x46')]=_['keys'](_0x135829[_0xd2fe('0x46')]);_0x51d7e0[_0xd2fe('0x47')]=_[_0xd2fe('0x48')](_0x51d7e0[_0xd2fe('0x45')],_0x51d7e0['query']);_0x4c4c77[_0xd2fe('0x49')]=_[_0xd2fe('0x48')](_0x51d7e0[_0xd2fe('0x45')],qs['fields'](_0x135829[_0xd2fe('0x46')][_0xd2fe('0x4a')]));_0x4c4c77[_0xd2fe('0x49')]=_0x4c4c77['attributes'][_0xd2fe('0x4b')]?_0x4c4c77[_0xd2fe('0x49')]:_0x51d7e0['model'];if(!_0x135829['query']['hasOwnProperty'](_0xd2fe('0x4c'))){_0x4c4c77[_0xd2fe('0x31')]=qs['limit'](_0x135829[_0xd2fe('0x46')][_0xd2fe('0x31')]);_0x4c4c77[_0xd2fe('0x30')]=qs['offset'](_0x135829[_0xd2fe('0x46')][_0xd2fe('0x30')]);}_0x4c4c77[_0xd2fe('0x4d')]=qs[_0xd2fe('0x4e')](_0x135829[_0xd2fe('0x46')][_0xd2fe('0x4e')]);_0x4c4c77[_0xd2fe('0x4f')]=qs['filters'](_[_0xd2fe('0x50')](_0x135829[_0xd2fe('0x46')],_0x51d7e0[_0xd2fe('0x47')]),_0x1151e7);if(_0x135829[_0xd2fe('0x46')][_0xd2fe('0x51')]){_0x4c4c77['where']=_['merge'](_0x4c4c77[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x1151e7,function(_0x3a2615){if(_0x3a2615['type']!=='VIRTUAL'){var _0xc09227={};_0xc09227[_0x3a2615[_0xd2fe('0x3c')]]={'$like':'%'+_0x135829[_0xd2fe('0x46')][_0xd2fe('0x51')]+'%'};return _0xc09227;}})});}_0x4c4c77=_[_0xd2fe('0x52')]({},_0x4c4c77,_0x135829[_0xd2fe('0x53')]);var _0x377e88={'where':_0x4c4c77[_0xd2fe('0x4f')]};return db[_0xd2fe('0x41')][_0xd2fe('0x33')](_0x377e88)[_0xd2fe('0x21')](function(_0x598d51){_0x28ce8e[_0xd2fe('0x33')]=_0x598d51;if(_0x135829[_0xd2fe('0x46')][_0xd2fe('0x54')]){_0x4c4c77['include']=[{'all':!![]}];}return db[_0xd2fe('0x41')]['findAll'](_0x4c4c77);})['then'](function(_0x2238be){_0x28ce8e['rows']=_0x2238be;return _0x28ce8e;})[_0xd2fe('0x21')](respondWithFilteredResult(_0x2346c6,_0x4c4c77))['catch'](handleError(_0x2346c6,null));};exports[_0xd2fe('0x55')]=function(_0x5a54ab,_0x297666){var _0x25ff06={'raw':![],'where':{'id':_0x5a54ab['params']['id']},'include':[{'model':db[_0xd2fe('0x3e')],'as':_0xd2fe('0x3f')}]},_0x516996={};_0x516996['model']=_[_0xd2fe('0x56')](db[_0xd2fe('0x41')][_0xd2fe('0x42')]);_0x516996['query']=_['keys'](_0x5a54ab['query']);_0x516996[_0xd2fe('0x47')]=_['intersection'](_0x516996[_0xd2fe('0x45')],_0x516996[_0xd2fe('0x46')]);_0x25ff06[_0xd2fe('0x49')]=_[_0xd2fe('0x48')](_0x516996[_0xd2fe('0x45')],qs['fields'](_0x5a54ab[_0xd2fe('0x46')][_0xd2fe('0x4a')]));_0x25ff06['attributes']=_0x25ff06[_0xd2fe('0x49')][_0xd2fe('0x4b')]?_0x25ff06['attributes']:_0x516996[_0xd2fe('0x45')];if(_0x5a54ab[_0xd2fe('0x46')][_0xd2fe('0x54')]){_0x25ff06[_0xd2fe('0x57')]=[{'all':!![]}];}_0x25ff06=_['merge']({},_0x25ff06,_0x5a54ab['options']);return db[_0xd2fe('0x41')][_0xd2fe('0x58')](_0x25ff06)[_0xd2fe('0x21')](handleEntityNotFound(_0x297666,null))['then'](respondWithResult(_0x297666,null))[_0xd2fe('0x2b')](handleError(_0x297666,null));};exports['create']=function(_0x3a3566,_0x4fae03){return db[_0xd2fe('0x41')]['create'](_0x3a3566[_0xd2fe('0x59')],{})[_0xd2fe('0x21')](function(_0x46d41c){var _0x54b5c0=_0x3a3566[_0xd2fe('0x5a')]['get']({'plain':!![]});if(!_0x54b5c0)throw new Error(_0xd2fe('0x5b'));if(_0x54b5c0[_0xd2fe('0x5c')]===_0xd2fe('0x5a')){var _0x24eb5a=_0x46d41c['get']({'plain':!![]});var _0x217192='OpenchannelAccounts';return db[_0xd2fe('0x5d')][_0xd2fe('0x58')]({'where':{'name':_0x217192,'userProfileId':_0x54b5c0[_0xd2fe('0x5e')]},'raw':!![]})[_0xd2fe('0x21')](function(_0x2574bc){if(_0x2574bc&&_0x2574bc[_0xd2fe('0x5f')]===0x0){return db['UserProfileResource'][_0xd2fe('0x60')]({'name':_0x24eb5a[_0xd2fe('0x3c')],'resourceId':_0x24eb5a['id'],'type':_0x2574bc['name'],'sectionId':_0x2574bc['id']},{})['then'](function(){return _0x46d41c;});}else{return _0x46d41c;}})[_0xd2fe('0x2b')](function(_0x4b3fe0){logger[_0xd2fe('0x27')](_0xd2fe('0x61'),_0x4b3fe0);throw _0x4b3fe0;});}return _0x46d41c;})[_0xd2fe('0x21')](respondWithResult(_0x4fae03,0xc9))[_0xd2fe('0x2b')](handleError(_0x4fae03,null));};exports[_0xd2fe('0x38')]=function(_0x4a9348,_0xf614d1){if(_0x4a9348['body']['id']){delete _0x4a9348['body']['id'];}return db[_0xd2fe('0x41')][_0xd2fe('0x58')]({'where':{'id':_0x4a9348['params']['id']},'include':[{'model':db['Pause'],'as':_0xd2fe('0x3f')}]})[_0xd2fe('0x21')](handleEntityNotFound(_0xf614d1,null))[_0xd2fe('0x21')](saveUpdates(_0x4a9348[_0xd2fe('0x59')],null))[_0xd2fe('0x21')](respondWithResult(_0xf614d1,null))[_0xd2fe('0x2b')](handleError(_0xf614d1,null));};exports['destroy']=function(_0x1f569b,_0x19011d){return db[_0xd2fe('0x41')][_0xd2fe('0x58')]({'where':{'id':_0x1f569b[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x19011d,null))[_0xd2fe('0x21')](removeEntity(_0x19011d,null))[_0xd2fe('0x2b')](handleError(_0x19011d,null));};exports['describe']=function(_0x5623a2,_0x187951){return db[_0xd2fe('0x41')][_0xd2fe('0x63')]()[_0xd2fe('0x21')](respondWithResult(_0x187951,null))[_0xd2fe('0x2b')](handleError(_0x187951,null));};exports['addDisposition']=function(_0x42cb83,_0xdf98a9,_0xa13fe){if(_0x42cb83['body']['id']){delete _0x42cb83[_0xd2fe('0x59')]['id'];}return db['OpenchannelAccount'][_0xd2fe('0x58')]({'where':{'id':_0x42cb83['params']['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0xdf98a9,null))[_0xd2fe('0x21')](function(_0x26ab69){if(_0x26ab69){_0x42cb83[_0xd2fe('0x59')][_0xd2fe('0x64')]=_0x26ab69['id'];return db[_0xd2fe('0x65')]['create'](_0x42cb83[_0xd2fe('0x59')]);}})[_0xd2fe('0x21')](respondWithResult(_0xdf98a9,null))[_0xd2fe('0x2b')](handleError(_0xdf98a9,null));};exports['getDispositions']=function(_0x18f902,_0x5ecc10,_0x43c3d6){var _0x5eb1f5={'raw':![],'where':{}};var _0x48a568={};var _0x28fa56={'count':0x0,'rows':[]};return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0x18f902[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x5ecc10,null))[_0xd2fe('0x21')](function(_0x47f60f){if(_0x47f60f){_0x48a568[_0xd2fe('0x45')]=_[_0xd2fe('0x56')](db[_0xd2fe('0x65')][_0xd2fe('0x42')]);_0x48a568[_0xd2fe('0x46')]=_[_0xd2fe('0x56')](_0x18f902[_0xd2fe('0x46')]);_0x48a568[_0xd2fe('0x47')]=_['intersection'](_0x48a568[_0xd2fe('0x45')],_0x48a568[_0xd2fe('0x46')]);_0x5eb1f5['attributes']=_['intersection'](_0x48a568['model'],qs[_0xd2fe('0x4a')](_0x18f902[_0xd2fe('0x46')][_0xd2fe('0x4a')]));_0x5eb1f5[_0xd2fe('0x49')]=_0x5eb1f5['attributes'][_0xd2fe('0x4b')]?_0x5eb1f5['attributes']:_0x48a568['model'];if(!_0x18f902[_0xd2fe('0x46')]['hasOwnProperty'](_0xd2fe('0x4c'))){_0x5eb1f5[_0xd2fe('0x31')]=qs[_0xd2fe('0x31')](_0x18f902[_0xd2fe('0x46')]['limit']);_0x5eb1f5[_0xd2fe('0x30')]=qs[_0xd2fe('0x30')](_0x18f902[_0xd2fe('0x46')][_0xd2fe('0x30')]);}_0x5eb1f5[_0xd2fe('0x4d')]=qs[_0xd2fe('0x4e')](_0x18f902['query']['sort']);_0x5eb1f5[_0xd2fe('0x4f')]=qs[_0xd2fe('0x47')](_[_0xd2fe('0x50')](_0x18f902[_0xd2fe('0x46')],_0x48a568['filters']));_0x5eb1f5[_0xd2fe('0x4f')][_0xd2fe('0x64')]=_0x47f60f['id'];if(_0x18f902['query']['filter']){_0x5eb1f5[_0xd2fe('0x4f')]=_[_0xd2fe('0x52')](_0x5eb1f5[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x5eb1f5[_0xd2fe('0x49')],function(_0x1c3107){var _0x41d0f8={};_0x41d0f8[_0x1c3107]={'$like':'%'+_0x18f902[_0xd2fe('0x46')]['filter']+'%'};return _0x41d0f8;})});}_0x5eb1f5=_[_0xd2fe('0x52')]({},_0x5eb1f5,_0x18f902[_0xd2fe('0x53')]);return db['Disposition'][_0xd2fe('0x33')]({'where':_0x5eb1f5['where']})['then'](function(_0x59b6e6){_0x28fa56[_0xd2fe('0x33')]=_0x59b6e6;if(_0x18f902['query'][_0xd2fe('0x54')]){_0x5eb1f5[_0xd2fe('0x57')]=[{'all':!![]}];}return db[_0xd2fe('0x65')][_0xd2fe('0x67')](_0x5eb1f5);})[_0xd2fe('0x21')](function(_0x4c32f7){_0x28fa56[_0xd2fe('0x68')]=_0x4c32f7;return _0x28fa56;});}})[_0xd2fe('0x21')](respondWithFilteredResult(_0x5ecc10,_0x5eb1f5))[_0xd2fe('0x2b')](handleError(_0x5ecc10,null));};exports[_0xd2fe('0x69')]=function(_0x351e99,_0x1651a0,_0x1f06a3){return db['OpenchannelAccount'][_0xd2fe('0x58')]({'where':{'id':_0x351e99['params']['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x1651a0,null))[_0xd2fe('0x21')](function(_0x803450){if(_0x803450){return _0x803450[_0xd2fe('0x69')](_0x351e99['query'][_0xd2fe('0x6a')]);}})[_0xd2fe('0x21')](respondWithStatusCode(_0x1651a0,null))[_0xd2fe('0x2b')](handleError(_0x1651a0,null));};exports[_0xd2fe('0x6b')]=function(_0x578d24,_0x341612,_0x872048){if(_0x578d24[_0xd2fe('0x59')]['id']){delete _0x578d24[_0xd2fe('0x59')]['id'];}return db[_0xd2fe('0x41')][_0xd2fe('0x58')]({'where':{'id':_0x578d24[_0xd2fe('0x62')]['id']}})['then'](handleEntityNotFound(_0x341612,null))['then'](function(_0x372ebd){if(_0x372ebd){_0x578d24[_0xd2fe('0x59')][_0xd2fe('0x64')]=_0x372ebd['id'];return db[_0xd2fe('0x6c')][_0xd2fe('0x60')](_0x578d24[_0xd2fe('0x59')]);}})[_0xd2fe('0x21')](respondWithResult(_0x341612,null))[_0xd2fe('0x2b')](handleError(_0x341612,null));};exports[_0xd2fe('0x6d')]=function(_0x2b6077,_0x35687b,_0x2433bb){var _0x39b6ac={'raw':![],'where':{}};var _0x26b0a7={};var _0x2add95={'count':0x0,'rows':[]};return db[_0xd2fe('0x41')]['findOne']({'where':{'id':_0x2b6077[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x35687b,null))[_0xd2fe('0x21')](function(_0x48f49a){if(_0x48f49a){_0x26b0a7[_0xd2fe('0x45')]=_[_0xd2fe('0x56')](db[_0xd2fe('0x6c')]['rawAttributes']);_0x26b0a7[_0xd2fe('0x46')]=_[_0xd2fe('0x56')](_0x2b6077[_0xd2fe('0x46')]);_0x26b0a7['filters']=_[_0xd2fe('0x48')](_0x26b0a7[_0xd2fe('0x45')],_0x26b0a7[_0xd2fe('0x46')]);_0x39b6ac[_0xd2fe('0x49')]=_['intersection'](_0x26b0a7[_0xd2fe('0x45')],qs[_0xd2fe('0x4a')](_0x2b6077[_0xd2fe('0x46')][_0xd2fe('0x4a')]));_0x39b6ac['attributes']=_0x39b6ac[_0xd2fe('0x49')][_0xd2fe('0x4b')]?_0x39b6ac[_0xd2fe('0x49')]:_0x26b0a7[_0xd2fe('0x45')];if(!_0x2b6077['query']['hasOwnProperty'](_0xd2fe('0x4c'))){_0x39b6ac[_0xd2fe('0x31')]=qs[_0xd2fe('0x31')](_0x2b6077[_0xd2fe('0x46')][_0xd2fe('0x31')]);_0x39b6ac[_0xd2fe('0x30')]=qs[_0xd2fe('0x30')](_0x2b6077[_0xd2fe('0x46')][_0xd2fe('0x30')]);}_0x39b6ac[_0xd2fe('0x4d')]=qs['sort'](_0x2b6077[_0xd2fe('0x46')]['sort']);_0x39b6ac[_0xd2fe('0x4f')]=qs[_0xd2fe('0x47')](_[_0xd2fe('0x50')](_0x2b6077[_0xd2fe('0x46')],_0x26b0a7[_0xd2fe('0x47')]));_0x39b6ac[_0xd2fe('0x4f')]['OpenchannelAccountId']=_0x48f49a['id'];if(_0x2b6077['query']['filter']){_0x39b6ac['where']=_[_0xd2fe('0x52')](_0x39b6ac[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x39b6ac[_0xd2fe('0x49')],function(_0x53d674){var _0x1fca4a={};_0x1fca4a[_0x53d674]={'$like':'%'+_0x2b6077[_0xd2fe('0x46')]['filter']+'%'};return _0x1fca4a;})});}_0x39b6ac=_[_0xd2fe('0x52')]({},_0x39b6ac,_0x2b6077['options']);return db[_0xd2fe('0x6c')][_0xd2fe('0x33')]({'where':_0x39b6ac[_0xd2fe('0x4f')]})[_0xd2fe('0x21')](function(_0x5957e3){_0x2add95[_0xd2fe('0x33')]=_0x5957e3;if(_0x2b6077[_0xd2fe('0x46')][_0xd2fe('0x54')]){_0x39b6ac[_0xd2fe('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd2fe('0x67')](_0x39b6ac);})[_0xd2fe('0x21')](function(_0x483f14){_0x2add95[_0xd2fe('0x68')]=_0x483f14;return _0x2add95;});}})[_0xd2fe('0x21')](respondWithFilteredResult(_0x35687b,_0x39b6ac))[_0xd2fe('0x2b')](handleError(_0x35687b,null));};exports[_0xd2fe('0x6e')]=function(_0x2c79b5,_0xff41d6,_0x3ba677){return db[_0xd2fe('0x41')]['find']({'where':{'id':_0x2c79b5[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0xff41d6,null))[_0xd2fe('0x21')](function(_0x30b1a0){if(_0x30b1a0){return _0x30b1a0['removeAnswers'](_0x2c79b5['query'][_0xd2fe('0x6a')]);}})[_0xd2fe('0x21')](respondWithStatusCode(_0xff41d6,null))['catch'](handleError(_0xff41d6,null));};exports[_0xd2fe('0x6f')]=function(_0x59ceea,_0x36dd8c,_0x54578c){var _0x6be4b3={'body':_0x59ceea[_0xd2fe('0x59')],'channel':_0xd2fe('0x70')};var _0xc4a458=[];var _0x491fa6=[];var _0x3820f9={};var _0x52b92=![];return db['CmContact']['describe']()[_0xd2fe('0x21')](function(_0x48a020){if(!_0x48a020){throw new db[(_0xd2fe('0x71'))][(_0xd2fe('0x72'))](_0xd2fe('0x73'));}_0xc4a458=_['difference'](_[_0xd2fe('0x56')](_0x48a020),[_0xd2fe('0x74'),_0xd2fe('0x75')]);_0x491fa6=_['difference'](_[_0xd2fe('0x56')](_0x48a020),[_0xd2fe('0x74'),'updatedAt',_0xd2fe('0x76'),_0xd2fe('0x77')]);if(_0x59ceea[_0xd2fe('0x59')]['id']){delete _0x59ceea[_0xd2fe('0x59')]['id'];}if(_[_0xd2fe('0x78')](_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x79')])){throw new db[(_0xd2fe('0x71'))][(_0xd2fe('0x72'))](_0xd2fe('0x7a'));}if(_[_0xd2fe('0x78')](_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x59')])||_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x59')]===''){throw new db[(_0xd2fe('0x71'))][(_0xd2fe('0x72'))](_0xd2fe('0x7b'));}if(_[_0xd2fe('0x78')](_0x59ceea[_0xd2fe('0x59')]['mapKey'])){throw new db[(_0xd2fe('0x71'))][(_0xd2fe('0x72'))](_0xd2fe('0x7c')+_0x491fa6);}if(!_[_0xd2fe('0x7d')](_0x491fa6,_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x7e')])){throw new db[(_0xd2fe('0x71'))]['ValidationError'](_0xd2fe('0x7f')+_0x491fa6);}_0x3820f9[_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x7e')]]=_0x59ceea['body'][_0xd2fe('0x79')];})['then'](function(){return db['OpenchannelAccount'][_0xd2fe('0x58')]({'where':{'id':_0x59ceea[_0xd2fe('0x62')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd2fe('0x80')],'as':'Contacts','where':_0x3820f9,'limit':0x1,'order':[[_0xd2fe('0x75'),'DESC']]}]},{'model':db[_0xd2fe('0x81')],'as':_0xd2fe('0x82')}]});})[_0xd2fe('0x21')](handleEntityNotFound(_0x36dd8c,null))[_0xd2fe('0x21')](function(_0xeec3b2){if(_0xeec3b2&&_0xeec3b2['List']){_0x6be4b3['account']=_0xeec3b2;_0x6be4b3[_0xd2fe('0x83')]=_0xeec3b2[_0xd2fe('0x82')];_0x6be4b3[_0xd2fe('0x84')]=_0xeec3b2['List'];_0x6be4b3[_0xd2fe('0x83')]=_[_0xd2fe('0x85')](_0x6be4b3[_0xd2fe('0x83')],['priority'],['asc']);if(_0x6be4b3['account']['Applications']){delete _0x6be4b3[_0xd2fe('0x86')][_0xd2fe('0x82')];}if(_0x6be4b3[_0xd2fe('0x86')][_0xd2fe('0x87')]&&_0x6be4b3[_0xd2fe('0x86')][_0xd2fe('0x87')]['Contacts'][_0xd2fe('0x4b')]){return _0x6be4b3[_0xd2fe('0x86')][_0xd2fe('0x87')][_0xd2fe('0x88')][0x0];}var _0x409932=_[_0xd2fe('0x1c')](_0x59ceea['body'],{'firstName':_0x59ceea[_0xd2fe('0x59')]['from'],'ListId':_0xeec3b2['ListId']});_0x409932[_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x7e')]]=_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x79')];return db['CmContact'][_0xd2fe('0x60')](_0x409932,{'fields':_0xc4a458,'raw':!![]});}})[_0xd2fe('0x21')](handleEntityNotFound(_0x36dd8c,null))[_0xd2fe('0x21')](function(_0x2dceab){_0x6be4b3['contact']=_0x2dceab;if(_0x2dceab){var _0x67f14f={'ContactId':_0x2dceab['id'],'OpenchannelAccountId':_0x59ceea[_0xd2fe('0x62')]['id'],'from':(_0x2dceab['firstName']||'')+'\x20'+(_0x2dceab[_0xd2fe('0x89')]||'')};var _0x4e0ba2={'OpenchannelAccountId':_0x59ceea[_0xd2fe('0x62')]['id'],'closed':![]};if(_0x59ceea[_0xd2fe('0x59')]['threadId']){_0x4e0ba2[_0xd2fe('0x8a')]=_0x59ceea['body']['threadId'];return db[_0xd2fe('0x8b')][_0xd2fe('0x58')]({'where':_0x4e0ba2})['then'](function(_0x1c3c82){if(_0x1c3c82){return[_0x1c3c82,![]];}_0x67f14f[_0xd2fe('0x8a')]=_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x8a')];_0x67f14f['externalUrl']=_0x59ceea['body']['externalUrl'];return db[_0xd2fe('0x8b')][_0xd2fe('0x60')](_0x67f14f)[_0xd2fe('0x21')](function(_0x211f3d){return[_0x211f3d,!![]];});});}else{_0x4e0ba2[_0xd2fe('0x8a')]=null;}_0x4e0ba2[_0xd2fe('0x8c')]=_0x2dceab['id'];return db[_0xd2fe('0x8b')][_0xd2fe('0x58')]({'where':_0x4e0ba2})[_0xd2fe('0x21')](function(_0x3e09da){if(_0x3e09da){return[_0x3e09da,![]];}return db[_0xd2fe('0x8b')][_0xd2fe('0x60')](_0x67f14f)[_0xd2fe('0x21')](function(_0x354f75){return[_0x354f75,!![]];});});}})[_0xd2fe('0x8d')](function(_0x396460,_0x140657){if(_0x396460){_0x52b92=_0x140657;if(!_0x140657){var _0x3a0bf4={'from':(_0x6be4b3['contact'][_0xd2fe('0x8e')]||'')+'\x20'+(_0x6be4b3[_0xd2fe('0x8f')][_0xd2fe('0x89')]||'')};if(_0x59ceea[_0xd2fe('0x59')]['threadId']&&_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x90')]&&_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x8a')]!=_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x90')]){_0x3a0bf4[_0xd2fe('0x8a')]=_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x90')];}return _0x396460['update'](_0x3a0bf4);}else{return _0x396460;}}})[_0xd2fe('0x21')](function(_0x3dfc3d){_0x6be4b3['interaction']=_0x3dfc3d[_0xd2fe('0x91')]({'plain':!![]});_0x6be4b3[_0xd2fe('0x92')][_0xd2fe('0x93')]=_0x52b92;if(_0x6be4b3[_0xd2fe('0x92')][_0xd2fe('0x93')]){if(_0x6be4b3[_0xd2fe('0x86')][_0xd2fe('0x94')]){_0x6be4b3[_0xd2fe('0x83')][_0xd2fe('0x95')]({'id':0x0,'priority':_0x6be4b3['applications'][_0xd2fe('0x4b')]+0x1,'app':_0xd2fe('0x96'),'appdata':_0xd2fe('0x97'),'interval':_0xd2fe('0x98')});}}return db[_0xd2fe('0x99')][_0xd2fe('0x60')]({'body':_0x59ceea['body']['body'],'OpenchannelAccountId':_0x59ceea[_0xd2fe('0x62')]['id'],'OpenchannelInteractionId':_0x3dfc3d['id'],'direction':'in','ContactId':_0x6be4b3[_0xd2fe('0x8f')]['id'],'AttachmentId':_0x59ceea[_0xd2fe('0x59')][_0xd2fe('0x9a')]});})[_0xd2fe('0x21')](function(_0x28f4e8){_0x6be4b3['message']=_0x28f4e8;if(_0x6be4b3[_0xd2fe('0x92')][_0xd2fe('0x9b')]){return db[_0xd2fe('0x9c')][_0xd2fe('0x58')]({'attributes':['id',_0xd2fe('0x3c')],'where':{'id':_0x6be4b3[_0xd2fe('0x92')][_0xd2fe('0x9b')]}})[_0xd2fe('0x21')](function(_0x6e16fd){if(_0x6e16fd){_0x6be4b3['applications'][_0xd2fe('0x9d')]({'id':0x0,'priority':0x0,'app':_0xd2fe('0x9e'),'appdata':_0x6e16fd[_0xd2fe('0x3c')]+','+(_0x6be4b3[_0xd2fe('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0xd2fe('0x98')});_0x6be4b3[_0xd2fe('0x9f')]=![];}return respondWithRpcPromise('Start',_0xd2fe('0xa0'),_0x6be4b3);});}return respondWithRpcPromise(_0xd2fe('0xa1'),_0xd2fe('0xa0'),_0x6be4b3);})[_0xd2fe('0x21')](function(_0x1f0ba2){respondWithRpcPromise(_0xd2fe('0xa2'),_0xd2fe('0xa2'),{'event':_0xd2fe('0x6f'),'message':_0x1f0ba2},client9002);return _0x1f0ba2;})['then'](respondWithResult(_0x36dd8c,null))[_0xd2fe('0x2b')](handleError(_0x36dd8c,null));};exports[_0xd2fe('0xa3')]=function(_0x57c406,_0x46d902){var _0xb5fea0=_0x57c406[_0xd2fe('0x62')]['id'];var _0x3522bf=_0x57c406[_0xd2fe('0x59')];var _0x2fa064=0xc8;var _0x5b296a=null;return db['sequelize'][_0xd2fe('0xa4')]({'isolationLevel':db[_0xd2fe('0xa5')][_0xd2fe('0xa6')]['ISOLATION_LEVELS'][_0xd2fe('0xa7')]},function(_0x174ef3){return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0xb5fea0},'transaction':_0x174ef3})[_0xd2fe('0x21')](function(_0x500092){if(_0x500092){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0xb5fea0},'transaction':_0x174ef3})['then'](function(){var _0x412d41=_[_0xd2fe('0x40')](_0x3522bf,function(_0x599696){_0x599696[_0xd2fe('0x64')]=_0xb5fea0;return _0x599696;});return db['OpenchannelApplication'][_0xd2fe('0xa8')](_0x412d41,{'transaction':_0x174ef3});});}else{_0x2fa064=0x194;_0x5b296a=[];}});})[_0xd2fe('0x21')](function(){if(_0x2fa064!==0x194){return db[_0xd2fe('0x81')][_0xd2fe('0xa9')]({'where':{'OpenchannelAccountId':_0xb5fea0},'order':'priority'})['then'](function(_0x326230){_0x5b296a=_0x326230;});}})[_0xd2fe('0x2b')](function(_0x3a9604){_0x2fa064=0x1f4;logger['error'](_0x3a9604[_0xd2fe('0x3b')]);if(_0x3a9604['name']){delete _0x3a9604[_0xd2fe('0x3c')];}_0x5b296a=_0x3a9604;})[_0xd2fe('0xaa')](function(){if(_0x5b296a===null){_0x46d902[_0xd2fe('0x2c')](_0x2fa064);}else{if(_0x2fa064===0x1f4){_0x46d902[_0xd2fe('0x2d')](_0x2fa064)[_0xd2fe('0xab')](_0x5b296a);}else{_0x46d902[_0xd2fe('0x2d')](_0x2fa064)[_0xd2fe('0x2f')](_0x5b296a);}}});};exports[_0xd2fe('0xac')]=function(_0x4014e9,_0x4ede8a,_0x324caa){var _0x5a70c2={};var _0x412f3d={};var _0x3dd1ef;var _0x24c1a4;return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0x4014e9[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x4ede8a,null))[_0xd2fe('0x21')](function(_0x51cc6a){if(_0x51cc6a){_0x3dd1ef=_0x51cc6a;_0x412f3d['model']=_['keys'](db[_0xd2fe('0x81')][_0xd2fe('0x42')]);_0x412f3d['query']=_[_0xd2fe('0x56')](_0x4014e9['query']);_0x412f3d[_0xd2fe('0x47')]=_[_0xd2fe('0x48')](_0x412f3d[_0xd2fe('0x45')],_0x412f3d['query']);_0x5a70c2[_0xd2fe('0x49')]=_[_0xd2fe('0x48')](_0x412f3d[_0xd2fe('0x45')],qs['fields'](_0x4014e9[_0xd2fe('0x46')][_0xd2fe('0x4a')]));_0x5a70c2[_0xd2fe('0x49')]=_0x5a70c2[_0xd2fe('0x49')]['length']?_0x5a70c2[_0xd2fe('0x49')]:_0x412f3d[_0xd2fe('0x45')];_0x5a70c2[_0xd2fe('0x4d')]=qs[_0xd2fe('0x4e')](_0x4014e9[_0xd2fe('0x46')][_0xd2fe('0x4e')]);_0x5a70c2['where']=qs[_0xd2fe('0x47')](_[_0xd2fe('0x50')](_0x4014e9['query'],_0x412f3d[_0xd2fe('0x47')]));if(_0x4014e9[_0xd2fe('0x46')][_0xd2fe('0x51')]){_0x5a70c2['where']=_[_0xd2fe('0x52')](_0x5a70c2[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x5a70c2[_0xd2fe('0x49')],function(_0x537d65){var _0x29c802={};_0x29c802[_0x537d65]={'$like':'%'+_0x4014e9['query'][_0xd2fe('0x51')]+'%'};return _0x29c802;})});}_0x5a70c2=_[_0xd2fe('0x52')]({},_0x5a70c2,_0x4014e9[_0xd2fe('0x53')]);return _0x3dd1ef[_0xd2fe('0xac')](_0x5a70c2);}})['then'](function(_0x2a4d8a){if(_0x2a4d8a){_0x24c1a4=_0x2a4d8a['length'];if(!_0x4014e9[_0xd2fe('0x46')][_0xd2fe('0xad')](_0xd2fe('0x4c'))){_0x5a70c2[_0xd2fe('0x31')]=qs[_0xd2fe('0x31')](_0x4014e9[_0xd2fe('0x46')][_0xd2fe('0x31')]);_0x5a70c2[_0xd2fe('0x30')]=qs[_0xd2fe('0x30')](_0x4014e9[_0xd2fe('0x46')]['offset']);}return _0x3dd1ef['getApplications'](_0x5a70c2);}})[_0xd2fe('0x21')](function(_0x4815cd){if(_0x4815cd){return _0x4815cd?{'count':_0x24c1a4,'rows':_0x4815cd}:null;}})[_0xd2fe('0x21')](respondWithResult(_0x4ede8a,null))[_0xd2fe('0x2b')](handleError(_0x4ede8a,null));};exports[_0xd2fe('0xae')]=function(_0x4e8a1c,_0x2a0612,_0x191b37){var _0x14f83a={'raw':![],'where':{}};var _0x1e6ae2={};var _0x206a3e={'count':0x0,'rows':[]};return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0x4e8a1c[_0xd2fe('0x62')]['id']}})['then'](handleEntityNotFound(_0x2a0612,null))[_0xd2fe('0x21')](function(_0x458d5e){if(_0x458d5e){_0x1e6ae2[_0xd2fe('0x45')]=_[_0xd2fe('0x56')](db[_0xd2fe('0x8b')][_0xd2fe('0x42')]);_0x1e6ae2['query']=_[_0xd2fe('0x56')](_0x4e8a1c['query']);_0x1e6ae2[_0xd2fe('0x47')]=_[_0xd2fe('0x48')](_0x1e6ae2['model'],_0x1e6ae2[_0xd2fe('0x46')]);_0x14f83a[_0xd2fe('0x49')]=_[_0xd2fe('0x48')](_0x1e6ae2['model'],qs[_0xd2fe('0x4a')](_0x4e8a1c[_0xd2fe('0x46')]['fields']));_0x14f83a['attributes']=_0x14f83a[_0xd2fe('0x49')][_0xd2fe('0x4b')]?_0x14f83a['attributes']:_0x1e6ae2[_0xd2fe('0x45')];if(!_0x4e8a1c['query']['hasOwnProperty'](_0xd2fe('0x4c'))){_0x14f83a[_0xd2fe('0x31')]=qs[_0xd2fe('0x31')](_0x4e8a1c['query'][_0xd2fe('0x31')]);_0x14f83a['offset']=qs[_0xd2fe('0x30')](_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0x30')]);}_0x14f83a['order']=qs[_0xd2fe('0x4e')](_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0x4e')]);_0x14f83a[_0xd2fe('0x4f')]=qs[_0xd2fe('0x47')](_[_0xd2fe('0x50')](_0x4e8a1c[_0xd2fe('0x46')],_0x1e6ae2[_0xd2fe('0x47')]));_0x14f83a['where']['OpenchannelAccountId']=_0x458d5e['id'];if(_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0x51')]){_0x14f83a[_0xd2fe('0x4f')]=_[_0xd2fe('0x52')](_0x14f83a[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x14f83a[_0xd2fe('0x49')],function(_0x1f8c82){var _0x24b008={};_0x24b008[_0x1f8c82]={'$like':'%'+_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0x51')]+'%'};return _0x24b008;})});}_0x14f83a=_[_0xd2fe('0x52')]({},_0x14f83a,_0x4e8a1c[_0xd2fe('0x53')]);return db[_0xd2fe('0x8b')][_0xd2fe('0x33')]({'where':_0x14f83a[_0xd2fe('0x4f')]})['then'](function(_0x37488c){_0x206a3e[_0xd2fe('0x33')]=_0x37488c;if(_0x4e8a1c['query']['includeAll']){_0x14f83a[_0xd2fe('0x57')]=[{'model':db[_0xd2fe('0x80')],'as':_0xd2fe('0xaf'),'required':![]},{'model':db[_0xd2fe('0x9c')],'as':_0xd2fe('0xb0'),'attributes':[_0xd2fe('0x3c'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd2fe('0x3c'),_0xd2fe('0xb1')],'where':_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0xb2')]?{'id':_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0xb2')]}:undefined,'required':_0x4e8a1c[_0xd2fe('0x46')][_0xd2fe('0xb2')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x14f83a);})[_0xd2fe('0x21')](function(_0x4f1675){_0x206a3e['rows']=_0x4f1675;return _0x206a3e;});}})[_0xd2fe('0x21')](respondWithFilteredResult(_0x2a0612,_0x14f83a))['catch'](handleError(_0x2a0612,null));};exports[_0xd2fe('0xb3')]=function(_0x392c8d,_0x2969a5,_0x45caa0){return db[_0xd2fe('0x41')][_0xd2fe('0x58')]({'where':{'id':_0x392c8d['params']['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x2969a5,null))[_0xd2fe('0x21')](function(_0x59d57f){if(_0x59d57f){return _0x59d57f[_0xd2fe('0xb3')](_0x392c8d[_0xd2fe('0x59')][_0xd2fe('0x6a')],_['omit'](_0x392c8d[_0xd2fe('0x59')],[_0xd2fe('0x6a'),'id'])||{})[_0xd2fe('0x8d')](function(_0x46d16e){for(var _0x58cf96=0x0;_0x58cf96<_0x392c8d[_0xd2fe('0x59')][_0xd2fe('0x6a')][_0xd2fe('0x4b')];_0x58cf96+=0x1){socket[_0xd2fe('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x392c8d[_0xd2fe('0x59')][_0xd2fe('0x6a')][_0x58cf96]),'OpenchannelAccountId':Number(_0x392c8d['params']['id'])});}return _0x46d16e;});}})[_0xd2fe('0x21')](respondWithResult(_0x2969a5,null))['catch'](handleError(_0x2969a5,null));};exports[_0xd2fe('0xb5')]=function(_0x40518e,_0x4a9513,_0x569bc8){return db[_0xd2fe('0x41')]['find']({'where':{'id':_0x40518e['params']['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x4a9513,null))[_0xd2fe('0x21')](function(_0x17f310){if(_0x17f310){return _0x17f310[_0xd2fe('0xb5')](_0x40518e[_0xd2fe('0x46')][_0xd2fe('0x6a')])[_0xd2fe('0x21')](function(){if(_[_0xd2fe('0xb6')](_0x40518e[_0xd2fe('0x46')][_0xd2fe('0x6a')])){for(var _0xa0dd20=0x0;_0xa0dd20<_0x40518e[_0xd2fe('0x46')][_0xd2fe('0x6a')]['length'];_0xa0dd20+=0x1){socket[_0xd2fe('0xb4')](_0xd2fe('0xb7'),{'UserId':Number(_0x40518e['query'][_0xd2fe('0x6a')][_0xa0dd20]),'OpenchannelAccountId':Number(_0x40518e[_0xd2fe('0x62')]['id'])});}}else{socket['emit'](_0xd2fe('0xb7'),{'UserId':Number(_0x40518e[_0xd2fe('0x46')]['ids']),'OpenchannelAccountId':Number(_0x40518e[_0xd2fe('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a9513,null))[_0xd2fe('0x2b')](handleError(_0x4a9513,null));};exports[_0xd2fe('0xb8')]=function(_0xcbdf3f,_0x467c55,_0x2bae0b){var _0x3f2be7={};var _0x163926={};var _0x27732a;var _0x37b8c4;return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0xcbdf3f[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x467c55,null))[_0xd2fe('0x21')](function(_0x5acba2){if(_0x5acba2){_0x27732a=_0x5acba2;_0x163926['model']=_[_0xd2fe('0x56')](db[_0xd2fe('0x9c')][_0xd2fe('0x42')]);_0x163926[_0xd2fe('0x46')]=_[_0xd2fe('0x56')](_0xcbdf3f[_0xd2fe('0x46')]);_0x163926[_0xd2fe('0x47')]=_['intersection'](_0x163926[_0xd2fe('0x45')],_0x163926[_0xd2fe('0x46')]);_0x3f2be7[_0xd2fe('0x49')]=_[_0xd2fe('0x48')](_0x163926[_0xd2fe('0x45')],qs['fields'](_0xcbdf3f['query'][_0xd2fe('0x4a')]));_0x3f2be7[_0xd2fe('0x49')]=_0x3f2be7[_0xd2fe('0x49')][_0xd2fe('0x4b')]?_0x3f2be7[_0xd2fe('0x49')]:_0x163926[_0xd2fe('0x45')];_0x3f2be7[_0xd2fe('0x4d')]=qs[_0xd2fe('0x4e')](_0xcbdf3f['query']['sort']);_0x3f2be7[_0xd2fe('0x4f')]=qs[_0xd2fe('0x47')](_[_0xd2fe('0x50')](_0xcbdf3f[_0xd2fe('0x46')],_0x163926[_0xd2fe('0x47')]));if(_0xcbdf3f[_0xd2fe('0x46')][_0xd2fe('0x51')]){_0x3f2be7[_0xd2fe('0x4f')]=_['merge'](_0x3f2be7[_0xd2fe('0x4f')],{'$or':_[_0xd2fe('0x40')](_0x3f2be7[_0xd2fe('0x49')],function(_0x24a09d){var _0x4ebef7={};_0x4ebef7[_0x24a09d]={'$like':'%'+_0xcbdf3f[_0xd2fe('0x46')][_0xd2fe('0x51')]+'%'};return _0x4ebef7;})});}_0x3f2be7=_['merge']({},_0x3f2be7,_0xcbdf3f[_0xd2fe('0x53')]);return _0x27732a['getAgents'](_0x3f2be7);}})['then'](function(_0x2ed110){if(_0x2ed110){_0x37b8c4=_0x2ed110['length'];if(!_0xcbdf3f[_0xd2fe('0x46')][_0xd2fe('0xad')](_0xd2fe('0x4c'))){_0x3f2be7['limit']=qs[_0xd2fe('0x31')](_0xcbdf3f[_0xd2fe('0x46')]['limit']);_0x3f2be7[_0xd2fe('0x30')]=qs[_0xd2fe('0x30')](_0xcbdf3f[_0xd2fe('0x46')][_0xd2fe('0x30')]);}return _0x27732a[_0xd2fe('0xb8')](_0x3f2be7);}})[_0xd2fe('0x21')](function(_0x45200e){if(_0x45200e){return _0x45200e?{'count':_0x37b8c4,'rows':_0x45200e}:null;}})['then'](respondWithResult(_0x467c55,null))[_0xd2fe('0x2b')](handleError(_0x467c55,null));};exports[_0xd2fe('0xab')]=function(_0x3ed882,_0x45bfba,_0x29e095){var _0x32ad0f,_0x452f84,_0x1e1b97;if(_[_0xd2fe('0x78')](_0x3ed882['body'][_0xd2fe('0x59')])||_0x3ed882[_0xd2fe('0x59')][_0xd2fe('0x59')]===''){throw new db[(_0xd2fe('0x71'))][(_0xd2fe('0x72'))](_0xd2fe('0x7b'));}if(_[_0xd2fe('0x78')](_0x3ed882[_0xd2fe('0x59')]['to'])){}_0x32ad0f=_0x3ed882[_0xd2fe('0x59')]['to'];return db[_0xd2fe('0x41')][_0xd2fe('0x66')]({'where':{'id':_0x3ed882[_0xd2fe('0x62')]['id']}})[_0xd2fe('0x21')](handleEntityNotFound(_0x45bfba,null))[_0xd2fe('0x21')](function(_0x105b7d){if(_0x105b7d){return db[_0xd2fe('0x41')][_0xd2fe('0x58')]({'where':{'id':_0x105b7d['id']},'include':[{'model':db[_0xd2fe('0xb9')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd2fe('0x88'),'where':{[_0x105b7d[_0xd2fe('0x7e')]]:_0x32ad0f},'limit':0x1,'order':[[_0xd2fe('0x75'),_0xd2fe('0xba')]]}]}]})[_0xd2fe('0x21')](handleEntityNotFound(_0x45bfba,null))[_0xd2fe('0x21')](function(_0x15c65b){if(_0x15c65b&&_0x15c65b[_0xd2fe('0x87')]){_0x452f84=_0x15c65b['get']({'plain':!![]});if(_0x452f84[_0xd2fe('0x87')]&&_0x452f84[_0xd2fe('0x87')][_0xd2fe('0x88')][_0xd2fe('0x4b')]){return _0x452f84[_0xd2fe('0x87')]['Contacts'][0x0];}return db[_0xd2fe('0x80')][_0xd2fe('0x60')](_[_0xd2fe('0x1c')](_0x3ed882[_0xd2fe('0x59')],{'firstName':_0x32ad0f,[_0x15c65b[_0xd2fe('0x7e')]]:_0x32ad0f,'phone':_0x32ad0f,'ListId':_0x452f84[_0xd2fe('0x77')]}));}})['then'](handleEntityNotFound(_0x45bfba,null))[_0xd2fe('0x21')](function(_0xbba044){if(_0xbba044){_0x1e1b97=_0xbba044;return db[_0xd2fe('0x8b')][_0xd2fe('0x58')]({'where':{'ContactId':_0x1e1b97['id'],'closed':![],'OpenchannelAccountId':_0x452f84['id']}})['then'](function(_0x3eb54f){if(_0x3eb54f){return[_0x3eb54f,![]];}return db[_0xd2fe('0x8b')][_0xd2fe('0x60')]({'UserId':_0x3ed882[_0xd2fe('0x5a')]['id'],'ContactId':_0x1e1b97['id'],'OpenchannelAccountId':_0x452f84['id'],'lastMsgDirection':'out','firstMsgDirection':_0xd2fe('0xbb'),'Messages':[_[_0xd2fe('0x52')](_0x3ed882[_0xd2fe('0x59')],{'read':![],'body':_0x3ed882['body'][_0xd2fe('0x59')],'OpenchannelAccountId':_0x452f84['id'],'UserId':_0x3ed882[_0xd2fe('0x5a')]['id'],'ContactId':_0x1e1b97['id']})]},{'include':[{'model':db[_0xd2fe('0x99')],'as':'Messages'}]})['then'](function(_0x30bf8f){return[_0x30bf8f,!![]];});});}})[_0xd2fe('0x8d')](function(_0x5c8aa6,_0xa07f05){if(_0xa07f05){return _0x5c8aa6;}return db[_0xd2fe('0x99')][_0xd2fe('0x60')](_[_0xd2fe('0x52')](_0x3ed882[_0xd2fe('0x59')],{'read':![],'body':_0x3ed882[_0xd2fe('0x59')][_0xd2fe('0x59')],'OpenchannelAccountId':_0x452f84['id'],'OpenchannelInteractionId':_0x5c8aa6['id'],'UserId':_0x3ed882[_0xd2fe('0x5a')]['id'],'ContactId':_0x1e1b97['id']}))[_0xd2fe('0x21')](function(_0x5b0d9b){_0x5c8aa6[_0xd2fe('0xbc')]['Messages']=[];_0x5c8aa6['dataValues']['Messages']['push'](_0x5b0d9b['dataValues']);return _0x5c8aa6;});});}})['then'](respondWithResult(_0x45bfba,null))[_0xd2fe('0x2b')](handleError(_0x45bfba,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 12b1c48..bb5c827 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 _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4483,0x1a3));var _0x3448=function(_0x1e7776,_0x38f6ec){_0x1e7776=_0x1e7776-0x0;var _0x5c8641=_0x4483[_0x1e7776];return _0x5c8641;};'use strict';var EventEmitter=require(_0x3448('0x0'));var OpenchannelAccount=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb43b=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x323896,_0x2af13e){var _0x3e646f=function(_0x43b3f6){while(--_0x43b3f6){_0x323896['push'](_0x323896['shift']());}};_0x3e646f(++_0x2af13e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x349ece,_0x2ec443){_0x349ece=_0x349ece-0x0;var _0x1a0f15=_0xb43b[_0x349ece];return _0x1a0f15;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var OpenchannelAccount=require(_0xbb43('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb43('0x2')](0x0);var events={'afterCreate':_0xbb43('0x3'),'afterUpdate':_0xbb43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x131e9e){return function(_0x41aff6,_0x351254,_0x16432a){OpenchannelAccountEvents['emit'](_0x131e9e+':'+_0x41aff6['id'],_0x41aff6);OpenchannelAccountEvents['emit'](_0x131e9e,_0x41aff6);_0x16432a(null);};}for(var e in events){if(events[_0xbb43('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xbb43('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d4fac92..8efa0cc 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(_0x1115ed,_0x3dc0a0){var _0x4be0ac=function(_0x3a7057){while(--_0x3a7057){_0x1115ed['push'](_0x1115ed['shift']());}};_0x4be0ac(++_0x3dc0a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0xd6b915,_0x827258){var _0x4a467e=function(_0x514825){while(--_0x514825){_0xd6b915['push'](_0xd6b915['shift']());}};_0x4a467e(++_0x827258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 008bc8f..89d25bf 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 _0x6c76=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x6c76,0x184));var _0x66c7=function(_0x4fef7e,_0x12e0a5){_0x4fef7e=_0x4fef7e-0x0;var _0x37aa0a=_0x6c76[_0x4fef7e];return _0x37aa0a;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});config[_0x66c7('0x9')]=_['defaults'](config['redis'],{'host':_0x66c7('0xa'),'port':0x18eb});var socket=require(_0x66c7('0xb'))(new Redis(config[_0x66c7('0x9')]));require('./openchannelAccount.socket')[_0x66c7('0xc')](socket);function respondWithRpcPromise(_0xbc35d9,_0xf44e2,_0x2fff5e){return new BPromise(function(_0x492634,_0x464085){return client[_0x66c7('0xd')](_0xbc35d9,_0x2fff5e)[_0x66c7('0xe')](function(_0x187e00){logger[_0x66c7('0xf')](_0x66c7('0x10'),_0xf44e2,_0x66c7('0x11'));logger['debug'](_0x66c7('0x12'),_0xf44e2,_0x66c7('0x11'),JSON[_0x66c7('0x13')](_0x187e00));if(_0x187e00[_0x66c7('0x14')]){if(_0x187e00[_0x66c7('0x14')][_0x66c7('0x15')]===0x1f4){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')]['message']);return _0x464085(_0x187e00[_0x66c7('0x14')]['message']);}logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')][_0x66c7('0x16')]);return _0x492634(_0x187e00[_0x66c7('0x14')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xf44e2,'request\x20sent');_0x492634(_0x187e00[_0x66c7('0x17')][_0x66c7('0x16')]);}})['catch'](function(_0x524e87){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x524e87);_0x464085(_0x524e87);});});} \ No newline at end of file +var _0x073e=['../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/utils'];(function(_0x578e2a,_0x36f0fa){var _0x542ce4=function(_0x37ff32){while(--_0x37ff32){_0x578e2a['push'](_0x578e2a['shift']());}};_0x542ce4(++_0x36f0fa);}(_0x073e,0x181));var _0xe073=function(_0xb3beb1,_0x4a5118){_0xb3beb1=_0xb3beb1-0x0;var _0xd1f8e9=_0x073e[_0xb3beb1];return _0xd1f8e9;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var moment=require(_0xe073('0x2'));var BPromise=require(_0xe073('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe073('0x4'));var logger=require(_0xe073('0x5'))(_0xe073('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe073('0x7')]({'port':0x232a});config[_0xe073('0x8')]=_[_0xe073('0x9')](config[_0xe073('0x8')],{'host':_0xe073('0xa'),'port':0x18eb});var socket=require(_0xe073('0xb'))(new Redis(config['redis']));require(_0xe073('0xc'))[_0xe073('0xd')](socket);function respondWithRpcPromise(_0x46757c,_0x118048,_0x4fccb1){return new BPromise(function(_0x47ac27,_0x32878f){return client[_0xe073('0xe')](_0x46757c,_0x4fccb1)[_0xe073('0xf')](function(_0x3a9df1){logger[_0xe073('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0xe073('0x11'));logger['debug'](_0xe073('0x12'),_0x118048,'request\x20sent',JSON[_0xe073('0x13')](_0x3a9df1));if(_0x3a9df1['error']){if(_0x3a9df1[_0xe073('0x14')][_0xe073('0x15')]===0x1f4){logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);return _0x32878f(_0x3a9df1[_0xe073('0x14')][_0xe073('0x17')]);}logger[_0xe073('0x14')](_0xe073('0x16'),_0x118048,_0x3a9df1[_0xe073('0x14')]['message']);return _0x47ac27(_0x3a9df1['error']['message']);}else{logger[_0xe073('0x10')](_0xe073('0x16'),_0x118048,_0xe073('0x11'));_0x47ac27(_0x3a9df1[_0xe073('0x18')]['message']);}})[_0xe073('0x19')](function(_0x103a51){logger[_0xe073('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x118048,_0x103a51);_0x32878f(_0x103a51);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4c4145a..5063057 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 _0x81d5=['register','length','openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x81d5,0x1ab));var _0x581d=function(_0x319671,_0x35d082){_0x319671=_0x319671-0x0;var _0x452c6a=_0x81d5[_0x319671];return _0x452c6a;};'use strict';var OpenchannelAccountEvents=require(_0x581d('0x0'));var events=[_0x581d('0x1'),'remove',_0x581d('0x2')];function createListener(_0x20d1a8,_0x2fe463){return function(_0x9fb336){_0x2fe463[_0x581d('0x3')](_0x20d1a8,_0x9fb336);};}function removeListener(_0x553617,_0x4801bc){return function(){OpenchannelAccountEvents[_0x581d('0x4')](_0x553617,_0x4801bc);};}exports[_0x581d('0x5')]=function(_0x1895d2){for(var _0x4bb545=0x0,_0x16067b=events[_0x581d('0x6')];_0x4bb545<_0x16067b;_0x4bb545++){var _0x43124c=events[_0x4bb545];var _0x497368=createListener(_0x581d('0x7')+_0x43124c,_0x1895d2);OpenchannelAccountEvents['on'](_0x43124c,_0x497368);}}; \ No newline at end of file +var _0x1978=['openchannelAccount:','save','remove','update','emit','removeListener','length'];(function(_0x22bcb4,_0x1a658a){var _0x1ca513=function(_0x483d49){while(--_0x483d49){_0x22bcb4['push'](_0x22bcb4['shift']());}};_0x1ca513(++_0x1a658a);}(_0x1978,0x174));var _0x8197=function(_0x5f2433,_0x44c42a){_0x5f2433=_0x5f2433-0x0;var _0xd4b5db=_0x1978[_0x5f2433];return _0xd4b5db;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x8197('0x0'),_0x8197('0x1'),_0x8197('0x2')];function createListener(_0x374b6a,_0x203bf1){return function(_0x2828d2){_0x203bf1[_0x8197('0x3')](_0x374b6a,_0x2828d2);};}function removeListener(_0x346978,_0x4003e1){return function(){OpenchannelAccountEvents[_0x8197('0x4')](_0x346978,_0x4003e1);};}exports['register']=function(_0x215d3c){for(var _0x1556ad=0x0,_0x117bf1=events[_0x8197('0x5')];_0x1556ad<_0x117bf1;_0x1556ad++){var _0x3e8799=events[_0x1556ad];var _0x1bc265=createListener(_0x8197('0x6')+_0x3e8799,_0x215d3c);OpenchannelAccountEvents['on'](_0x3e8799,_0x1bc265);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a885a4b..51eba40 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 _0xef70=['../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x455b5d,_0x427262){var _0x460edc=function(_0x4d7b43){while(--_0x4d7b43){_0x455b5d['push'](_0x455b5d['shift']());}};_0x460edc(++_0x427262);}(_0xef70,0xb5));var _0x0ef7=function(_0xf5cf8b,_0x4698bd){_0xf5cf8b=_0xf5cf8b-0x0;var _0x38216e=_0xef70[_0xf5cf8b];return _0x38216e;};'use strict';var multer=require(_0x0ef7('0x0'));var util=require(_0x0ef7('0x1'));var path=require(_0x0ef7('0x2'));var timeout=require(_0x0ef7('0x3'));var express=require(_0x0ef7('0x4'));var router=express[_0x0ef7('0x5')]();var fs_extra=require(_0x0ef7('0x6'));var auth=require(_0x0ef7('0x7'));var interaction=require(_0x0ef7('0x8'));var config=require(_0x0ef7('0x9'));var controller=require(_0x0ef7('0xa'));router[_0x0ef7('0xb')]('/',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xd')]);router[_0x0ef7('0xb')]('/:id',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xe')]);router['post']('/',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0xf')]);router[_0x0ef7('0x10')](_0x0ef7('0x11'),auth[_0x0ef7('0xc')](),controller[_0x0ef7('0x12')]);router['delete']('/:id',auth[_0x0ef7('0xc')](),controller[_0x0ef7('0x13')]);module[_0x0ef7('0x14')]=router; \ No newline at end of file +var _0x250f=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put'];(function(_0x1c445a,_0xea7543){var _0x33e4ad=function(_0xbf0ca7){while(--_0xbf0ca7){_0x1c445a['push'](_0x1c445a['shift']());}};_0x33e4ad(++_0xea7543);}(_0x250f,0x195));var _0xf250=function(_0x40cb37,_0x43d441){_0x40cb37=_0x40cb37-0x0;var _0x583dc7=_0x250f[_0x40cb37];return _0x583dc7;};'use strict';var multer=require(_0xf250('0x0'));var util=require(_0xf250('0x1'));var path=require(_0xf250('0x2'));var timeout=require(_0xf250('0x3'));var express=require(_0xf250('0x4'));var router=express[_0xf250('0x5')]();var fs_extra=require(_0xf250('0x6'));var auth=require(_0xf250('0x7'));var interaction=require(_0xf250('0x8'));var config=require(_0xf250('0x9'));var controller=require('./openchannelApplication.controller');router[_0xf250('0xa')]('/',auth[_0xf250('0xb')](),controller[_0xf250('0xc')]);router[_0xf250('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf250('0xb')](),controller[_0xf250('0xd')]);router[_0xf250('0xe')](_0xf250('0xf'),auth[_0xf250('0xb')](),controller[_0xf250('0x10')]);router[_0xf250('0x11')](_0xf250('0xf'),auth['isAuthenticated'](),controller[_0xf250('0x12')]);module[_0xf250('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 3f25c88..2fda443 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 _0x8cdf=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2a04d4,_0xa57830){var _0x40b2f9=function(_0x44f8cf){while(--_0x44f8cf){_0x2a04d4['push'](_0x2a04d4['shift']());}};_0x40b2f9(++_0xa57830);}(_0x8cdf,0x14e));var _0xf8cd=function(_0x39d0d5,_0xcd43b4){_0x39d0d5=_0x39d0d5-0x0;var _0x4e4d18=_0x8cdf[_0x39d0d5];return _0x4e4d18;};'use strict';var Sequelize=require(_0xf8cd('0x0'));module[_0xf8cd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf8cd('0x2')],'allowNull':![],'defaultValue':_0xf8cd('0x3')},'appdata':{'type':Sequelize[_0xf8cd('0x4')]()},'description':{'type':Sequelize[_0xf8cd('0x2')]},'interval':{'type':Sequelize[_0xf8cd('0x2')],'defaultValue':_0xf8cd('0x5')}}; \ No newline at end of file +var _0x365c=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3a844f,_0x4060d8){var _0xd10a1e=function(_0x215b93){while(--_0x215b93){_0x3a844f['push'](_0x3a844f['shift']());}};_0xd10a1e(++_0x4060d8);}(_0x365c,0x19a));var _0xc365=function(_0xb2eee0,_0x32d420){_0xb2eee0=_0xb2eee0-0x0;var _0x97dee2=_0x365c[_0xb2eee0];return _0x97dee2;};'use strict';var Sequelize=require(_0xc365('0x0'));module[_0xc365('0x1')]={'priority':{'type':Sequelize[_0xc365('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc365('0x3')],'allowNull':![],'defaultValue':_0xc365('0x4')},'appdata':{'type':Sequelize[_0xc365('0x5')]()},'description':{'type':Sequelize[_0xc365('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc365('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 815a973..147495d 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 _0x7a52=['fieldName','type','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','params','keys','rawAttributes','fields','include','find','create','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','json','reject','save','update','then','end','error','name','send','OpenchannelApplication'];(function(_0x1d1dd7,_0x5adaeb){var _0x22f7da=function(_0x27da18){while(--_0x27da18){_0x1d1dd7['push'](_0x1d1dd7['shift']());}};_0x22f7da(++_0x5adaeb);}(_0x7a52,0x1d3));var _0x27a5=function(_0x25e527,_0x2a333a){_0x25e527=_0x25e527-0x0;var _0x4f258a=_0x7a52[_0x25e527];return _0x4f258a;};'use strict';var emlformat=require(_0x27a5('0x0'));var rimraf=require(_0x27a5('0x1'));var zipdir=require(_0x27a5('0x2'));var jsonpatch=require(_0x27a5('0x3'));var rp=require(_0x27a5('0x4'));var moment=require(_0x27a5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x27a5('0x6'));var util=require(_0x27a5('0x7'));var path=require(_0x27a5('0x8'));var sox=require(_0x27a5('0x9'));var csv=require(_0x27a5('0xa'));var ejs=require(_0x27a5('0xb'));var fs=require('fs');var fs_extra=require(_0x27a5('0xc'));var _=require(_0x27a5('0xd'));var squel=require(_0x27a5('0xe'));var crypto=require(_0x27a5('0xf'));var jsforce=require(_0x27a5('0x10'));var deskjs=require(_0x27a5('0x11'));var toCsv=require(_0x27a5('0xa'));var querystring=require(_0x27a5('0x12'));var Papa=require(_0x27a5('0x13'));var Redis=require(_0x27a5('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x27a5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a5('0x16'));var logger=require(_0x27a5('0x17'))('api');var utils=require(_0x27a5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x27a5('0x19'));var db=require(_0x27a5('0x1a'))['db'];function respondWithStatusCode(_0x346cb5,_0x47f038){_0x47f038=_0x47f038||0xcc;return function(_0x4b59d7){if(_0x4b59d7){return _0x346cb5[_0x27a5('0x1b')](_0x47f038);}return _0x346cb5[_0x27a5('0x1c')](_0x47f038)['end']();};}function respondWithResult(_0x46afc5,_0x5fdbe3){_0x5fdbe3=_0x5fdbe3||0xc8;return function(_0x207963){if(_0x207963){return _0x46afc5[_0x27a5('0x1c')](_0x5fdbe3)['json'](_0x207963);}};}function respondWithFilteredResult(_0x2c6e97,_0x1368be){return function(_0x279aff){if(_0x279aff){var _0x51e129=typeof _0x1368be['offset']===_0x27a5('0x1d')&&typeof _0x1368be[_0x27a5('0x1e')]===_0x27a5('0x1d');var _0x26f534=_0x279aff['count'];var _0x2f4690=_0x51e129?0x0:_0x1368be[_0x27a5('0x1f')];var _0x2b8a27=_0x51e129?_0x279aff[_0x27a5('0x20')]:_0x1368be['offset']+_0x1368be[_0x27a5('0x1e')];var _0xc2d7dc;if(_0x2b8a27>=_0x26f534){_0x2b8a27=_0x26f534;_0xc2d7dc=0xc8;}else{_0xc2d7dc=0xce;}_0x2c6e97['status'](_0xc2d7dc);return _0x2c6e97[_0x27a5('0x21')]('Content-Range',_0x2f4690+'-'+_0x2b8a27+'/'+_0x26f534)[_0x27a5('0x22')](_0x279aff);}return null;};}function patchUpdates(_0x4ee469){return function(_0x3658bb){try{jsonpatch['apply'](_0x3658bb,_0x4ee469,!![]);}catch(_0x1479bf){return BPromise[_0x27a5('0x23')](_0x1479bf);}return _0x3658bb[_0x27a5('0x24')]();};}function saveUpdates(_0x18bfe4,_0x4d6022){return function(_0x489516){if(_0x489516){return _0x489516[_0x27a5('0x25')](_0x18bfe4)[_0x27a5('0x26')](function(_0x10c7d6){return _0x10c7d6;});}return null;};}function removeEntity(_0x5d4c06,_0x3e461a){return function(_0x35cc53){if(_0x35cc53){return _0x35cc53['destroy']()[_0x27a5('0x26')](function(){_0x5d4c06[_0x27a5('0x1c')](0xcc)[_0x27a5('0x27')]();});}};}function handleEntityNotFound(_0x1fc144,_0x26fcdb){return function(_0x535edb){if(!_0x535edb){_0x1fc144[_0x27a5('0x1b')](0x194);}return _0x535edb;};}function handleError(_0x147907,_0x3f1100){_0x3f1100=_0x3f1100||0x1f4;return function(_0x4d2156){logger[_0x27a5('0x28')](_0x4d2156['stack']);if(_0x4d2156[_0x27a5('0x29')]){delete _0x4d2156[_0x27a5('0x29')];}_0x147907[_0x27a5('0x1c')](_0x3f1100)[_0x27a5('0x2a')](_0x4d2156);};}exports['index']=function(_0x393fab,_0x437671){var _0x140644={},_0x2c8f22={},_0x247397={'count':0x0,'rows':[]};var _0x3f4ca7=_['map'](db[_0x27a5('0x2b')]['rawAttributes'],function(_0x38b5f5){return{'name':_0x38b5f5[_0x27a5('0x2c')],'type':_0x38b5f5[_0x27a5('0x2d')]['key']};});_0x2c8f22[_0x27a5('0x2e')]=_[_0x27a5('0x2f')](_0x3f4ca7,_0x27a5('0x29'));_0x2c8f22[_0x27a5('0x30')]=_['keys'](_0x393fab['query']);_0x2c8f22[_0x27a5('0x31')]=_[_0x27a5('0x32')](_0x2c8f22['model'],_0x2c8f22[_0x27a5('0x30')]);_0x140644[_0x27a5('0x33')]=_[_0x27a5('0x32')](_0x2c8f22[_0x27a5('0x2e')],qs['fields'](_0x393fab[_0x27a5('0x30')]['fields']));_0x140644['attributes']=_0x140644[_0x27a5('0x33')]['length']?_0x140644[_0x27a5('0x33')]:_0x2c8f22['model'];if(!_0x393fab[_0x27a5('0x30')][_0x27a5('0x34')](_0x27a5('0x35'))){_0x140644[_0x27a5('0x1e')]=qs['limit'](_0x393fab['query']['limit']);_0x140644[_0x27a5('0x1f')]=qs[_0x27a5('0x1f')](_0x393fab[_0x27a5('0x30')]['offset']);}_0x140644['order']=qs[_0x27a5('0x36')](_0x393fab[_0x27a5('0x30')]['sort']);_0x140644[_0x27a5('0x37')]=qs[_0x27a5('0x31')](_[_0x27a5('0x38')](_0x393fab['query'],_0x2c8f22[_0x27a5('0x31')]),_0x3f4ca7);if(_0x393fab[_0x27a5('0x30')][_0x27a5('0x39')]){_0x140644[_0x27a5('0x37')]=_[_0x27a5('0x3a')](_0x140644[_0x27a5('0x37')],{'$or':_['map'](_0x3f4ca7,function(_0xa2def8){if(_0xa2def8[_0x27a5('0x2d')]!==_0x27a5('0x3b')){var _0x2fd3e7={};_0x2fd3e7[_0xa2def8[_0x27a5('0x29')]]={'$like':'%'+_0x393fab[_0x27a5('0x30')]['filter']+'%'};return _0x2fd3e7;}})});}_0x140644=_['merge']({},_0x140644,_0x393fab[_0x27a5('0x3c')]);var _0x1514cb={'where':_0x140644[_0x27a5('0x37')]};return db['OpenchannelApplication']['count'](_0x1514cb)['then'](function(_0x138cec){_0x247397[_0x27a5('0x20')]=_0x138cec;if(_0x393fab[_0x27a5('0x30')][_0x27a5('0x3d')]){_0x140644['include']=[{'all':!![]}];}return db[_0x27a5('0x2b')]['findAll'](_0x140644);})['then'](function(_0x4777cb){_0x247397['rows']=_0x4777cb;return _0x247397;})['then'](respondWithFilteredResult(_0x437671,_0x140644))['catch'](handleError(_0x437671,null));};exports[_0x27a5('0x3e')]=function(_0x3ed8e8,_0x82aaf2){var _0x37ed53={'raw':!![],'where':{'id':_0x3ed8e8[_0x27a5('0x3f')]['id']}},_0x4e9f41={};_0x4e9f41[_0x27a5('0x2e')]=_[_0x27a5('0x40')](db[_0x27a5('0x2b')][_0x27a5('0x41')]);_0x4e9f41[_0x27a5('0x30')]=_[_0x27a5('0x40')](_0x3ed8e8[_0x27a5('0x30')]);_0x4e9f41[_0x27a5('0x31')]=_[_0x27a5('0x32')](_0x4e9f41[_0x27a5('0x2e')],_0x4e9f41[_0x27a5('0x30')]);_0x37ed53[_0x27a5('0x33')]=_['intersection'](_0x4e9f41['model'],qs[_0x27a5('0x42')](_0x3ed8e8[_0x27a5('0x30')][_0x27a5('0x42')]));_0x37ed53[_0x27a5('0x33')]=_0x37ed53['attributes']['length']?_0x37ed53[_0x27a5('0x33')]:_0x4e9f41[_0x27a5('0x2e')];if(_0x3ed8e8[_0x27a5('0x30')][_0x27a5('0x3d')]){_0x37ed53[_0x27a5('0x43')]=[{'all':!![]}];}_0x37ed53=_[_0x27a5('0x3a')]({},_0x37ed53,_0x3ed8e8[_0x27a5('0x3c')]);return db[_0x27a5('0x2b')][_0x27a5('0x44')](_0x37ed53)[_0x27a5('0x26')](handleEntityNotFound(_0x82aaf2,null))[_0x27a5('0x26')](respondWithResult(_0x82aaf2,null))['catch'](handleError(_0x82aaf2,null));};exports[_0x27a5('0x45')]=function(_0x2dcfa3,_0x5d920a){return db['OpenchannelApplication'][_0x27a5('0x45')](_0x2dcfa3[_0x27a5('0x46')],{})[_0x27a5('0x26')](respondWithResult(_0x5d920a,0xc9))[_0x27a5('0x47')](handleError(_0x5d920a,null));};exports[_0x27a5('0x25')]=function(_0x2d607e,_0x5cecfc){if(_0x2d607e[_0x27a5('0x46')]['id']){delete _0x2d607e[_0x27a5('0x46')]['id'];}return db[_0x27a5('0x2b')][_0x27a5('0x44')]({'where':{'id':_0x2d607e[_0x27a5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5cecfc,null))[_0x27a5('0x26')](saveUpdates(_0x2d607e[_0x27a5('0x46')],null))[_0x27a5('0x26')](respondWithResult(_0x5cecfc,null))[_0x27a5('0x47')](handleError(_0x5cecfc,null));};exports[_0x27a5('0x48')]=function(_0x22b9cf,_0x2df814){return db[_0x27a5('0x2b')][_0x27a5('0x44')]({'where':{'id':_0x22b9cf[_0x27a5('0x3f')]['id']}})[_0x27a5('0x26')](handleEntityNotFound(_0x2df814,null))[_0x27a5('0x26')](removeEntity(_0x2df814,null))[_0x27a5('0x47')](handleError(_0x2df814,null));}; \ No newline at end of file +var _0x9b80=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','OpenchannelApplication','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','merge','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1f0d91,_0x24b032){var _0xafee7a=function(_0x2d1295){while(--_0x2d1295){_0x1f0d91['push'](_0x1f0d91['shift']());}};_0xafee7a(++_0x24b032);}(_0x9b80,0x1f4));var _0x09b8=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x9b80[_0x44216d];return _0xeca523;};'use strict';var emlformat=require(_0x09b8('0x0'));var rimraf=require(_0x09b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09b8('0x2'));var moment=require(_0x09b8('0x3'));var BPromise=require(_0x09b8('0x4'));var Mustache=require(_0x09b8('0x5'));var util=require('util');var path=require(_0x09b8('0x6'));var sox=require(_0x09b8('0x7'));var csv=require(_0x09b8('0x8'));var ejs=require(_0x09b8('0x9'));var fs=require('fs');var fs_extra=require(_0x09b8('0xa'));var _=require(_0x09b8('0xb'));var squel=require(_0x09b8('0xc'));var crypto=require('crypto');var jsforce=require(_0x09b8('0xd'));var deskjs=require(_0x09b8('0xe'));var toCsv=require(_0x09b8('0x8'));var querystring=require('querystring');var Papa=require(_0x09b8('0xf'));var Redis=require('ioredis');var authService=require(_0x09b8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x09b8('0x11'));var hardwareService=require(_0x09b8('0x12'));var logger=require(_0x09b8('0x13'))(_0x09b8('0x14'));var utils=require(_0x09b8('0x15'));var config=require(_0x09b8('0x16'));var licenseUtil=require(_0x09b8('0x17'));var db=require(_0x09b8('0x18'))['db'];function respondWithStatusCode(_0x17a73a,_0x5cf11f){_0x5cf11f=_0x5cf11f||0xcc;return function(_0x45bc99){if(_0x45bc99){return _0x17a73a[_0x09b8('0x19')](_0x5cf11f);}return _0x17a73a[_0x09b8('0x1a')](_0x5cf11f)[_0x09b8('0x1b')]();};}function respondWithResult(_0x3c83db,_0x465ac9){_0x465ac9=_0x465ac9||0xc8;return function(_0x5962bb){if(_0x5962bb){return _0x3c83db['status'](_0x465ac9)['json'](_0x5962bb);}};}function respondWithFilteredResult(_0x27cd0b,_0x3b4f46){return function(_0x58fe78){if(_0x58fe78){var _0x59cf77=typeof _0x3b4f46[_0x09b8('0x1c')]===_0x09b8('0x1d')&&typeof _0x3b4f46[_0x09b8('0x1e')]===_0x09b8('0x1d');var _0x259026=_0x58fe78[_0x09b8('0x1f')];var _0x1813c7=_0x59cf77?0x0:_0x3b4f46[_0x09b8('0x1c')];var _0x3c56aa=_0x59cf77?_0x58fe78[_0x09b8('0x1f')]:_0x3b4f46['offset']+_0x3b4f46[_0x09b8('0x1e')];var _0x3928c2;if(_0x3c56aa>=_0x259026){_0x3c56aa=_0x259026;_0x3928c2=0xc8;}else{_0x3928c2=0xce;}_0x27cd0b[_0x09b8('0x1a')](_0x3928c2);return _0x27cd0b[_0x09b8('0x20')]('Content-Range',_0x1813c7+'-'+_0x3c56aa+'/'+_0x259026)['json'](_0x58fe78);}return null;};}function patchUpdates(_0x1cc1d0){return function(_0x5f4736){try{jsonpatch['apply'](_0x5f4736,_0x1cc1d0,!![]);}catch(_0x225af9){return BPromise[_0x09b8('0x21')](_0x225af9);}return _0x5f4736[_0x09b8('0x22')]();};}function saveUpdates(_0x326d2b,_0x12caa1){return function(_0x5c437f){if(_0x5c437f){return _0x5c437f[_0x09b8('0x23')](_0x326d2b)['then'](function(_0xcae1ea){return _0xcae1ea;});}return null;};}function removeEntity(_0x55ed37,_0x5b6b98){return function(_0x496178){if(_0x496178){return _0x496178[_0x09b8('0x24')]()[_0x09b8('0x25')](function(){_0x55ed37[_0x09b8('0x1a')](0xcc)[_0x09b8('0x1b')]();});}};}function handleEntityNotFound(_0x37cb1d,_0x3c29d5){return function(_0x4a62b7){if(!_0x4a62b7){_0x37cb1d[_0x09b8('0x19')](0x194);}return _0x4a62b7;};}function handleError(_0x2dbfd3,_0x3eece7){_0x3eece7=_0x3eece7||0x1f4;return function(_0x2afb0e){logger[_0x09b8('0x26')](_0x2afb0e[_0x09b8('0x27')]);if(_0x2afb0e[_0x09b8('0x28')]){delete _0x2afb0e[_0x09b8('0x28')];}_0x2dbfd3[_0x09b8('0x1a')](_0x3eece7)[_0x09b8('0x29')](_0x2afb0e);};}exports[_0x09b8('0x2a')]=function(_0x355d42,_0x52b5f9){var _0x2fac69={},_0x1db4fb={},_0x49a7da={'count':0x0,'rows':[]};var _0x1c0e05=_[_0x09b8('0x2b')](db[_0x09b8('0x2c')]['rawAttributes'],function(_0x20a6a2){return{'name':_0x20a6a2['fieldName'],'type':_0x20a6a2[_0x09b8('0x2d')][_0x09b8('0x2e')]};});_0x1db4fb[_0x09b8('0x2f')]=_['map'](_0x1c0e05,'name');_0x1db4fb[_0x09b8('0x30')]=_['keys'](_0x355d42[_0x09b8('0x30')]);_0x1db4fb[_0x09b8('0x31')]=_['intersection'](_0x1db4fb['model'],_0x1db4fb[_0x09b8('0x30')]);_0x2fac69[_0x09b8('0x32')]=_[_0x09b8('0x33')](_0x1db4fb[_0x09b8('0x2f')],qs[_0x09b8('0x34')](_0x355d42[_0x09b8('0x30')][_0x09b8('0x34')]));_0x2fac69['attributes']=_0x2fac69['attributes'][_0x09b8('0x35')]?_0x2fac69['attributes']:_0x1db4fb['model'];if(!_0x355d42[_0x09b8('0x30')]['hasOwnProperty'](_0x09b8('0x36'))){_0x2fac69[_0x09b8('0x1e')]=qs[_0x09b8('0x1e')](_0x355d42[_0x09b8('0x30')][_0x09b8('0x1e')]);_0x2fac69[_0x09b8('0x1c')]=qs[_0x09b8('0x1c')](_0x355d42[_0x09b8('0x30')][_0x09b8('0x1c')]);}_0x2fac69[_0x09b8('0x37')]=qs['sort'](_0x355d42['query'][_0x09b8('0x38')]);_0x2fac69[_0x09b8('0x39')]=qs[_0x09b8('0x31')](_['pick'](_0x355d42[_0x09b8('0x30')],_0x1db4fb['filters']),_0x1c0e05);if(_0x355d42['query']['filter']){_0x2fac69[_0x09b8('0x39')]=_['merge'](_0x2fac69[_0x09b8('0x39')],{'$or':_['map'](_0x1c0e05,function(_0x11eded){if(_0x11eded[_0x09b8('0x2d')]!==_0x09b8('0x3a')){var _0x3cb39e={};_0x3cb39e[_0x11eded[_0x09b8('0x28')]]={'$like':'%'+_0x355d42['query'][_0x09b8('0x3b')]+'%'};return _0x3cb39e;}})});}_0x2fac69=_['merge']({},_0x2fac69,_0x355d42[_0x09b8('0x3c')]);var _0x86b6b0={'where':_0x2fac69[_0x09b8('0x39')]};return db[_0x09b8('0x2c')]['count'](_0x86b6b0)['then'](function(_0x2a9c1c){_0x49a7da[_0x09b8('0x1f')]=_0x2a9c1c;if(_0x355d42[_0x09b8('0x30')][_0x09b8('0x3d')]){_0x2fac69['include']=[{'all':!![]}];}return db[_0x09b8('0x2c')][_0x09b8('0x3e')](_0x2fac69);})[_0x09b8('0x25')](function(_0x20fa35){_0x49a7da[_0x09b8('0x3f')]=_0x20fa35;return _0x49a7da;})['then'](respondWithFilteredResult(_0x52b5f9,_0x2fac69))[_0x09b8('0x40')](handleError(_0x52b5f9,null));};exports[_0x09b8('0x41')]=function(_0x1531aa,_0x100043){var _0x3201f1={'raw':!![],'where':{'id':_0x1531aa[_0x09b8('0x42')]['id']}},_0x18b6ad={};_0x18b6ad[_0x09b8('0x2f')]=_['keys'](db['OpenchannelApplication'][_0x09b8('0x43')]);_0x18b6ad[_0x09b8('0x30')]=_[_0x09b8('0x44')](_0x1531aa[_0x09b8('0x30')]);_0x18b6ad[_0x09b8('0x31')]=_[_0x09b8('0x33')](_0x18b6ad[_0x09b8('0x2f')],_0x18b6ad['query']);_0x3201f1['attributes']=_[_0x09b8('0x33')](_0x18b6ad[_0x09b8('0x2f')],qs['fields'](_0x1531aa[_0x09b8('0x30')][_0x09b8('0x34')]));_0x3201f1[_0x09b8('0x32')]=_0x3201f1[_0x09b8('0x32')]['length']?_0x3201f1['attributes']:_0x18b6ad['model'];if(_0x1531aa[_0x09b8('0x30')][_0x09b8('0x3d')]){_0x3201f1[_0x09b8('0x45')]=[{'all':!![]}];}_0x3201f1=_[_0x09b8('0x46')]({},_0x3201f1,_0x1531aa[_0x09b8('0x3c')]);return db[_0x09b8('0x2c')][_0x09b8('0x47')](_0x3201f1)[_0x09b8('0x25')](handleEntityNotFound(_0x100043,null))[_0x09b8('0x25')](respondWithResult(_0x100043,null))[_0x09b8('0x40')](handleError(_0x100043,null));};exports[_0x09b8('0x48')]=function(_0x2514d8,_0x516b7f){return db[_0x09b8('0x2c')][_0x09b8('0x48')](_0x2514d8[_0x09b8('0x49')],{})[_0x09b8('0x25')](respondWithResult(_0x516b7f,0xc9))[_0x09b8('0x40')](handleError(_0x516b7f,null));};exports['update']=function(_0xae1fc6,_0x4a8adb){if(_0xae1fc6[_0x09b8('0x49')]['id']){delete _0xae1fc6[_0x09b8('0x49')]['id'];}return db[_0x09b8('0x2c')]['find']({'where':{'id':_0xae1fc6[_0x09b8('0x42')]['id']}})[_0x09b8('0x25')](handleEntityNotFound(_0x4a8adb,null))[_0x09b8('0x25')](saveUpdates(_0xae1fc6[_0x09b8('0x49')],null))[_0x09b8('0x25')](respondWithResult(_0x4a8adb,null))[_0x09b8('0x40')](handleError(_0x4a8adb,null));};exports['destroy']=function(_0x55e976,_0x51032){return db['OpenchannelApplication'][_0x09b8('0x47')]({'where':{'id':_0x55e976[_0x09b8('0x42')]['id']}})[_0x09b8('0x25')](handleEntityNotFound(_0x51032,null))['then'](removeEntity(_0x51032,null))[_0x09b8('0x40')](handleError(_0x51032,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9660bfb..a795366 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 _0x16fa=['./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x16fa,0x65));var _0xa16f=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x16fa[_0x5eca50];return _0x41fb84;};'use strict';var _=require(_0xa16f('0x0'));var util=require(_0xa16f('0x1'));var logger=require(_0xa16f('0x2'))(_0xa16f('0x3'));var moment=require(_0xa16f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa16f('0x5'));var fs=require('fs');var path=require(_0xa16f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa16f('0x7'));module[_0xa16f('0x8')]=function(_0xd25a6b,_0x37a334){return _0xd25a6b[_0xa16f('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xa16f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa16f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3123=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x27c883,_0x2f6efa){var _0xaae3a4=function(_0x3f6ee8){while(--_0x3f6ee8){_0x27c883['push'](_0x27c883['shift']());}};_0xaae3a4(++_0x2f6efa);}(_0x3123,0x8b));var _0x3312=function(_0x3f98aa,_0x1b8b51){_0x3f98aa=_0x3f98aa-0x0;var _0x5e775b=_0x3123[_0x3f98aa];return _0x5e775b;};'use strict';var _=require(_0x3312('0x0'));var util=require(_0x3312('0x1'));var logger=require(_0x3312('0x2'))(_0x3312('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3312('0x4'));var fs=require('fs');var path=require(_0x3312('0x5'));var rimraf=require(_0x3312('0x6'));var config=require(_0x3312('0x7'));var attributes=require(_0x3312('0x8'));module[_0x3312('0x9')]=function(_0xb01430,_0x4b5acb){return _0xb01430[_0x3312('0xa')](_0x3312('0xb'),attributes,{'tableName':_0x3312('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3312('0xd'),'collate':_0x3312('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f9c0274..4c3bc34 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 _0x1967=['stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1967,0x12e));var _0x7196=function(_0x162082,_0x5d3494){_0x162082=_0x162082-0x0;var _0x4d1fb4=_0x1967[_0x162082];return _0x4d1fb4;};'use strict';var _=require(_0x7196('0x0'));var util=require(_0x7196('0x1'));var moment=require(_0x7196('0x2'));var BPromise=require(_0x7196('0x3'));var rs=require(_0x7196('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7196('0x9')][_0x7196('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1a12,_0x50c7ba,_0x2b8ed4){return new BPromise(function(_0x257e08,_0x3bc531){return client[_0x7196('0xb')](_0x4b1a12,_0x2b8ed4)[_0x7196('0xc')](function(_0x7fce54){logger[_0x7196('0xd')](_0x7196('0xe'),_0x50c7ba,_0x7196('0xf'));logger[_0x7196('0x10')](_0x7196('0x11'),_0x50c7ba,_0x7196('0xf'),JSON['stringify'](_0x7fce54));if(_0x7fce54[_0x7196('0x12')]){if(_0x7fce54['error'][_0x7196('0x13')]===0x1f4){logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x7fce54[_0x7196('0x12')][_0x7196('0x14')]);return _0x3bc531(_0x7fce54['error'][_0x7196('0x14')]);}logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x7fce54['error'][_0x7196('0x14')]);return _0x257e08(_0x7fce54[_0x7196('0x12')][_0x7196('0x14')]);}else{logger[_0x7196('0xd')](_0x7196('0xe'),_0x50c7ba,_0x7196('0xf'));_0x257e08(_0x7fce54['result'][_0x7196('0x14')]);}})['catch'](function(_0x1227a3){logger[_0x7196('0x12')](_0x7196('0xe'),_0x50c7ba,_0x1227a3);_0x3bc531(_0x1227a3);});});}exports[_0x7196('0x15')]=function(_0x58d180){var _0xa18f1=this;return new Promise(function(_0x572f48,_0x948bf5){return db[_0x7196('0x16')]['update'](_0x58d180[_0x7196('0x17')],{'raw':_0x58d180[_0x7196('0x18')]?_0x58d180['options'][_0x7196('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58d180[_0x7196('0x18')]?_0x58d180[_0x7196('0x18')][_0x7196('0x1a')]||null:null,'attributes':_0x58d180[_0x7196('0x18')]?_0x58d180[_0x7196('0x18')][_0x7196('0x1b')]||null:null,'limit':_0x58d180['options']?_0x58d180[_0x7196('0x18')]['limit']||null:null})['then'](function(_0x46d13a){logger[_0x7196('0xd')](_0x7196('0x15'),_0x58d180);logger[_0x7196('0x10')](_0x7196('0x15'),_0x58d180,JSON[_0x7196('0x1c')](_0x46d13a));_0x572f48(_0x46d13a);})[_0x7196('0x1d')](function(_0x3f1317){logger[_0x7196('0x12')](_0x7196('0x15'),_0x3f1317[_0x7196('0x14')],_0x58d180);_0x948bf5(_0xa18f1[_0x7196('0x12')](0x1f4,_0x3f1317['message']));});});}; \ No newline at end of file +var _0x0e4f=['limit','UpdateOpenchannelApplication','stringify','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../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','message','result','OpenchannelApplication','update','body','options','raw','where','attributes'];(function(_0x210459,_0x42c55b){var _0x59991b=function(_0x1d5545){while(--_0x1d5545){_0x210459['push'](_0x210459['shift']());}};_0x59991b(++_0x42c55b);}(_0x0e4f,0xca));var _0xf0e4=function(_0x513cc2,_0x100353){_0x513cc2=_0x513cc2-0x0;var _0x5b37fc=_0x0e4f[_0x513cc2];return _0x5b37fc;};'use strict';var _=require(_0xf0e4('0x0'));var util=require('util');var moment=require(_0xf0e4('0x1'));var BPromise=require(_0xf0e4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0e4('0x3'));var db=require(_0xf0e4('0x4'))['db'];var utils=require(_0xf0e4('0x5'));var logger=require(_0xf0e4('0x6'))(_0xf0e4('0x7'));var config=require(_0xf0e4('0x8'));var jayson=require(_0xf0e4('0x9'));var client=jayson[_0xf0e4('0xa')][_0xf0e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbc93e5,_0x929d2,_0x2ba715){return new BPromise(function(_0x8a8cfd,_0x15a1c0){return client[_0xf0e4('0xc')](_0xbc93e5,_0x2ba715)[_0xf0e4('0xd')](function(_0x38858e){logger[_0xf0e4('0xe')](_0xf0e4('0xf'),_0x929d2,'request\x20sent');logger[_0xf0e4('0x10')](_0xf0e4('0x11'),_0x929d2,_0xf0e4('0x12'),JSON['stringify'](_0x38858e));if(_0x38858e[_0xf0e4('0x13')]){if(_0x38858e['error']['code']===0x1f4){logger[_0xf0e4('0x13')](_0xf0e4('0xf'),_0x929d2,_0x38858e[_0xf0e4('0x13')][_0xf0e4('0x14')]);return _0x15a1c0(_0x38858e[_0xf0e4('0x13')][_0xf0e4('0x14')]);}logger[_0xf0e4('0x13')](_0xf0e4('0xf'),_0x929d2,_0x38858e[_0xf0e4('0x13')][_0xf0e4('0x14')]);return _0x8a8cfd(_0x38858e[_0xf0e4('0x13')][_0xf0e4('0x14')]);}else{logger[_0xf0e4('0xe')](_0xf0e4('0xf'),_0x929d2,'request\x20sent');_0x8a8cfd(_0x38858e[_0xf0e4('0x15')][_0xf0e4('0x14')]);}})['catch'](function(_0x2149b4){logger['error'](_0xf0e4('0xf'),_0x929d2,_0x2149b4);_0x15a1c0(_0x2149b4);});});}exports['UpdateOpenchannelApplication']=function(_0x316379){var _0xfe50ef=this;return new Promise(function(_0x16f4d9,_0x4ca1b6){return db[_0xf0e4('0x16')][_0xf0e4('0x17')](_0x316379[_0xf0e4('0x18')],{'raw':_0x316379[_0xf0e4('0x19')]?_0x316379[_0xf0e4('0x19')][_0xf0e4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316379[_0xf0e4('0x19')]?_0x316379[_0xf0e4('0x19')][_0xf0e4('0x1b')]||null:null,'attributes':_0x316379['options']?_0x316379[_0xf0e4('0x19')][_0xf0e4('0x1c')]||null:null,'limit':_0x316379[_0xf0e4('0x19')]?_0x316379[_0xf0e4('0x19')][_0xf0e4('0x1d')]||null:null})[_0xf0e4('0xd')](function(_0x576886){logger[_0xf0e4('0xe')](_0xf0e4('0x1e'),_0x316379);logger[_0xf0e4('0x10')](_0xf0e4('0x1e'),_0x316379,JSON[_0xf0e4('0x1f')](_0x576886));_0x16f4d9(_0x576886);})[_0xf0e4('0x20')](function(_0xaac405){logger[_0xf0e4('0x13')](_0xf0e4('0x1e'),_0xaac405[_0xf0e4('0x14')],_0x316379);_0x4ca1b6(_0xfe50ef[_0xf0e4('0x13')](0x1f4,_0xaac405['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b13e6a8..6d98922 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 _0x1d8c=['openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update'];(function(_0x425036,_0x39bebc){var _0x7fc880=function(_0x54493c){while(--_0x54493c){_0x425036['push'](_0x425036['shift']());}};_0x7fc880(++_0x39bebc);}(_0x1d8c,0xa0));var _0xc1d8=function(_0x2208e3,_0x241116){_0x2208e3=_0x2208e3-0x0;var _0x20fbc0=_0x1d8c[_0x2208e3];return _0x20fbc0;};'use strict';var multer=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var path=require('path');var timeout=require(_0xc1d8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc1d8('0x3'));var auth=require(_0xc1d8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1d8('0x5'));var controller=require(_0xc1d8('0x6'));router[_0xc1d8('0x7')]('/',auth[_0xc1d8('0x8')](),controller['index']);router[_0xc1d8('0x7')]('/describe',auth[_0xc1d8('0x8')](),controller[_0xc1d8('0x9')]);router[_0xc1d8('0x7')](_0xc1d8('0xa'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0xb')]);router[_0xc1d8('0x7')](_0xc1d8('0xc'),auth[_0xc1d8('0x8')](),controller['getMessages']);router[_0xc1d8('0x7')]('/:id/download',auth[_0xc1d8('0x8')](),controller['download']);router[_0xc1d8('0xd')]('/',auth[_0xc1d8('0x8')](),controller['create']);router['post'](_0xc1d8('0xc'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0xe')]);router[_0xc1d8('0xd')](_0xc1d8('0xf'),auth[_0xc1d8('0x8')](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x12')),controller[_0xc1d8('0x13')]);router['put']('/:id',auth[_0xc1d8('0x8')](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x14')),controller[_0xc1d8('0x15')]);router['delete'](_0xc1d8('0xa'),auth['isAuthenticated'](),interaction[_0xc1d8('0x10')](_0xc1d8('0x11'),_0xc1d8('0x16')),controller[_0xc1d8('0x17')]);router['delete'](_0xc1d8('0xf'),auth[_0xc1d8('0x8')](),controller[_0xc1d8('0x18')]);module[_0xc1d8('0x19')]=router; \ No newline at end of file +var _0xd88a=['tracked','openchannel','openchannelinteraction:addtags','update','delete','openchannelinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags'];(function(_0x250758,_0x12d63d){var _0x4f47f8=function(_0x1569be){while(--_0x1569be){_0x250758['push'](_0x250758['shift']());}};_0x4f47f8(++_0x12d63d);}(_0xd88a,0x1ed));var _0xad88=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0xd88a[_0x5c6ceb];return _0x28821b;};'use strict';var multer=require('multer');var util=require(_0xad88('0x0'));var path=require(_0xad88('0x1'));var timeout=require(_0xad88('0x2'));var express=require(_0xad88('0x3'));var router=express[_0xad88('0x4')]();var fs_extra=require(_0xad88('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xad88('0x6'));var config=require(_0xad88('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xad88('0x8')]('/',auth[_0xad88('0x9')](),controller['index']);router[_0xad88('0x8')](_0xad88('0xa'),auth[_0xad88('0x9')](),controller[_0xad88('0xb')]);router[_0xad88('0x8')](_0xad88('0xc'),auth[_0xad88('0x9')](),controller[_0xad88('0xd')]);router[_0xad88('0x8')](_0xad88('0xe'),auth[_0xad88('0x9')](),controller['getMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xad88('0xf')]);router[_0xad88('0x10')]('/',auth[_0xad88('0x9')](),controller[_0xad88('0x11')]);router['post'](_0xad88('0xe'),auth[_0xad88('0x9')](),controller[_0xad88('0x12')]);router[_0xad88('0x10')](_0xad88('0x13'),auth[_0xad88('0x9')](),interaction[_0xad88('0x14')](_0xad88('0x15'),_0xad88('0x16')),controller['addTags']);router['put'](_0xad88('0xc'),auth['isAuthenticated'](),interaction[_0xad88('0x14')]('openchannel','openchannelinteraction:update'),controller[_0xad88('0x17')]);router[_0xad88('0x18')](_0xad88('0xc'),auth[_0xad88('0x9')](),interaction['tracked']('openchannel',_0xad88('0x19')),controller['destroy']);router[_0xad88('0x18')]('/:id/tags',auth[_0xad88('0x9')](),controller[_0xad88('0x1a')]);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 6cccb99..ae0cf72 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 _0xd846=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xd846,0x195));var _0x6d84=function(_0x153cf2,_0x2e332c){_0x153cf2=_0x153cf2-0x0;var _0x46f5fc=_0xd846[_0x153cf2];return _0x46f5fc;};'use strict';var Sequelize=require(_0x6d84('0x0'));module[_0x6d84('0x1')]={'closed':{'type':Sequelize[_0x6d84('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d84('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6d84('0x4')]},'threadId':{'type':Sequelize[_0x6d84('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x6d84('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6d84('0x5')]('in',_0x6d84('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6d84('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x6d84('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8cfd=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x29c22d,_0xdc777){var _0x1ba6de=function(_0x4d9c54){while(--_0x4d9c54){_0x29c22d['push'](_0x29c22d['shift']());}};_0x1ba6de(++_0xdc777);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0x8cfd[_0x45ac0c];return _0x4b4074;};'use strict';var Sequelize=require(_0xd8cf('0x0'));module[_0xd8cf('0x1')]={'closed':{'type':Sequelize[_0xd8cf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd8cf('0x3')]},'disposition':{'type':Sequelize[_0xd8cf('0x4')]},'secondDisposition':{'type':Sequelize[_0xd8cf('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd8cf('0x4')]},'read1stAt':{'type':Sequelize[_0xd8cf('0x3')]},'threadId':{'type':Sequelize[_0xd8cf('0x4')]},'externalUrl':{'type':Sequelize[_0xd8cf('0x4')]},'lastMsgAt':{'type':Sequelize[_0xd8cf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd8cf('0x5')]('in',_0xd8cf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd8cf('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xd8cf('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5727343..8ab52f5 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 _0x6455=['undefined','count','set','Content-Range','update','destroy','then','error','stack','name','index','rawAttributes','fieldName','openchannel','query','user','catch','show','type','from','params','model','OpenchannelInteraction','filters','intersection','attributes','fields','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','omit','ids','findOne','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','lastName','secret','read','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit'];(function(_0x2f9bb4,_0x38044c){var _0x209169=function(_0x113334){while(--_0x113334){_0x2f9bb4['push'](_0x2f9bb4['shift']());}};_0x209169(++_0x38044c);}(_0x6455,0xed));var _0x5645=function(_0x19ed77,_0x277e2c){_0x19ed77=_0x19ed77-0x0;var _0x2d558a=_0x6455[_0x19ed77];return _0x2d558a;};'use strict';var rimraf=require(_0x5645('0x0'));var zipdir=require(_0x5645('0x1'));var moment=require(_0x5645('0x2'));var util=require(_0x5645('0x3'));var path=require(_0x5645('0x4'));var ejs=require(_0x5645('0x5'));var fs=require('fs');var _=require(_0x5645('0x6'));var Redis=require('ioredis');var interaction=require(_0x5645('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x5645('0x8'));var logger=require(_0x5645('0x9'))('api');var config=require(_0x5645('0xa'));var db=require('../../mysqldb')['db'];config[_0x5645('0xb')]=_[_0x5645('0xc')](config[_0x5645('0xb')],{'host':_0x5645('0xd'),'port':0x18eb});var socket=require(_0x5645('0xe'))(new Redis(config[_0x5645('0xb')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5dc19b,_0x226b8c){_0x226b8c=_0x226b8c||0xcc;return function(_0x565e19){if(_0x565e19){return _0x5dc19b[_0x5645('0xf')](_0x226b8c);}return _0x5dc19b[_0x5645('0x10')](_0x226b8c)[_0x5645('0x11')]();};}function respondWithResult(_0x3db483,_0x3b63a4){_0x3b63a4=_0x3b63a4||0xc8;return function(_0xd0442){if(_0xd0442){return _0x3db483[_0x5645('0x10')](_0x3b63a4)[_0x5645('0x12')](_0xd0442);}};}function respondWithFilteredResult(_0x413d1,_0xe147d4){return function(_0x33e109){if(_0x33e109){var _0x43c6c6=typeof _0xe147d4[_0x5645('0x13')]==='undefined'&&typeof _0xe147d4[_0x5645('0x14')]===_0x5645('0x15');var _0x54dbc1=_0x33e109[_0x5645('0x16')];var _0x4a9b24=_0x43c6c6?0x0:_0xe147d4[_0x5645('0x13')];var _0x52b0c6=_0x43c6c6?_0x33e109[_0x5645('0x16')]:_0xe147d4[_0x5645('0x13')]+_0xe147d4[_0x5645('0x14')];var _0x5638cb;if(_0x52b0c6>=_0x54dbc1){_0x52b0c6=_0x54dbc1;_0x5638cb=0xc8;}else{_0x5638cb=0xce;}_0x413d1[_0x5645('0x10')](_0x5638cb);return _0x413d1[_0x5645('0x17')](_0x5645('0x18'),_0x4a9b24+'-'+_0x52b0c6+'/'+_0x54dbc1)[_0x5645('0x12')](_0x33e109);}return null;};}function saveUpdates(_0x4c3375){return function(_0x2e5764){if(_0x2e5764){return _0x2e5764[_0x5645('0x19')](_0x4c3375)['then'](function(_0x20fd08){return _0x20fd08;});}return null;};}function removeEntity(_0x1e97bc){return function(_0x3de1be){if(_0x3de1be){return _0x3de1be[_0x5645('0x1a')]()[_0x5645('0x1b')](function(){_0x1e97bc[_0x5645('0x10')](0xcc)[_0x5645('0x11')]();});}};}function handleEntityNotFound(_0xcad68b){return function(_0x1cddbb){if(!_0x1cddbb){_0xcad68b[_0x5645('0xf')](0x194);}return _0x1cddbb;};}function handleError(_0x4e337a,_0x86d51a){_0x86d51a=_0x86d51a||0x1f4;return function(_0x34bbbd){logger[_0x5645('0x1c')](_0x34bbbd[_0x5645('0x1d')]);if(_0x34bbbd[_0x5645('0x1e')]){delete _0x34bbbd[_0x5645('0x1e')];}_0x4e337a[_0x5645('0x10')](_0x86d51a)['send'](_0x34bbbd);};}exports[_0x5645('0x1f')]=function(_0xdae9d9,_0x11815e){var _0x50e5de={};var _0x1243bc=_['map'](db['OpenchannelInteraction'][_0x5645('0x20')],function(_0x3b6ef8){return{'name':_0x3b6ef8[_0x5645('0x21')],'type':_0x3b6ef8['type']['key']};});_0x50e5de=qs['getOptions'](_0x1243bc,_0xdae9d9);return interaction['findAll'](_0x5645('0x22'),_0xdae9d9[_0x5645('0x23')],_0xdae9d9[_0x5645('0x24')],_0x50e5de,_0x1243bc)[_0x5645('0x1b')](respondWithFilteredResult(_0x11815e,_0x50e5de))[_0x5645('0x25')](handleError(_0x11815e,null));};exports[_0x5645('0x26')]=function(_0x222077,_0x4e2aad){var _0xb951c9={};if(_0x222077[_0x5645('0x23')][_0x5645('0x27')]&&_0x222077[_0x5645('0x23')][_0x5645('0x27')]===_0x5645('0x28')){_0xb951c9[_0x5645('0x28')]=_0x222077[_0x5645('0x29')]['id'];}else{_0xb951c9['id']=_0x222077['params']['id'];}var _0x2df296={'raw':![],'where':_0xb951c9},_0x3b665a={};_0x3b665a[_0x5645('0x2a')]=_['keys'](db[_0x5645('0x2b')][_0x5645('0x20')]);_0x3b665a[_0x5645('0x23')]=_['keys'](_0x222077[_0x5645('0x23')]);_0x3b665a[_0x5645('0x2c')]=_[_0x5645('0x2d')](_0x3b665a[_0x5645('0x2a')],_0x3b665a['query']);_0x2df296[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x3b665a[_0x5645('0x2a')],qs[_0x5645('0x2f')](_0x222077[_0x5645('0x23')][_0x5645('0x2f')]));_0x2df296[_0x5645('0x2e')]=_0x2df296[_0x5645('0x2e')]['length']?_0x2df296[_0x5645('0x2e')]:_0x3b665a[_0x5645('0x2a')];if(_0x222077['query']['includeAll']){_0x2df296['include']=[{'all':!![]}];}_0x2df296=_[_0x5645('0x30')]({},_0x2df296,_0x222077[_0x5645('0x31')]);return db[_0x5645('0x2b')][_0x5645('0x32')](_0x2df296)[_0x5645('0x1b')](handleEntityNotFound(_0x4e2aad,null))[_0x5645('0x1b')](respondWithResult(_0x4e2aad,null))[_0x5645('0x25')](handleError(_0x4e2aad,null));};exports[_0x5645('0x33')]=function(_0xa27321,_0x3858ab){return db['OpenchannelInteraction'][_0x5645('0x33')](_0xa27321[_0x5645('0x34')],{})[_0x5645('0x1b')](respondWithResult(_0x3858ab,0xc9))[_0x5645('0x25')](handleError(_0x3858ab,null));};exports[_0x5645('0x19')]=function(_0x5e03c6,_0x2f9c23){if(_0x5e03c6['body']['id']){delete _0x5e03c6[_0x5645('0x34')]['id'];}return db[_0x5645('0x2b')]['find']({'where':{'id':_0x5e03c6[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f9c23,null))['then'](saveUpdates(_0x5e03c6[_0x5645('0x34')],null))[_0x5645('0x1b')](respondWithResult(_0x2f9c23,null))['catch'](handleError(_0x2f9c23,null));};exports[_0x5645('0x1a')]=function(_0x25f41e,_0x19a9fd){return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0x25f41e[_0x5645('0x29')]['id']}})[_0x5645('0x1b')](handleEntityNotFound(_0x19a9fd,null))[_0x5645('0x1b')](removeEntity(_0x19a9fd,null))[_0x5645('0x25')](handleError(_0x19a9fd,null));};exports[_0x5645('0x35')]=function(_0x14dcf4,_0x2c20a4){return db[_0x5645('0x2b')][_0x5645('0x35')]()['then'](respondWithResult(_0x2c20a4,null))[_0x5645('0x25')](handleError(_0x2c20a4,null));};exports[_0x5645('0x36')]=function(_0x137e53,_0x46572b){return db[_0x5645('0x37')][_0x5645('0x32')]({'where':{'id':_0x137e53[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x46572b,null))[_0x5645('0x1b')](function(_0x33516f){if(_0x33516f){return _0x33516f[_0x5645('0x36')](_0x137e53[_0x5645('0x34')]['ids'],_[_0x5645('0x38')](_0x137e53[_0x5645('0x34')],[_0x5645('0x39'),'id'])||{});}})[_0x5645('0x1b')](respondWithResult(_0x46572b,null))[_0x5645('0x25')](handleError(_0x46572b,null));};exports['getMessages']=function(_0x3d47c5,_0x1e93f1){var _0x596fa1={'raw':![],'where':{}};var _0x35cc02={};var _0x466711={'count':0x0,'rows':[]};return db[_0x5645('0x2b')][_0x5645('0x3a')]({'where':{'id':_0x3d47c5[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x1e93f1,null))[_0x5645('0x1b')](function(_0x13a60b){if(_0x13a60b){_0x35cc02[_0x5645('0x2a')]=_[_0x5645('0x3b')](db[_0x5645('0x37')][_0x5645('0x20')]);_0x35cc02[_0x5645('0x23')]=_[_0x5645('0x3b')](_0x3d47c5['query']);_0x35cc02[_0x5645('0x2c')]=_[_0x5645('0x2d')](_0x35cc02[_0x5645('0x2a')],_0x35cc02[_0x5645('0x23')]);_0x596fa1[_0x5645('0x2e')]=_[_0x5645('0x2d')](_0x35cc02[_0x5645('0x2a')],qs['fields'](_0x3d47c5[_0x5645('0x23')][_0x5645('0x2f')]));_0x596fa1['attributes']=_0x596fa1['attributes'][_0x5645('0x3c')]?_0x596fa1[_0x5645('0x2e')]:_0x35cc02[_0x5645('0x2a')];if(!_0x3d47c5['query'][_0x5645('0x3d')](_0x5645('0x3e'))){_0x596fa1['limit']=qs[_0x5645('0x14')](_0x3d47c5[_0x5645('0x23')][_0x5645('0x14')]);_0x596fa1['offset']=qs['offset'](_0x3d47c5['query'][_0x5645('0x13')]);}_0x596fa1[_0x5645('0x3f')]=qs[_0x5645('0x40')](_0x3d47c5[_0x5645('0x23')][_0x5645('0x40')]);_0x596fa1[_0x5645('0x41')]=qs[_0x5645('0x2c')](_[_0x5645('0x42')](_0x3d47c5['query'],_0x35cc02[_0x5645('0x2c')]));_0x596fa1[_0x5645('0x41')][_0x5645('0x43')]=_0x13a60b['id'];if(_0x3d47c5['query'][_0x5645('0x44')]){_0x596fa1['where']=_[_0x5645('0x30')](_0x596fa1['where'],{'$or':_['map'](_0x596fa1[_0x5645('0x2e')],function(_0x518eba){var _0x11c4c7={};_0x11c4c7[_0x518eba]={'$like':'%'+_0x3d47c5['query'][_0x5645('0x44')]+'%'};return _0x11c4c7;})});}if(_0x3d47c5[_0x5645('0x23')][_0x5645('0x45')]){var _0x3bad29=_0x3d47c5[_0x5645('0x23')][_0x5645('0x45')]['split'](',');var _0x21e09b={};_0x21e09b[_0x3bad29[0x0]]={'$gte':moment(_0x3bad29[0x1])[_0x5645('0x46')](_0x5645('0x47'))};_0x596fa1['where']=_[_0x5645('0x30')](_0x596fa1['where'],_0x21e09b);}_0x596fa1=_[_0x5645('0x30')]({},_0x596fa1,_0x3d47c5[_0x5645('0x31')]);return db[_0x5645('0x37')][_0x5645('0x16')]({'where':_0x596fa1['where']})['then'](function(_0x208384){_0x466711[_0x5645('0x16')]=_0x208384;if(_0x3d47c5['query'][_0x5645('0x48')]){_0x596fa1[_0x5645('0x49')]=[{'all':!![]}];}return db[_0x5645('0x37')][_0x5645('0x4a')](_0x596fa1);})[_0x5645('0x1b')](function(_0x1b8f20){_0x466711[_0x5645('0x4b')]=_0x1b8f20;return _0x466711;});}})[_0x5645('0x1b')](respondWithFilteredResult(_0x1e93f1,_0x596fa1))[_0x5645('0x25')](handleError(_0x1e93f1,null));};exports[_0x5645('0x4c')]=function(_0xed5745,_0x1d5a99){return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0xed5745[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d5a99,null))['then'](function(_0xf771df){if(_0xf771df){return _0xf771df[_0x5645('0x4d')](_0xed5745[_0x5645('0x34')][_0x5645('0x39')],_[_0x5645('0x38')](_0xed5745[_0x5645('0x34')],[_0x5645('0x39'),'id'])||{})['spread'](function(){return db[_0x5645('0x4e')][_0x5645('0x4a')]({'attributes':['id',_0x5645('0x1e'),_0x5645('0x4f')],'where':{'id':_0xed5745[_0x5645('0x34')]['ids']}});})['then'](function(_0xeccf59){socket[_0x5645('0x50')](_0x5645('0x51'),{'id':Number(_0xed5745['params']['id']),'tags':_0xeccf59||[]});return{'id':Number(_0xed5745[_0x5645('0x29')]['id']),'tags':_0xeccf59||[]};});}})[_0x5645('0x1b')](respondWithResult(_0x1d5a99,null))[_0x5645('0x25')](handleError(_0x1d5a99,null));};exports[_0x5645('0x52')]=function(_0x1f3616,_0x4d6390){return db['OpenchannelInteraction'][_0x5645('0x32')]({'where':{'id':_0x1f3616[_0x5645('0x29')]['id']}})['then'](handleEntityNotFound(_0x4d6390,null))[_0x5645('0x1b')](function(_0x33bfd9){if(_0x33bfd9){return _0x33bfd9[_0x5645('0x52')](_0x1f3616[_0x5645('0x23')]['ids']);}})[_0x5645('0x1b')](respondWithStatusCode(_0x4d6390,null))[_0x5645('0x25')](handleError(_0x4d6390,null));};exports[_0x5645('0x53')]=function(_0x467afb,_0x3dcb78){var _0x1b893a=moment()['unix']()[_0x5645('0x54')]();var _0x3b6c48=path[_0x5645('0x55')](config[_0x5645('0x56')],'server',_0x5645('0x57'),_0x5645('0x58'));var _0x1fad87=path['join'](config[_0x5645('0x56')],_0x5645('0x59'),_0x5645('0x57'),_0x5645('0x5a'));var _0x588e38=path['join'](_0x3b6c48,_0x1b893a);var _0x114e02=util[_0x5645('0x46')](_0x5645('0x5b'),_0x467afb[_0x5645('0x29')]['id'],_0x1b893a);var _0x37876a=path[_0x5645('0x55')](_0x3b6c48,_0x114e02);var _0x616cb6=[];_0x616cb6['push']({'model':db['User'],'as':_0x5645('0x5c'),'attributes':['id',_0x5645('0x5d')],'raw':!![]});_0x616cb6[_0x5645('0x5e')]({'model':db['CmContact'],'as':_0x5645('0x5f'),'attributes':['id',_0x5645('0x60'),'lastName'],'raw':!![]});if(_0x467afb['query']['attachments']){_0x616cb6['push']({'model':db[_0x5645('0x61')],'as':_0x5645('0x61'),'raw':!![]});}var _0x3a47b5=[{'model':db[_0x5645('0x37')],'as':_0x5645('0x62'),'attributes':['id',_0x5645('0x34'),_0x5645('0x63'),_0x5645('0x64'),'secret','read'],'include':_0x616cb6}];_0x3a47b5[_0x5645('0x5e')]({'model':db[_0x5645('0x65')],'as':_0x5645('0x66'),'attributes':['id',_0x5645('0x1e')]});_0x3a47b5[_0x5645('0x5e')]({'model':db[_0x5645('0x5c')],'as':'Owner','attributes':['id','fullname']});return db[_0x5645('0x2b')][_0x5645('0x32')]({'where':{'id':_0x467afb['params']['id']},'include':_0x3a47b5})[_0x5645('0x1b')](handleEntityNotFound(_0x3dcb78,null))[_0x5645('0x1b')](function(_0x25a4c6){if(_0x25a4c6){var _0x569dc1=_0x25a4c6[_0x5645('0x67')]({'plain':!![]});fs[_0x5645('0x68')](_0x588e38);var _0x4ab4f9={'channel':_0x5645('0x69'),'account':_0x569dc1[_0x5645('0x66')]['name'],'agent':_0x569dc1[_0x5645('0x6a')]?_0x569dc1[_0x5645('0x6a')][_0x5645('0x5d')]:_0x5645('0x6b'),'createdAt':moment(_0x569dc1[_0x5645('0x63')])[_0x5645('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5645('0x54')](),'closedAt':_0x569dc1[_0x5645('0x6c')]?moment(_0x569dc1[_0x5645('0x6d')])[_0x5645('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5645('0x54')]():'','disposition':_0x569dc1[_0x5645('0x6e')],'visibility':_0x569dc1[_0x5645('0x6f')]?_0x5645('0x70'):_0x5645('0x71'),'messages':_(_0x569dc1[_0x5645('0x62')])[_0x5645('0x44')]({'secret':![]})['map'](function(_0x4ccfbb){if(_0x4ccfbb[_0x5645('0x61')]){var _0x2cea4c=path[_0x5645('0x55')](_0x1fad87,_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')]);if(fs[_0x5645('0x73')](_0x2cea4c)){fs[_0x5645('0x74')](_0x2cea4c)[_0x5645('0x75')](fs['createWriteStream'](path[_0x5645('0x55')](_0x588e38,_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')])));}}return{'date':moment(_0x4ccfbb['createdAt'])['format'](_0x5645('0x47'))[_0x5645('0x54')](),'sender':_0x4ccfbb[_0x5645('0x64')]===_0x5645('0x76')?_0x4ccfbb[_0x5645('0x5c')]?_0x4ccfbb[_0x5645('0x5c')]['fullname']:_0x5645('0x77'):_0x4ccfbb[_0x5645('0x5f')][_0x5645('0x60')]+(_0x4ccfbb['Contact'][_0x5645('0x78')]?'\x20'+_0x4ccfbb[_0x5645('0x5f')]['lastName']:''),'body':_0x4ccfbb[_0x5645('0x61')]?_0x4ccfbb[_0x5645('0x61')][_0x5645('0x72')]:_0x4ccfbb[_0x5645('0x34')],'direction':_0x4ccfbb[_0x5645('0x64')]==='out'?'A':'C','secret':_0x4ccfbb[_0x5645('0x79')],'read':_0x4ccfbb[_0x5645('0x7a')],'attachment':_0x4ccfbb[_0x5645('0x61')]};})[_0x5645('0x7b')]()};return ejs[_0x5645('0x7c')](path[_0x5645('0x55')](config['root'],_0x5645('0x59'),_0x5645('0x7d'),_0x5645('0x7e')),{'interaction':_0x4ab4f9})['then'](function(_0x199513){var _0x55a0f7=path[_0x5645('0x55')](_0x588e38,'transcript-'+_0x569dc1['id']+'-'+_0x1b893a+'.pdf');var _0x55496a={'path':_0x55a0f7,'channel':_0x5645('0x69'),'interactionId':_0x569dc1['id']};return pdf[_0x5645('0x7f')](_0x199513,_0x55496a);})['then'](function(){return new Promise(function(_0x2e1b46,_0x267b81){zipdir(_0x588e38,{'saveTo':_0x37876a},function(_0x3fe4f8,_0x56f9f0){if(_0x3fe4f8)return _0x267b81(_0x3fe4f8);return _0x2e1b46(_0x56f9f0);});})['then'](function(){return new Promise(function(_0x4e7f46,_0x1bd100){rimraf(_0x588e38,function(_0x54d2ca){if(_0x54d2ca)_0x1bd100(_0x54d2ca);return _0x4e7f46();});});})[_0x5645('0x1b')](function(){return _0x3dcb78[_0x5645('0x53')](_0x37876a,_0x114e02,function(_0x367630){if(_0x367630){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x367630);}else{fs[_0x5645('0x80')](_0x37876a);}});});});}else{return _0x3dcb78[_0x5645('0xf')](0xc8);}})[_0x5645('0x25')](handleError(_0x3dcb78,null));}; \ No newline at end of file +var _0x4ffb=['redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','error','stack','name','send','map','fieldName','type','key','getOptions','findAll','openchannel','query','catch','show','from','params','model','keys','OpenchannelInteraction','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','hasOwnProperty','order','sort','pick','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','setTags','omit','spread','color','emit','openchannelInteractionTags:save','removeTags','join','root','server','files','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','push','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','User','Owner','get','N.A.','toString','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','Contact','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','unlinkSync','moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger'];(function(_0xfd49ed,_0x1272e1){var _0x355f54=function(_0x3fc70f){while(--_0x3fc70f){_0xfd49ed['push'](_0xfd49ed['shift']());}};_0x355f54(++_0x1272e1);}(_0x4ffb,0xf3));var _0xb4ff=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0x4ffb[_0x3a8ce2];return _0x2e5a45;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xb4ff('0x0'));var util=require(_0xb4ff('0x1'));var path=require(_0xb4ff('0x2'));var ejs=require(_0xb4ff('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb4ff('0x4'));var qs=require(_0xb4ff('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0xb4ff('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb4ff('0x7')]=_[_0xb4ff('0x8')](config[_0xb4ff('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb4ff('0x9'))(new Redis(config[_0xb4ff('0x7')]));require(_0xb4ff('0xa'))[_0xb4ff('0xb')](socket);function respondWithStatusCode(_0x48dec2,_0x1af2cb){_0x1af2cb=_0x1af2cb||0xcc;return function(_0x457202){if(_0x457202){return _0x48dec2[_0xb4ff('0xc')](_0x1af2cb);}return _0x48dec2[_0xb4ff('0xd')](_0x1af2cb)[_0xb4ff('0xe')]();};}function respondWithResult(_0x538472,_0x1b7bd0){_0x1b7bd0=_0x1b7bd0||0xc8;return function(_0x150633){if(_0x150633){return _0x538472['status'](_0x1b7bd0)['json'](_0x150633);}};}function respondWithFilteredResult(_0x85819f,_0x38e338){return function(_0x17ebcd){if(_0x17ebcd){var _0x4110e2=typeof _0x38e338[_0xb4ff('0xf')]===_0xb4ff('0x10')&&typeof _0x38e338[_0xb4ff('0x11')]===_0xb4ff('0x10');var _0x59182b=_0x17ebcd['count'];var _0x1910b7=_0x4110e2?0x0:_0x38e338[_0xb4ff('0xf')];var _0x5aa042=_0x4110e2?_0x17ebcd[_0xb4ff('0x12')]:_0x38e338[_0xb4ff('0xf')]+_0x38e338[_0xb4ff('0x11')];var _0x3e4334;if(_0x5aa042>=_0x59182b){_0x5aa042=_0x59182b;_0x3e4334=0xc8;}else{_0x3e4334=0xce;}_0x85819f['status'](_0x3e4334);return _0x85819f[_0xb4ff('0x13')](_0xb4ff('0x14'),_0x1910b7+'-'+_0x5aa042+'/'+_0x59182b)[_0xb4ff('0x15')](_0x17ebcd);}return null;};}function saveUpdates(_0x2d62dd){return function(_0x15f39c){if(_0x15f39c){return _0x15f39c[_0xb4ff('0x16')](_0x2d62dd)['then'](function(_0x49a5cf){return _0x49a5cf;});}return null;};}function removeEntity(_0x2c0419){return function(_0x72959f){if(_0x72959f){return _0x72959f[_0xb4ff('0x17')]()[_0xb4ff('0x18')](function(){_0x2c0419[_0xb4ff('0xd')](0xcc)[_0xb4ff('0xe')]();});}};}function handleEntityNotFound(_0x2997ec){return function(_0x1d7d0a){if(!_0x1d7d0a){_0x2997ec[_0xb4ff('0xc')](0x194);}return _0x1d7d0a;};}function handleError(_0x1d0729,_0x57ffed){_0x57ffed=_0x57ffed||0x1f4;return function(_0x45ed15){logger[_0xb4ff('0x19')](_0x45ed15[_0xb4ff('0x1a')]);if(_0x45ed15[_0xb4ff('0x1b')]){delete _0x45ed15[_0xb4ff('0x1b')];}_0x1d0729[_0xb4ff('0xd')](_0x57ffed)[_0xb4ff('0x1c')](_0x45ed15);};}exports['index']=function(_0x14b33e,_0x5cb982){var _0x22801d={};var _0x1dbc51=_[_0xb4ff('0x1d')](db['OpenchannelInteraction']['rawAttributes'],function(_0x7afc34){return{'name':_0x7afc34[_0xb4ff('0x1e')],'type':_0x7afc34[_0xb4ff('0x1f')][_0xb4ff('0x20')]};});_0x22801d=qs[_0xb4ff('0x21')](_0x1dbc51,_0x14b33e);return interaction[_0xb4ff('0x22')](_0xb4ff('0x23'),_0x14b33e[_0xb4ff('0x24')],_0x14b33e['user'],_0x22801d,_0x1dbc51)[_0xb4ff('0x18')](respondWithFilteredResult(_0x5cb982,_0x22801d))[_0xb4ff('0x25')](handleError(_0x5cb982,null));};exports[_0xb4ff('0x26')]=function(_0x3371de,_0xaa9f3d){var _0x231f15={};if(_0x3371de[_0xb4ff('0x24')][_0xb4ff('0x1f')]&&_0x3371de[_0xb4ff('0x24')][_0xb4ff('0x1f')]===_0xb4ff('0x27')){_0x231f15[_0xb4ff('0x27')]=_0x3371de[_0xb4ff('0x28')]['id'];}else{_0x231f15['id']=_0x3371de[_0xb4ff('0x28')]['id'];}var _0x45ec66={'raw':![],'where':_0x231f15},_0xa561c0={};_0xa561c0[_0xb4ff('0x29')]=_[_0xb4ff('0x2a')](db[_0xb4ff('0x2b')][_0xb4ff('0x2c')]);_0xa561c0[_0xb4ff('0x24')]=_[_0xb4ff('0x2a')](_0x3371de[_0xb4ff('0x24')]);_0xa561c0[_0xb4ff('0x2d')]=_[_0xb4ff('0x2e')](_0xa561c0[_0xb4ff('0x29')],_0xa561c0[_0xb4ff('0x24')]);_0x45ec66[_0xb4ff('0x2f')]=_[_0xb4ff('0x2e')](_0xa561c0[_0xb4ff('0x29')],qs[_0xb4ff('0x30')](_0x3371de[_0xb4ff('0x24')][_0xb4ff('0x30')]));_0x45ec66[_0xb4ff('0x2f')]=_0x45ec66[_0xb4ff('0x2f')][_0xb4ff('0x31')]?_0x45ec66[_0xb4ff('0x2f')]:_0xa561c0[_0xb4ff('0x29')];if(_0x3371de['query'][_0xb4ff('0x32')]){_0x45ec66[_0xb4ff('0x33')]=[{'all':!![]}];}_0x45ec66=_[_0xb4ff('0x34')]({},_0x45ec66,_0x3371de[_0xb4ff('0x35')]);return db[_0xb4ff('0x2b')][_0xb4ff('0x36')](_0x45ec66)[_0xb4ff('0x18')](handleEntityNotFound(_0xaa9f3d,null))['then'](respondWithResult(_0xaa9f3d,null))[_0xb4ff('0x25')](handleError(_0xaa9f3d,null));};exports[_0xb4ff('0x37')]=function(_0x27c7de,_0x505869){return db[_0xb4ff('0x2b')]['create'](_0x27c7de[_0xb4ff('0x38')],{})['then'](respondWithResult(_0x505869,0xc9))[_0xb4ff('0x25')](handleError(_0x505869,null));};exports[_0xb4ff('0x16')]=function(_0x21869c,_0x4d91aa){if(_0x21869c[_0xb4ff('0x38')]['id']){delete _0x21869c[_0xb4ff('0x38')]['id'];}return db[_0xb4ff('0x2b')][_0xb4ff('0x36')]({'where':{'id':_0x21869c[_0xb4ff('0x28')]['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x4d91aa,null))['then'](saveUpdates(_0x21869c['body'],null))[_0xb4ff('0x18')](respondWithResult(_0x4d91aa,null))[_0xb4ff('0x25')](handleError(_0x4d91aa,null));};exports[_0xb4ff('0x17')]=function(_0xb4bd39,_0x31464c){return db[_0xb4ff('0x2b')][_0xb4ff('0x36')]({'where':{'id':_0xb4bd39[_0xb4ff('0x28')]['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x31464c,null))['then'](removeEntity(_0x31464c,null))['catch'](handleError(_0x31464c,null));};exports[_0xb4ff('0x39')]=function(_0x3ecc34,_0xaf801e){return db['OpenchannelInteraction'][_0xb4ff('0x39')]()[_0xb4ff('0x18')](respondWithResult(_0xaf801e,null))[_0xb4ff('0x25')](handleError(_0xaf801e,null));};exports[_0xb4ff('0x3a')]=function(_0x2551fc,_0x484c28){return db['OpenchannelMessage'][_0xb4ff('0x36')]({'where':{'id':_0x2551fc[_0xb4ff('0x28')]['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x484c28,null))['then'](function(_0x4ffc4b){if(_0x4ffc4b){return _0x4ffc4b[_0xb4ff('0x3a')](_0x2551fc[_0xb4ff('0x38')][_0xb4ff('0x3b')],_['omit'](_0x2551fc[_0xb4ff('0x38')],[_0xb4ff('0x3b'),'id'])||{});}})[_0xb4ff('0x18')](respondWithResult(_0x484c28,null))[_0xb4ff('0x25')](handleError(_0x484c28,null));};exports[_0xb4ff('0x3c')]=function(_0x4acad8,_0x2f4819){var _0xf88f={'raw':![],'where':{}};var _0x5608f4={};var _0x48e2d4={'count':0x0,'rows':[]};return db[_0xb4ff('0x2b')]['findOne']({'where':{'id':_0x4acad8[_0xb4ff('0x28')]['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x2f4819,null))[_0xb4ff('0x18')](function(_0x5c9b6a){if(_0x5c9b6a){_0x5608f4[_0xb4ff('0x29')]=_[_0xb4ff('0x2a')](db['OpenchannelMessage'][_0xb4ff('0x2c')]);_0x5608f4['query']=_[_0xb4ff('0x2a')](_0x4acad8[_0xb4ff('0x24')]);_0x5608f4['filters']=_[_0xb4ff('0x2e')](_0x5608f4['model'],_0x5608f4[_0xb4ff('0x24')]);_0xf88f[_0xb4ff('0x2f')]=_[_0xb4ff('0x2e')](_0x5608f4[_0xb4ff('0x29')],qs['fields'](_0x4acad8[_0xb4ff('0x24')][_0xb4ff('0x30')]));_0xf88f[_0xb4ff('0x2f')]=_0xf88f[_0xb4ff('0x2f')]['length']?_0xf88f['attributes']:_0x5608f4[_0xb4ff('0x29')];if(!_0x4acad8['query'][_0xb4ff('0x3d')]('nolimit')){_0xf88f[_0xb4ff('0x11')]=qs['limit'](_0x4acad8[_0xb4ff('0x24')]['limit']);_0xf88f[_0xb4ff('0xf')]=qs['offset'](_0x4acad8[_0xb4ff('0x24')][_0xb4ff('0xf')]);}_0xf88f[_0xb4ff('0x3e')]=qs[_0xb4ff('0x3f')](_0x4acad8[_0xb4ff('0x24')]['sort']);_0xf88f['where']=qs['filters'](_[_0xb4ff('0x40')](_0x4acad8[_0xb4ff('0x24')],_0x5608f4['filters']));_0xf88f[_0xb4ff('0x41')][_0xb4ff('0x42')]=_0x5c9b6a['id'];if(_0x4acad8[_0xb4ff('0x24')][_0xb4ff('0x43')]){_0xf88f[_0xb4ff('0x41')]=_[_0xb4ff('0x34')](_0xf88f[_0xb4ff('0x41')],{'$or':_['map'](_0xf88f[_0xb4ff('0x2f')],function(_0x28420f){var _0xb2788f={};_0xb2788f[_0x28420f]={'$like':'%'+_0x4acad8[_0xb4ff('0x24')][_0xb4ff('0x43')]+'%'};return _0xb2788f;})});}if(_0x4acad8[_0xb4ff('0x24')]['$gte']){var _0x219df8=_0x4acad8[_0xb4ff('0x24')][_0xb4ff('0x44')][_0xb4ff('0x45')](',');var _0x1eacf6={};_0x1eacf6[_0x219df8[0x0]]={'$gte':moment(_0x219df8[0x1])[_0xb4ff('0x46')](_0xb4ff('0x47'))};_0xf88f[_0xb4ff('0x41')]=_[_0xb4ff('0x34')](_0xf88f[_0xb4ff('0x41')],_0x1eacf6);}_0xf88f=_[_0xb4ff('0x34')]({},_0xf88f,_0x4acad8[_0xb4ff('0x35')]);return db[_0xb4ff('0x48')]['count']({'where':_0xf88f[_0xb4ff('0x41')]})[_0xb4ff('0x18')](function(_0x389bcf){_0x48e2d4[_0xb4ff('0x12')]=_0x389bcf;if(_0x4acad8[_0xb4ff('0x24')]['includeAll']){_0xf88f[_0xb4ff('0x33')]=[{'all':!![]}];}return db[_0xb4ff('0x48')]['findAll'](_0xf88f);})[_0xb4ff('0x18')](function(_0x5091e3){_0x48e2d4['rows']=_0x5091e3;return _0x48e2d4;});}})[_0xb4ff('0x18')](respondWithFilteredResult(_0x2f4819,_0xf88f))[_0xb4ff('0x25')](handleError(_0x2f4819,null));};exports['addTags']=function(_0x78300f,_0x8e3151){return db[_0xb4ff('0x2b')]['find']({'where':{'id':_0x78300f[_0xb4ff('0x28')]['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x8e3151,null))[_0xb4ff('0x18')](function(_0x3e7155){if(_0x3e7155){return _0x3e7155[_0xb4ff('0x49')](_0x78300f[_0xb4ff('0x38')]['ids'],_[_0xb4ff('0x4a')](_0x78300f[_0xb4ff('0x38')],[_0xb4ff('0x3b'),'id'])||{})[_0xb4ff('0x4b')](function(){return db['Tag'][_0xb4ff('0x22')]({'attributes':['id',_0xb4ff('0x1b'),_0xb4ff('0x4c')],'where':{'id':_0x78300f[_0xb4ff('0x38')][_0xb4ff('0x3b')]}});})[_0xb4ff('0x18')](function(_0x1768e3){socket[_0xb4ff('0x4d')](_0xb4ff('0x4e'),{'id':Number(_0x78300f['params']['id']),'tags':_0x1768e3||[]});return{'id':Number(_0x78300f[_0xb4ff('0x28')]['id']),'tags':_0x1768e3||[]};});}})[_0xb4ff('0x18')](respondWithResult(_0x8e3151,null))[_0xb4ff('0x25')](handleError(_0x8e3151,null));};exports[_0xb4ff('0x4f')]=function(_0x57d484,_0x24cd10){return db[_0xb4ff('0x2b')]['find']({'where':{'id':_0x57d484['params']['id']}})[_0xb4ff('0x18')](handleEntityNotFound(_0x24cd10,null))['then'](function(_0x262dc4){if(_0x262dc4){return _0x262dc4['removeTags'](_0x57d484[_0xb4ff('0x24')]['ids']);}})[_0xb4ff('0x18')](respondWithStatusCode(_0x24cd10,null))[_0xb4ff('0x25')](handleError(_0x24cd10,null));};exports['download']=function(_0x3500b4,_0x264b1f){var _0xae96ad=moment()['unix']()['toString']();var _0x12bc9b=path[_0xb4ff('0x50')](config[_0xb4ff('0x51')],_0xb4ff('0x52'),_0xb4ff('0x53'),'tmp');var _0x2df050=path[_0xb4ff('0x50')](config[_0xb4ff('0x51')],_0xb4ff('0x52'),'files',_0xb4ff('0x54'));var _0x4cef85=path['join'](_0x12bc9b,_0xae96ad);var _0x529f1b=util[_0xb4ff('0x46')](_0xb4ff('0x55'),_0x3500b4[_0xb4ff('0x28')]['id'],_0xae96ad);var _0x49f209=path[_0xb4ff('0x50')](_0x12bc9b,_0x529f1b);var _0xbda8c1=[];_0xbda8c1['push']({'model':db['User'],'as':'User','attributes':['id',_0xb4ff('0x56')],'raw':!![]});_0xbda8c1['push']({'model':db[_0xb4ff('0x57')],'as':'Contact','attributes':['id',_0xb4ff('0x58'),_0xb4ff('0x59')],'raw':!![]});if(_0x3500b4[_0xb4ff('0x24')]['attachments']){_0xbda8c1[_0xb4ff('0x5a')]({'model':db['Attachment'],'as':_0xb4ff('0x5b'),'raw':!![]});}var _0x3a7653=[{'model':db[_0xb4ff('0x48')],'as':_0xb4ff('0x5c'),'attributes':['id',_0xb4ff('0x38'),_0xb4ff('0x5d'),'direction',_0xb4ff('0x5e'),_0xb4ff('0x5f')],'include':_0xbda8c1}];_0x3a7653[_0xb4ff('0x5a')]({'model':db[_0xb4ff('0x60')],'as':_0xb4ff('0x61'),'attributes':['id','name']});_0x3a7653[_0xb4ff('0x5a')]({'model':db[_0xb4ff('0x62')],'as':_0xb4ff('0x63'),'attributes':['id',_0xb4ff('0x56')]});return db['OpenchannelInteraction'][_0xb4ff('0x36')]({'where':{'id':_0x3500b4[_0xb4ff('0x28')]['id']},'include':_0x3a7653})[_0xb4ff('0x18')](handleEntityNotFound(_0x264b1f,null))[_0xb4ff('0x18')](function(_0x4c6b42){if(_0x4c6b42){var _0xe6c82b=_0x4c6b42[_0xb4ff('0x64')]({'plain':!![]});fs['mkdirSync'](_0x4cef85);var _0x568983={'channel':'Openchannel','account':_0xe6c82b[_0xb4ff('0x61')][_0xb4ff('0x1b')],'agent':_0xe6c82b[_0xb4ff('0x63')]?_0xe6c82b['Owner'][_0xb4ff('0x56')]:_0xb4ff('0x65'),'createdAt':moment(_0xe6c82b[_0xb4ff('0x5d')])['format'](_0xb4ff('0x47'))[_0xb4ff('0x66')](),'closedAt':_0xe6c82b[_0xb4ff('0x67')]?moment(_0xe6c82b['closedAt'])['format'](_0xb4ff('0x47'))['toString']():'','disposition':_0xe6c82b[_0xb4ff('0x68')],'visibility':_0xe6c82b[_0xb4ff('0x69')]?_0xb4ff('0x6a'):_0xb4ff('0x6b'),'messages':_(_0xe6c82b[_0xb4ff('0x5c')])[_0xb4ff('0x43')]({'secret':![]})[_0xb4ff('0x1d')](function(_0x4a40cc){if(_0x4a40cc[_0xb4ff('0x5b')]){var _0xdecd90=path['join'](_0x2df050,_0x4a40cc[_0xb4ff('0x5b')][_0xb4ff('0x6c')]);if(fs[_0xb4ff('0x6d')](_0xdecd90)){fs[_0xb4ff('0x6e')](_0xdecd90)[_0xb4ff('0x6f')](fs['createWriteStream'](path[_0xb4ff('0x50')](_0x4cef85,_0x4a40cc[_0xb4ff('0x5b')][_0xb4ff('0x6c')])));}}return{'date':moment(_0x4a40cc[_0xb4ff('0x5d')])[_0xb4ff('0x46')](_0xb4ff('0x47'))['toString'](),'sender':_0x4a40cc['direction']===_0xb4ff('0x70')?_0x4a40cc[_0xb4ff('0x62')]?_0x4a40cc[_0xb4ff('0x62')]['fullname']:_0xb4ff('0x71'):_0x4a40cc[_0xb4ff('0x72')][_0xb4ff('0x58')]+(_0x4a40cc['Contact'][_0xb4ff('0x59')]?'\x20'+_0x4a40cc['Contact'][_0xb4ff('0x59')]:''),'body':_0x4a40cc[_0xb4ff('0x5b')]?_0x4a40cc[_0xb4ff('0x5b')][_0xb4ff('0x6c')]:_0x4a40cc[_0xb4ff('0x38')],'direction':_0x4a40cc[_0xb4ff('0x73')]===_0xb4ff('0x70')?'A':'C','secret':_0x4a40cc[_0xb4ff('0x5e')],'read':_0x4a40cc[_0xb4ff('0x5f')],'attachment':_0x4a40cc[_0xb4ff('0x5b')]};})[_0xb4ff('0x74')]()};return ejs[_0xb4ff('0x75')](path[_0xb4ff('0x50')](config[_0xb4ff('0x51')],_0xb4ff('0x52'),_0xb4ff('0x76'),_0xb4ff('0x77')),{'interaction':_0x568983})[_0xb4ff('0x18')](function(_0x264185){var _0x36973b=path[_0xb4ff('0x50')](_0x4cef85,_0xb4ff('0x78')+_0xe6c82b['id']+'-'+_0xae96ad+_0xb4ff('0x79'));var _0x6dfba2={'path':_0x36973b,'channel':'Openchannel','interactionId':_0xe6c82b['id']};return pdf[_0xb4ff('0x7a')](_0x264185,_0x6dfba2);})[_0xb4ff('0x18')](function(){return new Promise(function(_0x1518f5,_0x260ff7){zipdir(_0x4cef85,{'saveTo':_0x49f209},function(_0x4ce439,_0x35d863){if(_0x4ce439)return _0x260ff7(_0x4ce439);return _0x1518f5(_0x35d863);});})['then'](function(){return new Promise(function(_0x36fc70,_0x207324){rimraf(_0x4cef85,function(_0x4b33d3){if(_0x4b33d3)_0x207324(_0x4b33d3);return _0x36fc70();});});})[_0xb4ff('0x18')](function(){return _0x264b1f[_0xb4ff('0x7b')](_0x49f209,_0x529f1b,function(_0x17f25e){if(_0x17f25e){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x17f25e);}else{fs[_0xb4ff('0x7c')](_0x49f209);}});});});}else{return _0x264b1f[_0xb4ff('0xc')](0xc8);}})[_0xb4ff('0x25')](handleError(_0x264b1f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 17f1099..5b1bdbf 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 _0x87ac=['findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','save','update','remove','then','Users','map'];(function(_0x830fb0,_0x2c1567){var _0x36a91e=function(_0x3e2ad1){while(--_0x3e2ad1){_0x830fb0['push'](_0x830fb0['shift']());}};_0x36a91e(++_0x2c1567);}(_0x87ac,0x16d));var _0xc87a=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x87ac[_0x4bd06e];return _0x85ebb;};'use strict';var EventEmitter=require(_0xc87a('0x0'));var OpenchannelInteraction=require(_0xc87a('0x1'))['db'][_0xc87a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc87a('0x3'),'afterUpdate':_0xc87a('0x4'),'afterDestroy':_0xc87a('0x5')};function emitEvent(_0x4f8467){return function(_0x10171f,_0x7adb66,_0x391396){_0x10171f['getUsers']({'attributes':['id'],'raw':!![]})[_0xc87a('0x6')](function(_0x386657){_0x10171f['setDataValue'](_0xc87a('0x7'),_0x386657[_0xc87a('0x8')](function(_0x48884e){return{'id':_0x48884e['id']};}));return OpenchannelMessage[_0xc87a('0x9')]({'where':{'OpenchannelInteractionId':_0x10171f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc87a('0x6')](function(_0x5716a3){_0x10171f[_0xc87a('0xa')](_0xc87a('0xb'),_0x5716a3[_0xc87a('0xc')]);OpenchannelInteractionEvents[_0xc87a('0xd')](_0x4f8467+':'+_0x10171f['id'],_0x10171f);OpenchannelInteractionEvents['emit'](_0x4f8467,_0x10171f);_0x391396(null);})['catch'](_0x391396(null));};}for(var e in events){if(events[_0xc87a('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xc87a('0xf')](e,emitEvent(event));}}module[_0xc87a('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe6ee=['exports','events','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hook'];(function(_0x242289,_0x232090){var _0x58b981=function(_0x4f978b){while(--_0x4f978b){_0x242289['push'](_0x242289['shift']());}};_0x58b981(++_0x232090);}(_0xe6ee,0x181));var _0xee6e=function(_0x487693,_0x5f1edd){_0x487693=_0x487693-0x0;var _0x33c2cb=_0xe6ee[_0x487693];return _0x33c2cb;};'use strict';var EventEmitter=require(_0xee6e('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xee6e('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xee6e('0x2')](0x0);var events={'afterCreate':_0xee6e('0x3'),'afterUpdate':_0xee6e('0x4'),'afterDestroy':_0xee6e('0x5')};function emitEvent(_0x688113){return function(_0x363174,_0x41c8d9,_0x387d30){_0x363174[_0xee6e('0x6')]({'attributes':['id'],'raw':!![]})[_0xee6e('0x7')](function(_0x37af8a){_0x363174[_0xee6e('0x8')]('Users',_0x37af8a['map'](function(_0x49d822){return{'id':_0x49d822['id']};}));return OpenchannelMessage[_0xee6e('0x9')]({'where':{'OpenchannelInteractionId':_0x363174['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee6e('0x7')](function(_0x190527){_0x363174[_0xee6e('0x8')](_0xee6e('0xa'),_0x190527[_0xee6e('0xb')]);OpenchannelInteractionEvents[_0xee6e('0xc')](_0x688113+':'+_0x363174['id'],_0x363174);OpenchannelInteractionEvents[_0xee6e('0xc')](_0x688113,_0x363174);_0x387d30(null);})[_0xee6e('0xd')](_0x387d30(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xee6e('0xe')](e,emitEvent(event));}}module[_0xee6e('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 645c429..305a399 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 _0xfc9b=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports'];(function(_0x54684f,_0x4af790){var _0x5d31aa=function(_0x35fd57){while(--_0x35fd57){_0x54684f['push'](_0x54684f['shift']());}};_0x5d31aa(++_0x4af790);}(_0xfc9b,0x74));var _0xbfc9=function(_0x388a56,_0x4ec231){_0x388a56=_0x388a56-0x0;var _0x2109b0=_0xfc9b[_0x388a56];return _0x2109b0;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var logger=require(_0xbfc9('0x2'))(_0xbfc9('0x3'));var moment=require(_0xbfc9('0x4'));var BPromise=require(_0xbfc9('0x5'));var rp=require(_0xbfc9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc9('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfc9('0x8'));module[_0xbfc9('0x9')]=function(_0x523ff1,_0x1dbece){return _0x523ff1[_0xbfc9('0xa')](_0xbfc9('0xb'),attributes,{'tableName':_0xbfc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbfc9('0xd'),'hooks':{'beforeUpdate':function(_0x57a087,_0x32bee5,_0x5073cf){if(_0x57a087[_0xbfc9('0xe')]('closed')){_0x57a087[_0xbfc9('0xf')]=moment()[_0xbfc9('0x10')](_0xbfc9('0x11'));}_0x5073cf(null,_0x57a087);}}});}; \ No newline at end of file +var _0x03f6=['utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x03f6,0x1e1));var _0x603f=function(_0x13d9db,_0x21b2ed){_0x13d9db=_0x13d9db-0x0;var _0x334b01=_0x03f6[_0x13d9db];return _0x334b01;};'use strict';var _=require('lodash');var util=require(_0x603f('0x0'));var logger=require(_0x603f('0x1'))('api');var moment=require(_0x603f('0x2'));var BPromise=require(_0x603f('0x3'));var rp=require(_0x603f('0x4'));var fs=require('fs');var path=require(_0x603f('0x5'));var rimraf=require(_0x603f('0x6'));var config=require(_0x603f('0x7'));var attributes=require(_0x603f('0x8'));module[_0x603f('0x9')]=function(_0x5979c6,_0x34ed61){return _0x5979c6[_0x603f('0xa')](_0x603f('0xb'),attributes,{'tableName':_0x603f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x603f('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x317750,_0x4407de,_0x2425e4){if(_0x317750[_0x603f('0xe')](_0x603f('0xf'))){_0x317750[_0x603f('0x10')]=moment()[_0x603f('0x11')](_0x603f('0x12'));}_0x2425e4(null,_0x317750);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6181ce6..f5e9b24 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 _0x3d6f=['ids','spread','AddTags','lodash','util','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','AddTagsToOpenchannelInteraction','addTags'];(function(_0x1620e0,_0x120daf){var _0x4414e5=function(_0x567c3d){while(--_0x567c3d){_0x1620e0['push'](_0x1620e0['shift']());}};_0x4414e5(++_0x120daf);}(_0x3d6f,0xdb));var _0xf3d6=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0x3d6f[_0x3bc3b4];return _0x4c546b;};'use strict';var _=require(_0xf3d6('0x0'));var util=require(_0xf3d6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf3d6('0x2'))(_0xf3d6('0x3'));var config=require(_0xf3d6('0x4'));var jayson=require(_0xf3d6('0x5'));var client=jayson['client'][_0xf3d6('0x6')]({'port':0x232a});config[_0xf3d6('0x7')]=_[_0xf3d6('0x8')](config[_0xf3d6('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf3d6('0x9'))(new Redis(config['redis']));require(_0xf3d6('0xa'))[_0xf3d6('0xb')](socket);function respondWithRpcPromise(_0x403b10,_0x15b12c,_0x3e0c28){return new BPromise(function(_0x32d100,_0xa09f99){return client[_0xf3d6('0xc')](_0x403b10,_0x3e0c28)[_0xf3d6('0xd')](function(_0x57bf51){logger[_0xf3d6('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x15b12c,_0xf3d6('0xf'));logger[_0xf3d6('0x10')](_0xf3d6('0x11'),_0x15b12c,_0xf3d6('0xf'),JSON['stringify'](_0x57bf51));if(_0x57bf51[_0xf3d6('0x12')]){if(_0x57bf51['error'][_0xf3d6('0x13')]===0x1f4){logger['error'](_0xf3d6('0x14'),_0x15b12c,_0x57bf51[_0xf3d6('0x12')][_0xf3d6('0x15')]);return _0xa09f99(_0x57bf51[_0xf3d6('0x12')]['message']);}logger[_0xf3d6('0x12')](_0xf3d6('0x14'),_0x15b12c,_0x57bf51[_0xf3d6('0x12')][_0xf3d6('0x15')]);return _0x32d100(_0x57bf51['error']['message']);}else{logger[_0xf3d6('0xe')](_0xf3d6('0x14'),_0x15b12c,_0xf3d6('0xf'));_0x32d100(_0x57bf51['result'][_0xf3d6('0x15')]);}})[_0xf3d6('0x16')](function(_0x5e41b8){logger[_0xf3d6('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x15b12c,_0x5e41b8);_0xa09f99(_0x5e41b8);});});}exports[_0xf3d6('0x17')]=function(_0x34eda0){var _0x4ffdf7=this;return new Promise(function(_0x2229d0,_0x544cc9){return db[_0xf3d6('0x18')][_0xf3d6('0x19')](_0x34eda0[_0xf3d6('0x1a')],{'raw':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1d')]||null:null,'attributes':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')]['attributes']||null:null,'limit':_0x34eda0[_0xf3d6('0x1b')]?_0x34eda0[_0xf3d6('0x1b')][_0xf3d6('0x1e')]||null:null})[_0xf3d6('0xd')](function(_0x19f599){logger['info'](_0xf3d6('0x17'),_0x34eda0);logger[_0xf3d6('0x10')](_0xf3d6('0x17'),_0x34eda0,JSON['stringify'](_0x19f599));_0x2229d0(_0x19f599);})[_0xf3d6('0x16')](function(_0x525a12){logger['error'](_0xf3d6('0x17'),_0x525a12['message'],_0x34eda0);_0x544cc9(_0x4ffdf7[_0xf3d6('0x12')](0x1f4,_0x525a12[_0xf3d6('0x15')]));});});};exports[_0xf3d6('0x1f')]=function(_0x285b68){return new Promise(function(_0x5c50d9,_0x5d09f2){return db[_0xf3d6('0x18')]['find']({'where':_0x285b68[_0xf3d6('0x1b')]?_0x285b68[_0xf3d6('0x1b')][_0xf3d6('0x1d')]||null:null})['then'](function(_0x3b64e5){if(_0x3b64e5){return _0x3b64e5[_0xf3d6('0x20')](_0x285b68[_0xf3d6('0x1a')][_0xf3d6('0x21')],_['omit'](_0x285b68[_0xf3d6('0x1a')],[_0xf3d6('0x21'),'id'])||{});}})[_0xf3d6('0x22')](function(_0x312bcc){logger[_0xf3d6('0xe')](_0xf3d6('0x23'),_0x285b68);logger[_0xf3d6('0x10')]('AddTags',_0x285b68,JSON['stringify'](_0x312bcc));_0x5c50d9(_0x312bcc);})[_0xf3d6('0x16')](function(_0x2e76da){logger[_0xf3d6('0x12')]('AddTags',_0x2e76da[_0xf3d6('0x15')],_0x285b68);_0x5d09f2(_this[_0xf3d6('0x12')](0x1f4,_0x2e76da[_0xf3d6('0x15')]));});});}; \ No newline at end of file +var _0x7378=['jayson/promise','client','http','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','OpenchannelInteraction','body','options','raw','where','limit','UpdateOpenchannelInteraction','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4cc669,_0x608556){var _0x55b197=function(_0x492478){while(--_0x492478){_0x4cc669['push'](_0x4cc669['shift']());}};_0x55b197(++_0x608556);}(_0x7378,0x1ae));var _0x8737=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7378[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8737('0x0'));var util=require(_0x8737('0x1'));var moment=require(_0x8737('0x2'));var BPromise=require(_0x8737('0x3'));var rs=require(_0x8737('0x4'));var fs=require('fs');var Redis=require(_0x8737('0x5'));var db=require(_0x8737('0x6'))['db'];var utils=require(_0x8737('0x7'));var logger=require(_0x8737('0x8'))(_0x8737('0x9'));var config=require('../../config/environment');var jayson=require(_0x8737('0xa'));var client=jayson[_0x8737('0xb')][_0x8737('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8737('0xd'),'port':0x18eb});var socket=require(_0x8737('0xe'))(new Redis(config[_0x8737('0xf')]));require(_0x8737('0x10'))[_0x8737('0x11')](socket);function respondWithRpcPromise(_0x3d569e,_0x19ef39,_0x1d4f52){return new BPromise(function(_0x2620de,_0x23bd6e){return client[_0x8737('0x12')](_0x3d569e,_0x1d4f52)[_0x8737('0x13')](function(_0x305881){logger[_0x8737('0x14')](_0x8737('0x15'),_0x19ef39,_0x8737('0x16'));logger[_0x8737('0x17')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x19ef39,_0x8737('0x16'),JSON[_0x8737('0x18')](_0x305881));if(_0x305881[_0x8737('0x19')]){if(_0x305881[_0x8737('0x19')][_0x8737('0x1a')]===0x1f4){logger[_0x8737('0x19')](_0x8737('0x15'),_0x19ef39,_0x305881[_0x8737('0x19')]['message']);return _0x23bd6e(_0x305881[_0x8737('0x19')][_0x8737('0x1b')]);}logger[_0x8737('0x19')](_0x8737('0x15'),_0x19ef39,_0x305881['error'][_0x8737('0x1b')]);return _0x2620de(_0x305881['error']['message']);}else{logger['info'](_0x8737('0x15'),_0x19ef39,_0x8737('0x16'));_0x2620de(_0x305881['result'][_0x8737('0x1b')]);}})[_0x8737('0x1c')](function(_0x5048d5){logger[_0x8737('0x19')](_0x8737('0x15'),_0x19ef39,_0x5048d5);_0x23bd6e(_0x5048d5);});});}exports['UpdateOpenchannelInteraction']=function(_0x1983bd){var _0x3b3b94=this;return new Promise(function(_0x29f77d,_0x3bf48a){return db[_0x8737('0x1d')]['update'](_0x1983bd[_0x8737('0x1e')],{'raw':_0x1983bd[_0x8737('0x1f')]?_0x1983bd[_0x8737('0x1f')][_0x8737('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1983bd[_0x8737('0x1f')]?_0x1983bd[_0x8737('0x1f')][_0x8737('0x21')]||null:null,'attributes':_0x1983bd[_0x8737('0x1f')]?_0x1983bd[_0x8737('0x1f')]['attributes']||null:null,'limit':_0x1983bd['options']?_0x1983bd['options'][_0x8737('0x22')]||null:null})[_0x8737('0x13')](function(_0x46cf4f){logger['info'](_0x8737('0x23'),_0x1983bd);logger[_0x8737('0x17')](_0x8737('0x23'),_0x1983bd,JSON[_0x8737('0x18')](_0x46cf4f));_0x29f77d(_0x46cf4f);})[_0x8737('0x1c')](function(_0x39d60a){logger[_0x8737('0x19')](_0x8737('0x23'),_0x39d60a[_0x8737('0x1b')],_0x1983bd);_0x3bf48a(_0x3b3b94['error'](0x1f4,_0x39d60a[_0x8737('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1895ac){return new Promise(function(_0x142b4d,_0x434d4d){return db[_0x8737('0x1d')][_0x8737('0x24')]({'where':_0x1895ac[_0x8737('0x1f')]?_0x1895ac[_0x8737('0x1f')][_0x8737('0x21')]||null:null})[_0x8737('0x13')](function(_0x3407e5){if(_0x3407e5){return _0x3407e5['addTags'](_0x1895ac[_0x8737('0x1e')]['ids'],_[_0x8737('0x25')](_0x1895ac[_0x8737('0x1e')],['ids','id'])||{});}})[_0x8737('0x26')](function(_0x21fbec){logger[_0x8737('0x14')]('AddTags',_0x1895ac);logger[_0x8737('0x17')](_0x8737('0x27'),_0x1895ac,JSON[_0x8737('0x18')](_0x21fbec));_0x142b4d(_0x21fbec);})['catch'](function(_0x312b86){logger[_0x8737('0x19')](_0x8737('0x27'),_0x312b86['message'],_0x1895ac);_0x434d4d(_this['error'](0x1f4,_0x312b86[_0x8737('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 46cf6e9..e2c5513 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 _0x78ea=['save','remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x4c7537,_0x4eb9f0){var _0x5f54a2=function(_0x459c12){while(--_0x459c12){_0x4c7537['push'](_0x4c7537['shift']());}};_0x5f54a2(++_0x4eb9f0);}(_0x78ea,0x1d7));var _0xa78e=function(_0x5ca5d3,_0x532add){_0x5ca5d3=_0x5ca5d3-0x0;var _0xb1712d=_0x78ea[_0x5ca5d3];return _0xb1712d;};'use strict';var OpenchannelInteractionEvents=require(_0xa78e('0x0'));var events=[_0xa78e('0x1'),_0xa78e('0x2'),'update'];function createListener(_0x40322f,_0x14314c){return function(_0x2caa4f){_0x14314c[_0xa78e('0x3')](_0x40322f,_0x2caa4f);};}function removeListener(_0x1e669a,_0x20f5ae){return function(){OpenchannelInteractionEvents[_0xa78e('0x4')](_0x1e669a,_0x20f5ae);};}exports[_0xa78e('0x5')]=function(_0x3d4e07){for(var _0x51a619=0x0,_0x67e4d3=events[_0xa78e('0x6')];_0x51a619<_0x67e4d3;_0x51a619++){var _0x4bcd62=events[_0x51a619];var _0x54df41=createListener(_0xa78e('0x7')+_0x4bcd62,_0x3d4e07);OpenchannelInteractionEvents['on'](_0x4bcd62,_0x54df41);}}; \ No newline at end of file +var _0x8b30=['length','remove','update','removeListener','register'];(function(_0x1cd9cd,_0x5862fd){var _0x3abfe1=function(_0x3ed40b){while(--_0x3ed40b){_0x1cd9cd['push'](_0x1cd9cd['shift']());}};_0x3abfe1(++_0x5862fd);}(_0x8b30,0xe7));var _0x08b3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x8b30[_0x3e5086];return _0xfeb102;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x08b3('0x0'),_0x08b3('0x1')];function createListener(_0x1b3740,_0x467f22){return function(_0x111e5d){_0x467f22['emit'](_0x1b3740,_0x111e5d);};}function removeListener(_0x8b9f2b,_0x592421){return function(){OpenchannelInteractionEvents[_0x08b3('0x2')](_0x8b9f2b,_0x592421);};}exports[_0x08b3('0x3')]=function(_0x17904d){for(var _0x2e8374=0x0,_0x3a498e=events[_0x08b3('0x4')];_0x2e8374<_0x3a498e;_0x2e8374++){var _0x4bad55=events[_0x2e8374];var _0x39b882=createListener('openchannelInteraction:'+_0x4bad55,_0x17904d);OpenchannelInteractionEvents['on'](_0x4bad55,_0x39b882);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f861114..d6f50a2 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0xdcc5fe,_0x2bab2f){var _0x254acf=function(_0x4930ca){while(--_0x4930ca){_0xdcc5fe['push'](_0xdcc5fe['shift']());}};_0x254acf(++_0x2bab2f);}(_0xedd9,0xfc));var _0x9edd=function(_0xef8958,_0x3b85b8){_0xef8958=_0xef8958-0x0;var _0x846579=_0xedd9[_0xef8958];return _0x846579;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6b79b23..2153e18 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 _0xdc9b=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x5d0459,_0x5a5be9){var _0x5b7907=function(_0x39d005){while(--_0x39d005){_0x5d0459['push'](_0x5d0459['shift']());}};_0x5b7907(++_0x5a5be9);}(_0xdc9b,0x70));var _0xbdc9=function(_0x1997e6,_0x53a2da){_0x1997e6=_0x1997e6-0x0;var _0x45ed17=_0xdc9b[_0x1997e6];return _0x45ed17;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'body':{'type':Sequelize[_0xbdc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbdc9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdc9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file +var _0xdd4f=['DATE','TEXT','sequelize','BOOLEAN','out'];(function(_0x55243c,_0x56cb07){var _0x37fdd0=function(_0x2675e7){while(--_0x2675e7){_0x55243c['push'](_0x55243c['shift']());}};_0x37fdd0(++_0x56cb07);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5912dd,_0x37d7af){_0x5912dd=_0x5912dd-0x0;var _0x9fd481=_0xdd4f[_0x5912dd];return _0x9fd481;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfdd4('0x2')),'defaultValue':_0xfdd4('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfdd4('0x3')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfdd4('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b88b321..167d98c 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 _0x0958=['moment','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','merge','options','OpenchannelMessage','includeAll','include','findAll','rows','params','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','fullname','email','internal','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise'];(function(_0x1c5663,_0x4c0905){var _0x126319=function(_0x3ebbce){while(--_0x3ebbce){_0x1c5663['push'](_0x1c5663['shift']());}};_0x126319(++_0x4c0905);}(_0x0958,0x7c));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x8095('0x0'));var rimraf=require(_0x8095('0x1'));var zipdir=require(_0x8095('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8095('0x3'));var moment=require(_0x8095('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8095('0x5'));var path=require(_0x8095('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8095('0x7'));var fs=require('fs');var fs_extra=require(_0x8095('0x8'));var _=require(_0x8095('0x9'));var squel=require(_0x8095('0xa'));var crypto=require(_0x8095('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8095('0xc'));var querystring=require(_0x8095('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8095('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8095('0xf'));var hardwareService=require(_0x8095('0x10'));var logger=require(_0x8095('0x11'))(_0x8095('0x12'));var utils=require(_0x8095('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8095('0x14'));var db=require('../../mysqldb')['db'];config[_0x8095('0x15')]=_[_0x8095('0x16')](config[_0x8095('0x15')],{'host':_0x8095('0x17'),'port':0x18eb});var socket=require(_0x8095('0x18'))(new Redis(config[_0x8095('0x15')]));require('./openchannelMessage.socket')[_0x8095('0x19')](socket);var jayson=require(_0x8095('0x1a'));var client=jayson[_0x8095('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x8095('0x1b')][_0x8095('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x42a59a,_0xb7c487,_0x466ac9,_0x5ae78f){return new BPromise(function(_0x1b1ca3,_0x463d6e){var _0x4a1d27=_0x5ae78f||client;return _0x4a1d27['request'](_0x42a59a,_0x466ac9)[_0x8095('0x1d')](function(_0x51c65a){logger[_0x8095('0x1e')](_0x8095('0x1f'),_0xb7c487,_0x8095('0x20'));logger['debug'](_0x8095('0x21'),_0xb7c487,_0x8095('0x20'),JSON[_0x8095('0x22')](_0x51c65a));if(_0x51c65a['error']){if(_0x51c65a[_0x8095('0x23')][_0x8095('0x24')]===0x1f4){logger[_0x8095('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xb7c487,_0x51c65a[_0x8095('0x23')]['message']);return _0x463d6e(_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);}logger[_0x8095('0x23')](_0x8095('0x1f'),_0xb7c487,_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);return _0x1b1ca3(_0x51c65a[_0x8095('0x23')][_0x8095('0x25')]);}else{logger[_0x8095('0x1e')](_0x8095('0x1f'),_0xb7c487,_0x8095('0x20'));_0x1b1ca3(_0x51c65a[_0x8095('0x26')][_0x8095('0x25')]);}})[_0x8095('0x27')](function(_0x5896f4){logger['error'](_0x8095('0x1f'),_0xb7c487,_0x5896f4);_0x463d6e(_0x5896f4);});});}function respondWithStatusCode(_0x190b0a,_0x2552b9){_0x2552b9=_0x2552b9||0xcc;return function(_0x39cde9){if(_0x39cde9){return _0x190b0a[_0x8095('0x28')](_0x2552b9);}return _0x190b0a[_0x8095('0x29')](_0x2552b9)[_0x8095('0x2a')]();};}function respondWithResult(_0xe39b50,_0x440975){_0x440975=_0x440975||0xc8;return function(_0x165fee){if(_0x165fee){return _0xe39b50[_0x8095('0x29')](_0x440975)[_0x8095('0x2b')](_0x165fee);}};}function respondWithFilteredResult(_0x223ade,_0x38d932){return function(_0xd4ff7d){if(_0xd4ff7d){var _0x22fc6c=typeof _0x38d932[_0x8095('0x2c')]===_0x8095('0x2d')&&typeof _0x38d932['limit']===_0x8095('0x2d');var _0x24caa2=_0xd4ff7d[_0x8095('0x2e')];var _0x3cba01=_0x22fc6c?0x0:_0x38d932[_0x8095('0x2c')];var _0x3806cd=_0x22fc6c?_0xd4ff7d[_0x8095('0x2e')]:_0x38d932['offset']+_0x38d932['limit'];var _0x4bf45e;if(_0x3806cd>=_0x24caa2){_0x3806cd=_0x24caa2;_0x4bf45e=0xc8;}else{_0x4bf45e=0xce;}_0x223ade[_0x8095('0x29')](_0x4bf45e);return _0x223ade['set'](_0x8095('0x2f'),_0x3cba01+'-'+_0x3806cd+'/'+_0x24caa2)[_0x8095('0x2b')](_0xd4ff7d);}return null;};}function patchUpdates(_0x6a7188){return function(_0x2a5599){try{jsonpatch[_0x8095('0x30')](_0x2a5599,_0x6a7188,!![]);}catch(_0x4f6b55){return BPromise['reject'](_0x4f6b55);}return _0x2a5599['save']();};}function saveUpdates(_0x407eb4,_0x3c68a2){return function(_0x167828){if(_0x167828){return _0x167828[_0x8095('0x31')](_0x407eb4)[_0x8095('0x1d')](function(_0x5f28a6){return _0x5f28a6;});}return null;};}function removeEntity(_0xf83cdc,_0x2a8183){return function(_0x5b6ca9){if(_0x5b6ca9){return _0x5b6ca9[_0x8095('0x32')]()[_0x8095('0x1d')](function(){_0xf83cdc['status'](0xcc)[_0x8095('0x2a')]();});}};}function handleEntityNotFound(_0x461cf0,_0xf1ac9a){return function(_0x4389c2){if(!_0x4389c2){_0x461cf0['sendStatus'](0x194);}return _0x4389c2;};}function handleError(_0x3eacd8,_0x261393){_0x261393=_0x261393||0x1f4;return function(_0x26004e){logger[_0x8095('0x23')](_0x26004e[_0x8095('0x33')]);if(_0x26004e[_0x8095('0x34')]){delete _0x26004e[_0x8095('0x34')];}_0x3eacd8['status'](_0x261393)[_0x8095('0x35')](_0x26004e);};}exports[_0x8095('0x36')]=function(_0x5510a6,_0xce269d){var _0x45b187={},_0x3b2339={},_0x4bf4d0={'count':0x0,'rows':[]};var _0x19de8e=_[_0x8095('0x37')](db['OpenchannelMessage'][_0x8095('0x38')],function(_0x1b12fe){return{'name':_0x1b12fe[_0x8095('0x39')],'type':_0x1b12fe[_0x8095('0x3a')]['key']};});_0x3b2339[_0x8095('0x3b')]=_[_0x8095('0x37')](_0x19de8e,_0x8095('0x34'));_0x3b2339[_0x8095('0x3c')]=_[_0x8095('0x3d')](_0x5510a6[_0x8095('0x3c')]);_0x3b2339[_0x8095('0x3e')]=_['intersection'](_0x3b2339[_0x8095('0x3b')],_0x3b2339[_0x8095('0x3c')]);_0x45b187[_0x8095('0x3f')]=_[_0x8095('0x40')](_0x3b2339['model'],qs[_0x8095('0x41')](_0x5510a6[_0x8095('0x3c')]['fields']));_0x45b187[_0x8095('0x3f')]=_0x45b187['attributes'][_0x8095('0x42')]?_0x45b187[_0x8095('0x3f')]:_0x3b2339[_0x8095('0x3b')];if(!_0x5510a6[_0x8095('0x3c')][_0x8095('0x43')]('nolimit')){_0x45b187['limit']=qs['limit'](_0x5510a6[_0x8095('0x3c')][_0x8095('0x44')]);_0x45b187[_0x8095('0x2c')]=qs[_0x8095('0x2c')](_0x5510a6[_0x8095('0x3c')][_0x8095('0x2c')]);}_0x45b187[_0x8095('0x45')]=qs[_0x8095('0x46')](_0x5510a6[_0x8095('0x3c')][_0x8095('0x46')]);_0x45b187[_0x8095('0x47')]=qs[_0x8095('0x3e')](_[_0x8095('0x48')](_0x5510a6['query'],_0x3b2339[_0x8095('0x3e')]),_0x19de8e);if(_0x5510a6[_0x8095('0x3c')]['filter']){_0x45b187[_0x8095('0x47')]=_['merge'](_0x45b187[_0x8095('0x47')],{'$or':_[_0x8095('0x37')](_0x19de8e,function(_0x125017){if(_0x125017[_0x8095('0x3a')]!==_0x8095('0x49')){var _0x205a2c={};_0x205a2c[_0x125017[_0x8095('0x34')]]={'$like':'%'+_0x5510a6[_0x8095('0x3c')]['filter']+'%'};return _0x205a2c;}})});}_0x45b187=_[_0x8095('0x4a')]({},_0x45b187,_0x5510a6[_0x8095('0x4b')]);var _0x27d78f={'where':_0x45b187[_0x8095('0x47')]};return db[_0x8095('0x4c')][_0x8095('0x2e')](_0x27d78f)[_0x8095('0x1d')](function(_0x3f06b6){_0x4bf4d0[_0x8095('0x2e')]=_0x3f06b6;if(_0x5510a6[_0x8095('0x3c')][_0x8095('0x4d')]){_0x45b187[_0x8095('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8095('0x4f')](_0x45b187);})['then'](function(_0x5ae2a0){_0x4bf4d0[_0x8095('0x50')]=_0x5ae2a0;return _0x4bf4d0;})[_0x8095('0x1d')](respondWithFilteredResult(_0xce269d,_0x45b187))['catch'](handleError(_0xce269d,null));};exports['show']=function(_0x18ef15,_0x36456f){var _0x47addc={'raw':!![],'where':{'id':_0x18ef15[_0x8095('0x51')]['id']}},_0x313db0={};_0x313db0[_0x8095('0x3b')]=_[_0x8095('0x3d')](db[_0x8095('0x4c')][_0x8095('0x38')]);_0x313db0[_0x8095('0x3c')]=_['keys'](_0x18ef15['query']);_0x313db0[_0x8095('0x3e')]=_['intersection'](_0x313db0[_0x8095('0x3b')],_0x313db0['query']);_0x47addc[_0x8095('0x3f')]=_[_0x8095('0x40')](_0x313db0['model'],qs[_0x8095('0x41')](_0x18ef15[_0x8095('0x3c')]['fields']));_0x47addc[_0x8095('0x3f')]=_0x47addc['attributes'][_0x8095('0x42')]?_0x47addc['attributes']:_0x313db0[_0x8095('0x3b')];if(_0x18ef15[_0x8095('0x3c')][_0x8095('0x4d')]){_0x47addc[_0x8095('0x4e')]=[{'all':!![]}];}_0x47addc=_[_0x8095('0x4a')]({},_0x47addc,_0x18ef15[_0x8095('0x4b')]);return db['OpenchannelMessage'][_0x8095('0x52')](_0x47addc)[_0x8095('0x1d')](handleEntityNotFound(_0x36456f,null))[_0x8095('0x1d')](respondWithResult(_0x36456f,null))[_0x8095('0x27')](handleError(_0x36456f,null));};exports[_0x8095('0x53')]=function(_0x4bb5c3,_0x283722){return db[_0x8095('0x4c')][_0x8095('0x53')](_0x4bb5c3[_0x8095('0x54')],{})[_0x8095('0x1d')](respondWithResult(_0x283722,0xc9))['catch'](handleError(_0x283722,null));};exports[_0x8095('0x31')]=function(_0x479cfd,_0xd81d69){if(_0x479cfd['body']['id']){delete _0x479cfd['body']['id'];}return db[_0x8095('0x4c')][_0x8095('0x52')]({'where':{'id':_0x479cfd[_0x8095('0x51')]['id']}})[_0x8095('0x1d')](handleEntityNotFound(_0xd81d69,null))[_0x8095('0x1d')](saveUpdates(_0x479cfd[_0x8095('0x54')],null))['then'](respondWithResult(_0xd81d69,null))[_0x8095('0x27')](handleError(_0xd81d69,null));};exports[_0x8095('0x32')]=function(_0x1e7d7d,_0x27fc7b){return db['OpenchannelMessage'][_0x8095('0x52')]({'where':{'id':_0x1e7d7d[_0x8095('0x51')]['id']}})['then'](handleEntityNotFound(_0x27fc7b,null))[_0x8095('0x1d')](removeEntity(_0x27fc7b,null))[_0x8095('0x27')](handleError(_0x27fc7b,null));};exports[_0x8095('0x55')]=function(_0xe43dde,_0x41bf8e){return db[_0x8095('0x4c')][_0x8095('0x55')]()[_0x8095('0x1d')](respondWithResult(_0x41bf8e,null))[_0x8095('0x27')](handleError(_0x41bf8e,null));};var interaction_log=require(_0x8095('0x11'))(_0x8095('0x56'));exports[_0x8095('0x57')]=function(_0x19acde,_0x8f3a36,_0x426ece){var _0x166f8d={'agent':{},'channel':_0x8095('0x58')};if(_0x19acde[_0x8095('0x54')]['id']){delete _0x19acde[_0x8095('0x54')]['id'];}_0x19acde[_0x8095('0x54')][_0x8095('0x59')]=!![];_0x19acde[_0x8095('0x54')][_0x8095('0x5a')]=moment()[_0x8095('0x5b')](_0x8095('0x5c'));_0x19acde['body'][_0x8095('0x5d')]=_0x19acde['body'][_0x8095('0x5d')]||_0x19acde[_0x8095('0x5e')]['id'];_0x166f8d[_0x8095('0x5f')]['id']=_0x19acde['body'][_0x8095('0x5d')];return db[_0x8095('0x4c')]['find']({'where':{'id':_0x19acde[_0x8095('0x51')]['id'],'UserId':null}})[_0x8095('0x1d')](handleEntityNotFound(_0x8f3a36,null))[_0x8095('0x1d')](saveUpdates(_0x19acde[_0x8095('0x54')],null))['then'](function(_0x2c4eaa){if(_0x2c4eaa){_0x166f8d[_0x8095('0x25')]=_0x2c4eaa['get']({'plain':!![]});return db[_0x8095('0x60')][_0x8095('0x52')]({'where':{'id':_0x2c4eaa[_0x8095('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x8f3a36,null))['then'](function(_0x5a5e4d){if(_0x5a5e4d){return _0x5a5e4d[_0x8095('0x31')]({'UserId':_0x19acde[_0x8095('0x54')][_0x8095('0x5d')],'read1stAt':_['isNil'](_0x5a5e4d[_0x8095('0x62')])?moment()[_0x8095('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8095('0x1d')](function(_0x180742){if(_0x180742){_0x166f8d['interaction']=_0x180742[_0x8095('0x63')]({'plain':!![]});interaction_log['info'](_0x8095('0x64'),_0x19acde[_0x8095('0x5e')]['id'],_0x19acde[_0x8095('0x5e')][_0x8095('0x34')],_0x19acde[_0x8095('0x5e')][_0x8095('0x65')],_0x166f8d['interaction']['id'],_0x19acde['body']?JSON[_0x8095('0x22')](_0x19acde[_0x8095('0x54')]):_0x8095('0x66'));return respondWithRpcPromise(_0x8095('0x67'),_0x8095('0x68'),_0x166f8d);}return null;})['then'](function(_0x24d858){var _0x521851='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24d858[_0x8095('0x25')]['ContactId'];return db[_0x8095('0x69')]['query'](_0x521851,{'type':db[_0x8095('0x6a')][_0x8095('0x6b')][_0x8095('0x6c')],'raw':!![]})[_0x8095('0x1d')](function(_0x4befad){return _0x4befad;});})['then'](function(_0x38d15c){if(_0x38d15c){_0x166f8d[_0x8095('0x25')][_0x8095('0x6d')]=_0x38d15c[0x0];if(!_0x19acde['body'][_0x8095('0x5d')])return;return db[_0x8095('0x6e')][_0x8095('0x52')]({'where':{'id':_0x19acde['body'][_0x8095('0x5d')],'role':'agent'},'attributes':['id',_0x8095('0x34'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x11ceb2){if(!_0x11ceb2)return null;_0x166f8d[_0x8095('0x25')][_0x8095('0x5f')]=_0x11ceb2;return _0x166f8d;})[_0x8095('0x1d')](function(_0x9a2240){if(_0x9a2240){if(_0x19acde[_0x8095('0x54')][_0x8095('0x6f')]){_0x166f8d[_0x8095('0x25')][_0x8095('0x70')]=util['format']('SIP/%s',_0x19acde['user'][_0x8095('0x34')]);_0x166f8d['message'][_0x8095('0x71')]=_0x166f8d[_0x8095('0x71')];_0x166f8d[_0x8095('0x25')][_0x8095('0x72')]=_0x166f8d[_0x8095('0x71')];_0x166f8d[_0x8095('0x25')][_0x8095('0x73')]=_0x8095('0x57');return respondWithRpcPromise(_0x8095('0x74'),'EventManager',{'event':_0x8095('0x75'),'message':_0x166f8d[_0x8095('0x25')]},client9002)['then'](function(){return _0x166f8d;});}return _0x166f8d;}return null;})[_0x8095('0x1d')](respondWithResult(_0x8f3a36,null))[_0x8095('0x27')](handleError(_0x8f3a36,null));};var interaction_log=require(_0x8095('0x11'))('openchannel-interactions');exports[_0x8095('0x76')]=function(_0x2542ef,_0x970194,_0xbd1aa8){var _0x5cb6af={'agent':{},'channel':_0x8095('0x58')};if(_0x2542ef['body']['id']){delete _0x2542ef['body']['id'];}_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')]=_0x2542ef[_0x8095('0x54')]['UserId']||_0x2542ef[_0x8095('0x5e')]['id'];_0x5cb6af[_0x8095('0x5f')]['id']=_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')];return db[_0x8095('0x4c')][_0x8095('0x52')]({'where':{'id':_0x2542ef[_0x8095('0x51')]['id'],'UserId':null}})[_0x8095('0x1d')](handleEntityNotFound(_0x970194,null))[_0x8095('0x1d')](function(_0x33a376){if(_0x33a376){_0x5cb6af[_0x8095('0x25')]=_0x33a376[_0x8095('0x63')]({'plain':!![]});return db[_0x8095('0x60')]['find']({'where':{'id':_0x33a376[_0x8095('0x61')]}});}return null;})[_0x8095('0x1d')](handleEntityNotFound(_0x970194,null))[_0x8095('0x1d')](function(_0x19cb04){if(_0x19cb04){_0x5cb6af[_0x8095('0x77')]=_0x19cb04['get']({'plain':!![]});interaction_log[_0x8095('0x1e')](_0x8095('0x78'),_0x2542ef[_0x8095('0x5e')]['id'],_0x2542ef[_0x8095('0x5e')]['name'],_0x2542ef[_0x8095('0x5e')][_0x8095('0x65')],_0x5cb6af[_0x8095('0x77')]['id'],_0x2542ef[_0x8095('0x54')]?JSON[_0x8095('0x22')](_0x2542ef[_0x8095('0x54')]):_0x8095('0x66'));return respondWithRpcPromise(_0x8095('0x79'),'rejectMessage',_0x5cb6af);}return null;})[_0x8095('0x1d')](function(_0x2ad4e0){var _0x678a15='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ad4e0['message'][_0x8095('0x7a')];return db[_0x8095('0x69')][_0x8095('0x3c')](_0x678a15,{'type':db[_0x8095('0x6a')][_0x8095('0x6b')]['SELECT'],'raw':!![]})[_0x8095('0x1d')](function(_0x1ee5b2){return _0x1ee5b2;});})[_0x8095('0x1d')](function(_0x5085ca){if(_0x5085ca){_0x5cb6af['message']['contact']=_0x5085ca[0x0];if(!_0x2542ef[_0x8095('0x54')][_0x8095('0x5d')])return;return db['User'][_0x8095('0x52')]({'where':{'id':_0x2542ef['body'][_0x8095('0x5d')],'role':_0x8095('0x5f')},'attributes':['id',_0x8095('0x34'),_0x8095('0x7b'),_0x8095('0x7c'),_0x8095('0x7d')],'raw':!![]});}return null;})['then'](function(_0x13d197){if(!_0x13d197)return null;_0x5cb6af['message'][_0x8095('0x5f')]=_0x13d197;return _0x5cb6af;})[_0x8095('0x1d')](function(_0x3462ee){if(_0x3462ee){_0x3462ee[_0x8095('0x25')][_0x8095('0x70')]=util[_0x8095('0x5b')](_0x8095('0x7e'),_0x2542ef[_0x8095('0x5e')][_0x8095('0x34')]);_0x3462ee[_0x8095('0x25')]['channel']=_0x5cb6af['channel'];_0x3462ee[_0x8095('0x25')]['motionChannel']=_0x5cb6af['channel'];_0x3462ee['message'][_0x8095('0x73')]=_0x8095('0x76');respondWithRpcPromise('EventManager',_0x8095('0x74'),{'event':_0x8095('0x7f'),'message':_0x3462ee[_0x8095('0x25')]},client9002);return _0x5cb6af;}return null;})['then'](respondWithResult(_0x970194,null))[_0x8095('0x27')](handleError(_0x970194,null));}; \ No newline at end of file +var _0x3827=['stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','filters','intersection','attributes','model','fields','query','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','catch','includeAll','include','options','find','create','body','params','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','email','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','status','end'];(function(_0x2bdcca,_0x458fe3){var _0x27fede=function(_0x1f8c35){while(--_0x1f8c35){_0x2bdcca['push'](_0x2bdcca['shift']());}};_0x27fede(++_0x458fe3);}(_0x3827,0x1c4));var _0x7382=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x3827[_0x39c734];return _0xb2a2f9;};'use strict';var emlformat=require(_0x7382('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7382('0x1'));var rp=require(_0x7382('0x2'));var moment=require(_0x7382('0x3'));var BPromise=require(_0x7382('0x4'));var Mustache=require(_0x7382('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7382('0x6'));var ejs=require(_0x7382('0x7'));var fs=require('fs');var fs_extra=require(_0x7382('0x8'));var _=require(_0x7382('0x9'));var squel=require(_0x7382('0xa'));var crypto=require(_0x7382('0xb'));var jsforce=require(_0x7382('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7382('0x6'));var querystring=require(_0x7382('0xd'));var Papa=require(_0x7382('0xe'));var Redis=require(_0x7382('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7382('0x10'));var as=require(_0x7382('0x11'));var hardwareService=require(_0x7382('0x12'));var logger=require(_0x7382('0x13'))(_0x7382('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7382('0x15'));var db=require('../../mysqldb')['db'];config[_0x7382('0x16')]=_[_0x7382('0x17')](config[_0x7382('0x16')],{'host':_0x7382('0x18'),'port':0x18eb});var socket=require(_0x7382('0x19'))(new Redis(config[_0x7382('0x16')]));require('./openchannelMessage.socket')[_0x7382('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7382('0x1b')][_0x7382('0x1c')]({'port':0x232c});var client9002=jayson[_0x7382('0x1b')][_0x7382('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xcc7829,_0x57b308,_0x1daadb,_0x580248){return new BPromise(function(_0x3c719f,_0x21a33e){var _0x2bee6c=_0x580248||client;return _0x2bee6c[_0x7382('0x1d')](_0xcc7829,_0x1daadb)['then'](function(_0x23570c){logger[_0x7382('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x57b308,'request\x20sent');logger[_0x7382('0x1f')](_0x7382('0x20'),_0x57b308,_0x7382('0x21'),JSON['stringify'](_0x23570c));if(_0x23570c['error']){if(_0x23570c[_0x7382('0x22')][_0x7382('0x23')]===0x1f4){logger[_0x7382('0x22')](_0x7382('0x24'),_0x57b308,_0x23570c[_0x7382('0x22')][_0x7382('0x25')]);return _0x21a33e(_0x23570c[_0x7382('0x22')][_0x7382('0x25')]);}logger['error'](_0x7382('0x24'),_0x57b308,_0x23570c['error']['message']);return _0x3c719f(_0x23570c[_0x7382('0x22')][_0x7382('0x25')]);}else{logger[_0x7382('0x1e')](_0x7382('0x24'),_0x57b308,'request\x20sent');_0x3c719f(_0x23570c['result']['message']);}})['catch'](function(_0x5b2001){logger[_0x7382('0x22')](_0x7382('0x24'),_0x57b308,_0x5b2001);_0x21a33e(_0x5b2001);});});}function respondWithStatusCode(_0x4a26c1,_0x42f165){_0x42f165=_0x42f165||0xcc;return function(_0x54998d){if(_0x54998d){return _0x4a26c1[_0x7382('0x26')](_0x42f165);}return _0x4a26c1['status'](_0x42f165)['end']();};}function respondWithResult(_0x36dbf4,_0x45402c){_0x45402c=_0x45402c||0xc8;return function(_0x36ca4e){if(_0x36ca4e){return _0x36dbf4['status'](_0x45402c)[_0x7382('0x27')](_0x36ca4e);}};}function respondWithFilteredResult(_0x2b6507,_0x4755bd){return function(_0x16c099){if(_0x16c099){var _0x69e1f1=typeof _0x4755bd[_0x7382('0x28')]==='undefined'&&typeof _0x4755bd[_0x7382('0x29')]===_0x7382('0x2a');var _0x10c428=_0x16c099[_0x7382('0x2b')];var _0x17cb33=_0x69e1f1?0x0:_0x4755bd[_0x7382('0x28')];var _0x4a1cdd=_0x69e1f1?_0x16c099[_0x7382('0x2b')]:_0x4755bd[_0x7382('0x28')]+_0x4755bd[_0x7382('0x29')];var _0x24c2ca;if(_0x4a1cdd>=_0x10c428){_0x4a1cdd=_0x10c428;_0x24c2ca=0xc8;}else{_0x24c2ca=0xce;}_0x2b6507['status'](_0x24c2ca);return _0x2b6507[_0x7382('0x2c')](_0x7382('0x2d'),_0x17cb33+'-'+_0x4a1cdd+'/'+_0x10c428)['json'](_0x16c099);}return null;};}function patchUpdates(_0x4a9511){return function(_0x3bf25b){try{jsonpatch['apply'](_0x3bf25b,_0x4a9511,!![]);}catch(_0x56295d){return BPromise[_0x7382('0x2e')](_0x56295d);}return _0x3bf25b['save']();};}function saveUpdates(_0x2e2400,_0x5aa61f){return function(_0x1d34aa){if(_0x1d34aa){return _0x1d34aa[_0x7382('0x2f')](_0x2e2400)[_0x7382('0x30')](function(_0x4427f6){return _0x4427f6;});}return null;};}function removeEntity(_0x97d36a,_0xd4e175){return function(_0x32e5cf){if(_0x32e5cf){return _0x32e5cf[_0x7382('0x31')]()[_0x7382('0x30')](function(){_0x97d36a[_0x7382('0x32')](0xcc)[_0x7382('0x33')]();});}};}function handleEntityNotFound(_0x5c5aaa,_0x24225c){return function(_0xe1c71e){if(!_0xe1c71e){_0x5c5aaa[_0x7382('0x26')](0x194);}return _0xe1c71e;};}function handleError(_0xf51c74,_0x123519){_0x123519=_0x123519||0x1f4;return function(_0x49ac46){logger['error'](_0x49ac46[_0x7382('0x34')]);if(_0x49ac46[_0x7382('0x35')]){delete _0x49ac46['name'];}_0xf51c74[_0x7382('0x32')](_0x123519)[_0x7382('0x36')](_0x49ac46);};}exports['index']=function(_0x562761,_0x4aeb7a){var _0x21d1fb={},_0x13ad62={},_0xed4750={'count':0x0,'rows':[]};var _0x159a85=_[_0x7382('0x37')](db[_0x7382('0x38')][_0x7382('0x39')],function(_0x3d49e3){return{'name':_0x3d49e3[_0x7382('0x3a')],'type':_0x3d49e3['type'][_0x7382('0x3b')]};});_0x13ad62['model']=_[_0x7382('0x37')](_0x159a85,'name');_0x13ad62['query']=_[_0x7382('0x3c')](_0x562761['query']);_0x13ad62[_0x7382('0x3d')]=_[_0x7382('0x3e')](_0x13ad62['model'],_0x13ad62['query']);_0x21d1fb[_0x7382('0x3f')]=_[_0x7382('0x3e')](_0x13ad62[_0x7382('0x40')],qs[_0x7382('0x41')](_0x562761[_0x7382('0x42')]['fields']));_0x21d1fb['attributes']=_0x21d1fb['attributes'][_0x7382('0x43')]?_0x21d1fb[_0x7382('0x3f')]:_0x13ad62[_0x7382('0x40')];if(!_0x562761[_0x7382('0x42')][_0x7382('0x44')](_0x7382('0x45'))){_0x21d1fb[_0x7382('0x29')]=qs[_0x7382('0x29')](_0x562761['query'][_0x7382('0x29')]);_0x21d1fb['offset']=qs[_0x7382('0x28')](_0x562761['query'][_0x7382('0x28')]);}_0x21d1fb[_0x7382('0x46')]=qs['sort'](_0x562761[_0x7382('0x42')]['sort']);_0x21d1fb[_0x7382('0x47')]=qs[_0x7382('0x3d')](_[_0x7382('0x48')](_0x562761[_0x7382('0x42')],_0x13ad62[_0x7382('0x3d')]),_0x159a85);if(_0x562761[_0x7382('0x42')][_0x7382('0x49')]){_0x21d1fb[_0x7382('0x47')]=_[_0x7382('0x4a')](_0x21d1fb[_0x7382('0x47')],{'$or':_[_0x7382('0x37')](_0x159a85,function(_0x193fd6){if(_0x193fd6[_0x7382('0x4b')]!==_0x7382('0x4c')){var _0xcb923={};_0xcb923[_0x193fd6[_0x7382('0x35')]]={'$like':'%'+_0x562761[_0x7382('0x42')][_0x7382('0x49')]+'%'};return _0xcb923;}})});}_0x21d1fb=_[_0x7382('0x4a')]({},_0x21d1fb,_0x562761['options']);var _0x344ac6={'where':_0x21d1fb[_0x7382('0x47')]};return db[_0x7382('0x38')][_0x7382('0x2b')](_0x344ac6)[_0x7382('0x30')](function(_0x171cb0){_0xed4750[_0x7382('0x2b')]=_0x171cb0;if(_0x562761['query']['includeAll']){_0x21d1fb['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x21d1fb);})[_0x7382('0x30')](function(_0x2b5aef){_0xed4750['rows']=_0x2b5aef;return _0xed4750;})[_0x7382('0x30')](respondWithFilteredResult(_0x4aeb7a,_0x21d1fb))[_0x7382('0x4d')](handleError(_0x4aeb7a,null));};exports['show']=function(_0x3957e4,_0x20ba36){var _0x1e4ebf={'raw':!![],'where':{'id':_0x3957e4['params']['id']}},_0x9f7a2e={};_0x9f7a2e[_0x7382('0x40')]=_[_0x7382('0x3c')](db[_0x7382('0x38')][_0x7382('0x39')]);_0x9f7a2e[_0x7382('0x42')]=_[_0x7382('0x3c')](_0x3957e4['query']);_0x9f7a2e[_0x7382('0x3d')]=_[_0x7382('0x3e')](_0x9f7a2e[_0x7382('0x40')],_0x9f7a2e['query']);_0x1e4ebf['attributes']=_[_0x7382('0x3e')](_0x9f7a2e['model'],qs[_0x7382('0x41')](_0x3957e4['query'][_0x7382('0x41')]));_0x1e4ebf['attributes']=_0x1e4ebf[_0x7382('0x3f')][_0x7382('0x43')]?_0x1e4ebf['attributes']:_0x9f7a2e[_0x7382('0x40')];if(_0x3957e4['query'][_0x7382('0x4e')]){_0x1e4ebf[_0x7382('0x4f')]=[{'all':!![]}];}_0x1e4ebf=_[_0x7382('0x4a')]({},_0x1e4ebf,_0x3957e4[_0x7382('0x50')]);return db['OpenchannelMessage'][_0x7382('0x51')](_0x1e4ebf)[_0x7382('0x30')](handleEntityNotFound(_0x20ba36,null))['then'](respondWithResult(_0x20ba36,null))[_0x7382('0x4d')](handleError(_0x20ba36,null));};exports[_0x7382('0x52')]=function(_0x504c82,_0x2141eb){return db[_0x7382('0x38')]['create'](_0x504c82['body'],{})[_0x7382('0x30')](respondWithResult(_0x2141eb,0xc9))[_0x7382('0x4d')](handleError(_0x2141eb,null));};exports['update']=function(_0x37b336,_0x2080a4){if(_0x37b336[_0x7382('0x53')]['id']){delete _0x37b336[_0x7382('0x53')]['id'];}return db[_0x7382('0x38')][_0x7382('0x51')]({'where':{'id':_0x37b336[_0x7382('0x54')]['id']}})[_0x7382('0x30')](handleEntityNotFound(_0x2080a4,null))[_0x7382('0x30')](saveUpdates(_0x37b336[_0x7382('0x53')],null))[_0x7382('0x30')](respondWithResult(_0x2080a4,null))[_0x7382('0x4d')](handleError(_0x2080a4,null));};exports['destroy']=function(_0x28b789,_0x3d9606){return db[_0x7382('0x38')][_0x7382('0x51')]({'where':{'id':_0x28b789[_0x7382('0x54')]['id']}})[_0x7382('0x30')](handleEntityNotFound(_0x3d9606,null))[_0x7382('0x30')](removeEntity(_0x3d9606,null))[_0x7382('0x4d')](handleError(_0x3d9606,null));};exports['describe']=function(_0x436d16,_0x3a7c18){return db[_0x7382('0x38')]['describe']()[_0x7382('0x30')](respondWithResult(_0x3a7c18,null))['catch'](handleError(_0x3a7c18,null));};var interaction_log=require(_0x7382('0x13'))('openchannel-interactions');exports[_0x7382('0x55')]=function(_0x1c4d96,_0x4d9b69,_0x4e9d3e){var _0x39bc19={'agent':{},'channel':_0x7382('0x56')};if(_0x1c4d96['body']['id']){delete _0x1c4d96[_0x7382('0x53')]['id'];}_0x1c4d96['body'][_0x7382('0x57')]=!![];_0x1c4d96['body'][_0x7382('0x58')]=moment()[_0x7382('0x59')](_0x7382('0x5a'));_0x1c4d96[_0x7382('0x53')][_0x7382('0x5b')]=_0x1c4d96[_0x7382('0x53')][_0x7382('0x5b')]||_0x1c4d96[_0x7382('0x5c')]['id'];_0x39bc19['agent']['id']=_0x1c4d96['body'][_0x7382('0x5b')];return db[_0x7382('0x38')][_0x7382('0x51')]({'where':{'id':_0x1c4d96['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d9b69,null))['then'](saveUpdates(_0x1c4d96[_0x7382('0x53')],null))['then'](function(_0x18dc83){if(_0x18dc83){_0x39bc19[_0x7382('0x25')]=_0x18dc83[_0x7382('0x5d')]({'plain':!![]});return db[_0x7382('0x5e')][_0x7382('0x51')]({'where':{'id':_0x18dc83[_0x7382('0x5f')]}});}return null;})[_0x7382('0x30')](handleEntityNotFound(_0x4d9b69,null))[_0x7382('0x30')](function(_0x2b17cd){if(_0x2b17cd){return _0x2b17cd[_0x7382('0x2f')]({'UserId':_0x1c4d96[_0x7382('0x53')][_0x7382('0x5b')],'read1stAt':_[_0x7382('0x60')](_0x2b17cd[_0x7382('0x61')])?moment()[_0x7382('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5d0b8e){if(_0x5d0b8e){_0x39bc19['interaction']=_0x5d0b8e['get']({'plain':!![]});interaction_log[_0x7382('0x1e')](_0x7382('0x62'),_0x1c4d96[_0x7382('0x5c')]['id'],_0x1c4d96['user'][_0x7382('0x35')],_0x1c4d96[_0x7382('0x5c')][_0x7382('0x63')],_0x39bc19[_0x7382('0x64')]['id'],_0x1c4d96[_0x7382('0x53')]?JSON[_0x7382('0x65')](_0x1c4d96[_0x7382('0x53')]):_0x7382('0x66'));return respondWithRpcPromise(_0x7382('0x67'),'acceptMessage',_0x39bc19);}return null;})[_0x7382('0x30')](function(_0xab5410){var _0x136531=_0x7382('0x68')+_0xab5410['message'][_0x7382('0x69')];return db[_0x7382('0x6a')][_0x7382('0x42')](_0x136531,{'type':db[_0x7382('0x6b')][_0x7382('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x57b287){return _0x57b287;});})[_0x7382('0x30')](function(_0x42c767){if(_0x42c767){_0x39bc19['message'][_0x7382('0x6d')]=_0x42c767[0x0];if(!_0x1c4d96[_0x7382('0x53')]['UserId'])return;return db[_0x7382('0x6e')]['find']({'where':{'id':_0x1c4d96[_0x7382('0x53')]['UserId'],'role':_0x7382('0x6f')},'attributes':['id',_0x7382('0x35'),'fullname','email',_0x7382('0x70')],'raw':!![]});}return null;})[_0x7382('0x30')](function(_0x456a1f){if(!_0x456a1f)return null;_0x39bc19[_0x7382('0x25')][_0x7382('0x6f')]=_0x456a1f;return _0x39bc19;})[_0x7382('0x30')](function(_0x523759){if(_0x523759){if(_0x1c4d96[_0x7382('0x53')][_0x7382('0x71')]){_0x39bc19[_0x7382('0x25')][_0x7382('0x72')]=util[_0x7382('0x59')](_0x7382('0x73'),_0x1c4d96['user'][_0x7382('0x35')]);_0x39bc19[_0x7382('0x25')][_0x7382('0x74')]=_0x39bc19[_0x7382('0x74')];_0x39bc19[_0x7382('0x25')][_0x7382('0x75')]=_0x39bc19[_0x7382('0x74')];_0x39bc19[_0x7382('0x25')][_0x7382('0x76')]=_0x7382('0x55');return respondWithRpcPromise('EventManager',_0x7382('0x77'),{'event':'acceptmessage','message':_0x39bc19[_0x7382('0x25')]},client9002)[_0x7382('0x30')](function(){return _0x39bc19;});}return _0x39bc19;}return null;})[_0x7382('0x30')](respondWithResult(_0x4d9b69,null))[_0x7382('0x4d')](handleError(_0x4d9b69,null));};var interaction_log=require('../../config/logger')(_0x7382('0x78'));exports[_0x7382('0x2e')]=function(_0x39251d,_0x4530c5,_0x14cb56){var _0x50d4cc={'agent':{},'channel':'openchannel'};if(_0x39251d[_0x7382('0x53')]['id']){delete _0x39251d['body']['id'];}_0x39251d[_0x7382('0x53')][_0x7382('0x5b')]=_0x39251d[_0x7382('0x53')]['UserId']||_0x39251d[_0x7382('0x5c')]['id'];_0x50d4cc[_0x7382('0x6f')]['id']=_0x39251d[_0x7382('0x53')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x39251d[_0x7382('0x54')]['id'],'UserId':null}})[_0x7382('0x30')](handleEntityNotFound(_0x4530c5,null))[_0x7382('0x30')](function(_0x557dc4){if(_0x557dc4){_0x50d4cc[_0x7382('0x25')]=_0x557dc4[_0x7382('0x5d')]({'plain':!![]});return db[_0x7382('0x5e')][_0x7382('0x51')]({'where':{'id':_0x557dc4[_0x7382('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x4530c5,null))[_0x7382('0x30')](function(_0x4d5ce9){if(_0x4d5ce9){_0x50d4cc[_0x7382('0x64')]=_0x4d5ce9[_0x7382('0x5d')]({'plain':!![]});interaction_log[_0x7382('0x1e')](_0x7382('0x79'),_0x39251d[_0x7382('0x5c')]['id'],_0x39251d['user'][_0x7382('0x35')],_0x39251d['user'][_0x7382('0x63')],_0x50d4cc['interaction']['id'],_0x39251d[_0x7382('0x53')]?JSON['stringify'](_0x39251d[_0x7382('0x53')]):_0x7382('0x66'));return respondWithRpcPromise(_0x7382('0x7a'),'rejectMessage',_0x50d4cc);}return null;})['then'](function(_0x10a2bb){var _0x487cb2=_0x7382('0x68')+_0x10a2bb[_0x7382('0x25')]['ContactId'];return db['sequelize'][_0x7382('0x42')](_0x487cb2,{'type':db[_0x7382('0x6b')][_0x7382('0x6c')][_0x7382('0x7b')],'raw':!![]})[_0x7382('0x30')](function(_0x361659){return _0x361659;});})[_0x7382('0x30')](function(_0x1801f8){if(_0x1801f8){_0x50d4cc[_0x7382('0x25')][_0x7382('0x6d')]=_0x1801f8[0x0];if(!_0x39251d['body']['UserId'])return;return db['User'][_0x7382('0x51')]({'where':{'id':_0x39251d[_0x7382('0x53')]['UserId'],'role':_0x7382('0x6f')},'attributes':['id',_0x7382('0x35'),'fullname',_0x7382('0x7c'),'internal'],'raw':!![]});}return null;})[_0x7382('0x30')](function(_0x3775ec){if(!_0x3775ec)return null;_0x50d4cc[_0x7382('0x25')][_0x7382('0x6f')]=_0x3775ec;return _0x50d4cc;})[_0x7382('0x30')](function(_0x4cc8db){if(_0x4cc8db){_0x4cc8db[_0x7382('0x25')][_0x7382('0x72')]=util['format'](_0x7382('0x73'),_0x39251d[_0x7382('0x5c')][_0x7382('0x35')]);_0x4cc8db[_0x7382('0x25')]['channel']=_0x50d4cc[_0x7382('0x74')];_0x4cc8db[_0x7382('0x25')][_0x7382('0x75')]=_0x50d4cc[_0x7382('0x74')];_0x4cc8db[_0x7382('0x25')][_0x7382('0x76')]=_0x7382('0x2e');respondWithRpcPromise('EventManager',_0x7382('0x77'),{'event':_0x7382('0x7d'),'message':_0x4cc8db['message']},client9002);return _0x50d4cc;}return null;})[_0x7382('0x30')](respondWithResult(_0x4530c5,null))['catch'](handleError(_0x4530c5,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index f9777cc..7548fd6 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 _0xc599=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x259145,_0x37b1af){var _0x2a1560=function(_0x52ab00){while(--_0x52ab00){_0x259145['push'](_0x259145['shift']());}};_0x2a1560(++_0x37b1af);}(_0xc599,0x131));var _0x9c59=function(_0xe8b9c7,_0x534838){_0xe8b9c7=_0xe8b9c7-0x0;var _0x4b606f=_0xc599[_0xe8b9c7];return _0x4b606f;};'use strict';var EventEmitter=require(_0x9c59('0x0'));var OpenchannelMessage=require(_0x9c59('0x1'))['db'][_0x9c59('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9c59('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c59('0x4'),'afterDestroy':_0x9c59('0x5')};function emitEvent(_0x5442ba){return function(_0x1a7c8,_0x3fcd3f,_0x36127d){OpenchannelMessageEvents[_0x9c59('0x6')](_0x5442ba+':'+_0x1a7c8['id'],_0x1a7c8);OpenchannelMessageEvents[_0x9c59('0x6')](_0x5442ba,_0x1a7c8);_0x36127d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9c59('0x7')](e,emitEvent(event));}}module[_0x9c59('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6d9f=['emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6d9f,0x16f));var _0xf6d9=function(_0x3d84f8,_0x436cb0){_0x3d84f8=_0x3d84f8-0x0;var _0xb7737b=_0x6d9f[_0x3d84f8];return _0xb7737b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xf6d9('0x0'))['db'][_0xf6d9('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf6d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf6d9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x767309){return function(_0xf98abf,_0x279741,_0x50c1d4){OpenchannelMessageEvents['emit'](_0x767309+':'+_0xf98abf['id'],_0xf98abf);OpenchannelMessageEvents[_0xf6d9('0x4')](_0x767309,_0xf98abf);_0x50c1d4(null);};}for(var e in events){if(events[_0xf6d9('0x5')](e)){var event=events[e];OpenchannelMessage[_0xf6d9('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 11cf8c1..594bf5d 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 _0x6aba=['OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','then','OpenchannelAccount','find','OpenchannelAccountId','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','Interaction','omit','POST','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x3aff6f,_0x23c8d8){var _0x4c37b5=function(_0x414a76){while(--_0x414a76){_0x3aff6f['push'](_0x3aff6f['shift']());}};_0x4c37b5(++_0x23c8d8);}(_0x6aba,0xe5));var _0xa6ab=function(_0xf8ef36,_0x587316){_0xf8ef36=_0xf8ef36-0x0;var _0x5eefb3=_0x6aba[_0xf8ef36];return _0x5eefb3;};'use strict';var _=require(_0xa6ab('0x0'));var util=require(_0xa6ab('0x1'));var logger=require(_0xa6ab('0x2'))('api');var moment=require(_0xa6ab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6ab('0x4'));var config=require(_0xa6ab('0x5'));var attributes=require(_0xa6ab('0x6'));module[_0xa6ab('0x7')]=function(_0x307783,_0x5a1ac6){return _0x307783[_0xa6ab('0x8')](_0xa6ab('0x9'),attributes,{'tableName':_0xa6ab('0xa'),'paranoid':![],'indexes':[{'name':_0xa6ab('0xb'),'fields':[_0xa6ab('0xc')],'type':_0xa6ab('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd800bd,_0x324499,_0x242a19){var _0x52b9dc=_0x307783['models'];var _0xe1e5d5=_0xd800bd[_0xa6ab('0xe')]({'plain':!![]});if(_0xe1e5d5[_0xa6ab('0xf')][_0xa6ab('0x10')]()==='in'||_0xe1e5d5[_0xa6ab('0xf')]['toLowerCase']()===_0xa6ab('0x11')&&!_0xe1e5d5[_0xa6ab('0x12')]&&!_[_0xa6ab('0x13')](_0xe1e5d5[_0xa6ab('0x14')])){_0x52b9dc[_0xa6ab('0x15')][_0xa6ab('0x16')]({'where':{'id':_0xe1e5d5[_0xa6ab('0x17')]}})['then'](function(_0x3e886a){if(_0x3e886a){_0x3e886a[_0xa6ab('0x18')]({'lastMsgAt':_0xe1e5d5[_0xa6ab('0x19')],'lastMsgDirection':_0xe1e5d5['direction'][_0xa6ab('0x10')]()});}})['catch'](function(_0x191cce){console[_0xa6ab('0x1a')](_0x191cce);});}if(_0xe1e5d5[_0xa6ab('0xf')]==='out'&&!_0xe1e5d5[_0xa6ab('0x12')]){var _0xebf042;_0x52b9dc['CmContact']['describe']()[_0xa6ab('0x1b')](function(_0x5f37c3){return _0x52b9dc[_0xa6ab('0x1c')][_0xa6ab('0x1d')]({'where':{'id':_0xe1e5d5[_0xa6ab('0x1e')]},'include':[{'model':_0x52b9dc[_0xa6ab('0x15')],'as':'Interactions','where':{'id':_0xe1e5d5[_0xa6ab('0x17')]},'limit':0x1,'include':[{'model':_0x52b9dc[_0xa6ab('0x1f')],'as':_0xa6ab('0x20'),'attributes':_[_0xa6ab('0x21')](_0x5f37c3)}]}]});})['then'](function(_0x2ef886){_0xebf042=_0x2ef886[_0xa6ab('0xe')]({'plain':!![]});if(_0xebf042&&_0xebf042[_0xa6ab('0x22')]){logger[_0xa6ab('0x23')](_0xa6ab('0x24'),'afterCreate',util[_0xa6ab('0x25')](_0xa6ab('0x26'),_0xe1e5d5['id'],_0xebf042['replyUri']));if(_0xebf042[_0xa6ab('0x27')]&&_0xebf042[_0xa6ab('0x27')]['length']){_0xe1e5d5[_0xa6ab('0x28')]=_[_0xa6ab('0x29')](_0xebf042[_0xa6ab('0x27')][0x0],_0xa6ab('0x20'));_0xe1e5d5[_0xa6ab('0x20')]=_0xebf042[_0xa6ab('0x27')][0x0][_0xa6ab('0x20')];}var _0x324499={'method':_0xa6ab('0x2a'),'uri':encodeURI(_0xebf042[_0xa6ab('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x324499['method']){case _0xa6ab('0x2b'):_0x324499['qs']=_0xe1e5d5;break;case _0xa6ab('0x2a'):_0x324499[_0xa6ab('0xc')]=_0xe1e5d5;break;}return rp(_0x324499)[_0xa6ab('0x1b')](function(_0x505d58){logger[_0xa6ab('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0xa6ab('0x2c'),util[_0xa6ab('0x25')](_0xa6ab('0x2d'),_0xe1e5d5['id'],_0xebf042['replyUri']));if(_0x505d58[_0xa6ab('0xc')][_0xa6ab('0x2e')]&&_0x505d58['body']['threadId']!=_0xe1e5d5[_0xa6ab('0x28')][_0xa6ab('0x2e')]){return _0x52b9dc[_0xa6ab('0x15')][_0xa6ab('0x18')]({'threadId':_0x505d58['body'][_0xa6ab('0x2e')]},{'where':{'id':_0xe1e5d5[_0xa6ab('0x28')]['id']}});}else{return;}})[_0xa6ab('0x1b')](function(){return _0xd800bd[_0xa6ab('0x18')]({'read':!![]});})[_0xa6ab('0x2f')](function(_0x5d938b){logger['error']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xa6ab('0x30')](_0x5d938b,{'showHidden':![],'depth':null}));_0x242a19();});}else{_0x242a19();}})[_0xa6ab('0x31')](function(){_0x242a19();});}else{_0x242a19();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5188=['OpenchannelInteraction','findOne','then','update','createdAt','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','replyUri','afterCreate','format','Interactions','Interaction','POST','method','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelMessage','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x37e0e6,_0x26696c){var _0x31b5dc=function(_0x548722){while(--_0x548722){_0x37e0e6['push'](_0x37e0e6['shift']());}};_0x31b5dc(++_0x26696c);}(_0x5188,0xb5));var _0x8518=function(_0x1f16b2,_0x56c918){_0x1f16b2=_0x1f16b2-0x0;var _0x31ff86=_0x5188[_0x1f16b2];return _0x31ff86;};'use strict';var _=require(_0x8518('0x0'));var util=require(_0x8518('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8518('0x2'));var BPromise=require(_0x8518('0x3'));var rp=require(_0x8518('0x4'));var fs=require('fs');var path=require(_0x8518('0x5'));var rimraf=require(_0x8518('0x6'));var config=require(_0x8518('0x7'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x76e96,_0x1afd32){return _0x76e96['define'](_0x8518('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x8518('0x9')],'type':_0x8518('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44f3a8,_0x5473cb,_0x395ac0){var _0x579c18=_0x76e96[_0x8518('0xb')];var _0x17d69c=_0x44f3a8[_0x8518('0xc')]({'plain':!![]});if(_0x17d69c[_0x8518('0xd')][_0x8518('0xe')]()==='in'||_0x17d69c[_0x8518('0xd')]['toLowerCase']()===_0x8518('0xf')&&!_0x17d69c[_0x8518('0x10')]&&!_[_0x8518('0x11')](_0x17d69c[_0x8518('0x12')])){_0x579c18[_0x8518('0x13')][_0x8518('0x14')]({'where':{'id':_0x17d69c['OpenchannelInteractionId']}})[_0x8518('0x15')](function(_0x27256f){if(_0x27256f){_0x27256f[_0x8518('0x16')]({'lastMsgAt':_0x17d69c[_0x8518('0x17')],'lastMsgDirection':_0x17d69c[_0x8518('0xd')][_0x8518('0xe')]()});}})['catch'](function(_0x44cc50){console[_0x8518('0x18')](_0x44cc50);});}if(_0x17d69c[_0x8518('0xd')]==='out'&&!_0x17d69c[_0x8518('0x10')]){var _0x5262c5;_0x579c18[_0x8518('0x19')][_0x8518('0x1a')]()[_0x8518('0x15')](function(_0xe731a5){return _0x579c18[_0x8518('0x1b')][_0x8518('0x1c')]({'where':{'id':_0x17d69c[_0x8518('0x1d')]},'include':[{'model':_0x579c18['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x17d69c[_0x8518('0x1e')]},'limit':0x1,'include':[{'model':_0x579c18[_0x8518('0x19')],'as':_0x8518('0x1f'),'attributes':_[_0x8518('0x20')](_0xe731a5)}]}]});})[_0x8518('0x15')](function(_0x5c7ca3){_0x5262c5=_0x5c7ca3[_0x8518('0xc')]({'plain':!![]});if(_0x5262c5&&_0x5262c5[_0x8518('0x21')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x8518('0x22'),util[_0x8518('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x17d69c['id'],_0x5262c5['replyUri']));if(_0x5262c5[_0x8518('0x24')]&&_0x5262c5[_0x8518('0x24')]['length']){_0x17d69c[_0x8518('0x25')]=_['omit'](_0x5262c5[_0x8518('0x24')][0x0],'Contact');_0x17d69c[_0x8518('0x1f')]=_0x5262c5['Interactions'][0x0]['Contact'];}var _0x5473cb={'method':_0x8518('0x26'),'uri':encodeURI(_0x5262c5[_0x8518('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5473cb[_0x8518('0x27')]){case _0x8518('0x28'):_0x5473cb['qs']=_0x17d69c;break;case'POST':_0x5473cb[_0x8518('0x9')]=_0x17d69c;break;}return rp(_0x5473cb)['then'](function(_0x1818d9){logger[_0x8518('0x29')](_0x8518('0x2a'),'afterCreate',util[_0x8518('0x23')](_0x8518('0x2b'),_0x17d69c['id'],_0x5262c5[_0x8518('0x21')]));if(_0x1818d9[_0x8518('0x9')]['threadId']&&_0x1818d9[_0x8518('0x9')][_0x8518('0x2c')]!=_0x17d69c[_0x8518('0x25')]['threadId']){return _0x579c18[_0x8518('0x13')]['update']({'threadId':_0x1818d9[_0x8518('0x9')][_0x8518('0x2c')]},{'where':{'id':_0x17d69c['Interaction']['id']}});}else{return;}})[_0x8518('0x15')](function(){return _0x44f3a8[_0x8518('0x16')]({'read':!![]});})[_0x8518('0x2d')](function(_0xfeb29f){logger[_0x8518('0x18')](_0x8518('0x2a'),_0x8518('0x22'),util[_0x8518('0x2e')](_0xfeb29f,{'showHidden':![],'depth':null}));_0x395ac0();});}else{_0x395ac0();}})[_0x8518('0x2f')](function(){_0x395ac0();});}else{_0x395ac0();}}},'charset':_0x8518('0x30'),'collate':_0x8518('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c77c6f2..77915da 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ce76a,_0x2462f2){var _0x538e7e=function(_0x19dc75){while(--_0x19dc75){_0x2ce76a['push'](_0x2ce76a['shift']());}};_0x538e7e(++_0x2462f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2d9d59,_0x2e383e){_0x2d9d59=_0x2d9d59-0x0;var _0x4ee6a6=_0x5f2f[_0x2d9d59];return _0x4ee6a6;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x245e45,_0x5ce75d){var _0x1554b5=function(_0x426145){while(--_0x426145){_0x245e45['push'](_0x245e45['shift']());}};_0x1554b5(++_0x5ce75d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 390779a..da1d28e 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 _0xde81=['save','remove','update','removeListener','register','length','./openchannelMessage.events'];(function(_0x251fa8,_0x438d42){var _0x3d89e9=function(_0x5f91dc){while(--_0x5f91dc){_0x251fa8['push'](_0x251fa8['shift']());}};_0x3d89e9(++_0x438d42);}(_0xde81,0x109));var _0x1de8=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0xde81[_0x455f19];return _0x422f21;};'use strict';var OpenchannelMessageEvents=require(_0x1de8('0x0'));var events=[_0x1de8('0x1'),_0x1de8('0x2'),_0x1de8('0x3')];function createListener(_0x16911a,_0x21db66){return function(_0x52a51a){_0x21db66['emit'](_0x16911a,_0x52a51a);};}function removeListener(_0xebfcf9,_0x5953a6){return function(){OpenchannelMessageEvents[_0x1de8('0x4')](_0xebfcf9,_0x5953a6);};}exports[_0x1de8('0x5')]=function(_0x42801a){for(var _0x3ae723=0x0,_0x22918e=events[_0x1de8('0x6')];_0x3ae723<_0x22918e;_0x3ae723++){var _0x435404=events[_0x3ae723];var _0x5ae9ca=createListener('openchannelMessage:'+_0x435404,_0x42801a);OpenchannelMessageEvents['on'](_0x435404,_0x5ae9ca);}}; \ No newline at end of file +var _0x9eb7=['removeListener','length','openchannelMessage:','remove','update','emit'];(function(_0x1a3743,_0x11c62b){var _0x54221d=function(_0x56a9d6){while(--_0x56a9d6){_0x1a3743['push'](_0x1a3743['shift']());}};_0x54221d(++_0x11c62b);}(_0x9eb7,0x117));var _0x79eb=function(_0x53c5fc,_0x5d45de){_0x53c5fc=_0x53c5fc-0x0;var _0x3465d6=_0x9eb7[_0x53c5fc];return _0x3465d6;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x79eb('0x0'),_0x79eb('0x1')];function createListener(_0x13115,_0x354996){return function(_0x48cea0){_0x354996[_0x79eb('0x2')](_0x13115,_0x48cea0);};}function removeListener(_0x59ba07,_0x53c385){return function(){OpenchannelMessageEvents[_0x79eb('0x3')](_0x59ba07,_0x53c385);};}exports['register']=function(_0x44788c){for(var _0x492ad5=0x0,_0x333b61=events[_0x79eb('0x4')];_0x492ad5<_0x333b61;_0x492ad5++){var _0x55bfe7=events[_0x492ad5];var _0x131b99=createListener(_0x79eb('0x5')+_0x55bfe7,_0x44788c);OpenchannelMessageEvents['on'](_0x55bfe7,_0x131b99);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5616ec5..9c0bffe 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 _0x139a=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x139a,0x1a4));var _0xa139=function(_0x4ddd99,_0x40627a){_0x4ddd99=_0x4ddd99-0x0;var _0x35b9b4=_0x139a[_0x4ddd99];return _0x35b9b4;};'use strict';var multer=require(_0xa139('0x0'));var util=require('util');var path=require(_0xa139('0x1'));var timeout=require(_0xa139('0x2'));var express=require(_0xa139('0x3'));var router=express[_0xa139('0x4')]();var fs_extra=require(_0xa139('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa139('0x6'));var config=require(_0xa139('0x7'));var controller=require(_0xa139('0x8'));router[_0xa139('0x9')]('/',auth[_0xa139('0xa')](),controller[_0xa139('0xb')]);router[_0xa139('0x9')](_0xa139('0xc'),auth[_0xa139('0xa')](),controller['describe']);router[_0xa139('0x9')](_0xa139('0xd'),auth['isAuthenticated'](),controller[_0xa139('0xe')]);router['get'](_0xa139('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa139('0x9')]('/:id/teams',auth[_0xa139('0xa')](),controller[_0xa139('0x10')]);router[_0xa139('0x9')](_0xa139('0x11'),auth[_0xa139('0xa')](),controller['getAgents']);router[_0xa139('0x12')]('/',auth[_0xa139('0xa')](),controller[_0xa139('0x13')]);router[_0xa139('0x12')](_0xa139('0x14'),auth[_0xa139('0xa')](),controller[_0xa139('0x15')]);router[_0xa139('0x12')](_0xa139('0x11'),auth[_0xa139('0xa')](),controller[_0xa139('0x16')]);router[_0xa139('0x17')]('/:id',auth[_0xa139('0xa')](),controller[_0xa139('0x18')]);router[_0xa139('0x19')](_0xa139('0xd'),auth[_0xa139('0xa')](),controller[_0xa139('0x1a')]);router['delete'](_0xa139('0x14'),auth[_0xa139('0xa')](),controller[_0xa139('0x1b')]);router['delete']('/:id/users',auth[_0xa139('0xa')](),controller[_0xa139('0x1c')]);module[_0xa139('0x1d')]=router; \ No newline at end of file +var _0xf83d=['/:id/teams','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create'];(function(_0x3feaba,_0x42e1bd){var _0x3fccc9=function(_0xdf964a){while(--_0xdf964a){_0x3feaba['push'](_0x3feaba['shift']());}};_0x3fccc9(++_0x42e1bd);}(_0xf83d,0x1d3));var _0xdf83=function(_0x25a928,_0x4c440b){_0x25a928=_0x25a928-0x0;var _0x4e5a3c=_0xf83d[_0x25a928];return _0x4e5a3c;};'use strict';var multer=require(_0xdf83('0x0'));var util=require(_0xdf83('0x1'));var path=require(_0xdf83('0x2'));var timeout=require(_0xdf83('0x3'));var express=require(_0xdf83('0x4'));var router=express[_0xdf83('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf83('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xdf83('0x7')]('/',auth[_0xdf83('0x8')](),controller[_0xdf83('0x9')]);router[_0xdf83('0x7')]('/describe',auth[_0xdf83('0x8')](),controller[_0xdf83('0xa')]);router[_0xdf83('0x7')](_0xdf83('0xb'),auth[_0xdf83('0x8')](),controller['show']);router['get'](_0xdf83('0xc'),auth[_0xdf83('0x8')](),controller[_0xdf83('0xd')]);router[_0xdf83('0x7')]('/:id/teams',auth[_0xdf83('0x8')](),controller[_0xdf83('0xe')]);router[_0xdf83('0x7')](_0xdf83('0xf'),auth[_0xdf83('0x8')](),controller[_0xdf83('0x10')]);router[_0xdf83('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf83('0x12')]);router['post'](_0xdf83('0x13'),auth[_0xdf83('0x8')](),controller[_0xdf83('0x14')]);router[_0xdf83('0x11')](_0xdf83('0xf'),auth[_0xdf83('0x8')](),controller[_0xdf83('0x15')]);router['put'](_0xdf83('0xb'),auth[_0xdf83('0x8')](),controller[_0xdf83('0x16')]);router[_0xdf83('0x17')](_0xdf83('0xb'),auth[_0xdf83('0x8')](),controller[_0xdf83('0x18')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xdf83('0x17')]('/:id/users',auth[_0xdf83('0x8')](),controller[_0xdf83('0x19')]);module[_0xdf83('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7d5f31a..afe357f 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 _0xadc8=['roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xadc8,0xf1));var _0x8adc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadc8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8adc('0x0'));module['exports']={'name':{'type':Sequelize[_0x8adc('0x1')],'unique':_0x8adc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8adc('0x1')]},'timeout':{'type':Sequelize[_0x8adc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8adc('0x4')]('rrmemory','beepall',_0x8adc('0x5'))}}; \ No newline at end of file +var _0x3edb=['INTEGER','ENUM','roundrobin','sequelize','STRING'];(function(_0x4a05b0,_0x53b480){var _0x321adc=function(_0x19bb8c){while(--_0x19bb8c){_0x4a05b0['push'](_0x4a05b0['shift']());}};_0x321adc(++_0x53b480);}(_0x3edb,0x170));var _0xb3ed=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3edb[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0xb3ed('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb3ed('0x1')]},'timeout':{'type':Sequelize[_0xb3ed('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb3ed('0x3')]('rrmemory','beepall',_0xb3ed('0x4'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 542d968..fec38c6 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 _0x62a7=['userOpenchannelQueue:remove','getAgents','eml-format','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','offset','count','limit','set','json','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','Team','rawAttributes','ids','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','forEach','userOpenchannelQueue:save','findAll','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','removeAgents','emit','addAgents','omit','spread'];(function(_0x2c39b4,_0x1875ca){var _0x25dc5e=function(_0x34b8fd){while(--_0x34b8fd){_0x2c39b4['push'](_0x2c39b4['shift']());}};_0x25dc5e(++_0x1875ca);}(_0x62a7,0x191));var _0x762a=function(_0x337216,_0x4184e2){_0x337216=_0x337216-0x0;var _0x113fdb=_0x62a7[_0x337216];return _0x113fdb;};'use strict';var emlformat=require(_0x762a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x762a('0x1'));var Mustache=require('mustache');var util=require(_0x762a('0x2'));var path=require(_0x762a('0x3'));var sox=require('sox');var csv=require(_0x762a('0x4'));var ejs=require(_0x762a('0x5'));var fs=require('fs');var fs_extra=require(_0x762a('0x6'));var _=require('lodash');var squel=require(_0x762a('0x7'));var crypto=require(_0x762a('0x8'));var jsforce=require(_0x762a('0x9'));var deskjs=require(_0x762a('0xa'));var toCsv=require(_0x762a('0x4'));var querystring=require(_0x762a('0xb'));var Papa=require(_0x762a('0xc'));var Redis=require('ioredis');var authService=require(_0x762a('0xd'));var qs=require(_0x762a('0xe'));var as=require(_0x762a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x762a('0x10'))(_0x762a('0x11'));var utils=require(_0x762a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x762a('0x13'));var db=require('../../mysqldb')['db'];config[_0x762a('0x14')]=_[_0x762a('0x15')](config[_0x762a('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x762a('0x16'))(new Redis(config[_0x762a('0x14')]));require(_0x762a('0x17'))['register'](socket);function respondWithStatusCode(_0x2e010e,_0x18a5e7){_0x18a5e7=_0x18a5e7||0xcc;return function(_0x5dae47){if(_0x5dae47){return _0x2e010e[_0x762a('0x18')](_0x18a5e7);}return _0x2e010e['status'](_0x18a5e7)[_0x762a('0x19')]();};}function respondWithResult(_0x3351af,_0x5944d0){_0x5944d0=_0x5944d0||0xc8;return function(_0x4a0091){if(_0x4a0091){return _0x3351af[_0x762a('0x1a')](_0x5944d0)['json'](_0x4a0091);}};}function respondWithFilteredResult(_0x3efe17,_0x156b46){return function(_0x451e98){if(_0x451e98){var _0x1a27e2=typeof _0x156b46[_0x762a('0x1b')]==='undefined'&&typeof _0x156b46['limit']==='undefined';var _0x578cbc=_0x451e98[_0x762a('0x1c')];var _0x5b8e5a=_0x1a27e2?0x0:_0x156b46[_0x762a('0x1b')];var _0x4003a2=_0x1a27e2?_0x451e98[_0x762a('0x1c')]:_0x156b46[_0x762a('0x1b')]+_0x156b46[_0x762a('0x1d')];var _0x1d8854;if(_0x4003a2>=_0x578cbc){_0x4003a2=_0x578cbc;_0x1d8854=0xc8;}else{_0x1d8854=0xce;}_0x3efe17[_0x762a('0x1a')](_0x1d8854);return _0x3efe17[_0x762a('0x1e')]('Content-Range',_0x5b8e5a+'-'+_0x4003a2+'/'+_0x578cbc)[_0x762a('0x1f')](_0x451e98);}return null;};}function patchUpdates(_0x4e8555){return function(_0x4762e4){try{jsonpatch['apply'](_0x4762e4,_0x4e8555,!![]);}catch(_0x368441){return BPromise[_0x762a('0x20')](_0x368441);}return _0x4762e4[_0x762a('0x21')]();};}function saveUpdates(_0x615572,_0x436b48){return function(_0x42bcdf){if(_0x42bcdf){return _0x42bcdf[_0x762a('0x22')](_0x615572)[_0x762a('0x23')](function(_0x3da667){return _0x3da667;});}return null;};}function removeEntity(_0x1b660f,_0x3a80f1){return function(_0x13e8b6){if(_0x13e8b6){return _0x13e8b6[_0x762a('0x24')]()[_0x762a('0x23')](function(){var _0x479c5b=_0x13e8b6[_0x762a('0x25')]({'plain':!![]});var _0x1b0a6e=_0x762a('0x26');return db[_0x762a('0x27')][_0x762a('0x24')]({'where':{'type':_0x1b0a6e,'resourceId':_0x479c5b['id']}})[_0x762a('0x23')](function(){return _0x13e8b6;});})['then'](function(){_0x1b660f[_0x762a('0x1a')](0xcc)[_0x762a('0x19')]();});}};}function handleEntityNotFound(_0x1fe2c1,_0x6cc057){return function(_0x12d486){if(!_0x12d486){_0x1fe2c1[_0x762a('0x18')](0x194);}return _0x12d486;};}function handleError(_0x575066,_0x4fa0ad){_0x4fa0ad=_0x4fa0ad||0x1f4;return function(_0x5f22b7){logger[_0x762a('0x28')](_0x5f22b7[_0x762a('0x29')]);if(_0x5f22b7[_0x762a('0x2a')]){delete _0x5f22b7[_0x762a('0x2a')];}_0x575066[_0x762a('0x1a')](_0x4fa0ad)[_0x762a('0x2b')](_0x5f22b7);};}exports['index']=function(_0x1d2f35,_0x5cce4c){var _0x3b721d={},_0x46084c={},_0x5e4321={'count':0x0,'rows':[]};var _0x3306a0=_[_0x762a('0x2c')](db[_0x762a('0x2d')]['rawAttributes'],function(_0x5b2626){return{'name':_0x5b2626[_0x762a('0x2e')],'type':_0x5b2626[_0x762a('0x2f')][_0x762a('0x30')]};});_0x46084c[_0x762a('0x31')]=_['map'](_0x3306a0,_0x762a('0x2a'));_0x46084c[_0x762a('0x32')]=_[_0x762a('0x33')](_0x1d2f35[_0x762a('0x32')]);_0x46084c['filters']=_[_0x762a('0x34')](_0x46084c[_0x762a('0x31')],_0x46084c[_0x762a('0x32')]);_0x3b721d[_0x762a('0x35')]=_[_0x762a('0x34')](_0x46084c[_0x762a('0x31')],qs['fields'](_0x1d2f35[_0x762a('0x32')][_0x762a('0x36')]));_0x3b721d['attributes']=_0x3b721d[_0x762a('0x35')][_0x762a('0x37')]?_0x3b721d[_0x762a('0x35')]:_0x46084c['model'];if(!_0x1d2f35['query'][_0x762a('0x38')](_0x762a('0x39'))){_0x3b721d[_0x762a('0x1d')]=qs[_0x762a('0x1d')](_0x1d2f35[_0x762a('0x32')][_0x762a('0x1d')]);_0x3b721d[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x1d2f35[_0x762a('0x32')]['offset']);}_0x3b721d['order']=qs[_0x762a('0x3a')](_0x1d2f35[_0x762a('0x32')][_0x762a('0x3a')]);_0x3b721d[_0x762a('0x3b')]=qs['filters'](_[_0x762a('0x3c')](_0x1d2f35[_0x762a('0x32')],_0x46084c[_0x762a('0x3d')]),_0x3306a0);if(_0x1d2f35[_0x762a('0x32')]['filter']){_0x3b721d[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x3b721d[_0x762a('0x3b')],{'$or':_[_0x762a('0x2c')](_0x3306a0,function(_0x23b452){if(_0x23b452[_0x762a('0x2f')]!==_0x762a('0x3f')){var _0x80a14c={};_0x80a14c[_0x23b452[_0x762a('0x2a')]]={'$like':'%'+_0x1d2f35['query'][_0x762a('0x40')]+'%'};return _0x80a14c;}})});}_0x3b721d=_[_0x762a('0x3e')]({},_0x3b721d,_0x1d2f35[_0x762a('0x41')]);var _0xc41f17={'where':_0x3b721d[_0x762a('0x3b')]};return db[_0x762a('0x2d')]['count'](_0xc41f17)['then'](function(_0x330c55){_0x5e4321[_0x762a('0x1c')]=_0x330c55;if(_0x1d2f35[_0x762a('0x32')][_0x762a('0x42')]){_0x3b721d['include']=[{'all':!![]}];}return db[_0x762a('0x2d')]['findAll'](_0x3b721d);})[_0x762a('0x23')](function(_0xaffa48){_0x5e4321[_0x762a('0x43')]=_0xaffa48;return _0x5e4321;})[_0x762a('0x23')](respondWithFilteredResult(_0x5cce4c,_0x3b721d))[_0x762a('0x44')](handleError(_0x5cce4c,null));};exports[_0x762a('0x45')]=function(_0x1d8e95,_0x119703){var _0x592c24={'raw':!![],'where':{'id':_0x1d8e95[_0x762a('0x46')]['id']}},_0x18e616={};_0x18e616[_0x762a('0x31')]=_[_0x762a('0x33')](db[_0x762a('0x2d')]['rawAttributes']);_0x18e616['query']=_['keys'](_0x1d8e95[_0x762a('0x32')]);_0x18e616[_0x762a('0x3d')]=_[_0x762a('0x34')](_0x18e616[_0x762a('0x31')],_0x18e616[_0x762a('0x32')]);_0x592c24['attributes']=_[_0x762a('0x34')](_0x18e616[_0x762a('0x31')],qs[_0x762a('0x36')](_0x1d8e95['query'][_0x762a('0x36')]));_0x592c24[_0x762a('0x35')]=_0x592c24[_0x762a('0x35')][_0x762a('0x37')]?_0x592c24['attributes']:_0x18e616['model'];if(_0x1d8e95[_0x762a('0x32')][_0x762a('0x42')]){_0x592c24[_0x762a('0x47')]=[{'all':!![]}];}_0x592c24=_[_0x762a('0x3e')]({},_0x592c24,_0x1d8e95['options']);return db[_0x762a('0x2d')][_0x762a('0x48')](_0x592c24)[_0x762a('0x23')](handleEntityNotFound(_0x119703,null))[_0x762a('0x23')](respondWithResult(_0x119703,null))[_0x762a('0x44')](handleError(_0x119703,null));};exports[_0x762a('0x49')]=function(_0x47dc39,_0x43b5d1){return db[_0x762a('0x2d')][_0x762a('0x49')](_0x47dc39['body'],{})[_0x762a('0x23')](function(_0x4434ad){var _0x36146d=_0x47dc39['user'][_0x762a('0x25')]({'plain':!![]});if(!_0x36146d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36146d[_0x762a('0x4a')]===_0x762a('0x4b')){var _0x31c19c=_0x4434ad[_0x762a('0x25')]({'plain':!![]});var _0x587883=_0x762a('0x26');return db[_0x762a('0x4c')][_0x762a('0x48')]({'where':{'name':_0x587883,'userProfileId':_0x36146d[_0x762a('0x4d')]},'raw':!![]})[_0x762a('0x23')](function(_0x678d80){if(_0x678d80&&_0x678d80[_0x762a('0x4e')]===0x0){return db['UserProfileResource'][_0x762a('0x49')]({'name':_0x31c19c['name'],'resourceId':_0x31c19c['id'],'type':_0x678d80['name'],'sectionId':_0x678d80['id']},{})[_0x762a('0x23')](function(){return _0x4434ad;});}else{return _0x4434ad;}})[_0x762a('0x44')](function(_0x26e934){logger['error'](_0x762a('0x4f'),_0x26e934);throw _0x26e934;});}return _0x4434ad;})['then'](respondWithResult(_0x43b5d1,0xc9))['catch'](handleError(_0x43b5d1,null));};exports[_0x762a('0x22')]=function(_0xcf6897,_0x479beb){if(_0xcf6897['body']['id']){delete _0xcf6897[_0x762a('0x50')]['id'];}return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0xcf6897[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x479beb,null))[_0x762a('0x23')](saveUpdates(_0xcf6897['body'],null))[_0x762a('0x23')](respondWithResult(_0x479beb,null))[_0x762a('0x44')](handleError(_0x479beb,null));};exports[_0x762a('0x24')]=function(_0xeef6b1,_0x255638){return db['OpenchannelQueue'][_0x762a('0x48')]({'where':{'id':_0xeef6b1['params']['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x255638,null))[_0x762a('0x23')](removeEntity(_0x255638,null))[_0x762a('0x44')](handleError(_0x255638,null));};exports['describe']=function(_0x1802a9,_0x4f1196){return db[_0x762a('0x2d')][_0x762a('0x51')]()[_0x762a('0x23')](respondWithResult(_0x4f1196,null))[_0x762a('0x44')](handleError(_0x4f1196,null));};exports[_0x762a('0x52')]=function(_0x398c56,_0x4acbcd,_0x2e7743){var _0x8db0e8={'raw':!![],'where':{}},_0x50844e={},_0x3d2381;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x398c56['params']['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x4acbcd,null))[_0x762a('0x23')](function(_0x4d291f){if(_0x4d291f){_0x3d2381=_0x4d291f[_0x762a('0x25')]({'plain':!![]});_0x50844e[_0x762a('0x31')]=_['keys'](db[_0x762a('0x54')]['rawAttributes']);_0x50844e[_0x762a('0x32')]=_[_0x762a('0x33')](_0x398c56[_0x762a('0x32')]);_0x50844e[_0x762a('0x3d')]=_['intersection'](_0x50844e[_0x762a('0x31')],_0x50844e['query']);_0x8db0e8['attributes']=_['intersection'](_0x50844e[_0x762a('0x31')],qs[_0x762a('0x36')](_0x398c56[_0x762a('0x32')]['fields']));_0x8db0e8[_0x762a('0x35')]=_0x8db0e8['attributes']['length']?_0x8db0e8['attributes']:_0x50844e[_0x762a('0x31')];if(!_0x398c56[_0x762a('0x32')][_0x762a('0x38')](_0x762a('0x39'))){_0x8db0e8['limit']=qs['limit'](_0x398c56[_0x762a('0x32')][_0x762a('0x1d')]);_0x8db0e8[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x398c56[_0x762a('0x32')][_0x762a('0x1b')]);}_0x8db0e8[_0x762a('0x55')]=qs['sort'](_0x398c56[_0x762a('0x32')][_0x762a('0x3a')]);_0x8db0e8[_0x762a('0x3b')]=qs['filters'](_['pick'](_0x398c56[_0x762a('0x32')],_0x50844e[_0x762a('0x3d')]));_0x8db0e8['where'][_0x762a('0x56')]=_0x4d291f['id'];if(_0x398c56[_0x762a('0x32')][_0x762a('0x40')]){_0x8db0e8[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x8db0e8[_0x762a('0x3b')],{'$or':_['map'](_0x8db0e8[_0x762a('0x35')],function(_0x32fcb0){var _0x3bc833={};_0x3bc833[_0x32fcb0]={'$like':'%'+_0x398c56['query'][_0x762a('0x40')]+'%'};return _0x3bc833;})});}_0x8db0e8=_[_0x762a('0x3e')]({},_0x8db0e8,_0x398c56[_0x762a('0x41')]);return db[_0x762a('0x54')]['findAll'](_0x8db0e8);}})['then'](function(_0x213f0f){if(_0x213f0f){return db[_0x762a('0x57')][_0x762a('0x58')]({'where':{'id':_[_0x762a('0x2c')](_0x213f0f,_0x762a('0x59')),'role':_0x762a('0x5a')},'attributes':['id',_0x762a('0x2a'),'openchannelPause',_0x762a('0x5b'),_0x762a('0x5c')]});}})[_0x762a('0x23')](function(_0x42037b){if(_0x42037b){return{'count':_0x42037b[_0x762a('0x1c')],'rows':_[_0x762a('0x2c')](_0x42037b['rows'],function(_0x289e33){return{'membername':_0x289e33['name'],'UserId':_0x289e33['id'],'queue_name':_0x3d2381['name'],'OpenchannelQueueId':_0x3d2381['id'],'interface':util[_0x762a('0x5d')](_0x762a('0x5e'),'SIP',_0x289e33[_0x762a('0x2a')]),'penalty':0x0,'paused':_0x289e33[_0x762a('0x5f')],'createdAt':_0x289e33[_0x762a('0x5c')],'updatedAt':_0x289e33[_0x762a('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4acbcd,_0x8db0e8))[_0x762a('0x44')](handleError(_0x4acbcd,null));};exports[_0x762a('0x60')]=function(_0x4d4cba,_0x4bf92d,_0x314acf){var _0x42b3f6={};var _0x2feb9a={};var _0x297960;var _0x1e1210;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x4d4cba['params']['id']}})['then'](handleEntityNotFound(_0x4bf92d,null))[_0x762a('0x23')](function(_0x1a9b37){if(_0x1a9b37){_0x297960=_0x1a9b37;_0x2feb9a[_0x762a('0x31')]=_[_0x762a('0x33')](db[_0x762a('0x61')][_0x762a('0x62')]);_0x2feb9a[_0x762a('0x32')]=_[_0x762a('0x33')](_0x4d4cba['query']);_0x2feb9a[_0x762a('0x3d')]=_[_0x762a('0x34')](_0x2feb9a[_0x762a('0x31')],_0x2feb9a[_0x762a('0x32')]);_0x42b3f6[_0x762a('0x35')]=_[_0x762a('0x34')](_0x2feb9a[_0x762a('0x31')],qs[_0x762a('0x36')](_0x4d4cba[_0x762a('0x32')][_0x762a('0x36')]));_0x42b3f6[_0x762a('0x35')]=_0x42b3f6[_0x762a('0x35')]['length']?_0x42b3f6[_0x762a('0x35')]:_0x2feb9a[_0x762a('0x31')];_0x42b3f6[_0x762a('0x55')]=qs[_0x762a('0x3a')](_0x4d4cba['query'][_0x762a('0x3a')]);_0x42b3f6[_0x762a('0x3b')]=qs[_0x762a('0x3d')](_[_0x762a('0x3c')](_0x4d4cba[_0x762a('0x32')],_0x2feb9a[_0x762a('0x3d')]));if(_0x4d4cba[_0x762a('0x32')][_0x762a('0x40')]){_0x42b3f6[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0x42b3f6[_0x762a('0x3b')],{'$or':_['map'](_0x42b3f6[_0x762a('0x35')],function(_0x1b7201){var _0x1d1a3c={};_0x1d1a3c[_0x1b7201]={'$like':'%'+_0x4d4cba[_0x762a('0x32')]['filter']+'%'};return _0x1d1a3c;})});}_0x42b3f6=_[_0x762a('0x3e')]({},_0x42b3f6,_0x4d4cba[_0x762a('0x41')]);return _0x297960['getTeams'](_0x42b3f6);}})[_0x762a('0x23')](function(_0x35d83d){if(_0x35d83d){_0x1e1210=_0x35d83d[_0x762a('0x37')];if(!_0x4d4cba['query'][_0x762a('0x38')](_0x762a('0x39'))){_0x42b3f6[_0x762a('0x1d')]=qs['limit'](_0x4d4cba[_0x762a('0x32')][_0x762a('0x1d')]);_0x42b3f6[_0x762a('0x1b')]=qs[_0x762a('0x1b')](_0x4d4cba[_0x762a('0x32')][_0x762a('0x1b')]);}return _0x297960[_0x762a('0x60')](_0x42b3f6);}})[_0x762a('0x23')](function(_0x35bf8b){if(_0x35bf8b){return _0x35bf8b?{'count':_0x1e1210,'rows':_0x35bf8b}:null;}})[_0x762a('0x23')](respondWithResult(_0x4bf92d,null))[_0x762a('0x44')](handleError(_0x4bf92d,null));};exports['addTeams']=function(_0x2cfd44,_0x513b98,_0x404cab){var _0x16f805=_0x2cfd44[_0x762a('0x50')][_0x762a('0x63')];return db[_0x762a('0x61')]['findAll']({'where':{'id':_0x16f805},'attributes':['id'],'include':[{'model':db[_0x762a('0x57')],'as':'Agents','attributes':['id',_0x762a('0x2a'),'online',_0x762a('0x64'),_0x762a('0x65')],'raw':!![]}]})[_0x762a('0x23')](function(_0x586289){if(_0x586289){var _0x4a08b2=_[_0x762a('0x66')](_0x586289,function(_0x33ec6a){var _0x413060=_0x33ec6a[_0x762a('0x25')]({'plain':!![]});return _0x413060[_0x762a('0x67')];});return db[_0x762a('0x2d')]['find']({'where':{'id':_0x2cfd44['params']['id']}})[_0x762a('0x23')](function(_0x26be1b){return db[_0x762a('0x68')]['transaction'](function(_0x1ebb95){return _0x26be1b[_0x762a('0x69')](_0x16f805,{'transaction':_0x1ebb95})[_0x762a('0x23')](function(){return BPromise[_0x762a('0x6a')](_0x4a08b2,function(_0x36d04f){return db[_0x762a('0x54')]['findOrCreate']({'where':{'UserId':_0x36d04f['id'],'OpenchannelQueueId':_0x2cfd44[_0x762a('0x46')]['id']},'transaction':_0x1ebb95});});})[_0x762a('0x23')](function(){_0x4a08b2[_0x762a('0x6b')](function(_0x2b5227){socket['emit'](_0x762a('0x6c'),{'UserId':_0x2b5227['id'],'OpenchannelQueueId':_0x26be1b['id']});});});});});}})[_0x762a('0x23')](respondWithStatusCode(_0x513b98,null))[_0x762a('0x44')](handleError(_0x513b98,null));};exports['removeTeams']=function(_0x24c66e,_0x49860,_0xca4667){return db[_0x762a('0x61')][_0x762a('0x6d')]({'where':{'id':_0x24c66e[_0x762a('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x762a('0x57')],'as':_0x762a('0x67'),'attributes':['id'],'raw':!![]}]})[_0x762a('0x23')](handleEntityNotFound(_0x49860,null))[_0x762a('0x23')](function(_0xd64eba){var _0x5c6a56=_[_0x762a('0x2c')](_0xd64eba,'id');var _0x5f39ab=[];var _0x2e0997=[];var _0x358d28=squel[_0x762a('0x6e')]();_0x358d28[_0x762a('0x6f')]('tq.TeamId')[_0x762a('0x70')](_0x762a('0x71'),'tq')[_0x762a('0x72')](_0x762a('0x73'),'ut',_0x762a('0x74'))['where'](_0x762a('0x75'),_0x24c66e[_0x762a('0x46')]['id']);for(var _0x232651=0x0;_0x232651<_0xd64eba[_0x762a('0x37')];_0x232651+=0x1){let _0x2cc853=_0xd64eba[_0x232651];for(var _0x1e0b27=0x0;_0x1e0b27<_0x2cc853[_0x762a('0x67')][_0x762a('0x37')];_0x1e0b27+=0x1){let _0x1abe88=_0x2cc853['Agents'][_0x1e0b27];var _0x27e7ac=_0x358d28['clone']();_0x27e7ac[_0x762a('0x3b')](_0x762a('0x76'),_0x1abe88['id']);_0x2e0997[_0x762a('0x77')](db['sequelize'][_0x762a('0x32')](_0x27e7ac[_0x762a('0x78')](),{'type':db[_0x762a('0x68')][_0x762a('0x79')][_0x762a('0x7a')]})[_0x762a('0x23')](function(_0x5b6dc9){if(_0x5b6dc9[_0x762a('0x37')]===0x1){return _0x1abe88['id'];}else{var _0x3315a8=_['every'](_[_0x762a('0x2c')](_0x5b6dc9,_0x762a('0x7b')),function(_0x4ba472){return _[_0x762a('0x7c')](_0x5c6a56,_0x4ba472);});if(_0x3315a8){return _0x1abe88['id'];}}}));}}return BPromise['all'](_0x2e0997)[_0x762a('0x23')](function(_0x2ea529){_0x5f39ab=_(_0x5f39ab)['union'](_0x2ea529)[_0x762a('0x7d')]()['value']();return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x24c66e[_0x762a('0x46')]['id']}})[_0x762a('0x23')](function(_0x4f81ec){return db[_0x762a('0x68')]['transaction'](function(_0x148044){return _0x4f81ec['removeTeams'](_0x24c66e[_0x762a('0x32')][_0x762a('0x63')],{'transaction':_0x148044})[_0x762a('0x23')](function(){if(!_['isEmpty'](_0x5f39ab)){return _0x4f81ec[_0x762a('0x7e')](_0x5f39ab,{'transaction':_0x148044});}})[_0x762a('0x23')](function(){_0x5f39ab['forEach'](function(_0x3faf67){socket[_0x762a('0x7f')]('userOpenchannelQueue:remove',{'UserId':_0x3faf67,'OpenchannelQueueId':_0x4f81ec['id']});});});});});});})[_0x762a('0x23')](respondWithStatusCode(_0x49860,null))[_0x762a('0x44')](handleError(_0x49860,null));};exports[_0x762a('0x80')]=function(_0x5ca9ae,_0x27d9be,_0x778f3e){return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x5ca9ae['params']['id']}})['then'](handleEntityNotFound(_0x27d9be,null))[_0x762a('0x23')](function(_0x2bbaba){if(_0x2bbaba){return _0x2bbaba[_0x762a('0x80')](_0x5ca9ae['body']['ids'],_[_0x762a('0x81')](_0x5ca9ae[_0x762a('0x50')],['ids','id'])||{})[_0x762a('0x82')](function(_0x4b6bc8){for(var _0x2b452d=0x0;_0x2b452d<_0x5ca9ae[_0x762a('0x50')]['ids']['length'];_0x2b452d+=0x1){socket[_0x762a('0x7f')](_0x762a('0x6c'),{'UserId':Number(_0x5ca9ae[_0x762a('0x50')][_0x762a('0x63')][_0x2b452d]),'OpenchannelQueueId':Number(_0x5ca9ae['params']['id'])});}return _0x4b6bc8;});}})[_0x762a('0x23')](respondWithResult(_0x27d9be,null))['catch'](handleError(_0x27d9be,null));};exports[_0x762a('0x7e')]=function(_0x807d21,_0x2b1578,_0x725518){return db[_0x762a('0x2d')][_0x762a('0x48')]({'where':{'id':_0x807d21[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x2b1578,null))['then'](function(_0x4100ac){if(_0x4100ac){return _0x4100ac[_0x762a('0x7e')](_0x807d21[_0x762a('0x32')]['ids'])[_0x762a('0x23')](function(){if(_['isArray'](_0x807d21[_0x762a('0x32')]['ids'])){for(var _0x2a7ce1=0x0;_0x2a7ce1<_0x807d21[_0x762a('0x32')]['ids'][_0x762a('0x37')];_0x2a7ce1+=0x1){socket['emit'](_0x762a('0x83'),{'UserId':Number(_0x807d21[_0x762a('0x32')][_0x762a('0x63')][_0x2a7ce1]),'OpenchannelQueueId':Number(_0x807d21['params']['id'])});}}else{socket[_0x762a('0x7f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x807d21[_0x762a('0x32')][_0x762a('0x63')]),'OpenchannelQueueId':Number(_0x807d21[_0x762a('0x46')]['id'])});}});}})[_0x762a('0x23')](respondWithStatusCode(_0x2b1578,null))[_0x762a('0x44')](handleError(_0x2b1578,null));};exports[_0x762a('0x84')]=function(_0x5a06d3,_0x6b34a5,_0x22062a){var _0xa6db08={};var _0x453dfa={};var _0x2f45ea;var _0x28040e;return db[_0x762a('0x2d')][_0x762a('0x53')]({'where':{'id':_0x5a06d3[_0x762a('0x46')]['id']}})[_0x762a('0x23')](handleEntityNotFound(_0x6b34a5,null))[_0x762a('0x23')](function(_0x55007b){if(_0x55007b){_0x2f45ea=_0x55007b;_0x453dfa[_0x762a('0x31')]=_['keys'](db[_0x762a('0x57')][_0x762a('0x62')]);_0x453dfa[_0x762a('0x32')]=_[_0x762a('0x33')](_0x5a06d3['query']);_0x453dfa['filters']=_['intersection'](_0x453dfa['model'],_0x453dfa[_0x762a('0x32')]);_0xa6db08[_0x762a('0x35')]=_['intersection'](_0x453dfa[_0x762a('0x31')],qs[_0x762a('0x36')](_0x5a06d3[_0x762a('0x32')][_0x762a('0x36')]));_0xa6db08[_0x762a('0x35')]=_0xa6db08['attributes'][_0x762a('0x37')]?_0xa6db08['attributes']:_0x453dfa['model'];_0xa6db08['order']=qs[_0x762a('0x3a')](_0x5a06d3[_0x762a('0x32')]['sort']);_0xa6db08[_0x762a('0x3b')]=qs['filters'](_[_0x762a('0x3c')](_0x5a06d3['query'],_0x453dfa[_0x762a('0x3d')]));if(_0x5a06d3['query']['filter']){_0xa6db08[_0x762a('0x3b')]=_[_0x762a('0x3e')](_0xa6db08[_0x762a('0x3b')],{'$or':_[_0x762a('0x2c')](_0xa6db08[_0x762a('0x35')],function(_0x3a815d){var _0x7a798e={};_0x7a798e[_0x3a815d]={'$like':'%'+_0x5a06d3['query'][_0x762a('0x40')]+'%'};return _0x7a798e;})});}_0xa6db08=_[_0x762a('0x3e')]({},_0xa6db08,_0x5a06d3[_0x762a('0x41')]);return _0x2f45ea['getAgents'](_0xa6db08);}})[_0x762a('0x23')](function(_0x595b8f){if(_0x595b8f){_0x28040e=_0x595b8f['length'];if(!_0x5a06d3[_0x762a('0x32')][_0x762a('0x38')](_0x762a('0x39'))){_0xa6db08[_0x762a('0x1d')]=qs[_0x762a('0x1d')](_0x5a06d3[_0x762a('0x32')]['limit']);_0xa6db08[_0x762a('0x1b')]=qs['offset'](_0x5a06d3[_0x762a('0x32')][_0x762a('0x1b')]);}return _0x2f45ea['getAgents'](_0xa6db08);}})[_0x762a('0x23')](function(_0x25b68e){if(_0x25b68e){return _0x25b68e?{'count':_0x28040e,'rows':_0x25b68e}:null;}})[_0x762a('0x23')](respondWithResult(_0x6b34a5,null))[_0x762a('0x44')](handleError(_0x6b34a5,null));}; \ No newline at end of file +var _0x6833=['userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','map','findAll','User','UserId','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','all','union','compact','value','removeAgents','addAgents','spread','isArray','emit','userOpenchannelQueue:remove','getAgents','eml-format','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6833,0x149));var _0x3683=function(_0x5c01b1,_0x18d4b5){_0x5c01b1=_0x5c01b1-0x0;var _0x4683b6=_0x6833[_0x5c01b1];return _0x4683b6;};'use strict';var emlformat=require(_0x3683('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3683('0x1'));var moment=require(_0x3683('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3683('0x3'));var util=require(_0x3683('0x4'));var path=require(_0x3683('0x5'));var sox=require(_0x3683('0x6'));var csv=require('to-csv');var ejs=require(_0x3683('0x7'));var fs=require('fs');var fs_extra=require(_0x3683('0x8'));var _=require(_0x3683('0x9'));var squel=require(_0x3683('0xa'));var crypto=require(_0x3683('0xb'));var jsforce=require(_0x3683('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3683('0xd'));var querystring=require(_0x3683('0xe'));var Papa=require('papaparse');var Redis=require(_0x3683('0xf'));var authService=require(_0x3683('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3683('0x12'))(_0x3683('0x13'));var utils=require('../../config/utils');var config=require(_0x3683('0x14'));var licenseUtil=require(_0x3683('0x15'));var db=require(_0x3683('0x16'))['db'];config['redis']=_[_0x3683('0x17')](config['redis'],{'host':_0x3683('0x18'),'port':0x18eb});var socket=require(_0x3683('0x19'))(new Redis(config[_0x3683('0x1a')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f5d1f,_0x3d891e){_0x3d891e=_0x3d891e||0xcc;return function(_0x2dd4b2){if(_0x2dd4b2){return _0x4f5d1f[_0x3683('0x1b')](_0x3d891e);}return _0x4f5d1f[_0x3683('0x1c')](_0x3d891e)[_0x3683('0x1d')]();};}function respondWithResult(_0x51f691,_0x3f0d39){_0x3f0d39=_0x3f0d39||0xc8;return function(_0x1f44e3){if(_0x1f44e3){return _0x51f691[_0x3683('0x1c')](_0x3f0d39)[_0x3683('0x1e')](_0x1f44e3);}};}function respondWithFilteredResult(_0x43ccc7,_0x54a28a){return function(_0xce17fe){if(_0xce17fe){var _0x48c572=typeof _0x54a28a[_0x3683('0x1f')]===_0x3683('0x20')&&typeof _0x54a28a['limit']==='undefined';var _0x26dca4=_0xce17fe[_0x3683('0x21')];var _0x3487b3=_0x48c572?0x0:_0x54a28a[_0x3683('0x1f')];var _0x1c0531=_0x48c572?_0xce17fe[_0x3683('0x21')]:_0x54a28a[_0x3683('0x1f')]+_0x54a28a[_0x3683('0x22')];var _0x3ac48a;if(_0x1c0531>=_0x26dca4){_0x1c0531=_0x26dca4;_0x3ac48a=0xc8;}else{_0x3ac48a=0xce;}_0x43ccc7[_0x3683('0x1c')](_0x3ac48a);return _0x43ccc7[_0x3683('0x23')](_0x3683('0x24'),_0x3487b3+'-'+_0x1c0531+'/'+_0x26dca4)[_0x3683('0x1e')](_0xce17fe);}return null;};}function patchUpdates(_0x24e40b){return function(_0x420ba8){try{jsonpatch['apply'](_0x420ba8,_0x24e40b,!![]);}catch(_0x199d5d){return BPromise[_0x3683('0x25')](_0x199d5d);}return _0x420ba8['save']();};}function saveUpdates(_0x4070d2,_0x57262e){return function(_0x4d645d){if(_0x4d645d){return _0x4d645d[_0x3683('0x26')](_0x4070d2)['then'](function(_0x46f707){return _0x46f707;});}return null;};}function removeEntity(_0x331413,_0x4ad56f){return function(_0x561d9b){if(_0x561d9b){return _0x561d9b[_0x3683('0x27')]()[_0x3683('0x28')](function(){var _0x41fe9b=_0x561d9b['get']({'plain':!![]});var _0xb7423a=_0x3683('0x29');return db[_0x3683('0x2a')][_0x3683('0x27')]({'where':{'type':_0xb7423a,'resourceId':_0x41fe9b['id']}})[_0x3683('0x28')](function(){return _0x561d9b;});})[_0x3683('0x28')](function(){_0x331413[_0x3683('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40d6eb,_0x3253f7){return function(_0x1574bb){if(!_0x1574bb){_0x40d6eb['sendStatus'](0x194);}return _0x1574bb;};}function handleError(_0x483c36,_0x237079){_0x237079=_0x237079||0x1f4;return function(_0x2cde4c){logger[_0x3683('0x2b')](_0x2cde4c[_0x3683('0x2c')]);if(_0x2cde4c[_0x3683('0x2d')]){delete _0x2cde4c[_0x3683('0x2d')];}_0x483c36[_0x3683('0x1c')](_0x237079)[_0x3683('0x2e')](_0x2cde4c);};}exports[_0x3683('0x2f')]=function(_0x4224e1,_0x16163c){var _0x4079b6={},_0x1f0a56={},_0x54da88={'count':0x0,'rows':[]};var _0x3aaa2a=_['map'](db[_0x3683('0x30')]['rawAttributes'],function(_0x5d935d){return{'name':_0x5d935d['fieldName'],'type':_0x5d935d[_0x3683('0x31')][_0x3683('0x32')]};});_0x1f0a56[_0x3683('0x33')]=_['map'](_0x3aaa2a,_0x3683('0x2d'));_0x1f0a56['query']=_[_0x3683('0x34')](_0x4224e1['query']);_0x1f0a56[_0x3683('0x35')]=_[_0x3683('0x36')](_0x1f0a56[_0x3683('0x33')],_0x1f0a56[_0x3683('0x37')]);_0x4079b6[_0x3683('0x38')]=_[_0x3683('0x36')](_0x1f0a56[_0x3683('0x33')],qs[_0x3683('0x39')](_0x4224e1[_0x3683('0x37')][_0x3683('0x39')]));_0x4079b6[_0x3683('0x38')]=_0x4079b6[_0x3683('0x38')][_0x3683('0x3a')]?_0x4079b6['attributes']:_0x1f0a56[_0x3683('0x33')];if(!_0x4224e1['query'][_0x3683('0x3b')](_0x3683('0x3c'))){_0x4079b6['limit']=qs[_0x3683('0x22')](_0x4224e1[_0x3683('0x37')][_0x3683('0x22')]);_0x4079b6[_0x3683('0x1f')]=qs[_0x3683('0x1f')](_0x4224e1[_0x3683('0x37')][_0x3683('0x1f')]);}_0x4079b6[_0x3683('0x3d')]=qs[_0x3683('0x3e')](_0x4224e1['query']['sort']);_0x4079b6['where']=qs[_0x3683('0x35')](_[_0x3683('0x3f')](_0x4224e1['query'],_0x1f0a56[_0x3683('0x35')]),_0x3aaa2a);if(_0x4224e1[_0x3683('0x37')]['filter']){_0x4079b6[_0x3683('0x40')]=_[_0x3683('0x41')](_0x4079b6[_0x3683('0x40')],{'$or':_['map'](_0x3aaa2a,function(_0x487c86){if(_0x487c86[_0x3683('0x31')]!==_0x3683('0x42')){var _0x2cae54={};_0x2cae54[_0x487c86[_0x3683('0x2d')]]={'$like':'%'+_0x4224e1[_0x3683('0x37')][_0x3683('0x43')]+'%'};return _0x2cae54;}})});}_0x4079b6=_['merge']({},_0x4079b6,_0x4224e1[_0x3683('0x44')]);var _0x539932={'where':_0x4079b6[_0x3683('0x40')]};return db['OpenchannelQueue'][_0x3683('0x21')](_0x539932)[_0x3683('0x28')](function(_0x27cd4d){_0x54da88[_0x3683('0x21')]=_0x27cd4d;if(_0x4224e1[_0x3683('0x37')]['includeAll']){_0x4079b6[_0x3683('0x45')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x4079b6);})['then'](function(_0x5e362c){_0x54da88[_0x3683('0x46')]=_0x5e362c;return _0x54da88;})['then'](respondWithFilteredResult(_0x16163c,_0x4079b6))[_0x3683('0x47')](handleError(_0x16163c,null));};exports['show']=function(_0x47987c,_0x247f49){var _0x1f38a1={'raw':!![],'where':{'id':_0x47987c[_0x3683('0x48')]['id']}},_0x5a34a3={};_0x5a34a3[_0x3683('0x33')]=_[_0x3683('0x34')](db[_0x3683('0x30')][_0x3683('0x49')]);_0x5a34a3[_0x3683('0x37')]=_['keys'](_0x47987c['query']);_0x5a34a3['filters']=_[_0x3683('0x36')](_0x5a34a3[_0x3683('0x33')],_0x5a34a3[_0x3683('0x37')]);_0x1f38a1[_0x3683('0x38')]=_[_0x3683('0x36')](_0x5a34a3['model'],qs[_0x3683('0x39')](_0x47987c[_0x3683('0x37')][_0x3683('0x39')]));_0x1f38a1[_0x3683('0x38')]=_0x1f38a1[_0x3683('0x38')][_0x3683('0x3a')]?_0x1f38a1[_0x3683('0x38')]:_0x5a34a3[_0x3683('0x33')];if(_0x47987c[_0x3683('0x37')][_0x3683('0x4a')]){_0x1f38a1[_0x3683('0x45')]=[{'all':!![]}];}_0x1f38a1=_['merge']({},_0x1f38a1,_0x47987c['options']);return db['OpenchannelQueue'][_0x3683('0x4b')](_0x1f38a1)[_0x3683('0x28')](handleEntityNotFound(_0x247f49,null))[_0x3683('0x28')](respondWithResult(_0x247f49,null))[_0x3683('0x47')](handleError(_0x247f49,null));};exports['create']=function(_0x5a1323,_0x2753bd){return db[_0x3683('0x30')][_0x3683('0x4c')](_0x5a1323[_0x3683('0x4d')],{})['then'](function(_0x3b73d6){var _0x183480=_0x5a1323[_0x3683('0x4e')][_0x3683('0x4f')]({'plain':!![]});if(!_0x183480)throw new Error(_0x3683('0x50'));if(_0x183480['role']===_0x3683('0x4e')){var _0x40d619=_0x3b73d6[_0x3683('0x4f')]({'plain':!![]});var _0x1d17ed='OpenchannelQueues';return db[_0x3683('0x51')][_0x3683('0x4b')]({'where':{'name':_0x1d17ed,'userProfileId':_0x183480[_0x3683('0x52')]},'raw':!![]})[_0x3683('0x28')](function(_0x3236e2){if(_0x3236e2&&_0x3236e2[_0x3683('0x53')]===0x0){return db[_0x3683('0x2a')][_0x3683('0x4c')]({'name':_0x40d619['name'],'resourceId':_0x40d619['id'],'type':_0x3236e2['name'],'sectionId':_0x3236e2['id']},{})[_0x3683('0x28')](function(){return _0x3b73d6;});}else{return _0x3b73d6;}})[_0x3683('0x47')](function(_0x43ac8c){logger[_0x3683('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43ac8c);throw _0x43ac8c;});}return _0x3b73d6;})[_0x3683('0x28')](respondWithResult(_0x2753bd,0xc9))['catch'](handleError(_0x2753bd,null));};exports[_0x3683('0x26')]=function(_0xf2fe4e,_0x89bbcb){if(_0xf2fe4e[_0x3683('0x4d')]['id']){delete _0xf2fe4e['body']['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0xf2fe4e[_0x3683('0x48')]['id']}})[_0x3683('0x28')](handleEntityNotFound(_0x89bbcb,null))[_0x3683('0x28')](saveUpdates(_0xf2fe4e[_0x3683('0x4d')],null))[_0x3683('0x28')](respondWithResult(_0x89bbcb,null))[_0x3683('0x47')](handleError(_0x89bbcb,null));};exports[_0x3683('0x27')]=function(_0x582ac3,_0x4ad675){return db[_0x3683('0x30')][_0x3683('0x4b')]({'where':{'id':_0x582ac3[_0x3683('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ad675,null))[_0x3683('0x28')](removeEntity(_0x4ad675,null))[_0x3683('0x47')](handleError(_0x4ad675,null));};exports[_0x3683('0x54')]=function(_0x2f8e87,_0xfe5e8a){return db[_0x3683('0x30')][_0x3683('0x54')]()[_0x3683('0x28')](respondWithResult(_0xfe5e8a,null))[_0x3683('0x47')](handleError(_0xfe5e8a,null));};exports[_0x3683('0x55')]=function(_0x16c220,_0x32b819,_0x36657e){var _0x4798c3={'raw':!![],'where':{}},_0x3abd89={},_0x3f1058;return db[_0x3683('0x30')][_0x3683('0x56')]({'where':{'id':_0x16c220[_0x3683('0x48')]['id']}})['then'](handleEntityNotFound(_0x32b819,null))[_0x3683('0x28')](function(_0xfbe914){if(_0xfbe914){_0x3f1058=_0xfbe914['get']({'plain':!![]});_0x3abd89[_0x3683('0x33')]=_['keys'](db[_0x3683('0x57')][_0x3683('0x49')]);_0x3abd89[_0x3683('0x37')]=_[_0x3683('0x34')](_0x16c220[_0x3683('0x37')]);_0x3abd89[_0x3683('0x35')]=_[_0x3683('0x36')](_0x3abd89[_0x3683('0x33')],_0x3abd89[_0x3683('0x37')]);_0x4798c3[_0x3683('0x38')]=_[_0x3683('0x36')](_0x3abd89[_0x3683('0x33')],qs[_0x3683('0x39')](_0x16c220[_0x3683('0x37')][_0x3683('0x39')]));_0x4798c3['attributes']=_0x4798c3[_0x3683('0x38')]['length']?_0x4798c3['attributes']:_0x3abd89[_0x3683('0x33')];if(!_0x16c220[_0x3683('0x37')][_0x3683('0x3b')](_0x3683('0x3c'))){_0x4798c3['limit']=qs['limit'](_0x16c220[_0x3683('0x37')][_0x3683('0x22')]);_0x4798c3[_0x3683('0x1f')]=qs[_0x3683('0x1f')](_0x16c220['query']['offset']);}_0x4798c3['order']=qs['sort'](_0x16c220[_0x3683('0x37')][_0x3683('0x3e')]);_0x4798c3[_0x3683('0x40')]=qs[_0x3683('0x35')](_[_0x3683('0x3f')](_0x16c220['query'],_0x3abd89[_0x3683('0x35')]));_0x4798c3[_0x3683('0x40')][_0x3683('0x58')]=_0xfbe914['id'];if(_0x16c220[_0x3683('0x37')][_0x3683('0x43')]){_0x4798c3['where']=_[_0x3683('0x41')](_0x4798c3[_0x3683('0x40')],{'$or':_[_0x3683('0x59')](_0x4798c3[_0x3683('0x38')],function(_0x4388af){var _0x18c9b4={};_0x18c9b4[_0x4388af]={'$like':'%'+_0x16c220[_0x3683('0x37')][_0x3683('0x43')]+'%'};return _0x18c9b4;})});}_0x4798c3=_[_0x3683('0x41')]({},_0x4798c3,_0x16c220['options']);return db['UserOpenchannelQueue'][_0x3683('0x5a')](_0x4798c3);}})['then'](function(_0x520391){if(_0x520391){return db[_0x3683('0x5b')]['findAndCountAll']({'where':{'id':_[_0x3683('0x59')](_0x520391,_0x3683('0x5c')),'role':'agent'},'attributes':['id',_0x3683('0x2d'),'openchannelPause',_0x3683('0x5d'),_0x3683('0x5e')]});}})[_0x3683('0x28')](function(_0x535ca0){if(_0x535ca0){return{'count':_0x535ca0[_0x3683('0x21')],'rows':_[_0x3683('0x59')](_0x535ca0[_0x3683('0x46')],function(_0x2d5fde){return{'membername':_0x2d5fde['name'],'UserId':_0x2d5fde['id'],'queue_name':_0x3f1058[_0x3683('0x2d')],'OpenchannelQueueId':_0x3f1058['id'],'interface':util[_0x3683('0x5f')](_0x3683('0x60'),_0x3683('0x61'),_0x2d5fde[_0x3683('0x2d')]),'penalty':0x0,'paused':_0x2d5fde[_0x3683('0x62')],'createdAt':_0x2d5fde[_0x3683('0x5e')],'updatedAt':_0x2d5fde[_0x3683('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3683('0x28')](respondWithFilteredResult(_0x32b819,_0x4798c3))[_0x3683('0x47')](handleError(_0x32b819,null));};exports[_0x3683('0x63')]=function(_0x432054,_0x438c1a,_0xb3008a){var _0x3c8fce={};var _0x207295={};var _0xeca67;var _0x2a1abb;return db['OpenchannelQueue'][_0x3683('0x56')]({'where':{'id':_0x432054[_0x3683('0x48')]['id']}})['then'](handleEntityNotFound(_0x438c1a,null))[_0x3683('0x28')](function(_0x155d00){if(_0x155d00){_0xeca67=_0x155d00;_0x207295[_0x3683('0x33')]=_['keys'](db[_0x3683('0x64')][_0x3683('0x49')]);_0x207295[_0x3683('0x37')]=_[_0x3683('0x34')](_0x432054[_0x3683('0x37')]);_0x207295[_0x3683('0x35')]=_[_0x3683('0x36')](_0x207295[_0x3683('0x33')],_0x207295[_0x3683('0x37')]);_0x3c8fce[_0x3683('0x38')]=_[_0x3683('0x36')](_0x207295[_0x3683('0x33')],qs[_0x3683('0x39')](_0x432054['query'][_0x3683('0x39')]));_0x3c8fce[_0x3683('0x38')]=_0x3c8fce[_0x3683('0x38')][_0x3683('0x3a')]?_0x3c8fce[_0x3683('0x38')]:_0x207295['model'];_0x3c8fce['order']=qs[_0x3683('0x3e')](_0x432054[_0x3683('0x37')]['sort']);_0x3c8fce[_0x3683('0x40')]=qs['filters'](_[_0x3683('0x3f')](_0x432054[_0x3683('0x37')],_0x207295['filters']));if(_0x432054[_0x3683('0x37')][_0x3683('0x43')]){_0x3c8fce[_0x3683('0x40')]=_[_0x3683('0x41')](_0x3c8fce[_0x3683('0x40')],{'$or':_[_0x3683('0x59')](_0x3c8fce[_0x3683('0x38')],function(_0x46020a){var _0x35b9a9={};_0x35b9a9[_0x46020a]={'$like':'%'+_0x432054['query'][_0x3683('0x43')]+'%'};return _0x35b9a9;})});}_0x3c8fce=_[_0x3683('0x41')]({},_0x3c8fce,_0x432054[_0x3683('0x44')]);return _0xeca67[_0x3683('0x63')](_0x3c8fce);}})[_0x3683('0x28')](function(_0x61e53a){if(_0x61e53a){_0x2a1abb=_0x61e53a[_0x3683('0x3a')];if(!_0x432054['query'][_0x3683('0x3b')]('nolimit')){_0x3c8fce[_0x3683('0x22')]=qs[_0x3683('0x22')](_0x432054['query'][_0x3683('0x22')]);_0x3c8fce[_0x3683('0x1f')]=qs[_0x3683('0x1f')](_0x432054['query']['offset']);}return _0xeca67[_0x3683('0x63')](_0x3c8fce);}})[_0x3683('0x28')](function(_0x51e5ae){if(_0x51e5ae){return _0x51e5ae?{'count':_0x2a1abb,'rows':_0x51e5ae}:null;}})[_0x3683('0x28')](respondWithResult(_0x438c1a,null))[_0x3683('0x47')](handleError(_0x438c1a,null));};exports[_0x3683('0x65')]=function(_0x2a89fc,_0x13b105,_0x780011){var _0x12cdc3=_0x2a89fc[_0x3683('0x4d')]['ids'];return db[_0x3683('0x64')][_0x3683('0x5a')]({'where':{'id':_0x12cdc3},'attributes':['id'],'include':[{'model':db[_0x3683('0x5b')],'as':_0x3683('0x66'),'attributes':['id','name',_0x3683('0x67'),_0x3683('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x2dbe8e){if(_0x2dbe8e){var _0x2e8046=_[_0x3683('0x69')](_0x2dbe8e,function(_0x159a5a){var _0x1467d4=_0x159a5a['get']({'plain':!![]});return _0x1467d4[_0x3683('0x66')];});return db[_0x3683('0x30')][_0x3683('0x4b')]({'where':{'id':_0x2a89fc[_0x3683('0x48')]['id']}})[_0x3683('0x28')](function(_0x426c03){return db[_0x3683('0x6a')][_0x3683('0x6b')](function(_0x442143){return _0x426c03[_0x3683('0x65')](_0x12cdc3,{'transaction':_0x442143})[_0x3683('0x28')](function(){return BPromise[_0x3683('0x6c')](_0x2e8046,function(_0x206367){return db[_0x3683('0x57')][_0x3683('0x6d')]({'where':{'UserId':_0x206367['id'],'OpenchannelQueueId':_0x2a89fc[_0x3683('0x48')]['id']},'transaction':_0x442143});});})[_0x3683('0x28')](function(){_0x2e8046[_0x3683('0x6e')](function(_0x31348b){socket['emit'](_0x3683('0x6f'),{'UserId':_0x31348b['id'],'OpenchannelQueueId':_0x426c03['id']});});});});});}})[_0x3683('0x28')](respondWithStatusCode(_0x13b105,null))['catch'](handleError(_0x13b105,null));};exports[_0x3683('0x70')]=function(_0x12e795,_0x3cd34f,_0x5779a4){return db[_0x3683('0x64')]['findAll']({'where':{'id':_0x12e795[_0x3683('0x37')][_0x3683('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3683('0x5b')],'as':_0x3683('0x66'),'attributes':['id'],'raw':!![]}]})[_0x3683('0x28')](handleEntityNotFound(_0x3cd34f,null))['then'](function(_0xef473e){var _0x4af7ee=_['map'](_0xef473e,'id');var _0x31aac9=[];var _0x4303e5=[];var _0x16dfca=squel[_0x3683('0x72')]();_0x16dfca[_0x3683('0x73')](_0x3683('0x74'))[_0x3683('0x75')](_0x3683('0x76'),'tq')['join'](_0x3683('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3683('0x40')](_0x3683('0x78'),_0x12e795[_0x3683('0x48')]['id']);for(var _0x464703=0x0;_0x464703<_0xef473e[_0x3683('0x3a')];_0x464703+=0x1){let _0x39627a=_0xef473e[_0x464703];for(var _0x2f5208=0x0;_0x2f5208<_0x39627a[_0x3683('0x66')]['length'];_0x2f5208+=0x1){let _0x34350a=_0x39627a[_0x3683('0x66')][_0x2f5208];var _0x3785a8=_0x16dfca[_0x3683('0x79')]();_0x3785a8[_0x3683('0x40')](_0x3683('0x7a'),_0x34350a['id']);_0x4303e5['push'](db[_0x3683('0x6a')]['query'](_0x3785a8['toString'](),{'type':db[_0x3683('0x6a')]['QueryTypes'][_0x3683('0x7b')]})[_0x3683('0x28')](function(_0x2910d5){if(_0x2910d5[_0x3683('0x3a')]===0x1){return _0x34350a['id'];}else{var _0x1f96b3=_[_0x3683('0x7c')](_['map'](_0x2910d5,_0x3683('0x7d')),function(_0x586e96){return _['includes'](_0x4af7ee,_0x586e96);});if(_0x1f96b3){return _0x34350a['id'];}}}));}}return BPromise[_0x3683('0x7e')](_0x4303e5)[_0x3683('0x28')](function(_0x3b09eb){_0x31aac9=_(_0x31aac9)[_0x3683('0x7f')](_0x3b09eb)[_0x3683('0x80')]()[_0x3683('0x81')]();return db[_0x3683('0x30')][_0x3683('0x4b')]({'where':{'id':_0x12e795[_0x3683('0x48')]['id']}})[_0x3683('0x28')](function(_0x2b1e49){return db[_0x3683('0x6a')][_0x3683('0x6b')](function(_0x10ef5f){return _0x2b1e49[_0x3683('0x70')](_0x12e795['query'][_0x3683('0x71')],{'transaction':_0x10ef5f})[_0x3683('0x28')](function(){if(!_['isEmpty'](_0x31aac9)){return _0x2b1e49[_0x3683('0x82')](_0x31aac9,{'transaction':_0x10ef5f});}})[_0x3683('0x28')](function(){_0x31aac9[_0x3683('0x6e')](function(_0x2b2a22){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x2b2a22,'OpenchannelQueueId':_0x2b1e49['id']});});});});});});})[_0x3683('0x28')](respondWithStatusCode(_0x3cd34f,null))[_0x3683('0x47')](handleError(_0x3cd34f,null));};exports[_0x3683('0x83')]=function(_0x45f577,_0x87d653,_0x3340a9){return db['OpenchannelQueue'][_0x3683('0x4b')]({'where':{'id':_0x45f577[_0x3683('0x48')]['id']}})[_0x3683('0x28')](handleEntityNotFound(_0x87d653,null))[_0x3683('0x28')](function(_0x3cfd16){if(_0x3cfd16){return _0x3cfd16[_0x3683('0x83')](_0x45f577[_0x3683('0x4d')][_0x3683('0x71')],_['omit'](_0x45f577[_0x3683('0x4d')],['ids','id'])||{})[_0x3683('0x84')](function(_0x243b5d){for(var _0x62e67e=0x0;_0x62e67e<_0x45f577[_0x3683('0x4d')][_0x3683('0x71')]['length'];_0x62e67e+=0x1){socket['emit'](_0x3683('0x6f'),{'UserId':Number(_0x45f577[_0x3683('0x4d')]['ids'][_0x62e67e]),'OpenchannelQueueId':Number(_0x45f577[_0x3683('0x48')]['id'])});}return _0x243b5d;});}})[_0x3683('0x28')](respondWithResult(_0x87d653,null))[_0x3683('0x47')](handleError(_0x87d653,null));};exports[_0x3683('0x82')]=function(_0x1c01eb,_0x546eb0,_0x3e2d8a){return db[_0x3683('0x30')][_0x3683('0x4b')]({'where':{'id':_0x1c01eb[_0x3683('0x48')]['id']}})[_0x3683('0x28')](handleEntityNotFound(_0x546eb0,null))[_0x3683('0x28')](function(_0x5c3610){if(_0x5c3610){return _0x5c3610[_0x3683('0x82')](_0x1c01eb[_0x3683('0x37')][_0x3683('0x71')])[_0x3683('0x28')](function(){if(_[_0x3683('0x85')](_0x1c01eb['query'][_0x3683('0x71')])){for(var _0x565f70=0x0;_0x565f70<_0x1c01eb[_0x3683('0x37')][_0x3683('0x71')][_0x3683('0x3a')];_0x565f70+=0x1){socket[_0x3683('0x86')](_0x3683('0x87'),{'UserId':Number(_0x1c01eb['query'][_0x3683('0x71')][_0x565f70]),'OpenchannelQueueId':Number(_0x1c01eb[_0x3683('0x48')]['id'])});}}else{socket[_0x3683('0x86')](_0x3683('0x87'),{'UserId':Number(_0x1c01eb[_0x3683('0x37')][_0x3683('0x71')]),'OpenchannelQueueId':Number(_0x1c01eb[_0x3683('0x48')]['id'])});}});}})[_0x3683('0x28')](respondWithStatusCode(_0x546eb0,null))['catch'](handleError(_0x546eb0,null));};exports[_0x3683('0x88')]=function(_0xea1301,_0x4b76d3,_0x486e48){var _0x4271af={};var _0x2b1d24={};var _0x53f95c;var _0x3d5796;return db[_0x3683('0x30')]['findOne']({'where':{'id':_0xea1301[_0x3683('0x48')]['id']}})[_0x3683('0x28')](handleEntityNotFound(_0x4b76d3,null))['then'](function(_0x13c63c){if(_0x13c63c){_0x53f95c=_0x13c63c;_0x2b1d24[_0x3683('0x33')]=_[_0x3683('0x34')](db[_0x3683('0x5b')][_0x3683('0x49')]);_0x2b1d24[_0x3683('0x37')]=_[_0x3683('0x34')](_0xea1301[_0x3683('0x37')]);_0x2b1d24[_0x3683('0x35')]=_[_0x3683('0x36')](_0x2b1d24['model'],_0x2b1d24[_0x3683('0x37')]);_0x4271af['attributes']=_[_0x3683('0x36')](_0x2b1d24['model'],qs[_0x3683('0x39')](_0xea1301[_0x3683('0x37')][_0x3683('0x39')]));_0x4271af['attributes']=_0x4271af[_0x3683('0x38')][_0x3683('0x3a')]?_0x4271af['attributes']:_0x2b1d24[_0x3683('0x33')];_0x4271af[_0x3683('0x3d')]=qs[_0x3683('0x3e')](_0xea1301[_0x3683('0x37')][_0x3683('0x3e')]);_0x4271af[_0x3683('0x40')]=qs[_0x3683('0x35')](_['pick'](_0xea1301[_0x3683('0x37')],_0x2b1d24[_0x3683('0x35')]));if(_0xea1301[_0x3683('0x37')][_0x3683('0x43')]){_0x4271af[_0x3683('0x40')]=_[_0x3683('0x41')](_0x4271af[_0x3683('0x40')],{'$or':_[_0x3683('0x59')](_0x4271af[_0x3683('0x38')],function(_0x4dcb35){var _0x3aa791={};_0x3aa791[_0x4dcb35]={'$like':'%'+_0xea1301[_0x3683('0x37')]['filter']+'%'};return _0x3aa791;})});}_0x4271af=_[_0x3683('0x41')]({},_0x4271af,_0xea1301['options']);return _0x53f95c[_0x3683('0x88')](_0x4271af);}})['then'](function(_0x25e381){if(_0x25e381){_0x3d5796=_0x25e381[_0x3683('0x3a')];if(!_0xea1301['query'][_0x3683('0x3b')](_0x3683('0x3c'))){_0x4271af['limit']=qs[_0x3683('0x22')](_0xea1301['query'][_0x3683('0x22')]);_0x4271af['offset']=qs[_0x3683('0x1f')](_0xea1301[_0x3683('0x37')][_0x3683('0x1f')]);}return _0x53f95c[_0x3683('0x88')](_0x4271af);}})[_0x3683('0x28')](function(_0x4bfa71){if(_0x4bfa71){return _0x4bfa71?{'count':_0x3d5796,'rows':_0x4bfa71}:null;}})[_0x3683('0x28')](respondWithResult(_0x4b76d3,null))[_0x3683('0x47')](handleError(_0x4b76d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c984522..472c773 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 _0xd349=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x58c008,_0x222f08){var _0x9804b7=function(_0x56d01a){while(--_0x56d01a){_0x58c008['push'](_0x58c008['shift']());}};_0x9804b7(++_0x222f08);}(_0xd349,0x139));var _0x9d34=function(_0x5f2de8,_0x124dfe){_0x5f2de8=_0x5f2de8-0x0;var _0x11e267=_0xd349[_0x5f2de8];return _0x11e267;};'use strict';var EventEmitter=require(_0x9d34('0x0'));var OpenchannelQueue=require(_0x9d34('0x1'))['db'][_0x9d34('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9d34('0x3')](0x0);var events={'afterCreate':_0x9d34('0x4'),'afterUpdate':_0x9d34('0x5'),'afterDestroy':_0x9d34('0x6')};function emitEvent(_0x4c4265){return function(_0x537318,_0x2d21b1,_0x379a0b){OpenchannelQueueEvents[_0x9d34('0x7')](_0x4c4265+':'+_0x537318['id'],_0x537318);OpenchannelQueueEvents[_0x9d34('0x7')](_0x4c4265,_0x537318);_0x379a0b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x9d34('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xed5c=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x27fab4,_0x3cee20){var _0x53e82f=function(_0x2abe94){while(--_0x2abe94){_0x27fab4['push'](_0x27fab4['shift']());}};_0x53e82f(++_0x3cee20);}(_0xed5c,0x1c8));var _0xced5=function(_0x5b1799,_0x285495){_0x5b1799=_0x5b1799-0x0;var _0x1b53fc=_0xed5c[_0x5b1799];return _0x1b53fc;};'use strict';var EventEmitter=require(_0xced5('0x0'));var OpenchannelQueue=require(_0xced5('0x1'))['db'][_0xced5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xced5('0x3'),'afterUpdate':_0xced5('0x4'),'afterDestroy':_0xced5('0x5')};function emitEvent(_0x121655){return function(_0x4a2081,_0x2c9e11,_0x5d56db){OpenchannelQueueEvents[_0xced5('0x6')](_0x121655+':'+_0x4a2081['id'],_0x4a2081);OpenchannelQueueEvents[_0xced5('0x6')](_0x121655,_0x4a2081);_0x5d56db(null);};}for(var e in events){if(events[_0xced5('0x7')](e)){var event=events[e];OpenchannelQueue[_0xced5('0x8')](e,emitEvent(event));}}module[_0xced5('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 924876d..5369054 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 _0xd391=['api','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util'];(function(_0x3f7af5,_0x2147a0){var _0x55ad46=function(_0x4a2084){while(--_0x4a2084){_0x3f7af5['push'](_0x3f7af5['shift']());}};_0x55ad46(++_0x2147a0);}(_0xd391,0xf8));var _0x1d39=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xd391[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x1d39('0x0'));var util=require(_0x1d39('0x1'));var logger=require('../../config/logger')(_0x1d39('0x2'));var moment=require('moment');var BPromise=require(_0x1d39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d39('0x4'));var rimraf=require(_0x1d39('0x5'));var config=require(_0x1d39('0x6'));var attributes=require(_0x1d39('0x7'));module['exports']=function(_0x253326,_0xf2a50f){return _0x253326[_0x1d39('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x1d39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacc8=['util','../../config/logger','api','bluebird','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x43cebc,_0x2c9fdb){var _0x3073b5=function(_0x19e616){while(--_0x19e616){_0x43cebc['push'](_0x43cebc['shift']());}};_0x3073b5(++_0x2c9fdb);}(_0xacc8,0x1eb));var _0x8acc=function(_0x52ef2d,_0xf6adcc){_0x52ef2d=_0x52ef2d-0x0;var _0x277179=_0xacc8[_0x52ef2d];return _0x277179;};'use strict';var _=require(_0x8acc('0x0'));var util=require(_0x8acc('0x1'));var logger=require(_0x8acc('0x2'))(_0x8acc('0x3'));var moment=require('moment');var BPromise=require(_0x8acc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8acc('0x5'));var rimraf=require('rimraf');var config=require(_0x8acc('0x6'));var attributes=require(_0x8acc('0x7'));module[_0x8acc('0x8')]=function(_0x2243e1,_0x5d2f3b){return _0x2243e1[_0x8acc('0x9')](_0x8acc('0xa'),attributes,{'tableName':_0x8acc('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 e3a7350..287fd48 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 _0xd12c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','debug','catch','ShowOpenchannelQueue','OpenchannelQueue','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xd12c,0xea));var _0xcd12=function(_0x47554d,_0x36ac72){_0x47554d=_0x47554d-0x0;var _0x4554b1=_0xd12c[_0x47554d];return _0x4554b1;};'use strict';var _=require('lodash');var util=require(_0xcd12('0x0'));var moment=require(_0xcd12('0x1'));var BPromise=require(_0xcd12('0x2'));var rs=require(_0xcd12('0x3'));var fs=require('fs');var Redis=require(_0xcd12('0x4'));var db=require(_0xcd12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd12('0x6'))(_0xcd12('0x7'));var config=require(_0xcd12('0x8'));var jayson=require(_0xcd12('0x9'));var client=jayson[_0xcd12('0xa')]['http']({'port':0x232a});config[_0xcd12('0xb')]=_[_0xcd12('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcd12('0xd'))(new Redis(config[_0xcd12('0xb')]));require(_0xcd12('0xe'))[_0xcd12('0xf')](socket);function respondWithRpcPromise(_0x22283b,_0x4336d3,_0x4dee44){return new BPromise(function(_0x58d786,_0xacaf54){return client[_0xcd12('0x10')](_0x22283b,_0x4dee44)['then'](function(_0x4d970e){logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x4336d3,_0xcd12('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4336d3,_0xcd12('0x13'),JSON[_0xcd12('0x14')](_0x4d970e));if(_0x4d970e['error']){if(_0x4d970e[_0xcd12('0x15')][_0xcd12('0x16')]===0x1f4){logger['error'](_0xcd12('0x12'),_0x4336d3,_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);return _0xacaf54(_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4336d3,_0x4d970e[_0xcd12('0x15')][_0xcd12('0x17')]);return _0x58d786(_0x4d970e['error'][_0xcd12('0x17')]);}else{logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x4336d3,'request\x20sent');_0x58d786(_0x4d970e[_0xcd12('0x18')][_0xcd12('0x17')]);}})['catch'](function(_0x89c548){logger[_0xcd12('0x15')](_0xcd12('0x12'),_0x4336d3,_0x89c548);_0xacaf54(_0x89c548);});});}exports[_0xcd12('0x19')]=function(_0x532c00){var _0x430e18=this;return new Promise(function(_0x23dc50,_0x429907){return db['OpenchannelQueue'][_0xcd12('0x1a')]({'raw':_0x532c00['options']?_0x532c00[_0xcd12('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532c00[_0xcd12('0x1b')]?_0x532c00[_0xcd12('0x1b')][_0xcd12('0x1c')]||null:null,'attributes':_0x532c00['options']?_0x532c00[_0xcd12('0x1b')][_0xcd12('0x1d')]||null:null,'limit':_0x532c00[_0xcd12('0x1b')]?_0x532c00['options'][_0xcd12('0x1e')]||null:null,'include':_0x532c00[_0xcd12('0x1b')]?_0x532c00[_0xcd12('0x1b')]['include']?_[_0xcd12('0x1f')](_0x532c00['options'][_0xcd12('0x20')],function(_0x47a40f){return{'model':db[_0x47a40f[_0xcd12('0x21')]],'as':_0x47a40f['as'],'attributes':_0x47a40f[_0xcd12('0x1d')],'include':_0x47a40f['include']?_[_0xcd12('0x1f')](_0x47a40f[_0xcd12('0x20')],function(_0x12cc99){return{'model':db[_0x12cc99[_0xcd12('0x21')]],'as':_0x12cc99['as'],'attributes':_0x12cc99[_0xcd12('0x1d')],'include':_0x12cc99[_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x12cc99[_0xcd12('0x20')],function(_0x1afd33){return{'model':db[_0x1afd33[_0xcd12('0x21')]],'as':_0x1afd33['as'],'attributes':_0x1afd33['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d7ce4){logger[_0xcd12('0x11')](_0xcd12('0x19'),_0x532c00);logger[_0xcd12('0x22')](_0xcd12('0x19'),_0x532c00,JSON[_0xcd12('0x14')](_0x5d7ce4));_0x23dc50(_0x5d7ce4);})[_0xcd12('0x23')](function(_0x5a789b){logger[_0xcd12('0x15')](_0xcd12('0x19'),_0x5a789b[_0xcd12('0x17')],_0x532c00);_0x429907(_0x430e18['error'](0x1f4,_0x5a789b[_0xcd12('0x17')]));});});};exports[_0xcd12('0x24')]=function(_0x4f1007){var _0x1c5be7=this;return new Promise(function(_0x3844f3,_0x46daa9){return db[_0xcd12('0x25')]['find']({'raw':_0x4f1007[_0xcd12('0x1b')]?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x26')]===undefined?!![]:![]:!![],'where':_0x4f1007['options']?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x1c')]||null:null,'attributes':_0x4f1007['options']?_0x4f1007['options']['attributes']||null:null,'include':_0x4f1007[_0xcd12('0x1b')]?_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x4f1007[_0xcd12('0x1b')][_0xcd12('0x20')],function(_0x3b2f4f){return{'model':db[_0x3b2f4f['model']],'as':_0x3b2f4f['as'],'attributes':_0x3b2f4f[_0xcd12('0x1d')],'include':_0x3b2f4f['include']?_[_0xcd12('0x1f')](_0x3b2f4f[_0xcd12('0x20')],function(_0x348d37){return{'model':db[_0x348d37[_0xcd12('0x21')]],'as':_0x348d37['as'],'attributes':_0x348d37[_0xcd12('0x1d')],'include':_0x348d37[_0xcd12('0x20')]?_[_0xcd12('0x1f')](_0x348d37[_0xcd12('0x20')],function(_0x5cb90b){return{'model':db[_0x5cb90b[_0xcd12('0x21')]],'as':_0x5cb90b['as'],'attributes':_0x5cb90b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd12('0x27')](function(_0x8b24cf){logger['info'](_0xcd12('0x24'),_0x4f1007);logger['debug'](_0xcd12('0x24'),_0x4f1007,JSON[_0xcd12('0x14')](_0x8b24cf));_0x3844f3(_0x8b24cf);})[_0xcd12('0x23')](function(_0x28292f){logger[_0xcd12('0x15')](_0xcd12('0x24'),_0x28292f[_0xcd12('0x17')],_0x4f1007);_0x46daa9(_0x1c5be7[_0xcd12('0x15')](0x1f4,_0x28292f[_0xcd12('0x17')]));});});}; \ No newline at end of file +var _0x8b47=['findAll','options','raw','where','map','include','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','attributes','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8b47,0xab));var _0x78b4=function(_0x27e144,_0x1d9ff9){_0x27e144=_0x27e144-0x0;var _0x37b396=_0x8b47[_0x27e144];return _0x37b396;};'use strict';var _=require(_0x78b4('0x0'));var util=require(_0x78b4('0x1'));var moment=require(_0x78b4('0x2'));var BPromise=require(_0x78b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78b4('0x4'))['db'];var utils=require(_0x78b4('0x5'));var logger=require(_0x78b4('0x6'))(_0x78b4('0x7'));var config=require(_0x78b4('0x8'));var jayson=require(_0x78b4('0x9'));var client=jayson[_0x78b4('0xa')][_0x78b4('0xb')]({'port':0x232a});config[_0x78b4('0xc')]=_['defaults'](config[_0x78b4('0xc')],{'host':_0x78b4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78b4('0xc')]));require('./openchannelQueue.socket')[_0x78b4('0xe')](socket);function respondWithRpcPromise(_0x58c6bd,_0x4ad74e,_0x5bc787){return new BPromise(function(_0x7f2950,_0x23f171){return client[_0x78b4('0xf')](_0x58c6bd,_0x5bc787)[_0x78b4('0x10')](function(_0x3f6cbd){logger[_0x78b4('0x11')](_0x78b4('0x12'),_0x4ad74e,_0x78b4('0x13'));logger[_0x78b4('0x14')](_0x78b4('0x15'),_0x4ad74e,'request\x20sent',JSON[_0x78b4('0x16')](_0x3f6cbd));if(_0x3f6cbd['error']){if(_0x3f6cbd[_0x78b4('0x17')][_0x78b4('0x18')]===0x1f4){logger['error'](_0x78b4('0x12'),_0x4ad74e,_0x3f6cbd[_0x78b4('0x17')][_0x78b4('0x19')]);return _0x23f171(_0x3f6cbd[_0x78b4('0x17')][_0x78b4('0x19')]);}logger[_0x78b4('0x17')](_0x78b4('0x12'),_0x4ad74e,_0x3f6cbd['error']['message']);return _0x7f2950(_0x3f6cbd[_0x78b4('0x17')][_0x78b4('0x19')]);}else{logger[_0x78b4('0x11')](_0x78b4('0x12'),_0x4ad74e,_0x78b4('0x13'));_0x7f2950(_0x3f6cbd[_0x78b4('0x1a')][_0x78b4('0x19')]);}})[_0x78b4('0x1b')](function(_0x2bca9c){logger[_0x78b4('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ad74e,_0x2bca9c);_0x23f171(_0x2bca9c);});});}exports['GetOpenchannelQueue']=function(_0x57f088){var _0x1b97de=this;return new Promise(function(_0x4abae0,_0x381163){return db[_0x78b4('0x1c')][_0x78b4('0x1d')]({'raw':_0x57f088[_0x78b4('0x1e')]?_0x57f088['options'][_0x78b4('0x1f')]===undefined?!![]:![]:!![],'where':_0x57f088[_0x78b4('0x1e')]?_0x57f088['options'][_0x78b4('0x20')]||null:null,'attributes':_0x57f088[_0x78b4('0x1e')]?_0x57f088[_0x78b4('0x1e')]['attributes']||null:null,'limit':_0x57f088[_0x78b4('0x1e')]?_0x57f088['options']['limit']||null:null,'include':_0x57f088['options']?_0x57f088[_0x78b4('0x1e')]['include']?_[_0x78b4('0x21')](_0x57f088[_0x78b4('0x1e')][_0x78b4('0x22')],function(_0x3b5a1d){return{'model':db[_0x3b5a1d[_0x78b4('0x23')]],'as':_0x3b5a1d['as'],'attributes':_0x3b5a1d['attributes'],'include':_0x3b5a1d[_0x78b4('0x22')]?_[_0x78b4('0x21')](_0x3b5a1d[_0x78b4('0x22')],function(_0x9c3db5){return{'model':db[_0x9c3db5[_0x78b4('0x23')]],'as':_0x9c3db5['as'],'attributes':_0x9c3db5['attributes'],'include':_0x9c3db5[_0x78b4('0x22')]?_[_0x78b4('0x21')](_0x9c3db5[_0x78b4('0x22')],function(_0x27f551){return{'model':db[_0x27f551[_0x78b4('0x23')]],'as':_0x27f551['as'],'attributes':_0x27f551['attributes']};}):[]};}):[]};}):[]:[]})[_0x78b4('0x10')](function(_0x476658){logger[_0x78b4('0x11')](_0x78b4('0x24'),_0x57f088);logger[_0x78b4('0x14')](_0x78b4('0x24'),_0x57f088,JSON[_0x78b4('0x16')](_0x476658));_0x4abae0(_0x476658);})[_0x78b4('0x1b')](function(_0x4f5fcf){logger['error'](_0x78b4('0x24'),_0x4f5fcf['message'],_0x57f088);_0x381163(_0x1b97de[_0x78b4('0x17')](0x1f4,_0x4f5fcf[_0x78b4('0x19')]));});});};exports[_0x78b4('0x25')]=function(_0x26a4d7){var _0x449986=this;return new Promise(function(_0xd3d2b1,_0x38de6d){return db[_0x78b4('0x1c')][_0x78b4('0x26')]({'raw':_0x26a4d7[_0x78b4('0x1e')]?_0x26a4d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x26a4d7[_0x78b4('0x1e')]?_0x26a4d7[_0x78b4('0x1e')][_0x78b4('0x20')]||null:null,'attributes':_0x26a4d7[_0x78b4('0x1e')]?_0x26a4d7['options'][_0x78b4('0x27')]||null:null,'include':_0x26a4d7['options']?_0x26a4d7[_0x78b4('0x1e')][_0x78b4('0x22')]?_['map'](_0x26a4d7[_0x78b4('0x1e')][_0x78b4('0x22')],function(_0x4ace58){return{'model':db[_0x4ace58[_0x78b4('0x23')]],'as':_0x4ace58['as'],'attributes':_0x4ace58[_0x78b4('0x27')],'include':_0x4ace58['include']?_[_0x78b4('0x21')](_0x4ace58['include'],function(_0xe6697b){return{'model':db[_0xe6697b[_0x78b4('0x23')]],'as':_0xe6697b['as'],'attributes':_0xe6697b['attributes'],'include':_0xe6697b[_0x78b4('0x22')]?_['map'](_0xe6697b['include'],function(_0x359eaa){return{'model':db[_0x359eaa[_0x78b4('0x23')]],'as':_0x359eaa['as'],'attributes':_0x359eaa[_0x78b4('0x27')]};}):[]};}):[]};}):[]:[]})[_0x78b4('0x10')](function(_0x1a0dd2){logger[_0x78b4('0x11')](_0x78b4('0x25'),_0x26a4d7);logger['debug'](_0x78b4('0x25'),_0x26a4d7,JSON[_0x78b4('0x16')](_0x1a0dd2));_0xd3d2b1(_0x1a0dd2);})[_0x78b4('0x1b')](function(_0x4c190f){logger[_0x78b4('0x17')](_0x78b4('0x25'),_0x4c190f[_0x78b4('0x19')],_0x26a4d7);_0x38de6d(_0x449986[_0x78b4('0x17')](0x1f4,_0x4c190f['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index aaebab5..22e10b1 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 _0x9478=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update'];(function(_0x2d2b63,_0x277d0a){var _0x5d18f8=function(_0x4eca54){while(--_0x4eca54){_0x2d2b63['push'](_0x2d2b63['shift']());}};_0x5d18f8(++_0x277d0a);}(_0x9478,0x15b));var _0x8947=function(_0x533da3,_0x2b6fc4){_0x533da3=_0x533da3-0x0;var _0x2b4350=_0x9478[_0x533da3];return _0x2b4350;};'use strict';var OpenchannelQueueEvents=require(_0x8947('0x0'));var events=[_0x8947('0x1'),_0x8947('0x2'),_0x8947('0x3')];function createListener(_0x24e328,_0x2c431b){return function(_0x5b0c61){_0x2c431b[_0x8947('0x4')](_0x24e328,_0x5b0c61);};}function removeListener(_0x535070,_0x2db57c){return function(){OpenchannelQueueEvents[_0x8947('0x5')](_0x535070,_0x2db57c);};}exports[_0x8947('0x6')]=function(_0x4388f1){for(var _0x676147=0x0,_0x39f454=events[_0x8947('0x7')];_0x676147<_0x39f454;_0x676147++){var _0xdcc559=events[_0x676147];var _0x549dda=createListener(_0x8947('0x8')+_0xdcc559,_0x4388f1);OpenchannelQueueEvents['on'](_0xdcc559,_0x549dda);}}; \ No newline at end of file +var _0x4b2c=['length','openchannelQueue:','./openchannelQueue.events','save','update','removeListener','register'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x4b2c,0x13d));var _0xc4b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b2c[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0xc4b2('0x0'));var events=[_0xc4b2('0x1'),'remove',_0xc4b2('0x2')];function createListener(_0x251013,_0x22f45b){return function(_0x404b32){_0x22f45b['emit'](_0x251013,_0x404b32);};}function removeListener(_0xede242,_0x254a00){return function(){OpenchannelQueueEvents[_0xc4b2('0x3')](_0xede242,_0x254a00);};}exports[_0xc4b2('0x4')]=function(_0x4d8415){for(var _0x456f06=0x0,_0x32ef28=events[_0xc4b2('0x5')];_0x456f06<_0x32ef28;_0x456f06++){var _0x24130b=events[_0x456f06];var _0x71302e=createListener(_0xc4b2('0x6')+_0x24130b,_0x4d8415);OpenchannelQueueEvents['on'](_0x24130b,_0x71302e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 69b6e34..3b4014c 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 _0xa289=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x2c87d2,_0x21b9bd){var _0x9bfbf7=function(_0x144af3){while(--_0x144af3){_0x2c87d2['push'](_0x2c87d2['shift']());}};_0x9bfbf7(++_0x21b9bd);}(_0xa289,0x7d));var _0x9a28=function(_0x5006a8,_0x1433a2){_0x5006a8=_0x5006a8-0x0;var _0x381ee6=_0xa289[_0x5006a8];return _0x381ee6;};'use strict';var multer=require(_0x9a28('0x0'));var util=require('util');var path=require(_0x9a28('0x1'));var timeout=require(_0x9a28('0x2'));var express=require(_0x9a28('0x3'));var router=express[_0x9a28('0x4')]();var fs_extra=require(_0x9a28('0x5'));var auth=require(_0x9a28('0x6'));var interaction=require(_0x9a28('0x7'));var config=require(_0x9a28('0x8'));var controller=require(_0x9a28('0x9'));router[_0x9a28('0xa')]('/',auth[_0x9a28('0xb')](),controller[_0x9a28('0xc')]);router['get'](_0x9a28('0xd'),auth[_0x9a28('0xb')](),controller['describe']);router[_0x9a28('0xa')](_0x9a28('0xe'),auth[_0x9a28('0xb')](),controller[_0x9a28('0xf')]);router['post']('/',auth[_0x9a28('0xb')](),controller[_0x9a28('0x10')]);router[_0x9a28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9a28('0x12')]);router['delete']('/:id',auth[_0x9a28('0xb')](),controller[_0x9a28('0x13')]);module[_0x9a28('0x14')]=router; \ No newline at end of file +var _0x83d6=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','create','put','update'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x83d6,0x9b));var _0x683d=function(_0x525204,_0x422177){_0x525204=_0x525204-0x0;var _0x50f268=_0x83d6[_0x525204];return _0x50f268;};'use strict';var multer=require(_0x683d('0x0'));var util=require(_0x683d('0x1'));var path=require(_0x683d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x683d('0x3')]();var fs_extra=require(_0x683d('0x4'));var auth=require(_0x683d('0x5'));var interaction=require(_0x683d('0x6'));var config=require(_0x683d('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x683d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x683d('0x8')](_0x683d('0x9'),auth['isAuthenticated'](),controller[_0x683d('0xa')]);router[_0x683d('0x8')](_0x683d('0xb'),auth[_0x683d('0xc')](),controller['show']);router['post']('/',auth[_0x683d('0xc')](),controller[_0x683d('0xd')]);router[_0x683d('0xe')](_0x683d('0xb'),auth['isAuthenticated'](),controller[_0x683d('0xf')]);router[_0x683d('0x10')]('/:id',auth[_0x683d('0xc')](),controller[_0x683d('0x11')]);module[_0x683d('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 338f998..a86b2fb 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 _0xfa39=['STRING','DATE','exports'];(function(_0x1b72b2,_0x302840){var _0x1230b1=function(_0x4f9c13){while(--_0x4f9c13){_0x1b72b2['push'](_0x1b72b2['shift']());}};_0x1230b1(++_0x302840);}(_0xfa39,0x197));var _0x9fa3=function(_0x4ce1b9,_0x397a4b){_0x4ce1b9=_0x4ce1b9-0x0;var _0x2bb15d=_0xfa39[_0x4ce1b9];return _0x2bb15d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9fa3('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9fa3('0x1')]},'joinAt':{'type':Sequelize[_0x9fa3('0x2')]},'leaveAt':{'type':Sequelize[_0x9fa3('0x2')]},'acceptAt':{'type':Sequelize[_0x9fa3('0x2')]},'exitAt':{'type':Sequelize[_0x9fa3('0x2')]},'reason':{'type':Sequelize[_0x9fa3('0x1')]}}; \ No newline at end of file +var _0x8b91=['STRING','DATE','moment','sequelize','exports'];(function(_0x49a811,_0x190495){var _0xd8ff9d=function(_0x3def3e){while(--_0x3def3e){_0x49a811['push'](_0x49a811['shift']());}};_0xd8ff9d(++_0x190495);}(_0x8b91,0x17e));var _0x18b9=function(_0x578762,_0x53f3ed){_0x578762=_0x578762-0x0;var _0x2438b9=_0x8b91[_0x578762];return _0x2438b9;};'use strict';var moment=require(_0x18b9('0x0'));var Sequelize=require(_0x18b9('0x1'));module[_0x18b9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x18b9('0x3')]},'joinAt':{'type':Sequelize[_0x18b9('0x4')]},'leaveAt':{'type':Sequelize[_0x18b9('0x4')]},'acceptAt':{'type':Sequelize[_0x18b9('0x4')]},'exitAt':{'type':Sequelize[_0x18b9('0x4')]},'reason':{'type':Sequelize[_0x18b9('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 5f5e46a..c10a6f0 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 _0xba6f=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','map','keys','query','filters','model','attributes','intersection','fields','order','sort','pick','filter','where','merge','type','includeAll','include','catch','show','params','length','options','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xba6f,0x106));var _0xfba6=function(_0x5b2c50,_0x4db66b){_0x5b2c50=_0x5b2c50-0x0;var _0x47f2f9=_0xba6f[_0x5b2c50];return _0x47f2f9;};'use strict';var emlformat=require(_0xfba6('0x0'));var rimraf=require(_0xfba6('0x1'));var zipdir=require(_0xfba6('0x2'));var jsonpatch=require(_0xfba6('0x3'));var rp=require(_0xfba6('0x4'));var moment=require(_0xfba6('0x5'));var BPromise=require(_0xfba6('0x6'));var Mustache=require(_0xfba6('0x7'));var util=require('util');var path=require(_0xfba6('0x8'));var sox=require(_0xfba6('0x9'));var csv=require(_0xfba6('0xa'));var ejs=require(_0xfba6('0xb'));var fs=require('fs');var fs_extra=require(_0xfba6('0xc'));var _=require('lodash');var squel=require(_0xfba6('0xd'));var crypto=require('crypto');var jsforce=require(_0xfba6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfba6('0xa'));var querystring=require('querystring');var Papa=require(_0xfba6('0xf'));var Redis=require(_0xfba6('0x10'));var authService=require(_0xfba6('0x11'));var qs=require(_0xfba6('0x12'));var as=require(_0xfba6('0x13'));var hardwareService=require(_0xfba6('0x14'));var logger=require(_0xfba6('0x15'))(_0xfba6('0x16'));var utils=require(_0xfba6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfba6('0x18'));var db=require(_0xfba6('0x19'))['db'];function respondWithStatusCode(_0x21d095,_0x48fbd9){_0x48fbd9=_0x48fbd9||0xcc;return function(_0xe3f2c3){if(_0xe3f2c3){return _0x21d095[_0xfba6('0x1a')](_0x48fbd9);}return _0x21d095['status'](_0x48fbd9)[_0xfba6('0x1b')]();};}function respondWithResult(_0x562a89,_0x4f2101){_0x4f2101=_0x4f2101||0xc8;return function(_0x127d68){if(_0x127d68){return _0x562a89[_0xfba6('0x1c')](_0x4f2101)[_0xfba6('0x1d')](_0x127d68);}};}function respondWithFilteredResult(_0x29e11b,_0x1b1ad2){return function(_0x345bbd){if(_0x345bbd){var _0xf808c2=typeof _0x1b1ad2[_0xfba6('0x1e')]===_0xfba6('0x1f')&&typeof _0x1b1ad2[_0xfba6('0x20')]===_0xfba6('0x1f');var _0x3caf43=_0x345bbd[_0xfba6('0x21')];var _0x94fc4f=_0xf808c2?0x0:_0x1b1ad2[_0xfba6('0x1e')];var _0x1eb59b=_0xf808c2?_0x345bbd['count']:_0x1b1ad2[_0xfba6('0x1e')]+_0x1b1ad2[_0xfba6('0x20')];var _0x1cb052;if(_0x1eb59b>=_0x3caf43){_0x1eb59b=_0x3caf43;_0x1cb052=0xc8;}else{_0x1cb052=0xce;}_0x29e11b['status'](_0x1cb052);return _0x29e11b[_0xfba6('0x22')](_0xfba6('0x23'),_0x94fc4f+'-'+_0x1eb59b+'/'+_0x3caf43)[_0xfba6('0x1d')](_0x345bbd);}return null;};}function patchUpdates(_0x1ce3a1){return function(_0x87a36){try{jsonpatch[_0xfba6('0x24')](_0x87a36,_0x1ce3a1,!![]);}catch(_0x3ea1af){return BPromise[_0xfba6('0x25')](_0x3ea1af);}return _0x87a36[_0xfba6('0x26')]();};}function saveUpdates(_0x509fed,_0x556c10){return function(_0x443d64){if(_0x443d64){return _0x443d64[_0xfba6('0x27')](_0x509fed)[_0xfba6('0x28')](function(_0x338f4a){return _0x338f4a;});}return null;};}function removeEntity(_0x9779bd,_0x5402bc){return function(_0x4f5e69){if(_0x4f5e69){return _0x4f5e69[_0xfba6('0x29')]()[_0xfba6('0x28')](function(){_0x9779bd[_0xfba6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13d462,_0x3ccc96){return function(_0x126fe5){if(!_0x126fe5){_0x13d462[_0xfba6('0x1a')](0x194);}return _0x126fe5;};}function handleError(_0x532124,_0x18263f){_0x18263f=_0x18263f||0x1f4;return function(_0x3002bc){logger['error'](_0x3002bc[_0xfba6('0x2a')]);if(_0x3002bc[_0xfba6('0x2b')]){delete _0x3002bc[_0xfba6('0x2b')];}_0x532124['status'](_0x18263f)[_0xfba6('0x2c')](_0x3002bc);};}exports[_0xfba6('0x2d')]=function(_0x536f99,_0x478586){var _0xc2ed26={},_0xe9b545={},_0x38891d={'count':0x0,'rows':[]};var _0x2d572f=_['map'](db[_0xfba6('0x2e')][_0xfba6('0x2f')],function(_0x1904a3){return{'name':_0x1904a3[_0xfba6('0x30')],'type':_0x1904a3['type'][_0xfba6('0x31')]};});_0xe9b545['model']=_[_0xfba6('0x32')](_0x2d572f,_0xfba6('0x2b'));_0xe9b545['query']=_[_0xfba6('0x33')](_0x536f99[_0xfba6('0x34')]);_0xe9b545[_0xfba6('0x35')]=_['intersection'](_0xe9b545[_0xfba6('0x36')],_0xe9b545['query']);_0xc2ed26[_0xfba6('0x37')]=_[_0xfba6('0x38')](_0xe9b545[_0xfba6('0x36')],qs[_0xfba6('0x39')](_0x536f99['query']['fields']));_0xc2ed26[_0xfba6('0x37')]=_0xc2ed26[_0xfba6('0x37')]['length']?_0xc2ed26[_0xfba6('0x37')]:_0xe9b545[_0xfba6('0x36')];if(!_0x536f99[_0xfba6('0x34')]['hasOwnProperty']('nolimit')){_0xc2ed26[_0xfba6('0x20')]=qs[_0xfba6('0x20')](_0x536f99[_0xfba6('0x34')][_0xfba6('0x20')]);_0xc2ed26['offset']=qs[_0xfba6('0x1e')](_0x536f99[_0xfba6('0x34')][_0xfba6('0x1e')]);}_0xc2ed26[_0xfba6('0x3a')]=qs['sort'](_0x536f99['query'][_0xfba6('0x3b')]);_0xc2ed26['where']=qs['filters'](_[_0xfba6('0x3c')](_0x536f99[_0xfba6('0x34')],_0xe9b545['filters']),_0x2d572f);if(_0x536f99[_0xfba6('0x34')][_0xfba6('0x3d')]){_0xc2ed26[_0xfba6('0x3e')]=_[_0xfba6('0x3f')](_0xc2ed26[_0xfba6('0x3e')],{'$or':_[_0xfba6('0x32')](_0x2d572f,function(_0x64f6ea){if(_0x64f6ea[_0xfba6('0x40')]!=='VIRTUAL'){var _0x2a53d2={};_0x2a53d2[_0x64f6ea[_0xfba6('0x2b')]]={'$like':'%'+_0x536f99[_0xfba6('0x34')][_0xfba6('0x3d')]+'%'};return _0x2a53d2;}})});}_0xc2ed26=_[_0xfba6('0x3f')]({},_0xc2ed26,_0x536f99['options']);var _0x144f4b={'where':_0xc2ed26[_0xfba6('0x3e')]};return db['OpenchannelQueueReport']['count'](_0x144f4b)[_0xfba6('0x28')](function(_0x24d6fd){_0x38891d[_0xfba6('0x21')]=_0x24d6fd;if(_0x536f99[_0xfba6('0x34')][_0xfba6('0x41')]){_0xc2ed26[_0xfba6('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0xc2ed26);})['then'](function(_0x3842b9){_0x38891d['rows']=_0x3842b9;return _0x38891d;})[_0xfba6('0x28')](respondWithFilteredResult(_0x478586,_0xc2ed26))[_0xfba6('0x43')](handleError(_0x478586,null));};exports[_0xfba6('0x44')]=function(_0x449510,_0x144a70){var _0x35eb40={'raw':!![],'where':{'id':_0x449510[_0xfba6('0x45')]['id']}},_0x2ad036={};_0x2ad036[_0xfba6('0x36')]=_[_0xfba6('0x33')](db[_0xfba6('0x2e')][_0xfba6('0x2f')]);_0x2ad036['query']=_[_0xfba6('0x33')](_0x449510[_0xfba6('0x34')]);_0x2ad036[_0xfba6('0x35')]=_['intersection'](_0x2ad036['model'],_0x2ad036[_0xfba6('0x34')]);_0x35eb40[_0xfba6('0x37')]=_['intersection'](_0x2ad036[_0xfba6('0x36')],qs[_0xfba6('0x39')](_0x449510[_0xfba6('0x34')][_0xfba6('0x39')]));_0x35eb40[_0xfba6('0x37')]=_0x35eb40[_0xfba6('0x37')][_0xfba6('0x46')]?_0x35eb40['attributes']:_0x2ad036[_0xfba6('0x36')];if(_0x449510['query'][_0xfba6('0x41')]){_0x35eb40[_0xfba6('0x42')]=[{'all':!![]}];}_0x35eb40=_[_0xfba6('0x3f')]({},_0x35eb40,_0x449510[_0xfba6('0x47')]);return db[_0xfba6('0x2e')]['find'](_0x35eb40)[_0xfba6('0x28')](handleEntityNotFound(_0x144a70,null))[_0xfba6('0x28')](respondWithResult(_0x144a70,null))['catch'](handleError(_0x144a70,null));};exports[_0xfba6('0x48')]=function(_0x428742,_0xde948){return db[_0xfba6('0x2e')][_0xfba6('0x48')](_0x428742[_0xfba6('0x49')],{})['then'](respondWithResult(_0xde948,0xc9))['catch'](handleError(_0xde948,null));};exports[_0xfba6('0x27')]=function(_0x59a231,_0x11ea5d){if(_0x59a231[_0xfba6('0x49')]['id']){delete _0x59a231[_0xfba6('0x49')]['id'];}return db[_0xfba6('0x2e')]['find']({'where':{'id':_0x59a231['params']['id']}})['then'](handleEntityNotFound(_0x11ea5d,null))[_0xfba6('0x28')](saveUpdates(_0x59a231[_0xfba6('0x49')],null))[_0xfba6('0x28')](respondWithResult(_0x11ea5d,null))['catch'](handleError(_0x11ea5d,null));};exports[_0xfba6('0x29')]=function(_0x30df68,_0x410e42){return db[_0xfba6('0x2e')]['find']({'where':{'id':_0x30df68[_0xfba6('0x45')]['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0x410e42,null))['then'](removeEntity(_0x410e42,null))[_0xfba6('0x43')](handleError(_0x410e42,null));};exports['describe']=function(_0x48d475,_0x1463f4){return db[_0xfba6('0x2e')]['describe']()['then'](respondWithResult(_0x1463f4,null))[_0xfba6('0x43')](handleError(_0x1463f4,null));}; \ No newline at end of file +var _0xa022=['destroy','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','update','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','then'];(function(_0x269963,_0x3e9a38){var _0x3f1bf2=function(_0x576fba){while(--_0x576fba){_0x269963['push'](_0x269963['shift']());}};_0x3f1bf2(++_0x3e9a38);}(_0xa022,0x145));var _0x2a02=function(_0x414e16,_0x3d9dcf){_0x414e16=_0x414e16-0x0;var _0x4907a4=_0xa022[_0x414e16];return _0x4907a4;};'use strict';var emlformat=require(_0x2a02('0x0'));var rimraf=require(_0x2a02('0x1'));var zipdir=require(_0x2a02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2a02('0x3'));var BPromise=require(_0x2a02('0x4'));var Mustache=require(_0x2a02('0x5'));var util=require(_0x2a02('0x6'));var path=require('path');var sox=require(_0x2a02('0x7'));var csv=require(_0x2a02('0x8'));var ejs=require(_0x2a02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2a02('0xa'));var jsforce=require(_0x2a02('0xb'));var deskjs=require(_0x2a02('0xc'));var toCsv=require(_0x2a02('0x8'));var querystring=require(_0x2a02('0xd'));var Papa=require(_0x2a02('0xe'));var Redis=require(_0x2a02('0xf'));var authService=require(_0x2a02('0x10'));var qs=require(_0x2a02('0x11'));var as=require(_0x2a02('0x12'));var hardwareService=require(_0x2a02('0x13'));var logger=require('../../config/logger')(_0x2a02('0x14'));var utils=require(_0x2a02('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2a02('0x16'));var db=require(_0x2a02('0x17'))['db'];function respondWithStatusCode(_0x13f17c,_0x20a4e5){_0x20a4e5=_0x20a4e5||0xcc;return function(_0x454c23){if(_0x454c23){return _0x13f17c[_0x2a02('0x18')](_0x20a4e5);}return _0x13f17c[_0x2a02('0x19')](_0x20a4e5)[_0x2a02('0x1a')]();};}function respondWithResult(_0xa7f227,_0x111c06){_0x111c06=_0x111c06||0xc8;return function(_0x26760f){if(_0x26760f){return _0xa7f227[_0x2a02('0x19')](_0x111c06)[_0x2a02('0x1b')](_0x26760f);}};}function respondWithFilteredResult(_0x39126c,_0x5ed2d9){return function(_0xd80fad){if(_0xd80fad){var _0x52572f=typeof _0x5ed2d9[_0x2a02('0x1c')]==='undefined'&&typeof _0x5ed2d9[_0x2a02('0x1d')]==='undefined';var _0x4612d6=_0xd80fad[_0x2a02('0x1e')];var _0x28374e=_0x52572f?0x0:_0x5ed2d9[_0x2a02('0x1c')];var _0x207f12=_0x52572f?_0xd80fad[_0x2a02('0x1e')]:_0x5ed2d9[_0x2a02('0x1c')]+_0x5ed2d9[_0x2a02('0x1d')];var _0x2ff4be;if(_0x207f12>=_0x4612d6){_0x207f12=_0x4612d6;_0x2ff4be=0xc8;}else{_0x2ff4be=0xce;}_0x39126c['status'](_0x2ff4be);return _0x39126c[_0x2a02('0x1f')](_0x2a02('0x20'),_0x28374e+'-'+_0x207f12+'/'+_0x4612d6)[_0x2a02('0x1b')](_0xd80fad);}return null;};}function patchUpdates(_0xc1167a){return function(_0x348c8e){try{jsonpatch['apply'](_0x348c8e,_0xc1167a,!![]);}catch(_0x211dbd){return BPromise['reject'](_0x211dbd);}return _0x348c8e[_0x2a02('0x21')]();};}function saveUpdates(_0x49fe34,_0x542786){return function(_0x561254){if(_0x561254){return _0x561254['update'](_0x49fe34)[_0x2a02('0x22')](function(_0x41bd28){return _0x41bd28;});}return null;};}function removeEntity(_0x2aaf8d,_0x14ddfa){return function(_0x2385f2){if(_0x2385f2){return _0x2385f2[_0x2a02('0x23')]()[_0x2a02('0x22')](function(){_0x2aaf8d['status'](0xcc)[_0x2a02('0x1a')]();});}};}function handleEntityNotFound(_0x2c030a,_0x30e428){return function(_0x12c463){if(!_0x12c463){_0x2c030a['sendStatus'](0x194);}return _0x12c463;};}function handleError(_0x10e5c0,_0x4e21c3){_0x4e21c3=_0x4e21c3||0x1f4;return function(_0x1a55cf){logger[_0x2a02('0x24')](_0x1a55cf[_0x2a02('0x25')]);if(_0x1a55cf[_0x2a02('0x26')]){delete _0x1a55cf[_0x2a02('0x26')];}_0x10e5c0[_0x2a02('0x19')](_0x4e21c3)[_0x2a02('0x27')](_0x1a55cf);};}exports[_0x2a02('0x28')]=function(_0x5cfd99,_0x5de944){var _0x48b62d={},_0x2eebb3={},_0x458722={'count':0x0,'rows':[]};var _0x3c1599=_[_0x2a02('0x29')](db[_0x2a02('0x2a')]['rawAttributes'],function(_0x523b3d){return{'name':_0x523b3d[_0x2a02('0x2b')],'type':_0x523b3d[_0x2a02('0x2c')][_0x2a02('0x2d')]};});_0x2eebb3[_0x2a02('0x2e')]=_[_0x2a02('0x29')](_0x3c1599,'name');_0x2eebb3[_0x2a02('0x2f')]=_[_0x2a02('0x30')](_0x5cfd99[_0x2a02('0x2f')]);_0x2eebb3[_0x2a02('0x31')]=_['intersection'](_0x2eebb3[_0x2a02('0x2e')],_0x2eebb3[_0x2a02('0x2f')]);_0x48b62d['attributes']=_[_0x2a02('0x32')](_0x2eebb3['model'],qs[_0x2a02('0x33')](_0x5cfd99[_0x2a02('0x2f')][_0x2a02('0x33')]));_0x48b62d[_0x2a02('0x34')]=_0x48b62d['attributes'][_0x2a02('0x35')]?_0x48b62d[_0x2a02('0x34')]:_0x2eebb3[_0x2a02('0x2e')];if(!_0x5cfd99[_0x2a02('0x2f')][_0x2a02('0x36')]('nolimit')){_0x48b62d['limit']=qs[_0x2a02('0x1d')](_0x5cfd99[_0x2a02('0x2f')][_0x2a02('0x1d')]);_0x48b62d[_0x2a02('0x1c')]=qs[_0x2a02('0x1c')](_0x5cfd99['query'][_0x2a02('0x1c')]);}_0x48b62d[_0x2a02('0x37')]=qs['sort'](_0x5cfd99[_0x2a02('0x2f')][_0x2a02('0x38')]);_0x48b62d[_0x2a02('0x39')]=qs['filters'](_['pick'](_0x5cfd99[_0x2a02('0x2f')],_0x2eebb3[_0x2a02('0x31')]),_0x3c1599);if(_0x5cfd99['query'][_0x2a02('0x3a')]){_0x48b62d['where']=_[_0x2a02('0x3b')](_0x48b62d[_0x2a02('0x39')],{'$or':_[_0x2a02('0x29')](_0x3c1599,function(_0x1fcef5){if(_0x1fcef5[_0x2a02('0x2c')]!==_0x2a02('0x3c')){var _0x445479={};_0x445479[_0x1fcef5[_0x2a02('0x26')]]={'$like':'%'+_0x5cfd99[_0x2a02('0x2f')][_0x2a02('0x3a')]+'%'};return _0x445479;}})});}_0x48b62d=_[_0x2a02('0x3b')]({},_0x48b62d,_0x5cfd99[_0x2a02('0x3d')]);var _0x4e6ca3={'where':_0x48b62d[_0x2a02('0x39')]};return db[_0x2a02('0x2a')][_0x2a02('0x1e')](_0x4e6ca3)['then'](function(_0x3960a0){_0x458722['count']=_0x3960a0;if(_0x5cfd99[_0x2a02('0x2f')]['includeAll']){_0x48b62d[_0x2a02('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x2a02('0x3f')](_0x48b62d);})['then'](function(_0x445f2d){_0x458722[_0x2a02('0x40')]=_0x445f2d;return _0x458722;})[_0x2a02('0x22')](respondWithFilteredResult(_0x5de944,_0x48b62d))[_0x2a02('0x41')](handleError(_0x5de944,null));};exports['show']=function(_0x2dca6e,_0x47a164){var _0x45de71={'raw':!![],'where':{'id':_0x2dca6e[_0x2a02('0x42')]['id']}},_0x282774={};_0x282774[_0x2a02('0x2e')]=_[_0x2a02('0x30')](db['OpenchannelQueueReport']['rawAttributes']);_0x282774['query']=_[_0x2a02('0x30')](_0x2dca6e[_0x2a02('0x2f')]);_0x282774[_0x2a02('0x31')]=_['intersection'](_0x282774[_0x2a02('0x2e')],_0x282774[_0x2a02('0x2f')]);_0x45de71[_0x2a02('0x34')]=_[_0x2a02('0x32')](_0x282774[_0x2a02('0x2e')],qs[_0x2a02('0x33')](_0x2dca6e[_0x2a02('0x2f')][_0x2a02('0x33')]));_0x45de71[_0x2a02('0x34')]=_0x45de71[_0x2a02('0x34')]['length']?_0x45de71[_0x2a02('0x34')]:_0x282774['model'];if(_0x2dca6e[_0x2a02('0x2f')][_0x2a02('0x43')]){_0x45de71[_0x2a02('0x3e')]=[{'all':!![]}];}_0x45de71=_[_0x2a02('0x3b')]({},_0x45de71,_0x2dca6e[_0x2a02('0x3d')]);return db[_0x2a02('0x2a')]['find'](_0x45de71)['then'](handleEntityNotFound(_0x47a164,null))[_0x2a02('0x22')](respondWithResult(_0x47a164,null))[_0x2a02('0x41')](handleError(_0x47a164,null));};exports[_0x2a02('0x44')]=function(_0x14b266,_0x586020){return db[_0x2a02('0x2a')][_0x2a02('0x44')](_0x14b266[_0x2a02('0x45')],{})[_0x2a02('0x22')](respondWithResult(_0x586020,0xc9))[_0x2a02('0x41')](handleError(_0x586020,null));};exports[_0x2a02('0x46')]=function(_0x22feaf,_0x2c71ef){if(_0x22feaf[_0x2a02('0x45')]['id']){delete _0x22feaf[_0x2a02('0x45')]['id'];}return db[_0x2a02('0x2a')]['find']({'where':{'id':_0x22feaf[_0x2a02('0x42')]['id']}})[_0x2a02('0x22')](handleEntityNotFound(_0x2c71ef,null))[_0x2a02('0x22')](saveUpdates(_0x22feaf['body'],null))[_0x2a02('0x22')](respondWithResult(_0x2c71ef,null))[_0x2a02('0x41')](handleError(_0x2c71ef,null));};exports[_0x2a02('0x23')]=function(_0x46938f,_0x50c06c){return db[_0x2a02('0x2a')]['find']({'where':{'id':_0x46938f[_0x2a02('0x42')]['id']}})[_0x2a02('0x22')](handleEntityNotFound(_0x50c06c,null))[_0x2a02('0x22')](removeEntity(_0x50c06c,null))[_0x2a02('0x41')](handleError(_0x50c06c,null));};exports[_0x2a02('0x47')]=function(_0x83ec11,_0x5f2678){return db[_0x2a02('0x2a')][_0x2a02('0x47')]()['then'](respondWithResult(_0x5f2678,null))[_0x2a02('0x41')](handleError(_0x5f2678,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7a3163b..37097ff 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x476f21,_0x1167e4){var _0xa50928=function(_0x1f3211){while(--_0x1f3211){_0x476f21['push'](_0x476f21['shift']());}};_0xa50928(++_0x1167e4);}(_0x7a54,0x106));var _0x47a5=function(_0x209587,_0x3e4e82){_0x209587=_0x209587-0x0;var _0x2e701f=_0x7a54[_0x209587];return _0x2e701f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x31396a,_0x53099a){var _0x5f5888=function(_0x453e44){while(--_0x453e44){_0x31396a['push'](_0x31396a['shift']());}};_0x5f5888(++_0x53099a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'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':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 207fcd9..706a041 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 _0xb62e=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','UpdateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['create'](_0x39b138[_0xeb62('0x1a')],{'raw':_0x39b138[_0xeb62('0x1b')]?_0x39b138[_0xeb62('0x1b')][_0xeb62('0x1c')]===undefined?!![]:![]:!![]})[_0xeb62('0x1d')](function(_0x24cbf3){logger[_0xeb62('0xd')]('CreateOpenchannelQueueReport',_0x39b138);logger['debug'](_0xeb62('0x18'),_0x39b138,JSON[_0xeb62('0x12')](_0x24cbf3));_0x27efc8(_0x24cbf3);})[_0xeb62('0x17')](function(_0x13243f){logger[_0xeb62('0x13')]('CreateOpenchannelQueueReport',_0x13243f['message'],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x13243f[_0xeb62('0x15')]));});});};exports[_0xeb62('0x1e')]=function(_0x395b70){var _0x55a169=this;return new Promise(function(_0x4e92f5,_0x3ef988){return db['OpenchannelQueueReport'][_0xeb62('0x1f')](_0x395b70['body'],{'raw':_0x395b70[_0xeb62('0x1b')]?_0x395b70['options'][_0xeb62('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')]['where']||null:null,'attributes':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x20')]||null:null,'limit':_0x395b70[_0xeb62('0x1b')]?_0x395b70[_0xeb62('0x1b')][_0xeb62('0x21')]||null:null})['then'](function(_0x192517){logger[_0xeb62('0xd')]('UpdateOpenchannelQueueReport',_0x395b70);logger[_0xeb62('0x10')](_0xeb62('0x1e'),_0x395b70,JSON[_0xeb62('0x12')](_0x192517));_0x4e92f5(_0x192517);})[_0xeb62('0x17')](function(_0x235448){logger['error']('UpdateOpenchannelQueueReport',_0x235448[_0xeb62('0x15')],_0x395b70);_0x3ef988(_0x55a169[_0xeb62('0x13')](0x1f4,_0x235448[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0x373d=['error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify'];(function(_0x13f6fb,_0x1c9af8){var _0x56b4b8=function(_0x20f9d7){while(--_0x20f9d7){_0x13f6fb['push'](_0x13f6fb['shift']());}};_0x56b4b8(++_0x1c9af8);}(_0x373d,0x1e2));var _0xd373=function(_0xa1b8e1,_0x31e781){_0xa1b8e1=_0xa1b8e1-0x0;var _0x16e56c=_0x373d[_0xa1b8e1];return _0x16e56c;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['CreateOpenchannelQueueReport']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['OpenchannelQueueReport']['create'](_0x460259[_0xd373('0x14')],{'raw':_0x460259[_0xd373('0x15')]?_0x460259[_0xd373('0x15')][_0xd373('0x16')]===undefined?!![]:![]:!![]})[_0xd373('0x17')](function(_0x181eb2){logger['info'](_0xd373('0x18'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x18'),_0x460259,JSON[_0xd373('0xd')](_0x181eb2));_0x55c5c7(_0x181eb2);})[_0xd373('0x13')](function(_0x3aa1c5){logger['error'](_0xd373('0x18'),_0x3aa1c5[_0xd373('0x10')],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0x3aa1c5[_0xd373('0x10')]));});});};exports[_0xd373('0x19')]=function(_0x238ffd){var _0x466a03=this;return new Promise(function(_0x109e4c,_0x1ab540){return db[_0xd373('0x1a')][_0xd373('0x1b')](_0x238ffd[_0xd373('0x14')],{'raw':_0x238ffd[_0xd373('0x15')]?_0x238ffd[_0xd373('0x15')][_0xd373('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x238ffd[_0xd373('0x15')]?_0x238ffd[_0xd373('0x15')][_0xd373('0x1c')]||null:null,'attributes':_0x238ffd[_0xd373('0x15')]?_0x238ffd[_0xd373('0x15')][_0xd373('0x1d')]||null:null,'limit':_0x238ffd[_0xd373('0x15')]?_0x238ffd[_0xd373('0x15')][_0xd373('0x1e')]||null:null})[_0xd373('0x17')](function(_0x2869e5){logger[_0xd373('0xa')](_0xd373('0x19'),_0x238ffd);logger[_0xd373('0xc')](_0xd373('0x19'),_0x238ffd,JSON['stringify'](_0x2869e5));_0x109e4c(_0x2869e5);})[_0xd373('0x13')](function(_0x490842){logger['error'](_0xd373('0x19'),_0x490842[_0xd373('0x10')],_0x238ffd);_0x1ab540(_0x466a03[_0xd373('0xe')](0x1f4,_0x490842[_0xd373('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index fe1fa4f..1ccf59e 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 _0xf76f=['/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x594245,_0x37fa88){var _0x538195=function(_0x96af1){while(--_0x96af1){_0x594245['push'](_0x594245['shift']());}};_0x538195(++_0x37fa88);}(_0xf76f,0x1bf));var _0xff76=function(_0x3e9b78,_0x4ecc13){_0x3e9b78=_0x3e9b78-0x0;var _0xcc94a3=_0xf76f[_0x3e9b78];return _0xcc94a3;};'use strict';var multer=require(_0xff76('0x0'));var util=require(_0xff76('0x1'));var path=require(_0xff76('0x2'));var timeout=require('connect-timeout');var express=require(_0xff76('0x3'));var router=express[_0xff76('0x4')]();var fs_extra=require(_0xff76('0x5'));var auth=require(_0xff76('0x6'));var interaction=require(_0xff76('0x7'));var config=require(_0xff76('0x8'));var controller=require(_0xff76('0x9'));router[_0xff76('0xa')]('/',auth[_0xff76('0xb')](),controller[_0xff76('0xc')]);router[_0xff76('0xa')](_0xff76('0xd'),auth[_0xff76('0xb')](),controller[_0xff76('0xe')]);router[_0xff76('0xa')](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x10')]);router[_0xff76('0x11')]('/',auth[_0xff76('0xb')](),controller[_0xff76('0x12')]);router[_0xff76('0x13')](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x14')]);router['delete'](_0xff76('0xf'),auth[_0xff76('0xb')](),controller[_0xff76('0x15')]);module['exports']=router; \ No newline at end of file +var _0x20cc=['post','create','put','update','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0xfa874a,_0x990e70){var _0x3ffce4=function(_0x583540){while(--_0x583540){_0xfa874a['push'](_0xfa874a['shift']());}};_0x3ffce4(++_0x990e70);}(_0x20cc,0x1ec));var _0xc20c=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x20cc[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var path=require(_0xc20c('0x2'));var timeout=require(_0xc20c('0x3'));var express=require(_0xc20c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc20c('0x5'));var interaction=require(_0xc20c('0x6'));var config=require('../../config/environment');var controller=require(_0xc20c('0x7'));router[_0xc20c('0x8')]('/',auth[_0xc20c('0x9')](),controller[_0xc20c('0xa')]);router[_0xc20c('0x8')](_0xc20c('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xc20c('0x8')]('/:id',auth[_0xc20c('0x9')](),controller['show']);router[_0xc20c('0xc')]('/',auth['isAuthenticated'](),controller[_0xc20c('0xd')]);router[_0xc20c('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc20c('0xf')]);router['delete'](_0xc20c('0x10'),auth[_0xc20c('0x9')](),controller[_0xc20c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 87bfe69..33f03f8 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xbd2601,_0x393b2a){var _0x34de0a=function(_0x536346){while(--_0x536346){_0xbd2601['push'](_0xbd2601['shift']());}};_0x34de0a(++_0x393b2a);}(_0x70e0,0x17b));var _0x070e=function(_0x1acb77,_0x460b09){_0x1acb77=_0x1acb77-0x0;var _0x2054bb=_0x70e0[_0x1acb77];return _0x2054bb;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x171220,_0x4715ad){var _0x177114=function(_0x5ea6b2){while(--_0x5ea6b2){_0x171220['push'](_0x171220['shift']());}};_0x177114(++_0x4715ad);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xcb91[_0x5b5cde];return _0x364ad2;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ab35a17..7ada8a7 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 _0xf829=['stack','name','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','show','params','include','find','catch','create','body','update','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf829,0x14f));var _0x9f82=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0xf829[_0x3776b4];return _0x1636d9;};'use strict';var emlformat=require(_0x9f82('0x0'));var rimraf=require(_0x9f82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f82('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f82('0x3'));var util=require(_0x9f82('0x4'));var path=require(_0x9f82('0x5'));var sox=require('sox');var csv=require(_0x9f82('0x6'));var ejs=require(_0x9f82('0x7'));var fs=require('fs');var fs_extra=require(_0x9f82('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f82('0x9'));var jsforce=require(_0x9f82('0xa'));var deskjs=require(_0x9f82('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9f82('0xc'));var Papa=require(_0x9f82('0xd'));var Redis=require(_0x9f82('0xe'));var authService=require(_0x9f82('0xf'));var qs=require(_0x9f82('0x10'));var as=require(_0x9f82('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f82('0x12'))(_0x9f82('0x13'));var utils=require(_0x9f82('0x14'));var config=require(_0x9f82('0x15'));var licenseUtil=require(_0x9f82('0x16'));var db=require(_0x9f82('0x17'))['db'];function respondWithStatusCode(_0x1f1806,_0x297be9){_0x297be9=_0x297be9||0xcc;return function(_0xed5961){if(_0xed5961){return _0x1f1806[_0x9f82('0x18')](_0x297be9);}return _0x1f1806[_0x9f82('0x19')](_0x297be9)[_0x9f82('0x1a')]();};}function respondWithResult(_0x3349b8,_0x10fa75){_0x10fa75=_0x10fa75||0xc8;return function(_0x38c0e1){if(_0x38c0e1){return _0x3349b8['status'](_0x10fa75)[_0x9f82('0x1b')](_0x38c0e1);}};}function respondWithFilteredResult(_0x1b23bb,_0x53be35){return function(_0x1fcd0b){if(_0x1fcd0b){var _0x3f0fb1=typeof _0x53be35[_0x9f82('0x1c')]===_0x9f82('0x1d')&&typeof _0x53be35[_0x9f82('0x1e')]===_0x9f82('0x1d');var _0x5a6487=_0x1fcd0b[_0x9f82('0x1f')];var _0x47e6d2=_0x3f0fb1?0x0:_0x53be35[_0x9f82('0x1c')];var _0x3178e5=_0x3f0fb1?_0x1fcd0b[_0x9f82('0x1f')]:_0x53be35['offset']+_0x53be35[_0x9f82('0x1e')];var _0x43ca1c;if(_0x3178e5>=_0x5a6487){_0x3178e5=_0x5a6487;_0x43ca1c=0xc8;}else{_0x43ca1c=0xce;}_0x1b23bb[_0x9f82('0x19')](_0x43ca1c);return _0x1b23bb[_0x9f82('0x20')](_0x9f82('0x21'),_0x47e6d2+'-'+_0x3178e5+'/'+_0x5a6487)[_0x9f82('0x1b')](_0x1fcd0b);}return null;};}function patchUpdates(_0x2ac49f){return function(_0x149b5a){try{jsonpatch[_0x9f82('0x22')](_0x149b5a,_0x2ac49f,!![]);}catch(_0x86fb13){return BPromise[_0x9f82('0x23')](_0x86fb13);}return _0x149b5a[_0x9f82('0x24')]();};}function saveUpdates(_0x569419,_0x4873fe){return function(_0x3d0fe9){if(_0x3d0fe9){return _0x3d0fe9['update'](_0x569419)['then'](function(_0xb90b88){return _0xb90b88;});}return null;};}function removeEntity(_0x4614df,_0x10d258){return function(_0x5338ac){if(_0x5338ac){return _0x5338ac[_0x9f82('0x25')]()[_0x9f82('0x26')](function(){_0x4614df[_0x9f82('0x19')](0xcc)[_0x9f82('0x1a')]();});}};}function handleEntityNotFound(_0x57d8a4,_0x4d1dbb){return function(_0xd35b57){if(!_0xd35b57){_0x57d8a4['sendStatus'](0x194);}return _0xd35b57;};}function handleError(_0xa95afa,_0x575204){_0x575204=_0x575204||0x1f4;return function(_0x505c74){logger[_0x9f82('0x27')](_0x505c74[_0x9f82('0x28')]);if(_0x505c74[_0x9f82('0x29')]){delete _0x505c74['name'];}_0xa95afa[_0x9f82('0x19')](_0x575204)['send'](_0x505c74);};}exports[_0x9f82('0x2a')]=function(_0x401df4,_0x4100c3){var _0x3f9d19={},_0x357aa0={},_0x49f62a={'count':0x0,'rows':[]};var _0x123839=_['map'](db[_0x9f82('0x2b')][_0x9f82('0x2c')],function(_0x3efb37){return{'name':_0x3efb37[_0x9f82('0x2d')],'type':_0x3efb37[_0x9f82('0x2e')][_0x9f82('0x2f')]};});_0x357aa0[_0x9f82('0x30')]=_['map'](_0x123839,_0x9f82('0x29'));_0x357aa0['query']=_[_0x9f82('0x31')](_0x401df4[_0x9f82('0x32')]);_0x357aa0[_0x9f82('0x33')]=_[_0x9f82('0x34')](_0x357aa0[_0x9f82('0x30')],_0x357aa0[_0x9f82('0x32')]);_0x3f9d19[_0x9f82('0x35')]=_[_0x9f82('0x34')](_0x357aa0[_0x9f82('0x30')],qs[_0x9f82('0x36')](_0x401df4[_0x9f82('0x32')]['fields']));_0x3f9d19[_0x9f82('0x35')]=_0x3f9d19[_0x9f82('0x35')][_0x9f82('0x37')]?_0x3f9d19['attributes']:_0x357aa0[_0x9f82('0x30')];if(!_0x401df4[_0x9f82('0x32')][_0x9f82('0x38')]('nolimit')){_0x3f9d19[_0x9f82('0x1e')]=qs[_0x9f82('0x1e')](_0x401df4[_0x9f82('0x32')]['limit']);_0x3f9d19['offset']=qs[_0x9f82('0x1c')](_0x401df4[_0x9f82('0x32')][_0x9f82('0x1c')]);}_0x3f9d19[_0x9f82('0x39')]=qs[_0x9f82('0x3a')](_0x401df4['query'][_0x9f82('0x3a')]);_0x3f9d19[_0x9f82('0x3b')]=qs[_0x9f82('0x33')](_['pick'](_0x401df4[_0x9f82('0x32')],_0x357aa0[_0x9f82('0x33')]),_0x123839);if(_0x401df4[_0x9f82('0x32')][_0x9f82('0x3c')]){_0x3f9d19[_0x9f82('0x3b')]=_[_0x9f82('0x3d')](_0x3f9d19[_0x9f82('0x3b')],{'$or':_[_0x9f82('0x3e')](_0x123839,function(_0x57e4f5){if(_0x57e4f5['type']!==_0x9f82('0x3f')){var _0x179260={};_0x179260[_0x57e4f5['name']]={'$like':'%'+_0x401df4[_0x9f82('0x32')][_0x9f82('0x3c')]+'%'};return _0x179260;}})});}_0x3f9d19=_[_0x9f82('0x3d')]({},_0x3f9d19,_0x401df4[_0x9f82('0x40')]);var _0x1c2d43={'where':_0x3f9d19[_0x9f82('0x3b')]};return db[_0x9f82('0x2b')][_0x9f82('0x1f')](_0x1c2d43)[_0x9f82('0x26')](function(_0xd746fe){_0x49f62a[_0x9f82('0x1f')]=_0xd746fe;if(_0x401df4[_0x9f82('0x32')][_0x9f82('0x41')]){_0x3f9d19['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x3f9d19);})[_0x9f82('0x26')](function(_0x19d742){_0x49f62a['rows']=_0x19d742;return _0x49f62a;})[_0x9f82('0x26')](respondWithFilteredResult(_0x4100c3,_0x3f9d19))['catch'](handleError(_0x4100c3,null));};exports[_0x9f82('0x42')]=function(_0x670d5f,_0x315629){var _0x584fc8={'raw':!![],'where':{'id':_0x670d5f[_0x9f82('0x43')]['id']}},_0x4b0b8c={};_0x4b0b8c['model']=_[_0x9f82('0x31')](db[_0x9f82('0x2b')][_0x9f82('0x2c')]);_0x4b0b8c[_0x9f82('0x32')]=_[_0x9f82('0x31')](_0x670d5f['query']);_0x4b0b8c['filters']=_[_0x9f82('0x34')](_0x4b0b8c[_0x9f82('0x30')],_0x4b0b8c['query']);_0x584fc8[_0x9f82('0x35')]=_[_0x9f82('0x34')](_0x4b0b8c[_0x9f82('0x30')],qs[_0x9f82('0x36')](_0x670d5f[_0x9f82('0x32')][_0x9f82('0x36')]));_0x584fc8[_0x9f82('0x35')]=_0x584fc8[_0x9f82('0x35')][_0x9f82('0x37')]?_0x584fc8['attributes']:_0x4b0b8c[_0x9f82('0x30')];if(_0x670d5f[_0x9f82('0x32')]['includeAll']){_0x584fc8[_0x9f82('0x44')]=[{'all':!![]}];}_0x584fc8=_[_0x9f82('0x3d')]({},_0x584fc8,_0x670d5f[_0x9f82('0x40')]);return db[_0x9f82('0x2b')][_0x9f82('0x45')](_0x584fc8)['then'](handleEntityNotFound(_0x315629,null))[_0x9f82('0x26')](respondWithResult(_0x315629,null))[_0x9f82('0x46')](handleError(_0x315629,null));};exports[_0x9f82('0x47')]=function(_0x456b40,_0x21ee84){return db[_0x9f82('0x2b')][_0x9f82('0x47')](_0x456b40[_0x9f82('0x48')],{})[_0x9f82('0x26')](respondWithResult(_0x21ee84,0xc9))[_0x9f82('0x46')](handleError(_0x21ee84,null));};exports[_0x9f82('0x49')]=function(_0x465a54,_0x44ab3c){if(_0x465a54['body']['id']){delete _0x465a54[_0x9f82('0x48')]['id'];}return db[_0x9f82('0x2b')][_0x9f82('0x45')]({'where':{'id':_0x465a54[_0x9f82('0x43')]['id']}})[_0x9f82('0x26')](handleEntityNotFound(_0x44ab3c,null))[_0x9f82('0x26')](saveUpdates(_0x465a54[_0x9f82('0x48')],null))[_0x9f82('0x26')](respondWithResult(_0x44ab3c,null))[_0x9f82('0x46')](handleError(_0x44ab3c,null));};exports[_0x9f82('0x25')]=function(_0xd2feb6,_0x5d3428){return db[_0x9f82('0x2b')][_0x9f82('0x45')]({'where':{'id':_0xd2feb6[_0x9f82('0x43')]['id']}})[_0x9f82('0x26')](handleEntityNotFound(_0x5d3428,null))[_0x9f82('0x26')](removeEntity(_0x5d3428,null))[_0x9f82('0x46')](handleError(_0x5d3428,null));};exports['describe']=function(_0x5ca2b2,_0x384a58){return db[_0x9f82('0x2b')][_0x9f82('0x4a')]()[_0x9f82('0x26')](respondWithResult(_0x384a58,null))[_0x9f82('0x46')](handleError(_0x384a58,null));}; \ No newline at end of file +var _0x6fcf=['sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4b2457,_0x52773e){var _0x456a02=function(_0x4e7321){while(--_0x4e7321){_0x4b2457['push'](_0x4b2457['shift']());}};_0x456a02(++_0x52773e);}(_0x6fcf,0x1a2));var _0xf6fc=function(_0x459963,_0x5a366a){_0x459963=_0x459963-0x0;var _0xbe84e3=_0x6fcf[_0x459963];return _0xbe84e3;};'use strict';var emlformat=require(_0xf6fc('0x0'));var rimraf=require(_0xf6fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6fc('0x2'));var rp=require(_0xf6fc('0x3'));var moment=require(_0xf6fc('0x4'));var BPromise=require(_0xf6fc('0x5'));var Mustache=require(_0xf6fc('0x6'));var util=require(_0xf6fc('0x7'));var path=require('path');var sox=require(_0xf6fc('0x8'));var csv=require(_0xf6fc('0x9'));var ejs=require(_0xf6fc('0xa'));var fs=require('fs');var fs_extra=require(_0xf6fc('0xb'));var _=require(_0xf6fc('0xc'));var squel=require(_0xf6fc('0xd'));var crypto=require(_0xf6fc('0xe'));var jsforce=require(_0xf6fc('0xf'));var deskjs=require(_0xf6fc('0x10'));var toCsv=require(_0xf6fc('0x9'));var querystring=require(_0xf6fc('0x11'));var Papa=require(_0xf6fc('0x12'));var Redis=require(_0xf6fc('0x13'));var authService=require(_0xf6fc('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xf6fc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6fc('0x16'))(_0xf6fc('0x17'));var utils=require('../../config/utils');var config=require(_0xf6fc('0x18'));var licenseUtil=require(_0xf6fc('0x19'));var db=require(_0xf6fc('0x1a'))['db'];function respondWithStatusCode(_0x5b7d76,_0x4bb480){_0x4bb480=_0x4bb480||0xcc;return function(_0x3344db){if(_0x3344db){return _0x5b7d76[_0xf6fc('0x1b')](_0x4bb480);}return _0x5b7d76[_0xf6fc('0x1c')](_0x4bb480)['end']();};}function respondWithResult(_0x205524,_0x260340){_0x260340=_0x260340||0xc8;return function(_0x37c7ab){if(_0x37c7ab){return _0x205524[_0xf6fc('0x1c')](_0x260340)[_0xf6fc('0x1d')](_0x37c7ab);}};}function respondWithFilteredResult(_0x11470c,_0x8a649f){return function(_0x4d280c){if(_0x4d280c){var _0x4908f7=typeof _0x8a649f[_0xf6fc('0x1e')]===_0xf6fc('0x1f')&&typeof _0x8a649f[_0xf6fc('0x20')]==='undefined';var _0x49a992=_0x4d280c[_0xf6fc('0x21')];var _0x418f6c=_0x4908f7?0x0:_0x8a649f['offset'];var _0x51ee20=_0x4908f7?_0x4d280c['count']:_0x8a649f['offset']+_0x8a649f[_0xf6fc('0x20')];var _0x2e7c3c;if(_0x51ee20>=_0x49a992){_0x51ee20=_0x49a992;_0x2e7c3c=0xc8;}else{_0x2e7c3c=0xce;}_0x11470c[_0xf6fc('0x1c')](_0x2e7c3c);return _0x11470c[_0xf6fc('0x22')](_0xf6fc('0x23'),_0x418f6c+'-'+_0x51ee20+'/'+_0x49a992)['json'](_0x4d280c);}return null;};}function patchUpdates(_0x4301ec){return function(_0xb3faa6){try{jsonpatch[_0xf6fc('0x24')](_0xb3faa6,_0x4301ec,!![]);}catch(_0x21e4a9){return BPromise[_0xf6fc('0x25')](_0x21e4a9);}return _0xb3faa6[_0xf6fc('0x26')]();};}function saveUpdates(_0x2c0f44,_0x47ba3a){return function(_0x32e9bc){if(_0x32e9bc){return _0x32e9bc[_0xf6fc('0x27')](_0x2c0f44)['then'](function(_0x35002d){return _0x35002d;});}return null;};}function removeEntity(_0x1601cf,_0x45ad6a){return function(_0x4327ba){if(_0x4327ba){return _0x4327ba[_0xf6fc('0x28')]()[_0xf6fc('0x29')](function(){_0x1601cf[_0xf6fc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1276e7,_0x3222bf){return function(_0x5e7037){if(!_0x5e7037){_0x1276e7[_0xf6fc('0x1b')](0x194);}return _0x5e7037;};}function handleError(_0x5630f0,_0x1e2a7f){_0x1e2a7f=_0x1e2a7f||0x1f4;return function(_0x5c2717){logger['error'](_0x5c2717[_0xf6fc('0x2a')]);if(_0x5c2717[_0xf6fc('0x2b')]){delete _0x5c2717['name'];}_0x5630f0[_0xf6fc('0x1c')](_0x1e2a7f)[_0xf6fc('0x2c')](_0x5c2717);};}exports[_0xf6fc('0x2d')]=function(_0x362ea8,_0x4794d2){var _0x381613={},_0x2ccf2d={},_0x44a6d0={'count':0x0,'rows':[]};var _0x3eccee=_[_0xf6fc('0x2e')](db[_0xf6fc('0x2f')][_0xf6fc('0x30')],function(_0x208761){return{'name':_0x208761[_0xf6fc('0x31')],'type':_0x208761[_0xf6fc('0x32')][_0xf6fc('0x33')]};});_0x2ccf2d[_0xf6fc('0x34')]=_['map'](_0x3eccee,_0xf6fc('0x2b'));_0x2ccf2d[_0xf6fc('0x35')]=_[_0xf6fc('0x36')](_0x362ea8[_0xf6fc('0x35')]);_0x2ccf2d['filters']=_['intersection'](_0x2ccf2d['model'],_0x2ccf2d[_0xf6fc('0x35')]);_0x381613[_0xf6fc('0x37')]=_[_0xf6fc('0x38')](_0x2ccf2d[_0xf6fc('0x34')],qs[_0xf6fc('0x39')](_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x39')]));_0x381613[_0xf6fc('0x37')]=_0x381613['attributes'][_0xf6fc('0x3a')]?_0x381613[_0xf6fc('0x37')]:_0x2ccf2d[_0xf6fc('0x34')];if(!_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x3b')](_0xf6fc('0x3c'))){_0x381613[_0xf6fc('0x20')]=qs['limit'](_0x362ea8[_0xf6fc('0x35')]['limit']);_0x381613[_0xf6fc('0x1e')]=qs[_0xf6fc('0x1e')](_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x1e')]);}_0x381613[_0xf6fc('0x3d')]=qs[_0xf6fc('0x3e')](_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x3e')]);_0x381613['where']=qs[_0xf6fc('0x3f')](_[_0xf6fc('0x40')](_0x362ea8[_0xf6fc('0x35')],_0x2ccf2d[_0xf6fc('0x3f')]),_0x3eccee);if(_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x41')]){_0x381613['where']=_[_0xf6fc('0x42')](_0x381613[_0xf6fc('0x43')],{'$or':_[_0xf6fc('0x2e')](_0x3eccee,function(_0x2ffb61){if(_0x2ffb61[_0xf6fc('0x32')]!==_0xf6fc('0x44')){var _0xddd34e={};_0xddd34e[_0x2ffb61[_0xf6fc('0x2b')]]={'$like':'%'+_0x362ea8['query']['filter']+'%'};return _0xddd34e;}})});}_0x381613=_[_0xf6fc('0x42')]({},_0x381613,_0x362ea8['options']);var _0x259681={'where':_0x381613[_0xf6fc('0x43')]};return db['OpenchannelTransferReport'][_0xf6fc('0x21')](_0x259681)[_0xf6fc('0x29')](function(_0x45fdc3){_0x44a6d0[_0xf6fc('0x21')]=_0x45fdc3;if(_0x362ea8[_0xf6fc('0x35')][_0xf6fc('0x45')]){_0x381613[_0xf6fc('0x46')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xf6fc('0x47')](_0x381613);})[_0xf6fc('0x29')](function(_0x1ebfd9){_0x44a6d0[_0xf6fc('0x48')]=_0x1ebfd9;return _0x44a6d0;})[_0xf6fc('0x29')](respondWithFilteredResult(_0x4794d2,_0x381613))['catch'](handleError(_0x4794d2,null));};exports[_0xf6fc('0x49')]=function(_0x2cf701,_0x5588b8){var _0x44c01c={'raw':!![],'where':{'id':_0x2cf701[_0xf6fc('0x4a')]['id']}},_0x4981e5={};_0x4981e5[_0xf6fc('0x34')]=_[_0xf6fc('0x36')](db[_0xf6fc('0x2f')][_0xf6fc('0x30')]);_0x4981e5[_0xf6fc('0x35')]=_[_0xf6fc('0x36')](_0x2cf701[_0xf6fc('0x35')]);_0x4981e5[_0xf6fc('0x3f')]=_['intersection'](_0x4981e5[_0xf6fc('0x34')],_0x4981e5['query']);_0x44c01c[_0xf6fc('0x37')]=_[_0xf6fc('0x38')](_0x4981e5[_0xf6fc('0x34')],qs[_0xf6fc('0x39')](_0x2cf701[_0xf6fc('0x35')][_0xf6fc('0x39')]));_0x44c01c[_0xf6fc('0x37')]=_0x44c01c[_0xf6fc('0x37')][_0xf6fc('0x3a')]?_0x44c01c['attributes']:_0x4981e5[_0xf6fc('0x34')];if(_0x2cf701[_0xf6fc('0x35')][_0xf6fc('0x45')]){_0x44c01c[_0xf6fc('0x46')]=[{'all':!![]}];}_0x44c01c=_['merge']({},_0x44c01c,_0x2cf701['options']);return db[_0xf6fc('0x2f')][_0xf6fc('0x4b')](_0x44c01c)[_0xf6fc('0x29')](handleEntityNotFound(_0x5588b8,null))[_0xf6fc('0x29')](respondWithResult(_0x5588b8,null))[_0xf6fc('0x4c')](handleError(_0x5588b8,null));};exports[_0xf6fc('0x4d')]=function(_0x23d12f,_0x2b2d41){return db[_0xf6fc('0x2f')][_0xf6fc('0x4d')](_0x23d12f[_0xf6fc('0x4e')],{})[_0xf6fc('0x29')](respondWithResult(_0x2b2d41,0xc9))['catch'](handleError(_0x2b2d41,null));};exports[_0xf6fc('0x27')]=function(_0x1d9da5,_0x3eea3e){if(_0x1d9da5['body']['id']){delete _0x1d9da5[_0xf6fc('0x4e')]['id'];}return db[_0xf6fc('0x2f')][_0xf6fc('0x4b')]({'where':{'id':_0x1d9da5['params']['id']}})['then'](handleEntityNotFound(_0x3eea3e,null))[_0xf6fc('0x29')](saveUpdates(_0x1d9da5['body'],null))[_0xf6fc('0x29')](respondWithResult(_0x3eea3e,null))[_0xf6fc('0x4c')](handleError(_0x3eea3e,null));};exports['destroy']=function(_0x866735,_0x56789a){return db[_0xf6fc('0x2f')][_0xf6fc('0x4b')]({'where':{'id':_0x866735['params']['id']}})[_0xf6fc('0x29')](handleEntityNotFound(_0x56789a,null))[_0xf6fc('0x29')](removeEntity(_0x56789a,null))[_0xf6fc('0x4c')](handleError(_0x56789a,null));};exports[_0xf6fc('0x4f')]=function(_0x11ebee,_0x24c7b9){return db[_0xf6fc('0x2f')]['describe']()[_0xf6fc('0x29')](respondWithResult(_0x24c7b9,null))['catch'](handleError(_0x24c7b9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1aace88..da91880 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 _0x71b3=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','uniqueid','lodash','api','moment','bluebird'];(function(_0x149c7f,_0x47ea83){var _0x408125=function(_0x23355f){while(--_0x23355f){_0x149c7f['push'](_0x149c7f['shift']());}};_0x408125(++_0x47ea83);}(_0x71b3,0x13b));var _0x371b=function(_0xd606cf,_0x26083a){_0xd606cf=_0xd606cf-0x0;var _0x2445d8=_0x71b3[_0xd606cf];return _0x2445d8;};'use strict';var _=require(_0x371b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x371b('0x1'));var moment=require(_0x371b('0x2'));var BPromise=require(_0x371b('0x3'));var rp=require(_0x371b('0x4'));var fs=require('fs');var path=require(_0x371b('0x5'));var rimraf=require(_0x371b('0x6'));var config=require('../../config/environment');var attributes=require(_0x371b('0x7'));module[_0x371b('0x8')]=function(_0x51fde2,_0x4c3870){return _0x51fde2[_0x371b('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x371b('0xa'),'fields':[_0x371b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x968e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x137f1d,_0x173f64){var _0x2188ab=function(_0x15d8a7){while(--_0x15d8a7){_0x137f1d['push'](_0x137f1d['shift']());}};_0x2188ab(++_0x173f64);}(_0x968e,0xfb));var _0xe968=function(_0xab8668,_0x5204ac){_0xab8668=_0xab8668-0x0;var _0x571c10=_0x968e[_0xab8668];return _0x571c10;};'use strict';var _=require(_0xe968('0x0'));var util=require('util');var logger=require(_0xe968('0x1'))(_0xe968('0x2'));var moment=require(_0xe968('0x3'));var BPromise=require(_0xe968('0x4'));var rp=require(_0xe968('0x5'));var fs=require('fs');var path=require(_0xe968('0x6'));var rimraf=require(_0xe968('0x7'));var config=require('../../config/environment');var attributes=require(_0xe968('0x8'));module[_0xe968('0x9')]=function(_0xad77c2,_0xd7ff03){return _0xad77c2[_0xe968('0xa')](_0xe968('0xb'),attributes,{'tableName':_0xe968('0xc'),'paranoid':![],'indexes':[{'name':_0xe968('0xd'),'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 4f70742..00aae9f 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 _0x3148=['then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x46974b,_0x23a4dd){var _0x50fd7a=function(_0x5862ea){while(--_0x5862ea){_0x46974b['push'](_0x46974b['shift']());}};_0x50fd7a(++_0x23a4dd);}(_0x3148,0x1d3));var _0x8314=function(_0x206192,_0x111bb2){_0x206192=_0x206192-0x0;var _0x27e778=_0x3148[_0x206192];return _0x27e778;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file +var _0x25fa=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x43af80,_0x1a300e){var _0x26c0ea=function(_0x3fb0b6){while(--_0x3fb0b6){_0x43af80['push'](_0x43af80['shift']());}};_0x26c0ea(++_0x1a300e);}(_0x25fa,0x109));var _0xa25f=function(_0x175a00,_0x8a64b2){_0x175a00=_0x175a00-0x0;var _0x24b4a0=_0x25fa[_0x175a00];return _0x24b4a0;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var moment=require(_0xa25f('0x1'));var BPromise=require(_0xa25f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa25f('0x3'));var db=require(_0xa25f('0x4'))['db'];var utils=require(_0xa25f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa25f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa25f('0x7')][_0xa25f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29666d,_0x455225,_0x22982b){return new BPromise(function(_0x168907,_0x64bbbf){return client[_0xa25f('0x9')](_0x29666d,_0x22982b)[_0xa25f('0xa')](function(_0x55ef98){logger[_0xa25f('0xb')](_0xa25f('0xc'),_0x455225,'request\x20sent');logger[_0xa25f('0xd')](_0xa25f('0xe'),_0x455225,_0xa25f('0xf'),JSON[_0xa25f('0x10')](_0x55ef98));if(_0x55ef98['error']){if(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x12')]===0x1f4){logger['error'](_0xa25f('0xc'),_0x455225,_0x55ef98[_0xa25f('0x11')]['message']);return _0x64bbbf(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);}logger[_0xa25f('0x11')](_0xa25f('0xc'),_0x455225,_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);return _0x168907(_0x55ef98[_0xa25f('0x11')][_0xa25f('0x13')]);}else{logger[_0xa25f('0xb')](_0xa25f('0xc'),_0x455225,_0xa25f('0xf'));_0x168907(_0x55ef98[_0xa25f('0x14')]['message']);}})[_0xa25f('0x15')](function(_0x471679){logger[_0xa25f('0x11')](_0xa25f('0xc'),_0x455225,_0x471679);_0x64bbbf(_0x471679);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e2fc9dd..f2227fb 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 _0xa053=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x115dba,_0x41bdf8){var _0x4e32a4=function(_0xa13a32){while(--_0xa13a32){_0x115dba['push'](_0x115dba['shift']());}};_0x4e32a4(++_0x41bdf8);}(_0xa053,0xee));var _0x3a05=function(_0x5b25cd,_0xcb4a6d){_0x5b25cd=_0x5b25cd-0x0;var _0x572478=_0xa053[_0x5b25cd];return _0x572478;};'use strict';var multer=require(_0x3a05('0x0'));var util=require(_0x3a05('0x1'));var path=require('path');var timeout=require(_0x3a05('0x2'));var express=require(_0x3a05('0x3'));var router=express[_0x3a05('0x4')]();var fs_extra=require(_0x3a05('0x5'));var auth=require(_0x3a05('0x6'));var interaction=require(_0x3a05('0x7'));var config=require(_0x3a05('0x8'));var controller=require(_0x3a05('0x9'));router[_0x3a05('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3a05('0xb'),auth[_0x3a05('0xc')](),controller[_0x3a05('0xd')]);router[_0x3a05('0xe')]('/',auth[_0x3a05('0xc')](),controller[_0x3a05('0xf')]);router['put'](_0x3a05('0xb'),auth['isAuthenticated'](),controller[_0x3a05('0x10')]);router[_0x3a05('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3a05('0x12')]);module[_0x3a05('0x13')]=router; \ No newline at end of file +var _0x48af=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post'];(function(_0x4f66b5,_0x2bd5ed){var _0x450793=function(_0x4aed78){while(--_0x4aed78){_0x4f66b5['push'](_0x4f66b5['shift']());}};_0x450793(++_0x2bd5ed);}(_0x48af,0x95));var _0xf48a=function(_0x1eaf5e,_0x333d16){_0x1eaf5e=_0x1eaf5e-0x0;var _0x409fa2=_0x48af[_0x1eaf5e];return _0x409fa2;};'use strict';var multer=require(_0xf48a('0x0'));var util=require(_0xf48a('0x1'));var path=require(_0xf48a('0x2'));var timeout=require(_0xf48a('0x3'));var express=require(_0xf48a('0x4'));var router=express['Router']();var fs_extra=require(_0xf48a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf48a('0x6'));var config=require(_0xf48a('0x7'));var controller=require(_0xf48a('0x8'));router[_0xf48a('0x9')]('/',auth[_0xf48a('0xa')](),controller['index']);router['get'](_0xf48a('0xb'),auth[_0xf48a('0xa')](),controller['show']);router[_0xf48a('0xc')]('/',auth['isAuthenticated'](),controller[_0xf48a('0xd')]);router[_0xf48a('0xe')](_0xf48a('0xb'),auth[_0xf48a('0xa')](),controller[_0xf48a('0xf')]);router[_0xf48a('0x10')]('/:id',auth[_0xf48a('0xa')](),controller['destroy']);module[_0xf48a('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4658b37..3fc795e 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 _0x0b2f=['exports','STRING','name'];(function(_0x3b1702,_0x2cdf95){var _0x1cebd5=function(_0x49718d){while(--_0x49718d){_0x3b1702['push'](_0x3b1702['shift']());}};_0x1cebd5(++_0x2cdf95);}(_0x0b2f,0x1e3));var _0xf0b2=function(_0x4c885c,_0x3f3696){_0x4c885c=_0x4c885c-0x0;var _0x1797cd=_0x0b2f[_0x4c885c];return _0x1797cd;};'use strict';var Sequelize=require('sequelize');module[_0xf0b2('0x0')]={'name':{'type':Sequelize[_0xf0b2('0x1')],'unique':_0xf0b2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf0b2('0x1')]}}; \ No newline at end of file +var _0x74c9=['sequelize','exports','name','STRING'];(function(_0x2d2b9b,_0x487c93){var _0x4c3155=function(_0xe67e65){while(--_0xe67e65){_0x2d2b9b['push'](_0x2d2b9b['shift']());}};_0x4c3155(++_0x487c93);}(_0x74c9,0x17c));var _0x974c=function(_0x47cade,_0x123077){_0x47cade=_0x47cade-0x0;var _0x5ab52f=_0x74c9[_0x47cade];return _0x5ab52f;};'use strict';var Sequelize=require(_0x974c('0x0'));module[_0x974c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x974c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x974c('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6f8df19..1ba9c6d 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 _0x24ca=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','set','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format'];(function(_0x4f6fdc,_0x4c4e51){var _0x143c4f=function(_0x4cc08a){while(--_0x4cc08a){_0x4f6fdc['push'](_0x4f6fdc['shift']());}};_0x143c4f(++_0x4c4e51);}(_0x24ca,0x9d));var _0xa24c=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x24ca[_0x2c0ded];return _0x4473e5;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require(_0xa24c('0x1'));var zipdir=require(_0xa24c('0x2'));var jsonpatch=require(_0xa24c('0x3'));var rp=require(_0xa24c('0x4'));var moment=require(_0xa24c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa24c('0x6'));var util=require(_0xa24c('0x7'));var path=require(_0xa24c('0x8'));var sox=require(_0xa24c('0x9'));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('squel');var crypto=require(_0xa24c('0xa'));var jsforce=require(_0xa24c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa24c('0xc'));var Papa=require(_0xa24c('0xd'));var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa24c('0x11'));var logger=require(_0xa24c('0x12'))(_0xa24c('0x13'));var utils=require('../../config/utils');var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47fcd6,_0x53a9f6){_0x53a9f6=_0x53a9f6||0xcc;return function(_0x52f505){if(_0x52f505){return _0x47fcd6['sendStatus'](_0x53a9f6);}return _0x47fcd6[_0xa24c('0x16')](_0x53a9f6)[_0xa24c('0x17')]();};}function respondWithResult(_0x250e8d,_0x1bf237){_0x1bf237=_0x1bf237||0xc8;return function(_0x9b7757){if(_0x9b7757){return _0x250e8d[_0xa24c('0x16')](_0x1bf237)['json'](_0x9b7757);}};}function respondWithFilteredResult(_0x85b97d,_0x1fa127){return function(_0x1dea40){if(_0x1dea40){var _0x18b3a8=typeof _0x1fa127['offset']===_0xa24c('0x18')&&typeof _0x1fa127[_0xa24c('0x19')]==='undefined';var _0xf8ad17=_0x1dea40[_0xa24c('0x1a')];var _0x20f872=_0x18b3a8?0x0:_0x1fa127['offset'];var _0x4ffa6c=_0x18b3a8?_0x1dea40[_0xa24c('0x1a')]:_0x1fa127[_0xa24c('0x1b')]+_0x1fa127['limit'];var _0x1da7be;if(_0x4ffa6c>=_0xf8ad17){_0x4ffa6c=_0xf8ad17;_0x1da7be=0xc8;}else{_0x1da7be=0xce;}_0x85b97d['status'](_0x1da7be);return _0x85b97d[_0xa24c('0x1c')]('Content-Range',_0x20f872+'-'+_0x4ffa6c+'/'+_0xf8ad17)['json'](_0x1dea40);}return null;};}function patchUpdates(_0x500f39){return function(_0x5ab118){try{jsonpatch['apply'](_0x5ab118,_0x500f39,!![]);}catch(_0x5448b6){return BPromise['reject'](_0x5448b6);}return _0x5ab118[_0xa24c('0x1d')]();};}function saveUpdates(_0xd23393,_0x1c971e){return function(_0x4b94f3){if(_0x4b94f3){return _0x4b94f3['update'](_0xd23393)[_0xa24c('0x1e')](function(_0x22a6fe){return _0x22a6fe;});}return null;};}function removeEntity(_0x19ee42,_0x80166e){return function(_0x23853a){if(_0x23853a){return _0x23853a[_0xa24c('0x1f')]()[_0xa24c('0x1e')](function(){var _0x2eac9d=_0x23853a[_0xa24c('0x20')]({'plain':!![]});var _0x27f0ae=_0xa24c('0x21');return db[_0xa24c('0x22')][_0xa24c('0x1f')]({'where':{'type':_0x27f0ae,'resourceId':_0x2eac9d['id']}})['then'](function(){return _0x23853a;});})[_0xa24c('0x1e')](function(){_0x19ee42[_0xa24c('0x16')](0xcc)[_0xa24c('0x17')]();});}};}function handleEntityNotFound(_0x3c242b,_0x559857){return function(_0x595654){if(!_0x595654){_0x3c242b['sendStatus'](0x194);}return _0x595654;};}function handleError(_0x4bd73f,_0x1ff154){_0x1ff154=_0x1ff154||0x1f4;return function(_0x3d0849){logger[_0xa24c('0x23')](_0x3d0849[_0xa24c('0x24')]);if(_0x3d0849[_0xa24c('0x25')]){delete _0x3d0849[_0xa24c('0x25')];}_0x4bd73f[_0xa24c('0x16')](_0x1ff154)[_0xa24c('0x26')](_0x3d0849);};}exports[_0xa24c('0x27')]=function(_0x41fcdb,_0x1cd7f8){var _0x322909={},_0x51d047={},_0x58853c={'count':0x0,'rows':[]};var _0xb22768=_[_0xa24c('0x28')](db[_0xa24c('0x29')]['rawAttributes'],function(_0x3764c9){return{'name':_0x3764c9[_0xa24c('0x2a')],'type':_0x3764c9[_0xa24c('0x2b')][_0xa24c('0x2c')]};});_0x51d047['model']=_[_0xa24c('0x28')](_0xb22768,_0xa24c('0x25'));_0x51d047['query']=_['keys'](_0x41fcdb['query']);_0x51d047['filters']=_['intersection'](_0x51d047[_0xa24c('0x2d')],_0x51d047[_0xa24c('0x2e')]);_0x322909[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x51d047[_0xa24c('0x2d')],qs[_0xa24c('0x31')](_0x41fcdb[_0xa24c('0x2e')]['fields']));_0x322909[_0xa24c('0x2f')]=_0x322909[_0xa24c('0x2f')][_0xa24c('0x32')]?_0x322909[_0xa24c('0x2f')]:_0x51d047['model'];if(!_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x33')](_0xa24c('0x34'))){_0x322909['limit']=qs['limit'](_0x41fcdb['query']['limit']);_0x322909[_0xa24c('0x1b')]=qs[_0xa24c('0x1b')](_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x1b')]);}_0x322909[_0xa24c('0x35')]=qs['sort'](_0x41fcdb[_0xa24c('0x2e')]['sort']);_0x322909[_0xa24c('0x36')]=qs[_0xa24c('0x37')](_['pick'](_0x41fcdb[_0xa24c('0x2e')],_0x51d047[_0xa24c('0x37')]),_0xb22768);if(_0x41fcdb[_0xa24c('0x2e')]['filter']){_0x322909['where']=_[_0xa24c('0x38')](_0x322909[_0xa24c('0x36')],{'$or':_[_0xa24c('0x28')](_0xb22768,function(_0x4faf37){if(_0x4faf37['type']!==_0xa24c('0x39')){var _0x3511b0={};_0x3511b0[_0x4faf37[_0xa24c('0x25')]]={'$like':'%'+_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x3a')]+'%'};return _0x3511b0;}})});}_0x322909=_[_0xa24c('0x38')]({},_0x322909,_0x41fcdb['options']);var _0x144147={'where':_0x322909[_0xa24c('0x36')]};return db[_0xa24c('0x29')][_0xa24c('0x1a')](_0x144147)[_0xa24c('0x1e')](function(_0x4ee41f){_0x58853c['count']=_0x4ee41f;if(_0x41fcdb[_0xa24c('0x2e')][_0xa24c('0x3b')]){_0x322909[_0xa24c('0x3c')]=[{'all':!![]}];}return db[_0xa24c('0x29')][_0xa24c('0x3d')](_0x322909);})[_0xa24c('0x1e')](function(_0x2efd86){_0x58853c[_0xa24c('0x3e')]=_0x2efd86;return _0x58853c;})['then'](respondWithFilteredResult(_0x1cd7f8,_0x322909))['catch'](handleError(_0x1cd7f8,null));};exports[_0xa24c('0x3f')]=function(_0x10a625,_0x233260){var _0x51e25a={'raw':!![],'where':{'id':_0x10a625[_0xa24c('0x40')]['id']}},_0x30b0fc={};_0x30b0fc[_0xa24c('0x2d')]=_['keys'](db[_0xa24c('0x29')]['rawAttributes']);_0x30b0fc[_0xa24c('0x2e')]=_[_0xa24c('0x41')](_0x10a625['query']);_0x30b0fc[_0xa24c('0x37')]=_[_0xa24c('0x30')](_0x30b0fc[_0xa24c('0x2d')],_0x30b0fc[_0xa24c('0x2e')]);_0x51e25a[_0xa24c('0x2f')]=_[_0xa24c('0x30')](_0x30b0fc[_0xa24c('0x2d')],qs[_0xa24c('0x31')](_0x10a625['query']['fields']));_0x51e25a[_0xa24c('0x2f')]=_0x51e25a[_0xa24c('0x2f')][_0xa24c('0x32')]?_0x51e25a[_0xa24c('0x2f')]:_0x30b0fc[_0xa24c('0x2d')];if(_0x10a625[_0xa24c('0x2e')]['includeAll']){_0x51e25a[_0xa24c('0x3c')]=[{'all':!![]}];}_0x51e25a=_[_0xa24c('0x38')]({},_0x51e25a,_0x10a625[_0xa24c('0x42')]);return db[_0xa24c('0x29')][_0xa24c('0x43')](_0x51e25a)[_0xa24c('0x1e')](handleEntityNotFound(_0x233260,null))[_0xa24c('0x1e')](respondWithResult(_0x233260,null))[_0xa24c('0x44')](handleError(_0x233260,null));};exports['create']=function(_0xb0fa22,_0x37ac7b){return db[_0xa24c('0x29')]['create'](_0xb0fa22[_0xa24c('0x45')],{})[_0xa24c('0x1e')](function(_0x44c43b){var _0x184b8c=_0xb0fa22[_0xa24c('0x46')][_0xa24c('0x20')]({'plain':!![]});if(!_0x184b8c)throw new Error(_0xa24c('0x47'));if(_0x184b8c[_0xa24c('0x48')]===_0xa24c('0x46')){var _0xa96de4=_0x44c43b[_0xa24c('0x20')]({'plain':!![]});var _0x2da061='Pauses';return db[_0xa24c('0x49')][_0xa24c('0x43')]({'where':{'name':_0x2da061,'userProfileId':_0x184b8c[_0xa24c('0x4a')]},'raw':!![]})['then'](function(_0xdb19ca){if(_0xdb19ca&&_0xdb19ca[_0xa24c('0x4b')]===0x0){return db['UserProfileResource'][_0xa24c('0x4c')]({'name':_0xa96de4[_0xa24c('0x25')],'resourceId':_0xa96de4['id'],'type':_0xdb19ca[_0xa24c('0x25')],'sectionId':_0xdb19ca['id']},{})[_0xa24c('0x1e')](function(){return _0x44c43b;});}else{return _0x44c43b;}})[_0xa24c('0x44')](function(_0x23e154){logger[_0xa24c('0x23')](_0xa24c('0x4d'),_0x23e154);throw _0x23e154;});}return _0x44c43b;})['then'](respondWithResult(_0x37ac7b,0xc9))[_0xa24c('0x44')](handleError(_0x37ac7b,null));};exports[_0xa24c('0x4e')]=function(_0xa0392b,_0x3a17cf){if(_0xa0392b[_0xa24c('0x45')]['id']){delete _0xa0392b['body']['id'];}return db[_0xa24c('0x29')][_0xa24c('0x43')]({'where':{'id':_0xa0392b[_0xa24c('0x40')]['id']}})[_0xa24c('0x1e')](handleEntityNotFound(_0x3a17cf,null))[_0xa24c('0x1e')](saveUpdates(_0xa0392b[_0xa24c('0x45')],null))['then'](respondWithResult(_0x3a17cf,null))[_0xa24c('0x44')](handleError(_0x3a17cf,null));};exports[_0xa24c('0x1f')]=function(_0x8ecfba,_0x158df6){return db[_0xa24c('0x29')][_0xa24c('0x43')]({'where':{'id':_0x8ecfba['params']['id']}})[_0xa24c('0x1e')](handleEntityNotFound(_0x158df6,null))[_0xa24c('0x1e')](removeEntity(_0x158df6,null))['catch'](handleError(_0x158df6,null));}; \ No newline at end of file +var _0xe235=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','Pause','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','pick','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','user','role','Pauses','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x60667a,_0x151d48){var _0x45bb44=function(_0x16cb26){while(--_0x16cb26){_0x60667a['push'](_0x60667a['shift']());}};_0x45bb44(++_0x151d48);}(_0xe235,0x185));var _0x5e23=function(_0x49e606,_0x45ec78){_0x49e606=_0x49e606-0x0;var _0x14eab7=_0xe235[_0x49e606];return _0x14eab7;};'use strict';var emlformat=require(_0x5e23('0x0'));var rimraf=require(_0x5e23('0x1'));var zipdir=require(_0x5e23('0x2'));var jsonpatch=require(_0x5e23('0x3'));var rp=require(_0x5e23('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e23('0x5'));var path=require(_0x5e23('0x6'));var sox=require(_0x5e23('0x7'));var csv=require(_0x5e23('0x8'));var ejs=require(_0x5e23('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e23('0xa'));var squel=require(_0x5e23('0xb'));var crypto=require(_0x5e23('0xc'));var jsforce=require(_0x5e23('0xd'));var deskjs=require(_0x5e23('0xe'));var toCsv=require(_0x5e23('0x8'));var querystring=require(_0x5e23('0xf'));var Papa=require('papaparse');var Redis=require(_0x5e23('0x10'));var authService=require(_0x5e23('0x11'));var qs=require(_0x5e23('0x12'));var as=require(_0x5e23('0x13'));var hardwareService=require(_0x5e23('0x14'));var logger=require(_0x5e23('0x15'))(_0x5e23('0x16'));var utils=require(_0x5e23('0x17'));var config=require(_0x5e23('0x18'));var licenseUtil=require(_0x5e23('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9fc118,_0x34cb73){_0x34cb73=_0x34cb73||0xcc;return function(_0x54193c){if(_0x54193c){return _0x9fc118[_0x5e23('0x1a')](_0x34cb73);}return _0x9fc118[_0x5e23('0x1b')](_0x34cb73)[_0x5e23('0x1c')]();};}function respondWithResult(_0x114060,_0x38d707){_0x38d707=_0x38d707||0xc8;return function(_0x55c6eb){if(_0x55c6eb){return _0x114060[_0x5e23('0x1b')](_0x38d707)[_0x5e23('0x1d')](_0x55c6eb);}};}function respondWithFilteredResult(_0x569e02,_0x367dc4){return function(_0x2ddea9){if(_0x2ddea9){var _0x2e0e2e=typeof _0x367dc4[_0x5e23('0x1e')]===_0x5e23('0x1f')&&typeof _0x367dc4[_0x5e23('0x20')]===_0x5e23('0x1f');var _0xc4b745=_0x2ddea9[_0x5e23('0x21')];var _0x462109=_0x2e0e2e?0x0:_0x367dc4[_0x5e23('0x1e')];var _0x38a930=_0x2e0e2e?_0x2ddea9[_0x5e23('0x21')]:_0x367dc4[_0x5e23('0x1e')]+_0x367dc4[_0x5e23('0x20')];var _0x58729a;if(_0x38a930>=_0xc4b745){_0x38a930=_0xc4b745;_0x58729a=0xc8;}else{_0x58729a=0xce;}_0x569e02[_0x5e23('0x1b')](_0x58729a);return _0x569e02['set'](_0x5e23('0x22'),_0x462109+'-'+_0x38a930+'/'+_0xc4b745)[_0x5e23('0x1d')](_0x2ddea9);}return null;};}function patchUpdates(_0x45958a){return function(_0x263961){try{jsonpatch[_0x5e23('0x23')](_0x263961,_0x45958a,!![]);}catch(_0x336064){return BPromise[_0x5e23('0x24')](_0x336064);}return _0x263961[_0x5e23('0x25')]();};}function saveUpdates(_0x5a7c90,_0xc2285b){return function(_0x1a01f1){if(_0x1a01f1){return _0x1a01f1[_0x5e23('0x26')](_0x5a7c90)[_0x5e23('0x27')](function(_0x538f0f){return _0x538f0f;});}return null;};}function removeEntity(_0x2024d7,_0x2306be){return function(_0x55b788){if(_0x55b788){return _0x55b788[_0x5e23('0x28')]()[_0x5e23('0x27')](function(){var _0x1253ca=_0x55b788[_0x5e23('0x29')]({'plain':!![]});var _0x5e361e='Pauses';return db[_0x5e23('0x2a')]['destroy']({'where':{'type':_0x5e361e,'resourceId':_0x1253ca['id']}})[_0x5e23('0x27')](function(){return _0x55b788;});})[_0x5e23('0x27')](function(){_0x2024d7[_0x5e23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166c22,_0x3ac5e4){return function(_0x55bf4b){if(!_0x55bf4b){_0x166c22[_0x5e23('0x1a')](0x194);}return _0x55bf4b;};}function handleError(_0x4232b1,_0x6a2fb9){_0x6a2fb9=_0x6a2fb9||0x1f4;return function(_0x4140a1){logger[_0x5e23('0x2b')](_0x4140a1[_0x5e23('0x2c')]);if(_0x4140a1[_0x5e23('0x2d')]){delete _0x4140a1[_0x5e23('0x2d')];}_0x4232b1[_0x5e23('0x1b')](_0x6a2fb9)['send'](_0x4140a1);};}exports[_0x5e23('0x2e')]=function(_0xacdbf3,_0x467e6c){var _0x562b85={},_0x34fde8={},_0x1f7948={'count':0x0,'rows':[]};var _0xafad02=_['map'](db[_0x5e23('0x2f')][_0x5e23('0x30')],function(_0x35e751){return{'name':_0x35e751[_0x5e23('0x31')],'type':_0x35e751['type']['key']};});_0x34fde8[_0x5e23('0x32')]=_[_0x5e23('0x33')](_0xafad02,_0x5e23('0x2d'));_0x34fde8[_0x5e23('0x34')]=_[_0x5e23('0x35')](_0xacdbf3[_0x5e23('0x34')]);_0x34fde8[_0x5e23('0x36')]=_[_0x5e23('0x37')](_0x34fde8[_0x5e23('0x32')],_0x34fde8[_0x5e23('0x34')]);_0x562b85['attributes']=_[_0x5e23('0x37')](_0x34fde8['model'],qs[_0x5e23('0x38')](_0xacdbf3[_0x5e23('0x34')][_0x5e23('0x38')]));_0x562b85['attributes']=_0x562b85['attributes'][_0x5e23('0x39')]?_0x562b85[_0x5e23('0x3a')]:_0x34fde8[_0x5e23('0x32')];if(!_0xacdbf3['query'][_0x5e23('0x3b')]('nolimit')){_0x562b85[_0x5e23('0x20')]=qs[_0x5e23('0x20')](_0xacdbf3[_0x5e23('0x34')][_0x5e23('0x20')]);_0x562b85[_0x5e23('0x1e')]=qs[_0x5e23('0x1e')](_0xacdbf3['query']['offset']);}_0x562b85['order']=qs[_0x5e23('0x3c')](_0xacdbf3['query']['sort']);_0x562b85['where']=qs[_0x5e23('0x36')](_[_0x5e23('0x3d')](_0xacdbf3[_0x5e23('0x34')],_0x34fde8[_0x5e23('0x36')]),_0xafad02);if(_0xacdbf3[_0x5e23('0x34')]['filter']){_0x562b85[_0x5e23('0x3e')]=_['merge'](_0x562b85[_0x5e23('0x3e')],{'$or':_[_0x5e23('0x33')](_0xafad02,function(_0x160d39){if(_0x160d39[_0x5e23('0x3f')]!==_0x5e23('0x40')){var _0x1330de={};_0x1330de[_0x160d39[_0x5e23('0x2d')]]={'$like':'%'+_0xacdbf3[_0x5e23('0x34')]['filter']+'%'};return _0x1330de;}})});}_0x562b85=_['merge']({},_0x562b85,_0xacdbf3[_0x5e23('0x41')]);var _0xe318af={'where':_0x562b85[_0x5e23('0x3e')]};return db['Pause'][_0x5e23('0x21')](_0xe318af)[_0x5e23('0x27')](function(_0x4f3f87){_0x1f7948['count']=_0x4f3f87;if(_0xacdbf3[_0x5e23('0x34')][_0x5e23('0x42')]){_0x562b85[_0x5e23('0x43')]=[{'all':!![]}];}return db[_0x5e23('0x2f')][_0x5e23('0x44')](_0x562b85);})[_0x5e23('0x27')](function(_0x12c873){_0x1f7948[_0x5e23('0x45')]=_0x12c873;return _0x1f7948;})['then'](respondWithFilteredResult(_0x467e6c,_0x562b85))[_0x5e23('0x46')](handleError(_0x467e6c,null));};exports[_0x5e23('0x47')]=function(_0x3ef9d5,_0x3698ca){var _0x241366={'raw':!![],'where':{'id':_0x3ef9d5['params']['id']}},_0x39683a={};_0x39683a[_0x5e23('0x32')]=_['keys'](db[_0x5e23('0x2f')][_0x5e23('0x30')]);_0x39683a[_0x5e23('0x34')]=_[_0x5e23('0x35')](_0x3ef9d5[_0x5e23('0x34')]);_0x39683a[_0x5e23('0x36')]=_[_0x5e23('0x37')](_0x39683a[_0x5e23('0x32')],_0x39683a[_0x5e23('0x34')]);_0x241366[_0x5e23('0x3a')]=_[_0x5e23('0x37')](_0x39683a['model'],qs[_0x5e23('0x38')](_0x3ef9d5[_0x5e23('0x34')]['fields']));_0x241366[_0x5e23('0x3a')]=_0x241366[_0x5e23('0x3a')][_0x5e23('0x39')]?_0x241366[_0x5e23('0x3a')]:_0x39683a[_0x5e23('0x32')];if(_0x3ef9d5['query'][_0x5e23('0x42')]){_0x241366[_0x5e23('0x43')]=[{'all':!![]}];}_0x241366=_[_0x5e23('0x48')]({},_0x241366,_0x3ef9d5[_0x5e23('0x41')]);return db[_0x5e23('0x2f')][_0x5e23('0x49')](_0x241366)[_0x5e23('0x27')](handleEntityNotFound(_0x3698ca,null))['then'](respondWithResult(_0x3698ca,null))['catch'](handleError(_0x3698ca,null));};exports[_0x5e23('0x4a')]=function(_0x367b26,_0x423ef1){return db['Pause'][_0x5e23('0x4a')](_0x367b26[_0x5e23('0x4b')],{})[_0x5e23('0x27')](function(_0x116566){var _0x39852e=_0x367b26[_0x5e23('0x4c')][_0x5e23('0x29')]({'plain':!![]});if(!_0x39852e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39852e[_0x5e23('0x4d')]===_0x5e23('0x4c')){var _0x47eaca=_0x116566[_0x5e23('0x29')]({'plain':!![]});var _0x11522c=_0x5e23('0x4e');return db[_0x5e23('0x4f')]['find']({'where':{'name':_0x11522c,'userProfileId':_0x39852e['userProfileId']},'raw':!![]})[_0x5e23('0x27')](function(_0x63f2a6){if(_0x63f2a6&&_0x63f2a6[_0x5e23('0x50')]===0x0){return db['UserProfileResource'][_0x5e23('0x4a')]({'name':_0x47eaca[_0x5e23('0x2d')],'resourceId':_0x47eaca['id'],'type':_0x63f2a6['name'],'sectionId':_0x63f2a6['id']},{})[_0x5e23('0x27')](function(){return _0x116566;});}else{return _0x116566;}})['catch'](function(_0x306d4e){logger['error'](_0x5e23('0x51'),_0x306d4e);throw _0x306d4e;});}return _0x116566;})[_0x5e23('0x27')](respondWithResult(_0x423ef1,0xc9))['catch'](handleError(_0x423ef1,null));};exports[_0x5e23('0x26')]=function(_0xd47f90,_0x2db7c2){if(_0xd47f90[_0x5e23('0x4b')]['id']){delete _0xd47f90[_0x5e23('0x4b')]['id'];}return db[_0x5e23('0x2f')]['find']({'where':{'id':_0xd47f90[_0x5e23('0x52')]['id']}})[_0x5e23('0x27')](handleEntityNotFound(_0x2db7c2,null))['then'](saveUpdates(_0xd47f90[_0x5e23('0x4b')],null))['then'](respondWithResult(_0x2db7c2,null))[_0x5e23('0x46')](handleError(_0x2db7c2,null));};exports['destroy']=function(_0xcc953,_0x10b462){return db['Pause'][_0x5e23('0x49')]({'where':{'id':_0xcc953[_0x5e23('0x52')]['id']}})[_0x5e23('0x27')](handleEntityNotFound(_0x10b462,null))[_0x5e23('0x27')](removeEntity(_0x10b462,null))['catch'](handleError(_0x10b462,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 10ca729..1ad2ad2 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x88be6c,_0x209c9e){var _0x339ca9=function(_0x495b98){while(--_0x495b98){_0x88be6c['push'](_0x88be6c['shift']());}};_0x339ca9(++_0x209c9e);}(_0x5fab,0x177));var _0xb5fa=function(_0x53f5ec,_0x34bca9){_0x53f5ec=_0x53f5ec-0x0;var _0x4e2d6a=_0x5fab[_0x53f5ec];return _0x4e2d6a;};'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/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3ad23ff..53798b2 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(_0xc270ac,_0x1ab826){var _0xf847=function(_0x55ca14){while(--_0x55ca14){_0xc270ac['push'](_0xc270ac['shift']());}};_0xf847(++_0x1ab826);}(_0x7a54,0x106));var _0x47a5=function(_0x4aa413,_0x1aba48){_0x4aa413=_0x4aa413-0x0;var _0x3fd63d=_0x7a54[_0x4aa413];return _0x3fd63d;};'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(_0x473d97,_0x1e73db){var _0x83bd70=function(_0x2321fe){while(--_0x2321fe){_0x473d97['push'](_0x473d97['shift']());}};_0x83bd70(++_0x1e73db);}(_0x7a54,0x106));var _0x47a5=function(_0x616c0f,_0x26637e){_0x616c0f=_0x616c0f-0x0;var _0x11d87b=_0x7a54[_0x616c0f];return _0x11d87b;};'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 803da5c..e0933eb 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 _0x81bd=['diskStorage','join','root','server/files/plugins','originalname','format','basename','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','show','/:id/download','download'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x81bd,0x7c));var _0xd81b=function(_0x5a4257,_0x3ae34d){_0x5a4257=_0x5a4257-0x0;var _0x3746a7=_0x81bd[_0x5a4257];return _0x3746a7;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/webhook',controller['webhookGet']);router[_0xd81b('0xc')]('/:id',auth[_0xd81b('0xa')](),controller[_0xd81b('0xd')]);router[_0xd81b('0xc')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);var upload=multer({'storage':multer[_0xd81b('0x10')]({'destination':function(_0x17e09f,_0x2090e1,_0x23c789){_0x23c789(null,path[_0xd81b('0x11')](config[_0xd81b('0x12')],_0xd81b('0x13')));},'filename':function(_0x560530,_0x21dfff,_0x57f71d){_0x21dfff[_0xd81b('0x14')]=_0x21dfff[_0xd81b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57f71d(null,util[_0xd81b('0x15')]('%s-%s%s',path[_0xd81b('0x16')](_0x21dfff[_0xd81b('0x14')],path[_0xd81b('0x17')](_0x21dfff[_0xd81b('0x14')])),Date[_0xd81b('0x18')](),path['extname'](_0x21dfff[_0xd81b('0x14')])));}})});router[_0xd81b('0x19')]('/',upload['single'](_0xd81b('0x1a')),controller[_0xd81b('0x1b')]);router[_0xd81b('0x19')](_0xd81b('0x1c'),controller[_0xd81b('0x1d')]);router[_0xd81b('0x1e')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x20')]);router[_0xd81b('0x21')](_0xd81b('0x1f'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x21')]);module[_0xd81b('0x22')]=router; \ No newline at end of file +var _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','show','download','root','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','file','webhookPost','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x29d4,0x1a1));var _0x429d=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x29d4[_0x5e36d1];return _0x950b9e;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),controller['webhookGet']);router[_0x429d('0x9')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0xd')]);router[_0x429d('0x9')]('/:id/download',auth[_0x429d('0xa')](),controller[_0x429d('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x31ff87,_0x2fd1ca,_0x417f77){_0x417f77(null,path['join'](config[_0x429d('0xf')],_0x429d('0x10')));},'filename':function(_0x1d933b,_0x1cb1cf,_0x4843af){_0x1cb1cf[_0x429d('0x11')]=_0x1cb1cf[_0x429d('0x11')][_0x429d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4843af(null,util['format'](_0x429d('0x13'),path[_0x429d('0x14')](_0x1cb1cf['originalname'],path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])),Date[_0x429d('0x16')](),path[_0x429d('0x15')](_0x1cb1cf[_0x429d('0x11')])));}})});router[_0x429d('0x17')]('/',upload['single'](_0x429d('0x18')),controller['upload']);router[_0x429d('0x17')](_0x429d('0xc'),controller[_0x429d('0x19')]);router[_0x429d('0x1a')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1b')]);router[_0x429d('0x1c')]('/:id',auth[_0x429d('0xa')](),controller[_0x429d('0x1c')]);module[_0x429d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8e78a1e..ca164a1 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 _0x3d2d=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','TEXT','STRING','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never'];(function(_0x4877ee,_0x36ea12){var _0x49558a=function(_0x3c9af9){while(--_0x3c9af9){_0x4877ee['push'](_0x4877ee['shift']());}};_0x49558a(++_0x36ea12);}(_0x3d2d,0xcd));var _0xd3d2=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x3d2d[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0xd3d2('0x0'));module[_0xd3d2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd3d2('0x2')](_0xd3d2('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xd3d2('0x4')]},'path':{'type':Sequelize[_0xd3d2('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd3d2('0x6')},'sidebar':{'type':Sequelize[_0xd3d2('0x2')](_0xd3d2('0x7'),_0xd3d2('0x8'),_0xd3d2('0x9'),_0xd3d2('0xa')),'defaultValue':_0xd3d2('0x9'),'comment':_0xd3d2('0xb')},'icon':{'type':Sequelize[_0xd3d2('0x5')]},'adminUrl':{'type':Sequelize[_0xd3d2('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe336=['always','never','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly'];(function(_0x14529a,_0x149147){var _0x230299=function(_0x4793d1){while(--_0x4793d1){_0x14529a['push'](_0x14529a['shift']());}};_0x230299(++_0x149147);}(_0xe336,0x11a));var _0x6e33=function(_0x1ba71d,_0xcd4311){_0x1ba71d=_0x1ba71d-0x0;var _0x24f30e=_0xe336[_0x1ba71d];return _0x24f30e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6e33('0x0')](_0x6e33('0x1'),_0x6e33('0x2'))},'description':{'type':Sequelize[_0x6e33('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x6e33('0x4')],'comment':_0x6e33('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6e33('0x6')},'sidebar':{'type':Sequelize[_0x6e33('0x0')]('adminOnly',_0x6e33('0x7'),_0x6e33('0x8'),_0x6e33('0x9')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x6e33('0x4')]},'adminUrl':{'type':Sequelize[_0x6e33('0x4')]},'agentUrl':{'type':Sequelize[_0x6e33('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 8a42989..9fd1944 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 _0xc60a=['status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','Plugins','destroy','end','error','name','send','index','Plugin','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','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','Invalid\x20plugin\x20structure','lstatSync','isFile','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','version','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','resolve','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus'];(function(_0x201aca,_0x21c20d){var _0xd08049=function(_0x3498bb){while(--_0x3498bb){_0x201aca['push'](_0x201aca['shift']());}};_0xd08049(++_0x21c20d);}(_0xc60a,0x13d));var _0xac60=function(_0x493ebc,_0x15ee5b){_0x493ebc=_0x493ebc-0x0;var _0x43ce87=_0xc60a[_0x493ebc];return _0x43ce87;};'use strict';var emlformat=require(_0xac60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac60('0x1'));var jsonpatch=require(_0xac60('0x2'));var rp=require(_0xac60('0x3'));var moment=require(_0xac60('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac60('0x5'));var util=require('util');var path=require(_0xac60('0x6'));var sox=require(_0xac60('0x7'));var csv=require(_0xac60('0x8'));var ejs=require(_0xac60('0x9'));var fs=require('fs');var fs_extra=require(_0xac60('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac60('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xac60('0xc'));var toCsv=require(_0xac60('0x8'));var querystring=require(_0xac60('0xd'));var Papa=require(_0xac60('0xe'));var extract=require(_0xac60('0xf'));var rimraf=require(_0xac60('0x10'));var archiver=require(_0xac60('0x11'));var Redis=require(_0xac60('0x12'));var authService=require(_0xac60('0x13'));var qs=require(_0xac60('0x14'));var as=require(_0xac60('0x15'));var hardwareService=require(_0xac60('0x16'));var logger=require(_0xac60('0x17'))('api');var utils=require(_0xac60('0x18'));var config=require(_0xac60('0x19'));var licenseUtil=require(_0xac60('0x1a'));var db=require(_0xac60('0x1b'))['db'];config[_0xac60('0x1c')]=_[_0xac60('0x1d')](config[_0xac60('0x1c')],{'host':_0xac60('0x1e'),'port':0x18eb});var socket=require(_0xac60('0x1f'))(new Redis(config[_0xac60('0x1c')]));require(_0xac60('0x20'))[_0xac60('0x21')](socket);function respondWithStatusCode(_0x3ca805,_0x293016){_0x293016=_0x293016||0xcc;return function(_0x39cbca){if(_0x39cbca){return _0x3ca805[_0xac60('0x22')](_0x293016);}return _0x3ca805[_0xac60('0x23')](_0x293016)['end']();};}function respondWithResult(_0x4a2bb8,_0x5aacff){_0x5aacff=_0x5aacff||0xc8;return function(_0x4abc9a){if(_0x4abc9a){return _0x4a2bb8[_0xac60('0x23')](_0x5aacff)[_0xac60('0x24')](_0x4abc9a);}};}function respondWithFilteredResult(_0x21e684,_0x48818b){return function(_0x21c0c6){if(_0x21c0c6){var _0x2af69d=typeof _0x48818b[_0xac60('0x25')]===_0xac60('0x26')&&typeof _0x48818b[_0xac60('0x27')]===_0xac60('0x26');var _0x144045=_0x21c0c6[_0xac60('0x28')];var _0x53d16e=_0x2af69d?0x0:_0x48818b['offset'];var _0x242f55=_0x2af69d?_0x21c0c6['count']:_0x48818b[_0xac60('0x25')]+_0x48818b[_0xac60('0x27')];var _0x5d865c;if(_0x242f55>=_0x144045){_0x242f55=_0x144045;_0x5d865c=0xc8;}else{_0x5d865c=0xce;}_0x21e684[_0xac60('0x23')](_0x5d865c);return _0x21e684['set'](_0xac60('0x29'),_0x53d16e+'-'+_0x242f55+'/'+_0x144045)[_0xac60('0x24')](_0x21c0c6);}return null;};}function patchUpdates(_0x575f8c){return function(_0x32020a){try{jsonpatch[_0xac60('0x2a')](_0x32020a,_0x575f8c,!![]);}catch(_0x453706){return BPromise['reject'](_0x453706);}return _0x32020a[_0xac60('0x2b')]();};}function saveUpdates(_0x1b460c,_0x4e104a){return function(_0x20bf9e){if(_0x20bf9e){return _0x20bf9e[_0xac60('0x2c')](_0x1b460c)[_0xac60('0x2d')](function(_0x4c816f){return _0x4c816f;});}return null;};}function removeEntity(_0x3529e8,_0x248ffc){return function(_0x1b11e3){if(_0x1b11e3){return _0x1b11e3['destroy']()['then'](function(){var _0x34e83c=_0x1b11e3['get']({'plain':!![]});var _0x20c007=_0xac60('0x2e');return db['UserProfileResource'][_0xac60('0x2f')]({'where':{'type':_0x20c007,'resourceId':_0x34e83c['id']}})[_0xac60('0x2d')](function(){return _0x1b11e3;});})[_0xac60('0x2d')](function(){_0x3529e8[_0xac60('0x23')](0xcc)[_0xac60('0x30')]();});}};}function handleEntityNotFound(_0x1a6371,_0x53ad01){return function(_0x2a5562){if(!_0x2a5562){_0x1a6371[_0xac60('0x22')](0x194);}return _0x2a5562;};}function handleError(_0x58ea73,_0x2c3fea){_0x2c3fea=_0x2c3fea||0x1f4;return function(_0x4f11d7){logger[_0xac60('0x31')](_0x4f11d7['stack']);if(_0x4f11d7[_0xac60('0x32')]){delete _0x4f11d7['name'];}_0x58ea73[_0xac60('0x23')](_0x2c3fea)[_0xac60('0x33')](_0x4f11d7);};}exports[_0xac60('0x34')]=function(_0x1b920a,_0x451d82){var _0x4710f4={},_0x89d887={},_0x4155fb={'count':0x0,'rows':[]};var _0x56eb6e=_['map'](db[_0xac60('0x35')][_0xac60('0x36')],function(_0x4fc889){return{'name':_0x4fc889['fieldName'],'type':_0x4fc889['type'][_0xac60('0x37')]};});_0x89d887[_0xac60('0x38')]=_['map'](_0x56eb6e,_0xac60('0x32'));_0x89d887[_0xac60('0x39')]=_['keys'](_0x1b920a['query']);_0x89d887['filters']=_[_0xac60('0x3a')](_0x89d887[_0xac60('0x38')],_0x89d887[_0xac60('0x39')]);_0x4710f4['attributes']=_[_0xac60('0x3a')](_0x89d887['model'],qs[_0xac60('0x3b')](_0x1b920a['query'][_0xac60('0x3b')]));_0x4710f4[_0xac60('0x3c')]=_0x4710f4[_0xac60('0x3c')][_0xac60('0x3d')]?_0x4710f4['attributes']:_0x89d887[_0xac60('0x38')];if(!_0x1b920a[_0xac60('0x39')][_0xac60('0x3e')](_0xac60('0x3f'))){_0x4710f4[_0xac60('0x27')]=qs[_0xac60('0x27')](_0x1b920a['query'][_0xac60('0x27')]);_0x4710f4[_0xac60('0x25')]=qs[_0xac60('0x25')](_0x1b920a['query'][_0xac60('0x25')]);}_0x4710f4[_0xac60('0x40')]=qs[_0xac60('0x41')](_0x1b920a[_0xac60('0x39')][_0xac60('0x41')]);_0x4710f4[_0xac60('0x42')]=qs[_0xac60('0x43')](_[_0xac60('0x44')](_0x1b920a[_0xac60('0x39')],_0x89d887['filters']),_0x56eb6e);if(_0x1b920a[_0xac60('0x39')]['filter']){_0x4710f4['where']=_[_0xac60('0x45')](_0x4710f4[_0xac60('0x42')],{'$or':_[_0xac60('0x46')](_0x56eb6e,function(_0x45d192){if(_0x45d192[_0xac60('0x47')]!==_0xac60('0x48')){var _0x435a93={};_0x435a93[_0x45d192[_0xac60('0x32')]]={'$like':'%'+_0x1b920a[_0xac60('0x39')][_0xac60('0x49')]+'%'};return _0x435a93;}})});}_0x4710f4=_['merge']({},_0x4710f4,_0x1b920a[_0xac60('0x4a')]);var _0x2fab5c={'where':_0x4710f4[_0xac60('0x42')]};return db['Plugin']['count'](_0x2fab5c)[_0xac60('0x2d')](function(_0x4bb8df){_0x4155fb['count']=_0x4bb8df;if(_0x1b920a[_0xac60('0x39')][_0xac60('0x4b')]){_0x4710f4[_0xac60('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0xac60('0x4d')](_0x4710f4);})[_0xac60('0x2d')](function(_0x549db5){_0x4155fb[_0xac60('0x4e')]=_0x549db5;return _0x4155fb;})[_0xac60('0x2d')](respondWithFilteredResult(_0x451d82,_0x4710f4))[_0xac60('0x4f')](handleError(_0x451d82,null));};exports[_0xac60('0x50')]=function(_0x43be01,_0x46a590){var _0x4692a5={'raw':!![],'where':{'id':_0x43be01[_0xac60('0x51')]['id']}},_0x5528f8={};_0x5528f8['model']=_[_0xac60('0x52')](db[_0xac60('0x35')]['rawAttributes']);_0x5528f8[_0xac60('0x39')]=_[_0xac60('0x52')](_0x43be01[_0xac60('0x39')]);_0x5528f8[_0xac60('0x43')]=_[_0xac60('0x3a')](_0x5528f8[_0xac60('0x38')],_0x5528f8[_0xac60('0x39')]);_0x4692a5[_0xac60('0x3c')]=_[_0xac60('0x3a')](_0x5528f8[_0xac60('0x38')],qs['fields'](_0x43be01[_0xac60('0x39')]['fields']));_0x4692a5[_0xac60('0x3c')]=_0x4692a5[_0xac60('0x3c')][_0xac60('0x3d')]?_0x4692a5[_0xac60('0x3c')]:_0x5528f8[_0xac60('0x38')];if(_0x43be01[_0xac60('0x39')][_0xac60('0x4b')]){_0x4692a5[_0xac60('0x4c')]=[{'all':!![]}];}_0x4692a5=_['merge']({},_0x4692a5,_0x43be01['options']);return db[_0xac60('0x35')]['find'](_0x4692a5)['then'](handleEntityNotFound(_0x46a590,null))[_0xac60('0x2d')](respondWithResult(_0x46a590,null))[_0xac60('0x4f')](handleError(_0x46a590,null));};exports['download']=function(_0x2a1733,_0x31a6d5,_0x493b6f){return db[_0xac60('0x35')][_0xac60('0x53')]({'where':{'id':_0x2a1733[_0xac60('0x51')]['id']},'attributes':[_0xac60('0x32'),'path'],'raw':!![]})[_0xac60('0x2d')](handleEntityNotFound(_0x31a6d5,null))[_0xac60('0x2d')](function(_0x6a3681){if(_0x6a3681){var _0x37f9bc=path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),util[_0xac60('0x57')](_0xac60('0x58'),path['basename'](_0x6a3681[_0xac60('0x6')])));var _0x3e406b=fs[_0xac60('0x59')](_0x37f9bc);var _0x46ba67=archiver(_0xac60('0x5a'),{'zlib':{'level':0x9}});_0x46ba67['on']('warning',function(_0x4a3b8f){if(_0x4a3b8f[_0xac60('0x5b')]===_0xac60('0x5c')){logger['error'](_0x4a3b8f);}else{throw new db['Sequelize'][(_0xac60('0x5d'))](_0xac60('0x5e'));}});_0x46ba67['on'](_0xac60('0x31'),function(_0x25cb19){throw new db[(_0xac60('0x5f'))][(_0xac60('0x5d'))](_0xac60('0x5e'));});_0x46ba67[_0xac60('0x60')](_0x3e406b);_0x46ba67[_0xac60('0x61')](_0xac60('0x62'),{'cwd':path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),path[_0xac60('0x63')](_0x6a3681[_0xac60('0x6')])),'ignore':[path[_0xac60('0x54')](path[_0xac60('0x64')](_0x6a3681[_0xac60('0x6')]),'node_modules/**/*'),path[_0xac60('0x54')](path['basename'](_0x6a3681['path']),_0xac60('0x65'))],'nodir':!![]})[_0xac60('0x66')]();_0x3e406b['on'](_0xac60('0x67'),function(){if(!fs[_0xac60('0x68')](_0x37f9bc)){throw new db['Sequelize'][(_0xac60('0x5d'))](_0xac60('0x69'));}return _0x31a6d5['download'](_0x37f9bc,util[_0xac60('0x57')](_0xac60('0x58'),path[_0xac60('0x64')](_0x6a3681[_0xac60('0x6')])),function(_0x258aac){if(_0x258aac){throw new db[(_0xac60('0x5f'))][(_0xac60('0x5d'))](_0xac60('0x6a'));}fs[_0xac60('0x6b')](_0x37f9bc);logger['info'](_0xac60('0x6c'));logger[_0xac60('0x6d')](_0xac60('0x6e'));});});}return null;})['catch'](handleError(_0x31a6d5,null));};exports[_0xac60('0x6f')]=function(_0x526036,_0x11c016,_0x2432d0){var _0x2b02f9=path[_0xac60('0x64')](_0x526036[_0xac60('0x70')][_0xac60('0x71')],path[_0xac60('0x72')](_0x526036[_0xac60('0x70')][_0xac60('0x71')]));var _0xb57272=path[_0xac60('0x54')](config[_0xac60('0x55')],'server/files/plugins',_0x526036[_0xac60('0x70')]['filename']);var _0x18e37c=path[_0xac60('0x54')](config[_0xac60('0x55')],'server/files/plugins',_0x2b02f9);logger[_0xac60('0x6d')](_0xac60('0x73'),_0xb57272);logger[_0xac60('0x6d')](_0xac60('0x74'),_0x18e37c);try{fs[_0xac60('0x75')](_0xb57272,parseInt(_0xac60('0x76'),0x8));extract(_0xb57272,{'dir':_0x18e37c},function(_0x13a8ac){if(_0x13a8ac){logger['error'](_0x13a8ac);handleError(_0x13a8ac,!![]);};var _0x479180=fs['readdirSync'](_0x18e37c);if(_0x479180[_0xac60('0x3d')]>0x1){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')](_0xac60('0x77'));return _0x2432d0(new Error('Invalid\x20plugin\x20structure'));}var _0x5ab9fa=fs[_0xac60('0x78')](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0]));if(_0x5ab9fa[_0xac60('0x79')]()){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')]('Invalid\x20plugin\x20structure');return _0x2432d0(new Error(_0xac60('0x77')));}if(_0x5ab9fa['isDirectory']()){var _0x230318=fs['readdirSync'](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0]));if(_0x230318[_0xac60('0x3d')]===0x0){removeReferences(_0xb57272,_0x18e37c);logger[_0xac60('0x31')](_0xac60('0x77'));return _0x2432d0(new Error(_0xac60('0x77')));}var _0x260ebc=_0x230318[_0xac60('0x7a')](function(_0x564f6b){return _0x564f6b==='manifest.json';});if(!_0x260ebc){return _0x2432d0(new Error(_0xac60('0x7b')));}var _0x5ea468=fs[_0xac60('0x7c')](path[_0xac60('0x54')](_0x18e37c,_0x479180[0x0],'manifest.json'));var _0x276626=JSON[_0xac60('0x7d')](_0x5ea468);if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x32')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x276626[_0xac60('0x47')]){return _0x2432d0(new Error(_0xac60('0x7e')));}if(_0xac60('0x26')==typeof _0x276626['version']){return _0x2432d0(new Error(_0xac60('0x7f')));}if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]){return _0x2432d0(new Error(_0xac60('0x81')));}if(_0x276626[_0xac60('0x47')]===_0xac60('0x82')){if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')]&&_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]['views'][_0xac60('0x85')]){return _0x2432d0(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x276626[_0xac60('0x47')]===_0xac60('0x86')){if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')][_0xac60('0x87')]){return _0x2432d0(new Error(_0xac60('0x88')));}if(_0xac60('0x26')==typeof _0x276626[_0xac60('0x80')]['scriptPath']){return _0x2432d0(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2432d0(new Error(_0xac60('0x89')));}var _0x3d3b5a=_0x276626[_0xac60('0x32')];var _0x3c0a6d=_0x276626[_0xac60('0x8a')];var _0x6b7c9c=_0x276626[_0xac60('0x47')];var _0x54db0c=_0x276626['sidebar']?_0x276626['sidebar']:_0xac60('0x8b');var _0x27944a=_0x276626[_0xac60('0x8c')]?_0x276626[_0xac60('0x8c')]:_0xac60('0x8d');var _0x4595d6='';var _0x30ecd5='';var _0xd90484='';var _0x4fdab7='';var _0x3b44ba=_0x276626[_0xac60('0x8e')];if(_0x6b7c9c===_0xac60('0x82')){if(_0xac60('0x26')!=typeof _0x276626['parameters']['views']['admin']){var _0x2e6cae=_0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2e6cae)){_0x4595d6=path[_0xac60('0x54')](_0xac60('0x90'),_0x2b02f9,_0x479180[0x0],_0x2e6cae);}else{_0x4595d6=_0x2e6cae;}}else{logger[_0xac60('0x6d')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x85')]){var _0x2110b6=_0x276626[_0xac60('0x80')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2110b6)){_0x30ecd5=path['join'](_0xac60('0x90'),_0x2b02f9,_0x479180[0x0],_0x2110b6);}else{_0x30ecd5=_0x2110b6;}}else{logger[_0xac60('0x6d')](_0xac60('0x91'));}}else if(_0x6b7c9c===_0xac60('0x86')){_0xd90484=_0x276626['parameters'][_0xac60('0x87')];_0x4fdab7=_0x276626[_0xac60('0x80')]['scriptPath'];if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')]){if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x84')]){var _0x2e6cae=_0x276626['parameters'][_0xac60('0x83')][_0xac60('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e6cae)){_0x4595d6=path[_0xac60('0x54')]('plugins',_0x2b02f9,_0x479180[0x0],_0x2e6cae);}else{_0x4595d6=_0x2e6cae;}}if(_0xac60('0x26')!=typeof _0x276626[_0xac60('0x80')][_0xac60('0x83')][_0xac60('0x85')]){var _0x2110b6=_0x276626[_0xac60('0x80')]['views'][_0xac60('0x85')];if(!/^(f|ht)tps?:\/\//i[_0xac60('0x8f')](_0x2110b6)){_0x30ecd5=path[_0xac60('0x54')]('plugins',_0x2b02f9,_0x479180[0x0],_0x2110b6);}else{_0x30ecd5=_0x2110b6;}}}}var _0xeb2e4a={'name':_0x3d3b5a,'description':_0x3c0a6d,'path':path[_0xac60('0x54')](_0x2b02f9,_0x479180[0x0]),'type':_0x6b7c9c,'sidebar':_0x54db0c,'icon':_0x27944a,'adminUrl':_0x4595d6,'agentUrl':_0x30ecd5,'scriptName':_0xd90484,'scriptPath':_0x4fdab7,'version':_0x3b44ba};removeReferences(_0xb57272,null);return db[_0xac60('0x35')][_0xac60('0x92')](_0xeb2e4a)[_0xac60('0x2d')](function(_0x2de283){var _0x10c87c={'role':_0x526036[_0xac60('0x93')][_0xac60('0x94')],'userProfileId':_0x526036[_0xac60('0x93')][_0xac60('0x95')]};if(!_0x10c87c)throw new Error(_0xac60('0x96'));if(_0x10c87c[_0xac60('0x94')]===_0xac60('0x97')){var _0x4c983a=_0x2de283[_0xac60('0x98')]({'plain':!![]});return db['UserProfileSection'][_0xac60('0x53')]({'where':{'name':_0xac60('0x2e'),'userProfileId':_0x10c87c[_0xac60('0x95')]},'raw':!![]})['then'](function(_0x19432a){if(_0x19432a&&_0x19432a[_0xac60('0x99')]===0x0){return db[_0xac60('0x9a')][_0xac60('0x92')]({'name':_0x4c983a[_0xac60('0x32')],'resourceId':_0x4c983a['id'],'type':_0x19432a[_0xac60('0x32')],'sectionId':_0x19432a['id']},{})[_0xac60('0x2d')](function(){return _0x2de283;});}else{return _0x2de283;}})[_0xac60('0x4f')](function(_0x5015d9){logger[_0xac60('0x31')](_0xac60('0x9b'),_0x5015d9);throw _0x5015d9;});}return _0x2de283;})['then'](respondWithResult(_0x11c016,null))[_0xac60('0x4f')](handleError(_0x11c016,null));}});}catch(_0x9ab1e8){_0x11c016['status'](0x1f4)[_0xac60('0x33')](_0x9ab1e8);}};function removeReferences(_0xf48d6b,_0x27ab0e){try{if(_0xf48d6b){fs['unlinkSync'](_0xf48d6b);logger[_0xac60('0x6d')](_0xac60('0x9c'));}if(_0x27ab0e){rimraf(_0x27ab0e,function(){});logger[_0xac60('0x6d')](_0xac60('0x9d'));}}catch(_0x5da03f){logger[_0xac60('0x31')](_0x5da03f);}}exports[_0xac60('0x2c')]=function(_0x4c06b2,_0xf22dee,_0x1d6f9f){return db[_0xac60('0x35')]['find']({'where':{'id':_0x4c06b2[_0xac60('0x51')]['id']}})[_0xac60('0x2d')](handleEntityNotFound(_0xf22dee,null))[_0xac60('0x2d')](saveUpdates(_0x4c06b2['body'],null))['then'](respondWithResult(_0xf22dee,null))[_0xac60('0x4f')](handleError(_0xf22dee,null));};exports[_0xac60('0x9e')]=function(_0x317519,_0x2ff0e0,_0x7862b2){return db['Plugin'][_0xac60('0x53')]({'where':{'id':_0x317519[_0xac60('0x51')]['id']}})['then'](function(_0xf8131c){if(_0xf8131c){return _0xf8131c['destroy']();}})[_0xac60('0x2d')](function(_0x4b5b45){rimraf(path[_0xac60('0x54')](config[_0xac60('0x55')],_0xac60('0x56'),path[_0xac60('0x63')](_0x4b5b45[_0xac60('0x6')])),function(){});return _0x4b5b45;})[_0xac60('0x2d')](handleEntityNotFound(_0x2ff0e0,null))[_0xac60('0x2d')](respondWithStatusCode(_0x2ff0e0,null))[_0xac60('0x4f')](handleError(_0x2ff0e0,null));};exports[_0xac60('0x9f')]=function(_0xa561ba,_0x55c7ae,_0xb813f7){return BPromise['resolve']()[_0xac60('0x2d')](function(){if(!_0xa561ba[_0xac60('0x39')][_0xac60('0x6')]){throw new Error(_0xac60('0xa0'));}if(!_0xa561ba['query'][_0xac60('0xa1')]){throw new Error(_0xac60('0xa2'));}var _0x4aef7d=_0xa561ba[_0xac60('0x39')]['hostname']?_0xa561ba['query'][_0xac60('0xa3')]+':'+_0xa561ba[_0xac60('0x39')][_0xac60('0xa1')]:_0xac60('0xa4')+_0xa561ba['query'][_0xac60('0xa1')];var _0x17c403=_0xa561ba['query'][_0xac60('0x24')]?_0xa561ba[_0xac60('0x39')]['json']:!![];var _0x28d5ad=_0xa561ba[_0xac60('0x39')][_0xac60('0xa5')]?_0xa561ba[_0xac60('0x39')][_0xac60('0xa5')]:null;var _0x8f5fe3={'method':_0xa561ba[_0xac60('0xa6')],'uri':util[_0xac60('0x57')](_0xac60('0xa7'),_0x4aef7d,_0xa561ba[_0xac60('0x39')][_0xac60('0x6')]),'json':_0x17c403,'resolveWithFullResponse':!![],'encoding':_0x28d5ad,'qs':_0xa561ba[_0xac60('0x39')]};if(_0xa561ba[_0xac60('0xa8')]){_0x8f5fe3[_0xac60('0xa8')]=_0xa561ba[_0xac60('0xa8')];if(_0x8f5fe3[_0xac60('0xa8')]['content-length']){delete _0x8f5fe3['headers'][_0xac60('0xa9')];}}if(_0x8f5fe3['headers']['content-type']){delete _0x8f5fe3['headers'][_0xac60('0xaa')];}return rp(_0x8f5fe3);})[_0xac60('0x2d')](function(_0x4fb749){if(_0x4fb749){_0x55c7ae['set'](_0x4fb749['headers']);logger[_0xac60('0x6d')](_0x4fb749[_0xac60('0x93')]);if(_[_0xac60('0xab')](_0xa561ba[_0xac60('0x39')]['path'],_0xac60('0xac'))&&_0x4fb749['statusCode']==0x1f4){return _0x55c7ae['sendStatus'](_0x4fb749['statusCode']);}else{return _0x55c7ae[_0xac60('0x23')](_0x4fb749[_0xac60('0xad')])[_0xac60('0x33')](_0x4fb749[_0xac60('0x93')]);}}else{return _0x55c7ae['sendStatus'](0xc8);}})[_0xac60('0x4f')](handleError(_0x55c7ae,null));};exports[_0xac60('0xae')]=function(_0x287a19,_0x4802cd,_0x2b65c0){return BPromise[_0xac60('0xaf')]()[_0xac60('0x2d')](function(){if(!_0x287a19['query'][_0xac60('0x6')]){throw new Error(_0xac60('0xa0'));}if(!_0x287a19[_0xac60('0x39')][_0xac60('0xa1')]){throw new Error(_0xac60('0xa2'));}var _0x5cc04d=_0x287a19[_0xac60('0x39')][_0xac60('0xa3')]?_0x287a19[_0xac60('0x39')]['hostname']+':'+_0x287a19[_0xac60('0x39')][_0xac60('0xa1')]:_0xac60('0xa4')+_0x287a19[_0xac60('0x39')][_0xac60('0xa1')];var _0x3122c6=_0x287a19[_0xac60('0x39')][_0xac60('0x24')]?_0x287a19['query'][_0xac60('0x24')]:!![];var _0xed469b=_0x287a19['query']['encoding']?_0x287a19[_0xac60('0x39')][_0xac60('0xa5')]:null;var _0x52ebad={'method':_0x287a19[_0xac60('0xa6')],'uri':util['format'](_0xac60('0xa7'),_0x5cc04d,_0x287a19[_0xac60('0x39')][_0xac60('0x6')]),'json':_0x3122c6,'resolveWithFullResponse':!![],'encoding':_0xed469b,'body':_0x287a19[_0xac60('0x93')]};if(_0x287a19[_0xac60('0xa8')]){_0x52ebad[_0xac60('0xa8')]=_0x287a19[_0xac60('0xa8')];if(_0x52ebad['headers'][_0xac60('0xa9')]){delete _0x52ebad[_0xac60('0xa8')][_0xac60('0xa9')];}}if(_0x52ebad['headers'][_0xac60('0xaa')]){delete _0x52ebad[_0xac60('0xa8')]['content-type'];}return rp(_0x52ebad);})[_0xac60('0x2d')](function(_0x21dab6){if(_0x21dab6){_0x4802cd['set'](_0x21dab6['headers']);logger[_0xac60('0x6d')](_0x21dab6['body']);return _0x4802cd[_0xac60('0x23')](_0x21dab6['statusCode'])['send'](_0x21dab6[_0xac60('0x93')]);}else{return _0x4802cd[_0xac60('0x22')](0xc8);}})[_0xac60('0x4f')](handleError(_0x4802cd,null));}; \ No newline at end of file +var _0x834e=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','Plugins','UserProfileResource','error','name','index','Plugin','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','rows','catch','params','length','merge','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','send','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','webhookPost','http://localhost:','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x3776f9,_0x539639){var _0x3d7837=function(_0xd04a6){while(--_0xd04a6){_0x3776f9['push'](_0x3776f9['shift']());}};_0x3d7837(++_0x539639);}(_0x834e,0x150));var _0xe834=function(_0x4dcecc,_0x3865b9){_0x4dcecc=_0x4dcecc-0x0;var _0x2aa658=_0x834e[_0x4dcecc];return _0x2aa658;};'use strict';var emlformat=require(_0xe834('0x0'));var rimraf=require(_0xe834('0x1'));var zipdir=require(_0xe834('0x2'));var jsonpatch=require(_0xe834('0x3'));var rp=require(_0xe834('0x4'));var moment=require(_0xe834('0x5'));var BPromise=require(_0xe834('0x6'));var Mustache=require(_0xe834('0x7'));var util=require('util');var path=require(_0xe834('0x8'));var sox=require(_0xe834('0x9'));var csv=require(_0xe834('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe834('0xb'));var _=require(_0xe834('0xc'));var squel=require(_0xe834('0xd'));var crypto=require(_0xe834('0xe'));var jsforce=require(_0xe834('0xf'));var deskjs=require(_0xe834('0x10'));var toCsv=require(_0xe834('0xa'));var querystring=require(_0xe834('0x11'));var Papa=require(_0xe834('0x12'));var extract=require(_0xe834('0x13'));var rimraf=require('rimraf');var archiver=require(_0xe834('0x14'));var Redis=require(_0xe834('0x15'));var authService=require(_0xe834('0x16'));var qs=require(_0xe834('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe834('0x18'));var logger=require(_0xe834('0x19'))(_0xe834('0x1a'));var utils=require(_0xe834('0x1b'));var config=require(_0xe834('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0xe834('0x1d'))['db'];config[_0xe834('0x1e')]=_[_0xe834('0x1f')](config['redis'],{'host':_0xe834('0x20'),'port':0x18eb});var socket=require(_0xe834('0x21'))(new Redis(config[_0xe834('0x1e')]));require(_0xe834('0x22'))[_0xe834('0x23')](socket);function respondWithStatusCode(_0xe3bd01,_0x2d00cb){_0x2d00cb=_0x2d00cb||0xcc;return function(_0x548d46){if(_0x548d46){return _0xe3bd01[_0xe834('0x24')](_0x2d00cb);}return _0xe3bd01[_0xe834('0x25')](_0x2d00cb)[_0xe834('0x26')]();};}function respondWithResult(_0x2c375a,_0x116675){_0x116675=_0x116675||0xc8;return function(_0x29e8f1){if(_0x29e8f1){return _0x2c375a[_0xe834('0x25')](_0x116675)[_0xe834('0x27')](_0x29e8f1);}};}function respondWithFilteredResult(_0x3df1af,_0x3cfcd5){return function(_0x513ab7){if(_0x513ab7){var _0x52edfe=typeof _0x3cfcd5[_0xe834('0x28')]===_0xe834('0x29')&&typeof _0x3cfcd5[_0xe834('0x2a')]===_0xe834('0x29');var _0x215273=_0x513ab7[_0xe834('0x2b')];var _0x3480ec=_0x52edfe?0x0:_0x3cfcd5['offset'];var _0x15cf31=_0x52edfe?_0x513ab7[_0xe834('0x2b')]:_0x3cfcd5[_0xe834('0x28')]+_0x3cfcd5[_0xe834('0x2a')];var _0x20c959;if(_0x15cf31>=_0x215273){_0x15cf31=_0x215273;_0x20c959=0xc8;}else{_0x20c959=0xce;}_0x3df1af[_0xe834('0x25')](_0x20c959);return _0x3df1af[_0xe834('0x2c')](_0xe834('0x2d'),_0x3480ec+'-'+_0x15cf31+'/'+_0x215273)[_0xe834('0x27')](_0x513ab7);}return null;};}function patchUpdates(_0x463be7){return function(_0x3c0649){try{jsonpatch['apply'](_0x3c0649,_0x463be7,!![]);}catch(_0x1084a6){return BPromise[_0xe834('0x2e')](_0x1084a6);}return _0x3c0649['save']();};}function saveUpdates(_0x7b60e3,_0x38b42d){return function(_0x2d66c7){if(_0x2d66c7){return _0x2d66c7[_0xe834('0x2f')](_0x7b60e3)[_0xe834('0x30')](function(_0x5379f6){return _0x5379f6;});}return null;};}function removeEntity(_0x8a8d94,_0xea61a2){return function(_0xc8a08c){if(_0xc8a08c){return _0xc8a08c[_0xe834('0x31')]()[_0xe834('0x30')](function(){var _0x241a63=_0xc8a08c['get']({'plain':!![]});var _0x1abe50=_0xe834('0x32');return db[_0xe834('0x33')]['destroy']({'where':{'type':_0x1abe50,'resourceId':_0x241a63['id']}})[_0xe834('0x30')](function(){return _0xc8a08c;});})[_0xe834('0x30')](function(){_0x8a8d94[_0xe834('0x25')](0xcc)[_0xe834('0x26')]();});}};}function handleEntityNotFound(_0x3a37d7,_0x4b023d){return function(_0x2ece1){if(!_0x2ece1){_0x3a37d7[_0xe834('0x24')](0x194);}return _0x2ece1;};}function handleError(_0x586714,_0x599a9d){_0x599a9d=_0x599a9d||0x1f4;return function(_0x7fc733){logger[_0xe834('0x34')](_0x7fc733['stack']);if(_0x7fc733[_0xe834('0x35')]){delete _0x7fc733[_0xe834('0x35')];}_0x586714[_0xe834('0x25')](_0x599a9d)['send'](_0x7fc733);};}exports[_0xe834('0x36')]=function(_0x109ca,_0x3cdf79){var _0x4b162d={},_0x17ec61={},_0x162c3c={'count':0x0,'rows':[]};var _0x2483f3=_['map'](db[_0xe834('0x37')][_0xe834('0x38')],function(_0x2b243c){return{'name':_0x2b243c[_0xe834('0x39')],'type':_0x2b243c[_0xe834('0x3a')]['key']};});_0x17ec61[_0xe834('0x3b')]=_[_0xe834('0x3c')](_0x2483f3,_0xe834('0x35'));_0x17ec61[_0xe834('0x3d')]=_[_0xe834('0x3e')](_0x109ca[_0xe834('0x3d')]);_0x17ec61['filters']=_['intersection'](_0x17ec61['model'],_0x17ec61[_0xe834('0x3d')]);_0x4b162d[_0xe834('0x3f')]=_[_0xe834('0x40')](_0x17ec61[_0xe834('0x3b')],qs[_0xe834('0x41')](_0x109ca[_0xe834('0x3d')][_0xe834('0x41')]));_0x4b162d['attributes']=_0x4b162d['attributes']['length']?_0x4b162d['attributes']:_0x17ec61[_0xe834('0x3b')];if(!_0x109ca['query'][_0xe834('0x42')]('nolimit')){_0x4b162d['limit']=qs['limit'](_0x109ca[_0xe834('0x3d')]['limit']);_0x4b162d[_0xe834('0x28')]=qs['offset'](_0x109ca[_0xe834('0x3d')][_0xe834('0x28')]);}_0x4b162d[_0xe834('0x43')]=qs[_0xe834('0x44')](_0x109ca[_0xe834('0x3d')][_0xe834('0x44')]);_0x4b162d[_0xe834('0x45')]=qs['filters'](_['pick'](_0x109ca[_0xe834('0x3d')],_0x17ec61[_0xe834('0x46')]),_0x2483f3);if(_0x109ca[_0xe834('0x3d')][_0xe834('0x47')]){_0x4b162d[_0xe834('0x45')]=_['merge'](_0x4b162d[_0xe834('0x45')],{'$or':_[_0xe834('0x3c')](_0x2483f3,function(_0x34ec6d){if(_0x34ec6d[_0xe834('0x3a')]!==_0xe834('0x48')){var _0x32fddc={};_0x32fddc[_0x34ec6d[_0xe834('0x35')]]={'$like':'%'+_0x109ca[_0xe834('0x3d')][_0xe834('0x47')]+'%'};return _0x32fddc;}})});}_0x4b162d=_['merge']({},_0x4b162d,_0x109ca[_0xe834('0x49')]);var _0x1d1782={'where':_0x4b162d[_0xe834('0x45')]};return db[_0xe834('0x37')][_0xe834('0x2b')](_0x1d1782)[_0xe834('0x30')](function(_0x468c51){_0x162c3c[_0xe834('0x2b')]=_0x468c51;if(_0x109ca[_0xe834('0x3d')][_0xe834('0x4a')]){_0x4b162d[_0xe834('0x4b')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x4b162d);})[_0xe834('0x30')](function(_0x4c0783){_0x162c3c[_0xe834('0x4c')]=_0x4c0783;return _0x162c3c;})[_0xe834('0x30')](respondWithFilteredResult(_0x3cdf79,_0x4b162d))[_0xe834('0x4d')](handleError(_0x3cdf79,null));};exports['show']=function(_0x1d536c,_0x49d7d1){var _0x2658ae={'raw':!![],'where':{'id':_0x1d536c[_0xe834('0x4e')]['id']}},_0x14348a={};_0x14348a[_0xe834('0x3b')]=_[_0xe834('0x3e')](db[_0xe834('0x37')]['rawAttributes']);_0x14348a[_0xe834('0x3d')]=_[_0xe834('0x3e')](_0x1d536c[_0xe834('0x3d')]);_0x14348a[_0xe834('0x46')]=_[_0xe834('0x40')](_0x14348a[_0xe834('0x3b')],_0x14348a[_0xe834('0x3d')]);_0x2658ae['attributes']=_[_0xe834('0x40')](_0x14348a[_0xe834('0x3b')],qs[_0xe834('0x41')](_0x1d536c[_0xe834('0x3d')]['fields']));_0x2658ae[_0xe834('0x3f')]=_0x2658ae[_0xe834('0x3f')][_0xe834('0x4f')]?_0x2658ae[_0xe834('0x3f')]:_0x14348a[_0xe834('0x3b')];if(_0x1d536c[_0xe834('0x3d')]['includeAll']){_0x2658ae[_0xe834('0x4b')]=[{'all':!![]}];}_0x2658ae=_[_0xe834('0x50')]({},_0x2658ae,_0x1d536c['options']);return db['Plugin']['find'](_0x2658ae)[_0xe834('0x30')](handleEntityNotFound(_0x49d7d1,null))['then'](respondWithResult(_0x49d7d1,null))[_0xe834('0x4d')](handleError(_0x49d7d1,null));};exports[_0xe834('0x51')]=function(_0xfcab8b,_0x2217df,_0x1443ad){return db['Plugin'][_0xe834('0x52')]({'where':{'id':_0xfcab8b[_0xe834('0x4e')]['id']},'attributes':[_0xe834('0x35'),'path'],'raw':!![]})[_0xe834('0x30')](handleEntityNotFound(_0x2217df,null))[_0xe834('0x30')](function(_0xdb690f){if(_0xdb690f){var _0x24fc10=path[_0xe834('0x53')](config[_0xe834('0x54')],_0xe834('0x55'),util[_0xe834('0x56')](_0xe834('0x57'),path[_0xe834('0x58')](_0xdb690f[_0xe834('0x8')])));var _0x27e17f=fs[_0xe834('0x59')](_0x24fc10);var _0x146eaa=archiver(_0xe834('0x5a'),{'zlib':{'level':0x9}});_0x146eaa['on']('warning',function(_0x578517){if(_0x578517[_0xe834('0x5b')]===_0xe834('0x5c')){logger[_0xe834('0x34')](_0x578517);}else{throw new db[(_0xe834('0x5d'))][(_0xe834('0x5e'))](_0xe834('0x5f'));}});_0x146eaa['on'](_0xe834('0x34'),function(_0x1e37b8){throw new db[(_0xe834('0x5d'))][(_0xe834('0x5e'))](_0xe834('0x5f'));});_0x146eaa[_0xe834('0x60')](_0x27e17f);_0x146eaa['glob'](_0xe834('0x61'),{'cwd':path['join'](config[_0xe834('0x54')],_0xe834('0x55'),path[_0xe834('0x62')](_0xdb690f[_0xe834('0x8')])),'ignore':[path[_0xe834('0x53')](path[_0xe834('0x58')](_0xdb690f[_0xe834('0x8')]),_0xe834('0x63')),path[_0xe834('0x53')](path[_0xe834('0x58')](_0xdb690f[_0xe834('0x8')]),_0xe834('0x64'))],'nodir':!![]})[_0xe834('0x65')]();_0x27e17f['on'](_0xe834('0x66'),function(){if(!fs['existsSync'](_0x24fc10)){throw new db['Sequelize'][(_0xe834('0x5e'))](_0xe834('0x67'));}return _0x2217df[_0xe834('0x51')](_0x24fc10,util[_0xe834('0x56')](_0xe834('0x57'),path[_0xe834('0x58')](_0xdb690f[_0xe834('0x8')])),function(_0x529b28){if(_0x529b28){throw new db['Sequelize'][(_0xe834('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xe834('0x68')](_0x24fc10);logger[_0xe834('0x69')](_0xe834('0x6a'));logger['info'](_0xe834('0x6b'));});});}return null;})[_0xe834('0x4d')](handleError(_0x2217df,null));};exports['upload']=function(_0x6d5183,_0x52d3ff,_0x2a90ba){var _0x1cdde6=path[_0xe834('0x58')](_0x6d5183[_0xe834('0x6c')][_0xe834('0x6d')],path[_0xe834('0x6e')](_0x6d5183[_0xe834('0x6c')][_0xe834('0x6d')]));var _0xf030d5=path[_0xe834('0x53')](config[_0xe834('0x54')],_0xe834('0x55'),_0x6d5183['file']['filename']);var _0x1f3b4e=path[_0xe834('0x53')](config[_0xe834('0x54')],'server/files/plugins',_0x1cdde6);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0xf030d5);logger['info'](_0xe834('0x6f'),_0x1f3b4e);try{fs[_0xe834('0x70')](_0xf030d5,parseInt(_0xe834('0x71'),0x8));extract(_0xf030d5,{'dir':_0x1f3b4e},function(_0x189c13){if(_0x189c13){logger[_0xe834('0x34')](_0x189c13);handleError(_0x189c13,!![]);};var _0xea5296=fs['readdirSync'](_0x1f3b4e);if(_0xea5296['length']>0x1){removeReferences(_0xf030d5,_0x1f3b4e);logger['error'](_0xe834('0x72'));return _0x2a90ba(new Error(_0xe834('0x72')));}var _0x5c1474=fs[_0xe834('0x73')](path[_0xe834('0x53')](_0x1f3b4e,_0xea5296[0x0]));if(_0x5c1474[_0xe834('0x74')]()){removeReferences(_0xf030d5,_0x1f3b4e);logger['error'](_0xe834('0x72'));return _0x2a90ba(new Error(_0xe834('0x72')));}if(_0x5c1474['isDirectory']()){var _0x21340d=fs[_0xe834('0x75')](path['join'](_0x1f3b4e,_0xea5296[0x0]));if(_0x21340d[_0xe834('0x4f')]===0x0){removeReferences(_0xf030d5,_0x1f3b4e);logger[_0xe834('0x34')](_0xe834('0x72'));return _0x2a90ba(new Error(_0xe834('0x72')));}var _0x545a80=_0x21340d[_0xe834('0x76')](function(_0xa0352d){return _0xa0352d===_0xe834('0x77');});if(!_0x545a80){return _0x2a90ba(new Error(_0xe834('0x78')));}var _0x526d1f=fs[_0xe834('0x79')](path[_0xe834('0x53')](_0x1f3b4e,_0xea5296[0x0],_0xe834('0x77')));var _0x3dc75c=JSON[_0xe834('0x7a')](_0x526d1f);if(_0xe834('0x29')==typeof _0x3dc75c[_0xe834('0x35')]){return _0x2a90ba(new Error(_0xe834('0x7b')));}if('undefined'==typeof _0x3dc75c[_0xe834('0x3a')]){return _0x2a90ba(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x3dc75c[_0xe834('0x7c')]){return _0x2a90ba(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe834('0x29')==typeof _0x3dc75c[_0xe834('0x7d')]){return _0x2a90ba(new Error(_0xe834('0x7e')));}if(_0x3dc75c[_0xe834('0x3a')]===_0xe834('0x7f')){if(_0xe834('0x29')==typeof _0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')]){return _0x2a90ba(new Error(_0xe834('0x81')));}if(_0xe834('0x29')==typeof _0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')][_0xe834('0x82')]&&'undefined'==typeof _0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')][_0xe834('0x83')]){return _0x2a90ba(new Error(_0xe834('0x84')));}}else if(_0x3dc75c[_0xe834('0x3a')]==='script'){if('undefined'==typeof _0x3dc75c[_0xe834('0x7d')]['scriptName']){return _0x2a90ba(new Error(_0xe834('0x85')));}if(_0xe834('0x29')==typeof _0x3dc75c['parameters'][_0xe834('0x86')]){return _0x2a90ba(new Error(_0xe834('0x87')));}}else{return _0x2a90ba(new Error(_0xe834('0x88')));}var _0xcf0e63=_0x3dc75c[_0xe834('0x35')];var _0x34181a=_0x3dc75c[_0xe834('0x89')];var _0x1cd330=_0x3dc75c[_0xe834('0x3a')];var _0x53dec9=_0x3dc75c[_0xe834('0x8a')]?_0x3dc75c[_0xe834('0x8a')]:'always';var _0x313163=_0x3dc75c[_0xe834('0x8b')]?_0x3dc75c[_0xe834('0x8b')]:_0xe834('0x8c');var _0x396b9a='';var _0x3b3a3f='';var _0x1c67fd='';var _0x492005='';var _0x198166=_0x3dc75c[_0xe834('0x7c')];if(_0x1cd330==='html'){if(_0xe834('0x29')!=typeof _0x3dc75c[_0xe834('0x7d')]['views'][_0xe834('0x82')]){var _0x52899a=_0x3dc75c['parameters'][_0xe834('0x80')][_0xe834('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xe834('0x8d')](_0x52899a)){_0x396b9a=path[_0xe834('0x53')](_0xe834('0x8e'),_0x1cdde6,_0xea5296[0x0],_0x52899a);}else{_0x396b9a=_0x52899a;}}else{logger[_0xe834('0x69')](_0xe834('0x8f'));}if(_0xe834('0x29')!=typeof _0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')][_0xe834('0x83')]){var _0x453395=_0x3dc75c['parameters'][_0xe834('0x80')][_0xe834('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe834('0x8d')](_0x453395)){_0x3b3a3f=path[_0xe834('0x53')](_0xe834('0x8e'),_0x1cdde6,_0xea5296[0x0],_0x453395);}else{_0x3b3a3f=_0x453395;}}else{logger[_0xe834('0x69')](_0xe834('0x90'));}}else if(_0x1cd330===_0xe834('0x91')){_0x1c67fd=_0x3dc75c['parameters'][_0xe834('0x92')];_0x492005=_0x3dc75c[_0xe834('0x7d')][_0xe834('0x86')];if(_0xe834('0x29')!=typeof _0x3dc75c['parameters'][_0xe834('0x80')]){if(_0xe834('0x29')!=typeof _0x3dc75c[_0xe834('0x7d')]['views'][_0xe834('0x82')]){var _0x52899a=_0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')][_0xe834('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xe834('0x8d')](_0x52899a)){_0x396b9a=path[_0xe834('0x53')]('plugins',_0x1cdde6,_0xea5296[0x0],_0x52899a);}else{_0x396b9a=_0x52899a;}}if('undefined'!=typeof _0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')]['agent']){var _0x453395=_0x3dc75c[_0xe834('0x7d')][_0xe834('0x80')][_0xe834('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xe834('0x8d')](_0x453395)){_0x3b3a3f=path[_0xe834('0x53')](_0xe834('0x8e'),_0x1cdde6,_0xea5296[0x0],_0x453395);}else{_0x3b3a3f=_0x453395;}}}}var _0x1e948a={'name':_0xcf0e63,'description':_0x34181a,'path':path[_0xe834('0x53')](_0x1cdde6,_0xea5296[0x0]),'type':_0x1cd330,'sidebar':_0x53dec9,'icon':_0x313163,'adminUrl':_0x396b9a,'agentUrl':_0x3b3a3f,'scriptName':_0x1c67fd,'scriptPath':_0x492005,'version':_0x198166};removeReferences(_0xf030d5,null);return db[_0xe834('0x37')]['create'](_0x1e948a)['then'](function(_0x687bdf){var _0x42ee13={'role':_0x6d5183[_0xe834('0x93')][_0xe834('0x94')],'userProfileId':_0x6d5183[_0xe834('0x93')]['userProfileId']};if(!_0x42ee13)throw new Error(_0xe834('0x95'));if(_0x42ee13[_0xe834('0x94')]===_0xe834('0x96')){var _0x102790=_0x687bdf[_0xe834('0x97')]({'plain':!![]});return db[_0xe834('0x98')][_0xe834('0x52')]({'where':{'name':_0xe834('0x32'),'userProfileId':_0x42ee13[_0xe834('0x99')]},'raw':!![]})[_0xe834('0x30')](function(_0x2ba2e3){if(_0x2ba2e3&&_0x2ba2e3['autoAssociation']===0x0){return db[_0xe834('0x33')]['create']({'name':_0x102790[_0xe834('0x35')],'resourceId':_0x102790['id'],'type':_0x2ba2e3['name'],'sectionId':_0x2ba2e3['id']},{})['then'](function(){return _0x687bdf;});}else{return _0x687bdf;}})[_0xe834('0x4d')](function(_0xe13460){logger[_0xe834('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe13460);throw _0xe13460;});}return _0x687bdf;})[_0xe834('0x30')](respondWithResult(_0x52d3ff,null))[_0xe834('0x4d')](handleError(_0x52d3ff,null));}});}catch(_0x43da21){_0x52d3ff[_0xe834('0x25')](0x1f4)[_0xe834('0x9a')](_0x43da21);}};function removeReferences(_0x5b3812,_0x37b737){try{if(_0x5b3812){fs[_0xe834('0x68')](_0x5b3812);logger[_0xe834('0x69')]('Zip\x20archive\x20removed');}if(_0x37b737){rimraf(_0x37b737,function(){});logger['info'](_0xe834('0x9b'));}}catch(_0x2d0c35){logger[_0xe834('0x34')](_0x2d0c35);}}exports[_0xe834('0x2f')]=function(_0x250f96,_0x53292d,_0x17da7c){return db[_0xe834('0x37')]['find']({'where':{'id':_0x250f96[_0xe834('0x4e')]['id']}})[_0xe834('0x30')](handleEntityNotFound(_0x53292d,null))[_0xe834('0x30')](saveUpdates(_0x250f96['body'],null))[_0xe834('0x30')](respondWithResult(_0x53292d,null))[_0xe834('0x4d')](handleError(_0x53292d,null));};exports[_0xe834('0x9c')]=function(_0x21777b,_0xb1ee47,_0x1fa99b){return db[_0xe834('0x37')][_0xe834('0x52')]({'where':{'id':_0x21777b['params']['id']}})['then'](function(_0x4c2232){if(_0x4c2232){return _0x4c2232[_0xe834('0x31')]();}})['then'](function(_0x668792){rimraf(path['join'](config[_0xe834('0x54')],'server/files/plugins',path[_0xe834('0x62')](_0x668792[_0xe834('0x8')])),function(){});return _0x668792;})[_0xe834('0x30')](handleEntityNotFound(_0xb1ee47,null))['then'](respondWithStatusCode(_0xb1ee47,null))[_0xe834('0x4d')](handleError(_0xb1ee47,null));};exports[_0xe834('0x9d')]=function(_0x1a31bd,_0x2925fa,_0x8b3cd6){return BPromise[_0xe834('0x9e')]()[_0xe834('0x30')](function(){if(!_0x1a31bd[_0xe834('0x3d')]['path']){throw new Error(_0xe834('0x9f'));}if(!_0x1a31bd[_0xe834('0x3d')][_0xe834('0xa0')]){throw new Error(_0xe834('0xa1'));}var _0x1ce6e1=_0x1a31bd[_0xe834('0x3d')][_0xe834('0xa2')]?_0x1a31bd[_0xe834('0x3d')]['hostname']+':'+_0x1a31bd[_0xe834('0x3d')][_0xe834('0xa0')]:'http://localhost:'+_0x1a31bd['query'][_0xe834('0xa0')];var _0x2439d2=_0x1a31bd[_0xe834('0x3d')][_0xe834('0x27')]?_0x1a31bd[_0xe834('0x3d')][_0xe834('0x27')]:!![];var _0xfd6511=_0x1a31bd['query'][_0xe834('0xa3')]?_0x1a31bd[_0xe834('0x3d')]['encoding']:null;var _0x62f2ce={'method':_0x1a31bd[_0xe834('0xa4')],'uri':util[_0xe834('0x56')](_0xe834('0xa5'),_0x1ce6e1,_0x1a31bd[_0xe834('0x3d')][_0xe834('0x8')]),'json':_0x2439d2,'resolveWithFullResponse':!![],'encoding':_0xfd6511,'qs':_0x1a31bd['query']};if(_0x1a31bd[_0xe834('0xa6')]){_0x62f2ce[_0xe834('0xa6')]=_0x1a31bd[_0xe834('0xa6')];if(_0x62f2ce[_0xe834('0xa6')][_0xe834('0xa7')]){delete _0x62f2ce[_0xe834('0xa6')][_0xe834('0xa7')];}}if(_0x62f2ce['headers'][_0xe834('0xa8')]){delete _0x62f2ce['headers']['content-type'];}return rp(_0x62f2ce);})[_0xe834('0x30')](function(_0x2a329d){if(_0x2a329d){_0x2925fa['set'](_0x2a329d[_0xe834('0xa6')]);logger[_0xe834('0x69')](_0x2a329d[_0xe834('0x93')]);if(_[_0xe834('0xa9')](_0x1a31bd[_0xe834('0x3d')][_0xe834('0x8')],_0xe834('0x51'))&&_0x2a329d['statusCode']==0x1f4){return _0x2925fa['sendStatus'](_0x2a329d['statusCode']);}else{return _0x2925fa[_0xe834('0x25')](_0x2a329d['statusCode'])[_0xe834('0x9a')](_0x2a329d['body']);}}else{return _0x2925fa[_0xe834('0x24')](0xc8);}})['catch'](handleError(_0x2925fa,null));};exports[_0xe834('0xaa')]=function(_0x1c96b9,_0x5df46f,_0x361626){return BPromise[_0xe834('0x9e')]()[_0xe834('0x30')](function(){if(!_0x1c96b9['query'][_0xe834('0x8')]){throw new Error(_0xe834('0x9f'));}if(!_0x1c96b9[_0xe834('0x3d')][_0xe834('0xa0')]){throw new Error(_0xe834('0xa1'));}var _0x317ea1=_0x1c96b9[_0xe834('0x3d')][_0xe834('0xa2')]?_0x1c96b9[_0xe834('0x3d')][_0xe834('0xa2')]+':'+_0x1c96b9[_0xe834('0x3d')]['port']:_0xe834('0xab')+_0x1c96b9[_0xe834('0x3d')][_0xe834('0xa0')];var _0x549841=_0x1c96b9[_0xe834('0x3d')]['json']?_0x1c96b9[_0xe834('0x3d')]['json']:!![];var _0x6e0e23=_0x1c96b9[_0xe834('0x3d')]['encoding']?_0x1c96b9[_0xe834('0x3d')]['encoding']:null;var _0x4e52be={'method':_0x1c96b9['method'],'uri':util[_0xe834('0x56')](_0xe834('0xa5'),_0x317ea1,_0x1c96b9['query'][_0xe834('0x8')]),'json':_0x549841,'resolveWithFullResponse':!![],'encoding':_0x6e0e23,'body':_0x1c96b9['body']};if(_0x1c96b9[_0xe834('0xa6')]){_0x4e52be[_0xe834('0xa6')]=_0x1c96b9[_0xe834('0xa6')];if(_0x4e52be['headers'][_0xe834('0xa7')]){delete _0x4e52be[_0xe834('0xa6')][_0xe834('0xa7')];}}if(_0x4e52be[_0xe834('0xa6')][_0xe834('0xa8')]){delete _0x4e52be[_0xe834('0xa6')]['content-type'];}return rp(_0x4e52be);})[_0xe834('0x30')](function(_0x102900){if(_0x102900){_0x5df46f['set'](_0x102900[_0xe834('0xa6')]);logger[_0xe834('0x69')](_0x102900['body']);return _0x5df46f[_0xe834('0x25')](_0x102900[_0xe834('0xac')])[_0xe834('0x9a')](_0x102900[_0xe834('0x93')]);}else{return _0x5df46f[_0xe834('0x24')](0xc8);}})['catch'](handleError(_0x5df46f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e6d0207..defa1b2 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 _0xe700=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x351974,_0x4007d2){var _0x5649f4=function(_0x19e854){while(--_0x19e854){_0x351974['push'](_0x351974['shift']());}};_0x5649f4(++_0x4007d2);}(_0xe700,0x75));var _0x0e70=function(_0x3bfcbe,_0xd4935e){_0x3bfcbe=_0x3bfcbe-0x0;var _0x1eb8da=_0xe700[_0x3bfcbe];return _0x1eb8da;};'use strict';var EventEmitter=require(_0x0e70('0x0'));var Plugin=require(_0x0e70('0x1'))['db'][_0x0e70('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x0e70('0x3')](0x0);var events={'afterCreate':_0x0e70('0x4'),'afterUpdate':_0x0e70('0x5'),'afterDestroy':_0x0e70('0x6')};function emitEvent(_0x34f087){return function(_0x27ba59,_0xb9349a,_0x55e41f){PluginEvents[_0x0e70('0x7')](_0x34f087+':'+_0x27ba59['id'],_0x27ba59);PluginEvents['emit'](_0x34f087,_0x27ba59);_0x55e41f(null);};}for(var e in events){if(events[_0x0e70('0x8')](e)){var event=events[e];Plugin[_0x0e70('0x9')](e,emitEvent(event));}}module[_0x0e70('0xa')]=PluginEvents; \ No newline at end of file +var _0xa4bd=['Plugin','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x26db15,_0x50daec){var _0x31f013=function(_0x2b71fe){while(--_0x2b71fe){_0x26db15['push'](_0x26db15['shift']());}};_0x31f013(++_0x50daec);}(_0xa4bd,0x1e4));var _0xda4b=function(_0xb11151,_0x12ddce){_0xb11151=_0xb11151-0x0;var _0x432948=_0xa4bd[_0xb11151];return _0x432948;};'use strict';var EventEmitter=require(_0xda4b('0x0'));var Plugin=require(_0xda4b('0x1'))['db'][_0xda4b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda4b('0x3'),'afterUpdate':_0xda4b('0x4'),'afterDestroy':_0xda4b('0x5')};function emitEvent(_0xa7bd1d){return function(_0x2b900e,_0xc42c1c,_0x2da904){PluginEvents[_0xda4b('0x6')](_0xa7bd1d+':'+_0x2b900e['id'],_0x2b900e);PluginEvents[_0xda4b('0x6')](_0xa7bd1d,_0x2b900e);_0x2da904(null);};}for(var e in events){if(events[_0xda4b('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xda4b('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 7c59483..2631ed8 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 _0x4e20=['Plugin','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x3a5c6c,_0x5b8ba1){var _0x62d29c=function(_0x1c8a2b){while(--_0x1c8a2b){_0x3a5c6c['push'](_0x3a5c6c['shift']());}};_0x62d29c(++_0x5b8ba1);}(_0x4e20,0x121));var _0x04e2=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4e20[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var logger=require(_0x04e2('0x2'))(_0x04e2('0x3'));var moment=require(_0x04e2('0x4'));var BPromise=require(_0x04e2('0x5'));var rp=require(_0x04e2('0x6'));var fs=require('fs');var path=require(_0x04e2('0x7'));var rimraf=require(_0x04e2('0x8'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x04e2('0x9')]=function(_0x143381,_0x5e62e4){return _0x143381[_0x04e2('0xa')](_0x04e2('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f6f=['exports','plugins','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x12a1d0,_0x42c00f){var _0x2a906a=function(_0x2f7d5e){while(--_0x2f7d5e){_0x12a1d0['push'](_0x12a1d0['shift']());}};_0x2a906a(++_0x42c00f);}(_0x2f6f,0x102));var _0xf2f6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2f6f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xf2f6('0x0'));var util=require('util');var logger=require(_0xf2f6('0x1'))('api');var moment=require(_0xf2f6('0x2'));var BPromise=require(_0xf2f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2f6('0x4'));var rimraf=require(_0xf2f6('0x5'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xf2f6('0x6')]=function(_0x57fb0b,_0x406ca9){return _0x57fb0b['define']('Plugin',attributes,{'tableName':_0xf2f6('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 62a85fd..b67ec41 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 _0x069d=['body','options','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','create'];(function(_0x4d3d1f,_0x5eddf8){var _0x2dbb2e=function(_0x1c350e){while(--_0x1c350e){_0x4d3d1f['push'](_0x4d3d1f['shift']());}};_0x2dbb2e(++_0x5eddf8);}(_0x069d,0x11a));var _0xd069=function(_0x109348,_0x333600){_0x109348=_0x109348-0x0;var _0x4b1c61=_0x069d[_0x109348];return _0x4b1c61;};'use strict';var _=require(_0xd069('0x0'));var util=require('util');var moment=require(_0xd069('0x1'));var BPromise=require('bluebird');var rs=require(_0xd069('0x2'));var fs=require('fs');var Redis=require(_0xd069('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd069('0x4'));var logger=require(_0xd069('0x5'))('rpc');var config=require(_0xd069('0x6'));var jayson=require(_0xd069('0x7'));var client=jayson['client'][_0xd069('0x8')]({'port':0x232a});config[_0xd069('0x9')]=_['defaults'](config[_0xd069('0x9')],{'host':_0xd069('0xa'),'port':0x18eb});var socket=require(_0xd069('0xb'))(new Redis(config['redis']));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x24b3d7,_0x3e0233,_0x439bfa){return new BPromise(function(_0x339852,_0x217d2c){return client[_0xd069('0xc')](_0x24b3d7,_0x439bfa)[_0xd069('0xd')](function(_0xddefd7){logger[_0xd069('0xe')](_0xd069('0xf'),_0x3e0233,_0xd069('0x10'));logger[_0xd069('0x11')](_0xd069('0x12'),_0x3e0233,'request\x20sent',JSON[_0xd069('0x13')](_0xddefd7));if(_0xddefd7['error']){if(_0xddefd7[_0xd069('0x14')][_0xd069('0x15')]===0x1f4){logger[_0xd069('0x14')](_0xd069('0xf'),_0x3e0233,_0xddefd7[_0xd069('0x14')][_0xd069('0x16')]);return _0x217d2c(_0xddefd7['error'][_0xd069('0x16')]);}logger['error'](_0xd069('0xf'),_0x3e0233,_0xddefd7[_0xd069('0x14')]['message']);return _0x339852(_0xddefd7[_0xd069('0x14')][_0xd069('0x16')]);}else{logger[_0xd069('0xe')](_0xd069('0xf'),_0x3e0233,_0xd069('0x10'));_0x339852(_0xddefd7[_0xd069('0x17')][_0xd069('0x16')]);}})['catch'](function(_0x2e30a0){logger['error']('Plugin,\x20%s,\x20%s',_0x3e0233,_0x2e30a0);_0x217d2c(_0x2e30a0);});});}exports[_0xd069('0x18')]=function(_0x286181){var _0x1db98a=this;return new Promise(function(_0x58963b,_0x141e06){return db['Plugin'][_0xd069('0x19')](_0x286181[_0xd069('0x1a')],{'raw':_0x286181[_0xd069('0x1b')]?_0x286181[_0xd069('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1667fb){logger['info'](_0xd069('0x18'),_0x286181);logger[_0xd069('0x11')](_0xd069('0x18'),_0x286181,JSON[_0xd069('0x13')](_0x1667fb));_0x58963b(_0x1667fb);})['catch'](function(_0x3df557){logger['error'](_0xd069('0x18'),_0x3df557[_0xd069('0x16')],_0x286181);_0x141e06(_0x1db98a[_0xd069('0x14')](0x1f4,_0x3df557[_0xd069('0x16')]));});});}; \ No newline at end of file +var _0x142c=['jayson/promise','client','http','redis','defaults','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','code','message','error','result','catch','CreatePlugin','Plugin','body','options','then','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x142c,0x8a));var _0xc142=function(_0x1c6145,_0x410a9d){_0x1c6145=_0x1c6145-0x0;var _0x224655=_0x142c[_0x1c6145];return _0x224655;};'use strict';var _=require(_0xc142('0x0'));var util=require('util');var moment=require(_0xc142('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc142('0x2'));var db=require(_0xc142('0x3'))['db'];var utils=require(_0xc142('0x4'));var logger=require(_0xc142('0x5'))(_0xc142('0x6'));var config=require('../../config/environment');var jayson=require(_0xc142('0x7'));var client=jayson[_0xc142('0x8')][_0xc142('0x9')]({'port':0x232a});config[_0xc142('0xa')]=_[_0xc142('0xb')](config[_0xc142('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc142('0xc'))[_0xc142('0xd')](socket);function respondWithRpcPromise(_0x1e1742,_0x3c515c,_0x2fab10){return new BPromise(function(_0x2214bf,_0x453818){return client['request'](_0x1e1742,_0x2fab10)['then'](function(_0x16b203){logger[_0xc142('0xe')](_0xc142('0xf'),_0x3c515c,'request\x20sent');logger[_0xc142('0x10')](_0xc142('0x11'),_0x3c515c,_0xc142('0x12'),JSON['stringify'](_0x16b203));if(_0x16b203['error']){if(_0x16b203['error'][_0xc142('0x13')]===0x1f4){logger['error'](_0xc142('0xf'),_0x3c515c,_0x16b203['error'][_0xc142('0x14')]);return _0x453818(_0x16b203[_0xc142('0x15')][_0xc142('0x14')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x3c515c,_0x16b203[_0xc142('0x15')][_0xc142('0x14')]);return _0x2214bf(_0x16b203[_0xc142('0x15')][_0xc142('0x14')]);}else{logger[_0xc142('0xe')]('Plugin,\x20%s,\x20%s',_0x3c515c,_0xc142('0x12'));_0x2214bf(_0x16b203[_0xc142('0x16')][_0xc142('0x14')]);}})[_0xc142('0x17')](function(_0x52bb73){logger['error'](_0xc142('0xf'),_0x3c515c,_0x52bb73);_0x453818(_0x52bb73);});});}exports[_0xc142('0x18')]=function(_0x3ff9ce){var _0xfa90b6=this;return new Promise(function(_0x1190cf,_0x5be093){return db[_0xc142('0x19')]['create'](_0x3ff9ce[_0xc142('0x1a')],{'raw':_0x3ff9ce[_0xc142('0x1b')]?_0x3ff9ce[_0xc142('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc142('0x1c')](function(_0x18256d){logger[_0xc142('0xe')](_0xc142('0x18'),_0x3ff9ce);logger[_0xc142('0x10')](_0xc142('0x18'),_0x3ff9ce,JSON['stringify'](_0x18256d));_0x1190cf(_0x18256d);})[_0xc142('0x17')](function(_0x1ca4ae){logger[_0xc142('0x15')](_0xc142('0x18'),_0x1ca4ae[_0xc142('0x14')],_0x3ff9ce);_0x5be093(_0xfa90b6[_0xc142('0x15')](0x1f4,_0x1ca4ae[_0xc142('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ade3c73..5ea68fe 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 _0x9eef=['emit','removeListener','register','plugin:','./plugin.events','save','remove','update'];(function(_0x48799b,_0x75e289){var _0x12a22f=function(_0x29d1ca){while(--_0x29d1ca){_0x48799b['push'](_0x48799b['shift']());}};_0x12a22f(++_0x75e289);}(_0x9eef,0x1f4));var _0xf9ee=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x9eef[_0x4629ed];return _0x52ca04;};'use strict';var PluginEvents=require(_0xf9ee('0x0'));var events=[_0xf9ee('0x1'),_0xf9ee('0x2'),_0xf9ee('0x3')];function createListener(_0x58822e,_0x5a3fd4){return function(_0x14e8f2){_0x5a3fd4[_0xf9ee('0x4')](_0x58822e,_0x14e8f2);};}function removeListener(_0x27db36,_0x346350){return function(){PluginEvents[_0xf9ee('0x5')](_0x27db36,_0x346350);};}exports[_0xf9ee('0x6')]=function(_0x58ecef){for(var _0x1d911f=0x0,_0x1d2b8f=events['length'];_0x1d911f<_0x1d2b8f;_0x1d911f++){var _0x5c75c1=events[_0x1d911f];var _0xf46bb7=createListener(_0xf9ee('0x7')+_0x5c75c1,_0x58ecef);PluginEvents['on'](_0x5c75c1,_0xf46bb7);}}; \ No newline at end of file +var _0x49c0=['update','emit','register','length','./plugin.events'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x49c0,0x16c));var _0x049c=function(_0x18d0e9,_0xa1de3c){_0x18d0e9=_0x18d0e9-0x0;var _0x575c92=_0x49c0[_0x18d0e9];return _0x575c92;};'use strict';var PluginEvents=require(_0x049c('0x0'));var events=['save','remove',_0x049c('0x1')];function createListener(_0x5a69e4,_0x295958){return function(_0x427607){_0x295958[_0x049c('0x2')](_0x5a69e4,_0x427607);};}function removeListener(_0x20d043,_0x34ca2b){return function(){PluginEvents['removeListener'](_0x20d043,_0x34ca2b);};}exports[_0x049c('0x3')]=function(_0x148327){for(var _0x3fc40d=0x0,_0x4a8b09=events[_0x049c('0x4')];_0x3fc40d<_0x4a8b09;_0x3fc40d++){var _0x265126=events[_0x3fc40d];var _0x41db6b=createListener('plugin:'+_0x265126,_0x148327);PluginEvents['on'](_0x265126,_0x41db6b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cca0188..935cc45 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(_0x4dcb03,_0x40c348){var _0x36d490=function(_0x26f9b2){while(--_0x26f9b2){_0x4dcb03['push'](_0x4dcb03['shift']());}};_0x36d490(++_0x40c348);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x4eb89f,_0x55ec89){var _0x7f0d8e=function(_0x502e2e){while(--_0x502e2e){_0x4eb89f['push'](_0x4eb89f['shift']());}};_0x7f0d8e(++_0x55ec89);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 7156ce0..b8d09c7 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 _0xb9a7=['name','npm\x20install','info','error','index','list','reject','express','motion2','length','catch','describe','params','then','create','body','../../files/plugins','script','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','child_process','bluebird','sendStatus','status','json'];(function(_0x30e41d,_0x141592){var _0xa6c0e3=function(_0xbfa7c){while(--_0xbfa7c){_0x30e41d['push'](_0x30e41d['shift']());}};_0xa6c0e3(++_0x141592);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb9a7[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var pm2=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x7b9a('0x1'))['exec'];var BPromise=require(_0x7b9a('0x2'));function handleEntityNotFound(_0x40ef7d,_0x37b25b){return function(_0x24cae3){if(!_0x24cae3){_0x40ef7d[_0x7b9a('0x3')](0x194);;}return _0x24cae3;};}function respondWithResult(_0xf6dae2,_0x22764f){_0x22764f=_0x22764f||0xc8;return function(_0x7019fd){if(_0x7019fd){return _0xf6dae2[_0x7b9a('0x4')](_0x22764f)[_0x7b9a('0x5')](_0x7019fd);}return null;};}function handleError(_0x4d3f20,_0x43d8e2){_0x43d8e2=_0x43d8e2||0x1f4;return function(_0x3e84f1){logger['error'](_0x3e84f1['stack']);if(_0x3e84f1['name']){delete _0x3e84f1[_0x7b9a('0x6')];}_0x4d3f20[_0x7b9a('0x4')](_0x43d8e2)['send'](_0x3e84f1);};}function execChildProcess(){return new BPromise(function(_0x32c85d,_0x5b13f3){exec(_0x7b9a('0x7'),function(_0x597732,_0x3af176,_0x1584a2){logger[_0x7b9a('0x8')](_0x3af176);logger['info'](_0x1584a2);if(_0x597732){logger[_0x7b9a('0x9')](_0x597732);return _0x5b13f3(_0x597732);}return _0x32c85d(_0x3af176);});});}exports[_0x7b9a('0xa')]=function(_0x5e3875,_0x67553c){return pm2[_0x7b9a('0xb')]()['then'](function(_0xb157e5){if(_0xb157e5){var _0xde180d=_[_0x7b9a('0xc')](_0xb157e5,function(_0x2853f2){return _0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xd')||_0x2853f2[_0x7b9a('0x6')]===_0x7b9a('0xe');});return{'rows':_0xde180d,'count':_0xde180d[_0x7b9a('0xf')]};}return null;})['then'](respondWithResult(_0x67553c,null))[_0x7b9a('0x10')](handleError(_0x67553c,null));};exports['show']=function(_0x123921,_0xa217cb){return pm2[_0x7b9a('0x11')](_0x123921[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](respondWithResult(_0xa217cb,null))[_0x7b9a('0x13')](handleEntityNotFound(_0xa217cb,null))[_0x7b9a('0x10')](handleError(_0xa217cb,null));};exports[_0x7b9a('0x14')]=function(_0x2064a0,_0x588c48){if(_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')]&&_0x2064a0[_0x7b9a('0x15')]['script']){var _0x993048=path['join'](__dirname,_0x7b9a('0x16'),_0x2064a0['body'][_0x7b9a('0x17')]);var _0x331ae6=process[_0x7b9a('0x18')]();process['chdir'](path[_0x7b9a('0x19')](_0x993048));return execChildProcess()[_0x7b9a('0x13')](function(_0x5705b2){process[_0x7b9a('0x1a')](_0x331ae6);return pm2[_0x7b9a('0x1b')]({'name':_0x2064a0[_0x7b9a('0x15')][_0x7b9a('0x6')],'script':_0x993048});})[_0x7b9a('0x13')](function(_0x5b2f52){pm2[_0x7b9a('0x1c')]();return _0x5b2f52[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x588c48,0xc9))['catch'](handleError(_0x588c48,null));}else{return _0x588c48[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x1d')});}};exports[_0x7b9a('0x1e')]=function(_0x4c2271,_0x55d01c){if(_0x4c2271[_0x7b9a('0x15')]['id']){delete _0x4c2271['body']['id'];}var _0x54df8a={'online':_0x7b9a('0x1f'),'stopped':'stop'};if(_0x54df8a['hasOwnProperty'](_0x4c2271[_0x7b9a('0x15')]['status'])){return pm2[_0x54df8a[_0x4c2271[_0x7b9a('0x15')][_0x7b9a('0x4')]]](_0x4c2271['params']['id'])[_0x7b9a('0x13')](respondWithResult(_0x55d01c,0xc8))[_0x7b9a('0x10')](handleError(_0x55d01c,null));}else{return _0x55d01c[_0x7b9a('0x4')](0x1f4)['send']({'message':_0x7b9a('0x20')});}};exports[_0x7b9a('0x21')]=function(_0x181e9c,_0x6c8b1f){if(_0x181e9c[_0x7b9a('0x15')]['id']){delete _0x181e9c[_0x7b9a('0x15')]['id'];}if(_0x181e9c['params']['id']){return pm2['delete'](_0x181e9c[_0x7b9a('0x12')]['id'])[_0x7b9a('0x13')](function(_0x6daf3c){pm2['dump']();return _0x6daf3c[0x0];})[_0x7b9a('0x13')](respondWithResult(_0x6c8b1f,null))[_0x7b9a('0x10')](handleError(_0x6c8b1f,null));}else{return _0x6c8b1f['status'](0x1f4)['send']({'message':_0x7b9a('0x22')});}}; \ No newline at end of file +var _0xa902=['then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','update','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','list','reject','express','motion2','length'];(function(_0x407bd6,_0x2ab0cd){var _0x181443=function(_0x260b5a){while(--_0x260b5a){_0x407bd6['push'](_0x407bd6['shift']());}};_0x181443(++_0x2ab0cd);}(_0xa902,0x8d));var _0x2a90=function(_0x4682ab,_0x47fc76){_0x4682ab=_0x4682ab-0x0;var _0x1043ac=_0xa902[_0x4682ab];return _0x1043ac;};'use strict';var _=require(_0x2a90('0x0'));var pm2=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var path=require(_0x2a90('0x4'));var exec=require('child_process')[_0x2a90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4961c2,_0x169808){return function(_0x2b40c0){if(!_0x2b40c0){_0x4961c2[_0x2a90('0x6')](0x194);;}return _0x2b40c0;};}function respondWithResult(_0x21e1d2,_0x4a32c7){_0x4a32c7=_0x4a32c7||0xc8;return function(_0x25bcfc){if(_0x25bcfc){return _0x21e1d2['status'](_0x4a32c7)[_0x2a90('0x7')](_0x25bcfc);}return null;};}function handleError(_0x570659,_0x5ec2b9){_0x5ec2b9=_0x5ec2b9||0x1f4;return function(_0xc75b6e){logger[_0x2a90('0x8')](_0xc75b6e[_0x2a90('0x9')]);if(_0xc75b6e[_0x2a90('0xa')]){delete _0xc75b6e[_0x2a90('0xa')];}_0x570659['status'](_0x5ec2b9)[_0x2a90('0xb')](_0xc75b6e);};}function execChildProcess(){return new BPromise(function(_0x3dadc2,_0x43c56d){exec(_0x2a90('0xc'),function(_0x541e22,_0x40e6aa,_0x52391c){logger[_0x2a90('0xd')](_0x40e6aa);logger['info'](_0x52391c);if(_0x541e22){logger[_0x2a90('0x8')](_0x541e22);return _0x43c56d(_0x541e22);}return _0x3dadc2(_0x40e6aa);});});}exports['index']=function(_0x407ce5,_0x30e166){return pm2[_0x2a90('0xe')]()['then'](function(_0x56d1b8){if(_0x56d1b8){var _0x57227c=_[_0x2a90('0xf')](_0x56d1b8,function(_0x3a42df){return _0x3a42df['name']===_0x2a90('0x10')||_0x3a42df[_0x2a90('0xa')]===_0x2a90('0x11');});return{'rows':_0x57227c,'count':_0x57227c[_0x2a90('0x12')]};}return null;})[_0x2a90('0x13')](respondWithResult(_0x30e166,null))[_0x2a90('0x14')](handleError(_0x30e166,null));};exports[_0x2a90('0x15')]=function(_0x10cf94,_0x43eea5){return pm2['describe'](_0x10cf94[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](respondWithResult(_0x43eea5,null))[_0x2a90('0x13')](handleEntityNotFound(_0x43eea5,null))['catch'](handleError(_0x43eea5,null));};exports[_0x2a90('0x17')]=function(_0x1f51a6,_0x148d18){if(_0x1f51a6[_0x2a90('0x18')][_0x2a90('0xa')]&&_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]){var _0x114d42=path[_0x2a90('0x1a')](__dirname,_0x2a90('0x1b'),_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]);var _0x4fdd62=process[_0x2a90('0x1c')]();process[_0x2a90('0x1d')](path[_0x2a90('0x1e')](_0x114d42));return execChildProcess()[_0x2a90('0x13')](function(_0x5912fd){process[_0x2a90('0x1d')](_0x4fdd62);return pm2[_0x2a90('0x1f')]({'name':_0x1f51a6['body'][_0x2a90('0xa')],'script':_0x114d42});})[_0x2a90('0x13')](function(_0x10a6dd){pm2[_0x2a90('0x20')]();return _0x10a6dd[0x0];})[_0x2a90('0x13')](respondWithResult(_0x148d18,0xc9))[_0x2a90('0x14')](handleError(_0x148d18,null));}else{return _0x148d18[_0x2a90('0x21')](0x1f4)[_0x2a90('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a90('0x22')]=function(_0x17f978,_0x3934d4){if(_0x17f978[_0x2a90('0x18')]['id']){delete _0x17f978[_0x2a90('0x18')]['id'];}var _0x5208d8={'online':'restart','stopped':_0x2a90('0x23')};if(_0x5208d8['hasOwnProperty'](_0x17f978['body']['status'])){return pm2[_0x5208d8[_0x17f978[_0x2a90('0x18')][_0x2a90('0x21')]]](_0x17f978['params']['id'])['then'](respondWithResult(_0x3934d4,0xc8))[_0x2a90('0x14')](handleError(_0x3934d4,null));}else{return _0x3934d4['status'](0x1f4)[_0x2a90('0xb')]({'message':_0x2a90('0x24')});}};exports[_0x2a90('0x25')]=function(_0x27b6b6,_0xf18d11){if(_0x27b6b6[_0x2a90('0x18')]['id']){delete _0x27b6b6[_0x2a90('0x18')]['id'];}if(_0x27b6b6['params']['id']){return pm2[_0x2a90('0x26')](_0x27b6b6[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](function(_0x5cdeb4){pm2[_0x2a90('0x20')]();return _0x5cdeb4[0x0];})[_0x2a90('0x13')](respondWithResult(_0xf18d11,null))[_0x2a90('0x14')](handleError(_0xf18d11,null));}else{return _0xf18d11[_0x2a90('0x21')](0x1f4)['send']({'message':_0x2a90('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 5c8e37c..37e62e6 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 _0xb837=['/queues','getQueues','exports','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xb837,0x7b));var _0x7b83=function(_0x494ce2,_0x397591){_0x494ce2=_0x494ce2-0x0;var _0x52ec77=_0xb837[_0x494ce2];return _0x52ec77;};'use strict';var express=require(_0x7b83('0x0'));var router=express[_0x7b83('0x1')]();var auth=require(_0x7b83('0x2'));var controller=require('./realtime.controller');router[_0x7b83('0x3')](_0x7b83('0x4'),auth[_0x7b83('0x5')](),controller[_0x7b83('0x6')]);router[_0x7b83('0x3')](_0x7b83('0x7'),auth['isAuthenticated'](),controller[_0x7b83('0x8')]);module[_0x7b83('0x9')]=router; \ No newline at end of file +var _0x70ff=['exports','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents','/queues','getQueues'];(function(_0x8e7915,_0x4fb7ac){var _0x40322d=function(_0xac95e4){while(--_0xac95e4){_0x8e7915['push'](_0x8e7915['shift']());}};_0x40322d(++_0x4fb7ac);}(_0x70ff,0x1ba));var _0xf70f=function(_0x416d75,_0x2c8e81){_0x416d75=_0x416d75-0x0;var _0x10af66=_0x70ff[_0x416d75];return _0x10af66;};'use strict';var express=require('express');var router=express[_0xf70f('0x0')]();var auth=require(_0xf70f('0x1'));var controller=require(_0xf70f('0x2'));router[_0xf70f('0x3')]('/agents',auth[_0xf70f('0x4')](),controller[_0xf70f('0x5')]);router[_0xf70f('0x3')](_0xf70f('0x6'),auth[_0xf70f('0x4')](),controller[_0xf70f('0x7')]);module[_0xf70f('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 4e26504..d8f7f1c 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 _0xfd04=['length','map','rawAttributes','fieldName','type','key','online','raw','push','forEach','Pause','merge','where','user','userProfileId','Agents','agent','extraQueryConditions','assign','UserProfile','User','findAndCountAll','getAgentStatus','pause','Status','sortAgentsByStatus','split','catch','getQueues','resolve','format','startCase','name','outbound','dialActive','dialMethod','getOptions','role','voice','filter','getResources','initializeQueues','lodash','../../components/realtime/queues','../../components/parsers/qs','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','then','isValidChannel','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus'];(function(_0x5e62aa,_0x48b6c4){var _0x48724d=function(_0xb2062c){while(--_0xb2062c){_0x5e62aa['push'](_0x5e62aa['shift']());}};_0x48724d(++_0x48b6c4);}(_0xfd04,0x114));var _0x4fd0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfd04[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4fd0('0x0'));var util=require('util');var rta=require('../../components/realtime/agents');var rtq=require(_0x4fd0('0x1'));var qs=require(_0x4fd0('0x2'));var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x4fd0('0x3'))[_0x4fd0('0x4')];var APIHandleError=require(_0x4fd0('0x3'))['handleError'];function respondWithFilteredResult(_0x38b9ff,_0x55e29a){return function(_0x1bfef0){if(_0x1bfef0){var _0x4d578c=typeof _0x55e29a[_0x4fd0('0x5')]===_0x4fd0('0x6')&&typeof _0x55e29a[_0x4fd0('0x7')]===_0x4fd0('0x6');var _0xa4c49a=_0x1bfef0[_0x4fd0('0x8')];var _0x3b2851=_0x4d578c?0x0:_0x55e29a['offset'];var _0x567418=_0x4d578c?_0x1bfef0['count']:_0x55e29a[_0x4fd0('0x5')]+_0x55e29a[_0x4fd0('0x7')];var _0x3beae0;if(_0x567418>=_0xa4c49a){_0x567418=_0xa4c49a;_0x3beae0=0xc8;}else{_0x3beae0=0xce;}_0x38b9ff[_0x4fd0('0x9')](_0x3beae0);return _0x38b9ff[_0x4fd0('0xa')](_0x4fd0('0xb'),_0x3b2851+'-'+_0x567418+'/'+_0xa4c49a)[_0x4fd0('0xc')](_0x1bfef0);}return null;};}exports[_0x4fd0('0xd')]=function(_0x297c92,_0x1a6f58){var _0x54eac7={'count':0x0,'rows':[]};var _0x3b6b80={};var _0x53d2d1;var _0x24e134=utils[_0x4fd0('0xe')]();var _0x46c3e5;var _0x29a756;var _0x45daa3=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x10')];var _0x2b02f4=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x11')];var _0x317a1c=_0x297c92['query'][_0x4fd0('0x12')];var _0x5599de=_0x2b02f4==='pause'||_0x2b02f4===_0x4fd0('0x13')?!![]:![];var _0xdcec0e=[];var _0x487318;var _0x5ec0f3;Promise['resolve']()[_0x4fd0('0x14')](function(){if(_0x297c92[_0x4fd0('0xf')]['channel']){if(!utils[_0x4fd0('0x15')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')]));}_0x53d2d1=_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x16')][_0x4fd0('0x17')]();}if(!_0x297c92['query'][_0x4fd0('0x18')]||!_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')][_0x4fd0('0x19')](_0x4fd0('0x1a'))){_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]=rta[_0x4fd0('0x1b')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]);return;}var _0xa9b755=rta[_0x4fd0('0x1c')](_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]);_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x18')]=_0xa9b755[_0x4fd0('0x1d')][_0x4fd0('0x1e')](',');_0x487318=_0xa9b755[_0x4fd0('0x1f')];})[_0x4fd0('0x14')](function(){if(!_0x45daa3){return[];}return rta[_0x4fd0('0x20')](_0x45daa3,_0x53d2d1);})[_0x4fd0('0x14')](function(_0x24be6e){_0xdcec0e=_0x24be6e;return rta[_0x4fd0('0x21')]();})[_0x4fd0('0x14')](function(_0x59b7a1){_0x29a756=_0x59b7a1[_0x4fd0('0x22')];if((!_0x2b02f4||_0x5599de)&&!_0x487318){return _0xdcec0e;}if(_0x487318&&!_0x2b02f4){return rta[_0x4fd0('0x23')](_0x29a756,_0xdcec0e,_0x487318);}else{return rta['getAgentIdsByStatus'](_0x29a756,_0xdcec0e,_0x2b02f4);}})[_0x4fd0('0x14')](function(_0x59d053){_0xdcec0e=_0x59d053;var _0x2cf8e4=![];if(_0xdcec0e[_0x4fd0('0x24')]===0x0){if(_0x45daa3||_0x2b02f4){_0x2cf8e4=!![];}if(_0x5599de){_0x2cf8e4=![];}}if(_0x2cf8e4){return _0x54eac7;}var _0x2239a0=_[_0x4fd0('0x25')](db['User'][_0x4fd0('0x26')],function(_0x37a09f){return{'name':_0x37a09f[_0x4fd0('0x27')],'type':_0x37a09f[_0x4fd0('0x28')][_0x4fd0('0x29')]};});_0x297c92['query']['role']='agent';_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x2a')]=!![];_0x3b6b80=qs['getOptions'](_0x2239a0,_0x297c92);_0x3b6b80[_0x4fd0('0x2b')]=!![];var _0x5b2283=[];if(_0xdcec0e[_0x4fd0('0x24')]>0x0){_0x5b2283[_0x4fd0('0x2c')]({'id':{'$in':_0xdcec0e}});if(_0x487318&&!_0x2b02f4){_0x5ec0f3=[db['sequelize']['literal']('FIELD(id,'+_0xdcec0e+')')];_0x3b6b80['order']=_0x5ec0f3;}}if(_0x5599de){_0x24e134[_0x4fd0('0x2d')](function(_0x33f619){var _0x4fc085=!![];if(_0x2b02f4===_0x4fd0('0x13')&&_0x53d2d1!==_0x33f619){_0x4fc085=![];}_0x5b2283[_0x4fd0('0x2c')]({[_0x33f619+_0x4fd0('0x2e')]:_0x4fc085});});if(_0x317a1c){_0x5b2283[_0x4fd0('0x2c')]({'pauseType':_0x317a1c});}}else if(_0x2b02f4){_0x24e134['forEach'](function(_0x28475c){_0x5b2283[_0x4fd0('0x2c')]({[_0x28475c+'Pause']:![]});});}_0x3b6b80['where']=_[_0x4fd0('0x2f')](_0x3b6b80[_0x4fd0('0x30')],{'$and':_0x5b2283});if(_0x297c92[_0x4fd0('0x31')]['role']===_0x4fd0('0x31')){var _0x53152e={'params':{'id':_0x297c92[_0x4fd0('0x31')][_0x4fd0('0x32')]},'query':{'section':_0x4fd0('0x33'),'role':_0x4fd0('0x34'),'online':!![],'raw':!![],'ids':_0xdcec0e,'customSorting':_0x5ec0f3}};if(_0x5599de){_0x53152e['query'][_0x4fd0('0x35')]=_0x5b2283;}_0x53152e[_0x4fd0('0xf')]=Object[_0x4fd0('0x36')](_0x53152e[_0x4fd0('0xf')],_0x297c92[_0x4fd0('0xf')]);delete _0x53152e[_0x4fd0('0xf')]['id'];return db[_0x4fd0('0x37')]['getResources'](_0x53152e);}return db[_0x4fd0('0x38')][_0x4fd0('0x39')](_0x3b6b80);})[_0x4fd0('0x14')](function(_0x492678){_0x54eac7[_0x4fd0('0x8')]=_0x492678[_0x4fd0('0x8')];_0x46c3e5=_0x492678[_0x4fd0('0x22')];return _0x46c3e5[_0x4fd0('0x25')](function(_0x428b04){var _0x845fe3=_['find'](_0x29a756,['id',_0x428b04['id']]);if(_0x845fe3){var _0x397f7b=rta['filterAgentAttributes'](_0x845fe3);_[_0x4fd0('0x2f')](_0x428b04,_0x397f7b);}_0x428b04[_0x4fd0('0x1a')]=rta[_0x4fd0('0x3a')](_0x428b04);if(_0x428b04[_0x4fd0('0x1a')][_0x4fd0('0x19')](_0x4fd0('0x3b'))){_0x24e134['forEach'](function(_0x241bce){if(_0x428b04[_0x241bce+_0x4fd0('0x2e')]){_0x428b04[_0x241bce+_0x4fd0('0x3c')]=_0x4fd0('0x3b');}});}return _0x428b04;});})[_0x4fd0('0x14')](function(_0x41008f){if(!_0x487318||_0x5ec0f3){return _0x41008f;}return rta[_0x4fd0('0x3d')](_0x41008f,_0x487318);})['then'](function(_0x11930b){var _0x68671c=null;if(_0x297c92[_0x4fd0('0xf')][_0x4fd0('0x1d')]){var _0x4812a1=_0x297c92['query'][_0x4fd0('0x1d')][_0x4fd0('0x3e')](',');_0x68671c=_0x11930b['map'](function(_0x125280){return _['pick'](_0x125280,_0x4812a1);});}_0x54eac7['rows']=_0x68671c||_0x11930b;return _0x54eac7;})[_0x4fd0('0x14')](respondWithFilteredResult(_0x1a6f58,_0x3b6b80))[_0x4fd0('0x3f')](APIHandleError(_0x1a6f58));};exports[_0x4fd0('0x40')]=function(_0x426287,_0x3d4e74){var _0x55ce14={'count':0x0,'rows':[]};var _0x10ed99={};var _0x1132b4;var _0x16ada0;var _0x4e33b6;Promise[_0x4fd0('0x41')]()[_0x4fd0('0x14')](function(){if(_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')]){if(!utils[_0x4fd0('0x15')](_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')])){throw new APIBadRequestError(util[_0x4fd0('0x42')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x426287[_0x4fd0('0xf')][_0x4fd0('0x16')]));}_0x1132b4=_0x426287['query'][_0x4fd0('0x16')][_0x4fd0('0x17')]();}var _0x291367=_[_0x4fd0('0x43')](_0x1132b4)+'Queue';var _0x443abb=_['map'](db[_0x291367][_0x4fd0('0x26')],function(_0x46b8f8){return{'name':_0x46b8f8[_0x4fd0('0x27')],'type':_0x46b8f8[_0x4fd0('0x28')][_0x4fd0('0x29')]};});if(!_0x426287[_0x4fd0('0xf')][_0x4fd0('0x1d')]){var _0xe4fd71=['id',_0x4fd0('0x44')];if(_0x1132b4==='voice'){_0xe4fd71['push'](_0x4fd0('0x28'));if(_0x426287[_0x4fd0('0xf')][_0x4fd0('0x28')]===_0x4fd0('0x45')){_0xe4fd71[_0x4fd0('0x2c')]([_0x4fd0('0x46'),_0x4fd0('0x47')]);}}_0x426287['query']['fields']=_0xe4fd71[_0x4fd0('0x1e')](',');}_0x10ed99=qs[_0x4fd0('0x48')](_0x443abb,_0x426287);if(_0x426287[_0x4fd0('0x31')][_0x4fd0('0x49')]==='user'){var _0x3dfe0a={'params':{'id':_0x426287[_0x4fd0('0x31')]['userProfileId']},'query':{'section':_0x1132b4===_0x4fd0('0x4a')&&_0x426287['query'][_0x4fd0('0x28')]===_0x4fd0('0x45')?'QueueCampaigns':_[_0x4fd0('0x43')](_0x1132b4)+'Queues','type':_0x426287[_0x4fd0('0xf')][_0x4fd0('0x28')],'nolimit':!![],'sort':_0x4fd0('0x44'),'filter':_0x426287[_0x4fd0('0xf')][_0x4fd0('0x4b')]}};return db[_0x4fd0('0x37')][_0x4fd0('0x4c')](_0x3dfe0a);}return db[_0x291367]['findAndCountAll'](_0x10ed99);})[_0x4fd0('0x14')](function(_0x488427){_0x55ce14[_0x4fd0('0x8')]=_0x488427[_0x4fd0('0x8')];_0x16ada0=_0x488427[_0x4fd0('0x22')];return rtq['getRealtimeQueues'](_0x426287,_0x1132b4);})['then'](function(_0x4d8131){_0x4e33b6=_0x4d8131[_0x4fd0('0x22')];return rtq[_0x4fd0('0x4d')](_0x16ada0,_0x4e33b6,_0x1132b4,_0x426287[_0x4fd0('0xf')]['type']);})[_0x4fd0('0x14')](function(_0x317278){_0x55ce14[_0x4fd0('0x22')]=_0x317278;return _0x55ce14;})[_0x4fd0('0x14')](respondWithFilteredResult(_0x3d4e74,_0x10ed99))[_0x4fd0('0x3f')](APIHandleError(_0x3d4e74));}; \ No newline at end of file +var _0x409f=['../../mysqldb','APIBadRequestError','../../errors/api','handleError','offset','limit','undefined','count','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','online','raw','sequelize','literal','FIELD(id,','forEach','push','Pause','merge','where','user','userProfileId','Agents','extraQueryConditions','UserProfile','getResources','filterAgentAttributes','getAgentStatus','Status','sortAgentsByStatus','split','pick','catch','getQueues','name','voice','outbound','dialActive','dialMethod','getOptions','QueueCampaigns','startCase','Queues','filter','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils'];(function(_0x2e8660,_0x21b463){var _0x2b574e=function(_0x366a02){while(--_0x366a02){_0x2e8660['push'](_0x2e8660['shift']());}};_0x2b574e(++_0x21b463);}(_0x409f,0x1b7));var _0xf409=function(_0x19d74c,_0x1a1a32){_0x19d74c=_0x19d74c-0x0;var _0x1f33d1=_0x409f[_0x19d74c];return _0x1f33d1;};'use strict';var _=require(_0xf409('0x0'));var util=require(_0xf409('0x1'));var rta=require(_0xf409('0x2'));var rtq=require(_0xf409('0x3'));var qs=require(_0xf409('0x4'));var utils=require(_0xf409('0x5'));var db=require(_0xf409('0x6'))['db'];var APIBadRequestError=require('../../errors/api')[_0xf409('0x7')];var APIHandleError=require(_0xf409('0x8'))[_0xf409('0x9')];function respondWithFilteredResult(_0x442226,_0x4a260c){return function(_0x2b3842){if(_0x2b3842){var _0x69add9=typeof _0x4a260c[_0xf409('0xa')]==='undefined'&&typeof _0x4a260c[_0xf409('0xb')]===_0xf409('0xc');var _0x93302a=_0x2b3842[_0xf409('0xd')];var _0x525d5a=_0x69add9?0x0:_0x4a260c[_0xf409('0xa')];var _0x161215=_0x69add9?_0x2b3842[_0xf409('0xd')]:_0x4a260c[_0xf409('0xa')]+_0x4a260c['limit'];var _0x2aa152;if(_0x161215>=_0x93302a){_0x161215=_0x93302a;_0x2aa152=0xc8;}else{_0x2aa152=0xce;}_0x442226['status'](_0x2aa152);return _0x442226[_0xf409('0xe')](_0xf409('0xf'),_0x525d5a+'-'+_0x161215+'/'+_0x93302a)[_0xf409('0x10')](_0x2b3842);}return null;};}exports[_0xf409('0x11')]=function(_0x31779d,_0x74a45f){var _0x1d74a7={'count':0x0,'rows':[]};var _0x37bb62={};var _0x1881b1;var _0x24c7ab=utils[_0xf409('0x12')]();var _0x2a0683;var _0x3bc691;var _0x5782a4=_0x31779d['query'][_0xf409('0x13')];var _0x35e1f4=_0x31779d[_0xf409('0x14')][_0xf409('0x15')];var _0x28f99b=_0x31779d[_0xf409('0x14')][_0xf409('0x16')];var _0x44288e=_0x35e1f4===_0xf409('0x17')||_0x35e1f4===_0xf409('0x18')?!![]:![];var _0x63a8a6=[];var _0x1e8cc3;var _0x2adfb0;Promise[_0xf409('0x19')]()[_0xf409('0x1a')](function(){if(_0x31779d[_0xf409('0x14')][_0xf409('0x1b')]){if(!utils[_0xf409('0x1c')](_0x31779d[_0xf409('0x14')][_0xf409('0x1b')])){throw new APIBadRequestError(util[_0xf409('0x1d')](_0xf409('0x1e'),_0x31779d[_0xf409('0x14')][_0xf409('0x1b')]));}_0x1881b1=_0x31779d[_0xf409('0x14')][_0xf409('0x1b')][_0xf409('0x1f')]();}if(!_0x31779d[_0xf409('0x14')][_0xf409('0x20')]||!_0x31779d[_0xf409('0x14')][_0xf409('0x20')][_0xf409('0x21')](_0xf409('0x22'))){_0x31779d[_0xf409('0x14')]['sort']=rta[_0xf409('0x23')](_0x31779d[_0xf409('0x14')][_0xf409('0x20')]);return;}var _0x4c01d2=rta[_0xf409('0x24')](_0x31779d[_0xf409('0x14')][_0xf409('0x20')]);_0x31779d[_0xf409('0x14')]['sort']=_0x4c01d2[_0xf409('0x25')][_0xf409('0x26')](',');_0x1e8cc3=_0x4c01d2[_0xf409('0x27')];})[_0xf409('0x1a')](function(){if(!_0x5782a4){return[];}return rta['getAgentIdsByQueues'](_0x5782a4,_0x1881b1);})['then'](function(_0x364180){_0x63a8a6=_0x364180;return rta[_0xf409('0x28')]();})[_0xf409('0x1a')](function(_0x5c6429){_0x3bc691=_0x5c6429[_0xf409('0x29')];if((!_0x35e1f4||_0x44288e)&&!_0x1e8cc3){return _0x63a8a6;}if(_0x1e8cc3&&!_0x35e1f4){return rta[_0xf409('0x2a')](_0x3bc691,_0x63a8a6,_0x1e8cc3);}else{return rta[_0xf409('0x2b')](_0x3bc691,_0x63a8a6,_0x35e1f4);}})['then'](function(_0x73a932){_0x63a8a6=_0x73a932;var _0x4c314a=![];if(_0x63a8a6[_0xf409('0x2c')]===0x0){if(_0x5782a4||_0x35e1f4){_0x4c314a=!![];}if(_0x44288e){_0x4c314a=![];}}if(_0x4c314a){return _0x1d74a7;}var _0x273d73=_[_0xf409('0x2d')](db[_0xf409('0x2e')]['rawAttributes'],function(_0x25385f){return{'name':_0x25385f[_0xf409('0x2f')],'type':_0x25385f[_0xf409('0x30')][_0xf409('0x31')]};});_0x31779d[_0xf409('0x14')][_0xf409('0x32')]=_0xf409('0x33');_0x31779d[_0xf409('0x14')][_0xf409('0x34')]=!![];_0x37bb62=qs['getOptions'](_0x273d73,_0x31779d);_0x37bb62[_0xf409('0x35')]=!![];var _0x1d909c=[];if(_0x63a8a6['length']>0x0){_0x1d909c['push']({'id':{'$in':_0x63a8a6}});if(_0x1e8cc3&&!_0x35e1f4){_0x2adfb0=[db[_0xf409('0x36')][_0xf409('0x37')](_0xf409('0x38')+_0x63a8a6+')')];_0x37bb62[_0xf409('0x27')]=_0x2adfb0;}}if(_0x44288e){_0x24c7ab[_0xf409('0x39')](function(_0x5222e8){var _0xdb9d6d=!![];if(_0x35e1f4===_0xf409('0x18')&&_0x1881b1!==_0x5222e8){_0xdb9d6d=![];}_0x1d909c[_0xf409('0x3a')]({[_0x5222e8+'Pause']:_0xdb9d6d});});if(_0x28f99b){_0x1d909c['push']({'pauseType':_0x28f99b});}}else if(_0x35e1f4){_0x24c7ab[_0xf409('0x39')](function(_0x2d4edf){_0x1d909c[_0xf409('0x3a')]({[_0x2d4edf+_0xf409('0x3b')]:![]});});}_0x37bb62['where']=_[_0xf409('0x3c')](_0x37bb62[_0xf409('0x3d')],{'$and':_0x1d909c});if(_0x31779d[_0xf409('0x3e')]['role']===_0xf409('0x3e')){var _0x525b8b={'params':{'id':_0x31779d[_0xf409('0x3e')][_0xf409('0x3f')]},'query':{'section':_0xf409('0x40'),'role':_0xf409('0x33'),'online':!![],'raw':!![],'ids':_0x63a8a6,'customSorting':_0x2adfb0}};if(_0x44288e){_0x525b8b[_0xf409('0x14')][_0xf409('0x41')]=_0x1d909c;}_0x525b8b['query']=Object['assign'](_0x525b8b[_0xf409('0x14')],_0x31779d['query']);delete _0x525b8b[_0xf409('0x14')]['id'];return db[_0xf409('0x42')][_0xf409('0x43')](_0x525b8b);}return db[_0xf409('0x2e')]['findAndCountAll'](_0x37bb62);})['then'](function(_0x547752){_0x1d74a7[_0xf409('0xd')]=_0x547752[_0xf409('0xd')];_0x2a0683=_0x547752[_0xf409('0x29')];return _0x2a0683[_0xf409('0x2d')](function(_0x29272f){var _0x2f07f2=_['find'](_0x3bc691,['id',_0x29272f['id']]);if(_0x2f07f2){var _0x2f9fd3=rta[_0xf409('0x44')](_0x2f07f2);_['merge'](_0x29272f,_0x2f9fd3);}_0x29272f[_0xf409('0x22')]=rta[_0xf409('0x45')](_0x29272f);if(_0x29272f['globalStatus'][_0xf409('0x21')](_0xf409('0x17'))){_0x24c7ab[_0xf409('0x39')](function(_0x3642d4){if(_0x29272f[_0x3642d4+_0xf409('0x3b')]){_0x29272f[_0x3642d4+_0xf409('0x46')]=_0xf409('0x17');}});}return _0x29272f;});})[_0xf409('0x1a')](function(_0x326895){if(!_0x1e8cc3||_0x2adfb0){return _0x326895;}return rta[_0xf409('0x47')](_0x326895,_0x1e8cc3);})[_0xf409('0x1a')](function(_0x256946){var _0x5537e4=null;if(_0x31779d['query'][_0xf409('0x25')]){var _0x119ee1=_0x31779d[_0xf409('0x14')][_0xf409('0x25')][_0xf409('0x48')](',');_0x5537e4=_0x256946[_0xf409('0x2d')](function(_0x53a221){return _[_0xf409('0x49')](_0x53a221,_0x119ee1);});}_0x1d74a7[_0xf409('0x29')]=_0x5537e4||_0x256946;return _0x1d74a7;})[_0xf409('0x1a')](respondWithFilteredResult(_0x74a45f,_0x37bb62))[_0xf409('0x4a')](APIHandleError(_0x74a45f));};exports[_0xf409('0x4b')]=function(_0x3bf2e6,_0x59f51d){var _0x3519b8={'count':0x0,'rows':[]};var _0x46fa9b={};var _0x3ad40b;var _0x3aef9a;var _0x24fc69;Promise[_0xf409('0x19')]()[_0xf409('0x1a')](function(){if(_0x3bf2e6[_0xf409('0x14')][_0xf409('0x1b')]){if(!utils[_0xf409('0x1c')](_0x3bf2e6[_0xf409('0x14')][_0xf409('0x1b')])){throw new APIBadRequestError(util[_0xf409('0x1d')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3bf2e6[_0xf409('0x14')]['channel']));}_0x3ad40b=_0x3bf2e6[_0xf409('0x14')]['channel'][_0xf409('0x1f')]();}var _0x443cd4=_['startCase'](_0x3ad40b)+'Queue';var _0x32a13f=_[_0xf409('0x2d')](db[_0x443cd4]['rawAttributes'],function(_0x4ab4e8){return{'name':_0x4ab4e8[_0xf409('0x2f')],'type':_0x4ab4e8[_0xf409('0x30')][_0xf409('0x31')]};});if(!_0x3bf2e6[_0xf409('0x14')][_0xf409('0x25')]){var _0x37bed2=['id',_0xf409('0x4c')];if(_0x3ad40b===_0xf409('0x4d')){_0x37bed2[_0xf409('0x3a')]('type');if(_0x3bf2e6[_0xf409('0x14')][_0xf409('0x30')]===_0xf409('0x4e')){_0x37bed2[_0xf409('0x3a')]([_0xf409('0x4f'),_0xf409('0x50')]);}}_0x3bf2e6['query']['fields']=_0x37bed2[_0xf409('0x26')](',');}_0x46fa9b=qs[_0xf409('0x51')](_0x32a13f,_0x3bf2e6);if(_0x3bf2e6[_0xf409('0x3e')][_0xf409('0x32')]===_0xf409('0x3e')){var _0xb22054={'params':{'id':_0x3bf2e6[_0xf409('0x3e')]['userProfileId']},'query':{'section':_0x3ad40b==='voice'&&_0x3bf2e6[_0xf409('0x14')][_0xf409('0x30')]===_0xf409('0x4e')?_0xf409('0x52'):_[_0xf409('0x53')](_0x3ad40b)+_0xf409('0x54'),'type':_0x3bf2e6[_0xf409('0x14')][_0xf409('0x30')],'nolimit':!![],'sort':_0xf409('0x4c'),'filter':_0x3bf2e6[_0xf409('0x14')][_0xf409('0x55')]}};return db['UserProfile'][_0xf409('0x43')](_0xb22054);}return db[_0x443cd4][_0xf409('0x56')](_0x46fa9b);})[_0xf409('0x1a')](function(_0x42412e){_0x3519b8[_0xf409('0xd')]=_0x42412e[_0xf409('0xd')];_0x3aef9a=_0x42412e['rows'];return rtq[_0xf409('0x57')](_0x3bf2e6,_0x3ad40b);})[_0xf409('0x1a')](function(_0x26021c){_0x24fc69=_0x26021c[_0xf409('0x29')];return rtq[_0xf409('0x58')](_0x3aef9a,_0x24fc69,_0x3ad40b,_0x3bf2e6[_0xf409('0x14')][_0xf409('0x30')]);})[_0xf409('0x1a')](function(_0x47bf47){_0x3519b8[_0xf409('0x29')]=_0x47bf47;return _0x3519b8;})[_0xf409('0x1a')](respondWithFilteredResult(_0x59f51d,_0x46fa9b))['catch'](APIHandleError(_0x59f51d));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f049b47..5d9b4fb 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(_0x667c6a,_0x2155cd){var _0x36396a=function(_0x29d602){while(--_0x29d602){_0x667c6a['push'](_0x667c6a['shift']());}};_0x36396a(++_0x2155cd);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x785617,_0x2835e9){var _0x8b3f71=function(_0x88d45d){while(--_0x88d45d){_0x785617['push'](_0x785617['shift']());}};_0x8b3f71(++_0x2835e9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f642d,_0x3701da){_0x3f642d=_0x3f642d-0x0;var _0x545e99=_0xedd9[_0x3f642d];return _0x545e99;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 0738f48..1ecc5a0 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 _0x2bd8=['sequelize','INTEGER','STRING','DATE'];(function(_0x274e7f,_0x139c43){var _0x3eba3f=function(_0x4a64bc){while(--_0x4a64bc){_0x274e7f['push'](_0x274e7f['shift']());}};_0x3eba3f(++_0x139c43);}(_0x2bd8,0x130));var _0x82bd=function(_0x4fb244,_0x30321d){_0x4fb244=_0x4fb244-0x0;var _0x385b31=_0x2bd8[_0x4fb244];return _0x385b31;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'state':{'type':Sequelize[_0x82bd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x82bd('0x2')]},'scheduledat':{'type':Sequelize[_0x82bd('0x3')]},'uniqueid':{'type':Sequelize[_0x82bd('0x2')]},'starttime':{'type':Sequelize[_0x82bd('0x3')]},'responsetime':{'type':Sequelize[_0x82bd('0x3')]},'ringtime':{'type':Sequelize[_0x82bd('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82bd('0x2')]},'membername':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file +var _0x7c09=['DATE','STRING','exports','INTEGER'];(function(_0x2653f5,_0x568693){var _0x39039d=function(_0x95f2b4){while(--_0x95f2b4){_0x2653f5['push'](_0x2653f5['shift']());}};_0x39039d(++_0x568693);}(_0x7c09,0x102));var _0x97c0=function(_0x2b4225,_0x1b51cf){_0x2b4225=_0x2b4225-0x0;var _0x2b6b82=_0x7c09[_0x2b4225];return _0x2b6b82;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'state':{'type':Sequelize[_0x97c0('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x97c0('0x2')]},'uniqueid':{'type':Sequelize[_0x97c0('0x3')]},'starttime':{'type':Sequelize[_0x97c0('0x2')]},'responsetime':{'type':Sequelize[_0x97c0('0x2')]},'ringtime':{'type':Sequelize[_0x97c0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x97c0('0x3')]},'campaigntype':{'type':Sequelize[_0x97c0('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a78e484..44e4b45 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 _0xfcdc=['api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','lodash','util','../../config/logger'];(function(_0x13c90a,_0x182cea){var _0x47bc14=function(_0x236eca){while(--_0x236eca){_0x13c90a['push'](_0x13c90a['shift']());}};_0x47bc14(++_0x182cea);}(_0xfcdc,0x179));var _0xcfcd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfcdc[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xcfcd('0x0'));var util=require(_0xcfcd('0x1'));var logger=require(_0xcfcd('0x2'))(_0xcfcd('0x3'));var moment=require(_0xcfcd('0x4'));var BPromise=require(_0xcfcd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcfcd('0x6'));var config=require(_0xcfcd('0x7'));var attributes=require(_0xcfcd('0x8'));module[_0xcfcd('0x9')]=function(_0x3247b4,_0x1dd79a){return _0x3247b4['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2489=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x12ceda,_0x8512a0){var _0x4cf4a3=function(_0x3bc7c5){while(--_0x3bc7c5){_0x12ceda['push'](_0x12ceda['shift']());}};_0x4cf4a3(++_0x8512a0);}(_0x2489,0x9f));var _0x9248=function(_0x380ac8,_0x1de82f){_0x380ac8=_0x380ac8-0x0;var _0x3e590b=_0x2489[_0x380ac8];return _0x3e590b;};'use strict';var _=require(_0x9248('0x0'));var util=require(_0x9248('0x1'));var logger=require(_0x9248('0x2'))('api');var moment=require(_0x9248('0x3'));var BPromise=require(_0x9248('0x4'));var rp=require(_0x9248('0x5'));var fs=require('fs');var path=require(_0x9248('0x6'));var rimraf=require(_0x9248('0x7'));var config=require(_0x9248('0x8'));var attributes=require(_0x9248('0x9'));module['exports']=function(_0x326758,_0x4ccc27){return _0x326758[_0x9248('0xa')](_0x9248('0xb'),attributes,{'tableName':_0x9248('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 c605da9..ead04c4 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 _0xaa18=['options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','body'];(function(_0x49aab7,_0x1d6397){var _0x587b6f=function(_0x2346ac){while(--_0x2346ac){_0x49aab7['push'](_0x49aab7['shift']());}};_0x587b6f(++_0x1d6397);}(_0xaa18,0x16d));var _0x8aa1=function(_0x541d36,_0x19842a){_0x541d36=_0x541d36-0x0;var _0x4ab56e=_0xaa18[_0x541d36];return _0x4ab56e;};'use strict';var _=require(_0x8aa1('0x0'));var util=require(_0x8aa1('0x1'));var moment=require('moment');var BPromise=require(_0x8aa1('0x2'));var rs=require(_0x8aa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8aa1('0x4'))['db'];var utils=require(_0x8aa1('0x5'));var logger=require(_0x8aa1('0x6'))(_0x8aa1('0x7'));var config=require(_0x8aa1('0x8'));var jayson=require(_0x8aa1('0x9'));var client=jayson['client'][_0x8aa1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e2b6a,_0x5b2a06,_0x5f4723){return new BPromise(function(_0xa7e272,_0x1f290f){return client[_0x8aa1('0xb')](_0x4e2b6a,_0x5f4723)[_0x8aa1('0xc')](function(_0x4d3ddf){logger['info'](_0x8aa1('0xd'),_0x5b2a06,'request\x20sent');logger[_0x8aa1('0xe')](_0x8aa1('0xf'),_0x5b2a06,_0x8aa1('0x10'),JSON[_0x8aa1('0x11')](_0x4d3ddf));if(_0x4d3ddf['error']){if(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x13')]===0x1f4){logger['error'](_0x8aa1('0xd'),_0x5b2a06,_0x4d3ddf['error'][_0x8aa1('0x14')]);return _0x1f290f(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);}logger[_0x8aa1('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b2a06,_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);return _0xa7e272(_0x4d3ddf[_0x8aa1('0x12')][_0x8aa1('0x14')]);}else{logger[_0x8aa1('0x15')](_0x8aa1('0xd'),_0x5b2a06,'request\x20sent');_0xa7e272(_0x4d3ddf[_0x8aa1('0x16')][_0x8aa1('0x14')]);}})[_0x8aa1('0x17')](function(_0x2a387e){logger[_0x8aa1('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5b2a06,_0x2a387e);_0x1f290f(_0x2a387e);});});}exports[_0x8aa1('0x18')]=function(_0x1ec06e){var _0x5b499d=this;return new Promise(function(_0x26fe2d,_0x4b821b){return db['ReportAgentPreview'][_0x8aa1('0x19')](_0x1ec06e[_0x8aa1('0x1a')],{'raw':_0x1ec06e[_0x8aa1('0x1b')]?_0x1ec06e['options']['raw']===undefined?!![]:![]:!![]})[_0x8aa1('0xc')](function(_0x3b818a){logger['info'](_0x8aa1('0x18'),_0x1ec06e);logger[_0x8aa1('0xe')]('CreateReportAgentPreview',_0x1ec06e,JSON[_0x8aa1('0x11')](_0x3b818a));_0x26fe2d(_0x3b818a);})[_0x8aa1('0x17')](function(_0xb38f9a){logger[_0x8aa1('0x12')](_0x8aa1('0x18'),_0xb38f9a['message'],_0x1ec06e);_0x4b821b(_0x5b499d['error'](0x1f4,_0xb38f9a[_0x8aa1('0x14')]));});});}; \ No newline at end of file +var _0x7e4e=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x7e4e,0x16c));var _0xe7e4=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x7e4e[_0x2d364e];return _0x1b9312;};'use strict';var _=require(_0xe7e4('0x0'));var util=require(_0xe7e4('0x1'));var moment=require(_0xe7e4('0x2'));var BPromise=require(_0xe7e4('0x3'));var rs=require(_0xe7e4('0x4'));var fs=require('fs');var Redis=require(_0xe7e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7e4('0x6'));var logger=require('../../config/logger')(_0xe7e4('0x7'));var config=require(_0xe7e4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe7e4('0x9')][_0xe7e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42f999,_0xd16849,_0x50e745){return new BPromise(function(_0x3edc0c,_0x5a1dda){return client[_0xe7e4('0xb')](_0x42f999,_0x50e745)[_0xe7e4('0xc')](function(_0x302f78){logger[_0xe7e4('0xd')](_0xe7e4('0xe'),_0xd16849,_0xe7e4('0xf'));logger[_0xe7e4('0x10')](_0xe7e4('0x11'),_0xd16849,'request\x20sent',JSON[_0xe7e4('0x12')](_0x302f78));if(_0x302f78[_0xe7e4('0x13')]){if(_0x302f78[_0xe7e4('0x13')]['code']===0x1f4){logger['error'](_0xe7e4('0xe'),_0xd16849,_0x302f78[_0xe7e4('0x13')][_0xe7e4('0x14')]);return _0x5a1dda(_0x302f78[_0xe7e4('0x13')]['message']);}logger['error'](_0xe7e4('0xe'),_0xd16849,_0x302f78[_0xe7e4('0x13')][_0xe7e4('0x14')]);return _0x3edc0c(_0x302f78[_0xe7e4('0x13')][_0xe7e4('0x14')]);}else{logger[_0xe7e4('0xd')](_0xe7e4('0xe'),_0xd16849,_0xe7e4('0xf'));_0x3edc0c(_0x302f78['result'][_0xe7e4('0x14')]);}})['catch'](function(_0x99cee7){logger[_0xe7e4('0x13')](_0xe7e4('0xe'),_0xd16849,_0x99cee7);_0x5a1dda(_0x99cee7);});});}exports[_0xe7e4('0x15')]=function(_0x48d3cc){var _0x523156=this;return new Promise(function(_0x475d17,_0x251486){return db[_0xe7e4('0x16')][_0xe7e4('0x17')](_0x48d3cc[_0xe7e4('0x18')],{'raw':_0x48d3cc['options']?_0x48d3cc[_0xe7e4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe7e4('0xc')](function(_0x58c00b){logger[_0xe7e4('0xd')](_0xe7e4('0x15'),_0x48d3cc);logger[_0xe7e4('0x10')](_0xe7e4('0x15'),_0x48d3cc,JSON[_0xe7e4('0x12')](_0x58c00b));_0x475d17(_0x58c00b);})[_0xe7e4('0x1a')](function(_0x56ef9d){logger[_0xe7e4('0x13')](_0xe7e4('0x15'),_0x56ef9d[_0xe7e4('0x14')],_0x48d3cc);_0x251486(_0x523156[_0xe7e4('0x13')](0x1f4,_0x56ef9d[_0xe7e4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index fd07fc8..85ccfcd 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 _0xe53d=['faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id','showFaxQueues','post','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','get','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x460e8b,_0x3f17dd){var _0x78d336=function(_0x417c09){while(--_0x417c09){_0x460e8b['push'](_0x460e8b['shift']());}};_0x78d336(++_0x3f17dd);}(_0xe53d,0x1a7));var _0xde53=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xe53d[_0x47aa64];return _0x549c7a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde53('0x0'));var express=require(_0xde53('0x1'));var router=express[_0xde53('0x2')]();var auth=require(_0xde53('0x3'));var controller=require(_0xde53('0x4'));router['get'](_0xde53('0x5'),auth[_0xde53('0x6')](),controller['voiceChannels']);router[_0xde53('0x7')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xde53('0x6')](),controller[_0xde53('0x8')]);router['get'](_0xde53('0x9'),auth['isAuthenticated'](),controller[_0xde53('0xa')]);router[_0xde53('0x7')](_0xde53('0xb'),auth[_0xde53('0x6')](),controller[_0xde53('0xc')]);router[_0xde53('0x7')](_0xde53('0xd'),auth['isAuthenticated'](),controller[_0xde53('0xe')]);router[_0xde53('0x7')](_0xde53('0xf'),auth[_0xde53('0x6')](),controller[_0xde53('0x10')]);router[_0xde53('0x7')]('/mail/accounts',auth[_0xde53('0x6')](),controller[_0xde53('0x11')]);router[_0xde53('0x7')](_0xde53('0x12'),auth['isAuthenticated'](),controller[_0xde53('0x13')]);router[_0xde53('0x7')]('/sms/queues',auth['isAuthenticated'](),controller['smsQueues']);router[_0xde53('0x7')]('/whatsapp/queues',auth[_0xde53('0x6')](),controller[_0xde53('0x14')]);router[_0xde53('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0xde53('0x15')]);router[_0xde53('0x7')](_0xde53('0x16'),auth[_0xde53('0x6')](),controller[_0xde53('0x17')]);router[_0xde53('0x7')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xde53('0x7')](_0xde53('0x18'),auth[_0xde53('0x6')](),controller[_0xde53('0x19')]);router[_0xde53('0x7')](_0xde53('0x1a'),auth[_0xde53('0x6')](),controller[_0xde53('0x1b')]);router[_0xde53('0x7')](_0xde53('0x1c'),auth['isAuthenticated'](),controller[_0xde53('0x1d')]);router[_0xde53('0x7')]('/voice/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x1e')]);router[_0xde53('0x1f')]('/voice/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x20')]);router[_0xde53('0x7')](_0xde53('0x21'),auth['isAuthenticated'](),controller[_0xde53('0x22')]);router['get']('/outbound/channels',auth[_0xde53('0x6')](),controller[_0xde53('0x23')]);router['get'](_0xde53('0x24'),auth['isAuthenticated'](),controller[_0xde53('0x25')]);router[_0xde53('0x1f')](_0xde53('0x26'),auth[_0xde53('0x6')](),controller[_0xde53('0x27')]);router[_0xde53('0x7')](_0xde53('0x28'),auth[_0xde53('0x6')](),controller[_0xde53('0x29')]);router[_0xde53('0x7')]('/trunks',auth[_0xde53('0x6')](),controller[_0xde53('0x2a')]);router[_0xde53('0x7')](_0xde53('0x2b'),auth[_0xde53('0x6')](),controller[_0xde53('0x2c')]);router[_0xde53('0x7')](_0xde53('0x2d'),auth[_0xde53('0x6')](),controller[_0xde53('0x2e')]);router[_0xde53('0x7')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xde53('0x2f')]);router[_0xde53('0x7')]('/mail/queues/waitinginteractions',auth[_0xde53('0x6')](),controller[_0xde53('0x30')]);router[_0xde53('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xde53('0x6')](),controller[_0xde53('0x31')]);router[_0xde53('0x7')](_0xde53('0x32'),auth[_0xde53('0x6')](),controller[_0xde53('0x33')]);router[_0xde53('0x7')](_0xde53('0x34'),auth['isAuthenticated'](),controller[_0xde53('0x35')]);router[_0xde53('0x7')](_0xde53('0x36'),auth[_0xde53('0x6')](),controller[_0xde53('0x37')]);router[_0xde53('0x7')](_0xde53('0x38'),auth[_0xde53('0x6')](),controller[_0xde53('0x39')]);router['post'](_0xde53('0x3a'),auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x3b')));router['get'](_0xde53('0x3c'),auth[_0xde53('0x6')](),controller[_0xde53('0x3d')]);router['post'](_0xde53('0x3e'),auth['isAuthenticated'](),controller[_0xde53('0x3f')]('chat'));router[_0xde53('0x7')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0xde53('0x40')]);router['post']('/fax/queues/:id/notify',auth[_0xde53('0x6')](),controller['queueNotify']('fax'));router[_0xde53('0x7')](_0xde53('0x41'),auth['isAuthenticated'](),controller[_0xde53('0x42')]);router[_0xde53('0x43')](_0xde53('0x44'),auth[_0xde53('0x6')](),controller[_0xde53('0x3f')]('openchannel'));router[_0xde53('0x7')](_0xde53('0x45'),auth[_0xde53('0x6')](),controller[_0xde53('0x46')]);router[_0xde53('0x43')]('/sms/queues/:id/notify',auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x47')));router[_0xde53('0x43')](_0xde53('0x48'),auth[_0xde53('0x6')](),controller['queueNotify'](_0xde53('0x49')));router[_0xde53('0x7')](_0xde53('0x4a'),auth[_0xde53('0x6')](),controller[_0xde53('0x4b')]);router['get']('/whatsapp/queues/:id',auth[_0xde53('0x6')](),controller[_0xde53('0x4c')]);router['post'](_0xde53('0x4d'),auth[_0xde53('0x6')](),controller[_0xde53('0x4e')]);module[_0xde53('0x4f')]=router; \ No newline at end of file +var _0xb835=['post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xb835,0x154));var _0x5b83=function(_0x5daed0,_0x13a66f){_0x5daed0=_0x5daed0-0x0;var _0x442583=_0xb835[_0x5daed0];return _0x442583;};'use strict';var multer=require(_0x5b83('0x0'));var util=require(_0x5b83('0x1'));var path=require(_0x5b83('0x2'));var express=require(_0x5b83('0x3'));var router=express[_0x5b83('0x4')]();var auth=require(_0x5b83('0x5'));var controller=require(_0x5b83('0x6'));router[_0x5b83('0x7')](_0x5b83('0x8'),auth[_0x5b83('0x9')](),controller[_0x5b83('0xa')]);router[_0x5b83('0x7')](_0x5b83('0xb'),auth[_0x5b83('0x9')](),controller['voiceChannelMixMonitor']);router[_0x5b83('0x7')](_0x5b83('0xc'),auth[_0x5b83('0x9')](),controller[_0x5b83('0xd')]);router[_0x5b83('0x7')](_0x5b83('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x5b83('0x7')](_0x5b83('0xf'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x10')]);router['get'](_0x5b83('0x11'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x12')]);router[_0x5b83('0x7')](_0x5b83('0x13'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x14')]);router['get']('/openchannel/queues',auth[_0x5b83('0x9')](),controller['openchannelQueues']);router[_0x5b83('0x7')](_0x5b83('0x15'),auth['isAuthenticated'](),controller[_0x5b83('0x16')]);router[_0x5b83('0x7')](_0x5b83('0x17'),auth[_0x5b83('0x9')](),controller['whatsappQueues']);router[_0x5b83('0x7')](_0x5b83('0x18'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x19')]);router[_0x5b83('0x7')](_0x5b83('0x1a'),auth['isAuthenticated'](),controller[_0x5b83('0x1b')]);router[_0x5b83('0x7')](_0x5b83('0x1c'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x1d')]);router['get'](_0x5b83('0x1e'),auth[_0x5b83('0x9')](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x5b83('0x1f')]);router[_0x5b83('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5b83('0x9')](),controller[_0x5b83('0x20')]);router[_0x5b83('0x7')](_0x5b83('0x21'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x22')]);router[_0x5b83('0x23')](_0x5b83('0x21'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x24')]);router['get'](_0x5b83('0x25'),auth['isAuthenticated'](),controller['outbound']);router['get'](_0x5b83('0x26'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x27')]);router[_0x5b83('0x7')](_0x5b83('0x28'),auth[_0x5b83('0x9')](),controller['agents']);router[_0x5b83('0x23')]('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x5b83('0x29')]);router[_0x5b83('0x7')](_0x5b83('0x2a'),auth[_0x5b83('0x9')](),controller['telephones']);router[_0x5b83('0x7')](_0x5b83('0x2b'),auth['isAuthenticated'](),controller[_0x5b83('0x2c')]);router[_0x5b83('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x5b83('0x2d')]);router[_0x5b83('0x7')](_0x5b83('0x2e'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x2f')]);router[_0x5b83('0x7')](_0x5b83('0x30'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x31')]);router['get'](_0x5b83('0x32'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x33')]);router['get'](_0x5b83('0x34'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x35')]);router[_0x5b83('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x5b83('0x36')]);router[_0x5b83('0x7')](_0x5b83('0x37'),auth[_0x5b83('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x5b83('0x7')](_0x5b83('0x38'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x39')]);router[_0x5b83('0x7')](_0x5b83('0x3a'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x3b')]);router[_0x5b83('0x3c')](_0x5b83('0x3d'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x3e')]('mail'));router[_0x5b83('0x7')](_0x5b83('0x3f'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x40')]);router[_0x5b83('0x3c')](_0x5b83('0x41'),auth[_0x5b83('0x9')](),controller['queueNotify'](_0x5b83('0x42')));router['get'](_0x5b83('0x43'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x44')]);router['post'](_0x5b83('0x45'),auth[_0x5b83('0x9')](),controller['queueNotify'](_0x5b83('0x46')));router[_0x5b83('0x7')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x5b83('0x47')]);router['post'](_0x5b83('0x48'),auth[_0x5b83('0x9')](),controller['queueNotify']('openchannel'));router[_0x5b83('0x7')]('/openchannel/queues/:id',auth[_0x5b83('0x9')](),controller[_0x5b83('0x49')]);router[_0x5b83('0x3c')]('/sms/queues/:id/notify',auth[_0x5b83('0x9')](),controller[_0x5b83('0x3e')](_0x5b83('0x4a')));router[_0x5b83('0x3c')](_0x5b83('0x4b'),auth[_0x5b83('0x9')](),controller[_0x5b83('0x3e')](_0x5b83('0x4c')));router['get']('/sms/queues/:id',auth[_0x5b83('0x9')](),controller[_0x5b83('0x4d')]);router['get']('/whatsapp/queues/:id',auth[_0x5b83('0x9')](),controller[_0x5b83('0x4e')]);router['post']('/agents/:id/notify',auth[_0x5b83('0x9')](),controller[_0x5b83('0x4f')]);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 df9585b..cc2f266 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 _0x81bd=['client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','Message','Interaction','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','agent','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','MessageId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api'];(function(_0xa3e76a,_0x424feb){var _0x519095=function(_0x5d4502){while(--_0x5d4502){_0xa3e76a['push'](_0xa3e76a['shift']());}};_0x519095(++_0x424feb);}(_0x81bd,0x7c));var _0xd81b=function(_0x3e3bed,_0x28cdc0){_0x3e3bed=_0x3e3bed-0x0;var _0x30595b=_0x81bd[_0x3e3bed];return _0x30595b;};'use strict';var BPromise=require(_0xd81b('0x0'));var moment=require(_0xd81b('0x1'));var _=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var db=require(_0xd81b('0x4'))['db'];var logger=require(_0xd81b('0x5'))(_0xd81b('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232a});var mailClient=jayson[_0xd81b('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xd81b('0x7')][_0xd81b('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){var _0x223515=_0x5e14e8?_0x5e14e8:amiClient;return _0x223515[_0xd81b('0x9')](_0x1f3f2c,_0x562084)[_0xd81b('0xa')](function(_0x86dab6){if(_0x86dab6[_0xd81b('0xb')]){if(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xc')]===0x1f4){return _0x5468d5(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}return _0xa4cf97(_0x86dab6[_0xd81b('0xb')][_0xd81b('0xd')]);}else{_0xa4cf97(_0x86dab6[_0xd81b('0xe')]);}})[_0xd81b('0xf')](function(_0x560530){_0x5468d5(_0x560530);});});}function respondWithResult(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xc8;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x10')](_0x57f71d)['json'](_0x3f2405);}return _0x21dfff[_0xd81b('0x11')](0x194);};}function handleError(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0x1f4;return function(_0x41bf7a){logger[_0xd81b('0xb')](_0x41bf7a[_0xd81b('0x12')]);if(_0x41bf7a[_0xd81b('0x13')]){delete _0x41bf7a['name'];}_0x47dd04[_0xd81b('0x10')](_0x13dd00)[_0xd81b('0x14')](_0x41bf7a);};}function findById(_0x5c2863){return function(_0x2abef4){if(!_[_0xd81b('0x15')](_0x5c2863)&&!_[_0xd81b('0x15')](_0x2abef4)&&!_[_0xd81b('0x15')](_0x2abef4[_0xd81b('0x16')])){return _[_0xd81b('0x17')](_0x2abef4[_0xd81b('0x16')],function(_0x3d4d34){return _0x3d4d34['id']==_0x5c2863;});}return null;};}exports[_0xd81b('0x18')]=function(_0x285164,_0x1ff3c6){return respondWithRpcPromise(_0xd81b('0x19'),_0x285164[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x1ff3c6,null))[_0xd81b('0xf')](handleError(_0x1ff3c6,null));};exports[_0xd81b('0x1b')]=function(_0x5f101a,_0x4d566e){return respondWithRpcPromise(_0xd81b('0x1c'),_[_0xd81b('0x1d')](_0x5f101a[_0xd81b('0x1a')],_0x5f101a['params']))[_0xd81b('0xa')](respondWithResult(_0x4d566e,null))[_0xd81b('0xf')](handleError(_0x4d566e,null));};exports['voiceChannelStopMixMonitor']=function(_0xcd6474,_0x13d687){return respondWithRpcPromise(_0xd81b('0x1e'),_[_0xd81b('0x1d')](_0xcd6474[_0xd81b('0x1a')],_0xcd6474[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x13d687,null))[_0xd81b('0xf')](handleError(_0x13d687,null));};exports[_0xd81b('0x20')]=function(_0x212c4e,_0x2ccedf){return respondWithRpcPromise(_0xd81b('0x21'),_0x212c4e['query'])[_0xd81b('0xa')](respondWithResult(_0x2ccedf,null))[_0xd81b('0xf')](handleError(_0x2ccedf,null));};exports[_0xd81b('0x22')]=function(_0x31b9fd,_0x3266c2){return respondWithRpcPromise(_0xd81b('0x21'),_0x31b9fd[_0xd81b('0x1a')])[_0xd81b('0xa')](findById(_0x31b9fd[_0xd81b('0x1f')]['id']))['then'](respondWithResult(_0x3266c2,null))[_0xd81b('0xf')](handleError(_0x3266c2,null));};exports['updateVoiceQueue']=function(_0x5c8aee,_0xb9ff9f){return respondWithRpcPromise(_0xd81b('0x23'),_['merge'](_0x5c8aee['body'],_0x5c8aee[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0xb9ff9f,null))[_0xd81b('0xf')](handleError(_0xb9ff9f,null));};exports[_0xd81b('0x24')]=function(_0x1a1572,_0x4654ba){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xd81b('0x1d')](_0x1a1572[_0xd81b('0x1a')],_0x1a1572['params']))['then'](respondWithResult(_0x4654ba,null))[_0xd81b('0xf')](handleError(_0x4654ba,null));};exports[_0xd81b('0x25')]=function(_0x50472a,_0x50ce25){return respondWithRpcPromise('VoiceQueuesChannels',_0x50472a[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x50ce25,null))[_0xd81b('0xf')](handleError(_0x50ce25,null));};exports[_0xd81b('0x26')]=function(_0xa56339,_0x12ee8f){return respondWithRpcPromise(_0xd81b('0x27'),_['merge'](_0xa56339[_0xd81b('0x1a')],_0xa56339['params']))[_0xd81b('0xa')](respondWithResult(_0x12ee8f,null))[_0xd81b('0xf')](handleError(_0x12ee8f,null));};exports[_0xd81b('0x28')]=function(_0xcd9e86,_0x36c69f){return respondWithRpcPromise(_0xd81b('0x29'),_[_0xd81b('0x1d')](_0xcd9e86[_0xd81b('0x1a')],_0xcd9e86[_0xd81b('0x1f')]))[_0xd81b('0xa')](respondWithResult(_0x36c69f,null))[_0xd81b('0xf')](handleError(_0x36c69f,null));};exports[_0xd81b('0x2a')]=function(_0x346038,_0x57bc0c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd81b('0x1d')](_0x346038[_0xd81b('0x1a')],_0x346038[_0xd81b('0x1f')]))['then'](respondWithResult(_0x57bc0c,null))[_0xd81b('0xf')](handleError(_0x57bc0c,null));};exports[_0xd81b('0x2b')]=function(_0x5a236a,_0x46f058){return respondWithRpcPromise(_0xd81b('0x2c'),_0x5a236a['query'])[_0xd81b('0xa')](respondWithResult(_0x46f058,null))['catch'](handleError(_0x46f058,null));};exports[_0xd81b('0x2d')]=function(_0x2502d1,_0x203365){return respondWithRpcPromise(_0xd81b('0x2e'),_0x2502d1['query'])[_0xd81b('0xa')](respondWithResult(_0x203365,null))[_0xd81b('0xf')](handleError(_0x203365,null));};exports[_0xd81b('0x2f')]=function(_0x67fbe5,_0x3abd60){var _0x466e98;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'])[_0xd81b('0xa')](function(_0x35a295){_0x466e98=_0x35a295;return respondWithRpcPromise(_0xd81b('0x30'),_0x67fbe5['query'],routingClient);})[_0xd81b('0xa')](function(_0x3a05f4){return _[_0xd81b('0x1d')]({},_0x3a05f4,_0x466e98);})[_0xd81b('0xa')](respondWithResult(_0x3abd60,null))[_0xd81b('0xf')](handleError(_0x3abd60,null));};exports['agentCapacity']=function(_0x3dfba7,_0x11d617){if(_0x3dfba7[_0xd81b('0x31')]&&_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]&&_0x3dfba7[_0xd81b('0x33')]&&_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]){for(var _0x4405a8 in _0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')]){if(_0x3dfba7['body'][_0xd81b('0x32')][_0xd81b('0x34')](_0x4405a8)){db[_0xd81b('0x35')][_0xd81b('0x36')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'exitAt':null,'uniqueid':_0x3dfba7[_0xd81b('0x31')]['interaction'][_0x4405a8]&&_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')]?{'$notIn':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8]}:{'$ne':null}}})[_0xd81b('0xa')](function(_0x37031b){var _0x334bd0=moment()[_0xd81b('0x39')](_0xd81b('0x3a'));for(var _0xcfbbc2=0x0,_0x41e2e6=_0x37031b[_0xd81b('0x38')];_0xcfbbc2<_0x41e2e6;_0xcfbbc2+=0x1){_0x37031b[_0xcfbbc2]['updateAttributes']({'exitAt':_0x334bd0});}});for(var _0x27d18a=0x0;_0x27d18a<_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0xd81b('0x38')];_0x27d18a+=0x1){db[_0xd81b('0x35')][_0xd81b('0x3b')]({'where':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'type':_0xd81b('0x37'),'uniqueid':_0x3dfba7['body'][_0xd81b('0x32')][_0x4405a8][_0x27d18a],'exitAt':null},'defaults':{'channel':_0x4405a8,'membername':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')],'interface':_[_0xd81b('0x15')](_0x3dfba7['user'][_0xd81b('0x3c')])?util[_0xd81b('0x39')](_0xd81b('0x3d'),_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x13')]):_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3c')],'type':_0xd81b('0x37'),'enterAt':moment()[_0xd81b('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3dfba7[_0xd81b('0x33')][_0xd81b('0x3e')],'uniqueid':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x32')][_0x4405a8][_0x27d18a]}});}}}}return respondWithRpcPromise(_0xd81b('0x3f'),{'id':_0x3dfba7[_0xd81b('0x1f')]['id'],'capacity':_0x3dfba7[_0xd81b('0x31')][_0xd81b('0x40')]},routingClient)['then'](respondWithResult(_0x11d617,null))[_0xd81b('0xf')](handleError(_0x11d617,null));};exports[_0xd81b('0x41')]=function(_0x1b523c,_0x3d171a){return respondWithRpcPromise(_0xd81b('0x42'),_0x1b523c['query'])[_0xd81b('0xa')](respondWithResult(_0x3d171a,null))[_0xd81b('0xf')](handleError(_0x3d171a,null));};exports['trunks']=function(_0x1f13c3,_0x315bd5){return respondWithRpcPromise(_0xd81b('0x43'),_0x1f13c3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x315bd5,null))[_0xd81b('0xf')](handleError(_0x315bd5,null));};exports[_0xd81b('0x44')]=function(_0x22f588,_0x3ed626){return respondWithRpcPromise(_0xd81b('0x45'),_0x22f588[_0xd81b('0x1a')])['then'](respondWithResult(_0x3ed626,null))[_0xd81b('0xf')](handleError(_0x3ed626,null));};exports['chatQueues']=function(_0x1800fa,_0x7b438c){return respondWithRpcPromise(_0xd81b('0x46'),_0x1800fa[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x7b438c,null))[_0xd81b('0xf')](handleError(_0x7b438c,null));};exports['showChatQueues']=function(_0x2d978d,_0xe0c9c6){return respondWithRpcPromise('ChatQueues',_0x2d978d['query'],routingClient)[_0xd81b('0xa')](findById(_0x2d978d['params']['id']))[_0xd81b('0xa')](respondWithResult(_0xe0c9c6,null))['catch'](handleError(_0xe0c9c6,null));};exports[_0xd81b('0x47')]=function(_0x315a66,_0x3d97ba){return respondWithRpcPromise('MailQueues',_0x315a66[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3d97ba,null))['catch'](handleError(_0x3d97ba,null));};exports[_0xd81b('0x48')]=function(_0x108aaf,_0x5951ec){return respondWithRpcPromise(_0xd81b('0x49'),_0x108aaf['query'],routingClient)[_0xd81b('0xa')](findById(_0x108aaf[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5951ec,null))[_0xd81b('0xf')](handleError(_0x5951ec,null));};exports[_0xd81b('0x4a')]=function(_0x32eab4,_0x2f2afe){return respondWithRpcPromise(_0xd81b('0x4b'),_0x32eab4[_0xd81b('0x1a')],mailClient)[_0xd81b('0xa')](respondWithResult(_0x2f2afe,null))['catch'](handleError(_0x2f2afe,null));};exports[_0xd81b('0x4c')]=function(_0x434434,_0x385841){return respondWithRpcPromise(_0xd81b('0x4d'),_0x434434[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x385841,null))[_0xd81b('0xf')](handleError(_0x385841,null));};exports['showOpenchannelQueues']=function(_0x57f0fb,_0x5de22d){return respondWithRpcPromise(_0xd81b('0x4d'),_0x57f0fb[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x57f0fb[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5de22d,null))[_0xd81b('0xf')](handleError(_0x5de22d,null));};exports[_0xd81b('0x4e')]=function(_0x5afecf,_0x3fcd8c){return respondWithRpcPromise(_0xd81b('0x4f'),_0x5afecf[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x3fcd8c,null))[_0xd81b('0xf')](handleError(_0x3fcd8c,null));};exports[_0xd81b('0x50')]=function(_0xb5fca8,_0x4ed17d){return respondWithRpcPromise(_0xd81b('0x4f'),_0xb5fca8[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0xb5fca8[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x4ed17d,null))[_0xd81b('0xf')](handleError(_0x4ed17d,null));};exports[_0xd81b('0x51')]=function(_0x19d4f0,_0x8fa8cd){return respondWithRpcPromise(_0xd81b('0x52'),_0x19d4f0[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x8fa8cd,null))['catch'](handleError(_0x8fa8cd,null));};exports[_0xd81b('0x53')]=function(_0x5358a6,_0x2e7141){return respondWithRpcPromise(_0xd81b('0x52'),_0x5358a6[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x5358a6[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x2e7141,null))[_0xd81b('0xf')](handleError(_0x2e7141,null));};exports[_0xd81b('0x54')]=function(_0x10d6d2,_0x36fb7a){return respondWithRpcPromise('FaxQueues',_0x10d6d2[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x36fb7a,null))[_0xd81b('0xf')](handleError(_0x36fb7a,null));};exports[_0xd81b('0x55')]=function(_0x7720d3,_0x5abbb4){return respondWithRpcPromise('FaxQueues',_0x7720d3[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](findById(_0x7720d3[_0xd81b('0x1f')]['id']))[_0xd81b('0xa')](respondWithResult(_0x5abbb4,null))[_0xd81b('0xf')](handleError(_0x5abbb4,null));};exports[_0xd81b('0x56')]=function(_0xaee7e3,_0x539132){return respondWithRpcPromise(_0xd81b('0x57'),_0xaee7e3[_0xd81b('0x1a')])[_0xd81b('0xa')](respondWithResult(_0x539132,null))[_0xd81b('0xf')](handleError(_0x539132,null));};exports[_0xd81b('0x58')]=function(_0x21d039,_0x1e0da3){return respondWithRpcPromise(_0xd81b('0x59'),_0x21d039[_0xd81b('0x1a')],routingClient)['then'](respondWithResult(_0x1e0da3,null))[_0xd81b('0xf')](handleError(_0x1e0da3,null));};exports[_0xd81b('0x5a')]=function(_0x3858eb,_0x9c30e7){return respondWithRpcPromise(_0xd81b('0x5b'),_0x3858eb['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x9c30e7,null))[_0xd81b('0xf')](handleError(_0x9c30e7,null));};exports['openchannelQueuesWaitingInteractions']=function(_0xa00645,_0x43e593){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0xa00645[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x43e593,null))[_0xd81b('0xf')](handleError(_0x43e593,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2aff4b,_0x3db4d7){return respondWithRpcPromise(_0xd81b('0x5c'),_0x2aff4b['query'],routingClient)['then'](function(_0xdd970d){if(_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')]!==undefined){var _0x5d601d=_(_0xdd970d[_0xd81b('0x16')])[_0xd81b('0x5e')]([_0x2aff4b[_0xd81b('0x1a')][_0xd81b('0x5d')],_0x2aff4b['params']['id']])['map'](_0xd81b('0x5f'))[_0xd81b('0x60')]()[_0xd81b('0x61')]();return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x1b8b17){return _0x5d601d[_0xd81b('0x62')](_0x1b8b17['queue_id'])>-0x1;});}else{return _0xdd970d[_0xd81b('0x16')]['filter'](function(_0x32a8f4){return _0x32a8f4[_0xd81b('0x5f')]===parseInt(_0x2aff4b['params']['id']);});}})[_0xd81b('0xa')](respondWithResult(_0x3db4d7,null))[_0xd81b('0xf')](handleError(_0x3db4d7,null));};exports[_0xd81b('0x63')]=function(_0x2490f1,_0x2b0fe4){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2490f1[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b0fe4,null))[_0xd81b('0xf')](handleError(_0x2b0fe4,null));};exports[_0xd81b('0x64')]=function(_0x1919b2,_0x2b1d96){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x1919b2['query'],routingClient)[_0xd81b('0xa')](respondWithResult(_0x2b1d96,null))[_0xd81b('0xf')](handleError(_0x2b1d96,null));};exports[_0xd81b('0x65')]=function(_0x15aed5,_0x4dd8ac){return respondWithRpcPromise(_0xd81b('0x66'),_0x15aed5[_0xd81b('0x1a')],routingClient)[_0xd81b('0xa')](respondWithResult(_0x4dd8ac,null))[_0xd81b('0xf')](handleError(_0x4dd8ac,null));};exports[_0xd81b('0x67')]=function(_0x589882){return function(_0x3744bf,_0x374ac0){var _0x159b28,_0x40b468;var _0x1d596c=_[_0xd81b('0x68')](_0x589882);var _0x402eb9=_0x589882==='chat'?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0x1d596c+_0xd81b('0x6b')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x3744bf[_0xd81b('0x1f')]['id']}})[_0xd81b('0xa')](function(_0x59bee6){if(_[_0xd81b('0x15')](_0x59bee6)){throw new Error(_0x1d596c+'\x20Queue\x20not\x20found');}_0x159b28=_0x59bee6;return db[_0x1d596c+_0xd81b('0x6d')][_0xd81b('0x6c')]({'where':{'id':_0x3744bf[_0xd81b('0x31')]['messageId']},'include':[{'model':db[_0x1d596c+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x1d596c+_0x402eb9],'as':_0xd81b('0x6a')}]});})[_0xd81b('0xa')](function(_0x254105){if(_[_0xd81b('0x15')](_0x254105)){throw new Error(_0x1d596c+'\x20Message\x20not\x20found');}_0x40b468=_0x254105;return _0x254105[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5f5514={'uniqueid':_0x589882+'.'+_0x40b468['id']+'.'+_0x40b468[_0xd81b('0x6e')]['id'],'FromUserId':_0x3744bf[_0xd81b('0x33')]['id'],'type':_0xd81b('0x70')};_0x5f5514[_0x1d596c+'MessageId']=_0x40b468['id'];_0x5f5514[_0x1d596c+_0xd81b('0x71')]=_0x40b468[_0xd81b('0x6e')]['id'];_0x5f5514[_0xd81b('0x72')+_0x1d596c+_0x402eb9+'Id']=_0x40b468[_0xd81b('0x6a')]['id'];_0x5f5514['To'+_0x1d596c+_0xd81b('0x73')]=_0x159b28['id'];return db[_0x1d596c+_0xd81b('0x74')]['create'](_0x5f5514);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x589882,'interaction':_0x40b468[_0xd81b('0x6e')],'message':_0x40b468,'account':_0x40b468[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x70'),'appdata':_0x159b28[_0xd81b('0x13')]+','+(_0x40b468[_0xd81b('0x6a')][_0xd81b('0x76')]||0x12c),'interval':_0xd81b('0x77')}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x374ac0,null))[_0xd81b('0xf')](handleError(_0x374ac0,null));};};exports[_0xd81b('0x78')]=function(_0x42eb62,_0x2c19fd){var _0x36d8fd,_0x5adfe4;if(_[_0xd81b('0x15')](_0x42eb62['body'][_0xd81b('0x79')])){throw new Error(_0xd81b('0x7a'));}var _0x1ca94b=_0x42eb62[_0xd81b('0x31')][_0xd81b('0x79')];var _0x115805=_['capitalize'](_0x1ca94b);var _0x3a41e6=_0x1ca94b===_0xd81b('0x7b')?_0xd81b('0x69'):_0xd81b('0x6a');return db[_0xd81b('0x7c')][_0xd81b('0x6c')]({'raw':!![],'where':{'id':_0x42eb62[_0xd81b('0x1f')]['id'],'role':_0xd81b('0x7d')}})[_0xd81b('0xa')](function(_0xfacc8f){if(_[_0xd81b('0x15')](_0xfacc8f)){throw new Error(_0xd81b('0x7e'));}_0x36d8fd=_0xfacc8f;return db[_0x115805+'Message'][_0xd81b('0x6c')]({'where':{'id':_0x42eb62[_0xd81b('0x31')][_0xd81b('0x7f')]},'include':[{'model':db[_0x115805+_0xd81b('0x6e')],'as':_0xd81b('0x6e')},{'model':db[_0x115805+_0x3a41e6],'as':'Account'}]});})[_0xd81b('0xa')](function(_0x1e61d8){if(_[_0xd81b('0x15')](_0x1e61d8)){throw new Error(_0x115805+_0xd81b('0x80'));}_0x5adfe4=_0x1e61d8;return _0x1e61d8[_0xd81b('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd81b('0xa')](function(){var _0x4e4919={'uniqueid':_0x1ca94b+'.'+_0x5adfe4['id']+'.'+_0x5adfe4[_0xd81b('0x6e')]['id'],'FromUserId':_0x42eb62['user']['id'],'type':_0xd81b('0x70'),'ToUserId':_0x36d8fd['id']};_0x4e4919[_0x115805+_0xd81b('0x81')]=_0x5adfe4['id'];_0x4e4919[_0x115805+_0xd81b('0x71')]=_0x5adfe4[_0xd81b('0x6e')]['id'];_0x4e4919['From'+_0x115805+_0x3a41e6+'Id']=_0x5adfe4[_0xd81b('0x6a')]['id'];return db[_0x115805+_0xd81b('0x74')]['create'](_0x4e4919);})[_0xd81b('0xa')](function(){return respondWithRpcPromise(_0xd81b('0x75'),{'channel':_0x1ca94b,'interaction':_0x5adfe4[_0xd81b('0x6e')],'message':_0x5adfe4,'account':_0x5adfe4[_0xd81b('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd81b('0x7d'),'appdata':_0x36d8fd['name']+','+(_0x5adfe4['Account'][_0xd81b('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd81b('0xa')](respondWithResult(_0x2c19fd,null))['catch'](handleError(_0x2c19fd,null));}; \ No newline at end of file +var _0xeda8=['TransferReport','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','code','result','catch','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','merge','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User'];(function(_0x57cf37,_0x149b89){var _0x2df46f=function(_0x70283c){while(--_0x70283c){_0x57cf37['push'](_0x57cf37['shift']());}};_0x2df46f(++_0x149b89);}(_0xeda8,0x104));var _0x8eda=function(_0xd6ea7d,_0x5ba689){_0xd6ea7d=_0xd6ea7d-0x0;var _0xff8bc3=_0xeda8[_0xd6ea7d];return _0xff8bc3;};'use strict';var BPromise=require(_0x8eda('0x0'));var moment=require(_0x8eda('0x1'));var _=require('lodash');var util=require(_0x8eda('0x2'));var db=require(_0x8eda('0x3'))['db'];var logger=require(_0x8eda('0x4'))(_0x8eda('0x5'));var jayson=require(_0x8eda('0x6'));var amiClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232a});var mailClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232b});var routingClient=jayson[_0x8eda('0x7')][_0x8eda('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){var _0x6b544f=_0x28b721?_0x28b721:amiClient;return _0x6b544f['request'](_0x32abe8,_0x4e2ebb)['then'](function(_0x488849){if(_0x488849['error']){if(_0x488849[_0x8eda('0x9')][_0x8eda('0xa')]===0x1f4){return _0x5aa93d(_0x488849[_0x8eda('0x9')]['message']);}return _0x1b6a1d(_0x488849[_0x8eda('0x9')]['message']);}else{_0x1b6a1d(_0x488849[_0x8eda('0xb')]);}})[_0x8eda('0xc')](function(_0x2fdec0){_0x5aa93d(_0x2fdec0);});});}function respondWithResult(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xc8;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0xd')](_0x337573)[_0x8eda('0xe')](_0x3af00c);}return _0x1ad3df['sendStatus'](0x194);};}function handleError(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0x1f4;return function(_0x223dcf){logger['error'](_0x223dcf[_0x8eda('0xf')]);if(_0x223dcf[_0x8eda('0x10')]){delete _0x223dcf[_0x8eda('0x10')];}_0x500bd4['status'](_0xe04d90)[_0x8eda('0x11')](_0x223dcf);};}function findById(_0x5594ad){return function(_0xf7d764){if(!_['isNil'](_0x5594ad)&&!_[_0x8eda('0x12')](_0xf7d764)&&!_['isNil'](_0xf7d764[_0x8eda('0x13')])){return _[_0x8eda('0x14')](_0xf7d764['rows'],function(_0x5e44b7){return _0x5e44b7['id']==_0x5594ad;});}return null;};}exports[_0x8eda('0x15')]=function(_0x1b7e94,_0x1b089d){return respondWithRpcPromise(_0x8eda('0x16'),_0x1b7e94[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x1b089d,null))[_0x8eda('0xc')](handleError(_0x1b089d,null));};exports[_0x8eda('0x19')]=function(_0x850cce,_0x232786){return respondWithRpcPromise(_0x8eda('0x1a'),_['merge'](_0x850cce[_0x8eda('0x17')],_0x850cce['params']))[_0x8eda('0x18')](respondWithResult(_0x232786,null))['catch'](handleError(_0x232786,null));};exports[_0x8eda('0x1b')]=function(_0x2dab25,_0x4f3e0a){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x2dab25[_0x8eda('0x17')],_0x2dab25[_0x8eda('0x1c')]))['then'](respondWithResult(_0x4f3e0a,null))[_0x8eda('0xc')](handleError(_0x4f3e0a,null));};exports[_0x8eda('0x1d')]=function(_0x54aa7f,_0x25e955){return respondWithRpcPromise(_0x8eda('0x1e'),_0x54aa7f[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x25e955,null))[_0x8eda('0xc')](handleError(_0x25e955,null));};exports['showVoiceQueues']=function(_0x41b5a9,_0x5a8bed){return respondWithRpcPromise(_0x8eda('0x1e'),_0x41b5a9[_0x8eda('0x17')])[_0x8eda('0x18')](findById(_0x41b5a9['params']['id']))[_0x8eda('0x18')](respondWithResult(_0x5a8bed,null))[_0x8eda('0xc')](handleError(_0x5a8bed,null));};exports[_0x8eda('0x1f')]=function(_0x4cdd2e,_0x1616ea){return respondWithRpcPromise(_0x8eda('0x20'),_['merge'](_0x4cdd2e[_0x8eda('0x21')],_0x4cdd2e[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x1616ea,null))[_0x8eda('0xc')](handleError(_0x1616ea,null));};exports['voiceQueuesPreview']=function(_0x58dd55,_0x54513c){return respondWithRpcPromise(_0x8eda('0x22'),_[_0x8eda('0x23')](_0x58dd55[_0x8eda('0x17')],_0x58dd55['params']))['then'](respondWithResult(_0x54513c,null))['catch'](handleError(_0x54513c,null));};exports[_0x8eda('0x24')]=function(_0x48d52d,_0x31aaaf){return respondWithRpcPromise('VoiceQueuesChannels',_0x48d52d['query'])['then'](respondWithResult(_0x31aaaf,null))[_0x8eda('0xc')](handleError(_0x31aaaf,null));};exports[_0x8eda('0x25')]=function(_0x142f67,_0x2a3cdc){return respondWithRpcPromise(_0x8eda('0x26'),_[_0x8eda('0x23')](_0x142f67[_0x8eda('0x17')],_0x142f67[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x2a3cdc,null))[_0x8eda('0xc')](handleError(_0x2a3cdc,null));};exports[_0x8eda('0x27')]=function(_0x3132fd,_0xc354d9){return respondWithRpcPromise(_0x8eda('0x28'),_['merge'](_0x3132fd[_0x8eda('0x17')],_0x3132fd[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0xc354d9,null))['catch'](handleError(_0xc354d9,null));};exports['voiceQueuesChannelRedirect']=function(_0x41c873,_0x36dc26){return respondWithRpcPromise(_0x8eda('0x29'),_[_0x8eda('0x23')](_0x41c873['query'],_0x41c873[_0x8eda('0x1c')]))[_0x8eda('0x18')](respondWithResult(_0x36dc26,null))[_0x8eda('0xc')](handleError(_0x36dc26,null));};exports[_0x8eda('0x2a')]=function(_0x567aa6,_0x29a706){return respondWithRpcPromise('Outbound',_0x567aa6[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x29a706,null))[_0x8eda('0xc')](handleError(_0x29a706,null));};exports[_0x8eda('0x2b')]=function(_0x261e12,_0x32ce09){return respondWithRpcPromise('OutboundChannels',_0x261e12[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x32ce09,null))[_0x8eda('0xc')](handleError(_0x32ce09,null));};exports[_0x8eda('0x2c')]=function(_0xa1e556,_0x5cf565){var _0x17ee80;return respondWithRpcPromise(_0x8eda('0x2d'),_0xa1e556[_0x8eda('0x17')])['then'](function(_0x408e00){_0x17ee80=_0x408e00;return respondWithRpcPromise('Agents',_0xa1e556[_0x8eda('0x17')],routingClient);})[_0x8eda('0x18')](function(_0x42d434){return _[_0x8eda('0x23')]({},_0x42d434,_0x17ee80);})[_0x8eda('0x18')](respondWithResult(_0x5cf565,null))['catch'](handleError(_0x5cf565,null));};exports['agentCapacity']=function(_0xbf14a1,_0xfcb278){if(_0xbf14a1[_0x8eda('0x21')]&&_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]&&_0xbf14a1[_0x8eda('0x2f')]&&_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]){for(var _0x184590 in _0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')]){if(_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x8eda('0x30')](_0x184590)){db[_0x8eda('0x31')][_0x8eda('0x32')]({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')],'type':_0x8eda('0x33'),'exitAt':null,'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590]&&_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590][_0x8eda('0x34')]?{'$notIn':_0xbf14a1[_0x8eda('0x21')]['interaction'][_0x184590]}:{'$ne':null}}})[_0x8eda('0x18')](function(_0x1fff77){var _0x51f2a3=moment()[_0x8eda('0x35')](_0x8eda('0x36'));for(var _0x2a3546=0x0,_0x48ad47=_0x1fff77[_0x8eda('0x34')];_0x2a3546<_0x48ad47;_0x2a3546+=0x1){_0x1fff77[_0x2a3546][_0x8eda('0x37')]({'exitAt':_0x51f2a3});}});for(var _0x3996b7=0x0;_0x3996b7<_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x8eda('0x34')];_0x3996b7+=0x1){db[_0x8eda('0x31')]['findOrCreate']({'where':{'channel':_0x184590,'membername':_0xbf14a1[_0x8eda('0x2f')]['name'],'type':_0x8eda('0x33'),'uniqueid':_0xbf14a1['body'][_0x8eda('0x2e')][_0x184590][_0x3996b7],'exitAt':null},'defaults':{'channel':_0x184590,'membername':_0xbf14a1['user'][_0x8eda('0x10')],'interface':_['isNil'](_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')])?util[_0x8eda('0x35')](_0x8eda('0x39'),_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x10')]):_0xbf14a1[_0x8eda('0x2f')][_0x8eda('0x38')],'type':_0x8eda('0x33'),'enterAt':moment()[_0x8eda('0x35')](_0x8eda('0x36')),'role':_0x8eda('0x3a'),'internal':_0xbf14a1['user'][_0x8eda('0x3b')],'uniqueid':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x2e')][_0x184590][_0x3996b7]}});}}}}return respondWithRpcPromise(_0x8eda('0x3c'),{'id':_0xbf14a1[_0x8eda('0x1c')]['id'],'capacity':_0xbf14a1[_0x8eda('0x21')][_0x8eda('0x3d')]},routingClient)[_0x8eda('0x18')](respondWithResult(_0xfcb278,null))[_0x8eda('0xc')](handleError(_0xfcb278,null));};exports[_0x8eda('0x3e')]=function(_0x3e4242,_0x370ec2){return respondWithRpcPromise(_0x8eda('0x3f'),_0x3e4242[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0x370ec2,null))['catch'](handleError(_0x370ec2,null));};exports[_0x8eda('0x40')]=function(_0x142581,_0xabfddb){return respondWithRpcPromise(_0x8eda('0x41'),_0x142581[_0x8eda('0x17')])[_0x8eda('0x18')](respondWithResult(_0xabfddb,null))['catch'](handleError(_0xabfddb,null));};exports[_0x8eda('0x42')]=function(_0x1b4942,_0x68f9cd){return respondWithRpcPromise('Campaigns',_0x1b4942[_0x8eda('0x17')])['then'](respondWithResult(_0x68f9cd,null))[_0x8eda('0xc')](handleError(_0x68f9cd,null));};exports[_0x8eda('0x43')]=function(_0x12ccb4,_0x582e90){return respondWithRpcPromise(_0x8eda('0x44'),_0x12ccb4[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x582e90,null))['catch'](handleError(_0x582e90,null));};exports[_0x8eda('0x45')]=function(_0xd8a5ba,_0x3a3c5a){return respondWithRpcPromise(_0x8eda('0x44'),_0xd8a5ba[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](findById(_0xd8a5ba[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x3a3c5a,null))[_0x8eda('0xc')](handleError(_0x3a3c5a,null));};exports[_0x8eda('0x46')]=function(_0x482a40,_0x3a9ffb){return respondWithRpcPromise(_0x8eda('0x47'),_0x482a40['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x3a9ffb,null))['catch'](handleError(_0x3a9ffb,null));};exports['showMailQueues']=function(_0x4a3e61,_0x4a26af){return respondWithRpcPromise('MailQueues',_0x4a3e61[_0x8eda('0x17')],routingClient)['then'](findById(_0x4a3e61[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x4a26af,null))[_0x8eda('0xc')](handleError(_0x4a26af,null));};exports[_0x8eda('0x48')]=function(_0x21bd2b,_0x302d82){return respondWithRpcPromise(_0x8eda('0x49'),_0x21bd2b['query'],mailClient)[_0x8eda('0x18')](respondWithResult(_0x302d82,null))['catch'](handleError(_0x302d82,null));};exports[_0x8eda('0x4a')]=function(_0x4ba827,_0xfb98bf){return respondWithRpcPromise('OpenchannelQueues',_0x4ba827[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0xfb98bf,null))[_0x8eda('0xc')](handleError(_0xfb98bf,null));};exports['showOpenchannelQueues']=function(_0x589fbe,_0x55d642){return respondWithRpcPromise(_0x8eda('0x4b'),_0x589fbe[_0x8eda('0x17')],routingClient)['then'](findById(_0x589fbe[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x55d642,null))['catch'](handleError(_0x55d642,null));};exports[_0x8eda('0x4c')]=function(_0x375bbe,_0x284065){return respondWithRpcPromise(_0x8eda('0x4d'),_0x375bbe['query'],routingClient)['then'](respondWithResult(_0x284065,null))[_0x8eda('0xc')](handleError(_0x284065,null));};exports[_0x8eda('0x4e')]=function(_0x111177,_0x2119ce){return respondWithRpcPromise('SmsQueues',_0x111177[_0x8eda('0x17')],routingClient)['then'](findById(_0x111177[_0x8eda('0x1c')]['id']))['then'](respondWithResult(_0x2119ce,null))[_0x8eda('0xc')](handleError(_0x2119ce,null));};exports['whatsappQueues']=function(_0x437d35,_0x232e37){return respondWithRpcPromise(_0x8eda('0x4f'),_0x437d35[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x232e37,null))[_0x8eda('0xc')](handleError(_0x232e37,null));};exports[_0x8eda('0x50')]=function(_0x1dfb4f,_0xe32385){return respondWithRpcPromise('WhatsappQueues',_0x1dfb4f['query'],routingClient)[_0x8eda('0x18')](findById(_0x1dfb4f['params']['id']))[_0x8eda('0x18')](respondWithResult(_0xe32385,null))[_0x8eda('0xc')](handleError(_0xe32385,null));};exports[_0x8eda('0x51')]=function(_0x2ca608,_0x1729a8){return respondWithRpcPromise('FaxQueues',_0x2ca608['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x1729a8,null))[_0x8eda('0xc')](handleError(_0x1729a8,null));};exports[_0x8eda('0x52')]=function(_0xc6a2d8,_0x24953a){return respondWithRpcPromise(_0x8eda('0x53'),_0xc6a2d8[_0x8eda('0x17')],routingClient)['then'](findById(_0xc6a2d8[_0x8eda('0x1c')]['id']))[_0x8eda('0x18')](respondWithResult(_0x24953a,null))['catch'](handleError(_0x24953a,null));};exports[_0x8eda('0x54')]=function(_0x5467e9,_0x47f57c){return respondWithRpcPromise('FaxAccounts',_0x5467e9['query'])[_0x8eda('0x18')](respondWithResult(_0x47f57c,null))[_0x8eda('0xc')](handleError(_0x47f57c,null));};exports[_0x8eda('0x55')]=function(_0xb3bb07,_0xa3e405){return respondWithRpcPromise(_0x8eda('0x56'),_0xb3bb07['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0xa3e405,null))[_0x8eda('0xc')](handleError(_0xa3e405,null));};exports[_0x8eda('0x57')]=function(_0x3f5d3d,_0x4a1e6c){return respondWithRpcPromise(_0x8eda('0x58'),_0x3f5d3d[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4a1e6c,null))[_0x8eda('0xc')](handleError(_0x4a1e6c,null));};exports[_0x8eda('0x59')]=function(_0x3167e1,_0x4ef854){return respondWithRpcPromise(_0x8eda('0x5a'),_0x3167e1[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x4ef854,null))[_0x8eda('0xc')](handleError(_0x4ef854,null));};exports[_0x8eda('0x5b')]=function(_0x34a5c8,_0x127d98){return respondWithRpcPromise(_0x8eda('0x5a'),_0x34a5c8[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](function(_0x2bdceb){if(_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')]!==undefined){var _0x3d823e=_(_0x2bdceb['rows'])['filter']([_0x34a5c8[_0x8eda('0x17')][_0x8eda('0x5c')],_0x34a5c8[_0x8eda('0x1c')]['id']])[_0x8eda('0x5d')]('queue_id')[_0x8eda('0x5e')]()[_0x8eda('0x5f')]();return _0x2bdceb['rows'][_0x8eda('0x60')](function(_0x5f0d26){return _0x3d823e[_0x8eda('0x61')](_0x5f0d26[_0x8eda('0x62')])>-0x1;});}else{return _0x2bdceb[_0x8eda('0x13')]['filter'](function(_0x1165fc){return _0x1165fc[_0x8eda('0x62')]===parseInt(_0x34a5c8[_0x8eda('0x1c')]['id']);});}})['then'](respondWithResult(_0x127d98,null))[_0x8eda('0xc')](handleError(_0x127d98,null));};exports[_0x8eda('0x63')]=function(_0x10fcab,_0x2f30af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x10fcab['query'],routingClient)[_0x8eda('0x18')](respondWithResult(_0x2f30af,null))[_0x8eda('0xc')](handleError(_0x2f30af,null));};exports[_0x8eda('0x64')]=function(_0xd93d5,_0x49781b){return respondWithRpcPromise(_0x8eda('0x65'),_0xd93d5[_0x8eda('0x17')],routingClient)[_0x8eda('0x18')](respondWithResult(_0x49781b,null))[_0x8eda('0xc')](handleError(_0x49781b,null));};exports[_0x8eda('0x66')]=function(_0x4fb714,_0x2cec88){return respondWithRpcPromise(_0x8eda('0x67'),_0x4fb714[_0x8eda('0x17')],routingClient)['then'](respondWithResult(_0x2cec88,null))['catch'](handleError(_0x2cec88,null));};exports['queueNotify']=function(_0xcf2ef3){return function(_0x327590,_0x362b22){var _0x4751d6,_0x3c9c51;var _0x325adc=_[_0x8eda('0x68')](_0xcf2ef3);var _0x3f700a=_0xcf2ef3==='chat'?_0x8eda('0x69'):_0x8eda('0x6a');return db[_0x325adc+_0x8eda('0x6b')]['findOne']({'raw':!![],'where':{'id':_0x327590[_0x8eda('0x1c')]['id']}})[_0x8eda('0x18')](function(_0x3095bd){if(_[_0x8eda('0x12')](_0x3095bd)){throw new Error(_0x325adc+_0x8eda('0x6c'));}_0x4751d6=_0x3095bd;return db[_0x325adc+_0x8eda('0x6d')][_0x8eda('0x6e')]({'where':{'id':_0x327590[_0x8eda('0x21')][_0x8eda('0x6f')]},'include':[{'model':db[_0x325adc+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x325adc+_0x3f700a],'as':'Account'}]});})[_0x8eda('0x18')](function(_0x46c155){if(_[_0x8eda('0x12')](_0x46c155)){throw new Error(_0x325adc+_0x8eda('0x71'));}_0x3c9c51=_0x46c155;return _0x46c155[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x11cbb1={'uniqueid':_0xcf2ef3+'.'+_0x3c9c51['id']+'.'+_0x3c9c51[_0x8eda('0x70')]['id'],'FromUserId':_0x327590[_0x8eda('0x2f')]['id'],'type':_0x8eda('0x73')};_0x11cbb1[_0x325adc+_0x8eda('0x74')]=_0x3c9c51['id'];_0x11cbb1[_0x325adc+'InteractionId']=_0x3c9c51['Interaction']['id'];_0x11cbb1['From'+_0x325adc+_0x3f700a+'Id']=_0x3c9c51[_0x8eda('0x6a')]['id'];_0x11cbb1['To'+_0x325adc+_0x8eda('0x75')]=_0x4751d6['id'];return db[_0x325adc+'TransferReport'][_0x8eda('0x76')](_0x11cbb1);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0xcf2ef3,'interaction':_0x3c9c51['Interaction'],'message':_0x3c9c51,'account':_0x3c9c51[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4751d6[_0x8eda('0x10')]+','+(_0x3c9c51['Account'][_0x8eda('0x78')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})['then'](respondWithResult(_0x362b22,null))[_0x8eda('0xc')](handleError(_0x362b22,null));};};exports[_0x8eda('0x7a')]=function(_0x355d61,_0x2a1c43){var _0x128cbd,_0x1bac9f;if(_[_0x8eda('0x12')](_0x355d61[_0x8eda('0x21')][_0x8eda('0x7b')])){throw new Error(_0x8eda('0x7c'));}var _0x5566f2=_0x355d61['body']['channel'];var _0x5b64c8=_[_0x8eda('0x68')](_0x5566f2);var _0x768f3f=_0x5566f2===_0x8eda('0x7d')?'Website':_0x8eda('0x6a');return db[_0x8eda('0x7e')][_0x8eda('0x6e')]({'raw':!![],'where':{'id':_0x355d61[_0x8eda('0x1c')]['id'],'role':_0x8eda('0x3a')}})[_0x8eda('0x18')](function(_0x72184a){if(_[_0x8eda('0x12')](_0x72184a)){throw new Error('Agent\x20not\x20found');}_0x128cbd=_0x72184a;return db[_0x5b64c8+'Message'][_0x8eda('0x6e')]({'where':{'id':_0x355d61[_0x8eda('0x21')]['messageId']},'include':[{'model':db[_0x5b64c8+_0x8eda('0x70')],'as':_0x8eda('0x70')},{'model':db[_0x5b64c8+_0x768f3f],'as':_0x8eda('0x6a')}]});})['then'](function(_0x36926f){if(_[_0x8eda('0x12')](_0x36926f)){throw new Error(_0x5b64c8+_0x8eda('0x71'));}_0x1bac9f=_0x36926f;return _0x36926f[_0x8eda('0x72')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eda('0x18')](function(){var _0x3c0bc4={'uniqueid':_0x5566f2+'.'+_0x1bac9f['id']+'.'+_0x1bac9f[_0x8eda('0x70')]['id'],'FromUserId':_0x355d61['user']['id'],'type':_0x8eda('0x73'),'ToUserId':_0x128cbd['id']};_0x3c0bc4[_0x5b64c8+_0x8eda('0x74')]=_0x1bac9f['id'];_0x3c0bc4[_0x5b64c8+'InteractionId']=_0x1bac9f['Interaction']['id'];_0x3c0bc4['From'+_0x5b64c8+_0x768f3f+'Id']=_0x1bac9f[_0x8eda('0x6a')]['id'];return db[_0x5b64c8+_0x8eda('0x7f')][_0x8eda('0x76')](_0x3c0bc4);})[_0x8eda('0x18')](function(){return respondWithRpcPromise(_0x8eda('0x77'),{'channel':_0x5566f2,'interaction':_0x1bac9f[_0x8eda('0x70')],'message':_0x1bac9f,'account':_0x1bac9f[_0x8eda('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eda('0x3a'),'appdata':_0x128cbd[_0x8eda('0x10')]+','+(_0x1bac9f[_0x8eda('0x6a')][_0x8eda('0x80')]||0x12c),'interval':_0x8eda('0x79')}]},routingClient);})[_0x8eda('0x18')](respondWithResult(_0x2a1c43,null))[_0x8eda('0xc')](handleError(_0x2a1c43,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4c92f5f..eee74a6 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 _0xe4a0=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','run','post','create','put','update','delete'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xe4a0,0x152));var _0x0e4a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe4a0[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require(_0x0e4a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e4a('0x1'));var router=express[_0x0e4a('0x2')]();var fs_extra=require(_0x0e4a('0x3'));var auth=require(_0x0e4a('0x4'));var interaction=require(_0x0e4a('0x5'));var config=require(_0x0e4a('0x6'));var controller=require(_0x0e4a('0x7'));router['get']('/',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x9')]);router[_0x0e4a('0xa')](_0x0e4a('0xb'),auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xc')]);router[_0x0e4a('0xa')]('/:id/run',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xd')]);router[_0x0e4a('0xe')]('/',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0xf')]);router[_0x0e4a('0x10')]('/:id',auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x11')]);router[_0x0e4a('0x12')](_0x0e4a('0xb'),auth[_0x0e4a('0x8')](),controller[_0x0e4a('0x13')]);module[_0x0e4a('0x14')]=router; \ No newline at end of file +var _0xac5e=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','post','put','update','delete','exports'];(function(_0x18947b,_0x2613c1){var _0x2cf6d1=function(_0x365b22){while(--_0x365b22){_0x18947b['push'](_0x18947b['shift']());}};_0x2cf6d1(++_0x2613c1);}(_0xac5e,0xbe));var _0xeac5=function(_0x590942,_0x3f09cf){_0x590942=_0x590942-0x0;var _0x1f6e57=_0xac5e[_0x590942];return _0x1f6e57;};'use strict';var multer=require(_0xeac5('0x0'));var util=require(_0xeac5('0x1'));var path=require(_0xeac5('0x2'));var timeout=require(_0xeac5('0x3'));var express=require(_0xeac5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeac5('0x5'));var interaction=require(_0xeac5('0x6'));var config=require(_0xeac5('0x7'));var controller=require('./schedule.controller');router[_0xeac5('0x8')]('/',auth[_0xeac5('0x9')](),controller[_0xeac5('0xa')]);router[_0xeac5('0x8')](_0xeac5('0xb'),auth[_0xeac5('0x9')](),controller[_0xeac5('0xc')]);router['get'](_0xeac5('0xd'),auth[_0xeac5('0x9')](),controller['run']);router[_0xeac5('0xe')]('/',auth[_0xeac5('0x9')](),controller['create']);router[_0xeac5('0xf')]('/:id',auth[_0xeac5('0x9')](),controller[_0xeac5('0x10')]);router[_0xeac5('0x11')](_0xeac5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xeac5('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 09b2879..508660a 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 _0x6dc7=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','weeks','minutes','csv','pdf','custom'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x6dc7,0xd4));var _0x76dc=function(_0x573010,_0x2923c4){_0x573010=_0x573010-0x0;var _0x84c43d=_0x6dc7[_0x573010];return _0x84c43d;};'use strict';var Sequelize=require(_0x76dc('0x0'));module[_0x76dc('0x1')]={'name':{'type':Sequelize[_0x76dc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x76dc('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x76dc('0x2')],'allowNull':![],'defaultValue':_0x76dc('0x3')},'startAt':{'type':Sequelize[_0x76dc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x76dc('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x76dc('0x5')]('years',_0x76dc('0x6'),'months',_0x76dc('0x7'),'days','hours',_0x76dc('0x8')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x76dc('0x5')](_0x76dc('0x9'),_0x76dc('0xa'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x76dc('0x5')]('custom','default'),'allowNull':![],'defaultValue':_0x76dc('0xb')},'sendMail':{'type':Sequelize[_0x76dc('0xc')],'defaultValue':![]},'email':{'type':Sequelize[_0x76dc('0x2')]},'cc':{'type':Sequelize[_0x76dc('0xd')]},'bcc':{'type':Sequelize[_0x76dc('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x76dc('0xc')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4036=['custom','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','hours','minutes','days','pdf','xlsx'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x4036,0x1e2));var _0x6403=function(_0x3cc5fd,_0x569445){_0x3cc5fd=_0x3cc5fd-0x0;var _0x31c92e=_0x4036[_0x3cc5fd];return _0x31c92e;};'use strict';var Sequelize=require('sequelize');module[_0x6403('0x0')]={'name':{'type':Sequelize[_0x6403('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6403('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6403('0x1')],'allowNull':![],'defaultValue':_0x6403('0x2')},'startAt':{'type':Sequelize[_0x6403('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x6403('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x6403('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6403('0x5')]('years',_0x6403('0x6'),_0x6403('0x7'),_0x6403('0x8'),'days',_0x6403('0x9'),_0x6403('0xa')),'allowNull':![],'defaultValue':_0x6403('0xb')},'output':{'type':Sequelize[_0x6403('0x5')]('csv',_0x6403('0xc'),_0x6403('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x6403('0x5')](_0x6403('0xe'),'default'),'allowNull':![],'defaultValue':_0x6403('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6403('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 57b4cf7..6707d3a 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 _0x6d23=['options','Schedule','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','update','run','../../config/schedule','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','index','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','name'];(function(_0x30bcc0,_0x311904){var _0x2cf768=function(_0x28dbd2){while(--_0x28dbd2){_0x30bcc0['push'](_0x30bcc0['shift']());}};_0x2cf768(++_0x311904);}(_0x6d23,0x68));var _0x36d2=function(_0x216cb4,_0x26e051){_0x216cb4=_0x216cb4-0x0;var _0x303c7b=_0x6d23[_0x216cb4];return _0x303c7b;};'use strict';var emlformat=require(_0x36d2('0x0'));var rimraf=require(_0x36d2('0x1'));var zipdir=require(_0x36d2('0x2'));var jsonpatch=require(_0x36d2('0x3'));var rp=require('request-promise');var moment=require(_0x36d2('0x4'));var BPromise=require(_0x36d2('0x5'));var Mustache=require(_0x36d2('0x6'));var util=require(_0x36d2('0x7'));var path=require(_0x36d2('0x8'));var sox=require(_0x36d2('0x9'));var csv=require(_0x36d2('0xa'));var ejs=require(_0x36d2('0xb'));var fs=require('fs');var fs_extra=require(_0x36d2('0xc'));var _=require(_0x36d2('0xd'));var squel=require(_0x36d2('0xe'));var crypto=require(_0x36d2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x36d2('0x10'));var toCsv=require(_0x36d2('0xa'));var querystring=require(_0x36d2('0x11'));var Papa=require(_0x36d2('0x12'));var Redis=require(_0x36d2('0x13'));var authService=require(_0x36d2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x36d2('0x15'));var hardwareService=require(_0x36d2('0x16'));var logger=require(_0x36d2('0x17'))(_0x36d2('0x18'));var utils=require('../../config/utils');var config=require(_0x36d2('0x19'));var licenseUtil=require(_0x36d2('0x1a'));var db=require(_0x36d2('0x1b'))['db'];function respondWithStatusCode(_0x422e2b,_0x4d4fe9){_0x4d4fe9=_0x4d4fe9||0xcc;return function(_0x7a0de1){if(_0x7a0de1){return _0x422e2b[_0x36d2('0x1c')](_0x4d4fe9);}return _0x422e2b[_0x36d2('0x1d')](_0x4d4fe9)[_0x36d2('0x1e')]();};}function respondWithResult(_0x23c071,_0x5573b6){_0x5573b6=_0x5573b6||0xc8;return function(_0x2fa0cc){if(_0x2fa0cc){return _0x23c071[_0x36d2('0x1d')](_0x5573b6)[_0x36d2('0x1f')](_0x2fa0cc);}};}function respondWithFilteredResult(_0x140c3e,_0x2f27ce){return function(_0x315464){if(_0x315464){var _0x2df13e=typeof _0x2f27ce[_0x36d2('0x20')]===_0x36d2('0x21')&&typeof _0x2f27ce[_0x36d2('0x22')]===_0x36d2('0x21');var _0x54e511=_0x315464['count'];var _0x21840b=_0x2df13e?0x0:_0x2f27ce[_0x36d2('0x20')];var _0x1e4767=_0x2df13e?_0x315464[_0x36d2('0x23')]:_0x2f27ce[_0x36d2('0x20')]+_0x2f27ce[_0x36d2('0x22')];var _0xe173b7;if(_0x1e4767>=_0x54e511){_0x1e4767=_0x54e511;_0xe173b7=0xc8;}else{_0xe173b7=0xce;}_0x140c3e[_0x36d2('0x1d')](_0xe173b7);return _0x140c3e[_0x36d2('0x24')](_0x36d2('0x25'),_0x21840b+'-'+_0x1e4767+'/'+_0x54e511)['json'](_0x315464);}return null;};}function patchUpdates(_0x1c8be3){return function(_0x1e9ad1){try{jsonpatch['apply'](_0x1e9ad1,_0x1c8be3,!![]);}catch(_0x1ccd6f){return BPromise[_0x36d2('0x26')](_0x1ccd6f);}return _0x1e9ad1[_0x36d2('0x27')]();};}function saveUpdates(_0xc33cb5,_0x38a141){return function(_0x1d520d){if(_0x1d520d){return _0x1d520d['update'](_0xc33cb5)[_0x36d2('0x28')](function(_0x201a02){return _0x201a02;});}return null;};}function removeEntity(_0x50729e,_0x164495){return function(_0x22ee6e){if(_0x22ee6e){return _0x22ee6e[_0x36d2('0x29')]()[_0x36d2('0x28')](function(){var _0xfc59db=_0x22ee6e[_0x36d2('0x2a')]({'plain':!![]});var _0x5e8c4a=_0x36d2('0x2b');return db[_0x36d2('0x2c')]['destroy']({'where':{'type':_0x5e8c4a,'resourceId':_0xfc59db['id']}})[_0x36d2('0x28')](function(){return _0x22ee6e;});})[_0x36d2('0x28')](function(){_0x50729e[_0x36d2('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517f31,_0x47d142){return function(_0x55eb14){if(!_0x55eb14){_0x517f31[_0x36d2('0x1c')](0x194);}return _0x55eb14;};}function handleError(_0x5ebfc6,_0x1a76ce){_0x1a76ce=_0x1a76ce||0x1f4;return function(_0x2f9e9f){logger[_0x36d2('0x2d')](_0x2f9e9f['stack']);if(_0x2f9e9f['name']){delete _0x2f9e9f['name'];}_0x5ebfc6[_0x36d2('0x1d')](_0x1a76ce)['send'](_0x2f9e9f);};}exports[_0x36d2('0x2e')]=function(_0x1fc430,_0x152170){var _0x4c4fba={},_0x2215cc={},_0x718d73={'count':0x0,'rows':[]};var _0x5891c3=_[_0x36d2('0x2f')](db['Schedule'][_0x36d2('0x30')],function(_0x3f7493){return{'name':_0x3f7493[_0x36d2('0x31')],'type':_0x3f7493['type']['key']};});_0x2215cc['model']=_['map'](_0x5891c3,'name');_0x2215cc[_0x36d2('0x32')]=_[_0x36d2('0x33')](_0x1fc430[_0x36d2('0x32')]);_0x2215cc[_0x36d2('0x34')]=_['intersection'](_0x2215cc[_0x36d2('0x35')],_0x2215cc[_0x36d2('0x32')]);_0x4c4fba[_0x36d2('0x36')]=_[_0x36d2('0x37')](_0x2215cc['model'],qs[_0x36d2('0x38')](_0x1fc430['query'][_0x36d2('0x38')]));_0x4c4fba[_0x36d2('0x36')]=_0x4c4fba[_0x36d2('0x36')][_0x36d2('0x39')]?_0x4c4fba[_0x36d2('0x36')]:_0x2215cc[_0x36d2('0x35')];if(!_0x1fc430['query'][_0x36d2('0x3a')]('nolimit')){_0x4c4fba[_0x36d2('0x22')]=qs['limit'](_0x1fc430['query']['limit']);_0x4c4fba[_0x36d2('0x20')]=qs[_0x36d2('0x20')](_0x1fc430[_0x36d2('0x32')][_0x36d2('0x20')]);}_0x4c4fba[_0x36d2('0x3b')]=qs[_0x36d2('0x3c')](_0x1fc430[_0x36d2('0x32')][_0x36d2('0x3c')]);_0x4c4fba['where']=qs[_0x36d2('0x34')](_['pick'](_0x1fc430[_0x36d2('0x32')],_0x2215cc['filters']),_0x5891c3);if(_0x1fc430[_0x36d2('0x32')][_0x36d2('0x3d')]){_0x4c4fba['where']=_[_0x36d2('0x3e')](_0x4c4fba[_0x36d2('0x3f')],{'$or':_[_0x36d2('0x2f')](_0x5891c3,function(_0x542da2){if(_0x542da2['type']!==_0x36d2('0x40')){var _0x991451={};_0x991451[_0x542da2[_0x36d2('0x41')]]={'$like':'%'+_0x1fc430['query'][_0x36d2('0x3d')]+'%'};return _0x991451;}})});}_0x4c4fba=_[_0x36d2('0x3e')]({},_0x4c4fba,_0x1fc430[_0x36d2('0x42')]);var _0x1fb5d2={'where':_0x4c4fba[_0x36d2('0x3f')]};return db[_0x36d2('0x43')]['count'](_0x1fb5d2)[_0x36d2('0x28')](function(_0x538433){_0x718d73[_0x36d2('0x23')]=_0x538433;if(_0x1fc430[_0x36d2('0x32')][_0x36d2('0x44')]){_0x4c4fba[_0x36d2('0x45')]=[{'all':!![]}];}return db[_0x36d2('0x43')][_0x36d2('0x46')](_0x4c4fba);})[_0x36d2('0x28')](function(_0x1f2d12){_0x718d73[_0x36d2('0x47')]=_0x1f2d12;return _0x718d73;})[_0x36d2('0x28')](respondWithFilteredResult(_0x152170,_0x4c4fba))[_0x36d2('0x48')](handleError(_0x152170,null));};exports[_0x36d2('0x49')]=function(_0x4501da,_0x318552){var _0x41e7e3={'raw':![],'where':{'id':_0x4501da[_0x36d2('0x4a')]['id']}},_0x224fc9={};_0x224fc9[_0x36d2('0x35')]=_[_0x36d2('0x33')](db['Schedule'][_0x36d2('0x30')]);_0x224fc9[_0x36d2('0x32')]=_[_0x36d2('0x33')](_0x4501da[_0x36d2('0x32')]);_0x224fc9['filters']=_[_0x36d2('0x37')](_0x224fc9['model'],_0x224fc9[_0x36d2('0x32')]);_0x41e7e3[_0x36d2('0x36')]=_[_0x36d2('0x37')](_0x224fc9[_0x36d2('0x35')],qs[_0x36d2('0x38')](_0x4501da[_0x36d2('0x32')][_0x36d2('0x38')]));_0x41e7e3['attributes']=_0x41e7e3[_0x36d2('0x36')]['length']?_0x41e7e3[_0x36d2('0x36')]:_0x224fc9[_0x36d2('0x35')];if(_0x4501da[_0x36d2('0x32')][_0x36d2('0x44')]){_0x41e7e3[_0x36d2('0x45')]=[{'all':!![]}];}_0x41e7e3=_[_0x36d2('0x3e')]({},_0x41e7e3,_0x4501da['options']);return db['Schedule'][_0x36d2('0x4b')](_0x41e7e3)[_0x36d2('0x28')](handleEntityNotFound(_0x318552,null))['then'](respondWithResult(_0x318552,null))[_0x36d2('0x48')](handleError(_0x318552,null));};exports[_0x36d2('0x4c')]=function(_0x5c7daf,_0x5088e){return db[_0x36d2('0x43')][_0x36d2('0x4c')](_0x5c7daf[_0x36d2('0x4d')],{})['then'](function(_0x5d2d0d){var _0x3eafbc=_0x5c7daf[_0x36d2('0x4e')][_0x36d2('0x2a')]({'plain':!![]});if(!_0x3eafbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3eafbc[_0x36d2('0x4f')]==='user'){var _0x4faa5d=_0x5d2d0d[_0x36d2('0x2a')]({'plain':!![]});var _0x4e5a55=_0x36d2('0x2b');return db[_0x36d2('0x50')][_0x36d2('0x4b')]({'where':{'name':_0x4e5a55,'userProfileId':_0x3eafbc['userProfileId']},'raw':!![]})[_0x36d2('0x28')](function(_0x5766e1){if(_0x5766e1&&_0x5766e1[_0x36d2('0x51')]===0x0){return db[_0x36d2('0x2c')]['create']({'name':_0x4faa5d[_0x36d2('0x41')],'resourceId':_0x4faa5d['id'],'type':_0x5766e1[_0x36d2('0x41')],'sectionId':_0x5766e1['id']},{})['then'](function(){return _0x5d2d0d;});}else{return _0x5d2d0d;}})[_0x36d2('0x48')](function(_0x32db4f){logger[_0x36d2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32db4f);throw _0x32db4f;});}return _0x5d2d0d;})[_0x36d2('0x28')](respondWithResult(_0x5088e,0xc9))[_0x36d2('0x48')](handleError(_0x5088e,null));};exports[_0x36d2('0x52')]=function(_0x3af162,_0x1f5153){if(_0x3af162[_0x36d2('0x4d')]['id']){delete _0x3af162[_0x36d2('0x4d')]['id'];}return db[_0x36d2('0x43')][_0x36d2('0x4b')]({'where':{'id':_0x3af162[_0x36d2('0x4a')]['id']}})[_0x36d2('0x28')](handleEntityNotFound(_0x1f5153,null))['then'](saveUpdates(_0x3af162[_0x36d2('0x4d')],null))[_0x36d2('0x28')](respondWithResult(_0x1f5153,null))['catch'](handleError(_0x1f5153,null));};exports[_0x36d2('0x29')]=function(_0x113c52,_0x4af8e6){return db['Schedule'][_0x36d2('0x4b')]({'where':{'id':_0x113c52[_0x36d2('0x4a')]['id']}})[_0x36d2('0x28')](handleEntityNotFound(_0x4af8e6,null))['then'](removeEntity(_0x4af8e6,null))[_0x36d2('0x48')](handleError(_0x4af8e6,null));};exports[_0x36d2('0x53')]=function(_0xd13185,_0x4604f8,_0x47e7b6){var _0x21bc12=require(_0x36d2('0x54'));return db[_0x36d2('0x43')][_0x36d2('0x4b')]({'where':{'id':_0xd13185[_0x36d2('0x4a')]['id']},'raw':!![]})[_0x36d2('0x28')](handleEntityNotFound(_0x4604f8,null))[_0x36d2('0x28')](function(){_0x21bc12[_0x36d2('0x53')](_0xd13185['params']['id']);})[_0x36d2('0x28')](respondWithStatusCode(_0x4604f8,null))['catch'](handleError(_0x4604f8,null));}; \ No newline at end of file +var _0x5d6d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','destroy','then','get','Scheduler','error','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','Schedule','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2d165f,_0x16631d){var _0x5b1b19=function(_0x48fc26){while(--_0x48fc26){_0x2d165f['push'](_0x2d165f['shift']());}};_0x5b1b19(++_0x16631d);}(_0x5d6d,0x140));var _0xd5d6=function(_0x2b1880,_0x5c00c7){_0x2b1880=_0x2b1880-0x0;var _0x3a9b9d=_0x5d6d[_0x2b1880];return _0x3a9b9d;};'use strict';var emlformat=require(_0xd5d6('0x0'));var rimraf=require(_0xd5d6('0x1'));var zipdir=require(_0xd5d6('0x2'));var jsonpatch=require(_0xd5d6('0x3'));var rp=require(_0xd5d6('0x4'));var moment=require(_0xd5d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd5d6('0x6'));var util=require(_0xd5d6('0x7'));var path=require(_0xd5d6('0x8'));var sox=require(_0xd5d6('0x9'));var csv=require('to-csv');var ejs=require(_0xd5d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5d6('0xb'));var squel=require(_0xd5d6('0xc'));var crypto=require('crypto');var jsforce=require(_0xd5d6('0xd'));var deskjs=require(_0xd5d6('0xe'));var toCsv=require(_0xd5d6('0xf'));var querystring=require(_0xd5d6('0x10'));var Papa=require(_0xd5d6('0x11'));var Redis=require(_0xd5d6('0x12'));var authService=require(_0xd5d6('0x13'));var qs=require(_0xd5d6('0x14'));var as=require(_0xd5d6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5d6('0x16'))(_0xd5d6('0x17'));var utils=require('../../config/utils');var config=require(_0xd5d6('0x18'));var licenseUtil=require(_0xd5d6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa85213,_0x4559d6){_0x4559d6=_0x4559d6||0xcc;return function(_0x250e45){if(_0x250e45){return _0xa85213[_0xd5d6('0x1a')](_0x4559d6);}return _0xa85213[_0xd5d6('0x1b')](_0x4559d6)[_0xd5d6('0x1c')]();};}function respondWithResult(_0x23b2b3,_0x218510){_0x218510=_0x218510||0xc8;return function(_0x2d73ff){if(_0x2d73ff){return _0x23b2b3[_0xd5d6('0x1b')](_0x218510)['json'](_0x2d73ff);}};}function respondWithFilteredResult(_0x3c5ab0,_0x20d4d6){return function(_0x22b5b0){if(_0x22b5b0){var _0x25cb62=typeof _0x20d4d6['offset']===_0xd5d6('0x1d')&&typeof _0x20d4d6[_0xd5d6('0x1e')]===_0xd5d6('0x1d');var _0x29eb63=_0x22b5b0[_0xd5d6('0x1f')];var _0x9b4e21=_0x25cb62?0x0:_0x20d4d6[_0xd5d6('0x20')];var _0xff099b=_0x25cb62?_0x22b5b0['count']:_0x20d4d6[_0xd5d6('0x20')]+_0x20d4d6[_0xd5d6('0x1e')];var _0x292453;if(_0xff099b>=_0x29eb63){_0xff099b=_0x29eb63;_0x292453=0xc8;}else{_0x292453=0xce;}_0x3c5ab0[_0xd5d6('0x1b')](_0x292453);return _0x3c5ab0['set'](_0xd5d6('0x21'),_0x9b4e21+'-'+_0xff099b+'/'+_0x29eb63)[_0xd5d6('0x22')](_0x22b5b0);}return null;};}function patchUpdates(_0x37f226){return function(_0x4f3e8a){try{jsonpatch['apply'](_0x4f3e8a,_0x37f226,!![]);}catch(_0x54e2a0){return BPromise[_0xd5d6('0x23')](_0x54e2a0);}return _0x4f3e8a[_0xd5d6('0x24')]();};}function saveUpdates(_0x4deeaf,_0x5aef19){return function(_0x52d315){if(_0x52d315){return _0x52d315[_0xd5d6('0x25')](_0x4deeaf)['then'](function(_0x319758){return _0x319758;});}return null;};}function removeEntity(_0x2e75e5,_0x580bbf){return function(_0x2300b6){if(_0x2300b6){return _0x2300b6[_0xd5d6('0x26')]()[_0xd5d6('0x27')](function(){var _0x387fc7=_0x2300b6[_0xd5d6('0x28')]({'plain':!![]});var _0x434085=_0xd5d6('0x29');return db['UserProfileResource'][_0xd5d6('0x26')]({'where':{'type':_0x434085,'resourceId':_0x387fc7['id']}})[_0xd5d6('0x27')](function(){return _0x2300b6;});})[_0xd5d6('0x27')](function(){_0x2e75e5[_0xd5d6('0x1b')](0xcc)[_0xd5d6('0x1c')]();});}};}function handleEntityNotFound(_0x213b29,_0x58391e){return function(_0x530988){if(!_0x530988){_0x213b29[_0xd5d6('0x1a')](0x194);}return _0x530988;};}function handleError(_0x1da15b,_0x151488){_0x151488=_0x151488||0x1f4;return function(_0x35f100){logger[_0xd5d6('0x2a')](_0x35f100['stack']);if(_0x35f100[_0xd5d6('0x2b')]){delete _0x35f100[_0xd5d6('0x2b')];}_0x1da15b[_0xd5d6('0x1b')](_0x151488)['send'](_0x35f100);};}exports[_0xd5d6('0x2c')]=function(_0x53c373,_0x1b1bfc){var _0x392287={},_0x126f34={},_0x313e4e={'count':0x0,'rows':[]};var _0x34dd4d=_[_0xd5d6('0x2d')](db['Schedule'][_0xd5d6('0x2e')],function(_0x30d020){return{'name':_0x30d020[_0xd5d6('0x2f')],'type':_0x30d020[_0xd5d6('0x30')]['key']};});_0x126f34['model']=_[_0xd5d6('0x2d')](_0x34dd4d,'name');_0x126f34[_0xd5d6('0x31')]=_[_0xd5d6('0x32')](_0x53c373[_0xd5d6('0x31')]);_0x126f34[_0xd5d6('0x33')]=_[_0xd5d6('0x34')](_0x126f34[_0xd5d6('0x35')],_0x126f34[_0xd5d6('0x31')]);_0x392287['attributes']=_[_0xd5d6('0x34')](_0x126f34['model'],qs['fields'](_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x36')]));_0x392287['attributes']=_0x392287[_0xd5d6('0x37')][_0xd5d6('0x38')]?_0x392287[_0xd5d6('0x37')]:_0x126f34[_0xd5d6('0x35')];if(!_0x53c373['query'][_0xd5d6('0x39')]('nolimit')){_0x392287[_0xd5d6('0x1e')]=qs[_0xd5d6('0x1e')](_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x1e')]);_0x392287['offset']=qs[_0xd5d6('0x20')](_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x20')]);}_0x392287[_0xd5d6('0x3a')]=qs[_0xd5d6('0x3b')](_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x3b')]);_0x392287[_0xd5d6('0x3c')]=qs[_0xd5d6('0x33')](_[_0xd5d6('0x3d')](_0x53c373[_0xd5d6('0x31')],_0x126f34[_0xd5d6('0x33')]),_0x34dd4d);if(_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x3e')]){_0x392287[_0xd5d6('0x3c')]=_['merge'](_0x392287[_0xd5d6('0x3c')],{'$or':_[_0xd5d6('0x2d')](_0x34dd4d,function(_0x3546fd){if(_0x3546fd['type']!==_0xd5d6('0x3f')){var _0x30d0f0={};_0x30d0f0[_0x3546fd[_0xd5d6('0x2b')]]={'$like':'%'+_0x53c373[_0xd5d6('0x31')][_0xd5d6('0x3e')]+'%'};return _0x30d0f0;}})});}_0x392287=_['merge']({},_0x392287,_0x53c373['options']);var _0x413891={'where':_0x392287[_0xd5d6('0x3c')]};return db[_0xd5d6('0x40')]['count'](_0x413891)[_0xd5d6('0x27')](function(_0x1afeea){_0x313e4e['count']=_0x1afeea;if(_0x53c373['query'][_0xd5d6('0x41')]){_0x392287[_0xd5d6('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xd5d6('0x43')](_0x392287);})['then'](function(_0x355a70){_0x313e4e[_0xd5d6('0x44')]=_0x355a70;return _0x313e4e;})[_0xd5d6('0x27')](respondWithFilteredResult(_0x1b1bfc,_0x392287))[_0xd5d6('0x45')](handleError(_0x1b1bfc,null));};exports[_0xd5d6('0x46')]=function(_0x1c4500,_0x38de6b){var _0x37daf5={'raw':![],'where':{'id':_0x1c4500[_0xd5d6('0x47')]['id']}},_0xbc94a={};_0xbc94a[_0xd5d6('0x35')]=_[_0xd5d6('0x32')](db[_0xd5d6('0x40')][_0xd5d6('0x2e')]);_0xbc94a[_0xd5d6('0x31')]=_[_0xd5d6('0x32')](_0x1c4500[_0xd5d6('0x31')]);_0xbc94a[_0xd5d6('0x33')]=_[_0xd5d6('0x34')](_0xbc94a[_0xd5d6('0x35')],_0xbc94a[_0xd5d6('0x31')]);_0x37daf5[_0xd5d6('0x37')]=_['intersection'](_0xbc94a[_0xd5d6('0x35')],qs['fields'](_0x1c4500[_0xd5d6('0x31')][_0xd5d6('0x36')]));_0x37daf5[_0xd5d6('0x37')]=_0x37daf5[_0xd5d6('0x37')][_0xd5d6('0x38')]?_0x37daf5[_0xd5d6('0x37')]:_0xbc94a[_0xd5d6('0x35')];if(_0x1c4500[_0xd5d6('0x31')][_0xd5d6('0x41')]){_0x37daf5[_0xd5d6('0x42')]=[{'all':!![]}];}_0x37daf5=_[_0xd5d6('0x48')]({},_0x37daf5,_0x1c4500[_0xd5d6('0x49')]);return db['Schedule'][_0xd5d6('0x4a')](_0x37daf5)['then'](handleEntityNotFound(_0x38de6b,null))[_0xd5d6('0x27')](respondWithResult(_0x38de6b,null))[_0xd5d6('0x45')](handleError(_0x38de6b,null));};exports[_0xd5d6('0x4b')]=function(_0x5670b0,_0x246431){return db[_0xd5d6('0x40')]['create'](_0x5670b0[_0xd5d6('0x4c')],{})['then'](function(_0x5e78c0){var _0xadc775=_0x5670b0['user'][_0xd5d6('0x28')]({'plain':!![]});if(!_0xadc775)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadc775[_0xd5d6('0x4d')]===_0xd5d6('0x4e')){var _0x1759fe=_0x5e78c0[_0xd5d6('0x28')]({'plain':!![]});var _0x3c3be3='Scheduler';return db[_0xd5d6('0x4f')]['find']({'where':{'name':_0x3c3be3,'userProfileId':_0xadc775['userProfileId']},'raw':!![]})[_0xd5d6('0x27')](function(_0x272c11){if(_0x272c11&&_0x272c11[_0xd5d6('0x50')]===0x0){return db[_0xd5d6('0x51')][_0xd5d6('0x4b')]({'name':_0x1759fe[_0xd5d6('0x2b')],'resourceId':_0x1759fe['id'],'type':_0x272c11[_0xd5d6('0x2b')],'sectionId':_0x272c11['id']},{})[_0xd5d6('0x27')](function(){return _0x5e78c0;});}else{return _0x5e78c0;}})[_0xd5d6('0x45')](function(_0x576694){logger[_0xd5d6('0x2a')](_0xd5d6('0x52'),_0x576694);throw _0x576694;});}return _0x5e78c0;})[_0xd5d6('0x27')](respondWithResult(_0x246431,0xc9))[_0xd5d6('0x45')](handleError(_0x246431,null));};exports[_0xd5d6('0x25')]=function(_0x38db3d,_0x1ab25d){if(_0x38db3d['body']['id']){delete _0x38db3d[_0xd5d6('0x4c')]['id'];}return db[_0xd5d6('0x40')][_0xd5d6('0x4a')]({'where':{'id':_0x38db3d['params']['id']}})['then'](handleEntityNotFound(_0x1ab25d,null))[_0xd5d6('0x27')](saveUpdates(_0x38db3d[_0xd5d6('0x4c')],null))[_0xd5d6('0x27')](respondWithResult(_0x1ab25d,null))[_0xd5d6('0x45')](handleError(_0x1ab25d,null));};exports['destroy']=function(_0x3ae340,_0x163078){return db[_0xd5d6('0x40')][_0xd5d6('0x4a')]({'where':{'id':_0x3ae340[_0xd5d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x163078,null))[_0xd5d6('0x27')](removeEntity(_0x163078,null))['catch'](handleError(_0x163078,null));};exports[_0xd5d6('0x53')]=function(_0x23ba0f,_0x551834,_0x311091){var _0x41bf59=require(_0xd5d6('0x54'));return db[_0xd5d6('0x40')][_0xd5d6('0x4a')]({'where':{'id':_0x23ba0f[_0xd5d6('0x47')]['id']},'raw':!![]})[_0xd5d6('0x27')](handleEntityNotFound(_0x551834,null))[_0xd5d6('0x27')](function(){_0x41bf59[_0xd5d6('0x53')](_0x23ba0f[_0xd5d6('0x47')]['id']);})[_0xd5d6('0x27')](respondWithStatusCode(_0x551834,null))[_0xd5d6('0x45')](handleError(_0x551834,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a434022..6cc48a9 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 _0xd8f9=['path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','../../config/logger','api','bluebird'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd8f9,0x10b));var _0x9d8f=function(_0xa9e95e,_0x384135){_0xa9e95e=_0xa9e95e-0x0;var _0xee0cc=_0xd8f9[_0xa9e95e];return _0xee0cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d8f('0x0'))(_0x9d8f('0x1'));var moment=require('moment');var BPromise=require(_0x9d8f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d8f('0x3'));var rimraf=require(_0x9d8f('0x4'));var config=require(_0x9d8f('0x5'));var attributes=require(_0x9d8f('0x6'));module[_0x9d8f('0x7')]=function(_0x429677,_0x5cdf66){return _0x429677['define'](_0x9d8f('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29ee=['./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x5d7dc8,_0x14a0fc){var _0x4b99bb=function(_0x13349c){while(--_0x13349c){_0x5d7dc8['push'](_0x5d7dc8['shift']());}};_0x4b99bb(++_0x14a0fc);}(_0x29ee,0x7d));var _0xe29e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x29ee[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xe29e('0x0'));var util=require(_0xe29e('0x1'));var logger=require(_0xe29e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe29e('0x3'));var rp=require(_0xe29e('0x4'));var fs=require('fs');var path=require(_0xe29e('0x5'));var rimraf=require('rimraf');var config=require(_0xe29e('0x6'));var attributes=require(_0xe29e('0x7'));module[_0xe29e('0x8')]=function(_0xc9941,_0x1c42f5){return _0xc9941[_0xe29e('0x9')](_0xe29e('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 795358c..e4f71a3 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 _0xa51a=['Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa51a,0x1ec));var _0xaa51=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa51a[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xaa51('0x0'));var util=require(_0xaa51('0x1'));var moment=require(_0xaa51('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa51('0x3'));var fs=require('fs');var Redis=require(_0xaa51('0x4'));var db=require(_0xaa51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa51('0x6'))(_0xaa51('0x7'));var config=require(_0xaa51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa51('0x9')][_0xaa51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c81f,_0x3d58ae,_0x507c37){return new BPromise(function(_0x3d5964,_0x21591d){return client[_0xaa51('0xb')](_0x18c81f,_0x507c37)[_0xaa51('0xc')](function(_0x2e6ba2){logger[_0xaa51('0xd')](_0xaa51('0xe'),_0x3d58ae,'request\x20sent');logger[_0xaa51('0xf')](_0xaa51('0x10'),_0x3d58ae,'request\x20sent',JSON[_0xaa51('0x11')](_0x2e6ba2));if(_0x2e6ba2[_0xaa51('0x12')]){if(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x13')]===0x1f4){logger[_0xaa51('0x12')](_0xaa51('0xe'),_0x3d58ae,_0x2e6ba2[_0xaa51('0x12')]['message']);return _0x21591d(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);}logger[_0xaa51('0x12')]('Schedule,\x20%s,\x20%s',_0x3d58ae,_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);return _0x3d5964(_0x2e6ba2[_0xaa51('0x12')][_0xaa51('0x14')]);}else{logger[_0xaa51('0xd')](_0xaa51('0xe'),_0x3d58ae,_0xaa51('0x15'));_0x3d5964(_0x2e6ba2[_0xaa51('0x16')]['message']);}})['catch'](function(_0x3c2675){logger['error'](_0xaa51('0xe'),_0x3d58ae,_0x3c2675);_0x21591d(_0x3c2675);});});} \ No newline at end of file +var _0x88f6=['message','result','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x88f6,0xca));var _0x688f=function(_0x445585,_0xa456b){_0x445585=_0x445585-0x0;var _0x322d6a=_0x88f6[_0x445585];return _0x322d6a;};'use strict';var _=require('lodash');var util=require(_0x688f('0x0'));var moment=require(_0x688f('0x1'));var BPromise=require(_0x688f('0x2'));var rs=require(_0x688f('0x3'));var fs=require('fs');var Redis=require(_0x688f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x688f('0x5'));var config=require('../../config/environment');var jayson=require(_0x688f('0x6'));var client=jayson[_0x688f('0x7')][_0x688f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f54da,_0x3c138a,_0x2d9865){return new BPromise(function(_0x5d2f07,_0x417f4a){return client[_0x688f('0x9')](_0x5f54da,_0x2d9865)[_0x688f('0xa')](function(_0x1223a3){logger[_0x688f('0xb')](_0x688f('0xc'),_0x3c138a,_0x688f('0xd'));logger[_0x688f('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3c138a,_0x688f('0xd'),JSON[_0x688f('0xf')](_0x1223a3));if(_0x1223a3['error']){if(_0x1223a3['error'][_0x688f('0x10')]===0x1f4){logger['error'](_0x688f('0xc'),_0x3c138a,_0x1223a3[_0x688f('0x11')][_0x688f('0x12')]);return _0x417f4a(_0x1223a3[_0x688f('0x11')][_0x688f('0x12')]);}logger[_0x688f('0x11')](_0x688f('0xc'),_0x3c138a,_0x1223a3[_0x688f('0x11')][_0x688f('0x12')]);return _0x5d2f07(_0x1223a3['error']['message']);}else{logger[_0x688f('0xb')](_0x688f('0xc'),_0x3c138a,'request\x20sent');_0x5d2f07(_0x1223a3[_0x688f('0x13')][_0x688f('0x12')]);}})['catch'](function(_0x39ad3e){logger[_0x688f('0x11')](_0x688f('0xc'),_0x3c138a,_0x39ad3e);_0x417f4a(_0x39ad3e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f71a761..cb01066 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 _0xea55=['show','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1546c2,_0x22e822){var _0x24583c=function(_0x3906f8){while(--_0x3906f8){_0x1546c2['push'](_0x1546c2['shift']());}};_0x24583c(++_0x22e822);}(_0xea55,0x105));var _0x5ea5=function(_0x197080,_0xe79f73){_0x197080=_0x197080-0x0;var _0x1b3669=_0xea55[_0x197080];return _0x1b3669;};'use strict';var multer=require(_0x5ea5('0x0'));var util=require(_0x5ea5('0x1'));var path=require(_0x5ea5('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ea5('0x3'));var router=express['Router']();var fs_extra=require(_0x5ea5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ea5('0x5'));var controller=require('./screenRecording.controller');router[_0x5ea5('0x6')]('/',auth['isAuthenticated'](),controller[_0x5ea5('0x7')]);router[_0x5ea5('0x6')](_0x5ea5('0x8'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xa')]);router['get'](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0xc')]);router[_0x5ea5('0x6')](_0x5ea5('0xd'),auth['isAuthenticated'](),controller[_0x5ea5('0xe')]);router[_0x5ea5('0xf')]('/',auth[_0x5ea5('0x9')](),controller['create']);router[_0x5ea5('0x10')]('/:id',auth[_0x5ea5('0x9')](),controller[_0x5ea5('0x11')]);router[_0x5ea5('0x12')](_0x5ea5('0xb'),auth[_0x5ea5('0x9')](),controller[_0x5ea5('0x13')]);module[_0x5ea5('0x14')]=router; \ No newline at end of file +var _0x3152=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x49f795,_0x89dea1){var _0x5a4d7d=function(_0x547b0d){while(--_0x547b0d){_0x49f795['push'](_0x49f795['shift']());}};_0x5a4d7d(++_0x89dea1);}(_0x3152,0x147));var _0x2315=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3152[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0x2315('0x0'));var util=require(_0x2315('0x1'));var path=require(_0x2315('0x2'));var timeout=require(_0x2315('0x3'));var express=require(_0x2315('0x4'));var router=express['Router']();var fs_extra=require(_0x2315('0x5'));var auth=require(_0x2315('0x6'));var interaction=require(_0x2315('0x7'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x2315('0x8')](),controller[_0x2315('0x9')]);router['get'](_0x2315('0xa'),auth[_0x2315('0x8')](),controller[_0x2315('0xb')]);router[_0x2315('0xc')](_0x2315('0xd'),auth[_0x2315('0x8')](),controller[_0x2315('0xe')]);router[_0x2315('0xc')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x2315('0x8')](),controller['create']);router[_0x2315('0xf')](_0x2315('0xd'),auth['isAuthenticated'](),controller[_0x2315('0x10')]);router[_0x2315('0x11')](_0x2315('0xd'),auth[_0x2315('0x8')](),controller['destroy']);module[_0x2315('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0b19dcb..dc411b9 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 _0x7096=['closedAt','updatedAt','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x7096,0x10c));var _0x6709=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7096[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6709('0x0'));var path=require('path');var config=require(_0x6709('0x1'));module['exports']={'format':{'type':Sequelize[_0x6709('0x2')],'get':function(){return this[_0x6709('0x3')](_0x6709('0x4'))?path[_0x6709('0x5')](this[_0x6709('0x3')](_0x6709('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x6709('0x6')]},'channel':{'type':Sequelize[_0x6709('0x6')]},'value':{'type':Sequelize[_0x6709('0x6')],'set':function(_0x3e2223){var _0x11ad23=_0x3e2223[_0x6709('0x7')](/\\/g,'/');this[_0x6709('0x8')]('value',_0x11ad23);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6709('0x9')],'set':function(_0x2d8c0b){this[_0x6709('0x8')](_0x6709('0xa'),moment()[_0x6709('0xb')](_0x2d8c0b,'ms'));this[_0x6709('0x8')]('closedAt',moment());this['setDataValue'](_0x6709('0xc'),_0x2d8c0b);}},'startedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this[_0x6709('0x3')](_0x6709('0xa')))[_0x6709('0xe')](_0x6709('0xf'))[_0x6709('0x10')]();}},'closedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this['getDataValue'](_0x6709('0x11')))[_0x6709('0xe')](_0x6709('0xf'))[_0x6709('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6709('0x3')]('createdAt'))[_0x6709('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x6709('0x10')]();}},'updatedAt':{'type':Sequelize[_0x6709('0xd')],'get':function(){return moment(this[_0x6709('0x3')](_0x6709('0x12')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x82d8=['path','VIRTUAL','value','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize'];(function(_0xdf7b6,_0x1cb44c){var _0x13396c=function(_0xfd0a5c){while(--_0xfd0a5c){_0xdf7b6['push'](_0xdf7b6['shift']());}};_0x13396c(++_0x1cb44c);}(_0x82d8,0xff));var _0x882d=function(_0x3f8ba6,_0x4bdef3){_0x3f8ba6=_0x3f8ba6-0x0;var _0x46e8dc=_0x82d8[_0x3f8ba6];return _0x46e8dc;};'use strict';var Sequelize=require(_0x882d('0x0'));var moment=require('moment');var path=require(_0x882d('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x882d('0x2')],'get':function(){return this['getDataValue'](_0x882d('0x3'))?path['extname'](this['getDataValue'](_0x882d('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0x882d('0x4')]},'channel':{'type':Sequelize[_0x882d('0x4')]},'value':{'type':Sequelize[_0x882d('0x4')],'set':function(_0xb7539b){var _0x3c8b67=_0xb7539b[_0x882d('0x5')](/\\/g,'/');this['setDataValue'](_0x882d('0x3'),_0x3c8b67);}},'rating':{'type':Sequelize[_0x882d('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x882d('0x6')],'set':function(_0x4da4aa){this[_0x882d('0x7')](_0x882d('0x8'),moment()['subtract'](_0x4da4aa,'ms'));this[_0x882d('0x7')](_0x882d('0x9'),moment());this[_0x882d('0x7')]('duration',_0x4da4aa);}},'startedAt':{'type':Sequelize[_0x882d('0xa')],'get':function(){return moment(this[_0x882d('0xb')](_0x882d('0x8')))[_0x882d('0xc')](_0x882d('0xd'))[_0x882d('0xe')]();}},'closedAt':{'type':Sequelize[_0x882d('0xa')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x882d('0xc')](_0x882d('0xd'))[_0x882d('0xe')]();}},'createdAt':{'type':Sequelize[_0x882d('0xa')],'get':function(){return moment(this[_0x882d('0xb')]('createdAt'))[_0x882d('0xc')](_0x882d('0xd'))[_0x882d('0xe')]();}},'updatedAt':{'type':Sequelize[_0x882d('0xa')],'get':function(){return moment(this[_0x882d('0xb')](_0x882d('0xf')))[_0x882d('0xc')](_0x882d('0xd'))[_0x882d('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8a59a26..ae6b439 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x4d8231,_0x2f54df){var _0x5c7b42=function(_0x4c0ad6){while(--_0x4c0ad6){_0x4d8231['push'](_0x4d8231['shift']());}};_0x5c7b42(++_0x2f54df);}(_0x6f47,0xc7));var _0x76f4=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6f47[_0x3c2a69];return _0x596bc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file +var _0xe14b=['include','findAll','catch','show','fields','length','includeAll','find','create','body','duration','closedAt','value','params','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x323715,_0x2572d9){var _0x496370=function(_0x29f4d0){while(--_0x29f4d0){_0x323715['push'](_0x323715['shift']());}};_0x496370(++_0x2572d9);}(_0xe14b,0x93));var _0xbe14=function(_0x2be893,_0x341a0d){_0x2be893=_0x2be893-0x0;var _0x25ee63=_0xe14b[_0x2be893];return _0x25ee63;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x2e')](_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25')),[_0xbe14('0x2f')]);_0x19252f[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x3c3613['query']);_0x19252f[_0xbe14('0x32')]=_['intersection'](_0x19252f['model'],_0x19252f[_0xbe14('0x30')]);_0x1c7cc7['attributes']=_[_0xbe14('0x33')](_0x19252f[_0xbe14('0x2d')],qs['fields'](_0x3c3613['query']['fields']));_0x1c7cc7[_0xbe14('0x34')]=_0x1c7cc7[_0xbe14('0x34')]['length']?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f[_0xbe14('0x2d')];if(!_0x3c3613[_0xbe14('0x30')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7['limit']=qs['limit'](_0x3c3613[_0xbe14('0x30')]['limit']);_0x1c7cc7['offset']=qs['offset'](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x1c')]);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x30')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x32')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x30')],_0x19252f[_0xbe14('0x32')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x30')]['filter']){_0x1c7cc7['where']=_[_0xbe14('0x3b')](_0x1c7cc7[_0xbe14('0x39')],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x520e09){if(_0x520e09[_0xbe14('0x2b')]!==_0xbe14('0x3c')){var _0xeda70e={};_0xeda70e[_0x520e09[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x30')][_0xbe14('0x3d')]+'%'};return _0xeda70e;}})});}_0x1c7cc7=_[_0xbe14('0x3b')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3e')]);var _0x1b2608={'where':_0x1c7cc7['where']};return db[_0xbe14('0x28')][_0xbe14('0x1b')](_0x1b2608)[_0xbe14('0x22')](function(_0x1b3118){_0x34d648[_0xbe14('0x1b')]=_0x1b3118;if(_0x3c3613[_0xbe14('0x30')]['includeAll']){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x5cf713){_0x34d648['rows']=_0x5cf713;return _0x34d648;})[_0xbe14('0x22')](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))[_0xbe14('0x41')](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0x51c859,_0x5d5318){var _0x6b6aa8={'raw':![],'where':{'id':_0x51c859['params']['id']}},_0x59ae4d={};_0x59ae4d[_0xbe14('0x2d')]=_[_0xbe14('0x31')](db[_0xbe14('0x28')]['rawAttributes']);_0x59ae4d['query']=_['keys'](_0x51c859[_0xbe14('0x30')]);_0x59ae4d[_0xbe14('0x32')]=_[_0xbe14('0x33')](_0x59ae4d['model'],_0x59ae4d[_0xbe14('0x30')]);_0x6b6aa8[_0xbe14('0x34')]=_[_0xbe14('0x33')](_0x59ae4d[_0xbe14('0x2d')],qs['fields'](_0x51c859['query'][_0xbe14('0x43')]));_0x6b6aa8[_0xbe14('0x34')]=_0x6b6aa8[_0xbe14('0x34')][_0xbe14('0x44')]?_0x6b6aa8[_0xbe14('0x34')]:_0x59ae4d['model'];if(_0x51c859['query'][_0xbe14('0x45')]){_0x6b6aa8[_0xbe14('0x3f')]=[{'all':!![]}];}_0x6b6aa8=_[_0xbe14('0x3b')]({},_0x6b6aa8,_0x51c859[_0xbe14('0x3e')]);return db['ScreenRecording'][_0xbe14('0x46')](_0x6b6aa8)[_0xbe14('0x22')](handleEntityNotFound(_0x5d5318,null))['then'](respondWithResult(_0x5d5318,null))[_0xbe14('0x41')](handleError(_0x5d5318,null));};exports[_0xbe14('0x47')]=function(_0x2d6ee8,_0x36c20c){return db['ScreenRecording']['create'](_0x2d6ee8[_0xbe14('0x48')],{})[_0xbe14('0x22')](respondWithResult(_0x36c20c,0xc9))['catch'](handleError(_0x36c20c,null));};exports['update']=function(_0xca8cdb,_0x5d3726){if(_0xca8cdb[_0xbe14('0x48')]['id']){delete _0xca8cdb[_0xbe14('0x48')]['id'];}delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x49')];delete _0xca8cdb[_0xbe14('0x48')]['createdAt'];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4a')];delete _0xca8cdb[_0xbe14('0x48')][_0xbe14('0x4b')];return db[_0xbe14('0x28')]['find']({'where':{'id':_0xca8cdb[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5d3726,null))[_0xbe14('0x22')](saveUpdates(_0xca8cdb[_0xbe14('0x48')],null))[_0xbe14('0x22')](respondWithResult(_0x5d3726,null))[_0xbe14('0x41')](handleError(_0x5d3726,null));};exports['describe']=function(_0x5aeea9,_0x3a49f7){return db[_0xbe14('0x28')][_0xbe14('0x4d')]()['then'](respondWithResult(_0x3a49f7,null))['catch'](handleError(_0x3a49f7,null));};exports[_0xbe14('0x4e')]=function(_0x134878,_0x50d78f,_0x339a86){var _0x32496a=require('../../components/encryptor');var _0x28f995=![];var _0x4a40d2={};if(_0x134878[_0xbe14('0x30')][_0xbe14('0x2b')]&&_0x134878[_0xbe14('0x30')]['type']===_0xbe14('0x4f')){_0x4a40d2[_0xbe14('0x4f')]=_0x134878['params']['id'];}else{_0x4a40d2['id']=_0x134878[_0xbe14('0x4c')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':_0x4a40d2,'attributes':['id',_0xbe14('0x4b')],'raw':!![]})[_0xbe14('0x22')](handleEntityNotFound(_0x50d78f,null))['then'](function(_0x42a346){if(_0x42a346){var _0x34cd66=path[_0xbe14('0x50')](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x42a346[_0xbe14('0x4b')]);var _0x1dd6c7=util['format'](_0xbe14('0x53'),_0x34cd66);if(fs[_0xbe14('0x54')](_0x1dd6c7)){_0x28f995=!![];return _0x32496a[_0xbe14('0x55')](_0x1dd6c7,_0x34cd66,config[_0xbe14('0x56')][_0xbe14('0x57')])[_0xbe14('0x22')](function(){return _0x42a346;});}return _0x42a346;}})[_0xbe14('0x22')](function(_0x32df3c){if(_0x32df3c){var _0x285b6e=path[_0xbe14('0x50')](config[_0xbe14('0x51')],'server/files/screen_recordings',_0x32df3c['value']);if(!fs['existsSync'](_0x285b6e)){throw new db[(_0xbe14('0x58'))][(_0xbe14('0x59'))](_0xbe14('0x5a'));}if(_0x32df3c[_0xbe14('0x5b')]){return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,_0x32df3c[_0xbe14('0x5b')]+path[_0xbe14('0x5c')](_0x285b6e),function(){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}else{return _0x50d78f[_0xbe14('0x4e')](_0x285b6e,function(_0x451b0b){if(_0x28f995){fs[_0xbe14('0x5d')](_0x285b6e);}});}}})[_0xbe14('0x41')](function(_0x2088e4){if(_0x2088e4[_0xbe14('0x5e')]===_0xbe14('0x5a')){_0x50d78f[_0xbe14('0x17')](0x194)[_0xbe14('0x26')](_0xbe14('0x5f'));}else{return handleError(_0x50d78f,null);}});};exports[_0xbe14('0x60')]=function(_0x1a945b,_0x5f394c){return db[_0xbe14('0x28')][_0xbe14('0x46')]({'where':{'id':_0x1a945b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x22')](function(_0x3ee6b7){if(_[_0xbe14('0x61')](_0x3ee6b7)){throw new ReferenceError(_0xbe14('0x62'));}return _0x3ee6b7;})[_0xbe14('0x22')](function(_0x23cb36){var _0x100d43=path['join'](config[_0xbe14('0x51')],_0xbe14('0x52'),_0x23cb36[_0xbe14('0x4b')]);logger[_0xbe14('0x63')](_0xbe14('0x64'),_0x100d43);if(!_['isNil'](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs['unlinkSync'](_0x100d43);}_0x100d43=_0x100d43+_0xbe14('0x67');if(!_[_0xbe14('0x61')](_0x23cb36[_0xbe14('0x4b')])&&fs[_0xbe14('0x54')](_0x100d43)){logger[_0xbe14('0x63')](_0xbe14('0x65')+_0x100d43+_0xbe14('0x66'));fs[_0xbe14('0x68')](_0x100d43);}return _0x23cb36;})['then'](function(_0x1bb588){if(!_0x1bb588)throw new InternalError();return _0x1bb588[_0xbe14('0x60')]();})[_0xbe14('0x22')](function(){_0x5f394c[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();})[_0xbe14('0x41')](handleError(_0x5f394c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1bdf51c..f9aeb85 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 _0x2b3a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x4047d0,_0x1029f4){var _0x219d28=function(_0x3a1aee){while(--_0x3a1aee){_0x4047d0['push'](_0x4047d0['shift']());}};_0x219d28(++_0x1029f4);}(_0x2b3a,0x73));var _0xa2b3=function(_0xc385ea,_0xc7031d){_0xc385ea=_0xc385ea-0x0;var _0x34cb01=_0x2b3a[_0xc385ea];return _0x34cb01;};'use strict';var _=require(_0xa2b3('0x0'));var util=require(_0xa2b3('0x1'));var logger=require('../../config/logger')(_0xa2b3('0x2'));var moment=require(_0xa2b3('0x3'));var BPromise=require(_0xa2b3('0x4'));var rp=require(_0xa2b3('0x5'));var fs=require('fs');var path=require(_0xa2b3('0x6'));var rimraf=require(_0xa2b3('0x7'));var config=require(_0xa2b3('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x351d20,_0x35656a){return _0x351d20[_0xa2b3('0x9')](_0xa2b3('0xa'),attributes,{'tableName':_0xa2b3('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xa2b3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xebf5=['rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','path'];(function(_0x5b9ef5,_0x5985ad){var _0x3d44f6=function(_0x5b8167){while(--_0x5b8167){_0x5b9ef5['push'](_0x5b9ef5['shift']());}};_0x3d44f6(++_0x5985ad);}(_0xebf5,0xcb));var _0x5ebf=function(_0x20c2f2,_0xf3351c){_0x20c2f2=_0x20c2f2-0x0;var _0x4f5b86=_0xebf5[_0x20c2f2];return _0x4f5b86;};'use strict';var _=require(_0x5ebf('0x0'));var util=require(_0x5ebf('0x1'));var logger=require('../../config/logger')(_0x5ebf('0x2'));var moment=require(_0x5ebf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ebf('0x4'));var rimraf=require(_0x5ebf('0x5'));var config=require(_0x5ebf('0x6'));var attributes=require(_0x5ebf('0x7'));module[_0x5ebf('0x8')]=function(_0x339b95,_0x43aaf5){return _0x339b95[_0x5ebf('0x9')](_0x5ebf('0xa'),attributes,{'tableName':_0x5ebf('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x5ebf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3abc810..a699e95 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 _0xc377=['rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55e1db,_0x446f3f){var _0x2e06e0=function(_0x3f0058){while(--_0x3f0058){_0x55e1db['push'](_0x55e1db['shift']());}};_0x2e06e0(++_0x446f3f);}(_0xc377,0xf1));var _0x7c37=function(_0x5153e8,_0x3126e7){_0x5153e8=_0x5153e8-0x0;var _0x2468bd=_0xc377[_0x5153e8];return _0x2468bd;};'use strict';var _=require(_0x7c37('0x0'));var util=require(_0x7c37('0x1'));var moment=require(_0x7c37('0x2'));var BPromise=require(_0x7c37('0x3'));var rs=require(_0x7c37('0x4'));var fs=require('fs');var Redis=require(_0x7c37('0x5'));var db=require(_0x7c37('0x6'))['db'];var utils=require(_0x7c37('0x7'));var logger=require(_0x7c37('0x8'))(_0x7c37('0x9'));var config=require(_0x7c37('0xa'));var jayson=require(_0x7c37('0xb'));var client=jayson[_0x7c37('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b0444,_0xe9aee6,_0x5be73d){return new BPromise(function(_0x4e8487,_0x159295){return client[_0x7c37('0xd')](_0x2b0444,_0x5be73d)[_0x7c37('0xe')](function(_0x1ad80e){logger[_0x7c37('0xf')](_0x7c37('0x10'),_0xe9aee6,'request\x20sent');logger[_0x7c37('0x11')](_0x7c37('0x12'),_0xe9aee6,_0x7c37('0x13'),JSON[_0x7c37('0x14')](_0x1ad80e));if(_0x1ad80e['error']){if(_0x1ad80e[_0x7c37('0x15')]['code']===0x1f4){logger[_0x7c37('0x15')]('ScreenRecording,\x20%s,\x20%s',_0xe9aee6,_0x1ad80e['error'][_0x7c37('0x16')]);return _0x159295(_0x1ad80e['error'][_0x7c37('0x16')]);}logger[_0x7c37('0x15')](_0x7c37('0x10'),_0xe9aee6,_0x1ad80e[_0x7c37('0x15')][_0x7c37('0x16')]);return _0x4e8487(_0x1ad80e[_0x7c37('0x15')][_0x7c37('0x16')]);}else{logger[_0x7c37('0xf')]('ScreenRecording,\x20%s,\x20%s',_0xe9aee6,'request\x20sent');_0x4e8487(_0x1ad80e[_0x7c37('0x17')]['message']);}})[_0x7c37('0x18')](function(_0x596b24){logger[_0x7c37('0x15')](_0x7c37('0x10'),_0xe9aee6,_0x596b24);_0x159295(_0x596b24);});});} \ No newline at end of file +var _0x1400=['ScreenRecording,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1fdfb4,_0x2b7f95){var _0x41b422=function(_0x275678){while(--_0x275678){_0x1fdfb4['push'](_0x1fdfb4['shift']());}};_0x41b422(++_0x2b7f95);}(_0x1400,0x1eb));var _0x0140=function(_0x467075,_0x524d49){_0x467075=_0x467075-0x0;var _0x61a8c6=_0x1400[_0x467075];return _0x61a8c6;};'use strict';var _=require(_0x0140('0x0'));var util=require(_0x0140('0x1'));var moment=require(_0x0140('0x2'));var BPromise=require('bluebird');var rs=require(_0x0140('0x3'));var fs=require('fs');var Redis=require(_0x0140('0x4'));var db=require(_0x0140('0x5'))['db'];var utils=require(_0x0140('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0140('0x7'));var jayson=require(_0x0140('0x8'));var client=jayson[_0x0140('0x9')][_0x0140('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f5157,_0x1cec83,_0x52fc3a){return new BPromise(function(_0x489488,_0x1d0d53){return client[_0x0140('0xb')](_0x2f5157,_0x52fc3a)['then'](function(_0x2115c4){logger[_0x0140('0xc')](_0x0140('0xd'),_0x1cec83,_0x0140('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1cec83,_0x0140('0xe'),JSON['stringify'](_0x2115c4));if(_0x2115c4[_0x0140('0xf')]){if(_0x2115c4[_0x0140('0xf')]['code']===0x1f4){logger[_0x0140('0xf')](_0x0140('0xd'),_0x1cec83,_0x2115c4[_0x0140('0xf')][_0x0140('0x10')]);return _0x1d0d53(_0x2115c4['error'][_0x0140('0x10')]);}logger[_0x0140('0xf')](_0x0140('0xd'),_0x1cec83,_0x2115c4[_0x0140('0xf')][_0x0140('0x10')]);return _0x489488(_0x2115c4[_0x0140('0xf')][_0x0140('0x10')]);}else{logger['info'](_0x0140('0xd'),_0x1cec83,_0x0140('0xe'));_0x489488(_0x2115c4[_0x0140('0x11')][_0x0140('0x10')]);}})['catch'](function(_0x2d6c02){logger[_0x0140('0xf')](_0x0140('0xd'),_0x1cec83,_0x2d6c02);_0x1d0d53(_0x2d6c02);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 06aa5e1..7076ede 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 _0xc5f7=['logologin','extname','/:id/preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','post','single','file','addLogo','server/files/images/logos/'];(function(_0x282829,_0x4a657d){var _0x3219c7=function(_0x1cf724){while(--_0x1cf724){_0x282829['push'](_0x282829['shift']());}};_0x3219c7(++_0x4a657d);}(_0xc5f7,0x184));var _0x7c5f=function(_0x34d440,_0x43ba86){_0x34d440=_0x34d440-0x0;var _0x5a0348=_0xc5f7[_0x34d440];return _0x5a0348;};'use strict';var multer=require('multer');var util=require(_0x7c5f('0x0'));var path=require(_0x7c5f('0x1'));var timeout=require(_0x7c5f('0x2'));var express=require('express');var router=express[_0x7c5f('0x3')]();var fs_extra=require(_0x7c5f('0x4'));var auth=require(_0x7c5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c5f('0x6'));var controller=require(_0x7c5f('0x7'));router[_0x7c5f('0x8')]('/',auth[_0x7c5f('0x9')](),controller[_0x7c5f('0xa')]);router['get'](_0x7c5f('0xb'),controller[_0x7c5f('0xc')]);router[_0x7c5f('0x8')](_0x7c5f('0xd'),controller[_0x7c5f('0xe')]);router[_0x7c5f('0x8')](_0x7c5f('0xf'),controller['getLogo']);router[_0x7c5f('0x8')](_0x7c5f('0x10'),controller[_0x7c5f('0x11')]);router[_0x7c5f('0x8')](_0x7c5f('0x12'),controller['gdpr']);router[_0x7c5f('0x8')]('/:id/preferred',controller['getPreferred']);router[_0x7c5f('0x8')]('/:id/favicon',controller[_0x7c5f('0x13')]);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x5a057f,_0x2e84f3,_0x1768fe){_0x1768fe(null,path[_0x7c5f('0x15')](config[_0x7c5f('0x16')],'server/files/images/logos/'));},'filename':function(_0x4b7208,_0x76961e,_0x428a52){_0x428a52(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x19'),path['extname'](_0x76961e[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0xf'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller[_0x7c5f('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32e776,_0x598c59,_0x1eb7d9){_0x1eb7d9(null,path[_0x7c5f('0x15')](config[_0x7c5f('0x16')],_0x7c5f('0x1f')));},'filename':function(_0x4cdea2,_0x2a40c7,_0x3e8030){_0x3e8030(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x20'),path[_0x7c5f('0x21')](_0x2a40c7[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x10'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x2ad824,_0x558b2e,_0xc8b548){_0xc8b548(null,path['join'](config['root'],_0x7c5f('0x1f')));},'filename':function(_0x50e13e,_0x43b141,_0x457800){_0x457800(null,util[_0x7c5f('0x17')]('%s%s','preferred',path[_0x7c5f('0x21')](_0x43b141[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x22'),upload['single'](_0x7c5f('0x1d')),controller[_0x7c5f('0x23')]);var upload=multer({'storage':multer[_0x7c5f('0x14')]({'destination':function(_0x12cc7e,_0x2d27b2,_0x2bb985){_0x2bb985(null,path[_0x7c5f('0x15')](config['root'],_0x7c5f('0x1f')));},'filename':function(_0x4f0e09,_0x399303,_0x265db3){_0x265db3(null,util[_0x7c5f('0x17')](_0x7c5f('0x18'),_0x7c5f('0x24'),path[_0x7c5f('0x21')](_0x399303[_0x7c5f('0x1a')])));}})});router[_0x7c5f('0x1b')](_0x7c5f('0x25'),upload[_0x7c5f('0x1c')](_0x7c5f('0x1d')),controller[_0x7c5f('0x26')]);router[_0x7c5f('0x27')](_0x7c5f('0xd'),auth[_0x7c5f('0x9')](),controller[_0x7c5f('0x28')]);module[_0x7c5f('0x29')]=router; \ No newline at end of file +var _0x7f6a=['diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','single','file','addLogo','logologin','originalname','addLogoLogin','format','preferred','addPreferred','favicon','post','addFavicon','/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon'];(function(_0x4eb3ec,_0x51b871){var _0x1a3de8=function(_0x179f80){while(--_0x179f80){_0x4eb3ec['push'](_0x4eb3ec['shift']());}};_0x1a3de8(++_0x51b871);}(_0x7f6a,0xc6));var _0xa7f6=function(_0x56a2f4,_0x3ecd05){_0x56a2f4=_0x56a2f4-0x0;var _0x484750=_0x7f6a[_0x56a2f4];return _0x484750;};'use strict';var multer=require(_0xa7f6('0x0'));var util=require(_0xa7f6('0x1'));var path=require(_0xa7f6('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7f6('0x3'));var router=express['Router']();var fs_extra=require(_0xa7f6('0x4'));var auth=require(_0xa7f6('0x5'));var interaction=require(_0xa7f6('0x6'));var config=require(_0xa7f6('0x7'));var controller=require(_0xa7f6('0x8'));router[_0xa7f6('0x9')]('/',auth[_0xa7f6('0xa')](),controller[_0xa7f6('0xb')]);router[_0xa7f6('0x9')](_0xa7f6('0xc'),controller[_0xa7f6('0xd')]);router[_0xa7f6('0x9')]('/:id',controller[_0xa7f6('0xe')]);router['get'](_0xa7f6('0xf'),controller[_0xa7f6('0x10')]);router[_0xa7f6('0x9')](_0xa7f6('0x11'),controller[_0xa7f6('0x12')]);router[_0xa7f6('0x9')]('/:id/gdpr',controller[_0xa7f6('0x13')]);router[_0xa7f6('0x9')]('/:id/preferred',controller[_0xa7f6('0x14')]);router[_0xa7f6('0x9')](_0xa7f6('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xa7f6('0x16')]({'destination':function(_0x361b50,_0x5e4fbd,_0x6d3b8d){_0x6d3b8d(null,path[_0xa7f6('0x17')](config[_0xa7f6('0x18')],_0xa7f6('0x19')));},'filename':function(_0x217763,_0x1eb990,_0xc6e613){_0xc6e613(null,util['format'](_0xa7f6('0x1a'),_0xa7f6('0x1b'),path[_0xa7f6('0x1c')](_0x1eb990['originalname'])));}})});router['post'](_0xa7f6('0xf'),upload[_0xa7f6('0x1d')](_0xa7f6('0x1e')),controller[_0xa7f6('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a5524,_0x7e5432,_0x3fa31e){_0x3fa31e(null,path[_0xa7f6('0x17')](config[_0xa7f6('0x18')],'server/files/images/logos/'));},'filename':function(_0x12a9b7,_0x4fad84,_0x3de17a){_0x3de17a(null,util['format'](_0xa7f6('0x1a'),_0xa7f6('0x20'),path[_0xa7f6('0x1c')](_0x4fad84[_0xa7f6('0x21')])));}})});router['post'](_0xa7f6('0x11'),upload[_0xa7f6('0x1d')](_0xa7f6('0x1e')),controller[_0xa7f6('0x22')]);var upload=multer({'storage':multer[_0xa7f6('0x16')]({'destination':function(_0xeaea6d,_0x54f145,_0x221897){_0x221897(null,path[_0xa7f6('0x17')](config['root'],_0xa7f6('0x19')));},'filename':function(_0xf1a644,_0x18582f,_0x5c53f3){_0x5c53f3(null,util[_0xa7f6('0x23')]('%s%s',_0xa7f6('0x24'),path[_0xa7f6('0x1c')](_0x18582f[_0xa7f6('0x21')])));}})});router['post']('/:id/preferred',upload[_0xa7f6('0x1d')]('file'),controller[_0xa7f6('0x25')]);var upload=multer({'storage':multer[_0xa7f6('0x16')]({'destination':function(_0x15828c,_0x5bbf25,_0x891df){_0x891df(null,path[_0xa7f6('0x17')](config[_0xa7f6('0x18')],_0xa7f6('0x19')));},'filename':function(_0x248eaf,_0x3c0c34,_0x244867){_0x244867(null,util['format']('%s%s',_0xa7f6('0x26'),path['extname'](_0x3c0c34[_0xa7f6('0x21')])));}})});router[_0xa7f6('0x27')](_0xa7f6('0x15'),upload[_0xa7f6('0x1d')](_0xa7f6('0x1e')),controller[_0xa7f6('0x28')]);router['put'](_0xa7f6('0x29'),auth[_0xa7f6('0xa')](),controller[_0xa7f6('0x2a')]);module[_0xa7f6('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 80780db..661271c 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(_0x1344fd,_0x57ed8d){var _0x394332=function(_0xacc382){while(--_0xacc382){_0x1344fd['push'](_0x1344fd['shift']());}};_0x394332(++_0x57ed8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x599ee8,_0x463c26){var _0x5d08d2=function(_0x1d3c96){while(--_0x1d3c96){_0x599ee8['push'](_0x599ee8['shift']());}};_0x5d08d2(++_0x463c26);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 6177d56..6dab85b 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 _0x99e9=['pick','filter','merge','map','type','includeAll','include','Setting','params','rawAttributes','length','options','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','defaultLogo','defaultLoginLogo','default_loginLogo.svg','custom','download','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','ValidationError','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','index','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where'];(function(_0x1b326c,_0x49a702){var _0x458067=function(_0x3c0d26){while(--_0x3c0d26){_0x1b326c['push'](_0x1b326c['shift']());}};_0x458067(++_0x49a702);}(_0x99e9,0xb4));var _0x999e=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x99e9[_0x154940];return _0x401409;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x999e('0x0'));var zipdir=require(_0x999e('0x1'));var jsonpatch=require(_0x999e('0x2'));var rp=require(_0x999e('0x3'));var moment=require('moment');var BPromise=require(_0x999e('0x4'));var Mustache=require(_0x999e('0x5'));var util=require(_0x999e('0x6'));var path=require('path');var sox=require(_0x999e('0x7'));var csv=require('to-csv');var ejs=require(_0x999e('0x8'));var fs=require('fs');var fs_extra=require(_0x999e('0x9'));var _=require(_0x999e('0xa'));var squel=require(_0x999e('0xb'));var crypto=require('crypto');var jsforce=require(_0x999e('0xc'));var deskjs=require(_0x999e('0xd'));var toCsv=require(_0x999e('0xe'));var querystring=require(_0x999e('0xf'));var Papa=require(_0x999e('0x10'));var Redis=require(_0x999e('0x11'));var authService=require(_0x999e('0x12'));var qs=require(_0x999e('0x13'));var as=require(_0x999e('0x14'));var hardwareService=require(_0x999e('0x15'));var logger=require(_0x999e('0x16'))(_0x999e('0x17'));var utils=require(_0x999e('0x18'));var config=require(_0x999e('0x19'));var licenseUtil=require(_0x999e('0x1a'));var db=require(_0x999e('0x1b'))['db'];var jayson=require(_0x999e('0x1c'));var client=jayson['client'][_0x999e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54afad,_0x3e6f5a,_0x387924,_0x2fbc3e){return new BPromise(function(_0x538a92,_0x28bdd1){var _0x4d1716=_0x2fbc3e||client;return _0x4d1716[_0x999e('0x1e')](_0x54afad,_0x387924)['then'](function(_0x549ad4){logger[_0x999e('0x1f')](_0x999e('0x20'),_0x3e6f5a,_0x999e('0x21'));logger[_0x999e('0x22')](_0x999e('0x23'),_0x3e6f5a,_0x999e('0x21'),JSON['stringify'](_0x549ad4));if(_0x549ad4['error']){if(_0x549ad4['error'][_0x999e('0x24')]===0x1f4){logger[_0x999e('0x25')](_0x999e('0x20'),_0x3e6f5a,_0x549ad4[_0x999e('0x25')][_0x999e('0x26')]);return _0x28bdd1(_0x549ad4[_0x999e('0x25')]['message']);}logger['error'](_0x999e('0x20'),_0x3e6f5a,_0x549ad4[_0x999e('0x25')][_0x999e('0x26')]);return _0x538a92(_0x549ad4['error'][_0x999e('0x26')]);}else{logger[_0x999e('0x1f')](_0x999e('0x20'),_0x3e6f5a,_0x999e('0x21'));_0x538a92(_0x549ad4[_0x999e('0x27')][_0x999e('0x26')]);}})[_0x999e('0x28')](function(_0x4d4474){logger['error'](_0x999e('0x20'),_0x3e6f5a,_0x4d4474);_0x28bdd1(_0x4d4474);});});}function respondWithStatusCode(_0x4f0091,_0x4c5491){_0x4c5491=_0x4c5491||0xcc;return function(_0x452acd){if(_0x452acd){return _0x4f0091[_0x999e('0x29')](_0x4c5491);}return _0x4f0091[_0x999e('0x2a')](_0x4c5491)[_0x999e('0x2b')]();};}function respondWithResult(_0x3f2bbf,_0x320634){_0x320634=_0x320634||0xc8;return function(_0x4f8406){if(_0x4f8406){return _0x3f2bbf[_0x999e('0x2a')](_0x320634)[_0x999e('0x2c')](_0x4f8406);}};}function respondWithFilteredResult(_0x11068e,_0x12b9ad){return function(_0x1b7adb){if(_0x1b7adb){var _0x1d2dc6=typeof _0x12b9ad[_0x999e('0x2d')]==='undefined'&&typeof _0x12b9ad[_0x999e('0x2e')]==='undefined';var _0x4fed13=_0x1b7adb[_0x999e('0x2f')];var _0x1059bd=_0x1d2dc6?0x0:_0x12b9ad[_0x999e('0x2d')];var _0x555ca0=_0x1d2dc6?_0x1b7adb[_0x999e('0x2f')]:_0x12b9ad[_0x999e('0x2d')]+_0x12b9ad[_0x999e('0x2e')];var _0x4339bf;if(_0x555ca0>=_0x4fed13){_0x555ca0=_0x4fed13;_0x4339bf=0xc8;}else{_0x4339bf=0xce;}_0x11068e[_0x999e('0x2a')](_0x4339bf);return _0x11068e[_0x999e('0x30')](_0x999e('0x31'),_0x1059bd+'-'+_0x555ca0+'/'+_0x4fed13)[_0x999e('0x2c')](_0x1b7adb);}return null;};}function patchUpdates(_0x27102b){return function(_0x3ddacb){try{jsonpatch['apply'](_0x3ddacb,_0x27102b,!![]);}catch(_0x1c8feb){return BPromise[_0x999e('0x32')](_0x1c8feb);}return _0x3ddacb[_0x999e('0x33')]();};}function saveUpdates(_0x4c2ce8,_0x2ca5b8){return function(_0x5af72c){if(_0x5af72c){return _0x5af72c['update'](_0x4c2ce8)[_0x999e('0x34')](function(_0x332195){return _0x332195;});}return null;};}function removeEntity(_0x5aa206,_0x53ebb2){return function(_0x5def61){if(_0x5def61){return _0x5def61[_0x999e('0x35')]()[_0x999e('0x34')](function(){_0x5aa206[_0x999e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2724be,_0x41d6f1){return function(_0x37f662){if(!_0x37f662){_0x2724be[_0x999e('0x29')](0x194);}return _0x37f662;};}function handleError(_0x4f861f,_0x4ebcb7){_0x4ebcb7=_0x4ebcb7||0x1f4;return function(_0x44fb32){logger['error'](_0x44fb32[_0x999e('0x36')]);if(_0x44fb32[_0x999e('0x37')]){delete _0x44fb32[_0x999e('0x37')];}_0x4f861f[_0x999e('0x2a')](_0x4ebcb7)['send'](_0x44fb32);};}exports[_0x999e('0x38')]=function(_0x28df26,_0x5bd468){var _0x4808d1={},_0x327866={},_0x4aa98c={'count':0x0,'rows':[]};var _0xa0c150=_['map'](db['Setting']['rawAttributes'],function(_0x5360a3){return{'name':_0x5360a3[_0x999e('0x39')],'type':_0x5360a3['type'][_0x999e('0x3a')]};});_0x327866['model']=_['map'](_0xa0c150,'name');_0x327866[_0x999e('0x3b')]=_[_0x999e('0x3c')](_0x28df26[_0x999e('0x3b')]);_0x327866[_0x999e('0x3d')]=_[_0x999e('0x3e')](_0x327866[_0x999e('0x3f')],_0x327866[_0x999e('0x3b')]);_0x4808d1[_0x999e('0x40')]=_['intersection'](_0x327866[_0x999e('0x3f')],qs[_0x999e('0x41')](_0x28df26[_0x999e('0x3b')][_0x999e('0x41')]));_0x4808d1['attributes']=_0x4808d1[_0x999e('0x40')]['length']?_0x4808d1[_0x999e('0x40')]:_0x327866[_0x999e('0x3f')];if(!_0x28df26[_0x999e('0x3b')][_0x999e('0x42')]('nolimit')){_0x4808d1[_0x999e('0x2e')]=qs[_0x999e('0x2e')](_0x28df26[_0x999e('0x3b')]['limit']);_0x4808d1['offset']=qs[_0x999e('0x2d')](_0x28df26[_0x999e('0x3b')][_0x999e('0x2d')]);}_0x4808d1[_0x999e('0x43')]=qs[_0x999e('0x44')](_0x28df26[_0x999e('0x3b')][_0x999e('0x44')]);_0x4808d1[_0x999e('0x45')]=qs[_0x999e('0x3d')](_[_0x999e('0x46')](_0x28df26['query'],_0x327866['filters']),_0xa0c150);if(_0x28df26[_0x999e('0x3b')][_0x999e('0x47')]){_0x4808d1[_0x999e('0x45')]=_[_0x999e('0x48')](_0x4808d1[_0x999e('0x45')],{'$or':_[_0x999e('0x49')](_0xa0c150,function(_0x528547){if(_0x528547[_0x999e('0x4a')]!=='VIRTUAL'){var _0x4caf56={};_0x4caf56[_0x528547[_0x999e('0x37')]]={'$like':'%'+_0x28df26['query']['filter']+'%'};return _0x4caf56;}})});}_0x4808d1=_['merge']({},_0x4808d1,_0x28df26['options']);var _0xc89b1={'where':_0x4808d1[_0x999e('0x45')]};return db['Setting'][_0x999e('0x2f')](_0xc89b1)[_0x999e('0x34')](function(_0x2aa9ca){_0x4aa98c['count']=_0x2aa9ca;if(_0x28df26['query'][_0x999e('0x4b')]){_0x4808d1[_0x999e('0x4c')]=[{'all':!![]}];}return db[_0x999e('0x4d')]['findAll'](_0x4808d1);})['then'](function(_0x4d0358){_0x4aa98c['rows']=_0x4d0358;return _0x4aa98c;})[_0x999e('0x34')](respondWithFilteredResult(_0x5bd468,_0x4808d1))['catch'](handleError(_0x5bd468,null));};exports['show']=function(_0x45e2c2,_0x29a27f){var _0x5843f1={'raw':![],'where':{'id':_0x45e2c2[_0x999e('0x4e')]['id']}},_0xa50dc6={};_0xa50dc6['model']=_[_0x999e('0x3c')](db['Setting'][_0x999e('0x4f')]);_0xa50dc6[_0x999e('0x3b')]=_['keys'](_0x45e2c2[_0x999e('0x3b')]);_0xa50dc6[_0x999e('0x3d')]=_['intersection'](_0xa50dc6['model'],_0xa50dc6[_0x999e('0x3b')]);_0x5843f1['attributes']=_['intersection'](_0xa50dc6['model'],qs[_0x999e('0x41')](_0x45e2c2[_0x999e('0x3b')][_0x999e('0x41')]));_0x5843f1[_0x999e('0x40')]=_0x5843f1[_0x999e('0x40')][_0x999e('0x50')]?_0x5843f1['attributes']:_0xa50dc6[_0x999e('0x3f')];if(_0x45e2c2[_0x999e('0x3b')]['includeAll']){_0x5843f1[_0x999e('0x4c')]=[{'all':!![]}];}_0x5843f1=_[_0x999e('0x48')]({},_0x5843f1,_0x45e2c2[_0x999e('0x51')]);return db[_0x999e('0x4d')][_0x999e('0x52')](_0x5843f1)[_0x999e('0x34')](handleEntityNotFound(_0x29a27f,null))[_0x999e('0x34')](respondWithResult(_0x29a27f,null))[_0x999e('0x28')](handleError(_0x29a27f,null));};exports[_0x999e('0x53')]=function(_0x53932a,_0x9f3f7a){if(_0x53932a[_0x999e('0x54')]['id']){delete _0x53932a[_0x999e('0x54')]['id'];}return db[_0x999e('0x4d')]['find']({'where':{'id':_0x53932a[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x9f3f7a,null))[_0x999e('0x34')](saveUpdates(_0x53932a[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x9f3f7a,null))[_0x999e('0x28')](handleError(_0x9f3f7a,null));};exports[_0x999e('0x55')]=function(_0x1a6925,_0x4ecb26,_0x56368e){if(_0x1a6925[_0x999e('0x56')]&&_0x1a6925[_0x999e('0x56')][_0x999e('0x57')]){_0x1a6925[_0x999e('0x54')][_0x999e('0x58')]=_0x1a6925[_0x999e('0x56')][_0x999e('0x57')];}return db['Setting']['find']({'where':{'id':_0x1a6925[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x4ecb26,null))[_0x999e('0x34')](saveUpdates(_0x1a6925[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x4ecb26,null))['catch'](handleError(_0x4ecb26,null));};exports[_0x999e('0x59')]=function(_0x1e7ad2,_0x30a49d,_0x3c8ecf){if(_0x1e7ad2[_0x999e('0x56')]&&_0x1e7ad2[_0x999e('0x56')][_0x999e('0x57')]){_0x1e7ad2['body'][_0x999e('0x5a')]=_0x1e7ad2['file'][_0x999e('0x57')];}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x1e7ad2[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x30a49d,null))[_0x999e('0x34')](saveUpdates(_0x1e7ad2['body'],null))[_0x999e('0x34')](respondWithResult(_0x30a49d,null))[_0x999e('0x28')](handleError(_0x30a49d,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x5b')]=function(_0x470e51,_0x121110,_0x23fd58){var _0x3d398c=_0x999e('0x5c');var _0x7f9dfe={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x77a387){if(_0x77a387){_0x7f9dfe=_0x77a387;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x470e51['params']['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),_0x999e('0x5f'),'defaultLogo','defaultLoginLogo',_0x999e('0x60'),_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x121110,null))[_0x999e('0x34')](function(_0x1c9b64){if(_0x1c9b64){var _0x19d934=_0x1c9b64[_0x999e('0x58')]&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config['root'],_0x3d398c,_[_0x999e('0x64')](_0x1c9b64['logo'])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x3d398c,_['toLower'](_0x1c9b64[_0x999e('0x58')])):path[_0x999e('0x63')](config[_0x999e('0x65')],_0x3d398c,_[_0x999e('0x64')](_0x999e('0x66')));var _0x4ba9cd=_0x999e('0x67')+_[_0x999e('0x68')]('logo');if(_0x1c9b64[_0x4ba9cd]||!_0x7f9dfe['custom']){_0x19d934=path['join'](config[_0x999e('0x65')],_0x3d398c,_[_0x999e('0x64')](_0x999e('0x66')));}if(!fs[_0x999e('0x62')](_0x19d934)){throw new db[(_0x999e('0x69'))]['ValidationError'](_['upperFirst']('logo')+_0x999e('0x6a'));}return _0x121110['download'](_0x19d934);}})['catch'](handleError(_0x121110,null));};var utilLicense=require(_0x999e('0x1a'));exports['getLogoLogin']=function(_0x294f2a,_0x3131c7,_0xb5ac06){var _0x5b8a0d=_0x999e('0x5c');var _0x3c2bce={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x3f0baa){if(_0x3f0baa){_0x3c2bce=_0x3f0baa;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x294f2a['params']['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),'favicon',_0x999e('0x6b'),_0x999e('0x6c'),'defaultPreferred',_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x3131c7,null))[_0x999e('0x34')](function(_0x1f0dc3){if(_0x1f0dc3){var _0xc02339=_0x1f0dc3[_0x999e('0x5a')]&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x1f0dc3[_0x999e('0x5a')])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x1f0dc3[_0x999e('0x5a')])):path['join'](config[_0x999e('0x65')],_0x5b8a0d,_[_0x999e('0x64')](_0x999e('0x6d')));var _0x4e6c30=_0x999e('0x67')+_[_0x999e('0x68')](_0x999e('0x5a'));if(_0x1f0dc3[_0x4e6c30]||!_0x3c2bce[_0x999e('0x6e')]){_0xc02339=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x5b8a0d,_['toLower'](_0x999e('0x6d')));}if(!fs['existsSync'](_0xc02339)){throw new db[(_0x999e('0x69'))]['ValidationError'](_['upperFirst'](_0x999e('0x5a'))+'\x20not\x20found');}return _0x3131c7[_0x999e('0x6f')](_0xc02339);}})[_0x999e('0x28')](handleError(_0x3131c7,null));};exports['gdpr']=function(_0x15c83f,_0x2d064e){return db['Setting'][_0x999e('0x52')]({'where':{'id':_0x15c83f[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x70')]})[_0x999e('0x34')](respondWithResult(_0x2d064e,null))[_0x999e('0x28')](handleError(_0x2d064e,null));};exports[_0x999e('0x71')]=function(_0x4f22a6,_0x25b243,_0x5cdf6d){if(_0x4f22a6['file']&&_0x4f22a6[_0x999e('0x56')][_0x999e('0x57')]){_0x4f22a6[_0x999e('0x54')][_0x999e('0x5e')]=_0x4f22a6[_0x999e('0x56')][_0x999e('0x57')];}return db['Setting'][_0x999e('0x52')]({'where':{'id':_0x4f22a6[_0x999e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x25b243,null))[_0x999e('0x34')](saveUpdates(_0x4f22a6[_0x999e('0x54')],null))[_0x999e('0x34')](respondWithResult(_0x25b243,null))['catch'](handleError(_0x25b243,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x72')]=function(_0x328c2d,_0x47eac1,_0x216040){var _0x372316=_0x999e('0x5c');var _0x53cf4d={'custom':![]};return utilLicense['getLicense']()[_0x999e('0x34')](function(_0x47e5ce){if(_0x47e5ce){_0x53cf4d=_0x47e5ce;}return db[_0x999e('0x4d')][_0x999e('0x52')]({'where':{'id':_0x328c2d[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),_0x999e('0x5e'),_0x999e('0x5f'),'defaultLogo',_0x999e('0x6c'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x47eac1,null))[_0x999e('0x34')](function(_0xa0a5de){if(_0xa0a5de){var _0x302e73=_0xa0a5de[_0x999e('0x5e')]&&fs[_0x999e('0x62')](path['join'](config[_0x999e('0x65')],_0x372316,_['toLower'](_0xa0a5de[_0x999e('0x5e')])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x372316,_['toLower'](_0xa0a5de[_0x999e('0x5e')])):path['join'](config[_0x999e('0x65')],_0x372316,_[_0x999e('0x64')](_0x999e('0x73')));var _0xe7f809=_0x999e('0x67')+_['upperFirst']('preferred');if(_0xa0a5de[_0xe7f809]||!_0x53cf4d[_0x999e('0x6e')]||!_0x53cf4d[_0x999e('0x5e')]){_0x302e73=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x372316,_[_0x999e('0x64')](_0x999e('0x73')));}if(!fs[_0x999e('0x62')](_0x302e73)){throw new db[(_0x999e('0x69'))]['ValidationError'](_[_0x999e('0x68')](_0x999e('0x5e'))+_0x999e('0x6a'));}return _0x47eac1[_0x999e('0x6f')](_0x302e73);}})[_0x999e('0x28')](handleError(_0x47eac1,null));};exports[_0x999e('0x74')]=function(_0x38b48b,_0x16d552,_0x4c6d18){if(_0x38b48b[_0x999e('0x56')]&&_0x38b48b[_0x999e('0x56')][_0x999e('0x57')]){_0x38b48b[_0x999e('0x54')][_0x999e('0x5f')]=_0x38b48b[_0x999e('0x56')][_0x999e('0x57')];}return db[_0x999e('0x4d')]['find']({'where':{'id':_0x38b48b[_0x999e('0x4e')]['id']}})[_0x999e('0x34')](handleEntityNotFound(_0x16d552,null))[_0x999e('0x34')](saveUpdates(_0x38b48b['body'],null))[_0x999e('0x34')](respondWithResult(_0x16d552,null))[_0x999e('0x28')](handleError(_0x16d552,null));};var utilLicense=require(_0x999e('0x1a'));exports[_0x999e('0x75')]=function(_0x35fcd5,_0x4f6f0f,_0x1004eb){var _0x228d46=_0x999e('0x5c');var _0x4ee1d4={'custom':![]};return utilLicense[_0x999e('0x5d')]()[_0x999e('0x34')](function(_0x412d20){if(_0x412d20){_0x4ee1d4=_0x412d20;}return db['Setting']['find']({'where':{'id':_0x35fcd5[_0x999e('0x4e')]['id']},'attributes':[_0x999e('0x58'),_0x999e('0x5a'),'preferred',_0x999e('0x5f'),_0x999e('0x6b'),_0x999e('0x6c'),'defaultPreferred',_0x999e('0x61')],'raw':!![]});})[_0x999e('0x34')](handleEntityNotFound(_0x4f6f0f,null))['then'](function(_0x45c6fc){if(_0x45c6fc){var _0x5ac17e=_0x45c6fc['favicon']&&fs[_0x999e('0x62')](path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x45c6fc['favicon'])))?path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x45c6fc[_0x999e('0x5f')])):path[_0x999e('0x63')](config['root'],_0x228d46,_[_0x999e('0x64')](_0x999e('0x76')));var _0x3b1a00='default'+_[_0x999e('0x68')](_0x999e('0x5f'));if(_0x45c6fc[_0x3b1a00]||!_0x4ee1d4[_0x999e('0x6e')]){_0x5ac17e=path[_0x999e('0x63')](config[_0x999e('0x65')],_0x228d46,_[_0x999e('0x64')](_0x999e('0x76')));}if(!fs[_0x999e('0x62')](_0x5ac17e)){throw new db['Sequelize'][(_0x999e('0x77'))](_[_0x999e('0x68')](_0x999e('0x5f'))+_0x999e('0x6a'));}return _0x4f6f0f['download'](_0x5ac17e);}})[_0x999e('0x28')](handleError(_0x4f6f0f,null));};exports[_0x999e('0x78')]=function(_0xada3ee,_0x411a6b){var _0x1bca25={'offset':moment()['utcOffset']()};_0x1bca25[_0x999e('0x79')]=moment()[_0x999e('0x7a')](_0x1bca25[_0x999e('0x2d')])[_0x999e('0x7b')](_0x999e('0x7c'));return _0x411a6b[_0x999e('0x2a')](0xc8)['send'](_0x1bca25);}; \ No newline at end of file +var _0x5ee7=['then','Setting,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','destroy','stack','name','send','map','Setting','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','update','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','download','getLogoLogin','server/files/images/logos','favicon','defaultLogo','defaultLoginLogo','default_loginLogo.svg','Sequelize','ValidationError','gdpr','addPreferred','getPreferred','default_preferred.png','custom','\x20not\x20found','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','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','../../mysqldb','jayson/promise','client','request'];(function(_0x170049,_0x2bdd6b){var _0x5cc4f7=function(_0x32e8ac){while(--_0x32e8ac){_0x170049['push'](_0x170049['shift']());}};_0x5cc4f7(++_0x2bdd6b);}(_0x5ee7,0xdc));var _0x75ee=function(_0x3f617d,_0x4d5caf){_0x3f617d=_0x3f617d-0x0;var _0x4502a2=_0x5ee7[_0x3f617d];return _0x4502a2;};'use strict';var emlformat=require(_0x75ee('0x0'));var rimraf=require(_0x75ee('0x1'));var zipdir=require(_0x75ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75ee('0x3'));var moment=require('moment');var BPromise=require(_0x75ee('0x4'));var Mustache=require(_0x75ee('0x5'));var util=require(_0x75ee('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x75ee('0x7'));var fs=require('fs');var fs_extra=require(_0x75ee('0x8'));var _=require(_0x75ee('0x9'));var squel=require('squel');var crypto=require(_0x75ee('0xa'));var jsforce=require(_0x75ee('0xb'));var deskjs=require(_0x75ee('0xc'));var toCsv=require(_0x75ee('0xd'));var querystring=require(_0x75ee('0xe'));var Papa=require(_0x75ee('0xf'));var Redis=require(_0x75ee('0x10'));var authService=require(_0x75ee('0x11'));var qs=require(_0x75ee('0x12'));var as=require(_0x75ee('0x13'));var hardwareService=require(_0x75ee('0x14'));var logger=require(_0x75ee('0x15'))(_0x75ee('0x16'));var utils=require(_0x75ee('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75ee('0x18'))['db'];var jayson=require(_0x75ee('0x19'));var client=jayson[_0x75ee('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249928,_0x548dbf,_0x3bdf58,_0x3b6716){return new BPromise(function(_0x1ae359,_0x578a27){var _0x21fba8=_0x3b6716||client;return _0x21fba8[_0x75ee('0x1b')](_0x249928,_0x3bdf58)[_0x75ee('0x1c')](function(_0x394f73){logger['info'](_0x75ee('0x1d'),_0x548dbf,_0x75ee('0x1e'));logger[_0x75ee('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x548dbf,_0x75ee('0x1e'),JSON['stringify'](_0x394f73));if(_0x394f73[_0x75ee('0x20')]){if(_0x394f73[_0x75ee('0x20')]['code']===0x1f4){logger[_0x75ee('0x20')](_0x75ee('0x1d'),_0x548dbf,_0x394f73[_0x75ee('0x20')][_0x75ee('0x21')]);return _0x578a27(_0x394f73[_0x75ee('0x20')][_0x75ee('0x21')]);}logger[_0x75ee('0x20')](_0x75ee('0x1d'),_0x548dbf,_0x394f73[_0x75ee('0x20')][_0x75ee('0x21')]);return _0x1ae359(_0x394f73[_0x75ee('0x20')]['message']);}else{logger[_0x75ee('0x22')](_0x75ee('0x1d'),_0x548dbf,_0x75ee('0x1e'));_0x1ae359(_0x394f73[_0x75ee('0x23')][_0x75ee('0x21')]);}})[_0x75ee('0x24')](function(_0xce4bd8){logger[_0x75ee('0x20')]('Setting,\x20%s,\x20%s',_0x548dbf,_0xce4bd8);_0x578a27(_0xce4bd8);});});}function respondWithStatusCode(_0xf457e8,_0x47b04d){_0x47b04d=_0x47b04d||0xcc;return function(_0x44a594){if(_0x44a594){return _0xf457e8['sendStatus'](_0x47b04d);}return _0xf457e8['status'](_0x47b04d)[_0x75ee('0x25')]();};}function respondWithResult(_0x47c46c,_0xcc30a9){_0xcc30a9=_0xcc30a9||0xc8;return function(_0x442ad){if(_0x442ad){return _0x47c46c['status'](_0xcc30a9)[_0x75ee('0x26')](_0x442ad);}};}function respondWithFilteredResult(_0x107668,_0x301f97){return function(_0x3a7bec){if(_0x3a7bec){var _0x1fd032=typeof _0x301f97[_0x75ee('0x27')]==='undefined'&&typeof _0x301f97[_0x75ee('0x28')]===_0x75ee('0x29');var _0x2a7743=_0x3a7bec[_0x75ee('0x2a')];var _0x1f1abe=_0x1fd032?0x0:_0x301f97[_0x75ee('0x27')];var _0x1a00d0=_0x1fd032?_0x3a7bec[_0x75ee('0x2a')]:_0x301f97['offset']+_0x301f97[_0x75ee('0x28')];var _0x358edf;if(_0x1a00d0>=_0x2a7743){_0x1a00d0=_0x2a7743;_0x358edf=0xc8;}else{_0x358edf=0xce;}_0x107668[_0x75ee('0x2b')](_0x358edf);return _0x107668['set'](_0x75ee('0x2c'),_0x1f1abe+'-'+_0x1a00d0+'/'+_0x2a7743)[_0x75ee('0x26')](_0x3a7bec);}return null;};}function patchUpdates(_0x48edb6){return function(_0x59ffdb){try{jsonpatch[_0x75ee('0x2d')](_0x59ffdb,_0x48edb6,!![]);}catch(_0x25b871){return BPromise[_0x75ee('0x2e')](_0x25b871);}return _0x59ffdb[_0x75ee('0x2f')]();};}function saveUpdates(_0x644e75,_0x325822){return function(_0x38c456){if(_0x38c456){return _0x38c456['update'](_0x644e75)[_0x75ee('0x1c')](function(_0x3769e1){return _0x3769e1;});}return null;};}function removeEntity(_0x3ae851,_0x5a2098){return function(_0x19eeda){if(_0x19eeda){return _0x19eeda[_0x75ee('0x30')]()[_0x75ee('0x1c')](function(){_0x3ae851['status'](0xcc)[_0x75ee('0x25')]();});}};}function handleEntityNotFound(_0x8e2e34,_0x2e7a80){return function(_0x2067f2){if(!_0x2067f2){_0x8e2e34['sendStatus'](0x194);}return _0x2067f2;};}function handleError(_0xb65d7,_0x453578){_0x453578=_0x453578||0x1f4;return function(_0x4accc8){logger[_0x75ee('0x20')](_0x4accc8[_0x75ee('0x31')]);if(_0x4accc8[_0x75ee('0x32')]){delete _0x4accc8[_0x75ee('0x32')];}_0xb65d7[_0x75ee('0x2b')](_0x453578)[_0x75ee('0x33')](_0x4accc8);};}exports['index']=function(_0x81260b,_0x5e34ac){var _0x5794a8={},_0x4809f2={},_0x3a256f={'count':0x0,'rows':[]};var _0x49d5e3=_[_0x75ee('0x34')](db[_0x75ee('0x35')]['rawAttributes'],function(_0x219790){return{'name':_0x219790[_0x75ee('0x36')],'type':_0x219790[_0x75ee('0x37')][_0x75ee('0x38')]};});_0x4809f2['model']=_[_0x75ee('0x34')](_0x49d5e3,_0x75ee('0x32'));_0x4809f2[_0x75ee('0x39')]=_[_0x75ee('0x3a')](_0x81260b[_0x75ee('0x39')]);_0x4809f2['filters']=_[_0x75ee('0x3b')](_0x4809f2[_0x75ee('0x3c')],_0x4809f2[_0x75ee('0x39')]);_0x5794a8[_0x75ee('0x3d')]=_[_0x75ee('0x3b')](_0x4809f2[_0x75ee('0x3c')],qs[_0x75ee('0x3e')](_0x81260b[_0x75ee('0x39')]['fields']));_0x5794a8['attributes']=_0x5794a8[_0x75ee('0x3d')][_0x75ee('0x3f')]?_0x5794a8[_0x75ee('0x3d')]:_0x4809f2[_0x75ee('0x3c')];if(!_0x81260b[_0x75ee('0x39')][_0x75ee('0x40')]('nolimit')){_0x5794a8['limit']=qs[_0x75ee('0x28')](_0x81260b['query']['limit']);_0x5794a8['offset']=qs['offset'](_0x81260b[_0x75ee('0x39')][_0x75ee('0x27')]);}_0x5794a8[_0x75ee('0x41')]=qs[_0x75ee('0x42')](_0x81260b['query'][_0x75ee('0x42')]);_0x5794a8['where']=qs[_0x75ee('0x43')](_[_0x75ee('0x44')](_0x81260b['query'],_0x4809f2[_0x75ee('0x43')]),_0x49d5e3);if(_0x81260b[_0x75ee('0x39')][_0x75ee('0x45')]){_0x5794a8[_0x75ee('0x46')]=_[_0x75ee('0x47')](_0x5794a8[_0x75ee('0x46')],{'$or':_['map'](_0x49d5e3,function(_0x111df1){if(_0x111df1['type']!==_0x75ee('0x48')){var _0x2de251={};_0x2de251[_0x111df1['name']]={'$like':'%'+_0x81260b['query'][_0x75ee('0x45')]+'%'};return _0x2de251;}})});}_0x5794a8=_[_0x75ee('0x47')]({},_0x5794a8,_0x81260b[_0x75ee('0x49')]);var _0x15ad7f={'where':_0x5794a8[_0x75ee('0x46')]};return db[_0x75ee('0x35')]['count'](_0x15ad7f)['then'](function(_0x1f4326){_0x3a256f[_0x75ee('0x2a')]=_0x1f4326;if(_0x81260b[_0x75ee('0x39')][_0x75ee('0x4a')]){_0x5794a8[_0x75ee('0x4b')]=[{'all':!![]}];}return db[_0x75ee('0x35')][_0x75ee('0x4c')](_0x5794a8);})[_0x75ee('0x1c')](function(_0x1eaf81){_0x3a256f[_0x75ee('0x4d')]=_0x1eaf81;return _0x3a256f;})[_0x75ee('0x1c')](respondWithFilteredResult(_0x5e34ac,_0x5794a8))[_0x75ee('0x24')](handleError(_0x5e34ac,null));};exports[_0x75ee('0x4e')]=function(_0x754a58,_0x1ea551){var _0x58d1a4={'raw':![],'where':{'id':_0x754a58[_0x75ee('0x4f')]['id']}},_0x1ba5b2={};_0x1ba5b2[_0x75ee('0x3c')]=_[_0x75ee('0x3a')](db[_0x75ee('0x35')][_0x75ee('0x50')]);_0x1ba5b2[_0x75ee('0x39')]=_[_0x75ee('0x3a')](_0x754a58[_0x75ee('0x39')]);_0x1ba5b2[_0x75ee('0x43')]=_['intersection'](_0x1ba5b2['model'],_0x1ba5b2[_0x75ee('0x39')]);_0x58d1a4[_0x75ee('0x3d')]=_[_0x75ee('0x3b')](_0x1ba5b2[_0x75ee('0x3c')],qs[_0x75ee('0x3e')](_0x754a58[_0x75ee('0x39')][_0x75ee('0x3e')]));_0x58d1a4[_0x75ee('0x3d')]=_0x58d1a4[_0x75ee('0x3d')][_0x75ee('0x3f')]?_0x58d1a4[_0x75ee('0x3d')]:_0x1ba5b2[_0x75ee('0x3c')];if(_0x754a58[_0x75ee('0x39')][_0x75ee('0x4a')]){_0x58d1a4[_0x75ee('0x4b')]=[{'all':!![]}];}_0x58d1a4=_['merge']({},_0x58d1a4,_0x754a58[_0x75ee('0x49')]);return db[_0x75ee('0x35')][_0x75ee('0x51')](_0x58d1a4)[_0x75ee('0x1c')](handleEntityNotFound(_0x1ea551,null))['then'](respondWithResult(_0x1ea551,null))[_0x75ee('0x24')](handleError(_0x1ea551,null));};exports[_0x75ee('0x52')]=function(_0x14e80d,_0xe3de29){if(_0x14e80d[_0x75ee('0x53')]['id']){delete _0x14e80d[_0x75ee('0x53')]['id'];}return db['Setting']['find']({'where':{'id':_0x14e80d['params']['id']}})[_0x75ee('0x1c')](handleEntityNotFound(_0xe3de29,null))[_0x75ee('0x1c')](saveUpdates(_0x14e80d[_0x75ee('0x53')],null))[_0x75ee('0x1c')](respondWithResult(_0xe3de29,null))[_0x75ee('0x24')](handleError(_0xe3de29,null));};exports[_0x75ee('0x54')]=function(_0x5f2b79,_0x1e47cc,_0xb130a1){if(_0x5f2b79['file']&&_0x5f2b79[_0x75ee('0x55')]['filename']){_0x5f2b79[_0x75ee('0x53')][_0x75ee('0x56')]=_0x5f2b79[_0x75ee('0x55')][_0x75ee('0x57')];}return db[_0x75ee('0x35')][_0x75ee('0x51')]({'where':{'id':_0x5f2b79[_0x75ee('0x4f')]['id']}})[_0x75ee('0x1c')](handleEntityNotFound(_0x1e47cc,null))[_0x75ee('0x1c')](saveUpdates(_0x5f2b79[_0x75ee('0x53')],null))[_0x75ee('0x1c')](respondWithResult(_0x1e47cc,null))[_0x75ee('0x24')](handleError(_0x1e47cc,null));};exports[_0x75ee('0x58')]=function(_0x185c49,_0x47dbd1,_0x56f019){if(_0x185c49[_0x75ee('0x55')]&&_0x185c49[_0x75ee('0x55')][_0x75ee('0x57')]){_0x185c49[_0x75ee('0x53')][_0x75ee('0x59')]=_0x185c49['file'][_0x75ee('0x57')];}return db['Setting']['find']({'where':{'id':_0x185c49['params']['id']}})[_0x75ee('0x1c')](handleEntityNotFound(_0x47dbd1,null))['then'](saveUpdates(_0x185c49['body'],null))[_0x75ee('0x1c')](respondWithResult(_0x47dbd1,null))[_0x75ee('0x24')](handleError(_0x47dbd1,null));};var utilLicense=require(_0x75ee('0x5a'));exports[_0x75ee('0x5b')]=function(_0x527591,_0x275570,_0x3f3bfd){var _0x2a2fea='server/files/images/logos';var _0x37bf3e={'custom':![]};return utilLicense[_0x75ee('0x5c')]()[_0x75ee('0x1c')](function(_0x4d9ac2){if(_0x4d9ac2){_0x37bf3e=_0x4d9ac2;}return db[_0x75ee('0x35')][_0x75ee('0x51')]({'where':{'id':_0x527591[_0x75ee('0x4f')]['id']},'attributes':[_0x75ee('0x56'),_0x75ee('0x59'),_0x75ee('0x5d'),'favicon','defaultLogo','defaultLoginLogo',_0x75ee('0x5e'),_0x75ee('0x5f')],'raw':!![]});})[_0x75ee('0x1c')](handleEntityNotFound(_0x275570,null))['then'](function(_0x2c6e60){if(_0x2c6e60){var _0x190d7c=_0x2c6e60[_0x75ee('0x56')]&&fs[_0x75ee('0x60')](path['join'](config['root'],_0x2a2fea,_['toLower'](_0x2c6e60[_0x75ee('0x56')])))?path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x2a2fea,_[_0x75ee('0x63')](_0x2c6e60['logo'])):path['join'](config[_0x75ee('0x62')],_0x2a2fea,_[_0x75ee('0x63')](_0x75ee('0x64')));var _0x5be1c5=_0x75ee('0x65')+_['upperFirst'](_0x75ee('0x56'));if(_0x2c6e60[_0x5be1c5]||!_0x37bf3e['custom']){_0x190d7c=path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x2a2fea,_[_0x75ee('0x63')](_0x75ee('0x64')));}if(!fs['existsSync'](_0x190d7c)){throw new db['Sequelize']['ValidationError'](_[_0x75ee('0x66')]('logo')+'\x20not\x20found');}return _0x275570[_0x75ee('0x67')](_0x190d7c);}})[_0x75ee('0x24')](handleError(_0x275570,null));};var utilLicense=require('../../config/license/util');exports[_0x75ee('0x68')]=function(_0x460cbd,_0x2fbce5,_0x306053){var _0x725a9c=_0x75ee('0x69');var _0x412b10={'custom':![]};return utilLicense[_0x75ee('0x5c')]()[_0x75ee('0x1c')](function(_0x46f647){if(_0x46f647){_0x412b10=_0x46f647;}return db[_0x75ee('0x35')]['find']({'where':{'id':_0x460cbd[_0x75ee('0x4f')]['id']},'attributes':['logo',_0x75ee('0x59'),_0x75ee('0x5d'),_0x75ee('0x6a'),_0x75ee('0x6b'),_0x75ee('0x6c'),_0x75ee('0x5e'),_0x75ee('0x5f')],'raw':!![]});})[_0x75ee('0x1c')](handleEntityNotFound(_0x2fbce5,null))[_0x75ee('0x1c')](function(_0x2fca3d){if(_0x2fca3d){var _0x5e1c74=_0x2fca3d[_0x75ee('0x59')]&&fs['existsSync'](path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x725a9c,_[_0x75ee('0x63')](_0x2fca3d[_0x75ee('0x59')])))?path['join'](config[_0x75ee('0x62')],_0x725a9c,_['toLower'](_0x2fca3d[_0x75ee('0x59')])):path['join'](config['root'],_0x725a9c,_[_0x75ee('0x63')](_0x75ee('0x6d')));var _0x108e32=_0x75ee('0x65')+_[_0x75ee('0x66')](_0x75ee('0x59'));if(_0x2fca3d[_0x108e32]||!_0x412b10['custom']){_0x5e1c74=path['join'](config['root'],_0x725a9c,_['toLower'](_0x75ee('0x6d')));}if(!fs['existsSync'](_0x5e1c74)){throw new db[(_0x75ee('0x6e'))][(_0x75ee('0x6f'))](_['upperFirst'](_0x75ee('0x59'))+'\x20not\x20found');}return _0x2fbce5['download'](_0x5e1c74);}})[_0x75ee('0x24')](handleError(_0x2fbce5,null));};exports[_0x75ee('0x70')]=function(_0x22d943,_0x36b61e){return db[_0x75ee('0x35')]['find']({'where':{'id':_0x22d943[_0x75ee('0x4f')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x36b61e,null))['catch'](handleError(_0x36b61e,null));};exports[_0x75ee('0x71')]=function(_0x196021,_0x30ae60,_0x51181c){if(_0x196021[_0x75ee('0x55')]&&_0x196021[_0x75ee('0x55')]['filename']){_0x196021['body']['preferred']=_0x196021[_0x75ee('0x55')][_0x75ee('0x57')];}return db[_0x75ee('0x35')][_0x75ee('0x51')]({'where':{'id':_0x196021[_0x75ee('0x4f')]['id']}})[_0x75ee('0x1c')](handleEntityNotFound(_0x30ae60,null))[_0x75ee('0x1c')](saveUpdates(_0x196021[_0x75ee('0x53')],null))[_0x75ee('0x1c')](respondWithResult(_0x30ae60,null))[_0x75ee('0x24')](handleError(_0x30ae60,null));};var utilLicense=require(_0x75ee('0x5a'));exports[_0x75ee('0x72')]=function(_0x35c5aa,_0x259a9e,_0x47d056){var _0x1edf74=_0x75ee('0x69');var _0x459e17={'custom':![]};return utilLicense[_0x75ee('0x5c')]()[_0x75ee('0x1c')](function(_0x302ce9){if(_0x302ce9){_0x459e17=_0x302ce9;}return db[_0x75ee('0x35')]['find']({'where':{'id':_0x35c5aa[_0x75ee('0x4f')]['id']},'attributes':[_0x75ee('0x56'),_0x75ee('0x59'),_0x75ee('0x5d'),_0x75ee('0x6a'),_0x75ee('0x6b'),_0x75ee('0x6c'),_0x75ee('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x75ee('0x1c')](handleEntityNotFound(_0x259a9e,null))[_0x75ee('0x1c')](function(_0xc91863){if(_0xc91863){var _0xdff554=_0xc91863[_0x75ee('0x5d')]&&fs['existsSync'](path['join'](config[_0x75ee('0x62')],_0x1edf74,_['toLower'](_0xc91863['preferred'])))?path[_0x75ee('0x61')](config['root'],_0x1edf74,_[_0x75ee('0x63')](_0xc91863['preferred'])):path['join'](config[_0x75ee('0x62')],_0x1edf74,_[_0x75ee('0x63')](_0x75ee('0x73')));var _0x573c3b=_0x75ee('0x65')+_[_0x75ee('0x66')](_0x75ee('0x5d'));if(_0xc91863[_0x573c3b]||!_0x459e17[_0x75ee('0x74')]||!_0x459e17[_0x75ee('0x5d')]){_0xdff554=path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x1edf74,_[_0x75ee('0x63')](_0x75ee('0x73')));}if(!fs[_0x75ee('0x60')](_0xdff554)){throw new db[(_0x75ee('0x6e'))]['ValidationError'](_[_0x75ee('0x66')](_0x75ee('0x5d'))+_0x75ee('0x75'));}return _0x259a9e[_0x75ee('0x67')](_0xdff554);}})[_0x75ee('0x24')](handleError(_0x259a9e,null));};exports['addFavicon']=function(_0x462fc7,_0x35f5a6,_0x483fba){if(_0x462fc7[_0x75ee('0x55')]&&_0x462fc7[_0x75ee('0x55')][_0x75ee('0x57')]){_0x462fc7[_0x75ee('0x53')][_0x75ee('0x6a')]=_0x462fc7[_0x75ee('0x55')][_0x75ee('0x57')];}return db[_0x75ee('0x35')][_0x75ee('0x51')]({'where':{'id':_0x462fc7[_0x75ee('0x4f')]['id']}})[_0x75ee('0x1c')](handleEntityNotFound(_0x35f5a6,null))['then'](saveUpdates(_0x462fc7[_0x75ee('0x53')],null))['then'](respondWithResult(_0x35f5a6,null))[_0x75ee('0x24')](handleError(_0x35f5a6,null));};var utilLicense=require(_0x75ee('0x5a'));exports[_0x75ee('0x76')]=function(_0x10dea8,_0x26c5a3,_0xfdf536){var _0x292016=_0x75ee('0x69');var _0x5b3db2={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x3acc36){if(_0x3acc36){_0x5b3db2=_0x3acc36;}return db[_0x75ee('0x35')]['find']({'where':{'id':_0x10dea8[_0x75ee('0x4f')]['id']},'attributes':[_0x75ee('0x56'),_0x75ee('0x59'),_0x75ee('0x5d'),'favicon',_0x75ee('0x6b'),'defaultLoginLogo',_0x75ee('0x5e'),_0x75ee('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x26c5a3,null))[_0x75ee('0x1c')](function(_0x11c7b2){if(_0x11c7b2){var _0x3f1644=_0x11c7b2[_0x75ee('0x6a')]&&fs[_0x75ee('0x60')](path['join'](config[_0x75ee('0x62')],_0x292016,_[_0x75ee('0x63')](_0x11c7b2['favicon'])))?path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x292016,_[_0x75ee('0x63')](_0x11c7b2[_0x75ee('0x6a')])):path[_0x75ee('0x61')](config[_0x75ee('0x62')],_0x292016,_[_0x75ee('0x63')](_0x75ee('0x77')));var _0x5cbe7e=_0x75ee('0x65')+_['upperFirst'](_0x75ee('0x6a'));if(_0x11c7b2[_0x5cbe7e]||!_0x5b3db2['custom']){_0x3f1644=path[_0x75ee('0x61')](config['root'],_0x292016,_[_0x75ee('0x63')](_0x75ee('0x77')));}if(!fs[_0x75ee('0x60')](_0x3f1644)){throw new db[(_0x75ee('0x6e'))][(_0x75ee('0x6f'))](_[_0x75ee('0x66')](_0x75ee('0x6a'))+_0x75ee('0x75'));}return _0x26c5a3[_0x75ee('0x67')](_0x3f1644);}})[_0x75ee('0x24')](handleError(_0x26c5a3,null));};exports[_0x75ee('0x78')]=function(_0x568950,_0x2563eb){var _0x22b970={'offset':moment()[_0x75ee('0x79')]()};_0x22b970[_0x75ee('0x7a')]=moment()[_0x75ee('0x79')](_0x22b970['offset'])['format'](_0x75ee('0x7b'));return _0x2563eb[_0x75ee('0x2b')](0xc8)[_0x75ee('0x33')](_0x22b970);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 383297a..9bd1510 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'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 6bbbf7b..6d65e2c 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 _0xc1f4=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Setting','find','raw','options','where','attributes','include','map','model','then','ShowSetting','stringify'];(function(_0x4c5804,_0x1d76e1){var _0x680109=function(_0x3f57fc){while(--_0x3f57fc){_0x4c5804['push'](_0x4c5804['shift']());}};_0x680109(++_0x1d76e1);}(_0xc1f4,0x176));var _0x4c1f=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0xc1f4[_0x3b826d];return _0x38e1b3;};'use strict';var _=require(_0x4c1f('0x0'));var util=require(_0x4c1f('0x1'));var moment=require('moment');var BPromise=require(_0x4c1f('0x2'));var rs=require(_0x4c1f('0x3'));var fs=require('fs');var Redis=require(_0x4c1f('0x4'));var db=require(_0x4c1f('0x5'))['db'];var utils=require(_0x4c1f('0x6'));var logger=require('../../config/logger')(_0x4c1f('0x7'));var config=require(_0x4c1f('0x8'));var jayson=require(_0x4c1f('0x9'));var client=jayson[_0x4c1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28ed01,_0x38b2b1,_0x1a3fb7){return new BPromise(function(_0x3801ea,_0x1b7b6e){return client[_0x4c1f('0xb')](_0x28ed01,_0x1a3fb7)['then'](function(_0xba7d2d){logger[_0x4c1f('0xc')](_0x4c1f('0xd'),_0x38b2b1,_0x4c1f('0xe'));logger[_0x4c1f('0xf')](_0x4c1f('0x10'),_0x38b2b1,_0x4c1f('0xe'),JSON['stringify'](_0xba7d2d));if(_0xba7d2d[_0x4c1f('0x11')]){if(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x12')]===0x1f4){logger[_0x4c1f('0x11')]('Setting,\x20%s,\x20%s',_0x38b2b1,_0xba7d2d['error'][_0x4c1f('0x13')]);return _0x1b7b6e(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);}logger[_0x4c1f('0x11')](_0x4c1f('0xd'),_0x38b2b1,_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);return _0x3801ea(_0xba7d2d[_0x4c1f('0x11')][_0x4c1f('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x38b2b1,_0x4c1f('0xe'));_0x3801ea(_0xba7d2d[_0x4c1f('0x14')][_0x4c1f('0x13')]);}})[_0x4c1f('0x15')](function(_0x3474f2){logger[_0x4c1f('0x11')](_0x4c1f('0xd'),_0x38b2b1,_0x3474f2);_0x1b7b6e(_0x3474f2);});});}exports['ShowSetting']=function(_0x219fbf){var _0x2373c7=this;return new Promise(function(_0x7f4677,_0x2c65db){return db[_0x4c1f('0x16')][_0x4c1f('0x17')]({'raw':_0x219fbf['options']?_0x219fbf['options'][_0x4c1f('0x18')]===undefined?!![]:![]:!![],'where':_0x219fbf['options']?_0x219fbf[_0x4c1f('0x19')][_0x4c1f('0x1a')]||null:null,'attributes':_0x219fbf['options']?_0x219fbf['options'][_0x4c1f('0x1b')]||null:null,'include':_0x219fbf[_0x4c1f('0x19')]?_0x219fbf['options'][_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x219fbf['options'][_0x4c1f('0x1c')],function(_0x188e54){return{'model':db[_0x188e54[_0x4c1f('0x1e')]],'as':_0x188e54['as'],'attributes':_0x188e54['attributes'],'include':_0x188e54[_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x188e54[_0x4c1f('0x1c')],function(_0x272e7a){return{'model':db[_0x272e7a['model']],'as':_0x272e7a['as'],'attributes':_0x272e7a[_0x4c1f('0x1b')],'include':_0x272e7a[_0x4c1f('0x1c')]?_[_0x4c1f('0x1d')](_0x272e7a['include'],function(_0x9e5227){return{'model':db[_0x9e5227['model']],'as':_0x9e5227['as'],'attributes':_0x9e5227['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c1f('0x1f')](function(_0x5a65b0){logger['info'](_0x4c1f('0x20'),_0x219fbf);logger[_0x4c1f('0xf')](_0x4c1f('0x20'),_0x219fbf,JSON[_0x4c1f('0x21')](_0x5a65b0));_0x7f4677(_0x5a65b0);})['catch'](function(_0x27bbf8){logger[_0x4c1f('0x11')](_0x4c1f('0x20'),_0x27bbf8[_0x4c1f('0x13')],_0x219fbf);_0x2c65db(_0x2373c7[_0x4c1f('0x11')](0x1f4,_0x27bbf8[_0x4c1f('0x13')]));});});}; \ No newline at end of file +var _0x26b9=['attributes','include','map','model','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSetting','find','options','raw','where'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x26b9,0x70));var _0x926b=function(_0xa3083e,_0x345ff9){_0xa3083e=_0xa3083e-0x0;var _0x3f3023=_0x26b9[_0xa3083e];return _0x3f3023;};'use strict';var _=require('lodash');var util=require(_0x926b('0x0'));var moment=require(_0x926b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x926b('0x2'))['db'];var utils=require(_0x926b('0x3'));var logger=require('../../config/logger')(_0x926b('0x4'));var config=require(_0x926b('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x926b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x42a958,_0x18ba62,_0x10472f){return new BPromise(function(_0x3bf72a,_0x3c6963){return client[_0x926b('0x7')](_0x42a958,_0x10472f)[_0x926b('0x8')](function(_0x41b430){logger[_0x926b('0x9')](_0x926b('0xa'),_0x18ba62,_0x926b('0xb'));logger[_0x926b('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x18ba62,_0x926b('0xb'),JSON[_0x926b('0xd')](_0x41b430));if(_0x41b430[_0x926b('0xe')]){if(_0x41b430['error'][_0x926b('0xf')]===0x1f4){logger['error'](_0x926b('0xa'),_0x18ba62,_0x41b430[_0x926b('0xe')][_0x926b('0x10')]);return _0x3c6963(_0x41b430[_0x926b('0xe')]['message']);}logger[_0x926b('0xe')](_0x926b('0xa'),_0x18ba62,_0x41b430[_0x926b('0xe')][_0x926b('0x10')]);return _0x3bf72a(_0x41b430['error'][_0x926b('0x10')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x18ba62,'request\x20sent');_0x3bf72a(_0x41b430['result']['message']);}})[_0x926b('0x11')](function(_0x40a3fb){logger[_0x926b('0xe')]('Setting,\x20%s,\x20%s',_0x18ba62,_0x40a3fb);_0x3c6963(_0x40a3fb);});});}exports[_0x926b('0x12')]=function(_0x123dea){var _0x49682f=this;return new Promise(function(_0x3d8f0d,_0xfa34a1){return db['Setting'][_0x926b('0x13')]({'raw':_0x123dea[_0x926b('0x14')]?_0x123dea[_0x926b('0x14')][_0x926b('0x15')]===undefined?!![]:![]:!![],'where':_0x123dea[_0x926b('0x14')]?_0x123dea[_0x926b('0x14')][_0x926b('0x16')]||null:null,'attributes':_0x123dea[_0x926b('0x14')]?_0x123dea[_0x926b('0x14')][_0x926b('0x17')]||null:null,'include':_0x123dea[_0x926b('0x14')]?_0x123dea[_0x926b('0x14')][_0x926b('0x18')]?_[_0x926b('0x19')](_0x123dea[_0x926b('0x14')][_0x926b('0x18')],function(_0x3b9518){return{'model':db[_0x3b9518['model']],'as':_0x3b9518['as'],'attributes':_0x3b9518[_0x926b('0x17')],'include':_0x3b9518[_0x926b('0x18')]?_['map'](_0x3b9518['include'],function(_0x3ec9a7){return{'model':db[_0x3ec9a7[_0x926b('0x1a')]],'as':_0x3ec9a7['as'],'attributes':_0x3ec9a7[_0x926b('0x17')],'include':_0x3ec9a7[_0x926b('0x18')]?_[_0x926b('0x19')](_0x3ec9a7[_0x926b('0x18')],function(_0x175515){return{'model':db[_0x175515[_0x926b('0x1a')]],'as':_0x175515['as'],'attributes':_0x175515['attributes']};}):[]};}):[]};}):[]:[]})[_0x926b('0x8')](function(_0x2ba573){logger[_0x926b('0x9')]('ShowSetting',_0x123dea);logger[_0x926b('0xc')](_0x926b('0x12'),_0x123dea,JSON['stringify'](_0x2ba573));_0x3d8f0d(_0x2ba573);})[_0x926b('0x11')](function(_0x580687){logger[_0x926b('0xe')]('ShowSetting',_0x580687[_0x926b('0x10')],_0x123dea);_0xfa34a1(_0x49682f['error'](0x1f4,_0x580687[_0x926b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e04238f..a18cda4 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7217,0x19e));var _0x7721=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x7217[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x3da3c8,_0x3423d7){_0x3da3c8=_0x3da3c8-0x0;var _0x49d5be=_0xf494[_0x3da3c8];return _0x49d5be;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f08c881..fc1cc0f 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 _0x7891=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','twilio','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5eb36a,_0x57a984){var _0x25605c=function(_0x52a5b2){while(--_0x52a5b2){_0x5eb36a['push'](_0x5eb36a['shift']());}};_0x25605c(++_0x57a984);}(_0x7891,0xca));var _0x1789=function(_0x51e772,_0x495c25){_0x51e772=_0x51e772-0x0;var _0x49fa1f=_0x7891[_0x51e772];return _0x49fa1f;};'use strict';var Sequelize=require(_0x1789('0x0'));var rs=require(_0x1789('0x1'));module['exports']={'name':{'type':Sequelize[_0x1789('0x2')],'unique':_0x1789('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1789('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1789('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1789('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1789('0x4'),'skebby','connectel',_0x1789('0x5'),_0x1789('0x6'),_0x1789('0x7'),_0x1789('0x8'),_0x1789('0x9'),'infobip',_0x1789('0xa'))},'accountSid':{'type':Sequelize[_0x1789('0x2')]},'authId':{'type':Sequelize[_0x1789('0x2')]},'authToken':{'type':Sequelize[_0x1789('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1789('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1789('0x2')]},'senderString':{'type':Sequelize[_0x1789('0x2')]},'deliveryReport':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x1789('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1789('0xc')],'defaultValue':function(){return _0x1789('0xd');}},'notificationSound':{'type':Sequelize[_0x1789('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1789('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1789('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1789('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1789('0xe')],'comment':_0x1789('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1789('0x10'),'set':function(_0x48ca6a){if(!_0x48ca6a)this[_0x1789('0x11')](_0x1789('0x12'),null);this[_0x1789('0x11')](_0x1789('0x13'),_0x48ca6a);}}}; \ No newline at end of file +var _0x2024=['STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x1265fa,_0x1a1fed){var _0x1fe35e=function(_0x533d60){while(--_0x533d60){_0x1265fa['push'](_0x1265fa['shift']());}};_0x1fe35e(++_0x1a1fed);}(_0x2024,0x76));var _0x4202=function(_0x211dac,_0x3ceeb3){_0x211dac=_0x211dac-0x0;var _0xbb1206=_0x2024[_0x211dac];return _0xbb1206;};'use strict';var Sequelize=require(_0x4202('0x0'));var rs=require('randomstring');module[_0x4202('0x1')]={'name':{'type':Sequelize[_0x4202('0x2')],'unique':_0x4202('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4202('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x4202('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x4202('0x2')],'defaultValue':function(){return rs[_0x4202('0x4')]();}},'phone':{'type':Sequelize[_0x4202('0x2')]},'type':{'type':Sequelize[_0x4202('0x5')](_0x4202('0x6'),_0x4202('0x7'),_0x4202('0x8'),_0x4202('0x9'),_0x4202('0xa'),'clickatell',_0x4202('0xb'),_0x4202('0xc'),_0x4202('0xd'),_0x4202('0xe'))},'accountSid':{'type':Sequelize[_0x4202('0x2')]},'authId':{'type':Sequelize[_0x4202('0x2')]},'authToken':{'type':Sequelize[_0x4202('0x2')]},'smsMethod':{'type':Sequelize[_0x4202('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4202('0x2')]},'password':{'type':Sequelize[_0x4202('0x2')]},'apiKey':{'type':Sequelize[_0x4202('0x2')]},'applicationId':{'type':Sequelize[_0x4202('0x2')]},'accountId':{'type':Sequelize[_0x4202('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x4202('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x4202('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4202('0x10')],'defaultValue':function(){return _0x4202('0x11');}},'notificationSound':{'type':Sequelize[_0x4202('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4202('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4202('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4202('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4202('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4202('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x4202('0xf')],'defaultValue':![],'comment':_0x4202('0x14'),'set':function(_0x382e2d){if(!_0x382e2d)this['setDataValue'](_0x4202('0x15'),null);this[_0x4202('0x16')](_0x4202('0x17'),_0x382e2d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2b463bc..b395b50 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 _0xb5e1=['MessageSid','skebby','sender','text','clicksend','messageId','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','send','addApplications','sequelize','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','user','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','status_code','message_id','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','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','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SmsAccounts','name','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','SmsAccountId','getDispositions','findOne','Disposition','length','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','Body'];(function(_0x4dde73,_0x281a14){var _0x100b55=function(_0x13c96c){while(--_0x13c96c){_0x4dde73['push'](_0x4dde73['shift']());}};_0x100b55(++_0x281a14);}(_0xb5e1,0x65));var _0x1b5e=function(_0x26ab0c,_0x1d1d76){_0x26ab0c=_0x26ab0c-0x0;var _0x39292c=_0xb5e1[_0x26ab0c];return _0x39292c;};'use strict';var emlformat=require(_0x1b5e('0x0'));var rimraf=require(_0x1b5e('0x1'));var zipdir=require(_0x1b5e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b5e('0x3'));var moment=require('moment');var BPromise=require(_0x1b5e('0x4'));var Mustache=require(_0x1b5e('0x5'));var util=require(_0x1b5e('0x6'));var path=require(_0x1b5e('0x7'));var sox=require(_0x1b5e('0x8'));var csv=require(_0x1b5e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b5e('0xa'));var _=require('lodash');var squel=require(_0x1b5e('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b5e('0xc'));var deskjs=require(_0x1b5e('0xd'));var toCsv=require(_0x1b5e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b5e('0xe'));var authService=require(_0x1b5e('0xf'));var qs=require(_0x1b5e('0x10'));var as=require(_0x1b5e('0x11'));var hardwareService=require(_0x1b5e('0x12'));var logger=require(_0x1b5e('0x13'))(_0x1b5e('0x14'));var utils=require(_0x1b5e('0x15'));var config=require(_0x1b5e('0x16'));var licenseUtil=require(_0x1b5e('0x17'));var db=require(_0x1b5e('0x18'))['db'];config[_0x1b5e('0x19')]=_[_0x1b5e('0x1a')](config[_0x1b5e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b5e('0x1b'))(new Redis(config[_0x1b5e('0x19')]));require(_0x1b5e('0x1c'))[_0x1b5e('0x1d')](socket);var jayson=require(_0x1b5e('0x1e'));var client=jayson[_0x1b5e('0x1f')][_0x1b5e('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5a644d,_0x51284d,_0x3b611e,_0x2eb9cc){return new BPromise(function(_0x2f5227,_0x9f2af7){var _0x212d6b=_0x2eb9cc||client;return _0x212d6b[_0x1b5e('0x21')](_0x5a644d,_0x3b611e)['then'](function(_0x5be474){logger[_0x1b5e('0x22')](_0x1b5e('0x23'),_0x51284d,_0x1b5e('0x24'));logger[_0x1b5e('0x25')](_0x1b5e('0x26'),_0x51284d,_0x1b5e('0x24'),JSON['stringify'](_0x5be474));if(_0x5be474[_0x1b5e('0x27')]){if(_0x5be474[_0x1b5e('0x27')]['code']===0x1f4){logger[_0x1b5e('0x27')](_0x1b5e('0x23'),_0x51284d,_0x5be474[_0x1b5e('0x27')][_0x1b5e('0x28')]);return _0x9f2af7(_0x5be474['error']['message']);}logger[_0x1b5e('0x27')](_0x1b5e('0x23'),_0x51284d,_0x5be474['error'][_0x1b5e('0x28')]);return _0x2f5227(_0x5be474['error'][_0x1b5e('0x28')]);}else{logger[_0x1b5e('0x22')](_0x1b5e('0x23'),_0x51284d,_0x1b5e('0x24'));_0x2f5227(_0x5be474['result'][_0x1b5e('0x28')]);}})[_0x1b5e('0x29')](function(_0x564582){logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s',_0x51284d,_0x564582);_0x9f2af7(_0x564582);});});}function respondWithStatusCode(_0x1fca39,_0x4be338){_0x4be338=_0x4be338||0xcc;return function(_0x4071c0){if(_0x4071c0){return _0x1fca39[_0x1b5e('0x2a')](_0x4be338);}return _0x1fca39[_0x1b5e('0x2b')](_0x4be338)[_0x1b5e('0x2c')]();};}function respondWithResult(_0x4c1da1,_0x1f7ee0){_0x1f7ee0=_0x1f7ee0||0xc8;return function(_0x405961){if(_0x405961){return _0x4c1da1[_0x1b5e('0x2b')](_0x1f7ee0)['json'](_0x405961);}};}function respondWithFilteredResult(_0x27ff52,_0x569835){return function(_0x315792){if(_0x315792){var _0x16fe9a=typeof _0x569835[_0x1b5e('0x2d')]===_0x1b5e('0x2e')&&typeof _0x569835[_0x1b5e('0x2f')]===_0x1b5e('0x2e');var _0x970dc7=_0x315792[_0x1b5e('0x30')];var _0x512c7e=_0x16fe9a?0x0:_0x569835[_0x1b5e('0x2d')];var _0x4a6c90=_0x16fe9a?_0x315792[_0x1b5e('0x30')]:_0x569835['offset']+_0x569835[_0x1b5e('0x2f')];var _0x1b168d;if(_0x4a6c90>=_0x970dc7){_0x4a6c90=_0x970dc7;_0x1b168d=0xc8;}else{_0x1b168d=0xce;}_0x27ff52['status'](_0x1b168d);return _0x27ff52[_0x1b5e('0x31')](_0x1b5e('0x32'),_0x512c7e+'-'+_0x4a6c90+'/'+_0x970dc7)[_0x1b5e('0x33')](_0x315792);}return null;};}function patchUpdates(_0x5b2722){return function(_0x28513d){try{jsonpatch[_0x1b5e('0x34')](_0x28513d,_0x5b2722,!![]);}catch(_0x145a8f){return BPromise[_0x1b5e('0x35')](_0x145a8f);}return _0x28513d[_0x1b5e('0x36')]();};}function saveUpdates(_0x1a047e,_0x386289){return function(_0x120aeb){if(_0x120aeb){return _0x120aeb[_0x1b5e('0x37')](_0x1a047e)[_0x1b5e('0x38')](function(_0x2432ec){return _0x2432ec;});}return null;};}function removeEntity(_0x99a506,_0x2ea8ce){return function(_0x194ea2){if(_0x194ea2){return _0x194ea2[_0x1b5e('0x39')]()[_0x1b5e('0x38')](function(){var _0x27d894=_0x194ea2[_0x1b5e('0x3a')]({'plain':!![]});var _0xd90a53=_0x1b5e('0x3b');return db['UserProfileResource'][_0x1b5e('0x39')]({'where':{'type':_0xd90a53,'resourceId':_0x27d894['id']}})['then'](function(){return _0x194ea2;});})[_0x1b5e('0x38')](function(){_0x99a506[_0x1b5e('0x2b')](0xcc)[_0x1b5e('0x2c')]();});}};}function handleEntityNotFound(_0x5d4dad,_0x220e27){return function(_0x7fbef9){if(!_0x7fbef9){_0x5d4dad[_0x1b5e('0x2a')](0x194);}return _0x7fbef9;};}function handleError(_0x925a5e,_0x59904d){_0x59904d=_0x59904d||0x1f4;return function(_0x27f696){logger['error'](_0x27f696['stack']);if(_0x27f696[_0x1b5e('0x3c')]){delete _0x27f696[_0x1b5e('0x3c')];}_0x925a5e['status'](_0x59904d)['send'](_0x27f696);};}exports['index']=function(_0x7ce5a2,_0x4e7593){var _0x5072d6={'include':[{'model':db['Pause'],'as':_0x1b5e('0x3d')}]},_0x1e8975={},_0x408b85={'count':0x0,'rows':[]};var _0x54eae7=_[_0x1b5e('0x3e')](db[_0x1b5e('0x3f')][_0x1b5e('0x40')],function(_0x161c6d){return{'name':_0x161c6d[_0x1b5e('0x41')],'type':_0x161c6d[_0x1b5e('0x42')]['key']};});_0x1e8975[_0x1b5e('0x43')]=_[_0x1b5e('0x3e')](_0x54eae7,_0x1b5e('0x3c'));_0x1e8975['query']=_[_0x1b5e('0x44')](_0x7ce5a2[_0x1b5e('0x45')]);_0x1e8975[_0x1b5e('0x46')]=_['intersection'](_0x1e8975[_0x1b5e('0x43')],_0x1e8975[_0x1b5e('0x45')]);_0x5072d6[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x1e8975['model'],qs[_0x1b5e('0x49')](_0x7ce5a2['query'][_0x1b5e('0x49')]));_0x5072d6[_0x1b5e('0x47')]=_0x5072d6[_0x1b5e('0x47')]['length']?_0x5072d6[_0x1b5e('0x47')]:_0x1e8975['model'];if(!_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4a')]('nolimit')){_0x5072d6[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x7ce5a2['query'][_0x1b5e('0x2f')]);_0x5072d6['offset']=qs['offset'](_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x2d')]);}_0x5072d6[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x5072d6[_0x1b5e('0x4d')]=qs['filters'](_['pick'](_0x7ce5a2[_0x1b5e('0x45')],_0x1e8975['filters']),_0x54eae7);if(_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x5072d6[_0x1b5e('0x4d')]=_['merge'](_0x5072d6[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x54eae7,function(_0x3aac51){if(_0x3aac51[_0x1b5e('0x42')]!==_0x1b5e('0x4f')){var _0x26b590={};_0x26b590[_0x3aac51[_0x1b5e('0x3c')]]={'$like':'%'+_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x26b590;}})});}_0x5072d6=_[_0x1b5e('0x50')]({},_0x5072d6,_0x7ce5a2[_0x1b5e('0x51')]);var _0x2f972e={'where':_0x5072d6[_0x1b5e('0x4d')]};return db[_0x1b5e('0x3f')]['count'](_0x2f972e)[_0x1b5e('0x38')](function(_0x305689){_0x408b85['count']=_0x305689;if(_0x7ce5a2[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0x5072d6[_0x1b5e('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0x1b5e('0x54')](_0x5072d6);})['then'](function(_0x393dcc){_0x408b85[_0x1b5e('0x55')]=_0x393dcc;return _0x408b85;})[_0x1b5e('0x38')](respondWithFilteredResult(_0x4e7593,_0x5072d6))['catch'](handleError(_0x4e7593,null));};exports[_0x1b5e('0x56')]=function(_0x5b06b1,_0x5d152e){var _0x200895={'raw':![],'where':{'id':_0x5b06b1[_0x1b5e('0x57')]['id']},'include':[{'model':db[_0x1b5e('0x58')],'as':_0x1b5e('0x3d')}]},_0x1a8352={};_0x1a8352[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x3f')][_0x1b5e('0x40')]);_0x1a8352[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x5b06b1[_0x1b5e('0x45')]);_0x1a8352[_0x1b5e('0x46')]=_[_0x1b5e('0x48')](_0x1a8352[_0x1b5e('0x43')],_0x1a8352['query']);_0x200895['attributes']=_[_0x1b5e('0x48')](_0x1a8352[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x5b06b1[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x200895['attributes']=_0x200895[_0x1b5e('0x47')]['length']?_0x200895[_0x1b5e('0x47')]:_0x1a8352['model'];if(_0x5b06b1['query'][_0x1b5e('0x52')]){_0x200895['include']=[{'all':!![]}];}_0x200895=_['merge']({},_0x200895,_0x5b06b1[_0x1b5e('0x51')]);return db[_0x1b5e('0x3f')]['find'](_0x200895)[_0x1b5e('0x38')](handleEntityNotFound(_0x5d152e,null))[_0x1b5e('0x38')](respondWithResult(_0x5d152e,null))[_0x1b5e('0x29')](handleError(_0x5d152e,null));};exports[_0x1b5e('0x59')]=function(_0x2deeb5,_0xb1a19){return db[_0x1b5e('0x3f')]['create'](_0x2deeb5['body'],{})['then'](function(_0x59e512){var _0xeadaa0=_0x2deeb5['user'][_0x1b5e('0x3a')]({'plain':!![]});if(!_0xeadaa0)throw new Error(_0x1b5e('0x5a'));if(_0xeadaa0[_0x1b5e('0x5b')]==='user'){var _0x222476=_0x59e512['get']({'plain':!![]});var _0xcc68f4='SmsAccounts';return db[_0x1b5e('0x5c')]['find']({'where':{'name':_0xcc68f4,'userProfileId':_0xeadaa0[_0x1b5e('0x5d')]},'raw':!![]})[_0x1b5e('0x38')](function(_0x216690){if(_0x216690&&_0x216690[_0x1b5e('0x5e')]===0x0){return db[_0x1b5e('0x5f')][_0x1b5e('0x59')]({'name':_0x222476['name'],'resourceId':_0x222476['id'],'type':_0x216690['name'],'sectionId':_0x216690['id']},{})[_0x1b5e('0x38')](function(){return _0x59e512;});}else{return _0x59e512;}})['catch'](function(_0x133ddc){logger[_0x1b5e('0x27')](_0x1b5e('0x60'),_0x133ddc);throw _0x133ddc;});}return _0x59e512;})[_0x1b5e('0x38')](respondWithResult(_0xb1a19,0xc9))[_0x1b5e('0x29')](handleError(_0xb1a19,null));};exports[_0x1b5e('0x37')]=function(_0x4d6d3a,_0x5a712b){if(_0x4d6d3a[_0x1b5e('0x61')]['id']){delete _0x4d6d3a['body']['id'];}return db['SmsAccount'][_0x1b5e('0x62')]({'where':{'id':_0x4d6d3a[_0x1b5e('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x1b5e('0x3d')}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x5a712b,null))[_0x1b5e('0x38')](saveUpdates(_0x4d6d3a[_0x1b5e('0x61')],null))[_0x1b5e('0x38')](respondWithResult(_0x5a712b,null))[_0x1b5e('0x29')](handleError(_0x5a712b,null));};exports['destroy']=function(_0x49cf8a,_0x8f2859){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x49cf8a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x8f2859,null))[_0x1b5e('0x38')](removeEntity(_0x8f2859,null))[_0x1b5e('0x29')](handleError(_0x8f2859,null));};exports[_0x1b5e('0x63')]=function(_0x1b0f62,_0x2d46df){return db[_0x1b5e('0x3f')][_0x1b5e('0x63')]()[_0x1b5e('0x38')](respondWithResult(_0x2d46df,null))[_0x1b5e('0x29')](handleError(_0x2d46df,null));};exports['addDisposition']=function(_0x3bdd57,_0x1ac388,_0xb5eaef){if(_0x3bdd57[_0x1b5e('0x61')]['id']){delete _0x3bdd57[_0x1b5e('0x61')]['id'];}return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x3bdd57[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1ac388,null))['then'](function(_0x3f62ca){if(_0x3f62ca){_0x3bdd57[_0x1b5e('0x61')][_0x1b5e('0x64')]=_0x3f62ca['id'];return db['Disposition'][_0x1b5e('0x59')](_0x3bdd57[_0x1b5e('0x61')]);}})[_0x1b5e('0x38')](respondWithResult(_0x1ac388,null))[_0x1b5e('0x29')](handleError(_0x1ac388,null));};exports[_0x1b5e('0x65')]=function(_0x3b5b49,_0x2d8ebc,_0x3b51b1){var _0x5e7f58={'raw':![],'where':{}};var _0x30a89d={};var _0x17c6bd={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x3b5b49[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0x2d8ebc,null))[_0x1b5e('0x38')](function(_0x5e52d7){if(_0x5e52d7){_0x30a89d[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x67')]['rawAttributes']);_0x30a89d[_0x1b5e('0x45')]=_['keys'](_0x3b5b49[_0x1b5e('0x45')]);_0x30a89d['filters']=_[_0x1b5e('0x48')](_0x30a89d[_0x1b5e('0x43')],_0x30a89d['query']);_0x5e7f58[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x30a89d[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x5e7f58['attributes']=_0x5e7f58[_0x1b5e('0x47')][_0x1b5e('0x68')]?_0x5e7f58['attributes']:_0x30a89d[_0x1b5e('0x43')];if(!_0x3b5b49['query'][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0x5e7f58[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x2f')]);_0x5e7f58['offset']=qs[_0x1b5e('0x2d')](_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x2d')]);}_0x5e7f58[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x3b5b49[_0x1b5e('0x45')]['sort']);_0x5e7f58[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x3b5b49[_0x1b5e('0x45')],_0x30a89d['filters']));_0x5e7f58[_0x1b5e('0x4d')][_0x1b5e('0x64')]=_0x5e52d7['id'];if(_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x5e7f58['where']=_[_0x1b5e('0x50')](_0x5e7f58[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x5e7f58[_0x1b5e('0x47')],function(_0x195912){var _0xcc3a50={};_0xcc3a50[_0x195912]={'$like':'%'+_0x3b5b49[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0xcc3a50;})});}_0x5e7f58=_[_0x1b5e('0x50')]({},_0x5e7f58,_0x3b5b49[_0x1b5e('0x51')]);return db['Disposition']['count']({'where':_0x5e7f58[_0x1b5e('0x4d')]})[_0x1b5e('0x38')](function(_0x39bc7c){_0x17c6bd['count']=_0x39bc7c;if(_0x3b5b49['query']['includeAll']){_0x5e7f58[_0x1b5e('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5e7f58);})[_0x1b5e('0x38')](function(_0x3243d4){_0x17c6bd[_0x1b5e('0x55')]=_0x3243d4;return _0x17c6bd;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x2d8ebc,_0x5e7f58))[_0x1b5e('0x29')](handleError(_0x2d8ebc,null));};exports[_0x1b5e('0x6b')]=function(_0x1970f4,_0xfd1ce8,_0x3363fc){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x1970f4[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0xfd1ce8,null))['then'](function(_0x55acc8){if(_0x55acc8){return _0x55acc8[_0x1b5e('0x6b')](_0x1970f4['query'][_0x1b5e('0x6c')]);}})[_0x1b5e('0x38')](respondWithStatusCode(_0xfd1ce8,null))['catch'](handleError(_0xfd1ce8,null));};exports[_0x1b5e('0x6d')]=function(_0x119fdb,_0xc67392,_0xc5d100){if(_0x119fdb[_0x1b5e('0x61')]['id']){delete _0x119fdb[_0x1b5e('0x61')]['id'];}return db[_0x1b5e('0x3f')]['find']({'where':{'id':_0x119fdb[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0xc67392,null))[_0x1b5e('0x38')](function(_0x599361){if(_0x599361){_0x119fdb[_0x1b5e('0x61')][_0x1b5e('0x64')]=_0x599361['id'];return db[_0x1b5e('0x6e')][_0x1b5e('0x59')](_0x119fdb[_0x1b5e('0x61')]);}})[_0x1b5e('0x38')](respondWithResult(_0xc67392,null))[_0x1b5e('0x29')](handleError(_0xc67392,null));};exports['getAnswers']=function(_0xc5d3e4,_0x477b08,_0x44a8d7){var _0x1ff21c={'raw':![],'where':{}};var _0x38482e={};var _0x461481={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0xc5d3e4[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x477b08,null))[_0x1b5e('0x38')](function(_0x46df5d){if(_0x46df5d){_0x38482e[_0x1b5e('0x43')]=_[_0x1b5e('0x44')](db['CannedAnswer'][_0x1b5e('0x40')]);_0x38482e[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0xc5d3e4[_0x1b5e('0x45')]);_0x38482e['filters']=_[_0x1b5e('0x48')](_0x38482e[_0x1b5e('0x43')],_0x38482e[_0x1b5e('0x45')]);_0x1ff21c[_0x1b5e('0x47')]=_['intersection'](_0x38482e['model'],qs[_0x1b5e('0x49')](_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x1ff21c[_0x1b5e('0x47')]=_0x1ff21c[_0x1b5e('0x47')][_0x1b5e('0x68')]?_0x1ff21c[_0x1b5e('0x47')]:_0x38482e['model'];if(!_0xc5d3e4[_0x1b5e('0x45')]['hasOwnProperty'](_0x1b5e('0x69'))){_0x1ff21c['limit']=qs[_0x1b5e('0x2f')](_0xc5d3e4['query'][_0x1b5e('0x2f')]);_0x1ff21c['offset']=qs[_0x1b5e('0x2d')](_0xc5d3e4['query']['offset']);}_0x1ff21c[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x1ff21c[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0xc5d3e4[_0x1b5e('0x45')],_0x38482e['filters']));_0x1ff21c[_0x1b5e('0x4d')]['SmsAccountId']=_0x46df5d['id'];if(_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x1ff21c[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0x1ff21c['where'],{'$or':_['map'](_0x1ff21c[_0x1b5e('0x47')],function(_0x38d017){var _0x10d99f={};_0x10d99f[_0x38d017]={'$like':'%'+_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x10d99f;})});}_0x1ff21c=_[_0x1b5e('0x50')]({},_0x1ff21c,_0xc5d3e4[_0x1b5e('0x51')]);return db[_0x1b5e('0x6e')][_0x1b5e('0x30')]({'where':_0x1ff21c['where']})[_0x1b5e('0x38')](function(_0x181362){_0x461481[_0x1b5e('0x30')]=_0x181362;if(_0xc5d3e4[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0x1ff21c['include']=[{'all':!![]}];}return db[_0x1b5e('0x6e')][_0x1b5e('0x54')](_0x1ff21c);})[_0x1b5e('0x38')](function(_0x4896c4){_0x461481[_0x1b5e('0x55')]=_0x4896c4;return _0x461481;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x477b08,_0x1ff21c))[_0x1b5e('0x29')](handleError(_0x477b08,null));};exports[_0x1b5e('0x6f')]=function(_0x48ecbc,_0x44405a,_0x4607e6){return db['SmsAccount']['find']({'where':{'id':_0x48ecbc[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x44405a,null))['then'](function(_0x8b83c9){if(_0x8b83c9){return _0x8b83c9['removeAnswers'](_0x48ecbc[_0x1b5e('0x45')][_0x1b5e('0x6c')]);}})[_0x1b5e('0x38')](respondWithStatusCode(_0x44405a,null))['catch'](handleError(_0x44405a,null));};exports['notify']=function(_0x279df,_0x1d6c36,_0x213aa8){var _0x1913cc={'channel':_0x1b5e('0x70')};var _0x49b06e=[];var _0x755093=[];var _0x2f8ea4={};return db[_0x1b5e('0x3f')]['find']({'where':{'id':_0x279df['params']['id']},'include':[{'model':db[_0x1b5e('0x71')],'as':_0x1b5e('0x72')}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))['then'](function(_0x27c7c7){_0x1913cc[_0x1b5e('0x73')]=_0x27c7c7;_0x1913cc[_0x1b5e('0x74')]=_[_0x1b5e('0x75')](_0x27c7c7[_0x1b5e('0x72')],[_0x1b5e('0x76')],[_0x1b5e('0x77')]);if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x72')]){delete _0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x72')];}return db['CmContact']['describe']();})[_0x1b5e('0x38')](function(_0x3831c2){if(!_0x3831c2){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0x79'));}_0x49b06e=_[_0x1b5e('0x7a')](_[_0x1b5e('0x44')](_0x3831c2),[_0x1b5e('0x7b'),_0x1b5e('0x7c')]);_0x755093=_[_0x1b5e('0x7a')](_[_0x1b5e('0x44')](_0x3831c2),[_0x1b5e('0x7b'),_0x1b5e('0x7c'),_0x1b5e('0x7d'),_0x1b5e('0x7e')]);_0x1913cc[_0x1b5e('0x61')]={'mapKey':_0x1b5e('0x7f')};if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0x42')]){switch(_0x1913cc[_0x1b5e('0x73')]['type']){case'twilio':_0x1913cc['body'][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')]['From'];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x81')];_0x1913cc['body']['messageId']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x82')];break;case _0x1b5e('0x83'):_0x1913cc[_0x1b5e('0x61')]['from']='+'+_0x279df[_0x1b5e('0x61')][_0x1b5e('0x84')];_0x1913cc['body'][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x85')];break;case'connectel':_0x1913cc[_0x1b5e('0x61')]['from']=_0x279df['body'][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x28')];break;case _0x1b5e('0x86'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x61')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body']['message_id'];break;case _0x1b5e('0x88'):_0x1913cc['body']['from']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x89')];_0x1913cc['body'][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8a')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body'][_0x1b5e('0x8b')];break;case _0x1b5e('0x8c'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]='+'+_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')]['body']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0]['text'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body']['results'][0x0][_0x1b5e('0x87')];break;case _0x1b5e('0x8e'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x8f')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x90')][_0x1b5e('0x28')];break;case _0x1b5e('0x91'):_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df['body'][_0x1b5e('0x92')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df['body']['text'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x87')]=_0x279df['body'][_0x1b5e('0x93')];break;case _0x1b5e('0x94'):_0x1913cc[_0x1b5e('0x61')]['messageId']=_0x279df['body'][0x0][_0x1b5e('0x28')]['id'];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')][_0x1b5e('0x80')];_0x1913cc['body']['body']=_0x279df['body'][0x0][_0x1b5e('0x28')][_0x1b5e('0x85')];break;case'intelepeer':_0x1913cc['body'][_0x1b5e('0x80')]=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x80')];_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')]=_0x279df[_0x1b5e('0x61')]['message'];_0x1913cc[_0x1b5e('0x61')]['messageId']=_0x279df[_0x1b5e('0x61')][_0x1b5e('0x95')];break;}}if(_0x1913cc[_0x1b5e('0x61')]['id']){delete _0x1913cc[_0x1b5e('0x61')]['id'];}if(_['isNil'](_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')])){throw new db['Sequelize'][(_0x1b5e('0x96'))](_0x1b5e('0x97'));}if(_[_0x1b5e('0x98')](_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')])||_0x1913cc[_0x1b5e('0x61')]['body']===''){throw new db[(_0x1b5e('0x78'))][(_0x1b5e('0x96'))](_0x1b5e('0x99'));}if(_[_0x1b5e('0x98')](_0x1913cc[_0x1b5e('0x61')]['mapKey'])){throw new db[(_0x1b5e('0x78'))][(_0x1b5e('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x755093);}if(!_[_0x1b5e('0x9a')](_0x755093,_0x1913cc['body'][_0x1b5e('0x9b')])){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0x9c')+_0x755093);}_0x2f8ea4[_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x9b')]]=_0x1913cc['body'][_0x1b5e('0x80')];return db[_0x1b5e('0x9d')][_0x1b5e('0x62')]({'where':{'id':_0x1913cc[_0x1b5e('0x73')]['ListId']},'include':[{'model':db[_0x1b5e('0x9e')],'as':_0x1b5e('0x9f'),'where':_0x2f8ea4,'limit':0x1,'order':[['updatedAt',_0x1b5e('0xa0')]]}]});})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))[_0x1b5e('0x38')](function(_0x506036){if(_0x506036){_0x1913cc[_0x1b5e('0xa1')]=_['omit'](_0x506036,[_0x1b5e('0x9f')]);if(_0x506036[_0x1b5e('0x9f')][_0x1b5e('0x68')]){return _0x506036[_0x1b5e('0x9f')][0x0];}var _0x2fa9d2=_['defaults'](_0x1913cc[_0x1b5e('0x61')],{'firstName':_0x1913cc['body']['from'],'ListId':_0x506036['id']});_0x2fa9d2[_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x9b')]]=_0x1913cc[_0x1b5e('0x61')]['from'];return db[_0x1b5e('0x9e')]['create'](_0x2fa9d2,{'fields':_0x49b06e,'raw':!![]});}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1d6c36,null))['then'](function(_0x8dfd70){if(_0x8dfd70){_0x1913cc[_0x1b5e('0xa2')]=_0x8dfd70;var _0x4337ad={'ContactId':_0x8dfd70['id'],'phone':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id']};var _0x452e0d={'ContactId':_0x8dfd70['id'],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id'],'closed':![]};return db[_0x1b5e('0xa3')][_0x1b5e('0x62')]({'where':_0x452e0d})[_0x1b5e('0x38')](function(_0x33c834){if(_0x33c834){return[_0x33c834,![]];}return db[_0x1b5e('0xa3')][_0x1b5e('0x59')](_0x4337ad)['then'](function(_0x31ccc1){return[_0x31ccc1,!![]];});});}})[_0x1b5e('0xa4')](function(_0x5ec791,_0x255d5b){_0x1913cc['interaction']=_0x5ec791[_0x1b5e('0x3a')]({'plain':!![]});_0x1913cc[_0x1b5e('0xa5')]['created']=![];if(_0x255d5b){if(_0x1913cc[_0x1b5e('0x73')][_0x1b5e('0xa6')]){_0x1913cc[_0x1b5e('0x74')][_0x1b5e('0xa7')]({'id':0x0,'priority':_0x1913cc['applications'][_0x1b5e('0x68')]+0x1,'app':_0x1b5e('0xa8'),'appdata':_0x1b5e('0xa9'),'interval':_0x1b5e('0xaa')});}_0x1913cc[_0x1b5e('0xa5')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x80')],'messageId':_0x1913cc['body'][_0x1b5e('0x87')],'body':_0x1913cc[_0x1b5e('0x61')][_0x1b5e('0x61')],'SmsAccountId':_0x279df[_0x1b5e('0x57')]['id'],'SmsInteractionId':_0x5ec791['id'],'direction':'in','ContactId':_0x5ec791['ContactId'],'AttachmentId':_0x1913cc['body']['AttachmentId']});})['then'](function(_0x4160a1){_0x1913cc['message']=_0x4160a1;if(_0x1913cc['interaction'][_0x1b5e('0xab')]){return db[_0x1b5e('0xac')][_0x1b5e('0x62')]({'attributes':['id','name'],'where':{'id':_0x1913cc[_0x1b5e('0xa5')][_0x1b5e('0xab')]}})[_0x1b5e('0x38')](function(_0x3177d3){if(_0x3177d3){_0x1913cc['applications'][_0x1b5e('0xad')]({'id':0x0,'priority':0x0,'app':_0x1b5e('0xae'),'appdata':_0x3177d3[_0x1b5e('0x3c')]+','+(_0x1913cc['account'][_0x1b5e('0xaf')]||0xa),'interval':_0x1b5e('0xaa')});}return respondWithRpcPromise(_0x1b5e('0xb0'),_0x1b5e('0xb1'),_0x1913cc);});}return respondWithRpcPromise(_0x1b5e('0xb0'),_0x1b5e('0xb1'),_0x1913cc);})[_0x1b5e('0x38')](function(_0x2ca019){if(_0x2ca019){var _0x2affc2=0xc8;var _0x26496a=_0x1b5e('0xb2');logger[_0x1b5e('0x22')](_0x1b5e('0x26'),_0x26496a,_0x2affc2,_0x1b5e('0xb3'));logger[_0x1b5e('0x25')](_0x1b5e('0xb4'),_0x26496a,_0x2affc2,'entity\x20found',JSON[_0x1b5e('0xb5')](_0x2ca019));if(_0x1913cc[_0x1b5e('0x73')]['type']===_0x1b5e('0xb6')){return _0x1d6c36['status'](_0x2affc2)[_0x1b5e('0x31')](_0x1b5e('0xb7'),_0x1b5e('0xb8'))[_0x1b5e('0xb9')]('\x0a');}else{return _0x1d6c36[_0x1b5e('0x2b')](_0x2affc2)[_0x1b5e('0x33')](_0x2ca019);}}})['catch'](handleError(_0x1d6c36,null));};exports[_0x1b5e('0xba')]=function(_0x4bc29d,_0x48bebe){var _0x1ddfb8=_0x4bc29d['params']['id'];var _0x5800ca=_0x4bc29d[_0x1b5e('0x61')];var _0x5656f7=0xc8;var _0x5cb821=null;return db[_0x1b5e('0xbb')]['transaction']({'isolationLevel':db[_0x1b5e('0xbb')]['Transaction']['ISOLATION_LEVELS'][_0x1b5e('0xbc')]},function(_0x132e32){return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x1ddfb8},'transaction':_0x132e32})[_0x1b5e('0x38')](function(_0x298364){if(_0x298364){return db['SmsApplication'][_0x1b5e('0x39')]({'where':{'SmsAccountId':_0x1ddfb8},'transaction':_0x132e32})[_0x1b5e('0x38')](function(){var _0x521142=_[_0x1b5e('0x3e')](_0x5800ca,function(_0x7443d3){_0x7443d3[_0x1b5e('0x64')]=_0x1ddfb8;return _0x7443d3;});return db[_0x1b5e('0x71')]['bulkCreate'](_0x521142,{'transaction':_0x132e32});});}else{_0x5656f7=0x194;_0x5cb821=[];}});})[_0x1b5e('0x38')](function(){if(_0x5656f7!==0x194){return db[_0x1b5e('0x71')][_0x1b5e('0xbd')]({'where':{'SmsAccountId':_0x1ddfb8},'order':_0x1b5e('0x76')})[_0x1b5e('0x38')](function(_0x3851cb){_0x5cb821=_0x3851cb;});}})[_0x1b5e('0x29')](function(_0x1f244d){_0x5656f7=0x1f4;logger['error'](_0x1f244d[_0x1b5e('0xbe')]);if(_0x1f244d[_0x1b5e('0x3c')]){delete _0x1f244d[_0x1b5e('0x3c')];}_0x5cb821=_0x1f244d;})[_0x1b5e('0xbf')](function(){if(_0x5cb821===null){_0x48bebe[_0x1b5e('0x2a')](_0x5656f7);}else{if(_0x5656f7===0x1f4){_0x48bebe['status'](_0x5656f7)[_0x1b5e('0xb9')](_0x5cb821);}else{_0x48bebe[_0x1b5e('0x2b')](_0x5656f7)[_0x1b5e('0x33')](_0x5cb821);}}});};exports[_0x1b5e('0xc0')]=function(_0x4ce1aa,_0xa06c20,_0x2339ee){var _0x347364={};var _0x251e30={};var _0x45c1e6;var _0x6bd873;return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x4ce1aa[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0xa06c20,null))[_0x1b5e('0x38')](function(_0x1412dd){if(_0x1412dd){_0x45c1e6=_0x1412dd;_0x251e30[_0x1b5e('0x43')]=_['keys'](db[_0x1b5e('0x71')][_0x1b5e('0x40')]);_0x251e30[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x4ce1aa[_0x1b5e('0x45')]);_0x251e30['filters']=_[_0x1b5e('0x48')](_0x251e30[_0x1b5e('0x43')],_0x251e30[_0x1b5e('0x45')]);_0x347364['attributes']=_['intersection'](_0x251e30[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x49')]));_0x347364[_0x1b5e('0x47')]=_0x347364['attributes']['length']?_0x347364[_0x1b5e('0x47')]:_0x251e30[_0x1b5e('0x43')];_0x347364[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0x347364[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x4ce1aa['query'],_0x251e30[_0x1b5e('0x46')]));if(_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0x347364[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0x347364[_0x1b5e('0x4d')],{'$or':_[_0x1b5e('0x3e')](_0x347364[_0x1b5e('0x47')],function(_0x4312d2){var _0x1246ed={};_0x1246ed[_0x4312d2]={'$like':'%'+_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x1246ed;})});}_0x347364=_[_0x1b5e('0x50')]({},_0x347364,_0x4ce1aa[_0x1b5e('0x51')]);return _0x45c1e6['getApplications'](_0x347364);}})[_0x1b5e('0x38')](function(_0x5ba07c){if(_0x5ba07c){_0x6bd873=_0x5ba07c['length'];if(!_0x4ce1aa[_0x1b5e('0x45')][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0x347364[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x4ce1aa[_0x1b5e('0x45')]['limit']);_0x347364[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x4ce1aa[_0x1b5e('0x45')]['offset']);}return _0x45c1e6[_0x1b5e('0xc0')](_0x347364);}})[_0x1b5e('0x38')](function(_0x3aded9){if(_0x3aded9){return _0x3aded9?{'count':_0x6bd873,'rows':_0x3aded9}:null;}})[_0x1b5e('0x38')](respondWithResult(_0xa06c20,null))['catch'](handleError(_0xa06c20,null));};exports[_0x1b5e('0xc1')]=function(_0x11d963,_0x1ee1ed,_0x37f93b){var _0xb385db={'raw':![],'where':{}};var _0x40813e={};var _0x1344c5={'count':0x0,'rows':[]};return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x11d963['params']['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x1ee1ed,null))[_0x1b5e('0x38')](function(_0x180ec1){if(_0x180ec1){_0x40813e[_0x1b5e('0x43')]=_[_0x1b5e('0x44')](db['SmsInteraction'][_0x1b5e('0x40')]);_0x40813e[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x11d963[_0x1b5e('0x45')]);_0x40813e[_0x1b5e('0x46')]=_[_0x1b5e('0x48')](_0x40813e[_0x1b5e('0x43')],_0x40813e[_0x1b5e('0x45')]);_0xb385db[_0x1b5e('0x47')]=_['intersection'](_0x40813e[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x11d963['query'][_0x1b5e('0x49')]));_0xb385db['attributes']=_0xb385db[_0x1b5e('0x47')]['length']?_0xb385db[_0x1b5e('0x47')]:_0x40813e[_0x1b5e('0x43')];if(!_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4a')]('nolimit')){_0xb385db[_0x1b5e('0x2f')]=qs[_0x1b5e('0x2f')](_0x11d963[_0x1b5e('0x45')]['limit']);_0xb385db[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x11d963[_0x1b5e('0x45')]['offset']);}_0xb385db['order']=qs['sort'](_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0xb385db[_0x1b5e('0x4d')]=qs[_0x1b5e('0x46')](_[_0x1b5e('0x6a')](_0x11d963['query'],_0x40813e[_0x1b5e('0x46')]));_0xb385db[_0x1b5e('0x4d')][_0x1b5e('0x64')]=_0x180ec1['id'];if(_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0xb385db[_0x1b5e('0x4d')]=_[_0x1b5e('0x50')](_0xb385db['where'],{'$or':_['map'](_0xb385db[_0x1b5e('0x47')],function(_0x3aa316){var _0x26951b={};_0x26951b[_0x3aa316]={'$like':'%'+_0x11d963[_0x1b5e('0x45')]['filter']+'%'};return _0x26951b;})});}_0xb385db=_['merge']({},_0xb385db,_0x11d963['options']);return db[_0x1b5e('0xa3')]['count']({'where':_0xb385db[_0x1b5e('0x4d')]})['then'](function(_0xd7069e){_0x1344c5['count']=_0xd7069e;if(_0x11d963[_0x1b5e('0x45')][_0x1b5e('0x52')]){_0xb385db['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x1b5e('0xc2'),'attributes':[_0x1b5e('0x3c'),_0x1b5e('0xc3'),_0x1b5e('0xc4')],'required':![]},{'model':db[_0x1b5e('0xc5')],'as':'Tags','attributes':['id','name',_0x1b5e('0xc6')],'where':_0x11d963[_0x1b5e('0x45')][_0x1b5e('0xc7')]?{'id':_0x11d963['query'][_0x1b5e('0xc7')]}:undefined,'required':_0x11d963[_0x1b5e('0x45')][_0x1b5e('0xc7')]?!![]:![]}];}return db['SmsInteraction'][_0x1b5e('0x54')](_0xb385db);})[_0x1b5e('0x38')](function(_0x59321d){_0x1344c5[_0x1b5e('0x55')]=_0x59321d;return _0x1344c5;});}})[_0x1b5e('0x38')](respondWithFilteredResult(_0x1ee1ed,_0xb385db))[_0x1b5e('0x29')](handleError(_0x1ee1ed,null));};exports['send']=function(_0x5a9198,_0x460f1f,_0x4a770f){var _0xe89575,_0x4853f6,_0x334af9;if(_['isNil'](_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')])||_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')]===''){throw new db['Sequelize'][(_0x1b5e('0x96'))](_0x1b5e('0x99'));}if(_[_0x1b5e('0x98')](_0x5a9198[_0x1b5e('0x61')]['to'])){throw new db[(_0x1b5e('0x78'))]['ValidationError'](_0x1b5e('0xc8'));}_0xe89575=_0x5a9198['body']['to'];return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x5a9198[_0x1b5e('0x57')]['id']},'include':[{'model':db[_0x1b5e('0x9d')],'as':_0x1b5e('0xc9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0xe89575},'limit':0x1,'order':[[_0x1b5e('0x7c'),_0x1b5e('0xa0')]]}]}]})[_0x1b5e('0x38')](handleEntityNotFound(_0x460f1f,null))['then'](function(_0xe4c3d2){if(_0xe4c3d2&&_0xe4c3d2['List']){_0x4853f6=_0xe4c3d2[_0x1b5e('0x3a')]({'plain':!![]});if(_0x4853f6[_0x1b5e('0xc9')]&&_0x4853f6[_0x1b5e('0xc9')]['Contacts'][_0x1b5e('0x68')]){return _0x4853f6[_0x1b5e('0xc9')][_0x1b5e('0x9f')][0x0];}return db[_0x1b5e('0x9e')][_0x1b5e('0x59')](_['defaults'](_0x5a9198[_0x1b5e('0x61')],{'firstName':_0xe89575,'mobile':_0xe89575,'phone':_0xe89575,'ListId':_0x4853f6['ListId']}));}})[_0x1b5e('0x38')](handleEntityNotFound(_0x460f1f,null))['then'](function(_0x2c449a){if(_0x2c449a){_0x334af9=_0x2c449a;return db[_0x1b5e('0xa3')][_0x1b5e('0x62')]({'where':{'ContactId':_0x334af9['id'],'closed':![],'SmsAccountId':_0x4853f6['id']}})['then'](function(_0x10a239){if(_0x10a239){return[_0x10a239,![]];}return db[_0x1b5e('0xa3')][_0x1b5e('0x59')]({'UserId':_0x5a9198['user']['id'],'ContactId':_0x334af9['id'],'SmsAccountId':_0x4853f6['id'],'phone':_0xe89575,'firstMsgDirection':'out','Messages':[_['merge'](_0x5a9198['body'],{'read':![],'body':_0x5a9198['body']['body'],'phone':_0xe89575,'SmsAccountId':_0x4853f6['id'],'UserId':_0x5a9198[_0x1b5e('0xca')]['id'],'ContactId':_0x334af9['id']})]},{'include':[{'model':db[_0x1b5e('0xcb')],'as':_0x1b5e('0xcc')}]})[_0x1b5e('0x38')](function(_0x1cc955){return[_0x1cc955,!![]];});});}})[_0x1b5e('0xa4')](function(_0x37bfe2,_0x205a4a){if(_0x205a4a){return _0x37bfe2;}return db['SmsMessage'][_0x1b5e('0x59')](_[_0x1b5e('0x50')](_0x5a9198[_0x1b5e('0x61')],{'read':![],'body':_0x5a9198[_0x1b5e('0x61')][_0x1b5e('0x61')],'phone':_0xe89575,'SmsAccountId':_0x4853f6['id'],'SmsInteractionId':_0x37bfe2['id'],'UserId':_0x5a9198[_0x1b5e('0xca')]['id'],'ContactId':_0x334af9['id']}))[_0x1b5e('0x38')](function(_0x31f519){_0x37bfe2['dataValues'][_0x1b5e('0xcc')]=[];_0x37bfe2['dataValues'][_0x1b5e('0xcc')]['push'](_0x31f519[_0x1b5e('0xcd')]);return _0x37bfe2;});})[_0x1b5e('0x38')](respondWithResult(_0x460f1f,null))['catch'](handleError(_0x460f1f,null));};exports['status']=function(_0x1d262f,_0x4f7c71,_0x302145){if(_0x1d262f[_0x1b5e('0x61')]['id']){delete _0x1d262f[_0x1b5e('0x61')]['id'];}var _0x1f52e4,_0x4a9036,_0x496ad7;return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x1d262f[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x4f7c71,null))[_0x1b5e('0x38')](function(_0x1f8197){if(_0x1f8197){_0x496ad7=_0x1f8197;logger[_0x1b5e('0x25')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0xce'),_0x1f8197[_0x1b5e('0x42')],util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));switch(_0x1f8197[_0x1b5e('0x42')]){case _0x1b5e('0x83'):if(_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd0')]&&_0x1d262f[_0x1b5e('0x61')]['status']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x2b')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x1d262f['body']['requestid']&&_0x1d262f[_0x1b5e('0x61')]['statusInt']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd1')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['requestid']}});}break;case _0x1b5e('0x86'):if(_0x1d262f[_0x1b5e('0x61')]['message_id']&&_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd2')]){_0x4a9036=_0x1d262f['body'][_0x1b5e('0xd2')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd3')]}});}break;case _0x1b5e('0x8c'):var _0x58cecb=_0x1d262f['body'][_0x1b5e('0x8d')][0x0];if(_0x58cecb[_0x1b5e('0x87')]&&_0x58cecb['status'][_0x1b5e('0xd4')]===_0x1b5e('0xd5')){_0x4a9036=_0x58cecb['status'][_0x1b5e('0xd4')];return db['SmsMessage']['find']({'where':{'messageId':_0x58cecb[_0x1b5e('0x87')]}});}break;case _0x1b5e('0x91'):if(_0x1d262f['body'][_0x1b5e('0x87')]&&_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x2b')]){_0x4a9036=_0x1d262f['body'][_0x1b5e('0x2b')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')]['messageId']}});}break;case'bandwidth':if(_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')]['id']){_0x4a9036=_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x42')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][0x0][_0x1b5e('0x28')]['id']}});}break;case _0x1b5e('0xd6'):if(_0x1d262f[_0x1b5e('0x61')]['redif']&&_0x1d262f['body'][_0x1b5e('0x2b')]){_0x4a9036=_0x1d262f[_0x1b5e('0x61')]['status'];return db[_0x1b5e('0xcb')]['find']({'where':{'messageId':_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x4f7c71,null))[_0x1b5e('0x38')](function(_0x98d54a){if(_0x98d54a){_0x1f52e4=_0x98d54a;switch(_0x496ad7[_0x1b5e('0x42')]){case _0x1b5e('0x83'):if(_0x4a9036===_0x1b5e('0xd5')){return _0x1f52e4['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x83'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4a9036==='1'){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util['inspect'](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0xd8')]&&_0x4a9036>=0xc8&&_0x4a9036<=0xce){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x86'),util[_0x1b5e('0xcf')](_0x1d262f['body'],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x8c'):var _0x409ef1=_0x1d262f[_0x1b5e('0x61')][_0x1b5e('0x8d')][0x0];if(_0x409ef1[_0x1b5e('0x2b')][_0x1b5e('0xd4')]===_0x1b5e('0xd5')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b5e('0x2b'),'infobip',util['inspect'](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x91'):if(_0x4a9036==_0x1b5e('0xd9')||_0x4a9036==_0x1b5e('0xda')){return _0x1f52e4['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x91'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0x94'):if(_0x4a9036==_0x1b5e('0xdb')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger[_0x1b5e('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1b5e('0x2b'),_0x1b5e('0x94'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1b5e('0xd6'):if(_0x4a9036==='DELIVRD'||_0x4a9036===_0x1b5e('0xdc')){return _0x1f52e4[_0x1b5e('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1b5e('0xd6'),util[_0x1b5e('0xcf')](_0x1d262f[_0x1b5e('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x1f52e4;}})[_0x1b5e('0x38')](respondWithResult(_0x4f7c71,null))[_0x1b5e('0x29')](handleError(_0x4f7c71,null));};exports['statusGet']=function(_0x4c7237,_0x115ccf,_0x3ed2b7){var _0x437cc3,_0x282ff7,_0x2d6e17;return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x4c7237['params']['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x115ccf,null))[_0x1b5e('0x38')](function(_0x2ac390){if(_0x2ac390){_0x2d6e17=_0x2ac390;logger[_0x1b5e('0x25')](_0x1b5e('0x26'),'status','received\x20delivery\x20report\x20from',_0x2ac390[_0x1b5e('0x42')],util['inspect'](_0x4c7237[_0x1b5e('0x45')],{'showHidden':![],'depth':null}));switch(_0x2ac390[_0x1b5e('0x42')]){case _0x1b5e('0x8e'):if(_0x4c7237['query'][_0x1b5e('0xdd')]&&_0x4c7237['query'][_0x1b5e('0xde')]){_0x282ff7=_0x4c7237[_0x1b5e('0x45')][_0x1b5e('0xde')];return db[_0x1b5e('0xcb')][_0x1b5e('0x62')]({'where':{'messageId':_0x4c7237[_0x1b5e('0x45')][_0x1b5e('0xdd')]}});}break;}}})[_0x1b5e('0x38')](handleEntityNotFound(_0x115ccf,null))[_0x1b5e('0x38')](function(_0x116a72){if(_0x116a72){_0x437cc3=_0x116a72;switch(_0x2d6e17[_0x1b5e('0x42')]){case _0x1b5e('0x8e'):if(_0x282ff7==='2'||_0x282ff7==='6'){return _0x437cc3['update']({'read':!![]});}else{logger[_0x1b5e('0x27')](_0x1b5e('0x26'),_0x1b5e('0x2b'),_0x1b5e('0x8e'),util[_0x1b5e('0xcf')](_0x4c7237[_0x1b5e('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x437cc3;}})[_0x1b5e('0x38')](respondWithResult(_0x115ccf,null))[_0x1b5e('0x29')](handleError(_0x115ccf,null));};exports['addAgents']=function(_0x5ecadf,_0xb395c,_0x35de28){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x5ecadf[_0x1b5e('0x57')]['id']}})['then'](handleEntityNotFound(_0xb395c,null))['then'](function(_0x1010e0){if(_0x1010e0){return _0x1010e0[_0x1b5e('0xdf')](_0x5ecadf[_0x1b5e('0x61')]['ids'],_[_0x1b5e('0xe0')](_0x5ecadf[_0x1b5e('0x61')],[_0x1b5e('0x6c'),'id'])||{})[_0x1b5e('0xa4')](function(_0x279bbe){for(var _0x2d4479=0x0;_0x2d4479<_0x5ecadf[_0x1b5e('0x61')]['ids'][_0x1b5e('0x68')];_0x2d4479+=0x1){socket['emit'](_0x1b5e('0xe1'),{'UserId':Number(_0x5ecadf[_0x1b5e('0x61')][_0x1b5e('0x6c')][_0x2d4479]),'SmsAccountId':Number(_0x5ecadf[_0x1b5e('0x57')]['id'])});}return _0x279bbe;});}})[_0x1b5e('0x38')](respondWithResult(_0xb395c,null))[_0x1b5e('0x29')](handleError(_0xb395c,null));};exports[_0x1b5e('0xe2')]=function(_0x36878a,_0x197187,_0x473ae3){return db[_0x1b5e('0x3f')][_0x1b5e('0x62')]({'where':{'id':_0x36878a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x197187,null))[_0x1b5e('0x38')](function(_0x24f8ac){if(_0x24f8ac){return _0x24f8ac[_0x1b5e('0xe2')](_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')])[_0x1b5e('0x38')](function(){if(_[_0x1b5e('0xe3')](_0x36878a['query'][_0x1b5e('0x6c')])){for(var _0x4852bd=0x0;_0x4852bd<_0x36878a[_0x1b5e('0x45')]['ids'][_0x1b5e('0x68')];_0x4852bd+=0x1){socket[_0x1b5e('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')][_0x4852bd]),'SmsAccountId':Number(_0x36878a[_0x1b5e('0x57')]['id'])});}}else{socket[_0x1b5e('0xe4')](_0x1b5e('0xe5'),{'UserId':Number(_0x36878a[_0x1b5e('0x45')][_0x1b5e('0x6c')]),'SmsAccountId':Number(_0x36878a[_0x1b5e('0x57')]['id'])});}});}})[_0x1b5e('0x38')](respondWithStatusCode(_0x197187,null))[_0x1b5e('0x29')](handleError(_0x197187,null));};exports[_0x1b5e('0xe6')]=function(_0x48709a,_0x34d54a,_0x41d890){var _0xa84da9={};var _0x1d4c6b={};var _0x52bd46;var _0x331805;return db[_0x1b5e('0x3f')][_0x1b5e('0x66')]({'where':{'id':_0x48709a[_0x1b5e('0x57')]['id']}})[_0x1b5e('0x38')](handleEntityNotFound(_0x34d54a,null))[_0x1b5e('0x38')](function(_0xc6d1c9){if(_0xc6d1c9){_0x52bd46=_0xc6d1c9;_0x1d4c6b['model']=_[_0x1b5e('0x44')](db[_0x1b5e('0xac')][_0x1b5e('0x40')]);_0x1d4c6b[_0x1b5e('0x45')]=_[_0x1b5e('0x44')](_0x48709a[_0x1b5e('0x45')]);_0x1d4c6b[_0x1b5e('0x46')]=_['intersection'](_0x1d4c6b[_0x1b5e('0x43')],_0x1d4c6b[_0x1b5e('0x45')]);_0xa84da9[_0x1b5e('0x47')]=_[_0x1b5e('0x48')](_0x1d4c6b[_0x1b5e('0x43')],qs[_0x1b5e('0x49')](_0x48709a['query'][_0x1b5e('0x49')]));_0xa84da9[_0x1b5e('0x47')]=_0xa84da9['attributes']['length']?_0xa84da9[_0x1b5e('0x47')]:_0x1d4c6b[_0x1b5e('0x43')];_0xa84da9[_0x1b5e('0x4b')]=qs[_0x1b5e('0x4c')](_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4c')]);_0xa84da9[_0x1b5e('0x4d')]=qs['filters'](_[_0x1b5e('0x6a')](_0x48709a[_0x1b5e('0x45')],_0x1d4c6b[_0x1b5e('0x46')]));if(_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4e')]){_0xa84da9['where']=_[_0x1b5e('0x50')](_0xa84da9['where'],{'$or':_[_0x1b5e('0x3e')](_0xa84da9[_0x1b5e('0x47')],function(_0x2ff7f9){var _0x3949f9={};_0x3949f9[_0x2ff7f9]={'$like':'%'+_0x48709a[_0x1b5e('0x45')][_0x1b5e('0x4e')]+'%'};return _0x3949f9;})});}_0xa84da9=_[_0x1b5e('0x50')]({},_0xa84da9,_0x48709a['options']);return _0x52bd46[_0x1b5e('0xe6')](_0xa84da9);}})[_0x1b5e('0x38')](function(_0x53a10f){if(_0x53a10f){_0x331805=_0x53a10f[_0x1b5e('0x68')];if(!_0x48709a['query'][_0x1b5e('0x4a')](_0x1b5e('0x69'))){_0xa84da9['limit']=qs[_0x1b5e('0x2f')](_0x48709a[_0x1b5e('0x45')]['limit']);_0xa84da9[_0x1b5e('0x2d')]=qs[_0x1b5e('0x2d')](_0x48709a[_0x1b5e('0x45')]['offset']);}return _0x52bd46['getAgents'](_0xa84da9);}})[_0x1b5e('0x38')](function(_0x8be25e){if(_0x8be25e){return _0x8be25e?{'count':_0x331805,'rows':_0x8be25e}:null;}})[_0x1b5e('0x38')](respondWithResult(_0x34d54a,null))[_0x1b5e('0x29')](handleError(_0x34d54a,null));}; \ No newline at end of file +var _0x5c1f=['account','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','skebby','text','clicksend','message_id','plivo','MessageUUID','infobip','results','messageId','csc','originatingAddress','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','list','omit','Contacts','contact','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','SmsInteraction','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','connectel','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','register','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsAccount','includeAll','findAll','rows','show','params','keys','include','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','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','order','CannedAnswer','notify','sms','SmsApplication','applications','orderBy','Applications','priority','asc'];(function(_0x1be5cd,_0x2fce99){var _0x571f1b=function(_0x826f45){while(--_0x826f45){_0x1be5cd['push'](_0x1be5cd['shift']());}};_0x571f1b(++_0x2fce99);}(_0x5c1f,0x152));var _0xf5c1=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x5c1f[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5c1('0x0'));var zipdir=require(_0xf5c1('0x1'));var jsonpatch=require(_0xf5c1('0x2'));var rp=require(_0xf5c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf5c1('0x4'));var util=require(_0xf5c1('0x5'));var path=require('path');var sox=require(_0xf5c1('0x6'));var csv=require(_0xf5c1('0x7'));var ejs=require(_0xf5c1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5c1('0x9'));var squel=require(_0xf5c1('0xa'));var crypto=require(_0xf5c1('0xb'));var jsforce=require(_0xf5c1('0xc'));var deskjs=require(_0xf5c1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf5c1('0xe'));var authService=require(_0xf5c1('0xf'));var qs=require(_0xf5c1('0x10'));var as=require(_0xf5c1('0x11'));var hardwareService=require(_0xf5c1('0x12'));var logger=require('../../config/logger')(_0xf5c1('0x13'));var utils=require(_0xf5c1('0x14'));var config=require(_0xf5c1('0x15'));var licenseUtil=require(_0xf5c1('0x16'));var db=require('../../mysqldb')['db'];config[_0xf5c1('0x17')]=_[_0xf5c1('0x18')](config[_0xf5c1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xf5c1('0x19'))(new Redis(config[_0xf5c1('0x17')]));require(_0xf5c1('0x1a'))[_0xf5c1('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf5c1('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x36f86f,_0x20c395,_0x3062c2,_0x6ea495){return new BPromise(function(_0x30fc0a,_0x17c708){var _0x459e6f=_0x6ea495||client;return _0x459e6f[_0xf5c1('0x1d')](_0x36f86f,_0x3062c2)[_0xf5c1('0x1e')](function(_0x510e05){logger[_0xf5c1('0x1f')](_0xf5c1('0x20'),_0x20c395,_0xf5c1('0x21'));logger[_0xf5c1('0x22')](_0xf5c1('0x23'),_0x20c395,_0xf5c1('0x21'),JSON[_0xf5c1('0x24')](_0x510e05));if(_0x510e05[_0xf5c1('0x25')]){if(_0x510e05[_0xf5c1('0x25')]['code']===0x1f4){logger[_0xf5c1('0x25')](_0xf5c1('0x20'),_0x20c395,_0x510e05['error'][_0xf5c1('0x26')]);return _0x17c708(_0x510e05[_0xf5c1('0x25')]['message']);}logger[_0xf5c1('0x25')]('SmsAccount,\x20%s,\x20%s',_0x20c395,_0x510e05[_0xf5c1('0x25')][_0xf5c1('0x26')]);return _0x30fc0a(_0x510e05[_0xf5c1('0x25')]['message']);}else{logger[_0xf5c1('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x20c395,_0xf5c1('0x21'));_0x30fc0a(_0x510e05[_0xf5c1('0x27')]['message']);}})[_0xf5c1('0x28')](function(_0x48e216){logger['error']('SmsAccount,\x20%s,\x20%s',_0x20c395,_0x48e216);_0x17c708(_0x48e216);});});}function respondWithStatusCode(_0x410203,_0x53796f){_0x53796f=_0x53796f||0xcc;return function(_0x48f3fa){if(_0x48f3fa){return _0x410203[_0xf5c1('0x29')](_0x53796f);}return _0x410203[_0xf5c1('0x2a')](_0x53796f)['end']();};}function respondWithResult(_0x407f7b,_0x4a8121){_0x4a8121=_0x4a8121||0xc8;return function(_0x2784a8){if(_0x2784a8){return _0x407f7b[_0xf5c1('0x2a')](_0x4a8121)[_0xf5c1('0x2b')](_0x2784a8);}};}function respondWithFilteredResult(_0x41c53a,_0x57eb3f){return function(_0xedcc62){if(_0xedcc62){var _0x53383a=typeof _0x57eb3f['offset']==='undefined'&&typeof _0x57eb3f['limit']===_0xf5c1('0x2c');var _0x22d709=_0xedcc62['count'];var _0x39a098=_0x53383a?0x0:_0x57eb3f[_0xf5c1('0x2d')];var _0x34a3f3=_0x53383a?_0xedcc62[_0xf5c1('0x2e')]:_0x57eb3f[_0xf5c1('0x2d')]+_0x57eb3f[_0xf5c1('0x2f')];var _0x40fa80;if(_0x34a3f3>=_0x22d709){_0x34a3f3=_0x22d709;_0x40fa80=0xc8;}else{_0x40fa80=0xce;}_0x41c53a[_0xf5c1('0x2a')](_0x40fa80);return _0x41c53a[_0xf5c1('0x30')](_0xf5c1('0x31'),_0x39a098+'-'+_0x34a3f3+'/'+_0x22d709)[_0xf5c1('0x2b')](_0xedcc62);}return null;};}function patchUpdates(_0x1ed471){return function(_0x481f63){try{jsonpatch[_0xf5c1('0x32')](_0x481f63,_0x1ed471,!![]);}catch(_0x3fa466){return BPromise[_0xf5c1('0x33')](_0x3fa466);}return _0x481f63[_0xf5c1('0x34')]();};}function saveUpdates(_0x25ea4a,_0x5bac98){return function(_0x3d54f9){if(_0x3d54f9){return _0x3d54f9[_0xf5c1('0x35')](_0x25ea4a)[_0xf5c1('0x1e')](function(_0x25e21c){return _0x25e21c;});}return null;};}function removeEntity(_0x35acaf,_0x5b872c){return function(_0x1c6a7d){if(_0x1c6a7d){return _0x1c6a7d[_0xf5c1('0x36')]()[_0xf5c1('0x1e')](function(){var _0x32ae78=_0x1c6a7d[_0xf5c1('0x37')]({'plain':!![]});var _0x4df129=_0xf5c1('0x38');return db[_0xf5c1('0x39')]['destroy']({'where':{'type':_0x4df129,'resourceId':_0x32ae78['id']}})[_0xf5c1('0x1e')](function(){return _0x1c6a7d;});})[_0xf5c1('0x1e')](function(){_0x35acaf[_0xf5c1('0x2a')](0xcc)[_0xf5c1('0x3a')]();});}};}function handleEntityNotFound(_0x5f19a5,_0x4f2977){return function(_0xd8e386){if(!_0xd8e386){_0x5f19a5[_0xf5c1('0x29')](0x194);}return _0xd8e386;};}function handleError(_0x131af8,_0x33f831){_0x33f831=_0x33f831||0x1f4;return function(_0x5026b2){logger[_0xf5c1('0x25')](_0x5026b2['stack']);if(_0x5026b2[_0xf5c1('0x3b')]){delete _0x5026b2[_0xf5c1('0x3b')];}_0x131af8[_0xf5c1('0x2a')](_0x33f831)[_0xf5c1('0x3c')](_0x5026b2);};}exports[_0xf5c1('0x3d')]=function(_0x2696dc,_0xfa675a){var _0x567144={'include':[{'model':db['Pause'],'as':_0xf5c1('0x3e')}]},_0x2ebfcd={},_0x30c80e={'count':0x0,'rows':[]};var _0xe9ee2c=_['map'](db['SmsAccount'][_0xf5c1('0x3f')],function(_0x5d71a6){return{'name':_0x5d71a6[_0xf5c1('0x40')],'type':_0x5d71a6[_0xf5c1('0x41')]['key']};});_0x2ebfcd[_0xf5c1('0x42')]=_[_0xf5c1('0x43')](_0xe9ee2c,_0xf5c1('0x3b'));_0x2ebfcd[_0xf5c1('0x44')]=_['keys'](_0x2696dc['query']);_0x2ebfcd[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0x2ebfcd[_0xf5c1('0x42')],_0x2ebfcd['query']);_0x567144[_0xf5c1('0x47')]=_['intersection'](_0x2ebfcd['model'],qs['fields'](_0x2696dc['query'][_0xf5c1('0x48')]));_0x567144['attributes']=_0x567144[_0xf5c1('0x47')][_0xf5c1('0x49')]?_0x567144[_0xf5c1('0x47')]:_0x2ebfcd[_0xf5c1('0x42')];if(!_0x2696dc[_0xf5c1('0x44')][_0xf5c1('0x4a')](_0xf5c1('0x4b'))){_0x567144[_0xf5c1('0x2f')]=qs[_0xf5c1('0x2f')](_0x2696dc[_0xf5c1('0x44')][_0xf5c1('0x2f')]);_0x567144[_0xf5c1('0x2d')]=qs['offset'](_0x2696dc['query'][_0xf5c1('0x2d')]);}_0x567144['order']=qs[_0xf5c1('0x4c')](_0x2696dc[_0xf5c1('0x44')][_0xf5c1('0x4c')]);_0x567144[_0xf5c1('0x4d')]=qs['filters'](_[_0xf5c1('0x4e')](_0x2696dc[_0xf5c1('0x44')],_0x2ebfcd[_0xf5c1('0x45')]),_0xe9ee2c);if(_0x2696dc[_0xf5c1('0x44')][_0xf5c1('0x4f')]){_0x567144[_0xf5c1('0x4d')]=_[_0xf5c1('0x50')](_0x567144[_0xf5c1('0x4d')],{'$or':_['map'](_0xe9ee2c,function(_0x38dd86){if(_0x38dd86['type']!==_0xf5c1('0x51')){var _0x106e7c={};_0x106e7c[_0x38dd86[_0xf5c1('0x3b')]]={'$like':'%'+_0x2696dc['query']['filter']+'%'};return _0x106e7c;}})});}_0x567144=_[_0xf5c1('0x50')]({},_0x567144,_0x2696dc[_0xf5c1('0x52')]);var _0x3aeea6={'where':_0x567144['where']};return db[_0xf5c1('0x53')]['count'](_0x3aeea6)[_0xf5c1('0x1e')](function(_0x19b2c6){_0x30c80e[_0xf5c1('0x2e')]=_0x19b2c6;if(_0x2696dc['query'][_0xf5c1('0x54')]){_0x567144['include']=[{'all':!![]}];}return db[_0xf5c1('0x53')][_0xf5c1('0x55')](_0x567144);})[_0xf5c1('0x1e')](function(_0x433da3){_0x30c80e[_0xf5c1('0x56')]=_0x433da3;return _0x30c80e;})[_0xf5c1('0x1e')](respondWithFilteredResult(_0xfa675a,_0x567144))[_0xf5c1('0x28')](handleError(_0xfa675a,null));};exports[_0xf5c1('0x57')]=function(_0x20e48a,_0xebd1c4){var _0xa1080a={'raw':![],'where':{'id':_0x20e48a[_0xf5c1('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf5c1('0x3e')}]},_0xf4eb88={};_0xf4eb88['model']=_[_0xf5c1('0x59')](db[_0xf5c1('0x53')][_0xf5c1('0x3f')]);_0xf4eb88['query']=_['keys'](_0x20e48a[_0xf5c1('0x44')]);_0xf4eb88[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0xf4eb88[_0xf5c1('0x42')],_0xf4eb88[_0xf5c1('0x44')]);_0xa1080a[_0xf5c1('0x47')]=_['intersection'](_0xf4eb88[_0xf5c1('0x42')],qs[_0xf5c1('0x48')](_0x20e48a[_0xf5c1('0x44')]['fields']));_0xa1080a[_0xf5c1('0x47')]=_0xa1080a[_0xf5c1('0x47')][_0xf5c1('0x49')]?_0xa1080a[_0xf5c1('0x47')]:_0xf4eb88[_0xf5c1('0x42')];if(_0x20e48a[_0xf5c1('0x44')][_0xf5c1('0x54')]){_0xa1080a[_0xf5c1('0x5a')]=[{'all':!![]}];}_0xa1080a=_['merge']({},_0xa1080a,_0x20e48a[_0xf5c1('0x52')]);return db[_0xf5c1('0x53')][_0xf5c1('0x5b')](_0xa1080a)[_0xf5c1('0x1e')](handleEntityNotFound(_0xebd1c4,null))[_0xf5c1('0x1e')](respondWithResult(_0xebd1c4,null))[_0xf5c1('0x28')](handleError(_0xebd1c4,null));};exports[_0xf5c1('0x5c')]=function(_0xebbf1f,_0x59f417){return db[_0xf5c1('0x53')][_0xf5c1('0x5c')](_0xebbf1f[_0xf5c1('0x5d')],{})[_0xf5c1('0x1e')](function(_0x311b4c){var _0x3430cd=_0xebbf1f[_0xf5c1('0x5e')][_0xf5c1('0x37')]({'plain':!![]});if(!_0x3430cd)throw new Error(_0xf5c1('0x5f'));if(_0x3430cd['role']===_0xf5c1('0x5e')){var _0x36e16c=_0x311b4c[_0xf5c1('0x37')]({'plain':!![]});var _0x429f1b='SmsAccounts';return db[_0xf5c1('0x60')][_0xf5c1('0x5b')]({'where':{'name':_0x429f1b,'userProfileId':_0x3430cd[_0xf5c1('0x61')]},'raw':!![]})[_0xf5c1('0x1e')](function(_0xfe7e87){if(_0xfe7e87&&_0xfe7e87[_0xf5c1('0x62')]===0x0){return db[_0xf5c1('0x39')]['create']({'name':_0x36e16c['name'],'resourceId':_0x36e16c['id'],'type':_0xfe7e87[_0xf5c1('0x3b')],'sectionId':_0xfe7e87['id']},{})[_0xf5c1('0x1e')](function(){return _0x311b4c;});}else{return _0x311b4c;}})[_0xf5c1('0x28')](function(_0x175d9c){logger[_0xf5c1('0x25')](_0xf5c1('0x63'),_0x175d9c);throw _0x175d9c;});}return _0x311b4c;})['then'](respondWithResult(_0x59f417,0xc9))[_0xf5c1('0x28')](handleError(_0x59f417,null));};exports['update']=function(_0x1f674b,_0x264e88){if(_0x1f674b[_0xf5c1('0x5d')]['id']){delete _0x1f674b[_0xf5c1('0x5d')]['id'];}return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x1f674b[_0xf5c1('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xf5c1('0x3e')}]})[_0xf5c1('0x1e')](handleEntityNotFound(_0x264e88,null))[_0xf5c1('0x1e')](saveUpdates(_0x1f674b[_0xf5c1('0x5d')],null))[_0xf5c1('0x1e')](respondWithResult(_0x264e88,null))['catch'](handleError(_0x264e88,null));};exports[_0xf5c1('0x36')]=function(_0x399c9b,_0x37cb47){return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x399c9b[_0xf5c1('0x58')]['id']}})['then'](handleEntityNotFound(_0x37cb47,null))[_0xf5c1('0x1e')](removeEntity(_0x37cb47,null))[_0xf5c1('0x28')](handleError(_0x37cb47,null));};exports[_0xf5c1('0x64')]=function(_0x1fddd5,_0xd1b1d1){return db['SmsAccount']['describe']()[_0xf5c1('0x1e')](respondWithResult(_0xd1b1d1,null))[_0xf5c1('0x28')](handleError(_0xd1b1d1,null));};exports[_0xf5c1('0x65')]=function(_0x4c90f2,_0x5ed8e7,_0x4b9865){if(_0x4c90f2[_0xf5c1('0x5d')]['id']){delete _0x4c90f2['body']['id'];}return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x4c90f2[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x5ed8e7,null))[_0xf5c1('0x1e')](function(_0x2f3e70){if(_0x2f3e70){_0x4c90f2[_0xf5c1('0x5d')][_0xf5c1('0x66')]=_0x2f3e70['id'];return db['Disposition'][_0xf5c1('0x5c')](_0x4c90f2[_0xf5c1('0x5d')]);}})[_0xf5c1('0x1e')](respondWithResult(_0x5ed8e7,null))[_0xf5c1('0x28')](handleError(_0x5ed8e7,null));};exports[_0xf5c1('0x67')]=function(_0x426c70,_0x185339,_0x168425){var _0x475889={'raw':![],'where':{}};var _0x372658={};var _0x13e0c3={'count':0x0,'rows':[]};return db[_0xf5c1('0x53')][_0xf5c1('0x68')]({'where':{'id':_0x426c70['params']['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x185339,null))[_0xf5c1('0x1e')](function(_0x563816){if(_0x563816){_0x372658[_0xf5c1('0x42')]=_[_0xf5c1('0x59')](db[_0xf5c1('0x69')]['rawAttributes']);_0x372658[_0xf5c1('0x44')]=_[_0xf5c1('0x59')](_0x426c70[_0xf5c1('0x44')]);_0x372658[_0xf5c1('0x45')]=_['intersection'](_0x372658[_0xf5c1('0x42')],_0x372658[_0xf5c1('0x44')]);_0x475889[_0xf5c1('0x47')]=_[_0xf5c1('0x46')](_0x372658[_0xf5c1('0x42')],qs[_0xf5c1('0x48')](_0x426c70['query'][_0xf5c1('0x48')]));_0x475889[_0xf5c1('0x47')]=_0x475889[_0xf5c1('0x47')]['length']?_0x475889['attributes']:_0x372658['model'];if(!_0x426c70['query'][_0xf5c1('0x4a')](_0xf5c1('0x4b'))){_0x475889[_0xf5c1('0x2f')]=qs[_0xf5c1('0x2f')](_0x426c70['query'][_0xf5c1('0x2f')]);_0x475889[_0xf5c1('0x2d')]=qs[_0xf5c1('0x2d')](_0x426c70['query'][_0xf5c1('0x2d')]);}_0x475889['order']=qs[_0xf5c1('0x4c')](_0x426c70['query'][_0xf5c1('0x4c')]);_0x475889[_0xf5c1('0x4d')]=qs[_0xf5c1('0x45')](_[_0xf5c1('0x4e')](_0x426c70[_0xf5c1('0x44')],_0x372658[_0xf5c1('0x45')]));_0x475889['where']['SmsAccountId']=_0x563816['id'];if(_0x426c70[_0xf5c1('0x44')][_0xf5c1('0x4f')]){_0x475889[_0xf5c1('0x4d')]=_[_0xf5c1('0x50')](_0x475889['where'],{'$or':_[_0xf5c1('0x43')](_0x475889[_0xf5c1('0x47')],function(_0x6ae457){var _0x1b8c07={};_0x1b8c07[_0x6ae457]={'$like':'%'+_0x426c70[_0xf5c1('0x44')][_0xf5c1('0x4f')]+'%'};return _0x1b8c07;})});}_0x475889=_[_0xf5c1('0x50')]({},_0x475889,_0x426c70[_0xf5c1('0x52')]);return db[_0xf5c1('0x69')][_0xf5c1('0x2e')]({'where':_0x475889[_0xf5c1('0x4d')]})['then'](function(_0x5717d1){_0x13e0c3[_0xf5c1('0x2e')]=_0x5717d1;if(_0x426c70[_0xf5c1('0x44')]['includeAll']){_0x475889['include']=[{'all':!![]}];}return db[_0xf5c1('0x69')]['findAll'](_0x475889);})[_0xf5c1('0x1e')](function(_0x582920){_0x13e0c3['rows']=_0x582920;return _0x13e0c3;});}})[_0xf5c1('0x1e')](respondWithFilteredResult(_0x185339,_0x475889))[_0xf5c1('0x28')](handleError(_0x185339,null));};exports[_0xf5c1('0x6a')]=function(_0x5e1217,_0x375dfa,_0x308e19){return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x5e1217[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x375dfa,null))[_0xf5c1('0x1e')](function(_0x33781f){if(_0x33781f){return _0x33781f[_0xf5c1('0x6a')](_0x5e1217[_0xf5c1('0x44')][_0xf5c1('0x6b')]);}})[_0xf5c1('0x1e')](respondWithStatusCode(_0x375dfa,null))[_0xf5c1('0x28')](handleError(_0x375dfa,null));};exports[_0xf5c1('0x6c')]=function(_0x35a1fc,_0x5e9e75,_0x50d57e){if(_0x35a1fc[_0xf5c1('0x5d')]['id']){delete _0x35a1fc['body']['id'];}return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x35a1fc[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x5e9e75,null))['then'](function(_0x4298fd){if(_0x4298fd){_0x35a1fc['body'][_0xf5c1('0x66')]=_0x4298fd['id'];return db['CannedAnswer'][_0xf5c1('0x5c')](_0x35a1fc[_0xf5c1('0x5d')]);}})[_0xf5c1('0x1e')](respondWithResult(_0x5e9e75,null))[_0xf5c1('0x28')](handleError(_0x5e9e75,null));};exports[_0xf5c1('0x6d')]=function(_0x14ef06,_0x45e176,_0x496c99){var _0x18adcf={'raw':![],'where':{}};var _0x32f7a9={};var _0x17be71={'count':0x0,'rows':[]};return db[_0xf5c1('0x53')][_0xf5c1('0x68')]({'where':{'id':_0x14ef06[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x45e176,null))[_0xf5c1('0x1e')](function(_0x23645b){if(_0x23645b){_0x32f7a9[_0xf5c1('0x42')]=_[_0xf5c1('0x59')](db['CannedAnswer'][_0xf5c1('0x3f')]);_0x32f7a9[_0xf5c1('0x44')]=_[_0xf5c1('0x59')](_0x14ef06[_0xf5c1('0x44')]);_0x32f7a9[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0x32f7a9[_0xf5c1('0x42')],_0x32f7a9[_0xf5c1('0x44')]);_0x18adcf[_0xf5c1('0x47')]=_[_0xf5c1('0x46')](_0x32f7a9[_0xf5c1('0x42')],qs[_0xf5c1('0x48')](_0x14ef06[_0xf5c1('0x44')][_0xf5c1('0x48')]));_0x18adcf[_0xf5c1('0x47')]=_0x18adcf['attributes']['length']?_0x18adcf[_0xf5c1('0x47')]:_0x32f7a9['model'];if(!_0x14ef06[_0xf5c1('0x44')][_0xf5c1('0x4a')]('nolimit')){_0x18adcf[_0xf5c1('0x2f')]=qs['limit'](_0x14ef06['query']['limit']);_0x18adcf[_0xf5c1('0x2d')]=qs[_0xf5c1('0x2d')](_0x14ef06[_0xf5c1('0x44')]['offset']);}_0x18adcf[_0xf5c1('0x6e')]=qs[_0xf5c1('0x4c')](_0x14ef06[_0xf5c1('0x44')][_0xf5c1('0x4c')]);_0x18adcf[_0xf5c1('0x4d')]=qs[_0xf5c1('0x45')](_[_0xf5c1('0x4e')](_0x14ef06[_0xf5c1('0x44')],_0x32f7a9['filters']));_0x18adcf[_0xf5c1('0x4d')]['SmsAccountId']=_0x23645b['id'];if(_0x14ef06[_0xf5c1('0x44')][_0xf5c1('0x4f')]){_0x18adcf[_0xf5c1('0x4d')]=_['merge'](_0x18adcf[_0xf5c1('0x4d')],{'$or':_[_0xf5c1('0x43')](_0x18adcf[_0xf5c1('0x47')],function(_0x392b13){var _0x310c2c={};_0x310c2c[_0x392b13]={'$like':'%'+_0x14ef06['query'][_0xf5c1('0x4f')]+'%'};return _0x310c2c;})});}_0x18adcf=_[_0xf5c1('0x50')]({},_0x18adcf,_0x14ef06[_0xf5c1('0x52')]);return db[_0xf5c1('0x6f')]['count']({'where':_0x18adcf['where']})['then'](function(_0x26b0e5){_0x17be71[_0xf5c1('0x2e')]=_0x26b0e5;if(_0x14ef06[_0xf5c1('0x44')][_0xf5c1('0x54')]){_0x18adcf['include']=[{'all':!![]}];}return db[_0xf5c1('0x6f')]['findAll'](_0x18adcf);})[_0xf5c1('0x1e')](function(_0xdd41aa){_0x17be71[_0xf5c1('0x56')]=_0xdd41aa;return _0x17be71;});}})[_0xf5c1('0x1e')](respondWithFilteredResult(_0x45e176,_0x18adcf))[_0xf5c1('0x28')](handleError(_0x45e176,null));};exports['removeAnswers']=function(_0x577a8b,_0x4049cf,_0x15edfd){return db[_0xf5c1('0x53')][_0xf5c1('0x5b')]({'where':{'id':_0x577a8b['params']['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x4049cf,null))[_0xf5c1('0x1e')](function(_0x369fca){if(_0x369fca){return _0x369fca['removeAnswers'](_0x577a8b[_0xf5c1('0x44')][_0xf5c1('0x6b')]);}})[_0xf5c1('0x1e')](respondWithStatusCode(_0x4049cf,null))[_0xf5c1('0x28')](handleError(_0x4049cf,null));};exports[_0xf5c1('0x70')]=function(_0x2511f4,_0x34249a,_0x8fe53){var _0x3ac5c0={'channel':_0xf5c1('0x71')};var _0x27a572=[];var _0x1ad69e=[];var _0x52f4b3={};return db['SmsAccount'][_0xf5c1('0x5b')]({'where':{'id':_0x2511f4['params']['id']},'include':[{'model':db[_0xf5c1('0x72')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x34249a,null))['then'](function(_0xeb124c){_0x3ac5c0['account']=_0xeb124c;_0x3ac5c0[_0xf5c1('0x73')]=_[_0xf5c1('0x74')](_0xeb124c[_0xf5c1('0x75')],[_0xf5c1('0x76')],[_0xf5c1('0x77')]);if(_0x3ac5c0[_0xf5c1('0x78')][_0xf5c1('0x75')]){delete _0x3ac5c0['account'][_0xf5c1('0x75')];}return db[_0xf5c1('0x79')][_0xf5c1('0x64')]();})[_0xf5c1('0x1e')](function(_0x281d6f){if(!_0x281d6f){throw new db[(_0xf5c1('0x7a'))]['ValidationError'](_0xf5c1('0x7b'));}_0x27a572=_[_0xf5c1('0x7c')](_[_0xf5c1('0x59')](_0x281d6f),[_0xf5c1('0x7d'),_0xf5c1('0x7e')]);_0x1ad69e=_[_0xf5c1('0x7c')](_[_0xf5c1('0x59')](_0x281d6f),[_0xf5c1('0x7d'),_0xf5c1('0x7e'),'CompanyId',_0xf5c1('0x7f')]);_0x3ac5c0[_0xf5c1('0x5d')]={'mapKey':_0xf5c1('0x80')};if(_0x3ac5c0['account']['type']){switch(_0x3ac5c0[_0xf5c1('0x78')]['type']){case _0xf5c1('0x81'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x83')];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')]['Body'];_0x3ac5c0[_0xf5c1('0x5d')]['messageId']=_0x2511f4[_0xf5c1('0x5d')]['MessageSid'];break;case _0xf5c1('0x84'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]='+'+_0x2511f4[_0xf5c1('0x5d')]['sender'];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4['body'][_0xf5c1('0x85')];break;case'connectel':_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4['body'][_0xf5c1('0x82')];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')]['message'];break;case _0xf5c1('0x86'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x82')];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x5d')];_0x3ac5c0[_0xf5c1('0x5d')]['messageId']=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x87')];break;case _0xf5c1('0x88'):_0x3ac5c0[_0xf5c1('0x5d')]['from']=_0x2511f4[_0xf5c1('0x5d')]['From'];_0x3ac5c0[_0xf5c1('0x5d')]['body']=_0x2511f4[_0xf5c1('0x5d')]['Text'];_0x3ac5c0[_0xf5c1('0x5d')]['messageId']=_0x2511f4['body'][_0xf5c1('0x89')];break;case _0xf5c1('0x8a'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]='+'+_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x8b')][0x0]['from'];_0x3ac5c0['body'][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')]['results'][0x0]['text'];_0x3ac5c0[_0xf5c1('0x5d')]['messageId']=_0x2511f4[_0xf5c1('0x5d')]['results'][0x0][_0xf5c1('0x8c')];break;case _0xf5c1('0x8d'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4['body'][_0xf5c1('0x8e')];_0x3ac5c0['body'][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x8f')][_0xf5c1('0x26')];break;case'clickatell':_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4[_0xf5c1('0x5d')]['fromNumber'];_0x3ac5c0['body'][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x85')];_0x3ac5c0[_0xf5c1('0x5d')]['messageId']=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x90')];break;case _0xf5c1('0x91'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x8c')]=_0x2511f4[_0xf5c1('0x5d')][0x0][_0xf5c1('0x26')]['id'];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4[_0xf5c1('0x5d')][0x0][_0xf5c1('0x26')][_0xf5c1('0x82')];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')][0x0][_0xf5c1('0x26')][_0xf5c1('0x85')];break;case _0xf5c1('0x92'):_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')]=_0x2511f4[_0xf5c1('0x5d')][_0xf5c1('0x82')];_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x5d')]=_0x2511f4[_0xf5c1('0x5d')]['message'];_0x3ac5c0['body'][_0xf5c1('0x8c')]=_0x2511f4['body'][_0xf5c1('0x93')];break;}}if(_0x3ac5c0[_0xf5c1('0x5d')]['id']){delete _0x3ac5c0[_0xf5c1('0x5d')]['id'];}if(_['isNil'](_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')])){throw new db[(_0xf5c1('0x7a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf5c1('0x94')](_0x3ac5c0['body'][_0xf5c1('0x5d')])||_0x3ac5c0[_0xf5c1('0x5d')]['body']===''){throw new db[(_0xf5c1('0x7a'))][(_0xf5c1('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf5c1('0x94')](_0x3ac5c0[_0xf5c1('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0xf5c1('0x95'))](_0xf5c1('0x96')+_0x1ad69e);}if(!_['includes'](_0x1ad69e,_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x97')])){throw new db[(_0xf5c1('0x7a'))][(_0xf5c1('0x95'))](_0xf5c1('0x98')+_0x1ad69e);}_0x52f4b3[_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x97')]]=_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')];return db['CmList'][_0xf5c1('0x5b')]({'where':{'id':_0x3ac5c0[_0xf5c1('0x78')][_0xf5c1('0x7f')]},'include':[{'model':db[_0xf5c1('0x79')],'as':'Contacts','where':_0x52f4b3,'limit':0x1,'order':[[_0xf5c1('0x7e'),'DESC']]}]});})[_0xf5c1('0x1e')](handleEntityNotFound(_0x34249a,null))['then'](function(_0x4957fc){if(_0x4957fc){_0x3ac5c0[_0xf5c1('0x99')]=_[_0xf5c1('0x9a')](_0x4957fc,['Contacts']);if(_0x4957fc[_0xf5c1('0x9b')][_0xf5c1('0x49')]){return _0x4957fc['Contacts'][0x0];}var _0x5c89e9=_['defaults'](_0x3ac5c0['body'],{'firstName':_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')],'ListId':_0x4957fc['id']});_0x5c89e9[_0x3ac5c0['body'][_0xf5c1('0x97')]]=_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')];return db[_0xf5c1('0x79')]['create'](_0x5c89e9,{'fields':_0x27a572,'raw':!![]});}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x34249a,null))['then'](function(_0x58c923){if(_0x58c923){_0x3ac5c0[_0xf5c1('0x9c')]=_0x58c923;var _0x3ce2ef={'ContactId':_0x58c923['id'],'phone':_0x3ac5c0['body'][_0xf5c1('0x82')],'SmsAccountId':_0x2511f4[_0xf5c1('0x58')]['id']};var _0x29d787={'ContactId':_0x58c923['id'],'SmsAccountId':_0x2511f4[_0xf5c1('0x58')]['id'],'closed':![]};return db['SmsInteraction'][_0xf5c1('0x5b')]({'where':_0x29d787})[_0xf5c1('0x1e')](function(_0x389539){if(_0x389539){return[_0x389539,![]];}return db['SmsInteraction'][_0xf5c1('0x5c')](_0x3ce2ef)[_0xf5c1('0x1e')](function(_0x2d5f74){return[_0x2d5f74,!![]];});});}})[_0xf5c1('0x9d')](function(_0x2c97e8,_0x3c5f1d){_0x3ac5c0['interaction']=_0x2c97e8['get']({'plain':!![]});_0x3ac5c0[_0xf5c1('0x9e')][_0xf5c1('0x9f')]=![];if(_0x3c5f1d){if(_0x3ac5c0['account'][_0xf5c1('0xa0')]){_0x3ac5c0[_0xf5c1('0x73')][_0xf5c1('0xa1')]({'id':0x0,'priority':_0x3ac5c0[_0xf5c1('0x73')][_0xf5c1('0x49')]+0x1,'app':_0xf5c1('0xa2'),'appdata':_0xf5c1('0xa3'),'interval':_0xf5c1('0xa4')});}_0x3ac5c0['interaction'][_0xf5c1('0x9f')]=!![];}return db[_0xf5c1('0xa5')]['create']({'phone':_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0x82')],'messageId':_0x3ac5c0[_0xf5c1('0x5d')]['messageId'],'body':_0x3ac5c0['body'][_0xf5c1('0x5d')],'SmsAccountId':_0x2511f4[_0xf5c1('0x58')]['id'],'SmsInteractionId':_0x2c97e8['id'],'direction':'in','ContactId':_0x2c97e8[_0xf5c1('0xa6')],'AttachmentId':_0x3ac5c0[_0xf5c1('0x5d')][_0xf5c1('0xa7')]});})['then'](function(_0x424b2d){_0x3ac5c0[_0xf5c1('0x26')]=_0x424b2d;if(_0x3ac5c0['interaction'][_0xf5c1('0xa8')]){return db['User'][_0xf5c1('0x5b')]({'attributes':['id',_0xf5c1('0x3b')],'where':{'id':_0x3ac5c0[_0xf5c1('0x9e')][_0xf5c1('0xa8')]}})[_0xf5c1('0x1e')](function(_0xdbee3e){if(_0xdbee3e){_0x3ac5c0[_0xf5c1('0x73')][_0xf5c1('0xa9')]({'id':0x0,'priority':0x0,'app':_0xf5c1('0xaa'),'appdata':_0xdbee3e[_0xf5c1('0x3b')]+','+(_0x3ac5c0[_0xf5c1('0x78')][_0xf5c1('0xab')]||0xa),'interval':_0xf5c1('0xa4')});}return respondWithRpcPromise(_0xf5c1('0xac'),_0xf5c1('0xad'),_0x3ac5c0);});}return respondWithRpcPromise(_0xf5c1('0xac'),_0xf5c1('0xad'),_0x3ac5c0);})[_0xf5c1('0x1e')](function(_0x4d7d97){if(_0x4d7d97){var _0x308d76=0xc8;var _0x2de0f8=_0xf5c1('0xae');logger['info'](_0xf5c1('0x23'),_0x2de0f8,_0x308d76,_0xf5c1('0xaf'));logger[_0xf5c1('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2de0f8,_0x308d76,_0xf5c1('0xaf'),JSON[_0xf5c1('0x24')](_0x4d7d97));if(_0x3ac5c0[_0xf5c1('0x78')][_0xf5c1('0x41')]===_0xf5c1('0x81')){return _0x34249a['status'](_0x308d76)[_0xf5c1('0x30')](_0xf5c1('0xb0'),_0xf5c1('0xb1'))[_0xf5c1('0x3c')](_0xf5c1('0xb2'));}else{return _0x34249a[_0xf5c1('0x2a')](_0x308d76)[_0xf5c1('0x2b')](_0x4d7d97);}}})[_0xf5c1('0x28')](handleError(_0x34249a,null));};exports[_0xf5c1('0xb3')]=function(_0x3d8c2c,_0x3d6d38){var _0x43bebb=_0x3d8c2c['params']['id'];var _0x17dcf6=_0x3d8c2c[_0xf5c1('0x5d')];var _0x5a1751=0xc8;var _0x1230bc=null;return db['sequelize'][_0xf5c1('0xb4')]({'isolationLevel':db[_0xf5c1('0xb5')][_0xf5c1('0xb6')]['ISOLATION_LEVELS'][_0xf5c1('0xb7')]},function(_0x444c44){return db[_0xf5c1('0x53')]['findOne']({'where':{'id':_0x43bebb},'transaction':_0x444c44})['then'](function(_0x29e1a8){if(_0x29e1a8){return db[_0xf5c1('0x72')][_0xf5c1('0x36')]({'where':{'SmsAccountId':_0x43bebb},'transaction':_0x444c44})['then'](function(){var _0x3d07df=_[_0xf5c1('0x43')](_0x17dcf6,function(_0x3ff1f3){_0x3ff1f3[_0xf5c1('0x66')]=_0x43bebb;return _0x3ff1f3;});return db[_0xf5c1('0x72')]['bulkCreate'](_0x3d07df,{'transaction':_0x444c44});});}else{_0x5a1751=0x194;_0x1230bc=[];}});})[_0xf5c1('0x1e')](function(){if(_0x5a1751!==0x194){return db['SmsApplication'][_0xf5c1('0xb8')]({'where':{'SmsAccountId':_0x43bebb},'order':'priority'})[_0xf5c1('0x1e')](function(_0x6a0d2f){_0x1230bc=_0x6a0d2f;});}})['catch'](function(_0x2e4297){_0x5a1751=0x1f4;logger[_0xf5c1('0x25')](_0x2e4297[_0xf5c1('0xb9')]);if(_0x2e4297['name']){delete _0x2e4297[_0xf5c1('0x3b')];}_0x1230bc=_0x2e4297;})[_0xf5c1('0xba')](function(){if(_0x1230bc===null){_0x3d6d38[_0xf5c1('0x29')](_0x5a1751);}else{if(_0x5a1751===0x1f4){_0x3d6d38[_0xf5c1('0x2a')](_0x5a1751)[_0xf5c1('0x3c')](_0x1230bc);}else{_0x3d6d38[_0xf5c1('0x2a')](_0x5a1751)[_0xf5c1('0x2b')](_0x1230bc);}}});};exports[_0xf5c1('0xbb')]=function(_0x4d3fd4,_0x2b8d5c,_0x2f1c1c){var _0x2f5227={};var _0x251384={};var _0x13fde4;var _0xf1f57d;return db[_0xf5c1('0x53')][_0xf5c1('0x68')]({'where':{'id':_0x4d3fd4[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x2b8d5c,null))[_0xf5c1('0x1e')](function(_0x45efa8){if(_0x45efa8){_0x13fde4=_0x45efa8;_0x251384[_0xf5c1('0x42')]=_['keys'](db[_0xf5c1('0x72')]['rawAttributes']);_0x251384['query']=_[_0xf5c1('0x59')](_0x4d3fd4[_0xf5c1('0x44')]);_0x251384[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0x251384[_0xf5c1('0x42')],_0x251384[_0xf5c1('0x44')]);_0x2f5227['attributes']=_[_0xf5c1('0x46')](_0x251384[_0xf5c1('0x42')],qs[_0xf5c1('0x48')](_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x48')]));_0x2f5227[_0xf5c1('0x47')]=_0x2f5227['attributes'][_0xf5c1('0x49')]?_0x2f5227['attributes']:_0x251384[_0xf5c1('0x42')];_0x2f5227['order']=qs[_0xf5c1('0x4c')](_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x4c')]);_0x2f5227[_0xf5c1('0x4d')]=qs[_0xf5c1('0x45')](_[_0xf5c1('0x4e')](_0x4d3fd4['query'],_0x251384[_0xf5c1('0x45')]));if(_0x4d3fd4[_0xf5c1('0x44')]['filter']){_0x2f5227[_0xf5c1('0x4d')]=_[_0xf5c1('0x50')](_0x2f5227[_0xf5c1('0x4d')],{'$or':_[_0xf5c1('0x43')](_0x2f5227[_0xf5c1('0x47')],function(_0x2b2b0b){var _0x4c0430={};_0x4c0430[_0x2b2b0b]={'$like':'%'+_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x4f')]+'%'};return _0x4c0430;})});}_0x2f5227=_['merge']({},_0x2f5227,_0x4d3fd4[_0xf5c1('0x52')]);return _0x13fde4[_0xf5c1('0xbb')](_0x2f5227);}})[_0xf5c1('0x1e')](function(_0x550e6a){if(_0x550e6a){_0xf1f57d=_0x550e6a[_0xf5c1('0x49')];if(!_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x4a')](_0xf5c1('0x4b'))){_0x2f5227['limit']=qs[_0xf5c1('0x2f')](_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x2f')]);_0x2f5227[_0xf5c1('0x2d')]=qs[_0xf5c1('0x2d')](_0x4d3fd4[_0xf5c1('0x44')][_0xf5c1('0x2d')]);}return _0x13fde4[_0xf5c1('0xbb')](_0x2f5227);}})[_0xf5c1('0x1e')](function(_0x3769b3){if(_0x3769b3){return _0x3769b3?{'count':_0xf1f57d,'rows':_0x3769b3}:null;}})[_0xf5c1('0x1e')](respondWithResult(_0x2b8d5c,null))[_0xf5c1('0x28')](handleError(_0x2b8d5c,null));};exports[_0xf5c1('0xbc')]=function(_0x578094,_0x1a3906,_0x6a97cb){var _0x56aad3={'raw':![],'where':{}};var _0x1617f3={};var _0x3aa468={'count':0x0,'rows':[]};return db['SmsAccount'][_0xf5c1('0x68')]({'where':{'id':_0x578094[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x1a3906,null))[_0xf5c1('0x1e')](function(_0x5905a9){if(_0x5905a9){_0x1617f3[_0xf5c1('0x42')]=_[_0xf5c1('0x59')](db['SmsInteraction']['rawAttributes']);_0x1617f3[_0xf5c1('0x44')]=_[_0xf5c1('0x59')](_0x578094[_0xf5c1('0x44')]);_0x1617f3[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0x1617f3[_0xf5c1('0x42')],_0x1617f3['query']);_0x56aad3[_0xf5c1('0x47')]=_[_0xf5c1('0x46')](_0x1617f3[_0xf5c1('0x42')],qs[_0xf5c1('0x48')](_0x578094['query'][_0xf5c1('0x48')]));_0x56aad3['attributes']=_0x56aad3['attributes'][_0xf5c1('0x49')]?_0x56aad3['attributes']:_0x1617f3[_0xf5c1('0x42')];if(!_0x578094['query'][_0xf5c1('0x4a')]('nolimit')){_0x56aad3[_0xf5c1('0x2f')]=qs[_0xf5c1('0x2f')](_0x578094[_0xf5c1('0x44')][_0xf5c1('0x2f')]);_0x56aad3['offset']=qs[_0xf5c1('0x2d')](_0x578094['query']['offset']);}_0x56aad3[_0xf5c1('0x6e')]=qs[_0xf5c1('0x4c')](_0x578094[_0xf5c1('0x44')][_0xf5c1('0x4c')]);_0x56aad3['where']=qs[_0xf5c1('0x45')](_[_0xf5c1('0x4e')](_0x578094[_0xf5c1('0x44')],_0x1617f3[_0xf5c1('0x45')]));_0x56aad3[_0xf5c1('0x4d')][_0xf5c1('0x66')]=_0x5905a9['id'];if(_0x578094[_0xf5c1('0x44')][_0xf5c1('0x4f')]){_0x56aad3[_0xf5c1('0x4d')]=_[_0xf5c1('0x50')](_0x56aad3[_0xf5c1('0x4d')],{'$or':_[_0xf5c1('0x43')](_0x56aad3[_0xf5c1('0x47')],function(_0x392bbb){var _0x32fa24={};_0x32fa24[_0x392bbb]={'$like':'%'+_0x578094['query'][_0xf5c1('0x4f')]+'%'};return _0x32fa24;})});}_0x56aad3=_[_0xf5c1('0x50')]({},_0x56aad3,_0x578094[_0xf5c1('0x52')]);return db[_0xf5c1('0xbd')][_0xf5c1('0x2e')]({'where':_0x56aad3[_0xf5c1('0x4d')]})[_0xf5c1('0x1e')](function(_0x3990ce){_0x3aa468[_0xf5c1('0x2e')]=_0x3990ce;if(_0x578094[_0xf5c1('0x44')][_0xf5c1('0x54')]){_0x56aad3[_0xf5c1('0x5a')]=[{'model':db[_0xf5c1('0x79')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf5c1('0xbe'),'attributes':[_0xf5c1('0x3b'),_0xf5c1('0xbf'),_0xf5c1('0xc0')],'required':![]},{'model':db['Tag'],'as':_0xf5c1('0xc1'),'attributes':['id',_0xf5c1('0x3b'),_0xf5c1('0xc2')],'where':_0x578094[_0xf5c1('0x44')]['tag']?{'id':_0x578094[_0xf5c1('0x44')][_0xf5c1('0xc3')]}:undefined,'required':_0x578094[_0xf5c1('0x44')][_0xf5c1('0xc3')]?!![]:![]}];}return db[_0xf5c1('0xbd')]['findAll'](_0x56aad3);})[_0xf5c1('0x1e')](function(_0x14da81){_0x3aa468['rows']=_0x14da81;return _0x3aa468;});}})[_0xf5c1('0x1e')](respondWithFilteredResult(_0x1a3906,_0x56aad3))[_0xf5c1('0x28')](handleError(_0x1a3906,null));};exports['send']=function(_0x2604f4,_0x41fe9c,_0x349bc4){var _0x12b524,_0x4f77f8,_0x4ccb25;if(_[_0xf5c1('0x94')](_0x2604f4['body'][_0xf5c1('0x5d')])||_0x2604f4['body']['body']===''){throw new db[(_0xf5c1('0x7a'))][(_0xf5c1('0x95'))](_0xf5c1('0xc4'));}if(_['isNil'](_0x2604f4['body']['to'])){throw new db['Sequelize']['ValidationError'](_0xf5c1('0xc5'));}_0x12b524=_0x2604f4[_0xf5c1('0x5d')]['to'];return db[_0xf5c1('0x53')]['find']({'where':{'id':_0x2604f4['params']['id']},'include':[{'model':db[_0xf5c1('0xc6')],'as':_0xf5c1('0xc7'),'include':[{'model':db[_0xf5c1('0x79')],'as':_0xf5c1('0x9b'),'where':{'mobile':_0x12b524},'limit':0x1,'order':[[_0xf5c1('0x7e'),_0xf5c1('0xc8')]]}]}]})['then'](handleEntityNotFound(_0x41fe9c,null))['then'](function(_0x3b1ced){if(_0x3b1ced&&_0x3b1ced[_0xf5c1('0xc7')]){_0x4f77f8=_0x3b1ced[_0xf5c1('0x37')]({'plain':!![]});if(_0x4f77f8[_0xf5c1('0xc7')]&&_0x4f77f8[_0xf5c1('0xc7')][_0xf5c1('0x9b')][_0xf5c1('0x49')]){return _0x4f77f8[_0xf5c1('0xc7')]['Contacts'][0x0];}return db[_0xf5c1('0x79')][_0xf5c1('0x5c')](_[_0xf5c1('0x18')](_0x2604f4[_0xf5c1('0x5d')],{'firstName':_0x12b524,'mobile':_0x12b524,'phone':_0x12b524,'ListId':_0x4f77f8[_0xf5c1('0x7f')]}));}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x41fe9c,null))[_0xf5c1('0x1e')](function(_0x5950a6){if(_0x5950a6){_0x4ccb25=_0x5950a6;return db[_0xf5c1('0xbd')]['find']({'where':{'ContactId':_0x4ccb25['id'],'closed':![],'SmsAccountId':_0x4f77f8['id']}})[_0xf5c1('0x1e')](function(_0x33863a){if(_0x33863a){return[_0x33863a,![]];}return db[_0xf5c1('0xbd')][_0xf5c1('0x5c')]({'UserId':_0x2604f4['user']['id'],'ContactId':_0x4ccb25['id'],'SmsAccountId':_0x4f77f8['id'],'phone':_0x12b524,'firstMsgDirection':_0xf5c1('0xc9'),'Messages':[_['merge'](_0x2604f4[_0xf5c1('0x5d')],{'read':![],'body':_0x2604f4[_0xf5c1('0x5d')]['body'],'phone':_0x12b524,'SmsAccountId':_0x4f77f8['id'],'UserId':_0x2604f4['user']['id'],'ContactId':_0x4ccb25['id']})]},{'include':[{'model':db[_0xf5c1('0xa5')],'as':'Messages'}]})[_0xf5c1('0x1e')](function(_0x243e20){return[_0x243e20,!![]];});});}})[_0xf5c1('0x9d')](function(_0x362df8,_0x4a71fa){if(_0x4a71fa){return _0x362df8;}return db[_0xf5c1('0xa5')]['create'](_['merge'](_0x2604f4[_0xf5c1('0x5d')],{'read':![],'body':_0x2604f4['body'][_0xf5c1('0x5d')],'phone':_0x12b524,'SmsAccountId':_0x4f77f8['id'],'SmsInteractionId':_0x362df8['id'],'UserId':_0x2604f4[_0xf5c1('0x5e')]['id'],'ContactId':_0x4ccb25['id']}))['then'](function(_0x2045e4){_0x362df8['dataValues'][_0xf5c1('0xca')]=[];_0x362df8[_0xf5c1('0xcb')]['Messages'][_0xf5c1('0xa1')](_0x2045e4['dataValues']);return _0x362df8;});})['then'](respondWithResult(_0x41fe9c,null))[_0xf5c1('0x28')](handleError(_0x41fe9c,null));};exports[_0xf5c1('0x2a')]=function(_0x664312,_0x5138a5,_0xb2235a){if(_0x664312[_0xf5c1('0x5d')]['id']){delete _0x664312[_0xf5c1('0x5d')]['id'];}var _0x3d3dbb,_0x2b8084,_0x505ae3;return db['SmsAccount'][_0xf5c1('0x5b')]({'where':{'id':_0x664312['params']['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x5138a5,null))[_0xf5c1('0x1e')](function(_0x239824){if(_0x239824){_0x505ae3=_0x239824;logger[_0xf5c1('0x22')](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0xcc'),_0x239824[_0xf5c1('0x41')],util[_0xf5c1('0xcd')](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));switch(_0x239824['type']){case _0xf5c1('0x84'):if(_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xce')]&&_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x2a')]){_0x2b8084=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x2a')];return db[_0xf5c1('0xa5')][_0xf5c1('0x5b')]({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xce')]}});}break;case'connectel':if(_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xcf')]&&_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd0')]){_0x2b8084=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd0')];return db['SmsMessage'][_0xf5c1('0x5b')]({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xcf')]}});}break;case _0xf5c1('0x86'):if(_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x87')]&&_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd1')]){_0x2b8084=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd1')];return db[_0xf5c1('0xa5')][_0xf5c1('0x5b')]({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x87')]}});}break;case _0xf5c1('0x8a'):var _0x564d14=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x8b')][0x0];if(_0x564d14[_0xf5c1('0x8c')]&&_0x564d14[_0xf5c1('0x2a')][_0xf5c1('0xd2')]===_0xf5c1('0xd3')){_0x2b8084=_0x564d14[_0xf5c1('0x2a')][_0xf5c1('0xd2')];return db[_0xf5c1('0xa5')][_0xf5c1('0x5b')]({'where':{'messageId':_0x564d14['messageId']}});}break;case _0xf5c1('0xd4'):if(_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x8c')]&&_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x2a')]){_0x2b8084=_0x664312[_0xf5c1('0x5d')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x8c')]}});}break;case _0xf5c1('0x91'):if(_0x664312[_0xf5c1('0x5d')][0x0][_0xf5c1('0x26')]['id']){_0x2b8084=_0x664312[_0xf5c1('0x5d')][0x0]['type'];return db[_0xf5c1('0xa5')][_0xf5c1('0x5b')]({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][0x0][_0xf5c1('0x26')]['id']}});}break;case'intelepeer':if(_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd5')]&&_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x2a')]){_0x2b8084=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x5138a5,null))[_0xf5c1('0x1e')](function(_0x5d9883){if(_0x5d9883){_0x3d3dbb=_0x5d9883;switch(_0x505ae3[_0xf5c1('0x41')]){case _0xf5c1('0x84'):if(_0x2b8084===_0xf5c1('0xd3')){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger[_0xf5c1('0x25')](_0xf5c1('0x23'),'status',_0xf5c1('0x84'),util['inspect'](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xf5c1('0xd6'):if(_0x2b8084==='1'){return _0x3d3dbb['update']({'read':!![]});}else{logger['error'](_0xf5c1('0x23'),'status',_0xf5c1('0x84'),util[_0xf5c1('0xcd')](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x664312[_0xf5c1('0x5d')][_0xf5c1('0xd7')]&&_0x2b8084>=0xc8&&_0x2b8084<=0xce){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util['inspect'](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xf5c1('0x8a'):var _0x159dff=_0x664312[_0xf5c1('0x5d')][_0xf5c1('0x8b')][0x0];if(_0x159dff[_0xf5c1('0x2a')]['groupName']===_0xf5c1('0xd3')){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger[_0xf5c1('0x25')](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0x8a'),util['inspect'](_0x664312['body'],{'showHidden':![],'depth':null}));}break;case _0xf5c1('0xd4'):if(_0x2b8084=='DELIVERED_TO_GATEWAY'||_0x2b8084==_0xf5c1('0xd8')){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger[_0xf5c1('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf5c1('0x2a'),_0xf5c1('0xd4'),util[_0xf5c1('0xcd')](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xf5c1('0x91'):if(_0x2b8084=='message-delivered'){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger['error'](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0x91'),util[_0xf5c1('0xcd')](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xf5c1('0x92'):if(_0x2b8084===_0xf5c1('0xd9')||_0x2b8084===_0xf5c1('0xda')){return _0x3d3dbb[_0xf5c1('0x35')]({'read':!![]});}else{logger[_0xf5c1('0x25')](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0x92'),util[_0xf5c1('0xcd')](_0x664312[_0xf5c1('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x3d3dbb;}})[_0xf5c1('0x1e')](respondWithResult(_0x5138a5,null))['catch'](handleError(_0x5138a5,null));};exports[_0xf5c1('0xdb')]=function(_0x4e4c4e,_0x522548,_0x502db6){var _0x282cb3,_0x41c8c5,_0x2d88d1;return db['SmsAccount'][_0xf5c1('0x5b')]({'where':{'id':_0x4e4c4e[_0xf5c1('0x58')]['id']}})['then'](handleEntityNotFound(_0x522548,null))['then'](function(_0x254ac8){if(_0x254ac8){_0x2d88d1=_0x254ac8;logger[_0xf5c1('0x22')](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0xcc'),_0x254ac8[_0xf5c1('0x41')],util['inspect'](_0x4e4c4e['query'],{'showHidden':![],'depth':null}));switch(_0x254ac8[_0xf5c1('0x41')]){case _0xf5c1('0x8d'):if(_0x4e4c4e[_0xf5c1('0x44')][_0xf5c1('0xdc')]&&_0x4e4c4e['query'][_0xf5c1('0xdd')]){_0x41c8c5=_0x4e4c4e[_0xf5c1('0x44')]['state'];return db[_0xf5c1('0xa5')]['find']({'where':{'messageId':_0x4e4c4e[_0xf5c1('0x44')][_0xf5c1('0xdc')]}});}break;}}})['then'](handleEntityNotFound(_0x522548,null))[_0xf5c1('0x1e')](function(_0x5a586b){if(_0x5a586b){_0x282cb3=_0x5a586b;switch(_0x2d88d1[_0xf5c1('0x41')]){case _0xf5c1('0x8d'):if(_0x41c8c5==='2'||_0x41c8c5==='6'){return _0x282cb3['update']({'read':!![]});}else{logger['error'](_0xf5c1('0x23'),_0xf5c1('0x2a'),_0xf5c1('0x8d'),util[_0xf5c1('0xcd')](_0x4e4c4e[_0xf5c1('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x282cb3;}})[_0xf5c1('0x1e')](respondWithResult(_0x522548,null))['catch'](handleError(_0x522548,null));};exports[_0xf5c1('0xde')]=function(_0x4c8c4a,_0x18313d,_0x5ba855){return db[_0xf5c1('0x53')]['find']({'where':{'id':_0x4c8c4a['params']['id']}})['then'](handleEntityNotFound(_0x18313d,null))[_0xf5c1('0x1e')](function(_0x527374){if(_0x527374){return _0x527374['addAgents'](_0x4c8c4a['body']['ids'],_[_0xf5c1('0x9a')](_0x4c8c4a[_0xf5c1('0x5d')],[_0xf5c1('0x6b'),'id'])||{})[_0xf5c1('0x9d')](function(_0x235c80){for(var _0x35587b=0x0;_0x35587b<_0x4c8c4a[_0xf5c1('0x5d')][_0xf5c1('0x6b')]['length'];_0x35587b+=0x1){socket[_0xf5c1('0xdf')](_0xf5c1('0xe0'),{'UserId':Number(_0x4c8c4a[_0xf5c1('0x5d')]['ids'][_0x35587b]),'SmsAccountId':Number(_0x4c8c4a[_0xf5c1('0x58')]['id'])});}return _0x235c80;});}})['then'](respondWithResult(_0x18313d,null))[_0xf5c1('0x28')](handleError(_0x18313d,null));};exports[_0xf5c1('0xe1')]=function(_0x258c2d,_0x5b2a32,_0x469f57){return db['SmsAccount']['find']({'where':{'id':_0x258c2d[_0xf5c1('0x58')]['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x5b2a32,null))[_0xf5c1('0x1e')](function(_0x5bfb4f){if(_0x5bfb4f){return _0x5bfb4f[_0xf5c1('0xe1')](_0x258c2d[_0xf5c1('0x44')][_0xf5c1('0x6b')])['then'](function(){if(_[_0xf5c1('0xe2')](_0x258c2d[_0xf5c1('0x44')][_0xf5c1('0x6b')])){for(var _0x113685=0x0;_0x113685<_0x258c2d[_0xf5c1('0x44')][_0xf5c1('0x6b')][_0xf5c1('0x49')];_0x113685+=0x1){socket[_0xf5c1('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x258c2d[_0xf5c1('0x44')][_0xf5c1('0x6b')][_0x113685]),'SmsAccountId':Number(_0x258c2d[_0xf5c1('0x58')]['id'])});}}else{socket[_0xf5c1('0xdf')](_0xf5c1('0xe3'),{'UserId':Number(_0x258c2d[_0xf5c1('0x44')][_0xf5c1('0x6b')]),'SmsAccountId':Number(_0x258c2d[_0xf5c1('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b2a32,null))['catch'](handleError(_0x5b2a32,null));};exports[_0xf5c1('0xe4')]=function(_0x145298,_0x542c83,_0x5c61f4){var _0x568b30={};var _0x4e92ff={};var _0x341c0e;var _0x414ee1;return db[_0xf5c1('0x53')][_0xf5c1('0x68')]({'where':{'id':_0x145298['params']['id']}})[_0xf5c1('0x1e')](handleEntityNotFound(_0x542c83,null))[_0xf5c1('0x1e')](function(_0x29ba8a){if(_0x29ba8a){_0x341c0e=_0x29ba8a;_0x4e92ff[_0xf5c1('0x42')]=_[_0xf5c1('0x59')](db['User'][_0xf5c1('0x3f')]);_0x4e92ff['query']=_[_0xf5c1('0x59')](_0x145298[_0xf5c1('0x44')]);_0x4e92ff[_0xf5c1('0x45')]=_[_0xf5c1('0x46')](_0x4e92ff['model'],_0x4e92ff[_0xf5c1('0x44')]);_0x568b30[_0xf5c1('0x47')]=_[_0xf5c1('0x46')](_0x4e92ff[_0xf5c1('0x42')],qs['fields'](_0x145298['query'][_0xf5c1('0x48')]));_0x568b30[_0xf5c1('0x47')]=_0x568b30[_0xf5c1('0x47')][_0xf5c1('0x49')]?_0x568b30[_0xf5c1('0x47')]:_0x4e92ff[_0xf5c1('0x42')];_0x568b30[_0xf5c1('0x6e')]=qs[_0xf5c1('0x4c')](_0x145298[_0xf5c1('0x44')][_0xf5c1('0x4c')]);_0x568b30[_0xf5c1('0x4d')]=qs[_0xf5c1('0x45')](_[_0xf5c1('0x4e')](_0x145298[_0xf5c1('0x44')],_0x4e92ff[_0xf5c1('0x45')]));if(_0x145298[_0xf5c1('0x44')]['filter']){_0x568b30[_0xf5c1('0x4d')]=_['merge'](_0x568b30['where'],{'$or':_['map'](_0x568b30[_0xf5c1('0x47')],function(_0x3b8733){var _0x44e4b5={};_0x44e4b5[_0x3b8733]={'$like':'%'+_0x145298['query'][_0xf5c1('0x4f')]+'%'};return _0x44e4b5;})});}_0x568b30=_[_0xf5c1('0x50')]({},_0x568b30,_0x145298[_0xf5c1('0x52')]);return _0x341c0e[_0xf5c1('0xe4')](_0x568b30);}})[_0xf5c1('0x1e')](function(_0x4deea5){if(_0x4deea5){_0x414ee1=_0x4deea5[_0xf5c1('0x49')];if(!_0x145298[_0xf5c1('0x44')]['hasOwnProperty'](_0xf5c1('0x4b'))){_0x568b30['limit']=qs[_0xf5c1('0x2f')](_0x145298[_0xf5c1('0x44')]['limit']);_0x568b30['offset']=qs[_0xf5c1('0x2d')](_0x145298[_0xf5c1('0x44')][_0xf5c1('0x2d')]);}return _0x341c0e[_0xf5c1('0xe4')](_0x568b30);}})[_0xf5c1('0x1e')](function(_0x571238){if(_0x571238){return _0x571238?{'count':_0x414ee1,'rows':_0x571238}:null;}})[_0xf5c1('0x1e')](respondWithResult(_0x542c83,null))[_0xf5c1('0x28')](handleError(_0x542c83,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1f3255a..aebe7ff 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 _0xb9bd=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update'];(function(_0x2f0c5b,_0x36c6a5){var _0x28a304=function(_0x1caf6a){while(--_0x1caf6a){_0x2f0c5b['push'](_0x2f0c5b['shift']());}};_0x28a304(++_0x36c6a5);}(_0xb9bd,0x136));var _0xdb9b=function(_0xa9b7c,_0x4a8e29){_0xa9b7c=_0xa9b7c-0x0;var _0x423bce=_0xb9bd[_0xa9b7c];return _0x423bce;};'use strict';var EventEmitter=require(_0xdb9b('0x0'));var SmsAccount=require(_0xdb9b('0x1'))['db'][_0xdb9b('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xdb9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb9b('0x4'),'afterDestroy':_0xdb9b('0x5')};function emitEvent(_0x4a6eb0){return function(_0x504e9f,_0x2010b2,_0xcc0a27){SmsAccountEvents[_0xdb9b('0x6')](_0x4a6eb0+':'+_0x504e9f['id'],_0x504e9f);SmsAccountEvents[_0xdb9b('0x6')](_0x4a6eb0,_0x504e9f);_0xcc0a27(null);};}for(var e in events){if(events[_0xdb9b('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xdb9b('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x1da8=['SmsAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x5d4672,_0x3bcfda){var _0x1fdc84=function(_0x385cf3){while(--_0x385cf3){_0x5d4672['push'](_0x5d4672['shift']());}};_0x1fdc84(++_0x3bcfda);}(_0x1da8,0x77));var _0x81da=function(_0x3902d6,_0x1f1c2d){_0x3902d6=_0x3902d6-0x0;var _0x25fa74=_0x1da8[_0x3902d6];return _0x25fa74;};'use strict';var EventEmitter=require(_0x81da('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x81da('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x81da('0x2')](0x0);var events={'afterCreate':_0x81da('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x340aea){return function(_0x25cfed,_0x26d15c,_0x258d4b){SmsAccountEvents['emit'](_0x340aea+':'+_0x25cfed['id'],_0x25cfed);SmsAccountEvents[_0x81da('0x4')](_0x340aea,_0x25cfed);_0x258d4b(null);};}for(var e in events){if(events[_0x81da('0x5')](e)){var event=events[e];SmsAccount[_0x81da('0x6')](e,emitEvent(event));}}module[_0x81da('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a78828b..175c9c0 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 _0x72a0=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','SmsAccount','sms_accounts'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x72a0,0x1b8));var _0x072a=function(_0x2fc2df,_0x14b59b){_0x2fc2df=_0x2fc2df-0x0;var _0x521bf5=_0x72a0[_0x2fc2df];return _0x521bf5;};'use strict';var _=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x072a('0x2'));var BPromise=require(_0x072a('0x3'));var rp=require(_0x072a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x072a('0x5'));var config=require(_0x072a('0x6'));var attributes=require(_0x072a('0x7'));module['exports']=function(_0x3dad5a,_0x401e56){return _0x3dad5a['define'](_0x072a('0x8'),attributes,{'tableName':_0x072a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a03=['SmsAccount','sms_accounts','lodash','util','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a03,0x80));var _0x38a0=function(_0x311f62,_0x161405){_0x311f62=_0x311f62-0x0;var _0x415751=_0x8a03[_0x311f62];return _0x415751;};'use strict';var _=require(_0x38a0('0x0'));var util=require(_0x38a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x38a0('0x2'));var BPromise=require('bluebird');var rp=require(_0x38a0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38a0('0x4'));var config=require(_0x38a0('0x5'));var attributes=require('./smsAccount.attributes');module[_0x38a0('0x6')]=function(_0x54d394,_0x41c619){return _0x54d394['define'](_0x38a0('0x7'),attributes,{'tableName':_0x38a0('0x8'),'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 b02e192..98a162f 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 _0x9a62=['jayson/promise','client','http','redis','socket.io-emitter','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','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4b6db3,_0x4bfef8){var _0x5797ff=function(_0x574adf){while(--_0x574adf){_0x4b6db3['push'](_0x4b6db3['shift']());}};_0x5797ff(++_0x4bfef8);}(_0x9a62,0x1a8));var _0x29a6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9a62[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x29a6('0x0'));var util=require(_0x29a6('0x1'));var moment=require(_0x29a6('0x2'));var BPromise=require(_0x29a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29a6('0x4'));var db=require(_0x29a6('0x5'))['db'];var utils=require(_0x29a6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29a6('0x7'));var jayson=require(_0x29a6('0x8'));var client=jayson[_0x29a6('0x9')][_0x29a6('0xa')]({'port':0x232a});config[_0x29a6('0xb')]=_['defaults'](config[_0x29a6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x29a6('0xc'))(new Redis(config[_0x29a6('0xb')]));require('./smsAccount.socket')[_0x29a6('0xd')](socket);function respondWithRpcPromise(_0x3a5d8b,_0x1e7395,_0x38f074){return new BPromise(function(_0x36ae76,_0x21a16c){return client[_0x29a6('0xe')](_0x3a5d8b,_0x38f074)[_0x29a6('0xf')](function(_0x594662){logger[_0x29a6('0x10')](_0x29a6('0x11'),_0x1e7395,'request\x20sent');logger['debug'](_0x29a6('0x12'),_0x1e7395,_0x29a6('0x13'),JSON[_0x29a6('0x14')](_0x594662));if(_0x594662[_0x29a6('0x15')]){if(_0x594662[_0x29a6('0x15')][_0x29a6('0x16')]===0x1f4){logger['error'](_0x29a6('0x11'),_0x1e7395,_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);return _0x21a16c(_0x594662['error']['message']);}logger[_0x29a6('0x15')](_0x29a6('0x11'),_0x1e7395,_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);return _0x36ae76(_0x594662[_0x29a6('0x15')][_0x29a6('0x17')]);}else{logger[_0x29a6('0x10')](_0x29a6('0x11'),_0x1e7395,'request\x20sent');_0x36ae76(_0x594662[_0x29a6('0x18')][_0x29a6('0x17')]);}})[_0x29a6('0x19')](function(_0x22ab8b){logger[_0x29a6('0x15')](_0x29a6('0x11'),_0x1e7395,_0x22ab8b);_0x21a16c(_0x22ab8b);});});}exports[_0x29a6('0x1a')]=function(_0x3e9e16){var _0x54ecd4=this;return new Promise(function(_0x7c9baf,_0x3cea11){return db[_0x29a6('0x1b')][_0x29a6('0x1c')]({'raw':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e9e16['options']?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x1f')]||null:null,'attributes':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16[_0x29a6('0x1d')][_0x29a6('0x20')]||null:null,'include':_0x3e9e16[_0x29a6('0x1d')]?_0x3e9e16['options'][_0x29a6('0x21')]?_[_0x29a6('0x22')](_0x3e9e16['options'][_0x29a6('0x21')],function(_0x2e5c8c){return{'model':db[_0x2e5c8c[_0x29a6('0x23')]],'as':_0x2e5c8c['as'],'attributes':_0x2e5c8c[_0x29a6('0x20')],'include':_0x2e5c8c['include']?_[_0x29a6('0x22')](_0x2e5c8c[_0x29a6('0x21')],function(_0x14abc1){return{'model':db[_0x14abc1[_0x29a6('0x23')]],'as':_0x14abc1['as'],'attributes':_0x14abc1[_0x29a6('0x20')],'include':_0x14abc1['include']?_['map'](_0x14abc1['include'],function(_0x3bdbcf){return{'model':db[_0x3bdbcf['model']],'as':_0x3bdbcf['as'],'attributes':_0x3bdbcf[_0x29a6('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30d98f){logger[_0x29a6('0x10')](_0x29a6('0x1a'),_0x3e9e16);logger['debug'](_0x29a6('0x1a'),_0x3e9e16,JSON[_0x29a6('0x14')](_0x30d98f));_0x7c9baf(_0x30d98f);})[_0x29a6('0x19')](function(_0x1fc82f){logger[_0x29a6('0x15')]('ShowSmsAccount',_0x1fc82f[_0x29a6('0x17')],_0x3e9e16);_0x3cea11(_0x54ecd4[_0x29a6('0x15')](0x1f4,_0x1fc82f['message']));});});}; \ No newline at end of file +var _0xcc53=['localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','find','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcc53,0x149));var _0x3cc5=function(_0x13745a,_0xc2eb33){_0x13745a=_0x13745a-0x0;var _0x488914=_0xcc53[_0x13745a];return _0x488914;};'use strict';var _=require(_0x3cc5('0x0'));var util=require(_0x3cc5('0x1'));var moment=require(_0x3cc5('0x2'));var BPromise=require(_0x3cc5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3cc5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3cc5('0x6'));var client=jayson[_0x3cc5('0x7')][_0x3cc5('0x8')]({'port':0x232a});config[_0x3cc5('0x9')]=_[_0x3cc5('0xa')](config[_0x3cc5('0x9')],{'host':_0x3cc5('0xb'),'port':0x18eb});var socket=require(_0x3cc5('0xc'))(new Redis(config[_0x3cc5('0x9')]));require('./smsAccount.socket')[_0x3cc5('0xd')](socket);function respondWithRpcPromise(_0x526bcf,_0x284e5b,_0x51e93e){return new BPromise(function(_0x1a0f27,_0x4a93ea){return client[_0x3cc5('0xe')](_0x526bcf,_0x51e93e)[_0x3cc5('0xf')](function(_0x200377){logger[_0x3cc5('0x10')](_0x3cc5('0x11'),_0x284e5b,_0x3cc5('0x12'));logger['debug'](_0x3cc5('0x13'),_0x284e5b,_0x3cc5('0x12'),JSON[_0x3cc5('0x14')](_0x200377));if(_0x200377[_0x3cc5('0x15')]){if(_0x200377[_0x3cc5('0x15')][_0x3cc5('0x16')]===0x1f4){logger['error'](_0x3cc5('0x11'),_0x284e5b,_0x200377[_0x3cc5('0x15')]['message']);return _0x4a93ea(_0x200377[_0x3cc5('0x15')][_0x3cc5('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x284e5b,_0x200377[_0x3cc5('0x15')][_0x3cc5('0x17')]);return _0x1a0f27(_0x200377[_0x3cc5('0x15')]['message']);}else{logger['info'](_0x3cc5('0x11'),_0x284e5b,_0x3cc5('0x12'));_0x1a0f27(_0x200377[_0x3cc5('0x18')][_0x3cc5('0x17')]);}})[_0x3cc5('0x19')](function(_0x53ee20){logger['error']('SmsAccount,\x20%s,\x20%s',_0x284e5b,_0x53ee20);_0x4a93ea(_0x53ee20);});});}exports[_0x3cc5('0x1a')]=function(_0x2d9d71){var _0x39e18b=this;return new Promise(function(_0x29fc2c,_0x3529d5){return db['SmsAccount'][_0x3cc5('0x1b')]({'raw':_0x2d9d71['options']?_0x2d9d71[_0x3cc5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2d9d71[_0x3cc5('0x1c')]?_0x2d9d71[_0x3cc5('0x1c')]['where']||null:null,'attributes':_0x2d9d71[_0x3cc5('0x1c')]?_0x2d9d71['options'][_0x3cc5('0x1d')]||null:null,'include':_0x2d9d71[_0x3cc5('0x1c')]?_0x2d9d71[_0x3cc5('0x1c')][_0x3cc5('0x1e')]?_[_0x3cc5('0x1f')](_0x2d9d71['options'][_0x3cc5('0x1e')],function(_0x4dd4e4){return{'model':db[_0x4dd4e4[_0x3cc5('0x20')]],'as':_0x4dd4e4['as'],'attributes':_0x4dd4e4[_0x3cc5('0x1d')],'include':_0x4dd4e4['include']?_[_0x3cc5('0x1f')](_0x4dd4e4['include'],function(_0x48a04e){return{'model':db[_0x48a04e['model']],'as':_0x48a04e['as'],'attributes':_0x48a04e[_0x3cc5('0x1d')],'include':_0x48a04e[_0x3cc5('0x1e')]?_['map'](_0x48a04e['include'],function(_0xb63929){return{'model':db[_0xb63929[_0x3cc5('0x20')]],'as':_0xb63929['as'],'attributes':_0xb63929['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b750c){logger['info'](_0x3cc5('0x1a'),_0x2d9d71);logger[_0x3cc5('0x21')](_0x3cc5('0x1a'),_0x2d9d71,JSON['stringify'](_0x3b750c));_0x29fc2c(_0x3b750c);})[_0x3cc5('0x19')](function(_0x4fa01a){logger['error'](_0x3cc5('0x1a'),_0x4fa01a[_0x3cc5('0x17')],_0x2d9d71);_0x3529d5(_0x39e18b['error'](0x1f4,_0x4fa01a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e002386..0fcf1b3 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(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 02fbc7a..4ba876a 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x430207,_0x56998c){var _0x202b7d=function(_0x559e81){while(--_0x559e81){_0x430207['push'](_0x430207['shift']());}};_0x202b7d(++_0x56998c);}(_0xedd9,0xfc));var _0x9edd=function(_0x2c35ee,_0x50630c){_0x2c35ee=_0x2c35ee-0x0;var _0x2bb24f=_0xedd9[_0x2c35ee];return _0x2bb24f;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x48557f,_0x4e1379){var _0x1f7a5b=function(_0x548d61){while(--_0x548d61){_0x48557f['push'](_0x48557f['shift']());}};_0x1f7a5b(++_0x4e1379);}(_0xedd9,0xfc));var _0x9edd=function(_0x58d31b,_0xbbe2da){_0x58d31b=_0x58d31b-0x0;var _0x1a95da=_0xedd9[_0x58d31b];return _0x1a95da;};'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('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 237efa7..d577aed 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 _0x1a90=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x52c076,_0x3adfa7){var _0x10fb4a=function(_0x5e324e){while(--_0x5e324e){_0x52c076['push'](_0x52c076['shift']());}};_0x10fb4a(++_0x3adfa7);}(_0x1a90,0xe7));var _0x01a9=function(_0x1ac278,_0x516547){_0x1ac278=_0x1ac278-0x0;var _0x4773de=_0x1a90[_0x1ac278];return _0x4773de;};'use strict';var Sequelize=require(_0x01a9('0x0'));module[_0x01a9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x01a9('0x2')],'allowNull':![],'defaultValue':_0x01a9('0x3')},'appdata':{'type':Sequelize[_0x01a9('0x4')]()},'description':{'type':Sequelize[_0x01a9('0x2')]},'interval':{'type':Sequelize[_0x01a9('0x2')],'defaultValue':_0x01a9('0x5')}}; \ No newline at end of file +var _0x2214=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x195270,_0x412abb){var _0x5398dd=function(_0x1deab2){while(--_0x1deab2){_0x195270['push'](_0x195270['shift']());}};_0x5398dd(++_0x412abb);}(_0x2214,0x193));var _0x4221=function(_0x18e2c2,_0x22aef6){_0x18e2c2=_0x18e2c2-0x0;var _0x24da9c=_0x2214[_0x18e2c2];return _0x24da9c;};'use strict';var Sequelize=require(_0x4221('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4221('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4221('0x2')],'allowNull':![],'defaultValue':_0x4221('0x3')},'appdata':{'type':Sequelize[_0x4221('0x4')]()},'description':{'type':Sequelize[_0x4221('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4221('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 491618c..edac4e5 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 _0xce17=['findAll','show','params','find','create','body','catch','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xce17,0x1d5));var _0x7ce1=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xce17[_0x1b8d87];return _0x182b74;};'use strict';var emlformat=require(_0x7ce1('0x0'));var rimraf=require(_0x7ce1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ce1('0x2'));var moment=require('moment');var BPromise=require(_0x7ce1('0x3'));var Mustache=require(_0x7ce1('0x4'));var util=require(_0x7ce1('0x5'));var path=require(_0x7ce1('0x6'));var sox=require(_0x7ce1('0x7'));var csv=require(_0x7ce1('0x8'));var ejs=require(_0x7ce1('0x9'));var fs=require('fs');var fs_extra=require(_0x7ce1('0xa'));var _=require(_0x7ce1('0xb'));var squel=require('squel');var crypto=require(_0x7ce1('0xc'));var jsforce=require(_0x7ce1('0xd'));var deskjs=require(_0x7ce1('0xe'));var toCsv=require(_0x7ce1('0x8'));var querystring=require(_0x7ce1('0xf'));var Papa=require(_0x7ce1('0x10'));var Redis=require(_0x7ce1('0x11'));var authService=require(_0x7ce1('0x12'));var qs=require(_0x7ce1('0x13'));var as=require(_0x7ce1('0x14'));var hardwareService=require(_0x7ce1('0x15'));var logger=require(_0x7ce1('0x16'))(_0x7ce1('0x17'));var utils=require('../../config/utils');var config=require(_0x7ce1('0x18'));var licenseUtil=require(_0x7ce1('0x19'));var db=require(_0x7ce1('0x1a'))['db'];function respondWithStatusCode(_0x537c65,_0x4f132f){_0x4f132f=_0x4f132f||0xcc;return function(_0x4f19fd){if(_0x4f19fd){return _0x537c65[_0x7ce1('0x1b')](_0x4f132f);}return _0x537c65[_0x7ce1('0x1c')](_0x4f132f)[_0x7ce1('0x1d')]();};}function respondWithResult(_0x5b5bda,_0x39a44d){_0x39a44d=_0x39a44d||0xc8;return function(_0x285cf9){if(_0x285cf9){return _0x5b5bda[_0x7ce1('0x1c')](_0x39a44d)[_0x7ce1('0x1e')](_0x285cf9);}};}function respondWithFilteredResult(_0x425197,_0x4421de){return function(_0x15723d){if(_0x15723d){var _0x109249=typeof _0x4421de[_0x7ce1('0x1f')]===_0x7ce1('0x20')&&typeof _0x4421de[_0x7ce1('0x21')]===_0x7ce1('0x20');var _0x391975=_0x15723d['count'];var _0x170d99=_0x109249?0x0:_0x4421de['offset'];var _0x26d417=_0x109249?_0x15723d[_0x7ce1('0x22')]:_0x4421de[_0x7ce1('0x1f')]+_0x4421de['limit'];var _0x18b01f;if(_0x26d417>=_0x391975){_0x26d417=_0x391975;_0x18b01f=0xc8;}else{_0x18b01f=0xce;}_0x425197[_0x7ce1('0x1c')](_0x18b01f);return _0x425197[_0x7ce1('0x23')]('Content-Range',_0x170d99+'-'+_0x26d417+'/'+_0x391975)[_0x7ce1('0x1e')](_0x15723d);}return null;};}function patchUpdates(_0x424b03){return function(_0x3245cc){try{jsonpatch[_0x7ce1('0x24')](_0x3245cc,_0x424b03,!![]);}catch(_0x5314bb){return BPromise['reject'](_0x5314bb);}return _0x3245cc[_0x7ce1('0x25')]();};}function saveUpdates(_0x96936a,_0x3fc265){return function(_0x2cc6bc){if(_0x2cc6bc){return _0x2cc6bc[_0x7ce1('0x26')](_0x96936a)[_0x7ce1('0x27')](function(_0x12c7ae){return _0x12c7ae;});}return null;};}function removeEntity(_0x3b2273,_0x3cf280){return function(_0x1da67f){if(_0x1da67f){return _0x1da67f[_0x7ce1('0x28')]()[_0x7ce1('0x27')](function(){_0x3b2273[_0x7ce1('0x1c')](0xcc)[_0x7ce1('0x1d')]();});}};}function handleEntityNotFound(_0x481c55,_0x1ca99c){return function(_0x400cd5){if(!_0x400cd5){_0x481c55['sendStatus'](0x194);}return _0x400cd5;};}function handleError(_0x2a9b57,_0x58bbed){_0x58bbed=_0x58bbed||0x1f4;return function(_0x39a2fc){logger[_0x7ce1('0x29')](_0x39a2fc[_0x7ce1('0x2a')]);if(_0x39a2fc[_0x7ce1('0x2b')]){delete _0x39a2fc[_0x7ce1('0x2b')];}_0x2a9b57[_0x7ce1('0x1c')](_0x58bbed)[_0x7ce1('0x2c')](_0x39a2fc);};}exports[_0x7ce1('0x2d')]=function(_0x1778ff,_0x1fe603){var _0x203ece={},_0x3ca2fa={},_0x25c508={'count':0x0,'rows':[]};var _0x6f64d4=_[_0x7ce1('0x2e')](db[_0x7ce1('0x2f')][_0x7ce1('0x30')],function(_0x111c53){return{'name':_0x111c53[_0x7ce1('0x31')],'type':_0x111c53['type'][_0x7ce1('0x32')]};});_0x3ca2fa['model']=_['map'](_0x6f64d4,_0x7ce1('0x2b'));_0x3ca2fa['query']=_[_0x7ce1('0x33')](_0x1778ff[_0x7ce1('0x34')]);_0x3ca2fa[_0x7ce1('0x35')]=_['intersection'](_0x3ca2fa[_0x7ce1('0x36')],_0x3ca2fa['query']);_0x203ece['attributes']=_[_0x7ce1('0x37')](_0x3ca2fa[_0x7ce1('0x36')],qs[_0x7ce1('0x38')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x38')]));_0x203ece[_0x7ce1('0x39')]=_0x203ece['attributes'][_0x7ce1('0x3a')]?_0x203ece[_0x7ce1('0x39')]:_0x3ca2fa['model'];if(!_0x1778ff[_0x7ce1('0x34')]['hasOwnProperty'](_0x7ce1('0x3b'))){_0x203ece[_0x7ce1('0x21')]=qs[_0x7ce1('0x21')](_0x1778ff['query'][_0x7ce1('0x21')]);_0x203ece[_0x7ce1('0x1f')]=qs[_0x7ce1('0x1f')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x1f')]);}_0x203ece[_0x7ce1('0x3c')]=qs[_0x7ce1('0x3d')](_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x3d')]);_0x203ece[_0x7ce1('0x3e')]=qs[_0x7ce1('0x35')](_[_0x7ce1('0x3f')](_0x1778ff[_0x7ce1('0x34')],_0x3ca2fa[_0x7ce1('0x35')]),_0x6f64d4);if(_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x40')]){_0x203ece[_0x7ce1('0x3e')]=_[_0x7ce1('0x41')](_0x203ece[_0x7ce1('0x3e')],{'$or':_['map'](_0x6f64d4,function(_0x4a00c0){if(_0x4a00c0[_0x7ce1('0x42')]!=='VIRTUAL'){var _0x47f17b={};_0x47f17b[_0x4a00c0[_0x7ce1('0x2b')]]={'$like':'%'+_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x40')]+'%'};return _0x47f17b;}})});}_0x203ece=_[_0x7ce1('0x41')]({},_0x203ece,_0x1778ff[_0x7ce1('0x43')]);var _0x557670={'where':_0x203ece['where']};return db[_0x7ce1('0x2f')][_0x7ce1('0x22')](_0x557670)[_0x7ce1('0x27')](function(_0x22274d){_0x25c508[_0x7ce1('0x22')]=_0x22274d;if(_0x1778ff[_0x7ce1('0x34')][_0x7ce1('0x44')]){_0x203ece[_0x7ce1('0x45')]=[{'all':!![]}];}return db['SmsApplication'][_0x7ce1('0x46')](_0x203ece);})['then'](function(_0x58279e){_0x25c508['rows']=_0x58279e;return _0x25c508;})['then'](respondWithFilteredResult(_0x1fe603,_0x203ece))['catch'](handleError(_0x1fe603,null));};exports[_0x7ce1('0x47')]=function(_0x5097e9,_0x1410de){var _0x10fff0={'raw':!![],'where':{'id':_0x5097e9[_0x7ce1('0x48')]['id']}},_0x42a2d8={};_0x42a2d8[_0x7ce1('0x36')]=_[_0x7ce1('0x33')](db[_0x7ce1('0x2f')][_0x7ce1('0x30')]);_0x42a2d8[_0x7ce1('0x34')]=_[_0x7ce1('0x33')](_0x5097e9['query']);_0x42a2d8['filters']=_[_0x7ce1('0x37')](_0x42a2d8[_0x7ce1('0x36')],_0x42a2d8['query']);_0x10fff0['attributes']=_['intersection'](_0x42a2d8[_0x7ce1('0x36')],qs[_0x7ce1('0x38')](_0x5097e9[_0x7ce1('0x34')][_0x7ce1('0x38')]));_0x10fff0[_0x7ce1('0x39')]=_0x10fff0['attributes'][_0x7ce1('0x3a')]?_0x10fff0[_0x7ce1('0x39')]:_0x42a2d8[_0x7ce1('0x36')];if(_0x5097e9[_0x7ce1('0x34')][_0x7ce1('0x44')]){_0x10fff0[_0x7ce1('0x45')]=[{'all':!![]}];}_0x10fff0=_[_0x7ce1('0x41')]({},_0x10fff0,_0x5097e9[_0x7ce1('0x43')]);return db[_0x7ce1('0x2f')][_0x7ce1('0x49')](_0x10fff0)[_0x7ce1('0x27')](handleEntityNotFound(_0x1410de,null))[_0x7ce1('0x27')](respondWithResult(_0x1410de,null))['catch'](handleError(_0x1410de,null));};exports[_0x7ce1('0x4a')]=function(_0x31965a,_0x212b21){return db[_0x7ce1('0x2f')][_0x7ce1('0x4a')](_0x31965a[_0x7ce1('0x4b')],{})['then'](respondWithResult(_0x212b21,0xc9))[_0x7ce1('0x4c')](handleError(_0x212b21,null));};exports['update']=function(_0x59dcb0,_0x4f4c65){if(_0x59dcb0[_0x7ce1('0x4b')]['id']){delete _0x59dcb0[_0x7ce1('0x4b')]['id'];}return db[_0x7ce1('0x2f')][_0x7ce1('0x49')]({'where':{'id':_0x59dcb0[_0x7ce1('0x48')]['id']}})[_0x7ce1('0x27')](handleEntityNotFound(_0x4f4c65,null))['then'](saveUpdates(_0x59dcb0[_0x7ce1('0x4b')],null))['then'](respondWithResult(_0x4f4c65,null))[_0x7ce1('0x4c')](handleError(_0x4f4c65,null));};exports[_0x7ce1('0x28')]=function(_0x337780,_0x5c91d1){return db[_0x7ce1('0x2f')][_0x7ce1('0x49')]({'where':{'id':_0x337780[_0x7ce1('0x48')]['id']}})[_0x7ce1('0x27')](handleEntityNotFound(_0x5c91d1,null))[_0x7ce1('0x27')](removeEntity(_0x5c91d1,null))[_0x7ce1('0x4c')](handleError(_0x5c91d1,null));}; \ No newline at end of file +var _0x2c9e=['VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c9e,0xa4));var _0xe2c9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2c9e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xe2c9('0x0'));var rimraf=require(_0xe2c9('0x1'));var zipdir=require(_0xe2c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2c9('0x3'));var moment=require(_0xe2c9('0x4'));var BPromise=require(_0xe2c9('0x5'));var Mustache=require(_0xe2c9('0x6'));var util=require(_0xe2c9('0x7'));var path=require(_0xe2c9('0x8'));var sox=require('sox');var csv=require(_0xe2c9('0x9'));var ejs=require(_0xe2c9('0xa'));var fs=require('fs');var fs_extra=require(_0xe2c9('0xb'));var _=require('lodash');var squel=require(_0xe2c9('0xc'));var crypto=require('crypto');var jsforce=require(_0xe2c9('0xd'));var deskjs=require(_0xe2c9('0xe'));var toCsv=require(_0xe2c9('0x9'));var querystring=require(_0xe2c9('0xf'));var Papa=require(_0xe2c9('0x10'));var Redis=require(_0xe2c9('0x11'));var authService=require(_0xe2c9('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe2c9('0x13'));var logger=require(_0xe2c9('0x14'))(_0xe2c9('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe2c9('0x16'));var db=require(_0xe2c9('0x17'))['db'];function respondWithStatusCode(_0x267609,_0x1b9f82){_0x1b9f82=_0x1b9f82||0xcc;return function(_0x48c9a4){if(_0x48c9a4){return _0x267609[_0xe2c9('0x18')](_0x1b9f82);}return _0x267609['status'](_0x1b9f82)['end']();};}function respondWithResult(_0x5843ad,_0x19395d){_0x19395d=_0x19395d||0xc8;return function(_0x2e3304){if(_0x2e3304){return _0x5843ad['status'](_0x19395d)[_0xe2c9('0x19')](_0x2e3304);}};}function respondWithFilteredResult(_0x182dd3,_0x2ce967){return function(_0x162868){if(_0x162868){var _0x470f4c=typeof _0x2ce967[_0xe2c9('0x1a')]===_0xe2c9('0x1b')&&typeof _0x2ce967[_0xe2c9('0x1c')]===_0xe2c9('0x1b');var _0x26f52e=_0x162868[_0xe2c9('0x1d')];var _0x3915a9=_0x470f4c?0x0:_0x2ce967[_0xe2c9('0x1a')];var _0x3ea1e2=_0x470f4c?_0x162868[_0xe2c9('0x1d')]:_0x2ce967[_0xe2c9('0x1a')]+_0x2ce967[_0xe2c9('0x1c')];var _0x373bc2;if(_0x3ea1e2>=_0x26f52e){_0x3ea1e2=_0x26f52e;_0x373bc2=0xc8;}else{_0x373bc2=0xce;}_0x182dd3[_0xe2c9('0x1e')](_0x373bc2);return _0x182dd3[_0xe2c9('0x1f')](_0xe2c9('0x20'),_0x3915a9+'-'+_0x3ea1e2+'/'+_0x26f52e)[_0xe2c9('0x19')](_0x162868);}return null;};}function patchUpdates(_0x382c13){return function(_0x5ddf8b){try{jsonpatch['apply'](_0x5ddf8b,_0x382c13,!![]);}catch(_0x2dd36a){return BPromise[_0xe2c9('0x21')](_0x2dd36a);}return _0x5ddf8b[_0xe2c9('0x22')]();};}function saveUpdates(_0x263a74,_0x3bcd4c){return function(_0x52af78){if(_0x52af78){return _0x52af78[_0xe2c9('0x23')](_0x263a74)[_0xe2c9('0x24')](function(_0x269d7b){return _0x269d7b;});}return null;};}function removeEntity(_0x122412,_0x4e35e3){return function(_0x3be775){if(_0x3be775){return _0x3be775['destroy']()['then'](function(){_0x122412[_0xe2c9('0x1e')](0xcc)[_0xe2c9('0x25')]();});}};}function handleEntityNotFound(_0x536c54,_0xf80f99){return function(_0x575700){if(!_0x575700){_0x536c54[_0xe2c9('0x18')](0x194);}return _0x575700;};}function handleError(_0x3f067a,_0x1fb118){_0x1fb118=_0x1fb118||0x1f4;return function(_0x512242){logger[_0xe2c9('0x26')](_0x512242[_0xe2c9('0x27')]);if(_0x512242[_0xe2c9('0x28')]){delete _0x512242[_0xe2c9('0x28')];}_0x3f067a[_0xe2c9('0x1e')](_0x1fb118)[_0xe2c9('0x29')](_0x512242);};}exports[_0xe2c9('0x2a')]=function(_0x37a657,_0x4fcf82){var _0x56567e={},_0x30f312={},_0x38221d={'count':0x0,'rows':[]};var _0x2dee00=_[_0xe2c9('0x2b')](db[_0xe2c9('0x2c')][_0xe2c9('0x2d')],function(_0x1e04e1){return{'name':_0x1e04e1[_0xe2c9('0x2e')],'type':_0x1e04e1[_0xe2c9('0x2f')]['key']};});_0x30f312[_0xe2c9('0x30')]=_[_0xe2c9('0x2b')](_0x2dee00,_0xe2c9('0x28'));_0x30f312['query']=_[_0xe2c9('0x31')](_0x37a657['query']);_0x30f312[_0xe2c9('0x32')]=_[_0xe2c9('0x33')](_0x30f312[_0xe2c9('0x30')],_0x30f312[_0xe2c9('0x34')]);_0x56567e[_0xe2c9('0x35')]=_[_0xe2c9('0x33')](_0x30f312['model'],qs['fields'](_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x36')]));_0x56567e[_0xe2c9('0x35')]=_0x56567e[_0xe2c9('0x35')][_0xe2c9('0x37')]?_0x56567e[_0xe2c9('0x35')]:_0x30f312[_0xe2c9('0x30')];if(!_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x38')]('nolimit')){_0x56567e['limit']=qs[_0xe2c9('0x1c')](_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x1c')]);_0x56567e[_0xe2c9('0x1a')]=qs[_0xe2c9('0x1a')](_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x1a')]);}_0x56567e[_0xe2c9('0x39')]=qs['sort'](_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x3a')]);_0x56567e[_0xe2c9('0x3b')]=qs['filters'](_['pick'](_0x37a657[_0xe2c9('0x34')],_0x30f312[_0xe2c9('0x32')]),_0x2dee00);if(_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x3c')]){_0x56567e[_0xe2c9('0x3b')]=_['merge'](_0x56567e[_0xe2c9('0x3b')],{'$or':_[_0xe2c9('0x2b')](_0x2dee00,function(_0x2cdd1b){if(_0x2cdd1b[_0xe2c9('0x2f')]!==_0xe2c9('0x3d')){var _0xd0c99a={};_0xd0c99a[_0x2cdd1b[_0xe2c9('0x28')]]={'$like':'%'+_0x37a657[_0xe2c9('0x34')][_0xe2c9('0x3c')]+'%'};return _0xd0c99a;}})});}_0x56567e=_[_0xe2c9('0x3e')]({},_0x56567e,_0x37a657[_0xe2c9('0x3f')]);var _0xf2dfac={'where':_0x56567e['where']};return db[_0xe2c9('0x2c')]['count'](_0xf2dfac)[_0xe2c9('0x24')](function(_0x3576cf){_0x38221d[_0xe2c9('0x1d')]=_0x3576cf;if(_0x37a657[_0xe2c9('0x34')]['includeAll']){_0x56567e[_0xe2c9('0x40')]=[{'all':!![]}];}return db[_0xe2c9('0x2c')][_0xe2c9('0x41')](_0x56567e);})['then'](function(_0x180f5b){_0x38221d[_0xe2c9('0x42')]=_0x180f5b;return _0x38221d;})[_0xe2c9('0x24')](respondWithFilteredResult(_0x4fcf82,_0x56567e))['catch'](handleError(_0x4fcf82,null));};exports[_0xe2c9('0x43')]=function(_0x2aa204,_0x59a043){var _0x3172aa={'raw':!![],'where':{'id':_0x2aa204[_0xe2c9('0x44')]['id']}},_0x54cf65={};_0x54cf65[_0xe2c9('0x30')]=_[_0xe2c9('0x31')](db[_0xe2c9('0x2c')][_0xe2c9('0x2d')]);_0x54cf65[_0xe2c9('0x34')]=_[_0xe2c9('0x31')](_0x2aa204[_0xe2c9('0x34')]);_0x54cf65[_0xe2c9('0x32')]=_[_0xe2c9('0x33')](_0x54cf65[_0xe2c9('0x30')],_0x54cf65[_0xe2c9('0x34')]);_0x3172aa['attributes']=_['intersection'](_0x54cf65[_0xe2c9('0x30')],qs['fields'](_0x2aa204[_0xe2c9('0x34')][_0xe2c9('0x36')]));_0x3172aa[_0xe2c9('0x35')]=_0x3172aa[_0xe2c9('0x35')][_0xe2c9('0x37')]?_0x3172aa[_0xe2c9('0x35')]:_0x54cf65['model'];if(_0x2aa204[_0xe2c9('0x34')][_0xe2c9('0x45')]){_0x3172aa[_0xe2c9('0x40')]=[{'all':!![]}];}_0x3172aa=_['merge']({},_0x3172aa,_0x2aa204[_0xe2c9('0x3f')]);return db['SmsApplication'][_0xe2c9('0x46')](_0x3172aa)['then'](handleEntityNotFound(_0x59a043,null))[_0xe2c9('0x24')](respondWithResult(_0x59a043,null))[_0xe2c9('0x47')](handleError(_0x59a043,null));};exports[_0xe2c9('0x48')]=function(_0x2cd430,_0x2b27d9){return db[_0xe2c9('0x2c')]['create'](_0x2cd430[_0xe2c9('0x49')],{})['then'](respondWithResult(_0x2b27d9,0xc9))['catch'](handleError(_0x2b27d9,null));};exports[_0xe2c9('0x23')]=function(_0x486d10,_0x293536){if(_0x486d10[_0xe2c9('0x49')]['id']){delete _0x486d10[_0xe2c9('0x49')]['id'];}return db[_0xe2c9('0x2c')][_0xe2c9('0x46')]({'where':{'id':_0x486d10['params']['id']}})[_0xe2c9('0x24')](handleEntityNotFound(_0x293536,null))[_0xe2c9('0x24')](saveUpdates(_0x486d10[_0xe2c9('0x49')],null))[_0xe2c9('0x24')](respondWithResult(_0x293536,null))['catch'](handleError(_0x293536,null));};exports[_0xe2c9('0x4a')]=function(_0x23c6f2,_0x446444){return db['SmsApplication'][_0xe2c9('0x46')]({'where':{'id':_0x23c6f2['params']['id']}})['then'](handleEntityNotFound(_0x446444,null))[_0xe2c9('0x24')](removeEntity(_0x446444,null))['catch'](handleError(_0x446444,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ab51799..dc599b9 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 _0xe570=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','util','api'];(function(_0x40d3dd,_0x4087e9){var _0x340823=function(_0x15b6c9){while(--_0x15b6c9){_0x40d3dd['push'](_0x40d3dd['shift']());}};_0x340823(++_0x4087e9);}(_0xe570,0x1ab));var _0x0e57=function(_0x514e5d,_0x5ddd58){_0x514e5d=_0x514e5d-0x0;var _0xd419df=_0xe570[_0x514e5d];return _0xd419df;};'use strict';var _=require('lodash');var util=require(_0x0e57('0x0'));var logger=require('../../config/logger')(_0x0e57('0x1'));var moment=require(_0x0e57('0x2'));var BPromise=require(_0x0e57('0x3'));var rp=require(_0x0e57('0x4'));var fs=require('fs');var path=require(_0x0e57('0x5'));var rimraf=require(_0x0e57('0x6'));var config=require(_0x0e57('0x7'));var attributes=require(_0x0e57('0x8'));module['exports']=function(_0x5baf45,_0x26111d){return _0x5baf45[_0x0e57('0x9')](_0x0e57('0xa'),attributes,{'tableName':_0x0e57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0e57('0xc')});}; \ No newline at end of file +var _0xd481=['SmsApplication','utf8mb4','util','../../config/logger','moment','bluebird','path','exports','define'];(function(_0xe0f744,_0x3055e8){var _0x53c0c7=function(_0x23b31e){while(--_0x23b31e){_0xe0f744['push'](_0xe0f744['shift']());}};_0x53c0c7(++_0x3055e8);}(_0xd481,0x197));var _0x1d48=function(_0x1502a7,_0x1405af){_0x1502a7=_0x1502a7-0x0;var _0x59ab25=_0xd481[_0x1502a7];return _0x59ab25;};'use strict';var _=require('lodash');var util=require(_0x1d48('0x0'));var logger=require(_0x1d48('0x1'))('api');var moment=require(_0x1d48('0x2'));var BPromise=require(_0x1d48('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d48('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x1d48('0x5')]=function(_0x2aba91,_0x402707){return _0x2aba91[_0x1d48('0x6')](_0x1d48('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d48('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c79c7f2..4b509a4 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 _0xa5c1=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x5b2152,_0x523a7c){_0x5b2152=_0x5b2152-0x0;var _0x29af49=_0xa5c1[_0x5b2152];return _0x29af49;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var moment=require(_0x1a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a5c('0x4'));var logger=require(_0x1a5c('0x5'))(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var jayson=require(_0x1a5c('0x8'));var client=jayson[_0x1a5c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9853,_0x580a2e,_0x438f8f){return new BPromise(function(_0x43a2ed,_0x1702ce){return client['request'](_0x9853,_0x438f8f)[_0x1a5c('0xa')](function(_0x4c0bd2){logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x580a2e,'request\x20sent',JSON[_0x1a5c('0xf')](_0x4c0bd2));if(_0x4c0bd2[_0x1a5c('0x10')]){if(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x11')]===0x1f4){logger[_0x1a5c('0x10')](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x1702ce(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}logger['error'](_0x1a5c('0xc'),_0x580a2e,_0x4c0bd2[_0x1a5c('0x10')]['message']);return _0x43a2ed(_0x4c0bd2[_0x1a5c('0x10')][_0x1a5c('0x12')]);}else{logger[_0x1a5c('0xb')](_0x1a5c('0xc'),_0x580a2e,'request\x20sent');_0x43a2ed(_0x4c0bd2[_0x1a5c('0x13')]['message']);}})[_0x1a5c('0x14')](function(_0x44648a){logger[_0x1a5c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x580a2e,_0x44648a);_0x1702ce(_0x44648a);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x9fc285,_0x43d9f1){var _0x3df0f9=function(_0x557bc5){while(--_0x557bc5){_0x9fc285['push'](_0x9fc285['shift']());}};_0x3df0f9(++_0x43d9f1);}(_0xd943,0x15d));var _0x3d94=function(_0x32b216,_0x4b8418){_0x32b216=_0x32b216-0x0;var _0x36c86a=_0xd943[_0x32b216];return _0x36c86a;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c23b8d3..3a2cf45 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 _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x4f986d,_0x1b176a){var _0x57609c=function(_0x3946bf){while(--_0x3946bf){_0x4f986d['push'](_0x4f986d['shift']());}};_0x57609c(++_0x1b176a);}(_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('./smsInteraction.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('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0xb43d1b,_0x3935cf){var _0x4aafca=function(_0x3b26d2){while(--_0x3b26d2){_0xb43d1b['push'](_0xb43d1b['shift']());}};_0x4aafca(++_0x3935cf);}(_0x34b7,0x196));var _0x734b=function(_0x224dda,_0x16d0f9){_0x224dda=_0x224dda-0x0;var _0x2987ac=_0x34b7[_0x224dda];return _0x2987ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 269c023..718f4ea 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 _0x8d0a=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x595734,_0x2880c7){var _0x14e1a4=function(_0x38320d){while(--_0x38320d){_0x595734['push'](_0x595734['shift']());}};_0x14e1a4(++_0x2880c7);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3b0242,_0x29d44b){_0x3b0242=_0x3b0242-0x0;var _0xd10fd4=_0x8d0a[_0x3b0242];return _0xd10fd4;};'use strict';var Sequelize=require(_0xa8d0('0x0'));var moment=require('moment');module[_0xa8d0('0x1')]={'closed':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8d0('0x3')]},'disposition':{'type':Sequelize[_0xa8d0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'note':{'type':Sequelize[_0xa8d0('0x4')]},'phone':{'type':Sequelize[_0xa8d0('0x4')]},'read1stAt':{'type':Sequelize[_0xa8d0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8d0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa8d0('0x6')]('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7a08=['moment','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x2cf493,_0x2fe293){var _0x135214=function(_0x5c1e54){while(--_0x5c1e54){_0x2cf493['push'](_0x2cf493['shift']());}};_0x135214(++_0x2fe293);}(_0x7a08,0x11e));var _0x87a0=function(_0x277c93,_0x33a8bb){_0x277c93=_0x277c93-0x0;var _0x1bc988=_0x7a08[_0x277c93];return _0x1bc988;};'use strict';var Sequelize=require(_0x87a0('0x0'));var moment=require(_0x87a0('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87a0('0x2')]},'disposition':{'type':Sequelize[_0x87a0('0x3')]},'secondDisposition':{'type':Sequelize[_0x87a0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x87a0('0x3')]},'note':{'type':Sequelize[_0x87a0('0x3')]},'phone':{'type':Sequelize[_0x87a0('0x3')]},'read1stAt':{'type':Sequelize[_0x87a0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x87a0('0x4')]('in',_0x87a0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x87a0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x87a0('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x87a0('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 715719b..df03eb1 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 _0xc353=['ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','findAll','query','user','catch','params','model','keys','filters','intersection','fields','attributes','includeAll','include','create','body','find','describe','addMessage','SmsMessage','ids','omit','length','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','Messages','createdAt','direction','read','SmsAccount','Owner','mkdirSync','Account','closed','closedAt','disposition','System','lastName','value','renderFile','views','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','moment','bluebird','path'];(function(_0x20d3b7,_0x417e95){var _0x2a81e4=function(_0xe38caf){while(--_0xe38caf){_0x20d3b7['push'](_0x20d3b7['shift']());}};_0x2a81e4(++_0x417e95);}(_0xc353,0x75));var _0x3c35=function(_0x2f26a3,_0x36da6d){_0x2f26a3=_0x2f26a3-0x0;var _0x169e9=_0xc353[_0x2f26a3];return _0x169e9;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x3c35('0x0'));var BPromise=require(_0x3c35('0x1'));var util=require('util');var path=require(_0x3c35('0x2'));var ejs=require(_0x3c35('0x3'));var fs=require('fs');var _=require(_0x3c35('0x4'));var Redis=require(_0x3c35('0x5'));var interaction=require(_0x3c35('0x6'));var qs=require(_0x3c35('0x7'));var pdf=require(_0x3c35('0x8'));var logger=require(_0x3c35('0x9'))(_0x3c35('0xa'));var config=require(_0x3c35('0xb'));var db=require(_0x3c35('0xc'))['db'];config['redis']=_[_0x3c35('0xd')](config[_0x3c35('0xe')],{'host':_0x3c35('0xf'),'port':0x18eb});var socket=require(_0x3c35('0x10'))(new Redis(config['redis']));require(_0x3c35('0x11'))[_0x3c35('0x12')](socket);function respondWithStatusCode(_0x2f5bcb,_0x1f64d0){_0x1f64d0=_0x1f64d0||0xcc;return function(_0x2ee9da){if(_0x2ee9da){return _0x2f5bcb['sendStatus'](_0x1f64d0);}return _0x2f5bcb[_0x3c35('0x13')](_0x1f64d0)[_0x3c35('0x14')]();};}function respondWithResult(_0x5f15ab,_0x37cb46){_0x37cb46=_0x37cb46||0xc8;return function(_0x5e78f3){if(_0x5e78f3){return _0x5f15ab['status'](_0x37cb46)[_0x3c35('0x15')](_0x5e78f3);}};}function respondWithFilteredResult(_0xd051f3,_0x148aaf){return function(_0x41dc38){if(_0x41dc38){var _0x2df9db=typeof _0x148aaf[_0x3c35('0x16')]===_0x3c35('0x17')&&typeof _0x148aaf['limit']===_0x3c35('0x17');var _0x4c359a=_0x41dc38[_0x3c35('0x18')];var _0x282cea=_0x2df9db?0x0:_0x148aaf[_0x3c35('0x16')];var _0x3e9d61=_0x2df9db?_0x41dc38[_0x3c35('0x18')]:_0x148aaf['offset']+_0x148aaf[_0x3c35('0x19')];var _0x1911f9;if(_0x3e9d61>=_0x4c359a){_0x3e9d61=_0x4c359a;_0x1911f9=0xc8;}else{_0x1911f9=0xce;}_0xd051f3[_0x3c35('0x13')](_0x1911f9);return _0xd051f3[_0x3c35('0x1a')]('Content-Range',_0x282cea+'-'+_0x3e9d61+'/'+_0x4c359a)['json'](_0x41dc38);}return null;};}function saveUpdates(_0x11d373){return function(_0x468994){if(_0x468994){return _0x468994[_0x3c35('0x1b')](_0x11d373)[_0x3c35('0x1c')](function(_0x4f12df){return _0x4f12df;});}return null;};}function removeEntity(_0xa1ce80){return function(_0x1d1c87){if(_0x1d1c87){return _0x1d1c87[_0x3c35('0x1d')]()[_0x3c35('0x1c')](function(){_0xa1ce80[_0x3c35('0x13')](0xcc)[_0x3c35('0x14')]();});}};}function handleEntityNotFound(_0x1bb1ee){return function(_0x4b232a){if(!_0x4b232a){_0x1bb1ee[_0x3c35('0x1e')](0x194);}return _0x4b232a;};}function handleError(_0x2a71a6,_0xdcac1c){_0xdcac1c=_0xdcac1c||0x1f4;return function(_0x3e3ad0){logger[_0x3c35('0x1f')](_0x3e3ad0[_0x3c35('0x20')]);if(_0x3e3ad0[_0x3c35('0x21')]){delete _0x3e3ad0[_0x3c35('0x21')];}_0x2a71a6[_0x3c35('0x13')](_0xdcac1c)[_0x3c35('0x22')](_0x3e3ad0);};}exports[_0x3c35('0x23')]=function(_0xd6e826,_0x3140ae){var _0x179cfe={};var _0x56d1c6=_[_0x3c35('0x24')](db[_0x3c35('0x25')][_0x3c35('0x26')],function(_0x5da06b){return{'name':_0x5da06b[_0x3c35('0x27')],'type':_0x5da06b[_0x3c35('0x28')]['key']};});_0x179cfe=qs['getOptions'](_0x56d1c6,_0xd6e826);return interaction[_0x3c35('0x29')]('sms',_0xd6e826[_0x3c35('0x2a')],_0xd6e826[_0x3c35('0x2b')],_0x179cfe,_0x56d1c6)[_0x3c35('0x1c')](respondWithFilteredResult(_0x3140ae,_0x179cfe))[_0x3c35('0x2c')](handleError(_0x3140ae,null));};exports['show']=function(_0x3b9f5b,_0xc57a25){var _0x1ee32c={'raw':![],'where':{'id':_0x3b9f5b[_0x3c35('0x2d')]['id']}},_0x41e575={};_0x41e575[_0x3c35('0x2e')]=_[_0x3c35('0x2f')](db['SmsInteraction'][_0x3c35('0x26')]);_0x41e575[_0x3c35('0x2a')]=_[_0x3c35('0x2f')](_0x3b9f5b[_0x3c35('0x2a')]);_0x41e575[_0x3c35('0x30')]=_[_0x3c35('0x31')](_0x41e575[_0x3c35('0x2e')],_0x41e575[_0x3c35('0x2a')]);_0x1ee32c['attributes']=_[_0x3c35('0x31')](_0x41e575[_0x3c35('0x2e')],qs[_0x3c35('0x32')](_0x3b9f5b[_0x3c35('0x2a')][_0x3c35('0x32')]));_0x1ee32c[_0x3c35('0x33')]=_0x1ee32c[_0x3c35('0x33')]['length']?_0x1ee32c[_0x3c35('0x33')]:_0x41e575[_0x3c35('0x2e')];if(_0x3b9f5b[_0x3c35('0x2a')][_0x3c35('0x34')]){_0x1ee32c[_0x3c35('0x35')]=[{'all':!![]}];}_0x1ee32c=_['merge']({},_0x1ee32c,_0x3b9f5b['options']);return db[_0x3c35('0x25')]['find'](_0x1ee32c)[_0x3c35('0x1c')](handleEntityNotFound(_0xc57a25,null))[_0x3c35('0x1c')](respondWithResult(_0xc57a25,null))[_0x3c35('0x2c')](handleError(_0xc57a25,null));};exports[_0x3c35('0x36')]=function(_0x4284a1,_0x313065){return db['SmsInteraction'][_0x3c35('0x36')](_0x4284a1[_0x3c35('0x37')],{})['then'](respondWithResult(_0x313065,0xc9))[_0x3c35('0x2c')](handleError(_0x313065,null));};exports['update']=function(_0x15baf7,_0x10b251){if(_0x15baf7[_0x3c35('0x37')]['id']){delete _0x15baf7['body']['id'];}return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x15baf7['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x10b251,null))[_0x3c35('0x1c')](saveUpdates(_0x15baf7['body'],null))[_0x3c35('0x1c')](respondWithResult(_0x10b251,null))[_0x3c35('0x2c')](handleError(_0x10b251,null));};exports[_0x3c35('0x1d')]=function(_0x5bf27d,_0x46679e){return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x5bf27d[_0x3c35('0x2d')]['id']}})['then'](handleEntityNotFound(_0x46679e,null))[_0x3c35('0x1c')](removeEntity(_0x46679e,null))[_0x3c35('0x2c')](handleError(_0x46679e,null));};exports[_0x3c35('0x39')]=function(_0x23fced,_0x339639){return db[_0x3c35('0x25')]['describe']()['then'](respondWithResult(_0x339639,null))[_0x3c35('0x2c')](handleError(_0x339639,null));};exports[_0x3c35('0x3a')]=function(_0x2e49d7,_0x360d36){return db[_0x3c35('0x3b')]['find']({'where':{'id':_0x2e49d7[_0x3c35('0x2d')]['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x360d36,null))[_0x3c35('0x1c')](function(_0x36887c){if(_0x36887c){return _0x36887c[_0x3c35('0x3a')](_0x2e49d7[_0x3c35('0x37')][_0x3c35('0x3c')],_[_0x3c35('0x3d')](_0x2e49d7['body'],[_0x3c35('0x3c'),'id'])||{});}})[_0x3c35('0x1c')](respondWithResult(_0x360d36,null))['catch'](handleError(_0x360d36,null));};exports['getMessages']=function(_0x5db29f,_0x4a619d){var _0x3c92eb={'raw':![],'where':{}};var _0x4db3c1={};var _0x3c1c13={'count':0x0,'rows':[]};return db[_0x3c35('0x25')]['findOne']({'where':{'id':_0x5db29f['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x4a619d,null))[_0x3c35('0x1c')](function(_0x2c71ee){if(_0x2c71ee){_0x4db3c1[_0x3c35('0x2e')]=_['keys'](db['SmsMessage'][_0x3c35('0x26')]);_0x4db3c1['query']=_[_0x3c35('0x2f')](_0x5db29f[_0x3c35('0x2a')]);_0x4db3c1[_0x3c35('0x30')]=_[_0x3c35('0x31')](_0x4db3c1['model'],_0x4db3c1[_0x3c35('0x2a')]);_0x3c92eb[_0x3c35('0x33')]=_[_0x3c35('0x31')](_0x4db3c1[_0x3c35('0x2e')],qs[_0x3c35('0x32')](_0x5db29f[_0x3c35('0x2a')]['fields']));_0x3c92eb[_0x3c35('0x33')]=_0x3c92eb[_0x3c35('0x33')][_0x3c35('0x3e')]?_0x3c92eb[_0x3c35('0x33')]:_0x4db3c1['model'];if(!_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x3f')](_0x3c35('0x40'))){_0x3c92eb[_0x3c35('0x19')]=qs[_0x3c35('0x19')](_0x5db29f['query'][_0x3c35('0x19')]);_0x3c92eb['offset']=qs['offset'](_0x5db29f['query'][_0x3c35('0x16')]);}_0x3c92eb[_0x3c35('0x41')]=qs[_0x3c35('0x42')](_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x42')]);_0x3c92eb['where']=qs['filters'](_[_0x3c35('0x43')](_0x5db29f[_0x3c35('0x2a')],_0x4db3c1[_0x3c35('0x30')]));_0x3c92eb[_0x3c35('0x44')][_0x3c35('0x45')]=_0x2c71ee['id'];if(_0x5db29f[_0x3c35('0x2a')]['filter']){_0x3c92eb[_0x3c35('0x44')]=_['merge'](_0x3c92eb[_0x3c35('0x44')],{'$or':_[_0x3c35('0x24')](_0x3c92eb['attributes'],function(_0x40b4fd){var _0x3c7490={};_0x3c7490[_0x40b4fd]={'$like':'%'+_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x46')]+'%'};return _0x3c7490;})});}if(_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x47')]){var _0x5e554d=_0x5db29f[_0x3c35('0x2a')]['$gte'][_0x3c35('0x48')](',');var _0x29c9ce={};_0x29c9ce[_0x5e554d[0x0]]={'$gte':moment(_0x5e554d[0x1])['format'](_0x3c35('0x49'))};_0x3c92eb[_0x3c35('0x44')]=_[_0x3c35('0x4a')](_0x3c92eb[_0x3c35('0x44')],_0x29c9ce);}_0x3c92eb=_[_0x3c35('0x4a')]({},_0x3c92eb,_0x5db29f['options']);return db['SmsMessage'][_0x3c35('0x18')]({'where':_0x3c92eb['where']})[_0x3c35('0x1c')](function(_0x2711a3){_0x3c1c13['count']=_0x2711a3;if(_0x5db29f[_0x3c35('0x2a')][_0x3c35('0x34')]){_0x3c92eb[_0x3c35('0x35')]=[{'all':!![]}];}return db[_0x3c35('0x3b')]['findAll'](_0x3c92eb);})['then'](function(_0x54bbce){_0x3c1c13[_0x3c35('0x4b')]=_0x54bbce;return _0x3c1c13;});}})[_0x3c35('0x1c')](respondWithFilteredResult(_0x4a619d,_0x3c92eb))[_0x3c35('0x2c')](handleError(_0x4a619d,null));};exports[_0x3c35('0x4c')]=function(_0x973c87,_0x20616c){return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x973c87['params']['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x20616c,null))[_0x3c35('0x1c')](function(_0x27ee86){if(_0x27ee86){return _0x27ee86['setTags'](_0x973c87[_0x3c35('0x37')]['ids'],_[_0x3c35('0x3d')](_0x973c87[_0x3c35('0x37')],[_0x3c35('0x3c'),'id'])||{})['spread'](function(){return db[_0x3c35('0x4d')][_0x3c35('0x29')]({'attributes':['id','name',_0x3c35('0x4e')],'where':{'id':_0x973c87[_0x3c35('0x37')][_0x3c35('0x3c')]}});})[_0x3c35('0x1c')](function(_0x4da18d){socket[_0x3c35('0x4f')](_0x3c35('0x50'),{'id':Number(_0x973c87[_0x3c35('0x2d')]['id']),'tags':_0x4da18d||[]});return{'id':Number(_0x973c87[_0x3c35('0x2d')]['id']),'tags':_0x4da18d||[]};});}})[_0x3c35('0x1c')](respondWithResult(_0x20616c,null))[_0x3c35('0x2c')](handleError(_0x20616c,null));};exports[_0x3c35('0x51')]=function(_0x416856,_0x3c06a7){return db['SmsInteraction'][_0x3c35('0x38')]({'where':{'id':_0x416856[_0x3c35('0x2d')]['id']}})[_0x3c35('0x1c')](handleEntityNotFound(_0x3c06a7,null))[_0x3c35('0x1c')](function(_0x5726f9){if(_0x5726f9){return _0x5726f9[_0x3c35('0x51')](_0x416856[_0x3c35('0x2a')][_0x3c35('0x3c')]);}})[_0x3c35('0x1c')](respondWithStatusCode(_0x3c06a7,null))['catch'](handleError(_0x3c06a7,null));};exports[_0x3c35('0x52')]=function(_0x3ebfd2,_0x185fb3){var _0x32329b=moment()[_0x3c35('0x53')]()[_0x3c35('0x54')]();var _0x5a7106=path[_0x3c35('0x55')](config[_0x3c35('0x56')],_0x3c35('0x57'),'files',_0x3c35('0x58'));var _0xdb0955=path['join'](_0x5a7106,_0x32329b);var _0x2a6b66=util[_0x3c35('0x59')](_0x3c35('0x5a'),_0x3ebfd2['params']['id'],_0x32329b);var _0x5e9c14=path[_0x3c35('0x55')](_0x5a7106,_0x2a6b66);var _0x163936=[];_0x163936['push']({'model':db[_0x3c35('0x5b')],'as':_0x3c35('0x5b'),'attributes':['id',_0x3c35('0x5c')],'raw':!![]});_0x163936[_0x3c35('0x5d')]({'model':db[_0x3c35('0x5e')],'as':_0x3c35('0x5f'),'attributes':['id',_0x3c35('0x60'),'lastName'],'raw':!![]});var _0x10908b=[{'model':db[_0x3c35('0x3b')],'as':_0x3c35('0x61'),'attributes':['id',_0x3c35('0x37'),_0x3c35('0x62'),_0x3c35('0x63'),'secret',_0x3c35('0x64')],'include':_0x163936}];_0x10908b[_0x3c35('0x5d')]({'model':db[_0x3c35('0x65')],'as':'Account','attributes':['id',_0x3c35('0x21')]});_0x10908b[_0x3c35('0x5d')]({'model':db[_0x3c35('0x5b')],'as':_0x3c35('0x66'),'attributes':['id',_0x3c35('0x5c')]});return db[_0x3c35('0x25')][_0x3c35('0x38')]({'where':{'id':_0x3ebfd2['params']['id']},'include':_0x10908b})[_0x3c35('0x1c')](handleEntityNotFound(_0x185fb3,null))[_0x3c35('0x1c')](function(_0x4b3230){if(_0x4b3230){var _0x2b104c=_0x4b3230['get']({'plain':!![]});fs[_0x3c35('0x67')](_0xdb0955);var _0x148d2f={'channel':'Sms','account':_0x2b104c[_0x3c35('0x68')][_0x3c35('0x21')],'agent':_0x2b104c[_0x3c35('0x66')]?_0x2b104c['Owner']['fullname']:'N.A.','createdAt':moment(_0x2b104c[_0x3c35('0x62')])[_0x3c35('0x59')](_0x3c35('0x49'))[_0x3c35('0x54')](),'closedAt':_0x2b104c[_0x3c35('0x69')]?moment(_0x2b104c[_0x3c35('0x6a')])[_0x3c35('0x59')](_0x3c35('0x49'))['toString']():'','disposition':_0x2b104c[_0x3c35('0x6b')],'messages':_(_0x2b104c[_0x3c35('0x61')])['filter']({'secret':![]})['map'](function(_0x27a2b4){return{'date':moment(_0x27a2b4[_0x3c35('0x62')])[_0x3c35('0x59')](_0x3c35('0x49'))[_0x3c35('0x54')](),'sender':_0x27a2b4[_0x3c35('0x63')]==='out'?_0x27a2b4[_0x3c35('0x5b')]?_0x27a2b4['User'][_0x3c35('0x5c')]:_0x3c35('0x6c'):_0x27a2b4['Contact'][_0x3c35('0x60')]+(_0x27a2b4['Contact']['lastName']?'\x20'+_0x27a2b4[_0x3c35('0x5f')][_0x3c35('0x6d')]:''),'body':_0x27a2b4[_0x3c35('0x37')],'direction':_0x27a2b4[_0x3c35('0x63')]==='out'?'A':'C','secret':_0x27a2b4['secret'],'read':_0x27a2b4[_0x3c35('0x64')]};})[_0x3c35('0x6e')]()};return ejs[_0x3c35('0x6f')](path[_0x3c35('0x55')](config['root'],_0x3c35('0x57'),_0x3c35('0x70'),'downloadInteraction.ejs'),{'interaction':_0x148d2f})['then'](function(_0x1a585a){var _0x41c94f=path[_0x3c35('0x55')](_0xdb0955,_0x3c35('0x71')+_0x2b104c['id']+'-'+_0x32329b+_0x3c35('0x72'));var _0x54d6d3={'path':_0x41c94f,'channel':_0x3c35('0x73'),'interactionId':_0x2b104c['id']};return pdf[_0x3c35('0x74')](_0x1a585a,_0x54d6d3);})[_0x3c35('0x1c')](function(){return new BPromise(function(_0x333344,_0x17eb4a){zipdir(_0xdb0955,{'saveTo':_0x5e9c14},function(_0x576126,_0x592e00){if(_0x576126)return _0x17eb4a(_0x576126);return _0x333344(_0x592e00);});})[_0x3c35('0x1c')](function(){return new BPromise(function(_0x1cbfd4,_0x4b28d9){rimraf(_0xdb0955,function(_0x1611f5){if(_0x1611f5)_0x4b28d9(_0x1611f5);return _0x1cbfd4();});});})['then'](function(){return _0x185fb3['download'](_0x5e9c14,_0x2a6b66,function(_0x4989f9){if(_0x4989f9){console[_0x3c35('0x75')](_0x3c35('0x76'),_0x4989f9);}else{fs[_0x3c35('0x77')](_0x5e9c14);}});});});}else{return _0x185fb3['sendStatus'](0xc8);}})['catch'](handleError(_0x185fb3,null));}; \ No newline at end of file +var _0x4d74=['params','describe','addMessage','SmsMessage','ids','omit','findOne','length','hasOwnProperty','nolimit','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','Contact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','mkdirSync','Owner','N.A.','closedAt','disposition','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','sms','query','user','catch','show','model','keys','filters','intersection','attributes','fields','includeAll','include','options','SmsInteraction','find','create','body','destroy'];(function(_0x2c0026,_0x30364c){var _0x542e20=function(_0xc2d151){while(--_0xc2d151){_0x2c0026['push'](_0x2c0026['shift']());}};_0x542e20(++_0x30364c);}(_0x4d74,0xc0));var _0x44d7=function(_0x63b6d3,_0x13c87d){_0x63b6d3=_0x63b6d3-0x0;var _0x41a70c=_0x4d74[_0x63b6d3];return _0x41a70c;};'use strict';var rimraf=require(_0x44d7('0x0'));var zipdir=require(_0x44d7('0x1'));var moment=require(_0x44d7('0x2'));var BPromise=require(_0x44d7('0x3'));var util=require('util');var path=require(_0x44d7('0x4'));var ejs=require(_0x44d7('0x5'));var fs=require('fs');var _=require(_0x44d7('0x6'));var Redis=require(_0x44d7('0x7'));var interaction=require(_0x44d7('0x8'));var qs=require(_0x44d7('0x9'));var pdf=require(_0x44d7('0xa'));var logger=require(_0x44d7('0xb'))(_0x44d7('0xc'));var config=require(_0x44d7('0xd'));var db=require(_0x44d7('0xe'))['db'];config[_0x44d7('0xf')]=_[_0x44d7('0x10')](config[_0x44d7('0xf')],{'host':_0x44d7('0x11'),'port':0x18eb});var socket=require(_0x44d7('0x12'))(new Redis(config[_0x44d7('0xf')]));require(_0x44d7('0x13'))[_0x44d7('0x14')](socket);function respondWithStatusCode(_0x5b7aa8,_0x438490){_0x438490=_0x438490||0xcc;return function(_0xc2310d){if(_0xc2310d){return _0x5b7aa8[_0x44d7('0x15')](_0x438490);}return _0x5b7aa8[_0x44d7('0x16')](_0x438490)['end']();};}function respondWithResult(_0x1b632a,_0x1af200){_0x1af200=_0x1af200||0xc8;return function(_0x2c42c8){if(_0x2c42c8){return _0x1b632a[_0x44d7('0x16')](_0x1af200)[_0x44d7('0x17')](_0x2c42c8);}};}function respondWithFilteredResult(_0x301401,_0x52442f){return function(_0x44a949){if(_0x44a949){var _0x1ce717=typeof _0x52442f[_0x44d7('0x18')]===_0x44d7('0x19')&&typeof _0x52442f[_0x44d7('0x1a')]==='undefined';var _0x5ae9e0=_0x44a949[_0x44d7('0x1b')];var _0x3bd938=_0x1ce717?0x0:_0x52442f[_0x44d7('0x18')];var _0x5f4725=_0x1ce717?_0x44a949[_0x44d7('0x1b')]:_0x52442f['offset']+_0x52442f[_0x44d7('0x1a')];var _0x385056;if(_0x5f4725>=_0x5ae9e0){_0x5f4725=_0x5ae9e0;_0x385056=0xc8;}else{_0x385056=0xce;}_0x301401[_0x44d7('0x16')](_0x385056);return _0x301401[_0x44d7('0x1c')](_0x44d7('0x1d'),_0x3bd938+'-'+_0x5f4725+'/'+_0x5ae9e0)[_0x44d7('0x17')](_0x44a949);}return null;};}function saveUpdates(_0x37371d){return function(_0x186e56){if(_0x186e56){return _0x186e56[_0x44d7('0x1e')](_0x37371d)[_0x44d7('0x1f')](function(_0x341891){return _0x341891;});}return null;};}function removeEntity(_0x59f26a){return function(_0x5cbdb5){if(_0x5cbdb5){return _0x5cbdb5['destroy']()[_0x44d7('0x1f')](function(){_0x59f26a[_0x44d7('0x16')](0xcc)[_0x44d7('0x20')]();});}};}function handleEntityNotFound(_0x188a0a){return function(_0x5d826b){if(!_0x5d826b){_0x188a0a[_0x44d7('0x15')](0x194);}return _0x5d826b;};}function handleError(_0x54c6dd,_0x41649f){_0x41649f=_0x41649f||0x1f4;return function(_0x3fea29){logger['error'](_0x3fea29[_0x44d7('0x21')]);if(_0x3fea29['name']){delete _0x3fea29[_0x44d7('0x22')];}_0x54c6dd['status'](_0x41649f)[_0x44d7('0x23')](_0x3fea29);};}exports[_0x44d7('0x24')]=function(_0x39e558,_0x5edf26){var _0x1968b5={};var _0x2e1cb8=_[_0x44d7('0x25')](db['SmsInteraction'][_0x44d7('0x26')],function(_0x4dd33f){return{'name':_0x4dd33f[_0x44d7('0x27')],'type':_0x4dd33f[_0x44d7('0x28')][_0x44d7('0x29')]};});_0x1968b5=qs[_0x44d7('0x2a')](_0x2e1cb8,_0x39e558);return interaction['findAll'](_0x44d7('0x2b'),_0x39e558[_0x44d7('0x2c')],_0x39e558[_0x44d7('0x2d')],_0x1968b5,_0x2e1cb8)[_0x44d7('0x1f')](respondWithFilteredResult(_0x5edf26,_0x1968b5))[_0x44d7('0x2e')](handleError(_0x5edf26,null));};exports[_0x44d7('0x2f')]=function(_0x5cca52,_0x25aea8){var _0x4eaa52={'raw':![],'where':{'id':_0x5cca52['params']['id']}},_0x447b2b={};_0x447b2b[_0x44d7('0x30')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x447b2b[_0x44d7('0x2c')]=_[_0x44d7('0x31')](_0x5cca52[_0x44d7('0x2c')]);_0x447b2b[_0x44d7('0x32')]=_[_0x44d7('0x33')](_0x447b2b[_0x44d7('0x30')],_0x447b2b[_0x44d7('0x2c')]);_0x4eaa52[_0x44d7('0x34')]=_['intersection'](_0x447b2b[_0x44d7('0x30')],qs[_0x44d7('0x35')](_0x5cca52[_0x44d7('0x2c')][_0x44d7('0x35')]));_0x4eaa52[_0x44d7('0x34')]=_0x4eaa52['attributes']['length']?_0x4eaa52[_0x44d7('0x34')]:_0x447b2b[_0x44d7('0x30')];if(_0x5cca52[_0x44d7('0x2c')][_0x44d7('0x36')]){_0x4eaa52[_0x44d7('0x37')]=[{'all':!![]}];}_0x4eaa52=_['merge']({},_0x4eaa52,_0x5cca52[_0x44d7('0x38')]);return db[_0x44d7('0x39')][_0x44d7('0x3a')](_0x4eaa52)[_0x44d7('0x1f')](handleEntityNotFound(_0x25aea8,null))[_0x44d7('0x1f')](respondWithResult(_0x25aea8,null))[_0x44d7('0x2e')](handleError(_0x25aea8,null));};exports[_0x44d7('0x3b')]=function(_0x1fb916,_0x127cb4){return db[_0x44d7('0x39')]['create'](_0x1fb916[_0x44d7('0x3c')],{})[_0x44d7('0x1f')](respondWithResult(_0x127cb4,0xc9))[_0x44d7('0x2e')](handleError(_0x127cb4,null));};exports[_0x44d7('0x1e')]=function(_0x2cddea,_0x5b5d90){if(_0x2cddea[_0x44d7('0x3c')]['id']){delete _0x2cddea['body']['id'];}return db[_0x44d7('0x39')][_0x44d7('0x3a')]({'where':{'id':_0x2cddea['params']['id']}})['then'](handleEntityNotFound(_0x5b5d90,null))['then'](saveUpdates(_0x2cddea[_0x44d7('0x3c')],null))[_0x44d7('0x1f')](respondWithResult(_0x5b5d90,null))[_0x44d7('0x2e')](handleError(_0x5b5d90,null));};exports[_0x44d7('0x3d')]=function(_0x3fe068,_0x18e39d){return db[_0x44d7('0x39')][_0x44d7('0x3a')]({'where':{'id':_0x3fe068[_0x44d7('0x3e')]['id']}})[_0x44d7('0x1f')](handleEntityNotFound(_0x18e39d,null))[_0x44d7('0x1f')](removeEntity(_0x18e39d,null))[_0x44d7('0x2e')](handleError(_0x18e39d,null));};exports[_0x44d7('0x3f')]=function(_0x97b688,_0x1df04b){return db[_0x44d7('0x39')][_0x44d7('0x3f')]()['then'](respondWithResult(_0x1df04b,null))[_0x44d7('0x2e')](handleError(_0x1df04b,null));};exports[_0x44d7('0x40')]=function(_0x1dc010,_0x19e62d){return db[_0x44d7('0x41')][_0x44d7('0x3a')]({'where':{'id':_0x1dc010[_0x44d7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19e62d,null))[_0x44d7('0x1f')](function(_0x496f9d){if(_0x496f9d){return _0x496f9d[_0x44d7('0x40')](_0x1dc010[_0x44d7('0x3c')][_0x44d7('0x42')],_[_0x44d7('0x43')](_0x1dc010[_0x44d7('0x3c')],[_0x44d7('0x42'),'id'])||{});}})[_0x44d7('0x1f')](respondWithResult(_0x19e62d,null))['catch'](handleError(_0x19e62d,null));};exports['getMessages']=function(_0x6c49f4,_0x421d17){var _0x296a5f={'raw':![],'where':{}};var _0x2ee597={};var _0x55a10f={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x44d7('0x44')]({'where':{'id':_0x6c49f4[_0x44d7('0x3e')]['id']}})[_0x44d7('0x1f')](handleEntityNotFound(_0x421d17,null))[_0x44d7('0x1f')](function(_0x378304){if(_0x378304){_0x2ee597[_0x44d7('0x30')]=_[_0x44d7('0x31')](db[_0x44d7('0x41')][_0x44d7('0x26')]);_0x2ee597['query']=_[_0x44d7('0x31')](_0x6c49f4[_0x44d7('0x2c')]);_0x2ee597[_0x44d7('0x32')]=_['intersection'](_0x2ee597[_0x44d7('0x30')],_0x2ee597[_0x44d7('0x2c')]);_0x296a5f[_0x44d7('0x34')]=_[_0x44d7('0x33')](_0x2ee597[_0x44d7('0x30')],qs['fields'](_0x6c49f4['query'][_0x44d7('0x35')]));_0x296a5f[_0x44d7('0x34')]=_0x296a5f[_0x44d7('0x34')][_0x44d7('0x45')]?_0x296a5f[_0x44d7('0x34')]:_0x2ee597[_0x44d7('0x30')];if(!_0x6c49f4['query'][_0x44d7('0x46')](_0x44d7('0x47'))){_0x296a5f[_0x44d7('0x1a')]=qs['limit'](_0x6c49f4[_0x44d7('0x2c')]['limit']);_0x296a5f[_0x44d7('0x18')]=qs['offset'](_0x6c49f4[_0x44d7('0x2c')]['offset']);}_0x296a5f['order']=qs[_0x44d7('0x48')](_0x6c49f4['query']['sort']);_0x296a5f[_0x44d7('0x49')]=qs[_0x44d7('0x32')](_[_0x44d7('0x4a')](_0x6c49f4[_0x44d7('0x2c')],_0x2ee597[_0x44d7('0x32')]));_0x296a5f[_0x44d7('0x49')][_0x44d7('0x4b')]=_0x378304['id'];if(_0x6c49f4[_0x44d7('0x2c')][_0x44d7('0x4c')]){_0x296a5f['where']=_[_0x44d7('0x4d')](_0x296a5f['where'],{'$or':_['map'](_0x296a5f[_0x44d7('0x34')],function(_0x5dfb86){var _0x927b14={};_0x927b14[_0x5dfb86]={'$like':'%'+_0x6c49f4[_0x44d7('0x2c')][_0x44d7('0x4c')]+'%'};return _0x927b14;})});}if(_0x6c49f4['query'][_0x44d7('0x4e')]){var _0x470b0e=_0x6c49f4[_0x44d7('0x2c')][_0x44d7('0x4e')][_0x44d7('0x4f')](',');var _0x5eabab={};_0x5eabab[_0x470b0e[0x0]]={'$gte':moment(_0x470b0e[0x1])[_0x44d7('0x50')](_0x44d7('0x51'))};_0x296a5f['where']=_[_0x44d7('0x4d')](_0x296a5f[_0x44d7('0x49')],_0x5eabab);}_0x296a5f=_['merge']({},_0x296a5f,_0x6c49f4[_0x44d7('0x38')]);return db[_0x44d7('0x41')]['count']({'where':_0x296a5f['where']})[_0x44d7('0x1f')](function(_0x56f7a8){_0x55a10f[_0x44d7('0x1b')]=_0x56f7a8;if(_0x6c49f4[_0x44d7('0x2c')][_0x44d7('0x36')]){_0x296a5f[_0x44d7('0x37')]=[{'all':!![]}];}return db['SmsMessage'][_0x44d7('0x52')](_0x296a5f);})[_0x44d7('0x1f')](function(_0x2f8661){_0x55a10f['rows']=_0x2f8661;return _0x55a10f;});}})['then'](respondWithFilteredResult(_0x421d17,_0x296a5f))[_0x44d7('0x2e')](handleError(_0x421d17,null));};exports[_0x44d7('0x53')]=function(_0x3b06ea,_0x2a156f){return db['SmsInteraction'][_0x44d7('0x3a')]({'where':{'id':_0x3b06ea[_0x44d7('0x3e')]['id']}})[_0x44d7('0x1f')](handleEntityNotFound(_0x2a156f,null))['then'](function(_0x258742){if(_0x258742){return _0x258742[_0x44d7('0x54')](_0x3b06ea[_0x44d7('0x3c')][_0x44d7('0x42')],_[_0x44d7('0x43')](_0x3b06ea[_0x44d7('0x3c')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x44d7('0x52')]({'attributes':['id',_0x44d7('0x22'),_0x44d7('0x55')],'where':{'id':_0x3b06ea[_0x44d7('0x3c')][_0x44d7('0x42')]}});})[_0x44d7('0x1f')](function(_0x5440dc){socket[_0x44d7('0x56')](_0x44d7('0x57'),{'id':Number(_0x3b06ea[_0x44d7('0x3e')]['id']),'tags':_0x5440dc||[]});return{'id':Number(_0x3b06ea['params']['id']),'tags':_0x5440dc||[]};});}})[_0x44d7('0x1f')](respondWithResult(_0x2a156f,null))['catch'](handleError(_0x2a156f,null));};exports[_0x44d7('0x58')]=function(_0x259b7a,_0x17d68d){return db[_0x44d7('0x39')][_0x44d7('0x3a')]({'where':{'id':_0x259b7a[_0x44d7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x17d68d,null))[_0x44d7('0x1f')](function(_0x104de4){if(_0x104de4){return _0x104de4[_0x44d7('0x58')](_0x259b7a[_0x44d7('0x2c')][_0x44d7('0x42')]);}})[_0x44d7('0x1f')](respondWithStatusCode(_0x17d68d,null))[_0x44d7('0x2e')](handleError(_0x17d68d,null));};exports[_0x44d7('0x59')]=function(_0x12f317,_0x4b0755){var _0x5d415e=moment()[_0x44d7('0x5a')]()[_0x44d7('0x5b')]();var _0x1269c6=path[_0x44d7('0x5c')](config[_0x44d7('0x5d')],_0x44d7('0x5e'),_0x44d7('0x5f'),_0x44d7('0x60'));var _0x167a65=path[_0x44d7('0x5c')](_0x1269c6,_0x5d415e);var _0x5be206=util[_0x44d7('0x50')](_0x44d7('0x61'),_0x12f317[_0x44d7('0x3e')]['id'],_0x5d415e);var _0x3d5403=path[_0x44d7('0x5c')](_0x1269c6,_0x5be206);var _0x4e27b3=[];_0x4e27b3['push']({'model':db[_0x44d7('0x62')],'as':_0x44d7('0x62'),'attributes':['id',_0x44d7('0x63')],'raw':!![]});_0x4e27b3[_0x44d7('0x64')]({'model':db['CmContact'],'as':_0x44d7('0x65'),'attributes':['id','firstName',_0x44d7('0x66')],'raw':!![]});var _0x138f19=[{'model':db['SmsMessage'],'as':_0x44d7('0x67'),'attributes':['id','body',_0x44d7('0x68'),_0x44d7('0x69'),_0x44d7('0x6a'),_0x44d7('0x6b')],'include':_0x4e27b3}];_0x138f19[_0x44d7('0x64')]({'model':db[_0x44d7('0x6c')],'as':_0x44d7('0x6d'),'attributes':['id',_0x44d7('0x22')]});_0x138f19[_0x44d7('0x64')]({'model':db[_0x44d7('0x62')],'as':'Owner','attributes':['id',_0x44d7('0x63')]});return db[_0x44d7('0x39')]['find']({'where':{'id':_0x12f317[_0x44d7('0x3e')]['id']},'include':_0x138f19})[_0x44d7('0x1f')](handleEntityNotFound(_0x4b0755,null))[_0x44d7('0x1f')](function(_0x52a5c4){if(_0x52a5c4){var _0x399168=_0x52a5c4['get']({'plain':!![]});fs[_0x44d7('0x6e')](_0x167a65);var _0x46d74a={'channel':'Sms','account':_0x399168[_0x44d7('0x6d')][_0x44d7('0x22')],'agent':_0x399168[_0x44d7('0x6f')]?_0x399168[_0x44d7('0x6f')][_0x44d7('0x63')]:_0x44d7('0x70'),'createdAt':moment(_0x399168['createdAt'])[_0x44d7('0x50')](_0x44d7('0x51'))['toString'](),'closedAt':_0x399168['closed']?moment(_0x399168[_0x44d7('0x71')])[_0x44d7('0x50')](_0x44d7('0x51'))['toString']():'','disposition':_0x399168[_0x44d7('0x72')],'messages':_(_0x399168[_0x44d7('0x67')])['filter']({'secret':![]})[_0x44d7('0x25')](function(_0x41edbf){return{'date':moment(_0x41edbf[_0x44d7('0x68')])[_0x44d7('0x50')](_0x44d7('0x51'))['toString'](),'sender':_0x41edbf[_0x44d7('0x69')]===_0x44d7('0x73')?_0x41edbf[_0x44d7('0x62')]?_0x41edbf[_0x44d7('0x62')][_0x44d7('0x63')]:_0x44d7('0x74'):_0x41edbf[_0x44d7('0x65')][_0x44d7('0x75')]+(_0x41edbf['Contact'][_0x44d7('0x66')]?'\x20'+_0x41edbf[_0x44d7('0x65')][_0x44d7('0x66')]:''),'body':_0x41edbf[_0x44d7('0x3c')],'direction':_0x41edbf['direction']===_0x44d7('0x73')?'A':'C','secret':_0x41edbf['secret'],'read':_0x41edbf[_0x44d7('0x6b')]};})[_0x44d7('0x76')]()};return ejs[_0x44d7('0x77')](path['join'](config[_0x44d7('0x5d')],_0x44d7('0x5e'),_0x44d7('0x78'),_0x44d7('0x79')),{'interaction':_0x46d74a})[_0x44d7('0x1f')](function(_0x11b0a3){var _0x405eaf=path[_0x44d7('0x5c')](_0x167a65,_0x44d7('0x7a')+_0x399168['id']+'-'+_0x5d415e+_0x44d7('0x7b'));var _0x108f64={'path':_0x405eaf,'channel':_0x44d7('0x7c'),'interactionId':_0x399168['id']};return pdf[_0x44d7('0x7d')](_0x11b0a3,_0x108f64);})[_0x44d7('0x1f')](function(){return new BPromise(function(_0x2a4086,_0x40621e){zipdir(_0x167a65,{'saveTo':_0x3d5403},function(_0x44883e,_0x12e793){if(_0x44883e)return _0x40621e(_0x44883e);return _0x2a4086(_0x12e793);});})[_0x44d7('0x1f')](function(){return new BPromise(function(_0x114b7d,_0x496c33){rimraf(_0x167a65,function(_0x1b242d){if(_0x1b242d)_0x496c33(_0x1b242d);return _0x114b7d();});});})['then'](function(){return _0x4b0755[_0x44d7('0x59')](_0x3d5403,_0x5be206,function(_0x4b0a95){if(_0x4b0a95){console['log']('err',_0x4b0a95);}else{fs[_0x44d7('0x7e')](_0x3d5403);}});});});}else{return _0x4b0755[_0x44d7('0x15')](0xc8);}})[_0x44d7('0x2e')](handleError(_0x4b0755,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8681a62..057182a 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 _0xe5af=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','setDataValue','Users','map'];(function(_0x52c949,_0x34f4ae){var _0x1fc429=function(_0x36a351){while(--_0x36a351){_0x52c949['push'](_0x52c949['shift']());}};_0x1fc429(++_0x34f4ae);}(_0xe5af,0x9c));var _0xfe5a=function(_0xdc815e,_0x10ac44){_0xdc815e=_0xdc815e-0x0;var _0x19285c=_0xe5af[_0xdc815e];return _0x19285c;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xfe5a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe5a('0x3')](0x0);var events={'afterCreate':_0xfe5a('0x4'),'afterUpdate':'update','afterDestroy':_0xfe5a('0x5')};function emitEvent(_0x48e3a7){return function(_0x526677,_0x37455d,_0x2039cd){_0x526677['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x356c69){_0x526677[_0xfe5a('0x6')](_0xfe5a('0x7'),_0x356c69[_0xfe5a('0x8')](function(_0x5cd100){return{'id':_0x5cd100['id']};}));return SmsMessage[_0xfe5a('0x9')]({'where':{'SmsInteractionId':_0x526677['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51718e){_0x526677[_0xfe5a('0x6')](_0xfe5a('0xa'),_0x51718e['length']);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7+':'+_0x526677['id'],_0x526677);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7,_0x526677);_0x2039cd(null);})[_0xfe5a('0xc')](_0x2039cd(null));};}for(var e in events){if(events[_0xfe5a('0xd')](e)){var event=events[e];SmsInteraction[_0xfe5a('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x2d1fd8,_0x25ec75){var _0x129960=function(_0x395955){while(--_0x395955){_0x2d1fd8['push'](_0x2d1fd8['shift']());}};_0x129960(++_0x25ec75);}(_0x1399,0x16c));var _0x9139=function(_0x188ee6,_0x4282c4){_0x188ee6=_0x188ee6-0x0;var _0x3995e8=_0x1399[_0x188ee6];return _0x3995e8;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 20e3a36..2d0ca37 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 _0xf34c=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf34c,0x196));var _0xcf34=function(_0x46a896,_0x1d31f4){_0x46a896=_0x46a896-0x0;var _0xd4f86c=_0xf34c[_0x46a896];return _0xd4f86c;};'use strict';var _=require(_0xcf34('0x0'));var util=require('util');var logger=require(_0xcf34('0x1'))(_0xcf34('0x2'));var moment=require(_0xcf34('0x3'));var BPromise=require(_0xcf34('0x4'));var rp=require(_0xcf34('0x5'));var fs=require('fs');var path=require(_0xcf34('0x6'));var rimraf=require(_0xcf34('0x7'));var config=require(_0xcf34('0x8'));var attributes=require(_0xcf34('0x9'));module[_0xcf34('0xa')]=function(_0x165002,_0x5b1c3f){return _0x165002[_0xcf34('0xb')](_0xcf34('0xc'),attributes,{'tableName':_0xcf34('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x476596,_0x477013,_0x494053){if(_0x476596[_0xcf34('0xe')](_0xcf34('0xf'))){_0x476596[_0xcf34('0x10')]=moment()[_0xcf34('0x11')](_0xcf34('0x12'));}_0x494053(null,_0x476596);}}});}; \ No newline at end of file +var _0x88cc=['util','api','moment','bluebird','path','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x24d391,_0x1afcc3){var _0x42c233=function(_0x3c6761){while(--_0x3c6761){_0x24d391['push'](_0x24d391['shift']());}};_0x42c233(++_0x1afcc3);}(_0x88cc,0x195));var _0xc88c=function(_0x1d7bc0,_0x50a455){_0x1d7bc0=_0x1d7bc0-0x0;var _0x15a179=_0x88cc[_0x1d7bc0];return _0x15a179;};'use strict';var _=require(_0xc88c('0x0'));var util=require(_0xc88c('0x1'));var logger=require('../../config/logger')(_0xc88c('0x2'));var moment=require(_0xc88c('0x3'));var BPromise=require(_0xc88c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc88c('0x5'));var rimraf=require('rimraf');var config=require(_0xc88c('0x6'));var attributes=require(_0xc88c('0x7'));module['exports']=function(_0x282af8,_0x4fcf4b){return _0x282af8[_0xc88c('0x8')](_0xc88c('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d8528,_0xb82280,_0x3299b2){if(_0x1d8528['changed'](_0xc88c('0xa'))){_0x1d8528[_0xc88c('0xb')]=moment()[_0xc88c('0xc')](_0xc88c('0xd'));}_0x3299b2(null,_0x1d8528);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 032c972..9eede70 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 _0x70e7=['redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','update','body','options','where','limit','UpdateSmsInteraction','debug','stringify','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x33e9dc,_0x5809b9){var _0x121fa5=function(_0x543b87){while(--_0x543b87){_0x33e9dc['push'](_0x33e9dc['shift']());}};_0x121fa5(++_0x5809b9);}(_0x70e7,0xca));var _0x770e=function(_0x478d7b,_0x55f7d2){_0x478d7b=_0x478d7b-0x0;var _0x5c460f=_0x70e7[_0x478d7b];return _0x5c460f;};'use strict';var _=require(_0x770e('0x0'));var util=require('util');var moment=require(_0x770e('0x1'));var BPromise=require(_0x770e('0x2'));var rs=require(_0x770e('0x3'));var fs=require('fs');var Redis=require(_0x770e('0x4'));var db=require(_0x770e('0x5'))['db'];var utils=require(_0x770e('0x6'));var logger=require('../../config/logger')(_0x770e('0x7'));var config=require(_0x770e('0x8'));var jayson=require(_0x770e('0x9'));var client=jayson[_0x770e('0xa')][_0x770e('0xb')]({'port':0x232a});config['redis']=_[_0x770e('0xc')](config[_0x770e('0xd')],{'host':_0x770e('0xe'),'port':0x18eb});var socket=require(_0x770e('0xf'))(new Redis(config[_0x770e('0xd')]));require(_0x770e('0x10'))[_0x770e('0x11')](socket);function respondWithRpcPromise(_0x4711f6,_0x9a9362,_0x47c041){return new BPromise(function(_0x3f7d06,_0x4f8d6e){return client[_0x770e('0x12')](_0x4711f6,_0x47c041)[_0x770e('0x13')](function(_0x27ce39){logger[_0x770e('0x14')](_0x770e('0x15'),_0x9a9362,'request\x20sent');logger['debug'](_0x770e('0x16'),_0x9a9362,_0x770e('0x17'),JSON['stringify'](_0x27ce39));if(_0x27ce39[_0x770e('0x18')]){if(_0x27ce39[_0x770e('0x18')][_0x770e('0x19')]===0x1f4){logger[_0x770e('0x18')](_0x770e('0x15'),_0x9a9362,_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);return _0x4f8d6e(_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);}logger[_0x770e('0x18')](_0x770e('0x15'),_0x9a9362,_0x27ce39[_0x770e('0x18')][_0x770e('0x1a')]);return _0x3f7d06(_0x27ce39[_0x770e('0x18')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x9a9362,_0x770e('0x17'));_0x3f7d06(_0x27ce39['result'][_0x770e('0x1a')]);}})[_0x770e('0x1b')](function(_0x3db866){logger[_0x770e('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x9a9362,_0x3db866);_0x4f8d6e(_0x3db866);});});}exports['UpdateSmsInteraction']=function(_0x1c0c7c){var _0x502eb9=this;return new Promise(function(_0x3dbeb3,_0x149bf1){return db['SmsInteraction'][_0x770e('0x1c')](_0x1c0c7c[_0x770e('0x1d')],{'raw':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c[_0x770e('0x1e')][_0x770e('0x1f')]||null:null,'attributes':_0x1c0c7c['options']?_0x1c0c7c[_0x770e('0x1e')]['attributes']||null:null,'limit':_0x1c0c7c[_0x770e('0x1e')]?_0x1c0c7c[_0x770e('0x1e')][_0x770e('0x20')]||null:null})[_0x770e('0x13')](function(_0x1bab14){logger[_0x770e('0x14')](_0x770e('0x21'),_0x1c0c7c);logger[_0x770e('0x22')]('UpdateSmsInteraction',_0x1c0c7c,JSON[_0x770e('0x23')](_0x1bab14));_0x3dbeb3(_0x1bab14);})[_0x770e('0x1b')](function(_0x547ac4){logger[_0x770e('0x18')](_0x770e('0x21'),_0x547ac4[_0x770e('0x1a')],_0x1c0c7c);_0x149bf1(_0x502eb9[_0x770e('0x18')](0x1f4,_0x547ac4[_0x770e('0x1a')]));});});};exports[_0x770e('0x24')]=function(_0x2fa49a){return new Promise(function(_0x6cb035,_0x46e2d1){return db[_0x770e('0x25')][_0x770e('0x26')]({'where':_0x2fa49a['options']?_0x2fa49a[_0x770e('0x1e')][_0x770e('0x1f')]||null:null})['then'](function(_0x3f440f){if(_0x3f440f){return _0x3f440f[_0x770e('0x27')](_0x2fa49a[_0x770e('0x1d')][_0x770e('0x28')],_[_0x770e('0x29')](_0x2fa49a[_0x770e('0x1d')],['ids','id'])||{});}})['spread'](function(_0x4bdf45){logger['info'](_0x770e('0x2a'),_0x2fa49a);logger[_0x770e('0x22')](_0x770e('0x2a'),_0x2fa49a,JSON['stringify'](_0x4bdf45));_0x6cb035(_0x4bdf45);})['catch'](function(_0x1d1f58){logger[_0x770e('0x18')](_0x770e('0x2a'),_0x1d1f58[_0x770e('0x1a')],_0x2fa49a);_0x46e2d1(_this[_0x770e('0x18')](0x1f4,_0x1d1f58['message']));});});}; \ No newline at end of file +var _0x52ab=['find','where','addTags','ids','spread','AddTags','debug','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','redis','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','attributes','limit','AddTagsToSmsInteraction','SmsInteraction'];(function(_0x4a0dbd,_0x66e63c){var _0x1d4015=function(_0x16df16){while(--_0x16df16){_0x4a0dbd['push'](_0x4a0dbd['shift']());}};_0x1d4015(++_0x66e63c);}(_0x52ab,0x15d));var _0xb52a=function(_0x3e6389,_0x1112db){_0x3e6389=_0x3e6389-0x0;var _0x46038f=_0x52ab[_0x3e6389];return _0x46038f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb52a('0x0'));var BPromise=require(_0xb52a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb52a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb52a('0x3'));var logger=require(_0xb52a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb52a('0x5'));var client=jayson[_0xb52a('0x6')][_0xb52a('0x7')]({'port':0x232a});config['redis']=_[_0xb52a('0x8')](config['redis'],{'host':_0xb52a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb52a('0xa')]));require(_0xb52a('0xb'))['register'](socket);function respondWithRpcPromise(_0x5286de,_0x4296f0,_0x15ba68){return new BPromise(function(_0x20dce3,_0x119bf6){return client['request'](_0x5286de,_0x15ba68)[_0xb52a('0xc')](function(_0x3c3655){logger[_0xb52a('0xd')](_0xb52a('0xe'),_0x4296f0,_0xb52a('0xf'));logger['debug'](_0xb52a('0x10'),_0x4296f0,_0xb52a('0xf'),JSON[_0xb52a('0x11')](_0x3c3655));if(_0x3c3655[_0xb52a('0x12')]){if(_0x3c3655[_0xb52a('0x12')][_0xb52a('0x13')]===0x1f4){logger['error'](_0xb52a('0xe'),_0x4296f0,_0x3c3655[_0xb52a('0x12')][_0xb52a('0x14')]);return _0x119bf6(_0x3c3655['error'][_0xb52a('0x14')]);}logger[_0xb52a('0x12')](_0xb52a('0xe'),_0x4296f0,_0x3c3655[_0xb52a('0x12')]['message']);return _0x20dce3(_0x3c3655[_0xb52a('0x12')][_0xb52a('0x14')]);}else{logger[_0xb52a('0xd')](_0xb52a('0xe'),_0x4296f0,_0xb52a('0xf'));_0x20dce3(_0x3c3655[_0xb52a('0x15')][_0xb52a('0x14')]);}})[_0xb52a('0x16')](function(_0x4f7240){logger[_0xb52a('0x12')](_0xb52a('0xe'),_0x4296f0,_0x4f7240);_0x119bf6(_0x4f7240);});});}exports[_0xb52a('0x17')]=function(_0x110121){var _0x3be5ec=this;return new Promise(function(_0x429670,_0x477254){return db['SmsInteraction'][_0xb52a('0x18')](_0x110121[_0xb52a('0x19')],{'raw':_0x110121[_0xb52a('0x1a')]?_0x110121[_0xb52a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110121[_0xb52a('0x1a')]?_0x110121[_0xb52a('0x1a')]['where']||null:null,'attributes':_0x110121[_0xb52a('0x1a')]?_0x110121['options'][_0xb52a('0x1b')]||null:null,'limit':_0x110121[_0xb52a('0x1a')]?_0x110121[_0xb52a('0x1a')][_0xb52a('0x1c')]||null:null})[_0xb52a('0xc')](function(_0x4d3e6e){logger[_0xb52a('0xd')]('UpdateSmsInteraction',_0x110121);logger['debug']('UpdateSmsInteraction',_0x110121,JSON['stringify'](_0x4d3e6e));_0x429670(_0x4d3e6e);})[_0xb52a('0x16')](function(_0x4c4021){logger[_0xb52a('0x12')](_0xb52a('0x17'),_0x4c4021[_0xb52a('0x14')],_0x110121);_0x477254(_0x3be5ec[_0xb52a('0x12')](0x1f4,_0x4c4021[_0xb52a('0x14')]));});});};exports[_0xb52a('0x1d')]=function(_0xf5422d){return new Promise(function(_0x3d2582,_0x58f549){return db[_0xb52a('0x1e')][_0xb52a('0x1f')]({'where':_0xf5422d['options']?_0xf5422d[_0xb52a('0x1a')][_0xb52a('0x20')]||null:null})[_0xb52a('0xc')](function(_0xedbcc4){if(_0xedbcc4){return _0xedbcc4[_0xb52a('0x21')](_0xf5422d[_0xb52a('0x19')][_0xb52a('0x22')],_['omit'](_0xf5422d['body'],['ids','id'])||{});}})[_0xb52a('0x23')](function(_0x1c5206){logger[_0xb52a('0xd')](_0xb52a('0x24'),_0xf5422d);logger[_0xb52a('0x25')](_0xb52a('0x24'),_0xf5422d,JSON['stringify'](_0x1c5206));_0x3d2582(_0x1c5206);})['catch'](function(_0x1f87c7){logger[_0xb52a('0x12')]('AddTags',_0x1f87c7[_0xb52a('0x14')],_0xf5422d);_0x58f549(_this[_0xb52a('0x12')](0x1f4,_0x1f87c7[_0xb52a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 9ee9977..95ed197 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 _0x7022=['removeListener','length','smsInteraction:','./smsInteraction.events','emit'];(function(_0x524a13,_0x22668c){var _0x8a623e=function(_0x4bacd5){while(--_0x4bacd5){_0x524a13['push'](_0x524a13['shift']());}};_0x8a623e(++_0x22668c);}(_0x7022,0xa3));var _0x2702=function(_0x407df3,_0x1c37da){_0x407df3=_0x407df3-0x0;var _0xce2cfd=_0x7022[_0x407df3];return _0xce2cfd;};'use strict';var SmsInteractionEvents=require(_0x2702('0x0'));var events=['save','remove','update'];function createListener(_0x8b165b,_0x43a313){return function(_0x4883cb){_0x43a313[_0x2702('0x1')](_0x8b165b,_0x4883cb);};}function removeListener(_0x489ef1,_0x2d8216){return function(){SmsInteractionEvents[_0x2702('0x2')](_0x489ef1,_0x2d8216);};}exports['register']=function(_0x2672d7){for(var _0x4c90ab=0x0,_0xe5021a=events[_0x2702('0x3')];_0x4c90ab<_0xe5021a;_0x4c90ab++){var _0x1b37c8=events[_0x4c90ab];var _0x4e0a9e=createListener(_0x2702('0x4')+_0x1b37c8,_0x2672d7);SmsInteractionEvents['on'](_0x1b37c8,_0x4e0a9e);}}; \ No newline at end of file +var _0xd3b7=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x4a87b8,_0x338ae3){var _0x241045=function(_0x252fec){while(--_0x252fec){_0x4a87b8['push'](_0x4a87b8['shift']());}};_0x241045(++_0x338ae3);}(_0xd3b7,0x10d));var _0x7d3b=function(_0x45cfee,_0x3a2421){_0x45cfee=_0x45cfee-0x0;var _0x39a741=_0xd3b7[_0x45cfee];return _0x39a741;};'use strict';var SmsInteractionEvents=require(_0x7d3b('0x0'));var events=[_0x7d3b('0x1'),_0x7d3b('0x2'),'update'];function createListener(_0x56a621,_0x40f0cb){return function(_0x101b56){_0x40f0cb[_0x7d3b('0x3')](_0x56a621,_0x101b56);};}function removeListener(_0x44ac37,_0x285083){return function(){SmsInteractionEvents[_0x7d3b('0x4')](_0x44ac37,_0x285083);};}exports[_0x7d3b('0x5')]=function(_0x19d2d3){for(var _0x1f7c34=0x0,_0x447ac5=events[_0x7d3b('0x6')];_0x1f7c34<_0x447ac5;_0x1f7c34++){var _0x30cb58=events[_0x1f7c34];var _0x325c45=createListener(_0x7d3b('0x7')+_0x30cb58,_0x19d2d3);SmsInteractionEvents['on'](_0x30cb58,_0x325c45);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 48edc3b..8d14848 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 _0xca21=['/:id/status','put','/:id/accept','accept','reject','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','sms','create'];(function(_0x1b522b,_0x33332b){var _0x1a57b5=function(_0x11cb07){while(--_0x11cb07){_0x1b522b['push'](_0x1b522b['shift']());}};_0x1a57b5(++_0x33332b);}(_0xca21,0xcf));var _0x1ca2=function(_0x5ef660,_0x773bde){_0x5ef660=_0x5ef660-0x0;var _0x219718=_0xca21[_0x5ef660];return _0x219718;};'use strict';var multer=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1ca2('0x2'));var router=express[_0x1ca2('0x3')]();var fs_extra=require(_0x1ca2('0x4'));var auth=require(_0x1ca2('0x5'));var interaction=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var controller=require(_0x1ca2('0x8'));router[_0x1ca2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1ca2('0x9')]('/describe',auth[_0x1ca2('0xa')](),controller[_0x1ca2('0xb')]);router['get'](_0x1ca2('0xc'),auth['isAuthenticated'](),controller[_0x1ca2('0xd')]);router[_0x1ca2('0xe')]('/',auth[_0x1ca2('0xa')](),interaction[_0x1ca2('0xf')](_0x1ca2('0x10'),'smsmessage:create'),controller[_0x1ca2('0x11')]);router['post'](_0x1ca2('0x12'),controller['status']);router[_0x1ca2('0x13')]('/:id',auth[_0x1ca2('0xa')](),controller['update']);router['put'](_0x1ca2('0x14'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x15')]);router['put']('/:id/reject',auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x16')]);router['delete'](_0x1ca2('0xc'),auth[_0x1ca2('0xa')](),controller[_0x1ca2('0x17')]);module[_0x1ca2('0x18')]=router; \ No newline at end of file +var _0x2a39=['accept','put','/:id/reject','reject','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','update','/:id/accept'];(function(_0x238f7f,_0xb893b6){var _0x4e5103=function(_0x3d5c70){while(--_0x3d5c70){_0x238f7f['push'](_0x238f7f['shift']());}};_0x4e5103(++_0xb893b6);}(_0x2a39,0x1af));var _0x92a3=function(_0x2c2ddd,_0x1f2f89){_0x2c2ddd=_0x2c2ddd-0x0;var _0x3281c6=_0x2a39[_0x2c2ddd];return _0x3281c6;};'use strict';var multer=require(_0x92a3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x92a3('0x1'));var express=require(_0x92a3('0x2'));var router=express['Router']();var fs_extra=require(_0x92a3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x92a3('0x4'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x92a3('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x92a3('0x6'),auth[_0x92a3('0x7')](),controller[_0x92a3('0x8')]);router[_0x92a3('0x5')](_0x92a3('0x9'),auth[_0x92a3('0x7')](),controller[_0x92a3('0xa')]);router[_0x92a3('0xb')]('/',auth['isAuthenticated'](),interaction[_0x92a3('0xc')](_0x92a3('0xd'),_0x92a3('0xe')),controller['create']);router[_0x92a3('0xb')](_0x92a3('0xf'),controller[_0x92a3('0x10')]);router['put'](_0x92a3('0x9'),auth['isAuthenticated'](),controller[_0x92a3('0x11')]);router['put'](_0x92a3('0x12'),auth['isAuthenticated'](),controller[_0x92a3('0x13')]);router[_0x92a3('0x14')](_0x92a3('0x15'),auth[_0x92a3('0x7')](),controller[_0x92a3('0x16')]);router[_0x92a3('0x17')](_0x92a3('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x92a3('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 236eb80..0f3ffbb 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 _0x2a96=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x17764a,_0x1cabab){var _0x1a4bf1=function(_0x10227b){while(--_0x10227b){_0x17764a['push'](_0x17764a['shift']());}};_0x1a4bf1(++_0x1cabab);}(_0x2a96,0xb8));var _0x62a9=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0x2a96[_0x549d57];return _0x330291;};'use strict';var Sequelize=require(_0x62a9('0x0'));module[_0x62a9('0x1')]={'body':{'type':Sequelize[_0x62a9('0x2')](_0x62a9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x62a9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x62a9('0x5')),'defaultValue':_0x62a9('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x62a9('0x6')](0xbe)},'phone':{'type':Sequelize[_0x62a9('0x6')]},'readAt':{'type':Sequelize[_0x62a9('0x7')]},'secret':{'type':Sequelize[_0x62a9('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x62a9('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x43e7=['out','STRING','sequelize','TEXT'];(function(_0x13e1b9,_0x32a9de){var _0x4902dc=function(_0x400f43){while(--_0x400f43){_0x13e1b9['push'](_0x13e1b9['shift']());}};_0x4902dc(++_0x32a9de);}(_0x43e7,0xda));var _0x743e=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x43e7[_0x270a54];return _0x4d07d0;};'use strict';var Sequelize=require(_0x743e('0x0'));module['exports']={'body':{'type':Sequelize[_0x743e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x743e('0x2')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x743e('0x3')](0xbe)},'phone':{'type':Sequelize[_0x743e('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x743e('0x3')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3992a35..f57d900 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 _0x29b6=['fields','length','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','rawAttributes','keys','includeAll','create','body','find','params','destroy','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','User','agent','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','interface','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','delivered','Status','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./smsMessage.socket','register','client','http','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','fieldName','key','model','query','filters','intersection'];(function(_0x13455,_0x19d50d){var _0x11ea17=function(_0x436b6a){while(--_0x436b6a){_0x13455['push'](_0x13455['shift']());}};_0x11ea17(++_0x19d50d);}(_0x29b6,0x17e));var _0x629b=function(_0x42a23e,_0x1e62a9){_0x42a23e=_0x42a23e-0x0;var _0x33d3f3=_0x29b6[_0x42a23e];return _0x33d3f3;};'use strict';var emlformat=require(_0x629b('0x0'));var rimraf=require(_0x629b('0x1'));var zipdir=require(_0x629b('0x2'));var jsonpatch=require(_0x629b('0x3'));var rp=require(_0x629b('0x4'));var moment=require(_0x629b('0x5'));var BPromise=require(_0x629b('0x6'));var Mustache=require(_0x629b('0x7'));var util=require(_0x629b('0x8'));var path=require(_0x629b('0x9'));var sox=require('sox');var csv=require(_0x629b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x629b('0xb'));var _=require(_0x629b('0xc'));var squel=require(_0x629b('0xd'));var crypto=require(_0x629b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x629b('0xf'));var toCsv=require(_0x629b('0xa'));var querystring=require('querystring');var Papa=require(_0x629b('0x10'));var Redis=require(_0x629b('0x11'));var authService=require(_0x629b('0x12'));var qs=require(_0x629b('0x13'));var as=require(_0x629b('0x14'));var hardwareService=require(_0x629b('0x15'));var logger=require(_0x629b('0x16'))(_0x629b('0x17'));var utils=require(_0x629b('0x18'));var config=require(_0x629b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x629b('0x1a')]=_[_0x629b('0x1b')](config[_0x629b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x629b('0x1c'))(new Redis(config[_0x629b('0x1a')]));require(_0x629b('0x1d'))[_0x629b('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232c});var client9002=jayson[_0x629b('0x1f')][_0x629b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2c1f4f,_0x4ba9ae,_0x2a4d96,_0x4b0cfb){return new BPromise(function(_0x151b93,_0x2b0a74){var _0x204bb4=_0x4b0cfb||client;return _0x204bb4['request'](_0x2c1f4f,_0x2a4d96)[_0x629b('0x21')](function(_0x58f5a8){logger[_0x629b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x629b('0x23'));logger['debug'](_0x629b('0x24'),_0x4ba9ae,_0x629b('0x23'),JSON[_0x629b('0x25')](_0x58f5a8));if(_0x58f5a8['error']){if(_0x58f5a8[_0x629b('0x26')]['code']===0x1f4){logger[_0x629b('0x26')](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x2b0a74(_0x58f5a8['error'][_0x629b('0x28')]);}logger['error'](_0x629b('0x27'),_0x4ba9ae,_0x58f5a8[_0x629b('0x26')][_0x629b('0x28')]);return _0x151b93(_0x58f5a8['error'][_0x629b('0x28')]);}else{logger[_0x629b('0x22')](_0x629b('0x27'),_0x4ba9ae,_0x629b('0x23'));_0x151b93(_0x58f5a8[_0x629b('0x29')][_0x629b('0x28')]);}})[_0x629b('0x2a')](function(_0x547b3c){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4ba9ae,_0x547b3c);_0x2b0a74(_0x547b3c);});});}function respondWithStatusCode(_0x58b320,_0x3e1e25){_0x3e1e25=_0x3e1e25||0xcc;return function(_0x31c0b3){if(_0x31c0b3){return _0x58b320[_0x629b('0x2b')](_0x3e1e25);}return _0x58b320[_0x629b('0x2c')](_0x3e1e25)[_0x629b('0x2d')]();};}function respondWithResult(_0x40ae3c,_0x4c1f21){_0x4c1f21=_0x4c1f21||0xc8;return function(_0x43bc04){if(_0x43bc04){return _0x40ae3c[_0x629b('0x2c')](_0x4c1f21)[_0x629b('0x2e')](_0x43bc04);}};}function respondWithFilteredResult(_0x12d5fc,_0x12cc51){return function(_0x16c365){if(_0x16c365){var _0x3ef549=typeof _0x12cc51[_0x629b('0x2f')]==='undefined'&&typeof _0x12cc51['limit']===_0x629b('0x30');var _0x2fb97d=_0x16c365['count'];var _0x1628cb=_0x3ef549?0x0:_0x12cc51['offset'];var _0x86ee7c=_0x3ef549?_0x16c365[_0x629b('0x31')]:_0x12cc51['offset']+_0x12cc51[_0x629b('0x32')];var _0x16d968;if(_0x86ee7c>=_0x2fb97d){_0x86ee7c=_0x2fb97d;_0x16d968=0xc8;}else{_0x16d968=0xce;}_0x12d5fc[_0x629b('0x2c')](_0x16d968);return _0x12d5fc[_0x629b('0x33')](_0x629b('0x34'),_0x1628cb+'-'+_0x86ee7c+'/'+_0x2fb97d)[_0x629b('0x2e')](_0x16c365);}return null;};}function patchUpdates(_0x5550bd){return function(_0x269c0a){try{jsonpatch[_0x629b('0x35')](_0x269c0a,_0x5550bd,!![]);}catch(_0x2b21a3){return BPromise[_0x629b('0x36')](_0x2b21a3);}return _0x269c0a[_0x629b('0x37')]();};}function saveUpdates(_0x3c75cb,_0x198729){return function(_0x1f4cf6){if(_0x1f4cf6){return _0x1f4cf6[_0x629b('0x38')](_0x3c75cb)[_0x629b('0x21')](function(_0x229c50){return _0x229c50;});}return null;};}function removeEntity(_0x1dcc06,_0x2f8b21){return function(_0x4f2e44){if(_0x4f2e44){return _0x4f2e44['destroy']()[_0x629b('0x21')](function(){_0x1dcc06[_0x629b('0x2c')](0xcc)[_0x629b('0x2d')]();});}};}function handleEntityNotFound(_0x25ee68,_0x564590){return function(_0x311e82){if(!_0x311e82){_0x25ee68[_0x629b('0x2b')](0x194);}return _0x311e82;};}function handleError(_0x15ce4c,_0x46f403){_0x46f403=_0x46f403||0x1f4;return function(_0x4c1a34){logger[_0x629b('0x26')](_0x4c1a34[_0x629b('0x39')]);if(_0x4c1a34[_0x629b('0x3a')]){delete _0x4c1a34[_0x629b('0x3a')];}_0x15ce4c[_0x629b('0x2c')](_0x46f403)['send'](_0x4c1a34);};}exports[_0x629b('0x3b')]=function(_0x4024c7,_0x20c488){var _0x37daad={},_0x3b8100={},_0x36f47e={'count':0x0,'rows':[]};var _0x384783=_[_0x629b('0x3c')](db[_0x629b('0x3d')]['rawAttributes'],function(_0x3b2506){return{'name':_0x3b2506[_0x629b('0x3e')],'type':_0x3b2506['type'][_0x629b('0x3f')]};});_0x3b8100[_0x629b('0x40')]=_[_0x629b('0x3c')](_0x384783,_0x629b('0x3a'));_0x3b8100['query']=_['keys'](_0x4024c7[_0x629b('0x41')]);_0x3b8100[_0x629b('0x42')]=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],_0x3b8100[_0x629b('0x41')]);_0x37daad['attributes']=_[_0x629b('0x43')](_0x3b8100[_0x629b('0x40')],qs[_0x629b('0x44')](_0x4024c7[_0x629b('0x41')][_0x629b('0x44')]));_0x37daad['attributes']=_0x37daad['attributes'][_0x629b('0x45')]?_0x37daad[_0x629b('0x46')]:_0x3b8100[_0x629b('0x40')];if(!_0x4024c7[_0x629b('0x41')][_0x629b('0x47')](_0x629b('0x48'))){_0x37daad[_0x629b('0x32')]=qs[_0x629b('0x32')](_0x4024c7['query'][_0x629b('0x32')]);_0x37daad[_0x629b('0x2f')]=qs[_0x629b('0x2f')](_0x4024c7[_0x629b('0x41')][_0x629b('0x2f')]);}_0x37daad['order']=qs['sort'](_0x4024c7[_0x629b('0x41')][_0x629b('0x49')]);_0x37daad[_0x629b('0x4a')]=qs[_0x629b('0x42')](_['pick'](_0x4024c7[_0x629b('0x41')],_0x3b8100['filters']),_0x384783);if(_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]){_0x37daad['where']=_[_0x629b('0x4c')](_0x37daad[_0x629b('0x4a')],{'$or':_[_0x629b('0x3c')](_0x384783,function(_0x309665){if(_0x309665[_0x629b('0x4d')]!==_0x629b('0x4e')){var _0x4f8a5b={};_0x4f8a5b[_0x309665['name']]={'$like':'%'+_0x4024c7[_0x629b('0x41')][_0x629b('0x4b')]+'%'};return _0x4f8a5b;}})});}_0x37daad=_[_0x629b('0x4c')]({},_0x37daad,_0x4024c7[_0x629b('0x4f')]);var _0x23df71={'where':_0x37daad[_0x629b('0x4a')]};return db[_0x629b('0x3d')]['count'](_0x23df71)['then'](function(_0x4143fe){_0x36f47e['count']=_0x4143fe;if(_0x4024c7[_0x629b('0x41')]['includeAll']){_0x37daad[_0x629b('0x50')]=[{'all':!![]}];}return db[_0x629b('0x3d')][_0x629b('0x51')](_0x37daad);})[_0x629b('0x21')](function(_0x1422dd){_0x36f47e[_0x629b('0x52')]=_0x1422dd;return _0x36f47e;})[_0x629b('0x21')](respondWithFilteredResult(_0x20c488,_0x37daad))[_0x629b('0x2a')](handleError(_0x20c488,null));};exports['show']=function(_0x12cf74,_0x581da4){var _0x34d1bd={'raw':!![],'where':{'id':_0x12cf74['params']['id']}},_0x1ceb2a={};_0x1ceb2a[_0x629b('0x40')]=_['keys'](db['SmsMessage'][_0x629b('0x53')]);_0x1ceb2a[_0x629b('0x41')]=_[_0x629b('0x54')](_0x12cf74[_0x629b('0x41')]);_0x1ceb2a['filters']=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],_0x1ceb2a['query']);_0x34d1bd[_0x629b('0x46')]=_[_0x629b('0x43')](_0x1ceb2a[_0x629b('0x40')],qs['fields'](_0x12cf74[_0x629b('0x41')][_0x629b('0x44')]));_0x34d1bd[_0x629b('0x46')]=_0x34d1bd[_0x629b('0x46')][_0x629b('0x45')]?_0x34d1bd['attributes']:_0x1ceb2a['model'];if(_0x12cf74[_0x629b('0x41')][_0x629b('0x55')]){_0x34d1bd[_0x629b('0x50')]=[{'all':!![]}];}_0x34d1bd=_[_0x629b('0x4c')]({},_0x34d1bd,_0x12cf74[_0x629b('0x4f')]);return db[_0x629b('0x3d')]['find'](_0x34d1bd)['then'](handleEntityNotFound(_0x581da4,null))[_0x629b('0x21')](respondWithResult(_0x581da4,null))[_0x629b('0x2a')](handleError(_0x581da4,null));};exports[_0x629b('0x56')]=function(_0x3f819e,_0x264c6f){return db[_0x629b('0x3d')]['create'](_0x3f819e['body'],{})[_0x629b('0x21')](respondWithResult(_0x264c6f,0xc9))[_0x629b('0x2a')](handleError(_0x264c6f,null));};exports['update']=function(_0x4a71c0,_0xc1f151){if(_0x4a71c0[_0x629b('0x57')]['id']){delete _0x4a71c0[_0x629b('0x57')]['id'];}return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x4a71c0[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0xc1f151,null))[_0x629b('0x21')](saveUpdates(_0x4a71c0[_0x629b('0x57')],null))[_0x629b('0x21')](respondWithResult(_0xc1f151,null))['catch'](handleError(_0xc1f151,null));};exports[_0x629b('0x5a')]=function(_0x26cf93,_0x21bdf8){return db['SmsMessage']['find']({'where':{'id':_0x26cf93[_0x629b('0x59')]['id']}})[_0x629b('0x21')](handleEntityNotFound(_0x21bdf8,null))[_0x629b('0x21')](removeEntity(_0x21bdf8,null))['catch'](handleError(_0x21bdf8,null));};exports[_0x629b('0x5b')]=function(_0x228710,_0x137ed5){return db[_0x629b('0x3d')][_0x629b('0x5b')]()[_0x629b('0x21')](respondWithResult(_0x137ed5,null))['catch'](handleError(_0x137ed5,null));};var interaction_log=require(_0x629b('0x16'))(_0x629b('0x5c'));exports[_0x629b('0x5d')]=function(_0x169f2f,_0x25d9e9,_0x5ea044){var _0x528d33={'agent':{},'channel':'sms'};if(_0x169f2f[_0x629b('0x57')]['id']){delete _0x169f2f[_0x629b('0x57')]['id'];}_0x169f2f[_0x629b('0x57')][_0x629b('0x5e')]=!![];_0x169f2f[_0x629b('0x57')][_0x629b('0x5f')]=moment()[_0x629b('0x60')](_0x629b('0x61'));_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]=_0x169f2f[_0x629b('0x57')][_0x629b('0x62')]||_0x169f2f[_0x629b('0x63')]['id'];_0x528d33['agent']['id']=_0x169f2f[_0x629b('0x57')]['UserId'];return db[_0x629b('0x3d')]['find']({'where':{'id':_0x169f2f['params']['id'],'UserId':null}})[_0x629b('0x21')](handleEntityNotFound(_0x25d9e9,null))['then'](saveUpdates(_0x169f2f['body'],null))['then'](function(_0x5c56e6){if(_0x5c56e6){_0x528d33[_0x629b('0x28')]=_0x5c56e6[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x5c56e6[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x25d9e9,null))[_0x629b('0x21')](function(_0x2532d5){if(_0x2532d5){return _0x2532d5[_0x629b('0x38')]({'UserId':_0x169f2f['body']['UserId'],'read1stAt':_[_0x629b('0x67')](_0x2532d5[_0x629b('0x68')])?moment()[_0x629b('0x60')](_0x629b('0x61')):undefined});}return null;})[_0x629b('0x21')](function(_0x150a8c){if(_0x150a8c){_0x528d33[_0x629b('0x69')]=_0x150a8c[_0x629b('0x64')]({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x6a'),_0x169f2f[_0x629b('0x63')]['id'],_0x169f2f['user']['name'],_0x169f2f['user'][_0x629b('0x6b')],_0x528d33[_0x629b('0x69')]['id'],_0x169f2f[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x169f2f[_0x629b('0x57')]):_0x629b('0x6c'));return respondWithRpcPromise(_0x629b('0x6d'),_0x629b('0x6e'),_0x528d33);}return null;})[_0x629b('0x21')](function(_0x1ef3ef){var _0x1fa5c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ef3ef[_0x629b('0x28')]['ContactId'];return db[_0x629b('0x6f')]['query'](_0x1fa5c6,{'type':db[_0x629b('0x70')][_0x629b('0x71')]['SELECT'],'raw':!![]})[_0x629b('0x21')](function(_0x5a1f6c){return _0x5a1f6c;});})[_0x629b('0x21')](function(_0x2576ac){if(_0x2576ac){_0x528d33[_0x629b('0x28')]['contact']=_0x2576ac[0x0];if(!_0x169f2f[_0x629b('0x57')][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x169f2f[_0x629b('0x57')]['UserId'],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),_0x629b('0x76')],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x477c5a){if(!_0x477c5a)return null;_0x528d33[_0x629b('0x28')][_0x629b('0x73')]=_0x477c5a;return _0x528d33;})[_0x629b('0x21')](function(_0x3045df){if(_0x3045df){if(_0x169f2f[_0x629b('0x57')][_0x629b('0x77')]){_0x528d33[_0x629b('0x28')]['interface']=util[_0x629b('0x60')](_0x629b('0x78'),_0x169f2f['user']['name']);_0x528d33[_0x629b('0x28')][_0x629b('0x79')]=_0x528d33[_0x629b('0x79')];_0x528d33['message']['motionChannel']=_0x528d33[_0x629b('0x79')];_0x528d33[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x5d');return respondWithRpcPromise(_0x629b('0x7b'),_0x629b('0x7b'),{'event':_0x629b('0x7c'),'message':_0x528d33[_0x629b('0x28')]},client9002)[_0x629b('0x21')](function(){return _0x528d33;});}return _0x528d33;}return null;})['then'](respondWithResult(_0x25d9e9,null))['catch'](handleError(_0x25d9e9,null));};var interaction_log=require(_0x629b('0x16'))('sms-interactions');exports[_0x629b('0x36')]=function(_0x120632,_0x37acc8,_0x15f072){var _0x523fc4={'agent':{},'channel':_0x629b('0x7d')};if(_0x120632[_0x629b('0x57')]['id']){delete _0x120632[_0x629b('0x57')]['id'];}_0x120632[_0x629b('0x57')][_0x629b('0x62')]=_0x120632[_0x629b('0x57')][_0x629b('0x62')]||_0x120632[_0x629b('0x63')]['id'];_0x523fc4[_0x629b('0x73')]['id']=_0x120632[_0x629b('0x57')][_0x629b('0x62')];return db['SmsMessage']['find']({'where':{'id':_0x120632[_0x629b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x557aa0){if(_0x557aa0){_0x523fc4['message']=_0x557aa0[_0x629b('0x64')]({'plain':!![]});return db[_0x629b('0x65')][_0x629b('0x58')]({'where':{'id':_0x557aa0[_0x629b('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x37acc8,null))[_0x629b('0x21')](function(_0x48e31e){if(_0x48e31e){_0x523fc4['interaction']=_0x48e31e['get']({'plain':!![]});interaction_log[_0x629b('0x22')](_0x629b('0x7e'),_0x120632[_0x629b('0x63')]['id'],_0x120632[_0x629b('0x63')][_0x629b('0x3a')],_0x120632['user'][_0x629b('0x6b')],_0x523fc4[_0x629b('0x69')]['id'],_0x120632[_0x629b('0x57')]?JSON[_0x629b('0x25')](_0x120632['body']):'null');return respondWithRpcPromise(_0x629b('0x7f'),_0x629b('0x80'),_0x523fc4);}return null;})[_0x629b('0x21')](function(_0x4f51cb){var _0x14585f=_0x629b('0x81')+_0x4f51cb['message'][_0x629b('0x82')];return db['sequelize'][_0x629b('0x41')](_0x14585f,{'type':db[_0x629b('0x70')][_0x629b('0x71')][_0x629b('0x83')],'raw':!![]})[_0x629b('0x21')](function(_0x1f5496){return _0x1f5496;});})[_0x629b('0x21')](function(_0x429485){if(_0x429485){_0x523fc4[_0x629b('0x28')][_0x629b('0x84')]=_0x429485[0x0];if(!_0x120632['body'][_0x629b('0x62')])return;return db[_0x629b('0x72')][_0x629b('0x58')]({'where':{'id':_0x120632[_0x629b('0x57')][_0x629b('0x62')],'role':_0x629b('0x73')},'attributes':['id',_0x629b('0x3a'),_0x629b('0x74'),_0x629b('0x75'),'internal'],'raw':!![]});}return null;})[_0x629b('0x21')](function(_0x14cf48){if(!_0x14cf48)return null;_0x523fc4[_0x629b('0x28')][_0x629b('0x73')]=_0x14cf48;return _0x523fc4;})['then'](function(_0x4e4339){if(_0x4e4339){_0x4e4339['message'][_0x629b('0x85')]=util[_0x629b('0x60')]('SIP/%s',_0x120632[_0x629b('0x63')][_0x629b('0x3a')]);_0x4e4339[_0x629b('0x28')][_0x629b('0x79')]=_0x523fc4[_0x629b('0x79')];_0x4e4339[_0x629b('0x28')][_0x629b('0x86')]=_0x523fc4['channel'];_0x4e4339[_0x629b('0x28')][_0x629b('0x7a')]=_0x629b('0x36');respondWithRpcPromise(_0x629b('0x7b'),'EventManager',{'event':_0x629b('0x87'),'message':_0x4e4339[_0x629b('0x28')]},client9002);return _0x523fc4;}return null;})[_0x629b('0x21')](respondWithResult(_0x37acc8,null))['catch'](handleError(_0x37acc8,null));};exports['status']=function(_0x1c1948,_0x410fa8,_0x3f8bc0){if(_0x1c1948[_0x629b('0x57')]['id']){delete _0x1c1948[_0x629b('0x57')]['id'];}var _0x4dfe08;return db[_0x629b('0x3d')][_0x629b('0x58')]({'where':{'id':_0x1c1948[_0x629b('0x59')]['id']}})['then'](handleEntityNotFound(_0x410fa8,null))[_0x629b('0x21')](function(_0x28f494){if(_0x28f494){_0x4dfe08=_0x28f494;return db[_0x629b('0x88')][_0x629b('0x58')]({'where':{'id':_0x28f494[_0x629b('0x89')]}});}})[_0x629b('0x21')](handleEntityNotFound(_0x410fa8,null))['then'](function(_0x5d0cdd){if(_0x5d0cdd){logger['debug'](_0x629b('0x24'),_0x629b('0x2c'),_0x629b('0x8a'),_0x5d0cdd[_0x629b('0x4d')],util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));switch(_0x5d0cdd['type']){case _0x629b('0x8c'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x8d')]===_0x4dfe08[_0x629b('0x8e')]){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),_0x629b('0x8c'),util['inspect'](_0x1c1948['body'],{'showHidden':![],'depth':null}));}break;case _0x629b('0x8f'):if(_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]&&_0x1c1948[_0x629b('0x57')][_0x629b('0x90')]===_0x4dfe08[_0x629b('0x8e')]&&_[_0x629b('0x91')](['sent',_0x629b('0x92')],_0x1c1948[_0x629b('0x57')][_0x629b('0x93')])>=0x0){return _0x4dfe08[_0x629b('0x38')]({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'plivio',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;case _0x629b('0x94'):var _0x1a1007=_0x1c1948[_0x629b('0x57')]['results'][0x0];if(_0x1a1007[_0x629b('0x2c')]['groupName']===_0x629b('0x95')){return _0x4dfe08['update']({'read':!![]});}else{logger[_0x629b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x629b('0x2c'),'infobip',util[_0x629b('0x8b')](_0x1c1948[_0x629b('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4dfe08;}})[_0x629b('0x21')](respondWithResult(_0x410fa8,null))['catch'](handleError(_0x410fa8,null));}; \ No newline at end of file +var _0xeb7e=['read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','inspect','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsMessage','includeAll','include','catch','show','params','length','create','body','find','describe','sms-interactions','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil'];(function(_0x11df8e,_0xd5434d){var _0x23d436=function(_0x26df9a){while(--_0x26df9a){_0x11df8e['push'](_0x11df8e['shift']());}};_0x23d436(++_0xd5434d);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0x4e70b4,_0x2dca45){_0x4e70b4=_0x4e70b4-0x0;var _0x325c1e=_0xeb7e[_0x4e70b4];return _0x325c1e;};'use strict';var emlformat=require(_0xeeb7('0x0'));var rimraf=require(_0xeeb7('0x1'));var zipdir=require(_0xeeb7('0x2'));var jsonpatch=require(_0xeeb7('0x3'));var rp=require(_0xeeb7('0x4'));var moment=require(_0xeeb7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeeb7('0x6'));var util=require(_0xeeb7('0x7'));var path=require(_0xeeb7('0x8'));var sox=require(_0xeeb7('0x9'));var csv=require(_0xeeb7('0xa'));var ejs=require(_0xeeb7('0xb'));var fs=require('fs');var fs_extra=require(_0xeeb7('0xc'));var _=require(_0xeeb7('0xd'));var squel=require('squel');var crypto=require(_0xeeb7('0xe'));var jsforce=require(_0xeeb7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeeb7('0xa'));var querystring=require('querystring');var Papa=require(_0xeeb7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeeb7('0x11'));var hardwareService=require(_0xeeb7('0x12'));var logger=require(_0xeeb7('0x13'))(_0xeeb7('0x14'));var utils=require(_0xeeb7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeeb7('0x16'));var db=require(_0xeeb7('0x17'))['db'];config['redis']=_['defaults'](config[_0xeeb7('0x18')],{'host':_0xeeb7('0x19'),'port':0x18eb});var socket=require(_0xeeb7('0x1a'))(new Redis(config[_0xeeb7('0x18')]));require(_0xeeb7('0x1b'))[_0xeeb7('0x1c')](socket);var jayson=require(_0xeeb7('0x1d'));var client=jayson['client'][_0xeeb7('0x1e')]({'port':0x232c});var client9002=jayson[_0xeeb7('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300988,_0x38b145,_0x409d59,_0xa6633b){return new BPromise(function(_0x2c1e23,_0x24a9a5){var _0x353218=_0xa6633b||client;return _0x353218[_0xeeb7('0x20')](_0x300988,_0x409d59)[_0xeeb7('0x21')](function(_0x3b1ce2){logger[_0xeeb7('0x22')](_0xeeb7('0x23'),_0x38b145,_0xeeb7('0x24'));logger[_0xeeb7('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x38b145,_0xeeb7('0x24'),JSON[_0xeeb7('0x26')](_0x3b1ce2));if(_0x3b1ce2[_0xeeb7('0x27')]){if(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x28')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x38b145,_0x3b1ce2[_0xeeb7('0x27')]['message']);return _0x24a9a5(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);}logger[_0xeeb7('0x27')](_0xeeb7('0x23'),_0x38b145,_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);return _0x2c1e23(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);}else{logger[_0xeeb7('0x22')]('SmsMessage,\x20%s,\x20%s',_0x38b145,_0xeeb7('0x24'));_0x2c1e23(_0x3b1ce2[_0xeeb7('0x2a')][_0xeeb7('0x29')]);}})['catch'](function(_0x3c189d){logger[_0xeeb7('0x27')](_0xeeb7('0x23'),_0x38b145,_0x3c189d);_0x24a9a5(_0x3c189d);});});}function respondWithStatusCode(_0x3d5e54,_0x5581f0){_0x5581f0=_0x5581f0||0xcc;return function(_0x1956f8){if(_0x1956f8){return _0x3d5e54[_0xeeb7('0x2b')](_0x5581f0);}return _0x3d5e54[_0xeeb7('0x2c')](_0x5581f0)[_0xeeb7('0x2d')]();};}function respondWithResult(_0x468ea8,_0x2fe923){_0x2fe923=_0x2fe923||0xc8;return function(_0x364237){if(_0x364237){return _0x468ea8['status'](_0x2fe923)['json'](_0x364237);}};}function respondWithFilteredResult(_0x4debcf,_0x5ef864){return function(_0x4f5707){if(_0x4f5707){var _0x439dac=typeof _0x5ef864['offset']===_0xeeb7('0x2e')&&typeof _0x5ef864[_0xeeb7('0x2f')]===_0xeeb7('0x2e');var _0x581e0b=_0x4f5707[_0xeeb7('0x30')];var _0x271afa=_0x439dac?0x0:_0x5ef864[_0xeeb7('0x31')];var _0x3da78d=_0x439dac?_0x4f5707[_0xeeb7('0x30')]:_0x5ef864[_0xeeb7('0x31')]+_0x5ef864[_0xeeb7('0x2f')];var _0x317777;if(_0x3da78d>=_0x581e0b){_0x3da78d=_0x581e0b;_0x317777=0xc8;}else{_0x317777=0xce;}_0x4debcf[_0xeeb7('0x2c')](_0x317777);return _0x4debcf[_0xeeb7('0x32')](_0xeeb7('0x33'),_0x271afa+'-'+_0x3da78d+'/'+_0x581e0b)[_0xeeb7('0x34')](_0x4f5707);}return null;};}function patchUpdates(_0x1bc1c3){return function(_0x162197){try{jsonpatch[_0xeeb7('0x35')](_0x162197,_0x1bc1c3,!![]);}catch(_0x1f1d75){return BPromise[_0xeeb7('0x36')](_0x1f1d75);}return _0x162197['save']();};}function saveUpdates(_0x3af784,_0x1a78d3){return function(_0x5a8f04){if(_0x5a8f04){return _0x5a8f04[_0xeeb7('0x37')](_0x3af784)[_0xeeb7('0x21')](function(_0x115466){return _0x115466;});}return null;};}function removeEntity(_0x245e04,_0x5a4d01){return function(_0x2d0f3c){if(_0x2d0f3c){return _0x2d0f3c[_0xeeb7('0x38')]()[_0xeeb7('0x21')](function(){_0x245e04[_0xeeb7('0x2c')](0xcc)[_0xeeb7('0x2d')]();});}};}function handleEntityNotFound(_0x5c33b5,_0x20f2d1){return function(_0x2c8743){if(!_0x2c8743){_0x5c33b5[_0xeeb7('0x2b')](0x194);}return _0x2c8743;};}function handleError(_0x7ba0e5,_0x5e5c9f){_0x5e5c9f=_0x5e5c9f||0x1f4;return function(_0x4c2e8b){logger['error'](_0x4c2e8b[_0xeeb7('0x39')]);if(_0x4c2e8b[_0xeeb7('0x3a')]){delete _0x4c2e8b[_0xeeb7('0x3a')];}_0x7ba0e5[_0xeeb7('0x2c')](_0x5e5c9f)[_0xeeb7('0x3b')](_0x4c2e8b);};}exports[_0xeeb7('0x3c')]=function(_0x3a479e,_0x5d114a){var _0x1a062c={},_0x12ce5f={},_0x2fa188={'count':0x0,'rows':[]};var _0x185d8b=_[_0xeeb7('0x3d')](db['SmsMessage']['rawAttributes'],function(_0x979c03){return{'name':_0x979c03[_0xeeb7('0x3e')],'type':_0x979c03['type'][_0xeeb7('0x3f')]};});_0x12ce5f[_0xeeb7('0x40')]=_[_0xeeb7('0x3d')](_0x185d8b,_0xeeb7('0x3a'));_0x12ce5f['query']=_[_0xeeb7('0x41')](_0x3a479e[_0xeeb7('0x42')]);_0x12ce5f[_0xeeb7('0x43')]=_['intersection'](_0x12ce5f[_0xeeb7('0x40')],_0x12ce5f[_0xeeb7('0x42')]);_0x1a062c[_0xeeb7('0x44')]=_[_0xeeb7('0x45')](_0x12ce5f[_0xeeb7('0x40')],qs[_0xeeb7('0x46')](_0x3a479e['query'][_0xeeb7('0x46')]));_0x1a062c['attributes']=_0x1a062c['attributes']['length']?_0x1a062c[_0xeeb7('0x44')]:_0x12ce5f[_0xeeb7('0x40')];if(!_0x3a479e['query'][_0xeeb7('0x47')](_0xeeb7('0x48'))){_0x1a062c[_0xeeb7('0x2f')]=qs[_0xeeb7('0x2f')](_0x3a479e['query'][_0xeeb7('0x2f')]);_0x1a062c[_0xeeb7('0x31')]=qs['offset'](_0x3a479e[_0xeeb7('0x42')]['offset']);}_0x1a062c['order']=qs['sort'](_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x49')]);_0x1a062c[_0xeeb7('0x4a')]=qs[_0xeeb7('0x43')](_[_0xeeb7('0x4b')](_0x3a479e[_0xeeb7('0x42')],_0x12ce5f[_0xeeb7('0x43')]),_0x185d8b);if(_0x3a479e[_0xeeb7('0x42')]['filter']){_0x1a062c['where']=_[_0xeeb7('0x4c')](_0x1a062c[_0xeeb7('0x4a')],{'$or':_[_0xeeb7('0x3d')](_0x185d8b,function(_0x93ee0e){if(_0x93ee0e[_0xeeb7('0x4d')]!==_0xeeb7('0x4e')){var _0x3842af={};_0x3842af[_0x93ee0e['name']]={'$like':'%'+_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x4f')]+'%'};return _0x3842af;}})});}_0x1a062c=_['merge']({},_0x1a062c,_0x3a479e[_0xeeb7('0x50')]);var _0x30785a={'where':_0x1a062c[_0xeeb7('0x4a')]};return db[_0xeeb7('0x51')][_0xeeb7('0x30')](_0x30785a)[_0xeeb7('0x21')](function(_0x44cbd0){_0x2fa188['count']=_0x44cbd0;if(_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x52')]){_0x1a062c[_0xeeb7('0x53')]=[{'all':!![]}];}return db[_0xeeb7('0x51')]['findAll'](_0x1a062c);})[_0xeeb7('0x21')](function(_0x8ba840){_0x2fa188['rows']=_0x8ba840;return _0x2fa188;})[_0xeeb7('0x21')](respondWithFilteredResult(_0x5d114a,_0x1a062c))[_0xeeb7('0x54')](handleError(_0x5d114a,null));};exports[_0xeeb7('0x55')]=function(_0x1e6c7e,_0x3d781c){var _0x2810d1={'raw':!![],'where':{'id':_0x1e6c7e[_0xeeb7('0x56')]['id']}},_0x1021cd={};_0x1021cd[_0xeeb7('0x40')]=_[_0xeeb7('0x41')](db[_0xeeb7('0x51')]['rawAttributes']);_0x1021cd['query']=_[_0xeeb7('0x41')](_0x1e6c7e[_0xeeb7('0x42')]);_0x1021cd['filters']=_['intersection'](_0x1021cd['model'],_0x1021cd[_0xeeb7('0x42')]);_0x2810d1[_0xeeb7('0x44')]=_[_0xeeb7('0x45')](_0x1021cd[_0xeeb7('0x40')],qs[_0xeeb7('0x46')](_0x1e6c7e[_0xeeb7('0x42')][_0xeeb7('0x46')]));_0x2810d1[_0xeeb7('0x44')]=_0x2810d1[_0xeeb7('0x44')][_0xeeb7('0x57')]?_0x2810d1[_0xeeb7('0x44')]:_0x1021cd[_0xeeb7('0x40')];if(_0x1e6c7e[_0xeeb7('0x42')]['includeAll']){_0x2810d1['include']=[{'all':!![]}];}_0x2810d1=_[_0xeeb7('0x4c')]({},_0x2810d1,_0x1e6c7e[_0xeeb7('0x50')]);return db['SmsMessage']['find'](_0x2810d1)['then'](handleEntityNotFound(_0x3d781c,null))['then'](respondWithResult(_0x3d781c,null))[_0xeeb7('0x54')](handleError(_0x3d781c,null));};exports[_0xeeb7('0x58')]=function(_0x72707f,_0x4d554e){return db[_0xeeb7('0x51')]['create'](_0x72707f[_0xeeb7('0x59')],{})[_0xeeb7('0x21')](respondWithResult(_0x4d554e,0xc9))[_0xeeb7('0x54')](handleError(_0x4d554e,null));};exports['update']=function(_0x16b00a,_0x46a216){if(_0x16b00a[_0xeeb7('0x59')]['id']){delete _0x16b00a[_0xeeb7('0x59')]['id'];}return db[_0xeeb7('0x51')]['find']({'where':{'id':_0x16b00a['params']['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x46a216,null))[_0xeeb7('0x21')](saveUpdates(_0x16b00a[_0xeeb7('0x59')],null))[_0xeeb7('0x21')](respondWithResult(_0x46a216,null))[_0xeeb7('0x54')](handleError(_0x46a216,null));};exports[_0xeeb7('0x38')]=function(_0x2f2065,_0x22b0a1){return db['SmsMessage'][_0xeeb7('0x5a')]({'where':{'id':_0x2f2065[_0xeeb7('0x56')]['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x22b0a1,null))['then'](removeEntity(_0x22b0a1,null))[_0xeeb7('0x54')](handleError(_0x22b0a1,null));};exports[_0xeeb7('0x5b')]=function(_0x20f41b,_0x3c5dd5){return db['SmsMessage'][_0xeeb7('0x5b')]()['then'](respondWithResult(_0x3c5dd5,null))[_0xeeb7('0x54')](handleError(_0x3c5dd5,null));};var interaction_log=require(_0xeeb7('0x13'))(_0xeeb7('0x5c'));exports['accept']=function(_0x44b4a7,_0x21837c,_0x54b240){var _0x5f5c68={'agent':{},'channel':_0xeeb7('0x5d')};if(_0x44b4a7[_0xeeb7('0x59')]['id']){delete _0x44b4a7[_0xeeb7('0x59')]['id'];}_0x44b4a7['body']['read']=!![];_0x44b4a7[_0xeeb7('0x59')]['readAt']=moment()[_0xeeb7('0x5e')](_0xeeb7('0x5f'));_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')]=_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')]||_0x44b4a7['user']['id'];_0x5f5c68[_0xeeb7('0x61')]['id']=_0x44b4a7['body'][_0xeeb7('0x60')];return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x44b4a7['params']['id'],'UserId':null}})[_0xeeb7('0x21')](handleEntityNotFound(_0x21837c,null))['then'](saveUpdates(_0x44b4a7[_0xeeb7('0x59')],null))[_0xeeb7('0x21')](function(_0x3c6b29){if(_0x3c6b29){_0x5f5c68[_0xeeb7('0x29')]=_0x3c6b29[_0xeeb7('0x62')]({'plain':!![]});return db[_0xeeb7('0x63')][_0xeeb7('0x5a')]({'where':{'id':_0x3c6b29[_0xeeb7('0x64')]}});}return null;})[_0xeeb7('0x21')](handleEntityNotFound(_0x21837c,null))[_0xeeb7('0x21')](function(_0x5cadb6){if(_0x5cadb6){return _0x5cadb6[_0xeeb7('0x37')]({'UserId':_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')],'read1stAt':_[_0xeeb7('0x65')](_0x5cadb6[_0xeeb7('0x66')])?moment()[_0xeeb7('0x5e')](_0xeeb7('0x5f')):undefined});}return null;})[_0xeeb7('0x21')](function(_0x12c5be){if(_0x12c5be){_0x5f5c68['interaction']=_0x12c5be[_0xeeb7('0x62')]({'plain':!![]});interaction_log[_0xeeb7('0x22')](_0xeeb7('0x67'),_0x44b4a7[_0xeeb7('0x68')]['id'],_0x44b4a7['user'][_0xeeb7('0x3a')],_0x44b4a7[_0xeeb7('0x68')][_0xeeb7('0x69')],_0x5f5c68['interaction']['id'],_0x44b4a7[_0xeeb7('0x59')]?JSON['stringify'](_0x44b4a7[_0xeeb7('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xeeb7('0x6a'),_0x5f5c68);}return null;})[_0xeeb7('0x21')](function(_0x53e237){var _0x4bd9d7=_0xeeb7('0x6b')+_0x53e237[_0xeeb7('0x29')][_0xeeb7('0x6c')];return db[_0xeeb7('0x6d')][_0xeeb7('0x42')](_0x4bd9d7,{'type':db['Sequelize'][_0xeeb7('0x6e')][_0xeeb7('0x6f')],'raw':!![]})[_0xeeb7('0x21')](function(_0x54bcaf){return _0x54bcaf;});})[_0xeeb7('0x21')](function(_0x197832){if(_0x197832){_0x5f5c68['message'][_0xeeb7('0x70')]=_0x197832[0x0];if(!_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')])return;return db[_0xeeb7('0x71')]['find']({'where':{'id':_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')],'role':_0xeeb7('0x61')},'attributes':['id','name',_0xeeb7('0x72'),_0xeeb7('0x73'),_0xeeb7('0x74')],'raw':!![]});}return null;})[_0xeeb7('0x21')](function(_0x198da5){if(!_0x198da5)return null;_0x5f5c68[_0xeeb7('0x29')][_0xeeb7('0x61')]=_0x198da5;return _0x5f5c68;})[_0xeeb7('0x21')](function(_0x3a21cb){if(_0x3a21cb){if(_0x44b4a7[_0xeeb7('0x59')]['manual']){_0x5f5c68['message'][_0xeeb7('0x75')]=util[_0xeeb7('0x5e')](_0xeeb7('0x76'),_0x44b4a7['user']['name']);_0x5f5c68[_0xeeb7('0x29')]['channel']=_0x5f5c68[_0xeeb7('0x77')];_0x5f5c68[_0xeeb7('0x29')][_0xeeb7('0x78')]=_0x5f5c68[_0xeeb7('0x77')];_0x5f5c68['message']['event']=_0xeeb7('0x79');return respondWithRpcPromise(_0xeeb7('0x7a'),'EventManager',{'event':_0xeeb7('0x7b'),'message':_0x5f5c68['message']},client9002)['then'](function(){return _0x5f5c68;});}return _0x5f5c68;}return null;})[_0xeeb7('0x21')](respondWithResult(_0x21837c,null))[_0xeeb7('0x54')](handleError(_0x21837c,null));};var interaction_log=require('../../config/logger')(_0xeeb7('0x5c'));exports[_0xeeb7('0x36')]=function(_0x377653,_0x46c2a4,_0xfd0486){var _0x24a405={'agent':{},'channel':_0xeeb7('0x5d')};if(_0x377653[_0xeeb7('0x59')]['id']){delete _0x377653['body']['id'];}_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')]=_0x377653['body'][_0xeeb7('0x60')]||_0x377653[_0xeeb7('0x68')]['id'];_0x24a405[_0xeeb7('0x61')]['id']=_0x377653[_0xeeb7('0x59')]['UserId'];return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x377653[_0xeeb7('0x56')]['id'],'UserId':null}})[_0xeeb7('0x21')](handleEntityNotFound(_0x46c2a4,null))[_0xeeb7('0x21')](function(_0x1f0ca4){if(_0x1f0ca4){_0x24a405[_0xeeb7('0x29')]=_0x1f0ca4[_0xeeb7('0x62')]({'plain':!![]});return db[_0xeeb7('0x63')][_0xeeb7('0x5a')]({'where':{'id':_0x1f0ca4[_0xeeb7('0x64')]}});}return null;})[_0xeeb7('0x21')](handleEntityNotFound(_0x46c2a4,null))[_0xeeb7('0x21')](function(_0x2c2700){if(_0x2c2700){_0x24a405[_0xeeb7('0x7c')]=_0x2c2700[_0xeeb7('0x62')]({'plain':!![]});interaction_log[_0xeeb7('0x22')](_0xeeb7('0x7d'),_0x377653['user']['id'],_0x377653[_0xeeb7('0x68')]['name'],_0x377653[_0xeeb7('0x68')][_0xeeb7('0x69')],_0x24a405['interaction']['id'],_0x377653[_0xeeb7('0x59')]?JSON['stringify'](_0x377653[_0xeeb7('0x59')]):_0xeeb7('0x7e'));return respondWithRpcPromise(_0xeeb7('0x7f'),_0xeeb7('0x80'),_0x24a405);}return null;})[_0xeeb7('0x21')](function(_0x2d3fa3){var _0x54f142='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d3fa3[_0xeeb7('0x29')][_0xeeb7('0x6c')];return db[_0xeeb7('0x6d')][_0xeeb7('0x42')](_0x54f142,{'type':db[_0xeeb7('0x81')][_0xeeb7('0x6e')][_0xeeb7('0x6f')],'raw':!![]})[_0xeeb7('0x21')](function(_0x57ddec){return _0x57ddec;});})[_0xeeb7('0x21')](function(_0x4e9dc1){if(_0x4e9dc1){_0x24a405[_0xeeb7('0x29')][_0xeeb7('0x70')]=_0x4e9dc1[0x0];if(!_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')])return;return db[_0xeeb7('0x71')][_0xeeb7('0x5a')]({'where':{'id':_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')],'role':'agent'},'attributes':['id',_0xeeb7('0x3a'),'fullname','email',_0xeeb7('0x74')],'raw':!![]});}return null;})[_0xeeb7('0x21')](function(_0x951f62){if(!_0x951f62)return null;_0x24a405['message'][_0xeeb7('0x61')]=_0x951f62;return _0x24a405;})[_0xeeb7('0x21')](function(_0x3cc143){if(_0x3cc143){_0x3cc143[_0xeeb7('0x29')][_0xeeb7('0x75')]=util['format'](_0xeeb7('0x76'),_0x377653['user'][_0xeeb7('0x3a')]);_0x3cc143[_0xeeb7('0x29')][_0xeeb7('0x77')]=_0x24a405[_0xeeb7('0x77')];_0x3cc143['message'][_0xeeb7('0x78')]=_0x24a405[_0xeeb7('0x77')];_0x3cc143['message']['event']='reject';respondWithRpcPromise(_0xeeb7('0x7a'),'EventManager',{'event':_0xeeb7('0x82'),'message':_0x3cc143[_0xeeb7('0x29')]},client9002);return _0x24a405;}return null;})['then'](respondWithResult(_0x46c2a4,null))[_0xeeb7('0x54')](handleError(_0x46c2a4,null));};exports[_0xeeb7('0x2c')]=function(_0x1e7c22,_0x459c60,_0x322c8b){if(_0x1e7c22[_0xeeb7('0x59')]['id']){delete _0x1e7c22[_0xeeb7('0x59')]['id'];}var _0xd78377;return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x1e7c22[_0xeeb7('0x56')]['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x459c60,null))[_0xeeb7('0x21')](function(_0x2ce572){if(_0x2ce572){_0xd78377=_0x2ce572;return db[_0xeeb7('0x83')]['find']({'where':{'id':_0x2ce572[_0xeeb7('0x84')]}});}})[_0xeeb7('0x21')](handleEntityNotFound(_0x459c60,null))[_0xeeb7('0x21')](function(_0x2b7d00){if(_0x2b7d00){logger['debug'](_0xeeb7('0x85'),'status',_0xeeb7('0x86'),_0x2b7d00[_0xeeb7('0x4d')],util['inspect'](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));switch(_0x2b7d00[_0xeeb7('0x4d')]){case _0xeeb7('0x87'):if(_0x1e7c22['body'][_0xeeb7('0x88')]&&_0x1e7c22['body'][_0xeeb7('0x88')]===_0xd78377[_0xeeb7('0x89')]){return _0xd78377['update']({'read':!![]});}else{logger['error'](_0xeeb7('0x8a'),_0xeeb7('0x2c'),'twilio',util['inspect'](_0x1e7c22['body'],{'showHidden':![],'depth':null}));}break;case _0xeeb7('0x8b'):if(_0x1e7c22[_0xeeb7('0x59')][_0xeeb7('0x8c')]&&_0x1e7c22['body'][_0xeeb7('0x8c')]===_0xd78377[_0xeeb7('0x89')]&&_['indexOf']([_0xeeb7('0x8d'),_0xeeb7('0x8e')],_0x1e7c22[_0xeeb7('0x59')][_0xeeb7('0x8f')])>=0x0){return _0xd78377[_0xeeb7('0x37')]({'read':!![]});}else{logger[_0xeeb7('0x27')](_0xeeb7('0x8a'),_0xeeb7('0x2c'),_0xeeb7('0x90'),util[_0xeeb7('0x91')](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));}break;case _0xeeb7('0x92'):var _0x2a1db6=_0x1e7c22['body'][_0xeeb7('0x93')][0x0];if(_0x2a1db6['status'][_0xeeb7('0x94')]===_0xeeb7('0x95')){return _0xd78377['update']({'read':!![]});}else{logger[_0xeeb7('0x27')](_0xeeb7('0x8a'),_0xeeb7('0x2c'),'infobip',util[_0xeeb7('0x91')](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));}break;}return _0xd78377;}})[_0xeeb7('0x21')](respondWithResult(_0x459c60,null))[_0xeeb7('0x54')](handleError(_0x459c60,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 4044c80..ff79a63 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 _0x8ff6=['../../mysqldb','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x4b2037,_0x41055c){var _0x48599b=function(_0x251da3){while(--_0x251da3){_0x4b2037['push'](_0x4b2037['shift']());}};_0x48599b(++_0x41055c);}(_0x8ff6,0x1df));var _0x68ff=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x8ff6[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0x68ff('0x0'));var SmsMessage=require(_0x68ff('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x68ff('0x2')](0x0);var events={'afterCreate':_0x68ff('0x3'),'afterUpdate':'update','afterDestroy':_0x68ff('0x4')};function emitEvent(_0x9802cc){return function(_0x3f305a,_0x4001f5,_0x5553e4){SmsMessageEvents[_0x68ff('0x5')](_0x9802cc+':'+_0x3f305a['id'],_0x3f305a);SmsMessageEvents['emit'](_0x9802cc,_0x3f305a);_0x5553e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x68ff('0x6')](e,emitEvent(event));}}module[_0x68ff('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xf618=['save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x451b32,_0x1eace6){var _0x4ac489=function(_0x458d72){while(--_0x458d72){_0x451b32['push'](_0x451b32['shift']());}};_0x4ac489(++_0x1eace6);}(_0xf618,0x1b4));var _0x8f61=function(_0x2c00e7,_0x507037){_0x2c00e7=_0x2c00e7-0x0;var _0x13fbca=_0xf618[_0x2c00e7];return _0x13fbca;};'use strict';var EventEmitter=require(_0x8f61('0x0'));var SmsMessage=require(_0x8f61('0x1'))['db'][_0x8f61('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8f61('0x3')](0x0);var events={'afterCreate':_0x8f61('0x4'),'afterUpdate':_0x8f61('0x5'),'afterDestroy':_0x8f61('0x6')};function emitEvent(_0x3ca9f7){return function(_0x160066,_0x579e25,_0xf6fe1a){SmsMessageEvents['emit'](_0x3ca9f7+':'+_0x160066['id'],_0x160066);SmsMessageEvents['emit'](_0x3ca9f7,_0x160066);_0xf6fe1a(null);};}for(var e in events){if(events[_0x8f61('0x7')](e)){var event=events[e];SmsMessage[_0x8f61('0x8')](e,emitEvent(event));}}module[_0x8f61('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bf1c903..e320d8d 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 _0x9a05=['POST','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','text','keys','length','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','direction','error','secret','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','username','GET','split','session_key','internal_order_id','read','inspect','catch','Missing\x20parameters:\x20username,\x20password','senderString'];(function(_0x79c44,_0x69b694){var _0x2df76c=function(_0xbdf830){while(--_0xbdf830){_0x79c44['push'](_0x79c44['shift']());}};_0x2df76c(++_0x69b694);}(_0x9a05,0x126));var _0x59a0=function(_0x2f5d8f,_0x2224c6){_0x2f5d8f=_0x2f5d8f-0x0;var _0x2b3bd7=_0x9a05[_0x2f5d8f];return _0x2b3bd7;};'use strict';var _=require('lodash');var util=require(_0x59a0('0x0'));var logger=require(_0x59a0('0x1'))(_0x59a0('0x2'));var moment=require(_0x59a0('0x3'));var BPromise=require(_0x59a0('0x4'));var rp=require(_0x59a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59a0('0x6'));var attributes=require(_0x59a0('0x7'));module['exports']=function(_0x1cc052,_0x4f362e){return _0x1cc052[_0x59a0('0x8')](_0x59a0('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x59a0('0xa'),'fields':['messageId']},{'name':_0x59a0('0xb'),'fields':[_0x59a0('0xc')],'type':_0x59a0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34668e,_0x185f8e,_0x1b54b3){var _0x135d96=_0x1cc052[_0x59a0('0xe')];var _0x12701a=_0x34668e[_0x59a0('0xf')]({'plain':!![]});if(_0x12701a['direction']['toLowerCase']()==='in'||_0x12701a['direction'][_0x59a0('0x10')]()===_0x59a0('0x11')&&!_0x12701a['secret']&&!_[_0x59a0('0x12')](_0x12701a[_0x59a0('0x13')])&&!_[_0x59a0('0x12')](_0x12701a[_0x59a0('0x14')])){_0x135d96[_0x59a0('0x15')][_0x59a0('0x16')]({'where':{'id':_0x12701a['SmsInteractionId']}})[_0x59a0('0x17')](function(_0x50351e){if(_0x50351e){_0x50351e[_0x59a0('0x18')]({'lastMsgAt':_0x12701a['createdAt'],'lastMsgDirection':_0x12701a[_0x59a0('0x19')]['toLowerCase']()});}})['catch'](function(_0x56f9cf){console[_0x59a0('0x1a')](_0x56f9cf);});}if(_0x12701a[_0x59a0('0x19')]===_0x59a0('0x11')&&!_0x12701a[_0x59a0('0x1b')]){var _0x5dd177;_0x135d96['SmsAccount'][_0x59a0('0x1c')]({'where':{'id':_0x12701a['SmsAccountId']},'raw':!![]})['then'](function(_0x1a6a90){_0x5dd177=_0x1a6a90;if(_0x5dd177&&_0x5dd177[_0x59a0('0x1d')]){switch(_0x5dd177[_0x59a0('0x1d')]){case _0x59a0('0x1e'):var _0x4b1669=require('twilio');if(_0x5dd177[_0x59a0('0x1f')]&&_0x5dd177[_0x59a0('0x20')]&&_0x5dd177[_0x59a0('0x21')]){var _0x1be65f=new _0x4b1669(_0x5dd177[_0x59a0('0x1f')],_0x5dd177[_0x59a0('0x20')]);_0x1be65f[_0x59a0('0x22')][_0x59a0('0x23')]({'body':_0x12701a[_0x59a0('0xc')],'to':_0x12701a[_0x59a0('0x21')],'from':_0x5dd177[_0x59a0('0x21')],'statusCallback':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177['token']})['then'](function(_0x4cf065){if(_0x4cf065[_0x59a0('0x27')]){return _0x34668e[_0x59a0('0x18')]({'messageId':_0x4cf065[_0x59a0('0x27')]});}})['catch'](function(_0x5c472d){logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x1e'),util['inspect'](_0x5c472d,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate',_0x59a0('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x59a0('0x2a'):var _0x34c18a=_0x59a0('0x2b');if(_0x5dd177['username']&&_0x5dd177[_0x59a0('0x2c')]){var _0x5a233a={'recipient':[_0x12701a['phone']],'message':_0x12701a[_0x59a0('0xc')],'message_type':_0x5dd177[_0x59a0('0x2d')]};if(_0x5dd177[_0x59a0('0x2d')]&&_0x5dd177['smsMethod']!=='SI'){_0x5a233a[_0x59a0('0x2e')]=_0x5dd177['phone'];}var _0x3a7599={'url':_0x34c18a+'login?username='+_0x5dd177[_0x59a0('0x2f')]+'&password='+_0x5dd177[_0x59a0('0x2c')],'method':_0x59a0('0x30')};rp(_0x3a7599)[_0x59a0('0x17')](function(_0x5a4c7f){var _0x2b797f=_0x5a4c7f[_0x59a0('0x31')](';');var _0xd49dce={'user_key':_0x2b797f[0x0],'session_key':_0x2b797f[0x1]};_0x3a7599={'url':_0x34c18a+'sms','method':'POST','headers':{'user_key':_0xd49dce['user_key'],'Session_key':_0xd49dce[_0x59a0('0x32')]},'json':!![],'body':_0x5a233a};return rp(_0x3a7599);})[_0x59a0('0x17')](function(_0x18acd5){if(_0x18acd5['total_sent']>=0x1){var _0x22c587={'messageId':_0x18acd5[_0x59a0('0x33')]};if(_0x5dd177['smsMethod']!=='GP'||!_0x5dd177['deliveryReport']){_0x22c587[_0x59a0('0x34')]=!![];}return _0x34668e['update'](_0x22c587);}else{return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x2a'),util[_0x59a0('0x35')](_0x18acd5,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0xfc7ccb){return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','skebby',util[_0x59a0('0x35')](_0xfc7ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x2a'),_0x59a0('0x37'));}break;case'connectel':if(_0x5dd177[_0x59a0('0x20')]){var _0x1141a4={'recipient':_0x12701a[_0x59a0('0x21')],'message':_0x12701a[_0x59a0('0xc')],'sender':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')],'authorization':_0x5dd177[_0x59a0('0x20')]};var _0x185f8e={'method':_0x59a0('0x39'),'uri':_0x59a0('0x3a'),'body':_0x1141a4,'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x340d8d){var _0x273d4b={'messageId':_0x340d8d[_0x59a0('0x3b')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x273d4b[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x273d4b);})[_0x59a0('0x36')](function(_0x2322ab){logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','connectel',util['inspect'](_0x2322ab,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x3d'),_0x59a0('0x3e'));}break;case _0x59a0('0x3f'):if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){var _0x1141a4={'messages':[{'source':'xCALLY\x20Motion','to':_0x12701a['phone'],'body':_0x12701a[_0x59a0('0xc')],'from':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')]}]};var _0x1b8bd0=util[_0x59a0('0x40')]('%s:%s',_0x5dd177[_0x59a0('0x2f')],_0x5dd177[_0x59a0('0x2c')]);var _0x185f8e={'method':'POST','uri':_0x59a0('0x41'),'body':_0x1141a4,'headers':{'Authorization':util['format'](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')]('base64'))},'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x51206d){if(_0x51206d[_0x59a0('0x44')]>=0xc8&&_0x51206d[_0x59a0('0x44')]<=0xce){if(_0x51206d[_0x59a0('0x45')]&&_0x51206d[_0x59a0('0x45')][_0x59a0('0x46')]>0x0){var _0x23adc8=_[_0x59a0('0x47')](_0x51206d[_0x59a0('0x45')][_0x59a0('0x22')]);var _0x43da82={'messageId':_0x23adc8[_0x59a0('0x48')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x43da82[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x43da82);}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'clickSend',util['inspect'](_0x51206d,{'showHidden':![],'depth':null}));}}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),util[_0x59a0('0x35')](_0x51206d,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x4cf2cc){logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),util[_0x59a0('0x35')](_0x4cf2cc,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x49'),_0x59a0('0x37'));}break;case _0x59a0('0x4a'):if(_0x5dd177[_0x59a0('0x4b')]&&_0x5dd177['authToken']){var _0x1141a4={'dst':_0x12701a[_0x59a0('0x21')],'text':_0x12701a[_0x59a0('0xc')],'src':_0x5dd177[_0x59a0('0x38')]||_0x5dd177[_0x59a0('0x21')],'url':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177[_0x59a0('0x4c')]};var _0x1b8bd0=util[_0x59a0('0x40')]('%s:%s',_0x5dd177['authId'],_0x5dd177['authToken']);var _0x185f8e={'method':_0x59a0('0x39'),'uri':util[_0x59a0('0x40')](_0x59a0('0x4d'),_0x5dd177[_0x59a0('0x4b')]),'body':_0x1141a4,'headers':{'Authorization':util['format'](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')](_0x59a0('0x4e')))},'json':!![]};rp(_0x185f8e)[_0x59a0('0x17')](function(_0x58d38d){var _0x9f6c7d={'messageId':_0x58d38d[_0x59a0('0x4f')][0x0]};return _0x34668e[_0x59a0('0x18')](_0x9f6c7d);})[_0x59a0('0x36')](function(_0x51b798){logger['error'](_0x59a0('0x28'),'afterCreate',_0x59a0('0x4a'),util[_0x59a0('0x35')](_0x51b798,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x4a'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){if(_0x5dd177[_0x59a0('0x50')]){var _0x2a180b={'method':_0x59a0('0x39'),'uri':_0x5dd177['baseUrl']+_0x59a0('0x51'),'body':{'username':_0x5dd177['username'],'password':_0x5dd177[_0x59a0('0x2c')]},'json':!![]};return rp(_0x2a180b)[_0x59a0('0x17')](function(_0x22f877){var _0x280061={'method':_0x59a0('0x39'),'uri':_0x5dd177['baseUrl']+_0x59a0('0x52'),'body':{'messages':[{'from':_0x5dd177[_0x59a0('0x21')],'destinations':[{'to':_0x12701a[_0x59a0('0x21')]}],'text':_0x12701a[_0x59a0('0xc')],'notifyUrl':_0x5dd177[_0x59a0('0x24')]+_0x59a0('0x25')+_0x12701a['id']+_0x59a0('0x26')+_0x5dd177[_0x59a0('0x4c')],'notifyContentType':_0x59a0('0x53'),'callbackData':_0x5dd177['phone']+';'+_0x12701a[_0x59a0('0xc')]}]},'headers':{'Authorization':_0x59a0('0x54')+_0x22f877[_0x59a0('0x4c')]},'json':!![]};return rp(_0x280061)['then'](function(_0x290ff1){if(_0x290ff1[_0x59a0('0x22')]){var _0x58c415={'messageId':_0x290ff1[_0x59a0('0x22')][0x0]['messageId']};if(!_0x5dd177[_0x59a0('0x3c')]){_0x58c415[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x58c415);}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','infobip',util['inspect'](_0x290ff1,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x790c08){return logger[_0x59a0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x55'),util['inspect'](_0x790c08,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'infobip',_0x59a0('0x37'));}break;case _0x59a0('0x56'):var _0x3c5b23=require(_0x59a0('0x57'));if(_0x5dd177[_0x59a0('0x58')]){var _0x2d998a={};_0x2d998a[_0x59a0('0x59')]=_0x5dd177[_0x59a0('0x2f')];_0x2d998a['phone']=_0x12701a[_0x59a0('0x21')];_0x2d998a[_0x59a0('0x2e')]=_0x5dd177['phone'];_0x2d998a[_0x59a0('0x5a')]=_0x12701a[_0x59a0('0xc')];_0x2d998a['timestamp']=+new Date();var _0x4f57fa='';var _0x3b7937='';var _0x2adf9c=Object[_0x59a0('0x5b')](_0x2d998a);_0x2adf9c['sort']();for(var _0x1b166b=0x0;_0x1b166b<_0x2adf9c[_0x59a0('0x5c')];_0x1b166b++){if(_0x4f57fa!=''){_0x4f57fa+='&';}_0x4f57fa+=_0x2adf9c[_0x1b166b]+'='+encodeURIComponent(_0x2d998a[_0x2adf9c[_0x1b166b]]);_0x3b7937+=_0x2d998a[_0x2adf9c[_0x1b166b]];}_0x3b7937+=_0x5dd177[_0x59a0('0x58')];_0x3b7937=_0x3c5b23['createHash'](_0x59a0('0x5d'))[_0x59a0('0x18')](_0x3b7937)[_0x59a0('0x5e')](_0x59a0('0x5f'));if(_0x4f57fa!==''){_0x4f57fa+='&';}_0x4f57fa+=_0x59a0('0x60')+_0x3b7937;var _0x3a7599={'method':'GET','uri':_0x5dd177[_0x59a0('0x50')]+'/external/get/send.php?'+_0x4f57fa,'json':!![]};return rp(_0x3a7599)[_0x59a0('0x17')](function(_0x4bd8e5){var _0x17a507=Object[_0x59a0('0x5b')](_0x4bd8e5);if(_0x4bd8e5[_0x17a507[0x0]]['error']&&parseInt(_0x4bd8e5[_0x17a507[0x0]][_0x59a0('0x1a')])===0x0){var _0xa029c9={'messageId':_0x4bd8e5[_0x17a507[0x0]][_0x59a0('0x61')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0xa029c9['read']=!![];}return _0x34668e[_0x59a0('0x18')](_0xa029c9);}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','csc',util[_0x59a0('0x35')](_0x4bd8e5[_0x59a0('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x63fd97){return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x56'),util[_0x59a0('0x35')](_0x63fd97,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x56'),_0x59a0('0x62'));}break;case _0x59a0('0x63'):if(_0x5dd177[_0x59a0('0x58')]){var _0x528ed4={'method':'POST','uri':_0x59a0('0x64'),'headers':{'Authorization':_0x5dd177[_0x59a0('0x58')]},'body':{'content':_0x12701a[_0x59a0('0xc')],'to':[_0x12701a[_0x59a0('0x21')]],'from':_0x5dd177[_0x59a0('0x21')],'binary':![],'clientMessageId':_0x59a0('0x65'),'charset':'UTF-8'},'json':!![]};rp(_0x528ed4)[_0x59a0('0x17')](function(_0x11e294){if(!_0x11e294['error']){var _0x7ab5de={'messageId':_0x11e294[_0x59a0('0x22')][0x0][_0x59a0('0x66')]};if(!_0x5dd177[_0x59a0('0x3c')]){_0x7ab5de[_0x59a0('0x34')]=!![];}return _0x34668e[_0x59a0('0x18')](_0x7ab5de);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x59a0('0x63'),util[_0x59a0('0x35')](_0x11e294[_0x59a0('0x1a')],{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x1d4e51){return logger['error'](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x63'),util[_0x59a0('0x35')](_0x1d4e51,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x63'),_0x59a0('0x62'));}break;case _0x59a0('0x67'):if(_0x5dd177[_0x59a0('0x2f')]&&_0x5dd177[_0x59a0('0x2c')]){var _0x1b8bd0=util[_0x59a0('0x40')](_0x59a0('0x68'),_0x5dd177[_0x59a0('0x2f')],_0x5dd177[_0x59a0('0x2c')]);var _0x185f8e={'method':_0x59a0('0x39'),'uri':_0x59a0('0x69')+_0x5dd177[_0x59a0('0x6a')]+_0x59a0('0x6b'),'body':{'to':[_0x12701a[_0x59a0('0x21')]],'text':_0x12701a[_0x59a0('0xc')],'from':_0x5dd177['phone'],'applicationId':_0x5dd177[_0x59a0('0x6c')]},'headers':{'Authorization':util[_0x59a0('0x40')](_0x59a0('0x42'),new Buffer(_0x1b8bd0)[_0x59a0('0x43')](_0x59a0('0x4e')))},'json':!![]};rp(_0x185f8e)['then'](function(_0x1944be){if(_0x1944be['id']){var _0x1d5b8b={'messageId':_0x1944be['id']};return _0x34668e[_0x59a0('0x18')](_0x1d5b8b);}else{logger[_0x59a0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x59a0('0x29'),_0x59a0('0x67'),util[_0x59a0('0x35')](_0x1944be,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x5dd0ba){logger[_0x59a0('0x1a')](_0x59a0('0x28'),'afterCreate','bandwidth',util[_0x59a0('0x35')](_0x5dd0ba,{'showHidden':![],'depth':null}));});}else{logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x67'),_0x59a0('0x37'));}break;case _0x59a0('0x6d'):if(_0x5dd177[_0x59a0('0x58')]){var _0x49765b={};var _0x3a7599={'method':_0x59a0('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x59a0('0x6e')+_0x5dd177[_0x59a0('0x58')],'Content-Type':'application/json'},'body':{'from':_0x5dd177[_0x59a0('0x21')],'to':_0x12701a[_0x59a0('0x21')],'text':_0x12701a['body']},'json':!![]};return rp(_0x3a7599)[_0x59a0('0x17')](function(_0x550e88){if(_0x550e88['code']==0xca){_0x49765b[_0x59a0('0x6f')]=_0x550e88;var _0x4999b7={'method':_0x59a0('0x39'),'uri':_0x59a0('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x5dd177[_0x59a0('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x49765b[_0x59a0('0x6f')][_0x59a0('0x71')]},'json':!![]};return rp(_0x4999b7)['then'](function(_0x2e3223){_0x49765b[_0x59a0('0x72')]=_0x2e3223;var _0x4748d3={'messageId':_0x49765b[_0x59a0('0x6f')][_0x59a0('0x71')],'read':!![]};return _0x34668e[_0x59a0('0x18')](_0x4748d3);});}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x6d'),util[_0x59a0('0x35')](_0x550e88,{'showHidden':![],'depth':null}));}})[_0x59a0('0x36')](function(_0x14bb19){return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),_0x59a0('0x6d'),util[_0x59a0('0x35')](_0x14bb19,{'showHidden':![],'depth':null}));});}else{return logger[_0x59a0('0x1a')](_0x59a0('0x28'),_0x59a0('0x29'),'intelepeer',_0x59a0('0x73'));}break;}}})['finally'](function(){_0x1b54b3();});}else{_0x1b54b3();}}},'charset':'utf8mb4','collate':_0x59a0('0x74')});}; \ No newline at end of file +var _0xc682=['head','message_id','clickSend','plivo','authId','remote','format','%s:%s','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','text','timestamp','sort','length','apiKey','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','out','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','sender','&password=','GET','split','sms','user_key','session_key','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count'];(function(_0x32d1ae,_0x4f7beb){var _0x1cd407=function(_0x2e3e86){while(--_0x2e3e86){_0x32d1ae['push'](_0x32d1ae['shift']());}};_0x1cd407(++_0x4f7beb);}(_0xc682,0xb4));var _0x2c68=function(_0x4c0967,_0x42b2ad){_0x4c0967=_0x4c0967-0x0;var _0x3f0600=_0xc682[_0x4c0967];return _0x3f0600;};'use strict';var _=require('lodash');var util=require(_0x2c68('0x0'));var logger=require(_0x2c68('0x1'))(_0x2c68('0x2'));var moment=require(_0x2c68('0x3'));var BPromise=require(_0x2c68('0x4'));var rp=require(_0x2c68('0x5'));var fs=require('fs');var path=require(_0x2c68('0x6'));var rimraf=require(_0x2c68('0x7'));var config=require(_0x2c68('0x8'));var attributes=require(_0x2c68('0x9'));module[_0x2c68('0xa')]=function(_0x3c1ef8,_0x465e30){return _0x3c1ef8[_0x2c68('0xb')]('SmsMessage',attributes,{'tableName':_0x2c68('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2c68('0xd')]},{'name':_0x2c68('0xe'),'fields':['body'],'type':_0x2c68('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x30c466,_0x1b6c4d,_0x5d08d3){var _0x59185b=_0x3c1ef8[_0x2c68('0x10')];var _0x496290=_0x30c466['get']({'plain':!![]});if(_0x496290[_0x2c68('0x11')][_0x2c68('0x12')]()==='in'||_0x496290[_0x2c68('0x11')][_0x2c68('0x12')]()==='out'&&!_0x496290['secret']&&!_[_0x2c68('0x13')](_0x496290[_0x2c68('0x14')])&&!_[_0x2c68('0x13')](_0x496290[_0x2c68('0x15')])){_0x59185b[_0x2c68('0x16')][_0x2c68('0x17')]({'where':{'id':_0x496290[_0x2c68('0x15')]}})[_0x2c68('0x18')](function(_0x586cea){if(_0x586cea){_0x586cea[_0x2c68('0x19')]({'lastMsgAt':_0x496290['createdAt'],'lastMsgDirection':_0x496290[_0x2c68('0x11')]['toLowerCase']()});}})[_0x2c68('0x1a')](function(_0x5125d2){console[_0x2c68('0x1b')](_0x5125d2);});}if(_0x496290[_0x2c68('0x11')]===_0x2c68('0x1c')&&!_0x496290[_0x2c68('0x1d')]){var _0x10b480;_0x59185b[_0x2c68('0x1e')]['find']({'where':{'id':_0x496290[_0x2c68('0x1f')]},'raw':!![]})[_0x2c68('0x18')](function(_0x56fa4f){_0x10b480=_0x56fa4f;if(_0x10b480&&_0x10b480['type']){switch(_0x10b480[_0x2c68('0x20')]){case _0x2c68('0x21'):var _0x20f1bf=require('twilio');if(_0x10b480[_0x2c68('0x22')]&&_0x10b480[_0x2c68('0x23')]&&_0x10b480['phone']){var _0x2d4d05=new _0x20f1bf(_0x10b480[_0x2c68('0x22')],_0x10b480['authToken']);_0x2d4d05[_0x2c68('0x24')]['create']({'body':_0x496290['body'],'to':_0x496290[_0x2c68('0x25')],'from':_0x10b480[_0x2c68('0x25')],'statusCallback':_0x10b480['remote']+_0x2c68('0x26')+_0x496290['id']+_0x2c68('0x27')+_0x10b480[_0x2c68('0x28')]})[_0x2c68('0x18')](function(_0x14e7a2){if(_0x14e7a2[_0x2c68('0x29')]){return _0x30c466[_0x2c68('0x19')]({'messageId':_0x14e7a2[_0x2c68('0x29')]});}})['catch'](function(_0x5969e4){logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c68('0x2a'),'twilio',util[_0x2c68('0x2b')](_0x5969e4,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),'afterCreate',_0x2c68('0x21'),_0x2c68('0x2d'));}break;case'skebby':var _0x5f535f=_0x2c68('0x2e');if(_0x10b480[_0x2c68('0x2f')]&&_0x10b480[_0x2c68('0x30')]){var _0x52b7c3={'recipient':[_0x496290[_0x2c68('0x25')]],'message':_0x496290[_0x2c68('0x31')],'message_type':_0x10b480[_0x2c68('0x32')]};if(_0x10b480[_0x2c68('0x32')]&&_0x10b480[_0x2c68('0x32')]!=='SI'){_0x52b7c3[_0x2c68('0x33')]=_0x10b480[_0x2c68('0x25')];}var _0x26f45={'url':_0x5f535f+'login?username='+_0x10b480[_0x2c68('0x2f')]+_0x2c68('0x34')+_0x10b480[_0x2c68('0x30')],'method':_0x2c68('0x35')};rp(_0x26f45)[_0x2c68('0x18')](function(_0xc292b8){var _0x89d197=_0xc292b8[_0x2c68('0x36')](';');var _0xeb8e47={'user_key':_0x89d197[0x0],'session_key':_0x89d197[0x1]};_0x26f45={'url':_0x5f535f+_0x2c68('0x37'),'method':'POST','headers':{'user_key':_0xeb8e47[_0x2c68('0x38')],'Session_key':_0xeb8e47[_0x2c68('0x39')]},'json':!![],'body':_0x52b7c3};return rp(_0x26f45);})[_0x2c68('0x18')](function(_0x26740a){if(_0x26740a['total_sent']>=0x1){var _0x57ae0e={'messageId':_0x26740a[_0x2c68('0x3a')]};if(_0x10b480[_0x2c68('0x32')]!=='GP'||!_0x10b480[_0x2c68('0x3b')]){_0x57ae0e['read']=!![];}return _0x30c466[_0x2c68('0x19')](_0x57ae0e);}else{return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x3c'),util[_0x2c68('0x2b')](_0x26740a,{'showHidden':![],'depth':null}));}})['catch'](function(_0xa173a1){return logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x2c68('0x2b')](_0xa173a1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x3c'),_0x2c68('0x3d'));}break;case _0x2c68('0x3e'):if(_0x10b480['authToken']){var _0x26198a={'recipient':_0x496290[_0x2c68('0x25')],'message':_0x496290[_0x2c68('0x31')],'sender':_0x10b480[_0x2c68('0x3f')]||_0x10b480[_0x2c68('0x25')],'authorization':_0x10b480[_0x2c68('0x23')]};var _0x1b6c4d={'method':_0x2c68('0x40'),'uri':_0x2c68('0x41'),'body':_0x26198a,'json':!![]};rp(_0x1b6c4d)['then'](function(_0x41b8ec){var _0x2bd62f={'messageId':_0x41b8ec[_0x2c68('0x42')]};if(!_0x10b480[_0x2c68('0x3b')]){_0x2bd62f[_0x2c68('0x43')]=!![];}return _0x30c466['update'](_0x2bd62f);})[_0x2c68('0x1a')](function(_0x4da12f){logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x3e'),util[_0x2c68('0x2b')](_0x4da12f,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x3e'),'Missing\x20parameters:\x20authToken');}break;case _0x2c68('0x44'):if(_0x10b480[_0x2c68('0x2f')]&&_0x10b480[_0x2c68('0x30')]){var _0x26198a={'messages':[{'source':_0x2c68('0x45'),'to':_0x496290[_0x2c68('0x25')],'body':_0x496290[_0x2c68('0x31')],'from':_0x10b480[_0x2c68('0x3f')]||_0x10b480[_0x2c68('0x25')]}]};var _0x51c95a=util['format']('%s:%s',_0x10b480[_0x2c68('0x2f')],_0x10b480['password']);var _0x1b6c4d={'method':_0x2c68('0x40'),'uri':_0x2c68('0x46'),'body':_0x26198a,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x51c95a)[_0x2c68('0x47')](_0x2c68('0x48')))},'json':!![]};rp(_0x1b6c4d)['then'](function(_0x30a784){if(_0x30a784[_0x2c68('0x49')]>=0xc8&&_0x30a784['http_code']<=0xce){if(_0x30a784[_0x2c68('0x4a')]&&_0x30a784[_0x2c68('0x4a')][_0x2c68('0x4b')]>0x0){var _0x4405cc=_[_0x2c68('0x4c')](_0x30a784[_0x2c68('0x4a')]['messages']);var _0x2ac3a1={'messageId':_0x4405cc[_0x2c68('0x4d')]};if(!_0x10b480[_0x2c68('0x3b')]){_0x2ac3a1[_0x2c68('0x43')]=!![];}return _0x30c466[_0x2c68('0x19')](_0x2ac3a1);}else{logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x4e'),util[_0x2c68('0x2b')](_0x30a784,{'showHidden':![],'depth':null}));}}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x4e'),util[_0x2c68('0x2b')](_0x30a784,{'showHidden':![],'depth':null}));}})[_0x2c68('0x1a')](function(_0x122459){logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),'clickSend',util['inspect'](_0x122459,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x4e'),_0x2c68('0x3d'));}break;case _0x2c68('0x4f'):if(_0x10b480[_0x2c68('0x50')]&&_0x10b480['authToken']){var _0x26198a={'dst':_0x496290[_0x2c68('0x25')],'text':_0x496290[_0x2c68('0x31')],'src':_0x10b480[_0x2c68('0x3f')]||_0x10b480['phone'],'url':_0x10b480[_0x2c68('0x51')]+_0x2c68('0x26')+_0x496290['id']+_0x2c68('0x27')+_0x10b480['token']};var _0x51c95a=util[_0x2c68('0x52')](_0x2c68('0x53'),_0x10b480[_0x2c68('0x50')],_0x10b480[_0x2c68('0x23')]);var _0x1b6c4d={'method':_0x2c68('0x40'),'uri':util[_0x2c68('0x52')]('https://api.plivo.com/v1/Account/%s/Message/',_0x10b480[_0x2c68('0x50')]),'body':_0x26198a,'headers':{'Authorization':util[_0x2c68('0x52')](_0x2c68('0x54'),new Buffer(_0x51c95a)['toString'](_0x2c68('0x48')))},'json':!![]};rp(_0x1b6c4d)[_0x2c68('0x18')](function(_0x4ff673){var _0xc45004={'messageId':_0x4ff673[_0x2c68('0x55')][0x0]};return _0x30c466[_0x2c68('0x19')](_0xc45004);})[_0x2c68('0x1a')](function(_0x101863){logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c68('0x4f'),util[_0x2c68('0x2b')](_0x101863,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c68('0x2a'),'plivo',_0x2c68('0x56'));}break;case _0x2c68('0x57'):if(_0x10b480[_0x2c68('0x2f')]&&_0x10b480[_0x2c68('0x30')]){if(_0x10b480[_0x2c68('0x58')]){var _0x2b7f37={'method':'POST','uri':_0x10b480[_0x2c68('0x58')]+_0x2c68('0x59'),'body':{'username':_0x10b480[_0x2c68('0x2f')],'password':_0x10b480[_0x2c68('0x30')]},'json':!![]};return rp(_0x2b7f37)['then'](function(_0x8e7680){var _0x499cdb={'method':_0x2c68('0x40'),'uri':_0x10b480[_0x2c68('0x58')]+_0x2c68('0x5a'),'body':{'messages':[{'from':_0x10b480[_0x2c68('0x25')],'destinations':[{'to':_0x496290[_0x2c68('0x25')]}],'text':_0x496290[_0x2c68('0x31')],'notifyUrl':_0x10b480[_0x2c68('0x51')]+_0x2c68('0x26')+_0x496290['id']+'/status?token='+_0x10b480['token'],'notifyContentType':'application/json','callbackData':_0x10b480[_0x2c68('0x25')]+';'+_0x496290[_0x2c68('0x31')]}]},'headers':{'Authorization':_0x2c68('0x5b')+_0x8e7680[_0x2c68('0x28')]},'json':!![]};return rp(_0x499cdb)[_0x2c68('0x18')](function(_0x4c124b){if(_0x4c124b['messages']){var _0x291d48={'messageId':_0x4c124b['messages'][0x0][_0x2c68('0xd')]};if(!_0x10b480[_0x2c68('0x3b')]){_0x291d48['read']=!![];}return _0x30c466[_0x2c68('0x19')](_0x291d48);}else{return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),'infobip',util[_0x2c68('0x2b')](_0x4c124b,{'showHidden':![],'depth':null}));}});})[_0x2c68('0x1a')](function(_0x3151ae){return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x57'),util[_0x2c68('0x2b')](_0x3151ae,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c68('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c68('0x2a'),_0x2c68('0x57'),_0x2c68('0x3d'));}break;case'csc':var _0x545218=require('crypto');if(_0x10b480['apiKey']){var _0x4eacfd={};_0x4eacfd['login']=_0x10b480[_0x2c68('0x2f')];_0x4eacfd[_0x2c68('0x25')]=_0x496290[_0x2c68('0x25')];_0x4eacfd[_0x2c68('0x33')]=_0x10b480['phone'];_0x4eacfd[_0x2c68('0x5c')]=_0x496290['body'];_0x4eacfd[_0x2c68('0x5d')]=+new Date();var _0x195422='';var _0x356cc8='';var _0x462a3b=Object['keys'](_0x4eacfd);_0x462a3b[_0x2c68('0x5e')]();for(var _0x3fe9d2=0x0;_0x3fe9d2<_0x462a3b[_0x2c68('0x5f')];_0x3fe9d2++){if(_0x195422!=''){_0x195422+='&';}_0x195422+=_0x462a3b[_0x3fe9d2]+'='+encodeURIComponent(_0x4eacfd[_0x462a3b[_0x3fe9d2]]);_0x356cc8+=_0x4eacfd[_0x462a3b[_0x3fe9d2]];}_0x356cc8+=_0x10b480[_0x2c68('0x60')];_0x356cc8=_0x545218['createHash'](_0x2c68('0x61'))[_0x2c68('0x19')](_0x356cc8)[_0x2c68('0x62')](_0x2c68('0x63'));if(_0x195422!==''){_0x195422+='&';}_0x195422+=_0x2c68('0x64')+_0x356cc8;var _0x26f45={'method':'GET','uri':_0x10b480['baseUrl']+_0x2c68('0x65')+_0x195422,'json':!![]};return rp(_0x26f45)[_0x2c68('0x18')](function(_0x162310){var _0x58f438=Object[_0x2c68('0x66')](_0x162310);if(_0x162310[_0x58f438[0x0]]['error']&&parseInt(_0x162310[_0x58f438[0x0]][_0x2c68('0x1b')])===0x0){var _0x1ddb8d={'messageId':_0x162310[_0x58f438[0x0]][_0x2c68('0x67')]};if(!_0x10b480[_0x2c68('0x3b')]){_0x1ddb8d['read']=!![];}return _0x30c466[_0x2c68('0x19')](_0x1ddb8d);}else{return logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c68('0x2a'),_0x2c68('0x68'),util[_0x2c68('0x2b')](_0x162310[_0x2c68('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x46556f){return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x68'),util[_0x2c68('0x2b')](_0x46556f,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),'afterCreate',_0x2c68('0x68'),_0x2c68('0x69'));}break;case _0x2c68('0x6a'):if(_0x10b480[_0x2c68('0x60')]){var _0x5f1325={'method':_0x2c68('0x40'),'uri':_0x2c68('0x6b'),'headers':{'Authorization':_0x10b480[_0x2c68('0x60')]},'body':{'content':_0x496290['body'],'to':[_0x496290[_0x2c68('0x25')]],'from':_0x10b480[_0x2c68('0x25')],'binary':![],'clientMessageId':_0x2c68('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x5f1325)[_0x2c68('0x18')](function(_0x34d2be){if(!_0x34d2be[_0x2c68('0x1b')]){var _0x22202d={'messageId':_0x34d2be['messages'][0x0][_0x2c68('0x6d')]};if(!_0x10b480[_0x2c68('0x3b')]){_0x22202d[_0x2c68('0x43')]=!![];}return _0x30c466[_0x2c68('0x19')](_0x22202d);}else{return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),'afterCreate',_0x2c68('0x6a'),util[_0x2c68('0x2b')](_0x34d2be[_0x2c68('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xc6bc2a){return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x6a'),util[_0x2c68('0x2b')](_0xc6bc2a,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c68('0x6a'),_0x2c68('0x69'));}break;case _0x2c68('0x6e'):if(_0x10b480[_0x2c68('0x2f')]&&_0x10b480[_0x2c68('0x30')]){var _0x51c95a=util[_0x2c68('0x52')]('%s:%s',_0x10b480['username'],_0x10b480[_0x2c68('0x30')]);var _0x1b6c4d={'method':_0x2c68('0x40'),'uri':_0x2c68('0x6f')+_0x10b480[_0x2c68('0x70')]+_0x2c68('0x71'),'body':{'to':[_0x496290['phone']],'text':_0x496290['body'],'from':_0x10b480['phone'],'applicationId':_0x10b480[_0x2c68('0x72')]},'headers':{'Authorization':util[_0x2c68('0x52')]('Basic\x20%s',new Buffer(_0x51c95a)[_0x2c68('0x47')](_0x2c68('0x48')))},'json':!![]};rp(_0x1b6c4d)[_0x2c68('0x18')](function(_0x4e76b5){if(_0x4e76b5['id']){var _0x749c78={'messageId':_0x4e76b5['id']};return _0x30c466['update'](_0x749c78);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c68('0x2a'),_0x2c68('0x6e'),util[_0x2c68('0x2b')](_0x4e76b5,{'showHidden':![],'depth':null}));}})[_0x2c68('0x1a')](function(_0x409015){logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),_0x2c68('0x6e'),util[_0x2c68('0x2b')](_0x409015,{'showHidden':![],'depth':null}));});}else{logger[_0x2c68('0x1b')](_0x2c68('0x2c'),'afterCreate','bandwidth',_0x2c68('0x3d'));}break;case _0x2c68('0x73'):if(_0x10b480[_0x2c68('0x60')]){var _0x303ed2={};var _0x26f45={'method':_0x2c68('0x40'),'uri':_0x2c68('0x74'),'headers':{'Authorization':'Bearer\x20'+_0x10b480[_0x2c68('0x60')],'Content-Type':'application/json'},'body':{'from':_0x10b480[_0x2c68('0x25')],'to':_0x496290[_0x2c68('0x25')],'text':_0x496290['body']},'json':!![]};return rp(_0x26f45)[_0x2c68('0x18')](function(_0x1a5970){if(_0x1a5970[_0x2c68('0x75')]==0xca){_0x303ed2['message']=_0x1a5970;var _0x5125e9={'method':_0x2c68('0x40'),'uri':_0x2c68('0x76'),'headers':{'Authorization':_0x2c68('0x77')+_0x10b480[_0x2c68('0x60')],'Content-Type':_0x2c68('0x78')},'body':{'refid':_0x303ed2[_0x2c68('0x79')][_0x2c68('0x7a')]},'json':!![]};return rp(_0x5125e9)[_0x2c68('0x18')](function(_0x4ff3e7){_0x303ed2[_0x2c68('0x7b')]=_0x4ff3e7;var _0x255511={'messageId':_0x303ed2['message']['refid'],'read':!![]};return _0x30c466[_0x2c68('0x19')](_0x255511);});}else{return logger['error'](_0x2c68('0x2c'),_0x2c68('0x2a'),'intelepeer',util[_0x2c68('0x2b')](_0x1a5970,{'showHidden':![],'depth':null}));}})[_0x2c68('0x1a')](function(_0x260b67){return logger[_0x2c68('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2c68('0x73'),util['inspect'](_0x260b67,{'showHidden':![],'depth':null}));});}else{return logger[_0x2c68('0x1b')](_0x2c68('0x2c'),_0x2c68('0x2a'),'intelepeer',_0x2c68('0x7c'));}break;}}})[_0x2c68('0x7d')](function(){_0x5d08d3();});}else{_0x5d08d3();}}},'charset':_0x2c68('0x7e'),'collate':_0x2c68('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f681e58..e1bbfdd 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 _0x7efd=['error','code','message','info','request\x20sent','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0x7efd,0x103));var _0xd7ef=function(_0x2e33d3,_0x4375d2){_0x2e33d3=_0x2e33d3-0x0;var _0x5cd87d=_0x7efd[_0x2e33d3];return _0x5cd87d;};'use strict';var _=require(_0xd7ef('0x0'));var util=require(_0xd7ef('0x1'));var moment=require(_0xd7ef('0x2'));var BPromise=require(_0xd7ef('0x3'));var rs=require(_0xd7ef('0x4'));var fs=require('fs');var Redis=require(_0xd7ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd7ef('0x6'));var logger=require('../../config/logger')(_0xd7ef('0x7'));var config=require(_0xd7ef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd7ef('0x9')][_0xd7ef('0xa')]({'port':0x232a});config[_0xd7ef('0xb')]=_['defaults'](config[_0xd7ef('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7ef('0xc'))(new Redis(config[_0xd7ef('0xb')]));require(_0xd7ef('0xd'))[_0xd7ef('0xe')](socket);function respondWithRpcPromise(_0x48fc83,_0x4b3c26,_0x512cc2){return new BPromise(function(_0x5e208c,_0x296bbc){return client[_0xd7ef('0xf')](_0x48fc83,_0x512cc2)[_0xd7ef('0x10')](function(_0x51a4a1){logger['info'](_0xd7ef('0x11'),_0x4b3c26,'request\x20sent');logger['debug'](_0xd7ef('0x12'),_0x4b3c26,'request\x20sent',JSON[_0xd7ef('0x13')](_0x51a4a1));if(_0x51a4a1[_0xd7ef('0x14')]){if(_0x51a4a1['error'][_0xd7ef('0x15')]===0x1f4){logger[_0xd7ef('0x14')](_0xd7ef('0x11'),_0x4b3c26,_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);return _0x296bbc(_0x51a4a1[_0xd7ef('0x14')]['message']);}logger[_0xd7ef('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b3c26,_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);return _0x5e208c(_0x51a4a1[_0xd7ef('0x14')][_0xd7ef('0x16')]);}else{logger[_0xd7ef('0x17')](_0xd7ef('0x11'),_0x4b3c26,_0xd7ef('0x18'));_0x5e208c(_0x51a4a1['result']['message']);}})[_0xd7ef('0x19')](function(_0x19d59e){logger[_0xd7ef('0x14')]('SmsMessage,\x20%s,\x20%s',_0x4b3c26,_0x19d59e);_0x296bbc(_0x19d59e);});});}exports[_0xd7ef('0x1a')]=function(_0x1d09ec){var _0x35d97b=this;return new Promise(function(_0x2fdbcf,_0x4465a0){return db['SmsMessage'][_0xd7ef('0x1b')](_0x1d09ec[_0xd7ef('0x1c')],{'raw':_0x1d09ec['options']?_0x1d09ec[_0xd7ef('0x1d')][_0xd7ef('0x1e')]===undefined?!![]:![]:!![]})[_0xd7ef('0x10')](function(_0x258cb3){logger[_0xd7ef('0x17')](_0xd7ef('0x1a'),_0x1d09ec);logger['debug']('CreateSmsMessage',_0x1d09ec,JSON[_0xd7ef('0x13')](_0x258cb3));_0x2fdbcf(_0x258cb3);})[_0xd7ef('0x19')](function(_0xb16580){logger['error'](_0xd7ef('0x1a'),_0xb16580['message'],_0x1d09ec);_0x4465a0(_0x35d97b[_0xd7ef('0x14')](0x1f4,_0xb16580['message']));});});}; \ No newline at end of file +var _0x68f9=['redis','defaults','localhost','socket.io-emitter','register','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','SmsMessage','body','options','then','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x68f9,0x104));var _0x968f=function(_0x4f17b1,_0x4bd96a){_0x4f17b1=_0x4f17b1-0x0;var _0x58f242=_0x68f9[_0x4f17b1];return _0x58f242;};'use strict';var _=require('lodash');var util=require(_0x968f('0x0'));var moment=require(_0x968f('0x1'));var BPromise=require('bluebird');var rs=require(_0x968f('0x2'));var fs=require('fs');var Redis=require(_0x968f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x968f('0x4'))(_0x968f('0x5'));var config=require(_0x968f('0x6'));var jayson=require(_0x968f('0x7'));var client=jayson[_0x968f('0x8')][_0x968f('0x9')]({'port':0x232a});config[_0x968f('0xa')]=_[_0x968f('0xb')](config['redis'],{'host':_0x968f('0xc'),'port':0x18eb});var socket=require(_0x968f('0xd'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x968f('0xe')](socket);function respondWithRpcPromise(_0x544ebc,_0x31d5ea,_0x12413c){return new BPromise(function(_0x4fd19d,_0x569ab2){return client['request'](_0x544ebc,_0x12413c)['then'](function(_0x2ce7cb){logger[_0x968f('0xf')](_0x968f('0x10'),_0x31d5ea,_0x968f('0x11'));logger[_0x968f('0x12')](_0x968f('0x13'),_0x31d5ea,_0x968f('0x11'),JSON[_0x968f('0x14')](_0x2ce7cb));if(_0x2ce7cb[_0x968f('0x15')]){if(_0x2ce7cb[_0x968f('0x15')]['code']===0x1f4){logger['error'](_0x968f('0x10'),_0x31d5ea,_0x2ce7cb[_0x968f('0x15')][_0x968f('0x16')]);return _0x569ab2(_0x2ce7cb[_0x968f('0x15')]['message']);}logger['error'](_0x968f('0x10'),_0x31d5ea,_0x2ce7cb[_0x968f('0x15')]['message']);return _0x4fd19d(_0x2ce7cb['error'][_0x968f('0x16')]);}else{logger[_0x968f('0xf')](_0x968f('0x10'),_0x31d5ea,'request\x20sent');_0x4fd19d(_0x2ce7cb[_0x968f('0x17')][_0x968f('0x16')]);}})[_0x968f('0x18')](function(_0x1d6bf1){logger['error'](_0x968f('0x10'),_0x31d5ea,_0x1d6bf1);_0x569ab2(_0x1d6bf1);});});}exports[_0x968f('0x19')]=function(_0x5f18a4){var _0x3c6710=this;return new Promise(function(_0x31473c,_0x100b1a){return db[_0x968f('0x1a')]['create'](_0x5f18a4[_0x968f('0x1b')],{'raw':_0x5f18a4['options']?_0x5f18a4[_0x968f('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x968f('0x1d')](function(_0xb4662d){logger['info'](_0x968f('0x19'),_0x5f18a4);logger[_0x968f('0x12')]('CreateSmsMessage',_0x5f18a4,JSON[_0x968f('0x14')](_0xb4662d));_0x31473c(_0xb4662d);})[_0x968f('0x18')](function(_0x544af8){logger[_0x968f('0x15')](_0x968f('0x19'),_0x544af8[_0x968f('0x16')],_0x5f18a4);_0x100b1a(_0x3c6710[_0x968f('0x15')](0x1f4,_0x544af8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 78f0760..c40f133 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 _0x1d60=['smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x49a4e3,_0x1cc52e){var _0x1e96be=function(_0x184bdd){while(--_0x184bdd){_0x49a4e3['push'](_0x49a4e3['shift']());}};_0x1e96be(++_0x1cc52e);}(_0x1d60,0xf1));var _0x01d6=function(_0x43fac0,_0x345c86){_0x43fac0=_0x43fac0-0x0;var _0xf1a226=_0x1d60[_0x43fac0];return _0xf1a226;};'use strict';var SmsMessageEvents=require(_0x01d6('0x0'));var events=[_0x01d6('0x1'),_0x01d6('0x2'),_0x01d6('0x3')];function createListener(_0x47076b,_0x59f92a){return function(_0x149977){_0x59f92a[_0x01d6('0x4')](_0x47076b,_0x149977);};}function removeListener(_0x3de778,_0x5bcd7a){return function(){SmsMessageEvents[_0x01d6('0x5')](_0x3de778,_0x5bcd7a);};}exports['register']=function(_0x34ecf5){for(var _0x2e7af2=0x0,_0x2381cf=events[_0x01d6('0x6')];_0x2e7af2<_0x2381cf;_0x2e7af2++){var _0x3f29d2=events[_0x2e7af2];var _0x4aca5c=createListener(_0x01d6('0x7')+_0x3f29d2,_0x34ecf5);SmsMessageEvents['on'](_0x3f29d2,_0x4aca5c);}}; \ No newline at end of file +var _0x638b=['smsMessage:','save','update','emit','removeListener','register','length'];(function(_0xa24881,_0x43f67d){var _0x1551f0=function(_0x59a5d1){while(--_0x59a5d1){_0xa24881['push'](_0xa24881['shift']());}};_0x1551f0(++_0x43f67d);}(_0x638b,0x94));var _0xb638=function(_0xe8cba3,_0x37b08e){_0xe8cba3=_0xe8cba3-0x0;var _0x5c7ee2=_0x638b[_0xe8cba3];return _0x5c7ee2;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xb638('0x0'),'remove',_0xb638('0x1')];function createListener(_0x56b7f8,_0x43cf10){return function(_0xad828e){_0x43cf10[_0xb638('0x2')](_0x56b7f8,_0xad828e);};}function removeListener(_0x5d0e99,_0xe30828){return function(){SmsMessageEvents[_0xb638('0x3')](_0x5d0e99,_0xe30828);};}exports[_0xb638('0x4')]=function(_0xd8518f){for(var _0x312e15=0x0,_0x218e35=events[_0xb638('0x5')];_0x312e15<_0x218e35;_0x312e15++){var _0x196eab=events[_0x312e15];var _0x27c6f3=createListener(_0xb638('0x6')+_0x196eab,_0xd8518f);SmsMessageEvents['on'](_0x196eab,_0x27c6f3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f0a5bf1..2c50bfc 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 _0x8320=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x3ea960,_0x1259b1){var _0x1eeba2=function(_0xed08db){while(--_0xed08db){_0x3ea960['push'](_0x3ea960['shift']());}};_0x1eeba2(++_0x1259b1);}(_0x8320,0x1b3));var _0x0832=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x8320[_0x454165];return _0x56db53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0832('0x0'));var timeout=require('connect-timeout');var express=require(_0x0832('0x1'));var router=express[_0x0832('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0832('0x3'));var interaction=require(_0x0832('0x4'));var config=require(_0x0832('0x5'));var controller=require(_0x0832('0x6'));router[_0x0832('0x7')]('/',auth['isAuthenticated'](),controller[_0x0832('0x8')]);router[_0x0832('0x7')](_0x0832('0x9'),auth[_0x0832('0xa')](),controller[_0x0832('0xb')]);router[_0x0832('0x7')](_0x0832('0xc'),auth[_0x0832('0xa')](),controller['show']);router[_0x0832('0x7')](_0x0832('0xd'),auth[_0x0832('0xa')](),controller['getMembers']);router[_0x0832('0x7')](_0x0832('0xe'),auth[_0x0832('0xa')](),controller[_0x0832('0xf')]);router[_0x0832('0x7')](_0x0832('0x10'),auth[_0x0832('0xa')](),controller[_0x0832('0x11')]);router[_0x0832('0x12')]('/',auth[_0x0832('0xa')](),controller[_0x0832('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x0832('0x14')]);router['post']('/:id/users',auth[_0x0832('0xa')](),controller[_0x0832('0x15')]);router[_0x0832('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0832('0x17')]);router[_0x0832('0x18')](_0x0832('0xc'),auth[_0x0832('0xa')](),controller[_0x0832('0x19')]);router[_0x0832('0x18')]('/:id/teams',auth[_0x0832('0xa')](),controller['removeTeams']);router[_0x0832('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x0832('0x1a')]);module[_0x0832('0x1b')]=router; \ No newline at end of file +var _0x8935=['get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller'];(function(_0x2293e2,_0x51801e){var _0x3bfa05=function(_0x55b96f){while(--_0x55b96f){_0x2293e2['push'](_0x2293e2['shift']());}};_0x3bfa05(++_0x51801e);}(_0x8935,0x188));var _0x5893=function(_0x401c21,_0x2e16d5){_0x401c21=_0x401c21-0x0;var _0x1a320e=_0x8935[_0x401c21];return _0x1a320e;};'use strict';var multer=require(_0x5893('0x0'));var util=require(_0x5893('0x1'));var path=require(_0x5893('0x2'));var timeout=require(_0x5893('0x3'));var express=require(_0x5893('0x4'));var router=express[_0x5893('0x5')]();var fs_extra=require(_0x5893('0x6'));var auth=require(_0x5893('0x7'));var interaction=require(_0x5893('0x8'));var config=require(_0x5893('0x9'));var controller=require(_0x5893('0xa'));router[_0x5893('0xb')]('/',auth[_0x5893('0xc')](),controller[_0x5893('0xd')]);router[_0x5893('0xb')]('/describe',auth[_0x5893('0xc')](),controller[_0x5893('0xe')]);router['get'](_0x5893('0xf'),auth[_0x5893('0xc')](),controller[_0x5893('0x10')]);router[_0x5893('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x5893('0x11')]);router[_0x5893('0xb')](_0x5893('0x12'),auth[_0x5893('0xc')](),controller[_0x5893('0x13')]);router[_0x5893('0xb')]('/:id/users',auth[_0x5893('0xc')](),controller['getAgents']);router[_0x5893('0x14')]('/',auth[_0x5893('0xc')](),controller[_0x5893('0x15')]);router[_0x5893('0x14')](_0x5893('0x12'),auth[_0x5893('0xc')](),controller[_0x5893('0x16')]);router[_0x5893('0x14')](_0x5893('0x17'),auth[_0x5893('0xc')](),controller[_0x5893('0x18')]);router[_0x5893('0x19')]('/:id',auth[_0x5893('0xc')](),controller[_0x5893('0x1a')]);router[_0x5893('0x1b')]('/:id',auth[_0x5893('0xc')](),controller[_0x5893('0x1c')]);router[_0x5893('0x1b')](_0x5893('0x12'),auth['isAuthenticated'](),controller[_0x5893('0x1d')]);router[_0x5893('0x1b')]('/:id/users',auth[_0x5893('0xc')](),controller['removeAgents']);module[_0x5893('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6240c8a..b00f4a3 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 _0xd567=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x5f47e1,_0x4205b8){var _0x36b14c=function(_0xf1de12){while(--_0xf1de12){_0x5f47e1['push'](_0x5f47e1['shift']());}};_0x36b14c(++_0x4205b8);}(_0xd567,0xc1));var _0x7d56=function(_0x2e4f5c,_0x3a04f1){_0x2e4f5c=_0x2e4f5c-0x0;var _0x11d4af=_0xd567[_0x2e4f5c];return _0x11d4af;};'use strict';var Sequelize=require(_0x7d56('0x0'));module[_0x7d56('0x1')]={'name':{'type':Sequelize[_0x7d56('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d56('0x2')]},'timeout':{'type':Sequelize[_0x7d56('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d56('0x4')](_0x7d56('0x5'),_0x7d56('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x85c7=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x4015b7,_0x4cf6bb){var _0x5d6d6e=function(_0xac8cbb){while(--_0xac8cbb){_0x4015b7['push'](_0x4015b7['shift']());}};_0x5d6d6e(++_0x4cf6bb);}(_0x85c7,0xef));var _0x785c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x85c7[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0x785c('0x0')]={'name':{'type':Sequelize[_0x785c('0x1')],'unique':_0x785c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x785c('0x1')]},'timeout':{'type':Sequelize[_0x785c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x785c('0x4')](_0x785c('0x5'),_0x785c('0x6'),_0x785c('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index aee9c44..b259152 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 _0xf094=['get','SmsQueues','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','options','findAll','catch','show','SmsQueue','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','params','describe','getMembers','findOne','UserSmsQueue','hasOwnProperty','nolimit','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xf094,0x1ee));var _0x4f09=function(_0x565c4e,_0x1e77f9){_0x565c4e=_0x565c4e-0x0;var _0x4a167f=_0xf094[_0x565c4e];return _0x4a167f;};'use strict';var emlformat=require(_0x4f09('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f09('0x1'));var jsonpatch=require(_0x4f09('0x2'));var rp=require('request-promise');var moment=require(_0x4f09('0x3'));var BPromise=require(_0x4f09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4f09('0x5'));var csv=require(_0x4f09('0x6'));var ejs=require(_0x4f09('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4f09('0x8'));var crypto=require(_0x4f09('0x9'));var jsforce=require(_0x4f09('0xa'));var deskjs=require(_0x4f09('0xb'));var toCsv=require(_0x4f09('0x6'));var querystring=require(_0x4f09('0xc'));var Papa=require(_0x4f09('0xd'));var Redis=require(_0x4f09('0xe'));var authService=require(_0x4f09('0xf'));var qs=require(_0x4f09('0x10'));var as=require(_0x4f09('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f09('0x12'))(_0x4f09('0x13'));var utils=require(_0x4f09('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f09('0x15'))['db'];config[_0x4f09('0x16')]=_[_0x4f09('0x17')](config['redis'],{'host':_0x4f09('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f09('0x16')]));require(_0x4f09('0x19'))['register'](socket);function respondWithStatusCode(_0x2d7abd,_0x5c57e5){_0x5c57e5=_0x5c57e5||0xcc;return function(_0x475334){if(_0x475334){return _0x2d7abd['sendStatus'](_0x5c57e5);}return _0x2d7abd[_0x4f09('0x1a')](_0x5c57e5)[_0x4f09('0x1b')]();};}function respondWithResult(_0x131b91,_0x105621){_0x105621=_0x105621||0xc8;return function(_0x2ddadf){if(_0x2ddadf){return _0x131b91[_0x4f09('0x1a')](_0x105621)[_0x4f09('0x1c')](_0x2ddadf);}};}function respondWithFilteredResult(_0x4b891c,_0x2dcc00){return function(_0x295609){if(_0x295609){var _0x5739ca=typeof _0x2dcc00[_0x4f09('0x1d')]===_0x4f09('0x1e')&&typeof _0x2dcc00[_0x4f09('0x1f')]===_0x4f09('0x1e');var _0x185437=_0x295609[_0x4f09('0x20')];var _0x31d36d=_0x5739ca?0x0:_0x2dcc00[_0x4f09('0x1d')];var _0x4bd9a5=_0x5739ca?_0x295609[_0x4f09('0x20')]:_0x2dcc00[_0x4f09('0x1d')]+_0x2dcc00[_0x4f09('0x1f')];var _0x60586e;if(_0x4bd9a5>=_0x185437){_0x4bd9a5=_0x185437;_0x60586e=0xc8;}else{_0x60586e=0xce;}_0x4b891c[_0x4f09('0x1a')](_0x60586e);return _0x4b891c[_0x4f09('0x21')]('Content-Range',_0x31d36d+'-'+_0x4bd9a5+'/'+_0x185437)['json'](_0x295609);}return null;};}function patchUpdates(_0xf30ee3){return function(_0x342f30){try{jsonpatch[_0x4f09('0x22')](_0x342f30,_0xf30ee3,!![]);}catch(_0x3b483f){return BPromise['reject'](_0x3b483f);}return _0x342f30['save']();};}function saveUpdates(_0x4967c6,_0x2b16ec){return function(_0x49be67){if(_0x49be67){return _0x49be67[_0x4f09('0x23')](_0x4967c6)['then'](function(_0x11026e){return _0x11026e;});}return null;};}function removeEntity(_0x2c8d05,_0x47d9a2){return function(_0x1c8726){if(_0x1c8726){return _0x1c8726[_0x4f09('0x24')]()[_0x4f09('0x25')](function(){var _0x15329e=_0x1c8726[_0x4f09('0x26')]({'plain':!![]});var _0x20153a=_0x4f09('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x20153a,'resourceId':_0x15329e['id']}})[_0x4f09('0x25')](function(){return _0x1c8726;});})['then'](function(){_0x2c8d05['status'](0xcc)[_0x4f09('0x1b')]();});}};}function handleEntityNotFound(_0xb193d3,_0x557c11){return function(_0x48e424){if(!_0x48e424){_0xb193d3[_0x4f09('0x28')](0x194);}return _0x48e424;};}function handleError(_0x175f4d,_0x14ffc1){_0x14ffc1=_0x14ffc1||0x1f4;return function(_0x515eb3){logger[_0x4f09('0x29')](_0x515eb3[_0x4f09('0x2a')]);if(_0x515eb3[_0x4f09('0x2b')]){delete _0x515eb3[_0x4f09('0x2b')];}_0x175f4d[_0x4f09('0x1a')](_0x14ffc1)['send'](_0x515eb3);};}exports[_0x4f09('0x2c')]=function(_0x36da47,_0x3db93e){var _0x2fe57c={},_0x3d004f={},_0x4acb26={'count':0x0,'rows':[]};var _0x49b704=_[_0x4f09('0x2d')](db['SmsQueue'][_0x4f09('0x2e')],function(_0x10e2b6){return{'name':_0x10e2b6['fieldName'],'type':_0x10e2b6[_0x4f09('0x2f')][_0x4f09('0x30')]};});_0x3d004f[_0x4f09('0x31')]=_[_0x4f09('0x2d')](_0x49b704,'name');_0x3d004f['query']=_[_0x4f09('0x32')](_0x36da47[_0x4f09('0x33')]);_0x3d004f[_0x4f09('0x34')]=_['intersection'](_0x3d004f[_0x4f09('0x31')],_0x3d004f[_0x4f09('0x33')]);_0x2fe57c[_0x4f09('0x35')]=_['intersection'](_0x3d004f[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x36')]));_0x2fe57c[_0x4f09('0x35')]=_0x2fe57c['attributes'][_0x4f09('0x37')]?_0x2fe57c['attributes']:_0x3d004f[_0x4f09('0x31')];if(!_0x36da47['query']['hasOwnProperty']('nolimit')){_0x2fe57c[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x1f')]);_0x2fe57c['offset']=qs[_0x4f09('0x1d')](_0x36da47[_0x4f09('0x33')][_0x4f09('0x1d')]);}_0x2fe57c[_0x4f09('0x38')]=qs[_0x4f09('0x39')](_0x36da47['query'][_0x4f09('0x39')]);_0x2fe57c['where']=qs[_0x4f09('0x34')](_[_0x4f09('0x3a')](_0x36da47[_0x4f09('0x33')],_0x3d004f[_0x4f09('0x34')]),_0x49b704);if(_0x36da47[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x2fe57c[_0x4f09('0x3c')]=_['merge'](_0x2fe57c[_0x4f09('0x3c')],{'$or':_[_0x4f09('0x2d')](_0x49b704,function(_0x521bb4){if(_0x521bb4[_0x4f09('0x2f')]!=='VIRTUAL'){var _0xd04751={};_0xd04751[_0x521bb4[_0x4f09('0x2b')]]={'$like':'%'+_0x36da47['query'][_0x4f09('0x3b')]+'%'};return _0xd04751;}})});}_0x2fe57c=_[_0x4f09('0x3d')]({},_0x2fe57c,_0x36da47[_0x4f09('0x3e')]);var _0x2a14da={'where':_0x2fe57c[_0x4f09('0x3c')]};return db['SmsQueue'][_0x4f09('0x20')](_0x2a14da)[_0x4f09('0x25')](function(_0x4477dc){_0x4acb26[_0x4f09('0x20')]=_0x4477dc;if(_0x36da47[_0x4f09('0x33')]['includeAll']){_0x2fe57c['include']=[{'all':!![]}];}return db['SmsQueue'][_0x4f09('0x3f')](_0x2fe57c);})[_0x4f09('0x25')](function(_0x3bc7ab){_0x4acb26['rows']=_0x3bc7ab;return _0x4acb26;})[_0x4f09('0x25')](respondWithFilteredResult(_0x3db93e,_0x2fe57c))[_0x4f09('0x40')](handleError(_0x3db93e,null));};exports[_0x4f09('0x41')]=function(_0x1eac0c,_0x1f5a51){var _0x435a1f={'raw':!![],'where':{'id':_0x1eac0c['params']['id']}},_0x4429c1={};_0x4429c1[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x42')]['rawAttributes']);_0x4429c1['query']=_['keys'](_0x1eac0c[_0x4f09('0x33')]);_0x4429c1[_0x4f09('0x34')]=_[_0x4f09('0x43')](_0x4429c1[_0x4f09('0x31')],_0x4429c1[_0x4f09('0x33')]);_0x435a1f[_0x4f09('0x35')]=_[_0x4f09('0x43')](_0x4429c1[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x1eac0c[_0x4f09('0x33')]['fields']));_0x435a1f[_0x4f09('0x35')]=_0x435a1f[_0x4f09('0x35')][_0x4f09('0x37')]?_0x435a1f['attributes']:_0x4429c1[_0x4f09('0x31')];if(_0x1eac0c[_0x4f09('0x33')]['includeAll']){_0x435a1f[_0x4f09('0x44')]=[{'all':!![]}];}_0x435a1f=_[_0x4f09('0x3d')]({},_0x435a1f,_0x1eac0c['options']);return db['SmsQueue']['find'](_0x435a1f)[_0x4f09('0x25')](handleEntityNotFound(_0x1f5a51,null))[_0x4f09('0x25')](respondWithResult(_0x1f5a51,null))['catch'](handleError(_0x1f5a51,null));};exports[_0x4f09('0x45')]=function(_0x28f55c,_0x210a3b){return db[_0x4f09('0x42')][_0x4f09('0x45')](_0x28f55c[_0x4f09('0x46')],{})[_0x4f09('0x25')](function(_0x42e43a){var _0x563c84=_0x28f55c[_0x4f09('0x47')][_0x4f09('0x26')]({'plain':!![]});if(!_0x563c84)throw new Error(_0x4f09('0x48'));if(_0x563c84[_0x4f09('0x49')]===_0x4f09('0x47')){var _0x363552=_0x42e43a[_0x4f09('0x26')]({'plain':!![]});var _0x32d472=_0x4f09('0x27');return db[_0x4f09('0x4a')]['find']({'where':{'name':_0x32d472,'userProfileId':_0x563c84['userProfileId']},'raw':!![]})[_0x4f09('0x25')](function(_0x50a3a8){if(_0x50a3a8&&_0x50a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x4f09('0x45')]({'name':_0x363552['name'],'resourceId':_0x363552['id'],'type':_0x50a3a8[_0x4f09('0x2b')],'sectionId':_0x50a3a8['id']},{})[_0x4f09('0x25')](function(){return _0x42e43a;});}else{return _0x42e43a;}})[_0x4f09('0x40')](function(_0x54de37){logger[_0x4f09('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54de37);throw _0x54de37;});}return _0x42e43a;})[_0x4f09('0x25')](respondWithResult(_0x210a3b,0xc9))[_0x4f09('0x40')](handleError(_0x210a3b,null));};exports[_0x4f09('0x23')]=function(_0x292ec3,_0x57b3d8){if(_0x292ec3[_0x4f09('0x46')]['id']){delete _0x292ec3['body']['id'];}return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x292ec3[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x57b3d8,null))['then'](saveUpdates(_0x292ec3[_0x4f09('0x46')],null))[_0x4f09('0x25')](respondWithResult(_0x57b3d8,null))[_0x4f09('0x40')](handleError(_0x57b3d8,null));};exports[_0x4f09('0x24')]=function(_0x2d8d82,_0xdb8f97){return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x2d8d82['params']['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0xdb8f97,null))[_0x4f09('0x25')](removeEntity(_0xdb8f97,null))[_0x4f09('0x40')](handleError(_0xdb8f97,null));};exports[_0x4f09('0x4d')]=function(_0x2e3e5a,_0x365159){return db[_0x4f09('0x42')][_0x4f09('0x4d')]()[_0x4f09('0x25')](respondWithResult(_0x365159,null))['catch'](handleError(_0x365159,null));};exports[_0x4f09('0x4e')]=function(_0x2ddb2b,_0x47f768,_0xab96cf){var _0x20ba0d={'raw':!![],'where':{}},_0x2db2ad={},_0xb7251f;return db[_0x4f09('0x42')][_0x4f09('0x4f')]({'where':{'id':_0x2ddb2b[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x47f768,null))[_0x4f09('0x25')](function(_0xcfc037){if(_0xcfc037){_0xb7251f=_0xcfc037['get']({'plain':!![]});_0x2db2ad[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x50')][_0x4f09('0x2e')]);_0x2db2ad[_0x4f09('0x33')]=_['keys'](_0x2ddb2b[_0x4f09('0x33')]);_0x2db2ad['filters']=_[_0x4f09('0x43')](_0x2db2ad[_0x4f09('0x31')],_0x2db2ad['query']);_0x20ba0d[_0x4f09('0x35')]=_['intersection'](_0x2db2ad[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x36')]));_0x20ba0d[_0x4f09('0x35')]=_0x20ba0d[_0x4f09('0x35')][_0x4f09('0x37')]?_0x20ba0d[_0x4f09('0x35')]:_0x2db2ad[_0x4f09('0x31')];if(!_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x51')](_0x4f09('0x52'))){_0x20ba0d[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x2ddb2b['query']['limit']);_0x20ba0d[_0x4f09('0x1d')]=qs[_0x4f09('0x1d')](_0x2ddb2b[_0x4f09('0x33')]['offset']);}_0x20ba0d[_0x4f09('0x38')]=qs['sort'](_0x2ddb2b[_0x4f09('0x33')]['sort']);_0x20ba0d[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_['pick'](_0x2ddb2b[_0x4f09('0x33')],_0x2db2ad['filters']));_0x20ba0d['where']['SmsQueueId']=_0xcfc037['id'];if(_0x2ddb2b[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x20ba0d['where']=_[_0x4f09('0x3d')](_0x20ba0d[_0x4f09('0x3c')],{'$or':_['map'](_0x20ba0d[_0x4f09('0x35')],function(_0x19654c){var _0x467cd5={};_0x467cd5[_0x19654c]={'$like':'%'+_0x2ddb2b[_0x4f09('0x33')]['filter']+'%'};return _0x467cd5;})});}_0x20ba0d=_['merge']({},_0x20ba0d,_0x2ddb2b['options']);return db[_0x4f09('0x50')][_0x4f09('0x3f')](_0x20ba0d);}})[_0x4f09('0x25')](function(_0x3d08b6){if(_0x3d08b6){return db['User']['findAndCountAll']({'where':{'id':_[_0x4f09('0x2d')](_0x3d08b6,_0x4f09('0x53')),'role':_0x4f09('0x54')},'attributes':['id',_0x4f09('0x2b'),_0x4f09('0x55'),_0x4f09('0x56'),_0x4f09('0x57')]});}})[_0x4f09('0x25')](function(_0x5771c4){if(_0x5771c4){return{'count':_0x5771c4['count'],'rows':_[_0x4f09('0x2d')](_0x5771c4[_0x4f09('0x58')],function(_0x5b2f56){return{'membername':_0x5b2f56['name'],'UserId':_0x5b2f56['id'],'queue_name':_0xb7251f[_0x4f09('0x2b')],'SmsQueueId':_0xb7251f['id'],'interface':util[_0x4f09('0x59')](_0x4f09('0x5a'),_0x4f09('0x5b'),_0x5b2f56['name']),'penalty':0x0,'paused':_0x5b2f56[_0x4f09('0x55')],'createdAt':_0x5b2f56[_0x4f09('0x57')],'updatedAt':_0x5b2f56['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x47f768,_0x20ba0d))[_0x4f09('0x40')](handleError(_0x47f768,null));};exports[_0x4f09('0x5c')]=function(_0x1d0aaf,_0x5c1165,_0x4116cd){var _0x555b3f={};var _0x13b1fb={};var _0x5582cf;var _0x1620ef;return db[_0x4f09('0x42')][_0x4f09('0x4f')]({'where':{'id':_0x1d0aaf[_0x4f09('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c1165,null))[_0x4f09('0x25')](function(_0x29fefd){if(_0x29fefd){_0x5582cf=_0x29fefd;_0x13b1fb[_0x4f09('0x31')]=_[_0x4f09('0x32')](db['Team'][_0x4f09('0x2e')]);_0x13b1fb['query']=_[_0x4f09('0x32')](_0x1d0aaf[_0x4f09('0x33')]);_0x13b1fb['filters']=_[_0x4f09('0x43')](_0x13b1fb[_0x4f09('0x31')],_0x13b1fb[_0x4f09('0x33')]);_0x555b3f['attributes']=_[_0x4f09('0x43')](_0x13b1fb[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x36')]));_0x555b3f[_0x4f09('0x35')]=_0x555b3f[_0x4f09('0x35')]['length']?_0x555b3f[_0x4f09('0x35')]:_0x13b1fb[_0x4f09('0x31')];_0x555b3f['order']=qs['sort'](_0x1d0aaf['query']['sort']);_0x555b3f[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_['pick'](_0x1d0aaf[_0x4f09('0x33')],_0x13b1fb[_0x4f09('0x34')]));if(_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x3b')]){_0x555b3f['where']=_[_0x4f09('0x3d')](_0x555b3f['where'],{'$or':_[_0x4f09('0x2d')](_0x555b3f[_0x4f09('0x35')],function(_0x41708c){var _0x1b602e={};_0x1b602e[_0x41708c]={'$like':'%'+_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x3b')]+'%'};return _0x1b602e;})});}_0x555b3f=_[_0x4f09('0x3d')]({},_0x555b3f,_0x1d0aaf[_0x4f09('0x3e')]);return _0x5582cf[_0x4f09('0x5c')](_0x555b3f);}})[_0x4f09('0x25')](function(_0x9bd8fc){if(_0x9bd8fc){_0x1620ef=_0x9bd8fc['length'];if(!_0x1d0aaf['query']['hasOwnProperty'](_0x4f09('0x52'))){_0x555b3f[_0x4f09('0x1f')]=qs[_0x4f09('0x1f')](_0x1d0aaf['query'][_0x4f09('0x1f')]);_0x555b3f['offset']=qs[_0x4f09('0x1d')](_0x1d0aaf[_0x4f09('0x33')][_0x4f09('0x1d')]);}return _0x5582cf['getTeams'](_0x555b3f);}})['then'](function(_0x8eeb82){if(_0x8eeb82){return _0x8eeb82?{'count':_0x1620ef,'rows':_0x8eeb82}:null;}})[_0x4f09('0x25')](respondWithResult(_0x5c1165,null))['catch'](handleError(_0x5c1165,null));};exports[_0x4f09('0x5d')]=function(_0x384ca9,_0x3c0848,_0x4f4891){var _0x18f3ca=_0x384ca9[_0x4f09('0x46')]['ids'];return db[_0x4f09('0x5e')][_0x4f09('0x3f')]({'where':{'id':_0x18f3ca},'attributes':['id'],'include':[{'model':db[_0x4f09('0x5f')],'as':_0x4f09('0x60'),'attributes':['id','name',_0x4f09('0x61'),_0x4f09('0x62'),_0x4f09('0x63')],'raw':!![]}]})['then'](function(_0x34de57){if(_0x34de57){var _0x25b0bd=_[_0x4f09('0x64')](_0x34de57,function(_0x3002f6){var _0x4d29b8=_0x3002f6[_0x4f09('0x26')]({'plain':!![]});return _0x4d29b8[_0x4f09('0x60')];});return db[_0x4f09('0x42')]['find']({'where':{'id':_0x384ca9[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](function(_0x5c5a7a){return db[_0x4f09('0x65')]['transaction'](function(_0x6782c2){return _0x5c5a7a[_0x4f09('0x5d')](_0x18f3ca,{'transaction':_0x6782c2})[_0x4f09('0x25')](function(){return BPromise[_0x4f09('0x66')](_0x25b0bd,function(_0x36c470){return db['UserSmsQueue'][_0x4f09('0x67')]({'where':{'UserId':_0x36c470['id'],'SmsQueueId':_0x384ca9[_0x4f09('0x4c')]['id']},'transaction':_0x6782c2});});})[_0x4f09('0x25')](function(){_0x25b0bd[_0x4f09('0x68')](function(_0x4db292){socket[_0x4f09('0x69')](_0x4f09('0x6a'),{'UserId':_0x4db292['id'],'SmsQueueId':_0x5c5a7a['id']});});});});});}})[_0x4f09('0x25')](respondWithStatusCode(_0x3c0848,null))[_0x4f09('0x40')](handleError(_0x3c0848,null));};exports[_0x4f09('0x6b')]=function(_0x14df5d,_0x4b29ac,_0x44a1c5){return db[_0x4f09('0x5e')]['findAll']({'where':{'id':_0x14df5d[_0x4f09('0x33')][_0x4f09('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4f09('0x25')](handleEntityNotFound(_0x4b29ac,null))[_0x4f09('0x25')](function(_0x4a5a10){var _0x282331=_[_0x4f09('0x2d')](_0x4a5a10,'id');var _0x25a7d8=[];var _0x16ce8e=[];var _0x2441f5=squel[_0x4f09('0x6d')]();_0x2441f5['field'](_0x4f09('0x6e'))[_0x4f09('0x6f')]('team_has_sms_queues','tq')[_0x4f09('0x70')]('user_has_teams','ut',_0x4f09('0x71'))['where'](_0x4f09('0x72'),_0x14df5d[_0x4f09('0x4c')]['id']);for(var _0x48ee7b=0x0;_0x48ee7b<_0x4a5a10['length'];_0x48ee7b+=0x1){let _0x35098d=_0x4a5a10[_0x48ee7b];for(var _0x833275=0x0;_0x833275<_0x35098d['Agents'][_0x4f09('0x37')];_0x833275+=0x1){let _0x47fd29=_0x35098d[_0x4f09('0x60')][_0x833275];var _0x216ee4=_0x2441f5[_0x4f09('0x73')]();_0x216ee4[_0x4f09('0x3c')](_0x4f09('0x74'),_0x47fd29['id']);_0x16ce8e[_0x4f09('0x75')](db[_0x4f09('0x65')]['query'](_0x216ee4[_0x4f09('0x76')](),{'type':db['sequelize'][_0x4f09('0x77')][_0x4f09('0x78')]})['then'](function(_0x1b4ddb){if(_0x1b4ddb[_0x4f09('0x37')]===0x1){return _0x47fd29['id'];}else{var _0x14f0ff=_[_0x4f09('0x79')](_[_0x4f09('0x2d')](_0x1b4ddb,'TeamId'),function(_0xaec80f){return _[_0x4f09('0x7a')](_0x282331,_0xaec80f);});if(_0x14f0ff){return _0x47fd29['id'];}}}));}}return BPromise[_0x4f09('0x7b')](_0x16ce8e)[_0x4f09('0x25')](function(_0x1a833f){_0x25a7d8=_(_0x25a7d8)[_0x4f09('0x7c')](_0x1a833f)['compact']()[_0x4f09('0x7d')]();return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x14df5d[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](function(_0x50411d){return db[_0x4f09('0x65')][_0x4f09('0x7e')](function(_0x15726b){return _0x50411d[_0x4f09('0x6b')](_0x14df5d[_0x4f09('0x33')][_0x4f09('0x6c')],{'transaction':_0x15726b})[_0x4f09('0x25')](function(){if(!_['isEmpty'](_0x25a7d8)){return _0x50411d[_0x4f09('0x7f')](_0x25a7d8,{'transaction':_0x15726b});}})[_0x4f09('0x25')](function(){_0x25a7d8[_0x4f09('0x68')](function(_0x51e760){socket[_0x4f09('0x69')](_0x4f09('0x80'),{'UserId':_0x51e760,'SmsQueueId':_0x50411d['id']});});});});});});})[_0x4f09('0x25')](respondWithStatusCode(_0x4b29ac,null))[_0x4f09('0x40')](handleError(_0x4b29ac,null));};exports['addAgents']=function(_0x2651d1,_0x218672,_0x249e5a){return db[_0x4f09('0x42')][_0x4f09('0x4b')]({'where':{'id':_0x2651d1['params']['id']}})['then'](handleEntityNotFound(_0x218672,null))[_0x4f09('0x25')](function(_0x1b5ea8){if(_0x1b5ea8){return _0x1b5ea8[_0x4f09('0x81')](_0x2651d1['body']['ids'],_[_0x4f09('0x82')](_0x2651d1[_0x4f09('0x46')],[_0x4f09('0x6c'),'id'])||{})[_0x4f09('0x83')](function(_0x29f73a){for(var _0x26f6c4=0x0;_0x26f6c4<_0x2651d1[_0x4f09('0x46')]['ids'][_0x4f09('0x37')];_0x26f6c4+=0x1){socket['emit'](_0x4f09('0x6a'),{'UserId':Number(_0x2651d1[_0x4f09('0x46')][_0x4f09('0x6c')][_0x26f6c4]),'SmsQueueId':Number(_0x2651d1[_0x4f09('0x4c')]['id'])});}return _0x29f73a;});}})[_0x4f09('0x25')](respondWithResult(_0x218672,null))[_0x4f09('0x40')](handleError(_0x218672,null));};exports[_0x4f09('0x7f')]=function(_0x91e0ba,_0x471917,_0x209c46){return db['SmsQueue'][_0x4f09('0x4b')]({'where':{'id':_0x91e0ba[_0x4f09('0x4c')]['id']}})[_0x4f09('0x25')](handleEntityNotFound(_0x471917,null))['then'](function(_0x516dae){if(_0x516dae){return _0x516dae[_0x4f09('0x7f')](_0x91e0ba[_0x4f09('0x33')]['ids'])[_0x4f09('0x25')](function(){if(_['isArray'](_0x91e0ba['query']['ids'])){for(var _0x874f17=0x0;_0x874f17<_0x91e0ba[_0x4f09('0x33')]['ids']['length'];_0x874f17+=0x1){socket[_0x4f09('0x69')]('userSmsQueue:remove',{'UserId':Number(_0x91e0ba['query']['ids'][_0x874f17]),'SmsQueueId':Number(_0x91e0ba['params']['id'])});}}else{socket[_0x4f09('0x69')](_0x4f09('0x80'),{'UserId':Number(_0x91e0ba[_0x4f09('0x33')]['ids']),'SmsQueueId':Number(_0x91e0ba['params']['id'])});}});}})['then'](respondWithStatusCode(_0x471917,null))[_0x4f09('0x40')](handleError(_0x471917,null));};exports[_0x4f09('0x84')]=function(_0x33b2c0,_0x30a274,_0x1f4e00){var _0x263977={};var _0x1432dc={};var _0x5ab8dd;var _0x40affe;return db['SmsQueue'][_0x4f09('0x4f')]({'where':{'id':_0x33b2c0[_0x4f09('0x4c')]['id']}})['then'](handleEntityNotFound(_0x30a274,null))[_0x4f09('0x25')](function(_0x2a918b){if(_0x2a918b){_0x5ab8dd=_0x2a918b;_0x1432dc[_0x4f09('0x31')]=_[_0x4f09('0x32')](db[_0x4f09('0x5f')][_0x4f09('0x2e')]);_0x1432dc[_0x4f09('0x33')]=_[_0x4f09('0x32')](_0x33b2c0[_0x4f09('0x33')]);_0x1432dc[_0x4f09('0x34')]=_[_0x4f09('0x43')](_0x1432dc[_0x4f09('0x31')],_0x1432dc['query']);_0x263977[_0x4f09('0x35')]=_[_0x4f09('0x43')](_0x1432dc[_0x4f09('0x31')],qs[_0x4f09('0x36')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x36')]));_0x263977[_0x4f09('0x35')]=_0x263977[_0x4f09('0x35')][_0x4f09('0x37')]?_0x263977[_0x4f09('0x35')]:_0x1432dc[_0x4f09('0x31')];_0x263977[_0x4f09('0x38')]=qs[_0x4f09('0x39')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x39')]);_0x263977[_0x4f09('0x3c')]=qs[_0x4f09('0x34')](_[_0x4f09('0x3a')](_0x33b2c0[_0x4f09('0x33')],_0x1432dc['filters']));if(_0x33b2c0[_0x4f09('0x33')]['filter']){_0x263977[_0x4f09('0x3c')]=_[_0x4f09('0x3d')](_0x263977[_0x4f09('0x3c')],{'$or':_[_0x4f09('0x2d')](_0x263977[_0x4f09('0x35')],function(_0x3fc9a5){var _0xe675c2={};_0xe675c2[_0x3fc9a5]={'$like':'%'+_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x3b')]+'%'};return _0xe675c2;})});}_0x263977=_[_0x4f09('0x3d')]({},_0x263977,_0x33b2c0[_0x4f09('0x3e')]);return _0x5ab8dd['getAgents'](_0x263977);}})[_0x4f09('0x25')](function(_0xf0a853){if(_0xf0a853){_0x40affe=_0xf0a853['length'];if(!_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x51')](_0x4f09('0x52'))){_0x263977[_0x4f09('0x1f')]=qs['limit'](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x1f')]);_0x263977[_0x4f09('0x1d')]=qs[_0x4f09('0x1d')](_0x33b2c0[_0x4f09('0x33')][_0x4f09('0x1d')]);}return _0x5ab8dd[_0x4f09('0x84')](_0x263977);}})[_0x4f09('0x25')](function(_0xac922c){if(_0xac922c){return _0xac922c?{'count':_0x40affe,'rows':_0xac922c}:null;}})[_0x4f09('0x25')](respondWithResult(_0x30a274,null))[_0x4f09('0x40')](handleError(_0x30a274,null));}; \ No newline at end of file +var _0x3527=['save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsQueue','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','order','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','Agents','voicePause','interface','flatMap','findOrCreate','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','sequelize','transaction','removeAgents','emit','addAgents','spread','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x331f60,_0x30333e){var _0x29994e=function(_0x38dc49){while(--_0x38dc49){_0x331f60['push'](_0x331f60['shift']());}};_0x29994e(++_0x30333e);}(_0x3527,0x171));var _0x7352=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x3527[_0x15cbce];return _0x257f29;};'use strict';var emlformat=require(_0x7352('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7352('0x1'));var jsonpatch=require(_0x7352('0x2'));var rp=require('request-promise');var moment=require(_0x7352('0x3'));var BPromise=require(_0x7352('0x4'));var Mustache=require(_0x7352('0x5'));var util=require(_0x7352('0x6'));var path=require(_0x7352('0x7'));var sox=require(_0x7352('0x8'));var csv=require(_0x7352('0x9'));var ejs=require(_0x7352('0xa'));var fs=require('fs');var fs_extra=require(_0x7352('0xb'));var _=require(_0x7352('0xc'));var squel=require(_0x7352('0xd'));var crypto=require(_0x7352('0xe'));var jsforce=require(_0x7352('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7352('0x9'));var querystring=require(_0x7352('0x10'));var Papa=require('papaparse');var Redis=require(_0x7352('0x11'));var authService=require(_0x7352('0x12'));var qs=require(_0x7352('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7352('0x14'));var logger=require(_0x7352('0x15'))('api');var utils=require(_0x7352('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7352('0x17'));var db=require(_0x7352('0x18'))['db'];config[_0x7352('0x19')]=_[_0x7352('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7352('0x1b'))(new Redis(config[_0x7352('0x19')]));require('./smsQueue.socket')[_0x7352('0x1c')](socket);function respondWithStatusCode(_0x31f327,_0x3b1732){_0x3b1732=_0x3b1732||0xcc;return function(_0x2fb82c){if(_0x2fb82c){return _0x31f327['sendStatus'](_0x3b1732);}return _0x31f327[_0x7352('0x1d')](_0x3b1732)[_0x7352('0x1e')]();};}function respondWithResult(_0x3f7a19,_0x355d50){_0x355d50=_0x355d50||0xc8;return function(_0x119ca6){if(_0x119ca6){return _0x3f7a19['status'](_0x355d50)['json'](_0x119ca6);}};}function respondWithFilteredResult(_0x34a4da,_0x4f5e7b){return function(_0x129d26){if(_0x129d26){var _0x157b70=typeof _0x4f5e7b[_0x7352('0x1f')]===_0x7352('0x20')&&typeof _0x4f5e7b[_0x7352('0x21')]===_0x7352('0x20');var _0x3a9e84=_0x129d26[_0x7352('0x22')];var _0x4ca1ab=_0x157b70?0x0:_0x4f5e7b[_0x7352('0x1f')];var _0x50bcd4=_0x157b70?_0x129d26['count']:_0x4f5e7b[_0x7352('0x1f')]+_0x4f5e7b['limit'];var _0x179d99;if(_0x50bcd4>=_0x3a9e84){_0x50bcd4=_0x3a9e84;_0x179d99=0xc8;}else{_0x179d99=0xce;}_0x34a4da[_0x7352('0x1d')](_0x179d99);return _0x34a4da[_0x7352('0x23')](_0x7352('0x24'),_0x4ca1ab+'-'+_0x50bcd4+'/'+_0x3a9e84)['json'](_0x129d26);}return null;};}function patchUpdates(_0x33c162){return function(_0x5286fb){try{jsonpatch[_0x7352('0x25')](_0x5286fb,_0x33c162,!![]);}catch(_0x3ad2e6){return BPromise[_0x7352('0x26')](_0x3ad2e6);}return _0x5286fb[_0x7352('0x27')]();};}function saveUpdates(_0x1d0387,_0xa89fd8){return function(_0x2df120){if(_0x2df120){return _0x2df120[_0x7352('0x28')](_0x1d0387)[_0x7352('0x29')](function(_0x42227d){return _0x42227d;});}return null;};}function removeEntity(_0x3782c8,_0x2033b5){return function(_0x613056){if(_0x613056){return _0x613056[_0x7352('0x2a')]()[_0x7352('0x29')](function(){var _0x2a2746=_0x613056['get']({'plain':!![]});var _0x530471='SmsQueues';return db[_0x7352('0x2b')]['destroy']({'where':{'type':_0x530471,'resourceId':_0x2a2746['id']}})[_0x7352('0x29')](function(){return _0x613056;});})[_0x7352('0x29')](function(){_0x3782c8[_0x7352('0x1d')](0xcc)[_0x7352('0x1e')]();});}};}function handleEntityNotFound(_0x2d6f79,_0x292511){return function(_0x5a2408){if(!_0x5a2408){_0x2d6f79['sendStatus'](0x194);}return _0x5a2408;};}function handleError(_0x3a3577,_0x1ffd9e){_0x1ffd9e=_0x1ffd9e||0x1f4;return function(_0x24c35a){logger[_0x7352('0x2c')](_0x24c35a[_0x7352('0x2d')]);if(_0x24c35a[_0x7352('0x2e')]){delete _0x24c35a[_0x7352('0x2e')];}_0x3a3577['status'](_0x1ffd9e)[_0x7352('0x2f')](_0x24c35a);};}exports[_0x7352('0x30')]=function(_0x13f4a7,_0x502133){var _0x550dae={},_0x12ba1e={},_0x5b8b6a={'count':0x0,'rows':[]};var _0x45f49c=_[_0x7352('0x31')](db['SmsQueue'][_0x7352('0x32')],function(_0x1d3449){return{'name':_0x1d3449[_0x7352('0x33')],'type':_0x1d3449[_0x7352('0x34')][_0x7352('0x35')]};});_0x12ba1e['model']=_[_0x7352('0x31')](_0x45f49c,_0x7352('0x2e'));_0x12ba1e[_0x7352('0x36')]=_[_0x7352('0x37')](_0x13f4a7[_0x7352('0x36')]);_0x12ba1e['filters']=_[_0x7352('0x38')](_0x12ba1e['model'],_0x12ba1e['query']);_0x550dae[_0x7352('0x39')]=_[_0x7352('0x38')](_0x12ba1e[_0x7352('0x3a')],qs[_0x7352('0x3b')](_0x13f4a7[_0x7352('0x36')][_0x7352('0x3b')]));_0x550dae[_0x7352('0x39')]=_0x550dae['attributes'][_0x7352('0x3c')]?_0x550dae[_0x7352('0x39')]:_0x12ba1e[_0x7352('0x3a')];if(!_0x13f4a7[_0x7352('0x36')][_0x7352('0x3d')](_0x7352('0x3e'))){_0x550dae[_0x7352('0x21')]=qs[_0x7352('0x21')](_0x13f4a7[_0x7352('0x36')][_0x7352('0x21')]);_0x550dae[_0x7352('0x1f')]=qs[_0x7352('0x1f')](_0x13f4a7[_0x7352('0x36')][_0x7352('0x1f')]);}_0x550dae['order']=qs[_0x7352('0x3f')](_0x13f4a7[_0x7352('0x36')][_0x7352('0x3f')]);_0x550dae[_0x7352('0x40')]=qs[_0x7352('0x41')](_[_0x7352('0x42')](_0x13f4a7[_0x7352('0x36')],_0x12ba1e[_0x7352('0x41')]),_0x45f49c);if(_0x13f4a7['query'][_0x7352('0x43')]){_0x550dae[_0x7352('0x40')]=_[_0x7352('0x44')](_0x550dae[_0x7352('0x40')],{'$or':_[_0x7352('0x31')](_0x45f49c,function(_0x520d33){if(_0x520d33[_0x7352('0x34')]!==_0x7352('0x45')){var _0x3903d8={};_0x3903d8[_0x520d33[_0x7352('0x2e')]]={'$like':'%'+_0x13f4a7['query'][_0x7352('0x43')]+'%'};return _0x3903d8;}})});}_0x550dae=_[_0x7352('0x44')]({},_0x550dae,_0x13f4a7[_0x7352('0x46')]);var _0x2325bb={'where':_0x550dae[_0x7352('0x40')]};return db['SmsQueue'][_0x7352('0x22')](_0x2325bb)[_0x7352('0x29')](function(_0x5ee786){_0x5b8b6a[_0x7352('0x22')]=_0x5ee786;if(_0x13f4a7['query']['includeAll']){_0x550dae['include']=[{'all':!![]}];}return db[_0x7352('0x47')][_0x7352('0x48')](_0x550dae);})[_0x7352('0x29')](function(_0x378de5){_0x5b8b6a[_0x7352('0x49')]=_0x378de5;return _0x5b8b6a;})[_0x7352('0x29')](respondWithFilteredResult(_0x502133,_0x550dae))[_0x7352('0x4a')](handleError(_0x502133,null));};exports[_0x7352('0x4b')]=function(_0x521134,_0x9a177b){var _0x3e7a70={'raw':!![],'where':{'id':_0x521134[_0x7352('0x4c')]['id']}},_0x48e1dd={};_0x48e1dd[_0x7352('0x3a')]=_[_0x7352('0x37')](db[_0x7352('0x47')]['rawAttributes']);_0x48e1dd[_0x7352('0x36')]=_[_0x7352('0x37')](_0x521134[_0x7352('0x36')]);_0x48e1dd['filters']=_[_0x7352('0x38')](_0x48e1dd[_0x7352('0x3a')],_0x48e1dd[_0x7352('0x36')]);_0x3e7a70['attributes']=_[_0x7352('0x38')](_0x48e1dd['model'],qs[_0x7352('0x3b')](_0x521134[_0x7352('0x36')][_0x7352('0x3b')]));_0x3e7a70[_0x7352('0x39')]=_0x3e7a70['attributes']['length']?_0x3e7a70[_0x7352('0x39')]:_0x48e1dd[_0x7352('0x3a')];if(_0x521134[_0x7352('0x36')][_0x7352('0x4d')]){_0x3e7a70[_0x7352('0x4e')]=[{'all':!![]}];}_0x3e7a70=_['merge']({},_0x3e7a70,_0x521134['options']);return db[_0x7352('0x47')][_0x7352('0x4f')](_0x3e7a70)[_0x7352('0x29')](handleEntityNotFound(_0x9a177b,null))[_0x7352('0x29')](respondWithResult(_0x9a177b,null))[_0x7352('0x4a')](handleError(_0x9a177b,null));};exports[_0x7352('0x50')]=function(_0x27f638,_0x5f285c){return db[_0x7352('0x47')][_0x7352('0x50')](_0x27f638[_0x7352('0x51')],{})[_0x7352('0x29')](function(_0x254ab1){var _0x58ee1e=_0x27f638[_0x7352('0x52')][_0x7352('0x53')]({'plain':!![]});if(!_0x58ee1e)throw new Error(_0x7352('0x54'));if(_0x58ee1e[_0x7352('0x55')]==='user'){var _0x5a0100=_0x254ab1[_0x7352('0x53')]({'plain':!![]});var _0x5f33d3=_0x7352('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x5f33d3,'userProfileId':_0x58ee1e[_0x7352('0x57')]},'raw':!![]})[_0x7352('0x29')](function(_0x459b2d){if(_0x459b2d&&_0x459b2d['autoAssociation']===0x0){return db[_0x7352('0x2b')][_0x7352('0x50')]({'name':_0x5a0100[_0x7352('0x2e')],'resourceId':_0x5a0100['id'],'type':_0x459b2d[_0x7352('0x2e')],'sectionId':_0x459b2d['id']},{})[_0x7352('0x29')](function(){return _0x254ab1;});}else{return _0x254ab1;}})['catch'](function(_0x4db666){logger[_0x7352('0x2c')](_0x7352('0x58'),_0x4db666);throw _0x4db666;});}return _0x254ab1;})['then'](respondWithResult(_0x5f285c,0xc9))[_0x7352('0x4a')](handleError(_0x5f285c,null));};exports[_0x7352('0x28')]=function(_0x4bb627,_0x49dd54){if(_0x4bb627['body']['id']){delete _0x4bb627[_0x7352('0x51')]['id'];}return db[_0x7352('0x47')]['find']({'where':{'id':_0x4bb627['params']['id']}})[_0x7352('0x29')](handleEntityNotFound(_0x49dd54,null))[_0x7352('0x29')](saveUpdates(_0x4bb627[_0x7352('0x51')],null))[_0x7352('0x29')](respondWithResult(_0x49dd54,null))['catch'](handleError(_0x49dd54,null));};exports[_0x7352('0x2a')]=function(_0x579947,_0x435238){return db['SmsQueue'][_0x7352('0x4f')]({'where':{'id':_0x579947[_0x7352('0x4c')]['id']}})['then'](handleEntityNotFound(_0x435238,null))[_0x7352('0x29')](removeEntity(_0x435238,null))[_0x7352('0x4a')](handleError(_0x435238,null));};exports[_0x7352('0x59')]=function(_0x1ec33b,_0x5433bb){return db[_0x7352('0x47')][_0x7352('0x59')]()['then'](respondWithResult(_0x5433bb,null))[_0x7352('0x4a')](handleError(_0x5433bb,null));};exports[_0x7352('0x5a')]=function(_0x25d638,_0x2131ce,_0xc443f8){var _0x3780d8={'raw':!![],'where':{}},_0x32b144={},_0x315cab;return db['SmsQueue'][_0x7352('0x5b')]({'where':{'id':_0x25d638['params']['id']}})['then'](handleEntityNotFound(_0x2131ce,null))[_0x7352('0x29')](function(_0x34f62c){if(_0x34f62c){_0x315cab=_0x34f62c['get']({'plain':!![]});_0x32b144[_0x7352('0x3a')]=_[_0x7352('0x37')](db[_0x7352('0x5c')][_0x7352('0x32')]);_0x32b144[_0x7352('0x36')]=_[_0x7352('0x37')](_0x25d638[_0x7352('0x36')]);_0x32b144[_0x7352('0x41')]=_['intersection'](_0x32b144[_0x7352('0x3a')],_0x32b144[_0x7352('0x36')]);_0x3780d8[_0x7352('0x39')]=_['intersection'](_0x32b144[_0x7352('0x3a')],qs[_0x7352('0x3b')](_0x25d638[_0x7352('0x36')][_0x7352('0x3b')]));_0x3780d8[_0x7352('0x39')]=_0x3780d8[_0x7352('0x39')][_0x7352('0x3c')]?_0x3780d8['attributes']:_0x32b144['model'];if(!_0x25d638[_0x7352('0x36')]['hasOwnProperty'](_0x7352('0x3e'))){_0x3780d8[_0x7352('0x21')]=qs['limit'](_0x25d638[_0x7352('0x36')][_0x7352('0x21')]);_0x3780d8[_0x7352('0x1f')]=qs[_0x7352('0x1f')](_0x25d638[_0x7352('0x36')][_0x7352('0x1f')]);}_0x3780d8[_0x7352('0x5d')]=qs[_0x7352('0x3f')](_0x25d638[_0x7352('0x36')]['sort']);_0x3780d8[_0x7352('0x40')]=qs[_0x7352('0x41')](_[_0x7352('0x42')](_0x25d638[_0x7352('0x36')],_0x32b144[_0x7352('0x41')]));_0x3780d8[_0x7352('0x40')]['SmsQueueId']=_0x34f62c['id'];if(_0x25d638['query'][_0x7352('0x43')]){_0x3780d8['where']=_['merge'](_0x3780d8[_0x7352('0x40')],{'$or':_[_0x7352('0x31')](_0x3780d8[_0x7352('0x39')],function(_0x39c489){var _0x20ef7b={};_0x20ef7b[_0x39c489]={'$like':'%'+_0x25d638['query'][_0x7352('0x43')]+'%'};return _0x20ef7b;})});}_0x3780d8=_[_0x7352('0x44')]({},_0x3780d8,_0x25d638['options']);return db[_0x7352('0x5c')]['findAll'](_0x3780d8);}})[_0x7352('0x29')](function(_0x100b55){if(_0x100b55){return db[_0x7352('0x5e')]['findAndCountAll']({'where':{'id':_[_0x7352('0x31')](_0x100b55,_0x7352('0x5f')),'role':_0x7352('0x60')},'attributes':['id',_0x7352('0x2e'),_0x7352('0x61'),_0x7352('0x62'),_0x7352('0x63')]});}})[_0x7352('0x29')](function(_0x3a4e45){if(_0x3a4e45){return{'count':_0x3a4e45[_0x7352('0x22')],'rows':_[_0x7352('0x31')](_0x3a4e45[_0x7352('0x49')],function(_0x46c5f8){return{'membername':_0x46c5f8[_0x7352('0x2e')],'UserId':_0x46c5f8['id'],'queue_name':_0x315cab[_0x7352('0x2e')],'SmsQueueId':_0x315cab['id'],'interface':util[_0x7352('0x64')](_0x7352('0x65'),'SIP',_0x46c5f8[_0x7352('0x2e')]),'penalty':0x0,'paused':_0x46c5f8[_0x7352('0x61')],'createdAt':_0x46c5f8[_0x7352('0x63')],'updatedAt':_0x46c5f8[_0x7352('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7352('0x29')](respondWithFilteredResult(_0x2131ce,_0x3780d8))['catch'](handleError(_0x2131ce,null));};exports[_0x7352('0x66')]=function(_0x10f697,_0x47e90d,_0x1af827){var _0x3f7405={};var _0x2fe5ef={};var _0x58faf9;var _0x4fe870;return db[_0x7352('0x47')][_0x7352('0x5b')]({'where':{'id':_0x10f697[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](handleEntityNotFound(_0x47e90d,null))[_0x7352('0x29')](function(_0x49eb20){if(_0x49eb20){_0x58faf9=_0x49eb20;_0x2fe5ef['model']=_[_0x7352('0x37')](db[_0x7352('0x67')][_0x7352('0x32')]);_0x2fe5ef[_0x7352('0x36')]=_[_0x7352('0x37')](_0x10f697['query']);_0x2fe5ef[_0x7352('0x41')]=_[_0x7352('0x38')](_0x2fe5ef[_0x7352('0x3a')],_0x2fe5ef[_0x7352('0x36')]);_0x3f7405[_0x7352('0x39')]=_[_0x7352('0x38')](_0x2fe5ef[_0x7352('0x3a')],qs[_0x7352('0x3b')](_0x10f697[_0x7352('0x36')]['fields']));_0x3f7405[_0x7352('0x39')]=_0x3f7405[_0x7352('0x39')]['length']?_0x3f7405[_0x7352('0x39')]:_0x2fe5ef[_0x7352('0x3a')];_0x3f7405[_0x7352('0x5d')]=qs[_0x7352('0x3f')](_0x10f697[_0x7352('0x36')][_0x7352('0x3f')]);_0x3f7405[_0x7352('0x40')]=qs['filters'](_[_0x7352('0x42')](_0x10f697[_0x7352('0x36')],_0x2fe5ef[_0x7352('0x41')]));if(_0x10f697[_0x7352('0x36')][_0x7352('0x43')]){_0x3f7405[_0x7352('0x40')]=_[_0x7352('0x44')](_0x3f7405[_0x7352('0x40')],{'$or':_[_0x7352('0x31')](_0x3f7405['attributes'],function(_0x52e5eb){var _0x48ffe4={};_0x48ffe4[_0x52e5eb]={'$like':'%'+_0x10f697['query']['filter']+'%'};return _0x48ffe4;})});}_0x3f7405=_[_0x7352('0x44')]({},_0x3f7405,_0x10f697[_0x7352('0x46')]);return _0x58faf9[_0x7352('0x66')](_0x3f7405);}})[_0x7352('0x29')](function(_0x2a8be){if(_0x2a8be){_0x4fe870=_0x2a8be[_0x7352('0x3c')];if(!_0x10f697[_0x7352('0x36')][_0x7352('0x3d')]('nolimit')){_0x3f7405[_0x7352('0x21')]=qs['limit'](_0x10f697[_0x7352('0x36')][_0x7352('0x21')]);_0x3f7405[_0x7352('0x1f')]=qs[_0x7352('0x1f')](_0x10f697[_0x7352('0x36')]['offset']);}return _0x58faf9[_0x7352('0x66')](_0x3f7405);}})['then'](function(_0x221f69){if(_0x221f69){return _0x221f69?{'count':_0x4fe870,'rows':_0x221f69}:null;}})[_0x7352('0x29')](respondWithResult(_0x47e90d,null))[_0x7352('0x4a')](handleError(_0x47e90d,null));};exports['addTeams']=function(_0x2a50d1,_0x2cb490,_0x2218ef){var _0x4d1687=_0x2a50d1[_0x7352('0x51')]['ids'];return db[_0x7352('0x67')][_0x7352('0x48')]({'where':{'id':_0x4d1687},'attributes':['id'],'include':[{'model':db[_0x7352('0x5e')],'as':_0x7352('0x68'),'attributes':['id',_0x7352('0x2e'),'online',_0x7352('0x69'),_0x7352('0x6a')],'raw':!![]}]})[_0x7352('0x29')](function(_0xecf35a){if(_0xecf35a){var _0x4ce7e3=_[_0x7352('0x6b')](_0xecf35a,function(_0x2bba16){var _0x35bc76=_0x2bba16['get']({'plain':!![]});return _0x35bc76['Agents'];});return db['SmsQueue'][_0x7352('0x4f')]({'where':{'id':_0x2a50d1[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](function(_0x479c66){return db['sequelize']['transaction'](function(_0x353044){return _0x479c66['addTeams'](_0x4d1687,{'transaction':_0x353044})[_0x7352('0x29')](function(){return BPromise['each'](_0x4ce7e3,function(_0x1021b7){return db[_0x7352('0x5c')][_0x7352('0x6c')]({'where':{'UserId':_0x1021b7['id'],'SmsQueueId':_0x2a50d1[_0x7352('0x4c')]['id']},'transaction':_0x353044});});})[_0x7352('0x29')](function(){_0x4ce7e3['forEach'](function(_0x5428a7){socket['emit'](_0x7352('0x6d'),{'UserId':_0x5428a7['id'],'SmsQueueId':_0x479c66['id']});});});});});}})[_0x7352('0x29')](respondWithStatusCode(_0x2cb490,null))['catch'](handleError(_0x2cb490,null));};exports[_0x7352('0x6e')]=function(_0x3a6ed3,_0x5570e1,_0x1f4dd7){return db[_0x7352('0x67')][_0x7352('0x48')]({'where':{'id':_0x3a6ed3[_0x7352('0x36')][_0x7352('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x7352('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5570e1,null))[_0x7352('0x29')](function(_0x270fd4){var _0x39e1a7=_[_0x7352('0x31')](_0x270fd4,'id');var _0x519eb5=[];var _0x531175=[];var _0x117e29=squel[_0x7352('0x70')]();_0x117e29[_0x7352('0x71')](_0x7352('0x72'))['from'](_0x7352('0x73'),'tq')[_0x7352('0x74')]('user_has_teams','ut',_0x7352('0x75'))[_0x7352('0x40')]('SmsQueueId\x20=\x20?',_0x3a6ed3[_0x7352('0x4c')]['id']);for(var _0x3c05ac=0x0;_0x3c05ac<_0x270fd4[_0x7352('0x3c')];_0x3c05ac+=0x1){let _0x360cae=_0x270fd4[_0x3c05ac];for(var _0x4b207c=0x0;_0x4b207c<_0x360cae[_0x7352('0x68')][_0x7352('0x3c')];_0x4b207c+=0x1){let _0x952986=_0x360cae[_0x7352('0x68')][_0x4b207c];var _0x20e03c=_0x117e29[_0x7352('0x76')]();_0x20e03c[_0x7352('0x40')](_0x7352('0x77'),_0x952986['id']);_0x531175[_0x7352('0x78')](db['sequelize'][_0x7352('0x36')](_0x20e03c[_0x7352('0x79')](),{'type':db['sequelize'][_0x7352('0x7a')][_0x7352('0x7b')]})[_0x7352('0x29')](function(_0x465b58){if(_0x465b58['length']===0x1){return _0x952986['id'];}else{var _0x17ce44=_[_0x7352('0x7c')](_[_0x7352('0x31')](_0x465b58,'TeamId'),function(_0x404d24){return _[_0x7352('0x7d')](_0x39e1a7,_0x404d24);});if(_0x17ce44){return _0x952986['id'];}}}));}}return BPromise['all'](_0x531175)[_0x7352('0x29')](function(_0x168e22){_0x519eb5=_(_0x519eb5)[_0x7352('0x7e')](_0x168e22)['compact']()['value']();return db['SmsQueue']['find']({'where':{'id':_0x3a6ed3[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](function(_0x4a6230){return db[_0x7352('0x7f')][_0x7352('0x80')](function(_0x324c87){return _0x4a6230['removeTeams'](_0x3a6ed3['query'][_0x7352('0x6f')],{'transaction':_0x324c87})['then'](function(){if(!_['isEmpty'](_0x519eb5)){return _0x4a6230[_0x7352('0x81')](_0x519eb5,{'transaction':_0x324c87});}})[_0x7352('0x29')](function(){_0x519eb5['forEach'](function(_0x297289){socket[_0x7352('0x82')]('userSmsQueue:remove',{'UserId':_0x297289,'SmsQueueId':_0x4a6230['id']});});});});});});})[_0x7352('0x29')](respondWithStatusCode(_0x5570e1,null))[_0x7352('0x4a')](handleError(_0x5570e1,null));};exports[_0x7352('0x83')]=function(_0x226449,_0x32e510,_0x396d2e){return db['SmsQueue'][_0x7352('0x4f')]({'where':{'id':_0x226449[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](handleEntityNotFound(_0x32e510,null))[_0x7352('0x29')](function(_0x584cb6){if(_0x584cb6){return _0x584cb6[_0x7352('0x83')](_0x226449[_0x7352('0x51')][_0x7352('0x6f')],_['omit'](_0x226449['body'],[_0x7352('0x6f'),'id'])||{})[_0x7352('0x84')](function(_0x36e3ec){for(var _0x2740f1=0x0;_0x2740f1<_0x226449[_0x7352('0x51')][_0x7352('0x6f')]['length'];_0x2740f1+=0x1){socket[_0x7352('0x82')](_0x7352('0x6d'),{'UserId':Number(_0x226449[_0x7352('0x51')][_0x7352('0x6f')][_0x2740f1]),'SmsQueueId':Number(_0x226449[_0x7352('0x4c')]['id'])});}return _0x36e3ec;});}})['then'](respondWithResult(_0x32e510,null))[_0x7352('0x4a')](handleError(_0x32e510,null));};exports[_0x7352('0x81')]=function(_0xc5f99c,_0x40c384,_0x17efd1){return db[_0x7352('0x47')][_0x7352('0x4f')]({'where':{'id':_0xc5f99c[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](handleEntityNotFound(_0x40c384,null))[_0x7352('0x29')](function(_0x297ba3){if(_0x297ba3){return _0x297ba3[_0x7352('0x81')](_0xc5f99c['query'][_0x7352('0x6f')])['then'](function(){if(_[_0x7352('0x85')](_0xc5f99c['query'][_0x7352('0x6f')])){for(var _0x4392b4=0x0;_0x4392b4<_0xc5f99c[_0x7352('0x36')][_0x7352('0x6f')][_0x7352('0x3c')];_0x4392b4+=0x1){socket[_0x7352('0x82')]('userSmsQueue:remove',{'UserId':Number(_0xc5f99c['query'][_0x7352('0x6f')][_0x4392b4]),'SmsQueueId':Number(_0xc5f99c['params']['id'])});}}else{socket[_0x7352('0x82')](_0x7352('0x86'),{'UserId':Number(_0xc5f99c['query'][_0x7352('0x6f')]),'SmsQueueId':Number(_0xc5f99c[_0x7352('0x4c')]['id'])});}});}})[_0x7352('0x29')](respondWithStatusCode(_0x40c384,null))[_0x7352('0x4a')](handleError(_0x40c384,null));};exports[_0x7352('0x87')]=function(_0x9ce53e,_0x13c374,_0x2e9c01){var _0x39082f={};var _0x1ff472={};var _0x5a9f48;var _0x202cba;return db[_0x7352('0x47')][_0x7352('0x5b')]({'where':{'id':_0x9ce53e[_0x7352('0x4c')]['id']}})[_0x7352('0x29')](handleEntityNotFound(_0x13c374,null))['then'](function(_0x352bb0){if(_0x352bb0){_0x5a9f48=_0x352bb0;_0x1ff472['model']=_['keys'](db['User'][_0x7352('0x32')]);_0x1ff472[_0x7352('0x36')]=_[_0x7352('0x37')](_0x9ce53e['query']);_0x1ff472[_0x7352('0x41')]=_['intersection'](_0x1ff472[_0x7352('0x3a')],_0x1ff472['query']);_0x39082f[_0x7352('0x39')]=_[_0x7352('0x38')](_0x1ff472[_0x7352('0x3a')],qs['fields'](_0x9ce53e[_0x7352('0x36')][_0x7352('0x3b')]));_0x39082f[_0x7352('0x39')]=_0x39082f[_0x7352('0x39')][_0x7352('0x3c')]?_0x39082f[_0x7352('0x39')]:_0x1ff472[_0x7352('0x3a')];_0x39082f[_0x7352('0x5d')]=qs[_0x7352('0x3f')](_0x9ce53e[_0x7352('0x36')][_0x7352('0x3f')]);_0x39082f[_0x7352('0x40')]=qs['filters'](_[_0x7352('0x42')](_0x9ce53e[_0x7352('0x36')],_0x1ff472[_0x7352('0x41')]));if(_0x9ce53e[_0x7352('0x36')][_0x7352('0x43')]){_0x39082f['where']=_[_0x7352('0x44')](_0x39082f[_0x7352('0x40')],{'$or':_[_0x7352('0x31')](_0x39082f[_0x7352('0x39')],function(_0xbf5140){var _0x5e5533={};_0x5e5533[_0xbf5140]={'$like':'%'+_0x9ce53e[_0x7352('0x36')][_0x7352('0x43')]+'%'};return _0x5e5533;})});}_0x39082f=_[_0x7352('0x44')]({},_0x39082f,_0x9ce53e[_0x7352('0x46')]);return _0x5a9f48['getAgents'](_0x39082f);}})[_0x7352('0x29')](function(_0x5cc1b1){if(_0x5cc1b1){_0x202cba=_0x5cc1b1[_0x7352('0x3c')];if(!_0x9ce53e[_0x7352('0x36')][_0x7352('0x3d')](_0x7352('0x3e'))){_0x39082f['limit']=qs[_0x7352('0x21')](_0x9ce53e[_0x7352('0x36')]['limit']);_0x39082f[_0x7352('0x1f')]=qs[_0x7352('0x1f')](_0x9ce53e[_0x7352('0x36')][_0x7352('0x1f')]);}return _0x5a9f48[_0x7352('0x87')](_0x39082f);}})[_0x7352('0x29')](function(_0x5b78cb){if(_0x5b78cb){return _0x5b78cb?{'count':_0x202cba,'rows':_0x5b78cb}:null;}})[_0x7352('0x29')](respondWithResult(_0x13c374,null))[_0x7352('0x4a')](handleError(_0x13c374,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index a2224e3..a523176 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 _0x6e5a=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x306898,_0x19b59b){var _0x299817=function(_0x3c5669){while(--_0x3c5669){_0x306898['push'](_0x306898['shift']());}};_0x299817(++_0x19b59b);}(_0x6e5a,0x13a));var _0xa6e5=function(_0x21ac6d,_0x5757dc){_0x21ac6d=_0x21ac6d-0x0;var _0x2ae901=_0x6e5a[_0x21ac6d];return _0x2ae901;};'use strict';var EventEmitter=require(_0xa6e5('0x0'));var SmsQueue=require(_0xa6e5('0x1'))['db'][_0xa6e5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6e5('0x3'),'afterUpdate':_0xa6e5('0x4'),'afterDestroy':_0xa6e5('0x5')};function emitEvent(_0x2b9f01){return function(_0x28a2d3,_0x5e8d5b,_0x1b173f){SmsQueueEvents[_0xa6e5('0x6')](_0x2b9f01+':'+_0x28a2d3['id'],_0x28a2d3);SmsQueueEvents[_0xa6e5('0x6')](_0x2b9f01,_0x28a2d3);_0x1b173f(null);};}for(var e in events){if(events[_0xa6e5('0x7')](e)){var event=events[e];SmsQueue[_0xa6e5('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x64bb=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3238bd,_0x4ea3ef){var _0xdc7a7e=function(_0x275fbc){while(--_0x275fbc){_0x3238bd['push'](_0x3238bd['shift']());}};_0xdc7a7e(++_0x4ea3ef);}(_0x64bb,0x144));var _0xb64b=function(_0x13f5c8,_0x43bfb0){_0x13f5c8=_0x13f5c8-0x0;var _0xa84bf7=_0x64bb[_0x13f5c8];return _0xa84bf7;};'use strict';var EventEmitter=require(_0xb64b('0x0'));var SmsQueue=require(_0xb64b('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb64b('0x2')](0x0);var events={'afterCreate':_0xb64b('0x3'),'afterUpdate':_0xb64b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f5ee){return function(_0x28e903,_0x1b543b,_0x4b9a6b){SmsQueueEvents['emit'](_0x38f5ee+':'+_0x28e903['id'],_0x28e903);SmsQueueEvents[_0xb64b('0x5')](_0x38f5ee,_0x28e903);_0x4b9a6b(null);};}for(var e in events){if(events[_0xb64b('0x6')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb64b('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8b7ea5a..3957cd2 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 _0x1ce6=['rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5b878b,_0x5e5a75){var _0x18ac65=function(_0x2b870c){while(--_0x2b870c){_0x5b878b['push'](_0x5b878b['shift']());}};_0x18ac65(++_0x5e5a75);}(_0x1ce6,0x65));var _0x61ce=function(_0x5bd909,_0x543760){_0x5bd909=_0x5bd909-0x0;var _0x27d6ba=_0x1ce6[_0x5bd909];return _0x27d6ba;};'use strict';var _=require(_0x61ce('0x0'));var util=require(_0x61ce('0x1'));var logger=require(_0x61ce('0x2'))(_0x61ce('0x3'));var moment=require(_0x61ce('0x4'));var BPromise=require(_0x61ce('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61ce('0x6'));var rimraf=require(_0x61ce('0x7'));var config=require(_0x61ce('0x8'));var attributes=require(_0x61ce('0x9'));module['exports']=function(_0x38f72d,_0x2de674){return _0x38f72d[_0x61ce('0xa')]('SmsQueue',attributes,{'tableName':_0x61ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeecc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x2d25e5,_0x5d1e52){var _0x8385c8=function(_0x2dd203){while(--_0x2dd203){_0x2d25e5['push'](_0x2d25e5['shift']());}};_0x8385c8(++_0x5d1e52);}(_0xeecc,0xa4));var _0xceec=function(_0x5a7cf0,_0x5f49fa){_0x5a7cf0=_0x5a7cf0-0x0;var _0x36aa88=_0xeecc[_0x5a7cf0];return _0x36aa88;};'use strict';var _=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var logger=require(_0xceec('0x2'))(_0xceec('0x3'));var moment=require(_0xceec('0x4'));var BPromise=require(_0xceec('0x5'));var rp=require(_0xceec('0x6'));var fs=require('fs');var path=require(_0xceec('0x7'));var rimraf=require(_0xceec('0x8'));var config=require(_0xceec('0x9'));var attributes=require(_0xceec('0xa'));module['exports']=function(_0x3a6f26,_0x531492){return _0x3a6f26[_0xceec('0xb')](_0xceec('0xc'),attributes,{'tableName':_0xceec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 839a2ac..42579d3 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 _0x0df3=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','ShowSmsQueue','SmsQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x0df3,0x98));var _0x30df=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0x0df3[_0x440917];return _0x5e906b;};'use strict';var _=require(_0x30df('0x0'));var util=require('util');var moment=require(_0x30df('0x1'));var BPromise=require('bluebird');var rs=require(_0x30df('0x2'));var fs=require('fs');var Redis=require(_0x30df('0x3'));var db=require(_0x30df('0x4'))['db'];var utils=require(_0x30df('0x5'));var logger=require(_0x30df('0x6'))(_0x30df('0x7'));var config=require(_0x30df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x30df('0x9')][_0x30df('0xa')]({'port':0x232a});config[_0x30df('0xb')]=_[_0x30df('0xc')](config['redis'],{'host':_0x30df('0xd'),'port':0x18eb});var socket=require(_0x30df('0xe'))(new Redis(config[_0x30df('0xb')]));require(_0x30df('0xf'))[_0x30df('0x10')](socket);function respondWithRpcPromise(_0x56cdfd,_0x19c670,_0x543003){return new BPromise(function(_0x5530a5,_0x5c7158){return client['request'](_0x56cdfd,_0x543003)[_0x30df('0x11')](function(_0x3cf8fa){logger['info']('SmsQueue,\x20%s,\x20%s',_0x19c670,_0x30df('0x12'));logger['debug'](_0x30df('0x13'),_0x19c670,_0x30df('0x12'),JSON['stringify'](_0x3cf8fa));if(_0x3cf8fa[_0x30df('0x14')]){if(_0x3cf8fa[_0x30df('0x14')][_0x30df('0x15')]===0x1f4){logger['error'](_0x30df('0x16'),_0x19c670,_0x3cf8fa['error'][_0x30df('0x17')]);return _0x5c7158(_0x3cf8fa['error'][_0x30df('0x17')]);}logger['error'](_0x30df('0x16'),_0x19c670,_0x3cf8fa[_0x30df('0x14')]['message']);return _0x5530a5(_0x3cf8fa[_0x30df('0x14')][_0x30df('0x17')]);}else{logger[_0x30df('0x18')]('SmsQueue,\x20%s,\x20%s',_0x19c670,_0x30df('0x12'));_0x5530a5(_0x3cf8fa[_0x30df('0x19')][_0x30df('0x17')]);}})[_0x30df('0x1a')](function(_0x307aa6){logger['error'](_0x30df('0x16'),_0x19c670,_0x307aa6);_0x5c7158(_0x307aa6);});});}exports[_0x30df('0x1b')]=function(_0x44be1f){var _0x132f47=this;return new Promise(function(_0xe59bea,_0x17dc77){return db['SmsQueue'][_0x30df('0x1c')]({'raw':_0x44be1f[_0x30df('0x1d')]?_0x44be1f[_0x30df('0x1d')][_0x30df('0x1e')]===undefined?!![]:![]:!![],'where':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')]['where']||null:null,'attributes':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')][_0x30df('0x1f')]||null:null,'limit':_0x44be1f[_0x30df('0x1d')]?_0x44be1f[_0x30df('0x1d')][_0x30df('0x20')]||null:null,'include':_0x44be1f['options']?_0x44be1f[_0x30df('0x1d')][_0x30df('0x21')]?_['map'](_0x44be1f['options'][_0x30df('0x21')],function(_0x5db860){return{'model':db[_0x5db860['model']],'as':_0x5db860['as'],'attributes':_0x5db860[_0x30df('0x1f')],'include':_0x5db860['include']?_['map'](_0x5db860['include'],function(_0x15f907){return{'model':db[_0x15f907[_0x30df('0x22')]],'as':_0x15f907['as'],'attributes':_0x15f907[_0x30df('0x1f')],'include':_0x15f907[_0x30df('0x21')]?_[_0x30df('0x23')](_0x15f907[_0x30df('0x21')],function(_0x35f800){return{'model':db[_0x35f800[_0x30df('0x22')]],'as':_0x35f800['as'],'attributes':_0x35f800[_0x30df('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1950d6){logger['info'](_0x30df('0x1b'),_0x44be1f);logger[_0x30df('0x24')](_0x30df('0x1b'),_0x44be1f,JSON[_0x30df('0x25')](_0x1950d6));_0xe59bea(_0x1950d6);})[_0x30df('0x1a')](function(_0x6ae2c2){logger[_0x30df('0x14')](_0x30df('0x1b'),_0x6ae2c2[_0x30df('0x17')],_0x44be1f);_0x17dc77(_0x132f47[_0x30df('0x14')](0x1f4,_0x6ae2c2['message']));});});};exports[_0x30df('0x26')]=function(_0x5d4375){var _0x2a2cac=this;return new Promise(function(_0x24bbd3,_0x39b1a8){return db[_0x30df('0x27')]['find']({'raw':_0x5d4375[_0x30df('0x1d')]?_0x5d4375['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d4375['options']?_0x5d4375[_0x30df('0x1d')]['where']||null:null,'attributes':_0x5d4375[_0x30df('0x1d')]?_0x5d4375[_0x30df('0x1d')]['attributes']||null:null,'include':_0x5d4375[_0x30df('0x1d')]?_0x5d4375['options'][_0x30df('0x21')]?_['map'](_0x5d4375[_0x30df('0x1d')][_0x30df('0x21')],function(_0x4f9088){return{'model':db[_0x4f9088[_0x30df('0x22')]],'as':_0x4f9088['as'],'attributes':_0x4f9088[_0x30df('0x1f')],'include':_0x4f9088[_0x30df('0x21')]?_[_0x30df('0x23')](_0x4f9088['include'],function(_0x141de1){return{'model':db[_0x141de1[_0x30df('0x22')]],'as':_0x141de1['as'],'attributes':_0x141de1['attributes'],'include':_0x141de1[_0x30df('0x21')]?_['map'](_0x141de1[_0x30df('0x21')],function(_0x73ec71){return{'model':db[_0x73ec71[_0x30df('0x22')]],'as':_0x73ec71['as'],'attributes':_0x73ec71[_0x30df('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x30df('0x11')](function(_0x297f6f){logger[_0x30df('0x18')](_0x30df('0x26'),_0x5d4375);logger[_0x30df('0x24')](_0x30df('0x26'),_0x5d4375,JSON[_0x30df('0x25')](_0x297f6f));_0x24bbd3(_0x297f6f);})[_0x30df('0x1a')](function(_0x474c22){logger['error']('ShowSmsQueue',_0x474c22[_0x30df('0x17')],_0x5d4375);_0x39b1a8(_0x2a2cac['error'](0x1f4,_0x474c22[_0x30df('0x17')]));});});}; \ No newline at end of file +var _0x0c73=['defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5267db,_0x2f34a2){var _0x53f050=function(_0x4438bf){while(--_0x4438bf){_0x5267db['push'](_0x5267db['shift']());}};_0x53f050(++_0x2f34a2);}(_0x0c73,0x15b));var _0x30c7=function(_0x3e7561,_0x462ee3){_0x3e7561=_0x3e7561-0x0;var _0x283bb1=_0x0c73[_0x3e7561];return _0x283bb1;};'use strict';var _=require(_0x30c7('0x0'));var util=require(_0x30c7('0x1'));var moment=require(_0x30c7('0x2'));var BPromise=require(_0x30c7('0x3'));var rs=require(_0x30c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x30c7('0x5'));var logger=require(_0x30c7('0x6'))(_0x30c7('0x7'));var config=require(_0x30c7('0x8'));var jayson=require(_0x30c7('0x9'));var client=jayson[_0x30c7('0xa')][_0x30c7('0xb')]({'port':0x232a});config[_0x30c7('0xc')]=_[_0x30c7('0xd')](config[_0x30c7('0xc')],{'host':_0x30c7('0xe'),'port':0x18eb});var socket=require(_0x30c7('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x30c7('0x10')](socket);function respondWithRpcPromise(_0x3fd318,_0x28d512,_0x4146b9){return new BPromise(function(_0x1d5c37,_0x331a09){return client[_0x30c7('0x11')](_0x3fd318,_0x4146b9)[_0x30c7('0x12')](function(_0x3b0855){logger[_0x30c7('0x13')](_0x30c7('0x14'),_0x28d512,_0x30c7('0x15'));logger[_0x30c7('0x16')](_0x30c7('0x17'),_0x28d512,_0x30c7('0x15'),JSON[_0x30c7('0x18')](_0x3b0855));if(_0x3b0855[_0x30c7('0x19')]){if(_0x3b0855[_0x30c7('0x19')][_0x30c7('0x1a')]===0x1f4){logger[_0x30c7('0x19')](_0x30c7('0x14'),_0x28d512,_0x3b0855[_0x30c7('0x19')][_0x30c7('0x1b')]);return _0x331a09(_0x3b0855['error'][_0x30c7('0x1b')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x28d512,_0x3b0855['error'][_0x30c7('0x1b')]);return _0x1d5c37(_0x3b0855[_0x30c7('0x19')]['message']);}else{logger[_0x30c7('0x13')](_0x30c7('0x14'),_0x28d512,_0x30c7('0x15'));_0x1d5c37(_0x3b0855['result']['message']);}})['catch'](function(_0x163880){logger['error']('SmsQueue,\x20%s,\x20%s',_0x28d512,_0x163880);_0x331a09(_0x163880);});});}exports[_0x30c7('0x1c')]=function(_0x13905f){var _0x58d030=this;return new Promise(function(_0x33d4ae,_0x558ac3){return db[_0x30c7('0x1d')][_0x30c7('0x1e')]({'raw':_0x13905f[_0x30c7('0x1f')]?_0x13905f['options'][_0x30c7('0x20')]===undefined?!![]:![]:!![],'where':_0x13905f[_0x30c7('0x1f')]?_0x13905f[_0x30c7('0x1f')][_0x30c7('0x21')]||null:null,'attributes':_0x13905f['options']?_0x13905f[_0x30c7('0x1f')]['attributes']||null:null,'limit':_0x13905f[_0x30c7('0x1f')]?_0x13905f[_0x30c7('0x1f')][_0x30c7('0x22')]||null:null,'include':_0x13905f['options']?_0x13905f[_0x30c7('0x1f')][_0x30c7('0x23')]?_[_0x30c7('0x24')](_0x13905f[_0x30c7('0x1f')][_0x30c7('0x23')],function(_0x418125){return{'model':db[_0x418125['model']],'as':_0x418125['as'],'attributes':_0x418125[_0x30c7('0x25')],'include':_0x418125[_0x30c7('0x23')]?_[_0x30c7('0x24')](_0x418125[_0x30c7('0x23')],function(_0x171ba0){return{'model':db[_0x171ba0[_0x30c7('0x26')]],'as':_0x171ba0['as'],'attributes':_0x171ba0[_0x30c7('0x25')],'include':_0x171ba0[_0x30c7('0x23')]?_[_0x30c7('0x24')](_0x171ba0['include'],function(_0x2fdf76){return{'model':db[_0x2fdf76['model']],'as':_0x2fdf76['as'],'attributes':_0x2fdf76[_0x30c7('0x25')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x12')](function(_0x3b5b03){logger[_0x30c7('0x13')](_0x30c7('0x1c'),_0x13905f);logger[_0x30c7('0x16')](_0x30c7('0x1c'),_0x13905f,JSON['stringify'](_0x3b5b03));_0x33d4ae(_0x3b5b03);})['catch'](function(_0x48e6cc){logger[_0x30c7('0x19')](_0x30c7('0x1c'),_0x48e6cc['message'],_0x13905f);_0x558ac3(_0x58d030[_0x30c7('0x19')](0x1f4,_0x48e6cc[_0x30c7('0x1b')]));});});};exports['ShowSmsQueue']=function(_0x5297ac){var _0x249653=this;return new Promise(function(_0x5f0a85,_0x4e8a47){return db['SmsQueue']['find']({'raw':_0x5297ac['options']?_0x5297ac[_0x30c7('0x1f')][_0x30c7('0x20')]===undefined?!![]:![]:!![],'where':_0x5297ac[_0x30c7('0x1f')]?_0x5297ac['options'][_0x30c7('0x21')]||null:null,'attributes':_0x5297ac[_0x30c7('0x1f')]?_0x5297ac[_0x30c7('0x1f')]['attributes']||null:null,'include':_0x5297ac[_0x30c7('0x1f')]?_0x5297ac[_0x30c7('0x1f')][_0x30c7('0x23')]?_['map'](_0x5297ac[_0x30c7('0x1f')][_0x30c7('0x23')],function(_0x32f6a1){return{'model':db[_0x32f6a1[_0x30c7('0x26')]],'as':_0x32f6a1['as'],'attributes':_0x32f6a1['attributes'],'include':_0x32f6a1['include']?_[_0x30c7('0x24')](_0x32f6a1['include'],function(_0x402b94){return{'model':db[_0x402b94[_0x30c7('0x26')]],'as':_0x402b94['as'],'attributes':_0x402b94['attributes'],'include':_0x402b94[_0x30c7('0x23')]?_['map'](_0x402b94[_0x30c7('0x23')],function(_0x3d6e97){return{'model':db[_0x3d6e97[_0x30c7('0x26')]],'as':_0x3d6e97['as'],'attributes':_0x3d6e97[_0x30c7('0x25')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x12')](function(_0x1e5b84){logger[_0x30c7('0x13')](_0x30c7('0x27'),_0x5297ac);logger['debug']('ShowSmsQueue',_0x5297ac,JSON['stringify'](_0x1e5b84));_0x5f0a85(_0x1e5b84);})['catch'](function(_0x1082c9){logger[_0x30c7('0x19')](_0x30c7('0x27'),_0x1082c9[_0x30c7('0x1b')],_0x5297ac);_0x4e8a47(_0x249653[_0x30c7('0x19')](0x1f4,_0x1082c9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index eb3affc..e2d53cf 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 _0xec51=['remove','update','emit','removeListener','register','smsQueue:','./smsQueue.events','save'];(function(_0x1fc915,_0x4e8623){var _0x2c6ebd=function(_0x1a36ae){while(--_0x1a36ae){_0x1fc915['push'](_0x1fc915['shift']());}};_0x2c6ebd(++_0x4e8623);}(_0xec51,0xc6));var _0x1ec5=function(_0x418330,_0x4c8c2d){_0x418330=_0x418330-0x0;var _0x503c9a=_0xec51[_0x418330];return _0x503c9a;};'use strict';var SmsQueueEvents=require(_0x1ec5('0x0'));var events=[_0x1ec5('0x1'),_0x1ec5('0x2'),_0x1ec5('0x3')];function createListener(_0x38fa4d,_0x41eb6a){return function(_0x24624d){_0x41eb6a[_0x1ec5('0x4')](_0x38fa4d,_0x24624d);};}function removeListener(_0x5d50c3,_0xed50e6){return function(){SmsQueueEvents[_0x1ec5('0x5')](_0x5d50c3,_0xed50e6);};}exports[_0x1ec5('0x6')]=function(_0x2535c3){for(var _0x3f4aef=0x0,_0x295500=events['length'];_0x3f4aef<_0x295500;_0x3f4aef++){var _0xcdd486=events[_0x3f4aef];var _0x404205=createListener(_0x1ec5('0x7')+_0xcdd486,_0x2535c3);SmsQueueEvents['on'](_0xcdd486,_0x404205);}}; \ No newline at end of file +var _0x787a=['length','smsQueue:','remove','update','emit','removeListener'];(function(_0x427cce,_0x718314){var _0x283078=function(_0x5ebae4){while(--_0x5ebae4){_0x427cce['push'](_0x427cce['shift']());}};_0x283078(++_0x718314);}(_0x787a,0x1ca));var _0xa787=function(_0x45d3ad,_0x1eb892){_0x45d3ad=_0x45d3ad-0x0;var _0x2c7383=_0x787a[_0x45d3ad];return _0x2c7383;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xa787('0x0'),_0xa787('0x1')];function createListener(_0x51653b,_0x3647c1){return function(_0x493149){_0x3647c1[_0xa787('0x2')](_0x51653b,_0x493149);};}function removeListener(_0x466743,_0x4df89c){return function(){SmsQueueEvents[_0xa787('0x3')](_0x466743,_0x4df89c);};}exports['register']=function(_0x1ba939){for(var _0x43bb69=0x0,_0x45cd3d=events[_0xa787('0x4')];_0x43bb69<_0x45cd3d;_0x43bb69++){var _0x44395c=events[_0x43bb69];var _0x31a0e5=createListener(_0xa787('0x5')+_0x44395c,_0x1ba939);SmsQueueEvents['on'](_0x44395c,_0x31a0e5);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f8e4334..d594f7b 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 _0x55fd=['./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x3cc092,_0x370778){var _0x58be9e=function(_0x5de5f7){while(--_0x5de5f7){_0x3cc092['push'](_0x3cc092['shift']());}};_0x58be9e(++_0x370778);}(_0x55fd,0xbf));var _0xd55f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x55fd[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0xd55f('0x0'));var util=require(_0xd55f('0x1'));var path=require(_0xd55f('0x2'));var timeout=require(_0xd55f('0x3'));var express=require('express');var router=express[_0xd55f('0x4')]();var fs_extra=require(_0xd55f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd55f('0x6'));var config=require('../../config/environment');var controller=require(_0xd55f('0x7'));router[_0xd55f('0x8')]('/',auth[_0xd55f('0x9')](),controller[_0xd55f('0xa')]);router[_0xd55f('0x8')]('/describe',auth[_0xd55f('0x9')](),controller[_0xd55f('0xb')]);router[_0xd55f('0x8')](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller['show']);router[_0xd55f('0xd')]('/',auth[_0xd55f('0x9')](),controller['create']);router[_0xd55f('0xe')](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller[_0xd55f('0xf')]);router['delete'](_0xd55f('0xc'),auth[_0xd55f('0x9')](),controller[_0xd55f('0x10')]);module[_0xd55f('0x11')]=router; \ No newline at end of file +var _0xadae=['describe','/:id','show','post','create','put','destroy','exports','multer','util','path','../../config/environment','get','isAuthenticated','/describe'];(function(_0x14bf3b,_0x47031a){var _0x4fb45b=function(_0x5dc661){while(--_0x5dc661){_0x14bf3b['push'](_0x14bf3b['shift']());}};_0x4fb45b(++_0x47031a);}(_0xadae,0x134));var _0xeada=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xadae[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var path=require(_0xeada('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeada('0x3'));var controller=require('./smsQueueReport.controller');router[_0xeada('0x4')]('/',auth[_0xeada('0x5')](),controller['index']);router['get'](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x7')]);router[_0xeada('0x4')](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0x9')]);router[_0xeada('0xa')]('/',auth[_0xeada('0x5')](),controller[_0xeada('0xb')]);router[_0xeada('0xc')](_0xeada('0x8'),auth[_0xeada('0x5')](),controller['update']);router['delete'](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0xd')]);module[_0xeada('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 0727687..bc9c755 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 _0xdc0d=['DATE','moment','sequelize','STRING'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0xdc0d,0xc1));var _0xddc0=function(_0x14c7fb,_0x3a23f4){_0x14c7fb=_0x14c7fb-0x0;var _0x435dce=_0xdc0d[_0x14c7fb];return _0x435dce;};'use strict';var moment=require(_0xddc0('0x0'));var Sequelize=require(_0xddc0('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xddc0('0x2')]},'joinAt':{'type':Sequelize[_0xddc0('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xddc0('0x3')]},'exitAt':{'type':Sequelize[_0xddc0('0x3')]},'reason':{'type':Sequelize[_0xddc0('0x2')]}}; \ No newline at end of file +var _0x3f98=['moment','sequelize','exports','STRING','DATE'];(function(_0x155285,_0x1ae4b5){var _0xc51d9a=function(_0xe824e){while(--_0xe824e){_0x155285['push'](_0x155285['shift']());}};_0xc51d9a(++_0x1ae4b5);}(_0x3f98,0x19a));var _0x83f9=function(_0x2a667a,_0x2f5598){_0x2a667a=_0x2a667a-0x0;var _0x4acb90=_0x3f98[_0x2a667a];return _0x4acb90;};'use strict';var moment=require(_0x83f9('0x0'));var Sequelize=require(_0x83f9('0x1'));module[_0x83f9('0x2')]={'uniqueid':{'type':Sequelize[_0x83f9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x83f9('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x83f9('0x4')]},'acceptAt':{'type':Sequelize[_0x83f9('0x4')]},'exitAt':{'type':Sequelize[_0x83f9('0x4')]},'reason':{'type':Sequelize[_0x83f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0d592d7..f62398b 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 _0xd98f=['pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','intersection','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','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/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','send','index','SmsQueueReport','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x248bc5,_0x407855){var _0x4fbb0d=function(_0x2e96d9){while(--_0x2e96d9){_0x248bc5['push'](_0x248bc5['shift']());}};_0x4fbb0d(++_0x407855);}(_0xd98f,0x199));var _0xfd98=function(_0x31117e,_0x55d446){_0x31117e=_0x31117e-0x0;var _0x54934b=_0xd98f[_0x31117e];return _0x54934b;};'use strict';var emlformat=require(_0xfd98('0x0'));var rimraf=require(_0xfd98('0x1'));var zipdir=require(_0xfd98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd98('0x3'));var moment=require(_0xfd98('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfd98('0x5'));var util=require(_0xfd98('0x6'));var path=require(_0xfd98('0x7'));var sox=require(_0xfd98('0x8'));var csv=require('to-csv');var ejs=require(_0xfd98('0x9'));var fs=require('fs');var fs_extra=require(_0xfd98('0xa'));var _=require(_0xfd98('0xb'));var squel=require(_0xfd98('0xc'));var crypto=require(_0xfd98('0xd'));var jsforce=require(_0xfd98('0xe'));var deskjs=require(_0xfd98('0xf'));var toCsv=require(_0xfd98('0x10'));var querystring=require(_0xfd98('0x11'));var Papa=require('papaparse');var Redis=require(_0xfd98('0x12'));var authService=require(_0xfd98('0x13'));var qs=require(_0xfd98('0x14'));var as=require(_0xfd98('0x15'));var hardwareService=require(_0xfd98('0x16'));var logger=require(_0xfd98('0x17'))(_0xfd98('0x18'));var utils=require(_0xfd98('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfd98('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x514378,_0x5bd7f0){_0x5bd7f0=_0x5bd7f0||0xcc;return function(_0x28ad07){if(_0x28ad07){return _0x514378[_0xfd98('0x1b')](_0x5bd7f0);}return _0x514378[_0xfd98('0x1c')](_0x5bd7f0)[_0xfd98('0x1d')]();};}function respondWithResult(_0xdc6e1f,_0x588246){_0x588246=_0x588246||0xc8;return function(_0x26e1a5){if(_0x26e1a5){return _0xdc6e1f[_0xfd98('0x1c')](_0x588246)[_0xfd98('0x1e')](_0x26e1a5);}};}function respondWithFilteredResult(_0x29f357,_0x393e4d){return function(_0x4ae6d0){if(_0x4ae6d0){var _0x2efac4=typeof _0x393e4d[_0xfd98('0x1f')]==='undefined'&&typeof _0x393e4d[_0xfd98('0x20')]===_0xfd98('0x21');var _0x248eff=_0x4ae6d0[_0xfd98('0x22')];var _0x37d938=_0x2efac4?0x0:_0x393e4d['offset'];var _0x28d329=_0x2efac4?_0x4ae6d0[_0xfd98('0x22')]:_0x393e4d[_0xfd98('0x1f')]+_0x393e4d[_0xfd98('0x20')];var _0xe0e84b;if(_0x28d329>=_0x248eff){_0x28d329=_0x248eff;_0xe0e84b=0xc8;}else{_0xe0e84b=0xce;}_0x29f357[_0xfd98('0x1c')](_0xe0e84b);return _0x29f357['set'](_0xfd98('0x23'),_0x37d938+'-'+_0x28d329+'/'+_0x248eff)['json'](_0x4ae6d0);}return null;};}function patchUpdates(_0x4e8134){return function(_0x4972c1){try{jsonpatch['apply'](_0x4972c1,_0x4e8134,!![]);}catch(_0x4b1d16){return BPromise[_0xfd98('0x24')](_0x4b1d16);}return _0x4972c1[_0xfd98('0x25')]();};}function saveUpdates(_0x1c8ccd,_0x3ed869){return function(_0x572c9d){if(_0x572c9d){return _0x572c9d[_0xfd98('0x26')](_0x1c8ccd)[_0xfd98('0x27')](function(_0x558d9c){return _0x558d9c;});}return null;};}function removeEntity(_0x8b4c69,_0x5b4093){return function(_0x26f0d7){if(_0x26f0d7){return _0x26f0d7[_0xfd98('0x28')]()[_0xfd98('0x27')](function(){_0x8b4c69[_0xfd98('0x1c')](0xcc)[_0xfd98('0x1d')]();});}};}function handleEntityNotFound(_0x436bb9,_0x415813){return function(_0x1d7799){if(!_0x1d7799){_0x436bb9[_0xfd98('0x1b')](0x194);}return _0x1d7799;};}function handleError(_0x42e42b,_0x120369){_0x120369=_0x120369||0x1f4;return function(_0x2b66b7){logger[_0xfd98('0x29')](_0x2b66b7['stack']);if(_0x2b66b7[_0xfd98('0x2a')]){delete _0x2b66b7[_0xfd98('0x2a')];}_0x42e42b[_0xfd98('0x1c')](_0x120369)[_0xfd98('0x2b')](_0x2b66b7);};}exports[_0xfd98('0x2c')]=function(_0xe7134a,_0x39ac79){var _0x47730b={},_0x11e705={},_0x2b8139={'count':0x0,'rows':[]};var _0x66fb81=_['map'](db[_0xfd98('0x2d')]['rawAttributes'],function(_0x2dbe4a){return{'name':_0x2dbe4a[_0xfd98('0x2e')],'type':_0x2dbe4a[_0xfd98('0x2f')][_0xfd98('0x30')]};});_0x11e705[_0xfd98('0x31')]=_[_0xfd98('0x32')](_0x66fb81,'name');_0x11e705['query']=_['keys'](_0xe7134a[_0xfd98('0x33')]);_0x11e705[_0xfd98('0x34')]=_['intersection'](_0x11e705[_0xfd98('0x31')],_0x11e705['query']);_0x47730b[_0xfd98('0x35')]=_['intersection'](_0x11e705['model'],qs[_0xfd98('0x36')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x36')]));_0x47730b['attributes']=_0x47730b[_0xfd98('0x35')]['length']?_0x47730b[_0xfd98('0x35')]:_0x11e705[_0xfd98('0x31')];if(!_0xe7134a[_0xfd98('0x33')][_0xfd98('0x37')](_0xfd98('0x38'))){_0x47730b[_0xfd98('0x20')]=qs[_0xfd98('0x20')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x20')]);_0x47730b['offset']=qs[_0xfd98('0x1f')](_0xe7134a['query'][_0xfd98('0x1f')]);}_0x47730b[_0xfd98('0x39')]=qs[_0xfd98('0x3a')](_0xe7134a[_0xfd98('0x33')][_0xfd98('0x3a')]);_0x47730b['where']=qs[_0xfd98('0x34')](_[_0xfd98('0x3b')](_0xe7134a[_0xfd98('0x33')],_0x11e705['filters']),_0x66fb81);if(_0xe7134a[_0xfd98('0x33')][_0xfd98('0x3c')]){_0x47730b[_0xfd98('0x3d')]=_[_0xfd98('0x3e')](_0x47730b['where'],{'$or':_[_0xfd98('0x32')](_0x66fb81,function(_0x525343){if(_0x525343[_0xfd98('0x2f')]!==_0xfd98('0x3f')){var _0x4c672d={};_0x4c672d[_0x525343[_0xfd98('0x2a')]]={'$like':'%'+_0xe7134a['query'][_0xfd98('0x3c')]+'%'};return _0x4c672d;}})});}_0x47730b=_[_0xfd98('0x3e')]({},_0x47730b,_0xe7134a['options']);var _0x26cf6f={'where':_0x47730b[_0xfd98('0x3d')]};return db['SmsQueueReport'][_0xfd98('0x22')](_0x26cf6f)[_0xfd98('0x27')](function(_0x2be8e5){_0x2b8139[_0xfd98('0x22')]=_0x2be8e5;if(_0xe7134a[_0xfd98('0x33')]['includeAll']){_0x47730b[_0xfd98('0x40')]=[{'all':!![]}];}return db[_0xfd98('0x2d')][_0xfd98('0x41')](_0x47730b);})[_0xfd98('0x27')](function(_0x10e3ae){_0x2b8139[_0xfd98('0x42')]=_0x10e3ae;return _0x2b8139;})[_0xfd98('0x27')](respondWithFilteredResult(_0x39ac79,_0x47730b))[_0xfd98('0x43')](handleError(_0x39ac79,null));};exports[_0xfd98('0x44')]=function(_0x4ab063,_0x2bc4c9){var _0x31cbc6={'raw':!![],'where':{'id':_0x4ab063[_0xfd98('0x45')]['id']}},_0x308243={};_0x308243[_0xfd98('0x31')]=_[_0xfd98('0x46')](db[_0xfd98('0x2d')]['rawAttributes']);_0x308243[_0xfd98('0x33')]=_[_0xfd98('0x46')](_0x4ab063[_0xfd98('0x33')]);_0x308243[_0xfd98('0x34')]=_[_0xfd98('0x47')](_0x308243[_0xfd98('0x31')],_0x308243[_0xfd98('0x33')]);_0x31cbc6[_0xfd98('0x35')]=_['intersection'](_0x308243[_0xfd98('0x31')],qs[_0xfd98('0x36')](_0x4ab063[_0xfd98('0x33')][_0xfd98('0x36')]));_0x31cbc6[_0xfd98('0x35')]=_0x31cbc6[_0xfd98('0x35')][_0xfd98('0x48')]?_0x31cbc6['attributes']:_0x308243['model'];if(_0x4ab063[_0xfd98('0x33')][_0xfd98('0x49')]){_0x31cbc6[_0xfd98('0x40')]=[{'all':!![]}];}_0x31cbc6=_['merge']({},_0x31cbc6,_0x4ab063['options']);return db[_0xfd98('0x2d')]['find'](_0x31cbc6)[_0xfd98('0x27')](handleEntityNotFound(_0x2bc4c9,null))[_0xfd98('0x27')](respondWithResult(_0x2bc4c9,null))[_0xfd98('0x43')](handleError(_0x2bc4c9,null));};exports['create']=function(_0x211469,_0x2f8eb2){return db['SmsQueueReport'][_0xfd98('0x4a')](_0x211469[_0xfd98('0x4b')],{})[_0xfd98('0x27')](respondWithResult(_0x2f8eb2,0xc9))[_0xfd98('0x43')](handleError(_0x2f8eb2,null));};exports[_0xfd98('0x26')]=function(_0x1f40ce,_0x3a1e84){if(_0x1f40ce['body']['id']){delete _0x1f40ce[_0xfd98('0x4b')]['id'];}return db[_0xfd98('0x2d')][_0xfd98('0x4c')]({'where':{'id':_0x1f40ce[_0xfd98('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a1e84,null))[_0xfd98('0x27')](saveUpdates(_0x1f40ce[_0xfd98('0x4b')],null))[_0xfd98('0x27')](respondWithResult(_0x3a1e84,null))[_0xfd98('0x43')](handleError(_0x3a1e84,null));};exports[_0xfd98('0x28')]=function(_0x2c4762,_0x5388d5){return db[_0xfd98('0x2d')]['find']({'where':{'id':_0x2c4762['params']['id']}})[_0xfd98('0x27')](handleEntityNotFound(_0x5388d5,null))[_0xfd98('0x27')](removeEntity(_0x5388d5,null))[_0xfd98('0x43')](handleError(_0x5388d5,null));};exports[_0xfd98('0x4d')]=function(_0x454f61,_0xb740b8){return db[_0xfd98('0x2d')]['describe']()[_0xfd98('0x27')](respondWithResult(_0xb740b8,null))[_0xfd98('0x43')](handleError(_0xb740b8,null));}; \ No newline at end of file +var _0xe904=['stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','end','sendStatus','error'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xe904,0xc0));var _0x4e90=function(_0x252bad,_0xcd6c93){_0x252bad=_0x252bad-0x0;var _0x510476=_0xe904[_0x252bad];return _0x510476;};'use strict';var emlformat=require(_0x4e90('0x0'));var rimraf=require(_0x4e90('0x1'));var zipdir=require(_0x4e90('0x2'));var jsonpatch=require(_0x4e90('0x3'));var rp=require(_0x4e90('0x4'));var moment=require('moment');var BPromise=require(_0x4e90('0x5'));var Mustache=require('mustache');var util=require(_0x4e90('0x6'));var path=require(_0x4e90('0x7'));var sox=require(_0x4e90('0x8'));var csv=require(_0x4e90('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e90('0xa'));var _=require('lodash');var squel=require(_0x4e90('0xb'));var crypto=require(_0x4e90('0xc'));var jsforce=require(_0x4e90('0xd'));var deskjs=require(_0x4e90('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4e90('0xf'));var Papa=require(_0x4e90('0x10'));var Redis=require(_0x4e90('0x11'));var authService=require(_0x4e90('0x12'));var qs=require(_0x4e90('0x13'));var as=require(_0x4e90('0x14'));var hardwareService=require(_0x4e90('0x15'));var logger=require(_0x4e90('0x16'))(_0x4e90('0x17'));var utils=require(_0x4e90('0x18'));var config=require(_0x4e90('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e90('0x1a'))['db'];function respondWithStatusCode(_0x4b85b3,_0x488b5b){_0x488b5b=_0x488b5b||0xcc;return function(_0x8584a9){if(_0x8584a9){return _0x4b85b3['sendStatus'](_0x488b5b);}return _0x4b85b3[_0x4e90('0x1b')](_0x488b5b)['end']();};}function respondWithResult(_0x364303,_0x114595){_0x114595=_0x114595||0xc8;return function(_0x239532){if(_0x239532){return _0x364303[_0x4e90('0x1b')](_0x114595)['json'](_0x239532);}};}function respondWithFilteredResult(_0x5af372,_0x363cb9){return function(_0x3d900c){if(_0x3d900c){var _0x3f0939=typeof _0x363cb9[_0x4e90('0x1c')]===_0x4e90('0x1d')&&typeof _0x363cb9[_0x4e90('0x1e')]===_0x4e90('0x1d');var _0xebd274=_0x3d900c['count'];var _0x577b8a=_0x3f0939?0x0:_0x363cb9['offset'];var _0x40434d=_0x3f0939?_0x3d900c[_0x4e90('0x1f')]:_0x363cb9[_0x4e90('0x1c')]+_0x363cb9[_0x4e90('0x1e')];var _0x111b77;if(_0x40434d>=_0xebd274){_0x40434d=_0xebd274;_0x111b77=0xc8;}else{_0x111b77=0xce;}_0x5af372[_0x4e90('0x1b')](_0x111b77);return _0x5af372['set'](_0x4e90('0x20'),_0x577b8a+'-'+_0x40434d+'/'+_0xebd274)[_0x4e90('0x21')](_0x3d900c);}return null;};}function patchUpdates(_0x5f5ce4){return function(_0x54fdad){try{jsonpatch[_0x4e90('0x22')](_0x54fdad,_0x5f5ce4,!![]);}catch(_0x374499){return BPromise[_0x4e90('0x23')](_0x374499);}return _0x54fdad['save']();};}function saveUpdates(_0x9ab55f,_0x4d2367){return function(_0x31394f){if(_0x31394f){return _0x31394f[_0x4e90('0x24')](_0x9ab55f)['then'](function(_0x47ab01){return _0x47ab01;});}return null;};}function removeEntity(_0x20d393,_0x5ca287){return function(_0x20538b){if(_0x20538b){return _0x20538b[_0x4e90('0x25')]()[_0x4e90('0x26')](function(){_0x20d393['status'](0xcc)[_0x4e90('0x27')]();});}};}function handleEntityNotFound(_0xf2479f,_0x3c996e){return function(_0x11ab79){if(!_0x11ab79){_0xf2479f[_0x4e90('0x28')](0x194);}return _0x11ab79;};}function handleError(_0x24b94a,_0x405744){_0x405744=_0x405744||0x1f4;return function(_0x4e017e){logger[_0x4e90('0x29')](_0x4e017e[_0x4e90('0x2a')]);if(_0x4e017e[_0x4e90('0x2b')]){delete _0x4e017e[_0x4e90('0x2b')];}_0x24b94a['status'](_0x405744)['send'](_0x4e017e);};}exports[_0x4e90('0x2c')]=function(_0x2e992a,_0x4ff3df){var _0x4c7cc6={},_0x2a9755={},_0x4591ab={'count':0x0,'rows':[]};var _0x2ee2fb=_[_0x4e90('0x2d')](db['SmsQueueReport'][_0x4e90('0x2e')],function(_0x4fce63){return{'name':_0x4fce63[_0x4e90('0x2f')],'type':_0x4fce63[_0x4e90('0x30')][_0x4e90('0x31')]};});_0x2a9755[_0x4e90('0x32')]=_[_0x4e90('0x2d')](_0x2ee2fb,_0x4e90('0x2b'));_0x2a9755[_0x4e90('0x33')]=_[_0x4e90('0x34')](_0x2e992a[_0x4e90('0x33')]);_0x2a9755[_0x4e90('0x35')]=_[_0x4e90('0x36')](_0x2a9755[_0x4e90('0x32')],_0x2a9755[_0x4e90('0x33')]);_0x4c7cc6[_0x4e90('0x37')]=_[_0x4e90('0x36')](_0x2a9755[_0x4e90('0x32')],qs[_0x4e90('0x38')](_0x2e992a['query']['fields']));_0x4c7cc6[_0x4e90('0x37')]=_0x4c7cc6[_0x4e90('0x37')][_0x4e90('0x39')]?_0x4c7cc6[_0x4e90('0x37')]:_0x2a9755[_0x4e90('0x32')];if(!_0x2e992a['query'][_0x4e90('0x3a')](_0x4e90('0x3b'))){_0x4c7cc6['limit']=qs['limit'](_0x2e992a[_0x4e90('0x33')][_0x4e90('0x1e')]);_0x4c7cc6[_0x4e90('0x1c')]=qs[_0x4e90('0x1c')](_0x2e992a['query'][_0x4e90('0x1c')]);}_0x4c7cc6[_0x4e90('0x3c')]=qs['sort'](_0x2e992a['query']['sort']);_0x4c7cc6[_0x4e90('0x3d')]=qs['filters'](_[_0x4e90('0x3e')](_0x2e992a['query'],_0x2a9755['filters']),_0x2ee2fb);if(_0x2e992a['query'][_0x4e90('0x3f')]){_0x4c7cc6['where']=_[_0x4e90('0x40')](_0x4c7cc6['where'],{'$or':_['map'](_0x2ee2fb,function(_0x29655e){if(_0x29655e[_0x4e90('0x30')]!=='VIRTUAL'){var _0x36443c={};_0x36443c[_0x29655e[_0x4e90('0x2b')]]={'$like':'%'+_0x2e992a[_0x4e90('0x33')][_0x4e90('0x3f')]+'%'};return _0x36443c;}})});}_0x4c7cc6=_[_0x4e90('0x40')]({},_0x4c7cc6,_0x2e992a[_0x4e90('0x41')]);var _0x46a95b={'where':_0x4c7cc6[_0x4e90('0x3d')]};return db[_0x4e90('0x42')][_0x4e90('0x1f')](_0x46a95b)[_0x4e90('0x26')](function(_0x4cee07){_0x4591ab[_0x4e90('0x1f')]=_0x4cee07;if(_0x2e992a[_0x4e90('0x33')][_0x4e90('0x43')]){_0x4c7cc6[_0x4e90('0x44')]=[{'all':!![]}];}return db[_0x4e90('0x42')][_0x4e90('0x45')](_0x4c7cc6);})[_0x4e90('0x26')](function(_0x3a615c){_0x4591ab[_0x4e90('0x46')]=_0x3a615c;return _0x4591ab;})[_0x4e90('0x26')](respondWithFilteredResult(_0x4ff3df,_0x4c7cc6))[_0x4e90('0x47')](handleError(_0x4ff3df,null));};exports[_0x4e90('0x48')]=function(_0x73b6d2,_0x11216e){var _0xe54c4c={'raw':!![],'where':{'id':_0x73b6d2[_0x4e90('0x49')]['id']}},_0x1aa3ad={};_0x1aa3ad[_0x4e90('0x32')]=_[_0x4e90('0x34')](db['SmsQueueReport'][_0x4e90('0x2e')]);_0x1aa3ad[_0x4e90('0x33')]=_['keys'](_0x73b6d2[_0x4e90('0x33')]);_0x1aa3ad[_0x4e90('0x35')]=_[_0x4e90('0x36')](_0x1aa3ad['model'],_0x1aa3ad[_0x4e90('0x33')]);_0xe54c4c[_0x4e90('0x37')]=_[_0x4e90('0x36')](_0x1aa3ad[_0x4e90('0x32')],qs[_0x4e90('0x38')](_0x73b6d2[_0x4e90('0x33')][_0x4e90('0x38')]));_0xe54c4c[_0x4e90('0x37')]=_0xe54c4c[_0x4e90('0x37')][_0x4e90('0x39')]?_0xe54c4c[_0x4e90('0x37')]:_0x1aa3ad['model'];if(_0x73b6d2[_0x4e90('0x33')][_0x4e90('0x43')]){_0xe54c4c[_0x4e90('0x44')]=[{'all':!![]}];}_0xe54c4c=_[_0x4e90('0x40')]({},_0xe54c4c,_0x73b6d2['options']);return db['SmsQueueReport'][_0x4e90('0x4a')](_0xe54c4c)[_0x4e90('0x26')](handleEntityNotFound(_0x11216e,null))[_0x4e90('0x26')](respondWithResult(_0x11216e,null))['catch'](handleError(_0x11216e,null));};exports[_0x4e90('0x4b')]=function(_0x10579b,_0x2d9115){return db[_0x4e90('0x42')][_0x4e90('0x4b')](_0x10579b[_0x4e90('0x4c')],{})['then'](respondWithResult(_0x2d9115,0xc9))[_0x4e90('0x47')](handleError(_0x2d9115,null));};exports[_0x4e90('0x24')]=function(_0x40968b,_0x48e9fb){if(_0x40968b['body']['id']){delete _0x40968b[_0x4e90('0x4c')]['id'];}return db['SmsQueueReport'][_0x4e90('0x4a')]({'where':{'id':_0x40968b['params']['id']}})[_0x4e90('0x26')](handleEntityNotFound(_0x48e9fb,null))[_0x4e90('0x26')](saveUpdates(_0x40968b[_0x4e90('0x4c')],null))['then'](respondWithResult(_0x48e9fb,null))[_0x4e90('0x47')](handleError(_0x48e9fb,null));};exports[_0x4e90('0x25')]=function(_0x2e013b,_0x4dac99){return db[_0x4e90('0x42')][_0x4e90('0x4a')]({'where':{'id':_0x2e013b[_0x4e90('0x49')]['id']}})[_0x4e90('0x26')](handleEntityNotFound(_0x4dac99,null))[_0x4e90('0x26')](removeEntity(_0x4dac99,null))['catch'](handleError(_0x4dac99,null));};exports[_0x4e90('0x4d')]=function(_0x371ace,_0x293582){return db[_0x4e90('0x42')][_0x4e90('0x4d')]()[_0x4e90('0x26')](respondWithResult(_0x293582,null))[_0x4e90('0x47')](handleError(_0x293582,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index bcd1633..99aa152 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3281b6,_0x2337ff){var _0x383b0f=function(_0x518080){while(--_0x518080){_0x3281b6['push'](_0x3281b6['shift']());}};_0x383b0f(++_0x2337ff);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3079f1f..ebf17cf 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 _0x3dba=['attributes','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','update','where'];(function(_0x25bf48,_0xe4466f){var _0x31f138=function(_0x535c1d){while(--_0x535c1d){_0x25bf48['push'](_0x25bf48['shift']());}};_0x31f138(++_0xe4466f);}(_0x3dba,0x66));var _0xa3db=function(_0x4dd0a7,_0xb4399f){_0x4dd0a7=_0x4dd0a7-0x0;var _0x487e9b=_0x3dba[_0x4dd0a7];return _0x487e9b;};'use strict';var _=require('lodash');var util=require(_0xa3db('0x0'));var moment=require(_0xa3db('0x1'));var BPromise=require(_0xa3db('0x2'));var rs=require(_0xa3db('0x3'));var fs=require('fs');var Redis=require(_0xa3db('0x4'));var db=require(_0xa3db('0x5'))['db'];var utils=require(_0xa3db('0x6'));var logger=require(_0xa3db('0x7'))(_0xa3db('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3db('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea76c,_0xf4b29a,_0x281409){return new BPromise(function(_0x2cc439,_0x414d81){return client[_0xa3db('0xa')](_0x3ea76c,_0x281409)[_0xa3db('0xb')](function(_0x1ddaa2){logger[_0xa3db('0xc')](_0xa3db('0xd'),_0xf4b29a,_0xa3db('0xe'));logger['debug'](_0xa3db('0xf'),_0xf4b29a,_0xa3db('0xe'),JSON[_0xa3db('0x10')](_0x1ddaa2));if(_0x1ddaa2[_0xa3db('0x11')]){if(_0x1ddaa2[_0xa3db('0x11')]['code']===0x1f4){logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x1ddaa2[_0xa3db('0x11')][_0xa3db('0x12')]);return _0x414d81(_0x1ddaa2[_0xa3db('0x11')]['message']);}logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x1ddaa2[_0xa3db('0x11')][_0xa3db('0x12')]);return _0x2cc439(_0x1ddaa2['error'][_0xa3db('0x12')]);}else{logger[_0xa3db('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0xf4b29a,_0xa3db('0xe'));_0x2cc439(_0x1ddaa2[_0xa3db('0x13')]['message']);}})[_0xa3db('0x14')](function(_0x42f62f){logger[_0xa3db('0x11')](_0xa3db('0xd'),_0xf4b29a,_0x42f62f);_0x414d81(_0x42f62f);});});}exports[_0xa3db('0x15')]=function(_0xf19636){var _0x2fe5ff=this;return new Promise(function(_0x14443c,_0x39c462){return db['SmsQueueReport'][_0xa3db('0x16')](_0xf19636[_0xa3db('0x17')],{'raw':_0xf19636['options']?_0xf19636[_0xa3db('0x18')][_0xa3db('0x19')]===undefined?!![]:![]:!![]})[_0xa3db('0xb')](function(_0x1ffcf9){logger['info'](_0xa3db('0x15'),_0xf19636);logger['debug'](_0xa3db('0x15'),_0xf19636,JSON[_0xa3db('0x10')](_0x1ffcf9));_0x14443c(_0x1ffcf9);})[_0xa3db('0x14')](function(_0x37f332){logger[_0xa3db('0x11')](_0xa3db('0x15'),_0x37f332[_0xa3db('0x12')],_0xf19636);_0x39c462(_0x2fe5ff[_0xa3db('0x11')](0x1f4,_0x37f332[_0xa3db('0x12')]));});});};exports[_0xa3db('0x1a')]=function(_0x3120f8){var _0x3bb49f=this;return new Promise(function(_0x505bc1,_0x60eb7d){return db[_0xa3db('0x1b')][_0xa3db('0x1c')](_0x3120f8[_0xa3db('0x17')],{'raw':_0x3120f8[_0xa3db('0x18')]?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3120f8['options']?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x1d')]||null:null,'attributes':_0x3120f8['options']?_0x3120f8['options'][_0xa3db('0x1e')]||null:null,'limit':_0x3120f8[_0xa3db('0x18')]?_0x3120f8[_0xa3db('0x18')][_0xa3db('0x1f')]||null:null})[_0xa3db('0xb')](function(_0x9d1e44){logger[_0xa3db('0xc')](_0xa3db('0x1a'),_0x3120f8);logger[_0xa3db('0x20')]('UpdateSmsQueueReport',_0x3120f8,JSON['stringify'](_0x9d1e44));_0x505bc1(_0x9d1e44);})[_0xa3db('0x14')](function(_0x411dc3){logger[_0xa3db('0x11')](_0xa3db('0x1a'),_0x411dc3[_0xa3db('0x12')],_0x3120f8);_0x60eb7d(_0x3bb49f[_0xa3db('0x11')](0x1f4,_0x411dc3['message']));});});}; \ No newline at end of file +var _0x6fbf=['code','message','info','result','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','where','limit','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x668729,_0x42f486){var _0x175801=function(_0x12d3f8){while(--_0x12d3f8){_0x668729['push'](_0x668729['shift']());}};_0x175801(++_0x42f486);}(_0x6fbf,0x71));var _0xf6fb=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0x6fbf[_0xd46333];return _0x336108;};'use strict';var _=require('lodash');var util=require(_0xf6fb('0x0'));var moment=require('moment');var BPromise=require(_0xf6fb('0x1'));var rs=require(_0xf6fb('0x2'));var fs=require('fs');var Redis=require(_0xf6fb('0x3'));var db=require(_0xf6fb('0x4'))['db'];var utils=require(_0xf6fb('0x5'));var logger=require(_0xf6fb('0x6'))('rpc');var config=require(_0xf6fb('0x7'));var jayson=require(_0xf6fb('0x8'));var client=jayson[_0xf6fb('0x9')][_0xf6fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da7bb,_0xb1f3ab,_0x1dd2cf){return new BPromise(function(_0x571922,_0x22740){return client[_0xf6fb('0xb')](_0x3da7bb,_0x1dd2cf)[_0xf6fb('0xc')](function(_0x514b73){logger['info'](_0xf6fb('0xd'),_0xb1f3ab,'request\x20sent');logger[_0xf6fb('0xe')](_0xf6fb('0xf'),_0xb1f3ab,_0xf6fb('0x10'),JSON[_0xf6fb('0x11')](_0x514b73));if(_0x514b73['error']){if(_0x514b73[_0xf6fb('0x12')][_0xf6fb('0x13')]===0x1f4){logger['error'](_0xf6fb('0xd'),_0xb1f3ab,_0x514b73[_0xf6fb('0x12')][_0xf6fb('0x14')]);return _0x22740(_0x514b73[_0xf6fb('0x12')][_0xf6fb('0x14')]);}logger[_0xf6fb('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xb1f3ab,_0x514b73[_0xf6fb('0x12')][_0xf6fb('0x14')]);return _0x571922(_0x514b73[_0xf6fb('0x12')][_0xf6fb('0x14')]);}else{logger[_0xf6fb('0x15')](_0xf6fb('0xd'),_0xb1f3ab,'request\x20sent');_0x571922(_0x514b73[_0xf6fb('0x16')][_0xf6fb('0x14')]);}})['catch'](function(_0x47c237){logger[_0xf6fb('0x12')](_0xf6fb('0xd'),_0xb1f3ab,_0x47c237);_0x22740(_0x47c237);});});}exports['CreateSmsQueueReport']=function(_0x124cff){var _0x11ad87=this;return new Promise(function(_0x44922d,_0x561c5f){return db[_0xf6fb('0x17')][_0xf6fb('0x18')](_0x124cff[_0xf6fb('0x19')],{'raw':_0x124cff[_0xf6fb('0x1a')]?_0x124cff['options'][_0xf6fb('0x1b')]===undefined?!![]:![]:!![]})[_0xf6fb('0xc')](function(_0x396960){logger[_0xf6fb('0x15')](_0xf6fb('0x1c'),_0x124cff);logger['debug'](_0xf6fb('0x1c'),_0x124cff,JSON[_0xf6fb('0x11')](_0x396960));_0x44922d(_0x396960);})['catch'](function(_0x326413){logger[_0xf6fb('0x12')](_0xf6fb('0x1c'),_0x326413[_0xf6fb('0x14')],_0x124cff);_0x561c5f(_0x11ad87[_0xf6fb('0x12')](0x1f4,_0x326413['message']));});});};exports[_0xf6fb('0x1d')]=function(_0xc0830b){var _0x63d445=this;return new Promise(function(_0x1d2155,_0x43854d){return db[_0xf6fb('0x17')]['update'](_0xc0830b['body'],{'raw':_0xc0830b[_0xf6fb('0x1a')]?_0xc0830b['options'][_0xf6fb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0830b[_0xf6fb('0x1a')]?_0xc0830b['options'][_0xf6fb('0x1e')]||null:null,'attributes':_0xc0830b[_0xf6fb('0x1a')]?_0xc0830b[_0xf6fb('0x1a')]['attributes']||null:null,'limit':_0xc0830b[_0xf6fb('0x1a')]?_0xc0830b[_0xf6fb('0x1a')][_0xf6fb('0x1f')]||null:null})[_0xf6fb('0xc')](function(_0x34aa44){logger[_0xf6fb('0x15')](_0xf6fb('0x1d'),_0xc0830b);logger['debug'](_0xf6fb('0x1d'),_0xc0830b,JSON[_0xf6fb('0x11')](_0x34aa44));_0x1d2155(_0x34aa44);})[_0xf6fb('0x20')](function(_0x1ab63c){logger['error'](_0xf6fb('0x1d'),_0x1ab63c[_0xf6fb('0x14')],_0xc0830b);_0x43854d(_0x63d445[_0xf6fb('0x12')](0x1f4,_0x1ab63c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index f74353d..5b36581 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 _0x02a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x43f59f,_0x78de62){var _0x5f36fc=function(_0x10df26){while(--_0x10df26){_0x43f59f['push'](_0x43f59f['shift']());}};_0x5f36fc(++_0x78de62);}(_0x02a7,0x7a));var _0x702a=function(_0x56a345,_0x5e8ab6){_0x56a345=_0x56a345-0x0;var _0xe4c560=_0x02a7[_0x56a345];return _0xe4c560;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var fs_extra=require(_0x702a('0x3'));var auth=require(_0x702a('0x4'));var interaction=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var controller=require(_0x702a('0x7'));router['get']('/',auth[_0x702a('0x8')](),controller['index']);router[_0x702a('0x9')](_0x702a('0xa'),auth[_0x702a('0x8')](),controller[_0x702a('0xb')]);router[_0x702a('0x9')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller['show']);router[_0x702a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x702a('0xe')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0xf')]);router['delete'](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0x10')]);module[_0x702a('0x11')]=router; \ No newline at end of file +var _0x4b1f=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','post'];(function(_0x2c4c3e,_0x380a36){var _0x4a652b=function(_0x5a8796){while(--_0x5a8796){_0x2c4c3e['push'](_0x2c4c3e['shift']());}};_0x4a652b(++_0x380a36);}(_0x4b1f,0x195));var _0xf4b1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4b1f[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var path=require('path');var timeout=require(_0xf4b1('0x2'));var express=require(_0xf4b1('0x3'));var router=express[_0xf4b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf4b1('0x5'));var interaction=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x9')]);router[_0xf4b1('0xa')](_0xf4b1('0xb'),auth[_0xf4b1('0x8')](),controller['describe']);router['get']('/:id',auth[_0xf4b1('0x8')](),controller['show']);router[_0xf4b1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4b1('0xd')](_0xf4b1('0xe'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0xf')]);router[_0xf4b1('0x10')](_0xf4b1('0xe'),auth[_0xf4b1('0x8')](),controller[_0xf4b1('0x11')]);module[_0xf4b1('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e76395f..c667c5e 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x6d1c65,_0x22df6e){var _0x1e96b4=function(_0xc1aac4){while(--_0xc1aac4){_0x6d1c65['push'](_0x6d1c65['shift']());}};_0x1e96b4(++_0x22df6e);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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(_0x44179f,_0x550320){var _0x406bdc=function(_0x5a0800){while(--_0x5a0800){_0x44179f['push'](_0x44179f['shift']());}};_0x406bdc(++_0x550320);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xcb91[_0x4d08b8];return _0x70214a;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f885923..86ed240 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 _0x81ed=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','show','params','fields','includeAll','options','create','body','find','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2aaa60,_0x22258f){var _0x2e3fa5=function(_0x335589){while(--_0x335589){_0x2aaa60['push'](_0x2aaa60['shift']());}};_0x2e3fa5(++_0x22258f);}(_0x81ed,0xd2));var _0xd81e=function(_0x509dad,_0x1f995f){_0x509dad=_0x509dad-0x0;var _0x21e122=_0x81ed[_0x509dad];return _0x21e122;};'use strict';var emlformat=require(_0xd81e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd81e('0x1'));var jsonpatch=require(_0xd81e('0x2'));var rp=require(_0xd81e('0x3'));var moment=require(_0xd81e('0x4'));var BPromise=require(_0xd81e('0x5'));var Mustache=require(_0xd81e('0x6'));var util=require(_0xd81e('0x7'));var path=require(_0xd81e('0x8'));var sox=require(_0xd81e('0x9'));var csv=require(_0xd81e('0xa'));var ejs=require(_0xd81e('0xb'));var fs=require('fs');var fs_extra=require(_0xd81e('0xc'));var _=require(_0xd81e('0xd'));var squel=require(_0xd81e('0xe'));var crypto=require(_0xd81e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd81e('0x10'));var toCsv=require(_0xd81e('0xa'));var querystring=require(_0xd81e('0x11'));var Papa=require(_0xd81e('0x12'));var Redis=require(_0xd81e('0x13'));var authService=require(_0xd81e('0x14'));var qs=require(_0xd81e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd81e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd81e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd81e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44b9f7,_0x11fb87){_0x11fb87=_0x11fb87||0xcc;return function(_0x409b85){if(_0x409b85){return _0x44b9f7['sendStatus'](_0x11fb87);}return _0x44b9f7[_0xd81e('0x19')](_0x11fb87)['end']();};}function respondWithResult(_0x4b8caa,_0x3000be){_0x3000be=_0x3000be||0xc8;return function(_0xd6d16b){if(_0xd6d16b){return _0x4b8caa[_0xd81e('0x19')](_0x3000be)[_0xd81e('0x1a')](_0xd6d16b);}};}function respondWithFilteredResult(_0x148a3b,_0x59684d){return function(_0x570a45){if(_0x570a45){var _0x5441df=typeof _0x59684d[_0xd81e('0x1b')]==='undefined'&&typeof _0x59684d['limit']===_0xd81e('0x1c');var _0x4354e5=_0x570a45[_0xd81e('0x1d')];var _0x2ac325=_0x5441df?0x0:_0x59684d[_0xd81e('0x1b')];var _0xdcb4e0=_0x5441df?_0x570a45[_0xd81e('0x1d')]:_0x59684d['offset']+_0x59684d[_0xd81e('0x1e')];var _0x297d88;if(_0xdcb4e0>=_0x4354e5){_0xdcb4e0=_0x4354e5;_0x297d88=0xc8;}else{_0x297d88=0xce;}_0x148a3b[_0xd81e('0x19')](_0x297d88);return _0x148a3b['set']('Content-Range',_0x2ac325+'-'+_0xdcb4e0+'/'+_0x4354e5)[_0xd81e('0x1a')](_0x570a45);}return null;};}function patchUpdates(_0x1b4eb9){return function(_0x125ee3){try{jsonpatch[_0xd81e('0x1f')](_0x125ee3,_0x1b4eb9,!![]);}catch(_0x4e74e9){return BPromise[_0xd81e('0x20')](_0x4e74e9);}return _0x125ee3['save']();};}function saveUpdates(_0x1c23ee,_0x1b252e){return function(_0x407704){if(_0x407704){return _0x407704[_0xd81e('0x21')](_0x1c23ee)[_0xd81e('0x22')](function(_0x449321){return _0x449321;});}return null;};}function removeEntity(_0x36d6ea,_0x436903){return function(_0x1aa9da){if(_0x1aa9da){return _0x1aa9da[_0xd81e('0x23')]()[_0xd81e('0x22')](function(){_0x36d6ea['status'](0xcc)[_0xd81e('0x24')]();});}};}function handleEntityNotFound(_0x46955d,_0x52c839){return function(_0x242014){if(!_0x242014){_0x46955d[_0xd81e('0x25')](0x194);}return _0x242014;};}function handleError(_0x24cfe1,_0x30cb78){_0x30cb78=_0x30cb78||0x1f4;return function(_0x5246d8){logger['error'](_0x5246d8[_0xd81e('0x26')]);if(_0x5246d8['name']){delete _0x5246d8[_0xd81e('0x27')];}_0x24cfe1['status'](_0x30cb78)['send'](_0x5246d8);};}exports[_0xd81e('0x28')]=function(_0x5c7ffe,_0x11a8de){var _0x1f4699={},_0x3d77fd={},_0x50a4cb={'count':0x0,'rows':[]};var _0x502d65=_[_0xd81e('0x29')](db[_0xd81e('0x2a')][_0xd81e('0x2b')],function(_0x2883d4){return{'name':_0x2883d4[_0xd81e('0x2c')],'type':_0x2883d4[_0xd81e('0x2d')][_0xd81e('0x2e')]};});_0x3d77fd[_0xd81e('0x2f')]=_[_0xd81e('0x29')](_0x502d65,_0xd81e('0x27'));_0x3d77fd[_0xd81e('0x30')]=_[_0xd81e('0x31')](_0x5c7ffe['query']);_0x3d77fd[_0xd81e('0x32')]=_[_0xd81e('0x33')](_0x3d77fd[_0xd81e('0x2f')],_0x3d77fd[_0xd81e('0x30')]);_0x1f4699[_0xd81e('0x34')]=_[_0xd81e('0x33')](_0x3d77fd[_0xd81e('0x2f')],qs['fields'](_0x5c7ffe[_0xd81e('0x30')]['fields']));_0x1f4699['attributes']=_0x1f4699[_0xd81e('0x34')][_0xd81e('0x35')]?_0x1f4699[_0xd81e('0x34')]:_0x3d77fd[_0xd81e('0x2f')];if(!_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x36')](_0xd81e('0x37'))){_0x1f4699['limit']=qs[_0xd81e('0x1e')](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x1e')]);_0x1f4699[_0xd81e('0x1b')]=qs[_0xd81e('0x1b')](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x1b')]);}_0x1f4699[_0xd81e('0x38')]=qs['sort'](_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x39')]);_0x1f4699[_0xd81e('0x3a')]=qs['filters'](_[_0xd81e('0x3b')](_0x5c7ffe[_0xd81e('0x30')],_0x3d77fd[_0xd81e('0x32')]),_0x502d65);if(_0x5c7ffe[_0xd81e('0x30')]['filter']){_0x1f4699[_0xd81e('0x3a')]=_[_0xd81e('0x3c')](_0x1f4699['where'],{'$or':_[_0xd81e('0x29')](_0x502d65,function(_0x1889a0){if(_0x1889a0[_0xd81e('0x2d')]!==_0xd81e('0x3d')){var _0x1c0ce6={};_0x1c0ce6[_0x1889a0[_0xd81e('0x27')]]={'$like':'%'+_0x5c7ffe[_0xd81e('0x30')][_0xd81e('0x3e')]+'%'};return _0x1c0ce6;}})});}_0x1f4699=_[_0xd81e('0x3c')]({},_0x1f4699,_0x5c7ffe['options']);var _0x48a212={'where':_0x1f4699[_0xd81e('0x3a')]};return db[_0xd81e('0x2a')][_0xd81e('0x1d')](_0x48a212)[_0xd81e('0x22')](function(_0x5d4aba){_0x50a4cb['count']=_0x5d4aba;if(_0x5c7ffe['query']['includeAll']){_0x1f4699[_0xd81e('0x3f')]=[{'all':!![]}];}return db[_0xd81e('0x2a')]['findAll'](_0x1f4699);})[_0xd81e('0x22')](function(_0x789586){_0x50a4cb[_0xd81e('0x40')]=_0x789586;return _0x50a4cb;})[_0xd81e('0x22')](respondWithFilteredResult(_0x11a8de,_0x1f4699))['catch'](handleError(_0x11a8de,null));};exports[_0xd81e('0x41')]=function(_0x55797e,_0x2e15f1){var _0x49d2af={'raw':!![],'where':{'id':_0x55797e[_0xd81e('0x42')]['id']}},_0x1379d4={};_0x1379d4[_0xd81e('0x2f')]=_[_0xd81e('0x31')](db['SmsTransferReport'][_0xd81e('0x2b')]);_0x1379d4[_0xd81e('0x30')]=_[_0xd81e('0x31')](_0x55797e[_0xd81e('0x30')]);_0x1379d4[_0xd81e('0x32')]=_['intersection'](_0x1379d4['model'],_0x1379d4[_0xd81e('0x30')]);_0x49d2af[_0xd81e('0x34')]=_[_0xd81e('0x33')](_0x1379d4[_0xd81e('0x2f')],qs[_0xd81e('0x43')](_0x55797e[_0xd81e('0x30')][_0xd81e('0x43')]));_0x49d2af[_0xd81e('0x34')]=_0x49d2af[_0xd81e('0x34')][_0xd81e('0x35')]?_0x49d2af['attributes']:_0x1379d4[_0xd81e('0x2f')];if(_0x55797e['query'][_0xd81e('0x44')]){_0x49d2af[_0xd81e('0x3f')]=[{'all':!![]}];}_0x49d2af=_[_0xd81e('0x3c')]({},_0x49d2af,_0x55797e[_0xd81e('0x45')]);return db[_0xd81e('0x2a')]['find'](_0x49d2af)['then'](handleEntityNotFound(_0x2e15f1,null))[_0xd81e('0x22')](respondWithResult(_0x2e15f1,null))['catch'](handleError(_0x2e15f1,null));};exports[_0xd81e('0x46')]=function(_0x5d74d3,_0x1c4148){return db[_0xd81e('0x2a')][_0xd81e('0x46')](_0x5d74d3[_0xd81e('0x47')],{})[_0xd81e('0x22')](respondWithResult(_0x1c4148,0xc9))['catch'](handleError(_0x1c4148,null));};exports['update']=function(_0x419b4f,_0x30a9dd){if(_0x419b4f[_0xd81e('0x47')]['id']){delete _0x419b4f['body']['id'];}return db[_0xd81e('0x2a')][_0xd81e('0x48')]({'where':{'id':_0x419b4f[_0xd81e('0x42')]['id']}})[_0xd81e('0x22')](handleEntityNotFound(_0x30a9dd,null))[_0xd81e('0x22')](saveUpdates(_0x419b4f[_0xd81e('0x47')],null))[_0xd81e('0x22')](respondWithResult(_0x30a9dd,null))['catch'](handleError(_0x30a9dd,null));};exports[_0xd81e('0x23')]=function(_0x2d11c1,_0x1619c8){return db[_0xd81e('0x2a')][_0xd81e('0x48')]({'where':{'id':_0x2d11c1[_0xd81e('0x42')]['id']}})[_0xd81e('0x22')](handleEntityNotFound(_0x1619c8,null))[_0xd81e('0x22')](removeEntity(_0x1619c8,null))[_0xd81e('0x49')](handleError(_0x1619c8,null));};exports[_0xd81e('0x4a')]=function(_0x5549ac,_0x5227e0){return db[_0xd81e('0x2a')][_0xd81e('0x4a')]()[_0xd81e('0x22')](respondWithResult(_0x5227e0,null))[_0xd81e('0x49')](handleError(_0x5227e0,null));}; \ No newline at end of file +var _0x5c08=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SmsTransferReport','includeAll','include','rows','catch','show','options','find','create','body','params','describe','eml-format'];(function(_0x21aa0b,_0x4cabbc){var _0xb02314=function(_0x322d5f){while(--_0x322d5f){_0x21aa0b['push'](_0x21aa0b['shift']());}};_0xb02314(++_0x4cabbc);}(_0x5c08,0x14b));var _0x85c0=function(_0x17803c,_0x5ed5f0){_0x17803c=_0x17803c-0x0;var _0xf36fc6=_0x5c08[_0x17803c];return _0xf36fc6;};'use strict';var emlformat=require(_0x85c0('0x0'));var rimraf=require(_0x85c0('0x1'));var zipdir=require(_0x85c0('0x2'));var jsonpatch=require(_0x85c0('0x3'));var rp=require(_0x85c0('0x4'));var moment=require(_0x85c0('0x5'));var BPromise=require(_0x85c0('0x6'));var Mustache=require('mustache');var util=require(_0x85c0('0x7'));var path=require(_0x85c0('0x8'));var sox=require(_0x85c0('0x9'));var csv=require(_0x85c0('0xa'));var ejs=require(_0x85c0('0xb'));var fs=require('fs');var fs_extra=require(_0x85c0('0xc'));var _=require(_0x85c0('0xd'));var squel=require(_0x85c0('0xe'));var crypto=require(_0x85c0('0xf'));var jsforce=require(_0x85c0('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x85c0('0x11'));var Papa=require(_0x85c0('0x12'));var Redis=require(_0x85c0('0x13'));var authService=require(_0x85c0('0x14'));var qs=require(_0x85c0('0x15'));var as=require(_0x85c0('0x16'));var hardwareService=require(_0x85c0('0x17'));var logger=require(_0x85c0('0x18'))(_0x85c0('0x19'));var utils=require(_0x85c0('0x1a'));var config=require(_0x85c0('0x1b'));var licenseUtil=require(_0x85c0('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf723d4,_0x5e5965){_0x5e5965=_0x5e5965||0xcc;return function(_0x2aca0f){if(_0x2aca0f){return _0xf723d4[_0x85c0('0x1d')](_0x5e5965);}return _0xf723d4[_0x85c0('0x1e')](_0x5e5965)[_0x85c0('0x1f')]();};}function respondWithResult(_0x33f45c,_0x1ec857){_0x1ec857=_0x1ec857||0xc8;return function(_0x1adc6b){if(_0x1adc6b){return _0x33f45c[_0x85c0('0x1e')](_0x1ec857)[_0x85c0('0x20')](_0x1adc6b);}};}function respondWithFilteredResult(_0x311e87,_0x3e11c0){return function(_0x19e7c7){if(_0x19e7c7){var _0xb6ab6d=typeof _0x3e11c0[_0x85c0('0x21')]==='undefined'&&typeof _0x3e11c0['limit']===_0x85c0('0x22');var _0x3fb9ea=_0x19e7c7[_0x85c0('0x23')];var _0x31e47c=_0xb6ab6d?0x0:_0x3e11c0['offset'];var _0x18b24f=_0xb6ab6d?_0x19e7c7[_0x85c0('0x23')]:_0x3e11c0['offset']+_0x3e11c0[_0x85c0('0x24')];var _0x4b7c5a;if(_0x18b24f>=_0x3fb9ea){_0x18b24f=_0x3fb9ea;_0x4b7c5a=0xc8;}else{_0x4b7c5a=0xce;}_0x311e87['status'](_0x4b7c5a);return _0x311e87['set'](_0x85c0('0x25'),_0x31e47c+'-'+_0x18b24f+'/'+_0x3fb9ea)['json'](_0x19e7c7);}return null;};}function patchUpdates(_0x1e571c){return function(_0x2c6505){try{jsonpatch[_0x85c0('0x26')](_0x2c6505,_0x1e571c,!![]);}catch(_0x154f41){return BPromise[_0x85c0('0x27')](_0x154f41);}return _0x2c6505[_0x85c0('0x28')]();};}function saveUpdates(_0x464f6f,_0x4fb373){return function(_0x150aba){if(_0x150aba){return _0x150aba[_0x85c0('0x29')](_0x464f6f)[_0x85c0('0x2a')](function(_0x5110d1){return _0x5110d1;});}return null;};}function removeEntity(_0x1319eb,_0x5ceddf){return function(_0x3ba017){if(_0x3ba017){return _0x3ba017[_0x85c0('0x2b')]()['then'](function(){_0x1319eb[_0x85c0('0x1e')](0xcc)[_0x85c0('0x1f')]();});}};}function handleEntityNotFound(_0x46d66a,_0x116744){return function(_0x1ac028){if(!_0x1ac028){_0x46d66a[_0x85c0('0x1d')](0x194);}return _0x1ac028;};}function handleError(_0x2d7542,_0x1d5e87){_0x1d5e87=_0x1d5e87||0x1f4;return function(_0x5a3556){logger[_0x85c0('0x2c')](_0x5a3556[_0x85c0('0x2d')]);if(_0x5a3556[_0x85c0('0x2e')]){delete _0x5a3556['name'];}_0x2d7542[_0x85c0('0x1e')](_0x1d5e87)[_0x85c0('0x2f')](_0x5a3556);};}exports[_0x85c0('0x30')]=function(_0x449828,_0x4a66c0){var _0x44157a={},_0x58d71b={},_0x15b293={'count':0x0,'rows':[]};var _0x16bba0=_['map'](db['SmsTransferReport'][_0x85c0('0x31')],function(_0x3beab9){return{'name':_0x3beab9[_0x85c0('0x32')],'type':_0x3beab9[_0x85c0('0x33')][_0x85c0('0x34')]};});_0x58d71b[_0x85c0('0x35')]=_[_0x85c0('0x36')](_0x16bba0,_0x85c0('0x2e'));_0x58d71b[_0x85c0('0x37')]=_[_0x85c0('0x38')](_0x449828['query']);_0x58d71b[_0x85c0('0x39')]=_[_0x85c0('0x3a')](_0x58d71b[_0x85c0('0x35')],_0x58d71b[_0x85c0('0x37')]);_0x44157a[_0x85c0('0x3b')]=_[_0x85c0('0x3a')](_0x58d71b[_0x85c0('0x35')],qs[_0x85c0('0x3c')](_0x449828[_0x85c0('0x37')][_0x85c0('0x3c')]));_0x44157a[_0x85c0('0x3b')]=_0x44157a[_0x85c0('0x3b')][_0x85c0('0x3d')]?_0x44157a[_0x85c0('0x3b')]:_0x58d71b[_0x85c0('0x35')];if(!_0x449828[_0x85c0('0x37')][_0x85c0('0x3e')](_0x85c0('0x3f'))){_0x44157a[_0x85c0('0x24')]=qs[_0x85c0('0x24')](_0x449828['query'][_0x85c0('0x24')]);_0x44157a[_0x85c0('0x21')]=qs[_0x85c0('0x21')](_0x449828['query']['offset']);}_0x44157a[_0x85c0('0x40')]=qs[_0x85c0('0x41')](_0x449828['query'][_0x85c0('0x41')]);_0x44157a['where']=qs[_0x85c0('0x39')](_[_0x85c0('0x42')](_0x449828['query'],_0x58d71b[_0x85c0('0x39')]),_0x16bba0);if(_0x449828[_0x85c0('0x37')][_0x85c0('0x43')]){_0x44157a[_0x85c0('0x44')]=_[_0x85c0('0x45')](_0x44157a['where'],{'$or':_[_0x85c0('0x36')](_0x16bba0,function(_0x368b3d){if(_0x368b3d['type']!==_0x85c0('0x46')){var _0x3ff02a={};_0x3ff02a[_0x368b3d[_0x85c0('0x2e')]]={'$like':'%'+_0x449828[_0x85c0('0x37')][_0x85c0('0x43')]+'%'};return _0x3ff02a;}})});}_0x44157a=_[_0x85c0('0x45')]({},_0x44157a,_0x449828['options']);var _0x499478={'where':_0x44157a[_0x85c0('0x44')]};return db[_0x85c0('0x47')]['count'](_0x499478)[_0x85c0('0x2a')](function(_0x1ef8e2){_0x15b293[_0x85c0('0x23')]=_0x1ef8e2;if(_0x449828[_0x85c0('0x37')][_0x85c0('0x48')]){_0x44157a[_0x85c0('0x49')]=[{'all':!![]}];}return db[_0x85c0('0x47')]['findAll'](_0x44157a);})[_0x85c0('0x2a')](function(_0x3ead83){_0x15b293[_0x85c0('0x4a')]=_0x3ead83;return _0x15b293;})['then'](respondWithFilteredResult(_0x4a66c0,_0x44157a))[_0x85c0('0x4b')](handleError(_0x4a66c0,null));};exports[_0x85c0('0x4c')]=function(_0x1c0e70,_0x443391){var _0x259d46={'raw':!![],'where':{'id':_0x1c0e70['params']['id']}},_0x4bb7d4={};_0x4bb7d4[_0x85c0('0x35')]=_['keys'](db[_0x85c0('0x47')]['rawAttributes']);_0x4bb7d4['query']=_[_0x85c0('0x38')](_0x1c0e70['query']);_0x4bb7d4[_0x85c0('0x39')]=_[_0x85c0('0x3a')](_0x4bb7d4[_0x85c0('0x35')],_0x4bb7d4['query']);_0x259d46[_0x85c0('0x3b')]=_['intersection'](_0x4bb7d4[_0x85c0('0x35')],qs[_0x85c0('0x3c')](_0x1c0e70[_0x85c0('0x37')][_0x85c0('0x3c')]));_0x259d46[_0x85c0('0x3b')]=_0x259d46[_0x85c0('0x3b')][_0x85c0('0x3d')]?_0x259d46[_0x85c0('0x3b')]:_0x4bb7d4[_0x85c0('0x35')];if(_0x1c0e70[_0x85c0('0x37')][_0x85c0('0x48')]){_0x259d46['include']=[{'all':!![]}];}_0x259d46=_[_0x85c0('0x45')]({},_0x259d46,_0x1c0e70[_0x85c0('0x4d')]);return db[_0x85c0('0x47')][_0x85c0('0x4e')](_0x259d46)['then'](handleEntityNotFound(_0x443391,null))[_0x85c0('0x2a')](respondWithResult(_0x443391,null))[_0x85c0('0x4b')](handleError(_0x443391,null));};exports[_0x85c0('0x4f')]=function(_0x442391,_0x5a8925){return db[_0x85c0('0x47')][_0x85c0('0x4f')](_0x442391['body'],{})[_0x85c0('0x2a')](respondWithResult(_0x5a8925,0xc9))[_0x85c0('0x4b')](handleError(_0x5a8925,null));};exports['update']=function(_0x4ee5b4,_0x1890bd){if(_0x4ee5b4['body']['id']){delete _0x4ee5b4[_0x85c0('0x50')]['id'];}return db['SmsTransferReport'][_0x85c0('0x4e')]({'where':{'id':_0x4ee5b4[_0x85c0('0x51')]['id']}})[_0x85c0('0x2a')](handleEntityNotFound(_0x1890bd,null))[_0x85c0('0x2a')](saveUpdates(_0x4ee5b4[_0x85c0('0x50')],null))[_0x85c0('0x2a')](respondWithResult(_0x1890bd,null))['catch'](handleError(_0x1890bd,null));};exports['destroy']=function(_0x36a437,_0x34acbe){return db['SmsTransferReport']['find']({'where':{'id':_0x36a437[_0x85c0('0x51')]['id']}})[_0x85c0('0x2a')](handleEntityNotFound(_0x34acbe,null))[_0x85c0('0x2a')](removeEntity(_0x34acbe,null))[_0x85c0('0x4b')](handleError(_0x34acbe,null));};exports[_0x85c0('0x52')]=function(_0x183544,_0x4fd090){return db[_0x85c0('0x47')][_0x85c0('0x52')]()['then'](respondWithResult(_0x4fd090,null))['catch'](handleError(_0x4fd090,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index bfa82f1..73840ab 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 _0x5b47=['../../config/logger','api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x141c05,_0x319076){var _0x25fa28=function(_0x56f1c0){while(--_0x56f1c0){_0x141c05['push'](_0x141c05['shift']());}};_0x25fa28(++_0x319076);}(_0x5b47,0x11d));var _0x75b4=function(_0x44e652,_0x4af87d){_0x44e652=_0x44e652-0x0;var _0x53237a=_0x5b47[_0x44e652];return _0x53237a;};'use strict';var _=require('lodash');var util=require(_0x75b4('0x0'));var logger=require(_0x75b4('0x1'))(_0x75b4('0x2'));var moment=require(_0x75b4('0x3'));var BPromise=require(_0x75b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75b4('0x5'));var rimraf=require('rimraf');var config=require(_0x75b4('0x6'));var attributes=require(_0x75b4('0x7'));module[_0x75b4('0x8')]=function(_0x405744,_0x51dc44){return _0x405744[_0x75b4('0x9')](_0x75b4('0xa'),attributes,{'tableName':_0x75b4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x75b4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e1a=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x276aa9,_0x533dae){var _0x3d9c1a=function(_0x4c6ad9){while(--_0x4c6ad9){_0x276aa9['push'](_0x276aa9['shift']());}};_0x3d9c1a(++_0x533dae);}(_0x2e1a,0xd6));var _0xa2e1=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x2e1a[_0xdd0313];return _0x2bd7e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2e1('0x0'))(_0xa2e1('0x1'));var moment=require('moment');var BPromise=require(_0xa2e1('0x2'));var rp=require(_0xa2e1('0x3'));var fs=require('fs');var path=require(_0xa2e1('0x4'));var rimraf=require(_0xa2e1('0x5'));var config=require(_0xa2e1('0x6'));var attributes=require(_0xa2e1('0x7'));module[_0xa2e1('0x8')]=function(_0x4d534c,_0x4428a9){return _0x4d534c[_0xa2e1('0x9')](_0xa2e1('0xa'),attributes,{'tableName':_0xa2e1('0xb'),'paranoid':![],'indexes':[{'name':_0xa2e1('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e5bf212..cf9d3e7 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 _0xf185=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x584683,_0x46a0a4){var _0x57bbf4=function(_0x3180c6){while(--_0x3180c6){_0x584683['push'](_0x584683['shift']());}};_0x57bbf4(++_0x46a0a4);}(_0xf185,0x1be));var _0x5f18=function(_0x4dc157,_0x14ec7e){_0x4dc157=_0x4dc157-0x0;var _0x14739b=_0xf185[_0x4dc157];return _0x14739b;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var Redis=require(_0x5f18('0x4'));var db=require(_0x5f18('0x5'))['db'];var utils=require(_0x5f18('0x6'));var logger=require('../../config/logger')(_0x5f18('0x7'));var config=require(_0x5f18('0x8'));var jayson=require(_0x5f18('0x9'));var client=jayson[_0x5f18('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2982d6,_0x3c69ee,_0x47e05a){return new BPromise(function(_0x15b931,_0x4f7c62){return client[_0x5f18('0xb')](_0x2982d6,_0x47e05a)[_0x5f18('0xc')](function(_0x5d84b3){logger[_0x5f18('0xd')](_0x5f18('0xe'),_0x3c69ee,'request\x20sent');logger[_0x5f18('0xf')](_0x5f18('0x10'),_0x3c69ee,'request\x20sent',JSON['stringify'](_0x5d84b3));if(_0x5d84b3[_0x5f18('0x11')]){if(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x12')]===0x1f4){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x4f7c62(_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);}logger[_0x5f18('0x11')](_0x5f18('0xe'),_0x3c69ee,_0x5d84b3[_0x5f18('0x11')][_0x5f18('0x13')]);return _0x15b931(_0x5d84b3['error'][_0x5f18('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3c69ee,_0x5f18('0x14'));_0x15b931(_0x5d84b3[_0x5f18('0x15')][_0x5f18('0x13')]);}})[_0x5f18('0x16')](function(_0x337ec1){logger['error'](_0x5f18('0xe'),_0x3c69ee,_0x337ec1);_0x4f7c62(_0x337ec1);});});} \ No newline at end of file +var _0x23d3=['rpc','jayson/promise','client','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32efcb,_0x55523f){var _0x1dae88=function(_0x11c606){while(--_0x11c606){_0x32efcb['push'](_0x32efcb['shift']());}};_0x1dae88(++_0x55523f);}(_0x23d3,0xe8));var _0x323d=function(_0x13806c,_0x264a84){_0x13806c=_0x13806c-0x0;var _0x5a6d2b=_0x23d3[_0x13806c];return _0x5a6d2b;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var moment=require(_0x323d('0x2'));var BPromise=require('bluebird');var rs=require(_0x323d('0x3'));var fs=require('fs');var Redis=require(_0x323d('0x4'));var db=require(_0x323d('0x5'))['db'];var utils=require(_0x323d('0x6'));var logger=require(_0x323d('0x7'))(_0x323d('0x8'));var config=require('../../config/environment');var jayson=require(_0x323d('0x9'));var client=jayson[_0x323d('0xa')][_0x323d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1057c2,_0x597de9,_0xbcfbc9){return new BPromise(function(_0x380ae6,_0x2b25c8){return client['request'](_0x1057c2,_0xbcfbc9)[_0x323d('0xc')](function(_0x399f5e){logger['info'](_0x323d('0xd'),_0x597de9,_0x323d('0xe'));logger[_0x323d('0xf')](_0x323d('0x10'),_0x597de9,'request\x20sent',JSON[_0x323d('0x11')](_0x399f5e));if(_0x399f5e[_0x323d('0x12')]){if(_0x399f5e[_0x323d('0x12')][_0x323d('0x13')]===0x1f4){logger[_0x323d('0x12')](_0x323d('0xd'),_0x597de9,_0x399f5e[_0x323d('0x12')]['message']);return _0x2b25c8(_0x399f5e[_0x323d('0x12')]['message']);}logger[_0x323d('0x12')](_0x323d('0xd'),_0x597de9,_0x399f5e[_0x323d('0x12')][_0x323d('0x14')]);return _0x380ae6(_0x399f5e[_0x323d('0x12')][_0x323d('0x14')]);}else{logger[_0x323d('0x15')](_0x323d('0xd'),_0x597de9,_0x323d('0xe'));_0x380ae6(_0x399f5e[_0x323d('0x16')][_0x323d('0x14')]);}})[_0x323d('0x17')](function(_0x464756){logger[_0x323d('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x597de9,_0x464756);_0x2b25c8(_0x464756);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index fad7d24..2e6df19 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 _0x73cf=['isAuthenticated','index','/:id','/:id/download','diskStorage','join','originalname','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x18d244,_0x5d93e4){var _0x21a20f=function(_0x4a29d0){while(--_0x4a29d0){_0x18d244['push'](_0x18d244['shift']());}};_0x21a20f(++_0x5d93e4);}(_0x73cf,0x7d));var _0xf73c=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x73cf[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0xf73c('0x0'));var util=require(_0xf73c('0x1'));var path=require(_0xf73c('0x2'));var timeout=require('connect-timeout');var express=require(_0xf73c('0x3'));var router=express['Router']();var fs_extra=require(_0xf73c('0x4'));var auth=require(_0xf73c('0x5'));var interaction=require(_0xf73c('0x6'));var config=require(_0xf73c('0x7'));var controller=require(_0xf73c('0x8'));router[_0xf73c('0x9')]('/',auth[_0xf73c('0xa')](),controller[_0xf73c('0xb')]);router[_0xf73c('0x9')](_0xf73c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf73c('0x9')](_0xf73c('0xd'),auth[_0xf73c('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xf73c('0xe')]({'destination':function(_0x15fd8f,_0x1e74f7,_0x43f57f){_0x43f57f(null,path[_0xf73c('0xf')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x9e5740,_0x22e137,_0x57a4c3){_0x22e137[_0xf73c('0x10')]=_0x22e137[_0xf73c('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57a4c3(null,util['format']('%s-%s%s',path[_0xf73c('0x11')](_0x22e137['originalname'],path[_0xf73c('0x12')](_0x22e137[_0xf73c('0x10')])),Date[_0xf73c('0x13')](),path['extname'](_0x22e137[_0xf73c('0x10')])));}})});router[_0xf73c('0x14')]('/',upload[_0xf73c('0x15')](_0xf73c('0x16')),controller[_0xf73c('0x17')]);router[_0xf73c('0x18')](_0xf73c('0xc'),auth[_0xf73c('0xa')](),controller['update']);router[_0xf73c('0x19')](_0xf73c('0xc'),auth[_0xf73c('0xa')](),controller['delete']);module[_0xf73c('0x1a')]=router; \ No newline at end of file +var _0x9dba=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','put','update'];(function(_0x26f413,_0x510ec7){var _0x87aebe=function(_0x4905e2){while(--_0x4905e2){_0x26f413['push'](_0x26f413['shift']());}};_0x87aebe(++_0x510ec7);}(_0x9dba,0x12a));var _0xa9db=function(_0x470829,_0x337489){_0x470829=_0x470829-0x0;var _0x47f840=_0x9dba[_0x470829];return _0x47f840;};'use strict';var multer=require(_0xa9db('0x0'));var util=require(_0xa9db('0x1'));var path=require('path');var timeout=require(_0xa9db('0x2'));var express=require(_0xa9db('0x3'));var router=express[_0xa9db('0x4')]();var fs_extra=require(_0xa9db('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9db('0x6'));var config=require(_0xa9db('0x7'));var controller=require('./sound.controller');router[_0xa9db('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9db('0x9')]);router['get'](_0xa9db('0xa'),auth['isAuthenticated'](),controller[_0xa9db('0xb')]);router['get'](_0xa9db('0xc'),auth[_0xa9db('0xd')](),controller[_0xa9db('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb5a944,_0x39a580,_0x5ef2ef){_0x5ef2ef(null,path[_0xa9db('0xf')](config[_0xa9db('0x10')],_0xa9db('0x11')));},'filename':function(_0x9147a1,_0x25c3d1,_0x2c7beb){_0x25c3d1[_0xa9db('0x12')]=_0x25c3d1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c7beb(null,util[_0xa9db('0x13')](_0xa9db('0x14'),path[_0xa9db('0x15')](_0x25c3d1[_0xa9db('0x12')],path[_0xa9db('0x16')](_0x25c3d1[_0xa9db('0x12')])),Date['now'](),path[_0xa9db('0x16')](_0x25c3d1['originalname'])));}})});router[_0xa9db('0x17')]('/',upload['single']('file'),controller['create']);router[_0xa9db('0x18')]('/:id',auth[_0xa9db('0xd')](),controller[_0xa9db('0x19')]);router[_0xa9db('0x1a')](_0xa9db('0xa'),auth[_0xa9db('0xd')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6ba7cab..e515ce6 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 _0x4104=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x3e030b,_0x459975){var _0x34267c=function(_0x44d37f){while(--_0x44d37f){_0x3e030b['push'](_0x3e030b['shift']());}};_0x34267c(++_0x459975);}(_0x4104,0x1ae));var _0x4410=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x4104[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require(_0x4410('0x0'));module['exports']={'name':{'type':Sequelize[_0x4410('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4410('0x1')]},'display_name':{'type':Sequelize[_0x4410('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4410('0x1')]},'original_format':{'type':Sequelize[_0x4410('0x1')]},'original_duration':{'type':Sequelize[_0x4410('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4410('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4410('0x4')]},'converted_format':{'type':Sequelize[_0x4410('0x1')]},'converted_duration':{'type':Sequelize[_0x4410('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x4410('0x3')]},'converted_channelCount':{'type':Sequelize[_0x4410('0x4')]},'converted_bitRate':{'type':Sequelize[_0x4410('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x4410('0x4')]}}; \ No newline at end of file +var _0xb7a5=['name','FLOAT','BIGINT','INTEGER','exports','STRING'];(function(_0x1e9719,_0x145486){var _0x36e088=function(_0x14f435){while(--_0x14f435){_0x1e9719['push'](_0x1e9719['shift']());}};_0x36e088(++_0x145486);}(_0xb7a5,0x13c));var _0x5b7a=function(_0x515982,_0x587d4b){_0x515982=_0x515982-0x0;var _0x1556f0=_0xb7a5[_0x515982];return _0x1556f0;};'use strict';var Sequelize=require('sequelize');module[_0x5b7a('0x0')]={'name':{'type':Sequelize[_0x5b7a('0x1')],'unique':_0x5b7a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5b7a('0x1')]},'display_name':{'type':Sequelize[_0x5b7a('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x5b7a('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x5b7a('0x3')]},'original_sampleCount':{'type':Sequelize[_0x5b7a('0x4')]},'original_channelCount':{'type':Sequelize[_0x5b7a('0x5')]},'original_bitRate':{'type':Sequelize[_0x5b7a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x5b7a('0x5')]},'converted_format':{'type':Sequelize[_0x5b7a('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x5b7a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x5b7a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x5b7a('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8912a2c..f461160 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 _0x4fd4=['info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','save_name','converted_format','existsSync','join','root','ValidationError','server/files/sounds/converted','format','%s.%s','create','file','originalname','extname','basename','filename','server/files/sounds/original'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4fd4,0x121));var _0x44fd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4fd4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x44fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44fd('0x1'));var jsonpatch=require(_0x44fd('0x2'));var rp=require(_0x44fd('0x3'));var moment=require('moment');var BPromise=require(_0x44fd('0x4'));var Mustache=require(_0x44fd('0x5'));var util=require(_0x44fd('0x6'));var path=require(_0x44fd('0x7'));var sox=require(_0x44fd('0x8'));var csv=require(_0x44fd('0x9'));var ejs=require(_0x44fd('0xa'));var fs=require('fs');var fs_extra=require(_0x44fd('0xb'));var _=require(_0x44fd('0xc'));var squel=require('squel');var crypto=require(_0x44fd('0xd'));var jsforce=require(_0x44fd('0xe'));var deskjs=require(_0x44fd('0xf'));var toCsv=require(_0x44fd('0x9'));var querystring=require(_0x44fd('0x10'));var Papa=require(_0x44fd('0x11'));var Redis=require(_0x44fd('0x12'));var authService=require(_0x44fd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44fd('0x14'));var logger=require(_0x44fd('0x15'))(_0x44fd('0x16'));var utils=require(_0x44fd('0x17'));var config=require(_0x44fd('0x18'));var licenseUtil=require(_0x44fd('0x19'));var db=require(_0x44fd('0x1a'))['db'];function respondWithStatusCode(_0x42b80a,_0x1db3e0){_0x1db3e0=_0x1db3e0||0xcc;return function(_0xc0a5b0){if(_0xc0a5b0){return _0x42b80a['sendStatus'](_0x1db3e0);}return _0x42b80a[_0x44fd('0x1b')](_0x1db3e0)[_0x44fd('0x1c')]();};}function respondWithResult(_0x414a74,_0x4da777){_0x4da777=_0x4da777||0xc8;return function(_0x332fe5){if(_0x332fe5){return _0x414a74['status'](_0x4da777)[_0x44fd('0x1d')](_0x332fe5);}};}function respondWithFilteredResult(_0x2460cd,_0x3c0029){return function(_0x3f1124){if(_0x3f1124){var _0xef160a=typeof _0x3c0029[_0x44fd('0x1e')]===_0x44fd('0x1f')&&typeof _0x3c0029[_0x44fd('0x20')]===_0x44fd('0x1f');var _0x46f275=_0x3f1124[_0x44fd('0x21')];var _0x24dbff=_0xef160a?0x0:_0x3c0029[_0x44fd('0x1e')];var _0x2c1d4a=_0xef160a?_0x3f1124[_0x44fd('0x21')]:_0x3c0029[_0x44fd('0x1e')]+_0x3c0029[_0x44fd('0x20')];var _0x207b3e;if(_0x2c1d4a>=_0x46f275){_0x2c1d4a=_0x46f275;_0x207b3e=0xc8;}else{_0x207b3e=0xce;}_0x2460cd[_0x44fd('0x1b')](_0x207b3e);return _0x2460cd['set'](_0x44fd('0x22'),_0x24dbff+'-'+_0x2c1d4a+'/'+_0x46f275)[_0x44fd('0x1d')](_0x3f1124);}return null;};}function patchUpdates(_0x29f555){return function(_0x6076d7){try{jsonpatch['apply'](_0x6076d7,_0x29f555,!![]);}catch(_0x5ed32e){return BPromise[_0x44fd('0x23')](_0x5ed32e);}return _0x6076d7[_0x44fd('0x24')]();};}function saveUpdates(_0x212553,_0x3dc01f){return function(_0x4caedc){if(_0x4caedc){return _0x4caedc['update'](_0x212553)[_0x44fd('0x25')](function(_0x2845b3){return _0x2845b3;});}return null;};}function removeEntity(_0x56a488,_0x33abd6){return function(_0x441313){if(_0x441313){return _0x441313[_0x44fd('0x26')]()[_0x44fd('0x25')](function(){var _0x1fce30=_0x441313['get']({'plain':!![]});var _0x558a6a=_0x44fd('0x27');return db[_0x44fd('0x28')][_0x44fd('0x26')]({'where':{'type':_0x558a6a,'resourceId':_0x1fce30['id']}})[_0x44fd('0x25')](function(){return _0x441313;});})[_0x44fd('0x25')](function(){_0x56a488['status'](0xcc)[_0x44fd('0x1c')]();});}};}function handleEntityNotFound(_0x1def66,_0x42b343){return function(_0x100741){if(!_0x100741){_0x1def66[_0x44fd('0x29')](0x194);}return _0x100741;};}function handleError(_0x400023,_0x43cf62){_0x43cf62=_0x43cf62||0x1f4;return function(_0x5530eb){logger['error'](_0x5530eb[_0x44fd('0x2a')]);if(_0x5530eb['name']){delete _0x5530eb[_0x44fd('0x2b')];}_0x400023[_0x44fd('0x1b')](_0x43cf62)[_0x44fd('0x2c')](_0x5530eb);};}exports[_0x44fd('0x2d')]=function(_0xa0404d,_0x1c7023){var _0x33d387={},_0x58ef3c={},_0x42dcf9={'count':0x0,'rows':[]};var _0x341389=_[_0x44fd('0x2e')](db[_0x44fd('0x2f')][_0x44fd('0x30')],function(_0x418cc9){return{'name':_0x418cc9[_0x44fd('0x31')],'type':_0x418cc9[_0x44fd('0x32')][_0x44fd('0x33')]};});_0x58ef3c[_0x44fd('0x34')]=_['map'](_0x341389,_0x44fd('0x2b'));_0x58ef3c[_0x44fd('0x35')]=_[_0x44fd('0x36')](_0xa0404d[_0x44fd('0x35')]);_0x58ef3c['filters']=_[_0x44fd('0x37')](_0x58ef3c[_0x44fd('0x34')],_0x58ef3c['query']);_0x33d387[_0x44fd('0x38')]=_[_0x44fd('0x37')](_0x58ef3c[_0x44fd('0x34')],qs[_0x44fd('0x39')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x39')]));_0x33d387['attributes']=_0x33d387[_0x44fd('0x38')][_0x44fd('0x3a')]?_0x33d387[_0x44fd('0x38')]:_0x58ef3c['model'];if(!_0xa0404d['query']['hasOwnProperty'](_0x44fd('0x3b'))){_0x33d387[_0x44fd('0x20')]=qs[_0x44fd('0x20')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x20')]);_0x33d387['offset']=qs[_0x44fd('0x1e')](_0xa0404d['query'][_0x44fd('0x1e')]);}_0x33d387[_0x44fd('0x3c')]=qs[_0x44fd('0x3d')](_0xa0404d[_0x44fd('0x35')][_0x44fd('0x3d')]);_0x33d387[_0x44fd('0x3e')]=qs[_0x44fd('0x3f')](_[_0x44fd('0x40')](_0xa0404d['query'],_0x58ef3c[_0x44fd('0x3f')]),_0x341389);if(_0xa0404d[_0x44fd('0x35')]['filter']){_0x33d387[_0x44fd('0x3e')]=_[_0x44fd('0x41')](_0x33d387[_0x44fd('0x3e')],{'$or':_[_0x44fd('0x2e')](_0x341389,function(_0xbf7bd3){if(_0xbf7bd3[_0x44fd('0x32')]!==_0x44fd('0x42')){var _0x24122e={};_0x24122e[_0xbf7bd3[_0x44fd('0x2b')]]={'$like':'%'+_0xa0404d[_0x44fd('0x35')]['filter']+'%'};return _0x24122e;}})});}_0x33d387=_['merge']({},_0x33d387,_0xa0404d[_0x44fd('0x43')]);var _0x1188af={'where':_0x33d387[_0x44fd('0x3e')]};return db[_0x44fd('0x2f')]['count'](_0x1188af)['then'](function(_0x5f0dba){_0x42dcf9[_0x44fd('0x21')]=_0x5f0dba;if(_0xa0404d[_0x44fd('0x35')][_0x44fd('0x44')]){_0x33d387[_0x44fd('0x45')]=[{'all':!![]}];}return db['Sound'][_0x44fd('0x46')](_0x33d387);})[_0x44fd('0x25')](function(_0x5914a8){_0x42dcf9[_0x44fd('0x47')]=_0x5914a8;return _0x42dcf9;})[_0x44fd('0x25')](respondWithFilteredResult(_0x1c7023,_0x33d387))['catch'](handleError(_0x1c7023,null));};exports[_0x44fd('0x48')]=function(_0x1fdd9c,_0x1e8fea){var _0xf7fc5f={'raw':!![],'where':{'id':_0x1fdd9c[_0x44fd('0x49')]['id']}},_0x14157d={};_0x14157d[_0x44fd('0x34')]=_[_0x44fd('0x36')](db[_0x44fd('0x2f')][_0x44fd('0x30')]);_0x14157d[_0x44fd('0x35')]=_[_0x44fd('0x36')](_0x1fdd9c[_0x44fd('0x35')]);_0x14157d[_0x44fd('0x3f')]=_[_0x44fd('0x37')](_0x14157d[_0x44fd('0x34')],_0x14157d[_0x44fd('0x35')]);_0xf7fc5f[_0x44fd('0x38')]=_[_0x44fd('0x37')](_0x14157d[_0x44fd('0x34')],qs[_0x44fd('0x39')](_0x1fdd9c[_0x44fd('0x35')]['fields']));_0xf7fc5f[_0x44fd('0x38')]=_0xf7fc5f[_0x44fd('0x38')]['length']?_0xf7fc5f[_0x44fd('0x38')]:_0x14157d[_0x44fd('0x34')];if(_0x1fdd9c[_0x44fd('0x35')]['includeAll']){_0xf7fc5f[_0x44fd('0x45')]=[{'all':!![]}];}_0xf7fc5f=_[_0x44fd('0x41')]({},_0xf7fc5f,_0x1fdd9c[_0x44fd('0x43')]);return db['Sound'][_0x44fd('0x4a')](_0xf7fc5f)['then'](handleEntityNotFound(_0x1e8fea,null))[_0x44fd('0x25')](respondWithResult(_0x1e8fea,null))[_0x44fd('0x4b')](handleError(_0x1e8fea,null));};exports['download']=function(_0x43914f,_0x3367c1,_0x4a948c){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x43914f[_0x44fd('0x49')]['id']},'attributes':[_0x44fd('0x2b'),_0x44fd('0x4c'),_0x44fd('0x4d')],'raw':!![]})[_0x44fd('0x25')](handleEntityNotFound(_0x3367c1,null))[_0x44fd('0x25')](function(_0x4f4911){if(_0x4f4911){if(!fs[_0x44fd('0x4e')](path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',_0x4f4911['save_name']+'.'+_0x4f4911['converted_format']))){throw new db['Sequelize'][(_0x44fd('0x51'))]('Sound\x20not\x20found');}return _0x3367c1['download'](path[_0x44fd('0x4f')](config[_0x44fd('0x50')],_0x44fd('0x52'),util[_0x44fd('0x53')](_0x44fd('0x54'),_0x4f4911['save_name'],_0x4f4911['converted_format'])),util[_0x44fd('0x53')](_0x44fd('0x54'),_0x4f4911[_0x44fd('0x2b')],_0x4f4911[_0x44fd('0x4d')]));}return null;})[_0x44fd('0x4b')](handleError(_0x3367c1,null));};exports[_0x44fd('0x55')]=function(_0x3942dd,_0x208651,_0x3d9a39){var _0xdf19a9={'name':path['basename'](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x57')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')]['originalname'])),'save_name':path[_0x44fd('0x59')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')])),'original_format':path['extname'](_0x3942dd['file'][_0x44fd('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x198605=path[_0x44fd('0x4f')](config['root'],_0x44fd('0x5b'),_0x3942dd[_0x44fd('0x56')]['filename']);var _0x29875b=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',util[_0x44fd('0x53')]('%s.%s',path[_0x44fd('0x59')](_0x3942dd['file'][_0x44fd('0x5a')],path[_0x44fd('0x58')](_0x3942dd[_0x44fd('0x56')][_0x44fd('0x5a')])),_0xdf19a9[_0x44fd('0x4d')]));logger[_0x44fd('0x5c')](_0x44fd('0x5d'),_0x198605);logger[_0x44fd('0x5c')](_0x44fd('0x5e'),_0x29875b);try{fs[_0x44fd('0x5f')](_0x198605,parseInt('0777',0x8));var _0x6f0a12=sox[_0x44fd('0x60')](_0x198605,_0x29875b,{'sampleRate':0x1f40,'format':_0x44fd('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x6f0a12['on'](_0x44fd('0x62'),function(_0x29471d){fs[_0x44fd('0x63')](_0x198605);_0x208651[_0x44fd('0x1b')](0x1f4)[_0x44fd('0x2c')](_0x29471d);});_0x6f0a12['on'](_0x44fd('0x64'),function(_0x4710f0){_0xdf19a9[_0x44fd('0x65')]=isNaN(_0x4710f0[_0x44fd('0x66')])?null:_0x4710f0[_0x44fd('0x66')]*0x3e8;_0xdf19a9[_0x44fd('0x67')]=isNaN(_0x4710f0[_0x44fd('0x68')])?null:_0x4710f0[_0x44fd('0x68')];_0xdf19a9['original_channelCount']=isNaN(_0x4710f0[_0x44fd('0x69')])?null:_0x4710f0[_0x44fd('0x69')];_0xdf19a9[_0x44fd('0x6a')]=isNaN(_0x4710f0['bitRate'])?null:_0x4710f0[_0x44fd('0x6b')];_0xdf19a9[_0x44fd('0x6c')]=isNaN(_0x4710f0['sampleRate'])?null:_0x4710f0[_0x44fd('0x6d')];});_0x6f0a12['on']('dest',function(_0x366994){_0xdf19a9[_0x44fd('0x6e')]=isNaN(_0x366994[_0x44fd('0x66')])?null:_0x366994[_0x44fd('0x66')]*0x3e8;_0xdf19a9[_0x44fd('0x6f')]=isNaN(_0x366994[_0x44fd('0x68')])?null:_0x366994[_0x44fd('0x68')];_0xdf19a9['converted_channelCount']=isNaN(_0x366994[_0x44fd('0x69')])?null:_0x366994[_0x44fd('0x69')];_0xdf19a9[_0x44fd('0x70')]=isNaN(_0x366994[_0x44fd('0x6b')])?null:_0x366994[_0x44fd('0x6b')];_0xdf19a9['converted_sampleRate']=isNaN(_0x366994[_0x44fd('0x6d')])?null:_0x366994[_0x44fd('0x6d')];});_0x6f0a12['on'](_0x44fd('0x1c'),function(){fs[_0x44fd('0x5f')](_0x29875b,parseInt(_0x44fd('0x71'),0x8));return db[_0x44fd('0x2f')][_0x44fd('0x55')](_0xdf19a9)['then'](function(_0x460e3b){var _0x2e3ef4={'role':_0x3942dd[_0x44fd('0x72')][_0x44fd('0x73')],'userProfileId':_0x3942dd[_0x44fd('0x72')][_0x44fd('0x74')]};if(!_0x2e3ef4)throw new Error(_0x44fd('0x75'));if(_0x2e3ef4[_0x44fd('0x73')]===_0x44fd('0x76')){var _0x2c2ba9=_0x460e3b[_0x44fd('0x77')]({'plain':!![]});return db[_0x44fd('0x78')]['find']({'where':{'name':_0x44fd('0x27'),'userProfileId':_0x2e3ef4[_0x44fd('0x74')]},'raw':!![]})[_0x44fd('0x25')](function(_0x3e6b51){if(_0x3e6b51&&_0x3e6b51[_0x44fd('0x79')]===0x0){return db[_0x44fd('0x28')]['create']({'name':_0x2c2ba9[_0x44fd('0x2b')],'resourceId':_0x2c2ba9['id'],'type':_0x3e6b51[_0x44fd('0x2b')],'sectionId':_0x3e6b51['id']},{})['then'](function(){return _0x460e3b;});}else{return _0x460e3b;}})[_0x44fd('0x4b')](function(_0x4eb837){logger[_0x44fd('0x62')](_0x44fd('0x7a'),_0x4eb837);throw _0x4eb837;});}return _0x460e3b;})[_0x44fd('0x25')](respondWithResult(_0x208651,null))[_0x44fd('0x4b')](handleError(_0x208651,null));});_0x6f0a12[_0x44fd('0x7b')]();}catch(_0x301749){_0x208651[_0x44fd('0x1b')](0x1f4)[_0x44fd('0x2c')](_0x301749);}};exports[_0x44fd('0x7c')]=function(_0x15e1ae,_0x2164bd,_0x191cf2){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x15e1ae[_0x44fd('0x49')]['id']}})[_0x44fd('0x25')](handleEntityNotFound(_0x2164bd,null))['then'](saveUpdates(_[_0x44fd('0x40')](_0x15e1ae['body'],[_0x44fd('0x2b'),'description']),null))['then'](respondWithResult(_0x2164bd,null))[_0x44fd('0x4b')](handleError(_0x2164bd,null));};exports[_0x44fd('0x7d')]=function(_0x2ad4e3,_0x35559f,_0x5062a4){return db['Sound'][_0x44fd('0x4a')]({'where':{'id':_0x2ad4e3[_0x44fd('0x49')]['id']}})[_0x44fd('0x25')](function(_0xb7a6d7){if(_0xb7a6d7){return _0xb7a6d7[_0x44fd('0x26')]();}})[_0x44fd('0x25')](function(_0x33bdf0){var _0x3cfd29=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/original',util[_0x44fd('0x53')](_0x44fd('0x54'),_0x33bdf0[_0x44fd('0x4c')],_0x33bdf0[_0x44fd('0x7e')]));var _0x326f95=path[_0x44fd('0x4f')](config[_0x44fd('0x50')],'server/files/sounds/converted',util[_0x44fd('0x53')](_0x44fd('0x54'),_0x33bdf0['save_name'],_0x33bdf0[_0x44fd('0x4d')]));fs[_0x44fd('0x63')](_0x3cfd29);fs[_0x44fd('0x63')](_0x326f95);return _0x33bdf0;})['then'](function(_0x3e6dfc){if(_0x3e6dfc){return _0x35559f['status'](0xcc)[_0x44fd('0x1c')]();}})[_0x44fd('0x25')](handleEntityNotFound(_0x35559f,null))[_0x44fd('0x4b')](handleError(_0x35559f,null));}; \ No newline at end of file +var _0xda98=['chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','bitRate','converted_sampleRate','end','create','body','role','userProfileId','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','Sounds','UserProfileResource','error','stack','map','Sound','rawAttributes','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','basename','file','extname','originalname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s'];(function(_0x140dcd,_0xe99058){var _0x346705=function(_0x38a521){while(--_0x38a521){_0x140dcd['push'](_0x140dcd['shift']());}};_0x346705(++_0xe99058);}(_0xda98,0x19a));var _0x8da9=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0xda98[_0x11de83];return _0x45bdb0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8da9('0x0'));var zipdir=require(_0x8da9('0x1'));var jsonpatch=require(_0x8da9('0x2'));var rp=require(_0x8da9('0x3'));var moment=require(_0x8da9('0x4'));var BPromise=require(_0x8da9('0x5'));var Mustache=require('mustache');var util=require(_0x8da9('0x6'));var path=require(_0x8da9('0x7'));var sox=require(_0x8da9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8da9('0x9'));var _=require('lodash');var squel=require(_0x8da9('0xa'));var crypto=require(_0x8da9('0xb'));var jsforce=require(_0x8da9('0xc'));var deskjs=require(_0x8da9('0xd'));var toCsv=require(_0x8da9('0xe'));var querystring=require(_0x8da9('0xf'));var Papa=require(_0x8da9('0x10'));var Redis=require(_0x8da9('0x11'));var authService=require(_0x8da9('0x12'));var qs=require(_0x8da9('0x13'));var as=require(_0x8da9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8da9('0x15'))(_0x8da9('0x16'));var utils=require(_0x8da9('0x17'));var config=require(_0x8da9('0x18'));var licenseUtil=require(_0x8da9('0x19'));var db=require(_0x8da9('0x1a'))['db'];function respondWithStatusCode(_0x2a591f,_0xf26c6a){_0xf26c6a=_0xf26c6a||0xcc;return function(_0x3c5d2b){if(_0x3c5d2b){return _0x2a591f[_0x8da9('0x1b')](_0xf26c6a);}return _0x2a591f[_0x8da9('0x1c')](_0xf26c6a)['end']();};}function respondWithResult(_0x4dd420,_0x53e22d){_0x53e22d=_0x53e22d||0xc8;return function(_0x575054){if(_0x575054){return _0x4dd420[_0x8da9('0x1c')](_0x53e22d)['json'](_0x575054);}};}function respondWithFilteredResult(_0xf9cb5e,_0x30550f){return function(_0x54afff){if(_0x54afff){var _0x1d2ff6=typeof _0x30550f['offset']===_0x8da9('0x1d')&&typeof _0x30550f['limit']===_0x8da9('0x1d');var _0x12f60b=_0x54afff[_0x8da9('0x1e')];var _0x2a3c8c=_0x1d2ff6?0x0:_0x30550f['offset'];var _0x7c496f=_0x1d2ff6?_0x54afff[_0x8da9('0x1e')]:_0x30550f[_0x8da9('0x1f')]+_0x30550f['limit'];var _0x1f6765;if(_0x7c496f>=_0x12f60b){_0x7c496f=_0x12f60b;_0x1f6765=0xc8;}else{_0x1f6765=0xce;}_0xf9cb5e[_0x8da9('0x1c')](_0x1f6765);return _0xf9cb5e[_0x8da9('0x20')](_0x8da9('0x21'),_0x2a3c8c+'-'+_0x7c496f+'/'+_0x12f60b)[_0x8da9('0x22')](_0x54afff);}return null;};}function patchUpdates(_0x2c99b5){return function(_0xc73807){try{jsonpatch[_0x8da9('0x23')](_0xc73807,_0x2c99b5,!![]);}catch(_0x5aebaa){return BPromise[_0x8da9('0x24')](_0x5aebaa);}return _0xc73807[_0x8da9('0x25')]();};}function saveUpdates(_0x6dea02,_0x312c27){return function(_0x54d2f2){if(_0x54d2f2){return _0x54d2f2[_0x8da9('0x26')](_0x6dea02)['then'](function(_0xa1fed1){return _0xa1fed1;});}return null;};}function removeEntity(_0x807932,_0x4b13bd){return function(_0x4262f6){if(_0x4262f6){return _0x4262f6[_0x8da9('0x27')]()[_0x8da9('0x28')](function(){var _0x113e9d=_0x4262f6['get']({'plain':!![]});var _0x26a4b8=_0x8da9('0x29');return db[_0x8da9('0x2a')]['destroy']({'where':{'type':_0x26a4b8,'resourceId':_0x113e9d['id']}})[_0x8da9('0x28')](function(){return _0x4262f6;});})['then'](function(){_0x807932['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c7025,_0x2956aa){return function(_0x10e3b3){if(!_0x10e3b3){_0x3c7025['sendStatus'](0x194);}return _0x10e3b3;};}function handleError(_0x3d4c55,_0x34e310){_0x34e310=_0x34e310||0x1f4;return function(_0x58d5cb){logger[_0x8da9('0x2b')](_0x58d5cb[_0x8da9('0x2c')]);if(_0x58d5cb['name']){delete _0x58d5cb['name'];}_0x3d4c55['status'](_0x34e310)['send'](_0x58d5cb);};}exports['index']=function(_0x335310,_0x534242){var _0x309760={},_0x111c13={},_0x128a0b={'count':0x0,'rows':[]};var _0x259e62=_[_0x8da9('0x2d')](db[_0x8da9('0x2e')][_0x8da9('0x2f')],function(_0x3c95b4){return{'name':_0x3c95b4['fieldName'],'type':_0x3c95b4[_0x8da9('0x30')][_0x8da9('0x31')]};});_0x111c13['model']=_[_0x8da9('0x2d')](_0x259e62,_0x8da9('0x32'));_0x111c13[_0x8da9('0x33')]=_['keys'](_0x335310[_0x8da9('0x33')]);_0x111c13[_0x8da9('0x34')]=_[_0x8da9('0x35')](_0x111c13[_0x8da9('0x36')],_0x111c13[_0x8da9('0x33')]);_0x309760['attributes']=_[_0x8da9('0x35')](_0x111c13[_0x8da9('0x36')],qs['fields'](_0x335310['query'][_0x8da9('0x37')]));_0x309760[_0x8da9('0x38')]=_0x309760[_0x8da9('0x38')][_0x8da9('0x39')]?_0x309760['attributes']:_0x111c13[_0x8da9('0x36')];if(!_0x335310[_0x8da9('0x33')][_0x8da9('0x3a')](_0x8da9('0x3b'))){_0x309760['limit']=qs[_0x8da9('0x3c')](_0x335310['query'][_0x8da9('0x3c')]);_0x309760['offset']=qs[_0x8da9('0x1f')](_0x335310['query'][_0x8da9('0x1f')]);}_0x309760[_0x8da9('0x3d')]=qs['sort'](_0x335310[_0x8da9('0x33')][_0x8da9('0x3e')]);_0x309760[_0x8da9('0x3f')]=qs[_0x8da9('0x34')](_[_0x8da9('0x40')](_0x335310['query'],_0x111c13[_0x8da9('0x34')]),_0x259e62);if(_0x335310[_0x8da9('0x33')][_0x8da9('0x41')]){_0x309760[_0x8da9('0x3f')]=_[_0x8da9('0x42')](_0x309760[_0x8da9('0x3f')],{'$or':_[_0x8da9('0x2d')](_0x259e62,function(_0x4696c9){if(_0x4696c9['type']!=='VIRTUAL'){var _0x3c6c45={};_0x3c6c45[_0x4696c9[_0x8da9('0x32')]]={'$like':'%'+_0x335310[_0x8da9('0x33')][_0x8da9('0x41')]+'%'};return _0x3c6c45;}})});}_0x309760=_[_0x8da9('0x42')]({},_0x309760,_0x335310[_0x8da9('0x43')]);var _0xdfed12={'where':_0x309760['where']};return db[_0x8da9('0x2e')][_0x8da9('0x1e')](_0xdfed12)[_0x8da9('0x28')](function(_0x36374b){_0x128a0b[_0x8da9('0x1e')]=_0x36374b;if(_0x335310[_0x8da9('0x33')][_0x8da9('0x44')]){_0x309760['include']=[{'all':!![]}];}return db[_0x8da9('0x2e')][_0x8da9('0x45')](_0x309760);})['then'](function(_0x18616b){_0x128a0b[_0x8da9('0x46')]=_0x18616b;return _0x128a0b;})[_0x8da9('0x28')](respondWithFilteredResult(_0x534242,_0x309760))[_0x8da9('0x47')](handleError(_0x534242,null));};exports[_0x8da9('0x48')]=function(_0x173527,_0x306e21){var _0x5bb462={'raw':!![],'where':{'id':_0x173527[_0x8da9('0x49')]['id']}},_0x353c43={};_0x353c43['model']=_['keys'](db[_0x8da9('0x2e')][_0x8da9('0x2f')]);_0x353c43['query']=_[_0x8da9('0x4a')](_0x173527[_0x8da9('0x33')]);_0x353c43['filters']=_[_0x8da9('0x35')](_0x353c43[_0x8da9('0x36')],_0x353c43['query']);_0x5bb462['attributes']=_['intersection'](_0x353c43[_0x8da9('0x36')],qs[_0x8da9('0x37')](_0x173527['query']['fields']));_0x5bb462[_0x8da9('0x38')]=_0x5bb462[_0x8da9('0x38')][_0x8da9('0x39')]?_0x5bb462[_0x8da9('0x38')]:_0x353c43[_0x8da9('0x36')];if(_0x173527[_0x8da9('0x33')][_0x8da9('0x44')]){_0x5bb462[_0x8da9('0x4b')]=[{'all':!![]}];}_0x5bb462=_['merge']({},_0x5bb462,_0x173527[_0x8da9('0x43')]);return db[_0x8da9('0x2e')][_0x8da9('0x4c')](_0x5bb462)[_0x8da9('0x28')](handleEntityNotFound(_0x306e21,null))[_0x8da9('0x28')](respondWithResult(_0x306e21,null))['catch'](handleError(_0x306e21,null));};exports[_0x8da9('0x4d')]=function(_0x4e5c77,_0x415b3c,_0x4a2d96){return db[_0x8da9('0x2e')][_0x8da9('0x4c')]({'where':{'id':_0x4e5c77['params']['id']},'attributes':[_0x8da9('0x32'),_0x8da9('0x4e'),_0x8da9('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x415b3c,null))['then'](function(_0xec450b){if(_0xec450b){if(!fs[_0x8da9('0x50')](path[_0x8da9('0x51')](config[_0x8da9('0x52')],_0x8da9('0x53'),_0xec450b[_0x8da9('0x4e')]+'.'+_0xec450b[_0x8da9('0x4f')]))){throw new db['Sequelize'][(_0x8da9('0x54'))](_0x8da9('0x55'));}return _0x415b3c[_0x8da9('0x4d')](path['join'](config[_0x8da9('0x52')],_0x8da9('0x53'),util[_0x8da9('0x56')]('%s.%s',_0xec450b[_0x8da9('0x4e')],_0xec450b[_0x8da9('0x4f')])),util[_0x8da9('0x56')](_0x8da9('0x57'),_0xec450b['name'],_0xec450b[_0x8da9('0x4f')]));}return null;})[_0x8da9('0x47')](handleError(_0x415b3c,null));};exports['create']=function(_0x2a69dd,_0xa53ea5,_0x3552ab){var _0xd92a7f={'name':path[_0x8da9('0x58')](_0x2a69dd[_0x8da9('0x59')]['originalname'],path[_0x8da9('0x5a')](_0x2a69dd[_0x8da9('0x59')][_0x8da9('0x5b')])),'save_name':path[_0x8da9('0x58')](_0x2a69dd[_0x8da9('0x59')]['filename'],path[_0x8da9('0x5a')](_0x2a69dd[_0x8da9('0x59')][_0x8da9('0x5c')])),'original_format':path[_0x8da9('0x5a')](_0x2a69dd['file']['originalname'])['substring'](0x1),'converted_format':_0x8da9('0x5d')};var _0x55200a=path[_0x8da9('0x51')](config[_0x8da9('0x52')],_0x8da9('0x5e'),_0x2a69dd[_0x8da9('0x59')]['filename']);var _0x51ce20=path[_0x8da9('0x51')](config[_0x8da9('0x52')],_0x8da9('0x53'),util[_0x8da9('0x56')](_0x8da9('0x57'),path[_0x8da9('0x58')](_0x2a69dd['file']['filename'],path[_0x8da9('0x5a')](_0x2a69dd[_0x8da9('0x59')][_0x8da9('0x5c')])),_0xd92a7f[_0x8da9('0x4f')]));logger[_0x8da9('0x5f')](_0x8da9('0x60'),_0x55200a);logger['info'](_0x8da9('0x61'),_0x51ce20);try{fs[_0x8da9('0x62')](_0x55200a,parseInt(_0x8da9('0x63'),0x8));var _0xabd0a2=sox[_0x8da9('0x64')](_0x55200a,_0x51ce20,{'sampleRate':0x1f40,'format':_0x8da9('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xabd0a2['on'](_0x8da9('0x2b'),function(_0xf053dc){fs[_0x8da9('0x65')](_0x55200a);_0xa53ea5[_0x8da9('0x1c')](0x1f4)[_0x8da9('0x66')](_0xf053dc);});_0xabd0a2['on'](_0x8da9('0x67'),function(_0x483982){_0xd92a7f[_0x8da9('0x68')]=isNaN(_0x483982['duration'])?null:_0x483982[_0x8da9('0x69')]*0x3e8;_0xd92a7f[_0x8da9('0x6a')]=isNaN(_0x483982[_0x8da9('0x6b')])?null:_0x483982[_0x8da9('0x6b')];_0xd92a7f['original_channelCount']=isNaN(_0x483982['channelCount'])?null:_0x483982['channelCount'];_0xd92a7f['original_bitRate']=isNaN(_0x483982['bitRate'])?null:_0x483982['bitRate'];_0xd92a7f[_0x8da9('0x6c')]=isNaN(_0x483982['sampleRate'])?null:_0x483982[_0x8da9('0x6d')];});_0xabd0a2['on'](_0x8da9('0x6e'),function(_0x58a2fe){_0xd92a7f[_0x8da9('0x6f')]=isNaN(_0x58a2fe[_0x8da9('0x69')])?null:_0x58a2fe[_0x8da9('0x69')]*0x3e8;_0xd92a7f[_0x8da9('0x70')]=isNaN(_0x58a2fe[_0x8da9('0x6b')])?null:_0x58a2fe[_0x8da9('0x6b')];_0xd92a7f[_0x8da9('0x71')]=isNaN(_0x58a2fe[_0x8da9('0x72')])?null:_0x58a2fe[_0x8da9('0x72')];_0xd92a7f['converted_bitRate']=isNaN(_0x58a2fe['bitRate'])?null:_0x58a2fe[_0x8da9('0x73')];_0xd92a7f[_0x8da9('0x74')]=isNaN(_0x58a2fe[_0x8da9('0x6d')])?null:_0x58a2fe[_0x8da9('0x6d')];});_0xabd0a2['on'](_0x8da9('0x75'),function(){fs[_0x8da9('0x62')](_0x51ce20,parseInt(_0x8da9('0x63'),0x8));return db[_0x8da9('0x2e')][_0x8da9('0x76')](_0xd92a7f)[_0x8da9('0x28')](function(_0x5aa88d){var _0x21cfcc={'role':_0x2a69dd[_0x8da9('0x77')][_0x8da9('0x78')],'userProfileId':_0x2a69dd[_0x8da9('0x77')][_0x8da9('0x79')]};if(!_0x21cfcc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21cfcc[_0x8da9('0x78')]==='user'){var _0x2b47cb=_0x5aa88d[_0x8da9('0x7a')]({'plain':!![]});return db['UserProfileSection'][_0x8da9('0x4c')]({'where':{'name':_0x8da9('0x29'),'userProfileId':_0x21cfcc[_0x8da9('0x79')]},'raw':!![]})['then'](function(_0x1ace68){if(_0x1ace68&&_0x1ace68[_0x8da9('0x7b')]===0x0){return db[_0x8da9('0x2a')]['create']({'name':_0x2b47cb['name'],'resourceId':_0x2b47cb['id'],'type':_0x1ace68[_0x8da9('0x32')],'sectionId':_0x1ace68['id']},{})[_0x8da9('0x28')](function(){return _0x5aa88d;});}else{return _0x5aa88d;}})[_0x8da9('0x47')](function(_0x574350){logger[_0x8da9('0x2b')](_0x8da9('0x7c'),_0x574350);throw _0x574350;});}return _0x5aa88d;})['then'](respondWithResult(_0xa53ea5,null))[_0x8da9('0x47')](handleError(_0xa53ea5,null));});_0xabd0a2['start']();}catch(_0x5adb41){_0xa53ea5['status'](0x1f4)[_0x8da9('0x66')](_0x5adb41);}};exports[_0x8da9('0x26')]=function(_0x361672,_0x3bddc6,_0x251730){return db[_0x8da9('0x2e')]['find']({'where':{'id':_0x361672['params']['id']}})[_0x8da9('0x28')](handleEntityNotFound(_0x3bddc6,null))[_0x8da9('0x28')](saveUpdates(_[_0x8da9('0x40')](_0x361672[_0x8da9('0x77')],[_0x8da9('0x32'),_0x8da9('0x7d')]),null))[_0x8da9('0x28')](respondWithResult(_0x3bddc6,null))[_0x8da9('0x47')](handleError(_0x3bddc6,null));};exports['delete']=function(_0x168df0,_0xc54d3f,_0x272ff2){return db[_0x8da9('0x2e')][_0x8da9('0x4c')]({'where':{'id':_0x168df0[_0x8da9('0x49')]['id']}})[_0x8da9('0x28')](function(_0x3d164e){if(_0x3d164e){return _0x3d164e[_0x8da9('0x27')]();}})[_0x8da9('0x28')](function(_0x54f7cc){var _0x430296=path[_0x8da9('0x51')](config[_0x8da9('0x52')],'server/files/sounds/original',util[_0x8da9('0x56')]('%s.%s',_0x54f7cc[_0x8da9('0x4e')],_0x54f7cc[_0x8da9('0x7e')]));var _0x13b111=path[_0x8da9('0x51')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x54f7cc[_0x8da9('0x4e')],_0x54f7cc[_0x8da9('0x4f')]));fs[_0x8da9('0x65')](_0x430296);fs[_0x8da9('0x65')](_0x13b111);return _0x54f7cc;})[_0x8da9('0x28')](function(_0x1f089d){if(_0x1f089d){return _0xc54d3f[_0x8da9('0x1c')](0xcc)[_0x8da9('0x75')]();}})[_0x8da9('0x28')](handleEntityNotFound(_0xc54d3f,null))['catch'](handleError(_0xc54d3f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 8767b62..d8d4e8b 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 _0x6124=['tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x5522b6,_0x1aad4d){var _0xba4a4c=function(_0x31d39e){while(--_0x31d39e){_0x5522b6['push'](_0x5522b6['shift']());}};_0xba4a4c(++_0x1aad4d);}(_0x6124,0xcd));var _0x4612=function(_0x1ed04d,_0x3b091e){_0x1ed04d=_0x1ed04d-0x0;var _0x5a17c1=_0x6124[_0x1ed04d];return _0x5a17c1;};'use strict';var _=require(_0x4612('0x0'));var util=require(_0x4612('0x1'));var logger=require(_0x4612('0x2'))('api');var moment=require(_0x4612('0x3'));var BPromise=require(_0x4612('0x4'));var rp=require(_0x4612('0x5'));var fs=require('fs');var path=require(_0x4612('0x6'));var rimraf=require(_0x4612('0x7'));var config=require(_0x4612('0x8'));var attributes=require(_0x4612('0x9'));module[_0x4612('0xa')]=function(_0x20bb2c,_0x5af7fc){return _0x20bb2c['define']('Sound',attributes,{'tableName':_0x4612('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe99f=['moment','bluebird','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api'];(function(_0x24681b,_0x31424e){var _0x10d992=function(_0x1c04bc){while(--_0x1c04bc){_0x24681b['push'](_0x24681b['shift']());}};_0x10d992(++_0x31424e);}(_0xe99f,0x6b));var _0xfe99=function(_0x2907a3,_0x24c8d7){_0x2907a3=_0x2907a3-0x0;var _0x623737=_0xe99f[_0x2907a3];return _0x623737;};'use strict';var _=require('lodash');var util=require(_0xfe99('0x0'));var logger=require(_0xfe99('0x1'))(_0xfe99('0x2'));var moment=require(_0xfe99('0x3'));var BPromise=require(_0xfe99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfe99('0x5'));var attributes=require(_0xfe99('0x6'));module[_0xfe99('0x7')]=function(_0x29f7b4,_0x1f8728){return _0x29f7b4[_0xfe99('0x8')](_0xfe99('0x9'),attributes,{'tableName':_0xfe99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 1128ae0..af014ea 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 _0x529d=['model','attributes','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find','options','raw','where','include','map'];(function(_0x4505b8,_0x4ac0d7){var _0x4b3368=function(_0x2fd5cf){while(--_0x2fd5cf){_0x4505b8['push'](_0x4505b8['shift']());}};_0x4b3368(++_0x4ac0d7);}(_0x529d,0x176));var _0xd529=function(_0x1a35bd,_0x287613){_0x1a35bd=_0x1a35bd-0x0;var _0x31d554=_0x529d[_0x1a35bd];return _0x31d554;};'use strict';var _=require('lodash');var util=require(_0xd529('0x0'));var moment=require(_0xd529('0x1'));var BPromise=require(_0xd529('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd529('0x3'))['db'];var utils=require(_0xd529('0x4'));var logger=require(_0xd529('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd529('0x6'));var client=jayson['client'][_0xd529('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49ad3b,_0x2b2b24,_0x263d55){return new BPromise(function(_0x196463,_0x537eb9){return client[_0xd529('0x8')](_0x49ad3b,_0x263d55)[_0xd529('0x9')](function(_0x33b32b){logger[_0xd529('0xa')]('Sound,\x20%s,\x20%s',_0x2b2b24,_0xd529('0xb'));logger[_0xd529('0xc')](_0xd529('0xd'),_0x2b2b24,'request\x20sent',JSON[_0xd529('0xe')](_0x33b32b));if(_0x33b32b['error']){if(_0x33b32b[_0xd529('0xf')][_0xd529('0x10')]===0x1f4){logger[_0xd529('0xf')](_0xd529('0x11'),_0x2b2b24,_0x33b32b['error'][_0xd529('0x12')]);return _0x537eb9(_0x33b32b[_0xd529('0xf')]['message']);}logger[_0xd529('0xf')]('Sound,\x20%s,\x20%s',_0x2b2b24,_0x33b32b[_0xd529('0xf')][_0xd529('0x12')]);return _0x196463(_0x33b32b['error']['message']);}else{logger['info'](_0xd529('0x11'),_0x2b2b24,_0xd529('0xb'));_0x196463(_0x33b32b[_0xd529('0x13')]['message']);}})[_0xd529('0x14')](function(_0x50bc6f){logger['error']('Sound,\x20%s,\x20%s',_0x2b2b24,_0x50bc6f);_0x537eb9(_0x50bc6f);});});}exports[_0xd529('0x15')]=function(_0x22e282){var _0x219afe=this;return new Promise(function(_0x50dac3,_0x15bfcf){return db[_0xd529('0x16')][_0xd529('0x17')]({'raw':_0x22e282[_0xd529('0x18')]?_0x22e282[_0xd529('0x18')][_0xd529('0x19')]===undefined?!![]:![]:!![],'where':_0x22e282['options']?_0x22e282[_0xd529('0x18')][_0xd529('0x1a')]||null:null,'attributes':_0x22e282['options']?_0x22e282[_0xd529('0x18')]['attributes']||null:null,'include':_0x22e282[_0xd529('0x18')]?_0x22e282[_0xd529('0x18')][_0xd529('0x1b')]?_['map'](_0x22e282[_0xd529('0x18')][_0xd529('0x1b')],function(_0x3614a4){return{'model':db[_0x3614a4['model']],'as':_0x3614a4['as'],'attributes':_0x3614a4['attributes'],'include':_0x3614a4[_0xd529('0x1b')]?_[_0xd529('0x1c')](_0x3614a4['include'],function(_0x4130ba){return{'model':db[_0x4130ba['model']],'as':_0x4130ba['as'],'attributes':_0x4130ba['attributes'],'include':_0x4130ba['include']?_['map'](_0x4130ba['include'],function(_0x1f8d53){return{'model':db[_0x1f8d53[_0xd529('0x1d')]],'as':_0x1f8d53['as'],'attributes':_0x1f8d53[_0xd529('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x546032){logger[_0xd529('0xa')]('ShowSound',_0x22e282);logger[_0xd529('0xc')](_0xd529('0x15'),_0x22e282,JSON[_0xd529('0xe')](_0x546032));_0x50dac3(_0x546032);})[_0xd529('0x14')](function(_0x16b6ed){logger[_0xd529('0xf')](_0xd529('0x15'),_0x16b6ed[_0xd529('0x12')],_0x22e282);_0x15bfcf(_0x219afe[_0xd529('0xf')](0x1f4,_0x16b6ed[_0xd529('0x12')]));});});}; \ No newline at end of file +var _0x3ac9=['info','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','find','options','raw','where','attributes','include','model','map'];(function(_0x40a096,_0x150d81){var _0x437a57=function(_0x3b5371){while(--_0x3b5371){_0x40a096['push'](_0x40a096['shift']());}};_0x437a57(++_0x150d81);}(_0x3ac9,0x1ae));var _0x93ac=function(_0x50daa4,_0x3c336d){_0x50daa4=_0x50daa4-0x0;var _0x389935=_0x3ac9[_0x50daa4];return _0x389935;};'use strict';var _=require(_0x93ac('0x0'));var util=require('util');var moment=require(_0x93ac('0x1'));var BPromise=require(_0x93ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93ac('0x3'));var db=require(_0x93ac('0x4'))['db'];var utils=require(_0x93ac('0x5'));var logger=require(_0x93ac('0x6'))(_0x93ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x93ac('0x8'));var client=jayson[_0x93ac('0x9')][_0x93ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x376db2,_0x372ded,_0x4fb207){return new BPromise(function(_0x177edb,_0x57044f){return client[_0x93ac('0xb')](_0x376db2,_0x4fb207)[_0x93ac('0xc')](function(_0x2c4ae8){logger['info'](_0x93ac('0xd'),_0x372ded,_0x93ac('0xe'));logger[_0x93ac('0xf')](_0x93ac('0x10'),_0x372ded,_0x93ac('0xe'),JSON[_0x93ac('0x11')](_0x2c4ae8));if(_0x2c4ae8[_0x93ac('0x12')]){if(_0x2c4ae8['error'][_0x93ac('0x13')]===0x1f4){logger[_0x93ac('0x12')](_0x93ac('0xd'),_0x372ded,_0x2c4ae8[_0x93ac('0x12')][_0x93ac('0x14')]);return _0x57044f(_0x2c4ae8[_0x93ac('0x12')][_0x93ac('0x14')]);}logger[_0x93ac('0x12')](_0x93ac('0xd'),_0x372ded,_0x2c4ae8['error']['message']);return _0x177edb(_0x2c4ae8[_0x93ac('0x12')][_0x93ac('0x14')]);}else{logger['info'](_0x93ac('0xd'),_0x372ded,_0x93ac('0xe'));_0x177edb(_0x2c4ae8[_0x93ac('0x15')][_0x93ac('0x14')]);}})[_0x93ac('0x16')](function(_0x40ec81){logger[_0x93ac('0x12')](_0x93ac('0xd'),_0x372ded,_0x40ec81);_0x57044f(_0x40ec81);});});}exports[_0x93ac('0x17')]=function(_0x12fa2e){var _0x556a9b=this;return new Promise(function(_0x4f9573,_0x461a3c){return db['Sound'][_0x93ac('0x18')]({'raw':_0x12fa2e[_0x93ac('0x19')]?_0x12fa2e[_0x93ac('0x19')][_0x93ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x12fa2e[_0x93ac('0x19')]?_0x12fa2e[_0x93ac('0x19')][_0x93ac('0x1b')]||null:null,'attributes':_0x12fa2e[_0x93ac('0x19')]?_0x12fa2e['options'][_0x93ac('0x1c')]||null:null,'include':_0x12fa2e['options']?_0x12fa2e[_0x93ac('0x19')][_0x93ac('0x1d')]?_['map'](_0x12fa2e[_0x93ac('0x19')][_0x93ac('0x1d')],function(_0x5a93ab){return{'model':db[_0x5a93ab[_0x93ac('0x1e')]],'as':_0x5a93ab['as'],'attributes':_0x5a93ab['attributes'],'include':_0x5a93ab[_0x93ac('0x1d')]?_[_0x93ac('0x1f')](_0x5a93ab[_0x93ac('0x1d')],function(_0x1f977f){return{'model':db[_0x1f977f['model']],'as':_0x1f977f['as'],'attributes':_0x1f977f[_0x93ac('0x1c')],'include':_0x1f977f[_0x93ac('0x1d')]?_[_0x93ac('0x1f')](_0x1f977f['include'],function(_0x5c6ab4){return{'model':db[_0x5c6ab4[_0x93ac('0x1e')]],'as':_0x5c6ab4['as'],'attributes':_0x5c6ab4['attributes']};}):[]};}):[]};}):[]:[]})[_0x93ac('0xc')](function(_0x462eba){logger[_0x93ac('0x20')]('ShowSound',_0x12fa2e);logger[_0x93ac('0xf')](_0x93ac('0x17'),_0x12fa2e,JSON[_0x93ac('0x11')](_0x462eba));_0x4f9573(_0x462eba);})['catch'](function(_0x20992f){logger[_0x93ac('0x12')](_0x93ac('0x17'),_0x20992f[_0x93ac('0x14')],_0x12fa2e);_0x461a3c(_0x556a9b[_0x93ac('0x12')](0x1f4,_0x20992f[_0x93ac('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1778689..3dee7b1 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x38da37,_0x55b675){var _0x1e3a85=function(_0x15f63e){while(--_0x15f63e){_0x38da37['push'](_0x38da37['shift']());}};_0x1e3a85(++_0x55b675);}(_0xda3f,0xec));var _0xfda3=function(_0x43351b,_0x5b23ea){_0x43351b=_0x43351b-0x0;var _0x6feb92=_0xda3f[_0x43351b];return _0x6feb92;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x544b3f,_0x4d8b66){_0x544b3f=_0x544b3f-0x0;var _0x15787f=_0x0b0e[_0x544b3f];return _0x15787f;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index dc8bbc4..9f97b07 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 _0xf3a8=['sequelize','exports','STRING','TEXT','ENUM','out'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xf3a8,0x66));var _0x8f3a=function(_0xadbd68,_0x9b8cc7){_0xadbd68=_0xadbd68-0x0;var _0x41f007=_0xf3a8[_0xadbd68];return _0x41f007;};'use strict';var Sequelize=require(_0x8f3a('0x0'));module[_0x8f3a('0x1')]={'uniqueid':{'type':Sequelize[_0x8f3a('0x2')]},'body':{'type':Sequelize[_0x8f3a('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8f3a('0x4')]('in',_0x8f3a('0x5')),'defaultValue':_0x8f3a('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8f3a('0x3')]}}; \ No newline at end of file +var _0x373a=['ENUM','out','TEXT','sequelize','STRING','medium'];(function(_0x4dd365,_0x28e042){var _0x2b716e=function(_0x294c07){while(--_0x294c07){_0x4dd365['push'](_0x4dd365['shift']());}};_0x2b716e(++_0x28e042);}(_0x373a,0xdb));var _0xa373=function(_0xcfb222,_0x24c9b6){_0xcfb222=_0xcfb222-0x0;var _0x44d11a=_0x373a[_0xcfb222];return _0x44d11a;};'use strict';var Sequelize=require(_0xa373('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa373('0x1')]},'body':{'type':Sequelize['TEXT'](_0xa373('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xa373('0x3')]('in',_0xa373('0x4')),'defaultValue':_0xa373('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xa373('0x1')]},'providerResponse':{'type':Sequelize[_0xa373('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4f5b933..1a90245 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 _0x0fda=['show','params','keys','find','create','body','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x176e96,_0x6f2e74){var _0x9ea112=function(_0x1a549e){while(--_0x1a549e){_0x176e96['push'](_0x176e96['shift']());}};_0x9ea112(++_0x6f2e74);}(_0x0fda,0x96));var _0xa0fd=function(_0x567496,_0x3fafb6){_0x567496=_0x567496-0x0;var _0x28735a=_0x0fda[_0x567496];return _0x28735a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa0fd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0fd('0x1'));var BPromise=require(_0xa0fd('0x2'));var Mustache=require(_0xa0fd('0x3'));var util=require(_0xa0fd('0x4'));var path=require('path');var sox=require(_0xa0fd('0x5'));var csv=require(_0xa0fd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0fd('0x7'));var _=require(_0xa0fd('0x8'));var squel=require(_0xa0fd('0x9'));var crypto=require(_0xa0fd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa0fd('0xb'));var toCsv=require(_0xa0fd('0x6'));var querystring=require(_0xa0fd('0xc'));var Papa=require('papaparse');var Redis=require(_0xa0fd('0xd'));var authService=require(_0xa0fd('0xe'));var qs=require(_0xa0fd('0xf'));var as=require(_0xa0fd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0fd('0x11'))(_0xa0fd('0x12'));var utils=require(_0xa0fd('0x13'));var config=require(_0xa0fd('0x14'));var licenseUtil=require(_0xa0fd('0x15'));var db=require(_0xa0fd('0x16'))['db'];function respondWithStatusCode(_0x497995,_0x1830b8){_0x1830b8=_0x1830b8||0xcc;return function(_0x369dfd){if(_0x369dfd){return _0x497995[_0xa0fd('0x17')](_0x1830b8);}return _0x497995['status'](_0x1830b8)[_0xa0fd('0x18')]();};}function respondWithResult(_0x404514,_0x1a9d4a){_0x1a9d4a=_0x1a9d4a||0xc8;return function(_0x5f4139){if(_0x5f4139){return _0x404514[_0xa0fd('0x19')](_0x1a9d4a)[_0xa0fd('0x1a')](_0x5f4139);}};}function respondWithFilteredResult(_0x2914f6,_0x5abe9c){return function(_0x341dea){if(_0x341dea){var _0x4a5841=typeof _0x5abe9c[_0xa0fd('0x1b')]===_0xa0fd('0x1c')&&typeof _0x5abe9c[_0xa0fd('0x1d')]==='undefined';var _0x521c9e=_0x341dea[_0xa0fd('0x1e')];var _0x411989=_0x4a5841?0x0:_0x5abe9c[_0xa0fd('0x1b')];var _0x421734=_0x4a5841?_0x341dea['count']:_0x5abe9c['offset']+_0x5abe9c[_0xa0fd('0x1d')];var _0xe5fc2d;if(_0x421734>=_0x521c9e){_0x421734=_0x521c9e;_0xe5fc2d=0xc8;}else{_0xe5fc2d=0xce;}_0x2914f6[_0xa0fd('0x19')](_0xe5fc2d);return _0x2914f6[_0xa0fd('0x1f')](_0xa0fd('0x20'),_0x411989+'-'+_0x421734+'/'+_0x521c9e)['json'](_0x341dea);}return null;};}function patchUpdates(_0x1cca79){return function(_0x4da05e){try{jsonpatch[_0xa0fd('0x21')](_0x4da05e,_0x1cca79,!![]);}catch(_0x5549b1){return BPromise[_0xa0fd('0x22')](_0x5549b1);}return _0x4da05e[_0xa0fd('0x23')]();};}function saveUpdates(_0x46fba1,_0x577acf){return function(_0x2e9d7d){if(_0x2e9d7d){return _0x2e9d7d[_0xa0fd('0x24')](_0x46fba1)[_0xa0fd('0x25')](function(_0x151b0e){return _0x151b0e;});}return null;};}function removeEntity(_0x579a31,_0x283905){return function(_0x317132){if(_0x317132){return _0x317132['destroy']()[_0xa0fd('0x25')](function(){_0x579a31[_0xa0fd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dba80,_0x188c4e){return function(_0x3e68c6){if(!_0x3e68c6){_0x1dba80[_0xa0fd('0x17')](0x194);}return _0x3e68c6;};}function handleError(_0x1ece6b,_0x562ddc){_0x562ddc=_0x562ddc||0x1f4;return function(_0x110855){logger['error'](_0x110855[_0xa0fd('0x26')]);if(_0x110855['name']){delete _0x110855[_0xa0fd('0x27')];}_0x1ece6b[_0xa0fd('0x19')](_0x562ddc)['send'](_0x110855);};}exports['index']=function(_0x2a43a3,_0x4a7c39){var _0x5d63a7={},_0x4200ae={},_0x44054b={'count':0x0,'rows':[]};var _0x5892bb=_[_0xa0fd('0x28')](db[_0xa0fd('0x29')][_0xa0fd('0x2a')],function(_0x309ae9){return{'name':_0x309ae9[_0xa0fd('0x2b')],'type':_0x309ae9[_0xa0fd('0x2c')][_0xa0fd('0x2d')]};});_0x4200ae[_0xa0fd('0x2e')]=_[_0xa0fd('0x28')](_0x5892bb,'name');_0x4200ae[_0xa0fd('0x2f')]=_['keys'](_0x2a43a3['query']);_0x4200ae['filters']=_[_0xa0fd('0x30')](_0x4200ae[_0xa0fd('0x2e')],_0x4200ae[_0xa0fd('0x2f')]);_0x5d63a7[_0xa0fd('0x31')]=_[_0xa0fd('0x30')](_0x4200ae[_0xa0fd('0x2e')],qs[_0xa0fd('0x32')](_0x2a43a3['query']['fields']));_0x5d63a7['attributes']=_0x5d63a7[_0xa0fd('0x31')][_0xa0fd('0x33')]?_0x5d63a7[_0xa0fd('0x31')]:_0x4200ae[_0xa0fd('0x2e')];if(!_0x2a43a3[_0xa0fd('0x2f')]['hasOwnProperty'](_0xa0fd('0x34'))){_0x5d63a7[_0xa0fd('0x1d')]=qs[_0xa0fd('0x1d')](_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x1d')]);_0x5d63a7[_0xa0fd('0x1b')]=qs[_0xa0fd('0x1b')](_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x1b')]);}_0x5d63a7['order']=qs[_0xa0fd('0x35')](_0x2a43a3['query'][_0xa0fd('0x35')]);_0x5d63a7[_0xa0fd('0x36')]=qs[_0xa0fd('0x37')](_[_0xa0fd('0x38')](_0x2a43a3[_0xa0fd('0x2f')],_0x4200ae['filters']),_0x5892bb);if(_0x2a43a3['query'][_0xa0fd('0x39')]){_0x5d63a7[_0xa0fd('0x36')]=_[_0xa0fd('0x3a')](_0x5d63a7[_0xa0fd('0x36')],{'$or':_[_0xa0fd('0x28')](_0x5892bb,function(_0x306824){if(_0x306824['type']!==_0xa0fd('0x3b')){var _0x5ba381={};_0x5ba381[_0x306824[_0xa0fd('0x27')]]={'$like':'%'+_0x2a43a3[_0xa0fd('0x2f')][_0xa0fd('0x39')]+'%'};return _0x5ba381;}})});}_0x5d63a7=_[_0xa0fd('0x3a')]({},_0x5d63a7,_0x2a43a3[_0xa0fd('0x3c')]);var _0x3b79b5={'where':_0x5d63a7[_0xa0fd('0x36')]};return db[_0xa0fd('0x29')][_0xa0fd('0x1e')](_0x3b79b5)[_0xa0fd('0x25')](function(_0x3b0a48){_0x44054b[_0xa0fd('0x1e')]=_0x3b0a48;if(_0x2a43a3['query'][_0xa0fd('0x3d')]){_0x5d63a7[_0xa0fd('0x3e')]=[{'all':!![]}];}return db[_0xa0fd('0x29')][_0xa0fd('0x3f')](_0x5d63a7);})[_0xa0fd('0x25')](function(_0xf674f5){_0x44054b[_0xa0fd('0x40')]=_0xf674f5;return _0x44054b;})['then'](respondWithFilteredResult(_0x4a7c39,_0x5d63a7))[_0xa0fd('0x41')](handleError(_0x4a7c39,null));};exports[_0xa0fd('0x42')]=function(_0x3a6d16,_0x24df1b){var _0x255cf3={'raw':!![],'where':{'id':_0x3a6d16[_0xa0fd('0x43')]['id']}},_0xb7882b={};_0xb7882b[_0xa0fd('0x2e')]=_['keys'](db[_0xa0fd('0x29')][_0xa0fd('0x2a')]);_0xb7882b[_0xa0fd('0x2f')]=_[_0xa0fd('0x44')](_0x3a6d16['query']);_0xb7882b['filters']=_[_0xa0fd('0x30')](_0xb7882b[_0xa0fd('0x2e')],_0xb7882b[_0xa0fd('0x2f')]);_0x255cf3['attributes']=_[_0xa0fd('0x30')](_0xb7882b[_0xa0fd('0x2e')],qs[_0xa0fd('0x32')](_0x3a6d16[_0xa0fd('0x2f')][_0xa0fd('0x32')]));_0x255cf3['attributes']=_0x255cf3[_0xa0fd('0x31')]['length']?_0x255cf3[_0xa0fd('0x31')]:_0xb7882b[_0xa0fd('0x2e')];if(_0x3a6d16[_0xa0fd('0x2f')][_0xa0fd('0x3d')]){_0x255cf3['include']=[{'all':!![]}];}_0x255cf3=_[_0xa0fd('0x3a')]({},_0x255cf3,_0x3a6d16[_0xa0fd('0x3c')]);return db[_0xa0fd('0x29')][_0xa0fd('0x45')](_0x255cf3)[_0xa0fd('0x25')](handleEntityNotFound(_0x24df1b,null))['then'](respondWithResult(_0x24df1b,null))[_0xa0fd('0x41')](handleError(_0x24df1b,null));};exports[_0xa0fd('0x46')]=function(_0x1e7b80,_0x572e19){return db[_0xa0fd('0x29')][_0xa0fd('0x46')](_0x1e7b80[_0xa0fd('0x47')],{})[_0xa0fd('0x25')](respondWithResult(_0x572e19,0xc9))[_0xa0fd('0x41')](handleError(_0x572e19,null));};exports[_0xa0fd('0x24')]=function(_0x422445,_0x3704c7){if(_0x422445[_0xa0fd('0x47')]['id']){delete _0x422445[_0xa0fd('0x47')]['id'];}return db[_0xa0fd('0x29')][_0xa0fd('0x45')]({'where':{'id':_0x422445[_0xa0fd('0x43')]['id']}})['then'](handleEntityNotFound(_0x3704c7,null))[_0xa0fd('0x25')](saveUpdates(_0x422445[_0xa0fd('0x47')],null))['then'](respondWithResult(_0x3704c7,null))['catch'](handleError(_0x3704c7,null));};exports['destroy']=function(_0x3156a9,_0x1befc6){return db['SquareMessage'][_0xa0fd('0x45')]({'where':{'id':_0x3156a9['params']['id']}})['then'](handleEntityNotFound(_0x1befc6,null))[_0xa0fd('0x25')](removeEntity(_0x1befc6,null))[_0xa0fd('0x41')](handleError(_0x1befc6,null));}; \ No newline at end of file +var _0x4d32=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','SquareMessage','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','eml-format','zip-dir','request-promise','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'];(function(_0x5bb0be,_0x2a5e84){var _0x29b8b0=function(_0x1425d1){while(--_0x1425d1){_0x5bb0be['push'](_0x5bb0be['shift']());}};_0x29b8b0(++_0x2a5e84);}(_0x4d32,0x1b9));var _0x24d3=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x4d32[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x24d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24d3('0x2'));var moment=require(_0x24d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24d3('0x4'));var util=require(_0x24d3('0x5'));var path=require(_0x24d3('0x6'));var sox=require(_0x24d3('0x7'));var csv=require(_0x24d3('0x8'));var ejs=require(_0x24d3('0x9'));var fs=require('fs');var fs_extra=require(_0x24d3('0xa'));var _=require(_0x24d3('0xb'));var squel=require(_0x24d3('0xc'));var crypto=require(_0x24d3('0xd'));var jsforce=require(_0x24d3('0xe'));var deskjs=require(_0x24d3('0xf'));var toCsv=require(_0x24d3('0x8'));var querystring=require(_0x24d3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x24d3('0x11'));var qs=require(_0x24d3('0x12'));var as=require(_0x24d3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24d3('0x14'))(_0x24d3('0x15'));var utils=require(_0x24d3('0x16'));var config=require(_0x24d3('0x17'));var licenseUtil=require(_0x24d3('0x18'));var db=require(_0x24d3('0x19'))['db'];function respondWithStatusCode(_0x44c040,_0x4a457d){_0x4a457d=_0x4a457d||0xcc;return function(_0x1f0db8){if(_0x1f0db8){return _0x44c040['sendStatus'](_0x4a457d);}return _0x44c040['status'](_0x4a457d)[_0x24d3('0x1a')]();};}function respondWithResult(_0xdc2331,_0x2e79dd){_0x2e79dd=_0x2e79dd||0xc8;return function(_0xafdd46){if(_0xafdd46){return _0xdc2331[_0x24d3('0x1b')](_0x2e79dd)[_0x24d3('0x1c')](_0xafdd46);}};}function respondWithFilteredResult(_0x374a73,_0x1b9011){return function(_0x3e9a7c){if(_0x3e9a7c){var _0x3934da=typeof _0x1b9011[_0x24d3('0x1d')]===_0x24d3('0x1e')&&typeof _0x1b9011[_0x24d3('0x1f')]===_0x24d3('0x1e');var _0x581514=_0x3e9a7c['count'];var _0x4a43b6=_0x3934da?0x0:_0x1b9011[_0x24d3('0x1d')];var _0x15e05e=_0x3934da?_0x3e9a7c[_0x24d3('0x20')]:_0x1b9011[_0x24d3('0x1d')]+_0x1b9011[_0x24d3('0x1f')];var _0x2783d0;if(_0x15e05e>=_0x581514){_0x15e05e=_0x581514;_0x2783d0=0xc8;}else{_0x2783d0=0xce;}_0x374a73['status'](_0x2783d0);return _0x374a73['set'](_0x24d3('0x21'),_0x4a43b6+'-'+_0x15e05e+'/'+_0x581514)['json'](_0x3e9a7c);}return null;};}function patchUpdates(_0x9b21a3){return function(_0x270155){try{jsonpatch[_0x24d3('0x22')](_0x270155,_0x9b21a3,!![]);}catch(_0x2879a9){return BPromise[_0x24d3('0x23')](_0x2879a9);}return _0x270155[_0x24d3('0x24')]();};}function saveUpdates(_0x5c620b,_0x1ee364){return function(_0x2a1f11){if(_0x2a1f11){return _0x2a1f11[_0x24d3('0x25')](_0x5c620b)[_0x24d3('0x26')](function(_0x274d7b){return _0x274d7b;});}return null;};}function removeEntity(_0x16f736,_0x342299){return function(_0x82c6ee){if(_0x82c6ee){return _0x82c6ee[_0x24d3('0x27')]()[_0x24d3('0x26')](function(){_0x16f736[_0x24d3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b026,_0x395084){return function(_0x1aa002){if(!_0x1aa002){_0x49b026[_0x24d3('0x28')](0x194);}return _0x1aa002;};}function handleError(_0x50e0fc,_0x16e71d){_0x16e71d=_0x16e71d||0x1f4;return function(_0x548f75){logger['error'](_0x548f75[_0x24d3('0x29')]);if(_0x548f75['name']){delete _0x548f75['name'];}_0x50e0fc[_0x24d3('0x1b')](_0x16e71d)[_0x24d3('0x2a')](_0x548f75);};}exports[_0x24d3('0x2b')]=function(_0x468193,_0x4e63b3){var _0x126622={},_0x2cbdb0={},_0x335873={'count':0x0,'rows':[]};var _0x54f0ad=_[_0x24d3('0x2c')](db['SquareMessage'][_0x24d3('0x2d')],function(_0xa99bc0){return{'name':_0xa99bc0[_0x24d3('0x2e')],'type':_0xa99bc0[_0x24d3('0x2f')][_0x24d3('0x30')]};});_0x2cbdb0['model']=_[_0x24d3('0x2c')](_0x54f0ad,_0x24d3('0x31'));_0x2cbdb0[_0x24d3('0x32')]=_['keys'](_0x468193[_0x24d3('0x32')]);_0x2cbdb0[_0x24d3('0x33')]=_[_0x24d3('0x34')](_0x2cbdb0[_0x24d3('0x35')],_0x2cbdb0[_0x24d3('0x32')]);_0x126622['attributes']=_['intersection'](_0x2cbdb0['model'],qs[_0x24d3('0x36')](_0x468193['query'][_0x24d3('0x36')]));_0x126622[_0x24d3('0x37')]=_0x126622['attributes'][_0x24d3('0x38')]?_0x126622[_0x24d3('0x37')]:_0x2cbdb0[_0x24d3('0x35')];if(!_0x468193[_0x24d3('0x32')][_0x24d3('0x39')](_0x24d3('0x3a'))){_0x126622[_0x24d3('0x1f')]=qs['limit'](_0x468193[_0x24d3('0x32')][_0x24d3('0x1f')]);_0x126622[_0x24d3('0x1d')]=qs[_0x24d3('0x1d')](_0x468193[_0x24d3('0x32')][_0x24d3('0x1d')]);}_0x126622[_0x24d3('0x3b')]=qs['sort'](_0x468193[_0x24d3('0x32')][_0x24d3('0x3c')]);_0x126622[_0x24d3('0x3d')]=qs[_0x24d3('0x33')](_['pick'](_0x468193[_0x24d3('0x32')],_0x2cbdb0[_0x24d3('0x33')]),_0x54f0ad);if(_0x468193[_0x24d3('0x32')]['filter']){_0x126622['where']=_[_0x24d3('0x3e')](_0x126622[_0x24d3('0x3d')],{'$or':_[_0x24d3('0x2c')](_0x54f0ad,function(_0x5833e2){if(_0x5833e2['type']!=='VIRTUAL'){var _0x5e7dfe={};_0x5e7dfe[_0x5833e2[_0x24d3('0x31')]]={'$like':'%'+_0x468193['query'][_0x24d3('0x3f')]+'%'};return _0x5e7dfe;}})});}_0x126622=_[_0x24d3('0x3e')]({},_0x126622,_0x468193['options']);var _0x38e0cd={'where':_0x126622[_0x24d3('0x3d')]};return db[_0x24d3('0x40')][_0x24d3('0x20')](_0x38e0cd)['then'](function(_0x4b7dc4){_0x335873[_0x24d3('0x20')]=_0x4b7dc4;if(_0x468193['query'][_0x24d3('0x41')]){_0x126622[_0x24d3('0x42')]=[{'all':!![]}];}return db[_0x24d3('0x40')][_0x24d3('0x43')](_0x126622);})[_0x24d3('0x26')](function(_0x20ffbb){_0x335873[_0x24d3('0x44')]=_0x20ffbb;return _0x335873;})['then'](respondWithFilteredResult(_0x4e63b3,_0x126622))[_0x24d3('0x45')](handleError(_0x4e63b3,null));};exports[_0x24d3('0x46')]=function(_0x1be95d,_0x47646b){var _0x5bdc34={'raw':!![],'where':{'id':_0x1be95d['params']['id']}},_0x53eb7a={};_0x53eb7a[_0x24d3('0x35')]=_['keys'](db[_0x24d3('0x40')][_0x24d3('0x2d')]);_0x53eb7a[_0x24d3('0x32')]=_[_0x24d3('0x47')](_0x1be95d['query']);_0x53eb7a[_0x24d3('0x33')]=_[_0x24d3('0x34')](_0x53eb7a['model'],_0x53eb7a[_0x24d3('0x32')]);_0x5bdc34[_0x24d3('0x37')]=_['intersection'](_0x53eb7a[_0x24d3('0x35')],qs[_0x24d3('0x36')](_0x1be95d[_0x24d3('0x32')][_0x24d3('0x36')]));_0x5bdc34[_0x24d3('0x37')]=_0x5bdc34['attributes'][_0x24d3('0x38')]?_0x5bdc34['attributes']:_0x53eb7a[_0x24d3('0x35')];if(_0x1be95d[_0x24d3('0x32')][_0x24d3('0x41')]){_0x5bdc34[_0x24d3('0x42')]=[{'all':!![]}];}_0x5bdc34=_['merge']({},_0x5bdc34,_0x1be95d[_0x24d3('0x48')]);return db[_0x24d3('0x40')][_0x24d3('0x49')](_0x5bdc34)['then'](handleEntityNotFound(_0x47646b,null))[_0x24d3('0x26')](respondWithResult(_0x47646b,null))[_0x24d3('0x45')](handleError(_0x47646b,null));};exports[_0x24d3('0x4a')]=function(_0x175104,_0x28e96a){return db['SquareMessage']['create'](_0x175104[_0x24d3('0x4b')],{})['then'](respondWithResult(_0x28e96a,0xc9))['catch'](handleError(_0x28e96a,null));};exports['update']=function(_0x30661b,_0x13c027){if(_0x30661b['body']['id']){delete _0x30661b[_0x24d3('0x4b')]['id'];}return db[_0x24d3('0x40')][_0x24d3('0x49')]({'where':{'id':_0x30661b[_0x24d3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13c027,null))[_0x24d3('0x26')](saveUpdates(_0x30661b[_0x24d3('0x4b')],null))['then'](respondWithResult(_0x13c027,null))[_0x24d3('0x45')](handleError(_0x13c027,null));};exports[_0x24d3('0x27')]=function(_0xc732a7,_0x5c7e25){return db[_0x24d3('0x40')][_0x24d3('0x49')]({'where':{'id':_0xc732a7[_0x24d3('0x4c')]['id']}})[_0x24d3('0x26')](handleEntityNotFound(_0x5c7e25,null))[_0x24d3('0x26')](removeEntity(_0x5c7e25,null))[_0x24d3('0x45')](handleError(_0x5c7e25,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1135601..81c4643 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 _0x3786=['../../config/logger','api','moment','bluebird','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x3b4408,_0x14b65e){var _0x4be83c=function(_0x3ed670){while(--_0x3ed670){_0x3b4408['push'](_0x3b4408['shift']());}};_0x4be83c(++_0x14b65e);}(_0x3786,0x196));var _0x6378=function(_0x458bcc,_0x2d385d){_0x458bcc=_0x458bcc-0x0;var _0x55c157=_0x3786[_0x458bcc];return _0x55c157;};'use strict';var _=require(_0x6378('0x0'));var util=require(_0x6378('0x1'));var logger=require(_0x6378('0x2'))(_0x6378('0x3'));var moment=require(_0x6378('0x4'));var BPromise=require(_0x6378('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6378('0x6'));var config=require('../../config/environment');var attributes=require(_0x6378('0x7'));module[_0x6378('0x8')]=function(_0x14188a,_0x1e91c2){return _0x14188a[_0x6378('0x9')](_0x6378('0xa'),attributes,{'tableName':_0x6378('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2625=['define','SquareMessage','square_messages','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports'];(function(_0x19d39c,_0x3d84bb){var _0x45b97e=function(_0x43f0c6){while(--_0x43f0c6){_0x19d39c['push'](_0x19d39c['shift']());}};_0x45b97e(++_0x3d84bb);}(_0x2625,0x1cb));var _0x5262=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x2625[_0x9aada2];return _0x196dff;};'use strict';var _=require('lodash');var util=require(_0x5262('0x0'));var logger=require(_0x5262('0x1'))('api');var moment=require(_0x5262('0x2'));var BPromise=require(_0x5262('0x3'));var rp=require(_0x5262('0x4'));var fs=require('fs');var path=require(_0x5262('0x5'));var rimraf=require(_0x5262('0x6'));var config=require('../../config/environment');var attributes=require(_0x5262('0x7'));module[_0x5262('0x8')]=function(_0x4c3e32,_0x29c069){return _0x4c3e32[_0x5262('0x9')](_0x5262('0xa'),attributes,{'tableName':_0x5262('0xb'),'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 ce5caac..4b306f7 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 _0x82f5=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x1f3b0c,_0x3fce85){var _0x11f18f=function(_0x2b0476){while(--_0x2b0476){_0x1f3b0c['push'](_0x1f3b0c['shift']());}};_0x11f18f(++_0x3fce85);}(_0x82f5,0xdc));var _0x582f=function(_0x49361a,_0x3e9b3a){_0x49361a=_0x49361a-0x0;var _0x289cb3=_0x82f5[_0x49361a];return _0x289cb3;};'use strict';var _=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var moment=require(_0x582f('0x2'));var BPromise=require(_0x582f('0x3'));var rs=require(_0x582f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x582f('0x5'));var logger=require(_0x582f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x582f('0x7'));var client=jayson[_0x582f('0x8')][_0x582f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e402b,_0x477dc0,_0x23120d){return new BPromise(function(_0x48c58a,_0x2880e8){return client['request'](_0x3e402b,_0x23120d)[_0x582f('0xa')](function(_0x23368c){logger[_0x582f('0xb')](_0x582f('0xc'),_0x477dc0,_0x582f('0xd'));logger[_0x582f('0xe')](_0x582f('0xf'),_0x477dc0,'request\x20sent',JSON['stringify'](_0x23368c));if(_0x23368c[_0x582f('0x10')]){if(_0x23368c[_0x582f('0x10')][_0x582f('0x11')]===0x1f4){logger[_0x582f('0x10')]('SquareMessage,\x20%s,\x20%s',_0x477dc0,_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);return _0x2880e8(_0x23368c[_0x582f('0x10')]['message']);}logger[_0x582f('0x10')](_0x582f('0xc'),_0x477dc0,_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);return _0x48c58a(_0x23368c[_0x582f('0x10')][_0x582f('0x12')]);}else{logger['info'](_0x582f('0xc'),_0x477dc0,_0x582f('0xd'));_0x48c58a(_0x23368c['result']['message']);}})[_0x582f('0x13')](function(_0xf8e3bb){logger[_0x582f('0x10')](_0x582f('0xc'),_0x477dc0,_0xf8e3bb);_0x2880e8(_0xf8e3bb);});});}exports[_0x582f('0x14')]=function(_0x31086e){var _0x5c358a=this;return new Promise(function(_0x3adb2a,_0x5269e5){return db['SquareMessage']['create'](_0x31086e[_0x582f('0x15')],{'raw':_0x31086e[_0x582f('0x16')]?_0x31086e[_0x582f('0x16')][_0x582f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5e7497){logger[_0x582f('0xb')](_0x582f('0x14'),_0x31086e);logger[_0x582f('0xe')](_0x582f('0x14'),_0x31086e,JSON[_0x582f('0x18')](_0x5e7497));_0x3adb2a(_0x5e7497);})['catch'](function(_0x4169c4){logger[_0x582f('0x10')](_0x582f('0x14'),_0x4169c4[_0x582f('0x12')],_0x31086e);_0x5269e5(_0x5c358a[_0x582f('0x10')](0x1f4,_0x4169c4[_0x582f('0x12')]));});});}; \ No newline at end of file +var _0x40f2=['CreateSquareMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','create','options','raw'];(function(_0x4156b2,_0x8b8260){var _0x25a99f=function(_0x52c349){while(--_0x52c349){_0x4156b2['push'](_0x4156b2['shift']());}};_0x25a99f(++_0x8b8260);}(_0x40f2,0xfd));var _0x240f=function(_0x59295c,_0x328d25){_0x59295c=_0x59295c-0x0;var _0x1de514=_0x40f2[_0x59295c];return _0x1de514;};'use strict';var _=require(_0x240f('0x0'));var util=require(_0x240f('0x1'));var moment=require(_0x240f('0x2'));var BPromise=require(_0x240f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x240f('0x4'));var db=require(_0x240f('0x5'))['db'];var utils=require(_0x240f('0x6'));var logger=require(_0x240f('0x7'))(_0x240f('0x8'));var config=require(_0x240f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x240f('0xa')][_0x240f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x126d9e,_0x3de65b,_0x596024){return new BPromise(function(_0x3f93c3,_0x5df884){return client[_0x240f('0xc')](_0x126d9e,_0x596024)[_0x240f('0xd')](function(_0x5504d3){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3de65b,_0x240f('0xe'));logger[_0x240f('0xf')](_0x240f('0x10'),_0x3de65b,_0x240f('0xe'),JSON[_0x240f('0x11')](_0x5504d3));if(_0x5504d3[_0x240f('0x12')]){if(_0x5504d3['error'][_0x240f('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x3de65b,_0x5504d3['error'][_0x240f('0x14')]);return _0x5df884(_0x5504d3['error'][_0x240f('0x14')]);}logger[_0x240f('0x12')](_0x240f('0x15'),_0x3de65b,_0x5504d3['error'][_0x240f('0x14')]);return _0x3f93c3(_0x5504d3[_0x240f('0x12')]['message']);}else{logger['info'](_0x240f('0x15'),_0x3de65b,_0x240f('0xe'));_0x3f93c3(_0x5504d3[_0x240f('0x16')][_0x240f('0x14')]);}})[_0x240f('0x17')](function(_0x3f5566){logger[_0x240f('0x12')]('SquareMessage,\x20%s,\x20%s',_0x3de65b,_0x3f5566);_0x5df884(_0x3f5566);});});}exports['CreateSquareMessage']=function(_0x1f020a){var _0x32a1f3=this;return new Promise(function(_0x21c260,_0x1dc2c9){return db['SquareMessage'][_0x240f('0x18')](_0x1f020a['body'],{'raw':_0x1f020a['options']?_0x1f020a[_0x240f('0x19')][_0x240f('0x1a')]===undefined?!![]:![]:!![]})[_0x240f('0xd')](function(_0x2555be){logger['info'](_0x240f('0x1b'),_0x1f020a);logger[_0x240f('0xf')](_0x240f('0x1b'),_0x1f020a,JSON[_0x240f('0x11')](_0x2555be));_0x21c260(_0x2555be);})['catch'](function(_0x1f0f30){logger['error'](_0x240f('0x1b'),_0x1f0f30[_0x240f('0x14')],_0x1f020a);_0x1dc2c9(_0x32a1f3[_0x240f('0x12')](0x1f4,_0x1f0f30[_0x240f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index badc849..aaed080 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 _0x9e36=['/:id','show','/:id/test','test','post','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x9e36,0xa1));var _0x69e3=function(_0x4cc588,_0x4a9bc4){_0x4cc588=_0x4cc588-0x0;var _0x36619d=_0x9e36[_0x4cc588];return _0x36619d;};'use strict';var multer=require(_0x69e3('0x0'));var util=require(_0x69e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69e3('0x2'));var router=express[_0x69e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x69e3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x69e3('0x5'));var controller=require(_0x69e3('0x6'));router[_0x69e3('0x7')]('/',auth[_0x69e3('0x8')](),controller[_0x69e3('0x9')]);router[_0x69e3('0x7')](_0x69e3('0xa'),auth[_0x69e3('0x8')](),controller[_0x69e3('0xb')]);router[_0x69e3('0x7')](_0x69e3('0xc'),auth[_0x69e3('0x8')](),timeout('15s'),controller[_0x69e3('0xd')]);router[_0x69e3('0xe')]('/',auth[_0x69e3('0x8')](),controller['create']);router[_0x69e3('0xf')](_0x69e3('0xa'),auth['isAuthenticated'](),controller[_0x69e3('0x10')]);router[_0x69e3('0x11')](_0x69e3('0xa'),auth[_0x69e3('0x8')](),controller['destroy']);module[_0x69e3('0x12')]=router; \ No newline at end of file +var _0x8858=['/:id','isAuthenticated','show','15s','test','post','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get'];(function(_0xf83277,_0x55487e){var _0x361e0e=function(_0xa2b602){while(--_0xa2b602){_0xf83277['push'](_0xf83277['shift']());}};_0x361e0e(++_0x55487e);}(_0x8858,0xa2));var _0x8885=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8858[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x8885('0x0'));var util=require(_0x8885('0x1'));var path=require(_0x8885('0x2'));var timeout=require(_0x8885('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8885('0x4'));var auth=require(_0x8885('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8885('0x6'));var controller=require(_0x8885('0x7'));router[_0x8885('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8885('0x8')](_0x8885('0x9'),auth[_0x8885('0xa')](),controller[_0x8885('0xb')]);router[_0x8885('0x8')]('/:id/test',auth[_0x8885('0xa')](),timeout(_0x8885('0xc')),controller[_0x8885('0xd')]);router[_0x8885('0xe')]('/',auth[_0x8885('0xa')](),controller[_0x8885('0xf')]);router[_0x8885('0x10')]('/:id',auth[_0x8885('0xa')](),controller['update']);router[_0x8885('0x11')]('/:id',auth[_0x8885('0xa')](),controller[_0x8885('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 87c0e45..be49252 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 _0xe85e=['STRING','name','sequelize','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xe85e,0x1ae));var _0xee85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee85('0x0'));module[_0xee85('0x1')]={'name':{'type':Sequelize[_0xee85('0x2')],'unique':_0xee85('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xee85('0x2')]},'description':{'type':Sequelize[_0xee85('0x2')]}}; \ No newline at end of file +var _0x88f0=['sequelize','exports','STRING','name'];(function(_0x387145,_0x5a9167){var _0x49ba5e=function(_0x1c7fae){while(--_0x1c7fae){_0x387145['push'](_0x387145['shift']());}};_0x49ba5e(++_0x5a9167);}(_0x88f0,0x130));var _0x088f=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x88f0[_0x3f70cd];return _0x3feb93;};'use strict';var Sequelize=require(_0x088f('0x0'));module[_0x088f('0x1')]={'name':{'type':Sequelize[_0x088f('0x2')],'unique':_0x088f('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'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 e908f06..8e6d70b 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 _0xdb9c=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','catch','body','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1e30fe,_0x33c422){var _0x378089=function(_0xa08c87){while(--_0xa08c87){_0x1e30fe['push'](_0x1e30fe['shift']());}};_0x378089(++_0x33c422);}(_0xdb9c,0xff));var _0xcdb9=function(_0x32c315,_0x4ab541){_0x32c315=_0x32c315-0x0;var _0x469e07=_0xdb9c[_0x32c315];return _0x469e07;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdb9('0x0'));var zipdir=require(_0xcdb9('0x1'));var jsonpatch=require(_0xcdb9('0x2'));var rp=require(_0xcdb9('0x3'));var moment=require(_0xcdb9('0x4'));var BPromise=require(_0xcdb9('0x5'));var Mustache=require(_0xcdb9('0x6'));var util=require(_0xcdb9('0x7'));var path=require(_0xcdb9('0x8'));var sox=require(_0xcdb9('0x9'));var csv=require(_0xcdb9('0xa'));var ejs=require(_0xcdb9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdb9('0xc'));var squel=require('squel');var crypto=require(_0xcdb9('0xd'));var jsforce=require(_0xcdb9('0xe'));var deskjs=require(_0xcdb9('0xf'));var toCsv=require(_0xcdb9('0xa'));var querystring=require('querystring');var Papa=require(_0xcdb9('0x10'));var Redis=require(_0xcdb9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcdb9('0x12'));var as=require(_0xcdb9('0x13'));var hardwareService=require(_0xcdb9('0x14'));var logger=require(_0xcdb9('0x15'))('api');var utils=require(_0xcdb9('0x16'));var config=require(_0xcdb9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdb9('0x18'))['db'];function respondWithStatusCode(_0x1453ba,_0x23a682){_0x23a682=_0x23a682||0xcc;return function(_0x1fa2d1){if(_0x1fa2d1){return _0x1453ba[_0xcdb9('0x19')](_0x23a682);}return _0x1453ba[_0xcdb9('0x1a')](_0x23a682)[_0xcdb9('0x1b')]();};}function respondWithResult(_0x51ad38,_0xabffb9){_0xabffb9=_0xabffb9||0xc8;return function(_0x19be29){if(_0x19be29){return _0x51ad38['status'](_0xabffb9)[_0xcdb9('0x1c')](_0x19be29);}};}function respondWithFilteredResult(_0x3b767b,_0x569547){return function(_0x3a2f09){if(_0x3a2f09){var _0x7538e2=typeof _0x569547[_0xcdb9('0x1d')]==='undefined'&&typeof _0x569547[_0xcdb9('0x1e')]===_0xcdb9('0x1f');var _0x1501be=_0x3a2f09[_0xcdb9('0x20')];var _0x1475ba=_0x7538e2?0x0:_0x569547[_0xcdb9('0x1d')];var _0x8c4a6d=_0x7538e2?_0x3a2f09['count']:_0x569547[_0xcdb9('0x1d')]+_0x569547[_0xcdb9('0x1e')];var _0x535962;if(_0x8c4a6d>=_0x1501be){_0x8c4a6d=_0x1501be;_0x535962=0xc8;}else{_0x535962=0xce;}_0x3b767b['status'](_0x535962);return _0x3b767b[_0xcdb9('0x21')](_0xcdb9('0x22'),_0x1475ba+'-'+_0x8c4a6d+'/'+_0x1501be)['json'](_0x3a2f09);}return null;};}function patchUpdates(_0x976ff1){return function(_0x4d7dba){try{jsonpatch[_0xcdb9('0x23')](_0x4d7dba,_0x976ff1,!![]);}catch(_0x2452d0){return BPromise[_0xcdb9('0x24')](_0x2452d0);}return _0x4d7dba['save']();};}function saveUpdates(_0x65841,_0x15ed90){return function(_0x539305){if(_0x539305){return _0x539305[_0xcdb9('0x25')](_0x65841)[_0xcdb9('0x26')](function(_0x2b3eca){return _0x2b3eca;});}return null;};}function removeEntity(_0x37fff1,_0x1cc606){return function(_0x1db345){if(_0x1db345){return _0x1db345[_0xcdb9('0x27')]()[_0xcdb9('0x26')](function(){var _0x4db3b0=_0x1db345['get']({'plain':!![]});var _0x45139e=_0xcdb9('0x28');return db[_0xcdb9('0x29')][_0xcdb9('0x27')]({'where':{'type':_0x45139e,'resourceId':_0x4db3b0['id']}})['then'](function(){return _0x1db345;});})['then'](function(){_0x37fff1['status'](0xcc)[_0xcdb9('0x1b')]();});}};}function handleEntityNotFound(_0x1d2ef2,_0x2cad92){return function(_0x357cd1){if(!_0x357cd1){_0x1d2ef2[_0xcdb9('0x19')](0x194);}return _0x357cd1;};}function handleError(_0x1dcb43,_0x1b5a74){_0x1b5a74=_0x1b5a74||0x1f4;return function(_0x3299a7){logger[_0xcdb9('0x2a')](_0x3299a7[_0xcdb9('0x2b')]);if(_0x3299a7['name']){delete _0x3299a7[_0xcdb9('0x2c')];}_0x1dcb43[_0xcdb9('0x1a')](_0x1b5a74)['send'](_0x3299a7);};}exports[_0xcdb9('0x2d')]=function(_0xf52c57,_0x53698f){var _0x348fb4={},_0x4828cf={},_0x2e3b10={'count':0x0,'rows':[]};var _0x5e0562=_[_0xcdb9('0x2e')](db[_0xcdb9('0x2f')]['rawAttributes'],function(_0x312784){return{'name':_0x312784[_0xcdb9('0x30')],'type':_0x312784[_0xcdb9('0x31')][_0xcdb9('0x32')]};});_0x4828cf['model']=_[_0xcdb9('0x2e')](_0x5e0562,_0xcdb9('0x2c'));_0x4828cf[_0xcdb9('0x33')]=_[_0xcdb9('0x34')](_0xf52c57[_0xcdb9('0x33')]);_0x4828cf['filters']=_[_0xcdb9('0x35')](_0x4828cf[_0xcdb9('0x36')],_0x4828cf['query']);_0x348fb4[_0xcdb9('0x37')]=_[_0xcdb9('0x35')](_0x4828cf[_0xcdb9('0x36')],qs[_0xcdb9('0x38')](_0xf52c57['query'][_0xcdb9('0x38')]));_0x348fb4[_0xcdb9('0x37')]=_0x348fb4[_0xcdb9('0x37')][_0xcdb9('0x39')]?_0x348fb4[_0xcdb9('0x37')]:_0x4828cf[_0xcdb9('0x36')];if(!_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x3a')](_0xcdb9('0x3b'))){_0x348fb4[_0xcdb9('0x1e')]=qs[_0xcdb9('0x1e')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x1e')]);_0x348fb4['offset']=qs[_0xcdb9('0x1d')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x1d')]);}_0x348fb4[_0xcdb9('0x3c')]=qs[_0xcdb9('0x3d')](_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x3d')]);_0x348fb4['where']=qs[_0xcdb9('0x3e')](_[_0xcdb9('0x3f')](_0xf52c57[_0xcdb9('0x33')],_0x4828cf[_0xcdb9('0x3e')]),_0x5e0562);if(_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x40')]){_0x348fb4[_0xcdb9('0x41')]=_[_0xcdb9('0x42')](_0x348fb4[_0xcdb9('0x41')],{'$or':_[_0xcdb9('0x2e')](_0x5e0562,function(_0x1ebc1e){if(_0x1ebc1e['type']!==_0xcdb9('0x43')){var _0x1ed6d9={};_0x1ed6d9[_0x1ebc1e[_0xcdb9('0x2c')]]={'$like':'%'+_0xf52c57[_0xcdb9('0x33')]['filter']+'%'};return _0x1ed6d9;}})});}_0x348fb4=_[_0xcdb9('0x42')]({},_0x348fb4,_0xf52c57[_0xcdb9('0x44')]);var _0x312592={'where':_0x348fb4[_0xcdb9('0x41')]};return db[_0xcdb9('0x2f')][_0xcdb9('0x20')](_0x312592)[_0xcdb9('0x26')](function(_0x4402b0){_0x2e3b10[_0xcdb9('0x20')]=_0x4402b0;if(_0xf52c57[_0xcdb9('0x33')][_0xcdb9('0x45')]){_0x348fb4[_0xcdb9('0x46')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x348fb4);})[_0xcdb9('0x26')](function(_0x27c6e1){_0x2e3b10[_0xcdb9('0x47')]=_0x27c6e1;return _0x2e3b10;})[_0xcdb9('0x26')](respondWithFilteredResult(_0x53698f,_0x348fb4))['catch'](handleError(_0x53698f,null));};exports['show']=function(_0x20c3f2,_0x46b57c){var _0x45988d={'raw':!![],'where':{'id':_0x20c3f2[_0xcdb9('0x48')]['id']}},_0x55e7b8={};_0x55e7b8[_0xcdb9('0x36')]=_[_0xcdb9('0x34')](db[_0xcdb9('0x2f')][_0xcdb9('0x49')]);_0x55e7b8['query']=_[_0xcdb9('0x34')](_0x20c3f2['query']);_0x55e7b8['filters']=_[_0xcdb9('0x35')](_0x55e7b8[_0xcdb9('0x36')],_0x55e7b8[_0xcdb9('0x33')]);_0x45988d[_0xcdb9('0x37')]=_[_0xcdb9('0x35')](_0x55e7b8[_0xcdb9('0x36')],qs[_0xcdb9('0x38')](_0x20c3f2[_0xcdb9('0x33')][_0xcdb9('0x38')]));_0x45988d[_0xcdb9('0x37')]=_0x45988d[_0xcdb9('0x37')][_0xcdb9('0x39')]?_0x45988d[_0xcdb9('0x37')]:_0x55e7b8[_0xcdb9('0x36')];if(_0x20c3f2[_0xcdb9('0x33')]['includeAll']){_0x45988d['include']=[{'all':!![]}];}_0x45988d=_[_0xcdb9('0x42')]({},_0x45988d,_0x20c3f2[_0xcdb9('0x44')]);return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')](_0x45988d)['then'](handleEntityNotFound(_0x46b57c,null))[_0xcdb9('0x26')](respondWithResult(_0x46b57c,null))['catch'](handleError(_0x46b57c,null));};exports['create']=function(_0x3961da,_0x18498c){return db[_0xcdb9('0x2f')]['create'](_0x3961da['body'],{})['then'](function(_0x37073c){var _0x24d878=_0x3961da[_0xcdb9('0x4b')][_0xcdb9('0x4c')]({'plain':!![]});if(!_0x24d878)throw new Error(_0xcdb9('0x4d'));if(_0x24d878[_0xcdb9('0x4e')]===_0xcdb9('0x4b')){var _0x1b1e55=_0x37073c['get']({'plain':!![]});var _0xe8fa48=_0xcdb9('0x28');return db[_0xcdb9('0x4f')]['find']({'where':{'name':_0xe8fa48,'userProfileId':_0x24d878['userProfileId']},'raw':!![]})['then'](function(_0x1ea6c7){if(_0x1ea6c7&&_0x1ea6c7[_0xcdb9('0x50')]===0x0){return db['UserProfileResource'][_0xcdb9('0x51')]({'name':_0x1b1e55['name'],'resourceId':_0x1b1e55['id'],'type':_0x1ea6c7[_0xcdb9('0x2c')],'sectionId':_0x1ea6c7['id']},{})[_0xcdb9('0x26')](function(){return _0x37073c;});}else{return _0x37073c;}})['catch'](function(_0xe1a0e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe1a0e1);throw _0xe1a0e1;});}return _0x37073c;})[_0xcdb9('0x26')](respondWithResult(_0x18498c,0xc9))[_0xcdb9('0x52')](handleError(_0x18498c,null));};exports[_0xcdb9('0x25')]=function(_0xd5b8f6,_0x1ce559){if(_0xd5b8f6[_0xcdb9('0x53')]['id']){delete _0xd5b8f6[_0xcdb9('0x53')]['id'];}return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')]({'where':{'id':_0xd5b8f6[_0xcdb9('0x48')]['id']}})[_0xcdb9('0x26')](handleEntityNotFound(_0x1ce559,null))[_0xcdb9('0x26')](saveUpdates(_0xd5b8f6[_0xcdb9('0x53')],null))['then'](respondWithResult(_0x1ce559,null))[_0xcdb9('0x52')](handleError(_0x1ce559,null));};exports['destroy']=function(_0xe335c5,_0x4aad5e){return db[_0xcdb9('0x2f')][_0xcdb9('0x4a')]({'where':{'id':_0xe335c5[_0xcdb9('0x48')]['id']}})[_0xcdb9('0x26')](handleEntityNotFound(_0x4aad5e,null))[_0xcdb9('0x26')](removeEntity(_0x4aad5e,null))['catch'](handleError(_0x4aad5e,null));};exports[_0xcdb9('0x54')]=function(_0x23a486,_0x1d5f46,_0x4006c2){var _0x4ee9df;return db[_0xcdb9('0x2f')]['find']({'where':{'id':_0x23a486[_0xcdb9('0x48')]['id']},'attributes':['id',_0xcdb9('0x55')]})['then'](handleEntityNotFound(_0x1d5f46,null))[_0xcdb9('0x26')](function(_0xcb90aa){if(_0xcb90aa){var _0x106579=require('odbc')();_0x106579[_0xcdb9('0x56')](_0xcb90aa[_0xcdb9('0x55')]);_0x106579[_0xcdb9('0x57')]();return _0xcb90aa;}})[_0xcdb9('0x26')](respondWithResult(_0x1d5f46,null))[_0xcdb9('0x52')](handleError(_0x1d5f46,null));}; \ No newline at end of file +var _0x9fbe=['include','rows','catch','show','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','odbc','closeSync','eml-format','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','index','SquareOdbc','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll'];(function(_0x158347,_0x20d159){var _0x408235=function(_0x13e233){while(--_0x13e233){_0x158347['push'](_0x158347['shift']());}};_0x408235(++_0x20d159);}(_0x9fbe,0x15c));var _0xe9fb=function(_0x5831a3,_0x4463b7){_0x5831a3=_0x5831a3-0x0;var _0x198912=_0x9fbe[_0x5831a3];return _0x198912;};'use strict';var emlformat=require(_0xe9fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe9fb('0x1'));var moment=require('moment');var BPromise=require(_0xe9fb('0x2'));var Mustache=require('mustache');var util=require(_0xe9fb('0x3'));var path=require(_0xe9fb('0x4'));var sox=require(_0xe9fb('0x5'));var csv=require(_0xe9fb('0x6'));var ejs=require(_0xe9fb('0x7'));var fs=require('fs');var fs_extra=require(_0xe9fb('0x8'));var _=require(_0xe9fb('0x9'));var squel=require(_0xe9fb('0xa'));var crypto=require(_0xe9fb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe9fb('0x6'));var querystring=require('querystring');var Papa=require(_0xe9fb('0xc'));var Redis=require(_0xe9fb('0xd'));var authService=require(_0xe9fb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe9fb('0xf'));var hardwareService=require(_0xe9fb('0x10'));var logger=require(_0xe9fb('0x11'))(_0xe9fb('0x12'));var utils=require(_0xe9fb('0x13'));var config=require(_0xe9fb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9fb('0x15'))['db'];function respondWithStatusCode(_0x562056,_0x59d167){_0x59d167=_0x59d167||0xcc;return function(_0x39c472){if(_0x39c472){return _0x562056[_0xe9fb('0x16')](_0x59d167);}return _0x562056['status'](_0x59d167)['end']();};}function respondWithResult(_0x1500e7,_0x56698f){_0x56698f=_0x56698f||0xc8;return function(_0x1f1d4d){if(_0x1f1d4d){return _0x1500e7[_0xe9fb('0x17')](_0x56698f)[_0xe9fb('0x18')](_0x1f1d4d);}};}function respondWithFilteredResult(_0x64f92a,_0x427943){return function(_0x32287d){if(_0x32287d){var _0x1a0997=typeof _0x427943[_0xe9fb('0x19')]===_0xe9fb('0x1a')&&typeof _0x427943[_0xe9fb('0x1b')]===_0xe9fb('0x1a');var _0x3d14ba=_0x32287d[_0xe9fb('0x1c')];var _0x4f14f4=_0x1a0997?0x0:_0x427943['offset'];var _0x10281d=_0x1a0997?_0x32287d[_0xe9fb('0x1c')]:_0x427943[_0xe9fb('0x19')]+_0x427943[_0xe9fb('0x1b')];var _0x243f0c;if(_0x10281d>=_0x3d14ba){_0x10281d=_0x3d14ba;_0x243f0c=0xc8;}else{_0x243f0c=0xce;}_0x64f92a[_0xe9fb('0x17')](_0x243f0c);return _0x64f92a['set'](_0xe9fb('0x1d'),_0x4f14f4+'-'+_0x10281d+'/'+_0x3d14ba)[_0xe9fb('0x18')](_0x32287d);}return null;};}function patchUpdates(_0x14285c){return function(_0xe985ff){try{jsonpatch[_0xe9fb('0x1e')](_0xe985ff,_0x14285c,!![]);}catch(_0x13f1b0){return BPromise['reject'](_0x13f1b0);}return _0xe985ff[_0xe9fb('0x1f')]();};}function saveUpdates(_0x57332b,_0x273286){return function(_0x143fd5){if(_0x143fd5){return _0x143fd5[_0xe9fb('0x20')](_0x57332b)[_0xe9fb('0x21')](function(_0x2a4faf){return _0x2a4faf;});}return null;};}function removeEntity(_0x512e6c,_0x507922){return function(_0x315d7e){if(_0x315d7e){return _0x315d7e[_0xe9fb('0x22')]()[_0xe9fb('0x21')](function(){var _0x473e48=_0x315d7e[_0xe9fb('0x23')]({'plain':!![]});var _0x482f77=_0xe9fb('0x24');return db[_0xe9fb('0x25')][_0xe9fb('0x22')]({'where':{'type':_0x482f77,'resourceId':_0x473e48['id']}})[_0xe9fb('0x21')](function(){return _0x315d7e;});})['then'](function(){_0x512e6c['status'](0xcc)[_0xe9fb('0x26')]();});}};}function handleEntityNotFound(_0x356363,_0x3ec520){return function(_0x3b94e0){if(!_0x3b94e0){_0x356363[_0xe9fb('0x16')](0x194);}return _0x3b94e0;};}function handleError(_0x4f4272,_0x4ddb51){_0x4ddb51=_0x4ddb51||0x1f4;return function(_0x3aedad){logger[_0xe9fb('0x27')](_0x3aedad[_0xe9fb('0x28')]);if(_0x3aedad[_0xe9fb('0x29')]){delete _0x3aedad[_0xe9fb('0x29')];}_0x4f4272[_0xe9fb('0x17')](_0x4ddb51)['send'](_0x3aedad);};}exports[_0xe9fb('0x2a')]=function(_0x2b5b4a,_0x15b0e3){var _0x24650d={},_0x2ab5f5={},_0x58d21e={'count':0x0,'rows':[]};var _0x5a3233=_['map'](db[_0xe9fb('0x2b')][_0xe9fb('0x2c')],function(_0x4c77b4){return{'name':_0x4c77b4[_0xe9fb('0x2d')],'type':_0x4c77b4[_0xe9fb('0x2e')][_0xe9fb('0x2f')]};});_0x2ab5f5['model']=_[_0xe9fb('0x30')](_0x5a3233,'name');_0x2ab5f5['query']=_['keys'](_0x2b5b4a['query']);_0x2ab5f5[_0xe9fb('0x31')]=_[_0xe9fb('0x32')](_0x2ab5f5[_0xe9fb('0x33')],_0x2ab5f5[_0xe9fb('0x34')]);_0x24650d['attributes']=_[_0xe9fb('0x32')](_0x2ab5f5['model'],qs[_0xe9fb('0x35')](_0x2b5b4a['query']['fields']));_0x24650d['attributes']=_0x24650d['attributes'][_0xe9fb('0x36')]?_0x24650d[_0xe9fb('0x37')]:_0x2ab5f5[_0xe9fb('0x33')];if(!_0x2b5b4a[_0xe9fb('0x34')][_0xe9fb('0x38')](_0xe9fb('0x39'))){_0x24650d[_0xe9fb('0x1b')]=qs[_0xe9fb('0x1b')](_0x2b5b4a[_0xe9fb('0x34')][_0xe9fb('0x1b')]);_0x24650d[_0xe9fb('0x19')]=qs[_0xe9fb('0x19')](_0x2b5b4a['query'][_0xe9fb('0x19')]);}_0x24650d[_0xe9fb('0x3a')]=qs[_0xe9fb('0x3b')](_0x2b5b4a[_0xe9fb('0x34')]['sort']);_0x24650d[_0xe9fb('0x3c')]=qs[_0xe9fb('0x31')](_[_0xe9fb('0x3d')](_0x2b5b4a['query'],_0x2ab5f5[_0xe9fb('0x31')]),_0x5a3233);if(_0x2b5b4a[_0xe9fb('0x34')]['filter']){_0x24650d['where']=_[_0xe9fb('0x3e')](_0x24650d['where'],{'$or':_[_0xe9fb('0x30')](_0x5a3233,function(_0x27bfde){if(_0x27bfde[_0xe9fb('0x2e')]!==_0xe9fb('0x3f')){var _0x4c7f95={};_0x4c7f95[_0x27bfde[_0xe9fb('0x29')]]={'$like':'%'+_0x2b5b4a[_0xe9fb('0x34')][_0xe9fb('0x40')]+'%'};return _0x4c7f95;}})});}_0x24650d=_[_0xe9fb('0x3e')]({},_0x24650d,_0x2b5b4a[_0xe9fb('0x41')]);var _0x5448d8={'where':_0x24650d[_0xe9fb('0x3c')]};return db['SquareOdbc'][_0xe9fb('0x1c')](_0x5448d8)['then'](function(_0x4f65ce){_0x58d21e[_0xe9fb('0x1c')]=_0x4f65ce;if(_0x2b5b4a[_0xe9fb('0x34')][_0xe9fb('0x42')]){_0x24650d[_0xe9fb('0x43')]=[{'all':!![]}];}return db[_0xe9fb('0x2b')]['findAll'](_0x24650d);})[_0xe9fb('0x21')](function(_0x396280){_0x58d21e[_0xe9fb('0x44')]=_0x396280;return _0x58d21e;})[_0xe9fb('0x21')](respondWithFilteredResult(_0x15b0e3,_0x24650d))[_0xe9fb('0x45')](handleError(_0x15b0e3,null));};exports[_0xe9fb('0x46')]=function(_0x5631e8,_0x3fd42f){var _0x10bb0f={'raw':!![],'where':{'id':_0x5631e8['params']['id']}},_0x2d4bd3={};_0x2d4bd3[_0xe9fb('0x33')]=_[_0xe9fb('0x47')](db[_0xe9fb('0x2b')]['rawAttributes']);_0x2d4bd3[_0xe9fb('0x34')]=_[_0xe9fb('0x47')](_0x5631e8['query']);_0x2d4bd3['filters']=_[_0xe9fb('0x32')](_0x2d4bd3[_0xe9fb('0x33')],_0x2d4bd3[_0xe9fb('0x34')]);_0x10bb0f[_0xe9fb('0x37')]=_[_0xe9fb('0x32')](_0x2d4bd3[_0xe9fb('0x33')],qs['fields'](_0x5631e8[_0xe9fb('0x34')]['fields']));_0x10bb0f['attributes']=_0x10bb0f['attributes'][_0xe9fb('0x36')]?_0x10bb0f['attributes']:_0x2d4bd3[_0xe9fb('0x33')];if(_0x5631e8[_0xe9fb('0x34')][_0xe9fb('0x42')]){_0x10bb0f[_0xe9fb('0x43')]=[{'all':!![]}];}_0x10bb0f=_[_0xe9fb('0x3e')]({},_0x10bb0f,_0x5631e8[_0xe9fb('0x41')]);return db['SquareOdbc']['find'](_0x10bb0f)['then'](handleEntityNotFound(_0x3fd42f,null))[_0xe9fb('0x21')](respondWithResult(_0x3fd42f,null))['catch'](handleError(_0x3fd42f,null));};exports['create']=function(_0x41cc90,_0x97bfd7){return db[_0xe9fb('0x2b')][_0xe9fb('0x48')](_0x41cc90[_0xe9fb('0x49')],{})['then'](function(_0x3e429b){var _0x2a2333=_0x41cc90['user'][_0xe9fb('0x23')]({'plain':!![]});if(!_0x2a2333)throw new Error(_0xe9fb('0x4a'));if(_0x2a2333[_0xe9fb('0x4b')]===_0xe9fb('0x4c')){var _0x3ec1da=_0x3e429b['get']({'plain':!![]});var _0x1ad80f='ODBC';return db[_0xe9fb('0x4d')][_0xe9fb('0x4e')]({'where':{'name':_0x1ad80f,'userProfileId':_0x2a2333['userProfileId']},'raw':!![]})[_0xe9fb('0x21')](function(_0x10d9c2){if(_0x10d9c2&&_0x10d9c2['autoAssociation']===0x0){return db[_0xe9fb('0x25')]['create']({'name':_0x3ec1da['name'],'resourceId':_0x3ec1da['id'],'type':_0x10d9c2[_0xe9fb('0x29')],'sectionId':_0x10d9c2['id']},{})['then'](function(){return _0x3e429b;});}else{return _0x3e429b;}})[_0xe9fb('0x45')](function(_0x490c92){logger[_0xe9fb('0x27')](_0xe9fb('0x4f'),_0x490c92);throw _0x490c92;});}return _0x3e429b;})[_0xe9fb('0x21')](respondWithResult(_0x97bfd7,0xc9))[_0xe9fb('0x45')](handleError(_0x97bfd7,null));};exports[_0xe9fb('0x20')]=function(_0x5aa542,_0x4d5bc2){if(_0x5aa542[_0xe9fb('0x49')]['id']){delete _0x5aa542[_0xe9fb('0x49')]['id'];}return db['SquareOdbc'][_0xe9fb('0x4e')]({'where':{'id':_0x5aa542['params']['id']}})['then'](handleEntityNotFound(_0x4d5bc2,null))['then'](saveUpdates(_0x5aa542[_0xe9fb('0x49')],null))[_0xe9fb('0x21')](respondWithResult(_0x4d5bc2,null))[_0xe9fb('0x45')](handleError(_0x4d5bc2,null));};exports['destroy']=function(_0x56c697,_0x336877){return db[_0xe9fb('0x2b')][_0xe9fb('0x4e')]({'where':{'id':_0x56c697['params']['id']}})[_0xe9fb('0x21')](handleEntityNotFound(_0x336877,null))[_0xe9fb('0x21')](removeEntity(_0x336877,null))[_0xe9fb('0x45')](handleError(_0x336877,null));};exports['test']=function(_0x1d7ce7,_0xd21017,_0x469365){var _0xd3d433;return db['SquareOdbc'][_0xe9fb('0x4e')]({'where':{'id':_0x1d7ce7[_0xe9fb('0x50')]['id']},'attributes':['id','dsn']})[_0xe9fb('0x21')](handleEntityNotFound(_0xd21017,null))[_0xe9fb('0x21')](function(_0x2afe4f){if(_0x2afe4f){var _0xe82082=require(_0xe9fb('0x51'))();_0xe82082['openSync'](_0x2afe4f['dsn']);_0xe82082[_0xe9fb('0x52')]();return _0x2afe4f;}})['then'](respondWithResult(_0xd21017,null))['catch'](handleError(_0xd21017,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index ff60bef..12e8567 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 _0xc897=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','lodash','util'];(function(_0x4f152a,_0x1888f5){var _0x41552f=function(_0x10596b){while(--_0x10596b){_0x4f152a['push'](_0x4f152a['shift']());}};_0x41552f(++_0x1888f5);}(_0xc897,0xc1));var _0x7c89=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc897[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x7c89('0x0'));var util=require(_0x7c89('0x1'));var logger=require(_0x7c89('0x2'))(_0x7c89('0x3'));var moment=require(_0x7c89('0x4'));var BPromise=require(_0x7c89('0x5'));var rp=require(_0x7c89('0x6'));var fs=require('fs');var path=require(_0x7c89('0x7'));var rimraf=require(_0x7c89('0x8'));var config=require('../../config/environment');var attributes=require(_0x7c89('0x9'));module[_0x7c89('0xa')]=function(_0x5bff64,_0xa3acd7){return _0x5bff64[_0x7c89('0xb')](_0x7c89('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x012a=['path','../../config/environment','./squareOdbc.attributes','SquareOdbc','square_odbc','util','api','moment','bluebird','request-promise'];(function(_0x32f2d9,_0x547052){var _0x117ad6=function(_0x1027c5){while(--_0x1027c5){_0x32f2d9['push'](_0x32f2d9['shift']());}};_0x117ad6(++_0x547052);}(_0x012a,0x159));var _0xa012=function(_0x48c1d2,_0x48b40){_0x48c1d2=_0x48c1d2-0x0;var _0x167819=_0x012a[_0x48c1d2];return _0x167819;};'use strict';var _=require('lodash');var util=require(_0xa012('0x0'));var logger=require('../../config/logger')(_0xa012('0x1'));var moment=require(_0xa012('0x2'));var BPromise=require(_0xa012('0x3'));var rp=require(_0xa012('0x4'));var fs=require('fs');var path=require(_0xa012('0x5'));var rimraf=require('rimraf');var config=require(_0xa012('0x6'));var attributes=require(_0xa012('0x7'));module['exports']=function(_0x39998a,_0x1a1c99){return _0x39998a['define'](_0xa012('0x8'),attributes,{'tableName':_0xa012('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 113cbd3..89840dd 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 _0x42c5=['../../config/logger','request','then','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','options','raw','where','include','model','attributes','map','catch','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x514aa1,_0x189c7a){var _0x5375aa=function(_0x3ed9d2){while(--_0x3ed9d2){_0x514aa1['push'](_0x514aa1['shift']());}};_0x5375aa(++_0x189c7a);}(_0x42c5,0x1c8));var _0x542c=function(_0x18b87b,_0x5e5757){_0x18b87b=_0x18b87b-0x0;var _0x53195a=_0x42c5[_0x18b87b];return _0x53195a;};'use strict';var _=require(_0x542c('0x0'));var util=require(_0x542c('0x1'));var moment=require(_0x542c('0x2'));var BPromise=require(_0x542c('0x3'));var rs=require(_0x542c('0x4'));var fs=require('fs');var Redis=require(_0x542c('0x5'));var db=require(_0x542c('0x6'))['db'];var utils=require(_0x542c('0x7'));var logger=require(_0x542c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x170baf,_0x1707dd,_0x3817be){return new BPromise(function(_0x4bb498,_0xe13145){return client[_0x542c('0x9')](_0x170baf,_0x3817be)[_0x542c('0xa')](function(_0x3ec98c){logger['info'](_0x542c('0xb'),_0x1707dd,'request\x20sent');logger[_0x542c('0xc')](_0x542c('0xd'),_0x1707dd,_0x542c('0xe'),JSON[_0x542c('0xf')](_0x3ec98c));if(_0x3ec98c['error']){if(_0x3ec98c[_0x542c('0x10')][_0x542c('0x11')]===0x1f4){logger[_0x542c('0x10')](_0x542c('0xb'),_0x1707dd,_0x3ec98c[_0x542c('0x10')][_0x542c('0x12')]);return _0xe13145(_0x3ec98c['error']['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1707dd,_0x3ec98c['error'][_0x542c('0x12')]);return _0x4bb498(_0x3ec98c[_0x542c('0x10')][_0x542c('0x12')]);}else{logger[_0x542c('0x13')](_0x542c('0xb'),_0x1707dd,_0x542c('0xe'));_0x4bb498(_0x3ec98c['result'][_0x542c('0x12')]);}})['catch'](function(_0xaf42b5){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1707dd,_0xaf42b5);_0xe13145(_0xaf42b5);});});}exports['ShowSquareOdbc']=function(_0x3b602b){var _0x3c99fb=this;return new Promise(function(_0x5722d4,_0x2cac4b){return db['SquareOdbc']['find']({'raw':_0x3b602b['options']?_0x3b602b[_0x542c('0x14')][_0x542c('0x15')]===undefined?!![]:![]:!![],'where':_0x3b602b[_0x542c('0x14')]?_0x3b602b['options'][_0x542c('0x16')]||null:null,'attributes':_0x3b602b[_0x542c('0x14')]?_0x3b602b[_0x542c('0x14')]['attributes']||null:null,'include':_0x3b602b[_0x542c('0x14')]?_0x3b602b[_0x542c('0x14')][_0x542c('0x17')]?_['map'](_0x3b602b[_0x542c('0x14')][_0x542c('0x17')],function(_0xa75f3e){return{'model':db[_0xa75f3e[_0x542c('0x18')]],'as':_0xa75f3e['as'],'attributes':_0xa75f3e['attributes'],'include':_0xa75f3e[_0x542c('0x17')]?_['map'](_0xa75f3e['include'],function(_0x209a10){return{'model':db[_0x209a10[_0x542c('0x18')]],'as':_0x209a10['as'],'attributes':_0x209a10[_0x542c('0x19')],'include':_0x209a10[_0x542c('0x17')]?_[_0x542c('0x1a')](_0x209a10['include'],function(_0x23b4b0){return{'model':db[_0x23b4b0['model']],'as':_0x23b4b0['as'],'attributes':_0x23b4b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x542c('0xa')](function(_0x2a3d41){logger[_0x542c('0x13')]('ShowSquareOdbc',_0x3b602b);logger[_0x542c('0xc')]('ShowSquareOdbc',_0x3b602b,JSON['stringify'](_0x2a3d41));_0x5722d4(_0x2a3d41);})[_0x542c('0x1b')](function(_0x1cd14c){logger['error'](_0x542c('0x1c'),_0x1cd14c['message'],_0x3b602b);_0x2cac4b(_0x3c99fb['error'](0x1f4,_0x1cd14c[_0x542c('0x12')]));});});}; \ No newline at end of file +var _0x0b4e=['attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model'];(function(_0x36e3ba,_0x1912e8){var _0x7972c7=function(_0x52e712){while(--_0x52e712){_0x36e3ba['push'](_0x36e3ba['shift']());}};_0x7972c7(++_0x1912e8);}(_0x0b4e,0xbc));var _0xe0b4=function(_0x41576a,_0x4d4638){_0x41576a=_0x41576a-0x0;var _0x751333=_0x0b4e[_0x41576a];return _0x751333;};'use strict';var _=require(_0xe0b4('0x0'));var util=require(_0xe0b4('0x1'));var moment=require(_0xe0b4('0x2'));var BPromise=require(_0xe0b4('0x3'));var rs=require(_0xe0b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0b4('0x5'))['db'];var utils=require(_0xe0b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe0b4('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x595d7f,_0x4fc98f,_0x3f7d91){return new BPromise(function(_0x19de34,_0x45c9b5){return client[_0xe0b4('0x8')](_0x595d7f,_0x3f7d91)[_0xe0b4('0x9')](function(_0x479b59){logger[_0xe0b4('0xa')](_0xe0b4('0xb'),_0x4fc98f,_0xe0b4('0xc'));logger[_0xe0b4('0xd')](_0xe0b4('0xe'),_0x4fc98f,'request\x20sent',JSON[_0xe0b4('0xf')](_0x479b59));if(_0x479b59['error']){if(_0x479b59[_0xe0b4('0x10')][_0xe0b4('0x11')]===0x1f4){logger[_0xe0b4('0x10')](_0xe0b4('0xb'),_0x4fc98f,_0x479b59['error']['message']);return _0x45c9b5(_0x479b59[_0xe0b4('0x10')][_0xe0b4('0x12')]);}logger[_0xe0b4('0x10')](_0xe0b4('0xb'),_0x4fc98f,_0x479b59[_0xe0b4('0x10')]['message']);return _0x19de34(_0x479b59['error'][_0xe0b4('0x12')]);}else{logger[_0xe0b4('0xa')]('SquareOdbc,\x20%s,\x20%s',_0x4fc98f,'request\x20sent');_0x19de34(_0x479b59[_0xe0b4('0x13')][_0xe0b4('0x12')]);}})['catch'](function(_0x23b244){logger[_0xe0b4('0x10')](_0xe0b4('0xb'),_0x4fc98f,_0x23b244);_0x45c9b5(_0x23b244);});});}exports[_0xe0b4('0x14')]=function(_0x26d455){var _0x540124=this;return new Promise(function(_0x577e1d,_0x500da8){return db[_0xe0b4('0x15')][_0xe0b4('0x16')]({'raw':_0x26d455['options']?_0x26d455[_0xe0b4('0x17')][_0xe0b4('0x18')]===undefined?!![]:![]:!![],'where':_0x26d455['options']?_0x26d455['options'][_0xe0b4('0x19')]||null:null,'attributes':_0x26d455[_0xe0b4('0x17')]?_0x26d455['options']['attributes']||null:null,'include':_0x26d455[_0xe0b4('0x17')]?_0x26d455[_0xe0b4('0x17')][_0xe0b4('0x1a')]?_[_0xe0b4('0x1b')](_0x26d455['options']['include'],function(_0x3b5333){return{'model':db[_0x3b5333[_0xe0b4('0x1c')]],'as':_0x3b5333['as'],'attributes':_0x3b5333[_0xe0b4('0x1d')],'include':_0x3b5333[_0xe0b4('0x1a')]?_[_0xe0b4('0x1b')](_0x3b5333[_0xe0b4('0x1a')],function(_0x1dea18){return{'model':db[_0x1dea18['model']],'as':_0x1dea18['as'],'attributes':_0x1dea18['attributes'],'include':_0x1dea18[_0xe0b4('0x1a')]?_['map'](_0x1dea18[_0xe0b4('0x1a')],function(_0x10a49c){return{'model':db[_0x10a49c[_0xe0b4('0x1c')]],'as':_0x10a49c['as'],'attributes':_0x10a49c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e2129){logger['info'](_0xe0b4('0x14'),_0x26d455);logger[_0xe0b4('0xd')]('ShowSquareOdbc',_0x26d455,JSON[_0xe0b4('0xf')](_0x1e2129));_0x577e1d(_0x1e2129);})[_0xe0b4('0x1e')](function(_0x54f29d){logger[_0xe0b4('0x10')]('ShowSquareOdbc',_0x54f29d[_0xe0b4('0x12')],_0x26d455);_0x500da8(_0x540124[_0xe0b4('0x10')](0x1f4,_0x54f29d[_0xe0b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 156bab4..d530ec3 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 _0x534f=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','multer'];(function(_0x3c3684,_0x3ce718){var _0x1dbe6a=function(_0x439c10){while(--_0x439c10){_0x3c3684['push'](_0x3c3684['shift']());}};_0x1dbe6a(++_0x3ce718);}(_0x534f,0xed));var _0xf534=function(_0x3d3592,_0x5c19ad){_0x3d3592=_0x3d3592-0x0;var _0xd0652d=_0x534f[_0x3d3592];return _0xd0652d;};'use strict';var multer=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var path=require(_0xf534('0x2'));var timeout=require(_0xf534('0x3'));var express=require(_0xf534('0x4'));var router=express['Router']();var fs_extra=require(_0xf534('0x5'));var auth=require(_0xf534('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf534('0x7'));var controller=require(_0xf534('0x8'));router[_0xf534('0x9')]('/',auth[_0xf534('0xa')](),controller['index']);router[_0xf534('0x9')](_0xf534('0xb'),auth[_0xf534('0xa')](),controller['show']);router[_0xf534('0xc')]('/',auth[_0xf534('0xa')](),controller[_0xf534('0xd')]);router[_0xf534('0xe')](_0xf534('0xb'),auth[_0xf534('0xa')](),controller[_0xf534('0xf')]);router['delete'](_0xf534('0xb'),auth['isAuthenticated'](),controller[_0xf534('0x10')]);module['exports']=router; \ No newline at end of file +var _0x413d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x413d,0x1d5));var _0xd413=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x413d[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xd413('0x0'));var util=require(_0xd413('0x1'));var path=require(_0xd413('0x2'));var timeout=require(_0xd413('0x3'));var express=require(_0xd413('0x4'));var router=express[_0xd413('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd413('0x6'));var interaction=require(_0xd413('0x7'));var config=require(_0xd413('0x8'));var controller=require(_0xd413('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd413('0xa')]);router[_0xd413('0xb')](_0xd413('0xc'),auth[_0xd413('0xd')](),controller[_0xd413('0xe')]);router[_0xd413('0xf')]('/',auth[_0xd413('0xd')](),controller['create']);router['put'](_0xd413('0xc'),auth[_0xd413('0xd')](),controller[_0xd413('0x10')]);router['delete'](_0xd413('0xc'),auth['isAuthenticated'](),controller[_0xd413('0x11')]);module[_0xd413('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3bb2c66..19bee38 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 _0xf935=['BLOB','production','DATE','sequelize','exports','STRING','name','TEXT','long','preproduction','toString','utf8'];(function(_0x3ccc44,_0x207b0c){var _0x5d74bb=function(_0x59989a){while(--_0x59989a){_0x3ccc44['push'](_0x3ccc44['shift']());}};_0x5d74bb(++_0x207b0c);}(_0xf935,0x1ef));var _0x5f93=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf935[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5f93('0x0'));module[_0x5f93('0x1')]={'name':{'type':Sequelize[_0x5f93('0x2')],'unique':_0x5f93('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5f93('0x2')]},'notes':{'type':Sequelize[_0x5f93('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x5f93('0x5')),'get':function(){if(this['getDataValue'](_0x5f93('0x6'))){return this['getDataValue'](_0x5f93('0x6'))[_0x5f93('0x7')](_0x5f93('0x8'));}}},'production':{'type':Sequelize[_0x5f93('0x9')](_0x5f93('0x5')),'get':function(){if(this['getDataValue'](_0x5f93('0xa'))){return this['getDataValue']('production')[_0x5f93('0x7')](_0x5f93('0x8'));}}},'savedAt':{'type':Sequelize[_0x5f93('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb181=['getDataValue','preproduction','toString','long','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB'];(function(_0x1cbd58,_0x1c4804){var _0x52e382=function(_0x2d4586){while(--_0x2d4586){_0x1cbd58['push'](_0x1cbd58['shift']());}};_0x52e382(++_0x1c4804);}(_0xb181,0xc6));var _0x1b18=function(_0x3d9ad8,_0x1877a3){_0x3d9ad8=_0x3d9ad8-0x0;var _0xbfe331=_0xb181[_0x3d9ad8];return _0xbfe331;};'use strict';var Sequelize=require(_0x1b18('0x0'));module[_0x1b18('0x1')]={'name':{'type':Sequelize[_0x1b18('0x2')],'unique':_0x1b18('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x1b18('0x4')]},'preproduction':{'type':Sequelize[_0x1b18('0x5')]('long'),'get':function(){if(this[_0x1b18('0x6')](_0x1b18('0x7'))){return this[_0x1b18('0x6')](_0x1b18('0x7'))[_0x1b18('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x1b18('0x5')](_0x1b18('0x9')),'get':function(){if(this['getDataValue'](_0x1b18('0xa'))){return this[_0x1b18('0x6')](_0x1b18('0xa'))[_0x1b18('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x1b18('0xb')]},'publishedAt':{'type':Sequelize[_0x1b18('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1911624..08e57b8 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 _0xf960=['send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','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','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','register','json','undefined','limit','count','offset','status','set','Content-Range','update','then','destroy','get','SquareProjects','publish','agi','sendStatus','error','stack','name'];(function(_0x5d4586,_0x2fc2dd){var _0x44f1e2=function(_0x54e1c4){while(--_0x54e1c4){_0x5d4586['push'](_0x5d4586['shift']());}};_0x44f1e2(++_0x2fc2dd);}(_0xf960,0x142));var _0x0f96=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xf960[_0x272638];return _0x19d027;};'use strict';var _=require(_0x0f96('0x0'));var Redis=require(_0x0f96('0x1'));var qs=require(_0x0f96('0x2'));var logger=require(_0x0f96('0x3'))('api');var config=require(_0x0f96('0x4'));var db=require(_0x0f96('0x5'))['db'];config[_0x0f96('0x6')]=_['defaults'](config[_0x0f96('0x6')],{'host':_0x0f96('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f96('0x6')]));require('./squareProject.socket')[_0x0f96('0x8')](socket);function respondWithResult(_0x1c3d8e,_0x5a2d14){_0x5a2d14=_0x5a2d14||0xc8;return function(_0x187a5a){if(_0x187a5a){return _0x1c3d8e['status'](_0x5a2d14)[_0x0f96('0x9')](_0x187a5a);}};}function respondWithFilteredResult(_0x3f68a4,_0x171d4b){return function(_0x57066f){if(_0x57066f){var _0x85d667=typeof _0x171d4b['offset']===_0x0f96('0xa')&&typeof _0x171d4b[_0x0f96('0xb')]===_0x0f96('0xa');var _0x1876a3=_0x57066f[_0x0f96('0xc')];var _0x139337=_0x85d667?0x0:_0x171d4b[_0x0f96('0xd')];var _0x116a70=_0x85d667?_0x57066f[_0x0f96('0xc')]:_0x171d4b['offset']+_0x171d4b[_0x0f96('0xb')];var _0x3f4731;if(_0x116a70>=_0x1876a3){_0x116a70=_0x1876a3;_0x3f4731=0xc8;}else{_0x3f4731=0xce;}_0x3f68a4[_0x0f96('0xe')](_0x3f4731);return _0x3f68a4[_0x0f96('0xf')](_0x0f96('0x10'),_0x139337+'-'+_0x116a70+'/'+_0x1876a3)['json'](_0x57066f);}return null;};}function saveUpdates(_0xee70ab){return function(_0x2279a2){if(_0x2279a2){return _0x2279a2[_0x0f96('0x11')](_0xee70ab)[_0x0f96('0x12')](function(_0x340454){return _0x340454;});}return null;};}function removeEntity(_0x44f764){return function(_0x1bb640){if(_0x1bb640){return _0x1bb640[_0x0f96('0x13')]()[_0x0f96('0x12')](function(){var _0x35a754=_0x1bb640[_0x0f96('0x14')]({'plain':!![]});var _0x55a54a=_0x0f96('0x15');return db['UserProfileResource']['destroy']({'where':{'type':_0x55a54a,'resourceId':_0x35a754['id']}})[_0x0f96('0x12')](function(){return _0x1bb640;});})[_0x0f96('0x12')](function(){var _0x45d9f5=new Redis(config[_0x0f96('0x6')]);_0x45d9f5[_0x0f96('0x16')](_0x0f96('0x17'),JSON['stringify']({'id':_0x1bb640['id'],'deleted':!![]}));})[_0x0f96('0x12')](function(){_0x44f764[_0x0f96('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f244){return function(_0x17d5ce){if(!_0x17d5ce){_0x50f244[_0x0f96('0x18')](0x194);}return _0x17d5ce;};}function handleError(_0x3800c6,_0x27c2e6){_0x27c2e6=_0x27c2e6||0x1f4;return function(_0x157b16){logger[_0x0f96('0x19')](_0x157b16[_0x0f96('0x1a')]);if(_0x157b16[_0x0f96('0x1b')]){delete _0x157b16[_0x0f96('0x1b')];}_0x3800c6['status'](_0x27c2e6)[_0x0f96('0x1c')](_0x157b16);};}exports[_0x0f96('0x1d')]=function(_0xd73b2c,_0xfc729b){var _0x319f5f={},_0x5eaf1={},_0x3ba75b={'count':0x0,'rows':[]};var _0x3953c2=_[_0x0f96('0x1e')](db[_0x0f96('0x1f')][_0x0f96('0x20')],function(_0xa7c3e1){return{'name':_0xa7c3e1[_0x0f96('0x21')],'type':_0xa7c3e1['type'][_0x0f96('0x22')]};});_0x5eaf1[_0x0f96('0x23')]=_[_0x0f96('0x1e')](_0x3953c2,_0x0f96('0x1b'));_0x5eaf1[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0xd73b2c['query']);_0x5eaf1[_0x0f96('0x26')]=_[_0x0f96('0x27')](_0x5eaf1[_0x0f96('0x23')],_0x5eaf1['query']);_0x319f5f[_0x0f96('0x28')]=_[_0x0f96('0x27')](_0x5eaf1[_0x0f96('0x23')],qs[_0x0f96('0x29')](_0xd73b2c[_0x0f96('0x24')]['fields']));_0x319f5f[_0x0f96('0x28')]=_0x319f5f[_0x0f96('0x28')]['length']?_0x319f5f[_0x0f96('0x28')]:_0x5eaf1[_0x0f96('0x23')];if(!_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x2a')]('nolimit')){_0x319f5f[_0x0f96('0xb')]=qs[_0x0f96('0xb')](_0xd73b2c['query'][_0x0f96('0xb')]);_0x319f5f[_0x0f96('0xd')]=qs[_0x0f96('0xd')](_0xd73b2c[_0x0f96('0x24')][_0x0f96('0xd')]);}_0x319f5f[_0x0f96('0x2b')]=qs['sort'](_0xd73b2c[_0x0f96('0x24')]['sort']);_0x319f5f[_0x0f96('0x2c')]=qs['filters'](_[_0x0f96('0x2d')](_0xd73b2c[_0x0f96('0x24')],_0x5eaf1[_0x0f96('0x26')]),_0x3953c2);if(_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x2e')]){_0x319f5f['where']=_[_0x0f96('0x2f')](_0x319f5f[_0x0f96('0x2c')],{'$or':_[_0x0f96('0x1e')](_0x3953c2,function(_0x45d13a){if(_0x45d13a[_0x0f96('0x30')]!=='VIRTUAL'){var _0x1a33d2={};_0x1a33d2[_0x45d13a[_0x0f96('0x1b')]]={'$like':'%'+_0xd73b2c['query'][_0x0f96('0x2e')]+'%'};return _0x1a33d2;}})});}_0x319f5f=_['merge']({},_0x319f5f,_0xd73b2c[_0x0f96('0x31')]);var _0x2a3db5={'where':_0x319f5f[_0x0f96('0x2c')]};return db[_0x0f96('0x1f')][_0x0f96('0xc')](_0x2a3db5)[_0x0f96('0x12')](function(_0x541c96){_0x3ba75b['count']=_0x541c96;if(_0xd73b2c[_0x0f96('0x24')][_0x0f96('0x32')]){_0x319f5f[_0x0f96('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x0f96('0x34')](_0x319f5f);})[_0x0f96('0x12')](function(_0x2bf1b0){_0x3ba75b[_0x0f96('0x35')]=_0x2bf1b0;return _0x3ba75b;})['then'](respondWithFilteredResult(_0xfc729b,_0x319f5f))[_0x0f96('0x36')](handleError(_0xfc729b,null));};exports[_0x0f96('0x37')]=function(_0x47e756,_0xb292a9){var _0x13d0e6={'raw':![],'where':{'id':_0x47e756[_0x0f96('0x38')]['id']}},_0x565838={};_0x565838[_0x0f96('0x23')]=_[_0x0f96('0x25')](db['SquareProject'][_0x0f96('0x20')]);_0x565838[_0x0f96('0x24')]=_[_0x0f96('0x25')](_0x47e756['query']);_0x565838[_0x0f96('0x26')]=_[_0x0f96('0x27')](_0x565838[_0x0f96('0x23')],_0x565838[_0x0f96('0x24')]);_0x13d0e6[_0x0f96('0x28')]=_[_0x0f96('0x27')](_0x565838[_0x0f96('0x23')],qs[_0x0f96('0x29')](_0x47e756['query'][_0x0f96('0x29')]));_0x13d0e6[_0x0f96('0x28')]=_0x13d0e6[_0x0f96('0x28')][_0x0f96('0x39')]?_0x13d0e6['attributes']:_0x565838['model'];if(_0x47e756[_0x0f96('0x24')][_0x0f96('0x32')]){_0x13d0e6[_0x0f96('0x33')]=[{'all':!![]}];}_0x13d0e6=_[_0x0f96('0x2f')]({},_0x13d0e6,_0x47e756[_0x0f96('0x31')]);return db['SquareProject']['find'](_0x13d0e6)['then'](handleEntityNotFound(_0xb292a9,null))[_0x0f96('0x12')](respondWithResult(_0xb292a9,null))[_0x0f96('0x36')](handleError(_0xb292a9,null));};exports[_0x0f96('0x3a')]=function(_0x17a647,_0x31c657){return db[_0x0f96('0x1f')]['create'](_0x17a647[_0x0f96('0x3b')],{})[_0x0f96('0x12')](function(_0x4b127d){var _0x516b78=_0x17a647[_0x0f96('0x3c')][_0x0f96('0x14')]({'plain':!![]});if(!_0x516b78)throw new Error(_0x0f96('0x3d'));if(_0x516b78[_0x0f96('0x3e')]===_0x0f96('0x3c')){var _0x2b762e=_0x4b127d[_0x0f96('0x14')]({'plain':!![]});var _0x473875=_0x0f96('0x15');return db[_0x0f96('0x3f')][_0x0f96('0x40')]({'where':{'name':_0x473875,'userProfileId':_0x516b78[_0x0f96('0x41')]},'raw':!![]})[_0x0f96('0x12')](function(_0x5a04a1){if(_0x5a04a1&&_0x5a04a1[_0x0f96('0x42')]===0x0){return db['UserProfileResource'][_0x0f96('0x3a')]({'name':_0x2b762e[_0x0f96('0x1b')],'resourceId':_0x2b762e['id'],'type':_0x5a04a1[_0x0f96('0x1b')],'sectionId':_0x5a04a1['id']},{})[_0x0f96('0x12')](function(){return _0x4b127d;});}else{return _0x4b127d;}})['catch'](function(_0x28032e){logger[_0x0f96('0x19')](_0x0f96('0x43'),_0x28032e);throw _0x28032e;});}return _0x4b127d;})['then'](respondWithResult(_0x31c657,0xc9))[_0x0f96('0x36')](handleError(_0x31c657,null));};exports[_0x0f96('0x11')]=function(_0x6fa584,_0x54257f){if(_0x6fa584[_0x0f96('0x3b')]['id']){delete _0x6fa584[_0x0f96('0x3b')]['id'];}return db[_0x0f96('0x1f')][_0x0f96('0x40')]({'where':{'id':_0x6fa584[_0x0f96('0x38')]['id']}})['then'](handleEntityNotFound(_0x54257f,null))[_0x0f96('0x12')](saveUpdates(_0x6fa584[_0x0f96('0x3b')],null))['then'](function(_0x5e1a6e){if(!_0x5e1a6e)return;var _0x1062a9=_0x5e1a6e['get']({'plain':!![]});return _0x1062a9;})[_0x0f96('0x12')](function(_0x3bd9a0){var _0x3ecff1=new Redis(config[_0x0f96('0x6')]);_0x3ecff1[_0x0f96('0x16')](_0x0f96('0x17'),JSON[_0x0f96('0x44')](_[_0x0f96('0x2d')](_0x3bd9a0,['id',_0x0f96('0x1b'),_0x0f96('0x45')])));return _0x3bd9a0;})[_0x0f96('0x12')](respondWithResult(_0x54257f,null))[_0x0f96('0x36')](handleError(_0x54257f,null));};exports[_0x0f96('0x13')]=function(_0x5ba784,_0x15a06d){return db[_0x0f96('0x1f')]['find']({'where':{'id':_0x5ba784[_0x0f96('0x38')]['id']}})[_0x0f96('0x12')](handleEntityNotFound(_0x15a06d,null))[_0x0f96('0x12')](removeEntity(_0x15a06d,null))[_0x0f96('0x36')](handleError(_0x15a06d,null));}; \ No newline at end of file +var _0xe47a=['options','includeAll','include','findAll','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','then','destroy','get','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x1b65eb,_0x3f511f){var _0x33ff7b=function(_0x5ca09b){while(--_0x5ca09b){_0x1b65eb['push'](_0x1b65eb['shift']());}};_0x33ff7b(++_0x3f511f);}(_0xe47a,0x140));var _0xae47=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe47a[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xae47('0x0'));var Redis=require(_0xae47('0x1'));var qs=require(_0xae47('0x2'));var logger=require(_0xae47('0x3'))(_0xae47('0x4'));var config=require(_0xae47('0x5'));var db=require('../../mysqldb')['db'];config[_0xae47('0x6')]=_[_0xae47('0x7')](config[_0xae47('0x6')],{'host':_0xae47('0x8'),'port':0x18eb});var socket=require(_0xae47('0x9'))(new Redis(config[_0xae47('0x6')]));require(_0xae47('0xa'))[_0xae47('0xb')](socket);function respondWithResult(_0x24aeb1,_0x3f12b9){_0x3f12b9=_0x3f12b9||0xc8;return function(_0x379ed5){if(_0x379ed5){return _0x24aeb1[_0xae47('0xc')](_0x3f12b9)[_0xae47('0xd')](_0x379ed5);}};}function respondWithFilteredResult(_0x35739d,_0x2fa247){return function(_0xc25235){if(_0xc25235){var _0x2df8df=typeof _0x2fa247[_0xae47('0xe')]==='undefined'&&typeof _0x2fa247[_0xae47('0xf')]===_0xae47('0x10');var _0x486505=_0xc25235[_0xae47('0x11')];var _0x4f8d48=_0x2df8df?0x0:_0x2fa247[_0xae47('0xe')];var _0x3efebf=_0x2df8df?_0xc25235[_0xae47('0x11')]:_0x2fa247['offset']+_0x2fa247[_0xae47('0xf')];var _0x516858;if(_0x3efebf>=_0x486505){_0x3efebf=_0x486505;_0x516858=0xc8;}else{_0x516858=0xce;}_0x35739d[_0xae47('0xc')](_0x516858);return _0x35739d[_0xae47('0x12')]('Content-Range',_0x4f8d48+'-'+_0x3efebf+'/'+_0x486505)[_0xae47('0xd')](_0xc25235);}return null;};}function saveUpdates(_0xca9ef9){return function(_0x58d22f){if(_0x58d22f){return _0x58d22f['update'](_0xca9ef9)[_0xae47('0x13')](function(_0x3c4751){return _0x3c4751;});}return null;};}function removeEntity(_0x2e68bb){return function(_0x63a211){if(_0x63a211){return _0x63a211[_0xae47('0x14')]()[_0xae47('0x13')](function(){var _0x1dc68c=_0x63a211[_0xae47('0x15')]({'plain':!![]});var _0x2d5d8c=_0xae47('0x16');return db[_0xae47('0x17')][_0xae47('0x14')]({'where':{'type':_0x2d5d8c,'resourceId':_0x1dc68c['id']}})[_0xae47('0x13')](function(){return _0x63a211;});})[_0xae47('0x13')](function(){var _0x92d293=new Redis(config['redis']);_0x92d293[_0xae47('0x18')]('agi',JSON[_0xae47('0x19')]({'id':_0x63a211['id'],'deleted':!![]}));})['then'](function(){_0x2e68bb[_0xae47('0xc')](0xcc)[_0xae47('0x1a')]();});}};}function handleEntityNotFound(_0x3b88c7){return function(_0x52a486){if(!_0x52a486){_0x3b88c7[_0xae47('0x1b')](0x194);}return _0x52a486;};}function handleError(_0x5e5499,_0x48d658){_0x48d658=_0x48d658||0x1f4;return function(_0x52cb2d){logger[_0xae47('0x1c')](_0x52cb2d[_0xae47('0x1d')]);if(_0x52cb2d[_0xae47('0x1e')]){delete _0x52cb2d['name'];}_0x5e5499[_0xae47('0xc')](_0x48d658)[_0xae47('0x1f')](_0x52cb2d);};}exports[_0xae47('0x20')]=function(_0x5a9310,_0x531648){var _0x4fab53={},_0x2e6d23={},_0x4920bc={'count':0x0,'rows':[]};var _0x1c38cc=_['map'](db[_0xae47('0x21')][_0xae47('0x22')],function(_0x434220){return{'name':_0x434220[_0xae47('0x23')],'type':_0x434220[_0xae47('0x24')][_0xae47('0x25')]};});_0x2e6d23[_0xae47('0x26')]=_[_0xae47('0x27')](_0x1c38cc,_0xae47('0x1e'));_0x2e6d23[_0xae47('0x28')]=_[_0xae47('0x29')](_0x5a9310[_0xae47('0x28')]);_0x2e6d23[_0xae47('0x2a')]=_[_0xae47('0x2b')](_0x2e6d23[_0xae47('0x26')],_0x2e6d23['query']);_0x4fab53[_0xae47('0x2c')]=_['intersection'](_0x2e6d23[_0xae47('0x26')],qs['fields'](_0x5a9310[_0xae47('0x28')]['fields']));_0x4fab53['attributes']=_0x4fab53[_0xae47('0x2c')][_0xae47('0x2d')]?_0x4fab53[_0xae47('0x2c')]:_0x2e6d23[_0xae47('0x26')];if(!_0x5a9310[_0xae47('0x28')][_0xae47('0x2e')](_0xae47('0x2f'))){_0x4fab53[_0xae47('0xf')]=qs[_0xae47('0xf')](_0x5a9310[_0xae47('0x28')]['limit']);_0x4fab53[_0xae47('0xe')]=qs['offset'](_0x5a9310[_0xae47('0x28')][_0xae47('0xe')]);}_0x4fab53[_0xae47('0x30')]=qs['sort'](_0x5a9310[_0xae47('0x28')][_0xae47('0x31')]);_0x4fab53[_0xae47('0x32')]=qs[_0xae47('0x2a')](_[_0xae47('0x33')](_0x5a9310[_0xae47('0x28')],_0x2e6d23['filters']),_0x1c38cc);if(_0x5a9310[_0xae47('0x28')][_0xae47('0x34')]){_0x4fab53['where']=_['merge'](_0x4fab53['where'],{'$or':_[_0xae47('0x27')](_0x1c38cc,function(_0xb9e120){if(_0xb9e120[_0xae47('0x24')]!==_0xae47('0x35')){var _0x157387={};_0x157387[_0xb9e120['name']]={'$like':'%'+_0x5a9310[_0xae47('0x28')]['filter']+'%'};return _0x157387;}})});}_0x4fab53=_[_0xae47('0x36')]({},_0x4fab53,_0x5a9310[_0xae47('0x37')]);var _0x1001d4={'where':_0x4fab53[_0xae47('0x32')]};return db[_0xae47('0x21')][_0xae47('0x11')](_0x1001d4)['then'](function(_0xbecbaa){_0x4920bc[_0xae47('0x11')]=_0xbecbaa;if(_0x5a9310['query'][_0xae47('0x38')]){_0x4fab53[_0xae47('0x39')]=[{'all':!![]}];}return db[_0xae47('0x21')][_0xae47('0x3a')](_0x4fab53);})[_0xae47('0x13')](function(_0x43073a){_0x4920bc['rows']=_0x43073a;return _0x4920bc;})[_0xae47('0x13')](respondWithFilteredResult(_0x531648,_0x4fab53))[_0xae47('0x3b')](handleError(_0x531648,null));};exports[_0xae47('0x3c')]=function(_0x442f87,_0x16fc31){var _0x1e81af={'raw':![],'where':{'id':_0x442f87[_0xae47('0x3d')]['id']}},_0x291483={};_0x291483[_0xae47('0x26')]=_[_0xae47('0x29')](db['SquareProject']['rawAttributes']);_0x291483[_0xae47('0x28')]=_['keys'](_0x442f87['query']);_0x291483[_0xae47('0x2a')]=_[_0xae47('0x2b')](_0x291483[_0xae47('0x26')],_0x291483[_0xae47('0x28')]);_0x1e81af[_0xae47('0x2c')]=_['intersection'](_0x291483[_0xae47('0x26')],qs[_0xae47('0x3e')](_0x442f87[_0xae47('0x28')]['fields']));_0x1e81af[_0xae47('0x2c')]=_0x1e81af[_0xae47('0x2c')]['length']?_0x1e81af[_0xae47('0x2c')]:_0x291483['model'];if(_0x442f87['query'][_0xae47('0x38')]){_0x1e81af['include']=[{'all':!![]}];}_0x1e81af=_['merge']({},_0x1e81af,_0x442f87['options']);return db[_0xae47('0x21')][_0xae47('0x3f')](_0x1e81af)[_0xae47('0x13')](handleEntityNotFound(_0x16fc31,null))[_0xae47('0x13')](respondWithResult(_0x16fc31,null))['catch'](handleError(_0x16fc31,null));};exports[_0xae47('0x40')]=function(_0x3edded,_0x11e9b2){return db[_0xae47('0x21')][_0xae47('0x40')](_0x3edded[_0xae47('0x41')],{})[_0xae47('0x13')](function(_0x2e2189){var _0x4575d4=_0x3edded[_0xae47('0x42')][_0xae47('0x15')]({'plain':!![]});if(!_0x4575d4)throw new Error(_0xae47('0x43'));if(_0x4575d4[_0xae47('0x44')]==='user'){var _0x16b21e=_0x2e2189['get']({'plain':!![]});var _0x22230b=_0xae47('0x16');return db[_0xae47('0x45')][_0xae47('0x3f')]({'where':{'name':_0x22230b,'userProfileId':_0x4575d4[_0xae47('0x46')]},'raw':!![]})[_0xae47('0x13')](function(_0xf0a5ec){if(_0xf0a5ec&&_0xf0a5ec[_0xae47('0x47')]===0x0){return db[_0xae47('0x17')][_0xae47('0x40')]({'name':_0x16b21e[_0xae47('0x1e')],'resourceId':_0x16b21e['id'],'type':_0xf0a5ec['name'],'sectionId':_0xf0a5ec['id']},{})[_0xae47('0x13')](function(){return _0x2e2189;});}else{return _0x2e2189;}})[_0xae47('0x3b')](function(_0x4d8f5f){logger[_0xae47('0x1c')](_0xae47('0x48'),_0x4d8f5f);throw _0x4d8f5f;});}return _0x2e2189;})[_0xae47('0x13')](respondWithResult(_0x11e9b2,0xc9))[_0xae47('0x3b')](handleError(_0x11e9b2,null));};exports[_0xae47('0x49')]=function(_0x47e5cc,_0x5f258d){if(_0x47e5cc[_0xae47('0x41')]['id']){delete _0x47e5cc[_0xae47('0x41')]['id'];}return db[_0xae47('0x21')]['find']({'where':{'id':_0x47e5cc[_0xae47('0x3d')]['id']}})[_0xae47('0x13')](handleEntityNotFound(_0x5f258d,null))[_0xae47('0x13')](saveUpdates(_0x47e5cc['body'],null))['then'](function(_0x478c0f){if(!_0x478c0f)return;var _0x4e8bd5=_0x478c0f[_0xae47('0x15')]({'plain':!![]});return _0x4e8bd5;})['then'](function(_0xfb7555){var _0x129db6=new Redis(config[_0xae47('0x6')]);_0x129db6[_0xae47('0x18')]('agi',JSON['stringify'](_[_0xae47('0x33')](_0xfb7555,['id',_0xae47('0x1e'),_0xae47('0x4a')])));return _0xfb7555;})[_0xae47('0x13')](respondWithResult(_0x5f258d,null))[_0xae47('0x3b')](handleError(_0x5f258d,null));};exports[_0xae47('0x14')]=function(_0x5a153c,_0x4af18e){return db[_0xae47('0x21')][_0xae47('0x3f')]({'where':{'id':_0x5a153c['params']['id']}})[_0xae47('0x13')](handleEntityNotFound(_0x4af18e,null))[_0xae47('0x13')](removeEntity(_0x4af18e,null))[_0xae47('0x3b')](handleError(_0x4af18e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9535c74..7f8e74a 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 _0xe933=['SquareProject','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xe933,0xc4));var _0x3e93=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe933[_0x1deb03];return _0x189fe7;};'use strict';var EventEmitter=require(_0x3e93('0x0'));var SquareProject=require(_0x3e93('0x1'))['db'][_0x3e93('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e93('0x3'),'afterUpdate':'update','afterDestroy':_0x3e93('0x4')};function emitEvent(_0x4a3121){return function(_0x4952a6,_0x1b2d52,_0x4b85df){SquareProjectEvents[_0x3e93('0x5')](_0x4a3121+':'+_0x4952a6['id'],_0x4952a6);SquareProjectEvents[_0x3e93('0x5')](_0x4a3121,_0x4952a6);_0x4b85df(null);};}for(var e in events){if(events[_0x3e93('0x6')](e)){var event=events[e];SquareProject[_0x3e93('0x7')](e,emitEvent(event));}}module[_0x3e93('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xd9f8=['SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','events'];(function(_0xedad0f,_0xd2a73d){var _0x1d657e=function(_0x2c98ce){while(--_0x2c98ce){_0xedad0f['push'](_0xedad0f['shift']());}};_0x1d657e(++_0xd2a73d);}(_0xd9f8,0xd8));var _0x8d9f=function(_0x1a7f3a,_0x3a5e52){_0x1a7f3a=_0x1a7f3a-0x0;var _0x134929=_0xd9f8[_0x1a7f3a];return _0x134929;};'use strict';var EventEmitter=require(_0x8d9f('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x8d9f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8d9f('0x2')](0x0);var events={'afterCreate':_0x8d9f('0x3'),'afterUpdate':_0x8d9f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2311ba){return function(_0x386f52,_0x24ed82,_0x5d830f){SquareProjectEvents[_0x8d9f('0x5')](_0x2311ba+':'+_0x386f52['id'],_0x386f52);SquareProjectEvents[_0x8d9f('0x5')](_0x2311ba,_0x386f52);_0x5d830f(null);};}for(var e in events){if(events[_0x8d9f('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index f03a9c7..2b72035 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 _0xeb3a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','SquareProject','square_projects','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x99bd01,_0x279ec8){var _0x228949=function(_0x3d6afe){while(--_0x3d6afe){_0x99bd01['push'](_0x99bd01['shift']());}};_0x228949(++_0x279ec8);}(_0xeb3a,0x77));var _0xaeb3=function(_0x25fd2,_0x26b9b7){_0x25fd2=_0x25fd2-0x0;var _0x239af1=_0xeb3a[_0x25fd2];return _0x239af1;};'use strict';var _=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var logger=require(_0xaeb3('0x2'))(_0xaeb3('0x3'));var moment=require(_0xaeb3('0x4'));var BPromise=require(_0xaeb3('0x5'));var rp=require(_0xaeb3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaeb3('0x7'));var config=require('../../config/environment');var attributes=require(_0xaeb3('0x8'));module[_0xaeb3('0x9')]=function(_0x3fef76,_0x93e78b){return _0x3fef76['define'](_0xaeb3('0xa'),attributes,{'tableName':_0xaeb3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e1f14,_0x89d3b3,_0x222766){if(_0x2e1f14['changed'](_0xaeb3('0xc'))){_0x2e1f14['savedAt']=moment()[_0xaeb3('0xd')](_0xaeb3('0xe'));}if(_0x2e1f14['changed'](_0xaeb3('0xf'))){_0x2e1f14[_0xaeb3('0x10')]=moment()[_0xaeb3('0xd')](_0xaeb3('0xe'));}_0x222766(null,_0x2e1f14);}}});}; \ No newline at end of file +var _0x56de=['request-promise','path','rimraf','../../config/environment','exports','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56de,0x92));var _0xe56d=function(_0x49b31b,_0x140314){_0x49b31b=_0x49b31b-0x0;var _0x2120e1=_0x56de[_0x49b31b];return _0x2120e1;};'use strict';var _=require('lodash');var util=require(_0xe56d('0x0'));var logger=require(_0xe56d('0x1'))('api');var moment=require(_0xe56d('0x2'));var BPromise=require(_0xe56d('0x3'));var rp=require(_0xe56d('0x4'));var fs=require('fs');var path=require(_0xe56d('0x5'));var rimraf=require(_0xe56d('0x6'));var config=require(_0xe56d('0x7'));var attributes=require('./squareProject.attributes');module[_0xe56d('0x8')]=function(_0x3d902d,_0x843516){return _0x3d902d['define']('SquareProject',attributes,{'tableName':_0xe56d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x50c729,_0x159c3d,_0x687079){if(_0x50c729[_0xe56d('0xa')](_0xe56d('0xb'))){_0x50c729['savedAt']=moment()[_0xe56d('0xc')](_0xe56d('0xd'));}if(_0x50c729[_0xe56d('0xa')](_0xe56d('0xe'))){_0x50c729['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x687079(null,_0x50c729);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e7ea3e2..22ec190 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 _0xe256=['where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','rpc','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject','findAll','raw','options'];(function(_0x57333f,_0x48685d){var _0x25e4d2=function(_0x39d525){while(--_0x39d525){_0x57333f['push'](_0x57333f['shift']());}};_0x25e4d2(++_0x48685d);}(_0xe256,0x96));var _0x6e25=function(_0x290129,_0x3bb647){_0x290129=_0x290129-0x0;var _0x1e7e52=_0xe256[_0x290129];return _0x1e7e52;};'use strict';var _=require(_0x6e25('0x0'));var Redis=require(_0x6e25('0x1'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6e25('0x2'));var config=require('../../config/environment');config[_0x6e25('0x3')]=_[_0x6e25('0x4')](config[_0x6e25('0x3')],{'host':_0x6e25('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e25('0x6'))['register'](socket);exports[_0x6e25('0x7')]=function(_0x66b2dd){var _0x551739=this;return new Promise(function(_0x3d1d99,_0x22a157){return db[_0x6e25('0x8')][_0x6e25('0x9')]({'raw':_0x66b2dd['options']?_0x66b2dd['options'][_0x6e25('0xa')]===undefined?!![]:![]:!![],'where':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xc')]||null:null,'attributes':_0x66b2dd[_0x6e25('0xb')]?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xd')]||null:null,'limit':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xe')]||null:null,'include':_0x66b2dd['options']?_0x66b2dd[_0x6e25('0xb')]['include']?_['map'](_0x66b2dd[_0x6e25('0xb')][_0x6e25('0xf')],function(_0x5f2951){return{'model':db[_0x5f2951[_0x6e25('0x10')]],'as':_0x5f2951['as'],'attributes':_0x5f2951['attributes'],'include':_0x5f2951['include']?_[_0x6e25('0x11')](_0x5f2951[_0x6e25('0xf')],function(_0x4ec379){return{'model':db[_0x4ec379[_0x6e25('0x10')]],'as':_0x4ec379['as'],'attributes':_0x4ec379[_0x6e25('0xd')],'include':_0x4ec379[_0x6e25('0xf')]?_[_0x6e25('0x11')](_0x4ec379[_0x6e25('0xf')],function(_0x4fac77){return{'model':db[_0x4fac77[_0x6e25('0x10')]],'as':_0x4fac77['as'],'attributes':_0x4fac77[_0x6e25('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6e25('0x12')](function(_0x939245){logger[_0x6e25('0x13')](_0x6e25('0x7'),_0x66b2dd);logger[_0x6e25('0x14')]('GetSquareProjects',_0x66b2dd,JSON[_0x6e25('0x15')](_0x939245));_0x3d1d99(_0x939245);})[_0x6e25('0x16')](function(_0x52c6c7){logger[_0x6e25('0x17')](_0x6e25('0x7'),_0x52c6c7[_0x6e25('0x18')],_0x66b2dd);_0x22a157(_0x551739[_0x6e25('0x17')](0x1f4,_0x52c6c7[_0x6e25('0x18')]));});});};exports[_0x6e25('0x19')]=function(_0x2a60c1){var _0x6780bc=this;return new Promise(function(_0x8f568f,_0xd2f141){return db['SquareProject'][_0x6e25('0x1a')]({'raw':_0x2a60c1['options']?_0x2a60c1[_0x6e25('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x2a60c1['options']?_0x2a60c1[_0x6e25('0xb')]['where']||null:null,'attributes':_0x2a60c1[_0x6e25('0xb')]?_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xd')]||null:null,'include':_0x2a60c1[_0x6e25('0xb')]?_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xf')]?_['map'](_0x2a60c1[_0x6e25('0xb')][_0x6e25('0xf')],function(_0x2424be){return{'model':db[_0x2424be[_0x6e25('0x10')]],'as':_0x2424be['as'],'attributes':_0x2424be[_0x6e25('0xd')],'include':_0x2424be['include']?_[_0x6e25('0x11')](_0x2424be[_0x6e25('0xf')],function(_0x231123){return{'model':db[_0x231123[_0x6e25('0x10')]],'as':_0x231123['as'],'attributes':_0x231123[_0x6e25('0xd')],'include':_0x231123[_0x6e25('0xf')]?_[_0x6e25('0x11')](_0x231123[_0x6e25('0xf')],function(_0x285fcf){return{'model':db[_0x285fcf[_0x6e25('0x10')]],'as':_0x285fcf['as'],'attributes':_0x285fcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e25('0x12')](function(_0x4f4a30){logger[_0x6e25('0x13')](_0x6e25('0x19'),_0x2a60c1);logger[_0x6e25('0x14')]('ShowSquareProject',_0x2a60c1,JSON[_0x6e25('0x15')](_0x4f4a30));_0x8f568f(_0x4f4a30);})[_0x6e25('0x16')](function(_0x4f01f7){logger['error']('ShowSquareProject',_0x4f01f7['message'],_0x2a60c1);_0xd2f141(_0x6780bc[_0x6e25('0x17')](0x1f4,_0x4f01f7[_0x6e25('0x18')]));});});}; \ No newline at end of file +var _0xef4f=['include','attributes','map','model','then','info','debug','stringify','error','SquareProject','ShowSquareProject','catch','message','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects','findAll','raw','options','where','limit'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xef4f,0x94));var _0xfef4=function(_0x2b58c2,_0x2ab689){_0x2b58c2=_0x2b58c2-0x0;var _0x2d32ed=_0xef4f[_0x2b58c2];return _0x2d32ed;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0xfef4('0x0'))['db'];var logger=require(_0xfef4('0x1'))(_0xfef4('0x2'));var config=require(_0xfef4('0x3'));config[_0xfef4('0x4')]=_[_0xfef4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfef4('0x6'))(new Redis(config[_0xfef4('0x4')]));require('./squareProject.socket')[_0xfef4('0x7')](socket);exports[_0xfef4('0x8')]=function(_0x2b33b1){var _0x5ea800=this;return new Promise(function(_0x3994f3,_0x185bb8){return db['SquareProject'][_0xfef4('0x9')]({'raw':_0x2b33b1['options']?_0x2b33b1['options'][_0xfef4('0xa')]===undefined?!![]:![]:!![],'where':_0x2b33b1[_0xfef4('0xb')]?_0x2b33b1[_0xfef4('0xb')][_0xfef4('0xc')]||null:null,'attributes':_0x2b33b1['options']?_0x2b33b1[_0xfef4('0xb')]['attributes']||null:null,'limit':_0x2b33b1[_0xfef4('0xb')]?_0x2b33b1[_0xfef4('0xb')][_0xfef4('0xd')]||null:null,'include':_0x2b33b1[_0xfef4('0xb')]?_0x2b33b1[_0xfef4('0xb')][_0xfef4('0xe')]?_['map'](_0x2b33b1[_0xfef4('0xb')][_0xfef4('0xe')],function(_0x4e5681){return{'model':db[_0x4e5681['model']],'as':_0x4e5681['as'],'attributes':_0x4e5681[_0xfef4('0xf')],'include':_0x4e5681[_0xfef4('0xe')]?_[_0xfef4('0x10')](_0x4e5681[_0xfef4('0xe')],function(_0x2cb764){return{'model':db[_0x2cb764[_0xfef4('0x11')]],'as':_0x2cb764['as'],'attributes':_0x2cb764[_0xfef4('0xf')],'include':_0x2cb764[_0xfef4('0xe')]?_[_0xfef4('0x10')](_0x2cb764[_0xfef4('0xe')],function(_0x16a99d){return{'model':db[_0x16a99d[_0xfef4('0x11')]],'as':_0x16a99d['as'],'attributes':_0x16a99d['attributes']};}):[]};}):[]};}):[]:[]})[_0xfef4('0x12')](function(_0x3655fd){logger[_0xfef4('0x13')]('GetSquareProjects',_0x2b33b1);logger[_0xfef4('0x14')](_0xfef4('0x8'),_0x2b33b1,JSON[_0xfef4('0x15')](_0x3655fd));_0x3994f3(_0x3655fd);})['catch'](function(_0x26b099){logger[_0xfef4('0x16')](_0xfef4('0x8'),_0x26b099['message'],_0x2b33b1);_0x185bb8(_0x5ea800['error'](0x1f4,_0x26b099['message']));});});};exports['ShowSquareProject']=function(_0x12d2c3){var _0x37d239=this;return new Promise(function(_0x57ea6f,_0x402f36){return db[_0xfef4('0x17')]['find']({'raw':_0x12d2c3[_0xfef4('0xb')]?_0x12d2c3['options'][_0xfef4('0xa')]===undefined?!![]:![]:!![],'where':_0x12d2c3[_0xfef4('0xb')]?_0x12d2c3[_0xfef4('0xb')][_0xfef4('0xc')]||null:null,'attributes':_0x12d2c3[_0xfef4('0xb')]?_0x12d2c3[_0xfef4('0xb')][_0xfef4('0xf')]||null:null,'include':_0x12d2c3[_0xfef4('0xb')]?_0x12d2c3[_0xfef4('0xb')]['include']?_[_0xfef4('0x10')](_0x12d2c3[_0xfef4('0xb')][_0xfef4('0xe')],function(_0x132052){return{'model':db[_0x132052[_0xfef4('0x11')]],'as':_0x132052['as'],'attributes':_0x132052[_0xfef4('0xf')],'include':_0x132052[_0xfef4('0xe')]?_[_0xfef4('0x10')](_0x132052[_0xfef4('0xe')],function(_0x4b250c){return{'model':db[_0x4b250c[_0xfef4('0x11')]],'as':_0x4b250c['as'],'attributes':_0x4b250c['attributes'],'include':_0x4b250c['include']?_['map'](_0x4b250c[_0xfef4('0xe')],function(_0x4b657d){return{'model':db[_0x4b657d[_0xfef4('0x11')]],'as':_0x4b657d['as'],'attributes':_0x4b657d[_0xfef4('0xf')]};}):[]};}):[]};}):[]:[]})[_0xfef4('0x12')](function(_0xf5a1f){logger[_0xfef4('0x13')](_0xfef4('0x18'),_0x12d2c3);logger[_0xfef4('0x14')](_0xfef4('0x18'),_0x12d2c3,JSON['stringify'](_0xf5a1f));_0x57ea6f(_0xf5a1f);})[_0xfef4('0x19')](function(_0x475dc4){logger[_0xfef4('0x16')](_0xfef4('0x18'),_0x475dc4[_0xfef4('0x1a')],_0x12d2c3);_0x402f36(_0x37d239[_0xfef4('0x16')](0x1f4,_0x475dc4[_0xfef4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7834d7c..2c7ca4d 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 _0xde6c=['remove','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x31b4aa,_0x9a6429){var _0x1bb3dd=function(_0x310869){while(--_0x310869){_0x31b4aa['push'](_0x31b4aa['shift']());}};_0x1bb3dd(++_0x9a6429);}(_0xde6c,0x1eb));var _0xcde6=function(_0x3bea4,_0x56a1a5){_0x3bea4=_0x3bea4-0x0;var _0xf8e956=_0xde6c[_0x3bea4];return _0xf8e956;};'use strict';var SquareProjectEvents=require(_0xcde6('0x0'));var events=['save',_0xcde6('0x1'),'update'];function createListener(_0x9f9c29,_0x164a15){return function(_0x400136){_0x164a15['emit'](_0x9f9c29,_0x400136);};}function removeListener(_0x656b17,_0x2b2d5c){return function(){SquareProjectEvents[_0xcde6('0x2')](_0x656b17,_0x2b2d5c);};}exports[_0xcde6('0x3')]=function(_0x1faeab){for(var _0x1a499b=0x0,_0x59f268=events[_0xcde6('0x4')];_0x1a499b<_0x59f268;_0x1a499b++){var _0x1807f=events[_0x1a499b];var _0x3c7f3b=createListener(_0xcde6('0x5')+_0x1807f,_0x1faeab);SquareProjectEvents['on'](_0x1807f,_0x3c7f3b);}}; \ No newline at end of file +var _0xab06=['length','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x1bf441,_0x49f64b){var _0x4d7eee=function(_0x5ef734){while(--_0x5ef734){_0x1bf441['push'](_0x1bf441['shift']());}};_0x4d7eee(++_0x49f64b);}(_0xab06,0xef));var _0x6ab0=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xab06[_0x313c96];return _0x522f53;};'use strict';var SquareProjectEvents=require(_0x6ab0('0x0'));var events=[_0x6ab0('0x1'),_0x6ab0('0x2'),_0x6ab0('0x3')];function createListener(_0x26328b,_0x515fb3){return function(_0x290067){_0x515fb3[_0x6ab0('0x4')](_0x26328b,_0x290067);};}function removeListener(_0x160183,_0x5649ef){return function(){SquareProjectEvents[_0x6ab0('0x5')](_0x160183,_0x5649ef);};}exports['register']=function(_0x5f0b05){for(var _0x2d46bc=0x0,_0x15ed96=events[_0x6ab0('0x6')];_0x2d46bc<_0x15ed96;_0x2d46bc++){var _0x5e481a=events[_0x2d46bc];var _0xb3e4f6=createListener('squareProject:'+_0x5e481a,_0x5f0b05);SquareProjectEvents['on'](_0x5e481a,_0xb3e4f6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e0426bb..7019006 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x588e63,_0x1081db){var _0x5b9b23=function(_0x5ac9d3){while(--_0x5ac9d3){_0x588e63['push'](_0x588e63['shift']());}};_0x5b9b23(++_0x1081db);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x489c51,_0x2437e6){var _0x26d788=function(_0x5b8646){while(--_0x5b8646){_0x489c51['push'](_0x489c51['shift']());}};_0x26d788(++_0x2437e6);}(_0xabce,0x103));var _0xeabc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xabce[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 56fd927..5c1e180 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 _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x364d80,_0x189614){var _0x463988=function(_0x14911d){while(--_0x14911d){_0x364d80['push'](_0x364d80['shift']());}};_0x463988(++_0x189614);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1ecde7,_0x3b8440){_0x1ecde7=_0x1ecde7-0x0;var _0xd38f8e=_0xb4c7[_0x1ecde7];return _0xd38f8e;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file +var _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0xd10919,_0x2d66ab){var _0x3e88f4=function(_0x32dbae){while(--_0x32dbae){_0xd10919['push'](_0xd10919['shift']());}};_0x3e88f4(++_0x2d66ab);}(_0x6aa7,0x178));var _0x76aa=function(_0x4421e6,_0x445e55){_0x4421e6=_0x4421e6-0x0;var _0x19ca77=_0x6aa7[_0x4421e6];return _0x19ca77;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 8bb11cc..0072b13 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 _0x71bb=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','SquareRecording','includeAll','include','findAll','catch','show','params','keys','find','create','body','download','../../components/encryptor','uniqueid','filename','savePath','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x71bb,0x16f));var _0xb71b=function(_0x1f48c7,_0x3c01b1){_0x1f48c7=_0x1f48c7-0x0;var _0x659e6b=_0x71bb[_0x1f48c7];return _0x659e6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71b('0x0'));var zipdir=require(_0xb71b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb71b('0x2'));var moment=require(_0xb71b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb71b('0x4'));var util=require(_0xb71b('0x5'));var path=require(_0xb71b('0x6'));var sox=require(_0xb71b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb71b('0x8'));var _=require(_0xb71b('0x9'));var squel=require(_0xb71b('0xa'));var crypto=require('crypto');var jsforce=require(_0xb71b('0xb'));var deskjs=require(_0xb71b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb71b('0xd'));var Papa=require(_0xb71b('0xe'));var Redis=require(_0xb71b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb71b('0x10'));var as=require(_0xb71b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb71b('0x12'));var utils=require(_0xb71b('0x13'));var config=require(_0xb71b('0x14'));var licenseUtil=require(_0xb71b('0x15'));var db=require(_0xb71b('0x16'))['db'];function respondWithStatusCode(_0x293c62,_0x83adac){_0x83adac=_0x83adac||0xcc;return function(_0x3ddbc5){if(_0x3ddbc5){return _0x293c62[_0xb71b('0x17')](_0x83adac);}return _0x293c62[_0xb71b('0x18')](_0x83adac)[_0xb71b('0x19')]();};}function respondWithResult(_0x3fa368,_0x2e78f3){_0x2e78f3=_0x2e78f3||0xc8;return function(_0x2548af){if(_0x2548af){return _0x3fa368['status'](_0x2e78f3)[_0xb71b('0x1a')](_0x2548af);}};}function respondWithFilteredResult(_0x1a06b1,_0x11b704){return function(_0x5c0c0f){if(_0x5c0c0f){var _0xf4c385=typeof _0x11b704['offset']===_0xb71b('0x1b')&&typeof _0x11b704['limit']==='undefined';var _0xc9187a=_0x5c0c0f[_0xb71b('0x1c')];var _0x337da7=_0xf4c385?0x0:_0x11b704[_0xb71b('0x1d')];var _0x13c149=_0xf4c385?_0x5c0c0f[_0xb71b('0x1c')]:_0x11b704[_0xb71b('0x1d')]+_0x11b704[_0xb71b('0x1e')];var _0x184969;if(_0x13c149>=_0xc9187a){_0x13c149=_0xc9187a;_0x184969=0xc8;}else{_0x184969=0xce;}_0x1a06b1[_0xb71b('0x18')](_0x184969);return _0x1a06b1[_0xb71b('0x1f')](_0xb71b('0x20'),_0x337da7+'-'+_0x13c149+'/'+_0xc9187a)['json'](_0x5c0c0f);}return null;};}function patchUpdates(_0x2026cd){return function(_0x11adf8){try{jsonpatch[_0xb71b('0x21')](_0x11adf8,_0x2026cd,!![]);}catch(_0x14c9ec){return BPromise[_0xb71b('0x22')](_0x14c9ec);}return _0x11adf8[_0xb71b('0x23')]();};}function saveUpdates(_0x4e1349,_0x2f9db2){return function(_0x575c63){if(_0x575c63){return _0x575c63[_0xb71b('0x24')](_0x4e1349)['then'](function(_0x3ff2ee){return _0x3ff2ee;});}return null;};}function removeEntity(_0x233528,_0x41f196){return function(_0x61fe1e){if(_0x61fe1e){return _0x61fe1e['destroy']()[_0xb71b('0x25')](function(){_0x233528[_0xb71b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d5ff,_0x31b0e9){return function(_0x3bd5f0){if(!_0x3bd5f0){_0x17d5ff[_0xb71b('0x17')](0x194);}return _0x3bd5f0;};}function handleError(_0x1def7e,_0x126167){_0x126167=_0x126167||0x1f4;return function(_0x54e587){logger['error'](_0x54e587[_0xb71b('0x26')]);if(_0x54e587[_0xb71b('0x27')]){delete _0x54e587['name'];}_0x1def7e[_0xb71b('0x18')](_0x126167)[_0xb71b('0x28')](_0x54e587);};}exports[_0xb71b('0x29')]=function(_0x1778ac,_0x37793f){var _0x1243a9={},_0x2f2253={},_0x286e7a={'count':0x0,'rows':[]};var _0xff1058=_[_0xb71b('0x2a')](db['SquareRecording'][_0xb71b('0x2b')],function(_0x54827a){return{'name':_0x54827a[_0xb71b('0x2c')],'type':_0x54827a['type'][_0xb71b('0x2d')]};});_0x2f2253[_0xb71b('0x2e')]=_[_0xb71b('0x2a')](_0xff1058,_0xb71b('0x27'));_0x2f2253[_0xb71b('0x2f')]=_['keys'](_0x1778ac[_0xb71b('0x2f')]);_0x2f2253[_0xb71b('0x30')]=_['intersection'](_0x2f2253[_0xb71b('0x2e')],_0x2f2253[_0xb71b('0x2f')]);_0x1243a9['attributes']=_[_0xb71b('0x31')](_0x2f2253[_0xb71b('0x2e')],qs['fields'](_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x32')]));_0x1243a9[_0xb71b('0x33')]=_0x1243a9[_0xb71b('0x33')][_0xb71b('0x34')]?_0x1243a9[_0xb71b('0x33')]:_0x2f2253[_0xb71b('0x2e')];if(!_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x35')]('nolimit')){_0x1243a9[_0xb71b('0x1e')]=qs[_0xb71b('0x1e')](_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x1e')]);_0x1243a9['offset']=qs['offset'](_0x1778ac[_0xb71b('0x2f')]['offset']);}_0x1243a9['order']=qs['sort'](_0x1778ac['query'][_0xb71b('0x36')]);_0x1243a9['where']=qs[_0xb71b('0x30')](_[_0xb71b('0x37')](_0x1778ac[_0xb71b('0x2f')],_0x2f2253[_0xb71b('0x30')]),_0xff1058);if(_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x38')]){_0x1243a9[_0xb71b('0x39')]=_[_0xb71b('0x3a')](_0x1243a9[_0xb71b('0x39')],{'$or':_['map'](_0xff1058,function(_0x243d53){if(_0x243d53[_0xb71b('0x3b')]!==_0xb71b('0x3c')){var _0x52312b={};_0x52312b[_0x243d53[_0xb71b('0x27')]]={'$like':'%'+_0x1778ac[_0xb71b('0x2f')][_0xb71b('0x38')]+'%'};return _0x52312b;}})});}_0x1243a9=_['merge']({},_0x1243a9,_0x1778ac[_0xb71b('0x3d')]);var _0x64d0c9={'where':_0x1243a9[_0xb71b('0x39')]};return db[_0xb71b('0x3e')][_0xb71b('0x1c')](_0x64d0c9)[_0xb71b('0x25')](function(_0x4de5df){_0x286e7a[_0xb71b('0x1c')]=_0x4de5df;if(_0x1778ac['query'][_0xb71b('0x3f')]){_0x1243a9[_0xb71b('0x40')]=[{'all':!![]}];}return db['SquareRecording'][_0xb71b('0x41')](_0x1243a9);})[_0xb71b('0x25')](function(_0xe9a419){_0x286e7a['rows']=_0xe9a419;return _0x286e7a;})[_0xb71b('0x25')](respondWithFilteredResult(_0x37793f,_0x1243a9))[_0xb71b('0x42')](handleError(_0x37793f,null));};exports[_0xb71b('0x43')]=function(_0x56cea5,_0x71fae7){var _0x46f050={'raw':!![],'where':{'id':_0x56cea5[_0xb71b('0x44')]['id']}},_0x19f3a8={};_0x19f3a8[_0xb71b('0x2e')]=_[_0xb71b('0x45')](db['SquareRecording'][_0xb71b('0x2b')]);_0x19f3a8['query']=_['keys'](_0x56cea5[_0xb71b('0x2f')]);_0x19f3a8[_0xb71b('0x30')]=_[_0xb71b('0x31')](_0x19f3a8['model'],_0x19f3a8[_0xb71b('0x2f')]);_0x46f050[_0xb71b('0x33')]=_['intersection'](_0x19f3a8['model'],qs['fields'](_0x56cea5['query'][_0xb71b('0x32')]));_0x46f050[_0xb71b('0x33')]=_0x46f050['attributes'][_0xb71b('0x34')]?_0x46f050[_0xb71b('0x33')]:_0x19f3a8['model'];if(_0x56cea5[_0xb71b('0x2f')][_0xb71b('0x3f')]){_0x46f050[_0xb71b('0x40')]=[{'all':!![]}];}_0x46f050=_[_0xb71b('0x3a')]({},_0x46f050,_0x56cea5[_0xb71b('0x3d')]);return db[_0xb71b('0x3e')][_0xb71b('0x46')](_0x46f050)[_0xb71b('0x25')](handleEntityNotFound(_0x71fae7,null))['then'](respondWithResult(_0x71fae7,null))[_0xb71b('0x42')](handleError(_0x71fae7,null));};exports[_0xb71b('0x47')]=function(_0x230e87,_0x34a8cc){return db['SquareRecording']['create'](_0x230e87[_0xb71b('0x48')],{})[_0xb71b('0x25')](respondWithResult(_0x34a8cc,0xc9))[_0xb71b('0x42')](handleError(_0x34a8cc,null));};exports['update']=function(_0x40cf0d,_0x3ffa7f){if(_0x40cf0d[_0xb71b('0x48')]['id']){delete _0x40cf0d[_0xb71b('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x40cf0d[_0xb71b('0x44')]['id']}})[_0xb71b('0x25')](handleEntityNotFound(_0x3ffa7f,null))[_0xb71b('0x25')](saveUpdates(_0x40cf0d['body'],null))[_0xb71b('0x25')](respondWithResult(_0x3ffa7f,null))[_0xb71b('0x42')](handleError(_0x3ffa7f,null));};exports[_0xb71b('0x49')]=function(_0x3c8fe1,_0x23e452,_0x5b0032){var _0x5dbcaa=require(_0xb71b('0x4a'));var _0x4cfe0e=![];var _0x1e5b4e={};if(_0x3c8fe1[_0xb71b('0x2f')][_0xb71b('0x3b')]&&_0x3c8fe1['query'][_0xb71b('0x3b')]==='uniqueid'){_0x1e5b4e[_0xb71b('0x4b')]=_0x3c8fe1[_0xb71b('0x44')]['id'];}else{_0x1e5b4e['id']=_0x3c8fe1[_0xb71b('0x44')]['id'];}return db[_0xb71b('0x3e')][_0xb71b('0x46')]({'where':_0x1e5b4e,'attributes':['id','savePath',_0xb71b('0x4c')],'raw':!![]})[_0xb71b('0x25')](handleEntityNotFound(_0x23e452,null))['then'](function(_0x57f0af){if(_0x57f0af){var _0x10653f=_0x57f0af[_0xb71b('0x4d')];var _0x528984=util['format'](_0xb71b('0x4e'),_0x10653f);if(fs['existsSync'](_0x528984)){_0x4cfe0e=!![];return _0x5dbcaa[_0xb71b('0x4f')](_0x528984,_0x10653f,config['secrets'][_0xb71b('0x50')])['then'](function(){return _0x57f0af;});}return _0x57f0af;}})[_0xb71b('0x25')](function(_0x395f77){if(_0x395f77){var _0x224094=_0x395f77[_0xb71b('0x4d')];if(!fs[_0xb71b('0x51')](_0x224094)){throw new db[(_0xb71b('0x52'))][(_0xb71b('0x53'))](_0xb71b('0x54'));}if(_0x395f77[_0xb71b('0x4c')]){return _0x23e452[_0xb71b('0x49')](_0x224094,_0x395f77[_0xb71b('0x4c')]+path[_0xb71b('0x55')](_0x224094),function(){if(_0x4cfe0e){fs['unlink'](_0x224094);}});}else{return _0x23e452[_0xb71b('0x49')](_0x224094,function(_0xee2baf){if(_0x4cfe0e){fs['unlink'](_0x224094);}});}}})[_0xb71b('0x42')](function(_0x42994a){if(_0x42994a[_0xb71b('0x56')]===_0xb71b('0x54')){_0x23e452[_0xb71b('0x18')](0x194)[_0xb71b('0x28')](_0xb71b('0x57'));}else{return handleError(_0x23e452,null);}});};exports[_0xb71b('0x58')]=function(_0x1727d9,_0x1d190f){return db[_0xb71b('0x3e')][_0xb71b('0x46')]({'where':{'id':_0x1727d9[_0xb71b('0x44')]['id']}})[_0xb71b('0x25')](function(_0x1000e6){if(_['isNil'](_0x1000e6)){throw new ReferenceError(_0xb71b('0x59'));}return _0x1000e6;})[_0xb71b('0x25')](function(_0x554693){var _0x32fc05=_0x554693[_0xb71b('0x4d')];logger[_0xb71b('0x5a')](_0xb71b('0x5b'),_0x32fc05);if(!_['isNil'](_0x554693['savePath'])&&fs[_0xb71b('0x51')](_0x32fc05)){logger[_0xb71b('0x5a')](_0xb71b('0x5c')+_0x32fc05+_0xb71b('0x5d'));fs['unlinkSync'](_0x32fc05);}_0x32fc05=_0x32fc05+_0xb71b('0x5e');if(!_[_0xb71b('0x5f')](_0x554693[_0xb71b('0x4d')])&&fs[_0xb71b('0x51')](_0x32fc05)){logger[_0xb71b('0x5a')]('File:\x20\x22'+_0x32fc05+_0xb71b('0x5d'));fs[_0xb71b('0x60')](_0x32fc05);}return _0x554693;})[_0xb71b('0x25')](function(_0x2bfa44){if(!_0x2bfa44)throw new InternalError();return _0x2bfa44[_0xb71b('0x58')]();})[_0xb71b('0x25')](function(){_0x1d190f[_0xb71b('0x18')](0xcc)[_0xb71b('0x19')]();})['catch'](handleError(_0x1d190f,null));}; \ No newline at end of file +var _0x8b85=['\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','merge','body','update','find','params','../../components/encryptor','uniqueid','filename','savePath','format','existsSync','secrets','Sequelize','extname','unlink','download','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22'];(function(_0x347f71,_0x4b716f){var _0x33d3c8=function(_0x486d99){while(--_0x486d99){_0x347f71['push'](_0x347f71['shift']());}};_0x33d3c8(++_0x4b716f);}(_0x8b85,0x1dd));var _0x58b8=function(_0xc753c8,_0x5627ff){_0xc753c8=_0xc753c8-0x0;var _0xd02f5c=_0x8b85[_0xc753c8];return _0xd02f5c;};'use strict';var emlformat=require(_0x58b8('0x0'));var rimraf=require(_0x58b8('0x1'));var zipdir=require(_0x58b8('0x2'));var jsonpatch=require(_0x58b8('0x3'));var rp=require('request-promise');var moment=require(_0x58b8('0x4'));var BPromise=require(_0x58b8('0x5'));var Mustache=require('mustache');var util=require(_0x58b8('0x6'));var path=require(_0x58b8('0x7'));var sox=require('sox');var csv=require(_0x58b8('0x8'));var ejs=require(_0x58b8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x58b8('0xa'));var crypto=require('crypto');var jsforce=require(_0x58b8('0xb'));var deskjs=require(_0x58b8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x58b8('0xd'));var Papa=require(_0x58b8('0xe'));var Redis=require(_0x58b8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58b8('0x10'));var hardwareService=require(_0x58b8('0x11'));var logger=require(_0x58b8('0x12'))(_0x58b8('0x13'));var utils=require(_0x58b8('0x14'));var config=require(_0x58b8('0x15'));var licenseUtil=require(_0x58b8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e0cd5,_0x896c8d){_0x896c8d=_0x896c8d||0xcc;return function(_0x51a9b4){if(_0x51a9b4){return _0x6e0cd5['sendStatus'](_0x896c8d);}return _0x6e0cd5['status'](_0x896c8d)[_0x58b8('0x17')]();};}function respondWithResult(_0x1ae3e8,_0x33b29b){_0x33b29b=_0x33b29b||0xc8;return function(_0x5172bf){if(_0x5172bf){return _0x1ae3e8[_0x58b8('0x18')](_0x33b29b)[_0x58b8('0x19')](_0x5172bf);}};}function respondWithFilteredResult(_0x5b446a,_0x9f154d){return function(_0x4e3492){if(_0x4e3492){var _0x593755=typeof _0x9f154d['offset']===_0x58b8('0x1a')&&typeof _0x9f154d[_0x58b8('0x1b')]===_0x58b8('0x1a');var _0x3d33df=_0x4e3492[_0x58b8('0x1c')];var _0x567b0e=_0x593755?0x0:_0x9f154d[_0x58b8('0x1d')];var _0x115b1e=_0x593755?_0x4e3492[_0x58b8('0x1c')]:_0x9f154d[_0x58b8('0x1d')]+_0x9f154d['limit'];var _0x4ebe52;if(_0x115b1e>=_0x3d33df){_0x115b1e=_0x3d33df;_0x4ebe52=0xc8;}else{_0x4ebe52=0xce;}_0x5b446a['status'](_0x4ebe52);return _0x5b446a[_0x58b8('0x1e')](_0x58b8('0x1f'),_0x567b0e+'-'+_0x115b1e+'/'+_0x3d33df)[_0x58b8('0x19')](_0x4e3492);}return null;};}function patchUpdates(_0x5975c5){return function(_0xd449c1){try{jsonpatch[_0x58b8('0x20')](_0xd449c1,_0x5975c5,!![]);}catch(_0x39b92b){return BPromise[_0x58b8('0x21')](_0x39b92b);}return _0xd449c1[_0x58b8('0x22')]();};}function saveUpdates(_0x45afe4,_0x5b8e30){return function(_0xbb80e){if(_0xbb80e){return _0xbb80e['update'](_0x45afe4)[_0x58b8('0x23')](function(_0x1e7fbd){return _0x1e7fbd;});}return null;};}function removeEntity(_0x473f89,_0xdbd778){return function(_0x56d410){if(_0x56d410){return _0x56d410['destroy']()[_0x58b8('0x23')](function(){_0x473f89[_0x58b8('0x18')](0xcc)[_0x58b8('0x17')]();});}};}function handleEntityNotFound(_0x4b3540,_0x57eabd){return function(_0x36a469){if(!_0x36a469){_0x4b3540[_0x58b8('0x24')](0x194);}return _0x36a469;};}function handleError(_0x397ade,_0x2968b6){_0x2968b6=_0x2968b6||0x1f4;return function(_0x187090){logger[_0x58b8('0x25')](_0x187090['stack']);if(_0x187090[_0x58b8('0x26')]){delete _0x187090['name'];}_0x397ade[_0x58b8('0x18')](_0x2968b6)[_0x58b8('0x27')](_0x187090);};}exports[_0x58b8('0x28')]=function(_0x5e66ea,_0x29f9d3){var _0x3ec101={},_0x11a916={},_0x374c13={'count':0x0,'rows':[]};var _0x4e4ced=_[_0x58b8('0x29')](db[_0x58b8('0x2a')][_0x58b8('0x2b')],function(_0x3e5dee){return{'name':_0x3e5dee[_0x58b8('0x2c')],'type':_0x3e5dee[_0x58b8('0x2d')][_0x58b8('0x2e')]};});_0x11a916['model']=_[_0x58b8('0x29')](_0x4e4ced,_0x58b8('0x26'));_0x11a916[_0x58b8('0x2f')]=_[_0x58b8('0x30')](_0x5e66ea[_0x58b8('0x2f')]);_0x11a916[_0x58b8('0x31')]=_[_0x58b8('0x32')](_0x11a916['model'],_0x11a916[_0x58b8('0x2f')]);_0x3ec101[_0x58b8('0x33')]=_[_0x58b8('0x32')](_0x11a916[_0x58b8('0x34')],qs[_0x58b8('0x35')](_0x5e66ea[_0x58b8('0x2f')]['fields']));_0x3ec101[_0x58b8('0x33')]=_0x3ec101[_0x58b8('0x33')][_0x58b8('0x36')]?_0x3ec101[_0x58b8('0x33')]:_0x11a916[_0x58b8('0x34')];if(!_0x5e66ea[_0x58b8('0x2f')][_0x58b8('0x37')](_0x58b8('0x38'))){_0x3ec101[_0x58b8('0x1b')]=qs[_0x58b8('0x1b')](_0x5e66ea['query']['limit']);_0x3ec101[_0x58b8('0x1d')]=qs[_0x58b8('0x1d')](_0x5e66ea[_0x58b8('0x2f')][_0x58b8('0x1d')]);}_0x3ec101[_0x58b8('0x39')]=qs[_0x58b8('0x3a')](_0x5e66ea[_0x58b8('0x2f')][_0x58b8('0x3a')]);_0x3ec101[_0x58b8('0x3b')]=qs[_0x58b8('0x31')](_[_0x58b8('0x3c')](_0x5e66ea[_0x58b8('0x2f')],_0x11a916['filters']),_0x4e4ced);if(_0x5e66ea[_0x58b8('0x2f')][_0x58b8('0x3d')]){_0x3ec101[_0x58b8('0x3b')]=_['merge'](_0x3ec101['where'],{'$or':_[_0x58b8('0x29')](_0x4e4ced,function(_0x28b17a){if(_0x28b17a[_0x58b8('0x2d')]!==_0x58b8('0x3e')){var _0x3a9976={};_0x3a9976[_0x28b17a[_0x58b8('0x26')]]={'$like':'%'+_0x5e66ea[_0x58b8('0x2f')]['filter']+'%'};return _0x3a9976;}})});}_0x3ec101=_['merge']({},_0x3ec101,_0x5e66ea[_0x58b8('0x3f')]);var _0x1a8fd3={'where':_0x3ec101[_0x58b8('0x3b')]};return db[_0x58b8('0x2a')][_0x58b8('0x1c')](_0x1a8fd3)[_0x58b8('0x23')](function(_0x2655fd){_0x374c13[_0x58b8('0x1c')]=_0x2655fd;if(_0x5e66ea[_0x58b8('0x2f')][_0x58b8('0x40')]){_0x3ec101[_0x58b8('0x41')]=[{'all':!![]}];}return db[_0x58b8('0x2a')]['findAll'](_0x3ec101);})[_0x58b8('0x23')](function(_0x4f6d3c){_0x374c13[_0x58b8('0x42')]=_0x4f6d3c;return _0x374c13;})['then'](respondWithFilteredResult(_0x29f9d3,_0x3ec101))[_0x58b8('0x43')](handleError(_0x29f9d3,null));};exports[_0x58b8('0x44')]=function(_0x55228f,_0x1881bd){var _0x399359={'raw':!![],'where':{'id':_0x55228f['params']['id']}},_0x686d84={};_0x686d84[_0x58b8('0x34')]=_[_0x58b8('0x30')](db[_0x58b8('0x2a')][_0x58b8('0x2b')]);_0x686d84[_0x58b8('0x2f')]=_[_0x58b8('0x30')](_0x55228f[_0x58b8('0x2f')]);_0x686d84[_0x58b8('0x31')]=_[_0x58b8('0x32')](_0x686d84[_0x58b8('0x34')],_0x686d84[_0x58b8('0x2f')]);_0x399359[_0x58b8('0x33')]=_[_0x58b8('0x32')](_0x686d84[_0x58b8('0x34')],qs['fields'](_0x55228f['query'][_0x58b8('0x35')]));_0x399359[_0x58b8('0x33')]=_0x399359[_0x58b8('0x33')][_0x58b8('0x36')]?_0x399359[_0x58b8('0x33')]:_0x686d84['model'];if(_0x55228f[_0x58b8('0x2f')]['includeAll']){_0x399359['include']=[{'all':!![]}];}_0x399359=_[_0x58b8('0x45')]({},_0x399359,_0x55228f['options']);return db[_0x58b8('0x2a')]['find'](_0x399359)[_0x58b8('0x23')](handleEntityNotFound(_0x1881bd,null))[_0x58b8('0x23')](respondWithResult(_0x1881bd,null))[_0x58b8('0x43')](handleError(_0x1881bd,null));};exports['create']=function(_0xe7e1c8,_0x222ce9){return db[_0x58b8('0x2a')]['create'](_0xe7e1c8[_0x58b8('0x46')],{})[_0x58b8('0x23')](respondWithResult(_0x222ce9,0xc9))[_0x58b8('0x43')](handleError(_0x222ce9,null));};exports[_0x58b8('0x47')]=function(_0x1a246c,_0x39d386){if(_0x1a246c[_0x58b8('0x46')]['id']){delete _0x1a246c[_0x58b8('0x46')]['id'];}return db['SquareRecording'][_0x58b8('0x48')]({'where':{'id':_0x1a246c[_0x58b8('0x49')]['id']}})[_0x58b8('0x23')](handleEntityNotFound(_0x39d386,null))['then'](saveUpdates(_0x1a246c[_0x58b8('0x46')],null))[_0x58b8('0x23')](respondWithResult(_0x39d386,null))[_0x58b8('0x43')](handleError(_0x39d386,null));};exports['download']=function(_0x132e80,_0x5aa68a,_0x1449b9){var _0x47a685=require(_0x58b8('0x4a'));var _0x1069fe=![];var _0x20290f={};if(_0x132e80['query'][_0x58b8('0x2d')]&&_0x132e80['query'][_0x58b8('0x2d')]==='uniqueid'){_0x20290f[_0x58b8('0x4b')]=_0x132e80['params']['id'];}else{_0x20290f['id']=_0x132e80['params']['id'];}return db[_0x58b8('0x2a')][_0x58b8('0x48')]({'where':_0x20290f,'attributes':['id','savePath',_0x58b8('0x4c')],'raw':!![]})[_0x58b8('0x23')](handleEntityNotFound(_0x5aa68a,null))[_0x58b8('0x23')](function(_0x3139fd){if(_0x3139fd){var _0x2c3d08=_0x3139fd[_0x58b8('0x4d')];var _0xfe4373=util[_0x58b8('0x4e')]('%s.cypher',_0x2c3d08);if(fs[_0x58b8('0x4f')](_0xfe4373)){_0x1069fe=!![];return _0x47a685['decryptFile'](_0xfe4373,_0x2c3d08,config[_0x58b8('0x50')]['recording'])[_0x58b8('0x23')](function(){return _0x3139fd;});}return _0x3139fd;}})[_0x58b8('0x23')](function(_0x31cd09){if(_0x31cd09){var _0x51b8ee=_0x31cd09[_0x58b8('0x4d')];if(!fs[_0x58b8('0x4f')](_0x51b8ee)){throw new db[(_0x58b8('0x51'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x31cd09['filename']){return _0x5aa68a['download'](_0x51b8ee,_0x31cd09['filename']+path[_0x58b8('0x52')](_0x51b8ee),function(){if(_0x1069fe){fs[_0x58b8('0x53')](_0x51b8ee);}});}else{return _0x5aa68a[_0x58b8('0x54')](_0x51b8ee,function(_0x1c2a73){if(_0x1069fe){fs['unlink'](_0x51b8ee);}});}}})[_0x58b8('0x43')](function(_0x4776d9){if(_0x4776d9[_0x58b8('0x55')]==='SquareRecording\x20not\x20found'){_0x5aa68a[_0x58b8('0x18')](0x194)['send'](_0x58b8('0x56'));}else{return handleError(_0x5aa68a,null);}});};exports[_0x58b8('0x57')]=function(_0x17d387,_0x237336){return db[_0x58b8('0x2a')][_0x58b8('0x48')]({'where':{'id':_0x17d387[_0x58b8('0x49')]['id']}})[_0x58b8('0x23')](function(_0x1007d1){if(_[_0x58b8('0x58')](_0x1007d1)){throw new ReferenceError(_0x58b8('0x59'));}return _0x1007d1;})['then'](function(_0x444d8c){var _0x3f22d1=_0x444d8c[_0x58b8('0x4d')];logger[_0x58b8('0x5a')](_0x58b8('0x5b'),_0x3f22d1);if(!_['isNil'](_0x444d8c[_0x58b8('0x4d')])&&fs['existsSync'](_0x3f22d1)){logger[_0x58b8('0x5a')](_0x58b8('0x5c')+_0x3f22d1+_0x58b8('0x5d'));fs[_0x58b8('0x5e')](_0x3f22d1);}_0x3f22d1=_0x3f22d1+'.cypher';if(!_[_0x58b8('0x58')](_0x444d8c[_0x58b8('0x4d')])&&fs['existsSync'](_0x3f22d1)){logger['info']('File:\x20\x22'+_0x3f22d1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3f22d1);}return _0x444d8c;})['then'](function(_0x3db640){if(!_0x3db640)throw new InternalError();return _0x3db640['destroy']();})[_0x58b8('0x23')](function(){_0x237336[_0x58b8('0x18')](0xcc)[_0x58b8('0x17')]();})['catch'](handleError(_0x237336,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index feebf50..6f9d63e 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 _0x1f2d=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x49e734,_0xc04f4f){var _0x2a2d42=function(_0x564e55){while(--_0x564e55){_0x49e734['push'](_0x49e734['shift']());}};_0x2a2d42(++_0xc04f4f);}(_0x1f2d,0x1c4));var _0xd1f2=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x1f2d[_0x1a3243];return _0x33f2ca;};'use strict';var _=require(_0xd1f2('0x0'));var util=require(_0xd1f2('0x1'));var logger=require(_0xd1f2('0x2'))(_0xd1f2('0x3'));var moment=require('moment');var BPromise=require(_0xd1f2('0x4'));var rp=require(_0xd1f2('0x5'));var fs=require('fs');var path=require(_0xd1f2('0x6'));var rimraf=require(_0xd1f2('0x7'));var config=require(_0xd1f2('0x8'));var attributes=require(_0xd1f2('0x9'));module[_0xd1f2('0xa')]=function(_0x185be2,_0x3e318d){return _0x185be2[_0xd1f2('0xb')](_0xd1f2('0xc'),attributes,{'tableName':_0xd1f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa329=['./squareRecording.attributes','exports','define','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x50d621,_0x8ebb63){var _0x4c4a8a=function(_0x249f0b){while(--_0x249f0b){_0x50d621['push'](_0x50d621['shift']());}};_0x4c4a8a(++_0x8ebb63);}(_0xa329,0x162));var _0x9a32=function(_0x5ad696,_0x2afd28){_0x5ad696=_0x5ad696-0x0;var _0x219c95=_0xa329[_0x5ad696];return _0x219c95;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var logger=require('../../config/logger')(_0x9a32('0x2'));var moment=require('moment');var BPromise=require(_0x9a32('0x3'));var rp=require(_0x9a32('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a32('0x5'));var attributes=require(_0x9a32('0x6'));module[_0x9a32('0x7')]=function(_0x21907f,_0x12735a){return _0x21907f[_0x9a32('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 96bc839..d2d91e0 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 _0x8c6b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','util','ioredis'];(function(_0x270141,_0x570788){var _0x32167e=function(_0x2d0587){while(--_0x2d0587){_0x270141['push'](_0x270141['shift']());}};_0x32167e(++_0x570788);}(_0x8c6b,0x19e));var _0xb8c6=function(_0x4a339c,_0x4eab70){_0x4a339c=_0x4a339c-0x0;var _0x3ddd0e=_0x8c6b[_0x4a339c];return _0x3ddd0e;};'use strict';var _=require('lodash');var util=require(_0xb8c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8c6('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8c6('0x2'))(_0xb8c6('0x3'));var config=require(_0xb8c6('0x4'));var jayson=require(_0xb8c6('0x5'));var client=jayson[_0xb8c6('0x6')][_0xb8c6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f8493,_0x233fb0,_0x4ede72){return new BPromise(function(_0x43522a,_0xa50639){return client[_0xb8c6('0x8')](_0x3f8493,_0x4ede72)['then'](function(_0x5a0912){logger[_0xb8c6('0x9')]('SquareRecording,\x20%s,\x20%s',_0x233fb0,_0xb8c6('0xa'));logger[_0xb8c6('0xb')](_0xb8c6('0xc'),_0x233fb0,_0xb8c6('0xa'),JSON[_0xb8c6('0xd')](_0x5a0912));if(_0x5a0912['error']){if(_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0xf')]===0x1f4){logger[_0xb8c6('0xe')](_0xb8c6('0x10'),_0x233fb0,_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0x11')]);return _0xa50639(_0x5a0912[_0xb8c6('0xe')]['message']);}logger['error'](_0xb8c6('0x10'),_0x233fb0,_0x5a0912[_0xb8c6('0xe')][_0xb8c6('0x11')]);return _0x43522a(_0x5a0912['error'][_0xb8c6('0x11')]);}else{logger[_0xb8c6('0x9')](_0xb8c6('0x10'),_0x233fb0,_0xb8c6('0xa'));_0x43522a(_0x5a0912['result'][_0xb8c6('0x11')]);}})[_0xb8c6('0x12')](function(_0x44c436){logger[_0xb8c6('0xe')](_0xb8c6('0x10'),_0x233fb0,_0x44c436);_0xa50639(_0x44c436);});});}exports[_0xb8c6('0x13')]=function(_0x2dece7){var _0x17ee50=this;return new Promise(function(_0x17eb4c,_0xc72ed3){return db[_0xb8c6('0x14')][_0xb8c6('0x15')](_0x2dece7[_0xb8c6('0x16')],{'raw':_0x2dece7[_0xb8c6('0x17')]?_0x2dece7['options'][_0xb8c6('0x18')]===undefined?!![]:![]:!![]})[_0xb8c6('0x19')](function(_0x3db728){logger[_0xb8c6('0x9')](_0xb8c6('0x13'),_0x2dece7);logger[_0xb8c6('0xb')]('CreateSquareRecording',_0x2dece7,JSON[_0xb8c6('0xd')](_0x3db728));_0x17eb4c(_0x3db728);})['catch'](function(_0x17e9b5){logger[_0xb8c6('0xe')](_0xb8c6('0x13'),_0x17e9b5[_0xb8c6('0x11')],_0x2dece7);_0xc72ed3(_0x17ee50[_0xb8c6('0xe')](0x1f4,_0x17e9b5['message']));});});}; \ No newline at end of file +var _0x894d=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4ac24c,_0x2791b9){var _0x3961b0=function(_0x56db82){while(--_0x56db82){_0x4ac24c['push'](_0x4ac24c['shift']());}};_0x3961b0(++_0x2791b9);}(_0x894d,0x136));var _0xd894=function(_0x8e85da,_0x123600){_0x8e85da=_0x8e85da-0x0;var _0x419c05=_0x894d[_0x8e85da];return _0x419c05;};'use strict';var _=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var moment=require(_0xd894('0x2'));var BPromise=require(_0xd894('0x3'));var rs=require(_0xd894('0x4'));var fs=require('fs');var Redis=require(_0xd894('0x5'));var db=require(_0xd894('0x6'))['db'];var utils=require(_0xd894('0x7'));var logger=require('../../config/logger')(_0xd894('0x8'));var config=require(_0xd894('0x9'));var jayson=require(_0xd894('0xa'));var client=jayson[_0xd894('0xb')][_0xd894('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41efa8,_0x434e74,_0x45d4e7){return new BPromise(function(_0x15599c,_0x4a3825){return client[_0xd894('0xd')](_0x41efa8,_0x45d4e7)['then'](function(_0x44d76d){logger[_0xd894('0xe')](_0xd894('0xf'),_0x434e74,_0xd894('0x10'));logger['debug'](_0xd894('0x11'),_0x434e74,'request\x20sent',JSON[_0xd894('0x12')](_0x44d76d));if(_0x44d76d[_0xd894('0x13')]){if(_0x44d76d[_0xd894('0x13')][_0xd894('0x14')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x434e74,_0x44d76d['error'][_0xd894('0x15')]);return _0x4a3825(_0x44d76d[_0xd894('0x13')][_0xd894('0x15')]);}logger[_0xd894('0x13')](_0xd894('0xf'),_0x434e74,_0x44d76d['error'][_0xd894('0x15')]);return _0x15599c(_0x44d76d['error']['message']);}else{logger[_0xd894('0xe')](_0xd894('0xf'),_0x434e74,_0xd894('0x10'));_0x15599c(_0x44d76d[_0xd894('0x16')][_0xd894('0x15')]);}})[_0xd894('0x17')](function(_0x52e0b3){logger['error'](_0xd894('0xf'),_0x434e74,_0x52e0b3);_0x4a3825(_0x52e0b3);});});}exports[_0xd894('0x18')]=function(_0x53d884){var _0xe264b6=this;return new Promise(function(_0xb83906,_0x127f91){return db[_0xd894('0x19')][_0xd894('0x1a')](_0x53d884[_0xd894('0x1b')],{'raw':_0x53d884[_0xd894('0x1c')]?_0x53d884['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4f57a1){logger[_0xd894('0xe')](_0xd894('0x18'),_0x53d884);logger[_0xd894('0x1d')](_0xd894('0x18'),_0x53d884,JSON['stringify'](_0x4f57a1));_0xb83906(_0x4f57a1);})[_0xd894('0x17')](function(_0x3d1a5f){logger['error'](_0xd894('0x18'),_0x3d1a5f['message'],_0x53d884);_0x127f91(_0xe264b6[_0xd894('0x13')](0x1f4,_0x3d1a5f[_0xd894('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d1346e5..df13b98 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index da0803e..e3324c9 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 _0xd175=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x26a57f,_0x1cef6c){var _0x26757e=function(_0x334918){while(--_0x334918){_0x26a57f['push'](_0x26a57f['shift']());}};_0x26757e(++_0x1cef6c);}(_0xd175,0x1ed));var _0x5d17=function(_0x5a0a90,_0x57bb44){_0x5a0a90=_0x5a0a90-0x0;var _0x5acabc=_0xd175[_0x5a0a90];return _0x5acabc;};'use strict';var Sequelize=require(_0x5d17('0x0'));module['exports']={'network':{'type':Sequelize[_0x5d17('0x1')]},'network_script':{'type':Sequelize[_0x5d17('0x1')]},'request':{'type':Sequelize[_0x5d17('0x1')]},'channel':{'type':Sequelize[_0x5d17('0x1')]},'language':{'type':Sequelize[_0x5d17('0x1')]},'type':{'type':Sequelize[_0x5d17('0x1')]},'uniqueid':{'type':Sequelize[_0x5d17('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d17('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5d17('0x1')]},'callington':{'type':Sequelize[_0x5d17('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x5d17('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5d17('0x1')]},'threadid':{'type':Sequelize[_0x5d17('0x1')]},'project_name':{'type':Sequelize[_0x5d17('0x1')]},'joinAt':{'type':Sequelize[_0x5d17('0x2')]},'leaveAt':{'type':Sequelize[_0x5d17('0x2')]},'bot':{'type':Sequelize[_0x5d17('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4ce1=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x52785f,_0x2ce125){var _0x5adebb=function(_0x3956eb){while(--_0x3956eb){_0x52785f['push'](_0x52785f['shift']());}};_0x5adebb(++_0x2ce125);}(_0x4ce1,0xca));var _0x14ce=function(_0x2797a6,_0xcae5e8){_0x2797a6=_0x2797a6-0x0;var _0xe9be5b=_0x4ce1[_0x2797a6];return _0xe9be5b;};'use strict';var Sequelize=require(_0x14ce('0x0'));module['exports']={'network':{'type':Sequelize[_0x14ce('0x1')]},'network_script':{'type':Sequelize[_0x14ce('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x14ce('0x1')]},'language':{'type':Sequelize[_0x14ce('0x1')]},'type':{'type':Sequelize[_0x14ce('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x14ce('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x14ce('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x14ce('0x1')]},'callingtns':{'type':Sequelize[_0x14ce('0x1')]},'dnid':{'type':Sequelize[_0x14ce('0x1')]},'rdnis':{'type':Sequelize[_0x14ce('0x1')]},'context':{'type':Sequelize[_0x14ce('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x14ce('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x14ce('0x1')]},'project_name':{'type':Sequelize[_0x14ce('0x1')]},'joinAt':{'type':Sequelize[_0x14ce('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x14ce('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 51dc4ca..b3fe7fd 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 _0x45a2=['path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','include','findAll','rows','show','params','keys','filters','options','find','catch','update','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x67e7e3,_0x4b126c){var _0x24bbde=function(_0x4bbc90){while(--_0x4bbc90){_0x67e7e3['push'](_0x67e7e3['shift']());}};_0x24bbde(++_0x4b126c);}(_0x45a2,0x1c6));var _0x245a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x45a2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x245a('0x0'));var zipdir=require(_0x245a('0x1'));var jsonpatch=require(_0x245a('0x2'));var rp=require(_0x245a('0x3'));var moment=require(_0x245a('0x4'));var BPromise=require(_0x245a('0x5'));var Mustache=require(_0x245a('0x6'));var util=require(_0x245a('0x7'));var path=require(_0x245a('0x8'));var sox=require(_0x245a('0x9'));var csv=require(_0x245a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x245a('0xb'));var _=require('lodash');var squel=require(_0x245a('0xc'));var crypto=require(_0x245a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x245a('0xe'));var toCsv=require(_0x245a('0xa'));var querystring=require(_0x245a('0xf'));var Papa=require(_0x245a('0x10'));var Redis=require(_0x245a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x245a('0x12'));var as=require(_0x245a('0x13'));var hardwareService=require(_0x245a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x245a('0x15'));var config=require(_0x245a('0x16'));var licenseUtil=require(_0x245a('0x17'));var db=require(_0x245a('0x18'))['db'];function respondWithStatusCode(_0x111b05,_0x1b970c){_0x1b970c=_0x1b970c||0xcc;return function(_0x164608){if(_0x164608){return _0x111b05[_0x245a('0x19')](_0x1b970c);}return _0x111b05['status'](_0x1b970c)[_0x245a('0x1a')]();};}function respondWithResult(_0x2a316f,_0x1d997f){_0x1d997f=_0x1d997f||0xc8;return function(_0xba2247){if(_0xba2247){return _0x2a316f['status'](_0x1d997f)[_0x245a('0x1b')](_0xba2247);}};}function respondWithFilteredResult(_0x44b882,_0x41328d){return function(_0x42de1e){if(_0x42de1e){var _0xf3d2ca=typeof _0x41328d[_0x245a('0x1c')]===_0x245a('0x1d')&&typeof _0x41328d['limit']===_0x245a('0x1d');var _0x4bd205=_0x42de1e['count'];var _0x104306=_0xf3d2ca?0x0:_0x41328d[_0x245a('0x1c')];var _0x23aee5=_0xf3d2ca?_0x42de1e[_0x245a('0x1e')]:_0x41328d[_0x245a('0x1c')]+_0x41328d['limit'];var _0x1b7b72;if(_0x23aee5>=_0x4bd205){_0x23aee5=_0x4bd205;_0x1b7b72=0xc8;}else{_0x1b7b72=0xce;}_0x44b882[_0x245a('0x1f')](_0x1b7b72);return _0x44b882[_0x245a('0x20')](_0x245a('0x21'),_0x104306+'-'+_0x23aee5+'/'+_0x4bd205)[_0x245a('0x1b')](_0x42de1e);}return null;};}function patchUpdates(_0x4b4679){return function(_0x34c953){try{jsonpatch['apply'](_0x34c953,_0x4b4679,!![]);}catch(_0x129fab){return BPromise[_0x245a('0x22')](_0x129fab);}return _0x34c953[_0x245a('0x23')]();};}function saveUpdates(_0x28cd2a,_0x58fdda){return function(_0x3b24a3){if(_0x3b24a3){return _0x3b24a3['update'](_0x28cd2a)[_0x245a('0x24')](function(_0x24e437){return _0x24e437;});}return null;};}function removeEntity(_0x1d664b,_0x354c3f){return function(_0x20a7e7){if(_0x20a7e7){return _0x20a7e7[_0x245a('0x25')]()[_0x245a('0x24')](function(){_0x1d664b[_0x245a('0x1f')](0xcc)[_0x245a('0x1a')]();});}};}function handleEntityNotFound(_0x4d04c9,_0x101b43){return function(_0x168df5){if(!_0x168df5){_0x4d04c9[_0x245a('0x19')](0x194);}return _0x168df5;};}function handleError(_0x10b47f,_0x474fbc){_0x474fbc=_0x474fbc||0x1f4;return function(_0x24e167){logger[_0x245a('0x26')](_0x24e167[_0x245a('0x27')]);if(_0x24e167[_0x245a('0x28')]){delete _0x24e167[_0x245a('0x28')];}_0x10b47f[_0x245a('0x1f')](_0x474fbc)['send'](_0x24e167);};}exports[_0x245a('0x29')]=function(_0x52f2fe,_0x21cb93){var _0x32d761={},_0x27d704={},_0x26db95={'count':0x0,'rows':[]};var _0x24d30e=_[_0x245a('0x2a')](db['SquareReport'][_0x245a('0x2b')],function(_0x15ee4a){return{'name':_0x15ee4a[_0x245a('0x2c')],'type':_0x15ee4a[_0x245a('0x2d')][_0x245a('0x2e')]};});_0x27d704[_0x245a('0x2f')]=_[_0x245a('0x2a')](_0x24d30e,'name');_0x27d704[_0x245a('0x30')]=_['keys'](_0x52f2fe['query']);_0x27d704['filters']=_[_0x245a('0x31')](_0x27d704['model'],_0x27d704['query']);_0x32d761[_0x245a('0x32')]=_[_0x245a('0x31')](_0x27d704[_0x245a('0x2f')],qs[_0x245a('0x33')](_0x52f2fe[_0x245a('0x30')][_0x245a('0x33')]));_0x32d761['attributes']=_0x32d761[_0x245a('0x32')][_0x245a('0x34')]?_0x32d761['attributes']:_0x27d704['model'];if(!_0x52f2fe['query']['hasOwnProperty'](_0x245a('0x35'))){_0x32d761[_0x245a('0x36')]=qs[_0x245a('0x36')](_0x52f2fe[_0x245a('0x30')][_0x245a('0x36')]);_0x32d761[_0x245a('0x1c')]=qs[_0x245a('0x1c')](_0x52f2fe['query'][_0x245a('0x1c')]);}_0x32d761[_0x245a('0x37')]=qs['sort'](_0x52f2fe[_0x245a('0x30')][_0x245a('0x38')]);_0x32d761['where']=qs['filters'](_[_0x245a('0x39')](_0x52f2fe[_0x245a('0x30')],_0x27d704['filters']),_0x24d30e);if(_0x52f2fe[_0x245a('0x30')][_0x245a('0x3a')]){_0x32d761[_0x245a('0x3b')]=_[_0x245a('0x3c')](_0x32d761[_0x245a('0x3b')],{'$or':_['map'](_0x24d30e,function(_0x45405c){if(_0x45405c[_0x245a('0x2d')]!==_0x245a('0x3d')){var _0x29fbd8={};_0x29fbd8[_0x45405c[_0x245a('0x28')]]={'$like':'%'+_0x52f2fe[_0x245a('0x30')]['filter']+'%'};return _0x29fbd8;}})});}_0x32d761=_[_0x245a('0x3c')]({},_0x32d761,_0x52f2fe['options']);var _0x55e093={'where':_0x32d761['where']};return db[_0x245a('0x3e')][_0x245a('0x1e')](_0x55e093)[_0x245a('0x24')](function(_0x6f7b46){_0x26db95[_0x245a('0x1e')]=_0x6f7b46;if(_0x52f2fe['query'][_0x245a('0x3f')]){_0x32d761[_0x245a('0x40')]=[{'all':!![]}];}return db['SquareReport'][_0x245a('0x41')](_0x32d761);})[_0x245a('0x24')](function(_0x4ae525){_0x26db95[_0x245a('0x42')]=_0x4ae525;return _0x26db95;})['then'](respondWithFilteredResult(_0x21cb93,_0x32d761))['catch'](handleError(_0x21cb93,null));};exports[_0x245a('0x43')]=function(_0x1e6a37,_0x5ad5e8){var _0x904940={'raw':!![],'where':{'id':_0x1e6a37[_0x245a('0x44')]['id']}},_0x59231b={};_0x59231b['model']=_[_0x245a('0x45')](db[_0x245a('0x3e')]['rawAttributes']);_0x59231b[_0x245a('0x30')]=_[_0x245a('0x45')](_0x1e6a37[_0x245a('0x30')]);_0x59231b[_0x245a('0x46')]=_[_0x245a('0x31')](_0x59231b[_0x245a('0x2f')],_0x59231b[_0x245a('0x30')]);_0x904940[_0x245a('0x32')]=_['intersection'](_0x59231b[_0x245a('0x2f')],qs[_0x245a('0x33')](_0x1e6a37[_0x245a('0x30')][_0x245a('0x33')]));_0x904940[_0x245a('0x32')]=_0x904940[_0x245a('0x32')][_0x245a('0x34')]?_0x904940['attributes']:_0x59231b['model'];if(_0x1e6a37[_0x245a('0x30')][_0x245a('0x3f')]){_0x904940[_0x245a('0x40')]=[{'all':!![]}];}_0x904940=_[_0x245a('0x3c')]({},_0x904940,_0x1e6a37[_0x245a('0x47')]);return db[_0x245a('0x3e')][_0x245a('0x48')](_0x904940)[_0x245a('0x24')](handleEntityNotFound(_0x5ad5e8,null))['then'](respondWithResult(_0x5ad5e8,null))['catch'](handleError(_0x5ad5e8,null));};exports['create']=function(_0x255086,_0xfa0bfb){return db[_0x245a('0x3e')]['create'](_0x255086['body'],{})[_0x245a('0x24')](respondWithResult(_0xfa0bfb,0xc9))[_0x245a('0x49')](handleError(_0xfa0bfb,null));};exports[_0x245a('0x4a')]=function(_0x3699d6,_0x5a41cc){if(_0x3699d6[_0x245a('0x4b')]['id']){delete _0x3699d6[_0x245a('0x4b')]['id'];}return db[_0x245a('0x3e')]['find']({'where':{'id':_0x3699d6[_0x245a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a41cc,null))[_0x245a('0x24')](saveUpdates(_0x3699d6[_0x245a('0x4b')],null))['then'](respondWithResult(_0x5a41cc,null))['catch'](handleError(_0x5a41cc,null));};exports['destroy']=function(_0x32eb50,_0x330ae7){return db[_0x245a('0x3e')][_0x245a('0x48')]({'where':{'id':_0x32eb50[_0x245a('0x44')]['id']}})[_0x245a('0x24')](handleEntityNotFound(_0x330ae7,null))[_0x245a('0x24')](removeEntity(_0x330ae7,null))['catch'](handleError(_0x330ae7,null));};exports[_0x245a('0x4c')]=function(_0x12ecc2,_0x1353a5){return db[_0x245a('0x3e')][_0x245a('0x4c')]()['then'](respondWithResult(_0x1353a5,null))[_0x245a('0x49')](handleError(_0x1353a5,null));}; \ No newline at end of file +var _0x192f=['limit','count','set','json','apply','update','then','destroy','sendStatus','error','name','index','map','SquareReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x192f,0x1c8));var _0xf192=function(_0x55f04b,_0x4967ba){_0x55f04b=_0x55f04b-0x0;var _0x907b12=_0x192f[_0x55f04b];return _0x907b12;};'use strict';var emlformat=require(_0xf192('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf192('0x1'));var rp=require(_0xf192('0x2'));var moment=require(_0xf192('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf192('0x4'));var util=require(_0xf192('0x5'));var path=require(_0xf192('0x6'));var sox=require(_0xf192('0x7'));var csv=require(_0xf192('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf192('0x9'));var _=require('lodash');var squel=require(_0xf192('0xa'));var crypto=require('crypto');var jsforce=require(_0xf192('0xb'));var deskjs=require(_0xf192('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf192('0xd'));var Papa=require(_0xf192('0xe'));var Redis=require(_0xf192('0xf'));var authService=require(_0xf192('0x10'));var qs=require(_0xf192('0x11'));var as=require(_0xf192('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf192('0x13'))('api');var utils=require(_0xf192('0x14'));var config=require(_0xf192('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf192('0x16'))['db'];function respondWithStatusCode(_0xf950af,_0x41e1a7){_0x41e1a7=_0x41e1a7||0xcc;return function(_0x32560e){if(_0x32560e){return _0xf950af['sendStatus'](_0x41e1a7);}return _0xf950af['status'](_0x41e1a7)[_0xf192('0x17')]();};}function respondWithResult(_0x5b277c,_0x4866d1){_0x4866d1=_0x4866d1||0xc8;return function(_0x1a5285){if(_0x1a5285){return _0x5b277c[_0xf192('0x18')](_0x4866d1)['json'](_0x1a5285);}};}function respondWithFilteredResult(_0x2d21ad,_0x4fce08){return function(_0x106999){if(_0x106999){var _0x1304ce=typeof _0x4fce08[_0xf192('0x19')]===_0xf192('0x1a')&&typeof _0x4fce08[_0xf192('0x1b')]===_0xf192('0x1a');var _0x58e8d3=_0x106999[_0xf192('0x1c')];var _0x574247=_0x1304ce?0x0:_0x4fce08['offset'];var _0xb762bd=_0x1304ce?_0x106999[_0xf192('0x1c')]:_0x4fce08[_0xf192('0x19')]+_0x4fce08['limit'];var _0x1b34ae;if(_0xb762bd>=_0x58e8d3){_0xb762bd=_0x58e8d3;_0x1b34ae=0xc8;}else{_0x1b34ae=0xce;}_0x2d21ad[_0xf192('0x18')](_0x1b34ae);return _0x2d21ad[_0xf192('0x1d')]('Content-Range',_0x574247+'-'+_0xb762bd+'/'+_0x58e8d3)[_0xf192('0x1e')](_0x106999);}return null;};}function patchUpdates(_0x23bc01){return function(_0x342f55){try{jsonpatch[_0xf192('0x1f')](_0x342f55,_0x23bc01,!![]);}catch(_0x502241){return BPromise['reject'](_0x502241);}return _0x342f55['save']();};}function saveUpdates(_0x36165d,_0x5cafb9){return function(_0x381375){if(_0x381375){return _0x381375[_0xf192('0x20')](_0x36165d)[_0xf192('0x21')](function(_0x44393b){return _0x44393b;});}return null;};}function removeEntity(_0x5bd8d3,_0x3f84fb){return function(_0x24bff5){if(_0x24bff5){return _0x24bff5[_0xf192('0x22')]()['then'](function(){_0x5bd8d3[_0xf192('0x18')](0xcc)[_0xf192('0x17')]();});}};}function handleEntityNotFound(_0x2814ca,_0x2fc9a7){return function(_0x4f3617){if(!_0x4f3617){_0x2814ca[_0xf192('0x23')](0x194);}return _0x4f3617;};}function handleError(_0x300fef,_0x4517f9){_0x4517f9=_0x4517f9||0x1f4;return function(_0x37474e){logger[_0xf192('0x24')](_0x37474e['stack']);if(_0x37474e[_0xf192('0x25')]){delete _0x37474e[_0xf192('0x25')];}_0x300fef['status'](_0x4517f9)['send'](_0x37474e);};}exports[_0xf192('0x26')]=function(_0x34c302,_0x2311dd){var _0x4da134={},_0x3cf048={},_0x2fee82={'count':0x0,'rows':[]};var _0x40435f=_[_0xf192('0x27')](db[_0xf192('0x28')]['rawAttributes'],function(_0x1b2bd3){return{'name':_0x1b2bd3['fieldName'],'type':_0x1b2bd3[_0xf192('0x29')][_0xf192('0x2a')]};});_0x3cf048[_0xf192('0x2b')]=_['map'](_0x40435f,_0xf192('0x25'));_0x3cf048[_0xf192('0x2c')]=_[_0xf192('0x2d')](_0x34c302['query']);_0x3cf048[_0xf192('0x2e')]=_['intersection'](_0x3cf048[_0xf192('0x2b')],_0x3cf048[_0xf192('0x2c')]);_0x4da134[_0xf192('0x2f')]=_[_0xf192('0x30')](_0x3cf048[_0xf192('0x2b')],qs[_0xf192('0x31')](_0x34c302[_0xf192('0x2c')][_0xf192('0x31')]));_0x4da134[_0xf192('0x2f')]=_0x4da134[_0xf192('0x2f')][_0xf192('0x32')]?_0x4da134[_0xf192('0x2f')]:_0x3cf048[_0xf192('0x2b')];if(!_0x34c302[_0xf192('0x2c')]['hasOwnProperty'](_0xf192('0x33'))){_0x4da134[_0xf192('0x1b')]=qs['limit'](_0x34c302['query']['limit']);_0x4da134[_0xf192('0x19')]=qs[_0xf192('0x19')](_0x34c302['query'][_0xf192('0x19')]);}_0x4da134[_0xf192('0x34')]=qs['sort'](_0x34c302[_0xf192('0x2c')]['sort']);_0x4da134[_0xf192('0x35')]=qs[_0xf192('0x2e')](_['pick'](_0x34c302[_0xf192('0x2c')],_0x3cf048[_0xf192('0x2e')]),_0x40435f);if(_0x34c302[_0xf192('0x2c')]['filter']){_0x4da134['where']=_['merge'](_0x4da134['where'],{'$or':_[_0xf192('0x27')](_0x40435f,function(_0x399a2c){if(_0x399a2c[_0xf192('0x29')]!==_0xf192('0x36')){var _0x2c7e20={};_0x2c7e20[_0x399a2c['name']]={'$like':'%'+_0x34c302[_0xf192('0x2c')][_0xf192('0x37')]+'%'};return _0x2c7e20;}})});}_0x4da134=_[_0xf192('0x38')]({},_0x4da134,_0x34c302[_0xf192('0x39')]);var _0x3c3a3a={'where':_0x4da134[_0xf192('0x35')]};return db[_0xf192('0x28')][_0xf192('0x1c')](_0x3c3a3a)[_0xf192('0x21')](function(_0x316c59){_0x2fee82['count']=_0x316c59;if(_0x34c302[_0xf192('0x2c')][_0xf192('0x3a')]){_0x4da134[_0xf192('0x3b')]=[{'all':!![]}];}return db[_0xf192('0x28')][_0xf192('0x3c')](_0x4da134);})[_0xf192('0x21')](function(_0x2fc907){_0x2fee82[_0xf192('0x3d')]=_0x2fc907;return _0x2fee82;})[_0xf192('0x21')](respondWithFilteredResult(_0x2311dd,_0x4da134))['catch'](handleError(_0x2311dd,null));};exports['show']=function(_0x56e40a,_0x21a5e8){var _0x31dabe={'raw':!![],'where':{'id':_0x56e40a[_0xf192('0x3e')]['id']}},_0x39f2a1={};_0x39f2a1[_0xf192('0x2b')]=_[_0xf192('0x2d')](db[_0xf192('0x28')][_0xf192('0x3f')]);_0x39f2a1[_0xf192('0x2c')]=_[_0xf192('0x2d')](_0x56e40a[_0xf192('0x2c')]);_0x39f2a1[_0xf192('0x2e')]=_[_0xf192('0x30')](_0x39f2a1[_0xf192('0x2b')],_0x39f2a1['query']);_0x31dabe[_0xf192('0x2f')]=_['intersection'](_0x39f2a1[_0xf192('0x2b')],qs['fields'](_0x56e40a[_0xf192('0x2c')][_0xf192('0x31')]));_0x31dabe[_0xf192('0x2f')]=_0x31dabe[_0xf192('0x2f')][_0xf192('0x32')]?_0x31dabe[_0xf192('0x2f')]:_0x39f2a1[_0xf192('0x2b')];if(_0x56e40a[_0xf192('0x2c')][_0xf192('0x3a')]){_0x31dabe[_0xf192('0x3b')]=[{'all':!![]}];}_0x31dabe=_[_0xf192('0x38')]({},_0x31dabe,_0x56e40a[_0xf192('0x39')]);return db[_0xf192('0x28')][_0xf192('0x40')](_0x31dabe)[_0xf192('0x21')](handleEntityNotFound(_0x21a5e8,null))[_0xf192('0x21')](respondWithResult(_0x21a5e8,null))[_0xf192('0x41')](handleError(_0x21a5e8,null));};exports[_0xf192('0x42')]=function(_0x53eaac,_0x905a9e){return db[_0xf192('0x28')][_0xf192('0x42')](_0x53eaac[_0xf192('0x43')],{})[_0xf192('0x21')](respondWithResult(_0x905a9e,0xc9))[_0xf192('0x41')](handleError(_0x905a9e,null));};exports['update']=function(_0x505801,_0x3dbbd9){if(_0x505801[_0xf192('0x43')]['id']){delete _0x505801['body']['id'];}return db[_0xf192('0x28')]['find']({'where':{'id':_0x505801[_0xf192('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3dbbd9,null))[_0xf192('0x21')](saveUpdates(_0x505801[_0xf192('0x43')],null))[_0xf192('0x21')](respondWithResult(_0x3dbbd9,null))[_0xf192('0x41')](handleError(_0x3dbbd9,null));};exports['destroy']=function(_0x50fc39,_0x5d60db){return db[_0xf192('0x28')]['find']({'where':{'id':_0x50fc39['params']['id']}})[_0xf192('0x21')](handleEntityNotFound(_0x5d60db,null))[_0xf192('0x21')](removeEntity(_0x5d60db,null))[_0xf192('0x41')](handleError(_0x5d60db,null));};exports[_0xf192('0x44')]=function(_0x59036c,_0x1dc49d){return db[_0xf192('0x28')][_0xf192('0x44')]()['then'](respondWithResult(_0x1dc49d,null))[_0xf192('0x41')](handleError(_0x1dc49d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 06fef03..ea99a4e 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 _0xf0a2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0a2,0x168));var _0x2f0a=function(_0x58fa7d,_0x111070){_0x58fa7d=_0x58fa7d-0x0;var _0x29b308=_0xf0a2[_0x58fa7d];return _0x29b308;};'use strict';var _=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var logger=require(_0x2f0a('0x2'))(_0x2f0a('0x3'));var moment=require(_0x2f0a('0x4'));var BPromise=require(_0x2f0a('0x5'));var rp=require(_0x2f0a('0x6'));var fs=require('fs');var path=require(_0x2f0a('0x7'));var rimraf=require(_0x2f0a('0x8'));var config=require(_0x2f0a('0x9'));var attributes=require(_0x2f0a('0xa'));module[_0x2f0a('0xb')]=function(_0x48a041,_0x55e914){return _0x48a041['define'](_0x2f0a('0xc'),attributes,{'tableName':_0x2f0a('0xd'),'paranoid':![],'indexes':[{'name':_0x2f0a('0xe'),'fields':[_0x2f0a('0xf'),_0x2f0a('0x10')]},{'name':_0x2f0a('0x11'),'fields':[_0x2f0a('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x184c=['api','bluebird','request-promise','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x2cfbe7,_0x4f5f10){var _0x519321=function(_0x19258d){while(--_0x19258d){_0x2cfbe7['push'](_0x2cfbe7['shift']());}};_0x519321(++_0x4f5f10);}(_0x184c,0x18d));var _0xc184=function(_0x540bd3,_0x10532d){_0x540bd3=_0x540bd3-0x0;var _0x3bfbc1=_0x184c[_0x540bd3];return _0x3bfbc1;};'use strict';var _=require(_0xc184('0x0'));var util=require(_0xc184('0x1'));var logger=require(_0xc184('0x2'))(_0xc184('0x3'));var moment=require('moment');var BPromise=require(_0xc184('0x4'));var rp=require(_0xc184('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc184('0x6'));var config=require('../../config/environment');var attributes=require(_0xc184('0x7'));module[_0xc184('0x8')]=function(_0x4d43dd,_0x450798){return _0x4d43dd[_0xc184('0x9')](_0xc184('0xa'),attributes,{'tableName':_0xc184('0xb'),'paranoid':![],'indexes':[{'name':_0xc184('0xc'),'fields':[_0xc184('0xd'),_0xc184('0xe')]},{'name':_0xc184('0xf'),'fields':[_0xc184('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 83ce248..b5ddb0b 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 _0x16e7=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x16e7,0x17c));var _0x716e=function(_0x2ff44b,_0x7e8762){_0x2ff44b=_0x2ff44b-0x0;var _0x18dbb0=_0x16e7[_0x2ff44b];return _0x18dbb0;};'use strict';var _=require('lodash');var util=require(_0x716e('0x0'));var moment=require(_0x716e('0x1'));var BPromise=require(_0x716e('0x2'));var rs=require(_0x716e('0x3'));var fs=require('fs');var Redis=require(_0x716e('0x4'));var db=require(_0x716e('0x5'))['db'];var utils=require(_0x716e('0x6'));var logger=require('../../config/logger')(_0x716e('0x7'));var config=require(_0x716e('0x8'));var jayson=require(_0x716e('0x9'));var client=jayson[_0x716e('0xa')][_0x716e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x344bc0,_0x5ee1ac,_0x25fa84){return new BPromise(function(_0x26cfe5,_0x404a9e){return client[_0x716e('0xc')](_0x344bc0,_0x25fa84)[_0x716e('0xd')](function(_0x187987){logger[_0x716e('0xe')](_0x716e('0xf'),_0x5ee1ac,_0x716e('0x10'));logger[_0x716e('0x11')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5ee1ac,'request\x20sent',JSON[_0x716e('0x12')](_0x187987));if(_0x187987[_0x716e('0x13')]){if(_0x187987[_0x716e('0x13')][_0x716e('0x14')]===0x1f4){logger['error'](_0x716e('0xf'),_0x5ee1ac,_0x187987[_0x716e('0x13')]['message']);return _0x404a9e(_0x187987[_0x716e('0x13')][_0x716e('0x15')]);}logger['error'](_0x716e('0xf'),_0x5ee1ac,_0x187987[_0x716e('0x13')][_0x716e('0x15')]);return _0x26cfe5(_0x187987['error'][_0x716e('0x15')]);}else{logger['info'](_0x716e('0xf'),_0x5ee1ac,'request\x20sent');_0x26cfe5(_0x187987[_0x716e('0x16')][_0x716e('0x15')]);}})['catch'](function(_0x53b74b){logger[_0x716e('0x13')](_0x716e('0xf'),_0x5ee1ac,_0x53b74b);_0x404a9e(_0x53b74b);});});}exports[_0x716e('0x17')]=function(_0x51b3bb){var _0x1ca97a=this;return new Promise(function(_0x3d0590,_0x243604){return db[_0x716e('0x18')][_0x716e('0x19')](_0x51b3bb[_0x716e('0x1a')],{'raw':_0x51b3bb[_0x716e('0x1b')]?_0x51b3bb['options']['raw']===undefined?!![]:![]:!![]})[_0x716e('0xd')](function(_0x265133){logger[_0x716e('0xe')](_0x716e('0x17'),_0x51b3bb);logger['debug']('CreateSquareReport',_0x51b3bb,JSON['stringify'](_0x265133));_0x3d0590(_0x265133);})['catch'](function(_0x33de92){logger[_0x716e('0x13')]('CreateSquareReport',_0x33de92[_0x716e('0x15')],_0x51b3bb);_0x243604(_0x1ca97a[_0x716e('0x13')](0x1f4,_0x33de92['message']));});});};exports[_0x716e('0x1c')]=function(_0x570dcc){var _0x21a57a=this;return new Promise(function(_0x6b1319,_0x2edcf4){return db[_0x716e('0x18')][_0x716e('0x1d')](_0x570dcc[_0x716e('0x1a')],{'raw':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x1f')]||null:null,'attributes':_0x570dcc[_0x716e('0x1b')]?_0x570dcc[_0x716e('0x1b')][_0x716e('0x20')]||null:null,'limit':_0x570dcc[_0x716e('0x1b')]?_0x570dcc['options'][_0x716e('0x21')]||null:null})[_0x716e('0xd')](function(_0x239da8){logger['info'](_0x716e('0x1c'),_0x570dcc);logger['debug'](_0x716e('0x1c'),_0x570dcc,JSON[_0x716e('0x12')](_0x239da8));_0x6b1319(_0x239da8);})[_0x716e('0x22')](function(_0x28f3c0){logger[_0x716e('0x13')](_0x716e('0x1c'),_0x28f3c0[_0x716e('0x15')],_0x570dcc);_0x2edcf4(_0x21a57a[_0x716e('0x13')](0x1f4,_0x28f3c0[_0x716e('0x15')]));});});}; \ No newline at end of file +var _0x43f9=['create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','info','request\x20sent','catch','CreateSquareReport','SquareReport'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x43f9,0x167));var _0x943f=function(_0x21d77a,_0x11b7fe){_0x21d77a=_0x21d77a-0x0;var _0x4c95fa=_0x43f9[_0x21d77a];return _0x4c95fa;};'use strict';var _=require(_0x943f('0x0'));var util=require(_0x943f('0x1'));var moment=require(_0x943f('0x2'));var BPromise=require(_0x943f('0x3'));var rs=require(_0x943f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x943f('0x5'));var logger=require(_0x943f('0x6'))(_0x943f('0x7'));var config=require(_0x943f('0x8'));var jayson=require(_0x943f('0x9'));var client=jayson[_0x943f('0xa')][_0x943f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2751e1,_0x444656,_0x532595){return new BPromise(function(_0x1cbd1f,_0x4e3430){return client[_0x943f('0xc')](_0x2751e1,_0x532595)[_0x943f('0xd')](function(_0xd8b310){logger['info']('SquareReport,\x20%s,\x20%s',_0x444656,'request\x20sent');logger[_0x943f('0xe')](_0x943f('0xf'),_0x444656,'request\x20sent',JSON[_0x943f('0x10')](_0xd8b310));if(_0xd8b310['error']){if(_0xd8b310[_0x943f('0x11')][_0x943f('0x12')]===0x1f4){logger[_0x943f('0x11')]('SquareReport,\x20%s,\x20%s',_0x444656,_0xd8b310[_0x943f('0x11')][_0x943f('0x13')]);return _0x4e3430(_0xd8b310[_0x943f('0x11')][_0x943f('0x13')]);}logger[_0x943f('0x11')](_0x943f('0x14'),_0x444656,_0xd8b310['error'][_0x943f('0x13')]);return _0x1cbd1f(_0xd8b310[_0x943f('0x11')][_0x943f('0x13')]);}else{logger[_0x943f('0x15')](_0x943f('0x14'),_0x444656,_0x943f('0x16'));_0x1cbd1f(_0xd8b310['result'][_0x943f('0x13')]);}})[_0x943f('0x17')](function(_0x3f3bf6){logger['error']('SquareReport,\x20%s,\x20%s',_0x444656,_0x3f3bf6);_0x4e3430(_0x3f3bf6);});});}exports[_0x943f('0x18')]=function(_0x49c0b2){var _0x4d654f=this;return new Promise(function(_0x318073,_0x24f67b){return db[_0x943f('0x19')][_0x943f('0x1a')](_0x49c0b2[_0x943f('0x1b')],{'raw':_0x49c0b2[_0x943f('0x1c')]?_0x49c0b2['options'][_0x943f('0x1d')]===undefined?!![]:![]:!![]})[_0x943f('0xd')](function(_0x2ecb13){logger[_0x943f('0x15')](_0x943f('0x18'),_0x49c0b2);logger[_0x943f('0xe')](_0x943f('0x18'),_0x49c0b2,JSON[_0x943f('0x10')](_0x2ecb13));_0x318073(_0x2ecb13);})[_0x943f('0x17')](function(_0x3f93aa){logger[_0x943f('0x11')]('CreateSquareReport',_0x3f93aa[_0x943f('0x13')],_0x49c0b2);_0x24f67b(_0x4d654f[_0x943f('0x11')](0x1f4,_0x3f93aa['message']));});});};exports[_0x943f('0x1e')]=function(_0x3f57c){var _0x30e406=this;return new Promise(function(_0x39c6c6,_0x1fa880){return db[_0x943f('0x19')][_0x943f('0x1f')](_0x3f57c[_0x943f('0x1b')],{'raw':_0x3f57c[_0x943f('0x1c')]?_0x3f57c[_0x943f('0x1c')][_0x943f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f57c['options']?_0x3f57c[_0x943f('0x1c')][_0x943f('0x20')]||null:null,'attributes':_0x3f57c[_0x943f('0x1c')]?_0x3f57c['options'][_0x943f('0x21')]||null:null,'limit':_0x3f57c[_0x943f('0x1c')]?_0x3f57c[_0x943f('0x1c')][_0x943f('0x22')]||null:null})['then'](function(_0x18b434){logger[_0x943f('0x15')](_0x943f('0x1e'),_0x3f57c);logger['debug'](_0x943f('0x1e'),_0x3f57c,JSON[_0x943f('0x10')](_0x18b434));_0x39c6c6(_0x18b434);})['catch'](function(_0x6306c3){logger[_0x943f('0x11')](_0x943f('0x1e'),_0x6306c3[_0x943f('0x13')],_0x3f57c);_0x1fa880(_0x30e406['error'](0x1f4,_0x6306c3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8fbdb22..f33dd16 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 _0x4895=['put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x41d364,_0xdfdc1a){var _0x5ace98=function(_0x5f1194){while(--_0x5f1194){_0x41d364['push'](_0x41d364['shift']());}};_0x5ace98(++_0xdfdc1a);}(_0x4895,0x90));var _0x5489=function(_0x52cc1e,_0x51160e){_0x52cc1e=_0x52cc1e-0x0;var _0x3a0902=_0x4895[_0x52cc1e];return _0x3a0902;};'use strict';var multer=require(_0x5489('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5489('0x1'));var router=express[_0x5489('0x2')]();var fs_extra=require(_0x5489('0x3'));var auth=require(_0x5489('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5489('0x5'));var controller=require(_0x5489('0x6'));router[_0x5489('0x7')]('/',auth['isAuthenticated'](),controller[_0x5489('0x8')]);router[_0x5489('0x7')](_0x5489('0x9'),auth[_0x5489('0xa')](),controller[_0x5489('0xb')]);router['get'](_0x5489('0xc'),auth[_0x5489('0xa')](),controller[_0x5489('0xd')]);router[_0x5489('0xe')]('/',auth['isAuthenticated'](),controller[_0x5489('0xf')]);router[_0x5489('0x10')](_0x5489('0xc'),auth[_0x5489('0xa')](),controller[_0x5489('0x11')]);router[_0x5489('0x12')]('/:id',auth[_0x5489('0xa')](),controller['destroy']);module[_0x5489('0x13')]=router; \ No newline at end of file +var _0xa256=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','put'];(function(_0x552daa,_0x1cc58a){var _0x399297=function(_0x411759){while(--_0x411759){_0x552daa['push'](_0x552daa['shift']());}};_0x399297(++_0x1cc58a);}(_0xa256,0x173));var _0x6a25=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa256[_0x24237f];return _0x48298e;};'use strict';var multer=require('multer');var util=require(_0x6a25('0x0'));var path=require(_0x6a25('0x1'));var timeout=require(_0x6a25('0x2'));var express=require('express');var router=express[_0x6a25('0x3')]();var fs_extra=require(_0x6a25('0x4'));var auth=require(_0x6a25('0x5'));var interaction=require(_0x6a25('0x6'));var config=require(_0x6a25('0x7'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x6a25('0x8')](),controller['index']);router[_0x6a25('0x9')]('/describe',auth[_0x6a25('0x8')](),controller['describe']);router[_0x6a25('0x9')](_0x6a25('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6a25('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6a25('0xc')](_0x6a25('0xa'),auth[_0x6a25('0x8')](),controller[_0x6a25('0xd')]);router['delete'](_0x6a25('0xa'),auth[_0x6a25('0x8')](),controller[_0x6a25('0xe')]);module[_0x6a25('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index dc5f42f..7ba339c 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 _0x0c0c=['STRING','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x0c0c,0x159));var _0xc0c0=function(_0x892efd,_0x44075e){_0x892efd=_0x892efd-0x0;var _0x1f6a80=_0x0c0c[_0x892efd];return _0x1f6a80;};'use strict';var Sequelize=require('sequelize');module[_0xc0c0('0x0')]={'uniqueid':{'type':Sequelize[_0xc0c0('0x1')]},'node':{'type':Sequelize[_0xc0c0('0x1')]},'application':{'type':Sequelize[_0xc0c0('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc0c0('0x1')]},'callerid':{'type':Sequelize[_0xc0c0('0x1')]}}; \ No newline at end of file +var _0x2b22=['STRING','TEXT','exports'];(function(_0x2f60df,_0x47675e){var _0x2bb820=function(_0x2f622e){while(--_0x2f622e){_0x2f60df['push'](_0x2f60df['shift']());}};_0x2bb820(++_0x47675e);}(_0x2b22,0x1c7));var _0x22b2=function(_0x353357,_0x59434c){_0x353357=_0x353357-0x0;var _0x294b64=_0x2b22[_0x353357];return _0x294b64;};'use strict';var Sequelize=require('sequelize');module[_0x22b2('0x0')]={'uniqueid':{'type':Sequelize[_0x22b2('0x1')]},'node':{'type':Sequelize[_0x22b2('0x1')]},'application':{'type':Sequelize[_0x22b2('0x1')]},'data':{'type':Sequelize[_0x22b2('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x22b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 00e0ed2..fd27d2f 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 _0x8a34=['options','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','then','sendStatus','error','name','index','map','fieldName','type','key','keys','query','model','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','SquareDetailsReport','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','merge'];(function(_0x3b731f,_0x4b89c6){var _0x414d85=function(_0x3291f8){while(--_0x3291f8){_0x3b731f['push'](_0x3b731f['shift']());}};_0x414d85(++_0x4b89c6);}(_0x8a34,0x9b));var _0x48a3=function(_0x54faff,_0x9a3b5e){_0x54faff=_0x54faff-0x0;var _0x5a784c=_0x8a34[_0x54faff];return _0x5a784c;};'use strict';var emlformat=require(_0x48a3('0x0'));var rimraf=require(_0x48a3('0x1'));var zipdir=require(_0x48a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48a3('0x3'));var moment=require(_0x48a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48a3('0x5'));var util=require(_0x48a3('0x6'));var path=require(_0x48a3('0x7'));var sox=require(_0x48a3('0x8'));var csv=require(_0x48a3('0x9'));var ejs=require(_0x48a3('0xa'));var fs=require('fs');var fs_extra=require(_0x48a3('0xb'));var _=require(_0x48a3('0xc'));var squel=require('squel');var crypto=require(_0x48a3('0xd'));var jsforce=require(_0x48a3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x48a3('0x9'));var querystring=require(_0x48a3('0xf'));var Papa=require(_0x48a3('0x10'));var Redis=require(_0x48a3('0x11'));var authService=require(_0x48a3('0x12'));var qs=require(_0x48a3('0x13'));var as=require(_0x48a3('0x14'));var hardwareService=require(_0x48a3('0x15'));var logger=require(_0x48a3('0x16'))('api');var utils=require(_0x48a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x48a3('0x18'));var db=require(_0x48a3('0x19'))['db'];function respondWithStatusCode(_0x555048,_0x4d9975){_0x4d9975=_0x4d9975||0xcc;return function(_0x53f4fe){if(_0x53f4fe){return _0x555048['sendStatus'](_0x4d9975);}return _0x555048['status'](_0x4d9975)[_0x48a3('0x1a')]();};}function respondWithResult(_0x47af42,_0x552653){_0x552653=_0x552653||0xc8;return function(_0x13c963){if(_0x13c963){return _0x47af42['status'](_0x552653)[_0x48a3('0x1b')](_0x13c963);}};}function respondWithFilteredResult(_0x202e53,_0x1997ce){return function(_0x9f129d){if(_0x9f129d){var _0x527480=typeof _0x1997ce['offset']===_0x48a3('0x1c')&&typeof _0x1997ce['limit']===_0x48a3('0x1c');var _0x186ad1=_0x9f129d[_0x48a3('0x1d')];var _0x47a8cc=_0x527480?0x0:_0x1997ce[_0x48a3('0x1e')];var _0x7c7cbf=_0x527480?_0x9f129d[_0x48a3('0x1d')]:_0x1997ce[_0x48a3('0x1e')]+_0x1997ce[_0x48a3('0x1f')];var _0x512c14;if(_0x7c7cbf>=_0x186ad1){_0x7c7cbf=_0x186ad1;_0x512c14=0xc8;}else{_0x512c14=0xce;}_0x202e53[_0x48a3('0x20')](_0x512c14);return _0x202e53[_0x48a3('0x21')](_0x48a3('0x22'),_0x47a8cc+'-'+_0x7c7cbf+'/'+_0x186ad1)[_0x48a3('0x1b')](_0x9f129d);}return null;};}function patchUpdates(_0x2f30a9){return function(_0x27e1be){try{jsonpatch['apply'](_0x27e1be,_0x2f30a9,!![]);}catch(_0xba8d5e){return BPromise[_0x48a3('0x23')](_0xba8d5e);}return _0x27e1be[_0x48a3('0x24')]();};}function saveUpdates(_0x2b3400,_0x40d4e8){return function(_0x8276e6){if(_0x8276e6){return _0x8276e6['update'](_0x2b3400)[_0x48a3('0x25')](function(_0x3cd8dc){return _0x3cd8dc;});}return null;};}function removeEntity(_0xd9746b,_0x418548){return function(_0x4b3167){if(_0x4b3167){return _0x4b3167['destroy']()[_0x48a3('0x25')](function(){_0xd9746b[_0x48a3('0x20')](0xcc)[_0x48a3('0x1a')]();});}};}function handleEntityNotFound(_0x297c0f,_0x30c1cf){return function(_0x24ab66){if(!_0x24ab66){_0x297c0f[_0x48a3('0x26')](0x194);}return _0x24ab66;};}function handleError(_0x28cdbf,_0x21e52c){_0x21e52c=_0x21e52c||0x1f4;return function(_0x346d4a){logger[_0x48a3('0x27')](_0x346d4a['stack']);if(_0x346d4a[_0x48a3('0x28')]){delete _0x346d4a[_0x48a3('0x28')];}_0x28cdbf['status'](_0x21e52c)['send'](_0x346d4a);};}exports[_0x48a3('0x29')]=function(_0x19df91,_0x1dd5b1){var _0x1a303a={},_0x3b99d0={},_0x38e9d3={'count':0x0,'rows':[]};var _0x48a953=_[_0x48a3('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x46f07e){return{'name':_0x46f07e[_0x48a3('0x2b')],'type':_0x46f07e[_0x48a3('0x2c')][_0x48a3('0x2d')]};});_0x3b99d0['model']=_[_0x48a3('0x2a')](_0x48a953,'name');_0x3b99d0['query']=_[_0x48a3('0x2e')](_0x19df91[_0x48a3('0x2f')]);_0x3b99d0['filters']=_['intersection'](_0x3b99d0[_0x48a3('0x30')],_0x3b99d0[_0x48a3('0x2f')]);_0x1a303a[_0x48a3('0x31')]=_[_0x48a3('0x32')](_0x3b99d0['model'],qs[_0x48a3('0x33')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x33')]));_0x1a303a[_0x48a3('0x31')]=_0x1a303a['attributes']['length']?_0x1a303a[_0x48a3('0x31')]:_0x3b99d0[_0x48a3('0x30')];if(!_0x19df91[_0x48a3('0x2f')][_0x48a3('0x34')]('nolimit')){_0x1a303a[_0x48a3('0x1f')]=qs[_0x48a3('0x1f')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x1f')]);_0x1a303a[_0x48a3('0x1e')]=qs[_0x48a3('0x1e')](_0x19df91[_0x48a3('0x2f')][_0x48a3('0x1e')]);}_0x1a303a[_0x48a3('0x35')]=qs[_0x48a3('0x36')](_0x19df91['query'][_0x48a3('0x36')]);_0x1a303a['where']=qs[_0x48a3('0x37')](_[_0x48a3('0x38')](_0x19df91[_0x48a3('0x2f')],_0x3b99d0[_0x48a3('0x37')]),_0x48a953);if(_0x19df91[_0x48a3('0x2f')]['filter']){_0x1a303a[_0x48a3('0x39')]=_['merge'](_0x1a303a[_0x48a3('0x39')],{'$or':_[_0x48a3('0x2a')](_0x48a953,function(_0x409320){if(_0x409320[_0x48a3('0x2c')]!==_0x48a3('0x3a')){var _0x56bd7a={};_0x56bd7a[_0x409320[_0x48a3('0x28')]]={'$like':'%'+_0x19df91['query']['filter']+'%'};return _0x56bd7a;}})});}_0x1a303a=_['merge']({},_0x1a303a,_0x19df91['options']);var _0x4693ed={'where':_0x1a303a[_0x48a3('0x39')]};return db[_0x48a3('0x3b')][_0x48a3('0x1d')](_0x4693ed)[_0x48a3('0x25')](function(_0x2b2117){_0x38e9d3[_0x48a3('0x1d')]=_0x2b2117;if(_0x19df91[_0x48a3('0x2f')][_0x48a3('0x3c')]){_0x1a303a['include']=[{'all':!![]}];}return db[_0x48a3('0x3b')][_0x48a3('0x3d')](_0x1a303a);})[_0x48a3('0x25')](function(_0x213b66){_0x38e9d3[_0x48a3('0x3e')]=_0x213b66;return _0x38e9d3;})[_0x48a3('0x25')](respondWithFilteredResult(_0x1dd5b1,_0x1a303a))[_0x48a3('0x3f')](handleError(_0x1dd5b1,null));};exports[_0x48a3('0x40')]=function(_0x6510b9,_0x24cb29){var _0x31d95a={'raw':!![],'where':{'id':_0x6510b9[_0x48a3('0x41')]['id']}},_0x4535a3={};_0x4535a3['model']=_[_0x48a3('0x2e')](db[_0x48a3('0x3b')][_0x48a3('0x42')]);_0x4535a3['query']=_[_0x48a3('0x2e')](_0x6510b9[_0x48a3('0x2f')]);_0x4535a3[_0x48a3('0x37')]=_['intersection'](_0x4535a3[_0x48a3('0x30')],_0x4535a3[_0x48a3('0x2f')]);_0x31d95a[_0x48a3('0x31')]=_[_0x48a3('0x32')](_0x4535a3[_0x48a3('0x30')],qs[_0x48a3('0x33')](_0x6510b9[_0x48a3('0x2f')][_0x48a3('0x33')]));_0x31d95a[_0x48a3('0x31')]=_0x31d95a[_0x48a3('0x31')][_0x48a3('0x43')]?_0x31d95a['attributes']:_0x4535a3['model'];if(_0x6510b9['query'][_0x48a3('0x3c')]){_0x31d95a[_0x48a3('0x44')]=[{'all':!![]}];}_0x31d95a=_[_0x48a3('0x45')]({},_0x31d95a,_0x6510b9[_0x48a3('0x46')]);return db[_0x48a3('0x3b')]['find'](_0x31d95a)[_0x48a3('0x25')](handleEntityNotFound(_0x24cb29,null))[_0x48a3('0x25')](respondWithResult(_0x24cb29,null))[_0x48a3('0x3f')](handleError(_0x24cb29,null));};exports[_0x48a3('0x47')]=function(_0x3540f9,_0x1cd22e){return db['SquareDetailsReport'][_0x48a3('0x47')](_0x3540f9['body'],{})['then'](respondWithResult(_0x1cd22e,0xc9))['catch'](handleError(_0x1cd22e,null));};exports['update']=function(_0x49e0e4,_0x4f5c1d){if(_0x49e0e4[_0x48a3('0x48')]['id']){delete _0x49e0e4[_0x48a3('0x48')]['id'];}return db['SquareDetailsReport'][_0x48a3('0x49')]({'where':{'id':_0x49e0e4[_0x48a3('0x41')]['id']}})[_0x48a3('0x25')](handleEntityNotFound(_0x4f5c1d,null))[_0x48a3('0x25')](saveUpdates(_0x49e0e4['body'],null))[_0x48a3('0x25')](respondWithResult(_0x4f5c1d,null))['catch'](handleError(_0x4f5c1d,null));};exports['destroy']=function(_0x447a5e,_0x25f4c7){return db[_0x48a3('0x3b')][_0x48a3('0x49')]({'where':{'id':_0x447a5e['params']['id']}})[_0x48a3('0x25')](handleEntityNotFound(_0x25f4c7,null))[_0x48a3('0x25')](removeEntity(_0x25f4c7,null))[_0x48a3('0x3f')](handleError(_0x25f4c7,null));};exports[_0x48a3('0x4a')]=function(_0x3ca81c,_0x567fcc){return db[_0x48a3('0x3b')][_0x48a3('0x4a')]()[_0x48a3('0x25')](respondWithResult(_0x567fcc,null))[_0x48a3('0x3f')](handleError(_0x567fcc,null));}; \ No newline at end of file +var _0x15a7=['keys','options','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','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','limit','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','filter','count','includeAll','include','findAll','rows','catch','show'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x15a7,0x1b2));var _0x715a=function(_0x145573,_0x2faaf6){_0x145573=_0x145573-0x0;var _0x4c4528=_0x15a7[_0x145573];return _0x4c4528;};'use strict';var emlformat=require(_0x715a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x715a('0x1'));var jsonpatch=require(_0x715a('0x2'));var rp=require(_0x715a('0x3'));var moment=require('moment');var BPromise=require(_0x715a('0x4'));var Mustache=require(_0x715a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x715a('0x6'));var csv=require(_0x715a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x715a('0x8'));var _=require(_0x715a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x715a('0x7'));var querystring=require(_0x715a('0xa'));var Papa=require('papaparse');var Redis=require(_0x715a('0xb'));var authService=require(_0x715a('0xc'));var qs=require(_0x715a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x715a('0xe'));var logger=require(_0x715a('0xf'))(_0x715a('0x10'));var utils=require(_0x715a('0x11'));var config=require(_0x715a('0x12'));var licenseUtil=require(_0x715a('0x13'));var db=require(_0x715a('0x14'))['db'];function respondWithStatusCode(_0x35b9fe,_0x145465){_0x145465=_0x145465||0xcc;return function(_0x428676){if(_0x428676){return _0x35b9fe[_0x715a('0x15')](_0x145465);}return _0x35b9fe[_0x715a('0x16')](_0x145465)[_0x715a('0x17')]();};}function respondWithResult(_0x1e9585,_0xa339d8){_0xa339d8=_0xa339d8||0xc8;return function(_0x12e23f){if(_0x12e23f){return _0x1e9585[_0x715a('0x16')](_0xa339d8)[_0x715a('0x18')](_0x12e23f);}};}function respondWithFilteredResult(_0xd91d3a,_0x10060){return function(_0x350dfa){if(_0x350dfa){var _0x5b1bdc=typeof _0x10060['offset']===_0x715a('0x19')&&typeof _0x10060[_0x715a('0x1a')]===_0x715a('0x19');var _0x30d2e4=_0x350dfa['count'];var _0xbf3ec6=_0x5b1bdc?0x0:_0x10060['offset'];var _0x3fa07f=_0x5b1bdc?_0x350dfa['count']:_0x10060[_0x715a('0x1b')]+_0x10060['limit'];var _0x36a1e;if(_0x3fa07f>=_0x30d2e4){_0x3fa07f=_0x30d2e4;_0x36a1e=0xc8;}else{_0x36a1e=0xce;}_0xd91d3a[_0x715a('0x16')](_0x36a1e);return _0xd91d3a[_0x715a('0x1c')](_0x715a('0x1d'),_0xbf3ec6+'-'+_0x3fa07f+'/'+_0x30d2e4)['json'](_0x350dfa);}return null;};}function patchUpdates(_0x50560f){return function(_0x37db6f){try{jsonpatch[_0x715a('0x1e')](_0x37db6f,_0x50560f,!![]);}catch(_0xd80c9){return BPromise[_0x715a('0x1f')](_0xd80c9);}return _0x37db6f[_0x715a('0x20')]();};}function saveUpdates(_0x12e1f3,_0x5d07e3){return function(_0x10a6a3){if(_0x10a6a3){return _0x10a6a3[_0x715a('0x21')](_0x12e1f3)[_0x715a('0x22')](function(_0x279269){return _0x279269;});}return null;};}function removeEntity(_0x299f62,_0x4c309a){return function(_0x3a8256){if(_0x3a8256){return _0x3a8256['destroy']()[_0x715a('0x22')](function(){_0x299f62[_0x715a('0x16')](0xcc)[_0x715a('0x17')]();});}};}function handleEntityNotFound(_0x3ff7b8,_0x287f6e){return function(_0x3fb024){if(!_0x3fb024){_0x3ff7b8[_0x715a('0x15')](0x194);}return _0x3fb024;};}function handleError(_0x3b48ba,_0x322068){_0x322068=_0x322068||0x1f4;return function(_0x349cb7){logger[_0x715a('0x23')](_0x349cb7['stack']);if(_0x349cb7[_0x715a('0x24')]){delete _0x349cb7[_0x715a('0x24')];}_0x3b48ba[_0x715a('0x16')](_0x322068)[_0x715a('0x25')](_0x349cb7);};}exports['index']=function(_0xc294b,_0x3973be){var _0x143172={},_0x1ca1c9={},_0x4ea17e={'count':0x0,'rows':[]};var _0x506dc2=_[_0x715a('0x26')](db[_0x715a('0x27')][_0x715a('0x28')],function(_0x346723){return{'name':_0x346723[_0x715a('0x29')],'type':_0x346723['type']['key']};});_0x1ca1c9['model']=_[_0x715a('0x26')](_0x506dc2,_0x715a('0x24'));_0x1ca1c9[_0x715a('0x2a')]=_['keys'](_0xc294b[_0x715a('0x2a')]);_0x1ca1c9[_0x715a('0x2b')]=_['intersection'](_0x1ca1c9[_0x715a('0x2c')],_0x1ca1c9[_0x715a('0x2a')]);_0x143172[_0x715a('0x2d')]=_[_0x715a('0x2e')](_0x1ca1c9['model'],qs[_0x715a('0x2f')](_0xc294b[_0x715a('0x2a')]['fields']));_0x143172[_0x715a('0x2d')]=_0x143172[_0x715a('0x2d')][_0x715a('0x30')]?_0x143172[_0x715a('0x2d')]:_0x1ca1c9[_0x715a('0x2c')];if(!_0xc294b['query']['hasOwnProperty'](_0x715a('0x31'))){_0x143172[_0x715a('0x1a')]=qs[_0x715a('0x1a')](_0xc294b[_0x715a('0x2a')][_0x715a('0x1a')]);_0x143172['offset']=qs[_0x715a('0x1b')](_0xc294b[_0x715a('0x2a')][_0x715a('0x1b')]);}_0x143172[_0x715a('0x32')]=qs[_0x715a('0x33')](_0xc294b[_0x715a('0x2a')][_0x715a('0x33')]);_0x143172[_0x715a('0x34')]=qs['filters'](_[_0x715a('0x35')](_0xc294b['query'],_0x1ca1c9['filters']),_0x506dc2);if(_0xc294b[_0x715a('0x2a')]['filter']){_0x143172[_0x715a('0x34')]=_[_0x715a('0x36')](_0x143172['where'],{'$or':_['map'](_0x506dc2,function(_0x7c6b67){if(_0x7c6b67['type']!=='VIRTUAL'){var _0x40169b={};_0x40169b[_0x7c6b67[_0x715a('0x24')]]={'$like':'%'+_0xc294b['query'][_0x715a('0x37')]+'%'};return _0x40169b;}})});}_0x143172=_[_0x715a('0x36')]({},_0x143172,_0xc294b['options']);var _0x1d5a6c={'where':_0x143172[_0x715a('0x34')]};return db['SquareDetailsReport'][_0x715a('0x38')](_0x1d5a6c)[_0x715a('0x22')](function(_0x5423cc){_0x4ea17e[_0x715a('0x38')]=_0x5423cc;if(_0xc294b[_0x715a('0x2a')][_0x715a('0x39')]){_0x143172[_0x715a('0x3a')]=[{'all':!![]}];}return db[_0x715a('0x27')][_0x715a('0x3b')](_0x143172);})[_0x715a('0x22')](function(_0x58803b){_0x4ea17e[_0x715a('0x3c')]=_0x58803b;return _0x4ea17e;})[_0x715a('0x22')](respondWithFilteredResult(_0x3973be,_0x143172))[_0x715a('0x3d')](handleError(_0x3973be,null));};exports[_0x715a('0x3e')]=function(_0x3c8898,_0x96daec){var _0x2ac999={'raw':!![],'where':{'id':_0x3c8898['params']['id']}},_0x58a95a={};_0x58a95a[_0x715a('0x2c')]=_[_0x715a('0x3f')](db['SquareDetailsReport'][_0x715a('0x28')]);_0x58a95a[_0x715a('0x2a')]=_[_0x715a('0x3f')](_0x3c8898[_0x715a('0x2a')]);_0x58a95a[_0x715a('0x2b')]=_[_0x715a('0x2e')](_0x58a95a['model'],_0x58a95a[_0x715a('0x2a')]);_0x2ac999[_0x715a('0x2d')]=_['intersection'](_0x58a95a[_0x715a('0x2c')],qs[_0x715a('0x2f')](_0x3c8898[_0x715a('0x2a')][_0x715a('0x2f')]));_0x2ac999[_0x715a('0x2d')]=_0x2ac999['attributes']['length']?_0x2ac999[_0x715a('0x2d')]:_0x58a95a[_0x715a('0x2c')];if(_0x3c8898[_0x715a('0x2a')]['includeAll']){_0x2ac999[_0x715a('0x3a')]=[{'all':!![]}];}_0x2ac999=_[_0x715a('0x36')]({},_0x2ac999,_0x3c8898[_0x715a('0x40')]);return db[_0x715a('0x27')][_0x715a('0x41')](_0x2ac999)[_0x715a('0x22')](handleEntityNotFound(_0x96daec,null))[_0x715a('0x22')](respondWithResult(_0x96daec,null))[_0x715a('0x3d')](handleError(_0x96daec,null));};exports[_0x715a('0x42')]=function(_0x306daa,_0x2faa4b){return db[_0x715a('0x27')][_0x715a('0x42')](_0x306daa[_0x715a('0x43')],{})[_0x715a('0x22')](respondWithResult(_0x2faa4b,0xc9))['catch'](handleError(_0x2faa4b,null));};exports['update']=function(_0x3a6407,_0x61d087){if(_0x3a6407[_0x715a('0x43')]['id']){delete _0x3a6407['body']['id'];}return db[_0x715a('0x27')]['find']({'where':{'id':_0x3a6407[_0x715a('0x44')]['id']}})['then'](handleEntityNotFound(_0x61d087,null))[_0x715a('0x22')](saveUpdates(_0x3a6407[_0x715a('0x43')],null))['then'](respondWithResult(_0x61d087,null))[_0x715a('0x3d')](handleError(_0x61d087,null));};exports[_0x715a('0x45')]=function(_0x3eaebe,_0x524ac9){return db[_0x715a('0x27')][_0x715a('0x41')]({'where':{'id':_0x3eaebe[_0x715a('0x44')]['id']}})[_0x715a('0x22')](handleEntityNotFound(_0x524ac9,null))['then'](removeEntity(_0x524ac9,null))['catch'](handleError(_0x524ac9,null));};exports[_0x715a('0x46')]=function(_0x48760e,_0x244e13){return db[_0x715a('0x27')][_0x715a('0x46')]()['then'](respondWithResult(_0x244e13,null))[_0x715a('0x3d')](handleError(_0x244e13,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1c05214..a974050 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 _0x4d76=['../../config/logger','api','path','../../config/environment','./squareReportDetail.attributes','exports','define','lodash','util'];(function(_0x3013a3,_0x4c0944){var _0x1a191c=function(_0x58cdbf){while(--_0x58cdbf){_0x3013a3['push'](_0x3013a3['shift']());}};_0x1a191c(++_0x4c0944);}(_0x4d76,0x103));var _0x64d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d76[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x64d7('0x0'));var util=require(_0x64d7('0x1'));var logger=require(_0x64d7('0x2'))(_0x64d7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x64d7('0x4'));var rimraf=require('rimraf');var config=require(_0x64d7('0x5'));var attributes=require(_0x64d7('0x6'));module[_0x64d7('0x7')]=function(_0x3e8b83,_0x9fe017){return _0x3e8b83[_0x64d7('0x8')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaccc=['lodash','util','api','moment','request-promise','rimraf','./squareReportDetail.attributes','exports','report_square_details'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0xaccc,0xfc));var _0xcacc=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xaccc[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0xcacc('0x0'));var util=require(_0xcacc('0x1'));var logger=require('../../config/logger')(_0xcacc('0x2'));var moment=require(_0xcacc('0x3'));var BPromise=require('bluebird');var rp=require(_0xcacc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcacc('0x5'));var config=require('../../config/environment');var attributes=require(_0xcacc('0x6'));module[_0xcacc('0x7')]=function(_0x5922ea,_0x45f0ad){return _0x5922ea['define']('SquareDetailsReport',attributes,{'tableName':_0xcacc('0x8'),'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 53c49dc..8caa22b 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 _0xa571=['create','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport'];(function(_0x236023,_0xa7f6b6){var _0x5ef19f=function(_0x4e3dfa){while(--_0x4e3dfa){_0x236023['push'](_0x236023['shift']());}};_0x5ef19f(++_0xa7f6b6);}(_0xa571,0x107));var _0x1a57=function(_0x2f19c1,_0x309c36){_0x2f19c1=_0x2f19c1-0x0;var _0x33aeac=_0xa571[_0x2f19c1];return _0x33aeac;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')](_0x1662a3[_0x1a57('0x18')],{'raw':_0x1662a3[_0x1a57('0x19')]?_0x1662a3['options']['raw']===undefined?!![]:![]:!![]})[_0x1a57('0xb')](function(_0x21e811){logger[_0x1a57('0xc')]('CreateSquareDetailsReport',_0x1662a3);logger['debug']('CreateSquareDetailsReport',_0x1662a3,JSON[_0x1a57('0x11')](_0x21e811));_0x53bb20(_0x21e811);})[_0x1a57('0x14')](function(_0x3f52b9){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x3f52b9[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x3f52b9[_0x1a57('0x13')]));});});}; \ No newline at end of file +var _0x5ec6=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment'];(function(_0x1a042d,_0x1e52d8){var _0x2a611a=function(_0xf0b604){while(--_0xf0b604){_0x1a042d['push'](_0x1a042d['shift']());}};_0x2a611a(++_0x1e52d8);}(_0x5ec6,0x7f));var _0x65ec=function(_0x39ec02,_0x22d351){_0x39ec02=_0x39ec02-0x0;var _0xd47f17=_0x5ec6[_0x39ec02];return _0xd47f17;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')](_0x1254f8[_0x65ec('0x17')],{'raw':_0x1254f8[_0x65ec('0x18')]?_0x1254f8[_0x65ec('0x18')][_0x65ec('0x19')]===undefined?!![]:![]:!![]})[_0x65ec('0xa')](function(_0x1467ac){logger[_0x65ec('0x12')](_0x65ec('0x14'),_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x1467ac));_0x29ebc4(_0x1467ac);})['catch'](function(_0x170703){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x170703[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x170703[_0x65ec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index afd7c5a..0bec419 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 _0x0d4a=['express','../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports'];(function(_0x388086,_0x544674){var _0x2e6130=function(_0x1c4828){while(--_0x1c4828){_0x388086['push'](_0x388086['shift']());}};_0x2e6130(++_0x544674);}(_0x0d4a,0xb8));var _0xa0d4=function(_0x97e12d,_0x1c0501){_0x97e12d=_0x97e12d-0x0;var _0x1359ca=_0x0d4a[_0x97e12d];return _0x1359ca;};'use strict';var express=require(_0xa0d4('0x0'));var router=express['Router']();var auth=require(_0xa0d4('0x1'));var controller=require('./system.controller');router[_0xa0d4('0x2')]('/',auth[_0xa0d4('0x3')](),controller[_0xa0d4('0x4')]);router[_0xa0d4('0x2')](_0xa0d4('0x5'),auth[_0xa0d4('0x3')](),controller[_0xa0d4('0x6')]);module[_0xa0d4('0x7')]=router; \ No newline at end of file +var _0xf15b=['exports','Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xf15b,0xbe));var _0xbf15=function(_0x3a41a5,_0x534403){_0x3a41a5=_0x3a41a5-0x0;var _0x10f8f1=_0xf15b[_0x3a41a5];return _0x10f8f1;};'use strict';var express=require('express');var router=express[_0xbf15('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xbf15('0x1'));router[_0xbf15('0x2')]('/',auth[_0xbf15('0x3')](),controller[_0xbf15('0x4')]);router['get'](_0xbf15('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0xbf15('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f1ffe91..f932ec5 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 _0xae21=['util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api'];(function(_0x2417c8,_0x416064){var _0x22ed17=function(_0x5b19fe){while(--_0x5b19fe){_0x2417c8['push'](_0x2417c8['shift']());}};_0x22ed17(++_0x416064);}(_0xae21,0x142));var _0x1ae2=function(_0x2dd973,_0x27b85d){_0x2dd973=_0x2dd973-0x0;var _0x363a49=_0xae21[_0x2dd973];return _0x363a49;};'use strict';var info=require('systeminformation');var exec=require(_0x1ae2('0x0'))['exec'];var logger=require(_0x1ae2('0x1'))(_0x1ae2('0x2'));var util=require(_0x1ae2('0x3'));var BPromise=require(_0x1ae2('0x4'));var _=require(_0x1ae2('0x5'));function handleError(_0x15287a,_0x5e5fe7,_0x327346){_0x5e5fe7=_0x5e5fe7||0x1f4;return function(_0x3e1c2a){logger['error'](_0x1ae2('0x6'),_0x327346,_0x5e5fe7,util[_0x1ae2('0x7')](_0x3e1c2a,{'showHidden':![],'depth':null}));delete _0x3e1c2a[_0x1ae2('0x8')];_0x15287a[_0x1ae2('0x9')](_0x5e5fe7)[_0x1ae2('0xa')](_0x3e1c2a);};}exports[_0x1ae2('0xb')]=function(_0x429112,_0x9204c5){return info[_0x1ae2('0xc')]()[_0x1ae2('0xd')](function(_0x212ae3){return _0x9204c5[_0x1ae2('0x9')](0xc8)[_0x1ae2('0xe')](_0x212ae3);})[_0x1ae2('0xf')](function(_0xb18ff8){return _0x9204c5[_0x1ae2('0x9')](0x1f4)[_0x1ae2('0xe')](_0xb18ff8);});};exports['killProcess']=function(_0x330030,_0x254662){var _0x3dab9f=[_0x1ae2('0x10')];return new BPromise(function(_0x2539c3,_0x5a1340){return exec(util['format'](_0x1ae2('0x11'),_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')]),function(_0x239e75,_0x1c67ad,_0x4de23c){if(_0x239e75){return _0x5a1340(_0x239e75);}return _0x2539c3(_0x1c67ad);});})[_0x1ae2('0xd')](function(_0x53a6fe){var _0x560db7=![];var _0x2e2e3d=_0x53a6fe['split'](/\n/);for(var _0x23cf24=0x0,_0x1d824d=_0x3dab9f['length'];_0x23cf24<_0x1d824d,_0x560db7===![];_0x23cf24+=0x1){if(_0x53a6fe['indexOf'](_0x3dab9f[_0x23cf24])>=0x0){_0x560db7=!![];}}if(!_0x560db7){throw new Error(util[_0x1ae2('0x14')](_0x1ae2('0x15'),_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')]));}process[_0x1ae2('0x16')](_0x330030[_0x1ae2('0x12')][_0x1ae2('0x13')],_0x1ae2('0x17'));return _0x254662[_0x1ae2('0x9')](0xc8)['json']({'message':util[_0x1ae2('0x14')](_0x1ae2('0x18'),_0x330030['params'][_0x1ae2('0x13')])});})[_0x1ae2('0xf')](handleError(_0x254662,null,'killProcess'));}; \ No newline at end of file +var _0x84c6=['bluebird','lodash','error','inspect','name','index','then','json','catch','status','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util'];(function(_0x448df7,_0x1f9421){var _0x3207e7=function(_0x168a34){while(--_0x168a34){_0x448df7['push'](_0x448df7['shift']());}};_0x3207e7(++_0x1f9421);}(_0x84c6,0xa8));var _0x684c=function(_0x426a18,_0x210d36){_0x426a18=_0x426a18-0x0;var _0x1512a5=_0x84c6[_0x426a18];return _0x1512a5;};'use strict';var info=require(_0x684c('0x0'));var exec=require(_0x684c('0x1'))[_0x684c('0x2')];var logger=require(_0x684c('0x3'))(_0x684c('0x4'));var util=require(_0x684c('0x5'));var BPromise=require(_0x684c('0x6'));var _=require(_0x684c('0x7'));function handleError(_0x3c5483,_0x19dbfe,_0x19dc2b){_0x19dbfe=_0x19dbfe||0x1f4;return function(_0x2f0305){logger[_0x684c('0x8')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x19dc2b,_0x19dbfe,util[_0x684c('0x9')](_0x2f0305,{'showHidden':![],'depth':null}));delete _0x2f0305[_0x684c('0xa')];_0x3c5483['status'](_0x19dbfe)['send'](_0x2f0305);};}exports[_0x684c('0xb')]=function(_0x2acbfa,_0x1cddfd){return info['getAllData']()[_0x684c('0xc')](function(_0xbe69cf){return _0x1cddfd['status'](0xc8)[_0x684c('0xd')](_0xbe69cf);})[_0x684c('0xe')](function(_0x4a2f4e){return _0x1cddfd[_0x684c('0xf')](0x1f4)[_0x684c('0xd')](_0x4a2f4e);});};exports[_0x684c('0x10')]=function(_0x529032,_0x1fdaf5){var _0x56e56e=[_0x684c('0x11')];return new BPromise(function(_0x1d4138,_0x195dca){return exec(util[_0x684c('0x12')](_0x684c('0x13'),_0x529032['params'][_0x684c('0x14')]),function(_0x351ba0,_0x48e1e3,_0x551b1f){if(_0x351ba0){return _0x195dca(_0x351ba0);}return _0x1d4138(_0x48e1e3);});})[_0x684c('0xc')](function(_0x37689a){var _0x511113=![];var _0x575124=_0x37689a[_0x684c('0x15')](/\n/);for(var _0x448d5c=0x0,_0x7715c2=_0x56e56e[_0x684c('0x16')];_0x448d5c<_0x7715c2,_0x511113===![];_0x448d5c+=0x1){if(_0x37689a[_0x684c('0x17')](_0x56e56e[_0x448d5c])>=0x0){_0x511113=!![];}}if(!_0x511113){throw new Error(util['format'](_0x684c('0x18'),_0x529032[_0x684c('0x19')][_0x684c('0x14')]));}process[_0x684c('0x1a')](_0x529032[_0x684c('0x19')][_0x684c('0x14')],_0x684c('0x1b'));return _0x1fdaf5['status'](0xc8)[_0x684c('0xd')]({'message':util[_0x684c('0x12')](_0x684c('0x1c'),_0x529032['params'][_0x684c('0x14')])});})[_0x684c('0xe')](handleError(_0x1fdaf5,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b86ecc6..f67eb3b 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 _0xadab=['show','post','update','delete','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated'];(function(_0x504c8b,_0x1187f4){var _0x3e0083=function(_0x5dfb0e){while(--_0x5dfb0e){_0x504c8b['push'](_0x504c8b['shift']());}};_0x3e0083(++_0x1187f4);}(_0xadab,0x115));var _0xbada=function(_0x1f54d7,_0xafc682){_0x1f54d7=_0x1f54d7-0x0;var _0x355fc0=_0xadab[_0x1f54d7];return _0x355fc0;};'use strict';var multer=require('multer');var util=require(_0xbada('0x0'));var path=require(_0xbada('0x1'));var timeout=require(_0xbada('0x2'));var express=require('express');var router=express[_0xbada('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbada('0x4'));var config=require(_0xbada('0x5'));var controller=require(_0xbada('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbada('0x7')]);router[_0xbada('0x8')](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xb')]);router[_0xbada('0xc')]('/',auth[_0xbada('0xa')](),controller['create']);router['put'](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xd')]);router[_0xbada('0xe')](_0xbada('0x9'),auth[_0xbada('0xa')](),controller[_0xbada('0xf')]);module['exports']=router; \ No newline at end of file +var _0xcac2=['path','connect-timeout','express','fs-extra','../../components/auth/service','./tag.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x1a7978,_0x287e67){var _0x14947f=function(_0x2f20f8){while(--_0x2f20f8){_0x1a7978['push'](_0x1a7978['shift']());}};_0x14947f(++_0x287e67);}(_0xcac2,0x8e));var _0x2cac=function(_0x588425,_0x22e281){_0x588425=_0x588425-0x0;var _0x2f69=_0xcac2[_0x588425];return _0x2f69;};'use strict';var multer=require(_0x2cac('0x0'));var util=require(_0x2cac('0x1'));var path=require(_0x2cac('0x2'));var timeout=require(_0x2cac('0x3'));var express=require(_0x2cac('0x4'));var router=express['Router']();var fs_extra=require(_0x2cac('0x5'));var auth=require(_0x2cac('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2cac('0x7'));router['get']('/',auth[_0x2cac('0x8')](),controller[_0x2cac('0x9')]);router['get'](_0x2cac('0xa'),auth[_0x2cac('0x8')](),controller[_0x2cac('0xb')]);router[_0x2cac('0xc')]('/',auth[_0x2cac('0x8')](),controller[_0x2cac('0xd')]);router[_0x2cac('0xe')](_0x2cac('0xa'),auth[_0x2cac('0x8')](),controller[_0x2cac('0xf')]);router[_0x2cac('0x10')](_0x2cac('0xa'),auth[_0x2cac('0x8')](),controller['destroy']);module[_0x2cac('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c3bfd09..68a3bf4 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 _0x9354=['exports','STRING','#0091EA'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0x9354,0x96));var _0x4935=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0x9354[_0xd8f7bd];return _0x1bd5ee;};'use strict';var Sequelize=require('sequelize');module[_0x4935('0x0')]={'name':{'type':Sequelize[_0x4935('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4935('0x1')],'defaultValue':_0x4935('0x2')},'description':{'type':Sequelize[_0x4935('0x1')]}}; \ No newline at end of file +var _0x758a=['sequelize','exports','STRING','name','#0091EA'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x758a,0x1d1));var _0xa758=function(_0x52dc41,_0x33a3b5){_0x52dc41=_0x52dc41-0x0;var _0x118e84=_0x758a[_0x52dc41];return _0x118e84;};'use strict';var Sequelize=require(_0xa758('0x0'));module[_0xa758('0x1')]={'name':{'type':Sequelize[_0xa758('0x2')],'unique':_0xa758('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa758('0x2')],'defaultValue':_0xa758('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6cfefd6..ed94469 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 _0xb248=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','Tag','findAll','rows','catch','params','rawAttributes','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','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','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','index','fieldName','type','key','model','map','query'];(function(_0x3b6128,_0x5a4a41){var _0x4254e8=function(_0x151397){while(--_0x151397){_0x3b6128['push'](_0x3b6128['shift']());}};_0x4254e8(++_0x5a4a41);}(_0xb248,0xc6));var _0x8b24=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb248[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];function respondWithStatusCode(_0x3d3450,_0x40c1e6){_0x40c1e6=_0x40c1e6||0xcc;return function(_0x40ea49){if(_0x40ea49){return _0x3d3450['sendStatus'](_0x40c1e6);}return _0x3d3450['status'](_0x40c1e6)[_0x8b24('0x19')]();};}function respondWithResult(_0x4433c0,_0xf92148){_0xf92148=_0xf92148||0xc8;return function(_0x32a451){if(_0x32a451){return _0x4433c0[_0x8b24('0x1a')](_0xf92148)[_0x8b24('0x1b')](_0x32a451);}};}function respondWithFilteredResult(_0x11d2ee,_0x3cd934){return function(_0x4e66ae){if(_0x4e66ae){var _0x5a5745=typeof _0x3cd934['offset']===_0x8b24('0x1c')&&typeof _0x3cd934['limit']==='undefined';var _0xafc423=_0x4e66ae[_0x8b24('0x1d')];var _0x527af7=_0x5a5745?0x0:_0x3cd934[_0x8b24('0x1e')];var _0x5e3c52=_0x5a5745?_0x4e66ae[_0x8b24('0x1d')]:_0x3cd934['offset']+_0x3cd934[_0x8b24('0x1f')];var _0x521f5c;if(_0x5e3c52>=_0xafc423){_0x5e3c52=_0xafc423;_0x521f5c=0xc8;}else{_0x521f5c=0xce;}_0x11d2ee[_0x8b24('0x1a')](_0x521f5c);return _0x11d2ee[_0x8b24('0x20')](_0x8b24('0x21'),_0x527af7+'-'+_0x5e3c52+'/'+_0xafc423)[_0x8b24('0x1b')](_0x4e66ae);}return null;};}function patchUpdates(_0x2a4f2d){return function(_0x44aae9){try{jsonpatch[_0x8b24('0x22')](_0x44aae9,_0x2a4f2d,!![]);}catch(_0x5c9c38){return BPromise[_0x8b24('0x23')](_0x5c9c38);}return _0x44aae9[_0x8b24('0x24')]();};}function saveUpdates(_0x4fff3c,_0xd9b96){return function(_0x13dd68){if(_0x13dd68){return _0x13dd68[_0x8b24('0x25')](_0x4fff3c)[_0x8b24('0x26')](function(_0x12a9f4){return _0x12a9f4;});}return null;};}function removeEntity(_0x10b721,_0x347591){return function(_0x3fddf8){if(_0x3fddf8){return _0x3fddf8[_0x8b24('0x27')]()[_0x8b24('0x26')](function(){var _0x2dd44b=_0x3fddf8[_0x8b24('0x28')]({'plain':!![]});var _0x2cfb27=_0x8b24('0x29');return db[_0x8b24('0x2a')][_0x8b24('0x27')]({'where':{'type':_0x2cfb27,'resourceId':_0x2dd44b['id']}})[_0x8b24('0x26')](function(){return _0x3fddf8;});})[_0x8b24('0x26')](function(){_0x10b721[_0x8b24('0x1a')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x1adcb4,_0xa6f06b){return function(_0x2be377){if(!_0x2be377){_0x1adcb4[_0x8b24('0x2b')](0x194);}return _0x2be377;};}function handleError(_0x1934d2,_0x364f3a){_0x364f3a=_0x364f3a||0x1f4;return function(_0x267f1e){logger[_0x8b24('0x2c')](_0x267f1e['stack']);if(_0x267f1e[_0x8b24('0x2d')]){delete _0x267f1e[_0x8b24('0x2d')];}_0x1934d2[_0x8b24('0x1a')](_0x364f3a)[_0x8b24('0x2e')](_0x267f1e);};}exports[_0x8b24('0x2f')]=function(_0x25b664,_0x1ab949){var _0x4de1cf={},_0xa37fe3={},_0x28d351={'count':0x0,'rows':[]};var _0x2ff6d7=_['map'](db['Tag']['rawAttributes'],function(_0x27cc28){return{'name':_0x27cc28[_0x8b24('0x30')],'type':_0x27cc28[_0x8b24('0x31')][_0x8b24('0x32')]};});_0xa37fe3[_0x8b24('0x33')]=_[_0x8b24('0x34')](_0x2ff6d7,_0x8b24('0x2d'));_0xa37fe3[_0x8b24('0x35')]=_[_0x8b24('0x36')](_0x25b664['query']);_0xa37fe3[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],_0xa37fe3['query']);_0x4de1cf[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x4de1cf[_0x8b24('0x39')]=_0x4de1cf[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x4de1cf['attributes']:_0xa37fe3[_0x8b24('0x33')];if(!_0x25b664[_0x8b24('0x35')]['hasOwnProperty'](_0x8b24('0x3c'))){_0x4de1cf[_0x8b24('0x1f')]=qs['limit'](_0x25b664[_0x8b24('0x35')][_0x8b24('0x1f')]);_0x4de1cf[_0x8b24('0x1e')]=qs[_0x8b24('0x1e')](_0x25b664['query'][_0x8b24('0x1e')]);}_0x4de1cf[_0x8b24('0x3d')]=qs[_0x8b24('0x3e')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3e')]);_0x4de1cf[_0x8b24('0x3f')]=qs['filters'](_[_0x8b24('0x40')](_0x25b664[_0x8b24('0x35')],_0xa37fe3[_0x8b24('0x37')]),_0x2ff6d7);if(_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]){_0x4de1cf[_0x8b24('0x3f')]=_[_0x8b24('0x42')](_0x4de1cf[_0x8b24('0x3f')],{'$or':_[_0x8b24('0x34')](_0x2ff6d7,function(_0x261e0f){if(_0x261e0f[_0x8b24('0x31')]!=='VIRTUAL'){var _0x1d319e={};_0x1d319e[_0x261e0f['name']]={'$like':'%'+_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]+'%'};return _0x1d319e;}})});}_0x4de1cf=_[_0x8b24('0x42')]({},_0x4de1cf,_0x25b664['options']);var _0x8a41d0={'where':_0x4de1cf[_0x8b24('0x3f')]};return db[_0x8b24('0x43')]['count'](_0x8a41d0)[_0x8b24('0x26')](function(_0x4f8da5){_0x28d351['count']=_0x4f8da5;if(_0x25b664[_0x8b24('0x35')]['includeAll']){_0x4de1cf['include']=[{'all':!![]}];}return db[_0x8b24('0x43')][_0x8b24('0x44')](_0x4de1cf);})[_0x8b24('0x26')](function(_0x3c6dc2){_0x28d351[_0x8b24('0x45')]=_0x3c6dc2;return _0x28d351;})[_0x8b24('0x26')](respondWithFilteredResult(_0x1ab949,_0x4de1cf))[_0x8b24('0x46')](handleError(_0x1ab949,null));};exports['show']=function(_0x58cd75,_0x39a9e8){var _0x38f78a={'raw':!![],'where':{'id':_0x58cd75[_0x8b24('0x47')]['id']}},_0x1752b0={};_0x1752b0['model']=_[_0x8b24('0x36')](db[_0x8b24('0x43')][_0x8b24('0x48')]);_0x1752b0['query']=_[_0x8b24('0x36')](_0x58cd75['query']);_0x1752b0[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0x1752b0['model'],_0x1752b0[_0x8b24('0x35')]);_0x38f78a[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0x1752b0[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x58cd75[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x38f78a[_0x8b24('0x39')]=_0x38f78a[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x38f78a[_0x8b24('0x39')]:_0x1752b0[_0x8b24('0x33')];if(_0x58cd75['query'][_0x8b24('0x49')]){_0x38f78a['include']=[{'all':!![]}];}_0x38f78a=_[_0x8b24('0x42')]({},_0x38f78a,_0x58cd75[_0x8b24('0x4a')]);return db['Tag']['find'](_0x38f78a)[_0x8b24('0x26')](handleEntityNotFound(_0x39a9e8,null))[_0x8b24('0x26')](respondWithResult(_0x39a9e8,null))[_0x8b24('0x46')](handleError(_0x39a9e8,null));};exports[_0x8b24('0x4b')]=function(_0x407b2f,_0x22619e){return db[_0x8b24('0x43')][_0x8b24('0x4b')](_0x407b2f['body'],{})['then'](function(_0x4b274c){var _0x3cacf8=_0x407b2f['user'][_0x8b24('0x28')]({'plain':!![]});if(!_0x3cacf8)throw new Error(_0x8b24('0x4c'));if(_0x3cacf8[_0x8b24('0x4d')]===_0x8b24('0x4e')){var _0x58a26d=_0x4b274c[_0x8b24('0x28')]({'plain':!![]});var _0x3df397=_0x8b24('0x29');return db[_0x8b24('0x4f')][_0x8b24('0x50')]({'where':{'name':_0x3df397,'userProfileId':_0x3cacf8[_0x8b24('0x51')]},'raw':!![]})[_0x8b24('0x26')](function(_0x1c208f){if(_0x1c208f&&_0x1c208f[_0x8b24('0x52')]===0x0){return db[_0x8b24('0x2a')][_0x8b24('0x4b')]({'name':_0x58a26d[_0x8b24('0x2d')],'resourceId':_0x58a26d['id'],'type':_0x1c208f[_0x8b24('0x2d')],'sectionId':_0x1c208f['id']},{})[_0x8b24('0x26')](function(){return _0x4b274c;});}else{return _0x4b274c;}})[_0x8b24('0x46')](function(_0x19bf6f){logger[_0x8b24('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19bf6f);throw _0x19bf6f;});}return _0x4b274c;})[_0x8b24('0x26')](respondWithResult(_0x22619e,0xc9))[_0x8b24('0x46')](handleError(_0x22619e,null));};exports[_0x8b24('0x25')]=function(_0x3dcec6,_0x4bac9f){if(_0x3dcec6[_0x8b24('0x53')]['id']){delete _0x3dcec6[_0x8b24('0x53')]['id'];}return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x3dcec6[_0x8b24('0x47')]['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x4bac9f,null))[_0x8b24('0x26')](saveUpdates(_0x3dcec6[_0x8b24('0x53')],null))[_0x8b24('0x26')](respondWithResult(_0x4bac9f,null))[_0x8b24('0x46')](handleError(_0x4bac9f,null));};exports[_0x8b24('0x27')]=function(_0x324222,_0x3ee4e2){return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x324222[_0x8b24('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ee4e2,null))['then'](removeEntity(_0x3ee4e2,null))['catch'](handleError(_0x3ee4e2,null));}; \ No newline at end of file +var _0xc788=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Tags','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter'];(function(_0x4aeb5a,_0x6765f2){var _0x6fbc9=function(_0x4bfc26){while(--_0x4bfc26){_0x4aeb5a['push'](_0x4aeb5a['shift']());}};_0x6fbc9(++_0x6765f2);}(_0xc788,0xc4));var _0x8c78=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0xc788[_0x5a8aa3];return _0x5d0458;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];function respondWithStatusCode(_0x4b2eca,_0x56a802){_0x56a802=_0x56a802||0xcc;return function(_0x349dfa){if(_0x349dfa){return _0x4b2eca[_0x8c78('0x18')](_0x56a802);}return _0x4b2eca[_0x8c78('0x19')](_0x56a802)[_0x8c78('0x1a')]();};}function respondWithResult(_0x2eedff,_0x3d1306){_0x3d1306=_0x3d1306||0xc8;return function(_0xe5f8ae){if(_0xe5f8ae){return _0x2eedff[_0x8c78('0x19')](_0x3d1306)[_0x8c78('0x1b')](_0xe5f8ae);}};}function respondWithFilteredResult(_0x1157d0,_0x4ff4b0){return function(_0x1fa78e){if(_0x1fa78e){var _0x293cfe=typeof _0x4ff4b0['offset']===_0x8c78('0x1c')&&typeof _0x4ff4b0[_0x8c78('0x1d')]===_0x8c78('0x1c');var _0x23824e=_0x1fa78e[_0x8c78('0x1e')];var _0x461eff=_0x293cfe?0x0:_0x4ff4b0['offset'];var _0x4f7bf9=_0x293cfe?_0x1fa78e[_0x8c78('0x1e')]:_0x4ff4b0['offset']+_0x4ff4b0['limit'];var _0xece4f0;if(_0x4f7bf9>=_0x23824e){_0x4f7bf9=_0x23824e;_0xece4f0=0xc8;}else{_0xece4f0=0xce;}_0x1157d0['status'](_0xece4f0);return _0x1157d0[_0x8c78('0x1f')](_0x8c78('0x20'),_0x461eff+'-'+_0x4f7bf9+'/'+_0x23824e)['json'](_0x1fa78e);}return null;};}function patchUpdates(_0x6c9a12){return function(_0x5b111b){try{jsonpatch[_0x8c78('0x21')](_0x5b111b,_0x6c9a12,!![]);}catch(_0x3af73c){return BPromise['reject'](_0x3af73c);}return _0x5b111b[_0x8c78('0x22')]();};}function saveUpdates(_0x188cc3,_0x499603){return function(_0x2bc595){if(_0x2bc595){return _0x2bc595[_0x8c78('0x23')](_0x188cc3)[_0x8c78('0x24')](function(_0x9581c6){return _0x9581c6;});}return null;};}function removeEntity(_0x215940,_0x20f483){return function(_0xbfdf6f){if(_0xbfdf6f){return _0xbfdf6f[_0x8c78('0x25')]()[_0x8c78('0x24')](function(){var _0x4a7d20=_0xbfdf6f[_0x8c78('0x26')]({'plain':!![]});var _0x458763=_0x8c78('0x27');return db['UserProfileResource'][_0x8c78('0x25')]({'where':{'type':_0x458763,'resourceId':_0x4a7d20['id']}})['then'](function(){return _0xbfdf6f;});})[_0x8c78('0x24')](function(){_0x215940[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x496c51,_0x583a74){return function(_0x2568d5){if(!_0x2568d5){_0x496c51['sendStatus'](0x194);}return _0x2568d5;};}function handleError(_0x20b128,_0x4376da){_0x4376da=_0x4376da||0x1f4;return function(_0x394c1d){logger[_0x8c78('0x28')](_0x394c1d[_0x8c78('0x29')]);if(_0x394c1d[_0x8c78('0x2a')]){delete _0x394c1d['name'];}_0x20b128[_0x8c78('0x19')](_0x4376da)['send'](_0x394c1d);};}exports[_0x8c78('0x2b')]=function(_0x17f4c8,_0xb69c52){var _0x4e764f={},_0x1f1a0c={},_0x3816d2={'count':0x0,'rows':[]};var _0x4f0005=_[_0x8c78('0x2c')](db[_0x8c78('0x2d')][_0x8c78('0x2e')],function(_0x487a4c){return{'name':_0x487a4c[_0x8c78('0x2f')],'type':_0x487a4c[_0x8c78('0x30')][_0x8c78('0x31')]};});_0x1f1a0c['model']=_[_0x8c78('0x2c')](_0x4f0005,_0x8c78('0x2a'));_0x1f1a0c['query']=_[_0x8c78('0x32')](_0x17f4c8[_0x8c78('0x33')]);_0x1f1a0c[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],_0x1f1a0c[_0x8c78('0x33')]);_0x4e764f[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],qs[_0x8c78('0x38')](_0x17f4c8['query'][_0x8c78('0x38')]));_0x4e764f[_0x8c78('0x37')]=_0x4e764f[_0x8c78('0x37')][_0x8c78('0x39')]?_0x4e764f[_0x8c78('0x37')]:_0x1f1a0c['model'];if(!_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x4e764f['limit']=qs[_0x8c78('0x1d')](_0x17f4c8[_0x8c78('0x33')]['limit']);_0x4e764f[_0x8c78('0x3c')]=qs['offset'](_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x4e764f[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x17f4c8['query'][_0x8c78('0x3e')]);_0x4e764f['where']=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x17f4c8[_0x8c78('0x33')],_0x1f1a0c['filters']),_0x4f0005);if(_0x17f4c8['query'][_0x8c78('0x40')]){_0x4e764f[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x4e764f[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x4f0005,function(_0x484931){if(_0x484931[_0x8c78('0x30')]!==_0x8c78('0x43')){var _0x1f0a2b={};_0x1f0a2b[_0x484931[_0x8c78('0x2a')]]={'$like':'%'+_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x40')]+'%'};return _0x1f0a2b;}})});}_0x4e764f=_[_0x8c78('0x42')]({},_0x4e764f,_0x17f4c8['options']);var _0x3995f4={'where':_0x4e764f[_0x8c78('0x41')]};return db['Tag']['count'](_0x3995f4)[_0x8c78('0x24')](function(_0x1612d5){_0x3816d2['count']=_0x1612d5;if(_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x44')]){_0x4e764f['include']=[{'all':!![]}];}return db[_0x8c78('0x2d')][_0x8c78('0x45')](_0x4e764f);})['then'](function(_0x10d521){_0x3816d2[_0x8c78('0x46')]=_0x10d521;return _0x3816d2;})[_0x8c78('0x24')](respondWithFilteredResult(_0xb69c52,_0x4e764f))[_0x8c78('0x47')](handleError(_0xb69c52,null));};exports[_0x8c78('0x48')]=function(_0x4e4880,_0x545d90){var _0x2841c2={'raw':!![],'where':{'id':_0x4e4880[_0x8c78('0x49')]['id']}},_0x2f6a6b={};_0x2f6a6b[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x2d')][_0x8c78('0x2e')]);_0x2f6a6b[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x4e4880[_0x8c78('0x33')]);_0x2f6a6b[_0x8c78('0x34')]=_['intersection'](_0x2f6a6b[_0x8c78('0x36')],_0x2f6a6b[_0x8c78('0x33')]);_0x2841c2[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x2f6a6b[_0x8c78('0x36')],qs['fields'](_0x4e4880[_0x8c78('0x33')][_0x8c78('0x38')]));_0x2841c2[_0x8c78('0x37')]=_0x2841c2[_0x8c78('0x37')][_0x8c78('0x39')]?_0x2841c2['attributes']:_0x2f6a6b[_0x8c78('0x36')];if(_0x4e4880['query']['includeAll']){_0x2841c2[_0x8c78('0x4a')]=[{'all':!![]}];}_0x2841c2=_[_0x8c78('0x42')]({},_0x2841c2,_0x4e4880[_0x8c78('0x4b')]);return db['Tag'][_0x8c78('0x4c')](_0x2841c2)[_0x8c78('0x24')](handleEntityNotFound(_0x545d90,null))[_0x8c78('0x24')](respondWithResult(_0x545d90,null))[_0x8c78('0x47')](handleError(_0x545d90,null));};exports[_0x8c78('0x4d')]=function(_0x38083e,_0x26103c){return db[_0x8c78('0x2d')][_0x8c78('0x4d')](_0x38083e['body'],{})[_0x8c78('0x24')](function(_0x1fcf97){var _0xba0de6=_0x38083e[_0x8c78('0x4e')]['get']({'plain':!![]});if(!_0xba0de6)throw new Error(_0x8c78('0x4f'));if(_0xba0de6[_0x8c78('0x50')]===_0x8c78('0x4e')){var _0x431125=_0x1fcf97['get']({'plain':!![]});var _0x336b95=_0x8c78('0x27');return db[_0x8c78('0x51')]['find']({'where':{'name':_0x336b95,'userProfileId':_0xba0de6[_0x8c78('0x52')]},'raw':!![]})['then'](function(_0xae80d){if(_0xae80d&&_0xae80d[_0x8c78('0x53')]===0x0){return db[_0x8c78('0x54')][_0x8c78('0x4d')]({'name':_0x431125[_0x8c78('0x2a')],'resourceId':_0x431125['id'],'type':_0xae80d[_0x8c78('0x2a')],'sectionId':_0xae80d['id']},{})[_0x8c78('0x24')](function(){return _0x1fcf97;});}else{return _0x1fcf97;}})[_0x8c78('0x47')](function(_0x19d807){logger[_0x8c78('0x28')](_0x8c78('0x55'),_0x19d807);throw _0x19d807;});}return _0x1fcf97;})[_0x8c78('0x24')](respondWithResult(_0x26103c,0xc9))[_0x8c78('0x47')](handleError(_0x26103c,null));};exports[_0x8c78('0x23')]=function(_0x54b40d,_0x22fe6c){if(_0x54b40d[_0x8c78('0x56')]['id']){delete _0x54b40d[_0x8c78('0x56')]['id'];}return db[_0x8c78('0x2d')]['find']({'where':{'id':_0x54b40d[_0x8c78('0x49')]['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x22fe6c,null))[_0x8c78('0x24')](saveUpdates(_0x54b40d[_0x8c78('0x56')],null))[_0x8c78('0x24')](respondWithResult(_0x22fe6c,null))[_0x8c78('0x47')](handleError(_0x22fe6c,null));};exports['destroy']=function(_0x1e616c,_0x42a34e){return db['Tag'][_0x8c78('0x4c')]({'where':{'id':_0x1e616c['params']['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x42a34e,null))[_0x8c78('0x24')](removeEntity(_0x42a34e,null))[_0x8c78('0x47')](handleError(_0x42a34e,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 49d0479..86575e8 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 _0xe50e=['request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','moment','bluebird'];(function(_0x150af2,_0x3dadbc){var _0x14961d=function(_0xfe44de){while(--_0xfe44de){_0x150af2['push'](_0x150af2['shift']());}};_0x14961d(++_0x3dadbc);}(_0xe50e,0xf9));var _0xee50=function(_0x3ffe5f,_0x2944ab){_0x3ffe5f=_0x3ffe5f-0x0;var _0x4adbdd=_0xe50e[_0x3ffe5f];return _0x4adbdd;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xee50('0x1'));var BPromise=require(_0xee50('0x2'));var rp=require(_0xee50('0x3'));var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require(_0xee50('0x6'));var attributes=require(_0xee50('0x7'));module[_0xee50('0x8')]=function(_0x3fe965,_0x3b0585){return _0x3fe965[_0xee50('0x9')](_0xee50('0xa'),attributes,{'tableName':_0xee50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7aa=['moment','bluebird','request-promise','../../config/environment','tools_tags','util','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x1f3757,_0x5043db){_0x1f3757=_0x1f3757-0x0;var _0x36c505=_0xa7aa[_0x1f3757];return _0x36c505;};'use strict';var _=require('lodash');var util=require(_0xaa7a('0x0'));var logger=require(_0xaa7a('0x1'))(_0xaa7a('0x2'));var moment=require(_0xaa7a('0x3'));var BPromise=require(_0xaa7a('0x4'));var rp=require(_0xaa7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa7a('0x6'));var attributes=require('./tag.attributes');module['exports']=function(_0x5675f3,_0x4159ec){return _0x5675f3['define']('Tag',attributes,{'tableName':_0xaa7a('0x7'),'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 ceb3e14..7586103 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','util'];(function(_0x2c68b8,_0x202e6a){var _0x14c7bf=function(_0x448186){while(--_0x448186){_0x2c68b8['push'](_0x2c68b8['shift']());}};_0x14c7bf(++_0x202e6a);}(_0xedd9,0xfc));var _0x9edd=function(_0x1cd85d,_0x539be1){_0x1cd85d=_0x1cd85d-0x0;var _0x49aa01=_0xedd9[_0x1cd85d];return _0x49aa01;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('Tag,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xe0c3=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1df35b,_0x5e7f81){var _0x47eb0b=function(_0x5a31eb){while(--_0x5a31eb){_0x1df35b['push'](_0x1df35b['shift']());}};_0x47eb0b(++_0x5e7f81);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var moment=require(_0x3e0c('0x1'));var BPromise=require(_0x3e0c('0x2'));var rs=require(_0x3e0c('0x3'));var fs=require('fs');var Redis=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];var utils=require(_0x3e0c('0x6'));var logger=require(_0x3e0c('0x7'))(_0x3e0c('0x8'));var config=require(_0x3e0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e339a,_0x3f6607,_0x243b5b){return new BPromise(function(_0x29673d,_0x2d2c39){return client[_0x3e0c('0xb')](_0x1e339a,_0x243b5b)[_0x3e0c('0xc')](function(_0x13ac88){logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,'request\x20sent');logger['debug'](_0x3e0c('0xf'),_0x3f6607,_0x3e0c('0x10'),JSON[_0x3e0c('0x11')](_0x13ac88));if(_0x13ac88[_0x3e0c('0x12')]){if(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x13')]===0x1f4){logger[_0x3e0c('0x12')]('Tag,\x20%s,\x20%s',_0x3f6607,_0x13ac88[_0x3e0c('0x12')]['message']);return _0x2d2c39(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}logger['error'](_0x3e0c('0xe'),_0x3f6607,_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);return _0x29673d(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}else{logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,_0x3e0c('0x10'));_0x29673d(_0x13ac88[_0x3e0c('0x15')][_0x3e0c('0x14')]);}})[_0x3e0c('0x16')](function(_0x1f8e71){logger['error']('Tag,\x20%s,\x20%s',_0x3f6607,_0x1f8e71);_0x2d2c39(_0x1f8e71);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f71aade..781b230 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 147900b..f735da9 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 _0x0713=['STRING','name'];(function(_0x463769,_0x5f4720){var _0x5e8753=function(_0x28f004){while(--_0x28f004){_0x463769['push'](_0x463769['shift']());}};_0x5e8753(++_0x5f4720);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x5b9a59,_0x37d51e){var _0x445e50=function(_0x39bf23){while(--_0x39bf23){_0x5b9a59['push'](_0x5b9a59['shift']());}};_0x445e50(++_0x37d51e);}(_0x2032,0xd9));var _0x2203=function(_0x7ef889,_0x5392c6){_0x7ef889=_0x7ef889-0x0;var _0xfb8e66=_0x2032[_0x7ef889];return _0xfb8e66;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d3abbad..4953bf1 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 _0x52ab=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','filter','where','merge','map','VIRTUAL','options','include','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','params','sequelize','transaction','Sequelize','UserId','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','sort','addQueues','add','Queues','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','penalty','QueueId','User','Queue','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','all','removeAgents','Openchannel','getAgents','nolimit','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a7917,_0x5a4b5a){var _0x5bfa26=function(_0x39987e){while(--_0x39987e){_0x2a7917['push'](_0x2a7917['shift']());}};_0x5bfa26(++_0x5a4b5a);}(_0x52ab,0x113));var _0xb52a=function(_0x484e01,_0x177d93){_0x484e01=_0x484e01-0x0;var _0x2746d3=_0x52ab[_0x484e01];return _0x2746d3;};'use strict';var emlformat=require(_0xb52a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb52a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb52a('0x2'));var moment=require('moment');var BPromise=require(_0xb52a('0x3'));var Mustache=require(_0xb52a('0x4'));var util=require(_0xb52a('0x5'));var path=require(_0xb52a('0x6'));var sox=require(_0xb52a('0x7'));var csv=require('to-csv');var ejs=require(_0xb52a('0x8'));var fs=require('fs');var fs_extra=require(_0xb52a('0x9'));var _=require(_0xb52a('0xa'));var squel=require('squel');var crypto=require(_0xb52a('0xb'));var jsforce=require(_0xb52a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb52a('0xd'));var Papa=require(_0xb52a('0xe'));var Redis=require(_0xb52a('0xf'));var authService=require(_0xb52a('0x10'));var qs=require(_0xb52a('0x11'));var as=require(_0xb52a('0x12'));var hardwareService=require(_0xb52a('0x13'));var logger=require(_0xb52a('0x14'))(_0xb52a('0x15'));var utils=require(_0xb52a('0x16'));var config=require(_0xb52a('0x17'));var licenseUtil=require(_0xb52a('0x18'));var db=require(_0xb52a('0x19'))['db'];config[_0xb52a('0x1a')]=_[_0xb52a('0x1b')](config[_0xb52a('0x1a')],{'host':_0xb52a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb52a('0x1a')]));require('./team.socket')[_0xb52a('0x1d')](socket);function respondWithStatusCode(_0x358a15,_0x4ad137){_0x4ad137=_0x4ad137||0xcc;return function(_0x21093a){if(_0x21093a){return _0x358a15[_0xb52a('0x1e')](_0x4ad137);}return _0x358a15[_0xb52a('0x1f')](_0x4ad137)[_0xb52a('0x20')]();};}function respondWithResult(_0x130d2e,_0x471314){_0x471314=_0x471314||0xc8;return function(_0x4f4e72){if(_0x4f4e72){return _0x130d2e[_0xb52a('0x1f')](_0x471314)[_0xb52a('0x21')](_0x4f4e72);}};}function respondWithFilteredResult(_0x260052,_0x24f9eb){return function(_0x2ce896){if(_0x2ce896){var _0x4e6f25=typeof _0x24f9eb[_0xb52a('0x22')]===_0xb52a('0x23')&&typeof _0x24f9eb[_0xb52a('0x24')]===_0xb52a('0x23');var _0x286168=_0x2ce896[_0xb52a('0x25')];var _0x3b9c2b=_0x4e6f25?0x0:_0x24f9eb[_0xb52a('0x22')];var _0x2b1977=_0x4e6f25?_0x2ce896[_0xb52a('0x25')]:_0x24f9eb[_0xb52a('0x22')]+_0x24f9eb['limit'];var _0x2c500e;if(_0x2b1977>=_0x286168){_0x2b1977=_0x286168;_0x2c500e=0xc8;}else{_0x2c500e=0xce;}_0x260052[_0xb52a('0x1f')](_0x2c500e);return _0x260052[_0xb52a('0x26')](_0xb52a('0x27'),_0x3b9c2b+'-'+_0x2b1977+'/'+_0x286168)[_0xb52a('0x21')](_0x2ce896);}return null;};}function patchUpdates(_0x48c1e8){return function(_0x5db94b){try{jsonpatch[_0xb52a('0x28')](_0x5db94b,_0x48c1e8,!![]);}catch(_0x21c049){return BPromise[_0xb52a('0x29')](_0x21c049);}return _0x5db94b[_0xb52a('0x2a')]();};}function saveUpdates(_0x56866c,_0x41ef2c){return function(_0x39ed4f){if(_0x39ed4f){return _0x39ed4f['update'](_0x56866c)[_0xb52a('0x2b')](function(_0x4a44a8){return _0x4a44a8;});}return null;};}function handleEntityNotFound(_0x5be38f,_0x2c3a55){return function(_0xca5333){if(!_0xca5333){_0x5be38f[_0xb52a('0x1e')](0x194);}return _0xca5333;};}function handleError(_0x3f87b7,_0x5a74d1){_0x5a74d1=_0x5a74d1||0x1f4;return function(_0x57bedb){logger[_0xb52a('0x2c')](_0x57bedb[_0xb52a('0x2d')]);if(_0x57bedb['name']){delete _0x57bedb[_0xb52a('0x2e')];}_0x3f87b7[_0xb52a('0x1f')](_0x5a74d1)[_0xb52a('0x2f')](_0x57bedb);};}exports['index']=function(_0x381dcb,_0x590668){var _0x12e0cf={},_0x509cb5={},_0x596a7a={'count':0x0,'rows':[]};var _0xa3df40=_['map'](db[_0xb52a('0x30')][_0xb52a('0x31')],function(_0xe06f83){return{'name':_0xe06f83[_0xb52a('0x32')],'type':_0xe06f83[_0xb52a('0x33')][_0xb52a('0x34')]};});_0x509cb5[_0xb52a('0x35')]=_['map'](_0xa3df40,'name');_0x509cb5[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x381dcb['query']);_0x509cb5[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x509cb5[_0xb52a('0x35')],_0x509cb5['query']);_0x12e0cf[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x509cb5[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x12e0cf[_0xb52a('0x3a')]=_0x12e0cf[_0xb52a('0x3a')][_0xb52a('0x3c')]?_0x12e0cf['attributes']:_0x509cb5[_0xb52a('0x35')];if(!_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3d')]('nolimit')){_0x12e0cf[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0x381dcb['query'][_0xb52a('0x24')]);_0x12e0cf[_0xb52a('0x22')]=qs[_0xb52a('0x22')](_0x381dcb[_0xb52a('0x36')][_0xb52a('0x22')]);}_0x12e0cf[_0xb52a('0x3e')]=qs['sort'](_0x381dcb['query']['sort']);_0x12e0cf['where']=qs['filters'](_['pick'](_0x381dcb[_0xb52a('0x36')],_0x509cb5[_0xb52a('0x38')]),_0xa3df40);if(_0x381dcb[_0xb52a('0x36')][_0xb52a('0x3f')]){_0x12e0cf[_0xb52a('0x40')]=_[_0xb52a('0x41')](_0x12e0cf['where'],{'$or':_[_0xb52a('0x42')](_0xa3df40,function(_0x4739ec){if(_0x4739ec[_0xb52a('0x33')]!==_0xb52a('0x43')){var _0x577079={};_0x577079[_0x4739ec[_0xb52a('0x2e')]]={'$like':'%'+_0x381dcb['query'][_0xb52a('0x3f')]+'%'};return _0x577079;}})});}_0x12e0cf=_[_0xb52a('0x41')]({},_0x12e0cf,_0x381dcb[_0xb52a('0x44')]);var _0x44a79d={'where':_0x12e0cf['where']};return db[_0xb52a('0x30')][_0xb52a('0x25')](_0x44a79d)[_0xb52a('0x2b')](function(_0x4788bf){_0x596a7a['count']=_0x4788bf;if(_0x381dcb[_0xb52a('0x36')]['includeAll']){_0x12e0cf[_0xb52a('0x45')]=[{'all':!![]}];}return db[_0xb52a('0x30')]['findAll'](_0x12e0cf);})[_0xb52a('0x2b')](function(_0x16fb3d){_0x596a7a[_0xb52a('0x46')]=_0x16fb3d;return _0x596a7a;})[_0xb52a('0x2b')](respondWithFilteredResult(_0x590668,_0x12e0cf))[_0xb52a('0x47')](handleError(_0x590668,null));};exports[_0xb52a('0x48')]=function(_0x293431,_0x53684f){var _0x2569a5={'raw':![],'where':{'id':_0x293431['params']['id']}},_0x127ef7={};_0x127ef7[_0xb52a('0x35')]=_[_0xb52a('0x37')](db[_0xb52a('0x30')]['rawAttributes']);_0x127ef7[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x293431[_0xb52a('0x36')]);_0x127ef7['filters']=_[_0xb52a('0x39')](_0x127ef7[_0xb52a('0x35')],_0x127ef7[_0xb52a('0x36')]);_0x2569a5[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x127ef7[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x293431[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x2569a5[_0xb52a('0x3a')]=_0x2569a5['attributes'][_0xb52a('0x3c')]?_0x2569a5[_0xb52a('0x3a')]:_0x127ef7[_0xb52a('0x35')];if(_0x293431[_0xb52a('0x36')][_0xb52a('0x49')]){_0x2569a5['include']=[{'all':!![]}];}_0x2569a5=_['merge']({},_0x2569a5,_0x293431[_0xb52a('0x44')]);return db[_0xb52a('0x30')]['find'](_0x2569a5)[_0xb52a('0x2b')](handleEntityNotFound(_0x53684f,null))[_0xb52a('0x2b')](respondWithResult(_0x53684f,null))[_0xb52a('0x47')](handleError(_0x53684f,null));};exports[_0xb52a('0x4a')]=function(_0x66afe1,_0x15736e){return db[_0xb52a('0x30')][_0xb52a('0x4a')](_0x66afe1[_0xb52a('0x4b')],{})[_0xb52a('0x2b')](function(_0x1f51b9){var _0x2599b9=_0x66afe1[_0xb52a('0x4c')][_0xb52a('0x4d')]({'plain':!![]});if(!_0x2599b9)throw new Error(_0xb52a('0x4e'));if(_0x2599b9[_0xb52a('0x4f')]===_0xb52a('0x4c')){var _0x353f38=_0x1f51b9[_0xb52a('0x4d')]({'plain':!![]});var _0x1cebcd=_0xb52a('0x50');return db['UserProfileSection'][_0xb52a('0x51')]({'where':{'name':_0x1cebcd,'userProfileId':_0x2599b9[_0xb52a('0x52')]},'raw':!![]})['then'](function(_0x2b27ef){if(_0x2b27ef&&_0x2b27ef['autoAssociation']===0x0){return db[_0xb52a('0x53')][_0xb52a('0x4a')]({'name':_0x353f38[_0xb52a('0x2e')],'resourceId':_0x353f38['id'],'type':_0x2b27ef[_0xb52a('0x2e')],'sectionId':_0x2b27ef['id']},{})[_0xb52a('0x2b')](function(){return _0x1f51b9;});}else{return _0x1f51b9;}})[_0xb52a('0x47')](function(_0x1688e2){logger[_0xb52a('0x2c')](_0xb52a('0x54'),_0x1688e2);throw _0x1688e2;});}return _0x1f51b9;})[_0xb52a('0x2b')](respondWithResult(_0x15736e,0xc9))[_0xb52a('0x47')](handleError(_0x15736e,null));};exports['update']=function(_0x2b98b6,_0x13fc94){if(_0x2b98b6[_0xb52a('0x4b')]['id']){delete _0x2b98b6[_0xb52a('0x4b')]['id'];}return db[_0xb52a('0x30')][_0xb52a('0x51')]({'where':{'id':_0x2b98b6['params']['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x13fc94,null))[_0xb52a('0x2b')](saveUpdates(_0x2b98b6[_0xb52a('0x4b')],null))['then'](respondWithResult(_0x13fc94,null))[_0xb52a('0x47')](handleError(_0x13fc94,null));};exports[_0xb52a('0x55')]=function(_0x2151be,_0x5c3a42){var _0x1d365d=_0x2151be[_0xb52a('0x56')]['id'];var _0x5dde9d=[];return db[_0xb52a('0x57')][_0xb52a('0x58')](function(_0x266106){var _0x31e0ef='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db[_0xb52a('0x57')][_0xb52a('0x36')](_0x31e0ef,{'type':db[_0xb52a('0x59')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x266106})[_0xb52a('0x2b')](function(_0x10d641){_0x5dde9d=_[_0xb52a('0x42')](_0x10d641,function(_0x2535d2){return Number(_0x2535d2[_0xb52a('0x5a')]);});})[_0xb52a('0x2b')](function(){var _0x274490='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x274490,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')]['SELECT'],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x471829){var _0x5d7787=_[_0xb52a('0x42')](_0x471829,function(_0x285720){return Number(_0x285720[_0xb52a('0x5c')]);});return db[_0xb52a('0x5d')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'VoiceQueueId':{'$in':_0x5d7787}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x5d498b=_0xb52a('0x5e')+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x5d498b,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x1ab487){var _0x1e401b=_[_0xb52a('0x42')](_0x1ab487,function(_0x3a9aba){return Number(_0x3a9aba[_0xb52a('0x60')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x5dde9d},'MailQueueId':{'$in':_0x1e401b}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x1aeb7f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x1aeb7f,{'type':db[_0xb52a('0x59')]['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x47249f){var _0x3e4427=_[_0xb52a('0x42')](_0x47249f,function(_0x35b311){return Number(_0x35b311[_0xb52a('0x61')]);});return db['UserSmsQueue'][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'SmsQueueId':{'$in':_0x3e4427}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x398485=_0xb52a('0x62')+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x398485,{'type':db[_0xb52a('0x59')]['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x4f64a0){var _0x516098=_[_0xb52a('0x42')](_0x4f64a0,function(_0x24b88f){return Number(_0x24b88f[_0xb52a('0x63')]);});return db[_0xb52a('0x64')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'ChatQueueId':{'$in':_0x516098}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x229524='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db['sequelize'][_0xb52a('0x36')](_0x229524,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x4782da){var _0x5019d7=_['map'](_0x4782da,function(_0x3ebfc0){return Number(_0x3ebfc0[_0xb52a('0x65')]);});return db[_0xb52a('0x66')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'FaxQueueId':{'$in':_0x5019d7}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0x19bf02=_0xb52a('0x67')+_0x1d365d;return db[_0xb52a('0x57')][_0xb52a('0x36')](_0x19bf02,{'type':db['Sequelize']['QueryTypes'][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x439b20){var _0x1b2e6c=_[_0xb52a('0x42')](_0x439b20,function(_0x4a1cb7){return Number(_0x4a1cb7[_0xb52a('0x68')]);});return db['UserOpenchannelQueue'][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'OpenchannelQueueId':{'$in':_0x1b2e6c}},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){var _0xb30da1='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1d365d;return db[_0xb52a('0x57')]['query'](_0xb30da1,{'type':db[_0xb52a('0x59')][_0xb52a('0x5b')][_0xb52a('0x5f')],'raw':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0x5b5927){var _0x57e4f4=_[_0xb52a('0x42')](_0x5b5927,function(_0x1053e5){return Number(_0x1053e5[_0xb52a('0x69')]);});return db[_0xb52a('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5dde9d},'WhatsappQueueId':{'$in':_0x57e4f4}},'transaction':_0x266106});})['then'](function(){return db[_0xb52a('0x6b')]['find']({'where':{'TeamId':_0x1d365d}});})[_0xb52a('0x2b')](function(_0x3db747){if(_0x3db747===null){return;}return db[_0xb52a('0x6c')][_0xb52a('0x55')]({'where':{'UserId':{'$in':_0x5dde9d},'VoicePrefixId':_0x3db747[_0xb52a('0x6d')]},'transaction':_0x266106});})[_0xb52a('0x2b')](function(){return db['Team'][_0xb52a('0x55')]({'where':{'id':_0x1d365d},'cascade':!![],'transaction':_0x266106});})[_0xb52a('0x2b')](function(_0xe0ca9c){if(_0xe0ca9c===0x0){_0x5c3a42[_0xb52a('0x1e')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0xb52a('0x50'),'resourceId':_0x1d365d},'cascade':!![],'transaction':_0x266106})[_0xb52a('0x2b')](function(){_0x5c3a42[_0xb52a('0x1f')](0xcc)[_0xb52a('0x20')]();});}})['catch'](function(_0x5edd45){_0x5c3a42[_0xb52a('0x1f')](0x1f4)[_0xb52a('0x2f')](_0x5edd45);});});};exports[_0xb52a('0x6e')]=function(_0x54d823,_0x10d145,_0x59ef8b){return db[_0xb52a('0x30')][_0xb52a('0x6f')]({'where':{'id':_0x54d823[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x10d145,null))[_0xb52a('0x2b')](function(_0x4d50e1){if(!_0x54d823['query'][_0xb52a('0x70')]||!utils[_0xb52a('0x71')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')])){throw new db['Sequelize'][(_0xb52a('0x72'))]('Unknown\x20channel');}var _0x3a4ff7={};var _0x2b3b4b={};_0x2b3b4b[_0xb52a('0x35')]=_['keys'](db[_[_0xb52a('0x73')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')][_0xb52a('0x74')]())+'Queue'][_0xb52a('0x31')]);_0x2b3b4b[_0xb52a('0x36')]=_[_0xb52a('0x37')](_0x54d823[_0xb52a('0x36')]);_0x2b3b4b[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x2b3b4b[_0xb52a('0x35')],_0x2b3b4b['query']);_0x3a4ff7[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x2b3b4b[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x3b')]));_0x3a4ff7[_0xb52a('0x3a')]=_0x3a4ff7[_0xb52a('0x3a')][_0xb52a('0x3c')]?_0x3a4ff7[_0xb52a('0x3a')]:_0x2b3b4b[_0xb52a('0x35')];_0x3a4ff7[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x24')]);_0x3a4ff7[_0xb52a('0x22')]=qs['offset'](_0x54d823[_0xb52a('0x36')][_0xb52a('0x22')]);_0x3a4ff7['order']=qs[_0xb52a('0x75')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x75')]);_0x3a4ff7['where']=qs['filters'](_['pick'](_0x54d823[_0xb52a('0x36')],_0x2b3b4b[_0xb52a('0x38')]));_0x3a4ff7=_['merge']({},_0x3a4ff7,_0x54d823[_0xb52a('0x44')]);return _0x4d50e1[_0xb52a('0x4d')+_[_0xb52a('0x73')](_0x54d823[_0xb52a('0x36')][_0xb52a('0x70')][_0xb52a('0x74')]())+'Queues'](_0x3a4ff7);})[_0xb52a('0x2b')](respondWithResult(_0x10d145,null))[_0xb52a('0x47')](handleError(_0x10d145,null));};exports[_0xb52a('0x76')]=function(_0x2c0fa1,_0x45732c,_0x4d25c3){return db[_0xb52a('0x30')][_0xb52a('0x6f')]({'where':{'id':_0x2c0fa1[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](function(_0x2fe77b){if(_0x2fe77b){if(!_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')]||!utils[_0xb52a('0x71')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')])){throw new db[(_0xb52a('0x59'))][(_0xb52a('0x72'))]('Unknown\x20channel');}return _0x2fe77b[_0xb52a('0x77')+_[_0xb52a('0x73')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x70')]['toLowerCase']())+_0xb52a('0x78')](_0x2c0fa1[_0xb52a('0x4b')][_0xb52a('0x79')]);}return null;})[_0xb52a('0x2b')](handleEntityNotFound(_0x45732c,null))['then'](respondWithStatusCode(_0x45732c,null))[_0xb52a('0x47')](handleError(_0x45732c,null));};exports['removeQueues']=function(_0x192fa7,_0x2e4e20,_0x16ceba){return db['Team'][_0xb52a('0x6f')]({'where':{'id':_0x192fa7['params']['id']}})['then'](function(_0x5939bf){if(_0x5939bf){if(!_0x192fa7[_0xb52a('0x36')]['channel']||!utils[_0xb52a('0x71')](_0x192fa7['query'][_0xb52a('0x70')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x5939bf[_0xb52a('0x7a')+_[_0xb52a('0x73')](_0x192fa7[_0xb52a('0x36')]['channel'][_0xb52a('0x74')]())+_0xb52a('0x78')](_0x192fa7[_0xb52a('0x36')][_0xb52a('0x79')]);}return null;})[_0xb52a('0x2b')](handleEntityNotFound(_0x2e4e20,null))[_0xb52a('0x2b')](respondWithStatusCode(_0x2e4e20,null))[_0xb52a('0x47')](handleError(_0x2e4e20,null));};exports[_0xb52a('0x7b')]=function(_0x4f7170,_0x2e8628){var _0x42e547=_[_0xb52a('0x7c')](_0x4f7170['body'][_0xb52a('0x79')])?_0x4f7170[_0xb52a('0x4b')][_0xb52a('0x79')]:[_0x4f7170['body'][_0xb52a('0x79')]];var _0x4fb67a=_0x4f7170['params']['id'];return db[_0xb52a('0x30')][_0xb52a('0x51')]({'where':{'id':_0x4fb67a}})[_0xb52a('0x2b')](handleEntityNotFound(_0x2e8628,null))[_0xb52a('0x2b')](function(_0x39965b){if(_0x39965b){var _0x513ff2=[_0xb52a('0x7d'),_0xb52a('0x7e'),_0xb52a('0x7f'),_0xb52a('0x80'),_0xb52a('0x81'),'Openchannel','Whatsapp'];return db[_0xb52a('0x57')]['transaction'](function(_0x2ba03e){var _0x1296be=_[_0xb52a('0x42')](_0x513ff2,function(_0x3a78e8){var _0x55b61c={'attributes':['id',_0xb52a('0x2e')]};if(_0x3a78e8===_0xb52a('0x7d')){_0x55b61c[_0xb52a('0x82')]={'attributes':[_0xb52a('0x83')]};}return _0x39965b['get'+_0x3a78e8+_0xb52a('0x78')](_0x55b61c)[_0xb52a('0x2b')](function(_0x1d9425){var _0x250cac=_['map'](_0x1d9425,function(_0x4e68ff){var _0x1b77c1=_[_0xb52a('0x42')](_0x42e547,function(_0x3ef03d){var _0x54a58d={'where':{'UserId':_0x3ef03d,[_0x3a78e8+_0xb52a('0x84')]:_0x4e68ff['id']},'transaction':_0x2ba03e};if(_0x3a78e8===_0xb52a('0x7d')){_0x54a58d[_0xb52a('0x1b')]={'penalty':_0x4e68ff['TeamVoiceQueue'][_0xb52a('0x83')]};}return db[_0xb52a('0x85')+_0x3a78e8+_0xb52a('0x86')][_0xb52a('0x87')](_0x54a58d)['then'](function(){socket[_0xb52a('0x88')](_0xb52a('0x4c')+_0x3a78e8+_0xb52a('0x89'),{'UserId':_0x3ef03d,[_0x3a78e8+_0xb52a('0x84')]:_0x4e68ff['id']});if(_0x3a78e8!=='Voice'){return;}return db[_0xb52a('0x85')][_0xb52a('0x8a')]({'where':{'id':_0x42e547,'online':0x1},'attributes':['id',_0xb52a('0x2e'),_0xb52a('0x8b'),_0xb52a('0x8c'),_0xb52a('0x8d')],'raw':!![]})[_0xb52a('0x2b')](function(_0x2ef232){var _0x5ba662=_[_0xb52a('0x42')](_0x2ef232,function(_0x3d1400){return db[_0xb52a('0x8e')][_0xb52a('0x8f')]({'membername':_0x3d1400['name'],'UserId':_0x3d1400['id'],'queue_name':_0x4e68ff['name'],'VoiceQueueId':_0x4e68ff['id'],'interface':_['isNil'](_0x3d1400[_0xb52a('0x8d')])?util['format']('SIP/%s',_0x3d1400['name']):_0x3d1400[_0xb52a('0x8d')],'paused':_0x3d1400['voicePause']||![],'penalty':_0x4e68ff['TeamVoiceQueue'][_0xb52a('0x83')]},{'transaction':_0x2ba03e});});return Promise[_0xb52a('0x90')](_0x5ba662);});});});return Promise[_0xb52a('0x90')](_0x1b77c1);});return Promise['all'](_0x250cac);})[_0xb52a('0x2b')](function(){return db[_0xb52a('0x6b')][_0xb52a('0x6f')]({'where':{'teamId':_0x4fb67a}})[_0xb52a('0x2b')](function(_0x2c7c10){if(_0x2c7c10){var _0x5668c4=_['map'](_0x42e547,function(_0x550298){db[_0xb52a('0x6c')]['upsert']({'UserId':_0x550298,'VoicePrefixId':_0x2c7c10[_0xb52a('0x6d')]});});return Promise[_0xb52a('0x90')](_0x5668c4);}});});});return Promise[_0xb52a('0x90')](_0x1296be)['then'](function(){return _0x39965b[_0xb52a('0x7b')](_0x42e547,{'transaction':_0x2ba03e})['spread'](function(_0x56ce8b){return _0x56ce8b;});});});}})[_0xb52a('0x2b')](respondWithResult(_0x2e8628,null))['catch'](handleError(_0x2e8628,null));};exports[_0xb52a('0x91')]=function(_0x44ca7e,_0x52caa0){var _0x35b92d=_[_0xb52a('0x7c')](_0x44ca7e[_0xb52a('0x36')][_0xb52a('0x79')])?_0x44ca7e[_0xb52a('0x36')]['ids']:[_0x44ca7e[_0xb52a('0x36')][_0xb52a('0x79')]];var _0x155651=_0x44ca7e['params']['id'];return db['Team'][_0xb52a('0x51')]({'where':{'id':_0x155651}})[_0xb52a('0x2b')](handleEntityNotFound(_0x52caa0,null))['then'](function(_0x1ddaa5){if(_0x1ddaa5){var _0x43909a=[_0xb52a('0x7d'),_0xb52a('0x7e'),_0xb52a('0x7f'),'Sms',_0xb52a('0x81'),_0xb52a('0x92'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x5d9718){var _0x31d72f=_[_0xb52a('0x42')](_0x43909a,function(_0x5874bd){var _0x4bfe95={'attributes':['id',_0xb52a('0x2e')]};return _0x1ddaa5[_0xb52a('0x4d')+_0x5874bd+_0xb52a('0x78')](_0x4bfe95)[_0xb52a('0x2b')](function(_0x4df53f){var _0x4a48fc=_[_0xb52a('0x42')](_0x4df53f,function(_0x111ff6){return _0x111ff6[_0xb52a('0x91')](_0x35b92d,{'transaction':_0x5d9718})['then'](function(){var _0x3eae19=_[_0xb52a('0x42')](_0x35b92d,function(_0x1453e4){socket[_0xb52a('0x88')](_0xb52a('0x4c')+_0x5874bd+'Queue:remove',{'UserId':Number(_0x1453e4),[_0x5874bd+_0xb52a('0x84')]:_0x111ff6['id']});if(_0x5874bd!=='Voice'){return;}return db[_0xb52a('0x8e')][_0xb52a('0x55')]({'where':{'VoiceQueueId':_0x111ff6['id'],'UserId':_0x1453e4},'transaction':_0x5d9718});});return Promise['all'](_0x3eae19);});});return Promise['all'](_0x4a48fc);});});return Promise[_0xb52a('0x90')](_0x31d72f)[_0xb52a('0x2b')](function(){return _0x1ddaa5[_0xb52a('0x91')](_0x35b92d,{'transaction':_0x5d9718});})['then'](function(){return db[_0xb52a('0x6b')][_0xb52a('0x6f')]({'where':{'teamId':_0x155651}})[_0xb52a('0x2b')](function(_0x4e12bf){if(_0x4e12bf){var _0x8b6228=_[_0xb52a('0x42')](_0x35b92d,function(_0x3bda36){db['UserVoicePrefix'][_0xb52a('0x55')]({'where':{'UserId':_0x3bda36,'VoicePrefixId':_0x4e12bf[_0xb52a('0x6d')]}});});return Promise[_0xb52a('0x90')](_0x8b6228);}});});});}})['then'](respondWithStatusCode(_0x52caa0,null))['catch'](handleError(_0x52caa0,null));};exports[_0xb52a('0x93')]=function(_0xff14e7,_0x153706,_0x500b0d){var _0x13f15a={};var _0x1d97de={};var _0x22127f;var _0x248939;return db['Team'][_0xb52a('0x6f')]({'where':{'id':_0xff14e7[_0xb52a('0x56')]['id']}})[_0xb52a('0x2b')](handleEntityNotFound(_0x153706,null))[_0xb52a('0x2b')](function(_0x2b9364){if(_0x2b9364){_0x22127f=_0x2b9364;_0x1d97de[_0xb52a('0x35')]=_[_0xb52a('0x37')](db[_0xb52a('0x85')][_0xb52a('0x31')]);_0x1d97de['query']=_['keys'](_0xff14e7[_0xb52a('0x36')]);_0x1d97de[_0xb52a('0x38')]=_[_0xb52a('0x39')](_0x1d97de[_0xb52a('0x35')],_0x1d97de[_0xb52a('0x36')]);_0x13f15a[_0xb52a('0x3a')]=_[_0xb52a('0x39')](_0x1d97de[_0xb52a('0x35')],qs[_0xb52a('0x3b')](_0xff14e7['query']['fields']));_0x13f15a[_0xb52a('0x3a')]=_0x13f15a[_0xb52a('0x3a')]['length']?_0x13f15a['attributes']:_0x1d97de['model'];_0x13f15a[_0xb52a('0x3e')]=qs[_0xb52a('0x75')](_0xff14e7[_0xb52a('0x36')][_0xb52a('0x75')]);_0x13f15a['where']=qs['filters'](_['pick'](_0xff14e7[_0xb52a('0x36')],_0x1d97de[_0xb52a('0x38')]));if(_0xff14e7['query'][_0xb52a('0x3f')]){_0x13f15a[_0xb52a('0x40')]=_[_0xb52a('0x41')](_0x13f15a['where'],{'$or':_['map'](_0x13f15a[_0xb52a('0x3a')],function(_0x2d59c4){var _0x199e9f={};_0x199e9f[_0x2d59c4]={'$like':'%'+_0xff14e7[_0xb52a('0x36')][_0xb52a('0x3f')]+'%'};return _0x199e9f;})});}_0x13f15a=_[_0xb52a('0x41')]({},_0x13f15a,_0xff14e7['options']);return _0x22127f[_0xb52a('0x93')](_0x13f15a);}})['then'](function(_0x56d5b9){if(_0x56d5b9){_0x248939=_0x56d5b9[_0xb52a('0x3c')];if(!_0xff14e7[_0xb52a('0x36')][_0xb52a('0x3d')](_0xb52a('0x94'))){_0x13f15a[_0xb52a('0x24')]=qs[_0xb52a('0x24')](_0xff14e7[_0xb52a('0x36')][_0xb52a('0x24')]);_0x13f15a['offset']=qs[_0xb52a('0x22')](_0xff14e7['query'][_0xb52a('0x22')]);}return _0x22127f[_0xb52a('0x93')](_0x13f15a);}})[_0xb52a('0x2b')](function(_0x20e556){if(_0x20e556){return _0x20e556?{'count':_0x248939,'rows':_0x20e556}:null;}})['then'](respondWithResult(_0x153706,null))['catch'](handleError(_0x153706,null));}; \ No newline at end of file +var _0x7e25=['lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','./team.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','Team','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','fields','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','findOne','ValidationError','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','defaults','TeamVoiceQueue','User','emit','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','isNil','all','spread','removeAgents','isArray','transaction','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x70b563,_0x29a126){var _0x3fb114=function(_0x429a0a){while(--_0x429a0a){_0x70b563['push'](_0x70b563['shift']());}};_0x3fb114(++_0x29a126);}(_0x7e25,0x1b4));var _0x57e2=function(_0x1066a3,_0x4ae4b6){_0x1066a3=_0x1066a3-0x0;var _0x488ca3=_0x7e25[_0x1066a3];return _0x488ca3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57e2('0x0'));var zipdir=require(_0x57e2('0x1'));var jsonpatch=require(_0x57e2('0x2'));var rp=require('request-promise');var moment=require(_0x57e2('0x3'));var BPromise=require(_0x57e2('0x4'));var Mustache=require(_0x57e2('0x5'));var util=require(_0x57e2('0x6'));var path=require(_0x57e2('0x7'));var sox=require(_0x57e2('0x8'));var csv=require('to-csv');var ejs=require(_0x57e2('0x9'));var fs=require('fs');var fs_extra=require(_0x57e2('0xa'));var _=require(_0x57e2('0xb'));var squel=require('squel');var crypto=require(_0x57e2('0xc'));var jsforce=require(_0x57e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x57e2('0xe'));var querystring=require(_0x57e2('0xf'));var Papa=require(_0x57e2('0x10'));var Redis=require(_0x57e2('0x11'));var authService=require(_0x57e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x57e2('0x13'));var hardwareService=require(_0x57e2('0x14'));var logger=require(_0x57e2('0x15'))(_0x57e2('0x16'));var utils=require(_0x57e2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x57e2('0x18'));var db=require('../../mysqldb')['db'];config[_0x57e2('0x19')]=_['defaults'](config[_0x57e2('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57e2('0x19')]));require(_0x57e2('0x1a'))['register'](socket);function respondWithStatusCode(_0x166f46,_0x4a56a3){_0x4a56a3=_0x4a56a3||0xcc;return function(_0x31987c){if(_0x31987c){return _0x166f46[_0x57e2('0x1b')](_0x4a56a3);}return _0x166f46[_0x57e2('0x1c')](_0x4a56a3)[_0x57e2('0x1d')]();};}function respondWithResult(_0x1d572f,_0x5d427b){_0x5d427b=_0x5d427b||0xc8;return function(_0x161333){if(_0x161333){return _0x1d572f[_0x57e2('0x1c')](_0x5d427b)[_0x57e2('0x1e')](_0x161333);}};}function respondWithFilteredResult(_0x4cee41,_0x163d21){return function(_0x41ffcf){if(_0x41ffcf){var _0x493a38=typeof _0x163d21['offset']===_0x57e2('0x1f')&&typeof _0x163d21[_0x57e2('0x20')]===_0x57e2('0x1f');var _0x32b900=_0x41ffcf[_0x57e2('0x21')];var _0x323065=_0x493a38?0x0:_0x163d21[_0x57e2('0x22')];var _0x15d87b=_0x493a38?_0x41ffcf[_0x57e2('0x21')]:_0x163d21[_0x57e2('0x22')]+_0x163d21['limit'];var _0x5b69c7;if(_0x15d87b>=_0x32b900){_0x15d87b=_0x32b900;_0x5b69c7=0xc8;}else{_0x5b69c7=0xce;}_0x4cee41['status'](_0x5b69c7);return _0x4cee41[_0x57e2('0x23')](_0x57e2('0x24'),_0x323065+'-'+_0x15d87b+'/'+_0x32b900)[_0x57e2('0x1e')](_0x41ffcf);}return null;};}function patchUpdates(_0x11ef3a){return function(_0x2ea074){try{jsonpatch[_0x57e2('0x25')](_0x2ea074,_0x11ef3a,!![]);}catch(_0xbb447){return BPromise[_0x57e2('0x26')](_0xbb447);}return _0x2ea074[_0x57e2('0x27')]();};}function saveUpdates(_0x4e39a7,_0x2313ef){return function(_0x5cb1a9){if(_0x5cb1a9){return _0x5cb1a9[_0x57e2('0x28')](_0x4e39a7)[_0x57e2('0x29')](function(_0x1eba1d){return _0x1eba1d;});}return null;};}function handleEntityNotFound(_0x37bead,_0x33d56c){return function(_0x1ef680){if(!_0x1ef680){_0x37bead[_0x57e2('0x1b')](0x194);}return _0x1ef680;};}function handleError(_0x2e7d6f,_0x21b934){_0x21b934=_0x21b934||0x1f4;return function(_0x25b690){logger['error'](_0x25b690['stack']);if(_0x25b690[_0x57e2('0x2a')]){delete _0x25b690[_0x57e2('0x2a')];}_0x2e7d6f[_0x57e2('0x1c')](_0x21b934)[_0x57e2('0x2b')](_0x25b690);};}exports[_0x57e2('0x2c')]=function(_0x543e31,_0x5cc7e4){var _0x1a7ec8={},_0x35fb2c={},_0x281f83={'count':0x0,'rows':[]};var _0x3b60f6=_[_0x57e2('0x2d')](db[_0x57e2('0x2e')][_0x57e2('0x2f')],function(_0x10ca2b){return{'name':_0x10ca2b[_0x57e2('0x30')],'type':_0x10ca2b['type']['key']};});_0x35fb2c[_0x57e2('0x31')]=_['map'](_0x3b60f6,_0x57e2('0x2a'));_0x35fb2c[_0x57e2('0x32')]=_[_0x57e2('0x33')](_0x543e31['query']);_0x35fb2c[_0x57e2('0x34')]=_[_0x57e2('0x35')](_0x35fb2c[_0x57e2('0x31')],_0x35fb2c[_0x57e2('0x32')]);_0x1a7ec8[_0x57e2('0x36')]=_[_0x57e2('0x35')](_0x35fb2c[_0x57e2('0x31')],qs['fields'](_0x543e31[_0x57e2('0x32')]['fields']));_0x1a7ec8[_0x57e2('0x36')]=_0x1a7ec8[_0x57e2('0x36')][_0x57e2('0x37')]?_0x1a7ec8['attributes']:_0x35fb2c[_0x57e2('0x31')];if(!_0x543e31[_0x57e2('0x32')]['hasOwnProperty'](_0x57e2('0x38'))){_0x1a7ec8[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x543e31['query'][_0x57e2('0x20')]);_0x1a7ec8[_0x57e2('0x22')]=qs[_0x57e2('0x22')](_0x543e31[_0x57e2('0x32')][_0x57e2('0x22')]);}_0x1a7ec8[_0x57e2('0x39')]=qs[_0x57e2('0x3a')](_0x543e31[_0x57e2('0x32')][_0x57e2('0x3a')]);_0x1a7ec8[_0x57e2('0x3b')]=qs[_0x57e2('0x34')](_[_0x57e2('0x3c')](_0x543e31[_0x57e2('0x32')],_0x35fb2c[_0x57e2('0x34')]),_0x3b60f6);if(_0x543e31['query'][_0x57e2('0x3d')]){_0x1a7ec8[_0x57e2('0x3b')]=_[_0x57e2('0x3e')](_0x1a7ec8['where'],{'$or':_['map'](_0x3b60f6,function(_0x4dad59){if(_0x4dad59[_0x57e2('0x3f')]!=='VIRTUAL'){var _0x275051={};_0x275051[_0x4dad59[_0x57e2('0x2a')]]={'$like':'%'+_0x543e31[_0x57e2('0x32')][_0x57e2('0x3d')]+'%'};return _0x275051;}})});}_0x1a7ec8=_[_0x57e2('0x3e')]({},_0x1a7ec8,_0x543e31['options']);var _0x248feb={'where':_0x1a7ec8['where']};return db['Team'][_0x57e2('0x21')](_0x248feb)['then'](function(_0x4ff7a3){_0x281f83['count']=_0x4ff7a3;if(_0x543e31['query'][_0x57e2('0x40')]){_0x1a7ec8[_0x57e2('0x41')]=[{'all':!![]}];}return db[_0x57e2('0x2e')][_0x57e2('0x42')](_0x1a7ec8);})[_0x57e2('0x29')](function(_0x4d6902){_0x281f83[_0x57e2('0x43')]=_0x4d6902;return _0x281f83;})[_0x57e2('0x29')](respondWithFilteredResult(_0x5cc7e4,_0x1a7ec8))['catch'](handleError(_0x5cc7e4,null));};exports[_0x57e2('0x44')]=function(_0x1ff2de,_0x1b2fa2){var _0x4dd9c6={'raw':![],'where':{'id':_0x1ff2de['params']['id']}},_0x46ec3f={};_0x46ec3f['model']=_[_0x57e2('0x33')](db['Team'][_0x57e2('0x2f')]);_0x46ec3f['query']=_[_0x57e2('0x33')](_0x1ff2de[_0x57e2('0x32')]);_0x46ec3f[_0x57e2('0x34')]=_[_0x57e2('0x35')](_0x46ec3f[_0x57e2('0x31')],_0x46ec3f[_0x57e2('0x32')]);_0x4dd9c6[_0x57e2('0x36')]=_[_0x57e2('0x35')](_0x46ec3f[_0x57e2('0x31')],qs[_0x57e2('0x45')](_0x1ff2de[_0x57e2('0x32')][_0x57e2('0x45')]));_0x4dd9c6[_0x57e2('0x36')]=_0x4dd9c6[_0x57e2('0x36')][_0x57e2('0x37')]?_0x4dd9c6[_0x57e2('0x36')]:_0x46ec3f[_0x57e2('0x31')];if(_0x1ff2de[_0x57e2('0x32')][_0x57e2('0x40')]){_0x4dd9c6['include']=[{'all':!![]}];}_0x4dd9c6=_[_0x57e2('0x3e')]({},_0x4dd9c6,_0x1ff2de[_0x57e2('0x46')]);return db[_0x57e2('0x2e')][_0x57e2('0x47')](_0x4dd9c6)[_0x57e2('0x29')](handleEntityNotFound(_0x1b2fa2,null))[_0x57e2('0x29')](respondWithResult(_0x1b2fa2,null))[_0x57e2('0x48')](handleError(_0x1b2fa2,null));};exports[_0x57e2('0x49')]=function(_0x14e55f,_0x1d618f){return db[_0x57e2('0x2e')][_0x57e2('0x49')](_0x14e55f[_0x57e2('0x4a')],{})[_0x57e2('0x29')](function(_0x433f12){var _0x524442=_0x14e55f[_0x57e2('0x4b')]['get']({'plain':!![]});if(!_0x524442)throw new Error(_0x57e2('0x4c'));if(_0x524442['role']===_0x57e2('0x4b')){var _0x422032=_0x433f12[_0x57e2('0x4d')]({'plain':!![]});var _0x188560=_0x57e2('0x4e');return db[_0x57e2('0x4f')][_0x57e2('0x47')]({'where':{'name':_0x188560,'userProfileId':_0x524442[_0x57e2('0x50')]},'raw':!![]})['then'](function(_0x519939){if(_0x519939&&_0x519939[_0x57e2('0x51')]===0x0){return db[_0x57e2('0x52')][_0x57e2('0x49')]({'name':_0x422032[_0x57e2('0x2a')],'resourceId':_0x422032['id'],'type':_0x519939['name'],'sectionId':_0x519939['id']},{})['then'](function(){return _0x433f12;});}else{return _0x433f12;}})[_0x57e2('0x48')](function(_0x3e66d2){logger[_0x57e2('0x53')](_0x57e2('0x54'),_0x3e66d2);throw _0x3e66d2;});}return _0x433f12;})[_0x57e2('0x29')](respondWithResult(_0x1d618f,0xc9))['catch'](handleError(_0x1d618f,null));};exports[_0x57e2('0x28')]=function(_0x3601da,_0x265f6a){if(_0x3601da[_0x57e2('0x4a')]['id']){delete _0x3601da[_0x57e2('0x4a')]['id'];}return db[_0x57e2('0x2e')][_0x57e2('0x47')]({'where':{'id':_0x3601da[_0x57e2('0x55')]['id']}})[_0x57e2('0x29')](handleEntityNotFound(_0x265f6a,null))['then'](saveUpdates(_0x3601da[_0x57e2('0x4a')],null))['then'](respondWithResult(_0x265f6a,null))[_0x57e2('0x48')](handleError(_0x265f6a,null));};exports[_0x57e2('0x56')]=function(_0x152ffe,_0x357cde){var _0x1881e6=_0x152ffe[_0x57e2('0x55')]['id'];var _0x2fbd80=[];return db[_0x57e2('0x57')]['transaction'](function(_0x1959c7){var _0x1e3a3a='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1881e6;return db['sequelize'][_0x57e2('0x32')](_0x1e3a3a,{'type':db[_0x57e2('0x58')][_0x57e2('0x59')][_0x57e2('0x5a')],'raw':!![],'transaction':_0x1959c7})[_0x57e2('0x29')](function(_0x2fcfca){_0x2fbd80=_[_0x57e2('0x2d')](_0x2fcfca,function(_0x495fb8){return Number(_0x495fb8['UserId']);});})[_0x57e2('0x29')](function(){var _0x3a60c7=_0x57e2('0x5b')+_0x1881e6;return db[_0x57e2('0x57')][_0x57e2('0x32')](_0x3a60c7,{'type':db['Sequelize'][_0x57e2('0x59')][_0x57e2('0x5a')],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x21e4d3){var _0x2340e6=_['map'](_0x21e4d3,function(_0x1c9fec){return Number(_0x1c9fec['VoiceQueueId']);});return db['UserVoiceQueue'][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'VoiceQueueId':{'$in':_0x2340e6}},'transaction':_0x1959c7});})['then'](function(){var _0x327c85=_0x57e2('0x5c')+_0x1881e6;return db['sequelize'][_0x57e2('0x32')](_0x327c85,{'type':db[_0x57e2('0x58')][_0x57e2('0x59')]['SELECT'],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0xa60527){var _0x231a89=_['map'](_0xa60527,function(_0x5833cc){return Number(_0x5833cc['MailQueueId']);});return db['UserMailQueue'][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'MailQueueId':{'$in':_0x231a89}},'transaction':_0x1959c7});})['then'](function(){var _0x3274aa=_0x57e2('0x5d')+_0x1881e6;return db[_0x57e2('0x57')][_0x57e2('0x32')](_0x3274aa,{'type':db[_0x57e2('0x58')]['QueryTypes'][_0x57e2('0x5a')],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x4713dd){var _0x2a0db0=_[_0x57e2('0x2d')](_0x4713dd,function(_0x48d99e){return Number(_0x48d99e['SmsQueueId']);});return db['UserSmsQueue'][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'SmsQueueId':{'$in':_0x2a0db0}},'transaction':_0x1959c7});})[_0x57e2('0x29')](function(){var _0x50cfbf=_0x57e2('0x5e')+_0x1881e6;return db['sequelize']['query'](_0x50cfbf,{'type':db[_0x57e2('0x58')][_0x57e2('0x59')]['SELECT'],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x4be3e2){var _0x20153c=_[_0x57e2('0x2d')](_0x4be3e2,function(_0x36fc6c){return Number(_0x36fc6c[_0x57e2('0x5f')]);});return db[_0x57e2('0x60')][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'ChatQueueId':{'$in':_0x20153c}},'transaction':_0x1959c7});})[_0x57e2('0x29')](function(){var _0x40a36a=_0x57e2('0x61')+_0x1881e6;return db[_0x57e2('0x57')][_0x57e2('0x32')](_0x40a36a,{'type':db['Sequelize'][_0x57e2('0x59')]['SELECT'],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x96c80d){var _0x277cf3=_[_0x57e2('0x2d')](_0x96c80d,function(_0x3da200){return Number(_0x3da200[_0x57e2('0x62')]);});return db[_0x57e2('0x63')][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'FaxQueueId':{'$in':_0x277cf3}},'transaction':_0x1959c7});})['then'](function(){var _0xcc7f3f=_0x57e2('0x64')+_0x1881e6;return db[_0x57e2('0x57')][_0x57e2('0x32')](_0xcc7f3f,{'type':db[_0x57e2('0x58')][_0x57e2('0x59')][_0x57e2('0x5a')],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x23700c){var _0x4b25a1=_[_0x57e2('0x2d')](_0x23700c,function(_0x37d281){return Number(_0x37d281[_0x57e2('0x65')]);});return db[_0x57e2('0x66')][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'OpenchannelQueueId':{'$in':_0x4b25a1}},'transaction':_0x1959c7});})['then'](function(){var _0x140212='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1881e6;return db[_0x57e2('0x57')]['query'](_0x140212,{'type':db[_0x57e2('0x58')][_0x57e2('0x59')][_0x57e2('0x5a')],'raw':!![],'transaction':_0x1959c7});})[_0x57e2('0x29')](function(_0x335cd8){var _0x262643=_[_0x57e2('0x2d')](_0x335cd8,function(_0x206229){return Number(_0x206229[_0x57e2('0x67')]);});return db[_0x57e2('0x68')][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'WhatsappQueueId':{'$in':_0x262643}},'transaction':_0x1959c7});})[_0x57e2('0x29')](function(){return db[_0x57e2('0x69')]['find']({'where':{'TeamId':_0x1881e6}});})[_0x57e2('0x29')](function(_0x4867af){if(_0x4867af===null){return;}return db[_0x57e2('0x6a')][_0x57e2('0x56')]({'where':{'UserId':{'$in':_0x2fbd80},'VoicePrefixId':_0x4867af[_0x57e2('0x6b')]},'transaction':_0x1959c7});})[_0x57e2('0x29')](function(){return db[_0x57e2('0x2e')][_0x57e2('0x56')]({'where':{'id':_0x1881e6},'cascade':!![],'transaction':_0x1959c7});})['then'](function(_0x3ab81c){if(_0x3ab81c===0x0){_0x357cde[_0x57e2('0x1b')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':'Teams','resourceId':_0x1881e6},'cascade':!![],'transaction':_0x1959c7})['then'](function(){_0x357cde[_0x57e2('0x1c')](0xcc)[_0x57e2('0x1d')]();});}})[_0x57e2('0x48')](function(_0x13f29a){_0x357cde[_0x57e2('0x1c')](0x1f4)['send'](_0x13f29a);});});};exports[_0x57e2('0x6c')]=function(_0x29e0f7,_0x2372bf,_0x27d733){return db[_0x57e2('0x2e')]['findOne']({'where':{'id':_0x29e0f7[_0x57e2('0x55')]['id']}})[_0x57e2('0x29')](handleEntityNotFound(_0x2372bf,null))['then'](function(_0x219353){if(!_0x29e0f7['query'][_0x57e2('0x6d')]||!utils[_0x57e2('0x6e')](_0x29e0f7[_0x57e2('0x32')][_0x57e2('0x6d')])){throw new db[(_0x57e2('0x58'))]['ValidationError'](_0x57e2('0x6f'));}var _0x59f09e={};var _0x25deab={};_0x25deab[_0x57e2('0x31')]=_['keys'](db[_[_0x57e2('0x70')](_0x29e0f7[_0x57e2('0x32')][_0x57e2('0x6d')][_0x57e2('0x71')]())+_0x57e2('0x72')]['rawAttributes']);_0x25deab[_0x57e2('0x32')]=_[_0x57e2('0x33')](_0x29e0f7['query']);_0x25deab[_0x57e2('0x34')]=_[_0x57e2('0x35')](_0x25deab[_0x57e2('0x31')],_0x25deab[_0x57e2('0x32')]);_0x59f09e[_0x57e2('0x36')]=_[_0x57e2('0x35')](_0x25deab[_0x57e2('0x31')],qs['fields'](_0x29e0f7['query'][_0x57e2('0x45')]));_0x59f09e[_0x57e2('0x36')]=_0x59f09e[_0x57e2('0x36')][_0x57e2('0x37')]?_0x59f09e[_0x57e2('0x36')]:_0x25deab[_0x57e2('0x31')];_0x59f09e[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x29e0f7['query']['limit']);_0x59f09e[_0x57e2('0x22')]=qs[_0x57e2('0x22')](_0x29e0f7[_0x57e2('0x32')][_0x57e2('0x22')]);_0x59f09e[_0x57e2('0x39')]=qs['sort'](_0x29e0f7[_0x57e2('0x32')][_0x57e2('0x3a')]);_0x59f09e[_0x57e2('0x3b')]=qs[_0x57e2('0x34')](_[_0x57e2('0x3c')](_0x29e0f7[_0x57e2('0x32')],_0x25deab[_0x57e2('0x34')]));_0x59f09e=_['merge']({},_0x59f09e,_0x29e0f7['options']);return _0x219353[_0x57e2('0x4d')+_[_0x57e2('0x70')](_0x29e0f7[_0x57e2('0x32')]['channel'][_0x57e2('0x71')]())+_0x57e2('0x73')](_0x59f09e);})[_0x57e2('0x29')](respondWithResult(_0x2372bf,null))[_0x57e2('0x48')](handleError(_0x2372bf,null));};exports[_0x57e2('0x74')]=function(_0x3d3ca7,_0x223397,_0x6e70fa){return db[_0x57e2('0x2e')][_0x57e2('0x75')]({'where':{'id':_0x3d3ca7[_0x57e2('0x55')]['id']}})['then'](function(_0x5e8449){if(_0x5e8449){if(!_0x3d3ca7[_0x57e2('0x4a')][_0x57e2('0x6d')]||!utils[_0x57e2('0x6e')](_0x3d3ca7[_0x57e2('0x4a')][_0x57e2('0x6d')])){throw new db['Sequelize'][(_0x57e2('0x76'))](_0x57e2('0x6f'));}return _0x5e8449['add'+_['capitalize'](_0x3d3ca7[_0x57e2('0x4a')][_0x57e2('0x6d')][_0x57e2('0x71')]())+'Queues'](_0x3d3ca7[_0x57e2('0x4a')][_0x57e2('0x77')]);}return null;})[_0x57e2('0x29')](handleEntityNotFound(_0x223397,null))[_0x57e2('0x29')](respondWithStatusCode(_0x223397,null))[_0x57e2('0x48')](handleError(_0x223397,null));};exports[_0x57e2('0x78')]=function(_0x2ebef8,_0x1a47cf,_0x1df55e){return db['Team']['findOne']({'where':{'id':_0x2ebef8[_0x57e2('0x55')]['id']}})[_0x57e2('0x29')](function(_0x563f8d){if(_0x563f8d){if(!_0x2ebef8[_0x57e2('0x32')]['channel']||!utils['isValidChannel'](_0x2ebef8[_0x57e2('0x32')][_0x57e2('0x6d')])){throw new db[(_0x57e2('0x58'))]['ValidationError'](_0x57e2('0x6f'));}return _0x563f8d[_0x57e2('0x79')+_[_0x57e2('0x70')](_0x2ebef8[_0x57e2('0x32')][_0x57e2('0x6d')][_0x57e2('0x71')]())+_0x57e2('0x73')](_0x2ebef8['query'][_0x57e2('0x77')]);}return null;})[_0x57e2('0x29')](handleEntityNotFound(_0x1a47cf,null))[_0x57e2('0x29')](respondWithStatusCode(_0x1a47cf,null))[_0x57e2('0x48')](handleError(_0x1a47cf,null));};exports[_0x57e2('0x7a')]=function(_0x467c33,_0x465f3){var _0x50a844=_['isArray'](_0x467c33[_0x57e2('0x4a')][_0x57e2('0x77')])?_0x467c33[_0x57e2('0x4a')]['ids']:[_0x467c33['body'][_0x57e2('0x77')]];var _0x2a627b=_0x467c33[_0x57e2('0x55')]['id'];return db['Team'][_0x57e2('0x47')]({'where':{'id':_0x2a627b}})['then'](handleEntityNotFound(_0x465f3,null))[_0x57e2('0x29')](function(_0x5f0a13){if(_0x5f0a13){var _0x12ea79=[_0x57e2('0x7b'),_0x57e2('0x7c'),_0x57e2('0x7d'),_0x57e2('0x7e'),_0x57e2('0x7f'),_0x57e2('0x80'),_0x57e2('0x81')];return db['sequelize']['transaction'](function(_0x5b616a){var _0x3c61f7=_[_0x57e2('0x2d')](_0x12ea79,function(_0x65d3a5){var _0x80a27c={'attributes':['id',_0x57e2('0x2a')]};if(_0x65d3a5===_0x57e2('0x7b')){_0x80a27c[_0x57e2('0x82')]={'attributes':[_0x57e2('0x83')]};}return _0x5f0a13[_0x57e2('0x4d')+_0x65d3a5+'Queues'](_0x80a27c)[_0x57e2('0x29')](function(_0x14ee80){var _0x3189b4=_[_0x57e2('0x2d')](_0x14ee80,function(_0x67e151){var _0x2b5714=_[_0x57e2('0x2d')](_0x50a844,function(_0x327326){var _0x275ed5={'where':{'UserId':_0x327326,[_0x65d3a5+'QueueId']:_0x67e151['id']},'transaction':_0x5b616a};if(_0x65d3a5==='Voice'){_0x275ed5[_0x57e2('0x84')]={'penalty':_0x67e151[_0x57e2('0x85')][_0x57e2('0x83')]};}return db[_0x57e2('0x86')+_0x65d3a5+'Queue']['findOrCreate'](_0x275ed5)[_0x57e2('0x29')](function(){socket[_0x57e2('0x87')]('user'+_0x65d3a5+_0x57e2('0x88'),{'UserId':_0x327326,[_0x65d3a5+_0x57e2('0x89')]:_0x67e151['id']});if(_0x65d3a5!==_0x57e2('0x7b')){return;}return db[_0x57e2('0x86')]['findAll']({'where':{'id':_0x50a844,'online':0x1},'attributes':['id',_0x57e2('0x2a'),_0x57e2('0x8a'),'voicePause',_0x57e2('0x8b')],'raw':!![]})[_0x57e2('0x29')](function(_0x299f48){var _0x385d5c=_[_0x57e2('0x2d')](_0x299f48,function(_0x155704){return db[_0x57e2('0x8c')][_0x57e2('0x8d')]({'membername':_0x155704[_0x57e2('0x2a')],'UserId':_0x155704['id'],'queue_name':_0x67e151[_0x57e2('0x2a')],'VoiceQueueId':_0x67e151['id'],'interface':_[_0x57e2('0x8e')](_0x155704[_0x57e2('0x8b')])?util['format']('SIP/%s',_0x155704[_0x57e2('0x2a')]):_0x155704['interface'],'paused':_0x155704['voicePause']||![],'penalty':_0x67e151[_0x57e2('0x85')][_0x57e2('0x83')]},{'transaction':_0x5b616a});});return Promise[_0x57e2('0x8f')](_0x385d5c);});});});return Promise[_0x57e2('0x8f')](_0x2b5714);});return Promise[_0x57e2('0x8f')](_0x3189b4);})[_0x57e2('0x29')](function(){return db[_0x57e2('0x69')][_0x57e2('0x75')]({'where':{'teamId':_0x2a627b}})['then'](function(_0x3da055){if(_0x3da055){var _0x40f4ed=_['map'](_0x50a844,function(_0x59da03){db['UserVoicePrefix']['upsert']({'UserId':_0x59da03,'VoicePrefixId':_0x3da055[_0x57e2('0x6b')]});});return Promise['all'](_0x40f4ed);}});});});return Promise[_0x57e2('0x8f')](_0x3c61f7)[_0x57e2('0x29')](function(){return _0x5f0a13['addAgents'](_0x50a844,{'transaction':_0x5b616a})[_0x57e2('0x90')](function(_0x195a40){return _0x195a40;});});});}})[_0x57e2('0x29')](respondWithResult(_0x465f3,null))[_0x57e2('0x48')](handleError(_0x465f3,null));};exports[_0x57e2('0x91')]=function(_0x1f1702,_0x722de7){var _0x544539=_[_0x57e2('0x92')](_0x1f1702['query']['ids'])?_0x1f1702[_0x57e2('0x32')][_0x57e2('0x77')]:[_0x1f1702[_0x57e2('0x32')]['ids']];var _0x352330=_0x1f1702[_0x57e2('0x55')]['id'];return db[_0x57e2('0x2e')][_0x57e2('0x47')]({'where':{'id':_0x352330}})['then'](handleEntityNotFound(_0x722de7,null))[_0x57e2('0x29')](function(_0x16dd85){if(_0x16dd85){var _0xfadc80=[_0x57e2('0x7b'),_0x57e2('0x7c'),_0x57e2('0x7d'),_0x57e2('0x7e'),'Fax',_0x57e2('0x80'),'Whatsapp'];return db[_0x57e2('0x57')][_0x57e2('0x93')](function(_0x328cd1){var _0x102215=_[_0x57e2('0x2d')](_0xfadc80,function(_0xaf4fc){var _0x22a20d={'attributes':['id','name']};return _0x16dd85[_0x57e2('0x4d')+_0xaf4fc+_0x57e2('0x73')](_0x22a20d)[_0x57e2('0x29')](function(_0x5a3833){var _0x26bb71=_[_0x57e2('0x2d')](_0x5a3833,function(_0x3f8ee1){return _0x3f8ee1['removeAgents'](_0x544539,{'transaction':_0x328cd1})['then'](function(){var _0xd4b484=_[_0x57e2('0x2d')](_0x544539,function(_0x5dabeb){socket[_0x57e2('0x87')](_0x57e2('0x4b')+_0xaf4fc+'Queue:remove',{'UserId':Number(_0x5dabeb),[_0xaf4fc+_0x57e2('0x89')]:_0x3f8ee1['id']});if(_0xaf4fc!==_0x57e2('0x7b')){return;}return db[_0x57e2('0x8c')][_0x57e2('0x56')]({'where':{'VoiceQueueId':_0x3f8ee1['id'],'UserId':_0x5dabeb},'transaction':_0x328cd1});});return Promise[_0x57e2('0x8f')](_0xd4b484);});});return Promise[_0x57e2('0x8f')](_0x26bb71);});});return Promise[_0x57e2('0x8f')](_0x102215)[_0x57e2('0x29')](function(){return _0x16dd85['removeAgents'](_0x544539,{'transaction':_0x328cd1});})[_0x57e2('0x29')](function(){return db[_0x57e2('0x69')][_0x57e2('0x75')]({'where':{'teamId':_0x352330}})['then'](function(_0x1524da){if(_0x1524da){var _0x5df8c0=_[_0x57e2('0x2d')](_0x544539,function(_0x18a70a){db[_0x57e2('0x6a')][_0x57e2('0x56')]({'where':{'UserId':_0x18a70a,'VoicePrefixId':_0x1524da['VoicePrefixId']}});});return Promise['all'](_0x5df8c0);}});});});}})[_0x57e2('0x29')](respondWithStatusCode(_0x722de7,null))[_0x57e2('0x48')](handleError(_0x722de7,null));};exports[_0x57e2('0x94')]=function(_0x536c98,_0x4d6103,_0x256343){var _0x3736a9={};var _0x3eee91={};var _0x3be21e;var _0x1fab4f;return db[_0x57e2('0x2e')][_0x57e2('0x75')]({'where':{'id':_0x536c98[_0x57e2('0x55')]['id']}})[_0x57e2('0x29')](handleEntityNotFound(_0x4d6103,null))[_0x57e2('0x29')](function(_0x4b9d29){if(_0x4b9d29){_0x3be21e=_0x4b9d29;_0x3eee91['model']=_[_0x57e2('0x33')](db[_0x57e2('0x86')][_0x57e2('0x2f')]);_0x3eee91[_0x57e2('0x32')]=_[_0x57e2('0x33')](_0x536c98['query']);_0x3eee91[_0x57e2('0x34')]=_['intersection'](_0x3eee91['model'],_0x3eee91[_0x57e2('0x32')]);_0x3736a9[_0x57e2('0x36')]=_[_0x57e2('0x35')](_0x3eee91[_0x57e2('0x31')],qs['fields'](_0x536c98['query'][_0x57e2('0x45')]));_0x3736a9[_0x57e2('0x36')]=_0x3736a9['attributes']['length']?_0x3736a9[_0x57e2('0x36')]:_0x3eee91[_0x57e2('0x31')];_0x3736a9['order']=qs[_0x57e2('0x3a')](_0x536c98[_0x57e2('0x32')][_0x57e2('0x3a')]);_0x3736a9[_0x57e2('0x3b')]=qs[_0x57e2('0x34')](_[_0x57e2('0x3c')](_0x536c98[_0x57e2('0x32')],_0x3eee91['filters']));if(_0x536c98[_0x57e2('0x32')][_0x57e2('0x3d')]){_0x3736a9[_0x57e2('0x3b')]=_['merge'](_0x3736a9[_0x57e2('0x3b')],{'$or':_['map'](_0x3736a9[_0x57e2('0x36')],function(_0x56f437){var _0x2bb857={};_0x2bb857[_0x56f437]={'$like':'%'+_0x536c98[_0x57e2('0x32')][_0x57e2('0x3d')]+'%'};return _0x2bb857;})});}_0x3736a9=_['merge']({},_0x3736a9,_0x536c98[_0x57e2('0x46')]);return _0x3be21e[_0x57e2('0x94')](_0x3736a9);}})[_0x57e2('0x29')](function(_0x1d3efb){if(_0x1d3efb){_0x1fab4f=_0x1d3efb[_0x57e2('0x37')];if(!_0x536c98[_0x57e2('0x32')]['hasOwnProperty']('nolimit')){_0x3736a9[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x536c98[_0x57e2('0x32')][_0x57e2('0x20')]);_0x3736a9[_0x57e2('0x22')]=qs[_0x57e2('0x22')](_0x536c98['query'][_0x57e2('0x22')]);}return _0x3be21e[_0x57e2('0x94')](_0x3736a9);}})[_0x57e2('0x29')](function(_0x4b044c){if(_0x4b044c){return _0x4b044c?{'count':_0x1fab4f,'rows':_0x4b044c}:null;}})[_0x57e2('0x29')](respondWithResult(_0x4d6103,null))[_0x57e2('0x48')](handleError(_0x4d6103,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 9f432c3..0be2e44 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 _0x3f89=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x52f159,_0x419d8a){var _0x156799=function(_0xf168e8){while(--_0xf168e8){_0x52f159['push'](_0x52f159['shift']());}};_0x156799(++_0x419d8a);}(_0x3f89,0x192));var _0x93f8=function(_0x2a12f7,_0x3439fc){_0x2a12f7=_0x2a12f7-0x0;var _0x4767eb=_0x3f89[_0x2a12f7];return _0x4767eb;};'use strict';var EventEmitter=require(_0x93f8('0x0'));var Team=require(_0x93f8('0x1'))['db'][_0x93f8('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x93f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x93f8('0x4')};function emitEvent(_0x803cf4){return function(_0x5d2a90,_0x4ebdc4,_0x56a205){TeamEvents[_0x93f8('0x5')](_0x803cf4+':'+_0x5d2a90['id'],_0x5d2a90);TeamEvents[_0x93f8('0x5')](_0x803cf4,_0x5d2a90);_0x56a205(null);};}for(var e in events){if(events[_0x93f8('0x6')](e)){var event=events[e];Team[_0x93f8('0x7')](e,emitEvent(event));}}module[_0x93f8('0x8')]=TeamEvents; \ No newline at end of file +var _0x5b52=['update','remove','emit','hasOwnProperty','hook','exports','Team'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x5b52,0x18e));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x25b5('0x0')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x25b5('0x1'),'afterDestroy':_0x25b5('0x2')};function emitEvent(_0x53df95){return function(_0x539641,_0x17998d,_0x28876f){TeamEvents[_0x25b5('0x3')](_0x53df95+':'+_0x539641['id'],_0x539641);TeamEvents['emit'](_0x53df95,_0x539641);_0x28876f(null);};}for(var e in events){if(events[_0x25b5('0x4')](e)){var event=events[e];Team[_0x25b5('0x5')](e,emitEvent(event));}}module[_0x25b5('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3743e2b..a23c6f8 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 _0x8828=['define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','lodash','Queues','map','setDataValue','catch','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8828,0x1e8));var _0x8882=function(_0x1e78a2,_0x2ce9e5){_0x1e78a2=_0x1e78a2-0x0;var _0x277401=_0x8828[_0x1e78a2];return _0x277401;};'use strict';var _=require(_0x8882('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x56f0ba,_0x17a8fe){var _0x488989='get'+_0x17a8fe+_0x8882('0x1');return _0x56f0ba[_0x488989]()['then'](function(_0x13c2ab){return _[_0x8882('0x2')](_0x13c2ab,function(_0x38b4f7){_0x38b4f7[_0x8882('0x3')]('channel',_0x17a8fe);return _0x38b4f7;});})[_0x8882('0x4')](function(_0x3d10eb){throw _0x3d10eb;});}module[_0x8882('0x5')]=function(_0xfe3da){return _0xfe3da[_0x8882('0x6')](_0x8882('0x7'),attributes,{'tableName':_0x8882('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4a1274=this;var _0x4c2c9b=[_0x8882('0x9'),_0x8882('0xa'),_0x8882('0xb'),_0x8882('0xc'),_0x8882('0xd'),_0x8882('0xe'),_0x8882('0xf')];return Promise[_0x8882('0x10')]()[_0x8882('0x11')](function(){var _0x407459=_[_0x8882('0x2')](_0x4c2c9b,function(_0x31c128){return getQueuesByChannel(_0x4a1274,_0x31c128);});return Promise[_0x8882('0x12')](_0x407459);})[_0x8882('0x4')](function(_0x53b87c){throw _0x53b87c;});}}});}; \ No newline at end of file +var _0x8b99=['resolve','map','lodash','get','Queues','then','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp'];(function(_0x3cf2d4,_0x5e1071){var _0x5df1b7=function(_0x4dc2b4){while(--_0x4dc2b4){_0x3cf2d4['push'](_0x3cf2d4['shift']());}};_0x5df1b7(++_0x5e1071);}(_0x8b99,0x1b7));var _0x98b9=function(_0x58a67d,_0x85ffdf){_0x58a67d=_0x58a67d-0x0;var _0xcc0e96=_0x8b99[_0x58a67d];return _0xcc0e96;};'use strict';var _=require(_0x98b9('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x3d6d87,_0x2b7fc1){var _0x3e8d7e=_0x98b9('0x1')+_0x2b7fc1+_0x98b9('0x2');return _0x3d6d87[_0x3e8d7e]()[_0x98b9('0x3')](function(_0x5369c3){return _['map'](_0x5369c3,function(_0x56a643){_0x56a643[_0x98b9('0x4')](_0x98b9('0x5'),_0x2b7fc1);return _0x56a643;});})[_0x98b9('0x6')](function(_0x4adb26){throw _0x4adb26;});}module[_0x98b9('0x7')]=function(_0x41b2af){return _0x41b2af[_0x98b9('0x8')](_0x98b9('0x9'),attributes,{'tableName':_0x98b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4de54d=this;var _0x5ab0eb=[_0x98b9('0xb'),_0x98b9('0xc'),_0x98b9('0xd'),_0x98b9('0xe'),'Sms',_0x98b9('0xf'),_0x98b9('0x10')];return Promise[_0x98b9('0x11')]()[_0x98b9('0x3')](function(){var _0x33048f=_[_0x98b9('0x12')](_0x5ab0eb,function(_0x117d19){return getQueuesByChannel(_0x4de54d,_0x117d19);});return Promise['all'](_0x33048f);})['catch'](function(_0x552e8c){throw _0x552e8c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2453f98..a9110b8 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 _0x0610=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','Team,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x57839e,_0x3d950d){var _0x1c8b4e=function(_0x3144a6){while(--_0x3144a6){_0x57839e['push'](_0x57839e['shift']());}};_0x1c8b4e(++_0x3d950d);}(_0x0610,0xfe));var _0x0061=function(_0x3582be,_0x109548){_0x3582be=_0x3582be-0x0;var _0x84b2de=_0x0610[_0x3582be];return _0x84b2de;};'use strict';var _=require(_0x0061('0x0'));var util=require(_0x0061('0x1'));var moment=require('moment');var BPromise=require(_0x0061('0x2'));var rs=require(_0x0061('0x3'));var fs=require('fs');var Redis=require(_0x0061('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0061('0x5'));var logger=require(_0x0061('0x6'))(_0x0061('0x7'));var config=require(_0x0061('0x8'));var jayson=require(_0x0061('0x9'));var client=jayson[_0x0061('0xa')]['http']({'port':0x232a});config[_0x0061('0xb')]=_['defaults'](config[_0x0061('0xb')],{'host':_0x0061('0xc'),'port':0x18eb});var socket=require(_0x0061('0xd'))(new Redis(config[_0x0061('0xb')]));require('./team.socket')[_0x0061('0xe')](socket);function respondWithRpcPromise(_0x26bd5f,_0x4912fa,_0x393f44){return new BPromise(function(_0x3efa6b,_0x2ce377){return client[_0x0061('0xf')](_0x26bd5f,_0x393f44)[_0x0061('0x10')](function(_0x35f785){logger['info'](_0x0061('0x11'),_0x4912fa,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x4912fa,_0x0061('0x12'),JSON[_0x0061('0x13')](_0x35f785));if(_0x35f785[_0x0061('0x14')]){if(_0x35f785[_0x0061('0x14')][_0x0061('0x15')]===0x1f4){logger[_0x0061('0x14')](_0x0061('0x11'),_0x4912fa,_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);return _0x2ce377(_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);}logger['error'](_0x0061('0x11'),_0x4912fa,_0x35f785[_0x0061('0x14')]['message']);return _0x3efa6b(_0x35f785[_0x0061('0x14')][_0x0061('0x16')]);}else{logger['info'](_0x0061('0x11'),_0x4912fa,_0x0061('0x12'));_0x3efa6b(_0x35f785[_0x0061('0x17')][_0x0061('0x16')]);}})[_0x0061('0x18')](function(_0x11a0c2){logger['error'](_0x0061('0x11'),_0x4912fa,_0x11a0c2);_0x2ce377(_0x11a0c2);});});} \ No newline at end of file +var _0xc960=['stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xc960,0x7c));var _0x0c96=function(_0x488120,_0x59aedc){_0x488120=_0x488120-0x0;var _0x735cd5=_0xc960[_0x488120];return _0x735cd5;};'use strict';var _=require(_0x0c96('0x0'));var util=require(_0x0c96('0x1'));var moment=require(_0x0c96('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c96('0x3'));var fs=require('fs');var Redis=require(_0x0c96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c96('0x6'));var jayson=require(_0x0c96('0x7'));var client=jayson[_0x0c96('0x8')]['http']({'port':0x232a});config[_0x0c96('0x9')]=_[_0x0c96('0xa')](config[_0x0c96('0x9')],{'host':_0x0c96('0xb'),'port':0x18eb});var socket=require(_0x0c96('0xc'))(new Redis(config[_0x0c96('0x9')]));require(_0x0c96('0xd'))[_0x0c96('0xe')](socket);function respondWithRpcPromise(_0x383666,_0x37be1d,_0x338581){return new BPromise(function(_0x10ba2a,_0x3213fe){return client['request'](_0x383666,_0x338581)[_0x0c96('0xf')](function(_0x1632b5){logger[_0x0c96('0x10')](_0x0c96('0x11'),_0x37be1d,_0x0c96('0x12'));logger[_0x0c96('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x37be1d,_0x0c96('0x12'),JSON[_0x0c96('0x14')](_0x1632b5));if(_0x1632b5[_0x0c96('0x15')]){if(_0x1632b5[_0x0c96('0x15')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x37be1d,_0x1632b5[_0x0c96('0x15')]['message']);return _0x3213fe(_0x1632b5['error'][_0x0c96('0x16')]);}logger[_0x0c96('0x15')](_0x0c96('0x11'),_0x37be1d,_0x1632b5[_0x0c96('0x15')][_0x0c96('0x16')]);return _0x10ba2a(_0x1632b5[_0x0c96('0x15')][_0x0c96('0x16')]);}else{logger[_0x0c96('0x10')](_0x0c96('0x11'),_0x37be1d,_0x0c96('0x12'));_0x10ba2a(_0x1632b5['result'][_0x0c96('0x16')]);}})[_0x0c96('0x17')](function(_0x1ce40b){logger[_0x0c96('0x15')]('Team,\x20%s,\x20%s',_0x37be1d,_0x1ce40b);_0x3213fe(_0x1ce40b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index fdceeba..47dd10a 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 _0xc263=['remove','emit','length','team:','./team.events'];(function(_0x49453e,_0x56009b){var _0x26d4a6=function(_0x9907a7){while(--_0x9907a7){_0x49453e['push'](_0x49453e['shift']());}};_0x26d4a6(++_0x56009b);}(_0xc263,0x171));var _0x3c26=function(_0x2e9d48,_0x292251){_0x2e9d48=_0x2e9d48-0x0;var _0x4e7c4d=_0xc263[_0x2e9d48];return _0x4e7c4d;};'use strict';var TeamEvents=require(_0x3c26('0x0'));var events=['save',_0x3c26('0x1'),'update'];function createListener(_0x141ff1,_0x4566c9){return function(_0xf33dc2){_0x4566c9[_0x3c26('0x2')](_0x141ff1,_0xf33dc2);};}function removeListener(_0x25328a,_0x5c4c3b){return function(){TeamEvents['removeListener'](_0x25328a,_0x5c4c3b);};}exports['register']=function(_0x5ce0e0){for(var _0x3a438b=0x0,_0x1f5ede=events[_0x3c26('0x3')];_0x3a438b<_0x1f5ede;_0x3a438b++){var _0x3cb3b4=events[_0x3a438b];var _0x11ee6f=createListener(_0x3c26('0x4')+_0x3cb3b4,_0x5ce0e0);TeamEvents['on'](_0x3cb3b4,_0x11ee6f);}}; \ No newline at end of file +var _0x5227=['team:','./team.events','save','remove','update','emit','removeListener','length'];(function(_0x87aa23,_0x51da6c){var _0x5c09e7=function(_0x36a115){while(--_0x36a115){_0x87aa23['push'](_0x87aa23['shift']());}};_0x5c09e7(++_0x51da6c);}(_0x5227,0x1d1));var _0x7522=function(_0x438578,_0xeccb24){_0x438578=_0x438578-0x0;var _0x55f90b=_0x5227[_0x438578];return _0x55f90b;};'use strict';var TeamEvents=require(_0x7522('0x0'));var events=[_0x7522('0x1'),_0x7522('0x2'),_0x7522('0x3')];function createListener(_0x3a6c52,_0x186c99){return function(_0x5eb1d1){_0x186c99[_0x7522('0x4')](_0x3a6c52,_0x5eb1d1);};}function removeListener(_0x1826a1,_0x2ff860){return function(){TeamEvents[_0x7522('0x5')](_0x1826a1,_0x2ff860);};}exports['register']=function(_0xa19d9a){for(var _0x15e038=0x0,_0x26767c=events[_0x7522('0x6')];_0x15e038<_0x26767c;_0x15e038++){var _0x110f4a=events[_0x15e038];var _0x3ebd0a=createListener(_0x7522('0x7')+_0x110f4a,_0xa19d9a);TeamEvents['on'](_0x110f4a,_0x3ebd0a);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 45c431a..15ee8df 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 _0xe2cc=['exports','sequelize'];(function(_0x1b6767,_0x11c00c){var _0x3e3b62=function(_0x108102){while(--_0x108102){_0x1b6767['push'](_0x1b6767['shift']());}};_0x3e3b62(++_0x11c00c);}(_0xe2cc,0x69));var _0xce2c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe2cc[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x12c9=['sequelize','INTEGER'];(function(_0x4584cb,_0x3b7259){var _0x3e0d0c=function(_0x5cfee5){while(--_0x5cfee5){_0x4584cb['push'](_0x4584cb['shift']());}};_0x3e0d0c(++_0x3b7259);}(_0x12c9,0x10e));var _0x912c=function(_0x78b325,_0x4bfe2a){_0x78b325=_0x78b325-0x0;var _0x30cd2c=_0x12c9[_0x78b325];return _0x30cd2c;};'use strict';var Sequelize=require(_0x912c('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x912c('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x912c('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0fe2812..f54e3ae 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 _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x21ec7b,_0x54811f){var _0x37253a=function(_0x14d7f5){while(--_0x14d7f5){_0x21ec7b['push'](_0x21ec7b['shift']());}};_0x37253a(++_0x54811f);}(_0xd914,0x17f));var _0x4d91=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0xd914[_0x218994];return _0x3f350b;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7fa=['exports','team_has_voice_prefixes','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x549c39,_0x1f88de){var _0xb88b84=function(_0x1dee91){while(--_0x1dee91){_0x549c39['push'](_0x549c39['shift']());}};_0xb88b84(++_0x1f88de);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('TeamVoicePrefix',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index ed95204..6a9d82c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x934605,_0x1773c5){var _0x3594b4=function(_0xaf130e){while(--_0xaf130e){_0x934605['push'](_0x934605['shift']());}};_0x3594b4(++_0x1773c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index df2b4af..3e94c6c 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 _0x702c=['INTEGER','sequelize','exports'];(function(_0x1076d0,_0x1d20fc){var _0x2d8fb9=function(_0x216d1e){while(--_0x216d1e){_0x1076d0['push'](_0x1076d0['shift']());}};_0x2d8fb9(++_0x1d20fc);}(_0x702c,0x1e4));var _0xc702=function(_0x9a515a,_0x1634be){_0x9a515a=_0x9a515a-0x0;var _0x4723d1=_0x702c[_0x9a515a];return _0x4723d1;};'use strict';var Sequelize=require(_0xc702('0x0'));module[_0xc702('0x1')]={'penalty':{'type':Sequelize[_0xc702('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd702=['sequelize','exports','INTEGER'];(function(_0x61b6fb,_0x15cbda){var _0x1f3f0c=function(_0x1a9d6f){while(--_0x1a9d6f){_0x61b6fb['push'](_0x61b6fb['shift']());}};_0x1f3f0c(++_0x15cbda);}(_0xd702,0x117));var _0x2d70=function(_0x277cb2,_0x31d01d){_0x277cb2=_0x277cb2-0x0;var _0x33a5e9=_0xd702[_0x277cb2];return _0x33a5e9;};'use strict';var Sequelize=require(_0x2d70('0x0'));module[_0x2d70('0x1')]={'penalty':{'type':Sequelize[_0x2d70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 5a424c1..57bae6c 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 _0xf873=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf873,0xb2));var _0x3f87=function(_0x3923e5,_0xbc9164){_0x3923e5=_0x3923e5-0x0;var _0xad60b7=_0xf873[_0x3923e5];return _0xad60b7;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./teamVoiceQueue.attributes');module[_0x3f87('0x9')]=function(_0x43c8e4,_0x27c03e){return _0x43c8e4['define'](_0x3f87('0xa'),attributes,{'tableName':_0x3f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x53dc8a,_0x445b4a){var _0x50f0af=function(_0x3e0c2d){while(--_0x3e0c2d){_0x53dc8a['push'](_0x53dc8a['shift']());}};_0x50f0af(++_0x445b4a);}(_0xf72b,0x1d9));var _0xbf72=function(_0x512a51,_0x2aa267){_0x512a51=_0x512a51-0x0;var _0x5c1724=_0xf72b[_0x512a51];return _0x5c1724;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('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 73bcf54..f91247d 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 _0x6326=['error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','stringify'];(function(_0x25199e,_0x482245){var _0x58350b=function(_0x58d500){while(--_0x58d500){_0x25199e['push'](_0x25199e['shift']());}};_0x58350b(++_0x482245);}(_0x6326,0x101));var _0x6632=function(_0x36d5b7,_0x2378a5){_0x36d5b7=_0x36d5b7-0x0;var _0x14922b=_0x6326[_0x36d5b7];return _0x14922b;};'use strict';var _=require('lodash');var util=require(_0x6632('0x0'));var moment=require('moment');var BPromise=require(_0x6632('0x1'));var rs=require(_0x6632('0x2'));var fs=require('fs');var Redis=require(_0x6632('0x3'));var db=require(_0x6632('0x4'))['db'];var utils=require(_0x6632('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6632('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6632('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58c561,_0x1703db,_0x4795fd){return new BPromise(function(_0x3756cc,_0x49b0e3){return client[_0x6632('0x8')](_0x58c561,_0x4795fd)[_0x6632('0x9')](function(_0x538531){logger[_0x6632('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1703db,_0x6632('0xb'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1703db,_0x6632('0xb'),JSON[_0x6632('0xc')](_0x538531));if(_0x538531[_0x6632('0xd')]){if(_0x538531[_0x6632('0xd')][_0x6632('0xe')]===0x1f4){logger[_0x6632('0xd')](_0x6632('0xf'),_0x1703db,_0x538531[_0x6632('0xd')]['message']);return _0x49b0e3(_0x538531[_0x6632('0xd')][_0x6632('0x10')]);}logger['error'](_0x6632('0xf'),_0x1703db,_0x538531[_0x6632('0xd')][_0x6632('0x10')]);return _0x3756cc(_0x538531[_0x6632('0xd')][_0x6632('0x10')]);}else{logger[_0x6632('0xa')](_0x6632('0xf'),_0x1703db,_0x6632('0xb'));_0x3756cc(_0x538531['result'][_0x6632('0x10')]);}})[_0x6632('0x11')](function(_0x28969a){logger[_0x6632('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1703db,_0x28969a);_0x49b0e3(_0x28969a);});});} \ No newline at end of file +var _0x4584=['result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x33a61a,_0x106e32){var _0x7c2dfd=function(_0x2f0acc){while(--_0x2f0acc){_0x33a61a['push'](_0x33a61a['shift']());}};_0x7c2dfd(++_0x106e32);}(_0x4584,0x1cf));var _0x4458=function(_0x2627c5,_0x3a0394){_0x2627c5=_0x2627c5-0x0;var _0x4f11fd=_0x4584[_0x2627c5];return _0x4f11fd;};'use strict';var _=require(_0x4458('0x0'));var util=require('util');var moment=require(_0x4458('0x1'));var BPromise=require(_0x4458('0x2'));var rs=require(_0x4458('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4458('0x4'));var logger=require(_0x4458('0x5'))(_0x4458('0x6'));var config=require(_0x4458('0x7'));var jayson=require(_0x4458('0x8'));var client=jayson[_0x4458('0x9')][_0x4458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215b2d,_0x102b5f,_0x51da14){return new BPromise(function(_0x14bb0f,_0x83fb96){return client[_0x4458('0xb')](_0x215b2d,_0x51da14)[_0x4458('0xc')](function(_0x1ab8c3){logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));logger[_0x4458('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x102b5f,_0x4458('0xf'),JSON[_0x4458('0x11')](_0x1ab8c3));if(_0x1ab8c3[_0x4458('0x12')]){if(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x13')]===0x1f4){logger['error'](_0x4458('0xe'),_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x83fb96(_0x1ab8c3['error'][_0x4458('0x14')]);}logger[_0x4458('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x102b5f,_0x1ab8c3['error'][_0x4458('0x14')]);return _0x14bb0f(_0x1ab8c3[_0x4458('0x12')][_0x4458('0x14')]);}else{logger[_0x4458('0xd')](_0x4458('0xe'),_0x102b5f,_0x4458('0xf'));_0x14bb0f(_0x1ab8c3[_0x4458('0x15')][_0x4458('0x14')]);}})['catch'](function(_0x31e500){logger['error'](_0x4458('0xe'),_0x102b5f,_0x31e500);_0x83fb96(_0x31e500);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0e0c3df..db557c1 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 _0xbcae=['isAuthenticated','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1c7fce,_0x573c15){var _0x177238=function(_0x183524){while(--_0x183524){_0x1c7fce['push'](_0x1c7fce['shift']());}};_0x177238(++_0x573c15);}(_0xbcae,0xa9));var _0xebca=function(_0x9bc98d,_0x12d721){_0x9bc98d=_0x9bc98d-0x0;var _0x2f4b5c=_0xbcae[_0x9bc98d];return _0x2f4b5c;};'use strict';var multer=require(_0xebca('0x0'));var util=require(_0xebca('0x1'));var path=require(_0xebca('0x2'));var timeout=require(_0xebca('0x3'));var express=require(_0xebca('0x4'));var router=express[_0xebca('0x5')]();var fs_extra=require(_0xebca('0x6'));var auth=require(_0xebca('0x7'));var interaction=require(_0xebca('0x8'));var config=require(_0xebca('0x9'));var controller=require('./template.controller');router[_0xebca('0xa')]('/',auth[_0xebca('0xb')](),controller['index']);router[_0xebca('0xa')](_0xebca('0xc'),auth[_0xebca('0xb')](),controller['show']);router[_0xebca('0xd')]('/',auth[_0xebca('0xb')](),controller[_0xebca('0xe')]);router[_0xebca('0xf')](_0xebca('0xc'),auth[_0xebca('0xb')](),controller['update']);router['delete']('/:id',auth[_0xebca('0xb')](),controller[_0xebca('0x10')]);module[_0xebca('0x11')]=router; \ No newline at end of file +var _0xe14a=['isAuthenticated','index','/:id','show','post','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xe14a,0x94));var _0xae14=function(_0x15872f,_0x2b7947){_0x15872f=_0x15872f-0x0;var _0x1065e0=_0xe14a[_0x15872f];return _0x1065e0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae14('0x0')]();var fs_extra=require(_0xae14('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xae14('0x2'));var config=require(_0xae14('0x3'));var controller=require(_0xae14('0x4'));router[_0xae14('0x5')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0x7')]);router[_0xae14('0x5')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller[_0xae14('0x9')]);router[_0xae14('0xa')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0xb')]);router['put']('/:id',auth[_0xae14('0x6')](),controller[_0xae14('0xc')]);router[_0xae14('0xd')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 95887b4..094b701 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 _0xf4d1=['STRING','sequelize'];(function(_0x212780,_0x5a61d1){var _0x4f7c9e=function(_0x322083){while(--_0x322083){_0x212780['push'](_0x212780['shift']());}};_0x4f7c9e(++_0x5a61d1);}(_0xf4d1,0xe9));var _0x1f4d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xf4d1[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x1f4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f4d('0x1')]},'description':{'type':Sequelize[_0x1f4d('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xec76=['exports','STRING','TEXT','sequelize'];(function(_0x1a9006,_0x1c4933){var _0x3b132c=function(_0x32ff14){while(--_0x32ff14){_0x1a9006['push'](_0x1a9006['shift']());}};_0x3b132c(++_0x1c4933);}(_0xec76,0x10f));var _0x6ec7=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0xec76[_0x34a6e9];return _0x11015c;};'use strict';var Sequelize=require(_0x6ec7('0x0'));module[_0x6ec7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ec7('0x2')]},'html':{'type':Sequelize[_0x6ec7('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 31a09cd..f62e635 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 _0x2017=['../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','map','Template','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','include','find','create','user','UserProfileSection','userProfileId','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','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'];(function(_0x5b327d,_0x570af7){var _0x4ac585=function(_0x203fc0){while(--_0x203fc0){_0x5b327d['push'](_0x5b327d['shift']());}};_0x4ac585(++_0x570af7);}(_0x2017,0x83));var _0x7201=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x2017[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require(_0x7201('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7201('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7201('0x2'));var moment=require(_0x7201('0x3'));var BPromise=require(_0x7201('0x4'));var Mustache=require(_0x7201('0x5'));var util=require(_0x7201('0x6'));var path=require(_0x7201('0x7'));var sox=require('sox');var csv=require(_0x7201('0x8'));var ejs=require(_0x7201('0x9'));var fs=require('fs');var fs_extra=require(_0x7201('0xa'));var _=require(_0x7201('0xb'));var squel=require(_0x7201('0xc'));var crypto=require(_0x7201('0xd'));var jsforce=require(_0x7201('0xe'));var deskjs=require(_0x7201('0xf'));var toCsv=require(_0x7201('0x8'));var querystring=require(_0x7201('0x10'));var Papa=require(_0x7201('0x11'));var Redis=require(_0x7201('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7201('0x13'));var as=require(_0x7201('0x14'));var hardwareService=require(_0x7201('0x15'));var logger=require(_0x7201('0x16'))(_0x7201('0x17'));var utils=require(_0x7201('0x18'));var config=require(_0x7201('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f94d3,_0x3152d3){_0x3152d3=_0x3152d3||0xcc;return function(_0x1657f0){if(_0x1657f0){return _0x2f94d3[_0x7201('0x1a')](_0x3152d3);}return _0x2f94d3['status'](_0x3152d3)[_0x7201('0x1b')]();};}function respondWithResult(_0x13d69a,_0x3870d3){_0x3870d3=_0x3870d3||0xc8;return function(_0x5f0ab7){if(_0x5f0ab7){return _0x13d69a[_0x7201('0x1c')](_0x3870d3)[_0x7201('0x1d')](_0x5f0ab7);}};}function respondWithFilteredResult(_0x586ae5,_0x50ab15){return function(_0x5e3b89){if(_0x5e3b89){var _0x350940=typeof _0x50ab15['offset']===_0x7201('0x1e')&&typeof _0x50ab15[_0x7201('0x1f')]==='undefined';var _0x7ceee1=_0x5e3b89[_0x7201('0x20')];var _0x7f9ad3=_0x350940?0x0:_0x50ab15[_0x7201('0x21')];var _0x5ae146=_0x350940?_0x5e3b89[_0x7201('0x20')]:_0x50ab15[_0x7201('0x21')]+_0x50ab15[_0x7201('0x1f')];var _0x224ae9;if(_0x5ae146>=_0x7ceee1){_0x5ae146=_0x7ceee1;_0x224ae9=0xc8;}else{_0x224ae9=0xce;}_0x586ae5[_0x7201('0x1c')](_0x224ae9);return _0x586ae5['set']('Content-Range',_0x7f9ad3+'-'+_0x5ae146+'/'+_0x7ceee1)[_0x7201('0x1d')](_0x5e3b89);}return null;};}function patchUpdates(_0x4c231e){return function(_0x206197){try{jsonpatch['apply'](_0x206197,_0x4c231e,!![]);}catch(_0x4538a9){return BPromise['reject'](_0x4538a9);}return _0x206197[_0x7201('0x22')]();};}function saveUpdates(_0xc1dcff,_0x3eacbf){return function(_0x24cb04){if(_0x24cb04){return _0x24cb04[_0x7201('0x23')](_0xc1dcff)[_0x7201('0x24')](function(_0x2f33ee){return _0x2f33ee;});}return null;};}function removeEntity(_0x2ad767,_0x3b12aa){return function(_0x3f740a){if(_0x3f740a){return _0x3f740a[_0x7201('0x25')]()[_0x7201('0x24')](function(){var _0x3e68a4=_0x3f740a[_0x7201('0x26')]({'plain':!![]});var _0x199710=_0x7201('0x27');return db[_0x7201('0x28')][_0x7201('0x25')]({'where':{'type':_0x199710,'resourceId':_0x3e68a4['id']}})[_0x7201('0x24')](function(){return _0x3f740a;});})[_0x7201('0x24')](function(){_0x2ad767[_0x7201('0x1c')](0xcc)[_0x7201('0x1b')]();});}};}function handleEntityNotFound(_0x5ea78e,_0x55d8e5){return function(_0x4d5814){if(!_0x4d5814){_0x5ea78e['sendStatus'](0x194);}return _0x4d5814;};}function handleError(_0x560e9d,_0x424b2d){_0x424b2d=_0x424b2d||0x1f4;return function(_0x1f810b){logger[_0x7201('0x29')](_0x1f810b[_0x7201('0x2a')]);if(_0x1f810b['name']){delete _0x1f810b[_0x7201('0x2b')];}_0x560e9d[_0x7201('0x1c')](_0x424b2d)['send'](_0x1f810b);};}exports['index']=function(_0x5ca386,_0x5c8eef){var _0x49519e={},_0x3cf2ac={},_0x1291cb={'count':0x0,'rows':[]};var _0x2be168=_[_0x7201('0x2c')](db[_0x7201('0x2d')][_0x7201('0x2e')],function(_0x5f01ca){return{'name':_0x5f01ca[_0x7201('0x2f')],'type':_0x5f01ca[_0x7201('0x30')]['key']};});_0x3cf2ac['model']=_[_0x7201('0x2c')](_0x2be168,_0x7201('0x2b'));_0x3cf2ac[_0x7201('0x31')]=_[_0x7201('0x32')](_0x5ca386[_0x7201('0x31')]);_0x3cf2ac[_0x7201('0x33')]=_[_0x7201('0x34')](_0x3cf2ac['model'],_0x3cf2ac[_0x7201('0x31')]);_0x49519e[_0x7201('0x35')]=_[_0x7201('0x34')](_0x3cf2ac[_0x7201('0x36')],qs[_0x7201('0x37')](_0x5ca386[_0x7201('0x31')][_0x7201('0x37')]));_0x49519e['attributes']=_0x49519e['attributes'][_0x7201('0x38')]?_0x49519e['attributes']:_0x3cf2ac['model'];if(!_0x5ca386[_0x7201('0x31')][_0x7201('0x39')](_0x7201('0x3a'))){_0x49519e[_0x7201('0x1f')]=qs['limit'](_0x5ca386[_0x7201('0x31')]['limit']);_0x49519e[_0x7201('0x21')]=qs[_0x7201('0x21')](_0x5ca386[_0x7201('0x31')][_0x7201('0x21')]);}_0x49519e[_0x7201('0x3b')]=qs[_0x7201('0x3c')](_0x5ca386['query']['sort']);_0x49519e[_0x7201('0x3d')]=qs['filters'](_['pick'](_0x5ca386['query'],_0x3cf2ac[_0x7201('0x33')]),_0x2be168);if(_0x5ca386[_0x7201('0x31')][_0x7201('0x3e')]){_0x49519e[_0x7201('0x3d')]=_['merge'](_0x49519e[_0x7201('0x3d')],{'$or':_[_0x7201('0x2c')](_0x2be168,function(_0x50f445){if(_0x50f445['type']!==_0x7201('0x3f')){var _0x4133ef={};_0x4133ef[_0x50f445[_0x7201('0x2b')]]={'$like':'%'+_0x5ca386['query'][_0x7201('0x3e')]+'%'};return _0x4133ef;}})});}_0x49519e=_[_0x7201('0x40')]({},_0x49519e,_0x5ca386[_0x7201('0x41')]);var _0x47d2ef={'where':_0x49519e[_0x7201('0x3d')]};return db[_0x7201('0x2d')][_0x7201('0x20')](_0x47d2ef)['then'](function(_0x5e30b8){_0x1291cb[_0x7201('0x20')]=_0x5e30b8;if(_0x5ca386['query'][_0x7201('0x42')]){_0x49519e['include']=[{'all':!![]}];}return db[_0x7201('0x2d')][_0x7201('0x43')](_0x49519e);})[_0x7201('0x24')](function(_0x1f5bb0){_0x1291cb[_0x7201('0x44')]=_0x1f5bb0;return _0x1291cb;})[_0x7201('0x24')](respondWithFilteredResult(_0x5c8eef,_0x49519e))[_0x7201('0x45')](handleError(_0x5c8eef,null));};exports['show']=function(_0x532dc8,_0x2937e8){var _0x3bd721={'raw':!![],'where':{'id':_0x532dc8[_0x7201('0x46')]['id']}},_0x793a43={};_0x793a43['model']=_[_0x7201('0x32')](db['Template']['rawAttributes']);_0x793a43['query']=_['keys'](_0x532dc8[_0x7201('0x31')]);_0x793a43[_0x7201('0x33')]=_['intersection'](_0x793a43[_0x7201('0x36')],_0x793a43['query']);_0x3bd721['attributes']=_['intersection'](_0x793a43['model'],qs['fields'](_0x532dc8[_0x7201('0x31')][_0x7201('0x37')]));_0x3bd721[_0x7201('0x35')]=_0x3bd721['attributes'][_0x7201('0x38')]?_0x3bd721[_0x7201('0x35')]:_0x793a43['model'];if(_0x532dc8[_0x7201('0x31')][_0x7201('0x42')]){_0x3bd721[_0x7201('0x47')]=[{'all':!![]}];}_0x3bd721=_['merge']({},_0x3bd721,_0x532dc8['options']);return db['Template'][_0x7201('0x48')](_0x3bd721)[_0x7201('0x24')](handleEntityNotFound(_0x2937e8,null))[_0x7201('0x24')](respondWithResult(_0x2937e8,null))[_0x7201('0x45')](handleError(_0x2937e8,null));};exports[_0x7201('0x49')]=function(_0x3135bb,_0x393fb2){return db[_0x7201('0x2d')][_0x7201('0x49')](_0x3135bb['body'],{})['then'](function(_0x4c9a3b){var _0x467562=_0x3135bb[_0x7201('0x4a')][_0x7201('0x26')]({'plain':!![]});if(!_0x467562)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467562['role']===_0x7201('0x4a')){var _0x366fa5=_0x4c9a3b[_0x7201('0x26')]({'plain':!![]});var _0x4133ec=_0x7201('0x27');return db[_0x7201('0x4b')][_0x7201('0x48')]({'where':{'name':_0x4133ec,'userProfileId':_0x467562[_0x7201('0x4c')]},'raw':!![]})['then'](function(_0x31df2b){if(_0x31df2b&&_0x31df2b['autoAssociation']===0x0){return db[_0x7201('0x28')][_0x7201('0x49')]({'name':_0x366fa5['name'],'resourceId':_0x366fa5['id'],'type':_0x31df2b[_0x7201('0x2b')],'sectionId':_0x31df2b['id']},{})[_0x7201('0x24')](function(){return _0x4c9a3b;});}else{return _0x4c9a3b;}})['catch'](function(_0x37d486){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d486);throw _0x37d486;});}return _0x4c9a3b;})[_0x7201('0x24')](respondWithResult(_0x393fb2,0xc9))[_0x7201('0x45')](handleError(_0x393fb2,null));};exports[_0x7201('0x23')]=function(_0x2b4bb2,_0x344349){if(_0x2b4bb2[_0x7201('0x4d')]['id']){delete _0x2b4bb2[_0x7201('0x4d')]['id'];}return db[_0x7201('0x2d')]['find']({'where':{'id':_0x2b4bb2['params']['id']}})['then'](handleEntityNotFound(_0x344349,null))[_0x7201('0x24')](saveUpdates(_0x2b4bb2[_0x7201('0x4d')],null))[_0x7201('0x24')](respondWithResult(_0x344349,null))[_0x7201('0x45')](handleError(_0x344349,null));};exports[_0x7201('0x25')]=function(_0xce7db2,_0x9c0954){return db[_0x7201('0x2d')][_0x7201('0x48')]({'where':{'id':_0xce7db2[_0x7201('0x46')]['id']}})[_0x7201('0x24')](handleEntityNotFound(_0x9c0954,null))[_0x7201('0x24')](removeEntity(_0x9c0954,null))[_0x7201('0x45')](handleError(_0x9c0954,null));}; \ No newline at end of file +var _0x7645=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x56875c,_0x432b1f){var _0x236f41=function(_0x34d4ad){while(--_0x34d4ad){_0x56875c['push'](_0x56875c['shift']());}};_0x236f41(++_0x432b1f);}(_0x7645,0x1a8));var _0x5764=function(_0x4b5b46,_0x182156){_0x4b5b46=_0x4b5b46-0x0;var _0x275ef7=_0x7645[_0x4b5b46];return _0x275ef7;};'use strict';var emlformat=require(_0x5764('0x0'));var rimraf=require(_0x5764('0x1'));var zipdir=require(_0x5764('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5764('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5764('0x4'));var util=require(_0x5764('0x5'));var path=require(_0x5764('0x6'));var sox=require(_0x5764('0x7'));var csv=require(_0x5764('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5764('0x9'));var squel=require('squel');var crypto=require(_0x5764('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5764('0xb'));var Redis=require(_0x5764('0xc'));var authService=require(_0x5764('0xd'));var qs=require(_0x5764('0xe'));var as=require(_0x5764('0xf'));var hardwareService=require(_0x5764('0x10'));var logger=require(_0x5764('0x11'))(_0x5764('0x12'));var utils=require(_0x5764('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5764('0x14'));var db=require(_0x5764('0x15'))['db'];function respondWithStatusCode(_0xd42c20,_0x1407fd){_0x1407fd=_0x1407fd||0xcc;return function(_0x4da075){if(_0x4da075){return _0xd42c20['sendStatus'](_0x1407fd);}return _0xd42c20['status'](_0x1407fd)[_0x5764('0x16')]();};}function respondWithResult(_0x26d83a,_0x32f619){_0x32f619=_0x32f619||0xc8;return function(_0x1aeae0){if(_0x1aeae0){return _0x26d83a[_0x5764('0x17')](_0x32f619)['json'](_0x1aeae0);}};}function respondWithFilteredResult(_0x2aa3e3,_0xff4d07){return function(_0x4779c5){if(_0x4779c5){var _0x5c25f4=typeof _0xff4d07[_0x5764('0x18')]===_0x5764('0x19')&&typeof _0xff4d07[_0x5764('0x1a')]===_0x5764('0x19');var _0x2e6fe7=_0x4779c5[_0x5764('0x1b')];var _0x45fe75=_0x5c25f4?0x0:_0xff4d07[_0x5764('0x18')];var _0x19e97a=_0x5c25f4?_0x4779c5[_0x5764('0x1b')]:_0xff4d07['offset']+_0xff4d07[_0x5764('0x1a')];var _0x53fc2f;if(_0x19e97a>=_0x2e6fe7){_0x19e97a=_0x2e6fe7;_0x53fc2f=0xc8;}else{_0x53fc2f=0xce;}_0x2aa3e3[_0x5764('0x17')](_0x53fc2f);return _0x2aa3e3['set']('Content-Range',_0x45fe75+'-'+_0x19e97a+'/'+_0x2e6fe7)['json'](_0x4779c5);}return null;};}function patchUpdates(_0x22425e){return function(_0x540a52){try{jsonpatch[_0x5764('0x1c')](_0x540a52,_0x22425e,!![]);}catch(_0x1971d9){return BPromise[_0x5764('0x1d')](_0x1971d9);}return _0x540a52[_0x5764('0x1e')]();};}function saveUpdates(_0x1aaa69,_0x1f0956){return function(_0x1505e1){if(_0x1505e1){return _0x1505e1[_0x5764('0x1f')](_0x1aaa69)[_0x5764('0x20')](function(_0xfcd239){return _0xfcd239;});}return null;};}function removeEntity(_0x1af980,_0x44a2d1){return function(_0x2c3660){if(_0x2c3660){return _0x2c3660['destroy']()[_0x5764('0x20')](function(){var _0x340277=_0x2c3660[_0x5764('0x21')]({'plain':!![]});var _0x341c1b=_0x5764('0x22');return db[_0x5764('0x23')][_0x5764('0x24')]({'where':{'type':_0x341c1b,'resourceId':_0x340277['id']}})[_0x5764('0x20')](function(){return _0x2c3660;});})['then'](function(){_0x1af980[_0x5764('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a4d7b,_0x27379f){return function(_0x1a1e67){if(!_0x1a1e67){_0x3a4d7b[_0x5764('0x25')](0x194);}return _0x1a1e67;};}function handleError(_0x1635d8,_0x21df71){_0x21df71=_0x21df71||0x1f4;return function(_0x2b5d5a){logger[_0x5764('0x26')](_0x2b5d5a[_0x5764('0x27')]);if(_0x2b5d5a[_0x5764('0x28')]){delete _0x2b5d5a[_0x5764('0x28')];}_0x1635d8[_0x5764('0x17')](_0x21df71)[_0x5764('0x29')](_0x2b5d5a);};}exports[_0x5764('0x2a')]=function(_0x383d24,_0xa53b75){var _0x3d1464={},_0x530ef8={},_0x1454b8={'count':0x0,'rows':[]};var _0x31a172=_[_0x5764('0x2b')](db[_0x5764('0x2c')][_0x5764('0x2d')],function(_0x4fd245){return{'name':_0x4fd245[_0x5764('0x2e')],'type':_0x4fd245[_0x5764('0x2f')][_0x5764('0x30')]};});_0x530ef8[_0x5764('0x31')]=_['map'](_0x31a172,'name');_0x530ef8[_0x5764('0x32')]=_[_0x5764('0x33')](_0x383d24[_0x5764('0x32')]);_0x530ef8[_0x5764('0x34')]=_['intersection'](_0x530ef8[_0x5764('0x31')],_0x530ef8[_0x5764('0x32')]);_0x3d1464[_0x5764('0x35')]=_[_0x5764('0x36')](_0x530ef8[_0x5764('0x31')],qs[_0x5764('0x37')](_0x383d24[_0x5764('0x32')][_0x5764('0x37')]));_0x3d1464[_0x5764('0x35')]=_0x3d1464['attributes'][_0x5764('0x38')]?_0x3d1464['attributes']:_0x530ef8[_0x5764('0x31')];if(!_0x383d24['query'][_0x5764('0x39')](_0x5764('0x3a'))){_0x3d1464[_0x5764('0x1a')]=qs[_0x5764('0x1a')](_0x383d24[_0x5764('0x32')][_0x5764('0x1a')]);_0x3d1464[_0x5764('0x18')]=qs[_0x5764('0x18')](_0x383d24[_0x5764('0x32')][_0x5764('0x18')]);}_0x3d1464[_0x5764('0x3b')]=qs[_0x5764('0x3c')](_0x383d24[_0x5764('0x32')][_0x5764('0x3c')]);_0x3d1464[_0x5764('0x3d')]=qs[_0x5764('0x34')](_[_0x5764('0x3e')](_0x383d24[_0x5764('0x32')],_0x530ef8[_0x5764('0x34')]),_0x31a172);if(_0x383d24[_0x5764('0x32')][_0x5764('0x3f')]){_0x3d1464[_0x5764('0x3d')]=_[_0x5764('0x40')](_0x3d1464[_0x5764('0x3d')],{'$or':_[_0x5764('0x2b')](_0x31a172,function(_0x53769b){if(_0x53769b[_0x5764('0x2f')]!==_0x5764('0x41')){var _0x4e0ce1={};_0x4e0ce1[_0x53769b[_0x5764('0x28')]]={'$like':'%'+_0x383d24[_0x5764('0x32')][_0x5764('0x3f')]+'%'};return _0x4e0ce1;}})});}_0x3d1464=_[_0x5764('0x40')]({},_0x3d1464,_0x383d24[_0x5764('0x42')]);var _0x101720={'where':_0x3d1464[_0x5764('0x3d')]};return db[_0x5764('0x2c')][_0x5764('0x1b')](_0x101720)[_0x5764('0x20')](function(_0x1cdcc7){_0x1454b8['count']=_0x1cdcc7;if(_0x383d24[_0x5764('0x32')][_0x5764('0x43')]){_0x3d1464[_0x5764('0x44')]=[{'all':!![]}];}return db['Template'][_0x5764('0x45')](_0x3d1464);})['then'](function(_0x46c1f8){_0x1454b8['rows']=_0x46c1f8;return _0x1454b8;})[_0x5764('0x20')](respondWithFilteredResult(_0xa53b75,_0x3d1464))['catch'](handleError(_0xa53b75,null));};exports['show']=function(_0x482add,_0x3fc084){var _0x3e4b64={'raw':!![],'where':{'id':_0x482add[_0x5764('0x46')]['id']}},_0x3a04de={};_0x3a04de['model']=_[_0x5764('0x33')](db[_0x5764('0x2c')][_0x5764('0x2d')]);_0x3a04de[_0x5764('0x32')]=_[_0x5764('0x33')](_0x482add['query']);_0x3a04de[_0x5764('0x34')]=_['intersection'](_0x3a04de[_0x5764('0x31')],_0x3a04de[_0x5764('0x32')]);_0x3e4b64[_0x5764('0x35')]=_['intersection'](_0x3a04de[_0x5764('0x31')],qs['fields'](_0x482add[_0x5764('0x32')][_0x5764('0x37')]));_0x3e4b64[_0x5764('0x35')]=_0x3e4b64['attributes'][_0x5764('0x38')]?_0x3e4b64[_0x5764('0x35')]:_0x3a04de['model'];if(_0x482add[_0x5764('0x32')]['includeAll']){_0x3e4b64[_0x5764('0x44')]=[{'all':!![]}];}_0x3e4b64=_[_0x5764('0x40')]({},_0x3e4b64,_0x482add[_0x5764('0x42')]);return db[_0x5764('0x2c')]['find'](_0x3e4b64)[_0x5764('0x20')](handleEntityNotFound(_0x3fc084,null))[_0x5764('0x20')](respondWithResult(_0x3fc084,null))[_0x5764('0x47')](handleError(_0x3fc084,null));};exports[_0x5764('0x48')]=function(_0x292528,_0x4e1913){return db['Template'][_0x5764('0x48')](_0x292528[_0x5764('0x49')],{})[_0x5764('0x20')](function(_0x225c35){var _0xc80460=_0x292528[_0x5764('0x4a')][_0x5764('0x21')]({'plain':!![]});if(!_0xc80460)throw new Error(_0x5764('0x4b'));if(_0xc80460[_0x5764('0x4c')]===_0x5764('0x4a')){var _0x526b9c=_0x225c35[_0x5764('0x21')]({'plain':!![]});var _0x188e94=_0x5764('0x22');return db['UserProfileSection'][_0x5764('0x4d')]({'where':{'name':_0x188e94,'userProfileId':_0xc80460[_0x5764('0x4e')]},'raw':!![]})[_0x5764('0x20')](function(_0x47d5c3){if(_0x47d5c3&&_0x47d5c3[_0x5764('0x4f')]===0x0){return db[_0x5764('0x23')]['create']({'name':_0x526b9c[_0x5764('0x28')],'resourceId':_0x526b9c['id'],'type':_0x47d5c3['name'],'sectionId':_0x47d5c3['id']},{})[_0x5764('0x20')](function(){return _0x225c35;});}else{return _0x225c35;}})[_0x5764('0x47')](function(_0x3036ca){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3036ca);throw _0x3036ca;});}return _0x225c35;})[_0x5764('0x20')](respondWithResult(_0x4e1913,0xc9))[_0x5764('0x47')](handleError(_0x4e1913,null));};exports['update']=function(_0x5ea260,_0x1e52f9){if(_0x5ea260['body']['id']){delete _0x5ea260['body']['id'];}return db[_0x5764('0x2c')]['find']({'where':{'id':_0x5ea260[_0x5764('0x46')]['id']}})[_0x5764('0x20')](handleEntityNotFound(_0x1e52f9,null))['then'](saveUpdates(_0x5ea260[_0x5764('0x49')],null))[_0x5764('0x20')](respondWithResult(_0x1e52f9,null))['catch'](handleError(_0x1e52f9,null));};exports['destroy']=function(_0x6a94e9,_0x56e937){return db[_0x5764('0x2c')][_0x5764('0x4d')]({'where':{'id':_0x6a94e9[_0x5764('0x46')]['id']}})[_0x5764('0x20')](handleEntityNotFound(_0x56e937,null))['then'](removeEntity(_0x56e937,null))['catch'](handleError(_0x56e937,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d91a480..2af772a 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 _0x5bf6=['exports','define','Template','lodash','util','../../config/logger','api','moment','request-promise','path','./template.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bf6,0xc9));var _0x65bf=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x5bf6[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x65bf('0x0'));var util=require(_0x65bf('0x1'));var logger=require(_0x65bf('0x2'))(_0x65bf('0x3'));var moment=require(_0x65bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x65bf('0x5'));var fs=require('fs');var path=require(_0x65bf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x65bf('0x7'));module[_0x65bf('0x8')]=function(_0x25b2df,_0x3f3c83){return _0x25b2df[_0x65bf('0x9')](_0x65bf('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277d=['rimraf','../../config/environment','exports','define','Template','tools_templates','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2ebe26,_0x59b23b){var _0x24ed11=function(_0xec3176){while(--_0xec3176){_0x2ebe26['push'](_0x2ebe26['shift']());}};_0x24ed11(++_0x59b23b);}(_0x277d,0x7e));var _0xd277=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x277d[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xd277('0x0'));var logger=require(_0xd277('0x1'))(_0xd277('0x2'));var moment=require(_0xd277('0x3'));var BPromise=require(_0xd277('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd277('0x5'));var rimraf=require(_0xd277('0x6'));var config=require(_0xd277('0x7'));var attributes=require('./template.attributes');module[_0xd277('0x8')]=function(_0x390d18,_0x5984cc){return _0x390d18[_0xd277('0x9')](_0xd277('0xa'),attributes,{'tableName':_0xd277('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 3c25ffa..352e427 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 _0x280b=['Template','findAll','options','raw','attributes','limit','include','map','model','then','GetTemplate','stringify','util','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','error','code','Template,\x20%s,\x20%s','message','result','catch'];(function(_0x1a6e4e,_0x42d8f1){var _0x45bca1=function(_0x54e442){while(--_0x54e442){_0x1a6e4e['push'](_0x1a6e4e['shift']());}};_0x45bca1(++_0x42d8f1);}(_0x280b,0x1bf));var _0xb280=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x280b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb280('0x0'));var moment=require(_0xb280('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb280('0x2'));var db=require(_0xb280('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb280('0x4'));var jayson=require(_0xb280('0x5'));var client=jayson['client'][_0xb280('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b343c,_0x5af817,_0x5db570){return new BPromise(function(_0xd044e8,_0x4f79cd){return client[_0xb280('0x7')](_0x4b343c,_0x5db570)['then'](function(_0x10eed9){logger[_0xb280('0x8')]('Template,\x20%s,\x20%s',_0x5af817,'request\x20sent');logger[_0xb280('0x9')]('Template,\x20%s,\x20%s,\x20%s',_0x5af817,_0xb280('0xa'),JSON['stringify'](_0x10eed9));if(_0x10eed9[_0xb280('0xb')]){if(_0x10eed9['error'][_0xb280('0xc')]===0x1f4){logger[_0xb280('0xb')](_0xb280('0xd'),_0x5af817,_0x10eed9[_0xb280('0xb')]['message']);return _0x4f79cd(_0x10eed9['error'][_0xb280('0xe')]);}logger[_0xb280('0xb')]('Template,\x20%s,\x20%s',_0x5af817,_0x10eed9[_0xb280('0xb')][_0xb280('0xe')]);return _0xd044e8(_0x10eed9[_0xb280('0xb')][_0xb280('0xe')]);}else{logger[_0xb280('0x8')](_0xb280('0xd'),_0x5af817,_0xb280('0xa'));_0xd044e8(_0x10eed9[_0xb280('0xf')]['message']);}})[_0xb280('0x10')](function(_0xc8d56a){logger[_0xb280('0xb')]('Template,\x20%s,\x20%s',_0x5af817,_0xc8d56a);_0x4f79cd(_0xc8d56a);});});}exports['GetTemplate']=function(_0x53a82c){var _0xa7bb4b=this;return new Promise(function(_0x1a7cc1,_0x421e32){return db[_0xb280('0x11')][_0xb280('0x12')]({'raw':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x14')]===undefined?!![]:![]:!![],'where':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')]['where']||null:null,'attributes':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x15')]||null:null,'limit':_0x53a82c['options']?_0x53a82c[_0xb280('0x13')][_0xb280('0x16')]||null:null,'include':_0x53a82c[_0xb280('0x13')]?_0x53a82c[_0xb280('0x13')][_0xb280('0x17')]?_[_0xb280('0x18')](_0x53a82c[_0xb280('0x13')][_0xb280('0x17')],function(_0xd7a11d){return{'model':db[_0xd7a11d[_0xb280('0x19')]],'as':_0xd7a11d['as'],'attributes':_0xd7a11d[_0xb280('0x15')],'include':_0xd7a11d[_0xb280('0x17')]?_[_0xb280('0x18')](_0xd7a11d[_0xb280('0x17')],function(_0x4d01d1){return{'model':db[_0x4d01d1['model']],'as':_0x4d01d1['as'],'attributes':_0x4d01d1[_0xb280('0x15')],'include':_0x4d01d1[_0xb280('0x17')]?_[_0xb280('0x18')](_0x4d01d1['include'],function(_0x55bb93){return{'model':db[_0x55bb93[_0xb280('0x19')]],'as':_0x55bb93['as'],'attributes':_0x55bb93[_0xb280('0x15')]};}):[]};}):[]};}):[]:[]})[_0xb280('0x1a')](function(_0x19e8f4){logger[_0xb280('0x8')](_0xb280('0x1b'),_0x53a82c);logger[_0xb280('0x9')]('GetTemplate',_0x53a82c,JSON[_0xb280('0x1c')](_0x19e8f4));_0x1a7cc1(_0x19e8f4);})[_0xb280('0x10')](function(_0x1d1e9a){logger[_0xb280('0xb')](_0xb280('0x1b'),_0x1d1e9a[_0xb280('0xe')],_0x53a82c);_0x421e32(_0xa7bb4b[_0xb280('0xb')](0x1f4,_0x1d1e9a[_0xb280('0xe')]));});});}; \ No newline at end of file +var _0x08e0=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','Template','findAll','options','where','attributes','limit','map','include','model','stringify','lodash'];(function(_0x4aa3c7,_0x46c8b0){var _0xf05b28=function(_0x34b41b){while(--_0x34b41b){_0x4aa3c7['push'](_0x4aa3c7['shift']());}};_0xf05b28(++_0x46c8b0);}(_0x08e0,0x16a));var _0x008e=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x08e0[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0x008e('0x0'));var util=require(_0x008e('0x1'));var moment=require(_0x008e('0x2'));var BPromise=require(_0x008e('0x3'));var rs=require(_0x008e('0x4'));var fs=require('fs');var Redis=require(_0x008e('0x5'));var db=require(_0x008e('0x6'))['db'];var utils=require(_0x008e('0x7'));var logger=require(_0x008e('0x8'))('rpc');var config=require(_0x008e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x008e('0xa')][_0x008e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bb8c8,_0x40795f,_0x75e68a){return new BPromise(function(_0x2ee8ec,_0x50216a){return client[_0x008e('0xc')](_0x4bb8c8,_0x75e68a)[_0x008e('0xd')](function(_0x35faeb){logger[_0x008e('0xe')](_0x008e('0xf'),_0x40795f,'request\x20sent');logger[_0x008e('0x10')](_0x008e('0x11'),_0x40795f,'request\x20sent',JSON['stringify'](_0x35faeb));if(_0x35faeb[_0x008e('0x12')]){if(_0x35faeb[_0x008e('0x12')][_0x008e('0x13')]===0x1f4){logger[_0x008e('0x12')](_0x008e('0xf'),_0x40795f,_0x35faeb['error']['message']);return _0x50216a(_0x35faeb[_0x008e('0x12')][_0x008e('0x14')]);}logger[_0x008e('0x12')](_0x008e('0xf'),_0x40795f,_0x35faeb[_0x008e('0x12')]['message']);return _0x2ee8ec(_0x35faeb[_0x008e('0x12')]['message']);}else{logger[_0x008e('0xe')](_0x008e('0xf'),_0x40795f,'request\x20sent');_0x2ee8ec(_0x35faeb['result']['message']);}})[_0x008e('0x15')](function(_0x18ebc2){logger[_0x008e('0x12')](_0x008e('0xf'),_0x40795f,_0x18ebc2);_0x50216a(_0x18ebc2);});});}exports[_0x008e('0x16')]=function(_0x488a1e){var _0x1aee4a=this;return new Promise(function(_0x453f94,_0x14b6ff){return db[_0x008e('0x17')][_0x008e('0x18')]({'raw':_0x488a1e['options']?_0x488a1e[_0x008e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x488a1e[_0x008e('0x19')]?_0x488a1e[_0x008e('0x19')][_0x008e('0x1a')]||null:null,'attributes':_0x488a1e[_0x008e('0x19')]?_0x488a1e[_0x008e('0x19')][_0x008e('0x1b')]||null:null,'limit':_0x488a1e['options']?_0x488a1e['options'][_0x008e('0x1c')]||null:null,'include':_0x488a1e[_0x008e('0x19')]?_0x488a1e[_0x008e('0x19')]['include']?_[_0x008e('0x1d')](_0x488a1e['options'][_0x008e('0x1e')],function(_0x2faa08){return{'model':db[_0x2faa08['model']],'as':_0x2faa08['as'],'attributes':_0x2faa08[_0x008e('0x1b')],'include':_0x2faa08[_0x008e('0x1e')]?_['map'](_0x2faa08[_0x008e('0x1e')],function(_0x2e0914){return{'model':db[_0x2e0914[_0x008e('0x1f')]],'as':_0x2e0914['as'],'attributes':_0x2e0914[_0x008e('0x1b')],'include':_0x2e0914[_0x008e('0x1e')]?_[_0x008e('0x1d')](_0x2e0914[_0x008e('0x1e')],function(_0x38a623){return{'model':db[_0x38a623[_0x008e('0x1f')]],'as':_0x38a623['as'],'attributes':_0x38a623['attributes']};}):[]};}):[]};}):[]:[]})[_0x008e('0xd')](function(_0x4cb14b){logger['info'](_0x008e('0x16'),_0x488a1e);logger['debug'](_0x008e('0x16'),_0x488a1e,JSON[_0x008e('0x20')](_0x4cb14b));_0x453f94(_0x4cb14b);})[_0x008e('0x15')](function(_0x4e821e){logger[_0x008e('0x12')](_0x008e('0x16'),_0x4e821e[_0x008e('0x14')],_0x488a1e);_0x14b6ff(_0x1aee4a['error'](0x1f4,_0x4e821e[_0x008e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index cca0ede..7719b27 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 _0x59fe=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','update','delete','/:id'];(function(_0x173505,_0x56e45a){var _0x2b8950=function(_0x3ba0bb){while(--_0x3ba0bb){_0x173505['push'](_0x173505['shift']());}};_0x2b8950(++_0x56e45a);}(_0x59fe,0x146));var _0xe59f=function(_0x3415dd,_0x524865){_0x3415dd=_0x3415dd-0x0;var _0x3ddf4e=_0x59fe[_0x3415dd];return _0x3ddf4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe59f('0x0'));var timeout=require(_0xe59f('0x1'));var express=require(_0xe59f('0x2'));var router=express[_0xe59f('0x3')]();var fs_extra=require(_0xe59f('0x4'));var auth=require(_0xe59f('0x5'));var interaction=require(_0xe59f('0x6'));var config=require(_0xe59f('0x7'));var controller=require(_0xe59f('0x8'));router['get']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe59f('0xb')]);router[_0xe59f('0xc')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0xe')]);router['get'](_0xe59f('0xf'),auth[_0xe59f('0x9')](),controller['getAnyConditions']);router[_0xe59f('0xc')](_0xe59f('0x10'),auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0xe59f('0x11')]);router[_0xe59f('0x12')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0x13')]);router[_0xe59f('0x12')](_0xe59f('0xf'),auth['isAuthenticated'](),controller[_0xe59f('0x14')]);router['post'](_0xe59f('0x10'),auth[_0xe59f('0x9')](),controller[_0xe59f('0x15')]);router['put']('/:id',auth[_0xe59f('0x9')](),controller[_0xe59f('0x16')]);router[_0xe59f('0x17')](_0xe59f('0x18'),auth['isAuthenticated'](),controller[_0xe59f('0x19')]);module[_0xe59f('0x1a')]=router; \ No newline at end of file +var _0xa322=['path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','/:id','update','delete','destroy','multer','util'];(function(_0x3e3c7a,_0x381151){var _0x25436a=function(_0x44f95c){while(--_0x44f95c){_0x3e3c7a['push'](_0x3e3c7a['shift']());}};_0x25436a(++_0x381151);}(_0xa322,0x15c));var _0x2a32=function(_0x6be555,_0x3b0519){_0x6be555=_0x6be555-0x0;var _0x3191ad=_0xa322[_0x6be555];return _0x3191ad;};'use strict';var multer=require(_0x2a32('0x0'));var util=require(_0x2a32('0x1'));var path=require(_0x2a32('0x2'));var timeout=require(_0x2a32('0x3'));var express=require('express');var router=express[_0x2a32('0x4')]();var fs_extra=require(_0x2a32('0x5'));var auth=require(_0x2a32('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x2a32('0x7')]('/',auth[_0x2a32('0x8')](),controller[_0x2a32('0x9')]);router['get']('/:id',auth[_0x2a32('0x8')](),controller[_0x2a32('0xa')]);router[_0x2a32('0x7')]('/:id/all_conditions',auth[_0x2a32('0x8')](),controller[_0x2a32('0xb')]);router['get'](_0x2a32('0xc'),auth[_0x2a32('0x8')](),controller[_0x2a32('0xd')]);router[_0x2a32('0x7')](_0x2a32('0xe'),auth[_0x2a32('0x8')](),controller[_0x2a32('0xf')]);router[_0x2a32('0x10')]('/',auth[_0x2a32('0x8')](),controller[_0x2a32('0x11')]);router[_0x2a32('0x10')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x2a32('0x12')]);router[_0x2a32('0x10')](_0x2a32('0xc'),auth[_0x2a32('0x8')](),controller[_0x2a32('0x13')]);router[_0x2a32('0x10')](_0x2a32('0xe'),auth[_0x2a32('0x8')](),controller['addAction']);router[_0x2a32('0x14')](_0x2a32('0x15'),auth[_0x2a32('0x8')](),controller[_0x2a32('0x16')]);router[_0x2a32('0x17')](_0x2a32('0x15'),auth[_0x2a32('0x8')](),controller[_0x2a32('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 628dde2..19753d5 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 _0x195f=['BOOLEAN','sequelize','STRING'];(function(_0x28c9dc,_0x219142){var _0x1500ad=function(_0x4fc5ec){while(--_0x4fc5ec){_0x28c9dc['push'](_0x28c9dc['shift']());}};_0x1500ad(++_0x219142);}(_0x195f,0xe5));var _0xf195=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x195f[_0x443494];return _0x4a6794;};'use strict';var Sequelize=require(_0xf195('0x0'));module['exports']={'name':{'type':Sequelize[_0xf195('0x1')]},'channel':{'type':Sequelize[_0xf195('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xf195('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x88d8=['STRING','sequelize','exports'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x88d8,0x1c6));var _0x888d=function(_0xd6e9f0,_0x287fd9){_0xd6e9f0=_0xd6e9f0-0x0;var _0x51457e=_0x88d8[_0xd6e9f0];return _0x51457e;};'use strict';var Sequelize=require(_0x888d('0x0'));module[_0x888d('0x1')]={'name':{'type':Sequelize[_0x888d('0x2')]},'channel':{'type':Sequelize[_0x888d('0x2')]},'description':{'type':Sequelize[_0x888d('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 11b4835..0c0caf5 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 _0xdd2a=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','hasOwnProperty','TriggerId','Action','getActions','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2b3d6d,_0xb6a71b){var _0x3e2c9f=function(_0x56771a){while(--_0x56771a){_0x2b3d6d['push'](_0x2b3d6d['shift']());}};_0x3e2c9f(++_0xb6a71b);}(_0xdd2a,0x1a5));var _0xadd2=function(_0x13e3b1,_0x524846){_0x13e3b1=_0x13e3b1-0x0;var _0x2ca897=_0xdd2a[_0x13e3b1];return _0x2ca897;};'use strict';var emlformat=require(_0xadd2('0x0'));var rimraf=require(_0xadd2('0x1'));var zipdir=require(_0xadd2('0x2'));var jsonpatch=require(_0xadd2('0x3'));var rp=require(_0xadd2('0x4'));var moment=require(_0xadd2('0x5'));var BPromise=require(_0xadd2('0x6'));var Mustache=require(_0xadd2('0x7'));var util=require(_0xadd2('0x8'));var path=require(_0xadd2('0x9'));var sox=require(_0xadd2('0xa'));var csv=require(_0xadd2('0xb'));var ejs=require(_0xadd2('0xc'));var fs=require('fs');var fs_extra=require(_0xadd2('0xd'));var _=require(_0xadd2('0xe'));var squel=require(_0xadd2('0xf'));var crypto=require(_0xadd2('0x10'));var jsforce=require(_0xadd2('0x11'));var deskjs=require(_0xadd2('0x12'));var toCsv=require(_0xadd2('0xb'));var querystring=require(_0xadd2('0x13'));var Papa=require(_0xadd2('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xadd2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xadd2('0x16'))(_0xadd2('0x17'));var utils=require(_0xadd2('0x18'));var config=require(_0xadd2('0x19'));var licenseUtil=require(_0xadd2('0x1a'));var db=require(_0xadd2('0x1b'))['db'];function respondWithStatusCode(_0xaeac5e,_0x928fe7){_0x928fe7=_0x928fe7||0xcc;return function(_0x4b0973){if(_0x4b0973){return _0xaeac5e[_0xadd2('0x1c')](_0x928fe7);}return _0xaeac5e['status'](_0x928fe7)[_0xadd2('0x1d')]();};}function respondWithResult(_0x498e71,_0x2d5497){_0x2d5497=_0x2d5497||0xc8;return function(_0x252d04){if(_0x252d04){return _0x498e71['status'](_0x2d5497)['json'](_0x252d04);}};}function respondWithFilteredResult(_0x1e9956,_0x2a8a9b){return function(_0x3dd439){if(_0x3dd439){var _0x305f71=typeof _0x2a8a9b[_0xadd2('0x1e')]===_0xadd2('0x1f')&&typeof _0x2a8a9b['limit']===_0xadd2('0x1f');var _0x23adcc=_0x3dd439[_0xadd2('0x20')];var _0x4c2fdc=_0x305f71?0x0:_0x2a8a9b[_0xadd2('0x1e')];var _0x5b8a0f=_0x305f71?_0x3dd439[_0xadd2('0x20')]:_0x2a8a9b[_0xadd2('0x1e')]+_0x2a8a9b[_0xadd2('0x21')];var _0xa32b8b;if(_0x5b8a0f>=_0x23adcc){_0x5b8a0f=_0x23adcc;_0xa32b8b=0xc8;}else{_0xa32b8b=0xce;}_0x1e9956[_0xadd2('0x22')](_0xa32b8b);return _0x1e9956[_0xadd2('0x23')](_0xadd2('0x24'),_0x4c2fdc+'-'+_0x5b8a0f+'/'+_0x23adcc)[_0xadd2('0x25')](_0x3dd439);}return null;};}function patchUpdates(_0x4010af){return function(_0x207379){try{jsonpatch['apply'](_0x207379,_0x4010af,!![]);}catch(_0x1e0610){return BPromise[_0xadd2('0x26')](_0x1e0610);}return _0x207379[_0xadd2('0x27')]();};}function saveUpdates(_0x1d5003,_0x51ccde){return function(_0x4ca5b9){if(_0x4ca5b9){return _0x4ca5b9[_0xadd2('0x28')](_0x1d5003)[_0xadd2('0x29')](function(_0x5f5bfe){return _0x5f5bfe;});}return null;};}function removeEntity(_0x67efb4,_0x44fdd4){return function(_0x4e6cc7){if(_0x4e6cc7){return _0x4e6cc7[_0xadd2('0x2a')]()[_0xadd2('0x29')](function(){var _0x4c76da=_0x4e6cc7[_0xadd2('0x2b')]({'plain':!![]});var _0x219627=_0xadd2('0x2c');return db[_0xadd2('0x2d')][_0xadd2('0x2a')]({'where':{'type':_0x219627,'resourceId':_0x4c76da['id']}})[_0xadd2('0x29')](function(){return _0x4e6cc7;});})['then'](function(){_0x67efb4[_0xadd2('0x22')](0xcc)[_0xadd2('0x1d')]();});}};}function handleEntityNotFound(_0x2b31d5,_0x7ff63f){return function(_0x3fda19){if(!_0x3fda19){_0x2b31d5[_0xadd2('0x1c')](0x194);}return _0x3fda19;};}function handleError(_0x5342c1,_0x1a0b3d){_0x1a0b3d=_0x1a0b3d||0x1f4;return function(_0x40b5b7){logger[_0xadd2('0x2e')](_0x40b5b7[_0xadd2('0x2f')]);if(_0x40b5b7[_0xadd2('0x30')]){delete _0x40b5b7['name'];}_0x5342c1[_0xadd2('0x22')](_0x1a0b3d)['send'](_0x40b5b7);};}exports[_0xadd2('0x31')]=function(_0x58163f,_0x530194){var _0x306aef={},_0x2db691={},_0x5eed33={'count':0x0,'rows':[]};var _0xf7da79=_[_0xadd2('0x32')](db[_0xadd2('0x33')][_0xadd2('0x34')],function(_0x53f5d2){return{'name':_0x53f5d2[_0xadd2('0x35')],'type':_0x53f5d2[_0xadd2('0x36')][_0xadd2('0x37')]};});_0x2db691[_0xadd2('0x38')]=_[_0xadd2('0x32')](_0xf7da79,_0xadd2('0x30'));_0x2db691[_0xadd2('0x39')]=_['keys'](_0x58163f[_0xadd2('0x39')]);_0x2db691[_0xadd2('0x3a')]=_[_0xadd2('0x3b')](_0x2db691['model'],_0x2db691['query']);_0x306aef[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x2db691['model'],qs[_0xadd2('0x3d')](_0x58163f[_0xadd2('0x39')]['fields']));_0x306aef[_0xadd2('0x3c')]=_0x306aef[_0xadd2('0x3c')]['length']?_0x306aef[_0xadd2('0x3c')]:_0x2db691[_0xadd2('0x38')];if(!_0x58163f[_0xadd2('0x39')]['hasOwnProperty'](_0xadd2('0x3e'))){_0x306aef[_0xadd2('0x21')]=qs['limit'](_0x58163f[_0xadd2('0x39')][_0xadd2('0x21')]);_0x306aef[_0xadd2('0x1e')]=qs['offset'](_0x58163f[_0xadd2('0x39')][_0xadd2('0x1e')]);}_0x306aef[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x58163f[_0xadd2('0x39')]['sort']);_0x306aef[_0xadd2('0x41')]=qs['filters'](_[_0xadd2('0x42')](_0x58163f[_0xadd2('0x39')],_0x2db691[_0xadd2('0x3a')]),_0xf7da79);if(_0x58163f[_0xadd2('0x39')][_0xadd2('0x43')]){_0x306aef['where']=_[_0xadd2('0x44')](_0x306aef[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0xf7da79,function(_0x520891){if(_0x520891[_0xadd2('0x36')]!=='VIRTUAL'){var _0x180ce3={};_0x180ce3[_0x520891['name']]={'$like':'%'+_0x58163f[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x180ce3;}})});}_0x306aef=_['merge']({},_0x306aef,_0x58163f[_0xadd2('0x45')]);var _0x21a4ab={'where':_0x306aef[_0xadd2('0x41')]};return db[_0xadd2('0x33')][_0xadd2('0x20')](_0x21a4ab)[_0xadd2('0x29')](function(_0x5746be){_0x5eed33['count']=_0x5746be;if(_0x58163f[_0xadd2('0x39')][_0xadd2('0x46')]){_0x306aef[_0xadd2('0x47')]=[{'all':!![]}];}return db[_0xadd2('0x33')][_0xadd2('0x48')](_0x306aef);})[_0xadd2('0x29')](function(_0x51671d){_0x5eed33[_0xadd2('0x49')]=_0x51671d;return _0x5eed33;})[_0xadd2('0x29')](respondWithFilteredResult(_0x530194,_0x306aef))[_0xadd2('0x4a')](handleError(_0x530194,null));};exports[_0xadd2('0x4b')]=function(_0x1a38aa,_0x52ed23){var _0x9c3719={'raw':![],'where':{'id':_0x1a38aa['params']['id']}},_0x538a1e={};_0x538a1e[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x33')]['rawAttributes']);_0x538a1e[_0xadd2('0x39')]=_['keys'](_0x1a38aa['query']);_0x538a1e[_0xadd2('0x3a')]=_[_0xadd2('0x3b')](_0x538a1e[_0xadd2('0x38')],_0x538a1e[_0xadd2('0x39')]);_0x9c3719[_0xadd2('0x3c')]=_['intersection'](_0x538a1e[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x1a38aa[_0xadd2('0x39')]['fields']));_0x9c3719[_0xadd2('0x3c')]=_0x9c3719['attributes'][_0xadd2('0x4d')]?_0x9c3719[_0xadd2('0x3c')]:_0x538a1e[_0xadd2('0x38')];if(_0x1a38aa['query'][_0xadd2('0x46')]){_0x9c3719[_0xadd2('0x47')]=[{'all':!![]}];}_0x9c3719=_[_0xadd2('0x44')]({},_0x9c3719,_0x1a38aa[_0xadd2('0x45')]);return db[_0xadd2('0x33')][_0xadd2('0x4e')](_0x9c3719)[_0xadd2('0x29')](handleEntityNotFound(_0x52ed23,null))[_0xadd2('0x29')](respondWithResult(_0x52ed23,null))[_0xadd2('0x4a')](handleError(_0x52ed23,null));};exports[_0xadd2('0x4f')]=function(_0x258c79,_0x571636){return db['Trigger'][_0xadd2('0x4f')](_0x258c79['body'],{})[_0xadd2('0x29')](function(_0x38c5aa){var _0x3da059=_0x258c79[_0xadd2('0x50')]['get']({'plain':!![]});if(!_0x3da059)throw new Error(_0xadd2('0x51'));if(_0x3da059[_0xadd2('0x52')]===_0xadd2('0x50')){var _0xb10007=_0x38c5aa[_0xadd2('0x2b')]({'plain':!![]});var _0x4014c7=_0xadd2('0x2c');return db[_0xadd2('0x53')]['find']({'where':{'name':_0x4014c7,'userProfileId':_0x3da059[_0xadd2('0x54')]},'raw':!![]})[_0xadd2('0x29')](function(_0x523c0e){if(_0x523c0e&&_0x523c0e[_0xadd2('0x55')]===0x0){return db['UserProfileResource'][_0xadd2('0x4f')]({'name':_0xb10007[_0xadd2('0x30')],'resourceId':_0xb10007['id'],'type':_0x523c0e[_0xadd2('0x30')],'sectionId':_0x523c0e['id']},{})[_0xadd2('0x29')](function(){return _0x38c5aa;});}else{return _0x38c5aa;}})['catch'](function(_0x3b3346){logger['error'](_0xadd2('0x56'),_0x3b3346);throw _0x3b3346;});}return _0x38c5aa;})[_0xadd2('0x29')](respondWithResult(_0x571636,0xc9))[_0xadd2('0x4a')](handleError(_0x571636,null));};exports['update']=function(_0xd29755,_0x4c5537){if(_0xd29755[_0xadd2('0x57')]['id']){delete _0xd29755[_0xadd2('0x57')]['id'];}return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0xd29755[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x4c5537,null))['then'](saveUpdates(_0xd29755[_0xadd2('0x57')],null))[_0xadd2('0x29')](respondWithResult(_0x4c5537,null))[_0xadd2('0x4a')](handleError(_0x4c5537,null));};exports[_0xadd2('0x2a')]=function(_0x1a5dc3,_0x3df85d){return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0x1a5dc3[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x3df85d,null))[_0xadd2('0x29')](removeEntity(_0x3df85d,null))[_0xadd2('0x4a')](handleError(_0x3df85d,null));};exports[_0xadd2('0x59')]=function(_0x301841,_0x1bd125,_0x32e8cd){if(_0x301841['body']['id']){delete _0x301841['body']['id'];}return db['Trigger'][_0xadd2('0x4e')]({'where':{'id':_0x301841['params']['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x1bd125,null))[_0xadd2('0x29')](function(_0x41c530){if(_0x41c530){_0x301841[_0xadd2('0x57')][_0xadd2('0x5a')]=_0x41c530['id'];return db[_0xadd2('0x5b')]['create'](_0x301841[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x1bd125,null))[_0xadd2('0x4a')](handleError(_0x1bd125,null));};exports[_0xadd2('0x5c')]=function(_0x577753,_0x383b94,_0x44b8e5){if(_0x577753[_0xadd2('0x57')]['id']){delete _0x577753[_0xadd2('0x57')]['id'];}return db[_0xadd2('0x33')][_0xadd2('0x4e')]({'where':{'id':_0x577753[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x383b94,null))[_0xadd2('0x29')](function(_0x1d9731){if(_0x1d9731){_0x577753['body'][_0xadd2('0x5d')]=_0x1d9731['id'];return db[_0xadd2('0x5b')]['create'](_0x577753[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x383b94,null))[_0xadd2('0x4a')](handleError(_0x383b94,null));};exports[_0xadd2('0x5e')]=function(_0x1f0df5,_0x362b79,_0x3aad12){var _0x1a451d={};var _0x5dba3a={};var _0x43ee0a;var _0x200323;return db[_0xadd2('0x33')][_0xadd2('0x5f')]({'where':{'id':_0x1f0df5['params']['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x362b79,null))[_0xadd2('0x29')](function(_0x5a9597){if(_0x5a9597){_0x43ee0a=_0x5a9597;_0x5dba3a[_0xadd2('0x38')]=_['keys'](db['Condition'][_0xadd2('0x34')]);_0x5dba3a[_0xadd2('0x39')]=_['keys'](_0x1f0df5[_0xadd2('0x39')]);_0x5dba3a['filters']=_[_0xadd2('0x3b')](_0x5dba3a[_0xadd2('0x38')],_0x5dba3a['query']);_0x1a451d[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x5dba3a[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x1a451d[_0xadd2('0x3c')]=_0x1a451d[_0xadd2('0x3c')][_0xadd2('0x4d')]?_0x1a451d[_0xadd2('0x3c')]:_0x5dba3a['model'];_0x1a451d['order']=qs[_0xadd2('0x40')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x40')]);_0x1a451d[_0xadd2('0x41')]=qs[_0xadd2('0x3a')](_[_0xadd2('0x42')](_0x1f0df5[_0xadd2('0x39')],_0x5dba3a['filters']));if(_0x1f0df5[_0xadd2('0x39')]['filter']){_0x1a451d['where']=_[_0xadd2('0x44')](_0x1a451d[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0x1a451d[_0xadd2('0x3c')],function(_0xf1e309){var _0x236f1e={};_0x236f1e[_0xf1e309]={'$like':'%'+_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x236f1e;})});}_0x1a451d=_[_0xadd2('0x44')]({},_0x1a451d,_0x1f0df5[_0xadd2('0x45')]);return _0x43ee0a[_0xadd2('0x5e')](_0x1a451d);}})[_0xadd2('0x29')](function(_0xe094ca){if(_0xe094ca){_0x200323=_0xe094ca[_0xadd2('0x4d')];if(!_0x1f0df5[_0xadd2('0x39')]['hasOwnProperty'](_0xadd2('0x3e'))){_0x1a451d[_0xadd2('0x21')]=qs[_0xadd2('0x21')](_0x1f0df5[_0xadd2('0x39')][_0xadd2('0x21')]);_0x1a451d[_0xadd2('0x1e')]=qs[_0xadd2('0x1e')](_0x1f0df5[_0xadd2('0x39')]['offset']);}return _0x43ee0a[_0xadd2('0x5e')](_0x1a451d);}})[_0xadd2('0x29')](function(_0x3cc9e1){if(_0x3cc9e1){return _0x3cc9e1?{'count':_0x200323,'rows':_0x3cc9e1}:null;}})[_0xadd2('0x29')](respondWithResult(_0x362b79,null))[_0xadd2('0x4a')](handleError(_0x362b79,null));};exports[_0xadd2('0x60')]=function(_0x3e3d4e,_0x3327b4,_0xba94d8){var _0x4f1618={};var _0x5e5639={};var _0x548159;var _0x4c6170;return db[_0xadd2('0x33')]['findOne']({'where':{'id':_0x3e3d4e['params']['id']}})['then'](handleEntityNotFound(_0x3327b4,null))[_0xadd2('0x29')](function(_0x138bf0){if(_0x138bf0){_0x548159=_0x138bf0;_0x5e5639[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x5b')][_0xadd2('0x34')]);_0x5e5639[_0xadd2('0x39')]=_[_0xadd2('0x4c')](_0x3e3d4e[_0xadd2('0x39')]);_0x5e5639['filters']=_[_0xadd2('0x3b')](_0x5e5639[_0xadd2('0x38')],_0x5e5639[_0xadd2('0x39')]);_0x4f1618[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x5e5639[_0xadd2('0x38')],qs[_0xadd2('0x3d')](_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x4f1618[_0xadd2('0x3c')]=_0x4f1618[_0xadd2('0x3c')][_0xadd2('0x4d')]?_0x4f1618[_0xadd2('0x3c')]:_0x5e5639[_0xadd2('0x38')];_0x4f1618[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x3e3d4e[_0xadd2('0x39')]['sort']);_0x4f1618[_0xadd2('0x41')]=qs[_0xadd2('0x3a')](_[_0xadd2('0x42')](_0x3e3d4e[_0xadd2('0x39')],_0x5e5639[_0xadd2('0x3a')]));if(_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x43')]){_0x4f1618[_0xadd2('0x41')]=_['merge'](_0x4f1618['where'],{'$or':_[_0xadd2('0x32')](_0x4f1618[_0xadd2('0x3c')],function(_0x273005){var _0x166be3={};_0x166be3[_0x273005]={'$like':'%'+_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x166be3;})});}_0x4f1618=_[_0xadd2('0x44')]({},_0x4f1618,_0x3e3d4e['options']);return _0x548159[_0xadd2('0x60')](_0x4f1618);}})[_0xadd2('0x29')](function(_0x1aadc6){if(_0x1aadc6){_0x4c6170=_0x1aadc6[_0xadd2('0x4d')];if(!_0x3e3d4e[_0xadd2('0x39')][_0xadd2('0x61')]('nolimit')){_0x4f1618['limit']=qs['limit'](_0x3e3d4e['query']['limit']);_0x4f1618[_0xadd2('0x1e')]=qs['offset'](_0x3e3d4e['query']['offset']);}return _0x548159['getAnyConditions'](_0x4f1618);}})[_0xadd2('0x29')](function(_0x317539){if(_0x317539){return _0x317539?{'count':_0x4c6170,'rows':_0x317539}:null;}})[_0xadd2('0x29')](respondWithResult(_0x3327b4,null))[_0xadd2('0x4a')](handleError(_0x3327b4,null));};exports['addAction']=function(_0x87be57,_0x3f12b9,_0x28880e){if(_0x87be57['body']['id']){delete _0x87be57[_0xadd2('0x57')]['id'];}return db[_0xadd2('0x33')][_0xadd2('0x4e')]({'where':{'id':_0x87be57[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x3f12b9,null))[_0xadd2('0x29')](function(_0x3696d8){if(_0x3696d8){_0x87be57[_0xadd2('0x57')][_0xadd2('0x62')]=_0x3696d8['id'];return db[_0xadd2('0x63')][_0xadd2('0x4f')](_0x87be57[_0xadd2('0x57')]);}})[_0xadd2('0x29')](respondWithResult(_0x3f12b9,null))['catch'](handleError(_0x3f12b9,null));};exports[_0xadd2('0x64')]=function(_0x5a3cfa,_0x1c4915,_0x36c17d){var _0x1ec8dd={};var _0x4dab4e={};var _0x336b17;var _0xa0d5b;return db[_0xadd2('0x33')][_0xadd2('0x5f')]({'where':{'id':_0x5a3cfa[_0xadd2('0x58')]['id']}})[_0xadd2('0x29')](handleEntityNotFound(_0x1c4915,null))[_0xadd2('0x29')](function(_0x57f2cd){if(_0x57f2cd){_0x336b17=_0x57f2cd;_0x4dab4e[_0xadd2('0x38')]=_[_0xadd2('0x4c')](db[_0xadd2('0x63')][_0xadd2('0x34')]);_0x4dab4e['query']=_[_0xadd2('0x4c')](_0x5a3cfa[_0xadd2('0x39')]);_0x4dab4e[_0xadd2('0x3a')]=_['intersection'](_0x4dab4e[_0xadd2('0x38')],_0x4dab4e['query']);_0x1ec8dd[_0xadd2('0x3c')]=_[_0xadd2('0x3b')](_0x4dab4e['model'],qs[_0xadd2('0x3d')](_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x3d')]));_0x1ec8dd[_0xadd2('0x3c')]=_0x1ec8dd[_0xadd2('0x3c')]['length']?_0x1ec8dd['attributes']:_0x4dab4e['model'];_0x1ec8dd[_0xadd2('0x3f')]=qs[_0xadd2('0x40')](_0x5a3cfa[_0xadd2('0x39')]['sort']);_0x1ec8dd['where']=qs[_0xadd2('0x3a')](_['pick'](_0x5a3cfa['query'],_0x4dab4e['filters']));if(_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x43')]){_0x1ec8dd[_0xadd2('0x41')]=_[_0xadd2('0x44')](_0x1ec8dd[_0xadd2('0x41')],{'$or':_[_0xadd2('0x32')](_0x1ec8dd[_0xadd2('0x3c')],function(_0x35903b){var _0x41f4d1={};_0x41f4d1[_0x35903b]={'$like':'%'+_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x43')]+'%'};return _0x41f4d1;})});}_0x1ec8dd=_[_0xadd2('0x44')]({},_0x1ec8dd,_0x5a3cfa[_0xadd2('0x45')]);return _0x336b17[_0xadd2('0x64')](_0x1ec8dd);}})['then'](function(_0x9c30b7){if(_0x9c30b7){_0xa0d5b=_0x9c30b7[_0xadd2('0x4d')];if(!_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x61')](_0xadd2('0x3e'))){_0x1ec8dd[_0xadd2('0x21')]=qs['limit'](_0x5a3cfa[_0xadd2('0x39')][_0xadd2('0x21')]);_0x1ec8dd['offset']=qs[_0xadd2('0x1e')](_0x5a3cfa['query']['offset']);}return _0x336b17['getActions'](_0x1ec8dd);}})[_0xadd2('0x29')](function(_0xe4b12f){if(_0xe4b12f){return _0xe4b12f?{'count':_0xa0d5b,'rows':_0xe4b12f}:null;}})[_0xadd2('0x29')](respondWithResult(_0x1c4915,null))[_0xadd2('0x4a')](handleError(_0x1c4915,null));}; \ No newline at end of file +var _0xcb18=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','get','Triggers','destroy','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','keys','length','find'];(function(_0x5964f0,_0xc339e2){var _0x3a91fb=function(_0x5d519e){while(--_0x5d519e){_0x5964f0['push'](_0x5964f0['shift']());}};_0x3a91fb(++_0xc339e2);}(_0xcb18,0x17e));var _0x8cb1=function(_0x32339a,_0x1fa2f7){_0x32339a=_0x32339a-0x0;var _0x9756d1=_0xcb18[_0x32339a];return _0x9756d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cb1('0x0'));var zipdir=require(_0x8cb1('0x1'));var jsonpatch=require(_0x8cb1('0x2'));var rp=require(_0x8cb1('0x3'));var moment=require(_0x8cb1('0x4'));var BPromise=require(_0x8cb1('0x5'));var Mustache=require(_0x8cb1('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8cb1('0x7'));var ejs=require(_0x8cb1('0x8'));var fs=require('fs');var fs_extra=require(_0x8cb1('0x9'));var _=require(_0x8cb1('0xa'));var squel=require(_0x8cb1('0xb'));var crypto=require(_0x8cb1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8cb1('0xd'));var toCsv=require(_0x8cb1('0x7'));var querystring=require(_0x8cb1('0xe'));var Papa=require('papaparse');var Redis=require(_0x8cb1('0xf'));var authService=require(_0x8cb1('0x10'));var qs=require(_0x8cb1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cb1('0x12'))(_0x8cb1('0x13'));var utils=require(_0x8cb1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8cb1('0x15'))['db'];function respondWithStatusCode(_0x44a993,_0x15916b){_0x15916b=_0x15916b||0xcc;return function(_0x1708ff){if(_0x1708ff){return _0x44a993[_0x8cb1('0x16')](_0x15916b);}return _0x44a993[_0x8cb1('0x17')](_0x15916b)['end']();};}function respondWithResult(_0x33f795,_0x52f0d1){_0x52f0d1=_0x52f0d1||0xc8;return function(_0x4c4dd9){if(_0x4c4dd9){return _0x33f795['status'](_0x52f0d1)[_0x8cb1('0x18')](_0x4c4dd9);}};}function respondWithFilteredResult(_0x2f04bc,_0x1b03cf){return function(_0x136ac4){if(_0x136ac4){var _0x1cfdf9=typeof _0x1b03cf['offset']===_0x8cb1('0x19')&&typeof _0x1b03cf[_0x8cb1('0x1a')]===_0x8cb1('0x19');var _0xf0e75d=_0x136ac4['count'];var _0x37a0b6=_0x1cfdf9?0x0:_0x1b03cf[_0x8cb1('0x1b')];var _0x34f31d=_0x1cfdf9?_0x136ac4[_0x8cb1('0x1c')]:_0x1b03cf[_0x8cb1('0x1b')]+_0x1b03cf[_0x8cb1('0x1a')];var _0x577652;if(_0x34f31d>=_0xf0e75d){_0x34f31d=_0xf0e75d;_0x577652=0xc8;}else{_0x577652=0xce;}_0x2f04bc[_0x8cb1('0x17')](_0x577652);return _0x2f04bc[_0x8cb1('0x1d')](_0x8cb1('0x1e'),_0x37a0b6+'-'+_0x34f31d+'/'+_0xf0e75d)[_0x8cb1('0x18')](_0x136ac4);}return null;};}function patchUpdates(_0x2eb11b){return function(_0x190c2e){try{jsonpatch[_0x8cb1('0x1f')](_0x190c2e,_0x2eb11b,!![]);}catch(_0xb0bf42){return BPromise[_0x8cb1('0x20')](_0xb0bf42);}return _0x190c2e[_0x8cb1('0x21')]();};}function saveUpdates(_0x44c572,_0x2dfb57){return function(_0x4e1639){if(_0x4e1639){return _0x4e1639['update'](_0x44c572)[_0x8cb1('0x22')](function(_0x1bb15b){return _0x1bb15b;});}return null;};}function removeEntity(_0xad67b2,_0x9b175e){return function(_0x57c534){if(_0x57c534){return _0x57c534['destroy']()[_0x8cb1('0x22')](function(){var _0x1156bb=_0x57c534[_0x8cb1('0x23')]({'plain':!![]});var _0x32c69e=_0x8cb1('0x24');return db['UserProfileResource'][_0x8cb1('0x25')]({'where':{'type':_0x32c69e,'resourceId':_0x1156bb['id']}})[_0x8cb1('0x22')](function(){return _0x57c534;});})[_0x8cb1('0x22')](function(){_0xad67b2[_0x8cb1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd82d,_0x4468c9){return function(_0x5e7c28){if(!_0x5e7c28){_0x2fd82d['sendStatus'](0x194);}return _0x5e7c28;};}function handleError(_0x58b54b,_0x5869bb){_0x5869bb=_0x5869bb||0x1f4;return function(_0x35c631){logger['error'](_0x35c631[_0x8cb1('0x26')]);if(_0x35c631[_0x8cb1('0x27')]){delete _0x35c631['name'];}_0x58b54b['status'](_0x5869bb)[_0x8cb1('0x28')](_0x35c631);};}exports[_0x8cb1('0x29')]=function(_0x42546c,_0x1f4808){var _0x2a65ef={},_0x1e8300={},_0x15133e={'count':0x0,'rows':[]};var _0x266352=_[_0x8cb1('0x2a')](db[_0x8cb1('0x2b')][_0x8cb1('0x2c')],function(_0x2562f9){return{'name':_0x2562f9[_0x8cb1('0x2d')],'type':_0x2562f9[_0x8cb1('0x2e')]['key']};});_0x1e8300['model']=_[_0x8cb1('0x2a')](_0x266352,_0x8cb1('0x27'));_0x1e8300[_0x8cb1('0x2f')]=_['keys'](_0x42546c['query']);_0x1e8300[_0x8cb1('0x30')]=_[_0x8cb1('0x31')](_0x1e8300[_0x8cb1('0x32')],_0x1e8300[_0x8cb1('0x2f')]);_0x2a65ef[_0x8cb1('0x33')]=_[_0x8cb1('0x31')](_0x1e8300[_0x8cb1('0x32')],qs['fields'](_0x42546c['query'][_0x8cb1('0x34')]));_0x2a65ef[_0x8cb1('0x33')]=_0x2a65ef['attributes']['length']?_0x2a65ef[_0x8cb1('0x33')]:_0x1e8300[_0x8cb1('0x32')];if(!_0x42546c[_0x8cb1('0x2f')]['hasOwnProperty'](_0x8cb1('0x35'))){_0x2a65ef[_0x8cb1('0x1a')]=qs[_0x8cb1('0x1a')](_0x42546c[_0x8cb1('0x2f')][_0x8cb1('0x1a')]);_0x2a65ef[_0x8cb1('0x1b')]=qs[_0x8cb1('0x1b')](_0x42546c['query'][_0x8cb1('0x1b')]);}_0x2a65ef[_0x8cb1('0x36')]=qs['sort'](_0x42546c[_0x8cb1('0x2f')][_0x8cb1('0x37')]);_0x2a65ef[_0x8cb1('0x38')]=qs[_0x8cb1('0x30')](_[_0x8cb1('0x39')](_0x42546c[_0x8cb1('0x2f')],_0x1e8300[_0x8cb1('0x30')]),_0x266352);if(_0x42546c['query'][_0x8cb1('0x3a')]){_0x2a65ef[_0x8cb1('0x38')]=_[_0x8cb1('0x3b')](_0x2a65ef[_0x8cb1('0x38')],{'$or':_[_0x8cb1('0x2a')](_0x266352,function(_0x21488e){if(_0x21488e[_0x8cb1('0x2e')]!=='VIRTUAL'){var _0x1fdb81={};_0x1fdb81[_0x21488e[_0x8cb1('0x27')]]={'$like':'%'+_0x42546c[_0x8cb1('0x2f')]['filter']+'%'};return _0x1fdb81;}})});}_0x2a65ef=_['merge']({},_0x2a65ef,_0x42546c[_0x8cb1('0x3c')]);var _0x1b97c0={'where':_0x2a65ef[_0x8cb1('0x38')]};return db[_0x8cb1('0x2b')][_0x8cb1('0x1c')](_0x1b97c0)[_0x8cb1('0x22')](function(_0x154ec7){_0x15133e[_0x8cb1('0x1c')]=_0x154ec7;if(_0x42546c[_0x8cb1('0x2f')][_0x8cb1('0x3d')]){_0x2a65ef[_0x8cb1('0x3e')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x2a65ef);})[_0x8cb1('0x22')](function(_0x1bd06c){_0x15133e['rows']=_0x1bd06c;return _0x15133e;})[_0x8cb1('0x22')](respondWithFilteredResult(_0x1f4808,_0x2a65ef))[_0x8cb1('0x3f')](handleError(_0x1f4808,null));};exports['show']=function(_0x163e36,_0x42183b){var _0x20030b={'raw':![],'where':{'id':_0x163e36[_0x8cb1('0x40')]['id']}},_0x3c9382={};_0x3c9382[_0x8cb1('0x32')]=_['keys'](db['Trigger'][_0x8cb1('0x2c')]);_0x3c9382[_0x8cb1('0x2f')]=_[_0x8cb1('0x41')](_0x163e36[_0x8cb1('0x2f')]);_0x3c9382[_0x8cb1('0x30')]=_['intersection'](_0x3c9382[_0x8cb1('0x32')],_0x3c9382['query']);_0x20030b[_0x8cb1('0x33')]=_[_0x8cb1('0x31')](_0x3c9382[_0x8cb1('0x32')],qs[_0x8cb1('0x34')](_0x163e36[_0x8cb1('0x2f')][_0x8cb1('0x34')]));_0x20030b[_0x8cb1('0x33')]=_0x20030b[_0x8cb1('0x33')][_0x8cb1('0x42')]?_0x20030b[_0x8cb1('0x33')]:_0x3c9382[_0x8cb1('0x32')];if(_0x163e36[_0x8cb1('0x2f')][_0x8cb1('0x3d')]){_0x20030b[_0x8cb1('0x3e')]=[{'all':!![]}];}_0x20030b=_['merge']({},_0x20030b,_0x163e36[_0x8cb1('0x3c')]);return db[_0x8cb1('0x2b')][_0x8cb1('0x43')](_0x20030b)[_0x8cb1('0x22')](handleEntityNotFound(_0x42183b,null))[_0x8cb1('0x22')](respondWithResult(_0x42183b,null))[_0x8cb1('0x3f')](handleError(_0x42183b,null));};exports[_0x8cb1('0x44')]=function(_0x2c1387,_0x31f15d){return db['Trigger'][_0x8cb1('0x44')](_0x2c1387[_0x8cb1('0x45')],{})[_0x8cb1('0x22')](function(_0x4673eb){var _0x4f10f6=_0x2c1387[_0x8cb1('0x46')]['get']({'plain':!![]});if(!_0x4f10f6)throw new Error(_0x8cb1('0x47'));if(_0x4f10f6[_0x8cb1('0x48')]==='user'){var _0x59547c=_0x4673eb[_0x8cb1('0x23')]({'plain':!![]});var _0x32fe46=_0x8cb1('0x24');return db[_0x8cb1('0x49')][_0x8cb1('0x43')]({'where':{'name':_0x32fe46,'userProfileId':_0x4f10f6['userProfileId']},'raw':!![]})[_0x8cb1('0x22')](function(_0x1d62c8){if(_0x1d62c8&&_0x1d62c8[_0x8cb1('0x4a')]===0x0){return db[_0x8cb1('0x4b')][_0x8cb1('0x44')]({'name':_0x59547c['name'],'resourceId':_0x59547c['id'],'type':_0x1d62c8[_0x8cb1('0x27')],'sectionId':_0x1d62c8['id']},{})[_0x8cb1('0x22')](function(){return _0x4673eb;});}else{return _0x4673eb;}})['catch'](function(_0x21d20f){logger[_0x8cb1('0x4c')](_0x8cb1('0x4d'),_0x21d20f);throw _0x21d20f;});}return _0x4673eb;})[_0x8cb1('0x22')](respondWithResult(_0x31f15d,0xc9))[_0x8cb1('0x3f')](handleError(_0x31f15d,null));};exports[_0x8cb1('0x4e')]=function(_0x6cef90,_0x3ba2cc){if(_0x6cef90[_0x8cb1('0x45')]['id']){delete _0x6cef90[_0x8cb1('0x45')]['id'];}return db['Trigger']['find']({'where':{'id':_0x6cef90[_0x8cb1('0x40')]['id']}})['then'](handleEntityNotFound(_0x3ba2cc,null))['then'](saveUpdates(_0x6cef90[_0x8cb1('0x45')],null))[_0x8cb1('0x22')](respondWithResult(_0x3ba2cc,null))['catch'](handleError(_0x3ba2cc,null));};exports[_0x8cb1('0x25')]=function(_0x477c25,_0x5e40c1){return db[_0x8cb1('0x2b')][_0x8cb1('0x43')]({'where':{'id':_0x477c25['params']['id']}})['then'](handleEntityNotFound(_0x5e40c1,null))[_0x8cb1('0x22')](removeEntity(_0x5e40c1,null))['catch'](handleError(_0x5e40c1,null));};exports[_0x8cb1('0x4f')]=function(_0x590b6c,_0x313465,_0x37f2b8){if(_0x590b6c[_0x8cb1('0x45')]['id']){delete _0x590b6c[_0x8cb1('0x45')]['id'];}return db[_0x8cb1('0x2b')][_0x8cb1('0x43')]({'where':{'id':_0x590b6c[_0x8cb1('0x40')]['id']}})[_0x8cb1('0x22')](handleEntityNotFound(_0x313465,null))[_0x8cb1('0x22')](function(_0x1bb024){if(_0x1bb024){_0x590b6c[_0x8cb1('0x45')][_0x8cb1('0x50')]=_0x1bb024['id'];return db[_0x8cb1('0x51')][_0x8cb1('0x44')](_0x590b6c[_0x8cb1('0x45')]);}})['then'](respondWithResult(_0x313465,null))[_0x8cb1('0x3f')](handleError(_0x313465,null));};exports[_0x8cb1('0x52')]=function(_0x586b36,_0x60db34,_0x100c82){if(_0x586b36[_0x8cb1('0x45')]['id']){delete _0x586b36[_0x8cb1('0x45')]['id'];}return db[_0x8cb1('0x2b')][_0x8cb1('0x43')]({'where':{'id':_0x586b36[_0x8cb1('0x40')]['id']}})[_0x8cb1('0x22')](handleEntityNotFound(_0x60db34,null))[_0x8cb1('0x22')](function(_0x141cb3){if(_0x141cb3){_0x586b36[_0x8cb1('0x45')][_0x8cb1('0x53')]=_0x141cb3['id'];return db['Condition'][_0x8cb1('0x44')](_0x586b36['body']);}})[_0x8cb1('0x22')](respondWithResult(_0x60db34,null))[_0x8cb1('0x3f')](handleError(_0x60db34,null));};exports[_0x8cb1('0x54')]=function(_0x488df0,_0x2d7d97,_0x58abf5){var _0x116ea8={};var _0x41ac9b={};var _0x4c606e;var _0x50b7c4;return db[_0x8cb1('0x2b')][_0x8cb1('0x55')]({'where':{'id':_0x488df0[_0x8cb1('0x40')]['id']}})[_0x8cb1('0x22')](handleEntityNotFound(_0x2d7d97,null))[_0x8cb1('0x22')](function(_0x445253){if(_0x445253){_0x4c606e=_0x445253;_0x41ac9b[_0x8cb1('0x32')]=_[_0x8cb1('0x41')](db['Condition'][_0x8cb1('0x2c')]);_0x41ac9b['query']=_[_0x8cb1('0x41')](_0x488df0[_0x8cb1('0x2f')]);_0x41ac9b['filters']=_['intersection'](_0x41ac9b['model'],_0x41ac9b[_0x8cb1('0x2f')]);_0x116ea8['attributes']=_['intersection'](_0x41ac9b[_0x8cb1('0x32')],qs[_0x8cb1('0x34')](_0x488df0['query'][_0x8cb1('0x34')]));_0x116ea8[_0x8cb1('0x33')]=_0x116ea8['attributes'][_0x8cb1('0x42')]?_0x116ea8[_0x8cb1('0x33')]:_0x41ac9b['model'];_0x116ea8[_0x8cb1('0x36')]=qs['sort'](_0x488df0[_0x8cb1('0x2f')][_0x8cb1('0x37')]);_0x116ea8[_0x8cb1('0x38')]=qs[_0x8cb1('0x30')](_['pick'](_0x488df0[_0x8cb1('0x2f')],_0x41ac9b[_0x8cb1('0x30')]));if(_0x488df0[_0x8cb1('0x2f')][_0x8cb1('0x3a')]){_0x116ea8[_0x8cb1('0x38')]=_[_0x8cb1('0x3b')](_0x116ea8[_0x8cb1('0x38')],{'$or':_[_0x8cb1('0x2a')](_0x116ea8[_0x8cb1('0x33')],function(_0x24b870){var _0xc967a6={};_0xc967a6[_0x24b870]={'$like':'%'+_0x488df0[_0x8cb1('0x2f')][_0x8cb1('0x3a')]+'%'};return _0xc967a6;})});}_0x116ea8=_['merge']({},_0x116ea8,_0x488df0['options']);return _0x4c606e['getAllConditions'](_0x116ea8);}})['then'](function(_0x37475e){if(_0x37475e){_0x50b7c4=_0x37475e['length'];if(!_0x488df0[_0x8cb1('0x2f')][_0x8cb1('0x56')](_0x8cb1('0x35'))){_0x116ea8['limit']=qs[_0x8cb1('0x1a')](_0x488df0[_0x8cb1('0x2f')]['limit']);_0x116ea8[_0x8cb1('0x1b')]=qs['offset'](_0x488df0[_0x8cb1('0x2f')]['offset']);}return _0x4c606e[_0x8cb1('0x54')](_0x116ea8);}})[_0x8cb1('0x22')](function(_0x27d735){if(_0x27d735){return _0x27d735?{'count':_0x50b7c4,'rows':_0x27d735}:null;}})[_0x8cb1('0x22')](respondWithResult(_0x2d7d97,null))[_0x8cb1('0x3f')](handleError(_0x2d7d97,null));};exports[_0x8cb1('0x57')]=function(_0x37d4ee,_0x433816,_0xd60352){var _0x2a45ac={};var _0x4ac961={};var _0x2e88c5;var _0xaae931;return db[_0x8cb1('0x2b')][_0x8cb1('0x55')]({'where':{'id':_0x37d4ee['params']['id']}})[_0x8cb1('0x22')](handleEntityNotFound(_0x433816,null))[_0x8cb1('0x22')](function(_0xde719a){if(_0xde719a){_0x2e88c5=_0xde719a;_0x4ac961[_0x8cb1('0x32')]=_[_0x8cb1('0x41')](db['Condition'][_0x8cb1('0x2c')]);_0x4ac961[_0x8cb1('0x2f')]=_[_0x8cb1('0x41')](_0x37d4ee[_0x8cb1('0x2f')]);_0x4ac961[_0x8cb1('0x30')]=_[_0x8cb1('0x31')](_0x4ac961[_0x8cb1('0x32')],_0x4ac961['query']);_0x2a45ac[_0x8cb1('0x33')]=_[_0x8cb1('0x31')](_0x4ac961[_0x8cb1('0x32')],qs[_0x8cb1('0x34')](_0x37d4ee['query']['fields']));_0x2a45ac[_0x8cb1('0x33')]=_0x2a45ac[_0x8cb1('0x33')][_0x8cb1('0x42')]?_0x2a45ac[_0x8cb1('0x33')]:_0x4ac961[_0x8cb1('0x32')];_0x2a45ac['order']=qs[_0x8cb1('0x37')](_0x37d4ee[_0x8cb1('0x2f')][_0x8cb1('0x37')]);_0x2a45ac['where']=qs[_0x8cb1('0x30')](_[_0x8cb1('0x39')](_0x37d4ee['query'],_0x4ac961[_0x8cb1('0x30')]));if(_0x37d4ee[_0x8cb1('0x2f')][_0x8cb1('0x3a')]){_0x2a45ac[_0x8cb1('0x38')]=_[_0x8cb1('0x3b')](_0x2a45ac[_0x8cb1('0x38')],{'$or':_['map'](_0x2a45ac[_0x8cb1('0x33')],function(_0x3e3b7a){var _0x1704a1={};_0x1704a1[_0x3e3b7a]={'$like':'%'+_0x37d4ee[_0x8cb1('0x2f')]['filter']+'%'};return _0x1704a1;})});}_0x2a45ac=_[_0x8cb1('0x3b')]({},_0x2a45ac,_0x37d4ee[_0x8cb1('0x3c')]);return _0x2e88c5['getAnyConditions'](_0x2a45ac);}})[_0x8cb1('0x22')](function(_0x5c68c4){if(_0x5c68c4){_0xaae931=_0x5c68c4[_0x8cb1('0x42')];if(!_0x37d4ee['query'][_0x8cb1('0x56')](_0x8cb1('0x35'))){_0x2a45ac[_0x8cb1('0x1a')]=qs[_0x8cb1('0x1a')](_0x37d4ee[_0x8cb1('0x2f')][_0x8cb1('0x1a')]);_0x2a45ac[_0x8cb1('0x1b')]=qs[_0x8cb1('0x1b')](_0x37d4ee[_0x8cb1('0x2f')][_0x8cb1('0x1b')]);}return _0x2e88c5['getAnyConditions'](_0x2a45ac);}})[_0x8cb1('0x22')](function(_0xd79f59){if(_0xd79f59){return _0xd79f59?{'count':_0xaae931,'rows':_0xd79f59}:null;}})['then'](respondWithResult(_0x433816,null))[_0x8cb1('0x3f')](handleError(_0x433816,null));};exports['addAction']=function(_0x1b26ae,_0x22f85b,_0x40fef4){if(_0x1b26ae[_0x8cb1('0x45')]['id']){delete _0x1b26ae['body']['id'];}return db[_0x8cb1('0x2b')][_0x8cb1('0x43')]({'where':{'id':_0x1b26ae['params']['id']}})[_0x8cb1('0x22')](handleEntityNotFound(_0x22f85b,null))[_0x8cb1('0x22')](function(_0x2b0ccd){if(_0x2b0ccd){_0x1b26ae[_0x8cb1('0x45')]['TriggerId']=_0x2b0ccd['id'];return db[_0x8cb1('0x58')][_0x8cb1('0x44')](_0x1b26ae['body']);}})[_0x8cb1('0x22')](respondWithResult(_0x22f85b,null))[_0x8cb1('0x3f')](handleError(_0x22f85b,null));};exports[_0x8cb1('0x59')]=function(_0x51a867,_0x290c52,_0x54ade1){var _0x5954a6={};var _0x53d66f={};var _0x37e657;var _0x445e5d;return db['Trigger'][_0x8cb1('0x55')]({'where':{'id':_0x51a867[_0x8cb1('0x40')]['id']}})['then'](handleEntityNotFound(_0x290c52,null))[_0x8cb1('0x22')](function(_0x4dff60){if(_0x4dff60){_0x37e657=_0x4dff60;_0x53d66f['model']=_[_0x8cb1('0x41')](db[_0x8cb1('0x58')][_0x8cb1('0x2c')]);_0x53d66f[_0x8cb1('0x2f')]=_[_0x8cb1('0x41')](_0x51a867[_0x8cb1('0x2f')]);_0x53d66f['filters']=_['intersection'](_0x53d66f['model'],_0x53d66f[_0x8cb1('0x2f')]);_0x5954a6[_0x8cb1('0x33')]=_[_0x8cb1('0x31')](_0x53d66f[_0x8cb1('0x32')],qs[_0x8cb1('0x34')](_0x51a867[_0x8cb1('0x2f')][_0x8cb1('0x34')]));_0x5954a6[_0x8cb1('0x33')]=_0x5954a6[_0x8cb1('0x33')][_0x8cb1('0x42')]?_0x5954a6[_0x8cb1('0x33')]:_0x53d66f[_0x8cb1('0x32')];_0x5954a6[_0x8cb1('0x36')]=qs[_0x8cb1('0x37')](_0x51a867['query'][_0x8cb1('0x37')]);_0x5954a6[_0x8cb1('0x38')]=qs[_0x8cb1('0x30')](_[_0x8cb1('0x39')](_0x51a867['query'],_0x53d66f['filters']));if(_0x51a867['query'][_0x8cb1('0x3a')]){_0x5954a6['where']=_[_0x8cb1('0x3b')](_0x5954a6[_0x8cb1('0x38')],{'$or':_[_0x8cb1('0x2a')](_0x5954a6[_0x8cb1('0x33')],function(_0x28cd29){var _0x3418dd={};_0x3418dd[_0x28cd29]={'$like':'%'+_0x51a867[_0x8cb1('0x2f')][_0x8cb1('0x3a')]+'%'};return _0x3418dd;})});}_0x5954a6=_[_0x8cb1('0x3b')]({},_0x5954a6,_0x51a867['options']);return _0x37e657[_0x8cb1('0x59')](_0x5954a6);}})[_0x8cb1('0x22')](function(_0x102823){if(_0x102823){_0x445e5d=_0x102823[_0x8cb1('0x42')];if(!_0x51a867[_0x8cb1('0x2f')][_0x8cb1('0x56')](_0x8cb1('0x35'))){_0x5954a6['limit']=qs[_0x8cb1('0x1a')](_0x51a867['query'][_0x8cb1('0x1a')]);_0x5954a6[_0x8cb1('0x1b')]=qs['offset'](_0x51a867[_0x8cb1('0x2f')]['offset']);}return _0x37e657[_0x8cb1('0x59')](_0x5954a6);}})[_0x8cb1('0x22')](function(_0x283593){if(_0x283593){return _0x283593?{'count':_0x445e5d,'rows':_0x283593}:null;}})[_0x8cb1('0x22')](respondWithResult(_0x290c52,null))[_0x8cb1('0x3f')](handleError(_0x290c52,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 29554be..7f9258c 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 _0x8b7c=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x8b7c,0x119));var _0xc8b7=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0x8b7c[_0x4b3f3e];return _0x921fc3;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4be6=['tools_triggers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x20a4ee,_0x5dfa9e){var _0x6fa7c=function(_0x287ffe){while(--_0x287ffe){_0x20a4ee['push'](_0x20a4ee['shift']());}};_0x6fa7c(++_0x5dfa9e);}(_0x4be6,0xb5));var _0x64be=function(_0x1171ca,_0xa4765){_0x1171ca=_0x1171ca-0x0;var _0x9c52fb=_0x4be6[_0x1171ca];return _0x9c52fb;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var logger=require(_0x64be('0x1'))(_0x64be('0x2'));var moment=require(_0x64be('0x3'));var BPromise=require(_0x64be('0x4'));var rp=require(_0x64be('0x5'));var fs=require('fs');var path=require(_0x64be('0x6'));var rimraf=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var attributes=require(_0x64be('0x9'));module['exports']=function(_0x131822,_0x2430e2){return _0x131822[_0x64be('0xa')]('Trigger',attributes,{'tableName':_0x64be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 32608df..3ef6856 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 _0x682f=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','Trigger','options','raw','where','attributes','limit','include','model','map','GetTrigger','stringify','catch','ShowTrigger','find','lodash'];(function(_0xc5b4b8,_0x5d3dcb){var _0x5e24d5=function(_0x3416c4){while(--_0x3416c4){_0xc5b4b8['push'](_0xc5b4b8['shift']());}};_0x5e24d5(++_0x5d3dcb);}(_0x682f,0x11f));var _0xf682=function(_0x17598f,_0x5a866a){_0x17598f=_0x17598f-0x0;var _0x2cef9c=_0x682f[_0x17598f];return _0x2cef9c;};'use strict';var _=require(_0xf682('0x0'));var util=require(_0xf682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf682('0x2'));var fs=require('fs');var Redis=require(_0xf682('0x3'));var db=require(_0xf682('0x4'))['db'];var utils=require(_0xf682('0x5'));var logger=require(_0xf682('0x6'))(_0xf682('0x7'));var config=require(_0xf682('0x8'));var jayson=require(_0xf682('0x9'));var client=jayson[_0xf682('0xa')][_0xf682('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c6985,_0x3f86b1,_0x23def6){return new BPromise(function(_0x1edaf6,_0x119baa){return client[_0xf682('0xc')](_0x3c6985,_0x23def6)[_0xf682('0xd')](function(_0x433af4){logger['info'](_0xf682('0xe'),_0x3f86b1,_0xf682('0xf'));logger[_0xf682('0x10')](_0xf682('0x11'),_0x3f86b1,_0xf682('0xf'),JSON['stringify'](_0x433af4));if(_0x433af4[_0xf682('0x12')]){if(_0x433af4[_0xf682('0x12')][_0xf682('0x13')]===0x1f4){logger[_0xf682('0x12')](_0xf682('0xe'),_0x3f86b1,_0x433af4[_0xf682('0x12')]['message']);return _0x119baa(_0x433af4[_0xf682('0x12')][_0xf682('0x14')]);}logger[_0xf682('0x12')]('Trigger,\x20%s,\x20%s',_0x3f86b1,_0x433af4['error'][_0xf682('0x14')]);return _0x1edaf6(_0x433af4[_0xf682('0x12')]['message']);}else{logger[_0xf682('0x15')](_0xf682('0xe'),_0x3f86b1,_0xf682('0xf'));_0x1edaf6(_0x433af4['result'][_0xf682('0x14')]);}})['catch'](function(_0x983597){logger['error']('Trigger,\x20%s,\x20%s',_0x3f86b1,_0x983597);_0x119baa(_0x983597);});});}exports['GetTrigger']=function(_0x37a681){var _0x92c789=this;return new Promise(function(_0x13a8dd,_0x462b56){return db[_0xf682('0x16')]['findAll']({'raw':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x18')]===undefined?!![]:![]:!![],'where':_0x37a681['options']?_0x37a681['options'][_0xf682('0x19')]||null:null,'attributes':_0x37a681['options']?_0x37a681[_0xf682('0x17')][_0xf682('0x1a')]||null:null,'limit':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x1b')]||null:null,'include':_0x37a681[_0xf682('0x17')]?_0x37a681[_0xf682('0x17')][_0xf682('0x1c')]?_['map'](_0x37a681[_0xf682('0x17')][_0xf682('0x1c')],function(_0x5dcfb9){return{'model':db[_0x5dcfb9[_0xf682('0x1d')]],'as':_0x5dcfb9['as'],'attributes':_0x5dcfb9[_0xf682('0x1a')],'include':_0x5dcfb9['include']?_['map'](_0x5dcfb9[_0xf682('0x1c')],function(_0x505249){return{'model':db[_0x505249[_0xf682('0x1d')]],'as':_0x505249['as'],'attributes':_0x505249[_0xf682('0x1a')],'include':_0x505249['include']?_[_0xf682('0x1e')](_0x505249[_0xf682('0x1c')],function(_0x218656){return{'model':db[_0x218656['model']],'as':_0x218656['as'],'attributes':_0x218656[_0xf682('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf682('0xd')](function(_0x1389fc){logger[_0xf682('0x15')](_0xf682('0x1f'),_0x37a681);logger[_0xf682('0x10')](_0xf682('0x1f'),_0x37a681,JSON[_0xf682('0x20')](_0x1389fc));_0x13a8dd(_0x1389fc);})[_0xf682('0x21')](function(_0x5c787f){logger[_0xf682('0x12')](_0xf682('0x1f'),_0x5c787f['message'],_0x37a681);_0x462b56(_0x92c789[_0xf682('0x12')](0x1f4,_0x5c787f['message']));});});};exports[_0xf682('0x22')]=function(_0x1f0059){var _0x43cf22=this;return new Promise(function(_0x1a44cd,_0x1b313a){return db['Trigger'][_0xf682('0x23')]({'raw':_0x1f0059[_0xf682('0x17')]?_0x1f0059[_0xf682('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f0059[_0xf682('0x17')]?_0x1f0059[_0xf682('0x17')]['where']||null:null,'attributes':_0x1f0059[_0xf682('0x17')]?_0x1f0059['options'][_0xf682('0x1a')]||null:null,'include':_0x1f0059['options']?_0x1f0059[_0xf682('0x17')][_0xf682('0x1c')]?_[_0xf682('0x1e')](_0x1f0059[_0xf682('0x17')]['include'],function(_0x579d5f){return{'model':db[_0x579d5f[_0xf682('0x1d')]],'as':_0x579d5f['as'],'attributes':_0x579d5f[_0xf682('0x1a')],'include':_0x579d5f['include']?_[_0xf682('0x1e')](_0x579d5f[_0xf682('0x1c')],function(_0x5c232e){return{'model':db[_0x5c232e[_0xf682('0x1d')]],'as':_0x5c232e['as'],'attributes':_0x5c232e[_0xf682('0x1a')],'include':_0x5c232e[_0xf682('0x1c')]?_[_0xf682('0x1e')](_0x5c232e[_0xf682('0x1c')],function(_0x466ec8){return{'model':db[_0x466ec8[_0xf682('0x1d')]],'as':_0x466ec8['as'],'attributes':_0x466ec8[_0xf682('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac41b){logger[_0xf682('0x15')](_0xf682('0x22'),_0x1f0059);logger[_0xf682('0x10')](_0xf682('0x22'),_0x1f0059,JSON[_0xf682('0x20')](_0x2ac41b));_0x1a44cd(_0x2ac41b);})[_0xf682('0x21')](function(_0x2e1735){logger[_0xf682('0x12')](_0xf682('0x22'),_0x2e1735['message'],_0x1f0059);_0x1b313a(_0x43cf22[_0xf682('0x12')](0x1f4,_0x2e1735[_0xf682('0x14')]));});});}; \ No newline at end of file +var _0xa597=['Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','attributes','limit','include','model','catch','ShowTrigger','find','raw','where','map','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc24008,_0x27bfa0){var _0x35b994=function(_0x10f9cb){while(--_0x10f9cb){_0xc24008['push'](_0xc24008['shift']());}};_0x35b994(++_0x27bfa0);}(_0xa597,0x159));var _0x7a59=function(_0x32c03f,_0x1553b0){_0x32c03f=_0x32c03f-0x0;var _0x181151=_0xa597[_0x32c03f];return _0x181151;};'use strict';var _=require('lodash');var util=require(_0x7a59('0x0'));var moment=require(_0x7a59('0x1'));var BPromise=require(_0x7a59('0x2'));var rs=require(_0x7a59('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a59('0x4'))['db'];var utils=require(_0x7a59('0x5'));var logger=require(_0x7a59('0x6'))(_0x7a59('0x7'));var config=require('../../config/environment');var jayson=require(_0x7a59('0x8'));var client=jayson[_0x7a59('0x9')][_0x7a59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4009ae,_0x45f19a,_0x11f517){return new BPromise(function(_0x2eb5f7,_0x2665fd){return client['request'](_0x4009ae,_0x11f517)[_0x7a59('0xb')](function(_0x41a528){logger['info'](_0x7a59('0xc'),_0x45f19a,_0x7a59('0xd'));logger[_0x7a59('0xe')](_0x7a59('0xf'),_0x45f19a,_0x7a59('0xd'),JSON[_0x7a59('0x10')](_0x41a528));if(_0x41a528[_0x7a59('0x11')]){if(_0x41a528[_0x7a59('0x11')][_0x7a59('0x12')]===0x1f4){logger[_0x7a59('0x11')]('Trigger,\x20%s,\x20%s',_0x45f19a,_0x41a528[_0x7a59('0x11')]['message']);return _0x2665fd(_0x41a528[_0x7a59('0x11')][_0x7a59('0x13')]);}logger[_0x7a59('0x11')](_0x7a59('0xc'),_0x45f19a,_0x41a528[_0x7a59('0x11')][_0x7a59('0x13')]);return _0x2eb5f7(_0x41a528['error'][_0x7a59('0x13')]);}else{logger['info'](_0x7a59('0xc'),_0x45f19a,'request\x20sent');_0x2eb5f7(_0x41a528[_0x7a59('0x14')]['message']);}})['catch'](function(_0x2d31b5){logger[_0x7a59('0x11')](_0x7a59('0xc'),_0x45f19a,_0x2d31b5);_0x2665fd(_0x2d31b5);});});}exports[_0x7a59('0x15')]=function(_0x4d2931){var _0x2dc6d0=this;return new Promise(function(_0x2deeee,_0x4db837){return db[_0x7a59('0x16')][_0x7a59('0x17')]({'raw':_0x4d2931[_0x7a59('0x18')]?_0x4d2931[_0x7a59('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d2931[_0x7a59('0x18')]?_0x4d2931[_0x7a59('0x18')]['where']||null:null,'attributes':_0x4d2931[_0x7a59('0x18')]?_0x4d2931[_0x7a59('0x18')][_0x7a59('0x19')]||null:null,'limit':_0x4d2931['options']?_0x4d2931[_0x7a59('0x18')][_0x7a59('0x1a')]||null:null,'include':_0x4d2931[_0x7a59('0x18')]?_0x4d2931[_0x7a59('0x18')][_0x7a59('0x1b')]?_['map'](_0x4d2931[_0x7a59('0x18')][_0x7a59('0x1b')],function(_0x59cf4d){return{'model':db[_0x59cf4d[_0x7a59('0x1c')]],'as':_0x59cf4d['as'],'attributes':_0x59cf4d[_0x7a59('0x19')],'include':_0x59cf4d[_0x7a59('0x1b')]?_['map'](_0x59cf4d[_0x7a59('0x1b')],function(_0x1b9185){return{'model':db[_0x1b9185[_0x7a59('0x1c')]],'as':_0x1b9185['as'],'attributes':_0x1b9185[_0x7a59('0x19')],'include':_0x1b9185['include']?_['map'](_0x1b9185[_0x7a59('0x1b')],function(_0x3de552){return{'model':db[_0x3de552[_0x7a59('0x1c')]],'as':_0x3de552['as'],'attributes':_0x3de552[_0x7a59('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7a59('0xb')](function(_0x5edce1){logger['info'](_0x7a59('0x15'),_0x4d2931);logger['debug'](_0x7a59('0x15'),_0x4d2931,JSON[_0x7a59('0x10')](_0x5edce1));_0x2deeee(_0x5edce1);})[_0x7a59('0x1d')](function(_0x3928df){logger[_0x7a59('0x11')](_0x7a59('0x15'),_0x3928df[_0x7a59('0x13')],_0x4d2931);_0x4db837(_0x2dc6d0[_0x7a59('0x11')](0x1f4,_0x3928df[_0x7a59('0x13')]));});});};exports[_0x7a59('0x1e')]=function(_0x3cafc3){var _0x256905=this;return new Promise(function(_0x35cc4a,_0x25b26f){return db[_0x7a59('0x16')][_0x7a59('0x1f')]({'raw':_0x3cafc3[_0x7a59('0x18')]?_0x3cafc3[_0x7a59('0x18')][_0x7a59('0x20')]===undefined?!![]:![]:!![],'where':_0x3cafc3[_0x7a59('0x18')]?_0x3cafc3[_0x7a59('0x18')][_0x7a59('0x21')]||null:null,'attributes':_0x3cafc3[_0x7a59('0x18')]?_0x3cafc3[_0x7a59('0x18')][_0x7a59('0x19')]||null:null,'include':_0x3cafc3['options']?_0x3cafc3[_0x7a59('0x18')]['include']?_[_0x7a59('0x22')](_0x3cafc3[_0x7a59('0x18')][_0x7a59('0x1b')],function(_0x407cad){return{'model':db[_0x407cad[_0x7a59('0x1c')]],'as':_0x407cad['as'],'attributes':_0x407cad['attributes'],'include':_0x407cad[_0x7a59('0x1b')]?_['map'](_0x407cad[_0x7a59('0x1b')],function(_0x167ac5){return{'model':db[_0x167ac5[_0x7a59('0x1c')]],'as':_0x167ac5['as'],'attributes':_0x167ac5[_0x7a59('0x19')],'include':_0x167ac5[_0x7a59('0x1b')]?_[_0x7a59('0x22')](_0x167ac5[_0x7a59('0x1b')],function(_0x580197){return{'model':db[_0x580197['model']],'as':_0x580197['as'],'attributes':_0x580197[_0x7a59('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7a59('0xb')](function(_0x12a6fc){logger[_0x7a59('0x23')](_0x7a59('0x1e'),_0x3cafc3);logger[_0x7a59('0xe')](_0x7a59('0x1e'),_0x3cafc3,JSON['stringify'](_0x12a6fc));_0x35cc4a(_0x12a6fc);})['catch'](function(_0x5e9c33){logger['error'](_0x7a59('0x1e'),_0x5e9c33['message'],_0x3cafc3);_0x25b26f(_0x256905[_0x7a59('0x11')](0x1f4,_0x5e9c33['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5e52f66..8005896 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 _0x9114=['put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','create'];(function(_0x34a7ca,_0x3e2363){var _0x2047f2=function(_0x40a989){while(--_0x40a989){_0x34a7ca['push'](_0x34a7ca['shift']());}};_0x2047f2(++_0x3e2363);}(_0x9114,0x17f));var _0x4911=function(_0x5533a3,_0x4325f8){_0x5533a3=_0x5533a3-0x0;var _0x29e227=_0x9114[_0x5533a3];return _0x29e227;};'use strict';var multer=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4911('0x2'));var router=express[_0x4911('0x3')]();var fs_extra=require(_0x4911('0x4'));var auth=require(_0x4911('0x5'));var interaction=require(_0x4911('0x6'));var config=require(_0x4911('0x7'));var controller=require(_0x4911('0x8'));router['get']('/',auth[_0x4911('0x9')](),controller[_0x4911('0xa')]);router[_0x4911('0xb')](_0x4911('0xc'),auth[_0x4911('0x9')](),controller['show']);router[_0x4911('0xd')](_0x4911('0xe'),auth[_0x4911('0x9')](),controller['clone']);router[_0x4911('0xd')]('/',auth[_0x4911('0x9')](),controller[_0x4911('0xf')]);router[_0x4911('0x10')]('/:id',auth[_0x4911('0x9')](),controller[_0x4911('0x11')]);router[_0x4911('0x12')](_0x4911('0xc'),auth[_0x4911('0x9')](),controller[_0x4911('0x13')]);module[_0x4911('0x14')]=router; \ No newline at end of file +var _0x0061=['../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ffde9,_0x4fabe6){var _0x1d3bd5=function(_0x3f96e1){while(--_0x3f96e1){_0x1ffde9['push'](_0x1ffde9['shift']());}};_0x1d3bd5(++_0x4fabe6);}(_0x0061,0x14d));var _0x1006=function(_0xf384db,_0x3ca3c2){_0xf384db=_0xf384db-0x0;var _0x1cc2a4=_0x0061[_0xf384db];return _0x1cc2a4;};'use strict';var multer=require(_0x1006('0x0'));var util=require('util');var path=require(_0x1006('0x1'));var timeout=require(_0x1006('0x2'));var express=require(_0x1006('0x3'));var router=express[_0x1006('0x4')]();var fs_extra=require(_0x1006('0x5'));var auth=require(_0x1006('0x6'));var interaction=require(_0x1006('0x7'));var config=require('../../config/environment');var controller=require(_0x1006('0x8'));router[_0x1006('0x9')]('/',auth[_0x1006('0xa')](),controller[_0x1006('0xb')]);router['get'](_0x1006('0xc'),auth[_0x1006('0xa')](),controller['show']);router[_0x1006('0xd')](_0x1006('0xe'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth[_0x1006('0xa')](),controller['create']);router[_0x1006('0xf')](_0x1006('0xc'),auth[_0x1006('0xa')](),controller[_0x1006('0x10')]);router[_0x1006('0x11')](_0x1006('0xc'),auth['isAuthenticated'](),controller[_0x1006('0x12')]);module[_0x1006('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 33532ca..de7e48d 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 _0x3541=['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\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','update,nonat','BOOLEAN','STRING','name','friend','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3541,0x108));var _0x1354=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3541[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1354('0x0')],'allowNull':![],'unique':_0x1354('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1354('0x2'),'user',_0x1354('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x5'),'ALLOWED_PASSED_SCREEN',_0x1354('0x6'),_0x1354('0x7'),_0x1354('0x8'),_0x1354('0x9'),_0x1354('0xa'),_0x1354('0xb'))},'deny':{'type':Sequelize[_0x1354('0x0')]},'permit':{'type':Sequelize[_0x1354('0x0')]},'secret':{'type':Sequelize[_0x1354('0x0')]},'md5secret':{'type':Sequelize[_0x1354('0x0')]},'remotesecret':{'type':Sequelize[_0x1354('0x0')]},'transport':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0xc'),'set':function(_0x39bc4c){this[_0x1354('0xd')]('transport',_0x39bc4c?_0x39bc4c[_0x1354('0xe')](','):null);},'get':function(){return this[_0x1354('0xf')]('transport')?this[_0x1354('0xf')](_0x1354('0x10'))[_0x1354('0x11')](','):null;},'comment':_0x1354('0x12')},'dtmfmode':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x13'),_0x1354('0x14'),'shortinfo','inband',_0x1354('0x15')),'defaultValue':_0x1354('0x13')},'directmedia':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x17'),_0x1354('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1354('0x0')]},'directmediadeny':{'type':Sequelize[_0x1354('0x0')]},'nat':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'force_rport,comedia','set':function(_0x4b77c1){this[_0x1354('0xd')]('nat',_0x4b77c1?_0x4b77c1[_0x1354('0xe')](','):null);},'get':function(){return this[_0x1354('0xf')](_0x1354('0x19'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0x1354('0x1a')},'callgroup':{'type':Sequelize[_0x1354('0x0')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x1354('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x1354('0x0')]},'language':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1354('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0x1b')},'allow':{'type':Sequelize[_0x1354('0x0')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x20e712){this[_0x1354('0xd')]('allow',_0x20e712?_0x20e712[_0x1354('0xe')](';'):_0x1354('0x1c'));},'get':function(){return this[_0x1354('0xf')]('allow')?this[_0x1354('0xf')](_0x1354('0x1d'))[_0x1354('0x11')](';'):null;},'comment':_0x1354('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no')},'insecure':{'type':Sequelize[_0x1354('0x0')],'defaultValue':_0x1354('0x1f'),'set':function(_0x423a34){this['setDataValue'](_0x1354('0x20'),_0x423a34?_0x423a34['join'](','):null);},'get':function(){return this['getDataValue'](_0x1354('0x20'))?this[_0x1354('0xf')](_0x1354('0x20'))[_0x1354('0x11')](','):null;},'comment':_0x1354('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x1354('0x23')](0xb)},'setvar':{'type':Sequelize[_0x1354('0x0')]},'callerid':{'type':Sequelize[_0x1354('0x0')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x1354('0x0')]},'callcounter':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':_0x1354('0x16')},'busylevel':{'type':Sequelize[_0x1354('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x1354('0x0')]},'template':{'type':Sequelize[_0x1354('0x0')]},'videosupport':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1354('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'mailbox':{'type':Sequelize[_0x1354('0x0')]},'session_timers':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x25'),_0x1354('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x1354('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x27'),_0x1354('0x28')),'defaultValue':_0x1354('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x1354('0x0')]},'regexten':{'type':Sequelize[_0x1354('0x0')]},'fromdomain':{'type':Sequelize[_0x1354('0x0')]},'fromuser':{'type':Sequelize[_0x1354('0x0')]},'port':{'type':Sequelize[_0x1354('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1354('0x0')]},'defaultuser':{'type':Sequelize[_0x1354('0x0')]},'rtptimeout':{'type':Sequelize[_0x1354('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1354('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x1354('0x4')]('yes','no',_0x1354('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1354('0x0')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x1354('0x23')](0xb)},'timerb':{'type':Sequelize[_0x1354('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1354('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x1354('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x1354('0x0')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x1354('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'icesupport':{'type':Sequelize[_0x1354('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x1354('0x4')]('yes','no',_0x1354('0x2a'),_0x1354('0x2b'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x1354('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x1354('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1354('0x0')]},'dtlscapath':{'type':Sequelize[_0x1354('0x0')]},'dtlssetup':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x2c'),'passive',_0x1354('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1354('0x0')]},'recordofffeature':{'type':Sequelize[_0x1354('0x0')]},'call_limit':{'type':Sequelize[_0x1354('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no')},'vmexten':{'type':Sequelize[_0x1354('0x0')]},'mohinterpret':{'type':Sequelize[_0x1354('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1354('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x1354('0x4')](_0x1354('0x16'),'no',_0x1354('0x17'),_0x1354('0x18'),_0x1354('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1354('0x0')]},'otherFields':{'type':Sequelize[_0x1354('0x0')]},'active':{'type':Sequelize[_0x1354('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x73f1=['rfc2833','shortinfo','inband','yes','nonat','update','outgoing','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x5a78a8,_0x3a54e7){var _0x2c8135=function(_0x2d0df7){while(--_0x2d0df7){_0x5a78a8['push'](_0x5a78a8['shift']());}};_0x2c8135(++_0x3a54e7);}(_0x73f1,0x193));var _0x173f=function(_0x2d073a,_0x1830ee){_0x2d073a=_0x2d073a-0x0;var _0x3a6e14=_0x73f1[_0x2d073a];return _0x3a6e14;};'use strict';var Sequelize=require('sequelize');module[_0x173f('0x0')]={'name':{'type':Sequelize[_0x173f('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x3'),_0x173f('0x4'),_0x173f('0x5')),'allowNull':![],'defaultValue':_0x173f('0x3')},'context':{'type':Sequelize[_0x173f('0x1')],'allowNull':![],'defaultValue':_0x173f('0x6')},'callingpres':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x7'),_0x173f('0x8'),_0x173f('0x9'),_0x173f('0xa'),_0x173f('0xb'),_0x173f('0xc'),_0x173f('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x173f('0x1')]},'permit':{'type':Sequelize[_0x173f('0x1')]},'secret':{'type':Sequelize[_0x173f('0x1')]},'md5secret':{'type':Sequelize[_0x173f('0x1')]},'remotesecret':{'type':Sequelize[_0x173f('0x1')]},'transport':{'type':Sequelize[_0x173f('0x1')],'defaultValue':_0x173f('0xe'),'set':function(_0x549b14){this[_0x173f('0xf')]('transport',_0x549b14?_0x549b14[_0x173f('0x10')](','):null);},'get':function(){return this[_0x173f('0x11')]('transport')?this[_0x173f('0x11')](_0x173f('0x12'))[_0x173f('0x13')](','):null;},'comment':_0x173f('0x14')},'dtmfmode':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x15'),'info',_0x173f('0x16'),_0x173f('0x17'),'auto'),'defaultValue':_0x173f('0x15')},'directmedia':{'type':Sequelize['ENUM'](_0x173f('0x18'),'no',_0x173f('0x19'),_0x173f('0x1a'),_0x173f('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x173f('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x173f('0x1')]},'directmediadeny':{'type':Sequelize[_0x173f('0x1')]},'nat':{'type':Sequelize[_0x173f('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x30fc27){this[_0x173f('0xf')](_0x173f('0x1c'),_0x30fc27?_0x30fc27[_0x173f('0x10')](','):null);},'get':function(){return this[_0x173f('0x11')](_0x173f('0x1c'))?this[_0x173f('0x11')]('nat')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x173f('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x173f('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x173f('0x1')]},'language':{'type':Sequelize[_0x173f('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x173f('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x173f('0x1d')},'allow':{'type':Sequelize[_0x173f('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x56d03c){this[_0x173f('0xf')](_0x173f('0x1e'),_0x56d03c?_0x56d03c[_0x173f('0x10')](';'):_0x173f('0x1f'));},'get':function(){return this['getDataValue'](_0x173f('0x1e'))?this[_0x173f('0x11')](_0x173f('0x1e'))[_0x173f('0x13')](';'):null;},'comment':_0x173f('0x20')},'autoframing':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'insecure':{'type':Sequelize[_0x173f('0x1')],'defaultValue':_0x173f('0x21'),'set':function(_0x51f525){this[_0x173f('0xf')](_0x173f('0x22'),_0x51f525?_0x51f525[_0x173f('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x173f('0x22'))?this[_0x173f('0x11')](_0x173f('0x22'))[_0x173f('0x13')](','):null;},'comment':_0x173f('0x23')},'trustrpid':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x173f('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no',_0x173f('0x24'))},'promiscredir':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'accountcode':{'type':Sequelize[_0x173f('0x25')](0xb)},'setvar':{'type':Sequelize[_0x173f('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x173f('0x26')},'amaflags':{'type':Sequelize[_0x173f('0x1')]},'callcounter':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x173f('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x173f('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x173f('0x1')]},'template':{'type':Sequelize[_0x173f('0x1')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x173f('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x173f('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'mailbox':{'type':Sequelize[_0x173f('0x1')]},'session_timers':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x28'),_0x173f('0x29'),_0x173f('0x2a'))},'session_expires':{'type':Sequelize[_0x173f('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x173f('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x2b'),_0x173f('0x2c')),'defaultValue':_0x173f('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x173f('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x173f('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x173f('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x173f('0x18'),'no'),'defaultValue':_0x173f('0x18')},'keepalive':{'type':Sequelize[_0x173f('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x173f('0x1')]},'rtptimeout':{'type':Sequelize[_0x173f('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no',_0x173f('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x173f('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x173f('0x25')](0xb)},'timerb':{'type':Sequelize[_0x173f('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x173f('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x173f('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x173f('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x173f('0x1')]},'use_q850_reason':{'type':Sequelize[_0x173f('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x173f('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x173f('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'icesupport':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x173f('0x2')]('yes','no',_0x173f('0x2e'),_0x173f('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x173f('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x173f('0x1')]},'dtlscipher':{'type':Sequelize[_0x173f('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x30'),'passive',_0x173f('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x173f('0x1')]},'recordofffeature':{'type':Sequelize[_0x173f('0x1')]},'call_limit':{'type':Sequelize[_0x173f('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x173f('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x173f('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x173f('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x173f('0x1')]},'parkinglot':{'type':Sequelize[_0x173f('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x173f('0x32')},'canreinvite':{'type':Sequelize[_0x173f('0x2')](_0x173f('0x18'),'no',_0x173f('0x19'),_0x173f('0x1a'),_0x173f('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x173f('0x1')]},'otherFields':{'type':Sequelize[_0x173f('0x1')]},'active':{'type':Sequelize[_0x173f('0x34')],'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 0c4a7bf..04f3940 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 _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','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','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x81bd,0x7c));var _0xd81b=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x81bd[_0xf1b134];return _0x139dbb;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x39f679,_0x1095a9){var _0x28a9f8=function(_0x122a5b){while(--_0x122a5b){_0x39f679['push'](_0x39f679['shift']());}};_0x28a9f8(++_0x1095a9);}(_0x54ef,0x112));var _0xf54e=function(_0x2ebc88,_0x2e4984){_0x2ebc88=_0x2ebc88-0x0;var _0x4e101f=_0x54ef[_0x2ebc88];return _0x4e101f;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0ce7313..6c50113 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 _0x9c0e=['Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x486008,_0x2b2d05){var _0x2fefc7=function(_0x4177fe){while(--_0x4177fe){_0x486008['push'](_0x486008['shift']());}};_0x2fefc7(++_0x2b2d05);}(_0x9c0e,0xf2));var _0xe9c0=function(_0x463311,_0x6247f0){_0x463311=_0x463311-0x0;var _0x34048f=_0x9c0e[_0x463311];return _0x34048f;};'use strict';var _=require('lodash');var util=require(_0xe9c0('0x0'));var logger=require(_0xe9c0('0x1'))(_0xe9c0('0x2'));var moment=require(_0xe9c0('0x3'));var BPromise=require(_0xe9c0('0x4'));var rp=require(_0xe9c0('0x5'));var fs=require('fs');var path=require(_0xe9c0('0x6'));var rimraf=require(_0xe9c0('0x7'));var config=require(_0xe9c0('0x8'));var attributes=require(_0xe9c0('0x9'));module['exports']=function(_0x5ee5fa,_0x59d499){return _0x5ee5fa['define'](_0xe9c0('0xa'),attributes,{'tableName':_0xe9c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8475=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','../../config/logger','api','moment'];(function(_0x216788,_0x3e15b7){var _0x252dc4=function(_0x350b8e){while(--_0x350b8e){_0x216788['push'](_0x216788['shift']());}};_0x252dc4(++_0x3e15b7);}(_0x8475,0xa4));var _0x5847=function(_0x4fa04c,_0x56dcb6){_0x4fa04c=_0x4fa04c-0x0;var _0x316e00=_0x8475[_0x4fa04c];return _0x316e00;};'use strict';var _=require(_0x5847('0x0'));var util=require(_0x5847('0x1'));var logger=require(_0x5847('0x2'))(_0x5847('0x3'));var moment=require(_0x5847('0x4'));var BPromise=require('bluebird');var rp=require(_0x5847('0x5'));var fs=require('fs');var path=require(_0x5847('0x6'));var rimraf=require(_0x5847('0x7'));var config=require(_0x5847('0x8'));var attributes=require(_0x5847('0x9'));module[_0x5847('0xa')]=function(_0x442554,_0x1ec505){return _0x442554[_0x5847('0xb')](_0x5847('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 3c31050..4c5e7ea 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 _0xb982=['catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrunk','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x32f185,_0x433de6){var _0x35efad=function(_0x3be548){while(--_0x3be548){_0x32f185['push'](_0x32f185['shift']());}};_0x35efad(++_0x433de6);}(_0xb982,0x117));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b98('0x0'));var util=require(_0x2b98('0x1'));var moment=require(_0x2b98('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b98('0x3'));var db=require(_0x2b98('0x4'))['db'];var utils=require(_0x2b98('0x5'));var logger=require(_0x2b98('0x6'))(_0x2b98('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b98('0x8'));var client=jayson[_0x2b98('0x9')][_0x2b98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cef9f,_0x1331f,_0x54a066){return new BPromise(function(_0x5c5066,_0x5a951f){return client['request'](_0x2cef9f,_0x54a066)['then'](function(_0x4ee0c3){logger[_0x2b98('0xb')](_0x2b98('0xc'),_0x1331f,'request\x20sent');logger[_0x2b98('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1331f,'request\x20sent',JSON[_0x2b98('0xe')](_0x4ee0c3));if(_0x4ee0c3[_0x2b98('0xf')]){if(_0x4ee0c3['error'][_0x2b98('0x10')]===0x1f4){logger[_0x2b98('0xf')](_0x2b98('0xc'),_0x1331f,_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);return _0x5a951f(_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);}logger[_0x2b98('0xf')]('Trunk,\x20%s,\x20%s',_0x1331f,_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);return _0x5c5066(_0x4ee0c3[_0x2b98('0xf')][_0x2b98('0x11')]);}else{logger[_0x2b98('0xb')](_0x2b98('0xc'),_0x1331f,'request\x20sent');_0x5c5066(_0x4ee0c3['result'][_0x2b98('0x11')]);}})[_0x2b98('0x12')](function(_0xdf1ff6){logger[_0x2b98('0xf')](_0x2b98('0xc'),_0x1331f,_0xdf1ff6);_0x5a951f(_0xdf1ff6);});});}exports[_0x2b98('0x13')]=function(_0xa6b639){var _0x57f665=this;return new Promise(function(_0x3bc0c9,_0x53a9c7){return db[_0x2b98('0x14')][_0x2b98('0x15')]({'raw':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x17')]===undefined?!![]:![]:!![],'where':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x18')]||null:null,'attributes':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x19')]||null:null,'limit':_0xa6b639['options']?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1a')]||null:null,'include':_0xa6b639[_0x2b98('0x16')]?_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0xa6b639[_0x2b98('0x16')][_0x2b98('0x1b')],function(_0x22933a){return{'model':db[_0x22933a[_0x2b98('0x1d')]],'as':_0x22933a['as'],'attributes':_0x22933a['attributes'],'include':_0x22933a[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x22933a['include'],function(_0x4cd503){return{'model':db[_0x4cd503[_0x2b98('0x1d')]],'as':_0x4cd503['as'],'attributes':_0x4cd503['attributes'],'include':_0x4cd503[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x4cd503['include'],function(_0x446e4d){return{'model':db[_0x446e4d[_0x2b98('0x1d')]],'as':_0x446e4d['as'],'attributes':_0x446e4d[_0x2b98('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2b98('0x1e')](function(_0x2c2490){logger[_0x2b98('0xb')](_0x2b98('0x13'),_0xa6b639);logger[_0x2b98('0xd')]('GetTrunk',_0xa6b639,JSON[_0x2b98('0xe')](_0x2c2490));_0x3bc0c9(_0x2c2490);})[_0x2b98('0x12')](function(_0x5050d0){logger[_0x2b98('0xf')]('GetTrunk',_0x5050d0[_0x2b98('0x11')],_0xa6b639);_0x53a9c7(_0x57f665[_0x2b98('0xf')](0x1f4,_0x5050d0['message']));});});};exports[_0x2b98('0x1f')]=function(_0x257d3d){var _0x4c5f88=this;return new Promise(function(_0x36009d,_0x403790){return db[_0x2b98('0x14')][_0x2b98('0x20')]({'raw':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x18')]||null:null,'attributes':_0x257d3d['options']?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x19')]||null:null,'include':_0x257d3d[_0x2b98('0x16')]?_0x257d3d[_0x2b98('0x16')][_0x2b98('0x1b')]?_['map'](_0x257d3d['options']['include'],function(_0x4ee90f){return{'model':db[_0x4ee90f['model']],'as':_0x4ee90f['as'],'attributes':_0x4ee90f[_0x2b98('0x19')],'include':_0x4ee90f[_0x2b98('0x1b')]?_['map'](_0x4ee90f['include'],function(_0x4991a9){return{'model':db[_0x4991a9[_0x2b98('0x1d')]],'as':_0x4991a9['as'],'attributes':_0x4991a9[_0x2b98('0x19')],'include':_0x4991a9[_0x2b98('0x1b')]?_[_0x2b98('0x1c')](_0x4991a9[_0x2b98('0x1b')],function(_0x226bec){return{'model':db[_0x226bec[_0x2b98('0x1d')]],'as':_0x226bec['as'],'attributes':_0x226bec[_0x2b98('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x386341){logger[_0x2b98('0xb')](_0x2b98('0x1f'),_0x257d3d);logger[_0x2b98('0xd')](_0x2b98('0x1f'),_0x257d3d,JSON[_0x2b98('0xe')](_0x386341));_0x36009d(_0x386341);})[_0x2b98('0x12')](function(_0x5346e6){logger[_0x2b98('0xf')](_0x2b98('0x1f'),_0x5346e6[_0x2b98('0x11')],_0x257d3d);_0x403790(_0x4c5f88[_0x2b98('0xf')](0x1f4,_0x5346e6[_0x2b98('0x11')]));});});}; \ No newline at end of file +var _0xf1e1=['request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x31fe33,_0x595585){var _0xc7a418=function(_0x11f062){while(--_0x11f062){_0x31fe33['push'](_0x31fe33['shift']());}};_0xc7a418(++_0x595585);}(_0xf1e1,0x1c8));var _0x1f1e=function(_0x4bbaba,_0x15097c){_0x4bbaba=_0x4bbaba-0x0;var _0x34ff2b=_0xf1e1[_0x4bbaba];return _0x34ff2b;};'use strict';var _=require(_0x1f1e('0x0'));var util=require(_0x1f1e('0x1'));var moment=require(_0x1f1e('0x2'));var BPromise=require(_0x1f1e('0x3'));var rs=require(_0x1f1e('0x4'));var fs=require('fs');var Redis=require(_0x1f1e('0x5'));var db=require(_0x1f1e('0x6'))['db'];var utils=require(_0x1f1e('0x7'));var logger=require('../../config/logger')(_0x1f1e('0x8'));var config=require(_0x1f1e('0x9'));var jayson=require(_0x1f1e('0xa'));var client=jayson[_0x1f1e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d8178,_0x1224b5,_0x4767ee){return new BPromise(function(_0x4feb59,_0x225c6d){return client[_0x1f1e('0xc')](_0x4d8178,_0x4767ee)[_0x1f1e('0xd')](function(_0x316325){logger['info'](_0x1f1e('0xe'),_0x1224b5,_0x1f1e('0xf'));logger[_0x1f1e('0x10')](_0x1f1e('0x11'),_0x1224b5,'request\x20sent',JSON[_0x1f1e('0x12')](_0x316325));if(_0x316325[_0x1f1e('0x13')]){if(_0x316325[_0x1f1e('0x13')]['code']===0x1f4){logger[_0x1f1e('0x13')](_0x1f1e('0xe'),_0x1224b5,_0x316325[_0x1f1e('0x13')][_0x1f1e('0x14')]);return _0x225c6d(_0x316325[_0x1f1e('0x13')]['message']);}logger[_0x1f1e('0x13')]('Trunk,\x20%s,\x20%s',_0x1224b5,_0x316325[_0x1f1e('0x13')][_0x1f1e('0x14')]);return _0x4feb59(_0x316325[_0x1f1e('0x13')]['message']);}else{logger['info'](_0x1f1e('0xe'),_0x1224b5,'request\x20sent');_0x4feb59(_0x316325['result'][_0x1f1e('0x14')]);}})[_0x1f1e('0x15')](function(_0x44435d){logger[_0x1f1e('0x13')](_0x1f1e('0xe'),_0x1224b5,_0x44435d);_0x225c6d(_0x44435d);});});}exports[_0x1f1e('0x16')]=function(_0xd1b39a){var _0x4c0dc3=this;return new Promise(function(_0x10fee0,_0xa73002){return db[_0x1f1e('0x17')][_0x1f1e('0x18')]({'raw':_0xd1b39a['options']?_0xd1b39a[_0x1f1e('0x19')][_0x1f1e('0x1a')]===undefined?!![]:![]:!![],'where':_0xd1b39a[_0x1f1e('0x19')]?_0xd1b39a['options'][_0x1f1e('0x1b')]||null:null,'attributes':_0xd1b39a[_0x1f1e('0x19')]?_0xd1b39a['options'][_0x1f1e('0x1c')]||null:null,'limit':_0xd1b39a[_0x1f1e('0x19')]?_0xd1b39a['options'][_0x1f1e('0x1d')]||null:null,'include':_0xd1b39a[_0x1f1e('0x19')]?_0xd1b39a[_0x1f1e('0x19')][_0x1f1e('0x1e')]?_[_0x1f1e('0x1f')](_0xd1b39a[_0x1f1e('0x19')][_0x1f1e('0x1e')],function(_0x204a45){return{'model':db[_0x204a45[_0x1f1e('0x20')]],'as':_0x204a45['as'],'attributes':_0x204a45[_0x1f1e('0x1c')],'include':_0x204a45['include']?_[_0x1f1e('0x1f')](_0x204a45[_0x1f1e('0x1e')],function(_0x46d892){return{'model':db[_0x46d892[_0x1f1e('0x20')]],'as':_0x46d892['as'],'attributes':_0x46d892[_0x1f1e('0x1c')],'include':_0x46d892[_0x1f1e('0x1e')]?_[_0x1f1e('0x1f')](_0x46d892[_0x1f1e('0x1e')],function(_0x98577e){return{'model':db[_0x98577e['model']],'as':_0x98577e['as'],'attributes':_0x98577e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c9074){logger[_0x1f1e('0x21')](_0x1f1e('0x16'),_0xd1b39a);logger[_0x1f1e('0x10')](_0x1f1e('0x16'),_0xd1b39a,JSON['stringify'](_0x2c9074));_0x10fee0(_0x2c9074);})[_0x1f1e('0x15')](function(_0xbfa9c8){logger[_0x1f1e('0x13')](_0x1f1e('0x16'),_0xbfa9c8[_0x1f1e('0x14')],_0xd1b39a);_0xa73002(_0x4c0dc3[_0x1f1e('0x13')](0x1f4,_0xbfa9c8['message']));});});};exports[_0x1f1e('0x22')]=function(_0x2fdafb){var _0x831ea0=this;return new Promise(function(_0x25e008,_0x4620d0){return db[_0x1f1e('0x17')][_0x1f1e('0x23')]({'raw':_0x2fdafb[_0x1f1e('0x19')]?_0x2fdafb[_0x1f1e('0x19')][_0x1f1e('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fdafb[_0x1f1e('0x19')]?_0x2fdafb['options']['where']||null:null,'attributes':_0x2fdafb[_0x1f1e('0x19')]?_0x2fdafb['options']['attributes']||null:null,'include':_0x2fdafb[_0x1f1e('0x19')]?_0x2fdafb[_0x1f1e('0x19')][_0x1f1e('0x1e')]?_[_0x1f1e('0x1f')](_0x2fdafb[_0x1f1e('0x19')][_0x1f1e('0x1e')],function(_0x2eb23c){return{'model':db[_0x2eb23c['model']],'as':_0x2eb23c['as'],'attributes':_0x2eb23c[_0x1f1e('0x1c')],'include':_0x2eb23c['include']?_['map'](_0x2eb23c[_0x1f1e('0x1e')],function(_0x3ad4c4){return{'model':db[_0x3ad4c4[_0x1f1e('0x20')]],'as':_0x3ad4c4['as'],'attributes':_0x3ad4c4[_0x1f1e('0x1c')],'include':_0x3ad4c4[_0x1f1e('0x1e')]?_[_0x1f1e('0x1f')](_0x3ad4c4['include'],function(_0x487321){return{'model':db[_0x487321[_0x1f1e('0x20')]],'as':_0x487321['as'],'attributes':_0x487321[_0x1f1e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1f1e('0xd')](function(_0x562900){logger['info'](_0x1f1e('0x22'),_0x2fdafb);logger[_0x1f1e('0x10')](_0x1f1e('0x22'),_0x2fdafb,JSON[_0x1f1e('0x12')](_0x562900));_0x25e008(_0x562900);})['catch'](function(_0x1bbbdc){logger[_0x1f1e('0x13')](_0x1f1e('0x22'),_0x1bbbdc['message'],_0x2fdafb);_0x4620d0(_0x831ea0[_0x1f1e('0x13')](0x1f4,_0x1bbbdc[_0x1f1e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index bf379ac..fedecda 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 _0x32c6=['put','/:id','isAuthenticated','update','Router','../../components/auth/service','./user-setting.controller'];(function(_0x4e9f49,_0x5a4a6b){var _0x167d58=function(_0x28d09c){while(--_0x28d09c){_0x4e9f49['push'](_0x4e9f49['shift']());}};_0x167d58(++_0x5a4a6b);}(_0x32c6,0x1ee));var _0x632c=function(_0x1fb802,_0x2aa9e9){_0x1fb802=_0x1fb802-0x0;var _0x34205b=_0x32c6[_0x1fb802];return _0x34205b;};'use strict';var express=require('express');var router=express[_0x632c('0x0')]();var auth=require(_0x632c('0x1'));var controller=require(_0x632c('0x2'));router[_0x632c('0x3')](_0x632c('0x4'),auth[_0x632c('0x5')](),controller[_0x632c('0x6')]);module['exports']=router; \ No newline at end of file +var _0xf527=['./user-setting.controller','put','/:id','update','Router'];(function(_0xda83bd,_0x4ba2f7){var _0x401361=function(_0x498da4){while(--_0x498da4){_0xda83bd['push'](_0xda83bd['shift']());}};_0x401361(++_0x4ba2f7);}(_0xf527,0x1e4));var _0x7f52=function(_0x1180d3,_0x7161b5){_0x1180d3=_0x1180d3-0x0;var _0x1500c8=_0xf527[_0x1180d3];return _0x1500c8;};'use strict';var express=require('express');var router=express[_0x7f52('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x7f52('0x1'));router[_0x7f52('0x2')](_0x7f52('0x3'),auth['isAuthenticated'](),controller[_0x7f52('0x4')]);module['exports']=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 00221a2..6e723ea 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 _0xe248=['UserId','info','debug','exports','error','TEXT','DATE','INTEGER'];(function(_0x39ecf1,_0x5191bc){var _0x354e58=function(_0x3aff48){while(--_0x3aff48){_0x39ecf1['push'](_0x39ecf1['shift']());}};_0x354e58(++_0x5191bc);}(_0xe248,0x79));var _0x8e24=function(_0x1daf58,_0x5254fc){_0x1daf58=_0x1daf58-0x0;var _0x237a3c=_0xe248[_0x1daf58];return _0x237a3c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x8e24('0x0'),_0x8e24('0x1')];module[_0x8e24('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8e24('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8e24('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8e24('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8e24('0x6')],'unique':_0x8e24('0x7')}}; \ No newline at end of file +var _0x978d=['ENUM','BOOLEAN','TEXT','DATE','UserId','sequelize','error','info','debug','exports'];(function(_0x518d82,_0x218926){var _0x583393=function(_0x2588cd){while(--_0x2588cd){_0x518d82['push'](_0x518d82['shift']());}};_0x583393(++_0x218926);}(_0x978d,0x73));var _0xd978=function(_0x5c367c,_0x47e238){_0x5c367c=_0x5c367c-0x0;var _0x3a1cf3=_0x978d[_0x5c367c];return _0x3a1cf3;};'use strict';var Sequelize=require(_0xd978('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd978('0x1'),'warning',_0xd978('0x2'),_0xd978('0x3')];module[_0xd978('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd978('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd978('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd978('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd978('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd978('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xd978('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 3545821..fcd0897 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 _0xde64=['then','sendStatus','error','name','update','user','admin','Unauthorized','params','UserSetting','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','status','json'];(function(_0x34b915,_0x1c466d){var _0x5b8701=function(_0x8aa7f2){while(--_0x8aa7f2){_0x34b915['push'](_0x34b915['shift']());}};_0x5b8701(++_0x1c466d);}(_0xde64,0x17c));var _0x4de6=function(_0x34808f,_0x45d902){_0x34808f=_0x34808f-0x0;var _0x588415=_0xde64[_0x34808f];return _0x588415;};'use strict';var _=require(_0x4de6('0x0'));var Redis=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var config=require(_0x4de6('0x4'));var db=require(_0x4de6('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x4de6('0x6')]));require(_0x4de6('0x7'))['register'](socket);config['redis']=_[_0x4de6('0x8')](config[_0x4de6('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x568496,_0x24edef){_0x24edef=_0x24edef||0xc8;return function(_0x35ae72){if(_0x35ae72){return _0x568496[_0x4de6('0x9')](_0x24edef)[_0x4de6('0xa')](_0x35ae72);}};}function saveUpdates(_0x34f7a4){return function(_0x202cdc){if(_0x202cdc){return _0x202cdc['update'](_0x34f7a4)[_0x4de6('0xb')](function(_0x45329b){return _0x45329b;});}return null;};}function handleEntityNotFound(_0x1dbeed){return function(_0x4885e3){if(!_0x4885e3){_0x1dbeed[_0x4de6('0xc')](0x194);}return _0x4885e3;};}function handleError(_0x170183,_0x2e205b){_0x2e205b=_0x2e205b||0x1f4;return function(_0x36f8d4){logger[_0x4de6('0xd')](_0x36f8d4['stack']);if(_0x36f8d4[_0x4de6('0xe')]){delete _0x36f8d4[_0x4de6('0xe')];}_0x170183[_0x4de6('0x9')](_0x2e205b)['send'](_0x36f8d4);};}exports[_0x4de6('0xf')]=function(_0x216a84,_0x27c108){if(_0x216a84[_0x4de6('0x10')]['role']!==_0x4de6('0x11'))throw new Error(_0x4de6('0x12'));if(isNaN(Number(_0x216a84[_0x4de6('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x4de6('0x14')]['find']({'where':{'id':_0x216a84['params']['id']}})[_0x4de6('0xb')](handleEntityNotFound(_0x27c108,null))[_0x4de6('0xb')](saveUpdates(_0x216a84[_0x4de6('0x15')],null))[_0x4de6('0xb')](respondWithResult(_0x27c108,null))[_0x4de6('0x16')](handleError(_0x27c108,null));}; \ No newline at end of file +var _0x9cff=['Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find','params','body','catch','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','status','json','update','then','error','name','user','role','admin'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9cff,0x1b0));var _0xf9cf=function(_0xe21946,_0x1c3991){_0xe21946=_0xe21946-0x0;var _0x10c84b=_0x9cff[_0xe21946];return _0x10c84b;};'use strict';var _=require('lodash');var Redis=require(_0xf9cf('0x0'));var logger=require(_0xf9cf('0x1'))(_0xf9cf('0x2'));var config=require('../../config/environment');var db=require(_0xf9cf('0x3'))['db'];var socket=require(_0xf9cf('0x4'))(new Redis(config[_0xf9cf('0x5')]));require('./user-setting.socket')[_0xf9cf('0x6')](socket);config[_0xf9cf('0x5')]=_[_0xf9cf('0x7')](config[_0xf9cf('0x5')],{'host':_0xf9cf('0x8'),'port':0x18eb});function respondWithResult(_0x27e2b1,_0x3d0aa9){_0x3d0aa9=_0x3d0aa9||0xc8;return function(_0x19d7f9){if(_0x19d7f9){return _0x27e2b1[_0xf9cf('0x9')](_0x3d0aa9)[_0xf9cf('0xa')](_0x19d7f9);}};}function saveUpdates(_0x285982){return function(_0x49bd9b){if(_0x49bd9b){return _0x49bd9b[_0xf9cf('0xb')](_0x285982)[_0xf9cf('0xc')](function(_0x59e86c){return _0x59e86c;});}return null;};}function handleEntityNotFound(_0x41bb03){return function(_0x4ecca5){if(!_0x4ecca5){_0x41bb03['sendStatus'](0x194);}return _0x4ecca5;};}function handleError(_0x3820b4,_0x18a2f8){_0x18a2f8=_0x18a2f8||0x1f4;return function(_0x491a3a){logger[_0xf9cf('0xd')](_0x491a3a['stack']);if(_0x491a3a[_0xf9cf('0xe')]){delete _0x491a3a['name'];}_0x3820b4[_0xf9cf('0x9')](_0x18a2f8)['send'](_0x491a3a);};}exports[_0xf9cf('0xb')]=function(_0x1f1e0b,_0x73c07){if(_0x1f1e0b[_0xf9cf('0xf')][_0xf9cf('0x10')]!==_0xf9cf('0x11'))throw new Error(_0xf9cf('0x12'));if(isNaN(Number(_0x1f1e0b['params']['id'])))throw new Error(_0xf9cf('0x13'));return db[_0xf9cf('0x14')][_0xf9cf('0x15')]({'where':{'id':_0x1f1e0b[_0xf9cf('0x16')]['id']}})[_0xf9cf('0xc')](handleEntityNotFound(_0x73c07,null))[_0xf9cf('0xc')](saveUpdates(_0x1f1e0b[_0xf9cf('0x17')],null))[_0xf9cf('0xc')](respondWithResult(_0x73c07,null))[_0xf9cf('0x18')](handleError(_0x73c07,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 fcc3dad..6006237 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 _0x5dfa=['UserSetting','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x621382,_0x12b926){var _0x54a195=function(_0x472e9e){while(--_0x472e9e){_0x621382['push'](_0x621382['shift']());}};_0x54a195(++_0x12b926);}(_0x5dfa,0x85));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa5df('0x0'));var UserSetting=require(_0xa5df('0x1'))['db'][_0xa5df('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa5df('0x3'),'afterUpdate':_0xa5df('0x4'),'afterDestroy':_0xa5df('0x5')};function emitEvent(_0x320e21){return function(_0x596a98,_0x4444a5,_0xfdea5b){UserSettingEvents[_0xa5df('0x6')](_0x320e21+':'+_0x596a98['id'],_0x596a98);UserSettingEvents[_0xa5df('0x6')](_0x320e21,_0x596a98);_0xfdea5b(null);};}for(var e in events){if(events[_0xa5df('0x7')](e)){var event=events[e];UserSetting[_0xa5df('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xd373=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xd373,0x192));var _0x3d37=function(_0x1a54a7,_0x533f6a){_0x1a54a7=_0x1a54a7-0x0;var _0x5945d5=_0xd373[_0x1a54a7];return _0x5945d5;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x3d37('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x3d37('0x1')](0x0);var events={'afterCreate':_0x3d37('0x2'),'afterUpdate':_0x3d37('0x3'),'afterDestroy':_0x3d37('0x4')};function emitEvent(_0x38b016){return function(_0x51da20,_0x354cb8,_0x36ef7a){UserSettingEvents[_0x3d37('0x5')](_0x38b016+':'+_0x51da20['id'],_0x51da20);UserSettingEvents['emit'](_0x38b016,_0x51da20);_0x36ef7a(null);};}for(var e in events){if(events[_0x3d37('0x6')](e)){var event=events[e];UserSetting[_0x3d37('0x7')](e,emitEvent(event));}}module[_0x3d37('0x8')]=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 d95c82d..6d35ef1 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 _0x536f=['./user-setting.attributes','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x115833,_0x3e8497){var _0x3129f6=function(_0x581c1d){while(--_0x581c1d){_0x115833['push'](_0x115833['shift']());}};_0x3129f6(++_0x3e8497);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xf536('0x0'));module['exports']=function(_0x4e4212){return _0x4e4212['define']('UserSetting',attributes,{'tableName':_0xf536('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e5e49){if(!_0x1e5e49[_0xf536('0x2')])_0x1e5e49[_0xf536('0x3')]=null;else if(_0x1e5e49['clientSideLoggingEnabledSince']===null)_0x1e5e49[_0xf536('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x0713=['user_settings','clientSideLoggingEnabledSince','define','UserSetting'];(function(_0x45799a,_0x3fa1d3){var _0x4d4f8b=function(_0xac8cd4){while(--_0xac8cd4){_0x45799a['push'](_0x45799a['shift']());}};_0x4d4f8b(++_0x3fa1d3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x2936e7){return _0x2936e7[_0x3071('0x0')](_0x3071('0x1'),attributes,{'tableName':_0x3071('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x864539){if(!_0x864539['clientSideLoggingEnabled'])_0x864539[_0x3071('0x3')]=null;else if(_0x864539[_0x3071('0x3')]===null)_0x864539[_0x3071('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index f4a1e6e..993d8c2 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 _0x22ae=['save','remove','emit','user-setting:update','UserId','register','length','./user-setting.events'];(function(_0x4db4a8,_0x5c90dc){var _0x960c57=function(_0x4f6aac){while(--_0x4f6aac){_0x4db4a8['push'](_0x4db4a8['shift']());}};_0x960c57(++_0x5c90dc);}(_0x22ae,0x1b7));var _0xe22a=function(_0x16c1d9,_0x2a1270){_0x16c1d9=_0x16c1d9-0x0;var _0x85293b=_0x22ae[_0x16c1d9];return _0x85293b;};'use strict';var UserSettingEvents=require(_0xe22a('0x0'));var events=[_0xe22a('0x1'),_0xe22a('0x2'),'update'];function createListener(_0x521b78,_0x3b6e0d){return function(_0x45971c){_0x3b6e0d[_0xe22a('0x3')](_0x521b78,_0x45971c);if(_0x521b78===_0xe22a('0x4')){_0x3b6e0d[_0xe22a('0x3')]('user-setting:update:user-'+_0x45971c[_0xe22a('0x5')],_0x45971c);}};}exports[_0xe22a('0x6')]=function(_0x534ce3){for(var _0xcbcf71=0x0,_0x17dac6=events[_0xe22a('0x7')];_0xcbcf71<_0x17dac6;_0xcbcf71++){var _0x1b8eb3=events[_0xcbcf71];var _0x37b8ba=createListener('user-setting:'+_0x1b8eb3,_0x534ce3);UserSettingEvents['on'](_0x1b8eb3,_0x37b8ba);}}; \ No newline at end of file +var _0x613f=['length','./user-setting.events','save','remove','update','emit','user-setting:update:user-','UserId','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x613f,0x6d));var _0xf613=function(_0x6e9f4e,_0xdc1f93){_0x6e9f4e=_0x6e9f4e-0x0;var _0x28bdc7=_0x613f[_0x6e9f4e];return _0x28bdc7;};'use strict';var UserSettingEvents=require(_0xf613('0x0'));var events=[_0xf613('0x1'),_0xf613('0x2'),_0xf613('0x3')];function createListener(_0x3c9665,_0x30293a){return function(_0x5a5160){_0x30293a[_0xf613('0x4')](_0x3c9665,_0x5a5160);if(_0x3c9665==='user-setting:update'){_0x30293a['emit'](_0xf613('0x5')+_0x5a5160[_0xf613('0x6')],_0x5a5160);}};}exports[_0xf613('0x7')]=function(_0x28a9a4){for(var _0xb2c12d=0x0,_0x4c25df=events[_0xf613('0x8')];_0xb2c12d<_0x4c25df;_0xb2c12d++){var _0x53ade4=events[_0xb2c12d];var _0x38d54a=createListener('user-setting:'+_0x53ade4,_0x28a9a4);UserSettingEvents['on'](_0x53ade4,_0x38d54a);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0b9fe51..56b2a77 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 _0x1af8=['post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','removeChatInteractions','/:id/mail_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/api_key'];(function(_0x1ded31,_0x1045f2){var _0x468251=function(_0x38ec0f){while(--_0x38ec0f){_0x1ded31['push'](_0x1ded31['shift']());}};_0x468251(++_0x1045f2);}(_0x1af8,0x99));var _0x81af=function(_0x2fe07e,_0x378166){_0x2fe07e=_0x2fe07e-0x0;var _0x2bc9f0=_0x1af8[_0x2fe07e];return _0x2bc9f0;};'use strict';var multer=require(_0x81af('0x0'));var util=require('util');var path=require(_0x81af('0x1'));var timeout=require(_0x81af('0x2'));var express=require(_0x81af('0x3'));var router=express[_0x81af('0x4')]();var fs_extra=require(_0x81af('0x5'));var auth=require(_0x81af('0x6'));var interaction=require(_0x81af('0x7'));var config=require(_0x81af('0x8'));var controller=require('./user.controller');router[_0x81af('0x9')]('/',auth[_0x81af('0xa')](),controller[_0x81af('0xb')]);router[_0x81af('0x9')]('/describe',auth[_0x81af('0xa')](),controller['describe']);router[_0x81af('0x9')]('/whoami',auth[_0x81af('0xa')](),controller[_0x81af('0xc')]);router[_0x81af('0x9')]('/presence',auth[_0x81af('0xa')](),controller[_0x81af('0xd')]);router[_0x81af('0x9')](_0x81af('0xe'),auth[_0x81af('0xa')](),controller[_0x81af('0xf')]);router[_0x81af('0x9')](_0x81af('0x10'),controller[_0x81af('0x11')]);router[_0x81af('0x9')]('/:id/open_tabs',auth[_0x81af('0xa')](),controller[_0x81af('0x12')]);router['get'](_0x81af('0x13'),auth[_0x81af('0xa')](),controller[_0x81af('0x14')]);router[_0x81af('0x9')](_0x81af('0x15'),auth[_0x81af('0xa')](),controller['getQueues']);router['get'](_0x81af('0x16'),auth['isAuthenticated'](),controller[_0x81af('0x17')]);router[_0x81af('0x9')]('/:id/groups',auth[_0x81af('0xa')](),controller[_0x81af('0x18')]);router[_0x81af('0x9')](_0x81af('0x19'),auth['isAuthenticated'](),controller[_0x81af('0x1a')]);router['get'](_0x81af('0x1b'),auth[_0x81af('0xa')](),controller['getScreenRecordings']);router[_0x81af('0x9')](_0x81af('0x1c'),auth[_0x81af('0xa')](),controller[_0x81af('0x1d')]);router[_0x81af('0x9')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x81af('0x1e'),auth[_0x81af('0xa')](),controller[_0x81af('0x1f')]);router[_0x81af('0x9')](_0x81af('0x20'),auth['isAuthenticated'](),controller[_0x81af('0x21')]);router[_0x81af('0x9')](_0x81af('0x22'),auth[_0x81af('0xa')](),controller['getFaxInteractions']);router[_0x81af('0x9')]('/:id/whatsapp/interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x23')]);router[_0x81af('0x9')](_0x81af('0x24'),auth[_0x81af('0xa')](),controller[_0x81af('0x25')]);router[_0x81af('0x9')]('/:id/lists',auth[_0x81af('0xa')](),controller[_0x81af('0x26')]);router[_0x81af('0x9')](_0x81af('0x27'),auth['isAuthenticated'](),controller[_0x81af('0x28')]);router[_0x81af('0x9')]('/:id/prefixes',auth[_0x81af('0xa')](),controller[_0x81af('0x29')]);router[_0x81af('0x9')](_0x81af('0x2a'),auth[_0x81af('0xa')](),controller[_0x81af('0x2b')]);router['get'](_0x81af('0x2c'),auth[_0x81af('0xa')](),controller[_0x81af('0x2d')]);router[_0x81af('0x9')](_0x81af('0x2e'),auth[_0x81af('0xa')](),controller[_0x81af('0x2f')]);router[_0x81af('0x9')](_0x81af('0x30'),auth[_0x81af('0xa')](),controller['getSmsAccounts']);router[_0x81af('0x9')](_0x81af('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get'](_0x81af('0x32'),auth[_0x81af('0xa')](),controller[_0x81af('0x33')]);router[_0x81af('0x9')]('/:id/scheduled_calls',auth[_0x81af('0xa')](),controller['getScheduledCalls']);router['get'](_0x81af('0x34'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x81af('0x35')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x81af('0x35')]('/',auth['isAuthenticated'](),controller[_0x81af('0x36')]);router[_0x81af('0x35')](_0x81af('0x37'),auth[_0x81af('0xa')](),controller[_0x81af('0x38')]);router['post'](_0x81af('0x15'),auth[_0x81af('0xa')](),controller[_0x81af('0x39')]);var upload=multer({'storage':multer[_0x81af('0x3a')]({'destination':function(_0x34040c,_0x126027,_0x22d380){_0x22d380(null,path[_0x81af('0x3b')](config[_0x81af('0x3c')],_0x81af('0x3d')));},'filename':function(_0x46ac71,_0x291c60,_0x1a4e40){_0x1a4e40(null,util[_0x81af('0x3e')]('%s-%s',Date[_0x81af('0x3f')](),_0x291c60['originalname']));}})});router['post']('/:id/avatar',upload[_0x81af('0x40')]('file'),controller[_0x81af('0x41')]);router[_0x81af('0x35')](_0x81af('0x42'),auth[_0x81af('0xa')](),controller[_0x81af('0x43')]);router['post'](_0x81af('0x44'),auth[_0x81af('0xa')](),controller[_0x81af('0x45')]);router['post'](_0x81af('0x46'),auth[_0x81af('0xa')](),controller[_0x81af('0x47')]);router[_0x81af('0x35')]('/:id/unpause',auth[_0x81af('0xa')](),controller[_0x81af('0x48')]);router[_0x81af('0x35')]('/:id/teams',auth[_0x81af('0xa')](),controller[_0x81af('0x49')]);router[_0x81af('0x35')](_0x81af('0x4a'),auth[_0x81af('0xa')](),controller[_0x81af('0x4b')]);router[_0x81af('0x35')]('/:id/mail_interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x4c')]);router[_0x81af('0x35')](_0x81af('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x81af('0x35')](_0x81af('0x4e'),auth[_0x81af('0xa')](),controller[_0x81af('0x4f')]);router[_0x81af('0x35')](_0x81af('0x50'),auth[_0x81af('0xa')](),controller[_0x81af('0x51')]);router[_0x81af('0x35')](_0x81af('0x52'),auth[_0x81af('0xa')](),controller[_0x81af('0x53')]);router['post'](_0x81af('0x2a'),auth[_0x81af('0xa')](),controller['addFaxAccounts']);router[_0x81af('0x35')](_0x81af('0x2c'),auth['isAuthenticated'](),controller[_0x81af('0x54')]);router[_0x81af('0x35')]('/:id/openchannel_accounts',auth[_0x81af('0xa')](),controller['addOpenchannelAccounts']);router[_0x81af('0x35')](_0x81af('0x30'),auth[_0x81af('0xa')](),controller[_0x81af('0x55')]);router[_0x81af('0x35')](_0x81af('0x31'),auth[_0x81af('0xa')](),controller[_0x81af('0x56')]);router[_0x81af('0x35')]('/:id/whatsapp_accounts',auth[_0x81af('0xa')](),controller['addWhatsappAccounts']);router[_0x81af('0x35')](_0x81af('0x34'),auth[_0x81af('0xa')](),controller[_0x81af('0x57')]);router[_0x81af('0x58')](_0x81af('0xe'),auth[_0x81af('0xa')](),controller['update']);router[_0x81af('0x58')](_0x81af('0x59'),auth[_0x81af('0xa')](),controller['changePassword']);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0x81af('0x5a')]);router[_0x81af('0x5b')](_0x81af('0x24'),auth[_0x81af('0xa')](),controller[_0x81af('0x5c')]);router[_0x81af('0x5b')]('/:id',auth[_0x81af('0xa')](),controller['destroy']);router[_0x81af('0x5b')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x81af('0x5d')]);router[_0x81af('0x5b')](_0x81af('0x5e'),auth[_0x81af('0xa')](),controller['removeMailInteractions']);router['delete'](_0x81af('0x4d'),auth[_0x81af('0xa')](),controller['removeFaxInteractions']);router['delete']('/:id/sms_interactions',auth[_0x81af('0xa')](),controller['removeSmsInteractions']);router[_0x81af('0x5b')]('/:id/openchannel_interactions',auth[_0x81af('0xa')](),controller[_0x81af('0x5f')]);router[_0x81af('0x5b')](_0x81af('0x52'),auth[_0x81af('0xa')](),controller[_0x81af('0x60')]);router[_0x81af('0x5b')]('/:id/fax_accounts',auth[_0x81af('0xa')](),controller[_0x81af('0x61')]);router['delete']('/:id/mail_accounts',auth[_0x81af('0xa')](),controller['removeMailAccounts']);router[_0x81af('0x5b')](_0x81af('0x2e'),auth[_0x81af('0xa')](),controller[_0x81af('0x62')]);router['delete'](_0x81af('0x30'),auth[_0x81af('0xa')](),controller[_0x81af('0x63')]);router[_0x81af('0x5b')](_0x81af('0x31'),auth[_0x81af('0xa')](),controller[_0x81af('0x64')]);router[_0x81af('0x5b')](_0x81af('0x32'),auth[_0x81af('0xa')](),controller[_0x81af('0x65')]);router[_0x81af('0x5b')](_0x81af('0x34'),auth[_0x81af('0xa')](),controller['removeApiKey']);module[_0x81af('0x66')]=router; \ No newline at end of file +var _0x13eb=['addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','/:id/password','delete','removeQueues','destroy','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','addQueues','diskStorage','server/files/images/','format','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions'];(function(_0x19420e,_0x436773){var _0x277e36=function(_0x1cb702){while(--_0x1cb702){_0x19420e['push'](_0x19420e['shift']());}};_0x277e36(++_0x436773);}(_0x13eb,0x8f));var _0xb13e=function(_0x54501d,_0x42e8a6){_0x54501d=_0x54501d-0x0;var _0x2b9b2c=_0x13eb[_0x54501d];return _0x2b9b2c;};'use strict';var multer=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var path=require('path');var timeout=require(_0xb13e('0x2'));var express=require(_0xb13e('0x3'));var router=express['Router']();var fs_extra=require(_0xb13e('0x4'));var auth=require(_0xb13e('0x5'));var interaction=require(_0xb13e('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xb13e('0x7')]('/',auth[_0xb13e('0x8')](),controller[_0xb13e('0x9')]);router[_0xb13e('0x7')](_0xb13e('0xa'),auth[_0xb13e('0x8')](),controller['describe']);router[_0xb13e('0x7')](_0xb13e('0xb'),auth['isAuthenticated'](),controller[_0xb13e('0xc')]);router[_0xb13e('0x7')](_0xb13e('0xd'),auth[_0xb13e('0x8')](),controller[_0xb13e('0xe')]);router[_0xb13e('0x7')](_0xb13e('0xf'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x10')]);router[_0xb13e('0x7')]('/:id/avatar',controller[_0xb13e('0x11')]);router[_0xb13e('0x7')](_0xb13e('0x12'),auth[_0xb13e('0x8')](),controller['getOpenTabs']);router[_0xb13e('0x7')](_0xb13e('0x13'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x14')]);router[_0xb13e('0x7')](_0xb13e('0x15'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x16')]);router[_0xb13e('0x7')](_0xb13e('0x17'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x18')]);router[_0xb13e('0x7')](_0xb13e('0x19'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x1a')]);router[_0xb13e('0x7')]('/:id/recordings',auth[_0xb13e('0x8')](),controller[_0xb13e('0x1b')]);router['get'](_0xb13e('0x1c'),auth[_0xb13e('0x8')](),controller['getScreenRecordings']);router[_0xb13e('0x7')](_0xb13e('0x1d'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x1e')]);router[_0xb13e('0x7')](_0xb13e('0x1f'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x20')]);router[_0xb13e('0x7')](_0xb13e('0x21'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x22')]);router[_0xb13e('0x7')](_0xb13e('0x23'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x24')]);router[_0xb13e('0x7')](_0xb13e('0x25'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x26')]);router[_0xb13e('0x7')]('/:id/whatsapp/interactions',auth[_0xb13e('0x8')](),controller[_0xb13e('0x27')]);router[_0xb13e('0x7')]('/:id/teams',auth[_0xb13e('0x8')](),controller[_0xb13e('0x28')]);router[_0xb13e('0x7')]('/:id/lists',auth[_0xb13e('0x8')](),controller[_0xb13e('0x29')]);router[_0xb13e('0x7')](_0xb13e('0x2a'),auth['isAuthenticated'](),controller[_0xb13e('0x2b')]);router[_0xb13e('0x7')](_0xb13e('0x2c'),auth[_0xb13e('0x8')](),controller['getVoicePrefixes']);router[_0xb13e('0x7')](_0xb13e('0x2d'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x2e')]);router[_0xb13e('0x7')](_0xb13e('0x2f'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x30')]);router[_0xb13e('0x7')](_0xb13e('0x31'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x32')]);router[_0xb13e('0x7')](_0xb13e('0x33'),auth['isAuthenticated'](),controller[_0xb13e('0x34')]);router[_0xb13e('0x7')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xb13e('0x35')]);router[_0xb13e('0x7')](_0xb13e('0x36'),auth[_0xb13e('0x8')](),controller['getWhatsappAccounts']);router[_0xb13e('0x7')](_0xb13e('0x37'),auth['isAuthenticated'](),controller[_0xb13e('0x38')]);router[_0xb13e('0x7')](_0xb13e('0x39'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x3a')]);router[_0xb13e('0x3b')](_0xb13e('0x13'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x3c')]);router[_0xb13e('0x3b')]('/',auth[_0xb13e('0x8')](),controller[_0xb13e('0x3d')]);router['post']('/create_many',auth[_0xb13e('0x8')](),controller['bulkCreate']);router[_0xb13e('0x3b')]('/:id/queues',auth[_0xb13e('0x8')](),controller[_0xb13e('0x3e')]);var upload=multer({'storage':multer[_0xb13e('0x3f')]({'destination':function(_0x5914b3,_0x29c1f9,_0x20274b){_0x20274b(null,path['join'](config['root'],_0xb13e('0x40')));},'filename':function(_0xabd1b6,_0x5af52e,_0x1d77e7){_0x1d77e7(null,util[_0xb13e('0x41')]('%s-%s',Date[_0xb13e('0x42')](),_0x5af52e[_0xb13e('0x43')]));}})});router[_0xb13e('0x3b')](_0xb13e('0x44'),upload[_0xb13e('0x45')](_0xb13e('0x46')),controller['addAvatar']);router['post'](_0xb13e('0x47'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x48')]);router[_0xb13e('0x3b')](_0xb13e('0x49'),auth['isAuthenticated'](),controller['logout']);router[_0xb13e('0x3b')](_0xb13e('0x4a'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x4b')]);router[_0xb13e('0x3b')](_0xb13e('0x4c'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x4d')]);router[_0xb13e('0x3b')](_0xb13e('0x4e'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x4f')]);router['post'](_0xb13e('0x50'),auth[_0xb13e('0x8')](),controller['addChatInteractions']);router[_0xb13e('0x3b')](_0xb13e('0x51'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x52')]);router[_0xb13e('0x3b')](_0xb13e('0x53'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x54')]);router[_0xb13e('0x3b')](_0xb13e('0x55'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x56')]);router[_0xb13e('0x3b')]('/:id/openchannel_interactions',auth[_0xb13e('0x8')](),controller[_0xb13e('0x57')]);router[_0xb13e('0x3b')](_0xb13e('0x58'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x59')]);router[_0xb13e('0x3b')](_0xb13e('0x2d'),auth['isAuthenticated'](),controller[_0xb13e('0x5a')]);router[_0xb13e('0x3b')](_0xb13e('0x2f'),auth['isAuthenticated'](),controller[_0xb13e('0x5b')]);router[_0xb13e('0x3b')](_0xb13e('0x31'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post'](_0xb13e('0x33'),auth[_0xb13e('0x8')](),controller['addSmsAccounts']);router[_0xb13e('0x3b')](_0xb13e('0x5c'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x5d')]);router['post'](_0xb13e('0x36'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x5e')]);router[_0xb13e('0x3b')](_0xb13e('0x39'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x5f')]);router['put']('/:id',auth[_0xb13e('0x8')](),controller[_0xb13e('0x60')]);router[_0xb13e('0x61')](_0xb13e('0x62'),auth['isAuthenticated'](),controller['changePassword']);router[_0xb13e('0x63')](_0xb13e('0x15'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x64')]);router['delete'](_0xb13e('0x4e'),auth[_0xb13e('0x8')](),controller['removeTeams']);router[_0xb13e('0x63')](_0xb13e('0xf'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x65')]);router[_0xb13e('0x63')](_0xb13e('0x50'),auth[_0xb13e('0x8')](),controller['removeChatInteractions']);router[_0xb13e('0x63')](_0xb13e('0x51'),auth[_0xb13e('0x8')](),controller['removeMailInteractions']);router[_0xb13e('0x63')]('/:id/fax_interactions',auth[_0xb13e('0x8')](),controller[_0xb13e('0x66')]);router[_0xb13e('0x63')](_0xb13e('0x55'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x67')]);router[_0xb13e('0x63')](_0xb13e('0x68'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x69')]);router[_0xb13e('0x63')](_0xb13e('0x58'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x6a')]);router[_0xb13e('0x63')](_0xb13e('0x2d'),auth['isAuthenticated'](),controller[_0xb13e('0x6b')]);router[_0xb13e('0x63')](_0xb13e('0x2f'),auth['isAuthenticated'](),controller[_0xb13e('0x6c')]);router[_0xb13e('0x63')](_0xb13e('0x31'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x6d')]);router[_0xb13e('0x63')](_0xb13e('0x33'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x6e')]);router[_0xb13e('0x63')](_0xb13e('0x5c'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x6f')]);router[_0xb13e('0x63')](_0xb13e('0x36'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x70')]);router['delete']('/:id/api_key',auth[_0xb13e('0x8')](),controller[_0xb13e('0x71')]);module[_0xb13e('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 83526a1..008eae3 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x1852aa,_0xb3b15f){var _0xba0dca=function(_0x5d675a){while(--_0x5d675a){_0x1852aa['push'](_0x1852aa['shift']());}};_0xba0dca(++_0xb3b15f);}(_0x70e0,0x17b));var _0x070e=function(_0x19f0d0,_0x91b5cf){_0x19f0d0=_0x19f0d0-0x0;var _0x227c64=_0x70e0[_0x19f0d0];return _0x227c64;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','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]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x563c00,_0x45a009){var _0x4befd0=function(_0x571ca2){while(--_0x571ca2){_0x563c00['push'](_0x563c00['shift']());}};_0x4befd0(++_0x45a009);}(_0x34e8,0x12c));var _0x834e=function(_0x5977bf,_0x14c105){_0x5977bf=_0x5977bf-0x0;var _0x21e156=_0x34e8[_0x5977bf];return _0x21e156;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'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 2b55731..4230370 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 _0x04d0=['List','Tag','Tags','color','tag','nolimit','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','format','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','update','YYYY-MM-DD\x20HH:mm:ss','forEach','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','pause','QueuePause','getChannels','type','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','getLists','values','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','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike','$iLike','$overlap','$contained','firstName','lastName','Contact','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','teams','queues','isEmpty','inbound','flatten','getAgents','lower','col','toString','asc','desc','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','client','offline','idle','unknown','unavailable','ringing','busy','slice','charAt','toUpperCase','select','InteractionId','field','ui.createdAt','_interactions','OpenTabs','moment','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','../../mysqldb','redis','./user.socket','defaults','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','agent','userNotification:recalc:','get','role','admin','user','Telephones','telephone','filter','map','value','find','name','UserProfileResource','stack','send','index','User','fieldName','includes','salt','getOptions','where','query','includeAll','userSetting','true','include','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','sms','dataValues','fax','mail','openchannel','whatsapp','all','catch','show','model','differenceBy','keys','rawAttributes','password','intersection','fields','merge','options','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','107','109','100','111','114','115','create','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','userProfileId','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','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','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','Queue:save','voice','VoiceQueue','online','removeQueues','remove','QueueId','Queue:remove','UserVoiceQueueRt','destroy','userpic','join','root','download','ChatOpenTabs','CHAT','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','CmContact','order','sort','filters','pick','hasOwnProperty','CmList'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x04d0,0xc4));var _0x004d=function(_0x126fac,_0x1a9ba7){_0x126fac=_0x126fac-0x0;var _0x2ebe5a=_0x04d0[_0x126fac];return _0x2ebe5a;};'use strict';var moment=require(_0x004d('0x0'));var util=require('util');var path=require(_0x004d('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x004d('0x2'));var jayson=require(_0x004d('0x3'));var Redis=require(_0x004d('0x4'));var authService=require(_0x004d('0x5'));var qs=require(_0x004d('0x6'));var logger=require(_0x004d('0x7'))(_0x004d('0x8'));var utils=require('../../config/utils');var config=require(_0x004d('0x9'));var licenseUtil=require(_0x004d('0xa'));var APIBadRequestError=require(_0x004d('0xb'))['APIBadRequestError'];var APINotFoundError=require(_0x004d('0xb'))[_0x004d('0xc')];var APIHandleError=require(_0x004d('0xb'))['handleError'];var db=require(_0x004d('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x004d('0xe')]));require(_0x004d('0xf'))['register'](socket);config[_0x004d('0xe')]=_[_0x004d('0x10')](config[_0x004d('0xe')],{'host':'localhost','port':0x18eb});var amiClient=jayson['client'][_0x004d('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x2c4183,_0x232d6f,_0x1fa0b1,_0x1e8ecc){return new Promise(function(_0x25b21c,_0x2edc6f){var _0x51c577=_0x1e8ecc||amiClient;return _0x51c577[_0x004d('0x12')](_0x2c4183,_0x1fa0b1)[_0x004d('0x13')](function(_0x3a0ecb){logger[_0x004d('0x14')](_0x004d('0x15'),_0x232d6f,_0x004d('0x16'));logger[_0x004d('0x17')](_0x004d('0x18'),_0x232d6f,_0x004d('0x16'),JSON['stringify'](_0x3a0ecb));if(_0x3a0ecb[_0x004d('0x19')]){if(_0x3a0ecb[_0x004d('0x19')][_0x004d('0x1a')]===0x1f4){logger[_0x004d('0x19')](_0x004d('0x15'),_0x232d6f,_0x3a0ecb[_0x004d('0x19')]['message']);return _0x2edc6f(_0x3a0ecb[_0x004d('0x19')]['message']);}logger[_0x004d('0x19')](_0x004d('0x15'),_0x232d6f,_0x3a0ecb[_0x004d('0x19')][_0x004d('0x1b')]);return _0x25b21c(_0x3a0ecb['error'][_0x004d('0x1b')]);}else{logger[_0x004d('0x14')]('User,\x20%s,\x20%s',_0x232d6f,_0x004d('0x16'));_0x25b21c(_0x3a0ecb['result'][_0x004d('0x1b')]);}})['catch'](function(_0x3644d5){logger['error']('User,\x20%s,\x20%s',_0x232d6f,_0x3644d5);_0x2edc6f(_0x3644d5);});});}function respondWithStatusCode(_0x47b6c5,_0x3ee0eb){_0x3ee0eb=_0x3ee0eb||0xcc;return function(_0x123eb7){if(_0x123eb7){return _0x47b6c5[_0x004d('0x1c')](_0x3ee0eb);}return _0x47b6c5[_0x004d('0x1d')](_0x3ee0eb)[_0x004d('0x1e')]();};}function respondWithResult(_0x3703fe,_0x47c40f){_0x47c40f=_0x47c40f||0xc8;return function(_0x5de90d){if(_0x5de90d){return _0x3703fe[_0x004d('0x1d')](_0x47c40f)[_0x004d('0x1f')](_0x5de90d);}};}function respondWithFilteredResult(_0x3082fb,_0xda5004){return function(_0xc41f34){if(_0xc41f34){var _0x9e9b96=typeof _0xda5004['offset']===_0x004d('0x20')&&typeof _0xda5004['limit']===_0x004d('0x20');var _0x4c05b3=_0xc41f34[_0x004d('0x21')];var _0x2d5e6e=_0x9e9b96?0x0:_0xda5004[_0x004d('0x22')];var _0x14cc43=_0x9e9b96?_0xc41f34[_0x004d('0x21')]:_0xda5004[_0x004d('0x22')]+_0xda5004[_0x004d('0x23')];var _0x57eb2d;if(_0x14cc43>=_0x4c05b3){_0x14cc43=_0x4c05b3;_0x57eb2d=0xc8;}else{_0x57eb2d=0xce;}_0x3082fb[_0x004d('0x1d')](_0x57eb2d);return _0x3082fb[_0x004d('0x24')](_0x004d('0x25'),_0x2d5e6e+'-'+_0x14cc43+'/'+_0x4c05b3)['json'](_0xc41f34);}return null;};}function saveUpdates(_0x1cb6ea){return function(_0x57095d){if(_0x57095d){return _0x57095d['update'](_0x1cb6ea)['then'](function(_0x5875f9){if(_0x5875f9['role']===_0x004d('0x26')){socket['emit'](_0x004d('0x27')+_0x5875f9['id'],_0x5875f9);}return _0x5875f9;});}return null;};}function removeEntity(_0x22ea1e){return function(_0x1282b2){if(_0x1282b2){return _0x1282b2['destroy']()[_0x004d('0x13')](function(){var _0x2ca6a1=_0x1282b2[_0x004d('0x28')]({'plain':!![]});if(_0x2ca6a1[_0x004d('0x29')]===_0x004d('0x2a'))return;var _0x6af8de=[{'name':'Users','value':_0x004d('0x2b'),'ignore':!![]},{'name':'Agents','value':_0x004d('0x26'),'ignore':![]},{'name':_0x004d('0x2c'),'value':_0x004d('0x2d'),'ignore':![]}];var _0x400afe=_(_0x6af8de)[_0x004d('0x2e')]('ignore')[_0x004d('0x2f')](_0x004d('0x30'))['value']();if(_['includes'](_0x400afe,_0x2ca6a1[_0x004d('0x29')])){return;}var _0x5a1968=_[_0x004d('0x31')](_0x6af8de,[_0x004d('0x30'),_0x2ca6a1[_0x004d('0x29')]])[_0x004d('0x32')];return db[_0x004d('0x33')]['destroy']({'where':{'type':_0x5a1968,'resourceId':_0x2ca6a1['id']}})[_0x004d('0x13')](function(){return _0x1282b2;});})[_0x004d('0x13')](function(){_0x22ea1e[_0x004d('0x1d')](0xcc)[_0x004d('0x1e')]();});}};}function handleEntityNotFound(_0x261e76){return function(_0x39f9b0){if(!_0x39f9b0){_0x261e76[_0x004d('0x1c')](0x194);}return _0x39f9b0;};}function handleError(_0x13d841,_0x1aecae){_0x1aecae=_0x1aecae||0x1f4;return function(_0x22ff92){logger['error'](_0x22ff92[_0x004d('0x34')]);if(_0x22ff92[_0x004d('0x32')]){delete _0x22ff92['name'];}_0x13d841[_0x004d('0x1d')](_0x1aecae)[_0x004d('0x35')](_0x22ff92);};}exports[_0x004d('0x36')]=function(_0x901d14,_0x1d750f){var _0x166f37={},_0x34098b={'count':0x0,'rows':[]};var _0x48db86=_(db[_0x004d('0x37')]['rawAttributes'])[_0x004d('0x2f')](function(_0x5381b0){return{'name':_0x5381b0[_0x004d('0x38')],'type':_0x5381b0['type']['key']};})[_0x004d('0x2e')](function(_0x2f1038){return!_[_0x004d('0x39')](['password',_0x004d('0x3a')],_0x2f1038['name']);})[_0x004d('0x30')]();_0x166f37=qs[_0x004d('0x3b')](_0x48db86,_0x901d14);var _0xc7b06a={'where':_0x166f37[_0x004d('0x3c')]};return db[_0x004d('0x37')][_0x004d('0x21')](_0xc7b06a)['then'](function(_0x42bf51){_0x34098b[_0x004d('0x21')]=_0x42bf51;if(_0x901d14[_0x004d('0x3d')][_0x004d('0x3e')]){_0x166f37['include']=[{'all':!![]}];}if(_0x901d14[_0x004d('0x3d')][_0x004d('0x3f')]===_0x004d('0x40')){_0x166f37[_0x004d('0x41')]=[{'model':db[_0x004d('0x42')],'as':'userSetting'}];}if(!_[_0x004d('0x39')](_0x166f37[_0x004d('0x43')],'id')){_0x166f37['attributes'][_0x004d('0x44')]('id');}return db[_0x004d('0x37')][_0x004d('0x45')](_0x166f37);})[_0x004d('0x13')](function(_0x3b4317){_0x34098b[_0x004d('0x46')]=_0x3b4317;if(_0x901d14[_0x004d('0x3d')][_0x004d('0x47')]===_0x004d('0x40')){var _0x3b39da=[];for(var _0x4bf324=0x0;_0x4bf324<_0x34098b[_0x004d('0x46')][_0x004d('0x48')];_0x4bf324++){_0x3b39da['push'](get_open_tabs(_0x004d('0x49'),_0x34098b['rows'][_0x4bf324]['dataValues']));_0x3b39da['push'](get_open_tabs(_0x004d('0x4a'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da['push'](get_open_tabs(_0x004d('0x4c'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da['push'](get_open_tabs(_0x004d('0x4d'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da[_0x004d('0x44')](get_open_tabs(_0x004d('0x4e'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));_0x3b39da[_0x004d('0x44')](get_open_tabs(_0x004d('0x4f'),_0x34098b[_0x004d('0x46')][_0x4bf324][_0x004d('0x4b')]));}return Promise[_0x004d('0x50')](_0x3b39da)['then'](function(){return _0x34098b;});}else{return _0x34098b;}})[_0x004d('0x13')](respondWithFilteredResult(_0x1d750f,_0x166f37))[_0x004d('0x51')](handleError(_0x1d750f,null));};exports[_0x004d('0x52')]=function(_0x5472ff,_0x5e97a6){var _0x5b3a42={'raw':![],'where':{'id':_0x5472ff['params']['id']}},_0x11564c={};_0x11564c[_0x004d('0x53')]=_[_0x004d('0x54')](_[_0x004d('0x55')](db[_0x004d('0x37')][_0x004d('0x56')]),[_0x004d('0x57'),'salt']);_0x11564c[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x5472ff[_0x004d('0x3d')]);_0x11564c['filters']=_['intersection'](_0x11564c[_0x004d('0x53')],_0x11564c[_0x004d('0x3d')]);_0x5b3a42[_0x004d('0x43')]=_[_0x004d('0x58')](_0x11564c['model'],qs[_0x004d('0x59')](_0x5472ff[_0x004d('0x3d')]['fields']));_0x5b3a42['attributes']=_0x5b3a42[_0x004d('0x43')][_0x004d('0x48')]?_0x5b3a42[_0x004d('0x43')]:_0x11564c[_0x004d('0x53')];if(_0x5472ff['query'][_0x004d('0x3e')]){_0x5b3a42['include']=[{'all':!![]}];}if(_0x5472ff[_0x004d('0x3d')][_0x004d('0x3f')]==='true'){_0x5b3a42['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x5b3a42=_[_0x004d('0x5a')]({},_0x5b3a42,_0x5472ff[_0x004d('0x5b')]);if(!_['includes'](_0x5b3a42[_0x004d('0x43')],'id')){_0x5b3a42[_0x004d('0x43')][_0x004d('0x44')]('id');}return db[_0x004d('0x37')][_0x004d('0x31')](_0x5b3a42)[_0x004d('0x13')](handleEntityNotFound(_0x5e97a6,null))[_0x004d('0x13')](function(_0x4680e0){var _0x36a9b1=[];values=_0x4680e0;if(_0x5472ff[_0x004d('0x3d')][_0x004d('0x47')]===_0x004d('0x40')){_0x36a9b1['push'](get_open_tabs(_0x004d('0x49'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4a'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4e'),_0x4680e0[_0x004d('0x4b')]));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4f'),_0x4680e0[_0x004d('0x4b')]));_0x36a9b1['push'](get_open_tabs(_0x004d('0x4c'),_0x4680e0['dataValues']));_0x36a9b1[_0x004d('0x44')](get_open_tabs(_0x004d('0x4d'),_0x4680e0['dataValues']));return Promise[_0x004d('0x50')](_0x36a9b1);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x5e97a6,null))[_0x004d('0x51')](handleError(_0x5e97a6,null));};exports['update']=function(_0xea842a,_0x12ef35){if(_0xea842a[_0x004d('0x5c')]['id']){delete _0xea842a[_0x004d('0x5c')]['id'];}delete _0xea842a[_0x004d('0x5c')][_0x004d('0x29')];return db['User']['find']({'where':{'id':_0xea842a[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x12ef35,null))[_0x004d('0x13')](saveUpdates(_0xea842a[_0x004d('0x5c')],null))[_0x004d('0x13')](respondWithResult(_0x12ef35,null))[_0x004d('0x51')](handleError(_0x12ef35,null));};exports[_0x004d('0x5e')]=function(_0x399d15,_0x94af84){return db['User']['describe']()['then'](respondWithResult(_0x94af84,null))[_0x004d('0x51')](handleError(_0x94af84,null));};exports[_0x004d('0x5f')]=function(_0x210012,_0x5c4afa){return db[_0x004d('0x37')]['find']({'where':{'id':_0x210012[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x5c4afa,null))[_0x004d('0x13')](function(_0x59fbb5){if(_0x59fbb5){return _0x59fbb5[_0x004d('0x5f')](_0x210012[_0x004d('0x5c')][_0x004d('0x60')],_[_0x004d('0x61')](_0x210012[_0x004d('0x5c')],['ids','id'])||{});}})[_0x004d('0x13')](respondWithResult(_0x5c4afa,null))['catch'](handleError(_0x5c4afa,null));};function validateUser(_0x1fb1ea){return new Promise(function(_0xf365ad,_0xac51d2){if(_0x1fb1ea[_0x004d('0x62')])return _0xf365ad(_0x1fb1ea);return db[_0x004d('0x63')][_0x004d('0x64')](0x1)[_0x004d('0x13')](function(_0x561e19){if(_0x561e19[_0x004d('0x65')])authService[_0x004d('0x66')](_0x1fb1ea[_0x004d('0x57')]);db['User']['max']('internal')[_0x004d('0x13')](function(_0x30fe6a){if(_[_0x004d('0x67')](_0x30fe6a)){_0x1fb1ea['internal']=_0x561e19[_0x004d('0x68')]||0x1;return;}if(_[_0x004d('0x67')](_0x561e19[_0x004d('0x68')])||_0x561e19['min_internal']===_0x30fe6a){_0x1fb1ea[_0x004d('0x62')]=_0x30fe6a+0x1;return;}if(_0x561e19[_0x004d('0x68')]>_0x30fe6a){_0x1fb1ea[_0x004d('0x62')]=_0x561e19[_0x004d('0x68')];return;}return db[_0x004d('0x69')][_0x004d('0x3d')](_0x004d('0x6a'),{'type':db[_0x004d('0x69')][_0x004d('0x6b')][_0x004d('0x6c')]})[_0x004d('0x13')](function(_0x3d3d81){if(_0x3d3d81&&_0x3d3d81[_0x004d('0x48')]){for(var _0x4f2b38=0x0,_0x123f84=_0x3d3d81[_0x004d('0x48')];_0x4f2b38<_0x123f84&&_['isNil'](_0x1fb1ea[_0x004d('0x62')]);_0x4f2b38++){if(_0x561e19[_0x004d('0x68')]<=_0x3d3d81[_0x4f2b38][_0x004d('0x6d')]){_0x1fb1ea[_0x004d('0x62')]=_0x3d3d81[_0x4f2b38][_0x004d('0x6d')];}else if(_0x561e19[_0x004d('0x68')]>_0x3d3d81[_0x4f2b38][_0x004d('0x6d')]&&_0x561e19[_0x004d('0x68')]<=_0x3d3d81[_0x4f2b38]['to']){_0x1fb1ea[_0x004d('0x62')]=_0x561e19['min_internal'];}}}if(_[_0x004d('0x67')](_0x1fb1ea['internal'])){_0x1fb1ea[_0x004d('0x62')]=_0x30fe6a+0x1;}return _0xf365ad(_0x1fb1ea);});});})[_0x004d('0x51')](function(_0x136ff0){_0xac51d2(_0x136ff0);});});}function updateUser(_0x2e643d){return new Promise(function(_0x133749,_0x10bdc5){try{if(_0x2e643d[_0x004d('0x6e')]){_0x2e643d[_0x004d('0x6f')]=_0x2e643d[_0x004d('0x62')];_0x2e643d[_0x004d('0x70')]={'mailbox':_0x2e643d[_0x004d('0x62')],'password':_0x2e643d[_0x004d('0x57')],'fullname':_0x2e643d[_0x004d('0x71')],'email':_0x2e643d[_0x004d('0x72')]};}if(_0x2e643d[_0x004d('0x29')]===_0x004d('0x26')){if(!_0x2e643d[_0x004d('0x73')])_0x2e643d[_0x004d('0x73')]=[_0x004d('0x74'),_0x004d('0x75'),_0x004d('0x76'),_0x004d('0x77'),_0x004d('0x78'),'104','105','106',_0x004d('0x79'),'108',_0x004d('0x7a'),_0x004d('0x7b'),_0x004d('0x7c'),_0x004d('0x7d'),_0x004d('0x7e')];}_0x133749(_0x2e643d);}catch(_0x2f4edb){_0x10bdc5(_0x2f4edb);}});}exports[_0x004d('0x7f')]=function(_0x51c3b3,_0xce2a5e){if(_0x51c3b3[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x26'))throw new Error('Unauthorized');if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]==='user'&&_0x51c3b3['user']['role']!==_0x004d('0x2a')){throw new Error(_0x004d('0x80'));}if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2a')&&_0x51c3b3[_0x004d('0x2b')]['role']!==_0x004d('0x2a')){throw new Error(_0x004d('0x81'));}return licenseUtil[_0x004d('0x82')]([_0x51c3b3[_0x004d('0x5c')]])[_0x004d('0x13')](function(){return validateUser(_0x51c3b3['body']);})[_0x004d('0x13')](function(_0x42687f){return updateUser(_0x42687f)[_0x004d('0x13')](function(_0x2fbdc3){if(_0x2fbdc3['role']==='admin'){_0x2fbdc3[_0x004d('0x83')]=_0x51c3b3[_0x004d('0x2b')]['settingsEnabled'];delete _0x2fbdc3[_0x004d('0x84')];}return _0x2fbdc3;});})[_0x004d('0x13')](function(_0x45a04d){return db[_0x004d('0x37')]['create'](_0x45a04d,{'include':[{'model':db[_0x004d('0x70')],'as':_0x004d('0x70')}]});})[_0x004d('0x13')](function(_0x3df689){if(_0x51c3b3[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2b'))return _0x3df689;if(_0x51c3b3[_0x004d('0x2b')]['role']!==_0x004d('0x2b'))return _0x3df689;return db['UserProfileSection'][_0x004d('0x31')]({'where':{'name':_0x3df689['role']===_0x004d('0x26')?_0x004d('0x85'):'Telephones','userProfileId':_0x51c3b3[_0x004d('0x2b')]['userProfileId']},'raw':!![]})[_0x004d('0x13')](function(_0x5a57c2){if(!_0x5a57c2||_0x5a57c2[_0x004d('0x86')]!=0x0)return _0x3df689;return db[_0x004d('0x33')]['create']({'name':_0x3df689[_0x004d('0x32')],'resourceId':_0x3df689['id'],'type':_0x5a57c2[_0x004d('0x32')],'sectionId':_0x5a57c2['id']},{})[_0x004d('0x13')](function(){return _0x3df689;});})[_0x004d('0x51')](function(_0x86d5f7){logger[_0x004d('0x19')](_0x004d('0x87'),_0x86d5f7);throw _0x86d5f7;});})[_0x004d('0x13')](respondWithResult(_0xce2a5e,0xc9))[_0x004d('0x51')](handleError(_0xce2a5e,null));};exports[_0x004d('0x88')]=function(_0x45bb11,_0x59cf96){var _0x31f242=_0x45bb11[_0x004d('0x5c')];var _0x5ddd27=[];if(_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x26'))throw new Error(_0x004d('0x89'));if(_[_0x004d('0x8a')](_0x31f242,[_0x004d('0x29'),_0x004d('0x2b')])&&_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!=='admin'){throw new Error(_0x004d('0x80'));}if(_['some'](_0x31f242,[_0x004d('0x29'),_0x004d('0x2a')])&&_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!==_0x004d('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x004d('0x82')](_0x31f242)[_0x004d('0x13')](function(){return validateUser(_0x31f242[0x0]);})['then'](function(){for(var _0x59dfe4=0x1;_0x59dfe4<_0x31f242['length'];_0x59dfe4++){var _0x15be80=_0x31f242[_0x59dfe4-0x1]['internal'];if(!_0x31f242[_0x59dfe4][_0x004d('0x62')])_0x31f242[_0x59dfe4][_0x004d('0x62')]=_0x15be80+0x1;_0x5ddd27[_0x004d('0x44')](validateUser(_0x31f242[_0x59dfe4]));}return Promise[_0x004d('0x50')](_0x5ddd27);})['then'](function(){_0x5ddd27=[];for(var _0x1e5ebd=0x0;_0x1e5ebd<_0x31f242[_0x004d('0x48')];_0x1e5ebd++){_0x5ddd27[_0x004d('0x44')](updateUser(_0x31f242[_0x1e5ebd]));}return Promise[_0x004d('0x50')](_0x5ddd27);})[_0x004d('0x13')](function(){_0x5ddd27=_0x31f242[_0x004d('0x2f')](function(_0x42e651){return db[_0x004d('0x37')][_0x004d('0x7f')](_0x42e651,{'include':[{'model':db[_0x004d('0x70')],'as':'VoiceMail'}]})[_0x004d('0x13')](function(_0x14e3ea){_0x42e651['id']=_0x14e3ea['id'];return _0x42e651;});});return Promise['all'](_0x5ddd27);})[_0x004d('0x13')](function(_0x1115ce){if(_0x45bb11[_0x004d('0x5c')][_0x004d('0x29')]===_0x004d('0x2b'))return _0x1115ce;if(_0x45bb11[_0x004d('0x2b')][_0x004d('0x29')]!=='user')return _0x1115ce;var _0x1cfa55=_[_0x004d('0x8a')](_0x1115ce,function(_0x40e966){return _0x40e966[_0x004d('0x29')]==='agent'||_0x40e966[_0x004d('0x29')]===_0x004d('0x2d');});if(!_0x1cfa55)return _0x1115ce;return db['UserProfileSection'][_0x004d('0x45')]({'where':{'name':{'$or':['Agents',_0x004d('0x2c')]},'userProfileId':_0x45bb11[_0x004d('0x2b')]['userProfileId']},'raw':!![]})[_0x004d('0x13')](function(_0x2245a4){if(_['isEmpty'](_0x2245a4)||!_[_0x004d('0x8a')](_0x2245a4,[_0x004d('0x86'),0x0]))return _0x1115ce;_0x5ddd27=[];var _0x14344d=_(_0x2245a4)[_0x004d('0x2f')](function(_0x48fc8d){if(_0x48fc8d['autoAssociation']===0x1)return;return _0x48fc8d[_0x004d('0x32')]===_0x004d('0x85')?_0x004d('0x26'):_0x004d('0x2d');})[_0x004d('0x8b')]()[_0x004d('0x30')]();for(var _0x5a1411=0x0;_0x5a1411<_0x1115ce[_0x004d('0x48')];_0x5a1411++){if(!_[_0x004d('0x39')](_0x14344d,_0x1115ce[_0x5a1411][_0x004d('0x29')]))return;var _0x20f77a=_0x1115ce[_0x5a1411]['role']===_0x004d('0x26')?_0x004d('0x85'):_0x004d('0x2c');_0x5ddd27[_0x004d('0x44')](db[_0x004d('0x33')][_0x004d('0x7f')]({'name':_0x1115ce[_0x5a1411]['name'],'resourceId':_0x1115ce[_0x5a1411]['id'],'type':_0x20f77a,'sectionId':_[_0x004d('0x31')](_0x2245a4,[_0x004d('0x32'),_0x20f77a])['id']},{}));}return Promise['all'](_0x5ddd27);});})['then'](respondWithResult(_0x59cf96,0xc9))[_0x004d('0x51')](handleError(_0x59cf96,null));};exports[_0x004d('0x8c')]=function(_0x24d4bd,_0x1b1bab){if(_0x24d4bd['body']['id']){delete _0x24d4bd[_0x004d('0x5c')]['id'];}return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x24d4bd[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](function(_0x1301f7){if(!_0x1301f7)return null;if(_0x1301f7['id']===_0x24d4bd['user']['id']){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')]||!_0x24d4bd['body'][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x91'));}if(!_0x1301f7[_0x004d('0x92')](_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x93'));}if(_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8d')]===_0x24d4bd['body'][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x94'));}}else if(_0x24d4bd['user']['role']===_0x004d('0x2a')){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]){throw new db[(_0x004d('0x8f'))]['ValidationError'](_0x004d('0x95'));}}else if(_0x24d4bd[_0x004d('0x2b')][_0x004d('0x29')]===_0x004d('0x2b')){if(!_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]){throw new db['Sequelize'][(_0x004d('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1301f7[_0x004d('0x29')]!==_0x004d('0x26')){throw new db[(_0x004d('0x8f'))]['ValidationError'](_0x004d('0x89'));}}else{throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x89'));}return _0x1301f7;})['then'](handleEntityNotFound(_0x1b1bab,null))[_0x004d('0x13')](function(_0x4eb357){return db[_0x004d('0x63')]['findOne']({'attributes':['id',_0x004d('0x65'),_0x004d('0x96'),'passwordHistoryLimit']})['then'](function(_0x6a98e6){if(_0x6a98e6[_0x004d('0x65')])authService[_0x004d('0x66')](_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')]);if(!_0x6a98e6['enforcePasswordHistory']||!_0x4eb357[_0x004d('0x97')])return _0x4eb357;authService[_0x004d('0x98')](_0x24d4bd[_0x004d('0x5c')]['newPassword'],_0x4eb357[_0x004d('0x97')],_0x6a98e6[_0x004d('0x99')]);return _0x4eb357;})[_0x004d('0x13')](saveUpdates({'password':_0x24d4bd[_0x004d('0x5c')][_0x004d('0x8e')],'passwordResetAt':_0x24d4bd[_0x004d('0x2b')]['id']==_0x24d4bd['params']['id']?moment():null,'previousPasswords':authService[_0x004d('0x9a')](_0x24d4bd[_0x004d('0x5c')]['newPassword'],_0x4eb357[_0x004d('0x97')])},null));})['then'](respondWithResult(_0x1b1bab,null))[_0x004d('0x51')](handleError(_0x1b1bab,null));};exports[_0x004d('0x9b')]=function(_0x149f4c,_0x42dde0){var _0x5a4238=_0x149f4c['body'][_0x004d('0x9c')];return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x149f4c[_0x004d('0x5d')]['id']},'attributes':['id','name',_0x004d('0x29'),'online','loginInPause','voicePause',_0x004d('0x9d')]})[_0x004d('0x13')](handleEntityNotFound(_0x42dde0,null))['then'](function(_0x2105be){if(_0x2105be){if(!utils[_0x004d('0x9e')](_0x5a4238)){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}return _0x2105be[_0x004d('0xa0')+_[_0x004d('0xa1')](_0x5a4238[_0x004d('0xa2')]())+_0x004d('0xa3')](_0x149f4c[_0x004d('0x5c')][_0x004d('0x60')],{'penalty':_0x149f4c[_0x004d('0x5c')][_0x004d('0xa4')]||0x0})[_0x004d('0xa5')](function(_0x5bdd20){for(var _0xd991b6=0x0;_0xd991b6<_0x149f4c[_0x004d('0x5c')]['ids'][_0x004d('0x48')];_0xd991b6+=0x1){var _0x59b2f6={'UserId':Number(_0x149f4c[_0x004d('0x5d')]['id'])};_0x59b2f6[_['capitalize'](_0x5a4238[_0x004d('0xa2')]())+'QueueId']=Number(_0x149f4c[_0x004d('0x5c')]['ids'][_0xd991b6]);socket[_0x004d('0xa6')](_0x004d('0x2b')+_[_0x004d('0xa1')](_0x5a4238[_0x004d('0xa2')]())+_0x004d('0xa7'),_0x59b2f6);}return _0x5bdd20;})[_0x004d('0x13')](function(){if(_0x5a4238===_0x004d('0xa8')){return db[_0x004d('0xa9')][_0x004d('0x45')]({'where':{'id':_0x149f4c['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1bd59d){var _0x4fdc02=_0x2105be[_0x004d('0x28')]({'plain':!![]});var _0x156f24=[];if(_0x5a4238==='voice'&&_0x4fdc02[_0x004d('0x29')]===_0x004d('0x26')&&_0x4fdc02[_0x004d('0xaa')]){for(let _0x948020=0x0;_0x948020<_0x1bd59d[_0x004d('0x48')];_0x948020+=0x1){_0x156f24[_0x004d('0x44')]({'membername':_0x4fdc02[_0x004d('0x32')],'UserId':_0x4fdc02['id'],'queue_name':_0x1bd59d[_0x948020][_0x004d('0x32')],'VoiceQueueId':_0x1bd59d[_0x948020]['id'],'interface':_[_0x004d('0x67')](_0x4fdc02[_0x004d('0x9d')])?util['format']('SIP/%s',_0x4fdc02[_0x004d('0x32')]):_0x4fdc02[_0x004d('0x9d')],'paused':_0x4fdc02['voicePause']||![],'penalty':_0x149f4c[_0x004d('0x5c')][_0x004d('0xa4')]||0x0});}return Promise[_0x004d('0x50')](_0x156f24[_0x004d('0x2f')](function(_0x6bcc85){return db['UserVoiceQueueRt']['upsert'](_0x6bcc85);}));}return _0x2105be;});}})['then'](respondWithStatusCode(_0x42dde0,null))['catch'](handleError(_0x42dde0,null));};exports[_0x004d('0xab')]=function(_0x2c870f,_0x1f0eb7){var _0x359eec,_0x49734f;return db['User'][_0x004d('0x31')]({'where':{'id':_0x2c870f[_0x004d('0x5d')]['id']},'attributes':['id',_0x004d('0x32'),_0x004d('0x29')]})['then'](handleEntityNotFound(_0x1f0eb7,null))[_0x004d('0x13')](function(_0x2b9af5){if(_0x2b9af5){_0x359eec=_0x2b9af5;if(!_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')]||!utils[_0x004d('0x9e')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}return _0x2b9af5[_0x004d('0xac')+_['capitalize'](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+'Queues'](_0x2c870f[_0x004d('0x3d')]['ids']);}})[_0x004d('0x13')](function(_0x3605b0){if(_['isArray'](_0x2c870f['query'][_0x004d('0x60')])){for(var _0x1043ed=0x0;_0x1043ed<_0x2c870f[_0x004d('0x3d')]['ids'][_0x004d('0x48')];_0x1043ed+=0x1){_0x49734f={'UserId':Number(_0x2c870f[_0x004d('0x5d')]['id'])};_0x49734f[_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')]['channel'][_0x004d('0xa2')]())+_0x004d('0xad')]=Number(_0x2c870f[_0x004d('0x3d')]['ids'][_0x1043ed]);socket[_0x004d('0xa6')]('user'+_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+'Queue:remove',_0x49734f);}}else{_0x49734f={'UserId':Number(_0x2c870f[_0x004d('0x5d')]['id'])};_0x49734f[_[_0x004d('0xa1')](_0x2c870f[_0x004d('0x3d')][_0x004d('0x9c')][_0x004d('0xa2')]())+_0x004d('0xad')]=Number(_0x2c870f[_0x004d('0x3d')][_0x004d('0x60')]);socket[_0x004d('0xa6')](_0x004d('0x2b')+_[_0x004d('0xa1')](_0x2c870f['query'][_0x004d('0x9c')][_0x004d('0xa2')]())+_0x004d('0xae'),_0x49734f);}return _0x3605b0;})[_0x004d('0x13')](function(){if(_0x2c870f['query'][_0x004d('0x9c')]===_0x004d('0xa8')){return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'UserId':_0x2c870f[_0x004d('0x5d')]['id'],'VoiceQueueId':_0x2c870f['query']['ids']},'individualHooks':!![]})[_0x004d('0x13')](function(){return _0x359eec;});}return _0x359eec;})[_0x004d('0x13')](respondWithStatusCode(_0x1f0eb7,null))[_0x004d('0x51')](handleError(_0x1f0eb7,null));};exports['addAvatar']=function(_0x4c0ce6,_0x14a626){_0x4c0ce6[_0x004d('0x5c')][_0x004d('0xb1')]=_0x4c0ce6['file']['filename'];return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x4c0ce6[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x14a626,null))[_0x004d('0x13')](saveUpdates(_0x4c0ce6['body'],null))['then'](respondWithResult(_0x14a626,null))[_0x004d('0x51')](handleError(_0x14a626,null));};exports['getAvatar']=function(_0x3b5e08,_0xc3f03a){var _0x221f58=path[_0x004d('0xb2')](config[_0x004d('0xb3')],'server/files/images/logos/default_profile.png');return db['User']['find']({'where':{'id':_0x3b5e08[_0x004d('0x5d')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xc3f03a,null))[_0x004d('0x13')](function(_0x562a0e){if(_0x562a0e){if(_[_0x004d('0x67')](_0x562a0e[_0x004d('0xb1')])){return _0xc3f03a['download'](_0x221f58);}else{if(!fs['existsSync'](path['join'](config['root'],'server/files/images/',_0x562a0e[_0x004d('0xb1')]))){return _0xc3f03a[_0x004d('0xb4')](_0x221f58);}return _0xc3f03a[_0x004d('0xb4')](path[_0x004d('0xb2')](config[_0x004d('0xb3')],'server/files/images/',_0x562a0e[_0x004d('0xb1')]));}}})['catch'](handleError(_0xc3f03a,null));};exports['getOpenTabs']=function(_0x5c5ce9,_0x81ac40){return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x5c5ce9['params']['id']},'attributes':['id']})[_0x004d('0x13')](handleEntityNotFound(_0x81ac40,null))[_0x004d('0x13')](function(_0x212d92){var _0x6bfd70=[];values=_0x212d92['dataValues'];_0x6bfd70[_0x004d('0x44')](get_open_tabs(_0x004d('0x49'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70[_0x004d('0x44')](get_open_tabs(_0x004d('0x4a'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs('openchannel',_0x212d92['dataValues']));_0x6bfd70['push'](get_open_tabs(_0x004d('0x4f'),_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs('fax',_0x212d92[_0x004d('0x4b')]));_0x6bfd70['push'](get_open_tabs(_0x004d('0x4d'),_0x212d92['dataValues']));return Promise['all'](_0x6bfd70);})[_0x004d('0x13')](function(_0x1c35d8){if(_0x1c35d8){var _0x1c96b8=_[_0x004d('0x2f')](values[_0x004d('0xb5')],function(_0x4ed4c6){return{'channel':_0x004d('0xb6'),'id':_0x4ed4c6['id'],'createdAt':_0x4ed4c6['createdAt']};});var _0x51c681=_[_0x004d('0x2f')](values['FaxOpenTabs'],function(_0x416539){return{'channel':_0x004d('0xb7'),'id':_0x416539['id'],'createdAt':_0x416539[_0x004d('0xb8')]};});var _0x10a699=_[_0x004d('0x2f')](values[_0x004d('0xb9')],function(_0x2f0917){return{'channel':_0x004d('0xba'),'id':_0x2f0917['id'],'createdAt':_0x2f0917['createdAt']};});var _0x492a9d=_[_0x004d('0x2f')](values['MailOpenTabs'],function(_0x54c5bf){return{'channel':_0x004d('0xbb'),'id':_0x54c5bf['id'],'createdAt':_0x54c5bf['createdAt']};});var _0xcdb67a=_[_0x004d('0x2f')](values[_0x004d('0xbc')],function(_0x1b68be){return{'channel':_0x004d('0xbd'),'id':_0x1b68be['id'],'createdAt':_0x1b68be[_0x004d('0xb8')]};});var _0x3d9fd5=_[_0x004d('0x2f')](values[_0x004d('0xbe')],function(_0x444e59){return{'channel':_0x004d('0xbf'),'id':_0x444e59['id'],'createdAt':_0x444e59[_0x004d('0xb8')]};});var _0x1db921=_[_0x004d('0xc0')](_0x1c96b8,_0x51c681,_0x10a699,_0x492a9d,_0xcdb67a,_0x3d9fd5);var _0x54eec8={'count':_0x1db921[_0x004d('0x48')],'rows':_0x1db921};return _0x54eec8;}else return null;})['then'](respondWithResult(_0x81ac40,null))[_0x004d('0x51')](handleError(_0x81ac40,null));};exports[_0x004d('0xc1')]=function(_0x4b1e8f,_0x5a3ae2){var _0x3f00ef={};var _0x100df5={};var _0x4c9b83;var _0x35f025;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x4b1e8f[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x5a3ae2,null))[_0x004d('0x13')](function(_0x741033){if(_0x741033){_0x4c9b83=_0x741033;_0x100df5[_0x004d('0x53')]=_['keys'](db[_0x004d('0xc3')]['rawAttributes']);_0x100df5[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x4b1e8f[_0x004d('0x3d')]);_0x100df5['filters']=_['intersection'](_0x100df5[_0x004d('0x53')],_0x100df5['query']);_0x3f00ef['attributes']=_[_0x004d('0x58')](_0x100df5['model'],qs[_0x004d('0x59')](_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x59')]));_0x3f00ef[_0x004d('0x43')]=_0x3f00ef[_0x004d('0x43')]['length']?_0x3f00ef[_0x004d('0x43')]:_0x100df5[_0x004d('0x53')];_0x3f00ef[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4b1e8f['query'][_0x004d('0xc5')]);_0x3f00ef[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x4b1e8f[_0x004d('0x3d')],_0x100df5[_0x004d('0xc6')]));if(_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x2e')]){_0x3f00ef[_0x004d('0x3c')]=_['merge'](_0x3f00ef[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x3f00ef[_0x004d('0x43')],function(_0x637db6){var _0x339e10={};_0x339e10[_0x637db6]={'$like':'%'+_0x4b1e8f[_0x004d('0x3d')]['filter']+'%'};return _0x339e10;})});}_0x3f00ef=_[_0x004d('0x5a')]({},_0x3f00ef,_0x4b1e8f[_0x004d('0x5b')]);return _0x4c9b83[_0x004d('0xc1')](_0x3f00ef);}})[_0x004d('0x13')](function(_0x3797b4){if(_0x3797b4){_0x35f025=_0x3797b4[_0x004d('0x48')];if(_0x4b1e8f[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0x3e'))){_0x3f00ef[_0x004d('0x41')]=[{'model':db[_0x004d('0xc9')],'as':_0x004d('0xca'),'required':![]},{'model':db[_0x004d('0xcb')],'as':_0x004d('0xcc'),'attributes':['id',_0x004d('0x32'),_0x004d('0xcd')],'where':_0x4b1e8f[_0x004d('0x3d')][_0x004d('0xce')]?{'id':_0x4b1e8f[_0x004d('0x3d')]['tag']}:undefined,'required':_0x4b1e8f[_0x004d('0x3d')]['tag']?!![]:![]}];}if(!_0x4b1e8f[_0x004d('0x3d')]['hasOwnProperty'](_0x004d('0xcf'))){_0x3f00ef[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x4b1e8f[_0x004d('0x3d')]['limit']);_0x3f00ef['offset']=qs[_0x004d('0x22')](_0x4b1e8f[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x4c9b83['getContacts'](_0x3f00ef);}})[_0x004d('0x13')](function(_0x2f60d2){if(_0x2f60d2){return _0x2f60d2?{'count':_0x35f025,'rows':_0x2f60d2}:null;}})[_0x004d('0x13')](respondWithResult(_0x5a3ae2,null))[_0x004d('0x51')](handleError(_0x5a3ae2,null));};exports['getQueues']=function(_0x421595,_0x49c8da){var _0x498083;var _0x1682a0={};var _0x4b8fbc;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x421595[_0x004d('0x5d')]['id']},'attributes':['id',_0x004d('0x32'),'role']})['then'](handleEntityNotFound(_0x49c8da,null))[_0x004d('0x13')](function(_0x2e9e40){if(!utils[_0x004d('0x9e')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])){throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0x9f'));}_0x498083=_0x2e9e40;var _0x492309={};_0x492309['model']=_['keys'](db[_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x56')]);_0x492309[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x421595[_0x004d('0x3d')]);_0x492309[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x492309[_0x004d('0x53')],_0x492309[_0x004d('0x3d')]);_0x1682a0[_0x004d('0x43')]=_[_0x004d('0x58')](_0x492309[_0x004d('0x53')],qs[_0x004d('0x59')](_0x421595['query'][_0x004d('0x59')]));_0x1682a0[_0x004d('0x43')]=_0x1682a0[_0x004d('0x43')][_0x004d('0x48')]?_0x1682a0[_0x004d('0x43')]:_0x492309['model'];_0x1682a0[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x421595[_0x004d('0x3d')][_0x004d('0xc5')]);_0x1682a0[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x421595[_0x004d('0x3d')],_0x492309['filters']));if(_0x421595['query'][_0x004d('0x2e')]){_0x1682a0[_0x004d('0x3c')]=_['merge'](_0x1682a0[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x1682a0['attributes'],function(_0x3a59eb){var _0x233f0f={};_0x233f0f[_0x3a59eb]={'$like':'%'+_0x421595[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x233f0f;})});}_0x1682a0=_[_0x004d('0x5a')]({},_0x1682a0,_0x421595[_0x004d('0x5b')]);switch(_0x498083['role']){case'admin':return db[_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x45')](_0x1682a0);case _0x004d('0x2b'):case _0x004d('0x26'):return _0x498083['get'+_['capitalize'](_0x421595[_0x004d('0x3d')]['channel'])+'Queues'](_0x1682a0);default:throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0xd1'));}})['then'](function(_0x6c74e9){_0x4b8fbc=_0x6c74e9[_0x004d('0x48')];if(!_0x421595[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x1682a0[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x421595['query'][_0x004d('0x23')]);_0x1682a0['offset']=qs[_0x004d('0x22')](_0x421595[_0x004d('0x3d')]['offset']);}switch(_0x498083[_0x004d('0x29')]){case _0x004d('0x2a'):return db[_['capitalize'](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xd0')][_0x004d('0x45')](_0x1682a0);case _0x004d('0x2b'):case _0x004d('0x26'):return _0x498083[_0x004d('0x28')+_[_0x004d('0xa1')](_0x421595[_0x004d('0x3d')][_0x004d('0x9c')])+_0x004d('0xa3')](_0x1682a0);}})[_0x004d('0x13')](function(_0x481d51){return{'count':_0x4b8fbc,'rows':_0x481d51};})['then'](respondWithResult(_0x49c8da,null))[_0x004d('0x51')](handleError(_0x49c8da,null));};exports[_0x004d('0xd2')]=function(_0x326fe4,_0x5bc097){var _0x93df4e={};var _0x2e06f6={};var _0x36f91b;var _0x477482;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x326fe4[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5bc097,null))['then'](function(_0x2705fb){if(_0x2705fb){_0x36f91b=_0x2705fb;_0x2e06f6[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xaf')][_0x004d('0x56')]);_0x2e06f6[_0x004d('0x3d')]=_['keys'](_0x326fe4['query']);_0x2e06f6[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x2e06f6[_0x004d('0x53')],_0x2e06f6[_0x004d('0x3d')]);_0x93df4e[_0x004d('0x43')]=_[_0x004d('0x58')](_0x2e06f6[_0x004d('0x53')],qs['fields'](_0x326fe4[_0x004d('0x3d')][_0x004d('0x59')]));_0x93df4e[_0x004d('0x43')]=_0x93df4e[_0x004d('0x43')][_0x004d('0x48')]?_0x93df4e[_0x004d('0x43')]:_0x2e06f6[_0x004d('0x53')];_0x93df4e[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x326fe4[_0x004d('0x3d')]['sort']);_0x93df4e[_0x004d('0x3c')]=qs['filters'](_[_0x004d('0xc7')](_0x326fe4['query'],_0x2e06f6[_0x004d('0xc6')]));if(_0x326fe4['query'][_0x004d('0x2e')]){_0x93df4e[_0x004d('0x3c')]=_['merge'](_0x93df4e[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x93df4e[_0x004d('0x43')],function(_0x2e12bd){var _0xda25b2={};_0xda25b2[_0x2e12bd]={'$like':'%'+_0x326fe4[_0x004d('0x3d')]['filter']+'%'};return _0xda25b2;})});}_0x93df4e=_[_0x004d('0x5a')]({},_0x93df4e,_0x326fe4[_0x004d('0x5b')]);return _0x36f91b[_0x004d('0xd2')](_0x93df4e);}})['then'](function(_0x347d55){if(_0x347d55){_0x477482=_0x347d55[_0x004d('0x48')];if(!_0x326fe4['query'][_0x004d('0xc8')](_0x004d('0xcf'))){_0x93df4e[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x326fe4[_0x004d('0x3d')][_0x004d('0x23')]);_0x93df4e['offset']=qs[_0x004d('0x22')](_0x326fe4['query'][_0x004d('0x22')]);}return _0x36f91b['getVoiceQueuesRt'](_0x93df4e);}})['then'](function(_0x562d6a){if(_0x562d6a){return _0x562d6a?{'count':_0x477482,'rows':_0x562d6a}:null;}})[_0x004d('0x13')](respondWithResult(_0x5bc097,null))['catch'](handleError(_0x5bc097,null));};exports[_0x004d('0xd3')]=function(_0x5747c4,_0x4359d6){var _0x443e74={};var _0x5039c4={};var _0x5048c1;var _0x527a70;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x5747c4[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x4359d6,null))[_0x004d('0x13')](function(_0x5ddc0f){if(_0x5ddc0f){_0x5048c1=_0x5ddc0f;_0x5039c4[_0x004d('0x53')]=_['keys'](db[_0x004d('0xd4')][_0x004d('0x56')]);_0x5039c4['query']=_[_0x004d('0x55')](_0x5747c4['query']);_0x5039c4['filters']=_['intersection'](_0x5039c4[_0x004d('0x53')],_0x5039c4[_0x004d('0x3d')]);_0x443e74[_0x004d('0x43')]=_[_0x004d('0x58')](_0x5039c4[_0x004d('0x53')],qs[_0x004d('0x59')](_0x5747c4[_0x004d('0x3d')][_0x004d('0x59')]));_0x443e74['attributes']=_0x443e74[_0x004d('0x43')][_0x004d('0x48')]?_0x443e74['attributes']:_0x5039c4[_0x004d('0x53')];_0x443e74[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x5747c4[_0x004d('0x3d')][_0x004d('0xc5')]);_0x443e74[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x5747c4[_0x004d('0x3d')],_0x5039c4['filters']));if(_0x5747c4[_0x004d('0x3d')][_0x004d('0x2e')]){_0x443e74[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x443e74[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x443e74[_0x004d('0x43')],function(_0x45f0e9){var _0x30b854={};_0x30b854[_0x45f0e9]={'$like':'%'+_0x5747c4[_0x004d('0x3d')]['filter']+'%'};return _0x30b854;})});}_0x443e74=_['merge']({},_0x443e74,_0x5747c4[_0x004d('0x5b')]);return _0x5048c1[_0x004d('0xd3')](_0x443e74);}})[_0x004d('0x13')](function(_0x4e9aa0){if(_0x4e9aa0){_0x527a70=_0x4e9aa0['length'];if(!_0x5747c4['query'][_0x004d('0xc8')]('nolimit')){_0x443e74[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x5747c4['query'][_0x004d('0x23')]);_0x443e74[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x5747c4[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x5048c1[_0x004d('0xd3')](_0x443e74);}})[_0x004d('0x13')](function(_0x5ea072){if(_0x5ea072){return _0x5ea072?{'count':_0x527a70,'rows':_0x5ea072}:null;}})[_0x004d('0x13')](respondWithResult(_0x4359d6,null))[_0x004d('0x51')](handleError(_0x4359d6,null));};exports[_0x004d('0xd5')]=function(_0x501e54,_0x239ae9){var _0x423491={'raw':!![],'where':{}};var _0x533768={};var _0x4a9276={'count':0x0,'rows':[]};return db['User'][_0x004d('0xc2')]({'where':{'id':_0x501e54[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x239ae9,null))[_0x004d('0x13')](function(_0x544b5b){if(_0x544b5b){_0x533768[_0x004d('0x53')]=_['keys'](db['VoiceRecording'][_0x004d('0x56')]);_0x533768[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x501e54[_0x004d('0x3d')]);_0x533768[_0x004d('0xc6')]=_['intersection'](_0x533768[_0x004d('0x53')],_0x533768[_0x004d('0x3d')]);_0x423491[_0x004d('0x43')]=_[_0x004d('0x58')](_0x533768[_0x004d('0x53')],qs[_0x004d('0x59')](_0x501e54[_0x004d('0x3d')][_0x004d('0x59')]));_0x423491[_0x004d('0x43')]=_0x423491[_0x004d('0x43')]['length']?_0x423491[_0x004d('0x43')]:_0x533768[_0x004d('0x53')];if(!_0x501e54[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x423491[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x501e54[_0x004d('0x3d')][_0x004d('0x23')]);_0x423491['offset']=qs[_0x004d('0x22')](_0x501e54['query'][_0x004d('0x22')]);}_0x423491[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x501e54['query']['sort']);_0x423491[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x501e54[_0x004d('0x3d')],_0x533768[_0x004d('0xc6')]));_0x423491[_0x004d('0x3c')]['UserId']=_0x544b5b['id'];if(_0x501e54[_0x004d('0x3d')][_0x004d('0x2e')]){_0x423491[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x423491['where'],{'$or':_[_0x004d('0x2f')](_0x423491[_0x004d('0x43')],function(_0x510906){var _0x5b1bd5={};_0x5b1bd5[_0x510906]={'$like':'%'+_0x501e54[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x5b1bd5;})});}_0x423491=_[_0x004d('0x5a')]({},_0x423491,_0x501e54['options']);return db[_0x004d('0xd6')][_0x004d('0x21')]({'where':_0x423491[_0x004d('0x3c')]})[_0x004d('0x13')](function(_0x226789){_0x4a9276['count']=_0x226789;if(_0x501e54[_0x004d('0x3d')][_0x004d('0x3e')]){_0x423491[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xd6')][_0x004d('0x45')](_0x423491);})['then'](function(_0x5d4c29){_0x4a9276[_0x004d('0x46')]=_0x5d4c29;return _0x4a9276;});}})['then'](respondWithFilteredResult(_0x239ae9,_0x423491))['catch'](handleError(_0x239ae9,null));};exports['getScreenRecordings']=function(_0x4414f4,_0x3ef1d8){var _0x2ccbb5={'raw':!![],'where':{}};var _0x592693={};var _0x488a33={'count':0x0,'rows':[]};return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x4414f4[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3ef1d8,null))[_0x004d('0x13')](function(_0x6d493d){if(_0x6d493d){_0x592693['model']=_[_0x004d('0x55')](db[_0x004d('0xd7')]['rawAttributes']);_0x592693[_0x004d('0x3d')]=_['keys'](_0x4414f4[_0x004d('0x3d')]);_0x592693[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x592693[_0x004d('0x53')],_0x592693[_0x004d('0x3d')]);_0x2ccbb5[_0x004d('0x43')]=_[_0x004d('0x58')](_0x592693[_0x004d('0x53')],qs[_0x004d('0x59')](_0x4414f4[_0x004d('0x3d')]['fields']));_0x2ccbb5['attributes']=_0x2ccbb5[_0x004d('0x43')]['length']?_0x2ccbb5[_0x004d('0x43')]:_0x592693[_0x004d('0x53')];if(!_0x4414f4[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x2ccbb5[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x4414f4[_0x004d('0x3d')]['limit']);_0x2ccbb5[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x4414f4[_0x004d('0x3d')][_0x004d('0x22')]);}_0x2ccbb5[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4414f4['query'][_0x004d('0xc5')]);_0x2ccbb5[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x4414f4[_0x004d('0x3d')],_0x592693['filters']));_0x2ccbb5['where'][_0x004d('0xd8')]=_0x6d493d['id'];if(_0x4414f4[_0x004d('0x3d')][_0x004d('0x2e')]){_0x2ccbb5[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x2ccbb5[_0x004d('0x3c')],{'$or':_['map'](_0x2ccbb5[_0x004d('0x43')],function(_0x5039e3){var _0x209539={};_0x209539[_0x5039e3]={'$like':'%'+_0x4414f4[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x209539;})});}_0x2ccbb5=_['merge']({},_0x2ccbb5,_0x4414f4['options']);return db[_0x004d('0xd7')][_0x004d('0x21')]({'where':_0x2ccbb5[_0x004d('0x3c')]})[_0x004d('0x13')](function(_0x356213){_0x488a33[_0x004d('0x21')]=_0x356213;if(_0x4414f4[_0x004d('0x3d')][_0x004d('0x3e')]){_0x2ccbb5[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xd7')][_0x004d('0x45')](_0x2ccbb5);})['then'](function(_0x144eba){_0x488a33[_0x004d('0x46')]=_0x144eba;return _0x488a33;});}})[_0x004d('0x13')](respondWithFilteredResult(_0x3ef1d8,_0x2ccbb5))['catch'](handleError(_0x3ef1d8,null));};exports['getChatInteractions']=function(_0x3b4fec,_0x1b49ce){var _0x2881da={};var _0x34d590={};var _0x42d37a;var _0x43fedf;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x3b4fec[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x1b49ce,null))[_0x004d('0x13')](function(_0x44a14b){if(_0x44a14b){_0x42d37a=_0x44a14b;_0x34d590[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xd9')]['rawAttributes']);_0x34d590[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x3b4fec[_0x004d('0x3d')]);_0x34d590[_0x004d('0xc6')]=_['intersection'](_0x34d590[_0x004d('0x53')],_0x34d590[_0x004d('0x3d')]);_0x2881da['attributes']=_[_0x004d('0x58')](_0x34d590[_0x004d('0x53')],qs['fields'](_0x3b4fec[_0x004d('0x3d')][_0x004d('0x59')]));_0x2881da[_0x004d('0x43')]=_0x2881da[_0x004d('0x43')][_0x004d('0x48')]?_0x2881da[_0x004d('0x43')]:_0x34d590[_0x004d('0x53')];_0x2881da[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x3b4fec[_0x004d('0x3d')][_0x004d('0xc5')]);_0x2881da[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x3b4fec[_0x004d('0x3d')],_0x34d590[_0x004d('0xc6')]));if(_0x3b4fec['query'][_0x004d('0x2e')]){_0x2881da['where']=_[_0x004d('0x5a')](_0x2881da['where'],{'$or':_[_0x004d('0x2f')](_0x2881da[_0x004d('0x43')],function(_0x14707b){var _0x5cf78e={};_0x5cf78e[_0x14707b]={'$like':'%'+_0x3b4fec[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x5cf78e;})});}_0x2881da=_['merge']({},_0x2881da,_0x3b4fec[_0x004d('0x5b')]);return _0x42d37a[_0x004d('0xda')](_0x2881da);}})[_0x004d('0x13')](function(_0x1a7d40){if(_0x1a7d40){_0x43fedf=_0x1a7d40[_0x004d('0x48')];if(!_0x3b4fec[_0x004d('0x3d')]['hasOwnProperty'](_0x004d('0xcf'))){_0x2881da[_0x004d('0x23')]=qs['limit'](_0x3b4fec['query'][_0x004d('0x23')]);_0x2881da[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x3b4fec[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x42d37a[_0x004d('0xda')](_0x2881da);}})[_0x004d('0x13')](function(_0x2a4766){if(_0x2a4766){return _0x2a4766?{'count':_0x43fedf,'rows':_0x2a4766}:null;}})['then'](respondWithResult(_0x1b49ce,null))['catch'](handleError(_0x1b49ce,null));};exports['getOpenchannelInteractions']=function(_0x2cc2ec,_0x2a88ce){var _0x1af681={};var _0x3ce052={};var _0x453c19;var _0x388f5c;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x2cc2ec[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2a88ce,null))[_0x004d('0x13')](function(_0x43ff3e){if(_0x43ff3e){_0x453c19=_0x43ff3e;_0x3ce052[_0x004d('0x53')]=_[_0x004d('0x55')](db['OpenchannelInteraction'][_0x004d('0x56')]);_0x3ce052['query']=_['keys'](_0x2cc2ec[_0x004d('0x3d')]);_0x3ce052[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x3ce052[_0x004d('0x53')],_0x3ce052[_0x004d('0x3d')]);_0x1af681['attributes']=_['intersection'](_0x3ce052[_0x004d('0x53')],qs[_0x004d('0x59')](_0x2cc2ec[_0x004d('0x3d')]['fields']));_0x1af681['attributes']=_0x1af681[_0x004d('0x43')][_0x004d('0x48')]?_0x1af681[_0x004d('0x43')]:_0x3ce052[_0x004d('0x53')];_0x1af681[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x2cc2ec['query'][_0x004d('0xc5')]);_0x1af681[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x2cc2ec[_0x004d('0x3d')],_0x3ce052[_0x004d('0xc6')]));if(_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x2e')]){_0x1af681['where']=_[_0x004d('0x5a')](_0x1af681[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x1af681[_0x004d('0x43')],function(_0x229c00){var _0x3b5cba={};_0x3b5cba[_0x229c00]={'$like':'%'+_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x3b5cba;})});}_0x1af681=_[_0x004d('0x5a')]({},_0x1af681,_0x2cc2ec[_0x004d('0x5b')]);return _0x453c19[_0x004d('0xdb')](_0x1af681);}})[_0x004d('0x13')](function(_0xcbe74a){if(_0xcbe74a){_0x388f5c=_0xcbe74a['length'];if(!_0x2cc2ec[_0x004d('0x3d')]['hasOwnProperty']('nolimit')){_0x1af681['limit']=qs['limit'](_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x23')]);_0x1af681[_0x004d('0x22')]=qs['offset'](_0x2cc2ec[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x453c19[_0x004d('0xdb')](_0x1af681);}})['then'](function(_0x1357a5){if(_0x1357a5){return _0x1357a5?{'count':_0x388f5c,'rows':_0x1357a5}:null;}})[_0x004d('0x13')](respondWithResult(_0x2a88ce,null))[_0x004d('0x51')](handleError(_0x2a88ce,null));};exports[_0x004d('0xdc')]=function(_0x564e9,_0x453a89){var _0x121ec1={'raw':!![],'where':{}};var _0x21b862={};var _0x916f4e={'count':0x0,'rows':[]};return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x564e9[_0x004d('0x5d')]['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x453a89,null))['then'](function(_0x4d5f8a){if(_0x4d5f8a){_0x21b862['model']=_[_0x004d('0x55')](db['MailInteraction'][_0x004d('0x56')]);_0x21b862[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x564e9[_0x004d('0x3d')]);_0x21b862['filters']=_[_0x004d('0x58')](_0x21b862[_0x004d('0x53')],_0x21b862[_0x004d('0x3d')]);_0x121ec1['attributes']=_['intersection'](_0x21b862[_0x004d('0x53')],qs[_0x004d('0x59')](_0x564e9[_0x004d('0x3d')][_0x004d('0x59')]));_0x121ec1[_0x004d('0x43')]=_0x121ec1[_0x004d('0x43')]['length']?_0x121ec1[_0x004d('0x43')]:_0x21b862[_0x004d('0x53')];if(!_0x564e9[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x121ec1[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x564e9[_0x004d('0x3d')]['limit']);_0x121ec1[_0x004d('0x22')]=qs['offset'](_0x564e9[_0x004d('0x3d')][_0x004d('0x22')]);}_0x121ec1[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x564e9['query'][_0x004d('0xc5')]);_0x121ec1[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x564e9[_0x004d('0x3d')],_0x21b862[_0x004d('0xc6')]));_0x121ec1[_0x004d('0x3c')][_0x004d('0xd8')]=_0x4d5f8a['id'];if(_0x564e9[_0x004d('0x3d')]['filter']){_0x121ec1['where']=_['merge'](_0x121ec1[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x121ec1[_0x004d('0x43')],function(_0x2e9b15){var _0x15f6e1={};_0x15f6e1[_0x2e9b15]={'$like':'%'+_0x564e9[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x15f6e1;})});}_0x121ec1=_[_0x004d('0x5a')]({},_0x121ec1,_0x564e9['options']);return db[_0x004d('0xdd')]['count']({'where':_0x121ec1['where']})[_0x004d('0x13')](function(_0x11780d){_0x916f4e[_0x004d('0x21')]=_0x11780d;if(_0x564e9[_0x004d('0x3d')]['includeAll']){_0x121ec1[_0x004d('0x41')]=[{'all':!![]}];}return db[_0x004d('0xdd')][_0x004d('0x45')](_0x121ec1);})[_0x004d('0x13')](function(_0x323cf7){_0x916f4e[_0x004d('0x46')]=_0x323cf7;return _0x916f4e;});}})[_0x004d('0x13')](respondWithFilteredResult(_0x453a89,_0x121ec1))[_0x004d('0x51')](handleError(_0x453a89,null));};exports[_0x004d('0xde')]=function(_0x43fdef,_0x38701e){var _0x3e8a0e={};var _0x379156={};var _0x7dcc13;var _0xe3f41b;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x43fdef['params']['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x38701e,null))['then'](function(_0x1c3288){if(_0x1c3288){_0x7dcc13=_0x1c3288;_0x379156['model']=_['keys'](db['SmsInteraction'][_0x004d('0x56')]);_0x379156['query']=_[_0x004d('0x55')](_0x43fdef['query']);_0x379156[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x379156[_0x004d('0x53')],_0x379156[_0x004d('0x3d')]);_0x3e8a0e['attributes']=_['intersection'](_0x379156[_0x004d('0x53')],qs[_0x004d('0x59')](_0x43fdef['query'][_0x004d('0x59')]));_0x3e8a0e[_0x004d('0x43')]=_0x3e8a0e[_0x004d('0x43')][_0x004d('0x48')]?_0x3e8a0e['attributes']:_0x379156[_0x004d('0x53')];_0x3e8a0e['order']=qs[_0x004d('0xc5')](_0x43fdef[_0x004d('0x3d')][_0x004d('0xc5')]);_0x3e8a0e[_0x004d('0x3c')]=qs['filters'](_['pick'](_0x43fdef[_0x004d('0x3d')],_0x379156[_0x004d('0xc6')]));if(_0x43fdef['query'][_0x004d('0x2e')]){_0x3e8a0e[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x3e8a0e[_0x004d('0x3c')],{'$or':_['map'](_0x3e8a0e[_0x004d('0x43')],function(_0x372ace){var _0x1ba561={};_0x1ba561[_0x372ace]={'$like':'%'+_0x43fdef[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x1ba561;})});}_0x3e8a0e=_[_0x004d('0x5a')]({},_0x3e8a0e,_0x43fdef['options']);return _0x7dcc13[_0x004d('0xde')](_0x3e8a0e);}})['then'](function(_0x13d8c6){if(_0x13d8c6){_0xe3f41b=_0x13d8c6['length'];if(!_0x43fdef[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x3e8a0e[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x43fdef[_0x004d('0x3d')][_0x004d('0x23')]);_0x3e8a0e['offset']=qs[_0x004d('0x22')](_0x43fdef[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x7dcc13['getSmsInteractions'](_0x3e8a0e);}})['then'](function(_0x26afd8){if(_0x26afd8){return _0x26afd8?{'count':_0xe3f41b,'rows':_0x26afd8}:null;}})[_0x004d('0x13')](respondWithResult(_0x38701e,null))[_0x004d('0x51')](handleError(_0x38701e,null));};exports['getFaxInteractions']=function(_0x388d7d,_0x4d7401){var _0x4be94e={};var _0x570cc7={};var _0x1a5853;var _0x5d8678;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x388d7d['params']['id']}})['then'](handleEntityNotFound(_0x4d7401,null))['then'](function(_0x4506f9){if(_0x4506f9){_0x1a5853=_0x4506f9;_0x570cc7[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xdf')][_0x004d('0x56')]);_0x570cc7[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x388d7d['query']);_0x570cc7['filters']=_['intersection'](_0x570cc7[_0x004d('0x53')],_0x570cc7[_0x004d('0x3d')]);_0x4be94e[_0x004d('0x43')]=_[_0x004d('0x58')](_0x570cc7['model'],qs[_0x004d('0x59')](_0x388d7d[_0x004d('0x3d')][_0x004d('0x59')]));_0x4be94e[_0x004d('0x43')]=_0x4be94e[_0x004d('0x43')][_0x004d('0x48')]?_0x4be94e[_0x004d('0x43')]:_0x570cc7['model'];_0x4be94e['order']=qs[_0x004d('0xc5')](_0x388d7d[_0x004d('0x3d')][_0x004d('0xc5')]);_0x4be94e[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x388d7d[_0x004d('0x3d')],_0x570cc7[_0x004d('0xc6')]));if(_0x388d7d[_0x004d('0x3d')][_0x004d('0x2e')]){_0x4be94e[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x4be94e[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x4be94e['attributes'],function(_0x5831fb){var _0x45853c={};_0x45853c[_0x5831fb]={'$like':'%'+_0x388d7d[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x45853c;})});}_0x4be94e=_[_0x004d('0x5a')]({},_0x4be94e,_0x388d7d[_0x004d('0x5b')]);return _0x1a5853['getFaxInteractions'](_0x4be94e);}})[_0x004d('0x13')](function(_0x32ab1c){if(_0x32ab1c){_0x5d8678=_0x32ab1c[_0x004d('0x48')];if(!_0x388d7d['query']['hasOwnProperty']('nolimit')){_0x4be94e['limit']=qs['limit'](_0x388d7d['query'][_0x004d('0x23')]);_0x4be94e[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x388d7d[_0x004d('0x3d')]['offset']);}return _0x1a5853['getFaxInteractions'](_0x4be94e);}})[_0x004d('0x13')](function(_0x16642a){if(_0x16642a){return _0x16642a?{'count':_0x5d8678,'rows':_0x16642a}:null;}})['then'](respondWithResult(_0x4d7401,null))[_0x004d('0x51')](handleError(_0x4d7401,null));};exports[_0x004d('0xe0')]=function(_0x3a4085,_0x29d550){var _0x514f47={};var _0x1f9454={};var _0x183d0e;var _0x5e0483;return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x3a4085[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x29d550,null))['then'](function(_0x485569){if(_0x485569){_0x183d0e=_0x485569;_0x1f9454[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0xe1')][_0x004d('0x56')]);_0x1f9454[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x3a4085[_0x004d('0x3d')]);_0x1f9454['filters']=_[_0x004d('0x58')](_0x1f9454[_0x004d('0x53')],_0x1f9454['query']);_0x514f47['attributes']=_['intersection'](_0x1f9454[_0x004d('0x53')],qs[_0x004d('0x59')](_0x3a4085[_0x004d('0x3d')][_0x004d('0x59')]));_0x514f47[_0x004d('0x43')]=_0x514f47[_0x004d('0x43')][_0x004d('0x48')]?_0x514f47['attributes']:_0x1f9454[_0x004d('0x53')];_0x514f47['order']=qs[_0x004d('0xc5')](_0x3a4085['query'][_0x004d('0xc5')]);_0x514f47[_0x004d('0x3c')]=qs['filters'](_[_0x004d('0xc7')](_0x3a4085['query'],_0x1f9454['filters']));if(_0x3a4085[_0x004d('0x3d')][_0x004d('0x2e')]){_0x514f47[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x514f47[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x514f47[_0x004d('0x43')],function(_0x1d1830){var _0x4b4d9a={};_0x4b4d9a[_0x1d1830]={'$like':'%'+_0x3a4085[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x4b4d9a;})});}_0x514f47=_[_0x004d('0x5a')]({},_0x514f47,_0x3a4085['options']);return _0x183d0e[_0x004d('0xe0')](_0x514f47);}})[_0x004d('0x13')](function(_0x1da578){if(_0x1da578){_0x5e0483=_0x1da578['length'];if(!_0x3a4085[_0x004d('0x3d')][_0x004d('0xc8')](_0x004d('0xcf'))){_0x514f47[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x3a4085[_0x004d('0x3d')]['limit']);_0x514f47[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x3a4085[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x183d0e[_0x004d('0xe0')](_0x514f47);}})['then'](function(_0x569d90){if(_0x569d90){return _0x569d90?{'count':_0x5e0483,'rows':_0x569d90}:null;}})['then'](respondWithResult(_0x29d550,null))['catch'](handleError(_0x29d550,null));};exports[_0x004d('0xe2')]=function(_0x3c28ca,_0x5607a9,_0x38be42){var _0x41fb6a;var _0x2998c4;var _0x4173cb;var _0x3a3126=!_[_0x004d('0x67')](_0x3c28ca[_0x004d('0x5d')]['id'])?_0x3c28ca[_0x004d('0x5d')]['id']:!_[_0x004d('0x67')](_0x3c28ca['user']['id'])?_0x3c28ca[_0x004d('0x2b')]['id']:null;return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x3a3126,'role':{'$or':[_0x004d('0x2a'),_0x004d('0x2b'),'agent']}},'attributes':['id',_0x004d('0x32'),_0x004d('0xe3'),_0x004d('0xe4'),_0x004d('0x29'),_0x004d('0x62'),_0x004d('0xe5')]})[_0x004d('0x13')](function(_0x2355a0){if(_0x2355a0){if(_0x2355a0[_0x004d('0x29')]===_0x004d('0x26')){_0x41fb6a=_0x2355a0;if(_0x3c28ca[_0x004d('0x5c')][_0x004d('0x9d')]){_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe7'),_0x41fb6a[_0x3c28ca[_0x004d('0x5c')]['interface']]);}else if(_0x3c28ca[_0x004d('0x5c')][_0x004d('0xe8')]){_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe9'),_0x3c28ca[_0x004d('0x5c')]['intrf']);}else{_0x4173cb=util[_0x004d('0xe6')](_0x004d('0xe9'),_0x41fb6a[_0x004d('0x32')]);}socket['to'](util['format'](_0x004d('0xea'),_0x41fb6a[_0x004d('0x32')]))[_0x004d('0xa6')](_0x004d('0xeb'),{'user':{'id':_0x41fb6a['id'],'name':_0x41fb6a[_0x004d('0x32')]},'ip':_0x3c28ca[_0x004d('0xec')][_0x004d('0xed')]||_0x3c28ca[_0x004d('0xee')][_0x004d('0xef')]||_0x3c28ca['socket']['remoteAddress']||_0x3c28ca[_0x004d('0xee')][_0x004d('0xf0')][_0x004d('0xef')]});return db[_0x004d('0xaf')]['destroy']({'where':{'membername':_0x41fb6a[_0x004d('0x32')]},'individualHooks':!![]});}}else{throw new db[(_0x004d('0x8f'))][(_0x004d('0x90'))](_0x004d('0xf1'));}})[_0x004d('0x13')](function(){if(_0x41fb6a){return _0x41fb6a[_0x004d('0xf2')]({'raw':!![]});}})['then'](function(_0x31e558){if(_0x41fb6a){if(_0x31e558){_0x2998c4=_0x31e558;if(_0x2998c4[_0x004d('0x48')]){var _0x3df8e5=_0x2998c4[_0x004d('0x2f')](function(_0x452051){var _0x167cf8={'membername':_0x41fb6a['name'],'UserId':_0x41fb6a['id'],'queue_name':_0x452051[_0x004d('0x32')],'VoiceQueueId':_0x452051['id'],'interface':_0x4173cb,'paused':_0x41fb6a[_0x004d('0xe5')]||![],'penalty':_0x452051[_0x004d('0xf3')]||0x0};return db[_0x004d('0xaf')][_0x004d('0xf4')](_0x167cf8);});return Promise[_0x004d('0x50')](_0x3df8e5);}}}})[_0x004d('0x13')](function(){if(_0x41fb6a){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x41fb6a['name'],'exitAt':null}});}})[_0x004d('0x13')](function(_0x32884b){if(_0x41fb6a){var _0x1850a9=[];_0x32884b['forEach'](function(_0x1f73f7){_0x1850a9['push'](_0x1f73f7[_0x004d('0xf6')]({'exitAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))}));});return Promise[_0x004d('0x50')](_0x1850a9);}})[_0x004d('0x13')](function(){if(_0x41fb6a){var _0x488d77=[];var _0x491695=[];var _0x41eb3e=utils['getChannels']();var _0x33f38c={'membername':_0x41fb6a[_0x004d('0x32')],'interface':_0x4173cb,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x41fb6a[_0x004d('0x29')],'internal':_0x41fb6a['internal']};_0x41eb3e[_0x004d('0xf8')](function(_0x11507b){_0x488d77[_0x004d('0x44')](_[_0x004d('0x5a')]({'channel':_0x11507b,'type':'LOGIN','data1':_0x3c28ca[_0x004d('0x5c')][_0x004d('0xf9')],'data2':_0x4173cb},_0x33f38c));if(_0x41fb6a['loginInPause']){_0x491695['push'](_['merge']({'channel':_0x11507b,'type':_0x004d('0xfa'),'data1':_0x004d('0xfb')},_0x33f38c));}});return db[_0x004d('0xf5')][_0x004d('0x88')](_0x488d77[_0x004d('0xc0')](_0x491695),{'individualHooks':!![]});}})[_0x004d('0x13')](function(){if(_0x41fb6a){return _0x41fb6a[_0x004d('0xf6')]({'online':!![],'lastLoginAt':moment()[_0x004d('0xe6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x41fb6a[_0x004d('0xe5')]||![],'mailPause':_0x41fb6a[_0x004d('0xe5')]||![],'chatPause':_0x41fb6a[_0x004d('0xe5')]||![],'faxPause':_0x41fb6a[_0x004d('0xe5')]||![],'smsPause':_0x41fb6a[_0x004d('0xe5')]||![],'openchannelPause':_0x41fb6a[_0x004d('0xe5')]||![],'whatsappPause':_0x41fb6a[_0x004d('0xe5')]||![],'pauseType':_0x41fb6a[_0x004d('0xe5')]?'LOGININPAUSE':null,'interface':_0x4173cb,'lastPauseAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))});}})[_0x004d('0x13')](function(_0x56b4d9){if(_0x3c28ca[_0x004d('0xfc')]){return _0x38be42();}else{return Promise[_0x004d('0xfd')](_0x56b4d9)[_0x004d('0x13')](respondWithResult(_0x5607a9,null));}})[_0x004d('0x51')](handleError(_0x5607a9,null));};exports['logout']=function(_0x455848,_0x37b20a){var _0x122956;return db['User']['find']({'where':{'id':_0x455848[_0x004d('0x5d')]['id'],'role':_0x004d('0x26')},'attributes':['id','name',_0x004d('0x29')]})[_0x004d('0x13')](handleEntityNotFound(_0x37b20a,null))[_0x004d('0x13')](function(_0x527cfa){if(_0x527cfa){_0x122956=_0x527cfa;return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'membername':_0x122956['name']},'individualHooks':!![]});}})[_0x004d('0x13')](function(){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x122956['name'],'exitAt':null}});})[_0x004d('0x13')](function(_0xf125c1){var _0x4d0bae=[];_0xf125c1[_0x004d('0xf8')](function(_0x38c57b){_0x4d0bae[_0x004d('0x44')](_0x38c57b['update']({'exitAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))}));});return Promise[_0x004d('0x50')](_0x4d0bae);})[_0x004d('0x13')](function(){return _0x122956['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x004d('0x13')](respondWithResult(_0x37b20a,null))[_0x004d('0x51')](handleError(_0x37b20a,null));};exports[_0x004d('0xfe')]=function(_0x1b9fe7,_0x3d9eee){var _0x76ef39;return db[_0x004d('0xaf')]['update']({'paused':0x1},{'where':{'UserId':_0x1b9fe7[_0x004d('0x5d')]['id']},'individualHooks':!![]})[_0x004d('0x13')](function(){return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x1b9fe7[_0x004d('0x5d')]['id'],'role':_0x004d('0x26')},'attributes':['id',_0x004d('0x32'),_0x004d('0x29'),_0x004d('0x62'),_0x004d('0x9d'),_0x004d('0xaa')]});})[_0x004d('0x13')](handleEntityNotFound(_0x3d9eee,null))['then'](function(_0x2f0d2b){if(_0x2f0d2b){_0x76ef39=_0x2f0d2b;return respondWithRpcPromise(_0x004d('0xff'),_0x004d('0xfe'),{'id':_0x76ef39['id'],'name':_0x76ef39[_0x004d('0x32')],'pause':!![]});}})[_0x004d('0x13')](function(){if(_0x76ef39){return db[_0x004d('0xf5')][_0x004d('0x45')]({'where':{'membername':_0x76ef39['name'],'type':_0x004d('0xfa'),'exitAt':null}});}})[_0x004d('0x13')](function(_0x55cd0e){if(_0x55cd0e[_0x004d('0x48')]){var _0x498767=moment()[_0x004d('0xe6')](_0x004d('0xf7'));for(var _0x592602=0x0,_0x345e4a=_0x55cd0e[_0x004d('0x48')];_0x592602<_0x345e4a;_0x592602++){_0x55cd0e[_0x592602]['updateAttributes']({'exitAt':_0x498767});}}})[_0x004d('0x13')](function(){var _0x222ebe=[];var _0x21b46c=utils[_0x004d('0x100')]();_0x21b46c[_0x004d('0xf8')](function(_0x3ea8d6){_0x222ebe['push']({'channel':_0x3ea8d6,'membername':_0x76ef39[_0x004d('0x32')],'interface':_[_0x004d('0x67')](_0x76ef39['interface'])?util['format'](_0x004d('0xe9'),_0x76ef39['name']):_0x76ef39[_0x004d('0x9d')],'type':_0x004d('0xfa'),'enterAt':moment()[_0x004d('0xe6')](_0x004d('0xf7')),'data1':_0x1b9fe7[_0x004d('0x5c')][_0x004d('0x101')]||'DEFAULT\x20PAUSE','role':_0x76ef39[_0x004d('0x29')],'internal':_0x76ef39['internal']});});return db[_0x004d('0xf5')]['bulkCreate'](_0x222ebe,{'individualHooks':!![]});})[_0x004d('0x13')](function(){return _0x76ef39[_0x004d('0xf6')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1b9fe7['body']['type']||_0x004d('0x102'),'lastPauseAt':moment()[_0x004d('0xe6')](_0x004d('0xf7'))});})[_0x004d('0x13')](respondWithResult(_0x3d9eee,null))[_0x004d('0x51')](handleError(_0x3d9eee,null));};exports['unpause']=function(_0x3743ed,_0x406a3e){if(_0x3743ed['body'][_0x004d('0x9c')]&&!utils[_0x004d('0x9e')](_0x3743ed[_0x004d('0x5c')][_0x004d('0x9c')])){throw new APIBadRequestError(util[_0x004d('0xe6')](_0x004d('0x103'),_0x3743ed['body'][_0x004d('0x9c')]));}return db[_0x004d('0x37')][_0x004d('0x31')]({'where':{'id':_0x3743ed['params']['id']},'attributes':['id','name',_0x004d('0x29'),'internal',_0x004d('0x9d'),_0x004d('0xaa'),_0x004d('0x104'),_0x004d('0x105'),_0x004d('0x106'),_0x004d('0x107'),_0x004d('0x108'),_0x004d('0x109'),'whatsappPause',_0x004d('0x10a'),_0x004d('0x10b')]})[_0x004d('0x13')](function(_0x117a5f){if(!_0x117a5f){throw new APINotFoundError(util[_0x004d('0xe6')](_0x004d('0x10c'),_0x3743ed[_0x004d('0x5d')]['id']));}return _0x117a5f['unpause'](_0x3743ed[_0x004d('0x5c')][_0x004d('0x9c')]);})[_0x004d('0x13')](respondWithResult(_0x406a3e,null))[_0x004d('0x51')](APIHandleError(_0x406a3e));};exports[_0x004d('0x10d')]=function(_0x540aa3,_0x1aecbd){var _0x44222c={};var _0x445523={};var _0x525483;var _0xa581f1;return db['User']['findOne']({'where':{'id':_0x540aa3['params']['id']}})[_0x004d('0x13')](handleEntityNotFound(_0x1aecbd,null))['then'](function(_0x1ba0d0){if(_0x1ba0d0){_0x525483=_0x1ba0d0;_0x445523[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0x10e')]['rawAttributes']);_0x445523[_0x004d('0x3d')]=_['keys'](_0x540aa3[_0x004d('0x3d')]);_0x445523[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x445523[_0x004d('0x53')],_0x445523[_0x004d('0x3d')]);_0x44222c['attributes']=_['intersection'](_0x445523[_0x004d('0x53')],qs[_0x004d('0x59')](_0x540aa3[_0x004d('0x3d')][_0x004d('0x59')]));_0x44222c['attributes']=_0x44222c[_0x004d('0x43')][_0x004d('0x48')]?_0x44222c[_0x004d('0x43')]:_0x445523['model'];_0x44222c['order']=qs[_0x004d('0xc5')](_0x540aa3[_0x004d('0x3d')][_0x004d('0xc5')]);_0x44222c['where']=qs[_0x004d('0xc6')](_[_0x004d('0xc7')](_0x540aa3['query'],_0x445523['filters']));if(_0x540aa3[_0x004d('0x3d')][_0x004d('0x2e')]){_0x44222c[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x44222c[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x44222c['attributes'],function(_0x226455){var _0xf3de6f={};_0xf3de6f[_0x226455]={'$like':'%'+_0x540aa3[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0xf3de6f;})});}_0x44222c=_[_0x004d('0x5a')]({},_0x44222c,_0x540aa3[_0x004d('0x5b')]);return _0x525483[_0x004d('0x10d')](_0x44222c);}})[_0x004d('0x13')](function(_0x19bf7f){if(_0x19bf7f){_0xa581f1=_0x19bf7f[_0x004d('0x48')];if(!_0x540aa3[_0x004d('0x3d')]['hasOwnProperty']('nolimit')){_0x44222c[_0x004d('0x23')]=qs[_0x004d('0x23')](_0x540aa3[_0x004d('0x3d')][_0x004d('0x23')]);_0x44222c['offset']=qs['offset'](_0x540aa3[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x525483[_0x004d('0x10d')](_0x44222c);}})[_0x004d('0x13')](function(_0x43f026){if(_0x43f026){return _0x43f026?{'count':_0xa581f1,'rows':_0x43f026}:null;}})[_0x004d('0x13')](respondWithResult(_0x1aecbd,null))[_0x004d('0x51')](handleError(_0x1aecbd,null));};exports[_0x004d('0x10f')]=function(_0x5b4154,_0x129ae2){var _0x3cbfe2=_0x5b4154[_0x004d('0x5d')]['id'];var _0x24e3f5=_0x5b4154['body']?_0x5b4154[_0x004d('0x5c')][_0x004d('0x60')]:null;var _0x2e9896=[];return Promise['resolve']()[_0x004d('0x13')](function(){if(!_0x24e3f5)throw new APIBadRequestError(_0x004d('0x110'));})[_0x004d('0x13')](function(){return db['User']['findOne']({'where':{'id':_0x3cbfe2}});})[_0x004d('0x13')](function(_0x4505d1){if(!_0x4505d1)throw new APINotFoundError(util[_0x004d('0xe6')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5b4154[_0x004d('0x5d')]['id']));return db[_0x004d('0x69')][_0x004d('0x111')](function(_0x2afd3b){return _0x4505d1['addTeams'](_0x24e3f5,{'transaction':_0x2afd3b})[_0x004d('0x13')](function(){return db[_0x004d('0x10e')][_0x004d('0x45')]({'where':{'id':{'$in':_0x24e3f5}}});})[_0x004d('0x13')](function(_0x34b704){var _0x3fe6b4=_[_0x004d('0x2f')](_0x34b704,function(_0x13f212){return _0x13f212['getAssociatedQueues']();});return Promise[_0x004d('0x50')](_0x3fe6b4);})[_0x004d('0x13')](function(_0x54d8c6){_0x2e9896=_[_0x004d('0x112')](_0x54d8c6);var _0x1cf023=_['map'](_0x2e9896,function(_0x53a749){return _0x53a749[_0x004d('0x113')](_0x4505d1['id'],{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x1cf023);})[_0x004d('0x13')](function(){if(!_0x4505d1[_0x004d('0xaa')])return;var _0x2a54f2=_['filter'](_0x2e9896,function(_0x2d9ead){return _0x2d9ead[_0x004d('0x114')](_0x004d('0x9c'))===_0x004d('0x115');});var _0x4f9877=_[_0x004d('0x2f')](_0x2a54f2,function(_0x3e076c){return db[_0x004d('0xaf')][_0x004d('0xf4')]({'membername':_0x4505d1['name'],'UserId':_0x4505d1['id'],'queue_name':_0x3e076c['name'],'VoiceQueueId':_0x3e076c['id'],'interface':_[_0x004d('0x67')](_0x4505d1[_0x004d('0x9d')])?util['format']('SIP/%s',_0x4505d1[_0x004d('0x32')]):_0x4505d1[_0x004d('0x9d')],'paused':_0x4505d1[_0x004d('0x104')]||![],'penalty':_0x4505d1['penalty']},{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x4f9877);})[_0x004d('0x13')](function(){return db[_0x004d('0x116')][_0x004d('0x45')]({'where':{'teamId':{'$in':_0x24e3f5}}});})[_0x004d('0x13')](function(_0x30bc86){var _0x147f5b=_['map'](_0x30bc86,function(_0x594ab6){return db[_0x004d('0x117')][_0x004d('0x7f')]({'UserId':_0x4505d1['id'],'VoicePrefixId':_0x594ab6[_0x004d('0x118')]},{'transaction':_0x2afd3b});});return Promise[_0x004d('0x50')](_0x147f5b);});});})[_0x004d('0x13')](function(){for(var _0x303d01=0x0;_0x303d01<_0x2e9896[_0x004d('0x48')];_0x303d01++){var _0x24e114=_0x2e9896[_0x303d01][_0x004d('0x114')](_0x004d('0x9c'));var _0x438fcb=_0x24e114+_0x004d('0xad');socket[_0x004d('0xa6')](_0x004d('0x2b')+_0x24e114+_0x004d('0xa7'),{'UserId':_0x3cbfe2,['queueField']:_0x2e9896[_0x303d01]['id']});}})[_0x004d('0x13')](respondWithStatusCode(_0x129ae2,null))[_0x004d('0x51')](APIHandleError(_0x129ae2));};exports[_0x004d('0x119')]=function(_0x27ea23,_0x18a9b4){var _0x5a4177=_0x27ea23[_0x004d('0x5d')]['id'];var _0x233b55=null;if(_0x27ea23['query'][_0x004d('0x60')]){_0x233b55=_[_0x004d('0x11a')](_0x27ea23[_0x004d('0x3d')][_0x004d('0x60')])?_0x27ea23['query'][_0x004d('0x60')]:[_0x27ea23['query'][_0x004d('0x60')]];}var _0x1253fd=[];return Promise['resolve']()[_0x004d('0x13')](function(){if(!_0x233b55)throw new APIBadRequestError(_0x004d('0x11b'));})[_0x004d('0x13')](function(){return db[_0x004d('0x37')][_0x004d('0xc2')]({'where':{'id':_0x5a4177}});})['then'](function(_0x36756d){if(!_0x36756d)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x27ea23[_0x004d('0x5d')]['id']));return db[_0x004d('0x69')][_0x004d('0x111')](function(_0x3fdbbc){return _0x36756d[_0x004d('0x119')](_0x233b55,{'transaction':_0x3fdbbc})[_0x004d('0x13')](function(){return db[_0x004d('0x10e')][_0x004d('0x45')]({'where':{'id':{'$in':_0x233b55}}});})[_0x004d('0x13')](function(_0x1213d9){var _0x24b584=_['map'](_0x1213d9,function(_0x125360){return _0x125360[_0x004d('0x11c')]();});return Promise[_0x004d('0x50')](_0x24b584);})[_0x004d('0x13')](function(_0x3a5850){_0x1253fd=_[_0x004d('0x112')](_0x3a5850);var _0x5a0020=_[_0x004d('0x2f')](_0x1253fd,function(_0x5be2c5){return _0x5be2c5[_0x004d('0x11d')](_0x36756d['id'],{'transaction':_0x3fdbbc});});return Promise[_0x004d('0x50')](_0x5a0020);})[_0x004d('0x13')](function(){if(!_0x36756d[_0x004d('0xaa')])return;var _0x862f6d=_['filter'](_0x1253fd,function(_0x3bb85c){return _0x3bb85c[_0x004d('0x114')](_0x004d('0x9c'))===_0x004d('0x115');});var _0x44f535=_[_0x004d('0x2f')](_0x862f6d,function(_0x1c8877){return db[_0x004d('0xaf')][_0x004d('0xb0')]({'where':{'VoiceQueueId':_0x1c8877['id'],'UserId':_0x36756d['id']},'transaction':_0x3fdbbc});});return Promise['all'](_0x44f535);})[_0x004d('0x13')](function(){return db[_0x004d('0x116')]['findAll']({'where':{'teamId':{'$in':_0x233b55}}});})[_0x004d('0x13')](function(_0x98fd8e){var _0x315f96=_[_0x004d('0x2f')](_0x98fd8e,function(_0x224962){return db[_0x004d('0x117')][_0x004d('0xb0')]({'where':{'UserId':_0x36756d['id'],'VoicePrefixId':_0x224962['VoicePrefixId']}},{'transaction':_0x3fdbbc});});return Promise[_0x004d('0x50')](_0x315f96);});});})[_0x004d('0x13')](function(){for(var _0x18f5bd=0x0;_0x18f5bd<_0x1253fd[_0x004d('0x48')];_0x18f5bd++){var _0x2c0b0b=_0x1253fd[_0x18f5bd]['getDataValue'](_0x004d('0x9c'));var _0x4b44c2=_0x2c0b0b+_0x004d('0xad');socket[_0x004d('0xa6')](_0x004d('0x2b')+_0x2c0b0b+_0x004d('0xae'),{'UserId':_0x5a4177,['queueField']:_0x1253fd[_0x18f5bd]['id']});}})[_0x004d('0x13')](respondWithStatusCode(_0x18a9b4,null))['catch'](APIHandleError(_0x18a9b4));};exports[_0x004d('0x11e')]=function(_0x4157da,_0xdfb273){var _0x170b86={};var _0x6efc51={};var _0x3da8e7;var _0x1589cc;return db[_0x004d('0x37')]['findOne']({'where':{'id':_0x4157da[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0xdfb273,null))['then'](function(_0x165dc0){if(_0x165dc0){_0x3da8e7=_0x165dc0;_0x6efc51[_0x004d('0x53')]=_['keys'](db[_0x004d('0xc9')][_0x004d('0x56')]);_0x6efc51['query']=_[_0x004d('0x55')](_0x4157da[_0x004d('0x3d')]);_0x6efc51[_0x004d('0xc6')]=_[_0x004d('0x58')](_0x6efc51[_0x004d('0x53')],_0x6efc51[_0x004d('0x3d')]);_0x170b86['attributes']=_[_0x004d('0x58')](_0x6efc51[_0x004d('0x53')],qs[_0x004d('0x59')](_0x4157da[_0x004d('0x3d')]['fields']));_0x170b86[_0x004d('0x43')]=_0x170b86[_0x004d('0x43')][_0x004d('0x48')]?_0x170b86[_0x004d('0x43')]:_0x6efc51[_0x004d('0x53')];_0x170b86[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x4157da[_0x004d('0x3d')][_0x004d('0xc5')]);_0x170b86[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x4157da['query'],_0x6efc51[_0x004d('0xc6')]));if(_0x4157da[_0x004d('0x3d')][_0x004d('0x2e')]){_0x170b86[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x170b86[_0x004d('0x3c')],{'$or':_[_0x004d('0x2f')](_0x170b86['attributes'],function(_0x4ede44){var _0x547b17={};_0x547b17[_0x4ede44]={'$like':'%'+_0x4157da[_0x004d('0x3d')][_0x004d('0x2e')]+'%'};return _0x547b17;})});}_0x170b86=_[_0x004d('0x5a')]({},_0x170b86,_0x4157da[_0x004d('0x5b')]);return _0x3da8e7[_0x004d('0x11e')](_0x170b86);}})['then'](function(_0x2b79dd){if(_0x2b79dd){_0x1589cc=_0x2b79dd['length'];if(!_0x4157da[_0x004d('0x3d')][_0x004d('0xc8')]('nolimit')){_0x170b86['limit']=qs['limit'](_0x4157da[_0x004d('0x3d')][_0x004d('0x23')]);_0x170b86[_0x004d('0x22')]=qs[_0x004d('0x22')](_0x4157da[_0x004d('0x3d')][_0x004d('0x22')]);}return _0x3da8e7[_0x004d('0x11e')](_0x170b86);}})[_0x004d('0x13')](function(_0x258a52){if(_0x258a52){return _0x258a52?{'count':_0x1589cc,'rows':_0x258a52}:null;}})[_0x004d('0x13')](respondWithResult(_0xdfb273,null))['catch'](handleError(_0xdfb273,null));};exports['getAgents']=function(_0x436f60,_0x26efd4){var _0x1e06ff={};var _0x45d766={};var _0x1fdbe8;return db['User'][_0x004d('0xc2')]({'where':{'id':_0x436f60[_0x004d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x26efd4,null))[_0x004d('0x13')](function(_0x2756b5){if(_0x2756b5){_0x1fdbe8=_0x2756b5;_0x45d766[_0x004d('0x53')]=_[_0x004d('0x55')](db[_0x004d('0x37')][_0x004d('0x56')]);_0x45d766[_0x004d('0x3d')]=_[_0x004d('0x55')](_0x436f60[_0x004d('0x3d')]);_0x45d766['filters']=_['intersection'](_0x45d766['model'],_0x45d766[_0x004d('0x3d')]);_0x1e06ff[_0x004d('0x43')]=_['intersection'](_0x45d766[_0x004d('0x53')],qs[_0x004d('0x59')](_0x436f60[_0x004d('0x3d')][_0x004d('0x59')]));_0x1e06ff[_0x004d('0x43')]=_0x1e06ff['attributes'][_0x004d('0x48')]?_0x1e06ff['attributes']:_0x45d766[_0x004d('0x53')];_0x1e06ff[_0x004d('0xc4')]=qs[_0x004d('0xc5')](_0x436f60[_0x004d('0x3d')][_0x004d('0xc5')]);_0x1e06ff[_0x004d('0x3c')]=qs[_0x004d('0xc6')](_['pick'](_0x436f60[_0x004d('0x3d')],_0x45d766[_0x004d('0xc6')]));if(_0x436f60[_0x004d('0x3d')][_0x004d('0x2e')]){_0x1e06ff[_0x004d('0x3c')]=_[_0x004d('0x5a')](_0x1e06ff['where'],{'$or':_['map'](_0x1e06ff['attributes'],function(_0x371f66){var _0x570b40={};_0x570b40[_0x371f66]={'$like':'%'+_0x436f60['query'][_0x004d('0x2e')]+'%'};return _0x570b40;})});}_0x1e06ff['model']=db[_0x004d('0x37')];_0x1e06ff['as']='Agents';_0x1e06ff=_['merge']({},_0x1e06ff,_0x436f60[_0x004d('0x5b')]);return _0x1fdbe8[_0x004d('0xf2')]({'include':[_0x1e06ff]});}})[_0x004d('0x13')](function(_0x11a810){if(_0x11a810){var _0x469e4a={},_0xc60aed=[];for(var _0x3bb4fe=0x0;_0x3bb4fe<_0x11a810[_0x004d('0x48')];_0x3bb4fe+=0x1){for(var _0x2eae3b=0x0,_0x148f2e;_0x2eae3b<_0x11a810[_0x3bb4fe][_0x004d('0x85')][_0x004d('0x48')];_0x2eae3b+=0x1){_0x148f2e=_0x11a810[_0x3bb4fe]['Agents'][_0x2eae3b]['get']({'plain':!![]});_0x469e4a[_0x148f2e['id']]=_0x148f2e;}}_0x469e4a=_[_0x004d('0x11f')](_0x469e4a);for(var _0x4409e0=qs['offset'](_0x436f60['query'][_0x004d('0x22')]);_0x4409e0<_0x469e4a['length']&&_0xc60aed[_0x004d('0x48')]=_0xafea37){_0x595669=_0xafea37;_0x4fcf32=0xc8;}else{_0x4fcf32=0xce;}_0x1c711b[_0x73d3('0x21')](_0x4fcf32);return _0x1c711b[_0x73d3('0x28')](_0x73d3('0x29'),_0x2f8392+'-'+_0x595669+'/'+_0xafea37)[_0x73d3('0x23')](_0xc9a6d6);}return null;};}function saveUpdates(_0x282a28){return function(_0x773d72){if(_0x773d72){return _0x773d72[_0x73d3('0x2a')](_0x282a28)[_0x73d3('0x15')](function(_0x28b60b){if(_0x28b60b['role']===_0x73d3('0x2b')){socket[_0x73d3('0x2c')](_0x73d3('0x2d')+_0x28b60b['id'],_0x28b60b);}return _0x28b60b;});}return null;};}function removeEntity(_0x13ce1d){return function(_0x98d9d){if(_0x98d9d){return _0x98d9d[_0x73d3('0x2e')]()[_0x73d3('0x15')](function(){var _0xb77784=_0x98d9d[_0x73d3('0x2f')]({'plain':!![]});if(_0xb77784[_0x73d3('0x30')]===_0x73d3('0x31'))return;var _0x4e5758=[{'name':_0x73d3('0x32'),'value':'user','ignore':!![]},{'name':_0x73d3('0x33'),'value':_0x73d3('0x2b'),'ignore':![]},{'name':_0x73d3('0x34'),'value':_0x73d3('0x35'),'ignore':![]}];var _0x57f317=_(_0x4e5758)[_0x73d3('0x36')](_0x73d3('0x37'))[_0x73d3('0x38')](_0x73d3('0x39'))[_0x73d3('0x39')]();if(_[_0x73d3('0x3a')](_0x57f317,_0xb77784[_0x73d3('0x30')])){return;}var _0x32609a=_[_0x73d3('0x3b')](_0x4e5758,[_0x73d3('0x39'),_0xb77784['role']])[_0x73d3('0x3c')];return db[_0x73d3('0x3d')][_0x73d3('0x2e')]({'where':{'type':_0x32609a,'resourceId':_0xb77784['id']}})['then'](function(){return _0x98d9d;});})['then'](function(){_0x13ce1d[_0x73d3('0x21')](0xcc)[_0x73d3('0x22')]();});}};}function handleEntityNotFound(_0x1aec35){return function(_0x30503f){if(!_0x30503f){_0x1aec35[_0x73d3('0x20')](0x194);}return _0x30503f;};}function handleError(_0x9b96ed,_0x131cff){_0x131cff=_0x131cff||0x1f4;return function(_0x3d8188){logger[_0x73d3('0x1a')](_0x3d8188[_0x73d3('0x3e')]);if(_0x3d8188['name']){delete _0x3d8188[_0x73d3('0x3c')];}_0x9b96ed['status'](_0x131cff)[_0x73d3('0x3f')](_0x3d8188);};}exports[_0x73d3('0x40')]=function(_0x5d5021,_0x12f277){var _0x4559ab={},_0x248304={'count':0x0,'rows':[]};var _0x1261bd=_(db[_0x73d3('0x41')][_0x73d3('0x42')])[_0x73d3('0x38')](function(_0x215a21){return{'name':_0x215a21[_0x73d3('0x43')],'type':_0x215a21[_0x73d3('0x44')][_0x73d3('0x45')]};})[_0x73d3('0x36')](function(_0x2cfac3){return!_[_0x73d3('0x3a')](['password',_0x73d3('0x46')],_0x2cfac3['name']);})[_0x73d3('0x39')]();_0x4559ab=qs[_0x73d3('0x47')](_0x1261bd,_0x5d5021);var _0x39c0e5={'where':_0x4559ab['where']};return db[_0x73d3('0x41')][_0x73d3('0x27')](_0x39c0e5)[_0x73d3('0x15')](function(_0x14d2d0){_0x248304[_0x73d3('0x27')]=_0x14d2d0;if(_0x5d5021[_0x73d3('0x48')][_0x73d3('0x49')]){_0x4559ab[_0x73d3('0x4a')]=[{'all':!![]}];}if(_0x5d5021['query'][_0x73d3('0x4b')]===_0x73d3('0x4c')){_0x4559ab[_0x73d3('0x4a')]=[{'model':db['UserSetting'],'as':_0x73d3('0x4b')}];}if(!_['includes'](_0x4559ab[_0x73d3('0x4d')],'id')){_0x4559ab[_0x73d3('0x4d')]['push']('id');}return db[_0x73d3('0x41')]['findAll'](_0x4559ab);})[_0x73d3('0x15')](function(_0x584bc7){_0x248304[_0x73d3('0x4e')]=_0x584bc7;if(_0x5d5021[_0x73d3('0x48')]['openTabs']==='true'){var _0x408cb8=[];for(var _0x54ec63=0x0;_0x54ec63<_0x248304[_0x73d3('0x4e')]['length'];_0x54ec63++){_0x408cb8['push'](get_open_tabs(_0x73d3('0x4f'),_0x248304[_0x73d3('0x4e')][_0x54ec63][_0x73d3('0x50')]));_0x408cb8['push'](get_open_tabs(_0x73d3('0x51'),_0x248304['rows'][_0x54ec63][_0x73d3('0x50')]));_0x408cb8['push'](get_open_tabs(_0x73d3('0x52'),_0x248304['rows'][_0x54ec63][_0x73d3('0x50')]));_0x408cb8[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x54'),_0x248304[_0x73d3('0x4e')][_0x54ec63][_0x73d3('0x50')]));_0x408cb8[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x55'),_0x248304[_0x73d3('0x4e')][_0x54ec63]['dataValues']));_0x408cb8[_0x73d3('0x53')](get_open_tabs('whatsapp',_0x248304[_0x73d3('0x4e')][_0x54ec63][_0x73d3('0x50')]));}return Promise[_0x73d3('0x56')](_0x408cb8)['then'](function(){return _0x248304;});}else{return _0x248304;}})[_0x73d3('0x15')](respondWithFilteredResult(_0x12f277,_0x4559ab))[_0x73d3('0x1f')](handleError(_0x12f277,null));};exports[_0x73d3('0x57')]=function(_0x2124d5,_0x122700){var _0x5ba1c0={'raw':![],'where':{'id':_0x2124d5['params']['id']}},_0x1c1a5b={};_0x1c1a5b['model']=_['differenceBy'](_[_0x73d3('0x58')](db['User'][_0x73d3('0x42')]),[_0x73d3('0x59'),_0x73d3('0x46')]);_0x1c1a5b[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x2124d5[_0x73d3('0x48')]);_0x1c1a5b[_0x73d3('0x5a')]=_['intersection'](_0x1c1a5b[_0x73d3('0x5b')],_0x1c1a5b['query']);_0x5ba1c0[_0x73d3('0x4d')]=_['intersection'](_0x1c1a5b['model'],qs[_0x73d3('0x5c')](_0x2124d5[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x5ba1c0[_0x73d3('0x4d')]=_0x5ba1c0[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x5ba1c0[_0x73d3('0x4d')]:_0x1c1a5b[_0x73d3('0x5b')];if(_0x2124d5['query'][_0x73d3('0x49')]){_0x5ba1c0['include']=[{'all':!![]}];}if(_0x2124d5[_0x73d3('0x48')][_0x73d3('0x4b')]===_0x73d3('0x4c')){_0x5ba1c0['include']=[{'model':db[_0x73d3('0x5e')],'as':'userSetting'}];}_0x5ba1c0=_[_0x73d3('0x5f')]({},_0x5ba1c0,_0x2124d5[_0x73d3('0x60')]);if(!_[_0x73d3('0x3a')](_0x5ba1c0['attributes'],'id')){_0x5ba1c0[_0x73d3('0x4d')]['push']('id');}return db[_0x73d3('0x41')][_0x73d3('0x3b')](_0x5ba1c0)[_0x73d3('0x15')](handleEntityNotFound(_0x122700,null))['then'](function(_0x5b1991){var _0x15c1b5=[];values=_0x5b1991;if(_0x2124d5[_0x73d3('0x48')]['openTabs']==='true'){_0x15c1b5[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x4f'),_0x5b1991[_0x73d3('0x50')]));_0x15c1b5[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x51'),_0x5b1991[_0x73d3('0x50')]));_0x15c1b5[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x55'),_0x5b1991[_0x73d3('0x50')]));_0x15c1b5[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x61'),_0x5b1991['dataValues']));_0x15c1b5[_0x73d3('0x53')](get_open_tabs('fax',_0x5b1991[_0x73d3('0x50')]));_0x15c1b5[_0x73d3('0x53')](get_open_tabs('mail',_0x5b1991['dataValues']));return Promise['all'](_0x15c1b5);}else{return values;}})[_0x73d3('0x15')](function(){return values;})[_0x73d3('0x15')](respondWithResult(_0x122700,null))['catch'](handleError(_0x122700,null));};exports[_0x73d3('0x2a')]=function(_0x2b360b,_0x1a60c3){if(_0x2b360b[_0x73d3('0x62')]['id']){delete _0x2b360b[_0x73d3('0x62')]['id'];}delete _0x2b360b[_0x73d3('0x62')][_0x73d3('0x30')];return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x2b360b[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x1a60c3,null))[_0x73d3('0x15')](saveUpdates(_0x2b360b['body'],null))[_0x73d3('0x15')](respondWithResult(_0x1a60c3,null))[_0x73d3('0x1f')](handleError(_0x1a60c3,null));};exports[_0x73d3('0x64')]=function(_0x571002,_0x24deff){return db['User']['describe']()[_0x73d3('0x15')](respondWithResult(_0x24deff,null))['catch'](handleError(_0x24deff,null));};exports[_0x73d3('0x65')]=function(_0x40d88f,_0x325bfe){return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x40d88f[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x325bfe,null))[_0x73d3('0x15')](function(_0x3620fc){if(_0x3620fc){return _0x3620fc[_0x73d3('0x65')](_0x40d88f['body']['ids'],_[_0x73d3('0x66')](_0x40d88f[_0x73d3('0x62')],['ids','id'])||{});}})[_0x73d3('0x15')](respondWithResult(_0x325bfe,null))[_0x73d3('0x1f')](handleError(_0x325bfe,null));};function validateUser(_0x1a1059){return new Promise(function(_0x48a012,_0x3b5361){if(_0x1a1059['internal'])return _0x48a012(_0x1a1059);return db[_0x73d3('0x67')][_0x73d3('0x68')](0x1)['then'](function(_0x15b239){if(_0x15b239[_0x73d3('0x69')])authService['validatePasswordPattern'](_0x1a1059[_0x73d3('0x59')]);db['User']['max'](_0x73d3('0x6a'))['then'](function(_0x2a62f8){if(_[_0x73d3('0x6b')](_0x2a62f8)){_0x1a1059[_0x73d3('0x6a')]=_0x15b239[_0x73d3('0x6c')]||0x1;return;}if(_['isNil'](_0x15b239[_0x73d3('0x6c')])||_0x15b239[_0x73d3('0x6c')]===_0x2a62f8){_0x1a1059['internal']=_0x2a62f8+0x1;return;}if(_0x15b239[_0x73d3('0x6c')]>_0x2a62f8){_0x1a1059[_0x73d3('0x6a')]=_0x15b239['min_internal'];return;}return db[_0x73d3('0x6d')][_0x73d3('0x48')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x73d3('0x6e')]})[_0x73d3('0x15')](function(_0x5995f4){if(_0x5995f4&&_0x5995f4[_0x73d3('0x5d')]){for(var _0x3d1d14=0x0,_0x472912=_0x5995f4['length'];_0x3d1d14<_0x472912&&_[_0x73d3('0x6b')](_0x1a1059[_0x73d3('0x6a')]);_0x3d1d14++){if(_0x15b239[_0x73d3('0x6c')]<=_0x5995f4[_0x3d1d14][_0x73d3('0x6f')]){_0x1a1059['internal']=_0x5995f4[_0x3d1d14]['from'];}else if(_0x15b239[_0x73d3('0x6c')]>_0x5995f4[_0x3d1d14][_0x73d3('0x6f')]&&_0x15b239[_0x73d3('0x6c')]<=_0x5995f4[_0x3d1d14]['to']){_0x1a1059[_0x73d3('0x6a')]=_0x15b239['min_internal'];}}}if(_[_0x73d3('0x6b')](_0x1a1059[_0x73d3('0x6a')])){_0x1a1059[_0x73d3('0x6a')]=_0x2a62f8+0x1;}return _0x48a012(_0x1a1059);});});})[_0x73d3('0x1f')](function(_0xbfd6d4){_0x3b5361(_0xbfd6d4);});});}function updateUser(_0x1274a9){return new Promise(function(_0x46135e,_0x344c70){try{if(_0x1274a9[_0x73d3('0x70')]){_0x1274a9[_0x73d3('0x71')]=_0x1274a9[_0x73d3('0x6a')];_0x1274a9[_0x73d3('0x72')]={'mailbox':_0x1274a9[_0x73d3('0x6a')],'password':_0x1274a9[_0x73d3('0x59')],'fullname':_0x1274a9['fullname'],'email':_0x1274a9['email']};}if(_0x1274a9[_0x73d3('0x30')]===_0x73d3('0x2b')){if(!_0x1274a9['permissions'])_0x1274a9[_0x73d3('0x73')]=[_0x73d3('0x74'),_0x73d3('0x75'),_0x73d3('0x76'),_0x73d3('0x77'),'110',_0x73d3('0x78'),_0x73d3('0x79'),_0x73d3('0x7a'),'107','108',_0x73d3('0x7b'),_0x73d3('0x7c'),_0x73d3('0x7d'),'114',_0x73d3('0x7e')];}_0x46135e(_0x1274a9);}catch(_0xb9ba26){_0x344c70(_0xb9ba26);}});}exports[_0x73d3('0x7f')]=function(_0x4f016e,_0x3f7c8f){if(_0x4f016e[_0x73d3('0x80')][_0x73d3('0x30')]===_0x73d3('0x2b'))throw new Error(_0x73d3('0x81'));if(_0x4f016e[_0x73d3('0x62')][_0x73d3('0x30')]===_0x73d3('0x80')&&_0x4f016e[_0x73d3('0x80')][_0x73d3('0x30')]!==_0x73d3('0x31')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x4f016e[_0x73d3('0x62')][_0x73d3('0x30')]===_0x73d3('0x31')&&_0x4f016e[_0x73d3('0x80')][_0x73d3('0x30')]!==_0x73d3('0x31')){throw new Error(_0x73d3('0x82'));}return licenseUtil[_0x73d3('0x83')]([_0x4f016e[_0x73d3('0x62')]])[_0x73d3('0x15')](function(){return validateUser(_0x4f016e[_0x73d3('0x62')]);})[_0x73d3('0x15')](function(_0x1ddea9){return updateUser(_0x1ddea9)['then'](function(_0x2c5409){if(_0x2c5409[_0x73d3('0x30')]===_0x73d3('0x31')){_0x2c5409['settingsEnabled']=_0x4f016e[_0x73d3('0x80')][_0x73d3('0x84')];delete _0x2c5409[_0x73d3('0x85')];}return _0x2c5409;});})[_0x73d3('0x15')](function(_0x3cf95d){return db[_0x73d3('0x41')]['create'](_0x3cf95d,{'include':[{'model':db[_0x73d3('0x72')],'as':'VoiceMail'}]});})['then'](function(_0x1c96c7){if(_0x4f016e['body']['role']===_0x73d3('0x80'))return _0x1c96c7;if(_0x4f016e[_0x73d3('0x80')][_0x73d3('0x30')]!==_0x73d3('0x80'))return _0x1c96c7;return db[_0x73d3('0x86')]['find']({'where':{'name':_0x1c96c7['role']===_0x73d3('0x2b')?_0x73d3('0x33'):'Telephones','userProfileId':_0x4f016e[_0x73d3('0x80')][_0x73d3('0x85')]},'raw':!![]})[_0x73d3('0x15')](function(_0x1bf476){if(!_0x1bf476||_0x1bf476[_0x73d3('0x87')]!=0x0)return _0x1c96c7;return db[_0x73d3('0x3d')][_0x73d3('0x7f')]({'name':_0x1c96c7[_0x73d3('0x3c')],'resourceId':_0x1c96c7['id'],'type':_0x1bf476[_0x73d3('0x3c')],'sectionId':_0x1bf476['id']},{})[_0x73d3('0x15')](function(){return _0x1c96c7;});})[_0x73d3('0x1f')](function(_0x491498){logger[_0x73d3('0x1a')](_0x73d3('0x88'),_0x491498);throw _0x491498;});})[_0x73d3('0x15')](respondWithResult(_0x3f7c8f,0xc9))[_0x73d3('0x1f')](handleError(_0x3f7c8f,null));};exports[_0x73d3('0x89')]=function(_0x48c0c4,_0x736701){var _0x58a569=_0x48c0c4[_0x73d3('0x62')];var _0x5f2104=[];if(_0x48c0c4[_0x73d3('0x80')]['role']===_0x73d3('0x2b'))throw new Error(_0x73d3('0x81'));if(_[_0x73d3('0x8a')](_0x58a569,[_0x73d3('0x30'),_0x73d3('0x80')])&&_0x48c0c4[_0x73d3('0x80')][_0x73d3('0x30')]!==_0x73d3('0x31')){throw new Error(_0x73d3('0x8b'));}if(_['some'](_0x58a569,[_0x73d3('0x30'),_0x73d3('0x31')])&&_0x48c0c4[_0x73d3('0x80')][_0x73d3('0x30')]!==_0x73d3('0x31')){throw new Error(_0x73d3('0x8c'));}return licenseUtil['checkUserLimits'](_0x58a569)[_0x73d3('0x15')](function(){return validateUser(_0x58a569[0x0]);})[_0x73d3('0x15')](function(){for(var _0x2d421e=0x1;_0x2d421e<_0x58a569[_0x73d3('0x5d')];_0x2d421e++){var _0x786c7d=_0x58a569[_0x2d421e-0x1][_0x73d3('0x6a')];if(!_0x58a569[_0x2d421e][_0x73d3('0x6a')])_0x58a569[_0x2d421e]['internal']=_0x786c7d+0x1;_0x5f2104[_0x73d3('0x53')](validateUser(_0x58a569[_0x2d421e]));}return Promise[_0x73d3('0x56')](_0x5f2104);})[_0x73d3('0x15')](function(){_0x5f2104=[];for(var _0x2f9515=0x0;_0x2f9515<_0x58a569[_0x73d3('0x5d')];_0x2f9515++){_0x5f2104[_0x73d3('0x53')](updateUser(_0x58a569[_0x2f9515]));}return Promise[_0x73d3('0x56')](_0x5f2104);})[_0x73d3('0x15')](function(){_0x5f2104=_0x58a569['map'](function(_0x505608){return db[_0x73d3('0x41')]['create'](_0x505608,{'include':[{'model':db[_0x73d3('0x72')],'as':_0x73d3('0x72')}]})[_0x73d3('0x15')](function(_0x2065d4){_0x505608['id']=_0x2065d4['id'];return _0x505608;});});return Promise[_0x73d3('0x56')](_0x5f2104);})[_0x73d3('0x15')](function(_0x2a3332){if(_0x48c0c4[_0x73d3('0x62')][_0x73d3('0x30')]===_0x73d3('0x80'))return _0x2a3332;if(_0x48c0c4[_0x73d3('0x80')]['role']!==_0x73d3('0x80'))return _0x2a3332;var _0x3ea907=_[_0x73d3('0x8a')](_0x2a3332,function(_0x327128){return _0x327128['role']===_0x73d3('0x2b')||_0x327128[_0x73d3('0x30')]===_0x73d3('0x35');});if(!_0x3ea907)return _0x2a3332;return db[_0x73d3('0x86')]['findAll']({'where':{'name':{'$or':['Agents',_0x73d3('0x34')]},'userProfileId':_0x48c0c4['user']['userProfileId']},'raw':!![]})['then'](function(_0x5142b9){if(_[_0x73d3('0x8d')](_0x5142b9)||!_[_0x73d3('0x8a')](_0x5142b9,[_0x73d3('0x87'),0x0]))return _0x2a3332;_0x5f2104=[];var _0x1eed7e=_(_0x5142b9)['map'](function(_0x19cf58){if(_0x19cf58[_0x73d3('0x87')]===0x1)return;return _0x19cf58['name']===_0x73d3('0x33')?'agent':_0x73d3('0x35');})[_0x73d3('0x8e')]()[_0x73d3('0x39')]();for(var _0x9da2c8=0x0;_0x9da2c8<_0x2a3332[_0x73d3('0x5d')];_0x9da2c8++){if(!_[_0x73d3('0x3a')](_0x1eed7e,_0x2a3332[_0x9da2c8][_0x73d3('0x30')]))return;var _0x3166a2=_0x2a3332[_0x9da2c8][_0x73d3('0x30')]===_0x73d3('0x2b')?'Agents':'Telephones';_0x5f2104[_0x73d3('0x53')](db[_0x73d3('0x3d')]['create']({'name':_0x2a3332[_0x9da2c8]['name'],'resourceId':_0x2a3332[_0x9da2c8]['id'],'type':_0x3166a2,'sectionId':_[_0x73d3('0x3b')](_0x5142b9,[_0x73d3('0x3c'),_0x3166a2])['id']},{}));}return Promise[_0x73d3('0x56')](_0x5f2104);});})[_0x73d3('0x15')](respondWithResult(_0x736701,0xc9))[_0x73d3('0x1f')](handleError(_0x736701,null));};exports['changePassword']=function(_0x5f3b31,_0x9a43){if(_0x5f3b31[_0x73d3('0x62')]['id']){delete _0x5f3b31['body']['id'];}return db[_0x73d3('0x41')]['find']({'where':{'id':_0x5f3b31[_0x73d3('0x63')]['id']}})['then'](function(_0x108c1c){if(!_0x108c1c)return null;if(_0x108c1c['id']===_0x5f3b31[_0x73d3('0x80')]['id']){if(!_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x8f')]||!_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x90')]){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))](_0x73d3('0x93'));}if(!_0x108c1c[_0x73d3('0x94')](_0x5f3b31['body'][_0x73d3('0x8f')])){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))](_0x73d3('0x95'));}if(_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x8f')]===_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x90')]){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))](_0x73d3('0x96'));}}else if(_0x5f3b31[_0x73d3('0x80')][_0x73d3('0x30')]===_0x73d3('0x31')){if(!_0x5f3b31[_0x73d3('0x62')]['newPassword']){throw new db[(_0x73d3('0x91'))]['ValidationError'](_0x73d3('0x97'));}}else if(_0x5f3b31[_0x73d3('0x80')]['role']===_0x73d3('0x80')){if(!_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x90')]){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x108c1c[_0x73d3('0x30')]!=='agent'){throw new db[(_0x73d3('0x91'))]['ValidationError'](_0x73d3('0x81'));}}else{throw new db['Sequelize']['ValidationError'](_0x73d3('0x81'));}return _0x108c1c;})['then'](handleEntityNotFound(_0x9a43,null))['then'](function(_0x1f2fc9){return db[_0x73d3('0x67')][_0x73d3('0x98')]({'attributes':['id','securePassword',_0x73d3('0x99'),_0x73d3('0x9a')]})[_0x73d3('0x15')](function(_0x2667d1){if(_0x2667d1[_0x73d3('0x69')])authService[_0x73d3('0x9b')](_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x90')]);if(!_0x2667d1['enforcePasswordHistory']||!_0x1f2fc9[_0x73d3('0x9c')])return _0x1f2fc9;authService['validatePasswordHistory'](_0x5f3b31[_0x73d3('0x62')]['newPassword'],_0x1f2fc9[_0x73d3('0x9c')],_0x2667d1[_0x73d3('0x9a')]);return _0x1f2fc9;})[_0x73d3('0x15')](saveUpdates({'password':_0x5f3b31[_0x73d3('0x62')][_0x73d3('0x90')],'passwordResetAt':_0x5f3b31['user']['id']==_0x5f3b31[_0x73d3('0x63')]['id']?moment():null,'previousPasswords':authService[_0x73d3('0x9d')](_0x5f3b31['body'][_0x73d3('0x90')],_0x1f2fc9['previousPasswords'])},null));})['then'](respondWithResult(_0x9a43,null))[_0x73d3('0x1f')](handleError(_0x9a43,null));};exports[_0x73d3('0x9e')]=function(_0x164bae,_0x3154c4){var _0x3e6e63=_0x164bae[_0x73d3('0x62')][_0x73d3('0x9f')];return db[_0x73d3('0x41')]['find']({'where':{'id':_0x164bae[_0x73d3('0x63')]['id']},'attributes':['id',_0x73d3('0x3c'),_0x73d3('0x30'),'online',_0x73d3('0xa0'),_0x73d3('0xa1'),_0x73d3('0xa2')]})['then'](handleEntityNotFound(_0x3154c4,null))['then'](function(_0x1b14bc){if(_0x1b14bc){if(!utils[_0x73d3('0xa3')](_0x3e6e63)){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))]('Unknown\x20channel');}return _0x1b14bc[_0x73d3('0xa4')+_[_0x73d3('0xa5')](_0x3e6e63[_0x73d3('0xa6')]())+_0x73d3('0xa7')](_0x164bae[_0x73d3('0x62')][_0x73d3('0xa8')],{'penalty':_0x164bae[_0x73d3('0x62')][_0x73d3('0xa9')]||0x0})[_0x73d3('0xaa')](function(_0x4048c4){for(var _0x4c539b=0x0;_0x4c539b<_0x164bae[_0x73d3('0x62')][_0x73d3('0xa8')][_0x73d3('0x5d')];_0x4c539b+=0x1){var _0x366860={'UserId':Number(_0x164bae[_0x73d3('0x63')]['id'])};_0x366860[_[_0x73d3('0xa5')](_0x3e6e63[_0x73d3('0xa6')]())+_0x73d3('0xab')]=Number(_0x164bae[_0x73d3('0x62')][_0x73d3('0xa8')][_0x4c539b]);socket['emit'](_0x73d3('0x80')+_[_0x73d3('0xa5')](_0x3e6e63[_0x73d3('0xa6')]())+_0x73d3('0xac'),_0x366860);}return _0x4048c4;})[_0x73d3('0x15')](function(){if(_0x3e6e63===_0x73d3('0xad')){return db[_0x73d3('0xae')]['findAll']({'where':{'id':_0x164bae['body'][_0x73d3('0xa8')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x73d3('0x15')](function(_0x202c65){var _0x417c2d=_0x1b14bc[_0x73d3('0x2f')]({'plain':!![]});var _0x18a714=[];if(_0x3e6e63===_0x73d3('0xad')&&_0x417c2d[_0x73d3('0x30')]===_0x73d3('0x2b')&&_0x417c2d[_0x73d3('0xaf')]){for(let _0x255ea1=0x0;_0x255ea1<_0x202c65[_0x73d3('0x5d')];_0x255ea1+=0x1){_0x18a714['push']({'membername':_0x417c2d[_0x73d3('0x3c')],'UserId':_0x417c2d['id'],'queue_name':_0x202c65[_0x255ea1]['name'],'VoiceQueueId':_0x202c65[_0x255ea1]['id'],'interface':_[_0x73d3('0x6b')](_0x417c2d[_0x73d3('0xa2')])?util[_0x73d3('0xb0')](_0x73d3('0xb1'),_0x417c2d[_0x73d3('0x3c')]):_0x417c2d[_0x73d3('0xa2')],'paused':_0x417c2d[_0x73d3('0xa1')]||![],'penalty':_0x164bae[_0x73d3('0x62')][_0x73d3('0xa9')]||0x0});}return Promise[_0x73d3('0x56')](_0x18a714['map'](function(_0x10494f){return db[_0x73d3('0xb2')][_0x73d3('0xb3')](_0x10494f);}));}return _0x1b14bc;});}})[_0x73d3('0x15')](respondWithStatusCode(_0x3154c4,null))['catch'](handleError(_0x3154c4,null));};exports['removeQueues']=function(_0x113d26,_0x2548e4){var _0x2ddc6c,_0xac7d97;return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x113d26[_0x73d3('0x63')]['id']},'attributes':['id','name',_0x73d3('0x30')]})[_0x73d3('0x15')](handleEntityNotFound(_0x2548e4,null))['then'](function(_0x5a9e6a){if(_0x5a9e6a){_0x2ddc6c=_0x5a9e6a;if(!_0x113d26[_0x73d3('0x48')][_0x73d3('0x9f')]||!utils['isValidChannel'](_0x113d26[_0x73d3('0x48')][_0x73d3('0x9f')])){throw new db[(_0x73d3('0x91'))]['ValidationError']('Unknown\x20channel');}return _0x5a9e6a['remove'+_[_0x73d3('0xa5')](_0x113d26[_0x73d3('0x48')][_0x73d3('0x9f')][_0x73d3('0xa6')]())+'Queues'](_0x113d26[_0x73d3('0x48')]['ids']);}})[_0x73d3('0x15')](function(_0x59c662){if(_['isArray'](_0x113d26['query'][_0x73d3('0xa8')])){for(var _0x197545=0x0;_0x197545<_0x113d26['query']['ids'][_0x73d3('0x5d')];_0x197545+=0x1){_0xac7d97={'UserId':Number(_0x113d26[_0x73d3('0x63')]['id'])};_0xac7d97[_[_0x73d3('0xa5')](_0x113d26[_0x73d3('0x48')][_0x73d3('0x9f')][_0x73d3('0xa6')]())+_0x73d3('0xab')]=Number(_0x113d26[_0x73d3('0x48')][_0x73d3('0xa8')][_0x197545]);socket['emit'](_0x73d3('0x80')+_['capitalize'](_0x113d26[_0x73d3('0x48')][_0x73d3('0x9f')]['toLowerCase']())+_0x73d3('0xb4'),_0xac7d97);}}else{_0xac7d97={'UserId':Number(_0x113d26[_0x73d3('0x63')]['id'])};_0xac7d97[_[_0x73d3('0xa5')](_0x113d26['query']['channel']['toLowerCase']())+_0x73d3('0xab')]=Number(_0x113d26[_0x73d3('0x48')][_0x73d3('0xa8')]);socket['emit'](_0x73d3('0x80')+_[_0x73d3('0xa5')](_0x113d26['query'][_0x73d3('0x9f')][_0x73d3('0xa6')]())+_0x73d3('0xb4'),_0xac7d97);}return _0x59c662;})[_0x73d3('0x15')](function(){if(_0x113d26['query']['channel']===_0x73d3('0xad')){return db[_0x73d3('0xb2')][_0x73d3('0x2e')]({'where':{'UserId':_0x113d26[_0x73d3('0x63')]['id'],'VoiceQueueId':_0x113d26[_0x73d3('0x48')][_0x73d3('0xa8')]},'individualHooks':!![]})[_0x73d3('0x15')](function(){return _0x2ddc6c;});}return _0x2ddc6c;})[_0x73d3('0x15')](respondWithStatusCode(_0x2548e4,null))[_0x73d3('0x1f')](handleError(_0x2548e4,null));};exports[_0x73d3('0xb5')]=function(_0x24405e,_0x1ad11f){_0x24405e[_0x73d3('0x62')][_0x73d3('0xb6')]=_0x24405e[_0x73d3('0xb7')]['filename'];return db['User']['find']({'where':{'id':_0x24405e[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x1ad11f,null))[_0x73d3('0x15')](saveUpdates(_0x24405e[_0x73d3('0x62')],null))['then'](respondWithResult(_0x1ad11f,null))['catch'](handleError(_0x1ad11f,null));};exports['getAvatar']=function(_0x40b8aa,_0x1d0a9e){var _0x4fac06=path[_0x73d3('0xb8')](config[_0x73d3('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x40b8aa[_0x73d3('0x63')]['id']},'attributes':['id',_0x73d3('0xb6')],'raw':!![]})[_0x73d3('0x15')](handleEntityNotFound(_0x1d0a9e,null))[_0x73d3('0x15')](function(_0x4fd721){if(_0x4fd721){if(_['isNil'](_0x4fd721['userpic'])){return _0x1d0a9e[_0x73d3('0xba')](_0x4fac06);}else{if(!fs[_0x73d3('0xbb')](path['join'](config[_0x73d3('0xb9')],'server/files/images/',_0x4fd721[_0x73d3('0xb6')]))){return _0x1d0a9e[_0x73d3('0xba')](_0x4fac06);}return _0x1d0a9e[_0x73d3('0xba')](path['join'](config[_0x73d3('0xb9')],_0x73d3('0xbc'),_0x4fd721['userpic']));}}})[_0x73d3('0x1f')](handleError(_0x1d0a9e,null));};exports['getOpenTabs']=function(_0x26e9be,_0x238300){return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x26e9be[_0x73d3('0x63')]['id']},'attributes':['id']})[_0x73d3('0x15')](handleEntityNotFound(_0x238300,null))[_0x73d3('0x15')](function(_0x245b5f){var _0x2349bd=[];values=_0x245b5f[_0x73d3('0x50')];_0x2349bd[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x4f'),_0x245b5f[_0x73d3('0x50')]));_0x2349bd['push'](get_open_tabs(_0x73d3('0x51'),_0x245b5f[_0x73d3('0x50')]));_0x2349bd['push'](get_open_tabs(_0x73d3('0x55'),_0x245b5f[_0x73d3('0x50')]));_0x2349bd[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x61'),_0x245b5f['dataValues']));_0x2349bd[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x52'),_0x245b5f['dataValues']));_0x2349bd[_0x73d3('0x53')](get_open_tabs(_0x73d3('0x54'),_0x245b5f[_0x73d3('0x50')]));return Promise[_0x73d3('0x56')](_0x2349bd);})[_0x73d3('0x15')](function(_0x42ff38){if(_0x42ff38){var _0x51843f=_[_0x73d3('0x38')](values[_0x73d3('0xbd')],function(_0x6baacf){return{'channel':_0x73d3('0xbe'),'id':_0x6baacf['id'],'createdAt':_0x6baacf[_0x73d3('0xbf')]};});var _0x1e8766=_['map'](values[_0x73d3('0xc0')],function(_0x25b86b){return{'channel':_0x73d3('0xc1'),'id':_0x25b86b['id'],'createdAt':_0x25b86b[_0x73d3('0xbf')]};});var _0x1ad388=_[_0x73d3('0x38')](values[_0x73d3('0xc2')],function(_0x50cff3){return{'channel':'OPENCHANNEL','id':_0x50cff3['id'],'createdAt':_0x50cff3[_0x73d3('0xbf')]};});var _0x50eaf2=_[_0x73d3('0x38')](values['MailOpenTabs'],function(_0x5e03b2){return{'channel':_0x73d3('0xc3'),'id':_0x5e03b2['id'],'createdAt':_0x5e03b2[_0x73d3('0xbf')]};});var _0x5c2924=_[_0x73d3('0x38')](values[_0x73d3('0xc4')],function(_0x2ea426){return{'channel':_0x73d3('0xc5'),'id':_0x2ea426['id'],'createdAt':_0x2ea426[_0x73d3('0xbf')]};});var _0x5ba7c2=_['map'](values['WhatsappOpenTabs'],function(_0x580a48){return{'channel':_0x73d3('0xc6'),'id':_0x580a48['id'],'createdAt':_0x580a48['createdAt']};});var _0x443c12=_[_0x73d3('0xc7')](_0x51843f,_0x1e8766,_0x1ad388,_0x50eaf2,_0x5c2924,_0x5ba7c2);var _0x2273bc={'count':_0x443c12[_0x73d3('0x5d')],'rows':_0x443c12};return _0x2273bc;}else return null;})[_0x73d3('0x15')](respondWithResult(_0x238300,null))[_0x73d3('0x1f')](handleError(_0x238300,null));};exports[_0x73d3('0xc8')]=function(_0x4368a8,_0x4164e7){var _0x2e397b={};var _0x5d1fc8={};var _0xa9c56f;var _0x51d6ed;return db[_0x73d3('0x41')]['findOne']({'where':{'id':_0x4368a8[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x4164e7,null))[_0x73d3('0x15')](function(_0x34c676){if(_0x34c676){_0xa9c56f=_0x34c676;_0x5d1fc8[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db['CmContact'][_0x73d3('0x42')]);_0x5d1fc8[_0x73d3('0x48')]=_['keys'](_0x4368a8[_0x73d3('0x48')]);_0x5d1fc8[_0x73d3('0x5a')]=_['intersection'](_0x5d1fc8[_0x73d3('0x5b')],_0x5d1fc8[_0x73d3('0x48')]);_0x2e397b['attributes']=_[_0x73d3('0xc9')](_0x5d1fc8[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x4368a8[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x2e397b['attributes']=_0x2e397b[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x2e397b[_0x73d3('0x4d')]:_0x5d1fc8[_0x73d3('0x5b')];_0x2e397b['order']=qs[_0x73d3('0xca')](_0x4368a8[_0x73d3('0x48')][_0x73d3('0xca')]);_0x2e397b[_0x73d3('0xcb')]=qs[_0x73d3('0x5a')](_[_0x73d3('0xcc')](_0x4368a8[_0x73d3('0x48')],_0x5d1fc8[_0x73d3('0x5a')]));if(_0x4368a8[_0x73d3('0x48')][_0x73d3('0x36')]){_0x2e397b[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x2e397b[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x2e397b[_0x73d3('0x4d')],function(_0x59b5de){var _0x5102cb={};_0x5102cb[_0x59b5de]={'$like':'%'+_0x4368a8[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x5102cb;})});}_0x2e397b=_[_0x73d3('0x5f')]({},_0x2e397b,_0x4368a8['options']);return _0xa9c56f[_0x73d3('0xc8')](_0x2e397b);}})[_0x73d3('0x15')](function(_0x3324a7){if(_0x3324a7){_0x51d6ed=_0x3324a7[_0x73d3('0x5d')];if(_0x4368a8['query'][_0x73d3('0xcd')]('includeAll')){_0x2e397b['include']=[{'model':db[_0x73d3('0xce')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x73d3('0xcf'),'attributes':['id','name',_0x73d3('0xd0')],'where':_0x4368a8[_0x73d3('0x48')][_0x73d3('0xd1')]?{'id':_0x4368a8['query'][_0x73d3('0xd1')]}:undefined,'required':_0x4368a8['query']['tag']?!![]:![]}];}if(!_0x4368a8[_0x73d3('0x48')][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x2e397b[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x4368a8[_0x73d3('0x48')]['limit']);_0x2e397b[_0x73d3('0x24')]=qs['offset'](_0x4368a8[_0x73d3('0x48')]['offset']);}return _0xa9c56f['getContacts'](_0x2e397b);}})[_0x73d3('0x15')](function(_0x3783ac){if(_0x3783ac){return _0x3783ac?{'count':_0x51d6ed,'rows':_0x3783ac}:null;}})[_0x73d3('0x15')](respondWithResult(_0x4164e7,null))['catch'](handleError(_0x4164e7,null));};exports[_0x73d3('0xd3')]=function(_0x1cfbb8,_0x529e69){var _0x17b37f;var _0x1e50ca={};var _0x493b9c;return db['User'][_0x73d3('0x98')]({'where':{'id':_0x1cfbb8[_0x73d3('0x63')]['id']},'attributes':['id',_0x73d3('0x3c'),_0x73d3('0x30')]})['then'](handleEntityNotFound(_0x529e69,null))[_0x73d3('0x15')](function(_0x422d3a){if(!utils[_0x73d3('0xa3')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x9f')])){throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))](_0x73d3('0xd4'));}_0x17b37f=_0x422d3a;var _0x47364f={};_0x47364f[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_[_0x73d3('0xa5')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x9f')])+_0x73d3('0xd5')][_0x73d3('0x42')]);_0x47364f[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x1cfbb8[_0x73d3('0x48')]);_0x47364f['filters']=_[_0x73d3('0xc9')](_0x47364f[_0x73d3('0x5b')],_0x47364f[_0x73d3('0x48')]);_0x1e50ca[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x47364f['model'],qs[_0x73d3('0x5c')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x1e50ca[_0x73d3('0x4d')]=_0x1e50ca[_0x73d3('0x4d')]['length']?_0x1e50ca[_0x73d3('0x4d')]:_0x47364f[_0x73d3('0x5b')];_0x1e50ca[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0xca')]);_0x1e50ca[_0x73d3('0xcb')]=qs[_0x73d3('0x5a')](_['pick'](_0x1cfbb8[_0x73d3('0x48')],_0x47364f[_0x73d3('0x5a')]));if(_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x36')]){_0x1e50ca[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x1e50ca[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x1e50ca[_0x73d3('0x4d')],function(_0x1d30eb){var _0x28d533={};_0x28d533[_0x1d30eb]={'$like':'%'+_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x28d533;})});}_0x1e50ca=_[_0x73d3('0x5f')]({},_0x1e50ca,_0x1cfbb8[_0x73d3('0x60')]);switch(_0x17b37f['role']){case _0x73d3('0x31'):return db[_[_0x73d3('0xa5')](_0x1cfbb8[_0x73d3('0x48')]['channel'])+_0x73d3('0xd5')]['findAll'](_0x1e50ca);case _0x73d3('0x80'):case _0x73d3('0x2b'):return _0x17b37f[_0x73d3('0x2f')+_['capitalize'](_0x1cfbb8['query'][_0x73d3('0x9f')])+_0x73d3('0xa7')](_0x1e50ca);default:throw new db['Sequelize'][(_0x73d3('0x92'))](_0x73d3('0xd7'));}})['then'](function(_0x4c7ffc){_0x493b9c=_0x4c7ffc[_0x73d3('0x5d')];if(!_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x1e50ca[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x25')]);_0x1e50ca[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x1cfbb8[_0x73d3('0x48')]['offset']);}switch(_0x17b37f[_0x73d3('0x30')]){case _0x73d3('0x31'):return db[_[_0x73d3('0xa5')](_0x1cfbb8[_0x73d3('0x48')][_0x73d3('0x9f')])+_0x73d3('0xd5')]['findAll'](_0x1e50ca);case'user':case _0x73d3('0x2b'):return _0x17b37f[_0x73d3('0x2f')+_[_0x73d3('0xa5')](_0x1cfbb8[_0x73d3('0x48')]['channel'])+_0x73d3('0xa7')](_0x1e50ca);}})['then'](function(_0xc891d){return{'count':_0x493b9c,'rows':_0xc891d};})[_0x73d3('0x15')](respondWithResult(_0x529e69,null))[_0x73d3('0x1f')](handleError(_0x529e69,null));};exports[_0x73d3('0xd8')]=function(_0x160c25,_0x2ac17b){var _0xc0db9f={};var _0x15f599={};var _0x57fc37;var _0xc3dda9;return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x160c25[_0x73d3('0x63')]['id']}})['then'](handleEntityNotFound(_0x2ac17b,null))['then'](function(_0x38ed1b){if(_0x38ed1b){_0x57fc37=_0x38ed1b;_0x15f599[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xb2')]['rawAttributes']);_0x15f599[_0x73d3('0x48')]=_['keys'](_0x160c25[_0x73d3('0x48')]);_0x15f599[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x15f599[_0x73d3('0x5b')],_0x15f599['query']);_0xc0db9f[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x15f599[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x160c25[_0x73d3('0x48')][_0x73d3('0x5c')]));_0xc0db9f[_0x73d3('0x4d')]=_0xc0db9f['attributes'][_0x73d3('0x5d')]?_0xc0db9f[_0x73d3('0x4d')]:_0x15f599[_0x73d3('0x5b')];_0xc0db9f[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x160c25['query'][_0x73d3('0xca')]);_0xc0db9f['where']=qs['filters'](_[_0x73d3('0xcc')](_0x160c25[_0x73d3('0x48')],_0x15f599[_0x73d3('0x5a')]));if(_0x160c25[_0x73d3('0x48')]['filter']){_0xc0db9f['where']=_[_0x73d3('0x5f')](_0xc0db9f['where'],{'$or':_[_0x73d3('0x38')](_0xc0db9f[_0x73d3('0x4d')],function(_0x41e4bc){var _0x3b9e82={};_0x3b9e82[_0x41e4bc]={'$like':'%'+_0x160c25[_0x73d3('0x48')]['filter']+'%'};return _0x3b9e82;})});}_0xc0db9f=_[_0x73d3('0x5f')]({},_0xc0db9f,_0x160c25['options']);return _0x57fc37[_0x73d3('0xd8')](_0xc0db9f);}})['then'](function(_0x56b669){if(_0x56b669){_0xc3dda9=_0x56b669[_0x73d3('0x5d')];if(!_0x160c25['query'][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0xc0db9f['limit']=qs[_0x73d3('0x25')](_0x160c25['query'][_0x73d3('0x25')]);_0xc0db9f['offset']=qs[_0x73d3('0x24')](_0x160c25['query'][_0x73d3('0x24')]);}return _0x57fc37['getVoiceQueuesRt'](_0xc0db9f);}})[_0x73d3('0x15')](function(_0x2865fe){if(_0x2865fe){return _0x2865fe?{'count':_0xc3dda9,'rows':_0x2865fe}:null;}})[_0x73d3('0x15')](respondWithResult(_0x2ac17b,null))[_0x73d3('0x1f')](handleError(_0x2ac17b,null));};exports[_0x73d3('0xd9')]=function(_0x30bea0,_0x1860c3){var _0x468573={};var _0x316135={};var _0x383e6d;var _0x4f4386;return db['User']['findOne']({'where':{'id':_0x30bea0[_0x73d3('0x63')]['id']}})['then'](handleEntityNotFound(_0x1860c3,null))[_0x73d3('0x15')](function(_0x3274c7){if(_0x3274c7){_0x383e6d=_0x3274c7;_0x316135['model']=_[_0x73d3('0x58')](db[_0x73d3('0xda')][_0x73d3('0x42')]);_0x316135[_0x73d3('0x48')]=_['keys'](_0x30bea0[_0x73d3('0x48')]);_0x316135[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x316135[_0x73d3('0x5b')],_0x316135[_0x73d3('0x48')]);_0x468573[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x316135['model'],qs['fields'](_0x30bea0['query'][_0x73d3('0x5c')]));_0x468573['attributes']=_0x468573[_0x73d3('0x4d')]['length']?_0x468573['attributes']:_0x316135[_0x73d3('0x5b')];_0x468573['order']=qs['sort'](_0x30bea0[_0x73d3('0x48')][_0x73d3('0xca')]);_0x468573[_0x73d3('0xcb')]=qs[_0x73d3('0x5a')](_['pick'](_0x30bea0['query'],_0x316135[_0x73d3('0x5a')]));if(_0x30bea0[_0x73d3('0x48')]['filter']){_0x468573['where']=_['merge'](_0x468573[_0x73d3('0xcb')],{'$or':_['map'](_0x468573[_0x73d3('0x4d')],function(_0x187d1d){var _0x214723={};_0x214723[_0x187d1d]={'$like':'%'+_0x30bea0[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x214723;})});}_0x468573=_[_0x73d3('0x5f')]({},_0x468573,_0x30bea0[_0x73d3('0x60')]);return _0x383e6d[_0x73d3('0xd9')](_0x468573);}})[_0x73d3('0x15')](function(_0x1d67e3){if(_0x1d67e3){_0x4f4386=_0x1d67e3[_0x73d3('0x5d')];if(!_0x30bea0['query'][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x468573[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x30bea0['query'][_0x73d3('0x25')]);_0x468573[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x30bea0['query']['offset']);}return _0x383e6d['getGroups'](_0x468573);}})[_0x73d3('0x15')](function(_0x33a7d9){if(_0x33a7d9){return _0x33a7d9?{'count':_0x4f4386,'rows':_0x33a7d9}:null;}})[_0x73d3('0x15')](respondWithResult(_0x1860c3,null))[_0x73d3('0x1f')](handleError(_0x1860c3,null));};exports[_0x73d3('0xdb')]=function(_0x4253df,_0x5f17cd){var _0x335d24={'raw':!![],'where':{}};var _0x552dda={};var _0x11e09a={'count':0x0,'rows':[]};return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x4253df[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x5f17cd,null))[_0x73d3('0x15')](function(_0x5dab3){if(_0x5dab3){_0x552dda['model']=_[_0x73d3('0x58')](db[_0x73d3('0xdc')][_0x73d3('0x42')]);_0x552dda[_0x73d3('0x48')]=_['keys'](_0x4253df[_0x73d3('0x48')]);_0x552dda[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x552dda['model'],_0x552dda[_0x73d3('0x48')]);_0x335d24[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x552dda['model'],qs['fields'](_0x4253df[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x335d24[_0x73d3('0x4d')]=_0x335d24['attributes'][_0x73d3('0x5d')]?_0x335d24[_0x73d3('0x4d')]:_0x552dda[_0x73d3('0x5b')];if(!_0x4253df[_0x73d3('0x48')][_0x73d3('0xcd')]('nolimit')){_0x335d24['limit']=qs[_0x73d3('0x25')](_0x4253df[_0x73d3('0x48')][_0x73d3('0x25')]);_0x335d24[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x4253df[_0x73d3('0x48')][_0x73d3('0x24')]);}_0x335d24[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x4253df[_0x73d3('0x48')][_0x73d3('0xca')]);_0x335d24[_0x73d3('0xcb')]=qs['filters'](_[_0x73d3('0xcc')](_0x4253df[_0x73d3('0x48')],_0x552dda['filters']));_0x335d24[_0x73d3('0xcb')][_0x73d3('0xdd')]=_0x5dab3['id'];if(_0x4253df['query'][_0x73d3('0x36')]){_0x335d24[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x335d24[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x335d24[_0x73d3('0x4d')],function(_0x4956dd){var _0x1a46df={};_0x1a46df[_0x4956dd]={'$like':'%'+_0x4253df['query'][_0x73d3('0x36')]+'%'};return _0x1a46df;})});}_0x335d24=_[_0x73d3('0x5f')]({},_0x335d24,_0x4253df[_0x73d3('0x60')]);return db[_0x73d3('0xdc')][_0x73d3('0x27')]({'where':_0x335d24['where']})[_0x73d3('0x15')](function(_0x3c7f83){_0x11e09a[_0x73d3('0x27')]=_0x3c7f83;if(_0x4253df['query'][_0x73d3('0x49')]){_0x335d24[_0x73d3('0x4a')]=[{'all':!![]}];}return db[_0x73d3('0xdc')][_0x73d3('0xde')](_0x335d24);})[_0x73d3('0x15')](function(_0x179e32){_0x11e09a['rows']=_0x179e32;return _0x11e09a;});}})['then'](respondWithFilteredResult(_0x5f17cd,_0x335d24))[_0x73d3('0x1f')](handleError(_0x5f17cd,null));};exports[_0x73d3('0xdf')]=function(_0x53b2e2,_0x5e6856){var _0x2fe12c={'raw':!![],'where':{}};var _0x4d4225={};var _0x24baa3={'count':0x0,'rows':[]};return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x53b2e2[_0x73d3('0x63')]['id']}})['then'](handleEntityNotFound(_0x5e6856,null))[_0x73d3('0x15')](function(_0x11b857){if(_0x11b857){_0x4d4225['model']=_[_0x73d3('0x58')](db[_0x73d3('0xe0')][_0x73d3('0x42')]);_0x4d4225[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x53b2e2[_0x73d3('0x48')]);_0x4d4225[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x4d4225['model'],_0x4d4225[_0x73d3('0x48')]);_0x2fe12c[_0x73d3('0x4d')]=_['intersection'](_0x4d4225[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x53b2e2['query'][_0x73d3('0x5c')]));_0x2fe12c[_0x73d3('0x4d')]=_0x2fe12c[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x2fe12c[_0x73d3('0x4d')]:_0x4d4225['model'];if(!_0x53b2e2['query'][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x2fe12c['limit']=qs[_0x73d3('0x25')](_0x53b2e2[_0x73d3('0x48')][_0x73d3('0x25')]);_0x2fe12c[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x53b2e2[_0x73d3('0x48')][_0x73d3('0x24')]);}_0x2fe12c['order']=qs[_0x73d3('0xca')](_0x53b2e2[_0x73d3('0x48')][_0x73d3('0xca')]);_0x2fe12c[_0x73d3('0xcb')]=qs[_0x73d3('0x5a')](_[_0x73d3('0xcc')](_0x53b2e2['query'],_0x4d4225[_0x73d3('0x5a')]));_0x2fe12c[_0x73d3('0xcb')]['UserId']=_0x11b857['id'];if(_0x53b2e2[_0x73d3('0x48')][_0x73d3('0x36')]){_0x2fe12c['where']=_[_0x73d3('0x5f')](_0x2fe12c[_0x73d3('0xcb')],{'$or':_['map'](_0x2fe12c[_0x73d3('0x4d')],function(_0x468664){var _0x22d457={};_0x22d457[_0x468664]={'$like':'%'+_0x53b2e2[_0x73d3('0x48')]['filter']+'%'};return _0x22d457;})});}_0x2fe12c=_[_0x73d3('0x5f')]({},_0x2fe12c,_0x53b2e2[_0x73d3('0x60')]);return db['ScreenRecording'][_0x73d3('0x27')]({'where':_0x2fe12c[_0x73d3('0xcb')]})['then'](function(_0x5491fc){_0x24baa3['count']=_0x5491fc;if(_0x53b2e2[_0x73d3('0x48')][_0x73d3('0x49')]){_0x2fe12c[_0x73d3('0x4a')]=[{'all':!![]}];}return db['ScreenRecording'][_0x73d3('0xde')](_0x2fe12c);})[_0x73d3('0x15')](function(_0x13ca08){_0x24baa3[_0x73d3('0x4e')]=_0x13ca08;return _0x24baa3;});}})[_0x73d3('0x15')](respondWithFilteredResult(_0x5e6856,_0x2fe12c))[_0x73d3('0x1f')](handleError(_0x5e6856,null));};exports[_0x73d3('0xe1')]=function(_0x19e03e,_0xbee93){var _0x4bc105={};var _0x955ef8={};var _0x3df15a;var _0xc1144a;return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x19e03e[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0xbee93,null))[_0x73d3('0x15')](function(_0x1f243d){if(_0x1f243d){_0x3df15a=_0x1f243d;_0x955ef8[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xe2')][_0x73d3('0x42')]);_0x955ef8[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x19e03e[_0x73d3('0x48')]);_0x955ef8[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x955ef8[_0x73d3('0x5b')],_0x955ef8[_0x73d3('0x48')]);_0x4bc105[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x955ef8['model'],qs[_0x73d3('0x5c')](_0x19e03e['query'][_0x73d3('0x5c')]));_0x4bc105[_0x73d3('0x4d')]=_0x4bc105[_0x73d3('0x4d')]['length']?_0x4bc105[_0x73d3('0x4d')]:_0x955ef8['model'];_0x4bc105[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x19e03e[_0x73d3('0x48')][_0x73d3('0xca')]);_0x4bc105['where']=qs[_0x73d3('0x5a')](_['pick'](_0x19e03e[_0x73d3('0x48')],_0x955ef8[_0x73d3('0x5a')]));if(_0x19e03e[_0x73d3('0x48')][_0x73d3('0x36')]){_0x4bc105[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x4bc105[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x4bc105[_0x73d3('0x4d')],function(_0x5ea796){var _0x133dd7={};_0x133dd7[_0x5ea796]={'$like':'%'+_0x19e03e['query']['filter']+'%'};return _0x133dd7;})});}_0x4bc105=_[_0x73d3('0x5f')]({},_0x4bc105,_0x19e03e[_0x73d3('0x60')]);return _0x3df15a['getChatInteractions'](_0x4bc105);}})[_0x73d3('0x15')](function(_0x1b6c88){if(_0x1b6c88){_0xc1144a=_0x1b6c88[_0x73d3('0x5d')];if(!_0x19e03e[_0x73d3('0x48')]['hasOwnProperty'](_0x73d3('0xd2'))){_0x4bc105[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x19e03e[_0x73d3('0x48')][_0x73d3('0x25')]);_0x4bc105['offset']=qs['offset'](_0x19e03e['query']['offset']);}return _0x3df15a['getChatInteractions'](_0x4bc105);}})['then'](function(_0x271919){if(_0x271919){return _0x271919?{'count':_0xc1144a,'rows':_0x271919}:null;}})[_0x73d3('0x15')](respondWithResult(_0xbee93,null))[_0x73d3('0x1f')](handleError(_0xbee93,null));};exports[_0x73d3('0xe3')]=function(_0xfe2c52,_0x1697c9){var _0x3b158e={};var _0x301fbb={};var _0x2f08da;var _0x527ac8;return db[_0x73d3('0x41')]['findOne']({'where':{'id':_0xfe2c52['params']['id']}})['then'](handleEntityNotFound(_0x1697c9,null))['then'](function(_0x51a950){if(_0x51a950){_0x2f08da=_0x51a950;_0x301fbb[_0x73d3('0x5b')]=_['keys'](db[_0x73d3('0xe4')]['rawAttributes']);_0x301fbb[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0xfe2c52['query']);_0x301fbb[_0x73d3('0x5a')]=_['intersection'](_0x301fbb[_0x73d3('0x5b')],_0x301fbb['query']);_0x3b158e[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x301fbb['model'],qs['fields'](_0xfe2c52['query'][_0x73d3('0x5c')]));_0x3b158e[_0x73d3('0x4d')]=_0x3b158e['attributes'][_0x73d3('0x5d')]?_0x3b158e['attributes']:_0x301fbb['model'];_0x3b158e[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0xfe2c52['query'][_0x73d3('0xca')]);_0x3b158e[_0x73d3('0xcb')]=qs[_0x73d3('0x5a')](_[_0x73d3('0xcc')](_0xfe2c52[_0x73d3('0x48')],_0x301fbb[_0x73d3('0x5a')]));if(_0xfe2c52['query'][_0x73d3('0x36')]){_0x3b158e['where']=_[_0x73d3('0x5f')](_0x3b158e[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x3b158e[_0x73d3('0x4d')],function(_0xcff000){var _0x5de384={};_0x5de384[_0xcff000]={'$like':'%'+_0xfe2c52[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x5de384;})});}_0x3b158e=_[_0x73d3('0x5f')]({},_0x3b158e,_0xfe2c52[_0x73d3('0x60')]);return _0x2f08da[_0x73d3('0xe3')](_0x3b158e);}})[_0x73d3('0x15')](function(_0x13e92b){if(_0x13e92b){_0x527ac8=_0x13e92b['length'];if(!_0xfe2c52[_0x73d3('0x48')][_0x73d3('0xcd')]('nolimit')){_0x3b158e[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0xfe2c52['query'][_0x73d3('0x25')]);_0x3b158e[_0x73d3('0x24')]=qs['offset'](_0xfe2c52['query'][_0x73d3('0x24')]);}return _0x2f08da[_0x73d3('0xe3')](_0x3b158e);}})['then'](function(_0x7e49e0){if(_0x7e49e0){return _0x7e49e0?{'count':_0x527ac8,'rows':_0x7e49e0}:null;}})['then'](respondWithResult(_0x1697c9,null))[_0x73d3('0x1f')](handleError(_0x1697c9,null));};exports[_0x73d3('0xe5')]=function(_0x146e42,_0x307bab){var _0x2cd1df={'raw':!![],'where':{}};var _0x399afe={};var _0x362194={'count':0x0,'rows':[]};return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x146e42[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x307bab,null))['then'](function(_0x123bb3){if(_0x123bb3){_0x399afe[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xe6')]['rawAttributes']);_0x399afe['query']=_['keys'](_0x146e42[_0x73d3('0x48')]);_0x399afe['filters']=_[_0x73d3('0xc9')](_0x399afe[_0x73d3('0x5b')],_0x399afe['query']);_0x2cd1df[_0x73d3('0x4d')]=_['intersection'](_0x399afe['model'],qs[_0x73d3('0x5c')](_0x146e42['query'][_0x73d3('0x5c')]));_0x2cd1df[_0x73d3('0x4d')]=_0x2cd1df[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x2cd1df[_0x73d3('0x4d')]:_0x399afe['model'];if(!_0x146e42[_0x73d3('0x48')][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x2cd1df[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x146e42[_0x73d3('0x48')][_0x73d3('0x25')]);_0x2cd1df['offset']=qs[_0x73d3('0x24')](_0x146e42['query'][_0x73d3('0x24')]);}_0x2cd1df[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x146e42[_0x73d3('0x48')][_0x73d3('0xca')]);_0x2cd1df[_0x73d3('0xcb')]=qs['filters'](_[_0x73d3('0xcc')](_0x146e42['query'],_0x399afe['filters']));_0x2cd1df['where'][_0x73d3('0xdd')]=_0x123bb3['id'];if(_0x146e42['query'][_0x73d3('0x36')]){_0x2cd1df[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x2cd1df[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x2cd1df['attributes'],function(_0x4be47c){var _0x29cec1={};_0x29cec1[_0x4be47c]={'$like':'%'+_0x146e42[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x29cec1;})});}_0x2cd1df=_[_0x73d3('0x5f')]({},_0x2cd1df,_0x146e42[_0x73d3('0x60')]);return db[_0x73d3('0xe6')][_0x73d3('0x27')]({'where':_0x2cd1df[_0x73d3('0xcb')]})[_0x73d3('0x15')](function(_0x178b58){_0x362194['count']=_0x178b58;if(_0x146e42[_0x73d3('0x48')]['includeAll']){_0x2cd1df[_0x73d3('0x4a')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x2cd1df);})[_0x73d3('0x15')](function(_0x4eb9e7){_0x362194['rows']=_0x4eb9e7;return _0x362194;});}})[_0x73d3('0x15')](respondWithFilteredResult(_0x307bab,_0x2cd1df))[_0x73d3('0x1f')](handleError(_0x307bab,null));};exports[_0x73d3('0xe7')]=function(_0x688634,_0x195190){var _0x596d8a={};var _0x2a8940={};var _0x114cfa;var _0x44a366;return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x688634['params']['id']}})['then'](handleEntityNotFound(_0x195190,null))[_0x73d3('0x15')](function(_0x1405d8){if(_0x1405d8){_0x114cfa=_0x1405d8;_0x2a8940[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xe8')][_0x73d3('0x42')]);_0x2a8940[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x688634[_0x73d3('0x48')]);_0x2a8940[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x2a8940[_0x73d3('0x5b')],_0x2a8940[_0x73d3('0x48')]);_0x596d8a[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x2a8940[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x688634[_0x73d3('0x48')]['fields']));_0x596d8a[_0x73d3('0x4d')]=_0x596d8a[_0x73d3('0x4d')]['length']?_0x596d8a[_0x73d3('0x4d')]:_0x2a8940[_0x73d3('0x5b')];_0x596d8a[_0x73d3('0xd6')]=qs['sort'](_0x688634[_0x73d3('0x48')]['sort']);_0x596d8a['where']=qs[_0x73d3('0x5a')](_['pick'](_0x688634[_0x73d3('0x48')],_0x2a8940[_0x73d3('0x5a')]));if(_0x688634[_0x73d3('0x48')][_0x73d3('0x36')]){_0x596d8a[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x596d8a[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x596d8a[_0x73d3('0x4d')],function(_0x2e74c3){var _0x3c766f={};_0x3c766f[_0x2e74c3]={'$like':'%'+_0x688634[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x3c766f;})});}_0x596d8a=_['merge']({},_0x596d8a,_0x688634[_0x73d3('0x60')]);return _0x114cfa[_0x73d3('0xe7')](_0x596d8a);}})[_0x73d3('0x15')](function(_0x54d45d){if(_0x54d45d){_0x44a366=_0x54d45d[_0x73d3('0x5d')];if(!_0x688634['query'][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x596d8a[_0x73d3('0x25')]=qs['limit'](_0x688634[_0x73d3('0x48')][_0x73d3('0x25')]);_0x596d8a[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x688634[_0x73d3('0x48')][_0x73d3('0x24')]);}return _0x114cfa[_0x73d3('0xe7')](_0x596d8a);}})[_0x73d3('0x15')](function(_0x5da48e){if(_0x5da48e){return _0x5da48e?{'count':_0x44a366,'rows':_0x5da48e}:null;}})[_0x73d3('0x15')](respondWithResult(_0x195190,null))['catch'](handleError(_0x195190,null));};exports[_0x73d3('0xe9')]=function(_0x5187bf,_0x30af2c){var _0x201fbc={};var _0x1ba98f={};var _0x59bc2b;var _0x2be7fc;return db['User'][_0x73d3('0x98')]({'where':{'id':_0x5187bf[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x30af2c,null))[_0x73d3('0x15')](function(_0x48bc53){if(_0x48bc53){_0x59bc2b=_0x48bc53;_0x1ba98f[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xea')][_0x73d3('0x42')]);_0x1ba98f[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x5187bf['query']);_0x1ba98f[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x1ba98f[_0x73d3('0x5b')],_0x1ba98f[_0x73d3('0x48')]);_0x201fbc[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x1ba98f[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x5187bf[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x201fbc[_0x73d3('0x4d')]=_0x201fbc['attributes']['length']?_0x201fbc['attributes']:_0x1ba98f[_0x73d3('0x5b')];_0x201fbc[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x5187bf[_0x73d3('0x48')][_0x73d3('0xca')]);_0x201fbc['where']=qs[_0x73d3('0x5a')](_[_0x73d3('0xcc')](_0x5187bf['query'],_0x1ba98f[_0x73d3('0x5a')]));if(_0x5187bf[_0x73d3('0x48')][_0x73d3('0x36')]){_0x201fbc[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x201fbc['where'],{'$or':_[_0x73d3('0x38')](_0x201fbc['attributes'],function(_0x25cefc){var _0x38c01b={};_0x38c01b[_0x25cefc]={'$like':'%'+_0x5187bf['query'][_0x73d3('0x36')]+'%'};return _0x38c01b;})});}_0x201fbc=_[_0x73d3('0x5f')]({},_0x201fbc,_0x5187bf[_0x73d3('0x60')]);return _0x59bc2b['getFaxInteractions'](_0x201fbc);}})[_0x73d3('0x15')](function(_0x37600a){if(_0x37600a){_0x2be7fc=_0x37600a[_0x73d3('0x5d')];if(!_0x5187bf[_0x73d3('0x48')][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0x201fbc['limit']=qs['limit'](_0x5187bf[_0x73d3('0x48')]['limit']);_0x201fbc[_0x73d3('0x24')]=qs['offset'](_0x5187bf[_0x73d3('0x48')][_0x73d3('0x24')]);}return _0x59bc2b[_0x73d3('0xe9')](_0x201fbc);}})[_0x73d3('0x15')](function(_0x3d5d75){if(_0x3d5d75){return _0x3d5d75?{'count':_0x2be7fc,'rows':_0x3d5d75}:null;}})[_0x73d3('0x15')](respondWithResult(_0x30af2c,null))[_0x73d3('0x1f')](handleError(_0x30af2c,null));};exports[_0x73d3('0xeb')]=function(_0x4b86af,_0x2283d8){var _0x111486={};var _0x3d3211={};var _0x5d73b2;var _0x1adbb8;return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x4b86af[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x2283d8,null))[_0x73d3('0x15')](function(_0x25cb7a){if(_0x25cb7a){_0x5d73b2=_0x25cb7a;_0x3d3211[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db[_0x73d3('0xec')][_0x73d3('0x42')]);_0x3d3211[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x4b86af[_0x73d3('0x48')]);_0x3d3211[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x3d3211[_0x73d3('0x5b')],_0x3d3211[_0x73d3('0x48')]);_0x111486[_0x73d3('0x4d')]=_['intersection'](_0x3d3211[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x4b86af[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x111486['attributes']=_0x111486['attributes']['length']?_0x111486[_0x73d3('0x4d')]:_0x3d3211[_0x73d3('0x5b')];_0x111486[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x4b86af[_0x73d3('0x48')][_0x73d3('0xca')]);_0x111486[_0x73d3('0xcb')]=qs['filters'](_[_0x73d3('0xcc')](_0x4b86af[_0x73d3('0x48')],_0x3d3211['filters']));if(_0x4b86af['query']['filter']){_0x111486[_0x73d3('0xcb')]=_['merge'](_0x111486['where'],{'$or':_[_0x73d3('0x38')](_0x111486[_0x73d3('0x4d')],function(_0x4aec78){var _0x129fdd={};_0x129fdd[_0x4aec78]={'$like':'%'+_0x4b86af['query']['filter']+'%'};return _0x129fdd;})});}_0x111486=_['merge']({},_0x111486,_0x4b86af[_0x73d3('0x60')]);return _0x5d73b2[_0x73d3('0xeb')](_0x111486);}})[_0x73d3('0x15')](function(_0xe21eae){if(_0xe21eae){_0x1adbb8=_0xe21eae[_0x73d3('0x5d')];if(!_0x4b86af['query']['hasOwnProperty'](_0x73d3('0xd2'))){_0x111486['limit']=qs[_0x73d3('0x25')](_0x4b86af[_0x73d3('0x48')][_0x73d3('0x25')]);_0x111486[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x4b86af[_0x73d3('0x48')][_0x73d3('0x24')]);}return _0x5d73b2['getWhatsappInteractions'](_0x111486);}})[_0x73d3('0x15')](function(_0x57cada){if(_0x57cada){return _0x57cada?{'count':_0x1adbb8,'rows':_0x57cada}:null;}})[_0x73d3('0x15')](respondWithResult(_0x2283d8,null))[_0x73d3('0x1f')](handleError(_0x2283d8,null));};exports[_0x73d3('0xed')]=function(_0x40d980,_0x48d4b1,_0x1a3170){var _0x440adc;var _0x1bd37b;var _0x467f2b;var _0x538161=!_[_0x73d3('0x6b')](_0x40d980[_0x73d3('0x63')]['id'])?_0x40d980['params']['id']:!_[_0x73d3('0x6b')](_0x40d980[_0x73d3('0x80')]['id'])?_0x40d980[_0x73d3('0x80')]['id']:null;return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x538161,'role':{'$or':['admin',_0x73d3('0x80'),'agent']}},'attributes':['id',_0x73d3('0x3c'),_0x73d3('0xee'),_0x73d3('0xef'),_0x73d3('0x30'),_0x73d3('0x6a'),'loginInPause']})[_0x73d3('0x15')](function(_0x1873d5){if(_0x1873d5){if(_0x1873d5[_0x73d3('0x30')]==='agent'){_0x440adc=_0x1873d5;if(_0x40d980['body']['interface']){_0x467f2b=util[_0x73d3('0xb0')](_0x73d3('0xf0'),_0x440adc[_0x40d980[_0x73d3('0x62')][_0x73d3('0xa2')]]);}else if(_0x40d980['body'][_0x73d3('0xf1')]){_0x467f2b=util[_0x73d3('0xb0')](_0x73d3('0xb1'),_0x40d980[_0x73d3('0x62')]['intrf']);}else{_0x467f2b=util['format']('SIP/%s',_0x440adc['name']);}socket['to'](util[_0x73d3('0xb0')]('user:%s',_0x440adc[_0x73d3('0x3c')]))[_0x73d3('0x2c')](_0x73d3('0xf2'),{'user':{'id':_0x440adc['id'],'name':_0x440adc[_0x73d3('0x3c')]},'ip':_0x40d980[_0x73d3('0xf3')]['x-forwarded-for']||_0x40d980[_0x73d3('0xf4')]['remoteAddress']||_0x40d980[_0x73d3('0xf5')][_0x73d3('0xf6')]||_0x40d980[_0x73d3('0xf4')]['socket'][_0x73d3('0xf6')]});return db[_0x73d3('0xb2')]['destroy']({'where':{'membername':_0x440adc[_0x73d3('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0x73d3('0x91'))][(_0x73d3('0x92'))](_0x73d3('0xf7'));}})['then'](function(){if(_0x440adc){return _0x440adc[_0x73d3('0xf8')]({'raw':!![]});}})[_0x73d3('0x15')](function(_0x486952){if(_0x440adc){if(_0x486952){_0x1bd37b=_0x486952;if(_0x1bd37b['length']){var _0x228870=_0x1bd37b['map'](function(_0x2d33e3){var _0x549fdd={'membername':_0x440adc[_0x73d3('0x3c')],'UserId':_0x440adc['id'],'queue_name':_0x2d33e3['name'],'VoiceQueueId':_0x2d33e3['id'],'interface':_0x467f2b,'paused':_0x440adc[_0x73d3('0xa0')]||![],'penalty':_0x2d33e3[_0x73d3('0xf9')]||0x0};return db[_0x73d3('0xb2')][_0x73d3('0xb3')](_0x549fdd);});return Promise[_0x73d3('0x56')](_0x228870);}}}})[_0x73d3('0x15')](function(){if(_0x440adc){return db['MemberReport'][_0x73d3('0xde')]({'where':{'membername':_0x440adc[_0x73d3('0x3c')],'exitAt':null}});}})['then'](function(_0x350401){if(_0x440adc){var _0x505e79=[];_0x350401['forEach'](function(_0x52be40){_0x505e79['push'](_0x52be40['update']({'exitAt':moment()['format'](_0x73d3('0xfa'))}));});return Promise[_0x73d3('0x56')](_0x505e79);}})[_0x73d3('0x15')](function(){if(_0x440adc){var _0x39ddf9=[];var _0x1e194e=[];var _0x3a7a62=utils['getChannels']();var _0x931fa={'membername':_0x440adc[_0x73d3('0x3c')],'interface':_0x467f2b,'enterAt':moment()[_0x73d3('0xb0')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x440adc[_0x73d3('0x30')],'internal':_0x440adc[_0x73d3('0x6a')]};_0x3a7a62[_0x73d3('0xfb')](function(_0x5d5a86){_0x39ddf9[_0x73d3('0x53')](_[_0x73d3('0x5f')]({'channel':_0x5d5a86,'type':'LOGIN','data1':_0x40d980[_0x73d3('0x62')][_0x73d3('0xfc')],'data2':_0x467f2b},_0x931fa));if(_0x440adc[_0x73d3('0xa0')]){_0x1e194e[_0x73d3('0x53')](_[_0x73d3('0x5f')]({'channel':_0x5d5a86,'type':_0x73d3('0xfd'),'data1':'LOGININPAUSE'},_0x931fa));}});return db['MemberReport'][_0x73d3('0x89')](_0x39ddf9[_0x73d3('0xc7')](_0x1e194e),{'individualHooks':!![]});}})[_0x73d3('0x15')](function(){if(_0x440adc){return _0x440adc[_0x73d3('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x73d3('0xb0')](_0x73d3('0xfa')),'voicePause':_0x440adc['loginInPause']||![],'mailPause':_0x440adc[_0x73d3('0xa0')]||![],'chatPause':_0x440adc[_0x73d3('0xa0')]||![],'faxPause':_0x440adc[_0x73d3('0xa0')]||![],'smsPause':_0x440adc[_0x73d3('0xa0')]||![],'openchannelPause':_0x440adc[_0x73d3('0xa0')]||![],'whatsappPause':_0x440adc[_0x73d3('0xa0')]||![],'pauseType':_0x440adc[_0x73d3('0xa0')]?_0x73d3('0xfe'):null,'interface':_0x467f2b,'lastPauseAt':moment()[_0x73d3('0xb0')](_0x73d3('0xfa'))});}})[_0x73d3('0x15')](function(_0x57c575){if(_0x40d980[_0x73d3('0xff')]){return _0x1a3170();}else{return Promise[_0x73d3('0x100')](_0x57c575)[_0x73d3('0x15')](respondWithResult(_0x48d4b1,null));}})[_0x73d3('0x1f')](handleError(_0x48d4b1,null));};exports['logout']=function(_0x41a806,_0x2323d3){var _0x581813;return db[_0x73d3('0x41')][_0x73d3('0x3b')]({'where':{'id':_0x41a806[_0x73d3('0x63')]['id'],'role':_0x73d3('0x2b')},'attributes':['id',_0x73d3('0x3c'),'role']})['then'](handleEntityNotFound(_0x2323d3,null))['then'](function(_0x155e7d){if(_0x155e7d){_0x581813=_0x155e7d;return db[_0x73d3('0xb2')][_0x73d3('0x2e')]({'where':{'membername':_0x581813['name']},'individualHooks':!![]});}})[_0x73d3('0x15')](function(){return db[_0x73d3('0x101')][_0x73d3('0xde')]({'where':{'membername':_0x581813['name'],'exitAt':null}});})[_0x73d3('0x15')](function(_0x3b9ed0){var _0x560657=[];_0x3b9ed0['forEach'](function(_0x4af0b9){_0x560657[_0x73d3('0x53')](_0x4af0b9[_0x73d3('0x2a')]({'exitAt':moment()[_0x73d3('0xb0')](_0x73d3('0xfa'))}));});return Promise['all'](_0x560657);})[_0x73d3('0x15')](function(){return _0x581813[_0x73d3('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x73d3('0x15')](respondWithResult(_0x2323d3,null))[_0x73d3('0x1f')](handleError(_0x2323d3,null));};exports[_0x73d3('0x102')]=function(_0xe8da16,_0x3ce1da){var _0x2e0eb2;return db['UserVoiceQueueRt'][_0x73d3('0x2a')]({'paused':0x1},{'where':{'UserId':_0xe8da16['params']['id']},'individualHooks':!![]})[_0x73d3('0x15')](function(){return db['User']['find']({'where':{'id':_0xe8da16['params']['id'],'role':_0x73d3('0x2b')},'attributes':['id',_0x73d3('0x3c'),_0x73d3('0x30'),_0x73d3('0x6a'),_0x73d3('0xa2'),_0x73d3('0xaf')]});})['then'](handleEntityNotFound(_0x3ce1da,null))['then'](function(_0x3930cf){if(_0x3930cf){_0x2e0eb2=_0x3930cf;return respondWithRpcPromise('QueuePause','pause',{'id':_0x2e0eb2['id'],'name':_0x2e0eb2[_0x73d3('0x3c')],'pause':!![]});}})[_0x73d3('0x15')](function(){if(_0x2e0eb2){return db[_0x73d3('0x101')][_0x73d3('0xde')]({'where':{'membername':_0x2e0eb2[_0x73d3('0x3c')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x177694){if(_0x177694[_0x73d3('0x5d')]){var _0x53e4be=moment()[_0x73d3('0xb0')](_0x73d3('0xfa'));for(var _0x5e414e=0x0,_0x5bf8c0=_0x177694[_0x73d3('0x5d')];_0x5e414e<_0x5bf8c0;_0x5e414e++){_0x177694[_0x5e414e][_0x73d3('0x103')]({'exitAt':_0x53e4be});}}})[_0x73d3('0x15')](function(){var _0x398627=[];var _0x2776e7=utils['getChannels']();_0x2776e7[_0x73d3('0xfb')](function(_0x6f5988){_0x398627[_0x73d3('0x53')]({'channel':_0x6f5988,'membername':_0x2e0eb2[_0x73d3('0x3c')],'interface':_[_0x73d3('0x6b')](_0x2e0eb2['interface'])?util[_0x73d3('0xb0')](_0x73d3('0xb1'),_0x2e0eb2[_0x73d3('0x3c')]):_0x2e0eb2[_0x73d3('0xa2')],'type':_0x73d3('0xfd'),'enterAt':moment()[_0x73d3('0xb0')](_0x73d3('0xfa')),'data1':_0xe8da16[_0x73d3('0x62')][_0x73d3('0x44')]||_0x73d3('0x104'),'role':_0x2e0eb2['role'],'internal':_0x2e0eb2[_0x73d3('0x6a')]});});return db[_0x73d3('0x101')][_0x73d3('0x89')](_0x398627,{'individualHooks':!![]});})[_0x73d3('0x15')](function(){return _0x2e0eb2[_0x73d3('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xe8da16[_0x73d3('0x62')][_0x73d3('0x44')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x73d3('0xb0')](_0x73d3('0xfa'))});})[_0x73d3('0x15')](respondWithResult(_0x3ce1da,null))[_0x73d3('0x1f')](handleError(_0x3ce1da,null));};exports['unpause']=function(_0x4d2e71,_0x40f833){if(_0x4d2e71['body'][_0x73d3('0x9f')]&&!utils[_0x73d3('0xa3')](_0x4d2e71['body'][_0x73d3('0x9f')])){throw new APIBadRequestError(util[_0x73d3('0xb0')](_0x73d3('0x105'),_0x4d2e71[_0x73d3('0x62')][_0x73d3('0x9f')]));}return db[_0x73d3('0x41')]['find']({'where':{'id':_0x4d2e71[_0x73d3('0x63')]['id']},'attributes':['id','name',_0x73d3('0x30'),_0x73d3('0x6a'),_0x73d3('0xa2'),_0x73d3('0xaf'),_0x73d3('0xa1'),_0x73d3('0x106'),_0x73d3('0x107'),_0x73d3('0x108'),_0x73d3('0x109'),_0x73d3('0x10a'),_0x73d3('0x10b'),_0x73d3('0x10c'),_0x73d3('0x10d')]})[_0x73d3('0x15')](function(_0x4ae85e){if(!_0x4ae85e){throw new APINotFoundError(util[_0x73d3('0xb0')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4d2e71[_0x73d3('0x63')]['id']));}return _0x4ae85e[_0x73d3('0x10e')](_0x4d2e71['body'][_0x73d3('0x9f')]);})[_0x73d3('0x15')](respondWithResult(_0x40f833,null))['catch'](APIHandleError(_0x40f833));};exports[_0x73d3('0x10f')]=function(_0x5e490b,_0x24c20c){var _0x4f5ac1={};var _0x5a41dc={};var _0x203431;var _0xa8faa;return db[_0x73d3('0x41')]['findOne']({'where':{'id':_0x5e490b[_0x73d3('0x63')]['id']}})['then'](handleEntityNotFound(_0x24c20c,null))[_0x73d3('0x15')](function(_0x2b661b){if(_0x2b661b){_0x203431=_0x2b661b;_0x5a41dc[_0x73d3('0x5b')]=_[_0x73d3('0x58')](db['Team'][_0x73d3('0x42')]);_0x5a41dc[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x5e490b[_0x73d3('0x48')]);_0x5a41dc[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x5a41dc[_0x73d3('0x5b')],_0x5a41dc[_0x73d3('0x48')]);_0x4f5ac1[_0x73d3('0x4d')]=_[_0x73d3('0xc9')](_0x5a41dc[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x5e490b[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x4f5ac1[_0x73d3('0x4d')]=_0x4f5ac1[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x4f5ac1['attributes']:_0x5a41dc['model'];_0x4f5ac1['order']=qs[_0x73d3('0xca')](_0x5e490b[_0x73d3('0x48')][_0x73d3('0xca')]);_0x4f5ac1[_0x73d3('0xcb')]=qs['filters'](_['pick'](_0x5e490b['query'],_0x5a41dc[_0x73d3('0x5a')]));if(_0x5e490b['query'][_0x73d3('0x36')]){_0x4f5ac1[_0x73d3('0xcb')]=_[_0x73d3('0x5f')](_0x4f5ac1[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x4f5ac1[_0x73d3('0x4d')],function(_0x47dfb9){var _0x39d99a={};_0x39d99a[_0x47dfb9]={'$like':'%'+_0x5e490b[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x39d99a;})});}_0x4f5ac1=_[_0x73d3('0x5f')]({},_0x4f5ac1,_0x5e490b[_0x73d3('0x60')]);return _0x203431[_0x73d3('0x10f')](_0x4f5ac1);}})[_0x73d3('0x15')](function(_0x29fb47){if(_0x29fb47){_0xa8faa=_0x29fb47[_0x73d3('0x5d')];if(!_0x5e490b[_0x73d3('0x48')]['hasOwnProperty'](_0x73d3('0xd2'))){_0x4f5ac1[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x5e490b[_0x73d3('0x48')][_0x73d3('0x25')]);_0x4f5ac1[_0x73d3('0x24')]=qs[_0x73d3('0x24')](_0x5e490b[_0x73d3('0x48')][_0x73d3('0x24')]);}return _0x203431[_0x73d3('0x10f')](_0x4f5ac1);}})[_0x73d3('0x15')](function(_0x1cead0){if(_0x1cead0){return _0x1cead0?{'count':_0xa8faa,'rows':_0x1cead0}:null;}})[_0x73d3('0x15')](respondWithResult(_0x24c20c,null))['catch'](handleError(_0x24c20c,null));};exports['addTeams']=function(_0x43b352,_0x207371){var _0x5d6d91=_0x43b352['params']['id'];var _0x21d7f9=_0x43b352['body']?_0x43b352['body']['ids']:null;var _0x57691e=[];return Promise[_0x73d3('0x100')]()['then'](function(){if(!_0x21d7f9)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x73d3('0x15')](function(){return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x5d6d91}});})['then'](function(_0x22d0ab){if(!_0x22d0ab)throw new APINotFoundError(util['format'](_0x73d3('0x110'),_0x43b352[_0x73d3('0x63')]['id']));return db[_0x73d3('0x6d')][_0x73d3('0x111')](function(_0x5ee759){return _0x22d0ab[_0x73d3('0x112')](_0x21d7f9,{'transaction':_0x5ee759})['then'](function(){return db[_0x73d3('0x113')][_0x73d3('0xde')]({'where':{'id':{'$in':_0x21d7f9}}});})[_0x73d3('0x15')](function(_0x149b59){var _0x3ad77a=_[_0x73d3('0x38')](_0x149b59,function(_0x2757ac){return _0x2757ac[_0x73d3('0x114')]();});return Promise[_0x73d3('0x56')](_0x3ad77a);})[_0x73d3('0x15')](function(_0x136115){_0x57691e=_[_0x73d3('0x115')](_0x136115);var _0x3f7746=_['map'](_0x57691e,function(_0x27db8e){return _0x27db8e[_0x73d3('0x116')](_0x22d0ab['id'],{'transaction':_0x5ee759});});return Promise[_0x73d3('0x56')](_0x3f7746);})[_0x73d3('0x15')](function(){if(!_0x22d0ab[_0x73d3('0xaf')])return;var _0x2a0d64=_[_0x73d3('0x36')](_0x57691e,function(_0x4b7714){return _0x4b7714[_0x73d3('0x117')](_0x73d3('0x9f'))==='Voice';});var _0x2ac4a9=_[_0x73d3('0x38')](_0x2a0d64,function(_0x4bfe55){return db['UserVoiceQueueRt'][_0x73d3('0xb3')]({'membername':_0x22d0ab[_0x73d3('0x3c')],'UserId':_0x22d0ab['id'],'queue_name':_0x4bfe55[_0x73d3('0x3c')],'VoiceQueueId':_0x4bfe55['id'],'interface':_[_0x73d3('0x6b')](_0x22d0ab[_0x73d3('0xa2')])?util['format']('SIP/%s',_0x22d0ab[_0x73d3('0x3c')]):_0x22d0ab[_0x73d3('0xa2')],'paused':_0x22d0ab[_0x73d3('0xa1')]||![],'penalty':_0x22d0ab[_0x73d3('0xa9')]},{'transaction':_0x5ee759});});return Promise[_0x73d3('0x56')](_0x2ac4a9);})[_0x73d3('0x15')](function(){return db['TeamVoicePrefix'][_0x73d3('0xde')]({'where':{'teamId':{'$in':_0x21d7f9}}});})[_0x73d3('0x15')](function(_0x23480b){var _0x19ca49=_['map'](_0x23480b,function(_0x5549de){return db[_0x73d3('0x118')][_0x73d3('0x7f')]({'UserId':_0x22d0ab['id'],'VoicePrefixId':_0x5549de[_0x73d3('0x119')]},{'transaction':_0x5ee759});});return Promise[_0x73d3('0x56')](_0x19ca49);});});})['then'](function(){for(var _0x2c5fe8=0x0;_0x2c5fe8<_0x57691e[_0x73d3('0x5d')];_0x2c5fe8++){var _0x475571=_0x57691e[_0x2c5fe8][_0x73d3('0x117')](_0x73d3('0x9f'));var _0x271785=_0x475571+_0x73d3('0xab');socket[_0x73d3('0x2c')]('user'+_0x475571+'Queue:save',{'UserId':_0x5d6d91,['queueField']:_0x57691e[_0x2c5fe8]['id']});}})['then'](respondWithStatusCode(_0x207371,null))['catch'](APIHandleError(_0x207371));};exports[_0x73d3('0x11a')]=function(_0x3d1961,_0x5db167){var _0x10835c=_0x3d1961[_0x73d3('0x63')]['id'];var _0x3b88a9=null;if(_0x3d1961['query'][_0x73d3('0xa8')]){_0x3b88a9=_[_0x73d3('0x11b')](_0x3d1961[_0x73d3('0x48')][_0x73d3('0xa8')])?_0x3d1961[_0x73d3('0x48')]['ids']:[_0x3d1961[_0x73d3('0x48')][_0x73d3('0xa8')]];}var _0x3fdcf8=[];return Promise[_0x73d3('0x100')]()[_0x73d3('0x15')](function(){if(!_0x3b88a9)throw new APIBadRequestError(_0x73d3('0x11c'));})[_0x73d3('0x15')](function(){return db['User'][_0x73d3('0x98')]({'where':{'id':_0x10835c}});})['then'](function(_0x3c767f){if(!_0x3c767f)throw new APINotFoundError(util[_0x73d3('0xb0')](_0x73d3('0x110'),_0x3d1961[_0x73d3('0x63')]['id']));return db[_0x73d3('0x6d')][_0x73d3('0x111')](function(_0x4cb2fb){return _0x3c767f['removeTeams'](_0x3b88a9,{'transaction':_0x4cb2fb})['then'](function(){return db['Team'][_0x73d3('0xde')]({'where':{'id':{'$in':_0x3b88a9}}});})[_0x73d3('0x15')](function(_0x2c3920){var _0x3a9011=_['map'](_0x2c3920,function(_0x46b7ac){return _0x46b7ac['getAssociatedQueues']();});return Promise['all'](_0x3a9011);})[_0x73d3('0x15')](function(_0x43ed3c){_0x3fdcf8=_[_0x73d3('0x115')](_0x43ed3c);var _0x5c0045=_[_0x73d3('0x38')](_0x3fdcf8,function(_0x4e2d88){return _0x4e2d88[_0x73d3('0x11d')](_0x3c767f['id'],{'transaction':_0x4cb2fb});});return Promise[_0x73d3('0x56')](_0x5c0045);})[_0x73d3('0x15')](function(){if(!_0x3c767f['online'])return;var _0x21a339=_[_0x73d3('0x36')](_0x3fdcf8,function(_0x357f4a){return _0x357f4a[_0x73d3('0x117')](_0x73d3('0x9f'))===_0x73d3('0x11e');});var _0x137432=_[_0x73d3('0x38')](_0x21a339,function(_0x51eccf){return db[_0x73d3('0xb2')]['destroy']({'where':{'VoiceQueueId':_0x51eccf['id'],'UserId':_0x3c767f['id']},'transaction':_0x4cb2fb});});return Promise[_0x73d3('0x56')](_0x137432);})[_0x73d3('0x15')](function(){return db['TeamVoicePrefix'][_0x73d3('0xde')]({'where':{'teamId':{'$in':_0x3b88a9}}});})['then'](function(_0x156b19){var _0x592fae=_['map'](_0x156b19,function(_0x2363f7){return db['UserVoicePrefix'][_0x73d3('0x2e')]({'where':{'UserId':_0x3c767f['id'],'VoicePrefixId':_0x2363f7[_0x73d3('0x119')]}},{'transaction':_0x4cb2fb});});return Promise[_0x73d3('0x56')](_0x592fae);});});})[_0x73d3('0x15')](function(){for(var _0x5c30f7=0x0;_0x5c30f7<_0x3fdcf8[_0x73d3('0x5d')];_0x5c30f7++){var _0x2cef7a=_0x3fdcf8[_0x5c30f7][_0x73d3('0x117')](_0x73d3('0x9f'));var _0x195576=_0x2cef7a+_0x73d3('0xab');socket[_0x73d3('0x2c')](_0x73d3('0x80')+_0x2cef7a+_0x73d3('0xb4'),{'UserId':_0x10835c,['queueField']:_0x3fdcf8[_0x5c30f7]['id']});}})[_0x73d3('0x15')](respondWithStatusCode(_0x5db167,null))[_0x73d3('0x1f')](APIHandleError(_0x5db167));};exports[_0x73d3('0x11f')]=function(_0x587f7f,_0x2b5145){var _0xe53fc7={};var _0x238db8={};var _0x434e72;var _0x466c6b;return db[_0x73d3('0x41')][_0x73d3('0x98')]({'where':{'id':_0x587f7f[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x2b5145,null))['then'](function(_0x401a3f){if(_0x401a3f){_0x434e72=_0x401a3f;_0x238db8['model']=_[_0x73d3('0x58')](db[_0x73d3('0xce')][_0x73d3('0x42')]);_0x238db8[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x587f7f['query']);_0x238db8[_0x73d3('0x5a')]=_['intersection'](_0x238db8[_0x73d3('0x5b')],_0x238db8[_0x73d3('0x48')]);_0xe53fc7[_0x73d3('0x4d')]=_['intersection'](_0x238db8[_0x73d3('0x5b')],qs['fields'](_0x587f7f[_0x73d3('0x48')][_0x73d3('0x5c')]));_0xe53fc7[_0x73d3('0x4d')]=_0xe53fc7[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0xe53fc7[_0x73d3('0x4d')]:_0x238db8[_0x73d3('0x5b')];_0xe53fc7[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x587f7f[_0x73d3('0x48')]['sort']);_0xe53fc7[_0x73d3('0xcb')]=qs['filters'](_['pick'](_0x587f7f[_0x73d3('0x48')],_0x238db8['filters']));if(_0x587f7f[_0x73d3('0x48')][_0x73d3('0x36')]){_0xe53fc7['where']=_[_0x73d3('0x5f')](_0xe53fc7[_0x73d3('0xcb')],{'$or':_['map'](_0xe53fc7[_0x73d3('0x4d')],function(_0x46b3d9){var _0x467012={};_0x467012[_0x46b3d9]={'$like':'%'+_0x587f7f[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x467012;})});}_0xe53fc7=_['merge']({},_0xe53fc7,_0x587f7f['options']);return _0x434e72[_0x73d3('0x11f')](_0xe53fc7);}})[_0x73d3('0x15')](function(_0x404647){if(_0x404647){_0x466c6b=_0x404647[_0x73d3('0x5d')];if(!_0x587f7f[_0x73d3('0x48')][_0x73d3('0xcd')](_0x73d3('0xd2'))){_0xe53fc7[_0x73d3('0x25')]=qs[_0x73d3('0x25')](_0x587f7f[_0x73d3('0x48')][_0x73d3('0x25')]);_0xe53fc7[_0x73d3('0x24')]=qs['offset'](_0x587f7f['query'][_0x73d3('0x24')]);}return _0x434e72['getLists'](_0xe53fc7);}})[_0x73d3('0x15')](function(_0x3b8097){if(_0x3b8097){return _0x3b8097?{'count':_0x466c6b,'rows':_0x3b8097}:null;}})[_0x73d3('0x15')](respondWithResult(_0x2b5145,null))[_0x73d3('0x1f')](handleError(_0x2b5145,null));};exports['getAgents']=function(_0x4042a9,_0x6201c7){var _0x20b595={};var _0x536764={};var _0x2de2e8;return db[_0x73d3('0x41')]['findOne']({'where':{'id':_0x4042a9[_0x73d3('0x63')]['id']}})[_0x73d3('0x15')](handleEntityNotFound(_0x6201c7,null))['then'](function(_0x27daec){if(_0x27daec){_0x2de2e8=_0x27daec;_0x536764['model']=_[_0x73d3('0x58')](db[_0x73d3('0x41')]['rawAttributes']);_0x536764[_0x73d3('0x48')]=_[_0x73d3('0x58')](_0x4042a9[_0x73d3('0x48')]);_0x536764[_0x73d3('0x5a')]=_[_0x73d3('0xc9')](_0x536764[_0x73d3('0x5b')],_0x536764[_0x73d3('0x48')]);_0x20b595['attributes']=_[_0x73d3('0xc9')](_0x536764[_0x73d3('0x5b')],qs[_0x73d3('0x5c')](_0x4042a9[_0x73d3('0x48')][_0x73d3('0x5c')]));_0x20b595[_0x73d3('0x4d')]=_0x20b595[_0x73d3('0x4d')][_0x73d3('0x5d')]?_0x20b595[_0x73d3('0x4d')]:_0x536764[_0x73d3('0x5b')];_0x20b595[_0x73d3('0xd6')]=qs[_0x73d3('0xca')](_0x4042a9['query']['sort']);_0x20b595[_0x73d3('0xcb')]=qs['filters'](_[_0x73d3('0xcc')](_0x4042a9[_0x73d3('0x48')],_0x536764[_0x73d3('0x5a')]));if(_0x4042a9[_0x73d3('0x48')][_0x73d3('0x36')]){_0x20b595[_0x73d3('0xcb')]=_['merge'](_0x20b595[_0x73d3('0xcb')],{'$or':_[_0x73d3('0x38')](_0x20b595[_0x73d3('0x4d')],function(_0x5c1a84){var _0x4b1ca1={};_0x4b1ca1[_0x5c1a84]={'$like':'%'+_0x4042a9[_0x73d3('0x48')][_0x73d3('0x36')]+'%'};return _0x4b1ca1;})});}_0x20b595[_0x73d3('0x5b')]=db['User'];_0x20b595['as']=_0x73d3('0x33');_0x20b595=_['merge']({},_0x20b595,_0x4042a9[_0x73d3('0x60')]);return _0x2de2e8[_0x73d3('0xf8')]({'include':[_0x20b595]});}})[_0x73d3('0x15')](function(_0x3457b2){if(_0x3457b2){var _0x3a007f={},_0x1cd6c5=[];for(var _0x45440a=0x0;_0x45440a<_0x3457b2[_0x73d3('0x5d')];_0x45440a+=0x1){for(var _0x5d0da6=0x0,_0x52622f;_0x5d0da6<_0x3457b2[_0x45440a][_0x73d3('0x33')][_0x73d3('0x5d')];_0x5d0da6+=0x1){_0x52622f=_0x3457b2[_0x45440a]['Agents'][_0x5d0da6][_0x73d3('0x2f')]({'plain':!![]});_0x3a007f[_0x52622f['id']]=_0x52622f;}}_0x3a007f=_[_0x73d3('0x120')](_0x3a007f);for(var _0x3b9ebb=qs[_0x73d3('0x24')](_0x4042a9[_0x73d3('0x48')][_0x73d3('0x24')]);_0x3b9ebb<_0x3a007f[_0x73d3('0x5d')]&&_0x1cd6c5[_0x73d3('0x5d')]=_0x3b5cb2[_0xe30c('0x4f')]){throw new Error(_0xe30c('0x50'));}})[_0xe30c('0x19')](function(){if(_0x3df434){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3df434[_0xe30c('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x3df434){return _0x3df434[_0xe30c('0x51')]({'raw':!![]});}})['then'](function(_0x23c3fa){if(_0x3df434){if(_0x23c3fa){var _0x536ab9=[];_0x2f39be=_0x23c3fa;if(_0x2f39be['length']){for(var _0x5764ba=0x0;_0x5764ba<_0x2f39be[_0xe30c('0x2c')];_0x5764ba++){_0x536ab9['push'](db[_0xe30c('0x28')][_0xe30c('0x52')]({'membername':_0x3df434[_0xe30c('0x2a')],'UserId':_0x3df434['id'],'queue_name':_0x2f39be[_0x5764ba][_0xe30c('0x2a')],'VoiceQueueId':_0x2f39be[_0x5764ba]['id'],'interface':_0x2b587c,'paused':_0x3df434[_0xe30c('0x4d')]||![],'penalty':_0x2f39be[_0x5764ba][_0xe30c('0x53')]||0x0}));}return BPromise[_0xe30c('0x54')](_0x536ab9);}}}})[_0xe30c('0x19')](function(){if(_0x3df434){return db[_0xe30c('0x29')]['findAll']({'where':{'membername':_0x3df434[_0xe30c('0x2a')],'exitAt':null}});}})[_0xe30c('0x19')](function(_0x34ad0a){if(_0x3df434){if(_0x34ad0a&&_0x34ad0a[_0xe30c('0x2c')]){var _0x4ac9bf=[];_0x34ad0a[_0xe30c('0x55')](function(_0x4a0023){_0x4ac9bf[_0xe30c('0x49')](_0x4a0023[_0xe30c('0x4a')]({'exitAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe30c('0x54')](_0x4ac9bf);}}})[_0xe30c('0x19')](function(){if(_0x3df434){var _0x15efce=[];var _0x435715=[];var _0x73843=utils['getChannels']();var _0x227d70={'membername':_0x3df434['name'],'interface':_0x2b587c,'enterAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3df434[_0xe30c('0x22')],'internal':_0x3df434[_0xe30c('0x23')]};_0x73843[_0xe30c('0x55')](function(_0xdd98e7){_0x15efce[_0xe30c('0x49')](_['merge']({'channel':_0xdd98e7,'type':'LOGIN','data1':_0xe30c('0x56'),'data2':_0x2b587c},_0x227d70));if(_0x3df434[_0xe30c('0x4d')]){_0x435715[_0xe30c('0x49')](_[_0xe30c('0x57')]({'channel':_0xdd98e7,'type':_0xe30c('0x2b'),'data1':_0xe30c('0x58')},_0x227d70));}});return db[_0xe30c('0x29')][_0xe30c('0x36')](_0x15efce[_0xe30c('0x59')](_0x435715),{'individualHooks':!![]});}})[_0xe30c('0x19')](function(){if(_0x3df434){return _0x3df434[_0xe30c('0x4a')]({'online':!![],'lastLoginAt':moment()[_0xe30c('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3df434['loginInPause']||![],'mailPause':_0x3df434['loginInPause']||![],'chatPause':_0x3df434[_0xe30c('0x4d')]||![],'faxPause':_0x3df434[_0xe30c('0x4d')]||![],'smsPause':_0x3df434['loginInPause']||![],'openchannelPause':_0x3df434[_0xe30c('0x4d')]||![],'pauseType':_0x3df434[_0xe30c('0x4d')]?_0xe30c('0x58'):null,'lastPauseAt':moment()[_0xe30c('0x25')](_0xe30c('0x2d')),'interface':_0x2b587c});}})[_0xe30c('0x19')](function(_0xebd8e){_0x575d35(_0xebd8e);})[_0xe30c('0x37')](function(_0x3f26d5){_0x862136(_0x2960fe[_0xe30c('0x1d')](0x1f4,_0x3f26d5[_0xe30c('0x1e')]));});});}; \ No newline at end of file +var _0x2f53=['params','UserVoiceQueueRt','update','MemberReport','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','isValidChannel','findOne','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','forEach','LoginUser','mobile','phone','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','all','merge','callysquare','LOGININPAUSE','concat','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','message','error','ShowUser','find','PauseUser','User','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found'];(function(_0x4d86b2,_0x42bb7b){var _0x48111f=function(_0x5c859c){while(--_0x5c859c){_0x4d86b2['push'](_0x4d86b2['shift']());}};_0x48111f(++_0x42bb7b);}(_0x2f53,0x86));var _0x32f5=function(_0xe848a3,_0x52ab83){_0xe848a3=_0xe848a3-0x0;var _0x2b8d60=_0x2f53[_0xe848a3];return _0x2b8d60;};'use strict';var _=require('lodash');var util=require(_0x32f5('0x0'));var moment=require(_0x32f5('0x1'));var BPromise=require(_0x32f5('0x2'));var Redis=require(_0x32f5('0x3'));var db=require(_0x32f5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x32f5('0x5'))('rpc');var config=require(_0x32f5('0x6'));config[_0x32f5('0x7')]=_[_0x32f5('0x8')](config[_0x32f5('0x7')],{'host':_0x32f5('0x9'),'port':0x18eb});var socket=require(_0x32f5('0xa'))(new Redis(config[_0x32f5('0x7')]));require(_0x32f5('0xb'))[_0x32f5('0xc')](socket);exports[_0x32f5('0xd')]=function(_0x1ffe02){var _0x1093d2=this;return new Promise(function(_0x2fa93b,_0x524a53){return db['User'][_0x32f5('0xe')]({'raw':_0x1ffe02[_0x32f5('0xf')]?_0x1ffe02[_0x32f5('0xf')][_0x32f5('0x10')]===undefined?!![]:![]:!![],'where':_0x1ffe02[_0x32f5('0xf')]?_0x1ffe02[_0x32f5('0xf')][_0x32f5('0x11')]||null:null,'attributes':_0x1ffe02[_0x32f5('0xf')]?_0x1ffe02[_0x32f5('0xf')]['attributes']||null:null,'limit':_0x1ffe02[_0x32f5('0xf')]?_0x1ffe02[_0x32f5('0xf')][_0x32f5('0x12')]||null:null,'include':_0x1ffe02[_0x32f5('0xf')]?_0x1ffe02[_0x32f5('0xf')][_0x32f5('0x13')]?_[_0x32f5('0x14')](_0x1ffe02[_0x32f5('0xf')]['include'],function(_0x274c86){return{'model':db[_0x274c86[_0x32f5('0x15')]],'as':_0x274c86['as'],'attributes':_0x274c86['attributes'],'include':_0x274c86[_0x32f5('0x13')]?_['map'](_0x274c86[_0x32f5('0x13')],function(_0x11de97){return{'model':db[_0x11de97[_0x32f5('0x15')]],'as':_0x11de97['as'],'attributes':_0x11de97[_0x32f5('0x16')],'include':_0x11de97[_0x32f5('0x13')]?_[_0x32f5('0x14')](_0x11de97[_0x32f5('0x13')],function(_0xd032f7){return{'model':db[_0xd032f7[_0x32f5('0x15')]],'as':_0xd032f7['as'],'attributes':_0xd032f7[_0x32f5('0x16')]};}):[]};}):[]};}):[]:[]})[_0x32f5('0x17')](function(_0x132939){logger[_0x32f5('0x18')]('GetUser',_0x1ffe02);logger[_0x32f5('0x19')](_0x32f5('0xd'),_0x1ffe02,JSON[_0x32f5('0x1a')](_0x132939));_0x2fa93b(_0x132939);})[_0x32f5('0x1b')](function(_0x590fc2){logger['error']('GetUser',_0x590fc2[_0x32f5('0x1c')],_0x1ffe02);_0x524a53(_0x1093d2[_0x32f5('0x1d')](0x1f4,_0x590fc2[_0x32f5('0x1c')]));});});};exports[_0x32f5('0x1e')]=function(_0x18195a){var _0x1296e9=this;return new Promise(function(_0x325784,_0x482436){return db['User'][_0x32f5('0x1f')]({'raw':_0x18195a['options']?_0x18195a['options']['raw']===undefined?!![]:![]:!![],'where':_0x18195a['options']?_0x18195a[_0x32f5('0xf')][_0x32f5('0x11')]||null:null,'attributes':_0x18195a[_0x32f5('0xf')]?_0x18195a[_0x32f5('0xf')][_0x32f5('0x16')]||null:null,'include':_0x18195a[_0x32f5('0xf')]?_0x18195a[_0x32f5('0xf')][_0x32f5('0x13')]?_[_0x32f5('0x14')](_0x18195a[_0x32f5('0xf')][_0x32f5('0x13')],function(_0x57ec3e){return{'model':db[_0x57ec3e[_0x32f5('0x15')]],'as':_0x57ec3e['as'],'attributes':_0x57ec3e[_0x32f5('0x16')],'include':_0x57ec3e[_0x32f5('0x13')]?_[_0x32f5('0x14')](_0x57ec3e[_0x32f5('0x13')],function(_0x4b3e97){return{'model':db[_0x4b3e97[_0x32f5('0x15')]],'as':_0x4b3e97['as'],'attributes':_0x4b3e97[_0x32f5('0x16')],'include':_0x4b3e97['include']?_[_0x32f5('0x14')](_0x4b3e97[_0x32f5('0x13')],function(_0x1c5207){return{'model':db[_0x1c5207['model']],'as':_0x1c5207['as'],'attributes':_0x1c5207[_0x32f5('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc4a9be){logger[_0x32f5('0x18')](_0x32f5('0x1e'),_0x18195a);logger[_0x32f5('0x19')](_0x32f5('0x1e'),_0x18195a,JSON['stringify'](_0xc4a9be));_0x325784(_0xc4a9be);})[_0x32f5('0x1b')](function(_0xa7773){logger[_0x32f5('0x1d')](_0x32f5('0x1e'),_0xa7773[_0x32f5('0x1c')],_0x18195a);_0x482436(_0x1296e9[_0x32f5('0x1d')](0x1f4,_0xa7773[_0x32f5('0x1c')]));});});};exports[_0x32f5('0x20')]=function(_0x374e52){var _0x402fec;return db[_0x32f5('0x21')][_0x32f5('0x1f')]({'where':_0x374e52[_0x32f5('0xf')][_0x32f5('0x11')]||{},'attributes':['id',_0x32f5('0x22'),_0x32f5('0x23'),_0x32f5('0x24'),_0x32f5('0x25')]})[_0x32f5('0x17')](function(_0xe58bfe){if(!_0xe58bfe){throw new Error(util[_0x32f5('0x26')](_0x32f5('0x27'),_0x374e52[_0x32f5('0x28')]['id']));}_0x402fec=_0xe58bfe;return db[_0x32f5('0x29')][_0x32f5('0x2a')]({'paused':0x1},{'where':{'UserId':_0x402fec['id']},'individualHooks':!![]});})[_0x32f5('0x17')](function(){return db[_0x32f5('0x2b')]['findAll']({'where':{'membername':_0x402fec[_0x32f5('0x22')],'type':_0x32f5('0x2c'),'exitAt':null}});})[_0x32f5('0x17')](function(_0x512272){if(_0x512272&&_0x512272['length']){var _0x4fe4f9=moment()[_0x32f5('0x26')](_0x32f5('0x2d'));for(var _0x10cc4a=0x0,_0x2b01d1=_0x512272[_0x32f5('0x2e')];_0x10cc4a<_0x2b01d1;_0x10cc4a++){_0x512272[_0x10cc4a][_0x32f5('0x2f')]({'exitAt':_0x4fe4f9});}}})[_0x32f5('0x17')](function(){var _0x26afb6=[];var _0x2c7f70=utils[_0x32f5('0x30')]();_0x2c7f70['forEach'](function(_0x2d36ac){_0x26afb6[_0x32f5('0x31')]({'channel':_0x2d36ac,'membername':_0x402fec['name'],'interface':_[_0x32f5('0x32')](_0x402fec[_0x32f5('0x25')])?util[_0x32f5('0x26')](_0x32f5('0x33'),_0x402fec[_0x32f5('0x22')]):_0x402fec[_0x32f5('0x25')],'type':_0x32f5('0x2c'),'enterAt':moment()[_0x32f5('0x26')](_0x32f5('0x2d')),'data1':_0x374e52[_0x32f5('0x34')][_0x32f5('0x35')]||_0x32f5('0x36'),'role':_0x402fec['role'],'internal':_0x402fec['internal'],'uniqueid':_0x374e52[_0x32f5('0x34')]['uniqueid']||null});});return db['MemberReport']['bulkCreate'](_0x26afb6,{'individualHooks':!![]});})[_0x32f5('0x17')](function(){return _0x402fec['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x374e52['body'][_0x32f5('0x35')]||_0x32f5('0x36'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x32f5('0x1b')](function(_0x426d16){throw _0x426d16;});};exports[_0x32f5('0x37')]=function(_0x3c5544){return Promise[_0x32f5('0x38')]()[_0x32f5('0x17')](function(){if(_0x3c5544[_0x32f5('0x34')][_0x32f5('0x39')]&&!utils[_0x32f5('0x3a')](_0x3c5544[_0x32f5('0x34')]['channel'])){throw new Error(util[_0x32f5('0x26')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3c5544[_0x32f5('0x34')][_0x32f5('0x39')]));}return db[_0x32f5('0x21')][_0x32f5('0x3b')]({'where':_0x3c5544[_0x32f5('0xf')][_0x32f5('0x11')]||{},'attributes':['id',_0x32f5('0x22'),_0x32f5('0x23'),_0x32f5('0x24'),'interface','online','voicePause',_0x32f5('0x3c'),_0x32f5('0x3d'),_0x32f5('0x3e'),_0x32f5('0x3f'),_0x32f5('0x40'),_0x32f5('0x41'),_0x32f5('0x42'),'lastPauseAt']});})[_0x32f5('0x17')](function(_0x5b495c){if(!_0x5b495c){throw new Error(util[_0x32f5('0x26')](_0x32f5('0x27'),_0x3c5544[_0x32f5('0x28')]['id']));}return _0x5b495c[_0x32f5('0x43')](_0x3c5544[_0x32f5('0x34')]['channel'],_0x32f5('0x44'));})[_0x32f5('0x1b')](function(_0x86e14b){throw _0x86e14b;});};exports[_0x32f5('0x45')]=function(_0xe4f0a1){var _0xa7ee2c=this;return new Promise(function(_0x2c4720,_0x551646){var _0x33b2dd;return db[_0x32f5('0x21')][_0x32f5('0x3b')]({'where':_0xe4f0a1[_0x32f5('0xf')][_0x32f5('0x11')]||{},'attributes':['id','name']})[_0x32f5('0x17')](function(_0x37d3b2){if(_0x37d3b2){_0x33b2dd=_0x37d3b2;return db[_0x32f5('0x29')]['destroy']({'where':{'membername':_0x33b2dd['name']},'individualHooks':!![]});}})[_0x32f5('0x17')](function(){if(_0x33b2dd){return db[_0x32f5('0x2b')][_0x32f5('0xe')]({'where':{'membername':_0x33b2dd[_0x32f5('0x22')],'exitAt':null}});}})[_0x32f5('0x17')](function(_0x5cc7c2){if(_0x33b2dd){if(_0x5cc7c2&&_0x5cc7c2[_0x32f5('0x2e')]){var _0x1a91e3=[];_0x5cc7c2[_0x32f5('0x46')](function(_0x1924cc){_0x1a91e3['push'](_0x1924cc['update']({'exitAt':moment()['format'](_0x32f5('0x2d'))}));});return BPromise['all'](_0x1a91e3);}}})[_0x32f5('0x17')](function(){if(_0x33b2dd){return _0x33b2dd[_0x32f5('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x32f5('0x17')](function(_0x3b4179){_0x2c4720(_0x3b4179);})[_0x32f5('0x1b')](function(_0x37af50){_0x551646(_0xa7ee2c['error'](0x1f4,_0x37af50[_0x32f5('0x1c')]));});});};exports[_0x32f5('0x47')]=function(_0x419009){var _0x4d155b=this;return new Promise(function(_0x3c6937,_0x241249){var _0x4c3dd2;var _0x20b428;var _0xca0b68;var _0x4be917;return db[_0x32f5('0x21')][_0x32f5('0x3b')]({'where':_0x419009[_0x32f5('0xf')][_0x32f5('0x11')]||{},'attributes':['id',_0x32f5('0x22'),'role',_0x32f5('0x48'),_0x32f5('0x49'),'internal','loginInPause',_0x32f5('0x25')]})[_0x32f5('0x17')](function(_0x30ee72){if(_0x30ee72){_0x4c3dd2=_0x30ee72;_0x4be917=_0x419009[_0x32f5('0x34')]['interface']?_0x419009[_0x32f5('0x34')][_0x32f5('0x25')]:util['format'](_0x32f5('0x33'),_0x4c3dd2[_0x32f5('0x22')]);return db['User'][_0x32f5('0x4a')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4c3dd2['id']}}});}})[_0x32f5('0x17')](function(_0x41d6fd){if(_0x41d6fd){_0xca0b68=_0x41d6fd;return require('../../config/license/util')[_0x32f5('0x4b')]();}})[_0x32f5('0x17')](function(_0x328c62){if(_0x328c62&&_0x328c62[_0x32f5('0x4c')]&&_0xca0b68>=_0x328c62[_0x32f5('0x4c')]){throw new Error(_0x32f5('0x4d'));}})[_0x32f5('0x17')](function(){if(_0x4c3dd2){return db[_0x32f5('0x29')][_0x32f5('0x4e')]({'where':{'membername':_0x4c3dd2[_0x32f5('0x22')]},'individualHooks':!![]});}})[_0x32f5('0x17')](function(){if(_0x4c3dd2){return _0x4c3dd2[_0x32f5('0x4f')]({'raw':!![]});}})[_0x32f5('0x17')](function(_0xb05850){if(_0x4c3dd2){if(_0xb05850){var _0x16e3ca=[];_0x20b428=_0xb05850;if(_0x20b428[_0x32f5('0x2e')]){for(var _0x4ff726=0x0;_0x4ff726<_0x20b428['length'];_0x4ff726++){_0x16e3ca[_0x32f5('0x31')](db[_0x32f5('0x29')][_0x32f5('0x50')]({'membername':_0x4c3dd2[_0x32f5('0x22')],'UserId':_0x4c3dd2['id'],'queue_name':_0x20b428[_0x4ff726]['name'],'VoiceQueueId':_0x20b428[_0x4ff726]['id'],'interface':_0x4be917,'paused':_0x4c3dd2[_0x32f5('0x51')]||![],'penalty':_0x20b428[_0x4ff726]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x16e3ca);}}}})[_0x32f5('0x17')](function(){if(_0x4c3dd2){return db[_0x32f5('0x2b')]['findAll']({'where':{'membername':_0x4c3dd2[_0x32f5('0x22')],'exitAt':null}});}})['then'](function(_0x1d8b24){if(_0x4c3dd2){if(_0x1d8b24&&_0x1d8b24[_0x32f5('0x2e')]){var _0x4af870=[];_0x1d8b24[_0x32f5('0x46')](function(_0x339ff4){_0x4af870[_0x32f5('0x31')](_0x339ff4[_0x32f5('0x2a')]({'exitAt':moment()[_0x32f5('0x26')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x32f5('0x52')](_0x4af870);}}})[_0x32f5('0x17')](function(){if(_0x4c3dd2){var _0x51269b=[];var _0x5b7391=[];var _0x387a00=utils[_0x32f5('0x30')]();var _0x1ca366={'membername':_0x4c3dd2[_0x32f5('0x22')],'interface':_0x4be917,'enterAt':moment()[_0x32f5('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4c3dd2[_0x32f5('0x23')],'internal':_0x4c3dd2['internal']};_0x387a00['forEach'](function(_0x895e26){_0x51269b['push'](_[_0x32f5('0x53')]({'channel':_0x895e26,'type':'LOGIN','data1':_0x32f5('0x54'),'data2':_0x4be917},_0x1ca366));if(_0x4c3dd2[_0x32f5('0x51')]){_0x5b7391['push'](_['merge']({'channel':_0x895e26,'type':_0x32f5('0x2c'),'data1':_0x32f5('0x55')},_0x1ca366));}});return db[_0x32f5('0x2b')]['bulkCreate'](_0x51269b[_0x32f5('0x56')](_0x5b7391),{'individualHooks':!![]});}})[_0x32f5('0x17')](function(){if(_0x4c3dd2){return _0x4c3dd2[_0x32f5('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x32f5('0x26')](_0x32f5('0x2d')),'voicePause':_0x4c3dd2[_0x32f5('0x51')]||![],'mailPause':_0x4c3dd2[_0x32f5('0x51')]||![],'chatPause':_0x4c3dd2[_0x32f5('0x51')]||![],'faxPause':_0x4c3dd2['loginInPause']||![],'smsPause':_0x4c3dd2[_0x32f5('0x51')]||![],'openchannelPause':_0x4c3dd2[_0x32f5('0x51')]||![],'pauseType':_0x4c3dd2['loginInPause']?_0x32f5('0x55'):null,'lastPauseAt':moment()[_0x32f5('0x26')](_0x32f5('0x2d')),'interface':_0x4be917});}})[_0x32f5('0x17')](function(_0x147998){_0x3c6937(_0x147998);})[_0x32f5('0x1b')](function(_0x4258d5){_0x241249(_0x4d155b[_0x32f5('0x1d')](0x1f4,_0x4258d5['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index cbef781..a677dc9 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 _0x65ea=['removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0x2972ae,_0xff04b){var _0x2e35b3=function(_0xbddd7){while(--_0xbddd7){_0x2972ae['push'](_0x2972ae['shift']());}};_0x2e35b3(++_0xff04b);}(_0x65ea,0x1c4));var _0xa65e=function(_0x26fb81,_0x4d4d56){_0x26fb81=_0x26fb81-0x0;var _0x4b1aae=_0x65ea[_0x26fb81];return _0x4b1aae;};'use strict';var UserEvents=require(_0xa65e('0x0'));var events=[_0xa65e('0x1'),_0xa65e('0x2'),_0xa65e('0x3')];function createListener(_0x2636c7,_0x42f5c5){return function(_0x22effb){_0x42f5c5['emit'](_0x2636c7,_0x22effb);};}function removeListener(_0x575c2d,_0x1a6e70){return function(){UserEvents[_0xa65e('0x4')](_0x575c2d,_0x1a6e70);};}exports[_0xa65e('0x5')]=function(_0x5f0de4){for(var _0x3c2b03=0x0,_0x4e6adf=events[_0xa65e('0x6')];_0x3c2b03<_0x4e6adf;_0x3c2b03++){var _0xd5b548=events[_0x3c2b03];var _0x3c41d6=createListener(_0xa65e('0x7')+_0xd5b548,_0x5f0de4);UserEvents['on'](_0xd5b548,_0x3c41d6);}}; \ No newline at end of file +var _0x74e5=['emit','register','length','user:','./user.events','save','remove','update'];(function(_0x31e587,_0x5a6d6d){var _0x4091e0=function(_0x4fceff){while(--_0x4fceff){_0x31e587['push'](_0x31e587['shift']());}};_0x4091e0(++_0x5a6d6d);}(_0x74e5,0xcc));var _0x574e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x74e5[_0x2a6809];return _0x11c371;};'use strict';var UserEvents=require(_0x574e('0x0'));var events=[_0x574e('0x1'),_0x574e('0x2'),_0x574e('0x3')];function createListener(_0x5a4b53,_0x3eff9f){return function(_0x58b4b2){_0x3eff9f[_0x574e('0x4')](_0x5a4b53,_0x58b4b2);};}function removeListener(_0x3bada8,_0x3c7a27){return function(){UserEvents['removeListener'](_0x3bada8,_0x3c7a27);};}exports[_0x574e('0x5')]=function(_0x5a7024){for(var _0x49787b=0x0,_0x38a476=events[_0x574e('0x6')];_0x49787b<_0x38a476;_0x49787b++){var _0xb295f8=events[_0x49787b];var _0x1a83c8=createListener(_0x574e('0x7')+_0xb295f8,_0x5a7024);UserEvents['on'](_0xb295f8,_0x1a83c8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f3636d5..be5ab1d 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(_0x10f875,_0x51f8cf){var _0x3accfa=function(_0x1918ea){while(--_0x1918ea){_0x10f875['push'](_0x10f875['shift']());}};_0x3accfa(++_0x51f8cf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x19b2d2,_0x2485b2){var _0x183e8e=function(_0x47b88b){while(--_0x47b88b){_0x19b2d2['push'](_0x19b2d2['shift']());}};_0x183e8e(++_0x2485b2);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5ef362d..2a9887f 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 _0xac29=['sequelize','exports'];(function(_0x1b08fe,_0x3db8a6){var _0x732168=function(_0x352709){while(--_0x352709){_0x1b08fe['push'](_0x1b08fe['shift']());}};_0x732168(++_0x3db8a6);}(_0xac29,0x1b8));var _0x9ac2=function(_0x4fc4ff,_0x4a76e3){_0x4fc4ff=_0x4fc4ff-0x0;var _0x4520ac=_0xac29[_0x4fc4ff];return _0x4520ac;};'use strict';var Sequelize=require(_0x9ac2('0x0'));module[_0x9ac2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb1fb=['exports','INTEGER','sequelize'];(function(_0x3fd883,_0x31ca0d){var _0x564b77=function(_0x5cb0e8){while(--_0x5cb0e8){_0x3fd883['push'](_0x3fd883['shift']());}};_0x564b77(++_0x31ca0d);}(_0xb1fb,0xd4));var _0xbb1f=function(_0x6636c1,_0x319f6f){_0x6636c1=_0x6636c1-0x0;var _0x610b0c=_0xb1fb[_0x6636c1];return _0x610b0c;};'use strict';var Sequelize=require(_0xbb1f('0x0'));module[_0xbb1f('0x1')]={'penalty':{'type':Sequelize[_0xbb1f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index cdb9a0f..30351d9 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 _0x1722=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','api'];(function(_0x598cd5,_0x1ee6e7){var _0x40b1ff=function(_0xd09aa7){while(--_0xd09aa7){_0x598cd5['push'](_0x598cd5['shift']());}};_0x40b1ff(++_0x1ee6e7);}(_0x1722,0x1ed));var _0x2172=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1722[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x2172('0x0'));var logger=require('../../config/logger')(_0x2172('0x1'));var moment=require('moment');var BPromise=require(_0x2172('0x2'));var rp=require(_0x2172('0x3'));var fs=require('fs');var path=require(_0x2172('0x4'));var rimraf=require(_0x2172('0x5'));var config=require(_0x2172('0x6'));var attributes=require(_0x2172('0x7'));module[_0x2172('0x8')]=function(_0x51638c,_0xdb2f85){return _0x51638c['define'](_0x2172('0x9'),attributes,{'tableName':_0x2172('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ad5=['user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0x2e2e8c,_0x386c48){var _0x5ca9c7=function(_0x3a5976){while(--_0x3a5976){_0x2e2e8c['push'](_0x2e2e8c['shift']());}};_0x5ca9c7(++_0x386c48);}(_0x3ad5,0x6d));var _0x53ad=function(_0x8b753a,_0x2fde62){_0x8b753a=_0x8b753a-0x0;var _0x23ba7e=_0x3ad5[_0x8b753a];return _0x23ba7e;};'use strict';var _=require('lodash');var util=require(_0x53ad('0x0'));var logger=require(_0x53ad('0x1'))(_0x53ad('0x2'));var moment=require('moment');var BPromise=require(_0x53ad('0x3'));var rp=require(_0x53ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53ad('0x5'));var config=require(_0x53ad('0x6'));var attributes=require(_0x53ad('0x7'));module[_0x53ad('0x8')]=function(_0x392530,_0x112924){return _0x392530[_0x53ad('0x9')](_0x53ad('0xa'),attributes,{'tableName':_0x53ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 8e23a2c..763ce90 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 _0x3b15=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x3b15,0x1df));var _0x53b1=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x3b15[_0x1f8053];return _0x174fd8;};'use strict';var _=require('lodash');var util=require(_0x53b1('0x0'));var moment=require(_0x53b1('0x1'));var BPromise=require(_0x53b1('0x2'));var rs=require(_0x53b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53b1('0x4'))['db'];var utils=require(_0x53b1('0x5'));var logger=require(_0x53b1('0x6'))(_0x53b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x53b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d782,_0x40f998,_0x2badd7){return new BPromise(function(_0xf5c7e5,_0x21d897){return client['request'](_0x32d782,_0x2badd7)['then'](function(_0x55f182){logger[_0x53b1('0x9')](_0x53b1('0xa'),_0x40f998,'request\x20sent');logger[_0x53b1('0xb')](_0x53b1('0xc'),_0x40f998,_0x53b1('0xd'),JSON[_0x53b1('0xe')](_0x55f182));if(_0x55f182[_0x53b1('0xf')]){if(_0x55f182[_0x53b1('0xf')][_0x53b1('0x10')]===0x1f4){logger[_0x53b1('0xf')](_0x53b1('0xa'),_0x40f998,_0x55f182['error'][_0x53b1('0x11')]);return _0x21d897(_0x55f182[_0x53b1('0xf')]['message']);}logger[_0x53b1('0xf')](_0x53b1('0xa'),_0x40f998,_0x55f182[_0x53b1('0xf')][_0x53b1('0x11')]);return _0xf5c7e5(_0x55f182[_0x53b1('0xf')][_0x53b1('0x11')]);}else{logger[_0x53b1('0x9')](_0x53b1('0xa'),_0x40f998,_0x53b1('0xd'));_0xf5c7e5(_0x55f182[_0x53b1('0x12')]['message']);}})[_0x53b1('0x13')](function(_0x406755){logger[_0x53b1('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x40f998,_0x406755);_0x21d897(_0x406755);});});} \ No newline at end of file +var _0xc6c6=['UserChatQueue,\x20%s,\x20%s,\x20%s','error','UserChatQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc6c6,0xa5));var _0x6c6c=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0xc6c6[_0x58381c];return _0x1a7440;};'use strict';var _=require(_0x6c6c('0x0'));var util=require(_0x6c6c('0x1'));var moment=require(_0x6c6c('0x2'));var BPromise=require(_0x6c6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c6c('0x4'));var db=require(_0x6c6c('0x5'))['db'];var utils=require(_0x6c6c('0x6'));var logger=require(_0x6c6c('0x7'))(_0x6c6c('0x8'));var config=require('../../config/environment');var jayson=require(_0x6c6c('0x9'));var client=jayson['client'][_0x6c6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bf236,_0x8eeba8,_0x5e2f9b){return new BPromise(function(_0x558caa,_0x269cf5){return client['request'](_0x1bf236,_0x5e2f9b)[_0x6c6c('0xb')](function(_0x3e0eac){logger[_0x6c6c('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x8eeba8,_0x6c6c('0xd'));logger[_0x6c6c('0xe')](_0x6c6c('0xf'),_0x8eeba8,_0x6c6c('0xd'),JSON['stringify'](_0x3e0eac));if(_0x3e0eac[_0x6c6c('0x10')]){if(_0x3e0eac[_0x6c6c('0x10')]['code']===0x1f4){logger['error'](_0x6c6c('0x11'),_0x8eeba8,_0x3e0eac[_0x6c6c('0x10')]['message']);return _0x269cf5(_0x3e0eac['error'][_0x6c6c('0x12')]);}logger[_0x6c6c('0x10')](_0x6c6c('0x11'),_0x8eeba8,_0x3e0eac['error']['message']);return _0x558caa(_0x3e0eac[_0x6c6c('0x10')][_0x6c6c('0x12')]);}else{logger['info'](_0x6c6c('0x11'),_0x8eeba8,'request\x20sent');_0x558caa(_0x3e0eac['result'][_0x6c6c('0x12')]);}})[_0x6c6c('0x13')](function(_0x3aee01){logger['error'](_0x6c6c('0x11'),_0x8eeba8,_0x3aee01);_0x269cf5(_0x3aee01);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b6bd495..8bc9f51 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4a4e6a,_0x72875f){var _0x4b9879=function(_0x5f35bd){while(--_0x5f35bd){_0x4a4e6a['push'](_0x4a4e6a['shift']());}};_0x4b9879(++_0x72875f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3f3f40,_0x4e745f){var _0x32c366=function(_0x343f6a){while(--_0x343f6a){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x32c366(++_0x4e745f);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'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 9512625..e275338 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 _0xa468=['INTEGER','sequelize'];(function(_0x1df7b8,_0x2fe5e5){var _0x29d911=function(_0x340121){while(--_0x340121){_0x1df7b8['push'](_0x1df7b8['shift']());}};_0x29d911(++_0x2fe5e5);}(_0xa468,0x13f));var _0x8a46=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa468[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8a46('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8a46('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8a46('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa6b5=['INTEGER'];(function(_0x3a0155,_0x3a5ebc){var _0x564ab1=function(_0x1ada20){while(--_0x1ada20){_0x3a0155['push'](_0x3a0155['shift']());}};_0x564ab1(++_0x3a5ebc);}(_0xa6b5,0xa9));var _0x5a6b=function(_0x4a3e20,_0x183216){_0x4a3e20=_0x4a3e20-0x0;var _0x1722d8=_0xa6b5[_0x4a3e20];return _0x1722d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5a6b('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5a6b('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5b17742..a4800a3 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 _0xace0=['moment','bluebird','path','./userFaxQueue.attributes','define','UserFaxQueue','lodash','util','../../config/logger','api'];(function(_0x2a0eb8,_0x48affb){var _0x51f8d9=function(_0x1b9875){while(--_0x1b9875){_0x2a0eb8['push'](_0x2a0eb8['shift']());}};_0x51f8d9(++_0x48affb);}(_0xace0,0x164));var _0x0ace=function(_0x171fa7,_0x587eca){_0x171fa7=_0x171fa7-0x0;var _0xc894e1=_0xace0[_0x171fa7];return _0xc894e1;};'use strict';var _=require(_0x0ace('0x0'));var util=require(_0x0ace('0x1'));var logger=require(_0x0ace('0x2'))(_0x0ace('0x3'));var moment=require(_0x0ace('0x4'));var BPromise=require(_0x0ace('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ace('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0ace('0x7'));module['exports']=function(_0x45ba06,_0x52aaf6){return _0x45ba06[_0x0ace('0x8')](_0x0ace('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3b3=['moment','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','util','api'];(function(_0x1f7863,_0xed5ba1){var _0x2cabd1=function(_0x4d4b6a){while(--_0x4d4b6a){_0x1f7863['push'](_0x1f7863['shift']());}};_0x2cabd1(++_0xed5ba1);}(_0xf3b3,0xee));var _0x3f3b=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xf3b3[_0x310504];return _0x5b36d0;};'use strict';var _=require('lodash');var util=require(_0x3f3b('0x0'));var logger=require('../../config/logger')(_0x3f3b('0x1'));var moment=require(_0x3f3b('0x2'));var BPromise=require(_0x3f3b('0x3'));var rp=require(_0x3f3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f3b('0x5'));var attributes=require(_0x3f3b('0x6'));module[_0x3f3b('0x7')]=function(_0x4a30af,_0x5c5857){return _0x4a30af[_0x3f3b('0x8')](_0x3f3b('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 0466ae2..fd2f384 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 _0x7ad6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message'];(function(_0x431fa5,_0x2a377a){var _0x3cce13=function(_0x3041a7){while(--_0x3041a7){_0x431fa5['push'](_0x431fa5['shift']());}};_0x3cce13(++_0x2a377a);}(_0x7ad6,0x9e));var _0x67ad=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7ad6[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x67ad('0x0'));var util=require(_0x67ad('0x1'));var moment=require(_0x67ad('0x2'));var BPromise=require(_0x67ad('0x3'));var rs=require(_0x67ad('0x4'));var fs=require('fs');var Redis=require(_0x67ad('0x5'));var db=require(_0x67ad('0x6'))['db'];var utils=require(_0x67ad('0x7'));var logger=require(_0x67ad('0x8'))(_0x67ad('0x9'));var config=require(_0x67ad('0xa'));var jayson=require(_0x67ad('0xb'));var client=jayson[_0x67ad('0xc')][_0x67ad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x143ae5,_0x43d50c,_0x14f023){return new BPromise(function(_0x4ed6d1,_0x3d4ec3){return client['request'](_0x143ae5,_0x14f023)[_0x67ad('0xe')](function(_0x3c9278){logger[_0x67ad('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x43d50c,_0x67ad('0x10'));logger[_0x67ad('0x11')](_0x67ad('0x12'),_0x43d50c,_0x67ad('0x10'),JSON[_0x67ad('0x13')](_0x3c9278));if(_0x3c9278[_0x67ad('0x14')]){if(_0x3c9278[_0x67ad('0x14')][_0x67ad('0x15')]===0x1f4){logger[_0x67ad('0x14')](_0x67ad('0x16'),_0x43d50c,_0x3c9278[_0x67ad('0x14')]['message']);return _0x3d4ec3(_0x3c9278[_0x67ad('0x14')]['message']);}logger[_0x67ad('0x14')](_0x67ad('0x16'),_0x43d50c,_0x3c9278['error']['message']);return _0x4ed6d1(_0x3c9278['error'][_0x67ad('0x17')]);}else{logger[_0x67ad('0xf')](_0x67ad('0x16'),_0x43d50c,_0x67ad('0x10'));_0x4ed6d1(_0x3c9278[_0x67ad('0x18')][_0x67ad('0x17')]);}})[_0x67ad('0x19')](function(_0x2ce7e2){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x43d50c,_0x2ce7e2);_0x3d4ec3(_0x2ce7e2);});});} \ No newline at end of file +var _0xc45e=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','UserFaxQueue,\x20%s,\x20%s','message','result'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xc45e,0x17b));var _0xec45=function(_0x5ab20a,_0x9677a0){_0x5ab20a=_0x5ab20a-0x0;var _0x2414c4=_0xc45e[_0x5ab20a];return _0x2414c4;};'use strict';var _=require('lodash');var util=require(_0xec45('0x0'));var moment=require(_0xec45('0x1'));var BPromise=require(_0xec45('0x2'));var rs=require(_0xec45('0x3'));var fs=require('fs');var Redis=require(_0xec45('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec45('0x5'));var logger=require(_0xec45('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xec45('0x7'));var client=jayson[_0xec45('0x8')][_0xec45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4859e4,_0x4a1c86,_0x8f4e8c){return new BPromise(function(_0x22ce0c,_0x7bf59b){return client[_0xec45('0xa')](_0x4859e4,_0x8f4e8c)[_0xec45('0xb')](function(_0x2c6574){logger[_0xec45('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x4a1c86,_0xec45('0xd'));logger[_0xec45('0xe')](_0xec45('0xf'),_0x4a1c86,'request\x20sent',JSON['stringify'](_0x2c6574));if(_0x2c6574[_0xec45('0x10')]){if(_0x2c6574[_0xec45('0x10')]['code']===0x1f4){logger[_0xec45('0x10')](_0xec45('0x11'),_0x4a1c86,_0x2c6574['error'][_0xec45('0x12')]);return _0x7bf59b(_0x2c6574[_0xec45('0x10')][_0xec45('0x12')]);}logger[_0xec45('0x10')](_0xec45('0x11'),_0x4a1c86,_0x2c6574['error']['message']);return _0x22ce0c(_0x2c6574[_0xec45('0x10')][_0xec45('0x12')]);}else{logger[_0xec45('0xc')](_0xec45('0x11'),_0x4a1c86,_0xec45('0xd'));_0x22ce0c(_0x2c6574[_0xec45('0x13')]['message']);}})[_0xec45('0x14')](function(_0x576960){logger[_0xec45('0x10')](_0xec45('0x11'),_0x4a1c86,_0x576960);_0x7bf59b(_0x576960);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8a371fa..d1b3b14 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xc657a4,_0xbb39f5){var _0x11e195=function(_0x3bd384){while(--_0x3bd384){_0xc657a4['push'](_0xc657a4['shift']());}};_0x11e195(++_0xbb39f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xcb91[_0x1c5142];return _0x1268cb;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x349712,_0x22c2a1){var _0x4382f5=function(_0x130d9c){while(--_0x130d9c){_0x349712['push'](_0x349712['shift']());}};_0x4382f5(++_0x22c2a1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xcb91[_0x4d08b8];return _0x70214a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 03f2f55..99b166c 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 _0xd8a7=['sequelize','INTEGER'];(function(_0x20a8ea,_0x3937d8){var _0x4df51b=function(_0x1c6780){while(--_0x1c6780){_0x20a8ea['push'](_0x20a8ea['shift']());}};_0x4df51b(++_0x3937d8);}(_0xd8a7,0x15e));var _0x7d8a=function(_0x4e1bf7,_0x2e5005){_0x4e1bf7=_0x4e1bf7-0x0;var _0xff3dae=_0xd8a7[_0x4e1bf7];return _0xff3dae;};'use strict';var Sequelize=require(_0x7d8a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7d8a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3ccc=['INTEGER','sequelize'];(function(_0x4b70ea,_0x24c617){var _0x3cc3c4=function(_0x371d95){while(--_0x371d95){_0x4b70ea['push'](_0x4b70ea['shift']());}};_0x3cc3c4(++_0x24c617);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x599aaf,_0x3d3622){_0x599aaf=_0x599aaf-0x0;var _0xd995f3=_0x3ccc[_0x599aaf];return _0xd995f3;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc3cc('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 75f0109..3935a50 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 _0xc89b=['user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x44c2ca,_0x115a04){var _0x4bdb20=function(_0x327152){while(--_0x327152){_0x44c2ca['push'](_0x44c2ca['shift']());}};_0x4bdb20(++_0x115a04);}(_0xc89b,0x1b3));var _0xbc89=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xc89b[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xbc89('0x0'));var util=require(_0xbc89('0x1'));var logger=require(_0xbc89('0x2'))(_0xbc89('0x3'));var moment=require('moment');var BPromise=require(_0xbc89('0x4'));var rp=require(_0xbc89('0x5'));var fs=require('fs');var path=require(_0xbc89('0x6'));var rimraf=require(_0xbc89('0x7'));var config=require(_0xbc89('0x8'));var attributes=require(_0xbc89('0x9'));module[_0xbc89('0xa')]=function(_0x2fd8a8,_0x4a924f){return _0x2fd8a8[_0xbc89('0xb')](_0xbc89('0xc'),attributes,{'tableName':_0xbc89('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e4=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x20e4,0x1c2));var _0x420e=function(_0x380d3c,_0xda738e){_0x380d3c=_0x380d3c-0x0;var _0x477ade=_0x20e4[_0x380d3c];return _0x477ade;};'use strict';var _=require(_0x420e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x420e('0x1'));var moment=require(_0x420e('0x2'));var BPromise=require(_0x420e('0x3'));var rp=require(_0x420e('0x4'));var fs=require('fs');var path=require(_0x420e('0x5'));var rimraf=require(_0x420e('0x6'));var config=require(_0x420e('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x420e('0x8')]=function(_0x53027a,_0x1f183f){return _0x53027a['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 89f6612..7ce4ea7 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x3599bf,_0x12db3d){var _0x34f329=function(_0x1d243d){while(--_0x1d243d){_0x3599bf['push'](_0x3599bf['shift']());}};_0x34f329(++_0x12db3d);}(_0x55ca,0x126));var _0xa55c=function(_0x3407ee,_0xb2e716){_0x3407ee=_0x3407ee-0x0;var _0x1b0b35=_0x55ca[_0x3407ee];return _0x1b0b35;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x5ce795,_0xe3be6b){var _0x105364=function(_0x2f2a79){while(--_0x2f2a79){_0x5ce795['push'](_0x5ce795['shift']());}};_0x105364(++_0xe3be6b);}(_0x55ca,0x126));var _0xa55c=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0x55ca[_0x407bd8];return _0x20b6c9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a792c7c..0b2745c 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 _0x3322=['sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0xd08b77,_0x125c19){var _0xfe0936=function(_0x209cc4){while(--_0x209cc4){_0xd08b77['push'](_0xd08b77['shift']());}};_0xfe0936(++_0x125c19);}(_0x3322,0x14c));var _0x2332=function(_0x3a177c,_0xfb1964){_0x3a177c=_0x3a177c-0x0;var _0x291a58=_0x3322[_0x3a177c];return _0x291a58;};'use strict';var multer=require(_0x2332('0x0'));var util=require(_0x2332('0x1'));var path=require(_0x2332('0x2'));var timeout=require(_0x2332('0x3'));var express=require(_0x2332('0x4'));var router=express[_0x2332('0x5')]();var fs_extra=require(_0x2332('0x6'));var auth=require(_0x2332('0x7'));var interaction=require(_0x2332('0x8'));var config=require(_0x2332('0x9'));var controller=require(_0x2332('0xa'));router[_0x2332('0xb')]('/',auth[_0x2332('0xc')](),controller[_0x2332('0xd')]);module[_0x2332('0xe')]=router; \ No newline at end of file +var _0x6756=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x6756,0x6d));var _0x6675=function(_0x41c792,_0x27dd28){_0x41c792=_0x41c792-0x0;var _0x4402e2=_0x6756[_0x41c792];return _0x4402e2;};'use strict';var multer=require(_0x6675('0x0'));var util=require(_0x6675('0x1'));var path=require('path');var timeout=require(_0x6675('0x2'));var express=require(_0x6675('0x3'));var router=express[_0x6675('0x4')]();var fs_extra=require(_0x6675('0x5'));var auth=require(_0x6675('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6675('0x7'));router[_0x6675('0x8')]('/',auth[_0x6675('0x9')](),controller[_0x6675('0xa')]);module[_0x6675('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index a84ebfd..e2f3298 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 _0x6108=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0x6108,0xe7));var _0x8610=function(_0x15e117,_0x1e2339){_0x15e117=_0x15e117-0x0;var _0x47420b=_0x6108[_0x15e117];return _0x47420b;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x8610('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8610('0x2')]},'beep':{'type':Sequelize[_0x8610('0x3')]}}; \ No newline at end of file +var _0xacb5=['TEXT','STRING','BOOLEAN','exports'];(function(_0x39ec13,_0x8fc387){var _0x29a3cd=function(_0x365f89){while(--_0x365f89){_0x39ec13['push'](_0x39ec13['shift']());}};_0x29a3cd(++_0x8fc387);}(_0xacb5,0x19f));var _0x5acb=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xacb5[_0x8dc04d];return _0x2f5f28;};'use strict';var Sequelize=require('sequelize');module[_0x5acb('0x0')]={'body':{'type':Sequelize[_0x5acb('0x1')]},'senderName':{'type':Sequelize[_0x5acb('0x2')]},'recipientsId':{'type':Sequelize[_0x5acb('0x1')]},'recipientsDescription':{'type':Sequelize[_0x5acb('0x2')]},'beep':{'type':Sequelize[_0x5acb('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a1d13aa..0c94dc0 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 _0x2ada=['sequelize','transaction','create','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','ids','queue','Queue','push','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','then','destroy','end','error','name','send','sendUserNotification','hasOwnProperty','text','body','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy'];(function(_0x3738ad,_0x4e25ae){var _0x253a25=function(_0x31954a){while(--_0x31954a){_0x3738ad['push'](_0x3738ad['shift']());}};_0x253a25(++_0x4e25ae);}(_0x2ada,0xcc));var _0xa2ad=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x2ada[_0x5224ba];return _0x459bd2;};'use strict';var emlformat=require(_0xa2ad('0x0'));var rimraf=require(_0xa2ad('0x1'));var zipdir=require(_0xa2ad('0x2'));var jsonpatch=require(_0xa2ad('0x3'));var rp=require(_0xa2ad('0x4'));var moment=require(_0xa2ad('0x5'));var BPromise=require(_0xa2ad('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2ad('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa2ad('0x8'));var fs=require('fs');var fs_extra=require(_0xa2ad('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa2ad('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2ad('0xb'));var Redis=require('ioredis');var authService=require(_0xa2ad('0xc'));var qs=require(_0xa2ad('0xd'));var as=require(_0xa2ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2ad('0xf'))(_0xa2ad('0x10'));var utils=require(_0xa2ad('0x11'));var config=require(_0xa2ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2ad('0x13'))['db'];config[_0xa2ad('0x14')]=_['defaults'](config[_0xa2ad('0x14')],{'host':_0xa2ad('0x15'),'port':0x18eb});var socket=require(_0xa2ad('0x16'))(new Redis(config[_0xa2ad('0x14')]));require(_0xa2ad('0x17'))[_0xa2ad('0x18')](socket);function respondWithStatusCode(_0x427f78,_0x4f4c5a){_0x4f4c5a=_0x4f4c5a||0xcc;return function(_0x149adc){if(_0x149adc){return _0x427f78[_0xa2ad('0x19')](_0x4f4c5a);}return _0x427f78[_0xa2ad('0x1a')](_0x4f4c5a)['end']();};}function respondWithResult(_0x1b735f,_0x70a05a){_0x70a05a=_0x70a05a||0xc8;return function(_0x2bda0d){if(_0x2bda0d){return _0x1b735f['status'](_0x70a05a)[_0xa2ad('0x1b')](_0x2bda0d);}};}function respondWithFilteredResult(_0x380346,_0xe9e8a7){return function(_0x3056a9){if(_0x3056a9){var _0x3ff3cc=typeof _0xe9e8a7[_0xa2ad('0x1c')]===_0xa2ad('0x1d')&&typeof _0xe9e8a7['limit']===_0xa2ad('0x1d');var _0x11b06d=_0x3056a9[_0xa2ad('0x1e')];var _0x26c4ad=_0x3ff3cc?0x0:_0xe9e8a7[_0xa2ad('0x1c')];var _0x41a3a5=_0x3ff3cc?_0x3056a9['count']:_0xe9e8a7[_0xa2ad('0x1c')]+_0xe9e8a7[_0xa2ad('0x1f')];var _0x43bdfa;if(_0x41a3a5>=_0x11b06d){_0x41a3a5=_0x11b06d;_0x43bdfa=0xc8;}else{_0x43bdfa=0xce;}_0x380346['status'](_0x43bdfa);return _0x380346['set']('Content-Range',_0x26c4ad+'-'+_0x41a3a5+'/'+_0x11b06d)['json'](_0x3056a9);}return null;};}function patchUpdates(_0x13366c){return function(_0x11fff4){try{jsonpatch[_0xa2ad('0x20')](_0x11fff4,_0x13366c,!![]);}catch(_0x254a7f){return BPromise[_0xa2ad('0x21')](_0x254a7f);}return _0x11fff4['save']();};}function saveUpdates(_0x5922dc,_0x4c9383){return function(_0x4c695b){if(_0x4c695b){return _0x4c695b['update'](_0x5922dc)[_0xa2ad('0x22')](function(_0x77ac47){return _0x77ac47;});}return null;};}function removeEntity(_0x7ac16f,_0x4d5d7d){return function(_0x4ca74c){if(_0x4ca74c){return _0x4ca74c[_0xa2ad('0x23')]()['then'](function(){_0x7ac16f[_0xa2ad('0x1a')](0xcc)[_0xa2ad('0x24')]();});}};}function handleEntityNotFound(_0xc3939f,_0x5de522){return function(_0x2e6c7f){if(!_0x2e6c7f){_0xc3939f[_0xa2ad('0x19')](0x194);}return _0x2e6c7f;};}function handleError(_0x388235,_0x2f04e3){_0x2f04e3=_0x2f04e3||0x1f4;return function(_0x499dfb){logger[_0xa2ad('0x25')](_0x499dfb['stack']);if(_0x499dfb[_0xa2ad('0x26')]){delete _0x499dfb[_0xa2ad('0x26')];}_0x388235[_0xa2ad('0x1a')](_0x2f04e3)[_0xa2ad('0x27')](_0x499dfb);};}exports[_0xa2ad('0x28')]=function(_0x4e1d6e,_0x153a4b,_0x483dae){if(!_0x4e1d6e['body'][_0xa2ad('0x29')](_0xa2ad('0x2a'))&&!_0x4e1d6e[_0xa2ad('0x2b')]['hasOwnProperty']('TemplateId')){throw new db[(_0xa2ad('0x2c'))]['ValidationError'](_0xa2ad('0x2d'));}else{if(_0x4e1d6e['body'][_0xa2ad('0x29')](_0xa2ad('0x2e'))&&!_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')](_0xa2ad('0x2f'))){throw new db['Sequelize']['ValidationError'](_0xa2ad('0x30'));}if(!_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')]('recipients')){throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))](_0xa2ad('0x32'));}else{try{var _0xbdcd1a=JSON['parse'](_0x4e1d6e['body'][_0xa2ad('0x33')]);}catch(_0x3ccfdc){logger['error'](_0x3ccfdc);throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3eb38d=[_0xa2ad('0x34'),_0xa2ad('0x35'),_0xa2ad('0x36'),_0xa2ad('0x37'),'smsqueue',_0xa2ad('0x38'),_0xa2ad('0x39'),_0xa2ad('0x3a'),'user'];if(_[_0xa2ad('0x3b')](_0xbdcd1a,function(_0x38e906){return!_[_0xa2ad('0x3c')](_0x3eb38d,_0x38e906[_0xa2ad('0x3d')][_0xa2ad('0x3e')]());})){throw new db[(_0xa2ad('0x2c'))]['ValidationError'](_0xa2ad('0x3f'));}}}var _0x1a7df2={};_0x1a7df2['senderName']=_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x29')](_0xa2ad('0x40'))?_0x4e1d6e['body'][_0xa2ad('0x40')]:_0x4e1d6e[_0xa2ad('0x41')][_0xa2ad('0x42')];_0x1a7df2['recipientsDescription']=_[_0xa2ad('0x43')](_0x4e1d6e['body'][_0xa2ad('0x44')])?null:_0x4e1d6e['body'][_0xa2ad('0x44')];_0x1a7df2[_0xa2ad('0x45')]=_0x4e1d6e[_0xa2ad('0x2b')][_0xa2ad('0x45')]||![];_0x1a7df2['SenderId']=_0x4e1d6e[_0xa2ad('0x41')]['id'];return getContent(_0x4e1d6e[_0xa2ad('0x2b')])[_0xa2ad('0x22')](function(_0x1263c6){_0x1a7df2[_0xa2ad('0x2b')]=_0x1263c6;return getRecipients(_0xbdcd1a);})[_0xa2ad('0x22')](function(_0x48feec){_0x1a7df2[_0xa2ad('0x46')]=_[_0xa2ad('0x47')](_0x48feec)['join'](',');return db[_0xa2ad('0x48')][_0xa2ad('0x49')](function(_0x2296d4){return db['UserNotification'][_0xa2ad('0x4a')](_0x1a7df2,{'raw':!![],'transaction':_0x2296d4})[_0xa2ad('0x22')](function(_0x5864d3){var _0x2944be={'sender':_0x1a7df2[_0xa2ad('0x40')],'description':_0x1a7df2[_0xa2ad('0x44')],'content':_0x1a7df2[_0xa2ad('0x2b')],'beep':_0x1a7df2[_0xa2ad('0x45')]};_0x48feec['forEach'](function(_0xfdf834){_0x2944be[_0xa2ad('0x4b')]=_0xfdf834;socket[_0xa2ad('0x4c')](_0xa2ad('0x4d'),_0x2944be);});return _0x5864d3;});});})['then'](respondWithResult(_0x153a4b,0xc9))[_0xa2ad('0x4e')](handleError(_0x153a4b,null));};function getContent(_0x5edcd0){return new BPromise(function(_0x452c33,_0x3726f2){if(_0x5edcd0[_0xa2ad('0x2a')]){_0x452c33(_0x5edcd0[_0xa2ad('0x2a')]);return;}return db[_0xa2ad('0x4f')][_0xa2ad('0x50')]({'attributes':[_0xa2ad('0x51')],'where':{'id':_0x5edcd0[_0xa2ad('0x2e')]},'raw':!![]})[_0xa2ad('0x22')](function(_0x31c5a7){if(!_0x31c5a7)throw new db[(_0xa2ad('0x2c'))][(_0xa2ad('0x31'))](_0xa2ad('0x52'));var _0x426ba9=Mustache['render'](_0x31c5a7[_0xa2ad('0x51')],_0x5edcd0[_0xa2ad('0x2f')]);_0x452c33(_0x426ba9);})[_0xa2ad('0x4e')](function(_0x447609){_0x3726f2(_0x447609);});});}function getRecipients(_0x369add){return new BPromise(function(_0x3e3977,_0x268ec5){var _0x4bdad2=[];var _0x4298b2=[];_0x369add['forEach'](function(_0x314ca3){var _0x1f1298=_[_0xa2ad('0x53')](_0x314ca3['model'][_0xa2ad('0x3e')]());if(_0x1f1298==='User'){_0x4bdad2=_['union'](_0x4bdad2,_0x314ca3[_0xa2ad('0x54')]);}else{if(_[_0xa2ad('0x3c')](_0x1f1298,_0xa2ad('0x55')))_0x1f1298=_0x1f1298['replace'](_0xa2ad('0x55'),_0xa2ad('0x56'));_0x314ca3[_0xa2ad('0x54')]['forEach'](function(_0x4be5fd){_0x4298b2[_0xa2ad('0x57')](getAgents(_0x1f1298,_0x4be5fd));});}});return BPromise[_0xa2ad('0x58')](_0x4298b2)[_0xa2ad('0x22')](function(_0x94b7a9){_0x4bdad2=_[_0xa2ad('0x59')](_0x4bdad2,_[_0xa2ad('0x5a')](_0x94b7a9));_0x3e3977(_0x4bdad2);})[_0xa2ad('0x4e')](function(_0x3dd645){_0x268ec5(_0x3dd645);});});}function getAgents(_0xfb1947,_0xaf2fe2){return new BPromise(function(_0x1d3b39,_0xab45ca){return db[_0xfb1947][_0xa2ad('0x50')]({'where':{'id':_0xaf2fe2}})[_0xa2ad('0x22')](function(_0x4fe609){return _0x4fe609['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x33d9d9){var _0x2efd97=_[_0xa2ad('0x5b')](_0x33d9d9,'id');_0x1d3b39(_0x2efd97);});})[_0xa2ad('0x4e')](function(_0x142394){_0xab45ca(_0x142394);});});} \ No newline at end of file +var _0x8189=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','join','transaction','create','forEach','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','toLowerCase','union','ids','queue','replace','Queue','push','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x570efe,_0x1a2780){var _0x58b26a=function(_0x3f26e0){while(--_0x3f26e0){_0x570efe['push'](_0x570efe['shift']());}};_0x58b26a(++_0x1a2780);}(_0x8189,0x168));var _0x9818=function(_0x417784,_0x49fe66){_0x417784=_0x417784-0x0;var _0x335bc9=_0x8189[_0x417784];return _0x335bc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9818('0x0'));var zipdir=require(_0x9818('0x1'));var jsonpatch=require(_0x9818('0x2'));var rp=require(_0x9818('0x3'));var moment=require(_0x9818('0x4'));var BPromise=require(_0x9818('0x5'));var Mustache=require(_0x9818('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9818('0x7'));var fs=require('fs');var fs_extra=require(_0x9818('0x8'));var _=require(_0x9818('0x9'));var squel=require(_0x9818('0xa'));var crypto=require('crypto');var jsforce=require(_0x9818('0xb'));var deskjs=require(_0x9818('0xc'));var toCsv=require(_0x9818('0xd'));var querystring=require(_0x9818('0xe'));var Papa=require(_0x9818('0xf'));var Redis=require('ioredis');var authService=require(_0x9818('0x10'));var qs=require(_0x9818('0x11'));var as=require(_0x9818('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9818('0x13'))(_0x9818('0x14'));var utils=require(_0x9818('0x15'));var config=require(_0x9818('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9818('0x17'))['db'];config[_0x9818('0x18')]=_[_0x9818('0x19')](config[_0x9818('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9818('0x1a'))(new Redis(config[_0x9818('0x18')]));require(_0x9818('0x1b'))[_0x9818('0x1c')](socket);function respondWithStatusCode(_0x286417,_0x4e62c0){_0x4e62c0=_0x4e62c0||0xcc;return function(_0x3268a0){if(_0x3268a0){return _0x286417[_0x9818('0x1d')](_0x4e62c0);}return _0x286417[_0x9818('0x1e')](_0x4e62c0)[_0x9818('0x1f')]();};}function respondWithResult(_0x28f592,_0x349f03){_0x349f03=_0x349f03||0xc8;return function(_0x13265a){if(_0x13265a){return _0x28f592[_0x9818('0x1e')](_0x349f03)[_0x9818('0x20')](_0x13265a);}};}function respondWithFilteredResult(_0x5da1b9,_0x80daf5){return function(_0x233df9){if(_0x233df9){var _0x163fce=typeof _0x80daf5['offset']===_0x9818('0x21')&&typeof _0x80daf5['limit']===_0x9818('0x21');var _0x122131=_0x233df9[_0x9818('0x22')];var _0x40092f=_0x163fce?0x0:_0x80daf5['offset'];var _0x59d6d3=_0x163fce?_0x233df9[_0x9818('0x22')]:_0x80daf5[_0x9818('0x23')]+_0x80daf5['limit'];var _0x549d86;if(_0x59d6d3>=_0x122131){_0x59d6d3=_0x122131;_0x549d86=0xc8;}else{_0x549d86=0xce;}_0x5da1b9[_0x9818('0x1e')](_0x549d86);return _0x5da1b9[_0x9818('0x24')]('Content-Range',_0x40092f+'-'+_0x59d6d3+'/'+_0x122131)[_0x9818('0x20')](_0x233df9);}return null;};}function patchUpdates(_0x65fa9d){return function(_0x3cc625){try{jsonpatch[_0x9818('0x25')](_0x3cc625,_0x65fa9d,!![]);}catch(_0x17699c){return BPromise[_0x9818('0x26')](_0x17699c);}return _0x3cc625[_0x9818('0x27')]();};}function saveUpdates(_0x21180d,_0x37fc29){return function(_0x4eb402){if(_0x4eb402){return _0x4eb402[_0x9818('0x28')](_0x21180d)[_0x9818('0x29')](function(_0x454e94){return _0x454e94;});}return null;};}function removeEntity(_0x1f280c,_0x4e2952){return function(_0x4fdc7e){if(_0x4fdc7e){return _0x4fdc7e[_0x9818('0x2a')]()[_0x9818('0x29')](function(){_0x1f280c['status'](0xcc)[_0x9818('0x1f')]();});}};}function handleEntityNotFound(_0x3dfad9,_0x5abdd1){return function(_0x4587b5){if(!_0x4587b5){_0x3dfad9[_0x9818('0x1d')](0x194);}return _0x4587b5;};}function handleError(_0x410218,_0x33e4bf){_0x33e4bf=_0x33e4bf||0x1f4;return function(_0x4b5f19){logger[_0x9818('0x2b')](_0x4b5f19[_0x9818('0x2c')]);if(_0x4b5f19['name']){delete _0x4b5f19[_0x9818('0x2d')];}_0x410218[_0x9818('0x1e')](_0x33e4bf)['send'](_0x4b5f19);};}exports[_0x9818('0x2e')]=function(_0x53e9eb,_0x51c499,_0x39815c){if(!_0x53e9eb[_0x9818('0x2f')][_0x9818('0x30')](_0x9818('0x31'))&&!_0x53e9eb['body'][_0x9818('0x30')](_0x9818('0x32'))){throw new db[(_0x9818('0x33'))][(_0x9818('0x34'))](_0x9818('0x35'));}else{if(_0x53e9eb[_0x9818('0x2f')][_0x9818('0x30')](_0x9818('0x32'))&&!_0x53e9eb[_0x9818('0x2f')]['hasOwnProperty']('view')){throw new db['Sequelize'][(_0x9818('0x34'))](_0x9818('0x36'));}if(!_0x53e9eb[_0x9818('0x2f')][_0x9818('0x30')](_0x9818('0x37'))){throw new db[(_0x9818('0x33'))]['ValidationError'](_0x9818('0x38'));}else{try{var _0x55afbb=JSON[_0x9818('0x39')](_0x53e9eb[_0x9818('0x2f')]['recipients']);}catch(_0x1839f9){logger[_0x9818('0x2b')](_0x1839f9);throw new db[(_0x9818('0x33'))][(_0x9818('0x34'))](_0x9818('0x3a'));}var _0x1e0a5a=[_0x9818('0x3b'),'faxqueue',_0x9818('0x3c'),_0x9818('0x3d'),_0x9818('0x3e'),_0x9818('0x3f'),'whatsappqueue',_0x9818('0x40'),_0x9818('0x41')];if(_[_0x9818('0x42')](_0x55afbb,function(_0x2bbd24){return!_[_0x9818('0x43')](_0x1e0a5a,_0x2bbd24['model']['toLowerCase']());})){throw new db[(_0x9818('0x33'))][(_0x9818('0x34'))](_0x9818('0x44'));}}}var _0x2f7fd0={};_0x2f7fd0[_0x9818('0x45')]=_0x53e9eb['body'][_0x9818('0x30')]('senderName')?_0x53e9eb['body'][_0x9818('0x45')]:_0x53e9eb[_0x9818('0x41')]['fullname'];_0x2f7fd0['recipientsDescription']=_[_0x9818('0x46')](_0x53e9eb['body'][_0x9818('0x47')])?null:_0x53e9eb[_0x9818('0x2f')][_0x9818('0x47')];_0x2f7fd0[_0x9818('0x48')]=_0x53e9eb['body'][_0x9818('0x48')]||![];_0x2f7fd0[_0x9818('0x49')]=_0x53e9eb[_0x9818('0x41')]['id'];return getContent(_0x53e9eb[_0x9818('0x2f')])[_0x9818('0x29')](function(_0x172600){_0x2f7fd0[_0x9818('0x2f')]=_0x172600;return getRecipients(_0x55afbb);})[_0x9818('0x29')](function(_0x2b3c87){_0x2f7fd0['recipientsId']=_['sortBy'](_0x2b3c87)[_0x9818('0x4a')](',');return db['sequelize'][_0x9818('0x4b')](function(_0x335e22){return db['UserNotification'][_0x9818('0x4c')](_0x2f7fd0,{'raw':!![],'transaction':_0x335e22})['then'](function(_0x1c5bd9){var _0x3614ea={'sender':_0x2f7fd0[_0x9818('0x45')],'description':_0x2f7fd0[_0x9818('0x47')],'content':_0x2f7fd0[_0x9818('0x2f')],'beep':_0x2f7fd0[_0x9818('0x48')]};_0x2b3c87[_0x9818('0x4d')](function(_0x484928){_0x3614ea['recipient']=_0x484928;socket[_0x9818('0x4e')](_0x9818('0x4f'),_0x3614ea);});return _0x1c5bd9;});});})[_0x9818('0x29')](respondWithResult(_0x51c499,0xc9))[_0x9818('0x50')](handleError(_0x51c499,null));};function getContent(_0x1a11c2){return new BPromise(function(_0x40a67f,_0x4c5033){if(_0x1a11c2[_0x9818('0x31')]){_0x40a67f(_0x1a11c2['text']);return;}return db[_0x9818('0x51')][_0x9818('0x52')]({'attributes':['html'],'where':{'id':_0x1a11c2[_0x9818('0x32')]},'raw':!![]})[_0x9818('0x29')](function(_0x5a24b9){if(!_0x5a24b9)throw new db['Sequelize'][(_0x9818('0x34'))](_0x9818('0x53'));var _0x89e1a=Mustache['render'](_0x5a24b9['html'],_0x1a11c2[_0x9818('0x54')]);_0x40a67f(_0x89e1a);})[_0x9818('0x50')](function(_0x3da384){_0x4c5033(_0x3da384);});});}function getRecipients(_0x21fe8c){return new BPromise(function(_0x459dad,_0x51b420){var _0x58b0e7=[];var _0x22c646=[];_0x21fe8c[_0x9818('0x4d')](function(_0x3e1fc7){var _0x24d73a=_[_0x9818('0x55')](_0x3e1fc7['model'][_0x9818('0x56')]());if(_0x24d73a==='User'){_0x58b0e7=_[_0x9818('0x57')](_0x58b0e7,_0x3e1fc7[_0x9818('0x58')]);}else{if(_[_0x9818('0x43')](_0x24d73a,_0x9818('0x59')))_0x24d73a=_0x24d73a[_0x9818('0x5a')](_0x9818('0x59'),_0x9818('0x5b'));_0x3e1fc7[_0x9818('0x58')][_0x9818('0x4d')](function(_0x50f4f8){_0x22c646[_0x9818('0x5c')](getAgents(_0x24d73a,_0x50f4f8));});}});return BPromise['all'](_0x22c646)[_0x9818('0x29')](function(_0x4134f3){_0x58b0e7=_[_0x9818('0x57')](_0x58b0e7,_['flatten'](_0x4134f3));_0x459dad(_0x58b0e7);})[_0x9818('0x50')](function(_0x128e00){_0x51b420(_0x128e00);});});}function getAgents(_0x31cf05,_0x439301){return new BPromise(function(_0x777062,_0x2c6ca4){return db[_0x31cf05][_0x9818('0x52')]({'where':{'id':_0x439301}})[_0x9818('0x29')](function(_0x4f49bc){return _0x4f49bc[_0x9818('0x5d')]({'attributes':['id'],'raw':!![]})[_0x9818('0x29')](function(_0x353ecd){var _0x485b2c=_[_0x9818('0x5e')](_0x353ecd,'id');_0x777062(_0x485b2c);});})[_0x9818('0x50')](function(_0x3e0cfc){_0x2c6ca4(_0x3e0cfc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8a328cd..e6b4adc 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 _0x7609=['exports','events','../../mysqldb','UserNotification','setMaxListeners','update','hasOwnProperty','hook'];(function(_0x2cb702,_0x4d0358){var _0x547a9e=function(_0x212d8a){while(--_0x212d8a){_0x2cb702['push'](_0x2cb702['shift']());}};_0x547a9e(++_0x4d0358);}(_0x7609,0x179));var _0x9760=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x7609[_0x264f48];return _0xb99167;};'use strict';var EventEmitter=require(_0x9760('0x0'));var UserNotification=require(_0x9760('0x1'))['db'][_0x9760('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9760('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9760('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1096aa){return function(_0x2d47c0,_0x5c80be,_0x35b530){UserNotificationEvents['emit'](_0x1096aa+':'+_0x2d47c0['id'],_0x2d47c0);UserNotificationEvents['emit'](_0x1096aa,_0x2d47c0);_0x35b530(null);};}for(var e in events){if(events[_0x9760('0x5')](e)){var event=events[e];UserNotification[_0x9760('0x6')](e,emitEvent(event));}}module[_0x9760('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xaefa=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb826c8,_0x1d506e){var _0x109289=function(_0x377d84){while(--_0x377d84){_0xb826c8['push'](_0xb826c8['shift']());}};_0x109289(++_0x1d506e);}(_0xaefa,0xff));var _0xaaef=function(_0x3b11cc,_0x59c6b5){_0x3b11cc=_0x3b11cc-0x0;var _0x46120d=_0xaefa[_0x3b11cc];return _0x46120d;};'use strict';var EventEmitter=require(_0xaaef('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaaef('0x1')](0x0);var events={'afterCreate':_0xaaef('0x2'),'afterUpdate':'update','afterDestroy':_0xaaef('0x3')};function emitEvent(_0x501e98){return function(_0x189d0a,_0x5a7da3,_0xcfc810){UserNotificationEvents[_0xaaef('0x4')](_0x501e98+':'+_0x189d0a['id'],_0x189d0a);UserNotificationEvents['emit'](_0x501e98,_0x189d0a);_0xcfc810(null);};}for(var e in events){if(events[_0xaaef('0x5')](e)){var event=events[e];UserNotification[_0xaaef('0x6')](e,emitEvent(event));}}module[_0xaaef('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 742f942..cdd978d 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 _0xbc6e=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xbc6e,0x1ad));var _0xebc6=function(_0x5f186e,_0x2c32ef){_0x5f186e=_0x5f186e-0x0;var _0x5afb65=_0xbc6e[_0x5f186e];return _0x5afb65;};'use strict';var _=require(_0xebc6('0x0'));var util=require(_0xebc6('0x1'));var logger=require('../../config/logger')(_0xebc6('0x2'));var moment=require('moment');var BPromise=require(_0xebc6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebc6('0x4'));var rimraf=require(_0xebc6('0x5'));var config=require(_0xebc6('0x6'));var attributes=require(_0xebc6('0x7'));module[_0xebc6('0x8')]=function(_0x40525e,_0x5d46a8){return _0x40525e[_0xebc6('0x9')](_0xebc6('0xa'),attributes,{'tableName':_0xebc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xebc6('0xc'),'collate':_0xebc6('0xd')});}; \ No newline at end of file +var _0xd9dc=['moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x204043,_0x25d300){var _0x3a0c35=function(_0x2f5345){while(--_0x2f5345){_0x204043['push'](_0x204043['shift']());}};_0x3a0c35(++_0x25d300);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x26bfc0,_0x34a9a4){_0x26bfc0=_0x26bfc0-0x0;var _0x1d908f=_0xd9dc[_0x26bfc0];return _0x1d908f;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var logger=require(_0xcd9d('0x1'))('api');var moment=require(_0xcd9d('0x2'));var BPromise=require(_0xcd9d('0x3'));var rp=require(_0xcd9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var attributes=require(_0xcd9d('0x7'));module[_0xcd9d('0x8')]=function(_0x8cc2e4,_0x50f1e2){return _0x8cc2e4[_0xcd9d('0x9')](_0xcd9d('0xa'),attributes,{'tableName':_0xcd9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcd9d('0xc'),'collate':_0xcd9d('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 951a318..f359b2f 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 _0xdbf0=['error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c24b8,_0x168e0b){var _0x563ed6=function(_0x7c1aa9){while(--_0x7c1aa9){_0x2c24b8['push'](_0x2c24b8['shift']());}};_0x563ed6(++_0x168e0b);}(_0xdbf0,0x127));var _0x0dbf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdbf0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x0dbf('0x0'));var util=require(_0x0dbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0dbf('0x2'));var fs=require('fs');var Redis=require(_0x0dbf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0dbf('0x4'))(_0x0dbf('0x5'));var config=require(_0x0dbf('0x6'));var jayson=require(_0x0dbf('0x7'));var client=jayson[_0x0dbf('0x8')][_0x0dbf('0x9')]({'port':0x232a});config[_0x0dbf('0xa')]=_[_0x0dbf('0xb')](config['redis'],{'host':_0x0dbf('0xc'),'port':0x18eb});var socket=require(_0x0dbf('0xd'))(new Redis(config['redis']));require(_0x0dbf('0xe'))[_0x0dbf('0xf')](socket);function respondWithRpcPromise(_0x46f432,_0x24fdd3,_0x4c5147){return new BPromise(function(_0x1b3a9c,_0x51ffb9){return client[_0x0dbf('0x10')](_0x46f432,_0x4c5147)[_0x0dbf('0x11')](function(_0x3b2179){logger[_0x0dbf('0x12')](_0x0dbf('0x13'),_0x24fdd3,'request\x20sent');logger[_0x0dbf('0x14')](_0x0dbf('0x15'),_0x24fdd3,_0x0dbf('0x16'),JSON[_0x0dbf('0x17')](_0x3b2179));if(_0x3b2179[_0x0dbf('0x18')]){if(_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x19')]===0x1f4){logger[_0x0dbf('0x18')]('UserNotification,\x20%s,\x20%s',_0x24fdd3,_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x1a')]);return _0x51ffb9(_0x3b2179['error'][_0x0dbf('0x1a')]);}logger['error'](_0x0dbf('0x13'),_0x24fdd3,_0x3b2179['error'][_0x0dbf('0x1a')]);return _0x1b3a9c(_0x3b2179[_0x0dbf('0x18')][_0x0dbf('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x24fdd3,_0x0dbf('0x16'));_0x1b3a9c(_0x3b2179[_0x0dbf('0x1b')][_0x0dbf('0x1a')]);}})[_0x0dbf('0x1c')](function(_0x3d84bb){logger[_0x0dbf('0x18')](_0x0dbf('0x13'),_0x24fdd3,_0x3d84bb);_0x51ffb9(_0x3d84bb);});});} \ No newline at end of file +var _0x37c3=['request\x20sent','debug','stringify','error','message','info','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x37c3,0x174));var _0x337c=function(_0x34c43b,_0x507409){_0x34c43b=_0x34c43b-0x0;var _0x15fe1c=_0x37c3[_0x34c43b];return _0x15fe1c;};'use strict';var _=require('lodash');var util=require(_0x337c('0x0'));var moment=require('moment');var BPromise=require(_0x337c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x337c('0x2'))['db'];var utils=require(_0x337c('0x3'));var logger=require(_0x337c('0x4'))('rpc');var config=require(_0x337c('0x5'));var jayson=require(_0x337c('0x6'));var client=jayson[_0x337c('0x7')][_0x337c('0x8')]({'port':0x232a});config[_0x337c('0x9')]=_[_0x337c('0xa')](config[_0x337c('0x9')],{'host':_0x337c('0xb'),'port':0x18eb});var socket=require(_0x337c('0xc'))(new Redis(config[_0x337c('0x9')]));require(_0x337c('0xd'))[_0x337c('0xe')](socket);function respondWithRpcPromise(_0x50f34b,_0x13fdbd,_0xf9d163){return new BPromise(function(_0x43255f,_0x3dab1f){return client[_0x337c('0xf')](_0x50f34b,_0xf9d163)[_0x337c('0x10')](function(_0x163abb){logger['info'](_0x337c('0x11'),_0x13fdbd,_0x337c('0x12'));logger[_0x337c('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x13fdbd,_0x337c('0x12'),JSON[_0x337c('0x14')](_0x163abb));if(_0x163abb[_0x337c('0x15')]){if(_0x163abb['error']['code']===0x1f4){logger[_0x337c('0x15')]('UserNotification,\x20%s,\x20%s',_0x13fdbd,_0x163abb[_0x337c('0x15')][_0x337c('0x16')]);return _0x3dab1f(_0x163abb[_0x337c('0x15')]['message']);}logger[_0x337c('0x15')](_0x337c('0x11'),_0x13fdbd,_0x163abb[_0x337c('0x15')]['message']);return _0x43255f(_0x163abb[_0x337c('0x15')][_0x337c('0x16')]);}else{logger[_0x337c('0x17')](_0x337c('0x11'),_0x13fdbd,_0x337c('0x12'));_0x43255f(_0x163abb[_0x337c('0x18')][_0x337c('0x16')]);}})[_0x337c('0x19')](function(_0x132139){logger['error'](_0x337c('0x11'),_0x13fdbd,_0x132139);_0x3dab1f(_0x132139);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7993e71..62385f0 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 _0xa74a=['save','remove','emit','register','length','userNotification:'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xa74a,0x138));var _0xaa74=function(_0x57170c,_0x11ff52){_0x57170c=_0x57170c-0x0;var _0x1c4470=_0xa74a[_0x57170c];return _0x1c4470;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xaa74('0x0'),_0xaa74('0x1'),'update'];function createListener(_0x5953e2,_0x218a28){return function(_0x1c568d){_0x218a28[_0xaa74('0x2')](_0x5953e2,_0x1c568d);};}function removeListener(_0x20a0f3,_0x4a2595){return function(){UserNotificationEvents['removeListener'](_0x20a0f3,_0x4a2595);};}exports[_0xaa74('0x3')]=function(_0x511f78){for(var _0x50af62=0x0,_0x323827=events[_0xaa74('0x4')];_0x50af62<_0x323827;_0x50af62++){var _0x51e5b4=events[_0x50af62];var _0x39d168=createListener(_0xaa74('0x5')+_0x51e5b4,_0x511f78);UserNotificationEvents['on'](_0x51e5b4,_0x39d168);}}; \ No newline at end of file +var _0x0c6d=['emit','removeListener','register','userNotification:','remove'];(function(_0x3d57ed,_0x45a7d4){var _0x29554d=function(_0x521ad3){while(--_0x521ad3){_0x3d57ed['push'](_0x3d57ed['shift']());}};_0x29554d(++_0x45a7d4);}(_0x0c6d,0x16c));var _0xd0c6=function(_0x3a09bf,_0x1eddf3){_0x3a09bf=_0x3a09bf-0x0;var _0x374544=_0x0c6d[_0x3a09bf];return _0x374544;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0xd0c6('0x0'),'update'];function createListener(_0xd85140,_0x286a46){return function(_0x4c89f5){_0x286a46[_0xd0c6('0x1')](_0xd85140,_0x4c89f5);};}function removeListener(_0x1fee2d,_0x1647a1){return function(){UserNotificationEvents[_0xd0c6('0x2')](_0x1fee2d,_0x1647a1);};}exports[_0xd0c6('0x3')]=function(_0x5b0a91){for(var _0x57847f=0x0,_0x336b20=events['length'];_0x57847f<_0x336b20;_0x57847f++){var _0x241107=events[_0x57847f];var _0x3ce8c7=createListener(_0xd0c6('0x4')+_0x241107,_0x5b0a91);UserNotificationEvents['on'](_0x241107,_0x3ce8c7);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 60705f5..7973ba3 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(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x7e366d,_0x3e57a7){var _0x19a9e0=function(_0xfbd19f){while(--_0xfbd19f){_0x7e366d['push'](_0x7e366d['shift']());}};_0x19a9e0(++_0x3e57a7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 95bc2c7..777c674 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 _0x6fd5=['sequelize','INTEGER'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x6fd5,0xf0));var _0x56fd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6fd5[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x56fd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x56fd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x12ef=['sequelize','exports','INTEGER'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x12ef,0x1a7));var _0xf12e=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0x12ef[_0x10a212];return _0x23c82b;};'use strict';var Sequelize=require(_0xf12e('0x0'));module[_0xf12e('0x1')]={'penalty':{'type':Sequelize[_0xf12e('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 ca7856f..c881538 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 _0xdf23=['util','../../config/logger','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','lodash'];(function(_0x2f6d38,_0xb5ec7a){var _0xb4ceb1=function(_0x49b37c){while(--_0x49b37c){_0x2f6d38['push'](_0x2f6d38['shift']());}};_0xb4ceb1(++_0xb5ec7a);}(_0xdf23,0xef));var _0x3df2=function(_0x8aefe0,_0x2fe240){_0x8aefe0=_0x8aefe0-0x0;var _0x23c98d=_0xdf23[_0x8aefe0];return _0x23c98d;};'use strict';var _=require(_0x3df2('0x0'));var util=require(_0x3df2('0x1'));var logger=require(_0x3df2('0x2'))(_0x3df2('0x3'));var moment=require(_0x3df2('0x4'));var BPromise=require(_0x3df2('0x5'));var rp=require(_0x3df2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3df2('0x7'));module[_0x3df2('0x8')]=function(_0x365154,_0x5c1b0d){return _0x365154['define'](_0x3df2('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96ab=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash'];(function(_0x7ad478,_0x2e89ef){var _0x1c660c=function(_0x1191c2){while(--_0x1191c2){_0x7ad478['push'](_0x7ad478['shift']());}};_0x1c660c(++_0x2e89ef);}(_0x96ab,0x13e));var _0xb96a=function(_0x32064c,_0x59b5e9){_0x32064c=_0x32064c-0x0;var _0x5064b4=_0x96ab[_0x32064c];return _0x5064b4;};'use strict';var _=require(_0xb96a('0x0'));var util=require(_0xb96a('0x1'));var logger=require('../../config/logger')(_0xb96a('0x2'));var moment=require('moment');var BPromise=require(_0xb96a('0x3'));var rp=require(_0xb96a('0x4'));var fs=require('fs');var path=require(_0xb96a('0x5'));var rimraf=require(_0xb96a('0x6'));var config=require(_0xb96a('0x7'));var attributes=require(_0xb96a('0x8'));module[_0xb96a('0x9')]=function(_0x5ca720,_0x465ad1){return _0x5ca720[_0xb96a('0xa')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 0b006b8..18223ef 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 _0x1619=['rpc','../../config/environment','jayson/promise','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x13fc18,_0x19f182){var _0x20a135=function(_0x593524){while(--_0x593524){_0x13fc18['push'](_0x13fc18['shift']());}};_0x20a135(++_0x19f182);}(_0x1619,0x19e));var _0x9161=function(_0x56a387,_0x434fda){_0x56a387=_0x56a387-0x0;var _0x481a29=_0x1619[_0x56a387];return _0x481a29;};'use strict';var _=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var moment=require('moment');var BPromise=require(_0x9161('0x2'));var rs=require(_0x9161('0x3'));var fs=require('fs');var Redis=require(_0x9161('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9161('0x5'));var logger=require('../../config/logger')(_0x9161('0x6'));var config=require(_0x9161('0x7'));var jayson=require(_0x9161('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d85d2,_0x466879,_0x3a3621){return new BPromise(function(_0x1c0285,_0x4800ae){return client['request'](_0x1d85d2,_0x3a3621)[_0x9161('0x9')](function(_0x4c9b85){logger[_0x9161('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x466879,'request\x20sent');logger[_0x9161('0xb')](_0x9161('0xc'),_0x466879,_0x9161('0xd'),JSON[_0x9161('0xe')](_0x4c9b85));if(_0x4c9b85['error']){if(_0x4c9b85[_0x9161('0xf')][_0x9161('0x10')]===0x1f4){logger[_0x9161('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x466879,_0x4c9b85['error'][_0x9161('0x11')]);return _0x4800ae(_0x4c9b85[_0x9161('0xf')][_0x9161('0x11')]);}logger['error'](_0x9161('0x12'),_0x466879,_0x4c9b85[_0x9161('0xf')]['message']);return _0x1c0285(_0x4c9b85[_0x9161('0xf')]['message']);}else{logger[_0x9161('0xa')](_0x9161('0x12'),_0x466879,_0x9161('0xd'));_0x1c0285(_0x4c9b85[_0x9161('0x13')]['message']);}})['catch'](function(_0x31eea7){logger[_0x9161('0xf')](_0x9161('0x12'),_0x466879,_0x31eea7);_0x4800ae(_0x31eea7);});});} \ No newline at end of file +var _0x0fa6=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x30e4c7,_0xe4eca3){var _0x2f7f5b=function(_0x437974){while(--_0x437974){_0x30e4c7['push'](_0x30e4c7['shift']());}};_0x2f7f5b(++_0xe4eca3);}(_0x0fa6,0x1bf));var _0x60fa=function(_0x30f80e,_0x1c0998){_0x30f80e=_0x30f80e-0x0;var _0x4c9c62=_0x0fa6[_0x30f80e];return _0x4c9c62;};'use strict';var _=require(_0x60fa('0x0'));var util=require(_0x60fa('0x1'));var moment=require(_0x60fa('0x2'));var BPromise=require(_0x60fa('0x3'));var rs=require(_0x60fa('0x4'));var fs=require('fs');var Redis=require(_0x60fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x60fa('0x6'));var logger=require('../../config/logger')(_0x60fa('0x7'));var config=require(_0x60fa('0x8'));var jayson=require(_0x60fa('0x9'));var client=jayson[_0x60fa('0xa')][_0x60fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b0e07,_0x1b57ff,_0x5d499e){return new BPromise(function(_0x34104c,_0x2246d3){return client[_0x60fa('0xc')](_0x5b0e07,_0x5d499e)[_0x60fa('0xd')](function(_0x14d448){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b57ff,_0x60fa('0xe'));logger['debug'](_0x60fa('0xf'),_0x1b57ff,'request\x20sent',JSON['stringify'](_0x14d448));if(_0x14d448[_0x60fa('0x10')]){if(_0x14d448[_0x60fa('0x10')]['code']===0x1f4){logger[_0x60fa('0x10')](_0x60fa('0x11'),_0x1b57ff,_0x14d448[_0x60fa('0x10')]['message']);return _0x2246d3(_0x14d448[_0x60fa('0x10')][_0x60fa('0x12')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b57ff,_0x14d448[_0x60fa('0x10')][_0x60fa('0x12')]);return _0x34104c(_0x14d448[_0x60fa('0x10')][_0x60fa('0x12')]);}else{logger[_0x60fa('0x13')](_0x60fa('0x11'),_0x1b57ff,_0x60fa('0xe'));_0x34104c(_0x14d448['result'][_0x60fa('0x12')]);}})[_0x60fa('0x14')](function(_0xbf47d4){logger[_0x60fa('0x10')](_0x60fa('0x11'),_0x1b57ff,_0xbf47d4);_0x2246d3(_0xbf47d4);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1572bce..80ad410 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 _0xabba=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','clone','post','addSections','addResources','update','delete','destroy','removeSections','removeResources','util'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xabba,0x195));var _0xaabb=function(_0x2d009a,_0x243d06){_0x2d009a=_0x2d009a-0x0;var _0x4d8dec=_0xabba[_0x2d009a];return _0x4d8dec;};'use strict';var multer=require('multer');var util=require(_0xaabb('0x0'));var path=require(_0xaabb('0x1'));var timeout=require(_0xaabb('0x2'));var express=require(_0xaabb('0x3'));var router=express[_0xaabb('0x4')]();var fs_extra=require(_0xaabb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaabb('0x6'));var config=require(_0xaabb('0x7'));var controller=require('./userProfile.controller');router[_0xaabb('0x8')]('/',auth[_0xaabb('0x9')](),controller[_0xaabb('0xa')]);router[_0xaabb('0x8')](_0xaabb('0xb'),auth[_0xaabb('0x9')](),controller[_0xaabb('0xc')]);router[_0xaabb('0x8')](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller['show']);router[_0xaabb('0x8')](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0xf')]);router[_0xaabb('0x8')](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x11')]);router['post']('/',auth[_0xaabb('0x9')](),controller[_0xaabb('0x12')]);router['post'](_0xaabb('0x13'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x14')]);router[_0xaabb('0x15')](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x16')]);router[_0xaabb('0x15')](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x17')]);router['put'](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x18')]);router[_0xaabb('0x19')](_0xaabb('0xd'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x1a')]);router['delete'](_0xaabb('0xe'),auth[_0xaabb('0x9')](),controller[_0xaabb('0x1b')]);router['delete'](_0xaabb('0x10'),auth['isAuthenticated'](),controller[_0xaabb('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x382c=['clone','/:id/resources','put','update','destroy','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getResources','post','create','/:id/clone'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x382c,0xcd));var _0xc382=function(_0x419780,_0x4eb356){_0x419780=_0x419780-0x0;var _0x16458e=_0x382c[_0x419780];return _0x16458e;};'use strict';var multer=require(_0xc382('0x0'));var util=require(_0xc382('0x1'));var path=require(_0xc382('0x2'));var timeout=require(_0xc382('0x3'));var express=require(_0xc382('0x4'));var router=express[_0xc382('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc382('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xc382('0x7')]('/',auth[_0xc382('0x8')](),controller[_0xc382('0x9')]);router[_0xc382('0x7')](_0xc382('0xa'),auth['isAuthenticated'](),controller[_0xc382('0xb')]);router[_0xc382('0x7')](_0xc382('0xc'),auth[_0xc382('0x8')](),controller[_0xc382('0xd')]);router[_0xc382('0x7')](_0xc382('0xe'),auth[_0xc382('0x8')](),controller['getSections']);router[_0xc382('0x7')]('/:id/resources',auth[_0xc382('0x8')](),controller[_0xc382('0xf')]);router[_0xc382('0x10')]('/',auth[_0xc382('0x8')](),controller[_0xc382('0x11')]);router[_0xc382('0x10')](_0xc382('0x12'),auth['isAuthenticated'](),controller[_0xc382('0x13')]);router[_0xc382('0x10')](_0xc382('0xe'),auth[_0xc382('0x8')](),controller['addSections']);router['post'](_0xc382('0x14'),auth[_0xc382('0x8')](),controller['addResources']);router[_0xc382('0x15')](_0xc382('0xc'),auth[_0xc382('0x8')](),controller[_0xc382('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc382('0x17')]);router['delete'](_0xc382('0xe'),auth['isAuthenticated'](),controller[_0xc382('0x18')]);router[_0xc382('0x19')](_0xc382('0x14'),auth['isAuthenticated'](),controller[_0xc382('0x1a')]);module[_0xc382('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9dba77e..f75abbf 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 _0x0675=['crudPermissions','getDataValue','split','BOOLEAN','exports','STRING','setDataValue'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x0675,0x185));var _0x5067=function(_0x16e62a,_0x31395a){_0x16e62a=_0x16e62a-0x0;var _0x4ba2a8=_0x0675[_0x16e62a];return _0x4ba2a8;};'use strict';var Sequelize=require('sequelize');module[_0x5067('0x0')]={'name':{'type':Sequelize[_0x5067('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x5067('0x1')],'set':function(_0x1da284){this[_0x5067('0x2')](_0x5067('0x3'),_0x1da284?_0x1da284['join'](''):[]);},'get':function(){return this[_0x5067('0x4')](_0x5067('0x3'))?this[_0x5067('0x4')](_0x5067('0x3'))[_0x5067('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5067('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x5067('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5067('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8699=['STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','name'];(function(_0x170ac4,_0x2dfb52){var _0x11955f=function(_0x3b82f7){while(--_0x3b82f7){_0x170ac4['push'](_0x170ac4['shift']());}};_0x11955f(++_0x2dfb52);}(_0x8699,0xcf));var _0x9869=function(_0x1e3e59,_0x596d22){_0x1e3e59=_0x1e3e59-0x0;var _0x4cdd16=_0x8699[_0x1e3e59];return _0x4cdd16;};'use strict';var Sequelize=require(_0x9869('0x0'));module[_0x9869('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9869('0x2')},'crudPermissions':{'type':Sequelize[_0x9869('0x3')],'set':function(_0x170a9a){this[_0x9869('0x4')](_0x9869('0x5'),_0x170a9a?_0x170a9a[_0x9869('0x6')](''):[]);},'get':function(){return this[_0x9869('0x7')]('crudPermissions')?this['getDataValue'](_0x9869('0x5'))[_0x9869('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9869('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9869('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9869('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9869('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9869('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9869('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ca4824e..7667898 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 _0xf66f=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','UserProfile','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','options','create','body','catch','clone','find','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','describe','addSections','sectionId','userProfileId','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','ids','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf66f,0x13c));var _0xff66=function(_0x1af71a,_0x1d18ee){_0x1af71a=_0x1af71a-0x0;var _0x3acd6a=_0xf66f[_0x1af71a];return _0x3acd6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff66('0x0'));var zipdir=require(_0xff66('0x1'));var jsonpatch=require(_0xff66('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff66('0x3'));var Mustache=require(_0xff66('0x4'));var util=require(_0xff66('0x5'));var path=require(_0xff66('0x6'));var sox=require(_0xff66('0x7'));var csv=require('to-csv');var ejs=require(_0xff66('0x8'));var fs=require('fs');var fs_extra=require(_0xff66('0x9'));var _=require(_0xff66('0xa'));var squel=require(_0xff66('0xb'));var crypto=require(_0xff66('0xc'));var jsforce=require(_0xff66('0xd'));var deskjs=require(_0xff66('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff66('0xf'));var Papa=require('papaparse');var Redis=require(_0xff66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff66('0x11'));var hardwareService=require(_0xff66('0x12'));var logger=require(_0xff66('0x13'))(_0xff66('0x14'));var utils=require('../../config/utils');var config=require(_0xff66('0x15'));var licenseUtil=require(_0xff66('0x16'));var db=require(_0xff66('0x17'))['db'];config[_0xff66('0x18')]=_[_0xff66('0x19')](config['redis'],{'host':_0xff66('0x1a'),'port':0x18eb});var socket=require(_0xff66('0x1b'))(new Redis(config[_0xff66('0x18')]));require('./userProfile.socket')[_0xff66('0x1c')](socket);function respondWithStatusCode(_0xbe3e77,_0x595271){_0x595271=_0x595271||0xcc;return function(_0x4aa1d7){if(_0x4aa1d7){return _0xbe3e77[_0xff66('0x1d')](_0x595271);}return _0xbe3e77[_0xff66('0x1e')](_0x595271)[_0xff66('0x1f')]();};}function respondWithResult(_0x2bf650,_0x21d148){_0x21d148=_0x21d148||0xc8;return function(_0x895b6b){if(_0x895b6b){return _0x2bf650[_0xff66('0x1e')](_0x21d148)[_0xff66('0x20')](_0x895b6b);}};}function respondWithFilteredResult(_0x1e469e,_0x522979){return function(_0x49db99){if(_0x49db99){var _0x345732=typeof _0x522979[_0xff66('0x21')]===_0xff66('0x22')&&typeof _0x522979[_0xff66('0x23')]===_0xff66('0x22');var _0x21b278=_0x49db99[_0xff66('0x24')];var _0x5d86d8=_0x345732?0x0:_0x522979[_0xff66('0x21')];var _0xd78da7=_0x345732?_0x49db99[_0xff66('0x24')]:_0x522979['offset']+_0x522979['limit'];var _0xd4003d;if(_0xd78da7>=_0x21b278){_0xd78da7=_0x21b278;_0xd4003d=0xc8;}else{_0xd4003d=0xce;}_0x1e469e[_0xff66('0x1e')](_0xd4003d);return _0x1e469e[_0xff66('0x25')]('Content-Range',_0x5d86d8+'-'+_0xd78da7+'/'+_0x21b278)[_0xff66('0x20')](_0x49db99);}return null;};}function patchUpdates(_0x5e6e6d){return function(_0x5acbe3){try{jsonpatch[_0xff66('0x26')](_0x5acbe3,_0x5e6e6d,!![]);}catch(_0x15d11d){return BPromise[_0xff66('0x27')](_0x15d11d);}return _0x5acbe3[_0xff66('0x28')]();};}function saveUpdates(_0x4e50d5,_0x25978a){return function(_0x1dba59){if(_0x1dba59){return _0x1dba59[_0xff66('0x29')](_0x4e50d5)[_0xff66('0x2a')](function(_0x37b16a){return _0x37b16a;});}return null;};}function removeEntity(_0x423b24,_0x25d265){return function(_0x54261f){if(_0x54261f){return _0x54261f[_0xff66('0x2b')]()['then'](function(){_0x423b24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x235a87,_0x25990b){return function(_0x4cafbd){if(!_0x4cafbd){_0x235a87[_0xff66('0x1d')](0x194);}return _0x4cafbd;};}function handleError(_0x45e3e3,_0x318862){_0x318862=_0x318862||0x1f4;return function(_0x18e8ec){logger[_0xff66('0x2c')](_0x18e8ec[_0xff66('0x2d')]);if(_0x18e8ec[_0xff66('0x2e')]){delete _0x18e8ec[_0xff66('0x2e')];}_0x45e3e3[_0xff66('0x1e')](_0x318862)['send'](_0x18e8ec);};}exports['index']=function(_0x1279f4,_0x5af85e){var _0x48ddb8={},_0x1e1667={},_0x3c3607={'count':0x0,'rows':[]};var _0x5b4940=_['map'](db[_0xff66('0x2f')][_0xff66('0x30')],function(_0x101cf2){return{'name':_0x101cf2[_0xff66('0x31')],'type':_0x101cf2[_0xff66('0x32')][_0xff66('0x33')]};});_0x1e1667[_0xff66('0x34')]=_[_0xff66('0x35')](_0x5b4940,_0xff66('0x2e'));_0x1e1667[_0xff66('0x36')]=_[_0xff66('0x37')](_0x1279f4['query']);_0x1e1667[_0xff66('0x38')]=_['intersection'](_0x1e1667[_0xff66('0x34')],_0x1e1667[_0xff66('0x36')]);_0x48ddb8[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x1e1667[_0xff66('0x34')],qs['fields'](_0x1279f4[_0xff66('0x36')][_0xff66('0x3b')]));_0x48ddb8['attributes']=_0x48ddb8[_0xff66('0x39')][_0xff66('0x3c')]?_0x48ddb8[_0xff66('0x39')]:_0x1e1667[_0xff66('0x34')];if(!_0x1279f4['query'][_0xff66('0x3d')]('nolimit')){_0x48ddb8[_0xff66('0x23')]=qs[_0xff66('0x23')](_0x1279f4[_0xff66('0x36')]['limit']);_0x48ddb8[_0xff66('0x21')]=qs[_0xff66('0x21')](_0x1279f4['query']['offset']);}_0x48ddb8[_0xff66('0x3e')]=qs['sort'](_0x1279f4[_0xff66('0x36')][_0xff66('0x3f')]);_0x48ddb8[_0xff66('0x40')]=qs[_0xff66('0x38')](_[_0xff66('0x41')](_0x1279f4[_0xff66('0x36')],_0x1e1667[_0xff66('0x38')]),_0x5b4940);if(_0x1279f4[_0xff66('0x36')]['filter']){_0x48ddb8[_0xff66('0x40')]=_[_0xff66('0x42')](_0x48ddb8['where'],{'$or':_[_0xff66('0x35')](_0x5b4940,function(_0x40cfd0){if(_0x40cfd0[_0xff66('0x32')]!=='VIRTUAL'){var _0x4e697b={};_0x4e697b[_0x40cfd0[_0xff66('0x2e')]]={'$like':'%'+_0x1279f4[_0xff66('0x36')][_0xff66('0x43')]+'%'};return _0x4e697b;}})});}_0x48ddb8=_[_0xff66('0x42')]({},_0x48ddb8,_0x1279f4['options']);var _0x48bb84={'where':_0x48ddb8[_0xff66('0x40')]};return db['UserProfile']['count'](_0x48bb84)['then'](function(_0xeb6483){_0x3c3607[_0xff66('0x24')]=_0xeb6483;if(_0x1279f4[_0xff66('0x36')][_0xff66('0x44')]){_0x48ddb8[_0xff66('0x45')]=[{'all':!![]}];}return db[_0xff66('0x2f')][_0xff66('0x46')](_0x48ddb8);})['then'](function(_0x473129){_0x3c3607[_0xff66('0x47')]=_0x473129;return _0x3c3607;})['then'](respondWithFilteredResult(_0x5af85e,_0x48ddb8))['catch'](handleError(_0x5af85e,null));};exports[_0xff66('0x48')]=function(_0x14137c,_0x19438a){var _0x272ae1={'raw':![],'where':{'id':_0x14137c[_0xff66('0x49')]['id']}},_0x3d9b2e={};_0x3d9b2e['model']=_[_0xff66('0x37')](db['UserProfile'][_0xff66('0x30')]);_0x3d9b2e[_0xff66('0x36')]=_[_0xff66('0x37')](_0x14137c['query']);_0x3d9b2e[_0xff66('0x38')]=_['intersection'](_0x3d9b2e['model'],_0x3d9b2e['query']);_0x272ae1[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x3d9b2e[_0xff66('0x34')],qs['fields'](_0x14137c['query'][_0xff66('0x3b')]));_0x272ae1[_0xff66('0x39')]=_0x272ae1[_0xff66('0x39')][_0xff66('0x3c')]?_0x272ae1[_0xff66('0x39')]:_0x3d9b2e['model'];if(_0x14137c[_0xff66('0x36')]['includeAll']){_0x272ae1[_0xff66('0x45')]=[{'all':!![]}];}_0x272ae1=_[_0xff66('0x42')]({},_0x272ae1,_0x14137c[_0xff66('0x4a')]);return db['UserProfile']['find'](_0x272ae1)[_0xff66('0x2a')](handleEntityNotFound(_0x19438a,null))['then'](respondWithResult(_0x19438a,null))['catch'](handleError(_0x19438a,null));};exports[_0xff66('0x4b')]=function(_0x1f5779,_0x995faf){return db['UserProfile']['create'](_0x1f5779[_0xff66('0x4c')],{})[_0xff66('0x2a')](respondWithResult(_0x995faf,0xc9))[_0xff66('0x4d')](handleError(_0x995faf,null));};exports[_0xff66('0x4e')]=function(_0x516921,_0x21340b){var _0x4ac1d6={'where':{'id':_0x516921[_0xff66('0x49')]['id']}},_0x2caef9={};_0x2caef9[_0xff66('0x34')]=_[_0xff66('0x37')](db[_0xff66('0x2f')]['rawAttributes']);_0x4ac1d6[_0xff66('0x39')]=_[_0xff66('0x3a')](_0x2caef9[_0xff66('0x34')],qs[_0xff66('0x3b')](_0x516921['query'][_0xff66('0x3b')]));_0x4ac1d6[_0xff66('0x39')]=_0x4ac1d6['attributes'][_0xff66('0x3c')]?_0x4ac1d6[_0xff66('0x39')]:_0x2caef9['model'];if(_0x516921[_0xff66('0x36')][_0xff66('0x44')]){_0x4ac1d6[_0xff66('0x45')]=[{'all':!![]}];}_0x4ac1d6=_[_0xff66('0x42')]({},_0x4ac1d6,_0x516921['options']);return db[_0xff66('0x2f')][_0xff66('0x4f')](_0x4ac1d6)['then'](handleEntityNotFound(_0x21340b,null))[_0xff66('0x2a')](function(_0x23891f){if(_0x23891f){var _0x5d0e71=_0x23891f[_0xff66('0x50')]({'plain':!![]});_0x5d0e71=qs[_0xff66('0x51')](_0x5d0e71,['id',_0xff66('0x52'),_0xff66('0x53'),_0xff66('0x54')]);_0x516921['body']=_[_0xff66('0x51')](_0x516921[_0xff66('0x4c')],['id',_0xff66('0x52'),'updatedAt']);return db[_0xff66('0x55')][_0xff66('0x56')](function(_0x377c98){return db[_0xff66('0x2f')]['create'](_[_0xff66('0x42')](_0x5d0e71,_0x516921[_0xff66('0x4c')]),{'include':_0x516921[_0xff66('0x36')][_0xff66('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x377c98})[_0xff66('0x2a')](function(_0x3fc4ba){var _0x409c89=_0x3fc4ba['get']({'plain':!![]});return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x516921['params']['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x1c0eab){if(_0x1c0eab){return BPromise['each'](_0x1c0eab,function(_0x348657){return new BPromise(function(_0x2f8944,_0x3e9c18){if(_0x348657[_0xff66('0x58')]===null||_0x348657[_0xff66('0x58')]===0x1)_0x2f8944(null);return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x348657['id']},'raw':!![]})['then'](function(_0x22ce25){var _0x48d588=_[_0xff66('0x35')](_0x22ce25,function(_0x29ac98){return qs[_0xff66('0x51')](_0x29ac98,['id',_0xff66('0x52'),_0xff66('0x53'),'sectionId']);});_0x2f8944(_0x48d588);})['catch'](function(_0x14332f){_0x3e9c18(_0x14332f);});})[_0xff66('0x2a')](function(_0x3c751a){var _0x521a21=qs['omit'](_0x348657,['id','createdAt',_0xff66('0x53')]);_0x521a21['userProfileId']=_0x409c89['id'];if(_0x3c751a)_0x521a21[_0xff66('0x5a')]=_0x3c751a;return _0x521a21;})[_0xff66('0x2a')](function(_0x4f7e61){return db[_0xff66('0x57')][_0xff66('0x4b')](_0x4f7e61,{'include':[{'model':db[_0xff66('0x59')],'as':_0xff66('0x5a')}],'raw':!![],'transaction':_0x377c98});});})[_0xff66('0x2a')](function(){return _0x409c89;});}});});});}})[_0xff66('0x2a')](respondWithResult(_0x21340b,0xc9))['catch'](handleError(_0x21340b,null));};exports[_0xff66('0x29')]=function(_0x3ceb9f,_0x2ff80b){if(_0x3ceb9f[_0xff66('0x4c')]['id']){delete _0x3ceb9f[_0xff66('0x4c')]['id'];}return db[_0xff66('0x2f')]['find']({'where':{'id':_0x3ceb9f[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x2ff80b,null))[_0xff66('0x2a')](saveUpdates(_0x3ceb9f[_0xff66('0x4c')],null))['then'](respondWithResult(_0x2ff80b,null))[_0xff66('0x4d')](handleError(_0x2ff80b,null));};exports['destroy']=function(_0x30466f,_0x5ec287){return db[_0xff66('0x2f')]['find']({'where':{'id':_0x30466f[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x5ec287,null))[_0xff66('0x2a')](removeEntity(_0x5ec287,null))['catch'](handleError(_0x5ec287,null));};exports[_0xff66('0x5b')]=function(_0x8b68ed,_0x47bd20){return db[_0xff66('0x2f')]['describe']()[_0xff66('0x2a')](respondWithResult(_0x47bd20,null))[_0xff66('0x4d')](handleError(_0x47bd20,null));};exports[_0xff66('0x5c')]=function(_0x1ef866,_0x13ec2d){var _0x1aa065=_0x1ef866[_0xff66('0x4c')];return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x1ef866[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x13ec2d,null))[_0xff66('0x2a')](function(_0x14968d){if(_0x14968d){return db[_0xff66('0x55')][_0xff66('0x56')](function(_0x4dbbd3){return db['UserProfileSection'][_0xff66('0x2b')]({'where':{'userProfileId':_0x1ef866['params']['id'],'sectionId':_[_0xff66('0x35')](_0x1aa065,function(_0x106609){return _0x106609[_0xff66('0x5d')];})},'transaction':_0x4dbbd3})[_0xff66('0x2a')](function(){var _0x21a56e=_['map'](_0x1aa065,function(_0x35ef50){_0x35ef50[_0xff66('0x5e')]=_0x1ef866[_0xff66('0x49')]['id'];return _0x35ef50;});var _0x56b160=[];return BPromise['each'](_0x21a56e,function(_0x3c0a56){return db['UserProfileSection'][_0xff66('0x4b')](_0x3c0a56,{'include':[{'model':db[_0xff66('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4dbbd3})[_0xff66('0x2a')](function(_0x1192fc){_0x56b160[_0xff66('0x5f')](_0x1192fc[_0xff66('0x50')]({'plain':!![]}));});})[_0xff66('0x2a')](function(){return _0x56b160;});});});}})['then'](function(_0x41a775){return _0x41a775;})[_0xff66('0x2a')](respondWithResult(_0x13ec2d,null))[_0xff66('0x4d')](handleError(_0x13ec2d,null));};exports[_0xff66('0x60')]=function(_0x12978a,_0x4d7ab4){var _0x381322;return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x12978a[_0xff66('0x49')]['id']},'attributes':['id',_0xff66('0x2e')]})[_0xff66('0x2a')](handleEntityNotFound(_0x4d7ab4,null))[_0xff66('0x2a')](function(_0x56753a){if(_0x56753a){_0x381322=_0x56753a;return db[_0xff66('0x57')][_0xff66('0x2b')]({'where':{'userProfileId':_0x12978a[_0xff66('0x49')]['id'],'sectionId':_0x12978a['query']['ids']}});}})['then'](function(){return _0x381322;})[_0xff66('0x2a')](respondWithStatusCode(_0x4d7ab4,null))[_0xff66('0x4d')](handleError(_0x4d7ab4,null));};exports['getSections']=function(_0x46997e,_0x10bcfa){var _0x9528b7=[];var _0x5ceda5=[];return db['UserProfileSection'][_0xff66('0x46')]({'where':{'userProfileId':_0x46997e['params']['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x5eec30){_0x9528b7=_[_0xff66('0x43')](_0x5eec30,function(_0x269b36){return _0x269b36[_0xff66('0x61')]===0x1||_[_0xff66('0x62')]([0x3eb,0x709],_0x269b36[_0xff66('0x5d')]);});if(!_[_0xff66('0x63')](_0x9528b7)){return _['map'](_0x9528b7,function(_0x306012){return _0x306012[_0xff66('0x5d')];});}else{return;}})[_0xff66('0x2a')](function(_0x439fe1){if(_0x439fe1)_0x5ceda5=_0x439fe1;if(_[_0xff66('0x62')](_0x5ceda5,0x64)){var _0x450854=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x64});return hasDefaultDashboard(_0x450854)[_0xff66('0x2a')](function(_0x416b45){return _['map'](_0x9528b7,function(_0x2aac34){if(_0x2aac34['sectionId']===0x64){_0x2aac34['subsections']=_0x416b45;}return _0x2aac34;});});}else{return;}})[_0xff66('0x2a')](function(_0x160daf){if(_0x160daf)_0x9528b7=_0x160daf;if(_[_0xff66('0x62')](_0x5ceda5,0x3eb)){var _0x1a82b7=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x3eb});return getCustomDashboards(_0x1a82b7)['then'](function(_0x374438){return _['map'](_0x9528b7,function(_0x3a4393){if(_0x1a82b7['enabled']){if(_0x3a4393[_0xff66('0x5d')]===0x3eb){_0x3a4393[_0xff66('0x64')]=_0x374438;}}else{if(_0x3a4393['sectionId']===0x64){if(!_0x3a4393[_0xff66('0x64')]){_0x3a4393[_0xff66('0x64')]=[];}_0x3a4393[_0xff66('0x64')]=_0x3a4393[_0xff66('0x64')]['concat'](_0x374438);}}return _0x3a4393;});});}else{return;}})[_0xff66('0x2a')](function(_0x101d1e){if(_0x101d1e)_0x9528b7=_0x101d1e;if(_['includes'](_0x5ceda5,0x709)){var _0x2c105f=_[_0xff66('0x4f')](_0x9528b7,{'sectionId':0x709});return getPlugins(_0x2c105f)[_0xff66('0x2a')](function(_0x51ae3f){if(_0x2c105f[_0xff66('0x61')]){return _[_0xff66('0x35')](_0x9528b7,function(_0x44beb6){if(_0x44beb6['sectionId']===0x709){_0x44beb6[_0xff66('0x64')]=_0x51ae3f;}return _0x44beb6;});}else{var _0x1d9a41={'sectionId':0x76c,'enabled':0x1,'subsections':_0x51ae3f};var _0x219d16=_[_0xff66('0x35')](_0x9528b7);_0x219d16[_0xff66('0x5f')](_0x1d9a41);return _0x219d16;}});}else{return;}})[_0xff66('0x2a')](function(_0x24065c){if(_0x24065c)_0x9528b7=_0x24065c;return _[_0xff66('0x43')](_0x9528b7,[_0xff66('0x61'),0x1]);})[_0xff66('0x2a')](respondWithResult(_0x10bcfa,null))[_0xff66('0x4d')](handleError(_0x10bcfa,null));};function hasDefaultDashboard(_0xe68ce9){var _0x2012b3=[0x65];return new BPromise(function(_0x3e4cff,_0xcfcb9){try{if(_0xe68ce9[_0xff66('0x58')]){_0x3e4cff(_0x2012b3);}else{return db[_0xff66('0x59')][_0xff66('0x65')]({'where':{'sectionId':_0xe68ce9['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x7a153f){_0x7a153f?_0x3e4cff(_0x2012b3):_0x3e4cff();});}}catch(_0x5c5c37){_0xcfcb9(_0x5c5c37);}});}function getCustomDashboards(_0x425d37){var _0x7451c9=[];return new BPromise(function(_0x811a10,_0x300e1a){try{if(_0x425d37[_0xff66('0x58')]){return db[_0xff66('0x66')]['findAll']({'raw':!![]})[_0xff66('0x2a')](function(_0x39f1ad){_0x39f1ad['forEach'](function(_0x440c5d){_0x7451c9['push'](_0x440c5d['id']+0x1869f);});_0x811a10(_0x7451c9);});}else{return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x425d37['id']},'raw':!![]})[_0xff66('0x2a')](function(_0xcb6d8d){_0xcb6d8d[_0xff66('0x67')](function(_0x302bd5){_0x7451c9[_0xff66('0x5f')](_0x302bd5[_0xff66('0x68')]+0x1869f);});_0x811a10(_0x7451c9);});}}catch(_0x1020a3){_0x300e1a(_0x1020a3);}});}function getPlugins(_0x48fa09){var _0x4ad8d9=[];return new BPromise(function(_0x27ac8d,_0x154f77){try{if(_0x48fa09['autoAssociation']){return db[_0xff66('0x69')][_0xff66('0x46')]({'raw':!![]})['then'](function(_0x3f0eef){_0x3f0eef[_0xff66('0x67')](function(_0x2d0ef9){_0x4ad8d9[_0xff66('0x5f')](_0x2d0ef9['id']+0x15b38);});_0x27ac8d(_0x4ad8d9);});}else{return db[_0xff66('0x59')][_0xff66('0x46')]({'where':{'sectionId':_0x48fa09['id']},'raw':!![]})[_0xff66('0x2a')](function(_0x434b1a){_0x434b1a[_0xff66('0x67')](function(_0x2e5ae9){_0x4ad8d9[_0xff66('0x5f')](_0x2e5ae9[_0xff66('0x68')]+0x15b38);});_0x27ac8d(_0x4ad8d9);});}}catch(_0x4b20e6){_0x154f77(_0x4b20e6);}});}exports[_0xff66('0x6a')]=function(_0x320065,_0x4a94a0){return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x320065[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x4a94a0,null))[_0xff66('0x2a')](function(_0x1a7bfc){if(_0x1a7bfc){return db['sequelize'][_0xff66('0x56')](function(_0x16158e){return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x320065['params']['id']},'attributes':['id'],'raw':!![]})[_0xff66('0x2a')](function(_0x4f1ecf){if(_0x4f1ecf){return db[_0xff66('0x57')][_0xff66('0x2b')]({'where':{'userProfileId':_0x320065[_0xff66('0x49')]['id'],'id':_['map'](_0x4f1ecf,function(_0x4c8e9c){return _0x4c8e9c['id'];})},'transaction':_0x16158e});}})[_0xff66('0x2a')](function(_0x7fe3aa){var _0xef7d91=_['map'](_0x320065[_0xff66('0x4c')],function(_0x5e69b3){_0x5e69b3['userProfileId']=_0x320065[_0xff66('0x49')]['id'];return _0x5e69b3;});return db[_0xff66('0x57')]['bulkCreate'](_0xef7d91,{'raw':!![],'transaction':_0x16158e});})[_0xff66('0x2a')](function(_0x46eb5b){var _0x51d40d=_[_0xff66('0x43')](_[_0xff66('0x35')](_0x46eb5b,function(_0x50839a){return _0x50839a[_0xff66('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x51d40d){return db[_0xff66('0x57')][_0xff66('0x46')]({'where':{'userProfileId':_0x320065[_0xff66('0x49')]['id'],'sectionId':_['map'](_0x51d40d,function(_0xee6682){return _0xee6682[_0xff66('0x5d')];})},'attributes':['id',_0xff66('0x5d')],'raw':!![]})['then'](function(_0x3f635f){var _0x31f819=_[_0xff66('0x35')](_0x320065[_0xff66('0x4c')],function(_0x34c3c1){_0x34c3c1[_0xff66('0x5e')]=_0x320065[_0xff66('0x49')]['id'];return _0x34c3c1;});return db['UserProfileResource']['bulkCreate'](_0x31f819,{'raw':!![],'transaction':_0x16158e});});}})['catch'](handleError(_0x4a94a0,null));});}})[_0xff66('0x2a')](function(_0x2b2c6e){var _0x40340f=_[_0xff66('0x35')](_0x2b2c6e,function(_0x5ef0c3){return _0x5ef0c3[_0xff66('0x50')]({'plain':!![]});});})[_0xff66('0x2a')](respondWithResult(_0x4a94a0,null))[_0xff66('0x4d')](handleError(_0x4a94a0,null));};exports[_0xff66('0x6b')]=function(_0x4a1dfb,_0x5c38c0,_0x1046a2){return db[_0xff66('0x2f')][_0xff66('0x4f')]({'where':{'id':_0x4a1dfb['params']['id']}})[_0xff66('0x2a')](handleEntityNotFound(_0x5c38c0,null))[_0xff66('0x2a')](function(_0x588130){if(_0x588130){return _0x588130[_0xff66('0x6b')](_0x4a1dfb[_0xff66('0x36')][_0xff66('0x6c')]);}})[_0xff66('0x2a')](respondWithStatusCode(_0x5c38c0,null))['catch'](handleError(_0x5c38c0,null));};exports['getResources']=function(_0x2ea9c4,_0x6ca9a8){var _0xe2f0d2={};if(!_0x2ea9c4[_0xff66('0x36')][_0xff66('0x6d')])throw new Error(_0xff66('0x6e'));if(!_0x2ea9c4[_0xff66('0x36')][_0xff66('0x3d')](_0xff66('0x6f'))){_0xe2f0d2[_0xff66('0x23')]=qs[_0xff66('0x23')](_0x2ea9c4[_0xff66('0x36')][_0xff66('0x23')]);_0xe2f0d2[_0xff66('0x21')]=qs[_0xff66('0x21')](_0x2ea9c4['query'][_0xff66('0x21')]);}return db[_0xff66('0x2f')]['find']({'where':{'id':_0x2ea9c4[_0xff66('0x49')]['id']}})[_0xff66('0x2a')](function(_0x291c42){if(!_0x291c42)throw new Error(_0xff66('0x70')+_0x2ea9c4[_0xff66('0x49')]['id']);return db[_0xff66('0x2f')][_0xff66('0x71')](_0x2ea9c4);})['then'](respondWithFilteredResult(_0x6ca9a8,_0xe2f0d2))[_0xff66('0x4d')](handleError(_0x6ca9a8,null));}; \ No newline at end of file +var _0x2f27=['sectionId','userProfileId','Resources','describe','push','removeSections','ids','includes','subsections','enabled','concat','findOne','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','UserProfile','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','clone','rawAttributes','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource'];(function(_0x5a38ee,_0x1bad30){var _0x4a7102=function(_0x56b2e8){while(--_0x56b2e8){_0x5a38ee['push'](_0x5a38ee['shift']());}};_0x4a7102(++_0x1bad30);}(_0x2f27,0x168));var _0x72f2=function(_0x32610c,_0x17fa9b){_0x32610c=_0x32610c-0x0;var _0x45399a=_0x2f27[_0x32610c];return _0x45399a;};'use strict';var emlformat=require(_0x72f2('0x0'));var rimraf=require(_0x72f2('0x1'));var zipdir=require(_0x72f2('0x2'));var jsonpatch=require(_0x72f2('0x3'));var rp=require('request-promise');var moment=require(_0x72f2('0x4'));var BPromise=require(_0x72f2('0x5'));var Mustache=require(_0x72f2('0x6'));var util=require(_0x72f2('0x7'));var path=require(_0x72f2('0x8'));var sox=require(_0x72f2('0x9'));var csv=require(_0x72f2('0xa'));var ejs=require(_0x72f2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x72f2('0xc'));var crypto=require(_0x72f2('0xd'));var jsforce=require(_0x72f2('0xe'));var deskjs=require(_0x72f2('0xf'));var toCsv=require(_0x72f2('0xa'));var querystring=require(_0x72f2('0x10'));var Papa=require(_0x72f2('0x11'));var Redis=require(_0x72f2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x72f2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72f2('0x14'));var logger=require(_0x72f2('0x15'))(_0x72f2('0x16'));var utils=require(_0x72f2('0x17'));var config=require(_0x72f2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x72f2('0x19')]=_[_0x72f2('0x1a')](config[_0x72f2('0x19')],{'host':_0x72f2('0x1b'),'port':0x18eb});var socket=require(_0x72f2('0x1c'))(new Redis(config['redis']));require(_0x72f2('0x1d'))[_0x72f2('0x1e')](socket);function respondWithStatusCode(_0x530173,_0x1c731c){_0x1c731c=_0x1c731c||0xcc;return function(_0x45ed48){if(_0x45ed48){return _0x530173[_0x72f2('0x1f')](_0x1c731c);}return _0x530173[_0x72f2('0x20')](_0x1c731c)['end']();};}function respondWithResult(_0x477d85,_0x6fd8a){_0x6fd8a=_0x6fd8a||0xc8;return function(_0x21ad7b){if(_0x21ad7b){return _0x477d85[_0x72f2('0x20')](_0x6fd8a)['json'](_0x21ad7b);}};}function respondWithFilteredResult(_0x254413,_0xb8fe11){return function(_0x2ac3f2){if(_0x2ac3f2){var _0x108739=typeof _0xb8fe11[_0x72f2('0x21')]==='undefined'&&typeof _0xb8fe11[_0x72f2('0x22')]===_0x72f2('0x23');var _0x3b4d18=_0x2ac3f2[_0x72f2('0x24')];var _0x2d1561=_0x108739?0x0:_0xb8fe11[_0x72f2('0x21')];var _0x21d781=_0x108739?_0x2ac3f2['count']:_0xb8fe11[_0x72f2('0x21')]+_0xb8fe11['limit'];var _0x18d500;if(_0x21d781>=_0x3b4d18){_0x21d781=_0x3b4d18;_0x18d500=0xc8;}else{_0x18d500=0xce;}_0x254413[_0x72f2('0x20')](_0x18d500);return _0x254413[_0x72f2('0x25')](_0x72f2('0x26'),_0x2d1561+'-'+_0x21d781+'/'+_0x3b4d18)['json'](_0x2ac3f2);}return null;};}function patchUpdates(_0x2c2e9e){return function(_0x49fa60){try{jsonpatch[_0x72f2('0x27')](_0x49fa60,_0x2c2e9e,!![]);}catch(_0x296528){return BPromise[_0x72f2('0x28')](_0x296528);}return _0x49fa60[_0x72f2('0x29')]();};}function saveUpdates(_0x14b62e,_0x3bf832){return function(_0x481622){if(_0x481622){return _0x481622[_0x72f2('0x2a')](_0x14b62e)[_0x72f2('0x2b')](function(_0x5ad288){return _0x5ad288;});}return null;};}function removeEntity(_0x15648c,_0x155dd6){return function(_0x200fbe){if(_0x200fbe){return _0x200fbe[_0x72f2('0x2c')]()[_0x72f2('0x2b')](function(){_0x15648c[_0x72f2('0x20')](0xcc)[_0x72f2('0x2d')]();});}};}function handleEntityNotFound(_0x2c573f,_0x234b46){return function(_0x520f9a){if(!_0x520f9a){_0x2c573f[_0x72f2('0x1f')](0x194);}return _0x520f9a;};}function handleError(_0x1d6be0,_0x5ab5aa){_0x5ab5aa=_0x5ab5aa||0x1f4;return function(_0x33ca8f){logger[_0x72f2('0x2e')](_0x33ca8f['stack']);if(_0x33ca8f['name']){delete _0x33ca8f[_0x72f2('0x2f')];}_0x1d6be0['status'](_0x5ab5aa)[_0x72f2('0x30')](_0x33ca8f);};}exports[_0x72f2('0x31')]=function(_0x180f60,_0x852e6e){var _0x552aad={},_0x458e08={},_0x2b20f2={'count':0x0,'rows':[]};var _0x291197=_[_0x72f2('0x32')](db[_0x72f2('0x33')]['rawAttributes'],function(_0x1948d1){return{'name':_0x1948d1[_0x72f2('0x34')],'type':_0x1948d1[_0x72f2('0x35')]['key']};});_0x458e08[_0x72f2('0x36')]=_['map'](_0x291197,_0x72f2('0x2f'));_0x458e08[_0x72f2('0x37')]=_[_0x72f2('0x38')](_0x180f60['query']);_0x458e08[_0x72f2('0x39')]=_[_0x72f2('0x3a')](_0x458e08[_0x72f2('0x36')],_0x458e08[_0x72f2('0x37')]);_0x552aad[_0x72f2('0x3b')]=_[_0x72f2('0x3a')](_0x458e08['model'],qs['fields'](_0x180f60['query'][_0x72f2('0x3c')]));_0x552aad[_0x72f2('0x3b')]=_0x552aad[_0x72f2('0x3b')][_0x72f2('0x3d')]?_0x552aad[_0x72f2('0x3b')]:_0x458e08[_0x72f2('0x36')];if(!_0x180f60['query'][_0x72f2('0x3e')](_0x72f2('0x3f'))){_0x552aad['limit']=qs[_0x72f2('0x22')](_0x180f60[_0x72f2('0x37')][_0x72f2('0x22')]);_0x552aad[_0x72f2('0x21')]=qs[_0x72f2('0x21')](_0x180f60[_0x72f2('0x37')][_0x72f2('0x21')]);}_0x552aad['order']=qs[_0x72f2('0x40')](_0x180f60[_0x72f2('0x37')][_0x72f2('0x40')]);_0x552aad[_0x72f2('0x41')]=qs[_0x72f2('0x39')](_[_0x72f2('0x42')](_0x180f60[_0x72f2('0x37')],_0x458e08[_0x72f2('0x39')]),_0x291197);if(_0x180f60[_0x72f2('0x37')][_0x72f2('0x43')]){_0x552aad[_0x72f2('0x41')]=_[_0x72f2('0x44')](_0x552aad[_0x72f2('0x41')],{'$or':_['map'](_0x291197,function(_0xd85480){if(_0xd85480[_0x72f2('0x35')]!=='VIRTUAL'){var _0x37e7f0={};_0x37e7f0[_0xd85480[_0x72f2('0x2f')]]={'$like':'%'+_0x180f60[_0x72f2('0x37')][_0x72f2('0x43')]+'%'};return _0x37e7f0;}})});}_0x552aad=_[_0x72f2('0x44')]({},_0x552aad,_0x180f60[_0x72f2('0x45')]);var _0x2fa720={'where':_0x552aad[_0x72f2('0x41')]};return db[_0x72f2('0x33')][_0x72f2('0x24')](_0x2fa720)['then'](function(_0xfdf68f){_0x2b20f2[_0x72f2('0x24')]=_0xfdf68f;if(_0x180f60[_0x72f2('0x37')][_0x72f2('0x46')]){_0x552aad[_0x72f2('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x72f2('0x48')](_0x552aad);})[_0x72f2('0x2b')](function(_0xabc08b){_0x2b20f2['rows']=_0xabc08b;return _0x2b20f2;})[_0x72f2('0x2b')](respondWithFilteredResult(_0x852e6e,_0x552aad))[_0x72f2('0x49')](handleError(_0x852e6e,null));};exports[_0x72f2('0x4a')]=function(_0x3d3f01,_0x38b0e5){var _0x168d24={'raw':![],'where':{'id':_0x3d3f01[_0x72f2('0x4b')]['id']}},_0x4efcb5={};_0x4efcb5[_0x72f2('0x36')]=_[_0x72f2('0x38')](db[_0x72f2('0x33')]['rawAttributes']);_0x4efcb5[_0x72f2('0x37')]=_[_0x72f2('0x38')](_0x3d3f01['query']);_0x4efcb5['filters']=_[_0x72f2('0x3a')](_0x4efcb5[_0x72f2('0x36')],_0x4efcb5['query']);_0x168d24[_0x72f2('0x3b')]=_['intersection'](_0x4efcb5[_0x72f2('0x36')],qs[_0x72f2('0x3c')](_0x3d3f01[_0x72f2('0x37')][_0x72f2('0x3c')]));_0x168d24[_0x72f2('0x3b')]=_0x168d24[_0x72f2('0x3b')][_0x72f2('0x3d')]?_0x168d24[_0x72f2('0x3b')]:_0x4efcb5[_0x72f2('0x36')];if(_0x3d3f01[_0x72f2('0x37')][_0x72f2('0x46')]){_0x168d24[_0x72f2('0x47')]=[{'all':!![]}];}_0x168d24=_[_0x72f2('0x44')]({},_0x168d24,_0x3d3f01[_0x72f2('0x45')]);return db[_0x72f2('0x33')][_0x72f2('0x4c')](_0x168d24)[_0x72f2('0x2b')](handleEntityNotFound(_0x38b0e5,null))['then'](respondWithResult(_0x38b0e5,null))[_0x72f2('0x49')](handleError(_0x38b0e5,null));};exports[_0x72f2('0x4d')]=function(_0x119d1d,_0x51bbce){return db[_0x72f2('0x33')][_0x72f2('0x4d')](_0x119d1d[_0x72f2('0x4e')],{})[_0x72f2('0x2b')](respondWithResult(_0x51bbce,0xc9))[_0x72f2('0x49')](handleError(_0x51bbce,null));};exports[_0x72f2('0x4f')]=function(_0x44e8c4,_0x34fe7b){var _0x943a04={'where':{'id':_0x44e8c4[_0x72f2('0x4b')]['id']}},_0x5588be={};_0x5588be[_0x72f2('0x36')]=_[_0x72f2('0x38')](db[_0x72f2('0x33')][_0x72f2('0x50')]);_0x943a04[_0x72f2('0x3b')]=_[_0x72f2('0x3a')](_0x5588be['model'],qs[_0x72f2('0x3c')](_0x44e8c4['query'][_0x72f2('0x3c')]));_0x943a04[_0x72f2('0x3b')]=_0x943a04['attributes'][_0x72f2('0x3d')]?_0x943a04[_0x72f2('0x3b')]:_0x5588be['model'];if(_0x44e8c4[_0x72f2('0x37')][_0x72f2('0x46')]){_0x943a04['include']=[{'all':!![]}];}_0x943a04=_['merge']({},_0x943a04,_0x44e8c4[_0x72f2('0x45')]);return db[_0x72f2('0x33')][_0x72f2('0x4c')](_0x943a04)['then'](handleEntityNotFound(_0x34fe7b,null))[_0x72f2('0x2b')](function(_0x23ed73){if(_0x23ed73){var _0x1ce554=_0x23ed73[_0x72f2('0x51')]({'plain':!![]});_0x1ce554=qs[_0x72f2('0x52')](_0x1ce554,['id',_0x72f2('0x53'),_0x72f2('0x54'),_0x72f2('0x55')]);_0x44e8c4[_0x72f2('0x4e')]=_[_0x72f2('0x52')](_0x44e8c4[_0x72f2('0x4e')],['id',_0x72f2('0x53'),_0x72f2('0x54')]);return db[_0x72f2('0x56')][_0x72f2('0x57')](function(_0x3f35d7){return db[_0x72f2('0x33')][_0x72f2('0x4d')](_[_0x72f2('0x44')](_0x1ce554,_0x44e8c4['body']),{'include':_0x44e8c4[_0x72f2('0x37')][_0x72f2('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x3f35d7})['then'](function(_0x40640e){var _0x77df74=_0x40640e[_0x72f2('0x51')]({'plain':!![]});return db[_0x72f2('0x58')]['findAll']({'where':{'userProfileId':_0x44e8c4[_0x72f2('0x4b')]['id']},'raw':!![]})[_0x72f2('0x2b')](function(_0x2a9f13){if(_0x2a9f13){return BPromise[_0x72f2('0x59')](_0x2a9f13,function(_0x488822){return new BPromise(function(_0x3c4caf,_0xfadac8){if(_0x488822[_0x72f2('0x5a')]===null||_0x488822[_0x72f2('0x5a')]===0x1)_0x3c4caf(null);return db[_0x72f2('0x5b')][_0x72f2('0x48')]({'where':{'sectionId':_0x488822['id']},'raw':!![]})[_0x72f2('0x2b')](function(_0x33d760){var _0x55d221=_[_0x72f2('0x32')](_0x33d760,function(_0x2cdec8){return qs[_0x72f2('0x52')](_0x2cdec8,['id',_0x72f2('0x53'),_0x72f2('0x54'),_0x72f2('0x5c')]);});_0x3c4caf(_0x55d221);})[_0x72f2('0x49')](function(_0x426816){_0xfadac8(_0x426816);});})[_0x72f2('0x2b')](function(_0x13b65a){var _0x4115cc=qs[_0x72f2('0x52')](_0x488822,['id',_0x72f2('0x53'),_0x72f2('0x54')]);_0x4115cc[_0x72f2('0x5d')]=_0x77df74['id'];if(_0x13b65a)_0x4115cc[_0x72f2('0x5e')]=_0x13b65a;return _0x4115cc;})[_0x72f2('0x2b')](function(_0x1df701){return db[_0x72f2('0x58')][_0x72f2('0x4d')](_0x1df701,{'include':[{'model':db[_0x72f2('0x5b')],'as':_0x72f2('0x5e')}],'raw':!![],'transaction':_0x3f35d7});});})[_0x72f2('0x2b')](function(){return _0x77df74;});}});});});}})['then'](respondWithResult(_0x34fe7b,0xc9))[_0x72f2('0x49')](handleError(_0x34fe7b,null));};exports[_0x72f2('0x2a')]=function(_0x54a931,_0x449e94){if(_0x54a931[_0x72f2('0x4e')]['id']){delete _0x54a931[_0x72f2('0x4e')]['id'];}return db[_0x72f2('0x33')][_0x72f2('0x4c')]({'where':{'id':_0x54a931['params']['id']}})[_0x72f2('0x2b')](handleEntityNotFound(_0x449e94,null))[_0x72f2('0x2b')](saveUpdates(_0x54a931[_0x72f2('0x4e')],null))[_0x72f2('0x2b')](respondWithResult(_0x449e94,null))[_0x72f2('0x49')](handleError(_0x449e94,null));};exports[_0x72f2('0x2c')]=function(_0xe87f6f,_0x61bda2){return db[_0x72f2('0x33')][_0x72f2('0x4c')]({'where':{'id':_0xe87f6f[_0x72f2('0x4b')]['id']}})[_0x72f2('0x2b')](handleEntityNotFound(_0x61bda2,null))[_0x72f2('0x2b')](removeEntity(_0x61bda2,null))[_0x72f2('0x49')](handleError(_0x61bda2,null));};exports['describe']=function(_0x33b5ed,_0xd66a97){return db[_0x72f2('0x33')][_0x72f2('0x5f')]()[_0x72f2('0x2b')](respondWithResult(_0xd66a97,null))['catch'](handleError(_0xd66a97,null));};exports['addSections']=function(_0x277b9b,_0x180251){var _0x397fc5=_0x277b9b[_0x72f2('0x4e')];return db['UserProfile'][_0x72f2('0x4c')]({'where':{'id':_0x277b9b[_0x72f2('0x4b')]['id']}})[_0x72f2('0x2b')](handleEntityNotFound(_0x180251,null))['then'](function(_0x1ed784){if(_0x1ed784){return db[_0x72f2('0x56')][_0x72f2('0x57')](function(_0x3c5507){return db[_0x72f2('0x58')]['destroy']({'where':{'userProfileId':_0x277b9b[_0x72f2('0x4b')]['id'],'sectionId':_[_0x72f2('0x32')](_0x397fc5,function(_0x57a1fe){return _0x57a1fe[_0x72f2('0x5c')];})},'transaction':_0x3c5507})['then'](function(){var _0x3d24a6=_['map'](_0x397fc5,function(_0x299093){_0x299093[_0x72f2('0x5d')]=_0x277b9b[_0x72f2('0x4b')]['id'];return _0x299093;});var _0x4ff3b9=[];return BPromise[_0x72f2('0x59')](_0x3d24a6,function(_0x25df98){return db[_0x72f2('0x58')][_0x72f2('0x4d')](_0x25df98,{'include':[{'model':db['UserProfileResource'],'as':_0x72f2('0x5e')}],'raw':!![],'transaction':_0x3c5507})[_0x72f2('0x2b')](function(_0x113456){_0x4ff3b9[_0x72f2('0x60')](_0x113456[_0x72f2('0x51')]({'plain':!![]}));});})[_0x72f2('0x2b')](function(){return _0x4ff3b9;});});});}})['then'](function(_0x63644a){return _0x63644a;})[_0x72f2('0x2b')](respondWithResult(_0x180251,null))[_0x72f2('0x49')](handleError(_0x180251,null));};exports[_0x72f2('0x61')]=function(_0x5ad445,_0x4b84c2){var _0x522286;return db[_0x72f2('0x33')]['find']({'where':{'id':_0x5ad445[_0x72f2('0x4b')]['id']},'attributes':['id',_0x72f2('0x2f')]})['then'](handleEntityNotFound(_0x4b84c2,null))[_0x72f2('0x2b')](function(_0x552b73){if(_0x552b73){_0x522286=_0x552b73;return db[_0x72f2('0x58')][_0x72f2('0x2c')]({'where':{'userProfileId':_0x5ad445[_0x72f2('0x4b')]['id'],'sectionId':_0x5ad445['query'][_0x72f2('0x62')]}});}})[_0x72f2('0x2b')](function(){return _0x522286;})[_0x72f2('0x2b')](respondWithStatusCode(_0x4b84c2,null))['catch'](handleError(_0x4b84c2,null));};exports['getSections']=function(_0x5a977b,_0x4dea40){var _0x3ead5e=[];var _0x329f7d=[];return db[_0x72f2('0x58')][_0x72f2('0x48')]({'where':{'userProfileId':_0x5a977b[_0x72f2('0x4b')]['id']},'raw':!![]})[_0x72f2('0x2b')](function(_0x2eea8b){_0x3ead5e=_[_0x72f2('0x43')](_0x2eea8b,function(_0xa18851){return _0xa18851['enabled']===0x1||_[_0x72f2('0x63')]([0x3eb,0x709],_0xa18851[_0x72f2('0x5c')]);});if(!_['isEmpty'](_0x3ead5e)){return _[_0x72f2('0x32')](_0x3ead5e,function(_0x37ed3a){return _0x37ed3a['sectionId'];});}else{return;}})['then'](function(_0x22662b){if(_0x22662b)_0x329f7d=_0x22662b;if(_[_0x72f2('0x63')](_0x329f7d,0x64)){var _0x2d01ae=_['find'](_0x3ead5e,{'sectionId':0x64});return hasDefaultDashboard(_0x2d01ae)[_0x72f2('0x2b')](function(_0x4bcc75){return _['map'](_0x3ead5e,function(_0x45ab3b){if(_0x45ab3b[_0x72f2('0x5c')]===0x64){_0x45ab3b[_0x72f2('0x64')]=_0x4bcc75;}return _0x45ab3b;});});}else{return;}})[_0x72f2('0x2b')](function(_0x144670){if(_0x144670)_0x3ead5e=_0x144670;if(_[_0x72f2('0x63')](_0x329f7d,0x3eb)){var _0x79ce1a=_[_0x72f2('0x4c')](_0x3ead5e,{'sectionId':0x3eb});return getCustomDashboards(_0x79ce1a)['then'](function(_0x1d30bb){return _[_0x72f2('0x32')](_0x3ead5e,function(_0x22d72d){if(_0x79ce1a[_0x72f2('0x65')]){if(_0x22d72d[_0x72f2('0x5c')]===0x3eb){_0x22d72d[_0x72f2('0x64')]=_0x1d30bb;}}else{if(_0x22d72d[_0x72f2('0x5c')]===0x64){if(!_0x22d72d[_0x72f2('0x64')]){_0x22d72d['subsections']=[];}_0x22d72d[_0x72f2('0x64')]=_0x22d72d[_0x72f2('0x64')][_0x72f2('0x66')](_0x1d30bb);}}return _0x22d72d;});});}else{return;}})[_0x72f2('0x2b')](function(_0x2e8f16){if(_0x2e8f16)_0x3ead5e=_0x2e8f16;if(_['includes'](_0x329f7d,0x709)){var _0x34cecf=_[_0x72f2('0x4c')](_0x3ead5e,{'sectionId':0x709});return getPlugins(_0x34cecf)[_0x72f2('0x2b')](function(_0x48987d){if(_0x34cecf[_0x72f2('0x65')]){return _['map'](_0x3ead5e,function(_0x5c5fd3){if(_0x5c5fd3[_0x72f2('0x5c')]===0x709){_0x5c5fd3[_0x72f2('0x64')]=_0x48987d;}return _0x5c5fd3;});}else{var _0x4f3f20={'sectionId':0x76c,'enabled':0x1,'subsections':_0x48987d};var _0x290135=_[_0x72f2('0x32')](_0x3ead5e);_0x290135[_0x72f2('0x60')](_0x4f3f20);return _0x290135;}});}else{return;}})['then'](function(_0x594355){if(_0x594355)_0x3ead5e=_0x594355;return _[_0x72f2('0x43')](_0x3ead5e,[_0x72f2('0x65'),0x1]);})[_0x72f2('0x2b')](respondWithResult(_0x4dea40,null))[_0x72f2('0x49')](handleError(_0x4dea40,null));};function hasDefaultDashboard(_0x21731d){var _0x4d3efe=[0x65];return new BPromise(function(_0x3c299c,_0x498fe1){try{if(_0x21731d[_0x72f2('0x5a')]){_0x3c299c(_0x4d3efe);}else{return db[_0x72f2('0x5b')][_0x72f2('0x67')]({'where':{'sectionId':_0x21731d['id']},'raw':!![]})[_0x72f2('0x2b')](function(_0x2448f){_0x2448f?_0x3c299c(_0x4d3efe):_0x3c299c();});}}catch(_0x46891f){_0x498fe1(_0x46891f);}});}function getCustomDashboards(_0x27fbea){var _0x4b7328=[];return new BPromise(function(_0x532c95,_0x4effa6){try{if(_0x27fbea['autoAssociation']){return db[_0x72f2('0x68')][_0x72f2('0x48')]({'raw':!![]})[_0x72f2('0x2b')](function(_0xe2ea0f){_0xe2ea0f[_0x72f2('0x69')](function(_0x397e4f){_0x4b7328['push'](_0x397e4f['id']+0x1869f);});_0x532c95(_0x4b7328);});}else{return db['UserProfileResource'][_0x72f2('0x48')]({'where':{'sectionId':_0x27fbea['id']},'raw':!![]})[_0x72f2('0x2b')](function(_0x4e861a){_0x4e861a['forEach'](function(_0x1b6106){_0x4b7328[_0x72f2('0x60')](_0x1b6106['resourceId']+0x1869f);});_0x532c95(_0x4b7328);});}}catch(_0x24cbe6){_0x4effa6(_0x24cbe6);}});}function getPlugins(_0x4e7fd0){var _0x57e7b9=[];return new BPromise(function(_0x1b6149,_0x44bce8){try{if(_0x4e7fd0['autoAssociation']){return db[_0x72f2('0x6a')][_0x72f2('0x48')]({'raw':!![]})[_0x72f2('0x2b')](function(_0x22d34b){_0x22d34b['forEach'](function(_0x4f9b84){_0x57e7b9[_0x72f2('0x60')](_0x4f9b84['id']+0x15b38);});_0x1b6149(_0x57e7b9);});}else{return db['UserProfileResource'][_0x72f2('0x48')]({'where':{'sectionId':_0x4e7fd0['id']},'raw':!![]})['then'](function(_0x1b5f12){_0x1b5f12[_0x72f2('0x69')](function(_0x33345c){_0x57e7b9[_0x72f2('0x60')](_0x33345c['resourceId']+0x15b38);});_0x1b6149(_0x57e7b9);});}}catch(_0xe0e82f){_0x44bce8(_0xe0e82f);}});}exports[_0x72f2('0x6b')]=function(_0x211761,_0x17cd23){return db['UserProfile']['find']({'where':{'id':_0x211761['params']['id']}})['then'](handleEntityNotFound(_0x17cd23,null))['then'](function(_0x29a1e3){if(_0x29a1e3){return db[_0x72f2('0x56')][_0x72f2('0x57')](function(_0x305c6c){return db['UserProfileSection'][_0x72f2('0x48')]({'where':{'userProfileId':_0x211761[_0x72f2('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x72f2('0x2b')](function(_0x20e99b){if(_0x20e99b){return db[_0x72f2('0x58')][_0x72f2('0x2c')]({'where':{'userProfileId':_0x211761[_0x72f2('0x4b')]['id'],'id':_['map'](_0x20e99b,function(_0x551b57){return _0x551b57['id'];})},'transaction':_0x305c6c});}})['then'](function(_0x437682){var _0x1730f9=_[_0x72f2('0x32')](_0x211761[_0x72f2('0x4e')],function(_0x1f7bb4){_0x1f7bb4['userProfileId']=_0x211761['params']['id'];return _0x1f7bb4;});return db['UserProfileSection']['bulkCreate'](_0x1730f9,{'raw':!![],'transaction':_0x305c6c});})[_0x72f2('0x2b')](function(_0x37edcf){var _0x3f9e5f=_[_0x72f2('0x43')](_[_0x72f2('0x32')](_0x37edcf,function(_0x2125e6){return _0x2125e6[_0x72f2('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x3f9e5f){return db['UserProfileSection'][_0x72f2('0x48')]({'where':{'userProfileId':_0x211761[_0x72f2('0x4b')]['id'],'sectionId':_['map'](_0x3f9e5f,function(_0x395bba){return _0x395bba[_0x72f2('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x72f2('0x2b')](function(_0x43dda9){var _0x255f13=_[_0x72f2('0x32')](_0x211761[_0x72f2('0x4e')],function(_0x3a0676){_0x3a0676[_0x72f2('0x5d')]=_0x211761[_0x72f2('0x4b')]['id'];return _0x3a0676;});return db[_0x72f2('0x5b')][_0x72f2('0x6c')](_0x255f13,{'raw':!![],'transaction':_0x305c6c});});}})[_0x72f2('0x49')](handleError(_0x17cd23,null));});}})['then'](function(_0xd6a859){var _0x44bb72=_['map'](_0xd6a859,function(_0x3d7347){return _0x3d7347[_0x72f2('0x51')]({'plain':!![]});});})[_0x72f2('0x2b')](respondWithResult(_0x17cd23,null))[_0x72f2('0x49')](handleError(_0x17cd23,null));};exports[_0x72f2('0x6d')]=function(_0x417674,_0x421cf2,_0x2de40d){return db[_0x72f2('0x33')][_0x72f2('0x4c')]({'where':{'id':_0x417674[_0x72f2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x421cf2,null))['then'](function(_0x12b42a){if(_0x12b42a){return _0x12b42a[_0x72f2('0x6d')](_0x417674[_0x72f2('0x37')]['ids']);}})[_0x72f2('0x2b')](respondWithStatusCode(_0x421cf2,null))[_0x72f2('0x49')](handleError(_0x421cf2,null));};exports[_0x72f2('0x6e')]=function(_0x2a218b,_0x43b68c){var _0x3bd369={};if(!_0x2a218b[_0x72f2('0x37')][_0x72f2('0x6f')])throw new Error(_0x72f2('0x70'));if(!_0x2a218b[_0x72f2('0x37')]['hasOwnProperty'](_0x72f2('0x3f'))){_0x3bd369[_0x72f2('0x22')]=qs['limit'](_0x2a218b[_0x72f2('0x37')][_0x72f2('0x22')]);_0x3bd369[_0x72f2('0x21')]=qs[_0x72f2('0x21')](_0x2a218b[_0x72f2('0x37')]['offset']);}return db['UserProfile'][_0x72f2('0x4c')]({'where':{'id':_0x2a218b[_0x72f2('0x4b')]['id']}})[_0x72f2('0x2b')](function(_0x1af9b9){if(!_0x1af9b9)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2a218b[_0x72f2('0x4b')]['id']);return db[_0x72f2('0x33')][_0x72f2('0x6e')](_0x2a218b);})['then'](respondWithFilteredResult(_0x43b68c,_0x3bd369))['catch'](handleError(_0x43b68c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8203305..e43f633 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 _0x6691=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa35f5d,_0x14e107){var _0x36a78b=function(_0x134b12){while(--_0x134b12){_0xa35f5d['push'](_0xa35f5d['shift']());}};_0x36a78b(++_0x14e107);}(_0x6691,0x12d));var _0x1669=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6691[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x1669('0x0'));var UserProfile=require(_0x1669('0x1'))['db'][_0x1669('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1669('0x3')](0x0);var events={'afterCreate':_0x1669('0x4'),'afterUpdate':_0x1669('0x5'),'afterDestroy':_0x1669('0x6')};function emitEvent(_0x455cbd){return function(_0x19a3f5,_0x2ad807,_0x4b41a5){UserProfileEvents[_0x1669('0x7')](_0x455cbd+':'+_0x19a3f5['id'],_0x19a3f5);UserProfileEvents[_0x1669('0x7')](_0x455cbd,_0x19a3f5);_0x4b41a5(null);};}for(var e in events){if(events[_0x1669('0x8')](e)){var event=events[e];UserProfile[_0x1669('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2d3921,_0x40288b){var _0x179e0c=function(_0x3763f6){while(--_0x3763f6){_0x2d3921['push'](_0x2d3921['shift']());}};_0x179e0c(++_0x40288b);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf323('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){UserProfileEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);UserProfileEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('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 f803ef8..a9185f5 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 _0x5c59=['fax','mail','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','QueueCampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','Schedule','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','model','all','keys','filters','intersection','attributes','fields','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','true','sms','dataValues'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0x5c59,0x17d));var _0x95c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5c59[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x95c5('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x95c5('0x1'));var squel=require(_0x95c5('0x2'));module[_0x95c5('0x3')]=function(_0x3c73d4){var _0x2c90c1=_0x3c73d4[_0x95c5('0x4')];function _0x7f2a40(_0x2d158f,_0x1c66a4){return new Promise(function(_0x547772,_0x5b5030){if(!_0x1c66a4)return _0x547772(null);var _0x109eea=_0x1c66a4[_0x95c5('0x5')]?{[_0x1c66a4[_0x95c5('0x5')][_0x95c5('0x6')]]:_0x1c66a4['filter'][_0x95c5('0x7')]}:undefined;return _0x2c90c1[_0x2d158f][_0x95c5('0x8')]({'where':_0x109eea,'raw':!![]})[_0x95c5('0x9')](function(_0x1fdf0d){_0x1c66a4[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x1fdf0d,'id');_0x547772(_0x1c66a4);})['catch'](function(_0x50c92a){_0x5b5030(_0x50c92a);});});}function _0x2eb240(_0x5d5ecc,_0x4cc261){return new Promise(function(_0x2a2ddc,_0x51bda1){var _0x5923ad=_0x5d5ecc[_0x95c5('0x5')]?{[_0x5d5ecc[_0x95c5('0x5')]['field']]:_0x5d5ecc[_0x95c5('0x5')][_0x95c5('0x7')]}:undefined;return _0x2c90c1[_0x5d5ecc['model']]['findAll']({'where':_0x5923ad,'raw':!![]})[_0x95c5('0x9')](function(_0x1e3dd5){_0x4cc261['associatedResources']=_[_0x95c5('0xb')](_0x1e3dd5,function(_0x3a16ed){return _0x3a16ed[_0x95c5('0xc')];});_0x2a2ddc(_0x4cc261);})[_0x95c5('0xd')](function(_0x357003){_0x51bda1(_0x357003);});});}function _0x214fd3(_0x174512,_0x244b34,_0x308e40){if(!_0x244b34)return Promise[_0x95c5('0xe')](null);return new Promise(function(_0x2c3b25,_0x1f621e){return _0x2c90c1[_0x95c5('0xf')][_0x95c5('0x8')]({'where':{'sectionId':_0x244b34['id']},'raw':!![]})[_0x95c5('0x9')](function(_0x341bfb){if(_0x174512['field']&&_0x174512[_0x95c5('0x6')]!=='id'){_0x244b34[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x341bfb,function(_0x25885b){return _0x25885b[_0x174512['field']];});}else{if(_0x308e40==='AnalyticExtractedReport'){_0x244b34['associatedResources']=_[_0x95c5('0xb')](_0x341bfb,function(_0x4f4fe6){return{'id':_0x4f4fe6[_0x95c5('0x10')],'type':_0x4f4fe6[_0x95c5('0x11')]};});}else{_0x244b34[_0x95c5('0xa')]=_[_0x95c5('0xb')](_0x341bfb,function(_0x2a7883){return _0x2a7883[_0x95c5('0x10')];});}}_0x2c3b25(_0x244b34);})[_0x95c5('0xd')](function(_0x50e495){_0x1f621e(_0x50e495);});});}function _0x330ef0(_0x243475,_0x2d11bb){var _0x447e6a={'parentSections':[]};switch(_0x243475[_0x95c5('0x12')]()){case _0x95c5('0x13'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x15');break;case _0x95c5('0x16'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x17');break;case _0x95c5('0x18'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x19');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x1b'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x1c');break;case'contacts':_0x447e6a['childModel']='CmContact';_0x447e6a['parentSections']=[{'name':_0x95c5('0x1d'),'field':'id','foreignKey':_0x95c5('0x1e')}];break;case'lists':_0x447e6a['childModel']=_0x95c5('0x1f');break;case _0x95c5('0x20'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x21');break;case _0x95c5('0x22'):_0x447e6a[_0x95c5('0x14')]='CmCustomField';break;case _0x95c5('0x23'):_0x447e6a['childModel']=_0x95c5('0x24');break;case _0x95c5('0x25'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x26');break;case'faxqueues':_0x447e6a['childModel']='FaxQueue';break;case'faxaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x27');break;case _0x95c5('0x28'):case _0x95c5('0x29'):case _0x95c5('0x2a'):_0x447e6a['childModel']='VoiceExtension';break;case _0x95c5('0x2b'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x2c');break;case _0x95c5('0x2d'):_0x447e6a['childModel']='VoiceMail';break;case _0x95c5('0x2e'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x2f');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x30'),'field':'name','foreignKey':_0x95c5('0x31'),'model':_0x95c5('0x32'),'filter':{'field':_0x95c5('0x33'),'value':[_0x95c5('0x34')]}},{'name':_0x95c5('0x35'),'field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x31'),'model':_0x95c5('0x32'),'filter':{'field':_0x95c5('0x33'),'value':[_0x95c5('0x36')]}},{'name':_0x95c5('0x37'),'field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x38'),'model':_0x95c5('0x39'),'filter':{'field':'type','value':[_0x95c5('0x3a')]}},{'name':'QueueCampaigns','field':_0x95c5('0xc'),'foreignKey':_0x95c5('0x38'),'model':_0x95c5('0x39'),'filter':{'field':_0x95c5('0x11'),'value':[_0x95c5('0x3b')]}}];break;case'musiconholds':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x3c');break;case _0x95c5('0x3d'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x3e');break;case _0x95c5('0x3f'):_0x447e6a[_0x95c5('0x14')]='VoicePrefix';break;case _0x95c5('0x40'):_0x447e6a[_0x95c5('0x14')]='Campaign';break;case _0x95c5('0x41'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x42');break;case'mailaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x43');break;case'mailsubstatuses':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x44');break;case _0x95c5('0x45'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x46');break;case _0x95c5('0x47'):_0x447e6a[_0x95c5('0x14')]='OpenchannelAccount';break;case _0x95c5('0x48'):_0x447e6a['childModel']=_0x95c5('0x49');break;case'smsaccounts':_0x447e6a['childModel']=_0x95c5('0x4a');break;case _0x95c5('0x4b'):_0x447e6a[_0x95c5('0x14')]='WhatsappQueue';break;case _0x95c5('0x4c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x4d');break;case _0x95c5('0x4e'):_0x447e6a[_0x95c5('0x14')]='Team';break;case'voicequeues':case'queuecampaigns':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x39');if(_0x2d11bb){_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x37')},{'name':_0x95c5('0x4f')}];}break;case _0x95c5('0x50'):case _0x95c5('0x51'):case _0x95c5('0x52'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x32');if(_0x2d11bb){_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x53'),'filter':{'field':'role','value':['admin',_0x95c5('0x54')]},'ignore':!![]},{'name':_0x95c5('0x30')},{'name':_0x95c5('0x35')}];}break;case _0x95c5('0x55'):_0x447e6a['childModel']=_0x95c5('0x56');break;case _0x95c5('0x57'):_0x447e6a['childModel']='SalesforceAccount';break;case _0x95c5('0x58'):_0x447e6a[_0x95c5('0x14')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x59');break;case _0x95c5('0x5a'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x5b');break;case _0x95c5('0x5c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x5d');break;case _0x95c5('0x5e'):_0x447e6a[_0x95c5('0x14')]='User';break;case _0x95c5('0x5f'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x60');break;case _0x95c5('0x61'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x62');break;case _0x95c5('0x63'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x64');break;case'intervals':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x65');break;case _0x95c5('0x66'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x67');break;case'scheduler':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x68');break;case'sounds':_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x69');break;case _0x95c5('0x6a'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x6b');break;case _0x95c5('0x6c'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x6d');break;case'triggers':_0x447e6a['childModel']=_0x95c5('0x6e');break;case _0x95c5('0x6f'):_0x447e6a['childModel']=_0x95c5('0x70');break;case _0x95c5('0x71'):_0x447e6a[_0x95c5('0x14')]='Variable';break;case _0x95c5('0x72'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x73');break;case _0x95c5('0x74'):_0x447e6a[_0x95c5('0x14')]=_0x95c5('0x75');_0x447e6a[_0x95c5('0x1a')]=[{'name':_0x95c5('0x76'),'field':'id','foreignKey':_0x95c5('0x77')}];break;case _0x95c5('0x78'):_0x447e6a['childModel']=_0x95c5('0x79');break;}return _0x447e6a;}function _0x1de728(_0x2fd91d,_0x169ecd){var _0x7d1c41=_0x2fd91d['charAt'](0x0)['toUpperCase']()+_0x2fd91d['slice'](0x1);var _0x259a5a={'type':_0x2c90c1['Sequelize'][_0x95c5('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x4fb009,_0x61d23d){var _0x3aafc6=squel[_0x95c5('0x7b')]()[_0x95c5('0x6')](_0x95c5('0x7c')+_0x7d1c41+_0x95c5('0x7d'),'id')['field'](_0x95c5('0x7e'))[_0x95c5('0x7f')](_0x95c5('0x80')+_0x2fd91d+_0x95c5('0x81'),'ui')[_0x95c5('0x82')](_0x95c5('0x83'),_0x169ecd['id']);return _0x2c90c1[_0x95c5('0x84')][_0x95c5('0x85')](_0x3aafc6[_0x95c5('0x86')](),_0x259a5a)[_0x95c5('0x9')](function(_0x33deee){_0x169ecd[_0x7d1c41+_0x95c5('0x87')]=_0x33deee;_0x4fb009(_0x33deee);})[_0x95c5('0xd')](function(_0x5dc69e){_0x61d23d(_0x5dc69e);});});}return _0x3c73d4[_0x95c5('0x88')](_0x95c5('0x89'),attributes,{'tableName':_0x95c5('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2d783c){var _0x17aee7={'raw':_0x2d783c[_0x95c5('0x85')][_0x95c5('0x8b')],'where':{}};var _0x1e4eba={};var _0x180bba={'count':0x0,'rows':[]};var _0x3417fc=_0x2d783c['query'][_0x95c5('0x8c')];var _0x13d008=_0x2d783c['query'][_0x95c5('0x8d')]||![];var _0xa1e9c0=_0x330ef0(_0x3417fc,_0x13d008);if(!_0xa1e9c0['childModel'])throw new Error(_0x95c5('0x8e')+_0x3417fc+'\x27');var _0xbcb3de=[{'name':_0x3417fc}];if(!_[_0x95c5('0x8f')](_0xa1e9c0['parentSections']))_0xbcb3de=_0xa1e9c0['parentSections'];var _0x4be641=[];for(var _0x5d052=0x0;_0x5d052<_0xbcb3de[_0x95c5('0x90')];_0x5d052++){_0x4be641[_0x95c5('0x91')](_0x2c90c1[_0x95c5('0x92')][_0x95c5('0x93')]({'where':{'userProfileId':_0x2d783c[_0x95c5('0x94')]['id'],'name':_0xbcb3de[_0x5d052]['name']},'raw':!![]}));}return Promise['all'](_0x4be641)['then'](function(_0x46519f){var _0x5366db=_[_0x95c5('0x5')](_0x46519f,function(_0x4ed0d0){return _0x4ed0d0?_0x4ed0d0:undefined;});var _0x3c14a4=_[_0x95c5('0x5')](_0xbcb3de,[_0x95c5('0x95'),!![]]);var _0x53ec69=_[_0x95c5('0x8f')](_0x5366db)&&_['isEmpty'](_0x3c14a4)?null:_[_0x95c5('0x96')](_0x3c14a4,_0x5366db);if(!_0x53ec69)return null;var _0x3e81d5=[];for(var _0x5da8a0=0x0;_0x5da8a0<_0x53ec69[_0x95c5('0x90')];_0x5da8a0++){var _0x4043a7=_[_0x95c5('0x93')](_0xbcb3de,function(_0x472bb3){return _0x53ec69[_0x5da8a0]?_0x472bb3['name']===_0x53ec69[_0x5da8a0]['name']:null;});if(_0x4043a7){if(_0x53ec69[_0x5da8a0][_0x95c5('0x95')]){_0x3e81d5[_0x95c5('0x91')](_0x7f2a40(_0xa1e9c0[_0x95c5('0x14')],_0x53ec69[_0x5da8a0]));}else{if(!_0x53ec69[_0x5da8a0][_0x95c5('0x97')]){_0x3e81d5[_0x95c5('0x91')](_0x214fd3(_0x4043a7,_0x53ec69[_0x5da8a0],_0xa1e9c0['childModel']));}else{if(_0x4043a7[_0x95c5('0x98')]){_0x3e81d5['push'](_0x2eb240(_0x4043a7,_0x53ec69[_0x5da8a0]));}}}}}return Promise[_0x95c5('0x99')](_0x3e81d5);})[_0x95c5('0x9')](function(_0x26d8fe){var _0x56824a=_0x26d8fe;var _0x48ecee=null;if(_0x56824a){_0x48ecee=_0x56824a[_0x95c5('0x90')]===0x1?_0x56824a[0x0]:null;}if(!_0x48ecee&&!_0x56824a)return _0x180bba;var _0x20b6dc=_0x2c90c1[_0xa1e9c0['childModel']]['rawAttributes'];_0x1e4eba[_0x95c5('0x98')]=_[_0x95c5('0x9a')](_0x20b6dc);_0x1e4eba[_0x95c5('0x85')]=_[_0x95c5('0x9a')](_0x2d783c[_0x95c5('0x85')]);_0x1e4eba[_0x95c5('0x9b')]=_[_0x95c5('0x9c')](_0x1e4eba[_0x95c5('0x98')],_0x1e4eba[_0x95c5('0x85')]);_0x17aee7[_0x95c5('0x9d')]=_[_0x95c5('0x9c')](_0x1e4eba[_0x95c5('0x98')],qs[_0x95c5('0x9e')](_0x2d783c[_0x95c5('0x85')]['fields']));_0x17aee7[_0x95c5('0x9d')]=_0x17aee7['attributes'][_0x95c5('0x90')]?_0x17aee7['attributes']:_0x1e4eba[_0x95c5('0x98')];if(!_0x2d783c[_0x95c5('0x85')]['hasOwnProperty']('nolimit')){_0x17aee7[_0x95c5('0x9f')]=qs['limit'](_0x2d783c[_0x95c5('0x85')][_0x95c5('0x9f')]);_0x17aee7['offset']=qs[_0x95c5('0xa0')](_0x2d783c[_0x95c5('0x85')][_0x95c5('0xa0')]);}_0x17aee7[_0x95c5('0xa1')]=qs[_0x95c5('0xa2')](_0x2d783c['query'][_0x95c5('0xa2')]);_0x17aee7[_0x95c5('0x82')]=qs['filters'](_[_0x95c5('0xa3')](_0x2d783c[_0x95c5('0x85')],_0x1e4eba['filters']));if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0x5')]){_0x17aee7[_0x95c5('0x82')]=_[_0x95c5('0xa4')](_0x17aee7[_0x95c5('0x82')],{'$or':_[_0x95c5('0xb')](_0x20b6dc,function(_0x258949){if(_0x258949[_0x95c5('0x11')]['key']!==_0x95c5('0xa5')){var _0xb25e9f={};_0xb25e9f[_0x258949[_0x95c5('0x6')]]={'$like':'%'+_0x2d783c[_0x95c5('0x85')][_0x95c5('0x5')]+'%'};return _0xb25e9f;}})});}var _0x191673=[];var _0x99b051=null;var _0x5aeac2={};if(_0x48ecee){_0x99b051=_[_0x95c5('0x93')](_0xbcb3de,['name',_0x48ecee[_0x95c5('0xc')]]);if(_0x99b051['field']){_0x5aeac2={};if(_0xa1e9c0[_0x95c5('0x14')]==='AnalyticExtractedReport'){_0x5aeac2[_0x99b051[_0x95c5('0xa6')]]=_[_0x95c5('0xb')](_0x48ecee[_0x95c5('0xa')],'id');}else{_0x5aeac2[_0x99b051[_0x95c5('0xa6')]]=_0x48ecee[_0x95c5('0xa')];}_0x191673[_0x95c5('0x91')](_0x5aeac2);}else{_0x17aee7['where']['id']=_0x48ecee['associatedResources'];}}else{for(var _0x56a98d=0x0;_0x56a98d<_0x56824a[_0x95c5('0x90')];_0x56a98d++){_0x99b051=_[_0x95c5('0x93')](_0xbcb3de,[_0x95c5('0xc'),_0x56824a[_0x56a98d][_0x95c5('0xc')]]);if(_0x99b051[_0x95c5('0x6')]){_0x5aeac2={};_0x5aeac2[_0x99b051['foreignKey']]=_0x56824a[_0x56a98d]['associatedResources'];_0x191673[_0x95c5('0x91')](_0x5aeac2);}else{if(!_0x17aee7[_0x95c5('0x82')]['id'])_0x17aee7[_0x95c5('0x82')]['id']=[];_0x56824a[_0x56a98d]['associatedResources']['forEach'](function(_0x427d59){_0x17aee7['where']['id'][_0x95c5('0x91')](_0x427d59);});}}}if(!_[_0x95c5('0x8f')](_0x191673)){_0x17aee7[_0x95c5('0x82')]=_[_0x95c5('0xa4')](_0x17aee7['where'],{'$and':{'$or':_0x191673}});}_0x17aee7=_['merge']({},_0x17aee7,_0x2d783c[_0x95c5('0xa7')]);if(_0x48ecee&&!_0x48ecee[_0x95c5('0x97')]&&_0xa1e9c0[_0x95c5('0x14')]===_0x95c5('0x75')){if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0xa8')]){_0x17aee7[_0x95c5('0xa9')]=[{'all':!![]}];}return _0x2c90c1[_0xa1e9c0[_0x95c5('0x14')]][_0x95c5('0x8')](_0x17aee7)[_0x95c5('0x9')](function(_0x4b4a57){var _0x248150=[];_0x4b4a57['forEach'](function(_0x3bceaa){var _0x37ddda;switch(_0x3bceaa[_0x95c5('0xaa')]){case _0x95c5('0xab'):_0x37ddda=_[_0x95c5('0x93')](_0x48ecee[_0x95c5('0xa')],function(_0x562c28){return _0x562c28['id']===_0x3bceaa[_0x95c5('0x77')]&&_0x562c28[_0x95c5('0x11')]===_0x95c5('0xac');});break;case _0x95c5('0xad'):_0x37ddda=_[_0x95c5('0x93')](_0x48ecee['associatedResources'],function(_0x13b918){return _0x13b918['id']===_0x3bceaa['reportId']&&_0x13b918[_0x95c5('0x11')]===_0x95c5('0xae');});break;}if(_0x37ddda)_0x248150[_0x95c5('0x91')](_0x3bceaa);});_0x180bba[_0x95c5('0xaf')]=_0x248150[_0x95c5('0x90')];_0x180bba[_0x95c5('0xb0')]=_0x248150;return _0x180bba;});}else{if(!_[_0x95c5('0x8f')](_0x2d783c[_0x95c5('0x85')]['ids'])){_0x17aee7[_0x95c5('0x82')]['id']=_0x17aee7[_0x95c5('0x82')]['id']?_[_0x95c5('0x9c')](_0x17aee7[_0x95c5('0x82')]['id'],_0x2d783c['query'][_0x95c5('0xb1')]):_0x2d783c['query'][_0x95c5('0xb1')];if(_0x2d783c[_0x95c5('0x85')]['customSorting']){_0x17aee7[_0x95c5('0xa1')]=_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb2')];}}if(_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb3')]){_0x17aee7['where']=_[_0x95c5('0xa4')](_0x17aee7['where'],{'$and':_0x2d783c['query'][_0x95c5('0xb3')]});}return _0x2c90c1[_0xa1e9c0[_0x95c5('0x14')]][_0x95c5('0xaf')]({'where':_0x17aee7[_0x95c5('0x82')]})['then'](function(_0x572900){_0x180bba[_0x95c5('0xaf')]=_0x572900;if(_0x2d783c[_0x95c5('0x85')]['includeAll']){if(_0xa1e9c0[_0x95c5('0x14')]==='CmContact'){_0x17aee7[_0x95c5('0xa9')]=[{'model':_0x2c90c1[_0x95c5('0x6b')],'as':_0x95c5('0xb4'),'attributes':['id',_0x95c5('0xc'),_0x95c5('0xb5')],'required':_0x2d783c['query']['tag']?!![]:![]},{'model':_0x2c90c1[_0x95c5('0x6b')],'as':'ThroughTags','attributes':['id','name',_0x95c5('0xb5')],'through':_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb6')]?{'attributes':[],'where':{'TagId':_0x2d783c[_0x95c5('0x85')][_0x95c5('0xb6')]||undefined}}:{},'required':_0x2d783c['query']['tag']?!![]:![]}];}else{_0x17aee7[_0x95c5('0xa9')]=[{'all':!![]}];}}return _0x2c90c1[_0xa1e9c0['childModel']][_0x95c5('0x8')](_0x17aee7);})['then'](function(_0x199efa){_0x180bba[_0x95c5('0xb0')]=_0x199efa;if(_0x3417fc===_0x95c5('0x30')&&_0x2d783c[_0x95c5('0x85')]['openTabs']===_0x95c5('0xb7')){var _0x374aee=[];for(var _0x9ec37b=0x0;_0x9ec37b<_0x180bba['rows'][_0x95c5('0x90')];_0x9ec37b++){_0x374aee[_0x95c5('0x91')](_0x1de728('chat',_0x180bba['rows'][_0x9ec37b]['dataValues']));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xb8'),_0x180bba[_0x95c5('0xb0')][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xba'),_0x180bba['rows'][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xbb'),_0x180bba['rows'][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee['push'](_0x1de728('openchannel',_0x180bba[_0x95c5('0xb0')][_0x9ec37b][_0x95c5('0xb9')]));_0x374aee[_0x95c5('0x91')](_0x1de728(_0x95c5('0xbc'),_0x180bba[_0x95c5('0xb0')][_0x9ec37b]['dataValues']));}return Promise['all'](_0x374aee)['then'](function(){return _0x180bba;});}return _0x180bba;});}});}}});}; \ No newline at end of file +var _0xa0b6=['FaxAccount','inboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailAccount','MailSubstatus','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','variables','plugins','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','params','all','ignore','union','find','push','autoAssociation','rawAttributes','keys','filters','model','intersection','fields','attributes','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','CmContact','Tags','color','tag','ThroughTags','true','chat','sms','fax','dataValues','lodash','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','map','catch','name','UserProfileResource','AnalyticExtractedReport','type','resourceId','SquareProject','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts'];(function(_0x19c371,_0x17de87){var _0x55f9c8=function(_0x1f3d6b){while(--_0x1f3d6b){_0x19c371['push'](_0x19c371['shift']());}};_0x55f9c8(++_0x17de87);}(_0xa0b6,0x93));var _0x6a0b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xa0b6[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x6a0b('0x0'));var attributes=require(_0x6a0b('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x6a0b('0x2'));module['exports']=function(_0x553d10){var _0x3c38aa=_0x553d10[_0x6a0b('0x3')];function _0x31e7ae(_0x449b92,_0x18d4dd){return new Promise(function(_0x5472bf,_0x322bda){if(!_0x18d4dd)return _0x5472bf(null);var _0x155ac8=_0x18d4dd[_0x6a0b('0x4')]?{[_0x18d4dd[_0x6a0b('0x4')][_0x6a0b('0x5')]]:_0x18d4dd[_0x6a0b('0x4')][_0x6a0b('0x6')]}:undefined;return _0x3c38aa[_0x449b92][_0x6a0b('0x7')]({'where':_0x155ac8,'raw':!![]})[_0x6a0b('0x8')](function(_0x58d5ec){_0x18d4dd[_0x6a0b('0x9')]=_[_0x6a0b('0xa')](_0x58d5ec,'id');_0x5472bf(_0x18d4dd);})[_0x6a0b('0xb')](function(_0x5a0fc7){_0x322bda(_0x5a0fc7);});});}function _0x22d318(_0x5c4c89,_0xb3ae61){return new Promise(function(_0x56b952,_0x50ebf5){var _0x1d25b0=_0x5c4c89[_0x6a0b('0x4')]?{[_0x5c4c89[_0x6a0b('0x4')]['field']]:_0x5c4c89[_0x6a0b('0x4')]['value']}:undefined;return _0x3c38aa[_0x5c4c89['model']]['findAll']({'where':_0x1d25b0,'raw':!![]})[_0x6a0b('0x8')](function(_0x5e2bd7){_0xb3ae61['associatedResources']=_['map'](_0x5e2bd7,function(_0x4d1bf3){return _0x4d1bf3[_0x6a0b('0xc')];});_0x56b952(_0xb3ae61);})[_0x6a0b('0xb')](function(_0x2d8178){_0x50ebf5(_0x2d8178);});});}function _0x256afa(_0x58e79e,_0x48f595,_0x1abd50){if(!_0x48f595)return Promise['resolve'](null);return new Promise(function(_0x3bf776,_0x773654){return _0x3c38aa[_0x6a0b('0xd')][_0x6a0b('0x7')]({'where':{'sectionId':_0x48f595['id']},'raw':!![]})[_0x6a0b('0x8')](function(_0x354774){if(_0x58e79e[_0x6a0b('0x5')]&&_0x58e79e[_0x6a0b('0x5')]!=='id'){_0x48f595[_0x6a0b('0x9')]=_[_0x6a0b('0xa')](_0x354774,function(_0x41086d){return _0x41086d[_0x58e79e[_0x6a0b('0x5')]];});}else{if(_0x1abd50===_0x6a0b('0xe')){_0x48f595[_0x6a0b('0x9')]=_[_0x6a0b('0xa')](_0x354774,function(_0x249154){return{'id':_0x249154['resourceId'],'type':_0x249154[_0x6a0b('0xf')]};});}else{_0x48f595[_0x6a0b('0x9')]=_[_0x6a0b('0xa')](_0x354774,function(_0x509c0e){return _0x509c0e[_0x6a0b('0x10')];});}}_0x3bf776(_0x48f595);})[_0x6a0b('0xb')](function(_0x52f45c){_0x773654(_0x52f45c);});});}function _0x1b5ad0(_0x1996ba,_0x2037a1){var _0x4dbdcd={'parentSections':[]};switch(_0x1996ba['toLowerCase']()){case'squareprojects':_0x4dbdcd['childModel']=_0x6a0b('0x11');break;case'odbc':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x13');break;case _0x6a0b('0x14'):_0x4dbdcd['childModel']=_0x6a0b('0x15');_0x4dbdcd[_0x6a0b('0x16')]=[{'name':_0x6a0b('0x17'),'field':'name','foreignKey':_0x6a0b('0x18')}];break;case _0x6a0b('0x19'):_0x4dbdcd['childModel']=_0x6a0b('0x1a');break;case _0x6a0b('0x1b'):_0x4dbdcd[_0x6a0b('0x12')]='CmContact';_0x4dbdcd[_0x6a0b('0x16')]=[{'name':_0x6a0b('0x1c'),'field':'id','foreignKey':_0x6a0b('0x1d')}];break;case _0x6a0b('0x1e'):_0x4dbdcd['childModel']=_0x6a0b('0x1f');break;case _0x6a0b('0x20'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x21');break;case'globalcustomfields':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x22');break;case'chatqueues':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x23');break;case _0x6a0b('0x24'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x25');break;case _0x6a0b('0x26'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x27');break;case _0x6a0b('0x28'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x29');break;case _0x6a0b('0x2a'):case'internalroutes':case'outboundroutes':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x2b');break;case'contexts':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x2c');break;case'voicemails':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x2d');break;case _0x6a0b('0x2e'):_0x4dbdcd['childModel']=_0x6a0b('0x2f');_0x4dbdcd['parentSections']=[{'name':_0x6a0b('0x30'),'field':'name','foreignKey':_0x6a0b('0x31'),'model':_0x6a0b('0x32'),'filter':{'field':_0x6a0b('0x33'),'value':[_0x6a0b('0x34')]}},{'name':_0x6a0b('0x35'),'field':_0x6a0b('0xc'),'foreignKey':'membername','model':'User','filter':{'field':_0x6a0b('0x33'),'value':[_0x6a0b('0x36')]}},{'name':_0x6a0b('0x37'),'field':_0x6a0b('0xc'),'foreignKey':_0x6a0b('0x38'),'model':_0x6a0b('0x39'),'filter':{'field':_0x6a0b('0xf'),'value':[_0x6a0b('0x3a')]}},{'name':_0x6a0b('0x3b'),'field':'name','foreignKey':_0x6a0b('0x38'),'model':_0x6a0b('0x39'),'filter':{'field':_0x6a0b('0xf'),'value':[_0x6a0b('0x3c')]}}];break;case _0x6a0b('0x3d'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x3e');break;case _0x6a0b('0x3f'):_0x4dbdcd['childModel']=_0x6a0b('0x40');break;case'voiceprefixes':_0x4dbdcd['childModel']=_0x6a0b('0x41');break;case _0x6a0b('0x42'):_0x4dbdcd['childModel']=_0x6a0b('0x43');break;case'mailqueues':_0x4dbdcd['childModel']='MailQueue';break;case'mailaccounts':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x44');break;case'mailsubstatuses':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x45');break;case'openchannelqueues':_0x4dbdcd[_0x6a0b('0x12')]='OpenchannelQueue';break;case'openchannelaccounts':_0x4dbdcd['childModel']=_0x6a0b('0x46');break;case'smsqueues':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x47');break;case _0x6a0b('0x48'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x49');break;case _0x6a0b('0x4a'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x4b');break;case _0x6a0b('0x4c'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x4d');break;case'teams':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x4e');break;case _0x6a0b('0x4f'):case _0x6a0b('0x50'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x39');if(_0x2037a1){_0x4dbdcd[_0x6a0b('0x16')]=[{'name':_0x6a0b('0x37')},{'name':_0x6a0b('0x3b')}];}break;case _0x6a0b('0x51'):case _0x6a0b('0x52'):case _0x6a0b('0x53'):_0x4dbdcd['childModel']=_0x6a0b('0x32');if(_0x2037a1){_0x4dbdcd[_0x6a0b('0x16')]=[{'name':_0x6a0b('0x54'),'filter':{'field':'role','value':['admin',_0x6a0b('0x55')]},'ignore':!![]},{'name':_0x6a0b('0x30')},{'name':_0x6a0b('0x35')}];}break;case _0x6a0b('0x56'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x57');break;case'salesforceaccounts':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x58');break;case _0x6a0b('0x59'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x5a');break;case _0x6a0b('0x5b'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x5c');break;case _0x6a0b('0x5d'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x5e');break;case _0x6a0b('0x5f'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x60');break;case _0x6a0b('0x61'):_0x4dbdcd['childModel']=_0x6a0b('0x32');break;case _0x6a0b('0x62'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x63');break;case _0x6a0b('0x64'):_0x4dbdcd[_0x6a0b('0x12')]='Disposition';break;case'customdashboards':_0x4dbdcd['childModel']='Dashboard';break;case _0x6a0b('0x65'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x66');break;case _0x6a0b('0x67'):_0x4dbdcd['childModel']=_0x6a0b('0x68');break;case _0x6a0b('0x69'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x6a');break;case _0x6a0b('0x6b'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x6c');break;case _0x6a0b('0x6d'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x6e');break;case'templates':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x6f');break;case _0x6a0b('0x70'):_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0x71');break;case _0x6a0b('0x72'):_0x4dbdcd[_0x6a0b('0x12')]='Trunk';break;case _0x6a0b('0x73'):_0x4dbdcd['childModel']='Variable';break;case _0x6a0b('0x74'):_0x4dbdcd[_0x6a0b('0x12')]='Plugin';break;case'extractedreports':_0x4dbdcd[_0x6a0b('0x12')]=_0x6a0b('0xe');_0x4dbdcd['parentSections']=[{'name':_0x6a0b('0x75'),'field':'id','foreignKey':_0x6a0b('0x76')}];break;case _0x6a0b('0x77'):_0x4dbdcd['childModel']=_0x6a0b('0x78');break;}return _0x4dbdcd;}function _0x2ff679(_0x282dfd,_0x437457){var _0x58800c=_0x282dfd[_0x6a0b('0x79')](0x0)[_0x6a0b('0x7a')]()+_0x282dfd['slice'](0x1);var _0x3512c8={'type':_0x3c38aa[_0x6a0b('0x7b')]['QueryTypes'][_0x6a0b('0x7c')],'raw':!![]};return new Promise(function(_0x3aa1f5,_0x40c142){var _0x55d3f6=squel['select']()[_0x6a0b('0x5')](_0x6a0b('0x7d')+_0x58800c+_0x6a0b('0x7e'),'id')[_0x6a0b('0x5')](_0x6a0b('0x7f'))[_0x6a0b('0x80')](_0x6a0b('0x81')+_0x282dfd+'_interactions','ui')[_0x6a0b('0x82')](_0x6a0b('0x83'),_0x437457['id']);return _0x3c38aa[_0x6a0b('0x84')][_0x6a0b('0x85')](_0x55d3f6['toString'](),_0x3512c8)[_0x6a0b('0x8')](function(_0xd97e43){_0x437457[_0x58800c+_0x6a0b('0x86')]=_0xd97e43;_0x3aa1f5(_0xd97e43);})['catch'](function(_0x3c02e2){_0x40c142(_0x3c02e2);});});}return _0x553d10[_0x6a0b('0x87')](_0x6a0b('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x257938){var _0xc5c34c={'raw':_0x257938[_0x6a0b('0x85')]['raw'],'where':{}};var _0x3c8503={};var _0x358704={'count':0x0,'rows':[]};var _0xbd8a81=_0x257938[_0x6a0b('0x85')][_0x6a0b('0x89')];var _0x34b07d=_0x257938[_0x6a0b('0x85')][_0x6a0b('0x8a')]||![];var _0x23b2bf=_0x1b5ad0(_0xbd8a81,_0x34b07d);if(!_0x23b2bf['childModel'])throw new Error(_0x6a0b('0x8b')+_0xbd8a81+'\x27');var _0x496377=[{'name':_0xbd8a81}];if(!_[_0x6a0b('0x8c')](_0x23b2bf[_0x6a0b('0x16')]))_0x496377=_0x23b2bf['parentSections'];var _0x8998c0=[];for(var _0x1b80b4=0x0;_0x1b80b4<_0x496377[_0x6a0b('0x8d')];_0x1b80b4++){_0x8998c0['push'](_0x3c38aa[_0x6a0b('0x8e')]['find']({'where':{'userProfileId':_0x257938[_0x6a0b('0x8f')]['id'],'name':_0x496377[_0x1b80b4][_0x6a0b('0xc')]},'raw':!![]}));}return Promise[_0x6a0b('0x90')](_0x8998c0)[_0x6a0b('0x8')](function(_0x58b3dd){var _0x2bdbf4=_[_0x6a0b('0x4')](_0x58b3dd,function(_0x272b28){return _0x272b28?_0x272b28:undefined;});var _0x88a8a7=_[_0x6a0b('0x4')](_0x496377,[_0x6a0b('0x91'),!![]]);var _0x271e99=_['isEmpty'](_0x2bdbf4)&&_['isEmpty'](_0x88a8a7)?null:_[_0x6a0b('0x92')](_0x88a8a7,_0x2bdbf4);if(!_0x271e99)return null;var _0x37c5f8=[];for(var _0x4d4c22=0x0;_0x4d4c22<_0x271e99[_0x6a0b('0x8d')];_0x4d4c22++){var _0x594936=_[_0x6a0b('0x93')](_0x496377,function(_0x232fa8){return _0x271e99[_0x4d4c22]?_0x232fa8['name']===_0x271e99[_0x4d4c22][_0x6a0b('0xc')]:null;});if(_0x594936){if(_0x271e99[_0x4d4c22][_0x6a0b('0x91')]){_0x37c5f8[_0x6a0b('0x94')](_0x31e7ae(_0x23b2bf['childModel'],_0x271e99[_0x4d4c22]));}else{if(!_0x271e99[_0x4d4c22][_0x6a0b('0x95')]){_0x37c5f8[_0x6a0b('0x94')](_0x256afa(_0x594936,_0x271e99[_0x4d4c22],_0x23b2bf[_0x6a0b('0x12')]));}else{if(_0x594936['model']){_0x37c5f8[_0x6a0b('0x94')](_0x22d318(_0x594936,_0x271e99[_0x4d4c22]));}}}}}return Promise['all'](_0x37c5f8);})[_0x6a0b('0x8')](function(_0x340ae5){var _0x495d4d=_0x340ae5;var _0x34ac15=null;if(_0x495d4d){_0x34ac15=_0x495d4d['length']===0x1?_0x495d4d[0x0]:null;}if(!_0x34ac15&&!_0x495d4d)return _0x358704;var _0x3203de=_0x3c38aa[_0x23b2bf[_0x6a0b('0x12')]][_0x6a0b('0x96')];_0x3c8503['model']=_[_0x6a0b('0x97')](_0x3203de);_0x3c8503[_0x6a0b('0x85')]=_[_0x6a0b('0x97')](_0x257938['query']);_0x3c8503[_0x6a0b('0x98')]=_['intersection'](_0x3c8503[_0x6a0b('0x99')],_0x3c8503[_0x6a0b('0x85')]);_0xc5c34c['attributes']=_[_0x6a0b('0x9a')](_0x3c8503['model'],qs['fields'](_0x257938[_0x6a0b('0x85')][_0x6a0b('0x9b')]));_0xc5c34c[_0x6a0b('0x9c')]=_0xc5c34c[_0x6a0b('0x9c')][_0x6a0b('0x8d')]?_0xc5c34c[_0x6a0b('0x9c')]:_0x3c8503[_0x6a0b('0x99')];if(!_0x257938['query']['hasOwnProperty']('nolimit')){_0xc5c34c[_0x6a0b('0x9d')]=qs[_0x6a0b('0x9d')](_0x257938[_0x6a0b('0x85')][_0x6a0b('0x9d')]);_0xc5c34c[_0x6a0b('0x9e')]=qs[_0x6a0b('0x9e')](_0x257938['query']['offset']);}_0xc5c34c[_0x6a0b('0x9f')]=qs[_0x6a0b('0xa0')](_0x257938[_0x6a0b('0x85')][_0x6a0b('0xa0')]);_0xc5c34c[_0x6a0b('0x82')]=qs[_0x6a0b('0x98')](_[_0x6a0b('0xa1')](_0x257938[_0x6a0b('0x85')],_0x3c8503['filters']));if(_0x257938[_0x6a0b('0x85')][_0x6a0b('0x4')]){_0xc5c34c[_0x6a0b('0x82')]=_[_0x6a0b('0xa2')](_0xc5c34c[_0x6a0b('0x82')],{'$or':_[_0x6a0b('0xa')](_0x3203de,function(_0x5ee77f){if(_0x5ee77f[_0x6a0b('0xf')][_0x6a0b('0xa3')]!==_0x6a0b('0xa4')){var _0x1b3eaa={};_0x1b3eaa[_0x5ee77f[_0x6a0b('0x5')]]={'$like':'%'+_0x257938[_0x6a0b('0x85')][_0x6a0b('0x4')]+'%'};return _0x1b3eaa;}})});}var _0x31d434=[];var _0x59b2fb=null;var _0x193624={};if(_0x34ac15){_0x59b2fb=_[_0x6a0b('0x93')](_0x496377,[_0x6a0b('0xc'),_0x34ac15[_0x6a0b('0xc')]]);if(_0x59b2fb[_0x6a0b('0x5')]){_0x193624={};if(_0x23b2bf[_0x6a0b('0x12')]===_0x6a0b('0xe')){_0x193624[_0x59b2fb[_0x6a0b('0xa5')]]=_['map'](_0x34ac15[_0x6a0b('0x9')],'id');}else{_0x193624[_0x59b2fb[_0x6a0b('0xa5')]]=_0x34ac15[_0x6a0b('0x9')];}_0x31d434[_0x6a0b('0x94')](_0x193624);}else{_0xc5c34c['where']['id']=_0x34ac15['associatedResources'];}}else{for(var _0x4e8e84=0x0;_0x4e8e84<_0x495d4d['length'];_0x4e8e84++){_0x59b2fb=_[_0x6a0b('0x93')](_0x496377,['name',_0x495d4d[_0x4e8e84][_0x6a0b('0xc')]]);if(_0x59b2fb[_0x6a0b('0x5')]){_0x193624={};_0x193624[_0x59b2fb[_0x6a0b('0xa5')]]=_0x495d4d[_0x4e8e84]['associatedResources'];_0x31d434[_0x6a0b('0x94')](_0x193624);}else{if(!_0xc5c34c['where']['id'])_0xc5c34c[_0x6a0b('0x82')]['id']=[];_0x495d4d[_0x4e8e84][_0x6a0b('0x9')][_0x6a0b('0xa6')](function(_0xde3d42){_0xc5c34c[_0x6a0b('0x82')]['id'][_0x6a0b('0x94')](_0xde3d42);});}}}if(!_[_0x6a0b('0x8c')](_0x31d434)){_0xc5c34c[_0x6a0b('0x82')]=_[_0x6a0b('0xa2')](_0xc5c34c['where'],{'$and':{'$or':_0x31d434}});}_0xc5c34c=_[_0x6a0b('0xa2')]({},_0xc5c34c,_0x257938['options']);if(_0x34ac15&&!_0x34ac15[_0x6a0b('0x95')]&&_0x23b2bf['childModel']===_0x6a0b('0xe')){if(_0x257938[_0x6a0b('0x85')][_0x6a0b('0xa7')]){_0xc5c34c[_0x6a0b('0xa8')]=[{'all':!![]}];}return _0x3c38aa[_0x23b2bf[_0x6a0b('0x12')]]['findAll'](_0xc5c34c)[_0x6a0b('0x8')](function(_0x5c74a8){var _0x417d3c=[];_0x5c74a8[_0x6a0b('0xa6')](function(_0x4f8f23){var _0x4b04a5;switch(_0x4f8f23[_0x6a0b('0xa9')]){case _0x6a0b('0xaa'):_0x4b04a5=_[_0x6a0b('0x93')](_0x34ac15[_0x6a0b('0x9')],function(_0x293537){return _0x293537['id']===_0x4f8f23['reportId']&&_0x293537[_0x6a0b('0xf')]==='DefaultReports';});break;case _0x6a0b('0xab'):_0x4b04a5=_[_0x6a0b('0x93')](_0x34ac15[_0x6a0b('0x9')],function(_0x13779b){return _0x13779b['id']===_0x4f8f23['reportId']&&_0x13779b['type']===_0x6a0b('0xac');});break;}if(_0x4b04a5)_0x417d3c[_0x6a0b('0x94')](_0x4f8f23);});_0x358704[_0x6a0b('0xad')]=_0x417d3c[_0x6a0b('0x8d')];_0x358704[_0x6a0b('0xae')]=_0x417d3c;return _0x358704;});}else{if(!_['isEmpty'](_0x257938['query']['ids'])){_0xc5c34c[_0x6a0b('0x82')]['id']=_0xc5c34c[_0x6a0b('0x82')]['id']?_[_0x6a0b('0x9a')](_0xc5c34c[_0x6a0b('0x82')]['id'],_0x257938[_0x6a0b('0x85')][_0x6a0b('0xaf')]):_0x257938[_0x6a0b('0x85')][_0x6a0b('0xaf')];if(_0x257938['query'][_0x6a0b('0xb0')]){_0xc5c34c[_0x6a0b('0x9f')]=_0x257938['query']['customSorting'];}}if(_0x257938['query'][_0x6a0b('0xb1')]){_0xc5c34c[_0x6a0b('0x82')]=_[_0x6a0b('0xa2')](_0xc5c34c[_0x6a0b('0x82')],{'$and':_0x257938['query']['extraQueryConditions']});}return _0x3c38aa[_0x23b2bf[_0x6a0b('0x12')]][_0x6a0b('0xad')]({'where':_0xc5c34c['where']})[_0x6a0b('0x8')](function(_0x2dc75b){_0x358704[_0x6a0b('0xad')]=_0x2dc75b;if(_0x257938['query'][_0x6a0b('0xa7')]){if(_0x23b2bf[_0x6a0b('0x12')]===_0x6a0b('0xb2')){_0xc5c34c[_0x6a0b('0xa8')]=[{'model':_0x3c38aa[_0x6a0b('0x6e')],'as':_0x6a0b('0xb3'),'attributes':['id','name',_0x6a0b('0xb4')],'required':_0x257938[_0x6a0b('0x85')][_0x6a0b('0xb5')]?!![]:![]},{'model':_0x3c38aa[_0x6a0b('0x6e')],'as':_0x6a0b('0xb6'),'attributes':['id',_0x6a0b('0xc'),_0x6a0b('0xb4')],'through':_0x257938[_0x6a0b('0x85')][_0x6a0b('0xb5')]?{'attributes':[],'where':{'TagId':_0x257938[_0x6a0b('0x85')][_0x6a0b('0xb5')]||undefined}}:{},'required':_0x257938[_0x6a0b('0x85')][_0x6a0b('0xb5')]?!![]:![]}];}else{_0xc5c34c[_0x6a0b('0xa8')]=[{'all':!![]}];}}return _0x3c38aa[_0x23b2bf[_0x6a0b('0x12')]][_0x6a0b('0x7')](_0xc5c34c);})['then'](function(_0x47415b){_0x358704[_0x6a0b('0xae')]=_0x47415b;if(_0xbd8a81===_0x6a0b('0x30')&&_0x257938[_0x6a0b('0x85')]['openTabs']===_0x6a0b('0xb7')){var _0x10ac50=[];for(var _0x881b95=0x0;_0x881b95<_0x358704[_0x6a0b('0xae')][_0x6a0b('0x8d')];_0x881b95++){_0x10ac50[_0x6a0b('0x94')](_0x2ff679(_0x6a0b('0xb8'),_0x358704[_0x6a0b('0xae')][_0x881b95]['dataValues']));_0x10ac50[_0x6a0b('0x94')](_0x2ff679(_0x6a0b('0xb9'),_0x358704[_0x6a0b('0xae')][_0x881b95]['dataValues']));_0x10ac50[_0x6a0b('0x94')](_0x2ff679(_0x6a0b('0xba'),_0x358704[_0x6a0b('0xae')][_0x881b95][_0x6a0b('0xbb')]));_0x10ac50[_0x6a0b('0x94')](_0x2ff679('mail',_0x358704[_0x6a0b('0xae')][_0x881b95][_0x6a0b('0xbb')]));_0x10ac50[_0x6a0b('0x94')](_0x2ff679('openchannel',_0x358704[_0x6a0b('0xae')][_0x881b95][_0x6a0b('0xbb')]));_0x10ac50['push'](_0x2ff679('whatsapp',_0x358704[_0x6a0b('0xae')][_0x881b95][_0x6a0b('0xbb')]));}return Promise['all'](_0x10ac50)[_0x6a0b('0x8')](function(){return _0x358704;});}return _0x358704;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 039ba93..87e3495 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 _0xfcf0=['UserProfile,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x34f499,_0xd8ff6e){var _0x2be65b=function(_0x238916){while(--_0x238916){_0x34f499['push'](_0x34f499['shift']());}};_0x2be65b(++_0xd8ff6e);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2af29a,_0x4f44bc){_0x2af29a=_0x2af29a-0x0;var _0x5ef02f=_0xfcf0[_0x2af29a];return _0x5ef02f;};'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});config[_0x0fcf('0xc')]=_[_0x0fcf('0xd')](config['redis'],{'host':_0x0fcf('0xe'),'port':0x18eb});var socket=require(_0x0fcf('0xf'))(new Redis(config[_0x0fcf('0xc')]));require('./userProfile.socket')[_0x0fcf('0x10')](socket);function respondWithRpcPromise(_0x7ac7bd,_0x239e5d,_0x4b3923){return new BPromise(function(_0x369959,_0x5c29ed){return client[_0x0fcf('0x11')](_0x7ac7bd,_0x4b3923)[_0x0fcf('0x12')](function(_0x201a58){logger['info']('UserProfile,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'));logger[_0x0fcf('0x14')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'),JSON[_0x0fcf('0x15')](_0x201a58));if(_0x201a58[_0x0fcf('0x16')]){if(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x17')]===0x1f4){logger['error'](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);return _0x5c29ed(_0x201a58['error'][_0x0fcf('0x19')]);}logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')]['message']);return _0x369959(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);}else{logger[_0x0fcf('0x1a')](_0x0fcf('0x18'),_0x239e5d,_0x0fcf('0x13'));_0x369959(_0x201a58['result'][_0x0fcf('0x19')]);}})[_0x0fcf('0x1b')](function(_0x5dad87){logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x5dad87);_0x5c29ed(_0x5dad87);});});} \ No newline at end of file +var _0x3e94=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ad17f,_0x421e9b){var _0x2ac35c=function(_0x858037){while(--_0x858037){_0x4ad17f['push'](_0x4ad17f['shift']());}};_0x2ac35c(++_0x421e9b);}(_0x3e94,0x67));var _0x43e9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3e94[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});config['redis']=_[_0x43e9('0xa')](config[_0x43e9('0xb')],{'host':_0x43e9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43e9('0xb')]));require(_0x43e9('0xd'))[_0x43e9('0xe')](socket);function respondWithRpcPromise(_0x208244,_0x3d2694,_0x169e98){return new BPromise(function(_0x437e1d,_0x3c3ee3){return client[_0x43e9('0xf')](_0x208244,_0x169e98)['then'](function(_0x367956){logger[_0x43e9('0x10')](_0x43e9('0x11'),_0x3d2694,'request\x20sent');logger[_0x43e9('0x12')](_0x43e9('0x13'),_0x3d2694,_0x43e9('0x14'),JSON[_0x43e9('0x15')](_0x367956));if(_0x367956[_0x43e9('0x16')]){if(_0x367956['error']['code']===0x1f4){logger[_0x43e9('0x16')]('UserProfile,\x20%s,\x20%s',_0x3d2694,_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);return _0x3c3ee3(_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);}logger[_0x43e9('0x16')](_0x43e9('0x11'),_0x3d2694,_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);return _0x437e1d(_0x367956[_0x43e9('0x16')][_0x43e9('0x17')]);}else{logger[_0x43e9('0x10')](_0x43e9('0x11'),_0x3d2694,_0x43e9('0x14'));_0x437e1d(_0x367956[_0x43e9('0x18')]['message']);}})['catch'](function(_0x38b426){logger[_0x43e9('0x16')](_0x43e9('0x11'),_0x3d2694,_0x38b426);_0x3c3ee3(_0x38b426);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 256f742..749acbb 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 _0xc862=['./userProfile.events','save','update','register','length','userProfile:'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0xc862,0x16e));var _0x2c86=function(_0x4a1664,_0x1b408b){_0x4a1664=_0x4a1664-0x0;var _0x502b3f=_0xc862[_0x4a1664];return _0x502b3f;};'use strict';var UserProfileEvents=require(_0x2c86('0x0'));var events=[_0x2c86('0x1'),'remove',_0x2c86('0x2')];function createListener(_0x2241ef,_0x2cece4){return function(_0x3fc4df){_0x2cece4['emit'](_0x2241ef,_0x3fc4df);};}function removeListener(_0x3d1ffb,_0x3639c1){return function(){UserProfileEvents['removeListener'](_0x3d1ffb,_0x3639c1);};}exports[_0x2c86('0x3')]=function(_0x5a1773){for(var _0x44434e=0x0,_0x75dafc=events[_0x2c86('0x4')];_0x44434e<_0x75dafc;_0x44434e++){var _0x588748=events[_0x44434e];var _0x33ae91=createListener(_0x2c86('0x5')+_0x588748,_0x5a1773);UserProfileEvents['on'](_0x588748,_0x33ae91);}}; \ No newline at end of file +var _0x62cc=['./userProfile.events','save','remove','emit','removeListener','register','userProfile:'];(function(_0x29774f,_0x15110e){var _0x45f2bf=function(_0x16e631){while(--_0x16e631){_0x29774f['push'](_0x29774f['shift']());}};_0x45f2bf(++_0x15110e);}(_0x62cc,0x69));var _0xc62c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62cc[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require(_0xc62c('0x0'));var events=[_0xc62c('0x1'),_0xc62c('0x2'),'update'];function createListener(_0x3baf75,_0x4625af){return function(_0x494558){_0x4625af[_0xc62c('0x3')](_0x3baf75,_0x494558);};}function removeListener(_0x1274bb,_0x29171d){return function(){UserProfileEvents[_0xc62c('0x4')](_0x1274bb,_0x29171d);};}exports[_0xc62c('0x5')]=function(_0x33de5a){for(var _0x2588f4=0x0,_0x44292c=events['length'];_0x2588f4<_0x44292c;_0x2588f4++){var _0x499586=events[_0x2588f4];var _0x57baf5=createListener(_0xc62c('0x6')+_0x499586,_0x33de5a);UserProfileEvents['on'](_0x499586,_0x57baf5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index b40c24a..d6c26eb 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 _0x6bd0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x6bd0,0xf1));var _0x06bd=function(_0x4a1062,_0x5ab6ab){_0x4a1062=_0x4a1062-0x0;var _0x2a832c=_0x6bd0[_0x4a1062];return _0x2a832c;};'use strict';var multer=require(_0x06bd('0x0'));var util=require('util');var path=require(_0x06bd('0x1'));var timeout=require(_0x06bd('0x2'));var express=require(_0x06bd('0x3'));var router=express[_0x06bd('0x4')]();var fs_extra=require(_0x06bd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x06bd('0x6'));var config=require(_0x06bd('0x7'));var controller=require(_0x06bd('0x8'));router[_0x06bd('0x9')]('/',auth[_0x06bd('0xa')](),controller[_0x06bd('0xb')]);router['get'](_0x06bd('0xc'),auth[_0x06bd('0xa')](),controller[_0x06bd('0xd')]);router[_0x06bd('0x9')](_0x06bd('0xe'),auth['isAuthenticated'](),controller[_0x06bd('0xf')]);router[_0x06bd('0x10')]('/',auth[_0x06bd('0xa')](),controller[_0x06bd('0x11')]);router[_0x06bd('0x12')](_0x06bd('0xe'),auth['isAuthenticated'](),controller[_0x06bd('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x06bd('0x14')]);module[_0x06bd('0x15')]=router; \ No newline at end of file +var _0xef32=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4d399b,_0x3bd4a4){var _0x4435e5=function(_0x587f0a){while(--_0x587f0a){_0x4d399b['push'](_0x4d399b['shift']());}};_0x4435e5(++_0x3bd4a4);}(_0xef32,0x6c));var _0x2ef3=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xef32[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x2ef3('0x0'));var util=require(_0x2ef3('0x1'));var path=require(_0x2ef3('0x2'));var timeout=require(_0x2ef3('0x3'));var express=require('express');var router=express[_0x2ef3('0x4')]();var fs_extra=require(_0x2ef3('0x5'));var auth=require(_0x2ef3('0x6'));var interaction=require(_0x2ef3('0x7'));var config=require('../../config/environment');var controller=require(_0x2ef3('0x8'));router[_0x2ef3('0x9')]('/',auth['isAuthenticated'](),controller[_0x2ef3('0xa')]);router[_0x2ef3('0x9')](_0x2ef3('0xb'),auth[_0x2ef3('0xc')](),controller[_0x2ef3('0xd')]);router['get'](_0x2ef3('0xe'),auth[_0x2ef3('0xc')](),controller[_0x2ef3('0xf')]);router[_0x2ef3('0x10')]('/',auth[_0x2ef3('0xc')](),controller[_0x2ef3('0x11')]);router[_0x2ef3('0x12')](_0x2ef3('0xe'),auth[_0x2ef3('0xc')](),controller['update']);router[_0x2ef3('0x13')]('/:id',auth[_0x2ef3('0xc')](),controller[_0x2ef3('0x14')]);module[_0x2ef3('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index a2070a6..3a3ddbd 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 _0x9cfc=['INTEGER','exports','STRING'];(function(_0x14c00f,_0x11b192){var _0x19fbda=function(_0xf9caa4){while(--_0xf9caa4){_0x14c00f['push'](_0x14c00f['shift']());}};_0x19fbda(++_0x11b192);}(_0x9cfc,0x1ea));var _0xc9cf=function(_0x21c320,_0x159ffa){_0x21c320=_0x21c320-0x0;var _0x58c125=_0x9cfc[_0x21c320];return _0x58c125;};'use strict';var Sequelize=require('sequelize');module[_0xc9cf('0x0')]={'name':{'type':Sequelize[_0xc9cf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc9cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc9cf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x14d4=['STRING','INTEGER'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x14d4,0x17a));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x414d('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x414d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x414d('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 478b7a6..4f33f40 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 _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x6343,0x168));var _0x3634=function(_0x2d29b0,_0x2423c1){_0x2d29b0=_0x2d29b0-0x0;var _0x1ac5fd=_0x6343[_0x2d29b0];return _0x1ac5fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 80c0de7..df13762 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 _0x8390=['api','moment','request-promise','path','rimraf','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8390,0x17f));var _0x0839=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0x8390[_0x4d0df6];return _0x4e2615;};'use strict';var _=require(_0x0839('0x0'));var util=require(_0x0839('0x1'));var logger=require('../../config/logger')(_0x0839('0x2'));var moment=require(_0x0839('0x3'));var BPromise=require('bluebird');var rp=require(_0x0839('0x4'));var fs=require('fs');var path=require(_0x0839('0x5'));var rimraf=require(_0x0839('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x41b9f3,_0x424836){return _0x41b9f3[_0x0839('0x7')]('UserProfileResource',attributes,{'tableName':_0x0839('0x8'),'paranoid':![],'indexes':[{'name':_0x0839('0x9'),'fields':['resourceId',_0x0839('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6495=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId'];(function(_0x1c596b,_0x2b6c08){var _0x1aceb5=function(_0x192e83){while(--_0x192e83){_0x1c596b['push'](_0x1c596b['shift']());}};_0x1aceb5(++_0x2b6c08);}(_0x6495,0xfc));var _0x5649=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6495[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x5649('0x0'));var logger=require(_0x5649('0x1'))(_0x5649('0x2'));var moment=require(_0x5649('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5649('0x4'));var rimraf=require(_0x5649('0x5'));var config=require(_0x5649('0x6'));var attributes=require(_0x5649('0x7'));module[_0x5649('0x8')]=function(_0x2562ee,_0x44b4a0){return _0x2562ee[_0x5649('0x9')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x5649('0xa'),'fields':[_0x5649('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 9529a0c..946a504 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 _0xbca9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cfe08,_0x40b70d){var _0x18b5a3=function(_0x333d4b){while(--_0x333d4b){_0x3cfe08['push'](_0x3cfe08['shift']());}};_0x18b5a3(++_0x40b70d);}(_0xbca9,0x16c));var _0x9bca=function(_0x4f47d5,_0x14bac5){_0x4f47d5=_0x4f47d5-0x0;var _0x507cc5=_0xbca9[_0x4f47d5];return _0x507cc5;};'use strict';var _=require(_0x9bca('0x0'));var util=require(_0x9bca('0x1'));var moment=require(_0x9bca('0x2'));var BPromise=require(_0x9bca('0x3'));var rs=require(_0x9bca('0x4'));var fs=require('fs');var Redis=require(_0x9bca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bca('0x6'));var logger=require('../../config/logger')(_0x9bca('0x7'));var config=require(_0x9bca('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9bca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101f68,_0x2d8fca,_0x99395c){return new BPromise(function(_0x223ada,_0x26a79c){return client['request'](_0x101f68,_0x99395c)[_0x9bca('0xa')](function(_0x2a0916){logger['info'](_0x9bca('0xb'),_0x2d8fca,_0x9bca('0xc'));logger['debug'](_0x9bca('0xd'),_0x2d8fca,_0x9bca('0xc'),JSON[_0x9bca('0xe')](_0x2a0916));if(_0x2a0916[_0x9bca('0xf')]){if(_0x2a0916['error'][_0x9bca('0x10')]===0x1f4){logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);return _0x26a79c(_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);}logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x2a0916['error']['message']);return _0x223ada(_0x2a0916[_0x9bca('0xf')][_0x9bca('0x11')]);}else{logger[_0x9bca('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2d8fca,_0x9bca('0xc'));_0x223ada(_0x2a0916[_0x9bca('0x13')]['message']);}})['catch'](function(_0x3e2d3d){logger[_0x9bca('0xf')](_0x9bca('0xb'),_0x2d8fca,_0x3e2d3d);_0x26a79c(_0x3e2d3d);});});} \ No newline at end of file +var _0x4ca2=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','UserProfileResource,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch'];(function(_0x334570,_0x23d405){var _0x45c6dc=function(_0x79e778){while(--_0x79e778){_0x334570['push'](_0x334570['shift']());}};_0x45c6dc(++_0x23d405);}(_0x4ca2,0xc8));var _0x24ca=function(_0x2a6f78,_0x57aee6){_0x2a6f78=_0x2a6f78-0x0;var _0x37f15e=_0x4ca2[_0x2a6f78];return _0x37f15e;};'use strict';var _=require(_0x24ca('0x0'));var util=require(_0x24ca('0x1'));var moment=require('moment');var BPromise=require(_0x24ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24ca('0x3'))['db'];var utils=require(_0x24ca('0x4'));var logger=require(_0x24ca('0x5'))(_0x24ca('0x6'));var config=require('../../config/environment');var jayson=require(_0x24ca('0x7'));var client=jayson['client'][_0x24ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a2cc3,_0x202013,_0x59dc68){return new BPromise(function(_0x16b7da,_0x116161){return client[_0x24ca('0x9')](_0x3a2cc3,_0x59dc68)[_0x24ca('0xa')](function(_0x331510){logger['info'](_0x24ca('0xb'),_0x202013,'request\x20sent');logger[_0x24ca('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x202013,'request\x20sent',JSON['stringify'](_0x331510));if(_0x331510[_0x24ca('0xd')]){if(_0x331510[_0x24ca('0xd')][_0x24ca('0xe')]===0x1f4){logger[_0x24ca('0xd')](_0x24ca('0xb'),_0x202013,_0x331510[_0x24ca('0xd')][_0x24ca('0xf')]);return _0x116161(_0x331510[_0x24ca('0xd')][_0x24ca('0xf')]);}logger[_0x24ca('0xd')](_0x24ca('0xb'),_0x202013,_0x331510[_0x24ca('0xd')][_0x24ca('0xf')]);return _0x16b7da(_0x331510[_0x24ca('0xd')][_0x24ca('0xf')]);}else{logger[_0x24ca('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x202013,_0x24ca('0x11'));_0x16b7da(_0x331510[_0x24ca('0x12')][_0x24ca('0xf')]);}})[_0x24ca('0x13')](function(_0x2e9a68){logger[_0x24ca('0xd')](_0x24ca('0xb'),_0x202013,_0x2e9a68);_0x116161(_0x2e9a68);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index fe457c1..526b971 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 _0xeb73=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x3975f2,_0x3a0ef1){var _0x1cd51b=function(_0x32fe80){while(--_0x32fe80){_0x3975f2['push'](_0x3975f2['shift']());}};_0x1cd51b(++_0x3a0ef1);}(_0xeb73,0x1bf));var _0x3eb7=function(_0x2254a0,_0x41f33e){_0x2254a0=_0x2254a0-0x0;var _0x35cd31=_0xeb73[_0x2254a0];return _0x35cd31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3eb7('0x0'));var timeout=require(_0x3eb7('0x1'));var express=require(_0x3eb7('0x2'));var router=express[_0x3eb7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3eb7('0x4'));var interaction=require(_0x3eb7('0x5'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x3eb7('0x6')]('/',auth[_0x3eb7('0x7')](),controller[_0x3eb7('0x8')]);router[_0x3eb7('0x6')](_0x3eb7('0x9'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xa')]);router[_0x3eb7('0x6')](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xc')]);router[_0x3eb7('0xd')]('/',auth[_0x3eb7('0x7')](),controller['create']);router[_0x3eb7('0xe')](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0xf')]);router['delete'](_0x3eb7('0xb'),auth[_0x3eb7('0x7')](),controller[_0x3eb7('0x10')]);module[_0x3eb7('0x11')]=router; \ No newline at end of file +var _0x1737=['fs-extra','../../config/environment','./userProfileSection.controller','get','/describe','isAuthenticated','describe','/:id','show','create','put','destroy','path','connect-timeout','express'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x1737,0x129));var _0x7173=function(_0x5a1b38,_0x21fae3){_0x5a1b38=_0x5a1b38-0x0;var _0x5c28fb=_0x1737[_0x5a1b38];return _0x5c28fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7173('0x0'));var timeout=require(_0x7173('0x1'));var express=require(_0x7173('0x2'));var router=express['Router']();var fs_extra=require(_0x7173('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7173('0x4'));var controller=require(_0x7173('0x5'));router[_0x7173('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7173('0x7'),auth[_0x7173('0x8')](),controller[_0x7173('0x9')]);router['get'](_0x7173('0xa'),auth[_0x7173('0x8')](),controller[_0x7173('0xb')]);router['post']('/',auth[_0x7173('0x8')](),controller[_0x7173('0xc')]);router[_0x7173('0xd')](_0x7173('0xa'),auth[_0x7173('0x8')](),controller['update']);router['delete'](_0x7173('0xa'),auth[_0x7173('0x8')](),controller[_0x7173('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 51a698f..9058b68 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 _0xbc9d=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x9eeb50,_0x4bf715){_0x9eeb50=_0x9eeb50-0x0;var _0x399e30=_0xbc9d[_0x9eeb50];return _0x399e30;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'name':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xdbc9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xdbc9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2aba48){this[_0xdbc9('0x4')](_0xdbc9('0x5'),_0x2aba48?_0x2aba48[_0xdbc9('0x6')](''):[]);},'get':function(){return this[_0xdbc9('0x7')](_0xdbc9('0x5'))?this[_0xdbc9('0x7')]('crudPermissions')[_0xdbc9('0x8')](''):[];}}}; \ No newline at end of file +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x571cb6,_0x492794){_0x571cb6=_0x571cb6-0x0;var _0x158af2=_0xd4f4[_0x571cb6];return _0x158af2;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a12e6ca..06f591c 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 _0x2f88=['key','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','model','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','UserProfileSection','type'];(function(_0x320f41,_0x1f6bef){var _0x3206ec=function(_0x59b76d){while(--_0x59b76d){_0x320f41['push'](_0x320f41['shift']());}};_0x3206ec(++_0x1f6bef);}(_0x2f88,0x1d2));var _0x82f8=function(_0x4d45c3,_0x5ef8ef){_0x4d45c3=_0x4d45c3-0x0;var _0x5bf776=_0x2f88[_0x4d45c3];return _0x5bf776;};'use strict';var emlformat=require(_0x82f8('0x0'));var rimraf=require(_0x82f8('0x1'));var zipdir=require(_0x82f8('0x2'));var jsonpatch=require(_0x82f8('0x3'));var rp=require('request-promise');var moment=require(_0x82f8('0x4'));var BPromise=require(_0x82f8('0x5'));var Mustache=require(_0x82f8('0x6'));var util=require(_0x82f8('0x7'));var path=require(_0x82f8('0x8'));var sox=require(_0x82f8('0x9'));var csv=require(_0x82f8('0xa'));var ejs=require(_0x82f8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f8('0xc'));var crypto=require('crypto');var jsforce=require(_0x82f8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x82f8('0xa'));var querystring=require(_0x82f8('0xe'));var Papa=require('papaparse');var Redis=require(_0x82f8('0xf'));var authService=require(_0x82f8('0x10'));var qs=require(_0x82f8('0x11'));var as=require(_0x82f8('0x12'));var hardwareService=require(_0x82f8('0x13'));var logger=require(_0x82f8('0x14'))(_0x82f8('0x15'));var utils=require('../../config/utils');var config=require(_0x82f8('0x16'));var licenseUtil=require(_0x82f8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46072a,_0x441e46){_0x441e46=_0x441e46||0xcc;return function(_0xcb12be){if(_0xcb12be){return _0x46072a[_0x82f8('0x18')](_0x441e46);}return _0x46072a['status'](_0x441e46)['end']();};}function respondWithResult(_0x5f4bc0,_0x451ee6){_0x451ee6=_0x451ee6||0xc8;return function(_0x469901){if(_0x469901){return _0x5f4bc0[_0x82f8('0x19')](_0x451ee6)[_0x82f8('0x1a')](_0x469901);}};}function respondWithFilteredResult(_0x2dc19e,_0x5e15c0){return function(_0x28ab17){if(_0x28ab17){var _0x174bcd=typeof _0x5e15c0[_0x82f8('0x1b')]==='undefined'&&typeof _0x5e15c0[_0x82f8('0x1c')]==='undefined';var _0x1ea8c9=_0x28ab17[_0x82f8('0x1d')];var _0x570d52=_0x174bcd?0x0:_0x5e15c0['offset'];var _0xf0fca5=_0x174bcd?_0x28ab17[_0x82f8('0x1d')]:_0x5e15c0[_0x82f8('0x1b')]+_0x5e15c0[_0x82f8('0x1c')];var _0x524be3;if(_0xf0fca5>=_0x1ea8c9){_0xf0fca5=_0x1ea8c9;_0x524be3=0xc8;}else{_0x524be3=0xce;}_0x2dc19e[_0x82f8('0x19')](_0x524be3);return _0x2dc19e[_0x82f8('0x1e')](_0x82f8('0x1f'),_0x570d52+'-'+_0xf0fca5+'/'+_0x1ea8c9)[_0x82f8('0x1a')](_0x28ab17);}return null;};}function patchUpdates(_0x80bb9){return function(_0x38aa1c){try{jsonpatch[_0x82f8('0x20')](_0x38aa1c,_0x80bb9,!![]);}catch(_0x6ca3fe){return BPromise[_0x82f8('0x21')](_0x6ca3fe);}return _0x38aa1c[_0x82f8('0x22')]();};}function saveUpdates(_0x4ad3e5,_0xba6d28){return function(_0x59c2fa){if(_0x59c2fa){return _0x59c2fa[_0x82f8('0x23')](_0x4ad3e5)['then'](function(_0x21edd9){return _0x21edd9;});}return null;};}function removeEntity(_0x2864b5,_0x31ca67){return function(_0x498647){if(_0x498647){return _0x498647[_0x82f8('0x24')]()['then'](function(){_0x2864b5[_0x82f8('0x19')](0xcc)[_0x82f8('0x25')]();});}};}function handleEntityNotFound(_0x3a4b26,_0x35a365){return function(_0xaac7b8){if(!_0xaac7b8){_0x3a4b26['sendStatus'](0x194);}return _0xaac7b8;};}function handleError(_0x28ff17,_0x5e2c09){_0x5e2c09=_0x5e2c09||0x1f4;return function(_0x40fcfb){logger['error'](_0x40fcfb[_0x82f8('0x26')]);if(_0x40fcfb[_0x82f8('0x27')]){delete _0x40fcfb[_0x82f8('0x27')];}_0x28ff17[_0x82f8('0x19')](_0x5e2c09)[_0x82f8('0x28')](_0x40fcfb);};}exports[_0x82f8('0x29')]=function(_0x3b33c0,_0x460a49){var _0x5528b6={},_0x42aee7={},_0x21d09e={'count':0x0,'rows':[]};var _0x355e77=_[_0x82f8('0x2a')](db[_0x82f8('0x2b')]['rawAttributes'],function(_0x4ab2c1){return{'name':_0x4ab2c1['fieldName'],'type':_0x4ab2c1[_0x82f8('0x2c')][_0x82f8('0x2d')]};});_0x42aee7['model']=_['map'](_0x355e77,_0x82f8('0x27'));_0x42aee7[_0x82f8('0x2e')]=_[_0x82f8('0x2f')](_0x3b33c0['query']);_0x42aee7['filters']=_[_0x82f8('0x30')](_0x42aee7['model'],_0x42aee7[_0x82f8('0x2e')]);_0x5528b6['attributes']=_[_0x82f8('0x30')](_0x42aee7['model'],qs[_0x82f8('0x31')](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x31')]));_0x5528b6[_0x82f8('0x32')]=_0x5528b6[_0x82f8('0x32')][_0x82f8('0x33')]?_0x5528b6['attributes']:_0x42aee7['model'];if(!_0x3b33c0[_0x82f8('0x2e')]['hasOwnProperty'](_0x82f8('0x34'))){_0x5528b6[_0x82f8('0x1c')]=qs[_0x82f8('0x1c')](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x1c')]);_0x5528b6[_0x82f8('0x1b')]=qs['offset'](_0x3b33c0['query']['offset']);}_0x5528b6[_0x82f8('0x35')]=qs['sort'](_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x36')]);_0x5528b6[_0x82f8('0x37')]=qs[_0x82f8('0x38')](_['pick'](_0x3b33c0[_0x82f8('0x2e')],_0x42aee7['filters']),_0x355e77);if(_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x39')]){_0x5528b6['where']=_[_0x82f8('0x3a')](_0x5528b6[_0x82f8('0x37')],{'$or':_[_0x82f8('0x2a')](_0x355e77,function(_0x5b6b43){if(_0x5b6b43[_0x82f8('0x2c')]!==_0x82f8('0x3b')){var _0x39f099={};_0x39f099[_0x5b6b43[_0x82f8('0x27')]]={'$like':'%'+_0x3b33c0[_0x82f8('0x2e')]['filter']+'%'};return _0x39f099;}})});}_0x5528b6=_['merge']({},_0x5528b6,_0x3b33c0[_0x82f8('0x3c')]);var _0x253970={'where':_0x5528b6[_0x82f8('0x37')]};return db[_0x82f8('0x2b')][_0x82f8('0x1d')](_0x253970)[_0x82f8('0x3d')](function(_0x5a2c52){_0x21d09e[_0x82f8('0x1d')]=_0x5a2c52;if(_0x3b33c0[_0x82f8('0x2e')][_0x82f8('0x3e')]){_0x5528b6[_0x82f8('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0x82f8('0x40')](_0x5528b6);})[_0x82f8('0x3d')](function(_0x5c31db){_0x21d09e['rows']=_0x5c31db;return _0x21d09e;})['then'](respondWithFilteredResult(_0x460a49,_0x5528b6))[_0x82f8('0x41')](handleError(_0x460a49,null));};exports[_0x82f8('0x42')]=function(_0xfbe442,_0x3df767){var _0x3d19ac={'raw':![],'where':{'id':_0xfbe442['params']['id']}},_0x28131c={};_0x28131c[_0x82f8('0x43')]=_[_0x82f8('0x2f')](db[_0x82f8('0x2b')]['rawAttributes']);_0x28131c[_0x82f8('0x2e')]=_[_0x82f8('0x2f')](_0xfbe442[_0x82f8('0x2e')]);_0x28131c[_0x82f8('0x38')]=_[_0x82f8('0x30')](_0x28131c[_0x82f8('0x43')],_0x28131c[_0x82f8('0x2e')]);_0x3d19ac[_0x82f8('0x32')]=_[_0x82f8('0x30')](_0x28131c[_0x82f8('0x43')],qs[_0x82f8('0x31')](_0xfbe442[_0x82f8('0x2e')]['fields']));_0x3d19ac[_0x82f8('0x32')]=_0x3d19ac['attributes']['length']?_0x3d19ac['attributes']:_0x28131c['model'];if(_0xfbe442[_0x82f8('0x2e')][_0x82f8('0x3e')]){_0x3d19ac[_0x82f8('0x3f')]=[{'all':!![]}];}_0x3d19ac=_[_0x82f8('0x3a')]({},_0x3d19ac,_0xfbe442[_0x82f8('0x3c')]);return db['UserProfileSection'][_0x82f8('0x44')](_0x3d19ac)['then'](handleEntityNotFound(_0x3df767,null))[_0x82f8('0x3d')](respondWithResult(_0x3df767,null))['catch'](handleError(_0x3df767,null));};exports[_0x82f8('0x45')]=function(_0xd28e22,_0x57ffa9){return db[_0x82f8('0x2b')][_0x82f8('0x45')](_0xd28e22['body'],{})[_0x82f8('0x3d')](respondWithResult(_0x57ffa9,0xc9))[_0x82f8('0x41')](handleError(_0x57ffa9,null));};exports[_0x82f8('0x23')]=function(_0x2c7bc7,_0xe3f04){if(_0x2c7bc7[_0x82f8('0x46')]['id']){delete _0x2c7bc7['body']['id'];}return db[_0x82f8('0x2b')]['find']({'where':{'id':_0x2c7bc7[_0x82f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xe3f04,null))['then'](saveUpdates(_0x2c7bc7[_0x82f8('0x46')],null))['then'](respondWithResult(_0xe3f04,null))['catch'](handleError(_0xe3f04,null));};exports[_0x82f8('0x24')]=function(_0x2640d4,_0x4835a2){return db['UserProfileSection'][_0x82f8('0x44')]({'where':{'id':_0x2640d4[_0x82f8('0x47')]['id']}})[_0x82f8('0x3d')](handleEntityNotFound(_0x4835a2,null))[_0x82f8('0x3d')](removeEntity(_0x4835a2,null))[_0x82f8('0x41')](handleError(_0x4835a2,null));};exports[_0x82f8('0x48')]=function(_0x5a8fc3,_0x16dcfe){return db['UserProfileSection']['describe']()[_0x82f8('0x3d')](respondWithResult(_0x16dcfe,null))[_0x82f8('0x41')](handleError(_0x16dcfe,null));}; \ No newline at end of file +var _0xf9e4=['map','UserProfileSection','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','status','sendStatus','error','stack','name','send','index'];(function(_0x3e25ba,_0x4d5399){var _0x393fb8=function(_0x4fc023){while(--_0x4fc023){_0x3e25ba['push'](_0x3e25ba['shift']());}};_0x393fb8(++_0x4d5399);}(_0xf9e4,0xbf));var _0x4f9e=function(_0x2aab17,_0x39aedd){_0x2aab17=_0x2aab17-0x0;var _0x25d0af=_0xf9e4[_0x2aab17];return _0x25d0af;};'use strict';var emlformat=require(_0x4f9e('0x0'));var rimraf=require(_0x4f9e('0x1'));var zipdir=require(_0x4f9e('0x2'));var jsonpatch=require(_0x4f9e('0x3'));var rp=require('request-promise');var moment=require(_0x4f9e('0x4'));var BPromise=require(_0x4f9e('0x5'));var Mustache=require('mustache');var util=require(_0x4f9e('0x6'));var path=require(_0x4f9e('0x7'));var sox=require(_0x4f9e('0x8'));var csv=require(_0x4f9e('0x9'));var ejs=require(_0x4f9e('0xa'));var fs=require('fs');var fs_extra=require(_0x4f9e('0xb'));var _=require(_0x4f9e('0xc'));var squel=require('squel');var crypto=require(_0x4f9e('0xd'));var jsforce=require(_0x4f9e('0xe'));var deskjs=require(_0x4f9e('0xf'));var toCsv=require(_0x4f9e('0x9'));var querystring=require(_0x4f9e('0x10'));var Papa=require(_0x4f9e('0x11'));var Redis=require('ioredis');var authService=require(_0x4f9e('0x12'));var qs=require(_0x4f9e('0x13'));var as=require(_0x4f9e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f9e('0x15'))(_0x4f9e('0x16'));var utils=require(_0x4f9e('0x17'));var config=require(_0x4f9e('0x18'));var licenseUtil=require(_0x4f9e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39c641,_0x54044d){_0x54044d=_0x54044d||0xcc;return function(_0x3a72ce){if(_0x3a72ce){return _0x39c641['sendStatus'](_0x54044d);}return _0x39c641['status'](_0x54044d)[_0x4f9e('0x1a')]();};}function respondWithResult(_0x3de3d5,_0x2e986d){_0x2e986d=_0x2e986d||0xc8;return function(_0x5a48cb){if(_0x5a48cb){return _0x3de3d5['status'](_0x2e986d)[_0x4f9e('0x1b')](_0x5a48cb);}};}function respondWithFilteredResult(_0x102fa9,_0x52a6bd){return function(_0x118ecf){if(_0x118ecf){var _0x1fac1a=typeof _0x52a6bd[_0x4f9e('0x1c')]==='undefined'&&typeof _0x52a6bd[_0x4f9e('0x1d')]===_0x4f9e('0x1e');var _0xcc1eb9=_0x118ecf[_0x4f9e('0x1f')];var _0x1bdef2=_0x1fac1a?0x0:_0x52a6bd['offset'];var _0x5f3822=_0x1fac1a?_0x118ecf[_0x4f9e('0x1f')]:_0x52a6bd[_0x4f9e('0x1c')]+_0x52a6bd[_0x4f9e('0x1d')];var _0x50d0c8;if(_0x5f3822>=_0xcc1eb9){_0x5f3822=_0xcc1eb9;_0x50d0c8=0xc8;}else{_0x50d0c8=0xce;}_0x102fa9['status'](_0x50d0c8);return _0x102fa9[_0x4f9e('0x20')](_0x4f9e('0x21'),_0x1bdef2+'-'+_0x5f3822+'/'+_0xcc1eb9)[_0x4f9e('0x1b')](_0x118ecf);}return null;};}function patchUpdates(_0x56b577){return function(_0x3c4fca){try{jsonpatch[_0x4f9e('0x22')](_0x3c4fca,_0x56b577,!![]);}catch(_0x56045e){return BPromise['reject'](_0x56045e);}return _0x3c4fca[_0x4f9e('0x23')]();};}function saveUpdates(_0x1dc751,_0x1816b9){return function(_0x117e06){if(_0x117e06){return _0x117e06[_0x4f9e('0x24')](_0x1dc751)[_0x4f9e('0x25')](function(_0x2ed806){return _0x2ed806;});}return null;};}function removeEntity(_0x566ec9,_0x50fc6b){return function(_0x1d3a9c){if(_0x1d3a9c){return _0x1d3a9c[_0x4f9e('0x26')]()[_0x4f9e('0x25')](function(){_0x566ec9[_0x4f9e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af11f,_0x54213e){return function(_0x209a27){if(!_0x209a27){_0x3af11f[_0x4f9e('0x28')](0x194);}return _0x209a27;};}function handleError(_0x380a8e,_0x57c483){_0x57c483=_0x57c483||0x1f4;return function(_0x1aa9b0){logger[_0x4f9e('0x29')](_0x1aa9b0[_0x4f9e('0x2a')]);if(_0x1aa9b0[_0x4f9e('0x2b')]){delete _0x1aa9b0[_0x4f9e('0x2b')];}_0x380a8e[_0x4f9e('0x27')](_0x57c483)[_0x4f9e('0x2c')](_0x1aa9b0);};}exports[_0x4f9e('0x2d')]=function(_0x5d8a8c,_0x12ecc8){var _0x2fc2e5={},_0x5e5670={},_0x34f4bb={'count':0x0,'rows':[]};var _0x55676c=_[_0x4f9e('0x2e')](db[_0x4f9e('0x2f')][_0x4f9e('0x30')],function(_0x37b085){return{'name':_0x37b085['fieldName'],'type':_0x37b085[_0x4f9e('0x31')][_0x4f9e('0x32')]};});_0x5e5670[_0x4f9e('0x33')]=_[_0x4f9e('0x2e')](_0x55676c,_0x4f9e('0x2b'));_0x5e5670[_0x4f9e('0x34')]=_[_0x4f9e('0x35')](_0x5d8a8c[_0x4f9e('0x34')]);_0x5e5670[_0x4f9e('0x36')]=_[_0x4f9e('0x37')](_0x5e5670['model'],_0x5e5670[_0x4f9e('0x34')]);_0x2fc2e5['attributes']=_['intersection'](_0x5e5670[_0x4f9e('0x33')],qs[_0x4f9e('0x38')](_0x5d8a8c['query']['fields']));_0x2fc2e5[_0x4f9e('0x39')]=_0x2fc2e5['attributes']['length']?_0x2fc2e5[_0x4f9e('0x39')]:_0x5e5670[_0x4f9e('0x33')];if(!_0x5d8a8c['query'][_0x4f9e('0x3a')](_0x4f9e('0x3b'))){_0x2fc2e5[_0x4f9e('0x1d')]=qs[_0x4f9e('0x1d')](_0x5d8a8c[_0x4f9e('0x34')][_0x4f9e('0x1d')]);_0x2fc2e5[_0x4f9e('0x1c')]=qs[_0x4f9e('0x1c')](_0x5d8a8c[_0x4f9e('0x34')][_0x4f9e('0x1c')]);}_0x2fc2e5['order']=qs[_0x4f9e('0x3c')](_0x5d8a8c['query'][_0x4f9e('0x3c')]);_0x2fc2e5[_0x4f9e('0x3d')]=qs[_0x4f9e('0x36')](_[_0x4f9e('0x3e')](_0x5d8a8c[_0x4f9e('0x34')],_0x5e5670[_0x4f9e('0x36')]),_0x55676c);if(_0x5d8a8c[_0x4f9e('0x34')][_0x4f9e('0x3f')]){_0x2fc2e5[_0x4f9e('0x3d')]=_[_0x4f9e('0x40')](_0x2fc2e5[_0x4f9e('0x3d')],{'$or':_[_0x4f9e('0x2e')](_0x55676c,function(_0x444f8a){if(_0x444f8a[_0x4f9e('0x31')]!==_0x4f9e('0x41')){var _0x448c64={};_0x448c64[_0x444f8a[_0x4f9e('0x2b')]]={'$like':'%'+_0x5d8a8c[_0x4f9e('0x34')][_0x4f9e('0x3f')]+'%'};return _0x448c64;}})});}_0x2fc2e5=_[_0x4f9e('0x40')]({},_0x2fc2e5,_0x5d8a8c[_0x4f9e('0x42')]);var _0xdc526e={'where':_0x2fc2e5[_0x4f9e('0x3d')]};return db[_0x4f9e('0x2f')]['count'](_0xdc526e)['then'](function(_0xf69c2){_0x34f4bb[_0x4f9e('0x1f')]=_0xf69c2;if(_0x5d8a8c[_0x4f9e('0x34')][_0x4f9e('0x43')]){_0x2fc2e5['include']=[{'all':!![]}];}return db[_0x4f9e('0x2f')][_0x4f9e('0x44')](_0x2fc2e5);})[_0x4f9e('0x25')](function(_0x43a820){_0x34f4bb[_0x4f9e('0x45')]=_0x43a820;return _0x34f4bb;})[_0x4f9e('0x25')](respondWithFilteredResult(_0x12ecc8,_0x2fc2e5))[_0x4f9e('0x46')](handleError(_0x12ecc8,null));};exports[_0x4f9e('0x47')]=function(_0x517425,_0x52dc4b){var _0x57a0f4={'raw':![],'where':{'id':_0x517425[_0x4f9e('0x48')]['id']}},_0x5cb355={};_0x5cb355[_0x4f9e('0x33')]=_[_0x4f9e('0x35')](db[_0x4f9e('0x2f')][_0x4f9e('0x30')]);_0x5cb355[_0x4f9e('0x34')]=_['keys'](_0x517425[_0x4f9e('0x34')]);_0x5cb355[_0x4f9e('0x36')]=_[_0x4f9e('0x37')](_0x5cb355[_0x4f9e('0x33')],_0x5cb355['query']);_0x57a0f4['attributes']=_[_0x4f9e('0x37')](_0x5cb355[_0x4f9e('0x33')],qs['fields'](_0x517425[_0x4f9e('0x34')][_0x4f9e('0x38')]));_0x57a0f4[_0x4f9e('0x39')]=_0x57a0f4[_0x4f9e('0x39')][_0x4f9e('0x49')]?_0x57a0f4['attributes']:_0x5cb355[_0x4f9e('0x33')];if(_0x517425[_0x4f9e('0x34')][_0x4f9e('0x43')]){_0x57a0f4[_0x4f9e('0x4a')]=[{'all':!![]}];}_0x57a0f4=_[_0x4f9e('0x40')]({},_0x57a0f4,_0x517425[_0x4f9e('0x42')]);return db['UserProfileSection']['find'](_0x57a0f4)[_0x4f9e('0x25')](handleEntityNotFound(_0x52dc4b,null))['then'](respondWithResult(_0x52dc4b,null))['catch'](handleError(_0x52dc4b,null));};exports[_0x4f9e('0x4b')]=function(_0x1a17ab,_0x37bb95){return db[_0x4f9e('0x2f')][_0x4f9e('0x4b')](_0x1a17ab['body'],{})[_0x4f9e('0x25')](respondWithResult(_0x37bb95,0xc9))[_0x4f9e('0x46')](handleError(_0x37bb95,null));};exports[_0x4f9e('0x24')]=function(_0x5ef818,_0x4232e0){if(_0x5ef818['body']['id']){delete _0x5ef818[_0x4f9e('0x4c')]['id'];}return db[_0x4f9e('0x2f')][_0x4f9e('0x4d')]({'where':{'id':_0x5ef818[_0x4f9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x4232e0,null))['then'](saveUpdates(_0x5ef818['body'],null))['then'](respondWithResult(_0x4232e0,null))[_0x4f9e('0x46')](handleError(_0x4232e0,null));};exports[_0x4f9e('0x26')]=function(_0x6a904c,_0xe42aea){return db['UserProfileSection'][_0x4f9e('0x4d')]({'where':{'id':_0x6a904c[_0x4f9e('0x48')]['id']}})[_0x4f9e('0x25')](handleEntityNotFound(_0xe42aea,null))['then'](removeEntity(_0xe42aea,null))[_0x4f9e('0x46')](handleError(_0xe42aea,null));};exports['describe']=function(_0x388974,_0x135a10){return db[_0x4f9e('0x2f')][_0x4f9e('0x4e')]()['then'](respondWithResult(_0x135a10,null))[_0x4f9e('0x46')](handleError(_0x135a10,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6475bd2..5fa75b4 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 _0x67f5=['rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','api','moment','bluebird'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x67f5,0x10d));var _0x567f=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x67f5[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require('lodash');var util=require(_0x567f('0x0'));var logger=require('../../config/logger')(_0x567f('0x1'));var moment=require(_0x567f('0x2'));var BPromise=require(_0x567f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x567f('0x4'));var config=require(_0x567f('0x5'));var attributes=require(_0x567f('0x6'));module['exports']=function(_0x429696,_0x3db2c8){return _0x429696[_0x567f('0x7')](_0x567f('0x8'),attributes,{'tableName':_0x567f('0x9'),'paranoid':![],'indexes':[{'name':_0x567f('0xa'),'fields':[_0x567f('0xb'),_0x567f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x369d=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util'];(function(_0x290844,_0x366077){var _0x546847=function(_0x4ea65e){while(--_0x4ea65e){_0x290844['push'](_0x290844['shift']());}};_0x546847(++_0x366077);}(_0x369d,0x166));var _0xd369=function(_0x4b6837,_0x31c457){_0x4b6837=_0x4b6837-0x0;var _0x1a05e2=_0x369d[_0x4b6837];return _0x1a05e2;};'use strict';var _=require(_0xd369('0x0'));var util=require(_0xd369('0x1'));var logger=require(_0xd369('0x2'))('api');var moment=require(_0xd369('0x3'));var BPromise=require(_0xd369('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd369('0x5'));var rimraf=require(_0xd369('0x6'));var config=require(_0xd369('0x7'));var attributes=require(_0xd369('0x8'));module[_0xd369('0x9')]=function(_0xc7e189,_0x34fbdf){return _0xc7e189[_0xd369('0xa')](_0xd369('0xb'),attributes,{'tableName':_0xd369('0xc'),'paranoid':![],'indexes':[{'name':_0xd369('0xd'),'fields':[_0xd369('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0e13f36..a3cfc12 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 _0xd068=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','code','error','UserProfileSection,\x20%s,\x20%s','message','catch','lodash'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xd068,0xce));var _0x8d06=function(_0x333e17,_0x589bb9){_0x333e17=_0x333e17-0x0;var _0x432dad=_0xd068[_0x333e17];return _0x432dad;};'use strict';var _=require(_0x8d06('0x0'));var util=require(_0x8d06('0x1'));var moment=require(_0x8d06('0x2'));var BPromise=require(_0x8d06('0x3'));var rs=require(_0x8d06('0x4'));var fs=require('fs');var Redis=require(_0x8d06('0x5'));var db=require(_0x8d06('0x6'))['db'];var utils=require(_0x8d06('0x7'));var logger=require(_0x8d06('0x8'))(_0x8d06('0x9'));var config=require(_0x8d06('0xa'));var jayson=require(_0x8d06('0xb'));var client=jayson[_0x8d06('0xc')][_0x8d06('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb52bab,_0x41b883,_0x3f1a0b){return new BPromise(function(_0x15f26f,_0x50fc05){return client[_0x8d06('0xe')](_0xb52bab,_0x3f1a0b)['then'](function(_0xc29343){logger[_0x8d06('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x41b883,_0x8d06('0x10'));logger['debug'](_0x8d06('0x11'),_0x41b883,_0x8d06('0x10'),JSON['stringify'](_0xc29343));if(_0xc29343['error']){if(_0xc29343['error'][_0x8d06('0x12')]===0x1f4){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343['error'][_0x8d06('0x15')]);return _0x50fc05(_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);}logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0xc29343[_0x8d06('0x13')][_0x8d06('0x15')]);return _0x15f26f(_0xc29343['error']['message']);}else{logger[_0x8d06('0xf')](_0x8d06('0x14'),_0x41b883,'request\x20sent');_0x15f26f(_0xc29343['result'][_0x8d06('0x15')]);}})[_0x8d06('0x16')](function(_0x5de921){logger[_0x8d06('0x13')](_0x8d06('0x14'),_0x41b883,_0x5de921);_0x50fc05(_0x5de921);});});} \ No newline at end of file +var _0xee78=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x33875d,_0xf2f624){var _0x477086=function(_0x5331e4){while(--_0x5331e4){_0x33875d['push'](_0x33875d['shift']());}};_0x477086(++_0xf2f624);}(_0xee78,0x1b9));var _0x8ee7=function(_0x192c09,_0x2b788d){_0x192c09=_0x192c09-0x0;var _0x35249e=_0xee78[_0x192c09];return _0x35249e;};'use strict';var _=require(_0x8ee7('0x0'));var util=require(_0x8ee7('0x1'));var moment=require(_0x8ee7('0x2'));var BPromise=require(_0x8ee7('0x3'));var rs=require(_0x8ee7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ee7('0x5'))['db'];var utils=require(_0x8ee7('0x6'));var logger=require('../../config/logger')(_0x8ee7('0x7'));var config=require(_0x8ee7('0x8'));var jayson=require(_0x8ee7('0x9'));var client=jayson[_0x8ee7('0xa')][_0x8ee7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9e0e8f,_0x31353c,_0x1b3980){return new BPromise(function(_0x48ce89,_0x23481f){return client['request'](_0x9e0e8f,_0x1b3980)[_0x8ee7('0xc')](function(_0x3e7b06){logger[_0x8ee7('0xd')](_0x8ee7('0xe'),_0x31353c,_0x8ee7('0xf'));logger['debug'](_0x8ee7('0x10'),_0x31353c,_0x8ee7('0xf'),JSON['stringify'](_0x3e7b06));if(_0x3e7b06[_0x8ee7('0x11')]){if(_0x3e7b06['error'][_0x8ee7('0x12')]===0x1f4){logger[_0x8ee7('0x11')](_0x8ee7('0xe'),_0x31353c,_0x3e7b06[_0x8ee7('0x11')]['message']);return _0x23481f(_0x3e7b06[_0x8ee7('0x11')][_0x8ee7('0x13')]);}logger[_0x8ee7('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x31353c,_0x3e7b06[_0x8ee7('0x11')][_0x8ee7('0x13')]);return _0x48ce89(_0x3e7b06[_0x8ee7('0x11')][_0x8ee7('0x13')]);}else{logger[_0x8ee7('0xd')](_0x8ee7('0xe'),_0x31353c,_0x8ee7('0xf'));_0x48ce89(_0x3e7b06[_0x8ee7('0x14')][_0x8ee7('0x13')]);}})[_0x8ee7('0x15')](function(_0x5c7de2){logger[_0x8ee7('0x11')](_0x8ee7('0xe'),_0x31353c,_0x5c7de2);_0x23481f(_0x5c7de2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c736d8e..cbc52c3 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xea97c9,_0x20aaef){var _0x213202=function(_0x3d52a3){while(--_0x3d52a3){_0xea97c9['push'](_0xea97c9['shift']());}};_0x213202(++_0x20aaef);}(_0x70e0,0x17b));var _0x070e=function(_0x577533,_0x392fd8){_0x577533=_0x577533-0x0;var _0x437cf1=_0x70e0[_0x577533];return _0x437cf1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29ca73,_0x12d17d){var _0x252f61=function(_0x55252f){while(--_0x55252f){_0x29ca73['push'](_0x29ca73['shift']());}};_0x252f61(++_0x12d17d);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d7360,_0x120839){_0x3d7360=_0x3d7360-0x0;var _0x40102c=_0xedd9[_0x3d7360];return _0x40102c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e2a7141..56a6fcc 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 _0xa780=['INTEGER','sequelize'];(function(_0x2d14dc,_0x58c365){var _0x1af3ee=function(_0x12183c){while(--_0x12183c){_0x2d14dc['push'](_0x2d14dc['shift']());}};_0x1af3ee(++_0x58c365);}(_0xa780,0x139));var _0x0a78=function(_0x13ccaf,_0x4cca45){_0x13ccaf=_0x13ccaf-0x0;var _0xa14269=_0xa780[_0x13ccaf];return _0xa14269;};'use strict';var Sequelize=require(_0x0a78('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0a78('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa78=['exports','INTEGER'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xfa78,0x1e2));var _0x8fa7=function(_0x5c26bd,_0x37968a){_0x5c26bd=_0x5c26bd-0x0;var _0x349f0e=_0xfa78[_0x5c26bd];return _0x349f0e;};'use strict';var Sequelize=require('sequelize');module[_0x8fa7('0x0')]={'penalty':{'type':Sequelize[_0x8fa7('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index da16a36..7e27fca 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 _0x8506=['util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x301f5e,_0x562f08){var _0x5cfc0d=function(_0x193684){while(--_0x193684){_0x301f5e['push'](_0x301f5e['shift']());}};_0x5cfc0d(++_0x562f08);}(_0x8506,0xe8));var _0x6850=function(_0x555e8c,_0x1aae85){_0x555e8c=_0x555e8c-0x0;var _0x3dfa7=_0x8506[_0x555e8c];return _0x3dfa7;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x6850('0x6')]=function(_0x372f0b,_0x232459){return _0x372f0b[_0x6850('0x7')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a55=['define','UserSmsQueue','user_has_sms_queues','lodash','moment','path','../../config/environment','exports'];(function(_0x39998c,_0x41efa1){var _0x27b152=function(_0xb0a6de){while(--_0xb0a6de){_0x39998c['push'](_0x39998c['shift']());}};_0x27b152(++_0x41efa1);}(_0x6a55,0xdb));var _0x56a5=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x6a55[_0x55257d];return _0x4d296d;};'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('./userSmsQueue.attributes');module[_0x56a5('0x4')]=function(_0x380b1b,_0x42d164){return _0x380b1b[_0x56a5('0x5')](_0x56a5('0x6'),attributes,{'tableName':_0x56a5('0x7'),'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 baebf6f..0074ea5 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 _0x943f=['error','code','UserSmsQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x943f,0x119));var _0xf943=function(_0x3034a5,_0x1057ee){_0x3034a5=_0x3034a5-0x0;var _0x2ab136=_0x943f[_0x3034a5];return _0x2ab136;};'use strict';var _=require(_0xf943('0x0'));var util=require(_0xf943('0x1'));var moment=require(_0xf943('0x2'));var BPromise=require(_0xf943('0x3'));var rs=require(_0xf943('0x4'));var fs=require('fs');var Redis=require(_0xf943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf943('0x6'));var logger=require(_0xf943('0x7'))(_0xf943('0x8'));var config=require(_0xf943('0x9'));var jayson=require(_0xf943('0xa'));var client=jayson[_0xf943('0xb')][_0xf943('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcf0276,_0x2ba3b5,_0x496169){return new BPromise(function(_0x57c930,_0x2431cc){return client['request'](_0xcf0276,_0x496169)[_0xf943('0xd')](function(_0x43e46a){logger[_0xf943('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x2ba3b5,_0xf943('0xf'));logger[_0xf943('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ba3b5,'request\x20sent',JSON[_0xf943('0x11')](_0x43e46a));if(_0x43e46a[_0xf943('0x12')]){if(_0x43e46a[_0xf943('0x12')][_0xf943('0x13')]===0x1f4){logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);return _0x2431cc(_0x43e46a['error'][_0xf943('0x15')]);}logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);return _0x57c930(_0x43e46a[_0xf943('0x12')][_0xf943('0x15')]);}else{logger[_0xf943('0xe')](_0xf943('0x14'),_0x2ba3b5,_0xf943('0xf'));_0x57c930(_0x43e46a[_0xf943('0x16')]['message']);}})['catch'](function(_0x28fad1){logger[_0xf943('0x12')](_0xf943('0x14'),_0x2ba3b5,_0x28fad1);_0x2431cc(_0x28fad1);});});} \ No newline at end of file +var _0x5f5e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x2e35fd,_0xde7dfd){var _0x41efb3=function(_0xd45d38){while(--_0xd45d38){_0x2e35fd['push'](_0x2e35fd['shift']());}};_0x41efb3(++_0xde7dfd);}(_0x5f5e,0x12c));var _0xe5f5=function(_0x22408b,_0x149e4c){_0x22408b=_0x22408b-0x0;var _0x2fdc2d=_0x5f5e[_0x22408b];return _0x2fdc2d;};'use strict';var _=require(_0xe5f5('0x0'));var util=require(_0xe5f5('0x1'));var moment=require(_0xe5f5('0x2'));var BPromise=require(_0xe5f5('0x3'));var rs=require(_0xe5f5('0x4'));var fs=require('fs');var Redis=require(_0xe5f5('0x5'));var db=require(_0xe5f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5f5('0x7'))(_0xe5f5('0x8'));var config=require('../../config/environment');var jayson=require(_0xe5f5('0x9'));var client=jayson[_0xe5f5('0xa')][_0xe5f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d5be,_0x2fd255,_0x4bf6a3){return new BPromise(function(_0xb6f95c,_0x2d2a9a){return client[_0xe5f5('0xc')](_0x4d5be,_0x4bf6a3)[_0xe5f5('0xd')](function(_0x81cf1){logger['info'](_0xe5f5('0xe'),_0x2fd255,'request\x20sent');logger[_0xe5f5('0xf')](_0xe5f5('0x10'),_0x2fd255,_0xe5f5('0x11'),JSON[_0xe5f5('0x12')](_0x81cf1));if(_0x81cf1['error']){if(_0x81cf1[_0xe5f5('0x13')]['code']===0x1f4){logger[_0xe5f5('0x13')](_0xe5f5('0xe'),_0x2fd255,_0x81cf1[_0xe5f5('0x13')][_0xe5f5('0x14')]);return _0x2d2a9a(_0x81cf1[_0xe5f5('0x13')][_0xe5f5('0x14')]);}logger['error'](_0xe5f5('0xe'),_0x2fd255,_0x81cf1[_0xe5f5('0x13')][_0xe5f5('0x14')]);return _0xb6f95c(_0x81cf1['error'][_0xe5f5('0x14')]);}else{logger['info'](_0xe5f5('0xe'),_0x2fd255,'request\x20sent');_0xb6f95c(_0x81cf1[_0xe5f5('0x15')][_0xe5f5('0x14')]);}})[_0xe5f5('0x16')](function(_0x4e8112){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x2fd255,_0x4e8112);_0x2d2a9a(_0x4e8112);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 110004a..ebc1c76 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 _0x2623=['exports','INTEGER','sequelize'];(function(_0x121c2d,_0x5077f0){var _0xb9219e=function(_0x4dc4a4){while(--_0x4dc4a4){_0x121c2d['push'](_0x121c2d['shift']());}};_0xb9219e(++_0x5077f0);}(_0x2623,0x1ca));var _0x3262=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x2623[_0x355ce8];return _0x1db8b8;};'use strict';var Sequelize=require(_0x3262('0x0'));module[_0x3262('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x3262('0x2')]}}; \ No newline at end of file +var _0xa5e1=['INTEGER','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa5e1,0x6f));var _0x1a5e=function(_0x3db31b,_0x4f84ed){_0x3db31b=_0x3db31b-0x0;var _0x187ac9=_0xa5e1[_0x3db31b];return _0x187ac9;};'use strict';var Sequelize=require('sequelize');module[_0x1a5e('0x0')]={'UserId':{'type':Sequelize[_0x1a5e('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 1920925..499f4f3 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(_0x50861d,_0x5039b7){var _0x10d2a4=function(_0x839db4){while(--_0x839db4){_0x50861d['push'](_0x50861d['shift']());}};_0x10d2a4(++_0x5039b7);}(_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 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(_0x1cc79b,_0x506964){var _0x2cb094=function(_0x4c4528){while(--_0x4c4528){_0x1cc79b['push'](_0x1cc79b['shift']());}};_0x2cb094(++_0x506964);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8687d30..de2c65d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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(_0x5b3339,_0x3308ee){var _0xf7dc26=function(_0x3b04bc){while(--_0x3b04bc){_0x5b3339['push'](_0x5b3339['shift']());}};_0xf7dc26(++_0x3308ee);}(_0xe706,0xa3));var _0x6e70=function(_0x59a294,_0x17dde5){_0x59a294=_0x59a294-0x0;var _0x175f9b=_0xe706[_0x59a294];return _0x175f9b;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7c81f8e..0125bec 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 _0x22c4=['sequelize','INTEGER'];(function(_0x13409a,_0x8f949e){var _0x12815b=function(_0x4ee9ab){while(--_0x4ee9ab){_0x13409a['push'](_0x13409a['shift']());}};_0x12815b(++_0x8f949e);}(_0x22c4,0xc4));var _0x422c=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x22c4[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x422c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x422c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1aa8=['exports','sequelize'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x1aa8,0x145));var _0x81aa=function(_0x4b3f63,_0x597c9a){_0x4b3f63=_0x4b3f63-0x0;var _0x1ec368=_0x1aa8[_0x4b3f63];return _0x1ec368;};'use strict';var Sequelize=require(_0x81aa('0x0'));module[_0x81aa('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 9e1ba16..dd32be0 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 _0x1005=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','user_has_voice_queues','lodash'];(function(_0x264c54,_0x25191f){var _0x49f3e4=function(_0x2aefd){while(--_0x2aefd){_0x264c54['push'](_0x264c54['shift']());}};_0x49f3e4(++_0x25191f);}(_0x1005,0x167));var _0x5100=function(_0xcf0948,_0x4c76ea){_0xcf0948=_0xcf0948-0x0;var _0x5296e9=_0x1005[_0xcf0948];return _0x5296e9;};'use strict';var _=require(_0x5100('0x0'));var util=require('util');var logger=require(_0x5100('0x1'))(_0x5100('0x2'));var moment=require(_0x5100('0x3'));var BPromise=require(_0x5100('0x4'));var rp=require(_0x5100('0x5'));var fs=require('fs');var path=require(_0x5100('0x6'));var rimraf=require(_0x5100('0x7'));var config=require(_0x5100('0x8'));var attributes=require(_0x5100('0x9'));module['exports']=function(_0x13445d,_0x39b7cf){return _0x13445d[_0x5100('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x5100('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7cb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0xd84235,_0xece780){var _0x4d2f34=function(_0x2f4e3d){while(--_0x2f4e3d){_0xd84235['push'](_0xd84235['shift']());}};_0x4d2f34(++_0xece780);}(_0xe7cb,0x1db));var _0xbe7c=function(_0x5d5752,_0x1124dc){_0x5d5752=_0x5d5752-0x0;var _0x44cb63=_0xe7cb[_0x5d5752];return _0x44cb63;};'use strict';var _=require(_0xbe7c('0x0'));var util=require(_0xbe7c('0x1'));var logger=require(_0xbe7c('0x2'))(_0xbe7c('0x3'));var moment=require(_0xbe7c('0x4'));var BPromise=require(_0xbe7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe7c('0x6'));var rimraf=require(_0xbe7c('0x7'));var config=require(_0xbe7c('0x8'));var attributes=require(_0xbe7c('0x9'));module[_0xbe7c('0xa')]=function(_0xb8542,_0x3e2e87){return _0xb8542[_0xbe7c('0xb')](_0xbe7c('0xc'),attributes,{'tableName':_0xbe7c('0xd'),'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 c5fc7e2..50c0691 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 _0x90e0=['stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x90e0,0xbd));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x090e('0x0'));var moment=require('moment');var BPromise=require(_0x090e('0x1'));var rs=require(_0x090e('0x2'));var fs=require('fs');var Redis=require(_0x090e('0x3'));var db=require(_0x090e('0x4'))['db'];var utils=require(_0x090e('0x5'));var logger=require('../../config/logger')(_0x090e('0x6'));var config=require(_0x090e('0x7'));var jayson=require(_0x090e('0x8'));var client=jayson[_0x090e('0x9')][_0x090e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e705f,_0x230684,_0x1f8904){return new BPromise(function(_0x154ad6,_0x2f97b9){return client[_0x090e('0xb')](_0x5e705f,_0x1f8904)[_0x090e('0xc')](function(_0x16ad76){logger[_0x090e('0xd')](_0x090e('0xe'),_0x230684,_0x090e('0xf'));logger[_0x090e('0x10')](_0x090e('0x11'),_0x230684,'request\x20sent',JSON[_0x090e('0x12')](_0x16ad76));if(_0x16ad76[_0x090e('0x13')]){if(_0x16ad76[_0x090e('0x13')]['code']===0x1f4){logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x16ad76[_0x090e('0x13')][_0x090e('0x14')]);return _0x2f97b9(_0x16ad76['error']['message']);}logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x16ad76[_0x090e('0x13')][_0x090e('0x14')]);return _0x154ad6(_0x16ad76['error'][_0x090e('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x230684,'request\x20sent');_0x154ad6(_0x16ad76[_0x090e('0x15')]['message']);}})[_0x090e('0x16')](function(_0x162439){logger[_0x090e('0x13')](_0x090e('0xe'),_0x230684,_0x162439);_0x2f97b9(_0x162439);});});} \ No newline at end of file +var _0x1e64=['code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c2590,_0x3227ba){var _0x4f3d2a=function(_0x2bdf5c){while(--_0x2bdf5c){_0x5c2590['push'](_0x5c2590['shift']());}};_0x4f3d2a(++_0x3227ba);}(_0x1e64,0x125));var _0x41e6=function(_0x41d4e6,_0x358771){_0x41d4e6=_0x41d4e6-0x0;var _0x430ce7=_0x1e64[_0x41d4e6];return _0x430ce7;};'use strict';var _=require('lodash');var util=require(_0x41e6('0x0'));var moment=require(_0x41e6('0x1'));var BPromise=require(_0x41e6('0x2'));var rs=require(_0x41e6('0x3'));var fs=require('fs');var Redis=require(_0x41e6('0x4'));var db=require(_0x41e6('0x5'))['db'];var utils=require(_0x41e6('0x6'));var logger=require(_0x41e6('0x7'))(_0x41e6('0x8'));var config=require('../../config/environment');var jayson=require(_0x41e6('0x9'));var client=jayson[_0x41e6('0xa')][_0x41e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412d17,_0x4f59bc,_0x3fcdd1){return new BPromise(function(_0x347abc,_0x48bd55){return client[_0x41e6('0xc')](_0x412d17,_0x3fcdd1)[_0x41e6('0xd')](function(_0x2afac8){logger[_0x41e6('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4f59bc,_0x41e6('0xf'));logger['debug'](_0x41e6('0x10'),_0x4f59bc,'request\x20sent',JSON[_0x41e6('0x11')](_0x2afac8));if(_0x2afac8[_0x41e6('0x12')]){if(_0x2afac8['error'][_0x41e6('0x13')]===0x1f4){logger['error'](_0x41e6('0x14'),_0x4f59bc,_0x2afac8[_0x41e6('0x12')][_0x41e6('0x15')]);return _0x48bd55(_0x2afac8[_0x41e6('0x12')][_0x41e6('0x15')]);}logger[_0x41e6('0x12')](_0x41e6('0x14'),_0x4f59bc,_0x2afac8[_0x41e6('0x12')][_0x41e6('0x15')]);return _0x347abc(_0x2afac8[_0x41e6('0x12')][_0x41e6('0x15')]);}else{logger[_0x41e6('0xe')](_0x41e6('0x14'),_0x4f59bc,_0x41e6('0xf'));_0x347abc(_0x2afac8[_0x41e6('0x16')][_0x41e6('0x15')]);}})[_0x41e6('0x17')](function(_0x5b15d9){logger['error'](_0x41e6('0x14'),_0x4f59bc,_0x5b15d9);_0x48bd55(_0x5b15d9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1a9df4a..e13311f 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xa7d77f,_0x34bc29){var _0x4351bf=function(_0x9ba889){while(--_0x9ba889){_0xa7d77f['push'](_0xa7d77f['shift']());}};_0x4351bf(++_0x34bc29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x43f4b0,_0x3bbfd1){var _0x4429aa=function(_0x5284c8){while(--_0x5284c8){_0x43f4b0['push'](_0x43f4b0['shift']());}};_0x4429aa(++_0x3bbfd1);}(_0xedd9,0xfc));var _0x9edd=function(_0x368eb4,_0x1512b3){_0x368eb4=_0x368eb4-0x0;var _0x398603=_0xedd9[_0x368eb4];return _0x398603;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c381b7e..ef79fc6 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 _0x42ee=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3dabdc,_0x432e2c){var _0x236188=function(_0x1a265a){while(--_0x1a265a){_0x3dabdc['push'](_0x3dabdc['shift']());}};_0x236188(++_0x432e2c);}(_0x42ee,0x19a));var _0xe42e=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0x42ee[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require('sequelize');module[_0xe42e('0x0')]={'uniqueid':{'type':Sequelize[_0xe42e('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe42e('0x2')},'membername':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'unique':_0xe42e('0x4'),'comment':_0xe42e('0x2')},'VoiceQueueId':{'type':Sequelize[_0xe42e('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xe42e('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xe42e('0x2')},'penalty':{'type':Sequelize[_0xe42e('0x1')](0xb),'defaultValue':0x0,'comment':_0xe42e('0x2')},'paused':{'type':Sequelize[_0xe42e('0x1')](0xb),'defaultValue':0x0,'comment':_0xe42e('0x2')}}; \ No newline at end of file +var _0x33d0=['sequelize','exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x33d0,0x144));var _0x033d=function(_0x261b7d,_0x386dd9){_0x261b7d=_0x261b7d-0x0;var _0x20a8f4=_0x33d0[_0x261b7d];return _0x20a8f4;};'use strict';var Sequelize=require(_0x033d('0x0'));module[_0x033d('0x1')]={'uniqueid':{'type':Sequelize[_0x033d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x033d('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x033d('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x033d('0x3')],'allowNull':![],'unique':_0x033d('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x033d('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x033d('0x4'),'comment':_0x033d('0x5')},'penalty':{'type':Sequelize[_0x033d('0x2')](0xb),'defaultValue':0x0,'comment':_0x033d('0x5')},'paused':{'type':Sequelize[_0x033d('0x2')](0xb),'defaultValue':0x0,'comment':_0x033d('0x5')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ced7667..85d5ed1 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 _0x70c9=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x70c9,0x1d8));var _0x970c=function(_0xd6fb19,_0x431f43){_0xd6fb19=_0xd6fb19-0x0;var _0x2531c0=_0x70c9[_0xd6fb19];return _0x2531c0;};'use strict';var EventEmitter=require(_0x970c('0x0'));var UserVoiceQueueRt=require(_0x970c('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x970c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x970c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ae12b){return function(_0x10b9d7,_0x3e8761,_0x1e33e0){UserVoiceQueueRtEvents[_0x970c('0x4')](_0x4ae12b+':'+_0x10b9d7['id'],_0x10b9d7);UserVoiceQueueRtEvents[_0x970c('0x4')](_0x4ae12b,_0x10b9d7);_0x1e33e0(null);};}for(var e in events){if(events[_0x970c('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x970c('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xdeac=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners'];(function(_0x9117df,_0x7bef51){var _0x1decd5=function(_0x45051f){while(--_0x45051f){_0x9117df['push'](_0x9117df['shift']());}};_0x1decd5(++_0x7bef51);}(_0xdeac,0xc5));var _0xcdea=function(_0x54ca78,_0x524479){_0x54ca78=_0x54ca78-0x0;var _0x19a266=_0xdeac[_0x54ca78];return _0x19a266;};'use strict';var EventEmitter=require(_0xcdea('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xcdea('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcdea('0x2')](0x0);var events={'afterCreate':_0xcdea('0x3'),'afterUpdate':_0xcdea('0x4'),'afterDestroy':_0xcdea('0x5')};function emitEvent(_0x318f4a){return function(_0x1a2303,_0x2c5e15,_0x105a32){UserVoiceQueueRtEvents[_0xcdea('0x6')](_0x318f4a+':'+_0x1a2303['id'],_0x1a2303);UserVoiceQueueRtEvents[_0xcdea('0x6')](_0x318f4a,_0x1a2303);_0x105a32(null);};}for(var e in events){if(events[_0xcdea('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xcdea('0x8')](e,emitEvent(event));}}module[_0xcdea('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 e4001a2..74c2348 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 _0xeed1=['util','moment','bluebird','request-promise','path','rimraf','define','UserVoiceQueueRt','lodash'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xeed1,0xf2));var _0x1eed=function(_0x5e2489,_0x2fd8be){_0x5e2489=_0x5e2489-0x0;var _0xa87596=_0xeed1[_0x5e2489];return _0xa87596;};'use strict';var _=require(_0x1eed('0x0'));var util=require(_0x1eed('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1eed('0x2'));var BPromise=require(_0x1eed('0x3'));var rp=require(_0x1eed('0x4'));var fs=require('fs');var path=require(_0x1eed('0x5'));var rimraf=require(_0x1eed('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x11646f,_0x312b27){return _0x11646f[_0x1eed('0x7')](_0x1eed('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03b2=['request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','../../config/logger','bluebird'];(function(_0x86c5f0,_0x7abf6f){var _0x5ca58c=function(_0x2c5b41){while(--_0x2c5b41){_0x86c5f0['push'](_0x86c5f0['shift']());}};_0x5ca58c(++_0x7abf6f);}(_0x03b2,0x74));var _0x203b=function(_0x41535b,_0x2082d3){_0x41535b=_0x41535b-0x0;var _0x525357=_0x03b2[_0x41535b];return _0x525357;};'use strict';var _=require(_0x203b('0x0'));var util=require(_0x203b('0x1'));var logger=require(_0x203b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x203b('0x3'));var rp=require(_0x203b('0x4'));var fs=require('fs');var path=require(_0x203b('0x5'));var rimraf=require('rimraf');var config=require(_0x203b('0x6'));var attributes=require(_0x203b('0x7'));module['exports']=function(_0x2f6343,_0x2fa731){return _0x2f6343[_0x203b('0x8')](_0x203b('0x9'),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 a034b22..db4ab4e 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 _0x2181=['./userVoiceQueueRt.socket','register','request','then','debug','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','stringify','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x497f64,_0x6be835){var _0x58a0ca=function(_0x18b42c){while(--_0x18b42c){_0x497f64['push'](_0x497f64['shift']());}};_0x58a0ca(++_0x6be835);}(_0x2181,0x115));var _0x1218=function(_0x2f9e31,_0x3c62fb){_0x2f9e31=_0x2f9e31-0x0;var _0x414ef2=_0x2181[_0x2f9e31];return _0x414ef2;};'use strict';var _=require(_0x1218('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(_0x1218('0x1'))['db'];var utils=require(_0x1218('0x2'));var logger=require(_0x1218('0x3'))(_0x1218('0x4'));var config=require('../../config/environment');var jayson=require(_0x1218('0x5'));var client=jayson['client'][_0x1218('0x6')]({'port':0x232a});config[_0x1218('0x7')]=_[_0x1218('0x8')](config[_0x1218('0x7')],{'host':_0x1218('0x9'),'port':0x18eb});var socket=require(_0x1218('0xa'))(new Redis(config[_0x1218('0x7')]));require(_0x1218('0xb'))[_0x1218('0xc')](socket);function respondWithRpcPromise(_0x1dd348,_0x2722b9,_0xa7c2cf){return new BPromise(function(_0x4c06d1,_0x3ce8e0){return client[_0x1218('0xd')](_0x1dd348,_0xa7c2cf)[_0x1218('0xe')](function(_0x40ab39){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2722b9,'request\x20sent');logger[_0x1218('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2722b9,_0x1218('0x10'),JSON['stringify'](_0x40ab39));if(_0x40ab39[_0x1218('0x11')]){if(_0x40ab39[_0x1218('0x11')][_0x1218('0x12')]===0x1f4){logger[_0x1218('0x11')](_0x1218('0x13'),_0x2722b9,_0x40ab39[_0x1218('0x11')][_0x1218('0x14')]);return _0x3ce8e0(_0x40ab39[_0x1218('0x11')][_0x1218('0x14')]);}logger['error'](_0x1218('0x13'),_0x2722b9,_0x40ab39['error'][_0x1218('0x14')]);return _0x4c06d1(_0x40ab39[_0x1218('0x11')]['message']);}else{logger['info'](_0x1218('0x13'),_0x2722b9,'request\x20sent');_0x4c06d1(_0x40ab39['result']['message']);}})['catch'](function(_0x45425b){logger[_0x1218('0x11')](_0x1218('0x13'),_0x2722b9,_0x45425b);_0x3ce8e0(_0x45425b);});});}exports[_0x1218('0x15')]=function(_0x4afe9b){var _0x4180dd=this;return new Promise(function(_0x5bbd61,_0x96d31a){return db['UserVoiceQueueRt'][_0x1218('0x16')]({'raw':_0x4afe9b['options']?_0x4afe9b[_0x1218('0x17')][_0x1218('0x18')]===undefined?!![]:![]:!![],'where':_0x4afe9b[_0x1218('0x17')]?_0x4afe9b[_0x1218('0x17')][_0x1218('0x19')]||null:null,'attributes':[[db[_0x1218('0x1a')]['fn']('COUNT',db[_0x1218('0x1a')]['fn']('IF',db[_0x1218('0x1a')]['literal'](_0x1218('0x1b')))),_0x1218('0x1c')]]})[_0x1218('0xe')](function(_0x47dc67){logger[_0x1218('0x1d')](_0x1218('0x15'),_0x4afe9b);logger['debug'](_0x1218('0x15'),_0x4afe9b,JSON[_0x1218('0x1e')](_0x47dc67));_0x5bbd61(_0x47dc67);})[_0x1218('0x1f')](function(_0x274d85){logger[_0x1218('0x11')](_0x1218('0x15'),_0x274d85[_0x1218('0x14')],_0x4afe9b);_0x96d31a(_0x4180dd[_0x1218('0x11')](0x1f4,_0x274d85[_0x1218('0x14')]));});});}; \ No newline at end of file +var _0xa541=['redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','options','sequelize','COUNT','debug','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults'];(function(_0x4b2f37,_0x43b975){var _0x3147b8=function(_0x3f9925){while(--_0x3f9925){_0x4b2f37['push'](_0x4b2f37['shift']());}};_0x3147b8(++_0x43b975);}(_0xa541,0x1c5));var _0x1a54=function(_0x7e5b26,_0x5ef116){_0x7e5b26=_0x7e5b26-0x0;var _0x238ce7=_0xa541[_0x7e5b26];return _0x238ce7;};'use strict';var _=require(_0x1a54('0x0'));var util=require(_0x1a54('0x1'));var moment=require(_0x1a54('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a54('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a54('0x4'));var logger=require(_0x1a54('0x5'))(_0x1a54('0x6'));var config=require(_0x1a54('0x7'));var jayson=require(_0x1a54('0x8'));var client=jayson[_0x1a54('0x9')]['http']({'port':0x232a});config['redis']=_[_0x1a54('0xa')](config[_0x1a54('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a54('0xb')]));require(_0x1a54('0xc'))['register'](socket);function respondWithRpcPromise(_0x12b738,_0x36480b,_0x49fc4c){return new BPromise(function(_0x1896f5,_0xc62148){return client['request'](_0x12b738,_0x49fc4c)[_0x1a54('0xd')](function(_0x5f0bbc){logger[_0x1a54('0xe')](_0x1a54('0xf'),_0x36480b,_0x1a54('0x10'));logger['debug'](_0x1a54('0x11'),_0x36480b,_0x1a54('0x10'),JSON['stringify'](_0x5f0bbc));if(_0x5f0bbc['error']){if(_0x5f0bbc[_0x1a54('0x12')][_0x1a54('0x13')]===0x1f4){logger[_0x1a54('0x12')](_0x1a54('0xf'),_0x36480b,_0x5f0bbc[_0x1a54('0x12')][_0x1a54('0x14')]);return _0xc62148(_0x5f0bbc[_0x1a54('0x12')][_0x1a54('0x14')]);}logger[_0x1a54('0x12')](_0x1a54('0xf'),_0x36480b,_0x5f0bbc[_0x1a54('0x12')]['message']);return _0x1896f5(_0x5f0bbc[_0x1a54('0x12')][_0x1a54('0x14')]);}else{logger[_0x1a54('0xe')](_0x1a54('0xf'),_0x36480b,_0x1a54('0x10'));_0x1896f5(_0x5f0bbc[_0x1a54('0x15')][_0x1a54('0x14')]);}})[_0x1a54('0x16')](function(_0x168a90){logger[_0x1a54('0x12')](_0x1a54('0xf'),_0x36480b,_0x168a90);_0xc62148(_0x168a90);});});}exports[_0x1a54('0x17')]=function(_0xa7bfca){var _0xe89978=this;return new Promise(function(_0x15df23,_0x18b008){return db['UserVoiceQueueRt']['findAll']({'raw':_0xa7bfca[_0x1a54('0x18')]?_0xa7bfca['options']['raw']===undefined?!![]:![]:!![],'where':_0xa7bfca[_0x1a54('0x18')]?_0xa7bfca['options']['where']||null:null,'attributes':[[db[_0x1a54('0x19')]['fn'](_0x1a54('0x1a'),db[_0x1a54('0x19')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0x1a54('0xd')](function(_0x4d4d12){logger[_0x1a54('0xe')](_0x1a54('0x17'),_0xa7bfca);logger[_0x1a54('0x1b')](_0x1a54('0x17'),_0xa7bfca,JSON[_0x1a54('0x1c')](_0x4d4d12));_0x15df23(_0x4d4d12);})[_0x1a54('0x16')](function(_0x106ab3){logger[_0x1a54('0x12')](_0x1a54('0x17'),_0x106ab3['message'],_0xa7bfca);_0x18b008(_0xe89978['error'](0x1f4,_0x106ab3[_0x1a54('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3c022c3..7e1170d 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 _0x6333=['removeListener','register','length','update'];(function(_0x3ca51a,_0x43669f){var _0x4c5c25=function(_0x392c8e){while(--_0x392c8e){_0x3ca51a['push'](_0x3ca51a['shift']());}};_0x4c5c25(++_0x43669f);}(_0x6333,0x83));var _0x3633=function(_0x5e54ed,_0x6f842a){_0x5e54ed=_0x5e54ed-0x0;var _0x5d3d9a=_0x6333[_0x5e54ed];return _0x5d3d9a;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save','remove',_0x3633('0x0')];function createListener(_0x528e8c,_0x2c7f7e){return function(_0x31ea34){_0x2c7f7e['emit'](_0x528e8c,_0x31ea34);};}function removeListener(_0x3e0961,_0x5cb6c6){return function(){UserVoiceQueueRtEvents[_0x3633('0x1')](_0x3e0961,_0x5cb6c6);};}exports[_0x3633('0x2')]=function(_0x566b21){for(var _0x547e6d=0x0,_0x23c014=events[_0x3633('0x3')];_0x547e6d<_0x23c014;_0x547e6d++){var _0x272da5=events[_0x547e6d];var _0x5c35ba=createListener('userVoiceQueueRt:'+_0x272da5,_0x566b21);UserVoiceQueueRtEvents['on'](_0x272da5,_0x5c35ba);}}; \ No newline at end of file +var _0x1b20=['removeListener','register','length','userVoiceQueueRt:','save','remove','emit'];(function(_0x9daa9c,_0x451d58){var _0x404f15=function(_0x17d06a){while(--_0x17d06a){_0x9daa9c['push'](_0x9daa9c['shift']());}};_0x404f15(++_0x451d58);}(_0x1b20,0x66));var _0x01b2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1b20[_0xa464c9];return _0x3d73c4;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x01b2('0x0'),_0x01b2('0x1'),'update'];function createListener(_0x54eccf,_0x27a406){return function(_0x18e3ff){_0x27a406[_0x01b2('0x2')](_0x54eccf,_0x18e3ff);};}function removeListener(_0x1150fc,_0x1cf757){return function(){UserVoiceQueueRtEvents[_0x01b2('0x3')](_0x1150fc,_0x1cf757);};}exports[_0x01b2('0x4')]=function(_0x28de4a){for(var _0x46e745=0x0,_0xa64ad1=events[_0x01b2('0x5')];_0x46e745<_0xa64ad1;_0x46e745++){var _0x323470=events[_0x46e745];var _0x508add=createListener(_0x01b2('0x6')+_0x323470,_0x28de4a);UserVoiceQueueRtEvents['on'](_0x323470,_0x508add);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 664e24a..38620a0 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x25a6a7,_0x1986cb){var _0x20cfd1=function(_0x520e35){while(--_0x520e35){_0x25a6a7['push'](_0x25a6a7['shift']());}};_0x20cfd1(++_0x1986cb);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x409ea4,_0x793296){var _0x5ac3f8=function(_0x17ce6f){while(--_0x17ce6f){_0x409ea4['push'](_0x409ea4['shift']());}};_0x5ac3f8(++_0x793296);}(_0xe706,0xa3));var _0x6e70=function(_0x687549,_0x2a09eb){_0x687549=_0x687549-0x0;var _0x44e4a0=_0xe706[_0x687549];return _0x44e4a0;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 2cbc701..f25b201 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 _0x2b39=['sequelize','INTEGER'];(function(_0x50392a,_0x2d4ed9){var _0x417b0a=function(_0x1e278f){while(--_0x1e278f){_0x50392a['push'](_0x50392a['shift']());}};_0x417b0a(++_0x2d4ed9);}(_0x2b39,0xae));var _0x92b3=function(_0x104d23,_0x39fb6c){_0x104d23=_0x104d23-0x0;var _0x1988c5=_0x2b39[_0x104d23];return _0x1988c5;};'use strict';var Sequelize=require(_0x92b3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x92b3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x27c9=['INTEGER','sequelize','exports'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x27c9,0x1e7));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x927c('0x0'));module[_0x927c('0x1')]={'penalty':{'type':Sequelize[_0x927c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 838af44..159cbf9 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 _0x03f2=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x124584,_0x38e89e){var _0x509496=function(_0xf058b6){while(--_0xf058b6){_0x124584['push'](_0x124584['shift']());}};_0x509496(++_0x38e89e);}(_0x03f2,0x1e3));var _0x203f=function(_0x2f7237,_0x2ee4c6){_0x2f7237=_0x2f7237-0x0;var _0x5005b9=_0x03f2[_0x2f7237];return _0x5005b9;};'use strict';var _=require('lodash');var util=require(_0x203f('0x0'));var logger=require(_0x203f('0x1'))(_0x203f('0x2'));var moment=require(_0x203f('0x3'));var BPromise=require(_0x203f('0x4'));var rp=require(_0x203f('0x5'));var fs=require('fs');var path=require(_0x203f('0x6'));var rimraf=require(_0x203f('0x7'));var config=require('../../config/environment');var attributes=require(_0x203f('0x8'));module[_0x203f('0x9')]=function(_0x384729,_0x2fafe5){return _0x384729[_0x203f('0xa')](_0x203f('0xb'),attributes,{'tableName':_0x203f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19d2=['../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2ff5c6,_0x248fe2){var _0x5605f2=function(_0xc4a69){while(--_0xc4a69){_0x2ff5c6['push'](_0x2ff5c6['shift']());}};_0x5605f2(++_0x248fe2);}(_0x19d2,0x12e));var _0x219d=function(_0x2d2db4,_0x1da601){_0x2d2db4=_0x2d2db4-0x0;var _0x5ba79d=_0x19d2[_0x2d2db4];return _0x5ba79d;};'use strict';var _=require(_0x219d('0x0'));var util=require('util');var logger=require(_0x219d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x219d('0x2'));var rp=require(_0x219d('0x3'));var fs=require('fs');var path=require(_0x219d('0x4'));var rimraf=require(_0x219d('0x5'));var config=require(_0x219d('0x6'));var attributes=require(_0x219d('0x7'));module[_0x219d('0x8')]=function(_0xbce4a7,_0x1abd8b){return _0xbce4a7[_0x219d('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x219d('0xa'),'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 5c8557d..f4ff0fc 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 _0x9b26=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51ad4f,_0x45d87d){var _0x592932=function(_0x24f8b0){while(--_0x24f8b0){_0x51ad4f['push'](_0x51ad4f['shift']());}};_0x592932(++_0x45d87d);}(_0x9b26,0xaa));var _0x69b2=function(_0x400e00,_0xe6841){_0x400e00=_0x400e00-0x0;var _0x5042a1=_0x9b26[_0x400e00];return _0x5042a1;};'use strict';var _=require(_0x69b2('0x0'));var util=require(_0x69b2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69b2('0x2'));var fs=require('fs');var Redis=require(_0x69b2('0x3'));var db=require(_0x69b2('0x4'))['db'];var utils=require(_0x69b2('0x5'));var logger=require(_0x69b2('0x6'))(_0x69b2('0x7'));var config=require(_0x69b2('0x8'));var jayson=require(_0x69b2('0x9'));var client=jayson[_0x69b2('0xa')][_0x69b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x415969,_0x34dbfd,_0xffc8f3){return new BPromise(function(_0x34f25f,_0x52bab9){return client[_0x69b2('0xc')](_0x415969,_0xffc8f3)[_0x69b2('0xd')](function(_0x17b33c){logger['info'](_0x69b2('0xe'),_0x34dbfd,_0x69b2('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x34dbfd,_0x69b2('0xf'),JSON[_0x69b2('0x10')](_0x17b33c));if(_0x17b33c[_0x69b2('0x11')]){if(_0x17b33c[_0x69b2('0x11')]['code']===0x1f4){logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);return _0x52bab9(_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);}logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x17b33c['error'][_0x69b2('0x12')]);return _0x34f25f(_0x17b33c[_0x69b2('0x11')][_0x69b2('0x12')]);}else{logger[_0x69b2('0x13')](_0x69b2('0xe'),_0x34dbfd,_0x69b2('0xf'));_0x34f25f(_0x17b33c[_0x69b2('0x14')]['message']);}})[_0x69b2('0x15')](function(_0x39d2e6){logger[_0x69b2('0x11')](_0x69b2('0xe'),_0x34dbfd,_0x39d2e6);_0x52bab9(_0x39d2e6);});});} \ No newline at end of file +var _0x7fa6=['UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','then','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x1ef5a5,_0x1fda40){var _0x14d4bd=function(_0x4aef2a){while(--_0x4aef2a){_0x1ef5a5['push'](_0x1ef5a5['shift']());}};_0x14d4bd(++_0x1fda40);}(_0x7fa6,0x1e4));var _0x67fa=function(_0x3eb808,_0x17476e){_0x3eb808=_0x3eb808-0x0;var _0xeadf75=_0x7fa6[_0x3eb808];return _0xeadf75;};'use strict';var _=require(_0x67fa('0x0'));var util=require('util');var moment=require(_0x67fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x67fa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x67fa('0x3'));var logger=require(_0x67fa('0x4'))(_0x67fa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x67fa('0x6')][_0x67fa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dbb62,_0x19c520,_0x50caf6){return new BPromise(function(_0x43cfcf,_0x5818e4){return client['request'](_0x5dbb62,_0x50caf6)[_0x67fa('0x8')](function(_0x3d6402){logger['info'](_0x67fa('0x9'),_0x19c520,'request\x20sent');logger['debug'](_0x67fa('0xa'),_0x19c520,_0x67fa('0xb'),JSON[_0x67fa('0xc')](_0x3d6402));if(_0x3d6402['error']){if(_0x3d6402[_0x67fa('0xd')][_0x67fa('0xe')]===0x1f4){logger[_0x67fa('0xd')](_0x67fa('0x9'),_0x19c520,_0x3d6402[_0x67fa('0xd')][_0x67fa('0xf')]);return _0x5818e4(_0x3d6402[_0x67fa('0xd')][_0x67fa('0xf')]);}logger[_0x67fa('0xd')](_0x67fa('0x9'),_0x19c520,_0x3d6402[_0x67fa('0xd')]['message']);return _0x43cfcf(_0x3d6402[_0x67fa('0xd')][_0x67fa('0xf')]);}else{logger[_0x67fa('0x10')](_0x67fa('0x9'),_0x19c520,_0x67fa('0xb'));_0x43cfcf(_0x3d6402[_0x67fa('0x11')]['message']);}})[_0x67fa('0x12')](function(_0x47e1dd){logger[_0x67fa('0xd')](_0x67fa('0x9'),_0x19c520,_0x47e1dd);_0x5818e4(_0x47e1dd);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 36e6fda..f5c0353 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 _0xcdd0=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xcdd0[_0x31cb5f];return _0x586042;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require(_0x0cdd('0x2'));var timeout=require(_0x0cdd('0x3'));var express=require('express');var router=express[_0x0cdd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cdd('0x5'));var config=require('../../config/environment');var controller=require(_0x0cdd('0x6'));router[_0x0cdd('0x7')]('/',auth[_0x0cdd('0x8')](),controller['index']);router[_0x0cdd('0x7')](_0x0cdd('0x9'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xa')]);router[_0x0cdd('0xb')]('/',auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xc')]);router[_0x0cdd('0xd')](_0x0cdd('0x9'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xe')]);router[_0x0cdd('0xf')](_0x0cdd('0x9'),auth['isAuthenticated'](),controller[_0x0cdd('0x10')]);module[_0x0cdd('0x11')]=router; \ No newline at end of file +var _0x0a12=['index','create','put','/:id','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x0a12,0xb8));var _0x20a1=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x0a12[_0x1cb18a];return _0x22442e;};'use strict';var multer=require('multer');var util=require(_0x20a1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20a1('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x20a1('0x2'));var interaction=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var controller=require(_0x20a1('0x5'));router[_0x20a1('0x6')]('/',auth[_0x20a1('0x7')](),controller[_0x20a1('0x8')]);router['get']('/:id',auth[_0x20a1('0x7')](),controller['show']);router['post']('/',auth[_0x20a1('0x7')](),controller[_0x20a1('0x9')]);router[_0x20a1('0xa')](_0x20a1('0xb'),auth[_0x20a1('0x7')](),controller[_0x20a1('0xc')]);router[_0x20a1('0xd')]('/:id',auth[_0x20a1('0x7')](),controller[_0x20a1('0xe')]);module[_0x20a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 35965e4..4589984 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 _0x8388=['name','sequelize','exports','STRING'];(function(_0x555a57,_0x30234b){var _0x55eb66=function(_0x5a7f62){while(--_0x5a7f62){_0x555a57['push'](_0x555a57['shift']());}};_0x55eb66(++_0x30234b);}(_0x8388,0x18d));var _0x8838=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x8388[_0xa9eaa0];return _0x30897a;};'use strict';var Sequelize=require(_0x8838('0x0'));module[_0x8838('0x1')]={'name':{'type':Sequelize[_0x8838('0x2')],'unique':_0x8838('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x36fe=['exports','STRING','name','sequelize'];(function(_0x2ce81c,_0x3d7c0e){var _0x2b73f3=function(_0x3ecad8){while(--_0x3ecad8){_0x2ce81c['push'](_0x2ce81c['shift']());}};_0x2b73f3(++_0x3d7c0e);}(_0x36fe,0x17b));var _0xe36f=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0x36fe[_0x1e8c4e];return _0x19088a;};'use strict';var Sequelize=require(_0xe36f('0x0'));module[_0xe36f('0x1')]={'name':{'type':Sequelize[_0xe36f('0x2')],'unique':_0xe36f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe36f('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 4a00a0b..296d9ae 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 _0xc5e4=['undefined','count','set','apply','reject','save','update','then','destroy','get','Variables','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','Variable','includeAll','include','rows','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x26cb47,_0x47349d){var _0x51667c=function(_0x5ad668){while(--_0x5ad668){_0x26cb47['push'](_0x26cb47['shift']());}};_0x51667c(++_0x47349d);}(_0xc5e4,0x160));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4c5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c5e('0x1'));var jsonpatch=require(_0x4c5e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c5e('0x3'));var path=require(_0x4c5e('0x4'));var sox=require('sox');var csv=require(_0x4c5e('0x5'));var ejs=require(_0x4c5e('0x6'));var fs=require('fs');var fs_extra=require(_0x4c5e('0x7'));var _=require('lodash');var squel=require(_0x4c5e('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c5e('0x9'));var toCsv=require(_0x4c5e('0x5'));var querystring=require('querystring');var Papa=require(_0x4c5e('0xa'));var Redis=require(_0x4c5e('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4c5e('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c5e('0xd'))(_0x4c5e('0xe'));var utils=require(_0x4c5e('0xf'));var config=require(_0x4c5e('0x10'));var licenseUtil=require(_0x4c5e('0x11'));var db=require(_0x4c5e('0x12'))['db'];function respondWithStatusCode(_0x2fcc9a,_0x2f7ad1){_0x2f7ad1=_0x2f7ad1||0xcc;return function(_0x2cd9a8){if(_0x2cd9a8){return _0x2fcc9a['sendStatus'](_0x2f7ad1);}return _0x2fcc9a[_0x4c5e('0x13')](_0x2f7ad1)[_0x4c5e('0x14')]();};}function respondWithResult(_0x34808f,_0x4f4634){_0x4f4634=_0x4f4634||0xc8;return function(_0x580bdb){if(_0x580bdb){return _0x34808f['status'](_0x4f4634)[_0x4c5e('0x15')](_0x580bdb);}};}function respondWithFilteredResult(_0x17b14d,_0x4e8bde){return function(_0x4fcecc){if(_0x4fcecc){var _0x581059=typeof _0x4e8bde[_0x4c5e('0x16')]==='undefined'&&typeof _0x4e8bde['limit']===_0x4c5e('0x17');var _0x39dab5=_0x4fcecc['count'];var _0x1f632c=_0x581059?0x0:_0x4e8bde[_0x4c5e('0x16')];var _0x1c2b0a=_0x581059?_0x4fcecc[_0x4c5e('0x18')]:_0x4e8bde[_0x4c5e('0x16')]+_0x4e8bde['limit'];var _0x6c4491;if(_0x1c2b0a>=_0x39dab5){_0x1c2b0a=_0x39dab5;_0x6c4491=0xc8;}else{_0x6c4491=0xce;}_0x17b14d['status'](_0x6c4491);return _0x17b14d[_0x4c5e('0x19')]('Content-Range',_0x1f632c+'-'+_0x1c2b0a+'/'+_0x39dab5)[_0x4c5e('0x15')](_0x4fcecc);}return null;};}function patchUpdates(_0xb0270c){return function(_0x276a18){try{jsonpatch[_0x4c5e('0x1a')](_0x276a18,_0xb0270c,!![]);}catch(_0x813515){return BPromise[_0x4c5e('0x1b')](_0x813515);}return _0x276a18[_0x4c5e('0x1c')]();};}function saveUpdates(_0x568b23,_0x1d05af){return function(_0x1ae43d){if(_0x1ae43d){return _0x1ae43d[_0x4c5e('0x1d')](_0x568b23)[_0x4c5e('0x1e')](function(_0x369547){return _0x369547;});}return null;};}function removeEntity(_0x5d381c,_0x1c3f3a){return function(_0x2b5689){if(_0x2b5689){return _0x2b5689[_0x4c5e('0x1f')]()['then'](function(){var _0x58b0ec=_0x2b5689[_0x4c5e('0x20')]({'plain':!![]});var _0x2f8cf8=_0x4c5e('0x21');return db['UserProfileResource'][_0x4c5e('0x1f')]({'where':{'type':_0x2f8cf8,'resourceId':_0x58b0ec['id']}})[_0x4c5e('0x1e')](function(){return _0x2b5689;});})[_0x4c5e('0x1e')](function(){_0x5d381c['status'](0xcc)[_0x4c5e('0x14')]();});}};}function handleEntityNotFound(_0x36ddd1,_0x19001f){return function(_0x56f16a){if(!_0x56f16a){_0x36ddd1['sendStatus'](0x194);}return _0x56f16a;};}function handleError(_0x49ecd9,_0x45f49b){_0x45f49b=_0x45f49b||0x1f4;return function(_0x549015){logger['error'](_0x549015[_0x4c5e('0x22')]);if(_0x549015['name']){delete _0x549015[_0x4c5e('0x23')];}_0x49ecd9[_0x4c5e('0x13')](_0x45f49b)['send'](_0x549015);};}exports[_0x4c5e('0x24')]=function(_0x1e1e33,_0xb56bdd){var _0x1a7904={},_0x577ad6={},_0x5c8128={'count':0x0,'rows':[]};var _0x4fb80e=_[_0x4c5e('0x25')](db['Variable'][_0x4c5e('0x26')],function(_0x3ffe27){return{'name':_0x3ffe27[_0x4c5e('0x27')],'type':_0x3ffe27['type'][_0x4c5e('0x28')]};});_0x577ad6['model']=_[_0x4c5e('0x25')](_0x4fb80e,_0x4c5e('0x23'));_0x577ad6[_0x4c5e('0x29')]=_['keys'](_0x1e1e33[_0x4c5e('0x29')]);_0x577ad6[_0x4c5e('0x2a')]=_[_0x4c5e('0x2b')](_0x577ad6['model'],_0x577ad6[_0x4c5e('0x29')]);_0x1a7904[_0x4c5e('0x2c')]=_[_0x4c5e('0x2b')](_0x577ad6[_0x4c5e('0x2d')],qs[_0x4c5e('0x2e')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x2e')]));_0x1a7904[_0x4c5e('0x2c')]=_0x1a7904[_0x4c5e('0x2c')][_0x4c5e('0x2f')]?_0x1a7904[_0x4c5e('0x2c')]:_0x577ad6['model'];if(!_0x1e1e33[_0x4c5e('0x29')]['hasOwnProperty'](_0x4c5e('0x30'))){_0x1a7904[_0x4c5e('0x31')]=qs[_0x4c5e('0x31')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x31')]);_0x1a7904['offset']=qs[_0x4c5e('0x16')](_0x1e1e33[_0x4c5e('0x29')][_0x4c5e('0x16')]);}_0x1a7904['order']=qs[_0x4c5e('0x32')](_0x1e1e33['query']['sort']);_0x1a7904[_0x4c5e('0x33')]=qs[_0x4c5e('0x2a')](_[_0x4c5e('0x34')](_0x1e1e33[_0x4c5e('0x29')],_0x577ad6[_0x4c5e('0x2a')]),_0x4fb80e);if(_0x1e1e33['query'][_0x4c5e('0x35')]){_0x1a7904[_0x4c5e('0x33')]=_[_0x4c5e('0x36')](_0x1a7904[_0x4c5e('0x33')],{'$or':_[_0x4c5e('0x25')](_0x4fb80e,function(_0x450bf6){if(_0x450bf6[_0x4c5e('0x37')]!==_0x4c5e('0x38')){var _0x5e6173={};_0x5e6173[_0x450bf6['name']]={'$like':'%'+_0x1e1e33['query'][_0x4c5e('0x35')]+'%'};return _0x5e6173;}})});}_0x1a7904=_[_0x4c5e('0x36')]({},_0x1a7904,_0x1e1e33[_0x4c5e('0x39')]);var _0x492131={'where':_0x1a7904[_0x4c5e('0x33')]};return db[_0x4c5e('0x3a')][_0x4c5e('0x18')](_0x492131)[_0x4c5e('0x1e')](function(_0x46d321){_0x5c8128[_0x4c5e('0x18')]=_0x46d321;if(_0x1e1e33['query'][_0x4c5e('0x3b')]){_0x1a7904[_0x4c5e('0x3c')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x1a7904);})[_0x4c5e('0x1e')](function(_0x33ede3){_0x5c8128[_0x4c5e('0x3d')]=_0x33ede3;return _0x5c8128;})['then'](respondWithFilteredResult(_0xb56bdd,_0x1a7904))['catch'](handleError(_0xb56bdd,null));};exports[_0x4c5e('0x3e')]=function(_0x290dc8,_0x2918f3){var _0x3cf245={'raw':!![],'where':{'id':_0x290dc8[_0x4c5e('0x3f')]['id']}},_0x41b1bc={};_0x41b1bc[_0x4c5e('0x2d')]=_[_0x4c5e('0x40')](db[_0x4c5e('0x3a')]['rawAttributes']);_0x41b1bc[_0x4c5e('0x29')]=_[_0x4c5e('0x40')](_0x290dc8[_0x4c5e('0x29')]);_0x41b1bc[_0x4c5e('0x2a')]=_[_0x4c5e('0x2b')](_0x41b1bc[_0x4c5e('0x2d')],_0x41b1bc[_0x4c5e('0x29')]);_0x3cf245[_0x4c5e('0x2c')]=_[_0x4c5e('0x2b')](_0x41b1bc[_0x4c5e('0x2d')],qs[_0x4c5e('0x2e')](_0x290dc8['query'][_0x4c5e('0x2e')]));_0x3cf245[_0x4c5e('0x2c')]=_0x3cf245[_0x4c5e('0x2c')][_0x4c5e('0x2f')]?_0x3cf245['attributes']:_0x41b1bc[_0x4c5e('0x2d')];if(_0x290dc8[_0x4c5e('0x29')][_0x4c5e('0x3b')]){_0x3cf245[_0x4c5e('0x3c')]=[{'all':!![]}];}_0x3cf245=_[_0x4c5e('0x36')]({},_0x3cf245,_0x290dc8['options']);return db['Variable'][_0x4c5e('0x41')](_0x3cf245)['then'](handleEntityNotFound(_0x2918f3,null))[_0x4c5e('0x1e')](respondWithResult(_0x2918f3,null))['catch'](handleError(_0x2918f3,null));};exports[_0x4c5e('0x42')]=function(_0x5087f6,_0x409e22){return db[_0x4c5e('0x3a')][_0x4c5e('0x42')](_0x5087f6['body'],{})[_0x4c5e('0x1e')](function(_0x5e8850){var _0xb87c1b=_0x5087f6['user'][_0x4c5e('0x20')]({'plain':!![]});if(!_0xb87c1b)throw new Error(_0x4c5e('0x43'));if(_0xb87c1b[_0x4c5e('0x44')]==='user'){var _0x5590b7=_0x5e8850['get']({'plain':!![]});var _0x199a12=_0x4c5e('0x21');return db[_0x4c5e('0x45')][_0x4c5e('0x41')]({'where':{'name':_0x199a12,'userProfileId':_0xb87c1b['userProfileId']},'raw':!![]})[_0x4c5e('0x1e')](function(_0x22748d){if(_0x22748d&&_0x22748d[_0x4c5e('0x46')]===0x0){return db['UserProfileResource']['create']({'name':_0x5590b7[_0x4c5e('0x23')],'resourceId':_0x5590b7['id'],'type':_0x22748d[_0x4c5e('0x23')],'sectionId':_0x22748d['id']},{})[_0x4c5e('0x1e')](function(){return _0x5e8850;});}else{return _0x5e8850;}})[_0x4c5e('0x47')](function(_0x231b17){logger[_0x4c5e('0x48')](_0x4c5e('0x49'),_0x231b17);throw _0x231b17;});}return _0x5e8850;})[_0x4c5e('0x1e')](respondWithResult(_0x409e22,0xc9))['catch'](handleError(_0x409e22,null));};exports[_0x4c5e('0x1d')]=function(_0x2103b8,_0x313681){if(_0x2103b8[_0x4c5e('0x4a')]['id']){delete _0x2103b8[_0x4c5e('0x4a')]['id'];}return db['Variable']['find']({'where':{'id':_0x2103b8[_0x4c5e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x313681,null))[_0x4c5e('0x1e')](saveUpdates(_0x2103b8[_0x4c5e('0x4a')],null))['then'](respondWithResult(_0x313681,null))[_0x4c5e('0x47')](handleError(_0x313681,null));};exports[_0x4c5e('0x1f')]=function(_0x2d55ed,_0x53c5d0){return db[_0x4c5e('0x3a')][_0x4c5e('0x41')]({'where':{'id':_0x2d55ed[_0x4c5e('0x3f')]['id']}})[_0x4c5e('0x1e')](handleEntityNotFound(_0x53c5d0,null))['then'](removeEntity(_0x53c5d0,null))['catch'](handleError(_0x53c5d0,null));}; \ No newline at end of file +var _0x0fe4=['filters','VIRTUAL','filter','merge','options','Variable','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4b8e54,_0x5edd12){var _0x3640db=function(_0x5b9dd1){while(--_0x5b9dd1){_0x4b8e54['push'](_0x4b8e54['shift']());}};_0x3640db(++_0x5edd12);}(_0x0fe4,0x161));var _0x40fe=function(_0x1df254,_0x143f22){_0x1df254=_0x1df254-0x0;var _0x2e2d2b=_0x0fe4[_0x1df254];return _0x2e2d2b;};'use strict';var emlformat=require(_0x40fe('0x0'));var rimraf=require(_0x40fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40fe('0x2'));var rp=require('request-promise');var moment=require(_0x40fe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40fe('0x4'));var util=require(_0x40fe('0x5'));var path=require(_0x40fe('0x6'));var sox=require(_0x40fe('0x7'));var csv=require(_0x40fe('0x8'));var ejs=require(_0x40fe('0x9'));var fs=require('fs');var fs_extra=require(_0x40fe('0xa'));var _=require(_0x40fe('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x40fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x40fe('0xd'));var Papa=require(_0x40fe('0xe'));var Redis=require(_0x40fe('0xf'));var authService=require(_0x40fe('0x10'));var qs=require(_0x40fe('0x11'));var as=require(_0x40fe('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x40fe('0x13'));var utils=require('../../config/utils');var config=require(_0x40fe('0x14'));var licenseUtil=require(_0x40fe('0x15'));var db=require(_0x40fe('0x16'))['db'];function respondWithStatusCode(_0x28e797,_0x5eb29a){_0x5eb29a=_0x5eb29a||0xcc;return function(_0x4764a6){if(_0x4764a6){return _0x28e797['sendStatus'](_0x5eb29a);}return _0x28e797[_0x40fe('0x17')](_0x5eb29a)[_0x40fe('0x18')]();};}function respondWithResult(_0x2487bc,_0x4ef81e){_0x4ef81e=_0x4ef81e||0xc8;return function(_0x255c96){if(_0x255c96){return _0x2487bc[_0x40fe('0x17')](_0x4ef81e)['json'](_0x255c96);}};}function respondWithFilteredResult(_0x41c3c3,_0x34bfcb){return function(_0x2dc62b){if(_0x2dc62b){var _0x2518f8=typeof _0x34bfcb[_0x40fe('0x19')]===_0x40fe('0x1a')&&typeof _0x34bfcb[_0x40fe('0x1b')]===_0x40fe('0x1a');var _0x512d3c=_0x2dc62b[_0x40fe('0x1c')];var _0x584f49=_0x2518f8?0x0:_0x34bfcb[_0x40fe('0x19')];var _0x5da7db=_0x2518f8?_0x2dc62b[_0x40fe('0x1c')]:_0x34bfcb['offset']+_0x34bfcb[_0x40fe('0x1b')];var _0x171c90;if(_0x5da7db>=_0x512d3c){_0x5da7db=_0x512d3c;_0x171c90=0xc8;}else{_0x171c90=0xce;}_0x41c3c3[_0x40fe('0x17')](_0x171c90);return _0x41c3c3[_0x40fe('0x1d')]('Content-Range',_0x584f49+'-'+_0x5da7db+'/'+_0x512d3c)[_0x40fe('0x1e')](_0x2dc62b);}return null;};}function patchUpdates(_0x555470){return function(_0x45888d){try{jsonpatch[_0x40fe('0x1f')](_0x45888d,_0x555470,!![]);}catch(_0x5b23eb){return BPromise[_0x40fe('0x20')](_0x5b23eb);}return _0x45888d[_0x40fe('0x21')]();};}function saveUpdates(_0x403390,_0x4f61ad){return function(_0x44809d){if(_0x44809d){return _0x44809d[_0x40fe('0x22')](_0x403390)[_0x40fe('0x23')](function(_0x9f46ef){return _0x9f46ef;});}return null;};}function removeEntity(_0x561e7a,_0x18e7dc){return function(_0xf8a3dc){if(_0xf8a3dc){return _0xf8a3dc['destroy']()[_0x40fe('0x23')](function(){var _0x96f6c3=_0xf8a3dc[_0x40fe('0x24')]({'plain':!![]});var _0x28c4aa=_0x40fe('0x25');return db[_0x40fe('0x26')][_0x40fe('0x27')]({'where':{'type':_0x28c4aa,'resourceId':_0x96f6c3['id']}})['then'](function(){return _0xf8a3dc;});})[_0x40fe('0x23')](function(){_0x561e7a[_0x40fe('0x17')](0xcc)[_0x40fe('0x18')]();});}};}function handleEntityNotFound(_0x32e5bc,_0x1127b4){return function(_0x43eae4){if(!_0x43eae4){_0x32e5bc[_0x40fe('0x28')](0x194);}return _0x43eae4;};}function handleError(_0x4ef01f,_0x216481){_0x216481=_0x216481||0x1f4;return function(_0x2b1ffa){logger[_0x40fe('0x29')](_0x2b1ffa[_0x40fe('0x2a')]);if(_0x2b1ffa[_0x40fe('0x2b')]){delete _0x2b1ffa[_0x40fe('0x2b')];}_0x4ef01f['status'](_0x216481)['send'](_0x2b1ffa);};}exports[_0x40fe('0x2c')]=function(_0x5e4f7a,_0x4b4ab7){var _0x3c0b31={},_0x3ae305={},_0x541fa2={'count':0x0,'rows':[]};var _0x46e9aa=_[_0x40fe('0x2d')](db['Variable'][_0x40fe('0x2e')],function(_0xf2fa9e){return{'name':_0xf2fa9e[_0x40fe('0x2f')],'type':_0xf2fa9e[_0x40fe('0x30')][_0x40fe('0x31')]};});_0x3ae305['model']=_[_0x40fe('0x2d')](_0x46e9aa,_0x40fe('0x2b'));_0x3ae305[_0x40fe('0x32')]=_[_0x40fe('0x33')](_0x5e4f7a['query']);_0x3ae305['filters']=_[_0x40fe('0x34')](_0x3ae305[_0x40fe('0x35')],_0x3ae305[_0x40fe('0x32')]);_0x3c0b31[_0x40fe('0x36')]=_[_0x40fe('0x34')](_0x3ae305[_0x40fe('0x35')],qs[_0x40fe('0x37')](_0x5e4f7a[_0x40fe('0x32')]['fields']));_0x3c0b31['attributes']=_0x3c0b31[_0x40fe('0x36')][_0x40fe('0x38')]?_0x3c0b31[_0x40fe('0x36')]:_0x3ae305['model'];if(!_0x5e4f7a[_0x40fe('0x32')][_0x40fe('0x39')](_0x40fe('0x3a'))){_0x3c0b31['limit']=qs[_0x40fe('0x1b')](_0x5e4f7a[_0x40fe('0x32')][_0x40fe('0x1b')]);_0x3c0b31[_0x40fe('0x19')]=qs[_0x40fe('0x19')](_0x5e4f7a['query']['offset']);}_0x3c0b31['order']=qs[_0x40fe('0x3b')](_0x5e4f7a[_0x40fe('0x32')][_0x40fe('0x3b')]);_0x3c0b31[_0x40fe('0x3c')]=qs['filters'](_[_0x40fe('0x3d')](_0x5e4f7a[_0x40fe('0x32')],_0x3ae305[_0x40fe('0x3e')]),_0x46e9aa);if(_0x5e4f7a[_0x40fe('0x32')]['filter']){_0x3c0b31[_0x40fe('0x3c')]=_['merge'](_0x3c0b31[_0x40fe('0x3c')],{'$or':_[_0x40fe('0x2d')](_0x46e9aa,function(_0x43602a){if(_0x43602a[_0x40fe('0x30')]!==_0x40fe('0x3f')){var _0x3798cb={};_0x3798cb[_0x43602a['name']]={'$like':'%'+_0x5e4f7a[_0x40fe('0x32')][_0x40fe('0x40')]+'%'};return _0x3798cb;}})});}_0x3c0b31=_[_0x40fe('0x41')]({},_0x3c0b31,_0x5e4f7a[_0x40fe('0x42')]);var _0x46f881={'where':_0x3c0b31[_0x40fe('0x3c')]};return db[_0x40fe('0x43')][_0x40fe('0x1c')](_0x46f881)['then'](function(_0x393394){_0x541fa2[_0x40fe('0x1c')]=_0x393394;if(_0x5e4f7a[_0x40fe('0x32')]['includeAll']){_0x3c0b31['include']=[{'all':!![]}];}return db[_0x40fe('0x43')][_0x40fe('0x44')](_0x3c0b31);})[_0x40fe('0x23')](function(_0x450de6){_0x541fa2[_0x40fe('0x45')]=_0x450de6;return _0x541fa2;})['then'](respondWithFilteredResult(_0x4b4ab7,_0x3c0b31))[_0x40fe('0x46')](handleError(_0x4b4ab7,null));};exports[_0x40fe('0x47')]=function(_0x1d64e9,_0x278bd7){var _0x40acd5={'raw':!![],'where':{'id':_0x1d64e9[_0x40fe('0x48')]['id']}},_0x424f0e={};_0x424f0e[_0x40fe('0x35')]=_[_0x40fe('0x33')](db[_0x40fe('0x43')][_0x40fe('0x2e')]);_0x424f0e['query']=_[_0x40fe('0x33')](_0x1d64e9[_0x40fe('0x32')]);_0x424f0e['filters']=_[_0x40fe('0x34')](_0x424f0e[_0x40fe('0x35')],_0x424f0e[_0x40fe('0x32')]);_0x40acd5[_0x40fe('0x36')]=_[_0x40fe('0x34')](_0x424f0e[_0x40fe('0x35')],qs[_0x40fe('0x37')](_0x1d64e9[_0x40fe('0x32')][_0x40fe('0x37')]));_0x40acd5[_0x40fe('0x36')]=_0x40acd5[_0x40fe('0x36')]['length']?_0x40acd5[_0x40fe('0x36')]:_0x424f0e[_0x40fe('0x35')];if(_0x1d64e9['query'][_0x40fe('0x49')]){_0x40acd5['include']=[{'all':!![]}];}_0x40acd5=_[_0x40fe('0x41')]({},_0x40acd5,_0x1d64e9[_0x40fe('0x42')]);return db[_0x40fe('0x43')]['find'](_0x40acd5)[_0x40fe('0x23')](handleEntityNotFound(_0x278bd7,null))[_0x40fe('0x23')](respondWithResult(_0x278bd7,null))[_0x40fe('0x46')](handleError(_0x278bd7,null));};exports[_0x40fe('0x4a')]=function(_0x10f68c,_0x3ba3a8){return db[_0x40fe('0x43')][_0x40fe('0x4a')](_0x10f68c[_0x40fe('0x4b')],{})[_0x40fe('0x23')](function(_0x54d504){var _0x2878a4=_0x10f68c[_0x40fe('0x4c')][_0x40fe('0x24')]({'plain':!![]});if(!_0x2878a4)throw new Error(_0x40fe('0x4d'));if(_0x2878a4[_0x40fe('0x4e')]===_0x40fe('0x4c')){var _0x54e34b=_0x54d504[_0x40fe('0x24')]({'plain':!![]});var _0x3dbe7b=_0x40fe('0x25');return db[_0x40fe('0x4f')][_0x40fe('0x50')]({'where':{'name':_0x3dbe7b,'userProfileId':_0x2878a4[_0x40fe('0x51')]},'raw':!![]})[_0x40fe('0x23')](function(_0x57d171){if(_0x57d171&&_0x57d171['autoAssociation']===0x0){return db[_0x40fe('0x26')][_0x40fe('0x4a')]({'name':_0x54e34b[_0x40fe('0x2b')],'resourceId':_0x54e34b['id'],'type':_0x57d171[_0x40fe('0x2b')],'sectionId':_0x57d171['id']},{})[_0x40fe('0x23')](function(){return _0x54d504;});}else{return _0x54d504;}})[_0x40fe('0x46')](function(_0xf1c77b){logger[_0x40fe('0x29')](_0x40fe('0x52'),_0xf1c77b);throw _0xf1c77b;});}return _0x54d504;})['then'](respondWithResult(_0x3ba3a8,0xc9))[_0x40fe('0x46')](handleError(_0x3ba3a8,null));};exports[_0x40fe('0x22')]=function(_0x445e8a,_0x25fa8f){if(_0x445e8a[_0x40fe('0x4b')]['id']){delete _0x445e8a[_0x40fe('0x4b')]['id'];}return db[_0x40fe('0x43')][_0x40fe('0x50')]({'where':{'id':_0x445e8a[_0x40fe('0x48')]['id']}})[_0x40fe('0x23')](handleEntityNotFound(_0x25fa8f,null))[_0x40fe('0x23')](saveUpdates(_0x445e8a[_0x40fe('0x4b')],null))['then'](respondWithResult(_0x25fa8f,null))[_0x40fe('0x46')](handleError(_0x25fa8f,null));};exports[_0x40fe('0x27')]=function(_0x27a376,_0x301bc5){return db['Variable'][_0x40fe('0x50')]({'where':{'id':_0x27a376[_0x40fe('0x48')]['id']}})[_0x40fe('0x23')](handleEntityNotFound(_0x301bc5,null))[_0x40fe('0x23')](removeEntity(_0x301bc5,null))[_0x40fe('0x46')](handleError(_0x301bc5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 8ba4019..784f087 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 _0xa620=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0xa620,0xe4));var _0x0a62=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0xa620[_0x17ebae];return _0x8cbe7d;};'use strict';var _=require(_0x0a62('0x0'));var util=require(_0x0a62('0x1'));var logger=require(_0x0a62('0x2'))(_0x0a62('0x3'));var moment=require(_0x0a62('0x4'));var BPromise=require(_0x0a62('0x5'));var rp=require(_0x0a62('0x6'));var fs=require('fs');var path=require(_0x0a62('0x7'));var rimraf=require(_0x0a62('0x8'));var config=require(_0x0a62('0x9'));var attributes=require('./variable.attributes');module[_0x0a62('0xa')]=function(_0x4f121d,_0xd4e3fd){return _0x4f121d[_0x0a62('0xb')](_0x0a62('0xc'),attributes,{'tableName':_0x0a62('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f35=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util'];(function(_0x44faf5,_0x1f0f92){var _0x4c0a90=function(_0x46f01e){while(--_0x46f01e){_0x44faf5['push'](_0x44faf5['shift']());}};_0x4c0a90(++_0x1f0f92);}(_0x3f35,0x13d));var _0x53f3=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x3f35[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x53f3('0x3'));var rp=require(_0x53f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53f3('0x5'));var config=require(_0x53f3('0x6'));var attributes=require(_0x53f3('0x7'));module[_0x53f3('0x8')]=function(_0x810ad2,_0x4f128c){return _0x810ad2[_0x53f3('0x9')](_0x53f3('0xa'),attributes,{'tableName':'tools_variables','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 97a381d..53d39fc 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x4c10fe,_0x19e0b2){var _0x5d4ffe=function(_0x219ac8){while(--_0x219ac8){_0x4c10fe['push'](_0x4c10fe['shift']());}};_0x5d4ffe(++_0x19e0b2);}(_0x3e74,0x175));var _0x43e7=function(_0xec4d22,_0x4395dd){_0xec4d22=_0xec4d22-0x0;var _0x558e82=_0x3e74[_0xec4d22];return _0x558e82;};'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']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\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')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x11bc40,_0x1de68b){_0x11bc40=_0x11bc40-0x0;var _0x5d8d52=_0x1cb9[_0x11bc40];return _0x5d8d52;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 3f16d4c..59f5434 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 _0x4dd4=['/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x25d6ce,_0x30d64a){var _0x1aef15=function(_0x13aa4f){while(--_0x13aa4f){_0x25d6ce['push'](_0x25d6ce['shift']());}};_0x1aef15(++_0x30d64a);}(_0x4dd4,0xfa));var _0x44dd=function(_0x43fc64,_0x1da87c){_0x43fc64=_0x43fc64-0x0;var _0x2c0d3b=_0x4dd4[_0x43fc64];return _0x2c0d3b;};'use strict';var express=require(_0x44dd('0x0'));var router=express[_0x44dd('0x1')]();var auth=require(_0x44dd('0x2'));var controller=require(_0x44dd('0x3'));router[_0x44dd('0x4')]('/',controller['index']);router[_0x44dd('0x4')](_0x44dd('0x5'),auth['isAuthenticated'](),auth[_0x44dd('0x6')](),controller[_0x44dd('0x7')]);router['get'](_0x44dd('0x8'),auth[_0x44dd('0x9')](),auth[_0x44dd('0x6')](),controller[_0x44dd('0xa')]);router['get'](_0x44dd('0xb'),auth[_0x44dd('0x9')](),auth[_0x44dd('0x6')](),controller[_0x44dd('0xc')]);router['get'](_0x44dd('0xd'),auth['isAuthenticated'](),controller[_0x44dd('0xe')]);router[_0x44dd('0x4')]('/migrations',controller[_0x44dd('0xf')]);module[_0x44dd('0x10')]=router; \ No newline at end of file +var _0xedf0=['../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','exports','express','Router'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xedf0,0x6e));var _0x0edf=function(_0x26930f,_0x2d582e){_0x26930f=_0x26930f-0x0;var _0x22ec6e=_0xedf0[_0x26930f];return _0x22ec6e;};'use strict';var express=require(_0x0edf('0x0'));var router=express[_0x0edf('0x1')]();var auth=require(_0x0edf('0x2'));var controller=require('./version.controller');router[_0x0edf('0x3')]('/',controller[_0x0edf('0x4')]);router['get'](_0x0edf('0x5'),auth[_0x0edf('0x6')](),auth[_0x0edf('0x7')](),controller[_0x0edf('0x8')]);router['get'](_0x0edf('0x9'),auth[_0x0edf('0x6')](),auth['canUpdate'](),controller[_0x0edf('0xa')]);router['get'](_0x0edf('0xb'),auth['isAuthenticated'](),auth[_0x0edf('0x7')](),controller[_0x0edf('0xc')]);router[_0x0edf('0x3')](_0x0edf('0xd'),auth[_0x0edf('0x6')](),controller['restart']);router[_0x0edf('0x3')](_0x0edf('0xe'),controller['migrations']);module[_0x0edf('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 ae5119d..7889680 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 _0x2f0a=['pkginfo','compare-versions','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','version','latest','fetch','status','json','origin','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','join','root','migrations','replace','push','length','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','catch','Database\x20already\x20up-to-date','umzug','path','lodash'];(function(_0x1fb70a,_0x3c9bfd){var _0xad13f8=function(_0xa12d6a){while(--_0xa12d6a){_0x1fb70a['push'](_0x1fb70a['shift']());}};_0xad13f8(++_0x3c9bfd);}(_0x2f0a,0xe8));var _0xa2f0=function(_0x289c09,_0x1cf82d){_0x289c09=_0x289c09-0x0;var _0xa6895b=_0x2f0a[_0x289c09];return _0xa6895b;};'use strict';var Umzug=require(_0xa2f0('0x0'));var path=require(_0xa2f0('0x1'));var fs=require('fs');var _=require(_0xa2f0('0x2'));var pkginfo=require(_0xa2f0('0x3'))(module,'version');var compareVersions=require(_0xa2f0('0x4'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xa2f0('0x5'));var pm2=require(_0xa2f0('0x6'));var logger=require(_0xa2f0('0x7'))(_0xa2f0('0x8'));var git=require(_0xa2f0('0x9'))(config['root']);exports[_0xa2f0('0xa')]=function(_0xa2695f,_0x547fea){var _0x156e50={'current':module[_0xa2f0('0xb')][_0xa2f0('0xc')],'phonebar':0x2};if(_0xa2695f['query']&&_0xa2695f['query'][_0xa2f0('0xd')]){return git[_0xa2f0('0xe')]()['tags'](function(_0x43211e,_0x4a8cd6){_0x156e50['latest']=(_0x43211e?module[_0xa2f0('0xb')]['version']:_0x4a8cd6[_0xa2f0('0xd')])||'2.0.0';return _0x547fea[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')](_0x156e50);});}else{return _0x547fea[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')](_0x156e50);}};exports[_0xa2f0('0xe')]=function(_0x4c4733,_0x51de77){return git[_0xa2f0('0xe')]([_0xa2f0('0x11'),'master'],function(_0x19e35a){if(_0x19e35a){logger['error'](_0x19e35a);return _0x51de77[_0xa2f0('0xf')](0x1f4)['json'](_0x19e35a);}logger['info'](_0xa2f0('0x12'));return _0x51de77[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x13')});});};exports[_0xa2f0('0x14')]=function(_0x2d5049,_0x5affc2){return git[_0xa2f0('0x14')]([_0xa2f0('0x15'),'FETCH_HEAD'],function(_0x30383d){if(_0x30383d){logger[_0xa2f0('0x16')](_0x30383d);return _0x5affc2[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x30383d);}logger[_0xa2f0('0x17')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x5affc2['status'](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x18')});});};exports[_0xa2f0('0x19')]=function(_0x48164d,_0x4cb17c){exec(_0xa2f0('0x1a'),function(_0x3153c7,_0x5e40e8,_0x3b44f8){logger['info'](_0x5e40e8);logger[_0xa2f0('0x17')](_0x3b44f8);if(_0x3153c7){logger[_0xa2f0('0x16')](_0x3153c7);return _0x4cb17c[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x3153c7);}return _0x4cb17c['status'](0xc8)[_0xa2f0('0x10')]({'output':_0x5e40e8});});};exports[_0xa2f0('0x1b')]=function(_0x415e52,_0xda0bf9){return pm2[_0xa2f0('0x1b')](_0xa2f0('0x1c'))[_0xa2f0('0x1d')](function(_0xddaf7b){logger[_0xa2f0('0x17')](_0xa2f0('0x1e'),_0xddaf7b);return _0xda0bf9[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x2b4031){logger[_0xa2f0('0x16')](_0x2b4031);return _0xda0bf9[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x2b4031);});};exports['migrations']=function(_0x553300,_0x260024){var _0x40836f=fs['readdirSync'](path[_0xa2f0('0x1f')](config[_0xa2f0('0x20')],'server',_0xa2f0('0x21')));var _0x1d6651=[];for(var _0x5eb36c=0x0;_0x5eb36c<_0x40836f['length'];_0x5eb36c++){var _0x343611=_0x40836f[_0x5eb36c][_0xa2f0('0x22')]('.js','');if(compareVersions(module[_0xa2f0('0xb')][_0xa2f0('0xc')],_0x343611)===-0x1){_0x1d6651[_0xa2f0('0x23')](_0x343611);}}if(_0x1d6651[_0xa2f0('0x24')]){var _0x1afa0e=_0x1d6651[_0xa2f0('0x25')](compareVersions);var _0x483aec=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xa2f0('0x26')],'modelName':_0xa2f0('0x26'),'columnName':_0xa2f0('0xc')},'migrations':{'params':[db[_0xa2f0('0x27')]['getQueryInterface'](),db[_0xa2f0('0x27')]['constructor'],function(){throw new Error(_0xa2f0('0x28'));}],'path':path[_0xa2f0('0x1f')](config[_0xa2f0('0x20')],_0xa2f0('0x29'),'migrations'),'pattern':/\.js$/}});_0x483aec['up']({'migrations':_['map'](_0x1afa0e,function(_0x1098aa){return _0x1098aa+_0xa2f0('0x2a');})})['then'](function(){return _0x260024[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':_0xa2f0('0x2b')+module[_0xa2f0('0xb')][_0xa2f0('0xc')]+'\x20to\x20'+_[_0xa2f0('0x2c')](_0x1afa0e),'migrations':_[_0xa2f0('0x1f')](_0x1afa0e)});})[_0xa2f0('0x2d')](function(_0x5b79a0){if(_0x5b79a0 instanceof db[_0xa2f0('0x27')]['UniqueConstraintError']){return _0x260024[_0xa2f0('0xf')](0xc8)['json']({'output':_0xa2f0('0x2e')});}else{return _0x260024[_0xa2f0('0xf')](0x1f4)[_0xa2f0('0x10')](_0x5b79a0);}});}else{return _0x260024[_0xa2f0('0xf')](0xc8)[_0xa2f0('0x10')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xff74=['git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','push','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','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','fetch','tags','latest','2.0.0','json','origin','master','info','status'];(function(_0x558674,_0x29686a){var _0x26333e=function(_0x3ae221){while(--_0x3ae221){_0x558674['push'](_0x558674['shift']());}};_0x26333e(++_0x29686a);}(_0xff74,0xbb));var _0x4ff7=function(_0xfb675c,_0x2cfb12){_0xfb675c=_0xfb675c-0x0;var _0x56179a=_0xff74[_0xfb675c];return _0x56179a;};'use strict';var Umzug=require(_0x4ff7('0x0'));var path=require(_0x4ff7('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x4ff7('0x2'))(module,_0x4ff7('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x4ff7('0x4'))['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x4ff7('0x5'));var logger=require(_0x4ff7('0x6'))(_0x4ff7('0x7'));var git=require(_0x4ff7('0x8'))(config[_0x4ff7('0x9')]);exports['index']=function(_0x12792c,_0x2ea1c5){var _0x33cfd9={'current':module[_0x4ff7('0xa')]['version'],'phonebar':0x2};if(_0x12792c[_0x4ff7('0xb')]&&_0x12792c[_0x4ff7('0xb')]['latest']){return git[_0x4ff7('0xc')]()[_0x4ff7('0xd')](function(_0x69e1c1,_0x5985b6){_0x33cfd9['latest']=(_0x69e1c1?module[_0x4ff7('0xa')][_0x4ff7('0x3')]:_0x5985b6[_0x4ff7('0xe')])||_0x4ff7('0xf');return _0x2ea1c5['status'](0xc8)[_0x4ff7('0x10')](_0x33cfd9);});}else{return _0x2ea1c5['status'](0xc8)[_0x4ff7('0x10')](_0x33cfd9);}};exports['fetch']=function(_0x3a9003,_0x245fa5){return git[_0x4ff7('0xc')]([_0x4ff7('0x11'),_0x4ff7('0x12')],function(_0x24fe92){if(_0x24fe92){logger['error'](_0x24fe92);return _0x245fa5['status'](0x1f4)[_0x4ff7('0x10')](_0x24fe92);}logger[_0x4ff7('0x13')]('git\x20fetch');return _0x245fa5[_0x4ff7('0x14')](0xc8)['json']({'output':_0x4ff7('0x15')});});};exports[_0x4ff7('0x16')]=function(_0x20cf21,_0x4385f0){return git[_0x4ff7('0x16')]([_0x4ff7('0x17'),_0x4ff7('0x18')],function(_0x28c5a6){if(_0x28c5a6){logger[_0x4ff7('0x19')](_0x28c5a6);return _0x4385f0[_0x4ff7('0x14')](0x1f4)[_0x4ff7('0x10')](_0x28c5a6);}logger[_0x4ff7('0x13')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x4385f0[_0x4ff7('0x14')](0xc8)[_0x4ff7('0x10')]({'output':_0x4ff7('0x1a')});});};exports[_0x4ff7('0x1b')]=function(_0x5366b0,_0xbdd2be){exec(_0x4ff7('0x1c'),function(_0x43cbe1,_0x2309df,_0x1fb822){logger['info'](_0x2309df);logger[_0x4ff7('0x13')](_0x1fb822);if(_0x43cbe1){logger[_0x4ff7('0x19')](_0x43cbe1);return _0xbdd2be['status'](0x1f4)[_0x4ff7('0x10')](_0x43cbe1);}return _0xbdd2be[_0x4ff7('0x14')](0xc8)[_0x4ff7('0x10')]({'output':_0x2309df});});};exports['restart']=function(_0x592fae,_0x1db436){return pm2[_0x4ff7('0x1d')](_0x4ff7('0x1e'))[_0x4ff7('0x1f')](function(_0x5da449){logger[_0x4ff7('0x13')](_0x4ff7('0x20'),_0x5da449);return _0x1db436[_0x4ff7('0x14')](0xc8)['json']({'output':_0x4ff7('0x21')});})[_0x4ff7('0x22')](function(_0x356cff){logger['error'](_0x356cff);return _0x1db436[_0x4ff7('0x14')](0x1f4)['json'](_0x356cff);});};exports[_0x4ff7('0x23')]=function(_0x2b7a6b,_0x55511e){var _0x521168=fs[_0x4ff7('0x24')](path[_0x4ff7('0x25')](config[_0x4ff7('0x9')],_0x4ff7('0x26'),_0x4ff7('0x23')));var _0x414e00=[];for(var _0x111944=0x0;_0x111944<_0x521168[_0x4ff7('0x27')];_0x111944++){var _0x205b9c=_0x521168[_0x111944][_0x4ff7('0x28')](_0x4ff7('0x29'),'');if(compareVersions(module['exports']['version'],_0x205b9c)===-0x1){_0x414e00[_0x4ff7('0x2a')](_0x205b9c);}}if(_0x414e00[_0x4ff7('0x27')]){var _0x26fdc0=_0x414e00['sort'](compareVersions);var _0x52f060=new Umzug({'storage':_0x4ff7('0x2b'),'storageOptions':{'model':db[_0x4ff7('0x2c')],'modelName':_0x4ff7('0x2c'),'columnName':_0x4ff7('0x3')},'migrations':{'params':[db[_0x4ff7('0x2b')][_0x4ff7('0x2d')](),db[_0x4ff7('0x2b')][_0x4ff7('0x2e')],function(){throw new Error(_0x4ff7('0x2f'));}],'path':path[_0x4ff7('0x25')](config[_0x4ff7('0x9')],'server','migrations'),'pattern':/\.js$/}});_0x52f060['up']({'migrations':_[_0x4ff7('0x30')](_0x26fdc0,function(_0x3fbbad){return _0x3fbbad+'.js';})})[_0x4ff7('0x1f')](function(){return _0x55511e['status'](0xc8)[_0x4ff7('0x10')]({'output':_0x4ff7('0x31')+module[_0x4ff7('0xa')][_0x4ff7('0x3')]+'\x20to\x20'+_[_0x4ff7('0x32')](_0x26fdc0),'migrations':_[_0x4ff7('0x25')](_0x26fdc0)});})[_0x4ff7('0x22')](function(_0x33a0d3){if(_0x33a0d3 instanceof db[_0x4ff7('0x2b')]['UniqueConstraintError']){return _0x55511e[_0x4ff7('0x14')](0xc8)[_0x4ff7('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x55511e[_0x4ff7('0x14')](0x1f4)[_0x4ff7('0x10')](_0x33a0d3);}});}else{return _0x55511e[_0x4ff7('0x14')](0xc8)[_0x4ff7('0x10')]({'output':_0x4ff7('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 7288518..7ca0d19 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 _0xb52d=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb52d,0x162));var _0xdb52=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xb52d[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0xdb52('0x0'));var util=require(_0xdb52('0x1'));var path=require(_0xdb52('0x2'));var timeout=require(_0xdb52('0x3'));var express=require(_0xdb52('0x4'));var router=express[_0xdb52('0x5')]();var fs_extra=require(_0xdb52('0x6'));var auth=require(_0xdb52('0x7'));var interaction=require(_0xdb52('0x8'));var config=require(_0xdb52('0x9'));var controller=require(_0xdb52('0xa'));router[_0xdb52('0xb')]('/',auth[_0xdb52('0xc')](),controller[_0xdb52('0xd')]);router['get']('/describe',auth[_0xdb52('0xc')](),controller[_0xdb52('0xe')]);router[_0xdb52('0xb')](_0xdb52('0xf'),auth[_0xdb52('0xc')](),controller[_0xdb52('0x10')]);router[_0xdb52('0x11')]('/',auth[_0xdb52('0xc')](),controller['create']);router[_0xdb52('0x12')](_0xdb52('0xf'),auth[_0xdb52('0xc')](),controller[_0xdb52('0x13')]);router[_0xdb52('0x14')]('/:id',auth[_0xdb52('0xc')](),controller[_0xdb52('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfe73=['../../config/environment','get','index','isAuthenticated','/:id','show','post','create','put','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xf077cb,_0x11cfa6){var _0x5549d9=function(_0x131d90){while(--_0x131d90){_0xf077cb['push'](_0xf077cb['shift']());}};_0x5549d9(++_0x11cfa6);}(_0xfe73,0xf4));var _0x3fe7=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xfe73[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x3fe7('0x0'));var util=require(_0x3fe7('0x1'));var path=require(_0x3fe7('0x2'));var timeout=require(_0x3fe7('0x3'));var express=require(_0x3fe7('0x4'));var router=express['Router']();var fs_extra=require(_0x3fe7('0x5'));var auth=require(_0x3fe7('0x6'));var interaction=require(_0x3fe7('0x7'));var config=require(_0x3fe7('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x3fe7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fe7('0xa')]);router[_0x3fe7('0x9')]('/describe',auth[_0x3fe7('0xb')](),controller['describe']);router[_0x3fe7('0x9')](_0x3fe7('0xc'),auth[_0x3fe7('0xb')](),controller[_0x3fe7('0xd')]);router[_0x3fe7('0xe')]('/',auth[_0x3fe7('0xb')](),controller[_0x3fe7('0xf')]);router[_0x3fe7('0x10')](_0x3fe7('0xc'),auth[_0x3fe7('0xb')](),controller[_0x3fe7('0x11')]);router['delete'](_0x3fe7('0xc'),auth[_0x3fe7('0xb')](),controller['destroy']);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 f0d9470..ab8cb4f 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 _0xea28=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x4ad17e,_0x4cf44b){var _0x309136=function(_0x676636){while(--_0x676636){_0x4ad17e['push'](_0x4ad17e['shift']());}};_0x309136(++_0x4cf44b);}(_0xea28,0x13a));var _0x8ea2=function(_0xbe6574,_0x1d448c){_0xbe6574=_0xbe6574-0x0;var _0x32a27e=_0xea28[_0xbe6574];return _0x32a27e;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'type':{'type':Sequelize[_0x8ea2('0x2')]},'uniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'calleridnum':{'type':Sequelize[_0x8ea2('0x2')]},'calleridname':{'type':Sequelize[_0x8ea2('0x2')]},'queue':{'type':Sequelize[_0x8ea2('0x2')]},'interface':{'type':Sequelize[_0x8ea2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x8ea2('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x8ea2('0x3')]},'holdtime':{'type':Sequelize[_0x8ea2('0x4')]},'agentcomplete':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8ea2('0x4')]},'agentacw':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8ea2('0x4')]},'reason':{'type':Sequelize[_0x8ea2('0x2')]},'lastevent':{'type':Sequelize[_0x8ea2('0x2')]},'channel':{'type':Sequelize[_0x8ea2('0x2')]},'channelstate':{'type':Sequelize[_0x8ea2('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8ea2('0x2')]},'language':{'type':Sequelize[_0x8ea2('0x2')]},'accountcode':{'type':Sequelize[_0x8ea2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x8ea2('0x2')]},'priority':{'type':Sequelize[_0x8ea2('0x2')]},'destchannel':{'type':Sequelize[_0x8ea2('0x2')]},'destchannelstate':{'type':Sequelize[_0x8ea2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8ea2('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x8ea2('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8ea2('0x2')]},'destaccountcode':{'type':Sequelize[_0x8ea2('0x2')]},'destcontext':{'type':Sequelize[_0x8ea2('0x2')]},'destexten':{'type':Sequelize[_0x8ea2('0x2')]},'destpriority':{'type':Sequelize[_0x8ea2('0x2')]},'destuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8ea2('0x2')]},'transfer':{'type':Sequelize[_0x8ea2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8ea2('0x2')],'comment':_0x8ea2('0x6')},'transferexten':{'type':Sequelize[_0x8ea2('0x2')]},'transferuniqueid':{'type':Sequelize[_0x8ea2('0x2')]},'agententerreason':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb03e=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x210396,_0x4d712e){var _0xd37ae2=function(_0x4a6cb1){while(--_0x4a6cb1){_0x210396['push'](_0x210396['shift']());}};_0xd37ae2(++_0x4d712e);}(_0xb03e,0x1eb));var _0xeb03=function(_0x284ae2,_0x26f59e){_0x284ae2=_0x284ae2-0x0;var _0x38bfa1=_0xb03e[_0x284ae2];return _0x38bfa1;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'type':{'type':Sequelize[_0xeb03('0x1')]},'uniqueid':{'type':Sequelize[_0xeb03('0x1')]},'calleridnum':{'type':Sequelize[_0xeb03('0x1')]},'calleridname':{'type':Sequelize[_0xeb03('0x1')]},'queue':{'type':Sequelize[_0xeb03('0x1')]},'interface':{'type':Sequelize[_0xeb03('0x1')]},'membername':{'type':Sequelize[_0xeb03('0x1')]},'agentcalledAt':{'type':Sequelize[_0xeb03('0x2')]},'agentconnectAt':{'type':Sequelize[_0xeb03('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xeb03('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xeb03('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeb03('0x3')]},'agentcomplete':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb03('0x3')]},'agentacw':{'type':Sequelize[_0xeb03('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xeb03('0x1')]},'lastevent':{'type':Sequelize[_0xeb03('0x1')]},'channel':{'type':Sequelize[_0xeb03('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeb03('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xeb03('0x1')]},'language':{'type':Sequelize[_0xeb03('0x1')]},'accountcode':{'type':Sequelize[_0xeb03('0x1')]},'context':{'type':Sequelize[_0xeb03('0x1')]},'exten':{'type':Sequelize[_0xeb03('0x1')]},'priority':{'type':Sequelize[_0xeb03('0x1')]},'destchannel':{'type':Sequelize[_0xeb03('0x1')]},'destchannelstate':{'type':Sequelize[_0xeb03('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeb03('0x1')]},'destcalleridnum':{'type':Sequelize[_0xeb03('0x1')]},'destcalleridname':{'type':Sequelize[_0xeb03('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xeb03('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xeb03('0x1')]},'destaccountcode':{'type':Sequelize[_0xeb03('0x1')]},'destcontext':{'type':Sequelize[_0xeb03('0x1')]},'destexten':{'type':Sequelize[_0xeb03('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xeb03('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb03('0x1')],'comment':_0xeb03('0x5')},'transferexten':{'type':Sequelize[_0xeb03('0x1')]},'transferuniqueid':{'type':Sequelize[_0xeb03('0x1')]},'agententerreason':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1d25f28..988e061 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(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 ebcf21e..323285c 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 _0x6eed=['define','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x250ce7,_0x502ad3){var _0x416428=function(_0x46564d){while(--_0x46564d){_0x250ce7['push'](_0x250ce7['shift']());}};_0x416428(++_0x502ad3);}(_0x6eed,0xff));var _0xd6ee=function(_0x1d506a,_0x4fc4a0){_0x1d506a=_0x1d506a-0x0;var _0x5edd79=_0x6eed[_0x1d506a];return _0x5edd79;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var logger=require(_0xd6ee('0x2'))(_0xd6ee('0x3'));var moment=require(_0xd6ee('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ee('0x5'));var fs=require('fs');var path=require(_0xd6ee('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd6ee('0x7'));module[_0xd6ee('0x8')]=function(_0x1c4f36,_0x37abca){return _0x1c4f36[_0xd6ee('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xd6ee('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf69d=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x574162,_0x2425ea){var _0x39c245=function(_0x46653f){while(--_0x46653f){_0x574162['push'](_0x574162['shift']());}};_0x39c245(++_0x2425ea);}(_0xf69d,0xd3));var _0xdf69=function(_0x31b346,_0x4011a3){_0x31b346=_0x31b346-0x0;var _0x582c79=_0xf69d[_0x31b346];return _0x582c79;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'paranoid':![],'indexes':[{'fields':[_0xdf69('0xe'),_0xdf69('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 0c7f18b..a9ed488 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 _0xcb32=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xcb32,0x19d));var _0x2cb3=function(_0x7f8abc,_0x85f3ba){_0x7f8abc=_0x7f8abc-0x0;var _0x3d6af8=_0xcb32[_0x7f8abc];return _0x3d6af8;};'use strict';var _=require(_0x2cb3('0x0'));var util=require(_0x2cb3('0x1'));var moment=require(_0x2cb3('0x2'));var BPromise=require(_0x2cb3('0x3'));var rs=require(_0x2cb3('0x4'));var fs=require('fs');var Redis=require(_0x2cb3('0x5'));var db=require(_0x2cb3('0x6'))['db'];var utils=require(_0x2cb3('0x7'));var logger=require(_0x2cb3('0x8'))(_0x2cb3('0x9'));var config=require(_0x2cb3('0xa'));var jayson=require(_0x2cb3('0xb'));var client=jayson[_0x2cb3('0xc')][_0x2cb3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x21bc67,_0x4403d4,_0x1b6590){return new BPromise(function(_0x5ed6ab,_0x17c0af){return client[_0x2cb3('0xe')](_0x21bc67,_0x1b6590)[_0x2cb3('0xf')](function(_0x4f001c){logger[_0x2cb3('0x10')](_0x2cb3('0x11'),_0x4403d4,_0x2cb3('0x12'));logger['debug'](_0x2cb3('0x13'),_0x4403d4,_0x2cb3('0x12'),JSON[_0x2cb3('0x14')](_0x4f001c));if(_0x4f001c[_0x2cb3('0x15')]){if(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x16')]===0x1f4){logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);return _0x17c0af(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);}logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);return _0x5ed6ab(_0x4f001c[_0x2cb3('0x15')][_0x2cb3('0x17')]);}else{logger[_0x2cb3('0x10')](_0x2cb3('0x11'),_0x4403d4,_0x2cb3('0x12'));_0x5ed6ab(_0x4f001c[_0x2cb3('0x18')][_0x2cb3('0x17')]);}})[_0x2cb3('0x19')](function(_0x569179){logger[_0x2cb3('0x15')](_0x2cb3('0x11'),_0x4403d4,_0x569179);_0x17c0af(_0x569179);});});}exports[_0x2cb3('0x1a')]=function(_0x196fdd){var _0x58a851=this;return new Promise(function(_0x4285ce,_0x1ba30c){return db['VoiceAgentReport'][_0x2cb3('0x1b')](_0x196fdd[_0x2cb3('0x1c')],{'raw':_0x196fdd[_0x2cb3('0x1d')]?_0x196fdd['options'][_0x2cb3('0x1e')]===undefined?!![]:![]:!![]})[_0x2cb3('0xf')](function(_0x1845d2){logger[_0x2cb3('0x10')](_0x2cb3('0x1a'),_0x196fdd);logger[_0x2cb3('0x1f')](_0x2cb3('0x1a'),_0x196fdd,JSON[_0x2cb3('0x14')](_0x1845d2));_0x4285ce(_0x1845d2);})[_0x2cb3('0x19')](function(_0x460c5b){logger[_0x2cb3('0x15')](_0x2cb3('0x1a'),_0x460c5b['message'],_0x196fdd);_0x1ba30c(_0x58a851['error'](0x1f4,_0x460c5b['message']));});});};exports[_0x2cb3('0x20')]=function(_0x576b6b){var _0x1e816c=this;return new Promise(function(_0xd20b09,_0xc11b6){return db[_0x2cb3('0x21')][_0x2cb3('0x22')](_0x576b6b['body'],{'raw':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x23')]||null:null,'attributes':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b[_0x2cb3('0x1d')][_0x2cb3('0x24')]||null:null,'limit':_0x576b6b[_0x2cb3('0x1d')]?_0x576b6b['options'][_0x2cb3('0x25')]||null:null})[_0x2cb3('0xf')](function(_0x128086){logger['info']('UpdateVoiceAgentReport',_0x576b6b);logger[_0x2cb3('0x1f')]('UpdateVoiceAgentReport',_0x576b6b,JSON[_0x2cb3('0x14')](_0x128086));_0xd20b09(_0x128086);})[_0x2cb3('0x19')](function(_0x59fbe1){logger['error'](_0x2cb3('0x20'),_0x59fbe1[_0x2cb3('0x17')],_0x576b6b);_0xc11b6(_0x1e816c[_0x2cb3('0x15')](0x1f4,_0x59fbe1[_0x2cb3('0x17')]));});});}; \ No newline at end of file +var _0x2b3a=['catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','where','attributes','then','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x64f713,_0x42cc4c){var _0x41ea6c=function(_0x13c5e5){while(--_0x13c5e5){_0x64f713['push'](_0x64f713['shift']());}};_0x41ea6c(++_0x42cc4c);}(_0x2b3a,0xe3));var _0xa2b3=function(_0x2e1199,_0x2723a8){_0x2e1199=_0x2e1199-0x0;var _0x1ee7bf=_0x2b3a[_0x2e1199];return _0x1ee7bf;};'use strict';var _=require(_0xa2b3('0x0'));var util=require(_0xa2b3('0x1'));var moment=require(_0xa2b3('0x2'));var BPromise=require(_0xa2b3('0x3'));var rs=require(_0xa2b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa2b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2b3('0x6'))(_0xa2b3('0x7'));var config=require('../../config/environment');var jayson=require(_0xa2b3('0x8'));var client=jayson[_0xa2b3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cbc3b,_0x450256,_0x5bfa1c){return new BPromise(function(_0x10cc17,_0xa2301f){return client[_0xa2b3('0xa')](_0x2cbc3b,_0x5bfa1c)['then'](function(_0x577193){logger['info'](_0xa2b3('0xb'),_0x450256,_0xa2b3('0xc'));logger[_0xa2b3('0xd')](_0xa2b3('0xe'),_0x450256,_0xa2b3('0xc'),JSON[_0xa2b3('0xf')](_0x577193));if(_0x577193[_0xa2b3('0x10')]){if(_0x577193[_0xa2b3('0x10')][_0xa2b3('0x11')]===0x1f4){logger[_0xa2b3('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x450256,_0x577193[_0xa2b3('0x10')][_0xa2b3('0x12')]);return _0xa2301f(_0x577193[_0xa2b3('0x10')][_0xa2b3('0x12')]);}logger[_0xa2b3('0x10')](_0xa2b3('0xb'),_0x450256,_0x577193['error'][_0xa2b3('0x12')]);return _0x10cc17(_0x577193['error'][_0xa2b3('0x12')]);}else{logger[_0xa2b3('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x450256,'request\x20sent');_0x10cc17(_0x577193[_0xa2b3('0x14')][_0xa2b3('0x12')]);}})[_0xa2b3('0x15')](function(_0x2f4c30){logger[_0xa2b3('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x450256,_0x2f4c30);_0xa2301f(_0x2f4c30);});});}exports[_0xa2b3('0x16')]=function(_0x3bf9ce){var _0xd1df75=this;return new Promise(function(_0x1079d4,_0x35c6ff){return db[_0xa2b3('0x17')]['create'](_0x3bf9ce[_0xa2b3('0x18')],{'raw':_0x3bf9ce[_0xa2b3('0x19')]?_0x3bf9ce['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x19d8ad){logger['info'](_0xa2b3('0x16'),_0x3bf9ce);logger[_0xa2b3('0xd')](_0xa2b3('0x16'),_0x3bf9ce,JSON[_0xa2b3('0xf')](_0x19d8ad));_0x1079d4(_0x19d8ad);})[_0xa2b3('0x15')](function(_0xa246c1){logger[_0xa2b3('0x10')](_0xa2b3('0x16'),_0xa246c1[_0xa2b3('0x12')],_0x3bf9ce);_0x35c6ff(_0xd1df75[_0xa2b3('0x10')](0x1f4,_0xa246c1[_0xa2b3('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0xb011b3){var _0x5cb25c=this;return new Promise(function(_0xc02390,_0x5ead6f){return db[_0xa2b3('0x17')]['update'](_0xb011b3[_0xa2b3('0x18')],{'raw':_0xb011b3[_0xa2b3('0x19')]?_0xb011b3['options'][_0xa2b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb011b3[_0xa2b3('0x19')]?_0xb011b3[_0xa2b3('0x19')][_0xa2b3('0x1b')]||null:null,'attributes':_0xb011b3[_0xa2b3('0x19')]?_0xb011b3[_0xa2b3('0x19')][_0xa2b3('0x1c')]||null:null,'limit':_0xb011b3['options']?_0xb011b3['options']['limit']||null:null})[_0xa2b3('0x1d')](function(_0x1e3f06){logger[_0xa2b3('0x13')](_0xa2b3('0x1e'),_0xb011b3);logger[_0xa2b3('0xd')](_0xa2b3('0x1e'),_0xb011b3,JSON[_0xa2b3('0xf')](_0x1e3f06));_0xc02390(_0x1e3f06);})[_0xa2b3('0x15')](function(_0x405d94){logger[_0xa2b3('0x10')]('UpdateVoiceAgentReport',_0x405d94[_0xa2b3('0x12')],_0xb011b3);_0x5ead6f(_0x5cb25c[_0xa2b3('0x10')](0x1f4,_0x405d94[_0xa2b3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index aacd84c..76ea7e9 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 _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x4740e9,_0x4729ab){var _0x3acffe=function(_0x28a87b){while(--_0x28a87b){_0x4740e9['push'](_0x4740e9['shift']());}};_0x3acffe(++_0x4729ab);}(_0xe14b,0x93));var _0xbe14=function(_0x357e55,_0x3916a2){_0x357e55=_0x357e55-0x0;var _0x1f0ac4=_0xe14b[_0x357e55];return _0x1f0ac4;};'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('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0x885a,0x180));var _0xa885=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x885a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 3ce1491..aac6179 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 _0xbc87=['STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound-fax','dialer'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc87,0x144));var _0x7bc8=function(_0xe86b07,_0x28ad1f){_0xe86b07=_0xe86b07-0x0;var _0x128e88=_0xbc87[_0xe86b07];return _0x128e88;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7bc8('0x1')](_0x7bc8('0x2'),_0x7bc8('0x3'),'outbound','inbound-fax',_0x7bc8('0x4'),_0x7bc8('0x5'))},'tag':{'type':Sequelize[_0x7bc8('0x6')]},'accountcode':{'type':Sequelize[_0x7bc8('0x6')]},'source':{'type':Sequelize[_0x7bc8('0x6')]},'destination':{'type':Sequelize[_0x7bc8('0x6')]},'destinationcontext':{'type':Sequelize[_0x7bc8('0x6')]},'callerid':{'type':Sequelize[_0x7bc8('0x6')]},'channel':{'type':Sequelize[_0x7bc8('0x6')]},'destinationchannel':{'type':Sequelize[_0x7bc8('0x6')]},'lastapplication':{'type':Sequelize[_0x7bc8('0x6')]},'lastdata':{'type':Sequelize[_0x7bc8('0x7')]},'starttime':{'type':Sequelize[_0x7bc8('0x8')]},'systemanswertime':{'type':Sequelize[_0x7bc8('0x8')]},'answertime':{'type':Sequelize[_0x7bc8('0x8')]},'endtime':{'type':Sequelize[_0x7bc8('0x8')]},'duration':{'type':Sequelize[_0x7bc8('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x7bc8('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7bc8('0x6')]},'userfield':{'type':Sequelize[_0x7bc8('0x6')]},'userDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x7bc8('0x6')]},'note':{'type':Sequelize[_0x7bc8('0x6')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x7bc8('0x9')]},'sipcallid':{'type':Sequelize[_0x7bc8('0x6')]}}; \ No newline at end of file +var _0x67a6=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','dialer'];(function(_0x3e06a6,_0x3a67a5){var _0x3a40c4=function(_0x475a9e){while(--_0x475a9e){_0x3e06a6['push'](_0x3e06a6['shift']());}};_0x3a40c4(++_0x3a67a5);}(_0x67a6,0x137));var _0x667a=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x67a6[_0x25248b];return _0x509939;};'use strict';var Sequelize=require(_0x667a('0x0'));module[_0x667a('0x1')]={'uniqueid':{'type':Sequelize[_0x667a('0x2')]},'type':{'type':Sequelize[_0x667a('0x3')](_0x667a('0x4'),_0x667a('0x5'),_0x667a('0x6'),'inbound-fax','outbound-fax',_0x667a('0x7'))},'tag':{'type':Sequelize[_0x667a('0x2')]},'accountcode':{'type':Sequelize[_0x667a('0x2')]},'source':{'type':Sequelize[_0x667a('0x2')]},'destination':{'type':Sequelize[_0x667a('0x2')]},'destinationcontext':{'type':Sequelize[_0x667a('0x2')]},'callerid':{'type':Sequelize[_0x667a('0x2')]},'channel':{'type':Sequelize[_0x667a('0x2')]},'destinationchannel':{'type':Sequelize[_0x667a('0x2')]},'lastapplication':{'type':Sequelize[_0x667a('0x2')]},'lastdata':{'type':Sequelize[_0x667a('0x8')]},'starttime':{'type':Sequelize[_0x667a('0x9')]},'systemanswertime':{'type':Sequelize[_0x667a('0x9')]},'answertime':{'type':Sequelize[_0x667a('0x9')]},'endtime':{'type':Sequelize[_0x667a('0x9')]},'duration':{'type':Sequelize[_0x667a('0xa')]},'billableseconds':{'type':Sequelize[_0x667a('0xa')]},'mohtime':{'type':Sequelize[_0x667a('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x667a('0x2')]},'amaflags':{'type':Sequelize[_0x667a('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x667a('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x667a('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x667a('0x2')]},'note':{'type':Sequelize[_0x667a('0x2')]},'prefix':{'type':Sequelize[_0x667a('0x2')]},'routeid':{'type':Sequelize[_0x667a('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index bcfcadd..f58d953 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x10cf43,_0x39bb82){_0x10cf43=_0x10cf43-0x0;var _0x154ea5=_0x2032[_0x10cf43];return _0x154ea5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x2d9bd2,_0x268f7c){var _0x242373=function(_0x681690){while(--_0x681690){_0x2d9bd2['push'](_0x2d9bd2['shift']());}};_0x242373(++_0x268f7c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b6847,_0x50c4d6){_0x4b6847=_0x4b6847-0x0;var _0x562863=_0x0b0e[_0x4b6847];return _0x562863;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 24d7d65..d8596c0 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 _0xe444=['request-promise','../../config/environment','exports','define','VoiceCallReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x327866,_0x54eded){var _0x17f0e3=function(_0x25b495){while(--_0x25b495){_0x327866['push'](_0x327866['shift']());}};_0x17f0e3(++_0x54eded);}(_0xe444,0x196));var _0x4e44=function(_0x25ba73,_0x151da9){_0x25ba73=_0x25ba73-0x0;var _0x5afaa6=_0xe444[_0x25ba73];return _0x5afaa6;};'use strict';var _=require(_0x4e44('0x0'));var util=require('util');var logger=require(_0x4e44('0x1'))(_0x4e44('0x2'));var moment=require(_0x4e44('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e44('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x4e44('0x6')]=function(_0x2897c0,_0x40a83f){return _0x2897c0[_0x4e44('0x7')](_0x4e44('0x8'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4e44('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8c8=['api','moment','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','../../config/logger'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xd8c8,0xba));var _0x8d8c=function(_0x50a946,_0x303c11){_0x50a946=_0x50a946-0x0;var _0x36b964=_0xd8c8[_0x50a946];return _0x36b964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d8c('0x0'))(_0x8d8c('0x1'));var moment=require(_0x8d8c('0x2'));var BPromise=require(_0x8d8c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d8c('0x4'));var config=require(_0x8d8c('0x5'));var attributes=require(_0x8d8c('0x6'));module[_0x8d8c('0x7')]=function(_0x1c94b9,_0x16021e){return _0x1c94b9[_0x8d8c('0x8')](_0x8d8c('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x8d8c('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 7c17416..0d63d75 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 _0x094e=['client','http','request','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','map','model','include','then','catch','create','body','CreateVoiceCallReport','update','UpdateVoiceCallReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x511f0b,_0x194864){var _0x4bcb4a=function(_0x4554ed){while(--_0x4554ed){_0x511f0b['push'](_0x511f0b['shift']());}};_0x4bcb4a(++_0x194864);}(_0x094e,0xbe));var _0xe094=function(_0x3cc3b1,_0x5b94e2){_0x3cc3b1=_0x3cc3b1-0x0;var _0x293104=_0x094e[_0x3cc3b1];return _0x293104;};'use strict';var _=require(_0xe094('0x0'));var util=require('util');var moment=require(_0xe094('0x1'));var BPromise=require('bluebird');var rs=require(_0xe094('0x2'));var fs=require('fs');var Redis=require(_0xe094('0x3'));var db=require(_0xe094('0x4'))['db'];var utils=require(_0xe094('0x5'));var logger=require(_0xe094('0x6'))(_0xe094('0x7'));var config=require(_0xe094('0x8'));var jayson=require(_0xe094('0x9'));var client=jayson[_0xe094('0xa')][_0xe094('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16ac99,_0x2ad933,_0x146863){return new BPromise(function(_0x2efd9b,_0x29692f){return client[_0xe094('0xc')](_0x16ac99,_0x146863)['then'](function(_0x3e97aa){logger[_0xe094('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0xe094('0xe'));logger[_0xe094('0xf')](_0xe094('0x10'),_0x2ad933,_0xe094('0xe'),JSON[_0xe094('0x11')](_0x3e97aa));if(_0x3e97aa['error']){if(_0x3e97aa[_0xe094('0x12')][_0xe094('0x13')]===0x1f4){logger[_0xe094('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0x3e97aa['error'][_0xe094('0x14')]);return _0x29692f(_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);}logger[_0xe094('0x12')](_0xe094('0x15'),_0x2ad933,_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);return _0x2efd9b(_0x3e97aa[_0xe094('0x12')][_0xe094('0x14')]);}else{logger['info'](_0xe094('0x15'),_0x2ad933,'request\x20sent');_0x2efd9b(_0x3e97aa[_0xe094('0x16')][_0xe094('0x14')]);}})['catch'](function(_0x1cff2c){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2ad933,_0x1cff2c);_0x29692f(_0x1cff2c);});});}exports[_0xe094('0x17')]=function(_0x44e468){var _0x36be95=this;return new Promise(function(_0x20601c,_0x59e9bd){return db[_0xe094('0x18')]['findAll']({'raw':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![],'where':_0x44e468[_0xe094('0x19')]?_0x44e468['options'][_0xe094('0x1b')]||null:null,'attributes':_0x44e468['options']?_0x44e468[_0xe094('0x19')][_0xe094('0x1c')]||null:null,'limit':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')][_0xe094('0x1d')]||null:null,'include':_0x44e468[_0xe094('0x19')]?_0x44e468[_0xe094('0x19')]['include']?_[_0xe094('0x1e')](_0x44e468['options']['include'],function(_0x394278){return{'model':db[_0x394278[_0xe094('0x1f')]],'as':_0x394278['as'],'attributes':_0x394278[_0xe094('0x1c')],'include':_0x394278[_0xe094('0x20')]?_[_0xe094('0x1e')](_0x394278['include'],function(_0x336d55){return{'model':db[_0x336d55[_0xe094('0x1f')]],'as':_0x336d55['as'],'attributes':_0x336d55[_0xe094('0x1c')],'include':_0x336d55[_0xe094('0x20')]?_[_0xe094('0x1e')](_0x336d55['include'],function(_0x440443){return{'model':db[_0x440443[_0xe094('0x1f')]],'as':_0x440443['as'],'attributes':_0x440443[_0xe094('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe094('0x21')](function(_0x2327a3){logger['info']('GetVoiceCallReport',_0x44e468);logger[_0xe094('0xf')](_0xe094('0x17'),_0x44e468,JSON[_0xe094('0x11')](_0x2327a3));_0x20601c(_0x2327a3);})[_0xe094('0x22')](function(_0x3ede13){logger['error'](_0xe094('0x17'),_0x3ede13[_0xe094('0x14')],_0x44e468);_0x59e9bd(_0x36be95[_0xe094('0x12')](0x1f4,_0x3ede13[_0xe094('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x1c68f0){var _0x2a7b99=this;return new Promise(function(_0x55d515,_0x559d61){return db[_0xe094('0x18')][_0xe094('0x23')](_0x1c68f0[_0xe094('0x24')],{'raw':_0x1c68f0[_0xe094('0x19')]?_0x1c68f0[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x17b275){logger[_0xe094('0xd')](_0xe094('0x25'),_0x1c68f0);logger[_0xe094('0xf')]('CreateVoiceCallReport',_0x1c68f0,JSON[_0xe094('0x11')](_0x17b275));_0x55d515(_0x17b275);})[_0xe094('0x22')](function(_0x1371a1){logger['error']('CreateVoiceCallReport',_0x1371a1[_0xe094('0x14')],_0x1c68f0);_0x559d61(_0x2a7b99[_0xe094('0x12')](0x1f4,_0x1371a1[_0xe094('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x63c700){var _0x5c6649=this;return new Promise(function(_0x2ceab9,_0x355333){return db['VoiceCallReport'][_0xe094('0x26')](_0x63c700[_0xe094('0x24')],{'raw':_0x63c700[_0xe094('0x19')]?_0x63c700[_0xe094('0x19')][_0xe094('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63c700[_0xe094('0x19')]?_0x63c700['options'][_0xe094('0x1b')]||null:null,'attributes':_0x63c700[_0xe094('0x19')]?_0x63c700[_0xe094('0x19')][_0xe094('0x1c')]||null:null,'limit':_0x63c700[_0xe094('0x19')]?_0x63c700['options'][_0xe094('0x1d')]||null:null})[_0xe094('0x21')](function(_0x426379){logger[_0xe094('0xd')](_0xe094('0x27'),_0x63c700);logger[_0xe094('0xf')](_0xe094('0x27'),_0x63c700,JSON['stringify'](_0x426379));_0x2ceab9(_0x426379);})['catch'](function(_0x3b1f01){logger[_0xe094('0x12')]('UpdateVoiceCallReport',_0x3b1f01['message'],_0x63c700);_0x355333(_0x5c6649[_0xe094('0x12')](0x1f4,_0x3b1f01[_0xe094('0x14')]));});});}; \ No newline at end of file +var _0xa85b=['client','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','include','map','attributes','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x406cc1,_0x40f8da){var _0x44546e=function(_0x5dd9e5){while(--_0x5dd9e5){_0x406cc1['push'](_0x406cc1['shift']());}};_0x44546e(++_0x40f8da);}(_0xa85b,0xdf));var _0xba85=function(_0x4df462,_0x11b2b9){_0x4df462=_0x4df462-0x0;var _0xe401c1=_0xa85b[_0x4df462];return _0xe401c1;};'use strict';var _=require(_0xba85('0x0'));var util=require(_0xba85('0x1'));var moment=require(_0xba85('0x2'));var BPromise=require(_0xba85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xba85('0x4'));var db=require(_0xba85('0x5'))['db'];var utils=require(_0xba85('0x6'));var logger=require(_0xba85('0x7'))(_0xba85('0x8'));var config=require(_0xba85('0x9'));var jayson=require(_0xba85('0xa'));var client=jayson[_0xba85('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe62ab,_0x4b3b86,_0x1742d6){return new BPromise(function(_0x2ed9d7,_0x3fcaa6){return client[_0xba85('0xc')](_0xe62ab,_0x1742d6)[_0xba85('0xd')](function(_0x8b55ef){logger[_0xba85('0xe')](_0xba85('0xf'),_0x4b3b86,'request\x20sent');logger[_0xba85('0x10')](_0xba85('0x11'),_0x4b3b86,_0xba85('0x12'),JSON[_0xba85('0x13')](_0x8b55ef));if(_0x8b55ef[_0xba85('0x14')]){if(_0x8b55ef[_0xba85('0x14')][_0xba85('0x15')]===0x1f4){logger[_0xba85('0x14')](_0xba85('0xf'),_0x4b3b86,_0x8b55ef[_0xba85('0x14')][_0xba85('0x16')]);return _0x3fcaa6(_0x8b55ef['error'][_0xba85('0x16')]);}logger[_0xba85('0x14')](_0xba85('0xf'),_0x4b3b86,_0x8b55ef[_0xba85('0x14')][_0xba85('0x16')]);return _0x2ed9d7(_0x8b55ef[_0xba85('0x14')]['message']);}else{logger['info'](_0xba85('0xf'),_0x4b3b86,_0xba85('0x12'));_0x2ed9d7(_0x8b55ef[_0xba85('0x17')][_0xba85('0x16')]);}})[_0xba85('0x18')](function(_0x2d058b){logger['error'](_0xba85('0xf'),_0x4b3b86,_0x2d058b);_0x3fcaa6(_0x2d058b);});});}exports['GetVoiceCallReport']=function(_0x44886f){var _0x4dd82b=this;return new Promise(function(_0xac93bd,_0xc236b7){return db['VoiceCallReport']['findAll']({'raw':_0x44886f[_0xba85('0x19')]?_0x44886f[_0xba85('0x19')][_0xba85('0x1a')]===undefined?!![]:![]:!![],'where':_0x44886f[_0xba85('0x19')]?_0x44886f[_0xba85('0x19')][_0xba85('0x1b')]||null:null,'attributes':_0x44886f['options']?_0x44886f[_0xba85('0x19')]['attributes']||null:null,'limit':_0x44886f['options']?_0x44886f[_0xba85('0x19')][_0xba85('0x1c')]||null:null,'include':_0x44886f[_0xba85('0x19')]?_0x44886f[_0xba85('0x19')][_0xba85('0x1d')]?_[_0xba85('0x1e')](_0x44886f[_0xba85('0x19')][_0xba85('0x1d')],function(_0x3a4788){return{'model':db[_0x3a4788['model']],'as':_0x3a4788['as'],'attributes':_0x3a4788[_0xba85('0x1f')],'include':_0x3a4788[_0xba85('0x1d')]?_['map'](_0x3a4788[_0xba85('0x1d')],function(_0x181f1a){return{'model':db[_0x181f1a[_0xba85('0x20')]],'as':_0x181f1a['as'],'attributes':_0x181f1a['attributes'],'include':_0x181f1a[_0xba85('0x1d')]?_[_0xba85('0x1e')](_0x181f1a[_0xba85('0x1d')],function(_0x149137){return{'model':db[_0x149137['model']],'as':_0x149137['as'],'attributes':_0x149137[_0xba85('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xba85('0xd')](function(_0x5c4169){logger[_0xba85('0xe')](_0xba85('0x21'),_0x44886f);logger['debug'](_0xba85('0x21'),_0x44886f,JSON['stringify'](_0x5c4169));_0xac93bd(_0x5c4169);})['catch'](function(_0x266917){logger[_0xba85('0x14')](_0xba85('0x21'),_0x266917[_0xba85('0x16')],_0x44886f);_0xc236b7(_0x4dd82b['error'](0x1f4,_0x266917[_0xba85('0x16')]));});});};exports[_0xba85('0x22')]=function(_0x2174a4){var _0x1878c5=this;return new Promise(function(_0x36025a,_0x5eda20){return db[_0xba85('0x23')]['create'](_0x2174a4[_0xba85('0x24')],{'raw':_0x2174a4[_0xba85('0x19')]?_0x2174a4[_0xba85('0x19')][_0xba85('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x826979){logger[_0xba85('0xe')](_0xba85('0x22'),_0x2174a4);logger['debug'](_0xba85('0x22'),_0x2174a4,JSON[_0xba85('0x13')](_0x826979));_0x36025a(_0x826979);})[_0xba85('0x18')](function(_0x475bc0){logger[_0xba85('0x14')]('CreateVoiceCallReport',_0x475bc0[_0xba85('0x16')],_0x2174a4);_0x5eda20(_0x1878c5['error'](0x1f4,_0x475bc0['message']));});});};exports[_0xba85('0x25')]=function(_0x5a5d99){var _0x13e9ac=this;return new Promise(function(_0x2cd63a,_0x149188){return db[_0xba85('0x23')][_0xba85('0x26')](_0x5a5d99[_0xba85('0x24')],{'raw':_0x5a5d99[_0xba85('0x19')]?_0x5a5d99[_0xba85('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5d99[_0xba85('0x19')]?_0x5a5d99[_0xba85('0x19')]['where']||null:null,'attributes':_0x5a5d99[_0xba85('0x19')]?_0x5a5d99['options'][_0xba85('0x1f')]||null:null,'limit':_0x5a5d99[_0xba85('0x19')]?_0x5a5d99[_0xba85('0x19')][_0xba85('0x1c')]||null:null})[_0xba85('0xd')](function(_0x4e54cb){logger[_0xba85('0xe')](_0xba85('0x25'),_0x5a5d99);logger[_0xba85('0x10')](_0xba85('0x25'),_0x5a5d99,JSON[_0xba85('0x13')](_0x4e54cb));_0x2cd63a(_0x4e54cb);})[_0xba85('0x18')](function(_0x1bb759){logger[_0xba85('0x14')](_0xba85('0x25'),_0x1bb759[_0xba85('0x16')],_0x5a5d99);_0x149188(_0x13e9ac[_0xba85('0x14')](0x1f4,_0x1bb759[_0xba85('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index dc3ce50..6dbc19a 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 _0x247f=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5eff3c,_0x1270c3){var _0xaa9aba=function(_0x40478e){while(--_0x40478e){_0x5eff3c['push'](_0x5eff3c['shift']());}};_0xaa9aba(++_0x1270c3);}(_0x247f,0x1a9));var _0xf247=function(_0x4b16a6,_0x33051c){_0x4b16a6=_0x4b16a6-0x0;var _0x4b767b=_0x247f[_0x4b16a6];return _0x4b767b;};'use strict';var multer=require(_0xf247('0x0'));var util=require(_0xf247('0x1'));var path=require(_0xf247('0x2'));var timeout=require(_0xf247('0x3'));var express=require('express');var router=express[_0xf247('0x4')]();var fs_extra=require(_0xf247('0x5'));var auth=require(_0xf247('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf247('0x7'));var controller=require(_0xf247('0x8'));router[_0xf247('0x9')]('/',auth[_0xf247('0xa')](),controller[_0xf247('0xb')]);router[_0xf247('0x9')]('/:id',auth[_0xf247('0xa')](),controller[_0xf247('0xc')]);router[_0xf247('0xd')]('/',auth[_0xf247('0xa')](),controller[_0xf247('0xe')]);router[_0xf247('0xf')]('/:id',auth[_0xf247('0xa')](),controller['update']);router[_0xf247('0x10')](_0xf247('0x11'),auth[_0xf247('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ce5=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x3c0138,_0x2aa33e){var _0x206403=function(_0x68b3f9){while(--_0x68b3f9){_0x3c0138['push'](_0x3c0138['shift']());}};_0x206403(++_0x2aa33e);}(_0x6ce5,0xff));var _0x56ce=function(_0x525b61,_0x1f2346){_0x525b61=_0x525b61-0x0;var _0x4aab1d=_0x6ce5[_0x525b61];return _0x4aab1d;};'use strict';var multer=require(_0x56ce('0x0'));var util=require(_0x56ce('0x1'));var path=require(_0x56ce('0x2'));var timeout=require('connect-timeout');var express=require(_0x56ce('0x3'));var router=express[_0x56ce('0x4')]();var fs_extra=require(_0x56ce('0x5'));var auth=require(_0x56ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x56ce('0x7'));var controller=require(_0x56ce('0x8'));router[_0x56ce('0x9')]('/',auth[_0x56ce('0xa')](),controller[_0x56ce('0xb')]);router['get'](_0x56ce('0xc'),auth[_0x56ce('0xa')](),controller['show']);router[_0x56ce('0xd')]('/',auth[_0x56ce('0xa')](),controller[_0x56ce('0xe')]);router['put'](_0x56ce('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x56ce('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x56ce('0x10')]);module[_0x56ce('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a867922..6ba46e4 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 _0x0dfc=['join','getDataValue','BOOLEAN','exports','name','STRING','setDataValue','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0dfc,0x123));var _0xc0df=function(_0x43a23a,_0x582599){_0x43a23a=_0x43a23a-0x0;var _0x37adad=_0x0dfc[_0x43a23a];return _0x37adad;};'use strict';var Sequelize=require('sequelize');module[_0xc0df('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xc0df('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xc0df('0x2')],'set':function(_0x46bed7){this[_0xc0df('0x3')](_0xc0df('0x4'),_0x46bed7?_0x46bed7[_0xc0df('0x5')](''):[]);},'get':function(){return this[_0xc0df('0x6')](_0xc0df('0x4'))?this[_0xc0df('0x6')](_0xc0df('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc0df('0x2')]},'record':{'type':Sequelize[_0xc0df('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc0df('0x2')]},'description':{'type':Sequelize[_0xc0df('0x2')]}}; \ No newline at end of file +var _0xc1e7=['exports','STRING','options','getDataValue','split','BOOLEAN','sequelize'];(function(_0x309118,_0x11dddc){var _0x513f46=function(_0x2ba6d){while(--_0x2ba6d){_0x309118['push'](_0x309118['shift']());}};_0x513f46(++_0x11dddc);}(_0xc1e7,0x15d));var _0x7c1e=function(_0x49fb86,_0xe7dcd9){_0x49fb86=_0x49fb86-0x0;var _0x535b41=_0xc1e7[_0x49fb86];return _0x535b41;};'use strict';var Sequelize=require(_0x7c1e('0x0'));module[_0x7c1e('0x1')]={'name':{'type':Sequelize[_0x7c1e('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x7c1e('0x2')],'set':function(_0x17376a){this['setDataValue'](_0x7c1e('0x3'),_0x17376a?_0x17376a['join'](''):[]);},'get':function(){return this[_0x7c1e('0x4')]('options')?this[_0x7c1e('0x4')]('options')[_0x7c1e('0x5')](''):[];}},'auth':{'type':Sequelize[_0x7c1e('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x7c1e('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7c1e('0x2')]},'description':{'type':Sequelize[_0x7c1e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fd891ef..7bdf76a 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 _0xb492=['model','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','ChanSpies','UserProfileResource','then','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x363a5f,_0x1c57ef){var _0x595004=function(_0x26cd51){while(--_0x26cd51){_0x363a5f['push'](_0x363a5f['shift']());}};_0x595004(++_0x1c57ef);}(_0xb492,0x172));var _0x2b49=function(_0x296297,_0x38f373){_0x296297=_0x296297-0x0;var _0x1cce18=_0xb492[_0x296297];return _0x1cce18;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b49('0x0'));var zipdir=require(_0x2b49('0x1'));var jsonpatch=require(_0x2b49('0x2'));var rp=require(_0x2b49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b49('0x4'));var util=require(_0x2b49('0x5'));var path=require(_0x2b49('0x6'));var sox=require(_0x2b49('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b49('0x8'));var _=require(_0x2b49('0x9'));var squel=require(_0x2b49('0xa'));var crypto=require(_0x2b49('0xb'));var jsforce=require(_0x2b49('0xc'));var deskjs=require(_0x2b49('0xd'));var toCsv=require(_0x2b49('0xe'));var querystring=require(_0x2b49('0xf'));var Papa=require('papaparse');var Redis=require(_0x2b49('0x10'));var authService=require(_0x2b49('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b49('0x12'));var hardwareService=require(_0x2b49('0x13'));var logger=require(_0x2b49('0x14'))('api');var utils=require(_0x2b49('0x15'));var config=require(_0x2b49('0x16'));var licenseUtil=require(_0x2b49('0x17'));var db=require(_0x2b49('0x18'))['db'];function respondWithStatusCode(_0x1af731,_0x1bda39){_0x1bda39=_0x1bda39||0xcc;return function(_0x5aad36){if(_0x5aad36){return _0x1af731['sendStatus'](_0x1bda39);}return _0x1af731[_0x2b49('0x19')](_0x1bda39)[_0x2b49('0x1a')]();};}function respondWithResult(_0x5e7361,_0x4dec02){_0x4dec02=_0x4dec02||0xc8;return function(_0x30eb71){if(_0x30eb71){return _0x5e7361[_0x2b49('0x19')](_0x4dec02)[_0x2b49('0x1b')](_0x30eb71);}};}function respondWithFilteredResult(_0x4d114b,_0x14fb17){return function(_0xf92e0d){if(_0xf92e0d){var _0x5ee983=typeof _0x14fb17['offset']===_0x2b49('0x1c')&&typeof _0x14fb17[_0x2b49('0x1d')]===_0x2b49('0x1c');var _0x14359f=_0xf92e0d[_0x2b49('0x1e')];var _0x248de1=_0x5ee983?0x0:_0x14fb17[_0x2b49('0x1f')];var _0x25f0d8=_0x5ee983?_0xf92e0d[_0x2b49('0x1e')]:_0x14fb17[_0x2b49('0x1f')]+_0x14fb17['limit'];var _0x37b4ae;if(_0x25f0d8>=_0x14359f){_0x25f0d8=_0x14359f;_0x37b4ae=0xc8;}else{_0x37b4ae=0xce;}_0x4d114b['status'](_0x37b4ae);return _0x4d114b[_0x2b49('0x20')](_0x2b49('0x21'),_0x248de1+'-'+_0x25f0d8+'/'+_0x14359f)[_0x2b49('0x1b')](_0xf92e0d);}return null;};}function patchUpdates(_0x389ff0){return function(_0x1e54f4){try{jsonpatch[_0x2b49('0x22')](_0x1e54f4,_0x389ff0,!![]);}catch(_0x5d33f8){return BPromise[_0x2b49('0x23')](_0x5d33f8);}return _0x1e54f4[_0x2b49('0x24')]();};}function saveUpdates(_0x38edc3,_0x5840ef){return function(_0x8e4c){if(_0x8e4c){return _0x8e4c['update'](_0x38edc3)['then'](function(_0x3107b1){return _0x3107b1;});}return null;};}function removeEntity(_0x1242bb,_0x744835){return function(_0x509164){if(_0x509164){return _0x509164[_0x2b49('0x25')]()['then'](function(){var _0x79f455=_0x509164['get']({'plain':!![]});var _0x3ea951=_0x2b49('0x26');return db[_0x2b49('0x27')][_0x2b49('0x25')]({'where':{'type':_0x3ea951,'resourceId':_0x79f455['id']}})['then'](function(){return _0x509164;});})[_0x2b49('0x28')](function(){_0x1242bb[_0x2b49('0x19')](0xcc)[_0x2b49('0x1a')]();});}};}function handleEntityNotFound(_0x70fa33,_0x4622e1){return function(_0x14d66b){if(!_0x14d66b){_0x70fa33['sendStatus'](0x194);}return _0x14d66b;};}function handleError(_0x267bad,_0x34cba2){_0x34cba2=_0x34cba2||0x1f4;return function(_0x237233){logger[_0x2b49('0x29')](_0x237233[_0x2b49('0x2a')]);if(_0x237233[_0x2b49('0x2b')]){delete _0x237233[_0x2b49('0x2b')];}_0x267bad[_0x2b49('0x19')](_0x34cba2)[_0x2b49('0x2c')](_0x237233);};}exports['index']=function(_0x117bed,_0x65c004){var _0x298497={},_0x54f74d={},_0x59f8e5={'count':0x0,'rows':[]};var _0x4cd74b=_[_0x2b49('0x2d')](db[_0x2b49('0x2e')][_0x2b49('0x2f')],function(_0x80f27a){return{'name':_0x80f27a[_0x2b49('0x30')],'type':_0x80f27a[_0x2b49('0x31')][_0x2b49('0x32')]};});_0x54f74d['model']=_[_0x2b49('0x2d')](_0x4cd74b,_0x2b49('0x2b'));_0x54f74d[_0x2b49('0x33')]=_[_0x2b49('0x34')](_0x117bed[_0x2b49('0x33')]);_0x54f74d[_0x2b49('0x35')]=_[_0x2b49('0x36')](_0x54f74d[_0x2b49('0x37')],_0x54f74d[_0x2b49('0x33')]);_0x298497[_0x2b49('0x38')]=_[_0x2b49('0x36')](_0x54f74d[_0x2b49('0x37')],qs[_0x2b49('0x39')](_0x117bed[_0x2b49('0x33')]['fields']));_0x298497[_0x2b49('0x38')]=_0x298497['attributes']['length']?_0x298497['attributes']:_0x54f74d[_0x2b49('0x37')];if(!_0x117bed[_0x2b49('0x33')][_0x2b49('0x3a')]('nolimit')){_0x298497['limit']=qs['limit'](_0x117bed[_0x2b49('0x33')][_0x2b49('0x1d')]);_0x298497[_0x2b49('0x1f')]=qs['offset'](_0x117bed[_0x2b49('0x33')]['offset']);}_0x298497['order']=qs['sort'](_0x117bed[_0x2b49('0x33')][_0x2b49('0x3b')]);_0x298497['where']=qs['filters'](_[_0x2b49('0x3c')](_0x117bed[_0x2b49('0x33')],_0x54f74d[_0x2b49('0x35')]),_0x4cd74b);if(_0x117bed[_0x2b49('0x33')]['filter']){_0x298497[_0x2b49('0x3d')]=_[_0x2b49('0x3e')](_0x298497[_0x2b49('0x3d')],{'$or':_[_0x2b49('0x2d')](_0x4cd74b,function(_0x347de6){if(_0x347de6['type']!==_0x2b49('0x3f')){var _0x12df8a={};_0x12df8a[_0x347de6[_0x2b49('0x2b')]]={'$like':'%'+_0x117bed[_0x2b49('0x33')][_0x2b49('0x40')]+'%'};return _0x12df8a;}})});}_0x298497=_['merge']({},_0x298497,_0x117bed['options']);var _0x4106d9={'where':_0x298497[_0x2b49('0x3d')]};return db['VoiceChanSpy'][_0x2b49('0x1e')](_0x4106d9)['then'](function(_0x4521d0){_0x59f8e5[_0x2b49('0x1e')]=_0x4521d0;if(_0x117bed[_0x2b49('0x33')][_0x2b49('0x41')]){_0x298497['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x2b49('0x42')](_0x298497);})[_0x2b49('0x28')](function(_0x4ff21d){_0x59f8e5[_0x2b49('0x43')]=_0x4ff21d;return _0x59f8e5;})[_0x2b49('0x28')](respondWithFilteredResult(_0x65c004,_0x298497))[_0x2b49('0x44')](handleError(_0x65c004,null));};exports[_0x2b49('0x45')]=function(_0x27a614,_0x452701){var _0x3bb91f={'raw':![],'where':{'id':_0x27a614[_0x2b49('0x46')]['id']}},_0xd3b4f8={};_0xd3b4f8['model']=_['keys'](db['VoiceChanSpy'][_0x2b49('0x2f')]);_0xd3b4f8[_0x2b49('0x33')]=_[_0x2b49('0x34')](_0x27a614[_0x2b49('0x33')]);_0xd3b4f8['filters']=_[_0x2b49('0x36')](_0xd3b4f8[_0x2b49('0x37')],_0xd3b4f8[_0x2b49('0x33')]);_0x3bb91f[_0x2b49('0x38')]=_[_0x2b49('0x36')](_0xd3b4f8[_0x2b49('0x37')],qs[_0x2b49('0x39')](_0x27a614[_0x2b49('0x33')][_0x2b49('0x39')]));_0x3bb91f[_0x2b49('0x38')]=_0x3bb91f['attributes'][_0x2b49('0x47')]?_0x3bb91f['attributes']:_0xd3b4f8[_0x2b49('0x37')];if(_0x27a614[_0x2b49('0x33')]['includeAll']){_0x3bb91f[_0x2b49('0x48')]=[{'all':!![]}];}_0x3bb91f=_[_0x2b49('0x3e')]({},_0x3bb91f,_0x27a614[_0x2b49('0x49')]);return db[_0x2b49('0x2e')][_0x2b49('0x4a')](_0x3bb91f)['then'](handleEntityNotFound(_0x452701,null))[_0x2b49('0x28')](respondWithResult(_0x452701,null))[_0x2b49('0x44')](handleError(_0x452701,null));};exports[_0x2b49('0x4b')]=function(_0x4ff422,_0x4ec660){return db[_0x2b49('0x2e')][_0x2b49('0x4b')](_0x4ff422['body'],{})['then'](function(_0x2f5ea1){var _0x2396bb=_0x4ff422[_0x2b49('0x4c')]['get']({'plain':!![]});if(!_0x2396bb)throw new Error(_0x2b49('0x4d'));if(_0x2396bb[_0x2b49('0x4e')]===_0x2b49('0x4c')){var _0x29dc15=_0x2f5ea1['get']({'plain':!![]});var _0xb197b1='ChanSpies';return db[_0x2b49('0x4f')][_0x2b49('0x4a')]({'where':{'name':_0xb197b1,'userProfileId':_0x2396bb[_0x2b49('0x50')]},'raw':!![]})['then'](function(_0x14dafb){if(_0x14dafb&&_0x14dafb[_0x2b49('0x51')]===0x0){return db[_0x2b49('0x27')][_0x2b49('0x4b')]({'name':_0x29dc15[_0x2b49('0x2b')],'resourceId':_0x29dc15['id'],'type':_0x14dafb[_0x2b49('0x2b')],'sectionId':_0x14dafb['id']},{})[_0x2b49('0x28')](function(){return _0x2f5ea1;});}else{return _0x2f5ea1;}})[_0x2b49('0x44')](function(_0x348720){logger[_0x2b49('0x29')](_0x2b49('0x52'),_0x348720);throw _0x348720;});}return _0x2f5ea1;})[_0x2b49('0x28')](respondWithResult(_0x4ec660,0xc9))[_0x2b49('0x44')](handleError(_0x4ec660,null));};exports[_0x2b49('0x53')]=function(_0x354d2e,_0x3e7085){if(_0x354d2e[_0x2b49('0x54')]['id']){delete _0x354d2e[_0x2b49('0x54')]['id'];}return db[_0x2b49('0x2e')][_0x2b49('0x4a')]({'where':{'id':_0x354d2e[_0x2b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e7085,null))[_0x2b49('0x28')](saveUpdates(_0x354d2e['body'],null))['then'](respondWithResult(_0x3e7085,null))[_0x2b49('0x44')](handleError(_0x3e7085,null));};exports[_0x2b49('0x25')]=function(_0x3502f2,_0x197d2f){return db[_0x2b49('0x2e')][_0x2b49('0x4a')]({'where':{'id':_0x3502f2[_0x2b49('0x46')]['id']}})['then'](handleEntityNotFound(_0x197d2f,null))[_0x2b49('0x28')](removeEntity(_0x197d2f,null))[_0x2b49('0x44')](handleError(_0x197d2f,null));}; \ No newline at end of file +var _0x668b=['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','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x3a9cae,_0x3b2a2d){var _0x3b19c5=function(_0x4ad944){while(--_0x4ad944){_0x3a9cae['push'](_0x3a9cae['shift']());}};_0x3b19c5(++_0x3b2a2d);}(_0x668b,0x140));var _0xb668=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x668b[_0x1b4002];return _0x1716f3;};'use strict';var emlformat=require(_0xb668('0x0'));var rimraf=require(_0xb668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb668('0x2'));var rp=require(_0xb668('0x3'));var moment=require('moment');var BPromise=require(_0xb668('0x4'));var Mustache=require('mustache');var util=require(_0xb668('0x5'));var path=require(_0xb668('0x6'));var sox=require(_0xb668('0x7'));var csv=require('to-csv');var ejs=require(_0xb668('0x8'));var fs=require('fs');var fs_extra=require(_0xb668('0x9'));var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0xe'));var querystring=require(_0xb668('0xf'));var Papa=require(_0xb668('0x10'));var Redis=require(_0xb668('0x11'));var authService=require(_0xb668('0x12'));var qs=require(_0xb668('0x13'));var as=require(_0xb668('0x14'));var hardwareService=require(_0xb668('0x15'));var logger=require('../../config/logger')(_0xb668('0x16'));var utils=require(_0xb668('0x17'));var config=require(_0xb668('0x18'));var licenseUtil=require(_0xb668('0x19'));var db=require(_0xb668('0x1a'))['db'];function respondWithStatusCode(_0x167057,_0x1d111a){_0x1d111a=_0x1d111a||0xcc;return function(_0x10ed24){if(_0x10ed24){return _0x167057[_0xb668('0x1b')](_0x1d111a);}return _0x167057[_0xb668('0x1c')](_0x1d111a)[_0xb668('0x1d')]();};}function respondWithResult(_0x3b7556,_0x3aed25){_0x3aed25=_0x3aed25||0xc8;return function(_0xd0450f){if(_0xd0450f){return _0x3b7556[_0xb668('0x1c')](_0x3aed25)[_0xb668('0x1e')](_0xd0450f);}};}function respondWithFilteredResult(_0x1ca6e7,_0x222cad){return function(_0x4fa32a){if(_0x4fa32a){var _0x4a755b=typeof _0x222cad[_0xb668('0x1f')]===_0xb668('0x20')&&typeof _0x222cad['limit']===_0xb668('0x20');var _0x567ad7=_0x4fa32a[_0xb668('0x21')];var _0x89fe72=_0x4a755b?0x0:_0x222cad['offset'];var _0x38595d=_0x4a755b?_0x4fa32a[_0xb668('0x21')]:_0x222cad['offset']+_0x222cad[_0xb668('0x22')];var _0x5b31ab;if(_0x38595d>=_0x567ad7){_0x38595d=_0x567ad7;_0x5b31ab=0xc8;}else{_0x5b31ab=0xce;}_0x1ca6e7[_0xb668('0x1c')](_0x5b31ab);return _0x1ca6e7[_0xb668('0x23')](_0xb668('0x24'),_0x89fe72+'-'+_0x38595d+'/'+_0x567ad7)[_0xb668('0x1e')](_0x4fa32a);}return null;};}function patchUpdates(_0x5d33ae){return function(_0x2b7f96){try{jsonpatch[_0xb668('0x25')](_0x2b7f96,_0x5d33ae,!![]);}catch(_0x25e5be){return BPromise['reject'](_0x25e5be);}return _0x2b7f96['save']();};}function saveUpdates(_0x43a70b,_0x1e5620){return function(_0x517eee){if(_0x517eee){return _0x517eee[_0xb668('0x26')](_0x43a70b)['then'](function(_0x2f1394){return _0x2f1394;});}return null;};}function removeEntity(_0x4bd365,_0x3f4745){return function(_0x1e1c94){if(_0x1e1c94){return _0x1e1c94[_0xb668('0x27')]()[_0xb668('0x28')](function(){var _0x2a5b3d=_0x1e1c94[_0xb668('0x29')]({'plain':!![]});var _0x4d4bf8=_0xb668('0x2a');return db[_0xb668('0x2b')][_0xb668('0x27')]({'where':{'type':_0x4d4bf8,'resourceId':_0x2a5b3d['id']}})['then'](function(){return _0x1e1c94;});})['then'](function(){_0x4bd365[_0xb668('0x1c')](0xcc)[_0xb668('0x1d')]();});}};}function handleEntityNotFound(_0x30b965,_0x5a67e9){return function(_0x3a2543){if(!_0x3a2543){_0x30b965[_0xb668('0x1b')](0x194);}return _0x3a2543;};}function handleError(_0x1616e5,_0x4c78a0){_0x4c78a0=_0x4c78a0||0x1f4;return function(_0x5709e2){logger[_0xb668('0x2c')](_0x5709e2[_0xb668('0x2d')]);if(_0x5709e2['name']){delete _0x5709e2[_0xb668('0x2e')];}_0x1616e5[_0xb668('0x1c')](_0x4c78a0)[_0xb668('0x2f')](_0x5709e2);};}exports[_0xb668('0x30')]=function(_0x256a8,_0x5f36b5){var _0x138ee5={},_0x3bd27c={},_0x5dfa2c={'count':0x0,'rows':[]};var _0x28bcdd=_['map'](db[_0xb668('0x31')][_0xb668('0x32')],function(_0x467fea){return{'name':_0x467fea[_0xb668('0x33')],'type':_0x467fea[_0xb668('0x34')][_0xb668('0x35')]};});_0x3bd27c[_0xb668('0x36')]=_[_0xb668('0x37')](_0x28bcdd,_0xb668('0x2e'));_0x3bd27c['query']=_[_0xb668('0x38')](_0x256a8[_0xb668('0x39')]);_0x3bd27c[_0xb668('0x3a')]=_['intersection'](_0x3bd27c[_0xb668('0x36')],_0x3bd27c[_0xb668('0x39')]);_0x138ee5[_0xb668('0x3b')]=_[_0xb668('0x3c')](_0x3bd27c['model'],qs[_0xb668('0x3d')](_0x256a8[_0xb668('0x39')][_0xb668('0x3d')]));_0x138ee5[_0xb668('0x3b')]=_0x138ee5[_0xb668('0x3b')][_0xb668('0x3e')]?_0x138ee5[_0xb668('0x3b')]:_0x3bd27c['model'];if(!_0x256a8[_0xb668('0x39')][_0xb668('0x3f')]('nolimit')){_0x138ee5[_0xb668('0x22')]=qs['limit'](_0x256a8['query'][_0xb668('0x22')]);_0x138ee5[_0xb668('0x1f')]=qs['offset'](_0x256a8[_0xb668('0x39')]['offset']);}_0x138ee5[_0xb668('0x40')]=qs['sort'](_0x256a8['query'][_0xb668('0x41')]);_0x138ee5[_0xb668('0x42')]=qs['filters'](_['pick'](_0x256a8[_0xb668('0x39')],_0x3bd27c[_0xb668('0x3a')]),_0x28bcdd);if(_0x256a8[_0xb668('0x39')][_0xb668('0x43')]){_0x138ee5[_0xb668('0x42')]=_['merge'](_0x138ee5['where'],{'$or':_[_0xb668('0x37')](_0x28bcdd,function(_0x43e98c){if(_0x43e98c[_0xb668('0x34')]!==_0xb668('0x44')){var _0x41aeca={};_0x41aeca[_0x43e98c[_0xb668('0x2e')]]={'$like':'%'+_0x256a8['query']['filter']+'%'};return _0x41aeca;}})});}_0x138ee5=_[_0xb668('0x45')]({},_0x138ee5,_0x256a8[_0xb668('0x46')]);var _0x89956d={'where':_0x138ee5[_0xb668('0x42')]};return db[_0xb668('0x31')]['count'](_0x89956d)[_0xb668('0x28')](function(_0x429b14){_0x5dfa2c['count']=_0x429b14;if(_0x256a8[_0xb668('0x39')][_0xb668('0x47')]){_0x138ee5[_0xb668('0x48')]=[{'all':!![]}];}return db[_0xb668('0x31')]['findAll'](_0x138ee5);})['then'](function(_0x4b7192){_0x5dfa2c[_0xb668('0x49')]=_0x4b7192;return _0x5dfa2c;})['then'](respondWithFilteredResult(_0x5f36b5,_0x138ee5))['catch'](handleError(_0x5f36b5,null));};exports['show']=function(_0x50ffe0,_0x467ac9){var _0x4874a8={'raw':![],'where':{'id':_0x50ffe0[_0xb668('0x4a')]['id']}},_0x14b269={};_0x14b269[_0xb668('0x36')]=_[_0xb668('0x38')](db[_0xb668('0x31')]['rawAttributes']);_0x14b269[_0xb668('0x39')]=_[_0xb668('0x38')](_0x50ffe0[_0xb668('0x39')]);_0x14b269[_0xb668('0x3a')]=_[_0xb668('0x3c')](_0x14b269[_0xb668('0x36')],_0x14b269[_0xb668('0x39')]);_0x4874a8[_0xb668('0x3b')]=_[_0xb668('0x3c')](_0x14b269[_0xb668('0x36')],qs[_0xb668('0x3d')](_0x50ffe0['query'][_0xb668('0x3d')]));_0x4874a8[_0xb668('0x3b')]=_0x4874a8[_0xb668('0x3b')]['length']?_0x4874a8['attributes']:_0x14b269[_0xb668('0x36')];if(_0x50ffe0['query'][_0xb668('0x47')]){_0x4874a8['include']=[{'all':!![]}];}_0x4874a8=_['merge']({},_0x4874a8,_0x50ffe0['options']);return db[_0xb668('0x31')][_0xb668('0x4b')](_0x4874a8)['then'](handleEntityNotFound(_0x467ac9,null))[_0xb668('0x28')](respondWithResult(_0x467ac9,null))[_0xb668('0x4c')](handleError(_0x467ac9,null));};exports[_0xb668('0x4d')]=function(_0x1b649f,_0x16d06f){return db[_0xb668('0x31')][_0xb668('0x4d')](_0x1b649f[_0xb668('0x4e')],{})[_0xb668('0x28')](function(_0x4065f7){var _0x4e0628=_0x1b649f[_0xb668('0x4f')][_0xb668('0x29')]({'plain':!![]});if(!_0x4e0628)throw new Error(_0xb668('0x50'));if(_0x4e0628[_0xb668('0x51')]===_0xb668('0x4f')){var _0x3da9ba=_0x4065f7[_0xb668('0x29')]({'plain':!![]});var _0x1bff79=_0xb668('0x2a');return db['UserProfileSection'][_0xb668('0x4b')]({'where':{'name':_0x1bff79,'userProfileId':_0x4e0628[_0xb668('0x52')]},'raw':!![]})[_0xb668('0x28')](function(_0x4c9eab){if(_0x4c9eab&&_0x4c9eab['autoAssociation']===0x0){return db[_0xb668('0x2b')][_0xb668('0x4d')]({'name':_0x3da9ba[_0xb668('0x2e')],'resourceId':_0x3da9ba['id'],'type':_0x4c9eab['name'],'sectionId':_0x4c9eab['id']},{})[_0xb668('0x28')](function(){return _0x4065f7;});}else{return _0x4065f7;}})['catch'](function(_0x51a5d3){logger[_0xb668('0x2c')](_0xb668('0x53'),_0x51a5d3);throw _0x51a5d3;});}return _0x4065f7;})[_0xb668('0x28')](respondWithResult(_0x16d06f,0xc9))[_0xb668('0x4c')](handleError(_0x16d06f,null));};exports[_0xb668('0x26')]=function(_0x42b306,_0x40f9a0){if(_0x42b306[_0xb668('0x4e')]['id']){delete _0x42b306[_0xb668('0x4e')]['id'];}return db[_0xb668('0x31')][_0xb668('0x4b')]({'where':{'id':_0x42b306[_0xb668('0x4a')]['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x40f9a0,null))[_0xb668('0x28')](saveUpdates(_0x42b306[_0xb668('0x4e')],null))[_0xb668('0x28')](respondWithResult(_0x40f9a0,null))[_0xb668('0x4c')](handleError(_0x40f9a0,null));};exports[_0xb668('0x27')]=function(_0x414660,_0x3b4fd5){return db[_0xb668('0x31')][_0xb668('0x4b')]({'where':{'id':_0x414660[_0xb668('0x4a')]['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x3b4fd5,null))[_0xb668('0x28')](removeEntity(_0x3b4fd5,null))[_0xb668('0x4c')](handleError(_0x3b4fd5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 451f9ee..0cb6273 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 _0x7ec4=['ChanSpy','SIP/%s,%s','name','options','join','record','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x7ec4,0x167));var _0x47ec=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7ec4[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x47ec('0x0'));var util=require(_0x47ec('0x1'));var BPromise=require(_0x47ec('0x2'));var attributes=require(_0x47ec('0x3'));var getUserApplications=function(_0x5cadbd,_0x8bb9e2,_0x3b63d4){var _0x3f9234=0x1;var _0x385bd5=[];var _0x39377e={'context':_0x8bb9e2[_0x47ec('0x4')]||'from-sip','exten':util[_0x47ec('0x5')](_0x47ec('0x6'),_0x5cadbd[_0x47ec('0x7')],_0x3b63d4),'type':_0x47ec('0x8'),'isApp':![],'ChanSpyId':_0x5cadbd['id'],'UserId':_0x8bb9e2['id']};_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0xa'),'appdata':util[_0x47ec('0x5')](_0x47ec('0xb'),_0x47ec('0xc')),'priority':_0x3f9234++},_0x39377e));if(_0x5cadbd['record']){_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0xd'),'appdata':util[_0x47ec('0x5')](_0x47ec('0xe'),_0x5cadbd[_0x47ec('0xf')]),'priority':_0x3f9234++},_0x39377e));}if(_0x5cadbd[_0x47ec('0x10')]){_0x385bd5[_0x47ec('0x11')](_[_0x47ec('0x9')]({'app':_0x47ec('0x12'),'appdata':_0x5cadbd['password'],'priority':_0x3f9234++},_0x39377e));}_0x385bd5['push'](_[_0x47ec('0x9')]({'app':_0x47ec('0x13'),'appdata':util[_0x47ec('0x5')](_0x47ec('0x14'),_0x8bb9e2[_0x47ec('0x15')],_0x5cadbd[_0x47ec('0x16')]?_0x5cadbd['options'][_0x47ec('0x17')](''):''),'priority':_0x3f9234++},_0x39377e));if(_0x5cadbd[_0x47ec('0x18')]){_0x385bd5[_0x47ec('0x11')](_[_0x47ec('0x9')]({'app':_0x47ec('0x19'),'priority':_0x3f9234++},_0x39377e));}return _0x385bd5;};var getChanSpyApplications=function(_0x2f8631,_0xce0e16){var _0xd56098=[];for(var _0xf50786=0x0,_0x493b85=0x1;_0xf50786<_0xce0e16['length'];_0xf50786++,_0x493b85=0x1){_0xd56098=_0xd56098[_0x47ec('0x1a')](getUserApplications(_0x2f8631,_0xce0e16[_0xf50786],_0xce0e16[_0xf50786][_0x47ec('0x1b')]));if(_0xce0e16[_0xf50786][_0x47ec('0x1b')]!=_0xce0e16[_0xf50786][_0x47ec('0x15')]){_0xd56098=_0xd56098[_0x47ec('0x1a')](getUserApplications(_0x2f8631,_0xce0e16[_0xf50786],_0xce0e16[_0xf50786]['name']));}}return _0xd56098;};var getChanSpyPromise=function(_0x3603cd,_0x7adbb2){return new BPromise(function(_0x1f91f7,_0x1579e6){return _0x3603cd[_0x47ec('0x1c')][_0x47ec('0x1d')]({'attributes':['id',_0x47ec('0x15'),_0x47ec('0x1b')],'where':{'role':_0x47ec('0x1e'),'chanspy':!![]},'raw':!![]})[_0x47ec('0x1f')](function(_0x1e01ca){if(_0x1e01ca){return _0x1f91f7(getChanSpyApplications(_0x7adbb2,_0x1e01ca));}return _0x1f91f7([]);})[_0x47ec('0x20')](function(_0xd647fd){_0x1579e6(_0xd647fd);});});};module[_0x47ec('0x21')]=function(_0x22fd0b,_0x5c8151){var _0x1f1308=_0x22fd0b[_0x47ec('0x22')];return _0x22fd0b[_0x47ec('0x23')](_0x47ec('0x24'),attributes,{'tableName':_0x47ec('0x25'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7fa6ef,_0x14ceca,_0x1ec259){return getChanSpyPromise(_0x1f1308,_0x7fa6ef)[_0x47ec('0x1f')](function(_0x578ce8){if(_0x578ce8&&_0x578ce8['length']){return _0x1f1308[_0x47ec('0x26')][_0x47ec('0x27')](_0x578ce8);}})[_0x47ec('0x1f')](function(){_0x1ec259();})[_0x47ec('0x20')](function(_0x5c9f34){_0x1ec259(_0x5c9f34);});},'afterUpdate':function(_0xddcb6d,_0x393457,_0x5d222f){return _0x1f1308[_0x47ec('0x26')][_0x47ec('0x28')]({'where':{'ChanSpyId':_0xddcb6d['id']}})[_0x47ec('0x1f')](function(){return getChanSpyPromise(_0x1f1308,_0xddcb6d);})[_0x47ec('0x1f')](function(_0x5139ca){if(_0x5139ca&&_0x5139ca[_0x47ec('0x29')]){return _0x1f1308['VoiceExtension'][_0x47ec('0x27')](_0x5139ca);}})[_0x47ec('0x1f')](function(){_0x5d222f();})[_0x47ec('0x20')](function(_0x4c653b){_0x5d222f(_0x4c653b);});},'afterDestroy':function(_0x21dc43,_0x2800ee,_0x266d55){return _0x1f1308['VoiceExtension'][_0x47ec('0x28')]({'where':{'ChanSpyId':_0x21dc43['id']}})[_0x47ec('0x1f')](function(){_0x266d55();})['catch'](function(_0x18bbe5){_0x266d55(_0x18bbe5);});}}});}; \ No newline at end of file +var _0x9b92=['then','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','prefix','system','push','merge','Set','chanspy','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','internal','User','agent','catch','exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension'];(function(_0x38547d,_0x1e47c5){var _0x3de9f8=function(_0x154ea4){while(--_0x154ea4){_0x38547d['push'](_0x38547d['shift']());}};_0x3de9f8(++_0x1e47c5);}(_0x9b92,0xff));var _0x29b9=function(_0x2cc017,_0x25b198){_0x2cc017=_0x2cc017-0x0;var _0x509276=_0x9b92[_0x2cc017];return _0x509276;};'use strict';var _=require(_0x29b9('0x0'));var util=require(_0x29b9('0x1'));var BPromise=require(_0x29b9('0x2'));var attributes=require(_0x29b9('0x3'));var getUserApplications=function(_0x2432cb,_0x4bced3,_0x4d6b41){var _0x26537c=0x1;var _0x56c4de=[];var _0x253273={'context':_0x4bced3[_0x29b9('0x4')]||'from-sip','exten':util[_0x29b9('0x5')](_0x29b9('0x6'),_0x2432cb[_0x29b9('0x7')],_0x4d6b41),'type':_0x29b9('0x8'),'isApp':![],'ChanSpyId':_0x2432cb['id'],'UserId':_0x4bced3['id']};_0x56c4de[_0x29b9('0x9')](_[_0x29b9('0xa')]({'app':_0x29b9('0xb'),'appdata':util[_0x29b9('0x5')]('CDR(type)=%s',_0x29b9('0xc')),'priority':_0x26537c++},_0x253273));if(_0x2432cb['record']){_0x56c4de[_0x29b9('0x9')](_['merge']({'app':'MixMonitor','appdata':util[_0x29b9('0x5')](_0x29b9('0xd'),_0x2432cb[_0x29b9('0xe')]),'priority':_0x26537c++},_0x253273));}if(_0x2432cb['auth']){_0x56c4de[_0x29b9('0x9')](_[_0x29b9('0xa')]({'app':_0x29b9('0xf'),'appdata':_0x2432cb[_0x29b9('0x10')],'priority':_0x26537c++},_0x253273));}_0x56c4de[_0x29b9('0x9')](_[_0x29b9('0xa')]({'app':_0x29b9('0x11'),'appdata':util['format'](_0x29b9('0x12'),_0x4bced3[_0x29b9('0x13')],_0x2432cb['options']?_0x2432cb[_0x29b9('0x14')]['join'](''):''),'priority':_0x26537c++},_0x253273));if(_0x2432cb[_0x29b9('0x15')]){_0x56c4de[_0x29b9('0x9')](_[_0x29b9('0xa')]({'app':_0x29b9('0x16'),'priority':_0x26537c++},_0x253273));}return _0x56c4de;};var getChanSpyApplications=function(_0x287b66,_0x20e720){var _0x4bfc65=[];for(var _0x57c294=0x0,_0x49f017=0x1;_0x57c294<_0x20e720['length'];_0x57c294++,_0x49f017=0x1){_0x4bfc65=_0x4bfc65['concat'](getUserApplications(_0x287b66,_0x20e720[_0x57c294],_0x20e720[_0x57c294][_0x29b9('0x17')]));if(_0x20e720[_0x57c294]['internal']!=_0x20e720[_0x57c294][_0x29b9('0x13')]){_0x4bfc65=_0x4bfc65['concat'](getUserApplications(_0x287b66,_0x20e720[_0x57c294],_0x20e720[_0x57c294][_0x29b9('0x13')]));}}return _0x4bfc65;};var getChanSpyPromise=function(_0x2cb58c,_0x3f1240){return new BPromise(function(_0x4d4902,_0x51dc1c){return _0x2cb58c[_0x29b9('0x18')]['findAll']({'attributes':['id','name',_0x29b9('0x17')],'where':{'role':_0x29b9('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x59c5b7){if(_0x59c5b7){return _0x4d4902(getChanSpyApplications(_0x3f1240,_0x59c5b7));}return _0x4d4902([]);})[_0x29b9('0x1a')](function(_0x16c7e1){_0x51dc1c(_0x16c7e1);});});};module[_0x29b9('0x1b')]=function(_0x10e355,_0x1613af){var _0x69bd5e=_0x10e355['models'];return _0x10e355[_0x29b9('0x1c')](_0x29b9('0x1d'),attributes,{'tableName':_0x29b9('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a466e,_0x441a67,_0x15ca61){return getChanSpyPromise(_0x69bd5e,_0x5a466e)['then'](function(_0x412523){if(_0x412523&&_0x412523[_0x29b9('0x1f')]){return _0x69bd5e[_0x29b9('0x20')]['bulkCreate'](_0x412523);}})[_0x29b9('0x21')](function(){_0x15ca61();})[_0x29b9('0x1a')](function(_0x26fcf0){_0x15ca61(_0x26fcf0);});},'afterUpdate':function(_0x16eb71,_0x14ee9d,_0x2fc36f){return _0x69bd5e[_0x29b9('0x20')][_0x29b9('0x22')]({'where':{'ChanSpyId':_0x16eb71['id']}})['then'](function(){return getChanSpyPromise(_0x69bd5e,_0x16eb71);})[_0x29b9('0x21')](function(_0x5bfb31){if(_0x5bfb31&&_0x5bfb31[_0x29b9('0x1f')]){return _0x69bd5e[_0x29b9('0x20')][_0x29b9('0x23')](_0x5bfb31);}})[_0x29b9('0x21')](function(){_0x2fc36f();})[_0x29b9('0x1a')](function(_0x11e074){_0x2fc36f(_0x11e074);});},'afterDestroy':function(_0x5de833,_0x4d6553,_0x4a00d1){return _0x69bd5e[_0x29b9('0x20')][_0x29b9('0x22')]({'where':{'ChanSpyId':_0x5de833['id']}})[_0x29b9('0x21')](function(){_0x4a00d1();})[_0x29b9('0x1a')](function(_0x3824f7){_0x4a00d1(_0x3824f7);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6872fd3..1369d91 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 _0x39cb=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x39cb,0x1bd));var _0xb39c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39cb[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb39c('0x0'));var moment=require(_0xb39c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb39c('0x2'));var fs=require('fs');var Redis=require(_0xb39c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb39c('0x4'));var logger=require(_0xb39c('0x5'))(_0xb39c('0x6'));var config=require(_0xb39c('0x7'));var jayson=require(_0xb39c('0x8'));var client=jayson['client'][_0xb39c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc868,_0x40112f,_0x3f2fbe){return new BPromise(function(_0x47d6d7,_0x5ae14a){return client[_0xb39c('0xa')](_0x2fc868,_0x3f2fbe)[_0xb39c('0xb')](function(_0x3ffb94){logger[_0xb39c('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x40112f,'request\x20sent');logger['debug'](_0xb39c('0xd'),_0x40112f,_0xb39c('0xe'),JSON[_0xb39c('0xf')](_0x3ffb94));if(_0x3ffb94[_0xb39c('0x10')]){if(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x11')]===0x1f4){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x3ffb94['error'][_0xb39c('0x13')]);return _0x5ae14a(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}logger['error'](_0xb39c('0x12'),_0x40112f,_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);return _0x47d6d7(_0x3ffb94[_0xb39c('0x10')][_0xb39c('0x13')]);}else{logger[_0xb39c('0xc')](_0xb39c('0x12'),_0x40112f,'request\x20sent');_0x47d6d7(_0x3ffb94[_0xb39c('0x14')][_0xb39c('0x13')]);}})[_0xb39c('0x15')](function(_0x1c2c5f){logger[_0xb39c('0x10')](_0xb39c('0x12'),_0x40112f,_0x1c2c5f);_0x5ae14a(_0x1c2c5f);});});} \ No newline at end of file +var _0x422f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','util'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0x422f,0x1c7));var _0xf422=function(_0x86b9b,_0x3bee57){_0x86b9b=_0x86b9b-0x0;var _0x42a820=_0x422f[_0x86b9b];return _0x42a820;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 27b9f7d..b00e7dc 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 _0x95fe=['../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','/:id','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x42f85f,_0x58e64e){var _0x4d1417=function(_0x2d98c5){while(--_0x2d98c5){_0x42f85f['push'](_0x42f85f['shift']());}};_0x4d1417(++_0x58e64e);}(_0x95fe,0x70));var _0xe95f=function(_0x4362c4,_0x57b51f){_0x4362c4=_0x4362c4-0x0;var _0x4e2876=_0x95fe[_0x4362c4];return _0x4e2876;};'use strict';var multer=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var path=require(_0xe95f('0x2'));var timeout=require(_0xe95f('0x3'));var express=require(_0xe95f('0x4'));var router=express[_0xe95f('0x5')]();var fs_extra=require(_0xe95f('0x6'));var auth=require(_0xe95f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe95f('0x8'));var controller=require(_0xe95f('0x9'));router['get']('/',auth[_0xe95f('0xa')](),controller[_0xe95f('0xb')]);router['get'](_0xe95f('0xc'),auth[_0xe95f('0xa')](),controller['show']);router['post']('/',auth[_0xe95f('0xa')](),controller['create']);router[_0xe95f('0xd')](_0xe95f('0xc'),auth[_0xe95f('0xa')](),controller[_0xe95f('0xe')]);router['delete'](_0xe95f('0xc'),auth['isAuthenticated'](),controller[_0xe95f('0xf')]);module[_0xe95f('0x10')]=router; \ No newline at end of file +var _0x3871=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy','exports','path'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x3871,0x1cf));var _0x1387=function(_0x4db517,_0x4dffde){_0x4db517=_0x4db517-0x0;var _0x5ea282=_0x3871[_0x4db517];return _0x5ea282;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1387('0x0'));var timeout=require(_0x1387('0x1'));var express=require(_0x1387('0x2'));var router=express['Router']();var fs_extra=require(_0x1387('0x3'));var auth=require(_0x1387('0x4'));var interaction=require(_0x1387('0x5'));var config=require('../../config/environment');var controller=require(_0x1387('0x6'));router[_0x1387('0x7')]('/',auth[_0x1387('0x8')](),controller[_0x1387('0x9')]);router[_0x1387('0x7')](_0x1387('0xa'),auth[_0x1387('0x8')](),controller['show']);router['post']('/',auth[_0x1387('0x8')](),controller[_0x1387('0xb')]);router['put'](_0x1387('0xa'),auth[_0x1387('0x8')](),controller[_0x1387('0xc')]);router[_0x1387('0xd')]('/:id',auth[_0x1387('0x8')](),controller[_0x1387('0xe')]);module[_0x1387('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 14a4edb..b59cb6f 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 _0xc6e3=['STRING','exports'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0xc6e3,0x1e3));var _0x3c6e=function(_0x10100,_0x1a7f21){_0x10100=_0x10100-0x0;var _0x38319b=_0xc6e3[_0x10100];return _0x38319b;};'use strict';var Sequelize=require('sequelize');module[_0x3c6e('0x0')]={'name':{'type':Sequelize[_0x3c6e('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x3c6e('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a2e=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0xb03583,_0x2ad292){var _0x180d0e=function(_0x132cd5){while(--_0x132cd5){_0xb03583['push'](_0xb03583['shift']());}};_0x180d0e(++_0x2ad292);}(_0x4a2e,0xf5));var _0xe4a2=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x4a2e[_0x22bee0];return _0x2d295b;};'use strict';var Sequelize=require(_0xe4a2('0x0'));module[_0xe4a2('0x1')]={'name':{'type':Sequelize[_0xe4a2('0x2')],'unique':_0xe4a2('0x3')},'description':{'type':Sequelize[_0xe4a2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe4a2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index fa8828c..eda0515 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 _0x9f7b=['include','show','params','catch','create','readFileSync','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','join','utf8','writeFileSync','findAll','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Contexts','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x578a80,_0x412698){var _0x4b4ba8=function(_0x4ff947){while(--_0x4ff947){_0x578a80['push'](_0x578a80['shift']());}};_0x4b4ba8(++_0x412698);}(_0x9f7b,0xf1));var _0xb9f7=function(_0x2030af,_0x1a442d){_0x2030af=_0x2030af-0x0;var _0x2e9f24=_0x9f7b[_0x2030af];return _0x2e9f24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9f7('0x0'));var zipdir=require(_0xb9f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9f7('0x2'));var moment=require(_0xb9f7('0x3'));var BPromise=require(_0xb9f7('0x4'));var Mustache=require(_0xb9f7('0x5'));var util=require(_0xb9f7('0x6'));var path=require(_0xb9f7('0x7'));var sox=require(_0xb9f7('0x8'));var csv=require(_0xb9f7('0x9'));var ejs=require(_0xb9f7('0xa'));var fs=require('fs');var fs_extra=require(_0xb9f7('0xb'));var _=require(_0xb9f7('0xc'));var squel=require(_0xb9f7('0xd'));var crypto=require(_0xb9f7('0xe'));var jsforce=require(_0xb9f7('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9f7('0x10'));var Papa=require(_0xb9f7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9f7('0x12'));var as=require(_0xb9f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f7('0x14'))(_0xb9f7('0x15'));var utils=require(_0xb9f7('0x16'));var config=require(_0xb9f7('0x17'));var licenseUtil=require(_0xb9f7('0x18'));var db=require(_0xb9f7('0x19'))['db'];var jayson=require(_0xb9f7('0x1a'));var client=jayson[_0xb9f7('0x1b')][_0xb9f7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x44e699,_0x59598e,_0x175ede,_0x3acd11){return new BPromise(function(_0x4f9407,_0x5c7cbe){var _0xa29a09=_0x3acd11||client;return _0xa29a09[_0xb9f7('0x1d')](_0x44e699,_0x175ede)[_0xb9f7('0x1e')](function(_0x41d78a){logger[_0xb9f7('0x1f')](_0xb9f7('0x20'),_0x59598e,_0xb9f7('0x21'));logger[_0xb9f7('0x22')](_0xb9f7('0x23'),_0x59598e,_0xb9f7('0x21'),JSON[_0xb9f7('0x24')](_0x41d78a));if(_0x41d78a[_0xb9f7('0x25')]){if(_0x41d78a[_0xb9f7('0x25')][_0xb9f7('0x26')]===0x1f4){logger['error'](_0xb9f7('0x20'),_0x59598e,_0x41d78a['error'][_0xb9f7('0x27')]);return _0x5c7cbe(_0x41d78a['error'][_0xb9f7('0x27')]);}logger['error'](_0xb9f7('0x20'),_0x59598e,_0x41d78a[_0xb9f7('0x25')][_0xb9f7('0x27')]);return _0x4f9407(_0x41d78a[_0xb9f7('0x25')]['message']);}else{logger[_0xb9f7('0x1f')](_0xb9f7('0x20'),_0x59598e,'request\x20sent');_0x4f9407(_0x41d78a[_0xb9f7('0x28')][_0xb9f7('0x27')]);}})['catch'](function(_0x24ecc5){logger[_0xb9f7('0x25')](_0xb9f7('0x20'),_0x59598e,_0x24ecc5);_0x5c7cbe(_0x24ecc5);});});}function respondWithStatusCode(_0x213e4c,_0x23672d){_0x23672d=_0x23672d||0xcc;return function(_0x501dbe){if(_0x501dbe){return _0x213e4c[_0xb9f7('0x29')](_0x23672d);}return _0x213e4c[_0xb9f7('0x2a')](_0x23672d)[_0xb9f7('0x2b')]();};}function respondWithResult(_0x1a82d3,_0x13385d){_0x13385d=_0x13385d||0xc8;return function(_0x47ee58){if(_0x47ee58){return _0x1a82d3[_0xb9f7('0x2a')](_0x13385d)[_0xb9f7('0x2c')](_0x47ee58);}};}function respondWithFilteredResult(_0x1853ba,_0x29e1dd){return function(_0x2c8c46){if(_0x2c8c46){var _0x1e84da=typeof _0x29e1dd['offset']===_0xb9f7('0x2d')&&typeof _0x29e1dd['limit']===_0xb9f7('0x2d');var _0x131c99=_0x2c8c46[_0xb9f7('0x2e')];var _0x43ef82=_0x1e84da?0x0:_0x29e1dd[_0xb9f7('0x2f')];var _0x31073e=_0x1e84da?_0x2c8c46[_0xb9f7('0x2e')]:_0x29e1dd['offset']+_0x29e1dd[_0xb9f7('0x30')];var _0x32ea9a;if(_0x31073e>=_0x131c99){_0x31073e=_0x131c99;_0x32ea9a=0xc8;}else{_0x32ea9a=0xce;}_0x1853ba['status'](_0x32ea9a);return _0x1853ba[_0xb9f7('0x31')](_0xb9f7('0x32'),_0x43ef82+'-'+_0x31073e+'/'+_0x131c99)[_0xb9f7('0x2c')](_0x2c8c46);}return null;};}function patchUpdates(_0x2a8732){return function(_0x1853d4){try{jsonpatch[_0xb9f7('0x33')](_0x1853d4,_0x2a8732,!![]);}catch(_0x50c0d7){return BPromise[_0xb9f7('0x34')](_0x50c0d7);}return _0x1853d4[_0xb9f7('0x35')]();};}function saveUpdates(_0x4414c2,_0x2e594a){return function(_0x470f03){if(_0x470f03){return _0x470f03['update'](_0x4414c2)[_0xb9f7('0x1e')](function(_0x282c02){return _0x282c02;});}return null;};}function removeEntity(_0x2299bd,_0x4605ed){return function(_0x4f4fa5){if(_0x4f4fa5){return _0x4f4fa5[_0xb9f7('0x36')]()[_0xb9f7('0x1e')](function(){var _0x16406c=_0x4f4fa5[_0xb9f7('0x37')]({'plain':!![]});var _0x208cea=_0xb9f7('0x38');return db['UserProfileResource'][_0xb9f7('0x36')]({'where':{'type':_0x208cea,'resourceId':_0x16406c['id']}})[_0xb9f7('0x1e')](function(){return _0x4f4fa5;});})[_0xb9f7('0x1e')](function(){_0x2299bd[_0xb9f7('0x2a')](0xcc)[_0xb9f7('0x2b')]();});}};}function handleEntityNotFound(_0x4d3a84,_0x2662cc){return function(_0x390879){if(!_0x390879){_0x4d3a84[_0xb9f7('0x29')](0x194);}return _0x390879;};}function handleError(_0x117e8e,_0xd9dba6){_0xd9dba6=_0xd9dba6||0x1f4;return function(_0x4537f6){logger[_0xb9f7('0x25')](_0x4537f6[_0xb9f7('0x39')]);if(_0x4537f6[_0xb9f7('0x3a')]){delete _0x4537f6[_0xb9f7('0x3a')];}_0x117e8e[_0xb9f7('0x2a')](_0xd9dba6)['send'](_0x4537f6);};}exports['index']=function(_0x2f4b30,_0x1aafb2){var _0x1ff303={},_0x25ead8={},_0xfea2fc={'count':0x0,'rows':[]};var _0x3ebed2=_['map'](db[_0xb9f7('0x3b')][_0xb9f7('0x3c')],function(_0x450da0){return{'name':_0x450da0[_0xb9f7('0x3d')],'type':_0x450da0[_0xb9f7('0x3e')][_0xb9f7('0x3f')]};});_0x25ead8[_0xb9f7('0x40')]=_[_0xb9f7('0x41')](_0x3ebed2,_0xb9f7('0x3a'));_0x25ead8[_0xb9f7('0x42')]=_[_0xb9f7('0x43')](_0x2f4b30[_0xb9f7('0x42')]);_0x25ead8[_0xb9f7('0x44')]=_[_0xb9f7('0x45')](_0x25ead8['model'],_0x25ead8[_0xb9f7('0x42')]);_0x1ff303[_0xb9f7('0x46')]=_[_0xb9f7('0x45')](_0x25ead8['model'],qs[_0xb9f7('0x47')](_0x2f4b30['query'][_0xb9f7('0x47')]));_0x1ff303[_0xb9f7('0x46')]=_0x1ff303['attributes'][_0xb9f7('0x48')]?_0x1ff303[_0xb9f7('0x46')]:_0x25ead8['model'];if(!_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x49')](_0xb9f7('0x4a'))){_0x1ff303[_0xb9f7('0x30')]=qs['limit'](_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x30')]);_0x1ff303[_0xb9f7('0x2f')]=qs[_0xb9f7('0x2f')](_0x2f4b30['query']['offset']);}_0x1ff303['order']=qs['sort'](_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x4b')]);_0x1ff303[_0xb9f7('0x4c')]=qs[_0xb9f7('0x44')](_[_0xb9f7('0x4d')](_0x2f4b30['query'],_0x25ead8['filters']),_0x3ebed2);if(_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x4e')]){_0x1ff303[_0xb9f7('0x4c')]=_[_0xb9f7('0x4f')](_0x1ff303[_0xb9f7('0x4c')],{'$or':_[_0xb9f7('0x41')](_0x3ebed2,function(_0x22932f){if(_0x22932f[_0xb9f7('0x3e')]!==_0xb9f7('0x50')){var _0x55cf55={};_0x55cf55[_0x22932f[_0xb9f7('0x3a')]]={'$like':'%'+_0x2f4b30[_0xb9f7('0x42')]['filter']+'%'};return _0x55cf55;}})});}_0x1ff303=_[_0xb9f7('0x4f')]({},_0x1ff303,_0x2f4b30[_0xb9f7('0x51')]);var _0x508026={'where':_0x1ff303[_0xb9f7('0x4c')]};return db['VoiceContext']['count'](_0x508026)[_0xb9f7('0x1e')](function(_0x2b3413){_0xfea2fc['count']=_0x2b3413;if(_0x2f4b30[_0xb9f7('0x42')][_0xb9f7('0x52')]){_0x1ff303[_0xb9f7('0x53')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1ff303);})['then'](function(_0x127569){_0xfea2fc['rows']=_0x127569;return _0xfea2fc;})[_0xb9f7('0x1e')](respondWithFilteredResult(_0x1aafb2,_0x1ff303))['catch'](handleError(_0x1aafb2,null));};exports[_0xb9f7('0x54')]=function(_0x5574cb,_0x5d3125){var _0x34987f={'raw':![],'where':{'id':_0x5574cb[_0xb9f7('0x55')]['id']}},_0x5fac10={};_0x5fac10[_0xb9f7('0x40')]=_[_0xb9f7('0x43')](db[_0xb9f7('0x3b')][_0xb9f7('0x3c')]);_0x5fac10['query']=_[_0xb9f7('0x43')](_0x5574cb[_0xb9f7('0x42')]);_0x5fac10[_0xb9f7('0x44')]=_[_0xb9f7('0x45')](_0x5fac10[_0xb9f7('0x40')],_0x5fac10[_0xb9f7('0x42')]);_0x34987f[_0xb9f7('0x46')]=_[_0xb9f7('0x45')](_0x5fac10[_0xb9f7('0x40')],qs['fields'](_0x5574cb['query']['fields']));_0x34987f[_0xb9f7('0x46')]=_0x34987f[_0xb9f7('0x46')]['length']?_0x34987f[_0xb9f7('0x46')]:_0x5fac10[_0xb9f7('0x40')];if(_0x5574cb[_0xb9f7('0x42')][_0xb9f7('0x52')]){_0x34987f[_0xb9f7('0x53')]=[{'all':!![]}];}_0x34987f=_[_0xb9f7('0x4f')]({},_0x34987f,_0x5574cb[_0xb9f7('0x51')]);return db[_0xb9f7('0x3b')]['find'](_0x34987f)[_0xb9f7('0x1e')](handleEntityNotFound(_0x5d3125,null))[_0xb9f7('0x1e')](respondWithResult(_0x5d3125,null))[_0xb9f7('0x56')](handleError(_0x5d3125,null));};exports[_0xb9f7('0x57')]=function(_0x598c39,_0x1061c5,_0x5d32cd){var _0x4e5e99;return db[_0xb9f7('0x3b')]['create'](_0x598c39['body'],{'raw':!![]})[_0xb9f7('0x1e')](function(_0xa4bd81){_0x4e5e99=_0xa4bd81;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x5e32ef){var _0x8fdf63=fs[_0xb9f7('0x58')](path['join'](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),'utf8');var _0x24bc3f=ejs[_0xb9f7('0x5b')](_0x8fdf63,{'contexts':_0x5e32ef||[]});fs['writeFileSync'](_0xb9f7('0x5c'),_0x24bc3f);})['then'](function(){return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x57'),{'module':_0xb9f7('0x5e')});})['then'](function(){var _0x370461=_0x598c39[_0xb9f7('0x5f')][_0xb9f7('0x37')]({'plain':!![]});if(!_0x370461)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x370461['role']===_0xb9f7('0x5f')){var _0x51c673=_0x4e5e99['get']({'plain':!![]});return db[_0xb9f7('0x60')][_0xb9f7('0x61')]({'where':{'name':_0xb9f7('0x38'),'userProfileId':_0x370461[_0xb9f7('0x62')]},'raw':!![]})[_0xb9f7('0x1e')](function(_0x2362a4){if(_0x2362a4&&_0x2362a4[_0xb9f7('0x63')]===0x0){return db[_0xb9f7('0x64')]['create']({'name':_0x51c673[_0xb9f7('0x3a')],'resourceId':_0x51c673['id'],'type':_0x2362a4[_0xb9f7('0x3a')],'sectionId':_0x2362a4['id']},{})[_0xb9f7('0x1e')](function(){return _0x4e5e99;});}else{return _0x4e5e99;}})['catch'](function(_0x3027f1){logger[_0xb9f7('0x25')](_0xb9f7('0x65'),_0x3027f1);throw _0x3027f1;});}return _0x4e5e99;})[_0xb9f7('0x1e')](respondWithResult(_0x1061c5,0xc9))[_0xb9f7('0x56')](handleError(_0x1061c5,null));};exports[_0xb9f7('0x66')]=function(_0x40b34c,_0x21f57d,_0xc5e4c6){var _0x354237;return db[_0xb9f7('0x3b')][_0xb9f7('0x61')]({'where':{'id':_0x40b34c['params']['id']}})[_0xb9f7('0x1e')](handleEntityNotFound(_0x21f57d,null))['then'](saveUpdates(_0x40b34c[_0xb9f7('0x67')],null))[_0xb9f7('0x1e')](function(_0x3c0711){if(_0x3c0711){_0x354237=_0x3c0711;return db[_0xb9f7('0x3b')]['findAll']({'raw':!![]});}})[_0xb9f7('0x1e')](function(_0x73311b){var _0x1b3154=fs['readFileSync'](path[_0xb9f7('0x68')](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),_0xb9f7('0x69'));var _0x3eb55a=ejs[_0xb9f7('0x5b')](_0x1b3154,{'contexts':_0x73311b||[]});fs[_0xb9f7('0x6a')](_0xb9f7('0x5c'),_0x3eb55a);})['then'](function(){return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x66'),{'module':'chan_sip.so'});})['then'](function(){return _0x354237;})['then'](respondWithResult(_0x21f57d,null))[_0xb9f7('0x56')](handleError(_0x21f57d,null));};exports['destroy']=function(_0x55ad1d,_0x1c5d99,_0x2d9c36){var _0x2949b5;return db[_0xb9f7('0x3b')]['find']({'where':{'id':_0x55ad1d[_0xb9f7('0x55')]['id']}})[_0xb9f7('0x1e')](handleEntityNotFound(_0x1c5d99,null))[_0xb9f7('0x1e')](removeEntity(_0x1c5d99,null))[_0xb9f7('0x1e')](function(){return db[_0xb9f7('0x3b')][_0xb9f7('0x6b')]({'raw':!![]});})['then'](function(_0x58e8f2){var _0x459f57=fs['readFileSync'](path['join'](config[_0xb9f7('0x59')],_0xb9f7('0x5a')),'utf8');var _0x434431=ejs[_0xb9f7('0x5b')](_0x459f57,{'contexts':_0x58e8f2});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x434431);return respondWithRpcPromise(_0xb9f7('0x5d'),_0xb9f7('0x36'),{'module':_0xb9f7('0x5e')});})[_0xb9f7('0x56')](handleError(_0x1c5d99,null));}; \ No newline at end of file +var _0xd2e8=['VoiceContext','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','keys','rawAttributes','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','Contexts','UserProfileResource','destroy','stack','name','send','map'];(function(_0x1ba704,_0x58e5de){var _0x43c3d9=function(_0x2d78fa){while(--_0x2d78fa){_0x1ba704['push'](_0x1ba704['shift']());}};_0x43c3d9(++_0x58e5de);}(_0xd2e8,0x96));var _0x8d2e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xd2e8[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x8d2e('0x0'));var rimraf=require(_0x8d2e('0x1'));var zipdir=require(_0x8d2e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d2e('0x3'));var moment=require(_0x8d2e('0x4'));var BPromise=require(_0x8d2e('0x5'));var Mustache=require(_0x8d2e('0x6'));var util=require(_0x8d2e('0x7'));var path=require(_0x8d2e('0x8'));var sox=require(_0x8d2e('0x9'));var csv=require(_0x8d2e('0xa'));var ejs=require(_0x8d2e('0xb'));var fs=require('fs');var fs_extra=require(_0x8d2e('0xc'));var _=require(_0x8d2e('0xd'));var squel=require(_0x8d2e('0xe'));var crypto=require('crypto');var jsforce=require(_0x8d2e('0xf'));var deskjs=require(_0x8d2e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d2e('0x11'));var Papa=require('papaparse');var Redis=require(_0x8d2e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8d2e('0x13'));var as=require(_0x8d2e('0x14'));var hardwareService=require(_0x8d2e('0x15'));var logger=require(_0x8d2e('0x16'))(_0x8d2e('0x17'));var utils=require(_0x8d2e('0x18'));var config=require(_0x8d2e('0x19'));var licenseUtil=require(_0x8d2e('0x1a'));var db=require(_0x8d2e('0x1b'))['db'];var jayson=require(_0x8d2e('0x1c'));var client=jayson[_0x8d2e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485229,_0x4d709a,_0x382e33,_0x1c02de){return new BPromise(function(_0x4f206d,_0x5045b2){var _0x527ea4=_0x1c02de||client;return _0x527ea4[_0x8d2e('0x1e')](_0x485229,_0x382e33)[_0x8d2e('0x1f')](function(_0x3f990d){logger[_0x8d2e('0x20')](_0x8d2e('0x21'),_0x4d709a,_0x8d2e('0x22'));logger[_0x8d2e('0x23')](_0x8d2e('0x24'),_0x4d709a,_0x8d2e('0x22'),JSON[_0x8d2e('0x25')](_0x3f990d));if(_0x3f990d[_0x8d2e('0x26')]){if(_0x3f990d['error'][_0x8d2e('0x27')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4d709a,_0x3f990d[_0x8d2e('0x26')]['message']);return _0x5045b2(_0x3f990d['error'][_0x8d2e('0x28')]);}logger[_0x8d2e('0x26')]('VoiceContext,\x20%s,\x20%s',_0x4d709a,_0x3f990d['error'][_0x8d2e('0x28')]);return _0x4f206d(_0x3f990d['error'][_0x8d2e('0x28')]);}else{logger[_0x8d2e('0x20')](_0x8d2e('0x21'),_0x4d709a,_0x8d2e('0x22'));_0x4f206d(_0x3f990d[_0x8d2e('0x29')][_0x8d2e('0x28')]);}})['catch'](function(_0x4981cc){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4d709a,_0x4981cc);_0x5045b2(_0x4981cc);});});}function respondWithStatusCode(_0x43b3a4,_0x5834e){_0x5834e=_0x5834e||0xcc;return function(_0xc7fb91){if(_0xc7fb91){return _0x43b3a4[_0x8d2e('0x2a')](_0x5834e);}return _0x43b3a4[_0x8d2e('0x2b')](_0x5834e)[_0x8d2e('0x2c')]();};}function respondWithResult(_0x494702,_0x360d25){_0x360d25=_0x360d25||0xc8;return function(_0x56e6ba){if(_0x56e6ba){return _0x494702['status'](_0x360d25)[_0x8d2e('0x2d')](_0x56e6ba);}};}function respondWithFilteredResult(_0x5e148a,_0xe834b4){return function(_0x5432eb){if(_0x5432eb){var _0x596900=typeof _0xe834b4[_0x8d2e('0x2e')]===_0x8d2e('0x2f')&&typeof _0xe834b4[_0x8d2e('0x30')]===_0x8d2e('0x2f');var _0x35c7e4=_0x5432eb[_0x8d2e('0x31')];var _0x109869=_0x596900?0x0:_0xe834b4[_0x8d2e('0x2e')];var _0x186441=_0x596900?_0x5432eb[_0x8d2e('0x31')]:_0xe834b4['offset']+_0xe834b4[_0x8d2e('0x30')];var _0x9f4bad;if(_0x186441>=_0x35c7e4){_0x186441=_0x35c7e4;_0x9f4bad=0xc8;}else{_0x9f4bad=0xce;}_0x5e148a[_0x8d2e('0x2b')](_0x9f4bad);return _0x5e148a[_0x8d2e('0x32')](_0x8d2e('0x33'),_0x109869+'-'+_0x186441+'/'+_0x35c7e4)[_0x8d2e('0x2d')](_0x5432eb);}return null;};}function patchUpdates(_0x403686){return function(_0x540ee0){try{jsonpatch['apply'](_0x540ee0,_0x403686,!![]);}catch(_0x44ad1d){return BPromise['reject'](_0x44ad1d);}return _0x540ee0[_0x8d2e('0x34')]();};}function saveUpdates(_0x28d4bd,_0x1f0142){return function(_0xa79e1a){if(_0xa79e1a){return _0xa79e1a['update'](_0x28d4bd)['then'](function(_0x519c9b){return _0x519c9b;});}return null;};}function removeEntity(_0x599a98,_0x4fda4c){return function(_0x3d3c1f){if(_0x3d3c1f){return _0x3d3c1f['destroy']()[_0x8d2e('0x1f')](function(){var _0x240518=_0x3d3c1f['get']({'plain':!![]});var _0x48a1dd=_0x8d2e('0x35');return db[_0x8d2e('0x36')][_0x8d2e('0x37')]({'where':{'type':_0x48a1dd,'resourceId':_0x240518['id']}})['then'](function(){return _0x3d3c1f;});})[_0x8d2e('0x1f')](function(){_0x599a98['status'](0xcc)[_0x8d2e('0x2c')]();});}};}function handleEntityNotFound(_0x311285,_0x412e78){return function(_0x446e52){if(!_0x446e52){_0x311285['sendStatus'](0x194);}return _0x446e52;};}function handleError(_0x4db034,_0xa15ac2){_0xa15ac2=_0xa15ac2||0x1f4;return function(_0x19ce13){logger[_0x8d2e('0x26')](_0x19ce13[_0x8d2e('0x38')]);if(_0x19ce13['name']){delete _0x19ce13[_0x8d2e('0x39')];}_0x4db034[_0x8d2e('0x2b')](_0xa15ac2)[_0x8d2e('0x3a')](_0x19ce13);};}exports['index']=function(_0x195be8,_0xa7fc25){var _0x22451a={},_0x559d30={},_0x1dd8f0={'count':0x0,'rows':[]};var _0x478ab1=_[_0x8d2e('0x3b')](db[_0x8d2e('0x3c')]['rawAttributes'],function(_0x548a97){return{'name':_0x548a97['fieldName'],'type':_0x548a97[_0x8d2e('0x3d')][_0x8d2e('0x3e')]};});_0x559d30[_0x8d2e('0x3f')]=_['map'](_0x478ab1,'name');_0x559d30[_0x8d2e('0x40')]=_['keys'](_0x195be8[_0x8d2e('0x40')]);_0x559d30[_0x8d2e('0x41')]=_[_0x8d2e('0x42')](_0x559d30['model'],_0x559d30[_0x8d2e('0x40')]);_0x22451a[_0x8d2e('0x43')]=_['intersection'](_0x559d30[_0x8d2e('0x3f')],qs[_0x8d2e('0x44')](_0x195be8['query'][_0x8d2e('0x44')]));_0x22451a[_0x8d2e('0x43')]=_0x22451a[_0x8d2e('0x43')]['length']?_0x22451a[_0x8d2e('0x43')]:_0x559d30[_0x8d2e('0x3f')];if(!_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x45')](_0x8d2e('0x46'))){_0x22451a['limit']=qs['limit'](_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x30')]);_0x22451a[_0x8d2e('0x2e')]=qs[_0x8d2e('0x2e')](_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x2e')]);}_0x22451a[_0x8d2e('0x47')]=qs['sort'](_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x48')]);_0x22451a['where']=qs[_0x8d2e('0x41')](_[_0x8d2e('0x49')](_0x195be8[_0x8d2e('0x40')],_0x559d30['filters']),_0x478ab1);if(_0x195be8['query'][_0x8d2e('0x4a')]){_0x22451a[_0x8d2e('0x4b')]=_[_0x8d2e('0x4c')](_0x22451a[_0x8d2e('0x4b')],{'$or':_[_0x8d2e('0x3b')](_0x478ab1,function(_0x45aa42){if(_0x45aa42[_0x8d2e('0x3d')]!=='VIRTUAL'){var _0x14e25e={};_0x14e25e[_0x45aa42[_0x8d2e('0x39')]]={'$like':'%'+_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x4a')]+'%'};return _0x14e25e;}})});}_0x22451a=_[_0x8d2e('0x4c')]({},_0x22451a,_0x195be8['options']);var _0x57c5ae={'where':_0x22451a[_0x8d2e('0x4b')]};return db[_0x8d2e('0x3c')][_0x8d2e('0x31')](_0x57c5ae)[_0x8d2e('0x1f')](function(_0x6e32f5){_0x1dd8f0[_0x8d2e('0x31')]=_0x6e32f5;if(_0x195be8[_0x8d2e('0x40')][_0x8d2e('0x4d')]){_0x22451a[_0x8d2e('0x4e')]=[{'all':!![]}];}return db[_0x8d2e('0x3c')][_0x8d2e('0x4f')](_0x22451a);})[_0x8d2e('0x1f')](function(_0xb44056){_0x1dd8f0['rows']=_0xb44056;return _0x1dd8f0;})[_0x8d2e('0x1f')](respondWithFilteredResult(_0xa7fc25,_0x22451a))[_0x8d2e('0x50')](handleError(_0xa7fc25,null));};exports['show']=function(_0x5f00b5,_0x14dcd9){var _0x2ffc23={'raw':![],'where':{'id':_0x5f00b5['params']['id']}},_0x3ed582={};_0x3ed582[_0x8d2e('0x3f')]=_[_0x8d2e('0x51')](db[_0x8d2e('0x3c')][_0x8d2e('0x52')]);_0x3ed582[_0x8d2e('0x40')]=_[_0x8d2e('0x51')](_0x5f00b5[_0x8d2e('0x40')]);_0x3ed582[_0x8d2e('0x41')]=_[_0x8d2e('0x42')](_0x3ed582[_0x8d2e('0x3f')],_0x3ed582[_0x8d2e('0x40')]);_0x2ffc23['attributes']=_['intersection'](_0x3ed582['model'],qs[_0x8d2e('0x44')](_0x5f00b5[_0x8d2e('0x40')][_0x8d2e('0x44')]));_0x2ffc23[_0x8d2e('0x43')]=_0x2ffc23[_0x8d2e('0x43')][_0x8d2e('0x53')]?_0x2ffc23[_0x8d2e('0x43')]:_0x3ed582[_0x8d2e('0x3f')];if(_0x5f00b5[_0x8d2e('0x40')][_0x8d2e('0x4d')]){_0x2ffc23[_0x8d2e('0x4e')]=[{'all':!![]}];}_0x2ffc23=_['merge']({},_0x2ffc23,_0x5f00b5['options']);return db[_0x8d2e('0x3c')][_0x8d2e('0x54')](_0x2ffc23)[_0x8d2e('0x1f')](handleEntityNotFound(_0x14dcd9,null))['then'](respondWithResult(_0x14dcd9,null))['catch'](handleError(_0x14dcd9,null));};exports['create']=function(_0x1c0122,_0x5305a6,_0x1a39a4){var _0x1b371e;return db['VoiceContext'][_0x8d2e('0x55')](_0x1c0122[_0x8d2e('0x56')],{'raw':!![]})['then'](function(_0x18cf99){_0x1b371e=_0x18cf99;return db[_0x8d2e('0x3c')]['findAll']({'raw':!![]});})[_0x8d2e('0x1f')](function(_0x45dc70){var _0x459398=fs[_0x8d2e('0x57')](path[_0x8d2e('0x58')](config[_0x8d2e('0x59')],_0x8d2e('0x5a')),_0x8d2e('0x5b'));var _0x313966=ejs[_0x8d2e('0x5c')](_0x459398,{'contexts':_0x45dc70||[]});fs['writeFileSync'](_0x8d2e('0x5d'),_0x313966);})[_0x8d2e('0x1f')](function(){return respondWithRpcPromise(_0x8d2e('0x5e'),_0x8d2e('0x55'),{'module':_0x8d2e('0x5f')});})['then'](function(){var _0x29b8e9=_0x1c0122[_0x8d2e('0x60')][_0x8d2e('0x61')]({'plain':!![]});if(!_0x29b8e9)throw new Error(_0x8d2e('0x62'));if(_0x29b8e9[_0x8d2e('0x63')]==='user'){var _0x5721bb=_0x1b371e[_0x8d2e('0x61')]({'plain':!![]});return db['UserProfileSection'][_0x8d2e('0x54')]({'where':{'name':_0x8d2e('0x35'),'userProfileId':_0x29b8e9['userProfileId']},'raw':!![]})[_0x8d2e('0x1f')](function(_0x4605ca){if(_0x4605ca&&_0x4605ca[_0x8d2e('0x64')]===0x0){return db[_0x8d2e('0x36')][_0x8d2e('0x55')]({'name':_0x5721bb['name'],'resourceId':_0x5721bb['id'],'type':_0x4605ca['name'],'sectionId':_0x4605ca['id']},{})[_0x8d2e('0x1f')](function(){return _0x1b371e;});}else{return _0x1b371e;}})[_0x8d2e('0x50')](function(_0x20f4d3){logger[_0x8d2e('0x26')](_0x8d2e('0x65'),_0x20f4d3);throw _0x20f4d3;});}return _0x1b371e;})[_0x8d2e('0x1f')](respondWithResult(_0x5305a6,0xc9))[_0x8d2e('0x50')](handleError(_0x5305a6,null));};exports['update']=function(_0xa77f52,_0x4edad2,_0x206afb){var _0x7c0279;return db['VoiceContext'][_0x8d2e('0x54')]({'where':{'id':_0xa77f52[_0x8d2e('0x66')]['id']}})[_0x8d2e('0x1f')](handleEntityNotFound(_0x4edad2,null))['then'](saveUpdates(_0xa77f52[_0x8d2e('0x56')],null))[_0x8d2e('0x1f')](function(_0xf71c1b){if(_0xf71c1b){_0x7c0279=_0xf71c1b;return db[_0x8d2e('0x3c')][_0x8d2e('0x4f')]({'raw':!![]});}})[_0x8d2e('0x1f')](function(_0xcd3c1c){var _0x351681=fs['readFileSync'](path['join'](config[_0x8d2e('0x59')],_0x8d2e('0x5a')),'utf8');var _0x2292ac=ejs[_0x8d2e('0x5c')](_0x351681,{'contexts':_0xcd3c1c||[]});fs[_0x8d2e('0x67')](_0x8d2e('0x5d'),_0x2292ac);})['then'](function(){return respondWithRpcPromise('Reload',_0x8d2e('0x68'),{'module':_0x8d2e('0x5f')});})[_0x8d2e('0x1f')](function(){return _0x7c0279;})[_0x8d2e('0x1f')](respondWithResult(_0x4edad2,null))[_0x8d2e('0x50')](handleError(_0x4edad2,null));};exports[_0x8d2e('0x37')]=function(_0x578831,_0xf33f21,_0x2b10b3){var _0x5f28aa;return db['VoiceContext'][_0x8d2e('0x54')]({'where':{'id':_0x578831[_0x8d2e('0x66')]['id']}})['then'](handleEntityNotFound(_0xf33f21,null))[_0x8d2e('0x1f')](removeEntity(_0xf33f21,null))['then'](function(){return db[_0x8d2e('0x3c')]['findAll']({'raw':!![]});})[_0x8d2e('0x1f')](function(_0x32a209){var _0x355327=fs['readFileSync'](path[_0x8d2e('0x58')](config[_0x8d2e('0x59')],'server/files/templates/context.ejs'),_0x8d2e('0x5b'));var _0x5cd981=ejs['render'](_0x355327,{'contexts':_0x32a209});fs[_0x8d2e('0x67')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5cd981);return respondWithRpcPromise(_0x8d2e('0x5e'),'destroy',{'module':_0x8d2e('0x5f')});})['catch'](handleError(_0xf33f21,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 54ed993..a2318b6 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 _0x3ba4=['define','VoiceContext','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ba4,0xc2));var _0x43ba=function(_0x2f47c3,_0x1c3015){_0x2f47c3=_0x2f47c3-0x0;var _0x5c8d37=_0x3ba4[_0x2f47c3];return _0x5c8d37;};'use strict';var _=require(_0x43ba('0x0'));var util=require('util');var logger=require(_0x43ba('0x1'))(_0x43ba('0x2'));var moment=require(_0x43ba('0x3'));var BPromise=require(_0x43ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x43ba('0x5'));var rimraf=require(_0x43ba('0x6'));var config=require(_0x43ba('0x7'));var attributes=require(_0x43ba('0x8'));module[_0x43ba('0x9')]=function(_0x1866e6,_0x3a30a9){return _0x1866e6[_0x43ba('0xa')](_0x43ba('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8481=['rimraf','../../config/environment','exports','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x323a09,_0xc46211){var _0x43de56=function(_0x59649e){while(--_0x59649e){_0x323a09['push'](_0x323a09['shift']());}};_0x43de56(++_0xc46211);}(_0x8481,0x1c7));var _0x1848=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8481[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x1848('0x0'));var util=require('util');var logger=require(_0x1848('0x1'))(_0x1848('0x2'));var moment=require(_0x1848('0x3'));var BPromise=require(_0x1848('0x4'));var rp=require(_0x1848('0x5'));var fs=require('fs');var path=require(_0x1848('0x6'));var rimraf=require(_0x1848('0x7'));var config=require(_0x1848('0x8'));var attributes=require('./voiceContext.attributes');module[_0x1848('0x9')]=function(_0x5cb737,_0x5ad7d9){return _0x5cb737['define']('VoiceContext',attributes,{'tableName':_0x1848('0xa'),'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 9354cff..4efe89f 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 _0xa9e8=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb32f0f,_0x312aa2){var _0x4fcd0e=function(_0x29d0de){while(--_0x29d0de){_0xb32f0f['push'](_0xb32f0f['shift']());}};_0x4fcd0e(++_0x312aa2);}(_0xa9e8,0x78));var _0x8a9e=function(_0x4a8639,_0x5180dd){_0x4a8639=_0x4a8639-0x0;var _0x4919ef=_0xa9e8[_0x4a8639];return _0x4919ef;};'use strict';var _=require(_0x8a9e('0x0'));var util=require(_0x8a9e('0x1'));var moment=require(_0x8a9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a9e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a9e('0x5'));var client=jayson[_0x8a9e('0x6')][_0x8a9e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x254f8a,_0x55b987,_0x43835c){return new BPromise(function(_0x223d67,_0x5211f0){return client[_0x8a9e('0x8')](_0x254f8a,_0x43835c)[_0x8a9e('0x9')](function(_0x43342d){logger['info'](_0x8a9e('0xa'),_0x55b987,'request\x20sent');logger['debug'](_0x8a9e('0xb'),_0x55b987,_0x8a9e('0xc'),JSON[_0x8a9e('0xd')](_0x43342d));if(_0x43342d[_0x8a9e('0xe')]){if(_0x43342d[_0x8a9e('0xe')][_0x8a9e('0xf')]===0x1f4){logger[_0x8a9e('0xe')](_0x8a9e('0xa'),_0x55b987,_0x43342d[_0x8a9e('0xe')][_0x8a9e('0x10')]);return _0x5211f0(_0x43342d['error'][_0x8a9e('0x10')]);}logger['error'](_0x8a9e('0xa'),_0x55b987,_0x43342d[_0x8a9e('0xe')][_0x8a9e('0x10')]);return _0x223d67(_0x43342d[_0x8a9e('0xe')]['message']);}else{logger['info'](_0x8a9e('0xa'),_0x55b987,_0x8a9e('0xc'));_0x223d67(_0x43342d[_0x8a9e('0x11')]['message']);}})[_0x8a9e('0x12')](function(_0x35ca37){logger[_0x8a9e('0xe')](_0x8a9e('0xa'),_0x55b987,_0x35ca37);_0x5211f0(_0x35ca37);});});} \ No newline at end of file +var _0xf604=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','VoiceContext,\x20%s,\x20%s','message'];(function(_0x15ef35,_0x27822b){var _0x68f143=function(_0x44d216){while(--_0x44d216){_0x15ef35['push'](_0x15ef35['shift']());}};_0x68f143(++_0x27822b);}(_0xf604,0x1a4));var _0x4f60=function(_0x8307e3,_0x48eb78){_0x8307e3=_0x8307e3-0x0;var _0x492db9=_0xf604[_0x8307e3];return _0x492db9;};'use strict';var _=require(_0x4f60('0x0'));var util=require(_0x4f60('0x1'));var moment=require(_0x4f60('0x2'));var BPromise=require(_0x4f60('0x3'));var rs=require(_0x4f60('0x4'));var fs=require('fs');var Redis=require(_0x4f60('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f60('0x6'))(_0x4f60('0x7'));var config=require(_0x4f60('0x8'));var jayson=require(_0x4f60('0x9'));var client=jayson[_0x4f60('0xa')][_0x4f60('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf758bb,_0x48bf70,_0x39e283){return new BPromise(function(_0x3818d4,_0x43c2bf){return client['request'](_0xf758bb,_0x39e283)['then'](function(_0x4fdf1b){logger[_0x4f60('0xc')]('VoiceContext,\x20%s,\x20%s',_0x48bf70,_0x4f60('0xd'));logger[_0x4f60('0xe')](_0x4f60('0xf'),_0x48bf70,_0x4f60('0xd'),JSON['stringify'](_0x4fdf1b));if(_0x4fdf1b['error']){if(_0x4fdf1b['error'][_0x4f60('0x10')]===0x1f4){logger[_0x4f60('0x11')](_0x4f60('0x12'),_0x48bf70,_0x4fdf1b[_0x4f60('0x11')]['message']);return _0x43c2bf(_0x4fdf1b[_0x4f60('0x11')][_0x4f60('0x13')]);}logger['error'](_0x4f60('0x12'),_0x48bf70,_0x4fdf1b[_0x4f60('0x11')][_0x4f60('0x13')]);return _0x3818d4(_0x4fdf1b['error'][_0x4f60('0x13')]);}else{logger[_0x4f60('0xc')]('VoiceContext,\x20%s,\x20%s',_0x48bf70,_0x4f60('0xd'));_0x3818d4(_0x4fdf1b[_0x4f60('0x14')][_0x4f60('0x13')]);}})[_0x4f60('0x15')](function(_0x5a93e9){logger[_0x4f60('0x11')]('VoiceContext,\x20%s,\x20%s',_0x48bf70,_0x5a93e9);_0x43c2bf(_0x5a93e9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bb2a320..8fc4f64 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 _0xdcc2=['show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x328290,_0x4320d7){var _0x2af434=function(_0x2fb7a3){while(--_0x2fb7a3){_0x328290['push'](_0x328290['shift']());}};_0x2af434(++_0x4320d7);}(_0xdcc2,0x16b));var _0x2dcc=function(_0x27f9e3,_0x5a9ad5){_0x27f9e3=_0x27f9e3-0x0;var _0x79802e=_0xdcc2[_0x27f9e3];return _0x79802e;};'use strict';var multer=require(_0x2dcc('0x0'));var util=require('util');var path=require(_0x2dcc('0x1'));var timeout=require(_0x2dcc('0x2'));var express=require(_0x2dcc('0x3'));var router=express[_0x2dcc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2dcc('0x5'));router[_0x2dcc('0x6')]('/',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0x8')]);router[_0x2dcc('0x6')]('/describe',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0x9')]);router[_0x2dcc('0x6')](_0x2dcc('0xa'),auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xb')]);router[_0x2dcc('0xc')]('/',auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xd')]);router[_0x2dcc('0xe')](_0x2dcc('0xa'),auth[_0x2dcc('0x7')](),controller[_0x2dcc('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2dcc('0x10')]=router; \ No newline at end of file +var _0xe8cd=['../../components/interaction/service','index','/describe','describe','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x49e3a6,_0x468448){var _0x185a7b=function(_0x163a1d){while(--_0x163a1d){_0x49e3a6['push'](_0x49e3a6['shift']());}};_0x185a7b(++_0x468448);}(_0xe8cd,0x152));var _0xde8c=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0xe8cd[_0x329664];return _0x4e346e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xde8c('0x0'));var timeout=require(_0xde8c('0x1'));var express=require('express');var router=express[_0xde8c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xde8c('0x3'));var interaction=require(_0xde8c('0x4'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xde8c('0x5')]);router['get'](_0xde8c('0x6'),auth['isAuthenticated'](),controller[_0xde8c('0x7')]);router[_0xde8c('0x8')](_0xde8c('0x9'),auth[_0xde8c('0xa')](),controller['show']);router[_0xde8c('0xb')]('/',auth[_0xde8c('0xa')](),controller[_0xde8c('0xc')]);router[_0xde8c('0xd')]('/:id',auth[_0xde8c('0xa')](),controller[_0xde8c('0xe')]);router[_0xde8c('0xf')]('/:id',auth[_0xde8c('0xa')](),controller[_0xde8c('0x10')]);module[_0xde8c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ab18088..b7e8354 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x311c92,_0x9166a3){var _0x2914d0=function(_0x3476d2){while(--_0x3476d2){_0x311c92['push'](_0x311c92['shift']());}};_0x2914d0(++_0x9166a3);}(_0x84ab,0x12f));var _0xb84a=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x84ab[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2ec3265..1e2235d 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 _0xb2b8=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceDialReport','type','key','model','query','keys','filters','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','show','rawAttributes','intersection','fields','length','find','catch','create','body','params','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0x3a2ef5,_0x47e4c1){var _0x48d535=function(_0x5e5503){while(--_0x5e5503){_0x3a2ef5['push'](_0x3a2ef5['shift']());}};_0x48d535(++_0x47e4c1);}(_0xb2b8,0xc8));var _0x8b2b=function(_0x2a8f34,_0x3130a6){_0x2a8f34=_0x2a8f34-0x0;var _0x1dd9a9=_0xb2b8[_0x2a8f34];return _0x1dd9a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b2b('0x0'));var zipdir=require(_0x8b2b('0x1'));var jsonpatch=require(_0x8b2b('0x2'));var rp=require(_0x8b2b('0x3'));var moment=require(_0x8b2b('0x4'));var BPromise=require(_0x8b2b('0x5'));var Mustache=require(_0x8b2b('0x6'));var util=require(_0x8b2b('0x7'));var path=require(_0x8b2b('0x8'));var sox=require(_0x8b2b('0x9'));var csv=require(_0x8b2b('0xa'));var ejs=require(_0x8b2b('0xb'));var fs=require('fs');var fs_extra=require(_0x8b2b('0xc'));var _=require(_0x8b2b('0xd'));var squel=require(_0x8b2b('0xe'));var crypto=require(_0x8b2b('0xf'));var jsforce=require(_0x8b2b('0x10'));var deskjs=require(_0x8b2b('0x11'));var toCsv=require(_0x8b2b('0xa'));var querystring=require(_0x8b2b('0x12'));var Papa=require('papaparse');var Redis=require(_0x8b2b('0x13'));var authService=require(_0x8b2b('0x14'));var qs=require(_0x8b2b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b2b('0x16'));var logger=require(_0x8b2b('0x17'))(_0x8b2b('0x18'));var utils=require(_0x8b2b('0x19'));var config=require(_0x8b2b('0x1a'));var licenseUtil=require(_0x8b2b('0x1b'));var db=require(_0x8b2b('0x1c'))['db'];function respondWithStatusCode(_0x266764,_0x3f2278){_0x3f2278=_0x3f2278||0xcc;return function(_0x51d223){if(_0x51d223){return _0x266764[_0x8b2b('0x1d')](_0x3f2278);}return _0x266764[_0x8b2b('0x1e')](_0x3f2278)['end']();};}function respondWithResult(_0x2cd526,_0x6e0dc6){_0x6e0dc6=_0x6e0dc6||0xc8;return function(_0x860d34){if(_0x860d34){return _0x2cd526['status'](_0x6e0dc6)[_0x8b2b('0x1f')](_0x860d34);}};}function respondWithFilteredResult(_0x48b203,_0x21aa1e){return function(_0x570eb7){if(_0x570eb7){var _0x3f523e=typeof _0x21aa1e[_0x8b2b('0x20')]===_0x8b2b('0x21')&&typeof _0x21aa1e['limit']===_0x8b2b('0x21');var _0x2e8eec=_0x570eb7['count'];var _0xfe57d5=_0x3f523e?0x0:_0x21aa1e[_0x8b2b('0x20')];var _0x54372a=_0x3f523e?_0x570eb7[_0x8b2b('0x22')]:_0x21aa1e[_0x8b2b('0x20')]+_0x21aa1e[_0x8b2b('0x23')];var _0x40807a;if(_0x54372a>=_0x2e8eec){_0x54372a=_0x2e8eec;_0x40807a=0xc8;}else{_0x40807a=0xce;}_0x48b203[_0x8b2b('0x1e')](_0x40807a);return _0x48b203[_0x8b2b('0x24')](_0x8b2b('0x25'),_0xfe57d5+'-'+_0x54372a+'/'+_0x2e8eec)['json'](_0x570eb7);}return null;};}function patchUpdates(_0x528bff){return function(_0x51da74){try{jsonpatch[_0x8b2b('0x26')](_0x51da74,_0x528bff,!![]);}catch(_0x50109a){return BPromise[_0x8b2b('0x27')](_0x50109a);}return _0x51da74[_0x8b2b('0x28')]();};}function saveUpdates(_0x28001f,_0x267490){return function(_0x360339){if(_0x360339){return _0x360339[_0x8b2b('0x29')](_0x28001f)[_0x8b2b('0x2a')](function(_0x14df32){return _0x14df32;});}return null;};}function removeEntity(_0x38b4f2,_0xa22338){return function(_0x3c774a){if(_0x3c774a){return _0x3c774a[_0x8b2b('0x2b')]()['then'](function(){_0x38b4f2[_0x8b2b('0x1e')](0xcc)[_0x8b2b('0x2c')]();});}};}function handleEntityNotFound(_0x63528d,_0x22ea77){return function(_0x328fff){if(!_0x328fff){_0x63528d[_0x8b2b('0x1d')](0x194);}return _0x328fff;};}function handleError(_0x138fe3,_0x2e12bc){_0x2e12bc=_0x2e12bc||0x1f4;return function(_0x562aab){logger[_0x8b2b('0x2d')](_0x562aab[_0x8b2b('0x2e')]);if(_0x562aab['name']){delete _0x562aab[_0x8b2b('0x2f')];}_0x138fe3[_0x8b2b('0x1e')](_0x2e12bc)['send'](_0x562aab);};}exports[_0x8b2b('0x30')]=function(_0x1b8095,_0x521397){var _0x2308b4={},_0x373a88={},_0x4536d3={'count':0x0,'rows':[]};var _0x5aa777=_[_0x8b2b('0x31')](db[_0x8b2b('0x32')]['rawAttributes'],function(_0x4b1df1){return{'name':_0x4b1df1['fieldName'],'type':_0x4b1df1[_0x8b2b('0x33')][_0x8b2b('0x34')]};});_0x373a88[_0x8b2b('0x35')]=_[_0x8b2b('0x31')](_0x5aa777,'name');_0x373a88[_0x8b2b('0x36')]=_[_0x8b2b('0x37')](_0x1b8095[_0x8b2b('0x36')]);_0x373a88[_0x8b2b('0x38')]=_['intersection'](_0x373a88[_0x8b2b('0x35')],_0x373a88[_0x8b2b('0x36')]);_0x2308b4[_0x8b2b('0x39')]=_['intersection'](_0x373a88['model'],qs['fields'](_0x1b8095[_0x8b2b('0x36')]['fields']));_0x2308b4[_0x8b2b('0x39')]=_0x2308b4['attributes']['length']?_0x2308b4[_0x8b2b('0x39')]:_0x373a88[_0x8b2b('0x35')];if(!_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3a')]('nolimit')){_0x2308b4[_0x8b2b('0x23')]=qs['limit'](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x23')]);_0x2308b4[_0x8b2b('0x20')]=qs[_0x8b2b('0x20')](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x20')]);}_0x2308b4[_0x8b2b('0x3b')]=qs[_0x8b2b('0x3c')](_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3c')]);_0x2308b4[_0x8b2b('0x3d')]=qs[_0x8b2b('0x38')](_[_0x8b2b('0x3e')](_0x1b8095[_0x8b2b('0x36')],_0x373a88['filters']),_0x5aa777);if(_0x1b8095['query'][_0x8b2b('0x3f')]){_0x2308b4['where']=_['merge'](_0x2308b4[_0x8b2b('0x3d')],{'$or':_[_0x8b2b('0x31')](_0x5aa777,function(_0x5b7253){if(_0x5b7253[_0x8b2b('0x33')]!=='VIRTUAL'){var _0x17dd22={};_0x17dd22[_0x5b7253[_0x8b2b('0x2f')]]={'$like':'%'+_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x3f')]+'%'};return _0x17dd22;}})});}_0x2308b4=_[_0x8b2b('0x40')]({},_0x2308b4,_0x1b8095['options']);var _0x1d5aed={'where':_0x2308b4[_0x8b2b('0x3d')]};return db[_0x8b2b('0x32')][_0x8b2b('0x22')](_0x1d5aed)[_0x8b2b('0x2a')](function(_0x260fef){_0x4536d3['count']=_0x260fef;if(_0x1b8095[_0x8b2b('0x36')][_0x8b2b('0x41')]){_0x2308b4[_0x8b2b('0x42')]=[{'all':!![]}];}return db[_0x8b2b('0x32')]['findAll'](_0x2308b4);})[_0x8b2b('0x2a')](function(_0xbf41f6){_0x4536d3[_0x8b2b('0x43')]=_0xbf41f6;return _0x4536d3;})['then'](respondWithFilteredResult(_0x521397,_0x2308b4))['catch'](handleError(_0x521397,null));};exports[_0x8b2b('0x44')]=function(_0xd11052,_0x71be16){var _0x323521={'raw':!![],'where':{'id':_0xd11052['params']['id']}},_0x19d25c={};_0x19d25c[_0x8b2b('0x35')]=_[_0x8b2b('0x37')](db[_0x8b2b('0x32')][_0x8b2b('0x45')]);_0x19d25c[_0x8b2b('0x36')]=_[_0x8b2b('0x37')](_0xd11052[_0x8b2b('0x36')]);_0x19d25c[_0x8b2b('0x38')]=_[_0x8b2b('0x46')](_0x19d25c[_0x8b2b('0x35')],_0x19d25c[_0x8b2b('0x36')]);_0x323521[_0x8b2b('0x39')]=_[_0x8b2b('0x46')](_0x19d25c['model'],qs[_0x8b2b('0x47')](_0xd11052[_0x8b2b('0x36')][_0x8b2b('0x47')]));_0x323521[_0x8b2b('0x39')]=_0x323521['attributes'][_0x8b2b('0x48')]?_0x323521[_0x8b2b('0x39')]:_0x19d25c[_0x8b2b('0x35')];if(_0xd11052[_0x8b2b('0x36')]['includeAll']){_0x323521['include']=[{'all':!![]}];}_0x323521=_[_0x8b2b('0x40')]({},_0x323521,_0xd11052['options']);return db[_0x8b2b('0x32')][_0x8b2b('0x49')](_0x323521)[_0x8b2b('0x2a')](handleEntityNotFound(_0x71be16,null))['then'](respondWithResult(_0x71be16,null))[_0x8b2b('0x4a')](handleError(_0x71be16,null));};exports[_0x8b2b('0x4b')]=function(_0x14681a,_0x1d2184){return db[_0x8b2b('0x32')]['create'](_0x14681a['body'],{})[_0x8b2b('0x2a')](respondWithResult(_0x1d2184,0xc9))[_0x8b2b('0x4a')](handleError(_0x1d2184,null));};exports[_0x8b2b('0x29')]=function(_0x30493b,_0x3e3787){if(_0x30493b[_0x8b2b('0x4c')]['id']){delete _0x30493b['body']['id'];}return db['VoiceDialReport'][_0x8b2b('0x49')]({'where':{'id':_0x30493b[_0x8b2b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3e3787,null))[_0x8b2b('0x2a')](saveUpdates(_0x30493b[_0x8b2b('0x4c')],null))['then'](respondWithResult(_0x3e3787,null))[_0x8b2b('0x4a')](handleError(_0x3e3787,null));};exports[_0x8b2b('0x2b')]=function(_0xb677b4,_0x56b88f){return db[_0x8b2b('0x32')][_0x8b2b('0x49')]({'where':{'id':_0xb677b4['params']['id']}})[_0x8b2b('0x2a')](handleEntityNotFound(_0x56b88f,null))[_0x8b2b('0x2a')](removeEntity(_0x56b88f,null))[_0x8b2b('0x4a')](handleError(_0x56b88f,null));};exports[_0x8b2b('0x4e')]=function(_0x4d1e68,_0x318297){return db[_0x8b2b('0x32')][_0x8b2b('0x4e')]()[_0x8b2b('0x2a')](respondWithResult(_0x318297,null))[_0x8b2b('0x4a')](handleError(_0x318297,null));}; \ No newline at end of file +var _0x71af=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceDialReport','includeAll','include','findAll','catch','show','params','find','create','body','describe'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x71af,0xe4));var _0xf71a=function(_0x5ef515,_0x20092d){_0x5ef515=_0x5ef515-0x0;var _0x21d397=_0x71af[_0x5ef515];return _0x21d397;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf71a('0x0'));var zipdir=require(_0xf71a('0x1'));var jsonpatch=require(_0xf71a('0x2'));var rp=require(_0xf71a('0x3'));var moment=require(_0xf71a('0x4'));var BPromise=require(_0xf71a('0x5'));var Mustache=require('mustache');var util=require(_0xf71a('0x6'));var path=require(_0xf71a('0x7'));var sox=require('sox');var csv=require(_0xf71a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf71a('0x9'));var squel=require(_0xf71a('0xa'));var crypto=require(_0xf71a('0xb'));var jsforce=require(_0xf71a('0xc'));var deskjs=require(_0xf71a('0xd'));var toCsv=require(_0xf71a('0x8'));var querystring=require(_0xf71a('0xe'));var Papa=require(_0xf71a('0xf'));var Redis=require(_0xf71a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf71a('0x11'));var hardwareService=require(_0xf71a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xf71a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf71a('0x14'));var db=require(_0xf71a('0x15'))['db'];function respondWithStatusCode(_0x572e34,_0xd16c9a){_0xd16c9a=_0xd16c9a||0xcc;return function(_0x269116){if(_0x269116){return _0x572e34['sendStatus'](_0xd16c9a);}return _0x572e34['status'](_0xd16c9a)[_0xf71a('0x16')]();};}function respondWithResult(_0x299409,_0x5a5aaa){_0x5a5aaa=_0x5a5aaa||0xc8;return function(_0xe48b77){if(_0xe48b77){return _0x299409[_0xf71a('0x17')](_0x5a5aaa)[_0xf71a('0x18')](_0xe48b77);}};}function respondWithFilteredResult(_0x213f68,_0x378dbd){return function(_0x400b5f){if(_0x400b5f){var _0x5d152b=typeof _0x378dbd['offset']===_0xf71a('0x19')&&typeof _0x378dbd[_0xf71a('0x1a')]==='undefined';var _0x5ada03=_0x400b5f['count'];var _0x9d2e70=_0x5d152b?0x0:_0x378dbd[_0xf71a('0x1b')];var _0x25722f=_0x5d152b?_0x400b5f[_0xf71a('0x1c')]:_0x378dbd[_0xf71a('0x1b')]+_0x378dbd[_0xf71a('0x1a')];var _0x25ef93;if(_0x25722f>=_0x5ada03){_0x25722f=_0x5ada03;_0x25ef93=0xc8;}else{_0x25ef93=0xce;}_0x213f68[_0xf71a('0x17')](_0x25ef93);return _0x213f68[_0xf71a('0x1d')](_0xf71a('0x1e'),_0x9d2e70+'-'+_0x25722f+'/'+_0x5ada03)[_0xf71a('0x18')](_0x400b5f);}return null;};}function patchUpdates(_0x5906be){return function(_0x388cce){try{jsonpatch[_0xf71a('0x1f')](_0x388cce,_0x5906be,!![]);}catch(_0x26a55c){return BPromise[_0xf71a('0x20')](_0x26a55c);}return _0x388cce[_0xf71a('0x21')]();};}function saveUpdates(_0x5293cf,_0x49f748){return function(_0x302201){if(_0x302201){return _0x302201[_0xf71a('0x22')](_0x5293cf)[_0xf71a('0x23')](function(_0xcd5457){return _0xcd5457;});}return null;};}function removeEntity(_0xfe7fe9,_0x3206a9){return function(_0x3d54be){if(_0x3d54be){return _0x3d54be[_0xf71a('0x24')]()['then'](function(){_0xfe7fe9[_0xf71a('0x17')](0xcc)[_0xf71a('0x16')]();});}};}function handleEntityNotFound(_0x3bee0b,_0x17ce30){return function(_0x348ab1){if(!_0x348ab1){_0x3bee0b[_0xf71a('0x25')](0x194);}return _0x348ab1;};}function handleError(_0x3d3231,_0x4d6bc2){_0x4d6bc2=_0x4d6bc2||0x1f4;return function(_0x395d90){logger[_0xf71a('0x26')](_0x395d90[_0xf71a('0x27')]);if(_0x395d90[_0xf71a('0x28')]){delete _0x395d90['name'];}_0x3d3231['status'](_0x4d6bc2)[_0xf71a('0x29')](_0x395d90);};}exports[_0xf71a('0x2a')]=function(_0x465d55,_0x417606){var _0x1f14e1={},_0x408c96={},_0x4f6938={'count':0x0,'rows':[]};var _0x5c4e66=_[_0xf71a('0x2b')](db['VoiceDialReport'][_0xf71a('0x2c')],function(_0x1bfe7d){return{'name':_0x1bfe7d[_0xf71a('0x2d')],'type':_0x1bfe7d[_0xf71a('0x2e')][_0xf71a('0x2f')]};});_0x408c96['model']=_[_0xf71a('0x2b')](_0x5c4e66,_0xf71a('0x28'));_0x408c96['query']=_[_0xf71a('0x30')](_0x465d55[_0xf71a('0x31')]);_0x408c96[_0xf71a('0x32')]=_[_0xf71a('0x33')](_0x408c96['model'],_0x408c96[_0xf71a('0x31')]);_0x1f14e1[_0xf71a('0x34')]=_[_0xf71a('0x33')](_0x408c96[_0xf71a('0x35')],qs[_0xf71a('0x36')](_0x465d55[_0xf71a('0x31')][_0xf71a('0x36')]));_0x1f14e1[_0xf71a('0x34')]=_0x1f14e1['attributes'][_0xf71a('0x37')]?_0x1f14e1[_0xf71a('0x34')]:_0x408c96[_0xf71a('0x35')];if(!_0x465d55['query'][_0xf71a('0x38')](_0xf71a('0x39'))){_0x1f14e1[_0xf71a('0x1a')]=qs[_0xf71a('0x1a')](_0x465d55['query'][_0xf71a('0x1a')]);_0x1f14e1[_0xf71a('0x1b')]=qs[_0xf71a('0x1b')](_0x465d55[_0xf71a('0x31')][_0xf71a('0x1b')]);}_0x1f14e1[_0xf71a('0x3a')]=qs[_0xf71a('0x3b')](_0x465d55[_0xf71a('0x31')][_0xf71a('0x3b')]);_0x1f14e1[_0xf71a('0x3c')]=qs[_0xf71a('0x32')](_[_0xf71a('0x3d')](_0x465d55[_0xf71a('0x31')],_0x408c96[_0xf71a('0x32')]),_0x5c4e66);if(_0x465d55[_0xf71a('0x31')][_0xf71a('0x3e')]){_0x1f14e1[_0xf71a('0x3c')]=_[_0xf71a('0x3f')](_0x1f14e1[_0xf71a('0x3c')],{'$or':_['map'](_0x5c4e66,function(_0xb705a8){if(_0xb705a8['type']!=='VIRTUAL'){var _0x5ea208={};_0x5ea208[_0xb705a8[_0xf71a('0x28')]]={'$like':'%'+_0x465d55[_0xf71a('0x31')][_0xf71a('0x3e')]+'%'};return _0x5ea208;}})});}_0x1f14e1=_[_0xf71a('0x3f')]({},_0x1f14e1,_0x465d55[_0xf71a('0x40')]);var _0x1537c6={'where':_0x1f14e1[_0xf71a('0x3c')]};return db[_0xf71a('0x41')]['count'](_0x1537c6)[_0xf71a('0x23')](function(_0x52b766){_0x4f6938['count']=_0x52b766;if(_0x465d55[_0xf71a('0x31')][_0xf71a('0x42')]){_0x1f14e1[_0xf71a('0x43')]=[{'all':!![]}];}return db[_0xf71a('0x41')][_0xf71a('0x44')](_0x1f14e1);})[_0xf71a('0x23')](function(_0xc7779d){_0x4f6938['rows']=_0xc7779d;return _0x4f6938;})[_0xf71a('0x23')](respondWithFilteredResult(_0x417606,_0x1f14e1))[_0xf71a('0x45')](handleError(_0x417606,null));};exports[_0xf71a('0x46')]=function(_0x588ca9,_0x2fa887){var _0x338719={'raw':!![],'where':{'id':_0x588ca9[_0xf71a('0x47')]['id']}},_0x437545={};_0x437545[_0xf71a('0x35')]=_[_0xf71a('0x30')](db[_0xf71a('0x41')][_0xf71a('0x2c')]);_0x437545['query']=_[_0xf71a('0x30')](_0x588ca9['query']);_0x437545['filters']=_['intersection'](_0x437545[_0xf71a('0x35')],_0x437545[_0xf71a('0x31')]);_0x338719[_0xf71a('0x34')]=_[_0xf71a('0x33')](_0x437545[_0xf71a('0x35')],qs['fields'](_0x588ca9['query'][_0xf71a('0x36')]));_0x338719[_0xf71a('0x34')]=_0x338719[_0xf71a('0x34')]['length']?_0x338719[_0xf71a('0x34')]:_0x437545[_0xf71a('0x35')];if(_0x588ca9[_0xf71a('0x31')][_0xf71a('0x42')]){_0x338719[_0xf71a('0x43')]=[{'all':!![]}];}_0x338719=_[_0xf71a('0x3f')]({},_0x338719,_0x588ca9[_0xf71a('0x40')]);return db[_0xf71a('0x41')][_0xf71a('0x48')](_0x338719)[_0xf71a('0x23')](handleEntityNotFound(_0x2fa887,null))[_0xf71a('0x23')](respondWithResult(_0x2fa887,null))[_0xf71a('0x45')](handleError(_0x2fa887,null));};exports[_0xf71a('0x49')]=function(_0x329a65,_0x1915a6){return db[_0xf71a('0x41')][_0xf71a('0x49')](_0x329a65[_0xf71a('0x4a')],{})[_0xf71a('0x23')](respondWithResult(_0x1915a6,0xc9))[_0xf71a('0x45')](handleError(_0x1915a6,null));};exports[_0xf71a('0x22')]=function(_0x252076,_0x5bdc52){if(_0x252076[_0xf71a('0x4a')]['id']){delete _0x252076[_0xf71a('0x4a')]['id'];}return db[_0xf71a('0x41')]['find']({'where':{'id':_0x252076[_0xf71a('0x47')]['id']}})[_0xf71a('0x23')](handleEntityNotFound(_0x5bdc52,null))['then'](saveUpdates(_0x252076[_0xf71a('0x4a')],null))[_0xf71a('0x23')](respondWithResult(_0x5bdc52,null))[_0xf71a('0x45')](handleError(_0x5bdc52,null));};exports['destroy']=function(_0x5bc140,_0x23b016){return db[_0xf71a('0x41')][_0xf71a('0x48')]({'where':{'id':_0x5bc140[_0xf71a('0x47')]['id']}})[_0xf71a('0x23')](handleEntityNotFound(_0x23b016,null))[_0xf71a('0x23')](removeEntity(_0x23b016,null))[_0xf71a('0x45')](handleError(_0x23b016,null));};exports[_0xf71a('0x4b')]=function(_0xca8c48,_0xf06585){return db['VoiceDialReport'][_0xf71a('0x4b')]()['then'](respondWithResult(_0xf06585,null))[_0xf71a('0x45')](handleError(_0xf06585,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 82735ea..b95d224 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 _0xfef9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','util','../../config/logger','api'];(function(_0x23056e,_0x2256b9){var _0x512c99=function(_0x244965){while(--_0x244965){_0x23056e['push'](_0x23056e['shift']());}};_0x512c99(++_0x2256b9);}(_0xfef9,0x92));var _0x9fef=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xfef9[_0x725a4c];return _0x37b2cc;};'use strict';var _=require(_0x9fef('0x0'));var util=require(_0x9fef('0x1'));var logger=require(_0x9fef('0x2'))(_0x9fef('0x3'));var moment=require(_0x9fef('0x4'));var BPromise=require(_0x9fef('0x5'));var rp=require(_0x9fef('0x6'));var fs=require('fs');var path=require(_0x9fef('0x7'));var rimraf=require(_0x9fef('0x8'));var config=require(_0x9fef('0x9'));var attributes=require(_0x9fef('0xa'));module[_0x9fef('0xb')]=function(_0x45720d,_0x26ddb6){return _0x45720d[_0x9fef('0xc')](_0x9fef('0xd'),attributes,{'tableName':_0x9fef('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b8f=['exports','define','VoiceDialReport','report_dial','util','api','request-promise','path','../../config/environment','./voiceDialReport.attributes'];(function(_0xb0ef6,_0x53cd27){var _0x30a8ff=function(_0x1df3c3){while(--_0x1df3c3){_0xb0ef6['push'](_0xb0ef6['shift']());}};_0x30a8ff(++_0x53cd27);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x473029,_0x84f5c5){_0x473029=_0x473029-0x0;var _0x183999=_0x6b8f[_0x473029];return _0x183999;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index eb2b972..135147c 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 _0x664b=['create','body','options','raw','CreateVoiceDialReport','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x664b,0xb2));var _0xb664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x664b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var moment=require(_0xb664('0x2'));var BPromise=require(_0xb664('0x3'));var rs=require(_0xb664('0x4'));var fs=require('fs');var Redis=require(_0xb664('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb664('0x6'));var logger=require(_0xb664('0x7'))(_0xb664('0x8'));var config=require(_0xb664('0x9'));var jayson=require(_0xb664('0xa'));var client=jayson[_0xb664('0xb')][_0xb664('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a2b97,_0x38ac19,_0x3236c0){return new BPromise(function(_0x44bdac,_0x5f3d8d){return client['request'](_0x4a2b97,_0x3236c0)[_0xb664('0xd')](function(_0x8c56b0){logger[_0xb664('0xe')](_0xb664('0xf'),_0x38ac19,_0xb664('0x10'));logger[_0xb664('0x11')](_0xb664('0x12'),_0x38ac19,_0xb664('0x10'),JSON[_0xb664('0x13')](_0x8c56b0));if(_0x8c56b0[_0xb664('0x14')]){if(_0x8c56b0['error'][_0xb664('0x15')]===0x1f4){logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);return _0x5f3d8d(_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);}logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x8c56b0[_0xb664('0x14')][_0xb664('0x16')]);return _0x44bdac(_0x8c56b0['error']['message']);}else{logger['info'](_0xb664('0xf'),_0x38ac19,_0xb664('0x10'));_0x44bdac(_0x8c56b0[_0xb664('0x17')][_0xb664('0x16')]);}})[_0xb664('0x18')](function(_0x99e7bd){logger[_0xb664('0x14')](_0xb664('0xf'),_0x38ac19,_0x99e7bd);_0x5f3d8d(_0x99e7bd);});});}exports['CreateVoiceDialReport']=function(_0x39aaaf){var _0x54d4b7=this;return new Promise(function(_0x527ba4,_0x13473f){return db[_0xb664('0x19')][_0xb664('0x1a')](_0x39aaaf[_0xb664('0x1b')],{'raw':_0x39aaaf[_0xb664('0x1c')]?_0x39aaaf[_0xb664('0x1c')][_0xb664('0x1d')]===undefined?!![]:![]:!![]})[_0xb664('0xd')](function(_0x43488b){logger[_0xb664('0xe')](_0xb664('0x1e'),_0x39aaaf);logger[_0xb664('0x11')]('CreateVoiceDialReport',_0x39aaaf,JSON[_0xb664('0x13')](_0x43488b));_0x527ba4(_0x43488b);})[_0xb664('0x18')](function(_0x1a12de){logger['error'](_0xb664('0x1e'),_0x1a12de[_0xb664('0x16')],_0x39aaaf);_0x13473f(_0x54d4b7[_0xb664('0x14')](0x1f4,_0x1a12de[_0xb664('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x31a834){var _0x81e2b5=this;return new Promise(function(_0x4bbec5,_0x587541){return db[_0xb664('0x19')]['update'](_0x31a834[_0xb664('0x1b')],{'raw':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')][_0xb664('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31a834['options']?_0x31a834[_0xb664('0x1c')][_0xb664('0x1f')]||null:null,'attributes':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')]['attributes']||null:null,'limit':_0x31a834[_0xb664('0x1c')]?_0x31a834[_0xb664('0x1c')][_0xb664('0x20')]||null:null})['then'](function(_0x3ff893){logger['info']('UpdateVoiceDialReport',_0x31a834);logger[_0xb664('0x11')](_0xb664('0x21'),_0x31a834,JSON['stringify'](_0x3ff893));_0x4bbec5(_0x3ff893);})['catch'](function(_0x12d28e){logger[_0xb664('0x14')](_0xb664('0x21'),_0x12d28e[_0xb664('0x16')],_0x31a834);_0x587541(_0x81e2b5[_0xb664('0x14')](0x1f4,_0x12d28e[_0xb664('0x16')]));});});}; \ No newline at end of file +var _0x059c=['stringify','error','message','result','catch','CreateVoiceDialReport','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','attributes','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x173c84,_0x1b2613){var _0x1ebc7b=function(_0x13e801){while(--_0x13e801){_0x173c84['push'](_0x173c84['shift']());}};_0x1ebc7b(++_0x1b2613);}(_0x059c,0x140));var _0xc059=function(_0x5104ec,_0x11722d){_0x5104ec=_0x5104ec-0x0;var _0x22b805=_0x059c[_0x5104ec];return _0x22b805;};'use strict';var _=require(_0xc059('0x0'));var util=require('util');var moment=require(_0xc059('0x1'));var BPromise=require(_0xc059('0x2'));var rs=require(_0xc059('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc059('0x4'))(_0xc059('0x5'));var config=require(_0xc059('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc059('0x7')][_0xc059('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7579,_0x1b0776,_0x2521b9){return new BPromise(function(_0x32f656,_0x41a3b8){return client[_0xc059('0x9')](_0x3a7579,_0x2521b9)[_0xc059('0xa')](function(_0x43e602){logger[_0xc059('0xb')](_0xc059('0xc'),_0x1b0776,_0xc059('0xd'));logger[_0xc059('0xe')](_0xc059('0xf'),_0x1b0776,_0xc059('0xd'),JSON[_0xc059('0x10')](_0x43e602));if(_0x43e602[_0xc059('0x11')]){if(_0x43e602['error']['code']===0x1f4){logger[_0xc059('0x11')](_0xc059('0xc'),_0x1b0776,_0x43e602['error']['message']);return _0x41a3b8(_0x43e602[_0xc059('0x11')]['message']);}logger[_0xc059('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x1b0776,_0x43e602[_0xc059('0x11')][_0xc059('0x12')]);return _0x32f656(_0x43e602[_0xc059('0x11')][_0xc059('0x12')]);}else{logger[_0xc059('0xb')](_0xc059('0xc'),_0x1b0776,_0xc059('0xd'));_0x32f656(_0x43e602[_0xc059('0x13')][_0xc059('0x12')]);}})[_0xc059('0x14')](function(_0x379753){logger[_0xc059('0x11')](_0xc059('0xc'),_0x1b0776,_0x379753);_0x41a3b8(_0x379753);});});}exports[_0xc059('0x15')]=function(_0x3da003){var _0x5e70fc=this;return new Promise(function(_0x66df9f,_0x3354e8){return db['VoiceDialReport']['create'](_0x3da003[_0xc059('0x16')],{'raw':_0x3da003[_0xc059('0x17')]?_0x3da003['options'][_0xc059('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1b3b9d){logger[_0xc059('0xb')](_0xc059('0x15'),_0x3da003);logger[_0xc059('0xe')](_0xc059('0x15'),_0x3da003,JSON[_0xc059('0x10')](_0x1b3b9d));_0x66df9f(_0x1b3b9d);})['catch'](function(_0x3b1e39){logger[_0xc059('0x11')](_0xc059('0x15'),_0x3b1e39['message'],_0x3da003);_0x3354e8(_0x5e70fc[_0xc059('0x11')](0x1f4,_0x3b1e39[_0xc059('0x12')]));});});};exports[_0xc059('0x19')]=function(_0x3f6b84){var _0x49eea8=this;return new Promise(function(_0xdb1402,_0x523afa){return db[_0xc059('0x1a')]['update'](_0x3f6b84[_0xc059('0x16')],{'raw':_0x3f6b84[_0xc059('0x17')]?_0x3f6b84['options'][_0xc059('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6b84[_0xc059('0x17')]?_0x3f6b84['options']['where']||null:null,'attributes':_0x3f6b84[_0xc059('0x17')]?_0x3f6b84[_0xc059('0x17')][_0xc059('0x1b')]||null:null,'limit':_0x3f6b84[_0xc059('0x17')]?_0x3f6b84['options']['limit']||null:null})[_0xc059('0xa')](function(_0x5ac019){logger[_0xc059('0xb')]('UpdateVoiceDialReport',_0x3f6b84);logger[_0xc059('0xe')]('UpdateVoiceDialReport',_0x3f6b84,JSON[_0xc059('0x10')](_0x5ac019));_0xdb1402(_0x5ac019);})['catch'](function(_0x152c9d){logger[_0xc059('0x11')]('UpdateVoiceDialReport',_0x152c9d[_0xc059('0x12')],_0x3f6b84);_0x523afa(_0x49eea8[_0xc059('0x11')](0x1f4,_0x152c9d[_0xc059('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 84e6fda..ef2f7da 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 _0xe19c=['path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','destroy','util'];(function(_0x49f25f,_0x342a75){var _0x227ed0=function(_0xab07e3){while(--_0xab07e3){_0x49f25f['push'](_0x49f25f['shift']());}};_0x227ed0(++_0x342a75);}(_0xe19c,0x175));var _0xce19=function(_0x152c94,_0x1b9c39){_0x152c94=_0x152c94-0x0;var _0x4c46e8=_0xe19c[_0x152c94];return _0x4c46e8;};'use strict';var multer=require('multer');var util=require(_0xce19('0x0'));var path=require(_0xce19('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce19('0x2'));var interaction=require(_0xce19('0x3'));var config=require(_0xce19('0x4'));var controller=require(_0xce19('0x5'));router[_0xce19('0x6')]('/',auth[_0xce19('0x7')](),controller[_0xce19('0x8')]);router[_0xce19('0x6')](_0xce19('0x9'),auth[_0xce19('0x7')](),controller[_0xce19('0xa')]);router[_0xce19('0xb')]('/',auth['isAuthenticated'](),controller[_0xce19('0xc')]);router['post'](_0xce19('0xd'),auth[_0xce19('0x7')](),controller[_0xce19('0xe')]);router[_0xce19('0xf')]('/:id',auth[_0xce19('0x7')](),controller['update']);router['delete'](_0xce19('0x9'),auth['isAuthenticated'](),controller[_0xce19('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8ad=['multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update','delete'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0xd8ad,0x169));var _0xdd8a=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0xd8ad[_0x205e5a];return _0x10da58;};'use strict';var multer=require(_0xdd8a('0x0'));var util=require('util');var path=require(_0xdd8a('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd8a('0x2'));var router=express[_0xdd8a('0x3')]();var fs_extra=require(_0xdd8a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdd8a('0x5'));var config=require(_0xdd8a('0x6'));var controller=require(_0xdd8a('0x7'));router[_0xdd8a('0x8')]('/',auth[_0xdd8a('0x9')](),controller[_0xdd8a('0xa')]);router['get'](_0xdd8a('0xb'),auth[_0xdd8a('0x9')](),controller[_0xdd8a('0xc')]);router[_0xdd8a('0xd')]('/',auth[_0xdd8a('0x9')](),controller[_0xdd8a('0xe')]);router['post']('/:id/applications',auth[_0xdd8a('0x9')](),controller[_0xdd8a('0xf')]);router[_0xdd8a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xdd8a('0x11')]);router[_0xdd8a('0x12')](_0xdd8a('0xb'),auth[_0xdd8a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e43d363..d21fd51 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 _0x4fed=['wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN'];(function(_0x1616ed,_0x226ec1){var _0x515008=function(_0x233b42){while(--_0x233b42){_0x1616ed['push'](_0x1616ed['shift']());}};_0x515008(++_0x226ec1);}(_0x4fed,0x180));var _0xd4fe=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x4fed[_0x1f1a97];return _0x29fc6a;};'use strict';var Sequelize=require(_0xd4fe('0x0'));module[_0xd4fe('0x1')]={'context':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'unique':_0xd4fe('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'unique':_0xd4fe('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':_0xd4fe('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd4fe('0x5')](_0xd4fe('0x6'),_0xd4fe('0x7'),_0xd4fe('0x8'),_0xd4fe('0x9'),_0xd4fe('0xa'),_0xd4fe('0xb'),_0xd4fe('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xd4fe('0x2')]},'interval':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd4fe('0xd')]},'isApp':{'type':Sequelize[_0xd4fe('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd4fe('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd4fe('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd4fe('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd4fe('0xf')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd4fe('0x10')],'get':function(_0xefbeb6){return this[_0xd4fe('0x11')](_0xd4fe('0x12'));}},'alias':{'type':Sequelize[_0xd4fe('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc54b=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports'];(function(_0x2fb22b,_0xa4226e){var _0x14f065=function(_0xd38b43){while(--_0xd38b43){_0x2fb22b['push'](_0x2fb22b['shift']());}};_0x14f065(++_0xa4226e);}(_0xc54b,0x1b3));var _0xbc54=function(_0x3f2720,_0x39be17){_0x3f2720=_0x3f2720-0x0;var _0xe90c23=_0xc54b[_0x3f2720];return _0xe90c23;};'use strict';var Sequelize=require(_0xbc54('0x0'));module[_0xbc54('0x1')]={'context':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'unique':_0xbc54('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'defaultValue':_0xbc54('0x4')},'appdata':{'type':Sequelize[_0xbc54('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbc54('0x5')](_0xbc54('0x6'),_0xbc54('0x7'),_0xbc54('0x8'),_0xbc54('0x9'),_0xbc54('0xa'),_0xbc54('0xb'),_0xbc54('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xbc54('0x2')]},'interval':{'type':Sequelize[_0xbc54('0x2')],'allowNull':![],'defaultValue':_0xbc54('0xd')},'IntervalId':{'type':Sequelize[_0xbc54('0xe')]},'isApp':{'type':Sequelize[_0xbc54('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbc54('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbc54('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xbc54('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbc54('0xe')]},'recordingFormat':{'type':Sequelize[_0xbc54('0x2')],'defaultValue':_0xbc54('0x10')},'answer':{'type':Sequelize[_0xbc54('0xf')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1e3747){return this[_0xbc54('0x11')](_0xbc54('0x12'));}},'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 87d6dbd..dfd1ab4 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 _0x662f=['findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','set','json','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','destroy','error','send','VoiceExtension','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','limit','order','sort','where','VIRTUAL','merge','include','findAll','rows','catch','params','fields','length','includeAll','create','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x662f,0x64));var _0xf662=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x662f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf662('0x0'));var Redis=require(_0xf662('0x1'));var qs=require(_0xf662('0x2'));var logger=require(_0xf662('0x3'))('api');var config=require(_0xf662('0x4'));var db=require(_0xf662('0x5'))['db'];config[_0xf662('0x6')]=_[_0xf662('0x7')](config[_0xf662('0x6')],{'host':_0xf662('0x8'),'port':0x18eb});var socket=require(_0xf662('0x9'))(new Redis(config[_0xf662('0x6')]));require(_0xf662('0xa'))[_0xf662('0xb')](socket);function respondWithStatusCode(_0x3accd6,_0x29d4ab){_0x29d4ab=_0x29d4ab||0xcc;return function(_0x17d05e){if(_0x17d05e){return _0x3accd6[_0xf662('0xc')](_0x29d4ab);}return _0x3accd6[_0xf662('0xd')](_0x29d4ab)[_0xf662('0xe')]();};}function respondWithResult(_0x56ecb1,_0x510f01){_0x510f01=_0x510f01||0xc8;return function(_0x182a17){if(_0x182a17){return _0x56ecb1[_0xf662('0xd')](_0x510f01)['json'](_0x182a17);}};}function respondWithFilteredResult(_0xcbebb3,_0x4045ef){return function(_0x37fb7f){if(_0x37fb7f){var _0x2741db=typeof _0x4045ef[_0xf662('0xf')]==='undefined'&&typeof _0x4045ef['limit']===_0xf662('0x10');var _0x4fe01b=_0x37fb7f['count'];var _0x1a4f71=_0x2741db?0x0:_0x4045ef[_0xf662('0xf')];var _0x3022e4=_0x2741db?_0x37fb7f[_0xf662('0x11')]:_0x4045ef[_0xf662('0xf')]+_0x4045ef['limit'];var _0x276c95;if(_0x3022e4>=_0x4fe01b){_0x3022e4=_0x4fe01b;_0x276c95=0xc8;}else{_0x276c95=0xce;}_0xcbebb3[_0xf662('0xd')](_0x276c95);return _0xcbebb3[_0xf662('0x12')]('Content-Range',_0x1a4f71+'-'+_0x3022e4+'/'+_0x4fe01b)[_0xf662('0x13')](_0x37fb7f);}return null;};}function removeEntity(_0xb68a4c){return function(_0x598fce){if(_0x598fce){return _0x598fce['destroy']()[_0xf662('0x14')](function(){var _0x2bdc30=_0x598fce[_0xf662('0x15')]({'plain':!![]});var _0x37e32e=[{'name':_0xf662('0x16'),'value':_0xf662('0x17'),'ignore':![]},{'name':_0xf662('0x18'),'value':'outbound','ignore':![]},{'name':_0xf662('0x19'),'value':_0xf662('0x1a'),'ignore':![]}];var _0x60b6e7=_(_0x37e32e)[_0xf662('0x1b')](_0xf662('0x1c'))[_0xf662('0x1d')](_0xf662('0x1e'))[_0xf662('0x1e')]();if(_[_0xf662('0x1f')](_0x60b6e7,_0x2bdc30['type'])){return;}var _0x17a629=_[_0xf662('0x20')](_0x37e32e,[_0xf662('0x1e'),_0x2bdc30[_0xf662('0x21')]])[_0xf662('0x22')];return db['UserProfileResource'][_0xf662('0x23')]({'where':{'type':_0x17a629,'resourceId':_0x2bdc30['id']}})[_0xf662('0x14')](function(){return _0x598fce;});})['then'](function(){_0xb68a4c[_0xf662('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a8c3){return function(_0x2886b6){if(!_0x2886b6){_0x55a8c3[_0xf662('0xc')](0x194);}return _0x2886b6;};}function handleError(_0x5e85df,_0x2e7f5f){_0x2e7f5f=_0x2e7f5f||0x1f4;return function(_0x4f29b9){logger[_0xf662('0x24')](_0x4f29b9['stack']);if(_0x4f29b9[_0xf662('0x22')]){delete _0x4f29b9[_0xf662('0x22')];}_0x5e85df['status'](_0x2e7f5f)[_0xf662('0x25')](_0x4f29b9);};}exports['index']=function(_0x318f45,_0x33be1b){var _0x3ed5cd={},_0x3caf46={},_0x1a61e4={'count':0x0,'rows':[]};var _0x25873f=_[_0xf662('0x1d')](db[_0xf662('0x26')][_0xf662('0x27')],function(_0x4da245){return{'name':_0x4da245[_0xf662('0x28')],'type':_0x4da245['type'][_0xf662('0x29')]};});_0x3caf46['model']=_['map'](_0x25873f,_0xf662('0x22'));_0x3caf46[_0xf662('0x2a')]=_[_0xf662('0x2b')](_0x318f45[_0xf662('0x2a')]);_0x3caf46[_0xf662('0x2c')]=_[_0xf662('0x2d')](_0x3caf46[_0xf662('0x2e')],_0x3caf46[_0xf662('0x2a')]);_0x3ed5cd[_0xf662('0x2f')]=_[_0xf662('0x2d')](_0x3caf46[_0xf662('0x2e')],qs['fields'](_0x318f45[_0xf662('0x2a')]['fields']));_0x3ed5cd[_0xf662('0x2f')]=_0x3ed5cd[_0xf662('0x2f')]['length']?_0x3ed5cd[_0xf662('0x2f')]:_0x3caf46[_0xf662('0x2e')];if(!_0x318f45['query'][_0xf662('0x30')]('nolimit')){_0x3ed5cd['limit']=qs[_0xf662('0x31')](_0x318f45[_0xf662('0x2a')][_0xf662('0x31')]);_0x3ed5cd['offset']=qs[_0xf662('0xf')](_0x318f45[_0xf662('0x2a')][_0xf662('0xf')]);}_0x3ed5cd[_0xf662('0x32')]=qs[_0xf662('0x33')](_0x318f45['query'][_0xf662('0x33')]);_0x3ed5cd['where']=qs[_0xf662('0x2c')](_['pick'](_0x318f45[_0xf662('0x2a')],_0x3caf46[_0xf662('0x2c')]),_0x25873f);if(_0x318f45['query'][_0xf662('0x1b')]){_0x3ed5cd[_0xf662('0x34')]=_['merge'](_0x3ed5cd[_0xf662('0x34')],{'$or':_[_0xf662('0x1d')](_0x25873f,function(_0x50855d){if(_0x50855d['type']!==_0xf662('0x35')){var _0x5e498a={};_0x5e498a[_0x50855d[_0xf662('0x22')]]={'$like':'%'+_0x318f45['query'][_0xf662('0x1b')]+'%'};return _0x5e498a;}})});}_0x3ed5cd=_[_0xf662('0x36')]({},_0x3ed5cd,_0x318f45['options']);var _0x4c8c8a={'where':_0x3ed5cd['where']};return db[_0xf662('0x26')][_0xf662('0x11')](_0x4c8c8a)[_0xf662('0x14')](function(_0x1d0b71){_0x1a61e4[_0xf662('0x11')]=_0x1d0b71;if(_0x318f45[_0xf662('0x2a')]['includeAll']){_0x3ed5cd[_0xf662('0x37')]=[{'all':!![]}];}return db[_0xf662('0x26')][_0xf662('0x38')](_0x3ed5cd);})[_0xf662('0x14')](function(_0x1e4603){_0x1a61e4[_0xf662('0x39')]=_0x1e4603;return _0x1a61e4;})['then'](respondWithFilteredResult(_0x33be1b,_0x3ed5cd))[_0xf662('0x3a')](handleError(_0x33be1b,null));};exports['show']=function(_0x1407aa,_0xf32d4c){var _0x4ff601={'raw':![],'where':{'id':_0x1407aa[_0xf662('0x3b')]['id']}},_0x596157={};_0x596157[_0xf662('0x2e')]=_[_0xf662('0x2b')](db[_0xf662('0x26')][_0xf662('0x27')]);_0x596157[_0xf662('0x2a')]=_[_0xf662('0x2b')](_0x1407aa[_0xf662('0x2a')]);_0x596157['filters']=_[_0xf662('0x2d')](_0x596157[_0xf662('0x2e')],_0x596157[_0xf662('0x2a')]);_0x4ff601['attributes']=_[_0xf662('0x2d')](_0x596157[_0xf662('0x2e')],qs['fields'](_0x1407aa[_0xf662('0x2a')][_0xf662('0x3c')]));_0x4ff601['attributes']=_0x4ff601['attributes'][_0xf662('0x3d')]?_0x4ff601[_0xf662('0x2f')]:_0x596157[_0xf662('0x2e')];if(_0x1407aa['query'][_0xf662('0x3e')]){_0x4ff601['include']=[{'all':!![]}];}_0x4ff601=_['merge']({},_0x4ff601,_0x1407aa['options']);return db[_0xf662('0x26')][_0xf662('0x20')](_0x4ff601)[_0xf662('0x14')](handleEntityNotFound(_0xf32d4c,null))[_0xf662('0x14')](respondWithResult(_0xf32d4c,null))[_0xf662('0x3a')](handleError(_0xf32d4c,null));};exports['destroy']=function(_0x402ace,_0x2c03a3){return db[_0xf662('0x26')][_0xf662('0x20')]({'where':{'id':_0x402ace[_0xf662('0x3b')]['id']}})[_0xf662('0x14')](handleEntityNotFound(_0x2c03a3,null))[_0xf662('0x14')](removeEntity(_0x2c03a3,null))[_0xf662('0x3a')](handleError(_0x2c03a3,null));};exports[_0xf662('0x3f')]=function(_0x1beac1,_0x2d6dc6){if(_0x1beac1[_0xf662('0x40')][_0xf662('0x21')]===_0xf662('0x41')&&!_['startsWith'](_0x1beac1[_0xf662('0x40')]['exten'],'_')){_0x1beac1[_0xf662('0x40')][_0xf662('0x42')]='_'[_0xf662('0x43')](_0x1beac1[_0xf662('0x40')][_0xf662('0x42')]);}return db[_0xf662('0x26')]['create'](_0x1beac1[_0xf662('0x40')],{'raw':![]})['then'](function(_0x4fafba){var _0x34b273=_0x1beac1[_0xf662('0x44')]['get']({'plain':!![]});if(!_0x34b273)throw new Error(_0xf662('0x45'));if(_0x34b273[_0xf662('0x46')]==='user'){var _0x11277b=_0x4fafba[_0xf662('0x15')]({'plain':!![]});var _0x5720c0=[{'name':_0xf662('0x16'),'value':_0xf662('0x17')},{'name':'OutboundRoutes','value':_0xf662('0x41')},{'name':'InternalRoutes','value':'internal'}];var _0x2187a8=_[_0xf662('0x20')](_0x5720c0,['value',_0x11277b[_0xf662('0x21')]])['name'];return db['UserProfileSection'][_0xf662('0x20')]({'where':{'name':_0x2187a8,'userProfileId':_0x34b273[_0xf662('0x47')]},'raw':!![]})[_0xf662('0x14')](function(_0x49c62d){if(_0x49c62d&&_0x49c62d[_0xf662('0x48')]===0x0){return db[_0xf662('0x49')][_0xf662('0x3f')]({'name':_0x11277b[_0xf662('0x22')],'resourceId':_0x11277b['id'],'type':_0x49c62d[_0xf662('0x22')],'sectionId':_0x49c62d['id']},{})['then'](function(){return _0x4fafba;});}else{return _0x4fafba;}})[_0xf662('0x3a')](function(_0x57161a){logger[_0xf662('0x24')](_0xf662('0x4a'),_0x57161a);throw _0x57161a;});}return _0x4fafba;})[_0xf662('0x14')](respondWithResult(_0x2d6dc6,0xc9))['catch'](handleError(_0x2d6dc6,null));};exports[_0xf662('0x4b')]=function(_0x1ebef4,_0x5c509c){if(_0x1ebef4[_0xf662('0x40')]['id']){delete _0x1ebef4[_0xf662('0x40')]['id'];}return db[_0xf662('0x26')]['find']({'where':{'id':_0x1ebef4['params']['id']}})['then'](handleEntityNotFound(_0x5c509c,null))[_0xf662('0x14')](function(_0x507b48){if(_0x507b48){return db['VoiceExtension']['update'](_[_0xf662('0x4c')](_0x1ebef4[_0xf662('0x40')],[_0xf662('0x42'),_0xf662('0x4d'),_0xf662('0x4e'),_0xf662('0x4f'),'cutdigits',_0xf662('0x50'),_0xf662('0x51')]),{'where':{'context':_0x507b48[_0xf662('0x4d')],'exten':_0x507b48[_0xf662('0x42')]},'individualHooks':!![]})[_0xf662('0x14')](function(_0x35ed2a){return _0x35ed2a;});}return null;})[_0xf662('0x14')](respondWithStatusCode(_0x5c509c,null))[_0xf662('0x3a')](handleError(_0x5c509c,null));};exports[_0xf662('0x52')]=function(_0x48398c,_0x9824fc){var _0x2f2bdf=_0x48398c[_0xf662('0x3b')]['id'];var _0x4b6d27=_0x48398c[_0xf662('0x40')];var _0x5b8c38=0xc8;var _0x55570e=null;return db[_0xf662('0x53')][_0xf662('0x54')]({'isolationLevel':db[_0xf662('0x53')]['Transaction'][_0xf662('0x55')][_0xf662('0x56')]},function(_0x4e9c69){return db['VoiceExtension'][_0xf662('0x57')]({'where':{'id':_0x2f2bdf},'transaction':_0x4e9c69})['then'](function(_0x5f314f){if(_0x5f314f){return db[_0xf662('0x26')]['destroy']({'where':{'VoiceExtensionId':_0x2f2bdf},'transaction':_0x4e9c69})['then'](function(){var _0x1f696a=_['map'](_0x4b6d27,function(_0x3b5b46){_0x3b5b46[_0xf662('0x58')]=_0x2f2bdf;_0x3b5b46[_0xf662('0x59')]=!![];return _0x3b5b46;});return _0x5f314f[_0xf662('0x5a')](_0x1f696a);})[_0xf662('0x14')](function(_0x4b96f7){return db['VoiceExtension'][_0xf662('0x5b')](_0x4b96f7,{'transaction':_0x4e9c69});});}else{_0x5b8c38=0x194;_0x55570e=[];}});})[_0xf662('0x14')](function(){if(_0x5b8c38!==0x194){return db[_0xf662('0x26')][_0xf662('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2f2bdf},'order':_0xf662('0x5d')})[_0xf662('0x14')](function(_0x34600e){_0x55570e=_0x34600e;});}})[_0xf662('0x3a')](function(_0x171db3){_0x5b8c38=0x1f4;logger[_0xf662('0x24')](_0x171db3[_0xf662('0x5e')]);if(_0x171db3['name']){delete _0x171db3[_0xf662('0x22')];}_0x55570e=_0x171db3;})[_0xf662('0x5f')](function(){if(_0x55570e===null){_0x9824fc[_0xf662('0xc')](_0x5b8c38);}else{if(_0x5b8c38===0x1f4){_0x9824fc[_0xf662('0xd')](_0x5b8c38)[_0xf662('0x25')](_0x55570e);}else{_0x9824fc[_0xf662('0xd')](_0x5b8c38)[_0xf662('0x13')](_0x55570e);}}});}; \ No newline at end of file +var _0x3516=['include','find','body','outbound','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','json','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','VoiceExtension','findAll','rows','catch','params'];(function(_0x94e6ab,_0x1452b8){var _0x2d3bd8=function(_0x4e108b){while(--_0x4e108b){_0x94e6ab['push'](_0x94e6ab['shift']());}};_0x2d3bd8(++_0x1452b8);}(_0x3516,0x192));var _0x6351=function(_0x61cae1,_0x28f2ba){_0x61cae1=_0x61cae1-0x0;var _0x332856=_0x3516[_0x61cae1];return _0x332856;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x6351('0x0'));var logger=require('../../config/logger')(_0x6351('0x1'));var config=require('../../config/environment');var db=require(_0x6351('0x2'))['db'];config[_0x6351('0x3')]=_[_0x6351('0x4')](config['redis'],{'host':_0x6351('0x5'),'port':0x18eb});var socket=require(_0x6351('0x6'))(new Redis(config[_0x6351('0x3')]));require(_0x6351('0x7'))[_0x6351('0x8')](socket);function respondWithStatusCode(_0x297fdd,_0x1f48ca){_0x1f48ca=_0x1f48ca||0xcc;return function(_0x374656){if(_0x374656){return _0x297fdd[_0x6351('0x9')](_0x1f48ca);}return _0x297fdd[_0x6351('0xa')](_0x1f48ca)[_0x6351('0xb')]();};}function respondWithResult(_0x9b850b,_0x3f3610){_0x3f3610=_0x3f3610||0xc8;return function(_0x1ff4de){if(_0x1ff4de){return _0x9b850b[_0x6351('0xa')](_0x3f3610)['json'](_0x1ff4de);}};}function respondWithFilteredResult(_0x321e16,_0x25d2ac){return function(_0x1ef8d4){if(_0x1ef8d4){var _0x17eee7=typeof _0x25d2ac[_0x6351('0xc')]===_0x6351('0xd')&&typeof _0x25d2ac['limit']===_0x6351('0xd');var _0x4f3267=_0x1ef8d4[_0x6351('0xe')];var _0x52b625=_0x17eee7?0x0:_0x25d2ac[_0x6351('0xc')];var _0x302b9a=_0x17eee7?_0x1ef8d4[_0x6351('0xe')]:_0x25d2ac[_0x6351('0xc')]+_0x25d2ac['limit'];var _0xcd4610;if(_0x302b9a>=_0x4f3267){_0x302b9a=_0x4f3267;_0xcd4610=0xc8;}else{_0xcd4610=0xce;}_0x321e16[_0x6351('0xa')](_0xcd4610);return _0x321e16[_0x6351('0xf')](_0x6351('0x10'),_0x52b625+'-'+_0x302b9a+'/'+_0x4f3267)['json'](_0x1ef8d4);}return null;};}function removeEntity(_0x216b10){return function(_0x58461c){if(_0x58461c){return _0x58461c[_0x6351('0x11')]()[_0x6351('0x12')](function(){var _0x311d84=_0x58461c[_0x6351('0x13')]({'plain':!![]});var _0x3e6de8=[{'name':_0x6351('0x14'),'value':_0x6351('0x15'),'ignore':![]},{'name':_0x6351('0x16'),'value':'outbound','ignore':![]},{'name':_0x6351('0x17'),'value':_0x6351('0x18'),'ignore':![]}];var _0x2d786f=_(_0x3e6de8)[_0x6351('0x19')](_0x6351('0x1a'))[_0x6351('0x1b')](_0x6351('0x1c'))[_0x6351('0x1c')]();if(_[_0x6351('0x1d')](_0x2d786f,_0x311d84[_0x6351('0x1e')])){return;}var _0x24cb02=_['find'](_0x3e6de8,['value',_0x311d84[_0x6351('0x1e')]])[_0x6351('0x1f')];return db[_0x6351('0x20')][_0x6351('0x11')]({'where':{'type':_0x24cb02,'resourceId':_0x311d84['id']}})[_0x6351('0x12')](function(){return _0x58461c;});})['then'](function(){_0x216b10['status'](0xcc)[_0x6351('0xb')]();});}};}function handleEntityNotFound(_0x5cd02d){return function(_0x11b611){if(!_0x11b611){_0x5cd02d['sendStatus'](0x194);}return _0x11b611;};}function handleError(_0x2ece17,_0x5ed477){_0x5ed477=_0x5ed477||0x1f4;return function(_0x4ec370){logger[_0x6351('0x21')](_0x4ec370[_0x6351('0x22')]);if(_0x4ec370[_0x6351('0x1f')]){delete _0x4ec370[_0x6351('0x1f')];}_0x2ece17[_0x6351('0xa')](_0x5ed477)[_0x6351('0x23')](_0x4ec370);};}exports['index']=function(_0x3943ba,_0x3a69c2){var _0x5bdcb7={},_0xe17ac={},_0x495975={'count':0x0,'rows':[]};var _0xc0d0e3=_[_0x6351('0x1b')](db['VoiceExtension'][_0x6351('0x24')],function(_0x413fcf){return{'name':_0x413fcf[_0x6351('0x25')],'type':_0x413fcf[_0x6351('0x1e')][_0x6351('0x26')]};});_0xe17ac['model']=_[_0x6351('0x1b')](_0xc0d0e3,_0x6351('0x1f'));_0xe17ac[_0x6351('0x27')]=_[_0x6351('0x28')](_0x3943ba[_0x6351('0x27')]);_0xe17ac[_0x6351('0x29')]=_[_0x6351('0x2a')](_0xe17ac[_0x6351('0x2b')],_0xe17ac[_0x6351('0x27')]);_0x5bdcb7['attributes']=_[_0x6351('0x2a')](_0xe17ac[_0x6351('0x2b')],qs[_0x6351('0x2c')](_0x3943ba['query']['fields']));_0x5bdcb7['attributes']=_0x5bdcb7[_0x6351('0x2d')][_0x6351('0x2e')]?_0x5bdcb7[_0x6351('0x2d')]:_0xe17ac[_0x6351('0x2b')];if(!_0x3943ba[_0x6351('0x27')][_0x6351('0x2f')](_0x6351('0x30'))){_0x5bdcb7['limit']=qs[_0x6351('0x31')](_0x3943ba['query'][_0x6351('0x31')]);_0x5bdcb7[_0x6351('0xc')]=qs['offset'](_0x3943ba[_0x6351('0x27')]['offset']);}_0x5bdcb7[_0x6351('0x32')]=qs[_0x6351('0x33')](_0x3943ba[_0x6351('0x27')][_0x6351('0x33')]);_0x5bdcb7[_0x6351('0x34')]=qs[_0x6351('0x29')](_[_0x6351('0x35')](_0x3943ba[_0x6351('0x27')],_0xe17ac[_0x6351('0x29')]),_0xc0d0e3);if(_0x3943ba[_0x6351('0x27')][_0x6351('0x19')]){_0x5bdcb7[_0x6351('0x34')]=_[_0x6351('0x36')](_0x5bdcb7[_0x6351('0x34')],{'$or':_[_0x6351('0x1b')](_0xc0d0e3,function(_0x15370d){if(_0x15370d[_0x6351('0x1e')]!==_0x6351('0x37')){var _0x2a735b={};_0x2a735b[_0x15370d['name']]={'$like':'%'+_0x3943ba['query']['filter']+'%'};return _0x2a735b;}})});}_0x5bdcb7=_['merge']({},_0x5bdcb7,_0x3943ba[_0x6351('0x38')]);var _0x28df48={'where':_0x5bdcb7['where']};return db['VoiceExtension'][_0x6351('0xe')](_0x28df48)[_0x6351('0x12')](function(_0x54cdf8){_0x495975[_0x6351('0xe')]=_0x54cdf8;if(_0x3943ba[_0x6351('0x27')][_0x6351('0x39')]){_0x5bdcb7['include']=[{'all':!![]}];}return db[_0x6351('0x3a')][_0x6351('0x3b')](_0x5bdcb7);})['then'](function(_0x389ab8){_0x495975[_0x6351('0x3c')]=_0x389ab8;return _0x495975;})[_0x6351('0x12')](respondWithFilteredResult(_0x3a69c2,_0x5bdcb7))[_0x6351('0x3d')](handleError(_0x3a69c2,null));};exports['show']=function(_0x51d807,_0x235d35){var _0x24ac70={'raw':![],'where':{'id':_0x51d807[_0x6351('0x3e')]['id']}},_0x282ec5={};_0x282ec5[_0x6351('0x2b')]=_[_0x6351('0x28')](db[_0x6351('0x3a')][_0x6351('0x24')]);_0x282ec5['query']=_[_0x6351('0x28')](_0x51d807[_0x6351('0x27')]);_0x282ec5[_0x6351('0x29')]=_[_0x6351('0x2a')](_0x282ec5[_0x6351('0x2b')],_0x282ec5[_0x6351('0x27')]);_0x24ac70[_0x6351('0x2d')]=_['intersection'](_0x282ec5[_0x6351('0x2b')],qs[_0x6351('0x2c')](_0x51d807[_0x6351('0x27')][_0x6351('0x2c')]));_0x24ac70[_0x6351('0x2d')]=_0x24ac70[_0x6351('0x2d')][_0x6351('0x2e')]?_0x24ac70[_0x6351('0x2d')]:_0x282ec5[_0x6351('0x2b')];if(_0x51d807['query'][_0x6351('0x39')]){_0x24ac70[_0x6351('0x3f')]=[{'all':!![]}];}_0x24ac70=_[_0x6351('0x36')]({},_0x24ac70,_0x51d807[_0x6351('0x38')]);return db['VoiceExtension'][_0x6351('0x40')](_0x24ac70)['then'](handleEntityNotFound(_0x235d35,null))['then'](respondWithResult(_0x235d35,null))[_0x6351('0x3d')](handleError(_0x235d35,null));};exports[_0x6351('0x11')]=function(_0x438d9b,_0x5aba1d){return db['VoiceExtension'][_0x6351('0x40')]({'where':{'id':_0x438d9b['params']['id']}})[_0x6351('0x12')](handleEntityNotFound(_0x5aba1d,null))[_0x6351('0x12')](removeEntity(_0x5aba1d,null))[_0x6351('0x3d')](handleError(_0x5aba1d,null));};exports['create']=function(_0x1d80fe,_0x13b066){if(_0x1d80fe[_0x6351('0x41')][_0x6351('0x1e')]===_0x6351('0x42')&&!_[_0x6351('0x43')](_0x1d80fe[_0x6351('0x41')][_0x6351('0x44')],'_')){_0x1d80fe[_0x6351('0x41')][_0x6351('0x44')]='_'[_0x6351('0x45')](_0x1d80fe[_0x6351('0x41')][_0x6351('0x44')]);}return db[_0x6351('0x3a')][_0x6351('0x46')](_0x1d80fe['body'],{'raw':![]})[_0x6351('0x12')](function(_0x1564cd){var _0x271bb9=_0x1d80fe['user'][_0x6351('0x13')]({'plain':!![]});if(!_0x271bb9)throw new Error(_0x6351('0x47'));if(_0x271bb9['role']==='user'){var _0xcb4141=_0x1564cd[_0x6351('0x13')]({'plain':!![]});var _0x3b5748=[{'name':_0x6351('0x14'),'value':'inbound'},{'name':_0x6351('0x16'),'value':_0x6351('0x42')},{'name':_0x6351('0x17'),'value':_0x6351('0x18')}];var _0x8ca11a=_[_0x6351('0x40')](_0x3b5748,[_0x6351('0x1c'),_0xcb4141[_0x6351('0x1e')]])['name'];return db['UserProfileSection'][_0x6351('0x40')]({'where':{'name':_0x8ca11a,'userProfileId':_0x271bb9[_0x6351('0x48')]},'raw':!![]})[_0x6351('0x12')](function(_0x557c13){if(_0x557c13&&_0x557c13[_0x6351('0x49')]===0x0){return db['UserProfileResource'][_0x6351('0x46')]({'name':_0xcb4141['name'],'resourceId':_0xcb4141['id'],'type':_0x557c13[_0x6351('0x1f')],'sectionId':_0x557c13['id']},{})[_0x6351('0x12')](function(){return _0x1564cd;});}else{return _0x1564cd;}})['catch'](function(_0x55056d){logger[_0x6351('0x21')](_0x6351('0x4a'),_0x55056d);throw _0x55056d;});}return _0x1564cd;})[_0x6351('0x12')](respondWithResult(_0x13b066,0xc9))['catch'](handleError(_0x13b066,null));};exports['update']=function(_0x46b516,_0x297dcf){if(_0x46b516['body']['id']){delete _0x46b516[_0x6351('0x41')]['id'];}return db[_0x6351('0x3a')][_0x6351('0x40')]({'where':{'id':_0x46b516[_0x6351('0x3e')]['id']}})[_0x6351('0x12')](handleEntityNotFound(_0x297dcf,null))['then'](function(_0x1c368a){if(_0x1c368a){return db['VoiceExtension']['update'](_[_0x6351('0x35')](_0x46b516[_0x6351('0x41')],[_0x6351('0x44'),_0x6351('0x4b'),'description',_0x6351('0x4c'),_0x6351('0x4d'),_0x6351('0x4e'),_0x6351('0x4f')]),{'where':{'context':_0x1c368a['context'],'exten':_0x1c368a['exten']},'individualHooks':!![]})[_0x6351('0x12')](function(_0x193f91){return _0x193f91;});}return null;})['then'](respondWithStatusCode(_0x297dcf,null))[_0x6351('0x3d')](handleError(_0x297dcf,null));};exports[_0x6351('0x50')]=function(_0x3acc34,_0x1ee3a4){var _0xde5ffa=_0x3acc34[_0x6351('0x3e')]['id'];var _0x2601e8=_0x3acc34[_0x6351('0x41')];var _0x29c6d6=0xc8;var _0x3eb7da=null;return db[_0x6351('0x51')][_0x6351('0x52')]({'isolationLevel':db[_0x6351('0x51')][_0x6351('0x53')][_0x6351('0x54')]['READ_COMMITTED']},function(_0xe3a878){return db['VoiceExtension'][_0x6351('0x55')]({'where':{'id':_0xde5ffa},'transaction':_0xe3a878})[_0x6351('0x12')](function(_0x568aa2){if(_0x568aa2){return db[_0x6351('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0xde5ffa},'transaction':_0xe3a878})[_0x6351('0x12')](function(){var _0x422842=_[_0x6351('0x1b')](_0x2601e8,function(_0xeaa299){_0xeaa299[_0x6351('0x56')]=_0xde5ffa;_0xeaa299[_0x6351('0x57')]=!![];return _0xeaa299;});return _0x568aa2[_0x6351('0x58')](_0x422842);})[_0x6351('0x12')](function(_0x33cece){return db['VoiceExtension'][_0x6351('0x59')](_0x33cece,{'transaction':_0xe3a878});});}else{_0x29c6d6=0x194;_0x3eb7da=[];}});})[_0x6351('0x12')](function(){if(_0x29c6d6!==0x194){return db['VoiceExtension'][_0x6351('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0xde5ffa},'order':_0x6351('0x5b')})['then'](function(_0x20fec1){_0x3eb7da=_0x20fec1;});}})[_0x6351('0x3d')](function(_0x1770c5){_0x29c6d6=0x1f4;logger[_0x6351('0x21')](_0x1770c5[_0x6351('0x22')]);if(_0x1770c5[_0x6351('0x1f')]){delete _0x1770c5[_0x6351('0x1f')];}_0x3eb7da=_0x1770c5;})['finally'](function(){if(_0x3eb7da===null){_0x1ee3a4[_0x6351('0x9')](_0x29c6d6);}else{if(_0x29c6d6===0x1f4){_0x1ee3a4[_0x6351('0xa')](_0x29c6d6)['send'](_0x3eb7da);}else{_0x1ee3a4[_0x6351('0xa')](_0x29c6d6)[_0x6351('0x5c')](_0x3eb7da);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 32d4f1d..76c265a 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 _0xae21=['save','update','remove','emit','hook','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x5131f0,_0x5039ef){var _0x29d526=function(_0x42ff27){while(--_0x42ff27){_0x5131f0['push'](_0x5131f0['shift']());}};_0x29d526(++_0x5039ef);}(_0xae21,0xf8));var _0x1ae2=function(_0x55ed1c,_0x3a7fbf){_0x55ed1c=_0x55ed1c-0x0;var _0x2b2426=_0xae21[_0x55ed1c];return _0x2b2426;};'use strict';var EventEmitter=require(_0x1ae2('0x0'));var VoiceExtension=require(_0x1ae2('0x1'))['db'][_0x1ae2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1ae2('0x3')](0x0);var events={'afterCreate':_0x1ae2('0x4'),'afterUpdate':_0x1ae2('0x5'),'afterDestroy':_0x1ae2('0x6')};function emitEvent(_0x33dd10){return function(_0x10bfc0,_0xb5bc05,_0x355d4c){VoiceExtensionEvents[_0x1ae2('0x7')](_0x33dd10+':'+_0x10bfc0['id'],_0x10bfc0);VoiceExtensionEvents['emit'](_0x33dd10,_0x10bfc0);_0x355d4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x1ae2('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xfe8c=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x5888df,_0x3f850b){var _0x5e6e4b=function(_0x5ac069){while(--_0x5ac069){_0x5888df['push'](_0x5888df['shift']());}};_0x5e6e4b(++_0x3f850b);}(_0xfe8c,0x8c));var _0xcfe8=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xfe8c[_0x18f64a];return _0x44687f;};'use strict';var EventEmitter=require(_0xcfe8('0x0'));var VoiceExtension=require(_0xcfe8('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcfe8('0x2')](0x0);var events={'afterCreate':_0xcfe8('0x3'),'afterUpdate':_0xcfe8('0x4'),'afterDestroy':_0xcfe8('0x5')};function emitEvent(_0x44c045){return function(_0x6e802e,_0x3d9f8e,_0x473441){VoiceExtensionEvents[_0xcfe8('0x6')](_0x44c045+':'+_0x6e802e['id'],_0x6e802e);VoiceExtensionEvents['emit'](_0x44c045,_0x6e802e);_0x473441(null);};}for(var e in events){if(events[_0xcfe8('0x7')](e)){var event=events[e];VoiceExtension[_0xcfe8('0x8')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index cea03f9..9dad80f 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 _0xf698=['No\x20alias\x20set','context','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','Set','exten','type','alias','NoOp','CDR(routeAlias)='];(function(_0x588644,_0x27dba7){var _0x1974e0=function(_0x5a3f95){while(--_0x5a3f95){_0x588644['push'](_0x588644['shift']());}};_0x1974e0(++_0x27dba7);}(_0xf698,0x1de));var _0x8f69=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xf698[_0x319cb9];return _0x1735fc;};'use strict';var _=require(_0x8f69('0x0'));var attributes=require(_0x8f69('0x1'));module['exports']=function(_0x1d6ed2){var _0x1f7a66=_0x1d6ed2['models'];function _0x4321fe(_0x220362){var _0x83c2db=0x2;var _0x355676=[{'type':_0x220362['type'],'app':_0x8f69('0x2'),'appdata':'CDR(type)='+_0x220362['type'],'context':_0x220362['context'],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362[_0x8f69('0x4')],'app':_0x220362[_0x8f69('0x5')]?_0x8f69('0x2'):_0x8f69('0x6'),'appdata':_0x220362[_0x8f69('0x5')]?_0x8f69('0x7')+_0x220362[_0x8f69('0x5')]:_0x8f69('0x8'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']}];if(_0x220362[_0x8f69('0x4')]==='inbound'){_0x355676[_0x8f69('0xa')]({'type':'inbound','app':_0x8f69('0x2'),'appdata':'CDR(routeid)='+_0x220362['id'],'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362['exten'],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']});}_0x355676[_0x8f69('0xa')]({'type':_0x220362[_0x8f69('0x4')],'app':_0x8f69('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x220362['context'],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362[_0x8f69('0x4')],'app':'Set','appdata':_0x8f69('0xb'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362[_0x8f69('0x3')],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']},{'type':_0x220362['type'],'app':_0x8f69('0x2'),'appdata':_0x8f69('0xc'),'context':_0x220362[_0x8f69('0x9')],'exten':_0x220362['exten'],'priority':_0x83c2db++,'VoiceExtensionId':_0x220362['id']});return _0x355676;}function _0x2aa302(_0x143318){var _0x29a6a6=0x2;var _0x35569d=[{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':'CDR(type)=outbound','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x143318[_0x8f69('0x5')]?'Set':_0x8f69('0x6'),'appdata':_0x143318[_0x8f69('0x5')]?'CDR(routeAlias)='+_0x143318[_0x8f69('0x5')]:_0x8f69('0x8'),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0xe')+(_0x143318[_0x8f69('0xf')]?_0x8f69('0x10')+_0x143318['cutdigits']+'}':_0x8f69('0x11')),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':'outbound','app':_0x8f69('0x2'),'appdata':'CDR(routeid)='+_0x143318['id'],'context':_0x143318['context'],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x13')+(_0x29a6a6+0x2)+'):Goto('+(_0x29a6a6+0x1)+')','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x143318['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x143318[_0x8f69('0xf')]+'}':_0x8f69('0x14'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':'Set','appdata':_0x8f69('0x15'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0xc'),'context':_0x143318['context'],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':_0x8f69('0xd'),'app':_0x8f69('0x2'),'appdata':_0x8f69('0x16')+_0x143318['id'],'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318['exten'],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']}];if(_0x143318[_0x8f69('0x17')](_0x8f69('0x18'))&&_0x143318[_0x8f69('0x18')]!==_0x8f69('0x19')){_0x35569d[_0x8f69('0xa')]({'type':'outbound','app':_0x8f69('0x2'),'appdata':_0x8f69('0x1a'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']},{'type':'outbound','app':_0x8f69('0x2'),'appdata':_0x8f69('0x1b')+_0x143318[_0x8f69('0x18')]||_0x8f69('0x1c'),'context':_0x143318[_0x8f69('0x9')],'exten':_0x143318[_0x8f69('0x3')],'priority':_0x29a6a6++,'VoiceExtensionId':_0x143318['id']});}return _0x35569d;}function _0x510337(_0x276a1b,_0x4c9c40){var _0x363cf2=[{'name':_0x8f69('0x1d'),'param':0x0},{'name':_0x8f69('0x1e'),'param':0x1},{'name':_0x8f69('0x1f'),'param':0x2},{'name':_0x8f69('0x20'),'param':0x3}];var _0x53f7f0={};var _0x50c29c=_0x4c9c40['split'](',');var _0x4d1a84=[];for(var _0x4e7fff=0x0;_0x4e7fff<_0x363cf2[_0x8f69('0x21')];_0x4e7fff++){switch(_0x363cf2[_0x4e7fff][_0x8f69('0x22')]){case _0x8f69('0x1d'):_0x53f7f0[_0x8f69('0x1d')]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]][_0x8f69('0x24')]('/')[0x1];_0x53f7f0['phone']=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]][_0x8f69('0x24')]('/')[0x2];_0x53f7f0[_0x8f69('0x25')]=_0x53f7f0[_0x8f69('0x26')]?_0x53f7f0['phone'][_0x8f69('0x24')]('$')[0x0]:undefined;_0x53f7f0[_0x8f69('0x26')]=_0x276a1b[_0x8f69('0xf')]?(_0x53f7f0['prefix']||'')+_0x8f69('0x10')+_0x276a1b['cutdigits']+'}':(_0x53f7f0['prefix']||'')+'${EXTEN}';_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=[_0x8f69('0x27'),_0x53f7f0[_0x8f69('0x1d')],_0x53f7f0[_0x8f69('0x26')]][_0x8f69('0x28')]('/');break;case _0x8f69('0x1f'):_0x53f7f0[_0x8f69('0x1f')]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]];if(_0x276a1b[_0x8f69('0x18')]!==_0x8f69('0x19')){if(_0x53f7f0[_0x8f69('0x1f')][_0x8f69('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x53f7f0[_0x8f69('0x1f')]+=_0x8f69('0x2a');}}else{_0x53f7f0[_0x8f69('0x1f')]=_0x53f7f0['options']['replace'](_0x8f69('0x2a'),'');}_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=_0x53f7f0[_0x8f69('0x1f')];break;default:_0x4d1a84[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]]=_0x50c29c[_0x363cf2[_0x4e7fff][_0x8f69('0x23')]];}}return _0x4d1a84[_0x8f69('0x28')](',');}function _0x4966b0(_0x2efe37,_0x27fc64,_0x577e41){return new Promise(function(_0x4297e1,_0x59fb1c){var _0x3bc5a3=[];if(_[_0x8f69('0x2b')](_0x27fc64))return _0x4297e1(_0x3bc5a3);_0x1f7a66[_0x8f69('0x2c')][_0x8f69('0x2d')]({'attributes':['id',_0x8f69('0x2e'),_0x8f69('0x2f')],'raw':!![]})[_0x8f69('0x30')](function(_0x47ae01){for(var _0x3bf6cc=0x0,_0x3d3866=0x0;_0x3bf6cc<_0x27fc64[_0x8f69('0x21')];_0x3bf6cc++,_0x3d3866=0x0){var _0x284fb5=_0x27fc64[_0x3bf6cc];var _0x2caa41=[];var _0x4d41c5=[];delete _0x284fb5['id'];if(_0x284fb5[_0x8f69('0x2e')]!==_0x8f69('0x31')){_0x284fb5[_0x8f69('0x32')]=[_0x284fb5[_0x8f69('0x2e')]];}else{_0x284fb5[_0x8f69('0x32')]=_0x284fb5['IntervalId']?_[_0x8f69('0x33')](_[_0x8f69('0x34')](_0x47ae01,{'IntervalId':_0x284fb5[_0x8f69('0x2f')]}),_0x8f69('0x2e')):[];}_0x284fb5[_0x8f69('0x9')]=_0x2efe37[_0x8f69('0x9')];_0x284fb5[_0x8f69('0x3')]=_0x2efe37[_0x8f69('0x3')];if(_0x284fb5[_0x8f69('0x4')])_0x284fb5[_0x8f69('0x4')]=_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')]();if(_0x2efe37[_0x8f69('0x4')]==='outbound'){if(_0x284fb5[_0x8f69('0x17')]('tag')&&_0x284fb5[_0x8f69('0x36')]&&_0x284fb5[_0x8f69('0x36')]!=='--'){_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':_0x8f69('0x37')+_0x284fb5[_0x8f69('0x36')],'context':_0x2efe37['context'],'exten':_0x2efe37[_0x8f69('0x3')],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}_0x2caa41['push']({'type':_0x284fb5[_0x8f69('0x4')]['toLowerCase'](),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x38')+(_0x284fb5[_0x8f69('0x39')]?_0x8f69('0x3a')+_0x284fb5[_0x8f69('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')]['length']+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}else{if(_0x284fb5[_0x8f69('0x17')](_0x8f69('0x3b'))){if([_0x8f69('0x3c'),_0x8f69('0x3d')][_0x8f69('0x3e')](_0x284fb5[_0x8f69('0x3f')][_0x8f69('0x35')]())&&_0x284fb5[_0x8f69('0x40')]!==_0x8f69('0x41')){if(_0x284fb5[_0x8f69('0x3b')]){_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5['type']['toLowerCase'](),'app':_0x8f69('0x12'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37[_0x8f69('0x3')],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}else{_0x2caa41['push']({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':_0x8f69('0x12'),'appdata':_0x8f69('0x42'),'context':_0x2efe37[_0x8f69('0x9')],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});_0x2caa41[_0x8f69('0xa')]({'type':_0x284fb5[_0x8f69('0x4')][_0x8f69('0x35')](),'app':'Set','appdata':_0x8f69('0x43'),'context':_0x2efe37['context'],'exten':_0x2efe37['exten'],'priority':_0x284fb5[_0x8f69('0x32')][_0x8f69('0x21')]+_0x577e41+_0x3d3866++,'VoiceExtensionId':_0x2efe37['id']});}}}}for(var _0x12333a=0x0;_0x12333a<_0x284fb5[_0x8f69('0x32')]['length'];_0x12333a++){var _0x40b682=_0x577e41+_0x284fb5[_0x8f69('0x32')]['length'];var _0x172e91=_0x12333a===_0x284fb5[_0x8f69('0x32')]['length']-0x1?_0x577e41+_0x2caa41['length']+_0x4d41c5['length']+0x2:_0x577e41+_0x12333a+0x1;_0x2caa41[_0x8f69('0x44')](_0x12333a,0x0,{'type':_0x2efe37[_0x8f69('0x4')],'app':_0x8f69('0x45'),'appdata':_0x284fb5['intervals'][_0x12333a]+'?'+_0x2efe37['context']+',${EXTEN},'+_0x40b682+':'+_0x2efe37[_0x8f69('0x9')]+_0x8f69('0x46')+_0x172e91,'exten':_0x2efe37[_0x8f69('0x3')],'context':_0x2efe37[_0x8f69('0x9')],'priority':_0x577e41+_0x12333a,'VoiceExtensionId':_0x2efe37['id']});}if(_0x284fb5[_0x8f69('0x40')]===_0x8f69('0x47'))_0x284fb5[_0x8f69('0x48')]=_0x510337(_0x2efe37,_0x284fb5['appdata']);_0x284fb5[_0x8f69('0x49')]=_0x2caa41[_0x8f69('0x21')]?_['last'](_0x2caa41)[_0x8f69('0x49')]+0x1:_0x577e41;_0x3bc5a3=_['concat'](_0x3bc5a3,_0x2caa41,[_0x284fb5],_0x4d41c5);_0x577e41=_[_0x8f69('0x4a')](_0x3bc5a3)[_0x8f69('0x49')]+0x1;}return _0x4297e1(_0x3bc5a3);})[_0x8f69('0x4b')](function(_0x4d8228){_0x59fb1c(_0x4d8228);});});}return _0x1d6ed2[_0x8f69('0x4c')](_0x8f69('0x4d'),attributes,{'tableName':_0x8f69('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x420395){var _0x35511f=this['get']({'plain':!![]});var _0x1fbe53=_0x35511f[_0x8f69('0x4')]===_0x8f69('0xd')?_0x2aa302(_0x35511f):_0x4321fe(_0x35511f);return _0x4966b0(_0x35511f,_0x420395,_['last'](_0x1fbe53)[_0x8f69('0x49')]+0x1)[_0x8f69('0x30')](function(_0xe1c45c){var _0x5c1359=_[_0x8f69('0x4f')](_0x1fbe53,_0xe1c45c);_0x5c1359[_0x8f69('0xa')]({'type':_0x35511f['type'],'app':_0x8f69('0x50'),'exten':_0x35511f[_0x8f69('0x3')],'context':_0x35511f[_0x8f69('0x9')],'priority':_[_0x8f69('0x4a')](_0x5c1359)[_0x8f69('0x49')]+0x1,'VoiceExtensionId':_0x35511f['id']});return _0x5c1359;});}}});}; \ No newline at end of file +var _0xbdba=['isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','push','callerID','NoOp(No\x20number\x20available)','answer','includes','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','VoiceExtension','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','NoOp','alias','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(routeAlias)=','No\x20alias\x20set','CDR(destination)=','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','url','split','length','name','trunk','param','phone','prefix','${EXTEN}','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0xbdba,0x107));var _0xabdb=function(_0x42ea21,_0xca32a2){_0x42ea21=_0x42ea21-0x0;var _0x1ac2dc=_0xbdba[_0x42ea21];return _0x1ac2dc;};'use strict';var _=require(_0xabdb('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xabdb('0x1')]=function(_0x3bdc80){var _0x2a00cd=_0x3bdc80[_0xabdb('0x2')];function _0x53185c(_0x2e74a4){var _0x19dab5=0x2;var _0x4f1d59=[{'type':_0x2e74a4[_0xabdb('0x3')],'app':_0xabdb('0x4'),'appdata':_0xabdb('0x5')+_0x2e74a4['type'],'context':_0x2e74a4[_0xabdb('0x6')],'exten':_0x2e74a4[_0xabdb('0x7')],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']},{'type':_0x2e74a4[_0xabdb('0x3')],'app':_0x2e74a4['alias']?_0xabdb('0x4'):_0xabdb('0x8'),'appdata':_0x2e74a4['alias']?'CDR(routeAlias)='+_0x2e74a4[_0xabdb('0x9')]:'No\x20alias\x20set','context':_0x2e74a4[_0xabdb('0x6')],'exten':_0x2e74a4[_0xabdb('0x7')],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']}];if(_0x2e74a4['type']==='inbound'){_0x4f1d59['push']({'type':_0xabdb('0xa'),'app':_0xabdb('0x4'),'appdata':_0xabdb('0xb')+_0x2e74a4['id'],'context':_0x2e74a4[_0xabdb('0x6')],'exten':_0x2e74a4[_0xabdb('0x7')],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']});}_0x4f1d59['push']({'type':_0x2e74a4[_0xabdb('0x3')],'app':_0xabdb('0x4'),'appdata':_0xabdb('0xc'),'context':_0x2e74a4[_0xabdb('0x6')],'exten':_0x2e74a4['exten'],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']},{'type':_0x2e74a4[_0xabdb('0x3')],'app':'Set','appdata':_0xabdb('0xd'),'context':_0x2e74a4['context'],'exten':_0x2e74a4[_0xabdb('0x7')],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']},{'type':_0x2e74a4[_0xabdb('0x3')],'app':_0xabdb('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2e74a4['context'],'exten':_0x2e74a4[_0xabdb('0x7')],'priority':_0x19dab5++,'VoiceExtensionId':_0x2e74a4['id']});return _0x4f1d59;}function _0x3614e9(_0x471347){var _0x177895=0x2;var _0x47f0c0=[{'type':'outbound','app':'Set','appdata':'CDR(type)=outbound','context':_0x471347[_0xabdb('0x6')],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0x471347[_0xabdb('0x9')]?_0xabdb('0x4'):'NoOp','appdata':_0x471347[_0xabdb('0x9')]?_0xabdb('0xf')+_0x471347[_0xabdb('0x9')]:_0xabdb('0x10'),'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347['exten'],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x4'),'appdata':_0xabdb('0x11')+(_0x471347[_0xabdb('0x12')]?'${EXTEN:'+_0x471347['cutdigits']+'}':'${EXTEN}'),'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':'Set','appdata':_0xabdb('0xb')+_0x471347['id'],'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347['exten'],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x177895+0x2)+_0xabdb('0x14')+(_0x177895+0x1)+')','context':_0x471347['context'],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':'outbound','app':_0xabdb('0x4'),'appdata':_0x471347[_0xabdb('0x12')]?_0xabdb('0x15')+_0x471347[_0xabdb('0x12')]+'}':_0xabdb('0x16'),'context':_0x471347['context'],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x4'),'appdata':_0xabdb('0xc'),'context':_0x471347['context'],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':'outbound','app':'Set','appdata':_0xabdb('0xd'),'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x4'),'appdata':_0xabdb('0x17'),'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x4'),'appdata':_0xabdb('0x18')+_0x471347['id'],'context':_0x471347[_0xabdb('0x6')],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']}];if(_0x471347[_0xabdb('0x19')](_0xabdb('0x1a'))&&_0x471347[_0xabdb('0x1a')]!==_0xabdb('0x1b')){_0x47f0c0['push']({'type':'outbound','app':_0xabdb('0x4'),'appdata':_0xabdb('0x1c'),'context':_0x471347['context'],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']},{'type':_0xabdb('0xe'),'app':_0xabdb('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x471347[_0xabdb('0x1a')]||'wav','context':_0x471347['context'],'exten':_0x471347[_0xabdb('0x7')],'priority':_0x177895++,'VoiceExtensionId':_0x471347['id']});}return _0x47f0c0;}function _0x11ec3b(_0x587d0d,_0x1b7345){var _0x4fce99=[{'name':'trunk','param':0x0},{'name':_0xabdb('0x1d'),'param':0x1},{'name':_0xabdb('0x1e'),'param':0x2},{'name':_0xabdb('0x1f'),'param':0x3}];var _0x22498c={};var _0x22cfbc=_0x1b7345[_0xabdb('0x20')](',');var _0x386a94=[];for(var _0x150e4a=0x0;_0x150e4a<_0x4fce99[_0xabdb('0x21')];_0x150e4a++){switch(_0x4fce99[_0x150e4a][_0xabdb('0x22')]){case _0xabdb('0x23'):_0x22498c[_0xabdb('0x23')]=_0x22cfbc[_0x4fce99[_0x150e4a][_0xabdb('0x24')]][_0xabdb('0x20')]('/')[0x1];_0x22498c[_0xabdb('0x25')]=_0x22cfbc[_0x4fce99[_0x150e4a][_0xabdb('0x24')]]['split']('/')[0x2];_0x22498c[_0xabdb('0x26')]=_0x22498c[_0xabdb('0x25')]?_0x22498c[_0xabdb('0x25')][_0xabdb('0x20')]('$')[0x0]:undefined;_0x22498c['phone']=_0x587d0d['cutdigits']?(_0x22498c['prefix']||'')+'${EXTEN:'+_0x587d0d['cutdigits']+'}':(_0x22498c[_0xabdb('0x26')]||'')+_0xabdb('0x27');_0x386a94[_0x4fce99[_0x150e4a][_0xabdb('0x24')]]=[_0xabdb('0x28'),_0x22498c[_0xabdb('0x23')],_0x22498c[_0xabdb('0x25')]][_0xabdb('0x29')]('/');break;case _0xabdb('0x1e'):_0x22498c[_0xabdb('0x1e')]=_0x22cfbc[_0x4fce99[_0x150e4a][_0xabdb('0x24')]];if(_0x587d0d[_0xabdb('0x1a')]!=='none'){if(_0x22498c[_0xabdb('0x1e')][_0xabdb('0x2a')](_0xabdb('0x2b'))<0x0){_0x22498c[_0xabdb('0x1e')]+='U(xcally-mixmonitor-context)';}}else{_0x22498c[_0xabdb('0x1e')]=_0x22498c['options'][_0xabdb('0x2c')](_0xabdb('0x2b'),'');}_0x386a94[_0x4fce99[_0x150e4a][_0xabdb('0x24')]]=_0x22498c[_0xabdb('0x1e')];break;default:_0x386a94[_0x4fce99[_0x150e4a]['param']]=_0x22cfbc[_0x4fce99[_0x150e4a]['param']];}}return _0x386a94['join'](',');}function _0x39c96e(_0x567ef1,_0x3025eb,_0x37e4c5){return new Promise(function(_0x6c6bbd,_0x48d1ce){var _0x1d0a9e=[];if(_[_0xabdb('0x2d')](_0x3025eb))return _0x6c6bbd(_0x1d0a9e);_0x2a00cd[_0xabdb('0x2e')][_0xabdb('0x2f')]({'attributes':['id',_0xabdb('0x30'),_0xabdb('0x31')],'raw':!![]})[_0xabdb('0x32')](function(_0x53c421){for(var _0x778ef1=0x0,_0x1b5998=0x0;_0x778ef1<_0x3025eb[_0xabdb('0x21')];_0x778ef1++,_0x1b5998=0x0){var _0x1ea1fc=_0x3025eb[_0x778ef1];var _0x34b651=[];var _0xe600f=[];delete _0x1ea1fc['id'];if(_0x1ea1fc['interval']!==_0xabdb('0x33')){_0x1ea1fc[_0xabdb('0x34')]=[_0x1ea1fc['interval']];}else{_0x1ea1fc['intervals']=_0x1ea1fc['IntervalId']?_[_0xabdb('0x35')](_[_0xabdb('0x36')](_0x53c421,{'IntervalId':_0x1ea1fc[_0xabdb('0x31')]}),_0xabdb('0x30')):[];}_0x1ea1fc[_0xabdb('0x6')]=_0x567ef1['context'];_0x1ea1fc[_0xabdb('0x7')]=_0x567ef1[_0xabdb('0x7')];if(_0x1ea1fc[_0xabdb('0x3')])_0x1ea1fc['type']=_0x1ea1fc[_0xabdb('0x3')][_0xabdb('0x37')]();if(_0x567ef1[_0xabdb('0x3')]===_0xabdb('0xe')){if(_0x1ea1fc[_0xabdb('0x19')]('tag')&&_0x1ea1fc[_0xabdb('0x38')]&&_0x1ea1fc['tag']!=='--'){_0x34b651['push']({'type':_0x1ea1fc[_0xabdb('0x3')][_0xabdb('0x37')](),'app':_0xabdb('0x4'),'appdata':_0xabdb('0x39')+_0x1ea1fc[_0xabdb('0x38')],'context':_0x567ef1[_0xabdb('0x6')],'exten':_0x567ef1['exten'],'priority':_0x1ea1fc['intervals'][_0xabdb('0x21')]+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});}_0x34b651[_0xabdb('0x3a')]({'type':_0x1ea1fc[_0xabdb('0x3')][_0xabdb('0x37')](),'app':_0xabdb('0x13'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1ea1fc['callerID']?'Set(CALLERID(all)='+_0x1ea1fc[_0xabdb('0x3b')]+')':_0xabdb('0x3c')),'context':_0x567ef1[_0xabdb('0x6')],'exten':_0x567ef1[_0xabdb('0x7')],'priority':_0x1ea1fc[_0xabdb('0x34')]['length']+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});}else{if(_0x1ea1fc[_0xabdb('0x19')](_0xabdb('0x3d'))){if(['queue','playback'][_0xabdb('0x3e')](_0x1ea1fc['app'][_0xabdb('0x37')]())&&_0x1ea1fc['appType']!==_0xabdb('0x3f')){if(_0x1ea1fc[_0xabdb('0x3d')]){_0x34b651[_0xabdb('0x3a')]({'type':_0x1ea1fc['type'][_0xabdb('0x37')](),'app':_0xabdb('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x567ef1[_0xabdb('0x6')],'exten':_0x567ef1['exten'],'priority':_0x1ea1fc['intervals'][_0xabdb('0x21')]+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});_0x34b651[_0xabdb('0x3a')]({'type':_0x1ea1fc[_0xabdb('0x3')][_0xabdb('0x37')](),'app':'Set','appdata':_0xabdb('0x40'),'context':_0x567ef1[_0xabdb('0x6')],'exten':_0x567ef1[_0xabdb('0x7')],'priority':_0x1ea1fc['intervals'][_0xabdb('0x21')]+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});}else{_0x34b651['push']({'type':_0x1ea1fc[_0xabdb('0x3')]['toLowerCase'](),'app':_0xabdb('0x13'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x567ef1['context'],'exten':_0x567ef1[_0xabdb('0x7')],'priority':_0x1ea1fc['intervals'][_0xabdb('0x21')]+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});_0x34b651[_0xabdb('0x3a')]({'type':_0x1ea1fc[_0xabdb('0x3')][_0xabdb('0x37')](),'app':_0xabdb('0x4'),'appdata':_0xabdb('0x41'),'context':_0x567ef1[_0xabdb('0x6')],'exten':_0x567ef1[_0xabdb('0x7')],'priority':_0x1ea1fc[_0xabdb('0x34')][_0xabdb('0x21')]+_0x37e4c5+_0x1b5998++,'VoiceExtensionId':_0x567ef1['id']});}}}}for(var _0x42e052=0x0;_0x42e052<_0x1ea1fc[_0xabdb('0x34')][_0xabdb('0x21')];_0x42e052++){var _0x2182f5=_0x37e4c5+_0x1ea1fc['intervals']['length'];var _0x3accec=_0x42e052===_0x1ea1fc[_0xabdb('0x34')][_0xabdb('0x21')]-0x1?_0x37e4c5+_0x34b651[_0xabdb('0x21')]+_0xe600f[_0xabdb('0x21')]+0x2:_0x37e4c5+_0x42e052+0x1;_0x34b651[_0xabdb('0x42')](_0x42e052,0x0,{'type':_0x567ef1['type'],'app':_0xabdb('0x43'),'appdata':_0x1ea1fc[_0xabdb('0x34')][_0x42e052]+'?'+_0x567ef1['context']+',${EXTEN},'+_0x2182f5+':'+_0x567ef1[_0xabdb('0x6')]+_0xabdb('0x44')+_0x3accec,'exten':_0x567ef1['exten'],'context':_0x567ef1[_0xabdb('0x6')],'priority':_0x37e4c5+_0x42e052,'VoiceExtensionId':_0x567ef1['id']});}if(_0x1ea1fc['appType']==='outboundDial')_0x1ea1fc[_0xabdb('0x45')]=_0x11ec3b(_0x567ef1,_0x1ea1fc['appdata']);_0x1ea1fc[_0xabdb('0x46')]=_0x34b651['length']?_[_0xabdb('0x47')](_0x34b651)[_0xabdb('0x46')]+0x1:_0x37e4c5;_0x1d0a9e=_[_0xabdb('0x48')](_0x1d0a9e,_0x34b651,[_0x1ea1fc],_0xe600f);_0x37e4c5=_[_0xabdb('0x47')](_0x1d0a9e)[_0xabdb('0x46')]+0x1;}return _0x6c6bbd(_0x1d0a9e);})[_0xabdb('0x49')](function(_0x2bc599){_0x48d1ce(_0x2bc599);});});}return _0x3bdc80['define'](_0xabdb('0x4a'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1b8116){var _0x43a1ec=this[_0xabdb('0x4b')]({'plain':!![]});var _0x1bbab4=_0x43a1ec[_0xabdb('0x3')]===_0xabdb('0xe')?_0x3614e9(_0x43a1ec):_0x53185c(_0x43a1ec);return _0x39c96e(_0x43a1ec,_0x1b8116,_[_0xabdb('0x47')](_0x1bbab4)['priority']+0x1)[_0xabdb('0x32')](function(_0x5a4c7d){var _0x5e7282=_[_0xabdb('0x48')](_0x1bbab4,_0x5a4c7d);_0x5e7282[_0xabdb('0x3a')]({'type':_0x43a1ec['type'],'app':_0xabdb('0x4c'),'exten':_0x43a1ec[_0xabdb('0x7')],'context':_0x43a1ec[_0xabdb('0x6')],'priority':_['last'](_0x5e7282)[_0xabdb('0x46')]+0x1,'VoiceExtensionId':_0x43a1ec['id']});return _0x5e7282;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e78396c..0057756 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 _0x0738=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x0738,0x6e));var _0x8073=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0738[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x8073('0x0'));var util=require('util');var moment=require(_0x8073('0x1'));var BPromise=require(_0x8073('0x2'));var rs=require(_0x8073('0x3'));var fs=require('fs');var Redis=require(_0x8073('0x4'));var db=require(_0x8073('0x5'))['db'];var utils=require(_0x8073('0x6'));var logger=require(_0x8073('0x7'))(_0x8073('0x8'));var config=require(_0x8073('0x9'));var jayson=require(_0x8073('0xa'));var client=jayson[_0x8073('0xb')]['http']({'port':0x232a});config[_0x8073('0xc')]=_[_0x8073('0xd')](config[_0x8073('0xc')],{'host':_0x8073('0xe'),'port':0x18eb});var socket=require(_0x8073('0xf'))(new Redis(config[_0x8073('0xc')]));require(_0x8073('0x10'))[_0x8073('0x11')](socket);function respondWithRpcPromise(_0x3ea58b,_0x518f9f,_0x4a1fec){return new BPromise(function(_0x28e17b,_0x359af2){return client[_0x8073('0x12')](_0x3ea58b,_0x4a1fec)[_0x8073('0x13')](function(_0x513ed2){logger[_0x8073('0x14')](_0x8073('0x15'),_0x518f9f,'request\x20sent');logger[_0x8073('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x518f9f,_0x8073('0x17'),JSON[_0x8073('0x18')](_0x513ed2));if(_0x513ed2[_0x8073('0x19')]){if(_0x513ed2[_0x8073('0x19')]['code']===0x1f4){logger[_0x8073('0x19')](_0x8073('0x15'),_0x518f9f,_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);return _0x359af2(_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);}logger[_0x8073('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x518f9f,_0x513ed2[_0x8073('0x19')]['message']);return _0x28e17b(_0x513ed2[_0x8073('0x19')][_0x8073('0x1a')]);}else{logger[_0x8073('0x14')](_0x8073('0x15'),_0x518f9f,_0x8073('0x17'));_0x28e17b(_0x513ed2[_0x8073('0x1b')][_0x8073('0x1a')]);}})[_0x8073('0x1c')](function(_0x7c8cf0){logger[_0x8073('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x518f9f,_0x7c8cf0);_0x359af2(_0x7c8cf0);});});}exports['GetVoiceExtension']=function(_0x18447e){var _0x2fec07=this;return new Promise(function(_0x5baaf9,_0x1c4b9a){return db[_0x8073('0x1d')][_0x8073('0x1e')]({'raw':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')][_0x8073('0x20')]===undefined?!![]:![]:!![],'where':_0x18447e[_0x8073('0x1f')]?_0x18447e['options'][_0x8073('0x21')]||null:null,'attributes':_0x18447e['options']?_0x18447e[_0x8073('0x1f')][_0x8073('0x22')]||null:null,'limit':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')][_0x8073('0x23')]||null:null,'include':_0x18447e[_0x8073('0x1f')]?_0x18447e[_0x8073('0x1f')]['include']?_[_0x8073('0x24')](_0x18447e[_0x8073('0x1f')][_0x8073('0x25')],function(_0x6c49b0){return{'model':db[_0x6c49b0['model']],'as':_0x6c49b0['as'],'attributes':_0x6c49b0[_0x8073('0x22')],'include':_0x6c49b0[_0x8073('0x25')]?_[_0x8073('0x24')](_0x6c49b0[_0x8073('0x25')],function(_0x1d1a4c){return{'model':db[_0x1d1a4c[_0x8073('0x26')]],'as':_0x1d1a4c['as'],'attributes':_0x1d1a4c['attributes'],'include':_0x1d1a4c[_0x8073('0x25')]?_[_0x8073('0x24')](_0x1d1a4c[_0x8073('0x25')],function(_0x33474f){return{'model':db[_0x33474f['model']],'as':_0x33474f['as'],'attributes':_0x33474f[_0x8073('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0151){logger['info'](_0x8073('0x27'),_0x18447e);logger['debug']('GetVoiceExtension',_0x18447e,JSON['stringify'](_0x4d0151));_0x5baaf9(_0x4d0151);})[_0x8073('0x1c')](function(_0x337135){logger[_0x8073('0x19')]('GetVoiceExtension',_0x337135[_0x8073('0x1a')],_0x18447e);_0x1c4b9a(_0x2fec07[_0x8073('0x19')](0x1f4,_0x337135['message']));});});}; \ No newline at end of file +var _0xfcbe=['include','map','model','GetVoiceExtension','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','where','attributes'];(function(_0x1200e9,_0x1a23a4){var _0x2c1ac4=function(_0x1e87e4){while(--_0x1e87e4){_0x1200e9['push'](_0x1200e9['shift']());}};_0x2c1ac4(++_0x1a23a4);}(_0xfcbe,0x1b1));var _0xefcb=function(_0xff6639,_0x20f580){_0xff6639=_0xff6639-0x0;var _0x38f667=_0xfcbe[_0xff6639];return _0x38f667;};'use strict';var _=require('lodash');var util=require(_0xefcb('0x0'));var moment=require(_0xefcb('0x1'));var BPromise=require(_0xefcb('0x2'));var rs=require(_0xefcb('0x3'));var fs=require('fs');var Redis=require(_0xefcb('0x4'));var db=require(_0xefcb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefcb('0x6'))(_0xefcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefcb('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xefcb('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xefcb('0xa'))(new Redis(config[_0xefcb('0x9')]));require(_0xefcb('0xb'))['register'](socket);function respondWithRpcPromise(_0x35630e,_0x35f070,_0x527170){return new BPromise(function(_0x533ee5,_0x326270){return client[_0xefcb('0xc')](_0x35630e,_0x527170)[_0xefcb('0xd')](function(_0x3f9204){logger[_0xefcb('0xe')](_0xefcb('0xf'),_0x35f070,'request\x20sent');logger[_0xefcb('0x10')](_0xefcb('0x11'),_0x35f070,_0xefcb('0x12'),JSON[_0xefcb('0x13')](_0x3f9204));if(_0x3f9204[_0xefcb('0x14')]){if(_0x3f9204['error']['code']===0x1f4){logger[_0xefcb('0x14')](_0xefcb('0xf'),_0x35f070,_0x3f9204['error'][_0xefcb('0x15')]);return _0x326270(_0x3f9204['error'][_0xefcb('0x15')]);}logger['error'](_0xefcb('0xf'),_0x35f070,_0x3f9204[_0xefcb('0x14')][_0xefcb('0x15')]);return _0x533ee5(_0x3f9204[_0xefcb('0x14')][_0xefcb('0x15')]);}else{logger[_0xefcb('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x35f070,_0xefcb('0x12'));_0x533ee5(_0x3f9204[_0xefcb('0x16')][_0xefcb('0x15')]);}})[_0xefcb('0x17')](function(_0x1bd57c){logger[_0xefcb('0x14')](_0xefcb('0xf'),_0x35f070,_0x1bd57c);_0x326270(_0x1bd57c);});});}exports['GetVoiceExtension']=function(_0x39ab04){var _0x3b7509=this;return new Promise(function(_0x5695b4,_0x12a93f){return db[_0xefcb('0x18')][_0xefcb('0x19')]({'raw':_0x39ab04[_0xefcb('0x1a')]?_0x39ab04[_0xefcb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x39ab04[_0xefcb('0x1a')]?_0x39ab04[_0xefcb('0x1a')][_0xefcb('0x1b')]||null:null,'attributes':_0x39ab04[_0xefcb('0x1a')]?_0x39ab04[_0xefcb('0x1a')][_0xefcb('0x1c')]||null:null,'limit':_0x39ab04[_0xefcb('0x1a')]?_0x39ab04[_0xefcb('0x1a')]['limit']||null:null,'include':_0x39ab04['options']?_0x39ab04['options'][_0xefcb('0x1d')]?_[_0xefcb('0x1e')](_0x39ab04[_0xefcb('0x1a')][_0xefcb('0x1d')],function(_0x20f51f){return{'model':db[_0x20f51f[_0xefcb('0x1f')]],'as':_0x20f51f['as'],'attributes':_0x20f51f[_0xefcb('0x1c')],'include':_0x20f51f['include']?_[_0xefcb('0x1e')](_0x20f51f[_0xefcb('0x1d')],function(_0xa42610){return{'model':db[_0xa42610[_0xefcb('0x1f')]],'as':_0xa42610['as'],'attributes':_0xa42610[_0xefcb('0x1c')],'include':_0xa42610[_0xefcb('0x1d')]?_[_0xefcb('0x1e')](_0xa42610[_0xefcb('0x1d')],function(_0x1c7ee1){return{'model':db[_0x1c7ee1[_0xefcb('0x1f')]],'as':_0x1c7ee1['as'],'attributes':_0x1c7ee1[_0xefcb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xefcb('0xd')](function(_0xccac33){logger[_0xefcb('0xe')](_0xefcb('0x20'),_0x39ab04);logger['debug'](_0xefcb('0x20'),_0x39ab04,JSON[_0xefcb('0x13')](_0xccac33));_0x5695b4(_0xccac33);})[_0xefcb('0x17')](function(_0x232d45){logger[_0xefcb('0x14')](_0xefcb('0x20'),_0x232d45[_0xefcb('0x15')],_0x39ab04);_0x12a93f(_0x3b7509['error'](0x1f4,_0x232d45['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index bcd53ef..153f1bf 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 _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2e4e7e,_0x380410){var _0x40ddb1=function(_0x3e448d){while(--_0x3e448d){_0x2e4e7e['push'](_0x2e4e7e['shift']());}};_0x40ddb1(++_0x380410);}(_0x7a54,0x106));var _0x47a5=function(_0x19e634,_0x385d80){_0x19e634=_0x19e634-0x0;var _0x294252=_0x7a54[_0x19e634];return _0x294252;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x41a54e,_0x416ac2){var _0xe63fb5=function(_0x332d51){while(--_0x332d51){_0x41a54e['push'](_0x41a54e['shift']());}};_0xe63fb5(++_0x416ac2);}(_0x7a54,0x106));var _0x47a5=function(_0x159727,_0x281296){_0x159727=_0x159727-0x0;var _0x26326e=_0x7a54[_0x159727];return _0x26326e;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index aafc0e7..23f1376 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','/:id','isAuthenticated','show','/:id/messages','getMessages','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1a4a89,_0x4abdee){var _0x47229b=function(_0xc5f0f3){while(--_0xc5f0f3){_0x1a4a89['push'](_0x1a4a89['shift']());}};_0x47229b(++_0x4abdee);}(_0x2ef3,0xba));var _0x32ef=function(_0x13726e,_0x15bd32){_0x13726e=_0x13726e-0x0;var _0x5e8c15=_0x2ef3[_0x13726e];return _0x5e8c15;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0xed1c=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller'];(function(_0x487bb1,_0x536170){var _0x8a1331=function(_0x49eede){while(--_0x49eede){_0x487bb1['push'](_0x487bb1['shift']());}};_0x8a1331(++_0x536170);}(_0xed1c,0xe4));var _0xced1=function(_0x2b90a2,_0x4de2ee){_0x2b90a2=_0x2b90a2-0x0;var _0x14ca1b=_0xed1c[_0x2b90a2];return _0x14ca1b;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/',auth['isAuthenticated'](),controller[_0xced1('0xe')]);router['put'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);router[_0xced1('0x10')](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0cbb22f..03efc0c 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 _0xa220=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','central'];(function(_0x5f2327,_0x123bcd){var _0x304698=function(_0x5eb594){while(--_0x5eb594){_0x5f2327['push'](_0x5f2327['shift']());}};_0x304698(++_0x123bcd);}(_0xa220,0x8f));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x0a22('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':_0x0a22('0x2'),'unique':_0x0a22('0x3')},'mailbox':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':'','allowNull':![],'unique':_0x0a22('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x0a22('0x1')]},'email':{'type':Sequelize[_0x0a22('0x1')],'validate':{'isEmail':!![]},'set':function(_0x40d827){this[_0x0a22('0x4')]('email',typeof _0x40d827===_0x0a22('0x5')&&_0x40d827['trim']()?_0x40d827['trim']():null);}},'pager':{'type':Sequelize[_0x0a22('0x1')]},'tz':{'type':Sequelize[_0x0a22('0x1')],'defaultValue':_0x0a22('0x6')},'attach':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0a22('0x1')]},'review':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0a22('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x0a22('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0a22('0x7')](_0x0a22('0x8'),'no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x0a22('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0a22('0x7')]('yes','no'),'defaultValue':_0x0a22('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x0a22('0x1')]},'emailbody':{'type':Sequelize[_0x0a22('0x1')]},'maxsecs':{'type':Sequelize[_0x0a22('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0a22('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0a22('0xb')],'get':function(){return this[_0x0a22('0xc')](_0x0a22('0xd'))+_0x0a22('0xe')+this[_0x0a22('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x5e63=['TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes'];(function(_0x31b4a4,_0x28d3f6){var _0xc87ed2=function(_0x5cbf34){while(--_0x5cbf34){_0x31b4a4['push'](_0x31b4a4['shift']());}};_0xc87ed2(++_0x28d3f6);}(_0x5e63,0x14a));var _0x35e6=function(_0x532b5b,_0xce6ec8){_0x532b5b=_0x532b5b-0x0;var _0x169ff9=_0x5e63[_0x532b5b];return _0x169ff9;};'use strict';var Sequelize=require(_0x35e6('0x0'));module[_0x35e6('0x1')]={'customer_id':{'type':Sequelize[_0x35e6('0x2')]},'context':{'type':Sequelize[_0x35e6('0x2')],'defaultValue':_0x35e6('0x3'),'unique':_0x35e6('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x35e6('0x4')},'password':{'type':Sequelize[_0x35e6('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x35e6('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5ec312){this[_0x35e6('0x5')](_0x35e6('0x6'),typeof _0x5ec312===_0x35e6('0x7')&&_0x5ec312[_0x35e6('0x8')]()?_0x5ec312[_0x35e6('0x8')]():null);}},'pager':{'type':Sequelize[_0x35e6('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x35e6('0x9')},'attach':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':_0x35e6('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x35e6('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x35e6('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x35e6('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x35e6('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x35e6('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':_0x35e6('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x35e6('0xa')](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x35e6('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x35e6('0xb'),'no'),'defaultValue':_0x35e6('0xb'),'allowNull':![]},'stamp':{'type':_0x35e6('0xd')},'emailsubject':{'type':Sequelize[_0x35e6('0x2')]},'emailbody':{'type':Sequelize[_0x35e6('0x2')]},'maxsecs':{'type':Sequelize[_0x35e6('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x35e6('0xf')],'get':function(){return this[_0x35e6('0x10')](_0x35e6('0x11'))+'\x20-\x20'+this[_0x35e6('0x10')](_0x35e6('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5b191c6..18a789a 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 _0x80ed=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0x80ed,0x11c));var _0xd80e=function(_0x54112c,_0xa35623){_0x54112c=_0x54112c-0x0;var _0xf37231=_0x80ed[_0x54112c];return _0xf37231;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];function respondWithStatusCode(_0x118f53,_0x1d3fcf){_0x1d3fcf=_0x1d3fcf||0xcc;return function(_0x4fb01c){if(_0x4fb01c){return _0x118f53['sendStatus'](_0x1d3fcf);}return _0x118f53['status'](_0x1d3fcf)['end']();};}function respondWithResult(_0x145766,_0x3d233b){_0x3d233b=_0x3d233b||0xc8;return function(_0x3096ae){if(_0x3096ae){return _0x145766[_0xd80e('0x1b')](_0x3d233b)[_0xd80e('0x1c')](_0x3096ae);}};}function respondWithFilteredResult(_0x58a17e,_0x595683){return function(_0x2c8c61){if(_0x2c8c61){var _0x3124e8=typeof _0x595683[_0xd80e('0x1d')]===_0xd80e('0x1e')&&typeof _0x595683[_0xd80e('0x1f')]===_0xd80e('0x1e');var _0x22ab67=_0x2c8c61['count'];var _0x21ceec=_0x3124e8?0x0:_0x595683[_0xd80e('0x1d')];var _0x3b543d=_0x3124e8?_0x2c8c61[_0xd80e('0x20')]:_0x595683['offset']+_0x595683[_0xd80e('0x1f')];var _0x175c67;if(_0x3b543d>=_0x22ab67){_0x3b543d=_0x22ab67;_0x175c67=0xc8;}else{_0x175c67=0xce;}_0x58a17e[_0xd80e('0x1b')](_0x175c67);return _0x58a17e['set'](_0xd80e('0x21'),_0x21ceec+'-'+_0x3b543d+'/'+_0x22ab67)[_0xd80e('0x1c')](_0x2c8c61);}return null;};}function patchUpdates(_0x2765ea){return function(_0x147134){try{jsonpatch[_0xd80e('0x22')](_0x147134,_0x2765ea,!![]);}catch(_0x5509d4){return BPromise['reject'](_0x5509d4);}return _0x147134[_0xd80e('0x23')]();};}function saveUpdates(_0x3fa159,_0x3b39bf){return function(_0x2d46e7){if(_0x2d46e7){return _0x2d46e7[_0xd80e('0x24')](_0x3fa159)[_0xd80e('0x25')](function(_0x43152c){return _0x43152c;});}return null;};}function removeEntity(_0x5430b6,_0x1fbf8a){return function(_0x57d70){if(_0x57d70){return _0x57d70[_0xd80e('0x26')]()['then'](function(){var _0x635ce0=_0x57d70[_0xd80e('0x27')]({'plain':!![]});var _0xe9bb59='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0xe9bb59,'resourceId':_0x635ce0['id']}})[_0xd80e('0x25')](function(){return _0x57d70;});})['then'](function(){_0x5430b6[_0xd80e('0x1b')](0xcc)[_0xd80e('0x28')]();});}};}function handleEntityNotFound(_0x4e8ed9,_0x24bafb){return function(_0xe1c04a){if(!_0xe1c04a){_0x4e8ed9[_0xd80e('0x29')](0x194);}return _0xe1c04a;};}function handleError(_0x46c05d,_0x5376eb){_0x5376eb=_0x5376eb||0x1f4;return function(_0x15f317){logger[_0xd80e('0x2a')](_0x15f317[_0xd80e('0x2b')]);if(_0x15f317[_0xd80e('0x2c')]){delete _0x15f317[_0xd80e('0x2c')];}_0x46c05d[_0xd80e('0x1b')](_0x5376eb)[_0xd80e('0x2d')](_0x15f317);};}exports[_0xd80e('0x2e')]=function(_0x5522dd,_0x54504e){var _0x30f9bd={},_0x1303eb={},_0x400220={'count':0x0,'rows':[]};var _0x32360c=_[_0xd80e('0x2f')](db[_0xd80e('0x30')]['rawAttributes'],function(_0x568d82){return{'name':_0x568d82[_0xd80e('0x31')],'type':_0x568d82[_0xd80e('0x32')][_0xd80e('0x33')]};});_0x1303eb[_0xd80e('0x34')]=_[_0xd80e('0x2f')](_0x32360c,_0xd80e('0x2c'));_0x1303eb[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x5522dd['query']);_0x1303eb['filters']=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],_0x1303eb[_0xd80e('0x35')]);_0x30f9bd[_0xd80e('0x38')]=_[_0xd80e('0x37')](_0x1303eb[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x5522dd[_0xd80e('0x35')][_0xd80e('0x39')]));_0x30f9bd[_0xd80e('0x38')]=_0x30f9bd['attributes'][_0xd80e('0x3a')]?_0x30f9bd['attributes']:_0x1303eb[_0xd80e('0x34')];if(!_0x5522dd[_0xd80e('0x35')][_0xd80e('0x3b')](_0xd80e('0x3c'))){_0x30f9bd['limit']=qs[_0xd80e('0x1f')](_0x5522dd['query'][_0xd80e('0x1f')]);_0x30f9bd['offset']=qs[_0xd80e('0x1d')](_0x5522dd[_0xd80e('0x35')]['offset']);}_0x30f9bd[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x5522dd[_0xd80e('0x35')]['sort']);_0x30f9bd[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x5522dd[_0xd80e('0x35')],_0x1303eb[_0xd80e('0x40')]),_0x32360c);if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x42')]){_0x30f9bd[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x30f9bd['where'],{'$or':_['map'](_0x32360c,function(_0x4e92f6){if(_0x4e92f6[_0xd80e('0x32')]!==_0xd80e('0x44')){var _0x55925e={};_0x55925e[_0x4e92f6[_0xd80e('0x2c')]]={'$like':'%'+_0x5522dd['query'][_0xd80e('0x42')]+'%'};return _0x55925e;}})});}_0x30f9bd=_['merge']({},_0x30f9bd,_0x5522dd[_0xd80e('0x45')]);var _0xae1514={'where':_0x30f9bd['where']};return db['VoiceMail'][_0xd80e('0x20')](_0xae1514)[_0xd80e('0x25')](function(_0x439673){_0x400220[_0xd80e('0x20')]=_0x439673;if(_0x5522dd[_0xd80e('0x35')][_0xd80e('0x46')]){_0x30f9bd[_0xd80e('0x47')]=[{'all':!![]}];}return db[_0xd80e('0x30')][_0xd80e('0x48')](_0x30f9bd);})[_0xd80e('0x25')](function(_0x1bbb36){_0x400220[_0xd80e('0x49')]=_0x1bbb36;return _0x400220;})[_0xd80e('0x25')](respondWithFilteredResult(_0x54504e,_0x30f9bd))[_0xd80e('0x4a')](handleError(_0x54504e,null));};exports[_0xd80e('0x4b')]=function(_0x7f80a,_0x558911){var _0x52213c={'raw':!![],'where':{'id':_0x7f80a[_0xd80e('0x4c')]['id']}},_0x5bdea5={};_0x5bdea5['model']=_[_0xd80e('0x36')](db[_0xd80e('0x30')][_0xd80e('0x4d')]);_0x5bdea5[_0xd80e('0x35')]=_[_0xd80e('0x36')](_0x7f80a[_0xd80e('0x35')]);_0x5bdea5['filters']=_['intersection'](_0x5bdea5['model'],_0x5bdea5[_0xd80e('0x35')]);_0x52213c['attributes']=_[_0xd80e('0x37')](_0x5bdea5[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x7f80a[_0xd80e('0x35')][_0xd80e('0x39')]));_0x52213c['attributes']=_0x52213c[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x52213c[_0xd80e('0x38')]:_0x5bdea5['model'];if(_0x7f80a[_0xd80e('0x35')][_0xd80e('0x46')]){_0x52213c[_0xd80e('0x47')]=[{'all':!![]}];}_0x52213c=_['merge']({},_0x52213c,_0x7f80a[_0xd80e('0x45')]);return db[_0xd80e('0x30')][_0xd80e('0x4e')](_0x52213c)[_0xd80e('0x25')](handleEntityNotFound(_0x558911,null))[_0xd80e('0x25')](respondWithResult(_0x558911,null))[_0xd80e('0x4a')](handleError(_0x558911,null));};exports['create']=function(_0x5aad1b,_0x275985){return db[_0xd80e('0x30')][_0xd80e('0x4f')](_0x5aad1b['body'],{})['then'](function(_0x1762a8){var _0xff0980=_0x5aad1b[_0xd80e('0x50')][_0xd80e('0x27')]({'plain':!![]});if(!_0xff0980)throw new Error(_0xd80e('0x51'));if(_0xff0980['role']===_0xd80e('0x50')){var _0x5c392d=_0x1762a8[_0xd80e('0x27')]({'plain':!![]});var _0x31107b='Voicemails';return db[_0xd80e('0x52')][_0xd80e('0x4e')]({'where':{'name':_0x31107b,'userProfileId':_0xff0980[_0xd80e('0x53')]},'raw':!![]})[_0xd80e('0x25')](function(_0x44b2f5){if(_0x44b2f5&&_0x44b2f5[_0xd80e('0x54')]===0x0){return db[_0xd80e('0x55')]['create']({'name':_0x5c392d[_0xd80e('0x2c')],'resourceId':_0x5c392d['id'],'type':_0x44b2f5[_0xd80e('0x2c')],'sectionId':_0x44b2f5['id']},{})[_0xd80e('0x25')](function(){return _0x1762a8;});}else{return _0x1762a8;}})['catch'](function(_0x52ab04){logger[_0xd80e('0x2a')](_0xd80e('0x56'),_0x52ab04);throw _0x52ab04;});}return _0x1762a8;})[_0xd80e('0x25')](respondWithResult(_0x275985,0xc9))[_0xd80e('0x4a')](handleError(_0x275985,null));};exports[_0xd80e('0x24')]=function(_0x8b7a70,_0x53b2b8){if(_0x8b7a70[_0xd80e('0x57')]['id']){delete _0x8b7a70['body']['id'];}return db[_0xd80e('0x30')]['find']({'where':{'id':_0x8b7a70[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x53b2b8,null))[_0xd80e('0x25')](saveUpdates(_0x8b7a70[_0xd80e('0x57')],null))[_0xd80e('0x25')](respondWithResult(_0x53b2b8,null))[_0xd80e('0x4a')](handleError(_0x53b2b8,null));};exports['destroy']=function(_0x13270c,_0x4e7edd){return db[_0xd80e('0x30')][_0xd80e('0x4e')]({'where':{'id':_0x13270c['params']['id']}})['then'](handleEntityNotFound(_0x4e7edd,null))[_0xd80e('0x25')](removeEntity(_0x4e7edd,null))[_0xd80e('0x4a')](handleError(_0x4e7edd,null));};exports[_0xd80e('0x58')]=function(_0x570a02,_0x568770,_0x1ba0ed){return db[_0xd80e('0x30')]['findOne']({'where':{'id':_0x570a02[_0xd80e('0x4c')]['id']}})[_0xd80e('0x25')](handleEntityNotFound(_0x568770,null))[_0xd80e('0x25')](function(_0x539390){var _0x41dda0;var _0x589c0b={},_0x720eab={};_0x720eab[_0xd80e('0x34')]=_[_0xd80e('0x36')](db[_0xd80e('0x59')]['rawAttributes']);_0x720eab[_0xd80e('0x35')]=_['keys'](_0x570a02[_0xd80e('0x35')]);_0x720eab['filters']=_[_0xd80e('0x37')](_0x720eab[_0xd80e('0x34')],_0x720eab[_0xd80e('0x35')]);_0x589c0b[_0xd80e('0x38')]=_['intersection'](_0x720eab[_0xd80e('0x34')],qs[_0xd80e('0x39')](_0x570a02['query'][_0xd80e('0x39')]));_0x589c0b[_0xd80e('0x38')]=_0x589c0b[_0xd80e('0x38')][_0xd80e('0x3a')]?_0x589c0b['attributes']:_0x720eab[_0xd80e('0x34')];if(!_0x570a02[_0xd80e('0x35')]['hasOwnProperty'](_0xd80e('0x3c'))){_0x589c0b[_0xd80e('0x1f')]=qs[_0xd80e('0x1f')](_0x570a02['query']['limit']);_0x589c0b['offset']=qs['offset'](_0x570a02[_0xd80e('0x35')]['offset']);}_0x589c0b[_0xd80e('0x3d')]=qs[_0xd80e('0x3e')](_0x570a02[_0xd80e('0x35')]['sort']);_0x589c0b[_0xd80e('0x3f')]=qs[_0xd80e('0x40')](_[_0xd80e('0x41')](_0x570a02[_0xd80e('0x35')],_0x720eab[_0xd80e('0x40')]));if(_0x570a02[_0xd80e('0x35')][_0xd80e('0x42')]){_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b['where'],{'$or':_['map'](_0x589c0b[_0xd80e('0x38')],function(_0x410ed6){var _0x10104c={};_0x10104c[_0x410ed6]={'$like':'%'+_0x570a02[_0xd80e('0x35')]['filter']+'%'};return _0x10104c;})});}_0x589c0b[_0xd80e('0x3f')]=_[_0xd80e('0x43')](_0x589c0b[_0xd80e('0x3f')],{'mailboxuser':_0x539390[_0xd80e('0x5a')]});_0x589c0b=_[_0xd80e('0x43')]({},_0x589c0b,_0x570a02['options']);return db[_0xd80e('0x59')][_0xd80e('0x5b')](_0x589c0b)[_0xd80e('0x25')](respondWithFilteredResult(_0x568770,_0x589c0b));})[_0xd80e('0x4a')](handleError(_0x568770,null));}; \ No newline at end of file +var _0x7d25=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','nolimit','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x2bde76,_0x361be3){var _0x2bc561=function(_0x44af9a){while(--_0x44af9a){_0x2bde76['push'](_0x2bde76['shift']());}};_0x2bc561(++_0x361be3);}(_0x7d25,0x8a));var _0x57d2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x7d25[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='Voicemails';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));};exports['getMessages']=function(_0x682542,_0x4cdae5,_0x3111a2){return db['VoiceMail'][_0x57d2('0x53')]({'where':{'id':_0x682542[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x4cdae5,null))['then'](function(_0x5985e4){var _0xd5b87e;var _0x2c1710={},_0x3b57fa={};_0x3b57fa[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x54')]['rawAttributes']);_0x3b57fa['query']=_[_0x57d2('0x36')](_0x682542[_0x57d2('0x35')]);_0x3b57fa[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x3b57fa['model'],_0x3b57fa['query']);_0x2c1710[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x3b57fa['model'],qs[_0x57d2('0x3a')](_0x682542[_0x57d2('0x35')][_0x57d2('0x3a')]));_0x2c1710[_0x57d2('0x39')]=_0x2c1710['attributes']['length']?_0x2c1710['attributes']:_0x3b57fa['model'];if(!_0x682542[_0x57d2('0x35')][_0x57d2('0x3c')](_0x57d2('0x55'))){_0x2c1710[_0x57d2('0x1e')]=qs[_0x57d2('0x1e')](_0x682542[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x2c1710['offset']=qs[_0x57d2('0x1d')](_0x682542['query'][_0x57d2('0x1d')]);}_0x2c1710['order']=qs[_0x57d2('0x3d')](_0x682542[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x2c1710[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x682542['query'],_0x3b57fa[_0x57d2('0x37')]));if(_0x682542[_0x57d2('0x35')][_0x57d2('0x40')]){_0x2c1710[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x2c1710[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x2c1710[_0x57d2('0x39')],function(_0x10141e){var _0x59c4e4={};_0x59c4e4[_0x10141e]={'$like':'%'+_0x682542[_0x57d2('0x35')]['filter']+'%'};return _0x59c4e4;})});}_0x2c1710['where']=_['merge'](_0x2c1710[_0x57d2('0x3e')],{'mailboxuser':_0x5985e4['mailbox']});_0x2c1710=_[_0x57d2('0x41')]({},_0x2c1710,_0x682542[_0x57d2('0x43')]);return db['VoiceMailMessage'][_0x57d2('0x56')](_0x2c1710)[_0x57d2('0x24')](respondWithFilteredResult(_0x4cdae5,_0x2c1710));})[_0x57d2('0x45')](handleError(_0x4cdae5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c36b6d8..e8a53cc 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 _0xed32=['moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','api'];(function(_0x207e4a,_0x5aad4e){var _0x5a4ac9=function(_0x5226d8){while(--_0x5226d8){_0x207e4a['push'](_0x207e4a['shift']());}};_0x5a4ac9(++_0x5aad4e);}(_0xed32,0x129));var _0x2ed3=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xed32[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x2ed3('0x0'));var logger=require('../../config/logger')(_0x2ed3('0x1'));var moment=require(_0x2ed3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ed3('0x3'));var rimraf=require(_0x2ed3('0x4'));var config=require(_0x2ed3('0x5'));var attributes=require(_0x2ed3('0x6'));module[_0x2ed3('0x7')]=function(_0x33440a,_0x5d3038){return _0x33440a['define'](_0x2ed3('0x8'),attributes,{'tableName':_0x2ed3('0x9'),'paranoid':![],'indexes':[{'name':_0x2ed3('0xa'),'fields':[_0x2ed3('0xb'),_0x2ed3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcaa=['path','rimraf','../../config/environment','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2123cb,_0x4e2f9a){var _0x12d096=function(_0x5737a4){while(--_0x5737a4){_0x2123cb['push'](_0x2123cb['shift']());}};_0x12d096(++_0x4e2f9a);}(_0xfcaa,0x1b4));var _0xafca=function(_0x485d70,_0x5b4754){_0x485d70=_0x485d70-0x0;var _0x288d67=_0xfcaa[_0x485d70];return _0x288d67;};'use strict';var _=require(_0xafca('0x0'));var util=require(_0xafca('0x1'));var logger=require(_0xafca('0x2'))(_0xafca('0x3'));var moment=require('moment');var BPromise=require(_0xafca('0x4'));var rp=require(_0xafca('0x5'));var fs=require('fs');var path=require(_0xafca('0x6'));var rimraf=require(_0xafca('0x7'));var config=require(_0xafca('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x317b44,_0x45a427){return _0x317b44['define'](_0xafca('0x9'),attributes,{'tableName':_0xafca('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xafca('0xb'),_0xafca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 934144c..2adb332 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 _0x04f4=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','VoiceMail,\x20%s,\x20%s','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x3b58c9,_0x1f46c3){var _0x5b653a=function(_0xecac3b){while(--_0xecac3b){_0x3b58c9['push'](_0x3b58c9['shift']());}};_0x5b653a(++_0x1f46c3);}(_0x04f4,0x131));var _0x404f=function(_0x14923d,_0x4bebd4){_0x14923d=_0x14923d-0x0;var _0x50d1af=_0x04f4[_0x14923d];return _0x50d1af;};'use strict';var _=require(_0x404f('0x0'));var util=require(_0x404f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x404f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x404f('0x3'))['db'];var utils=require(_0x404f('0x4'));var logger=require('../../config/logger')(_0x404f('0x5'));var config=require(_0x404f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x404f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x628a52,_0x4936c6,_0x1da183){return new BPromise(function(_0x2844a4,_0x2017c1){return client[_0x404f('0x8')](_0x628a52,_0x1da183)[_0x404f('0x9')](function(_0x485538){logger['info'](_0x404f('0xa'),_0x4936c6,'request\x20sent');logger['debug'](_0x404f('0xb'),_0x4936c6,_0x404f('0xc'),JSON['stringify'](_0x485538));if(_0x485538[_0x404f('0xd')]){if(_0x485538[_0x404f('0xd')][_0x404f('0xe')]===0x1f4){logger[_0x404f('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4936c6,_0x485538[_0x404f('0xd')][_0x404f('0xf')]);return _0x2017c1(_0x485538['error'][_0x404f('0xf')]);}logger[_0x404f('0xd')](_0x404f('0xa'),_0x4936c6,_0x485538['error'][_0x404f('0xf')]);return _0x2844a4(_0x485538[_0x404f('0xd')][_0x404f('0xf')]);}else{logger[_0x404f('0x10')](_0x404f('0xa'),_0x4936c6,_0x404f('0xc'));_0x2844a4(_0x485538[_0x404f('0x11')][_0x404f('0xf')]);}})[_0x404f('0x12')](function(_0x388b08){logger[_0x404f('0xd')]('VoiceMail,\x20%s,\x20%s',_0x4936c6,_0x388b08);_0x2017c1(_0x388b08);});});} \ No newline at end of file +var _0x7129=['../../config/utils','../../config/logger','jayson/promise','http','then','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x7129,0xeb));var _0x9712=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7129[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x9712('0x0'));var util=require(_0x9712('0x1'));var moment=require('moment');var BPromise=require(_0x9712('0x2'));var rs=require(_0x9712('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9712('0x4'))['db'];var utils=require(_0x9712('0x5'));var logger=require(_0x9712('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9712('0x7'));var client=jayson['client'][_0x9712('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x50c70e,_0x478260,_0x24a9df){return new BPromise(function(_0x331c35,_0x4f82ae){return client['request'](_0x50c70e,_0x24a9df)[_0x9712('0x9')](function(_0x44dc81){logger[_0x9712('0xa')]('VoiceMail,\x20%s,\x20%s',_0x478260,_0x9712('0xb'));logger['debug'](_0x9712('0xc'),_0x478260,_0x9712('0xb'),JSON[_0x9712('0xd')](_0x44dc81));if(_0x44dc81[_0x9712('0xe')]){if(_0x44dc81['error'][_0x9712('0xf')]===0x1f4){logger[_0x9712('0xe')](_0x9712('0x10'),_0x478260,_0x44dc81[_0x9712('0xe')][_0x9712('0x11')]);return _0x4f82ae(_0x44dc81['error'][_0x9712('0x11')]);}logger[_0x9712('0xe')](_0x9712('0x10'),_0x478260,_0x44dc81[_0x9712('0xe')][_0x9712('0x11')]);return _0x331c35(_0x44dc81[_0x9712('0xe')][_0x9712('0x11')]);}else{logger[_0x9712('0xa')](_0x9712('0x10'),_0x478260,_0x9712('0xb'));_0x331c35(_0x44dc81[_0x9712('0x12')]['message']);}})[_0x9712('0x13')](function(_0x1a88cc){logger[_0x9712('0xe')]('VoiceMail,\x20%s,\x20%s',_0x478260,_0x1a88cc);_0x4f82ae(_0x1a88cc);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index af89f51..1c89ed5 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 _0x9359=['post','put','/:id','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','download'];(function(_0x19d19c,_0x1f05da){var _0x849751=function(_0x11d43a){while(--_0x11d43a){_0x19d19c['push'](_0x19d19c['shift']());}};_0x849751(++_0x1f05da);}(_0x9359,0xe6));var _0x9935=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9359[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x9935('0x0'));var path=require('path');var timeout=require(_0x9935('0x1'));var express=require(_0x9935('0x2'));var router=express['Router']();var fs_extra=require(_0x9935('0x3'));var auth=require(_0x9935('0x4'));var interaction=require(_0x9935('0x5'));var config=require('../../config/environment');var controller=require(_0x9935('0x6'));router[_0x9935('0x7')]('/',auth[_0x9935('0x8')](),controller['index']);router[_0x9935('0x7')]('/:id',auth[_0x9935('0x8')](),controller['show']);router[_0x9935('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x9935('0x9')]);router[_0x9935('0xa')]('/',auth[_0x9935('0x8')](),controller['create']);router[_0x9935('0xb')](_0x9935('0xc'),auth['isAuthenticated'](),controller[_0x9935('0xd')]);router['delete'](_0x9935('0xc'),auth[_0x9935('0x8')](),controller[_0x9935('0xe')]);module[_0x9935('0xf')]=router; \ No newline at end of file +var _0x796b=['update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put'];(function(_0x1c92c8,_0x286fee){var _0xeaf1af=function(_0x3d6f67){while(--_0x3d6f67){_0x1c92c8['push'](_0x1c92c8['shift']());}};_0xeaf1af(++_0x286fee);}(_0x796b,0x16b));var _0xb796=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x796b[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0xb796('0x0'));var util=require('util');var path=require(_0xb796('0x1'));var timeout=require(_0xb796('0x2'));var express=require(_0xb796('0x3'));var router=express['Router']();var fs_extra=require(_0xb796('0x4'));var auth=require(_0xb796('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb796('0x6'));var controller=require(_0xb796('0x7'));router[_0xb796('0x8')]('/',auth[_0xb796('0x9')](),controller[_0xb796('0xa')]);router['get'](_0xb796('0xb'),auth[_0xb796('0x9')](),controller[_0xb796('0xc')]);router[_0xb796('0x8')](_0xb796('0xd'),auth[_0xb796('0x9')](),controller[_0xb796('0xe')]);router[_0xb796('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb796('0x10')](_0xb796('0xb'),auth[_0xb796('0x9')](),controller[_0xb796('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb796('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b9a4af6..bc4264a 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 _0x00e3=['sequelize','exports','VIRTUAL','INTEGER','STRING','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3ac3da,_0x4e467c){var _0x1a7525=function(_0x13c94e){while(--_0x13c94e){_0x3ac3da['push'](_0x3ac3da['shift']());}};_0x1a7525(++_0x4e467c);}(_0x00e3,0x98));var _0x300e=function(_0x40b003,_0x3ae3aa){_0x40b003=_0x40b003-0x0;var _0x3d0edc=_0x00e3[_0x40b003];return _0x3d0edc;};'use strict';var Sequelize=require(_0x300e('0x0'));module[_0x300e('0x1')]={'name':{'type':Sequelize[_0x300e('0x2')],'get':function(_0x34f1e4){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x300e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x300e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x300e('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x300e('0x6')](_0x300e('0x7'))}}; \ No newline at end of file +var _0xdcc4=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0xd0de62,_0x1b71aa){var _0x1e8e64=function(_0x34303b){while(--_0x34303b){_0xd0de62['push'](_0xd0de62['shift']());}};_0x1e8e64(++_0x1b71aa);}(_0xdcc4,0x160));var _0x4dcc=function(_0x80e427,_0x2738c1){_0x80e427=_0x80e427-0x0;var _0x2732b0=_0xdcc4[_0x80e427];return _0x2732b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4e1805){return this[_0x4dcc('0x0')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'duration':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x4dcc('0x2')](_0x4dcc('0x3')),'defaultValue':null},'flag':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4dcc('0x1')],'defaultValue':''},'stamp':{'type':_0x4dcc('0x4'),'defaultValue':Sequelize[_0x4dcc('0x5')](_0x4dcc('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 04c854a..eb5731b 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 _0x714e=['destroy','end','error','stack','name','send','map','VoiceMailMessage','fieldName','type','differenceBy','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then'];(function(_0x36ea5d,_0xa75586){var _0x596d87=function(_0x30f674){while(--_0x30f674){_0x36ea5d['push'](_0x36ea5d['shift']());}};_0x596d87(++_0xa75586);}(_0x714e,0x85));var _0xe714=function(_0x3ea5e1,_0x17c486){_0x3ea5e1=_0x3ea5e1-0x0;var _0x1b81d7=_0x714e[_0x3ea5e1];return _0x1b81d7;};'use strict';var emlformat=require(_0xe714('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe714('0x1'));var jsonpatch=require(_0xe714('0x2'));var rp=require(_0xe714('0x3'));var moment=require(_0xe714('0x4'));var BPromise=require(_0xe714('0x5'));var Mustache=require(_0xe714('0x6'));var util=require(_0xe714('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe714('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe714('0x9'));var squel=require(_0xe714('0xa'));var crypto=require('crypto');var jsforce=require(_0xe714('0xb'));var deskjs=require(_0xe714('0xc'));var toCsv=require(_0xe714('0xd'));var querystring=require(_0xe714('0xe'));var Papa=require('papaparse');var Redis=require(_0xe714('0xf'));var authService=require(_0xe714('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe714('0x11'));var logger=require(_0xe714('0x12'))(_0xe714('0x13'));var utils=require('../../config/utils');var config=require(_0xe714('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe714('0x15'))['db'];function respondWithStatusCode(_0x481fa5,_0x4adc69){_0x4adc69=_0x4adc69||0xcc;return function(_0x5b0147){if(_0x5b0147){return _0x481fa5['sendStatus'](_0x4adc69);}return _0x481fa5[_0xe714('0x16')](_0x4adc69)['end']();};}function respondWithResult(_0x4bedb8,_0x30e9b2){_0x30e9b2=_0x30e9b2||0xc8;return function(_0x24058f){if(_0x24058f){return _0x4bedb8[_0xe714('0x16')](_0x30e9b2)['json'](_0x24058f);}};}function respondWithFilteredResult(_0x38e092,_0x2c04ed){return function(_0x316918){if(_0x316918){var _0xdf9ad0=typeof _0x2c04ed[_0xe714('0x17')]===_0xe714('0x18')&&typeof _0x2c04ed[_0xe714('0x19')]===_0xe714('0x18');var _0x21cb0d=_0x316918[_0xe714('0x1a')];var _0x2740bb=_0xdf9ad0?0x0:_0x2c04ed[_0xe714('0x17')];var _0x200d79=_0xdf9ad0?_0x316918[_0xe714('0x1a')]:_0x2c04ed[_0xe714('0x17')]+_0x2c04ed[_0xe714('0x19')];var _0x589802;if(_0x200d79>=_0x21cb0d){_0x200d79=_0x21cb0d;_0x589802=0xc8;}else{_0x589802=0xce;}_0x38e092[_0xe714('0x16')](_0x589802);return _0x38e092[_0xe714('0x1b')](_0xe714('0x1c'),_0x2740bb+'-'+_0x200d79+'/'+_0x21cb0d)[_0xe714('0x1d')](_0x316918);}return null;};}function patchUpdates(_0x57b10e){return function(_0x39a80e){try{jsonpatch[_0xe714('0x1e')](_0x39a80e,_0x57b10e,!![]);}catch(_0x284f9b){return BPromise['reject'](_0x284f9b);}return _0x39a80e[_0xe714('0x1f')]();};}function saveUpdates(_0xd88bb2,_0x53a718){return function(_0x131f62){if(_0x131f62){return _0x131f62['update'](_0xd88bb2)[_0xe714('0x20')](function(_0x4d64ac){return _0x4d64ac;});}return null;};}function removeEntity(_0x537bfd,_0x334bed){return function(_0x5f1e6a){if(_0x5f1e6a){return _0x5f1e6a[_0xe714('0x21')]()[_0xe714('0x20')](function(){_0x537bfd[_0xe714('0x16')](0xcc)[_0xe714('0x22')]();});}};}function handleEntityNotFound(_0x4d2c82,_0x1a2d70){return function(_0x3001a4){if(!_0x3001a4){_0x4d2c82['sendStatus'](0x194);}return _0x3001a4;};}function handleError(_0x20541e,_0x2c3d11){_0x2c3d11=_0x2c3d11||0x1f4;return function(_0x50445f){logger[_0xe714('0x23')](_0x50445f[_0xe714('0x24')]);if(_0x50445f[_0xe714('0x25')]){delete _0x50445f[_0xe714('0x25')];}_0x20541e['status'](_0x2c3d11)[_0xe714('0x26')](_0x50445f);};}exports['index']=function(_0xd040bc,_0x48b5dc){var _0x507ff9={},_0x1d9dbd={},_0x4764a9={'count':0x0,'rows':[]};var _0x23fbd9=_[_0xe714('0x27')](db[_0xe714('0x28')]['rawAttributes'],function(_0xe545aa){return{'name':_0xe545aa[_0xe714('0x29')],'type':_0xe545aa[_0xe714('0x2a')]['key']};});_0x1d9dbd['model']=_[_0xe714('0x2b')](_[_0xe714('0x27')](_0x23fbd9,_0xe714('0x25')),[_0xe714('0x25')]);_0x1d9dbd[_0xe714('0x2c')]=_[_0xe714('0x2d')](_0xd040bc[_0xe714('0x2c')]);_0x1d9dbd['filters']=_['intersection'](_0x1d9dbd[_0xe714('0x2e')],_0x1d9dbd[_0xe714('0x2c')]);_0x507ff9[_0xe714('0x2f')]=_[_0xe714('0x30')](_0x1d9dbd[_0xe714('0x2e')],qs[_0xe714('0x31')](_0xd040bc['query']['fields']));_0x507ff9[_0xe714('0x2f')]=_0x507ff9[_0xe714('0x2f')][_0xe714('0x32')]?_0x507ff9['attributes']:_0x1d9dbd[_0xe714('0x2e')];if(!_0xd040bc[_0xe714('0x2c')][_0xe714('0x33')](_0xe714('0x34'))){_0x507ff9[_0xe714('0x19')]=qs[_0xe714('0x19')](_0xd040bc[_0xe714('0x2c')]['limit']);_0x507ff9[_0xe714('0x17')]=qs[_0xe714('0x17')](_0xd040bc[_0xe714('0x2c')]['offset']);}_0x507ff9['order']=qs[_0xe714('0x35')](_0xd040bc[_0xe714('0x2c')][_0xe714('0x35')]);_0x507ff9[_0xe714('0x36')]=qs[_0xe714('0x37')](_[_0xe714('0x38')](_0xd040bc[_0xe714('0x2c')],_0x1d9dbd[_0xe714('0x37')]),_0x23fbd9);if(_0xd040bc[_0xe714('0x2c')][_0xe714('0x39')]){_0x507ff9['where']=_[_0xe714('0x3a')](_0x507ff9['where'],{'$or':_[_0xe714('0x27')](_0x23fbd9,function(_0x1a8cb2){if(_0x1a8cb2['type']!==_0xe714('0x3b')){var _0x8f4bd0={};_0x8f4bd0[_0x1a8cb2[_0xe714('0x25')]]={'$like':'%'+_0xd040bc[_0xe714('0x2c')]['filter']+'%'};return _0x8f4bd0;}})});}_0x507ff9=_[_0xe714('0x3a')]({},_0x507ff9,_0xd040bc[_0xe714('0x3c')]);var _0x442d05={'where':_0x507ff9[_0xe714('0x36')]};return db['VoiceMailMessage'][_0xe714('0x1a')](_0x442d05)[_0xe714('0x20')](function(_0x793141){_0x4764a9[_0xe714('0x1a')]=_0x793141;if(_0xd040bc['query'][_0xe714('0x3d')]){_0x507ff9[_0xe714('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xe714('0x3f')](_0x507ff9);})[_0xe714('0x20')](function(_0x1df752){_0x4764a9['rows']=_0x1df752;return _0x4764a9;})[_0xe714('0x20')](respondWithFilteredResult(_0x48b5dc,_0x507ff9))[_0xe714('0x40')](handleError(_0x48b5dc,null));};exports[_0xe714('0x41')]=function(_0x42ffa2,_0x5251dd){var _0xf79d04={'raw':!![],'where':{'id':_0x42ffa2[_0xe714('0x42')]['id']}},_0x3ce70={};_0x3ce70['model']=_['keys'](db['VoiceMailMessage'][_0xe714('0x43')]);_0x3ce70['query']=_[_0xe714('0x2d')](_0x42ffa2[_0xe714('0x2c')]);_0x3ce70[_0xe714('0x37')]=_['intersection'](_0x3ce70[_0xe714('0x2e')],_0x3ce70['query']);_0xf79d04[_0xe714('0x2f')]=_[_0xe714('0x30')](_0x3ce70['model'],qs['fields'](_0x42ffa2[_0xe714('0x2c')][_0xe714('0x31')]));_0xf79d04[_0xe714('0x2f')]=_0xf79d04[_0xe714('0x2f')][_0xe714('0x32')]?_0xf79d04[_0xe714('0x2f')]:_0x3ce70[_0xe714('0x2e')];if(_0x42ffa2[_0xe714('0x2c')][_0xe714('0x3d')]){_0xf79d04[_0xe714('0x3e')]=[{'all':!![]}];}_0xf79d04=_[_0xe714('0x3a')]({},_0xf79d04,_0x42ffa2[_0xe714('0x3c')]);return db['VoiceMailMessage'][_0xe714('0x44')](_0xf79d04)['then'](handleEntityNotFound(_0x5251dd,null))['then'](respondWithResult(_0x5251dd,null))[_0xe714('0x40')](handleError(_0x5251dd,null));};exports[_0xe714('0x45')]=function(_0x4a5257,_0x108386){return db[_0xe714('0x28')]['create'](_0x4a5257['body'],{})[_0xe714('0x20')](respondWithResult(_0x108386,0xc9))[_0xe714('0x40')](handleError(_0x108386,null));};exports[_0xe714('0x46')]=function(_0x4a1f17,_0x41733c){if(_0x4a1f17[_0xe714('0x47')]['id']){delete _0x4a1f17[_0xe714('0x47')]['id'];}return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x4a1f17[_0xe714('0x42')]['id']}})[_0xe714('0x20')](handleEntityNotFound(_0x41733c,null))[_0xe714('0x20')](saveUpdates(_0x4a1f17['body'],null))[_0xe714('0x20')](respondWithResult(_0x41733c,null))[_0xe714('0x40')](handleError(_0x41733c,null));};exports[_0xe714('0x21')]=function(_0x2ec353,_0x183bc9){return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x2ec353['params']['id']}})['then'](handleEntityNotFound(_0x183bc9,null))[_0xe714('0x20')](removeEntity(_0x183bc9,null))[_0xe714('0x40')](handleError(_0x183bc9,null));};exports[_0xe714('0x48')]=function(_0x43cc25,_0x4043d3,_0x4f6e20){return db[_0xe714('0x28')][_0xe714('0x44')]({'where':{'id':_0x43cc25[_0xe714('0x42')]['id']},'attributes':['id',_0xe714('0x49'),_0xe714('0x4a')]})[_0xe714('0x20')](handleEntityNotFound(_0x4043d3,null))[_0xe714('0x20')](function(_0x2cf36c){if(_0x2cf36c){if(!_0x2cf36c[_0xe714('0x49')]){throw new db[(_0xe714('0x4b'))][(_0xe714('0x4c'))](_0xe714('0x4d'));}var _0x538251={'Content-Type':_0xe714('0x4e'),'Content-Disposition':_0xe714('0x4f')};if(_0x2cf36c[_0xe714('0x4a')]){_0x538251[_0xe714('0x50')]=_0xe714('0x51')+_0x2cf36c[_0xe714('0x4a')]+_0xe714('0x52');}_0x4043d3[_0xe714('0x1b')](_0x538251);return _0x4043d3[_0xe714('0x26')](new Buffer(_0x2cf36c[_0xe714('0x49')]));}})[_0xe714('0x40')](handleError(_0x4043d3,null));}; \ No newline at end of file +var _0x8c15=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','limit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','VoiceMailMessage','options','find','create','body','download','recording','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x3b1a2c,_0x483723){var _0x33951c=function(_0x50ca55){while(--_0x50ca55){_0x3b1a2c['push'](_0x3b1a2c['shift']());}};_0x33951c(++_0x483723);}(_0x8c15,0x1da));var _0x58c1=function(_0xbb64da,_0x53b3c0){_0xbb64da=_0xbb64da-0x0;var _0x2404b3=_0x8c15[_0xbb64da];return _0x2404b3;};'use strict';var emlformat=require(_0x58c1('0x0'));var rimraf=require(_0x58c1('0x1'));var zipdir=require(_0x58c1('0x2'));var jsonpatch=require(_0x58c1('0x3'));var rp=require(_0x58c1('0x4'));var moment=require(_0x58c1('0x5'));var BPromise=require(_0x58c1('0x6'));var Mustache=require(_0x58c1('0x7'));var util=require('util');var path=require(_0x58c1('0x8'));var sox=require(_0x58c1('0x9'));var csv=require(_0x58c1('0xa'));var ejs=require(_0x58c1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58c1('0xc'));var squel=require('squel');var crypto=require(_0x58c1('0xd'));var jsforce=require(_0x58c1('0xe'));var deskjs=require(_0x58c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x58c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x58c1('0x11'));var authService=require(_0x58c1('0x12'));var qs=require(_0x58c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x58c1('0x14'))('api');var utils=require(_0x58c1('0x15'));var config=require(_0x58c1('0x16'));var licenseUtil=require(_0x58c1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4634aa,_0x3667f1){_0x3667f1=_0x3667f1||0xcc;return function(_0x2cf5d3){if(_0x2cf5d3){return _0x4634aa['sendStatus'](_0x3667f1);}return _0x4634aa[_0x58c1('0x18')](_0x3667f1)[_0x58c1('0x19')]();};}function respondWithResult(_0x3deccf,_0x47ae41){_0x47ae41=_0x47ae41||0xc8;return function(_0x1b99ff){if(_0x1b99ff){return _0x3deccf[_0x58c1('0x18')](_0x47ae41)[_0x58c1('0x1a')](_0x1b99ff);}};}function respondWithFilteredResult(_0x4566f5,_0x58da15){return function(_0x7a4c50){if(_0x7a4c50){var _0x141910=typeof _0x58da15[_0x58c1('0x1b')]===_0x58c1('0x1c')&&typeof _0x58da15['limit']===_0x58c1('0x1c');var _0x53d256=_0x7a4c50[_0x58c1('0x1d')];var _0x47c5f2=_0x141910?0x0:_0x58da15[_0x58c1('0x1b')];var _0x5322ef=_0x141910?_0x7a4c50['count']:_0x58da15['offset']+_0x58da15['limit'];var _0x352bf3;if(_0x5322ef>=_0x53d256){_0x5322ef=_0x53d256;_0x352bf3=0xc8;}else{_0x352bf3=0xce;}_0x4566f5[_0x58c1('0x18')](_0x352bf3);return _0x4566f5[_0x58c1('0x1e')](_0x58c1('0x1f'),_0x47c5f2+'-'+_0x5322ef+'/'+_0x53d256)['json'](_0x7a4c50);}return null;};}function patchUpdates(_0x4425be){return function(_0x5bc7b3){try{jsonpatch[_0x58c1('0x20')](_0x5bc7b3,_0x4425be,!![]);}catch(_0x53d6c7){return BPromise[_0x58c1('0x21')](_0x53d6c7);}return _0x5bc7b3[_0x58c1('0x22')]();};}function saveUpdates(_0x32ede3,_0x547071){return function(_0x3f51c9){if(_0x3f51c9){return _0x3f51c9[_0x58c1('0x23')](_0x32ede3)[_0x58c1('0x24')](function(_0x2d48c6){return _0x2d48c6;});}return null;};}function removeEntity(_0x4447a6,_0x5d0cf8){return function(_0xa73f11){if(_0xa73f11){return _0xa73f11[_0x58c1('0x25')]()[_0x58c1('0x24')](function(){_0x4447a6[_0x58c1('0x18')](0xcc)[_0x58c1('0x19')]();});}};}function handleEntityNotFound(_0x547446,_0x1e756b){return function(_0x4c90ed){if(!_0x4c90ed){_0x547446[_0x58c1('0x26')](0x194);}return _0x4c90ed;};}function handleError(_0x1fd2c8,_0x59153e){_0x59153e=_0x59153e||0x1f4;return function(_0x3c8814){logger[_0x58c1('0x27')](_0x3c8814[_0x58c1('0x28')]);if(_0x3c8814['name']){delete _0x3c8814[_0x58c1('0x29')];}_0x1fd2c8[_0x58c1('0x18')](_0x59153e)[_0x58c1('0x2a')](_0x3c8814);};}exports['index']=function(_0x47eb48,_0x335f17){var _0x4757a5={},_0x5f337f={},_0x12d4e1={'count':0x0,'rows':[]};var _0x3561c2=_[_0x58c1('0x2b')](db['VoiceMailMessage'][_0x58c1('0x2c')],function(_0x293bc2){return{'name':_0x293bc2[_0x58c1('0x2d')],'type':_0x293bc2[_0x58c1('0x2e')]['key']};});_0x5f337f[_0x58c1('0x2f')]=_['differenceBy'](_[_0x58c1('0x2b')](_0x3561c2,_0x58c1('0x29')),['name']);_0x5f337f['query']=_[_0x58c1('0x30')](_0x47eb48[_0x58c1('0x31')]);_0x5f337f[_0x58c1('0x32')]=_[_0x58c1('0x33')](_0x5f337f[_0x58c1('0x2f')],_0x5f337f[_0x58c1('0x31')]);_0x4757a5['attributes']=_[_0x58c1('0x33')](_0x5f337f[_0x58c1('0x2f')],qs['fields'](_0x47eb48['query'][_0x58c1('0x34')]));_0x4757a5['attributes']=_0x4757a5['attributes'][_0x58c1('0x35')]?_0x4757a5[_0x58c1('0x36')]:_0x5f337f[_0x58c1('0x2f')];if(!_0x47eb48[_0x58c1('0x31')][_0x58c1('0x37')]('nolimit')){_0x4757a5[_0x58c1('0x38')]=qs['limit'](_0x47eb48[_0x58c1('0x31')]['limit']);_0x4757a5[_0x58c1('0x1b')]=qs['offset'](_0x47eb48[_0x58c1('0x31')][_0x58c1('0x1b')]);}_0x4757a5['order']=qs[_0x58c1('0x39')](_0x47eb48[_0x58c1('0x31')]['sort']);_0x4757a5[_0x58c1('0x3a')]=qs[_0x58c1('0x32')](_[_0x58c1('0x3b')](_0x47eb48[_0x58c1('0x31')],_0x5f337f[_0x58c1('0x32')]),_0x3561c2);if(_0x47eb48[_0x58c1('0x31')][_0x58c1('0x3c')]){_0x4757a5[_0x58c1('0x3a')]=_[_0x58c1('0x3d')](_0x4757a5[_0x58c1('0x3a')],{'$or':_[_0x58c1('0x2b')](_0x3561c2,function(_0x36a920){if(_0x36a920[_0x58c1('0x2e')]!=='VIRTUAL'){var _0x1a7995={};_0x1a7995[_0x36a920[_0x58c1('0x29')]]={'$like':'%'+_0x47eb48['query'][_0x58c1('0x3c')]+'%'};return _0x1a7995;}})});}_0x4757a5=_[_0x58c1('0x3d')]({},_0x4757a5,_0x47eb48['options']);var _0x23ab61={'where':_0x4757a5[_0x58c1('0x3a')]};return db['VoiceMailMessage'][_0x58c1('0x1d')](_0x23ab61)['then'](function(_0x33f33d){_0x12d4e1[_0x58c1('0x1d')]=_0x33f33d;if(_0x47eb48[_0x58c1('0x31')][_0x58c1('0x3e')]){_0x4757a5[_0x58c1('0x3f')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x58c1('0x40')](_0x4757a5);})[_0x58c1('0x24')](function(_0x4477b1){_0x12d4e1[_0x58c1('0x41')]=_0x4477b1;return _0x12d4e1;})[_0x58c1('0x24')](respondWithFilteredResult(_0x335f17,_0x4757a5))[_0x58c1('0x42')](handleError(_0x335f17,null));};exports['show']=function(_0x443eb1,_0x391319){var _0xe7d0dd={'raw':!![],'where':{'id':_0x443eb1[_0x58c1('0x43')]['id']}},_0x1446a0={};_0x1446a0['model']=_[_0x58c1('0x30')](db[_0x58c1('0x44')][_0x58c1('0x2c')]);_0x1446a0['query']=_[_0x58c1('0x30')](_0x443eb1['query']);_0x1446a0[_0x58c1('0x32')]=_[_0x58c1('0x33')](_0x1446a0[_0x58c1('0x2f')],_0x1446a0[_0x58c1('0x31')]);_0xe7d0dd[_0x58c1('0x36')]=_[_0x58c1('0x33')](_0x1446a0[_0x58c1('0x2f')],qs[_0x58c1('0x34')](_0x443eb1[_0x58c1('0x31')]['fields']));_0xe7d0dd[_0x58c1('0x36')]=_0xe7d0dd[_0x58c1('0x36')]['length']?_0xe7d0dd[_0x58c1('0x36')]:_0x1446a0[_0x58c1('0x2f')];if(_0x443eb1[_0x58c1('0x31')]['includeAll']){_0xe7d0dd['include']=[{'all':!![]}];}_0xe7d0dd=_['merge']({},_0xe7d0dd,_0x443eb1[_0x58c1('0x45')]);return db[_0x58c1('0x44')][_0x58c1('0x46')](_0xe7d0dd)['then'](handleEntityNotFound(_0x391319,null))['then'](respondWithResult(_0x391319,null))['catch'](handleError(_0x391319,null));};exports[_0x58c1('0x47')]=function(_0x36f8bc,_0x2b8f15){return db[_0x58c1('0x44')]['create'](_0x36f8bc['body'],{})[_0x58c1('0x24')](respondWithResult(_0x2b8f15,0xc9))['catch'](handleError(_0x2b8f15,null));};exports[_0x58c1('0x23')]=function(_0x417a32,_0x5cbc95){if(_0x417a32['body']['id']){delete _0x417a32[_0x58c1('0x48')]['id'];}return db[_0x58c1('0x44')][_0x58c1('0x46')]({'where':{'id':_0x417a32['params']['id']}})[_0x58c1('0x24')](handleEntityNotFound(_0x5cbc95,null))[_0x58c1('0x24')](saveUpdates(_0x417a32['body'],null))[_0x58c1('0x24')](respondWithResult(_0x5cbc95,null))[_0x58c1('0x42')](handleError(_0x5cbc95,null));};exports[_0x58c1('0x25')]=function(_0x322ce5,_0x59142c){return db[_0x58c1('0x44')][_0x58c1('0x46')]({'where':{'id':_0x322ce5[_0x58c1('0x43')]['id']}})['then'](handleEntityNotFound(_0x59142c,null))[_0x58c1('0x24')](removeEntity(_0x59142c,null))[_0x58c1('0x42')](handleError(_0x59142c,null));};exports[_0x58c1('0x49')]=function(_0x523073,_0x8e5a8,_0x3f3852){return db['VoiceMailMessage']['find']({'where':{'id':_0x523073[_0x58c1('0x43')]['id']},'attributes':['id',_0x58c1('0x4a'),'msg_id']})['then'](handleEntityNotFound(_0x8e5a8,null))[_0x58c1('0x24')](function(_0xc0bef1){if(_0xc0bef1){if(!_0xc0bef1[_0x58c1('0x4a')]){throw new db['Sequelize']['ValidationError'](_0x58c1('0x4b'));}var _0x4890bb={'Content-Type':_0x58c1('0x4c'),'Content-Disposition':'attachment'};if(_0xc0bef1[_0x58c1('0x4d')]){_0x4890bb[_0x58c1('0x4e')]=_0x58c1('0x4f')+_0xc0bef1['msg_id']+_0x58c1('0x50');}_0x8e5a8['set'](_0x4890bb);return _0x8e5a8['send'](new Buffer(_0xc0bef1[_0x58c1('0x4a')]));}})[_0x58c1('0x42')](handleError(_0x8e5a8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c2f048e..89e024a 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 _0xf998=['voice_voicemail_messages','dir','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x295a59,_0x3cf1a9){var _0x4629af=function(_0x367196){while(--_0x367196){_0x295a59['push'](_0x295a59['shift']());}};_0x4629af(++_0x3cf1a9);}(_0xf998,0x10a));var _0x8f99=function(_0x4801bd,_0x368071){_0x4801bd=_0x4801bd-0x0;var _0x3cf6fc=_0xf998[_0x4801bd];return _0x3cf6fc;};'use strict';var _=require(_0x8f99('0x0'));var util=require('util');var logger=require(_0x8f99('0x1'))(_0x8f99('0x2'));var moment=require('moment');var BPromise=require(_0x8f99('0x3'));var rp=require(_0x8f99('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f99('0x5'));var config=require(_0x8f99('0x6'));var attributes=require(_0x8f99('0x7'));module[_0x8f99('0x8')]=function(_0x1a660c,_0x3bde5b){return _0x1a660c['define'](_0x8f99('0x9'),attributes,{'tableName':_0x8f99('0xa'),'paranoid':![],'indexes':[{'name':_0x8f99('0xb'),'fields':[_0x8f99('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x83cd=['bluebird','request-promise','path','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment'];(function(_0x20895b,_0x198888){var _0x4147ab=function(_0x3444ea){while(--_0x3444ea){_0x20895b['push'](_0x20895b['shift']());}};_0x4147ab(++_0x198888);}(_0x83cd,0xa5));var _0xd83c=function(_0x49c34f,_0x5ed4f8){_0x49c34f=_0x49c34f-0x0;var _0x12c74a=_0x83cd[_0x49c34f];return _0x12c74a;};'use strict';var _=require(_0xd83c('0x0'));var util=require(_0xd83c('0x1'));var logger=require(_0xd83c('0x2'))('api');var moment=require(_0xd83c('0x3'));var BPromise=require(_0xd83c('0x4'));var rp=require(_0xd83c('0x5'));var fs=require('fs');var path=require(_0xd83c('0x6'));var rimraf=require(_0xd83c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xd83c('0x8')]=function(_0x19df6a,_0x1278e9){return _0x19df6a[_0xd83c('0x9')](_0xd83c('0xa'),attributes,{'tableName':_0xd83c('0xb'),'paranoid':![],'indexes':[{'name':_0xd83c('0xc'),'fields':[_0xd83c('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 52b55d4..7a46845 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 _0x83b1=['request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x504c5f,_0x4c9421){var _0x483c8e=function(_0x2a071e){while(--_0x2a071e){_0x504c5f['push'](_0x504c5f['shift']());}};_0x483c8e(++_0x4c9421);}(_0x83b1,0xf1));var _0x183b=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x83b1[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x183b('0x0'));var util=require(_0x183b('0x1'));var moment=require(_0x183b('0x2'));var BPromise=require(_0x183b('0x3'));var rs=require(_0x183b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x183b('0x5'))(_0x183b('0x6'));var config=require(_0x183b('0x7'));var jayson=require(_0x183b('0x8'));var client=jayson[_0x183b('0x9')][_0x183b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad52c,_0x4e13e6,_0xca0b6c){return new BPromise(function(_0x596bc1,_0x55ff0f){return client[_0x183b('0xb')](_0x3ad52c,_0xca0b6c)['then'](function(_0x4312a3){logger[_0x183b('0xc')](_0x183b('0xd'),_0x4e13e6,_0x183b('0xe'));logger[_0x183b('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4e13e6,'request\x20sent',JSON[_0x183b('0x10')](_0x4312a3));if(_0x4312a3[_0x183b('0x11')]){if(_0x4312a3[_0x183b('0x11')][_0x183b('0x12')]===0x1f4){logger[_0x183b('0x11')](_0x183b('0xd'),_0x4e13e6,_0x4312a3[_0x183b('0x11')]['message']);return _0x55ff0f(_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);}logger[_0x183b('0x11')](_0x183b('0xd'),_0x4e13e6,_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);return _0x596bc1(_0x4312a3[_0x183b('0x11')][_0x183b('0x13')]);}else{logger['info'](_0x183b('0xd'),_0x4e13e6,'request\x20sent');_0x596bc1(_0x4312a3[_0x183b('0x14')][_0x183b('0x13')]);}})['catch'](function(_0x255729){logger[_0x183b('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x4e13e6,_0x255729);_0x55ff0f(_0x255729);});});} \ No newline at end of file +var _0xa2fa=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xf0940e,_0x23b020){var _0x21c011=function(_0x473e38){while(--_0x473e38){_0xf0940e['push'](_0xf0940e['shift']());}};_0x21c011(++_0x23b020);}(_0xa2fa,0xd5));var _0xaa2f=function(_0x2f9aee,_0x29b9d4){_0x2f9aee=_0x2f9aee-0x0;var _0x39581e=_0xa2fa[_0x2f9aee];return _0x39581e;};'use strict';var _=require(_0xaa2f('0x0'));var util=require(_0xaa2f('0x1'));var moment=require(_0xaa2f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa2f('0x3'));var db=require(_0xaa2f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa2f('0x5'))(_0xaa2f('0x6'));var config=require(_0xaa2f('0x7'));var jayson=require(_0xaa2f('0x8'));var client=jayson[_0xaa2f('0x9')][_0xaa2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460a3d,_0x497dfe,_0xa76132){return new BPromise(function(_0x1330fa,_0x39c76a){return client[_0xaa2f('0xb')](_0x460a3d,_0xa76132)[_0xaa2f('0xc')](function(_0x39a395){logger['info'](_0xaa2f('0xd'),_0x497dfe,_0xaa2f('0xe'));logger[_0xaa2f('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x497dfe,'request\x20sent',JSON[_0xaa2f('0x10')](_0x39a395));if(_0x39a395[_0xaa2f('0x11')]){if(_0x39a395['error']['code']===0x1f4){logger[_0xaa2f('0x11')](_0xaa2f('0xd'),_0x497dfe,_0x39a395[_0xaa2f('0x11')][_0xaa2f('0x12')]);return _0x39c76a(_0x39a395[_0xaa2f('0x11')][_0xaa2f('0x12')]);}logger[_0xaa2f('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x497dfe,_0x39a395[_0xaa2f('0x11')][_0xaa2f('0x12')]);return _0x1330fa(_0x39a395[_0xaa2f('0x11')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x497dfe,'request\x20sent');_0x1330fa(_0x39a395[_0xaa2f('0x13')][_0xaa2f('0x12')]);}})[_0xaa2f('0x14')](function(_0x88900b){logger[_0xaa2f('0x11')](_0xaa2f('0xd'),_0x497dfe,_0x88900b);_0x39c76a(_0x88900b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a1be49c..1c0bebd 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 _0xa5af=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound'];(function(_0x2a8f43,_0x7126e){var _0xec242=function(_0x25e423){while(--_0x25e423){_0x2a8f43['push'](_0x2a8f43['shift']());}};_0xec242(++_0x7126e);}(_0xa5af,0x1d4));var _0xfa5a=function(_0x3e0104,_0x2916c0){_0x3e0104=_0x3e0104-0x0;var _0x5bf813=_0xa5af[_0x3e0104];return _0x5bf813;};'use strict';var multer=require(_0xfa5a('0x0'));var util=require('util');var path=require(_0xfa5a('0x1'));var timeout=require(_0xfa5a('0x2'));var express=require('express');var router=express[_0xfa5a('0x3')]();var fs_extra=require(_0xfa5a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfa5a('0x5'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xfa5a('0x6')](),controller['index']);router[_0xfa5a('0x7')](_0xfa5a('0x8'),auth['isAuthenticated'](),controller[_0xfa5a('0x9')]);router[_0xfa5a('0x7')](_0xfa5a('0xa'),auth['isAuthenticated'](),controller[_0xfa5a('0xb')]);router[_0xfa5a('0xc')]('/',auth[_0xfa5a('0x6')](),controller[_0xfa5a('0xd')]);router[_0xfa5a('0xc')](_0xfa5a('0xa'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0xe')]);router[_0xfa5a('0xf')](_0xfa5a('0x8'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x10')]);router['delete'](_0xfa5a('0x8'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x11')]);router[_0xfa5a('0x12')](_0xfa5a('0x13'),auth[_0xfa5a('0x6')](),controller[_0xfa5a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5594=['delete','destroy','/:id/sounds/:id2','removeSound','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/sounds','create','post','addSound'];(function(_0x2a6caf,_0xca9d4c){var _0x352aff=function(_0x480b8a){while(--_0x480b8a){_0x2a6caf['push'](_0x2a6caf['shift']());}};_0x352aff(++_0xca9d4c);}(_0x5594,0x149));var _0x4559=function(_0xc48869,_0x56b37b){_0xc48869=_0xc48869-0x0;var _0x1f5dca=_0x5594[_0xc48869];return _0x1f5dca;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4559('0x0'));var express=require(_0x4559('0x1'));var router=express[_0x4559('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4559('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4559('0x4'));var controller=require('./voiceMusicOnHold.controller');router[_0x4559('0x5')]('/',auth['isAuthenticated'](),controller[_0x4559('0x6')]);router[_0x4559('0x5')](_0x4559('0x7'),auth[_0x4559('0x8')](),controller['show']);router[_0x4559('0x5')](_0x4559('0x9'),auth['isAuthenticated'](),controller['getSounds']);router['post']('/',auth[_0x4559('0x8')](),controller[_0x4559('0xa')]);router[_0x4559('0xb')]('/:id/sounds',auth[_0x4559('0x8')](),controller[_0x4559('0xc')]);router['put'](_0x4559('0x7'),auth[_0x4559('0x8')](),controller['update']);router[_0x4559('0xd')](_0x4559('0x7'),auth[_0x4559('0x8')](),controller[_0x4559('0xe')]);router[_0x4559('0xd')](_0x4559('0xf'),auth[_0x4559('0x8')](),controller[_0x4559('0x10')]);module[_0x4559('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 8b4b2a7..1f75e7b 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 _0x7126=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb'];(function(_0x3ed1cc,_0x49a6fd){var _0x6a5053=function(_0x1638b9){while(--_0x1638b9){_0x3ed1cc['push'](_0x3ed1cc['shift']());}};_0x6a5053(++_0x49a6fd);}(_0x7126,0x1c1));var _0x6712=function(_0x4018b8,_0x5bd123){_0x4018b8=_0x4018b8-0x0;var _0x92d7ed=_0x7126[_0x4018b8];return _0x92d7ed;};'use strict';var Sequelize=require('sequelize');module[_0x6712('0x0')]={'name':{'type':Sequelize[_0x6712('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x6712('0x2')](_0x6712('0x3'),_0x6712('0x4'),_0x6712('0x5'),_0x6712('0x6'),_0x6712('0x7'),_0x6712('0x8')),'allowNull':!![],'defaultValue':_0x6712('0x4')},'directory':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![],'defaultValue':_0x6712('0x9')},'format':{'type':Sequelize[_0x6712('0x1')],'allowNull':!![]},'stamp':{'type':_0x6712('0xa')},'defaultEntry':{'type':Sequelize[_0x6712('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfae2=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM'];(function(_0xbbafe1,_0x23d828){var _0x4f703e=function(_0x322e13){while(--_0x322e13){_0xbbafe1['push'](_0xbbafe1['shift']());}};_0x4f703e(++_0x23d828);}(_0xfae2,0x19d));var _0x2fae=function(_0x11aee5,_0x27fa94){_0x11aee5=_0x11aee5-0x0;var _0x2e8c9d=_0xfae2[_0x11aee5];return _0x2e8c9d;};'use strict';var Sequelize=require(_0x2fae('0x0'));module[_0x2fae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x2fae('0x2')](_0x2fae('0x3'),_0x2fae('0x4'),_0x2fae('0x5'),_0x2fae('0x6'),_0x2fae('0x7'),_0x2fae('0x8')),'allowNull':!![],'defaultValue':_0x2fae('0x4')},'directory':{'type':Sequelize[_0x2fae('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x2fae('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2fae('0x9')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2fae('0x9')],'allowNull':!![],'defaultValue':_0x2fae('0xa')},'format':{'type':Sequelize[_0x2fae('0x9')],'allowNull':!![]},'stamp':{'type':_0x2fae('0xb')},'defaultEntry':{'type':Sequelize[_0x2fae('0xc')],'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 93f4205..61ffdb2 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 _0x18e2=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','findAll','rows','catch','show','params','keys','length','includeAll','find','update','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','id2','Sequelize','ValidationError','getSounds','order','filter'];(function(_0x4599b6,_0x40c254){var _0x2e014c=function(_0x3c4d90){while(--_0x3c4d90){_0x4599b6['push'](_0x4599b6['shift']());}};_0x2e014c(++_0x40c254);}(_0x18e2,0x71));var _0x218e=function(_0x3db9b7,_0x1da6eb){_0x3db9b7=_0x3db9b7-0x0;var _0x5e3911=_0x18e2[_0x3db9b7];return _0x5e3911;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x218e('0x0'));var zipdir=require(_0x218e('0x1'));var jsonpatch=require(_0x218e('0x2'));var rp=require(_0x218e('0x3'));var moment=require('moment');var BPromise=require(_0x218e('0x4'));var Mustache=require(_0x218e('0x5'));var util=require(_0x218e('0x6'));var path=require(_0x218e('0x7'));var sox=require('sox');var csv=require(_0x218e('0x8'));var ejs=require(_0x218e('0x9'));var fs=require('fs');var fs_extra=require(_0x218e('0xa'));var _=require(_0x218e('0xb'));var squel=require(_0x218e('0xc'));var crypto=require(_0x218e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x218e('0x8'));var querystring=require(_0x218e('0xe'));var Papa=require(_0x218e('0xf'));var Redis=require('ioredis');var authService=require(_0x218e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x218e('0x11'));var hardwareService=require(_0x218e('0x12'));var logger=require(_0x218e('0x13'))(_0x218e('0x14'));var utils=require(_0x218e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x218e('0x16'));var db=require(_0x218e('0x17'))['db'];function respondWithStatusCode(_0x5494c7,_0x1f9234){_0x1f9234=_0x1f9234||0xcc;return function(_0x311a88){if(_0x311a88){return _0x5494c7[_0x218e('0x18')](_0x1f9234);}return _0x5494c7[_0x218e('0x19')](_0x1f9234)[_0x218e('0x1a')]();};}function respondWithResult(_0xbbce20,_0x53effc){_0x53effc=_0x53effc||0xc8;return function(_0x40d173){if(_0x40d173){return _0xbbce20[_0x218e('0x19')](_0x53effc)[_0x218e('0x1b')](_0x40d173);}};}function respondWithFilteredResult(_0x3698c0,_0x20bd2a){return function(_0x4e9f74){if(_0x4e9f74){var _0x46c8ee=typeof _0x20bd2a[_0x218e('0x1c')]==='undefined'&&typeof _0x20bd2a[_0x218e('0x1d')]===_0x218e('0x1e');var _0x35da6a=_0x4e9f74[_0x218e('0x1f')];var _0x22e9d0=_0x46c8ee?0x0:_0x20bd2a[_0x218e('0x1c')];var _0xb73503=_0x46c8ee?_0x4e9f74['count']:_0x20bd2a[_0x218e('0x1c')]+_0x20bd2a['limit'];var _0x224696;if(_0xb73503>=_0x35da6a){_0xb73503=_0x35da6a;_0x224696=0xc8;}else{_0x224696=0xce;}_0x3698c0['status'](_0x224696);return _0x3698c0[_0x218e('0x20')](_0x218e('0x21'),_0x22e9d0+'-'+_0xb73503+'/'+_0x35da6a)[_0x218e('0x1b')](_0x4e9f74);}return null;};}function patchUpdates(_0x1ac792){return function(_0x9d06ec){try{jsonpatch['apply'](_0x9d06ec,_0x1ac792,!![]);}catch(_0x1f9b49){return BPromise['reject'](_0x1f9b49);}return _0x9d06ec[_0x218e('0x22')]();};}function saveUpdates(_0x3ccb70,_0x2f5c22){return function(_0x2286e3){if(_0x2286e3){return _0x2286e3['update'](_0x3ccb70)[_0x218e('0x23')](function(_0x3b2ce2){return _0x3b2ce2;});}return null;};}function removeEntity(_0x9b4a84,_0x34c95c){return function(_0x336acf){if(_0x336acf){return _0x336acf[_0x218e('0x24')]()[_0x218e('0x23')](function(){var _0x220b7a=_0x336acf['get']({'plain':!![]});var _0x27435a=_0x218e('0x25');return db[_0x218e('0x26')]['destroy']({'where':{'type':_0x27435a,'resourceId':_0x220b7a['id']}})[_0x218e('0x23')](function(){return _0x336acf;});})[_0x218e('0x23')](function(){_0x9b4a84[_0x218e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58c10b,_0x18f824){return function(_0x21dca5){if(!_0x21dca5){_0x58c10b['sendStatus'](0x194);}return _0x21dca5;};}function handleError(_0x241071,_0x37ef4e){_0x37ef4e=_0x37ef4e||0x1f4;return function(_0x372e8f){logger[_0x218e('0x27')](_0x372e8f[_0x218e('0x28')]);if(_0x372e8f[_0x218e('0x29')]){delete _0x372e8f['name'];}_0x241071[_0x218e('0x19')](_0x37ef4e)[_0x218e('0x2a')](_0x372e8f);};}exports[_0x218e('0x2b')]=function(_0x220f6a,_0x13ab0a){var _0x38da93={},_0x4c79bc={},_0x420740={'count':0x0,'rows':[]};var _0x1e9026=_[_0x218e('0x2c')](db[_0x218e('0x2d')][_0x218e('0x2e')],function(_0x16bd45){return{'name':_0x16bd45[_0x218e('0x2f')],'type':_0x16bd45[_0x218e('0x30')][_0x218e('0x31')]};});_0x4c79bc[_0x218e('0x32')]=_['map'](_0x1e9026,'name');_0x4c79bc[_0x218e('0x33')]=_['keys'](_0x220f6a['query']);_0x4c79bc['filters']=_[_0x218e('0x34')](_0x4c79bc[_0x218e('0x32')],_0x4c79bc[_0x218e('0x33')]);_0x38da93[_0x218e('0x35')]=_[_0x218e('0x34')](_0x4c79bc[_0x218e('0x32')],qs[_0x218e('0x36')](_0x220f6a['query'][_0x218e('0x36')]));_0x38da93[_0x218e('0x35')]=_0x38da93[_0x218e('0x35')]['length']?_0x38da93['attributes']:_0x4c79bc[_0x218e('0x32')];if(!_0x220f6a['query'][_0x218e('0x37')](_0x218e('0x38'))){_0x38da93[_0x218e('0x1d')]=qs[_0x218e('0x1d')](_0x220f6a[_0x218e('0x33')][_0x218e('0x1d')]);_0x38da93[_0x218e('0x1c')]=qs[_0x218e('0x1c')](_0x220f6a[_0x218e('0x33')]['offset']);}_0x38da93['order']=qs[_0x218e('0x39')](_0x220f6a[_0x218e('0x33')]['sort']);delete _0x220f6a[_0x218e('0x33')]['sort'];_0x38da93[_0x218e('0x3a')]=qs[_0x218e('0x3b')](_[_0x218e('0x3c')](_0x220f6a['query'],_0x4c79bc[_0x218e('0x3b')]),_0x1e9026);if(_0x220f6a['query']['filter']){_0x38da93[_0x218e('0x3a')]=_[_0x218e('0x3d')](_0x38da93['where'],{'$or':_['map'](_0x1e9026,function(_0x406a40){if(_0x406a40[_0x218e('0x30')]!=='VIRTUAL'){var _0x147f27={};_0x147f27[_0x406a40['name']]={'$like':'%'+_0x220f6a[_0x218e('0x33')]['filter']+'%'};return _0x147f27;}})});}_0x38da93=_['merge']({},_0x38da93,_0x220f6a[_0x218e('0x3e')]);var _0x22c29c={'where':_0x38da93[_0x218e('0x3a')]};return db[_0x218e('0x2d')][_0x218e('0x1f')](_0x22c29c)[_0x218e('0x23')](function(_0x5c9fa0){_0x420740[_0x218e('0x1f')]=_0x5c9fa0;if(_0x220f6a[_0x218e('0x33')]['includeAll']){_0x38da93['include']=[{'all':!![]}];}return db[_0x218e('0x2d')][_0x218e('0x3f')](_0x38da93);})[_0x218e('0x23')](function(_0x41da36){_0x420740[_0x218e('0x40')]=_0x41da36;return _0x420740;})[_0x218e('0x23')](respondWithFilteredResult(_0x13ab0a,_0x38da93))[_0x218e('0x41')](handleError(_0x13ab0a,null));};exports[_0x218e('0x42')]=function(_0x1bb940,_0x102a1f){var _0x371e7d={'raw':![],'where':{'id':_0x1bb940[_0x218e('0x43')]['id']}},_0x46c67e={};_0x46c67e[_0x218e('0x32')]=_[_0x218e('0x44')](db['VoiceMusicOnHold']['rawAttributes']);_0x46c67e[_0x218e('0x33')]=_[_0x218e('0x44')](_0x1bb940['query']);_0x46c67e[_0x218e('0x3b')]=_[_0x218e('0x34')](_0x46c67e[_0x218e('0x32')],_0x46c67e[_0x218e('0x33')]);_0x371e7d[_0x218e('0x35')]=_[_0x218e('0x34')](_0x46c67e[_0x218e('0x32')],qs[_0x218e('0x36')](_0x1bb940[_0x218e('0x33')][_0x218e('0x36')]));_0x371e7d[_0x218e('0x35')]=_0x371e7d[_0x218e('0x35')][_0x218e('0x45')]?_0x371e7d['attributes']:_0x46c67e[_0x218e('0x32')];if(_0x1bb940[_0x218e('0x33')][_0x218e('0x46')]){_0x371e7d['include']=[{'all':!![]}];}_0x371e7d=_[_0x218e('0x3d')]({},_0x371e7d,_0x1bb940[_0x218e('0x3e')]);return db['VoiceMusicOnHold'][_0x218e('0x47')](_0x371e7d)[_0x218e('0x23')](handleEntityNotFound(_0x102a1f,null))[_0x218e('0x23')](respondWithResult(_0x102a1f,null))[_0x218e('0x41')](handleError(_0x102a1f,null));};exports[_0x218e('0x48')]=function(_0x538b25,_0x292c78){if(_0x538b25[_0x218e('0x49')]['id']){delete _0x538b25[_0x218e('0x49')]['id'];}return db[_0x218e('0x2d')]['find']({'where':{'id':_0x538b25['params']['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x292c78,null))['then'](saveUpdates(_0x538b25['body'],null))[_0x218e('0x23')](respondWithResult(_0x292c78,null))[_0x218e('0x41')](handleError(_0x292c78,null));};exports[_0x218e('0x4a')]=function(_0x52a911,_0x53f1e5,_0x5c92ce){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x4b4299){if(_0x52a911[_0x218e('0x49')][_0x218e('0x4d')]===_0x218e('0x4e')){_0x52a911[_0x218e('0x49')]['directory']=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x51'),_0x52a911[_0x218e('0x49')]['name']);}return db[_0x218e('0x2d')][_0x218e('0x4a')](_0x52a911[_0x218e('0x49')],{'transaction':_0x4b4299})[_0x218e('0x23')](function(_0xd7548c){if(_0x52a911[_0x218e('0x49')][_0x218e('0x4d')]==='files'){fs[_0x218e('0x52')](_0xd7548c[_0x218e('0x53')],parseInt(_0x218e('0x54'),0x8));}var _0x432593=_0x52a911['user'][_0x218e('0x55')]({'plain':!![]});if(!_0x432593)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x432593[_0x218e('0x56')]===_0x218e('0x57')){var _0x5b1646=_0xd7548c[_0x218e('0x55')]({'plain':!![]});return db[_0x218e('0x58')][_0x218e('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x432593['userProfileId']},'raw':!![]})[_0x218e('0x23')](function(_0x501dbe){if(_0x501dbe&&_0x501dbe[_0x218e('0x59')]===0x0){return db['UserProfileResource'][_0x218e('0x4a')]({'name':_0x5b1646[_0x218e('0x29')],'resourceId':_0x5b1646['id'],'type':_0x501dbe[_0x218e('0x29')],'sectionId':_0x501dbe['id']},{})[_0x218e('0x23')](function(){return _0xd7548c;});}else{return _0xd7548c;}})[_0x218e('0x41')](function(_0x1a59c7){logger['error'](_0x218e('0x5a'),_0x1a59c7);});}return _0xd7548c;});})['then'](respondWithResult(_0x53f1e5,0xc9))['catch'](handleError(_0x53f1e5,null));};exports[_0x218e('0x24')]=function(_0x20d462,_0x561675,_0x5e5fc1){var _0x5c3d75;return db[_0x218e('0x2d')]['find']({'where':{'id':_0x20d462['params']['id']}})[_0x218e('0x23')](function(_0x1e91a4){if(_0x1e91a4){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x5c3540){return _0x1e91a4[_0x218e('0x24')]({'transaction':_0x5c3540,'raw':!![]})[_0x218e('0x23')](function(_0x5db0b5){if(_0x5db0b5[_0x218e('0x53')]){fs[_0x218e('0x5b')](_0x5db0b5[_0x218e('0x53')])[_0x218e('0x5c')](function(_0x5399c9){fs[_0x218e('0x5d')](path['join'](_0x5db0b5['directory'],_0x5399c9));});fs[_0x218e('0x5e')](_0x5db0b5['directory']);}return _0x5db0b5;});})[_0x218e('0x41')](function(_0x308ab1){throw new db['Sequelize']['ValidationError'](_0x308ab1[_0x218e('0x5f')]);});}})[_0x218e('0x23')](handleEntityNotFound(_0x561675,null))[_0x218e('0x23')](removeEntity(_0x561675,null))[_0x218e('0x41')](handleError(_0x561675,null));};exports[_0x218e('0x60')]=function(_0x20e918,_0x476d33,_0x281cb6){return db['sequelize'][_0x218e('0x4c')](function(_0x42212f){var _0x24920f;return db[_0x218e('0x2d')][_0x218e('0x47')]({'where':{'id':_0x20e918[_0x218e('0x43')]['id']}})[_0x218e('0x23')](function(_0x4593f9){if(_0x4593f9){_0x24920f=_0x4593f9;return _0x4593f9[_0x218e('0x60')](_0x20e918[_0x218e('0x49')]['id'],{'transaction':_0x42212f});}})[_0x218e('0x23')](function(_0x5d3cb2){if(_0x5d3cb2){return db[_0x218e('0x61')][_0x218e('0x62')]({'where':{'id':_0x20e918['body']['id']},'attributes':['id',_0x218e('0x29'),_0x218e('0x63'),'converted_format',_0x218e('0x64')],'raw':!![]});}})[_0x218e('0x23')](function(_0x1c4d6b){if(_0x1c4d6b){var _0x5e4201=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x65'),util[_0x218e('0x66')](_0x218e('0x67'),path[_0x218e('0x68')](_0x1c4d6b[_0x218e('0x63')],path['extname'](_0x1c4d6b[_0x218e('0x63')])),_0x1c4d6b[_0x218e('0x69')]));var _0x1c940b=path[_0x218e('0x4f')](config[_0x218e('0x50')],_0x218e('0x51'),_0x24920f[_0x218e('0x29')],util[_0x218e('0x66')](_0x218e('0x67'),_0x1c4d6b[_0x218e('0x29')],_0x1c4d6b[_0x218e('0x69')]));fs[_0x218e('0x6a')](_0x5e4201,_0x1c940b);return _0x1c4d6b;}})[_0x218e('0x41')](function(_0x5ccec8){throw new db['Sequelize']['ValidationError'](_0x5ccec8[_0x218e('0x5f')]);});})[_0x218e('0x23')](handleEntityNotFound(_0x476d33,null))[_0x218e('0x23')](respondWithResult(_0x476d33,0xc9))[_0x218e('0x41')](handleError(_0x476d33,null));};exports['removeSound']=function(_0x1d8a0c,_0x150c88,_0xb1106d){return db[_0x218e('0x4b')][_0x218e('0x4c')](function(_0x33aad1){var _0x189e45;return db[_0x218e('0x2d')][_0x218e('0x62')]({'where':{'id':_0x1d8a0c['params']['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x150c88,null))[_0x218e('0x23')](function(_0x49c4f4){if(_0x49c4f4){_0x189e45=_0x49c4f4;return _0x49c4f4['removeSound'](_0x1d8a0c[_0x218e('0x43')]['id2']);}})['then'](function(_0x5d67d6){if(_0x5d67d6){return db[_0x218e('0x61')][_0x218e('0x62')]({'where':{'id':_0x1d8a0c[_0x218e('0x43')][_0x218e('0x6b')]},'attributes':['id',_0x218e('0x29'),_0x218e('0x63'),_0x218e('0x69'),_0x218e('0x64')],'raw':!![]});}})[_0x218e('0x23')](function(_0x7d5d3a){if(_0x7d5d3a){fs[_0x218e('0x5d')](path[_0x218e('0x4f')](_0x189e45['directory'],util[_0x218e('0x66')]('%s.%s',_0x7d5d3a[_0x218e('0x29')],_0x7d5d3a['converted_format'])));return _0x7d5d3a;}})['catch'](function(_0xc8a0a5){throw new db[(_0x218e('0x6c'))][(_0x218e('0x6d'))](_0xc8a0a5[_0x218e('0x5f')]);});})[_0x218e('0x23')](handleEntityNotFound(_0x150c88,null))[_0x218e('0x23')](respondWithStatusCode(_0x150c88,0xcc))[_0x218e('0x41')](handleError(_0x150c88,null));};exports[_0x218e('0x6e')]=function(_0x3ef13b,_0x2b0c05,_0x428d4a){var _0x52a3c7={};var _0x2746ff={};var _0x5e85f1;var _0xb0371f;return db['VoiceMusicOnHold'][_0x218e('0x62')]({'where':{'id':_0x3ef13b[_0x218e('0x43')]['id']}})[_0x218e('0x23')](handleEntityNotFound(_0x2b0c05,null))[_0x218e('0x23')](function(_0x28609f){if(_0x28609f){_0x5e85f1=_0x28609f;_0x2746ff[_0x218e('0x32')]=_['keys'](db[_0x218e('0x61')][_0x218e('0x2e')]);_0x2746ff[_0x218e('0x33')]=_[_0x218e('0x44')](_0x3ef13b[_0x218e('0x33')]);_0x2746ff[_0x218e('0x3b')]=_[_0x218e('0x34')](_0x2746ff['model'],_0x2746ff[_0x218e('0x33')]);_0x52a3c7[_0x218e('0x35')]=_[_0x218e('0x34')](_0x2746ff[_0x218e('0x32')],qs['fields'](_0x3ef13b[_0x218e('0x33')][_0x218e('0x36')]));_0x52a3c7[_0x218e('0x35')]=_0x52a3c7['attributes'][_0x218e('0x45')]?_0x52a3c7[_0x218e('0x35')]:_0x2746ff[_0x218e('0x32')];_0x52a3c7[_0x218e('0x6f')]=qs[_0x218e('0x39')](_0x3ef13b[_0x218e('0x33')]['sort']);_0x52a3c7[_0x218e('0x3a')]=qs['filters'](_[_0x218e('0x3c')](_0x3ef13b[_0x218e('0x33')],_0x2746ff['filters']));if(_0x3ef13b[_0x218e('0x33')][_0x218e('0x70')]){_0x52a3c7[_0x218e('0x3a')]=_[_0x218e('0x3d')](_0x52a3c7[_0x218e('0x3a')],{'$or':_[_0x218e('0x2c')](_0x52a3c7[_0x218e('0x35')],function(_0x4237ee){var _0x2d7cb2={};_0x2d7cb2[_0x4237ee]={'$like':'%'+_0x3ef13b['query'][_0x218e('0x70')]+'%'};return _0x2d7cb2;})});}_0x52a3c7=_[_0x218e('0x3d')]({},_0x52a3c7,_0x3ef13b[_0x218e('0x3e')]);return _0x5e85f1['getSounds'](_0x52a3c7);}})[_0x218e('0x23')](function(_0x53f456){if(_0x53f456){_0xb0371f=_0x53f456[_0x218e('0x45')];if(!_0x3ef13b['query']['hasOwnProperty'](_0x218e('0x38'))){_0x52a3c7[_0x218e('0x1d')]=qs[_0x218e('0x1d')](_0x3ef13b[_0x218e('0x33')][_0x218e('0x1d')]);_0x52a3c7['offset']=qs[_0x218e('0x1c')](_0x3ef13b['query']['offset']);}return _0x5e85f1[_0x218e('0x6e')](_0x52a3c7);}})[_0x218e('0x23')](function(_0x4d72dc){if(_0x4d72dc){return _0x4d72dc?{'count':_0xb0371f,'rows':_0x4d72dc}:null;}})['then'](respondWithResult(_0x2b0c05,null))[_0x218e('0x41')](handleError(_0x2b0c05,null));}; \ No newline at end of file +var _0xff2f=['keys','intersection','attributes','fields','query','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','catch','filters','find','body','params','create','transaction','mode','join','files','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','extname','converted_format','server/files/moh','findOne','removeSound','id2','unlinkSync','getSounds','pick','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model'];(function(_0x51ce10,_0x9343bf){var _0x489bf0=function(_0x28c4f0){while(--_0x28c4f0){_0x51ce10['push'](_0x51ce10['shift']());}};_0x489bf0(++_0x9343bf);}(_0xff2f,0x117));var _0xfff2=function(_0x207ceb,_0x5481a7){_0x207ceb=_0x207ceb-0x0;var _0x562255=_0xff2f[_0x207ceb];return _0x562255;};'use strict';var emlformat=require(_0xfff2('0x0'));var rimraf=require(_0xfff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff2('0x2'));var rp=require(_0xfff2('0x3'));var moment=require(_0xfff2('0x4'));var BPromise=require(_0xfff2('0x5'));var Mustache=require(_0xfff2('0x6'));var util=require(_0xfff2('0x7'));var path=require(_0xfff2('0x8'));var sox=require(_0xfff2('0x9'));var csv=require('to-csv');var ejs=require(_0xfff2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfff2('0xb'));var squel=require('squel');var crypto=require(_0xfff2('0xc'));var jsforce=require(_0xfff2('0xd'));var deskjs=require(_0xfff2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfff2('0xf'));var Papa=require(_0xfff2('0x10'));var Redis=require(_0xfff2('0x11'));var authService=require(_0xfff2('0x12'));var qs=require(_0xfff2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfff2('0x14'));var logger=require('../../config/logger')(_0xfff2('0x15'));var utils=require(_0xfff2('0x16'));var config=require(_0xfff2('0x17'));var licenseUtil=require(_0xfff2('0x18'));var db=require(_0xfff2('0x19'))['db'];function respondWithStatusCode(_0xf136e5,_0x508bc9){_0x508bc9=_0x508bc9||0xcc;return function(_0x286be4){if(_0x286be4){return _0xf136e5[_0xfff2('0x1a')](_0x508bc9);}return _0xf136e5[_0xfff2('0x1b')](_0x508bc9)[_0xfff2('0x1c')]();};}function respondWithResult(_0x2e4e60,_0x48a4e3){_0x48a4e3=_0x48a4e3||0xc8;return function(_0x50ba4a){if(_0x50ba4a){return _0x2e4e60[_0xfff2('0x1b')](_0x48a4e3)[_0xfff2('0x1d')](_0x50ba4a);}};}function respondWithFilteredResult(_0x37d1a6,_0x94c38d){return function(_0x5d2c64){if(_0x5d2c64){var _0x14f15f=typeof _0x94c38d[_0xfff2('0x1e')]==='undefined'&&typeof _0x94c38d['limit']===_0xfff2('0x1f');var _0x22ac4b=_0x5d2c64[_0xfff2('0x20')];var _0x49fc1b=_0x14f15f?0x0:_0x94c38d[_0xfff2('0x1e')];var _0x132b3a=_0x14f15f?_0x5d2c64['count']:_0x94c38d[_0xfff2('0x1e')]+_0x94c38d[_0xfff2('0x21')];var _0x330d59;if(_0x132b3a>=_0x22ac4b){_0x132b3a=_0x22ac4b;_0x330d59=0xc8;}else{_0x330d59=0xce;}_0x37d1a6[_0xfff2('0x1b')](_0x330d59);return _0x37d1a6[_0xfff2('0x22')]('Content-Range',_0x49fc1b+'-'+_0x132b3a+'/'+_0x22ac4b)['json'](_0x5d2c64);}return null;};}function patchUpdates(_0x2a7689){return function(_0x3b59c7){try{jsonpatch[_0xfff2('0x23')](_0x3b59c7,_0x2a7689,!![]);}catch(_0xa689e3){return BPromise[_0xfff2('0x24')](_0xa689e3);}return _0x3b59c7['save']();};}function saveUpdates(_0x3a96fd,_0x3f1625){return function(_0x4cd695){if(_0x4cd695){return _0x4cd695[_0xfff2('0x25')](_0x3a96fd)[_0xfff2('0x26')](function(_0x45446b){return _0x45446b;});}return null;};}function removeEntity(_0x3831d5,_0x4bfb8e){return function(_0x921e14){if(_0x921e14){return _0x921e14[_0xfff2('0x27')]()[_0xfff2('0x26')](function(){var _0x3655af=_0x921e14[_0xfff2('0x28')]({'plain':!![]});var _0x37db97=_0xfff2('0x29');return db[_0xfff2('0x2a')][_0xfff2('0x27')]({'where':{'type':_0x37db97,'resourceId':_0x3655af['id']}})[_0xfff2('0x26')](function(){return _0x921e14;});})['then'](function(){_0x3831d5[_0xfff2('0x1b')](0xcc)[_0xfff2('0x1c')]();});}};}function handleEntityNotFound(_0x38e618,_0xcaf1e){return function(_0x112fbd){if(!_0x112fbd){_0x38e618['sendStatus'](0x194);}return _0x112fbd;};}function handleError(_0x309a1e,_0x48e523){_0x48e523=_0x48e523||0x1f4;return function(_0x165ec7){logger[_0xfff2('0x2b')](_0x165ec7[_0xfff2('0x2c')]);if(_0x165ec7[_0xfff2('0x2d')]){delete _0x165ec7[_0xfff2('0x2d')];}_0x309a1e['status'](_0x48e523)['send'](_0x165ec7);};}exports[_0xfff2('0x2e')]=function(_0x1dfe0a,_0x299dab){var _0x38acff={},_0x49c2eb={},_0xa56e6c={'count':0x0,'rows':[]};var _0x3e419a=_[_0xfff2('0x2f')](db[_0xfff2('0x30')][_0xfff2('0x31')],function(_0x447daf){return{'name':_0x447daf[_0xfff2('0x32')],'type':_0x447daf[_0xfff2('0x33')][_0xfff2('0x34')]};});_0x49c2eb[_0xfff2('0x35')]=_[_0xfff2('0x2f')](_0x3e419a,_0xfff2('0x2d'));_0x49c2eb['query']=_[_0xfff2('0x36')](_0x1dfe0a['query']);_0x49c2eb['filters']=_[_0xfff2('0x37')](_0x49c2eb[_0xfff2('0x35')],_0x49c2eb['query']);_0x38acff[_0xfff2('0x38')]=_[_0xfff2('0x37')](_0x49c2eb[_0xfff2('0x35')],qs[_0xfff2('0x39')](_0x1dfe0a[_0xfff2('0x3a')][_0xfff2('0x39')]));_0x38acff[_0xfff2('0x38')]=_0x38acff['attributes'][_0xfff2('0x3b')]?_0x38acff[_0xfff2('0x38')]:_0x49c2eb[_0xfff2('0x35')];if(!_0x1dfe0a[_0xfff2('0x3a')][_0xfff2('0x3c')]('nolimit')){_0x38acff[_0xfff2('0x21')]=qs[_0xfff2('0x21')](_0x1dfe0a[_0xfff2('0x3a')]['limit']);_0x38acff[_0xfff2('0x1e')]=qs[_0xfff2('0x1e')](_0x1dfe0a[_0xfff2('0x3a')][_0xfff2('0x1e')]);}_0x38acff['order']=qs[_0xfff2('0x3d')](_0x1dfe0a[_0xfff2('0x3a')]['sort']);delete _0x1dfe0a[_0xfff2('0x3a')][_0xfff2('0x3d')];_0x38acff[_0xfff2('0x3e')]=qs['filters'](_['pick'](_0x1dfe0a[_0xfff2('0x3a')],_0x49c2eb['filters']),_0x3e419a);if(_0x1dfe0a[_0xfff2('0x3a')][_0xfff2('0x3f')]){_0x38acff[_0xfff2('0x3e')]=_['merge'](_0x38acff[_0xfff2('0x3e')],{'$or':_[_0xfff2('0x2f')](_0x3e419a,function(_0xae2b4e){if(_0xae2b4e[_0xfff2('0x33')]!=='VIRTUAL'){var _0x1f5093={};_0x1f5093[_0xae2b4e[_0xfff2('0x2d')]]={'$like':'%'+_0x1dfe0a[_0xfff2('0x3a')]['filter']+'%'};return _0x1f5093;}})});}_0x38acff=_[_0xfff2('0x40')]({},_0x38acff,_0x1dfe0a[_0xfff2('0x41')]);var _0xcdfb71={'where':_0x38acff[_0xfff2('0x3e')]};return db[_0xfff2('0x30')][_0xfff2('0x20')](_0xcdfb71)[_0xfff2('0x26')](function(_0x309c09){_0xa56e6c[_0xfff2('0x20')]=_0x309c09;if(_0x1dfe0a['query'][_0xfff2('0x42')]){_0x38acff[_0xfff2('0x43')]=[{'all':!![]}];}return db[_0xfff2('0x30')]['findAll'](_0x38acff);})['then'](function(_0x187d0d){_0xa56e6c['rows']=_0x187d0d;return _0xa56e6c;})[_0xfff2('0x26')](respondWithFilteredResult(_0x299dab,_0x38acff))[_0xfff2('0x44')](handleError(_0x299dab,null));};exports['show']=function(_0x2414be,_0xc70648){var _0x3f0404={'raw':![],'where':{'id':_0x2414be['params']['id']}},_0x36f359={};_0x36f359[_0xfff2('0x35')]=_[_0xfff2('0x36')](db[_0xfff2('0x30')][_0xfff2('0x31')]);_0x36f359['query']=_[_0xfff2('0x36')](_0x2414be['query']);_0x36f359[_0xfff2('0x45')]=_[_0xfff2('0x37')](_0x36f359['model'],_0x36f359['query']);_0x3f0404[_0xfff2('0x38')]=_[_0xfff2('0x37')](_0x36f359['model'],qs[_0xfff2('0x39')](_0x2414be['query'][_0xfff2('0x39')]));_0x3f0404[_0xfff2('0x38')]=_0x3f0404[_0xfff2('0x38')][_0xfff2('0x3b')]?_0x3f0404[_0xfff2('0x38')]:_0x36f359[_0xfff2('0x35')];if(_0x2414be[_0xfff2('0x3a')][_0xfff2('0x42')]){_0x3f0404[_0xfff2('0x43')]=[{'all':!![]}];}_0x3f0404=_[_0xfff2('0x40')]({},_0x3f0404,_0x2414be[_0xfff2('0x41')]);return db[_0xfff2('0x30')][_0xfff2('0x46')](_0x3f0404)[_0xfff2('0x26')](handleEntityNotFound(_0xc70648,null))[_0xfff2('0x26')](respondWithResult(_0xc70648,null))[_0xfff2('0x44')](handleError(_0xc70648,null));};exports[_0xfff2('0x25')]=function(_0x47ebe3,_0x3f9ed3){if(_0x47ebe3[_0xfff2('0x47')]['id']){delete _0x47ebe3[_0xfff2('0x47')]['id'];}return db[_0xfff2('0x30')][_0xfff2('0x46')]({'where':{'id':_0x47ebe3[_0xfff2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f9ed3,null))[_0xfff2('0x26')](saveUpdates(_0x47ebe3[_0xfff2('0x47')],null))[_0xfff2('0x26')](respondWithResult(_0x3f9ed3,null))['catch'](handleError(_0x3f9ed3,null));};exports[_0xfff2('0x49')]=function(_0x214a60,_0x22834d,_0x2b2b63){return db['sequelize'][_0xfff2('0x4a')](function(_0x333b2a){if(_0x214a60[_0xfff2('0x47')][_0xfff2('0x4b')]==='files'){_0x214a60['body']['directory']=path[_0xfff2('0x4c')](config['root'],'server/files/moh',_0x214a60[_0xfff2('0x47')]['name']);}return db[_0xfff2('0x30')][_0xfff2('0x49')](_0x214a60[_0xfff2('0x47')],{'transaction':_0x333b2a})['then'](function(_0x5ca31e){if(_0x214a60[_0xfff2('0x47')]['mode']===_0xfff2('0x4d')){fs[_0xfff2('0x4e')](_0x5ca31e[_0xfff2('0x4f')],parseInt('0777',0x8));}var _0x53092d=_0x214a60[_0xfff2('0x50')][_0xfff2('0x28')]({'plain':!![]});if(!_0x53092d)throw new Error(_0xfff2('0x51'));if(_0x53092d[_0xfff2('0x52')]===_0xfff2('0x50')){var _0xf7487=_0x5ca31e[_0xfff2('0x28')]({'plain':!![]});return db[_0xfff2('0x53')][_0xfff2('0x46')]({'where':{'name':_0xfff2('0x29'),'userProfileId':_0x53092d[_0xfff2('0x54')]},'raw':!![]})[_0xfff2('0x26')](function(_0x1ca2e5){if(_0x1ca2e5&&_0x1ca2e5[_0xfff2('0x55')]===0x0){return db[_0xfff2('0x2a')][_0xfff2('0x49')]({'name':_0xf7487[_0xfff2('0x2d')],'resourceId':_0xf7487['id'],'type':_0x1ca2e5[_0xfff2('0x2d')],'sectionId':_0x1ca2e5['id']},{})[_0xfff2('0x26')](function(){return _0x5ca31e;});}else{return _0x5ca31e;}})[_0xfff2('0x44')](function(_0x53142d){logger[_0xfff2('0x2b')](_0xfff2('0x56'),_0x53142d);});}return _0x5ca31e;});})[_0xfff2('0x26')](respondWithResult(_0x22834d,0xc9))[_0xfff2('0x44')](handleError(_0x22834d,null));};exports[_0xfff2('0x27')]=function(_0xbb8718,_0x127b0e,_0x27ea08){var _0x496be3;return db[_0xfff2('0x30')][_0xfff2('0x46')]({'where':{'id':_0xbb8718[_0xfff2('0x48')]['id']}})[_0xfff2('0x26')](function(_0x411180){if(_0x411180){return db[_0xfff2('0x57')][_0xfff2('0x4a')](function(_0x5bf476){return _0x411180[_0xfff2('0x27')]({'transaction':_0x5bf476,'raw':!![]})[_0xfff2('0x26')](function(_0xf6d5e6){if(_0xf6d5e6[_0xfff2('0x4f')]){fs[_0xfff2('0x58')](_0xf6d5e6['directory'])['forEach'](function(_0xf2a52f){fs['unlinkSync'](path[_0xfff2('0x4c')](_0xf6d5e6['directory'],_0xf2a52f));});fs[_0xfff2('0x59')](_0xf6d5e6[_0xfff2('0x4f')]);}return _0xf6d5e6;});})['catch'](function(_0x45de4e){throw new db[(_0xfff2('0x5a'))][(_0xfff2('0x5b'))](_0x45de4e[_0xfff2('0x5c')]);});}})[_0xfff2('0x26')](handleEntityNotFound(_0x127b0e,null))[_0xfff2('0x26')](removeEntity(_0x127b0e,null))[_0xfff2('0x44')](handleError(_0x127b0e,null));};exports[_0xfff2('0x5d')]=function(_0xed4d50,_0x4a3658,_0xe953ac){return db[_0xfff2('0x57')][_0xfff2('0x4a')](function(_0xd1ffe5){var _0x44976b;return db[_0xfff2('0x30')][_0xfff2('0x46')]({'where':{'id':_0xed4d50['params']['id']}})[_0xfff2('0x26')](function(_0x1cb6a6){if(_0x1cb6a6){_0x44976b=_0x1cb6a6;return _0x1cb6a6['addSound'](_0xed4d50['body']['id'],{'transaction':_0xd1ffe5});}})[_0xfff2('0x26')](function(_0xa8258f){if(_0xa8258f){return db[_0xfff2('0x5e')]['findOne']({'where':{'id':_0xed4d50[_0xfff2('0x47')]['id']},'attributes':['id',_0xfff2('0x2d'),_0xfff2('0x5f'),'converted_format',_0xfff2('0x60')],'raw':!![]});}})[_0xfff2('0x26')](function(_0x3d5196){if(_0x3d5196){var _0x378c7b=path[_0xfff2('0x4c')](config[_0xfff2('0x61')],_0xfff2('0x62'),util[_0xfff2('0x63')](_0xfff2('0x64'),path['basename'](_0x3d5196['save_name'],path[_0xfff2('0x65')](_0x3d5196[_0xfff2('0x5f')])),_0x3d5196[_0xfff2('0x66')]));var _0x266196=path[_0xfff2('0x4c')](config[_0xfff2('0x61')],_0xfff2('0x67'),_0x44976b[_0xfff2('0x2d')],util[_0xfff2('0x63')](_0xfff2('0x64'),_0x3d5196['name'],_0x3d5196[_0xfff2('0x66')]));fs['symlinkSync'](_0x378c7b,_0x266196);return _0x3d5196;}})[_0xfff2('0x44')](function(_0xa6f638){throw new db[(_0xfff2('0x5a'))][(_0xfff2('0x5b'))](_0xa6f638[_0xfff2('0x5c')]);});})[_0xfff2('0x26')](handleEntityNotFound(_0x4a3658,null))['then'](respondWithResult(_0x4a3658,0xc9))[_0xfff2('0x44')](handleError(_0x4a3658,null));};exports['removeSound']=function(_0x21a945,_0x9adca,_0x48c2aa){return db[_0xfff2('0x57')][_0xfff2('0x4a')](function(_0x3a4c4b){var _0x55d1c2;return db[_0xfff2('0x30')][_0xfff2('0x68')]({'where':{'id':_0x21a945[_0xfff2('0x48')]['id']}})[_0xfff2('0x26')](handleEntityNotFound(_0x9adca,null))[_0xfff2('0x26')](function(_0x39bc9b){if(_0x39bc9b){_0x55d1c2=_0x39bc9b;return _0x39bc9b[_0xfff2('0x69')](_0x21a945[_0xfff2('0x48')][_0xfff2('0x6a')]);}})[_0xfff2('0x26')](function(_0x48a7c9){if(_0x48a7c9){return db['Sound'][_0xfff2('0x68')]({'where':{'id':_0x21a945[_0xfff2('0x48')][_0xfff2('0x6a')]},'attributes':['id',_0xfff2('0x2d'),_0xfff2('0x5f'),_0xfff2('0x66'),_0xfff2('0x60')],'raw':!![]});}})['then'](function(_0x109377){if(_0x109377){fs[_0xfff2('0x6b')](path[_0xfff2('0x4c')](_0x55d1c2[_0xfff2('0x4f')],util[_0xfff2('0x63')](_0xfff2('0x64'),_0x109377[_0xfff2('0x2d')],_0x109377[_0xfff2('0x66')])));return _0x109377;}})['catch'](function(_0x2bc7fa){throw new db[(_0xfff2('0x5a'))]['ValidationError'](_0x2bc7fa[_0xfff2('0x5c')]);});})[_0xfff2('0x26')](handleEntityNotFound(_0x9adca,null))['then'](respondWithStatusCode(_0x9adca,0xcc))[_0xfff2('0x44')](handleError(_0x9adca,null));};exports[_0xfff2('0x6c')]=function(_0x5f8846,_0x19f722,_0x264856){var _0x3cd399={};var _0x27f1b0={};var _0x6bde9d;var _0x471c67;return db[_0xfff2('0x30')][_0xfff2('0x68')]({'where':{'id':_0x5f8846[_0xfff2('0x48')]['id']}})['then'](handleEntityNotFound(_0x19f722,null))[_0xfff2('0x26')](function(_0x3921e7){if(_0x3921e7){_0x6bde9d=_0x3921e7;_0x27f1b0[_0xfff2('0x35')]=_[_0xfff2('0x36')](db['Sound'][_0xfff2('0x31')]);_0x27f1b0[_0xfff2('0x3a')]=_['keys'](_0x5f8846[_0xfff2('0x3a')]);_0x27f1b0[_0xfff2('0x45')]=_['intersection'](_0x27f1b0['model'],_0x27f1b0[_0xfff2('0x3a')]);_0x3cd399[_0xfff2('0x38')]=_[_0xfff2('0x37')](_0x27f1b0[_0xfff2('0x35')],qs[_0xfff2('0x39')](_0x5f8846[_0xfff2('0x3a')][_0xfff2('0x39')]));_0x3cd399[_0xfff2('0x38')]=_0x3cd399['attributes'][_0xfff2('0x3b')]?_0x3cd399[_0xfff2('0x38')]:_0x27f1b0['model'];_0x3cd399['order']=qs[_0xfff2('0x3d')](_0x5f8846['query'][_0xfff2('0x3d')]);_0x3cd399[_0xfff2('0x3e')]=qs[_0xfff2('0x45')](_[_0xfff2('0x6d')](_0x5f8846[_0xfff2('0x3a')],_0x27f1b0['filters']));if(_0x5f8846[_0xfff2('0x3a')][_0xfff2('0x3f')]){_0x3cd399[_0xfff2('0x3e')]=_['merge'](_0x3cd399['where'],{'$or':_[_0xfff2('0x2f')](_0x3cd399[_0xfff2('0x38')],function(_0x3466cf){var _0x18f2eb={};_0x18f2eb[_0x3466cf]={'$like':'%'+_0x5f8846[_0xfff2('0x3a')]['filter']+'%'};return _0x18f2eb;})});}_0x3cd399=_[_0xfff2('0x40')]({},_0x3cd399,_0x5f8846[_0xfff2('0x41')]);return _0x6bde9d[_0xfff2('0x6c')](_0x3cd399);}})[_0xfff2('0x26')](function(_0x104f93){if(_0x104f93){_0x471c67=_0x104f93[_0xfff2('0x3b')];if(!_0x5f8846['query']['hasOwnProperty'](_0xfff2('0x6e'))){_0x3cd399[_0xfff2('0x21')]=qs[_0xfff2('0x21')](_0x5f8846[_0xfff2('0x3a')]['limit']);_0x3cd399[_0xfff2('0x1e')]=qs['offset'](_0x5f8846['query'][_0xfff2('0x1e')]);}return _0x6bde9d[_0xfff2('0x6c')](_0x3cd399);}})[_0xfff2('0x26')](function(_0x6a4966){if(_0x6a4966){return _0x6a4966?{'count':_0x471c67,'rows':_0x6a4966}:null;}})[_0xfff2('0x26')](respondWithResult(_0x19f722,null))[_0xfff2('0x44')](handleError(_0x19f722,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index d7b5af4..e926249 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 _0x326b=['util','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x631596,_0x3719ee){var _0x4ab5c9=function(_0x4a1c35){while(--_0x4a1c35){_0x631596['push'](_0x631596['shift']());}};_0x4ab5c9(++_0x3719ee);}(_0x326b,0xd7));var _0xb326=function(_0x4f9d26,_0x641341){_0x4f9d26=_0x4f9d26-0x0;var _0x57debc=_0x326b[_0x4f9d26];return _0x57debc;};'use strict';var _=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb326('0x2'));var fs=require('fs');var path=require(_0xb326('0x3'));var rimraf=require(_0xb326('0x4'));var config=require(_0xb326('0x5'));var attributes=require(_0xb326('0x6'));module['exports']=function(_0x178bb7,_0x3d5ddc){return _0x178bb7['define'](_0xb326('0x7'),attributes,{'tableName':_0xb326('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b80=['api','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger'];(function(_0x53dd63,_0x5e1852){var _0x460c0a=function(_0x599511){while(--_0x599511){_0x53dd63['push'](_0x53dd63['shift']());}};_0x460c0a(++_0x5e1852);}(_0x6b80,0x1a0));var _0x06b8=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x6b80[_0x57d13b];return _0x467696;};'use strict';var _=require('lodash');var util=require(_0x06b8('0x0'));var logger=require(_0x06b8('0x1'))(_0x06b8('0x2'));var moment=require(_0x06b8('0x3'));var BPromise=require('bluebird');var rp=require(_0x06b8('0x4'));var fs=require('fs');var path=require(_0x06b8('0x5'));var rimraf=require(_0x06b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x06b8('0x7'));module[_0x06b8('0x8')]=function(_0x5089c8,_0xcadb6e){return _0x5089c8[_0x06b8('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x06b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 71f6543..0858c5e 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5dd3a1,_0xe30ace){var _0x39eff0=function(_0x2d3b54){while(--_0x2d3b54){_0x5dd3a1['push'](_0x5dd3a1['shift']());}};_0x39eff0(++_0xe30ace);}(_0x70e0,0x17b));var _0x070e=function(_0xf11512,_0x5d16ce){_0xf11512=_0xf11512-0x0;var _0x546bc=_0x70e0[_0xf11512];return _0x546bc;};'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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x306924,_0x1e5d7d){var _0x1ecca7=function(_0x4633e4){while(--_0x4633e4){_0x306924['push'](_0x306924['shift']());}};_0x1ecca7(++_0x1e5d7d);}(_0x70e0,0x17b));var _0x070e=function(_0x41f400,_0x283940){_0x41f400=_0x41f400-0x0;var _0x2bbe12=_0x70e0[_0x41f400];return _0x2bbe12;};'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')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8b168c9..803a4d9 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 _0x2c46=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','destroy','delete','removeAgents','removeTeams','exports','util','path','connect-timeout','express','Router'];(function(_0x1c26ea,_0x20eff2){var _0x1aa800=function(_0x39627c){while(--_0x39627c){_0x1c26ea['push'](_0x1c26ea['shift']());}};_0x1aa800(++_0x20eff2);}(_0x2c46,0x6f));var _0x62c4=function(_0x2dde07,_0x41469b){_0x2dde07=_0x2dde07-0x0;var _0x5de09d=_0x2c46[_0x2dde07];return _0x5de09d;};'use strict';var multer=require('multer');var util=require(_0x62c4('0x0'));var path=require(_0x62c4('0x1'));var timeout=require(_0x62c4('0x2'));var express=require(_0x62c4('0x3'));var router=express[_0x62c4('0x4')]();var fs_extra=require(_0x62c4('0x5'));var auth=require(_0x62c4('0x6'));var interaction=require(_0x62c4('0x7'));var config=require(_0x62c4('0x8'));var controller=require(_0x62c4('0x9'));router[_0x62c4('0xa')]('/',auth[_0x62c4('0xb')](),controller[_0x62c4('0xc')]);router[_0x62c4('0xa')](_0x62c4('0xd'),auth[_0x62c4('0xb')](),controller[_0x62c4('0xe')]);router['get'](_0x62c4('0xf'),auth['isAuthenticated'](),controller[_0x62c4('0x10')]);router['get'](_0x62c4('0x11'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x12')]);router[_0x62c4('0xa')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x14')]);router[_0x62c4('0x15')]('/',auth[_0x62c4('0xb')](),controller[_0x62c4('0x16')]);router[_0x62c4('0x15')](_0x62c4('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x62c4('0x15')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x17')]);router['put'](_0x62c4('0xf'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x62c4('0x18')]);router[_0x62c4('0x19')](_0x62c4('0x11'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x1a')]);router[_0x62c4('0x19')](_0x62c4('0x13'),auth[_0x62c4('0xb')](),controller[_0x62c4('0x1b')]);module[_0x62c4('0x1c')]=router; \ No newline at end of file +var _0xc063=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id/users','/:id/teams','getTeams','post','addTeams','put','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0xc063,0xb6));var _0x3c06=function(_0x36385b,_0x429635){_0x36385b=_0x36385b-0x0;var _0x409886=_0xc063[_0x36385b];return _0x409886;};'use strict';var multer=require(_0x3c06('0x0'));var util=require(_0x3c06('0x1'));var path=require(_0x3c06('0x2'));var timeout=require(_0x3c06('0x3'));var express=require('express');var router=express[_0x3c06('0x4')]();var fs_extra=require(_0x3c06('0x5'));var auth=require(_0x3c06('0x6'));var interaction=require(_0x3c06('0x7'));var config=require(_0x3c06('0x8'));var controller=require(_0x3c06('0x9'));router[_0x3c06('0xa')]('/',auth[_0x3c06('0xb')](),controller[_0x3c06('0xc')]);router['get'](_0x3c06('0xd'),auth[_0x3c06('0xb')](),controller[_0x3c06('0xe')]);router['get']('/:id',auth[_0x3c06('0xb')](),controller['show']);router[_0x3c06('0xa')](_0x3c06('0xf'),auth[_0x3c06('0xb')](),controller['getAgents']);router['get'](_0x3c06('0x10'),auth['isAuthenticated'](),controller[_0x3c06('0x11')]);router[_0x3c06('0x12')]('/',auth[_0x3c06('0xb')](),controller['create']);router[_0x3c06('0x12')](_0x3c06('0xf'),auth[_0x3c06('0xb')](),controller['addAgents']);router[_0x3c06('0x12')]('/:id/teams',auth[_0x3c06('0xb')](),controller[_0x3c06('0x13')]);router[_0x3c06('0x14')](_0x3c06('0x15'),auth[_0x3c06('0xb')](),controller[_0x3c06('0x16')]);router['delete'](_0x3c06('0x15'),auth['isAuthenticated'](),controller[_0x3c06('0x17')]);router[_0x3c06('0x18')](_0x3c06('0xf'),auth[_0x3c06('0xb')](),controller[_0x3c06('0x19')]);router[_0x3c06('0x18')](_0x3c06('0x10'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x3c06('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5ff5717..0d1840d 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 _0x0ca0=['INTEGER','sequelize','exports','STRING','name','VIRTUAL'];(function(_0x596e76,_0x25d38b){var _0x9829fd=function(_0x3201dd){while(--_0x3201dd){_0x596e76['push'](_0x596e76['shift']());}};_0x9829fd(++_0x25d38b);}(_0x0ca0,0x12d));var _0x00ca=function(_0x274ec1,_0x42da60){_0x274ec1=_0x274ec1-0x0;var _0x3ea453=_0x0ca0[_0x274ec1];return _0x3ea453;};'use strict';var Sequelize=require(_0x00ca('0x0'));module[_0x00ca('0x1')]={'name':{'type':Sequelize[_0x00ca('0x2')],'allowNull':![],'unique':_0x00ca('0x3')},'prefix':{'type':Sequelize[_0x00ca('0x4')],'get':function(_0x2a2206){return'system-'+this['getDataValue'](_0x00ca('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x00ca('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x00ca('0x5')]}}; \ No newline at end of file +var _0x4a76=['sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x246a6c,_0xd36d2f){var _0x4e1940=function(_0x42e50e){while(--_0x42e50e){_0x246a6c['push'](_0x246a6c['shift']());}};_0x4e1940(++_0xd36d2f);}(_0x4a76,0x180));var _0x64a7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4a76[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x64a7('0x0'));module[_0x64a7('0x1')]={'name':{'type':Sequelize[_0x64a7('0x2')],'allowNull':![],'unique':_0x64a7('0x3')},'prefix':{'type':Sequelize[_0x64a7('0x4')],'get':function(_0x24400d){return _0x64a7('0x5')+this['getDataValue'](_0x64a7('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x64a7('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 1321a4a..1e856f1 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 _0xaebd=['interface','flatMap','addTeams','TeamVoicePrefix','each','UserVoicePrefix','forEach','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','compact','value','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','find','describe','sequelize','transaction','create','get','VoiceExtension','user','role','UserProfileSection','VoicePrefixes','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','order','Team','options','getTeams','Agents','online','voicePause'];(function(_0x3b6b5e,_0x192868){var _0x2b55f9=function(_0x48c564){while(--_0x48c564){_0x3b6b5e['push'](_0x3b6b5e['shift']());}};_0x2b55f9(++_0x192868);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x5e7a14,_0x36594f){_0x5e7a14=_0x5e7a14-0x0;var _0x4b1d7e=_0xaebd[_0x5e7a14];return _0x4b1d7e;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];config['redis']=_[_0xdaeb('0x15')](config[_0xdaeb('0x16')],{'host':_0xdaeb('0x17'),'port':0x18eb});var socket=require(_0xdaeb('0x18'))(new Redis(config[_0xdaeb('0x16')]));require(_0xdaeb('0x19'))[_0xdaeb('0x1a')](socket);function respondWithStatusCode(_0x49ba9a,_0x57b091){_0x57b091=_0x57b091||0xcc;return function(_0x96371f){if(_0x96371f){return _0x49ba9a[_0xdaeb('0x1b')](_0x57b091);}return _0x49ba9a[_0xdaeb('0x1c')](_0x57b091)[_0xdaeb('0x1d')]();};}function respondWithResult(_0x538a25,_0x4c3bf3){_0x4c3bf3=_0x4c3bf3||0xc8;return function(_0x24b898){if(_0x24b898){return _0x538a25['status'](_0x4c3bf3)['json'](_0x24b898);}};}function respondWithFilteredResult(_0x42e509,_0x16eb2d){return function(_0x1b5243){if(_0x1b5243){var _0x1fe84e=typeof _0x16eb2d[_0xdaeb('0x1e')]===_0xdaeb('0x1f')&&typeof _0x16eb2d['limit']===_0xdaeb('0x1f');var _0x5ccf66=_0x1b5243[_0xdaeb('0x20')];var _0x13b3f2=_0x1fe84e?0x0:_0x16eb2d[_0xdaeb('0x1e')];var _0x5360ce=_0x1fe84e?_0x1b5243['count']:_0x16eb2d[_0xdaeb('0x1e')]+_0x16eb2d[_0xdaeb('0x21')];var _0x23fccb;if(_0x5360ce>=_0x5ccf66){_0x5360ce=_0x5ccf66;_0x23fccb=0xc8;}else{_0x23fccb=0xce;}_0x42e509[_0xdaeb('0x1c')](_0x23fccb);return _0x42e509[_0xdaeb('0x22')]('Content-Range',_0x13b3f2+'-'+_0x5360ce+'/'+_0x5ccf66)['json'](_0x1b5243);}return null;};}function patchUpdates(_0x2c969d){return function(_0x3cfcaf){try{jsonpatch[_0xdaeb('0x23')](_0x3cfcaf,_0x2c969d,!![]);}catch(_0x1d919a){return BPromise[_0xdaeb('0x24')](_0x1d919a);}return _0x3cfcaf['save']();};}function saveUpdates(_0x254c3b,_0x4dc25f){return function(_0x130c35){if(_0x130c35){return _0x130c35[_0xdaeb('0x25')](_0x254c3b)[_0xdaeb('0x26')](function(_0x3b0770){return _0x3b0770;});}return null;};}function removeEntity(_0x32c2c1,_0x4fc3e2){return function(_0x3a0b9c){if(_0x3a0b9c){return _0x3a0b9c[_0xdaeb('0x27')]()[_0xdaeb('0x26')](function(){var _0x4eb719=_0x3a0b9c['get']({'plain':!![]});var _0x43095f='VoicePrefixes';return db['UserProfileResource'][_0xdaeb('0x27')]({'where':{'type':_0x43095f,'resourceId':_0x4eb719['id']}})[_0xdaeb('0x26')](function(){return _0x3a0b9c;});})[_0xdaeb('0x26')](function(){_0x32c2c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32966f,_0x440022){return function(_0x37f468){if(!_0x37f468){_0x32966f['sendStatus'](0x194);}return _0x37f468;};}function handleError(_0x36c933,_0x510607){_0x510607=_0x510607||0x1f4;return function(_0x4da82d){logger[_0xdaeb('0x28')](_0x4da82d[_0xdaeb('0x29')]);if(_0x4da82d[_0xdaeb('0x2a')]){delete _0x4da82d[_0xdaeb('0x2a')];}_0x36c933[_0xdaeb('0x1c')](_0x510607)[_0xdaeb('0x2b')](_0x4da82d);};}exports[_0xdaeb('0x2c')]=function(_0x5f1c84,_0x1c1c7c){var _0x143972={},_0x345982={},_0x40dbaa={'count':0x0,'rows':[]};var _0x2c89ae=_['map'](db[_0xdaeb('0x2d')][_0xdaeb('0x2e')],function(_0x4a7abe){return{'name':_0x4a7abe[_0xdaeb('0x2f')],'type':_0x4a7abe[_0xdaeb('0x30')][_0xdaeb('0x31')]};});_0x345982[_0xdaeb('0x32')]=_[_0xdaeb('0x33')](_0x2c89ae,_0xdaeb('0x2a'));_0x345982[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x5f1c84[_0xdaeb('0x34')]);_0x345982[_0xdaeb('0x36')]=_['intersection'](_0x345982['model'],_0x345982[_0xdaeb('0x34')]);_0x143972['attributes']=_[_0xdaeb('0x37')](_0x345982[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x143972[_0xdaeb('0x39')]=_0x143972['attributes'][_0xdaeb('0x3a')]?_0x143972[_0xdaeb('0x39')]:_0x345982[_0xdaeb('0x32')];if(!_0x5f1c84['query'][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x143972[_0xdaeb('0x21')]=qs[_0xdaeb('0x21')](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x143972[_0xdaeb('0x1e')]=qs['offset'](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x1e')]);}_0x143972['order']=qs['sort'](_0x5f1c84[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x143972['where']=qs[_0xdaeb('0x36')](_[_0xdaeb('0x3e')](_0x5f1c84['query'],_0x345982[_0xdaeb('0x36')]),_0x2c89ae);if(_0x5f1c84[_0xdaeb('0x34')]['filter']){_0x143972['where']=_[_0xdaeb('0x3f')](_0x143972[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x2c89ae,function(_0x10082c){if(_0x10082c[_0xdaeb('0x30')]!==_0xdaeb('0x41')){var _0x5b705b={};_0x5b705b[_0x10082c[_0xdaeb('0x2a')]]={'$like':'%'+_0x5f1c84['query'][_0xdaeb('0x42')]+'%'};return _0x5b705b;}})});}_0x143972=_['merge']({},_0x143972,_0x5f1c84['options']);var _0x2b47d7={'where':_0x143972['where']};return db[_0xdaeb('0x2d')]['count'](_0x2b47d7)[_0xdaeb('0x26')](function(_0x244369){_0x40dbaa[_0xdaeb('0x20')]=_0x244369;if(_0x5f1c84[_0xdaeb('0x34')]['includeAll']){_0x143972[_0xdaeb('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0xdaeb('0x44')](_0x143972);})[_0xdaeb('0x26')](function(_0x447ef0){_0x40dbaa['rows']=_0x447ef0;return _0x40dbaa;})[_0xdaeb('0x26')](respondWithFilteredResult(_0x1c1c7c,_0x143972))[_0xdaeb('0x45')](handleError(_0x1c1c7c,null));};exports[_0xdaeb('0x46')]=function(_0x4715a7,_0x34cf4d){var _0x3debbc={'raw':![],'where':{'id':_0x4715a7[_0xdaeb('0x47')]['id']}},_0x1369f7={};_0x1369f7[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db[_0xdaeb('0x2d')][_0xdaeb('0x2e')]);_0x1369f7['query']=_[_0xdaeb('0x35')](_0x4715a7[_0xdaeb('0x34')]);_0x1369f7['filters']=_['intersection'](_0x1369f7[_0xdaeb('0x32')],_0x1369f7[_0xdaeb('0x34')]);_0x3debbc[_0xdaeb('0x39')]=_['intersection'](_0x1369f7[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x4715a7[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x3debbc[_0xdaeb('0x39')]=_0x3debbc[_0xdaeb('0x39')][_0xdaeb('0x3a')]?_0x3debbc[_0xdaeb('0x39')]:_0x1369f7['model'];if(_0x4715a7[_0xdaeb('0x34')][_0xdaeb('0x48')]){_0x3debbc['include']=[{'all':!![]}];}_0x3debbc=_[_0xdaeb('0x3f')]({},_0x3debbc,_0x4715a7['options']);return db[_0xdaeb('0x2d')][_0xdaeb('0x49')](_0x3debbc)[_0xdaeb('0x26')](handleEntityNotFound(_0x34cf4d,null))[_0xdaeb('0x26')](respondWithResult(_0x34cf4d,null))[_0xdaeb('0x45')](handleError(_0x34cf4d,null));};exports[_0xdaeb('0x27')]=function(_0x33a4d7,_0xfe595){return db[_0xdaeb('0x2d')]['find']({'where':{'id':_0x33a4d7['params']['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0xfe595,null))[_0xdaeb('0x26')](removeEntity(_0xfe595,null))[_0xdaeb('0x45')](handleError(_0xfe595,null));};exports[_0xdaeb('0x4a')]=function(_0xf37729,_0x220edc){return db['VoicePrefix'][_0xdaeb('0x4a')]()[_0xdaeb('0x26')](respondWithResult(_0x220edc,null))[_0xdaeb('0x45')](handleError(_0x220edc,null));};exports['create']=function(_0x428b72,_0x597584){var _0x3fe511;return db[_0xdaeb('0x4b')][_0xdaeb('0x4c')](function(_0x395e2c){return db[_0xdaeb('0x2d')][_0xdaeb('0x4d')](_0x428b72['body'],{'transaction':_0x395e2c})['then'](function(_0x4abd5e){_0x3fe511=_0x4abd5e[_0xdaeb('0x4e')]({'plain':!![]});return db[_0xdaeb('0x4f')]['find']({'where':{'id':_0x3fe511['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3f6030){return createVoicePrefixExtensions(_0x3fe511,_0x3f6030,_0x395e2c);});});})[_0xdaeb('0x26')](function(){var _0x2846f7=_0x428b72[_0xdaeb('0x50')][_0xdaeb('0x4e')]({'plain':!![]});if(!_0x2846f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2846f7[_0xdaeb('0x51')]==='user'){var _0x25e58f=_0x3fe511;return db[_0xdaeb('0x52')][_0xdaeb('0x49')]({'where':{'name':_0xdaeb('0x53'),'userProfileId':_0x2846f7[_0xdaeb('0x54')]},'raw':!![]})[_0xdaeb('0x26')](function(_0x51b98f){if(_0x51b98f&&_0x51b98f['autoAssociation']===0x0){return db[_0xdaeb('0x55')]['create']({'name':_0x25e58f[_0xdaeb('0x2a')],'resourceId':_0x25e58f['id'],'type':_0x51b98f[_0xdaeb('0x2a')],'sectionId':_0x51b98f['id']},{})[_0xdaeb('0x26')](function(){return _0x3fe511;});}else{return _0x3fe511;}})['catch'](function(_0x1dd297){logger[_0xdaeb('0x28')](_0xdaeb('0x56'),_0x1dd297);throw _0x1dd297;});}return _0x3fe511;})[_0xdaeb('0x26')](respondWithResult(_0x597584,null))[_0xdaeb('0x45')](handleError(_0x597584,null));};function Extension(_0x23a3f7,_0x1241c5,_0x29abaa,_0x2e8bae){this['context']=_0xdaeb('0x57');this[_0xdaeb('0x58')]=_0x23a3f7;this[_0xdaeb('0x59')]=_0x29abaa;this[_0xdaeb('0x30')]='system';this['description']=_0xdaeb('0x5a');this[_0xdaeb('0x5b')]=_0x1241c5;this[_0xdaeb('0x5c')]=_0x2e8bae;}function createVoicePrefixExtensions(_0x207b34,_0x4c734e,_0x3147ec){return new BPromise(function(_0x5e20b4,_0x1ff5b3){var _0x4a0af5=new Extension(formatPrefixName(_0x207b34[_0xdaeb('0x5d')]),0x1,'NoOp',_0xdaeb('0x5e'));_0x4a0af5[_0xdaeb('0x5f')]=_0x207b34['id'];return db[_0xdaeb('0x4f')][_0xdaeb('0x4d')](_0x4a0af5,{'transaction':_0x3147ec})[_0xdaeb('0x26')](function(_0x2e1619){var _0x15ce20=_0x2e1619[_0xdaeb('0x4e')]({'plain':!![]});var _0x40aec7=_[_0xdaeb('0x33')](addVoicePrefixExtensions(_0x207b34,_0x4c734e),function(_0x5abde4){_0x5abde4[_0xdaeb('0x60')]=_0x15ce20['id'];_0x5abde4['VoicePrefixId']=_0x207b34['id'];return _0x5abde4;});return db[_0xdaeb('0x4f')][_0xdaeb('0x61')](_0x40aec7,{'transaction':_0x3147ec})['then'](function(_0x469781){if(!_0x469781){return _0x1ff5b3('Extensions\x20creation\x20failed');}else{return _0x5e20b4(_0x469781);}})[_0xdaeb('0x45')](function(_0x2d6910){return _0x1ff5b3(_0x2d6910);});});;});};function addVoicePrefixExtensions(_0x50bff5,_0x888128){var _0x3f86f4=[];var _0x22981f=formatPrefixName(_0x50bff5[_0xdaeb('0x5d')]);_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x2,_0xdaeb('0x63'),'CDR(prefix)='+_0x50bff5[_0xdaeb('0x2a')]));if(_0x50bff5[_0xdaeb('0x64')]){_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x3,_0xdaeb('0x63'),_0xdaeb('0x65')+_0x50bff5[_0xdaeb('0x64')]));}else{_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x3,'NoOp',_0xdaeb('0x66')));}_0x3f86f4[_0xdaeb('0x62')](new Extension(_0x22981f,0x4,_0xdaeb('0x67'),_0x888128[_0xdaeb('0x68')]+','+_0xdaeb('0x69')+(0x8+_0x50bff5['name'][_0xdaeb('0x3a')])+'}'+','+0x1));return _0x3f86f4;}function formatPrefixName(_0x4292d9){var _0x29a06f='_';for(var _0x2d4d57=0x0;_0x2d4d57<_0x4292d9['length'];_0x2d4d57++){if(_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57)=='-'){_0x29a06f+=_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57);}else{_0x29a06f+='['+_0x4292d9[_0xdaeb('0x6a')](_0x2d4d57)+']';}}_0x29a06f+='.';return _0x29a06f;}exports['update']=function(_0x17c5a8,_0x237f31,_0x5e6c01){var _0x3ac0f0=_0x17c5a8[_0xdaeb('0x6b')];_0x3ac0f0[_0xdaeb('0x5d')]=_0xdaeb('0x6c')+_0x3ac0f0['name']+'-';return db[_0xdaeb('0x4b')]['transaction'](function(_0x12918f){return db[_0xdaeb('0x2d')][_0xdaeb('0x25')](_0x3ac0f0,{'where':{'id':_0x3ac0f0['id']},'transaction':_0x12918f})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x4f')][_0xdaeb('0x27')]({'where':{'VoicePrefixId':_0x3ac0f0['id']},'transaction':_0x12918f})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x4f')]['find']({'where':{'id':_0x3ac0f0[_0xdaeb('0x60')]},'raw':!![]})[_0xdaeb('0x26')](function(_0x257e5b){return createVoicePrefixExtensions(_0x3ac0f0,_0x257e5b,_0x12918f);});});});})[_0xdaeb('0x26')](function(){return db[_0xdaeb('0x2d')][_0xdaeb('0x6d')](_0x3ac0f0['id']);})[_0xdaeb('0x26')](respondWithResult(_0x237f31,null))[_0xdaeb('0x45')](handleError(_0x237f31,null));};exports['addAgents']=function(_0x4c979b,_0x3f089f,_0x44c972){return db[_0xdaeb('0x2d')][_0xdaeb('0x49')]({'where':{'id':_0x4c979b[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x3f089f,null))['then'](function(_0xce453d){if(_0xce453d){return _0xce453d[_0xdaeb('0x6e')](_0x4c979b[_0xdaeb('0x6b')][_0xdaeb('0x6f')],_[_0xdaeb('0x70')](_0x4c979b['body'],['ids','id'])||{})[_0xdaeb('0x71')](function(_0x2a77ce){for(var _0x38d25=0x0;_0x38d25<_0x4c979b['body'][_0xdaeb('0x6f')][_0xdaeb('0x3a')];_0x38d25+=0x1){socket[_0xdaeb('0x72')](_0xdaeb('0x73'),{'UserId':Number(_0x4c979b[_0xdaeb('0x6b')][_0xdaeb('0x6f')][_0x38d25]),'VoicePrefixId':Number(_0x4c979b['params']['id'])});}return _0x2a77ce;});}})[_0xdaeb('0x26')](respondWithResult(_0x3f089f,null))['catch'](handleError(_0x3f089f,null));};exports[_0xdaeb('0x74')]=function(_0x34bbc2,_0x2f9672,_0x13a423){return db['VoicePrefix'][_0xdaeb('0x49')]({'where':{'id':_0x34bbc2[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x2f9672,null))['then'](function(_0x623520){if(_0x623520){return _0x623520[_0xdaeb('0x74')](_0x34bbc2[_0xdaeb('0x34')][_0xdaeb('0x6f')])[_0xdaeb('0x26')](function(){if(_['isArray'](_0x34bbc2['query']['ids'])){for(var _0x10a29a=0x0;_0x10a29a<_0x34bbc2['query'][_0xdaeb('0x6f')][_0xdaeb('0x3a')];_0x10a29a+=0x1){socket['emit'](_0xdaeb('0x75'),{'UserId':Number(_0x34bbc2['query'][_0xdaeb('0x6f')][_0x10a29a]),'VoicePrefixId':Number(_0x34bbc2[_0xdaeb('0x47')]['id'])});}}else{socket[_0xdaeb('0x72')](_0xdaeb('0x75'),{'UserId':Number(_0x34bbc2[_0xdaeb('0x34')][_0xdaeb('0x6f')]),'VoicePrefixId':Number(_0x34bbc2['params']['id'])});}});}})[_0xdaeb('0x26')](respondWithStatusCode(_0x2f9672,null))[_0xdaeb('0x45')](handleError(_0x2f9672,null));};exports[_0xdaeb('0x76')]=function(_0x52c908,_0x1d31f8,_0x3ecf4e){var _0x4228a6={};var _0x4ce150={};var _0x1fd586;var _0x4eda32;return db[_0xdaeb('0x2d')][_0xdaeb('0x77')]({'where':{'id':_0x52c908[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](handleEntityNotFound(_0x1d31f8,null))['then'](function(_0x4bd7ef){if(_0x4bd7ef){_0x1fd586=_0x4bd7ef;_0x4ce150[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db['User'][_0xdaeb('0x2e')]);_0x4ce150[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x52c908[_0xdaeb('0x34')]);_0x4ce150[_0xdaeb('0x36')]=_[_0xdaeb('0x37')](_0x4ce150[_0xdaeb('0x32')],_0x4ce150[_0xdaeb('0x34')]);_0x4228a6['attributes']=_[_0xdaeb('0x37')](_0x4ce150[_0xdaeb('0x32')],qs[_0xdaeb('0x38')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x38')]));_0x4228a6[_0xdaeb('0x39')]=_0x4228a6[_0xdaeb('0x39')]['length']?_0x4228a6[_0xdaeb('0x39')]:_0x4ce150[_0xdaeb('0x32')];_0x4228a6[_0xdaeb('0x78')]=qs[_0xdaeb('0x3d')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x4228a6['where']=qs[_0xdaeb('0x36')](_[_0xdaeb('0x3e')](_0x52c908['query'],_0x4ce150['filters']));if(_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x42')]){_0x4228a6[_0xdaeb('0x40')]=_['merge'](_0x4228a6[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x4228a6[_0xdaeb('0x39')],function(_0x4549ad){var _0x38171d={};_0x38171d[_0x4549ad]={'$like':'%'+_0x52c908['query'][_0xdaeb('0x42')]+'%'};return _0x38171d;})});}_0x4228a6=_[_0xdaeb('0x3f')]({},_0x4228a6,_0x52c908['options']);return _0x1fd586[_0xdaeb('0x76')](_0x4228a6);}})[_0xdaeb('0x26')](function(_0x58b771){if(_0x58b771){_0x4eda32=_0x58b771['length'];if(!_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x4228a6[_0xdaeb('0x21')]=qs[_0xdaeb('0x21')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x4228a6[_0xdaeb('0x1e')]=qs[_0xdaeb('0x1e')](_0x52c908[_0xdaeb('0x34')][_0xdaeb('0x1e')]);}return _0x1fd586[_0xdaeb('0x76')](_0x4228a6);}})['then'](function(_0x2d5152){if(_0x2d5152){return _0x2d5152?{'count':_0x4eda32,'rows':_0x2d5152}:null;}})[_0xdaeb('0x26')](respondWithResult(_0x1d31f8,null))['catch'](handleError(_0x1d31f8,null));};exports['getTeams']=function(_0x332b3a,_0x3c096d,_0x2a7af6){var _0x1c69b8={};var _0x4790c6={};var _0x3f876c;var _0x124102;return db[_0xdaeb('0x2d')][_0xdaeb('0x77')]({'where':{'id':_0x332b3a[_0xdaeb('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c096d,null))['then'](function(_0x20cc70){if(_0x20cc70){_0x3f876c=_0x20cc70;_0x4790c6[_0xdaeb('0x32')]=_[_0xdaeb('0x35')](db[_0xdaeb('0x79')][_0xdaeb('0x2e')]);_0x4790c6[_0xdaeb('0x34')]=_[_0xdaeb('0x35')](_0x332b3a['query']);_0x4790c6['filters']=_['intersection'](_0x4790c6[_0xdaeb('0x32')],_0x4790c6['query']);_0x1c69b8[_0xdaeb('0x39')]=_['intersection'](_0x4790c6['model'],qs[_0xdaeb('0x38')](_0x332b3a['query'][_0xdaeb('0x38')]));_0x1c69b8[_0xdaeb('0x39')]=_0x1c69b8[_0xdaeb('0x39')][_0xdaeb('0x3a')]?_0x1c69b8[_0xdaeb('0x39')]:_0x4790c6[_0xdaeb('0x32')];_0x1c69b8[_0xdaeb('0x78')]=qs[_0xdaeb('0x3d')](_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x3d')]);_0x1c69b8[_0xdaeb('0x40')]=qs['filters'](_[_0xdaeb('0x3e')](_0x332b3a['query'],_0x4790c6[_0xdaeb('0x36')]));if(_0x332b3a['query']['filter']){_0x1c69b8[_0xdaeb('0x40')]=_[_0xdaeb('0x3f')](_0x1c69b8[_0xdaeb('0x40')],{'$or':_[_0xdaeb('0x33')](_0x1c69b8[_0xdaeb('0x39')],function(_0x282979){var _0x4616c1={};_0x4616c1[_0x282979]={'$like':'%'+_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x42')]+'%'};return _0x4616c1;})});}_0x1c69b8=_[_0xdaeb('0x3f')]({},_0x1c69b8,_0x332b3a[_0xdaeb('0x7a')]);return _0x3f876c[_0xdaeb('0x7b')](_0x1c69b8);}})[_0xdaeb('0x26')](function(_0x671eea){if(_0x671eea){_0x124102=_0x671eea[_0xdaeb('0x3a')];if(!_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x3b')](_0xdaeb('0x3c'))){_0x1c69b8['limit']=qs[_0xdaeb('0x21')](_0x332b3a[_0xdaeb('0x34')][_0xdaeb('0x21')]);_0x1c69b8['offset']=qs[_0xdaeb('0x1e')](_0x332b3a['query'][_0xdaeb('0x1e')]);}return _0x3f876c['getTeams'](_0x1c69b8);}})[_0xdaeb('0x26')](function(_0x397580){if(_0x397580){return _0x397580?{'count':_0x124102,'rows':_0x397580}:null;}})['then'](respondWithResult(_0x3c096d,null))[_0xdaeb('0x45')](handleError(_0x3c096d,null));};exports['addTeams']=function(_0x3e14f8,_0x536eb0,_0x2214f4){var _0x489e90=_0x3e14f8[_0xdaeb('0x6b')][_0xdaeb('0x6f')];var _0x25ee1b;return db['Team'][_0xdaeb('0x44')]({'where':{'id':_0x489e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdaeb('0x7c'),'attributes':['id',_0xdaeb('0x2a'),_0xdaeb('0x7d'),_0xdaeb('0x7e'),_0xdaeb('0x7f')],'raw':!![]}]})['then'](function(_0x1da7c4){if(_0x1da7c4){_0x25ee1b=_0x1da7c4;var _0x3c83fd=_[_0xdaeb('0x80')](_0x1da7c4,function(_0x51225e){var _0x52a452=_0x51225e[_0xdaeb('0x4e')]({'plain':!![]});return _0x52a452[_0xdaeb('0x7c')];});return db[_0xdaeb('0x2d')]['find']({'where':{'id':_0x3e14f8[_0xdaeb('0x47')]['id']}})['then'](function(_0x3d3c4c){return db[_0xdaeb('0x4b')][_0xdaeb('0x4c')](function(_0x285a3a){return _0x3d3c4c[_0xdaeb('0x81')](_0x489e90,{'transaction':_0x285a3a})[_0xdaeb('0x26')](function(){return BPromise['each'](_0x25ee1b,function(_0x43e54c){return db[_0xdaeb('0x82')]['upsert']({'TeamId':_0x43e54c['id'],'VoicePrefixId':_0x3e14f8[_0xdaeb('0x47')]['id']},{'transaction':_0x285a3a});});})[_0xdaeb('0x26')](function(){return BPromise[_0xdaeb('0x83')](_0x3c83fd,function(_0x50f11f){return db[_0xdaeb('0x84')]['findOrCreate']({'where':{'UserId':_0x50f11f['id'],'VoicePrefixId':_0x3e14f8[_0xdaeb('0x47')]['id']},'transaction':_0x285a3a});});})[_0xdaeb('0x26')](function(){_0x3c83fd[_0xdaeb('0x85')](function(_0x4a8811){socket[_0xdaeb('0x72')](_0xdaeb('0x73'),{'UserId':_0x4a8811['id'],'VoicePrefixId':_0x3d3c4c['id']});});});});});}})[_0xdaeb('0x26')](respondWithStatusCode(_0x536eb0,null))[_0xdaeb('0x45')](handleError(_0x536eb0,null));};exports[_0xdaeb('0x86')]=function(_0x266009,_0x294c17,_0x5596e6){return db[_0xdaeb('0x79')]['findAll']({'where':{'id':_0x266009[_0xdaeb('0x34')][_0xdaeb('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xdaeb('0x87')],'as':_0xdaeb('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xdaeb('0x26')](handleEntityNotFound(_0x294c17,null))[_0xdaeb('0x26')](function(_0x573168){var _0x4c7fce=_['map'](_0x573168,'id');var _0x4146f6=[];var _0x43e9ba=[];var _0x2b4637=squel[_0xdaeb('0x88')]();_0x2b4637[_0xdaeb('0x89')](_0xdaeb('0x8a'))[_0xdaeb('0x8b')](_0xdaeb('0x8c'),'tq')[_0xdaeb('0x8d')]('user_has_teams','ut',_0xdaeb('0x8e'))[_0xdaeb('0x40')]('VoicePrefixId\x20=\x20?',_0x266009[_0xdaeb('0x47')]['id']);for(var _0x161fab=0x0;_0x161fab<_0x573168[_0xdaeb('0x3a')];_0x161fab+=0x1){let _0x4be4e7=_0x573168[_0x161fab];for(var _0x537ffa=0x0;_0x537ffa<_0x4be4e7[_0xdaeb('0x7c')]['length'];_0x537ffa+=0x1){let _0x20a678=_0x4be4e7['Agents'][_0x537ffa];var _0x43dff7=_0x2b4637[_0xdaeb('0x8f')]();_0x43dff7[_0xdaeb('0x40')](_0xdaeb('0x90'),_0x20a678['id']);_0x43e9ba[_0xdaeb('0x62')](db['sequelize'][_0xdaeb('0x34')](_0x43dff7[_0xdaeb('0x91')](),{'type':db['sequelize']['QueryTypes'][_0xdaeb('0x92')]})[_0xdaeb('0x26')](function(_0x373682){if(_0x373682['length']===0x1){return _0x20a678['id'];}else{var _0x418914=_['every'](_[_0xdaeb('0x33')](_0x373682,_0xdaeb('0x93')),function(_0x514928){return _[_0xdaeb('0x94')](_0x4c7fce,_0x514928);});if(_0x418914){return _0x20a678['id'];}}}));}}return BPromise[_0xdaeb('0x95')](_0x43e9ba)[_0xdaeb('0x26')](function(_0x383217){_0x4146f6=_(_0x4146f6)[_0xdaeb('0x96')](_0x383217)[_0xdaeb('0x97')]()[_0xdaeb('0x98')]();return db[_0xdaeb('0x2d')][_0xdaeb('0x49')]({'where':{'id':_0x266009[_0xdaeb('0x47')]['id']}})[_0xdaeb('0x26')](function(_0x3450c9){return db['sequelize'][_0xdaeb('0x4c')](function(_0x7c1d3c){return _0x3450c9[_0xdaeb('0x86')](_0x266009[_0xdaeb('0x34')][_0xdaeb('0x6f')],{'transaction':_0x7c1d3c})[_0xdaeb('0x26')](function(){if(!_[_0xdaeb('0x99')](_0x4146f6)){return _0x3450c9[_0xdaeb('0x74')](_0x4146f6,{'transaction':_0x7c1d3c});}})[_0xdaeb('0x26')](function(){_0x4146f6['forEach'](function(_0x9fcb7d){socket['emit'](_0xdaeb('0x75'),{'UserId':_0x9fcb7d,'VoicePrefixId':_0x3450c9['id']});});});});});});})[_0xdaeb('0x26')](respondWithStatusCode(_0x294c17,null))[_0xdaeb('0x45')](handleError(_0x294c17,null));}; \ No newline at end of file +var _0xd824=['NoOp','charAt','system-','transaction','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','sort','pick','nolimit','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes','all','value','removeTeams','isEmpty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','userProfileId','autoAssociation','UserProfileResource','context','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL='];(function(_0x251703,_0x1c8a08){var _0xf0699e=function(_0x5b354c){while(--_0x5b354c){_0x251703['push'](_0x251703['shift']());}};_0xf0699e(++_0x1c8a08);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4d82('0x14')]=_[_0x4d82('0x15')](config[_0x4d82('0x14')],{'host':_0x4d82('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0x14')]));require(_0x4d82('0x17'))[_0x4d82('0x18')](socket);function respondWithStatusCode(_0x486152,_0x70c598){_0x70c598=_0x70c598||0xcc;return function(_0x4f4c45){if(_0x4f4c45){return _0x486152[_0x4d82('0x19')](_0x70c598);}return _0x486152['status'](_0x70c598)[_0x4d82('0x1a')]();};}function respondWithResult(_0x496f3b,_0x474acf){_0x474acf=_0x474acf||0xc8;return function(_0xb1640d){if(_0xb1640d){return _0x496f3b[_0x4d82('0x1b')](_0x474acf)[_0x4d82('0x1c')](_0xb1640d);}};}function respondWithFilteredResult(_0x2648a8,_0x7c03fc){return function(_0x258c59){if(_0x258c59){var _0x217b72=typeof _0x7c03fc[_0x4d82('0x1d')]==='undefined'&&typeof _0x7c03fc[_0x4d82('0x1e')]===_0x4d82('0x1f');var _0x1b1e39=_0x258c59[_0x4d82('0x20')];var _0xe6260=_0x217b72?0x0:_0x7c03fc[_0x4d82('0x1d')];var _0x1a513d=_0x217b72?_0x258c59[_0x4d82('0x20')]:_0x7c03fc[_0x4d82('0x1d')]+_0x7c03fc[_0x4d82('0x1e')];var _0xf2f5a5;if(_0x1a513d>=_0x1b1e39){_0x1a513d=_0x1b1e39;_0xf2f5a5=0xc8;}else{_0xf2f5a5=0xce;}_0x2648a8['status'](_0xf2f5a5);return _0x2648a8[_0x4d82('0x21')](_0x4d82('0x22'),_0xe6260+'-'+_0x1a513d+'/'+_0x1b1e39)['json'](_0x258c59);}return null;};}function patchUpdates(_0x1a419f){return function(_0x41f194){try{jsonpatch[_0x4d82('0x23')](_0x41f194,_0x1a419f,!![]);}catch(_0x14a2d4){return BPromise[_0x4d82('0x24')](_0x14a2d4);}return _0x41f194[_0x4d82('0x25')]();};}function saveUpdates(_0x11c043,_0x462258){return function(_0x12feab){if(_0x12feab){return _0x12feab[_0x4d82('0x26')](_0x11c043)[_0x4d82('0x27')](function(_0x395efc){return _0x395efc;});}return null;};}function removeEntity(_0x7404ba,_0x284c66){return function(_0x1940ef){if(_0x1940ef){return _0x1940ef['destroy']()['then'](function(){var _0x3dcb0f=_0x1940ef[_0x4d82('0x28')]({'plain':!![]});var _0x2a0572=_0x4d82('0x29');return db['UserProfileResource'][_0x4d82('0x2a')]({'where':{'type':_0x2a0572,'resourceId':_0x3dcb0f['id']}})[_0x4d82('0x27')](function(){return _0x1940ef;});})[_0x4d82('0x27')](function(){_0x7404ba[_0x4d82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4081f6,_0x4a7444){return function(_0x4d9ac4){if(!_0x4d9ac4){_0x4081f6['sendStatus'](0x194);}return _0x4d9ac4;};}function handleError(_0x52533b,_0x3d2229){_0x3d2229=_0x3d2229||0x1f4;return function(_0x8cfbf1){logger[_0x4d82('0x2b')](_0x8cfbf1['stack']);if(_0x8cfbf1[_0x4d82('0x2c')]){delete _0x8cfbf1[_0x4d82('0x2c')];}_0x52533b['status'](_0x3d2229)['send'](_0x8cfbf1);};}exports[_0x4d82('0x2d')]=function(_0x46a058,_0x16d30a){var _0x175961={},_0x5447f8={},_0x33d2a9={'count':0x0,'rows':[]};var _0x59cd4f=_[_0x4d82('0x2e')](db[_0x4d82('0x2f')]['rawAttributes'],function(_0x583cc5){return{'name':_0x583cc5[_0x4d82('0x30')],'type':_0x583cc5[_0x4d82('0x31')][_0x4d82('0x32')]};});_0x5447f8[_0x4d82('0x33')]=_[_0x4d82('0x2e')](_0x59cd4f,_0x4d82('0x2c'));_0x5447f8[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x46a058[_0x4d82('0x34')]);_0x5447f8[_0x4d82('0x36')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],_0x5447f8[_0x4d82('0x34')]);_0x175961[_0x4d82('0x37')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],qs[_0x4d82('0x38')](_0x46a058['query'][_0x4d82('0x38')]));_0x175961[_0x4d82('0x37')]=_0x175961[_0x4d82('0x37')]['length']?_0x175961[_0x4d82('0x37')]:_0x5447f8[_0x4d82('0x33')];if(!_0x46a058['query'][_0x4d82('0x39')]('nolimit')){_0x175961[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x46a058['query'][_0x4d82('0x1e')]);_0x175961['offset']=qs[_0x4d82('0x1d')](_0x46a058['query']['offset']);}_0x175961[_0x4d82('0x3a')]=qs['sort'](_0x46a058[_0x4d82('0x34')]['sort']);_0x175961[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0x46a058[_0x4d82('0x34')],_0x5447f8['filters']),_0x59cd4f);if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x175961['where']=_[_0x4d82('0x3d')](_0x175961['where'],{'$or':_[_0x4d82('0x2e')](_0x59cd4f,function(_0x54f714){if(_0x54f714[_0x4d82('0x31')]!==_0x4d82('0x3e')){var _0x1d9e8b={};_0x1d9e8b[_0x54f714[_0x4d82('0x2c')]]={'$like':'%'+_0x46a058['query'][_0x4d82('0x3c')]+'%'};return _0x1d9e8b;}})});}_0x175961=_[_0x4d82('0x3d')]({},_0x175961,_0x46a058[_0x4d82('0x3f')]);var _0x3e29a6={'where':_0x175961[_0x4d82('0x3b')]};return db[_0x4d82('0x2f')][_0x4d82('0x20')](_0x3e29a6)['then'](function(_0x3c80d6){_0x33d2a9[_0x4d82('0x20')]=_0x3c80d6;if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x40')]){_0x175961[_0x4d82('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x4d82('0x42')](_0x175961);})[_0x4d82('0x27')](function(_0x3f0a9f){_0x33d2a9[_0x4d82('0x43')]=_0x3f0a9f;return _0x33d2a9;})[_0x4d82('0x27')](respondWithFilteredResult(_0x16d30a,_0x175961))[_0x4d82('0x44')](handleError(_0x16d30a,null));};exports[_0x4d82('0x45')]=function(_0x5847c0,_0xe8c15f){var _0x1909da={'raw':![],'where':{'id':_0x5847c0[_0x4d82('0x46')]['id']}},_0x55e2f7={};_0x55e2f7['model']=_[_0x4d82('0x35')](db[_0x4d82('0x2f')]['rawAttributes']);_0x55e2f7[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x5847c0['query']);_0x55e2f7[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x55e2f7[_0x4d82('0x33')],_0x55e2f7['query']);_0x1909da[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x55e2f7['model'],qs['fields'](_0x5847c0[_0x4d82('0x34')][_0x4d82('0x38')]));_0x1909da[_0x4d82('0x37')]=_0x1909da[_0x4d82('0x37')][_0x4d82('0x48')]?_0x1909da[_0x4d82('0x37')]:_0x55e2f7[_0x4d82('0x33')];if(_0x5847c0['query'][_0x4d82('0x40')]){_0x1909da[_0x4d82('0x41')]=[{'all':!![]}];}_0x1909da=_[_0x4d82('0x3d')]({},_0x1909da,_0x5847c0[_0x4d82('0x3f')]);return db['VoicePrefix']['find'](_0x1909da)['then'](handleEntityNotFound(_0xe8c15f,null))[_0x4d82('0x27')](respondWithResult(_0xe8c15f,null))[_0x4d82('0x44')](handleError(_0xe8c15f,null));};exports[_0x4d82('0x2a')]=function(_0x34a08b,_0x25fc80){return db[_0x4d82('0x2f')]['find']({'where':{'id':_0x34a08b[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x25fc80,null))[_0x4d82('0x27')](removeEntity(_0x25fc80,null))[_0x4d82('0x44')](handleError(_0x25fc80,null));};exports[_0x4d82('0x49')]=function(_0x33f498,_0x127ef3){return db[_0x4d82('0x2f')][_0x4d82('0x49')]()['then'](respondWithResult(_0x127ef3,null))[_0x4d82('0x44')](handleError(_0x127ef3,null));};exports[_0x4d82('0x4a')]=function(_0x1822db,_0x25e8b9){var _0x1d853f;return db[_0x4d82('0x4b')]['transaction'](function(_0x5cf138){return db[_0x4d82('0x2f')][_0x4d82('0x4a')](_0x1822db[_0x4d82('0x4c')],{'transaction':_0x5cf138})[_0x4d82('0x27')](function(_0x2e373a){_0x1d853f=_0x2e373a[_0x4d82('0x28')]({'plain':!![]});return db[_0x4d82('0x4d')][_0x4d82('0x4e')]({'where':{'id':_0x1d853f[_0x4d82('0x4f')]},'raw':!![]})[_0x4d82('0x27')](function(_0x367c82){return createVoicePrefixExtensions(_0x1d853f,_0x367c82,_0x5cf138);});});})[_0x4d82('0x27')](function(){var _0x517f87=_0x1822db[_0x4d82('0x50')]['get']({'plain':!![]});if(!_0x517f87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517f87[_0x4d82('0x51')]===_0x4d82('0x50')){var _0x257dc4=_0x1d853f;return db['UserProfileSection'][_0x4d82('0x4e')]({'where':{'name':_0x4d82('0x29'),'userProfileId':_0x517f87[_0x4d82('0x52')]},'raw':!![]})[_0x4d82('0x27')](function(_0x4aaa65){if(_0x4aaa65&&_0x4aaa65[_0x4d82('0x53')]===0x0){return db[_0x4d82('0x54')][_0x4d82('0x4a')]({'name':_0x257dc4[_0x4d82('0x2c')],'resourceId':_0x257dc4['id'],'type':_0x4aaa65[_0x4d82('0x2c')],'sectionId':_0x4aaa65['id']},{})['then'](function(){return _0x1d853f;});}else{return _0x1d853f;}})[_0x4d82('0x44')](function(_0x3297ce){logger[_0x4d82('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3297ce);throw _0x3297ce;});}return _0x1d853f;})[_0x4d82('0x27')](respondWithResult(_0x25e8b9,null))[_0x4d82('0x44')](handleError(_0x25e8b9,null));};function Extension(_0x131bb5,_0x189e3f,_0x14e621,_0x3148bd){this[_0x4d82('0x55')]='from-sip';this['exten']=_0x131bb5;this[_0x4d82('0x56')]=_0x14e621;this[_0x4d82('0x31')]=_0x4d82('0x57');this['description']=_0x4d82('0x58');this[_0x4d82('0x59')]=_0x189e3f;this[_0x4d82('0x5a')]=_0x3148bd;}function createVoicePrefixExtensions(_0x3d85c2,_0x238459,_0x2aec60){return new BPromise(function(_0xa2cdb3,_0xc70504){var _0x131a10=new Extension(formatPrefixName(_0x3d85c2[_0x4d82('0x5b')]),0x1,'NoOp','Voice\x20Prefix');_0x131a10[_0x4d82('0x5c')]=_0x3d85c2['id'];return db[_0x4d82('0x4d')][_0x4d82('0x4a')](_0x131a10,{'transaction':_0x2aec60})['then'](function(_0x471349){var _0xc80c61=_0x471349[_0x4d82('0x28')]({'plain':!![]});var _0x328991=_[_0x4d82('0x2e')](addVoicePrefixExtensions(_0x3d85c2,_0x238459),function(_0x43c72e){_0x43c72e[_0x4d82('0x4f')]=_0xc80c61['id'];_0x43c72e[_0x4d82('0x5c')]=_0x3d85c2['id'];return _0x43c72e;});return db['VoiceExtension'][_0x4d82('0x5d')](_0x328991,{'transaction':_0x2aec60})[_0x4d82('0x27')](function(_0x279172){if(!_0x279172){return _0xc70504('Extensions\x20creation\x20failed');}else{return _0xa2cdb3(_0x279172);}})['catch'](function(_0x1d3e90){return _0xc70504(_0x1d3e90);});});;});};function addVoicePrefixExtensions(_0xc5b353,_0x1a785a){var _0x15d620=[];var _0x2872bf=formatPrefixName(_0xc5b353[_0x4d82('0x5b')]);_0x15d620['push'](new Extension(_0x2872bf,0x2,_0x4d82('0x5e'),_0x4d82('0x5f')+_0xc5b353[_0x4d82('0x2c')]));if(_0xc5b353['callerIdAll']){_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x5e'),_0x4d82('0x61')+_0xc5b353['callerIdAll']));}else{_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x62'),'No\x20callerid\x20available'));}_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x4,'goto',_0x1a785a[_0x4d82('0x55')]+','+'${EXTEN:'+(0x8+_0xc5b353['name'][_0x4d82('0x48')])+'}'+','+0x1));return _0x15d620;}function formatPrefixName(_0x32e291){var _0x5279e3='_';for(var _0x307592=0x0;_0x307592<_0x32e291['length'];_0x307592++){if(_0x32e291[_0x4d82('0x63')](_0x307592)=='-'){_0x5279e3+=_0x32e291['charAt'](_0x307592);}else{_0x5279e3+='['+_0x32e291[_0x4d82('0x63')](_0x307592)+']';}}_0x5279e3+='.';return _0x5279e3;}exports[_0x4d82('0x26')]=function(_0x2fcf61,_0x75900c,_0x9c5e5c){var _0x456f33=_0x2fcf61[_0x4d82('0x4c')];_0x456f33[_0x4d82('0x5b')]=_0x4d82('0x64')+_0x456f33[_0x4d82('0x2c')]+'-';return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x14d697){return db[_0x4d82('0x2f')][_0x4d82('0x26')](_0x456f33,{'where':{'id':_0x456f33['id']},'transaction':_0x14d697})[_0x4d82('0x27')](function(){return db[_0x4d82('0x4d')][_0x4d82('0x2a')]({'where':{'VoicePrefixId':_0x456f33['id']},'transaction':_0x14d697})['then'](function(){return db['VoiceExtension'][_0x4d82('0x4e')]({'where':{'id':_0x456f33['VoiceExtensionId']},'raw':!![]})[_0x4d82('0x27')](function(_0x47644d){return createVoicePrefixExtensions(_0x456f33,_0x47644d,_0x14d697);});});});})[_0x4d82('0x27')](function(){return db[_0x4d82('0x2f')][_0x4d82('0x66')](_0x456f33['id']);})[_0x4d82('0x27')](respondWithResult(_0x75900c,null))['catch'](handleError(_0x75900c,null));};exports[_0x4d82('0x67')]=function(_0x220e87,_0x554778,_0x80d688){return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0x220e87[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x554778,null))[_0x4d82('0x27')](function(_0x212561){if(_0x212561){return _0x212561[_0x4d82('0x67')](_0x220e87['body']['ids'],_['omit'](_0x220e87['body'],['ids','id'])||{})[_0x4d82('0x68')](function(_0x245e97){for(var _0x1fe26a=0x0;_0x1fe26a<_0x220e87['body'][_0x4d82('0x69')][_0x4d82('0x48')];_0x1fe26a+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':Number(_0x220e87[_0x4d82('0x4c')]['ids'][_0x1fe26a]),'VoicePrefixId':Number(_0x220e87['params']['id'])});}return _0x245e97;});}})[_0x4d82('0x27')](respondWithResult(_0x554778,null))[_0x4d82('0x44')](handleError(_0x554778,null));};exports[_0x4d82('0x6c')]=function(_0x2471b8,_0xd64d2a,_0x353c18){return db['VoicePrefix'][_0x4d82('0x4e')]({'where':{'id':_0x2471b8['params']['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0xd64d2a,null))[_0x4d82('0x27')](function(_0x28a256){if(_0x28a256){return _0x28a256[_0x4d82('0x6c')](_0x2471b8[_0x4d82('0x34')]['ids'])[_0x4d82('0x27')](function(){if(_[_0x4d82('0x6d')](_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')])){for(var _0x2a50b3=0x0;_0x2a50b3<_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')][_0x4d82('0x48')];_0x2a50b3+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')]['ids'][_0x2a50b3]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}}else{socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}});}})[_0x4d82('0x27')](respondWithStatusCode(_0xd64d2a,null))['catch'](handleError(_0xd64d2a,null));};exports[_0x4d82('0x6f')]=function(_0x3b7592,_0x5380ce,_0x21ea7c){var _0x588471={};var _0x634bfb={};var _0x5092ff;var _0x472666;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0x3b7592[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5380ce,null))['then'](function(_0x960e9){if(_0x960e9){_0x5092ff=_0x960e9;_0x634bfb[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x71')][_0x4d82('0x72')]);_0x634bfb[_0x4d82('0x34')]=_['keys'](_0x3b7592['query']);_0x634bfb[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x634bfb[_0x4d82('0x33')],_0x634bfb[_0x4d82('0x34')]);_0x588471[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x634bfb['model'],qs[_0x4d82('0x38')](_0x3b7592[_0x4d82('0x34')]['fields']));_0x588471[_0x4d82('0x37')]=_0x588471[_0x4d82('0x37')][_0x4d82('0x48')]?_0x588471['attributes']:_0x634bfb[_0x4d82('0x33')];_0x588471[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0x3b7592[_0x4d82('0x34')]['sort']);_0x588471[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_[_0x4d82('0x74')](_0x3b7592[_0x4d82('0x34')],_0x634bfb['filters']));if(_0x3b7592[_0x4d82('0x34')]['filter']){_0x588471['where']=_[_0x4d82('0x3d')](_0x588471[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x588471[_0x4d82('0x37')],function(_0xb2d707){var _0x49d4ed={};_0x49d4ed[_0xb2d707]={'$like':'%'+_0x3b7592[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x49d4ed;})});}_0x588471=_['merge']({},_0x588471,_0x3b7592[_0x4d82('0x3f')]);return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x210ed6){if(_0x210ed6){_0x472666=_0x210ed6['length'];if(!_0x3b7592[_0x4d82('0x34')]['hasOwnProperty'](_0x4d82('0x75'))){_0x588471[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x588471[_0x4d82('0x1d')]=qs['offset'](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1d')]);}return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x2c80ae){if(_0x2c80ae){return _0x2c80ae?{'count':_0x472666,'rows':_0x2c80ae}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5380ce,null))[_0x4d82('0x44')](handleError(_0x5380ce,null));};exports['getTeams']=function(_0xfb0987,_0x5a65e4,_0x252db4){var _0x24a63a={};var _0x2d0b29={};var _0x44c35f;var _0x54fcd4;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0xfb0987[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5a65e4,null))[_0x4d82('0x27')](function(_0x45b2e3){if(_0x45b2e3){_0x44c35f=_0x45b2e3;_0x2d0b29[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x76')][_0x4d82('0x72')]);_0x2d0b29[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0xfb0987[_0x4d82('0x34')]);_0x2d0b29['filters']=_[_0x4d82('0x47')](_0x2d0b29[_0x4d82('0x33')],_0x2d0b29[_0x4d82('0x34')]);_0x24a63a[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x2d0b29['model'],qs[_0x4d82('0x38')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x38')]));_0x24a63a[_0x4d82('0x37')]=_0x24a63a[_0x4d82('0x37')][_0x4d82('0x48')]?_0x24a63a['attributes']:_0x2d0b29['model'];_0x24a63a[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0xfb0987[_0x4d82('0x34')]['sort']);_0x24a63a[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0xfb0987[_0x4d82('0x34')],_0x2d0b29[_0x4d82('0x36')]));if(_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x24a63a[_0x4d82('0x3b')]=_[_0x4d82('0x3d')](_0x24a63a[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x24a63a['attributes'],function(_0x5471c3){var _0x1d1329={};_0x1d1329[_0x5471c3]={'$like':'%'+_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x1d1329;})});}_0x24a63a=_['merge']({},_0x24a63a,_0xfb0987[_0x4d82('0x3f')]);return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})[_0x4d82('0x27')](function(_0x5a9056){if(_0x5a9056){_0x54fcd4=_0x5a9056[_0x4d82('0x48')];if(!_0xfb0987['query']['hasOwnProperty'](_0x4d82('0x75'))){_0x24a63a[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x24a63a[_0x4d82('0x1d')]=qs[_0x4d82('0x1d')](_0xfb0987[_0x4d82('0x34')]['offset']);}return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})['then'](function(_0xc764bb){if(_0xc764bb){return _0xc764bb?{'count':_0x54fcd4,'rows':_0xc764bb}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5a65e4,null))[_0x4d82('0x44')](handleError(_0x5a65e4,null));};exports['addTeams']=function(_0xead937,_0x59e1bc,_0x521566){var _0x1eda7c=_0xead937['body'][_0x4d82('0x69')];var _0x5ac864;return db[_0x4d82('0x76')][_0x4d82('0x42')]({'where':{'id':_0x1eda7c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4d82('0x78'),'attributes':['id',_0x4d82('0x2c'),_0x4d82('0x79'),_0x4d82('0x7a'),_0x4d82('0x7b')],'raw':!![]}]})[_0x4d82('0x27')](function(_0x2b832e){if(_0x2b832e){_0x5ac864=_0x2b832e;var _0x402626=_[_0x4d82('0x7c')](_0x2b832e,function(_0x3be4f9){var _0x47c734=_0x3be4f9[_0x4d82('0x28')]({'plain':!![]});return _0x47c734[_0x4d82('0x78')];});return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xead937[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](function(_0x1768e2){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x1c61f5){return _0x1768e2[_0x4d82('0x7d')](_0x1eda7c,{'transaction':_0x1c61f5})[_0x4d82('0x27')](function(){return BPromise[_0x4d82('0x7e')](_0x5ac864,function(_0x44729c){return db[_0x4d82('0x7f')][_0x4d82('0x80')]({'TeamId':_0x44729c['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},{'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){return BPromise['each'](_0x402626,function(_0x2867e7){return db[_0x4d82('0x81')][_0x4d82('0x82')]({'where':{'UserId':_0x2867e7['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){_0x402626['forEach'](function(_0x14b0cb){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':_0x14b0cb['id'],'VoicePrefixId':_0x1768e2['id']});});});});});}})[_0x4d82('0x27')](respondWithStatusCode(_0x59e1bc,null))[_0x4d82('0x44')](handleError(_0x59e1bc,null));};exports['removeTeams']=function(_0xc56d02,_0x34234c,_0x23778f){return db['Team'][_0x4d82('0x42')]({'where':{'id':_0xc56d02['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4d82('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34234c,null))[_0x4d82('0x27')](function(_0x1d32c3){var _0x4d0047=_['map'](_0x1d32c3,'id');var _0x4f7c18=[];var _0x4277b7=[];var _0x2b7c2c=squel[_0x4d82('0x83')]();_0x2b7c2c['field']('tq.TeamId')[_0x4d82('0x84')](_0x4d82('0x85'),'tq')[_0x4d82('0x86')](_0x4d82('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4d82('0x3b')](_0x4d82('0x88'),_0xc56d02[_0x4d82('0x46')]['id']);for(var _0x2c18b2=0x0;_0x2c18b2<_0x1d32c3[_0x4d82('0x48')];_0x2c18b2+=0x1){let _0x37cac6=_0x1d32c3[_0x2c18b2];for(var _0x642d9=0x0;_0x642d9<_0x37cac6['Agents'][_0x4d82('0x48')];_0x642d9+=0x1){let _0x3097f8=_0x37cac6[_0x4d82('0x78')][_0x642d9];var _0x5ccadb=_0x2b7c2c['clone']();_0x5ccadb[_0x4d82('0x3b')](_0x4d82('0x89'),_0x3097f8['id']);_0x4277b7[_0x4d82('0x60')](db['sequelize'][_0x4d82('0x34')](_0x5ccadb[_0x4d82('0x8a')](),{'type':db[_0x4d82('0x4b')][_0x4d82('0x8b')]['SELECT']})[_0x4d82('0x27')](function(_0x3f0228){if(_0x3f0228['length']===0x1){return _0x3097f8['id'];}else{var _0x5f4633=_[_0x4d82('0x8c')](_['map'](_0x3f0228,'TeamId'),function(_0x3e4fb1){return _[_0x4d82('0x8d')](_0x4d0047,_0x3e4fb1);});if(_0x5f4633){return _0x3097f8['id'];}}}));}}return BPromise[_0x4d82('0x8e')](_0x4277b7)['then'](function(_0x4d6de5){_0x4f7c18=_(_0x4f7c18)['union'](_0x4d6de5)['compact']()[_0x4d82('0x8f')]();return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xc56d02['params']['id']}})[_0x4d82('0x27')](function(_0x227e2c){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x4f36f5){return _0x227e2c[_0x4d82('0x90')](_0xc56d02['query'][_0x4d82('0x69')],{'transaction':_0x4f36f5})[_0x4d82('0x27')](function(){if(!_[_0x4d82('0x91')](_0x4f7c18)){return _0x227e2c[_0x4d82('0x6c')](_0x4f7c18,{'transaction':_0x4f36f5});}})[_0x4d82('0x27')](function(){_0x4f7c18['forEach'](function(_0x3a0735){socket[_0x4d82('0x6a')]('userVoicePrefix:remove',{'UserId':_0x3a0735,'VoicePrefixId':_0x227e2c['id']});});});});});});})['then'](respondWithStatusCode(_0x34234c,null))['catch'](handleError(_0x34234c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3de3f73..cdafc8f 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 _0xfa43=['emit','hook','exports','VoicePrefix','setMaxListeners','save','update'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0xfa43,0xab));var _0x3fa4=function(_0x44f630,_0xcdd7f8){_0x44f630=_0x44f630-0x0;var _0x3633ef=_0xfa43[_0x44f630];return _0x3633ef;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x3fa4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3fa4('0x1')](0x0);var events={'afterCreate':_0x3fa4('0x2'),'afterUpdate':_0x3fa4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3adb05){return function(_0xbce03d,_0x2b4538,_0x53311a){VoicePrefixEvents['emit'](_0x3adb05+':'+_0xbce03d['id'],_0xbce03d);VoicePrefixEvents[_0x3fa4('0x4')](_0x3adb05,_0xbce03d);_0x53311a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x3fa4('0x5')](e,emitEvent(event));}}module[_0x3fa4('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x8ad3=['events','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x8ad3,0x70));var _0x38ad=function(_0x521eec,_0x5ac1d0){_0x521eec=_0x521eec-0x0;var _0x4e6f5e=_0x8ad3[_0x521eec];return _0x4e6f5e;};'use strict';var EventEmitter=require(_0x38ad('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x38ad('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38ad('0x2'),'afterDestroy':_0x38ad('0x3')};function emitEvent(_0x2ca78e){return function(_0x1b8818,_0x1f4341,_0x581b32){VoicePrefixEvents[_0x38ad('0x4')](_0x2ca78e+':'+_0x1b8818['id'],_0x1b8818);VoicePrefixEvents[_0x38ad('0x4')](_0x2ca78e,_0x1b8818);_0x581b32(null);};}for(var e in events){if(events[_0x38ad('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x38ad('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 563f310..1159130 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 _0xb6ff=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./voicePrefix.attributes','define','voice_prefixes'];(function(_0x3e191f,_0x3ff864){var _0x195058=function(_0x524218){while(--_0x524218){_0x3e191f['push'](_0x3e191f['shift']());}};_0x195058(++_0x3ff864);}(_0xb6ff,0x14d));var _0xfb6f=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0xb6ff[_0x102f97];return _0xd22058;};'use strict';var _=require('lodash');var util=require(_0xfb6f('0x0'));var logger=require(_0xfb6f('0x1'))('api');var moment=require(_0xfb6f('0x2'));var BPromise=require(_0xfb6f('0x3'));var rp=require(_0xfb6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb6f('0x5'));var config=require('../../config/environment');var attributes=require(_0xfb6f('0x6'));module['exports']=function(_0x4fdd24,_0x249695){return _0x4fdd24[_0xfb6f('0x7')]('VoicePrefix',attributes,{'tableName':_0xfb6f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a3c=['VoicePrefix','lodash','../../config/logger','api','bluebird','path','../../config/environment','./voicePrefix.attributes'];(function(_0x3e7e29,_0x5a94cd){var _0xe1d068=function(_0x274639){while(--_0x274639){_0x3e7e29['push'](_0x3e7e29['shift']());}};_0xe1d068(++_0x5a94cd);}(_0x0a3c,0x1c9));var _0xc0a3=function(_0x17baee,_0x110fb6){_0x17baee=_0x17baee-0x0;var _0x3b6939=_0x0a3c[_0x17baee];return _0x3b6939;};'use strict';var _=require(_0xc0a3('0x0'));var util=require('util');var logger=require(_0xc0a3('0x1'))(_0xc0a3('0x2'));var moment=require('moment');var BPromise=require(_0xc0a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a3('0x4'));var rimraf=require('rimraf');var config=require(_0xc0a3('0x5'));var attributes=require(_0xc0a3('0x6'));module['exports']=function(_0x38bd28,_0x4d7020){return _0x38bd28['define'](_0xc0a3('0x7'),attributes,{'tableName':'voice_prefixes','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 813975d..6b281ca 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 _0xab54=['localhost','socket.io-emitter','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','redis'];(function(_0x583453,_0x1ce51c){var _0x4169de=function(_0x1296e5){while(--_0x1296e5){_0x583453['push'](_0x583453['shift']());}};_0x4169de(++_0x1ce51c);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var BPromise=require(_0x4ab5('0x2'));var rs=require(_0x4ab5('0x3'));var fs=require('fs');var Redis=require(_0x4ab5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ab5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4ab5('0x6'));var client=jayson[_0x4ab5('0x7')]['http']({'port':0x232a});config[_0x4ab5('0x8')]=_['defaults'](config[_0x4ab5('0x8')],{'host':_0x4ab5('0x9'),'port':0x18eb});var socket=require(_0x4ab5('0xa'))(new Redis(config[_0x4ab5('0x8')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x5f5209,_0x30ef3d,_0x168817){return new BPromise(function(_0x5326a6,_0x32a206){return client[_0x4ab5('0xb')](_0x5f5209,_0x168817)['then'](function(_0x139648){logger[_0x4ab5('0xc')](_0x4ab5('0xd'),_0x30ef3d,_0x4ab5('0xe'));logger[_0x4ab5('0xf')](_0x4ab5('0x10'),_0x30ef3d,_0x4ab5('0xe'),JSON[_0x4ab5('0x11')](_0x139648));if(_0x139648[_0x4ab5('0x12')]){if(_0x139648[_0x4ab5('0x12')][_0x4ab5('0x13')]===0x1f4){logger[_0x4ab5('0x12')](_0x4ab5('0xd'),_0x30ef3d,_0x139648[_0x4ab5('0x12')]['message']);return _0x32a206(_0x139648[_0x4ab5('0x12')]['message']);}logger[_0x4ab5('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x139648['error'][_0x4ab5('0x14')]);return _0x5326a6(_0x139648[_0x4ab5('0x12')][_0x4ab5('0x14')]);}else{logger[_0x4ab5('0xc')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x4ab5('0xe'));_0x5326a6(_0x139648[_0x4ab5('0x15')]['message']);}})['catch'](function(_0x5d0afa){logger[_0x4ab5('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x30ef3d,_0x5d0afa);_0x32a206(_0x5d0afa);});});} \ No newline at end of file +var _0xb94c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x3d2198,_0x51e97c){var _0x557f35=function(_0x119cce){while(--_0x119cce){_0x3d2198['push'](_0x3d2198['shift']());}};_0x557f35(++_0x51e97c);}(_0xb94c,0x176));var _0xcb94=function(_0x4c3550,_0x171432){_0x4c3550=_0x4c3550-0x0;var _0x2dc5f7=_0xb94c[_0x4c3550];return _0x2dc5f7;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var moment=require('moment');var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb94('0x5'))(_0xcb94('0x6'));var config=require(_0xcb94('0x7'));var jayson=require(_0xcb94('0x8'));var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});config[_0xcb94('0xa')]=_[_0xcb94('0xb')](config[_0xcb94('0xa')],{'host':_0xcb94('0xc'),'port':0x18eb});var socket=require(_0xcb94('0xd'))(new Redis(config['redis']));require(_0xcb94('0xe'))[_0xcb94('0xf')](socket);function respondWithRpcPromise(_0x4374ea,_0x327f46,_0x513702){return new BPromise(function(_0x459102,_0x338ca1){return client[_0xcb94('0x10')](_0x4374ea,_0x513702)[_0xcb94('0x11')](function(_0x3887ce){logger[_0xcb94('0x12')](_0xcb94('0x13'),_0x327f46,_0xcb94('0x14'));logger[_0xcb94('0x15')](_0xcb94('0x16'),_0x327f46,'request\x20sent',JSON[_0xcb94('0x17')](_0x3887ce));if(_0x3887ce[_0xcb94('0x18')]){if(_0x3887ce['error']['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x327f46,_0x3887ce[_0xcb94('0x18')][_0xcb94('0x19')]);return _0x338ca1(_0x3887ce[_0xcb94('0x18')]['message']);}logger[_0xcb94('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x327f46,_0x3887ce[_0xcb94('0x18')][_0xcb94('0x19')]);return _0x459102(_0x3887ce[_0xcb94('0x18')][_0xcb94('0x19')]);}else{logger[_0xcb94('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x327f46,_0xcb94('0x14'));_0x459102(_0x3887ce['result']['message']);}})[_0xcb94('0x1a')](function(_0x19097c){logger[_0xcb94('0x18')](_0xcb94('0x13'),_0x327f46,_0x19097c);_0x338ca1(_0x19097c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 72ceb59..4b40f8f 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 _0xd353=['update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4af4a0,_0x1f1a3b){var _0x3bb9c7=function(_0x16de40){while(--_0x16de40){_0x4af4a0['push'](_0x4af4a0['shift']());}};_0x3bb9c7(++_0x1f1a3b);}(_0xd353,0x7e));var _0x3d35=function(_0x56ecb0,_0x40ece1){_0x56ecb0=_0x56ecb0-0x0;var _0xce5ee7=_0xd353[_0x56ecb0];return _0xce5ee7;};'use strict';var VoicePrefixEvents=require(_0x3d35('0x0'));var events=[_0x3d35('0x1'),'remove',_0x3d35('0x2')];function createListener(_0x408bd9,_0x4e0c68){return function(_0x528f0e){_0x4e0c68[_0x3d35('0x3')](_0x408bd9,_0x528f0e);};}function removeListener(_0x4e0869,_0x3bc47e){return function(){VoicePrefixEvents[_0x3d35('0x4')](_0x4e0869,_0x3bc47e);};}exports[_0x3d35('0x5')]=function(_0xb43971){for(var _0x16965f=0x0,_0x174b6b=events[_0x3d35('0x6')];_0x16965f<_0x174b6b;_0x16965f++){var _0x5db879=events[_0x16965f];var _0x2dd75b=createListener(_0x3d35('0x7')+_0x5db879,_0xb43971);VoicePrefixEvents['on'](_0x5db879,_0x2dd75b);}}; \ No newline at end of file +var _0x7633=['update','emit','removeListener','length','./voicePrefix.events','save','remove'];(function(_0xe0cfda,_0x3f363f){var _0x403be4=function(_0xff98a4){while(--_0xff98a4){_0xe0cfda['push'](_0xe0cfda['shift']());}};_0x403be4(++_0x3f363f);}(_0x7633,0x1c4));var _0x3763=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7633[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x3763('0x0'));var events=[_0x3763('0x1'),_0x3763('0x2'),_0x3763('0x3')];function createListener(_0xd1b764,_0x5db18c){return function(_0xa069d0){_0x5db18c[_0x3763('0x4')](_0xd1b764,_0xa069d0);};}function removeListener(_0x56a283,_0x5f4eb8){return function(){VoicePrefixEvents[_0x3763('0x5')](_0x56a283,_0x5f4eb8);};}exports['register']=function(_0x50585d){for(var _0x396634=0x0,_0x8a2d3e=events[_0x3763('0x6')];_0x396634<_0x8a2d3e;_0x396634++){var _0x335382=events[_0x396634];var _0x50b634=createListener('voicePrefix:'+_0x335382,_0x50585d);VoicePrefixEvents['on'](_0x335382,_0x50b634);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index bdfb86d..a48f927 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xb10b,0x12a));var _0xbb10=function(_0x40a107,_0x5acc82){_0x40a107=_0x40a107-0x0;var _0x4beb59=_0xb10b[_0x40a107];return _0x4beb59;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0xb10b,0x12a));var _0xbb10=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xb10b[_0x338c8c];return _0x371a9a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9476c01..2bf3a28 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 _0x2a56=['TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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)','#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)','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#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)','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','ringall','setDataValue','type','getDataValue','includes','strategy','INTEGER','yes','all','once'];(function(_0x279870,_0x178212){var _0x57b140=function(_0x3ef296){while(--_0x3ef296){_0x279870['push'](_0x279870['shift']());}};_0x57b140(++_0x178212);}(_0x2a56,0x174));var _0x62a5=function(_0x329e2f,_0x2a865e){_0x329e2f=_0x329e2f-0x0;var _0x52cd65=_0x2a56[_0x329e2f];return _0x52cd65;};'use strict';var Sequelize=require(_0x62a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x62a5('0x1')],'allowNull':![],'unique':_0x62a5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x4'),_0x62a5('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x62a5('0x6')},'announce':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x62a5('0x7'),_0x62a5('0x8'),_0x62a5('0x9'),_0x62a5('0xa'),_0x62a5('0xb'),'wrandom',_0x62a5('0xc')),'allowNull':![],'defaultValue':_0x62a5('0xd'),'set':function(_0x53ff81){this[_0x62a5('0xe')]('strategy',_0x53ff81?_0x53ff81:_0x62a5('0xa'));},'get':function(){var _0x2a3916=this['getDataValue'](_0x62a5('0xf'));var _0x5415d9=this[_0x62a5('0x10')]('dialMethod');var _0x559fed=this[_0x62a5('0x10')]('strategy');if(_0x2a3916===_0x62a5('0x5')){if(_0x5415d9==='preview'){return null;}if(_0x5415d9==='booked'&&![_0x62a5('0xa'),'roundrobin'][_0x62a5('0x11')](_0x559fed)){this[_0x62a5('0xe')](_0x62a5('0x12'),_0x62a5('0xa'));}}return _0x559fed;}},'servicelevel':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x62a5('0x13')](0xb)},'timeout':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x62a5('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':_0x62a5('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no',_0x62a5('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x62a5('0x14'),'no'),'defaultValue':_0x62a5('0x14')},'announce_holdtime':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no',_0x62a5('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x62a5('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x62a5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x62a5('0x1')]},'queue_youarenext':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x62a5('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x62a5('0x1')]},'queue_quantity1':{'type':Sequelize[_0x62a5('0x1')]},'queue_quantity2':{'type':Sequelize[_0x62a5('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x62a5('0x1')]},'queue_less_than':{'type':Sequelize[_0x62a5('0x1')]},'periodic_announce':{'type':Sequelize[_0x62a5('0x17')],'set':function(_0x5507da){this[_0x62a5('0xe')](_0x62a5('0x18'),_0x5507da?_0x5507da[_0x62a5('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x62a5('0x10')]('periodic_announce')[_0x62a5('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':_0x62a5('0x14'),'set':function(_0x399423){this[_0x62a5('0xe')](_0x62a5('0x1b'),_0x399423?_0x399423[_0x62a5('0x19')](','):undefined);},'get':function(){return this[_0x62a5('0x10')]('joinempty')?this[_0x62a5('0x10')](_0x62a5('0x1b'))[_0x62a5('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':'no','set':function(_0x372012){this[_0x62a5('0xe')](_0x62a5('0x1c'),_0x372012?_0x372012['join'](','):undefined);},'get':function(){return this[_0x62a5('0x10')]('leavewhenempty')?this['getDataValue'](_0x62a5('0x1c'))[_0x62a5('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x62a5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x62a5('0x1')]},'description':{'type':Sequelize[_0x62a5('0x1')]},'acw':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'set':function(_0x2464e4){this['setDataValue'](_0x62a5('0x1e'),_0x2464e4);if(_0x2464e4){if(this[_0x62a5('0x10')](_0x62a5('0x1f'))<0x2){this[_0x62a5('0xe')](_0x62a5('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x62a5('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'comment':_0x62a5('0x20')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x62a5('0x21'),_0x62a5('0x22'),_0x62a5('0x23'),_0x62a5('0x24')),'defaultValue':_0x62a5('0x21'),'comment':_0x62a5('0x25')},'dialLimitChannel':{'type':Sequelize[_0x62a5('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x62a5('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x62a5('0x27')},'dialPowerLevel':{'type':Sequelize[_0x62a5('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x29'),_0x62a5('0x2a')),'defaultValue':_0x62a5('0x2a'),'comment':_0x62a5('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x62a5('0x28')](0x2)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x62a5('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x62a5('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x62a5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x62a5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x62a5('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x62a5('0x2f'),'comment':_0x62a5('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x31')},'dialQueueProject':{'type':Sequelize[_0x62a5('0x1')],'comment':_0x62a5('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'comment':_0x62a5('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x62a5('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x62a5('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x62a5('0x3')](_0x62a5('0x39'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x62a5('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x62a5('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x62a5('0x13')](0x9)[_0x62a5('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x62a5('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x62a5('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x62a5('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x62a5('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x62a5('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x62a5('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x62a5('0x13')](0x9)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x62a5('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x62a5('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x62a5('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x62a5('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x62a5('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x62a5('0x3')]('DESC',_0x62a5('0x44')),'defaultValue':_0x62a5('0x45')},'dialQueueProject2':{'type':Sequelize[_0x62a5('0x1')],'comment':_0x62a5('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x62a5('0x46')},'dialCutDigit':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x62a5('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)[_0x62a5('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x62a5('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x62a5('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x62a5('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62a5('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e9f04){if(!_0x5e9f04)this[_0x62a5('0xe')]('mandatoryDispositionPauseId',null);this[_0x62a5('0xe')](_0x62a5('0x4e'),_0x5e9f04);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x62a5('0x13')](0x3)[_0x62a5('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x62a5('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x62a5('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xed6f=['includes','INTEGER','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','fewestcalls','linear','wrandom','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked'];(function(_0x1d4139,_0x10eb83){var _0x2ec4a8=function(_0x390856){while(--_0x390856){_0x1d4139['push'](_0x1d4139['shift']());}};_0x2ec4a8(++_0x10eb83);}(_0xed6f,0xf5));var _0xfed6=function(_0x5076e9,_0x22454a){_0x5076e9=_0x5076e9-0x0;var _0x2a0de1=_0xed6f[_0x5076e9];return _0x2a0de1;};'use strict';var Sequelize=require(_0xfed6('0x0'));module[_0xfed6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfed6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x4'),_0xfed6('0x5')),'allowNull':![],'defaultValue':_0xfed6('0x4')},'musiconhold':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':_0xfed6('0x7')},'announce':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfed6('0x8'),'leastrecent',_0xfed6('0x9'),'random','rrmemory',_0xfed6('0xa'),_0xfed6('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x4329f5){this[_0xfed6('0xc')](_0xfed6('0xd'),_0x4329f5?_0x4329f5:_0xfed6('0xe'));},'get':function(){var _0x6e0772=this[_0xfed6('0xf')](_0xfed6('0x10'));var _0x20d9b8=this['getDataValue'](_0xfed6('0x11'));var _0x2d6895=this[_0xfed6('0xf')](_0xfed6('0xd'));if(_0x6e0772==='outbound'){if(_0x20d9b8==='preview'){return null;}if(_0x20d9b8===_0xfed6('0x12')&&!['rrmemory','roundrobin'][_0xfed6('0x13')](_0x2d6895)){this[_0xfed6('0xc')](_0xfed6('0xd'),'rrmemory');}}return _0x2d6895;}},'servicelevel':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xfed6('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':_0xfed6('0x15')},'autopause':{'type':Sequelize[_0xfed6('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfed6('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xfed6('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfed6('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfed6('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfed6('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfed6('0x3')]('yes','no'),'defaultValue':_0xfed6('0x15')},'announce_holdtime':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no',_0xfed6('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xfed6('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xfed6('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfed6('0x6')]},'queue_youarenext':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xfed6('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfed6('0x6')]},'queue_quantity1':{'type':Sequelize[_0xfed6('0x6')]},'queue_quantity2':{'type':Sequelize[_0xfed6('0x6')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xfed6('0x6')]},'periodic_announce':{'type':Sequelize[_0xfed6('0x17')],'set':function(_0x4c970e){this[_0xfed6('0xc')](_0xfed6('0x18'),_0x4c970e?_0x4c970e['join'](','):[]);},'get':function(){return this[_0xfed6('0xf')](_0xfed6('0x18'))?this[_0xfed6('0xf')]('periodic_announce')[_0xfed6('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':_0xfed6('0x15'),'set':function(_0x8a4a79){this[_0xfed6('0xc')](_0xfed6('0x1a'),_0x8a4a79?_0x8a4a79[_0xfed6('0x1b')](','):undefined);},'get':function(){return this[_0xfed6('0xf')](_0xfed6('0x1a'))?this[_0xfed6('0xf')](_0xfed6('0x1a'))[_0xfed6('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':'no','set':function(_0x2326b7){this[_0xfed6('0xc')]('leavewhenempty',_0x2326b7?_0x2326b7[_0xfed6('0x1b')](','):undefined);},'get':function(){return this[_0xfed6('0xf')](_0xfed6('0x1c'))?this[_0xfed6('0xf')]('leavewhenempty')[_0xfed6('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xfed6('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xfed6('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':0x0,'set':function(_0x635b22){this[_0xfed6('0xc')](_0xfed6('0x1e'),_0x635b22);if(_0x635b22){if(this[_0xfed6('0xf')](_0xfed6('0x1f'))<0x2){this[_0xfed6('0xc')](_0xfed6('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfed6('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x20'),_0xfed6('0x21'),_0xfed6('0x22'),_0xfed6('0x23'),'booked'),'defaultValue':_0xfed6('0x21'),'comment':_0xfed6('0x24')},'dialLimitChannel':{'type':Sequelize[_0xfed6('0x14')](0x4)[_0xfed6('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfed6('0x26')},'dialLimitQueue':{'type':Sequelize[_0xfed6('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfed6('0x27')},'dialPowerLevel':{'type':Sequelize[_0xfed6('0x28')](0x2)[_0xfed6('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xfed6('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x2a'),_0xfed6('0x2b')),'defaultValue':_0xfed6('0x2b'),'comment':_0xfed6('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfed6('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfed6('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xfed6('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfed6('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfed6('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xfed6('0x2f'),'comment':_0xfed6('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x31')},'dialQueueProject':{'type':Sequelize[_0xfed6('0x6')],'comment':_0xfed6('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xfed6('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfed6('0x39')},'dialTimezone':{'type':Sequelize[_0xfed6('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xfed6('0x3a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfed6('0x3')](_0xfed6('0x3b'),_0xfed6('0x3c'),_0xfed6('0x3d')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':0x0,'comment':_0xfed6('0x3e')},'dialAMDInitialSilence':{'type':Sequelize[_0xfed6('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfed6('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0xfed6('0x14')](0x9)[_0xfed6('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfed6('0x40')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfed6('0x14')](0x9)[_0xfed6('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfed6('0x41')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfed6('0x14')](0x9)[_0xfed6('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xfed6('0x14')](0x9)[_0xfed6('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfed6('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfed6('0x14')](0x9)[_0xfed6('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xfed6('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfed6('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfed6('0x44')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xfed6('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfed6('0x45')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfed6('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfed6('0x46')},'dialRecallMeTimeout':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xfed6('0x3')]('DESC',_0xfed6('0x47')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfed6('0x6')],'comment':_0xfed6('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfed6('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfed6('0x48')},'dialCutDigit':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfed6('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x4c')},'dialDropRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x4e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x4f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x50')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfed6('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfed6('0x14')](0x5)[_0xfed6('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfed6('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xfed6('0x54')},'mandatoryDisposition':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':![],'comment':_0xfed6('0x55'),'set':function(_0x7842a1){if(!_0x7842a1)this[_0xfed6('0xc')](_0xfed6('0x56'),null);this[_0xfed6('0xc')](_0xfed6('0x57'),_0x7842a1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xfed6('0x14')](0x3)[_0xfed6('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfed6('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 635c674..ceede77 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 _0x3e4d=['localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','VIRTUAL','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','inbound','QueueCampaigns','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','autoAssociation','getHoppers','CmHopper','sort','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','interface','format','removeTeams','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isNil','SIP/%s','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_contacts','push','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x420b48,_0x49c12e){var _0x1d49d9=function(_0x28d82e){while(--_0x28d82e){_0x420b48['push'](_0x420b48['shift']());}};_0x1d49d9(++_0x49c12e);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x556d40,_0x268820){_0x556d40=_0x556d40-0x0;var _0x1fbca0=_0x3e4d[_0x556d40];return _0x1fbca0;};'use strict';var emlformat=require(_0xd3e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3e4('0x2'));var Mustache=require(_0xd3e4('0x3'));var util=require(_0xd3e4('0x4'));var path=require('path');var sox=require(_0xd3e4('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3e4('0x6'));var _=require(_0xd3e4('0x7'));var squel=require(_0xd3e4('0x8'));var crypto=require(_0xd3e4('0x9'));var jsforce=require(_0xd3e4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd3e4('0xb'));var querystring=require(_0xd3e4('0xc'));var Papa=require(_0xd3e4('0xd'));var Redis=require('ioredis');var authService=require(_0xd3e4('0xe'));var qs=require(_0xd3e4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3e4('0x10'))(_0xd3e4('0x11'));var utils=require(_0xd3e4('0x12'));var config=require(_0xd3e4('0x13'));var licenseUtil=require(_0xd3e4('0x14'));var db=require(_0xd3e4('0x15'))['db'];config[_0xd3e4('0x16')]=_['defaults'](config[_0xd3e4('0x16')],{'host':_0xd3e4('0x17'),'port':0x18eb});var socket=require(_0xd3e4('0x18'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xd3e4('0x19')](socket);function respondWithStatusCode(_0x4abd20,_0x33daec){_0x33daec=_0x33daec||0xcc;return function(_0xa878f1){if(_0xa878f1){return _0x4abd20['sendStatus'](_0x33daec);}return _0x4abd20[_0xd3e4('0x1a')](_0x33daec)[_0xd3e4('0x1b')]();};}function respondWithResult(_0x4d5136,_0x4fae0a){_0x4fae0a=_0x4fae0a||0xc8;return function(_0x5acc91){if(_0x5acc91){return _0x4d5136[_0xd3e4('0x1a')](_0x4fae0a)[_0xd3e4('0x1c')](_0x5acc91);}};}function respondWithFilteredResult(_0xd6de64,_0x157658){return function(_0xcf261b){if(_0xcf261b){var _0x48d143=typeof _0x157658[_0xd3e4('0x1d')]===_0xd3e4('0x1e')&&typeof _0x157658[_0xd3e4('0x1f')]==='undefined';var _0x413a10=_0xcf261b[_0xd3e4('0x20')];var _0x3ccba5=_0x48d143?0x0:_0x157658['offset'];var _0x5946a7=_0x48d143?_0xcf261b[_0xd3e4('0x20')]:_0x157658[_0xd3e4('0x1d')]+_0x157658[_0xd3e4('0x1f')];var _0x4386b0;if(_0x5946a7>=_0x413a10){_0x5946a7=_0x413a10;_0x4386b0=0xc8;}else{_0x4386b0=0xce;}_0xd6de64[_0xd3e4('0x1a')](_0x4386b0);return _0xd6de64[_0xd3e4('0x21')](_0xd3e4('0x22'),_0x3ccba5+'-'+_0x5946a7+'/'+_0x413a10)[_0xd3e4('0x1c')](_0xcf261b);}return null;};}function patchUpdates(_0x27019e){return function(_0x522f94){try{jsonpatch[_0xd3e4('0x23')](_0x522f94,_0x27019e,!![]);}catch(_0x5cd1fa){return BPromise[_0xd3e4('0x24')](_0x5cd1fa);}return _0x522f94[_0xd3e4('0x25')]();};}function saveUpdates(_0xe295b6,_0x82d2c5){return function(_0x426aa4){if(_0x426aa4){return _0x426aa4[_0xd3e4('0x26')](_0xe295b6)[_0xd3e4('0x27')](function(_0x4d24ab){return _0x4d24ab;});}return null;};}function removeEntity(_0x512ab8,_0x81b1f5){return function(_0x239763){if(_0x239763){return _0x239763[_0xd3e4('0x28')]()[_0xd3e4('0x27')](function(){var _0x868020=_0x239763[_0xd3e4('0x29')]({'plain':!![]});var _0x462586=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xd3e4('0x2a'),'ignore':![]}];var _0x5e96fc=_(_0x462586)[_0xd3e4('0x2b')](_0xd3e4('0x2c'))['map'](_0xd3e4('0x2d'))[_0xd3e4('0x2d')]();if(_[_0xd3e4('0x2e')](_0x5e96fc,_0x868020[_0xd3e4('0x2f')])){return;}var _0x49fc85=_[_0xd3e4('0x30')](_0x462586,[_0xd3e4('0x2d'),_0x868020[_0xd3e4('0x2f')]])[_0xd3e4('0x31')];return db[_0xd3e4('0x32')]['destroy']({'where':{'type':_0x49fc85,'resourceId':_0x868020['id']}})[_0xd3e4('0x27')](function(){return _0x239763;});})['then'](function(){_0x512ab8[_0xd3e4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594ed3,_0x57446a){return function(_0x2c6cce){if(!_0x2c6cce){_0x594ed3[_0xd3e4('0x33')](0x194);}return _0x2c6cce;};}function handleError(_0x18998a,_0x48534a){_0x48534a=_0x48534a||0x1f4;return function(_0x354772){logger[_0xd3e4('0x34')](_0x354772[_0xd3e4('0x35')]);if(_0x354772[_0xd3e4('0x31')]){delete _0x354772[_0xd3e4('0x31')];}_0x18998a[_0xd3e4('0x1a')](_0x48534a)['send'](_0x354772);};}exports['index']=function(_0x18bc38,_0x479d00){var _0x85379e={},_0x373c99={},_0x42d363={'count':0x0,'rows':[]};var _0x58c9b1=_[_0xd3e4('0x36')](db['VoiceQueue'][_0xd3e4('0x37')],function(_0x361699){return{'name':_0x361699[_0xd3e4('0x38')],'type':_0x361699[_0xd3e4('0x2f')]['key']};});_0x373c99[_0xd3e4('0x39')]=_['map'](_0x58c9b1,_0xd3e4('0x31'));_0x373c99[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x18bc38['query']);_0x373c99[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x373c99[_0xd3e4('0x39')],_0x373c99[_0xd3e4('0x3a')]);_0x85379e[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x373c99[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x85379e[_0xd3e4('0x3e')]=_0x85379e[_0xd3e4('0x3e')]['length']?_0x85379e[_0xd3e4('0x3e')]:_0x373c99[_0xd3e4('0x39')];if(!_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x85379e[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x1f')]);_0x85379e['offset']=qs[_0xd3e4('0x1d')](_0x18bc38['query']['offset']);}_0x85379e[_0xd3e4('0x42')]=qs['sort'](_0x18bc38[_0xd3e4('0x3a')]['sort']);_0x85379e[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x18bc38[_0xd3e4('0x3a')],_0x373c99[_0xd3e4('0x3c')]),_0x58c9b1);if(_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x85379e['where']=_['merge'](_0x85379e['where'],{'$or':_[_0xd3e4('0x36')](_0x58c9b1,function(_0x32e5a5){if(_0x32e5a5[_0xd3e4('0x2f')]!==_0xd3e4('0x45')){var _0x15403b={};_0x15403b[_0x32e5a5[_0xd3e4('0x31')]]={'$like':'%'+_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x15403b;}})});}_0x85379e=_[_0xd3e4('0x46')]({},_0x85379e,_0x18bc38[_0xd3e4('0x47')]);var _0x50598d={'where':_0x85379e[_0xd3e4('0x43')]};return db[_0xd3e4('0x48')][_0xd3e4('0x20')](_0x50598d)[_0xd3e4('0x27')](function(_0x1d4cb7){_0x42d363[_0xd3e4('0x20')]=_0x1d4cb7;if(_0x18bc38[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x85379e[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x48')][_0xd3e4('0x4b')](_0x85379e);})[_0xd3e4('0x27')](function(_0x5bb4c8){_0x42d363[_0xd3e4('0x4c')]=_0x5bb4c8;return _0x42d363;})[_0xd3e4('0x27')](respondWithFilteredResult(_0x479d00,_0x85379e))[_0xd3e4('0x4d')](handleError(_0x479d00,null));};exports['show']=function(_0x12df0d,_0x515728){var _0x199354={'raw':![],'where':{'id':_0x12df0d[_0xd3e4('0x4e')]['id']}},_0x13b56d={};_0x13b56d[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['VoiceQueue'][_0xd3e4('0x37')]);_0x13b56d[_0xd3e4('0x3a')]=_['keys'](_0x12df0d[_0xd3e4('0x3a')]);_0x13b56d[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x13b56d['model'],_0x13b56d[_0xd3e4('0x3a')]);_0x199354[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x13b56d[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x12df0d[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x199354['attributes']=_0x199354[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x199354[_0xd3e4('0x3e')]:_0x13b56d[_0xd3e4('0x39')];if(_0x12df0d['query'][_0xd3e4('0x49')]){_0x199354[_0xd3e4('0x4a')]=[{'all':!![]}];}_0x199354=_['merge']({},_0x199354,_0x12df0d['options']);return db[_0xd3e4('0x48')][_0xd3e4('0x30')](_0x199354)[_0xd3e4('0x27')](handleEntityNotFound(_0x515728,null))[_0xd3e4('0x27')](respondWithResult(_0x515728,null))['catch'](handleError(_0x515728,null));};exports[_0xd3e4('0x50')]=function(_0x391cef,_0x123607){return db['VoiceQueue'][_0xd3e4('0x50')](_0x391cef[_0xd3e4('0x51')],{})[_0xd3e4('0x27')](function(_0x2df2e7){var _0x2b534f=_0x391cef['user'][_0xd3e4('0x29')]({'plain':!![]});if(!_0x2b534f)throw new Error(_0xd3e4('0x52'));if(_0x2b534f[_0xd3e4('0x53')]===_0xd3e4('0x54')){var _0x4954ec=_0x2df2e7['get']({'plain':!![]});var _0x5e8843=[{'name':_0xd3e4('0x55'),'value':_0xd3e4('0x56')},{'name':_0xd3e4('0x57'),'value':'outbound'}];var _0x51efb9=_[_0xd3e4('0x30')](_0x5e8843,[_0xd3e4('0x2d'),_0x4954ec[_0xd3e4('0x2f')]])[_0xd3e4('0x31')];return db[_0xd3e4('0x58')][_0xd3e4('0x30')]({'where':{'name':_0x51efb9,'userProfileId':_0x2b534f['userProfileId']},'raw':!![]})[_0xd3e4('0x27')](function(_0xc01cf){if(_0xc01cf&&_0xc01cf['autoAssociation']===0x0){return db[_0xd3e4('0x32')]['create']({'name':_0x4954ec['name'],'resourceId':_0x4954ec['id'],'type':_0xc01cf[_0xd3e4('0x31')],'sectionId':_0xc01cf['id']},{})[_0xd3e4('0x27')](function(){return _0x2df2e7;});}else{return _0x2df2e7;}})[_0xd3e4('0x4d')](function(_0x16543a){logger[_0xd3e4('0x34')](_0xd3e4('0x59'),_0x16543a);throw _0x16543a;});}return _0x2df2e7;})[_0xd3e4('0x27')](respondWithResult(_0x123607,0xc9))[_0xd3e4('0x4d')](handleError(_0x123607,null));};exports[_0xd3e4('0x5a')]=function(_0x8f0010,_0x209743){var _0x31ae08={'where':{'id':_0x8f0010[_0xd3e4('0x4e')]['id']}},_0x3197f3={};_0x3197f3[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x48')][_0xd3e4('0x37')]);_0x31ae08[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x3197f3[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x8f0010['query'][_0xd3e4('0x3f')]));_0x31ae08[_0xd3e4('0x3e')]=_0x31ae08[_0xd3e4('0x3e')]['length']?_0x31ae08[_0xd3e4('0x3e')]:_0x3197f3['model'];if(_0x8f0010['query'][_0xd3e4('0x49')]){_0x31ae08[_0xd3e4('0x4a')]=[{'all':!![]}];}_0x31ae08=_[_0xd3e4('0x46')]({},_0x31ae08,_0x8f0010['options']);return db[_0xd3e4('0x48')]['find'](_0x31ae08)[_0xd3e4('0x27')](handleEntityNotFound(_0x209743,null))[_0xd3e4('0x27')](function(_0x1c6c1a){if(_0x1c6c1a){var _0x5b2a92=_0x1c6c1a[_0xd3e4('0x29')]({'plain':!![]});_0x5b2a92=qs[_0xd3e4('0x5b')](_0x5b2a92,['id',_0xd3e4('0x5c'),_0xd3e4('0x5d')]);_0x8f0010[_0xd3e4('0x51')]=_[_0xd3e4('0x5b')](_0x8f0010[_0xd3e4('0x51')],['id',_0xd3e4('0x5c'),_0xd3e4('0x5d')]);return db['VoiceQueue'][_0xd3e4('0x50')](_[_0xd3e4('0x46')](_0x5b2a92,_0x8f0010[_0xd3e4('0x51')]),{'include':_0x8f0010[_0xd3e4('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xd3e4('0x27')](function(_0x45174a){var _0x38d348=_0x8f0010[_0xd3e4('0x54')][_0xd3e4('0x29')]({'plain':!![]});if(!_0x38d348)throw new Error(_0xd3e4('0x52'));if(_0x38d348[_0xd3e4('0x53')]===_0xd3e4('0x54')){var _0x1e5be4=_0x45174a['get']({'plain':!![]});var _0x2d46c3=[{'name':_0xd3e4('0x55'),'value':_0xd3e4('0x56')},{'name':'QueueCampaigns','value':_0xd3e4('0x2a')}];var _0x2eef54=_[_0xd3e4('0x30')](_0x2d46c3,['value',_0x1e5be4['type']])[_0xd3e4('0x31')];return db['UserProfileSection']['find']({'where':{'name':_0x2eef54,'userProfileId':_0x38d348[_0xd3e4('0x5e')]},'raw':!![]})[_0xd3e4('0x27')](function(_0x151908){if(_0x151908&&_0x151908[_0xd3e4('0x5f')]===0x0){return db[_0xd3e4('0x32')][_0xd3e4('0x50')]({'name':_0x1e5be4['name'],'resourceId':_0x1e5be4['id'],'type':_0x151908[_0xd3e4('0x31')],'sectionId':_0x151908['id']},{})['then'](function(){return _0x45174a;});}else{return _0x45174a;}})[_0xd3e4('0x4d')](function(_0x5c86da){logger[_0xd3e4('0x34')](_0xd3e4('0x59'),_0x5c86da);throw _0x5c86da;});}return _0x45174a;});}})['then'](respondWithResult(_0x209743,0xc9))[_0xd3e4('0x4d')](handleError(_0x209743,null));};exports[_0xd3e4('0x26')]=function(_0x4604e7,_0x56e4fc){if(_0x4604e7['body']['id']){delete _0x4604e7[_0xd3e4('0x51')]['id'];}return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x4604e7[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x56e4fc,null))[_0xd3e4('0x27')](saveUpdates(_0x4604e7[_0xd3e4('0x51')],null))['then'](respondWithResult(_0x56e4fc,null))[_0xd3e4('0x4d')](handleError(_0x56e4fc,null));};exports['destroy']=function(_0x1e1036,_0x3f90e5){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x1e1036[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f90e5,null))[_0xd3e4('0x27')](removeEntity(_0x3f90e5,null))[_0xd3e4('0x4d')](handleError(_0x3f90e5,null));};exports[_0xd3e4('0x60')]=function(_0x5258af,_0x3e9978,_0x408b8b){var _0x4bda17={'raw':![],'where':{}};var _0xa4f05f={};var _0x15f853={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')]['findOne']({'where':{'id':_0x5258af['params']['id']}})['then'](handleEntityNotFound(_0x3e9978,null))[_0xd3e4('0x27')](function(_0x3d36dc){if(_0x3d36dc){_0xa4f05f[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x61')][_0xd3e4('0x37')]);_0xa4f05f['query']=_['keys'](_0x5258af[_0xd3e4('0x3a')]);_0xa4f05f[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0xa4f05f[_0xd3e4('0x39')],_0xa4f05f[_0xd3e4('0x3a')]);_0x4bda17[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0xa4f05f[_0xd3e4('0x39')],qs['fields'](_0x5258af[_0xd3e4('0x3a')]['fields']));_0x4bda17[_0xd3e4('0x3e')]=_0x4bda17['attributes'][_0xd3e4('0x4f')]?_0x4bda17[_0xd3e4('0x3e')]:_0xa4f05f[_0xd3e4('0x39')];if(!_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x4bda17[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x5258af['query'][_0xd3e4('0x1f')]);_0x4bda17['offset']=qs[_0xd3e4('0x1d')](_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x4bda17['order']=qs[_0xd3e4('0x62')](_0x5258af['query'][_0xd3e4('0x62')]);_0x4bda17['where']=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x5258af[_0xd3e4('0x3a')],_0xa4f05f[_0xd3e4('0x3c')]));_0x4bda17[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x3d36dc['id'];if(_0x5258af['query']['filter']){_0x4bda17[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x4bda17[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x4bda17[_0xd3e4('0x3e')],function(_0x3e046b){var _0x7f634e={};_0x7f634e[_0x3e046b]={'$like':'%'+_0x5258af[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x7f634e;})});}_0x4bda17=_[_0xd3e4('0x46')]({},_0x4bda17,_0x5258af['options']);return db[_0xd3e4('0x61')]['count']({'where':_0x4bda17[_0xd3e4('0x43')]})['then'](function(_0xdc608d){_0x15f853[_0xd3e4('0x20')]=_0xdc608d;if(_0x5258af['query'][_0xd3e4('0x49')]){_0x4bda17[_0xd3e4('0x4a')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4bda17);})[_0xd3e4('0x27')](function(_0x484f59){_0x15f853[_0xd3e4('0x4c')]=_0x484f59;return _0x15f853;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x3e9978,_0x4bda17))['catch'](handleError(_0x3e9978,null));};exports[_0xd3e4('0x64')]=function(_0x2845fe,_0x19d608,_0x1eeb3a){var _0x1318b4={'raw':!![],'where':{}};var _0x4ab109={};var _0x1f5dfe={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x2845fe[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19d608,null))['then'](function(_0x20fd1c){if(_0x20fd1c){_0x4ab109[_0xd3e4('0x39')]=_['keys'](db[_0xd3e4('0x66')]['rawAttributes']);_0x4ab109[_0xd3e4('0x3a')]=_['keys'](_0x2845fe[_0xd3e4('0x3a')]);_0x4ab109[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x4ab109[_0xd3e4('0x39')],_0x4ab109['query']);_0x1318b4['attributes']=_['intersection'](_0x4ab109[_0xd3e4('0x39')],qs[_0xd3e4('0x3f')](_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x1318b4['attributes']=_0x1318b4['attributes']['length']?_0x1318b4[_0xd3e4('0x3e')]:_0x4ab109[_0xd3e4('0x39')];if(!_0x2845fe[_0xd3e4('0x3a')]['hasOwnProperty'](_0xd3e4('0x41'))){_0x1318b4[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x2845fe['query']['limit']);_0x1318b4[_0xd3e4('0x1d')]=qs['offset'](_0x2845fe[_0xd3e4('0x3a')]['offset']);}_0x1318b4[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x2845fe['query'][_0xd3e4('0x62')]);_0x1318b4[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x2845fe[_0xd3e4('0x3a')],_0x4ab109[_0xd3e4('0x3c')]));_0x1318b4[_0xd3e4('0x43')]['VoiceQueueId']=_0x20fd1c['id'];if(_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x1318b4[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x1318b4['where'],{'$or':_[_0xd3e4('0x36')](_0x1318b4[_0xd3e4('0x3e')],function(_0x3da89e){var _0x468600={};_0x468600[_0x3da89e]={'$like':'%'+_0x2845fe['query'][_0xd3e4('0x2b')]+'%'};return _0x468600;})});}_0x1318b4=_[_0xd3e4('0x46')]({},_0x1318b4,_0x2845fe['options']);return db['CmHopperHistory'][_0xd3e4('0x20')]({'where':_0x1318b4['where']})[_0xd3e4('0x27')](function(_0x8c7183){_0x1f5dfe['count']=_0x8c7183;if(_0x2845fe[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x1318b4[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x66')][_0xd3e4('0x4b')](_0x1318b4);})[_0xd3e4('0x27')](function(_0x547e9f){_0x1f5dfe[_0xd3e4('0x4c')]=_0x547e9f;return _0x1f5dfe;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x19d608,_0x1318b4))[_0xd3e4('0x4d')](handleError(_0x19d608,null));};exports['getHopperFinals']=function(_0x13bc44,_0x482d08,_0x5ca1c7){var _0x1ebfe3={'raw':!![],'where':{}};var _0x55a4e4={};var _0x2c5aa6={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13bc44['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x482d08,null))[_0xd3e4('0x27')](function(_0x1825ea){if(_0x1825ea){_0x55a4e4[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['CmHopperFinal'][_0xd3e4('0x37')]);_0x55a4e4[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x13bc44[_0xd3e4('0x3a')]);_0x55a4e4[_0xd3e4('0x3c')]=_['intersection'](_0x55a4e4[_0xd3e4('0x39')],_0x55a4e4[_0xd3e4('0x3a')]);_0x1ebfe3[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x55a4e4['model'],qs[_0xd3e4('0x3f')](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x1ebfe3[_0xd3e4('0x3e')]=_0x1ebfe3['attributes'][_0xd3e4('0x4f')]?_0x1ebfe3[_0xd3e4('0x3e')]:_0x55a4e4[_0xd3e4('0x39')];if(!_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x1ebfe3[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x13bc44['query'][_0xd3e4('0x1f')]);_0x1ebfe3[_0xd3e4('0x1d')]=qs['offset'](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x1ebfe3['order']=qs[_0xd3e4('0x62')](_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x1ebfe3['where']=qs[_0xd3e4('0x3c')](_['pick'](_0x13bc44[_0xd3e4('0x3a')],_0x55a4e4['filters']));_0x1ebfe3[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x1825ea['id'];if(_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x1ebfe3[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x1ebfe3[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x1ebfe3[_0xd3e4('0x3e')],function(_0x33495e){var _0x1d8fe8={};_0x1d8fe8[_0x33495e]={'$like':'%'+_0x13bc44[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x1d8fe8;})});}_0x1ebfe3=_[_0xd3e4('0x46')]({},_0x1ebfe3,_0x13bc44[_0xd3e4('0x47')]);return db[_0xd3e4('0x67')]['count']({'where':_0x1ebfe3[_0xd3e4('0x43')]})[_0xd3e4('0x27')](function(_0x2a4010){_0x2c5aa6['count']=_0x2a4010;if(_0x13bc44['query'][_0xd3e4('0x49')]){_0x1ebfe3[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x67')][_0xd3e4('0x4b')](_0x1ebfe3);})[_0xd3e4('0x27')](function(_0x54397b){_0x2c5aa6[_0xd3e4('0x4c')]=_0x54397b;return _0x2c5aa6;});}})[_0xd3e4('0x27')](respondWithFilteredResult(_0x482d08,_0x1ebfe3))[_0xd3e4('0x4d')](handleError(_0x482d08,null));};exports[_0xd3e4('0x68')]=function(_0x4ffa97,_0x8bf0bb,_0x17e4f4){var _0x2b3394={'raw':!![],'where':{}};var _0x463f8c={};var _0x449225={'count':0x0,'rows':[]};return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x4ffa97[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x8bf0bb,null))[_0xd3e4('0x27')](function(_0x211ad0){if(_0x211ad0){_0x463f8c[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x69')][_0xd3e4('0x37')]);_0x463f8c['query']=_[_0xd3e4('0x3b')](_0x4ffa97[_0xd3e4('0x3a')]);_0x463f8c[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x463f8c[_0xd3e4('0x39')],_0x463f8c[_0xd3e4('0x3a')]);_0x2b3394[_0xd3e4('0x3e')]=_['intersection'](_0x463f8c['model'],qs[_0xd3e4('0x3f')](_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x2b3394[_0xd3e4('0x3e')]=_0x2b3394[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x2b3394['attributes']:_0x463f8c[_0xd3e4('0x39')];if(!_0x4ffa97[_0xd3e4('0x3a')]['hasOwnProperty']('nolimit')){_0x2b3394[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x4ffa97['query']['limit']);_0x2b3394['offset']=qs[_0xd3e4('0x1d')](_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}_0x2b3394[_0xd3e4('0x42')]=qs['sort'](_0x4ffa97['query'][_0xd3e4('0x62')]);_0x2b3394[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x4ffa97[_0xd3e4('0x3a')],_0x463f8c[_0xd3e4('0x3c')]));_0x2b3394[_0xd3e4('0x43')][_0xd3e4('0x63')]=_0x211ad0['id'];if(_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x2b3394[_0xd3e4('0x43')]=_[_0xd3e4('0x46')](_0x2b3394['where'],{'$or':_[_0xd3e4('0x36')](_0x2b3394[_0xd3e4('0x3e')],function(_0x598875){var _0x4d3905={};_0x4d3905[_0x598875]={'$like':'%'+_0x4ffa97['query'][_0xd3e4('0x2b')]+'%'};return _0x4d3905;})});}_0x2b3394=_[_0xd3e4('0x46')]({},_0x2b3394,_0x4ffa97['options']);return db['CmHopperBlack']['count']({'where':_0x2b3394[_0xd3e4('0x43')]})[_0xd3e4('0x27')](function(_0x3d65bf){_0x449225[_0xd3e4('0x20')]=_0x3d65bf;if(_0x4ffa97[_0xd3e4('0x3a')][_0xd3e4('0x49')]){_0x2b3394[_0xd3e4('0x4a')]=[{'all':!![]}];}return db[_0xd3e4('0x69')][_0xd3e4('0x4b')](_0x2b3394);})['then'](function(_0x8ca022){_0x449225['rows']=_0x8ca022;return _0x449225;});}})['then'](respondWithFilteredResult(_0x8bf0bb,_0x2b3394))[_0xd3e4('0x4d')](handleError(_0x8bf0bb,null));};exports[_0xd3e4('0x6a')]=function(_0x54b894,_0x3e709b,_0x17d957){var _0x487868={};var _0x8082d3={};var _0x17c5d6;var _0x362da4;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x54b894[_0xd3e4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3e709b,null))['then'](function(_0x438f5a){if(_0x438f5a){_0x17c5d6=_0x438f5a;_0x8082d3[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['Team']['rawAttributes']);_0x8082d3[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x54b894[_0xd3e4('0x3a')]);_0x8082d3['filters']=_[_0xd3e4('0x3d')](_0x8082d3[_0xd3e4('0x39')],_0x8082d3['query']);_0x487868[_0xd3e4('0x3e')]=_['intersection'](_0x8082d3[_0xd3e4('0x39')],qs['fields'](_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x487868[_0xd3e4('0x3e')]=_0x487868[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x487868[_0xd3e4('0x3e')]:_0x8082d3['model'];_0x487868[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x54b894['query'][_0xd3e4('0x62')]);_0x487868[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x54b894[_0xd3e4('0x3a')],_0x8082d3[_0xd3e4('0x3c')]));if(_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x487868['where']=_[_0xd3e4('0x46')](_0x487868['where'],{'$or':_['map'](_0x487868['attributes'],function(_0xb791a2){var _0x2d24c2={};_0x2d24c2[_0xb791a2]={'$like':'%'+_0x54b894['query'][_0xd3e4('0x2b')]+'%'};return _0x2d24c2;})});}_0x487868=_[_0xd3e4('0x46')]({},_0x487868,_0x54b894[_0xd3e4('0x47')]);return _0x17c5d6[_0xd3e4('0x6a')](_0x487868);}})[_0xd3e4('0x27')](function(_0x5c5b81){if(_0x5c5b81){_0x362da4=_0x5c5b81[_0xd3e4('0x4f')];if(!_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x40')]('nolimit')){_0x487868['limit']=qs['limit'](_0x54b894['query'][_0xd3e4('0x1f')]);_0x487868[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x54b894[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x17c5d6[_0xd3e4('0x6a')](_0x487868);}})[_0xd3e4('0x27')](function(_0x2c540c){if(_0x2c540c){return _0x2c540c?{'count':_0x362da4,'rows':_0x2c540c}:null;}})[_0xd3e4('0x27')](respondWithResult(_0x3e709b,null))[_0xd3e4('0x4d')](handleError(_0x3e709b,null));};exports['addTeams']=function(_0x49eeea,_0x4f4acc,_0x155d94){var _0x1bb176=_0x49eeea[_0xd3e4('0x51')][_0xd3e4('0x6b')];var _0x5befdd=_[_0xd3e4('0x36')](_0x1bb176,'id');return db[_0xd3e4('0x6c')][_0xd3e4('0x4b')]({'where':{'id':_0x5befdd},'attributes':['id'],'include':[{'model':db[_0xd3e4('0x6d')],'as':_0xd3e4('0x6e'),'attributes':['id',_0xd3e4('0x31'),_0xd3e4('0x6f'),_0xd3e4('0x70'),'interface'],'raw':!![]}]})['then'](function(_0x4bd920){if(_0x4bd920){var _0x196115=_[_0xd3e4('0x71')](_0x4bd920,function(_0x7d215b){var _0x5cfb3f=_0x7d215b['get']({'plain':!![]});_0x5cfb3f[_0xd3e4('0x6e')][_0xd3e4('0x72')](function(_0x487f74){_0x487f74[_0xd3e4('0x73')]=_[_0xd3e4('0x30')](_0x1bb176,{'id':_0x5cfb3f['id']})[_0xd3e4('0x73')];});return _0x5cfb3f[_0xd3e4('0x6e')];});return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x49eeea[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(_0x4e1a47){return db[_0xd3e4('0x74')][_0xd3e4('0x75')](function(_0x4cf2b1){return _0x4e1a47[_0xd3e4('0x76')](_0x5befdd,{'transaction':_0x4cf2b1})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_0x1bb176,function(_0xff1d71){return db[_0xd3e4('0x78')][_0xd3e4('0x79')]({'TeamId':_0xff1d71['id'],'VoiceQueueId':_0x49eeea[_0xd3e4('0x4e')]['id'],'penalty':_0xff1d71[_0xd3e4('0x73')]},{'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_0x196115,function(_0x3e12e7){return db[_0xd3e4('0x7a')]['findOrCreate']({'where':{'UserId':_0x3e12e7['id'],'VoiceQueueId':_0x49eeea[_0xd3e4('0x4e')]['id']},'defaults':{'penalty':_0x3e12e7[_0xd3e4('0x73')]},'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){return BPromise[_0xd3e4('0x77')](_[_0xd3e4('0x2b')](_0x196115,{'online':!![]}),function(_0xe18bed){return db['UserVoiceQueueRt'][_0xd3e4('0x79')]({'membername':_0xe18bed[_0xd3e4('0x31')],'UserId':_0xe18bed['id'],'queue_name':_0x4e1a47['name'],'VoiceQueueId':_0x4e1a47['id'],'interface':_['isNil'](_0xe18bed[_0xd3e4('0x7b')])?util[_0xd3e4('0x7c')]('SIP/%s',_0xe18bed[_0xd3e4('0x31')]):_0xe18bed[_0xd3e4('0x7b')],'paused':_0xe18bed[_0xd3e4('0x70')]||![],'penalty':_0xe18bed['penalty']},{'transaction':_0x4cf2b1});});})[_0xd3e4('0x27')](function(){_0x196115[_0xd3e4('0x72')](function(_0x42e8fb){socket['emit']('userVoiceQueue:save',{'UserId':_0x42e8fb['id'],'VoiceQueueId':_0x4e1a47['id']});});});});});}})['then'](respondWithStatusCode(_0x4f4acc,null))[_0xd3e4('0x4d')](handleError(_0x4f4acc,null));};exports[_0xd3e4('0x7d')]=function(_0x1d4997,_0xba3397,_0x3324ca){return db['Team'][_0xd3e4('0x4b')]({'where':{'id':_0x1d4997['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd3e4('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd3e4('0x27')](handleEntityNotFound(_0xba3397,null))[_0xd3e4('0x27')](function(_0x53fd2f){var _0x22201a=_[_0xd3e4('0x36')](_0x53fd2f,'id');var _0x59b26f=[];var _0x8ec9af=[];var _0x2a5cdd=squel['select']();_0x2a5cdd[_0xd3e4('0x7e')]('tq.TeamId')['from'](_0xd3e4('0x7f'),'tq')[_0xd3e4('0x80')](_0xd3e4('0x81'),'ut',_0xd3e4('0x82'))[_0xd3e4('0x43')]('VoiceQueueId\x20=\x20?',_0x1d4997['params']['id']);for(var _0x5ecd2d=0x0;_0x5ecd2d<_0x53fd2f[_0xd3e4('0x4f')];_0x5ecd2d+=0x1){let _0x1c1d4b=_0x53fd2f[_0x5ecd2d];for(var _0x1a1a07=0x0;_0x1a1a07<_0x1c1d4b[_0xd3e4('0x6e')][_0xd3e4('0x4f')];_0x1a1a07+=0x1){let _0x8a743d=_0x1c1d4b[_0xd3e4('0x6e')][_0x1a1a07];var _0x14f4bc=_0x2a5cdd[_0xd3e4('0x5a')]();_0x14f4bc['where'](_0xd3e4('0x83'),_0x8a743d['id']);_0x8ec9af['push'](db[_0xd3e4('0x74')]['query'](_0x14f4bc[_0xd3e4('0x84')](),{'type':db[_0xd3e4('0x74')][_0xd3e4('0x85')][_0xd3e4('0x86')]})[_0xd3e4('0x27')](function(_0x26e3c9){if(_0x26e3c9['length']===0x1){return _0x8a743d['id'];}else{var _0x22a0bd=_[_0xd3e4('0x87')](_['map'](_0x26e3c9,_0xd3e4('0x88')),function(_0x184fc1){return _[_0xd3e4('0x2e')](_0x22201a,_0x184fc1);});if(_0x22a0bd){return _0x8a743d['id'];}}}));}}return BPromise[_0xd3e4('0x89')](_0x8ec9af)[_0xd3e4('0x27')](function(_0x2ba22b){_0x59b26f=_(_0x59b26f)['union'](_0x2ba22b)[_0xd3e4('0x8a')]()['value']();return db['VoiceQueue'][_0xd3e4('0x30')]({'where':{'id':_0x1d4997[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(_0x27b4a2){return db[_0xd3e4('0x74')]['transaction'](function(_0x3283cf){return _0x27b4a2[_0xd3e4('0x7d')](_0x1d4997['query'][_0xd3e4('0x8b')],{'transaction':_0x3283cf})[_0xd3e4('0x27')](function(){if(!_[_0xd3e4('0x8c')](_0x59b26f)){return _0x27b4a2[_0xd3e4('0x8d')](_0x59b26f,{'transaction':_0x3283cf})[_0xd3e4('0x27')](function(){return db[_0xd3e4('0x8e')]['destroy']({'where':{'VoiceQueueId':_0x1d4997[_0xd3e4('0x4e')]['id'],'UserId':_0x59b26f},'transaction':_0x3283cf});});}})[_0xd3e4('0x27')](function(){_0x59b26f['forEach'](function(_0x5c01c7){socket[_0xd3e4('0x8f')](_0xd3e4('0x90'),{'UserId':_0x5c01c7,'VoiceQueueId':_0x27b4a2['id']});});});});});});})['then'](respondWithStatusCode(_0xba3397,null))[_0xd3e4('0x4d')](handleError(_0xba3397,null));};exports[_0xd3e4('0x91')]=function(_0x8c99b3,_0x27d9b0,_0x2ec18a){var _0x56e2fd,_0x1318ca;return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x8c99b3['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x27d9b0,null))['then'](function(_0x5c5d83){if(_0x5c5d83){_0x1318ca=_0x5c5d83;return _0x5c5d83[_0xd3e4('0x91')](_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')],_[_0xd3e4('0x5b')](_0x8c99b3['body'],['ids','id'])||{})[_0xd3e4('0x92')](function(_0x37a567){for(var _0x562075=0x0;_0x562075<_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')][_0xd3e4('0x4f')];_0x562075+=0x1){socket[_0xd3e4('0x8f')](_0xd3e4('0x93'),{'UserId':Number(_0x8c99b3['body'][_0xd3e4('0x8b')][_0x562075]),'VoiceQueueId':Number(_0x8c99b3[_0xd3e4('0x4e')]['id'])});}return _0x37a567;});}})[_0xd3e4('0x27')](function(_0x405606){_0x56e2fd=_0x405606||[];if(_0x1318ca){return db[_0xd3e4('0x6d')][_0xd3e4('0x4b')]({'where':{'id':_0x8c99b3[_0xd3e4('0x51')][_0xd3e4('0x8b')]},'attributes':['id',_0xd3e4('0x31'),_0xd3e4('0x6f'),_0xd3e4('0x70'),'interface'],'raw':!![]});}})[_0xd3e4('0x27')](function(_0x232a3d){if(!_[_0xd3e4('0x8c')](_0x232a3d)){var _0x3d1ce9=[];for(var _0x43cec1=0x0;_0x43cec1<_0x232a3d[_0xd3e4('0x4f')];_0x43cec1++){if(_0x232a3d[_0x43cec1]['online']){_0x3d1ce9['push'](db['UserVoiceQueueRt'][_0xd3e4('0x79')]({'membername':_0x232a3d[_0x43cec1][_0xd3e4('0x31')],'UserId':_0x232a3d[_0x43cec1]['id'],'queue_name':_0x1318ca[_0xd3e4('0x31')],'VoiceQueueId':_0x1318ca['id'],'interface':_[_0xd3e4('0x94')](_0x232a3d[_0x43cec1][_0xd3e4('0x7b')])?util['format'](_0xd3e4('0x95'),_0x232a3d[_0x43cec1][_0xd3e4('0x31')]):_0x232a3d[_0x43cec1][_0xd3e4('0x7b')],'paused':_0x232a3d[_0x43cec1]['voicePause']||![],'penalty':_0x8c99b3[_0xd3e4('0x51')]['penalty']||0x0}));}}return BPromise[_0xd3e4('0x89')](_0x3d1ce9);}})['then'](function(){return _0x56e2fd;})[_0xd3e4('0x27')](respondWithResult(_0x27d9b0,null))['catch'](handleError(_0x27d9b0,null));};exports[_0xd3e4('0x8d')]=function(_0x421420,_0x319f7a,_0x539b2f){return db['VoiceQueue']['find']({'where':{'id':_0x421420[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x319f7a,null))[_0xd3e4('0x27')](function(_0x18baf8){if(_0x18baf8){return _0x18baf8[_0xd3e4('0x8d')](_0x421420[_0xd3e4('0x3a')][_0xd3e4('0x8b')])[_0xd3e4('0x27')](function(){if(_['isArray'](_0x421420['query']['ids'])){for(var _0x35f194=0x0;_0x35f194<_0x421420['query'][_0xd3e4('0x8b')]['length'];_0x35f194+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x421420[_0xd3e4('0x3a')]['ids'][_0x35f194]),'VoiceQueueId':Number(_0x421420[_0xd3e4('0x4e')]['id'])});}}else{socket['emit'](_0xd3e4('0x90'),{'UserId':Number(_0x421420[_0xd3e4('0x3a')]['ids']),'VoiceQueueId':Number(_0x421420[_0xd3e4('0x4e')]['id'])});}});}})['then'](function(_0x245bb1){return db[_0xd3e4('0x8e')][_0xd3e4('0x28')]({'where':{'VoiceQueueId':_0x421420['params']['id'],'UserId':_0x421420['query'][_0xd3e4('0x8b')]}})['then'](function(){return _0x245bb1;});})['then'](respondWithStatusCode(_0x319f7a,null))[_0xd3e4('0x4d')](handleError(_0x319f7a,null));};exports[_0xd3e4('0x96')]=function(_0x2101a3,_0x21c133,_0x1600ae){var _0x3add51={};var _0x2320e9={};var _0x419ecd;var _0xf243d8;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x2101a3[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x21c133,null))[_0xd3e4('0x27')](function(_0x4e2a1a){if(_0x4e2a1a){_0x419ecd=_0x4e2a1a;_0x2320e9[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db['User']['rawAttributes']);_0x2320e9[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x2101a3[_0xd3e4('0x3a')]);_0x2320e9[_0xd3e4('0x3c')]=_[_0xd3e4('0x3d')](_0x2320e9['model'],_0x2320e9[_0xd3e4('0x3a')]);_0x3add51['attributes']=_['intersection'](_0x2320e9['model'],qs[_0xd3e4('0x3f')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x3f')]));_0x3add51[_0xd3e4('0x3e')]=_0x3add51['attributes']['length']?_0x3add51[_0xd3e4('0x3e')]:_0x2320e9[_0xd3e4('0x39')];_0x3add51[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x3add51[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x2101a3['query'],_0x2320e9[_0xd3e4('0x3c')]));if(_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x3add51[_0xd3e4('0x43')]=_['merge'](_0x3add51[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x3add51[_0xd3e4('0x3e')],function(_0x52271f){var _0x4340b7={};_0x4340b7[_0x52271f]={'$like':'%'+_0x2101a3['query']['filter']+'%'};return _0x4340b7;})});}_0x3add51=_[_0xd3e4('0x46')]({},_0x3add51,_0x2101a3[_0xd3e4('0x47')]);return _0x419ecd['getAgents'](_0x3add51);}})[_0xd3e4('0x27')](function(_0x54d5c5){if(_0x54d5c5){_0xf243d8=_0x54d5c5[_0xd3e4('0x4f')];if(!_0x2101a3['query'][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x3add51[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x1f')]);_0x3add51[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x2101a3[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x419ecd['getAgents'](_0x3add51);}})[_0xd3e4('0x27')](function(_0x407237){if(_0x407237){return _0x407237?{'count':_0xf243d8,'rows':_0x407237}:null;}})['then'](respondWithResult(_0x21c133,null))[_0xd3e4('0x4d')](handleError(_0x21c133,null));};exports[_0xd3e4('0x97')]=function(_0x355300,_0x6e7f8a,_0x4c3b9d){var _0x6a7580={};var _0x1ca6db={};var _0x42138b;var _0x429eed;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x355300[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x6e7f8a,null))[_0xd3e4('0x27')](function(_0x16e1bf){if(_0x16e1bf){_0x42138b=_0x16e1bf;_0x1ca6db['model']=_[_0xd3e4('0x3b')](db['UserVoiceQueueRt'][_0xd3e4('0x37')]);_0x1ca6db[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x355300[_0xd3e4('0x3a')]);_0x1ca6db[_0xd3e4('0x3c')]=_['intersection'](_0x1ca6db[_0xd3e4('0x39')],_0x1ca6db[_0xd3e4('0x3a')]);_0x6a7580['attributes']=_[_0xd3e4('0x3d')](_0x1ca6db['model'],qs['fields'](_0x355300[_0xd3e4('0x3a')]['fields']));_0x6a7580['attributes']=_0x6a7580['attributes'][_0xd3e4('0x4f')]?_0x6a7580[_0xd3e4('0x3e')]:_0x1ca6db[_0xd3e4('0x39')];_0x6a7580['order']=qs[_0xd3e4('0x62')](_0x355300[_0xd3e4('0x3a')]['sort']);_0x6a7580[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x355300[_0xd3e4('0x3a')],_0x1ca6db[_0xd3e4('0x3c')]));if(_0x355300['query'][_0xd3e4('0x2b')]){_0x6a7580[_0xd3e4('0x43')]=_['merge'](_0x6a7580[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x6a7580['attributes'],function(_0x2b9209){var _0x2b3c67={};_0x2b3c67[_0x2b9209]={'$like':'%'+_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x2b3c67;})});}_0x6a7580=_[_0xd3e4('0x46')]({},_0x6a7580,_0x355300[_0xd3e4('0x47')]);return _0x42138b[_0xd3e4('0x97')](_0x6a7580);}})[_0xd3e4('0x27')](function(_0x1502ed){if(_0x1502ed){_0x429eed=_0x1502ed[_0xd3e4('0x4f')];if(!_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x6a7580[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x355300['query'][_0xd3e4('0x1f')]);_0x6a7580[_0xd3e4('0x1d')]=qs['offset'](_0x355300[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x42138b[_0xd3e4('0x97')](_0x6a7580);}})[_0xd3e4('0x27')](function(_0x21336c){return _0x21336c?{'count':_0x429eed,'rows':_0x21336c}:null;})['then'](respondWithResult(_0x6e7f8a,null))[_0xd3e4('0x4d')](handleError(_0x6e7f8a,null));};exports[_0xd3e4('0x98')]=function(_0x47a58a,_0x1fb5d1,_0x1afe86){var _0x304c5e={};var _0x555278={};var _0x2a97ee;var _0x121f16;return db[_0xd3e4('0x48')]['findOne']({'where':{'id':_0x47a58a[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x1fb5d1,null))[_0xd3e4('0x27')](function(_0x21d7ea){if(_0x21d7ea){_0x2a97ee=_0x21d7ea;_0x555278[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x99')]['rawAttributes']);_0x555278[_0xd3e4('0x3a')]=_[_0xd3e4('0x3b')](_0x47a58a['query']);_0x555278['filters']=_[_0xd3e4('0x3d')](_0x555278['model'],_0x555278[_0xd3e4('0x3a')]);_0x304c5e[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x555278['model'],qs[_0xd3e4('0x3f')](_0x47a58a['query'][_0xd3e4('0x3f')]));_0x304c5e[_0xd3e4('0x3e')]=_0x304c5e['attributes'][_0xd3e4('0x4f')]?_0x304c5e[_0xd3e4('0x3e')]:_0x555278[_0xd3e4('0x39')];_0x304c5e[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x47a58a['query'][_0xd3e4('0x62')]);_0x304c5e[_0xd3e4('0x43')]=qs[_0xd3e4('0x3c')](_[_0xd3e4('0x44')](_0x47a58a[_0xd3e4('0x3a')],_0x555278[_0xd3e4('0x3c')]));if(_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x304c5e['where']=_[_0xd3e4('0x46')](_0x304c5e[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x304c5e[_0xd3e4('0x3e')],function(_0x14de5f){var _0x5c381e={};_0x5c381e[_0x14de5f]={'$like':'%'+_0x47a58a['query'][_0xd3e4('0x2b')]+'%'};return _0x5c381e;})});}_0x304c5e=_[_0xd3e4('0x46')]({},_0x304c5e,_0x47a58a[_0xd3e4('0x47')]);return _0x2a97ee[_0xd3e4('0x98')](_0x304c5e);}})[_0xd3e4('0x27')](function(_0x286ebf){if(_0x286ebf){_0x121f16=_0x286ebf[_0xd3e4('0x4f')];if(!_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x40')](_0xd3e4('0x41'))){_0x304c5e[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x47a58a['query']['limit']);_0x304c5e[_0xd3e4('0x1d')]=qs[_0xd3e4('0x1d')](_0x47a58a[_0xd3e4('0x3a')][_0xd3e4('0x1d')]);}return _0x2a97ee[_0xd3e4('0x98')](_0x304c5e);}})['then'](function(_0x1de8aa){if(_0x1de8aa){return _0x1de8aa?{'count':_0x121f16,'rows':_0x1de8aa}:null;}})['then'](respondWithResult(_0x1fb5d1,null))[_0xd3e4('0x4d')](handleError(_0x1fb5d1,null));};exports[_0xd3e4('0x9a')]=function(_0x456985,_0x23b7ff,_0x39893a){var _0x3f6fd2=moment()['format'](_0xd3e4('0x9b'));var _0x420fe6,_0x377b35;return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x456985['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x23b7ff,null))[_0xd3e4('0x27')](function(_0x13f41b){if(_0x13f41b){_0x377b35=_0x13f41b;return _0x13f41b[_0xd3e4('0x9a')](_0x456985[_0xd3e4('0x51')][_0xd3e4('0x8b')],_[_0xd3e4('0x5b')](_0x456985[_0xd3e4('0x51')],[_0xd3e4('0x8b'),'id'])||{});}return null;})[_0xd3e4('0x92')](function(_0x187d6a){var _0x30d732;_0x420fe6=_0x187d6a||[];var _0x5949c3=[];if(_0x187d6a){for(var _0x344e76=0x0;_0x344e76<_0x187d6a[_0xd3e4('0x4f')];_0x344e76+=0x1){var _0x3b5363=_0x187d6a[_0x344e76][_0xd3e4('0x29')]({'plain':!![]});_0x377b35[_0xd3e4('0x9c')]=_0x456985[_0xd3e4('0x51')]['dialCheckDuplicateType']?_0x456985[_0xd3e4('0x51')][_0xd3e4('0x9c')]:_0x377b35[_0xd3e4('0x9c')];switch(_0x377b35['dialCheckDuplicateType']){case _0xd3e4('0x9d'):_0x30d732=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')]('cm_hopper')[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa2'),_0xd3e4('0xa3'),_0xd3e4('0xa4'),_0xd3e4('0x63'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()['field']('phone','phone')['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0xa2'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))['field'](_0x3b5363['CmListId'][_0xd3e4('0x84')](),'ListId')[_0xd3e4('0x7e')](_0x456985['params']['id'][_0xd3e4('0x84')](),_0xd3e4('0x63'))['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')]('cm_contacts')[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())[_0xd3e4('0x43')](_0xd3e4('0xaa'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xab'))[_0xd3e4('0xa6')](_0xd3e4('0xac'))[_0xd3e4('0x43')]('VoiceQueueId\x20=\x20?',_0x456985[_0xd3e4('0x4e')]['id']['toString']()))[_0xd3e4('0x43')](_0xd3e4('0xad'),squel[_0xd3e4('0xa5')]()['field'](_0xd3e4('0xae'))[_0xd3e4('0xa6')](_0xd3e4('0xaf'))[_0xd3e4('0x43')](_0xd3e4('0xb0'),_0x456985[_0xd3e4('0x4e')]['id'][_0xd3e4('0x84')]())))[_0xd3e4('0x84')]();break;case _0xd3e4('0xb1'):_0x30d732=squel[_0xd3e4('0x9e')]()['into'](_0xd3e4('0xaf'))[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa2'),'ContactId',_0xd3e4('0xa4'),_0xd3e4('0x63'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()['field'](_0xd3e4('0xa1'),_0xd3e4('0xa1'))['field']('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0xa2'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')](),_0xd3e4('0xa4'))[_0xd3e4('0x7e')](_0x456985[_0xd3e4('0x4e')]['id']['toString'](),_0xd3e4('0x63'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27','updatedAt')['from'](_0xd3e4('0xb2'))[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xd3e4('0x43')](_0xd3e4('0xad'),squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xae'))[_0xd3e4('0xa6')](_0xd3e4('0xaf'))[_0xd3e4('0x43')](_0xd3e4('0xb0'),_0x456985[_0xd3e4('0x4e')]['id'][_0xd3e4('0x84')]())))['toString']();break;default:_0x30d732=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')](_0xd3e4('0xaf'))['fromQuery']([_0xd3e4('0xa1'),_0xd3e4('0xa2'),_0xd3e4('0xa3'),_0xd3e4('0xa4'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xa1'),_0xd3e4('0xa1'))['field']('\x27'+_0x3f6fd2+'\x27','scheduledAt')[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')](),'ListId')[_0xd3e4('0x7e')](_0x456985['params']['id'][_0xd3e4('0x84')](),'VoiceQueueId')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5c'))[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')](_0xd3e4('0xb2'))[_0xd3e4('0x43')]('deletedAt\x20IS\x20NULL')[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x3b5363[_0xd3e4('0xa9')][_0xd3e4('0x84')]())['where'](_0xd3e4('0xaa')))[_0xd3e4('0x84')]();}_0x5949c3[_0xd3e4('0xb3')](db[_0xd3e4('0x74')]['query'](_0x30d732));}return BPromise[_0xd3e4('0x89')](_0x5949c3);}})[_0xd3e4('0x27')](function(){var _0x8dad=[];var _0x2c4149=squel[_0xd3e4('0x9e')]()[_0xd3e4('0x9f')](_0xd3e4('0xb4'))[_0xd3e4('0xa0')]([_0xd3e4('0xb5'),'phone',_0xd3e4('0xb6'),_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')](_0xd3e4('0xb7'))['field'](_0xd3e4('0xb8'))[_0xd3e4('0x7e')]('ci.OrderBy+1')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27','createdAt')[_0xd3e4('0x7e')]('\x27'+_0x3f6fd2+'\x27',_0xd3e4('0x5d'))[_0xd3e4('0xa6')](_0xd3e4('0xb9'),'ci')[_0xd3e4('0x80')](_0xd3e4('0xaf'),'h',_0xd3e4('0xba'))[_0xd3e4('0x43')]('h.scheduledat=?',_0x3f6fd2)[_0xd3e4('0x43')](_0xd3e4('0xbb'),_0xd3e4('0xbc')))['toString']();_0x8dad['push'](db[_0xd3e4('0x74')]['query'](_0x2c4149));return BPromise[_0xd3e4('0x89')](_0x8dad);})['then'](function(){return _0x420fe6;})[_0xd3e4('0x27')](respondWithResult(_0x23b7ff,null))[_0xd3e4('0x4d')](handleError(_0x23b7ff,null));};exports[_0xd3e4('0xbd')]=function(_0x13722e,_0x39c033,_0x254ac1){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x13722e[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x39c033,null))[_0xd3e4('0x27')](function(_0x5093b1){if(_0x5093b1){return _0x5093b1[_0xd3e4('0xbd')](_0x13722e[_0xd3e4('0x3a')][_0xd3e4('0x8b')]);}})[_0xd3e4('0x27')](function(_0x5696d5){if(_0x5696d5){return db['CmHopper'][_0xd3e4('0x28')]({'where':{'ListId':_0x13722e[_0xd3e4('0x3a')][_0xd3e4('0x8b')],'VoiceQueueId':_0x13722e[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](function(){return _0x5696d5;});}})[_0xd3e4('0x27')](respondWithStatusCode(_0x39c033,null))[_0xd3e4('0x4d')](handleError(_0x39c033,null));};exports[_0xd3e4('0xbe')]=function(_0x697a5f,_0x1d1deb,_0x29aa1b){var _0x4d389a={};var _0x14b15a={};var _0x22fff9;var _0xe442df;return db[_0xd3e4('0x48')][_0xd3e4('0x65')]({'where':{'id':_0x697a5f['params']['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x1d1deb,null))['then'](function(_0x123282){if(_0x123282){_0x22fff9=_0x123282;_0x14b15a[_0xd3e4('0x39')]=_[_0xd3e4('0x3b')](db[_0xd3e4('0x99')][_0xd3e4('0x37')]);_0x14b15a[_0xd3e4('0x3a')]=_['keys'](_0x697a5f[_0xd3e4('0x3a')]);_0x14b15a['filters']=_[_0xd3e4('0x3d')](_0x14b15a[_0xd3e4('0x39')],_0x14b15a[_0xd3e4('0x3a')]);_0x4d389a[_0xd3e4('0x3e')]=_[_0xd3e4('0x3d')](_0x14b15a['model'],qs[_0xd3e4('0x3f')](_0x697a5f[_0xd3e4('0x3a')]['fields']));_0x4d389a[_0xd3e4('0x3e')]=_0x4d389a[_0xd3e4('0x3e')][_0xd3e4('0x4f')]?_0x4d389a[_0xd3e4('0x3e')]:_0x14b15a[_0xd3e4('0x39')];_0x4d389a[_0xd3e4('0x42')]=qs[_0xd3e4('0x62')](_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x62')]);_0x4d389a[_0xd3e4('0x43')]=qs['filters'](_[_0xd3e4('0x44')](_0x697a5f['query'],_0x14b15a[_0xd3e4('0x3c')]));if(_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x2b')]){_0x4d389a[_0xd3e4('0x43')]=_['merge'](_0x4d389a[_0xd3e4('0x43')],{'$or':_[_0xd3e4('0x36')](_0x4d389a[_0xd3e4('0x3e')],function(_0x16c441){var _0x267ce6={};_0x267ce6[_0x16c441]={'$like':'%'+_0x697a5f[_0xd3e4('0x3a')][_0xd3e4('0x2b')]+'%'};return _0x267ce6;})});}_0x4d389a=_['merge']({},_0x4d389a,_0x697a5f[_0xd3e4('0x47')]);return _0x22fff9[_0xd3e4('0xbe')](_0x4d389a);}})[_0xd3e4('0x27')](function(_0x478442){if(_0x478442){_0xe442df=_0x478442['length'];if(!_0x697a5f[_0xd3e4('0x3a')]['hasOwnProperty'](_0xd3e4('0x41'))){_0x4d389a[_0xd3e4('0x1f')]=qs[_0xd3e4('0x1f')](_0x697a5f[_0xd3e4('0x3a')]['limit']);_0x4d389a[_0xd3e4('0x1d')]=qs['offset'](_0x697a5f['query']['offset']);}return _0x22fff9[_0xd3e4('0xbe')](_0x4d389a);}})[_0xd3e4('0x27')](function(_0x41815f){if(_0x41815f){return _0x41815f?{'count':_0xe442df,'rows':_0x41815f}:null;}})[_0xd3e4('0x27')](respondWithResult(_0x1d1deb,null))[_0xd3e4('0x4d')](handleError(_0x1d1deb,null));};exports[_0xd3e4('0xbf')]=function(_0x12881b,_0x51e846,_0x149f58){var _0x3c6a51,_0x36f804;return db[_0xd3e4('0x48')]['find']({'where':{'id':_0x12881b[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x51e846,null))[_0xd3e4('0x27')](function(_0x15c8b0){if(_0x15c8b0){_0x36f804=_0x15c8b0;return _0x15c8b0['addBlackLists'](_0x12881b['body']['ids'],_[_0xd3e4('0x5b')](_0x12881b[_0xd3e4('0x51')],[_0xd3e4('0x8b'),'id'])||{});}return null;})['spread'](function(_0x2e5674){var _0xd78acf;_0x3c6a51=_0x2e5674||[];var _0x2a51df=[];if(_0x2e5674){for(var _0x235c93=0x0;_0x235c93<_0x2e5674[_0xd3e4('0x4f')];_0x235c93+=0x1){var _0x1e8ae4=_0x2e5674[_0x235c93][_0xd3e4('0x29')]({'plain':!![]});_0xd78acf=squel['insert']()['into']('cm_hopper_black')[_0xd3e4('0xa0')]([_0xd3e4('0xa1'),_0xd3e4('0xa3'),'ListId','VoiceQueueId',_0xd3e4('0x5c'),_0xd3e4('0x5d')],squel[_0xd3e4('0xa5')]()[_0xd3e4('0x7e')]('phone',_0xd3e4('0xa1'))[_0xd3e4('0x7e')]('id',_0xd3e4('0xa3'))[_0xd3e4('0x7e')](_0x1e8ae4[_0xd3e4('0xa9')][_0xd3e4('0x84')](),_0xd3e4('0xa4'))[_0xd3e4('0x7e')](_0x12881b['params']['id'][_0xd3e4('0x84')](),'VoiceQueueId')[_0xd3e4('0x7e')](_0xd3e4('0xc0'),_0xd3e4('0x5c'))[_0xd3e4('0x7e')](_0xd3e4('0xc0'),_0xd3e4('0x5d'))[_0xd3e4('0xa6')]('cm_contacts')[_0xd3e4('0x43')](_0xd3e4('0xa7'))[_0xd3e4('0x43')](_0xd3e4('0xa8'),_0x1e8ae4[_0xd3e4('0xa9')][_0xd3e4('0x84')]())[_0xd3e4('0x43')](_0xd3e4('0xaa')))[_0xd3e4('0x84')]();_0x2a51df[_0xd3e4('0xb3')](db[_0xd3e4('0x74')][_0xd3e4('0x3a')](_0xd78acf));}return BPromise['all'](_0x2a51df);}})[_0xd3e4('0x27')](function(){return _0x3c6a51;})[_0xd3e4('0x27')](respondWithResult(_0x51e846,null))[_0xd3e4('0x4d')](handleError(_0x51e846,null));};exports[_0xd3e4('0xc1')]=function(_0x50d678,_0x407f9b,_0xc773de){return db[_0xd3e4('0x48')][_0xd3e4('0x30')]({'where':{'id':_0x50d678[_0xd3e4('0x4e')]['id']}})[_0xd3e4('0x27')](handleEntityNotFound(_0x407f9b,null))[_0xd3e4('0x27')](function(_0x284f4d){if(_0x284f4d){return _0x284f4d[_0xd3e4('0xc1')](_0x50d678[_0xd3e4('0x3a')][_0xd3e4('0x8b')]);}})[_0xd3e4('0x27')](function(_0x15fa6b){if(_0x15fa6b){return db[_0xd3e4('0x69')][_0xd3e4('0x28')]({'where':{'ListId':_0x50d678['query'][_0xd3e4('0x8b')],'VoiceQueueId':_0x50d678[_0xd3e4('0x4e')]['id']}})['then'](function(){return _0x15fa6b;});}})[_0xd3e4('0x27')](respondWithStatusCode(_0x407f9b,null))[_0xd3e4('0x4d')](handleError(_0x407f9b,null));}; \ No newline at end of file +var _0xab00=['field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','every','TeamId','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','upsert','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','VoiceQueueId\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','push','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','VoiceQueue','rows','catch','show','params','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','findAll','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','SIP/%s','emit','removeTeams','ids','User','select'];(function(_0xa911e,_0x1a9f9a){var _0x28bd6f=function(_0x3b15ad){while(--_0x3b15ad){_0xa911e['push'](_0xa911e['shift']());}};_0x28bd6f(++_0x1a9f9a);}(_0xab00,0x1b9));var _0x0ab0=function(_0x22c6ce,_0x30e462){_0x22c6ce=_0x22c6ce-0x0;var _0xc18232=_0xab00[_0x22c6ce];return _0xc18232;};'use strict';var emlformat=require(_0x0ab0('0x0'));var rimraf=require(_0x0ab0('0x1'));var zipdir=require(_0x0ab0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ab0('0x3'));var moment=require(_0x0ab0('0x4'));var BPromise=require(_0x0ab0('0x5'));var Mustache=require('mustache');var util=require(_0x0ab0('0x6'));var path=require('path');var sox=require(_0x0ab0('0x7'));var csv=require(_0x0ab0('0x8'));var ejs=require(_0x0ab0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ab0('0xa'));var _=require(_0x0ab0('0xb'));var squel=require(_0x0ab0('0xc'));var crypto=require('crypto');var jsforce=require(_0x0ab0('0xd'));var deskjs=require(_0x0ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ab0('0xf'));var Papa=require('papaparse');var Redis=require(_0x0ab0('0x10'));var authService=require(_0x0ab0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ab0('0x12'));var utils=require('../../config/utils');var config=require(_0x0ab0('0x13'));var licenseUtil=require(_0x0ab0('0x14'));var db=require('../../mysqldb')['db'];config[_0x0ab0('0x15')]=_[_0x0ab0('0x16')](config[_0x0ab0('0x15')],{'host':_0x0ab0('0x17'),'port':0x18eb});var socket=require(_0x0ab0('0x18'))(new Redis(config[_0x0ab0('0x15')]));require(_0x0ab0('0x19'))[_0x0ab0('0x1a')](socket);function respondWithStatusCode(_0x2dfcd3,_0x459477){_0x459477=_0x459477||0xcc;return function(_0x28f26d){if(_0x28f26d){return _0x2dfcd3[_0x0ab0('0x1b')](_0x459477);}return _0x2dfcd3['status'](_0x459477)['end']();};}function respondWithResult(_0x5f4a41,_0x197b59){_0x197b59=_0x197b59||0xc8;return function(_0x32fe14){if(_0x32fe14){return _0x5f4a41[_0x0ab0('0x1c')](_0x197b59)['json'](_0x32fe14);}};}function respondWithFilteredResult(_0x49df08,_0x4a453f){return function(_0x5b3bef){if(_0x5b3bef){var _0x5710bf=typeof _0x4a453f[_0x0ab0('0x1d')]===_0x0ab0('0x1e')&&typeof _0x4a453f[_0x0ab0('0x1f')]===_0x0ab0('0x1e');var _0x454eb3=_0x5b3bef[_0x0ab0('0x20')];var _0x8b50a2=_0x5710bf?0x0:_0x4a453f['offset'];var _0x4a542c=_0x5710bf?_0x5b3bef[_0x0ab0('0x20')]:_0x4a453f[_0x0ab0('0x1d')]+_0x4a453f[_0x0ab0('0x1f')];var _0x5c3382;if(_0x4a542c>=_0x454eb3){_0x4a542c=_0x454eb3;_0x5c3382=0xc8;}else{_0x5c3382=0xce;}_0x49df08[_0x0ab0('0x1c')](_0x5c3382);return _0x49df08['set'](_0x0ab0('0x21'),_0x8b50a2+'-'+_0x4a542c+'/'+_0x454eb3)[_0x0ab0('0x22')](_0x5b3bef);}return null;};}function patchUpdates(_0x20cd95){return function(_0x35ee0d){try{jsonpatch[_0x0ab0('0x23')](_0x35ee0d,_0x20cd95,!![]);}catch(_0xc51b90){return BPromise[_0x0ab0('0x24')](_0xc51b90);}return _0x35ee0d['save']();};}function saveUpdates(_0x2a4629,_0xe7f0a5){return function(_0x2635a2){if(_0x2635a2){return _0x2635a2['update'](_0x2a4629)[_0x0ab0('0x25')](function(_0xd7c564){return _0xd7c564;});}return null;};}function removeEntity(_0x3e9afd,_0x5add07){return function(_0x1f5d10){if(_0x1f5d10){return _0x1f5d10[_0x0ab0('0x26')]()[_0x0ab0('0x25')](function(){var _0x2a4f7c=_0x1f5d10[_0x0ab0('0x27')]({'plain':!![]});var _0x56eedc=[{'name':_0x0ab0('0x28'),'value':'inbound','ignore':![]},{'name':_0x0ab0('0x29'),'value':_0x0ab0('0x2a'),'ignore':![]}];var _0x259e97=_(_0x56eedc)[_0x0ab0('0x2b')]('ignore')[_0x0ab0('0x2c')]('value')[_0x0ab0('0x2d')]();if(_[_0x0ab0('0x2e')](_0x259e97,_0x2a4f7c[_0x0ab0('0x2f')])){return;}var _0x1ae480=_[_0x0ab0('0x30')](_0x56eedc,[_0x0ab0('0x2d'),_0x2a4f7c[_0x0ab0('0x2f')]])[_0x0ab0('0x31')];return db[_0x0ab0('0x32')][_0x0ab0('0x26')]({'where':{'type':_0x1ae480,'resourceId':_0x2a4f7c['id']}})[_0x0ab0('0x25')](function(){return _0x1f5d10;});})[_0x0ab0('0x25')](function(){_0x3e9afd['status'](0xcc)[_0x0ab0('0x33')]();});}};}function handleEntityNotFound(_0x110676,_0x989e82){return function(_0x30cc46){if(!_0x30cc46){_0x110676[_0x0ab0('0x1b')](0x194);}return _0x30cc46;};}function handleError(_0x4758cc,_0x59c030){_0x59c030=_0x59c030||0x1f4;return function(_0x5070e4){logger[_0x0ab0('0x34')](_0x5070e4[_0x0ab0('0x35')]);if(_0x5070e4[_0x0ab0('0x31')]){delete _0x5070e4[_0x0ab0('0x31')];}_0x4758cc[_0x0ab0('0x1c')](_0x59c030)[_0x0ab0('0x36')](_0x5070e4);};}exports[_0x0ab0('0x37')]=function(_0x528468,_0x465b60){var _0x2ad0d4={},_0x2183ee={},_0x33f161={'count':0x0,'rows':[]};var _0x55fb40=_[_0x0ab0('0x2c')](db['VoiceQueue'][_0x0ab0('0x38')],function(_0x596534){return{'name':_0x596534['fieldName'],'type':_0x596534[_0x0ab0('0x2f')]['key']};});_0x2183ee[_0x0ab0('0x39')]=_[_0x0ab0('0x2c')](_0x55fb40,_0x0ab0('0x31'));_0x2183ee[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x528468[_0x0ab0('0x3a')]);_0x2183ee[_0x0ab0('0x3c')]=_['intersection'](_0x2183ee['model'],_0x2183ee['query']);_0x2ad0d4[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x2183ee[_0x0ab0('0x39')],qs['fields'](_0x528468['query'][_0x0ab0('0x3f')]));_0x2ad0d4[_0x0ab0('0x3d')]=_0x2ad0d4[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x2ad0d4[_0x0ab0('0x3d')]:_0x2183ee[_0x0ab0('0x39')];if(!_0x528468['query'][_0x0ab0('0x41')]('nolimit')){_0x2ad0d4['limit']=qs[_0x0ab0('0x1f')](_0x528468['query'][_0x0ab0('0x1f')]);_0x2ad0d4[_0x0ab0('0x1d')]=qs['offset'](_0x528468['query']['offset']);}_0x2ad0d4[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x528468[_0x0ab0('0x3a')]['sort']);_0x2ad0d4[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_[_0x0ab0('0x45')](_0x528468['query'],_0x2183ee[_0x0ab0('0x3c')]),_0x55fb40);if(_0x528468[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x2ad0d4[_0x0ab0('0x44')]=_[_0x0ab0('0x46')](_0x2ad0d4['where'],{'$or':_['map'](_0x55fb40,function(_0x31d2cf){if(_0x31d2cf[_0x0ab0('0x2f')]!==_0x0ab0('0x47')){var _0x301f95={};_0x301f95[_0x31d2cf[_0x0ab0('0x31')]]={'$like':'%'+_0x528468[_0x0ab0('0x3a')]['filter']+'%'};return _0x301f95;}})});}_0x2ad0d4=_[_0x0ab0('0x46')]({},_0x2ad0d4,_0x528468[_0x0ab0('0x48')]);var _0x45a027={'where':_0x2ad0d4[_0x0ab0('0x44')]};return db['VoiceQueue']['count'](_0x45a027)[_0x0ab0('0x25')](function(_0x1cc7bf){_0x33f161[_0x0ab0('0x20')]=_0x1cc7bf;if(_0x528468[_0x0ab0('0x3a')][_0x0ab0('0x49')]){_0x2ad0d4[_0x0ab0('0x4a')]=[{'all':!![]}];}return db[_0x0ab0('0x4b')]['findAll'](_0x2ad0d4);})['then'](function(_0x59f37c){_0x33f161[_0x0ab0('0x4c')]=_0x59f37c;return _0x33f161;})[_0x0ab0('0x25')](respondWithFilteredResult(_0x465b60,_0x2ad0d4))[_0x0ab0('0x4d')](handleError(_0x465b60,null));};exports[_0x0ab0('0x4e')]=function(_0x288715,_0x4a90b2){var _0x36dfd0={'raw':![],'where':{'id':_0x288715[_0x0ab0('0x4f')]['id']}},_0x482eaa={};_0x482eaa[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db[_0x0ab0('0x4b')][_0x0ab0('0x38')]);_0x482eaa[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x288715[_0x0ab0('0x3a')]);_0x482eaa['filters']=_['intersection'](_0x482eaa[_0x0ab0('0x39')],_0x482eaa[_0x0ab0('0x3a')]);_0x36dfd0[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x482eaa[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x288715['query'][_0x0ab0('0x3f')]));_0x36dfd0[_0x0ab0('0x3d')]=_0x36dfd0[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x36dfd0[_0x0ab0('0x3d')]:_0x482eaa[_0x0ab0('0x39')];if(_0x288715[_0x0ab0('0x3a')][_0x0ab0('0x49')]){_0x36dfd0[_0x0ab0('0x4a')]=[{'all':!![]}];}_0x36dfd0=_[_0x0ab0('0x46')]({},_0x36dfd0,_0x288715[_0x0ab0('0x48')]);return db[_0x0ab0('0x4b')][_0x0ab0('0x30')](_0x36dfd0)[_0x0ab0('0x25')](handleEntityNotFound(_0x4a90b2,null))[_0x0ab0('0x25')](respondWithResult(_0x4a90b2,null))['catch'](handleError(_0x4a90b2,null));};exports['create']=function(_0x524a75,_0x408b23){return db[_0x0ab0('0x4b')]['create'](_0x524a75['body'],{})['then'](function(_0xe111c9){var _0x113d6e=_0x524a75['user']['get']({'plain':!![]});if(!_0x113d6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x113d6e[_0x0ab0('0x50')]===_0x0ab0('0x51')){var _0xb96cf8=_0xe111c9[_0x0ab0('0x27')]({'plain':!![]});var _0x3e507d=[{'name':_0x0ab0('0x28'),'value':_0x0ab0('0x52')},{'name':_0x0ab0('0x29'),'value':_0x0ab0('0x2a')}];var _0x17923b=_[_0x0ab0('0x30')](_0x3e507d,[_0x0ab0('0x2d'),_0xb96cf8['type']])['name'];return db[_0x0ab0('0x53')][_0x0ab0('0x30')]({'where':{'name':_0x17923b,'userProfileId':_0x113d6e[_0x0ab0('0x54')]},'raw':!![]})[_0x0ab0('0x25')](function(_0x5ced70){if(_0x5ced70&&_0x5ced70[_0x0ab0('0x55')]===0x0){return db[_0x0ab0('0x32')]['create']({'name':_0xb96cf8['name'],'resourceId':_0xb96cf8['id'],'type':_0x5ced70[_0x0ab0('0x31')],'sectionId':_0x5ced70['id']},{})[_0x0ab0('0x25')](function(){return _0xe111c9;});}else{return _0xe111c9;}})[_0x0ab0('0x4d')](function(_0x19a215){logger['error'](_0x0ab0('0x56'),_0x19a215);throw _0x19a215;});}return _0xe111c9;})['then'](respondWithResult(_0x408b23,0xc9))['catch'](handleError(_0x408b23,null));};exports[_0x0ab0('0x57')]=function(_0x4f0c45,_0x2eaca1){var _0x2479bc={'where':{'id':_0x4f0c45[_0x0ab0('0x4f')]['id']}},_0x54aa67={};_0x54aa67['model']=_[_0x0ab0('0x3b')](db['VoiceQueue']['rawAttributes']);_0x2479bc[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x54aa67['model'],qs[_0x0ab0('0x3f')](_0x4f0c45[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x2479bc[_0x0ab0('0x3d')]=_0x2479bc[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x2479bc[_0x0ab0('0x3d')]:_0x54aa67[_0x0ab0('0x39')];if(_0x4f0c45[_0x0ab0('0x3a')]['includeAll']){_0x2479bc['include']=[{'all':!![]}];}_0x2479bc=_[_0x0ab0('0x46')]({},_0x2479bc,_0x4f0c45['options']);return db[_0x0ab0('0x4b')]['find'](_0x2479bc)[_0x0ab0('0x25')](handleEntityNotFound(_0x2eaca1,null))[_0x0ab0('0x25')](function(_0x2cf803){if(_0x2cf803){var _0x508da2=_0x2cf803[_0x0ab0('0x27')]({'plain':!![]});_0x508da2=qs[_0x0ab0('0x58')](_0x508da2,['id',_0x0ab0('0x59'),_0x0ab0('0x5a')]);_0x4f0c45[_0x0ab0('0x5b')]=_[_0x0ab0('0x58')](_0x4f0c45[_0x0ab0('0x5b')],['id',_0x0ab0('0x59'),'updatedAt']);return db[_0x0ab0('0x4b')][_0x0ab0('0x5c')](_[_0x0ab0('0x46')](_0x508da2,_0x4f0c45['body']),{'include':_0x4f0c45[_0x0ab0('0x3a')][_0x0ab0('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x2a034b){var _0x314abe=_0x4f0c45[_0x0ab0('0x51')][_0x0ab0('0x27')]({'plain':!![]});if(!_0x314abe)throw new Error(_0x0ab0('0x5d'));if(_0x314abe[_0x0ab0('0x50')]===_0x0ab0('0x51')){var _0x55c07e=_0x2a034b['get']({'plain':!![]});var _0x302af0=[{'name':_0x0ab0('0x28'),'value':_0x0ab0('0x52')},{'name':_0x0ab0('0x29'),'value':_0x0ab0('0x2a')}];var _0x3c2d0d=_[_0x0ab0('0x30')](_0x302af0,['value',_0x55c07e[_0x0ab0('0x2f')]])[_0x0ab0('0x31')];return db['UserProfileSection'][_0x0ab0('0x30')]({'where':{'name':_0x3c2d0d,'userProfileId':_0x314abe['userProfileId']},'raw':!![]})['then'](function(_0x447313){if(_0x447313&&_0x447313[_0x0ab0('0x55')]===0x0){return db[_0x0ab0('0x32')][_0x0ab0('0x5c')]({'name':_0x55c07e[_0x0ab0('0x31')],'resourceId':_0x55c07e['id'],'type':_0x447313[_0x0ab0('0x31')],'sectionId':_0x447313['id']},{})['then'](function(){return _0x2a034b;});}else{return _0x2a034b;}})[_0x0ab0('0x4d')](function(_0x4a8e5d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a8e5d);throw _0x4a8e5d;});}return _0x2a034b;});}})[_0x0ab0('0x25')](respondWithResult(_0x2eaca1,0xc9))[_0x0ab0('0x4d')](handleError(_0x2eaca1,null));};exports[_0x0ab0('0x5e')]=function(_0x2957c7,_0x148c81){if(_0x2957c7[_0x0ab0('0x5b')]['id']){delete _0x2957c7[_0x0ab0('0x5b')]['id'];}return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0x2957c7[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x148c81,null))[_0x0ab0('0x25')](saveUpdates(_0x2957c7[_0x0ab0('0x5b')],null))[_0x0ab0('0x25')](respondWithResult(_0x148c81,null))[_0x0ab0('0x4d')](handleError(_0x148c81,null));};exports[_0x0ab0('0x26')]=function(_0x2cf2a7,_0x27a54d){return db[_0x0ab0('0x4b')]['find']({'where':{'id':_0x2cf2a7['params']['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x27a54d,null))[_0x0ab0('0x25')](removeEntity(_0x27a54d,null))[_0x0ab0('0x4d')](handleError(_0x27a54d,null));};exports[_0x0ab0('0x5f')]=function(_0x2e8f66,_0x1a99f7,_0x16934e){var _0x3f8343={'raw':![],'where':{}};var _0x3e376={};var _0x4b00ad={'count':0x0,'rows':[]};return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x2e8f66[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x1a99f7,null))[_0x0ab0('0x25')](function(_0x2542c5){if(_0x2542c5){_0x3e376['model']=_[_0x0ab0('0x3b')](db[_0x0ab0('0x61')][_0x0ab0('0x38')]);_0x3e376[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x2e8f66['query']);_0x3e376[_0x0ab0('0x3c')]=_['intersection'](_0x3e376[_0x0ab0('0x39')],_0x3e376['query']);_0x3f8343['attributes']=_['intersection'](_0x3e376[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x2e8f66['query']['fields']));_0x3f8343[_0x0ab0('0x3d')]=_0x3f8343['attributes'][_0x0ab0('0x40')]?_0x3f8343[_0x0ab0('0x3d')]:_0x3e376['model'];if(!_0x2e8f66[_0x0ab0('0x3a')][_0x0ab0('0x41')](_0x0ab0('0x62'))){_0x3f8343[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0x2e8f66[_0x0ab0('0x3a')]['limit']);_0x3f8343[_0x0ab0('0x1d')]=qs[_0x0ab0('0x1d')](_0x2e8f66[_0x0ab0('0x3a')]['offset']);}_0x3f8343[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x2e8f66[_0x0ab0('0x3a')]['sort']);_0x3f8343['where']=qs[_0x0ab0('0x3c')](_['pick'](_0x2e8f66[_0x0ab0('0x3a')],_0x3e376[_0x0ab0('0x3c')]));_0x3f8343[_0x0ab0('0x44')][_0x0ab0('0x63')]=_0x2542c5['id'];if(_0x2e8f66[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x3f8343[_0x0ab0('0x44')]=_[_0x0ab0('0x46')](_0x3f8343[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x3f8343[_0x0ab0('0x3d')],function(_0x4595e0){var _0x223e15={};_0x223e15[_0x4595e0]={'$like':'%'+_0x2e8f66[_0x0ab0('0x3a')][_0x0ab0('0x2b')]+'%'};return _0x223e15;})});}_0x3f8343=_[_0x0ab0('0x46')]({},_0x3f8343,_0x2e8f66[_0x0ab0('0x48')]);return db['CmHopper'][_0x0ab0('0x20')]({'where':_0x3f8343[_0x0ab0('0x44')]})[_0x0ab0('0x25')](function(_0x5db451){_0x4b00ad[_0x0ab0('0x20')]=_0x5db451;if(_0x2e8f66[_0x0ab0('0x3a')][_0x0ab0('0x49')]){_0x3f8343[_0x0ab0('0x4a')]=[{'all':!![]}];}return db[_0x0ab0('0x61')]['findAll'](_0x3f8343);})[_0x0ab0('0x25')](function(_0x243f22){_0x4b00ad['rows']=_0x243f22;return _0x4b00ad;});}})[_0x0ab0('0x25')](respondWithFilteredResult(_0x1a99f7,_0x3f8343))[_0x0ab0('0x4d')](handleError(_0x1a99f7,null));};exports[_0x0ab0('0x64')]=function(_0x54a7c5,_0x50962c,_0x3ab092){var _0xd3a502={'raw':!![],'where':{}};var _0x56086a={};var _0x476ee6={'count':0x0,'rows':[]};return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x54a7c5[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x50962c,null))[_0x0ab0('0x25')](function(_0x1fbe8e){if(_0x1fbe8e){_0x56086a[_0x0ab0('0x39')]=_['keys'](db[_0x0ab0('0x65')][_0x0ab0('0x38')]);_0x56086a[_0x0ab0('0x3a')]=_['keys'](_0x54a7c5[_0x0ab0('0x3a')]);_0x56086a[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0x56086a[_0x0ab0('0x39')],_0x56086a[_0x0ab0('0x3a')]);_0xd3a502['attributes']=_['intersection'](_0x56086a['model'],qs[_0x0ab0('0x3f')](_0x54a7c5[_0x0ab0('0x3a')]['fields']));_0xd3a502[_0x0ab0('0x3d')]=_0xd3a502[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0xd3a502[_0x0ab0('0x3d')]:_0x56086a['model'];if(!_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x41')](_0x0ab0('0x62'))){_0xd3a502[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x1f')]);_0xd3a502[_0x0ab0('0x1d')]=qs[_0x0ab0('0x1d')](_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}_0xd3a502[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0xd3a502[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_[_0x0ab0('0x45')](_0x54a7c5['query'],_0x56086a[_0x0ab0('0x3c')]));_0xd3a502['where']['VoiceQueueId']=_0x1fbe8e['id'];if(_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0xd3a502['where']=_[_0x0ab0('0x46')](_0xd3a502[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0xd3a502[_0x0ab0('0x3d')],function(_0xb73566){var _0x153614={};_0x153614[_0xb73566]={'$like':'%'+_0x54a7c5['query'][_0x0ab0('0x2b')]+'%'};return _0x153614;})});}_0xd3a502=_['merge']({},_0xd3a502,_0x54a7c5['options']);return db['CmHopperHistory'][_0x0ab0('0x20')]({'where':_0xd3a502[_0x0ab0('0x44')]})[_0x0ab0('0x25')](function(_0x232a13){_0x476ee6[_0x0ab0('0x20')]=_0x232a13;if(_0x54a7c5[_0x0ab0('0x3a')][_0x0ab0('0x49')]){_0xd3a502['include']=[{'all':!![]}];}return db[_0x0ab0('0x65')][_0x0ab0('0x66')](_0xd3a502);})[_0x0ab0('0x25')](function(_0x274bd0){_0x476ee6['rows']=_0x274bd0;return _0x476ee6;});}})[_0x0ab0('0x25')](respondWithFilteredResult(_0x50962c,_0xd3a502))[_0x0ab0('0x4d')](handleError(_0x50962c,null));};exports['getHopperFinals']=function(_0x46485e,_0x368d28,_0x26699a){var _0x5383d0={'raw':!![],'where':{}};var _0x22b14e={};var _0x5c97e7={'count':0x0,'rows':[]};return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x46485e[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x368d28,null))['then'](function(_0x274745){if(_0x274745){_0x22b14e[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db['CmHopperFinal'][_0x0ab0('0x38')]);_0x22b14e[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x46485e[_0x0ab0('0x3a')]);_0x22b14e[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0x22b14e['model'],_0x22b14e[_0x0ab0('0x3a')]);_0x5383d0['attributes']=_[_0x0ab0('0x3e')](_0x22b14e[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x46485e[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x5383d0[_0x0ab0('0x3d')]=_0x5383d0[_0x0ab0('0x3d')]['length']?_0x5383d0[_0x0ab0('0x3d')]:_0x22b14e[_0x0ab0('0x39')];if(!_0x46485e[_0x0ab0('0x3a')][_0x0ab0('0x41')]('nolimit')){_0x5383d0[_0x0ab0('0x1f')]=qs['limit'](_0x46485e['query'][_0x0ab0('0x1f')]);_0x5383d0['offset']=qs[_0x0ab0('0x1d')](_0x46485e[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}_0x5383d0[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x46485e[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x5383d0[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_['pick'](_0x46485e['query'],_0x22b14e[_0x0ab0('0x3c')]));_0x5383d0['where']['VoiceQueueId']=_0x274745['id'];if(_0x46485e[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x5383d0['where']=_[_0x0ab0('0x46')](_0x5383d0[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x5383d0[_0x0ab0('0x3d')],function(_0x4308b7){var _0x4db759={};_0x4db759[_0x4308b7]={'$like':'%'+_0x46485e[_0x0ab0('0x3a')]['filter']+'%'};return _0x4db759;})});}_0x5383d0=_[_0x0ab0('0x46')]({},_0x5383d0,_0x46485e['options']);return db['CmHopperFinal'][_0x0ab0('0x20')]({'where':_0x5383d0['where']})[_0x0ab0('0x25')](function(_0x45b251){_0x5c97e7[_0x0ab0('0x20')]=_0x45b251;if(_0x46485e[_0x0ab0('0x3a')]['includeAll']){_0x5383d0[_0x0ab0('0x4a')]=[{'all':!![]}];}return db[_0x0ab0('0x67')]['findAll'](_0x5383d0);})[_0x0ab0('0x25')](function(_0x36720b){_0x5c97e7[_0x0ab0('0x4c')]=_0x36720b;return _0x5c97e7;});}})[_0x0ab0('0x25')](respondWithFilteredResult(_0x368d28,_0x5383d0))['catch'](handleError(_0x368d28,null));};exports[_0x0ab0('0x68')]=function(_0x5b6b53,_0x4a3536,_0x1c357a){var _0x53afb6={'raw':!![],'where':{}};var _0x8ab65f={};var _0x43c631={'count':0x0,'rows':[]};return db[_0x0ab0('0x4b')]['findOne']({'where':{'id':_0x5b6b53[_0x0ab0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4a3536,null))['then'](function(_0x1911b6){if(_0x1911b6){_0x8ab65f[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db[_0x0ab0('0x69')]['rawAttributes']);_0x8ab65f[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x5b6b53['query']);_0x8ab65f[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0x8ab65f[_0x0ab0('0x39')],_0x8ab65f[_0x0ab0('0x3a')]);_0x53afb6['attributes']=_['intersection'](_0x8ab65f[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x5b6b53[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x53afb6[_0x0ab0('0x3d')]=_0x53afb6[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x53afb6[_0x0ab0('0x3d')]:_0x8ab65f['model'];if(!_0x5b6b53[_0x0ab0('0x3a')][_0x0ab0('0x41')]('nolimit')){_0x53afb6[_0x0ab0('0x1f')]=qs['limit'](_0x5b6b53['query'][_0x0ab0('0x1f')]);_0x53afb6['offset']=qs[_0x0ab0('0x1d')](_0x5b6b53[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}_0x53afb6[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x5b6b53[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x53afb6[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_[_0x0ab0('0x45')](_0x5b6b53[_0x0ab0('0x3a')],_0x8ab65f[_0x0ab0('0x3c')]));_0x53afb6['where'][_0x0ab0('0x63')]=_0x1911b6['id'];if(_0x5b6b53[_0x0ab0('0x3a')]['filter']){_0x53afb6['where']=_[_0x0ab0('0x46')](_0x53afb6[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x53afb6['attributes'],function(_0x307ff2){var _0x2cd305={};_0x2cd305[_0x307ff2]={'$like':'%'+_0x5b6b53['query'][_0x0ab0('0x2b')]+'%'};return _0x2cd305;})});}_0x53afb6=_[_0x0ab0('0x46')]({},_0x53afb6,_0x5b6b53[_0x0ab0('0x48')]);return db[_0x0ab0('0x69')]['count']({'where':_0x53afb6[_0x0ab0('0x44')]})[_0x0ab0('0x25')](function(_0x2efd81){_0x43c631[_0x0ab0('0x20')]=_0x2efd81;if(_0x5b6b53[_0x0ab0('0x3a')]['includeAll']){_0x53afb6[_0x0ab0('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0ab0('0x66')](_0x53afb6);})[_0x0ab0('0x25')](function(_0x32dfb3){_0x43c631[_0x0ab0('0x4c')]=_0x32dfb3;return _0x43c631;});}})[_0x0ab0('0x25')](respondWithFilteredResult(_0x4a3536,_0x53afb6))['catch'](handleError(_0x4a3536,null));};exports[_0x0ab0('0x6a')]=function(_0x44b57e,_0x5bc48b,_0x51b6b5){var _0x795e58={};var _0xfb0396={};var _0xc293cf;var _0x1c9567;return db['VoiceQueue'][_0x0ab0('0x60')]({'where':{'id':_0x44b57e[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x5bc48b,null))[_0x0ab0('0x25')](function(_0x3ee80e){if(_0x3ee80e){_0xc293cf=_0x3ee80e;_0xfb0396[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db[_0x0ab0('0x6b')]['rawAttributes']);_0xfb0396[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x44b57e[_0x0ab0('0x3a')]);_0xfb0396[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0xfb0396[_0x0ab0('0x39')],_0xfb0396[_0x0ab0('0x3a')]);_0x795e58[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0xfb0396[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x44b57e['query'][_0x0ab0('0x3f')]));_0x795e58[_0x0ab0('0x3d')]=_0x795e58[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x795e58[_0x0ab0('0x3d')]:_0xfb0396['model'];_0x795e58[_0x0ab0('0x42')]=qs['sort'](_0x44b57e[_0x0ab0('0x3a')]['sort']);_0x795e58[_0x0ab0('0x44')]=qs['filters'](_[_0x0ab0('0x45')](_0x44b57e[_0x0ab0('0x3a')],_0xfb0396['filters']));if(_0x44b57e[_0x0ab0('0x3a')]['filter']){_0x795e58['where']=_['merge'](_0x795e58[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x795e58[_0x0ab0('0x3d')],function(_0x5c4d3a){var _0x415125={};_0x415125[_0x5c4d3a]={'$like':'%'+_0x44b57e[_0x0ab0('0x3a')][_0x0ab0('0x2b')]+'%'};return _0x415125;})});}_0x795e58=_['merge']({},_0x795e58,_0x44b57e[_0x0ab0('0x48')]);return _0xc293cf[_0x0ab0('0x6a')](_0x795e58);}})[_0x0ab0('0x25')](function(_0x31154b){if(_0x31154b){_0x1c9567=_0x31154b[_0x0ab0('0x40')];if(!_0x44b57e[_0x0ab0('0x3a')][_0x0ab0('0x41')](_0x0ab0('0x62'))){_0x795e58[_0x0ab0('0x1f')]=qs['limit'](_0x44b57e[_0x0ab0('0x3a')][_0x0ab0('0x1f')]);_0x795e58[_0x0ab0('0x1d')]=qs['offset'](_0x44b57e['query']['offset']);}return _0xc293cf[_0x0ab0('0x6a')](_0x795e58);}})[_0x0ab0('0x25')](function(_0x19167b){if(_0x19167b){return _0x19167b?{'count':_0x1c9567,'rows':_0x19167b}:null;}})[_0x0ab0('0x25')](respondWithResult(_0x5bc48b,null))[_0x0ab0('0x4d')](handleError(_0x5bc48b,null));};exports['addTeams']=function(_0x537758,_0x315196,_0x121630){var _0x8091=_0x537758[_0x0ab0('0x5b')]['teams'];var _0x104d20=_['map'](_0x8091,'id');return db['Team'][_0x0ab0('0x66')]({'where':{'id':_0x104d20},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0ab0('0x6c'),'attributes':['id',_0x0ab0('0x31'),_0x0ab0('0x6d'),_0x0ab0('0x6e'),'interface'],'raw':!![]}]})[_0x0ab0('0x25')](function(_0x226cd1){if(_0x226cd1){var _0x5e058f=_[_0x0ab0('0x6f')](_0x226cd1,function(_0x2e858e){var _0x200d21=_0x2e858e[_0x0ab0('0x27')]({'plain':!![]});_0x200d21['Agents'][_0x0ab0('0x70')](function(_0x26983e){_0x26983e[_0x0ab0('0x71')]=_[_0x0ab0('0x30')](_0x8091,{'id':_0x200d21['id']})['penalty'];});return _0x200d21['Agents'];});return db[_0x0ab0('0x4b')]['find']({'where':{'id':_0x537758[_0x0ab0('0x4f')]['id']}})['then'](function(_0x132f47){return db[_0x0ab0('0x72')][_0x0ab0('0x73')](function(_0x1d7e2c){return _0x132f47[_0x0ab0('0x74')](_0x104d20,{'transaction':_0x1d7e2c})['then'](function(){return BPromise[_0x0ab0('0x75')](_0x8091,function(_0x4824d3){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x4824d3['id'],'VoiceQueueId':_0x537758[_0x0ab0('0x4f')]['id'],'penalty':_0x4824d3[_0x0ab0('0x71')]},{'transaction':_0x1d7e2c});});})[_0x0ab0('0x25')](function(){return BPromise['each'](_0x5e058f,function(_0x5ef3b5){return db[_0x0ab0('0x76')][_0x0ab0('0x77')]({'where':{'UserId':_0x5ef3b5['id'],'VoiceQueueId':_0x537758['params']['id']},'defaults':{'penalty':_0x5ef3b5[_0x0ab0('0x71')]},'transaction':_0x1d7e2c});});})[_0x0ab0('0x25')](function(){return BPromise[_0x0ab0('0x75')](_[_0x0ab0('0x2b')](_0x5e058f,{'online':!![]}),function(_0x40618f){return db[_0x0ab0('0x78')]['upsert']({'membername':_0x40618f['name'],'UserId':_0x40618f['id'],'queue_name':_0x132f47['name'],'VoiceQueueId':_0x132f47['id'],'interface':_[_0x0ab0('0x79')](_0x40618f[_0x0ab0('0x7a')])?util['format'](_0x0ab0('0x7b'),_0x40618f[_0x0ab0('0x31')]):_0x40618f[_0x0ab0('0x7a')],'paused':_0x40618f[_0x0ab0('0x6e')]||![],'penalty':_0x40618f[_0x0ab0('0x71')]},{'transaction':_0x1d7e2c});});})['then'](function(){_0x5e058f[_0x0ab0('0x70')](function(_0x524ccd){socket[_0x0ab0('0x7c')]('userVoiceQueue:save',{'UserId':_0x524ccd['id'],'VoiceQueueId':_0x132f47['id']});});});});});}})[_0x0ab0('0x25')](respondWithStatusCode(_0x315196,null))[_0x0ab0('0x4d')](handleError(_0x315196,null));};exports[_0x0ab0('0x7d')]=function(_0xdb5167,_0x4dfef7,_0x184e98){return db['Team'][_0x0ab0('0x66')]({'where':{'id':_0xdb5167[_0x0ab0('0x3a')][_0x0ab0('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x0ab0('0x7f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4dfef7,null))['then'](function(_0x4945ee){var _0x18c7c2=_[_0x0ab0('0x2c')](_0x4945ee,'id');var _0x24b603=[];var _0x4ede17=[];var _0x310db5=squel[_0x0ab0('0x80')]();_0x310db5[_0x0ab0('0x81')](_0x0ab0('0x82'))[_0x0ab0('0x83')]('team_has_voice_queues','tq')[_0x0ab0('0x84')](_0x0ab0('0x85'),'ut',_0x0ab0('0x86'))[_0x0ab0('0x44')]('VoiceQueueId\x20=\x20?',_0xdb5167[_0x0ab0('0x4f')]['id']);for(var _0x551ea7=0x0;_0x551ea7<_0x4945ee['length'];_0x551ea7+=0x1){let _0x3cd156=_0x4945ee[_0x551ea7];for(var _0xcc517a=0x0;_0xcc517a<_0x3cd156['Agents'][_0x0ab0('0x40')];_0xcc517a+=0x1){let _0x32b774=_0x3cd156[_0x0ab0('0x6c')][_0xcc517a];var _0x59eff6=_0x310db5[_0x0ab0('0x57')]();_0x59eff6[_0x0ab0('0x44')]('ut.UserId\x20=\x20?',_0x32b774['id']);_0x4ede17['push'](db[_0x0ab0('0x72')][_0x0ab0('0x3a')](_0x59eff6[_0x0ab0('0x87')](),{'type':db[_0x0ab0('0x72')]['QueryTypes']['SELECT']})['then'](function(_0x26537d){if(_0x26537d['length']===0x1){return _0x32b774['id'];}else{var _0x2b9b46=_[_0x0ab0('0x88')](_['map'](_0x26537d,_0x0ab0('0x89')),function(_0x19e0fd){return _[_0x0ab0('0x2e')](_0x18c7c2,_0x19e0fd);});if(_0x2b9b46){return _0x32b774['id'];}}}));}}return BPromise[_0x0ab0('0x8a')](_0x4ede17)[_0x0ab0('0x25')](function(_0x40760d){_0x24b603=_(_0x24b603)['union'](_0x40760d)['compact']()[_0x0ab0('0x2d')]();return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0xdb5167[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](function(_0x2b9437){return db[_0x0ab0('0x72')]['transaction'](function(_0x2b14af){return _0x2b9437['removeTeams'](_0xdb5167['query'][_0x0ab0('0x7e')],{'transaction':_0x2b14af})[_0x0ab0('0x25')](function(){if(!_[_0x0ab0('0x8b')](_0x24b603)){return _0x2b9437[_0x0ab0('0x8c')](_0x24b603,{'transaction':_0x2b14af})[_0x0ab0('0x25')](function(){return db[_0x0ab0('0x78')][_0x0ab0('0x26')]({'where':{'VoiceQueueId':_0xdb5167[_0x0ab0('0x4f')]['id'],'UserId':_0x24b603},'transaction':_0x2b14af});});}})[_0x0ab0('0x25')](function(){_0x24b603[_0x0ab0('0x70')](function(_0x42b3b8){socket['emit'](_0x0ab0('0x8d'),{'UserId':_0x42b3b8,'VoiceQueueId':_0x2b9437['id']});});});});});});})[_0x0ab0('0x25')](respondWithStatusCode(_0x4dfef7,null))[_0x0ab0('0x4d')](handleError(_0x4dfef7,null));};exports[_0x0ab0('0x8e')]=function(_0x3f40f1,_0x2d1689,_0x255af0){var _0xe42a4e,_0x377bb6;return db[_0x0ab0('0x4b')]['find']({'where':{'id':_0x3f40f1[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x2d1689,null))[_0x0ab0('0x25')](function(_0x3c4782){if(_0x3c4782){_0x377bb6=_0x3c4782;return _0x3c4782[_0x0ab0('0x8e')](_0x3f40f1[_0x0ab0('0x5b')][_0x0ab0('0x7e')],_['omit'](_0x3f40f1[_0x0ab0('0x5b')],[_0x0ab0('0x7e'),'id'])||{})[_0x0ab0('0x8f')](function(_0x5d8d2f){for(var _0x1ee180=0x0;_0x1ee180<_0x3f40f1[_0x0ab0('0x5b')]['ids'][_0x0ab0('0x40')];_0x1ee180+=0x1){socket[_0x0ab0('0x7c')](_0x0ab0('0x90'),{'UserId':Number(_0x3f40f1[_0x0ab0('0x5b')]['ids'][_0x1ee180]),'VoiceQueueId':Number(_0x3f40f1['params']['id'])});}return _0x5d8d2f;});}})[_0x0ab0('0x25')](function(_0x4b8bd2){_0xe42a4e=_0x4b8bd2||[];if(_0x377bb6){return db[_0x0ab0('0x7f')][_0x0ab0('0x66')]({'where':{'id':_0x3f40f1[_0x0ab0('0x5b')][_0x0ab0('0x7e')]},'attributes':['id',_0x0ab0('0x31'),_0x0ab0('0x6d'),_0x0ab0('0x6e'),_0x0ab0('0x7a')],'raw':!![]});}})['then'](function(_0x3bfcf8){if(!_[_0x0ab0('0x8b')](_0x3bfcf8)){var _0x3a3247=[];for(var _0x19cac6=0x0;_0x19cac6<_0x3bfcf8[_0x0ab0('0x40')];_0x19cac6++){if(_0x3bfcf8[_0x19cac6][_0x0ab0('0x6d')]){_0x3a3247['push'](db[_0x0ab0('0x78')][_0x0ab0('0x91')]({'membername':_0x3bfcf8[_0x19cac6][_0x0ab0('0x31')],'UserId':_0x3bfcf8[_0x19cac6]['id'],'queue_name':_0x377bb6[_0x0ab0('0x31')],'VoiceQueueId':_0x377bb6['id'],'interface':_[_0x0ab0('0x79')](_0x3bfcf8[_0x19cac6]['interface'])?util[_0x0ab0('0x92')](_0x0ab0('0x7b'),_0x3bfcf8[_0x19cac6][_0x0ab0('0x31')]):_0x3bfcf8[_0x19cac6][_0x0ab0('0x7a')],'paused':_0x3bfcf8[_0x19cac6]['voicePause']||![],'penalty':_0x3f40f1[_0x0ab0('0x5b')][_0x0ab0('0x71')]||0x0}));}}return BPromise[_0x0ab0('0x8a')](_0x3a3247);}})['then'](function(){return _0xe42a4e;})[_0x0ab0('0x25')](respondWithResult(_0x2d1689,null))['catch'](handleError(_0x2d1689,null));};exports[_0x0ab0('0x8c')]=function(_0x1b0ea4,_0x1f11b7,_0x17227f){return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0x1b0ea4[_0x0ab0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f11b7,null))['then'](function(_0x62005b){if(_0x62005b){return _0x62005b['removeAgents'](_0x1b0ea4['query'][_0x0ab0('0x7e')])['then'](function(){if(_[_0x0ab0('0x93')](_0x1b0ea4['query'][_0x0ab0('0x7e')])){for(var _0x15d626=0x0;_0x15d626<_0x1b0ea4['query'][_0x0ab0('0x7e')][_0x0ab0('0x40')];_0x15d626+=0x1){socket[_0x0ab0('0x7c')](_0x0ab0('0x8d'),{'UserId':Number(_0x1b0ea4['query']['ids'][_0x15d626]),'VoiceQueueId':Number(_0x1b0ea4[_0x0ab0('0x4f')]['id'])});}}else{socket[_0x0ab0('0x7c')](_0x0ab0('0x8d'),{'UserId':Number(_0x1b0ea4['query'][_0x0ab0('0x7e')]),'VoiceQueueId':Number(_0x1b0ea4[_0x0ab0('0x4f')]['id'])});}});}})['then'](function(_0x426da3){return db[_0x0ab0('0x78')][_0x0ab0('0x26')]({'where':{'VoiceQueueId':_0x1b0ea4[_0x0ab0('0x4f')]['id'],'UserId':_0x1b0ea4[_0x0ab0('0x3a')][_0x0ab0('0x7e')]}})[_0x0ab0('0x25')](function(){return _0x426da3;});})['then'](respondWithStatusCode(_0x1f11b7,null))[_0x0ab0('0x4d')](handleError(_0x1f11b7,null));};exports[_0x0ab0('0x94')]=function(_0x54fa75,_0x3489c7,_0x4f134c){var _0x4a3b2c={};var _0x362158={};var _0x2dfc0d;var _0x20792b;return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x54fa75[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x3489c7,null))['then'](function(_0x133324){if(_0x133324){_0x2dfc0d=_0x133324;_0x362158['model']=_[_0x0ab0('0x3b')](db[_0x0ab0('0x7f')][_0x0ab0('0x38')]);_0x362158[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x54fa75[_0x0ab0('0x3a')]);_0x362158[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0x362158[_0x0ab0('0x39')],_0x362158['query']);_0x4a3b2c[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x362158['model'],qs['fields'](_0x54fa75['query']['fields']));_0x4a3b2c[_0x0ab0('0x3d')]=_0x4a3b2c[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x4a3b2c[_0x0ab0('0x3d')]:_0x362158['model'];_0x4a3b2c['order']=qs[_0x0ab0('0x43')](_0x54fa75[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x4a3b2c[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_[_0x0ab0('0x45')](_0x54fa75[_0x0ab0('0x3a')],_0x362158[_0x0ab0('0x3c')]));if(_0x54fa75[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x4a3b2c[_0x0ab0('0x44')]=_[_0x0ab0('0x46')](_0x4a3b2c['where'],{'$or':_[_0x0ab0('0x2c')](_0x4a3b2c['attributes'],function(_0x28b60a){var _0x47b4a6={};_0x47b4a6[_0x28b60a]={'$like':'%'+_0x54fa75['query'][_0x0ab0('0x2b')]+'%'};return _0x47b4a6;})});}_0x4a3b2c=_['merge']({},_0x4a3b2c,_0x54fa75[_0x0ab0('0x48')]);return _0x2dfc0d[_0x0ab0('0x94')](_0x4a3b2c);}})['then'](function(_0x3b9afc){if(_0x3b9afc){_0x20792b=_0x3b9afc[_0x0ab0('0x40')];if(!_0x54fa75[_0x0ab0('0x3a')][_0x0ab0('0x41')](_0x0ab0('0x62'))){_0x4a3b2c[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0x54fa75[_0x0ab0('0x3a')]['limit']);_0x4a3b2c[_0x0ab0('0x1d')]=qs[_0x0ab0('0x1d')](_0x54fa75[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}return _0x2dfc0d['getAgents'](_0x4a3b2c);}})[_0x0ab0('0x25')](function(_0x2ab1c1){if(_0x2ab1c1){return _0x2ab1c1?{'count':_0x20792b,'rows':_0x2ab1c1}:null;}})[_0x0ab0('0x25')](respondWithResult(_0x3489c7,null))[_0x0ab0('0x4d')](handleError(_0x3489c7,null));};exports['getMembers']=function(_0x37909c,_0x5d774f,_0x3f8050){var _0x431964={};var _0x56a7da={};var _0x1dcb21;var _0x17ba33;return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x37909c[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x5d774f,null))[_0x0ab0('0x25')](function(_0x24cca6){if(_0x24cca6){_0x1dcb21=_0x24cca6;_0x56a7da[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db['UserVoiceQueueRt'][_0x0ab0('0x38')]);_0x56a7da['query']=_[_0x0ab0('0x3b')](_0x37909c[_0x0ab0('0x3a')]);_0x56a7da['filters']=_[_0x0ab0('0x3e')](_0x56a7da[_0x0ab0('0x39')],_0x56a7da[_0x0ab0('0x3a')]);_0x431964[_0x0ab0('0x3d')]=_['intersection'](_0x56a7da[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x37909c[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x431964['attributes']=_0x431964[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x431964[_0x0ab0('0x3d')]:_0x56a7da['model'];_0x431964[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0x37909c[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x431964[_0x0ab0('0x44')]=qs['filters'](_[_0x0ab0('0x45')](_0x37909c['query'],_0x56a7da[_0x0ab0('0x3c')]));if(_0x37909c[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x431964[_0x0ab0('0x44')]=_[_0x0ab0('0x46')](_0x431964[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x431964[_0x0ab0('0x3d')],function(_0x4a54f6){var _0x30fce3={};_0x30fce3[_0x4a54f6]={'$like':'%'+_0x37909c['query'][_0x0ab0('0x2b')]+'%'};return _0x30fce3;})});}_0x431964=_[_0x0ab0('0x46')]({},_0x431964,_0x37909c[_0x0ab0('0x48')]);return _0x1dcb21[_0x0ab0('0x95')](_0x431964);}})[_0x0ab0('0x25')](function(_0x34474d){if(_0x34474d){_0x17ba33=_0x34474d['length'];if(!_0x37909c[_0x0ab0('0x3a')][_0x0ab0('0x41')]('nolimit')){_0x431964['limit']=qs[_0x0ab0('0x1f')](_0x37909c['query'][_0x0ab0('0x1f')]);_0x431964['offset']=qs['offset'](_0x37909c['query'][_0x0ab0('0x1d')]);}return _0x1dcb21[_0x0ab0('0x95')](_0x431964);}})['then'](function(_0x18a6f6){return _0x18a6f6?{'count':_0x17ba33,'rows':_0x18a6f6}:null;})['then'](respondWithResult(_0x5d774f,null))[_0x0ab0('0x4d')](handleError(_0x5d774f,null));};exports['getLists']=function(_0xf71f16,_0xacd792,_0x110f8e){var _0x2d73a8={};var _0x1084d5={};var _0x3535a6;var _0xe7a4b2;return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0xf71f16['params']['id']}})['then'](handleEntityNotFound(_0xacd792,null))[_0x0ab0('0x25')](function(_0xbeb937){if(_0xbeb937){_0x3535a6=_0xbeb937;_0x1084d5[_0x0ab0('0x39')]=_[_0x0ab0('0x3b')](db['CmList']['rawAttributes']);_0x1084d5[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0xf71f16[_0x0ab0('0x3a')]);_0x1084d5[_0x0ab0('0x3c')]=_['intersection'](_0x1084d5['model'],_0x1084d5['query']);_0x2d73a8[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x1084d5['model'],qs[_0x0ab0('0x3f')](_0xf71f16[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x2d73a8[_0x0ab0('0x3d')]=_0x2d73a8[_0x0ab0('0x3d')][_0x0ab0('0x40')]?_0x2d73a8[_0x0ab0('0x3d')]:_0x1084d5[_0x0ab0('0x39')];_0x2d73a8[_0x0ab0('0x42')]=qs[_0x0ab0('0x43')](_0xf71f16[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x2d73a8[_0x0ab0('0x44')]=qs[_0x0ab0('0x3c')](_[_0x0ab0('0x45')](_0xf71f16[_0x0ab0('0x3a')],_0x1084d5[_0x0ab0('0x3c')]));if(_0xf71f16['query'][_0x0ab0('0x2b')]){_0x2d73a8[_0x0ab0('0x44')]=_['merge'](_0x2d73a8[_0x0ab0('0x44')],{'$or':_['map'](_0x2d73a8[_0x0ab0('0x3d')],function(_0x45c271){var _0x566061={};_0x566061[_0x45c271]={'$like':'%'+_0xf71f16['query'][_0x0ab0('0x2b')]+'%'};return _0x566061;})});}_0x2d73a8=_[_0x0ab0('0x46')]({},_0x2d73a8,_0xf71f16[_0x0ab0('0x48')]);return _0x3535a6[_0x0ab0('0x96')](_0x2d73a8);}})[_0x0ab0('0x25')](function(_0x640ac){if(_0x640ac){_0xe7a4b2=_0x640ac[_0x0ab0('0x40')];if(!_0xf71f16[_0x0ab0('0x3a')]['hasOwnProperty']('nolimit')){_0x2d73a8[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0xf71f16[_0x0ab0('0x3a')][_0x0ab0('0x1f')]);_0x2d73a8[_0x0ab0('0x1d')]=qs[_0x0ab0('0x1d')](_0xf71f16[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}return _0x3535a6[_0x0ab0('0x96')](_0x2d73a8);}})[_0x0ab0('0x25')](function(_0x4d3502){if(_0x4d3502){return _0x4d3502?{'count':_0xe7a4b2,'rows':_0x4d3502}:null;}})[_0x0ab0('0x25')](respondWithResult(_0xacd792,null))[_0x0ab0('0x4d')](handleError(_0xacd792,null));};exports[_0x0ab0('0x97')]=function(_0xf7d614,_0x34f5e6,_0xd0ec59){var _0x3f0cca=moment()[_0x0ab0('0x92')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37ba01,_0x40b601;return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0xf7d614['params']['id']}})['then'](handleEntityNotFound(_0x34f5e6,null))['then'](function(_0x50548a){if(_0x50548a){_0x40b601=_0x50548a;return _0x50548a[_0x0ab0('0x97')](_0xf7d614['body'][_0x0ab0('0x7e')],_[_0x0ab0('0x58')](_0xf7d614[_0x0ab0('0x5b')],[_0x0ab0('0x7e'),'id'])||{});}return null;})[_0x0ab0('0x8f')](function(_0x159e92){var _0xba2445;_0x37ba01=_0x159e92||[];var _0x3cc7ba=[];if(_0x159e92){for(var _0x1b4f16=0x0;_0x1b4f16<_0x159e92[_0x0ab0('0x40')];_0x1b4f16+=0x1){var _0x56e3ca=_0x159e92[_0x1b4f16]['get']({'plain':!![]});_0x40b601['dialCheckDuplicateType']=_0xf7d614[_0x0ab0('0x5b')][_0x0ab0('0x98')]?_0xf7d614[_0x0ab0('0x5b')]['dialCheckDuplicateType']:_0x40b601[_0x0ab0('0x98')];switch(_0x40b601[_0x0ab0('0x98')]){case _0x0ab0('0x99'):_0xba2445=squel[_0x0ab0('0x9a')]()[_0x0ab0('0x9b')](_0x0ab0('0x9c'))[_0x0ab0('0x9d')]([_0x0ab0('0x9e'),_0x0ab0('0x9f'),_0x0ab0('0xa0'),_0x0ab0('0xa1'),_0x0ab0('0x63'),_0x0ab0('0x59'),_0x0ab0('0x5a')],squel['select']()[_0x0ab0('0x81')]('phone',_0x0ab0('0x9e'))['field']('\x27'+_0x3f0cca+'\x27','scheduledAt')[_0x0ab0('0x81')]('id','ContactId')['field'](_0x56e3ca[_0x0ab0('0xa2')][_0x0ab0('0x87')](),_0x0ab0('0xa1'))[_0x0ab0('0x81')](_0xf7d614['params']['id'][_0x0ab0('0x87')](),'VoiceQueueId')[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x59'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x5a'))['from'](_0x0ab0('0xa3'))[_0x0ab0('0x44')](_0x0ab0('0xa4'))[_0x0ab0('0x44')](_0x0ab0('0xa5'),_0x56e3ca['CmListId']['toString']())[_0x0ab0('0x44')](_0x0ab0('0xa6'))[_0x0ab0('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x0ab0('0xa7'))[_0x0ab0('0x83')]('cm_hopper_final')[_0x0ab0('0x44')]('VoiceQueueId\x20=\x20?',_0xf7d614['params']['id'][_0x0ab0('0x87')]()))['where'](_0x0ab0('0xa8'),squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')](_0x0ab0('0xa9'))[_0x0ab0('0x83')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xf7d614[_0x0ab0('0x4f')]['id'][_0x0ab0('0x87')]())))[_0x0ab0('0x87')]();break;case _0x0ab0('0xaa'):_0xba2445=squel['insert']()['into'](_0x0ab0('0x9c'))[_0x0ab0('0x9d')]([_0x0ab0('0x9e'),_0x0ab0('0x9f'),_0x0ab0('0xa0'),'ListId',_0x0ab0('0x63'),_0x0ab0('0x59'),_0x0ab0('0x5a')],squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')](_0x0ab0('0x9e'),_0x0ab0('0x9e'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x9f'))[_0x0ab0('0x81')]('id','ContactId')[_0x0ab0('0x81')](_0x56e3ca[_0x0ab0('0xa2')][_0x0ab0('0x87')](),'ListId')[_0x0ab0('0x81')](_0xf7d614[_0x0ab0('0x4f')]['id'][_0x0ab0('0x87')](),_0x0ab0('0x63'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x59'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x5a'))[_0x0ab0('0x83')](_0x0ab0('0xa3'))[_0x0ab0('0x44')](_0x0ab0('0xa4'))['where'](_0x0ab0('0xa5'),_0x56e3ca[_0x0ab0('0xa2')][_0x0ab0('0x87')]())[_0x0ab0('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x0ab0('0xa8'),squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')]('COALESCE(phone,\x27\x27)')[_0x0ab0('0x83')]('cm_hopper')[_0x0ab0('0x44')](_0x0ab0('0xab'),_0xf7d614['params']['id'][_0x0ab0('0x87')]())))['toString']();break;default:_0xba2445=squel['insert']()[_0x0ab0('0x9b')](_0x0ab0('0x9c'))[_0x0ab0('0x9d')]([_0x0ab0('0x9e'),_0x0ab0('0x9f'),_0x0ab0('0xa0'),_0x0ab0('0xa1'),_0x0ab0('0x63'),_0x0ab0('0x59'),_0x0ab0('0x5a')],squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')](_0x0ab0('0x9e'),_0x0ab0('0x9e'))['field']('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x9f'))[_0x0ab0('0x81')]('id',_0x0ab0('0xa0'))[_0x0ab0('0x81')](_0x56e3ca[_0x0ab0('0xa2')]['toString'](),'ListId')[_0x0ab0('0x81')](_0xf7d614[_0x0ab0('0x4f')]['id'][_0x0ab0('0x87')](),_0x0ab0('0x63'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x59'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x5a'))[_0x0ab0('0x83')](_0x0ab0('0xa3'))['where'](_0x0ab0('0xa4'))['where'](_0x0ab0('0xa5'),_0x56e3ca[_0x0ab0('0xa2')][_0x0ab0('0x87')]())['where'](_0x0ab0('0xa6')))[_0x0ab0('0x87')]();}_0x3cc7ba['push'](db[_0x0ab0('0x72')]['query'](_0xba2445));}return BPromise[_0x0ab0('0x8a')](_0x3cc7ba);}})[_0x0ab0('0x25')](function(){var _0x1cecca=[];var _0x3e68a0=squel[_0x0ab0('0x9a')]()[_0x0ab0('0x9b')](_0x0ab0('0xac'))['fromQuery']([_0x0ab0('0xad'),'phone',_0x0ab0('0xae'),'createdAt',_0x0ab0('0x5a')],squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')](_0x0ab0('0xaf'))[_0x0ab0('0x81')]('ci.item')['field'](_0x0ab0('0xb0'))['field']('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x59'))[_0x0ab0('0x81')]('\x27'+_0x3f0cca+'\x27',_0x0ab0('0x5a'))[_0x0ab0('0x83')](_0x0ab0('0xb1'),'ci')['join'](_0x0ab0('0x9c'),'h',_0x0ab0('0xb2'))[_0x0ab0('0x44')](_0x0ab0('0xb3'),_0x3f0cca)[_0x0ab0('0x44')](_0x0ab0('0xb4'),_0x0ab0('0xb5')))[_0x0ab0('0x87')]();_0x1cecca[_0x0ab0('0xb6')](db[_0x0ab0('0x72')]['query'](_0x3e68a0));return BPromise['all'](_0x1cecca);})['then'](function(){return _0x37ba01;})[_0x0ab0('0x25')](respondWithResult(_0x34f5e6,null))['catch'](handleError(_0x34f5e6,null));};exports[_0x0ab0('0xb7')]=function(_0x3f308a,_0x96bb9a,_0x2c0d2c){return db['VoiceQueue'][_0x0ab0('0x30')]({'where':{'id':_0x3f308a[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x96bb9a,null))[_0x0ab0('0x25')](function(_0xb2b3cf){if(_0xb2b3cf){return _0xb2b3cf[_0x0ab0('0xb7')](_0x3f308a[_0x0ab0('0x3a')][_0x0ab0('0x7e')]);}})[_0x0ab0('0x25')](function(_0x4e6f87){if(_0x4e6f87){return db[_0x0ab0('0x61')][_0x0ab0('0x26')]({'where':{'ListId':_0x3f308a[_0x0ab0('0x3a')]['ids'],'VoiceQueueId':_0x3f308a[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](function(){return _0x4e6f87;});}})[_0x0ab0('0x25')](respondWithStatusCode(_0x96bb9a,null))[_0x0ab0('0x4d')](handleError(_0x96bb9a,null));};exports['getBlackLists']=function(_0x2d3a75,_0x11894d,_0x38232e){var _0x4bee1d={};var _0x3ad22a={};var _0x2aadc1;var _0x554cef;return db[_0x0ab0('0x4b')][_0x0ab0('0x60')]({'where':{'id':_0x2d3a75[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x11894d,null))[_0x0ab0('0x25')](function(_0xb4847c){if(_0xb4847c){_0x2aadc1=_0xb4847c;_0x3ad22a['model']=_[_0x0ab0('0x3b')](db[_0x0ab0('0xb8')]['rawAttributes']);_0x3ad22a[_0x0ab0('0x3a')]=_[_0x0ab0('0x3b')](_0x2d3a75[_0x0ab0('0x3a')]);_0x3ad22a[_0x0ab0('0x3c')]=_[_0x0ab0('0x3e')](_0x3ad22a[_0x0ab0('0x39')],_0x3ad22a[_0x0ab0('0x3a')]);_0x4bee1d[_0x0ab0('0x3d')]=_[_0x0ab0('0x3e')](_0x3ad22a[_0x0ab0('0x39')],qs[_0x0ab0('0x3f')](_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x3f')]));_0x4bee1d[_0x0ab0('0x3d')]=_0x4bee1d['attributes'][_0x0ab0('0x40')]?_0x4bee1d[_0x0ab0('0x3d')]:_0x3ad22a[_0x0ab0('0x39')];_0x4bee1d['order']=qs[_0x0ab0('0x43')](_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x43')]);_0x4bee1d[_0x0ab0('0x44')]=qs['filters'](_['pick'](_0x2d3a75[_0x0ab0('0x3a')],_0x3ad22a['filters']));if(_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x2b')]){_0x4bee1d[_0x0ab0('0x44')]=_[_0x0ab0('0x46')](_0x4bee1d[_0x0ab0('0x44')],{'$or':_[_0x0ab0('0x2c')](_0x4bee1d[_0x0ab0('0x3d')],function(_0xfce89){var _0x35403d={};_0x35403d[_0xfce89]={'$like':'%'+_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x2b')]+'%'};return _0x35403d;})});}_0x4bee1d=_[_0x0ab0('0x46')]({},_0x4bee1d,_0x2d3a75[_0x0ab0('0x48')]);return _0x2aadc1[_0x0ab0('0xb9')](_0x4bee1d);}})[_0x0ab0('0x25')](function(_0x240076){if(_0x240076){_0x554cef=_0x240076[_0x0ab0('0x40')];if(!_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x41')](_0x0ab0('0x62'))){_0x4bee1d[_0x0ab0('0x1f')]=qs[_0x0ab0('0x1f')](_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x1f')]);_0x4bee1d[_0x0ab0('0x1d')]=qs[_0x0ab0('0x1d')](_0x2d3a75[_0x0ab0('0x3a')][_0x0ab0('0x1d')]);}return _0x2aadc1['getBlackLists'](_0x4bee1d);}})[_0x0ab0('0x25')](function(_0xf75581){if(_0xf75581){return _0xf75581?{'count':_0x554cef,'rows':_0xf75581}:null;}})[_0x0ab0('0x25')](respondWithResult(_0x11894d,null))[_0x0ab0('0x4d')](handleError(_0x11894d,null));};exports[_0x0ab0('0xba')]=function(_0x20c79a,_0x4895e4,_0x4a5076){var _0x389c09,_0x2a20b5;return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0x20c79a[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x4895e4,null))['then'](function(_0x13043f){if(_0x13043f){_0x2a20b5=_0x13043f;return _0x13043f['addBlackLists'](_0x20c79a['body'][_0x0ab0('0x7e')],_[_0x0ab0('0x58')](_0x20c79a[_0x0ab0('0x5b')],[_0x0ab0('0x7e'),'id'])||{});}return null;})[_0x0ab0('0x8f')](function(_0x51f82c){var _0xdd637a;_0x389c09=_0x51f82c||[];var _0x290faf=[];if(_0x51f82c){for(var _0x4ca25c=0x0;_0x4ca25c<_0x51f82c[_0x0ab0('0x40')];_0x4ca25c+=0x1){var _0x5f4ffe=_0x51f82c[_0x4ca25c][_0x0ab0('0x27')]({'plain':!![]});_0xdd637a=squel[_0x0ab0('0x9a')]()['into'](_0x0ab0('0xbb'))[_0x0ab0('0x9d')](['phone',_0x0ab0('0xa0'),'ListId',_0x0ab0('0x63'),_0x0ab0('0x59'),_0x0ab0('0x5a')],squel[_0x0ab0('0x80')]()[_0x0ab0('0x81')](_0x0ab0('0x9e'),_0x0ab0('0x9e'))['field']('id',_0x0ab0('0xa0'))[_0x0ab0('0x81')](_0x5f4ffe['CmListId'][_0x0ab0('0x87')](),'ListId')['field'](_0x20c79a[_0x0ab0('0x4f')]['id'][_0x0ab0('0x87')](),'VoiceQueueId')[_0x0ab0('0x81')](_0x0ab0('0xbc'),'createdAt')[_0x0ab0('0x81')]('NOW()',_0x0ab0('0x5a'))[_0x0ab0('0x83')](_0x0ab0('0xa3'))['where'](_0x0ab0('0xa4'))[_0x0ab0('0x44')]('ListId\x20=\x20?',_0x5f4ffe[_0x0ab0('0xa2')][_0x0ab0('0x87')]())[_0x0ab0('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x0ab0('0x87')]();_0x290faf['push'](db[_0x0ab0('0x72')][_0x0ab0('0x3a')](_0xdd637a));}return BPromise[_0x0ab0('0x8a')](_0x290faf);}})[_0x0ab0('0x25')](function(){return _0x389c09;})['then'](respondWithResult(_0x4895e4,null))['catch'](handleError(_0x4895e4,null));};exports['removeBlackLists']=function(_0x39f64c,_0x49dd3e,_0x2a2d70){return db[_0x0ab0('0x4b')][_0x0ab0('0x30')]({'where':{'id':_0x39f64c[_0x0ab0('0x4f')]['id']}})[_0x0ab0('0x25')](handleEntityNotFound(_0x49dd3e,null))[_0x0ab0('0x25')](function(_0x3c2563){if(_0x3c2563){return _0x3c2563[_0x0ab0('0xbd')](_0x39f64c[_0x0ab0('0x3a')][_0x0ab0('0x7e')]);}})['then'](function(_0x4aee59){if(_0x4aee59){return db[_0x0ab0('0x69')][_0x0ab0('0x26')]({'where':{'ListId':_0x39f64c[_0x0ab0('0x3a')][_0x0ab0('0x7e')],'VoiceQueueId':_0x39f64c['params']['id']}})[_0x0ab0('0x25')](function(){return _0x4aee59;});}})[_0x0ab0('0x25')](respondWithStatusCode(_0x49dd3e,null))[_0x0ab0('0x4d')](handleError(_0x49dd3e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ea6b005..2ffb4ad 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 _0x0715=['emit','hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x33a1d2,_0x429c58){var _0x5a7178=function(_0x6214ad){while(--_0x6214ad){_0x33a1d2['push'](_0x33a1d2['shift']());}};_0x5a7178(++_0x429c58);}(_0x0715,0xdb));var _0x5071=function(_0x44a6fc,_0x328afe){_0x44a6fc=_0x44a6fc-0x0;var _0x15eae8=_0x0715[_0x44a6fc];return _0x15eae8;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x5071('0x0'))['db'][_0x5071('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5071('0x2')](0x0);var events={'afterCreate':_0x5071('0x3'),'afterUpdate':_0x5071('0x4'),'afterDestroy':_0x5071('0x5')};function emitEvent(_0x1f0f74){return function(_0x304547,_0x438e05,_0x3948ed){VoiceQueueEvents[_0x5071('0x6')](_0x1f0f74+':'+_0x304547['id'],_0x304547);VoiceQueueEvents[_0x5071('0x6')](_0x1f0f74,_0x304547);_0x3948ed(null);};}for(var e in events){if(events[_0x5071('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x5071('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x357b=['VoiceQueue','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x48ebaf,_0x20750d){var _0x534111=function(_0xe2d1f5){while(--_0xe2d1f5){_0x48ebaf['push'](_0x48ebaf['shift']());}};_0x534111(++_0x20750d);}(_0x357b,0x154));var _0xb357=function(_0x44f6f2,_0x2c5b0a){_0x44f6f2=_0x44f6f2-0x0;var _0x1b51ff=_0x357b[_0x44f6f2];return _0x1b51ff;};'use strict';var EventEmitter=require(_0xb357('0x0'));var VoiceQueue=require(_0xb357('0x1'))['db'][_0xb357('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb357('0x3'),'afterUpdate':_0xb357('0x4'),'afterDestroy':_0xb357('0x5')};function emitEvent(_0x2b9bdd){return function(_0x398f77,_0x4c3332,_0x54ed1a){VoiceQueueEvents[_0xb357('0x6')](_0x2b9bdd+':'+_0x398f77['id'],_0x398f77);VoiceQueueEvents[_0xb357('0x6')](_0x2b9bdd,_0x398f77);_0x54ed1a(null);};}for(var e in events){if(events[_0xb357('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xb357('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 665876e..cb15373 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x3e74,0x175));var _0x43e7=function(_0x4ba0f7,_0xc9dffb){_0x4ba0f7=_0x4ba0f7-0x0;var _0x129148=_0x3e74[_0x4ba0f7];return _0x129148;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0x008c,0x188));var _0xc008=function(_0x56b886,_0x1ff474){_0x56b886=_0x56b886-0x0;var _0x164baf=_0x008c[_0x56b886];return _0x164baf;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 9e71f92..a2fbcae 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 _0x64a3=['message','info','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d3825,_0x1b465b){var _0x4be92c=function(_0x2a6a72){while(--_0x2a6a72){_0x2d3825['push'](_0x2d3825['shift']());}};_0x4be92c(++_0x1b465b);}(_0x64a3,0xda));var _0x364a=function(_0x22bb68,_0x5591d5){_0x22bb68=_0x22bb68-0x0;var _0x245e51=_0x64a3[_0x22bb68];return _0x245e51;};'use strict';var _=require(_0x364a('0x0'));var util=require(_0x364a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x364a('0x2'));var fs=require('fs');var Redis=require(_0x364a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x364a('0x4'))(_0x364a('0x5'));var config=require('../../config/environment');var jayson=require(_0x364a('0x6'));var client=jayson[_0x364a('0x7')]['http']({'port':0x232a});config[_0x364a('0x8')]=_[_0x364a('0x9')](config['redis'],{'host':_0x364a('0xa'),'port':0x18eb});var socket=require(_0x364a('0xb'))(new Redis(config[_0x364a('0x8')]));require(_0x364a('0xc'))['register'](socket);function respondWithRpcPromise(_0x26a0fd,_0x109147,_0x4081da){return new BPromise(function(_0x4bba80,_0x6f07e1){return client['request'](_0x26a0fd,_0x4081da)[_0x364a('0xd')](function(_0x3cc04d){logger['info'](_0x364a('0xe'),_0x109147,'request\x20sent');logger[_0x364a('0xf')](_0x364a('0x10'),_0x109147,_0x364a('0x11'),JSON[_0x364a('0x12')](_0x3cc04d));if(_0x3cc04d[_0x364a('0x13')]){if(_0x3cc04d[_0x364a('0x13')]['code']===0x1f4){logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);return _0x6f07e1(_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);}logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x3cc04d['error']['message']);return _0x4bba80(_0x3cc04d[_0x364a('0x13')][_0x364a('0x14')]);}else{logger[_0x364a('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x109147,'request\x20sent');_0x4bba80(_0x3cc04d[_0x364a('0x16')][_0x364a('0x14')]);}})[_0x364a('0x17')](function(_0x365918){logger[_0x364a('0x13')](_0x364a('0xe'),_0x109147,_0x365918);_0x6f07e1(_0x365918);});});}exports[_0x364a('0x18')]=function(_0x5dece1){var _0x4e7477=this;return new Promise(function(_0x1343c0,_0x2ce8bc){return db[_0x364a('0x19')]['findAll']({'raw':_0x5dece1[_0x364a('0x1a')]?_0x5dece1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5dece1[_0x364a('0x1a')]?_0x5dece1[_0x364a('0x1a')][_0x364a('0x1b')]||null:null,'attributes':_0x5dece1[_0x364a('0x1a')]?_0x5dece1['options'][_0x364a('0x1c')]||null:null,'limit':_0x5dece1[_0x364a('0x1a')]?_0x5dece1[_0x364a('0x1a')]['limit']||null:null,'include':_0x5dece1['options']?_0x5dece1['options'][_0x364a('0x1d')]?_[_0x364a('0x1e')](_0x5dece1[_0x364a('0x1a')][_0x364a('0x1d')],function(_0x205730){return{'model':db[_0x205730['model']],'as':_0x205730['as'],'attributes':_0x205730[_0x364a('0x1c')],'include':_0x205730[_0x364a('0x1d')]?_[_0x364a('0x1e')](_0x205730[_0x364a('0x1d')],function(_0x383b09){return{'model':db[_0x383b09[_0x364a('0x1f')]],'as':_0x383b09['as'],'attributes':_0x383b09['attributes'],'include':_0x383b09[_0x364a('0x1d')]?_['map'](_0x383b09[_0x364a('0x1d')],function(_0x30d280){return{'model':db[_0x30d280[_0x364a('0x1f')]],'as':_0x30d280['as'],'attributes':_0x30d280[_0x364a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x364a('0xd')](function(_0x755fc3){logger[_0x364a('0x15')](_0x364a('0x18'),_0x5dece1);logger[_0x364a('0xf')](_0x364a('0x18'),_0x5dece1,JSON[_0x364a('0x12')](_0x755fc3));_0x1343c0(_0x755fc3);})[_0x364a('0x17')](function(_0x271cc2){logger['error'](_0x364a('0x18'),_0x271cc2[_0x364a('0x14')],_0x5dece1);_0x2ce8bc(_0x4e7477['error'](0x1f4,_0x271cc2['message']));});});};exports[_0x364a('0x20')]=function(_0xaace10){var _0x4256b2=this;return new Promise(function(_0x5cf3e3,_0x5527f7){return db[_0x364a('0x19')][_0x364a('0x21')]({'raw':_0xaace10[_0x364a('0x1a')]?_0xaace10[_0x364a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xaace10['options']?_0xaace10[_0x364a('0x1a')][_0x364a('0x1b')]||null:null,'attributes':_0xaace10[_0x364a('0x1a')]?_0xaace10[_0x364a('0x1a')][_0x364a('0x1c')]||null:null,'include':_0xaace10['options']?_0xaace10[_0x364a('0x1a')][_0x364a('0x1d')]?_[_0x364a('0x1e')](_0xaace10[_0x364a('0x1a')][_0x364a('0x1d')],function(_0x9019ae){return{'model':db[_0x9019ae[_0x364a('0x1f')]],'as':_0x9019ae['as'],'attributes':_0x9019ae[_0x364a('0x1c')],'include':_0x9019ae[_0x364a('0x1d')]?_['map'](_0x9019ae[_0x364a('0x1d')],function(_0x3ec9f3){return{'model':db[_0x3ec9f3['model']],'as':_0x3ec9f3['as'],'attributes':_0x3ec9f3['attributes'],'include':_0x3ec9f3['include']?_[_0x364a('0x1e')](_0x3ec9f3[_0x364a('0x1d')],function(_0x2143f7){return{'model':db[_0x2143f7[_0x364a('0x1f')]],'as':_0x2143f7['as'],'attributes':_0x2143f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x364a('0xd')](function(_0x4131cf){logger['info'](_0x364a('0x20'),_0xaace10);logger['debug'](_0x364a('0x20'),_0xaace10,JSON['stringify'](_0x4131cf));_0x5cf3e3(_0x4131cf);})['catch'](function(_0x2240be){logger[_0x364a('0x13')](_0x364a('0x20'),_0x2240be[_0x364a('0x14')],_0xaace10);_0x5527f7(_0x4256b2[_0x364a('0x13')](0x1f4,_0x2240be['message']));});});}; \ No newline at end of file +var _0xdc75=['./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetVoiceQueue','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','VoiceQueue','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x339d29,_0x1f93ce){var _0x30cb9f=function(_0x548492){while(--_0x548492){_0x339d29['push'](_0x339d29['shift']());}};_0x30cb9f(++_0x1f93ce);}(_0xdc75,0xc6));var _0x5dc7=function(_0x575153,_0x2f7733){_0x575153=_0x575153-0x0;var _0x11a4e=_0xdc75[_0x575153];return _0x11a4e;};'use strict';var _=require('lodash');var util=require(_0x5dc7('0x0'));var moment=require(_0x5dc7('0x1'));var BPromise=require(_0x5dc7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5dc7('0x3'))(_0x5dc7('0x4'));var config=require(_0x5dc7('0x5'));var jayson=require(_0x5dc7('0x6'));var client=jayson[_0x5dc7('0x7')][_0x5dc7('0x8')]({'port':0x232a});config[_0x5dc7('0x9')]=_['defaults'](config[_0x5dc7('0x9')],{'host':_0x5dc7('0xa'),'port':0x18eb});var socket=require(_0x5dc7('0xb'))(new Redis(config[_0x5dc7('0x9')]));require(_0x5dc7('0xc'))[_0x5dc7('0xd')](socket);function respondWithRpcPromise(_0x8fcde6,_0x3463a4,_0x16eb59){return new BPromise(function(_0x505189,_0x3740c3){return client[_0x5dc7('0xe')](_0x8fcde6,_0x16eb59)['then'](function(_0x4a180b){logger[_0x5dc7('0xf')](_0x5dc7('0x10'),_0x3463a4,'request\x20sent');logger[_0x5dc7('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3463a4,_0x5dc7('0x12'),JSON[_0x5dc7('0x13')](_0x4a180b));if(_0x4a180b[_0x5dc7('0x14')]){if(_0x4a180b[_0x5dc7('0x14')][_0x5dc7('0x15')]===0x1f4){logger[_0x5dc7('0x14')](_0x5dc7('0x10'),_0x3463a4,_0x4a180b[_0x5dc7('0x14')][_0x5dc7('0x16')]);return _0x3740c3(_0x4a180b['error'][_0x5dc7('0x16')]);}logger[_0x5dc7('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3463a4,_0x4a180b[_0x5dc7('0x14')][_0x5dc7('0x16')]);return _0x505189(_0x4a180b[_0x5dc7('0x14')][_0x5dc7('0x16')]);}else{logger[_0x5dc7('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x3463a4,_0x5dc7('0x12'));_0x505189(_0x4a180b['result']['message']);}})[_0x5dc7('0x17')](function(_0x2342aa){logger[_0x5dc7('0x14')](_0x5dc7('0x10'),_0x3463a4,_0x2342aa);_0x3740c3(_0x2342aa);});});}exports[_0x5dc7('0x18')]=function(_0x3a3b9a){var _0x47d5a5=this;return new Promise(function(_0x1c27af,_0x53b78f){return db['VoiceQueue'][_0x5dc7('0x19')]({'raw':_0x3a3b9a[_0x5dc7('0x1a')]?_0x3a3b9a[_0x5dc7('0x1a')][_0x5dc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a3b9a['options']?_0x3a3b9a['options'][_0x5dc7('0x1c')]||null:null,'attributes':_0x3a3b9a[_0x5dc7('0x1a')]?_0x3a3b9a[_0x5dc7('0x1a')][_0x5dc7('0x1d')]||null:null,'limit':_0x3a3b9a[_0x5dc7('0x1a')]?_0x3a3b9a['options']['limit']||null:null,'include':_0x3a3b9a[_0x5dc7('0x1a')]?_0x3a3b9a['options'][_0x5dc7('0x1e')]?_[_0x5dc7('0x1f')](_0x3a3b9a[_0x5dc7('0x1a')][_0x5dc7('0x1e')],function(_0x3d4fe0){return{'model':db[_0x3d4fe0['model']],'as':_0x3d4fe0['as'],'attributes':_0x3d4fe0[_0x5dc7('0x1d')],'include':_0x3d4fe0[_0x5dc7('0x1e')]?_['map'](_0x3d4fe0[_0x5dc7('0x1e')],function(_0x4786bb){return{'model':db[_0x4786bb[_0x5dc7('0x20')]],'as':_0x4786bb['as'],'attributes':_0x4786bb[_0x5dc7('0x1d')],'include':_0x4786bb['include']?_[_0x5dc7('0x1f')](_0x4786bb[_0x5dc7('0x1e')],function(_0x4c2966){return{'model':db[_0x4c2966[_0x5dc7('0x20')]],'as':_0x4c2966['as'],'attributes':_0x4c2966[_0x5dc7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e14f3){logger[_0x5dc7('0xf')](_0x5dc7('0x18'),_0x3a3b9a);logger[_0x5dc7('0x11')](_0x5dc7('0x18'),_0x3a3b9a,JSON[_0x5dc7('0x13')](_0x3e14f3));_0x1c27af(_0x3e14f3);})['catch'](function(_0xa6463b){logger[_0x5dc7('0x14')](_0x5dc7('0x18'),_0xa6463b[_0x5dc7('0x16')],_0x3a3b9a);_0x53b78f(_0x47d5a5[_0x5dc7('0x14')](0x1f4,_0xa6463b['message']));});});};exports[_0x5dc7('0x21')]=function(_0x5e1b0a){var _0x269da0=this;return new Promise(function(_0x1c6a04,_0x15102d){return db[_0x5dc7('0x22')]['find']({'raw':_0x5e1b0a[_0x5dc7('0x1a')]?_0x5e1b0a[_0x5dc7('0x1a')][_0x5dc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e1b0a[_0x5dc7('0x1a')]?_0x5e1b0a[_0x5dc7('0x1a')][_0x5dc7('0x1c')]||null:null,'attributes':_0x5e1b0a['options']?_0x5e1b0a[_0x5dc7('0x1a')]['attributes']||null:null,'include':_0x5e1b0a[_0x5dc7('0x1a')]?_0x5e1b0a['options'][_0x5dc7('0x1e')]?_[_0x5dc7('0x1f')](_0x5e1b0a[_0x5dc7('0x1a')][_0x5dc7('0x1e')],function(_0x3664fd){return{'model':db[_0x3664fd[_0x5dc7('0x20')]],'as':_0x3664fd['as'],'attributes':_0x3664fd[_0x5dc7('0x1d')],'include':_0x3664fd['include']?_[_0x5dc7('0x1f')](_0x3664fd['include'],function(_0x180c89){return{'model':db[_0x180c89[_0x5dc7('0x20')]],'as':_0x180c89['as'],'attributes':_0x180c89[_0x5dc7('0x1d')],'include':_0x180c89[_0x5dc7('0x1e')]?_[_0x5dc7('0x1f')](_0x180c89[_0x5dc7('0x1e')],function(_0x2f7254){return{'model':db[_0x2f7254[_0x5dc7('0x20')]],'as':_0x2f7254['as'],'attributes':_0x2f7254['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x551694){logger[_0x5dc7('0xf')](_0x5dc7('0x21'),_0x5e1b0a);logger[_0x5dc7('0x11')](_0x5dc7('0x21'),_0x5e1b0a,JSON[_0x5dc7('0x13')](_0x551694));_0x1c6a04(_0x551694);})[_0x5dc7('0x17')](function(_0x5a1fff){logger[_0x5dc7('0x14')](_0x5dc7('0x21'),_0x5a1fff[_0x5dc7('0x16')],_0x5e1b0a);_0x15102d(_0x269da0['error'](0x1f4,_0x5a1fff[_0x5dc7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bb3b574..e6f5c7d 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 _0xc4db=['length','voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register'];(function(_0x58e6e7,_0x45812f){var _0x6ca7f=function(_0x28bf9e){while(--_0x28bf9e){_0x58e6e7['push'](_0x58e6e7['shift']());}};_0x6ca7f(++_0x45812f);}(_0xc4db,0x72));var _0xbc4d=function(_0x5508d9,_0x2a6dcc){_0x5508d9=_0x5508d9-0x0;var _0x2dada6=_0xc4db[_0x5508d9];return _0x2dada6;};'use strict';var VoiceQueueEvents=require(_0xbc4d('0x0'));var events=['save',_0xbc4d('0x1'),_0xbc4d('0x2')];function createListener(_0x2e669e,_0x14648a){return function(_0x28a894){_0x14648a[_0xbc4d('0x3')](_0x2e669e,_0x28a894);};}function removeListener(_0x2d6b9c,_0x27e926){return function(){VoiceQueueEvents[_0xbc4d('0x4')](_0x2d6b9c,_0x27e926);};}exports[_0xbc4d('0x5')]=function(_0x88e979){for(var _0x3d3372=0x0,_0x40990f=events[_0xbc4d('0x6')];_0x3d3372<_0x40990f;_0x3d3372++){var _0x3eb765=events[_0x3d3372];var _0x4c1105=createListener(_0xbc4d('0x7')+_0x3eb765,_0x88e979);VoiceQueueEvents['on'](_0x3eb765,_0x4c1105);}}; \ No newline at end of file +var _0xa5bb=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa5bb,0x14d));var _0xba5b=function(_0x3b1bb0,_0x24c6b0){_0x3b1bb0=_0x3b1bb0-0x0;var _0x23ea7f=_0xa5bb[_0x3b1bb0];return _0x23ea7f;};'use strict';var VoiceQueueEvents=require(_0xba5b('0x0'));var events=[_0xba5b('0x1'),_0xba5b('0x2'),'update'];function createListener(_0x3f9b96,_0x144ae9){return function(_0x2aefb1){_0x144ae9['emit'](_0x3f9b96,_0x2aefb1);};}function removeListener(_0x292f07,_0x368250){return function(){VoiceQueueEvents[_0xba5b('0x3')](_0x292f07,_0x368250);};}exports[_0xba5b('0x4')]=function(_0x489c58){for(var _0x9c938b=0x0,_0x3347dd=events[_0xba5b('0x5')];_0x9c938b<_0x3347dd;_0x9c938b++){var _0x4ed917=events[_0x9c938b];var _0x4b7248=createListener(_0xba5b('0x6')+_0x4ed917,_0x489c58);VoiceQueueEvents['on'](_0x4ed917,_0x4b7248);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 0fd92f8..fdb28b1 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 _0xe157=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','/index','getVoiceQueuesReport','show','post','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x404174,_0x5624ea){var _0x1783ce=function(_0x245377){while(--_0x245377){_0x404174['push'](_0x404174['shift']());}};_0x1783ce(++_0x5624ea);}(_0xe157,0x127));var _0x7e15=function(_0x1e76f4,_0x522772){_0x1e76f4=_0x1e76f4-0x0;var _0x4170e8=_0xe157[_0x1e76f4];return _0x4170e8;};'use strict';var multer=require('multer');var util=require(_0x7e15('0x0'));var path=require(_0x7e15('0x1'));var timeout=require(_0x7e15('0x2'));var express=require(_0x7e15('0x3'));var router=express[_0x7e15('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e15('0x6'));var controller=require(_0x7e15('0x7'));router[_0x7e15('0x8')]('/',auth[_0x7e15('0x9')](),controller['index']);router[_0x7e15('0x8')](_0x7e15('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7e15('0x8')](_0x7e15('0xb'),auth['isAuthenticated'](),controller[_0x7e15('0xc')]);router[_0x7e15('0x8')]('/:id',auth[_0x7e15('0x9')](),controller[_0x7e15('0xd')]);router[_0x7e15('0xe')]('/',auth[_0x7e15('0x9')](),controller['create']);router[_0x7e15('0xf')](_0x7e15('0x10'),auth[_0x7e15('0x9')](),controller[_0x7e15('0x11')]);router[_0x7e15('0x12')]('/:id',auth[_0x7e15('0x9')](),controller['destroy']);module[_0x7e15('0x13')]=router; \ No newline at end of file +var _0x88c9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','util','path'];(function(_0x24a654,_0x2ca441){var _0x458651=function(_0x1ecda1){while(--_0x1ecda1){_0x24a654['push'](_0x24a654['shift']());}};_0x458651(++_0x2ca441);}(_0x88c9,0x11c));var _0x988c=function(_0x340d25,_0x4a8c49){_0x340d25=_0x340d25-0x0;var _0x2f36da=_0x88c9[_0x340d25];return _0x2f36da;};'use strict';var multer=require('multer');var util=require(_0x988c('0x0'));var path=require(_0x988c('0x1'));var timeout=require(_0x988c('0x2'));var express=require('express');var router=express[_0x988c('0x3')]();var fs_extra=require(_0x988c('0x4'));var auth=require(_0x988c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x988c('0x6'));var controller=require(_0x988c('0x7'));router['get']('/',auth[_0x988c('0x8')](),controller[_0x988c('0x9')]);router[_0x988c('0xa')](_0x988c('0xb'),auth[_0x988c('0x8')](),controller[_0x988c('0xc')]);router[_0x988c('0xa')]('/index',auth[_0x988c('0x8')](),controller[_0x988c('0xd')]);router[_0x988c('0xa')]('/:id',auth[_0x988c('0x8')](),controller[_0x988c('0xe')]);router[_0x988c('0xf')]('/',auth[_0x988c('0x8')](),controller[_0x988c('0x10')]);router[_0x988c('0x11')](_0x988c('0x12'),auth[_0x988c('0x8')](),controller[_0x988c('0x13')]);router[_0x988c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x988c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 8616fa3..e1f35d6 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 _0x3921=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','sequelize','moment','exports','STRING','DATE'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3921,0x8a));var _0x1392=function(_0xdc105a,_0xfa41ba){_0xdc105a=_0xdc105a-0x0;var _0x1bca1e=_0x3921[_0xdc105a];return _0x1bca1e;};'use strict';var Sequelize=require(_0x1392('0x0'));var moment=require(_0x1392('0x1'));module[_0x1392('0x2')]={'type':{'type':Sequelize[_0x1392('0x3')]},'uniqueid':{'type':Sequelize[_0x1392('0x3')]},'calleridnum':{'type':Sequelize[_0x1392('0x3')]},'calleridname':{'type':Sequelize[_0x1392('0x3')]},'queue':{'type':Sequelize[_0x1392('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1392('0x4')],'set':function(_0x12fb00){var _0x3ee815=moment(_0x12fb00);var _0x15d2db=moment(this[_0x1392('0x5')](_0x1392('0x6')))[_0x1392('0x7')](_0x1392('0x8'));var _0x33cd05=_0x3ee815['diff'](_0x15d2db,'seconds');this[_0x1392('0x9')]('queuecallerleaveAt',_0x12fb00);this[_0x1392('0x9')]('holdtime',_0x33cd05||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1392('0x4')]},'queuecallerexit':{'type':Sequelize[_0x1392('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x1392('0x3')],'comment':_0x1392('0xb')},'originalposition':{'type':Sequelize[_0x1392('0xc')]},'channel':{'type':Sequelize[_0x1392('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1392('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1392('0x3')]},'exten':{'type':Sequelize[_0x1392('0x3')]},'priority':{'type':Sequelize[_0x1392('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1392('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1392('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1392('0x3')]},'transferuniqueid':{'type':Sequelize[_0x1392('0x3')]},'disposition':{'type':Sequelize[_0x1392('0x3')]},'secondDisposition':{'type':Sequelize[_0x1392('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1392('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1392('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1392('0x3')]}}; \ No newline at end of file +var _0x8d08=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','DATE','getDataValue','diff','seconds','setDataValue'];(function(_0x3338ed,_0x179eea){var _0x40f1b1=function(_0x3e0ccf){while(--_0x3e0ccf){_0x3338ed['push'](_0x3338ed['shift']());}};_0x40f1b1(++_0x179eea);}(_0x8d08,0x19d));var _0x88d0=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x8d08[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x88d0('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x88d0('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x88d0('0x1')]},'calleridname':{'type':Sequelize[_0x88d0('0x1')]},'queue':{'type':Sequelize[_0x88d0('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x88d0('0x2')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x37b410){var _0x15d04b=moment(_0x37b410);var _0xa85e76=moment(this[_0x88d0('0x3')]('queuecallerjoinAt'))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1ea7ce=_0x15d04b[_0x88d0('0x4')](_0xa85e76,_0x88d0('0x5'));this[_0x88d0('0x6')](_0x88d0('0x7'),_0x37b410);this[_0x88d0('0x6')](_0x88d0('0x8'),_0x1ea7ce||null);}},'position':{'type':Sequelize[_0x88d0('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x88d0('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x88d0('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x88d0('0x2')]},'queuecallerexit':{'type':Sequelize[_0x88d0('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x88d0('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x88d0('0xb')},'originalposition':{'type':Sequelize[_0x88d0('0x9')]},'channel':{'type':Sequelize[_0x88d0('0x1')]},'connectedlinenum':{'type':Sequelize[_0x88d0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x88d0('0x1')]},'context':{'type':Sequelize[_0x88d0('0x1')]},'exten':{'type':Sequelize[_0x88d0('0x1')]},'priority':{'type':Sequelize[_0x88d0('0x1')]},'holdtime':{'type':Sequelize[_0x88d0('0x9')]},'mohtime':{'type':Sequelize[_0x88d0('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x88d0('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x88d0('0x1')]},'transfer':{'type':Sequelize[_0x88d0('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x88d0('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x88d0('0x1')]},'transferuniqueid':{'type':Sequelize[_0x88d0('0x1')]},'disposition':{'type':Sequelize[_0x88d0('0x1')]},'secondDisposition':{'type':Sequelize[_0x88d0('0x1')]},'thirdDisposition':{'type':Sequelize[_0x88d0('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x88d0('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x88d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0e7e726..9c88754 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 _0x9ede=['intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','update','find','describe','getVoiceQueuesReport','order','rows','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','keys','query','filters'];(function(_0xc92184,_0x5b0687){var _0x5d98ef=function(_0x5673ea){while(--_0x5673ea){_0xc92184['push'](_0xc92184['shift']());}};_0x5d98ef(++_0x5b0687);}(_0x9ede,0x1f4));var _0xe9ed=function(_0x62650c,_0x1e481b){_0x62650c=_0x62650c-0x0;var _0x1668ca=_0x9ede[_0x62650c];return _0x1668ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe9ed('0x0'));var jsonpatch=require(_0xe9ed('0x1'));var rp=require(_0xe9ed('0x2'));var moment=require(_0xe9ed('0x3'));var BPromise=require(_0xe9ed('0x4'));var Mustache=require(_0xe9ed('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe9ed('0x6'));var ejs=require(_0xe9ed('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9ed('0x8'));var squel=require(_0xe9ed('0x9'));var crypto=require(_0xe9ed('0xa'));var jsforce=require(_0xe9ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe9ed('0x6'));var querystring=require(_0xe9ed('0xc'));var Papa=require(_0xe9ed('0xd'));var Redis=require(_0xe9ed('0xe'));var authService=require(_0xe9ed('0xf'));var qs=require(_0xe9ed('0x10'));var as=require(_0xe9ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9ed('0x12'))('api');var utils=require(_0xe9ed('0x13'));var config=require(_0xe9ed('0x14'));var licenseUtil=require(_0xe9ed('0x15'));var db=require(_0xe9ed('0x16'))['db'];config[_0xe9ed('0x17')]=_['defaults'](config['redis'],{'host':_0xe9ed('0x18'),'port':0x18eb});var socket=require(_0xe9ed('0x19'))(new Redis(config[_0xe9ed('0x17')]));require(_0xe9ed('0x1a'))[_0xe9ed('0x1b')](socket);function respondWithStatusCode(_0xe51317,_0x49fdc4){_0x49fdc4=_0x49fdc4||0xcc;return function(_0x18fb1a){if(_0x18fb1a){return _0xe51317['sendStatus'](_0x49fdc4);}return _0xe51317[_0xe9ed('0x1c')](_0x49fdc4)[_0xe9ed('0x1d')]();};}function respondWithResult(_0x4ba9b4,_0x2e7e34){_0x2e7e34=_0x2e7e34||0xc8;return function(_0x1a6e9e){if(_0x1a6e9e){return _0x4ba9b4[_0xe9ed('0x1c')](_0x2e7e34)['json'](_0x1a6e9e);}};}function respondWithFilteredResult(_0x5040cf,_0x577ba2){return function(_0x3644e3){if(_0x3644e3){var _0x166032=typeof _0x577ba2[_0xe9ed('0x1e')]===_0xe9ed('0x1f')&&typeof _0x577ba2[_0xe9ed('0x20')]===_0xe9ed('0x1f');var _0x2f5332=_0x3644e3[_0xe9ed('0x21')];var _0x253270=_0x166032?0x0:_0x577ba2[_0xe9ed('0x1e')];var _0x45ed44=_0x166032?_0x3644e3['count']:_0x577ba2[_0xe9ed('0x1e')]+_0x577ba2[_0xe9ed('0x20')];var _0x6afaa3;if(_0x45ed44>=_0x2f5332){_0x45ed44=_0x2f5332;_0x6afaa3=0xc8;}else{_0x6afaa3=0xce;}_0x5040cf[_0xe9ed('0x1c')](_0x6afaa3);return _0x5040cf[_0xe9ed('0x22')](_0xe9ed('0x23'),_0x253270+'-'+_0x45ed44+'/'+_0x2f5332)['json'](_0x3644e3);}return null;};}function patchUpdates(_0x5a2eb9){return function(_0x489259){try{jsonpatch['apply'](_0x489259,_0x5a2eb9,!![]);}catch(_0x10fb68){return BPromise['reject'](_0x10fb68);}return _0x489259[_0xe9ed('0x24')]();};}function saveUpdates(_0x56aec2,_0xd74de2){return function(_0x25c492){if(_0x25c492){return _0x25c492['update'](_0x56aec2)[_0xe9ed('0x25')](function(_0x40bfaf){return _0x40bfaf;});}return null;};}function removeEntity(_0xfed229,_0x518beb){return function(_0x1abedc){if(_0x1abedc){return _0x1abedc[_0xe9ed('0x26')]()['then'](function(){_0xfed229[_0xe9ed('0x1c')](0xcc)[_0xe9ed('0x1d')]();});}};}function handleEntityNotFound(_0x475084,_0x55eed6){return function(_0x13fc85){if(!_0x13fc85){_0x475084[_0xe9ed('0x27')](0x194);}return _0x13fc85;};}function handleError(_0x208044,_0x392539){_0x392539=_0x392539||0x1f4;return function(_0x384418){logger[_0xe9ed('0x28')](_0x384418[_0xe9ed('0x29')]);if(_0x384418[_0xe9ed('0x2a')]){delete _0x384418[_0xe9ed('0x2a')];}_0x208044['status'](_0x392539)['send'](_0x384418);};}exports[_0xe9ed('0x2b')]=function(_0x15ecd1,_0x4203b2){var _0xf474dc={},_0x117b7c={},_0x1684a4={'count':0x0,'rows':[]};var _0x136b3d=_[_0xe9ed('0x2c')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')],function(_0x60af32){return{'name':_0x60af32[_0xe9ed('0x2f')],'type':_0x60af32[_0xe9ed('0x30')][_0xe9ed('0x31')]};});_0x117b7c['model']=_[_0xe9ed('0x2c')](_0x136b3d,'name');_0x117b7c['query']=_[_0xe9ed('0x32')](_0x15ecd1[_0xe9ed('0x33')]);_0x117b7c[_0xe9ed('0x34')]=_[_0xe9ed('0x35')](_0x117b7c[_0xe9ed('0x36')],_0x117b7c[_0xe9ed('0x33')]);_0xf474dc[_0xe9ed('0x37')]=_[_0xe9ed('0x35')](_0x117b7c[_0xe9ed('0x36')],qs[_0xe9ed('0x38')](_0x15ecd1['query']['fields']));_0xf474dc[_0xe9ed('0x37')]=_0xf474dc['attributes'][_0xe9ed('0x39')]?_0xf474dc['attributes']:_0x117b7c[_0xe9ed('0x36')];if(!_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3a')]('nolimit')){_0xf474dc[_0xe9ed('0x20')]=qs[_0xe9ed('0x20')](_0x15ecd1[_0xe9ed('0x33')]['limit']);_0xf474dc['offset']=qs[_0xe9ed('0x1e')](_0x15ecd1['query'][_0xe9ed('0x1e')]);}_0xf474dc['order']=qs[_0xe9ed('0x3b')](_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3b')]);_0xf474dc[_0xe9ed('0x3c')]=qs[_0xe9ed('0x34')](_[_0xe9ed('0x3d')](_0x15ecd1[_0xe9ed('0x33')],_0x117b7c[_0xe9ed('0x34')]),_0x136b3d);if(_0x15ecd1[_0xe9ed('0x33')][_0xe9ed('0x3e')]){_0xf474dc[_0xe9ed('0x3c')]=_[_0xe9ed('0x3f')](_0xf474dc[_0xe9ed('0x3c')],{'$or':_[_0xe9ed('0x2c')](_0x136b3d,function(_0x45ade3){if(_0x45ade3[_0xe9ed('0x30')]!=='VIRTUAL'){var _0x3124c5={};_0x3124c5[_0x45ade3[_0xe9ed('0x2a')]]={'$like':'%'+_0x15ecd1[_0xe9ed('0x33')]['filter']+'%'};return _0x3124c5;}})});}_0xf474dc=_['merge']({},_0xf474dc,_0x15ecd1[_0xe9ed('0x40')]);var _0xf3222={'where':_0xf474dc[_0xe9ed('0x3c')]};return db['VoiceQueueReport']['count'](_0xf3222)[_0xe9ed('0x25')](function(_0x470374){_0x1684a4['count']=_0x470374;if(_0x15ecd1['query'][_0xe9ed('0x41')]){_0xf474dc[_0xe9ed('0x42')]=[{'all':!![]}];}return db[_0xe9ed('0x2d')][_0xe9ed('0x43')](_0xf474dc);})['then'](function(_0x179c18){_0x1684a4['rows']=_0x179c18;return _0x1684a4;})[_0xe9ed('0x25')](respondWithFilteredResult(_0x4203b2,_0xf474dc))['catch'](handleError(_0x4203b2,null));};exports[_0xe9ed('0x44')]=function(_0x6b23ab,_0x4d3d2e){var _0x30ee23={'raw':![],'where':{'id':_0x6b23ab[_0xe9ed('0x45')]['id']}},_0x3480ef={};_0x3480ef['model']=_[_0xe9ed('0x32')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')]);_0x3480ef['query']=_[_0xe9ed('0x32')](_0x6b23ab[_0xe9ed('0x33')]);_0x3480ef[_0xe9ed('0x34')]=_['intersection'](_0x3480ef[_0xe9ed('0x36')],_0x3480ef[_0xe9ed('0x33')]);_0x30ee23['attributes']=_[_0xe9ed('0x35')](_0x3480ef['model'],qs[_0xe9ed('0x38')](_0x6b23ab['query'][_0xe9ed('0x38')]));_0x30ee23[_0xe9ed('0x37')]=_0x30ee23[_0xe9ed('0x37')][_0xe9ed('0x39')]?_0x30ee23[_0xe9ed('0x37')]:_0x3480ef[_0xe9ed('0x36')];if(_0x6b23ab['query']['includeAll']){_0x30ee23[_0xe9ed('0x42')]=[{'all':!![]}];}_0x30ee23=_[_0xe9ed('0x3f')]({},_0x30ee23,_0x6b23ab[_0xe9ed('0x40')]);return db[_0xe9ed('0x2d')]['find'](_0x30ee23)['then'](handleEntityNotFound(_0x4d3d2e,null))[_0xe9ed('0x25')](respondWithResult(_0x4d3d2e,null))[_0xe9ed('0x46')](handleError(_0x4d3d2e,null));};exports[_0xe9ed('0x47')]=function(_0x47286c,_0x4521d5){return db[_0xe9ed('0x2d')]['create'](_0x47286c[_0xe9ed('0x48')],{})[_0xe9ed('0x25')](respondWithResult(_0x4521d5,0xc9))[_0xe9ed('0x46')](handleError(_0x4521d5,null));};exports[_0xe9ed('0x49')]=function(_0x7f1472,_0x19ca94){if(_0x7f1472[_0xe9ed('0x48')]['id']){delete _0x7f1472[_0xe9ed('0x48')]['id'];}return db[_0xe9ed('0x2d')][_0xe9ed('0x4a')]({'where':{'id':_0x7f1472[_0xe9ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x19ca94,null))[_0xe9ed('0x25')](saveUpdates(_0x7f1472['body'],null))[_0xe9ed('0x25')](respondWithResult(_0x19ca94,null))[_0xe9ed('0x46')](handleError(_0x19ca94,null));};exports['destroy']=function(_0x3e68ed,_0x4a72c2){return db[_0xe9ed('0x2d')]['find']({'where':{'id':_0x3e68ed[_0xe9ed('0x45')]['id']}})[_0xe9ed('0x25')](handleEntityNotFound(_0x4a72c2,null))[_0xe9ed('0x25')](removeEntity(_0x4a72c2,null))[_0xe9ed('0x46')](handleError(_0x4a72c2,null));};exports[_0xe9ed('0x4b')]=function(_0x34c160,_0x4e03eb){return db[_0xe9ed('0x2d')][_0xe9ed('0x4b')]()[_0xe9ed('0x25')](respondWithResult(_0x4e03eb,null))['catch'](handleError(_0x4e03eb,null));};exports[_0xe9ed('0x4c')]=function(_0x100769,_0x2037ec){var _0x1501fc={},_0x4fad8d={},_0x41b243={'count':0x0,'rows':[]};_0x4fad8d[_0xe9ed('0x36')]=_[_0xe9ed('0x32')](db[_0xe9ed('0x2d')][_0xe9ed('0x2e')]);_0x4fad8d[_0xe9ed('0x33')]=_['keys'](_0x100769[_0xe9ed('0x33')]);_0x4fad8d['filters']=_[_0xe9ed('0x35')](_0x4fad8d[_0xe9ed('0x36')],_0x4fad8d[_0xe9ed('0x33')]);_0x1501fc[_0xe9ed('0x37')]=_['intersection'](_0x4fad8d[_0xe9ed('0x36')],qs[_0xe9ed('0x38')](_0x100769['query']['fields']));_0x1501fc[_0xe9ed('0x37')]=_0x1501fc[_0xe9ed('0x37')][_0xe9ed('0x39')]?_0x1501fc[_0xe9ed('0x37')]:_0x4fad8d[_0xe9ed('0x36')];if(!_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3a')]('nolimit')){_0x1501fc[_0xe9ed('0x20')]=qs['limit'](_0x100769[_0xe9ed('0x33')][_0xe9ed('0x20')]);_0x1501fc['offset']=qs[_0xe9ed('0x1e')](_0x100769[_0xe9ed('0x33')][_0xe9ed('0x1e')]);}_0x1501fc[_0xe9ed('0x4d')]=qs[_0xe9ed('0x3b')](_0x100769['query'][_0xe9ed('0x3b')]);_0x1501fc['where']=qs[_0xe9ed('0x34')](_['pick'](_0x100769[_0xe9ed('0x33')],_0x4fad8d[_0xe9ed('0x34')]));if(_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3e')]){_0x1501fc[_0xe9ed('0x3c')]=_[_0xe9ed('0x3f')](_0x1501fc[_0xe9ed('0x3c')],{'$or':_[_0xe9ed('0x2c')](_0x1501fc[_0xe9ed('0x37')],function(_0x33545e){var _0x44cece={};_0x44cece[_0x33545e]={'$like':'%'+_0x100769[_0xe9ed('0x33')][_0xe9ed('0x3e')]+'%'};return _0x44cece;})});}_0x1501fc=_[_0xe9ed('0x3f')]({},_0x1501fc,_0x100769[_0xe9ed('0x40')]);var _0x26b6cc={'where':_0x1501fc['where']};return db[_0xe9ed('0x2d')][_0xe9ed('0x21')](_0x26b6cc)[_0xe9ed('0x25')](function(_0x4cd3a9){_0x41b243[_0xe9ed('0x21')]=_0x4cd3a9;if(_0x100769[_0xe9ed('0x33')][_0xe9ed('0x41')]){_0x1501fc['include']=[{'all':!![]}];}return db[_0xe9ed('0x2d')][_0xe9ed('0x43')](_0x1501fc);})[_0xe9ed('0x25')](function(_0x38fa12){_0x41b243[_0xe9ed('0x4e')]=_0x38fa12;return _0x41b243;})['then'](respondWithFilteredResult(_0x2037ec,_0x1501fc,_0xe9ed('0x4c')))['catch'](handleError(_0x2037ec,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x10f2=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','hasOwnProperty','pick','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x2e14f2,_0x377d0d){var _0x12cc03=function(_0xef3e56){while(--_0xef3e56){_0x2e14f2['push'](_0x2e14f2['shift']());}};_0x12cc03(++_0x377d0d);}(_0x10f2,0x1db));var _0x210f=function(_0x2a9eb7,_0xd32852){_0x2a9eb7=_0x2a9eb7-0x0;var _0x207ba6=_0x10f2[_0x2a9eb7];return _0x207ba6;};'use strict';var emlformat=require(_0x210f('0x0'));var rimraf=require(_0x210f('0x1'));var zipdir=require(_0x210f('0x2'));var jsonpatch=require(_0x210f('0x3'));var rp=require(_0x210f('0x4'));var moment=require(_0x210f('0x5'));var BPromise=require(_0x210f('0x6'));var Mustache=require('mustache');var util=require(_0x210f('0x7'));var path=require(_0x210f('0x8'));var sox=require(_0x210f('0x9'));var csv=require('to-csv');var ejs=require(_0x210f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x210f('0xb'));var toCsv=require('to-csv');var querystring=require(_0x210f('0xc'));var Papa=require(_0x210f('0xd'));var Redis=require(_0x210f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x210f('0xf'));var as=require(_0x210f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x210f('0x11'))(_0x210f('0x12'));var utils=require(_0x210f('0x13'));var config=require(_0x210f('0x14'));var licenseUtil=require(_0x210f('0x15'));var db=require(_0x210f('0x16'))['db'];config[_0x210f('0x17')]=_['defaults'](config[_0x210f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x210f('0x18'))(new Redis(config[_0x210f('0x17')]));require(_0x210f('0x19'))[_0x210f('0x1a')](socket);function respondWithStatusCode(_0x3f5fb2,_0x3fa3b1){_0x3fa3b1=_0x3fa3b1||0xcc;return function(_0x541a44){if(_0x541a44){return _0x3f5fb2[_0x210f('0x1b')](_0x3fa3b1);}return _0x3f5fb2['status'](_0x3fa3b1)[_0x210f('0x1c')]();};}function respondWithResult(_0x163641,_0x14d56f){_0x14d56f=_0x14d56f||0xc8;return function(_0x127ffe){if(_0x127ffe){return _0x163641[_0x210f('0x1d')](_0x14d56f)[_0x210f('0x1e')](_0x127ffe);}};}function respondWithFilteredResult(_0x4d87f9,_0x12d71f){return function(_0x5e76f0){if(_0x5e76f0){var _0x29fadc=typeof _0x12d71f[_0x210f('0x1f')]===_0x210f('0x20')&&typeof _0x12d71f[_0x210f('0x21')]==='undefined';var _0x3b2820=_0x5e76f0[_0x210f('0x22')];var _0x462d01=_0x29fadc?0x0:_0x12d71f[_0x210f('0x1f')];var _0x1404e9=_0x29fadc?_0x5e76f0['count']:_0x12d71f[_0x210f('0x1f')]+_0x12d71f['limit'];var _0x3bb67d;if(_0x1404e9>=_0x3b2820){_0x1404e9=_0x3b2820;_0x3bb67d=0xc8;}else{_0x3bb67d=0xce;}_0x4d87f9[_0x210f('0x1d')](_0x3bb67d);return _0x4d87f9['set'](_0x210f('0x23'),_0x462d01+'-'+_0x1404e9+'/'+_0x3b2820)[_0x210f('0x1e')](_0x5e76f0);}return null;};}function patchUpdates(_0x538582){return function(_0x470eea){try{jsonpatch[_0x210f('0x24')](_0x470eea,_0x538582,!![]);}catch(_0x3d3603){return BPromise[_0x210f('0x25')](_0x3d3603);}return _0x470eea[_0x210f('0x26')]();};}function saveUpdates(_0x55ad5d,_0x292bec){return function(_0x2ba149){if(_0x2ba149){return _0x2ba149[_0x210f('0x27')](_0x55ad5d)[_0x210f('0x28')](function(_0x2e7672){return _0x2e7672;});}return null;};}function removeEntity(_0x3e0dcc,_0x100bcd){return function(_0x2b7f00){if(_0x2b7f00){return _0x2b7f00[_0x210f('0x29')]()[_0x210f('0x28')](function(){_0x3e0dcc[_0x210f('0x1d')](0xcc)[_0x210f('0x1c')]();});}};}function handleEntityNotFound(_0x3c6cfd,_0x4f8e32){return function(_0xe2fbe1){if(!_0xe2fbe1){_0x3c6cfd[_0x210f('0x1b')](0x194);}return _0xe2fbe1;};}function handleError(_0x167886,_0x34862f){_0x34862f=_0x34862f||0x1f4;return function(_0xd66047){logger[_0x210f('0x2a')](_0xd66047['stack']);if(_0xd66047[_0x210f('0x2b')]){delete _0xd66047[_0x210f('0x2b')];}_0x167886['status'](_0x34862f)[_0x210f('0x2c')](_0xd66047);};}exports[_0x210f('0x2d')]=function(_0x5be1ef,_0x17eb7e){var _0x26f778={},_0x542a07={},_0x2ce20c={'count':0x0,'rows':[]};var _0x9e7b76=_[_0x210f('0x2e')](db[_0x210f('0x2f')][_0x210f('0x30')],function(_0x2f9130){return{'name':_0x2f9130[_0x210f('0x31')],'type':_0x2f9130[_0x210f('0x32')][_0x210f('0x33')]};});_0x542a07[_0x210f('0x34')]=_[_0x210f('0x2e')](_0x9e7b76,'name');_0x542a07[_0x210f('0x35')]=_[_0x210f('0x36')](_0x5be1ef[_0x210f('0x35')]);_0x542a07['filters']=_[_0x210f('0x37')](_0x542a07['model'],_0x542a07[_0x210f('0x35')]);_0x26f778[_0x210f('0x38')]=_[_0x210f('0x37')](_0x542a07[_0x210f('0x34')],qs[_0x210f('0x39')](_0x5be1ef[_0x210f('0x35')]['fields']));_0x26f778[_0x210f('0x38')]=_0x26f778[_0x210f('0x38')][_0x210f('0x3a')]?_0x26f778[_0x210f('0x38')]:_0x542a07['model'];if(!_0x5be1ef[_0x210f('0x35')]['hasOwnProperty'](_0x210f('0x3b'))){_0x26f778[_0x210f('0x21')]=qs[_0x210f('0x21')](_0x5be1ef['query'][_0x210f('0x21')]);_0x26f778[_0x210f('0x1f')]=qs[_0x210f('0x1f')](_0x5be1ef['query']['offset']);}_0x26f778[_0x210f('0x3c')]=qs[_0x210f('0x3d')](_0x5be1ef[_0x210f('0x35')][_0x210f('0x3d')]);_0x26f778[_0x210f('0x3e')]=qs[_0x210f('0x3f')](_['pick'](_0x5be1ef[_0x210f('0x35')],_0x542a07['filters']),_0x9e7b76);if(_0x5be1ef[_0x210f('0x35')][_0x210f('0x40')]){_0x26f778[_0x210f('0x3e')]=_[_0x210f('0x41')](_0x26f778[_0x210f('0x3e')],{'$or':_[_0x210f('0x2e')](_0x9e7b76,function(_0x1fc1b9){if(_0x1fc1b9[_0x210f('0x32')]!==_0x210f('0x42')){var _0x2b5d53={};_0x2b5d53[_0x1fc1b9[_0x210f('0x2b')]]={'$like':'%'+_0x5be1ef[_0x210f('0x35')][_0x210f('0x40')]+'%'};return _0x2b5d53;}})});}_0x26f778=_['merge']({},_0x26f778,_0x5be1ef[_0x210f('0x43')]);var _0x45a6e5={'where':_0x26f778[_0x210f('0x3e')]};return db[_0x210f('0x2f')]['count'](_0x45a6e5)[_0x210f('0x28')](function(_0x19d71b){_0x2ce20c[_0x210f('0x22')]=_0x19d71b;if(_0x5be1ef[_0x210f('0x35')][_0x210f('0x44')]){_0x26f778[_0x210f('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x26f778);})[_0x210f('0x28')](function(_0x414bde){_0x2ce20c[_0x210f('0x46')]=_0x414bde;return _0x2ce20c;})[_0x210f('0x28')](respondWithFilteredResult(_0x17eb7e,_0x26f778))[_0x210f('0x47')](handleError(_0x17eb7e,null));};exports['show']=function(_0x4be2f8,_0x214216){var _0x33440a={'raw':![],'where':{'id':_0x4be2f8[_0x210f('0x48')]['id']}},_0x51071e={};_0x51071e[_0x210f('0x34')]=_['keys'](db[_0x210f('0x2f')][_0x210f('0x30')]);_0x51071e[_0x210f('0x35')]=_[_0x210f('0x36')](_0x4be2f8['query']);_0x51071e[_0x210f('0x3f')]=_[_0x210f('0x37')](_0x51071e['model'],_0x51071e[_0x210f('0x35')]);_0x33440a[_0x210f('0x38')]=_[_0x210f('0x37')](_0x51071e[_0x210f('0x34')],qs['fields'](_0x4be2f8[_0x210f('0x35')][_0x210f('0x39')]));_0x33440a['attributes']=_0x33440a[_0x210f('0x38')]['length']?_0x33440a[_0x210f('0x38')]:_0x51071e[_0x210f('0x34')];if(_0x4be2f8[_0x210f('0x35')]['includeAll']){_0x33440a['include']=[{'all':!![]}];}_0x33440a=_[_0x210f('0x41')]({},_0x33440a,_0x4be2f8[_0x210f('0x43')]);return db[_0x210f('0x2f')][_0x210f('0x49')](_0x33440a)[_0x210f('0x28')](handleEntityNotFound(_0x214216,null))['then'](respondWithResult(_0x214216,null))['catch'](handleError(_0x214216,null));};exports['create']=function(_0x11b576,_0x474ad2){return db[_0x210f('0x2f')][_0x210f('0x4a')](_0x11b576[_0x210f('0x4b')],{})[_0x210f('0x28')](respondWithResult(_0x474ad2,0xc9))[_0x210f('0x47')](handleError(_0x474ad2,null));};exports[_0x210f('0x27')]=function(_0x14c9a6,_0x2b0f85){if(_0x14c9a6[_0x210f('0x4b')]['id']){delete _0x14c9a6[_0x210f('0x4b')]['id'];}return db[_0x210f('0x2f')][_0x210f('0x49')]({'where':{'id':_0x14c9a6[_0x210f('0x48')]['id']}})[_0x210f('0x28')](handleEntityNotFound(_0x2b0f85,null))['then'](saveUpdates(_0x14c9a6[_0x210f('0x4b')],null))[_0x210f('0x28')](respondWithResult(_0x2b0f85,null))[_0x210f('0x47')](handleError(_0x2b0f85,null));};exports[_0x210f('0x29')]=function(_0x31f94b,_0x2a40a7){return db[_0x210f('0x2f')][_0x210f('0x49')]({'where':{'id':_0x31f94b[_0x210f('0x48')]['id']}})[_0x210f('0x28')](handleEntityNotFound(_0x2a40a7,null))['then'](removeEntity(_0x2a40a7,null))[_0x210f('0x47')](handleError(_0x2a40a7,null));};exports[_0x210f('0x4c')]=function(_0x3bd1dc,_0x48262b){return db[_0x210f('0x2f')][_0x210f('0x4c')]()[_0x210f('0x28')](respondWithResult(_0x48262b,null))['catch'](handleError(_0x48262b,null));};exports['getVoiceQueuesReport']=function(_0x17c94f,_0x35dd26){var _0x315669={},_0xff37c0={},_0x1e2198={'count':0x0,'rows':[]};_0xff37c0['model']=_['keys'](db['VoiceQueueReport'][_0x210f('0x30')]);_0xff37c0[_0x210f('0x35')]=_[_0x210f('0x36')](_0x17c94f[_0x210f('0x35')]);_0xff37c0[_0x210f('0x3f')]=_[_0x210f('0x37')](_0xff37c0['model'],_0xff37c0[_0x210f('0x35')]);_0x315669[_0x210f('0x38')]=_['intersection'](_0xff37c0['model'],qs[_0x210f('0x39')](_0x17c94f[_0x210f('0x35')]['fields']));_0x315669[_0x210f('0x38')]=_0x315669[_0x210f('0x38')][_0x210f('0x3a')]?_0x315669[_0x210f('0x38')]:_0xff37c0[_0x210f('0x34')];if(!_0x17c94f['query'][_0x210f('0x4d')](_0x210f('0x3b'))){_0x315669['limit']=qs[_0x210f('0x21')](_0x17c94f[_0x210f('0x35')][_0x210f('0x21')]);_0x315669[_0x210f('0x1f')]=qs[_0x210f('0x1f')](_0x17c94f[_0x210f('0x35')]['offset']);}_0x315669[_0x210f('0x3c')]=qs[_0x210f('0x3d')](_0x17c94f['query']['sort']);_0x315669['where']=qs[_0x210f('0x3f')](_[_0x210f('0x4e')](_0x17c94f[_0x210f('0x35')],_0xff37c0[_0x210f('0x3f')]));if(_0x17c94f['query']['filter']){_0x315669[_0x210f('0x3e')]=_[_0x210f('0x41')](_0x315669['where'],{'$or':_[_0x210f('0x2e')](_0x315669[_0x210f('0x38')],function(_0x1b03fc){var _0x525ee4={};_0x525ee4[_0x1b03fc]={'$like':'%'+_0x17c94f['query'][_0x210f('0x40')]+'%'};return _0x525ee4;})});}_0x315669=_['merge']({},_0x315669,_0x17c94f[_0x210f('0x43')]);var _0x226e95={'where':_0x315669[_0x210f('0x3e')]};return db[_0x210f('0x2f')][_0x210f('0x22')](_0x226e95)[_0x210f('0x28')](function(_0x20b354){_0x1e2198['count']=_0x20b354;if(_0x17c94f['query'][_0x210f('0x44')]){_0x315669[_0x210f('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x210f('0x4f')](_0x315669);})['then'](function(_0x2fe9a3){_0x1e2198[_0x210f('0x46')]=_0x2fe9a3;return _0x1e2198;})['then'](respondWithFilteredResult(_0x35dd26,_0x315669,_0x210f('0x50')))[_0x210f('0x47')](handleError(_0x35dd26,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 4cfa056..e1522ce 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 _0xb338=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x3c0b95,_0x26105c){var _0x3759e0=function(_0x19f11f){while(--_0x19f11f){_0x3c0b95['push'](_0x3c0b95['shift']());}};_0x3759e0(++_0x26105c);}(_0xb338,0x166));var _0x8b33=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xb338[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0x8b33('0x0'));var VoiceQueueReport=require(_0x8b33('0x1'))['db'][_0x8b33('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8b33('0x3')](0x0);var events={'afterCreate':_0x8b33('0x4'),'afterUpdate':_0x8b33('0x5'),'afterDestroy':_0x8b33('0x6')};function emitEvent(_0x1ee917){return function(_0x4d91e6,_0x497c71,_0x1a5576){VoiceQueueReportEvents['emit'](_0x1ee917+':'+_0x4d91e6['id'],_0x4d91e6);VoiceQueueReportEvents[_0x8b33('0x7')](_0x1ee917,_0x4d91e6);_0x1a5576(null);};}for(var e in events){if(events[_0x8b33('0x8')](e)){var event=events[e];VoiceQueueReport[_0x8b33('0x9')](e,emitEvent(event));}}module[_0x8b33('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2bbf=['../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x414b2c,_0x286a36){var _0xeb891a=function(_0xadbcd9){while(--_0xadbcd9){_0x414b2c['push'](_0x414b2c['shift']());}};_0xeb891a(++_0x286a36);}(_0x2bbf,0x1cb));var _0xf2bb=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x2bbf[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xf2bb('0x0'))['db'][_0xf2bb('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf2bb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2bb('0x3'),'afterDestroy':_0xf2bb('0x4')};function emitEvent(_0x5d7c44){return function(_0x160036,_0x14c305,_0x32b05d){VoiceQueueReportEvents['emit'](_0x5d7c44+':'+_0x160036['id'],_0x160036);VoiceQueueReportEvents[_0xf2bb('0x5')](_0x5d7c44,_0x160036);_0x32b05d(null);};}for(var e in events){if(events[_0xf2bb('0x6')](e)){var event=events[e];VoiceQueueReport[_0xf2bb('0x7')](e,emitEvent(event));}}module[_0xf2bb('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8da59e9..e250f05 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 _0x20af=['report_queue','uniqueid','calleridnum','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x582ec9,_0x7ed3e0){var _0x5a63d1=function(_0x5c3ec3){while(--_0x5c3ec3){_0x582ec9['push'](_0x582ec9['shift']());}};_0x5a63d1(++_0x7ed3e0);}(_0x20af,0xb9));var _0xf20a=function(_0x38caf2,_0x4f20de){_0x38caf2=_0x38caf2-0x0;var _0x54a634=_0x20af[_0x38caf2];return _0x54a634;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf20a('0x0'))(_0xf20a('0x1'));var moment=require(_0xf20a('0x2'));var BPromise=require(_0xf20a('0x3'));var rp=require(_0xf20a('0x4'));var fs=require('fs');var path=require(_0xf20a('0x5'));var rimraf=require(_0xf20a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf20a('0x7'));module[_0xf20a('0x8')]=function(_0xbed358,_0x4a80e3){return _0xbed358[_0xf20a('0x9')](_0xf20a('0xa'),attributes,{'tableName':_0xf20a('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf20a('0xc')]},{'fields':[_0xf20a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22f2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x3bba93,_0x1b02eb){var _0x32d2ca=function(_0xecc323){while(--_0xecc323){_0x3bba93['push'](_0x3bba93['shift']());}};_0x32d2ca(++_0x1b02eb);}(_0x22f2,0xa6));var _0x222f=function(_0x2254ef,_0x1a311d){_0x2254ef=_0x2254ef-0x0;var _0x3167e5=_0x22f2[_0x2254ef];return _0x3167e5;};'use strict';var _=require(_0x222f('0x0'));var util=require(_0x222f('0x1'));var logger=require(_0x222f('0x2'))(_0x222f('0x3'));var moment=require('moment');var BPromise=require(_0x222f('0x4'));var rp=require(_0x222f('0x5'));var fs=require('fs');var path=require(_0x222f('0x6'));var rimraf=require(_0x222f('0x7'));var config=require(_0x222f('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x222f('0x9')]=function(_0x4c3765,_0x28e25b){return _0x4c3765['define'](_0x222f('0xa'),attributes,{'tableName':_0x222f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x222f('0xc')]},{'fields':[_0x222f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 301de20..c883216 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 _0xb154=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','findAll','options','where','limit','model','attributes','include','map','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','lodash'];(function(_0x59bb79,_0x36e412){var _0x20bc99=function(_0xa74525){while(--_0xa74525){_0x59bb79['push'](_0x59bb79['shift']());}};_0x20bc99(++_0x36e412);}(_0xb154,0xfb));var _0x4b15=function(_0x23172f,_0x11f3e4){_0x23172f=_0x23172f-0x0;var _0x178562=_0xb154[_0x23172f];return _0x178562;};'use strict';var _=require(_0x4b15('0x0'));var util=require(_0x4b15('0x1'));var moment=require(_0x4b15('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b15('0x3'));var db=require(_0x4b15('0x4'))['db'];var utils=require(_0x4b15('0x5'));var logger=require(_0x4b15('0x6'))(_0x4b15('0x7'));var config=require(_0x4b15('0x8'));var jayson=require(_0x4b15('0x9'));var client=jayson[_0x4b15('0xa')][_0x4b15('0xb')]({'port':0x232a});config[_0x4b15('0xc')]=_['defaults'](config[_0x4b15('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b15('0xd'))(new Redis(config[_0x4b15('0xc')]));require(_0x4b15('0xe'))['register'](socket);function respondWithRpcPromise(_0x20e398,_0x48479,_0x542a92){return new BPromise(function(_0x5b19f2,_0x46c273){return client['request'](_0x20e398,_0x542a92)[_0x4b15('0xf')](function(_0x2a707e){logger[_0x4b15('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x4b15('0x11'));logger[_0x4b15('0x12')](_0x4b15('0x13'),_0x48479,_0x4b15('0x11'),JSON[_0x4b15('0x14')](_0x2a707e));if(_0x2a707e['error']){if(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x16')]===0x1f4){logger[_0x4b15('0x15')](_0x4b15('0x17'),_0x48479,_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);return _0x46c273(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);}logger[_0x4b15('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x2a707e['error']['message']);return _0x5b19f2(_0x2a707e[_0x4b15('0x15')][_0x4b15('0x18')]);}else{logger[_0x4b15('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x48479,_0x4b15('0x11'));_0x5b19f2(_0x2a707e['result']['message']);}})[_0x4b15('0x19')](function(_0x261c6b){logger[_0x4b15('0x15')](_0x4b15('0x17'),_0x48479,_0x261c6b);_0x46c273(_0x261c6b);});});}exports['GetVoiceQueueReport']=function(_0x869f3c){var _0x82dbba=this;return new Promise(function(_0x3355cc,_0xf5f73d){return db['VoiceQueueReport'][_0x4b15('0x1a')]({'raw':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x869f3c['options']?_0x869f3c[_0x4b15('0x1b')][_0x4b15('0x1c')]||null:null,'attributes':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['attributes']||null:null,'limit':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')][_0x4b15('0x1d')]||null:null,'include':_0x869f3c[_0x4b15('0x1b')]?_0x869f3c[_0x4b15('0x1b')]['include']?_['map'](_0x869f3c[_0x4b15('0x1b')]['include'],function(_0x18d7e6){return{'model':db[_0x18d7e6[_0x4b15('0x1e')]],'as':_0x18d7e6['as'],'attributes':_0x18d7e6[_0x4b15('0x1f')],'include':_0x18d7e6[_0x4b15('0x20')]?_[_0x4b15('0x21')](_0x18d7e6[_0x4b15('0x20')],function(_0xca19bd){return{'model':db[_0xca19bd['model']],'as':_0xca19bd['as'],'attributes':_0xca19bd[_0x4b15('0x1f')],'include':_0xca19bd['include']?_[_0x4b15('0x21')](_0xca19bd[_0x4b15('0x20')],function(_0x59e721){return{'model':db[_0x59e721[_0x4b15('0x1e')]],'as':_0x59e721['as'],'attributes':_0x59e721[_0x4b15('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4b15('0xf')](function(_0x375b67){logger[_0x4b15('0x10')](_0x4b15('0x22'),_0x869f3c);logger[_0x4b15('0x12')]('GetVoiceQueueReport',_0x869f3c,JSON[_0x4b15('0x14')](_0x375b67));_0x3355cc(_0x375b67);})[_0x4b15('0x19')](function(_0x19f867){logger[_0x4b15('0x15')](_0x4b15('0x22'),_0x19f867[_0x4b15('0x18')],_0x869f3c);_0xf5f73d(_0x82dbba[_0x4b15('0x15')](0x1f4,_0x19f867['message']));});});};exports[_0x4b15('0x23')]=function(_0x3ead7b){var _0x60ed23=this;return new Promise(function(_0x1cc96d,_0x3900e2){return db[_0x4b15('0x24')][_0x4b15('0x25')](_0x3ead7b[_0x4b15('0x26')],{'raw':_0x3ead7b[_0x4b15('0x1b')]?_0x3ead7b[_0x4b15('0x1b')][_0x4b15('0x27')]===undefined?!![]:![]:!![]})[_0x4b15('0xf')](function(_0x1126be){logger[_0x4b15('0x10')](_0x4b15('0x23'),_0x3ead7b);logger[_0x4b15('0x12')](_0x4b15('0x23'),_0x3ead7b,JSON[_0x4b15('0x14')](_0x1126be));_0x1cc96d(_0x1126be);})[_0x4b15('0x19')](function(_0x19db8b){logger[_0x4b15('0x15')](_0x4b15('0x23'),_0x19db8b[_0x4b15('0x18')],_0x3ead7b);_0x3900e2(_0x60ed23[_0x4b15('0x15')](0x1f4,_0x19db8b[_0x4b15('0x18')]));});});};exports[_0x4b15('0x28')]=function(_0x22df1b){var _0x2231e1=this;return new Promise(function(_0x38801f,_0x4f3239){return db[_0x4b15('0x24')][_0x4b15('0x29')](_0x22df1b['body'],{'raw':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b['options'][_0x4b15('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b['options'][_0x4b15('0x1c')]||null:null,'attributes':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b[_0x4b15('0x1b')]['attributes']||null:null,'limit':_0x22df1b[_0x4b15('0x1b')]?_0x22df1b[_0x4b15('0x1b')][_0x4b15('0x1d')]||null:null})[_0x4b15('0xf')](function(_0x5a86a1){logger[_0x4b15('0x10')](_0x4b15('0x28'),_0x22df1b);logger['debug'](_0x4b15('0x28'),_0x22df1b,JSON['stringify'](_0x5a86a1));_0x38801f(_0x5a86a1);})['catch'](function(_0x4bb43f){logger[_0x4b15('0x15')](_0x4b15('0x28'),_0x4bb43f['message'],_0x22df1b);_0x4f3239(_0x2231e1['error'](0x1f4,_0x4bb43f[_0x4b15('0x18')]));});});}; \ No newline at end of file +var _0x6f95=['attributes','limit','include','map','model','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where'];(function(_0x170d16,_0x443724){var _0x1bf864=function(_0x2be80e){while(--_0x2be80e){_0x170d16['push'](_0x170d16['shift']());}};_0x1bf864(++_0x443724);}(_0x6f95,0xae));var _0x56f9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6f95[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x56f9('0x0'));var util=require(_0x56f9('0x1'));var moment=require(_0x56f9('0x2'));var BPromise=require('bluebird');var rs=require(_0x56f9('0x3'));var fs=require('fs');var Redis=require(_0x56f9('0x4'));var db=require(_0x56f9('0x5'))['db'];var utils=require(_0x56f9('0x6'));var logger=require(_0x56f9('0x7'))(_0x56f9('0x8'));var config=require('../../config/environment');var jayson=require(_0x56f9('0x9'));var client=jayson[_0x56f9('0xa')][_0x56f9('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x56f9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56f9('0xc')]));require('./voiceQueueReport.socket')[_0x56f9('0xd')](socket);function respondWithRpcPromise(_0x256951,_0x5b1ded,_0x3a70be){return new BPromise(function(_0xc88390,_0x39e2b5){return client[_0x56f9('0xe')](_0x256951,_0x3a70be)[_0x56f9('0xf')](function(_0x2c33a6){logger[_0x56f9('0x10')](_0x56f9('0x11'),_0x5b1ded,'request\x20sent');logger[_0x56f9('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5b1ded,_0x56f9('0x13'),JSON[_0x56f9('0x14')](_0x2c33a6));if(_0x2c33a6[_0x56f9('0x15')]){if(_0x2c33a6[_0x56f9('0x15')][_0x56f9('0x16')]===0x1f4){logger['error'](_0x56f9('0x11'),_0x5b1ded,_0x2c33a6[_0x56f9('0x15')][_0x56f9('0x17')]);return _0x39e2b5(_0x2c33a6[_0x56f9('0x15')][_0x56f9('0x17')]);}logger[_0x56f9('0x15')](_0x56f9('0x11'),_0x5b1ded,_0x2c33a6[_0x56f9('0x15')]['message']);return _0xc88390(_0x2c33a6['error'][_0x56f9('0x17')]);}else{logger[_0x56f9('0x10')](_0x56f9('0x11'),_0x5b1ded,_0x56f9('0x13'));_0xc88390(_0x2c33a6[_0x56f9('0x18')][_0x56f9('0x17')]);}})['catch'](function(_0x4583ff){logger[_0x56f9('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b1ded,_0x4583ff);_0x39e2b5(_0x4583ff);});});}exports[_0x56f9('0x19')]=function(_0x583809){var _0x4a1528=this;return new Promise(function(_0xccc77e,_0x1d9112){return db[_0x56f9('0x1a')][_0x56f9('0x1b')]({'raw':_0x583809[_0x56f9('0x1c')]?_0x583809[_0x56f9('0x1c')][_0x56f9('0x1d')]===undefined?!![]:![]:!![],'where':_0x583809[_0x56f9('0x1c')]?_0x583809[_0x56f9('0x1c')][_0x56f9('0x1e')]||null:null,'attributes':_0x583809['options']?_0x583809[_0x56f9('0x1c')][_0x56f9('0x1f')]||null:null,'limit':_0x583809[_0x56f9('0x1c')]?_0x583809['options'][_0x56f9('0x20')]||null:null,'include':_0x583809['options']?_0x583809[_0x56f9('0x1c')][_0x56f9('0x21')]?_[_0x56f9('0x22')](_0x583809[_0x56f9('0x1c')][_0x56f9('0x21')],function(_0x274b2f){return{'model':db[_0x274b2f[_0x56f9('0x23')]],'as':_0x274b2f['as'],'attributes':_0x274b2f[_0x56f9('0x1f')],'include':_0x274b2f[_0x56f9('0x21')]?_[_0x56f9('0x22')](_0x274b2f['include'],function(_0x2fe142){return{'model':db[_0x2fe142[_0x56f9('0x23')]],'as':_0x2fe142['as'],'attributes':_0x2fe142[_0x56f9('0x1f')],'include':_0x2fe142[_0x56f9('0x21')]?_[_0x56f9('0x22')](_0x2fe142[_0x56f9('0x21')],function(_0x5c7377){return{'model':db[_0x5c7377[_0x56f9('0x23')]],'as':_0x5c7377['as'],'attributes':_0x5c7377[_0x56f9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x56f9('0xf')](function(_0x5a5bb2){logger['info']('GetVoiceQueueReport',_0x583809);logger[_0x56f9('0x12')](_0x56f9('0x19'),_0x583809,JSON[_0x56f9('0x14')](_0x5a5bb2));_0xccc77e(_0x5a5bb2);})['catch'](function(_0x1a652b){logger[_0x56f9('0x15')](_0x56f9('0x19'),_0x1a652b[_0x56f9('0x17')],_0x583809);_0x1d9112(_0x4a1528[_0x56f9('0x15')](0x1f4,_0x1a652b[_0x56f9('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x5de360){var _0x18e9c7=this;return new Promise(function(_0x5eb06b,_0x2f8505){return db[_0x56f9('0x1a')][_0x56f9('0x24')](_0x5de360[_0x56f9('0x25')],{'raw':_0x5de360[_0x56f9('0x1c')]?_0x5de360[_0x56f9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x56f9('0xf')](function(_0x47171b){logger[_0x56f9('0x10')](_0x56f9('0x26'),_0x5de360);logger[_0x56f9('0x12')]('CreateVoiceQueueReport',_0x5de360,JSON[_0x56f9('0x14')](_0x47171b));_0x5eb06b(_0x47171b);})['catch'](function(_0x1b06a2){logger['error'](_0x56f9('0x26'),_0x1b06a2[_0x56f9('0x17')],_0x5de360);_0x2f8505(_0x18e9c7[_0x56f9('0x15')](0x1f4,_0x1b06a2[_0x56f9('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x4ba483){var _0x302adb=this;return new Promise(function(_0x49f3ac,_0x3cd5d9){return db[_0x56f9('0x1a')]['update'](_0x4ba483[_0x56f9('0x25')],{'raw':_0x4ba483[_0x56f9('0x1c')]?_0x4ba483[_0x56f9('0x1c')][_0x56f9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ba483[_0x56f9('0x1c')]?_0x4ba483['options'][_0x56f9('0x1e')]||null:null,'attributes':_0x4ba483[_0x56f9('0x1c')]?_0x4ba483[_0x56f9('0x1c')][_0x56f9('0x1f')]||null:null,'limit':_0x4ba483[_0x56f9('0x1c')]?_0x4ba483['options'][_0x56f9('0x20')]||null:null})[_0x56f9('0xf')](function(_0x27161a){logger['info'](_0x56f9('0x27'),_0x4ba483);logger[_0x56f9('0x12')](_0x56f9('0x27'),_0x4ba483,JSON[_0x56f9('0x14')](_0x27161a));_0x49f3ac(_0x27161a);})[_0x56f9('0x28')](function(_0x46e950){logger[_0x56f9('0x15')](_0x56f9('0x27'),_0x46e950['message'],_0x4ba483);_0x3cd5d9(_0x302adb[_0x56f9('0x15')](0x1f4,_0x46e950[_0x56f9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 848acf4..9bb7fc2 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 _0x53cf=['./voiceQueueReport.events','save','remove','update','removeListener','register','length','voiceQueueReport:'];(function(_0x4f8886,_0x9be826){var _0x3c49e4=function(_0x3121e1){while(--_0x3121e1){_0x4f8886['push'](_0x4f8886['shift']());}};_0x3c49e4(++_0x9be826);}(_0x53cf,0x1b0));var _0xf53c=function(_0x235d69,_0x5a78ee){_0x235d69=_0x235d69-0x0;var _0x2974de=_0x53cf[_0x235d69];return _0x2974de;};'use strict';var VoiceQueueReportEvents=require(_0xf53c('0x0'));var events=[_0xf53c('0x1'),_0xf53c('0x2'),_0xf53c('0x3')];function createListener(_0x416ec9,_0x8c1cf2){return function(_0x180faa){_0x8c1cf2['emit'](_0x416ec9,_0x180faa);};}function removeListener(_0x1c78e6,_0xfe7b32){return function(){VoiceQueueReportEvents[_0xf53c('0x4')](_0x1c78e6,_0xfe7b32);};}exports[_0xf53c('0x5')]=function(_0x4ce1c9){for(var _0x163377=0x0,_0x33f534=events[_0xf53c('0x6')];_0x163377<_0x33f534;_0x163377++){var _0x50687d=events[_0x163377];var _0x52a320=createListener(_0xf53c('0x7')+_0x50687d,_0x4ce1c9);VoiceQueueReportEvents['on'](_0x50687d,_0x52a320);}}; \ No newline at end of file +var _0xcb26=['removeListener','register','voiceQueueReport:','save','remove','update','emit'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xcb26,0x14c));var _0x6cb2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcb26[_0xfae23b];return _0x200640;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x6cb2('0x0'),_0x6cb2('0x1'),_0x6cb2('0x2')];function createListener(_0x310da3,_0x2c7ad2){return function(_0x5b31c1){_0x2c7ad2[_0x6cb2('0x3')](_0x310da3,_0x5b31c1);};}function removeListener(_0x4bd770,_0x27fc17){return function(){VoiceQueueReportEvents[_0x6cb2('0x4')](_0x4bd770,_0x27fc17);};}exports[_0x6cb2('0x5')]=function(_0x2d8bce){for(var _0x172745=0x0,_0x3092d2=events['length'];_0x172745<_0x3092d2;_0x172745++){var _0x494be0=events[_0x172745];var _0x2a295b=createListener(_0x6cb2('0x6')+_0x494be0,_0x2d8bce);VoiceQueueReportEvents['on'](_0x494be0,_0x2a295b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6c8af06..2714205 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 _0x43df=['/:id','show','create','put','update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x27881f,_0x4cb469){var _0x20bd21=function(_0x2512d2){while(--_0x2512d2){_0x27881f['push'](_0x27881f['shift']());}};_0x20bd21(++_0x4cb469);}(_0x43df,0x1c8));var _0xf43d=function(_0x546750,_0x4c86d2){_0x546750=_0x546750-0x0;var _0x518b4e=_0x43df[_0x546750];return _0x518b4e;};'use strict';var multer=require('multer');var util=require(_0xf43d('0x0'));var path=require(_0xf43d('0x1'));var timeout=require('connect-timeout');var express=require(_0xf43d('0x2'));var router=express[_0xf43d('0x3')]();var fs_extra=require(_0xf43d('0x4'));var auth=require(_0xf43d('0x5'));var interaction=require(_0xf43d('0x6'));var config=require(_0xf43d('0x7'));var controller=require(_0xf43d('0x8'));router[_0xf43d('0x9')]('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xb')]);router[_0xf43d('0x9')](_0xf43d('0xc'),auth['isAuthenticated'](),controller[_0xf43d('0xd')]);router['post']('/',auth[_0xf43d('0xa')](),controller[_0xf43d('0xe')]);router[_0xf43d('0xf')]('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x10')]);router['delete']('/:id',auth[_0xf43d('0xa')](),controller[_0xf43d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','post','create','put','/:id','exports','util','path','express','Router'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x20c0('0xc')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')](_0x20c0('0xf'),auth[_0x20c0('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x20c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b3e033b..b1f7109 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 _0x9b29=['moment','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x583031,_0x1d2e2d){var _0x27e7c8=function(_0x3ca200){while(--_0x3ca200){_0x583031['push'](_0x583031['shift']());}};_0x27e7c8(++_0x1d2e2d);}(_0x9b29,0x177));var _0x99b2=function(_0x27bbf8,_0x137d54){_0x27bbf8=_0x27bbf8-0x0;var _0x49b87d=_0x9b29[_0x27bbf8];return _0x49b87d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x99b2('0x0'));module['exports']={'time':{'type':Sequelize[_0x99b2('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x99b2('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x99b2('0x2'))}}; \ No newline at end of file +var _0x8fbf=['DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports','STRING'];(function(_0xd3945c,_0x11dac7){var _0x31a8c0=function(_0x5739fd){while(--_0x5739fd){_0xd3945c['push'](_0xd3945c['shift']());}};_0x31a8c0(++_0x11dac7);}(_0x8fbf,0xf9));var _0xf8fb=function(_0xb63246,_0x3d0c29){_0xb63246=_0xb63246-0x0;var _0x5f058f=_0x8fbf[_0xb63246];return _0x5f058f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf8fb('0x0'));module[_0xf8fb('0x1')]={'time':{'type':Sequelize[_0xf8fb('0x2')]},'callid':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf8fb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf8fb('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xf8fb('0x4')](_0xf8fb('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c4d0b1c..35f3163 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 _0xe75a=['sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','hasOwnProperty','order'];(function(_0x387f50,_0x42c20e){var _0x5c360a=function(_0x444e80){while(--_0x444e80){_0x387f50['push'](_0x387f50['shift']());}};_0x5c360a(++_0x42c20e);}(_0xe75a,0x1e7));var _0xae75=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0xe75a[_0xe89d97];return _0x1b6e5d;};'use strict';var emlformat=require(_0xae75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae75('0x1'));var jsonpatch=require(_0xae75('0x2'));var rp=require(_0xae75('0x3'));var moment=require(_0xae75('0x4'));var BPromise=require(_0xae75('0x5'));var Mustache=require(_0xae75('0x6'));var util=require(_0xae75('0x7'));var path=require('path');var sox=require(_0xae75('0x8'));var csv=require(_0xae75('0x9'));var ejs=require(_0xae75('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae75('0xb'));var squel=require(_0xae75('0xc'));var crypto=require(_0xae75('0xd'));var jsforce=require(_0xae75('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xae75('0x9'));var querystring=require(_0xae75('0xf'));var Papa=require(_0xae75('0x10'));var Redis=require(_0xae75('0x11'));var authService=require(_0xae75('0x12'));var qs=require(_0xae75('0x13'));var as=require(_0xae75('0x14'));var hardwareService=require(_0xae75('0x15'));var logger=require(_0xae75('0x16'))(_0xae75('0x17'));var utils=require(_0xae75('0x18'));var config=require(_0xae75('0x19'));var licenseUtil=require(_0xae75('0x1a'));var db=require(_0xae75('0x1b'))['db'];function respondWithStatusCode(_0xef6d44,_0x33bd43){_0x33bd43=_0x33bd43||0xcc;return function(_0xae359d){if(_0xae359d){return _0xef6d44[_0xae75('0x1c')](_0x33bd43);}return _0xef6d44[_0xae75('0x1d')](_0x33bd43)['end']();};}function respondWithResult(_0x3c0452,_0x18ad72){_0x18ad72=_0x18ad72||0xc8;return function(_0x45e5c7){if(_0x45e5c7){return _0x3c0452[_0xae75('0x1d')](_0x18ad72)[_0xae75('0x1e')](_0x45e5c7);}};}function respondWithFilteredResult(_0x43e4d4,_0x14ed54){return function(_0x14dfc1){if(_0x14dfc1){var _0x1580bc=typeof _0x14ed54[_0xae75('0x1f')]==='undefined'&&typeof _0x14ed54[_0xae75('0x20')]===_0xae75('0x21');var _0x4d0c03=_0x14dfc1['count'];var _0x44881d=_0x1580bc?0x0:_0x14ed54[_0xae75('0x1f')];var _0x1b1665=_0x1580bc?_0x14dfc1[_0xae75('0x22')]:_0x14ed54[_0xae75('0x1f')]+_0x14ed54['limit'];var _0x2123ce;if(_0x1b1665>=_0x4d0c03){_0x1b1665=_0x4d0c03;_0x2123ce=0xc8;}else{_0x2123ce=0xce;}_0x43e4d4[_0xae75('0x1d')](_0x2123ce);return _0x43e4d4[_0xae75('0x23')](_0xae75('0x24'),_0x44881d+'-'+_0x1b1665+'/'+_0x4d0c03)[_0xae75('0x1e')](_0x14dfc1);}return null;};}function patchUpdates(_0x5d8315){return function(_0x34baae){try{jsonpatch[_0xae75('0x25')](_0x34baae,_0x5d8315,!![]);}catch(_0x27fd7a){return BPromise['reject'](_0x27fd7a);}return _0x34baae[_0xae75('0x26')]();};}function saveUpdates(_0x3c6abf,_0x1f5a67){return function(_0x33008e){if(_0x33008e){return _0x33008e[_0xae75('0x27')](_0x3c6abf)[_0xae75('0x28')](function(_0x3b46c5){return _0x3b46c5;});}return null;};}function removeEntity(_0xe78fce,_0x54dba9){return function(_0x1f394d){if(_0x1f394d){return _0x1f394d[_0xae75('0x29')]()[_0xae75('0x28')](function(){_0xe78fce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4230b9,_0x4352d7){return function(_0x2b3a3e){if(!_0x2b3a3e){_0x4230b9['sendStatus'](0x194);}return _0x2b3a3e;};}function handleError(_0x3b6785,_0x3067a7){_0x3067a7=_0x3067a7||0x1f4;return function(_0x3f6a7d){logger['error'](_0x3f6a7d[_0xae75('0x2a')]);if(_0x3f6a7d['name']){delete _0x3f6a7d['name'];}_0x3b6785[_0xae75('0x1d')](_0x3067a7)[_0xae75('0x2b')](_0x3f6a7d);};}exports[_0xae75('0x2c')]=function(_0xcda0d,_0x41b380){var _0x58cff8={},_0xf3af38={},_0x269493={'count':0x0,'rows':[]};var _0x331299=_[_0xae75('0x2d')](db[_0xae75('0x2e')][_0xae75('0x2f')],function(_0x9c1db6){return{'name':_0x9c1db6[_0xae75('0x30')],'type':_0x9c1db6[_0xae75('0x31')][_0xae75('0x32')]};});_0xf3af38[_0xae75('0x33')]=_[_0xae75('0x2d')](_0x331299,'name');_0xf3af38['query']=_[_0xae75('0x34')](_0xcda0d['query']);_0xf3af38[_0xae75('0x35')]=_[_0xae75('0x36')](_0xf3af38[_0xae75('0x33')],_0xf3af38[_0xae75('0x37')]);_0x58cff8[_0xae75('0x38')]=_[_0xae75('0x36')](_0xf3af38['model'],qs['fields'](_0xcda0d[_0xae75('0x37')]['fields']));_0x58cff8[_0xae75('0x38')]=_0x58cff8[_0xae75('0x38')]['length']?_0x58cff8['attributes']:_0xf3af38[_0xae75('0x33')];if(!_0xcda0d[_0xae75('0x37')][_0xae75('0x39')]('nolimit')){_0x58cff8[_0xae75('0x20')]=qs[_0xae75('0x20')](_0xcda0d[_0xae75('0x37')][_0xae75('0x20')]);_0x58cff8[_0xae75('0x1f')]=qs[_0xae75('0x1f')](_0xcda0d[_0xae75('0x37')][_0xae75('0x1f')]);}_0x58cff8[_0xae75('0x3a')]=qs[_0xae75('0x3b')](_0xcda0d[_0xae75('0x37')][_0xae75('0x3b')]);_0x58cff8['where']=qs[_0xae75('0x35')](_[_0xae75('0x3c')](_0xcda0d[_0xae75('0x37')],_0xf3af38[_0xae75('0x35')]),_0x331299);if(_0xcda0d[_0xae75('0x37')][_0xae75('0x3d')]){_0x58cff8[_0xae75('0x3e')]=_['merge'](_0x58cff8[_0xae75('0x3e')],{'$or':_[_0xae75('0x2d')](_0x331299,function(_0x359a1a){if(_0x359a1a[_0xae75('0x31')]!==_0xae75('0x3f')){var _0x98fbf4={};_0x98fbf4[_0x359a1a[_0xae75('0x40')]]={'$like':'%'+_0xcda0d['query']['filter']+'%'};return _0x98fbf4;}})});}_0x58cff8=_[_0xae75('0x41')]({},_0x58cff8,_0xcda0d[_0xae75('0x42')]);var _0x3ac0e4={'where':_0x58cff8[_0xae75('0x3e')]};return db[_0xae75('0x2e')][_0xae75('0x22')](_0x3ac0e4)['then'](function(_0x32eeed){_0x269493['count']=_0x32eeed;if(_0xcda0d[_0xae75('0x37')][_0xae75('0x43')]){_0x58cff8[_0xae75('0x44')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xae75('0x45')](_0x58cff8);})[_0xae75('0x28')](function(_0x1213ad){_0x269493[_0xae75('0x46')]=_0x1213ad;return _0x269493;})[_0xae75('0x28')](respondWithFilteredResult(_0x41b380,_0x58cff8))[_0xae75('0x47')](handleError(_0x41b380,null));};exports[_0xae75('0x48')]=function(_0x5e02b9,_0x2b534b){var _0x2cc77b={'raw':!![],'where':{'id':_0x5e02b9['params']['id']}},_0x2de434={};_0x2de434[_0xae75('0x33')]=_['keys'](db[_0xae75('0x2e')][_0xae75('0x2f')]);_0x2de434[_0xae75('0x37')]=_['keys'](_0x5e02b9['query']);_0x2de434[_0xae75('0x35')]=_[_0xae75('0x36')](_0x2de434[_0xae75('0x33')],_0x2de434['query']);_0x2cc77b[_0xae75('0x38')]=_['intersection'](_0x2de434[_0xae75('0x33')],qs[_0xae75('0x49')](_0x5e02b9[_0xae75('0x37')][_0xae75('0x49')]));_0x2cc77b[_0xae75('0x38')]=_0x2cc77b[_0xae75('0x38')]['length']?_0x2cc77b[_0xae75('0x38')]:_0x2de434['model'];if(_0x5e02b9['query'][_0xae75('0x43')]){_0x2cc77b[_0xae75('0x44')]=[{'all':!![]}];}_0x2cc77b=_[_0xae75('0x41')]({},_0x2cc77b,_0x5e02b9['options']);return db[_0xae75('0x2e')][_0xae75('0x4a')](_0x2cc77b)[_0xae75('0x28')](handleEntityNotFound(_0x2b534b,null))['then'](respondWithResult(_0x2b534b,null))[_0xae75('0x47')](handleError(_0x2b534b,null));};exports['create']=function(_0x5f3ed8,_0x339571){return db[_0xae75('0x2e')][_0xae75('0x4b')](_0x5f3ed8['body'],{})['then'](respondWithResult(_0x339571,0xc9))[_0xae75('0x47')](handleError(_0x339571,null));};exports[_0xae75('0x27')]=function(_0x442666,_0x10dc98){if(_0x442666[_0xae75('0x4c')]['id']){delete _0x442666['body']['id'];}return db[_0xae75('0x2e')][_0xae75('0x4a')]({'where':{'id':_0x442666['params']['id']}})['then'](handleEntityNotFound(_0x10dc98,null))['then'](saveUpdates(_0x442666[_0xae75('0x4c')],null))[_0xae75('0x28')](respondWithResult(_0x10dc98,null))[_0xae75('0x47')](handleError(_0x10dc98,null));};exports[_0xae75('0x29')]=function(_0x20045d,_0x5552ea){return db[_0xae75('0x2e')][_0xae75('0x4a')]({'where':{'id':_0x20045d[_0xae75('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5552ea,null))[_0xae75('0x28')](removeEntity(_0x5552ea,null))['catch'](handleError(_0x5552ea,null));}; \ No newline at end of file +var _0x96c6=['show','includeAll','find','create','body','update','params','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','save','then','error','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x4cd662,_0x5e81ca){var _0x4f669d=function(_0x5373dd){while(--_0x5373dd){_0x4cd662['push'](_0x4cd662['shift']());}};_0x4f669d(++_0x5e81ca);}(_0x96c6,0xe6));var _0x696c=function(_0x84d56b,_0xc6761d){_0x84d56b=_0x84d56b-0x0;var _0x3a43ed=_0x96c6[_0x84d56b];return _0x3a43ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x696c('0x0'));var jsonpatch=require(_0x696c('0x1'));var rp=require(_0x696c('0x2'));var moment=require(_0x696c('0x3'));var BPromise=require(_0x696c('0x4'));var Mustache=require(_0x696c('0x5'));var util=require(_0x696c('0x6'));var path=require(_0x696c('0x7'));var sox=require(_0x696c('0x8'));var csv=require(_0x696c('0x9'));var ejs=require(_0x696c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x696c('0xb'));var squel=require('squel');var crypto=require(_0x696c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x696c('0x9'));var querystring=require(_0x696c('0xd'));var Papa=require(_0x696c('0xe'));var Redis=require(_0x696c('0xf'));var authService=require(_0x696c('0x10'));var qs=require(_0x696c('0x11'));var as=require(_0x696c('0x12'));var hardwareService=require(_0x696c('0x13'));var logger=require(_0x696c('0x14'))('api');var utils=require(_0x696c('0x15'));var config=require(_0x696c('0x16'));var licenseUtil=require(_0x696c('0x17'));var db=require(_0x696c('0x18'))['db'];function respondWithStatusCode(_0x4f5530,_0xcbbd98){_0xcbbd98=_0xcbbd98||0xcc;return function(_0x2bb012){if(_0x2bb012){return _0x4f5530[_0x696c('0x19')](_0xcbbd98);}return _0x4f5530['status'](_0xcbbd98)[_0x696c('0x1a')]();};}function respondWithResult(_0x3abebc,_0x2cd8af){_0x2cd8af=_0x2cd8af||0xc8;return function(_0x292fc3){if(_0x292fc3){return _0x3abebc['status'](_0x2cd8af)[_0x696c('0x1b')](_0x292fc3);}};}function respondWithFilteredResult(_0x5e8e30,_0x191cf0){return function(_0xdfef67){if(_0xdfef67){var _0xd1e36d=typeof _0x191cf0[_0x696c('0x1c')]===_0x696c('0x1d')&&typeof _0x191cf0[_0x696c('0x1e')]===_0x696c('0x1d');var _0x46fe3c=_0xdfef67[_0x696c('0x1f')];var _0x42e0a1=_0xd1e36d?0x0:_0x191cf0[_0x696c('0x1c')];var _0x19d205=_0xd1e36d?_0xdfef67[_0x696c('0x1f')]:_0x191cf0[_0x696c('0x1c')]+_0x191cf0['limit'];var _0x4c6386;if(_0x19d205>=_0x46fe3c){_0x19d205=_0x46fe3c;_0x4c6386=0xc8;}else{_0x4c6386=0xce;}_0x5e8e30[_0x696c('0x20')](_0x4c6386);return _0x5e8e30[_0x696c('0x21')]('Content-Range',_0x42e0a1+'-'+_0x19d205+'/'+_0x46fe3c)[_0x696c('0x1b')](_0xdfef67);}return null;};}function patchUpdates(_0x47434d){return function(_0x3e3f51){try{jsonpatch['apply'](_0x3e3f51,_0x47434d,!![]);}catch(_0x31707d){return BPromise['reject'](_0x31707d);}return _0x3e3f51[_0x696c('0x22')]();};}function saveUpdates(_0x425225,_0x5ec553){return function(_0x2934ef){if(_0x2934ef){return _0x2934ef['update'](_0x425225)[_0x696c('0x23')](function(_0x47ef3d){return _0x47ef3d;});}return null;};}function removeEntity(_0x4e7a0a,_0x236d13){return function(_0x2dc8e7){if(_0x2dc8e7){return _0x2dc8e7['destroy']()[_0x696c('0x23')](function(){_0x4e7a0a[_0x696c('0x20')](0xcc)[_0x696c('0x1a')]();});}};}function handleEntityNotFound(_0x548b92,_0x17e58c){return function(_0x2c4b67){if(!_0x2c4b67){_0x548b92['sendStatus'](0x194);}return _0x2c4b67;};}function handleError(_0x6e91c0,_0x4408b2){_0x4408b2=_0x4408b2||0x1f4;return function(_0x355c7c){logger[_0x696c('0x24')](_0x355c7c['stack']);if(_0x355c7c[_0x696c('0x25')]){delete _0x355c7c[_0x696c('0x25')];}_0x6e91c0[_0x696c('0x20')](_0x4408b2)[_0x696c('0x26')](_0x355c7c);};}exports[_0x696c('0x27')]=function(_0x495719,_0x1b22a3){var _0x3bf574={},_0x51420c={},_0x30a7a5={'count':0x0,'rows':[]};var _0x2b9087=_['map'](db[_0x696c('0x28')][_0x696c('0x29')],function(_0x36655b){return{'name':_0x36655b[_0x696c('0x2a')],'type':_0x36655b['type']['key']};});_0x51420c[_0x696c('0x2b')]=_[_0x696c('0x2c')](_0x2b9087,_0x696c('0x25'));_0x51420c[_0x696c('0x2d')]=_[_0x696c('0x2e')](_0x495719[_0x696c('0x2d')]);_0x51420c[_0x696c('0x2f')]=_['intersection'](_0x51420c[_0x696c('0x2b')],_0x51420c[_0x696c('0x2d')]);_0x3bf574['attributes']=_[_0x696c('0x30')](_0x51420c[_0x696c('0x2b')],qs[_0x696c('0x31')](_0x495719[_0x696c('0x2d')]['fields']));_0x3bf574['attributes']=_0x3bf574[_0x696c('0x32')][_0x696c('0x33')]?_0x3bf574[_0x696c('0x32')]:_0x51420c['model'];if(!_0x495719[_0x696c('0x2d')][_0x696c('0x34')](_0x696c('0x35'))){_0x3bf574[_0x696c('0x1e')]=qs['limit'](_0x495719['query'][_0x696c('0x1e')]);_0x3bf574[_0x696c('0x1c')]=qs[_0x696c('0x1c')](_0x495719[_0x696c('0x2d')]['offset']);}_0x3bf574['order']=qs[_0x696c('0x36')](_0x495719[_0x696c('0x2d')][_0x696c('0x36')]);_0x3bf574['where']=qs[_0x696c('0x2f')](_[_0x696c('0x37')](_0x495719[_0x696c('0x2d')],_0x51420c[_0x696c('0x2f')]),_0x2b9087);if(_0x495719[_0x696c('0x2d')][_0x696c('0x38')]){_0x3bf574[_0x696c('0x39')]=_[_0x696c('0x3a')](_0x3bf574[_0x696c('0x39')],{'$or':_[_0x696c('0x2c')](_0x2b9087,function(_0x3f94a4){if(_0x3f94a4[_0x696c('0x3b')]!==_0x696c('0x3c')){var _0x212f70={};_0x212f70[_0x3f94a4[_0x696c('0x25')]]={'$like':'%'+_0x495719[_0x696c('0x2d')][_0x696c('0x38')]+'%'};return _0x212f70;}})});}_0x3bf574=_[_0x696c('0x3a')]({},_0x3bf574,_0x495719[_0x696c('0x3d')]);var _0x2d16c0={'where':_0x3bf574[_0x696c('0x39')]};return db['VoiceQueuesLog'][_0x696c('0x1f')](_0x2d16c0)[_0x696c('0x23')](function(_0x413ce5){_0x30a7a5['count']=_0x413ce5;if(_0x495719[_0x696c('0x2d')]['includeAll']){_0x3bf574[_0x696c('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x696c('0x3f')](_0x3bf574);})[_0x696c('0x23')](function(_0x65c663){_0x30a7a5[_0x696c('0x40')]=_0x65c663;return _0x30a7a5;})[_0x696c('0x23')](respondWithFilteredResult(_0x1b22a3,_0x3bf574))[_0x696c('0x41')](handleError(_0x1b22a3,null));};exports[_0x696c('0x42')]=function(_0x42e462,_0x2ca19a){var _0x76874b={'raw':!![],'where':{'id':_0x42e462['params']['id']}},_0x17cd2a={};_0x17cd2a[_0x696c('0x2b')]=_['keys'](db[_0x696c('0x28')]['rawAttributes']);_0x17cd2a[_0x696c('0x2d')]=_[_0x696c('0x2e')](_0x42e462[_0x696c('0x2d')]);_0x17cd2a[_0x696c('0x2f')]=_['intersection'](_0x17cd2a[_0x696c('0x2b')],_0x17cd2a[_0x696c('0x2d')]);_0x76874b[_0x696c('0x32')]=_['intersection'](_0x17cd2a[_0x696c('0x2b')],qs[_0x696c('0x31')](_0x42e462[_0x696c('0x2d')]['fields']));_0x76874b['attributes']=_0x76874b[_0x696c('0x32')][_0x696c('0x33')]?_0x76874b[_0x696c('0x32')]:_0x17cd2a[_0x696c('0x2b')];if(_0x42e462[_0x696c('0x2d')][_0x696c('0x43')]){_0x76874b['include']=[{'all':!![]}];}_0x76874b=_[_0x696c('0x3a')]({},_0x76874b,_0x42e462[_0x696c('0x3d')]);return db[_0x696c('0x28')][_0x696c('0x44')](_0x76874b)[_0x696c('0x23')](handleEntityNotFound(_0x2ca19a,null))[_0x696c('0x23')](respondWithResult(_0x2ca19a,null))[_0x696c('0x41')](handleError(_0x2ca19a,null));};exports[_0x696c('0x45')]=function(_0x1e7b3a,_0x226c88){return db[_0x696c('0x28')]['create'](_0x1e7b3a[_0x696c('0x46')],{})['then'](respondWithResult(_0x226c88,0xc9))[_0x696c('0x41')](handleError(_0x226c88,null));};exports[_0x696c('0x47')]=function(_0x49b444,_0xceecf9){if(_0x49b444[_0x696c('0x46')]['id']){delete _0x49b444[_0x696c('0x46')]['id'];}return db[_0x696c('0x28')]['find']({'where':{'id':_0x49b444[_0x696c('0x48')]['id']}})['then'](handleEntityNotFound(_0xceecf9,null))[_0x696c('0x23')](saveUpdates(_0x49b444[_0x696c('0x46')],null))[_0x696c('0x23')](respondWithResult(_0xceecf9,null))['catch'](handleError(_0xceecf9,null));};exports[_0x696c('0x49')]=function(_0x18dc56,_0x445266){return db[_0x696c('0x28')][_0x696c('0x44')]({'where':{'id':_0x18dc56['params']['id']}})[_0x696c('0x23')](handleEntityNotFound(_0x445266,null))['then'](removeEntity(_0x445266,null))[_0x696c('0x41')](handleError(_0x445266,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d798501..cf12082 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 _0xe343=['./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x561a34,_0x3c02c6){var _0x29bd3f=function(_0x1eb9b2){while(--_0x1eb9b2){_0x561a34['push'](_0x561a34['shift']());}};_0x29bd3f(++_0x3c02c6);}(_0xe343,0x6e));var _0x3e34=function(_0x412818,_0xe8171a){_0x412818=_0x412818-0x0;var _0x2d40d1=_0xe343[_0x412818];return _0x2d40d1;};'use strict';var _=require(_0x3e34('0x0'));var util=require(_0x3e34('0x1'));var logger=require(_0x3e34('0x2'))('api');var moment=require(_0x3e34('0x3'));var BPromise=require(_0x3e34('0x4'));var rp=require(_0x3e34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e34('0x6'));var attributes=require(_0x3e34('0x7'));module[_0x3e34('0x8')]=function(_0x2b0223,_0x418c19){return _0x2b0223[_0x3e34('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x3e34('0xa'),'paranoid':![],'indexes':[{'name':_0x3e34('0xb'),'fields':[_0x3e34('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x57b8=['define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x2f1b61,_0x3b7bc5){var _0x23a054=function(_0x16f61a){while(--_0x16f61a){_0x2f1b61['push'](_0x2f1b61['shift']());}};_0x23a054(++_0x3b7bc5);}(_0x57b8,0x17c));var _0x857b=function(_0x4e6004,_0x2bf8ec){_0x4e6004=_0x4e6004-0x0;var _0x3d497a=_0x57b8[_0x4e6004];return _0x3d497a;};'use strict';var _=require(_0x857b('0x0'));var util=require(_0x857b('0x1'));var logger=require(_0x857b('0x2'))(_0x857b('0x3'));var moment=require('moment');var BPromise=require(_0x857b('0x4'));var rp=require(_0x857b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x857b('0x6'));var config=require(_0x857b('0x7'));var attributes=require(_0x857b('0x8'));module[_0x857b('0x9')]=function(_0x1b29cb,_0x3923e0){return _0x1b29cb[_0x857b('0xa')](_0x857b('0xb'),attributes,{'tableName':_0x857b('0xc'),'paranoid':![],'indexes':[{'name':_0x857b('0xd'),'fields':[_0x857b('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 49859b7..9210480 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 _0xc1e8=['rpc','../../config/environment','jayson/promise','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b2bb5,_0x315f28){var _0x5a7973=function(_0x51c96a){while(--_0x51c96a){_0x3b2bb5['push'](_0x3b2bb5['shift']());}};_0x5a7973(++_0x315f28);}(_0xc1e8,0x87));var _0x8c1e=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0xc1e8[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var moment=require(_0x8c1e('0x2'));var BPromise=require(_0x8c1e('0x3'));var rs=require(_0x8c1e('0x4'));var fs=require('fs');var Redis=require(_0x8c1e('0x5'));var db=require(_0x8c1e('0x6'))['db'];var utils=require(_0x8c1e('0x7'));var logger=require(_0x8c1e('0x8'))(_0x8c1e('0x9'));var config=require(_0x8c1e('0xa'));var jayson=require(_0x8c1e('0xb'));var client=jayson['client'][_0x8c1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x310103,_0x2b9f52,_0x5e6d1b){return new BPromise(function(_0x3c120a,_0x3d6703){return client[_0x8c1e('0xd')](_0x310103,_0x5e6d1b)[_0x8c1e('0xe')](function(_0x20ded3){logger['info'](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2b9f52,'request\x20sent',JSON[_0x8c1e('0x11')](_0x20ded3));if(_0x20ded3['error']){if(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x13')]===0x1f4){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')]['message']);return _0x3d6703(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);return _0x3c120a(_0x20ded3[_0x8c1e('0x12')][_0x8c1e('0x14')]);}else{logger[_0x8c1e('0x15')](_0x8c1e('0xf'),_0x2b9f52,_0x8c1e('0x10'));_0x3c120a(_0x20ded3[_0x8c1e('0x16')]['message']);}})[_0x8c1e('0x17')](function(_0x1a3497){logger[_0x8c1e('0x12')](_0x8c1e('0xf'),_0x2b9f52,_0x1a3497);_0x3d6703(_0x1a3497);});});} \ No newline at end of file +var _0x8b4f=['code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x161e88,_0x49ce5e){var _0x40ee62=function(_0x2c4660){while(--_0x2c4660){_0x161e88['push'](_0x161e88['shift']());}};_0x40ee62(++_0x49ce5e);}(_0x8b4f,0x19d));var _0xf8b4=function(_0xe89d97,_0x33e5ac){_0xe89d97=_0xe89d97-0x0;var _0x1b6e5d=_0x8b4f[_0xe89d97];return _0x1b6e5d;};'use strict';var _=require(_0xf8b4('0x0'));var util=require(_0xf8b4('0x1'));var moment=require('moment');var BPromise=require(_0xf8b4('0x2'));var rs=require(_0xf8b4('0x3'));var fs=require('fs');var Redis=require(_0xf8b4('0x4'));var db=require(_0xf8b4('0x5'))['db'];var utils=require(_0xf8b4('0x6'));var logger=require(_0xf8b4('0x7'))(_0xf8b4('0x8'));var config=require(_0xf8b4('0x9'));var jayson=require(_0xf8b4('0xa'));var client=jayson['client'][_0xf8b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e96b2,_0x2e010c,_0x4ea89e){return new BPromise(function(_0x441362,_0x668d5e){return client[_0xf8b4('0xc')](_0x1e96b2,_0x4ea89e)[_0xf8b4('0xd')](function(_0x1fe22a){logger[_0xf8b4('0xe')](_0xf8b4('0xf'),_0x2e010c,'request\x20sent');logger['debug'](_0xf8b4('0x10'),_0x2e010c,'request\x20sent',JSON[_0xf8b4('0x11')](_0x1fe22a));if(_0x1fe22a[_0xf8b4('0x12')]){if(_0x1fe22a[_0xf8b4('0x12')][_0xf8b4('0x13')]===0x1f4){logger[_0xf8b4('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2e010c,_0x1fe22a['error'][_0xf8b4('0x14')]);return _0x668d5e(_0x1fe22a[_0xf8b4('0x12')][_0xf8b4('0x14')]);}logger[_0xf8b4('0x12')](_0xf8b4('0xf'),_0x2e010c,_0x1fe22a[_0xf8b4('0x12')][_0xf8b4('0x14')]);return _0x441362(_0x1fe22a[_0xf8b4('0x12')][_0xf8b4('0x14')]);}else{logger[_0xf8b4('0xe')](_0xf8b4('0xf'),_0x2e010c,_0xf8b4('0x15'));_0x441362(_0x1fe22a[_0xf8b4('0x16')][_0xf8b4('0x14')]);}})[_0xf8b4('0x17')](function(_0x5685b2){logger[_0xf8b4('0x12')](_0xf8b4('0xf'),_0x2e010c,_0x5685b2);_0x668d5e(_0x5685b2);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c35697f..209f3b1 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 _0x628f=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update'];(function(_0x3a0b8a,_0x50cb91){var _0x204d8a=function(_0x45fcc9){while(--_0x45fcc9){_0x3a0b8a['push'](_0x3a0b8a['shift']());}};_0x204d8a(++_0x50cb91);}(_0x628f,0xab));var _0xf628=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x628f[_0x14e393];return _0x5b5ffa;};'use strict';var multer=require(_0xf628('0x0'));var util=require(_0xf628('0x1'));var path=require('path');var timeout=require(_0xf628('0x2'));var express=require(_0xf628('0x3'));var router=express[_0xf628('0x4')]();var fs_extra=require(_0xf628('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf628('0x6'));var controller=require(_0xf628('0x7'));router['get']('/',auth[_0xf628('0x8')](),controller[_0xf628('0x9')]);router[_0xf628('0xa')](_0xf628('0xb'),auth[_0xf628('0x8')](),controller[_0xf628('0xc')]);router[_0xf628('0xa')](_0xf628('0xd'),auth[_0xf628('0x8')](),controller['show']);router[_0xf628('0xa')](_0xf628('0xe'),auth['isAuthenticated'](),controller[_0xf628('0xf')]);router[_0xf628('0xa')](_0xf628('0x10'),controller[_0xf628('0x11')]);router[_0xf628('0xa')](_0xf628('0x12'),auth[_0xf628('0x8')](),controller[_0xf628('0x13')]);router[_0xf628('0x14')]('/',auth[_0xf628('0x8')](),controller[_0xf628('0x15')]);router[_0xf628('0x14')](_0xf628('0x12'),auth[_0xf628('0x8')](),controller[_0xf628('0x16')]);router[_0xf628('0x17')](_0xf628('0xd'),auth['isAuthenticated'](),controller[_0xf628('0x18')]);router[_0xf628('0x19')](_0xf628('0xd'),auth[_0xf628('0x8')](),controller[_0xf628('0x1a')]);module[_0xf628('0x1b')]=router; \ No newline at end of file +var _0x11fc=['/describe','describe','/:id','show','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2b2d33,_0x364135){var _0x29d035=function(_0x2eeb8e){while(--_0x2eeb8e){_0x2b2d33['push'](_0x2b2d33['shift']());}};_0x29d035(++_0x364135);}(_0x11fc,0xa3));var _0xc11f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x11fc[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xc11f('0x0'));var util=require(_0xc11f('0x1'));var path=require(_0xc11f('0x2'));var timeout=require(_0xc11f('0x3'));var express=require(_0xc11f('0x4'));var router=express[_0xc11f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc11f('0x6'));var interaction=require(_0xc11f('0x7'));var config=require(_0xc11f('0x8'));var controller=require('./voiceRecording.controller');router[_0xc11f('0x9')]('/',auth[_0xc11f('0xa')](),controller[_0xc11f('0xb')]);router[_0xc11f('0x9')](_0xc11f('0xc'),auth['isAuthenticated'](),controller[_0xc11f('0xd')]);router[_0xc11f('0x9')](_0xc11f('0xe'),auth[_0xc11f('0xa')](),controller[_0xc11f('0xf')]);router[_0xc11f('0x9')]('/:id/download',auth[_0xc11f('0xa')](),controller[_0xc11f('0x10')]);router[_0xc11f('0x9')](_0xc11f('0x11'),controller['downloads']);router['get'](_0xc11f('0x12'),auth[_0xc11f('0xa')](),controller[_0xc11f('0x13')]);router[_0xc11f('0x14')]('/',auth[_0xc11f('0xa')](),controller[_0xc11f('0x15')]);router['post']('/:id/transcribe',auth[_0xc11f('0xa')](),controller['runTranscribe']);router[_0xc11f('0x16')](_0xc11f('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xc11f('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc11f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index bc4662f..1599337 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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 494b96c..518ced5 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 _0x9485=['sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','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','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../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','reject','save','update','then','destroy','error','stack','send','index','map','VoiceRecording','rawAttributes','type','key','model','name','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','include','catch','params','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','push','$and','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured'];(function(_0x573b67,_0x40bada){var _0x53a235=function(_0x57c7ad){while(--_0x57c7ad){_0x573b67['push'](_0x573b67['shift']());}};_0x53a235(++_0x40bada);}(_0x9485,0x1d7));var _0x5948=function(_0x43c742,_0x130c38){_0x43c742=_0x43c742-0x0;var _0x3159cf=_0x9485[_0x43c742];return _0x3159cf;};'use strict';var emlformat=require(_0x5948('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5948('0x1'));var jsonpatch=require(_0x5948('0x2'));var rp=require(_0x5948('0x3'));var moment=require(_0x5948('0x4'));var BPromise=require(_0x5948('0x5'));var Mustache=require(_0x5948('0x6'));var util=require('util');var path=require(_0x5948('0x7'));var sox=require(_0x5948('0x8'));var csv=require(_0x5948('0x9'));var ejs=require(_0x5948('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5948('0xb'));var squel=require('squel');var crypto=require(_0x5948('0xc'));var jsforce=require(_0x5948('0xd'));var deskjs=require(_0x5948('0xe'));var toCsv=require(_0x5948('0x9'));var querystring=require('querystring');var Papa=require(_0x5948('0xf'));var AWS=require(_0x5948('0x10'));var uuidv4=require(_0x5948('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5948('0x12'));var as=require(_0x5948('0x13'));var hardwareService=require(_0x5948('0x14'));var logger=require(_0x5948('0x15'))('api');var utils=require(_0x5948('0x16'));var config=require(_0x5948('0x17'));var licenseUtil=require(_0x5948('0x18'));var db=require(_0x5948('0x19'))['db'];function respondWithStatusCode(_0x5a2832,_0xc59ce2){_0xc59ce2=_0xc59ce2||0xcc;return function(_0x32adb8){if(_0x32adb8){return _0x5a2832[_0x5948('0x1a')](_0xc59ce2);}return _0x5a2832[_0x5948('0x1b')](_0xc59ce2)[_0x5948('0x1c')]();};}function respondWithResult(_0x172291,_0x260234){_0x260234=_0x260234||0xc8;return function(_0x332a2b){if(_0x332a2b){return _0x172291[_0x5948('0x1b')](_0x260234)[_0x5948('0x1d')](_0x332a2b);}};}function respondWithFilteredResult(_0x3ffbcd,_0x1f7f53){return function(_0x1b9011){if(_0x1b9011){var _0x1636e3=typeof _0x1f7f53[_0x5948('0x1e')]===_0x5948('0x1f')&&typeof _0x1f7f53[_0x5948('0x20')]===_0x5948('0x1f');var _0x39156b=_0x1b9011['count'];var _0x1a2f9f=_0x1636e3?0x0:_0x1f7f53[_0x5948('0x1e')];var _0x214e7a=_0x1636e3?_0x1b9011[_0x5948('0x21')]:_0x1f7f53[_0x5948('0x1e')]+_0x1f7f53[_0x5948('0x20')];var _0x21f30e;if(_0x214e7a>=_0x39156b){_0x214e7a=_0x39156b;_0x21f30e=0xc8;}else{_0x21f30e=0xce;}_0x3ffbcd['status'](_0x21f30e);return _0x3ffbcd[_0x5948('0x22')](_0x5948('0x23'),_0x1a2f9f+'-'+_0x214e7a+'/'+_0x39156b)['json'](_0x1b9011);}return null;};}function patchUpdates(_0x236e6f){return function(_0x50c594){try{jsonpatch['apply'](_0x50c594,_0x236e6f,!![]);}catch(_0x39636c){return BPromise[_0x5948('0x24')](_0x39636c);}return _0x50c594[_0x5948('0x25')]();};}function saveUpdates(_0x2dfcc7,_0x301069){return function(_0x581cab){if(_0x581cab){return _0x581cab[_0x5948('0x26')](_0x2dfcc7)[_0x5948('0x27')](function(_0x425169){return _0x425169;});}return null;};}function removeEntity(_0x2e461a,_0x1e029c){return function(_0x3edb73){if(_0x3edb73){return _0x3edb73[_0x5948('0x28')]()[_0x5948('0x27')](function(){_0x2e461a[_0x5948('0x1b')](0xcc)[_0x5948('0x1c')]();});}};}function handleEntityNotFound(_0xca10ce,_0x588d3c){return function(_0x22123a){if(!_0x22123a){_0xca10ce[_0x5948('0x1a')](0x194);}return _0x22123a;};}function handleError(_0x10e005,_0xa42498){_0xa42498=_0xa42498||0x1f4;return function(_0xb39e47){logger[_0x5948('0x29')](_0xb39e47[_0x5948('0x2a')]);if(_0xb39e47['name']){delete _0xb39e47['name'];}_0x10e005[_0x5948('0x1b')](_0xa42498)[_0x5948('0x2b')](_0xb39e47);};}exports[_0x5948('0x2c')]=function(_0x295bdf,_0x2b1b94){var _0x30c672={},_0x36e44d={},_0x56be7a={'count':0x0,'rows':[]};var _0x19a404=_[_0x5948('0x2d')](db[_0x5948('0x2e')][_0x5948('0x2f')],function(_0xad083a){return{'name':_0xad083a['fieldName'],'type':_0xad083a[_0x5948('0x30')][_0x5948('0x31')]};});_0x36e44d[_0x5948('0x32')]=_['differenceBy'](_[_0x5948('0x2d')](_0x19a404,_0x5948('0x33')),[_0x5948('0x34')]);_0x36e44d[_0x5948('0x35')]=_[_0x5948('0x36')](_0x295bdf[_0x5948('0x35')]);_0x36e44d[_0x5948('0x37')]=_['intersection'](_0x36e44d[_0x5948('0x32')],_0x36e44d[_0x5948('0x35')]);_0x30c672[_0x5948('0x38')]=_[_0x5948('0x39')](_0x36e44d[_0x5948('0x32')],qs[_0x5948('0x3a')](_0x295bdf[_0x5948('0x35')]['fields']));_0x30c672['attributes']=_0x30c672['attributes'][_0x5948('0x3b')]?_0x30c672['attributes']:_0x36e44d['model'];if(!_0x295bdf[_0x5948('0x35')]['hasOwnProperty']('nolimit')){_0x30c672[_0x5948('0x20')]=qs['limit'](_0x295bdf[_0x5948('0x35')]['limit']);_0x30c672[_0x5948('0x1e')]=qs[_0x5948('0x1e')](_0x295bdf[_0x5948('0x35')][_0x5948('0x1e')]);}_0x30c672[_0x5948('0x3c')]=qs[_0x5948('0x3d')](_0x295bdf[_0x5948('0x35')][_0x5948('0x3d')]);_0x30c672[_0x5948('0x3e')]=qs[_0x5948('0x37')](_[_0x5948('0x3f')](_0x295bdf[_0x5948('0x35')],_0x36e44d['filters']),_0x19a404);if(_0x295bdf[_0x5948('0x35')][_0x5948('0x40')]){_0x30c672[_0x5948('0x3e')]=_['merge'](_0x30c672['where'],{'$or':_[_0x5948('0x2d')](_0x19a404,function(_0x34d44a){if(_0x34d44a['type']!==_0x5948('0x41')){var _0x2a8c23={};_0x2a8c23[_0x34d44a[_0x5948('0x33')]]={'$like':'%'+_0x295bdf['query'][_0x5948('0x40')]+'%'};return _0x2a8c23;}})});}_0x30c672=_[_0x5948('0x42')]({},_0x30c672,_0x295bdf['options']);var _0x1522fa={'where':_0x30c672[_0x5948('0x3e')]};return db[_0x5948('0x2e')][_0x5948('0x21')](_0x1522fa)['then'](function(_0xc8c44d){_0x56be7a[_0x5948('0x21')]=_0xc8c44d;if(_0x295bdf['query']['includeAll']){_0x30c672[_0x5948('0x43')]=[{'all':!![]}];}return db[_0x5948('0x2e')]['findAll'](_0x30c672);})[_0x5948('0x27')](function(_0x3b6e67){_0x56be7a['rows']=_0x3b6e67;return _0x56be7a;})['then'](respondWithFilteredResult(_0x2b1b94,_0x30c672))[_0x5948('0x44')](handleError(_0x2b1b94,null));};exports['show']=function(_0x533899,_0x4f960c){var _0x1b0e5f={'raw':![],'where':{'id':_0x533899[_0x5948('0x45')]['id']}},_0x4151df={};_0x4151df[_0x5948('0x32')]=_[_0x5948('0x36')](db[_0x5948('0x2e')][_0x5948('0x2f')]);_0x4151df[_0x5948('0x35')]=_[_0x5948('0x36')](_0x533899[_0x5948('0x35')]);_0x4151df['filters']=_[_0x5948('0x39')](_0x4151df[_0x5948('0x32')],_0x4151df[_0x5948('0x35')]);_0x1b0e5f[_0x5948('0x38')]=_[_0x5948('0x39')](_0x4151df[_0x5948('0x32')],qs['fields'](_0x533899[_0x5948('0x35')]['fields']));_0x1b0e5f[_0x5948('0x38')]=_0x1b0e5f[_0x5948('0x38')]['length']?_0x1b0e5f['attributes']:_0x4151df[_0x5948('0x32')];if(_0x533899[_0x5948('0x35')]['includeAll']){_0x1b0e5f[_0x5948('0x43')]=[{'all':!![]}];}_0x1b0e5f=_[_0x5948('0x42')]({},_0x1b0e5f,_0x533899['options']);return db[_0x5948('0x2e')]['find'](_0x1b0e5f)[_0x5948('0x27')](handleEntityNotFound(_0x4f960c,null))[_0x5948('0x27')](respondWithResult(_0x4f960c,null))['catch'](handleError(_0x4f960c,null));};exports['create']=function(_0x154fa3,_0x3555a8){return db[_0x5948('0x2e')][_0x5948('0x46')](_0x154fa3[_0x5948('0x47')],{})[_0x5948('0x27')](respondWithResult(_0x3555a8,0xc9))['catch'](handleError(_0x3555a8,null));};exports[_0x5948('0x26')]=function(_0x2fc147,_0x91aef8){if(_0x2fc147['body']['id']){delete _0x2fc147[_0x5948('0x47')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x2fc147[_0x5948('0x45')]['id']}})[_0x5948('0x27')](handleEntityNotFound(_0x91aef8,null))[_0x5948('0x27')](saveUpdates(_0x2fc147[_0x5948('0x47')],null))[_0x5948('0x27')](respondWithResult(_0x91aef8,null))[_0x5948('0x44')](handleError(_0x91aef8,null));};exports[_0x5948('0x48')]=function(_0x45e763,_0x18cf29){return db[_0x5948('0x2e')][_0x5948('0x48')]()[_0x5948('0x27')](respondWithResult(_0x18cf29,null))[_0x5948('0x44')](handleError(_0x18cf29,null));};exports[_0x5948('0x49')]=function(_0x45485d,_0x577601,_0x5c4b3e){var _0x426610=require(_0x5948('0x4a'));var _0x3be525=![];var _0x45c53e={};if(_0x45485d[_0x5948('0x35')][_0x5948('0x30')]&&_0x45485d[_0x5948('0x35')][_0x5948('0x30')]==='uniqueid'){_0x45c53e[_0x5948('0x4b')]=_0x45485d[_0x5948('0x45')]['id'];}else{_0x45c53e['id']=_0x45485d['params']['id'];}return db[_0x5948('0x2e')][_0x5948('0x4c')]({'where':_0x45c53e,'attributes':['id',_0x5948('0x4d')],'raw':!![]})[_0x5948('0x27')](handleEntityNotFound(_0x577601,null))[_0x5948('0x27')](function(_0x14b142){if(_0x14b142){var _0x55190e=_0x14b142[_0x5948('0x4d')];var _0x508df5=util[_0x5948('0x34')](_0x5948('0x4e'),_0x55190e);if(fs[_0x5948('0x4f')](_0x508df5)){_0x3be525=!![];return _0x426610[_0x5948('0x50')](_0x508df5,_0x55190e,config[_0x5948('0x51')][_0x5948('0x52')])['then'](function(){return _0x14b142;});}return _0x14b142;}})['then'](function(_0x788496){if(_0x788496){var _0x579af9=_0x788496['value'];if(!fs['existsSync'](_0x579af9)){throw new db[(_0x5948('0x53'))]['ValidationError'](_0x5948('0x54'));}if(_0x788496[_0x5948('0x55')]){return _0x577601['download'](_0x579af9,_0x788496[_0x5948('0x55')]+path[_0x5948('0x56')](_0x579af9),function(){if(_0x3be525){fs[_0x5948('0x57')](_0x579af9);}});}else{return _0x577601[_0x5948('0x49')](_0x579af9,function(_0x1ed703){if(_0x3be525){fs[_0x5948('0x57')](_0x579af9);}});}}})[_0x5948('0x44')](function(_0x3c06c5){if(_0x3c06c5[_0x5948('0x58')]===_0x5948('0x54')){_0x577601[_0x5948('0x1b')](0x194)[_0x5948('0x2b')]('Not\x20found');}else{return handleError(_0x577601,null);}});};exports[_0x5948('0x59')]=function(_0x1d0068,_0x2a84ef,_0x57ffe3){var _0x4ddfba=require(_0x5948('0x4a'));var _0x368df6=![];var _0x3b009e={'$and':[db[_0x5948('0x5a')][_0x5948('0x3e')](db[_0x5948('0x5a')]['fn']('MD5',db['sequelize'][_0x5948('0x5b')](_0x5948('0x4b'))),_0x1d0068[_0x5948('0x35')]['token'])]};if(_0x1d0068[_0x5948('0x35')][_0x5948('0x30')]&&_0x1d0068[_0x5948('0x35')][_0x5948('0x30')]===_0x5948('0x4b')){_0x3b009e['$and'][_0x5948('0x5c')]({'uniqueid':_0x1d0068['params']['id']});}else{_0x3b009e[_0x5948('0x5d')][_0x5948('0x5c')]({'id':_0x1d0068[_0x5948('0x45')]['id']});}return db[_0x5948('0x2e')][_0x5948('0x4c')]({'where':_0x3b009e,'attributes':['id',_0x5948('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x2a84ef,null))['then'](function(_0x105375){if(_0x105375){var _0x52df52=util[_0x5948('0x34')](_0x5948('0x4e'),_0x105375['value']);if(fs[_0x5948('0x4f')](_0x52df52)){_0x368df6=!![];return _0x4ddfba['decryptFile'](_0x52df52,_0x105375['value'],config[_0x5948('0x51')][_0x5948('0x52')])[_0x5948('0x27')](function(){return _0x105375;});}return _0x105375;}})[_0x5948('0x27')](function(_0xc14e11){if(_0xc14e11){if(!fs[_0x5948('0x4f')](_0xc14e11[_0x5948('0x4d')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xc14e11[_0x5948('0x55')]){return _0x2a84ef[_0x5948('0x49')](_0xc14e11[_0x5948('0x4d')],_0xc14e11[_0x5948('0x55')]+path[_0x5948('0x56')](_0xc14e11['value']),function(){if(_0x368df6){fs[_0x5948('0x57')](_0xc14e11['value']);}});}else{return _0x2a84ef[_0x5948('0x49')](_0xc14e11[_0x5948('0x4d')],function(_0xa22d9a){if(_0x368df6){fs[_0x5948('0x57')](_0xc14e11[_0x5948('0x4d')]);}});}}})[_0x5948('0x44')](handleError(_0x2a84ef,null));};exports[_0x5948('0x28')]=function(_0x328de5,_0x1a71f2){return db[_0x5948('0x2e')]['find']({'where':{'id':_0x328de5[_0x5948('0x45')]['id']}})[_0x5948('0x27')](function(_0x2159bd){if(_['isNil'](_0x2159bd)){throw new ReferenceError(_0x5948('0x5e'));}return _0x2159bd;})[_0x5948('0x27')](function(_0x182a2f){var _0x4dc0ea=_0x182a2f[_0x5948('0x4d')];logger[_0x5948('0x5f')](_0x5948('0x60'),_0x4dc0ea);if(!_[_0x5948('0x61')](_0x182a2f[_0x5948('0x4d')])&&fs[_0x5948('0x4f')](_0x4dc0ea)){logger[_0x5948('0x5f')](_0x5948('0x62')+_0x4dc0ea+_0x5948('0x63'));fs['unlinkSync'](_0x4dc0ea);}_0x4dc0ea=_0x4dc0ea+_0x5948('0x64');if(!_[_0x5948('0x61')](_0x182a2f[_0x5948('0x4d')])&&fs['existsSync'](_0x4dc0ea)){logger[_0x5948('0x5f')]('File:\x20\x22'+_0x4dc0ea+_0x5948('0x63'));fs[_0x5948('0x65')](_0x4dc0ea);}return _0x182a2f;})['then'](function(_0x2ddacb){if(!_0x2ddacb)throw new InternalError();return _0x2ddacb[_0x5948('0x28')]();})[_0x5948('0x27')](function(){_0x1a71f2[_0x5948('0x1b')](0xcc)[_0x5948('0x1c')]();})[_0x5948('0x44')](handleError(_0x1a71f2,null));};function getBucketslist(_0x1f79e1,_0x312f72,_0x5ad2d5){return new Promise(function(_0x4a28ad,_0x184739){var _0x3dac34=new AWS['S3']({'accessKeyId':_0x312f72,'secretAccessKey':_0x1f79e1,'region':_0x5ad2d5});_0x3dac34[_0x5948('0x66')]({},function(_0x2589e4,_0x3aea48){if(_0x2589e4){return _0x184739(_0x2589e4);}else{return _0x4a28ad(_0x3aea48);}});});}function createBucket(_0x559506,_0x3975b9,_0x5230bc,_0x3b307f){return new Promise(function(_0x86f30f,_0x474ddd){var _0x14a58e=new AWS['S3']({'accessKeyId':_0x3975b9,'secretAccessKey':_0x559506,'region':_0x5230bc});_0x14a58e[_0x5948('0x67')]({'Bucket':_0x3b307f},function(_0x23ed6b,_0x3c4bb0){if(_0x23ed6b){return _0x474ddd(_0x23ed6b);}else{return _0x86f30f(_0x3c4bb0);}});});}function uploadFile(_0x585311,_0x3b5440,_0x226e8f,_0x37ec5f,_0x2b5eb4,_0x2d54f2){return new Promise(function(_0x158aa4,_0x2080bc){var _0x406662=new AWS['S3']({'accessKeyId':_0x3b5440,'secretAccessKey':_0x585311,'region':_0x226e8f});_0x406662[_0x5948('0x68')]({'Bucket':_0x37ec5f,'Key':_0x2b5eb4,'Body':_0x2d54f2},function(_0x24145b,_0x23243c){if(_0x24145b){return _0x2080bc(_0x24145b);}else{return _0x158aa4(_0x23243c);}});});}function startTranscribe(_0x375344,_0x9e21b1,_0x27752c,_0x3e6427,_0x34ba0d,_0x41c982){return new Promise(function(_0x868f93,_0x2399b7){var _0x2db6d0=new AWS['TranscribeService']({'accessKeyId':_0x9e21b1,'secretAccessKey':_0x375344,'region':_0x27752c});_0x2db6d0[_0x5948('0x69')]({'TranscriptionJobName':_0x3e6427,'LanguageCode':_0x34ba0d,'Media':{'MediaFileUri':_0x41c982}},function(_0x245787,_0x42efba){if(_0x245787){return _0x2399b7(_0x245787);}else{return _0x868f93(_0x42efba);}});});}function transcribe(_0x394fff,_0x4c880d,_0x112419,_0x582eec,_0x163c42,_0x602b,_0x4c67d1){return new Promise(function(_0x2e8610,_0x5b2a4c){var _0x5e9205={};logger[_0x5948('0x5f')](util[_0x5948('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x394fff,_0x163c42));return uploadFile(_0x4c880d,_0x112419,_0x582eec,_0x163c42,path['basename'](_0x602b),fs['readFileSync'](_0x602b))[_0x5948('0x27')](function(_0x223c43){logger[_0x5948('0x5f')](util['format'](_0x5948('0x6a'),_0x394fff,_0x163c42,_0x223c43[_0x5948('0x6b')]));_0x5e9205['bucket']=_0x223c43[_0x5948('0x6c')];_0x5e9205['location']=_0x223c43['Location'];logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x6d'),_0x394fff));return startTranscribe(_0x4c880d,_0x112419,_0x582eec,uuidv4(),_0x4c67d1,_0x223c43[_0x5948('0x6b')]);})[_0x5948('0x27')](function(_0x49aa99){logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x6e'),_0x394fff,_0x49aa99['TranscriptionJob'][_0x5948('0x6f')]));_0x5e9205[_0x5948('0x70')]=_0x49aa99['TranscriptionJob']['TranscriptionJobName'];_0x5e9205[_0x5948('0x71')]=_0x49aa99[_0x5948('0x72')][_0x5948('0x73')];return _0x2e8610(_0x5e9205);})[_0x5948('0x44')](function(_0x52817b){return _0x5b2a4c(_0x52817b);});});}exports[_0x5948('0x74')]=function(_0x719634,_0x45df14,_0x27f340){var _0x4ac5eb;var _0x4a8b8c;var _0x27ceba;var _0x3ff873=require(_0x5948('0x4a'));return db['VoiceRecording']['findOne']({'where':{'id':_0x719634['params']['id']}})[_0x5948('0x27')](function(_0x17ead7){if(_0x17ead7){var _0x1b933f=util[_0x5948('0x34')](_0x5948('0x4e'),_0x17ead7['value']);if(fs[_0x5948('0x4f')](_0x1b933f)){cypher=!![];return _0x3ff873['decryptFile'](_0x1b933f,_0x17ead7[_0x5948('0x4d')],config['secrets'][_0x5948('0x52')])['then'](function(){return _0x17ead7;});}return _0x17ead7;}})[_0x5948('0x27')](function(_0x168b41){if(!_0x168b41){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x76'));}_0x4a8b8c=_0x168b41;return db[_0x5948('0x77')]['findOne']({'where':{'id':0x1}});})[_0x5948('0x27')](handleEntityNotFound(_0x45df14,null))[_0x5948('0x27')](function(_0x56e5ed){if(_0x56e5ed){_0x4ac5eb=_0x56e5ed;if(!_0x4ac5eb[_0x5948('0x78')]||!_0x4ac5eb[_0x5948('0x79')]||!_0x4ac5eb[_0x5948('0x7a')]||!_0x4ac5eb[_0x5948('0x7b')]||!_0x4ac5eb['bucket']){throw new db['Sequelize'][(_0x5948('0x75'))](_0x5948('0x7c'));}if(_0x719634[_0x5948('0x47')]['runSentiment']&&(!_0x4ac5eb[_0x5948('0x7d')]||!_0x4ac5eb[_0x5948('0x7e')]||!_0x4ac5eb[_0x5948('0x7f')]||!_0x4ac5eb[_0x5948('0x7b')]||!_0x4ac5eb[_0x5948('0x80')])){throw new db['Sequelize'][(_0x5948('0x75'))](_0x5948('0x81'));}return db[_0x5948('0x82')][_0x5948('0x83')]({'where':{'id':_0x4ac5eb[_0x5948('0x79')]}});}})[_0x5948('0x27')](function(_0x23ab5f){if(!_0x23ab5f){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x84'));}if(!_0x23ab5f[_0x5948('0x85')]||!_0x23ab5f[_0x5948('0x86')]){throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x87'));}_0x27ceba=_0x23ab5f;return getBucketslist(_0x27ceba[_0x5948('0x85')],_0x27ceba['data2'],_0x4ac5eb['transcribeRegion']);})['then'](function(_0x59bcd6){if(_0x59bcd6&&_0x59bcd6[_0x5948('0x88')]){var _0x23d341=_[_0x5948('0x4c')](_0x59bcd6[_0x5948('0x88')],function(_0x556372){return _0x556372[_0x5948('0x89')]===_0x4ac5eb[_0x5948('0x80')];});if(!_0x23d341){logger[_0x5948('0x5f')](util[_0x5948('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x719634[_0x5948('0x45')]['id'],_0x4ac5eb[_0x5948('0x80')]));return createBucket(_0x27ceba[_0x5948('0x85')],_0x27ceba[_0x5948('0x86')],_0x4ac5eb[_0x5948('0x7a')],_0x4ac5eb[_0x5948('0x80')]);}logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x8a'),_0x719634[_0x5948('0x45')]['id'],_0x4ac5eb[_0x5948('0x80')]));return;}})['then'](function(_0x14f235){if(_0x4a8b8c[_0x5948('0x71')]===_0x5948('0x8b')){return transcribe(_0x719634[_0x5948('0x45')]['id'],_0x27ceba[_0x5948('0x85')],_0x27ceba['data2'],_0x4ac5eb[_0x5948('0x7a')],_0x4ac5eb[_0x5948('0x80')],_0x4a8b8c[_0x5948('0x4d')],_0x4ac5eb[_0x5948('0x7b')]);}else{logger[_0x5948('0x5f')](util[_0x5948('0x34')](_0x5948('0x8c'),_0x719634[_0x5948('0x45')]['id']));return{'transcribeStatus':_0x5948('0x8d')};}})['then'](function(_0x213eb7){if(_0x213eb7){_0x213eb7['tempSentiment']=_0x719634[_0x5948('0x47')]['runSentiment'];return _0x4a8b8c['updateAttributes'](_0x213eb7);}})[_0x5948('0x27')](respondWithResult(_0x45df14,null))['catch'](handleError(_0x45df14,null));};function writeFile(_0x108c93,_0x3f73dd){return new Promise(function(_0x502e8e,_0x11932e){fs[_0x5948('0x8e')](_0x3f73dd,_0x108c93,function(_0x597d4b,_0x36d5b1){if(_0x597d4b){return _0x11932e(_0x597d4b);}else{return _0x502e8e(_0x36d5b1);}});});}exports[_0x5948('0x8f')]=function(_0x5d590e,_0x1815b9,_0x412929){return db[_0x5948('0x2e')][_0x5948('0x83')]({'where':{'id':_0x5d590e[_0x5948('0x45')]['id']}})[_0x5948('0x27')](handleEntityNotFound(_0x1815b9))[_0x5948('0x27')](function(_0x35d444){if(_0x35d444&&_0x35d444[_0x5948('0x90')]){var _0x4c4127=_0x35d444[_0x5948('0x90')];var _0x547434=config[_0x5948('0x91')]+_0x5948('0x92')+_0x35d444['id']+_0x5948('0x93');if(fs[_0x5948('0x4f')](_0x547434)){return _0x547434;}return writeFile(_0x4c4127,_0x547434)[_0x5948('0x27')](function(){return _0x547434;});}else{throw new db[(_0x5948('0x53'))][(_0x5948('0x75'))](_0x5948('0x94'));}})[_0x5948('0x27')](function(_0x5a26f6){return _0x1815b9[_0x5948('0x49')](_0x5a26f6);})['catch'](handleError(_0x1815b9));}; \ No newline at end of file +var _0xc099=['transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','type','key','name','format','filters','intersection','model','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','VoiceRecording','keys','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','Setting','transcribe'];(function(_0x1d8607,_0xaeb4a0){var _0x560770=function(_0x8a20df){while(--_0x8a20df){_0x1d8607['push'](_0x1d8607['shift']());}};_0x560770(++_0xaeb4a0);}(_0xc099,0x150));var _0x9c09=function(_0x308c7d,_0x4d8bf1){_0x308c7d=_0x308c7d-0x0;var _0x2cc68b=_0xc099[_0x308c7d];return _0x2cc68b;};'use strict';var emlformat=require(_0x9c09('0x0'));var rimraf=require(_0x9c09('0x1'));var zipdir=require(_0x9c09('0x2'));var jsonpatch=require(_0x9c09('0x3'));var rp=require(_0x9c09('0x4'));var moment=require(_0x9c09('0x5'));var BPromise=require(_0x9c09('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c09('0x7'));var sox=require('sox');var csv=require(_0x9c09('0x8'));var ejs=require(_0x9c09('0x9'));var fs=require('fs');var fs_extra=require(_0x9c09('0xa'));var _=require('lodash');var squel=require(_0x9c09('0xb'));var crypto=require(_0x9c09('0xc'));var jsforce=require(_0x9c09('0xd'));var deskjs=require(_0x9c09('0xe'));var toCsv=require(_0x9c09('0x8'));var querystring=require('querystring');var Papa=require(_0x9c09('0xf'));var AWS=require(_0x9c09('0x10'));var uuidv4=require(_0x9c09('0x11'));var Redis=require(_0x9c09('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c09('0x13'));var logger=require(_0x9c09('0x14'))(_0x9c09('0x15'));var utils=require('../../config/utils');var config=require(_0x9c09('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c09('0x17'))['db'];function respondWithStatusCode(_0xdc1c56,_0x50c861){_0x50c861=_0x50c861||0xcc;return function(_0x4af712){if(_0x4af712){return _0xdc1c56[_0x9c09('0x18')](_0x50c861);}return _0xdc1c56[_0x9c09('0x19')](_0x50c861)[_0x9c09('0x1a')]();};}function respondWithResult(_0x48762c,_0xd7e80b){_0xd7e80b=_0xd7e80b||0xc8;return function(_0x59dcb6){if(_0x59dcb6){return _0x48762c['status'](_0xd7e80b)[_0x9c09('0x1b')](_0x59dcb6);}};}function respondWithFilteredResult(_0xd7acfd,_0xbd1f35){return function(_0x33ea9f){if(_0x33ea9f){var _0x2fe085=typeof _0xbd1f35[_0x9c09('0x1c')]==='undefined'&&typeof _0xbd1f35[_0x9c09('0x1d')]==='undefined';var _0x3e268d=_0x33ea9f[_0x9c09('0x1e')];var _0x244249=_0x2fe085?0x0:_0xbd1f35[_0x9c09('0x1c')];var _0x349263=_0x2fe085?_0x33ea9f['count']:_0xbd1f35[_0x9c09('0x1c')]+_0xbd1f35[_0x9c09('0x1d')];var _0x5e652b;if(_0x349263>=_0x3e268d){_0x349263=_0x3e268d;_0x5e652b=0xc8;}else{_0x5e652b=0xce;}_0xd7acfd['status'](_0x5e652b);return _0xd7acfd[_0x9c09('0x1f')](_0x9c09('0x20'),_0x244249+'-'+_0x349263+'/'+_0x3e268d)['json'](_0x33ea9f);}return null;};}function patchUpdates(_0x4af214){return function(_0x544a05){try{jsonpatch[_0x9c09('0x21')](_0x544a05,_0x4af214,!![]);}catch(_0x583269){return BPromise[_0x9c09('0x22')](_0x583269);}return _0x544a05[_0x9c09('0x23')]();};}function saveUpdates(_0x5693ba,_0x8a2ea7){return function(_0x4a7ef2){if(_0x4a7ef2){return _0x4a7ef2[_0x9c09('0x24')](_0x5693ba)[_0x9c09('0x25')](function(_0x1f5fd2){return _0x1f5fd2;});}return null;};}function removeEntity(_0x1204c1,_0x11ef14){return function(_0x6d4ad5){if(_0x6d4ad5){return _0x6d4ad5[_0x9c09('0x26')]()[_0x9c09('0x25')](function(){_0x1204c1[_0x9c09('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349eab,_0xc7b1ac){return function(_0x26bc0e){if(!_0x26bc0e){_0x349eab[_0x9c09('0x18')](0x194);}return _0x26bc0e;};}function handleError(_0x29fb77,_0x4817e6){_0x4817e6=_0x4817e6||0x1f4;return function(_0x32bcb8){logger[_0x9c09('0x27')](_0x32bcb8[_0x9c09('0x28')]);if(_0x32bcb8['name']){delete _0x32bcb8['name'];}_0x29fb77[_0x9c09('0x19')](_0x4817e6)[_0x9c09('0x29')](_0x32bcb8);};}exports[_0x9c09('0x2a')]=function(_0x473da4,_0x3bccbe){var _0x477aaa={},_0x31aa9d={},_0x1f0fb4={'count':0x0,'rows':[]};var _0xdb9330=_[_0x9c09('0x2b')](db['VoiceRecording'][_0x9c09('0x2c')],function(_0x414a63){return{'name':_0x414a63['fieldName'],'type':_0x414a63[_0x9c09('0x2d')][_0x9c09('0x2e')]};});_0x31aa9d['model']=_['differenceBy'](_[_0x9c09('0x2b')](_0xdb9330,_0x9c09('0x2f')),[_0x9c09('0x30')]);_0x31aa9d['query']=_['keys'](_0x473da4['query']);_0x31aa9d[_0x9c09('0x31')]=_[_0x9c09('0x32')](_0x31aa9d[_0x9c09('0x33')],_0x31aa9d[_0x9c09('0x34')]);_0x477aaa[_0x9c09('0x35')]=_[_0x9c09('0x32')](_0x31aa9d[_0x9c09('0x33')],qs[_0x9c09('0x36')](_0x473da4[_0x9c09('0x34')]['fields']));_0x477aaa[_0x9c09('0x35')]=_0x477aaa[_0x9c09('0x35')][_0x9c09('0x37')]?_0x477aaa['attributes']:_0x31aa9d[_0x9c09('0x33')];if(!_0x473da4['query']['hasOwnProperty'](_0x9c09('0x38'))){_0x477aaa[_0x9c09('0x1d')]=qs[_0x9c09('0x1d')](_0x473da4[_0x9c09('0x34')]['limit']);_0x477aaa[_0x9c09('0x1c')]=qs[_0x9c09('0x1c')](_0x473da4['query'][_0x9c09('0x1c')]);}_0x477aaa['order']=qs[_0x9c09('0x39')](_0x473da4[_0x9c09('0x34')]['sort']);_0x477aaa[_0x9c09('0x3a')]=qs[_0x9c09('0x31')](_[_0x9c09('0x3b')](_0x473da4[_0x9c09('0x34')],_0x31aa9d[_0x9c09('0x31')]),_0xdb9330);if(_0x473da4[_0x9c09('0x34')][_0x9c09('0x3c')]){_0x477aaa[_0x9c09('0x3a')]=_[_0x9c09('0x3d')](_0x477aaa[_0x9c09('0x3a')],{'$or':_['map'](_0xdb9330,function(_0x80616d){if(_0x80616d['type']!==_0x9c09('0x3e')){var _0x252d85={};_0x252d85[_0x80616d[_0x9c09('0x2f')]]={'$like':'%'+_0x473da4[_0x9c09('0x34')][_0x9c09('0x3c')]+'%'};return _0x252d85;}})});}_0x477aaa=_[_0x9c09('0x3d')]({},_0x477aaa,_0x473da4[_0x9c09('0x3f')]);var _0x408c23={'where':_0x477aaa[_0x9c09('0x3a')]};return db['VoiceRecording'][_0x9c09('0x1e')](_0x408c23)[_0x9c09('0x25')](function(_0x3b1f08){_0x1f0fb4[_0x9c09('0x1e')]=_0x3b1f08;if(_0x473da4[_0x9c09('0x34')][_0x9c09('0x40')]){_0x477aaa[_0x9c09('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0x9c09('0x42')](_0x477aaa);})['then'](function(_0x5cdd0a){_0x1f0fb4[_0x9c09('0x43')]=_0x5cdd0a;return _0x1f0fb4;})[_0x9c09('0x25')](respondWithFilteredResult(_0x3bccbe,_0x477aaa))[_0x9c09('0x44')](handleError(_0x3bccbe,null));};exports[_0x9c09('0x45')]=function(_0x50055b,_0x5b6755){var _0x33a877={'raw':![],'where':{'id':_0x50055b[_0x9c09('0x46')]['id']}},_0x1d05dc={};_0x1d05dc['model']=_['keys'](db[_0x9c09('0x47')][_0x9c09('0x2c')]);_0x1d05dc['query']=_[_0x9c09('0x48')](_0x50055b[_0x9c09('0x34')]);_0x1d05dc[_0x9c09('0x31')]=_[_0x9c09('0x32')](_0x1d05dc['model'],_0x1d05dc['query']);_0x33a877[_0x9c09('0x35')]=_[_0x9c09('0x32')](_0x1d05dc['model'],qs[_0x9c09('0x36')](_0x50055b[_0x9c09('0x34')][_0x9c09('0x36')]));_0x33a877[_0x9c09('0x35')]=_0x33a877[_0x9c09('0x35')]['length']?_0x33a877[_0x9c09('0x35')]:_0x1d05dc[_0x9c09('0x33')];if(_0x50055b[_0x9c09('0x34')][_0x9c09('0x40')]){_0x33a877['include']=[{'all':!![]}];}_0x33a877=_[_0x9c09('0x3d')]({},_0x33a877,_0x50055b[_0x9c09('0x3f')]);return db[_0x9c09('0x47')][_0x9c09('0x49')](_0x33a877)[_0x9c09('0x25')](handleEntityNotFound(_0x5b6755,null))[_0x9c09('0x25')](respondWithResult(_0x5b6755,null))[_0x9c09('0x44')](handleError(_0x5b6755,null));};exports[_0x9c09('0x4a')]=function(_0x3b7e68,_0x11b545){return db['VoiceRecording'][_0x9c09('0x4a')](_0x3b7e68['body'],{})[_0x9c09('0x25')](respondWithResult(_0x11b545,0xc9))[_0x9c09('0x44')](handleError(_0x11b545,null));};exports[_0x9c09('0x24')]=function(_0x41d0d3,_0x34214d){if(_0x41d0d3['body']['id']){delete _0x41d0d3[_0x9c09('0x4b')]['id'];}return db['VoiceRecording'][_0x9c09('0x49')]({'where':{'id':_0x41d0d3['params']['id']}})[_0x9c09('0x25')](handleEntityNotFound(_0x34214d,null))['then'](saveUpdates(_0x41d0d3['body'],null))[_0x9c09('0x25')](respondWithResult(_0x34214d,null))['catch'](handleError(_0x34214d,null));};exports[_0x9c09('0x4c')]=function(_0x19d722,_0x1b1520){return db[_0x9c09('0x47')][_0x9c09('0x4c')]()[_0x9c09('0x25')](respondWithResult(_0x1b1520,null))[_0x9c09('0x44')](handleError(_0x1b1520,null));};exports[_0x9c09('0x4d')]=function(_0x27a8b0,_0x2df4c7,_0x4ccc30){var _0x57e421=require(_0x9c09('0x4e'));var _0x237b3e=![];var _0x4497d3={};if(_0x27a8b0[_0x9c09('0x34')][_0x9c09('0x2d')]&&_0x27a8b0['query'][_0x9c09('0x2d')]===_0x9c09('0x4f')){_0x4497d3[_0x9c09('0x4f')]=_0x27a8b0['params']['id'];}else{_0x4497d3['id']=_0x27a8b0[_0x9c09('0x46')]['id'];}return db[_0x9c09('0x47')][_0x9c09('0x49')]({'where':_0x4497d3,'attributes':['id',_0x9c09('0x50')],'raw':!![]})[_0x9c09('0x25')](handleEntityNotFound(_0x2df4c7,null))[_0x9c09('0x25')](function(_0x25d6a8){if(_0x25d6a8){var _0x38ae49=_0x25d6a8[_0x9c09('0x50')];var _0x5b088c=util['format'](_0x9c09('0x51'),_0x38ae49);if(fs[_0x9c09('0x52')](_0x5b088c)){_0x237b3e=!![];return _0x57e421[_0x9c09('0x53')](_0x5b088c,_0x38ae49,config[_0x9c09('0x54')][_0x9c09('0x55')])[_0x9c09('0x25')](function(){return _0x25d6a8;});}return _0x25d6a8;}})[_0x9c09('0x25')](function(_0x458811){if(_0x458811){var _0x384aca=_0x458811[_0x9c09('0x50')];if(!fs['existsSync'](_0x384aca)){throw new db[(_0x9c09('0x56'))][(_0x9c09('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x458811['filename']){return _0x2df4c7['download'](_0x384aca,_0x458811[_0x9c09('0x58')]+path[_0x9c09('0x59')](_0x384aca),function(){if(_0x237b3e){fs['unlink'](_0x384aca);}});}else{return _0x2df4c7['download'](_0x384aca,function(_0xf03ae6){if(_0x237b3e){fs[_0x9c09('0x5a')](_0x384aca);}});}}})['catch'](function(_0x6002b){if(_0x6002b[_0x9c09('0x5b')]===_0x9c09('0x5c')){_0x2df4c7[_0x9c09('0x19')](0x194)['send'](_0x9c09('0x5d'));}else{return handleError(_0x2df4c7,null);}});};exports[_0x9c09('0x5e')]=function(_0x5970c1,_0x7dc30d,_0x153e59){var _0x4bcfd5=require(_0x9c09('0x4e'));var _0x47806a=![];var _0x421fe3={'$and':[db[_0x9c09('0x5f')][_0x9c09('0x3a')](db[_0x9c09('0x5f')]['fn'](_0x9c09('0x60'),db['sequelize'][_0x9c09('0x61')](_0x9c09('0x4f'))),_0x5970c1['query'][_0x9c09('0x62')])]};if(_0x5970c1[_0x9c09('0x34')]['type']&&_0x5970c1[_0x9c09('0x34')][_0x9c09('0x2d')]===_0x9c09('0x4f')){_0x421fe3[_0x9c09('0x63')][_0x9c09('0x64')]({'uniqueid':_0x5970c1['params']['id']});}else{_0x421fe3['$and'][_0x9c09('0x64')]({'id':_0x5970c1[_0x9c09('0x46')]['id']});}return db[_0x9c09('0x47')][_0x9c09('0x49')]({'where':_0x421fe3,'attributes':['id',_0x9c09('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x7dc30d,null))[_0x9c09('0x25')](function(_0x519ea6){if(_0x519ea6){var _0x540b1c=util['format'](_0x9c09('0x51'),_0x519ea6[_0x9c09('0x50')]);if(fs[_0x9c09('0x52')](_0x540b1c)){_0x47806a=!![];return _0x4bcfd5[_0x9c09('0x53')](_0x540b1c,_0x519ea6[_0x9c09('0x50')],config['secrets'][_0x9c09('0x55')])['then'](function(){return _0x519ea6;});}return _0x519ea6;}})[_0x9c09('0x25')](function(_0x3c3787){if(_0x3c3787){if(!fs['existsSync'](_0x3c3787[_0x9c09('0x50')])){throw new db['Sequelize'][(_0x9c09('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x3c3787['filename']){return _0x7dc30d[_0x9c09('0x4d')](_0x3c3787[_0x9c09('0x50')],_0x3c3787['filename']+path[_0x9c09('0x59')](_0x3c3787[_0x9c09('0x50')]),function(){if(_0x47806a){fs[_0x9c09('0x5a')](_0x3c3787['value']);}});}else{return _0x7dc30d[_0x9c09('0x4d')](_0x3c3787[_0x9c09('0x50')],function(_0x3a5da5){if(_0x47806a){fs[_0x9c09('0x5a')](_0x3c3787[_0x9c09('0x50')]);}});}}})[_0x9c09('0x44')](handleError(_0x7dc30d,null));};exports[_0x9c09('0x26')]=function(_0x23c229,_0x54b1a6){return db['VoiceRecording'][_0x9c09('0x49')]({'where':{'id':_0x23c229[_0x9c09('0x46')]['id']}})[_0x9c09('0x25')](function(_0xedb975){if(_[_0x9c09('0x65')](_0xedb975)){throw new ReferenceError(_0x9c09('0x66'));}return _0xedb975;})['then'](function(_0x5dd31b){var _0x4a848a=_0x5dd31b[_0x9c09('0x50')];logger[_0x9c09('0x67')](_0x9c09('0x68'),_0x4a848a);if(!_[_0x9c09('0x65')](_0x5dd31b[_0x9c09('0x50')])&&fs['existsSync'](_0x4a848a)){logger['info'](_0x9c09('0x69')+_0x4a848a+_0x9c09('0x6a'));fs[_0x9c09('0x6b')](_0x4a848a);}_0x4a848a=_0x4a848a+_0x9c09('0x6c');if(!_['isNil'](_0x5dd31b[_0x9c09('0x50')])&&fs[_0x9c09('0x52')](_0x4a848a)){logger['info'](_0x9c09('0x69')+_0x4a848a+_0x9c09('0x6a'));fs[_0x9c09('0x6b')](_0x4a848a);}return _0x5dd31b;})['then'](function(_0x13b524){if(!_0x13b524)throw new InternalError();return _0x13b524['destroy']();})[_0x9c09('0x25')](function(){_0x54b1a6['status'](0xcc)[_0x9c09('0x1a')]();})[_0x9c09('0x44')](handleError(_0x54b1a6,null));};function getBucketslist(_0x5e9219,_0x11e0f8,_0x4c7bab){return new Promise(function(_0x3f3e90,_0x446767){var _0x5eb977=new AWS['S3']({'accessKeyId':_0x11e0f8,'secretAccessKey':_0x5e9219,'region':_0x4c7bab});_0x5eb977[_0x9c09('0x6d')]({},function(_0x2b2c3f,_0x3004e5){if(_0x2b2c3f){return _0x446767(_0x2b2c3f);}else{return _0x3f3e90(_0x3004e5);}});});}function createBucket(_0x2705c6,_0x1b97a1,_0x5d6d4b,_0x38a907){return new Promise(function(_0x34d542,_0x18f534){var _0x5776af=new AWS['S3']({'accessKeyId':_0x1b97a1,'secretAccessKey':_0x2705c6,'region':_0x5d6d4b});_0x5776af['createBucket']({'Bucket':_0x38a907},function(_0x3617f,_0x5bece9){if(_0x3617f){return _0x18f534(_0x3617f);}else{return _0x34d542(_0x5bece9);}});});}function uploadFile(_0x266ff7,_0x22b875,_0x12fb8a,_0x2323a1,_0x56f724,_0x111eef){return new Promise(function(_0x3e64b0,_0x5a52bd){var _0x7b92ab=new AWS['S3']({'accessKeyId':_0x22b875,'secretAccessKey':_0x266ff7,'region':_0x12fb8a});_0x7b92ab[_0x9c09('0x6e')]({'Bucket':_0x2323a1,'Key':_0x56f724,'Body':_0x111eef},function(_0x5962cd,_0x46a671){if(_0x5962cd){return _0x5a52bd(_0x5962cd);}else{return _0x3e64b0(_0x46a671);}});});}function startTranscribe(_0x5e50ab,_0xa8590a,_0x32f354,_0x127718,_0x428440,_0x4bdb7a){return new Promise(function(_0x39ec0a,_0x33420d){var _0x307c65=new AWS[(_0x9c09('0x6f'))]({'accessKeyId':_0xa8590a,'secretAccessKey':_0x5e50ab,'region':_0x32f354});_0x307c65[_0x9c09('0x70')]({'TranscriptionJobName':_0x127718,'LanguageCode':_0x428440,'Media':{'MediaFileUri':_0x4bdb7a}},function(_0x2b938a,_0x461055){if(_0x2b938a){return _0x33420d(_0x2b938a);}else{return _0x39ec0a(_0x461055);}});});}function transcribe(_0x117195,_0x16651d,_0xb266f5,_0x239594,_0x228f29,_0x34261d,_0x5905d4){return new Promise(function(_0x25cef4,_0x17c8c5){var _0x31a45b={};logger[_0x9c09('0x67')](util[_0x9c09('0x30')](_0x9c09('0x71'),_0x117195,_0x228f29));return uploadFile(_0x16651d,_0xb266f5,_0x239594,_0x228f29,path[_0x9c09('0x72')](_0x34261d),fs[_0x9c09('0x73')](_0x34261d))[_0x9c09('0x25')](function(_0x487b5e){logger[_0x9c09('0x67')](util[_0x9c09('0x30')](_0x9c09('0x74'),_0x117195,_0x228f29,_0x487b5e[_0x9c09('0x75')]));_0x31a45b[_0x9c09('0x76')]=_0x487b5e['Bucket'];_0x31a45b[_0x9c09('0x77')]=_0x487b5e[_0x9c09('0x75')];logger[_0x9c09('0x67')](util[_0x9c09('0x30')](_0x9c09('0x78'),_0x117195));return startTranscribe(_0x16651d,_0xb266f5,_0x239594,uuidv4(),_0x5905d4,_0x487b5e[_0x9c09('0x75')]);})[_0x9c09('0x25')](function(_0x2b4d40){logger[_0x9c09('0x67')](util[_0x9c09('0x30')](_0x9c09('0x79'),_0x117195,_0x2b4d40[_0x9c09('0x7a')][_0x9c09('0x7b')]));_0x31a45b[_0x9c09('0x7c')]=_0x2b4d40[_0x9c09('0x7a')][_0x9c09('0x7b')];_0x31a45b[_0x9c09('0x7d')]=_0x2b4d40[_0x9c09('0x7a')][_0x9c09('0x7e')];return _0x25cef4(_0x31a45b);})[_0x9c09('0x44')](function(_0x2f4d74){return _0x17c8c5(_0x2f4d74);});});}exports['runTranscribe']=function(_0x5890a5,_0x542449,_0x21c565){var _0x2e99bf;var _0x17fa06;var _0x4e7398;var _0x526873=require(_0x9c09('0x4e'));return db['VoiceRecording']['findOne']({'where':{'id':_0x5890a5['params']['id']}})['then'](function(_0x175668){if(_0x175668){var _0x5a58cd=util[_0x9c09('0x30')](_0x9c09('0x51'),_0x175668['value']);if(fs[_0x9c09('0x52')](_0x5a58cd)){cypher=!![];return _0x526873[_0x9c09('0x53')](_0x5a58cd,_0x175668['value'],config[_0x9c09('0x54')]['recording'])[_0x9c09('0x25')](function(){return _0x175668;});}return _0x175668;}})[_0x9c09('0x25')](function(_0x45eb19){if(!_0x45eb19){throw new db['Sequelize'][(_0x9c09('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x17fa06=_0x45eb19;return db[_0x9c09('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x9c09('0x25')](handleEntityNotFound(_0x542449,null))['then'](function(_0x47b973){if(_0x47b973){_0x2e99bf=_0x47b973;if(!_0x2e99bf[_0x9c09('0x80')]||!_0x2e99bf['transcribeAccountId']||!_0x2e99bf[_0x9c09('0x81')]||!_0x2e99bf[_0x9c09('0x82')]||!_0x2e99bf[_0x9c09('0x76')]){throw new db[(_0x9c09('0x56'))][(_0x9c09('0x57'))](_0x9c09('0x83'));}if(_0x5890a5['body']['runSentiment']&&(!_0x2e99bf[_0x9c09('0x84')]||!_0x2e99bf[_0x9c09('0x85')]||!_0x2e99bf[_0x9c09('0x86')]||!_0x2e99bf[_0x9c09('0x82')]||!_0x2e99bf[_0x9c09('0x76')])){throw new db[(_0x9c09('0x56'))][(_0x9c09('0x57'))](_0x9c09('0x87'));}return db[_0x9c09('0x88')][_0x9c09('0x89')]({'where':{'id':_0x2e99bf['transcribeAccountId']}});}})['then'](function(_0x1a3870){if(!_0x1a3870){throw new db[(_0x9c09('0x56'))]['ValidationError'](_0x9c09('0x8a'));}if(!_0x1a3870[_0x9c09('0x8b')]||!_0x1a3870[_0x9c09('0x8c')]){throw new db['Sequelize'][(_0x9c09('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x4e7398=_0x1a3870;return getBucketslist(_0x4e7398[_0x9c09('0x8b')],_0x4e7398[_0x9c09('0x8c')],_0x2e99bf['transcribeRegion']);})['then'](function(_0xf069e5){if(_0xf069e5&&_0xf069e5[_0x9c09('0x8d')]){var _0x1e0adf=_[_0x9c09('0x49')](_0xf069e5[_0x9c09('0x8d')],function(_0x4f3da2){return _0x4f3da2[_0x9c09('0x8e')]===_0x2e99bf['bucket'];});if(!_0x1e0adf){logger[_0x9c09('0x67')](util[_0x9c09('0x30')](_0x9c09('0x8f'),_0x5890a5[_0x9c09('0x46')]['id'],_0x2e99bf['bucket']));return createBucket(_0x4e7398[_0x9c09('0x8b')],_0x4e7398[_0x9c09('0x8c')],_0x2e99bf['transcribeRegion'],_0x2e99bf[_0x9c09('0x76')]);}logger[_0x9c09('0x67')](util['format'](_0x9c09('0x90'),_0x5890a5[_0x9c09('0x46')]['id'],_0x2e99bf[_0x9c09('0x76')]));return;}})[_0x9c09('0x25')](function(_0x308cf7){if(_0x17fa06[_0x9c09('0x7d')]===_0x9c09('0x91')){return transcribe(_0x5890a5[_0x9c09('0x46')]['id'],_0x4e7398['data1'],_0x4e7398['data2'],_0x2e99bf['transcribeRegion'],_0x2e99bf[_0x9c09('0x76')],_0x17fa06[_0x9c09('0x50')],_0x2e99bf[_0x9c09('0x82')]);}else{logger['info'](util[_0x9c09('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5890a5[_0x9c09('0x46')]['id']));return{'transcribeStatus':_0x9c09('0x92')};}})[_0x9c09('0x25')](function(_0x574fbf){if(_0x574fbf){_0x574fbf['tempSentiment']=_0x5890a5[_0x9c09('0x4b')][_0x9c09('0x93')];return _0x17fa06[_0x9c09('0x94')](_0x574fbf);}})[_0x9c09('0x25')](respondWithResult(_0x542449,null))[_0x9c09('0x44')](handleError(_0x542449,null));};function writeFile(_0x1de212,_0x1eb61e){return new Promise(function(_0x540a3d,_0x47b828){fs[_0x9c09('0x95')](_0x1eb61e,_0x1de212,function(_0x3dcf50,_0x2fc569){if(_0x3dcf50){return _0x47b828(_0x3dcf50);}else{return _0x540a3d(_0x2fc569);}});});}exports[_0x9c09('0x96')]=function(_0x5c8caa,_0x1adec4,_0x47f757){return db[_0x9c09('0x47')][_0x9c09('0x89')]({'where':{'id':_0x5c8caa[_0x9c09('0x46')]['id']}})['then'](handleEntityNotFound(_0x1adec4))[_0x9c09('0x25')](function(_0x32a38d){if(_0x32a38d&&_0x32a38d[_0x9c09('0x97')]){var _0x564b0f=_0x32a38d['fileText'];var _0x18aabb=config[_0x9c09('0x98')]+_0x9c09('0x99')+_0x32a38d['id']+'.txt';if(fs[_0x9c09('0x52')](_0x18aabb)){return _0x18aabb;}return writeFile(_0x564b0f,_0x18aabb)[_0x9c09('0x25')](function(){return _0x18aabb;});}else{throw new db[(_0x9c09('0x56'))][(_0x9c09('0x57'))](_0x9c09('0x9a'));}})[_0x9c09('0x25')](function(_0x3fcc83){return _0x1adec4[_0x9c09('0x4d')](_0x3fcc83);})['catch'](handleError(_0x1adec4));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 84ca50e..bc79408 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 _0xf3cd=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x545e06,_0xe14fa6){var _0x4cfaa2=function(_0x496dd9){while(--_0x496dd9){_0x545e06['push'](_0x545e06['shift']());}};_0x4cfaa2(++_0xe14fa6);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xd4ec0c,_0x2afcd2){_0xd4ec0c=_0xd4ec0c-0x0;var _0x580218=_0xf3cd[_0xd4ec0c];return _0x580218;};'use strict';var attributes=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]=function(_0x31e5a5,_0x1e0814){return _0x31e5a5[_0xdf3c('0x2')](_0xdf3c('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xdf3c('0x4'),'fields':[_0xdf3c('0x4')]},{'name':_0xdf3c('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7119=['exports','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x547b53,_0x5ea6cb){var _0x166225=function(_0x17487a){while(--_0x17487a){_0x547b53['push'](_0x547b53['shift']());}};_0x166225(++_0x5ea6cb);}(_0x7119,0x1c7));var _0x9711=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x7119[_0x31eb67];return _0x2a8cb8;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x9711('0x0')]=function(_0x529e10,_0x30d901){return _0x529e10['define'](_0x9711('0x1'),attributes,{'tableName':_0x9711('0x2'),'paranoid':![],'indexes':[{'name':_0x9711('0x3'),'fields':[_0x9711('0x3')]},{'name':'transcribeStatus','fields':[_0x9711('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b3bff37..6013bfe 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(_0xdc8eb0,_0x5351e4){var _0x2daef9=function(_0x381e2e){while(--_0x381e2e){_0xdc8eb0['push'](_0xdc8eb0['shift']());}};_0x2daef9(++_0x5351e4);}(_0x1623,0xab));var _0x3162=function(_0x3f87b2,_0x3223f8){_0x3f87b2=_0x3f87b2-0x0;var _0x531a6a=_0x1623[_0x3f87b2];return _0x531a6a;};'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 _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x12e7f6,_0x130b4b){var _0x47b391=function(_0xa05092){while(--_0xa05092){_0x12e7f6['push'](_0x12e7f6['shift']());}};_0x47b391(++_0x130b4b);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a47eb6c..464e251 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 _0xc6bf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','post','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x414014,_0x4e3322){var _0x38ab83=function(_0x2e80e1){while(--_0x2e80e1){_0x414014['push'](_0x414014['shift']());}};_0x38ab83(++_0x4e3322);}(_0xc6bf,0xba));var _0xfc6b=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0xc6bf[_0xd58823];return _0x249c0a;};'use strict';var multer=require(_0xfc6b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc6b('0x1'));var express=require(_0xfc6b('0x2'));var router=express[_0xfc6b('0x3')]();var fs_extra=require(_0xfc6b('0x4'));var auth=require(_0xfc6b('0x5'));var interaction=require(_0xfc6b('0x6'));var config=require(_0xfc6b('0x7'));var controller=require(_0xfc6b('0x8'));router[_0xfc6b('0x9')]('/',auth[_0xfc6b('0xa')](),controller[_0xfc6b('0xb')]);router['get']('/describe',auth[_0xfc6b('0xa')](),controller[_0xfc6b('0xc')]);router[_0xfc6b('0x9')]('/:id',auth[_0xfc6b('0xa')](),controller['show']);router[_0xfc6b('0xd')]('/',auth[_0xfc6b('0xa')](),controller['create']);router['put'](_0xfc6b('0xe'),auth['isAuthenticated'](),controller[_0xfc6b('0xf')]);router[_0xfc6b('0x10')](_0xfc6b('0xe'),auth['isAuthenticated'](),controller[_0xfc6b('0x11')]);module[_0xfc6b('0x12')]=router; \ No newline at end of file +var _0xcde7=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36c35a,_0x3deff8){var _0x4d044d=function(_0x1427c9){while(--_0x1427c9){_0x36c35a['push'](_0x36c35a['shift']());}};_0x4d044d(++_0x3deff8);}(_0xcde7,0x14a));var _0x7cde=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcde7[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x7cde('0x0'));var util=require(_0x7cde('0x1'));var path=require(_0x7cde('0x2'));var timeout=require(_0x7cde('0x3'));var express=require(_0x7cde('0x4'));var router=express[_0x7cde('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7cde('0x6'));var config=require(_0x7cde('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x7cde('0x8')]('/',auth['isAuthenticated'](),controller[_0x7cde('0x9')]);router['get'](_0x7cde('0xa'),auth[_0x7cde('0xb')](),controller[_0x7cde('0xc')]);router[_0x7cde('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7cde('0xd')]);router[_0x7cde('0xe')]('/',auth[_0x7cde('0xb')](),controller['create']);router[_0x7cde('0xf')](_0x7cde('0x10'),auth[_0x7cde('0xb')](),controller[_0x7cde('0x11')]);router[_0x7cde('0x12')](_0x7cde('0x10'),auth[_0x7cde('0xb')](),controller[_0x7cde('0x13')]);module[_0x7cde('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 7857d7c..0d8aa10 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 _0xfab5=['sequelize','moment','blind','attended','STRING','ENUM','Yes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfab5,0x1ea));var _0x5fab=function(_0x3e25bc,_0x1b01f3){_0x3e25bc=_0x3e25bc-0x0;var _0x345958=_0xfab5[_0x3e25bc];return _0x345958;};'use strict';var Sequelize=require(_0x5fab('0x0'));var moment=require(_0x5fab('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5fab('0x2'),_0x5fab('0x3'))},'result':{'type':Sequelize[_0x5fab('0x4')]},'transfererchannel':{'type':Sequelize[_0x5fab('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5fab('0x4')]},'transferercalleridname':{'type':Sequelize[_0x5fab('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x5fab('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5fab('0x4')]},'transferercontext':{'type':Sequelize[_0x5fab('0x4')]},'transfererexten':{'type':Sequelize[_0x5fab('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5fab('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x5fab('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x5fab('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5fab('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5fab('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x5fab('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x5fab('0x4')]},'isexternal':{'type':Sequelize[_0x5fab('0x5')](_0x5fab('0x6'),'No')},'context':{'type':Sequelize[_0x5fab('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x451e=['blind','STRING','Yes','sequelize','exports','ENUM'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x451e,0x159));var _0xe451=function(_0x311dbe,_0x9c7d98){_0x311dbe=_0x311dbe-0x0;var _0x3cf3af=_0x451e[_0x311dbe];return _0x3cf3af;};'use strict';var Sequelize=require(_0xe451('0x0'));var moment=require('moment');module[_0xe451('0x1')]={'type':{'type':Sequelize[_0xe451('0x2')](_0xe451('0x3'),'attended')},'result':{'type':Sequelize[_0xe451('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe451('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe451('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xe451('0x4')]},'transferercontext':{'type':Sequelize[_0xe451('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xe451('0x4')]},'transfereechannel':{'type':Sequelize[_0xe451('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xe451('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xe451('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe451('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xe451('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xe451('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe451('0x4')]},'isexternal':{'type':Sequelize[_0xe451('0x2')](_0xe451('0x5'),'No')},'context':{'type':Sequelize[_0xe451('0x4')]},'extension':{'type':Sequelize[_0xe451('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1bf8ed7..8ac5b78 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 _0x31f1=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key'];(function(_0x15e239,_0x563cb0){var _0x3c21fd=function(_0x2dbdb5){while(--_0x2dbdb5){_0x15e239['push'](_0x15e239['shift']());}};_0x3c21fd(++_0x563cb0);}(_0x31f1,0x179));var _0x131f=function(_0x2041ed,_0x370c24){_0x2041ed=_0x2041ed-0x0;var _0x271aec=_0x31f1[_0x2041ed];return _0x271aec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x131f('0x0'));var zipdir=require(_0x131f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x131f('0x2'));var BPromise=require(_0x131f('0x3'));var Mustache=require(_0x131f('0x4'));var util=require(_0x131f('0x5'));var path=require('path');var sox=require(_0x131f('0x6'));var csv=require(_0x131f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x131f('0x8'));var _=require('lodash');var squel=require(_0x131f('0x9'));var crypto=require(_0x131f('0xa'));var jsforce=require(_0x131f('0xb'));var deskjs=require(_0x131f('0xc'));var toCsv=require(_0x131f('0x7'));var querystring=require(_0x131f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x131f('0xe'));var hardwareService=require(_0x131f('0xf'));var logger=require(_0x131f('0x10'))('api');var utils=require(_0x131f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x131f('0x12'));var db=require(_0x131f('0x13'))['db'];function respondWithStatusCode(_0x356c20,_0x576b25){_0x576b25=_0x576b25||0xcc;return function(_0x19159b){if(_0x19159b){return _0x356c20[_0x131f('0x14')](_0x576b25);}return _0x356c20['status'](_0x576b25)['end']();};}function respondWithResult(_0x268b87,_0xb7f731){_0xb7f731=_0xb7f731||0xc8;return function(_0x1950e4){if(_0x1950e4){return _0x268b87[_0x131f('0x15')](_0xb7f731)[_0x131f('0x16')](_0x1950e4);}};}function respondWithFilteredResult(_0x2e69b0,_0xcfb9dc){return function(_0x539eb6){if(_0x539eb6){var _0x51cad8=typeof _0xcfb9dc[_0x131f('0x17')]===_0x131f('0x18')&&typeof _0xcfb9dc[_0x131f('0x19')]===_0x131f('0x18');var _0x2614df=_0x539eb6[_0x131f('0x1a')];var _0xacf663=_0x51cad8?0x0:_0xcfb9dc[_0x131f('0x17')];var _0x5437b9=_0x51cad8?_0x539eb6[_0x131f('0x1a')]:_0xcfb9dc['offset']+_0xcfb9dc[_0x131f('0x19')];var _0x312381;if(_0x5437b9>=_0x2614df){_0x5437b9=_0x2614df;_0x312381=0xc8;}else{_0x312381=0xce;}_0x2e69b0[_0x131f('0x15')](_0x312381);return _0x2e69b0['set'](_0x131f('0x1b'),_0xacf663+'-'+_0x5437b9+'/'+_0x2614df)[_0x131f('0x16')](_0x539eb6);}return null;};}function patchUpdates(_0x49361a){return function(_0x4acfa6){try{jsonpatch[_0x131f('0x1c')](_0x4acfa6,_0x49361a,!![]);}catch(_0x2af6fb){return BPromise['reject'](_0x2af6fb);}return _0x4acfa6['save']();};}function saveUpdates(_0x54501f,_0x4afbea){return function(_0x2f58d4){if(_0x2f58d4){return _0x2f58d4[_0x131f('0x1d')](_0x54501f)['then'](function(_0x4a6cdf){return _0x4a6cdf;});}return null;};}function removeEntity(_0x340848,_0x1cfd32){return function(_0x537da6){if(_0x537da6){return _0x537da6['destroy']()[_0x131f('0x1e')](function(){_0x340848[_0x131f('0x15')](0xcc)[_0x131f('0x1f')]();});}};}function handleEntityNotFound(_0x35c438,_0x590853){return function(_0x44d47f){if(!_0x44d47f){_0x35c438[_0x131f('0x14')](0x194);}return _0x44d47f;};}function handleError(_0x45cc0b,_0x27b6cb){_0x27b6cb=_0x27b6cb||0x1f4;return function(_0xc2f8a4){logger[_0x131f('0x20')](_0xc2f8a4[_0x131f('0x21')]);if(_0xc2f8a4[_0x131f('0x22')]){delete _0xc2f8a4['name'];}_0x45cc0b[_0x131f('0x15')](_0x27b6cb)[_0x131f('0x23')](_0xc2f8a4);};}exports[_0x131f('0x24')]=function(_0x46b384,_0x3ea108){var _0x3d9583={},_0x4b83ce={},_0x574bf6={'count':0x0,'rows':[]};var _0x24064e=_[_0x131f('0x25')](db[_0x131f('0x26')][_0x131f('0x27')],function(_0x39b951){return{'name':_0x39b951[_0x131f('0x28')],'type':_0x39b951[_0x131f('0x29')][_0x131f('0x2a')]};});_0x4b83ce['model']=_[_0x131f('0x25')](_0x24064e,_0x131f('0x22'));_0x4b83ce[_0x131f('0x2b')]=_[_0x131f('0x2c')](_0x46b384[_0x131f('0x2b')]);_0x4b83ce[_0x131f('0x2d')]=_[_0x131f('0x2e')](_0x4b83ce[_0x131f('0x2f')],_0x4b83ce[_0x131f('0x2b')]);_0x3d9583[_0x131f('0x30')]=_[_0x131f('0x2e')](_0x4b83ce[_0x131f('0x2f')],qs[_0x131f('0x31')](_0x46b384[_0x131f('0x2b')][_0x131f('0x31')]));_0x3d9583[_0x131f('0x30')]=_0x3d9583['attributes'][_0x131f('0x32')]?_0x3d9583['attributes']:_0x4b83ce['model'];if(!_0x46b384['query'][_0x131f('0x33')]('nolimit')){_0x3d9583[_0x131f('0x19')]=qs['limit'](_0x46b384[_0x131f('0x2b')][_0x131f('0x19')]);_0x3d9583[_0x131f('0x17')]=qs[_0x131f('0x17')](_0x46b384[_0x131f('0x2b')][_0x131f('0x17')]);}_0x3d9583[_0x131f('0x34')]=qs[_0x131f('0x35')](_0x46b384[_0x131f('0x2b')][_0x131f('0x35')]);_0x3d9583['where']=qs[_0x131f('0x2d')](_['pick'](_0x46b384[_0x131f('0x2b')],_0x4b83ce[_0x131f('0x2d')]),_0x24064e);if(_0x46b384[_0x131f('0x2b')][_0x131f('0x36')]){_0x3d9583[_0x131f('0x37')]=_[_0x131f('0x38')](_0x3d9583[_0x131f('0x37')],{'$or':_[_0x131f('0x25')](_0x24064e,function(_0x56bc44){if(_0x56bc44[_0x131f('0x29')]!==_0x131f('0x39')){var _0x1655cd={};_0x1655cd[_0x56bc44[_0x131f('0x22')]]={'$like':'%'+_0x46b384[_0x131f('0x2b')][_0x131f('0x36')]+'%'};return _0x1655cd;}})});}_0x3d9583=_['merge']({},_0x3d9583,_0x46b384['options']);var _0x1c0c81={'where':_0x3d9583['where']};return db[_0x131f('0x26')][_0x131f('0x1a')](_0x1c0c81)[_0x131f('0x1e')](function(_0xc8885e){_0x574bf6[_0x131f('0x1a')]=_0xc8885e;if(_0x46b384[_0x131f('0x2b')][_0x131f('0x3a')]){_0x3d9583[_0x131f('0x3b')]=[{'all':!![]}];}return db[_0x131f('0x26')][_0x131f('0x3c')](_0x3d9583);})[_0x131f('0x1e')](function(_0x350782){_0x574bf6['rows']=_0x350782;return _0x574bf6;})[_0x131f('0x1e')](respondWithFilteredResult(_0x3ea108,_0x3d9583))[_0x131f('0x3d')](handleError(_0x3ea108,null));};exports[_0x131f('0x3e')]=function(_0x37cb0a,_0x55240a){var _0x2bc97a={'raw':!![],'where':{'id':_0x37cb0a[_0x131f('0x3f')]['id']}},_0x586147={};_0x586147[_0x131f('0x2f')]=_[_0x131f('0x2c')](db[_0x131f('0x26')][_0x131f('0x27')]);_0x586147[_0x131f('0x2b')]=_['keys'](_0x37cb0a[_0x131f('0x2b')]);_0x586147['filters']=_[_0x131f('0x2e')](_0x586147['model'],_0x586147[_0x131f('0x2b')]);_0x2bc97a[_0x131f('0x30')]=_[_0x131f('0x2e')](_0x586147[_0x131f('0x2f')],qs[_0x131f('0x31')](_0x37cb0a['query'][_0x131f('0x31')]));_0x2bc97a[_0x131f('0x30')]=_0x2bc97a[_0x131f('0x30')]['length']?_0x2bc97a[_0x131f('0x30')]:_0x586147[_0x131f('0x2f')];if(_0x37cb0a[_0x131f('0x2b')][_0x131f('0x3a')]){_0x2bc97a[_0x131f('0x3b')]=[{'all':!![]}];}_0x2bc97a=_[_0x131f('0x38')]({},_0x2bc97a,_0x37cb0a[_0x131f('0x40')]);return db[_0x131f('0x26')]['find'](_0x2bc97a)['then'](handleEntityNotFound(_0x55240a,null))['then'](respondWithResult(_0x55240a,null))[_0x131f('0x3d')](handleError(_0x55240a,null));};exports[_0x131f('0x41')]=function(_0x5cee0e,_0x33f6d4){return db['VoiceTransferReport']['create'](_0x5cee0e[_0x131f('0x42')],{})[_0x131f('0x1e')](respondWithResult(_0x33f6d4,0xc9))[_0x131f('0x3d')](handleError(_0x33f6d4,null));};exports['update']=function(_0x55b1b9,_0x250cd4){if(_0x55b1b9['body']['id']){delete _0x55b1b9[_0x131f('0x42')]['id'];}return db['VoiceTransferReport'][_0x131f('0x43')]({'where':{'id':_0x55b1b9[_0x131f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x250cd4,null))[_0x131f('0x1e')](saveUpdates(_0x55b1b9[_0x131f('0x42')],null))[_0x131f('0x1e')](respondWithResult(_0x250cd4,null))[_0x131f('0x3d')](handleError(_0x250cd4,null));};exports[_0x131f('0x44')]=function(_0x218230,_0x2f45c8){return db[_0x131f('0x26')][_0x131f('0x43')]({'where':{'id':_0x218230[_0x131f('0x3f')]['id']}})[_0x131f('0x1e')](handleEntityNotFound(_0x2f45c8,null))[_0x131f('0x1e')](removeEntity(_0x2f45c8,null))[_0x131f('0x3d')](handleError(_0x2f45c8,null));};exports[_0x131f('0x45')]=function(_0x597e6d,_0x2537f8){return db[_0x131f('0x26')][_0x131f('0x45')]()[_0x131f('0x1e')](respondWithResult(_0x2537f8,null))['catch'](handleError(_0x2537f8,null));}; \ No newline at end of file +var _0xe74f=['fast-json-patch','moment','bluebird','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','catch','rawAttributes','options','find','create','body','params','describe','zip-dir'];(function(_0x1c0950,_0x3b9554){var _0x4d6578=function(_0x5600c4){while(--_0x5600c4){_0x1c0950['push'](_0x1c0950['shift']());}};_0x4d6578(++_0x3b9554);}(_0xe74f,0x113));var _0xfe74=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0xe74f[_0x2e9187];return _0x1fc3a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe74('0x0'));var jsonpatch=require(_0xfe74('0x1'));var rp=require('request-promise');var moment=require(_0xfe74('0x2'));var BPromise=require(_0xfe74('0x3'));var Mustache=require(_0xfe74('0x4'));var util=require('util');var path=require(_0xfe74('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfe74('0x6'));var fs=require('fs');var fs_extra=require(_0xfe74('0x7'));var _=require('lodash');var squel=require(_0xfe74('0x8'));var crypto=require('crypto');var jsforce=require(_0xfe74('0x9'));var deskjs=require(_0xfe74('0xa'));var toCsv=require(_0xfe74('0xb'));var querystring=require(_0xfe74('0xc'));var Papa=require(_0xfe74('0xd'));var Redis=require(_0xfe74('0xe'));var authService=require(_0xfe74('0xf'));var qs=require(_0xfe74('0x10'));var as=require(_0xfe74('0x11'));var hardwareService=require(_0xfe74('0x12'));var logger=require(_0xfe74('0x13'))(_0xfe74('0x14'));var utils=require(_0xfe74('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfe74('0x16'))['db'];function respondWithStatusCode(_0x2a9454,_0x19fb74){_0x19fb74=_0x19fb74||0xcc;return function(_0x61685e){if(_0x61685e){return _0x2a9454[_0xfe74('0x17')](_0x19fb74);}return _0x2a9454['status'](_0x19fb74)[_0xfe74('0x18')]();};}function respondWithResult(_0x263a34,_0x221c1f){_0x221c1f=_0x221c1f||0xc8;return function(_0x22d16e){if(_0x22d16e){return _0x263a34[_0xfe74('0x19')](_0x221c1f)[_0xfe74('0x1a')](_0x22d16e);}};}function respondWithFilteredResult(_0x286665,_0x129a26){return function(_0x5948f0){if(_0x5948f0){var _0x51be12=typeof _0x129a26[_0xfe74('0x1b')]==='undefined'&&typeof _0x129a26[_0xfe74('0x1c')]==='undefined';var _0x4a083f=_0x5948f0['count'];var _0xa188ec=_0x51be12?0x0:_0x129a26[_0xfe74('0x1b')];var _0x1f2e90=_0x51be12?_0x5948f0['count']:_0x129a26[_0xfe74('0x1b')]+_0x129a26[_0xfe74('0x1c')];var _0x229301;if(_0x1f2e90>=_0x4a083f){_0x1f2e90=_0x4a083f;_0x229301=0xc8;}else{_0x229301=0xce;}_0x286665[_0xfe74('0x19')](_0x229301);return _0x286665[_0xfe74('0x1d')](_0xfe74('0x1e'),_0xa188ec+'-'+_0x1f2e90+'/'+_0x4a083f)[_0xfe74('0x1a')](_0x5948f0);}return null;};}function patchUpdates(_0xdf9bbc){return function(_0x24f737){try{jsonpatch[_0xfe74('0x1f')](_0x24f737,_0xdf9bbc,!![]);}catch(_0x4bb683){return BPromise['reject'](_0x4bb683);}return _0x24f737['save']();};}function saveUpdates(_0x227af2,_0x257ec1){return function(_0x1b570f){if(_0x1b570f){return _0x1b570f[_0xfe74('0x20')](_0x227af2)[_0xfe74('0x21')](function(_0xc15ebd){return _0xc15ebd;});}return null;};}function removeEntity(_0xf1e8cd,_0x488a12){return function(_0x47b49c){if(_0x47b49c){return _0x47b49c[_0xfe74('0x22')]()[_0xfe74('0x21')](function(){_0xf1e8cd[_0xfe74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5806d6,_0x215aa4){return function(_0x322fb2){if(!_0x322fb2){_0x5806d6[_0xfe74('0x17')](0x194);}return _0x322fb2;};}function handleError(_0x812220,_0xc861fd){_0xc861fd=_0xc861fd||0x1f4;return function(_0x502528){logger[_0xfe74('0x23')](_0x502528[_0xfe74('0x24')]);if(_0x502528[_0xfe74('0x25')]){delete _0x502528['name'];}_0x812220[_0xfe74('0x19')](_0xc861fd)[_0xfe74('0x26')](_0x502528);};}exports[_0xfe74('0x27')]=function(_0x5214c1,_0x308eb7){var _0x38ff22={},_0x41418f={},_0x5a7d9d={'count':0x0,'rows':[]};var _0x416f76=_[_0xfe74('0x28')](db[_0xfe74('0x29')]['rawAttributes'],function(_0x12637f){return{'name':_0x12637f['fieldName'],'type':_0x12637f[_0xfe74('0x2a')]['key']};});_0x41418f[_0xfe74('0x2b')]=_[_0xfe74('0x28')](_0x416f76,_0xfe74('0x25'));_0x41418f[_0xfe74('0x2c')]=_[_0xfe74('0x2d')](_0x5214c1['query']);_0x41418f['filters']=_[_0xfe74('0x2e')](_0x41418f[_0xfe74('0x2b')],_0x41418f[_0xfe74('0x2c')]);_0x38ff22[_0xfe74('0x2f')]=_[_0xfe74('0x2e')](_0x41418f[_0xfe74('0x2b')],qs[_0xfe74('0x30')](_0x5214c1[_0xfe74('0x2c')]['fields']));_0x38ff22[_0xfe74('0x2f')]=_0x38ff22['attributes'][_0xfe74('0x31')]?_0x38ff22['attributes']:_0x41418f[_0xfe74('0x2b')];if(!_0x5214c1[_0xfe74('0x2c')][_0xfe74('0x32')](_0xfe74('0x33'))){_0x38ff22['limit']=qs[_0xfe74('0x1c')](_0x5214c1[_0xfe74('0x2c')][_0xfe74('0x1c')]);_0x38ff22[_0xfe74('0x1b')]=qs[_0xfe74('0x1b')](_0x5214c1['query'][_0xfe74('0x1b')]);}_0x38ff22[_0xfe74('0x34')]=qs[_0xfe74('0x35')](_0x5214c1['query']['sort']);_0x38ff22[_0xfe74('0x36')]=qs[_0xfe74('0x37')](_['pick'](_0x5214c1[_0xfe74('0x2c')],_0x41418f[_0xfe74('0x37')]),_0x416f76);if(_0x5214c1[_0xfe74('0x2c')][_0xfe74('0x38')]){_0x38ff22[_0xfe74('0x36')]=_[_0xfe74('0x39')](_0x38ff22['where'],{'$or':_[_0xfe74('0x28')](_0x416f76,function(_0x47451d){if(_0x47451d[_0xfe74('0x2a')]!==_0xfe74('0x3a')){var _0x6231b8={};_0x6231b8[_0x47451d[_0xfe74('0x25')]]={'$like':'%'+_0x5214c1[_0xfe74('0x2c')][_0xfe74('0x38')]+'%'};return _0x6231b8;}})});}_0x38ff22=_[_0xfe74('0x39')]({},_0x38ff22,_0x5214c1['options']);var _0x5e4699={'where':_0x38ff22[_0xfe74('0x36')]};return db[_0xfe74('0x29')]['count'](_0x5e4699)[_0xfe74('0x21')](function(_0x50a1f0){_0x5a7d9d['count']=_0x50a1f0;if(_0x5214c1[_0xfe74('0x2c')][_0xfe74('0x3b')]){_0x38ff22[_0xfe74('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x38ff22);})[_0xfe74('0x21')](function(_0x368044){_0x5a7d9d['rows']=_0x368044;return _0x5a7d9d;})[_0xfe74('0x21')](respondWithFilteredResult(_0x308eb7,_0x38ff22))[_0xfe74('0x3d')](handleError(_0x308eb7,null));};exports['show']=function(_0x1e2318,_0x57359f){var _0x1d82d5={'raw':!![],'where':{'id':_0x1e2318['params']['id']}},_0x2b2d37={};_0x2b2d37[_0xfe74('0x2b')]=_['keys'](db['VoiceTransferReport'][_0xfe74('0x3e')]);_0x2b2d37['query']=_[_0xfe74('0x2d')](_0x1e2318[_0xfe74('0x2c')]);_0x2b2d37['filters']=_[_0xfe74('0x2e')](_0x2b2d37[_0xfe74('0x2b')],_0x2b2d37[_0xfe74('0x2c')]);_0x1d82d5[_0xfe74('0x2f')]=_['intersection'](_0x2b2d37[_0xfe74('0x2b')],qs['fields'](_0x1e2318['query'][_0xfe74('0x30')]));_0x1d82d5[_0xfe74('0x2f')]=_0x1d82d5[_0xfe74('0x2f')][_0xfe74('0x31')]?_0x1d82d5[_0xfe74('0x2f')]:_0x2b2d37[_0xfe74('0x2b')];if(_0x1e2318[_0xfe74('0x2c')][_0xfe74('0x3b')]){_0x1d82d5['include']=[{'all':!![]}];}_0x1d82d5=_[_0xfe74('0x39')]({},_0x1d82d5,_0x1e2318[_0xfe74('0x3f')]);return db[_0xfe74('0x29')][_0xfe74('0x40')](_0x1d82d5)[_0xfe74('0x21')](handleEntityNotFound(_0x57359f,null))[_0xfe74('0x21')](respondWithResult(_0x57359f,null))[_0xfe74('0x3d')](handleError(_0x57359f,null));};exports[_0xfe74('0x41')]=function(_0x287427,_0xbb990c){return db['VoiceTransferReport'][_0xfe74('0x41')](_0x287427['body'],{})['then'](respondWithResult(_0xbb990c,0xc9))[_0xfe74('0x3d')](handleError(_0xbb990c,null));};exports[_0xfe74('0x20')]=function(_0x148021,_0x15312b){if(_0x148021[_0xfe74('0x42')]['id']){delete _0x148021[_0xfe74('0x42')]['id'];}return db[_0xfe74('0x29')][_0xfe74('0x40')]({'where':{'id':_0x148021['params']['id']}})[_0xfe74('0x21')](handleEntityNotFound(_0x15312b,null))['then'](saveUpdates(_0x148021['body'],null))[_0xfe74('0x21')](respondWithResult(_0x15312b,null))[_0xfe74('0x3d')](handleError(_0x15312b,null));};exports['destroy']=function(_0x2d446e,_0x157fb9){return db[_0xfe74('0x29')]['find']({'where':{'id':_0x2d446e[_0xfe74('0x43')]['id']}})[_0xfe74('0x21')](handleEntityNotFound(_0x157fb9,null))[_0xfe74('0x21')](removeEntity(_0x157fb9,null))[_0xfe74('0x3d')](handleError(_0x157fb9,null));};exports[_0xfe74('0x44')]=function(_0x349a91,_0x525e25){return db[_0xfe74('0x29')][_0xfe74('0x44')]()[_0xfe74('0x21')](respondWithResult(_0x525e25,null))[_0xfe74('0x3d')](handleError(_0x525e25,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d3e907e..04f5d72 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 _0x5c27=['exports','VoiceTransferReport','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5c27,0xad));var _0x75c2=function(_0x102123,_0x5c1a48){_0x102123=_0x102123-0x0;var _0x151fee=_0x5c27[_0x102123];return _0x151fee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x75c2('0x0'))(_0x75c2('0x1'));var moment=require(_0x75c2('0x2'));var BPromise=require(_0x75c2('0x3'));var rp=require(_0x75c2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x75c2('0x5'));var attributes=require(_0x75c2('0x6'));module[_0x75c2('0x7')]=function(_0x5ddcc9,_0x4a338e){return _0x5ddcc9['define'](_0x75c2('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb82=['report_call_transfer','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0x398349,_0x46ae20){var _0xa06629=function(_0x54d1af){while(--_0x54d1af){_0x398349['push'](_0x398349['shift']());}};_0xa06629(++_0x46ae20);}(_0xbb82,0x151));var _0x2bb8=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbb82[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x2bb8('0x0'));var logger=require('../../config/logger')(_0x2bb8('0x1'));var moment=require(_0x2bb8('0x2'));var BPromise=require(_0x2bb8('0x3'));var rp=require(_0x2bb8('0x4'));var fs=require('fs');var path=require(_0x2bb8('0x5'));var rimraf=require(_0x2bb8('0x6'));var config=require(_0x2bb8('0x7'));var attributes=require(_0x2bb8('0x8'));module[_0x2bb8('0x9')]=function(_0x2e2005,_0x8ffeed){return _0x2e2005[_0x2bb8('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x2bb8('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 4548aeb..3923130 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 _0xe897=['CreateVoiceTransferReport','VoiceTransferReport','create','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x502e4d,_0x552eec){var _0x18ebe4=function(_0xb5e067){while(--_0xb5e067){_0x502e4d['push'](_0x502e4d['shift']());}};_0x18ebe4(++_0x552eec);}(_0xe897,0xf7));var _0x7e89=function(_0x5111e8,_0x5915d5){_0x5111e8=_0x5111e8-0x0;var _0x4978dd=_0xe897[_0x5111e8];return _0x4978dd;};'use strict';var _=require(_0x7e89('0x0'));var util=require(_0x7e89('0x1'));var moment=require(_0x7e89('0x2'));var BPromise=require(_0x7e89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e89('0x4'));var db=require(_0x7e89('0x5'))['db'];var utils=require(_0x7e89('0x6'));var logger=require(_0x7e89('0x7'))('rpc');var config=require(_0x7e89('0x8'));var jayson=require(_0x7e89('0x9'));var client=jayson[_0x7e89('0xa')][_0x7e89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5813c8,_0x350d8c,_0x3753b4){return new BPromise(function(_0x4b4403,_0x383b72){return client[_0x7e89('0xc')](_0x5813c8,_0x3753b4)['then'](function(_0x39f007){logger[_0x7e89('0xd')](_0x7e89('0xe'),_0x350d8c,_0x7e89('0xf'));logger[_0x7e89('0x10')](_0x7e89('0x11'),_0x350d8c,_0x7e89('0xf'),JSON[_0x7e89('0x12')](_0x39f007));if(_0x39f007['error']){if(_0x39f007[_0x7e89('0x13')][_0x7e89('0x14')]===0x1f4){logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x39f007[_0x7e89('0x13')]['message']);return _0x383b72(_0x39f007[_0x7e89('0x13')][_0x7e89('0x15')]);}logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x39f007['error'][_0x7e89('0x15')]);return _0x4b4403(_0x39f007['error'][_0x7e89('0x15')]);}else{logger[_0x7e89('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x350d8c,'request\x20sent');_0x4b4403(_0x39f007[_0x7e89('0x16')][_0x7e89('0x15')]);}})['catch'](function(_0x3fc886){logger[_0x7e89('0x13')](_0x7e89('0xe'),_0x350d8c,_0x3fc886);_0x383b72(_0x3fc886);});});}exports[_0x7e89('0x17')]=function(_0x50b8d3){var _0x17f9fd=this;return new Promise(function(_0x3eec05,_0x3cb504){return db[_0x7e89('0x18')][_0x7e89('0x19')](_0x50b8d3['body'],{'raw':_0x50b8d3[_0x7e89('0x1a')]?_0x50b8d3[_0x7e89('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36d3ad){logger[_0x7e89('0xd')]('CreateVoiceTransferReport',_0x50b8d3);logger[_0x7e89('0x10')](_0x7e89('0x17'),_0x50b8d3,JSON[_0x7e89('0x12')](_0x36d3ad));_0x3eec05(_0x36d3ad);})['catch'](function(_0x4be996){logger['error'](_0x7e89('0x17'),_0x4be996[_0x7e89('0x15')],_0x50b8d3);_0x3cb504(_0x17f9fd[_0x7e89('0x13')](0x1f4,_0x4be996['message']));});});}; \ No newline at end of file +var _0xc309=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xc309,0x13d));var _0x9c30=function(_0x14fa9c,_0x239ce9){_0x14fa9c=_0x14fa9c-0x0;var _0x37c3c7=_0xc309[_0x14fa9c];return _0x37c3c7;};'use strict';var _=require('lodash');var util=require(_0x9c30('0x0'));var moment=require(_0x9c30('0x1'));var BPromise=require(_0x9c30('0x2'));var rs=require(_0x9c30('0x3'));var fs=require('fs');var Redis=require(_0x9c30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c30('0x5'));var logger=require(_0x9c30('0x6'))(_0x9c30('0x7'));var config=require(_0x9c30('0x8'));var jayson=require(_0x9c30('0x9'));var client=jayson['client'][_0x9c30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x243d43,_0x12e63,_0x1c4142){return new BPromise(function(_0x444939,_0x1bec38){return client['request'](_0x243d43,_0x1c4142)[_0x9c30('0xb')](function(_0x41700f){logger[_0x9c30('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x12e63,_0x9c30('0xd'));logger[_0x9c30('0xe')](_0x9c30('0xf'),_0x12e63,_0x9c30('0xd'),JSON[_0x9c30('0x10')](_0x41700f));if(_0x41700f[_0x9c30('0x11')]){if(_0x41700f['error'][_0x9c30('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x12e63,_0x41700f[_0x9c30('0x11')][_0x9c30('0x13')]);return _0x1bec38(_0x41700f[_0x9c30('0x11')][_0x9c30('0x13')]);}logger[_0x9c30('0x11')](_0x9c30('0x14'),_0x12e63,_0x41700f[_0x9c30('0x11')][_0x9c30('0x13')]);return _0x444939(_0x41700f[_0x9c30('0x11')][_0x9c30('0x13')]);}else{logger[_0x9c30('0xc')](_0x9c30('0x14'),_0x12e63,_0x9c30('0xd'));_0x444939(_0x41700f['result'][_0x9c30('0x13')]);}})[_0x9c30('0x15')](function(_0x4f6ece){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x12e63,_0x4f6ece);_0x1bec38(_0x4f6ece);});});}exports[_0x9c30('0x16')]=function(_0x463471){var _0x462bf8=this;return new Promise(function(_0x3d7ddc,_0x17961e){return db[_0x9c30('0x17')][_0x9c30('0x18')](_0x463471['body'],{'raw':_0x463471[_0x9c30('0x19')]?_0x463471['options'][_0x9c30('0x1a')]===undefined?!![]:![]:!![]})[_0x9c30('0xb')](function(_0x59daf5){logger[_0x9c30('0xc')](_0x9c30('0x16'),_0x463471);logger['debug']('CreateVoiceTransferReport',_0x463471,JSON['stringify'](_0x59daf5));_0x3d7ddc(_0x59daf5);})[_0x9c30('0x15')](function(_0x25de68){logger[_0x9c30('0x11')](_0x9c30('0x16'),_0x25de68[_0x9c30('0x13')],_0x463471);_0x17961e(_0x462bf8['error'](0x1f4,_0x25de68[_0x9c30('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 45e8e0d..22487e5 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 _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x46dc12,_0x55ccc3){var _0x4c1b0e=function(_0x2aa0cd){while(--_0x2aa0cd){_0x46dc12['push'](_0x46dc12['shift']());}};_0x4c1b0e(++_0x55ccc3);}(_0xe5b3,0x133));var _0x3e5b=function(_0x13cfcd,_0x2c3d5d){_0x13cfcd=_0x13cfcd-0x0;var _0x3b4a88=_0xe5b3[_0x13cfcd];return _0x3b4a88;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x1e770c,_0x450e0a){var _0x418372=function(_0x201f4c){while(--_0x201f4c){_0x1e770c['push'](_0x1e770c['shift']());}};_0x418372(++_0x450e0a);}(_0xedd9,0xfc));var _0x9edd=function(_0x18e8c8,_0x5b6b81){_0x18e8c8=_0x18e8c8-0x0;var _0x1fa76e=_0xedd9[_0x18e8c8];return _0x1fa76e;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('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 a0e30b3..c232820 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 _0xca66=['sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','then','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','sessionId','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x10a889,_0x220612){var _0x3b5ed3=function(_0x4f0137){while(--_0x4f0137){_0x10a889['push'](_0x10a889['shift']());}};_0x3b5ed3(++_0x220612);}(_0xca66,0x8b));var _0x6ca6=function(_0x1fb9b0,_0x22ffd7){_0x1fb9b0=_0x1fb9b0-0x0;var _0x37ce00=_0xca66[_0x1fb9b0];return _0x37ce00;};'use strict';var path=require(_0x6ca6('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ca6('0x1'));var util=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6ca6('0x4')]['http']({'port':0x232a});var logger=require(_0x6ca6('0x5'))('webbarapi');var Redis=require(_0x6ca6('0x6'));config[_0x6ca6('0x7')]=_[_0x6ca6('0x8')](config[_0x6ca6('0x7')],{'host':_0x6ca6('0x9'),'port':0x18eb});var io=require(_0x6ca6('0xa'))(new Redis(config[_0x6ca6('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'callNumber':{'type':_0x6ca6('0xd'),'required':[!![],_0x6ca6('0xe')]},'callerId':{'type':_0x6ca6('0xd')},'callbackUrl':{'type':_0x6ca6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6ca6('0xf')]},'transferNumber':{'type':_0x6ca6('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ca6('0xc')]}});function emit(_0x19e94f,_0x260b56,_0x3f03e6){logger[_0x6ca6('0x10')](_0x19e94f,_0x260b56,JSON[_0x6ca6('0x11')](_0x3f03e6));io['to'](_0x19e94f)[_0x6ca6('0x12')](_0x260b56,_0x3f03e6);}function handleError(_0x4f056d){return function(_0x2391ce){console[_0x6ca6('0x13')](_0x6ca6('0x14'),_0x2391ce,_0x2391ce instanceof RangeError);logger[_0x6ca6('0x15')](_0x2391ce[_0x6ca6('0x16')]);if(_0x2391ce instanceof RangeError){if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d[_0x6ca6('0x18')](0x194)[_0x6ca6('0x19')](_0x2391ce);}else{if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d['status'](0x1f4)[_0x6ca6('0x19')](_0x2391ce);}};}function checkError(){return function(_0x254afe){if(!_0x254afe){throw new RangeError(_0x6ca6('0x1a'));}return _0x254afe;};}function respondWithRpcPromise(_0x195c92,_0x3a24aa){return new BPromise(function(_0x438694,_0x593f15){var _0xfb962d=amiClient;return _0xfb962d[_0x6ca6('0x1b')](_0x195c92,_0x3a24aa)['then'](function(_0x4927c1){if(_0x4927c1[_0x6ca6('0x15')]){if(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1c')]===0x1f4){return _0x593f15(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1d')]);}return _0x438694(_0x4927c1['error'][_0x6ca6('0x1d')]);}else{_0x438694(_0x4927c1[_0x6ca6('0x1e')]);}})[_0x6ca6('0x1f')](function(_0x2d8c64){_0x593f15(_0x2d8c64);});});}function getAgent(_0x3971a2){return db[_0x6ca6('0x20')][_0x6ca6('0x21')]({'where':{'id':_0x3971a2,'role':_0x6ca6('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x55b07f,_0x144ec5){return new BPromise(function(_0x9467bd,_0xf1d821){var _0x141c0f=respondWithRpcPromise('VoiceChannels');var _0x5ea6f7=getAgent(_0x55b07f);Promise[_0x6ca6('0x23')]([_0x141c0f,_0x5ea6f7])['then'](function(_0x4ab84c){var _0x141e78=_0x4ab84c[0x0];var _0xefd407=_0x4ab84c[0x1];var _0x4a15cb=_[_0x6ca6('0x24')](_0x141e78[_0x6ca6('0x25')],function(_0xac50e8){return _0xac50e8[_0x6ca6('0x26')]==_0xefd407['id']&&_0xac50e8['sessionId']==_0x144ec5;});if(_0x4a15cb[_0x6ca6('0x27')]==0x1){_0x9467bd(_0xefd407);}else{_0xf1d821(new RangeError(_0x6ca6('0x28')+_0x144ec5+_0x6ca6('0x29')));}});});}exports[_0x6ca6('0x2a')]=function(_0x480264,_0x467a89){logger[_0x6ca6('0x10')](_0x6ca6('0x2b'),_0x480264[_0x6ca6('0x2c')]);var _0x5788a2=originateValidation['validate'](_0x480264['body']);if(_0x5788a2['length']>0x0){return _0x467a89['status'](0x190)[_0x6ca6('0x2d')](_0x5788a2);}var _0x3389c2=_0x480264[_0x6ca6('0x2c')]['userId'];var _0x206ecd=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x2e')];var _0x388e32=_0x480264['body'][_0x6ca6('0x2f')];var _0x40de00=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x30')];return getAgent(_0x3389c2)['then'](function(_0x1e28b4){logger['info'](_0x6ca6('0x31'),_0x1e28b4['name']);emit(util['format'](_0x6ca6('0x32'),_0x1e28b4[_0x6ca6('0x17')]),_0x6ca6('0x33'),{'callNumber':_0x206ecd,'callerId':_0x388e32,'callbackUrl':_0x40de00});return _0x467a89[_0x6ca6('0x18')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x467a89));};exports[_0x6ca6('0x34')]=function(_0x49c8a4,_0x43c2cb){logger['info'](_0x6ca6('0x35'),_0x49c8a4['body']);var _0x1ada8b=hangupValidation[_0x6ca6('0x36')](_0x49c8a4[_0x6ca6('0x2c')]);if(_0x1ada8b[_0x6ca6('0x27')]>0x0){return _0x43c2cb[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x1ada8b);}var _0x45e77b=_0x49c8a4[_0x6ca6('0x2c')]['userId'];var _0x2f6daf=_0x49c8a4['body']['sessionId'];return getAgent(_0x45e77b)[_0x6ca6('0x37')](function(_0x306eda){logger['info'](_0x6ca6('0x31'),_0x306eda['name']);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x306eda[_0x6ca6('0x17')]),_0x6ca6('0x39'),{'sessionId':_0x2f6daf});return _0x43c2cb['status'](0xc8)['json']({'error':![],'message':_0x6ca6('0x3a')});})[_0x6ca6('0x1f')](handleError(_0x43c2cb));};exports[_0x6ca6('0x3b')]=function(_0x3423e2,_0x4e6d4){logger['info'](_0x6ca6('0x3c'),_0x3423e2[_0x6ca6('0x2c')]);var _0x5bed6e=answerValidation[_0x6ca6('0x36')](_0x3423e2[_0x6ca6('0x2c')]);if(_0x5bed6e[_0x6ca6('0x27')]>0x0){return _0x4e6d4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x5bed6e);}var _0x3e658e=_0x3423e2[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1a8b7e=_0x3423e2['body'][_0x6ca6('0x3e')];return getAgent(_0x3e658e)[_0x6ca6('0x37')](function(_0x243661){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x243661[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x243661['name']),'webbar:answer',{'sessionId':_0x1a8b7e});return _0x4e6d4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x3f')});})[_0x6ca6('0x1f')](handleError(_0x4e6d4));};exports[_0x6ca6('0x40')]=function(_0x33f5d5,_0x1f51f4){logger['info']('hold\x20fired:',_0x33f5d5[_0x6ca6('0x2c')]);var _0x42b263=holdValidation['validate'](_0x33f5d5[_0x6ca6('0x2c')]);if(_0x42b263[_0x6ca6('0x27')]>0x0){return _0x1f51f4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x42b263);}var _0xc1928f=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x5f27f5=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0xc1928f)[_0x6ca6('0x37')](function(_0x4fde51){logger[_0x6ca6('0x10')]('entityFound:',_0x4fde51[_0x6ca6('0x17')]);emit(util['format']('user:%s',_0x4fde51['name']),_0x6ca6('0x41'),{'sessionId':_0x5f27f5});return _0x1f51f4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x1f51f4));};exports['unhold']=function(_0x1f552d,_0x1010a6){logger[_0x6ca6('0x10')](_0x6ca6('0x42'),_0x1f552d[_0x6ca6('0x2c')]);var _0x2e6364=unholdValidation[_0x6ca6('0x36')](_0x1f552d[_0x6ca6('0x2c')]);if(_0x2e6364[_0x6ca6('0x27')]>0x0){return _0x1010a6[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2e6364);}var _0x5578fb=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1de2ca=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0x5578fb)['then'](function(_0x14d87a){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x14d87a['name']);emit(util['format']('user:%s',_0x14d87a['name']),_0x6ca6('0x43'),{'sessionId':_0x1de2ca});return _0x1010a6[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1010a6));};exports[_0x6ca6('0x44')]=function(_0x2cbf30,_0x2591de){logger['info'](_0x6ca6('0x45'),_0x2591de['body']);var _0x281759=callsValidation[_0x6ca6('0x36')](_0x2cbf30[_0x6ca6('0x2c')]);if(_0x281759[_0x6ca6('0x27')]>0x0){return _0x2591de['status'](0x190)[_0x6ca6('0x2d')](_0x281759);}var _0x4874d8=_0x2cbf30['body'][_0x6ca6('0x3d')];var _0x11538e=respondWithRpcPromise(_0x6ca6('0x46'));var _0x35854a=getAgent(_0x4874d8);return Promise['all']([_0x11538e,_0x35854a])[_0x6ca6('0x37')](function(_0x1c12ae){var _0x2c4053=_0x1c12ae[0x0];var _0x13d3ea=_0x1c12ae[0x1];var _0x43881a=_[_0x6ca6('0x24')](_0x2c4053[_0x6ca6('0x25')],function(_0x405609){return _0x405609[_0x6ca6('0x26')]==_0x13d3ea['id'];});return _0x2591de[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'count':_0x43881a[_0x6ca6('0x27')],'rows':_0x43881a});})[_0x6ca6('0x1f')](handleError(_0x2591de));};exports[_0x6ca6('0x47')]=function(_0x2eeed6,_0x290c04){logger['info'](_0x6ca6('0x48'),_0x2eeed6[_0x6ca6('0x2c')]);var _0x2f4886=conferenceValidation[_0x6ca6('0x36')](_0x2eeed6[_0x6ca6('0x2c')]);if(_0x2f4886[_0x6ca6('0x27')]>0x0){return _0x290c04[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2f4886);}var _0x3328ea=_0x2eeed6[_0x6ca6('0x2c')][_0x6ca6('0x3d')];return getAgent(_0x3328ea)[_0x6ca6('0x37')](function(_0x9834d6){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x9834d6[_0x6ca6('0x17')]);emit(util['format'](_0x6ca6('0x32'),_0x9834d6[_0x6ca6('0x17')]),_0x6ca6('0x49'));return _0x290c04[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4a')});})['catch'](handleError(_0x290c04));};exports['transfer']=function(_0x509fe3,_0x21f786){logger[_0x6ca6('0x10')]('transfer\x20fired:',_0x509fe3[_0x6ca6('0x2c')]);var _0xc6021a=transferValidation[_0x6ca6('0x36')](_0x509fe3['body']);if(_0xc6021a[_0x6ca6('0x27')]>0x0){return _0x21f786[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0xc6021a);}var _0x1c3064=_0x509fe3[_0x6ca6('0x2c')]['userId'];var _0x514684=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x3e')];var _0x47d420=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x4b')];return getAgent(_0x1c3064)[_0x6ca6('0x37')](function(_0x19e7ac){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x19e7ac[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x19e7ac['name']),'webbar:transfer',{'sessionId':_0x514684,'transferNumber':_0x47d420});return _0x21f786[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4c')});})[_0x6ca6('0x1f')](handleError(_0x21f786));}; \ No newline at end of file +var _0x3667=['defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','send','request','then','error','code','message','catch','User','agent','VoiceChannels','filter','rows','UserId','sessionId','originate\x20fired:','body','length','json','userId','callNumber','callerId','entityFound:','format','status','hangup\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis'];(function(_0x546329,_0x19258f){var _0x3288d6=function(_0x49f476){while(--_0x49f476){_0x546329['push'](_0x546329['shift']());}};_0x3288d6(++_0x19258f);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x7366('0x0'));var fs=require('fs');var _=require(_0x7366('0x1'));var db=require(_0x7366('0x2'))['db'];var config=require(_0x7366('0x3'));var util=require(_0x7366('0x4'));var BPromise=require('bluebird');var jayson=require(_0x7366('0x5'));var amiClient=jayson[_0x7366('0x6')]['http']({'port':0x232a});var logger=require(_0x7366('0x7'))(_0x7366('0x8'));var Redis=require(_0x7366('0x9'));config[_0x7366('0xa')]=_[_0x7366('0xb')](config['redis'],{'host':_0x7366('0xc'),'port':0x18eb});var io=require(_0x7366('0xd'))(new Redis(config[_0x7366('0xa')]));var Schema=require(_0x7366('0xe'));var originateValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'callNumber':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x12')]},'callerId':{'type':_0x7366('0x11')},'callbackUrl':{'type':_0x7366('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x13')]},'transferNumber':{'type':_0x7366('0x11'),'required':[!![],_0x7366('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]},'sessionId':{'type':_0x7366('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7366('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7366('0xf'),'required':[!![],_0x7366('0x10')]}});function emit(_0x2c0422,_0xe2c87b,_0x431c01){logger[_0x7366('0x15')](_0x2c0422,_0xe2c87b,JSON[_0x7366('0x16')](_0x431c01));io['to'](_0x2c0422)[_0x7366('0x17')](_0xe2c87b,_0x431c01);}function handleError(_0x41113f){return function(_0x1a71f5){console['log'](_0x7366('0x18'),_0x1a71f5,_0x1a71f5 instanceof RangeError);logger['error'](_0x1a71f5[_0x7366('0x19')]);if(_0x1a71f5 instanceof RangeError){if(_0x1a71f5[_0x7366('0x1a')]){delete _0x1a71f5[_0x7366('0x1a')];}_0x41113f['status'](0x194)[_0x7366('0x1b')](_0x1a71f5);}else{if(_0x1a71f5[_0x7366('0x1a')]){delete _0x1a71f5[_0x7366('0x1a')];}_0x41113f['status'](0x1f4)[_0x7366('0x1b')](_0x1a71f5);}};}function checkError(){return function(_0x1946c6){if(!_0x1946c6){throw new RangeError('NotFound');}return _0x1946c6;};}function respondWithRpcPromise(_0x3bfbca,_0x411dfe){return new BPromise(function(_0xaab659,_0x1a12d2){var _0x3c30a2=amiClient;return _0x3c30a2[_0x7366('0x1c')](_0x3bfbca,_0x411dfe)[_0x7366('0x1d')](function(_0x22ed7e){if(_0x22ed7e[_0x7366('0x1e')]){if(_0x22ed7e[_0x7366('0x1e')][_0x7366('0x1f')]===0x1f4){return _0x1a12d2(_0x22ed7e[_0x7366('0x1e')][_0x7366('0x20')]);}return _0xaab659(_0x22ed7e['error'][_0x7366('0x20')]);}else{_0xaab659(_0x22ed7e['result']);}})[_0x7366('0x21')](function(_0x4ab987){_0x1a12d2(_0x4ab987);});});}function getAgent(_0x5e30fb){return db[_0x7366('0x22')]['findOne']({'where':{'id':_0x5e30fb,'role':_0x7366('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x256633,_0x191177){return new BPromise(function(_0x5c37e2,_0x6d196a){var _0x565aa7=respondWithRpcPromise(_0x7366('0x24'));var _0x2b61af=getAgent(_0x256633);Promise['all']([_0x565aa7,_0x2b61af])[_0x7366('0x1d')](function(_0x507baf){var _0xc58ac7=_0x507baf[0x0];var _0x46f80f=_0x507baf[0x1];var _0x39d6ea=_[_0x7366('0x25')](_0xc58ac7[_0x7366('0x26')],function(_0x5e075c){return _0x5e075c[_0x7366('0x27')]==_0x46f80f['id']&&_0x5e075c[_0x7366('0x28')]==_0x191177;});if(_0x39d6ea['length']==0x1){_0x5c37e2(_0x46f80f);}else{_0x6d196a(new RangeError('sessionId\x20'+_0x191177+'\x20not\x20found!'));}});});}exports['originate']=function(_0x2a1d46,_0x43d487){logger[_0x7366('0x15')](_0x7366('0x29'),_0x2a1d46['body']);var _0x3ca5e6=originateValidation[_0x7366('0xe')](_0x2a1d46[_0x7366('0x2a')]);if(_0x3ca5e6[_0x7366('0x2b')]>0x0){return _0x43d487['status'](0x190)[_0x7366('0x2c')](_0x3ca5e6);}var _0x311dab=_0x2a1d46['body'][_0x7366('0x2d')];var _0x44c81e=_0x2a1d46[_0x7366('0x2a')][_0x7366('0x2e')];var _0x7779c7=_0x2a1d46[_0x7366('0x2a')][_0x7366('0x2f')];var _0x26858b=_0x2a1d46[_0x7366('0x2a')]['callbackUrl'];return getAgent(_0x311dab)[_0x7366('0x1d')](function(_0x83b879){logger['info'](_0x7366('0x30'),_0x83b879[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x83b879[_0x7366('0x1a')]),'webbar:originate',{'callNumber':_0x44c81e,'callerId':_0x7779c7,'callbackUrl':_0x26858b});return _0x43d487[_0x7366('0x32')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x7366('0x21')](handleError(_0x43d487));};exports['hangup']=function(_0x3228b5,_0x116081){logger['info'](_0x7366('0x33'),_0x3228b5['body']);var _0x36f861=hangupValidation[_0x7366('0xe')](_0x3228b5[_0x7366('0x2a')]);if(_0x36f861[_0x7366('0x2b')]>0x0){return _0x116081['status'](0x190)[_0x7366('0x2c')](_0x36f861);}var _0x1d8be3=_0x3228b5[_0x7366('0x2a')]['userId'];var _0x487e36=_0x3228b5[_0x7366('0x2a')][_0x7366('0x28')];return getAgent(_0x1d8be3)[_0x7366('0x1d')](function(_0x18e9b1){logger[_0x7366('0x15')](_0x7366('0x30'),_0x18e9b1['name']);emit(util['format'](_0x7366('0x34'),_0x18e9b1[_0x7366('0x1a')]),'webbar:hangup',{'sessionId':_0x487e36});return _0x116081[_0x7366('0x32')](0xc8)[_0x7366('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0x7366('0x21')](handleError(_0x116081));};exports['answer']=function(_0xafac5,_0x1834cf){logger['info']('answer\x20fired:',_0xafac5[_0x7366('0x2a')]);var _0xedc3c7=answerValidation[_0x7366('0xe')](_0xafac5[_0x7366('0x2a')]);if(_0xedc3c7['length']>0x0){return _0x1834cf[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0xedc3c7);}var _0xb9d7e4=_0xafac5[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3d8c79=_0xafac5[_0x7366('0x2a')]['sessionId'];return getAgent(_0xb9d7e4)[_0x7366('0x1d')](function(_0x320fc2){logger[_0x7366('0x15')]('entityFound:',_0x320fc2[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x320fc2[_0x7366('0x1a')]),_0x7366('0x35'),{'sessionId':_0x3d8c79});return _0x1834cf[_0x7366('0x32')](0xc8)['json']({'error':![],'message':_0x7366('0x36')});})[_0x7366('0x21')](handleError(_0x1834cf));};exports[_0x7366('0x37')]=function(_0x570459,_0x37b251){logger[_0x7366('0x15')](_0x7366('0x38'),_0x570459['body']);var _0xb32e28=holdValidation[_0x7366('0xe')](_0x570459[_0x7366('0x2a')]);if(_0xb32e28[_0x7366('0x2b')]>0x0){return _0x37b251['status'](0x190)[_0x7366('0x2c')](_0xb32e28);}var _0x2d1c52=_0x570459[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3cf180=_0x570459[_0x7366('0x2a')][_0x7366('0x28')];return getAgent(_0x2d1c52)[_0x7366('0x1d')](function(_0x2ad8bf){logger['info'](_0x7366('0x30'),_0x2ad8bf[_0x7366('0x1a')]);emit(util['format'](_0x7366('0x34'),_0x2ad8bf[_0x7366('0x1a')]),'webbar:hold',{'sessionId':_0x3cf180});return _0x37b251[_0x7366('0x32')](0xc8)['json']({'error':![],'message':_0x7366('0x39')});})[_0x7366('0x21')](handleError(_0x37b251));};exports[_0x7366('0x3a')]=function(_0x22026a,_0x588b31){logger[_0x7366('0x15')](_0x7366('0x3b'),_0x22026a[_0x7366('0x2a')]);var _0x46a532=unholdValidation[_0x7366('0xe')](_0x22026a[_0x7366('0x2a')]);if(_0x46a532[_0x7366('0x2b')]>0x0){return _0x588b31[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0x46a532);}var _0x336b4d=_0x22026a[_0x7366('0x2a')][_0x7366('0x2d')];var _0x5d2a2c=_0x22026a[_0x7366('0x2a')]['sessionId'];return getAgent(_0x336b4d)['then'](function(_0x1d488b){logger[_0x7366('0x15')]('entityFound:',_0x1d488b[_0x7366('0x1a')]);emit(util[_0x7366('0x31')]('user:%s',_0x1d488b['name']),_0x7366('0x3c'),{'sessionId':_0x5d2a2c});return _0x588b31['status'](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x3d')});})['catch'](handleError(_0x588b31));};exports[_0x7366('0x3e')]=function(_0x1b3923,_0xcce4ef){logger['info'](_0x7366('0x3f'),_0xcce4ef[_0x7366('0x2a')]);var _0x2ca931=callsValidation[_0x7366('0xe')](_0x1b3923['body']);if(_0x2ca931[_0x7366('0x2b')]>0x0){return _0xcce4ef[_0x7366('0x32')](0x190)[_0x7366('0x2c')](_0x2ca931);}var _0xa15c2b=_0x1b3923[_0x7366('0x2a')]['userId'];var _0x1249a7=respondWithRpcPromise(_0x7366('0x24'));var _0x5b3160=getAgent(_0xa15c2b);return Promise[_0x7366('0x40')]([_0x1249a7,_0x5b3160])['then'](function(_0x2335cc){var _0x5cbefc=_0x2335cc[0x0];var _0x427066=_0x2335cc[0x1];var _0x16d438=_['filter'](_0x5cbefc[_0x7366('0x26')],function(_0xec468a){return _0xec468a[_0x7366('0x27')]==_0x427066['id'];});return _0xcce4ef[_0x7366('0x32')](0xc8)['json']({'count':_0x16d438['length'],'rows':_0x16d438});})[_0x7366('0x21')](handleError(_0xcce4ef));};exports['conference']=function(_0x432755,_0x14f758){logger[_0x7366('0x15')](_0x7366('0x41'),_0x432755[_0x7366('0x2a')]);var _0x3e64b7=conferenceValidation[_0x7366('0xe')](_0x432755[_0x7366('0x2a')]);if(_0x3e64b7[_0x7366('0x2b')]>0x0){return _0x14f758['status'](0x190)[_0x7366('0x2c')](_0x3e64b7);}var _0x52d254=_0x432755['body']['userId'];return getAgent(_0x52d254)[_0x7366('0x1d')](function(_0x523016){logger[_0x7366('0x15')]('entityFound:',_0x523016[_0x7366('0x1a')]);emit(util['format'](_0x7366('0x34'),_0x523016[_0x7366('0x1a')]),'webbar:conference');return _0x14f758['status'](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x42')});})[_0x7366('0x21')](handleError(_0x14f758));};exports[_0x7366('0x43')]=function(_0x5dc9e2,_0x349bd2){logger[_0x7366('0x15')](_0x7366('0x44'),_0x5dc9e2['body']);var _0x5a9aeb=transferValidation[_0x7366('0xe')](_0x5dc9e2[_0x7366('0x2a')]);if(_0x5a9aeb[_0x7366('0x2b')]>0x0){return _0x349bd2['status'](0x190)[_0x7366('0x2c')](_0x5a9aeb);}var _0x1e121f=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x2d')];var _0x3aa57b=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x28')];var _0x38c65b=_0x5dc9e2[_0x7366('0x2a')][_0x7366('0x45')];return getAgent(_0x1e121f)[_0x7366('0x1d')](function(_0x5d5c2e){logger[_0x7366('0x15')](_0x7366('0x30'),_0x5d5c2e['name']);emit(util[_0x7366('0x31')]('user:%s',_0x5d5c2e['name']),_0x7366('0x46'),{'sessionId':_0x3aa57b,'transferNumber':_0x38c65b});return _0x349bd2[_0x7366('0x32')](0xc8)[_0x7366('0x2c')]({'error':![],'message':_0x7366('0x47')});})[_0x7366('0x21')](handleError(_0x349bd2));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 03feaa8..c78aabb 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 _0xacf4=['./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x724d7a,_0x2fe1e1){var _0x2e1533=function(_0x4f435a){while(--_0x4f435a){_0x724d7a['push'](_0x724d7a['shift']());}};_0x2e1533(++_0x2fe1e1);}(_0xacf4,0xe7));var _0x4acf=function(_0x50470f,_0x1e0719){_0x50470f=_0x50470f-0x0;var _0x45e97c=_0xacf4[_0x50470f];return _0x45e97c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4acf('0x0'));var timeout=require(_0x4acf('0x1'));var express=require(_0x4acf('0x2'));var router=express[_0x4acf('0x3')]();var fs_extra=require(_0x4acf('0x4'));var auth=require(_0x4acf('0x5'));var interaction=require(_0x4acf('0x6'));var config=require('../../config/environment');var controller=require(_0x4acf('0x7'));router[_0x4acf('0x8')]('/',auth['isAuthenticated'](),controller[_0x4acf('0x9')]);router[_0x4acf('0x8')](_0x4acf('0xa'),auth[_0x4acf('0xb')](),controller[_0x4acf('0xc')]);router['get']('/:id',auth[_0x4acf('0xb')](),controller['show']);router[_0x4acf('0x8')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['getDispositions']);router[_0x4acf('0x8')](_0x4acf('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4acf('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0xf')]);router[_0x4acf('0x8')](_0x4acf('0x10'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x11')]);router[_0x4acf('0x12')]('/',auth[_0x4acf('0xb')](),controller[_0x4acf('0x13')]);router[_0x4acf('0x12')](_0x4acf('0xd'),auth[_0x4acf('0xb')](),controller['addDisposition']);router[_0x4acf('0x12')]('/:id/canned_answers',auth[_0x4acf('0xb')](),controller[_0x4acf('0x14')]);router[_0x4acf('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x4acf('0x15')]);router[_0x4acf('0x12')](_0x4acf('0x10'),auth['isAuthenticated'](),controller[_0x4acf('0x16')]);router[_0x4acf('0x12')](_0x4acf('0x17'),controller[_0x4acf('0x18')]);router[_0x4acf('0x12')](_0x4acf('0x19'),auth[_0x4acf('0xb')](),controller[_0x4acf('0x1a')]);router[_0x4acf('0x1b')](_0x4acf('0x1c'),auth[_0x4acf('0xb')](),controller['update']);router[_0x4acf('0x1d')](_0x4acf('0x1c'),auth['isAuthenticated'](),controller[_0x4acf('0x1e')]);router[_0x4acf('0x1d')]('/:id/dispositions',auth[_0x4acf('0xb')](),controller[_0x4acf('0x1f')]);router[_0x4acf('0x1d')](_0x4acf('0xe'),auth['isAuthenticated'](),controller[_0x4acf('0x20')]);router[_0x4acf('0x1d')]('/:id/users',auth[_0x4acf('0xb')](),controller[_0x4acf('0x21')]);module['exports']=router; \ No newline at end of file +var _0x896e=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/send','send','put','destroy','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x896e,0x1e9));var _0xe896=function(_0x1cd9df,_0x51a529){_0x1cd9df=_0x1cd9df-0x0;var _0xf0af17=_0x896e[_0x1cd9df];return _0xf0af17;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['get'](_0xe896('0x12'),auth['isAuthenticated'](),controller[_0xe896('0x13')]);router['get'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);router['get'](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x17')]);router['get'](_0xe896('0x18'),auth[_0xe896('0xe')](),controller[_0xe896('0x19')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x1a')]);router[_0xe896('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe896('0x1c')]);router[_0xe896('0x1b')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xe896('0x1d')]);router[_0xe896('0x1b')]('/:id/users',auth[_0xe896('0xe')](),controller['addAgents']);router[_0xe896('0x1b')](_0xe896('0x18'),auth[_0xe896('0xe')](),controller['addApplications']);router[_0xe896('0x1b')](_0xe896('0x1e'),controller[_0xe896('0x1f')]);router[_0xe896('0x1b')](_0xe896('0x20'),auth[_0xe896('0xe')](),controller[_0xe896('0x21')]);router[_0xe896('0x22')]('/:id',auth[_0xe896('0xe')](),controller['update']);router['delete'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x23')]);router[_0xe896('0x24')]('/:id/dispositions',auth[_0xe896('0xe')](),controller['removeDispositions']);router['delete'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x25')]);router[_0xe896('0x24')](_0xe896('0x16'),auth[_0xe896('0xe')](),controller[_0xe896('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ae996a7..fbc12fa 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 _0xd98e=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','STRING','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3a5e11,_0x346470){var _0x2ca2ba=function(_0x334a47){while(--_0x334a47){_0x3a5e11['push'](_0x3a5e11['shift']());}};_0x2ca2ba(++_0x346470);}(_0xd98e,0x1a3));var _0xed98=function(_0x407ea9,_0x5df008){_0x407ea9=_0x407ea9-0x0;var _0x3a5722=_0xd98e[_0x407ea9];return _0x3a5722;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xed98('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xed98('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0xed98('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xed98('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xed98('0x2')]},'type':{'type':Sequelize[_0xed98('0x3')](_0xed98('0x4'),_0xed98('0x5'))},'accountSid':{'type':Sequelize[_0xed98('0x2')]},'baseUrl':{'type':Sequelize[_0xed98('0x2')]},'authToken':{'type':Sequelize[_0xed98('0x2')]},'notificationTemplate':{'type':Sequelize[_0xed98('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed98('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed98('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xed98('0x7')],'defaultValue':![],'comment':_0xed98('0x9'),'set':function(_0x3c28a9){if(!_0x3c28a9){this[_0xed98('0xa')](_0xed98('0xb'),null);}this[_0xed98('0xa')](_0xed98('0xc'),_0x3c28a9);}},'description':{'type':Sequelize[_0xed98('0x2')]}}; \ No newline at end of file +var _0x2265=['setDataValue','mandatoryDispositionPauseId','randomstring','STRING','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x5ac3bc,_0xeb6756){var _0x21c6ca=function(_0x428811){while(--_0x428811){_0x5ac3bc['push'](_0x5ac3bc['shift']());}};_0x21c6ca(++_0xeb6756);}(_0x2265,0xfc));var _0x5226=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2265[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5226('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5226('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x5226('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x5226('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5226('0x1')]},'type':{'type':Sequelize['ENUM'](_0x5226('0x2'),_0x5226('0x3'))},'accountSid':{'type':Sequelize[_0x5226('0x1')]},'baseUrl':{'type':Sequelize[_0x5226('0x1')]},'authToken':{'type':Sequelize[_0x5226('0x1')]},'notificationTemplate':{'type':Sequelize[_0x5226('0x4')],'defaultValue':function(){return _0x5226('0x5');}},'notificationSound':{'type':Sequelize[_0x5226('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x5226('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5226('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5226('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5226('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5226('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5226('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30afd6){if(!_0x30afd6){this[_0x5226('0x8')](_0x5226('0x9'),null);}this[_0x5226('0x8')]('mandatoryDisposition',_0x30afd6);}},'description':{'type':Sequelize[_0x5226('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 826251f..675475e 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 _0x9833=['code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','keys','filters','model','attributes','intersection','query','fields','length','order','sort','pick','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','filter','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','send','getApplications','whatsapp','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','MessageSid','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x1f5ab3,_0x2d2473){var _0x2bd0d7=function(_0x41c41b){while(--_0x41c41b){_0x1f5ab3['push'](_0x1f5ab3['shift']());}};_0x2bd0d7(++_0x2d2473);}(_0x9833,0x9a));var _0x3983=function(_0x373ffe,_0x268f8f){_0x373ffe=_0x373ffe-0x0;var _0x40fa43=_0x9833[_0x373ffe];return _0x40fa43;};'use strict';var emlformat=require(_0x3983('0x0'));var rimraf=require(_0x3983('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3983('0x2'));var moment=require(_0x3983('0x3'));var BPromise=require(_0x3983('0x4'));var Mustache=require('mustache');var util=require(_0x3983('0x5'));var path=require(_0x3983('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3983('0x7'));var _=require(_0x3983('0x8'));var squel=require(_0x3983('0x9'));var crypto=require(_0x3983('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3983('0xb'));var toCsv=require(_0x3983('0xc'));var querystring=require(_0x3983('0xd'));var Papa=require(_0x3983('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3983('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3983('0x10'))(_0x3983('0x11'));var utils=require(_0x3983('0x12'));var config=require(_0x3983('0x13'));var licenseUtil=require(_0x3983('0x14'));var db=require(_0x3983('0x15'))['db'];config[_0x3983('0x16')]=_[_0x3983('0x17')](config[_0x3983('0x16')],{'host':_0x3983('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3983('0x16')]));require(_0x3983('0x19'))[_0x3983('0x1a')](socket);var jayson=require(_0x3983('0x1b'));var client=jayson['client'][_0x3983('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x565532,_0x39323b,_0x3ac206,_0x972c2b){return new BPromise(function(_0x58f43a,_0x3fd35d){var _0x291668=_0x972c2b||client;return _0x291668[_0x3983('0x1d')](_0x565532,_0x3ac206)[_0x3983('0x1e')](function(_0x49073c){logger[_0x3983('0x1f')](_0x3983('0x20'),_0x39323b,_0x3983('0x21'));logger[_0x3983('0x22')](_0x3983('0x23'),_0x39323b,'request\x20sent',JSON['stringify'](_0x49073c));if(_0x49073c[_0x3983('0x24')]){if(_0x49073c[_0x3983('0x24')][_0x3983('0x25')]===0x1f4){logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);return _0x3fd35d(_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);}logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x49073c[_0x3983('0x24')]['message']);return _0x58f43a(_0x49073c[_0x3983('0x24')][_0x3983('0x26')]);}else{logger[_0x3983('0x1f')](_0x3983('0x20'),_0x39323b,_0x3983('0x21'));_0x58f43a(_0x49073c['result'][_0x3983('0x26')]);}})[_0x3983('0x27')](function(_0x59dc55){logger[_0x3983('0x24')](_0x3983('0x20'),_0x39323b,_0x59dc55);_0x3fd35d(_0x59dc55);});});}function respondWithStatusCode(_0xec20bc,_0x5de2ec){_0x5de2ec=_0x5de2ec||0xcc;return function(_0x1853d9){if(_0x1853d9){return _0xec20bc[_0x3983('0x28')](_0x5de2ec);}return _0xec20bc[_0x3983('0x29')](_0x5de2ec)[_0x3983('0x2a')]();};}function respondWithResult(_0x95d2b8,_0x497f11){_0x497f11=_0x497f11||0xc8;return function(_0x872c6b){if(_0x872c6b){return _0x95d2b8[_0x3983('0x29')](_0x497f11)[_0x3983('0x2b')](_0x872c6b);}};}function respondWithFilteredResult(_0x118eb5,_0x5ad7df){return function(_0x5c0486){if(_0x5c0486){var _0x1fc4d2=typeof _0x5ad7df[_0x3983('0x2c')]===_0x3983('0x2d')&&typeof _0x5ad7df[_0x3983('0x2e')]===_0x3983('0x2d');var _0x1fb909=_0x5c0486[_0x3983('0x2f')];var _0x4cd84c=_0x1fc4d2?0x0:_0x5ad7df[_0x3983('0x2c')];var _0x3d63b2=_0x1fc4d2?_0x5c0486[_0x3983('0x2f')]:_0x5ad7df[_0x3983('0x2c')]+_0x5ad7df[_0x3983('0x2e')];var _0x50393c;if(_0x3d63b2>=_0x1fb909){_0x3d63b2=_0x1fb909;_0x50393c=0xc8;}else{_0x50393c=0xce;}_0x118eb5[_0x3983('0x29')](_0x50393c);return _0x118eb5[_0x3983('0x30')](_0x3983('0x31'),_0x4cd84c+'-'+_0x3d63b2+'/'+_0x1fb909)[_0x3983('0x2b')](_0x5c0486);}return null;};}function patchUpdates(_0x1dda49){return function(_0x55a187){try{jsonpatch[_0x3983('0x32')](_0x55a187,_0x1dda49,!![]);}catch(_0x3a23bf){return BPromise[_0x3983('0x33')](_0x3a23bf);}return _0x55a187[_0x3983('0x34')]();};}function saveUpdates(_0x2a2d59,_0x3f1f10){return function(_0x4c32f5){if(_0x4c32f5){return _0x4c32f5[_0x3983('0x35')](_0x2a2d59)[_0x3983('0x1e')](function(_0x1a4644){return _0x1a4644;});}return null;};}function removeEntity(_0x4a4f74,_0x234213){return function(_0x26a033){if(_0x26a033){return _0x26a033[_0x3983('0x36')]()['then'](function(){var _0x14afd0=_0x26a033[_0x3983('0x37')]({'plain':!![]});var _0x3c96a6=_0x3983('0x38');return db[_0x3983('0x39')][_0x3983('0x36')]({'where':{'type':_0x3c96a6,'resourceId':_0x14afd0['id']}})['then'](function(){return _0x26a033;});})[_0x3983('0x1e')](function(){_0x4a4f74[_0x3983('0x29')](0xcc)[_0x3983('0x2a')]();});}};}function handleEntityNotFound(_0x3a1a92,_0x3fe87f){return function(_0xf06b33){if(!_0xf06b33){_0x3a1a92[_0x3983('0x28')](0x194);}return _0xf06b33;};}function handleError(_0x5608a0,_0x303e2d){_0x303e2d=_0x303e2d||0x1f4;return function(_0x59c028){logger[_0x3983('0x24')](_0x59c028[_0x3983('0x3a')]);if(_0x59c028[_0x3983('0x3b')]){delete _0x59c028['name'];}_0x5608a0[_0x3983('0x29')](_0x303e2d)['send'](_0x59c028);};}exports[_0x3983('0x3c')]=function(_0x28a8c7,_0x2c1deb){var _0x206bbc={'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]},_0x360b57={},_0x4f9e3a={'count':0x0,'rows':[]};var _0x5109c3=_[_0x3983('0x3f')](db[_0x3983('0x40')]['rawAttributes'],function(_0x4a21e8){return{'name':_0x4a21e8[_0x3983('0x41')],'type':_0x4a21e8[_0x3983('0x42')]['key']};});_0x360b57['model']=_[_0x3983('0x3f')](_0x5109c3,_0x3983('0x3b'));_0x360b57['query']=_[_0x3983('0x43')](_0x28a8c7['query']);_0x360b57[_0x3983('0x44')]=_['intersection'](_0x360b57[_0x3983('0x45')],_0x360b57['query']);_0x206bbc[_0x3983('0x46')]=_[_0x3983('0x47')](_0x360b57[_0x3983('0x45')],qs['fields'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x49')]));_0x206bbc['attributes']=_0x206bbc['attributes'][_0x3983('0x4a')]?_0x206bbc[_0x3983('0x46')]:_0x360b57[_0x3983('0x45')];if(!_0x28a8c7[_0x3983('0x48')]['hasOwnProperty']('nolimit')){_0x206bbc[_0x3983('0x2e')]=qs['limit'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x2e')]);_0x206bbc['offset']=qs['offset'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x2c')]);}_0x206bbc[_0x3983('0x4b')]=qs['sort'](_0x28a8c7[_0x3983('0x48')][_0x3983('0x4c')]);_0x206bbc['where']=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x28a8c7[_0x3983('0x48')],_0x360b57[_0x3983('0x44')]),_0x5109c3);if(_0x28a8c7[_0x3983('0x48')]['filter']){_0x206bbc[_0x3983('0x4e')]=_['merge'](_0x206bbc['where'],{'$or':_[_0x3983('0x3f')](_0x5109c3,function(_0x58409b){if(_0x58409b['type']!==_0x3983('0x4f')){var _0x3ff823={};_0x3ff823[_0x58409b[_0x3983('0x3b')]]={'$like':'%'+_0x28a8c7[_0x3983('0x48')]['filter']+'%'};return _0x3ff823;}})});}_0x206bbc=_[_0x3983('0x50')]({},_0x206bbc,_0x28a8c7['options']);var _0x306530={'where':_0x206bbc['where']};return db[_0x3983('0x40')][_0x3983('0x2f')](_0x306530)['then'](function(_0x22749a){_0x4f9e3a['count']=_0x22749a;if(_0x28a8c7[_0x3983('0x48')]['includeAll']){_0x206bbc[_0x3983('0x51')]=[{'all':!![]}];}return db[_0x3983('0x40')][_0x3983('0x52')](_0x206bbc);})[_0x3983('0x1e')](function(_0x4cf43d){_0x4f9e3a[_0x3983('0x53')]=_0x4cf43d;return _0x4f9e3a;})['then'](respondWithFilteredResult(_0x2c1deb,_0x206bbc))[_0x3983('0x27')](handleError(_0x2c1deb,null));};exports[_0x3983('0x54')]=function(_0x5431fb,_0x43a187){var _0x5099a3={'raw':![],'where':{'id':_0x5431fb['params']['id']},'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]},_0x5cfda3={};_0x5cfda3[_0x3983('0x45')]=_[_0x3983('0x43')](db['WhatsappAccount'][_0x3983('0x55')]);_0x5cfda3[_0x3983('0x48')]=_[_0x3983('0x43')](_0x5431fb['query']);_0x5cfda3[_0x3983('0x44')]=_[_0x3983('0x47')](_0x5cfda3[_0x3983('0x45')],_0x5cfda3['query']);_0x5099a3[_0x3983('0x46')]=_[_0x3983('0x47')](_0x5cfda3[_0x3983('0x45')],qs[_0x3983('0x49')](_0x5431fb[_0x3983('0x48')][_0x3983('0x49')]));_0x5099a3[_0x3983('0x46')]=_0x5099a3['attributes'][_0x3983('0x4a')]?_0x5099a3['attributes']:_0x5cfda3[_0x3983('0x45')];if(_0x5431fb[_0x3983('0x48')][_0x3983('0x56')]){_0x5099a3[_0x3983('0x51')]=[{'all':!![]}];}_0x5099a3=_[_0x3983('0x50')]({},_0x5099a3,_0x5431fb[_0x3983('0x57')]);return db[_0x3983('0x40')][_0x3983('0x58')](_0x5099a3)[_0x3983('0x1e')](handleEntityNotFound(_0x43a187,null))[_0x3983('0x1e')](respondWithResult(_0x43a187,null))[_0x3983('0x27')](handleError(_0x43a187,null));};exports[_0x3983('0x59')]=function(_0x340c9c,_0x430be9){return db[_0x3983('0x40')]['create'](_0x340c9c[_0x3983('0x5a')],{})[_0x3983('0x1e')](function(_0x44f043){var _0x215093=_0x340c9c[_0x3983('0x5b')]['get']({'plain':!![]});if(!_0x215093)throw new Error(_0x3983('0x5c'));if(_0x215093[_0x3983('0x5d')]===_0x3983('0x5b')){var _0x3aab3e=_0x44f043[_0x3983('0x37')]({'plain':!![]});var _0x10af04='WhatsappAccounts';return db[_0x3983('0x5e')]['find']({'where':{'name':_0x10af04,'userProfileId':_0x215093[_0x3983('0x5f')]},'raw':!![]})[_0x3983('0x1e')](function(_0xbbaac5){if(_0xbbaac5&&_0xbbaac5['autoAssociation']===0x0){return db[_0x3983('0x39')][_0x3983('0x59')]({'name':_0x3aab3e[_0x3983('0x3b')],'resourceId':_0x3aab3e['id'],'type':_0xbbaac5[_0x3983('0x3b')],'sectionId':_0xbbaac5['id']},{})[_0x3983('0x1e')](function(){return _0x44f043;});}else{return _0x44f043;}})['catch'](function(_0x2c60b8){logger[_0x3983('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c60b8);throw _0x2c60b8;});}return _0x44f043;})[_0x3983('0x1e')](respondWithResult(_0x430be9,0xc9))[_0x3983('0x27')](handleError(_0x430be9,null));};exports['update']=function(_0x2fe593,_0x5723ba){if(_0x2fe593['body']['id']){delete _0x2fe593[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x2fe593[_0x3983('0x60')]['id']},'include':[{'model':db[_0x3983('0x3d')],'as':_0x3983('0x3e')}]})['then'](handleEntityNotFound(_0x5723ba,null))['then'](saveUpdates(_0x2fe593[_0x3983('0x5a')],null))[_0x3983('0x1e')](respondWithResult(_0x5723ba,null))[_0x3983('0x27')](handleError(_0x5723ba,null));};exports['destroy']=function(_0x3efcb2,_0x4a7aec){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x3efcb2[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x4a7aec,null))[_0x3983('0x1e')](removeEntity(_0x4a7aec,null))[_0x3983('0x27')](handleError(_0x4a7aec,null));};exports[_0x3983('0x61')]=function(_0x115f1e,_0x21cb4b){return db[_0x3983('0x40')]['describe']()[_0x3983('0x1e')](respondWithResult(_0x21cb4b,null))[_0x3983('0x27')](handleError(_0x21cb4b,null));};exports[_0x3983('0x62')]=function(_0x1c898c,_0x4d04be,_0x3f26c3){if(_0x1c898c['body']['id']){delete _0x1c898c[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x1c898c['params']['id']}})['then'](handleEntityNotFound(_0x4d04be,null))['then'](function(_0x1af676){if(_0x1af676){_0x1c898c[_0x3983('0x5a')][_0x3983('0x63')]=_0x1af676['id'];return db[_0x3983('0x64')][_0x3983('0x59')](_0x1c898c[_0x3983('0x5a')]);}})[_0x3983('0x1e')](respondWithResult(_0x4d04be,null))[_0x3983('0x27')](handleError(_0x4d04be,null));};exports[_0x3983('0x65')]=function(_0x18f0bb,_0x5ea996,_0x27ba9f){var _0x5ad195={'raw':![],'where':{}};var _0x22145b={};var _0x130605={'count':0x0,'rows':[]};return db[_0x3983('0x40')]['findOne']({'where':{'id':_0x18f0bb[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x5ea996,null))['then'](function(_0x3d2cdc){if(_0x3d2cdc){_0x22145b[_0x3983('0x45')]=_[_0x3983('0x43')](db[_0x3983('0x64')][_0x3983('0x55')]);_0x22145b['query']=_[_0x3983('0x43')](_0x18f0bb[_0x3983('0x48')]);_0x22145b[_0x3983('0x44')]=_[_0x3983('0x47')](_0x22145b['model'],_0x22145b[_0x3983('0x48')]);_0x5ad195['attributes']=_[_0x3983('0x47')](_0x22145b['model'],qs[_0x3983('0x49')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x49')]));_0x5ad195['attributes']=_0x5ad195[_0x3983('0x46')][_0x3983('0x4a')]?_0x5ad195['attributes']:_0x22145b['model'];if(!_0x18f0bb['query'][_0x3983('0x66')](_0x3983('0x67'))){_0x5ad195['limit']=qs[_0x3983('0x2e')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x2e')]);_0x5ad195['offset']=qs[_0x3983('0x2c')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x2c')]);}_0x5ad195[_0x3983('0x4b')]=qs[_0x3983('0x4c')](_0x18f0bb[_0x3983('0x48')][_0x3983('0x4c')]);_0x5ad195['where']=qs[_0x3983('0x44')](_['pick'](_0x18f0bb['query'],_0x22145b['filters']));_0x5ad195[_0x3983('0x4e')][_0x3983('0x63')]=_0x3d2cdc['id'];if(_0x18f0bb[_0x3983('0x48')]['filter']){_0x5ad195[_0x3983('0x4e')]=_[_0x3983('0x50')](_0x5ad195[_0x3983('0x4e')],{'$or':_[_0x3983('0x3f')](_0x5ad195[_0x3983('0x46')],function(_0x595d53){var _0x3cd765={};_0x3cd765[_0x595d53]={'$like':'%'+_0x18f0bb[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x3cd765;})});}_0x5ad195=_[_0x3983('0x50')]({},_0x5ad195,_0x18f0bb['options']);return db[_0x3983('0x64')]['count']({'where':_0x5ad195['where']})[_0x3983('0x1e')](function(_0x53038a){_0x130605[_0x3983('0x2f')]=_0x53038a;if(_0x18f0bb['query']['includeAll']){_0x5ad195['include']=[{'all':!![]}];}return db[_0x3983('0x64')][_0x3983('0x52')](_0x5ad195);})[_0x3983('0x1e')](function(_0x22e952){_0x130605['rows']=_0x22e952;return _0x130605;});}})[_0x3983('0x1e')](respondWithFilteredResult(_0x5ea996,_0x5ad195))['catch'](handleError(_0x5ea996,null));};exports['removeDispositions']=function(_0x4b5800,_0x36d981,_0x5a354d){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x4b5800['params']['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x36d981,null))[_0x3983('0x1e')](function(_0x48b95f){if(_0x48b95f){return _0x48b95f[_0x3983('0x69')](_0x4b5800['query'][_0x3983('0x6a')]);}})[_0x3983('0x1e')](respondWithStatusCode(_0x36d981,null))[_0x3983('0x27')](handleError(_0x36d981,null));};exports['addAnswer']=function(_0x32a2c1,_0x564550,_0x4a2501){if(_0x32a2c1['body']['id']){delete _0x32a2c1[_0x3983('0x5a')]['id'];}return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x32a2c1[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x564550,null))[_0x3983('0x1e')](function(_0x194a59){if(_0x194a59){_0x32a2c1['body'][_0x3983('0x63')]=_0x194a59['id'];return db[_0x3983('0x6b')][_0x3983('0x59')](_0x32a2c1[_0x3983('0x5a')]);}})['then'](respondWithResult(_0x564550,null))['catch'](handleError(_0x564550,null));};exports[_0x3983('0x6c')]=function(_0x19e196,_0x54af8c,_0x2579dc){var _0x9c9664={'raw':![],'where':{}};var _0x109598={};var _0x483a81={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x19e196[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x54af8c,null))[_0x3983('0x1e')](function(_0x414d7b){if(_0x414d7b){_0x109598[_0x3983('0x45')]=_[_0x3983('0x43')](db[_0x3983('0x6b')][_0x3983('0x55')]);_0x109598[_0x3983('0x48')]=_[_0x3983('0x43')](_0x19e196[_0x3983('0x48')]);_0x109598['filters']=_[_0x3983('0x47')](_0x109598[_0x3983('0x45')],_0x109598[_0x3983('0x48')]);_0x9c9664[_0x3983('0x46')]=_[_0x3983('0x47')](_0x109598['model'],qs[_0x3983('0x49')](_0x19e196[_0x3983('0x48')][_0x3983('0x49')]));_0x9c9664['attributes']=_0x9c9664['attributes'][_0x3983('0x4a')]?_0x9c9664['attributes']:_0x109598[_0x3983('0x45')];if(!_0x19e196['query']['hasOwnProperty'](_0x3983('0x67'))){_0x9c9664['limit']=qs[_0x3983('0x2e')](_0x19e196[_0x3983('0x48')][_0x3983('0x2e')]);_0x9c9664[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x19e196[_0x3983('0x48')]['offset']);}_0x9c9664[_0x3983('0x4b')]=qs['sort'](_0x19e196['query'][_0x3983('0x4c')]);_0x9c9664['where']=qs['filters'](_[_0x3983('0x4d')](_0x19e196[_0x3983('0x48')],_0x109598['filters']));_0x9c9664[_0x3983('0x4e')][_0x3983('0x63')]=_0x414d7b['id'];if(_0x19e196['query'][_0x3983('0x68')]){_0x9c9664['where']=_['merge'](_0x9c9664[_0x3983('0x4e')],{'$or':_[_0x3983('0x3f')](_0x9c9664[_0x3983('0x46')],function(_0x53b4a1){var _0x987555={};_0x987555[_0x53b4a1]={'$like':'%'+_0x19e196[_0x3983('0x48')]['filter']+'%'};return _0x987555;})});}_0x9c9664=_[_0x3983('0x50')]({},_0x9c9664,_0x19e196[_0x3983('0x57')]);return db['CannedAnswer'][_0x3983('0x2f')]({'where':_0x9c9664['where']})['then'](function(_0x3fd7b7){_0x483a81[_0x3983('0x2f')]=_0x3fd7b7;if(_0x19e196[_0x3983('0x48')][_0x3983('0x56')]){_0x9c9664['include']=[{'all':!![]}];}return db[_0x3983('0x6b')]['findAll'](_0x9c9664);})['then'](function(_0x4fc640){_0x483a81[_0x3983('0x53')]=_0x4fc640;return _0x483a81;});}})[_0x3983('0x1e')](respondWithFilteredResult(_0x54af8c,_0x9c9664))[_0x3983('0x27')](handleError(_0x54af8c,null));};exports[_0x3983('0x6e')]=function(_0x1834eb,_0x1f5af2,_0x298f4e){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x1834eb[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x1f5af2,null))['then'](function(_0x83926b){if(_0x83926b){return _0x83926b[_0x3983('0x6e')](_0x1834eb[_0x3983('0x48')]['ids']);}})[_0x3983('0x1e')](respondWithStatusCode(_0x1f5af2,null))[_0x3983('0x27')](handleError(_0x1f5af2,null));};exports[_0x3983('0x6f')]=function(_0x231f6f,_0x35c0dd,_0x389043){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x231f6f[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x35c0dd,null))[_0x3983('0x1e')](function(_0x5aa51f){if(_0x5aa51f){return _0x5aa51f[_0x3983('0x6f')](_0x231f6f[_0x3983('0x5a')]['ids'],_[_0x3983('0x70')](_0x231f6f['body'],[_0x3983('0x6a'),'id'])||{})[_0x3983('0x71')](function(_0x108f2f){for(var _0x21bf84=0x0;_0x21bf84<_0x231f6f[_0x3983('0x5a')][_0x3983('0x6a')][_0x3983('0x4a')];_0x21bf84+=0x1){socket[_0x3983('0x72')](_0x3983('0x73'),{'UserId':Number(_0x231f6f[_0x3983('0x5a')][_0x3983('0x6a')][_0x21bf84]),'WhatsappAccountId':Number(_0x231f6f[_0x3983('0x60')]['id'])});}return _0x108f2f;});}})[_0x3983('0x1e')](respondWithResult(_0x35c0dd,null))[_0x3983('0x27')](handleError(_0x35c0dd,null));};exports[_0x3983('0x74')]=function(_0x16325a,_0x531807,_0x51e4a8){return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x16325a[_0x3983('0x60')]['id']}})[_0x3983('0x1e')](handleEntityNotFound(_0x531807,null))[_0x3983('0x1e')](function(_0x319fb2){if(_0x319fb2){return _0x319fb2[_0x3983('0x74')](_0x16325a[_0x3983('0x48')][_0x3983('0x6a')])['then'](function(){if(_[_0x3983('0x75')](_0x16325a[_0x3983('0x48')][_0x3983('0x6a')])){for(var _0x195e71=0x0;_0x195e71<_0x16325a['query'][_0x3983('0x6a')][_0x3983('0x4a')];_0x195e71+=0x1){socket[_0x3983('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x16325a[_0x3983('0x48')][_0x3983('0x6a')][_0x195e71]),'WhatsappAccountId':Number(_0x16325a[_0x3983('0x60')]['id'])});}}else{socket[_0x3983('0x72')](_0x3983('0x76'),{'UserId':Number(_0x16325a[_0x3983('0x48')][_0x3983('0x6a')]),'WhatsappAccountId':Number(_0x16325a['params']['id'])});}});}})[_0x3983('0x1e')](respondWithStatusCode(_0x531807,null))[_0x3983('0x27')](handleError(_0x531807,null));};exports['getAgents']=function(_0x5ee57a,_0x1df593,_0x43c1b6){var _0x3199ad={};var _0x10bb22={};var _0x2958ad;var _0x2e32fb;return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x5ee57a[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x1df593,null))['then'](function(_0x597841){if(_0x597841){_0x2958ad=_0x597841;_0x10bb22['model']=_[_0x3983('0x43')](db['User'][_0x3983('0x55')]);_0x10bb22[_0x3983('0x48')]=_[_0x3983('0x43')](_0x5ee57a[_0x3983('0x48')]);_0x10bb22[_0x3983('0x44')]=_['intersection'](_0x10bb22[_0x3983('0x45')],_0x10bb22[_0x3983('0x48')]);_0x3199ad[_0x3983('0x46')]=_[_0x3983('0x47')](_0x10bb22[_0x3983('0x45')],qs[_0x3983('0x49')](_0x5ee57a['query']['fields']));_0x3199ad[_0x3983('0x46')]=_0x3199ad['attributes']['length']?_0x3199ad[_0x3983('0x46')]:_0x10bb22[_0x3983('0x45')];_0x3199ad[_0x3983('0x4b')]=qs[_0x3983('0x4c')](_0x5ee57a[_0x3983('0x48')][_0x3983('0x4c')]);_0x3199ad[_0x3983('0x4e')]=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x5ee57a['query'],_0x10bb22['filters']));if(_0x5ee57a[_0x3983('0x48')][_0x3983('0x68')]){_0x3199ad['where']=_[_0x3983('0x50')](_0x3199ad['where'],{'$or':_[_0x3983('0x3f')](_0x3199ad[_0x3983('0x46')],function(_0x33418a){var _0x1964b9={};_0x1964b9[_0x33418a]={'$like':'%'+_0x5ee57a[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x1964b9;})});}_0x3199ad=_[_0x3983('0x50')]({},_0x3199ad,_0x5ee57a['options']);return _0x2958ad[_0x3983('0x77')](_0x3199ad);}})['then'](function(_0xa5dd8d){if(_0xa5dd8d){_0x2e32fb=_0xa5dd8d['length'];if(!_0x5ee57a[_0x3983('0x48')][_0x3983('0x66')](_0x3983('0x67'))){_0x3199ad[_0x3983('0x2e')]=qs[_0x3983('0x2e')](_0x5ee57a[_0x3983('0x48')][_0x3983('0x2e')]);_0x3199ad[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x5ee57a[_0x3983('0x48')]['offset']);}return _0x2958ad[_0x3983('0x77')](_0x3199ad);}})[_0x3983('0x1e')](function(_0x59bdc6){if(_0x59bdc6){return _0x59bdc6?{'count':_0x2e32fb,'rows':_0x59bdc6}:null;}})[_0x3983('0x1e')](respondWithResult(_0x1df593,null))[_0x3983('0x27')](handleError(_0x1df593,null));};exports['addApplications']=function(_0x33c3d0,_0x48e553){var _0x65afe2=_0x33c3d0['params']['id'];var _0x241846=_0x33c3d0[_0x3983('0x5a')];var _0x494ffa=0xc8;var _0x4f758e=null;return db[_0x3983('0x78')][_0x3983('0x79')]({'isolationLevel':db[_0x3983('0x78')][_0x3983('0x7a')][_0x3983('0x7b')][_0x3983('0x7c')]},function(_0x31985b){return db['WhatsappAccount'][_0x3983('0x6d')]({'where':{'id':_0x65afe2},'transaction':_0x31985b})['then'](function(_0x599fdb){if(_0x599fdb){return db[_0x3983('0x7d')][_0x3983('0x36')]({'where':{'WhatsappAccountId':_0x65afe2},'transaction':_0x31985b})[_0x3983('0x1e')](function(){var _0x29ee10=_[_0x3983('0x3f')](_0x241846,function(_0x50caf1){_0x50caf1[_0x3983('0x63')]=_0x65afe2;return _0x50caf1;});return db[_0x3983('0x7d')][_0x3983('0x7e')](_0x29ee10,{'transaction':_0x31985b});});}else{_0x494ffa=0x194;_0x4f758e=[];}});})[_0x3983('0x1e')](function(){if(_0x494ffa!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x65afe2},'order':'priority'})[_0x3983('0x1e')](function(_0x3a694a){_0x4f758e=_0x3a694a;});}})[_0x3983('0x27')](function(_0x4ce261){_0x494ffa=0x1f4;logger['error'](_0x4ce261[_0x3983('0x3a')]);if(_0x4ce261[_0x3983('0x3b')]){delete _0x4ce261[_0x3983('0x3b')];}_0x4f758e=_0x4ce261;})[_0x3983('0x7f')](function(){if(_0x4f758e===null){_0x48e553[_0x3983('0x28')](_0x494ffa);}else{if(_0x494ffa===0x1f4){_0x48e553[_0x3983('0x29')](_0x494ffa)[_0x3983('0x80')](_0x4f758e);}else{_0x48e553[_0x3983('0x29')](_0x494ffa)[_0x3983('0x2b')](_0x4f758e);}}});};exports[_0x3983('0x81')]=function(_0x48f0d4,_0x2888e2,_0xbd99aa){var _0x152f29={};var _0x4a0e52={};var _0x7727f0;var _0x4eb3a4;return db['WhatsappAccount']['findOne']({'where':{'id':_0x48f0d4[_0x3983('0x60')]['id']}})['then'](handleEntityNotFound(_0x2888e2,null))[_0x3983('0x1e')](function(_0x51c572){if(_0x51c572){_0x7727f0=_0x51c572;_0x4a0e52[_0x3983('0x45')]=_['keys'](db[_0x3983('0x7d')][_0x3983('0x55')]);_0x4a0e52[_0x3983('0x48')]=_[_0x3983('0x43')](_0x48f0d4[_0x3983('0x48')]);_0x4a0e52[_0x3983('0x44')]=_[_0x3983('0x47')](_0x4a0e52[_0x3983('0x45')],_0x4a0e52[_0x3983('0x48')]);_0x152f29[_0x3983('0x46')]=_[_0x3983('0x47')](_0x4a0e52['model'],qs[_0x3983('0x49')](_0x48f0d4[_0x3983('0x48')][_0x3983('0x49')]));_0x152f29['attributes']=_0x152f29[_0x3983('0x46')][_0x3983('0x4a')]?_0x152f29[_0x3983('0x46')]:_0x4a0e52[_0x3983('0x45')];_0x152f29[_0x3983('0x4b')]=qs['sort'](_0x48f0d4[_0x3983('0x48')][_0x3983('0x4c')]);_0x152f29[_0x3983('0x4e')]=qs[_0x3983('0x44')](_[_0x3983('0x4d')](_0x48f0d4[_0x3983('0x48')],_0x4a0e52[_0x3983('0x44')]));if(_0x48f0d4[_0x3983('0x48')][_0x3983('0x68')]){_0x152f29[_0x3983('0x4e')]=_[_0x3983('0x50')](_0x152f29['where'],{'$or':_[_0x3983('0x3f')](_0x152f29[_0x3983('0x46')],function(_0x4f0363){var _0x38e748={};_0x38e748[_0x4f0363]={'$like':'%'+_0x48f0d4[_0x3983('0x48')][_0x3983('0x68')]+'%'};return _0x38e748;})});}_0x152f29=_[_0x3983('0x50')]({},_0x152f29,_0x48f0d4[_0x3983('0x57')]);return _0x7727f0[_0x3983('0x81')](_0x152f29);}})[_0x3983('0x1e')](function(_0x50cfe8){if(_0x50cfe8){_0x4eb3a4=_0x50cfe8[_0x3983('0x4a')];if(!_0x48f0d4['query']['hasOwnProperty'](_0x3983('0x67'))){_0x152f29[_0x3983('0x2e')]=qs['limit'](_0x48f0d4[_0x3983('0x48')][_0x3983('0x2e')]);_0x152f29[_0x3983('0x2c')]=qs[_0x3983('0x2c')](_0x48f0d4[_0x3983('0x48')]['offset']);}return _0x7727f0[_0x3983('0x81')](_0x152f29);}})['then'](function(_0xdecede){if(_0xdecede){return _0xdecede?{'count':_0x4eb3a4,'rows':_0xdecede}:null;}})[_0x3983('0x1e')](respondWithResult(_0x2888e2,null))['catch'](handleError(_0x2888e2,null));};exports['notify']=function(_0x8433b6,_0x169570,_0x2e7ecd){var _0x29d5aa={'channel':_0x3983('0x82')};var _0x4f1d09=[];var _0x13a2f3=[];var _0x5865d6={};return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x8433b6[_0x3983('0x60')]['id']},'include':[{'model':db[_0x3983('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x3c6db0){_0x29d5aa['account']=_0x3c6db0;if(_0x29d5aa['account']&&_0x29d5aa['account'][_0x3983('0x42')]===_0x3983('0x83')&&_0x8433b6['body'][_0x3983('0x84')]){if(_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][_0x3983('0x4a')]===0x0)return;if(_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x85')]!=='read')return;return db[_0x3983('0x86')]['update']({'read':!![],'readAt':_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x87')]},{'where':{'messageId':_0x8433b6[_0x3983('0x5a')][_0x3983('0x84')][0x0][_0x3983('0x88')]},'individualHooks':!![]})[_0x3983('0x1e')](function(_0xbca2db){return _0x169570[_0x3983('0x29')](0xc8)[_0x3983('0x2b')](_0xbca2db);});}_0x29d5aa[_0x3983('0x89')]=_['orderBy'](_0x3c6db0[_0x3983('0x8a')],[_0x3983('0x8b')],[_0x3983('0x8c')]);if(_0x29d5aa[_0x3983('0x8d')][_0x3983('0x8a')]){delete _0x29d5aa['account'][_0x3983('0x8a')];}return db[_0x3983('0x8e')][_0x3983('0x61')]()[_0x3983('0x1e')](function(_0x335e82){if(!_0x335e82){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))]('no\x20available\x20attributes');}_0x4f1d09=_['difference'](_['keys'](_0x335e82),[_0x3983('0x91'),_0x3983('0x92')]);_0x13a2f3=_['difference'](_['keys'](_0x335e82),['createdAt',_0x3983('0x92'),_0x3983('0x93'),_0x3983('0x94')]);_0x29d5aa['body']={'mapKey':_0x3983('0x95')};if(_0x29d5aa[_0x3983('0x8d')]&&_0x29d5aa[_0x3983('0x8d')][_0x3983('0x42')]===_0x3983('0x96')){_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')]=_0x8433b6[_0x3983('0x5a')]['From']['replace'](_0x3983('0x98'),'');_0x29d5aa[_0x3983('0x5a')]['body']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x99')];_0x29d5aa[_0x3983('0x5a')]['messageId']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x9a')];}if(_0x29d5aa[_0x3983('0x8d')]&&_0x29d5aa['account'][_0x3983('0x42')]==='sinch'){_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')]=_0x8433b6[_0x3983('0x5a')]['notifications'][0x0][_0x3983('0x97')];_0x29d5aa['body']['body']=_0x8433b6[_0x3983('0x5a')][_0x3983('0x9b')][0x0]['message'][_0x3983('0x5a')];_0x29d5aa[_0x3983('0x5a')][_0x3983('0x9c')]=_0x8433b6['body']['notifications'][0x0][_0x3983('0x88')];}if(_0x29d5aa['body']['id']){delete _0x29d5aa[_0x3983('0x5a')]['id'];}if(_['isNil'](_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')])){throw new db[(_0x3983('0x8f'))]['ValidationError'](_0x3983('0x9d'));}if(_[_0x3983('0x9e')](_0x29d5aa[_0x3983('0x5a')][_0x3983('0x5a')])||_0x29d5aa[_0x3983('0x5a')]['body']===''){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))](_0x3983('0x9f'));}if(_[_0x3983('0x9e')](_0x29d5aa['body']['mapKey'])){throw new db['Sequelize'][(_0x3983('0x90'))](_0x3983('0xa0')+_0x13a2f3);}if(!_['includes'](_0x13a2f3,_0x29d5aa['body'][_0x3983('0xa1')])){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13a2f3);}_0x5865d6[_0x29d5aa['body'][_0x3983('0xa1')]]=_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')];return db['CmList'][_0x3983('0x58')]({'where':{'id':_0x29d5aa['account'][_0x3983('0x94')]},'include':[{'model':db[_0x3983('0x8e')],'as':_0x3983('0xa2'),'where':_0x5865d6,'limit':0x1,'order':[[_0x3983('0x92'),_0x3983('0xa3')]]}]});})[_0x3983('0x1e')](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x2c83d6){if(_0x2c83d6){_0x29d5aa['list']=_['omit'](_0x2c83d6,['Contacts']);if(_0x2c83d6[_0x3983('0xa2')][_0x3983('0x4a')]){return _0x2c83d6[_0x3983('0xa2')][0x0];}var _0x450973=_[_0x3983('0x17')](_0x29d5aa[_0x3983('0x5a')],{'firstName':_0x29d5aa[_0x3983('0x5a')]['from'],'ListId':_0x2c83d6['id']});_0x450973[_0x29d5aa['body'][_0x3983('0xa1')]]=_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')];return db[_0x3983('0x8e')][_0x3983('0x59')](_0x450973,{'fields':_0x4f1d09,'raw':!![]});}})[_0x3983('0x1e')](handleEntityNotFound(_0x169570,null))[_0x3983('0x1e')](function(_0x500ebb){if(_0x500ebb){_0x29d5aa[_0x3983('0xa4')]=_0x500ebb;var _0x3660f7={'ContactId':_0x500ebb['id'],'phone':_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id']};var _0x30394={'ContactId':_0x500ebb['id'],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id'],'closed':![]};return db[_0x3983('0xa5')][_0x3983('0x58')]({'where':_0x30394})[_0x3983('0x1e')](function(_0x31a196){if(_0x31a196){return[_0x31a196,![]];}return db[_0x3983('0xa5')][_0x3983('0x59')](_0x3660f7)[_0x3983('0x1e')](function(_0xf9a7c7){return[_0xf9a7c7,!![]];});});}})[_0x3983('0x71')](function(_0x5c0290,_0x46a318){_0x29d5aa[_0x3983('0xa6')]=_0x5c0290['get']({'plain':!![]});_0x29d5aa[_0x3983('0xa6')][_0x3983('0xa7')]=![];if(_0x46a318){if(_0x29d5aa['account'][_0x3983('0xa8')]){_0x29d5aa[_0x3983('0x89')][_0x3983('0xa9')]({'id':0x0,'priority':_0x29d5aa['applications']['length']+0x1,'app':_0x3983('0xaa'),'appdata':_0x3983('0xab'),'interval':_0x3983('0xac')});}_0x29d5aa[_0x3983('0xa6')][_0x3983('0xa7')]=!![];}return db[_0x3983('0x86')][_0x3983('0x59')]({'phone':_0x29d5aa[_0x3983('0x5a')][_0x3983('0x97')],'messageId':_0x29d5aa[_0x3983('0x5a')]['messageId'],'body':_0x29d5aa['body'][_0x3983('0x5a')],'WhatsappAccountId':_0x8433b6[_0x3983('0x60')]['id'],'WhatsappInteractionId':_0x5c0290['id'],'direction':'in','ContactId':_0x5c0290[_0x3983('0xad')],'AttachmentId':_0x29d5aa['body'][_0x3983('0xae')]});})[_0x3983('0x1e')](function(_0x5fbab6){_0x29d5aa[_0x3983('0x26')]=_0x5fbab6;if(_0x29d5aa[_0x3983('0xa6')][_0x3983('0xaf')]){return db[_0x3983('0xb0')][_0x3983('0x58')]({'attributes':['id',_0x3983('0x3b')],'where':{'id':_0x29d5aa[_0x3983('0xa6')][_0x3983('0xaf')]}})[_0x3983('0x1e')](function(_0x1aacf5){if(_0x1aacf5){_0x29d5aa['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3983('0xb1'),'appdata':_0x1aacf5[_0x3983('0x3b')]+','+(_0x29d5aa['account'][_0x3983('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3983('0xb3'),'startRouting',_0x29d5aa);});}return respondWithRpcPromise(_0x3983('0xb3'),_0x3983('0xb4'),_0x29d5aa);})[_0x3983('0x1e')](function(_0x25a60c){if(_0x25a60c){var _0x4ef97a=0xc8;var _0xe62ce=_0x3983('0xb5');logger[_0x3983('0x1f')](_0x3983('0x23'),_0xe62ce,_0x4ef97a,'entity\x20found');logger['debug'](_0x3983('0xb6'),_0xe62ce,_0x4ef97a,'entity\x20found',JSON[_0x3983('0xb7')](_0x25a60c));if(_0x29d5aa['account'][_0x3983('0x42')]===_0x3983('0x96')){return _0x169570[_0x3983('0x29')](_0x4ef97a)['set'](_0x3983('0xb8'),_0x3983('0xb9'))[_0x3983('0x80')](_0x3983('0xba'));}else{return _0x169570[_0x3983('0x29')](_0x4ef97a)['json'](_0x25a60c);}}});})['catch'](handleError(_0x169570,null));};exports['send']=function(_0x55b017,_0x428c01,_0x77e802){var _0x1a97d7,_0x54326c,_0x22b751;if(_[_0x3983('0x9e')](_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')])||_0x55b017[_0x3983('0x5a')]['body']===''){throw new db[(_0x3983('0x8f'))][(_0x3983('0x90'))](_0x3983('0x9f'));}if(_['isNil'](_0x55b017[_0x3983('0x5a')]['to'])){throw new db[(_0x3983('0x8f'))]['ValidationError'](_0x3983('0xbb'));}_0x1a97d7=_0x55b017['body']['to'];return db[_0x3983('0x40')][_0x3983('0x58')]({'where':{'id':_0x55b017[_0x3983('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x3983('0xbc'),'include':[{'model':db[_0x3983('0x8e')],'as':_0x3983('0xa2'),'where':{'mobile':_0x1a97d7},'limit':0x1,'order':[['updatedAt',_0x3983('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x428c01,null))['then'](function(_0x3fe84b){if(_0x3fe84b&&_0x3fe84b[_0x3983('0xbc')]){_0x54326c=_0x3fe84b[_0x3983('0x37')]({'plain':!![]});if(_0x54326c['List']&&_0x54326c['List']['Contacts'][_0x3983('0x4a')]){return _0x54326c[_0x3983('0xbc')][_0x3983('0xa2')][0x0];}return db[_0x3983('0x8e')][_0x3983('0x59')](_[_0x3983('0x17')](_0x55b017['body'],{'firstName':_0x1a97d7,'mobile':_0x1a97d7,'phone':_0x1a97d7,'ListId':_0x54326c[_0x3983('0x94')]}));}})[_0x3983('0x1e')](handleEntityNotFound(_0x428c01,null))[_0x3983('0x1e')](function(_0x54ec6b){if(_0x54ec6b){_0x22b751=_0x54ec6b;return db['WhatsappInteraction'][_0x3983('0x58')]({'where':{'ContactId':_0x22b751['id'],'closed':![],'WhatsappAccountId':_0x54326c['id']}})[_0x3983('0x1e')](function(_0x59a8da){if(_0x59a8da){return[_0x59a8da,![]];}return db[_0x3983('0xa5')][_0x3983('0x59')]({'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id'],'WhatsappAccountId':_0x54326c['id'],'phone':_0x1a97d7,'firstMsgDirection':'out','Messages':[_[_0x3983('0x50')](_0x55b017[_0x3983('0x5a')],{'read':![],'body':_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')],'phone':_0x1a97d7,'WhatsappAccountId':_0x54326c['id'],'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x3983('0xbd')}]})['then'](function(_0x420ae3){return[_0x420ae3,!![]];});});}})[_0x3983('0x71')](function(_0x1175b9,_0x86d95){if(_0x86d95){return _0x1175b9;}return db[_0x3983('0x86')][_0x3983('0x59')](_['merge'](_0x55b017[_0x3983('0x5a')],{'read':![],'body':_0x55b017[_0x3983('0x5a')][_0x3983('0x5a')],'phone':_0x1a97d7,'WhatsappAccountId':_0x54326c['id'],'WhatsappInteractionId':_0x1175b9['id'],'UserId':_0x55b017[_0x3983('0x5b')]['id'],'ContactId':_0x22b751['id']}))['then'](function(_0x4d0d85){_0x1175b9[_0x3983('0xbe')]['Messages']=[];_0x1175b9['dataValues'][_0x3983('0xbd')][_0x3983('0xa9')](_0x4d0d85['dataValues']);return _0x1175b9;});})[_0x3983('0x1e')](respondWithResult(_0x428c01,null))[_0x3983('0x27')](handleError(_0x428c01,null));}; \ No newline at end of file +var _0x4dc6=['WhatsappAccount','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','Pause','rawAttributes','include','options','find','create','body','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','priority','ValidationError','difference','createdAt','updatedAt','ListId','twilio','from','whatsapp:','Body','messageId','notifications','message_id','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','debug','entity\x20found','Content-Type','\x0a','List','out','Messages','dataValues','push','eml-format','rimraf','moment','mustache','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','map'];(function(_0x41a53a,_0x217e3d){var _0x441e17=function(_0x255679){while(--_0x255679){_0x41a53a['push'](_0x41a53a['shift']());}};_0x441e17(++_0x217e3d);}(_0x4dc6,0x7d));var _0x64dc=function(_0x27b629,_0x1a870f){_0x27b629=_0x27b629-0x0;var _0x4b6e11=_0x4dc6[_0x27b629];return _0x4b6e11;};'use strict';var emlformat=require(_0x64dc('0x0'));var rimraf=require(_0x64dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64dc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x64dc('0x3'));var util=require(_0x64dc('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x64dc('0x5'));var ejs=require(_0x64dc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x64dc('0x7'));var jsforce=require(_0x64dc('0x8'));var deskjs=require(_0x64dc('0x9'));var toCsv=require(_0x64dc('0x5'));var querystring=require(_0x64dc('0xa'));var Papa=require(_0x64dc('0xb'));var Redis=require(_0x64dc('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x64dc('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64dc('0xe'))('api');var utils=require(_0x64dc('0xf'));var config=require(_0x64dc('0x10'));var licenseUtil=require(_0x64dc('0x11'));var db=require(_0x64dc('0x12'))['db'];config[_0x64dc('0x13')]=_[_0x64dc('0x14')](config[_0x64dc('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x64dc('0x15'))(new Redis(config['redis']));require(_0x64dc('0x16'))[_0x64dc('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x563247,_0x31d604,_0x3c0d73,_0x14d361){return new BPromise(function(_0x27e3c0,_0x41742b){var _0x7de507=_0x14d361||client;return _0x7de507[_0x64dc('0x18')](_0x563247,_0x3c0d73)[_0x64dc('0x19')](function(_0x282e0c){logger[_0x64dc('0x1a')](_0x64dc('0x1b'),_0x31d604,_0x64dc('0x1c'));logger['debug'](_0x64dc('0x1d'),_0x31d604,_0x64dc('0x1c'),JSON[_0x64dc('0x1e')](_0x282e0c));if(_0x282e0c['error']){if(_0x282e0c[_0x64dc('0x1f')][_0x64dc('0x20')]===0x1f4){logger[_0x64dc('0x1f')](_0x64dc('0x1b'),_0x31d604,_0x282e0c['error'][_0x64dc('0x21')]);return _0x41742b(_0x282e0c['error']['message']);}logger[_0x64dc('0x1f')](_0x64dc('0x1b'),_0x31d604,_0x282e0c[_0x64dc('0x1f')]['message']);return _0x27e3c0(_0x282e0c[_0x64dc('0x1f')][_0x64dc('0x21')]);}else{logger[_0x64dc('0x1a')](_0x64dc('0x1b'),_0x31d604,_0x64dc('0x1c'));_0x27e3c0(_0x282e0c[_0x64dc('0x22')][_0x64dc('0x21')]);}})[_0x64dc('0x23')](function(_0x5816ff){logger[_0x64dc('0x1f')](_0x64dc('0x1b'),_0x31d604,_0x5816ff);_0x41742b(_0x5816ff);});});}function respondWithStatusCode(_0x4c51ef,_0x2daffc){_0x2daffc=_0x2daffc||0xcc;return function(_0x3b96b2){if(_0x3b96b2){return _0x4c51ef[_0x64dc('0x24')](_0x2daffc);}return _0x4c51ef[_0x64dc('0x25')](_0x2daffc)[_0x64dc('0x26')]();};}function respondWithResult(_0x176bb2,_0x236e14){_0x236e14=_0x236e14||0xc8;return function(_0x3ee1f6){if(_0x3ee1f6){return _0x176bb2[_0x64dc('0x25')](_0x236e14)[_0x64dc('0x27')](_0x3ee1f6);}};}function respondWithFilteredResult(_0x405e75,_0x175f51){return function(_0x2325cc){if(_0x2325cc){var _0x244db4=typeof _0x175f51[_0x64dc('0x28')]===_0x64dc('0x29')&&typeof _0x175f51[_0x64dc('0x2a')]===_0x64dc('0x29');var _0x40e12a=_0x2325cc[_0x64dc('0x2b')];var _0x2a30a1=_0x244db4?0x0:_0x175f51[_0x64dc('0x28')];var _0x3a77ff=_0x244db4?_0x2325cc['count']:_0x175f51['offset']+_0x175f51[_0x64dc('0x2a')];var _0x54ce0b;if(_0x3a77ff>=_0x40e12a){_0x3a77ff=_0x40e12a;_0x54ce0b=0xc8;}else{_0x54ce0b=0xce;}_0x405e75[_0x64dc('0x25')](_0x54ce0b);return _0x405e75[_0x64dc('0x2c')](_0x64dc('0x2d'),_0x2a30a1+'-'+_0x3a77ff+'/'+_0x40e12a)['json'](_0x2325cc);}return null;};}function patchUpdates(_0x7a1794){return function(_0x2c3ae8){try{jsonpatch[_0x64dc('0x2e')](_0x2c3ae8,_0x7a1794,!![]);}catch(_0xce4aa2){return BPromise[_0x64dc('0x2f')](_0xce4aa2);}return _0x2c3ae8['save']();};}function saveUpdates(_0x58889d,_0x55bf22){return function(_0x130b54){if(_0x130b54){return _0x130b54[_0x64dc('0x30')](_0x58889d)['then'](function(_0x58674b){return _0x58674b;});}return null;};}function removeEntity(_0x103f9c,_0x245832){return function(_0x5b62d5){if(_0x5b62d5){return _0x5b62d5['destroy']()['then'](function(){var _0xdaaafc=_0x5b62d5['get']({'plain':!![]});var _0x2ae2be=_0x64dc('0x31');return db[_0x64dc('0x32')][_0x64dc('0x33')]({'where':{'type':_0x2ae2be,'resourceId':_0xdaaafc['id']}})[_0x64dc('0x19')](function(){return _0x5b62d5;});})[_0x64dc('0x19')](function(){_0x103f9c[_0x64dc('0x25')](0xcc)[_0x64dc('0x26')]();});}};}function handleEntityNotFound(_0x307da1,_0x1dae95){return function(_0x3e8a9e){if(!_0x3e8a9e){_0x307da1[_0x64dc('0x24')](0x194);}return _0x3e8a9e;};}function handleError(_0x388a2a,_0x22b346){_0x22b346=_0x22b346||0x1f4;return function(_0x35520a){logger[_0x64dc('0x1f')](_0x35520a[_0x64dc('0x34')]);if(_0x35520a[_0x64dc('0x35')]){delete _0x35520a[_0x64dc('0x35')];}_0x388a2a[_0x64dc('0x25')](_0x22b346)[_0x64dc('0x36')](_0x35520a);};}exports[_0x64dc('0x37')]=function(_0x39486c,_0x2403fe){var _0x27ddb9={'include':[{'model':db['Pause'],'as':_0x64dc('0x38')}]},_0x21e123={},_0x2cd18b={'count':0x0,'rows':[]};var _0x3af485=_[_0x64dc('0x39')](db[_0x64dc('0x3a')]['rawAttributes'],function(_0x57c3ad){return{'name':_0x57c3ad[_0x64dc('0x3b')],'type':_0x57c3ad[_0x64dc('0x3c')]['key']};});_0x21e123[_0x64dc('0x3d')]=_[_0x64dc('0x39')](_0x3af485,'name');_0x21e123['query']=_[_0x64dc('0x3e')](_0x39486c[_0x64dc('0x3f')]);_0x21e123['filters']=_[_0x64dc('0x40')](_0x21e123['model'],_0x21e123[_0x64dc('0x3f')]);_0x27ddb9[_0x64dc('0x41')]=_[_0x64dc('0x40')](_0x21e123['model'],qs[_0x64dc('0x42')](_0x39486c['query'][_0x64dc('0x42')]));_0x27ddb9[_0x64dc('0x41')]=_0x27ddb9[_0x64dc('0x41')][_0x64dc('0x43')]?_0x27ddb9[_0x64dc('0x41')]:_0x21e123[_0x64dc('0x3d')];if(!_0x39486c[_0x64dc('0x3f')][_0x64dc('0x44')](_0x64dc('0x45'))){_0x27ddb9[_0x64dc('0x2a')]=qs['limit'](_0x39486c[_0x64dc('0x3f')]['limit']);_0x27ddb9['offset']=qs['offset'](_0x39486c[_0x64dc('0x3f')][_0x64dc('0x28')]);}_0x27ddb9[_0x64dc('0x46')]=qs[_0x64dc('0x47')](_0x39486c['query'][_0x64dc('0x47')]);_0x27ddb9[_0x64dc('0x48')]=qs[_0x64dc('0x49')](_[_0x64dc('0x4a')](_0x39486c[_0x64dc('0x3f')],_0x21e123['filters']),_0x3af485);if(_0x39486c[_0x64dc('0x3f')][_0x64dc('0x4b')]){_0x27ddb9['where']=_[_0x64dc('0x4c')](_0x27ddb9[_0x64dc('0x48')],{'$or':_[_0x64dc('0x39')](_0x3af485,function(_0x403ba5){if(_0x403ba5['type']!==_0x64dc('0x4d')){var _0x39ef45={};_0x39ef45[_0x403ba5[_0x64dc('0x35')]]={'$like':'%'+_0x39486c[_0x64dc('0x3f')][_0x64dc('0x4b')]+'%'};return _0x39ef45;}})});}_0x27ddb9=_[_0x64dc('0x4c')]({},_0x27ddb9,_0x39486c['options']);var _0x29ec27={'where':_0x27ddb9[_0x64dc('0x48')]};return db[_0x64dc('0x3a')][_0x64dc('0x2b')](_0x29ec27)['then'](function(_0x3f5c22){_0x2cd18b['count']=_0x3f5c22;if(_0x39486c[_0x64dc('0x3f')][_0x64dc('0x4e')]){_0x27ddb9['include']=[{'all':!![]}];}return db[_0x64dc('0x3a')][_0x64dc('0x4f')](_0x27ddb9);})[_0x64dc('0x19')](function(_0x195f37){_0x2cd18b[_0x64dc('0x50')]=_0x195f37;return _0x2cd18b;})[_0x64dc('0x19')](respondWithFilteredResult(_0x2403fe,_0x27ddb9))[_0x64dc('0x23')](handleError(_0x2403fe,null));};exports[_0x64dc('0x51')]=function(_0x13d5f7,_0x24cd66){var _0x72b739={'raw':![],'where':{'id':_0x13d5f7['params']['id']},'include':[{'model':db[_0x64dc('0x52')],'as':_0x64dc('0x38')}]},_0xe9d7a6={};_0xe9d7a6['model']=_[_0x64dc('0x3e')](db['WhatsappAccount'][_0x64dc('0x53')]);_0xe9d7a6[_0x64dc('0x3f')]=_['keys'](_0x13d5f7[_0x64dc('0x3f')]);_0xe9d7a6['filters']=_[_0x64dc('0x40')](_0xe9d7a6[_0x64dc('0x3d')],_0xe9d7a6[_0x64dc('0x3f')]);_0x72b739['attributes']=_[_0x64dc('0x40')](_0xe9d7a6['model'],qs[_0x64dc('0x42')](_0x13d5f7['query'][_0x64dc('0x42')]));_0x72b739[_0x64dc('0x41')]=_0x72b739[_0x64dc('0x41')][_0x64dc('0x43')]?_0x72b739[_0x64dc('0x41')]:_0xe9d7a6[_0x64dc('0x3d')];if(_0x13d5f7[_0x64dc('0x3f')]['includeAll']){_0x72b739[_0x64dc('0x54')]=[{'all':!![]}];}_0x72b739=_[_0x64dc('0x4c')]({},_0x72b739,_0x13d5f7[_0x64dc('0x55')]);return db[_0x64dc('0x3a')][_0x64dc('0x56')](_0x72b739)[_0x64dc('0x19')](handleEntityNotFound(_0x24cd66,null))[_0x64dc('0x19')](respondWithResult(_0x24cd66,null))[_0x64dc('0x23')](handleError(_0x24cd66,null));};exports['create']=function(_0x366722,_0x8335e5){return db['WhatsappAccount'][_0x64dc('0x57')](_0x366722[_0x64dc('0x58')],{})[_0x64dc('0x19')](function(_0x38c8ac){var _0x1fa126=_0x366722[_0x64dc('0x59')]['get']({'plain':!![]});if(!_0x1fa126)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fa126['role']==='user'){var _0x43470b=_0x38c8ac[_0x64dc('0x5a')]({'plain':!![]});var _0x47c4cb=_0x64dc('0x31');return db['UserProfileSection'][_0x64dc('0x56')]({'where':{'name':_0x47c4cb,'userProfileId':_0x1fa126['userProfileId']},'raw':!![]})[_0x64dc('0x19')](function(_0x1ca8f8){if(_0x1ca8f8&&_0x1ca8f8[_0x64dc('0x5b')]===0x0){return db[_0x64dc('0x32')]['create']({'name':_0x43470b[_0x64dc('0x35')],'resourceId':_0x43470b['id'],'type':_0x1ca8f8[_0x64dc('0x35')],'sectionId':_0x1ca8f8['id']},{})['then'](function(){return _0x38c8ac;});}else{return _0x38c8ac;}})['catch'](function(_0x1f2fc5){logger[_0x64dc('0x1f')](_0x64dc('0x5c'),_0x1f2fc5);throw _0x1f2fc5;});}return _0x38c8ac;})[_0x64dc('0x19')](respondWithResult(_0x8335e5,0xc9))[_0x64dc('0x23')](handleError(_0x8335e5,null));};exports[_0x64dc('0x30')]=function(_0x324aa3,_0x6dfae6){if(_0x324aa3[_0x64dc('0x58')]['id']){delete _0x324aa3[_0x64dc('0x58')]['id'];}return db[_0x64dc('0x3a')][_0x64dc('0x56')]({'where':{'id':_0x324aa3[_0x64dc('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x64dc('0x38')}]})[_0x64dc('0x19')](handleEntityNotFound(_0x6dfae6,null))[_0x64dc('0x19')](saveUpdates(_0x324aa3[_0x64dc('0x58')],null))[_0x64dc('0x19')](respondWithResult(_0x6dfae6,null))['catch'](handleError(_0x6dfae6,null));};exports[_0x64dc('0x33')]=function(_0x42a496,_0x544f1f){return db[_0x64dc('0x3a')]['find']({'where':{'id':_0x42a496[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x544f1f,null))[_0x64dc('0x19')](removeEntity(_0x544f1f,null))[_0x64dc('0x23')](handleError(_0x544f1f,null));};exports['describe']=function(_0x5659f3,_0x34a0b4){return db[_0x64dc('0x3a')][_0x64dc('0x5e')]()[_0x64dc('0x19')](respondWithResult(_0x34a0b4,null))['catch'](handleError(_0x34a0b4,null));};exports[_0x64dc('0x5f')]=function(_0x3ec19c,_0x53fbd2,_0x2309f4){if(_0x3ec19c[_0x64dc('0x58')]['id']){delete _0x3ec19c[_0x64dc('0x58')]['id'];}return db[_0x64dc('0x3a')]['find']({'where':{'id':_0x3ec19c[_0x64dc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53fbd2,null))[_0x64dc('0x19')](function(_0x5b873f){if(_0x5b873f){_0x3ec19c['body'][_0x64dc('0x60')]=_0x5b873f['id'];return db[_0x64dc('0x61')][_0x64dc('0x57')](_0x3ec19c[_0x64dc('0x58')]);}})[_0x64dc('0x19')](respondWithResult(_0x53fbd2,null))[_0x64dc('0x23')](handleError(_0x53fbd2,null));};exports[_0x64dc('0x62')]=function(_0x2854ed,_0x15c07b,_0x3a0649){var _0xde304a={'raw':![],'where':{}};var _0xc03a97={};var _0x192395={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x64dc('0x63')]({'where':{'id':_0x2854ed[_0x64dc('0x5d')]['id']}})['then'](handleEntityNotFound(_0x15c07b,null))[_0x64dc('0x19')](function(_0x33e9f5){if(_0x33e9f5){_0xc03a97[_0x64dc('0x3d')]=_[_0x64dc('0x3e')](db[_0x64dc('0x61')]['rawAttributes']);_0xc03a97[_0x64dc('0x3f')]=_[_0x64dc('0x3e')](_0x2854ed[_0x64dc('0x3f')]);_0xc03a97[_0x64dc('0x49')]=_[_0x64dc('0x40')](_0xc03a97['model'],_0xc03a97[_0x64dc('0x3f')]);_0xde304a[_0x64dc('0x41')]=_[_0x64dc('0x40')](_0xc03a97[_0x64dc('0x3d')],qs[_0x64dc('0x42')](_0x2854ed[_0x64dc('0x3f')][_0x64dc('0x42')]));_0xde304a[_0x64dc('0x41')]=_0xde304a['attributes']['length']?_0xde304a[_0x64dc('0x41')]:_0xc03a97[_0x64dc('0x3d')];if(!_0x2854ed[_0x64dc('0x3f')][_0x64dc('0x44')](_0x64dc('0x45'))){_0xde304a[_0x64dc('0x2a')]=qs[_0x64dc('0x2a')](_0x2854ed['query'][_0x64dc('0x2a')]);_0xde304a[_0x64dc('0x28')]=qs[_0x64dc('0x28')](_0x2854ed[_0x64dc('0x3f')]['offset']);}_0xde304a[_0x64dc('0x46')]=qs['sort'](_0x2854ed[_0x64dc('0x3f')]['sort']);_0xde304a[_0x64dc('0x48')]=qs[_0x64dc('0x49')](_[_0x64dc('0x4a')](_0x2854ed[_0x64dc('0x3f')],_0xc03a97[_0x64dc('0x49')]));_0xde304a['where'][_0x64dc('0x60')]=_0x33e9f5['id'];if(_0x2854ed[_0x64dc('0x3f')][_0x64dc('0x4b')]){_0xde304a[_0x64dc('0x48')]=_[_0x64dc('0x4c')](_0xde304a[_0x64dc('0x48')],{'$or':_[_0x64dc('0x39')](_0xde304a[_0x64dc('0x41')],function(_0x15cb5d){var _0x5e5a29={};_0x5e5a29[_0x15cb5d]={'$like':'%'+_0x2854ed[_0x64dc('0x3f')]['filter']+'%'};return _0x5e5a29;})});}_0xde304a=_[_0x64dc('0x4c')]({},_0xde304a,_0x2854ed[_0x64dc('0x55')]);return db[_0x64dc('0x61')][_0x64dc('0x2b')]({'where':_0xde304a[_0x64dc('0x48')]})[_0x64dc('0x19')](function(_0x59e7be){_0x192395[_0x64dc('0x2b')]=_0x59e7be;if(_0x2854ed[_0x64dc('0x3f')][_0x64dc('0x4e')]){_0xde304a[_0x64dc('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x64dc('0x4f')](_0xde304a);})[_0x64dc('0x19')](function(_0x4ca057){_0x192395['rows']=_0x4ca057;return _0x192395;});}})[_0x64dc('0x19')](respondWithFilteredResult(_0x15c07b,_0xde304a))[_0x64dc('0x23')](handleError(_0x15c07b,null));};exports[_0x64dc('0x64')]=function(_0x469ae1,_0x378c4f,_0x3ae389){return db['WhatsappAccount'][_0x64dc('0x56')]({'where':{'id':_0x469ae1[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x378c4f,null))[_0x64dc('0x19')](function(_0x31eb39){if(_0x31eb39){return _0x31eb39[_0x64dc('0x64')](_0x469ae1[_0x64dc('0x3f')][_0x64dc('0x65')]);}})['then'](respondWithStatusCode(_0x378c4f,null))[_0x64dc('0x23')](handleError(_0x378c4f,null));};exports['addAnswer']=function(_0x462311,_0x46a3b0,_0x59863a){if(_0x462311[_0x64dc('0x58')]['id']){delete _0x462311[_0x64dc('0x58')]['id'];}return db[_0x64dc('0x3a')][_0x64dc('0x56')]({'where':{'id':_0x462311['params']['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x46a3b0,null))[_0x64dc('0x19')](function(_0xe7a769){if(_0xe7a769){_0x462311[_0x64dc('0x58')]['WhatsappAccountId']=_0xe7a769['id'];return db[_0x64dc('0x66')][_0x64dc('0x57')](_0x462311[_0x64dc('0x58')]);}})[_0x64dc('0x19')](respondWithResult(_0x46a3b0,null))['catch'](handleError(_0x46a3b0,null));};exports[_0x64dc('0x67')]=function(_0x5e165f,_0xfa6ca0,_0x22dea4){var _0xb3008={'raw':![],'where':{}};var _0x219d89={};var _0x25a1de={'count':0x0,'rows':[]};return db[_0x64dc('0x3a')]['findOne']({'where':{'id':_0x5e165f[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0xfa6ca0,null))[_0x64dc('0x19')](function(_0x45678b){if(_0x45678b){_0x219d89[_0x64dc('0x3d')]=_['keys'](db['CannedAnswer'][_0x64dc('0x53')]);_0x219d89[_0x64dc('0x3f')]=_['keys'](_0x5e165f[_0x64dc('0x3f')]);_0x219d89['filters']=_[_0x64dc('0x40')](_0x219d89['model'],_0x219d89[_0x64dc('0x3f')]);_0xb3008[_0x64dc('0x41')]=_[_0x64dc('0x40')](_0x219d89[_0x64dc('0x3d')],qs[_0x64dc('0x42')](_0x5e165f[_0x64dc('0x3f')]['fields']));_0xb3008['attributes']=_0xb3008[_0x64dc('0x41')]['length']?_0xb3008['attributes']:_0x219d89[_0x64dc('0x3d')];if(!_0x5e165f[_0x64dc('0x3f')][_0x64dc('0x44')](_0x64dc('0x45'))){_0xb3008['limit']=qs[_0x64dc('0x2a')](_0x5e165f[_0x64dc('0x3f')][_0x64dc('0x2a')]);_0xb3008[_0x64dc('0x28')]=qs['offset'](_0x5e165f[_0x64dc('0x3f')][_0x64dc('0x28')]);}_0xb3008[_0x64dc('0x46')]=qs[_0x64dc('0x47')](_0x5e165f[_0x64dc('0x3f')]['sort']);_0xb3008['where']=qs[_0x64dc('0x49')](_[_0x64dc('0x4a')](_0x5e165f[_0x64dc('0x3f')],_0x219d89['filters']));_0xb3008['where'][_0x64dc('0x60')]=_0x45678b['id'];if(_0x5e165f[_0x64dc('0x3f')][_0x64dc('0x4b')]){_0xb3008[_0x64dc('0x48')]=_[_0x64dc('0x4c')](_0xb3008[_0x64dc('0x48')],{'$or':_[_0x64dc('0x39')](_0xb3008[_0x64dc('0x41')],function(_0x5142d1){var _0x3fdf4b={};_0x3fdf4b[_0x5142d1]={'$like':'%'+_0x5e165f[_0x64dc('0x3f')][_0x64dc('0x4b')]+'%'};return _0x3fdf4b;})});}_0xb3008=_[_0x64dc('0x4c')]({},_0xb3008,_0x5e165f[_0x64dc('0x55')]);return db['CannedAnswer'][_0x64dc('0x2b')]({'where':_0xb3008[_0x64dc('0x48')]})[_0x64dc('0x19')](function(_0xf77456){_0x25a1de[_0x64dc('0x2b')]=_0xf77456;if(_0x5e165f['query']['includeAll']){_0xb3008['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x64dc('0x4f')](_0xb3008);})['then'](function(_0x5e7297){_0x25a1de[_0x64dc('0x50')]=_0x5e7297;return _0x25a1de;});}})['then'](respondWithFilteredResult(_0xfa6ca0,_0xb3008))['catch'](handleError(_0xfa6ca0,null));};exports[_0x64dc('0x68')]=function(_0x50a4fd,_0x236baf,_0x1c5e25){return db[_0x64dc('0x3a')][_0x64dc('0x56')]({'where':{'id':_0x50a4fd[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x236baf,null))[_0x64dc('0x19')](function(_0x26a221){if(_0x26a221){return _0x26a221[_0x64dc('0x68')](_0x50a4fd[_0x64dc('0x3f')][_0x64dc('0x65')]);}})[_0x64dc('0x19')](respondWithStatusCode(_0x236baf,null))['catch'](handleError(_0x236baf,null));};exports[_0x64dc('0x69')]=function(_0x17d07d,_0x26b7e5,_0x29600e){return db['WhatsappAccount'][_0x64dc('0x56')]({'where':{'id':_0x17d07d[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x26b7e5,null))[_0x64dc('0x19')](function(_0x318736){if(_0x318736){return _0x318736[_0x64dc('0x69')](_0x17d07d['body'][_0x64dc('0x65')],_[_0x64dc('0x6a')](_0x17d07d['body'],['ids','id'])||{})[_0x64dc('0x6b')](function(_0x4b7eb2){for(var _0x540fd0=0x0;_0x540fd0<_0x17d07d['body'][_0x64dc('0x65')]['length'];_0x540fd0+=0x1){socket[_0x64dc('0x6c')](_0x64dc('0x6d'),{'UserId':Number(_0x17d07d[_0x64dc('0x58')][_0x64dc('0x65')][_0x540fd0]),'WhatsappAccountId':Number(_0x17d07d[_0x64dc('0x5d')]['id'])});}return _0x4b7eb2;});}})[_0x64dc('0x19')](respondWithResult(_0x26b7e5,null))[_0x64dc('0x23')](handleError(_0x26b7e5,null));};exports[_0x64dc('0x6e')]=function(_0x308fb6,_0x3ca380,_0x1cfe18){return db[_0x64dc('0x3a')][_0x64dc('0x56')]({'where':{'id':_0x308fb6[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x3ca380,null))[_0x64dc('0x19')](function(_0x2412be){if(_0x2412be){return _0x2412be[_0x64dc('0x6e')](_0x308fb6[_0x64dc('0x3f')][_0x64dc('0x65')])['then'](function(){if(_[_0x64dc('0x6f')](_0x308fb6[_0x64dc('0x3f')]['ids'])){for(var _0x4d939b=0x0;_0x4d939b<_0x308fb6[_0x64dc('0x3f')][_0x64dc('0x65')][_0x64dc('0x43')];_0x4d939b+=0x1){socket['emit'](_0x64dc('0x70'),{'UserId':Number(_0x308fb6[_0x64dc('0x3f')][_0x64dc('0x65')][_0x4d939b]),'WhatsappAccountId':Number(_0x308fb6[_0x64dc('0x5d')]['id'])});}}else{socket['emit'](_0x64dc('0x70'),{'UserId':Number(_0x308fb6[_0x64dc('0x3f')][_0x64dc('0x65')]),'WhatsappAccountId':Number(_0x308fb6[_0x64dc('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ca380,null))[_0x64dc('0x23')](handleError(_0x3ca380,null));};exports[_0x64dc('0x71')]=function(_0x269b68,_0x571449,_0x29f3a5){var _0x1ed74a={};var _0x2b3405={};var _0x4d1802;var _0x16e7ed;return db['WhatsappAccount']['findOne']({'where':{'id':_0x269b68[_0x64dc('0x5d')]['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x571449,null))[_0x64dc('0x19')](function(_0x4d915b){if(_0x4d915b){_0x4d1802=_0x4d915b;_0x2b3405['model']=_['keys'](db[_0x64dc('0x72')][_0x64dc('0x53')]);_0x2b3405[_0x64dc('0x3f')]=_['keys'](_0x269b68['query']);_0x2b3405['filters']=_[_0x64dc('0x40')](_0x2b3405['model'],_0x2b3405[_0x64dc('0x3f')]);_0x1ed74a[_0x64dc('0x41')]=_[_0x64dc('0x40')](_0x2b3405[_0x64dc('0x3d')],qs[_0x64dc('0x42')](_0x269b68['query']['fields']));_0x1ed74a[_0x64dc('0x41')]=_0x1ed74a['attributes'][_0x64dc('0x43')]?_0x1ed74a[_0x64dc('0x41')]:_0x2b3405[_0x64dc('0x3d')];_0x1ed74a[_0x64dc('0x46')]=qs[_0x64dc('0x47')](_0x269b68[_0x64dc('0x3f')][_0x64dc('0x47')]);_0x1ed74a[_0x64dc('0x48')]=qs[_0x64dc('0x49')](_[_0x64dc('0x4a')](_0x269b68[_0x64dc('0x3f')],_0x2b3405[_0x64dc('0x49')]));if(_0x269b68[_0x64dc('0x3f')]['filter']){_0x1ed74a['where']=_[_0x64dc('0x4c')](_0x1ed74a[_0x64dc('0x48')],{'$or':_[_0x64dc('0x39')](_0x1ed74a['attributes'],function(_0x407977){var _0x564997={};_0x564997[_0x407977]={'$like':'%'+_0x269b68[_0x64dc('0x3f')][_0x64dc('0x4b')]+'%'};return _0x564997;})});}_0x1ed74a=_['merge']({},_0x1ed74a,_0x269b68[_0x64dc('0x55')]);return _0x4d1802[_0x64dc('0x71')](_0x1ed74a);}})[_0x64dc('0x19')](function(_0x327937){if(_0x327937){_0x16e7ed=_0x327937[_0x64dc('0x43')];if(!_0x269b68[_0x64dc('0x3f')]['hasOwnProperty']('nolimit')){_0x1ed74a[_0x64dc('0x2a')]=qs[_0x64dc('0x2a')](_0x269b68[_0x64dc('0x3f')]['limit']);_0x1ed74a['offset']=qs[_0x64dc('0x28')](_0x269b68[_0x64dc('0x3f')][_0x64dc('0x28')]);}return _0x4d1802[_0x64dc('0x71')](_0x1ed74a);}})[_0x64dc('0x19')](function(_0x5e68b7){if(_0x5e68b7){return _0x5e68b7?{'count':_0x16e7ed,'rows':_0x5e68b7}:null;}})[_0x64dc('0x19')](respondWithResult(_0x571449,null))[_0x64dc('0x23')](handleError(_0x571449,null));};exports[_0x64dc('0x73')]=function(_0x277ba3,_0x130e33){var _0x3512d8=_0x277ba3[_0x64dc('0x5d')]['id'];var _0x54f8dc=_0x277ba3['body'];var _0x463b32=0xc8;var _0xe14cb=null;return db[_0x64dc('0x74')][_0x64dc('0x75')]({'isolationLevel':db[_0x64dc('0x74')][_0x64dc('0x76')]['ISOLATION_LEVELS'][_0x64dc('0x77')]},function(_0x11eeac){return db['WhatsappAccount'][_0x64dc('0x63')]({'where':{'id':_0x3512d8},'transaction':_0x11eeac})[_0x64dc('0x19')](function(_0x3bb0d8){if(_0x3bb0d8){return db[_0x64dc('0x78')][_0x64dc('0x33')]({'where':{'WhatsappAccountId':_0x3512d8},'transaction':_0x11eeac})[_0x64dc('0x19')](function(){var _0x6234f0=_[_0x64dc('0x39')](_0x54f8dc,function(_0x22f691){_0x22f691[_0x64dc('0x60')]=_0x3512d8;return _0x22f691;});return db[_0x64dc('0x78')][_0x64dc('0x79')](_0x6234f0,{'transaction':_0x11eeac});});}else{_0x463b32=0x194;_0xe14cb=[];}});})['then'](function(){if(_0x463b32!==0x194){return db[_0x64dc('0x78')][_0x64dc('0x7a')]({'where':{'WhatsappAccountId':_0x3512d8},'order':'priority'})[_0x64dc('0x19')](function(_0x17a544){_0xe14cb=_0x17a544;});}})[_0x64dc('0x23')](function(_0x2efac6){_0x463b32=0x1f4;logger[_0x64dc('0x1f')](_0x2efac6[_0x64dc('0x34')]);if(_0x2efac6['name']){delete _0x2efac6['name'];}_0xe14cb=_0x2efac6;})[_0x64dc('0x7b')](function(){if(_0xe14cb===null){_0x130e33['sendStatus'](_0x463b32);}else{if(_0x463b32===0x1f4){_0x130e33[_0x64dc('0x25')](_0x463b32)[_0x64dc('0x36')](_0xe14cb);}else{_0x130e33['status'](_0x463b32)[_0x64dc('0x27')](_0xe14cb);}}});};exports[_0x64dc('0x7c')]=function(_0x17f0a6,_0x2d3052,_0x543c7e){var _0x5b62cb={};var _0x2c4294={};var _0x10c28d;var _0x84d5f2;return db[_0x64dc('0x3a')][_0x64dc('0x63')]({'where':{'id':_0x17f0a6['params']['id']}})[_0x64dc('0x19')](handleEntityNotFound(_0x2d3052,null))[_0x64dc('0x19')](function(_0xbcc206){if(_0xbcc206){_0x10c28d=_0xbcc206;_0x2c4294['model']=_[_0x64dc('0x3e')](db[_0x64dc('0x78')][_0x64dc('0x53')]);_0x2c4294[_0x64dc('0x3f')]=_['keys'](_0x17f0a6['query']);_0x2c4294[_0x64dc('0x49')]=_[_0x64dc('0x40')](_0x2c4294['model'],_0x2c4294[_0x64dc('0x3f')]);_0x5b62cb['attributes']=_[_0x64dc('0x40')](_0x2c4294[_0x64dc('0x3d')],qs[_0x64dc('0x42')](_0x17f0a6[_0x64dc('0x3f')]['fields']));_0x5b62cb[_0x64dc('0x41')]=_0x5b62cb[_0x64dc('0x41')][_0x64dc('0x43')]?_0x5b62cb[_0x64dc('0x41')]:_0x2c4294[_0x64dc('0x3d')];_0x5b62cb[_0x64dc('0x46')]=qs[_0x64dc('0x47')](_0x17f0a6[_0x64dc('0x3f')]['sort']);_0x5b62cb[_0x64dc('0x48')]=qs['filters'](_['pick'](_0x17f0a6['query'],_0x2c4294['filters']));if(_0x17f0a6[_0x64dc('0x3f')]['filter']){_0x5b62cb[_0x64dc('0x48')]=_[_0x64dc('0x4c')](_0x5b62cb[_0x64dc('0x48')],{'$or':_[_0x64dc('0x39')](_0x5b62cb['attributes'],function(_0xc2050a){var _0x57169e={};_0x57169e[_0xc2050a]={'$like':'%'+_0x17f0a6[_0x64dc('0x3f')]['filter']+'%'};return _0x57169e;})});}_0x5b62cb=_[_0x64dc('0x4c')]({},_0x5b62cb,_0x17f0a6[_0x64dc('0x55')]);return _0x10c28d[_0x64dc('0x7c')](_0x5b62cb);}})[_0x64dc('0x19')](function(_0x4649fd){if(_0x4649fd){_0x84d5f2=_0x4649fd[_0x64dc('0x43')];if(!_0x17f0a6[_0x64dc('0x3f')][_0x64dc('0x44')](_0x64dc('0x45'))){_0x5b62cb[_0x64dc('0x2a')]=qs[_0x64dc('0x2a')](_0x17f0a6[_0x64dc('0x3f')][_0x64dc('0x2a')]);_0x5b62cb[_0x64dc('0x28')]=qs['offset'](_0x17f0a6['query'][_0x64dc('0x28')]);}return _0x10c28d['getApplications'](_0x5b62cb);}})['then'](function(_0x3be71c){if(_0x3be71c){return _0x3be71c?{'count':_0x84d5f2,'rows':_0x3be71c}:null;}})[_0x64dc('0x19')](respondWithResult(_0x2d3052,null))[_0x64dc('0x23')](handleError(_0x2d3052,null));};exports[_0x64dc('0x7d')]=function(_0x12da23,_0x2aad7e,_0x3bb0c1){var _0x5acc8a={'channel':_0x64dc('0x7e')};var _0x48cf26=[];var _0x4ab7af=[];var _0x28a319={};return db[_0x64dc('0x3a')]['find']({'where':{'id':_0x12da23[_0x64dc('0x5d')]['id']},'include':[{'model':db[_0x64dc('0x78')],'as':_0x64dc('0x7f')}]})[_0x64dc('0x19')](handleEntityNotFound(_0x2aad7e,null))[_0x64dc('0x19')](function(_0x26793e){_0x5acc8a[_0x64dc('0x80')]=_0x26793e;if(_0x5acc8a['account']&&_0x5acc8a[_0x64dc('0x80')]['type']===_0x64dc('0x81')&&_0x12da23['body'][_0x64dc('0x82')]){if(_0x12da23[_0x64dc('0x58')]['statuses'][_0x64dc('0x43')]===0x0)return;if(_0x12da23[_0x64dc('0x58')][_0x64dc('0x82')][0x0][_0x64dc('0x83')]!==_0x64dc('0x84'))return;return db[_0x64dc('0x85')]['update']({'read':!![],'readAt':_0x12da23[_0x64dc('0x58')]['statuses'][0x0][_0x64dc('0x86')]},{'where':{'messageId':_0x12da23[_0x64dc('0x58')][_0x64dc('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x64dc('0x19')](function(_0x410589){return _0x2aad7e['status'](0xc8)[_0x64dc('0x27')](_0x410589);});}_0x5acc8a[_0x64dc('0x87')]=_[_0x64dc('0x88')](_0x26793e['Applications'],[_0x64dc('0x89')],['asc']);if(_0x5acc8a[_0x64dc('0x80')][_0x64dc('0x7f')]){delete _0x5acc8a[_0x64dc('0x80')]['Applications'];}return db['CmContact'][_0x64dc('0x5e')]()[_0x64dc('0x19')](function(_0x52c079){if(!_0x52c079){throw new db['Sequelize'][(_0x64dc('0x8a'))]('no\x20available\x20attributes');}_0x48cf26=_[_0x64dc('0x8b')](_[_0x64dc('0x3e')](_0x52c079),[_0x64dc('0x8c'),_0x64dc('0x8d')]);_0x4ab7af=_[_0x64dc('0x8b')](_[_0x64dc('0x3e')](_0x52c079),[_0x64dc('0x8c'),_0x64dc('0x8d'),'CompanyId',_0x64dc('0x8e')]);_0x5acc8a[_0x64dc('0x58')]={'mapKey':'mobile'};if(_0x5acc8a[_0x64dc('0x80')]&&_0x5acc8a[_0x64dc('0x80')][_0x64dc('0x3c')]===_0x64dc('0x8f')){_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')]=_0x12da23[_0x64dc('0x58')]['From']['replace'](_0x64dc('0x91'),'');_0x5acc8a[_0x64dc('0x58')]['body']=_0x12da23[_0x64dc('0x58')][_0x64dc('0x92')];_0x5acc8a['body'][_0x64dc('0x93')]=_0x12da23[_0x64dc('0x58')]['MessageSid'];}if(_0x5acc8a[_0x64dc('0x80')]&&_0x5acc8a['account'][_0x64dc('0x3c')]===_0x64dc('0x81')){_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')]=_0x12da23['body']['notifications'][0x0]['from'];_0x5acc8a['body'][_0x64dc('0x58')]=_0x12da23['body'][_0x64dc('0x94')][0x0]['message'][_0x64dc('0x58')];_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x93')]=_0x12da23[_0x64dc('0x58')][_0x64dc('0x94')][0x0][_0x64dc('0x95')];}if(_0x5acc8a[_0x64dc('0x58')]['id']){delete _0x5acc8a[_0x64dc('0x58')]['id'];}if(_[_0x64dc('0x96')](_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')])){throw new db[(_0x64dc('0x97'))][(_0x64dc('0x8a'))](_0x64dc('0x98'));}if(_[_0x64dc('0x96')](_0x5acc8a['body'][_0x64dc('0x58')])||_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x58')]===''){throw new db[(_0x64dc('0x97'))][(_0x64dc('0x8a'))](_0x64dc('0x99'));}if(_['isNil'](_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x9a')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ab7af);}if(!_['includes'](_0x4ab7af,_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x9a')])){throw new db[(_0x64dc('0x97'))]['ValidationError'](_0x64dc('0x9b')+_0x4ab7af);}_0x28a319[_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x9a')]]=_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')];return db[_0x64dc('0x9c')]['find']({'where':{'id':_0x5acc8a[_0x64dc('0x80')][_0x64dc('0x8e')]},'include':[{'model':db[_0x64dc('0x9d')],'as':_0x64dc('0x9e'),'where':_0x28a319,'limit':0x1,'order':[['updatedAt',_0x64dc('0x9f')]]}]});})[_0x64dc('0x19')](handleEntityNotFound(_0x2aad7e,null))[_0x64dc('0x19')](function(_0x7c8aef){if(_0x7c8aef){_0x5acc8a[_0x64dc('0xa0')]=_[_0x64dc('0x6a')](_0x7c8aef,[_0x64dc('0x9e')]);if(_0x7c8aef['Contacts']['length']){return _0x7c8aef[_0x64dc('0x9e')][0x0];}var _0x96598e=_[_0x64dc('0x14')](_0x5acc8a['body'],{'firstName':_0x5acc8a[_0x64dc('0x58')]['from'],'ListId':_0x7c8aef['id']});_0x96598e[_0x5acc8a['body']['mapKey']]=_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')];return db[_0x64dc('0x9d')][_0x64dc('0x57')](_0x96598e,{'fields':_0x48cf26,'raw':!![]});}})[_0x64dc('0x19')](handleEntityNotFound(_0x2aad7e,null))[_0x64dc('0x19')](function(_0x40e531){if(_0x40e531){_0x5acc8a[_0x64dc('0xa1')]=_0x40e531;var _0x533232={'ContactId':_0x40e531['id'],'phone':_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')],'WhatsappAccountId':_0x12da23[_0x64dc('0x5d')]['id']};var _0x127e37={'ContactId':_0x40e531['id'],'WhatsappAccountId':_0x12da23[_0x64dc('0x5d')]['id'],'closed':![]};return db[_0x64dc('0xa2')]['find']({'where':_0x127e37})[_0x64dc('0x19')](function(_0x4374f2){if(_0x4374f2){return[_0x4374f2,![]];}return db[_0x64dc('0xa2')]['create'](_0x533232)[_0x64dc('0x19')](function(_0x2dedd6){return[_0x2dedd6,!![]];});});}})[_0x64dc('0x6b')](function(_0x423f0c,_0x41e3b4){_0x5acc8a[_0x64dc('0xa3')]=_0x423f0c[_0x64dc('0x5a')]({'plain':!![]});_0x5acc8a[_0x64dc('0xa3')][_0x64dc('0xa4')]=![];if(_0x41e3b4){if(_0x5acc8a['account'][_0x64dc('0xa5')]){_0x5acc8a[_0x64dc('0x87')]['push']({'id':0x0,'priority':_0x5acc8a['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5acc8a[_0x64dc('0xa3')][_0x64dc('0xa4')]=!![];}return db[_0x64dc('0x85')]['create']({'phone':_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x90')],'messageId':_0x5acc8a[_0x64dc('0x58')][_0x64dc('0x93')],'body':_0x5acc8a['body'][_0x64dc('0x58')],'WhatsappAccountId':_0x12da23[_0x64dc('0x5d')]['id'],'WhatsappInteractionId':_0x423f0c['id'],'direction':'in','ContactId':_0x423f0c['ContactId'],'AttachmentId':_0x5acc8a[_0x64dc('0x58')][_0x64dc('0xa6')]});})['then'](function(_0x4d543b){_0x5acc8a[_0x64dc('0x21')]=_0x4d543b;if(_0x5acc8a[_0x64dc('0xa3')][_0x64dc('0xa7')]){return db['User'][_0x64dc('0x56')]({'attributes':['id',_0x64dc('0x35')],'where':{'id':_0x5acc8a[_0x64dc('0xa3')][_0x64dc('0xa7')]}})['then'](function(_0x270358){if(_0x270358){_0x5acc8a[_0x64dc('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0x64dc('0xa8'),'appdata':_0x270358['name']+','+(_0x5acc8a[_0x64dc('0x80')][_0x64dc('0xa9')]||0xa),'interval':_0x64dc('0xaa')});}return respondWithRpcPromise(_0x64dc('0xab'),'startRouting',_0x5acc8a);});}return respondWithRpcPromise(_0x64dc('0xab'),_0x64dc('0xac'),_0x5acc8a);})[_0x64dc('0x19')](function(_0x538281){if(_0x538281){var _0x5121cb=0xc8;var _0x5a154f=_0x64dc('0xad');logger[_0x64dc('0x1a')](_0x64dc('0x1d'),_0x5a154f,_0x5121cb,'entity\x20found');logger[_0x64dc('0xae')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5a154f,_0x5121cb,_0x64dc('0xaf'),JSON[_0x64dc('0x1e')](_0x538281));if(_0x5acc8a[_0x64dc('0x80')]['type']===_0x64dc('0x8f')){return _0x2aad7e[_0x64dc('0x25')](_0x5121cb)[_0x64dc('0x2c')](_0x64dc('0xb0'),'text/xml')['send'](_0x64dc('0xb1'));}else{return _0x2aad7e[_0x64dc('0x25')](_0x5121cb)[_0x64dc('0x27')](_0x538281);}}});})[_0x64dc('0x23')](handleError(_0x2aad7e,null));};exports['send']=function(_0x5b31b3,_0x4aaabe,_0x1fc56e){var _0x5c2209,_0x243ccd,_0x52c9c0;if(_[_0x64dc('0x96')](_0x5b31b3['body'][_0x64dc('0x58')])||_0x5b31b3[_0x64dc('0x58')][_0x64dc('0x58')]===''){throw new db[(_0x64dc('0x97'))][(_0x64dc('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x64dc('0x96')](_0x5b31b3[_0x64dc('0x58')]['to'])){throw new db[(_0x64dc('0x97'))][(_0x64dc('0x8a'))]('to\x20is\x20mandatory');}_0x5c2209=_0x5b31b3[_0x64dc('0x58')]['to'];return db[_0x64dc('0x3a')][_0x64dc('0x56')]({'where':{'id':_0x5b31b3[_0x64dc('0x5d')]['id']},'include':[{'model':db[_0x64dc('0x9c')],'as':_0x64dc('0xb2'),'include':[{'model':db[_0x64dc('0x9d')],'as':_0x64dc('0x9e'),'where':{'mobile':_0x5c2209},'limit':0x1,'order':[[_0x64dc('0x8d'),_0x64dc('0x9f')]]}]}]})['then'](handleEntityNotFound(_0x4aaabe,null))[_0x64dc('0x19')](function(_0x24db77){if(_0x24db77&&_0x24db77[_0x64dc('0xb2')]){_0x243ccd=_0x24db77['get']({'plain':!![]});if(_0x243ccd[_0x64dc('0xb2')]&&_0x243ccd[_0x64dc('0xb2')][_0x64dc('0x9e')]['length']){return _0x243ccd[_0x64dc('0xb2')][_0x64dc('0x9e')][0x0];}return db[_0x64dc('0x9d')][_0x64dc('0x57')](_[_0x64dc('0x14')](_0x5b31b3[_0x64dc('0x58')],{'firstName':_0x5c2209,'mobile':_0x5c2209,'phone':_0x5c2209,'ListId':_0x243ccd[_0x64dc('0x8e')]}));}})['then'](handleEntityNotFound(_0x4aaabe,null))[_0x64dc('0x19')](function(_0x323a96){if(_0x323a96){_0x52c9c0=_0x323a96;return db[_0x64dc('0xa2')]['find']({'where':{'ContactId':_0x52c9c0['id'],'closed':![],'WhatsappAccountId':_0x243ccd['id']}})[_0x64dc('0x19')](function(_0x47d687){if(_0x47d687){return[_0x47d687,![]];}return db[_0x64dc('0xa2')][_0x64dc('0x57')]({'UserId':_0x5b31b3[_0x64dc('0x59')]['id'],'ContactId':_0x52c9c0['id'],'WhatsappAccountId':_0x243ccd['id'],'phone':_0x5c2209,'firstMsgDirection':_0x64dc('0xb3'),'Messages':[_[_0x64dc('0x4c')](_0x5b31b3[_0x64dc('0x58')],{'read':![],'body':_0x5b31b3[_0x64dc('0x58')][_0x64dc('0x58')],'phone':_0x5c2209,'WhatsappAccountId':_0x243ccd['id'],'UserId':_0x5b31b3['user']['id'],'ContactId':_0x52c9c0['id']})]},{'include':[{'model':db[_0x64dc('0x85')],'as':_0x64dc('0xb4')}]})[_0x64dc('0x19')](function(_0x2b7a60){return[_0x2b7a60,!![]];});});}})[_0x64dc('0x6b')](function(_0x423ce5,_0x423352){if(_0x423352){return _0x423ce5;}return db[_0x64dc('0x85')][_0x64dc('0x57')](_[_0x64dc('0x4c')](_0x5b31b3[_0x64dc('0x58')],{'read':![],'body':_0x5b31b3[_0x64dc('0x58')][_0x64dc('0x58')],'phone':_0x5c2209,'WhatsappAccountId':_0x243ccd['id'],'WhatsappInteractionId':_0x423ce5['id'],'UserId':_0x5b31b3['user']['id'],'ContactId':_0x52c9c0['id']}))['then'](function(_0x3f86f1){_0x423ce5[_0x64dc('0xb5')][_0x64dc('0xb4')]=[];_0x423ce5[_0x64dc('0xb5')][_0x64dc('0xb4')][_0x64dc('0xb6')](_0x3f86f1[_0x64dc('0xb5')]);return _0x423ce5;});})[_0x64dc('0x19')](respondWithResult(_0x4aaabe,null))[_0x64dc('0x23')](handleError(_0x4aaabe,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index dbd40fd..99168b5 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 _0x8a9e=['hasOwnProperty','hook','../../mysqldb','save','remove','emit'];(function(_0x1c5d18,_0x1803ef){var _0x4583d6=function(_0xb4aa40){while(--_0xb4aa40){_0x1c5d18['push'](_0x1c5d18['shift']());}};_0x4583d6(++_0x1803ef);}(_0x8a9e,0x188));var _0xe8a9=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8a9e[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xe8a9('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe8a9('0x1'),'afterUpdate':'update','afterDestroy':_0xe8a9('0x2')};function emitEvent(_0x5b4ea0){return function(_0x57b57d,_0x462217,_0x1c79bd){WhatsappAccountEvents['emit'](_0x5b4ea0+':'+_0x57b57d['id'],_0x57b57d);WhatsappAccountEvents[_0xe8a9('0x3')](_0x5b4ea0,_0x57b57d);_0x1c79bd(null);};}for(var e in events){if(events[_0xe8a9('0x4')](e)){var event=events[e];WhatsappAccount[_0xe8a9('0x5')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xc43c=['WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x258b94,_0x294a49){var _0x2bf521=function(_0xbc378a){while(--_0xbc378a){_0x258b94['push'](_0x258b94['shift']());}};_0x2bf521(++_0x294a49);}(_0xc43c,0x152));var _0xcc43=function(_0x43db58,_0x5c629b){_0x43db58=_0x43db58-0x0;var _0x3534a0=_0xc43c[_0x43db58];return _0x3534a0;};'use strict';var EventEmitter=require(_0xcc43('0x0'));var WhatsappAccount=require(_0xcc43('0x1'))['db'][_0xcc43('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcc43('0x3')](0x0);var events={'afterCreate':_0xcc43('0x4'),'afterUpdate':_0xcc43('0x5'),'afterDestroy':'remove'};function emitEvent(_0x162a11){return function(_0x258c7e,_0x5c21a3,_0x1b589f){WhatsappAccountEvents[_0xcc43('0x6')](_0x162a11+':'+_0x258c7e['id'],_0x258c7e);WhatsappAccountEvents[_0xcc43('0x6')](_0x162a11,_0x258c7e);_0x1b589f(null);};}for(var e in events){if(events[_0xcc43('0x7')](e)){var event=events[e];WhatsappAccount[_0xcc43('0x8')](e,emitEvent(event));}}module[_0xcc43('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 685c270..6ec47b7 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 _0x5074=['api','moment','bluebird','path','rimraf','exports','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x36decb,_0x398689){var _0x1e80b0=function(_0x2ee604){while(--_0x2ee604){_0x36decb['push'](_0x36decb['shift']());}};_0x1e80b0(++_0x398689);}(_0x5074,0x6c));var _0x4507=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x5074[_0x3dee92];return _0x44d36e;};'use strict';var _=require(_0x4507('0x0'));var util=require('util');var logger=require(_0x4507('0x1'))(_0x4507('0x2'));var moment=require(_0x4507('0x3'));var BPromise=require(_0x4507('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4507('0x5'));var rimraf=require(_0x4507('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x4507('0x7')]=function(_0x359c9c,_0x30b8ed){return _0x359c9c['define'](_0x4507('0x8'),attributes,{'tableName':_0x4507('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c7=['exports','WhatsappAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','./whatsappAccount.attributes'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0xd2c7,0x197));var _0x7d2c=function(_0x13ff64,_0x106356){_0x13ff64=_0x13ff64-0x0;var _0x7949cb=_0xd2c7[_0x13ff64];return _0x7949cb;};'use strict';var _=require(_0x7d2c('0x0'));var util=require('util');var logger=require(_0x7d2c('0x1'))(_0x7d2c('0x2'));var moment=require(_0x7d2c('0x3'));var BPromise=require(_0x7d2c('0x4'));var rp=require(_0x7d2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d2c('0x6'));module[_0x7d2c('0x7')]=function(_0x1c3090,_0x3f26e2){return _0x1c3090['define'](_0x7d2c('0x8'),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 52917df..c4d63a9 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 _0xe34c=['where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','request\x20sent','catch','ShowWhatsappAccount','find','options'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xe34c,0x1cc));var _0xce34=function(_0x507c1c,_0x594f86){_0x507c1c=_0x507c1c-0x0;var _0x17b9c7=_0xe34c[_0x507c1c];return _0x17b9c7;};'use strict';var _=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var moment=require('moment');var BPromise=require(_0xce34('0x2'));var rs=require(_0xce34('0x3'));var fs=require('fs');var Redis=require(_0xce34('0x4'));var db=require(_0xce34('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xce34('0x6'))(_0xce34('0x7'));var config=require('../../config/environment');var jayson=require(_0xce34('0x8'));var client=jayson[_0xce34('0x9')]['http']({'port':0x232a});config['redis']=_[_0xce34('0xa')](config[_0xce34('0xb')],{'host':_0xce34('0xc'),'port':0x18eb});var socket=require(_0xce34('0xd'))(new Redis(config[_0xce34('0xb')]));require(_0xce34('0xe'))[_0xce34('0xf')](socket);function respondWithRpcPromise(_0xb99cf1,_0x548643,_0x54cd2d){return new BPromise(function(_0x9635bc,_0x2a0784){return client[_0xce34('0x10')](_0xb99cf1,_0x54cd2d)[_0xce34('0x11')](function(_0x3b7674){logger[_0xce34('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x548643,'request\x20sent');logger[_0xce34('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x548643,'request\x20sent',JSON[_0xce34('0x14')](_0x3b7674));if(_0x3b7674[_0xce34('0x15')]){if(_0x3b7674[_0xce34('0x15')][_0xce34('0x16')]===0x1f4){logger[_0xce34('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x548643,_0x3b7674[_0xce34('0x15')][_0xce34('0x17')]);return _0x2a0784(_0x3b7674[_0xce34('0x15')]['message']);}logger['error'](_0xce34('0x18'),_0x548643,_0x3b7674['error'][_0xce34('0x17')]);return _0x9635bc(_0x3b7674[_0xce34('0x15')]['message']);}else{logger[_0xce34('0x12')](_0xce34('0x18'),_0x548643,_0xce34('0x19'));_0x9635bc(_0x3b7674['result'][_0xce34('0x17')]);}})[_0xce34('0x1a')](function(_0x3b752f){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x548643,_0x3b752f);_0x2a0784(_0x3b752f);});});}exports[_0xce34('0x1b')]=function(_0x5b188a){var _0x42a3e8=this;return new Promise(function(_0x4122b8,_0x1b2373){return db['WhatsappAccount'][_0xce34('0x1c')]({'raw':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x1e')]||null:null,'attributes':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x1f')]||null:null,'include':_0x5b188a[_0xce34('0x1d')]?_0x5b188a[_0xce34('0x1d')][_0xce34('0x20')]?_[_0xce34('0x21')](_0x5b188a[_0xce34('0x1d')][_0xce34('0x20')],function(_0x5c2ccb){return{'model':db[_0x5c2ccb[_0xce34('0x22')]],'as':_0x5c2ccb['as'],'attributes':_0x5c2ccb[_0xce34('0x1f')],'include':_0x5c2ccb['include']?_[_0xce34('0x21')](_0x5c2ccb[_0xce34('0x20')],function(_0x5bed9d){return{'model':db[_0x5bed9d[_0xce34('0x22')]],'as':_0x5bed9d['as'],'attributes':_0x5bed9d[_0xce34('0x1f')],'include':_0x5bed9d[_0xce34('0x20')]?_[_0xce34('0x21')](_0x5bed9d[_0xce34('0x20')],function(_0x4b0b6d){return{'model':db[_0x4b0b6d[_0xce34('0x22')]],'as':_0x4b0b6d['as'],'attributes':_0x4b0b6d['attributes']};}):[]};}):[]};}):[]:[]})[_0xce34('0x11')](function(_0x439f86){logger[_0xce34('0x12')]('ShowWhatsappAccount',_0x5b188a);logger[_0xce34('0x13')](_0xce34('0x1b'),_0x5b188a,JSON[_0xce34('0x14')](_0x439f86));_0x4122b8(_0x439f86);})['catch'](function(_0x28babb){logger['error'](_0xce34('0x1b'),_0x28babb[_0xce34('0x17')],_0x5b188a);_0x1b2373(_0x42a3e8['error'](0x1f4,_0x28babb['message']));});});}; \ No newline at end of file +var _0xc4cf=['stringify','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x140445,_0x4b7964){var _0xa09a2c=function(_0x5ad093){while(--_0x5ad093){_0x140445['push'](_0x140445['shift']());}};_0xa09a2c(++_0x4b7964);}(_0xc4cf,0xc8));var _0xfc4c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc4cf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfc4c('0x0'));var util=require(_0xfc4c('0x1'));var moment=require(_0xfc4c('0x2'));var BPromise=require(_0xfc4c('0x3'));var rs=require(_0xfc4c('0x4'));var fs=require('fs');var Redis=require(_0xfc4c('0x5'));var db=require(_0xfc4c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc4c('0x7'))(_0xfc4c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc4c('0x9')][_0xfc4c('0xa')]({'port':0x232a});config[_0xfc4c('0xb')]=_[_0xfc4c('0xc')](config['redis'],{'host':_0xfc4c('0xd'),'port':0x18eb});var socket=require(_0xfc4c('0xe'))(new Redis(config[_0xfc4c('0xb')]));require(_0xfc4c('0xf'))[_0xfc4c('0x10')](socket);function respondWithRpcPromise(_0x2b188d,_0x39f9ed,_0x5b83cc){return new BPromise(function(_0x523a54,_0x57fbcf){return client[_0xfc4c('0x11')](_0x2b188d,_0x5b83cc)[_0xfc4c('0x12')](function(_0x243db7){logger[_0xfc4c('0x13')](_0xfc4c('0x14'),_0x39f9ed,_0xfc4c('0x15'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x39f9ed,_0xfc4c('0x15'),JSON[_0xfc4c('0x16')](_0x243db7));if(_0x243db7[_0xfc4c('0x17')]){if(_0x243db7[_0xfc4c('0x17')][_0xfc4c('0x18')]===0x1f4){logger[_0xfc4c('0x17')](_0xfc4c('0x14'),_0x39f9ed,_0x243db7[_0xfc4c('0x17')][_0xfc4c('0x19')]);return _0x57fbcf(_0x243db7[_0xfc4c('0x17')][_0xfc4c('0x19')]);}logger[_0xfc4c('0x17')](_0xfc4c('0x14'),_0x39f9ed,_0x243db7[_0xfc4c('0x17')][_0xfc4c('0x19')]);return _0x523a54(_0x243db7[_0xfc4c('0x17')][_0xfc4c('0x19')]);}else{logger[_0xfc4c('0x13')](_0xfc4c('0x14'),_0x39f9ed,_0xfc4c('0x15'));_0x523a54(_0x243db7['result']['message']);}})[_0xfc4c('0x1a')](function(_0x539ef5){logger[_0xfc4c('0x17')](_0xfc4c('0x14'),_0x39f9ed,_0x539ef5);_0x57fbcf(_0x539ef5);});});}exports[_0xfc4c('0x1b')]=function(_0x208caf){var _0x3af23c=this;return new Promise(function(_0xf80d8f,_0x33c677){return db[_0xfc4c('0x1c')][_0xfc4c('0x1d')]({'raw':_0x208caf[_0xfc4c('0x1e')]?_0x208caf[_0xfc4c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x208caf[_0xfc4c('0x1e')]?_0x208caf[_0xfc4c('0x1e')][_0xfc4c('0x1f')]||null:null,'attributes':_0x208caf[_0xfc4c('0x1e')]?_0x208caf[_0xfc4c('0x1e')]['attributes']||null:null,'include':_0x208caf['options']?_0x208caf[_0xfc4c('0x1e')][_0xfc4c('0x20')]?_[_0xfc4c('0x21')](_0x208caf[_0xfc4c('0x1e')][_0xfc4c('0x20')],function(_0x40c215){return{'model':db[_0x40c215[_0xfc4c('0x22')]],'as':_0x40c215['as'],'attributes':_0x40c215[_0xfc4c('0x23')],'include':_0x40c215[_0xfc4c('0x20')]?_[_0xfc4c('0x21')](_0x40c215['include'],function(_0x4d342f){return{'model':db[_0x4d342f['model']],'as':_0x4d342f['as'],'attributes':_0x4d342f[_0xfc4c('0x23')],'include':_0x4d342f['include']?_['map'](_0x4d342f[_0xfc4c('0x20')],function(_0x566011){return{'model':db[_0x566011[_0xfc4c('0x22')]],'as':_0x566011['as'],'attributes':_0x566011[_0xfc4c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfc4c('0x12')](function(_0x599960){logger[_0xfc4c('0x13')]('ShowWhatsappAccount',_0x208caf);logger[_0xfc4c('0x24')]('ShowWhatsappAccount',_0x208caf,JSON[_0xfc4c('0x16')](_0x599960));_0xf80d8f(_0x599960);})[_0xfc4c('0x1a')](function(_0x161f2e){logger[_0xfc4c('0x17')](_0xfc4c('0x1b'),_0x161f2e[_0xfc4c('0x19')],_0x208caf);_0x33c677(_0x3af23c['error'](0x1f4,_0x161f2e[_0xfc4c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index cefcb02..5e5257d 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 _0xb3ca=['whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register','length'];(function(_0x296bf1,_0x5a9279){var _0x5adc7a=function(_0x267813){while(--_0x267813){_0x296bf1['push'](_0x296bf1['shift']());}};_0x5adc7a(++_0x5a9279);}(_0xb3ca,0x151));var _0xab3c=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0xb3ca[_0x340e24];return _0x1808a;};'use strict';var WhatsappAccountEvents=require(_0xab3c('0x0'));var events=[_0xab3c('0x1'),_0xab3c('0x2'),_0xab3c('0x3')];function createListener(_0x1206ed,_0x1d46ae){return function(_0xd02338){_0x1d46ae['emit'](_0x1206ed,_0xd02338);};}function removeListener(_0x4e9e96,_0x1c1abe){return function(){WhatsappAccountEvents[_0xab3c('0x4')](_0x4e9e96,_0x1c1abe);};}exports[_0xab3c('0x5')]=function(_0x2621a4){for(var _0xa1c504=0x0,_0x35c1a3=events[_0xab3c('0x6')];_0xa1c504<_0x35c1a3;_0xa1c504++){var _0x73fe6f=events[_0xa1c504];var _0x1cff1b=createListener(_0xab3c('0x7')+_0x73fe6f,_0x2621a4);WhatsappAccountEvents['on'](_0x73fe6f,_0x1cff1b);}}; \ No newline at end of file +var _0x224e=['save','remove','update','removeListener','register','length','./whatsappAccount.events'];(function(_0x3eafd8,_0x1dc4f5){var _0x219db7=function(_0x10c912){while(--_0x10c912){_0x3eafd8['push'](_0x3eafd8['shift']());}};_0x219db7(++_0x1dc4f5);}(_0x224e,0xfb));var _0xe224=function(_0x5d0baf,_0x3abb6d){_0x5d0baf=_0x5d0baf-0x0;var _0x225ff8=_0x224e[_0x5d0baf];return _0x225ff8;};'use strict';var WhatsappAccountEvents=require(_0xe224('0x0'));var events=[_0xe224('0x1'),_0xe224('0x2'),_0xe224('0x3')];function createListener(_0x309e1a,_0x328b2d){return function(_0x1424bd){_0x328b2d['emit'](_0x309e1a,_0x1424bd);};}function removeListener(_0x52808b,_0xc5ed7d){return function(){WhatsappAccountEvents[_0xe224('0x4')](_0x52808b,_0xc5ed7d);};}exports[_0xe224('0x5')]=function(_0x717b56){for(var _0x5064bb=0x0,_0x2903e3=events[_0xe224('0x6')];_0x5064bb<_0x2903e3;_0x5064bb++){var _0x15303d=events[_0x5064bb];var _0x4d7c64=createListener('whatsappAccount:'+_0x15303d,_0x717b56);WhatsappAccountEvents['on'](_0x15303d,_0x4d7c64);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ae4b4e4..ffd63f8 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 _0x0c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x4a0f5a,_0xaa4371){var _0x5435ef=function(_0x563b9f){while(--_0x563b9f){_0x4a0f5a['push'](_0x4a0f5a['shift']());}};_0x5435ef(++_0xaa4371);}(_0x0c3c,0x199));var _0xc0c3=function(_0x1cee55,_0xe75188){_0x1cee55=_0x1cee55-0x0;var _0x4f640a=_0x0c3c[_0x1cee55];return _0x4f640a;};'use strict';var multer=require(_0xc0c3('0x0'));var util=require('util');var path=require(_0xc0c3('0x1'));var timeout=require(_0xc0c3('0x2'));var express=require(_0xc0c3('0x3'));var router=express['Router']();var fs_extra=require(_0xc0c3('0x4'));var auth=require(_0xc0c3('0x5'));var interaction=require(_0xc0c3('0x6'));var config=require(_0xc0c3('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc0c3('0x8')]('/',auth[_0xc0c3('0x9')](),controller[_0xc0c3('0xa')]);router[_0xc0c3('0x8')](_0xc0c3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc0c3('0xc')]('/',auth[_0xc0c3('0x9')](),controller[_0xc0c3('0xd')]);router[_0xc0c3('0xe')](_0xc0c3('0xb'),auth[_0xc0c3('0x9')](),controller['update']);router[_0xc0c3('0xf')](_0xc0c3('0xb'),auth[_0xc0c3('0x9')](),controller[_0xc0c3('0x10')]);module[_0xc0c3('0x11')]=router; \ No newline at end of file +var _0xa06a=['isAuthenticated','show','post','create','put','/:id','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xa06a,0x98));var _0xaa06=function(_0x19ebfa,_0x248cd6){_0x19ebfa=_0x19ebfa-0x0;var _0x23c43e=_0xa06a[_0x19ebfa];return _0x23c43e;};'use strict';var multer=require(_0xaa06('0x0'));var util=require(_0xaa06('0x1'));var path=require('path');var timeout=require(_0xaa06('0x2'));var express=require('express');var router=express[_0xaa06('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa06('0x4'));var interaction=require(_0xaa06('0x5'));var config=require('../../config/environment');var controller=require(_0xaa06('0x6'));router[_0xaa06('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaa06('0x7')]('/:id',auth[_0xaa06('0x8')](),controller[_0xaa06('0x9')]);router[_0xaa06('0xa')]('/',auth[_0xaa06('0x8')](),controller[_0xaa06('0xb')]);router[_0xaa06('0xc')](_0xaa06('0xd'),auth[_0xaa06('0x8')](),controller[_0xaa06('0xe')]);router['delete'](_0xaa06('0xd'),auth[_0xaa06('0x8')](),controller[_0xaa06('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7ea8cf7..dd5ffd1 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 _0xd661=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x401a73,_0x222281){var _0x548283=function(_0x2bd35c){while(--_0x2bd35c){_0x401a73['push'](_0x401a73['shift']());}};_0x548283(++_0x222281);}(_0xd661,0x13a));var _0x1d66=function(_0x15c679,_0x402cc0){_0x15c679=_0x15c679-0x0;var _0x152d42=_0xd661[_0x15c679];return _0x152d42;};'use strict';var Sequelize=require(_0x1d66('0x0'));module[_0x1d66('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1d66('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1d66('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1d66('0x2')],'defaultValue':_0x1d66('0x4')}}; \ No newline at end of file +var _0x2a18=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x14bff0,_0x247766){var _0x21dc67=function(_0x229bc6){while(--_0x229bc6){_0x14bff0['push'](_0x14bff0['shift']());}};_0x21dc67(++_0x247766);}(_0x2a18,0x192));var _0x82a1=function(_0x7440e0,_0x42d9b8){_0x7440e0=_0x7440e0-0x0;var _0x33ee99=_0x2a18[_0x7440e0];return _0x33ee99;};'use strict';var Sequelize=require(_0x82a1('0x0'));module[_0x82a1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x82a1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x82a1('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x82a1('0x2')],'defaultValue':_0x82a1('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2c5ac1a..4c0ebc1 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 _0xbd0a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','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/logger','../../config/utils'];(function(_0x4ca5d4,_0x25e0e){var _0x44798a=function(_0x4abf1c){while(--_0x4abf1c){_0x4ca5d4['push'](_0x4ca5d4['shift']());}};_0x44798a(++_0x25e0e);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x571560,_0x588a19){_0x571560=_0x571560-0x0;var _0x1dce89=_0xbd0a[_0x571560];return _0x1dce89;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];function respondWithStatusCode(_0x3bf33,_0xd66d68){_0xd66d68=_0xd66d68||0xcc;return function(_0x5b0f34){if(_0x5b0f34){return _0x3bf33[_0xabd0('0x18')](_0xd66d68);}return _0x3bf33['status'](_0xd66d68)[_0xabd0('0x19')]();};}function respondWithResult(_0x145f76,_0x5ceb94){_0x5ceb94=_0x5ceb94||0xc8;return function(_0x56ba31){if(_0x56ba31){return _0x145f76['status'](_0x5ceb94)['json'](_0x56ba31);}};}function respondWithFilteredResult(_0x679d0b,_0x26d8fd){return function(_0x97f4ec){if(_0x97f4ec){var _0xdb7a40=typeof _0x26d8fd[_0xabd0('0x1a')]===_0xabd0('0x1b')&&typeof _0x26d8fd[_0xabd0('0x1c')]===_0xabd0('0x1b');var _0x2d17b1=_0x97f4ec['count'];var _0x3a0ace=_0xdb7a40?0x0:_0x26d8fd['offset'];var _0x579dcd=_0xdb7a40?_0x97f4ec[_0xabd0('0x1d')]:_0x26d8fd[_0xabd0('0x1a')]+_0x26d8fd[_0xabd0('0x1c')];var _0x23f955;if(_0x579dcd>=_0x2d17b1){_0x579dcd=_0x2d17b1;_0x23f955=0xc8;}else{_0x23f955=0xce;}_0x679d0b['status'](_0x23f955);return _0x679d0b[_0xabd0('0x1e')](_0xabd0('0x1f'),_0x3a0ace+'-'+_0x579dcd+'/'+_0x2d17b1)['json'](_0x97f4ec);}return null;};}function patchUpdates(_0x56c2f5){return function(_0x1c955e){try{jsonpatch[_0xabd0('0x20')](_0x1c955e,_0x56c2f5,!![]);}catch(_0x4d9416){return BPromise[_0xabd0('0x21')](_0x4d9416);}return _0x1c955e[_0xabd0('0x22')]();};}function saveUpdates(_0xa1ebf,_0x1e077e){return function(_0x4c9f3a){if(_0x4c9f3a){return _0x4c9f3a[_0xabd0('0x23')](_0xa1ebf)[_0xabd0('0x24')](function(_0x3376bc){return _0x3376bc;});}return null;};}function removeEntity(_0x462420,_0x264167){return function(_0xf6dbad){if(_0xf6dbad){return _0xf6dbad[_0xabd0('0x25')]()[_0xabd0('0x24')](function(){_0x462420[_0xabd0('0x26')](0xcc)[_0xabd0('0x19')]();});}};}function handleEntityNotFound(_0x52c8be,_0x369dd0){return function(_0x2699c4){if(!_0x2699c4){_0x52c8be[_0xabd0('0x18')](0x194);}return _0x2699c4;};}function handleError(_0x3e0dd2,_0x31b869){_0x31b869=_0x31b869||0x1f4;return function(_0x399996){logger[_0xabd0('0x27')](_0x399996[_0xabd0('0x28')]);if(_0x399996[_0xabd0('0x29')]){delete _0x399996[_0xabd0('0x29')];}_0x3e0dd2[_0xabd0('0x26')](_0x31b869)[_0xabd0('0x2a')](_0x399996);};}exports[_0xabd0('0x2b')]=function(_0x3246de,_0x1fe955){var _0x15096f={},_0x5427a0={},_0x1c0d90={'count':0x0,'rows':[]};var _0x2d4c55=_[_0xabd0('0x2c')](db[_0xabd0('0x2d')]['rawAttributes'],function(_0x1ef94b){return{'name':_0x1ef94b[_0xabd0('0x2e')],'type':_0x1ef94b[_0xabd0('0x2f')]['key']};});_0x5427a0[_0xabd0('0x30')]=_[_0xabd0('0x2c')](_0x2d4c55,'name');_0x5427a0[_0xabd0('0x31')]=_['keys'](_0x3246de[_0xabd0('0x31')]);_0x5427a0[_0xabd0('0x32')]=_[_0xabd0('0x33')](_0x5427a0[_0xabd0('0x30')],_0x5427a0[_0xabd0('0x31')]);_0x15096f[_0xabd0('0x34')]=_['intersection'](_0x5427a0[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x3246de[_0xabd0('0x31')][_0xabd0('0x35')]));_0x15096f[_0xabd0('0x34')]=_0x15096f[_0xabd0('0x34')][_0xabd0('0x36')]?_0x15096f[_0xabd0('0x34')]:_0x5427a0[_0xabd0('0x30')];if(!_0x3246de[_0xabd0('0x31')][_0xabd0('0x37')](_0xabd0('0x38'))){_0x15096f[_0xabd0('0x1c')]=qs[_0xabd0('0x1c')](_0x3246de[_0xabd0('0x31')]['limit']);_0x15096f['offset']=qs['offset'](_0x3246de[_0xabd0('0x31')][_0xabd0('0x1a')]);}_0x15096f[_0xabd0('0x39')]=qs[_0xabd0('0x3a')](_0x3246de[_0xabd0('0x31')]['sort']);_0x15096f['where']=qs['filters'](_[_0xabd0('0x3b')](_0x3246de['query'],_0x5427a0[_0xabd0('0x32')]),_0x2d4c55);if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]){_0x15096f[_0xabd0('0x3d')]=_[_0xabd0('0x3e')](_0x15096f[_0xabd0('0x3d')],{'$or':_[_0xabd0('0x2c')](_0x2d4c55,function(_0x42e86e){if(_0x42e86e['type']!==_0xabd0('0x3f')){var _0x592de0={};_0x592de0[_0x42e86e['name']]={'$like':'%'+_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]+'%'};return _0x592de0;}})});}_0x15096f=_[_0xabd0('0x3e')]({},_0x15096f,_0x3246de[_0xabd0('0x40')]);var _0x1b8687={'where':_0x15096f['where']};return db[_0xabd0('0x2d')][_0xabd0('0x1d')](_0x1b8687)[_0xabd0('0x24')](function(_0x2e0bdf){_0x1c0d90['count']=_0x2e0bdf;if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x41')]){_0x15096f[_0xabd0('0x42')]=[{'all':!![]}];}return db[_0xabd0('0x2d')][_0xabd0('0x43')](_0x15096f);})[_0xabd0('0x24')](function(_0x2aa5a9){_0x1c0d90[_0xabd0('0x44')]=_0x2aa5a9;return _0x1c0d90;})[_0xabd0('0x24')](respondWithFilteredResult(_0x1fe955,_0x15096f))[_0xabd0('0x45')](handleError(_0x1fe955,null));};exports[_0xabd0('0x46')]=function(_0x975bbe,_0x237a33){var _0x514ea3={'raw':!![],'where':{'id':_0x975bbe[_0xabd0('0x47')]['id']}},_0x2ba135={};_0x2ba135[_0xabd0('0x30')]=_['keys'](db['WhatsappApplication'][_0xabd0('0x48')]);_0x2ba135[_0xabd0('0x31')]=_[_0xabd0('0x49')](_0x975bbe[_0xabd0('0x31')]);_0x2ba135[_0xabd0('0x32')]=_['intersection'](_0x2ba135['model'],_0x2ba135[_0xabd0('0x31')]);_0x514ea3[_0xabd0('0x34')]=_[_0xabd0('0x33')](_0x2ba135[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x975bbe['query'][_0xabd0('0x35')]));_0x514ea3[_0xabd0('0x34')]=_0x514ea3[_0xabd0('0x34')]['length']?_0x514ea3[_0xabd0('0x34')]:_0x2ba135[_0xabd0('0x30')];if(_0x975bbe[_0xabd0('0x31')][_0xabd0('0x41')]){_0x514ea3['include']=[{'all':!![]}];}_0x514ea3=_[_0xabd0('0x3e')]({},_0x514ea3,_0x975bbe[_0xabd0('0x40')]);return db[_0xabd0('0x2d')][_0xabd0('0x4a')](_0x514ea3)['then'](handleEntityNotFound(_0x237a33,null))[_0xabd0('0x24')](respondWithResult(_0x237a33,null))[_0xabd0('0x45')](handleError(_0x237a33,null));};exports[_0xabd0('0x4b')]=function(_0xc80459,_0x2a1069){return db[_0xabd0('0x2d')]['create'](_0xc80459['body'],{})[_0xabd0('0x24')](respondWithResult(_0x2a1069,0xc9))['catch'](handleError(_0x2a1069,null));};exports['update']=function(_0x2293bd,_0x1610d9){if(_0x2293bd[_0xabd0('0x4c')]['id']){delete _0x2293bd[_0xabd0('0x4c')]['id'];}return db['WhatsappApplication'][_0xabd0('0x4a')]({'where':{'id':_0x2293bd[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x1610d9,null))[_0xabd0('0x24')](saveUpdates(_0x2293bd['body'],null))['then'](respondWithResult(_0x1610d9,null))[_0xabd0('0x45')](handleError(_0x1610d9,null));};exports[_0xabd0('0x25')]=function(_0x16dd64,_0x32a5c9){return db[_0xabd0('0x2d')][_0xabd0('0x4a')]({'where':{'id':_0x16dd64[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x32a5c9,null))[_0xabd0('0x24')](removeEntity(_0x32a5c9,null))['catch'](handleError(_0x32a5c9,null));}; \ No newline at end of file +var _0xda2d=['then','destroy','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','filters','fields','query','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update'];(function(_0x19726f,_0x49e0eb){var _0x23c58c=function(_0x35f0ca){while(--_0x35f0ca){_0x19726f['push'](_0x19726f['shift']());}};_0x23c58c(++_0x49e0eb);}(_0xda2d,0x102));var _0xdda2=function(_0x2eb014,_0x4ed6e0){_0x2eb014=_0x2eb014-0x0;var _0x20f5f9=_0xda2d[_0x2eb014];return _0x20f5f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){_0x144f1e['status'](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x4be5ea,_0x2391a5){return function(_0x31d48b){if(!_0x31d48b){_0x4be5ea['sendStatus'](0x194);}return _0x31d48b;};}function handleError(_0x4e97dc,_0x28da54){_0x28da54=_0x28da54||0x1f4;return function(_0x4567e7){logger[_0xdda2('0x28')](_0x4567e7['stack']);if(_0x4567e7[_0xdda2('0x29')]){delete _0x4567e7[_0xdda2('0x29')];}_0x4e97dc[_0xdda2('0x1a')](_0x28da54)[_0xdda2('0x2a')](_0x4567e7);};}exports[_0xdda2('0x2b')]=function(_0x91b41a,_0x4bb8a4){var _0x24c37d={},_0x255bbc={},_0x53acb5={'count':0x0,'rows':[]};var _0x45e800=_[_0xdda2('0x2c')](db[_0xdda2('0x2d')][_0xdda2('0x2e')],function(_0x5540e5){return{'name':_0x5540e5[_0xdda2('0x2f')],'type':_0x5540e5[_0xdda2('0x30')]['key']};});_0x255bbc[_0xdda2('0x31')]=_['map'](_0x45e800,_0xdda2('0x29'));_0x255bbc['query']=_['keys'](_0x91b41a['query']);_0x255bbc[_0xdda2('0x32')]=_['intersection'](_0x255bbc[_0xdda2('0x31')],_0x255bbc['query']);_0x24c37d['attributes']=_['intersection'](_0x255bbc[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x33')]));_0x24c37d[_0xdda2('0x35')]=_0x24c37d[_0xdda2('0x35')][_0xdda2('0x36')]?_0x24c37d[_0xdda2('0x35')]:_0x255bbc[_0xdda2('0x31')];if(!_0x91b41a[_0xdda2('0x34')]['hasOwnProperty'](_0xdda2('0x37'))){_0x24c37d[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x1f')]);_0x24c37d[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x91b41a['query']['offset']);}_0x24c37d[_0xdda2('0x38')]=qs[_0xdda2('0x39')](_0x91b41a[_0xdda2('0x34')]['sort']);_0x24c37d['where']=qs[_0xdda2('0x32')](_[_0xdda2('0x3a')](_0x91b41a[_0xdda2('0x34')],_0x255bbc[_0xdda2('0x32')]),_0x45e800);if(_0x91b41a[_0xdda2('0x34')]['filter']){_0x24c37d[_0xdda2('0x3b')]=_[_0xdda2('0x3c')](_0x24c37d['where'],{'$or':_['map'](_0x45e800,function(_0x98bf47){if(_0x98bf47[_0xdda2('0x30')]!==_0xdda2('0x3d')){var _0x2708f4={};_0x2708f4[_0x98bf47[_0xdda2('0x29')]]={'$like':'%'+_0x91b41a['query'][_0xdda2('0x3e')]+'%'};return _0x2708f4;}})});}_0x24c37d=_[_0xdda2('0x3c')]({},_0x24c37d,_0x91b41a[_0xdda2('0x3f')]);var _0x1a7262={'where':_0x24c37d['where']};return db['WhatsappApplication'][_0xdda2('0x1e')](_0x1a7262)[_0xdda2('0x26')](function(_0x7a25fe){_0x53acb5['count']=_0x7a25fe;if(_0x91b41a[_0xdda2('0x34')]['includeAll']){_0x24c37d[_0xdda2('0x40')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xdda2('0x41')](_0x24c37d);})[_0xdda2('0x26')](function(_0x1db762){_0x53acb5[_0xdda2('0x42')]=_0x1db762;return _0x53acb5;})['then'](respondWithFilteredResult(_0x4bb8a4,_0x24c37d))[_0xdda2('0x43')](handleError(_0x4bb8a4,null));};exports['show']=function(_0x392f70,_0x4d3b78){var _0x1d1678={'raw':!![],'where':{'id':_0x392f70[_0xdda2('0x44')]['id']}},_0x12589b={};_0x12589b[_0xdda2('0x31')]=_[_0xdda2('0x45')](db['WhatsappApplication'][_0xdda2('0x2e')]);_0x12589b[_0xdda2('0x34')]=_['keys'](_0x392f70[_0xdda2('0x34')]);_0x12589b['filters']=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],_0x12589b[_0xdda2('0x34')]);_0x1d1678[_0xdda2('0x35')]=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x392f70[_0xdda2('0x34')][_0xdda2('0x33')]));_0x1d1678[_0xdda2('0x35')]=_0x1d1678[_0xdda2('0x35')][_0xdda2('0x36')]?_0x1d1678[_0xdda2('0x35')]:_0x12589b['model'];if(_0x392f70['query']['includeAll']){_0x1d1678[_0xdda2('0x40')]=[{'all':!![]}];}_0x1d1678=_[_0xdda2('0x3c')]({},_0x1d1678,_0x392f70['options']);return db[_0xdda2('0x2d')][_0xdda2('0x47')](_0x1d1678)[_0xdda2('0x26')](handleEntityNotFound(_0x4d3b78,null))['then'](respondWithResult(_0x4d3b78,null))[_0xdda2('0x43')](handleError(_0x4d3b78,null));};exports[_0xdda2('0x48')]=function(_0x4eada0,_0x5f0aa8){return db[_0xdda2('0x2d')]['create'](_0x4eada0[_0xdda2('0x49')],{})['then'](respondWithResult(_0x5f0aa8,0xc9))[_0xdda2('0x43')](handleError(_0x5f0aa8,null));};exports[_0xdda2('0x25')]=function(_0x50bd88,_0x585665){if(_0x50bd88[_0xdda2('0x49')]['id']){delete _0x50bd88[_0xdda2('0x49')]['id'];}return db[_0xdda2('0x2d')][_0xdda2('0x47')]({'where':{'id':_0x50bd88['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x585665,null))[_0xdda2('0x26')](saveUpdates(_0x50bd88[_0xdda2('0x49')],null))[_0xdda2('0x26')](respondWithResult(_0x585665,null))[_0xdda2('0x43')](handleError(_0x585665,null));};exports['destroy']=function(_0x1a56cc,_0x40b610){return db['WhatsappApplication'][_0xdda2('0x47')]({'where':{'id':_0x1a56cc[_0xdda2('0x44')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x40b610,null))[_0xdda2('0x26')](removeEntity(_0x40b610,null))[_0xdda2('0x43')](handleError(_0x40b610,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d151b09..7229d10 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 _0x4006=['../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','api','moment','path'];(function(_0x152aa4,_0x512cdb){var _0x227143=function(_0xbf99e0){while(--_0xbf99e0){_0x152aa4['push'](_0x152aa4['shift']());}};_0x227143(++_0x512cdb);}(_0x4006,0x1c7));var _0x6400=function(_0x5a3975,_0x19d772){_0x5a3975=_0x5a3975-0x0;var _0x5ef02d=_0x4006[_0x5a3975];return _0x5ef02d;};'use strict';var _=require('lodash');var util=require(_0x6400('0x0'));var logger=require(_0x6400('0x1'))(_0x6400('0x2'));var moment=require(_0x6400('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6400('0x4'));var rimraf=require('rimraf');var config=require(_0x6400('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x2dbd03,_0x599e6f){return _0x2dbd03[_0x6400('0x6')](_0x6400('0x7'),attributes,{'tableName':_0x6400('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6400('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfd0f=['api','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x16a5af,_0x3f3735){_0x16a5af=_0x16a5af-0x0;var _0x26bcb9=_0xfd0f[_0x16a5af];return _0x26bcb9;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var logger=require('../../config/logger')(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd0('0x5'));var rimraf=require('rimraf');var config=require(_0xffd0('0x6'));var attributes=require(_0xffd0('0x7'));module[_0xffd0('0x8')]=function(_0x9e9c1f,_0xd7f075){return _0x9e9c1f[_0xffd0('0x9')](_0xffd0('0xa'),attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffd0('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 6880e8b..a1f8280 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['code','message','WhatsappApplication,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4b141e,_0x18f608){var _0x21c384=function(_0x20eb14){while(--_0x20eb14){_0x4b141e['push'](_0x4b141e['shift']());}};_0x21c384(++_0x18f608);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4dfbfe,_0x80b6cc){_0x4dfbfe=_0x4dfbfe-0x0;var _0xca1fda=_0x9bde[_0x4dfbfe];return _0xca1fda;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x5c12=['../../config/environment','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x5c12,0x188));var _0x25c1=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x5c12[_0x4aa4e6];return _0x322588;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b6ca29b..366826c 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 _0x7217=['/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsappinteraction:addtags','addTags','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2a3552,_0x187b2f){var _0x3e81a5=function(_0x234fbc){while(--_0x234fbc){_0x2a3552['push'](_0x2a3552['shift']());}};_0x3e81a5(++_0x187b2f);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0x14')]);router['post'](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addMessage']);router[_0x7721('0x13')](_0x7721('0x15'),auth[_0x7721('0x9')](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x17')),controller[_0x7721('0x18')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x7721('0x16')](_0x7721('0x19'),_0x7721('0x1a')),controller[_0x7721('0x1b')]);router['delete'](_0x7721('0xd'),auth['isAuthenticated'](),interaction[_0x7721('0x16')]('whatsapp',_0x7721('0x1c')),controller[_0x7721('0x1d')]);router[_0x7721('0x1e')](_0x7721('0x15'),auth[_0x7721('0x9')](),controller[_0x7721('0x1f')]);module[_0x7721('0x20')]=router; \ No newline at end of file +var _0xc6ac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','exports','multer','util','path'];(function(_0x158a9d,_0x56a43f){var _0x171f22=function(_0x38c024){while(--_0x38c024){_0x158a9d['push'](_0x158a9d['shift']());}};_0x171f22(++_0x56a43f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5ad437,_0xe5ea54){_0x5ad437=_0x5ad437-0x0;var _0x1fa50f=_0xc6ac[_0x5ad437];return _0x1fa50f;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0xb')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0xb')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);router[_0xcc6a('0x16')]('/',auth[_0xcc6a('0xc')](),controller['create']);router['post'](_0xcc6a('0x12'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x17')]);router['post']('/:id/tags',auth[_0xcc6a('0xc')](),interaction[_0xcc6a('0x18')](_0xcc6a('0x19'),_0xcc6a('0x1a')),controller[_0xcc6a('0x1b')]);router[_0xcc6a('0x1c')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),interaction['tracked']('whatsapp','whatsappinteraction:update'),controller[_0xcc6a('0x1d')]);router[_0xcc6a('0x1e')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),interaction[_0xcc6a('0x18')](_0xcc6a('0x19'),_0xcc6a('0x1f')),controller[_0xcc6a('0x20')]);router[_0xcc6a('0x1e')](_0xcc6a('0x21'),auth[_0xcc6a('0xc')](),controller['removeTags']);module[_0xcc6a('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 520eec5..839e1e3 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 _0x1939=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x5b9807,_0x1b828a){var _0x32ca53=function(_0x5194e4){while(--_0x5194e4){_0x5b9807['push'](_0x5b9807['shift']());}};_0x32ca53(++_0x1b828a);}(_0x1939,0x1d1));var _0x9193=function(_0xbbfe59,_0x46067f){_0xbbfe59=_0xbbfe59-0x0;var _0x28a2a4=_0x1939[_0xbbfe59];return _0x28a2a4;};'use strict';var Sequelize=require(_0x9193('0x0'));var moment=require('moment');module[_0x9193('0x1')]={'closed':{'type':Sequelize[_0x9193('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9193('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9193('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9193('0x4')]},'note':{'type':Sequelize[_0x9193('0x4')]},'phone':{'type':Sequelize[_0x9193('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9193('0x5')]('in',_0x9193('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9193('0x5')]('in',_0x9193('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9193('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc7a3=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x18bc92,_0x343c18){_0x18bc92=_0x18bc92-0x0;var _0xaea17f=_0xc7a3[_0x18bc92];return _0xaea17f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c7a('0x0'));module[_0x3c7a('0x1')]={'closed':{'type':Sequelize[_0x3c7a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3c7a('0x3')]},'disposition':{'type':Sequelize[_0x3c7a('0x4')]},'secondDisposition':{'type':Sequelize[_0x3c7a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3c7a('0x4')]},'phone':{'type':Sequelize[_0x3c7a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3c7a('0x5')]('in',_0x3c7a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3c7a('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3c7a('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 3bb960a..91dc304 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 _0xb7a0=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','undefined','limit','offset','status','set','Content-Range','json','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','getOptions','whatsapp','query','catch','show','params','model','WhatsappInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','WhatsappMessage','addMessage','getMessages','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','setTags','ids','omit','spread','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','N.A.','toString','closed','closedAt','disposition','existsSync','createReadStream','pipe','basename','out','System','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger'];(function(_0x1ca30d,_0x4591cf){var _0x363c58=function(_0x2184e7){while(--_0x2184e7){_0x1ca30d['push'](_0x1ca30d['shift']());}};_0x363c58(++_0x4591cf);}(_0xb7a0,0xfa));var _0x0b7a=function(_0x3162f7,_0x55e9b4){_0x3162f7=_0x3162f7-0x0;var _0x1098bb=_0xb7a0[_0x3162f7];return _0x1098bb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0b7a('0x0'));var moment=require(_0x0b7a('0x1'));var BPromise=require(_0x0b7a('0x2'));var util=require(_0x0b7a('0x3'));var path=require(_0x0b7a('0x4'));var ejs=require(_0x0b7a('0x5'));var fs=require('fs');var _=require(_0x0b7a('0x6'));var Redis=require('ioredis');var interaction=require(_0x0b7a('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0b7a('0x8'));var logger=require(_0x0b7a('0x9'))('api');var config=require(_0x0b7a('0xa'));var db=require(_0x0b7a('0xb'))['db'];config[_0x0b7a('0xc')]=_['defaults'](config[_0x0b7a('0xc')],{'host':_0x0b7a('0xd'),'port':0x18eb});var socket=require(_0x0b7a('0xe'))(new Redis(config['redis']));require(_0x0b7a('0xf'))[_0x0b7a('0x10')](socket);function respondWithStatusCode(_0x388b6d,_0x99c7ef){_0x99c7ef=_0x99c7ef||0xcc;return function(_0x385949){if(_0x385949){return _0x388b6d[_0x0b7a('0x11')](_0x99c7ef);}return _0x388b6d['status'](_0x99c7ef)[_0x0b7a('0x12')]();};}function respondWithResult(_0x48fb98,_0x22aa2c){_0x22aa2c=_0x22aa2c||0xc8;return function(_0x42d483){if(_0x42d483){return _0x48fb98['status'](_0x22aa2c)['json'](_0x42d483);}};}function respondWithFilteredResult(_0x5d3d30,_0x3e5e59){return function(_0x79f0c){if(_0x79f0c){var _0x1ae858=typeof _0x3e5e59['offset']===_0x0b7a('0x13')&&typeof _0x3e5e59[_0x0b7a('0x14')]===_0x0b7a('0x13');var _0x462758=_0x79f0c['count'];var _0x2ea91c=_0x1ae858?0x0:_0x3e5e59['offset'];var _0x1bf5e9=_0x1ae858?_0x79f0c['count']:_0x3e5e59[_0x0b7a('0x15')]+_0x3e5e59['limit'];var _0x4b1f76;if(_0x1bf5e9>=_0x462758){_0x1bf5e9=_0x462758;_0x4b1f76=0xc8;}else{_0x4b1f76=0xce;}_0x5d3d30[_0x0b7a('0x16')](_0x4b1f76);return _0x5d3d30[_0x0b7a('0x17')](_0x0b7a('0x18'),_0x2ea91c+'-'+_0x1bf5e9+'/'+_0x462758)[_0x0b7a('0x19')](_0x79f0c);}return null;};}function saveUpdates(_0x4a2cd9){return function(_0x520a21){if(_0x520a21){return _0x520a21[_0x0b7a('0x1a')](_0x4a2cd9)[_0x0b7a('0x1b')](function(_0x5a00e8){return _0x5a00e8;});}return null;};}function removeEntity(_0xea0c9c){return function(_0x31e7c8){if(_0x31e7c8){return _0x31e7c8[_0x0b7a('0x1c')]()[_0x0b7a('0x1b')](function(){_0xea0c9c['status'](0xcc)[_0x0b7a('0x12')]();});}};}function handleEntityNotFound(_0x34b4ec){return function(_0x74665d){if(!_0x74665d){_0x34b4ec[_0x0b7a('0x11')](0x194);}return _0x74665d;};}function handleError(_0x4061a2,_0x4459f8){_0x4459f8=_0x4459f8||0x1f4;return function(_0x21b7ab){logger[_0x0b7a('0x1d')](_0x21b7ab[_0x0b7a('0x1e')]);if(_0x21b7ab[_0x0b7a('0x1f')]){delete _0x21b7ab[_0x0b7a('0x1f')];}_0x4061a2[_0x0b7a('0x16')](_0x4459f8)[_0x0b7a('0x20')](_0x21b7ab);};}exports['index']=function(_0x4c52ee,_0x1887cd){var _0x43ffcf={};var _0x2ba5d2=_[_0x0b7a('0x21')](db['WhatsappInteraction'][_0x0b7a('0x22')],function(_0x333288){return{'name':_0x333288['fieldName'],'type':_0x333288[_0x0b7a('0x23')][_0x0b7a('0x24')]};});_0x43ffcf=qs[_0x0b7a('0x25')](_0x2ba5d2,_0x4c52ee);return interaction['findAll'](_0x0b7a('0x26'),_0x4c52ee[_0x0b7a('0x27')],_0x4c52ee['user'],_0x43ffcf,_0x2ba5d2)[_0x0b7a('0x1b')](respondWithFilteredResult(_0x1887cd,_0x43ffcf))[_0x0b7a('0x28')](handleError(_0x1887cd,null));};exports[_0x0b7a('0x29')]=function(_0x23e043,_0x574041){var _0xbc081={'raw':![],'where':{'id':_0x23e043[_0x0b7a('0x2a')]['id']}},_0x1ae721={};_0x1ae721[_0x0b7a('0x2b')]=_['keys'](db[_0x0b7a('0x2c')]['rawAttributes']);_0x1ae721[_0x0b7a('0x27')]=_[_0x0b7a('0x2d')](_0x23e043['query']);_0x1ae721[_0x0b7a('0x2e')]=_[_0x0b7a('0x2f')](_0x1ae721[_0x0b7a('0x2b')],_0x1ae721['query']);_0xbc081[_0x0b7a('0x30')]=_['intersection'](_0x1ae721['model'],qs['fields'](_0x23e043[_0x0b7a('0x27')][_0x0b7a('0x31')]));_0xbc081[_0x0b7a('0x30')]=_0xbc081[_0x0b7a('0x30')][_0x0b7a('0x32')]?_0xbc081[_0x0b7a('0x30')]:_0x1ae721[_0x0b7a('0x2b')];if(_0x23e043[_0x0b7a('0x27')][_0x0b7a('0x33')]){_0xbc081[_0x0b7a('0x34')]=[{'all':!![]}];}_0xbc081=_[_0x0b7a('0x35')]({},_0xbc081,_0x23e043[_0x0b7a('0x36')]);return db['WhatsappInteraction'][_0x0b7a('0x37')](_0xbc081)['then'](handleEntityNotFound(_0x574041,null))['then'](respondWithResult(_0x574041,null))[_0x0b7a('0x28')](handleError(_0x574041,null));};exports[_0x0b7a('0x38')]=function(_0x4ed77a,_0x12bd1f){return db[_0x0b7a('0x2c')][_0x0b7a('0x38')](_0x4ed77a['body'],{})[_0x0b7a('0x1b')](respondWithResult(_0x12bd1f,0xc9))[_0x0b7a('0x28')](handleError(_0x12bd1f,null));};exports[_0x0b7a('0x1a')]=function(_0x496cf6,_0x24f4e6){if(_0x496cf6[_0x0b7a('0x39')]['id']){delete _0x496cf6['body']['id'];}return db[_0x0b7a('0x2c')]['find']({'where':{'id':_0x496cf6[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x24f4e6,null))[_0x0b7a('0x1b')](saveUpdates(_0x496cf6['body'],null))[_0x0b7a('0x1b')](respondWithResult(_0x24f4e6,null))[_0x0b7a('0x28')](handleError(_0x24f4e6,null));};exports[_0x0b7a('0x1c')]=function(_0x310dcb,_0xe966a7){return db['WhatsappInteraction']['find']({'where':{'id':_0x310dcb[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0xe966a7,null))[_0x0b7a('0x1b')](removeEntity(_0xe966a7,null))[_0x0b7a('0x28')](handleError(_0xe966a7,null));};exports[_0x0b7a('0x3a')]=function(_0x162aa5,_0x14ebcf){return db[_0x0b7a('0x2c')][_0x0b7a('0x3a')]()[_0x0b7a('0x1b')](respondWithResult(_0x14ebcf,null))['catch'](handleError(_0x14ebcf,null));};exports['addMessage']=function(_0x17ec0a,_0x26fe7c){return db[_0x0b7a('0x3b')]['find']({'where':{'id':_0x17ec0a[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x26fe7c,null))[_0x0b7a('0x1b')](function(_0x412b38){if(_0x412b38){return _0x412b38[_0x0b7a('0x3c')](_0x17ec0a[_0x0b7a('0x39')]['ids'],_['omit'](_0x17ec0a[_0x0b7a('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x26fe7c,null))['catch'](handleError(_0x26fe7c,null));};exports[_0x0b7a('0x3d')]=function(_0x41cd0d,_0x11a2ba){var _0x19bca5={'raw':![],'where':{}};var _0x1123df={};var _0x4ced91={'count':0x0,'rows':[]};return db[_0x0b7a('0x2c')]['findOne']({'where':{'id':_0x41cd0d[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x11a2ba,null))[_0x0b7a('0x1b')](function(_0x1b0605){if(_0x1b0605){_0x1123df[_0x0b7a('0x2b')]=_[_0x0b7a('0x2d')](db[_0x0b7a('0x3b')]['rawAttributes']);_0x1123df['query']=_[_0x0b7a('0x2d')](_0x41cd0d['query']);_0x1123df[_0x0b7a('0x2e')]=_[_0x0b7a('0x2f')](_0x1123df[_0x0b7a('0x2b')],_0x1123df[_0x0b7a('0x27')]);_0x19bca5[_0x0b7a('0x30')]=_[_0x0b7a('0x2f')](_0x1123df[_0x0b7a('0x2b')],qs['fields'](_0x41cd0d['query'][_0x0b7a('0x31')]));_0x19bca5[_0x0b7a('0x30')]=_0x19bca5[_0x0b7a('0x30')]['length']?_0x19bca5['attributes']:_0x1123df[_0x0b7a('0x2b')];if(!_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x3e')](_0x0b7a('0x3f'))){_0x19bca5['limit']=qs['limit'](_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x14')]);_0x19bca5['offset']=qs[_0x0b7a('0x15')](_0x41cd0d[_0x0b7a('0x27')]['offset']);}_0x19bca5['order']=qs[_0x0b7a('0x40')](_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x40')]);_0x19bca5[_0x0b7a('0x41')]=qs[_0x0b7a('0x2e')](_[_0x0b7a('0x42')](_0x41cd0d['query'],_0x1123df[_0x0b7a('0x2e')]));_0x19bca5[_0x0b7a('0x41')][_0x0b7a('0x43')]=_0x1b0605['id'];if(_0x41cd0d[_0x0b7a('0x27')]['filter']){_0x19bca5[_0x0b7a('0x41')]=_['merge'](_0x19bca5[_0x0b7a('0x41')],{'$or':_[_0x0b7a('0x21')](_0x19bca5[_0x0b7a('0x30')],function(_0x4c52a0){var _0x34b735={};_0x34b735[_0x4c52a0]={'$like':'%'+_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x44')]+'%'};return _0x34b735;})});}if(_0x41cd0d['query'][_0x0b7a('0x45')]){var _0x145166=_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x45')][_0x0b7a('0x46')](',');var _0x1da6bd={};_0x1da6bd[_0x145166[0x0]]={'$gte':moment(_0x145166[0x1])[_0x0b7a('0x47')](_0x0b7a('0x48'))};_0x19bca5['where']=_['merge'](_0x19bca5['where'],_0x1da6bd);}_0x19bca5=_[_0x0b7a('0x35')]({},_0x19bca5,_0x41cd0d[_0x0b7a('0x36')]);return db[_0x0b7a('0x3b')][_0x0b7a('0x49')]({'where':_0x19bca5[_0x0b7a('0x41')]})[_0x0b7a('0x1b')](function(_0x38cbf3){_0x4ced91['count']=_0x38cbf3;if(_0x41cd0d[_0x0b7a('0x27')][_0x0b7a('0x33')]){_0x19bca5[_0x0b7a('0x34')]=[{'all':!![]}];}return db[_0x0b7a('0x3b')]['findAll'](_0x19bca5);})[_0x0b7a('0x1b')](function(_0x14e919){_0x4ced91[_0x0b7a('0x4a')]=_0x14e919;return _0x4ced91;});}})[_0x0b7a('0x1b')](respondWithFilteredResult(_0x11a2ba,_0x19bca5))[_0x0b7a('0x28')](handleError(_0x11a2ba,null));};exports['addTags']=function(_0x33103d,_0x4050bd){return db[_0x0b7a('0x2c')][_0x0b7a('0x37')]({'where':{'id':_0x33103d[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x4050bd,null))[_0x0b7a('0x1b')](function(_0x373460){if(_0x373460){return _0x373460[_0x0b7a('0x4b')](_0x33103d['body'][_0x0b7a('0x4c')],_[_0x0b7a('0x4d')](_0x33103d['body'],['ids','id'])||{})[_0x0b7a('0x4e')](function(){return db[_0x0b7a('0x4f')][_0x0b7a('0x50')]({'attributes':['id',_0x0b7a('0x1f'),_0x0b7a('0x51')],'where':{'id':_0x33103d[_0x0b7a('0x39')][_0x0b7a('0x4c')]}});})[_0x0b7a('0x1b')](function(_0x45ee4e){socket[_0x0b7a('0x52')](_0x0b7a('0x53'),{'id':Number(_0x33103d[_0x0b7a('0x2a')]['id']),'tags':_0x45ee4e||[]});return{'id':Number(_0x33103d[_0x0b7a('0x2a')]['id']),'tags':_0x45ee4e||[]};});}})[_0x0b7a('0x1b')](respondWithResult(_0x4050bd,null))[_0x0b7a('0x28')](handleError(_0x4050bd,null));};exports[_0x0b7a('0x54')]=function(_0x115553,_0x36bacb){return db[_0x0b7a('0x2c')]['find']({'where':{'id':_0x115553[_0x0b7a('0x2a')]['id']}})[_0x0b7a('0x1b')](handleEntityNotFound(_0x36bacb,null))[_0x0b7a('0x1b')](function(_0x14c76d){if(_0x14c76d){return _0x14c76d[_0x0b7a('0x54')](_0x115553['query'][_0x0b7a('0x4c')]);}})[_0x0b7a('0x1b')](respondWithStatusCode(_0x36bacb,null))[_0x0b7a('0x28')](handleError(_0x36bacb,null));};exports[_0x0b7a('0x55')]=function(_0x2ba8f0,_0x278e06){var _0x9d5859=moment()[_0x0b7a('0x56')]()['toString']();var _0x3900e2=path[_0x0b7a('0x57')](config[_0x0b7a('0x58')],_0x0b7a('0x59'),_0x0b7a('0x5a'),_0x0b7a('0x5b'));var _0x1222ee=path[_0x0b7a('0x57')](config[_0x0b7a('0x58')],_0x0b7a('0x59'),_0x0b7a('0x5a'),_0x0b7a('0x5c'));var _0x553bf7=path[_0x0b7a('0x57')](_0x3900e2,_0x9d5859);var _0x38a8eb=util['format'](_0x0b7a('0x5d'),_0x2ba8f0[_0x0b7a('0x2a')]['id'],_0x9d5859);var _0x4c030d=path[_0x0b7a('0x57')](_0x3900e2,_0x38a8eb);var _0x3d1605=[];_0x3d1605[_0x0b7a('0x5e')]({'model':db['User'],'as':_0x0b7a('0x5f'),'attributes':['id',_0x0b7a('0x60')],'raw':!![]});_0x3d1605[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x61')],'as':_0x0b7a('0x62'),'attributes':['id',_0x0b7a('0x63'),_0x0b7a('0x64')],'raw':!![]});if(_0x2ba8f0[_0x0b7a('0x27')][_0x0b7a('0x5c')]){_0x3d1605[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x65')],'as':_0x0b7a('0x65'),'raw':!![]});}var _0x333c6b=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x0b7a('0x39'),_0x0b7a('0x66'),_0x0b7a('0x67'),'secret',_0x0b7a('0x68')],'include':_0x3d1605}];_0x333c6b[_0x0b7a('0x5e')]({'model':db[_0x0b7a('0x69')],'as':'Account','attributes':['id',_0x0b7a('0x1f')]});_0x333c6b[_0x0b7a('0x5e')]({'model':db['User'],'as':_0x0b7a('0x6a'),'attributes':['id','fullname']});return db[_0x0b7a('0x2c')][_0x0b7a('0x37')]({'where':{'id':_0x2ba8f0[_0x0b7a('0x2a')]['id']},'include':_0x333c6b})['then'](handleEntityNotFound(_0x278e06,null))[_0x0b7a('0x1b')](function(_0x29a237){if(_0x29a237){var _0x1f1dab=_0x29a237[_0x0b7a('0x6b')]({'plain':!![]});fs[_0x0b7a('0x6c')](_0x553bf7);var _0x4bb4ce={'channel':_0x0b7a('0x6d'),'account':_0x1f1dab['Account'][_0x0b7a('0x1f')],'agent':_0x1f1dab[_0x0b7a('0x6a')]?_0x1f1dab[_0x0b7a('0x6a')][_0x0b7a('0x60')]:_0x0b7a('0x6e'),'createdAt':moment(_0x1f1dab[_0x0b7a('0x66')])[_0x0b7a('0x47')](_0x0b7a('0x48'))[_0x0b7a('0x6f')](),'closedAt':_0x1f1dab[_0x0b7a('0x70')]?moment(_0x1f1dab[_0x0b7a('0x71')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0b7a('0x6f')]():'','disposition':_0x1f1dab[_0x0b7a('0x72')],'messages':_(_0x1f1dab['Messages'])[_0x0b7a('0x44')]({'secret':![]})[_0x0b7a('0x21')](function(_0x72a8f9){if(_0x72a8f9[_0x0b7a('0x65')]){var _0x238361=path[_0x0b7a('0x57')](_0x1222ee,_0x72a8f9[_0x0b7a('0x65')]['basename']);if(fs[_0x0b7a('0x73')](_0x238361)){fs[_0x0b7a('0x74')](_0x238361)[_0x0b7a('0x75')](fs['createWriteStream'](path['join'](_0x553bf7,_0x72a8f9[_0x0b7a('0x65')][_0x0b7a('0x76')])));}}return{'date':moment(_0x72a8f9[_0x0b7a('0x66')])[_0x0b7a('0x47')](_0x0b7a('0x48'))[_0x0b7a('0x6f')](),'sender':_0x72a8f9['direction']===_0x0b7a('0x77')?_0x72a8f9['User']?_0x72a8f9[_0x0b7a('0x5f')][_0x0b7a('0x60')]:_0x0b7a('0x78'):_0x72a8f9[_0x0b7a('0x62')][_0x0b7a('0x63')]+(_0x72a8f9[_0x0b7a('0x62')][_0x0b7a('0x64')]?'\x20'+_0x72a8f9['Contact']['lastName']:''),'body':_0x72a8f9[_0x0b7a('0x65')]?_0x72a8f9[_0x0b7a('0x65')][_0x0b7a('0x76')]:_0x72a8f9[_0x0b7a('0x39')],'direction':_0x72a8f9[_0x0b7a('0x67')]===_0x0b7a('0x77')?'A':'C','secret':_0x72a8f9[_0x0b7a('0x79')],'read':_0x72a8f9[_0x0b7a('0x68')],'attachment':_0x72a8f9[_0x0b7a('0x65')]};})['value']()};return ejs[_0x0b7a('0x7a')](path[_0x0b7a('0x57')](config['root'],_0x0b7a('0x59'),_0x0b7a('0x7b'),_0x0b7a('0x7c')),{'interaction':_0x4bb4ce})['then'](function(_0x2db810){var _0x15f6d5=path['join'](_0x553bf7,'transcript-'+_0x1f1dab['id']+'-'+_0x9d5859+_0x0b7a('0x7d'));var _0x215cba={'path':_0x15f6d5,'channel':_0x0b7a('0x6d'),'interactionId':_0x1f1dab['id']};return pdf[_0x0b7a('0x7e')](_0x2db810,_0x215cba);})[_0x0b7a('0x1b')](function(){return new BPromise(function(_0x532a5e,_0x4088fe){zipdir(_0x553bf7,{'saveTo':_0x4c030d},function(_0x245c9d,_0x556568){if(_0x245c9d)return _0x4088fe(_0x245c9d);return _0x532a5e(_0x556568);});})[_0x0b7a('0x1b')](function(){return new BPromise(function(_0x5b65a8,_0x5f3f05){rimraf(_0x553bf7,function(_0x23b7d8){if(_0x23b7d8)_0x5f3f05(_0x23b7d8);return _0x5b65a8();});});})[_0x0b7a('0x1b')](function(){return _0x278e06[_0x0b7a('0x55')](_0x4c030d,_0x38a8eb,function(_0x4b932c){if(_0x4b932c){console[_0x0b7a('0x7f')](_0x0b7a('0x80'),_0x4b932c);}else{fs[_0x0b7a('0x81')](_0x4c030d);}});});});}else{return _0x278e06[_0x0b7a('0x11')](0xc8);}})[_0x0b7a('0x28')](handleError(_0x278e06,null));}; \ No newline at end of file +var _0xe9b0=['unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','createdAt','YYYY-MM-DD\x20HH:mm:ss','toString','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','direction','out','System','lastName','value','renderFile','downloadInteraction.ejs','.pdf','log','unlinkSync','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','update','then','destroy','status','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','include','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download'];(function(_0x337d1b,_0x12571f){var _0x1bc03d=function(_0x20cfe9){while(--_0x20cfe9){_0x337d1b['push'](_0x337d1b['shift']());}};_0x1bc03d(++_0x12571f);}(_0xe9b0,0x123));var _0x0e9b=function(_0x23428f,_0x288620){_0x23428f=_0x23428f-0x0;var _0x4a1f23=_0xe9b0[_0x23428f];return _0x4a1f23;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x0e9b('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x0e9b('0x1'));var ejs=require(_0x0e9b('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0e9b('0x3'));var interaction=require(_0x0e9b('0x4'));var qs=require(_0x0e9b('0x5'));var pdf=require('../../components/export/pdf');var logger=require(_0x0e9b('0x6'))(_0x0e9b('0x7'));var config=require(_0x0e9b('0x8'));var db=require('../../mysqldb')['db'];config[_0x0e9b('0x9')]=_[_0x0e9b('0xa')](config[_0x0e9b('0x9')],{'host':_0x0e9b('0xb'),'port':0x18eb});var socket=require(_0x0e9b('0xc'))(new Redis(config[_0x0e9b('0x9')]));require(_0x0e9b('0xd'))[_0x0e9b('0xe')](socket);function respondWithStatusCode(_0x4b78c9,_0x518ac8){_0x518ac8=_0x518ac8||0xcc;return function(_0x3126c8){if(_0x3126c8){return _0x4b78c9[_0x0e9b('0xf')](_0x518ac8);}return _0x4b78c9['status'](_0x518ac8)[_0x0e9b('0x10')]();};}function respondWithResult(_0x3f9912,_0x1ddf6f){_0x1ddf6f=_0x1ddf6f||0xc8;return function(_0x1df5b6){if(_0x1df5b6){return _0x3f9912['status'](_0x1ddf6f)[_0x0e9b('0x11')](_0x1df5b6);}};}function respondWithFilteredResult(_0x2617bf,_0x57e936){return function(_0x15e303){if(_0x15e303){var _0xb3efcd=typeof _0x57e936[_0x0e9b('0x12')]===_0x0e9b('0x13')&&typeof _0x57e936[_0x0e9b('0x14')]===_0x0e9b('0x13');var _0x3a14c6=_0x15e303[_0x0e9b('0x15')];var _0x1a64fd=_0xb3efcd?0x0:_0x57e936['offset'];var _0x57862d=_0xb3efcd?_0x15e303[_0x0e9b('0x15')]:_0x57e936[_0x0e9b('0x12')]+_0x57e936['limit'];var _0x427a58;if(_0x57862d>=_0x3a14c6){_0x57862d=_0x3a14c6;_0x427a58=0xc8;}else{_0x427a58=0xce;}_0x2617bf['status'](_0x427a58);return _0x2617bf[_0x0e9b('0x16')]('Content-Range',_0x1a64fd+'-'+_0x57862d+'/'+_0x3a14c6)[_0x0e9b('0x11')](_0x15e303);}return null;};}function saveUpdates(_0xa1aa5c){return function(_0x343a01){if(_0x343a01){return _0x343a01[_0x0e9b('0x17')](_0xa1aa5c)[_0x0e9b('0x18')](function(_0x12d4a7){return _0x12d4a7;});}return null;};}function removeEntity(_0x83b5fa){return function(_0x1744f4){if(_0x1744f4){return _0x1744f4[_0x0e9b('0x19')]()[_0x0e9b('0x18')](function(){_0x83b5fa[_0x0e9b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c3ab7){return function(_0x246863){if(!_0x246863){_0x4c3ab7['sendStatus'](0x194);}return _0x246863;};}function handleError(_0x32f2d7,_0x1e33c3){_0x1e33c3=_0x1e33c3||0x1f4;return function(_0x5c421b){logger[_0x0e9b('0x1b')](_0x5c421b[_0x0e9b('0x1c')]);if(_0x5c421b[_0x0e9b('0x1d')]){delete _0x5c421b[_0x0e9b('0x1d')];}_0x32f2d7[_0x0e9b('0x1a')](_0x1e33c3)['send'](_0x5c421b);};}exports[_0x0e9b('0x1e')]=function(_0x44cc2f,_0x43c07c){var _0x4c02db={};var _0x1f27db=_[_0x0e9b('0x1f')](db[_0x0e9b('0x20')][_0x0e9b('0x21')],function(_0x101d2){return{'name':_0x101d2[_0x0e9b('0x22')],'type':_0x101d2[_0x0e9b('0x23')][_0x0e9b('0x24')]};});_0x4c02db=qs[_0x0e9b('0x25')](_0x1f27db,_0x44cc2f);return interaction[_0x0e9b('0x26')](_0x0e9b('0x27'),_0x44cc2f[_0x0e9b('0x28')],_0x44cc2f[_0x0e9b('0x29')],_0x4c02db,_0x1f27db)[_0x0e9b('0x18')](respondWithFilteredResult(_0x43c07c,_0x4c02db))['catch'](handleError(_0x43c07c,null));};exports['show']=function(_0x28b372,_0x3c2a54){var _0x2bd02e={'raw':![],'where':{'id':_0x28b372[_0x0e9b('0x2a')]['id']}},_0x1f2583={};_0x1f2583[_0x0e9b('0x2b')]=_['keys'](db[_0x0e9b('0x20')][_0x0e9b('0x21')]);_0x1f2583['query']=_[_0x0e9b('0x2c')](_0x28b372['query']);_0x1f2583[_0x0e9b('0x2d')]=_[_0x0e9b('0x2e')](_0x1f2583[_0x0e9b('0x2b')],_0x1f2583['query']);_0x2bd02e[_0x0e9b('0x2f')]=_[_0x0e9b('0x2e')](_0x1f2583[_0x0e9b('0x2b')],qs[_0x0e9b('0x30')](_0x28b372['query'][_0x0e9b('0x30')]));_0x2bd02e[_0x0e9b('0x2f')]=_0x2bd02e[_0x0e9b('0x2f')][_0x0e9b('0x31')]?_0x2bd02e[_0x0e9b('0x2f')]:_0x1f2583[_0x0e9b('0x2b')];if(_0x28b372[_0x0e9b('0x28')][_0x0e9b('0x32')]){_0x2bd02e['include']=[{'all':!![]}];}_0x2bd02e=_[_0x0e9b('0x33')]({},_0x2bd02e,_0x28b372[_0x0e9b('0x34')]);return db[_0x0e9b('0x20')][_0x0e9b('0x35')](_0x2bd02e)['then'](handleEntityNotFound(_0x3c2a54,null))[_0x0e9b('0x18')](respondWithResult(_0x3c2a54,null))[_0x0e9b('0x36')](handleError(_0x3c2a54,null));};exports[_0x0e9b('0x37')]=function(_0x2d7fbc,_0x677f9d){return db[_0x0e9b('0x20')][_0x0e9b('0x37')](_0x2d7fbc[_0x0e9b('0x38')],{})[_0x0e9b('0x18')](respondWithResult(_0x677f9d,0xc9))[_0x0e9b('0x36')](handleError(_0x677f9d,null));};exports[_0x0e9b('0x17')]=function(_0x41e2e2,_0x50149e){if(_0x41e2e2[_0x0e9b('0x38')]['id']){delete _0x41e2e2[_0x0e9b('0x38')]['id'];}return db[_0x0e9b('0x20')][_0x0e9b('0x35')]({'where':{'id':_0x41e2e2[_0x0e9b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x50149e,null))[_0x0e9b('0x18')](saveUpdates(_0x41e2e2[_0x0e9b('0x38')],null))[_0x0e9b('0x18')](respondWithResult(_0x50149e,null))['catch'](handleError(_0x50149e,null));};exports[_0x0e9b('0x19')]=function(_0x416f35,_0x9c5d32){return db[_0x0e9b('0x20')]['find']({'where':{'id':_0x416f35[_0x0e9b('0x2a')]['id']}})[_0x0e9b('0x18')](handleEntityNotFound(_0x9c5d32,null))[_0x0e9b('0x18')](removeEntity(_0x9c5d32,null))['catch'](handleError(_0x9c5d32,null));};exports[_0x0e9b('0x39')]=function(_0x596817,_0x5f59ff){return db[_0x0e9b('0x20')]['describe']()[_0x0e9b('0x18')](respondWithResult(_0x5f59ff,null))[_0x0e9b('0x36')](handleError(_0x5f59ff,null));};exports['addMessage']=function(_0x47a45b,_0x153798){return db[_0x0e9b('0x3a')]['find']({'where':{'id':_0x47a45b['params']['id']}})[_0x0e9b('0x18')](handleEntityNotFound(_0x153798,null))['then'](function(_0x2f03b7){if(_0x2f03b7){return _0x2f03b7[_0x0e9b('0x3b')](_0x47a45b[_0x0e9b('0x38')]['ids'],_[_0x0e9b('0x3c')](_0x47a45b[_0x0e9b('0x38')],[_0x0e9b('0x3d'),'id'])||{});}})[_0x0e9b('0x18')](respondWithResult(_0x153798,null))[_0x0e9b('0x36')](handleError(_0x153798,null));};exports[_0x0e9b('0x3e')]=function(_0x463a79,_0x1dc42d){var _0x501963={'raw':![],'where':{}};var _0x3de1b1={};var _0x5de14e={'count':0x0,'rows':[]};return db[_0x0e9b('0x20')][_0x0e9b('0x3f')]({'where':{'id':_0x463a79['params']['id']}})['then'](handleEntityNotFound(_0x1dc42d,null))[_0x0e9b('0x18')](function(_0x287a52){if(_0x287a52){_0x3de1b1[_0x0e9b('0x2b')]=_[_0x0e9b('0x2c')](db[_0x0e9b('0x3a')][_0x0e9b('0x21')]);_0x3de1b1['query']=_[_0x0e9b('0x2c')](_0x463a79[_0x0e9b('0x28')]);_0x3de1b1[_0x0e9b('0x2d')]=_[_0x0e9b('0x2e')](_0x3de1b1[_0x0e9b('0x2b')],_0x3de1b1['query']);_0x501963['attributes']=_[_0x0e9b('0x2e')](_0x3de1b1['model'],qs[_0x0e9b('0x30')](_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x30')]));_0x501963[_0x0e9b('0x2f')]=_0x501963[_0x0e9b('0x2f')][_0x0e9b('0x31')]?_0x501963['attributes']:_0x3de1b1['model'];if(!_0x463a79[_0x0e9b('0x28')]['hasOwnProperty'](_0x0e9b('0x40'))){_0x501963['limit']=qs['limit'](_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x14')]);_0x501963['offset']=qs[_0x0e9b('0x12')](_0x463a79[_0x0e9b('0x28')]['offset']);}_0x501963[_0x0e9b('0x41')]=qs[_0x0e9b('0x42')](_0x463a79[_0x0e9b('0x28')]['sort']);_0x501963[_0x0e9b('0x43')]=qs[_0x0e9b('0x2d')](_['pick'](_0x463a79[_0x0e9b('0x28')],_0x3de1b1['filters']));_0x501963[_0x0e9b('0x43')][_0x0e9b('0x44')]=_0x287a52['id'];if(_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x45')]){_0x501963[_0x0e9b('0x43')]=_['merge'](_0x501963[_0x0e9b('0x43')],{'$or':_[_0x0e9b('0x1f')](_0x501963[_0x0e9b('0x2f')],function(_0x2282d9){var _0xb16526={};_0xb16526[_0x2282d9]={'$like':'%'+_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x45')]+'%'};return _0xb16526;})});}if(_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x46')]){var _0x18ada5=_0x463a79[_0x0e9b('0x28')][_0x0e9b('0x46')][_0x0e9b('0x47')](',');var _0x216131={};_0x216131[_0x18ada5[0x0]]={'$gte':moment(_0x18ada5[0x1])[_0x0e9b('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x501963[_0x0e9b('0x43')]=_[_0x0e9b('0x33')](_0x501963[_0x0e9b('0x43')],_0x216131);}_0x501963=_[_0x0e9b('0x33')]({},_0x501963,_0x463a79[_0x0e9b('0x34')]);return db[_0x0e9b('0x3a')][_0x0e9b('0x15')]({'where':_0x501963[_0x0e9b('0x43')]})[_0x0e9b('0x18')](function(_0x5f160a){_0x5de14e[_0x0e9b('0x15')]=_0x5f160a;if(_0x463a79['query'][_0x0e9b('0x32')]){_0x501963[_0x0e9b('0x49')]=[{'all':!![]}];}return db[_0x0e9b('0x3a')][_0x0e9b('0x26')](_0x501963);})[_0x0e9b('0x18')](function(_0x6877de){_0x5de14e['rows']=_0x6877de;return _0x5de14e;});}})[_0x0e9b('0x18')](respondWithFilteredResult(_0x1dc42d,_0x501963))[_0x0e9b('0x36')](handleError(_0x1dc42d,null));};exports['addTags']=function(_0x2020b3,_0x39e95f){return db['WhatsappInteraction'][_0x0e9b('0x35')]({'where':{'id':_0x2020b3[_0x0e9b('0x2a')]['id']}})[_0x0e9b('0x18')](handleEntityNotFound(_0x39e95f,null))[_0x0e9b('0x18')](function(_0x3fd391){if(_0x3fd391){return _0x3fd391[_0x0e9b('0x4a')](_0x2020b3[_0x0e9b('0x38')]['ids'],_[_0x0e9b('0x3c')](_0x2020b3[_0x0e9b('0x38')],['ids','id'])||{})[_0x0e9b('0x4b')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0x0e9b('0x4c')],'where':{'id':_0x2020b3[_0x0e9b('0x38')]['ids']}});})[_0x0e9b('0x18')](function(_0x5a3f2a){socket[_0x0e9b('0x4d')](_0x0e9b('0x4e'),{'id':Number(_0x2020b3[_0x0e9b('0x2a')]['id']),'tags':_0x5a3f2a||[]});return{'id':Number(_0x2020b3[_0x0e9b('0x2a')]['id']),'tags':_0x5a3f2a||[]};});}})[_0x0e9b('0x18')](respondWithResult(_0x39e95f,null))[_0x0e9b('0x36')](handleError(_0x39e95f,null));};exports[_0x0e9b('0x4f')]=function(_0x30b9bd,_0x4c34c6){return db[_0x0e9b('0x20')]['find']({'where':{'id':_0x30b9bd[_0x0e9b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4c34c6,null))[_0x0e9b('0x18')](function(_0x4e08a9){if(_0x4e08a9){return _0x4e08a9['removeTags'](_0x30b9bd[_0x0e9b('0x28')][_0x0e9b('0x3d')]);}})['then'](respondWithStatusCode(_0x4c34c6,null))[_0x0e9b('0x36')](handleError(_0x4c34c6,null));};exports[_0x0e9b('0x50')]=function(_0x1382ea,_0x4fb57f){var _0xa8b6fe=moment()[_0x0e9b('0x51')]()['toString']();var _0x333a85=path[_0x0e9b('0x52')](config[_0x0e9b('0x53')],_0x0e9b('0x54'),_0x0e9b('0x55'),_0x0e9b('0x56'));var _0x41170b=path[_0x0e9b('0x52')](config[_0x0e9b('0x53')],_0x0e9b('0x54'),'files',_0x0e9b('0x57'));var _0x1411d1=path[_0x0e9b('0x52')](_0x333a85,_0xa8b6fe);var _0x852cee=util[_0x0e9b('0x48')](_0x0e9b('0x58'),_0x1382ea['params']['id'],_0xa8b6fe);var _0x18a5c0=path[_0x0e9b('0x52')](_0x333a85,_0x852cee);var _0x382de7=[];_0x382de7[_0x0e9b('0x59')]({'model':db[_0x0e9b('0x5a')],'as':_0x0e9b('0x5a'),'attributes':['id',_0x0e9b('0x5b')],'raw':!![]});_0x382de7[_0x0e9b('0x59')]({'model':db[_0x0e9b('0x5c')],'as':_0x0e9b('0x5d'),'attributes':['id',_0x0e9b('0x5e'),'lastName'],'raw':!![]});if(_0x1382ea[_0x0e9b('0x28')][_0x0e9b('0x57')]){_0x382de7['push']({'model':db['Attachment'],'as':_0x0e9b('0x5f'),'raw':!![]});}var _0x9edf6d=[{'model':db[_0x0e9b('0x3a')],'as':_0x0e9b('0x60'),'attributes':['id',_0x0e9b('0x38'),'createdAt','direction','secret',_0x0e9b('0x61')],'include':_0x382de7}];_0x9edf6d[_0x0e9b('0x59')]({'model':db[_0x0e9b('0x62')],'as':_0x0e9b('0x63'),'attributes':['id','name']});_0x9edf6d[_0x0e9b('0x59')]({'model':db[_0x0e9b('0x5a')],'as':_0x0e9b('0x64'),'attributes':['id',_0x0e9b('0x5b')]});return db[_0x0e9b('0x20')][_0x0e9b('0x35')]({'where':{'id':_0x1382ea[_0x0e9b('0x2a')]['id']},'include':_0x9edf6d})[_0x0e9b('0x18')](handleEntityNotFound(_0x4fb57f,null))['then'](function(_0x4de236){if(_0x4de236){var _0xccf47a=_0x4de236[_0x0e9b('0x65')]({'plain':!![]});fs[_0x0e9b('0x66')](_0x1411d1);var _0x4060f1={'channel':_0x0e9b('0x67'),'account':_0xccf47a['Account'][_0x0e9b('0x1d')],'agent':_0xccf47a['Owner']?_0xccf47a['Owner'][_0x0e9b('0x5b')]:'N.A.','createdAt':moment(_0xccf47a[_0x0e9b('0x68')])[_0x0e9b('0x48')](_0x0e9b('0x69'))[_0x0e9b('0x6a')](),'closedAt':_0xccf47a[_0x0e9b('0x6b')]?moment(_0xccf47a[_0x0e9b('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0xccf47a[_0x0e9b('0x6d')],'messages':_(_0xccf47a[_0x0e9b('0x60')])['filter']({'secret':![]})[_0x0e9b('0x1f')](function(_0x27b753){if(_0x27b753[_0x0e9b('0x5f')]){var _0x396420=path[_0x0e9b('0x52')](_0x41170b,_0x27b753['Attachment'][_0x0e9b('0x6e')]);if(fs['existsSync'](_0x396420)){fs[_0x0e9b('0x6f')](_0x396420)[_0x0e9b('0x70')](fs[_0x0e9b('0x71')](path[_0x0e9b('0x52')](_0x1411d1,_0x27b753['Attachment'][_0x0e9b('0x6e')])));}}return{'date':moment(_0x27b753[_0x0e9b('0x68')])['format'](_0x0e9b('0x69'))['toString'](),'sender':_0x27b753[_0x0e9b('0x72')]===_0x0e9b('0x73')?_0x27b753[_0x0e9b('0x5a')]?_0x27b753[_0x0e9b('0x5a')][_0x0e9b('0x5b')]:_0x0e9b('0x74'):_0x27b753[_0x0e9b('0x5d')][_0x0e9b('0x5e')]+(_0x27b753['Contact'][_0x0e9b('0x75')]?'\x20'+_0x27b753[_0x0e9b('0x5d')][_0x0e9b('0x75')]:''),'body':_0x27b753['Attachment']?_0x27b753[_0x0e9b('0x5f')]['basename']:_0x27b753[_0x0e9b('0x38')],'direction':_0x27b753[_0x0e9b('0x72')]===_0x0e9b('0x73')?'A':'C','secret':_0x27b753['secret'],'read':_0x27b753[_0x0e9b('0x61')],'attachment':_0x27b753[_0x0e9b('0x5f')]};})[_0x0e9b('0x76')]()};return ejs[_0x0e9b('0x77')](path[_0x0e9b('0x52')](config[_0x0e9b('0x53')],'server','views',_0x0e9b('0x78')),{'interaction':_0x4060f1})['then'](function(_0x50c5c6){var _0x56d8f7=path['join'](_0x1411d1,'transcript-'+_0xccf47a['id']+'-'+_0xa8b6fe+_0x0e9b('0x79'));var _0xffd6c={'path':_0x56d8f7,'channel':_0x0e9b('0x67'),'interactionId':_0xccf47a['id']};return pdf['createPdfFromHTML'](_0x50c5c6,_0xffd6c);})[_0x0e9b('0x18')](function(){return new BPromise(function(_0x2349c2,_0x2ebb5b){zipdir(_0x1411d1,{'saveTo':_0x18a5c0},function(_0xc5bc62,_0x5004f8){if(_0xc5bc62)return _0x2ebb5b(_0xc5bc62);return _0x2349c2(_0x5004f8);});})[_0x0e9b('0x18')](function(){return new BPromise(function(_0x54f834,_0x3d93f9){rimraf(_0x1411d1,function(_0x25f9e9){if(_0x25f9e9)_0x3d93f9(_0x25f9e9);return _0x54f834();});});})[_0x0e9b('0x18')](function(){return _0x4fb57f[_0x0e9b('0x50')](_0x18a5c0,_0x852cee,function(_0x504723){if(_0x504723){console[_0x0e9b('0x7a')]('err',_0x504723);}else{fs[_0x0e9b('0x7b')](_0x18a5c0);}});});});}else{return _0x4fb57f[_0x0e9b('0xf')](0xc8);}})[_0x0e9b('0x36')](handleError(_0x4fb57f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4b0d96d..bee1164 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 _0xc961=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x1ce743,_0x15c90c){var _0x5a4b42=function(_0x1bfee6){while(--_0x1bfee6){_0x1ce743['push'](_0x1ce743['shift']());}};_0x5a4b42(++_0x15c90c);}(_0xc961,0x17a));var _0x1c96=function(_0x33e114,_0x77cc5a){_0x33e114=_0x33e114-0x0;var _0x17e9b6=_0xc961[_0x33e114];return _0x17e9b6;};'use strict';var EventEmitter=require(_0x1c96('0x0'));var WhatsappInteraction=require(_0x1c96('0x1'))['db'][_0x1c96('0x2')];var WhatsappMessage=require(_0x1c96('0x1'))['db'][_0x1c96('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1c96('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30d2e0){return function(_0x494d92,_0x180969,_0x5594ee){_0x494d92[_0x1c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x1c96('0x6')](function(_0x1f09ff){_0x494d92[_0x1c96('0x7')](_0x1c96('0x8'),_0x1f09ff[_0x1c96('0x9')](function(_0x5523de){return{'id':_0x5523de['id']};}));return WhatsappMessage[_0x1c96('0xa')]({'where':{'WhatsappInteractionId':_0x494d92['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c96('0x6')](function(_0x691a95){_0x494d92[_0x1c96('0x7')](_0x1c96('0xb'),_0x691a95[_0x1c96('0xc')]);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0+':'+_0x494d92['id'],_0x494d92);WhatsappInteractionEvents[_0x1c96('0xd')](_0x30d2e0,_0x494d92);_0x5594ee(null);})[_0x1c96('0xe')](_0x5594ee(null));};}for(var e in events){if(events[_0x1c96('0xf')](e)){var event=events[e];WhatsappInteraction[_0x1c96('0x10')](e,emitEvent(event));}}module[_0x1c96('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xe3db=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x595a21,_0x24790f){var _0x50df84=function(_0x3c7188){while(--_0x3c7188){_0x595a21['push'](_0x595a21['shift']());}};_0x50df84(++_0x24790f);}(_0xe3db,0xc8));var _0xbe3d=function(_0x306051,_0x1e7c2f){_0x306051=_0x306051-0x0;var _0x24583c=_0xe3db[_0x306051];return _0x24583c;};'use strict';var EventEmitter=require(_0xbe3d('0x0'));var WhatsappInteraction=require(_0xbe3d('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xbe3d('0x1'))['db'][_0xbe3d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbe3d('0x3')](0x0);var events={'afterCreate':_0xbe3d('0x4'),'afterUpdate':_0xbe3d('0x5'),'afterDestroy':_0xbe3d('0x6')};function emitEvent(_0x30163d){return function(_0x472825,_0x22d579,_0xd5a81){_0x472825[_0xbe3d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x314709){_0x472825[_0xbe3d('0x8')](_0xbe3d('0x9'),_0x314709[_0xbe3d('0xa')](function(_0x55df34){return{'id':_0x55df34['id']};}));return WhatsappMessage[_0xbe3d('0xb')]({'where':{'WhatsappInteractionId':_0x472825['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe3d('0xc')](function(_0x514464){_0x472825['setDataValue'](_0xbe3d('0xd'),_0x514464[_0xbe3d('0xe')]);WhatsappInteractionEvents[_0xbe3d('0xf')](_0x30163d+':'+_0x472825['id'],_0x472825);WhatsappInteractionEvents[_0xbe3d('0xf')](_0x30163d,_0x472825);_0xd5a81(null);})[_0xbe3d('0x10')](_0xd5a81(null));};}for(var e in events){if(events[_0xbe3d('0x11')](e)){var event=events[e];WhatsappInteraction[_0xbe3d('0x12')](e,emitEvent(event));}}module[_0xbe3d('0x13')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f82b442..8203833 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 _0x6113=['request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0x6113,0x13e));var _0x3611=function(_0x2df74c,_0x42b9cb){_0x2df74c=_0x2df74c-0x0;var _0x219cc6=_0x6113[_0x2df74c];return _0x219cc6;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))(_0x3611('0x3'));var moment=require(_0x3611('0x4'));var BPromise=require(_0x3611('0x5'));var rp=require(_0x3611('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3611('0x7'));var attributes=require(_0x3611('0x8'));module[_0x3611('0x9')]=function(_0x13037f,_0x218ee0){return _0x13037f[_0x3611('0xa')](_0x3611('0xb'),attributes,{'tableName':_0x3611('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x516659,_0x57b596,_0xc9347a){if(_0x516659[_0x3611('0xd')](_0x3611('0xe'))){_0x516659[_0x3611('0xf')]=moment()[_0x3611('0x10')](_0x3611('0x11'));}_0xc9347a(null,_0x516659);}}});}; \ No newline at end of file +var _0x098d=['whatsapp_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction'];(function(_0x28fd08,_0x44d72b){var _0x11c93c=function(_0x178c48){while(--_0x178c48){_0x28fd08['push'](_0x28fd08['shift']());}};_0x11c93c(++_0x44d72b);}(_0x098d,0x1e0));var _0xd098=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x098d[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xd098('0x0'));var util=require(_0xd098('0x1'));var logger=require(_0xd098('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd098('0x3'));var rp=require(_0xd098('0x4'));var fs=require('fs');var path=require(_0xd098('0x5'));var rimraf=require(_0xd098('0x6'));var config=require('../../config/environment');var attributes=require(_0xd098('0x7'));module[_0xd098('0x8')]=function(_0x453770,_0x351e1c){return _0x453770['define'](_0xd098('0x9'),attributes,{'tableName':_0xd098('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1738b6,_0x1c9a4c,_0x146503){if(_0x1738b6[_0xd098('0xb')](_0xd098('0xc'))){_0x1738b6['closedAt']=moment()['format'](_0xd098('0xd'));}_0x146503(null,_0x1738b6);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 130f685..b273e6e 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 _0x9a6c=['catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result'];(function(_0x2d1158,_0xed7af0){var _0x5a2903=function(_0x1af70c){while(--_0x1af70c){_0x2d1158['push'](_0x2d1158['shift']());}};_0x5a2903(++_0xed7af0);}(_0x9a6c,0x6c));var _0xc9a6=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9a6c[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xc9a6('0x0'));var util=require('util');var moment=require(_0xc9a6('0x1'));var BPromise=require(_0xc9a6('0x2'));var rs=require(_0xc9a6('0x3'));var fs=require('fs');var Redis=require(_0xc9a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a6('0x5'));var logger=require(_0xc9a6('0x6'))(_0xc9a6('0x7'));var config=require(_0xc9a6('0x8'));var jayson=require(_0xc9a6('0x9'));var client=jayson[_0xc9a6('0xa')][_0xc9a6('0xb')]({'port':0x232a});config[_0xc9a6('0xc')]=_[_0xc9a6('0xd')](config[_0xc9a6('0xc')],{'host':_0xc9a6('0xe'),'port':0x18eb});var socket=require(_0xc9a6('0xf'))(new Redis(config[_0xc9a6('0xc')]));require(_0xc9a6('0x10'))[_0xc9a6('0x11')](socket);function respondWithRpcPromise(_0x5e7275,_0x2fe049,_0x1a167d){return new BPromise(function(_0x219a3f,_0x2c86b2){return client['request'](_0x5e7275,_0x1a167d)[_0xc9a6('0x12')](function(_0x484075){logger[_0xc9a6('0x13')](_0xc9a6('0x14'),_0x2fe049,'request\x20sent');logger['debug'](_0xc9a6('0x15'),_0x2fe049,'request\x20sent',JSON[_0xc9a6('0x16')](_0x484075));if(_0x484075[_0xc9a6('0x17')]){if(_0x484075[_0xc9a6('0x17')]['code']===0x1f4){logger[_0xc9a6('0x17')](_0xc9a6('0x14'),_0x2fe049,_0x484075[_0xc9a6('0x17')][_0xc9a6('0x18')]);return _0x2c86b2(_0x484075['error'][_0xc9a6('0x18')]);}logger[_0xc9a6('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2fe049,_0x484075['error'][_0xc9a6('0x18')]);return _0x219a3f(_0x484075['error'][_0xc9a6('0x18')]);}else{logger[_0xc9a6('0x13')](_0xc9a6('0x14'),_0x2fe049,_0xc9a6('0x19'));_0x219a3f(_0x484075[_0xc9a6('0x1a')][_0xc9a6('0x18')]);}})[_0xc9a6('0x1b')](function(_0x42539c){logger[_0xc9a6('0x17')](_0xc9a6('0x14'),_0x2fe049,_0x42539c);_0x2c86b2(_0x42539c);});});}exports['UpdateWhatsappInteraction']=function(_0x2ffcbc){var _0x218233=this;return new Promise(function(_0x17fa31,_0x2910bd){return db[_0xc9a6('0x1c')][_0xc9a6('0x1d')](_0x2ffcbc[_0xc9a6('0x1e')],{'raw':_0x2ffcbc['options']?_0x2ffcbc[_0xc9a6('0x1f')][_0xc9a6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ffcbc['options']?_0x2ffcbc['options'][_0xc9a6('0x21')]||null:null,'attributes':_0x2ffcbc['options']?_0x2ffcbc[_0xc9a6('0x1f')][_0xc9a6('0x22')]||null:null,'limit':_0x2ffcbc['options']?_0x2ffcbc['options'][_0xc9a6('0x23')]||null:null})[_0xc9a6('0x12')](function(_0x32f55b){logger[_0xc9a6('0x13')]('UpdateWhatsappInteraction',_0x2ffcbc);logger[_0xc9a6('0x24')](_0xc9a6('0x25'),_0x2ffcbc,JSON[_0xc9a6('0x16')](_0x32f55b));_0x17fa31(_0x32f55b);})[_0xc9a6('0x1b')](function(_0x2e0908){logger[_0xc9a6('0x17')](_0xc9a6('0x25'),_0x2e0908[_0xc9a6('0x18')],_0x2ffcbc);_0x2910bd(_0x218233[_0xc9a6('0x17')](0x1f4,_0x2e0908[_0xc9a6('0x18')]));});});};exports[_0xc9a6('0x26')]=function(_0x1b1626){return new Promise(function(_0x2a6e61,_0x4ff32d){return db['WhatsappInteraction'][_0xc9a6('0x27')]({'where':_0x1b1626[_0xc9a6('0x1f')]?_0x1b1626[_0xc9a6('0x1f')]['where']||null:null})['then'](function(_0x44f70a){if(_0x44f70a){return _0x44f70a[_0xc9a6('0x28')](_0x1b1626['body']['ids'],_[_0xc9a6('0x29')](_0x1b1626[_0xc9a6('0x1e')],[_0xc9a6('0x2a'),'id'])||{});}})[_0xc9a6('0x2b')](function(_0x4efba1){logger[_0xc9a6('0x13')](_0xc9a6('0x2c'),_0x1b1626);logger[_0xc9a6('0x24')]('AddTags',_0x1b1626,JSON[_0xc9a6('0x16')](_0x4efba1));_0x2a6e61(_0x4efba1);})[_0xc9a6('0x1b')](function(_0x342956){logger[_0xc9a6('0x17')](_0xc9a6('0x2c'),_0x342956[_0xc9a6('0x18')],_0x1b1626);_0x4ff32d(_this[_0xc9a6('0x17')](0x1f4,_0x342956[_0xc9a6('0x18')]));});});}; \ No newline at end of file +var _0xbab1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','find','then','addTags','ids','omit','AddTags','catch'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xbab1,0x19a));var _0x1bab=function(_0x500149,_0x71bbc8){_0x500149=_0x500149-0x0;var _0x3ff783=_0xbab1[_0x500149];return _0x3ff783;};'use strict';var _=require('lodash');var util=require(_0x1bab('0x0'));var moment=require(_0x1bab('0x1'));var BPromise=require(_0x1bab('0x2'));var rs=require(_0x1bab('0x3'));var fs=require('fs');var Redis=require(_0x1bab('0x4'));var db=require(_0x1bab('0x5'))['db'];var utils=require(_0x1bab('0x6'));var logger=require('../../config/logger')(_0x1bab('0x7'));var config=require('../../config/environment');var jayson=require(_0x1bab('0x8'));var client=jayson[_0x1bab('0x9')][_0x1bab('0xa')]({'port':0x232a});config[_0x1bab('0xb')]=_['defaults'](config[_0x1bab('0xb')],{'host':_0x1bab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1bab('0xd'))[_0x1bab('0xe')](socket);function respondWithRpcPromise(_0x50dab7,_0x489e66,_0x7e56b4){return new BPromise(function(_0x26b510,_0x18b528){return client[_0x1bab('0xf')](_0x50dab7,_0x7e56b4)['then'](function(_0x59a902){logger[_0x1bab('0x10')](_0x1bab('0x11'),_0x489e66,_0x1bab('0x12'));logger[_0x1bab('0x13')](_0x1bab('0x14'),_0x489e66,_0x1bab('0x12'),JSON[_0x1bab('0x15')](_0x59a902));if(_0x59a902[_0x1bab('0x16')]){if(_0x59a902[_0x1bab('0x16')][_0x1bab('0x17')]===0x1f4){logger['error'](_0x1bab('0x11'),_0x489e66,_0x59a902[_0x1bab('0x16')][_0x1bab('0x18')]);return _0x18b528(_0x59a902[_0x1bab('0x16')]['message']);}logger[_0x1bab('0x16')](_0x1bab('0x11'),_0x489e66,_0x59a902['error'][_0x1bab('0x18')]);return _0x26b510(_0x59a902[_0x1bab('0x16')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x489e66,'request\x20sent');_0x26b510(_0x59a902[_0x1bab('0x19')][_0x1bab('0x18')]);}})['catch'](function(_0x5da6e0){logger[_0x1bab('0x16')](_0x1bab('0x11'),_0x489e66,_0x5da6e0);_0x18b528(_0x5da6e0);});});}exports[_0x1bab('0x1a')]=function(_0x196e3d){var _0xfe4e0c=this;return new Promise(function(_0x42ba7a,_0x3d85e4){return db[_0x1bab('0x1b')]['update'](_0x196e3d[_0x1bab('0x1c')],{'raw':_0x196e3d['options']?_0x196e3d[_0x1bab('0x1d')][_0x1bab('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x196e3d[_0x1bab('0x1d')]?_0x196e3d['options'][_0x1bab('0x1f')]||null:null,'attributes':_0x196e3d['options']?_0x196e3d['options'][_0x1bab('0x20')]||null:null,'limit':_0x196e3d[_0x1bab('0x1d')]?_0x196e3d[_0x1bab('0x1d')][_0x1bab('0x21')]||null:null})['then'](function(_0x415201){logger['info']('UpdateWhatsappInteraction',_0x196e3d);logger[_0x1bab('0x13')](_0x1bab('0x1a'),_0x196e3d,JSON['stringify'](_0x415201));_0x42ba7a(_0x415201);})['catch'](function(_0x2cd593){logger[_0x1bab('0x16')](_0x1bab('0x1a'),_0x2cd593['message'],_0x196e3d);_0x3d85e4(_0xfe4e0c['error'](0x1f4,_0x2cd593[_0x1bab('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x325be4){return new Promise(function(_0x4b13cb,_0x218bc8){return db[_0x1bab('0x1b')][_0x1bab('0x22')]({'where':_0x325be4[_0x1bab('0x1d')]?_0x325be4[_0x1bab('0x1d')]['where']||null:null})[_0x1bab('0x23')](function(_0x542457){if(_0x542457){return _0x542457[_0x1bab('0x24')](_0x325be4[_0x1bab('0x1c')][_0x1bab('0x25')],_[_0x1bab('0x26')](_0x325be4[_0x1bab('0x1c')],[_0x1bab('0x25'),'id'])||{});}})['spread'](function(_0x43a754){logger[_0x1bab('0x10')](_0x1bab('0x27'),_0x325be4);logger[_0x1bab('0x13')](_0x1bab('0x27'),_0x325be4,JSON[_0x1bab('0x15')](_0x43a754));_0x4b13cb(_0x43a754);})[_0x1bab('0x28')](function(_0x812e48){logger[_0x1bab('0x16')]('AddTags',_0x812e48[_0x1bab('0x18')],_0x325be4);_0x218bc8(_this[_0x1bab('0x16')](0x1f4,_0x812e48['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d206d73..550c4ed 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 _0xcae5=['save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xcae5,0x1f1));var _0x5cae=function(_0x2ae6f6,_0x4a4c6f){_0x2ae6f6=_0x2ae6f6-0x0;var _0x41dd46=_0xcae5[_0x2ae6f6];return _0x41dd46;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x5cae('0x0'),_0x5cae('0x1'),'update'];function createListener(_0x36a9ab,_0x34e259){return function(_0x5e7d90){_0x34e259[_0x5cae('0x2')](_0x36a9ab,_0x5e7d90);};}function removeListener(_0x69e43a,_0x5d6d99){return function(){WhatsappInteractionEvents[_0x5cae('0x3')](_0x69e43a,_0x5d6d99);};}exports[_0x5cae('0x4')]=function(_0xc5e35){for(var _0x2bf24f=0x0,_0x2c62d9=events[_0x5cae('0x5')];_0x2bf24f<_0x2c62d9;_0x2bf24f++){var _0x2ac62d=events[_0x2bf24f];var _0x3fd429=createListener(_0x5cae('0x6')+_0x2ac62d,_0xc5e35);WhatsappInteractionEvents['on'](_0x2ac62d,_0x3fd429);}}; \ No newline at end of file +var _0x81a7=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','update'];(function(_0x512407,_0x145992){var _0x5b2cea=function(_0x377e66){while(--_0x377e66){_0x512407['push'](_0x512407['shift']());}};_0x5b2cea(++_0x145992);}(_0x81a7,0x106));var _0x781a=function(_0x3533e0,_0x4b89d3){_0x3533e0=_0x3533e0-0x0;var _0x5d71b2=_0x81a7[_0x3533e0];return _0x5d71b2;};'use strict';var WhatsappInteractionEvents=require(_0x781a('0x0'));var events=['save','remove',_0x781a('0x1')];function createListener(_0x2b7e6d,_0x4dd422){return function(_0x56a0df){_0x4dd422['emit'](_0x2b7e6d,_0x56a0df);};}function removeListener(_0x16fa81,_0x17c85e){return function(){WhatsappInteractionEvents[_0x781a('0x2')](_0x16fa81,_0x17c85e);};}exports[_0x781a('0x3')]=function(_0x28e105){for(var _0x19c86e=0x0,_0x3e1647=events[_0x781a('0x4')];_0x19c86e<_0x3e1647;_0x19c86e++){var _0x25e82b=events[_0x19c86e];var _0x412353=createListener(_0x781a('0x5')+_0x25e82b,_0x28e105);WhatsappInteractionEvents['on'](_0x25e82b,_0x412353);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0d470f3..c068870 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 _0x5f3b=['isAuthenticated','/:id','show','whatsapp','whatsappmessage:create','post','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x5f3b,0x122));var _0xb5f3=function(_0x18db39,_0x5dbdbc){_0x18db39=_0x18db39-0x0;var _0x200176=_0x5f3b[_0x18db39];return _0x200176;};'use strict';var multer=require(_0xb5f3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb5f3('0x1')]();var fs_extra=require(_0xb5f3('0x2'));var auth=require(_0xb5f3('0x3'));var interaction=require(_0xb5f3('0x4'));var config=require(_0xb5f3('0x5'));var controller=require(_0xb5f3('0x6'));router[_0xb5f3('0x7')]('/',auth['isAuthenticated'](),controller[_0xb5f3('0x8')]);router[_0xb5f3('0x7')](_0xb5f3('0x9'),auth[_0xb5f3('0xa')](),controller['describe']);router[_0xb5f3('0x7')](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0xc')]);router['post']('/',auth[_0xb5f3('0xa')](),interaction['tracked'](_0xb5f3('0xd'),_0xb5f3('0xe')),controller['create']);router[_0xb5f3('0xf')](_0xb5f3('0x10'),controller[_0xb5f3('0x11')]);router[_0xb5f3('0x12')](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x13')]);router[_0xb5f3('0x12')](_0xb5f3('0x14'),auth[_0xb5f3('0xa')](),controller['accept']);router['put'](_0xb5f3('0x15'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x16')]);router['delete'](_0xb5f3('0xb'),auth[_0xb5f3('0xa')](),controller[_0xb5f3('0x17')]);module[_0xb5f3('0x18')]=router; \ No newline at end of file +var _0x3f7f=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1599ae,_0x50ac2b){var _0x5c97cc=function(_0x4e0c3b){while(--_0x4e0c3b){_0x1599ae['push'](_0x1599ae['shift']());}};_0x5c97cc(++_0x50ac2b);}(_0x3f7f,0x72));var _0xf3f7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3f7f[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xf3f7('0x0'));var util=require('util');var path=require(_0xf3f7('0x1'));var timeout=require(_0xf3f7('0x2'));var express=require(_0xf3f7('0x3'));var router=express[_0xf3f7('0x4')]();var fs_extra=require(_0xf3f7('0x5'));var auth=require(_0xf3f7('0x6'));var interaction=require(_0xf3f7('0x7'));var config=require('../../config/environment');var controller=require(_0xf3f7('0x8'));router[_0xf3f7('0x9')]('/',auth[_0xf3f7('0xa')](),controller[_0xf3f7('0xb')]);router[_0xf3f7('0x9')](_0xf3f7('0xc'),auth[_0xf3f7('0xa')](),controller[_0xf3f7('0xd')]);router[_0xf3f7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xf3f7('0xe')]);router[_0xf3f7('0xf')]('/',auth['isAuthenticated'](),interaction[_0xf3f7('0x10')](_0xf3f7('0x11'),_0xf3f7('0x12')),controller[_0xf3f7('0x13')]);router[_0xf3f7('0xf')](_0xf3f7('0x14'),controller[_0xf3f7('0x15')]);router[_0xf3f7('0x16')](_0xf3f7('0x17'),auth[_0xf3f7('0xa')](),controller[_0xf3f7('0x18')]);router['put'](_0xf3f7('0x19'),auth[_0xf3f7('0xa')](),controller[_0xf3f7('0x1a')]);router['put'](_0xf3f7('0x1b'),auth[_0xf3f7('0xa')](),controller[_0xf3f7('0x1c')]);router[_0xf3f7('0x1d')](_0xf3f7('0x17'),auth[_0xf3f7('0xa')](),controller[_0xf3f7('0x1e')]);module[_0xf3f7('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3a070b6..f96628e 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 _0xbfe8=['out','STRING','DATE','exports','medium','BOOLEAN'];(function(_0x43ec2e,_0x3719b4){var _0x40ff3d=function(_0x450e31){while(--_0x450e31){_0x43ec2e['push'](_0x43ec2e['shift']());}};_0x40ff3d(++_0x3719b4);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x14c85c,_0x641112){_0x14c85c=_0x14c85c-0x0;var _0x89b231=_0xbfe8[_0x14c85c];return _0x89b231;};'use strict';var Sequelize=require('sequelize');module[_0x8bfe('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8bfe('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8bfe('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x8bfe('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8bfe('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8bfe('0x5')]},'secret':{'type':Sequelize[_0x8bfe('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8bfe('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8756=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x2ba8ab,_0xa5c8fa){var _0x20029b=function(_0x351d51){while(--_0x351d51){_0x2ba8ab['push'](_0x2ba8ab['shift']());}};_0x20029b(++_0xa5c8fa);}(_0x8756,0xc2));var _0x6875=function(_0x63a9af,_0x514b5b){_0x63a9af=_0x63a9af-0x0;var _0x2df8d4=_0x8756[_0x63a9af];return _0x2df8d4;};'use strict';var Sequelize=require(_0x6875('0x0'));module[_0x6875('0x1')]={'body':{'type':Sequelize[_0x6875('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6875('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6875('0x4')]('in',_0x6875('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6875('0x6')](0xbe)},'phone':{'type':Sequelize[_0x6875('0x6')]},'readAt':{'type':Sequelize[_0x6875('0x7')]},'secret':{'type':Sequelize[_0x6875('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6875('0x6')]},'providerResponse':{'type':Sequelize[_0x6875('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 3811e9f..57c0cce 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 _0xeecb=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','http','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','destroy','end','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','filters','pick','filter','where','merge','options','WhatsappMessage','includeAll','include','findAll','rows','params','keys','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','interface','channel','motionChannel','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','fullname','internal','event','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir'];(function(_0x427a21,_0x2b58af){var _0x18c737=function(_0x124749){while(--_0x124749){_0x427a21['push'](_0x427a21['shift']());}};_0x18c737(++_0x2b58af);}(_0xeecb,0x18d));var _0xbeec=function(_0x475e33,_0x42824a){_0x475e33=_0x475e33-0x0;var _0x318871=_0xeecb[_0x475e33];return _0x318871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbeec('0x0'));var zipdir=require(_0xbeec('0x1'));var jsonpatch=require(_0xbeec('0x2'));var rp=require(_0xbeec('0x3'));var moment=require(_0xbeec('0x4'));var BPromise=require(_0xbeec('0x5'));var Mustache=require(_0xbeec('0x6'));var util=require(_0xbeec('0x7'));var path=require(_0xbeec('0x8'));var sox=require(_0xbeec('0x9'));var csv=require(_0xbeec('0xa'));var ejs=require(_0xbeec('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeec('0xc'));var crypto=require(_0xbeec('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbeec('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbeec('0xf'));var Papa=require(_0xbeec('0x10'));var Redis=require(_0xbeec('0x11'));var authService=require(_0xbeec('0x12'));var qs=require(_0xbeec('0x13'));var as=require(_0xbeec('0x14'));var hardwareService=require(_0xbeec('0x15'));var logger=require(_0xbeec('0x16'))(_0xbeec('0x17'));var utils=require('../../config/utils');var config=require(_0xbeec('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xbeec('0x19')]=_[_0xbeec('0x1a')](config[_0xbeec('0x19')],{'host':_0xbeec('0x1b'),'port':0x18eb});var socket=require(_0xbeec('0x1c'))(new Redis(config[_0xbeec('0x19')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xbeec('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xbeec('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x48602a,_0x4b6ab2,_0xe9233f,_0x158553){return new BPromise(function(_0x14e4e7,_0x60ebe5){var _0x52826a=_0x158553||client;return _0x52826a[_0xbeec('0x1e')](_0x48602a,_0xe9233f)[_0xbeec('0x1f')](function(_0xf62c4e){logger[_0xbeec('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x4b6ab2,_0xbeec('0x21'));logger[_0xbeec('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4b6ab2,_0xbeec('0x21'),JSON[_0xbeec('0x23')](_0xf62c4e));if(_0xf62c4e[_0xbeec('0x24')]){if(_0xf62c4e[_0xbeec('0x24')]['code']===0x1f4){logger[_0xbeec('0x24')](_0xbeec('0x25'),_0x4b6ab2,_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);return _0x60ebe5(_0xf62c4e[_0xbeec('0x24')]['message']);}logger[_0xbeec('0x24')](_0xbeec('0x25'),_0x4b6ab2,_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);return _0x14e4e7(_0xf62c4e[_0xbeec('0x24')][_0xbeec('0x26')]);}else{logger[_0xbeec('0x20')](_0xbeec('0x25'),_0x4b6ab2,'request\x20sent');_0x14e4e7(_0xf62c4e[_0xbeec('0x27')]['message']);}})[_0xbeec('0x28')](function(_0x275b1b){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4b6ab2,_0x275b1b);_0x60ebe5(_0x275b1b);});});}function respondWithStatusCode(_0x38b5c4,_0x2350d9){_0x2350d9=_0x2350d9||0xcc;return function(_0x9e786a){if(_0x9e786a){return _0x38b5c4[_0xbeec('0x29')](_0x2350d9);}return _0x38b5c4[_0xbeec('0x2a')](_0x2350d9)['end']();};}function respondWithResult(_0x369164,_0x341408){_0x341408=_0x341408||0xc8;return function(_0x1f4ee9){if(_0x1f4ee9){return _0x369164[_0xbeec('0x2a')](_0x341408)[_0xbeec('0x2b')](_0x1f4ee9);}};}function respondWithFilteredResult(_0x187bae,_0x14a895){return function(_0x5b2ac7){if(_0x5b2ac7){var _0x18af54=typeof _0x14a895[_0xbeec('0x2c')]==='undefined'&&typeof _0x14a895[_0xbeec('0x2d')]==='undefined';var _0x3d29f0=_0x5b2ac7['count'];var _0x347364=_0x18af54?0x0:_0x14a895[_0xbeec('0x2c')];var _0x19f60c=_0x18af54?_0x5b2ac7[_0xbeec('0x2e')]:_0x14a895['offset']+_0x14a895['limit'];var _0x18aa58;if(_0x19f60c>=_0x3d29f0){_0x19f60c=_0x3d29f0;_0x18aa58=0xc8;}else{_0x18aa58=0xce;}_0x187bae[_0xbeec('0x2a')](_0x18aa58);return _0x187bae[_0xbeec('0x2f')](_0xbeec('0x30'),_0x347364+'-'+_0x19f60c+'/'+_0x3d29f0)[_0xbeec('0x2b')](_0x5b2ac7);}return null;};}function patchUpdates(_0x307903){return function(_0x30f1e0){try{jsonpatch['apply'](_0x30f1e0,_0x307903,!![]);}catch(_0x3ce43e){return BPromise[_0xbeec('0x31')](_0x3ce43e);}return _0x30f1e0[_0xbeec('0x32')]();};}function saveUpdates(_0x45a6a9,_0x39b72b){return function(_0x2e9bc2){if(_0x2e9bc2){return _0x2e9bc2['update'](_0x45a6a9)[_0xbeec('0x1f')](function(_0x961f8b){return _0x961f8b;});}return null;};}function removeEntity(_0x398d32,_0x714f37){return function(_0x3c617b){if(_0x3c617b){return _0x3c617b[_0xbeec('0x33')]()['then'](function(){_0x398d32[_0xbeec('0x2a')](0xcc)[_0xbeec('0x34')]();});}};}function handleEntityNotFound(_0x3da2a7,_0x1b0285){return function(_0x3a53a3){if(!_0x3a53a3){_0x3da2a7[_0xbeec('0x29')](0x194);}return _0x3a53a3;};}function handleError(_0xce8301,_0x2c7f34){_0x2c7f34=_0x2c7f34||0x1f4;return function(_0x3efe7c){logger['error'](_0x3efe7c[_0xbeec('0x35')]);if(_0x3efe7c['name']){delete _0x3efe7c[_0xbeec('0x36')];}_0xce8301[_0xbeec('0x2a')](_0x2c7f34)[_0xbeec('0x37')](_0x3efe7c);};}exports[_0xbeec('0x38')]=function(_0x37a66d,_0x41a0e6){var _0x511113={},_0x199ae3={},_0x12a4c9={'count':0x0,'rows':[]};var _0x14317f=_['map'](db['WhatsappMessage'][_0xbeec('0x39')],function(_0x2d8ff0){return{'name':_0x2d8ff0['fieldName'],'type':_0x2d8ff0[_0xbeec('0x3a')][_0xbeec('0x3b')]};});_0x199ae3[_0xbeec('0x3c')]=_[_0xbeec('0x3d')](_0x14317f,_0xbeec('0x36'));_0x199ae3['query']=_['keys'](_0x37a66d[_0xbeec('0x3e')]);_0x199ae3['filters']=_[_0xbeec('0x3f')](_0x199ae3['model'],_0x199ae3[_0xbeec('0x3e')]);_0x511113[_0xbeec('0x40')]=_[_0xbeec('0x3f')](_0x199ae3[_0xbeec('0x3c')],qs[_0xbeec('0x41')](_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x41')]));_0x511113[_0xbeec('0x40')]=_0x511113[_0xbeec('0x40')][_0xbeec('0x42')]?_0x511113['attributes']:_0x199ae3[_0xbeec('0x3c')];if(!_0x37a66d[_0xbeec('0x3e')]['hasOwnProperty'](_0xbeec('0x43'))){_0x511113['limit']=qs[_0xbeec('0x2d')](_0x37a66d[_0xbeec('0x3e')]['limit']);_0x511113['offset']=qs[_0xbeec('0x2c')](_0x37a66d[_0xbeec('0x3e')]['offset']);}_0x511113[_0xbeec('0x44')]=qs['sort'](_0x37a66d[_0xbeec('0x3e')]['sort']);_0x511113['where']=qs[_0xbeec('0x45')](_[_0xbeec('0x46')](_0x37a66d[_0xbeec('0x3e')],_0x199ae3[_0xbeec('0x45')]),_0x14317f);if(_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x47')]){_0x511113[_0xbeec('0x48')]=_[_0xbeec('0x49')](_0x511113[_0xbeec('0x48')],{'$or':_[_0xbeec('0x3d')](_0x14317f,function(_0x92794e){if(_0x92794e[_0xbeec('0x3a')]!=='VIRTUAL'){var _0x183929={};_0x183929[_0x92794e[_0xbeec('0x36')]]={'$like':'%'+_0x37a66d[_0xbeec('0x3e')]['filter']+'%'};return _0x183929;}})});}_0x511113=_[_0xbeec('0x49')]({},_0x511113,_0x37a66d[_0xbeec('0x4a')]);var _0x17260a={'where':_0x511113[_0xbeec('0x48')]};return db[_0xbeec('0x4b')][_0xbeec('0x2e')](_0x17260a)['then'](function(_0x5b0ba1){_0x12a4c9[_0xbeec('0x2e')]=_0x5b0ba1;if(_0x37a66d[_0xbeec('0x3e')][_0xbeec('0x4c')]){_0x511113[_0xbeec('0x4d')]=[{'all':!![]}];}return db[_0xbeec('0x4b')][_0xbeec('0x4e')](_0x511113);})[_0xbeec('0x1f')](function(_0x4a383d){_0x12a4c9[_0xbeec('0x4f')]=_0x4a383d;return _0x12a4c9;})[_0xbeec('0x1f')](respondWithFilteredResult(_0x41a0e6,_0x511113))[_0xbeec('0x28')](handleError(_0x41a0e6,null));};exports['show']=function(_0x4f8f76,_0xb2641c){var _0x3470c5={'raw':!![],'where':{'id':_0x4f8f76[_0xbeec('0x50')]['id']}},_0x372c28={};_0x372c28['model']=_['keys'](db[_0xbeec('0x4b')]['rawAttributes']);_0x372c28[_0xbeec('0x3e')]=_[_0xbeec('0x51')](_0x4f8f76['query']);_0x372c28[_0xbeec('0x45')]=_[_0xbeec('0x3f')](_0x372c28[_0xbeec('0x3c')],_0x372c28[_0xbeec('0x3e')]);_0x3470c5[_0xbeec('0x40')]=_[_0xbeec('0x3f')](_0x372c28[_0xbeec('0x3c')],qs[_0xbeec('0x41')](_0x4f8f76[_0xbeec('0x3e')]['fields']));_0x3470c5['attributes']=_0x3470c5[_0xbeec('0x40')][_0xbeec('0x42')]?_0x3470c5['attributes']:_0x372c28[_0xbeec('0x3c')];if(_0x4f8f76[_0xbeec('0x3e')][_0xbeec('0x4c')]){_0x3470c5[_0xbeec('0x4d')]=[{'all':!![]}];}_0x3470c5=_[_0xbeec('0x49')]({},_0x3470c5,_0x4f8f76['options']);return db[_0xbeec('0x4b')][_0xbeec('0x52')](_0x3470c5)['then'](handleEntityNotFound(_0xb2641c,null))[_0xbeec('0x1f')](respondWithResult(_0xb2641c,null))[_0xbeec('0x28')](handleError(_0xb2641c,null));};exports[_0xbeec('0x53')]=function(_0x4f951d,_0x3981ab){return db[_0xbeec('0x4b')]['create'](_0x4f951d[_0xbeec('0x54')],{})[_0xbeec('0x1f')](respondWithResult(_0x3981ab,0xc9))[_0xbeec('0x28')](handleError(_0x3981ab,null));};exports[_0xbeec('0x55')]=function(_0x2f6390,_0x4dc353){if(_0x2f6390[_0xbeec('0x54')]['id']){delete _0x2f6390[_0xbeec('0x54')]['id'];}return db[_0xbeec('0x4b')]['find']({'where':{'id':_0x2f6390['params']['id']}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4dc353,null))[_0xbeec('0x1f')](saveUpdates(_0x2f6390[_0xbeec('0x54')],null))[_0xbeec('0x1f')](respondWithResult(_0x4dc353,null))['catch'](handleError(_0x4dc353,null));};exports['destroy']=function(_0x31de80,_0xe657f7){return db[_0xbeec('0x4b')]['find']({'where':{'id':_0x31de80[_0xbeec('0x50')]['id']}})['then'](handleEntityNotFound(_0xe657f7,null))[_0xbeec('0x1f')](removeEntity(_0xe657f7,null))[_0xbeec('0x28')](handleError(_0xe657f7,null));};exports[_0xbeec('0x56')]=function(_0x31eea2,_0x1320c1){return db[_0xbeec('0x4b')][_0xbeec('0x56')]()[_0xbeec('0x1f')](respondWithResult(_0x1320c1,null))[_0xbeec('0x28')](handleError(_0x1320c1,null));};var interaction_log=require(_0xbeec('0x16'))(_0xbeec('0x57'));exports[_0xbeec('0x58')]=function(_0xd08b82,_0xc86c89,_0x1ad7d0){var _0x4982c0={'agent':{},'channel':_0xbeec('0x59')};if(_0xd08b82['body']['id']){delete _0xd08b82['body']['id'];}_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5a')]=!![];_0xd08b82['body']['readAt']=moment()[_0xbeec('0x5b')](_0xbeec('0x5c'));_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5d')]=_0xd08b82['body'][_0xbeec('0x5d')]||_0xd08b82[_0xbeec('0x5e')]['id'];_0x4982c0['agent']['id']=_0xd08b82['body']['UserId'];return db[_0xbeec('0x4b')]['find']({'where':{'id':_0xd08b82[_0xbeec('0x50')]['id'],'UserId':null}})[_0xbeec('0x1f')](handleEntityNotFound(_0xc86c89,null))[_0xbeec('0x1f')](saveUpdates(_0xd08b82[_0xbeec('0x54')],null))[_0xbeec('0x1f')](function(_0x53769d){if(_0x53769d){_0x4982c0[_0xbeec('0x26')]=_0x53769d[_0xbeec('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0xbeec('0x52')]({'where':{'id':_0x53769d[_0xbeec('0x60')]}});}return null;})[_0xbeec('0x1f')](handleEntityNotFound(_0xc86c89,null))['then'](function(_0x1d02a5){if(_0x1d02a5){return _0x1d02a5[_0xbeec('0x55')]({'UserId':_0xd08b82[_0xbeec('0x54')][_0xbeec('0x5d')],'read1stAt':_[_0xbeec('0x61')](_0x1d02a5[_0xbeec('0x62')])?moment()[_0xbeec('0x5b')](_0xbeec('0x5c')):undefined});}return null;})[_0xbeec('0x1f')](function(_0x3914a6){if(_0x3914a6){_0x4982c0[_0xbeec('0x63')]=_0x3914a6[_0xbeec('0x5f')]({'plain':!![]});interaction_log['info'](_0xbeec('0x64'),_0xd08b82['user']['id'],_0xd08b82['user'][_0xbeec('0x36')],_0xd08b82[_0xbeec('0x5e')][_0xbeec('0x65')],_0x4982c0['interaction']['id'],_0xd08b82[_0xbeec('0x54')]?JSON[_0xbeec('0x23')](_0xd08b82[_0xbeec('0x54')]):'null');return respondWithRpcPromise(_0xbeec('0x66'),_0xbeec('0x67'),_0x4982c0);}return null;})[_0xbeec('0x1f')](function(_0xa74d49){var _0x552604=_0xbeec('0x68')+_0xa74d49[_0xbeec('0x26')][_0xbeec('0x69')];return db[_0xbeec('0x6a')][_0xbeec('0x3e')](_0x552604,{'type':db[_0xbeec('0x6b')][_0xbeec('0x6c')][_0xbeec('0x6d')],'raw':!![]})[_0xbeec('0x1f')](function(_0x44abd){return _0x44abd;});})[_0xbeec('0x1f')](function(_0x212477){if(_0x212477){_0x4982c0[_0xbeec('0x26')][_0xbeec('0x6e')]=_0x212477[0x0];if(!_0xd08b82['body'][_0xbeec('0x5d')])return;return db[_0xbeec('0x6f')][_0xbeec('0x52')]({'where':{'id':_0xd08b82[_0xbeec('0x54')]['UserId'],'role':_0xbeec('0x70')},'attributes':['id',_0xbeec('0x36'),'fullname',_0xbeec('0x71'),'internal'],'raw':!![]});}return null;})[_0xbeec('0x1f')](function(_0x10efc1){if(!_0x10efc1)return null;_0x4982c0[_0xbeec('0x26')][_0xbeec('0x70')]=_0x10efc1;return _0x4982c0;})[_0xbeec('0x1f')](function(_0x57977c){if(_0x57977c){if(_0xd08b82[_0xbeec('0x54')]['manual']){_0x4982c0[_0xbeec('0x26')][_0xbeec('0x72')]=util['format']('SIP/%s',_0xd08b82[_0xbeec('0x5e')]['name']);_0x4982c0[_0xbeec('0x26')][_0xbeec('0x73')]=_0x4982c0[_0xbeec('0x73')];_0x4982c0[_0xbeec('0x26')][_0xbeec('0x74')]=_0x4982c0[_0xbeec('0x73')];_0x4982c0[_0xbeec('0x26')]['event']='accept';return respondWithRpcPromise('EventManager',_0xbeec('0x75'),{'event':'acceptmessage','message':_0x4982c0[_0xbeec('0x26')]},client9002)['then'](function(){return _0x4982c0;});}return _0x4982c0;}return null;})[_0xbeec('0x1f')](respondWithResult(_0xc86c89,null))[_0xbeec('0x28')](handleError(_0xc86c89,null));};var interaction_log=require(_0xbeec('0x16'))(_0xbeec('0x57'));exports[_0xbeec('0x31')]=function(_0x9bf6b,_0x524ac2,_0x2ee5d8){var _0x2d5c40={'agent':{},'channel':_0xbeec('0x59')};if(_0x9bf6b[_0xbeec('0x54')]['id']){delete _0x9bf6b['body']['id'];}_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')]=_0x9bf6b[_0xbeec('0x54')]['UserId']||_0x9bf6b[_0xbeec('0x5e')]['id'];_0x2d5c40[_0xbeec('0x70')]['id']=_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')];return db[_0xbeec('0x4b')][_0xbeec('0x52')]({'where':{'id':_0x9bf6b['params']['id'],'UserId':null}})[_0xbeec('0x1f')](handleEntityNotFound(_0x524ac2,null))[_0xbeec('0x1f')](function(_0x1593e9){if(_0x1593e9){_0x2d5c40['message']=_0x1593e9['get']({'plain':!![]});return db['WhatsappInteraction'][_0xbeec('0x52')]({'where':{'id':_0x1593e9[_0xbeec('0x60')]}});}return null;})[_0xbeec('0x1f')](handleEntityNotFound(_0x524ac2,null))[_0xbeec('0x1f')](function(_0x2314e7){if(_0x2314e7){_0x2d5c40[_0xbeec('0x63')]=_0x2314e7[_0xbeec('0x5f')]({'plain':!![]});interaction_log[_0xbeec('0x20')](_0xbeec('0x76'),_0x9bf6b[_0xbeec('0x5e')]['id'],_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x36')],_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x65')],_0x2d5c40['interaction']['id'],_0x9bf6b[_0xbeec('0x54')]?JSON[_0xbeec('0x23')](_0x9bf6b['body']):_0xbeec('0x77'));return respondWithRpcPromise(_0xbeec('0x78'),'rejectMessage',_0x2d5c40);}return null;})['then'](function(_0x2ffa74){var _0x47095e=_0xbeec('0x68')+_0x2ffa74['message'][_0xbeec('0x69')];return db[_0xbeec('0x6a')][_0xbeec('0x3e')](_0x47095e,{'type':db[_0xbeec('0x6b')][_0xbeec('0x6c')][_0xbeec('0x6d')],'raw':!![]})[_0xbeec('0x1f')](function(_0x2609c7){return _0x2609c7;});})[_0xbeec('0x1f')](function(_0x142978){if(_0x142978){_0x2d5c40[_0xbeec('0x26')][_0xbeec('0x6e')]=_0x142978[0x0];if(!_0x9bf6b[_0xbeec('0x54')]['UserId'])return;return db['User'][_0xbeec('0x52')]({'where':{'id':_0x9bf6b[_0xbeec('0x54')][_0xbeec('0x5d')],'role':_0xbeec('0x70')},'attributes':['id',_0xbeec('0x36'),_0xbeec('0x79'),'email',_0xbeec('0x7a')],'raw':!![]});}return null;})[_0xbeec('0x1f')](function(_0x3d8053){if(!_0x3d8053)return null;_0x2d5c40['message']['agent']=_0x3d8053;return _0x2d5c40;})[_0xbeec('0x1f')](function(_0x5f2b02){if(_0x5f2b02){_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x72')]=util[_0xbeec('0x5b')]('SIP/%s',_0x9bf6b[_0xbeec('0x5e')][_0xbeec('0x36')]);_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x73')]=_0x2d5c40[_0xbeec('0x73')];_0x5f2b02[_0xbeec('0x26')][_0xbeec('0x74')]=_0x2d5c40[_0xbeec('0x73')];_0x5f2b02['message'][_0xbeec('0x7b')]=_0xbeec('0x31');respondWithRpcPromise(_0xbeec('0x75'),_0xbeec('0x75'),{'event':'rejectmessage','message':_0x5f2b02[_0xbeec('0x26')]},client9002);return _0x2d5c40;}return null;})[_0xbeec('0x1f')](respondWithResult(_0x524ac2,null))[_0xbeec('0x28')](handleError(_0x524ac2,null));};exports[_0xbeec('0x2a')]=function(_0x16d201,_0x4e27ee,_0x224555){if(_0x16d201[_0xbeec('0x54')]['id']){delete _0x16d201[_0xbeec('0x54')]['id'];}var _0x4d2002;return db[_0xbeec('0x4b')][_0xbeec('0x52')]({'where':{'id':_0x16d201[_0xbeec('0x50')]['id']}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4e27ee,null))['then'](function(_0x4627a0){if(_0x4627a0){_0x4d2002=_0x4627a0;return db['WhatsappAccount'][_0xbeec('0x52')]({'where':{'id':_0x4627a0[_0xbeec('0x7c')]}});}})[_0xbeec('0x1f')](handleEntityNotFound(_0x4e27ee,null))[_0xbeec('0x1f')](function(_0x811beb){if(_0x811beb){logger[_0xbeec('0x22')](_0xbeec('0x7d'),_0xbeec('0x2a'),_0xbeec('0x7e'),_0x811beb['type'],util['inspect'](_0x16d201['body'],{'showHidden':![],'depth':null}));switch(_0x811beb['type']){case _0xbeec('0x7f'):if(_0x16d201[_0xbeec('0x54')][_0xbeec('0x80')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x80')]===_0x4d2002[_0xbeec('0x81')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x82')]&&_0x16d201[_0xbeec('0x54')][_0xbeec('0x82')]===_0xbeec('0x5a')){return _0x4d2002[_0xbeec('0x55')]({'read':!![]});}else{logger[_0xbeec('0x24')](_0xbeec('0x83'),_0xbeec('0x2a'),_0xbeec('0x7f'),util[_0xbeec('0x84')](_0x16d201[_0xbeec('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4d2002;}})[_0xbeec('0x1f')](respondWithResult(_0x4e27ee,null))[_0xbeec('0x28')](handleError(_0x4e27ee,null));}; \ No newline at end of file +var _0x08ed=['type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappMessage','findAll','rows','catch','show','params','length','find','create','body','update','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','WhatsappInteractionId','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','WhatsappAccountId','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','stack','name','map','rawAttributes','fieldName'];(function(_0x41185c,_0x4a60e2){var _0x4c7228=function(_0x12810d){while(--_0x12810d){_0x41185c['push'](_0x41185c['shift']());}};_0x4c7228(++_0x4a60e2);}(_0x08ed,0xd6));var _0xd08e=function(_0x6e9a01,_0x41ab36){_0x6e9a01=_0x6e9a01-0x0;var _0x238469=_0x08ed[_0x6e9a01];return _0x238469;};'use strict';var emlformat=require(_0xd08e('0x0'));var rimraf=require(_0xd08e('0x1'));var zipdir=require(_0xd08e('0x2'));var jsonpatch=require(_0xd08e('0x3'));var rp=require(_0xd08e('0x4'));var moment=require(_0xd08e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd08e('0x6'));var util=require(_0xd08e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd08e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd08e('0x9'));var crypto=require('crypto');var jsforce=require(_0xd08e('0xa'));var deskjs=require(_0xd08e('0xb'));var toCsv=require(_0xd08e('0x8'));var querystring=require('querystring');var Papa=require(_0xd08e('0xc'));var Redis=require(_0xd08e('0xd'));var authService=require(_0xd08e('0xe'));var qs=require(_0xd08e('0xf'));var as=require(_0xd08e('0x10'));var hardwareService=require(_0xd08e('0x11'));var logger=require('../../config/logger')(_0xd08e('0x12'));var utils=require(_0xd08e('0x13'));var config=require(_0xd08e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd08e('0x15'))['db'];config[_0xd08e('0x16')]=_[_0xd08e('0x17')](config[_0xd08e('0x16')],{'host':_0xd08e('0x18'),'port':0x18eb});var socket=require(_0xd08e('0x19'))(new Redis(config[_0xd08e('0x16')]));require(_0xd08e('0x1a'))[_0xd08e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd08e('0x1c')][_0xd08e('0x1d')]({'port':0x232c});var client9002=jayson[_0xd08e('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b469,_0x34d2c0,_0x1c211a,_0x230774){return new BPromise(function(_0x1f29b5,_0x10217f){var _0x18fa3e=_0x230774||client;return _0x18fa3e[_0xd08e('0x1e')](_0x42b469,_0x1c211a)['then'](function(_0x15ef1e){logger[_0xd08e('0x1f')](_0xd08e('0x20'),_0x34d2c0,_0xd08e('0x21'));logger[_0xd08e('0x22')](_0xd08e('0x23'),_0x34d2c0,_0xd08e('0x21'),JSON[_0xd08e('0x24')](_0x15ef1e));if(_0x15ef1e[_0xd08e('0x25')]){if(_0x15ef1e[_0xd08e('0x25')][_0xd08e('0x26')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x34d2c0,_0x15ef1e[_0xd08e('0x25')]['message']);return _0x10217f(_0x15ef1e[_0xd08e('0x25')]['message']);}logger['error'](_0xd08e('0x20'),_0x34d2c0,_0x15ef1e[_0xd08e('0x25')][_0xd08e('0x27')]);return _0x1f29b5(_0x15ef1e['error'][_0xd08e('0x27')]);}else{logger[_0xd08e('0x1f')](_0xd08e('0x20'),_0x34d2c0,'request\x20sent');_0x1f29b5(_0x15ef1e['result']['message']);}})['catch'](function(_0x3391f2){logger['error'](_0xd08e('0x20'),_0x34d2c0,_0x3391f2);_0x10217f(_0x3391f2);});});}function respondWithStatusCode(_0x4fe2b8,_0x26b557){_0x26b557=_0x26b557||0xcc;return function(_0xc22d9f){if(_0xc22d9f){return _0x4fe2b8[_0xd08e('0x28')](_0x26b557);}return _0x4fe2b8[_0xd08e('0x29')](_0x26b557)[_0xd08e('0x2a')]();};}function respondWithResult(_0x3267a7,_0x484465){_0x484465=_0x484465||0xc8;return function(_0x31cce4){if(_0x31cce4){return _0x3267a7[_0xd08e('0x29')](_0x484465)['json'](_0x31cce4);}};}function respondWithFilteredResult(_0x2c2de0,_0x2da249){return function(_0x51fc67){if(_0x51fc67){var _0x462fff=typeof _0x2da249[_0xd08e('0x2b')]===_0xd08e('0x2c')&&typeof _0x2da249['limit']===_0xd08e('0x2c');var _0x36713a=_0x51fc67[_0xd08e('0x2d')];var _0x45cb54=_0x462fff?0x0:_0x2da249['offset'];var _0x55ae3e=_0x462fff?_0x51fc67[_0xd08e('0x2d')]:_0x2da249['offset']+_0x2da249[_0xd08e('0x2e')];var _0x16a63c;if(_0x55ae3e>=_0x36713a){_0x55ae3e=_0x36713a;_0x16a63c=0xc8;}else{_0x16a63c=0xce;}_0x2c2de0[_0xd08e('0x29')](_0x16a63c);return _0x2c2de0[_0xd08e('0x2f')](_0xd08e('0x30'),_0x45cb54+'-'+_0x55ae3e+'/'+_0x36713a)['json'](_0x51fc67);}return null;};}function patchUpdates(_0x35486e){return function(_0x216b52){try{jsonpatch['apply'](_0x216b52,_0x35486e,!![]);}catch(_0x26b45f){return BPromise[_0xd08e('0x31')](_0x26b45f);}return _0x216b52[_0xd08e('0x32')]();};}function saveUpdates(_0x3fa1ee,_0x1cb99e){return function(_0xd7672c){if(_0xd7672c){return _0xd7672c['update'](_0x3fa1ee)[_0xd08e('0x33')](function(_0x3c9486){return _0x3c9486;});}return null;};}function removeEntity(_0xb8063d,_0x3c3453){return function(_0x4a4513){if(_0x4a4513){return _0x4a4513[_0xd08e('0x34')]()[_0xd08e('0x33')](function(){_0xb8063d['status'](0xcc)[_0xd08e('0x2a')]();});}};}function handleEntityNotFound(_0x631e96,_0x8db14e){return function(_0x22e1a8){if(!_0x22e1a8){_0x631e96[_0xd08e('0x28')](0x194);}return _0x22e1a8;};}function handleError(_0x1a6cca,_0x13a374){_0x13a374=_0x13a374||0x1f4;return function(_0xebc3f7){logger[_0xd08e('0x25')](_0xebc3f7[_0xd08e('0x35')]);if(_0xebc3f7[_0xd08e('0x36')]){delete _0xebc3f7[_0xd08e('0x36')];}_0x1a6cca[_0xd08e('0x29')](_0x13a374)['send'](_0xebc3f7);};}exports['index']=function(_0x4d26d2,_0x5a393f){var _0x16833f={},_0x25fe18={},_0x181430={'count':0x0,'rows':[]};var _0x330954=_[_0xd08e('0x37')](db['WhatsappMessage'][_0xd08e('0x38')],function(_0x323852){return{'name':_0x323852[_0xd08e('0x39')],'type':_0x323852[_0xd08e('0x3a')][_0xd08e('0x3b')]};});_0x25fe18['model']=_[_0xd08e('0x37')](_0x330954,_0xd08e('0x36'));_0x25fe18['query']=_[_0xd08e('0x3c')](_0x4d26d2[_0xd08e('0x3d')]);_0x25fe18[_0xd08e('0x3e')]=_[_0xd08e('0x3f')](_0x25fe18[_0xd08e('0x40')],_0x25fe18[_0xd08e('0x3d')]);_0x16833f[_0xd08e('0x41')]=_['intersection'](_0x25fe18[_0xd08e('0x40')],qs[_0xd08e('0x42')](_0x4d26d2[_0xd08e('0x3d')][_0xd08e('0x42')]));_0x16833f[_0xd08e('0x41')]=_0x16833f['attributes']['length']?_0x16833f[_0xd08e('0x41')]:_0x25fe18[_0xd08e('0x40')];if(!_0x4d26d2['query']['hasOwnProperty'](_0xd08e('0x43'))){_0x16833f[_0xd08e('0x2e')]=qs[_0xd08e('0x2e')](_0x4d26d2[_0xd08e('0x3d')]['limit']);_0x16833f[_0xd08e('0x2b')]=qs[_0xd08e('0x2b')](_0x4d26d2[_0xd08e('0x3d')][_0xd08e('0x2b')]);}_0x16833f[_0xd08e('0x44')]=qs[_0xd08e('0x45')](_0x4d26d2[_0xd08e('0x3d')][_0xd08e('0x45')]);_0x16833f[_0xd08e('0x46')]=qs['filters'](_[_0xd08e('0x47')](_0x4d26d2[_0xd08e('0x3d')],_0x25fe18[_0xd08e('0x3e')]),_0x330954);if(_0x4d26d2[_0xd08e('0x3d')]['filter']){_0x16833f[_0xd08e('0x46')]=_[_0xd08e('0x48')](_0x16833f[_0xd08e('0x46')],{'$or':_[_0xd08e('0x37')](_0x330954,function(_0x43a0ca){if(_0x43a0ca[_0xd08e('0x3a')]!==_0xd08e('0x49')){var _0x50a001={};_0x50a001[_0x43a0ca[_0xd08e('0x36')]]={'$like':'%'+_0x4d26d2[_0xd08e('0x3d')][_0xd08e('0x4a')]+'%'};return _0x50a001;}})});}_0x16833f=_['merge']({},_0x16833f,_0x4d26d2[_0xd08e('0x4b')]);var _0x1c706e={'where':_0x16833f[_0xd08e('0x46')]};return db['WhatsappMessage'][_0xd08e('0x2d')](_0x1c706e)[_0xd08e('0x33')](function(_0x10bf89){_0x181430[_0xd08e('0x2d')]=_0x10bf89;if(_0x4d26d2[_0xd08e('0x3d')][_0xd08e('0x4c')]){_0x16833f[_0xd08e('0x4d')]=[{'all':!![]}];}return db[_0xd08e('0x4e')][_0xd08e('0x4f')](_0x16833f);})['then'](function(_0x27b3d3){_0x181430[_0xd08e('0x50')]=_0x27b3d3;return _0x181430;})[_0xd08e('0x33')](respondWithFilteredResult(_0x5a393f,_0x16833f))[_0xd08e('0x51')](handleError(_0x5a393f,null));};exports[_0xd08e('0x52')]=function(_0x2e793f,_0x29cbc7){var _0x3c4a8e={'raw':!![],'where':{'id':_0x2e793f[_0xd08e('0x53')]['id']}},_0x5db243={};_0x5db243[_0xd08e('0x40')]=_['keys'](db[_0xd08e('0x4e')][_0xd08e('0x38')]);_0x5db243[_0xd08e('0x3d')]=_[_0xd08e('0x3c')](_0x2e793f[_0xd08e('0x3d')]);_0x5db243[_0xd08e('0x3e')]=_['intersection'](_0x5db243[_0xd08e('0x40')],_0x5db243[_0xd08e('0x3d')]);_0x3c4a8e[_0xd08e('0x41')]=_[_0xd08e('0x3f')](_0x5db243[_0xd08e('0x40')],qs['fields'](_0x2e793f[_0xd08e('0x3d')][_0xd08e('0x42')]));_0x3c4a8e[_0xd08e('0x41')]=_0x3c4a8e[_0xd08e('0x41')][_0xd08e('0x54')]?_0x3c4a8e['attributes']:_0x5db243[_0xd08e('0x40')];if(_0x2e793f[_0xd08e('0x3d')]['includeAll']){_0x3c4a8e['include']=[{'all':!![]}];}_0x3c4a8e=_[_0xd08e('0x48')]({},_0x3c4a8e,_0x2e793f[_0xd08e('0x4b')]);return db[_0xd08e('0x4e')][_0xd08e('0x55')](_0x3c4a8e)[_0xd08e('0x33')](handleEntityNotFound(_0x29cbc7,null))['then'](respondWithResult(_0x29cbc7,null))[_0xd08e('0x51')](handleError(_0x29cbc7,null));};exports['create']=function(_0x154107,_0x4067c8){return db[_0xd08e('0x4e')][_0xd08e('0x56')](_0x154107[_0xd08e('0x57')],{})['then'](respondWithResult(_0x4067c8,0xc9))['catch'](handleError(_0x4067c8,null));};exports[_0xd08e('0x58')]=function(_0x33f698,_0x43a736){if(_0x33f698[_0xd08e('0x57')]['id']){delete _0x33f698[_0xd08e('0x57')]['id'];}return db[_0xd08e('0x4e')]['find']({'where':{'id':_0x33f698['params']['id']}})['then'](handleEntityNotFound(_0x43a736,null))['then'](saveUpdates(_0x33f698[_0xd08e('0x57')],null))[_0xd08e('0x33')](respondWithResult(_0x43a736,null))[_0xd08e('0x51')](handleError(_0x43a736,null));};exports[_0xd08e('0x34')]=function(_0x1ae38b,_0x5e7c1a){return db[_0xd08e('0x4e')][_0xd08e('0x55')]({'where':{'id':_0x1ae38b['params']['id']}})[_0xd08e('0x33')](handleEntityNotFound(_0x5e7c1a,null))[_0xd08e('0x33')](removeEntity(_0x5e7c1a,null))[_0xd08e('0x51')](handleError(_0x5e7c1a,null));};exports[_0xd08e('0x59')]=function(_0x3ee41d,_0x49f1ad){return db[_0xd08e('0x4e')][_0xd08e('0x59')]()[_0xd08e('0x33')](respondWithResult(_0x49f1ad,null))[_0xd08e('0x51')](handleError(_0x49f1ad,null));};var interaction_log=require(_0xd08e('0x5a'))(_0xd08e('0x5b'));exports['accept']=function(_0x25f7a5,_0x34fb97,_0x2ad70f){var _0x221ff9={'agent':{},'channel':_0xd08e('0x5c')};if(_0x25f7a5[_0xd08e('0x57')]['id']){delete _0x25f7a5[_0xd08e('0x57')]['id'];}_0x25f7a5[_0xd08e('0x57')][_0xd08e('0x5d')]=!![];_0x25f7a5['body'][_0xd08e('0x5e')]=moment()[_0xd08e('0x5f')](_0xd08e('0x60'));_0x25f7a5[_0xd08e('0x57')][_0xd08e('0x61')]=_0x25f7a5[_0xd08e('0x57')][_0xd08e('0x61')]||_0x25f7a5['user']['id'];_0x221ff9[_0xd08e('0x62')]['id']=_0x25f7a5[_0xd08e('0x57')][_0xd08e('0x61')];return db[_0xd08e('0x4e')][_0xd08e('0x55')]({'where':{'id':_0x25f7a5[_0xd08e('0x53')]['id'],'UserId':null}})[_0xd08e('0x33')](handleEntityNotFound(_0x34fb97,null))['then'](saveUpdates(_0x25f7a5[_0xd08e('0x57')],null))[_0xd08e('0x33')](function(_0x5064de){if(_0x5064de){_0x221ff9[_0xd08e('0x27')]=_0x5064de[_0xd08e('0x63')]({'plain':!![]});return db[_0xd08e('0x64')][_0xd08e('0x55')]({'where':{'id':_0x5064de['WhatsappInteractionId']}});}return null;})[_0xd08e('0x33')](handleEntityNotFound(_0x34fb97,null))[_0xd08e('0x33')](function(_0x53d264){if(_0x53d264){return _0x53d264[_0xd08e('0x58')]({'UserId':_0x25f7a5['body'][_0xd08e('0x61')],'read1stAt':_[_0xd08e('0x65')](_0x53d264['read1stAt'])?moment()['format'](_0xd08e('0x60')):undefined});}return null;})['then'](function(_0x539818){if(_0x539818){_0x221ff9[_0xd08e('0x66')]=_0x539818[_0xd08e('0x63')]({'plain':!![]});interaction_log[_0xd08e('0x1f')](_0xd08e('0x67'),_0x25f7a5[_0xd08e('0x68')]['id'],_0x25f7a5[_0xd08e('0x68')]['name'],_0x25f7a5['user'][_0xd08e('0x69')],_0x221ff9[_0xd08e('0x66')]['id'],_0x25f7a5[_0xd08e('0x57')]?JSON['stringify'](_0x25f7a5[_0xd08e('0x57')]):_0xd08e('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xd08e('0x6b'),_0x221ff9);}return null;})[_0xd08e('0x33')](function(_0x1ae2be){var _0x31b9db='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ae2be[_0xd08e('0x27')][_0xd08e('0x6c')];return db[_0xd08e('0x6d')][_0xd08e('0x3d')](_0x31b9db,{'type':db[_0xd08e('0x6e')]['QueryTypes'][_0xd08e('0x6f')],'raw':!![]})[_0xd08e('0x33')](function(_0x38b197){return _0x38b197;});})['then'](function(_0x241053){if(_0x241053){_0x221ff9['message'][_0xd08e('0x70')]=_0x241053[0x0];if(!_0x25f7a5['body'][_0xd08e('0x61')])return;return db[_0xd08e('0x71')][_0xd08e('0x55')]({'where':{'id':_0x25f7a5[_0xd08e('0x57')]['UserId'],'role':_0xd08e('0x62')},'attributes':['id',_0xd08e('0x36'),_0xd08e('0x72'),_0xd08e('0x73'),_0xd08e('0x74')],'raw':!![]});}return null;})['then'](function(_0x4727e2){if(!_0x4727e2)return null;_0x221ff9[_0xd08e('0x27')][_0xd08e('0x62')]=_0x4727e2;return _0x221ff9;})[_0xd08e('0x33')](function(_0x1c1fcc){if(_0x1c1fcc){if(_0x25f7a5[_0xd08e('0x57')]['manual']){_0x221ff9[_0xd08e('0x27')][_0xd08e('0x75')]=util[_0xd08e('0x5f')]('SIP/%s',_0x25f7a5[_0xd08e('0x68')][_0xd08e('0x36')]);_0x221ff9[_0xd08e('0x27')][_0xd08e('0x76')]=_0x221ff9[_0xd08e('0x76')];_0x221ff9['message'][_0xd08e('0x77')]=_0x221ff9[_0xd08e('0x76')];_0x221ff9['message'][_0xd08e('0x78')]=_0xd08e('0x79');return respondWithRpcPromise(_0xd08e('0x7a'),_0xd08e('0x7a'),{'event':_0xd08e('0x7b'),'message':_0x221ff9['message']},client9002)['then'](function(){return _0x221ff9;});}return _0x221ff9;}return null;})['then'](respondWithResult(_0x34fb97,null))[_0xd08e('0x51')](handleError(_0x34fb97,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xd08e('0x31')]=function(_0x1f2ac0,_0x385155,_0x4f9f6d){var _0x2c64b9={'agent':{},'channel':_0xd08e('0x5c')};if(_0x1f2ac0['body']['id']){delete _0x1f2ac0[_0xd08e('0x57')]['id'];}_0x1f2ac0[_0xd08e('0x57')]['UserId']=_0x1f2ac0[_0xd08e('0x57')][_0xd08e('0x61')]||_0x1f2ac0['user']['id'];_0x2c64b9[_0xd08e('0x62')]['id']=_0x1f2ac0[_0xd08e('0x57')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x1f2ac0[_0xd08e('0x53')]['id'],'UserId':null}})[_0xd08e('0x33')](handleEntityNotFound(_0x385155,null))['then'](function(_0x5e7de4){if(_0x5e7de4){_0x2c64b9[_0xd08e('0x27')]=_0x5e7de4[_0xd08e('0x63')]({'plain':!![]});return db[_0xd08e('0x64')][_0xd08e('0x55')]({'where':{'id':_0x5e7de4[_0xd08e('0x7c')]}});}return null;})[_0xd08e('0x33')](handleEntityNotFound(_0x385155,null))['then'](function(_0x252666){if(_0x252666){_0x2c64b9['interaction']=_0x252666[_0xd08e('0x63')]({'plain':!![]});interaction_log[_0xd08e('0x1f')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f2ac0['user']['id'],_0x1f2ac0[_0xd08e('0x68')][_0xd08e('0x36')],_0x1f2ac0[_0xd08e('0x68')][_0xd08e('0x69')],_0x2c64b9['interaction']['id'],_0x1f2ac0[_0xd08e('0x57')]?JSON[_0xd08e('0x24')](_0x1f2ac0[_0xd08e('0x57')]):_0xd08e('0x6a'));return respondWithRpcPromise('RejectMessage',_0xd08e('0x7d'),_0x2c64b9);}return null;})[_0xd08e('0x33')](function(_0x42de0a){var _0x456623=_0xd08e('0x7e')+_0x42de0a['message']['ContactId'];return db[_0xd08e('0x6d')]['query'](_0x456623,{'type':db[_0xd08e('0x6e')][_0xd08e('0x7f')][_0xd08e('0x6f')],'raw':!![]})[_0xd08e('0x33')](function(_0x131dbc){return _0x131dbc;});})[_0xd08e('0x33')](function(_0x1d54f5){if(_0x1d54f5){_0x2c64b9['message'][_0xd08e('0x70')]=_0x1d54f5[0x0];if(!_0x1f2ac0[_0xd08e('0x57')]['UserId'])return;return db[_0xd08e('0x71')][_0xd08e('0x55')]({'where':{'id':_0x1f2ac0['body']['UserId'],'role':'agent'},'attributes':['id','name',_0xd08e('0x72'),_0xd08e('0x73'),'internal'],'raw':!![]});}return null;})[_0xd08e('0x33')](function(_0x4e6da1){if(!_0x4e6da1)return null;_0x2c64b9['message']['agent']=_0x4e6da1;return _0x2c64b9;})['then'](function(_0x390c3c){if(_0x390c3c){_0x390c3c['message'][_0xd08e('0x75')]=util[_0xd08e('0x5f')](_0xd08e('0x80'),_0x1f2ac0[_0xd08e('0x68')][_0xd08e('0x36')]);_0x390c3c[_0xd08e('0x27')][_0xd08e('0x76')]=_0x2c64b9['channel'];_0x390c3c['message'][_0xd08e('0x77')]=_0x2c64b9[_0xd08e('0x76')];_0x390c3c['message'][_0xd08e('0x78')]=_0xd08e('0x31');respondWithRpcPromise(_0xd08e('0x7a'),'EventManager',{'event':'rejectmessage','message':_0x390c3c[_0xd08e('0x27')]},client9002);return _0x2c64b9;}return null;})[_0xd08e('0x33')](respondWithResult(_0x385155,null))[_0xd08e('0x51')](handleError(_0x385155,null));};exports[_0xd08e('0x29')]=function(_0x35d8ac,_0x429417,_0x5b0b38){if(_0x35d8ac['body']['id']){delete _0x35d8ac[_0xd08e('0x57')]['id'];}var _0xb6c907;return db[_0xd08e('0x4e')][_0xd08e('0x55')]({'where':{'id':_0x35d8ac[_0xd08e('0x53')]['id']}})['then'](handleEntityNotFound(_0x429417,null))[_0xd08e('0x33')](function(_0x190abf){if(_0x190abf){_0xb6c907=_0x190abf;return db['WhatsappAccount'][_0xd08e('0x55')]({'where':{'id':_0x190abf[_0xd08e('0x81')]}});}})[_0xd08e('0x33')](handleEntityNotFound(_0x429417,null))[_0xd08e('0x33')](function(_0x301a09){if(_0x301a09){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xd08e('0x29'),'received\x20delivery\x20report\x20from',_0x301a09[_0xd08e('0x3a')],util[_0xd08e('0x82')](_0x35d8ac[_0xd08e('0x57')],{'showHidden':![],'depth':null}));switch(_0x301a09[_0xd08e('0x3a')]){case _0xd08e('0x83'):if(_0x35d8ac[_0xd08e('0x57')][_0xd08e('0x84')]&&_0x35d8ac[_0xd08e('0x57')][_0xd08e('0x84')]===_0xb6c907[_0xd08e('0x85')]&&_0x35d8ac[_0xd08e('0x57')]['MessageStatus']&&_0x35d8ac[_0xd08e('0x57')][_0xd08e('0x86')]==='read'){return _0xb6c907['update']({'read':!![]});}else{logger[_0xd08e('0x25')](_0xd08e('0x87'),_0xd08e('0x29'),_0xd08e('0x83'),util[_0xd08e('0x82')](_0x35d8ac[_0xd08e('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xb6c907;}})['then'](respondWithResult(_0x429417,null))['catch'](handleError(_0x429417,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index eebbd04..f095e5e 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 _0x2f68=['../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','emit','exports'];(function(_0x39e1b2,_0x45d149){var _0x251326=function(_0x1ca5a8){while(--_0x1ca5a8){_0x39e1b2['push'](_0x39e1b2['shift']());}};_0x251326(++_0x45d149);}(_0x2f68,0x9a));var _0x82f6=function(_0x3f5838,_0x77434c){_0x3f5838=_0x3f5838-0x0;var _0x57afa1=_0x2f68[_0x3f5838];return _0x57afa1;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x82f6('0x0'))['db'][_0x82f6('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x82f6('0x2')](0x0);var events={'afterCreate':_0x82f6('0x3'),'afterUpdate':'update','afterDestroy':_0x82f6('0x4')};function emitEvent(_0x488d61){return function(_0x2a06dc,_0x2ab73d,_0x5dad09){WhatsappMessageEvents[_0x82f6('0x5')](_0x488d61+':'+_0x2a06dc['id'],_0x2a06dc);WhatsappMessageEvents[_0x82f6('0x5')](_0x488d61,_0x2a06dc);_0x5dad09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x82f6('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7894=['WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7894,0x170));var _0x4789=function(_0x1eda41,_0x165efd){_0x1eda41=_0x1eda41-0x0;var _0x1859d9=_0x7894[_0x1eda41];return _0x1859d9;};'use strict';var EventEmitter=require(_0x4789('0x0'));var WhatsappMessage=require(_0x4789('0x1'))['db'][_0x4789('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4789('0x3')](0x0);var events={'afterCreate':_0x4789('0x4'),'afterUpdate':_0x4789('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd4bd76){return function(_0x2b2dd3,_0x4e2393,_0x3394f6){WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76+':'+_0x2b2dd3['id'],_0x2b2dd3);WhatsappMessageEvents[_0x4789('0x6')](_0xd4bd76,_0x2b2dd3);_0x3394f6(null);};}for(var e in events){if(events[_0x4789('0x7')](e)){var event=events[e];WhatsappMessage[_0x4789('0x8')](e,emitEvent(event));}}module[_0x4789('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ba8484f..4e9b654 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 _0x961d=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/messages/','text','body','statuses','message_id','err','finally','lodash','util','moment','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','whatsapp:','phone','/api/whatsapp/messages/','sid','afterCreate','inspect'];(function(_0x370c2c,_0x1ef5a7){var _0x40fb96=function(_0x3a8d1b){while(--_0x3a8d1b){_0x370c2c['push'](_0x370c2c['shift']());}};_0x40fb96(++_0x1ef5a7);}(_0x961d,0x9c));var _0xd961=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x961d[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd961('0x2'));var BPromise=require('bluebird');var rp=require(_0xd961('0x3'));var fetch=require(_0xd961('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd961('0x5'));var config=require(_0xd961('0x6'));var attributes=require(_0xd961('0x7'));module[_0xd961('0x8')]=function(_0x5af184,_0xe3db7){return _0x5af184[_0xd961('0x9')](_0xd961('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd961('0xb'),'fields':['messageId']},{'name':_0xd961('0xc'),'fields':['body'],'type':_0xd961('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ef3a0,_0x5aa587,_0xa749bd){var _0x5e08a2=_0x5af184['models'];var _0x2a73fc=_0x5ef3a0['get']({'plain':!![]});if(_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()==='in'||_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()===_0xd961('0x10')&&!_0x2a73fc[_0xd961('0x11')]&&!_[_0xd961('0x12')](_0x2a73fc[_0xd961('0x13')])){_0x5e08a2[_0xd961('0x14')]['findOne']({'where':{'id':_0x2a73fc[_0xd961('0x15')]}})[_0xd961('0x16')](function(_0x4dffd7){if(_0x4dffd7){_0x4dffd7[_0xd961('0x17')]({'lastMsgAt':_0x2a73fc['createdAt'],'lastMsgDirection':_0x2a73fc[_0xd961('0xe')][_0xd961('0xf')]()});}})[_0xd961('0x18')](function(_0x4a7e2b){console[_0xd961('0x19')](_0x4a7e2b);});}if(_0x2a73fc[_0xd961('0xe')]==='out'&&!_0x2a73fc[_0xd961('0x11')]){var _0x120740;_0x5e08a2[_0xd961('0x1a')]['find']({'where':{'id':_0x2a73fc[_0xd961('0x1b')]},'raw':!![]})['then'](function(_0x489a1f){_0x120740=_0x489a1f;if(_0x120740&&_0x120740['type']){switch(_0x120740[_0xd961('0x1c')]){case _0xd961('0x1d'):var _0x46f80e=require('twilio');if(_0x120740['accountSid']&&_0x120740[_0xd961('0x1e')]&&_0x120740['phone']){var _0x2a58aa=new _0x46f80e(_0x120740[_0xd961('0x1f')],_0x120740[_0xd961('0x1e')]);_0x2a58aa[_0xd961('0x20')][_0xd961('0x21')]({'body':_0x2a73fc['body'],'to':_0xd961('0x22')+_0x2a73fc[_0xd961('0x23')],'from':_0xd961('0x22')+_0x120740[_0xd961('0x23')],'statusCallback':_0x120740['remote']+_0xd961('0x24')+_0x2a73fc['id']+'/status?token='+_0x120740['token']})['then'](function(_0x2dc29c){if(_0x2dc29c[_0xd961('0x25')]){return _0x5ef3a0[_0xd961('0x17')]({'messageId':_0x2dc29c[_0xd961('0x25')]});}})[_0xd961('0x18')](function(_0x5669ce){logger[_0xd961('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd961('0x26'),_0xd961('0x1d'),util[_0xd961('0x27')](_0x5669ce,{'showHidden':![],'depth':null}));});}else{logger[_0xd961('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd961('0x26'),_0xd961('0x1d'),_0xd961('0x28'));}break;case'sinch':var _0x1980f4=_0x120740[_0xd961('0x1f')];var _0x28d68c=_0x120740[_0xd961('0x1e')];var _0x51aa12=_0x120740[_0xd961('0x29')]+'/whatsapp/v1/'+_0x1980f4+_0xd961('0x2a');var _0x1fdf62={'to':[_0x2a73fc[_0xd961('0x23')]],'message':{'type':_0xd961('0x2b'),'text':_0x2a73fc[_0xd961('0x2c')]}};var _0x3590ef={'method':'POST','uri':_0x51aa12,'headers':{'Authorization':'Bearer\x20'+_0x28d68c,'Content-Type':'application/json'},'body':_0x1fdf62,'json':!![]};rp(_0x3590ef)[_0xd961('0x16')](function(_0xb39f65){if(_0xb39f65[_0xd961('0x2d')][0x0][_0xd961('0x2e')]){return _0x5ef3a0[_0xd961('0x17')]({'messageId':_0xb39f65[_0xd961('0x2d')][0x0][_0xd961('0x2e')]});}})[_0xd961('0x18')](function(_0x3da8de){logger[_0xd961('0x2f')]('WhatsappMessage,\x20%s',_0x3da8de);});break;}}})[_0xd961('0x30')](function(){_0xa749bd();});}else{_0xa749bd();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x739f=['/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappMessage.attributes','exports','define','whatsapp_messages','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','then','update','createdAt','catch','error','find','type','authToken','phone','accountSid','create','whatsapp:','/api/whatsapp/messages/'];(function(_0x59914a,_0x289e5a){var _0x54a3c0=function(_0x3eac8d){while(--_0x3eac8d){_0x59914a['push'](_0x59914a['shift']());}};_0x54a3c0(++_0x289e5a);}(_0x739f,0xbc));var _0xf739=function(_0x6a5774,_0x54ef93){_0x6a5774=_0x6a5774-0x0;var _0x14e02b=_0x739f[_0x6a5774];return _0x14e02b;};'use strict';var _=require(_0xf739('0x0'));var util=require(_0xf739('0x1'));var logger=require(_0xf739('0x2'))(_0xf739('0x3'));var moment=require(_0xf739('0x4'));var BPromise=require(_0xf739('0x5'));var rp=require(_0xf739('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xf739('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf739('0x8'));module[_0xf739('0x9')]=function(_0x58cec7,_0x57ae17){return _0x58cec7[_0xf739('0xa')]('WhatsappMessage',attributes,{'tableName':_0xf739('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xf739('0xc'),'fields':[_0xf739('0xd')],'type':_0xf739('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xecaeed,_0x24e8a9,_0x3b2f89){var _0x491710=_0x58cec7[_0xf739('0xf')];var _0x242615=_0xecaeed[_0xf739('0x10')]({'plain':!![]});if(_0x242615['direction'][_0xf739('0x11')]()==='in'||_0x242615[_0xf739('0x12')]['toLowerCase']()===_0xf739('0x13')&&!_0x242615[_0xf739('0x14')]&&!_[_0xf739('0x15')](_0x242615[_0xf739('0x16')])){_0x491710['WhatsappInteraction']['findOne']({'where':{'id':_0x242615['WhatsappInteractionId']}})[_0xf739('0x17')](function(_0x1a0d84){if(_0x1a0d84){_0x1a0d84[_0xf739('0x18')]({'lastMsgAt':_0x242615[_0xf739('0x19')],'lastMsgDirection':_0x242615[_0xf739('0x12')]['toLowerCase']()});}})[_0xf739('0x1a')](function(_0x509442){console[_0xf739('0x1b')](_0x509442);});}if(_0x242615[_0xf739('0x12')]===_0xf739('0x13')&&!_0x242615[_0xf739('0x14')]){var _0x3f9ce2;_0x491710['WhatsappAccount'][_0xf739('0x1c')]({'where':{'id':_0x242615['WhatsappAccountId']},'raw':!![]})[_0xf739('0x17')](function(_0xef1dd2){_0x3f9ce2=_0xef1dd2;if(_0x3f9ce2&&_0x3f9ce2[_0xf739('0x1d')]){switch(_0x3f9ce2['type']){case'twilio':var _0x26fe95=require('twilio');if(_0x3f9ce2['accountSid']&&_0x3f9ce2[_0xf739('0x1e')]&&_0x3f9ce2[_0xf739('0x1f')]){var _0x1c0d2d=new _0x26fe95(_0x3f9ce2[_0xf739('0x20')],_0x3f9ce2[_0xf739('0x1e')]);_0x1c0d2d['messages'][_0xf739('0x21')]({'body':_0x242615[_0xf739('0xd')],'to':_0xf739('0x22')+_0x242615[_0xf739('0x1f')],'from':_0xf739('0x22')+_0x3f9ce2['phone'],'statusCallback':_0x3f9ce2['remote']+_0xf739('0x23')+_0x242615['id']+_0xf739('0x24')+_0x3f9ce2[_0xf739('0x25')]})[_0xf739('0x17')](function(_0x4e0d5d){if(_0x4e0d5d['sid']){return _0xecaeed[_0xf739('0x18')]({'messageId':_0x4e0d5d[_0xf739('0x26')]});}})[_0xf739('0x1a')](function(_0x230298){logger[_0xf739('0x1b')](_0xf739('0x27'),_0xf739('0x28'),'twilio',util[_0xf739('0x29')](_0x230298,{'showHidden':![],'depth':null}));});}else{logger[_0xf739('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf739('0x28'),_0xf739('0x2a'),_0xf739('0x2b'));}break;case'sinch':var _0x29f8a9=_0x3f9ce2['accountSid'];var _0x3ac52c=_0x3f9ce2[_0xf739('0x1e')];var _0x531078=_0x3f9ce2[_0xf739('0x2c')]+_0xf739('0x2d')+_0x29f8a9+_0xf739('0x2e');var _0x11d897={'to':[_0x242615[_0xf739('0x1f')]],'message':{'type':'text','text':_0x242615[_0xf739('0xd')]}};var _0x2d5bce={'method':_0xf739('0x2f'),'uri':_0x531078,'headers':{'Authorization':_0xf739('0x30')+_0x3ac52c,'Content-Type':_0xf739('0x31')},'body':_0x11d897,'json':!![]};rp(_0x2d5bce)[_0xf739('0x17')](function(_0x24c243){if(_0x24c243[_0xf739('0x32')][0x0][_0xf739('0x33')]){return _0xecaeed[_0xf739('0x18')]({'messageId':_0x24c243[_0xf739('0x32')][0x0][_0xf739('0x33')]});}})['catch'](function(_0x5cdbc1){logger['err'](_0xf739('0x34'),_0x5cdbc1);});break;}}})[_0xf739('0x35')](function(){_0x3b2f89();});}else{_0x3b2f89();}}},'charset':_0xf739('0x36'),'collate':_0xf739('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 6b7bd50..4c1113b 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 _0xf115=['../../config/logger','../../config/environment','jayson/promise','http','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','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x54f8dc,_0x19b2d4){var _0x58cfca=function(_0x413684){while(--_0x413684){_0x54f8dc['push'](_0x54f8dc['shift']());}};_0x58cfca(++_0x19b2d4);}(_0xf115,0xd9));var _0x5f11=function(_0xa61fd1,_0x38e3fb){_0xa61fd1=_0xa61fd1-0x0;var _0x4f87f5=_0xf115[_0xa61fd1];return _0x4f87f5;};'use strict';var _=require(_0x5f11('0x0'));var util=require(_0x5f11('0x1'));var moment=require(_0x5f11('0x2'));var BPromise=require(_0x5f11('0x3'));var rs=require(_0x5f11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f11('0x5'))['db'];var utils=require(_0x5f11('0x6'));var logger=require(_0x5f11('0x7'))('rpc');var config=require(_0x5f11('0x8'));var jayson=require(_0x5f11('0x9'));var client=jayson['client'][_0x5f11('0xa')]({'port':0x232a});config[_0x5f11('0xb')]=_[_0x5f11('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f11('0xd'))(new Redis(config[_0x5f11('0xb')]));require(_0x5f11('0xe'))['register'](socket);function respondWithRpcPromise(_0x37492e,_0x23d102,_0x306a20){return new BPromise(function(_0x31e9c0,_0x4587fc){return client[_0x5f11('0xf')](_0x37492e,_0x306a20)[_0x5f11('0x10')](function(_0x16920e){logger[_0x5f11('0x11')](_0x5f11('0x12'),_0x23d102,_0x5f11('0x13'));logger[_0x5f11('0x14')](_0x5f11('0x15'),_0x23d102,_0x5f11('0x13'),JSON['stringify'](_0x16920e));if(_0x16920e[_0x5f11('0x16')]){if(_0x16920e[_0x5f11('0x16')]['code']===0x1f4){logger[_0x5f11('0x16')](_0x5f11('0x12'),_0x23d102,_0x16920e['error'][_0x5f11('0x17')]);return _0x4587fc(_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x23d102,_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);return _0x31e9c0(_0x16920e[_0x5f11('0x16')][_0x5f11('0x17')]);}else{logger[_0x5f11('0x11')](_0x5f11('0x12'),_0x23d102,_0x5f11('0x13'));_0x31e9c0(_0x16920e[_0x5f11('0x18')]['message']);}})[_0x5f11('0x19')](function(_0xcf3f82){logger['error'](_0x5f11('0x12'),_0x23d102,_0xcf3f82);_0x4587fc(_0xcf3f82);});});}exports[_0x5f11('0x1a')]=function(_0x6f4a39){var _0x3f5b54=this;return new Promise(function(_0x213b1b,_0x4356dc){return db[_0x5f11('0x1b')][_0x5f11('0x1c')](_0x6f4a39[_0x5f11('0x1d')],{'raw':_0x6f4a39['options']?_0x6f4a39['options'][_0x5f11('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x549fd8){logger['info']('CreateWhatsappMessage',_0x6f4a39);logger['debug'](_0x5f11('0x1a'),_0x6f4a39,JSON[_0x5f11('0x1f')](_0x549fd8));_0x213b1b(_0x549fd8);})[_0x5f11('0x19')](function(_0x24c48e){logger[_0x5f11('0x16')]('CreateWhatsappMessage',_0x24c48e[_0x5f11('0x17')],_0x6f4a39);_0x4356dc(_0x3f5b54[_0x5f11('0x16')](0x1f4,_0x24c48e[_0x5f11('0x17')]));});});}; \ No newline at end of file +var _0x73b8=['body','options','raw','stringify','util','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','localhost','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateWhatsappMessage','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x73b8,0xc1));var _0x873b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x73b8[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x873b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x873b('0x1'));var fs=require('fs');var Redis=require(_0x873b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x873b('0x3'));var logger=require(_0x873b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x873b('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x873b('0x6')]=_['defaults'](config['redis'],{'host':_0x873b('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x873b('0x6')]));require(_0x873b('0x8'))['register'](socket);function respondWithRpcPromise(_0x3e656b,_0x15ac12,_0x56c04c){return new BPromise(function(_0x1c9f14,_0x811580){return client[_0x873b('0x9')](_0x3e656b,_0x56c04c)[_0x873b('0xa')](function(_0x363a82){logger['info'](_0x873b('0xb'),_0x15ac12,_0x873b('0xc'));logger[_0x873b('0xd')](_0x873b('0xe'),_0x15ac12,_0x873b('0xc'),JSON['stringify'](_0x363a82));if(_0x363a82[_0x873b('0xf')]){if(_0x363a82[_0x873b('0xf')][_0x873b('0x10')]===0x1f4){logger[_0x873b('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x15ac12,_0x363a82[_0x873b('0xf')]['message']);return _0x811580(_0x363a82[_0x873b('0xf')]['message']);}logger[_0x873b('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x15ac12,_0x363a82[_0x873b('0xf')]['message']);return _0x1c9f14(_0x363a82[_0x873b('0xf')][_0x873b('0x11')]);}else{logger[_0x873b('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x15ac12,_0x873b('0xc'));_0x1c9f14(_0x363a82[_0x873b('0x13')][_0x873b('0x11')]);}})[_0x873b('0x14')](function(_0x3561c7){logger[_0x873b('0xf')](_0x873b('0xb'),_0x15ac12,_0x3561c7);_0x811580(_0x3561c7);});});}exports[_0x873b('0x15')]=function(_0x175e52){var _0x264c9f=this;return new Promise(function(_0x4bea1b,_0x324550){return db['WhatsappMessage'][_0x873b('0x16')](_0x175e52[_0x873b('0x17')],{'raw':_0x175e52[_0x873b('0x18')]?_0x175e52[_0x873b('0x18')][_0x873b('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5ca32c){logger[_0x873b('0x12')](_0x873b('0x15'),_0x175e52);logger[_0x873b('0xd')](_0x873b('0x15'),_0x175e52,JSON[_0x873b('0x1a')](_0x5ca32c));_0x4bea1b(_0x5ca32c);})['catch'](function(_0x24c5b1){logger['error']('CreateWhatsappMessage',_0x24c5b1[_0x873b('0x11')],_0x175e52);_0x324550(_0x264c9f[_0x873b('0xf')](0x1f4,_0x24c5b1[_0x873b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 90796fd..cd5eeb9 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 _0xc62d=['update','emit','removeListener','register','whatsappMessage:','save','remove'];(function(_0x32662c,_0x2b3566){var _0x3e4157=function(_0xb13c30){while(--_0xb13c30){_0x32662c['push'](_0x32662c['shift']());}};_0x3e4157(++_0x2b3566);}(_0xc62d,0x98));var _0xdc62=function(_0x4602e4,_0x378ee6){_0x4602e4=_0x4602e4-0x0;var _0x425e18=_0xc62d[_0x4602e4];return _0x425e18;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xdc62('0x0'),_0xdc62('0x1'),_0xdc62('0x2')];function createListener(_0x592c81,_0x3dcdec){return function(_0x36f300){_0x3dcdec[_0xdc62('0x3')](_0x592c81,_0x36f300);};}function removeListener(_0x18b53f,_0x301be8){return function(){WhatsappMessageEvents[_0xdc62('0x4')](_0x18b53f,_0x301be8);};}exports[_0xdc62('0x5')]=function(_0x2ce07e){for(var _0x1e7dce=0x0,_0x1dbe6f=events['length'];_0x1e7dce<_0x1dbe6f;_0x1e7dce++){var _0xd3586d=events[_0x1e7dce];var _0x5a535e=createListener(_0xdc62('0x6')+_0xd3586d,_0x2ce07e);WhatsappMessageEvents['on'](_0xd3586d,_0x5a535e);}}; \ No newline at end of file +var _0x450c=['emit','removeListener','length','./whatsappMessage.events','save','remove','update'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x450c,0x15a));var _0xc450=function(_0x51d8a1,_0x25af31){_0x51d8a1=_0x51d8a1-0x0;var _0xf3eefc=_0x450c[_0x51d8a1];return _0xf3eefc;};'use strict';var WhatsappMessageEvents=require(_0xc450('0x0'));var events=[_0xc450('0x1'),_0xc450('0x2'),_0xc450('0x3')];function createListener(_0x48cab5,_0x3b6f2c){return function(_0x1e1cf1){_0x3b6f2c[_0xc450('0x4')](_0x48cab5,_0x1e1cf1);};}function removeListener(_0x36f18f,_0x2017ae){return function(){WhatsappMessageEvents[_0xc450('0x5')](_0x36f18f,_0x2017ae);};}exports['register']=function(_0x76162){for(var _0x40638c=0x0,_0x5d984e=events[_0xc450('0x6')];_0x40638c<_0x5d984e;_0x40638c++){var _0x24b954=events[_0x40638c];var _0x55e2ac=createListener('whatsappMessage:'+_0x24b954,_0x76162);WhatsappMessageEvents['on'](_0x24b954,_0x55e2ac);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 4a38203..4fbb22e 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 _0x1779=['getAgents','addTeams','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users'];(function(_0x20073b,_0x9c031e){var _0x428d14=function(_0x1c6d8b){while(--_0x1c6d8b){_0x20073b['push'](_0x20073b['shift']());}};_0x428d14(++_0x9c031e);}(_0x1779,0x1f0));var _0x9177=function(_0x2ec2cb,_0x16c8bb){_0x2ec2cb=_0x2ec2cb-0x0;var _0x30b5f5=_0x1779[_0x2ec2cb];return _0x30b5f5;};'use strict';var multer=require(_0x9177('0x0'));var util=require(_0x9177('0x1'));var path=require(_0x9177('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9177('0x3'));var interaction=require(_0x9177('0x4'));var config=require(_0x9177('0x5'));var controller=require(_0x9177('0x6'));router['get']('/',auth[_0x9177('0x7')](),controller[_0x9177('0x8')]);router[_0x9177('0x9')](_0x9177('0xa'),auth[_0x9177('0x7')](),controller['describe']);router[_0x9177('0x9')](_0x9177('0xb'),auth[_0x9177('0x7')](),controller[_0x9177('0xc')]);router[_0x9177('0x9')](_0x9177('0xd'),auth[_0x9177('0x7')](),controller[_0x9177('0xe')]);router[_0x9177('0x9')](_0x9177('0xf'),auth[_0x9177('0x7')](),controller['getTeams']);router['get'](_0x9177('0x10'),auth['isAuthenticated'](),controller[_0x9177('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9177('0xf'),auth[_0x9177('0x7')](),controller[_0x9177('0x12')]);router['post'](_0x9177('0x10'),auth[_0x9177('0x7')](),controller[_0x9177('0x13')]);router[_0x9177('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9177('0x15')]);router['delete'](_0x9177('0xb'),auth['isAuthenticated'](),controller[_0x9177('0x16')]);router['delete'](_0x9177('0xf'),auth[_0x9177('0x7')](),controller[_0x9177('0x17')]);router[_0x9177('0x18')](_0x9177('0x10'),auth[_0x9177('0x7')](),controller[_0x9177('0x19')]);module[_0x9177('0x1a')]=router; \ No newline at end of file +var _0xb3c8=['getAgents','post','create','/:id/teams','put','delete','destroy','removeAgents','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users'];(function(_0x15f037,_0x8b736c){var _0x2a6bc4=function(_0x4eecb5){while(--_0x4eecb5){_0x15f037['push'](_0x15f037['shift']());}};_0x2a6bc4(++_0x8b736c);}(_0xb3c8,0xf3));var _0x8b3c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xb3c8[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8b3c('0x0'));var timeout=require(_0x8b3c('0x1'));var express=require(_0x8b3c('0x2'));var router=express['Router']();var fs_extra=require(_0x8b3c('0x3'));var auth=require(_0x8b3c('0x4'));var interaction=require(_0x8b3c('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x8b3c('0x6')]('/',auth[_0x8b3c('0x7')](),controller[_0x8b3c('0x8')]);router[_0x8b3c('0x6')](_0x8b3c('0x9'),auth[_0x8b3c('0x7')](),controller[_0x8b3c('0xa')]);router['get'](_0x8b3c('0xb'),auth[_0x8b3c('0x7')](),controller[_0x8b3c('0xc')]);router[_0x8b3c('0x6')](_0x8b3c('0xd'),auth[_0x8b3c('0x7')](),controller[_0x8b3c('0xe')]);router[_0x8b3c('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8b3c('0xf')]);router[_0x8b3c('0x6')](_0x8b3c('0x10'),auth['isAuthenticated'](),controller[_0x8b3c('0x11')]);router[_0x8b3c('0x12')]('/',auth[_0x8b3c('0x7')](),controller[_0x8b3c('0x13')]);router[_0x8b3c('0x12')](_0x8b3c('0x14'),auth[_0x8b3c('0x7')](),controller['addTeams']);router[_0x8b3c('0x12')]('/:id/users',auth[_0x8b3c('0x7')](),controller['addAgents']);router[_0x8b3c('0x15')](_0x8b3c('0xb'),auth[_0x8b3c('0x7')](),controller['update']);router[_0x8b3c('0x16')](_0x8b3c('0xb'),auth[_0x8b3c('0x7')](),controller[_0x8b3c('0x17')]);router[_0x8b3c('0x16')](_0x8b3c('0x14'),auth[_0x8b3c('0x7')](),controller['removeTeams']);router['delete'](_0x8b3c('0x10'),auth[_0x8b3c('0x7')](),controller[_0x8b3c('0x18')]);module[_0x8b3c('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 61b6a67..42bc51a 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 _0x22dd=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x570f65,_0x9ca295){var _0x2570cf=function(_0x4bd1e8){while(--_0x4bd1e8){_0x570f65['push'](_0x570f65['shift']());}};_0x2570cf(++_0x9ca295);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd22d('0x0'));module[_0xd22d('0x1')]={'name':{'type':Sequelize[_0xd22d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd22d('0x3')](_0xd22d('0x4'),_0xd22d('0x5'),_0xd22d('0x6'))},'description':{'type':Sequelize[_0xd22d('0x2')]}}; \ No newline at end of file +var _0xb75c=['sequelize','exports','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x186c34,_0x2b3001){var _0x4c2801=function(_0xd035ce){while(--_0xd035ce){_0x186c34['push'](_0x186c34['shift']());}};_0x4c2801(++_0x2b3001);}(_0xb75c,0x1ce));var _0xcb75=function(_0x123d79,_0x578253){_0x123d79=_0x123d79-0x0;var _0xf0ab1=_0xb75c[_0x123d79];return _0xf0ab1;};'use strict';var Sequelize=require(_0xcb75('0x0'));module[_0xcb75('0x1')]={'name':{'type':Sequelize[_0xcb75('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcb75('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcb75('0x4'),_0xcb75('0x5'),_0xcb75('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d554ad9..45bba42 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 _0xd4d7=['getTeams','Team','rawAttributes','order','addTeams','ids','findAll','User','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','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','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','name','send','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','where','filters','pick','filter','merge','type','VIRTUAL','options','WhatsappQueue','include','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','nolimit','sort','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','createdAt'];(function(_0x972b3c,_0x8053a9){var _0x58ac69=function(_0x368299){while(--_0x368299){_0x972b3c['push'](_0x972b3c['shift']());}};_0x58ac69(++_0x8053a9);}(_0xd4d7,0x148));var _0x7d4d=function(_0x3d6d05,_0x16c8b8){_0x3d6d05=_0x3d6d05-0x0;var _0x288baf=_0xd4d7[_0x3d6d05];return _0x288baf;};'use strict';var emlformat=require(_0x7d4d('0x0'));var rimraf=require(_0x7d4d('0x1'));var zipdir=require(_0x7d4d('0x2'));var jsonpatch=require(_0x7d4d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d4d('0x4'));var util=require(_0x7d4d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7d4d('0x6'));var ejs=require(_0x7d4d('0x7'));var fs=require('fs');var fs_extra=require(_0x7d4d('0x8'));var _=require(_0x7d4d('0x9'));var squel=require(_0x7d4d('0xa'));var crypto=require('crypto');var jsforce=require(_0x7d4d('0xb'));var deskjs=require(_0x7d4d('0xc'));var toCsv=require(_0x7d4d('0x6'));var querystring=require(_0x7d4d('0xd'));var Papa=require(_0x7d4d('0xe'));var Redis=require(_0x7d4d('0xf'));var authService=require(_0x7d4d('0x10'));var qs=require(_0x7d4d('0x11'));var as=require(_0x7d4d('0x12'));var hardwareService=require(_0x7d4d('0x13'));var logger=require(_0x7d4d('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7d4d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7d4d('0x16')](config[_0x7d4d('0x17')],{'host':_0x7d4d('0x18'),'port':0x18eb});var socket=require(_0x7d4d('0x19'))(new Redis(config['redis']));require(_0x7d4d('0x1a'))[_0x7d4d('0x1b')](socket);function respondWithStatusCode(_0x2fb4ad,_0x406563){_0x406563=_0x406563||0xcc;return function(_0x120027){if(_0x120027){return _0x2fb4ad[_0x7d4d('0x1c')](_0x406563);}return _0x2fb4ad[_0x7d4d('0x1d')](_0x406563)['end']();};}function respondWithResult(_0x19f98f,_0x52138f){_0x52138f=_0x52138f||0xc8;return function(_0x12c20b){if(_0x12c20b){return _0x19f98f['status'](_0x52138f)[_0x7d4d('0x1e')](_0x12c20b);}};}function respondWithFilteredResult(_0x217b10,_0x5587a9){return function(_0x4e8f68){if(_0x4e8f68){var _0x80813a=typeof _0x5587a9['offset']===_0x7d4d('0x1f')&&typeof _0x5587a9[_0x7d4d('0x20')]===_0x7d4d('0x1f');var _0x3bbf64=_0x4e8f68[_0x7d4d('0x21')];var _0x35a997=_0x80813a?0x0:_0x5587a9['offset'];var _0x22a1ce=_0x80813a?_0x4e8f68['count']:_0x5587a9[_0x7d4d('0x22')]+_0x5587a9[_0x7d4d('0x20')];var _0x285e71;if(_0x22a1ce>=_0x3bbf64){_0x22a1ce=_0x3bbf64;_0x285e71=0xc8;}else{_0x285e71=0xce;}_0x217b10[_0x7d4d('0x1d')](_0x285e71);return _0x217b10[_0x7d4d('0x23')](_0x7d4d('0x24'),_0x35a997+'-'+_0x22a1ce+'/'+_0x3bbf64)[_0x7d4d('0x1e')](_0x4e8f68);}return null;};}function patchUpdates(_0x1fe180){return function(_0x5f5e0d){try{jsonpatch[_0x7d4d('0x25')](_0x5f5e0d,_0x1fe180,!![]);}catch(_0x5599db){return BPromise[_0x7d4d('0x26')](_0x5599db);}return _0x5f5e0d[_0x7d4d('0x27')]();};}function saveUpdates(_0xa95708,_0x3eee94){return function(_0x1e1472){if(_0x1e1472){return _0x1e1472[_0x7d4d('0x28')](_0xa95708)[_0x7d4d('0x29')](function(_0x1041de){return _0x1041de;});}return null;};}function removeEntity(_0x9590df,_0x2e298a){return function(_0x544e5d){if(_0x544e5d){return _0x544e5d[_0x7d4d('0x2a')]()[_0x7d4d('0x29')](function(){var _0x8630d6=_0x544e5d[_0x7d4d('0x2b')]({'plain':!![]});var _0x507b0b=_0x7d4d('0x2c');return db[_0x7d4d('0x2d')]['destroy']({'where':{'type':_0x507b0b,'resourceId':_0x8630d6['id']}})[_0x7d4d('0x29')](function(){return _0x544e5d;});})[_0x7d4d('0x29')](function(){_0x9590df['status'](0xcc)[_0x7d4d('0x2e')]();});}};}function handleEntityNotFound(_0x13c265,_0x5905ee){return function(_0xf7bddc){if(!_0xf7bddc){_0x13c265[_0x7d4d('0x1c')](0x194);}return _0xf7bddc;};}function handleError(_0x10524b,_0x20f34f){_0x20f34f=_0x20f34f||0x1f4;return function(_0x2c6712){logger['error'](_0x2c6712['stack']);if(_0x2c6712[_0x7d4d('0x2f')]){delete _0x2c6712[_0x7d4d('0x2f')];}_0x10524b['status'](_0x20f34f)[_0x7d4d('0x30')](_0x2c6712);};}exports['index']=function(_0x26840d,_0x24e9a2){var _0x278fd5={},_0x3408a4={},_0x2aedbc={'count':0x0,'rows':[]};var _0x568a73=_['map'](db['WhatsappQueue']['rawAttributes'],function(_0x3a8217){return{'name':_0x3a8217[_0x7d4d('0x31')],'type':_0x3a8217['type']['key']};});_0x3408a4[_0x7d4d('0x32')]=_[_0x7d4d('0x33')](_0x568a73,_0x7d4d('0x2f'));_0x3408a4[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x26840d[_0x7d4d('0x34')]);_0x3408a4['filters']=_['intersection'](_0x3408a4['model'],_0x3408a4[_0x7d4d('0x34')]);_0x278fd5[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x3408a4[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x26840d[_0x7d4d('0x34')]['fields']));_0x278fd5[_0x7d4d('0x36')]=_0x278fd5[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x278fd5[_0x7d4d('0x36')]:_0x3408a4['model'];if(!_0x26840d[_0x7d4d('0x34')][_0x7d4d('0x3a')]('nolimit')){_0x278fd5['limit']=qs[_0x7d4d('0x20')](_0x26840d['query']['limit']);_0x278fd5[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x26840d[_0x7d4d('0x34')][_0x7d4d('0x22')]);}_0x278fd5['order']=qs['sort'](_0x26840d['query']['sort']);_0x278fd5[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_[_0x7d4d('0x3d')](_0x26840d[_0x7d4d('0x34')],_0x3408a4[_0x7d4d('0x3c')]),_0x568a73);if(_0x26840d['query'][_0x7d4d('0x3e')]){_0x278fd5[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x278fd5[_0x7d4d('0x3b')],{'$or':_['map'](_0x568a73,function(_0xacf4ab){if(_0xacf4ab[_0x7d4d('0x40')]!==_0x7d4d('0x41')){var _0x5191cf={};_0x5191cf[_0xacf4ab[_0x7d4d('0x2f')]]={'$like':'%'+_0x26840d[_0x7d4d('0x34')]['filter']+'%'};return _0x5191cf;}})});}_0x278fd5=_[_0x7d4d('0x3f')]({},_0x278fd5,_0x26840d[_0x7d4d('0x42')]);var _0x9b3928={'where':_0x278fd5[_0x7d4d('0x3b')]};return db[_0x7d4d('0x43')]['count'](_0x9b3928)[_0x7d4d('0x29')](function(_0x84ed5d){_0x2aedbc[_0x7d4d('0x21')]=_0x84ed5d;if(_0x26840d['query']['includeAll']){_0x278fd5[_0x7d4d('0x44')]=[{'all':!![]}];}return db[_0x7d4d('0x43')]['findAll'](_0x278fd5);})[_0x7d4d('0x29')](function(_0x1cec56){_0x2aedbc['rows']=_0x1cec56;return _0x2aedbc;})[_0x7d4d('0x29')](respondWithFilteredResult(_0x24e9a2,_0x278fd5))[_0x7d4d('0x45')](handleError(_0x24e9a2,null));};exports[_0x7d4d('0x46')]=function(_0x58135c,_0x2ab9b7){var _0x4d8e44={'raw':!![],'where':{'id':_0x58135c[_0x7d4d('0x47')]['id']}},_0x131a7c={};_0x131a7c['model']=_['keys'](db[_0x7d4d('0x43')]['rawAttributes']);_0x131a7c[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x58135c['query']);_0x131a7c[_0x7d4d('0x3c')]=_['intersection'](_0x131a7c[_0x7d4d('0x32')],_0x131a7c['query']);_0x4d8e44['attributes']=_['intersection'](_0x131a7c[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x58135c[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x4d8e44[_0x7d4d('0x36')]=_0x4d8e44[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x4d8e44[_0x7d4d('0x36')]:_0x131a7c['model'];if(_0x58135c[_0x7d4d('0x34')][_0x7d4d('0x48')]){_0x4d8e44['include']=[{'all':!![]}];}_0x4d8e44=_[_0x7d4d('0x3f')]({},_0x4d8e44,_0x58135c[_0x7d4d('0x42')]);return db[_0x7d4d('0x43')][_0x7d4d('0x49')](_0x4d8e44)[_0x7d4d('0x29')](handleEntityNotFound(_0x2ab9b7,null))[_0x7d4d('0x29')](respondWithResult(_0x2ab9b7,null))[_0x7d4d('0x45')](handleError(_0x2ab9b7,null));};exports[_0x7d4d('0x4a')]=function(_0x30dc80,_0x458d8c){return db[_0x7d4d('0x43')][_0x7d4d('0x4a')](_0x30dc80['body'],{})['then'](function(_0x375d2b){var _0x324562=_0x30dc80[_0x7d4d('0x4b')][_0x7d4d('0x2b')]({'plain':!![]});if(!_0x324562)throw new Error(_0x7d4d('0x4c'));if(_0x324562[_0x7d4d('0x4d')]==='user'){var _0x11a73=_0x375d2b[_0x7d4d('0x2b')]({'plain':!![]});var _0x1f3a35=_0x7d4d('0x2c');return db[_0x7d4d('0x4e')][_0x7d4d('0x49')]({'where':{'name':_0x1f3a35,'userProfileId':_0x324562[_0x7d4d('0x4f')]},'raw':!![]})[_0x7d4d('0x29')](function(_0x154f0f){if(_0x154f0f&&_0x154f0f[_0x7d4d('0x50')]===0x0){return db[_0x7d4d('0x2d')][_0x7d4d('0x4a')]({'name':_0x11a73[_0x7d4d('0x2f')],'resourceId':_0x11a73['id'],'type':_0x154f0f[_0x7d4d('0x2f')],'sectionId':_0x154f0f['id']},{})[_0x7d4d('0x29')](function(){return _0x375d2b;});}else{return _0x375d2b;}})['catch'](function(_0x5e5937){logger[_0x7d4d('0x51')](_0x7d4d('0x52'),_0x5e5937);throw _0x5e5937;});}return _0x375d2b;})[_0x7d4d('0x29')](respondWithResult(_0x458d8c,0xc9))[_0x7d4d('0x45')](handleError(_0x458d8c,null));};exports['update']=function(_0x5a7b78,_0x1b288f){if(_0x5a7b78[_0x7d4d('0x53')]['id']){delete _0x5a7b78[_0x7d4d('0x53')]['id'];}return db['WhatsappQueue'][_0x7d4d('0x49')]({'where':{'id':_0x5a7b78['params']['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x1b288f,null))[_0x7d4d('0x29')](saveUpdates(_0x5a7b78[_0x7d4d('0x53')],null))[_0x7d4d('0x29')](respondWithResult(_0x1b288f,null))[_0x7d4d('0x45')](handleError(_0x1b288f,null));};exports[_0x7d4d('0x2a')]=function(_0x5aa7a3,_0x3bd4d8){return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x5aa7a3[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x3bd4d8,null))[_0x7d4d('0x29')](removeEntity(_0x3bd4d8,null))[_0x7d4d('0x45')](handleError(_0x3bd4d8,null));};exports[_0x7d4d('0x54')]=function(_0x21a7fc,_0x52ef16){return db[_0x7d4d('0x43')][_0x7d4d('0x54')]()[_0x7d4d('0x29')](respondWithResult(_0x52ef16,null))[_0x7d4d('0x45')](handleError(_0x52ef16,null));};exports[_0x7d4d('0x55')]=function(_0x1539af,_0x586406,_0x23536d){var _0x3d4e09={'raw':!![],'where':{}},_0x5dbbc3={},_0x14141d;return db[_0x7d4d('0x43')][_0x7d4d('0x56')]({'where':{'id':_0x1539af[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x586406,null))[_0x7d4d('0x29')](function(_0x2801d6){if(_0x2801d6){_0x14141d=_0x2801d6[_0x7d4d('0x2b')]({'plain':!![]});_0x5dbbc3[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x57')]['rawAttributes']);_0x5dbbc3[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x1539af['query']);_0x5dbbc3['filters']=_[_0x7d4d('0x37')](_0x5dbbc3[_0x7d4d('0x32')],_0x5dbbc3[_0x7d4d('0x34')]);_0x3d4e09[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x5dbbc3[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x3d4e09['attributes']=_0x3d4e09[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x3d4e09[_0x7d4d('0x36')]:_0x5dbbc3['model'];if(!_0x1539af['query'][_0x7d4d('0x3a')](_0x7d4d('0x58'))){_0x3d4e09[_0x7d4d('0x20')]=qs[_0x7d4d('0x20')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x3d4e09[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x22')]);}_0x3d4e09['order']=qs[_0x7d4d('0x59')](_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x3d4e09[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_['pick'](_0x1539af[_0x7d4d('0x34')],_0x5dbbc3[_0x7d4d('0x3c')]));_0x3d4e09[_0x7d4d('0x3b')]['WhatsappQueueId']=_0x2801d6['id'];if(_0x1539af[_0x7d4d('0x34')][_0x7d4d('0x3e')]){_0x3d4e09[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x3d4e09[_0x7d4d('0x3b')],{'$or':_[_0x7d4d('0x33')](_0x3d4e09[_0x7d4d('0x36')],function(_0x18aae0){var _0x4f73ab={};_0x4f73ab[_0x18aae0]={'$like':'%'+_0x1539af[_0x7d4d('0x34')]['filter']+'%'};return _0x4f73ab;})});}_0x3d4e09=_[_0x7d4d('0x3f')]({},_0x3d4e09,_0x1539af[_0x7d4d('0x42')]);return db[_0x7d4d('0x57')]['findAll'](_0x3d4e09);}})[_0x7d4d('0x29')](function(_0x4b4c79){if(_0x4b4c79){return db['User'][_0x7d4d('0x5a')]({'where':{'id':_['map'](_0x4b4c79,_0x7d4d('0x5b')),'role':_0x7d4d('0x5c')},'attributes':['id','name',_0x7d4d('0x5d'),_0x7d4d('0x5e'),'createdAt']});}})['then'](function(_0x5c175e){if(_0x5c175e){return{'count':_0x5c175e[_0x7d4d('0x21')],'rows':_[_0x7d4d('0x33')](_0x5c175e[_0x7d4d('0x5f')],function(_0x2f8743){return{'membername':_0x2f8743[_0x7d4d('0x2f')],'UserId':_0x2f8743['id'],'queue_name':_0x14141d[_0x7d4d('0x2f')],'WhatsappQueueId':_0x14141d['id'],'interface':util[_0x7d4d('0x60')]('%s/%s','SIP',_0x2f8743[_0x7d4d('0x2f')]),'penalty':0x0,'paused':_0x2f8743['whatsappPause'],'createdAt':_0x2f8743[_0x7d4d('0x61')],'updatedAt':_0x2f8743[_0x7d4d('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7d4d('0x29')](respondWithFilteredResult(_0x586406,_0x3d4e09))[_0x7d4d('0x45')](handleError(_0x586406,null));};exports[_0x7d4d('0x62')]=function(_0x187463,_0x5df5d0,_0x2603a8){var _0x2856a9={};var _0x2360c0={};var _0x26994e;var _0x4e0b75;return db['WhatsappQueue']['findOne']({'where':{'id':_0x187463[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x5df5d0,null))[_0x7d4d('0x29')](function(_0x39646c){if(_0x39646c){_0x26994e=_0x39646c;_0x2360c0[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x63')][_0x7d4d('0x64')]);_0x2360c0[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x187463[_0x7d4d('0x34')]);_0x2360c0['filters']=_[_0x7d4d('0x37')](_0x2360c0[_0x7d4d('0x32')],_0x2360c0['query']);_0x2856a9[_0x7d4d('0x36')]=_['intersection'](_0x2360c0[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x2856a9[_0x7d4d('0x36')]=_0x2856a9[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x2856a9['attributes']:_0x2360c0['model'];_0x2856a9[_0x7d4d('0x65')]=qs[_0x7d4d('0x59')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x2856a9[_0x7d4d('0x3b')]=qs[_0x7d4d('0x3c')](_['pick'](_0x187463['query'],_0x2360c0[_0x7d4d('0x3c')]));if(_0x187463[_0x7d4d('0x34')][_0x7d4d('0x3e')]){_0x2856a9[_0x7d4d('0x3b')]=_[_0x7d4d('0x3f')](_0x2856a9[_0x7d4d('0x3b')],{'$or':_[_0x7d4d('0x33')](_0x2856a9[_0x7d4d('0x36')],function(_0x109b47){var _0x3c5021={};_0x3c5021[_0x109b47]={'$like':'%'+_0x187463['query'][_0x7d4d('0x3e')]+'%'};return _0x3c5021;})});}_0x2856a9=_[_0x7d4d('0x3f')]({},_0x2856a9,_0x187463[_0x7d4d('0x42')]);return _0x26994e['getTeams'](_0x2856a9);}})['then'](function(_0x109fc5){if(_0x109fc5){_0x4e0b75=_0x109fc5['length'];if(!_0x187463['query'][_0x7d4d('0x3a')](_0x7d4d('0x58'))){_0x2856a9[_0x7d4d('0x20')]=qs['limit'](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x2856a9['offset']=qs[_0x7d4d('0x22')](_0x187463[_0x7d4d('0x34')][_0x7d4d('0x22')]);}return _0x26994e[_0x7d4d('0x62')](_0x2856a9);}})[_0x7d4d('0x29')](function(_0x9b0008){if(_0x9b0008){return _0x9b0008?{'count':_0x4e0b75,'rows':_0x9b0008}:null;}})[_0x7d4d('0x29')](respondWithResult(_0x5df5d0,null))[_0x7d4d('0x45')](handleError(_0x5df5d0,null));};exports[_0x7d4d('0x66')]=function(_0x1a975b,_0x4b2dd1,_0x3ee2f5){var _0x135742=_0x1a975b[_0x7d4d('0x53')][_0x7d4d('0x67')];return db['Team'][_0x7d4d('0x68')]({'where':{'id':_0x135742},'attributes':['id'],'include':[{'model':db[_0x7d4d('0x69')],'as':_0x7d4d('0x6a'),'attributes':['id','name','online',_0x7d4d('0x6b'),'interface'],'raw':!![]}]})[_0x7d4d('0x29')](function(_0x382917){if(_0x382917){var _0x3b64b0=_[_0x7d4d('0x6c')](_0x382917,function(_0x3e5723){var _0x2c7547=_0x3e5723[_0x7d4d('0x2b')]({'plain':!![]});return _0x2c7547[_0x7d4d('0x6a')];});return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x1a975b[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](function(_0x2ee860){return db[_0x7d4d('0x6d')][_0x7d4d('0x6e')](function(_0x1a9688){return _0x2ee860[_0x7d4d('0x66')](_0x135742,{'transaction':_0x1a9688})[_0x7d4d('0x29')](function(){return BPromise[_0x7d4d('0x6f')](_0x3b64b0,function(_0x6491a4){return db[_0x7d4d('0x57')][_0x7d4d('0x70')]({'where':{'UserId':_0x6491a4['id'],'WhatsappQueueId':_0x1a975b['params']['id']},'transaction':_0x1a9688});});})['then'](function(){_0x3b64b0['forEach'](function(_0x307dd6){socket[_0x7d4d('0x71')]('userWhatsappQueue:save',{'UserId':_0x307dd6['id'],'WhatsappQueueId':_0x2ee860['id']});});});});});}})[_0x7d4d('0x29')](respondWithStatusCode(_0x4b2dd1,null))['catch'](handleError(_0x4b2dd1,null));};exports['removeTeams']=function(_0x4f8512,_0x511cfd,_0x2a2675){return db[_0x7d4d('0x63')]['findAll']({'where':{'id':_0x4f8512[_0x7d4d('0x34')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d4d('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x511cfd,null))[_0x7d4d('0x29')](function(_0x220f8f){var _0xa246c4=_[_0x7d4d('0x33')](_0x220f8f,'id');var _0x3a67a6=[];var _0x5abb51=[];var _0x4356c4=squel['select']();_0x4356c4[_0x7d4d('0x72')](_0x7d4d('0x73'))[_0x7d4d('0x74')]('team_has_whatsapp_queues','tq')[_0x7d4d('0x75')](_0x7d4d('0x76'),'ut',_0x7d4d('0x77'))['where'](_0x7d4d('0x78'),_0x4f8512[_0x7d4d('0x47')]['id']);for(var _0x51c8d5=0x0;_0x51c8d5<_0x220f8f[_0x7d4d('0x39')];_0x51c8d5+=0x1){let _0x2b778b=_0x220f8f[_0x51c8d5];for(var _0x35b5a2=0x0;_0x35b5a2<_0x2b778b[_0x7d4d('0x6a')][_0x7d4d('0x39')];_0x35b5a2+=0x1){let _0x5206c0=_0x2b778b[_0x7d4d('0x6a')][_0x35b5a2];var _0x11d254=_0x4356c4[_0x7d4d('0x79')]();_0x11d254[_0x7d4d('0x3b')](_0x7d4d('0x7a'),_0x5206c0['id']);_0x5abb51[_0x7d4d('0x7b')](db['sequelize'][_0x7d4d('0x34')](_0x11d254[_0x7d4d('0x7c')](),{'type':db[_0x7d4d('0x6d')]['QueryTypes'][_0x7d4d('0x7d')]})[_0x7d4d('0x29')](function(_0x4a00c2){if(_0x4a00c2['length']===0x1){return _0x5206c0['id'];}else{var _0x539883=_['every'](_[_0x7d4d('0x33')](_0x4a00c2,_0x7d4d('0x7e')),function(_0xdc7f36){return _[_0x7d4d('0x7f')](_0xa246c4,_0xdc7f36);});if(_0x539883){return _0x5206c0['id'];}}}));}}return BPromise[_0x7d4d('0x80')](_0x5abb51)[_0x7d4d('0x29')](function(_0x486f67){_0x3a67a6=_(_0x3a67a6)[_0x7d4d('0x81')](_0x486f67)[_0x7d4d('0x82')]()[_0x7d4d('0x83')]();return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x4f8512[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](function(_0x1dc0ad){return db[_0x7d4d('0x6d')][_0x7d4d('0x6e')](function(_0x4d050){return _0x1dc0ad[_0x7d4d('0x84')](_0x4f8512[_0x7d4d('0x34')][_0x7d4d('0x67')],{'transaction':_0x4d050})['then'](function(){if(!_[_0x7d4d('0x85')](_0x3a67a6)){return _0x1dc0ad[_0x7d4d('0x86')](_0x3a67a6,{'transaction':_0x4d050});}})[_0x7d4d('0x29')](function(){_0x3a67a6['forEach'](function(_0x17b16e){socket[_0x7d4d('0x71')]('userWhatsappQueue:remove',{'UserId':_0x17b16e,'WhatsappQueueId':_0x1dc0ad['id']});});});});});});})[_0x7d4d('0x29')](respondWithStatusCode(_0x511cfd,null))['catch'](handleError(_0x511cfd,null));};exports[_0x7d4d('0x87')]=function(_0x2ce0d1,_0x29306d,_0x5bb1f7){return db[_0x7d4d('0x43')][_0x7d4d('0x49')]({'where':{'id':_0x2ce0d1['params']['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x29306d,null))['then'](function(_0x2916f6){if(_0x2916f6){return _0x2916f6['addAgents'](_0x2ce0d1['body'][_0x7d4d('0x67')],_[_0x7d4d('0x88')](_0x2ce0d1[_0x7d4d('0x53')],[_0x7d4d('0x67'),'id'])||{})[_0x7d4d('0x89')](function(_0x20cf1c){for(var _0x38b6af=0x0;_0x38b6af<_0x2ce0d1[_0x7d4d('0x53')][_0x7d4d('0x67')]['length'];_0x38b6af+=0x1){socket['emit'](_0x7d4d('0x8a'),{'UserId':Number(_0x2ce0d1[_0x7d4d('0x53')]['ids'][_0x38b6af]),'WhatsappQueueId':Number(_0x2ce0d1['params']['id'])});}return _0x20cf1c;});}})[_0x7d4d('0x29')](respondWithResult(_0x29306d,null))['catch'](handleError(_0x29306d,null));};exports[_0x7d4d('0x86')]=function(_0x282904,_0x18b7e1,_0x1c068f){return db['WhatsappQueue'][_0x7d4d('0x49')]({'where':{'id':_0x282904[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x18b7e1,null))['then'](function(_0x7dd584){if(_0x7dd584){return _0x7dd584[_0x7d4d('0x86')](_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')])[_0x7d4d('0x29')](function(){if(_[_0x7d4d('0x8b')](_0x282904[_0x7d4d('0x34')]['ids'])){for(var _0x223db6=0x0;_0x223db6<_0x282904['query'][_0x7d4d('0x67')]['length'];_0x223db6+=0x1){socket[_0x7d4d('0x71')](_0x7d4d('0x8c'),{'UserId':Number(_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')][_0x223db6]),'WhatsappQueueId':Number(_0x282904[_0x7d4d('0x47')]['id'])});}}else{socket[_0x7d4d('0x71')](_0x7d4d('0x8c'),{'UserId':Number(_0x282904[_0x7d4d('0x34')][_0x7d4d('0x67')]),'WhatsappQueueId':Number(_0x282904[_0x7d4d('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x18b7e1,null))[_0x7d4d('0x45')](handleError(_0x18b7e1,null));};exports['getAgents']=function(_0x199aed,_0x5d5257,_0x3682ef){var _0x33c603={};var _0x1a0883={};var _0x2f4331;var _0x5acd48;return db['WhatsappQueue'][_0x7d4d('0x56')]({'where':{'id':_0x199aed[_0x7d4d('0x47')]['id']}})[_0x7d4d('0x29')](handleEntityNotFound(_0x5d5257,null))['then'](function(_0x1c7cf6){if(_0x1c7cf6){_0x2f4331=_0x1c7cf6;_0x1a0883[_0x7d4d('0x32')]=_[_0x7d4d('0x35')](db[_0x7d4d('0x69')][_0x7d4d('0x64')]);_0x1a0883[_0x7d4d('0x34')]=_[_0x7d4d('0x35')](_0x199aed[_0x7d4d('0x34')]);_0x1a0883[_0x7d4d('0x3c')]=_['intersection'](_0x1a0883[_0x7d4d('0x32')],_0x1a0883[_0x7d4d('0x34')]);_0x33c603[_0x7d4d('0x36')]=_[_0x7d4d('0x37')](_0x1a0883[_0x7d4d('0x32')],qs[_0x7d4d('0x38')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x38')]));_0x33c603['attributes']=_0x33c603[_0x7d4d('0x36')][_0x7d4d('0x39')]?_0x33c603['attributes']:_0x1a0883[_0x7d4d('0x32')];_0x33c603[_0x7d4d('0x65')]=qs[_0x7d4d('0x59')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x59')]);_0x33c603[_0x7d4d('0x3b')]=qs['filters'](_[_0x7d4d('0x3d')](_0x199aed[_0x7d4d('0x34')],_0x1a0883['filters']));if(_0x199aed[_0x7d4d('0x34')]['filter']){_0x33c603['where']=_['merge'](_0x33c603['where'],{'$or':_['map'](_0x33c603[_0x7d4d('0x36')],function(_0x4475e6){var _0x2bd9f3={};_0x2bd9f3[_0x4475e6]={'$like':'%'+_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x3e')]+'%'};return _0x2bd9f3;})});}_0x33c603=_[_0x7d4d('0x3f')]({},_0x33c603,_0x199aed[_0x7d4d('0x42')]);return _0x2f4331[_0x7d4d('0x8d')](_0x33c603);}})['then'](function(_0x3bcd92){if(_0x3bcd92){_0x5acd48=_0x3bcd92[_0x7d4d('0x39')];if(!_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x3a')]('nolimit')){_0x33c603[_0x7d4d('0x20')]=qs[_0x7d4d('0x20')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x20')]);_0x33c603[_0x7d4d('0x22')]=qs[_0x7d4d('0x22')](_0x199aed[_0x7d4d('0x34')][_0x7d4d('0x22')]);}return _0x2f4331[_0x7d4d('0x8d')](_0x33c603);}})[_0x7d4d('0x29')](function(_0x25a4ed){if(_0x25a4ed){return _0x25a4ed?{'count':_0x5acd48,'rows':_0x25a4ed}:null;}})[_0x7d4d('0x29')](respondWithResult(_0x5d5257,null))[_0x7d4d('0x45')](handleError(_0x5d5257,null));}; \ No newline at end of file +var _0x1e38=['./whatsappQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','then','get','WhatsappQueues','destroy','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','attributes','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','hasOwnProperty','findAndCountAll','UserId','agent','whatsappPause','createdAt','rows','format','getTeams','Team','Agents','interface','flatMap','sequelize','transaction','findOrCreate','forEach','removeTeams','User','select','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','ids','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter'];(function(_0x307b95,_0x39ad1d){var _0x2cfafa=function(_0x532693){while(--_0x532693){_0x307b95['push'](_0x307b95['shift']());}};_0x2cfafa(++_0x39ad1d);}(_0x1e38,0x176));var _0x81e3=function(_0x43dc7e,_0x49a390){_0x43dc7e=_0x43dc7e-0x0;var _0x21e12d=_0x1e38[_0x43dc7e];return _0x21e12d;};'use strict';var emlformat=require(_0x81e3('0x0'));var rimraf=require(_0x81e3('0x1'));var zipdir=require(_0x81e3('0x2'));var jsonpatch=require(_0x81e3('0x3'));var rp=require('request-promise');var moment=require(_0x81e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x81e3('0x5'));var util=require(_0x81e3('0x6'));var path=require(_0x81e3('0x7'));var sox=require(_0x81e3('0x8'));var csv=require(_0x81e3('0x9'));var ejs=require(_0x81e3('0xa'));var fs=require('fs');var fs_extra=require(_0x81e3('0xb'));var _=require(_0x81e3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x81e3('0xd'));var deskjs=require(_0x81e3('0xe'));var toCsv=require(_0x81e3('0x9'));var querystring=require(_0x81e3('0xf'));var Papa=require(_0x81e3('0x10'));var Redis=require(_0x81e3('0x11'));var authService=require(_0x81e3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81e3('0x14'))(_0x81e3('0x15'));var utils=require(_0x81e3('0x16'));var config=require(_0x81e3('0x17'));var licenseUtil=require(_0x81e3('0x18'));var db=require('../../mysqldb')['db'];config[_0x81e3('0x19')]=_[_0x81e3('0x1a')](config[_0x81e3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x81e3('0x1b'))(new Redis(config[_0x81e3('0x19')]));require(_0x81e3('0x1c'))[_0x81e3('0x1d')](socket);function respondWithStatusCode(_0x3047e2,_0x545b60){_0x545b60=_0x545b60||0xcc;return function(_0x3fba21){if(_0x3fba21){return _0x3047e2[_0x81e3('0x1e')](_0x545b60);}return _0x3047e2[_0x81e3('0x1f')](_0x545b60)['end']();};}function respondWithResult(_0x3bbead,_0x5c6795){_0x5c6795=_0x5c6795||0xc8;return function(_0x3c9ebf){if(_0x3c9ebf){return _0x3bbead[_0x81e3('0x1f')](_0x5c6795)['json'](_0x3c9ebf);}};}function respondWithFilteredResult(_0x4b1923,_0x24eafe){return function(_0xe17151){if(_0xe17151){var _0x5c1b71=typeof _0x24eafe[_0x81e3('0x20')]===_0x81e3('0x21')&&typeof _0x24eafe[_0x81e3('0x22')]==='undefined';var _0x408176=_0xe17151[_0x81e3('0x23')];var _0x5961bf=_0x5c1b71?0x0:_0x24eafe[_0x81e3('0x20')];var _0x15ce97=_0x5c1b71?_0xe17151[_0x81e3('0x23')]:_0x24eafe[_0x81e3('0x20')]+_0x24eafe['limit'];var _0x24ae7b;if(_0x15ce97>=_0x408176){_0x15ce97=_0x408176;_0x24ae7b=0xc8;}else{_0x24ae7b=0xce;}_0x4b1923['status'](_0x24ae7b);return _0x4b1923[_0x81e3('0x24')]('Content-Range',_0x5961bf+'-'+_0x15ce97+'/'+_0x408176)[_0x81e3('0x25')](_0xe17151);}return null;};}function patchUpdates(_0x24db0a){return function(_0x54a36b){try{jsonpatch['apply'](_0x54a36b,_0x24db0a,!![]);}catch(_0x5282c7){return BPromise[_0x81e3('0x26')](_0x5282c7);}return _0x54a36b['save']();};}function saveUpdates(_0x703f44,_0x5a9f14){return function(_0xc8e866){if(_0xc8e866){return _0xc8e866[_0x81e3('0x27')](_0x703f44)[_0x81e3('0x28')](function(_0xb10038){return _0xb10038;});}return null;};}function removeEntity(_0x2c47bd,_0x580349){return function(_0x3ba0a7){if(_0x3ba0a7){return _0x3ba0a7['destroy']()[_0x81e3('0x28')](function(){var _0x3a1ce2=_0x3ba0a7[_0x81e3('0x29')]({'plain':!![]});var _0x2a33dd=_0x81e3('0x2a');return db['UserProfileResource'][_0x81e3('0x2b')]({'where':{'type':_0x2a33dd,'resourceId':_0x3a1ce2['id']}})['then'](function(){return _0x3ba0a7;});})[_0x81e3('0x28')](function(){_0x2c47bd[_0x81e3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xacc429,_0x13d402){return function(_0x5737f5){if(!_0x5737f5){_0xacc429[_0x81e3('0x1e')](0x194);}return _0x5737f5;};}function handleError(_0x23a331,_0x465b12){_0x465b12=_0x465b12||0x1f4;return function(_0x3e90b7){logger['error'](_0x3e90b7['stack']);if(_0x3e90b7[_0x81e3('0x2c')]){delete _0x3e90b7[_0x81e3('0x2c')];}_0x23a331[_0x81e3('0x1f')](_0x465b12)[_0x81e3('0x2d')](_0x3e90b7);};}exports[_0x81e3('0x2e')]=function(_0x475ab0,_0x144339){var _0x57e531={},_0x327587={},_0x555e61={'count':0x0,'rows':[]};var _0x344982=_[_0x81e3('0x2f')](db[_0x81e3('0x30')][_0x81e3('0x31')],function(_0x1b5793){return{'name':_0x1b5793[_0x81e3('0x32')],'type':_0x1b5793[_0x81e3('0x33')][_0x81e3('0x34')]};});_0x327587[_0x81e3('0x35')]=_[_0x81e3('0x2f')](_0x344982,'name');_0x327587[_0x81e3('0x36')]=_[_0x81e3('0x37')](_0x475ab0[_0x81e3('0x36')]);_0x327587[_0x81e3('0x38')]=_[_0x81e3('0x39')](_0x327587[_0x81e3('0x35')],_0x327587[_0x81e3('0x36')]);_0x57e531['attributes']=_['intersection'](_0x327587['model'],qs[_0x81e3('0x3a')](_0x475ab0[_0x81e3('0x36')][_0x81e3('0x3a')]));_0x57e531['attributes']=_0x57e531['attributes'][_0x81e3('0x3b')]?_0x57e531['attributes']:_0x327587[_0x81e3('0x35')];if(!_0x475ab0[_0x81e3('0x36')]['hasOwnProperty'](_0x81e3('0x3c'))){_0x57e531[_0x81e3('0x22')]=qs[_0x81e3('0x22')](_0x475ab0['query']['limit']);_0x57e531[_0x81e3('0x20')]=qs[_0x81e3('0x20')](_0x475ab0[_0x81e3('0x36')][_0x81e3('0x20')]);}_0x57e531[_0x81e3('0x3d')]=qs['sort'](_0x475ab0[_0x81e3('0x36')][_0x81e3('0x3e')]);_0x57e531[_0x81e3('0x3f')]=qs[_0x81e3('0x38')](_[_0x81e3('0x40')](_0x475ab0['query'],_0x327587['filters']),_0x344982);if(_0x475ab0[_0x81e3('0x36')][_0x81e3('0x41')]){_0x57e531[_0x81e3('0x3f')]=_[_0x81e3('0x42')](_0x57e531[_0x81e3('0x3f')],{'$or':_['map'](_0x344982,function(_0x31ec63){if(_0x31ec63[_0x81e3('0x33')]!==_0x81e3('0x43')){var _0x10bb3a={};_0x10bb3a[_0x31ec63['name']]={'$like':'%'+_0x475ab0[_0x81e3('0x36')][_0x81e3('0x41')]+'%'};return _0x10bb3a;}})});}_0x57e531=_[_0x81e3('0x42')]({},_0x57e531,_0x475ab0['options']);var _0x26d24e={'where':_0x57e531[_0x81e3('0x3f')]};return db[_0x81e3('0x30')]['count'](_0x26d24e)[_0x81e3('0x28')](function(_0x13e6ea){_0x555e61[_0x81e3('0x23')]=_0x13e6ea;if(_0x475ab0[_0x81e3('0x36')][_0x81e3('0x44')]){_0x57e531[_0x81e3('0x45')]=[{'all':!![]}];}return db[_0x81e3('0x30')][_0x81e3('0x46')](_0x57e531);})[_0x81e3('0x28')](function(_0xf74484){_0x555e61['rows']=_0xf74484;return _0x555e61;})['then'](respondWithFilteredResult(_0x144339,_0x57e531))[_0x81e3('0x47')](handleError(_0x144339,null));};exports[_0x81e3('0x48')]=function(_0x49b861,_0xe06934){var _0x5de8dc={'raw':!![],'where':{'id':_0x49b861[_0x81e3('0x49')]['id']}},_0x31f59e={};_0x31f59e[_0x81e3('0x35')]=_[_0x81e3('0x37')](db['WhatsappQueue']['rawAttributes']);_0x31f59e[_0x81e3('0x36')]=_[_0x81e3('0x37')](_0x49b861[_0x81e3('0x36')]);_0x31f59e[_0x81e3('0x38')]=_[_0x81e3('0x39')](_0x31f59e[_0x81e3('0x35')],_0x31f59e['query']);_0x5de8dc[_0x81e3('0x4a')]=_[_0x81e3('0x39')](_0x31f59e['model'],qs['fields'](_0x49b861['query']['fields']));_0x5de8dc[_0x81e3('0x4a')]=_0x5de8dc[_0x81e3('0x4a')][_0x81e3('0x3b')]?_0x5de8dc[_0x81e3('0x4a')]:_0x31f59e['model'];if(_0x49b861[_0x81e3('0x36')]['includeAll']){_0x5de8dc[_0x81e3('0x45')]=[{'all':!![]}];}_0x5de8dc=_[_0x81e3('0x42')]({},_0x5de8dc,_0x49b861[_0x81e3('0x4b')]);return db[_0x81e3('0x30')][_0x81e3('0x4c')](_0x5de8dc)['then'](handleEntityNotFound(_0xe06934,null))['then'](respondWithResult(_0xe06934,null))[_0x81e3('0x47')](handleError(_0xe06934,null));};exports[_0x81e3('0x4d')]=function(_0xb9b34b,_0x4846c4){return db['WhatsappQueue'][_0x81e3('0x4d')](_0xb9b34b[_0x81e3('0x4e')],{})[_0x81e3('0x28')](function(_0xd16de4){var _0x323389=_0xb9b34b[_0x81e3('0x4f')]['get']({'plain':!![]});if(!_0x323389)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x323389[_0x81e3('0x50')]==='user'){var _0x22250c=_0xd16de4[_0x81e3('0x29')]({'plain':!![]});var _0x4f5c52=_0x81e3('0x2a');return db[_0x81e3('0x51')][_0x81e3('0x4c')]({'where':{'name':_0x4f5c52,'userProfileId':_0x323389[_0x81e3('0x52')]},'raw':!![]})['then'](function(_0x1ac556){if(_0x1ac556&&_0x1ac556[_0x81e3('0x53')]===0x0){return db['UserProfileResource'][_0x81e3('0x4d')]({'name':_0x22250c[_0x81e3('0x2c')],'resourceId':_0x22250c['id'],'type':_0x1ac556['name'],'sectionId':_0x1ac556['id']},{})[_0x81e3('0x28')](function(){return _0xd16de4;});}else{return _0xd16de4;}})['catch'](function(_0x5b56d2){logger[_0x81e3('0x54')](_0x81e3('0x55'),_0x5b56d2);throw _0x5b56d2;});}return _0xd16de4;})['then'](respondWithResult(_0x4846c4,0xc9))[_0x81e3('0x47')](handleError(_0x4846c4,null));};exports['update']=function(_0x443521,_0x623be4){if(_0x443521[_0x81e3('0x4e')]['id']){delete _0x443521[_0x81e3('0x4e')]['id'];}return db[_0x81e3('0x30')][_0x81e3('0x4c')]({'where':{'id':_0x443521['params']['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0x623be4,null))[_0x81e3('0x28')](saveUpdates(_0x443521[_0x81e3('0x4e')],null))[_0x81e3('0x28')](respondWithResult(_0x623be4,null))[_0x81e3('0x47')](handleError(_0x623be4,null));};exports['destroy']=function(_0x413417,_0x3729d3){return db[_0x81e3('0x30')][_0x81e3('0x4c')]({'where':{'id':_0x413417['params']['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0x3729d3,null))[_0x81e3('0x28')](removeEntity(_0x3729d3,null))['catch'](handleError(_0x3729d3,null));};exports[_0x81e3('0x56')]=function(_0x491463,_0x1192f1){return db[_0x81e3('0x30')][_0x81e3('0x56')]()[_0x81e3('0x28')](respondWithResult(_0x1192f1,null))[_0x81e3('0x47')](handleError(_0x1192f1,null));};exports['getMembers']=function(_0x1c55cd,_0x1f08ad,_0x33ab1c){var _0x16d790={'raw':!![],'where':{}},_0x11fa54={},_0x27b4eb;return db[_0x81e3('0x30')][_0x81e3('0x57')]({'where':{'id':_0x1c55cd['params']['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0x1f08ad,null))['then'](function(_0x43cfb){if(_0x43cfb){_0x27b4eb=_0x43cfb['get']({'plain':!![]});_0x11fa54[_0x81e3('0x35')]=_['keys'](db[_0x81e3('0x58')]['rawAttributes']);_0x11fa54[_0x81e3('0x36')]=_[_0x81e3('0x37')](_0x1c55cd[_0x81e3('0x36')]);_0x11fa54['filters']=_[_0x81e3('0x39')](_0x11fa54[_0x81e3('0x35')],_0x11fa54['query']);_0x16d790['attributes']=_['intersection'](_0x11fa54[_0x81e3('0x35')],qs[_0x81e3('0x3a')](_0x1c55cd[_0x81e3('0x36')][_0x81e3('0x3a')]));_0x16d790[_0x81e3('0x4a')]=_0x16d790[_0x81e3('0x4a')]['length']?_0x16d790[_0x81e3('0x4a')]:_0x11fa54['model'];if(!_0x1c55cd[_0x81e3('0x36')][_0x81e3('0x59')](_0x81e3('0x3c'))){_0x16d790[_0x81e3('0x22')]=qs['limit'](_0x1c55cd[_0x81e3('0x36')]['limit']);_0x16d790['offset']=qs[_0x81e3('0x20')](_0x1c55cd['query'][_0x81e3('0x20')]);}_0x16d790['order']=qs[_0x81e3('0x3e')](_0x1c55cd[_0x81e3('0x36')][_0x81e3('0x3e')]);_0x16d790[_0x81e3('0x3f')]=qs['filters'](_[_0x81e3('0x40')](_0x1c55cd[_0x81e3('0x36')],_0x11fa54[_0x81e3('0x38')]));_0x16d790[_0x81e3('0x3f')]['WhatsappQueueId']=_0x43cfb['id'];if(_0x1c55cd['query'][_0x81e3('0x41')]){_0x16d790['where']=_['merge'](_0x16d790[_0x81e3('0x3f')],{'$or':_['map'](_0x16d790[_0x81e3('0x4a')],function(_0x4187b8){var _0x36093e={};_0x36093e[_0x4187b8]={'$like':'%'+_0x1c55cd[_0x81e3('0x36')]['filter']+'%'};return _0x36093e;})});}_0x16d790=_[_0x81e3('0x42')]({},_0x16d790,_0x1c55cd[_0x81e3('0x4b')]);return db[_0x81e3('0x58')][_0x81e3('0x46')](_0x16d790);}})[_0x81e3('0x28')](function(_0x50896e){if(_0x50896e){return db['User'][_0x81e3('0x5a')]({'where':{'id':_[_0x81e3('0x2f')](_0x50896e,_0x81e3('0x5b')),'role':_0x81e3('0x5c')},'attributes':['id',_0x81e3('0x2c'),_0x81e3('0x5d'),'updatedAt',_0x81e3('0x5e')]});}})[_0x81e3('0x28')](function(_0x5e6b3a){if(_0x5e6b3a){return{'count':_0x5e6b3a['count'],'rows':_['map'](_0x5e6b3a[_0x81e3('0x5f')],function(_0x2b50e1){return{'membername':_0x2b50e1[_0x81e3('0x2c')],'UserId':_0x2b50e1['id'],'queue_name':_0x27b4eb['name'],'WhatsappQueueId':_0x27b4eb['id'],'interface':util[_0x81e3('0x60')]('%s/%s','SIP',_0x2b50e1[_0x81e3('0x2c')]),'penalty':0x0,'paused':_0x2b50e1[_0x81e3('0x5d')],'createdAt':_0x2b50e1[_0x81e3('0x5e')],'updatedAt':_0x2b50e1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x81e3('0x28')](respondWithFilteredResult(_0x1f08ad,_0x16d790))[_0x81e3('0x47')](handleError(_0x1f08ad,null));};exports[_0x81e3('0x61')]=function(_0x4b33a7,_0x5ea6df,_0x49ea05){var _0x3d458d={};var _0x3447cb={};var _0xd00492;var _0x2c9ba0;return db['WhatsappQueue'][_0x81e3('0x57')]({'where':{'id':_0x4b33a7['params']['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0x5ea6df,null))['then'](function(_0x2e508b){if(_0x2e508b){_0xd00492=_0x2e508b;_0x3447cb[_0x81e3('0x35')]=_[_0x81e3('0x37')](db['Team'][_0x81e3('0x31')]);_0x3447cb[_0x81e3('0x36')]=_[_0x81e3('0x37')](_0x4b33a7[_0x81e3('0x36')]);_0x3447cb['filters']=_[_0x81e3('0x39')](_0x3447cb[_0x81e3('0x35')],_0x3447cb[_0x81e3('0x36')]);_0x3d458d[_0x81e3('0x4a')]=_[_0x81e3('0x39')](_0x3447cb[_0x81e3('0x35')],qs['fields'](_0x4b33a7[_0x81e3('0x36')]['fields']));_0x3d458d[_0x81e3('0x4a')]=_0x3d458d[_0x81e3('0x4a')][_0x81e3('0x3b')]?_0x3d458d[_0x81e3('0x4a')]:_0x3447cb[_0x81e3('0x35')];_0x3d458d['order']=qs['sort'](_0x4b33a7[_0x81e3('0x36')]['sort']);_0x3d458d['where']=qs[_0x81e3('0x38')](_[_0x81e3('0x40')](_0x4b33a7['query'],_0x3447cb[_0x81e3('0x38')]));if(_0x4b33a7[_0x81e3('0x36')]['filter']){_0x3d458d[_0x81e3('0x3f')]=_['merge'](_0x3d458d[_0x81e3('0x3f')],{'$or':_[_0x81e3('0x2f')](_0x3d458d['attributes'],function(_0x4a415a){var _0x4991d8={};_0x4991d8[_0x4a415a]={'$like':'%'+_0x4b33a7[_0x81e3('0x36')][_0x81e3('0x41')]+'%'};return _0x4991d8;})});}_0x3d458d=_[_0x81e3('0x42')]({},_0x3d458d,_0x4b33a7[_0x81e3('0x4b')]);return _0xd00492[_0x81e3('0x61')](_0x3d458d);}})[_0x81e3('0x28')](function(_0x3c9a38){if(_0x3c9a38){_0x2c9ba0=_0x3c9a38[_0x81e3('0x3b')];if(!_0x4b33a7[_0x81e3('0x36')]['hasOwnProperty']('nolimit')){_0x3d458d['limit']=qs['limit'](_0x4b33a7['query'][_0x81e3('0x22')]);_0x3d458d[_0x81e3('0x20')]=qs[_0x81e3('0x20')](_0x4b33a7[_0x81e3('0x36')][_0x81e3('0x20')]);}return _0xd00492[_0x81e3('0x61')](_0x3d458d);}})[_0x81e3('0x28')](function(_0x4603b1){if(_0x4603b1){return _0x4603b1?{'count':_0x2c9ba0,'rows':_0x4603b1}:null;}})[_0x81e3('0x28')](respondWithResult(_0x5ea6df,null))[_0x81e3('0x47')](handleError(_0x5ea6df,null));};exports['addTeams']=function(_0x4d9388,_0x57d48d,_0x541370){var _0x29c413=_0x4d9388[_0x81e3('0x4e')]['ids'];return db[_0x81e3('0x62')][_0x81e3('0x46')]({'where':{'id':_0x29c413},'attributes':['id'],'include':[{'model':db['User'],'as':_0x81e3('0x63'),'attributes':['id','name','online','voicePause',_0x81e3('0x64')],'raw':!![]}]})[_0x81e3('0x28')](function(_0x3e79e4){if(_0x3e79e4){var _0x35792a=_[_0x81e3('0x65')](_0x3e79e4,function(_0x264ce4){var _0xcd7272=_0x264ce4[_0x81e3('0x29')]({'plain':!![]});return _0xcd7272[_0x81e3('0x63')];});return db['WhatsappQueue'][_0x81e3('0x4c')]({'where':{'id':_0x4d9388[_0x81e3('0x49')]['id']}})['then'](function(_0x104c6e){return db[_0x81e3('0x66')][_0x81e3('0x67')](function(_0x138b5a){return _0x104c6e['addTeams'](_0x29c413,{'transaction':_0x138b5a})[_0x81e3('0x28')](function(){return BPromise['each'](_0x35792a,function(_0x17e0f2){return db[_0x81e3('0x58')][_0x81e3('0x68')]({'where':{'UserId':_0x17e0f2['id'],'WhatsappQueueId':_0x4d9388[_0x81e3('0x49')]['id']},'transaction':_0x138b5a});});})[_0x81e3('0x28')](function(){_0x35792a[_0x81e3('0x69')](function(_0x353205){socket['emit']('userWhatsappQueue:save',{'UserId':_0x353205['id'],'WhatsappQueueId':_0x104c6e['id']});});});});});}})[_0x81e3('0x28')](respondWithStatusCode(_0x57d48d,null))[_0x81e3('0x47')](handleError(_0x57d48d,null));};exports[_0x81e3('0x6a')]=function(_0x86ddd6,_0x62a440,_0x15c12a){return db[_0x81e3('0x62')][_0x81e3('0x46')]({'where':{'id':_0x86ddd6[_0x81e3('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x81e3('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x81e3('0x28')](handleEntityNotFound(_0x62a440,null))[_0x81e3('0x28')](function(_0x1d10a2){var _0xb76d87=_[_0x81e3('0x2f')](_0x1d10a2,'id');var _0x2b8013=[];var _0x4899cc=[];var _0x1c46f2=squel[_0x81e3('0x6c')]();_0x1c46f2['field'](_0x81e3('0x6d'))['from'](_0x81e3('0x6e'),'tq')['join'](_0x81e3('0x6f'),'ut',_0x81e3('0x70'))[_0x81e3('0x3f')](_0x81e3('0x71'),_0x86ddd6[_0x81e3('0x49')]['id']);for(var _0xc3ff6e=0x0;_0xc3ff6e<_0x1d10a2['length'];_0xc3ff6e+=0x1){let _0xfb306f=_0x1d10a2[_0xc3ff6e];for(var _0x553719=0x0;_0x553719<_0xfb306f['Agents']['length'];_0x553719+=0x1){let _0x32ff39=_0xfb306f[_0x81e3('0x63')][_0x553719];var _0x2e3b3b=_0x1c46f2['clone']();_0x2e3b3b[_0x81e3('0x3f')](_0x81e3('0x72'),_0x32ff39['id']);_0x4899cc[_0x81e3('0x73')](db[_0x81e3('0x66')]['query'](_0x2e3b3b[_0x81e3('0x74')](),{'type':db[_0x81e3('0x66')][_0x81e3('0x75')]['SELECT']})[_0x81e3('0x28')](function(_0x4fec4f){if(_0x4fec4f['length']===0x1){return _0x32ff39['id'];}else{var _0x1cc80d=_[_0x81e3('0x76')](_['map'](_0x4fec4f,_0x81e3('0x77')),function(_0x3a0d71){return _[_0x81e3('0x78')](_0xb76d87,_0x3a0d71);});if(_0x1cc80d){return _0x32ff39['id'];}}}));}}return BPromise[_0x81e3('0x79')](_0x4899cc)['then'](function(_0x51dd46){_0x2b8013=_(_0x2b8013)['union'](_0x51dd46)[_0x81e3('0x7a')]()[_0x81e3('0x7b')]();return db[_0x81e3('0x30')]['find']({'where':{'id':_0x86ddd6[_0x81e3('0x49')]['id']}})[_0x81e3('0x28')](function(_0x414275){return db[_0x81e3('0x66')][_0x81e3('0x67')](function(_0x13e3cc){return _0x414275['removeTeams'](_0x86ddd6[_0x81e3('0x36')][_0x81e3('0x7c')],{'transaction':_0x13e3cc})[_0x81e3('0x28')](function(){if(!_['isEmpty'](_0x2b8013)){return _0x414275[_0x81e3('0x7d')](_0x2b8013,{'transaction':_0x13e3cc});}})[_0x81e3('0x28')](function(){_0x2b8013[_0x81e3('0x69')](function(_0x5bbe5c){socket['emit'](_0x81e3('0x7e'),{'UserId':_0x5bbe5c,'WhatsappQueueId':_0x414275['id']});});});});});});})[_0x81e3('0x28')](respondWithStatusCode(_0x62a440,null))[_0x81e3('0x47')](handleError(_0x62a440,null));};exports[_0x81e3('0x7f')]=function(_0x14b51c,_0x4a7955,_0x2452dd){return db[_0x81e3('0x30')][_0x81e3('0x4c')]({'where':{'id':_0x14b51c['params']['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0x4a7955,null))[_0x81e3('0x28')](function(_0x166046){if(_0x166046){return _0x166046['addAgents'](_0x14b51c[_0x81e3('0x4e')][_0x81e3('0x7c')],_[_0x81e3('0x80')](_0x14b51c['body'],[_0x81e3('0x7c'),'id'])||{})[_0x81e3('0x81')](function(_0x3d61bb){for(var _0x2337ae=0x0;_0x2337ae<_0x14b51c[_0x81e3('0x4e')][_0x81e3('0x7c')][_0x81e3('0x3b')];_0x2337ae+=0x1){socket[_0x81e3('0x82')](_0x81e3('0x83'),{'UserId':Number(_0x14b51c[_0x81e3('0x4e')]['ids'][_0x2337ae]),'WhatsappQueueId':Number(_0x14b51c[_0x81e3('0x49')]['id'])});}return _0x3d61bb;});}})['then'](respondWithResult(_0x4a7955,null))[_0x81e3('0x47')](handleError(_0x4a7955,null));};exports[_0x81e3('0x7d')]=function(_0x459d9f,_0x492f9a,_0x543cad){return db[_0x81e3('0x30')][_0x81e3('0x4c')]({'where':{'id':_0x459d9f[_0x81e3('0x49')]['id']}})['then'](handleEntityNotFound(_0x492f9a,null))[_0x81e3('0x28')](function(_0xa903a2){if(_0xa903a2){return _0xa903a2['removeAgents'](_0x459d9f[_0x81e3('0x36')]['ids'])[_0x81e3('0x28')](function(){if(_[_0x81e3('0x84')](_0x459d9f[_0x81e3('0x36')]['ids'])){for(var _0x56af59=0x0;_0x56af59<_0x459d9f['query']['ids']['length'];_0x56af59+=0x1){socket[_0x81e3('0x82')](_0x81e3('0x7e'),{'UserId':Number(_0x459d9f[_0x81e3('0x36')]['ids'][_0x56af59]),'WhatsappQueueId':Number(_0x459d9f[_0x81e3('0x49')]['id'])});}}else{socket[_0x81e3('0x82')](_0x81e3('0x7e'),{'UserId':Number(_0x459d9f['query']['ids']),'WhatsappQueueId':Number(_0x459d9f[_0x81e3('0x49')]['id'])});}});}})[_0x81e3('0x28')](respondWithStatusCode(_0x492f9a,null))[_0x81e3('0x47')](handleError(_0x492f9a,null));};exports['getAgents']=function(_0x4f4d0a,_0xf49ef5,_0x1f8d6f){var _0x23b8a1={};var _0x1eb6d2={};var _0x103dd1;var _0x1b7400;return db[_0x81e3('0x30')][_0x81e3('0x57')]({'where':{'id':_0x4f4d0a[_0x81e3('0x49')]['id']}})[_0x81e3('0x28')](handleEntityNotFound(_0xf49ef5,null))[_0x81e3('0x28')](function(_0x1d28e8){if(_0x1d28e8){_0x103dd1=_0x1d28e8;_0x1eb6d2['model']=_[_0x81e3('0x37')](db['User'][_0x81e3('0x31')]);_0x1eb6d2[_0x81e3('0x36')]=_[_0x81e3('0x37')](_0x4f4d0a[_0x81e3('0x36')]);_0x1eb6d2['filters']=_[_0x81e3('0x39')](_0x1eb6d2['model'],_0x1eb6d2[_0x81e3('0x36')]);_0x23b8a1[_0x81e3('0x4a')]=_['intersection'](_0x1eb6d2[_0x81e3('0x35')],qs[_0x81e3('0x3a')](_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x3a')]));_0x23b8a1[_0x81e3('0x4a')]=_0x23b8a1[_0x81e3('0x4a')]['length']?_0x23b8a1[_0x81e3('0x4a')]:_0x1eb6d2[_0x81e3('0x35')];_0x23b8a1[_0x81e3('0x3d')]=qs[_0x81e3('0x3e')](_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x3e')]);_0x23b8a1[_0x81e3('0x3f')]=qs[_0x81e3('0x38')](_[_0x81e3('0x40')](_0x4f4d0a[_0x81e3('0x36')],_0x1eb6d2['filters']));if(_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x41')]){_0x23b8a1[_0x81e3('0x3f')]=_[_0x81e3('0x42')](_0x23b8a1['where'],{'$or':_[_0x81e3('0x2f')](_0x23b8a1[_0x81e3('0x4a')],function(_0x281177){var _0x4a8212={};_0x4a8212[_0x281177]={'$like':'%'+_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x41')]+'%'};return _0x4a8212;})});}_0x23b8a1=_[_0x81e3('0x42')]({},_0x23b8a1,_0x4f4d0a['options']);return _0x103dd1['getAgents'](_0x23b8a1);}})[_0x81e3('0x28')](function(_0x967f57){if(_0x967f57){_0x1b7400=_0x967f57['length'];if(!_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x59')](_0x81e3('0x3c'))){_0x23b8a1['limit']=qs[_0x81e3('0x22')](_0x4f4d0a[_0x81e3('0x36')][_0x81e3('0x22')]);_0x23b8a1['offset']=qs['offset'](_0x4f4d0a[_0x81e3('0x36')]['offset']);}return _0x103dd1[_0x81e3('0x85')](_0x23b8a1);}})[_0x81e3('0x28')](function(_0xc1e95d){if(_0xc1e95d){return _0xc1e95d?{'count':_0x1b7400,'rows':_0xc1e95d}:null;}})[_0x81e3('0x28')](respondWithResult(_0xf49ef5,null))['catch'](handleError(_0xf49ef5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c3c551f..9380972 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 _0xe6b5=['save','remove','emit','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x2427de,_0x51990b){var _0x8cb15c=function(_0x312bca){while(--_0x312bca){_0x2427de['push'](_0x2427de['shift']());}};_0x8cb15c(++_0x51990b);}(_0xe6b5,0x1e4));var _0x5e6b=function(_0x2e238a,_0x1b95d2){_0x2e238a=_0x2e238a-0x0;var _0x4fc840=_0xe6b5[_0x2e238a];return _0x4fc840;};'use strict';var EventEmitter=require(_0x5e6b('0x0'));var WhatsappQueue=require(_0x5e6b('0x1'))['db'][_0x5e6b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5e6b('0x3')](0x0);var events={'afterCreate':_0x5e6b('0x4'),'afterUpdate':'update','afterDestroy':_0x5e6b('0x5')};function emitEvent(_0x33c3a4){return function(_0x3174d5,_0x41c9a7,_0xafc7bd){WhatsappQueueEvents['emit'](_0x33c3a4+':'+_0x3174d5['id'],_0x3174d5);WhatsappQueueEvents[_0x5e6b('0x6')](_0x33c3a4,_0x3174d5);_0xafc7bd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5e6b('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xee68=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xee68,0x86));var _0x8ee6=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xee68[_0xaa0309];return _0x5de7ce;};'use strict';var EventEmitter=require(_0x8ee6('0x0'));var WhatsappQueue=require(_0x8ee6('0x1'))['db'][_0x8ee6('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8ee6('0x3')](0x0);var events={'afterCreate':_0x8ee6('0x4'),'afterUpdate':_0x8ee6('0x5'),'afterDestroy':_0x8ee6('0x6')};function emitEvent(_0x39fad2){return function(_0x43ac42,_0x98066d,_0xdfb353){WhatsappQueueEvents[_0x8ee6('0x7')](_0x39fad2+':'+_0x43ac42['id'],_0x43ac42);WhatsappQueueEvents['emit'](_0x39fad2,_0x43ac42);_0xdfb353(null);};}for(var e in events){if(events[_0x8ee6('0x8')](e)){var event=events[e];WhatsappQueue[_0x8ee6('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 3c71a8b..88ed768 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 _0x9825=['../../config/environment','exports','define','WhatsappQueue','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0x9825,0xe0));var _0x5982=function(_0x5b8a26,_0x7313bb){_0x5b8a26=_0x5b8a26-0x0;var _0x37f956=_0x9825[_0x5b8a26];return _0x37f956;};'use strict';var _=require('lodash');var util=require(_0x5982('0x0'));var logger=require(_0x5982('0x1'))(_0x5982('0x2'));var moment=require(_0x5982('0x3'));var BPromise=require('bluebird');var rp=require(_0x5982('0x4'));var fs=require('fs');var path=require(_0x5982('0x5'));var rimraf=require('rimraf');var config=require(_0x5982('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x5982('0x7')]=function(_0xe774a1,_0x2f5602){return _0xe774a1[_0x5982('0x8')](_0x5982('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x519f=['api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','whatsapp_queues','util','../../config/logger'];(function(_0x13a3c6,_0x1d3280){var _0x28c27f=function(_0x3ec1d1){while(--_0x3ec1d1){_0x13a3c6['push'](_0x13a3c6['shift']());}};_0x28c27f(++_0x1d3280);}(_0x519f,0x153));var _0xf519=function(_0x1b0a4f,_0x5c1580){_0x1b0a4f=_0x1b0a4f-0x0;var _0x2f569b=_0x519f[_0x1b0a4f];return _0x2f569b;};'use strict';var _=require('lodash');var util=require(_0xf519('0x0'));var logger=require(_0xf519('0x1'))(_0xf519('0x2'));var moment=require('moment');var BPromise=require(_0xf519('0x3'));var rp=require(_0xf519('0x4'));var fs=require('fs');var path=require(_0xf519('0x5'));var rimraf=require(_0xf519('0x6'));var config=require('../../config/environment');var attributes=require(_0xf519('0x7'));module[_0xf519('0x8')]=function(_0x5e6f63,_0x56f6a0){return _0x5e6f63[_0xf519('0x9')]('WhatsappQueue',attributes,{'tableName':_0xf519('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 79ae905..6c4b4d4 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 _0x8b3e=['map','model','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include'];(function(_0x4d28d6,_0x4b8b57){var _0x4bf4a6=function(_0x308402){while(--_0x308402){_0x4d28d6['push'](_0x4d28d6['shift']());}};_0x4bf4a6(++_0x4b8b57);}(_0x8b3e,0x14b));var _0xe8b3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe8b3('0x0'));var util=require(_0xe8b3('0x1'));var moment=require(_0xe8b3('0x2'));var BPromise=require(_0xe8b3('0x3'));var rs=require(_0xe8b3('0x4'));var fs=require('fs');var Redis=require(_0xe8b3('0x5'));var db=require(_0xe8b3('0x6'))['db'];var utils=require(_0xe8b3('0x7'));var logger=require(_0xe8b3('0x8'))(_0xe8b3('0x9'));var config=require('../../config/environment');var jayson=require(_0xe8b3('0xa'));var client=jayson[_0xe8b3('0xb')][_0xe8b3('0xc')]({'port':0x232a});config[_0xe8b3('0xd')]=_[_0xe8b3('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b3('0xf'))(new Redis(config[_0xe8b3('0xd')]));require(_0xe8b3('0x10'))[_0xe8b3('0x11')](socket);function respondWithRpcPromise(_0x4f64d5,_0x1b54f4,_0xdeb216){return new BPromise(function(_0xa1f4d6,_0x2c5586){return client['request'](_0x4f64d5,_0xdeb216)[_0xe8b3('0x12')](function(_0x5afb2b){logger[_0xe8b3('0x13')](_0xe8b3('0x14'),_0x1b54f4,_0xe8b3('0x15'));logger[_0xe8b3('0x16')](_0xe8b3('0x17'),_0x1b54f4,_0xe8b3('0x15'),JSON[_0xe8b3('0x18')](_0x5afb2b));if(_0x5afb2b[_0xe8b3('0x19')]){if(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1a')]===0x1f4){logger[_0xe8b3('0x19')](_0xe8b3('0x14'),_0x1b54f4,_0x5afb2b['error'][_0xe8b3('0x1b')]);return _0x2c5586(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);}logger[_0xe8b3('0x19')](_0xe8b3('0x14'),_0x1b54f4,_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);return _0xa1f4d6(_0x5afb2b[_0xe8b3('0x19')][_0xe8b3('0x1b')]);}else{logger[_0xe8b3('0x13')](_0xe8b3('0x14'),_0x1b54f4,_0xe8b3('0x15'));_0xa1f4d6(_0x5afb2b[_0xe8b3('0x1c')][_0xe8b3('0x1b')]);}})[_0xe8b3('0x1d')](function(_0xab8b5b){logger[_0xe8b3('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x1b54f4,_0xab8b5b);_0x2c5586(_0xab8b5b);});});}exports[_0xe8b3('0x1e')]=function(_0x111632){var _0x24f27a=this;return new Promise(function(_0x30898b,_0x5e7604){return db[_0xe8b3('0x1f')]['findAll']({'raw':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x21')]===undefined?!![]:![]:!![],'where':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x22')]||null:null,'attributes':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x23')]||null:null,'limit':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x24')]||null:null,'include':_0x111632[_0xe8b3('0x20')]?_0x111632[_0xe8b3('0x20')][_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x111632[_0xe8b3('0x20')][_0xe8b3('0x25')],function(_0x3f9d3a){return{'model':db[_0x3f9d3a[_0xe8b3('0x27')]],'as':_0x3f9d3a['as'],'attributes':_0x3f9d3a['attributes'],'include':_0x3f9d3a[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x3f9d3a[_0xe8b3('0x25')],function(_0x4a07d2){return{'model':db[_0x4a07d2['model']],'as':_0x4a07d2['as'],'attributes':_0x4a07d2[_0xe8b3('0x23')],'include':_0x4a07d2[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x4a07d2[_0xe8b3('0x25')],function(_0x15257a){return{'model':db[_0x15257a['model']],'as':_0x15257a['as'],'attributes':_0x15257a[_0xe8b3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32c584){logger[_0xe8b3('0x13')](_0xe8b3('0x1e'),_0x111632);logger[_0xe8b3('0x16')](_0xe8b3('0x1e'),_0x111632,JSON[_0xe8b3('0x18')](_0x32c584));_0x30898b(_0x32c584);})[_0xe8b3('0x1d')](function(_0x367105){logger[_0xe8b3('0x19')]('GetWhatsappQueue',_0x367105[_0xe8b3('0x1b')],_0x111632);_0x5e7604(_0x24f27a[_0xe8b3('0x19')](0x1f4,_0x367105[_0xe8b3('0x1b')]));});});};exports[_0xe8b3('0x28')]=function(_0x42b386){var _0x11676d=this;return new Promise(function(_0x4104d9,_0x119fff){return db['WhatsappQueue']['find']({'raw':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x21')]===undefined?!![]:![]:!![],'where':_0x42b386[_0xe8b3('0x20')]?_0x42b386['options'][_0xe8b3('0x22')]||null:null,'attributes':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x23')]||null:null,'include':_0x42b386[_0xe8b3('0x20')]?_0x42b386[_0xe8b3('0x20')][_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x42b386['options'][_0xe8b3('0x25')],function(_0x438aef){return{'model':db[_0x438aef['model']],'as':_0x438aef['as'],'attributes':_0x438aef[_0xe8b3('0x23')],'include':_0x438aef[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x438aef[_0xe8b3('0x25')],function(_0x5f5995){return{'model':db[_0x5f5995[_0xe8b3('0x27')]],'as':_0x5f5995['as'],'attributes':_0x5f5995['attributes'],'include':_0x5f5995[_0xe8b3('0x25')]?_[_0xe8b3('0x26')](_0x5f5995[_0xe8b3('0x25')],function(_0x89bf4f){return{'model':db[_0x89bf4f[_0xe8b3('0x27')]],'as':_0x89bf4f['as'],'attributes':_0x89bf4f[_0xe8b3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x91b352){logger[_0xe8b3('0x13')]('ShowWhatsappQueue',_0x42b386);logger[_0xe8b3('0x16')](_0xe8b3('0x28'),_0x42b386,JSON[_0xe8b3('0x18')](_0x91b352));_0x4104d9(_0x91b352);})['catch'](function(_0x58947b){logger[_0xe8b3('0x19')](_0xe8b3('0x28'),_0x58947b['message'],_0x42b386);_0x119fff(_0x11676d[_0xe8b3('0x19')](0x1f4,_0x58947b[_0xe8b3('0x1b')]));});});}; \ No newline at end of file +var _0x7598=['options','raw','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue'];(function(_0x254dbd,_0x12696f){var _0x2a3436=function(_0x256fa0){while(--_0x256fa0){_0x254dbd['push'](_0x254dbd['shift']());}};_0x2a3436(++_0x12696f);}(_0x7598,0x1c7));var _0x8759=function(_0x1e3aac,_0x56c303){_0x1e3aac=_0x1e3aac-0x0;var _0x392276=_0x7598[_0x1e3aac];return _0x392276;};'use strict';var _=require(_0x8759('0x0'));var util=require(_0x8759('0x1'));var moment=require(_0x8759('0x2'));var BPromise=require('bluebird');var rs=require(_0x8759('0x3'));var fs=require('fs');var Redis=require(_0x8759('0x4'));var db=require(_0x8759('0x5'))['db'];var utils=require(_0x8759('0x6'));var logger=require(_0x8759('0x7'))(_0x8759('0x8'));var config=require('../../config/environment');var jayson=require(_0x8759('0x9'));var client=jayson['client'][_0x8759('0xa')]({'port':0x232a});config[_0x8759('0xb')]=_[_0x8759('0xc')](config[_0x8759('0xb')],{'host':_0x8759('0xd'),'port':0x18eb});var socket=require(_0x8759('0xe'))(new Redis(config[_0x8759('0xb')]));require('./whatsappQueue.socket')[_0x8759('0xf')](socket);function respondWithRpcPromise(_0x264a8a,_0x1e0fa9,_0x349a12){return new BPromise(function(_0x584471,_0x3be837){return client['request'](_0x264a8a,_0x349a12)[_0x8759('0x10')](function(_0x594e9c){logger[_0x8759('0x11')](_0x8759('0x12'),_0x1e0fa9,_0x8759('0x13'));logger['debug'](_0x8759('0x14'),_0x1e0fa9,_0x8759('0x13'),JSON['stringify'](_0x594e9c));if(_0x594e9c[_0x8759('0x15')]){if(_0x594e9c[_0x8759('0x15')][_0x8759('0x16')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1e0fa9,_0x594e9c[_0x8759('0x15')][_0x8759('0x17')]);return _0x3be837(_0x594e9c[_0x8759('0x15')][_0x8759('0x17')]);}logger[_0x8759('0x15')](_0x8759('0x12'),_0x1e0fa9,_0x594e9c[_0x8759('0x15')]['message']);return _0x584471(_0x594e9c[_0x8759('0x15')][_0x8759('0x17')]);}else{logger[_0x8759('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x1e0fa9,'request\x20sent');_0x584471(_0x594e9c['result'][_0x8759('0x17')]);}})[_0x8759('0x18')](function(_0x4c0c4c){logger['error'](_0x8759('0x12'),_0x1e0fa9,_0x4c0c4c);_0x3be837(_0x4c0c4c);});});}exports[_0x8759('0x19')]=function(_0x27bbb4){var _0x54e77d=this;return new Promise(function(_0x11c763,_0x1c6956){return db['WhatsappQueue']['findAll']({'raw':_0x27bbb4[_0x8759('0x1a')]?_0x27bbb4['options'][_0x8759('0x1b')]===undefined?!![]:![]:!![],'where':_0x27bbb4[_0x8759('0x1a')]?_0x27bbb4[_0x8759('0x1a')]['where']||null:null,'attributes':_0x27bbb4[_0x8759('0x1a')]?_0x27bbb4[_0x8759('0x1a')]['attributes']||null:null,'limit':_0x27bbb4[_0x8759('0x1a')]?_0x27bbb4['options'][_0x8759('0x1c')]||null:null,'include':_0x27bbb4[_0x8759('0x1a')]?_0x27bbb4[_0x8759('0x1a')][_0x8759('0x1d')]?_[_0x8759('0x1e')](_0x27bbb4['options']['include'],function(_0x51c72a){return{'model':db[_0x51c72a[_0x8759('0x1f')]],'as':_0x51c72a['as'],'attributes':_0x51c72a['attributes'],'include':_0x51c72a['include']?_[_0x8759('0x1e')](_0x51c72a[_0x8759('0x1d')],function(_0x55c385){return{'model':db[_0x55c385[_0x8759('0x1f')]],'as':_0x55c385['as'],'attributes':_0x55c385['attributes'],'include':_0x55c385[_0x8759('0x1d')]?_['map'](_0x55c385[_0x8759('0x1d')],function(_0x128b2a){return{'model':db[_0x128b2a[_0x8759('0x1f')]],'as':_0x128b2a['as'],'attributes':_0x128b2a[_0x8759('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8759('0x10')](function(_0x252e85){logger['info'](_0x8759('0x19'),_0x27bbb4);logger['debug'](_0x8759('0x19'),_0x27bbb4,JSON[_0x8759('0x21')](_0x252e85));_0x11c763(_0x252e85);})[_0x8759('0x18')](function(_0x550d0a){logger[_0x8759('0x15')](_0x8759('0x19'),_0x550d0a[_0x8759('0x17')],_0x27bbb4);_0x1c6956(_0x54e77d[_0x8759('0x15')](0x1f4,_0x550d0a[_0x8759('0x17')]));});});};exports[_0x8759('0x22')]=function(_0x34eebb){var _0x10ca85=this;return new Promise(function(_0x23970c,_0x2455cd){return db['WhatsappQueue'][_0x8759('0x23')]({'raw':_0x34eebb[_0x8759('0x1a')]?_0x34eebb[_0x8759('0x1a')][_0x8759('0x1b')]===undefined?!![]:![]:!![],'where':_0x34eebb[_0x8759('0x1a')]?_0x34eebb['options']['where']||null:null,'attributes':_0x34eebb[_0x8759('0x1a')]?_0x34eebb[_0x8759('0x1a')]['attributes']||null:null,'include':_0x34eebb[_0x8759('0x1a')]?_0x34eebb['options']['include']?_[_0x8759('0x1e')](_0x34eebb[_0x8759('0x1a')][_0x8759('0x1d')],function(_0xee041b){return{'model':db[_0xee041b[_0x8759('0x1f')]],'as':_0xee041b['as'],'attributes':_0xee041b[_0x8759('0x20')],'include':_0xee041b[_0x8759('0x1d')]?_[_0x8759('0x1e')](_0xee041b[_0x8759('0x1d')],function(_0x16067f){return{'model':db[_0x16067f[_0x8759('0x1f')]],'as':_0x16067f['as'],'attributes':_0x16067f[_0x8759('0x20')],'include':_0x16067f[_0x8759('0x1d')]?_[_0x8759('0x1e')](_0x16067f[_0x8759('0x1d')],function(_0x122bbb){return{'model':db[_0x122bbb['model']],'as':_0x122bbb['as'],'attributes':_0x122bbb[_0x8759('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8759('0x10')](function(_0x3ea6b0){logger[_0x8759('0x11')](_0x8759('0x22'),_0x34eebb);logger[_0x8759('0x24')](_0x8759('0x22'),_0x34eebb,JSON[_0x8759('0x21')](_0x3ea6b0));_0x23970c(_0x3ea6b0);})[_0x8759('0x18')](function(_0x3e1fd2){logger[_0x8759('0x15')]('ShowWhatsappQueue',_0x3e1fd2[_0x8759('0x17')],_0x34eebb);_0x2455cd(_0x10ca85['error'](0x1f4,_0x3e1fd2[_0x8759('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2986217..cb84e26 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 _0x0f1a=['save','remove','update','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x3ecf65,_0x3bac13){var _0x1907df=function(_0x247dd9){while(--_0x247dd9){_0x3ecf65['push'](_0x3ecf65['shift']());}};_0x1907df(++_0x3bac13);}(_0x0f1a,0x1c1));var _0xa0f1=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0x0f1a[_0x26dc96];return _0x30b7be;};'use strict';var WhatsappQueueEvents=require(_0xa0f1('0x0'));var events=[_0xa0f1('0x1'),_0xa0f1('0x2'),_0xa0f1('0x3')];function createListener(_0x3908f0,_0x33b50a){return function(_0x3fe519){_0x33b50a['emit'](_0x3908f0,_0x3fe519);};}function removeListener(_0x3c88b3,_0x4d5352){return function(){WhatsappQueueEvents['removeListener'](_0x3c88b3,_0x4d5352);};}exports['register']=function(_0x1a8157){for(var _0x57a648=0x0,_0x570ef2=events[_0xa0f1('0x4')];_0x57a648<_0x570ef2;_0x57a648++){var _0xa45d93=events[_0x57a648];var _0x1cd306=createListener(_0xa0f1('0x5')+_0xa45d93,_0x1a8157);WhatsappQueueEvents['on'](_0xa45d93,_0x1cd306);}}; \ No newline at end of file +var _0xc4e1=['length','whatsappQueue:','./whatsappQueue.events','save','update','emit'];(function(_0x27b6cc,_0x3ddc54){var _0x68b73a=function(_0x4fff6e){while(--_0x4fff6e){_0x27b6cc['push'](_0x27b6cc['shift']());}};_0x68b73a(++_0x3ddc54);}(_0xc4e1,0x194));var _0x1c4e=function(_0x5d107c,_0x2efd02){_0x5d107c=_0x5d107c-0x0;var _0x415447=_0xc4e1[_0x5d107c];return _0x415447;};'use strict';var WhatsappQueueEvents=require(_0x1c4e('0x0'));var events=[_0x1c4e('0x1'),'remove',_0x1c4e('0x2')];function createListener(_0x49c97,_0x3cecc9){return function(_0x3e0319){_0x3cecc9[_0x1c4e('0x3')](_0x49c97,_0x3e0319);};}function removeListener(_0x22e1e3,_0x4796a6){return function(){WhatsappQueueEvents['removeListener'](_0x22e1e3,_0x4796a6);};}exports['register']=function(_0x51d1d8){for(var _0x13849e=0x0,_0x4267d9=events[_0x1c4e('0x4')];_0x13849e<_0x4267d9;_0x13849e++){var _0x2eeff3=events[_0x13849e];var _0x48db95=createListener(_0x1c4e('0x5')+_0x2eeff3,_0x51d1d8);WhatsappQueueEvents['on'](_0x2eeff3,_0x48db95);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 20effcf..c0b4a53 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 _0x3ae9=['describe','show','post','create','put','/:id','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x8466cd,_0x2a3590){var _0x33bf02=function(_0x2ba5a2){while(--_0x2ba5a2){_0x8466cd['push'](_0x8466cd['shift']());}};_0x33bf02(++_0x2a3590);}(_0x3ae9,0x9f));var _0x93ae=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3ae9[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x93ae('0x0'));var util=require(_0x93ae('0x1'));var path=require('path');var timeout=require(_0x93ae('0x2'));var express=require(_0x93ae('0x3'));var router=express[_0x93ae('0x4')]();var fs_extra=require(_0x93ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93ae('0x6'));var config=require(_0x93ae('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x93ae('0x8')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xa')]);router[_0x93ae('0x8')](_0x93ae('0xb'),auth[_0x93ae('0x9')](),controller[_0x93ae('0xc')]);router[_0x93ae('0x8')]('/:id',auth[_0x93ae('0x9')](),controller[_0x93ae('0xd')]);router[_0x93ae('0xe')]('/',auth[_0x93ae('0x9')](),controller[_0x93ae('0xf')]);router[_0x93ae('0x10')](_0x93ae('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x93ae('0x12')](_0x93ae('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f83=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x3aa5f3,_0x9ae1d8){var _0x434feb=function(_0x215a3c){while(--_0x215a3c){_0x3aa5f3['push'](_0x3aa5f3['shift']());}};_0x434feb(++_0x9ae1d8);}(_0x9f83,0x93));var _0x39f8=function(_0x218fd2,_0x4b9603){_0x218fd2=_0x218fd2-0x0;var _0x15642d=_0x9f83[_0x218fd2];return _0x15642d;};'use strict';var multer=require(_0x39f8('0x0'));var util=require(_0x39f8('0x1'));var path=require(_0x39f8('0x2'));var timeout=require(_0x39f8('0x3'));var express=require(_0x39f8('0x4'));var router=express[_0x39f8('0x5')]();var fs_extra=require(_0x39f8('0x6'));var auth=require(_0x39f8('0x7'));var interaction=require(_0x39f8('0x8'));var config=require('../../config/environment');var controller=require(_0x39f8('0x9'));router[_0x39f8('0xa')]('/',auth[_0x39f8('0xb')](),controller[_0x39f8('0xc')]);router[_0x39f8('0xa')](_0x39f8('0xd'),auth[_0x39f8('0xb')](),controller[_0x39f8('0xe')]);router['get'](_0x39f8('0xf'),auth[_0x39f8('0xb')](),controller['show']);router[_0x39f8('0x10')]('/',auth[_0x39f8('0xb')](),controller[_0x39f8('0x11')]);router[_0x39f8('0x12')](_0x39f8('0xf'),auth[_0x39f8('0xb')](),controller[_0x39f8('0x13')]);router[_0x39f8('0x14')](_0x39f8('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 19f9448..c23d493 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x35a07f,_0x425de9){var _0x280fc3=function(_0x4f9866){while(--_0x4f9866){_0x35a07f['push'](_0x35a07f['shift']());}};_0x280fc3(++_0x425de9);}(_0x7a54,0x106));var _0x47a5=function(_0x22c946,_0xef66d5){_0x22c946=_0x22c946-0x0;var _0x4540c7=_0x7a54[_0x22c946];return _0x4540c7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xe3f0a1,_0x2e84d4){var _0x42b92a=function(_0x445319){while(--_0x445319){_0xe3f0a1['push'](_0xe3f0a1['shift']());}};_0x42b92a(++_0x2e84d4);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 491f3e2..3173fbe 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 _0xb9be=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','WhatsappQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','options','includeAll','include','show','params','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9be,0xc5));var _0xeb9b=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xb9be[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0xeb9b('0x0'));var rimraf=require(_0xeb9b('0x1'));var zipdir=require(_0xeb9b('0x2'));var jsonpatch=require(_0xeb9b('0x3'));var rp=require(_0xeb9b('0x4'));var moment=require(_0xeb9b('0x5'));var BPromise=require(_0xeb9b('0x6'));var Mustache=require(_0xeb9b('0x7'));var util=require(_0xeb9b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb9b('0x9'));var ejs=require(_0xeb9b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9b('0xb'));var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0x9'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];function respondWithStatusCode(_0x3df18a,_0x2a01df){_0x2a01df=_0x2a01df||0xcc;return function(_0x51598f){if(_0x51598f){return _0x3df18a['sendStatus'](_0x2a01df);}return _0x3df18a['status'](_0x2a01df)[_0xeb9b('0x19')]();};}function respondWithResult(_0x1ef03f,_0x2674e6){_0x2674e6=_0x2674e6||0xc8;return function(_0x4ec46d){if(_0x4ec46d){return _0x1ef03f['status'](_0x2674e6)['json'](_0x4ec46d);}};}function respondWithFilteredResult(_0x32538b,_0x1a5f27){return function(_0x406afd){if(_0x406afd){var _0x3fa308=typeof _0x1a5f27[_0xeb9b('0x1a')]===_0xeb9b('0x1b')&&typeof _0x1a5f27[_0xeb9b('0x1c')]==='undefined';var _0x2e8645=_0x406afd[_0xeb9b('0x1d')];var _0x21aca6=_0x3fa308?0x0:_0x1a5f27[_0xeb9b('0x1a')];var _0x3cbe3e=_0x3fa308?_0x406afd[_0xeb9b('0x1d')]:_0x1a5f27[_0xeb9b('0x1a')]+_0x1a5f27[_0xeb9b('0x1c')];var _0x2c199f;if(_0x3cbe3e>=_0x2e8645){_0x3cbe3e=_0x2e8645;_0x2c199f=0xc8;}else{_0x2c199f=0xce;}_0x32538b[_0xeb9b('0x1e')](_0x2c199f);return _0x32538b['set'](_0xeb9b('0x1f'),_0x21aca6+'-'+_0x3cbe3e+'/'+_0x2e8645)['json'](_0x406afd);}return null;};}function patchUpdates(_0x5d5f54){return function(_0x580498){try{jsonpatch[_0xeb9b('0x20')](_0x580498,_0x5d5f54,!![]);}catch(_0x4ab4b8){return BPromise[_0xeb9b('0x21')](_0x4ab4b8);}return _0x580498[_0xeb9b('0x22')]();};}function saveUpdates(_0x37935c,_0x37d7e0){return function(_0x3c8be7){if(_0x3c8be7){return _0x3c8be7[_0xeb9b('0x23')](_0x37935c)[_0xeb9b('0x24')](function(_0x15e5b8){return _0x15e5b8;});}return null;};}function removeEntity(_0x142d1c,_0x46df93){return function(_0x61c86d){if(_0x61c86d){return _0x61c86d[_0xeb9b('0x25')]()[_0xeb9b('0x24')](function(){_0x142d1c[_0xeb9b('0x1e')](0xcc)[_0xeb9b('0x19')]();});}};}function handleEntityNotFound(_0x434461,_0x4c997e){return function(_0xd57390){if(!_0xd57390){_0x434461['sendStatus'](0x194);}return _0xd57390;};}function handleError(_0x66a567,_0x5d6846){_0x5d6846=_0x5d6846||0x1f4;return function(_0x347ec1){logger[_0xeb9b('0x26')](_0x347ec1[_0xeb9b('0x27')]);if(_0x347ec1[_0xeb9b('0x28')]){delete _0x347ec1['name'];}_0x66a567[_0xeb9b('0x1e')](_0x5d6846)[_0xeb9b('0x29')](_0x347ec1);};}exports['index']=function(_0x35ff07,_0x33bb1d){var _0x5ce745={},_0x2a4b51={},_0x2ea20f={'count':0x0,'rows':[]};var _0x4188d5=_['map'](db[_0xeb9b('0x2a')]['rawAttributes'],function(_0x6bb66){return{'name':_0x6bb66['fieldName'],'type':_0x6bb66[_0xeb9b('0x2b')]['key']};});_0x2a4b51[_0xeb9b('0x2c')]=_['map'](_0x4188d5,_0xeb9b('0x28'));_0x2a4b51['query']=_[_0xeb9b('0x2d')](_0x35ff07[_0xeb9b('0x2e')]);_0x2a4b51[_0xeb9b('0x2f')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],_0x2a4b51[_0xeb9b('0x2e')]);_0x5ce745[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0x2a4b51[_0xeb9b('0x2c')],qs[_0xeb9b('0x32')](_0x35ff07['query'][_0xeb9b('0x32')]));_0x5ce745[_0xeb9b('0x31')]=_0x5ce745[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x5ce745[_0xeb9b('0x31')]:_0x2a4b51[_0xeb9b('0x2c')];if(!_0x35ff07[_0xeb9b('0x2e')]['hasOwnProperty'](_0xeb9b('0x34'))){_0x5ce745[_0xeb9b('0x1c')]=qs[_0xeb9b('0x1c')](_0x35ff07['query'][_0xeb9b('0x1c')]);_0x5ce745[_0xeb9b('0x1a')]=qs[_0xeb9b('0x1a')](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x1a')]);}_0x5ce745[_0xeb9b('0x35')]=qs['sort'](_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x36')]);_0x5ce745['where']=qs[_0xeb9b('0x2f')](_[_0xeb9b('0x37')](_0x35ff07[_0xeb9b('0x2e')],_0x2a4b51[_0xeb9b('0x2f')]),_0x4188d5);if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]){_0x5ce745[_0xeb9b('0x39')]=_['merge'](_0x5ce745[_0xeb9b('0x39')],{'$or':_[_0xeb9b('0x3a')](_0x4188d5,function(_0x3b5472){if(_0x3b5472['type']!=='VIRTUAL'){var _0x4eacc3={};_0x4eacc3[_0x3b5472[_0xeb9b('0x28')]]={'$like':'%'+_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x38')]+'%'};return _0x4eacc3;}})});}_0x5ce745=_['merge']({},_0x5ce745,_0x35ff07[_0xeb9b('0x3b')]);var _0x9b36ae={'where':_0x5ce745[_0xeb9b('0x39')]};return db[_0xeb9b('0x2a')][_0xeb9b('0x1d')](_0x9b36ae)[_0xeb9b('0x24')](function(_0x377c9d){_0x2ea20f['count']=_0x377c9d;if(_0x35ff07[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x5ce745[_0xeb9b('0x3d')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x5ce745);})[_0xeb9b('0x24')](function(_0x110122){_0x2ea20f['rows']=_0x110122;return _0x2ea20f;})[_0xeb9b('0x24')](respondWithFilteredResult(_0x33bb1d,_0x5ce745))['catch'](handleError(_0x33bb1d,null));};exports[_0xeb9b('0x3e')]=function(_0xcce4da,_0x28b075){var _0x300565={'raw':!![],'where':{'id':_0xcce4da[_0xeb9b('0x3f')]['id']}},_0xbee63e={};_0xbee63e[_0xeb9b('0x2c')]=_[_0xeb9b('0x2d')](db[_0xeb9b('0x2a')][_0xeb9b('0x40')]);_0xbee63e[_0xeb9b('0x2e')]=_[_0xeb9b('0x2d')](_0xcce4da['query']);_0xbee63e['filters']=_[_0xeb9b('0x30')](_0xbee63e['model'],_0xbee63e[_0xeb9b('0x2e')]);_0x300565[_0xeb9b('0x31')]=_[_0xeb9b('0x30')](_0xbee63e['model'],qs[_0xeb9b('0x32')](_0xcce4da[_0xeb9b('0x2e')]['fields']));_0x300565[_0xeb9b('0x31')]=_0x300565[_0xeb9b('0x31')][_0xeb9b('0x33')]?_0x300565[_0xeb9b('0x31')]:_0xbee63e[_0xeb9b('0x2c')];if(_0xcce4da[_0xeb9b('0x2e')][_0xeb9b('0x3c')]){_0x300565[_0xeb9b('0x3d')]=[{'all':!![]}];}_0x300565=_['merge']({},_0x300565,_0xcce4da['options']);return db[_0xeb9b('0x2a')]['find'](_0x300565)['then'](handleEntityNotFound(_0x28b075,null))[_0xeb9b('0x24')](respondWithResult(_0x28b075,null))[_0xeb9b('0x41')](handleError(_0x28b075,null));};exports[_0xeb9b('0x42')]=function(_0x195f5a,_0x45bc74){return db[_0xeb9b('0x2a')]['create'](_0x195f5a['body'],{})['then'](respondWithResult(_0x45bc74,0xc9))[_0xeb9b('0x41')](handleError(_0x45bc74,null));};exports['update']=function(_0x4901b0,_0x2ee59c){if(_0x4901b0[_0xeb9b('0x43')]['id']){delete _0x4901b0[_0xeb9b('0x43')]['id'];}return db[_0xeb9b('0x2a')][_0xeb9b('0x44')]({'where':{'id':_0x4901b0[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x2ee59c,null))[_0xeb9b('0x24')](saveUpdates(_0x4901b0[_0xeb9b('0x43')],null))['then'](respondWithResult(_0x2ee59c,null))['catch'](handleError(_0x2ee59c,null));};exports[_0xeb9b('0x25')]=function(_0x21c93a,_0x542ef4){return db[_0xeb9b('0x2a')]['find']({'where':{'id':_0x21c93a[_0xeb9b('0x3f')]['id']}})[_0xeb9b('0x24')](handleEntityNotFound(_0x542ef4,null))['then'](removeEntity(_0x542ef4,null))['catch'](handleError(_0x542ef4,null));};exports['describe']=function(_0x211238,_0x32d8cd){return db[_0xeb9b('0x2a')]['describe']()['then'](respondWithResult(_0x32d8cd,null))[_0xeb9b('0x41')](handleError(_0x32d8cd,null));}; \ No newline at end of file +var _0xfff0=['length','include','body','find','describe','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','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0x1dd8f6,_0x3ea487){var _0xf083b7=function(_0x237d1d){while(--_0x237d1d){_0x1dd8f6['push'](_0x1dd8f6['shift']());}};_0xf083b7(++_0x3ea487);}(_0xfff0,0x139));var _0x0fff=function(_0x179a12,_0x4a1945){_0x179a12=_0x179a12-0x0;var _0x123332=_0xfff0[_0x179a12];return _0x123332;};'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(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 6007498..c699b9a 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 _0x52ac=['request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1826fa,_0x391e3a){var _0x1316f6=function(_0x2af398){while(--_0x2af398){_0x1826fa['push'](_0x1826fa['shift']());}};_0x1316f6(++_0x391e3a);}(_0x52ac,0xe0));var _0xc52a=function(_0x8426a0,_0x183ad8){_0x8426a0=_0x8426a0-0x0;var _0x4f71e3=_0x52ac[_0x8426a0];return _0x4f71e3;};'use strict';var _=require(_0xc52a('0x0'));var util=require('util');var logger=require(_0xc52a('0x1'))(_0xc52a('0x2'));var moment=require(_0xc52a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc52a('0x4'));var fs=require('fs');var path=require(_0xc52a('0x5'));var rimraf=require('rimraf');var config=require(_0xc52a('0x6'));var attributes=require(_0xc52a('0x7'));module['exports']=function(_0x5bed7e,_0x16e176){return _0x5bed7e[_0xc52a('0x8')](_0xc52a('0x9'),attributes,{'tableName':_0xc52a('0xa'),'paranoid':![],'indexes':[{'name':_0xc52a('0xb'),'fields':[_0xc52a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8339=['moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','util','../../config/logger'];(function(_0x3eddfc,_0x8eed79){var _0x4178d5=function(_0x55f052){while(--_0x55f052){_0x3eddfc['push'](_0x3eddfc['shift']());}};_0x4178d5(++_0x8eed79);}(_0x8339,0x77));var _0x9833=function(_0x3f1d11,_0x5e3836){_0x3f1d11=_0x3f1d11-0x0;var _0x38755f=_0x8339[_0x3f1d11];return _0x38755f;};'use strict';var _=require('lodash');var util=require(_0x9833('0x0'));var logger=require(_0x9833('0x1'))('api');var moment=require(_0x9833('0x2'));var BPromise=require(_0x9833('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9833('0x4'));var rimraf=require(_0x9833('0x5'));var config=require(_0x9833('0x6'));var attributes=require(_0x9833('0x7'));module['exports']=function(_0xaee83a,_0x393466){return _0xaee83a[_0x9833('0x8')](_0x9833('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9833('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6dfaf83..62f2d4b 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 _0xbe7a=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','create','body','raw','then','UpdateWhatsappQueueReport','update','options','attributes'];(function(_0x47eacf,_0x1b00a7){var _0x6706e9=function(_0x4841f8){while(--_0x4841f8){_0x47eacf['push'](_0x47eacf['shift']());}};_0x6706e9(++_0x1b00a7);}(_0xbe7a,0x1e0));var _0xabe7=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xbe7a[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xabe7('0x0'));var util=require(_0xabe7('0x1'));var moment=require(_0xabe7('0x2'));var BPromise=require(_0xabe7('0x3'));var rs=require(_0xabe7('0x4'));var fs=require('fs');var Redis=require(_0xabe7('0x5'));var db=require(_0xabe7('0x6'))['db'];var utils=require(_0xabe7('0x7'));var logger=require(_0xabe7('0x8'))(_0xabe7('0x9'));var config=require(_0xabe7('0xa'));var jayson=require(_0xabe7('0xb'));var client=jayson[_0xabe7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4db0e7,_0x632d8,_0xdc4e68){return new BPromise(function(_0x119515,_0x587c0b){return client['request'](_0x4db0e7,_0xdc4e68)['then'](function(_0xe46647){logger[_0xabe7('0xd')](_0xabe7('0xe'),_0x632d8,'request\x20sent');logger[_0xabe7('0xf')](_0xabe7('0x10'),_0x632d8,_0xabe7('0x11'),JSON[_0xabe7('0x12')](_0xe46647));if(_0xe46647[_0xabe7('0x13')]){if(_0xe46647[_0xabe7('0x13')][_0xabe7('0x14')]===0x1f4){logger[_0xabe7('0x13')](_0xabe7('0xe'),_0x632d8,_0xe46647['error'][_0xabe7('0x15')]);return _0x587c0b(_0xe46647['error'][_0xabe7('0x15')]);}logger[_0xabe7('0x13')](_0xabe7('0xe'),_0x632d8,_0xe46647[_0xabe7('0x13')][_0xabe7('0x15')]);return _0x119515(_0xe46647[_0xabe7('0x13')][_0xabe7('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x632d8,_0xabe7('0x11'));_0x119515(_0xe46647['result'][_0xabe7('0x15')]);}})[_0xabe7('0x16')](function(_0x40a529){logger['error'](_0xabe7('0xe'),_0x632d8,_0x40a529);_0x587c0b(_0x40a529);});});}exports[_0xabe7('0x17')]=function(_0x2c38c7){var _0x4d97ec=this;return new Promise(function(_0x44e15b,_0x3565b2){return db['WhatsappQueueReport'][_0xabe7('0x18')](_0x2c38c7[_0xabe7('0x19')],{'raw':_0x2c38c7['options']?_0x2c38c7['options'][_0xabe7('0x1a')]===undefined?!![]:![]:!![]})[_0xabe7('0x1b')](function(_0x188d6a){logger[_0xabe7('0xd')](_0xabe7('0x17'),_0x2c38c7);logger[_0xabe7('0xf')]('CreateWhatsappQueueReport',_0x2c38c7,JSON[_0xabe7('0x12')](_0x188d6a));_0x44e15b(_0x188d6a);})[_0xabe7('0x16')](function(_0x583bcb){logger['error'](_0xabe7('0x17'),_0x583bcb[_0xabe7('0x15')],_0x2c38c7);_0x3565b2(_0x4d97ec['error'](0x1f4,_0x583bcb[_0xabe7('0x15')]));});});};exports[_0xabe7('0x1c')]=function(_0x34ec65){var _0x5bbaa4=this;return new Promise(function(_0x46f795,_0x25d9ed){return db['WhatsappQueueReport'][_0xabe7('0x1d')](_0x34ec65[_0xabe7('0x19')],{'raw':_0x34ec65['options']?_0x34ec65[_0xabe7('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65['options']['where']||null:null,'attributes':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65[_0xabe7('0x1e')][_0xabe7('0x1f')]||null:null,'limit':_0x34ec65[_0xabe7('0x1e')]?_0x34ec65['options']['limit']||null:null})[_0xabe7('0x1b')](function(_0x489b1a){logger[_0xabe7('0xd')](_0xabe7('0x1c'),_0x34ec65);logger['debug'](_0xabe7('0x1c'),_0x34ec65,JSON[_0xabe7('0x12')](_0x489b1a));_0x46f795(_0x489b1a);})[_0xabe7('0x16')](function(_0x51ddd8){logger[_0xabe7('0x13')](_0xabe7('0x1c'),_0x51ddd8[_0xabe7('0x15')],_0x34ec65);_0x25d9ed(_0x5bbaa4[_0xabe7('0x13')](0x1f4,_0x51ddd8[_0xabe7('0x15')]));});});}; \ No newline at end of file +var _0xcce4=['WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','stringify','UpdateWhatsappQueueReport','update','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','error','code'];(function(_0x452e5a,_0x3c5fc4){var _0x2144c9=function(_0x4596ea){while(--_0x4596ea){_0x452e5a['push'](_0x452e5a['shift']());}};_0x2144c9(++_0x3c5fc4);}(_0xcce4,0xff));var _0x4cce=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xcce4[_0x420d8d];return _0x4865d7;};'use strict';var _=require(_0x4cce('0x0'));var util=require('util');var moment=require(_0x4cce('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cce('0x2'));var db=require(_0x4cce('0x3'))['db'];var utils=require(_0x4cce('0x4'));var logger=require(_0x4cce('0x5'))(_0x4cce('0x6'));var config=require('../../config/environment');var jayson=require(_0x4cce('0x7'));var client=jayson[_0x4cce('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e7919,_0x26f84f,_0x5900cf){return new BPromise(function(_0x549cc4,_0x233899){return client[_0x4cce('0x9')](_0x4e7919,_0x5900cf)[_0x4cce('0xa')](function(_0x5302f1){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x26f84f,_0x4cce('0xb'));logger[_0x4cce('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x26f84f,_0x4cce('0xb'),JSON['stringify'](_0x5302f1));if(_0x5302f1['error']){if(_0x5302f1[_0x4cce('0xd')][_0x4cce('0xe')]===0x1f4){logger['error'](_0x4cce('0xf'),_0x26f84f,_0x5302f1[_0x4cce('0xd')]['message']);return _0x233899(_0x5302f1[_0x4cce('0xd')]['message']);}logger[_0x4cce('0xd')](_0x4cce('0xf'),_0x26f84f,_0x5302f1[_0x4cce('0xd')][_0x4cce('0x10')]);return _0x549cc4(_0x5302f1[_0x4cce('0xd')][_0x4cce('0x10')]);}else{logger[_0x4cce('0x11')](_0x4cce('0xf'),_0x26f84f,'request\x20sent');_0x549cc4(_0x5302f1[_0x4cce('0x12')][_0x4cce('0x10')]);}})[_0x4cce('0x13')](function(_0xe00da9){logger['error'](_0x4cce('0xf'),_0x26f84f,_0xe00da9);_0x233899(_0xe00da9);});});}exports[_0x4cce('0x14')]=function(_0x585fcd){var _0x44a6be=this;return new Promise(function(_0x2101a0,_0x2e0a99){return db[_0x4cce('0x15')][_0x4cce('0x16')](_0x585fcd['body'],{'raw':_0x585fcd['options']?_0x585fcd[_0x4cce('0x17')][_0x4cce('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x423db2){logger[_0x4cce('0x11')]('CreateWhatsappQueueReport',_0x585fcd);logger[_0x4cce('0xc')](_0x4cce('0x14'),_0x585fcd,JSON[_0x4cce('0x19')](_0x423db2));_0x2101a0(_0x423db2);})[_0x4cce('0x13')](function(_0x573711){logger[_0x4cce('0xd')](_0x4cce('0x14'),_0x573711[_0x4cce('0x10')],_0x585fcd);_0x2e0a99(_0x44a6be[_0x4cce('0xd')](0x1f4,_0x573711[_0x4cce('0x10')]));});});};exports[_0x4cce('0x1a')]=function(_0x1ff8ed){var _0x1b4adc=this;return new Promise(function(_0x2b8aef,_0x5a39a3){return db[_0x4cce('0x15')][_0x4cce('0x1b')](_0x1ff8ed['body'],{'raw':_0x1ff8ed[_0x4cce('0x17')]?_0x1ff8ed[_0x4cce('0x17')][_0x4cce('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff8ed['options']?_0x1ff8ed[_0x4cce('0x17')]['where']||null:null,'attributes':_0x1ff8ed[_0x4cce('0x17')]?_0x1ff8ed[_0x4cce('0x17')][_0x4cce('0x1c')]||null:null,'limit':_0x1ff8ed[_0x4cce('0x17')]?_0x1ff8ed[_0x4cce('0x17')][_0x4cce('0x1d')]||null:null})[_0x4cce('0xa')](function(_0x38a2f6){logger[_0x4cce('0x11')](_0x4cce('0x1a'),_0x1ff8ed);logger['debug'](_0x4cce('0x1a'),_0x1ff8ed,JSON[_0x4cce('0x19')](_0x38a2f6));_0x2b8aef(_0x38a2f6);})['catch'](function(_0x54d038){logger[_0x4cce('0xd')](_0x4cce('0x1a'),_0x54d038[_0x4cce('0x10')],_0x1ff8ed);_0x5a39a3(_0x1b4adc['error'](0x1f4,_0x54d038[_0x4cce('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7279693..0f06750 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 _0x5e4f=['show','post','create','put','update','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x5e4f,0x168));var _0xf5e4=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x5e4f[_0x529059];return _0x156bc2;};'use strict';var multer=require(_0xf5e4('0x0'));var util=require(_0xf5e4('0x1'));var path=require(_0xf5e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5e4('0x3'));var router=express[_0xf5e4('0x4')]();var fs_extra=require(_0xf5e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf5e4('0x6'));var config=require(_0xf5e4('0x7'));var controller=require(_0xf5e4('0x8'));router[_0xf5e4('0x9')]('/',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xb')]);router[_0xf5e4('0x9')](_0xf5e4('0xc'),auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xd')]);router[_0xf5e4('0x9')]('/:id',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0xe')]);router[_0xf5e4('0xf')]('/',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0x10')]);router[_0xf5e4('0x11')]('/:id',auth[_0xf5e4('0xa')](),controller[_0xf5e4('0x12')]);router['delete'](_0xf5e4('0x13'),auth['isAuthenticated'](),controller[_0xf5e4('0x14')]);module[_0xf5e4('0x15')]=router; \ No newline at end of file +var _0x665e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x665e,0xbb));var _0xe665=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x665e[_0x2d4065];return _0xef6016;};'use strict';var multer=require('multer');var util=require(_0xe665('0x0'));var path=require(_0xe665('0x1'));var timeout=require(_0xe665('0x2'));var express=require(_0xe665('0x3'));var router=express[_0xe665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe665('0x5'));var interaction=require(_0xe665('0x6'));var config=require(_0xe665('0x7'));var controller=require(_0xe665('0x8'));router['get']('/',auth[_0xe665('0x9')](),controller[_0xe665('0xa')]);router[_0xe665('0xb')](_0xe665('0xc'),auth[_0xe665('0x9')](),controller[_0xe665('0xd')]);router['get'](_0xe665('0xe'),auth[_0xe665('0x9')](),controller[_0xe665('0xf')]);router[_0xe665('0x10')]('/',auth[_0xe665('0x9')](),controller['create']);router[_0xe665('0x11')](_0xe665('0xe'),auth['isAuthenticated'](),controller[_0xe665('0x12')]);router[_0xe665('0x13')](_0xe665('0xe'),auth[_0xe665('0x9')](),controller[_0xe665('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2a6e791..4fc02cf 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 _0xa664=['queue','exports','STRING','ENUM','account'];(function(_0x522be1,_0x1cff04){var _0x40596c=function(_0x3dc67a){while(--_0x3dc67a){_0x522be1['push'](_0x522be1['shift']());}};_0x40596c(++_0x1cff04);}(_0xa664,0x132));var _0x4a66=function(_0x7190b4,_0x480596){_0x7190b4=_0x7190b4-0x0;var _0x1d7c5e=_0xa664[_0x7190b4];return _0x1d7c5e;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'uniqueid':{'type':Sequelize[_0x4a66('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4a66('0x2')](_0x4a66('0x3'),'agent',_0x4a66('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x49db=['DATE','sequelize','exports','STRING','ENUM','account','queue'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x49db,0xc5));var _0xb49d=function(_0x2365a9,_0x2fcdcb){_0x2365a9=_0x2365a9-0x0;var _0x402535=_0x49db[_0x2365a9];return _0x402535;};'use strict';var Sequelize=require(_0xb49d('0x0'));module[_0xb49d('0x1')]={'uniqueid':{'type':Sequelize[_0xb49d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb49d('0x3')](_0xb49d('0x4'),'agent',_0xb49d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb49d('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 069bb49..092f078 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 _0xa209=['set','Content-Range','save','update','destroy','end','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x2f9e80,_0x1d5b11){var _0x5ad122=function(_0x34969a){while(--_0x34969a){_0x2f9e80['push'](_0x2f9e80['shift']());}};_0x5ad122(++_0x1d5b11);}(_0xa209,0xb6));var _0x9a20=function(_0x36cc2d,_0x2950d4){_0x36cc2d=_0x36cc2d-0x0;var _0x4553fc=_0xa209[_0x36cc2d];return _0x4553fc;};'use strict';var emlformat=require(_0x9a20('0x0'));var rimraf=require(_0x9a20('0x1'));var zipdir=require(_0x9a20('0x2'));var jsonpatch=require(_0x9a20('0x3'));var rp=require('request-promise');var moment=require(_0x9a20('0x4'));var BPromise=require(_0x9a20('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9a20('0x6'));var sox=require(_0x9a20('0x7'));var csv=require(_0x9a20('0x8'));var ejs=require(_0x9a20('0x9'));var fs=require('fs');var fs_extra=require(_0x9a20('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a20('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9a20('0xc'));var toCsv=require(_0x9a20('0x8'));var querystring=require(_0x9a20('0xd'));var Papa=require(_0x9a20('0xe'));var Redis=require(_0x9a20('0xf'));var authService=require(_0x9a20('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9a20('0x11'));var utils=require(_0x9a20('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9a20('0x13'));var db=require(_0x9a20('0x14'))['db'];function respondWithStatusCode(_0x1869ce,_0x1346e9){_0x1346e9=_0x1346e9||0xcc;return function(_0x1460b0){if(_0x1460b0){return _0x1869ce[_0x9a20('0x15')](_0x1346e9);}return _0x1869ce[_0x9a20('0x16')](_0x1346e9)['end']();};}function respondWithResult(_0x39864f,_0xc60b5d){_0xc60b5d=_0xc60b5d||0xc8;return function(_0x4e83ab){if(_0x4e83ab){return _0x39864f[_0x9a20('0x16')](_0xc60b5d)[_0x9a20('0x17')](_0x4e83ab);}};}function respondWithFilteredResult(_0x4c44a1,_0x332c50){return function(_0x19ad57){if(_0x19ad57){var _0x1e0c27=typeof _0x332c50[_0x9a20('0x18')]==='undefined'&&typeof _0x332c50['limit']===_0x9a20('0x19');var _0x280ef7=_0x19ad57[_0x9a20('0x1a')];var _0x24d930=_0x1e0c27?0x0:_0x332c50[_0x9a20('0x18')];var _0x3ecfae=_0x1e0c27?_0x19ad57[_0x9a20('0x1a')]:_0x332c50['offset']+_0x332c50[_0x9a20('0x1b')];var _0x9eda36;if(_0x3ecfae>=_0x280ef7){_0x3ecfae=_0x280ef7;_0x9eda36=0xc8;}else{_0x9eda36=0xce;}_0x4c44a1[_0x9a20('0x16')](_0x9eda36);return _0x4c44a1[_0x9a20('0x1c')](_0x9a20('0x1d'),_0x24d930+'-'+_0x3ecfae+'/'+_0x280ef7)[_0x9a20('0x17')](_0x19ad57);}return null;};}function patchUpdates(_0x2f075d){return function(_0x5f0862){try{jsonpatch['apply'](_0x5f0862,_0x2f075d,!![]);}catch(_0xe2ff02){return BPromise['reject'](_0xe2ff02);}return _0x5f0862[_0x9a20('0x1e')]();};}function saveUpdates(_0x486745,_0x145991){return function(_0xf4f177){if(_0xf4f177){return _0xf4f177[_0x9a20('0x1f')](_0x486745)['then'](function(_0x5e8ed3){return _0x5e8ed3;});}return null;};}function removeEntity(_0x38efcd,_0x21f249){return function(_0x461006){if(_0x461006){return _0x461006[_0x9a20('0x20')]()['then'](function(){_0x38efcd['status'](0xcc)[_0x9a20('0x21')]();});}};}function handleEntityNotFound(_0x21bb9e,_0x4e2e38){return function(_0x12008c){if(!_0x12008c){_0x21bb9e['sendStatus'](0x194);}return _0x12008c;};}function handleError(_0x17807a,_0x5b8c45){_0x5b8c45=_0x5b8c45||0x1f4;return function(_0x30e678){logger['error'](_0x30e678[_0x9a20('0x22')]);if(_0x30e678['name']){delete _0x30e678[_0x9a20('0x23')];}_0x17807a[_0x9a20('0x16')](_0x5b8c45)[_0x9a20('0x24')](_0x30e678);};}exports[_0x9a20('0x25')]=function(_0x29df21,_0x5a38af){var _0x18a32c={},_0x51cb07={},_0x119d20={'count':0x0,'rows':[]};var _0x26000f=_[_0x9a20('0x26')](db[_0x9a20('0x27')][_0x9a20('0x28')],function(_0x2cfbc4){return{'name':_0x2cfbc4['fieldName'],'type':_0x2cfbc4['type'][_0x9a20('0x29')]};});_0x51cb07[_0x9a20('0x2a')]=_['map'](_0x26000f,_0x9a20('0x23'));_0x51cb07[_0x9a20('0x2b')]=_[_0x9a20('0x2c')](_0x29df21[_0x9a20('0x2b')]);_0x51cb07[_0x9a20('0x2d')]=_[_0x9a20('0x2e')](_0x51cb07[_0x9a20('0x2a')],_0x51cb07[_0x9a20('0x2b')]);_0x18a32c[_0x9a20('0x2f')]=_['intersection'](_0x51cb07[_0x9a20('0x2a')],qs[_0x9a20('0x30')](_0x29df21[_0x9a20('0x2b')]['fields']));_0x18a32c['attributes']=_0x18a32c[_0x9a20('0x2f')][_0x9a20('0x31')]?_0x18a32c[_0x9a20('0x2f')]:_0x51cb07[_0x9a20('0x2a')];if(!_0x29df21['query'][_0x9a20('0x32')](_0x9a20('0x33'))){_0x18a32c[_0x9a20('0x1b')]=qs[_0x9a20('0x1b')](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x1b')]);_0x18a32c[_0x9a20('0x18')]=qs['offset'](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x18')]);}_0x18a32c['order']=qs[_0x9a20('0x34')](_0x29df21[_0x9a20('0x2b')][_0x9a20('0x34')]);_0x18a32c['where']=qs[_0x9a20('0x2d')](_[_0x9a20('0x35')](_0x29df21[_0x9a20('0x2b')],_0x51cb07[_0x9a20('0x2d')]),_0x26000f);if(_0x29df21[_0x9a20('0x2b')][_0x9a20('0x36')]){_0x18a32c[_0x9a20('0x37')]=_[_0x9a20('0x38')](_0x18a32c[_0x9a20('0x37')],{'$or':_[_0x9a20('0x26')](_0x26000f,function(_0x28e72d){if(_0x28e72d['type']!==_0x9a20('0x39')){var _0x58052f={};_0x58052f[_0x28e72d[_0x9a20('0x23')]]={'$like':'%'+_0x29df21[_0x9a20('0x2b')]['filter']+'%'};return _0x58052f;}})});}_0x18a32c=_[_0x9a20('0x38')]({},_0x18a32c,_0x29df21[_0x9a20('0x3a')]);var _0x77aaf8={'where':_0x18a32c['where']};return db[_0x9a20('0x27')][_0x9a20('0x1a')](_0x77aaf8)[_0x9a20('0x3b')](function(_0x1db6bd){_0x119d20[_0x9a20('0x1a')]=_0x1db6bd;if(_0x29df21[_0x9a20('0x2b')][_0x9a20('0x3c')]){_0x18a32c[_0x9a20('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x9a20('0x3e')](_0x18a32c);})[_0x9a20('0x3b')](function(_0x490977){_0x119d20[_0x9a20('0x3f')]=_0x490977;return _0x119d20;})[_0x9a20('0x3b')](respondWithFilteredResult(_0x5a38af,_0x18a32c))['catch'](handleError(_0x5a38af,null));};exports['show']=function(_0x38b80f,_0x5e186e){var _0xea7c77={'raw':!![],'where':{'id':_0x38b80f['params']['id']}},_0x48835b={};_0x48835b['model']=_['keys'](db[_0x9a20('0x27')][_0x9a20('0x28')]);_0x48835b['query']=_[_0x9a20('0x2c')](_0x38b80f[_0x9a20('0x2b')]);_0x48835b[_0x9a20('0x2d')]=_[_0x9a20('0x2e')](_0x48835b[_0x9a20('0x2a')],_0x48835b[_0x9a20('0x2b')]);_0xea7c77['attributes']=_[_0x9a20('0x2e')](_0x48835b[_0x9a20('0x2a')],qs['fields'](_0x38b80f['query']['fields']));_0xea7c77['attributes']=_0xea7c77[_0x9a20('0x2f')]['length']?_0xea7c77['attributes']:_0x48835b[_0x9a20('0x2a')];if(_0x38b80f[_0x9a20('0x2b')][_0x9a20('0x3c')]){_0xea7c77['include']=[{'all':!![]}];}_0xea7c77=_[_0x9a20('0x38')]({},_0xea7c77,_0x38b80f[_0x9a20('0x3a')]);return db['WhatsappTransferReport'][_0x9a20('0x40')](_0xea7c77)['then'](handleEntityNotFound(_0x5e186e,null))[_0x9a20('0x3b')](respondWithResult(_0x5e186e,null))[_0x9a20('0x41')](handleError(_0x5e186e,null));};exports[_0x9a20('0x42')]=function(_0x294b2a,_0x4af2e2){return db[_0x9a20('0x27')][_0x9a20('0x42')](_0x294b2a['body'],{})[_0x9a20('0x3b')](respondWithResult(_0x4af2e2,0xc9))[_0x9a20('0x41')](handleError(_0x4af2e2,null));};exports[_0x9a20('0x1f')]=function(_0x571fe2,_0xcc1b36){if(_0x571fe2[_0x9a20('0x43')]['id']){delete _0x571fe2[_0x9a20('0x43')]['id'];}return db[_0x9a20('0x27')]['find']({'where':{'id':_0x571fe2[_0x9a20('0x44')]['id']}})[_0x9a20('0x3b')](handleEntityNotFound(_0xcc1b36,null))[_0x9a20('0x3b')](saveUpdates(_0x571fe2[_0x9a20('0x43')],null))[_0x9a20('0x3b')](respondWithResult(_0xcc1b36,null))[_0x9a20('0x41')](handleError(_0xcc1b36,null));};exports['destroy']=function(_0x1fbaa4,_0x279b6c){return db[_0x9a20('0x27')][_0x9a20('0x40')]({'where':{'id':_0x1fbaa4[_0x9a20('0x44')]['id']}})['then'](handleEntityNotFound(_0x279b6c,null))[_0x9a20('0x3b')](removeEntity(_0x279b6c,null))[_0x9a20('0x41')](handleError(_0x279b6c,null));};exports[_0x9a20('0x45')]=function(_0x26f516,_0x4f6800){return db['WhatsappTransferReport'][_0x9a20('0x45')]()[_0x9a20('0x3b')](respondWithResult(_0x4f6800,null))['catch'](handleError(_0x4f6800,null));}; \ No newline at end of file +var _0x1472=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','then','destroy','stack','name','send','index','WhatsappTransferReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','update','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1472,0x1b6));var _0x2147=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0x1472[_0x3dd8dd];return _0x33e300;};'use strict';var emlformat=require(_0x2147('0x0'));var rimraf=require(_0x2147('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2147('0x2'));var rp=require(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var Mustache=require(_0x2147('0x6'));var util=require(_0x2147('0x7'));var path=require('path');var sox=require(_0x2147('0x8'));var csv=require(_0x2147('0x9'));var ejs=require(_0x2147('0xa'));var fs=require('fs');var fs_extra=require(_0x2147('0xb'));var _=require(_0x2147('0xc'));var squel=require(_0x2147('0xd'));var crypto=require(_0x2147('0xe'));var jsforce=require(_0x2147('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2147('0x9'));var querystring=require(_0x2147('0x10'));var Papa=require(_0x2147('0x11'));var Redis=require('ioredis');var authService=require(_0x2147('0x12'));var qs=require(_0x2147('0x13'));var as=require(_0x2147('0x14'));var hardwareService=require(_0x2147('0x15'));var logger=require('../../config/logger')(_0x2147('0x16'));var utils=require(_0x2147('0x17'));var config=require(_0x2147('0x18'));var licenseUtil=require(_0x2147('0x19'));var db=require(_0x2147('0x1a'))['db'];function respondWithStatusCode(_0x59f2c4,_0x347c12){_0x347c12=_0x347c12||0xcc;return function(_0x1d2044){if(_0x1d2044){return _0x59f2c4['sendStatus'](_0x347c12);}return _0x59f2c4['status'](_0x347c12)['end']();};}function respondWithResult(_0x40d006,_0x8797fd){_0x8797fd=_0x8797fd||0xc8;return function(_0x583233){if(_0x583233){return _0x40d006[_0x2147('0x1b')](_0x8797fd)['json'](_0x583233);}};}function respondWithFilteredResult(_0xc6e6d0,_0x5c4d00){return function(_0x50850a){if(_0x50850a){var _0x4eded7=typeof _0x5c4d00[_0x2147('0x1c')]===_0x2147('0x1d')&&typeof _0x5c4d00[_0x2147('0x1e')]===_0x2147('0x1d');var _0x3dc78e=_0x50850a[_0x2147('0x1f')];var _0x5e61f7=_0x4eded7?0x0:_0x5c4d00[_0x2147('0x1c')];var _0x18a2f0=_0x4eded7?_0x50850a[_0x2147('0x1f')]:_0x5c4d00[_0x2147('0x1c')]+_0x5c4d00['limit'];var _0x504062;if(_0x18a2f0>=_0x3dc78e){_0x18a2f0=_0x3dc78e;_0x504062=0xc8;}else{_0x504062=0xce;}_0xc6e6d0[_0x2147('0x1b')](_0x504062);return _0xc6e6d0[_0x2147('0x20')]('Content-Range',_0x5e61f7+'-'+_0x18a2f0+'/'+_0x3dc78e)[_0x2147('0x21')](_0x50850a);}return null;};}function patchUpdates(_0x5729ea){return function(_0x401c71){try{jsonpatch[_0x2147('0x22')](_0x401c71,_0x5729ea,!![]);}catch(_0x21b6b4){return BPromise['reject'](_0x21b6b4);}return _0x401c71['save']();};}function saveUpdates(_0x2438c0,_0x14268c){return function(_0x2c0ed6){if(_0x2c0ed6){return _0x2c0ed6['update'](_0x2438c0)[_0x2147('0x23')](function(_0x3fa8ed){return _0x3fa8ed;});}return null;};}function removeEntity(_0x12714c,_0x4dc326){return function(_0x4184a1){if(_0x4184a1){return _0x4184a1[_0x2147('0x24')]()['then'](function(){_0x12714c[_0x2147('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x966e91,_0x57aa59){return function(_0x1bbbe1){if(!_0x1bbbe1){_0x966e91['sendStatus'](0x194);}return _0x1bbbe1;};}function handleError(_0x1e4445,_0x5aa28d){_0x5aa28d=_0x5aa28d||0x1f4;return function(_0x56232c){logger['error'](_0x56232c[_0x2147('0x25')]);if(_0x56232c[_0x2147('0x26')]){delete _0x56232c[_0x2147('0x26')];}_0x1e4445[_0x2147('0x1b')](_0x5aa28d)[_0x2147('0x27')](_0x56232c);};}exports[_0x2147('0x28')]=function(_0x155afa,_0x5a9eb4){var _0x26c4e6={},_0x2abd8f={},_0x4d25cb={'count':0x0,'rows':[]};var _0x4afdbb=_['map'](db[_0x2147('0x29')][_0x2147('0x2a')],function(_0x2e3f1c){return{'name':_0x2e3f1c['fieldName'],'type':_0x2e3f1c[_0x2147('0x2b')]['key']};});_0x2abd8f['model']=_['map'](_0x4afdbb,_0x2147('0x26'));_0x2abd8f[_0x2147('0x2c')]=_[_0x2147('0x2d')](_0x155afa['query']);_0x2abd8f[_0x2147('0x2e')]=_[_0x2147('0x2f')](_0x2abd8f[_0x2147('0x30')],_0x2abd8f[_0x2147('0x2c')]);_0x26c4e6[_0x2147('0x31')]=_['intersection'](_0x2abd8f[_0x2147('0x30')],qs[_0x2147('0x32')](_0x155afa[_0x2147('0x2c')]['fields']));_0x26c4e6['attributes']=_0x26c4e6[_0x2147('0x31')][_0x2147('0x33')]?_0x26c4e6[_0x2147('0x31')]:_0x2abd8f[_0x2147('0x30')];if(!_0x155afa[_0x2147('0x2c')][_0x2147('0x34')](_0x2147('0x35'))){_0x26c4e6[_0x2147('0x1e')]=qs[_0x2147('0x1e')](_0x155afa[_0x2147('0x2c')][_0x2147('0x1e')]);_0x26c4e6[_0x2147('0x1c')]=qs[_0x2147('0x1c')](_0x155afa[_0x2147('0x2c')]['offset']);}_0x26c4e6[_0x2147('0x36')]=qs[_0x2147('0x37')](_0x155afa[_0x2147('0x2c')][_0x2147('0x37')]);_0x26c4e6[_0x2147('0x38')]=qs[_0x2147('0x2e')](_['pick'](_0x155afa[_0x2147('0x2c')],_0x2abd8f[_0x2147('0x2e')]),_0x4afdbb);if(_0x155afa[_0x2147('0x2c')][_0x2147('0x39')]){_0x26c4e6[_0x2147('0x38')]=_[_0x2147('0x3a')](_0x26c4e6[_0x2147('0x38')],{'$or':_[_0x2147('0x3b')](_0x4afdbb,function(_0x188928){if(_0x188928['type']!==_0x2147('0x3c')){var _0x2d8f52={};_0x2d8f52[_0x188928[_0x2147('0x26')]]={'$like':'%'+_0x155afa[_0x2147('0x2c')]['filter']+'%'};return _0x2d8f52;}})});}_0x26c4e6=_[_0x2147('0x3a')]({},_0x26c4e6,_0x155afa['options']);var _0x869408={'where':_0x26c4e6[_0x2147('0x38')]};return db[_0x2147('0x29')][_0x2147('0x1f')](_0x869408)[_0x2147('0x23')](function(_0x318680){_0x4d25cb[_0x2147('0x1f')]=_0x318680;if(_0x155afa[_0x2147('0x2c')][_0x2147('0x3d')]){_0x26c4e6[_0x2147('0x3e')]=[{'all':!![]}];}return db[_0x2147('0x29')][_0x2147('0x3f')](_0x26c4e6);})[_0x2147('0x23')](function(_0x3ef2dd){_0x4d25cb[_0x2147('0x40')]=_0x3ef2dd;return _0x4d25cb;})['then'](respondWithFilteredResult(_0x5a9eb4,_0x26c4e6))['catch'](handleError(_0x5a9eb4,null));};exports[_0x2147('0x41')]=function(_0x20c409,_0x3f0f1f){var _0x46491e={'raw':!![],'where':{'id':_0x20c409[_0x2147('0x42')]['id']}},_0xface5={};_0xface5['model']=_[_0x2147('0x2d')](db[_0x2147('0x29')][_0x2147('0x2a')]);_0xface5[_0x2147('0x2c')]=_[_0x2147('0x2d')](_0x20c409[_0x2147('0x2c')]);_0xface5[_0x2147('0x2e')]=_[_0x2147('0x2f')](_0xface5[_0x2147('0x30')],_0xface5[_0x2147('0x2c')]);_0x46491e['attributes']=_[_0x2147('0x2f')](_0xface5['model'],qs[_0x2147('0x32')](_0x20c409[_0x2147('0x2c')][_0x2147('0x32')]));_0x46491e[_0x2147('0x31')]=_0x46491e['attributes'][_0x2147('0x33')]?_0x46491e[_0x2147('0x31')]:_0xface5[_0x2147('0x30')];if(_0x20c409[_0x2147('0x2c')][_0x2147('0x3d')]){_0x46491e[_0x2147('0x3e')]=[{'all':!![]}];}_0x46491e=_[_0x2147('0x3a')]({},_0x46491e,_0x20c409[_0x2147('0x43')]);return db['WhatsappTransferReport'][_0x2147('0x44')](_0x46491e)[_0x2147('0x23')](handleEntityNotFound(_0x3f0f1f,null))['then'](respondWithResult(_0x3f0f1f,null))['catch'](handleError(_0x3f0f1f,null));};exports[_0x2147('0x45')]=function(_0x1c94e0,_0x5b152f){return db['WhatsappTransferReport'][_0x2147('0x45')](_0x1c94e0[_0x2147('0x46')],{})['then'](respondWithResult(_0x5b152f,0xc9))['catch'](handleError(_0x5b152f,null));};exports[_0x2147('0x47')]=function(_0x29e7db,_0x32e025){if(_0x29e7db[_0x2147('0x46')]['id']){delete _0x29e7db['body']['id'];}return db[_0x2147('0x29')][_0x2147('0x44')]({'where':{'id':_0x29e7db[_0x2147('0x42')]['id']}})[_0x2147('0x23')](handleEntityNotFound(_0x32e025,null))[_0x2147('0x23')](saveUpdates(_0x29e7db[_0x2147('0x46')],null))[_0x2147('0x23')](respondWithResult(_0x32e025,null))[_0x2147('0x48')](handleError(_0x32e025,null));};exports['destroy']=function(_0x22dd5c,_0x117e81){return db['WhatsappTransferReport'][_0x2147('0x44')]({'where':{'id':_0x22dd5c[_0x2147('0x42')]['id']}})[_0x2147('0x23')](handleEntityNotFound(_0x117e81,null))[_0x2147('0x23')](removeEntity(_0x117e81,null))['catch'](handleError(_0x117e81,null));};exports['describe']=function(_0x5ca9b0,_0x491aab){return db[_0x2147('0x29')]['describe']()[_0x2147('0x23')](respondWithResult(_0x491aab,null))[_0x2147('0x48')](handleError(_0x491aab,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d899b1a..33f29d2 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 _0xc45c=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger'];(function(_0x370d49,_0xa05493){var _0x26b62a=function(_0x15bd2e){while(--_0x15bd2e){_0x370d49['push'](_0x370d49['shift']());}};_0x26b62a(++_0xa05493);}(_0xc45c,0xe8));var _0xcc45=function(_0x249b75,_0x26c7d9){_0x249b75=_0x249b75-0x0;var _0x1763f2=_0xc45c[_0x249b75];return _0x1763f2;};'use strict';var _=require(_0xcc45('0x0'));var util=require('util');var logger=require(_0xcc45('0x1'))(_0xcc45('0x2'));var moment=require(_0xcc45('0x3'));var BPromise=require(_0xcc45('0x4'));var rp=require(_0xcc45('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc45('0x6'));var config=require(_0xcc45('0x7'));var attributes=require(_0xcc45('0x8'));module['exports']=function(_0x4e3500,_0x47a94a){return _0x4e3500[_0xcc45('0x9')](_0xcc45('0xa'),attributes,{'tableName':_0xcc45('0xb'),'paranoid':![],'indexes':[{'name':_0xcc45('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5410=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','report_whatsapp_transfer','uniqueid'];(function(_0x220109,_0x1d2547){var _0x4ccd65=function(_0x33e0d9){while(--_0x33e0d9){_0x220109['push'](_0x220109['shift']());}};_0x4ccd65(++_0x1d2547);}(_0x5410,0x138));var _0x0541=function(_0x4d88af,_0x34473c){_0x4d88af=_0x4d88af-0x0;var _0x43eb74=_0x5410[_0x4d88af];return _0x43eb74;};'use strict';var _=require(_0x0541('0x0'));var util=require('util');var logger=require(_0x0541('0x1'))(_0x0541('0x2'));var moment=require('moment');var BPromise=require(_0x0541('0x3'));var rp=require(_0x0541('0x4'));var fs=require('fs');var path=require(_0x0541('0x5'));var rimraf=require(_0x0541('0x6'));var config=require(_0x0541('0x7'));var attributes=require(_0x0541('0x8'));module['exports']=function(_0x427b6f,_0x5331a7){return _0x427b6f[_0x0541('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x0541('0xa'),'paranoid':![],'indexes':[{'name':_0x0541('0xb'),'fields':[_0x0541('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8a70602..c621479 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 _0x6abe=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6abe,0x1a7));var _0xe6ab=function(_0x11df2a,_0x588cfb){_0x11df2a=_0x11df2a-0x0;var _0x27a372=_0x6abe[_0x11df2a];return _0x27a372;};'use strict';var _=require(_0xe6ab('0x0'));var util=require(_0xe6ab('0x1'));var moment=require(_0xe6ab('0x2'));var BPromise=require(_0xe6ab('0x3'));var rs=require(_0xe6ab('0x4'));var fs=require('fs');var Redis=require(_0xe6ab('0x5'));var db=require(_0xe6ab('0x6'))['db'];var utils=require(_0xe6ab('0x7'));var logger=require(_0xe6ab('0x8'))(_0xe6ab('0x9'));var config=require(_0xe6ab('0xa'));var jayson=require(_0xe6ab('0xb'));var client=jayson[_0xe6ab('0xc')][_0xe6ab('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c603b,_0xe8ebae,_0x3e2108){return new BPromise(function(_0x360bfa,_0x3a70f9){return client[_0xe6ab('0xe')](_0x4c603b,_0x3e2108)[_0xe6ab('0xf')](function(_0x5a470f){logger[_0xe6ab('0x10')](_0xe6ab('0x11'),_0xe8ebae,_0xe6ab('0x12'));logger[_0xe6ab('0x13')](_0xe6ab('0x14'),_0xe8ebae,_0xe6ab('0x12'),JSON[_0xe6ab('0x15')](_0x5a470f));if(_0x5a470f[_0xe6ab('0x16')]){if(_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x17')]===0x1f4){logger[_0xe6ab('0x16')](_0xe6ab('0x11'),_0xe8ebae,_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);return _0x3a70f9(_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);}logger['error'](_0xe6ab('0x11'),_0xe8ebae,_0x5a470f[_0xe6ab('0x16')][_0xe6ab('0x18')]);return _0x360bfa(_0x5a470f[_0xe6ab('0x16')]['message']);}else{logger[_0xe6ab('0x10')](_0xe6ab('0x11'),_0xe8ebae,_0xe6ab('0x12'));_0x360bfa(_0x5a470f[_0xe6ab('0x19')]['message']);}})[_0xe6ab('0x1a')](function(_0x40e6bb){logger[_0xe6ab('0x16')](_0xe6ab('0x11'),_0xe8ebae,_0x40e6bb);_0x3a70f9(_0x40e6bb);});});} \ No newline at end of file +var _0x21a8=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x21a8,0xed));var _0x821a=function(_0x192323,_0x5f4658){_0x192323=_0x192323-0x0;var _0x324c6d=_0x21a8[_0x192323];return _0x324c6d;};'use strict';var _=require(_0x821a('0x0'));var util=require(_0x821a('0x1'));var moment=require(_0x821a('0x2'));var BPromise=require(_0x821a('0x3'));var rs=require(_0x821a('0x4'));var fs=require('fs');var Redis=require(_0x821a('0x5'));var db=require(_0x821a('0x6'))['db'];var utils=require(_0x821a('0x7'));var logger=require(_0x821a('0x8'))('rpc');var config=require(_0x821a('0x9'));var jayson=require(_0x821a('0xa'));var client=jayson[_0x821a('0xb')][_0x821a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xcae829,_0x1de26f,_0x3d76a9){return new BPromise(function(_0x1e54aa,_0x5dd47a){return client[_0x821a('0xd')](_0xcae829,_0x3d76a9)[_0x821a('0xe')](function(_0x32a236){logger[_0x821a('0xf')](_0x821a('0x10'),_0x1de26f,_0x821a('0x11'));logger[_0x821a('0x12')](_0x821a('0x13'),_0x1de26f,_0x821a('0x11'),JSON[_0x821a('0x14')](_0x32a236));if(_0x32a236[_0x821a('0x15')]){if(_0x32a236['error'][_0x821a('0x16')]===0x1f4){logger[_0x821a('0x15')](_0x821a('0x10'),_0x1de26f,_0x32a236[_0x821a('0x15')][_0x821a('0x17')]);return _0x5dd47a(_0x32a236[_0x821a('0x15')]['message']);}logger[_0x821a('0x15')](_0x821a('0x10'),_0x1de26f,_0x32a236[_0x821a('0x15')][_0x821a('0x17')]);return _0x1e54aa(_0x32a236['error']['message']);}else{logger[_0x821a('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1de26f,_0x821a('0x11'));_0x1e54aa(_0x32a236[_0x821a('0x18')][_0x821a('0x17')]);}})[_0x821a('0x19')](function(_0x1177e6){logger[_0x821a('0x15')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1de26f,_0x1177e6);_0x5dd47a(_0x1177e6);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 65e60b3..c418aa5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf1b=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','name','Offline\x20apps:','status','online','join','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','listen','info','start','exitCode','number'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x218036,_0x5bd8d5){_0x218036=_0x218036-0x0;var _0x12510c=_0xaf1b[_0x218036];return _0x12510c;};'use strict';var _=require(_0xbaf1('0x0'));var db=require(_0xbaf1('0x1'))['db'];var seedDb=require(_0xbaf1('0x2'));var checkLicense=require(_0xbaf1('0x3'));var rpc=require(_0xbaf1('0x4'));var config=require(_0xbaf1('0x5'));var logger=require(_0xbaf1('0x6'))(_0xbaf1('0x7'));var pm2=require(_0xbaf1('0x8'));var pm2Config=require(_0xbaf1('0x9'));var schedule=require(_0xbaf1('0xa'));var chat=require(_0xbaf1('0xb'));var whatsapp=require(_0xbaf1('0xc'));var transcribe=require(_0xbaf1('0xd'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xbaf1('0xe')]['sync']()[_0xbaf1('0xf')](function(){if(config['seedDB']){return seedDb[_0xbaf1('0x10')]();}})[_0xbaf1('0xf')](function(){return checkLicense[_0xbaf1('0x10')]();})['then'](function(){return rpc[_0xbaf1('0x11')]();})[_0xbaf1('0xf')](function(_0x56e04e){logger[_0xbaf1('0x12')](_0x56e04e);return chat['start']();})[_0xbaf1('0xf')](function(){return whatsapp[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return schedule[_0xbaf1('0x13')]();})[_0xbaf1('0xf')](function(){return transcribe[_0xbaf1('0x13')]();})['then'](function(){return provider['start']();})[_0xbaf1('0xf')](function(_0x1a10d6){logger[_0xbaf1('0x12')](_0x1a10d6);return pm2[_0xbaf1('0x13')](pm2Config);})[_0xbaf1('0xf')](function(_0x1097d6){var _0x177599=_0x1097d6['filter'](function(_0x32981b){return typeof _0x32981b[_0xbaf1('0x14')]===_0xbaf1('0x15')&&_0x32981b[_0xbaf1('0x14')]>=0x0;});if(_0x177599[_0xbaf1('0x16')]>0x0){throw new Error(_0x177599[_0xbaf1('0x16')]+_0xbaf1('0x17')+_[_0xbaf1('0x18')](_0x177599,function(_0x58d217){return'\x22'+_0x58d217[_0xbaf1('0x19')]['name']+'\x22';}));}logger[_0xbaf1('0x12')](_0xbaf1('0x1a'),_[_0xbaf1('0x18')](_[_0xbaf1('0x1b')](_0x1097d6,{'status':'online'}),_0xbaf1('0x1c'))['join']());logger[_0xbaf1('0x12')](_0xbaf1('0x1d'),_['map'](_[_0xbaf1('0x1b')](_0x1097d6,function(_0x33c524){return _0x33c524[_0xbaf1('0x1e')]!==_0xbaf1('0x1f');}),_0xbaf1('0x1c'))[_0xbaf1('0x20')]()||'None');console['log'](_0xbaf1('0x21'));})[_0xbaf1('0x22')](function(_0x254178){console['log'](_0xbaf1('0x23'),_0x254178);logger[_0xbaf1('0x24')](_0xbaf1('0x25'),_0x254178);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x5ad3=['exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','listen','info','start','exitCode','length','map','pm2_env','name','Online\x20apps:','filter','online','Offline\x20apps:','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x3bac2b,_0x2de937){var _0xc43b6a=function(_0x1e4726){while(--_0x1e4726){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xc43b6a(++_0x2de937);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x5ad3[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require(_0x35ad('0x0'));var db=require(_0x35ad('0x1'))['db'];var seedDb=require(_0x35ad('0x2'));var checkLicense=require(_0x35ad('0x3'));var rpc=require('./rpc');var config=require(_0x35ad('0x4'));var logger=require(_0x35ad('0x5'))(_0x35ad('0x6'));var pm2=require(_0x35ad('0x7'));var pm2Config=require(_0x35ad('0x8'));var schedule=require(_0x35ad('0x9'));var chat=require(_0x35ad('0xa'));var whatsapp=require(_0x35ad('0xb'));var transcribe=require(_0x35ad('0xc'));var provider=require(_0x35ad('0xd'));function main(){return db['sequelize'][_0x35ad('0xe')]()[_0x35ad('0xf')](function(){if(config[_0x35ad('0x10')]){return seedDb['default']();}})[_0x35ad('0xf')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x35ad('0x11')]();})[_0x35ad('0xf')](function(_0x4881d1){logger[_0x35ad('0x12')](_0x4881d1);return chat[_0x35ad('0x13')]();})['then'](function(){return whatsapp['start']();})[_0x35ad('0xf')](function(){return schedule[_0x35ad('0x13')]();})['then'](function(){return transcribe[_0x35ad('0x13')]();})[_0x35ad('0xf')](function(){return provider['start']();})['then'](function(_0x5ba1aa){logger[_0x35ad('0x12')](_0x5ba1aa);return pm2[_0x35ad('0x13')](pm2Config);})['then'](function(_0x3e2676){var _0x2ebceb=_0x3e2676['filter'](function(_0x1494be){return typeof _0x1494be['exitCode']==='number'&&_0x1494be[_0x35ad('0x14')]>=0x0;});if(_0x2ebceb[_0x35ad('0x15')]>0x0){throw new Error(_0x2ebceb[_0x35ad('0x15')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x35ad('0x16')](_0x2ebceb,function(_0x2f3f27){return'\x22'+_0x2f3f27[_0x35ad('0x17')][_0x35ad('0x18')]+'\x22';}));}logger[_0x35ad('0x12')](_0x35ad('0x19'),_['map'](_[_0x35ad('0x1a')](_0x3e2676,{'status':_0x35ad('0x1b')}),'name')['join']());logger[_0x35ad('0x12')](_0x35ad('0x1c'),_['map'](_[_0x35ad('0x1a')](_0x3e2676,function(_0x32735e){return _0x32735e['status']!==_0x35ad('0x1b');}),_0x35ad('0x18'))[_0x35ad('0x1d')]()||_0x35ad('0x1e'));console[_0x35ad('0x1f')](_0x35ad('0x20'));})[_0x35ad('0x21')](function(_0x1e0527){console[_0x35ad('0x1f')](_0x35ad('0x22'),_0x1e0527);logger['error'](_0x35ad('0x23'),_0x1e0527);process[_0x35ad('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8c28d1d..31e1b37 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 _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x559948,_0x5d7a75){var _0x4fc8d5=function(_0x4f77aa){while(--_0x4f77aa){_0x559948['push'](_0x559948['shift']());}};_0x4fc8d5(++_0x5d7a75);}(_0xedd9,0xfc));var _0x9edd=function(_0x298000,_0x24d983){_0x298000=_0x298000-0x0;var _0x48993c=_0xedd9[_0x298000];return _0x48993c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file +var _0x54ef=['../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','internal','email','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','headers','authorization','Basic','User','find','name','authenticate','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','disabled','blocked','blockDuration','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','encryptString','join','promisify','sign','secret','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x54ef,0x112));var _0xf54e=function(_0x1abdc8,_0x441fac){_0x1abdc8=_0x1abdc8-0x0;var _0xf8f1dd=_0x54ef[_0x1abdc8];return _0xf8f1dd;};'use strict';var db=require(_0xf54e('0x0'))['db'];var config=require(_0xf54e('0x1'));var hardwareConf=require(_0xf54e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xf54e('0x3'));var _=require(_0xf54e('0x4'));var jwt=require(_0xf54e('0x5'));var expressJwt=require(_0xf54e('0x6'));var compose=require(_0xf54e('0x7'));var basicAuth=require(_0xf54e('0x8'));var crypto=require(_0xf54e('0x9'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xf54e('0xa'));var validateJwt=expressJwt({'secret':config[_0xf54e('0xb')][_0xf54e('0xc')]});var userAttributes=['id','role',_0xf54e('0xd'),'name',_0xf54e('0xe'),_0xf54e('0xf'),'userpic',_0xf54e('0x10'),_0xf54e('0x11'),_0xf54e('0x12'),_0xf54e('0x13'),'mailPause',_0xf54e('0x14'),_0xf54e('0x15'),_0xf54e('0x16'),_0xf54e('0x17'),'showWebBar',_0xf54e('0x18'),'lastPauseAt','crudPermissions',_0xf54e('0x19'),_0xf54e('0x1a'),_0xf54e('0x1b'),_0xf54e('0x1c'),'phoneBarAutoAnswerDelay',_0xf54e('0x1d'),_0xf54e('0x1e'),_0xf54e('0x1f'),_0xf54e('0x20'),'phoneBarExpires',_0xf54e('0x21'),_0xf54e('0x22'),_0xf54e('0x23'),'hotdesk','interface',_0xf54e('0x24'),_0xf54e('0x25'),_0xf54e('0x26'),_0xf54e('0x27'),_0xf54e('0x28'),_0xf54e('0x29'),_0xf54e('0x2a'),_0xf54e('0x2b'),_0xf54e('0x2c'),_0xf54e('0x2d'),_0xf54e('0x2e'),'emailAutoanswer','emailAutoanswerDelay',_0xf54e('0x2f'),'smsAutoanswerDelay',_0xf54e('0x30'),_0xf54e('0x31'),_0xf54e('0x32'),_0xf54e('0x33'),_0xf54e('0x34'),_0xf54e('0x35')];exports[_0xf54e('0x36')]=function(){return this[_0xf54e('0x37')](!![])[_0xf54e('0x38')](function(_0x5f9eea,_0x1c58bd,_0x5b83df){if(_0x5f9eea[_0xf54e('0x39')]){_0x5b83df();}else{return db['ChatInteraction'][_0xf54e('0x3a')]({'where':{'id':_0x5f9eea[_0xf54e('0x3b')]['id']},'attributes':['id',_0xf54e('0x3c'),_0xf54e('0x3d')],'raw':!![]})[_0xf54e('0x3e')](function(_0x160160){if(_0x160160&&_0x160160[_0xf54e('0x3c')]){return _0x1c58bd[_0xf54e('0x3f')](_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?0x195:0x193)[_0xf54e('0x41')]({'message':_0x160160[_0xf54e('0x3d')]===_0xf54e('0x40')?'Unmanaged.':_0xf54e('0x42')});}else{_0x5b83df();}})['catch'](function(_0x282c63){_0x5b83df(_0x282c63);});}});};exports['isAuthenticated']=function isAuthenticated(_0x15b888){return compose()[_0xf54e('0x38')](function(_0x21ba00,_0xa13cd0,_0x25b643){var _0x3993e4;if(_0x21ba00[_0xf54e('0x43')]['authorization']){if(_['startsWith'](_0x21ba00[_0xf54e('0x43')][_0xf54e('0x44')],_0xf54e('0x45'))){var _0x16d00f=basicAuth(_0x21ba00);db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'name':_0x16d00f[_0xf54e('0x48')]}})[_0xf54e('0x3e')](function(_0x3ae704){if(!_0x3ae704||!_0x3ae704[_0xf54e('0x49')](_0x16d00f['pass'])){return _0xa13cd0['status'](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x4a')});}_0x21ba00['user']={'id':_0x3ae704['id']};_0x25b643();})[_0xf54e('0x4b')](function(_0x82e313){_0x25b643(_0x82e313);});}else if(_[_0xf54e('0x4c')](_0x21ba00[_0xf54e('0x43')]['authorization'],'Bearer')){validateJwt(_0x21ba00,_0xa13cd0,_0x25b643);}else{if(_0x15b888){_0x25b643();}else{return _0xa13cd0['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x4d')});}}}else if(_0x21ba00[_0xf54e('0x4e')][_0xf54e('0x4f')]){try{var _0x29dc39={'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x21ba00['query']['apikey'],_0x29dc39)[_0xf54e('0x3e')](function(_0x734187){return db['User']['find']({'where':{'id':_0x734187[_0xf54e('0x51')]}})[_0xf54e('0x3e')](function(_0x173e6c){_0x3993e4=_0x173e6c;return db['Setting'][_0xf54e('0x3a')]({'where':{'id':0x1},'attributes':[_0xf54e('0x52'),'blockDuration'],'raw':!![]});})[_0xf54e('0x3e')](function(_0x6e5bdf){if(!_0x3993e4||!_[_0xf54e('0x53')](_0x3993e4[_0xf54e('0x54')],_0x734187[_0xf54e('0x55')])){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3993e4[_0xf54e('0x56')]){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3993e4[_0xf54e('0x57')]){if(_0x6e5bdf[_0xf54e('0x58')]>0x0){if(moment(_0x3993e4[_0xf54e('0x59')])[_0xf54e('0x5a')](_0x6e5bdf[_0xf54e('0x58')],_0xf54e('0x5b'))>moment()){return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}else{return _0xa13cd0[_0xf54e('0x3f')](0x191)[_0xf54e('0x41')]({'message':_0xf54e('0x5c')});}}_0x21ba00[_0xf54e('0x39')]={'id':_0x3993e4['id']};_0x25b643();});})[_0xf54e('0x4b')](function(){return _0xa13cd0[_0xf54e('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x533423){_0x25b643(_0x533423);}}else if(_0x15b888){_0x25b643();}else{return _0xa13cd0[_0xf54e('0x3f')](0x193)[_0xf54e('0x41')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf54e('0x38')](function(_0x311ce1,_0x381c03,_0x4f61d7){if(_0x311ce1[_0xf54e('0x39')]){db[_0xf54e('0x46')][_0xf54e('0x47')]({'where':{'id':_0x311ce1[_0xf54e('0x39')]['id']},'attributes':userAttributes})[_0xf54e('0x3e')](function(_0x143a39){if(!_0x143a39){return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5d')});}_0x311ce1['user']=_0x143a39;_0x4f61d7();})[_0xf54e('0x4b')](function(_0x3447fd){_0x4f61d7(_0x3447fd);});}else if(_0x15b888){_0x4f61d7();}else{return _0x381c03[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x5e')});}});};exports[_0xf54e('0x5f')]=function canUpdate(){return compose()['use'](function(_0x23a4a1,_0x59af72,_0x1d16e0){return licenseUtil['getLicense']()[_0xf54e('0x3e')](function(_0x331b16){if(_0x331b16[_0xf54e('0x60')]){_0x1d16e0();}else{return _0x59af72['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0x32fb46){_0x1d16e0(_0x32fb46);});});};exports[_0xf54e('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x427799,_0x297737,_0x346bb4){return licenseUtil[_0xf54e('0x63')]()['then'](function(_0x1bdb5a){if(_0x1bdb5a[_0xf54e('0x64')]){_0x346bb4();}else{return _0x297737['status'](0x193)[_0xf54e('0x41')]({'message':_0xf54e('0x61')});}})[_0xf54e('0x4b')](function(_0xca0141){_0x346bb4(_0xca0141);});});};exports['isMiddleware']=function(_0x196e68,_0x2b645e,_0x2527f6){_0x196e68[_0xf54e('0x65')]=!![];return _0x2527f6();};exports[_0xf54e('0x66')]=function signToken(_0x3237ef){return signJwt(_0x3237ef);};exports[_0xf54e('0x67')]=function(_0xd7b0c5,_0x15bfef){if(!_0xd7b0c5[_0xf54e('0x39')]){return _0x15bfef[_0xf54e('0x3f')](0x194)[_0xf54e('0x41')]({'message':_0xf54e('0x68')});}var _0x2de1fe={'payload':{'id':_0xd7b0c5[_0xf54e('0x39')]['id'],'role':_0xd7b0c5[_0xf54e('0x39')][_0xf54e('0x69')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2de1fe)[_0xf54e('0x3e')](function(_0x21fd80){_0x15bfef[_0xf54e('0x6a')]('motion.token',_0x21fd80);_0x15bfef['redirect'](_0xf54e('0x6b'));})[_0xf54e('0x4b')](function(_0x45861b){return _0x15bfef[_0xf54e('0x3f')](0x1f4)[_0xf54e('0x6c')](_0x45861b);});};exports[_0xf54e('0x6d')]=function(_0x22763f){if(_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x54')])||_[_0xf54e('0x6e')](_0x22763f[_0xf54e('0x6f')])){return null;}else{return createJwt(_0x22763f);}};exports['generateApiKey']=function(_0x2aacf6){_0x2aacf6[_0xf54e('0x54')]=generateNonce();_0x2aacf6[_0xf54e('0x6f')]=generateIssuedAt();return createJwt(_0x2aacf6);};exports[_0xf54e('0x70')]=function(_0x1b8f16,_0x30f53b){var _0x18a25f=_0x1b8f16['query'][_0xf54e('0x4f')];if(_0x18a25f){var _0x5fabd2={'nonce':_0x30f53b[_0xf54e('0x54')],'iat':_0x30f53b['apiKeyIat'],'audience':hardwareConf[_0xf54e('0x50')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x18a25f,_0x5fabd2)[_0xf54e('0x3e')](function(){return generateApiKey(_0x30f53b);});}else{throw{'message':_0xf54e('0x71')};}};exports[_0xf54e('0x72')]=function(_0x5b882f){var _0x1d8ccf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d8ccf[_0xf54e('0x73')](_0x5b882f))throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0xf54e('0x76'));return;};exports[_0xf54e('0x77')]=function(_0x21d485,_0x55d57f,_0x55de5c){var _0x4270e1=encryptor[_0xf54e('0x78')](_0x55d57f)['split'](',');for(var _0x29743e=0x0;_0x29743e<_0x55de5c;_0x29743e++){if(!_0x4270e1[_0x29743e])break;if(_0x21d485['toLowerCase']()===_0x4270e1[_0x29743e][_0xf54e('0x79')]()){var _0x528a64=util[_0xf54e('0x7a')](_0xf54e('0x7b'),_0x55de5c);if(_0x55de5c===0x1){_0x528a64=_0xf54e('0x7c');}throw new db[(_0xf54e('0x74'))][(_0xf54e('0x75'))](_0x528a64);}}return;};exports[_0xf54e('0x7d')]=function(_0x556e55,_0x479572){var _0x79345=_0x479572?encryptor[_0xf54e('0x78')](_0x479572)['split'](','):[];if(_0x79345['length']===0x5){_0x79345[_0xf54e('0x7e')](-0x1,0x1);}_0x79345['unshift'](_0x556e55);return encryptor[_0xf54e('0x7f')](_0x79345[_0xf54e('0x80')](','));};function signJwt(_0x47596c){var _0x2b11f8=BPromise[_0xf54e('0x81')](jwt[_0xf54e('0x82')],{'context':jwt});var _0x3bf476=_0x47596c[_0xf54e('0x83')]||config[_0xf54e('0xb')][_0xf54e('0xc')];return new BPromise(function(_0x1f9dad,_0x2c6d0e){_0x2b11f8(_0x47596c[_0xf54e('0x84')],_0x3bf476,_0x47596c[_0xf54e('0x85')])['then'](function(_0x302f3d){_0x1f9dad(_0x302f3d);})[_0xf54e('0x4b')](function(_0xb7ff4d){_0x2c6d0e(_0xb7ff4d);});});}function verifyJwt(_0x11908b,_0x1e4c0d,_0x494629){var _0xf50b1b=BPromise[_0xf54e('0x81')](jwt['verify'],{'context':jwt});var _0x51ec35=_0x494629||config[_0xf54e('0xb')]['session'];return new BPromise(function(_0x26322a,_0x39c5eb){_0xf50b1b(_0x11908b,_0x51ec35,_0x1e4c0d)[_0xf54e('0x3e')](function(_0x9789b9){_0x26322a(_0x9789b9);})['catch'](function(_0x2ecda1){_0x39c5eb(_0x2ecda1);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf54e('0x86')](_0xf54e('0x87'));}function generateIssuedAt(){return Math[_0xf54e('0x88')](Date['now']()/0x3e8)[_0xf54e('0x86')]();}function createJwt(_0x504ec7){var _0x3f7224={'payload':{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce']},'options':{'algorithm':_0xf54e('0x89'),'subject':_0x504ec7['id']['toString'](),'issuer':hardwareConf[_0xf54e('0x50')](),'audience':hardwareConf[_0xf54e('0x50')]()}};return signJwt(_0x3f7224)[_0xf54e('0x3e')](function(_0x38405c){return{'iat':_0x504ec7[_0xf54e('0x6f')],'nonce':_0x504ec7['apiKeyNonce'],'token':_0x38405c};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 97d9605..7ea47ba 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x11e444,_0x2394cd){var _0x577b0e=function(_0x4ebbf3){while(--_0x4ebbf3){_0x11e444['push'](_0x11e444['shift']());}};_0x577b0e(++_0x2394cd);}(_0x2032,0xd9));var _0x2203=function(_0x11104c,_0x339419){_0x11104c=_0x11104c-0x0;var _0x198712=_0x2032[_0x11104c];return _0x198712;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file +var _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0x3edd39,_0x469521){var _0x294a20=function(_0x12817b){while(--_0x12817b){_0x3edd39['push'](_0x3edd39['shift']());}};_0x294a20(++_0x469521);}(_0x5f2f,0x73));var _0xf5f2=function(_0x239a74,_0x1490e3){_0x239a74=_0x239a74-0x0;var _0x1b5415=_0x5f2f[_0x239a74];return _0x1b5415;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 26b0266..579ea9c 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdae=['text','value','start','end','Tag','map','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','having','order','DESC','subqry.','keyBy','Sequelize','QueryTypes','SELECT','query','toString','TagIds','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','ListId','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','.id','firstName','lastName','fax','email','CompanyId','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','DATE','buildExpression','type'];(function(_0x5a4846,_0x28d781){var _0x2d2276=function(_0x2af201){while(--_0x2af201){_0x5a4846['push'](_0x5a4846['shift']());}};_0x2d2276(++_0x28d781);}(_0xbdae,0x1dc));var _0xebda=function(_0x4f0cc2,_0x463c25){_0x4f0cc2=_0x4f0cc2-0x0;var _0x1eb94f=_0xbdae[_0x4f0cc2];return _0x1eb94f;};'use strict';var _=require(_0xebda('0x0'));var squel=require(_0xebda('0x1'));var as=require(_0xebda('0x2'));var qs=require(_0xebda('0x3'));var utils=require('../interaction/utils');var db=require(_0xebda('0x4'))['db'];function skipContactsQuery(_0x2cdc90,_0x2446be){var _0x3457c4=![];if(_0x2cdc90['role']===_0xebda('0x5')&&!_0x2446be[_0xebda('0x6')]&&!_0x2446be[_0xebda('0x7')]&&_0x2446be['autocomplete']!=='true'){_0x3457c4=!![];}return _0x3457c4;}function getContactsSubquery(){return squel[_0xebda('0x8')]()[_0xebda('0x9')](_0xebda('0xa'),'c')[_0xebda('0xb')](_0xebda('0xc'));}function applyJoinClauses(_0x56e471,_0x17af17){var _0x4671a2=_0x17af17?'c':_0xebda('0xd');_0x56e471[_0xebda('0xe')](_0xebda('0xf'),'uc',_0xebda('0x10')+_0x4671a2+'.id')['left_join'](_0xebda('0x11'),'ct','ct.CmContactId\x20=\x20'+_0x4671a2+_0xebda('0x12'))[_0xebda('0xe')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x56e471;}function addFieldsToQuery(_0x227ee7,_0x29a28f,_0x2723d4,_0x32abe4,_0x494b06){var _0x449d7b=_0x494b06?'c':_0xebda('0xd');if(!_0x29a28f){_0x29a28f=['id',_0xebda('0x13'),_0xebda('0x14'),'phone','mobile',_0xebda('0x15'),_0xebda('0x16'),_0xebda('0x7'),_0xebda('0x17'),'createdAt','updatedAt','deletedAt','TagIds'];}else if(!_0x29a28f['includes']('id')){_0x29a28f[_0xebda('0x18')]('id');}var _0x3fe7b7=_0x2723d4&&_0x494b06||!_0x2723d4&&!_0x494b06;if(_0x32abe4){_0x3fe7b7=_0x32abe4&&_0x494b06||!_0x32abe4&&!_0x494b06;}_0x29a28f[_0xebda('0x19')](function(_0x464bd7){if(_0x464bd7==='TagIds'){if(_0x3fe7b7){_0x227ee7[_0xebda('0x1a')](_0xebda('0x1b'),_0x464bd7);}else if(_0x2723d4||_0x32abe4){_0x227ee7['field'](_0x449d7b+'.'+_0x464bd7);}}else{_0x227ee7[_0xebda('0x1a')](_0x449d7b+'.'+_0x464bd7);}});return _0x227ee7;}function getSqlClauses(){var _0x23b02d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0xebda('0x1c')](),'tags':{'clause':squel[_0xebda('0x1c')](),'ids':null},'user':{'clause':squel[_0xebda('0x1c')](),'skip':![]}};return _0x23b02d;}function parseTagParameter(_0x17eb32){var _0x144e11=squel['expr']();if(_0x17eb32){var _0x552f70=utils[_0xebda('0x1d')](_0x17eb32);_0x552f70[_0xebda('0x19')](function(_0x2ba9e8){_0x144e11['or'](_0xebda('0x1e'),'%,'+_0x2ba9e8+',%');});}return _0x144e11;}function parseSearchFilter(_0x35bfb4){var _0x1328e5=squel[_0xebda('0x1c')]();if(_0x35bfb4){var _0x1d5837=_0x35bfb4[_0xebda('0x1f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1d5837[_0xebda('0x20')]('\x20')[_0xebda('0x21')]>0x1){_0x1328e5['or'](_0xebda('0x22'),qs[_0xebda('0x23')](_0x1d5837),null);}else{if(qs['isNumeric'](_0x1d5837)){_0x1328e5['or'](_0xebda('0x24'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x25'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x26'),_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x27'),_0x1d5837+'%');}else if(qs[_0xebda('0x28')](_0x1d5837)){_0x1328e5['or']('c.email\x20LIKE\x20?',_0x1d5837+'%');}else{_0x1328e5['or'](_0xebda('0x29'),'%'+_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x2a'),'%'+_0x1d5837+'%');_0x1328e5['or'](_0xebda('0x2b'),'%'+_0x1d5837+'%');}}}return _0x1328e5;}function parseAdvancedSearchFilter(_0x1e85bf,_0x25fc1c){var _0x529a86=getSqlClauses();var _0x1fb30a=as[_0xebda('0x2c')](_0x1e85bf);var _0x419e93=_0x1fb30a[_0xebda('0x2d')];for(var _0x512135=0x0;_0x512135<_0x1fb30a['conditions'][_0xebda('0x21')];_0x512135++){var _0x5d3fd5=_0x1fb30a[_0xebda('0x2e')][_0x512135];var _0x214803='c';var _0x2b0a0e=_[_0xebda('0x2f')](_0x25fc1c,[_0xebda('0x30'),_0x5d3fd5['field']]);if(_0x2b0a0e){if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x31')||_0x2b0a0e['fieldType']===_0xebda('0x32')){_0x5d3fd5['castTo']=_0xebda('0x33');}var _0x5efe64=as[_0xebda('0x34')](_0x214803,_0x2b0a0e[_0xebda('0x35')],_0x5d3fd5);_0x529a86['default'][_0x419e93](_0x5efe64[_0xebda('0x36')],_0x5efe64[_0xebda('0x37')][_0xebda('0x38')],_0x5efe64[_0xebda('0x37')][_0xebda('0x39')]);}else{if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x3a')){var _0x97f7ae=_0x5d3fd5[_0xebda('0x37')][_0xebda('0x20')](',')[_0xebda('0x3b')](function(_0x3dee46){return Number(_0x3dee46);});var _0x40bb86=parseTagParameter(_0x97f7ae);_0x529a86[_0xebda('0x3c')][_0xebda('0x3d')]['and'](_0x40bb86);_0x529a86['tags'][_0xebda('0x3e')]=_0x97f7ae;}else if(_0x5d3fd5[_0xebda('0x1a')]===_0xebda('0x3f')){_0x529a86['user']['clause'][_0xebda('0x40')](_0xebda('0x41'),_0x5d3fd5[_0xebda('0x37')]);_0x529a86[_0xebda('0x42')][_0xebda('0x43')]=!![];}}}return _0x529a86;}function parseModelFields(_0x2f669f,_0x12bffc){var _0x1558e4=squel[_0xebda('0x1c')]();var _0x4ff7db=_(_0x2f669f)[_0xebda('0x44')]()['map'](function(_0x125612){return _[_0xebda('0x45')](_0x12bffc,[_0xebda('0x30'),_0x125612])?_0x125612:undefined;})[_0xebda('0x46')]()[_0xebda('0x37')]();if(_0x2f669f[_0xebda('0x47')]){_0x4ff7db[_0xebda('0x18')](_0xebda('0x47'));}if(_0x4ff7db[_0xebda('0x21')]>0x0){_0x4ff7db[_0xebda('0x19')](function(_0x41852e){if(_0x41852e==='ListId'){_0x1558e4[_0xebda('0x40')](_0xebda('0x48'),[][_0xebda('0x49')](_0x2f669f[_0x41852e]));}else if(_0x41852e==='Contact'){var _0x443657='%'+_0x2f669f[_0x41852e]+'%';_0x1558e4['and'](_0xebda('0x4a'),_0x443657);}else{_0x1558e4[_0xebda('0x40')]('c.'+_0x41852e+_0xebda('0x4b'),_0x2f669f[_0x41852e]);}});}return _0x1558e4;}function parseQueryParameters(_0x453907,_0x5475ae){var _0x202020=getSqlClauses();return Promise[_0xebda('0x4c')]()[_0xebda('0x4d')](function(){return parseModelFields(_0x453907,_0x5475ae);})[_0xebda('0x4d')](function(_0x20901f){_0x202020[_0xebda('0x4e')]['and'](_0x20901f);return parseTagParameter(_0x453907[_0xebda('0x4f')]);})['then'](function(_0x18ab03){_0x202020[_0xebda('0x3c')]['clause'][_0xebda('0x40')](_0x18ab03);return parseSearchFilter(_0x453907['filter']);})['then'](function(_0x1efb84){_0x202020[_0xebda('0x50')]=_0x1efb84;return _0x202020;});}function checkListsRestrictions(_0x159529,_0x26838f,_0x53008a){var _0x49f951=squel['expr']();return Promise[_0xebda('0x4c')]()[_0xebda('0x4d')](function(){if(_0x26838f[_0xebda('0x6')]&&_0x159529['role']===_0xebda('0x5')&&!_0x53008a){return _0x159529[_0xebda('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xebda('0x4d')](function(_0xda2a20){if(_0xda2a20){if(_0xda2a20[_0xebda('0x21')]===0x0){_0x49f951['and'](_0xebda('0x52'));}else{_0x49f951[_0xebda('0x40')](_0xebda('0x48'),_[_0xebda('0x3b')](_0xda2a20,'id'));}}})['then'](function(){return _0x49f951;});}function buildContactsQuery(_0x41355c,_0x190d80,_0x4deb4e,_0x484248,_0x27c8f0,_0x56f2c7){if(_0x190d80){_0x190d80=_0x4deb4e[_0xebda('0x53')];}_0x41355c=addFieldsToQuery(_0x41355c,_0x190d80,_0x484248,_0x56f2c7,!![]);var _0x2edb17=squel['select']();_0x2edb17=addFieldsToQuery(_0x2edb17,_0x190d80,_0x484248,_0x56f2c7,![]);if(_0x484248||_0x56f2c7){_0x41355c=applyJoinClauses(_0x41355c,!![]);_0x41355c['group'](_0xebda('0x54'));if(_0x4deb4e[_0xebda('0x55')]){_0x2edb17[_0xebda('0x55')](_0x4deb4e[_0xebda('0x55')]);}if(_0x4deb4e[_0xebda('0x56')]){_0x2edb17[_0xebda('0x56')](_0x4deb4e[_0xebda('0x56')]);}}else{_0x2edb17=applyJoinClauses(_0x2edb17,![]);_0x2edb17[_0xebda('0x57')]('subqry.id');if(_0x4deb4e[_0xebda('0x55')]){_0x41355c[_0xebda('0x55')](_0x4deb4e[_0xebda('0x55')]);}if(_0x4deb4e['offset']){_0x41355c[_0xebda('0x56')](_0x4deb4e[_0xebda('0x56')]);}}_0x2edb17[_0xebda('0x58')](_0x27c8f0);if(_0x4deb4e[_0xebda('0x59')]){_0x4deb4e[_0xebda('0x59')][_0xebda('0x19')](function(_0x523a86){_0x41355c['order']('c.'+_0x523a86[0x0],_0x523a86[0x1]===_0xebda('0x5a')?![]:!![]);_0x2edb17['order'](_0xebda('0x5b')+_0x523a86[0x0],_0x523a86[0x1]===_0xebda('0x5a')?![]:!![]);});}_0x2edb17['from'](_0x41355c,_0xebda('0xd'));return _0x2edb17;}function getFilteredContacts(_0x413d2e){var _0x1763d2=[];return db[_0xebda('0x3a')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0xebda('0x4d')](function(_0x30eecf){_0x1763d2=_[_0xebda('0x5c')](_0x30eecf,'id');var _0x31108b={'type':db[_0xebda('0x5d')][_0xebda('0x5e')][_0xebda('0x5f')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xebda('0x60')](_0x413d2e[_0xebda('0x61')](),_0x31108b);})[_0xebda('0x4d')](function(_0x370ec5){_0x370ec5[_0xebda('0x19')](function(_0x38d2ce){if(_0x38d2ce[_0xebda('0x62')]){_0x38d2ce[_0xebda('0x63')]=[];_0x38d2ce[_0xebda('0x62')][_0xebda('0x20')](',')[_0xebda('0x19')](function(_0x3a0a6d){_0x38d2ce[_0xebda('0x63')][_0xebda('0x18')](_0x1763d2[_0x3a0a6d]);});}delete _0x38d2ce[_0xebda('0x62')];});return _0x370ec5;});}function countFilteredContacts(_0x19bd48,_0x47be4a){var _0xd2f4cc=_0x19bd48[_0xebda('0x64')]();_0xd2f4cc['field'](_0xebda('0x65'));_0xd2f4cc=applyJoinClauses(_0xd2f4cc,!![]);_0x19bd48[_0xebda('0x57')](_0xebda('0x54'));var _0x590117=utils[_0xebda('0x1d')](_0x47be4a);if(!_[_0xebda('0x66')](_0x590117)){_0xd2f4cc[_0xebda('0xb')](_0xebda('0x67'),_0x590117);}var _0x55d9fe={'type':db[_0xebda('0x5d')][_0xebda('0x5e')][_0xebda('0x5f')],'raw':!![]};return db[_0xebda('0x68')][_0xebda('0x60')](_0xd2f4cc['toString'](),_0x55d9fe)[_0xebda('0x4d')](function(_0x488c7c){return _0x488c7c[0x0]['COUNT(*)'];});}module[_0xebda('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xcf87=['parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','end','Tag','map','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','tag','tags','resolve','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','limit','offset','subqry.id','order','subqry.','DESC','findAll','color','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','push','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xcf87,0xa8));var _0x7cf8=function(_0x5d494c,_0x1a1e96){_0x5d494c=_0x5d494c-0x0;var _0x4b92eb=_0xcf87[_0x5d494c];return _0x4b92eb;};'use strict';var _=require(_0x7cf8('0x0'));var squel=require('squel');var as=require(_0x7cf8('0x1'));var qs=require(_0x7cf8('0x2'));var utils=require(_0x7cf8('0x3'));var db=require(_0x7cf8('0x4'))['db'];function skipContactsQuery(_0x1c0f15,_0xbd325f){var _0x15a288=![];if(_0x1c0f15['role']===_0x7cf8('0x5')&&!_0xbd325f[_0x7cf8('0x6')]&&!_0xbd325f[_0x7cf8('0x7')]&&_0xbd325f[_0x7cf8('0x8')]!==_0x7cf8('0x9')){_0x15a288=!![];}return _0x15a288;}function getContactsSubquery(){return squel[_0x7cf8('0xa')]()[_0x7cf8('0xb')](_0x7cf8('0xc'),'c')['where'](_0x7cf8('0xd'));}function applyJoinClauses(_0x91e5db,_0x4c4bdc){var _0xee35f2=_0x4c4bdc?'c':_0x7cf8('0xe');_0x91e5db[_0x7cf8('0xf')](_0x7cf8('0x10'),'uc',_0x7cf8('0x11')+_0xee35f2+'.id')[_0x7cf8('0xf')]('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0xee35f2+_0x7cf8('0x12'))[_0x7cf8('0xf')](_0x7cf8('0x13'),'t',_0x7cf8('0x14'));return _0x91e5db;}function addFieldsToQuery(_0x1ddcce,_0x5d1965,_0x3f4440,_0x1f698e,_0x33e319){var _0xf1a383=_0x33e319?'c':_0x7cf8('0xe');if(!_0x5d1965){_0x5d1965=['id',_0x7cf8('0x15'),'lastName',_0x7cf8('0x16'),_0x7cf8('0x17'),_0x7cf8('0x18'),_0x7cf8('0x19'),_0x7cf8('0x7'),_0x7cf8('0x1a'),_0x7cf8('0x1b'),_0x7cf8('0x1c'),_0x7cf8('0x1d'),_0x7cf8('0x1e')];}else if(!_0x5d1965[_0x7cf8('0x1f')]('id')){_0x5d1965['push']('id');}var _0x323bd3=_0x3f4440&&_0x33e319||!_0x3f4440&&!_0x33e319;if(_0x1f698e){_0x323bd3=_0x1f698e&&_0x33e319||!_0x1f698e&&!_0x33e319;}_0x5d1965[_0x7cf8('0x20')](function(_0x16e3b3){if(_0x16e3b3===_0x7cf8('0x1e')){if(_0x323bd3){_0x1ddcce[_0x7cf8('0x21')](_0x7cf8('0x22'),_0x16e3b3);}else if(_0x3f4440||_0x1f698e){_0x1ddcce[_0x7cf8('0x21')](_0xf1a383+'.'+_0x16e3b3);}}else{_0x1ddcce[_0x7cf8('0x21')](_0xf1a383+'.'+_0x16e3b3);}});return _0x1ddcce;}function getSqlClauses(){var _0x3b4d34={'default':squel[_0x7cf8('0x23')](),'fields':squel['expr'](),'filter':squel[_0x7cf8('0x23')](),'tags':{'clause':squel[_0x7cf8('0x23')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x3b4d34;}function parseTagParameter(_0x36adaa){var _0x2e6131=squel[_0x7cf8('0x23')]();if(_0x36adaa){var _0x3125a5=utils['getSelectedTags'](_0x36adaa);_0x3125a5[_0x7cf8('0x20')](function(_0x42da20){_0x2e6131['or'](_0x7cf8('0x24'),'%,'+_0x42da20+',%');});}return _0x2e6131;}function parseSearchFilter(_0xda2271){var _0x373653=squel[_0x7cf8('0x23')]();if(_0xda2271){var _0x2e140e=_0xda2271[_0x7cf8('0x25')]('\x5c','\x5c\x5c')[_0x7cf8('0x25')](/'/g,'\x27\x27');if(_0x2e140e[_0x7cf8('0x26')]('\x20')[_0x7cf8('0x27')]>0x1){_0x373653['or'](_0x7cf8('0x28'),qs[_0x7cf8('0x29')](_0x2e140e),null);}else{if(qs['isNumeric'](_0x2e140e)){_0x373653['or'](_0x7cf8('0x2a'),_0x2e140e+'%');_0x373653['or']('c.phone\x20LIKE\x20?',_0x2e140e+'%');_0x373653['or'](_0x7cf8('0x2b'),_0x2e140e+'%');_0x373653['or']('c.fax\x20LIKE\x20?',_0x2e140e+'%');}else if(qs[_0x7cf8('0x2c')](_0x2e140e)){_0x373653['or'](_0x7cf8('0x2d'),_0x2e140e+'%');}else{_0x373653['or'](_0x7cf8('0x2e'),'%'+_0x2e140e+'%');_0x373653['or'](_0x7cf8('0x2f'),'%'+_0x2e140e+'%');_0x373653['or'](_0x7cf8('0x2d'),'%'+_0x2e140e+'%');}}}return _0x373653;}function parseAdvancedSearchFilter(_0x56df83,_0x8c3d14){var _0x597ad2=getSqlClauses();var _0x13a154=as[_0x7cf8('0x30')](_0x56df83);var _0x5015a5=_0x13a154[_0x7cf8('0x31')];for(var _0x260a76=0x0;_0x260a76<_0x13a154[_0x7cf8('0x32')]['length'];_0x260a76++){var _0x1ddf16=_0x13a154[_0x7cf8('0x32')][_0x260a76];var _0x121aba='c';var _0x1c7065=_['find'](_0x8c3d14,[_0x7cf8('0x33'),_0x1ddf16[_0x7cf8('0x21')]]);if(_0x1c7065){if(_0x1ddf16[_0x7cf8('0x21')]===_0x7cf8('0x34')||_0x1c7065[_0x7cf8('0x35')]===_0x7cf8('0x36')){_0x1ddf16[_0x7cf8('0x37')]='DATE';}var _0x47698e=as[_0x7cf8('0x38')](_0x121aba,_0x1c7065[_0x7cf8('0x39')],_0x1ddf16);_0x597ad2[_0x7cf8('0x3a')][_0x5015a5](_0x47698e[_0x7cf8('0x3b')],_0x47698e[_0x7cf8('0x3c')][_0x7cf8('0x3d')],_0x47698e[_0x7cf8('0x3c')][_0x7cf8('0x3e')]);}else{if(_0x1ddf16[_0x7cf8('0x21')]===_0x7cf8('0x3f')){var _0x1b0085=_0x1ddf16[_0x7cf8('0x3c')][_0x7cf8('0x26')](',')[_0x7cf8('0x40')](function(_0x3f83b6){return Number(_0x3f83b6);});var _0x4a6389=parseTagParameter(_0x1b0085);_0x597ad2['tags'][_0x7cf8('0x41')][_0x7cf8('0x42')](_0x4a6389);_0x597ad2['tags'][_0x7cf8('0x43')]=_0x1b0085;}else if(_0x1ddf16['field']===_0x7cf8('0x44')){_0x597ad2[_0x7cf8('0x45')][_0x7cf8('0x41')]['and'](_0x7cf8('0x46'),_0x1ddf16['value']);_0x597ad2[_0x7cf8('0x45')][_0x7cf8('0x47')]=!![];}}}return _0x597ad2;}function parseModelFields(_0x2cb82f,_0x1f6076){var _0x557038=squel[_0x7cf8('0x23')]();var _0x5b123d=_(_0x2cb82f)[_0x7cf8('0x48')]()[_0x7cf8('0x40')](function(_0x5e637b){return _[_0x7cf8('0x49')](_0x1f6076,[_0x7cf8('0x33'),_0x5e637b])?_0x5e637b:undefined;})['compact']()[_0x7cf8('0x3c')]();if(_0x2cb82f[_0x7cf8('0x4a')]){_0x5b123d['push'](_0x7cf8('0x4a'));}if(_0x5b123d[_0x7cf8('0x27')]>0x0){_0x5b123d[_0x7cf8('0x20')](function(_0x876b7f){if(_0x876b7f===_0x7cf8('0x7')){_0x557038[_0x7cf8('0x42')]('c.ListId\x20IN\x20?',[][_0x7cf8('0x4b')](_0x2cb82f[_0x876b7f]));}else if(_0x876b7f===_0x7cf8('0x4a')){var _0x5f4a3e='%'+_0x2cb82f[_0x876b7f]+'%';_0x557038[_0x7cf8('0x42')](_0x7cf8('0x4c'),_0x5f4a3e);}else{_0x557038[_0x7cf8('0x42')]('c.'+_0x876b7f+'\x20=\x20?',_0x2cb82f[_0x876b7f]);}});}return _0x557038;}function parseQueryParameters(_0x23babd,_0x26f4fd){var _0x59ba86=getSqlClauses();return Promise['resolve']()[_0x7cf8('0x4d')](function(){return parseModelFields(_0x23babd,_0x26f4fd);})[_0x7cf8('0x4d')](function(_0x1881dd){_0x59ba86['fields']['and'](_0x1881dd);return parseTagParameter(_0x23babd[_0x7cf8('0x4e')]);})[_0x7cf8('0x4d')](function(_0x499136){_0x59ba86[_0x7cf8('0x4f')][_0x7cf8('0x41')][_0x7cf8('0x42')](_0x499136);return parseSearchFilter(_0x23babd['filter']);})[_0x7cf8('0x4d')](function(_0x3cf20b){_0x59ba86['filter']=_0x3cf20b;return _0x59ba86;});}function checkListsRestrictions(_0x36a1b8,_0x577170,_0x280074){var _0x366b79=squel[_0x7cf8('0x23')]();return Promise[_0x7cf8('0x50')]()['then'](function(){if(_0x577170[_0x7cf8('0x6')]&&_0x36a1b8['role']===_0x7cf8('0x5')&&!_0x280074){return _0x36a1b8[_0x7cf8('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x7cf8('0x4d')](function(_0x5041b9){if(_0x5041b9){if(_0x5041b9[_0x7cf8('0x27')]===0x0){_0x366b79[_0x7cf8('0x42')](_0x7cf8('0x52'));}else{_0x366b79[_0x7cf8('0x42')](_0x7cf8('0x53'),_[_0x7cf8('0x40')](_0x5041b9,'id'));}}})[_0x7cf8('0x4d')](function(){return _0x366b79;});}function buildContactsQuery(_0xf7ba3a,_0x195cd4,_0x55b363,_0x58e9a4,_0x25c26a,_0x2cbcb8){if(_0x195cd4){_0x195cd4=_0x55b363[_0x7cf8('0x54')];}_0xf7ba3a=addFieldsToQuery(_0xf7ba3a,_0x195cd4,_0x58e9a4,_0x2cbcb8,!![]);var _0x1eb29d=squel[_0x7cf8('0xa')]();_0x1eb29d=addFieldsToQuery(_0x1eb29d,_0x195cd4,_0x58e9a4,_0x2cbcb8,![]);if(_0x58e9a4||_0x2cbcb8){_0xf7ba3a=applyJoinClauses(_0xf7ba3a,!![]);_0xf7ba3a[_0x7cf8('0x55')]('c.id');if(_0x55b363['limit']){_0x1eb29d[_0x7cf8('0x56')](_0x55b363[_0x7cf8('0x56')]);}if(_0x55b363[_0x7cf8('0x57')]){_0x1eb29d[_0x7cf8('0x57')](_0x55b363['offset']);}}else{_0x1eb29d=applyJoinClauses(_0x1eb29d,![]);_0x1eb29d[_0x7cf8('0x55')](_0x7cf8('0x58'));if(_0x55b363[_0x7cf8('0x56')]){_0xf7ba3a[_0x7cf8('0x56')](_0x55b363['limit']);}if(_0x55b363['offset']){_0xf7ba3a[_0x7cf8('0x57')](_0x55b363[_0x7cf8('0x57')]);}}_0x1eb29d['having'](_0x25c26a);if(_0x55b363['order']){_0x55b363['order'][_0x7cf8('0x20')](function(_0x39ef8c){_0xf7ba3a[_0x7cf8('0x59')]('c.'+_0x39ef8c[0x0],_0x39ef8c[0x1]==='DESC'?![]:!![]);_0x1eb29d[_0x7cf8('0x59')](_0x7cf8('0x5a')+_0x39ef8c[0x0],_0x39ef8c[0x1]===_0x7cf8('0x5b')?![]:!![]);});}_0x1eb29d[_0x7cf8('0xb')](_0xf7ba3a,_0x7cf8('0xe'));return _0x1eb29d;}function getFilteredContacts(_0x4a9c7b){var _0x5a98bb=[];return db[_0x7cf8('0x3f')][_0x7cf8('0x5c')]({'attributes':['id','name',_0x7cf8('0x5d')],'raw':!![]})[_0x7cf8('0x4d')](function(_0x23b2a9){_0x5a98bb=_['keyBy'](_0x23b2a9,'id');var _0x5425b1={'type':db[_0x7cf8('0x5e')]['QueryTypes'][_0x7cf8('0x5f')],'model':db[_0x7cf8('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7cf8('0x61')][_0x7cf8('0x62')](_0x4a9c7b[_0x7cf8('0x63')](),_0x5425b1);})['then'](function(_0x284b7f){_0x284b7f[_0x7cf8('0x20')](function(_0x5caa96){if(_0x5caa96[_0x7cf8('0x1e')]){_0x5caa96[_0x7cf8('0x64')]=[];_0x5caa96[_0x7cf8('0x1e')][_0x7cf8('0x26')](',')[_0x7cf8('0x20')](function(_0x3b5bcf){_0x5caa96['Tags'][_0x7cf8('0x65')](_0x5a98bb[_0x3b5bcf]);});}delete _0x5caa96[_0x7cf8('0x1e')];});return _0x284b7f;});}function countFilteredContacts(_0x2057a0,_0x17b24d){var _0x13e5d8=_0x2057a0['clone']();_0x13e5d8[_0x7cf8('0x21')](_0x7cf8('0x66'));_0x13e5d8=applyJoinClauses(_0x13e5d8,!![]);_0x2057a0[_0x7cf8('0x55')]('c.id');var _0x5d50d3=utils[_0x7cf8('0x67')](_0x17b24d);if(!_[_0x7cf8('0x68')](_0x5d50d3)){_0x13e5d8['where'](_0x7cf8('0x69'),_0x5d50d3);}var _0x500e9f={'type':db[_0x7cf8('0x5e')][_0x7cf8('0x6a')][_0x7cf8('0x5f')],'raw':!![]};return db['sequelize'][_0x7cf8('0x62')](_0x13e5d8[_0x7cf8('0x63')](),_0x500e9f)['then'](function(_0x16acd0){return _0x16acd0[0x0]['COUNT(*)'];});}module[_0x7cf8('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e3131d3..7bd1824 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 _0x78d4=['join','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','end','binary','write','unlink','createDecipher','close','secret','createCipher','update','utf8','base64','decryptString','final','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78d4,0xbc));var _0x478d=function(_0x51ad2f,_0x3d022e){_0x51ad2f=_0x51ad2f-0x0;var _0x5414f8=_0x78d4[_0x51ad2f];return _0x5414f8;};'use strict';var crypto=require(_0x478d('0x0'));var fs=require('fs');var BPromise=require(_0x478d('0x1'));var _=require(_0x478d('0x2'));var config=require(_0x478d('0x3'));var logger=require('../../config/logger')(_0x478d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x478d('0x5')][_0x478d('0x6')],'algorithm':_0x478d('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x478d('0x8')]&&config[_0x478d('0x8')][_0x478d('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x478d('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x478d('0x8')][_0x478d('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x478d('0xa')](',\x20');logger['error'](config['encrypt'][_0x478d('0x9')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1fd392){return AES_SUPPORTED_RX[_0x478d('0xb')](_0x1fd392);}function getSupportedCiphers(){return crypto[_0x478d('0xc')]()[_0x478d('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4f2abd){return getSupportedCiphers()[_0x478d('0xe')](_0x4f2abd)>-0x1;}function combineOptions(_0x42ed3d){var _0x498562={};for(var _0x9739b4 in fileOptions){if(fileOptions[_0x478d('0xf')](_0x9739b4)){_0x498562[_0x9739b4]=fileOptions[_0x9739b4];}}if(_0x42ed3d){for(var _0x26e3f7 in _0x42ed3d){if(_0x42ed3d[_0x478d('0xf')](_0x26e3f7)){_0x498562[_0x26e3f7]=_0x42ed3d[_0x26e3f7];}}}return _0x498562;}exports[_0x478d('0x10')]=function(_0x1516d6,_0x531f15,_0x1726ca,_0x2db29b){return new BPromise(function(_0x3a40f5,_0x3a94f6){_0x2db29b=combineOptions(_0x2db29b);var _0x446b84=new Buffer(_0x1726ca);var _0x32bd55=fs[_0x478d('0x11')](_0x1516d6);var _0x4e8a00=fs[_0x478d('0x12')](_0x531f15);var _0x5e175e=crypto['createCipher'](_0x2db29b['algorithm'],_0x446b84);_0x32bd55['on'](_0x478d('0x13'),function(_0x3b6482){var _0x5eda86=new Buffer(_0x5e175e['update'](_0x3b6482),'binary');_0x4e8a00['write'](_0x5eda86);});_0x32bd55['on'](_0x478d('0x14'),function(){try{var _0x1dfc3e=new Buffer(_0x5e175e['final']('binary'),_0x478d('0x15'));_0x4e8a00[_0x478d('0x16')](_0x1dfc3e);_0x4e8a00[_0x478d('0x14')]();_0x4e8a00['on']('close',function(){return _0x3a40f5(_0x531f15);});}catch(_0x525f6b){fs[_0x478d('0x17')](_0x531f15);return _0x3a94f6(_0x525f6b);}});});};exports['decryptFile']=function(_0x3fcb61,_0x46586f,_0x5cc72d,_0x3a464a){return new BPromise(function(_0x3b9514,_0x2cfc0d){_0x3a464a=combineOptions(_0x3a464a);var _0x137b1a=new Buffer(_0x5cc72d);var _0x263a72=fs[_0x478d('0x11')](_0x3fcb61);var _0x5bbc87=fs[_0x478d('0x12')](_0x46586f);var _0x2b9582=crypto[_0x478d('0x18')](_0x3a464a[_0x478d('0x9')],_0x137b1a);_0x263a72['on'](_0x478d('0x13'),function(_0x19cbd8){var _0x1dfb12=new Buffer(_0x2b9582['update'](_0x19cbd8),'binary');_0x5bbc87[_0x478d('0x16')](_0x1dfb12);});_0x263a72['on'](_0x478d('0x14'),function(){try{var _0x19db7b=new Buffer(_0x2b9582['final'](_0x478d('0x15')),_0x478d('0x15'));_0x5bbc87[_0x478d('0x16')](_0x19db7b);_0x5bbc87['end']();_0x5bbc87['on'](_0x478d('0x19'),function(){return _0x3b9514(_0x46586f);});}catch(_0x334bfa){fs['unlink'](_0x46586f);return _0x2cfc0d(_0x334bfa);}});});};exports['encryptString']=function(_0x59e689,_0x142da9,_0x3cda2a){var _0x280a45=_0x3cda2a||stringOptions[_0x478d('0x9')];var _0xd88916=_0x142da9||stringOptions[_0x478d('0x1a')];var _0x37cf4f=crypto[_0x478d('0x1b')](_0x280a45,_0xd88916);var _0x32be01=_0x37cf4f[_0x478d('0x1c')](_0x59e689,_0x478d('0x1d'),_0x478d('0x1e'));_0x32be01+=_0x37cf4f['final']('base64');return _0x32be01;};exports[_0x478d('0x1f')]=function(_0x55da05,_0x310530,_0x3daff1){var _0x474c27=_0x3daff1||stringOptions['algorithm'];var _0x29b928=_0x310530||stringOptions[_0x478d('0x1a')];var _0xd3f662=crypto['createDecipher'](_0x474c27,_0x29b928);var _0x5bbf35=_0xd3f662[_0x478d('0x1c')](_0x55da05,_0x478d('0x1e'),_0x478d('0x1d'));_0x5bbf35+=_0xd3f662[_0x478d('0x20')](_0x478d('0x1d'));return _0x5bbf35;}; \ No newline at end of file +var _0x8c66=['../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','binary','end','write','unlink','decryptFile','createReadStream','data','update','encryptString','utf8','final','base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment'];(function(_0x2a8cb0,_0x3aae7d){var _0x498457=function(_0x4d429f){while(--_0x4d429f){_0x2a8cb0['push'](_0x2a8cb0['shift']());}};_0x498457(++_0x3aae7d);}(_0x8c66,0x88));var _0x68c6=function(_0x5421a4,_0x362d8b){_0x5421a4=_0x5421a4-0x0;var _0x16b546=_0x8c66[_0x5421a4];return _0x16b546;};'use strict';var crypto=require(_0x68c6('0x0'));var fs=require('fs');var BPromise=require(_0x68c6('0x1'));var _=require(_0x68c6('0x2'));var config=require(_0x68c6('0x3'));var logger=require(_0x68c6('0x4'))(_0x68c6('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x68c6('0x6')][_0x68c6('0x7')],'algorithm':_0x68c6('0x8')};const fileOptions={'algorithm':_0x68c6('0x9')};if(config['encrypt']&&config[_0x68c6('0xa')][_0x68c6('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x68c6('0xb')]=config[_0x68c6('0xa')][_0x68c6('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x68c6('0xc')](config['encrypt'][_0x68c6('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x14632d){return AES_SUPPORTED_RX[_0x68c6('0xd')](_0x14632d);}function getSupportedCiphers(){return crypto[_0x68c6('0xe')]()[_0x68c6('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x14320e){return getSupportedCiphers()[_0x68c6('0x10')](_0x14320e)>-0x1;}function combineOptions(_0xbfc849){var _0x4c9c02={};for(var _0x59d242 in fileOptions){if(fileOptions[_0x68c6('0x11')](_0x59d242)){_0x4c9c02[_0x59d242]=fileOptions[_0x59d242];}}if(_0xbfc849){for(var _0x234a9e in _0xbfc849){if(_0xbfc849[_0x68c6('0x11')](_0x234a9e)){_0x4c9c02[_0x234a9e]=_0xbfc849[_0x234a9e];}}}return _0x4c9c02;}exports[_0x68c6('0x12')]=function(_0x5c3848,_0x5e91cc,_0x277bc5,_0x3b127d){return new BPromise(function(_0x2d3e12,_0x119f8f){_0x3b127d=combineOptions(_0x3b127d);var _0x252eed=new Buffer(_0x277bc5);var _0x2d87e3=fs['createReadStream'](_0x5c3848);var _0x5d04cb=fs[_0x68c6('0x13')](_0x5e91cc);var _0x273864=crypto[_0x68c6('0x14')](_0x3b127d[_0x68c6('0xb')],_0x252eed);_0x2d87e3['on']('data',function(_0xd2908d){var _0x5ee4ad=new Buffer(_0x273864['update'](_0xd2908d),_0x68c6('0x15'));_0x5d04cb['write'](_0x5ee4ad);});_0x2d87e3['on'](_0x68c6('0x16'),function(){try{var _0x17e8f0=new Buffer(_0x273864['final'](_0x68c6('0x15')),_0x68c6('0x15'));_0x5d04cb[_0x68c6('0x17')](_0x17e8f0);_0x5d04cb[_0x68c6('0x16')]();_0x5d04cb['on']('close',function(){return _0x2d3e12(_0x5e91cc);});}catch(_0x4ecb5d){fs[_0x68c6('0x18')](_0x5e91cc);return _0x119f8f(_0x4ecb5d);}});});};exports[_0x68c6('0x19')]=function(_0x2a70ac,_0x3fc99c,_0x4d322a,_0x43a03a){return new BPromise(function(_0x398984,_0x702d1d){_0x43a03a=combineOptions(_0x43a03a);var _0x1b93ff=new Buffer(_0x4d322a);var _0x53cfc4=fs[_0x68c6('0x1a')](_0x2a70ac);var _0x5407e1=fs[_0x68c6('0x13')](_0x3fc99c);var _0x5bc3bf=crypto['createDecipher'](_0x43a03a[_0x68c6('0xb')],_0x1b93ff);_0x53cfc4['on'](_0x68c6('0x1b'),function(_0x2284dc){var _0x4d2a6f=new Buffer(_0x5bc3bf[_0x68c6('0x1c')](_0x2284dc),_0x68c6('0x15'));_0x5407e1[_0x68c6('0x17')](_0x4d2a6f);});_0x53cfc4['on'](_0x68c6('0x16'),function(){try{var _0x238f40=new Buffer(_0x5bc3bf['final']('binary'),_0x68c6('0x15'));_0x5407e1['write'](_0x238f40);_0x5407e1['end']();_0x5407e1['on']('close',function(){return _0x398984(_0x3fc99c);});}catch(_0x341518){fs[_0x68c6('0x18')](_0x3fc99c);return _0x702d1d(_0x341518);}});});};exports[_0x68c6('0x1d')]=function(_0x27b020,_0x475317,_0x235b0c){var _0x17d39=_0x235b0c||stringOptions[_0x68c6('0xb')];var _0x575a46=_0x475317||stringOptions['secret'];var _0xf540c4=crypto[_0x68c6('0x14')](_0x17d39,_0x575a46);var _0x3f7079=_0xf540c4[_0x68c6('0x1c')](_0x27b020,_0x68c6('0x1e'),'base64');_0x3f7079+=_0xf540c4[_0x68c6('0x1f')](_0x68c6('0x20'));return _0x3f7079;};exports[_0x68c6('0x21')]=function(_0x2e1a66,_0x16dd7f,_0x43ecb4){var _0xd66924=_0x43ecb4||stringOptions[_0x68c6('0xb')];var _0x36ce0a=_0x16dd7f||stringOptions['secret'];var _0x142178=crypto[_0x68c6('0x22')](_0xd66924,_0x36ce0a);var _0x5c4e84=_0x142178['update'](_0x2e1a66,'base64',_0x68c6('0x1e'));_0x5c4e84+=_0x142178[_0x68c6('0x1f')]('utf8');return _0x5c4e84;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 0bc91f9..7dbc5f2 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 _0x6853=['range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','format','dirname','basename','length','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','to-csv','zip-dir','rimraf','../../mysqldb','dbH','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0x25a553,_0x57d9e7){var _0x1aff24=function(_0x5496e1){while(--_0x5496e1){_0x25a553['push'](_0x25a553['shift']());}};_0x1aff24(++_0x57d9e7);}(_0x6853,0x13c));var _0x3685=function(_0x5bac30,_0x118582){_0x5bac30=_0x5bac30-0x0;var _0x152f17=_0x6853[_0x5bac30];return _0x152f17;};'use strict';var util=require(_0x3685('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0x3685('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x3685('0x2'));var rimraf=require(_0x3685('0x3'));var db=require(_0x3685('0x4'))['db'];var dbH=require('../../mysqldb')[_0x3685('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3685('0x6')][0x2]);var QUERY=process[_0x3685('0x6')][0x3];var PATH=process[_0x3685('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30daf0,_0x43370d){var _0x4f390e={'status':_0x30daf0};var _0x2dc32e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43370d){_0x4f390e['savename']=_0x43370d;}return db['AnalyticExtractedReport'][_0x3685('0x7')](_0x4f390e,_0x2dc32e);}function main(){var _0x36dd51=0x1388;var _0x310cbe;logger[_0x3685('0x8')](util['format'](_0x3685('0x9'),EXTRACTED_REPORT_ID,_0x3685('0xa')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3685('0xb'),_0x3685('0xc')]})[_0x3685('0xd')](function(_0x1602e4){if(_0x1602e4){_0x310cbe=_0x1602e4;_0x36dd51=_0x310cbe['splitSizeCsv']||0x1388;}})[_0x3685('0xd')](function(){return dbH[_0x3685('0xe')][_0x3685('0xf')](util['format'](_0x3685('0x10'),QUERY),{'type':dbH[_0x3685('0xe')]['QueryTypes'][_0x3685('0x11')]});})[_0x3685('0xd')](function(_0x1d62d4){if(!_0x1d62d4[0x0][_0x3685('0x12')]){return analyticExtractedReport(_0x3685('0x13'));}var _0x100e4c=[];var _0x2810ea=0x0;if(_0x310cbe['split']){if(_0x1d62d4&&_0x1d62d4['length']){var _0x347e46=_[_0x3685('0x14')](_0x1d62d4[0x0][_0x3685('0x12')]/_0x36dd51);var _0x2b4a6d=Number[_0x3685('0x15')](_0x1d62d4[0x0][_0x3685('0x12')]/_0x36dd51)?_0x1d62d4[0x0][_0x3685('0x12')]%_0x36dd51:0x0;_0x347e46[_0x3685('0x16')](function(_0x1af216){if(_0x1af216>0x0){_0x2810ea+=_0x36dd51;}_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')]['query'](util['format'](_0x3685('0x18'),QUERY,_0x36dd51,_0x2810ea),{'type':dbH[_0x3685('0xe')][_0x3685('0x19')]['SELECT']}));});if(_0x2b4a6d>0x0){_0x2810ea+=_0x36dd51;_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')][_0x3685('0xf')](util[_0x3685('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b4a6d,_0x2810ea),{'type':dbH[_0x3685('0xe')][_0x3685('0x19')][_0x3685('0x11')]}));}}}else{_0x100e4c[_0x3685('0x17')](dbH[_0x3685('0xe')][_0x3685('0xf')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x3685('0x11')]}));}var _0x5d8c0e=path[_0x3685('0x1b')](PATH);var _0x3af7f8=path[_0x3685('0x1c')](PATH,'.csv');var _0x5d8c1f=_0x310cbe[_0x3685('0xb')]&&_0x100e4c[_0x3685('0x1d')]>0x1;var _0x21fa53=[];if(!fs[_0x3685('0x1e')](path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8))&&_0x5d8c1f){fs['mkdirSync'](path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8));}return BPromise[_0x3685('0x20')](_0x100e4c,function(_0x3e7e00){_0x21fa53[_0x3685('0x17')](_0x3e7e00);})['then'](function(){for(var _0x46091d=0x0;_0x46091d<_0x21fa53['length'];_0x46091d+=0x1){var _0x3a9e23;var _0x59b482=_0x21fa53[_0x46091d];if(_0x5d8c1f){_0x3a9e23=path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8,util[_0x3685('0x1a')](_0x3685('0x21'),_0x3af7f8,_0x46091d,_0x3685('0x22')));}else{_0x3a9e23=path[_0x3685('0x1f')](_0x5d8c0e,util[_0x3685('0x1a')]('%s.%s',_0x3af7f8,_0x3685('0x22')));}fs['writeFileSync'](_0x3a9e23,csv(_0x59b482));}})[_0x3685('0xd')](function(){if(_0x5d8c1f){return new Promise(function(_0x3c0d7a){zipdir(path['join'](_0x5d8c0e,_0x3af7f8),{'saveTo':path[_0x3685('0x1f')](_0x5d8c0e,util['format'](_0x3685('0x23'),_0x3af7f8,_0x3685('0x24')))},function(_0x496c68,_0x37628b){rimraf(path[_0x3685('0x1f')](_0x5d8c0e,_0x3af7f8),function(){});_0x3c0d7a(_0x3685('0x25'));});});}})['then'](function(){logger['info'](util[_0x3685('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x3685('0x26'),_0x5d8c1f?util[_0x3685('0x1a')](_0x3685('0x23'),_0x3af7f8,_0x5d8c1f?'zip':_0x3685('0x22')):null);});})[_0x3685('0x27')](function(_0x49b056){logger[_0x3685('0x8')](util[_0x3685('0x1a')](_0x3685('0x28'),EXTRACTED_REPORT_ID,_0x3685('0xa')),util['inspect'](_0x49b056,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3685('0x29')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xfada=['Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','exit','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num'];(function(_0x3dd7fd,_0x2c0f96){var _0x508615=function(_0x9aff68){while(--_0x9aff68){_0x3dd7fd['push'](_0x3dd7fd['shift']());}};_0x508615(++_0x2c0f96);}(_0xfada,0x1e4));var _0xafad=function(_0x4a3899,_0x38eb14){_0x4a3899=_0x4a3899-0x0;var _0x59cc6c=_0xfada[_0x4a3899];return _0x59cc6c;};'use strict';var util=require(_0xafad('0x0'));var path=require(_0xafad('0x1'));var _=require(_0xafad('0x2'));var csv=require(_0xafad('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xafad('0x4'));var rimraf=require(_0xafad('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xafad('0x6'))[_0xafad('0x7')];var logger=require(_0xafad('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xafad('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x159d1e,_0x33bafa){var _0x39e7b4={'status':_0x159d1e};var _0x7a0cf9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33bafa){_0x39e7b4[_0xafad('0xa')]=_0x33bafa;}return db[_0xafad('0xb')][_0xafad('0xc')](_0x39e7b4,_0x7a0cf9);}function main(){var _0x33befd=0x1388;var _0x4d224f;logger['info'](util[_0xafad('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xafad('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xafad('0xf'),_0xafad('0x10')]})[_0xafad('0x11')](function(_0x4be600){if(_0x4be600){_0x4d224f=_0x4be600;_0x33befd=_0x4d224f[_0xafad('0x10')]||0x1388;}})[_0xafad('0x11')](function(){return dbH[_0xafad('0x12')][_0xafad('0x13')](util[_0xafad('0xd')](_0xafad('0x14'),QUERY),{'type':dbH[_0xafad('0x12')]['QueryTypes']['SELECT']});})[_0xafad('0x11')](function(_0x1742fd){if(!_0x1742fd[0x0][_0xafad('0x15')]){return analyticExtractedReport(_0xafad('0x16'));}var _0x3e5b0c=[];var _0x102288=0x0;if(_0x4d224f[_0xafad('0xf')]){if(_0x1742fd&&_0x1742fd[_0xafad('0x17')]){var _0x2c28ef=_[_0xafad('0x18')](_0x1742fd[0x0]['num']/_0x33befd);var _0x9c7b73=Number['isInteger'](_0x1742fd[0x0]['num']/_0x33befd)?_0x1742fd[0x0][_0xafad('0x15')]%_0x33befd:0x0;_0x2c28ef[_0xafad('0x19')](function(_0x247032){if(_0x247032>0x0){_0x102288+=_0x33befd;}_0x3e5b0c[_0xafad('0x1a')](dbH['sequelize']['query'](util['format'](_0xafad('0x1b'),QUERY,_0x33befd,_0x102288),{'type':dbH[_0xafad('0x12')][_0xafad('0x1c')][_0xafad('0x1d')]}));});if(_0x9c7b73>0x0){_0x102288+=_0x33befd;_0x3e5b0c[_0xafad('0x1a')](dbH[_0xafad('0x12')][_0xafad('0x13')](util[_0xafad('0xd')](_0xafad('0x1b'),QUERY,_0x9c7b73,_0x102288),{'type':dbH[_0xafad('0x12')][_0xafad('0x1c')][_0xafad('0x1d')]}));}}}else{_0x3e5b0c[_0xafad('0x1a')](dbH[_0xafad('0x12')][_0xafad('0x13')](QUERY,{'type':dbH['sequelize'][_0xafad('0x1c')]['SELECT']}));}var _0x445b13=path['dirname'](PATH);var _0x155c1a=path[_0xafad('0x1e')](PATH,'.csv');var _0x1c7a6c=_0x4d224f[_0xafad('0xf')]&&_0x3e5b0c[_0xafad('0x17')]>0x1;var _0x35af4b=[];if(!fs[_0xafad('0x1f')](path[_0xafad('0x20')](_0x445b13,_0x155c1a))&&_0x1c7a6c){fs['mkdirSync'](path[_0xafad('0x20')](_0x445b13,_0x155c1a));}return BPromise[_0xafad('0x21')](_0x3e5b0c,function(_0x498f7c){_0x35af4b[_0xafad('0x1a')](_0x498f7c);})[_0xafad('0x11')](function(){for(var _0x46f83f=0x0;_0x46f83f<_0x35af4b['length'];_0x46f83f+=0x1){var _0x2a4f10;var _0x513fee=_0x35af4b[_0x46f83f];if(_0x1c7a6c){_0x2a4f10=path['join'](_0x445b13,_0x155c1a,util[_0xafad('0xd')](_0xafad('0x22'),_0x155c1a,_0x46f83f,_0xafad('0x23')));}else{_0x2a4f10=path['join'](_0x445b13,util[_0xafad('0xd')](_0xafad('0x24'),_0x155c1a,_0xafad('0x23')));}fs[_0xafad('0x25')](_0x2a4f10,csv(_0x513fee));}})[_0xafad('0x11')](function(){if(_0x1c7a6c){return new Promise(function(_0x1584dd){zipdir(path[_0xafad('0x20')](_0x445b13,_0x155c1a),{'saveTo':path[_0xafad('0x20')](_0x445b13,util[_0xafad('0xd')](_0xafad('0x24'),_0x155c1a,'zip'))},function(_0xb2fed8,_0x55c520){rimraf(path[_0xafad('0x20')](_0x445b13,_0x155c1a),function(){});_0x1584dd('zip\x20finished');});});}})[_0xafad('0x11')](function(){logger[_0xafad('0x26')](util[_0xafad('0xd')](_0xafad('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xafad('0x28'),_0x1c7a6c?util[_0xafad('0xd')](_0xafad('0x24'),_0x155c1a,_0x1c7a6c?_0xafad('0x29'):'csv'):null);});})[_0xafad('0x2a')](function(_0x433aba){logger[_0xafad('0x26')](util[_0xafad('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0xafad('0x2b')](_0x433aba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xafad('0x2c'));})['finally'](function(){process[_0xafad('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 52928dd..0b7fd82 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 _0xe875=['inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','pick','toString','value','fill','length','auto','body','push','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','sequelize','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x97b519,_0x3f9837){var _0x44ddef=function(_0x38c326){while(--_0x38c326){_0x97b519['push'](_0x97b519['shift']());}};_0x44ddef(++_0x3f9837);}(_0xe875,0x131));var _0x5e87=function(_0x3b1000,_0x1d3208){_0x3b1000=_0x3b1000-0x0;var _0x357d05=_0xe875[_0x3b1000];return _0x357d05;};'use strict';var _=require(_0x5e87('0x0'));var fs=require('fs');var util=require(_0x5e87('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5e87('0x2'));var zipdir=require(_0x5e87('0x3'));var rimraf=require(_0x5e87('0x4'));var JSDOM=require(_0x5e87('0x5'))[_0x5e87('0x6')];var window=new JSDOM('')[_0x5e87('0x7')];var BPromise=require(_0x5e87('0x8'));var db=require(_0x5e87('0x9'))['db'];var dbH=require(_0x5e87('0x9'))[_0x5e87('0xa')];var logger=require(_0x5e87('0xb'))(_0x5e87('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x5e87('0xd')][0x2]);var QUERY=process[_0x5e87('0xd')][0x3];var PATH=process[_0x5e87('0xd')][0x4];var NAME=process[_0x5e87('0xd')][0x5];var FORMAT=_0x5e87('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x400f0c,_0x2cfaac){var _0x219621={'status':_0x400f0c};var _0x49abe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cfaac){_0x219621[_0x5e87('0xf')]=_0x2cfaac;}return db[_0x5e87('0x10')]['update'](_0x219621,_0x49abe8);}function getHeaders(_0x37dd45){return _[_0x5e87('0x11')](_0x37dd45,function(_0x32f8aa){return{'text':_0x32f8aa,'style':'tableHeader'};});}function getRows(_0x3abdb1,_0x5191c1){return _[_0x5e87('0x11')](_0x5191c1,function(_0x16e67a){return _(_0x16e67a)[_0x5e87('0x12')](_0x3abdb1)[_0x5e87('0x11')](function(_0x522866){return _0x522866?_[_0x5e87('0x13')](_0x522866):'';})[_0x5e87('0x14')]();});}function createTable(_0x52ba7b,_0xba728b){var _0x714d74={'widths':_[_0x5e87('0x15')](Array(_0x52ba7b[_0x5e87('0x16')]),0x91),'heights':function(_0x5347c4){return _0x5347c4===0x0?_0x5e87('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x324d7a=getHeaders(_0x52ba7b);_0x714d74[_0x5e87('0x18')][_0x5e87('0x19')](_0x324d7a);var _0x13af0b=getRows(_0x52ba7b,_0xba728b);_0x714d74[_0x5e87('0x18')]=_0x714d74[_0x5e87('0x18')][_0x5e87('0x1a')](_0x13af0b);return _0x714d74;}function createTables(_0x2ef740){var _0x205d67=[];var _0x3a3ba0=_['chunk'](Object['keys'](_0x2ef740[0x0]),0x5);_0x3a3ba0[_0x5e87('0x1b')](function(_0x4b9e8a){_0x205d67[_0x5e87('0x19')](createTable(_0x4b9e8a,_0x2ef740));});return _0x205d67;}function getPDFDocDefinition(_0x29fe7c){var _0x45fbdf=util[_0x5e87('0x1c')](_0x5e87('0x1d'),NAME,EXTRACTED_REPORT[_0x5e87('0x1e')],moment(EXTRACTED_REPORT[_0x5e87('0x1f')])[_0x5e87('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x5e87('0x1c')](FORMAT));var _0x108a28=[];for(var _0x13b3f3=0x0;_0x13b3f3<_0x29fe7c[_0x5e87('0x16')];_0x13b3f3++){var _0x5336e7=[];if(_0x13b3f3===0x0){_0x5336e7[_0x5e87('0x19')]({'text':_0x45fbdf,'style':_0x5e87('0x20')});}var _0x18f3c8={'table':_0x29fe7c[_0x13b3f3]};if(_0x13b3f3>0x0){_0x18f3c8[_0x5e87('0x21')]=_0x5e87('0x22');_0x18f3c8[_0x5e87('0x23')]=[0x0,0x46,0x0,0x0];}_0x5336e7['push'](_0x18f3c8);_0x108a28['push'](_0x5336e7);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x108a28,'footer':function(_0x5495cd,_0x5ae0bb){return{'text':_0x5495cd['toString']()+_0x5e87('0x24')+_0x5ae0bb,'style':_0x5e87('0x25')};},'defaultStyle':{'font':_0x5e87('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5e87('0x27')},'footer':{'alignment':_0x5e87('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1bf213){var _0x4889a8=0x1388;var _0xf3ba04;if(!_0x1bf213[0x0][_0x5e87('0x29')]){return analyticExtractedReport(_0x5e87('0x2a'));}return db[_0x5e87('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5e87('0x2c'),_0x5e87('0x2d')]})['then'](function(_0x2e521f){if(_0x2e521f){_0xf3ba04=_0x2e521f;_0x4889a8=_0xf3ba04[_0x5e87('0x2d')]||0x3e8;}})[_0x5e87('0x2e')](function(){var _0x3ff7ea=[];var _0xfcc6e1=0x0;if(_0xf3ba04[_0x5e87('0x2c')]){if(_0x1bf213&&_0x1bf213['length']){var _0x2f2d9e=_['range'](_0x1bf213[0x0][_0x5e87('0x29')]/_0x4889a8);var _0x594f01=Number[_0x5e87('0x2f')](_0x1bf213[0x0]['num']/_0x4889a8)?_0x1bf213[0x0][_0x5e87('0x29')]%_0x4889a8:0x0;_0x2f2d9e[_0x5e87('0x1b')](function(_0x7ca167){if(_0x7ca167>0x0){_0xfcc6e1+=_0x4889a8;}_0x3ff7ea[_0x5e87('0x19')](dbH['sequelize'][_0x5e87('0x30')](util[_0x5e87('0x1c')](_0x5e87('0x31'),QUERY,_0x4889a8,_0xfcc6e1),{'type':dbH['sequelize'][_0x5e87('0x32')]['SELECT']}));});if(_0x594f01>0x0){_0xfcc6e1+=_0x4889a8;_0x3ff7ea[_0x5e87('0x19')](dbH['sequelize'][_0x5e87('0x30')](util[_0x5e87('0x1c')](_0x5e87('0x31'),QUERY,_0x594f01,_0xfcc6e1),{'type':dbH[_0x5e87('0x33')][_0x5e87('0x32')][_0x5e87('0x34')]}));}}}else{_0x3ff7ea['push'](dbH['sequelize'][_0x5e87('0x30')](QUERY,{'type':dbH[_0x5e87('0x33')]['QueryTypes']['SELECT']}));}var _0x2607ed=path['dirname'](PATH);var _0x44856e=path[_0x5e87('0x35')](PATH,_0x5e87('0x36'));var _0x2f33e3=_0xf3ba04['split']&&_0x3ff7ea[_0x5e87('0x16')]>0x1;var _0x4c7329=[];if(!fs[_0x5e87('0x37')](path[_0x5e87('0x38')](_0x2607ed,_0x44856e))&&_0x2f33e3){fs[_0x5e87('0x39')](path[_0x5e87('0x38')](_0x2607ed,_0x44856e));}return BPromise[_0x5e87('0x3a')](_0x3ff7ea,function(_0x1c9d10){_0x4c7329['push'](_0x1c9d10);})[_0x5e87('0x2e')](function(){var _0x334d19=[];for(var _0x1272db=0x0;_0x1272db<_0x4c7329[_0x5e87('0x16')];_0x1272db+=0x1){var _0x1ffcb9=_0x4c7329[_0x1272db];var _0x345a11=createTables(_[_0x5e87('0x3b')](_0x1ffcb9));var _0x50cc15;var _0x38a332=getPDFDocDefinition(_0x345a11);var _0x553d46=getPDFPrinter();var _0x215d23=_0x553d46[_0x5e87('0x3c')](_0x38a332);if(_0x2f33e3){_0x50cc15=path['join'](_0x2607ed,_0x44856e,util[_0x5e87('0x1c')](_0x5e87('0x3d'),_0x44856e,_0x1272db,'pdf'));}else{_0x50cc15=path[_0x5e87('0x38')](_0x2607ed,util[_0x5e87('0x1c')]('%s.%s',_0x44856e,_0x5e87('0x3e')));}_0x334d19[_0x5e87('0x19')](writePDFDocument(_0x215d23,_0x50cc15));}return Promise[_0x5e87('0x3f')](_0x334d19);})[_0x5e87('0x2e')](function(){if(_0x2f33e3){return new Promise(function(_0x24d91d){zipdir(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),{'saveTo':path[_0x5e87('0x38')](_0x2607ed,util[_0x5e87('0x1c')](_0x5e87('0x40'),_0x44856e,_0x5e87('0x41')))},function(){rimraf(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),function(){});_0x24d91d(_0x5e87('0x42'));});});}})[_0x5e87('0x2e')](function(){if(!_0x2f33e3)return;rimraf(path[_0x5e87('0x38')](_0x2607ed,_0x44856e),function(){});})[_0x5e87('0x2e')](function(){logger[_0x5e87('0x43')](util[_0x5e87('0x1c')](_0x5e87('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x2f33e3?util['format'](_0x5e87('0x40'),_0x44856e,_0x2f33e3?'zip':_0x5e87('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5e87('0x43')](util[_0x5e87('0x1c')](_0x5e87('0x45'),EXTRACTED_REPORT_ID,_0x5e87('0x46')));return db[_0x5e87('0x10')][_0x5e87('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5e87('0x2e')](function(_0x209756){EXTRACTED_REPORT=_0x209756;return dbH[_0x5e87('0x33')][_0x5e87('0x30')](util['format'](_0x5e87('0x48'),QUERY),{'type':dbH[_0x5e87('0x33')][_0x5e87('0x32')][_0x5e87('0x34')]});})[_0x5e87('0x2e')](extractReport)[_0x5e87('0x49')](function(_0x6f80eb){logger['info'](util[_0x5e87('0x1c')](_0x5e87('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x5e87('0x4b')](_0x6f80eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5e87('0x4c'));})[_0x5e87('0x4d')](function(){process[_0x5e87('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1851d2=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x5e87('0x4f'),'italics':__dirname+_0x5e87('0x50'),'bolditalics':__dirname+_0x5e87('0x51')}});return _0x1851d2;}function getPDFDocDefinitionFromHTML(_0x590664,_0x547109){var _0xfab91=util['format'](_0x5e87('0x52'),_0x547109[_0x5e87('0x53')],_0x547109[_0x5e87('0x54')]);var _0x3f4f01=moment()[_0x5e87('0x1c')]('YYYY-MM-DD')['toString']();var _0x5153c3=htmlToPdfmake(_0x590664,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5153c3],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5e87('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5e87('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x5e87('0x55')}},'header':function(){return[{'text':_0x5e87('0x56'),'style':_0x5e87('0x20')}];},'footer':function(_0x142fbe,_0x49409b){return[{'text':util[_0x5e87('0x1c')](_0x5e87('0x57'),_0xfab91,_0x142fbe,_0x49409b,_0x3f4f01),'style':_0x5e87('0x25')}];}};}function writePDFDocument(_0x221008,_0x4dcaaa){return new Promise(function(_0x234c6d,_0x10c3e3){var _0x225292=_0x221008[_0x5e87('0x58')](fs[_0x5e87('0x59')](_0x4dcaaa));_0x225292['on']('finish',function(){_0x234c6d(_0x5e87('0x5a'));});_0x225292['on'](_0x5e87('0x5b'),function(_0x21d560){_0x10c3e3(_0x21d560);});_0x221008[_0x5e87('0x5c')]();});}exports[_0x5e87('0x5d')]=function(_0x1a0985,_0xd5d837){var _0x1668cd=getPDFPrinter();var _0x5071df=getPDFDocDefinitionFromHTML(_0x1a0985,_0xd5d837);var _0x335be9=_0x1668cd[_0x5e87('0x3c')](_0x5071df);return writePDFDocument(_0x335be9,_0xd5d837[_0x5e87('0x5e')])['catch'](function(_0xfc0852){throw _0xfc0852;});}; \ No newline at end of file +var _0x358a=['\x20/\x20','Arial','black','num','Empty','Setting','find','split','range','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.pdf','existsSync','join','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','then','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','footer','createWriteStream','finish','error','end','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','auto','body','push','concat','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','length','header','pageBreak','before','margin'];(function(_0x38424b,_0xcb8601){var _0x20fe83=function(_0x4bf251){while(--_0x4bf251){_0x38424b['push'](_0x38424b['shift']());}};_0x20fe83(++_0xcb8601);}(_0x358a,0x89));var _0xa358=function(_0x268e21,_0xb30e2e){_0x268e21=_0x268e21-0x0;var _0x576f0f=_0x358a[_0x268e21];return _0x576f0f;};'use strict';var _=require(_0xa358('0x0'));var fs=require('fs');var util=require(_0xa358('0x1'));var path=require(_0xa358('0x2'));var moment=require(_0xa358('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xa358('0x4'));var zipdir=require(_0xa358('0x5'));var rimraf=require(_0xa358('0x6'));var JSDOM=require(_0xa358('0x7'))[_0xa358('0x8')];var window=new JSDOM('')[_0xa358('0x9')];var BPromise=require(_0xa358('0xa'));var db=require(_0xa358('0xb'))['db'];var dbH=require(_0xa358('0xb'))[_0xa358('0xc')];var logger=require(_0xa358('0xd'))(_0xa358('0xe'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa358('0xf')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xa358('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2907b0,_0x2bef3e){var _0x598cb9={'status':_0x2907b0};var _0x2b353b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2bef3e){_0x598cb9[_0xa358('0x11')]=_0x2bef3e;}return db['AnalyticExtractedReport'][_0xa358('0x12')](_0x598cb9,_0x2b353b);}function getHeaders(_0x191619){return _[_0xa358('0x13')](_0x191619,function(_0x45725f){return{'text':_0x45725f,'style':_0xa358('0x14')};});}function getRows(_0x565283,_0x4e6b20){return _[_0xa358('0x13')](_0x4e6b20,function(_0x1a0290){return _(_0x1a0290)[_0xa358('0x15')](_0x565283)[_0xa358('0x13')](function(_0x38b9e2){return _0x38b9e2?_[_0xa358('0x16')](_0x38b9e2):'';})['value']();});}function createTable(_0x1f0c8a,_0x26ed16){var _0x2fcd83={'widths':_['fill'](Array(_0x1f0c8a['length']),0x91),'heights':function(_0x525f9f){return _0x525f9f===0x0?_0xa358('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4dd000=getHeaders(_0x1f0c8a);_0x2fcd83[_0xa358('0x18')][_0xa358('0x19')](_0x4dd000);var _0x4e0e53=getRows(_0x1f0c8a,_0x26ed16);_0x2fcd83[_0xa358('0x18')]=_0x2fcd83[_0xa358('0x18')][_0xa358('0x1a')](_0x4e0e53);return _0x2fcd83;}function createTables(_0xad3c20){var _0x36c811=[];var _0x3c7140=_['chunk'](Object[_0xa358('0x1b')](_0xad3c20[0x0]),0x5);_0x3c7140['forEach'](function(_0x131036){_0x36c811[_0xa358('0x19')](createTable(_0x131036,_0xad3c20));});return _0x36c811;}function getPDFDocDefinition(_0xeb3330){var _0x22057f=util['format'](_0xa358('0x1c'),NAME,EXTRACTED_REPORT[_0xa358('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0xa358('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xa358('0x1f')])['format'](FORMAT));var _0x216dbc=[];for(var _0xf591b3=0x0;_0xf591b3<_0xeb3330[_0xa358('0x20')];_0xf591b3++){var _0x327b03=[];if(_0xf591b3===0x0){_0x327b03[_0xa358('0x19')]({'text':_0x22057f,'style':_0xa358('0x21')});}var _0x32336c={'table':_0xeb3330[_0xf591b3]};if(_0xf591b3>0x0){_0x32336c[_0xa358('0x22')]=_0xa358('0x23');_0x32336c[_0xa358('0x24')]=[0x0,0x46,0x0,0x0];}_0x327b03[_0xa358('0x19')](_0x32336c);_0x216dbc[_0xa358('0x19')](_0x327b03);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x216dbc,'footer':function(_0x32bd53,_0x315132){return{'text':_0x32bd53[_0xa358('0x16')]()+_0xa358('0x25')+_0x315132,'style':'footer'};},'defaultStyle':{'font':_0xa358('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa358('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x9a30df){var _0x26b0b8=0x1388;var _0x5f5a81;if(!_0x9a30df[0x0][_0xa358('0x28')]){return analyticExtractedReport(_0xa358('0x29'));}return db[_0xa358('0x2a')][_0xa358('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa358('0x2c'),'splitSizePdf']})['then'](function(_0x30e7f2){if(_0x30e7f2){_0x5f5a81=_0x30e7f2;_0x26b0b8=_0x5f5a81['splitSizePdf']||0x3e8;}})['then'](function(){var _0x383e8b=[];var _0x46f7da=0x0;if(_0x5f5a81[_0xa358('0x2c')]){if(_0x9a30df&&_0x9a30df[_0xa358('0x20')]){var _0x24c23c=_[_0xa358('0x2d')](_0x9a30df[0x0]['num']/_0x26b0b8);var _0x5e754e=Number['isInteger'](_0x9a30df[0x0]['num']/_0x26b0b8)?_0x9a30df[0x0][_0xa358('0x28')]%_0x26b0b8:0x0;_0x24c23c['forEach'](function(_0xa6983d){if(_0xa6983d>0x0){_0x46f7da+=_0x26b0b8;}_0x383e8b[_0xa358('0x19')](dbH[_0xa358('0x2e')]['query'](util[_0xa358('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x26b0b8,_0x46f7da),{'type':dbH[_0xa358('0x2e')][_0xa358('0x2f')][_0xa358('0x30')]}));});if(_0x5e754e>0x0){_0x46f7da+=_0x26b0b8;_0x383e8b[_0xa358('0x19')](dbH[_0xa358('0x2e')]['query'](util[_0xa358('0x1e')](_0xa358('0x31'),QUERY,_0x5e754e,_0x46f7da),{'type':dbH[_0xa358('0x2e')][_0xa358('0x2f')][_0xa358('0x30')]}));}}}else{_0x383e8b['push'](dbH['sequelize'][_0xa358('0x32')](QUERY,{'type':dbH[_0xa358('0x2e')][_0xa358('0x2f')][_0xa358('0x30')]}));}var _0x414756=path[_0xa358('0x33')](PATH);var _0x2dd48b=path[_0xa358('0x34')](PATH,_0xa358('0x35'));var _0x77a222=_0x5f5a81[_0xa358('0x2c')]&&_0x383e8b['length']>0x1;var _0x18ab1d=[];if(!fs[_0xa358('0x36')](path[_0xa358('0x37')](_0x414756,_0x2dd48b))&&_0x77a222){fs['mkdirSync'](path[_0xa358('0x37')](_0x414756,_0x2dd48b));}return BPromise['each'](_0x383e8b,function(_0x3cc7e5){_0x18ab1d[_0xa358('0x19')](_0x3cc7e5);})['then'](function(){var _0x568fd2=[];for(var _0x3a2086=0x0;_0x3a2086<_0x18ab1d[_0xa358('0x20')];_0x3a2086+=0x1){var _0x1840ef=_0x18ab1d[_0x3a2086];var _0x23f475=createTables(_['flatten'](_0x1840ef));var _0x41d6ed;var _0x35c65a=getPDFDocDefinition(_0x23f475);var _0x407845=getPDFPrinter();var _0x2ecfbd=_0x407845[_0xa358('0x38')](_0x35c65a);if(_0x77a222){_0x41d6ed=path[_0xa358('0x37')](_0x414756,_0x2dd48b,util['format'](_0xa358('0x39'),_0x2dd48b,_0x3a2086,_0xa358('0x3a')));}else{_0x41d6ed=path[_0xa358('0x37')](_0x414756,util[_0xa358('0x1e')](_0xa358('0x3b'),_0x2dd48b,_0xa358('0x3a')));}_0x568fd2[_0xa358('0x19')](writePDFDocument(_0x2ecfbd,_0x41d6ed));}return Promise[_0xa358('0x3c')](_0x568fd2);})[_0xa358('0x3d')](function(){if(_0x77a222){return new Promise(function(_0x2075d0){zipdir(path['join'](_0x414756,_0x2dd48b),{'saveTo':path[_0xa358('0x37')](_0x414756,util[_0xa358('0x1e')](_0xa358('0x3b'),_0x2dd48b,_0xa358('0x3e')))},function(){rimraf(path[_0xa358('0x37')](_0x414756,_0x2dd48b),function(){});_0x2075d0('zip\x20finished');});});}})[_0xa358('0x3d')](function(){if(!_0x77a222)return;rimraf(path['join'](_0x414756,_0x2dd48b),function(){});})[_0xa358('0x3d')](function(){logger[_0xa358('0x3f')](util[_0xa358('0x1e')](_0xa358('0x40'),EXTRACTED_REPORT_ID,_0xa358('0x41')));return analyticExtractedReport(_0xa358('0x42'),_0x77a222?util[_0xa358('0x1e')](_0xa358('0x3b'),_0x2dd48b,_0x77a222?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa358('0x3f')](util[_0xa358('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa358('0x41')));return db[_0xa358('0x43')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x290d42){EXTRACTED_REPORT=_0x290d42;return dbH['sequelize'][_0xa358('0x32')](util[_0xa358('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa358('0x2e')][_0xa358('0x2f')][_0xa358('0x30')]});})[_0xa358('0x3d')](extractReport)[_0xa358('0x44')](function(_0x5865a2){logger['info'](util['format'](_0xa358('0x45'),EXTRACTED_REPORT_ID,_0xa358('0x41')),util[_0xa358('0x46')](_0x5865a2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa358('0x47')](function(){process[_0xa358('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2716ff=new PdfPrinter({'Arial':{'normal':__dirname+_0xa358('0x49'),'bold':__dirname+_0xa358('0x4a'),'italics':__dirname+_0xa358('0x4b'),'bolditalics':__dirname+_0xa358('0x4c')}});return _0x2716ff;}function getPDFDocDefinitionFromHTML(_0x3e6064,_0x2263e8){var _0xc72dae=util[_0xa358('0x1e')](_0xa358('0x4d'),_0x2263e8[_0xa358('0x4e')],_0x2263e8[_0xa358('0x4f')]);var _0x1e2e80=moment()[_0xa358('0x1e')]('YYYY-MM-DD')[_0xa358('0x16')]();var _0x5409cf=htmlToPdfmake(_0x3e6064,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5409cf],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa358('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xa358('0x51'),'style':_0xa358('0x21')}];},'footer':function(_0x2d4eab,_0x51fe4c){return[{'text':util[_0xa358('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xc72dae,_0x2d4eab,_0x51fe4c,_0x1e2e80),'style':_0xa358('0x52')}];}};}function writePDFDocument(_0x2c4927,_0xc87f19){return new Promise(function(_0x26bdfd,_0xb0183d){var _0x1de26b=_0x2c4927['pipe'](fs[_0xa358('0x53')](_0xc87f19));_0x1de26b['on'](_0xa358('0x54'),function(){_0x26bdfd(_0xa358('0x54'));});_0x1de26b['on'](_0xa358('0x55'),function(_0x26f181){_0xb0183d(_0x26f181);});_0x2c4927[_0xa358('0x56')]();});}exports['createPdfFromHTML']=function(_0x28b510,_0x39fcd5){var _0x17aa79=getPDFPrinter();var _0xe29e63=getPDFDocDefinitionFromHTML(_0x28b510,_0x39fcd5);var _0x414481=_0x17aa79[_0xa358('0x38')](_0xe29e63);return writePDFDocument(_0x414481,_0x39fcd5['path'])[_0xa358('0x44')](function(_0x233455){throw _0x233455;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 4a71572..354ebef 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 _0x8091=['writeFileSync','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','Empty','length','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s'];(function(_0x77b9dc,_0x133d61){var _0x50de60=function(_0x3f0729){while(--_0x3f0729){_0x77b9dc['push'](_0x77b9dc['shift']());}};_0x50de60(++_0x133d61);}(_0x8091,0x124));var _0x1809=function(_0x20f36b,_0x4f0953){_0x20f36b=_0x20f36b-0x0;var _0xadf26e=_0x8091[_0x20f36b];return _0xadf26e;};'use strict';var util=require(_0x1809('0x0'));var path=require(_0x1809('0x1'));var _=require(_0x1809('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0x1809('0x3'));var rimraf=require(_0x1809('0x4'));var db=require(_0x1809('0x5'))['db'];var dbH=require(_0x1809('0x5'))[_0x1809('0x6')];var logger=require(_0x1809('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1809('0x8')][0x2]);var QUERY=process[_0x1809('0x8')][0x3];var PATH=process[_0x1809('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd90ca4,_0x34b31c){var _0x14c71c={'status':_0xd90ca4};var _0x1c22d9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x34b31c){_0x14c71c[_0x1809('0x9')]=_0x34b31c;}return db['AnalyticExtractedReport'][_0x1809('0xa')](_0x14c71c,_0x1c22d9);}function main(){var _0xb62294=0x1388;var _0x18b68c;logger['info'](util[_0x1809('0xb')](_0x1809('0xc'),EXTRACTED_REPORT_ID,_0x1809('0xd')));return db[_0x1809('0xe')][_0x1809('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1809('0x10'),_0x1809('0x11')]})[_0x1809('0x12')](function(_0x33dc31){if(_0x33dc31){_0x18b68c=_0x33dc31;_0xb62294=_0x18b68c['splitSizeXlsx']||0x1388;}})[_0x1809('0x12')](function(){return dbH[_0x1809('0x13')][_0x1809('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x1809('0x15')]['SELECT']});})[_0x1809('0x12')](function(_0x5a32f3){if(!_0x5a32f3[0x0]['num']){return analyticExtractedReport(_0x1809('0x16'));}var _0x19aae6=[];var _0x2cd365=0x0;if(_0x18b68c[_0x1809('0x10')]){if(_0x5a32f3&&_0x5a32f3[_0x1809('0x17')]){var _0x359556=_['range'](_0x5a32f3[0x0]['num']/_0xb62294);var _0x8a8a41=Number['isInteger'](_0x5a32f3[0x0]['num']/_0xb62294)?_0x5a32f3[0x0][_0x1809('0x18')]%_0xb62294:0x0;_0x359556[_0x1809('0x19')](function(_0x54444c){if(_0x54444c>0x0){_0x2cd365+=_0xb62294;}_0x19aae6[_0x1809('0x1a')](dbH['sequelize']['query'](util[_0x1809('0xb')](_0x1809('0x1b'),QUERY,_0xb62294,_0x2cd365),{'type':dbH[_0x1809('0x13')]['QueryTypes']['SELECT']}));});if(_0x8a8a41>0x0){_0x2cd365+=_0xb62294;_0x19aae6[_0x1809('0x1a')](dbH[_0x1809('0x13')][_0x1809('0x14')](util[_0x1809('0xb')](_0x1809('0x1b'),QUERY,_0x8a8a41,_0x2cd365),{'type':dbH[_0x1809('0x13')][_0x1809('0x15')]['SELECT']}));}}}else{_0x19aae6[_0x1809('0x1a')](dbH[_0x1809('0x13')][_0x1809('0x14')](QUERY,{'type':dbH['sequelize'][_0x1809('0x15')][_0x1809('0x1c')]}));}var _0xbf8965=path[_0x1809('0x1d')](PATH);var _0x81b24d=path[_0x1809('0x1e')](PATH,_0x1809('0x1f'));var _0x1fa0e0=_0x18b68c[_0x1809('0x10')]&&_0x19aae6['length']>0x1;var _0x5c3be0=[];if(!fs[_0x1809('0x20')](path['join'](_0xbf8965,_0x81b24d))&&_0x1fa0e0){fs['mkdirSync'](path[_0x1809('0x21')](_0xbf8965,_0x81b24d));}return BPromise[_0x1809('0x22')](_0x19aae6,function(_0x31e0a1){_0x5c3be0[_0x1809('0x1a')](_0x31e0a1);})['then'](function(){for(var _0x5a609e=0x0;_0x5a609e<_0x5c3be0[_0x1809('0x17')];_0x5a609e+=0x1){var _0x36e1a4;var _0x493e32=_0x5c3be0[_0x5a609e];if(_0x1fa0e0){_0x36e1a4=path['join'](_0xbf8965,_0x81b24d,util[_0x1809('0xb')](_0x1809('0x23'),_0x81b24d,_0x5a609e,'xlsx'));}else{_0x36e1a4=path['join'](_0xbf8965,util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,'xlsx'));}fs[_0x1809('0x25')](_0x36e1a4,json2xls(_0x493e32),'binary');}})[_0x1809('0x12')](function(){if(_0x1fa0e0){return new Promise(function(_0x2dc224){zipdir(path[_0x1809('0x21')](_0xbf8965,_0x81b24d),{'saveTo':path[_0x1809('0x21')](_0xbf8965,util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,_0x1809('0x26')))},function(_0xa4c0c9,_0x31f1f9){rimraf(path[_0x1809('0x21')](_0xbf8965,_0x81b24d),function(){});_0x2dc224(_0x1809('0x27'));});});}})[_0x1809('0x12')](function(){logger[_0x1809('0x28')](util[_0x1809('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1809('0xd')));return analyticExtractedReport(_0x1809('0x29'),_0x1fa0e0?util[_0x1809('0xb')](_0x1809('0x24'),_0x81b24d,_0x1fa0e0?'zip':'xlsx'):null);});})[_0x1809('0x2a')](function(_0x4b671d){logger[_0x1809('0x28')](util['format'](_0x1809('0x2b'),EXTRACTED_REPORT_ID,_0x1809('0xd')),util[_0x1809('0x2c')](_0x4b671d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1809('0x2d'));})['finally'](function(){process[_0x1809('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5ba7=['Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','xlsx','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x3b28f7,_0x5eda42){var _0x2ad32e=function(_0x36f0c2){while(--_0x36f0c2){_0x3b28f7['push'](_0x3b28f7['shift']());}};_0x2ad32e(++_0x5eda42);}(_0x5ba7,0x1b5));var _0x75ba=function(_0x1e569f,_0x5d5660){_0x1e569f=_0x1e569f-0x0;var _0x20570c=_0x5ba7[_0x1e569f];return _0x20570c;};'use strict';var util=require(_0x75ba('0x0'));var path=require(_0x75ba('0x1'));var _=require(_0x75ba('0x2'));var fs=require('fs');var json2xls=require(_0x75ba('0x3'));var BPromise=require(_0x75ba('0x4'));var zipdir=require(_0x75ba('0x5'));var rimraf=require(_0x75ba('0x6'));var db=require(_0x75ba('0x7'))['db'];var dbH=require(_0x75ba('0x7'))[_0x75ba('0x8')];var logger=require(_0x75ba('0x9'))(_0x75ba('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x75ba('0xb')][0x2]);var QUERY=process[_0x75ba('0xb')][0x3];var PATH=process[_0x75ba('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x54e1cc,_0x3555c6){var _0x104063={'status':_0x54e1cc};var _0x3f72c6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3555c6){_0x104063[_0x75ba('0xc')]=_0x3555c6;}return db[_0x75ba('0xd')]['update'](_0x104063,_0x3f72c6);}function main(){var _0x46965c=0x1388;var _0xbaf087;logger[_0x75ba('0xe')](util[_0x75ba('0xf')](_0x75ba('0x10'),EXTRACTED_REPORT_ID,_0x75ba('0x11')));return db[_0x75ba('0x12')][_0x75ba('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x75ba('0x14'),_0x75ba('0x15')]})['then'](function(_0x2cf222){if(_0x2cf222){_0xbaf087=_0x2cf222;_0x46965c=_0xbaf087[_0x75ba('0x15')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x75ba('0x16')](util[_0x75ba('0xf')](_0x75ba('0x17'),QUERY),{'type':dbH['sequelize'][_0x75ba('0x18')][_0x75ba('0x19')]});})[_0x75ba('0x1a')](function(_0x5928bf){if(!_0x5928bf[0x0][_0x75ba('0x1b')]){return analyticExtractedReport(_0x75ba('0x1c'));}var _0x530447=[];var _0x19a30c=0x0;if(_0xbaf087[_0x75ba('0x14')]){if(_0x5928bf&&_0x5928bf[_0x75ba('0x1d')]){var _0x3a9571=_[_0x75ba('0x1e')](_0x5928bf[0x0][_0x75ba('0x1b')]/_0x46965c);var _0x3e39a6=Number[_0x75ba('0x1f')](_0x5928bf[0x0][_0x75ba('0x1b')]/_0x46965c)?_0x5928bf[0x0][_0x75ba('0x1b')]%_0x46965c:0x0;_0x3a9571[_0x75ba('0x20')](function(_0x5e58e4){if(_0x5e58e4>0x0){_0x19a30c+=_0x46965c;}_0x530447[_0x75ba('0x21')](dbH['sequelize']['query'](util['format'](_0x75ba('0x22'),QUERY,_0x46965c,_0x19a30c),{'type':dbH[_0x75ba('0x23')][_0x75ba('0x18')][_0x75ba('0x19')]}));});if(_0x3e39a6>0x0){_0x19a30c+=_0x46965c;_0x530447[_0x75ba('0x21')](dbH[_0x75ba('0x23')]['query'](util[_0x75ba('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3e39a6,_0x19a30c),{'type':dbH[_0x75ba('0x23')][_0x75ba('0x18')][_0x75ba('0x19')]}));}}}else{_0x530447['push'](dbH[_0x75ba('0x23')][_0x75ba('0x16')](QUERY,{'type':dbH[_0x75ba('0x23')][_0x75ba('0x18')][_0x75ba('0x19')]}));}var _0x1c94b9=path[_0x75ba('0x24')](PATH);var _0x615d70=path[_0x75ba('0x25')](PATH,_0x75ba('0x26'));var _0x243c76=_0xbaf087[_0x75ba('0x14')]&&_0x530447[_0x75ba('0x1d')]>0x1;var _0x5a0704=[];if(!fs[_0x75ba('0x27')](path[_0x75ba('0x28')](_0x1c94b9,_0x615d70))&&_0x243c76){fs[_0x75ba('0x29')](path['join'](_0x1c94b9,_0x615d70));}return BPromise[_0x75ba('0x2a')](_0x530447,function(_0x3a254d){_0x5a0704[_0x75ba('0x21')](_0x3a254d);})[_0x75ba('0x1a')](function(){for(var _0x59f939=0x0;_0x59f939<_0x5a0704[_0x75ba('0x1d')];_0x59f939+=0x1){var _0x202319;var _0x33c1e7=_0x5a0704[_0x59f939];if(_0x243c76){_0x202319=path[_0x75ba('0x28')](_0x1c94b9,_0x615d70,util[_0x75ba('0xf')]('%s%d.%s',_0x615d70,_0x59f939,'xlsx'));}else{_0x202319=path[_0x75ba('0x28')](_0x1c94b9,util[_0x75ba('0xf')]('%s.%s',_0x615d70,_0x75ba('0x2b')));}fs['writeFileSync'](_0x202319,json2xls(_0x33c1e7),_0x75ba('0x2c'));}})['then'](function(){if(_0x243c76){return new Promise(function(_0x2e98df){zipdir(path['join'](_0x1c94b9,_0x615d70),{'saveTo':path[_0x75ba('0x28')](_0x1c94b9,util['format'](_0x75ba('0x2d'),_0x615d70,_0x75ba('0x2e')))},function(_0x5a0f87,_0x453312){rimraf(path['join'](_0x1c94b9,_0x615d70),function(){});_0x2e98df(_0x75ba('0x2f'));});});}})[_0x75ba('0x1a')](function(){logger[_0x75ba('0xe')](util['format'](_0x75ba('0x30'),EXTRACTED_REPORT_ID,_0x75ba('0x11')));return analyticExtractedReport(_0x75ba('0x31'),_0x243c76?util[_0x75ba('0xf')](_0x75ba('0x2d'),_0x615d70,_0x243c76?_0x75ba('0x2e'):'xlsx'):null);});})['catch'](function(_0x9c4524){logger[_0x75ba('0xe')](util[_0x75ba('0xf')](_0x75ba('0x32'),EXTRACTED_REPORT_ID,_0x75ba('0x11')),util[_0x75ba('0x33')](_0x9c4524,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x75ba('0x34')](function(){process[_0x75ba('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7a84eeb..ce554d9 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 _0xf05c=['MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','CDR(tag)=','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','type','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0'];(function(_0x2daf65,_0x200143){var _0x3f0a34=function(_0x19fa27){while(--_0x19fa27){_0x2daf65['push'](_0x2daf65['shift']());}};_0x3f0a34(++_0x200143);}(_0xf05c,0x176));var _0xcf05=function(_0x24fa05,_0x2b7735){_0x24fa05=_0x24fa05-0x0;var _0x250d9a=_0xf05c[_0x24fa05];return _0x250d9a;};'use strict';var _=require(_0xcf05('0x0'));var util=require(_0xcf05('0x1'));function rewrite(_0x5b6fb2,_0x4438ea){var _0x574d23=this;return _0x5b6fb2[_0xcf05('0x2')]['Interval'][_0xcf05('0x3')]({'raw':!![]})['then'](function(_0x2f9eb1){_0x574d23[_0xcf05('0x4')]=_0x2f9eb1;return _0x5b6fb2[_0xcf05('0x2')][_0xcf05('0x5')]['findAll']({'where':{'IntervalId':_0x4438ea[_0xcf05('0x6')]},'raw':!![]});})['then'](function(_0x107ea3){return _0x5b6fb2['models'][_0xcf05('0x5')][_0xcf05('0x3')]({'where':{'exten':{'$in':_[_0xcf05('0x7')](_['map'](_0x107ea3,_0xcf05('0x8')))}},'order':[{'raw':_0xcf05('0x9')}],'raw':!![]});})[_0xcf05('0xa')](function(_0x113d25){var _0x4461a9=_[_0xcf05('0xb')](_0x113d25,{'priority':'1'});var _0x2cb51b=_[_0xcf05('0xb')](_0x113d25,{'isApp':0x1});var _0x358b29=_[_0xcf05('0xc')](_0x2cb51b,_0xcf05('0x8'));var _0x453e0c=[_0xcf05('0xd'),_0xcf05('0xe')];var _0x43b231=[];var _0x1a2636=[];for(var _0x3bf042 in _0x358b29){if(_0x358b29[_0xcf05('0xf')](_0x3bf042)){_0x574d23[_0xcf05('0x10')]=0x2;_0x574d23[_0xcf05('0x11')]=[];_0x574d23[_0xcf05('0x12')]=_[_0xcf05('0x13')](_0x4461a9,{'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')]});_0x574d23['extensions'][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':util['format']('CDR(type)=%s',_0x358b29[_0x3bf042][0x0]['type']),'context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});if(_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')]===_0xcf05('0x17')){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x18')+_0x358b29[_0x3bf042][0x0]['VoiceExtensionId'],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});}else if(_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')]===_0xcf05('0x1a')){if(_0x574d23[_0xcf05('0x12')]){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x1b')+(_0x574d23[_0xcf05('0x12')][_0xcf05('0x1c')]?'${EXTEN:'+_0x574d23['extension']['cutdigits']+'}':_0xcf05('0x1d')),'context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x18')+_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});var _0x19f57f=_0x574d23[_0xcf05('0x10')]++;_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x20')+(_0x19f57f+0x2)+_0xcf05('0x21')+(_0x19f57f+0x1)+')','context':_0x358b29[_0x3bf042][0x0]['context'],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x19f57f,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});if(_0x574d23['extension']){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0x574d23['extension'][_0xcf05('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x574d23['extension'][_0xcf05('0x1c')]+'}':_0xcf05('0x22'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x23')+_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')],'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0]['exten'],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});if(_0x574d23['extension']&&_0x574d23['extension'][_0xcf05('0xf')](_0xcf05('0x24'))&&_0x574d23[_0xcf05('0x12')][_0xcf05('0x24')]!==_0xcf05('0x25')){_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0]['type'],'app':_0xcf05('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x574d23['extension'][_0xcf05('0x24')]||'wav','context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}}_0x574d23[_0xcf05('0x11')][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x26'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});_0x574d23[_0xcf05('0x11')]['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x27'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23['priority']++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});_0x574d23['extensions'][_0xcf05('0x14')]({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x15'),'appdata':_0xcf05('0x28'),'context':_0x358b29[_0x3bf042][0x0][_0xcf05('0x19')],'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'priority':_0x574d23[_0xcf05('0x10')]++,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});for(var _0x189c4c=0x0,_0x5b4f90=0x0;_0x189c4c<_0x358b29[_0x3bf042]['length'];_0x189c4c+=0x1,_0x5b4f90=0x0){var _0x1d86bd=_0x358b29[_0x3bf042][_0x189c4c];if(_0x1d86bd['type']){_0x1d86bd['type']=_0x1d86bd[_0xcf05('0x16')][_0xcf05('0x29')]();}var _0x501a79=[];var _0x3b76bc=[];delete _0x1d86bd['id'];delete _0x1d86bd[_0xcf05('0x2a')];delete _0x1d86bd[_0xcf05('0x2b')];var _0x2e7ceb=_0x1d86bd[_0xcf05('0x2c')]!==_0xcf05('0x2d')?[_0x1d86bd['interval']]:_0x1d86bd['IntervalId']?_[_0xcf05('0x2e')](_[_0xcf05('0xb')](_0x574d23[_0xcf05('0x4')],{'IntervalId':_0x1d86bd[_0xcf05('0x6')]}),_0xcf05('0x2c')):[];if(_0x1d86bd[_0xcf05('0xf')]('tag')){if(_0x1d86bd['tag']&&_0x1d86bd['tag']!=='--'){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':'Set','appdata':_0xcf05('0x2f')+_0x1d86bd[_0xcf05('0x30')],'context':_0x1d86bd['context'],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23['priority']+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}if(_0x1d86bd['type']===_0xcf05('0x1a')&&_0x1d86bd['hasOwnProperty'](_0xcf05('0x32'))){if(_0x1d86bd[_0xcf05('0x32')]){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x33')+_0x1d86bd[_0xcf05('0x32')]+')','context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd['exten'],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}else{_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x34'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}if(_0x1d86bd[_0xcf05('0xf')]('answer')){if(_0x453e0c[_0xcf05('0x35')](_0x1d86bd[_0xcf05('0x36')][_0xcf05('0x29')]())>=0x0&&_0x1d86bd[_0xcf05('0x37')]!=='custom'){if(_0x1d86bd[_0xcf05('0x38')]){_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd['type'],'app':'ExecIf','appdata':_0xcf05('0x39'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd['type'],'app':'Set','appdata':_0xcf05('0x3a'),'context':_0x1d86bd[_0xcf05('0x19')],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});}else{_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':_0xcf05('0x1f'),'appdata':_0xcf05('0x3b'),'context':_0x1d86bd['context'],'exten':_0x1d86bd['exten'],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23['priority']+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd['VoiceExtensionId']});_0x501a79[_0xcf05('0x14')]({'type':_0x1d86bd[_0xcf05('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1d86bd['context'],'exten':_0x1d86bd[_0xcf05('0x8')],'priority':_0x2e7ceb[_0xcf05('0x31')]+_0x574d23[_0xcf05('0x10')]+_0x5b4f90++,'VoiceExtensionId':_0x1d86bd[_0xcf05('0x1e')]});}}}for(var _0x29e030=0x0;_0x29e030<_0x2e7ceb['length'];_0x29e030+=0x1){var _0x2c53a6=_0x574d23['priority']+_0x2e7ceb[_0xcf05('0x31')];var _0x33bb1a=_0x29e030===_0x2e7ceb['length']-0x1?_0x574d23[_0xcf05('0x10')]+_0x501a79[_0xcf05('0x31')]+_0x3b76bc['length']+0x2:_0x574d23[_0xcf05('0x10')]+_0x29e030+0x1;_0x501a79['splice'](_0x29e030,0x0,{'type':_0x1d86bd[_0xcf05('0x16')],'app':'GotoIfTime','appdata':_0x2e7ceb[_0x29e030]+'?'+_0x1d86bd[_0xcf05('0x19')]+_0xcf05('0x3c')+_0x2c53a6+':'+_0x1d86bd[_0xcf05('0x19')]+_0xcf05('0x3c')+_0x33bb1a,'exten':_0x1d86bd[_0xcf05('0x8')],'context':_0x1d86bd[_0xcf05('0x19')],'priority':_0x574d23[_0xcf05('0x10')]+_0x29e030,'VoiceExtensionId':_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]});}_0x1d86bd[_0xcf05('0x10')]=_0x501a79[_0xcf05('0x31')]?_[_0xcf05('0x3d')](_0x501a79)['priority']+0x1:_0x574d23[_0xcf05('0x10')];_0x574d23['priority']=(_0x3b76bc[_0xcf05('0x31')]?_[_0xcf05('0x3d')](_0x3b76bc)[_0xcf05('0x10')]:_0x1d86bd[_0xcf05('0x10')])+0x1;_0x574d23[_0xcf05('0x11')]=_[_0xcf05('0x3e')](_0x574d23[_0xcf05('0x11')],_0x501a79,[_0x1d86bd],_0x3b76bc);}_0x574d23['extensions']['push']({'type':_0x358b29[_0x3bf042][0x0][_0xcf05('0x16')],'app':_0xcf05('0x3f'),'exten':_0x358b29[_0x3bf042][0x0][_0xcf05('0x8')],'context':_0x358b29[_0x3bf042][0x0]['context'],'priority':_0x574d23[_0xcf05('0x10')],'VoiceExtensionId':_0x358b29[_0x3bf042][0x0]['VoiceExtensionId']});_0x43b231[_0xcf05('0x14')](_0x358b29[_0x3bf042][0x0][_0xcf05('0x1e')]);_0x1a2636=_['concat'](_0x1a2636,_0x574d23['extensions']);}}return _0x5b6fb2[_0xcf05('0x40')](function(_0x5a482d){return _0x5b6fb2[_0xcf05('0x2')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x43b231}},'transaction':_0x5a482d})[_0xcf05('0xa')](function(_0x5de3fb){return _0x5b6fb2[_0xcf05('0x2')]['VoiceExtension'][_0xcf05('0x41')](_[_0xcf05('0x42')](_0x1a2636,_0xcf05('0x10')),{'transaction':_0x5a482d});});});})[_0xcf05('0x43')](function(_0x32be4f){console['error'](_0x32be4f);});}exports[_0xcf05('0x44')]=rewrite; \ No newline at end of file +var _0x86e5=['IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','sortBy','catch','error','rewrite','models','Interval','then','intervals','VoiceExtension','findAll','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','format','CDR(type)=%s','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*'];(function(_0x2e16d3,_0x566b4b){var _0x5c2680=function(_0x1a9c0e){while(--_0x1a9c0e){_0x2e16d3['push'](_0x2e16d3['shift']());}};_0x5c2680(++_0x566b4b);}(_0x86e5,0x1c8));var _0x586e=function(_0x5daeee,_0x5172ad){_0x5daeee=_0x5daeee-0x0;var _0x4fb236=_0x86e5[_0x5daeee];return _0x4fb236;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x39bc9d,_0x3e8b7a){var _0xde1bc6=this;return _0x39bc9d[_0x586e('0x0')][_0x586e('0x1')]['findAll']({'raw':!![]})[_0x586e('0x2')](function(_0x5acce0){_0xde1bc6[_0x586e('0x3')]=_0x5acce0;return _0x39bc9d[_0x586e('0x0')][_0x586e('0x4')]['findAll']({'where':{'IntervalId':_0x3e8b7a['IntervalId']},'raw':!![]});})[_0x586e('0x2')](function(_0x1b9e86){return _0x39bc9d[_0x586e('0x0')]['VoiceExtension'][_0x586e('0x5')]({'where':{'exten':{'$in':_[_0x586e('0x6')](_['map'](_0x1b9e86,_0x586e('0x7')))}},'order':[{'raw':_0x586e('0x8')}],'raw':!![]});})[_0x586e('0x2')](function(_0x29ba1b){var _0x544c13=_[_0x586e('0x9')](_0x29ba1b,{'priority':'1'});var _0x2208a8=_[_0x586e('0x9')](_0x29ba1b,{'isApp':0x1});var _0x494de5=_[_0x586e('0xa')](_0x2208a8,'exten');var _0x4f3cc3=[_0x586e('0xb'),_0x586e('0xc')];var _0x4ea0fd=[];var _0x2473bc=[];for(var _0x4dbed4 in _0x494de5){if(_0x494de5[_0x586e('0xd')](_0x4dbed4)){_0xde1bc6[_0x586e('0xe')]=0x2;_0xde1bc6[_0x586e('0xf')]=[];_0xde1bc6[_0x586e('0x10')]=_['find'](_0x544c13,{'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')]});_0xde1bc6['extensions'][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':'Set','appdata':util[_0x586e('0x13')](_0x586e('0x14'),_0x494de5[_0x4dbed4][0x0]['type']),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});if(_0x494de5[_0x4dbed4][0x0]['type']===_0x586e('0x17')){_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x19')+_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')],'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0]['VoiceExtensionId']});}else if(_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')]==='outbound'){if(_0xde1bc6[_0x586e('0x10')]){_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x1a')+(_0xde1bc6[_0x586e('0x10')][_0x586e('0x1b')]?_0x586e('0x1c')+_0xde1bc6[_0x586e('0x10')]['cutdigits']+'}':_0x586e('0x1d')),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6['priority']++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0]['VoiceExtensionId']});}_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x19')+_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')],'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});var _0x3c6c82=_0xde1bc6['priority']++;_0xde1bc6[_0x586e('0xf')]['push']({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x1e'),'appdata':_0x586e('0x1f')+(_0x3c6c82+0x2)+_0x586e('0x20')+(_0x3c6c82+0x1)+')','context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0x3c6c82,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});if(_0xde1bc6[_0x586e('0x10')]){_0xde1bc6['extensions']['push']({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0xde1bc6['extension'][_0x586e('0x1b')]?_0x586e('0x21')+_0xde1bc6[_0x586e('0x10')][_0x586e('0x1b')]+'}':_0x586e('0x22'),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});}_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':'outboundrouteid='+_0x494de5[_0x4dbed4][0x0]['VoiceExtensionId'],'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0]['exten'],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});if(_0xde1bc6[_0x586e('0x10')]&&_0xde1bc6[_0x586e('0x10')][_0x586e('0xd')]('recordingFormat')&&_0xde1bc6[_0x586e('0x10')][_0x586e('0x23')]!=='none'){_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0]['type'],'app':'Set','appdata':_0x586e('0x24'),'context':_0x494de5[_0x4dbed4][0x0]['context'],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0]['type'],'app':_0x586e('0x18'),'appdata':_0x586e('0x25')+_0xde1bc6['extension'][_0x586e('0x23')]||_0x586e('0x26'),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});}}_0xde1bc6[_0x586e('0xf')][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x27'),'context':_0x494de5[_0x4dbed4][0x0]['context'],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});_0xde1bc6[_0x586e('0xf')]['push']({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x28'),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'priority':_0xde1bc6['priority']++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});_0xde1bc6['extensions'][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x29'),'context':_0x494de5[_0x4dbed4][0x0][_0x586e('0x15')],'exten':_0x494de5[_0x4dbed4][0x0]['exten'],'priority':_0xde1bc6[_0x586e('0xe')]++,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});for(var _0x1333ad=0x0,_0x4633c5=0x0;_0x1333ad<_0x494de5[_0x4dbed4][_0x586e('0x2a')];_0x1333ad+=0x1,_0x4633c5=0x0){var _0x50c2fa=_0x494de5[_0x4dbed4][_0x1333ad];if(_0x50c2fa['type']){_0x50c2fa[_0x586e('0x12')]=_0x50c2fa[_0x586e('0x12')][_0x586e('0x2b')]();}var _0x5996ec=[];var _0xb522fe=[];delete _0x50c2fa['id'];delete _0x50c2fa[_0x586e('0x2c')];delete _0x50c2fa[_0x586e('0x2d')];var _0x4b33b1=_0x50c2fa[_0x586e('0x2e')]!==_0x586e('0x2f')?[_0x50c2fa[_0x586e('0x2e')]]:_0x50c2fa['IntervalId']?_['map'](_[_0x586e('0x9')](_0xde1bc6[_0x586e('0x3')],{'IntervalId':_0x50c2fa[_0x586e('0x30')]}),'interval'):[];if(_0x50c2fa['hasOwnProperty'](_0x586e('0x31'))){if(_0x50c2fa[_0x586e('0x31')]&&_0x50c2fa[_0x586e('0x31')]!=='--'){_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':_0x586e('0x18'),'appdata':_0x586e('0x32')+_0x50c2fa[_0x586e('0x31')],'context':_0x50c2fa[_0x586e('0x15')],'exten':_0x50c2fa[_0x586e('0x7')],'priority':_0x4b33b1['length']+_0xde1bc6[_0x586e('0xe')]+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});}}if(_0x50c2fa['type']===_0x586e('0x33')&&_0x50c2fa[_0x586e('0xd')](_0x586e('0x34'))){if(_0x50c2fa[_0x586e('0x34')]){_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa['type'],'app':_0x586e('0x1e'),'appdata':_0x586e('0x35')+_0x50c2fa[_0x586e('0x34')]+')','context':_0x50c2fa[_0x586e('0x15')],'exten':_0x50c2fa['exten'],'priority':_0x4b33b1[_0x586e('0x2a')]+_0xde1bc6[_0x586e('0xe')]+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});}else{_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':'ExecIf','appdata':_0x586e('0x36'),'context':_0x50c2fa[_0x586e('0x15')],'exten':_0x50c2fa['exten'],'priority':_0x4b33b1[_0x586e('0x2a')]+_0xde1bc6['priority']+_0x4633c5++,'VoiceExtensionId':_0x50c2fa['VoiceExtensionId']});}}if(_0x50c2fa[_0x586e('0xd')](_0x586e('0x37'))){if(_0x4f3cc3[_0x586e('0x38')](_0x50c2fa[_0x586e('0x39')][_0x586e('0x2b')]())>=0x0&&_0x50c2fa[_0x586e('0x3a')]!==_0x586e('0x3b')){if(_0x50c2fa[_0x586e('0x37')]){_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':_0x586e('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x50c2fa['context'],'exten':_0x50c2fa['exten'],'priority':_0x4b33b1['length']+_0xde1bc6['priority']+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':'Set','appdata':_0x586e('0x3c'),'context':_0x50c2fa[_0x586e('0x15')],'exten':_0x50c2fa[_0x586e('0x7')],'priority':_0x4b33b1[_0x586e('0x2a')]+_0xde1bc6[_0x586e('0xe')]+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});}else{_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':_0x586e('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x50c2fa[_0x586e('0x15')],'exten':_0x50c2fa[_0x586e('0x7')],'priority':_0x4b33b1['length']+_0xde1bc6[_0x586e('0xe')]+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});_0x5996ec[_0x586e('0x11')]({'type':_0x50c2fa[_0x586e('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x50c2fa['context'],'exten':_0x50c2fa[_0x586e('0x7')],'priority':_0x4b33b1[_0x586e('0x2a')]+_0xde1bc6[_0x586e('0xe')]+_0x4633c5++,'VoiceExtensionId':_0x50c2fa[_0x586e('0x16')]});}}}for(var _0x450a92=0x0;_0x450a92<_0x4b33b1[_0x586e('0x2a')];_0x450a92+=0x1){var _0x240452=_0xde1bc6[_0x586e('0xe')]+_0x4b33b1['length'];var _0x2ea1cb=_0x450a92===_0x4b33b1[_0x586e('0x2a')]-0x1?_0xde1bc6[_0x586e('0xe')]+_0x5996ec[_0x586e('0x2a')]+_0xb522fe[_0x586e('0x2a')]+0x2:_0xde1bc6[_0x586e('0xe')]+_0x450a92+0x1;_0x5996ec[_0x586e('0x3d')](_0x450a92,0x0,{'type':_0x50c2fa[_0x586e('0x12')],'app':_0x586e('0x3e'),'appdata':_0x4b33b1[_0x450a92]+'?'+_0x50c2fa[_0x586e('0x15')]+',${EXTEN},'+_0x240452+':'+_0x50c2fa['context']+_0x586e('0x3f')+_0x2ea1cb,'exten':_0x50c2fa['exten'],'context':_0x50c2fa[_0x586e('0x15')],'priority':_0xde1bc6[_0x586e('0xe')]+_0x450a92,'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});}_0x50c2fa[_0x586e('0xe')]=_0x5996ec[_0x586e('0x2a')]?_['last'](_0x5996ec)[_0x586e('0xe')]+0x1:_0xde1bc6['priority'];_0xde1bc6[_0x586e('0xe')]=(_0xb522fe[_0x586e('0x2a')]?_[_0x586e('0x40')](_0xb522fe)['priority']:_0x50c2fa['priority'])+0x1;_0xde1bc6[_0x586e('0xf')]=_[_0x586e('0x41')](_0xde1bc6[_0x586e('0xf')],_0x5996ec,[_0x50c2fa],_0xb522fe);}_0xde1bc6['extensions'][_0x586e('0x11')]({'type':_0x494de5[_0x4dbed4][0x0][_0x586e('0x12')],'app':_0x586e('0x42'),'exten':_0x494de5[_0x4dbed4][0x0][_0x586e('0x7')],'context':_0x494de5[_0x4dbed4][0x0]['context'],'priority':_0xde1bc6[_0x586e('0xe')],'VoiceExtensionId':_0x494de5[_0x4dbed4][0x0][_0x586e('0x16')]});_0x4ea0fd[_0x586e('0x11')](_0x494de5[_0x4dbed4][0x0]['VoiceExtensionId']);_0x2473bc=_[_0x586e('0x41')](_0x2473bc,_0xde1bc6[_0x586e('0xf')]);}}return _0x39bc9d[_0x586e('0x43')](function(_0x187c16){return _0x39bc9d[_0x586e('0x0')][_0x586e('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4ea0fd}},'transaction':_0x187c16})[_0x586e('0x2')](function(_0x33f70c){return _0x39bc9d[_0x586e('0x0')][_0x586e('0x4')]['bulkCreate'](_[_0x586e('0x44')](_0x2473bc,_0x586e('0xe')),{'transaction':_0x187c16});});});})[_0x586e('0x45')](function(_0x2f550f){console[_0x586e('0x46')](_0x2f550f);});}exports[_0x586e('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 253f582..0d3baad 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 _0x254d=['resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','\x20=\x20?','fromQuery','updatedAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','all','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit'];(function(_0x1d47a4,_0x197d81){var _0x3a16d7=function(_0x256282){while(--_0x256282){_0x1d47a4['push'](_0x1d47a4['shift']());}};_0x3a16d7(++_0x197d81);}(_0x254d,0x82));var _0xd254=function(_0x4e90e3,_0x570a1d){_0x4e90e3=_0x4e90e3-0x0;var _0x295e5b=_0x254d[_0x4e90e3];return _0x295e5b;};'use strict';var BPromise=require(_0xd254('0x0'));var util=require('util');var _=require(_0xd254('0x1'));var fs=require('fs');var squel=require(_0xd254('0x2'));var Papa=require(_0xd254('0x3'));var Redis=require(_0xd254('0x4'));var db=require(_0xd254('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xd254('0x6'))(_0xd254('0x7'));config[_0xd254('0x8')]=_[_0xd254('0x9')](config[_0xd254('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd254('0xa'))(new Redis(config[_0xd254('0x8')]));require(_0xd254('0xb'))[_0xd254('0xc')](socket);try{if(!process[_0xd254('0xd')][0x2]||process[_0xd254('0xd')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xd254('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd254('0xd')][0x3]||process[_0xd254('0xd')][0x3]===_0xd254('0xf')||process[_0xd254('0xd')][0x3]===_0xd254('0x10')||!process[_0xd254('0xd')][0x4]||process['argv'][0x4]===_0xd254('0xf')||process[_0xd254('0xd')][0x4]===_0xd254('0x10')){throw new Error(_0xd254('0x11'));}var FIELDS=_[_0xd254('0x12')](process[_0xd254('0xd')][0x3]['split'](','),process[_0xd254('0xd')][0x4]['split'](','));if(!process[_0xd254('0xd')][0x5]||process[_0xd254('0xd')][0x5]===_0xd254('0xf')||process[_0xd254('0xd')][0x5]===_0xd254('0x10')){throw new Error(_0xd254('0x13'));}var LISTID=process[_0xd254('0xd')][0x5];var COMPANYID=process[_0xd254('0xd')][0x6]&&process[_0xd254('0xd')][0x6]!==_0xd254('0xf')&&process['argv'][0x6]!==_0xd254('0x10')?process[_0xd254('0xd')][0x6]:null;var DUPLICATES=process[_0xd254('0xd')][0x7]&&process[_0xd254('0xd')][0x7]!=='undefined'&&process[_0xd254('0xd')][0x7]!==_0xd254('0x10')?process[_0xd254('0xd')][0x7]:null;if(!process[_0xd254('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0xd254('0xd')][0x8]===_0xd254('0x10')){throw new Error(_0xd254('0x14'));}var SOCKET_TIMESTAMP=process[_0xd254('0xd')][0x8];}catch(_0x5769d5){logger['error'](_0x5769d5);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(_0x162a1c,_0x2df2fa,_0x597664,_0x41f3bf){var _0x184a2e={'message':_0x2df2fa};_0x184a2e[_0x162a1c]=!![];if(_0x597664){_0x184a2e[_0xd254('0x15')]=_0x597664;}if(_0x41f3bf){_0x184a2e[_0xd254('0x16')]=_0x41f3bf;}return _0x184a2e;}function isEmail(_0x4414b0){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))*$/[_0xd254('0x17')](_0x4414b0);}function checkRow(_0x1f7a47,_0x3b4d63,_0x881a4){return new BPromise(function(_0x368756,_0x23f71f){if(_[_0xd254('0x18')](_0x1f7a47)){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x1a'),null,_0x881a4));}if(_0x1f7a47[_0xd254('0x1b')]&&_0x1f7a47['errors'][_0xd254('0x1c')]){var _0x149090=_[_0xd254('0x1d')](_0x1f7a47[_0xd254('0x1b')],_0xd254('0x1e'))[_0xd254('0x1f')](';');return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0x149090,null,_0x881a4));}var _0xe61990={};for(var _0x5eaecc in FIELDS){if(FIELDS[_0xd254('0x20')](_0x5eaecc)&&FIELDS[_0x5eaecc]){_0xe61990[_0x5eaecc]=_0x1f7a47[_0xd254('0x21')][0x0][FIELDS[_0x5eaecc]]||_0x1f7a47[_0xd254('0x21')][0x0]['\ufeff'+FIELDS[_0x5eaecc]];}}if(!_0xe61990[_0xd254('0x22')]){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x23'),null,_0x881a4));}if(!_0xe61990['phone']){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x24'),null,_0x881a4));}if(_0xe61990[_0xd254('0x25')]){var _0x37bc3e=moment(_0xe61990[_0xd254('0x25')],'YYYY-MM-DD');if(!_0x37bc3e[_0xd254('0x26')]()){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x27'),null,_0x881a4));}}if(_0xe61990[_0xd254('0x28')]){if(!isEmail(_0xe61990[_0xd254('0x28')])){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x29'),null,_0x881a4));}}_0xe61990['ListId']=LISTID;_0xe61990[_0xd254('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3b4d63){var _0x23eba5={};for(var _0xe35a95=0x0,_0x5115fc=DUPLICATES[_0xd254('0x1c')];_0xe35a95<_0x5115fc;_0xe35a95+=0x1){_0x23eba5[DUPLICATES[_0xe35a95]]=_0xe61990[DUPLICATES[_0xe35a95]];}var _0x10d3a0=_[_0xd254('0x2b')](_0x3b4d63,_0x23eba5);if(_0x10d3a0){return _0x23f71f(handleCheckRowError(_0xd254('0x2c'),_0xd254('0x2d'),_0x10d3a0,_0x881a4));}}return db[_0xd254('0x2e')][_0xd254('0x2f')](_0xe61990,{'raw':!![],'hooks':![],'fields':_[_0xd254('0x30')](_0xe61990)})[_0xd254('0x31')](function(_0x1a0163){if(DUPLICATES&&DUPLICATES['length']&&_0x3b4d63){_0x3b4d63[_0xd254('0x32')](_[_0xd254('0x33')](_0xe61990,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1a0163['id'];return _0x368756();})[_0xd254('0x34')](function(_0x1766d2){return _0x23f71f(handleCheckRowError(_0xd254('0x19'),_0xd254('0x35')+(_0x1766d2['message']||JSON[_0xd254('0x36')](_0x1766d2)),null,_0x881a4));});});}function checkHopper(){function _0x13fd36(){return function(_0x59213b){logger[_0xd254('0x19')](_0xd254('0x37'),_0xd254('0x38'),util[_0xd254('0x39')](_0x59213b,{'showHidden':![],'depth':null}));};}var _0x3199af=function(_0x294124,_0x230716){var _0x1ae64a=squel[_0xd254('0x3a')]()[_0xd254('0x3b')](_0xd254('0x3c'))['fromQuery']([_0xd254('0x3d'),_0xd254('0x3e'),_0xd254('0x3f'),_0xd254('0x40'),_0x230716,_0xd254('0x41'),'updatedAt'],squel[_0xd254('0x42')]()[_0xd254('0x43')]('phone','phone')[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x3e'))['field']('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID[_0xd254('0x45')](),_0xd254('0x40'))[_0xd254('0x43')](_0x294124['id'][_0xd254('0x45')](),_0x230716)[_0xd254('0x43')]('NOW()','createdAt')[_0xd254('0x43')](_0xd254('0x44'),'updatedAt')[_0xd254('0x46')](_0xd254('0x47'))[_0xd254('0x48')]('deletedAt\x20IS\x20NULL')[_0xd254('0x48')](_0xd254('0x49'),LISTID[_0xd254('0x45')]())[_0xd254('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0xd254('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xd254('0x3d'))['from'](_0xd254('0x3c'))[_0xd254('0x48')](_0x230716+_0xd254('0x4a'),_0x294124['id']['toString']())))[_0xd254('0x45')]();return _0x1ae64a;};var _0x3a3bc1=function(_0x1662e2,_0x30cea9){var _0x50c063=squel[_0xd254('0x3a')]()['into'](_0xd254('0x3c'))[_0xd254('0x4b')]([_0xd254('0x3d'),'scheduledAt',_0xd254('0x3f'),_0xd254('0x40'),_0x30cea9,_0xd254('0x41'),_0xd254('0x4c')],squel[_0xd254('0x42')]()['field'](_0xd254('0x3d'),_0xd254('0x3d'))['field'](_0xd254('0x44'),_0xd254('0x3e'))[_0xd254('0x43')]('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID['toString'](),_0xd254('0x40'))[_0xd254('0x43')](_0x1662e2['id']['toString'](),_0x30cea9)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')]('NOW()',_0xd254('0x4c'))[_0xd254('0x46')](_0xd254('0x47'))[_0xd254('0x48')](_0xd254('0x4d'))['where'](_0xd254('0x49'),LISTID['toString']())[_0xd254('0x48')](_0xd254('0x4e'),squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50'))[_0xd254('0x48')](_0xd254('0x51'),squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x52'))['from'](_0xd254('0x53'))['where'](_0x30cea9+_0xd254('0x4a'),_0x1662e2['id'][_0xd254('0x45')]()))[_0xd254('0x48')](_0xd254('0x51'),squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x3d'))[_0xd254('0x46')](_0xd254('0x3c'))[_0xd254('0x48')](_0x30cea9+_0xd254('0x4a'),_0x1662e2['id'][_0xd254('0x45')]())))[_0xd254('0x45')]();return _0x50c063;};function _0x3892df(_0x4b7bcc,_0x5ed9e2){var _0xb1bc1f=squel[_0xd254('0x3a')]()[_0xd254('0x3b')]('cm_hopper')['fromQuery']([_0xd254('0x3d'),_0xd254('0x3e'),_0xd254('0x3f'),_0xd254('0x40'),_0x5ed9e2,_0xd254('0x41'),'updatedAt'],squel[_0xd254('0x42')]()[_0xd254('0x43')](_0xd254('0x3d'),_0xd254('0x3d'))[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x3e'))[_0xd254('0x43')]('id','ContactId')[_0xd254('0x43')](LISTID[_0xd254('0x45')](),'ListId')[_0xd254('0x43')](_0x4b7bcc['id'][_0xd254('0x45')](),_0x5ed9e2)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')](_0xd254('0x44'),'updatedAt')['from']('cm_contacts')[_0xd254('0x48')](_0xd254('0x4d'))[_0xd254('0x48')](_0xd254('0x49'),LISTID['toString']())[_0xd254('0x48')]('id\x20IN\x20?',squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50')))[_0xd254('0x45')]();return _0xb1bc1f;}function _0x41db90(_0x5552f0,_0x4fc922){var _0x3b3d7b=squel[_0xd254('0x3a')]()['into'](_0xd254('0x54'))[_0xd254('0x4b')](['phone',_0xd254('0x3f'),_0xd254('0x40'),_0x4fc922,_0xd254('0x41'),_0xd254('0x4c')],squel[_0xd254('0x42')]()[_0xd254('0x43')]('phone','phone')['field']('id',_0xd254('0x3f'))[_0xd254('0x43')](LISTID['toString'](),'ListId')['field'](_0x5552f0['id']['toString'](),_0x4fc922)[_0xd254('0x43')](_0xd254('0x44'),_0xd254('0x41'))[_0xd254('0x43')]('NOW()',_0xd254('0x4c'))[_0xd254('0x46')]('cm_contacts')[_0xd254('0x48')](_0xd254('0x4d'))['where'](_0xd254('0x49'),LISTID[_0xd254('0x45')]())['where'](_0xd254('0x4e'),squel[_0xd254('0x4f')](hopperContacts))[_0xd254('0x48')](_0xd254('0x50')))['toString']();return _0x3b3d7b;}return db[_0xd254('0x55')][_0xd254('0x56')]({'where':{'type':_0xd254('0x57')},'attributes':['id',_0xd254('0x58')],'include':[{'model':db[_0xd254('0x59')],'as':_0xd254('0x5a'),'where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x46feaa){var _0x19e7a1=[];if(_0x46feaa){var _0x51f055;for(var _0x11726f=0x0,_0x1567d3;_0x11726f<_0x46feaa[_0xd254('0x1c')];_0x11726f+=0x1){_0x1567d3=_0x46feaa[_0x11726f][_0xd254('0x5b')]({'plain':!![]});switch(_0x1567d3[_0xd254('0x58')]){case _0xd254('0x5c'):_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3a3bc1(_0x1567d3,'VoiceQueueId'))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));break;case'onlyIfOpen':_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3199af(_0x1567d3,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));break;default:_0x19e7a1[_0xd254('0x32')](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x3892df(_0x1567d3,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));}}}return _0x19e7a1;})[_0xd254('0x60')]()[_0xd254('0x31')](function(){return db[_0xd254('0x55')][_0xd254('0x56')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xd254('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x18066a){var _0xbd588b=[];if(_0x18066a){var _0x37d50d;for(var _0x4b55c5=0x0,_0x3407c6;_0x4b55c5<_0x18066a['length'];_0x4b55c5+=0x1){_0x3407c6=_0x18066a[_0x4b55c5]['get']({'plain':!![]});_0xbd588b['push'](db[_0xd254('0x5d')][_0xd254('0x5e')](_0x41db90(_0x3407c6,_0xd254('0x5f')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));}}return _0xbd588b;})[_0xd254('0x60')]();})['then'](function(){return db[_0xd254('0x61')][_0xd254('0x56')]({'attributes':['id',_0xd254('0x58')],'include':[{'model':db['CmList'],'as':_0xd254('0x5a'),'where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x1842d5){var _0x23e0a6=[];if(_0x1842d5){for(var _0x4c00fb=0x0,_0x1deada;_0x4c00fb<_0x1842d5[_0xd254('0x1c')];_0x4c00fb+=0x1){_0x1deada=_0x1842d5[_0x4c00fb]['get']({'plain':!![]});switch(_0x1deada['dialCheckDuplicateType']){case _0xd254('0x5c'):_0x23e0a6[_0xd254('0x32')](db[_0xd254('0x5d')]['query'](_0x3a3bc1(_0x1deada,_0xd254('0x62')))['then'](function(){})['catch'](_0x13fd36()));break;case _0xd254('0x63'):_0x23e0a6[_0xd254('0x32')](db['sequelize'][_0xd254('0x5e')](_0x3199af(_0x1deada,_0xd254('0x62')))[_0xd254('0x31')](function(){})[_0xd254('0x34')](_0x13fd36()));break;default:_0x23e0a6['push'](db['sequelize'][_0xd254('0x5e')](_0x3892df(_0x1deada,'CampaignId'))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));}}}return _0x23e0a6;})['all']();})[_0xd254('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0xd254('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd254('0x31')](function(_0x10c48f){var _0x3cf146=[];if(_0x10c48f){for(var _0x20c6d1=0x0,_0xa3833e;_0x20c6d1<_0x10c48f[_0xd254('0x1c')];_0x20c6d1+=0x1){_0xa3833e=_0x10c48f[_0x20c6d1][_0xd254('0x5b')]({'plain':!![]});_0x3cf146[_0xd254('0x32')](db[_0xd254('0x5d')]['query'](_0x41db90(_0xa3833e,_0xd254('0x62')))[_0xd254('0x31')](function(){})['catch'](_0x13fd36()));}}return _0x3cf146;})['all']();})[_0xd254('0x34')](function(_0x5bb929){logger['error'](_0xd254('0x64'),'generalCheckHopper',_0x5bb929[_0xd254('0x1e')]);});}var processPromises=function(_0x213018){return BPromise[_0xd254('0x60')](promises)[_0xd254('0x31')](function(_0x452f13){})[_0xd254('0x34')](function(_0x3a9521){logger[_0xd254('0x19')](_0xd254('0x65'),JSON[_0xd254('0x36')](_0x3a9521));})[_0xd254('0x66')](function(){socket[_0xd254('0x67')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x213018){return _0x213018[_0xd254('0x68')]();}});};var endCsv=function(){return BPromise[_0xd254('0x69')]()[_0xd254('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd254('0x67')](_0xd254('0x6a')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd254('0x6b')](FILEPATH);}catch(_0x57bf60){logger[_0xd254('0x19')](_0xd254('0x6c'),JSON['stringify'](_0x57bf60));}finally{process[_0xd254('0x6d')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xd254('0x6e'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xd254('0x6f')](',');return db[_0xd254('0x2e')][_0xd254('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x414d08){var _0x43591d=fs[_0xd254('0x70')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd254('0x71')](_0x43591d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x144d19,_0x3c073e){total+=0x1;var _0x4e1f9f=total;promises[_0xd254('0x32')](checkRow(_0x144d19,_0x414d08,_0x4e1f9f)[_0xd254('0x31')](function(){success+=0x1;})[_0xd254('0x34')](function(_0x41f176){if(_0x41f176[_0xd254('0x19')]){errors+=0x1;delete _0x41f176[_0xd254('0x19')];}else if(_0x41f176[_0xd254('0x2c')]){duplicates+=0x1;delete _0x41f176[_0xd254('0x2c')];}rows[_0xd254('0x32')](_0x41f176);}));if(total%0xc8===0x0){_0x3c073e[_0xd254('0x72')]();return processPromises(_0x3c073e);}},'complete':function(){return processPromises()['then'](function(){logger[_0xd254('0x73')](_0xd254('0x74'));endCsv();});},'error':function(_0x361f81,_0x36f261){logger[_0xd254('0x73')]('CSV\x20parse\x20error',JSON[_0xd254('0x36')](_0x361f81));endCsv();}});})['catch'](function(_0x3f2d7d){logger[_0xd254('0x19')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd254('0x36')](_0x3f2d7d));});}main(); \ No newline at end of file +var _0x1884=['bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','cm_contacts','where','ListId\x20=\x20?','from','\x20=\x20?','select','deletedAt\x20IS\x20NULL','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','id\x20IN\x20?','cm_hopper_black','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x323921,_0x25ecdd){var _0x54ae0d=function(_0x4da983){while(--_0x4da983){_0x323921['push'](_0x323921['shift']());}};_0x54ae0d(++_0x25ecdd);}(_0x1884,0x1c4));var _0x4188=function(_0x31aa3c,_0x4daa1e){_0x31aa3c=_0x31aa3c-0x0;var _0x3f47ab=_0x1884[_0x31aa3c];return _0x3f47ab;};'use strict';var BPromise=require(_0x4188('0x0'));var util=require(_0x4188('0x1'));var _=require(_0x4188('0x2'));var fs=require('fs');var squel=require(_0x4188('0x3'));var Papa=require(_0x4188('0x4'));var Redis=require(_0x4188('0x5'));var db=require(_0x4188('0x6'))['db'];var config=require(_0x4188('0x7'));var logger=require('../../../config/logger')(_0x4188('0x8'));config[_0x4188('0x9')]=_[_0x4188('0xa')](config[_0x4188('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4188('0xb'))(new Redis(config['redis']));require(_0x4188('0xc'))[_0x4188('0xd')](socket);try{if(!process[_0x4188('0xe')][0x2]||process[_0x4188('0xe')][0x2]===_0x4188('0xf')||process['argv'][0x2]===_0x4188('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x4188('0xe')][0x3]||process[_0x4188('0xe')][0x3]===_0x4188('0xf')||process[_0x4188('0xe')][0x3]===_0x4188('0x10')||!process['argv'][0x4]||process[_0x4188('0xe')][0x4]==='undefined'||process[_0x4188('0xe')][0x4]==='null'){throw new Error(_0x4188('0x11'));}var FIELDS=_['zipObject'](process[_0x4188('0xe')][0x3]['split'](','),process[_0x4188('0xe')][0x4][_0x4188('0x12')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x4188('0xf')||process[_0x4188('0xe')][0x5]===_0x4188('0x10')){throw new Error(_0x4188('0x13'));}var LISTID=process[_0x4188('0xe')][0x5];var COMPANYID=process[_0x4188('0xe')][0x6]&&process[_0x4188('0xe')][0x6]!=='undefined'&&process[_0x4188('0xe')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x4188('0xe')][0x7]&&process['argv'][0x7]!==_0x4188('0xf')&&process[_0x4188('0xe')][0x7]!==_0x4188('0x10')?process[_0x4188('0xe')][0x7]:null;if(!process[_0x4188('0xe')][0x8]||process[_0x4188('0xe')][0x8]===_0x4188('0xf')||process[_0x4188('0xe')][0x8]===_0x4188('0x10')){throw new Error(_0x4188('0x14'));}var SOCKET_TIMESTAMP=process[_0x4188('0xe')][0x8];}catch(_0x1893eb){logger[_0x4188('0x15')](_0x1893eb);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(_0x17db32,_0x52dcc5,_0x2fa531,_0xb21e49){var _0x3e5d83={'message':_0x52dcc5};_0x3e5d83[_0x17db32]=!![];if(_0x2fa531){_0x3e5d83['contact']=_0x2fa531;}if(_0xb21e49){_0x3e5d83[_0x4188('0x16')]=_0xb21e49;}return _0x3e5d83;}function isEmail(_0xf9eb9a){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'](_0xf9eb9a);}function checkRow(_0x191ba4,_0x143575,_0x59cf20){return new BPromise(function(_0x5870b4,_0x5b7cbc){if(_[_0x4188('0x17')](_0x191ba4)){return _0x5b7cbc(handleCheckRowError('error',_0x4188('0x18'),null,_0x59cf20));}if(_0x191ba4[_0x4188('0x19')]&&_0x191ba4[_0x4188('0x19')][_0x4188('0x1a')]){var _0x14ffb3=_['map'](_0x191ba4[_0x4188('0x19')],_0x4188('0x1b'))[_0x4188('0x1c')](';');return _0x5b7cbc(handleCheckRowError('error',_0x14ffb3,null,_0x59cf20));}var _0x430383={};for(var _0x38d5f7 in FIELDS){if(FIELDS['hasOwnProperty'](_0x38d5f7)&&FIELDS[_0x38d5f7]){_0x430383[_0x38d5f7]=_0x191ba4[_0x4188('0x1d')][0x0][FIELDS[_0x38d5f7]]||_0x191ba4[_0x4188('0x1d')][0x0]['\ufeff'+FIELDS[_0x38d5f7]];}}if(!_0x430383[_0x4188('0x1e')]){return _0x5b7cbc(handleCheckRowError(_0x4188('0x15'),_0x4188('0x1f'),null,_0x59cf20));}if(!_0x430383[_0x4188('0x20')]){return _0x5b7cbc(handleCheckRowError(_0x4188('0x15'),_0x4188('0x21'),null,_0x59cf20));}if(_0x430383[_0x4188('0x22')]){var _0x2bd7c0=moment(_0x430383[_0x4188('0x22')],_0x4188('0x23'));if(!_0x2bd7c0[_0x4188('0x24')]()){return _0x5b7cbc(handleCheckRowError('error',_0x4188('0x25'),null,_0x59cf20));}}if(_0x430383[_0x4188('0x26')]){if(!isEmail(_0x430383['email'])){return _0x5b7cbc(handleCheckRowError('error',_0x4188('0x27'),null,_0x59cf20));}}_0x430383[_0x4188('0x28')]=LISTID;_0x430383['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4188('0x1a')]&&_0x143575){var _0x365c2e={};for(var _0x273d71=0x0,_0x3b288c=DUPLICATES['length'];_0x273d71<_0x3b288c;_0x273d71+=0x1){_0x365c2e[DUPLICATES[_0x273d71]]=_0x430383[DUPLICATES[_0x273d71]];}var _0x18eeee=_[_0x4188('0x29')](_0x143575,_0x365c2e);if(_0x18eeee){return _0x5b7cbc(handleCheckRowError(_0x4188('0x2a'),_0x4188('0x2b'),_0x18eeee,_0x59cf20));}}return db['CmContact'][_0x4188('0x2c')](_0x430383,{'raw':!![],'hooks':![],'fields':_[_0x4188('0x2d')](_0x430383)})[_0x4188('0x2e')](function(_0x423b66){if(DUPLICATES&&DUPLICATES[_0x4188('0x1a')]&&_0x143575){_0x143575['push'](_[_0x4188('0x2f')](_0x430383,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x423b66['id'];return _0x5870b4();})[_0x4188('0x30')](function(_0x52f3c8){return _0x5b7cbc(handleCheckRowError(_0x4188('0x15'),_0x4188('0x31')+(_0x52f3c8[_0x4188('0x1b')]||JSON[_0x4188('0x32')](_0x52f3c8)),null,_0x59cf20));});});}function checkHopper(){function _0xeedfad(){return function(_0xf8b136){logger[_0x4188('0x15')](_0x4188('0x33'),_0x4188('0x34'),util[_0x4188('0x35')](_0xf8b136,{'showHidden':![],'depth':null}));};}var _0x2a52ea=function(_0x344ad2,_0x13a73a){var _0x57ba0c=squel[_0x4188('0x36')]()[_0x4188('0x37')](_0x4188('0x38'))[_0x4188('0x39')]([_0x4188('0x20'),_0x4188('0x3a'),_0x4188('0x3b'),_0x4188('0x28'),_0x13a73a,_0x4188('0x3c'),_0x4188('0x3d')],squel['select']()[_0x4188('0x3e')]('phone',_0x4188('0x20'))[_0x4188('0x3e')](_0x4188('0x3f'),'scheduledAt')[_0x4188('0x3e')]('id','ContactId')[_0x4188('0x3e')](LISTID[_0x4188('0x40')](),_0x4188('0x28'))[_0x4188('0x3e')](_0x344ad2['id'][_0x4188('0x40')](),_0x13a73a)['field']('NOW()',_0x4188('0x3c'))[_0x4188('0x3e')]('NOW()','updatedAt')['from'](_0x4188('0x41'))['where']('deletedAt\x20IS\x20NULL')[_0x4188('0x42')](_0x4188('0x43'),LISTID[_0x4188('0x40')]())[_0x4188('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x4188('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x4188('0x3e')](_0x4188('0x20'))[_0x4188('0x44')](_0x4188('0x38'))['where'](_0x13a73a+_0x4188('0x45'),_0x344ad2['id'][_0x4188('0x40')]())))[_0x4188('0x40')]();return _0x57ba0c;};var _0xce602a=function(_0x1318fd,_0x525f5d){var _0x1c9dab=squel['insert']()['into'](_0x4188('0x38'))[_0x4188('0x39')]([_0x4188('0x20'),_0x4188('0x3a'),'ContactId',_0x4188('0x28'),_0x525f5d,_0x4188('0x3c'),_0x4188('0x3d')],squel[_0x4188('0x46')]()[_0x4188('0x3e')](_0x4188('0x20'),_0x4188('0x20'))['field'](_0x4188('0x3f'),_0x4188('0x3a'))['field']('id','ContactId')[_0x4188('0x3e')](LISTID[_0x4188('0x40')](),_0x4188('0x28'))[_0x4188('0x3e')](_0x1318fd['id'][_0x4188('0x40')](),_0x525f5d)[_0x4188('0x3e')](_0x4188('0x3f'),_0x4188('0x3c'))[_0x4188('0x3e')](_0x4188('0x3f'),_0x4188('0x3d'))[_0x4188('0x44')](_0x4188('0x41'))['where'](_0x4188('0x47'))[_0x4188('0x42')](_0x4188('0x43'),LISTID[_0x4188('0x40')]())[_0x4188('0x42')]('id\x20IN\x20?',squel[_0x4188('0x48')](hopperContacts))[_0x4188('0x42')](_0x4188('0x49'))['where'](_0x4188('0x4a'),squel[_0x4188('0x46')]()[_0x4188('0x3e')](_0x4188('0x4b'))[_0x4188('0x44')]('cm_hopper_final')['where'](_0x525f5d+_0x4188('0x45'),_0x1318fd['id'][_0x4188('0x40')]()))[_0x4188('0x42')](_0x4188('0x4a'),squel[_0x4188('0x46')]()[_0x4188('0x3e')]('phone')[_0x4188('0x44')](_0x4188('0x38'))[_0x4188('0x42')](_0x525f5d+_0x4188('0x45'),_0x1318fd['id'][_0x4188('0x40')]())))[_0x4188('0x40')]();return _0x1c9dab;};function _0x18399b(_0x4068aa,_0x39782e){var _0x25adab=squel[_0x4188('0x36')]()[_0x4188('0x37')](_0x4188('0x38'))[_0x4188('0x39')](['phone','scheduledAt','ContactId','ListId',_0x39782e,_0x4188('0x3c'),_0x4188('0x3d')],squel[_0x4188('0x46')]()[_0x4188('0x3e')](_0x4188('0x20'),_0x4188('0x20'))[_0x4188('0x3e')](_0x4188('0x3f'),'scheduledAt')['field']('id',_0x4188('0x3b'))[_0x4188('0x3e')](LISTID[_0x4188('0x40')](),_0x4188('0x28'))[_0x4188('0x3e')](_0x4068aa['id']['toString'](),_0x39782e)[_0x4188('0x3e')](_0x4188('0x3f'),'createdAt')[_0x4188('0x3e')](_0x4188('0x3f'),_0x4188('0x3d'))[_0x4188('0x44')]('cm_contacts')[_0x4188('0x42')](_0x4188('0x47'))['where'](_0x4188('0x43'),LISTID[_0x4188('0x40')]())['where'](_0x4188('0x4c'),squel['str'](hopperContacts))[_0x4188('0x42')](_0x4188('0x49')))['toString']();return _0x25adab;}function _0x342ebe(_0x28ca23,_0x24dc50){var _0x2c422c=squel[_0x4188('0x36')]()[_0x4188('0x37')](_0x4188('0x4d'))[_0x4188('0x39')](['phone',_0x4188('0x3b'),_0x4188('0x28'),_0x24dc50,_0x4188('0x3c'),_0x4188('0x3d')],squel['select']()['field'](_0x4188('0x20'),'phone')[_0x4188('0x3e')]('id',_0x4188('0x3b'))[_0x4188('0x3e')](LISTID[_0x4188('0x40')](),_0x4188('0x28'))['field'](_0x28ca23['id'][_0x4188('0x40')](),_0x24dc50)[_0x4188('0x3e')](_0x4188('0x3f'),_0x4188('0x3c'))[_0x4188('0x3e')](_0x4188('0x3f'),'updatedAt')[_0x4188('0x44')]('cm_contacts')[_0x4188('0x42')](_0x4188('0x47'))[_0x4188('0x42')](_0x4188('0x43'),LISTID[_0x4188('0x40')]())[_0x4188('0x42')]('id\x20IN\x20?',squel[_0x4188('0x48')](hopperContacts))[_0x4188('0x42')](_0x4188('0x49')))['toString']();return _0x2c422c;}return db['VoiceQueue'][_0x4188('0x4e')]({'where':{'type':_0x4188('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4188('0x50')],'as':_0x4188('0x51'),'where':{'id':LISTID}}]})[_0x4188('0x2e')](function(_0xb53f1){var _0x26c1b7=[];if(_0xb53f1){var _0x3c6d39;for(var _0x55e59b=0x0,_0x3093fb;_0x55e59b<_0xb53f1[_0x4188('0x1a')];_0x55e59b+=0x1){_0x3093fb=_0xb53f1[_0x55e59b]['get']({'plain':!![]});switch(_0x3093fb[_0x4188('0x52')]){case _0x4188('0x53'):_0x26c1b7[_0x4188('0x54')](db[_0x4188('0x55')][_0x4188('0x56')](_0xce602a(_0x3093fb,_0x4188('0x57')))[_0x4188('0x2e')](function(){})[_0x4188('0x30')](_0xeedfad()));break;case _0x4188('0x58'):_0x26c1b7[_0x4188('0x54')](db[_0x4188('0x55')][_0x4188('0x56')](_0x2a52ea(_0x3093fb,'VoiceQueueId'))['then'](function(){})['catch'](_0xeedfad()));break;default:_0x26c1b7[_0x4188('0x54')](db['sequelize'][_0x4188('0x56')](_0x18399b(_0x3093fb,_0x4188('0x57')))[_0x4188('0x2e')](function(){})['catch'](_0xeedfad()));}}}return _0x26c1b7;})[_0x4188('0x59')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x4188('0x4f')},'attributes':['id'],'include':[{'model':db[_0x4188('0x50')],'as':_0x4188('0x5a'),'where':{'id':LISTID}}]})[_0x4188('0x2e')](function(_0x5226fd){var _0x569d26=[];if(_0x5226fd){var _0x16e74c;for(var _0x118903=0x0,_0x56a8af;_0x118903<_0x5226fd[_0x4188('0x1a')];_0x118903+=0x1){_0x56a8af=_0x5226fd[_0x118903]['get']({'plain':!![]});_0x569d26[_0x4188('0x54')](db[_0x4188('0x55')]['query'](_0x342ebe(_0x56a8af,_0x4188('0x57')))['then'](function(){})['catch'](_0xeedfad()));}}return _0x569d26;})[_0x4188('0x59')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id',_0x4188('0x52')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x4188('0x2e')](function(_0x550765){var _0x550b36=[];if(_0x550765){for(var _0x412fba=0x0,_0x5ed8c7;_0x412fba<_0x550765[_0x4188('0x1a')];_0x412fba+=0x1){_0x5ed8c7=_0x550765[_0x412fba][_0x4188('0x5b')]({'plain':!![]});switch(_0x5ed8c7[_0x4188('0x52')]){case _0x4188('0x53'):_0x550b36[_0x4188('0x54')](db['sequelize'][_0x4188('0x56')](_0xce602a(_0x5ed8c7,_0x4188('0x5c')))[_0x4188('0x2e')](function(){})[_0x4188('0x30')](_0xeedfad()));break;case _0x4188('0x58'):_0x550b36[_0x4188('0x54')](db[_0x4188('0x55')][_0x4188('0x56')](_0x2a52ea(_0x5ed8c7,_0x4188('0x5c')))['then'](function(){})[_0x4188('0x30')](_0xeedfad()));break;default:_0x550b36['push'](db[_0x4188('0x55')][_0x4188('0x56')](_0x18399b(_0x5ed8c7,_0x4188('0x5c')))[_0x4188('0x2e')](function(){})[_0x4188('0x30')](_0xeedfad()));}}}return _0x550b36;})['all']();})['then'](function(){return db[_0x4188('0x5d')][_0x4188('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x4188('0x50')],'as':_0x4188('0x5a'),'where':{'id':LISTID}}]})[_0x4188('0x2e')](function(_0xfcd0bf){var _0x4d015a=[];if(_0xfcd0bf){for(var _0x2caed0=0x0,_0x3a77fe;_0x2caed0<_0xfcd0bf[_0x4188('0x1a')];_0x2caed0+=0x1){_0x3a77fe=_0xfcd0bf[_0x2caed0]['get']({'plain':!![]});_0x4d015a[_0x4188('0x54')](db[_0x4188('0x55')][_0x4188('0x56')](_0x342ebe(_0x3a77fe,_0x4188('0x5c')))[_0x4188('0x2e')](function(){})[_0x4188('0x30')](_0xeedfad()));}}return _0x4d015a;})[_0x4188('0x59')]();})[_0x4188('0x30')](function(_0x521f05){logger[_0x4188('0x15')](_0x4188('0x5e'),_0x4188('0x5f'),_0x521f05['message']);});}var processPromises=function(_0xef95d0){return BPromise[_0x4188('0x59')](promises)['then'](function(_0x49cb3b){})['catch'](function(_0x5938ae){logger[_0x4188('0x15')]('Error\x20processing\x20rows\x20block:',JSON['stringify'](_0x5938ae));})[_0x4188('0x60')](function(){socket[_0x4188('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xef95d0){return _0xef95d0[_0x4188('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x4188('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x4188('0x2e')](function(){socket[_0x4188('0x61')](_0x4188('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4188('0x64')](FILEPATH);}catch(_0x416517){logger[_0x4188('0x15')](_0x4188('0x65'),JSON[_0x4188('0x32')](_0x416517));}finally{process[_0x4188('0x66')](0x0);}});};process['on'](_0x4188('0x67'),function(){logger[_0x4188('0x68')](_0x4188('0x69'));endCsv();});function main(){return BPromise[_0x4188('0x6a')]()[_0x4188('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4188('0x12')](',');return db[_0x4188('0x6b')][_0x4188('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4188('0x2e')](function(_0x538562){var _0xf78ff0=fs[_0x4188('0x6c')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4188('0x6d')](_0xf78ff0,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e6444,_0x4ce429){total+=0x1;var _0x5a894a=total;promises[_0x4188('0x54')](checkRow(_0x5e6444,_0x538562,_0x5a894a)['then'](function(){success+=0x1;})['catch'](function(_0x41aea1){if(_0x41aea1['error']){errors+=0x1;delete _0x41aea1[_0x4188('0x15')];}else if(_0x41aea1[_0x4188('0x2a')]){duplicates+=0x1;delete _0x41aea1[_0x4188('0x2a')];}rows['push'](_0x41aea1);}));if(total%0xc8===0x0){_0x4ce429[_0x4188('0x6e')]();return processPromises(_0x4ce429);}},'complete':function(){return processPromises()['then'](function(){logger[_0x4188('0x68')](_0x4188('0x6f'));endCsv();});},'error':function(_0x1d2e3f,_0x2957ed){logger[_0x4188('0x68')](_0x4188('0x70'),JSON['stringify'](_0x1d2e3f));endCsv();}});})[_0x4188('0x30')](function(_0x1726e){logger[_0x4188('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x1726e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a30e89d..d671252 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 _0x6366=['isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','length','push','all','then','split','isNil','CmContactHasItem','update','updated','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_contacts.createdAt','into','cm_hopper_black','from','.CmListId\x20=\x20?','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId\x20=\x20','cm_contacts.phone','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','sequelize','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv','includes','keys','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)'];(function(_0x3572e9,_0x445f82){var _0x7076af=function(_0x1cc6ca){while(--_0x1cc6ca){_0x3572e9['push'](_0x3572e9['shift']());}};_0x7076af(++_0x445f82);}(_0x6366,0x198));var _0x6636=function(_0x23e03e,_0x130544){_0x23e03e=_0x23e03e-0x0;var _0x28056a=_0x6366[_0x23e03e];return _0x28056a;};'use strict';var fs=require('fs');var path=require(_0x6636('0x0'));var _=require(_0x6636('0x1'));var Papa=require(_0x6636('0x2'));var util=require('util');var BPromise=require(_0x6636('0x3'));var moment=require(_0x6636('0x4'));var squel=require(_0x6636('0x5'));var Redis=require(_0x6636('0x6'));var db=require(_0x6636('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x6636('0x8'));var logger=require(_0x6636('0x9'))('import');config[_0x6636('0xa')]=_['defaults'](config['redis'],{'host':_0x6636('0xb'),'port':0x18eb});var socket=require(_0x6636('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6636('0xd')](_0x6636('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6636('0xd')](_0x6636('0xe'));function isEmail(_0x4247a3){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'](_0x4247a3);}function selectNotIn(_0x9304c1,_0x402125,_0x4a0bc5,_0x2ee7b2,_0xeb879c){return squel[_0x6636('0xf')]()[_0x6636('0x10')](_0x6636('0x11'))['from'](_0x2ee7b2)[_0x6636('0x12')](_0x402125,null,_0x402125+_0x6636('0x13')+_0x2ee7b2+'.'+_0x4a0bc5)[_0x6636('0x14')](_0x2ee7b2+'.'+_0x4a0bc5+'\x20=\x20'+_0x9304c1+'.'+_0x4a0bc5)['where'](_0x402125+'.dialCheckDuplicateType\x20IN\x20('+_0xeb879c[_0x6636('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5bee5b,_0x56f6b0){promisesAdditionalPhones=[];return db[_0x6636('0x15')][_0x6636('0x16')]({'raw':!![],'attributes':['id',_0x6636('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x1fe2ca){if(_0x1fe2ca!==null){var _0x42decd=[];for(var _0x1f2c0e=0x0;_0x1f2c0e<_0x1fe2ca[_0x6636('0x18')];_0x1f2c0e++){var _0x259e63=_0x1fe2ca[_0x1f2c0e];_0x42decd[_0x6636('0x19')](insertAdditionalPhones(_0x259e63));}}Promise[_0x6636('0x1a')](_0x42decd)['then'](function(){_0x5bee5b({'val':0x1});});});});}function insertAdditionalPhones(_0x3a6ea2){return new Promise(function(_0x27d4bf,_0x4dd7a2){var _0x26c5a8=_0x3a6ea2[_0x6636('0x17')];var _0x1a0b74=_0x26c5a8['split'](';');var _0x44c4aa=[];orderBy=0x0;for(var _0x4dff5c=0x0;_0x4dff5c<_0x1a0b74['length'];_0x4dff5c++){_0x44c4aa[_0x6636('0x19')](splitAdditionalPhone(_0x3a6ea2['id'],_0x1a0b74[_0x4dff5c]));}Promise[_0x6636('0x1a')](_0x44c4aa)[_0x6636('0x1b')](function(){_0x27d4bf({'val':_0x1a0b74[_0x6636('0x18')]});});});}function splitAdditionalPhone(_0x2652a8,_0x3b9ce1){return new Promise(function(_0x36805a,_0x5a39f5){var _0x20e3d2=_0x3b9ce1[_0x6636('0x1c')](':');var _0x3ab28e=_0x20e3d2[0x0];var _0x5b345e=_0x20e3d2[0x1];if(!_[_0x6636('0x1d')](_0x5b345e)){var _0x26fff9=_0x5b345e[_0x6636('0x1c')]('|');var _0xdb501f=[];for(var _0x340c1a=0x0;_0x340c1a<_0x26fff9[_0x6636('0x18')];_0x340c1a++){if(_0x26fff9[_0x340c1a]!==''){var _0x41a9c6=_['filter'](promisesAdditionalPhones,{'contactId':_0x2652a8,'phone':_0x26fff9[_0x340c1a]});if(_0x41a9c6[_0x6636('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2652a8,'contactTypeId':_0x3ab28e,'phone':_0x26fff9[_0x340c1a],'orderBy':orderBy});}}}_0x36805a({'ok':0x1});}else _0x36805a({'res':0x0});});}function createAdditionalPhone(_0x4cbf8b,_0x504097,_0x245208,_0x274dbd){var _0x471f8b='';var _0x375360='';var _0x305338=_0x245208[_0x6636('0x1c')]('§');_0x471f8b=_0x305338[0x0];if(_0x305338['length']==0x2)_0x375360=_0x305338[0x1];return new Promise(function(_0x5997ba,_0x2c6307){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x4cbf8b,'item':_0x471f8b}})[_0x6636('0x1b')](function(_0x1ccd40){if(_0x1ccd40){return db[_0x6636('0x1e')][_0x6636('0x1f')]({'ItemTypeId':_0x504097,'description':_0x375360,'OrderBy':_0x274dbd},{'where':{'CmContactId':_0x4cbf8b,'item':_0x471f8b}})['then'](function(_0x258fce){_0x5997ba({'res':_0x6636('0x20')});});}else{return db[_0x6636('0x1e')]['create']({'CmContactId':_0x4cbf8b,'item':_0x471f8b,'description':_0x375360,'ItemTypeId':_0x504097,'OrderBy':_0x274dbd,'ItemClass':'PHONE'})['then'](function(_0x36ebb3){_0x5997ba({'res':'inserted'});});}});});}function insertCmHopper(_0x4f9bd5,_0x26b39c,_0x1f12b0,_0x1334a7,_0xfd97ea){var _0x18b5ce=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x26b39c+'.'+_0x1334a7,'cm_contacts.createdAt',_0x6636('0x21'),_0x6636('0x22'),_0x6636('0x23'),'\x22'+_0xfd97ea+'\x22'];return squel[_0x6636('0x24')]()['into']('cm_hopper')[_0x6636('0x25')]([_0x6636('0x11'),_0x6636('0x26'),_0x6636('0x27'),_0x6636('0x28'),_0x1334a7,_0x6636('0x29'),_0x6636('0x2a'),_0x6636('0x2b'),_0x6636('0x2c'),_0x6636('0x2d')],squel['select']()[_0x6636('0x2e')](_0x18b5ce)['from'](_0x26b39c)['join'](_0x6636('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x26b39c+_0x6636('0x30'))[_0x6636('0x12')](_0x1f12b0,null,_0x1f12b0+_0x6636('0x13')+_0x26b39c+'.'+_0x1334a7)[_0x6636('0x14')](_0x26b39c+'.CmListId\x20=\x20?',_0x4f9bd5)[_0x6636('0x14')](_0x6636('0x31'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x26b39c,_0x1f12b0,_0x1334a7,_0x6636('0x32'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x26b39c,_0x1f12b0,_0x1334a7,_0x6636('0x32'),[_0x6636('0x34')])))[_0x6636('0x35')]();}function insertCmHopperBlack(_0x280383,_0x3810b5,_0x3fe030,_0x5013a3){var _0x47a526=['cm_contacts.phone','cm_contacts.id',_0x6636('0x36'),_0x3810b5+'.'+_0x5013a3,_0x6636('0x37'),_0x6636('0x21')];return squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x39'))['fromQuery']([_0x6636('0x11'),'ContactId','ListId',_0x5013a3,_0x6636('0x29'),_0x6636('0x2a')],squel['select']()[_0x6636('0x2e')](_0x47a526)[_0x6636('0x3a')](_0x3810b5)[_0x6636('0x12')](_0x6636('0x2f'),null,'cm_contacts.ListId\x20=\x20'+_0x3810b5+'.CmListId')[_0x6636('0x12')](_0x3fe030,null,_0x3fe030+_0x6636('0x13')+_0x3810b5+'.'+_0x5013a3)['where'](_0x3810b5+_0x6636('0x3b'),_0x280383)[_0x6636('0x14')](_0x6636('0x31'),NOW)['where'](_0x6636('0x33'),squel[_0x6636('0xf')]()['field'](_0x6636('0x11'))['from'](_0x6636('0x39'))[_0x6636('0x14')](_0x6636('0x3c'),_0x280383)[_0x6636('0x14')](_0x5013a3+'\x20=\x20'+_0x3810b5+'.'+_0x5013a3)))['toString']();}function insertTzCmHopper(_0x4692a0,_0x57cdac,_0x236a61,_0x52a6ec,_0x2f8565,_0x9ae971){var _0x26520e=['cm_contacts.phone',_0x6636('0x3d')+_0x9ae971+_0x6636('0x3e'),_0x6636('0x3f'),'cm_contacts.ListId',_0x57cdac+'.'+_0x52a6ec,_0x6636('0x37'),_0x6636('0x21'),'cm_contacts.priority',_0x6636('0x23'),'\x22'+_0x2f8565+'\x22'];var _0x31ce2f=squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x32'))['fromQuery']([_0x6636('0x11'),_0x6636('0x26'),_0x6636('0x27'),_0x6636('0x28'),_0x52a6ec,'createdAt',_0x6636('0x2a'),_0x6636('0x2b'),_0x6636('0x2c'),_0x6636('0x2d')],squel['select']()[_0x6636('0x2e')](_0x26520e)[_0x6636('0x3a')](_0x57cdac)[_0x6636('0x12')]('cm_contacts',null,_0x6636('0x40')+_0x57cdac+_0x6636('0x30'))[_0x6636('0x12')](_0x236a61,null,_0x236a61+_0x6636('0x13')+_0x57cdac+'.'+_0x52a6ec)[_0x6636('0x12')](_0x9ae971,null,_0x9ae971+_0x6636('0x13')+_0x57cdac+'.'+_0x52a6ec)[_0x6636('0x14')](_0x57cdac+_0x6636('0x3b'),_0x4692a0)[_0x6636('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x57cdac,_0x236a61,_0x52a6ec,'cm_hopper',[_0x6636('0x34'),'\x22onlyIfOpen\x22']))[_0x6636('0x14')](_0x6636('0x33'),selectNotIn(_0x57cdac,_0x236a61,_0x52a6ec,'cm_hopper',[_0x6636('0x34')])))[_0x6636('0x35')]();return _0x31ce2f;}function insertTzCmHopperBlack(_0x51820b,_0x18a5bc,_0x2bcbc5,_0x70ca59){var _0x2a70dc=[_0x6636('0x41'),_0x6636('0x3f'),_0x6636('0x36'),_0x18a5bc+'.'+_0x70ca59,_0x6636('0x37'),_0x6636('0x21')];return squel['insert']()['into']('cm_hopper_black')[_0x6636('0x25')]([_0x6636('0x11'),_0x6636('0x27'),_0x6636('0x28'),_0x70ca59,_0x6636('0x29'),_0x6636('0x2a')],squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x2a70dc)[_0x6636('0x3a')](_0x18a5bc)[_0x6636('0x12')](_0x6636('0x2f'),null,_0x6636('0x40')+_0x18a5bc+'.CmListId')['join'](_0x2bcbc5,null,_0x2bcbc5+_0x6636('0x13')+_0x18a5bc+'.'+_0x70ca59)[_0x6636('0x14')](_0x18a5bc+'.CmListId\x20=\x20?',_0x51820b)[_0x6636('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6636('0x14')](_0x6636('0x33'),squel['select']()[_0x6636('0x10')](_0x6636('0x11'))[_0x6636('0x3a')](_0x6636('0x39'))[_0x6636('0x14')]('ListId\x20=\x20?',_0x51820b)['where'](_0x70ca59+'\x20=\x20'+_0x18a5bc+'.'+_0x70ca59)))[_0x6636('0x35')]();}function insertCmHopperAdditionalPhones(_0xd581fa){var _0x5b1cce=[_0x6636('0x42'),_0x6636('0x43'),_0x6636('0x44'),_0x6636('0x45'),_0x6636('0x46')];return squel[_0x6636('0x24')]()[_0x6636('0x38')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x6636('0x11'),_0x6636('0x47'),_0x6636('0x29'),'updatedAt'],squel['select']()[_0x6636('0x2e')](_0x5b1cce)[_0x6636('0x3a')](_0x6636('0x32'))['join'](_0x6636('0x2f'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6636('0x12')](_0x6636('0x48'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x6636('0x49'),_0xd581fa)[_0x6636('0x14')](_0x6636('0x31'),NOW))[_0x6636('0x35')]();}function insertCmContact(_0x3d88ce,_0x13b8b2,_0x5c0d33,_0x542251){var _0x4de5f4=_[_0x6636('0x4a')](_['keys'](_0x542251),[_0x6636('0x28'),'CompanyId',_0x6636('0x29'),_0x6636('0x2a')]);return squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x6636('0x2f'))['fromQuery'](_0x4de5f4,squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x4de5f4)[_0x6636('0x3a')](_0x13b8b2)[_0x6636('0x14')]('('+_0x5c0d33[_0x6636('0x12')](',')+_0x6636('0x4b'),squel[_0x6636('0xf')]()[_0x6636('0x2e')](_0x5c0d33)[_0x6636('0x3a')](_0x6636('0x2f'))['where'](_0x6636('0x3c'),_0x3d88ce)[_0x6636('0x14')](_0x6636('0x4c')))['where'](_0x6636('0x4d'),squel['select']()[_0x6636('0x10')](_0x6636('0x4e'),_0x6636('0x4f'))[_0x6636('0x3a')](_0x13b8b2)[_0x6636('0x50')](_0x5c0d33[_0x6636('0x12')](','))))[_0x6636('0x35')]();}function handleStop(){logger[_0x6636('0x51')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x214b09){logger[_0x6636('0x52')](_0x214b09[_0x6636('0x53')]);process[_0x6636('0x54')](0x1);}function handleError(_0x4e48a5,_0x518845){stats[_0x6636('0x55')]['push']({'name':_0x518845['code'],'message':_0x518845[_0x6636('0x53')],'row':_0x4e48a5});}function handleQuery(_0x28d3e7){logger['info'](_0x28d3e7);return db[_0x6636('0x56')][_0x6636('0x57')](_0x28d3e7)[_0x6636('0x58')](function(_0x47e0f8){results[_0x6636('0x19')](_0x47e0f8);})[_0x6636('0x59')](function(_0x1c2f4f){logger['error'](_0x1c2f4f[_0x6636('0x53')]);});}function updateTzCampaigns(_0x3de2df){return new Promise(function(_0x392b97,_0x508bec){var _0x35fd3b=squel[_0x6636('0xf')]()[_0x6636('0x2e')](['campaigns.id',_0x6636('0x5a')])[_0x6636('0x3a')](_0x6636('0x5b'))[_0x6636('0x12')](_0x6636('0x5c'),null,_0x6636('0x5d'))[_0x6636('0x14')](_0x6636('0x5e')+_0x3de2df);db[_0x6636('0x56')][_0x6636('0x57')](_0x35fd3b['toString']())['spread'](function(_0x43c5d5){var _0x19d58a=[];for(var _0x393e0f=0x0;_0x393e0f<_0x43c5d5[_0x6636('0x18')];_0x393e0f++){_0x19d58a[_0x6636('0x19')](getTimezoneData(_0x43c5d5[_0x393e0f],tmp_campaigns));}BPromise[_0x6636('0x1a')](_0x19d58a)[_0x6636('0x1b')](function(){_0x392b97({'val':0x1});});})[_0x6636('0x59')](function(_0x24c5c1){logger['error'](_0x24c5c1[_0x6636('0x53')]);_0x392b97({'val':0x0});});});}function updateTzVoiceQueues(_0x33f596){return new Promise(function(_0x1b901e,_0x2e9101){var _0x501f8b=squel[_0x6636('0xf')]()[_0x6636('0x2e')]([_0x6636('0x5f'),_0x6636('0x60')])['from']('voice_queues')[_0x6636('0x12')](_0x6636('0x61'),null,_0x6636('0x62'))['where']('voice_queues_has_cm_lists.CmListId='+_0x33f596);db[_0x6636('0x56')]['query'](_0x501f8b[_0x6636('0x35')]())[_0x6636('0x58')](function(_0x3695bd){var _0x46dce8=[];for(var _0x323224=0x0;_0x323224<_0x3695bd[_0x6636('0x18')];_0x323224++){_0x46dce8['push'](getTimezoneData(_0x3695bd[_0x323224],tmp_voice_queues));}BPromise[_0x6636('0x1a')](_0x46dce8)[_0x6636('0x1b')](function(){_0x1b901e({'val':0x1});});})['catch'](function(_0x18129a){logger['error'](_0x18129a[_0x6636('0x53')]);_0x1b901e({'val':0x0});});});}function getTimezoneData(_0x6ce8b0,_0x1a151b){return new Promise(function(_0x2554be,_0x544cbd){var _0x3e1fea=shared[_0x6636('0x63')];var _0x29e426=_0x3e1fea[_0x6ce8b0[_0x6636('0x64')]];if(_[_0x6636('0x1d')](_0x29e426)){_0x2554be({'ret':0x1});}else{var _0x4fdf64=_0x29e426['utcOffset'];var _0x3605b9=squel[_0x6636('0x24')]()[_0x6636('0x38')](_0x1a151b)[_0x6636('0x65')]('id',_0x6ce8b0['id'])['set'](_0x6636('0x66'),_0x4fdf64)[_0x6636('0x65')]('dialTimezone',_0x6ce8b0[_0x6636('0x64')])[_0x6636('0x35')]();return db[_0x6636('0x56')][_0x6636('0x57')](_0x3605b9)['spread'](function(_0x503dcb){_0x2554be({'ret':0x1});})[_0x6636('0x59')](function(_0xe5eb92){logger[_0x6636('0x52')](_0xe5eb92[_0x6636('0x53')]);_0x544cbd({'ret':0x1});});}});}function handleTZQuery(_0x45873e){logger[_0x6636('0x51')](_0x45873e);return db[_0x6636('0x56')][_0x6636('0x57')](_0x45873e)[_0x6636('0x58')](function(_0x23cc40){})[_0x6636('0x59')](function(_0x36f3c4){logger[_0x6636('0x52')](_0x36f3c4['message']);});}function main(_0x43feb5,_0x1a27e2,_0x3e19b8,_0x2d32b8){logger[_0x6636('0x51')](_0x6636('0x67'),_0x43feb5,JSON[_0x6636('0x68')](_0x1a27e2));process[_0x6636('0x69')](_0x6636('0x6a'));var _0x5d15e9=_0x1a27e2[_0x6636('0x6b')];var _0x486155=_['clone'](_0x5d15e9);var _0x1f170b=_0x1a27e2[_0x6636('0x6c')];var _0x49bc01=path[_0x6636('0x12')](config[_0x6636('0x6d')],'server/files/tmp',_0x1f170b+_0x6636('0x6e'));hasTZ=_['keys'](_0x5d15e9)[_0x6636('0x6f')](_0x6636('0x64'));var _0x3efdbb=_[_0x6636('0x70')](_0x5d15e9)[_0x6636('0x12')]();logger['info'](_0x6636('0x71'),_0x3efdbb);db[_0x6636('0x72')][_0x6636('0x16')]({'raw':!![],'attributes':['id',_0x6636('0x73')]})[_0x6636('0x1b')](function(_0x31f4c3){for(var _0x32e97e=0x0;_0x32e97e<_0x31f4c3[_0x6636('0x18')];_0x32e97e++){if(_0x31f4c3[_0x32e97e][_0x6636('0x73')]in _0x5d15e9){contactItemTypes[_0x6636('0x19')](_0x31f4c3[_0x32e97e]);delete _0x486155[_0x31f4c3[_0x32e97e][_0x6636('0x73')]];hasAdditionalPhones=!![];}for(var _0x1d597e in _0x5d15e9){if(_0x31f4c3[_0x32e97e]['name']+_0x6636('0x74')===_0x1d597e){phoneDescriptions[_0x6636('0x19')]({'itemTypeId':_0x31f4c3[_0x32e97e]['id'],'description':_0x1d597e});delete _0x486155[_0x1d597e];}}}if(hasAdditionalPhones)_0x486155['AdditionalPhones']='';var _0x575d16=_[_0x6636('0x70')](_0x486155)[_0x6636('0x12')]();logger[_0x6636('0x51')](_0x6636('0x71'),_0x575d16);fs[_0x6636('0x75')](_0x49bc01,_0x575d16+'\x0a');Papa[_0x6636('0x76')](fs[_0x6636('0x77')](_0x43feb5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48ceed,_0x2e4919){try{for(var _0x526ec4=0x0,_0x24a5b6=[];_0x526ec4<_0x48ceed[_0x6636('0x78')][_0x6636('0x18')];_0x526ec4++){stats[_0x6636('0x79')]+=0x1;if(_0x48ceed['errors'][_0x526ec4]){handleError(_0x48ceed['data'][_0x526ec4],_0x48ceed[_0x6636('0x55')][_0x526ec4]);}else{var _0x539860=[];var _0xdace83=[];var _0x4030f6={};for(var _0x48c910 in _0x5d15e9){let _0x5a18f0=contactItemTypes[_0x6636('0x7a')](_0x292887=>_0x292887[_0x6636('0x73')]===_0x48c910);let _0x18b3c6=contactItemTypes[_0x6636('0x7a')](_0x281425=>_0x281425[_0x6636('0x73')]+_0x6636('0x74')===_0x48c910);if(_[_0x6636('0x1d')](_0x5a18f0)&&_[_0x6636('0x1d')](_0x18b3c6)){if(_0x5d15e9[_0x6636('0x7b')](_0x48c910)){if(_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]]){var _0xea521b=_[_0x6636('0x7c')](_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]]['replace'](/"/g,'\x27'));switch(_0x48c910){case _0x6636('0x26'):var _0x3e9a9d=moment(_0xea521b,_0x6636('0xe'),!![]);if(_0x3e9a9d['isValid']()){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860['push'](_0x6636('0x7d'));}break;case _0x6636('0x2b'):var _0x397805=parseInt(_0xea521b);_0xea521b=_['isNaN'](_0x397805)||_0x397805<0x0||_0x397805>0x4?_0x2d32b8?0x3:0x2:_0x397805;_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');break;case _0x6636('0x2c'):var _0x2cd65f=parseInt(_0xea521b);if(_[_0x6636('0x7e')](_0x2cd65f)&&_[_0x6636('0x6f')](_0x3e19b8,_0x2cd65f)){_0x24a5b6[_0x6636('0x19')]('\x22'+_0x2cd65f+'\x22');}else{_0x539860['push'](_0x6636('0x7f'));}break;case _0x6636('0x80'):if(isEmail(_0xea521b)){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860[_0x6636('0x19')]('email\x20wrong\x20format');}break;case _0x6636('0x81'):var _0x198286=moment(_0xea521b,_0x6636('0x82'),!![]);if(_0x198286['isValid']()){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');}else{_0x539860[_0x6636('0x19')](_0x6636('0x83'));}break;case _0x6636('0x64'):var _0x5b38d2=shared['timezones'];var _0x43e777=_0x5b38d2[_0xea521b];if(!_['isNil'](_0x43e777)){var _0x81232e=_0x43e777['utcOffset'];_0x24a5b6[_0x6636('0x19')]('\x22'+_0xea521b+'\x22');_0x24a5b6['push']('\x22'+_0x81232e+'\x22');}break;default:_0x24a5b6['push']('\x22'+_0xea521b+'\x22');}}else{switch(_0x48c910){case _0x6636('0x84'):case _0x6636('0x11'):_0x539860[_0x6636('0x19')](_0x48c910+_0x6636('0x85'));break;default:_0x24a5b6['push']('\x22\x22');}}}}else{var _0x5ef3bf='';if(!_['isNil'](_0x5a18f0)){if(!_0x4030f6[_0x6636('0x7b')](_0x5a18f0['id'])){if(!_[_0x6636('0x1d')](_0x48ceed[_0x6636('0x78')][_0x526ec4][_0x5d15e9[_0x48c910]])){var _0xea521b=_['trim'](_0x48ceed['data'][_0x526ec4][_0x5d15e9[_0x48c910]][_0x6636('0x86')](/"/g,'\x27'));var _0x976a2d=phoneDescriptions['find'](_0x20976b=>_0x20976b[_0x6636('0x87')]===_0x5a18f0['id']);if(!_['isNil'](_0x976a2d)){var _0x6f0e74=_[_0x6636('0x7c')](_0x48ceed['data'][_0x526ec4][_0x5d15e9[_0x976a2d[_0x6636('0x88')]]]['replace'](/"/g,'\x27'));if(!_[_0x6636('0x1d')](_0x6f0e74))_0xea521b=_0xea521b+'§'+_0x6f0e74;}if(_0x5ef3bf=='')_0x5ef3bf=_0xea521b;else _0x5ef3bf+='|'+_0xea521b;}_0xdace83['push'](_0x5a18f0['id']+':'+_0x5ef3bf);_0x4030f6[_0x5a18f0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x24a5b6[_0x6636('0x19')]('\x22'+_0xdace83[_0x6636('0x12')](';')+'\x22');}if(_0x539860[_0x6636('0x18')]){handleError(_0x48ceed['data'][_0x526ec4],{'code':_0x6636('0x89'),'message':_0x539860[_0x6636('0x12')]()});}else{fs[_0x6636('0x8a')](_0x49bc01,_0x24a5b6['join']()+'\x0a');}_0x24a5b6=[];}if(!(stats[_0x6636('0x79')]%0xc8)){socket[_0x6636('0x8b')](_0x6636('0x8c')+_0x1f170b,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x6636('0x8d'));_0x2e4919[_0x6636('0x8e')]();}}catch(_0x499659){handleError(_0x48ceed['data'][_0x526ec4],{'code':_0x6636('0x8f'),'message':_0x499659[_0x6636('0x53')]});logger[_0x6636('0x52')](_0x6636('0x90'),_0x499659[_0x6636('0x53')]);}},'complete':function(){try{var _0x7ecaf3=[];var _0x127b8b=[];var _0x1638cb='cm_contacts';if(_0x1a27e2[_0x6636('0x91')]&&_0x1a27e2[_0x6636('0x91')][_0x6636('0x18')]){_0x1638cb=_0x6636('0x92')+_0x1f170b;_0x7ecaf3[_0x6636('0x19')](_0x6636('0x93')+_0x1638cb+_0x6636('0x94'));}tmp_campaigns=_0x6636('0x95')+_0x1f170b;tmp_voice_queues=_0x6636('0x96')+_0x1f170b;_0x127b8b[_0x6636('0x19')](_0x6636('0x93')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x127b8b[_0x6636('0x19')](_0x6636('0x93')+tmp_voice_queues+_0x6636('0x97'));BPromise[_0x6636('0x98')](_0x127b8b,handleTZQuery)[_0x6636('0x1b')](function(_0x17f731){updateTzCampaigns(_0x1a27e2['ListId'])[_0x6636('0x1b')](function(_0xdb21ac){updateTzVoiceQueues(_0x1a27e2[_0x6636('0x28')])[_0x6636('0x1b')](function(_0x2673b7){if(hasTZ)_0x575d16=_0x575d16[_0x6636('0x86')](_0x6636('0x64'),_0x6636('0x99'));var _0x88ba7e=util[_0x6636('0xd')](_0x6636('0x9a'),_0x49bc01,_0x1638cb,_0x575d16,_0x1a27e2['ListId'],_0x1a27e2[_0x6636('0x9b')]||null,NOW,NOW);if(_[_0x6636('0x1d')](_0x5d15e9['scheduledat'])){_0x88ba7e+=_0x6636('0x9c');}_0x7ecaf3[_0x6636('0x19')](_0x88ba7e);if(_0x1a27e2[_0x6636('0x91')]&&_0x1a27e2[_0x6636('0x91')][_0x6636('0x18')]){_0x7ecaf3[_0x6636('0x19')](insertCmContact(_0x1a27e2[_0x6636('0x28')],_0x1638cb,_0x1a27e2['duplicates'],_0x5d15e9));_0x7ecaf3[_0x6636('0x19')](_0x6636('0x9d')+_0x1638cb+';');}BPromise[_0x6636('0x98')](_0x7ecaf3,handleQuery)[_0x6636('0x1b')](function(_0x35b794){BPromise['all']([handleAdditionalPhones()])[_0x6636('0x1b')](function(){_0x7ecaf3=[];for(var _0xc96e30=0x0;_0xc96e30\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','format','test','select','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.id','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','code','message','sequelize','query','spread','catch','campaigns.id'];(function(_0x2170d5,_0x541f16){var _0x3cbd25=function(_0x1d6010){while(--_0x1d6010){_0x2170d5['push'](_0x2170d5['shift']());}};_0x3cbd25(++_0x541f16);}(_0x5d81,0x1c0));var _0x15d8=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x5d81[_0x59befa];return _0x1dd63d;};'use strict';var fs=require('fs');var path=require(_0x15d8('0x0'));var _=require(_0x15d8('0x1'));var Papa=require(_0x15d8('0x2'));var util=require('util');var BPromise=require(_0x15d8('0x3'));var moment=require(_0x15d8('0x4'));var squel=require(_0x15d8('0x5'));var Redis=require('ioredis');var db=require(_0x15d8('0x6'))['db'];var config=require('../../../config/environment');var shared=require(_0x15d8('0x7'));var logger=require(_0x15d8('0x8'))(_0x15d8('0x9'));config[_0x15d8('0xa')]=_[_0x15d8('0xb')](config[_0x15d8('0xa')],{'host':_0x15d8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15d8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x15d8('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x15d8('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3c99d8){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))*$/[_0x15d8('0xe')](_0x3c99d8);}function selectNotIn(_0x53a8e4,_0x5f2fa5,_0x11b1d7,_0x107c7f,_0x59d3c6){return squel[_0x15d8('0xf')]()['field']('phone')[_0x15d8('0x10')](_0x107c7f)['join'](_0x5f2fa5,null,_0x5f2fa5+_0x15d8('0x11')+_0x107c7f+'.'+_0x11b1d7)[_0x15d8('0x12')](_0x107c7f+'.'+_0x11b1d7+_0x15d8('0x13')+_0x53a8e4+'.'+_0x11b1d7)[_0x15d8('0x12')](_0x5f2fa5+_0x15d8('0x14')+_0x59d3c6['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x320345,_0x5ee8ab){promisesAdditionalPhones=[];return db['CmContact'][_0x15d8('0x15')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x15d8('0x16')](function(_0x3364b2){if(_0x3364b2!==null){var _0x21c4a8=[];for(var _0x13f1d8=0x0;_0x13f1d8<_0x3364b2[_0x15d8('0x17')];_0x13f1d8++){var _0xa635bd=_0x3364b2[_0x13f1d8];_0x21c4a8[_0x15d8('0x18')](insertAdditionalPhones(_0xa635bd));}}Promise[_0x15d8('0x19')](_0x21c4a8)[_0x15d8('0x16')](function(){_0x320345({'val':0x1});});});});}function insertAdditionalPhones(_0x289a7f){return new Promise(function(_0xec8f2,_0x551f80){var _0x20004a=_0x289a7f[_0x15d8('0x1a')];var _0x74619e=_0x20004a['split'](';');var _0x4ef8c2=[];orderBy=0x0;for(var _0x4d16ad=0x0;_0x4d16ad<_0x74619e[_0x15d8('0x17')];_0x4d16ad++){_0x4ef8c2[_0x15d8('0x18')](splitAdditionalPhone(_0x289a7f['id'],_0x74619e[_0x4d16ad]));}Promise[_0x15d8('0x19')](_0x4ef8c2)['then'](function(){_0xec8f2({'val':_0x74619e[_0x15d8('0x17')]});});});}function splitAdditionalPhone(_0x81cae3,_0x50a299){return new Promise(function(_0x2b2554,_0x1989f8){var _0x1e35b7=_0x50a299[_0x15d8('0x1b')](':');var _0x5894cd=_0x1e35b7[0x0];var _0x381833=_0x1e35b7[0x1];if(!_[_0x15d8('0x1c')](_0x381833)){var _0x1e0c16=_0x381833[_0x15d8('0x1b')]('|');var _0x527120=[];for(var _0x4debe2=0x0;_0x4debe2<_0x1e0c16[_0x15d8('0x17')];_0x4debe2++){if(_0x1e0c16[_0x4debe2]!==''){var _0x48c4b0=_[_0x15d8('0x1d')](promisesAdditionalPhones,{'contactId':_0x81cae3,'phone':_0x1e0c16[_0x4debe2]});if(_0x48c4b0[_0x15d8('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x15d8('0x18')]({'contactId':_0x81cae3,'contactTypeId':_0x5894cd,'phone':_0x1e0c16[_0x4debe2],'orderBy':orderBy});}}}_0x2b2554({'ok':0x1});}else _0x2b2554({'res':0x0});});}function createAdditionalPhone(_0x291aa2,_0x33d81c,_0xf4f2d8,_0x10d00f){var _0x3ec74c='';var _0x2cb5fe='';var _0x3f47d8=_0xf4f2d8[_0x15d8('0x1b')]('§');_0x3ec74c=_0x3f47d8[0x0];if(_0x3f47d8['length']==0x2)_0x2cb5fe=_0x3f47d8[0x1];return new Promise(function(_0x7f1882,_0x5061e3){return db[_0x15d8('0x1e')][_0x15d8('0x1f')]({'where':{'CmContactId':_0x291aa2,'item':_0x3ec74c}})[_0x15d8('0x16')](function(_0x1a076c){if(_0x1a076c){return db[_0x15d8('0x1e')][_0x15d8('0x20')]({'ItemTypeId':_0x33d81c,'description':_0x2cb5fe,'OrderBy':_0x10d00f},{'where':{'CmContactId':_0x291aa2,'item':_0x3ec74c}})[_0x15d8('0x16')](function(_0x31a4f6){_0x7f1882({'res':_0x15d8('0x21')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x291aa2,'item':_0x3ec74c,'description':_0x2cb5fe,'ItemTypeId':_0x33d81c,'OrderBy':_0x10d00f,'ItemClass':_0x15d8('0x22')})['then'](function(_0x4667de){_0x7f1882({'res':_0x15d8('0x23')});});}});});}function insertCmHopper(_0x5bcda7,_0x507291,_0xf064fe,_0x1c475b,_0x34c375){var _0x3926c2=[_0x15d8('0x24'),_0x15d8('0x25'),'cm_contacts.id',_0x15d8('0x26'),_0x507291+'.'+_0x1c475b,_0x15d8('0x27'),_0x15d8('0x28'),_0x15d8('0x29'),_0x15d8('0x2a'),'\x22'+_0x34c375+'\x22'];return squel[_0x15d8('0x2b')]()[_0x15d8('0x2c')](_0x15d8('0x2d'))[_0x15d8('0x2e')]([_0x15d8('0x2f'),_0x15d8('0x30'),_0x15d8('0x31'),_0x15d8('0x32'),_0x1c475b,_0x15d8('0x33'),'updatedAt',_0x15d8('0x34'),_0x15d8('0x35'),_0x15d8('0x36')],squel[_0x15d8('0xf')]()[_0x15d8('0x37')](_0x3926c2)['from'](_0x507291)['join'](_0x15d8('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x507291+_0x15d8('0x39'))[_0x15d8('0x3a')](_0xf064fe,null,_0xf064fe+_0x15d8('0x11')+_0x507291+'.'+_0x1c475b)[_0x15d8('0x12')](_0x507291+_0x15d8('0x3b'),_0x5bcda7)[_0x15d8('0x12')](_0x15d8('0x3c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x507291,_0xf064fe,_0x1c475b,_0x15d8('0x2d'),[_0x15d8('0x3d'),_0x15d8('0x3e')]))[_0x15d8('0x12')](_0x15d8('0x3f'),selectNotIn(_0x507291,_0xf064fe,_0x1c475b,_0x15d8('0x2d'),[_0x15d8('0x3d')])))['toString']();}function insertCmHopperBlack(_0x1d0691,_0x184bf4,_0x3ddeb2,_0x14e040){var _0x3942b8=[_0x15d8('0x24'),_0x15d8('0x40'),_0x15d8('0x26'),_0x184bf4+'.'+_0x14e040,_0x15d8('0x27'),_0x15d8('0x28')];return squel[_0x15d8('0x2b')]()['into'](_0x15d8('0x41'))['fromQuery']([_0x15d8('0x2f'),'ContactId',_0x15d8('0x32'),_0x14e040,_0x15d8('0x33'),_0x15d8('0x42')],squel[_0x15d8('0xf')]()[_0x15d8('0x37')](_0x3942b8)['from'](_0x184bf4)[_0x15d8('0x3a')](_0x15d8('0x38'),null,_0x15d8('0x43')+_0x184bf4+_0x15d8('0x39'))[_0x15d8('0x3a')](_0x3ddeb2,null,_0x3ddeb2+_0x15d8('0x11')+_0x184bf4+'.'+_0x14e040)['where'](_0x184bf4+_0x15d8('0x3b'),_0x1d0691)[_0x15d8('0x12')](_0x15d8('0x3c'),NOW)[_0x15d8('0x12')](_0x15d8('0x3f'),squel[_0x15d8('0xf')]()[_0x15d8('0x44')](_0x15d8('0x2f'))[_0x15d8('0x10')](_0x15d8('0x41'))['where'](_0x15d8('0x45'),_0x1d0691)[_0x15d8('0x12')](_0x14e040+_0x15d8('0x13')+_0x184bf4+'.'+_0x14e040)))[_0x15d8('0x46')]();}function insertTzCmHopper(_0x573463,_0x82e534,_0x3b46d3,_0x1dd63f,_0x3f79fe,_0x11ae75){var _0x320b38=[_0x15d8('0x24'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x11ae75+_0x15d8('0x47'),_0x15d8('0x40'),_0x15d8('0x26'),_0x82e534+'.'+_0x1dd63f,_0x15d8('0x27'),'cm_contacts.updatedAt',_0x15d8('0x29'),_0x15d8('0x2a'),'\x22'+_0x3f79fe+'\x22'];var _0x2ddfca=squel[_0x15d8('0x2b')]()[_0x15d8('0x2c')]('cm_hopper')[_0x15d8('0x2e')]([_0x15d8('0x2f'),_0x15d8('0x30'),_0x15d8('0x31'),_0x15d8('0x32'),_0x1dd63f,'createdAt',_0x15d8('0x42'),'priority','UserId',_0x15d8('0x36')],squel[_0x15d8('0xf')]()[_0x15d8('0x37')](_0x320b38)[_0x15d8('0x10')](_0x82e534)[_0x15d8('0x3a')]('cm_contacts',null,_0x15d8('0x43')+_0x82e534+_0x15d8('0x39'))[_0x15d8('0x3a')](_0x3b46d3,null,_0x3b46d3+_0x15d8('0x11')+_0x82e534+'.'+_0x1dd63f)[_0x15d8('0x3a')](_0x11ae75,null,_0x11ae75+_0x15d8('0x11')+_0x82e534+'.'+_0x1dd63f)[_0x15d8('0x12')](_0x82e534+_0x15d8('0x3b'),_0x573463)[_0x15d8('0x12')](_0x15d8('0x3c'),NOW)[_0x15d8('0x12')](_0x15d8('0x3f'),selectNotIn(_0x82e534,_0x3b46d3,_0x1dd63f,'cm_hopper',[_0x15d8('0x3d'),'\x22onlyIfOpen\x22']))[_0x15d8('0x12')](_0x15d8('0x3f'),selectNotIn(_0x82e534,_0x3b46d3,_0x1dd63f,'cm_hopper',['\x22always\x22'])))['toString']();return _0x2ddfca;}function insertTzCmHopperBlack(_0x1586da,_0x330dde,_0x250a50,_0xb288ea){var _0x57ca4f=[_0x15d8('0x24'),_0x15d8('0x40'),'cm_contacts.ListId',_0x330dde+'.'+_0xb288ea,_0x15d8('0x27'),_0x15d8('0x28')];return squel[_0x15d8('0x2b')]()['into'](_0x15d8('0x41'))[_0x15d8('0x2e')]([_0x15d8('0x2f'),_0x15d8('0x31'),_0x15d8('0x32'),_0xb288ea,_0x15d8('0x33'),_0x15d8('0x42')],squel[_0x15d8('0xf')]()[_0x15d8('0x37')](_0x57ca4f)['from'](_0x330dde)[_0x15d8('0x3a')](_0x15d8('0x38'),null,_0x15d8('0x43')+_0x330dde+_0x15d8('0x39'))['join'](_0x250a50,null,_0x250a50+_0x15d8('0x11')+_0x330dde+'.'+_0xb288ea)[_0x15d8('0x12')](_0x330dde+_0x15d8('0x3b'),_0x1586da)[_0x15d8('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x15d8('0x12')](_0x15d8('0x3f'),squel[_0x15d8('0xf')]()[_0x15d8('0x44')](_0x15d8('0x2f'))[_0x15d8('0x10')](_0x15d8('0x41'))[_0x15d8('0x12')](_0x15d8('0x45'),_0x1586da)[_0x15d8('0x12')](_0xb288ea+_0x15d8('0x13')+_0x330dde+'.'+_0xb288ea)))['toString']();}function insertCmHopperAdditionalPhones(_0x340695){var _0x3b7d65=['cm_hopper.id',_0x15d8('0x48'),_0x15d8('0x49'),_0x15d8('0x4a'),'cm_contact_has_items.updatedAt'];return squel[_0x15d8('0x2b')]()['into'](_0x15d8('0x4b'))[_0x15d8('0x2e')]([_0x15d8('0x4c'),'phone',_0x15d8('0x4d'),_0x15d8('0x33'),'updatedAt'],squel[_0x15d8('0xf')]()['fields'](_0x3b7d65)[_0x15d8('0x10')](_0x15d8('0x2d'))[_0x15d8('0x3a')](_0x15d8('0x38'),null,_0x15d8('0x4e'))[_0x15d8('0x3a')](_0x15d8('0x4f'),null,_0x15d8('0x50'))[_0x15d8('0x12')](_0x15d8('0x51'),_0x340695)['where'](_0x15d8('0x3c'),NOW))[_0x15d8('0x46')]();}function insertCmContact(_0x321cad,_0x171557,_0x594d9f,_0x30795b){var _0x37a945=_['concat'](_['keys'](_0x30795b),['ListId',_0x15d8('0x52'),_0x15d8('0x33'),_0x15d8('0x42')]);return squel[_0x15d8('0x2b')]()[_0x15d8('0x2c')]('cm_contacts')[_0x15d8('0x2e')](_0x37a945,squel[_0x15d8('0xf')]()[_0x15d8('0x37')](_0x37a945)['from'](_0x171557)[_0x15d8('0x12')]('('+_0x594d9f[_0x15d8('0x3a')](',')+_0x15d8('0x53'),squel['select']()['fields'](_0x594d9f)[_0x15d8('0x10')](_0x15d8('0x38'))['where'](_0x15d8('0x45'),_0x321cad)['where'](_0x15d8('0x54')))[_0x15d8('0x12')](_0x15d8('0x55'),squel[_0x15d8('0xf')]()[_0x15d8('0x44')]('MIN(id)',_0x15d8('0x56'))[_0x15d8('0x10')](_0x171557)['group'](_0x594d9f['join'](','))))['toString']();}function handleStop(){logger[_0x15d8('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x38b939){logger['error'](_0x38b939['message']);process['exit'](0x1);}function handleError(_0xedd96e,_0x1e61e5){stats['errors'][_0x15d8('0x18')]({'name':_0x1e61e5[_0x15d8('0x58')],'message':_0x1e61e5[_0x15d8('0x59')],'row':_0xedd96e});}function handleQuery(_0x575318){logger[_0x15d8('0x57')](_0x575318);return db[_0x15d8('0x5a')][_0x15d8('0x5b')](_0x575318)[_0x15d8('0x5c')](function(_0x306945){results[_0x15d8('0x18')](_0x306945);})[_0x15d8('0x5d')](function(_0x1e492a){logger['error'](_0x1e492a['message']);});}function updateTzCampaigns(_0x36e198){return new Promise(function(_0x1194f6,_0x47a753){var _0x2f8d98=squel[_0x15d8('0xf')]()['fields']([_0x15d8('0x5e'),_0x15d8('0x5f')])[_0x15d8('0x10')](_0x15d8('0x60'))[_0x15d8('0x3a')](_0x15d8('0x61'),null,_0x15d8('0x62'))[_0x15d8('0x12')](_0x15d8('0x63')+_0x36e198);db['sequelize'][_0x15d8('0x5b')](_0x2f8d98[_0x15d8('0x46')]())[_0x15d8('0x5c')](function(_0x2cf46a){var _0x49008c=[];for(var _0x52fc69=0x0;_0x52fc69<_0x2cf46a[_0x15d8('0x17')];_0x52fc69++){_0x49008c[_0x15d8('0x18')](getTimezoneData(_0x2cf46a[_0x52fc69],tmp_campaigns));}BPromise[_0x15d8('0x19')](_0x49008c)[_0x15d8('0x16')](function(){_0x1194f6({'val':0x1});});})['catch'](function(_0x399efb){logger[_0x15d8('0x64')](_0x399efb[_0x15d8('0x59')]);_0x1194f6({'val':0x0});});});}function updateTzVoiceQueues(_0x2f4688){return new Promise(function(_0x403856,_0x5a8379){var _0x5d6c59=squel[_0x15d8('0xf')]()[_0x15d8('0x37')]([_0x15d8('0x65'),_0x15d8('0x66')])[_0x15d8('0x10')](_0x15d8('0x67'))[_0x15d8('0x3a')](_0x15d8('0x68'),null,_0x15d8('0x69'))['where']('voice_queues_has_cm_lists.CmListId='+_0x2f4688);db[_0x15d8('0x5a')]['query'](_0x5d6c59['toString']())[_0x15d8('0x5c')](function(_0x3ce3d4){var _0x381d4c=[];for(var _0x3257f3=0x0;_0x3257f3<_0x3ce3d4[_0x15d8('0x17')];_0x3257f3++){_0x381d4c[_0x15d8('0x18')](getTimezoneData(_0x3ce3d4[_0x3257f3],tmp_voice_queues));}BPromise['all'](_0x381d4c)[_0x15d8('0x16')](function(){_0x403856({'val':0x1});});})['catch'](function(_0x2e94f8){logger[_0x15d8('0x64')](_0x2e94f8['message']);_0x403856({'val':0x0});});});}function getTimezoneData(_0x213998,_0x5b9c33){return new Promise(function(_0x26c816,_0x5e3cab){var _0xee48d5=shared[_0x15d8('0x6a')];var _0x15b3a8=_0xee48d5[_0x213998[_0x15d8('0x6b')]];if(_[_0x15d8('0x1c')](_0x15b3a8)){_0x26c816({'ret':0x1});}else{var _0x2b9891=_0x15b3a8[_0x15d8('0x6c')];var _0x2f71c3=squel[_0x15d8('0x2b')]()['into'](_0x5b9c33)[_0x15d8('0x6d')]('id',_0x213998['id'])[_0x15d8('0x6d')](_0x15d8('0x6e'),_0x2b9891)[_0x15d8('0x6d')](_0x15d8('0x6b'),_0x213998[_0x15d8('0x6b')])[_0x15d8('0x46')]();return db[_0x15d8('0x5a')][_0x15d8('0x5b')](_0x2f71c3)['spread'](function(_0x5096b0){_0x26c816({'ret':0x1});})[_0x15d8('0x5d')](function(_0x58c6cd){logger[_0x15d8('0x64')](_0x58c6cd['message']);_0x5e3cab({'ret':0x1});});}});}function handleTZQuery(_0x3ec6b2){logger[_0x15d8('0x57')](_0x3ec6b2);return db['sequelize'][_0x15d8('0x5b')](_0x3ec6b2)[_0x15d8('0x5c')](function(_0x3ab987){})['catch'](function(_0x585223){logger['error'](_0x585223[_0x15d8('0x59')]);});}function main(_0x138d15,_0x5c5cf4,_0x556528,_0x37c0a2){logger[_0x15d8('0x57')](_0x15d8('0x6f'),_0x138d15,JSON[_0x15d8('0x70')](_0x5c5cf4));process['send'](_0x15d8('0x71'));var _0x461052=_0x5c5cf4[_0x15d8('0x72')];var _0x1cd4d6=_[_0x15d8('0x73')](_0x461052);var _0x24bf45=_0x5c5cf4[_0x15d8('0x74')];var _0x1d50af=path[_0x15d8('0x3a')](config[_0x15d8('0x75')],'server/files/tmp',_0x24bf45+_0x15d8('0x76'));hasTZ=_[_0x15d8('0x77')](_0x461052)['includes']('dialTimezone');var _0x3dd25c=_[_0x15d8('0x77')](_0x461052)['join']();logger[_0x15d8('0x57')](_0x15d8('0x78'),_0x3dd25c);db[_0x15d8('0x79')]['findAll']({'raw':!![],'attributes':['id',_0x15d8('0x7a')]})[_0x15d8('0x16')](function(_0x10dddd){for(var _0x2292af=0x0;_0x2292af<_0x10dddd['length'];_0x2292af++){if(_0x10dddd[_0x2292af][_0x15d8('0x7a')]in _0x461052){contactItemTypes[_0x15d8('0x18')](_0x10dddd[_0x2292af]);delete _0x1cd4d6[_0x10dddd[_0x2292af][_0x15d8('0x7a')]];hasAdditionalPhones=!![];}for(var _0x4dcee0 in _0x461052){if(_0x10dddd[_0x2292af][_0x15d8('0x7a')]+_0x15d8('0x7b')===_0x4dcee0){phoneDescriptions[_0x15d8('0x18')]({'itemTypeId':_0x10dddd[_0x2292af]['id'],'description':_0x4dcee0});delete _0x1cd4d6[_0x4dcee0];}}}if(hasAdditionalPhones)_0x1cd4d6[_0x15d8('0x1a')]='';var _0x24e808=_['keys'](_0x1cd4d6)[_0x15d8('0x3a')]();logger[_0x15d8('0x57')]('header',_0x24e808);fs['writeFileSync'](_0x1d50af,_0x24e808+'\x0a');Papa[_0x15d8('0x7c')](fs[_0x15d8('0x7d')](_0x138d15),{'header':!![],'skipEmptyLines':!![],'step':function(_0x496b38,_0x3ab928){try{for(var _0x140d10=0x0,_0x1bdcf3=[];_0x140d10<_0x496b38[_0x15d8('0x7e')][_0x15d8('0x17')];_0x140d10++){stats[_0x15d8('0x7f')]+=0x1;if(_0x496b38[_0x15d8('0x80')][_0x140d10]){handleError(_0x496b38['data'][_0x140d10],_0x496b38[_0x15d8('0x80')][_0x140d10]);}else{var _0x3dfb6d=[];var _0x156511=[];var _0x4cf824={};for(var _0x207f8e in _0x461052){let _0x514a8f=contactItemTypes[_0x15d8('0x81')](_0x598b96=>_0x598b96[_0x15d8('0x7a')]===_0x207f8e);let _0x60151b=contactItemTypes[_0x15d8('0x81')](_0x50ebb3=>_0x50ebb3[_0x15d8('0x7a')]+_0x15d8('0x7b')===_0x207f8e);if(_[_0x15d8('0x1c')](_0x514a8f)&&_[_0x15d8('0x1c')](_0x60151b)){if(_0x461052[_0x15d8('0x82')](_0x207f8e)){if(_0x496b38[_0x15d8('0x7e')][_0x140d10][_0x461052[_0x207f8e]]){var _0x4d6086=_[_0x15d8('0x83')](_0x496b38[_0x15d8('0x7e')][_0x140d10][_0x461052[_0x207f8e]][_0x15d8('0x84')](/"/g,'\x27'));switch(_0x207f8e){case'scheduledat':var _0x1f70c0=moment(_0x4d6086,_0x15d8('0x85'),!![]);if(_0x1f70c0[_0x15d8('0x86')]()){_0x1bdcf3['push']('\x22'+_0x4d6086+'\x22');}else{_0x3dfb6d[_0x15d8('0x18')](_0x15d8('0x87'));}break;case'priority':var _0x38bd5b=parseInt(_0x4d6086);_0x4d6086=_[_0x15d8('0x88')](_0x38bd5b)||_0x38bd5b<0x0||_0x38bd5b>0x4?_0x37c0a2?0x3:0x2:_0x38bd5b;_0x1bdcf3[_0x15d8('0x18')]('\x22'+_0x4d6086+'\x22');break;case _0x15d8('0x35'):var _0x52d90c=parseInt(_0x4d6086);if(_[_0x15d8('0x89')](_0x52d90c)&&_[_0x15d8('0x8a')](_0x556528,_0x52d90c)){_0x1bdcf3[_0x15d8('0x18')]('\x22'+_0x52d90c+'\x22');}else{_0x3dfb6d['push']('agent\x20not\x20exists');}break;case _0x15d8('0x8b'):if(isEmail(_0x4d6086)){_0x1bdcf3['push']('\x22'+_0x4d6086+'\x22');}else{_0x3dfb6d[_0x15d8('0x18')](_0x15d8('0x8c'));}break;case _0x15d8('0x8d'):var _0x2c7b46=moment(_0x4d6086,_0x15d8('0x8e'),!![]);if(_0x2c7b46[_0x15d8('0x86')]()){_0x1bdcf3['push']('\x22'+_0x4d6086+'\x22');}else{_0x3dfb6d[_0x15d8('0x18')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x15d8('0x6b'):var _0xc62817=shared[_0x15d8('0x6a')];var _0x42a17b=_0xc62817[_0x4d6086];if(!_[_0x15d8('0x1c')](_0x42a17b)){var _0x2a9cc6=_0x42a17b[_0x15d8('0x6c')];_0x1bdcf3[_0x15d8('0x18')]('\x22'+_0x4d6086+'\x22');_0x1bdcf3['push']('\x22'+_0x2a9cc6+'\x22');}break;default:_0x1bdcf3[_0x15d8('0x18')]('\x22'+_0x4d6086+'\x22');}}else{switch(_0x207f8e){case _0x15d8('0x8f'):case _0x15d8('0x2f'):_0x3dfb6d[_0x15d8('0x18')](_0x207f8e+'\x20not\x20specified');break;default:_0x1bdcf3[_0x15d8('0x18')]('\x22\x22');}}}}else{var _0x12d52e='';if(!_[_0x15d8('0x1c')](_0x514a8f)){if(!_0x4cf824[_0x15d8('0x82')](_0x514a8f['id'])){if(!_[_0x15d8('0x1c')](_0x496b38[_0x15d8('0x7e')][_0x140d10][_0x461052[_0x207f8e]])){var _0x4d6086=_[_0x15d8('0x83')](_0x496b38[_0x15d8('0x7e')][_0x140d10][_0x461052[_0x207f8e]][_0x15d8('0x84')](/"/g,'\x27'));var _0x3a6049=phoneDescriptions[_0x15d8('0x81')](_0x57b35a=>_0x57b35a[_0x15d8('0x90')]===_0x514a8f['id']);if(!_[_0x15d8('0x1c')](_0x3a6049)){var _0x563dd3=_[_0x15d8('0x83')](_0x496b38[_0x15d8('0x7e')][_0x140d10][_0x461052[_0x3a6049[_0x15d8('0x91')]]][_0x15d8('0x84')](/"/g,'\x27'));if(!_[_0x15d8('0x1c')](_0x563dd3))_0x4d6086=_0x4d6086+'§'+_0x563dd3;}if(_0x12d52e=='')_0x12d52e=_0x4d6086;else _0x12d52e+='|'+_0x4d6086;}_0x156511[_0x15d8('0x18')](_0x514a8f['id']+':'+_0x12d52e);_0x4cf824[_0x514a8f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1bdcf3[_0x15d8('0x18')]('\x22'+_0x156511[_0x15d8('0x3a')](';')+'\x22');}if(_0x3dfb6d[_0x15d8('0x17')]){handleError(_0x496b38['data'][_0x140d10],{'code':_0x15d8('0x92'),'message':_0x3dfb6d[_0x15d8('0x3a')]()});}else{fs['appendFileSync'](_0x1d50af,_0x1bdcf3[_0x15d8('0x3a')]()+'\x0a');}_0x1bdcf3=[];}if(!(stats['rows']%0xc8)){socket[_0x15d8('0x93')](_0x15d8('0x94')+_0x24bf45,stats);stats[_0x15d8('0x80')]=[];}}if(stopped){logger[_0x15d8('0x57')](_0x15d8('0x95'));_0x3ab928[_0x15d8('0x96')]();}}catch(_0x3f7984){handleError(_0x496b38['data'][_0x140d10],{'code':'SystemError','message':_0x3f7984[_0x15d8('0x59')]});logger[_0x15d8('0x64')](_0x15d8('0x97'),_0x3f7984[_0x15d8('0x59')]);}},'complete':function(){try{var _0x34bd9c=[];var _0x447668=[];var _0x4beebc=_0x15d8('0x38');if(_0x5c5cf4[_0x15d8('0x98')]&&_0x5c5cf4[_0x15d8('0x98')][_0x15d8('0x17')]){_0x4beebc=_0x15d8('0x99')+_0x24bf45;_0x34bd9c['push'](_0x15d8('0x9a')+_0x4beebc+_0x15d8('0x9b'));}tmp_campaigns=_0x15d8('0x9c')+_0x24bf45;tmp_voice_queues=_0x15d8('0x9d')+_0x24bf45;_0x447668[_0x15d8('0x18')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x15d8('0x9e'));_0x447668[_0x15d8('0x18')](_0x15d8('0x9a')+tmp_voice_queues+_0x15d8('0x9e'));BPromise['each'](_0x447668,handleTZQuery)['then'](function(_0x2d8f20){updateTzCampaigns(_0x5c5cf4['ListId'])['then'](function(_0x326192){updateTzVoiceQueues(_0x5c5cf4[_0x15d8('0x32')])[_0x15d8('0x16')](function(_0x4c4900){if(hasTZ)_0x24e808=_0x24e808[_0x15d8('0x84')](_0x15d8('0x6b'),_0x15d8('0x9f'));var _0x16a16d=util[_0x15d8('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1d50af,_0x4beebc,_0x24e808,_0x5c5cf4[_0x15d8('0x32')],_0x5c5cf4['CompanyId']||null,NOW,NOW);if(_[_0x15d8('0x1c')](_0x461052[_0x15d8('0x30')])){_0x16a16d+=_0x15d8('0xa0');}_0x34bd9c[_0x15d8('0x18')](_0x16a16d);if(_0x5c5cf4[_0x15d8('0x98')]&&_0x5c5cf4[_0x15d8('0x98')][_0x15d8('0x17')]){_0x34bd9c[_0x15d8('0x18')](insertCmContact(_0x5c5cf4[_0x15d8('0x32')],_0x4beebc,_0x5c5cf4[_0x15d8('0x98')],_0x461052));_0x34bd9c['push'](_0x15d8('0xa1')+_0x4beebc+';');}BPromise[_0x15d8('0xa2')](_0x34bd9c,handleQuery)[_0x15d8('0x16')](function(_0xff79ac){BPromise['all']([handleAdditionalPhones()])[_0x15d8('0x16')](function(){_0x34bd9c=[];for(var _0xe5edc2=0x0;_0xe5edc2\x20\x20','root','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','squel','ioredis'];(function(_0x2d78c6,_0x1b5010){var _0x43b12a=function(_0x50cccc){while(--_0x50cccc){_0x2d78c6['push'](_0x2d78c6['shift']());}};_0x43b12a(++_0x1b5010);}(_0x2d28,0x1be));var _0x82d2=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x2d28[_0x5027b1];return _0x4a46cf;};'use strict';var fs=require('fs');var path=require(_0x82d2('0x0'));var _=require(_0x82d2('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x82d2('0x2'));var Redis=require(_0x82d2('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x82d2('0x4'));var logger=require(_0x82d2('0x5'))('import');config[_0x82d2('0x6')]=_['defaults'](config[_0x82d2('0x6')],{'host':_0x82d2('0x7'),'port':0x18eb});var socket=require(_0x82d2('0x8'))(new Redis(config[_0x82d2('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x82d2('0x9')+moment()[_0x82d2('0xa')](_0x82d2('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x132cf9){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))*$/[_0x82d2('0xc')](_0x132cf9);}function selectNotIn(_0x2affca,_0x508e51,_0x576b16,_0x3f5dda,_0x483b6e){return squel[_0x82d2('0xd')]()[_0x82d2('0xe')](_0x82d2('0xf'))[_0x82d2('0x10')](_0x3f5dda)['join'](_0x508e51,null,_0x508e51+_0x82d2('0x11')+_0x3f5dda+'.'+_0x576b16)[_0x82d2('0x12')](_0x3f5dda+'.'+_0x576b16+'\x20=\x20'+_0x2affca+'.'+_0x576b16)['where'](_0x508e51+_0x82d2('0x13')+_0x483b6e[_0x82d2('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2bf42c,_0x1cbeae){promisesAdditionalPhones=[];promisesContact=[];return db[_0x82d2('0x15')][_0x82d2('0x16')](_0x82d2('0x17')+tempTableName)[_0x82d2('0x18')](function(_0x38836e){if(_0x38836e!==null){var _0x35b8ff=[];for(var _0x7e5af1=0x0;_0x7e5af1<_0x38836e[_0x82d2('0x19')];_0x7e5af1++){var _0x4d2c11=_0x38836e[_0x7e5af1];if(!_[_0x82d2('0x1a')](_0x4d2c11['phone'])){if(!_[_0x82d2('0x1a')](_0x4d2c11[_0x82d2('0x1b')]))_0x35b8ff[_0x82d2('0x1c')](insertAdditionalPhones(_0x4d2c11));promisesContact['push']({'contact':_0x4d2c11});}}}Promise[_0x82d2('0x1d')](_0x35b8ff)[_0x82d2('0x1e')](function(){_0x2bf42c({'val':0x1});});})[_0x82d2('0x1f')](function(_0x227898){logger[_0x82d2('0x20')](_0x227898['message']);});});}function insertAdditionalPhones(_0xb023a3){return new Promise(function(_0x2374c6,_0x507f04){var _0x3f35a1=_0xb023a3[_0x82d2('0x1b')];if(_[_0x82d2('0x1a')](_0x3f35a1))_0x507f04({'val':0x0});else{var _0x103655=_0x3f35a1[_0x82d2('0x21')](';');var _0x4696d4=[];orderBy=0x0;for(var _0x238432=0x0;_0x238432<_0x103655[_0x82d2('0x19')];_0x238432++){_0x4696d4['push'](splitAdditionalPhone(_0xb023a3['id'],_0x103655[_0x238432]));}Promise['all'](_0x4696d4)[_0x82d2('0x1e')](function(){_0x2374c6({'val':_0x103655['length']});});}});}function splitAdditionalPhone(_0x59555b,_0x79b653){return new Promise(function(_0x4fcbe1,_0x4308a8){var _0x4049e1=_0x79b653[_0x82d2('0x21')](':');var _0x1e8c0d=_0x4049e1[0x0];var _0x23d153=_0x4049e1[0x1];if(_0x23d153!==''){var _0x2c84de=_0x23d153[_0x82d2('0x21')]('|');var _0x19acd0=[];for(var _0x13bb38=0x0;_0x13bb38<_0x2c84de[_0x82d2('0x19')];_0x13bb38++){if(_0x2c84de[_0x13bb38]!==''){var _0x39b82d=_[_0x82d2('0x22')](promisesAdditionalPhones,{'contactId':_0x59555b,'phone':_0x2c84de[_0x13bb38]});if(_0x39b82d['length']==0x0){orderBy++;promisesAdditionalPhones[_0x82d2('0x1c')]({'contactId':_0x59555b,'contactTypeId':_0x1e8c0d,'phone':_0x2c84de[_0x13bb38],'orderBy':orderBy});}}}_0x4fcbe1({'ok':0x1});}else _0x4fcbe1({'res':0x0});});}function createAdditionalPhone(_0x94e1fd,_0x260ddf,_0x488f48,_0x2d2ef1){var _0x3790b2='';var _0x286526='';var _0x2a6564=_0x488f48[_0x82d2('0x21')]('§');_0x3790b2=_0x2a6564[0x0];if(_0x2a6564[_0x82d2('0x19')]==0x2)_0x286526=_0x2a6564[0x1];return new Promise(function(_0x9058b9,_0x52a855){return db[_0x82d2('0x23')][_0x82d2('0x24')]({'where':{'CmContactId':_0x94e1fd,'item':_0x3790b2}})['then'](function(_0x201e2d){if(_0x201e2d){return db[_0x82d2('0x23')][_0x82d2('0x25')]({'ItemTypeId':_0x260ddf,'description':_0x286526,'OrderBy':_0x2d2ef1},{'where':{'CmContactId':_0x94e1fd,'item':_0x3790b2}})['then'](function(_0x21b8e3){_0x9058b9({'res':'updated'});});}else{return db[_0x82d2('0x23')]['create']({'CmContactId':_0x94e1fd,'item':_0x3790b2,'ItemTypeId':_0x260ddf,'description':_0x286526,'OrderBy':_0x2d2ef1,'ItemClass':_0x82d2('0x26')})['then'](function(_0x3a1f4d){_0x9058b9({'res':_0x82d2('0x27')});});}});});}function updateContact(_0x247319){return new Promise(function(_0x247b44,_0xf250f7){var _0xad055b=_0x247319['id'];delete _0x247319['id'];return db['CmContact'][_0x82d2('0x25')](_0x247319,{'where':{'id':_0xad055b}})[_0x82d2('0x1e')](function(_0x3fcb23){updatedRows+=0x1;return db[_0x82d2('0x28')][_0x82d2('0x25')]({'phone':_0x247319[_0x82d2('0xf')]},{'where':{'ContactId':_0xad055b}})[_0x82d2('0x1e')](function(_0x4f26f4){_0x247b44({'ret':'OK'});});});});}function insertCmHopper(_0x2c7bbf,_0x3877fe,_0x27745a,_0x1de7bf,_0x1f1bab){var _0x493f34=[_0x82d2('0x29'),'cm_contacts.scheduledat','cm_contacts.id',_0x82d2('0x2a'),_0x3877fe+'.'+_0x1de7bf,'cm_contacts.createdAt',_0x82d2('0x2b'),_0x82d2('0x2c'),_0x82d2('0x2d'),'\x22'+_0x1f1bab+'\x22'];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')](_0x82d2('0x30'))[_0x82d2('0x31')]([_0x82d2('0xf'),_0x82d2('0x32'),_0x82d2('0x33'),_0x82d2('0x34'),_0x1de7bf,_0x82d2('0x35'),_0x82d2('0x36'),_0x82d2('0x37'),_0x82d2('0x38'),_0x82d2('0x39')],squel[_0x82d2('0xd')]()['fields'](_0x493f34)[_0x82d2('0x10')](_0x3877fe)[_0x82d2('0x14')](_0x82d2('0x3a'),null,_0x82d2('0x3b')+_0x3877fe+'.CmListId')['join'](_0x27745a,null,_0x27745a+_0x82d2('0x11')+_0x3877fe+'.'+_0x1de7bf)[_0x82d2('0x12')](_0x3877fe+'.CmListId\x20=\x20?',_0x2c7bbf)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW)[_0x82d2('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3877fe,_0x27745a,_0x1de7bf,_0x82d2('0x30'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x82d2('0x12')](_0x82d2('0x3d'),selectNotIn(_0x3877fe,_0x27745a,_0x1de7bf,_0x82d2('0x30'),[_0x82d2('0x3e')])))[_0x82d2('0x3f')]();}function insertCmHopperBlack(_0x4680b7,_0x37671e,_0x4e6a08,_0x3886af){var _0x5ce132=[_0x82d2('0x29'),_0x82d2('0x40'),_0x82d2('0x2a'),_0x37671e+'.'+_0x3886af,_0x82d2('0x41'),_0x82d2('0x2b')];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')]('cm_hopper_black')[_0x82d2('0x31')](['phone','ContactId',_0x82d2('0x34'),_0x3886af,_0x82d2('0x35'),'updatedAt'],squel['select']()[_0x82d2('0x42')](_0x5ce132)['from'](_0x37671e)['join'](_0x82d2('0x3a'),null,_0x82d2('0x3b')+_0x37671e+_0x82d2('0x43'))[_0x82d2('0x14')](_0x4e6a08,null,_0x4e6a08+_0x82d2('0x11')+_0x37671e+'.'+_0x3886af)[_0x82d2('0x12')](_0x37671e+'.CmListId\x20=\x20?',_0x4680b7)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x82d2('0xd')]()['field'](_0x82d2('0xf'))[_0x82d2('0x10')](_0x82d2('0x44'))['where'](_0x82d2('0x45'),_0x4680b7)[_0x82d2('0x12')](_0x3886af+'\x20=\x20?',_0x37671e+'.'+_0x3886af)))[_0x82d2('0x3f')]();}function insertCmHopperAdditionalPhones(_0x957941){var _0x5d4853=[_0x82d2('0x46'),_0x82d2('0x47'),_0x82d2('0x48'),_0x82d2('0x49'),_0x82d2('0x4a')];return squel[_0x82d2('0x2e')]()[_0x82d2('0x2f')](_0x82d2('0x4b'))[_0x82d2('0x31')](['CmHopperId',_0x82d2('0xf'),_0x82d2('0x4c'),'createdAt','updatedAt'],squel['select']()[_0x82d2('0x42')](_0x5d4853)[_0x82d2('0x10')]('cm_hopper')['join'](_0x82d2('0x3a'),null,_0x82d2('0x4d'))[_0x82d2('0x14')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x82d2('0x12')](_0x82d2('0x4e'),_0x957941)[_0x82d2('0x12')](_0x82d2('0x3c'),NOW))[_0x82d2('0x3f')]();}function insertCmContact(_0x5ea1c6,_0x435bd7,_0x41d60f,_0x36ba8a){var _0x4e4f17=_[_0x82d2('0x4f')](_[_0x82d2('0x50')](_0x36ba8a),['ListId',_0x82d2('0x51'),'createdAt',_0x82d2('0x36')]);return squel['insert']()['into'](_0x82d2('0x3a'))['fromQuery'](_0x4e4f17,squel[_0x82d2('0xd')]()['fields'](_0x4e4f17)[_0x82d2('0x10')](_0x435bd7)[_0x82d2('0x12')]('('+_0x41d60f[_0x82d2('0x14')](',')+_0x82d2('0x52'),squel[_0x82d2('0xd')]()[_0x82d2('0x42')](_0x41d60f)[_0x82d2('0x10')](_0x82d2('0x3a'))[_0x82d2('0x12')](_0x82d2('0x45'),_0x5ea1c6))['where'](_0x82d2('0x53'),squel[_0x82d2('0xd')]()[_0x82d2('0xe')](_0x82d2('0x54'),_0x82d2('0x55'))[_0x82d2('0x10')](_0x435bd7)[_0x82d2('0x56')](_0x41d60f[_0x82d2('0x14')](','))))[_0x82d2('0x3f')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x56d84b){logger[_0x82d2('0x20')](_0x56d84b['message']);process[_0x82d2('0x57')](0x1);}function handleError(_0x351104,_0x2522e0){stats[_0x82d2('0x58')]['push']({'name':_0x2522e0['code'],'message':_0x2522e0['message'],'row':_0x351104});}function handleQuery(_0x38d51a){logger['info'](_0x38d51a);return db[_0x82d2('0x15')][_0x82d2('0x16')](_0x38d51a)[_0x82d2('0x18')](function(_0x47eaca){results[_0x82d2('0x1c')](_0x47eaca);})[_0x82d2('0x1f')](function(_0x507049){logger[_0x82d2('0x20')](_0x507049[_0x82d2('0x59')]);});}function main(_0x3fdfff,_0x14ca69,_0x35defe,_0x8e28a4){logger['info'](_0x82d2('0x5a'),_0x3fdfff,JSON['stringify'](_0x14ca69));process[_0x82d2('0x5b')](_0x82d2('0x5c'));var _0xa3ef37=_0x14ca69[_0x82d2('0x5d')];var _0x486e53=_[_0x82d2('0x5e')](_0xa3ef37);var _0x1e6dd2=_0x14ca69[_0x82d2('0x5f')];var _0x5581cd=path[_0x82d2('0x14')](config['root'],_0x82d2('0x60'),_0x1e6dd2+_0x82d2('0x61'));logger['info'](_0x82d2('0x62'),_0x14ca69);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x82d2('0x63')]})[_0x82d2('0x1e')](function(_0x2f96b5){for(var _0x23bcab=0x0;_0x23bcab<_0x2f96b5[_0x82d2('0x19')];_0x23bcab++){if(_0x2f96b5[_0x23bcab]['name']in _0xa3ef37){contactItemTypes[_0x82d2('0x1c')](_0x2f96b5[_0x23bcab]);delete _0x486e53[_0x2f96b5[_0x23bcab]['name']];hasAdditionalPhones=!![];}for(var _0x1d842c in _0xa3ef37){if(_0x2f96b5[_0x23bcab][_0x82d2('0x63')]+_0x82d2('0x64')===_0x1d842c){phoneDescriptions['push']({'itemTypeId':_0x2f96b5[_0x23bcab]['id'],'description':_0x1d842c});delete _0x486e53[_0x1d842c];}}}if(hasAdditionalPhones)_0x486e53[_0x82d2('0x1b')]='';var _0x32463b=_[_0x82d2('0x50')](_0x486e53)[_0x82d2('0x14')]();logger[_0x82d2('0x65')]('header',_0x32463b);fs['writeFileSync'](_0x5581cd,_0x32463b+'\x0a');Papa[_0x82d2('0x66')](fs[_0x82d2('0x67')](_0x3fdfff),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5b1d0e,_0x5f2033){try{for(var _0x2ef5e1=0x0,_0x1040b2=[];_0x2ef5e1<_0x5b1d0e['data'][_0x82d2('0x19')];_0x2ef5e1++){stats[_0x82d2('0x68')]+=0x1;if(_0x5b1d0e['errors'][_0x2ef5e1]){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],_0x5b1d0e[_0x82d2('0x58')][_0x2ef5e1]);}else{var _0x37da2b=[];var _0x3a4473=[];var _0x44ab84={};for(var _0x7f6398 in _0xa3ef37){let _0x5722b2=contactItemTypes[_0x82d2('0x6a')](_0x5b7662=>_0x5b7662[_0x82d2('0x63')]===_0x7f6398);let _0x528ff5=contactItemTypes[_0x82d2('0x6a')](_0x39fc59=>_0x39fc59['name']+_0x82d2('0x64')===_0x7f6398);if(_[_0x82d2('0x1a')](_0x5722b2)&&_['isNil'](_0x528ff5)){if(_0xa3ef37[_0x82d2('0x6b')](_0x7f6398)){if(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1][_0xa3ef37[_0x7f6398]]){var _0x3d7887=_[_0x82d2('0x6c')](_0x5b1d0e['data'][_0x2ef5e1][_0xa3ef37[_0x7f6398]]['replace'](/"/g,'\x27'));switch(_0x7f6398){case _0x82d2('0x32'):var _0x13c36a=moment(_0x3d7887,_0x82d2('0x6d'),!![]);if(_0x13c36a['isValid']()){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b[_0x82d2('0x1c')](_0x82d2('0x6e'));}break;case _0x82d2('0x37'):var _0x252895=parseInt(_0x3d7887);_0x3d7887=_[_0x82d2('0x6f')](_0x252895)||_0x252895<0x0||_0x252895>0x4?_0x8e28a4?0x3:0x2:_0x252895;_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');break;case _0x82d2('0x38'):var _0x485174=parseInt(_0x3d7887);if(_[_0x82d2('0x70')](_0x485174)&&_[_0x82d2('0x71')](_0x35defe,_0x485174)){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x485174+'\x22');}else{_0x37da2b[_0x82d2('0x1c')](_0x82d2('0x72'));}break;case _0x82d2('0x73'):if(isEmail(_0x3d7887)){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b['push'](_0x82d2('0x74'));}break;case _0x82d2('0x75'):var _0x4891e4=moment(_0x3d7887,_0x82d2('0x76'),!![]);if(_0x4891e4[_0x82d2('0x77')]()){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}else{_0x37da2b['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3d7887+'\x22');}}else{switch(_0x7f6398){case'firstName':case _0x82d2('0xf'):_0x37da2b[_0x82d2('0x1c')](_0x7f6398+_0x82d2('0x78'));break;default:_0x1040b2[_0x82d2('0x1c')]('\x22\x22');}}}}else{var _0x373098='';if(!_[_0x82d2('0x1a')](_0x5722b2)){if(!_0x44ab84[_0x82d2('0x6b')](_0x5722b2['id'])){for(var _0x2711c2=0x0;_0x2711c2<_0xa3ef37[_0x7f6398][_0x82d2('0x19')];_0x2711c2++){var _0x3d7887=_['trim'](_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1][_0xa3ef37[_0x7f6398][_0x2711c2]]['replace'](/"/g,'\x27'));var _0x453cf0=phoneDescriptions[_0x82d2('0x6a')](_0x4df171=>_0x4df171[_0x82d2('0x79')]===_0x5722b2['id']);if(!_[_0x82d2('0x1a')](_0x453cf0)){var _0x1dba8e=_[_0x82d2('0x6c')](_0x5b1d0e['data'][_0x2ef5e1][_0xa3ef37[_0x453cf0[_0x82d2('0x7a')]][0x0]][_0x82d2('0x7b')](/"/g,'\x27'));if(!_[_0x82d2('0x1a')](_0x1dba8e))_0x3d7887=_0x3d7887+'§'+_0x1dba8e;}if(_0x373098=='')_0x373098=_0x3d7887;else _0x373098+='|'+_0x3d7887;}_0x3a4473[_0x82d2('0x1c')](_0x5722b2['id']+':'+_0x373098);_0x44ab84[_0x5722b2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1040b2[_0x82d2('0x1c')]('\x22'+_0x3a4473['join'](';')+'\x22');}if(_0x37da2b[_0x82d2('0x19')]){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],{'code':'SystemRow','message':_0x37da2b[_0x82d2('0x14')]()});}else{fs['appendFileSync'](_0x5581cd,_0x1040b2[_0x82d2('0x14')]()+'\x0a');}_0x1040b2=[];}if(!(stats['rows']%0xc8)){socket[_0x82d2('0x7c')](_0x82d2('0x7d')+_0x1e6dd2,stats);stats['errors']=[];}}if(stopped){logger[_0x82d2('0x65')](_0x82d2('0x7e'));_0x5f2033[_0x82d2('0x7f')]();}}catch(_0xf3e3aa){handleError(_0x5b1d0e[_0x82d2('0x69')][_0x2ef5e1],{'code':'SystemError','message':_0xf3e3aa[_0x82d2('0x59')]});logger[_0x82d2('0x20')]('step',_0xf3e3aa['message']);}},'complete':function(){try{var _0x379aa5=[];var _0x2ce529=tempTableName;_0x379aa5['push'](_0x82d2('0x80')+_0x2ce529+_0x82d2('0x81'));logger['info'](_0x82d2('0x82'),contactItemTypes[_0x82d2('0x19')]);var _0x4ec03b=util[_0x82d2('0xa')](_0x82d2('0x83'),_0x5581cd,_0x2ce529,_0x32463b,_0x14ca69[_0x82d2('0x34')],_0x14ca69['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xa3ef37['scheduledat'])){_0x4ec03b+=',\x20scheduledAt\x20=\x20NOW()';}_0x379aa5['push'](_0x4ec03b);BPromise['each'](_0x379aa5,handleQuery)[_0x82d2('0x1e')](function(_0x2d03b6){BPromise[_0x82d2('0x1d')]([handleAdditionalPhones()])[_0x82d2('0x1e')](function(){_0x379aa5=[];for(var _0x197cc0=0x0;_0x197cc0\x20\x20','root','binding','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','squel','ioredis','../../../config/logger','import','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','phone','AdditionalPhones','push','catch','message','split','all','then','filter','CmContactHasItem','findOne','updated','create','inserted','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','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','\x22onlyIfOpen\x22','toString','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','query','main','stringify','start','clone','socket_timestamp','server/files/tmp','.csv','ContactItemType','findAll','name','_description','keys','writeFileSync','parse','data','rows','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x2884,0x1eb));var _0x4288=function(_0x5bef39,_0x12095f){_0x5bef39=_0x5bef39-0x0;var _0x132ed8=_0x2884[_0x5bef39];return _0x132ed8;};'use strict';var fs=require('fs');var path=require(_0x4288('0x0'));var _=require('lodash');var Papa=require(_0x4288('0x1'));var util=require(_0x4288('0x2'));var BPromise=require(_0x4288('0x3'));var moment=require('moment');var squel=require(_0x4288('0x4'));var Redis=require(_0x4288('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x4288('0x6'))(_0x4288('0x7'));config[_0x4288('0x8')]=_['defaults'](config['redis'],{'host':_0x4288('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4288('0x8')]));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()[_0x4288('0xa')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x4288('0xb')+moment()[_0x4288('0xa')](_0x4288('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x55c9ee){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'](_0x55c9ee);}function selectNotIn(_0x5c0e2d,_0x42a234,_0x7095f1,_0x2345d5,_0x2445eb){return squel[_0x4288('0xd')]()[_0x4288('0xe')]('phone')[_0x4288('0xf')](_0x2345d5)[_0x4288('0x10')](_0x42a234,null,_0x42a234+_0x4288('0x11')+_0x2345d5+'.'+_0x7095f1)[_0x4288('0x12')](_0x2345d5+'.'+_0x7095f1+'\x20=\x20'+_0x5c0e2d+'.'+_0x7095f1)[_0x4288('0x12')](_0x42a234+_0x4288('0x13')+_0x2445eb['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1782d2,_0x50a473){promisesAdditionalPhones=[];promisesContact=[];return db[_0x4288('0x14')]['query'](_0x4288('0x15')+tempTableName)[_0x4288('0x16')](function(_0x183c70){if(_0x183c70!==null){var _0x17afda=[];for(var _0xe24ccb=0x0;_0xe24ccb<_0x183c70[_0x4288('0x17')];_0xe24ccb++){var _0xb73bf5=_0x183c70[_0xe24ccb];if(!_[_0x4288('0x18')](_0xb73bf5[_0x4288('0x19')])){if(!_['isNil'](_0xb73bf5[_0x4288('0x1a')]))_0x17afda[_0x4288('0x1b')](insertAdditionalPhones(_0xb73bf5));promisesContact['push']({'contact':_0xb73bf5});}}}Promise['all'](_0x17afda)['then'](function(){_0x1782d2({'val':0x1});});})[_0x4288('0x1c')](function(_0x259f0a){logger['error'](_0x259f0a[_0x4288('0x1d')]);});});}function insertAdditionalPhones(_0x51d472){return new Promise(function(_0x865365,_0x2ebdf4){var _0xcedf50=_0x51d472['AdditionalPhones'];if(_[_0x4288('0x18')](_0xcedf50))_0x2ebdf4({'val':0x0});else{var _0x3547c1=_0xcedf50[_0x4288('0x1e')](';');var _0x4b9cda=[];orderBy=0x0;for(var _0x4fc547=0x0;_0x4fc547<_0x3547c1[_0x4288('0x17')];_0x4fc547++){_0x4b9cda[_0x4288('0x1b')](splitAdditionalPhone(_0x51d472['id'],_0x3547c1[_0x4fc547]));}Promise[_0x4288('0x1f')](_0x4b9cda)[_0x4288('0x20')](function(){_0x865365({'val':_0x3547c1[_0x4288('0x17')]});});}});}function splitAdditionalPhone(_0x292e74,_0x500c1e){return new Promise(function(_0x5f0c29,_0x1ff415){var _0xa3d2df=_0x500c1e['split'](':');var _0x43b76c=_0xa3d2df[0x0];var _0x54e6a8=_0xa3d2df[0x1];if(_0x54e6a8!==''){var _0x501fcb=_0x54e6a8[_0x4288('0x1e')]('|');var _0x1ac7b3=[];for(var _0x1b2d6c=0x0;_0x1b2d6c<_0x501fcb['length'];_0x1b2d6c++){if(_0x501fcb[_0x1b2d6c]!==''){var _0xcd16d3=_[_0x4288('0x21')](promisesAdditionalPhones,{'contactId':_0x292e74,'phone':_0x501fcb[_0x1b2d6c]});if(_0xcd16d3[_0x4288('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x4288('0x1b')]({'contactId':_0x292e74,'contactTypeId':_0x43b76c,'phone':_0x501fcb[_0x1b2d6c],'orderBy':orderBy});}}}_0x5f0c29({'ok':0x1});}else _0x5f0c29({'res':0x0});});}function createAdditionalPhone(_0x29e9ad,_0xf7f6d6,_0x4cc8bd,_0x3a8e3e){var _0x29a0e5='';var _0x46a537='';var _0x200af1=_0x4cc8bd[_0x4288('0x1e')]('§');_0x29a0e5=_0x200af1[0x0];if(_0x200af1[_0x4288('0x17')]==0x2)_0x46a537=_0x200af1[0x1];return new Promise(function(_0x41f53e,_0x5bca41){return db[_0x4288('0x22')][_0x4288('0x23')]({'where':{'CmContactId':_0x29e9ad,'item':_0x29a0e5}})[_0x4288('0x20')](function(_0x2881ef){if(_0x2881ef){return db[_0x4288('0x22')]['update']({'ItemTypeId':_0xf7f6d6,'description':_0x46a537,'OrderBy':_0x3a8e3e},{'where':{'CmContactId':_0x29e9ad,'item':_0x29a0e5}})[_0x4288('0x20')](function(_0x208b57){_0x41f53e({'res':_0x4288('0x24')});});}else{return db[_0x4288('0x22')][_0x4288('0x25')]({'CmContactId':_0x29e9ad,'item':_0x29a0e5,'ItemTypeId':_0xf7f6d6,'description':_0x46a537,'OrderBy':_0x3a8e3e,'ItemClass':'PHONE'})[_0x4288('0x20')](function(_0x2e3f21){_0x41f53e({'res':_0x4288('0x26')});});}});});}function updateContact(_0x2b39fe){return new Promise(function(_0x5721e8,_0x25147b){var _0x211a21=_0x2b39fe['id'];delete _0x2b39fe['id'];return db[_0x4288('0x27')][_0x4288('0x28')](_0x2b39fe,{'where':{'id':_0x211a21}})['then'](function(_0x911af4){updatedRows+=0x1;return db[_0x4288('0x29')][_0x4288('0x28')]({'phone':_0x2b39fe[_0x4288('0x19')]},{'where':{'ContactId':_0x211a21}})[_0x4288('0x20')](function(_0xca782f){_0x5721e8({'ret':'OK'});});});});}function insertCmHopper(_0x566763,_0x2ca3f4,_0x4be5d8,_0x498902,_0x4b4236){var _0x49c2d6=[_0x4288('0x2a'),_0x4288('0x2b'),_0x4288('0x2c'),_0x4288('0x2d'),_0x2ca3f4+'.'+_0x498902,_0x4288('0x2e'),_0x4288('0x2f'),'cm_contacts.priority',_0x4288('0x30'),'\x22'+_0x4b4236+'\x22'];return squel[_0x4288('0x31')]()[_0x4288('0x32')](_0x4288('0x33'))[_0x4288('0x34')]([_0x4288('0x19'),_0x4288('0x35'),_0x4288('0x36'),_0x4288('0x37'),_0x498902,_0x4288('0x38'),_0x4288('0x39'),_0x4288('0x3a'),_0x4288('0x3b'),_0x4288('0x3c')],squel[_0x4288('0xd')]()[_0x4288('0x3d')](_0x49c2d6)[_0x4288('0xf')](_0x2ca3f4)['join'](_0x4288('0x3e'),null,_0x4288('0x3f')+_0x2ca3f4+_0x4288('0x40'))['join'](_0x4be5d8,null,_0x4be5d8+_0x4288('0x11')+_0x2ca3f4+'.'+_0x498902)[_0x4288('0x12')](_0x2ca3f4+_0x4288('0x41'),_0x566763)['where'](_0x4288('0x42'),NOW)[_0x4288('0x12')](_0x4288('0x43'),selectNotIn(_0x2ca3f4,_0x4be5d8,_0x498902,_0x4288('0x33'),[_0x4288('0x44'),_0x4288('0x45')]))[_0x4288('0x12')](_0x4288('0x43'),selectNotIn(_0x2ca3f4,_0x4be5d8,_0x498902,_0x4288('0x33'),[_0x4288('0x44')])))[_0x4288('0x46')]();}function insertCmHopperBlack(_0x314ff4,_0x25b564,_0x4a0ae7,_0x26ddea){var _0x35906e=[_0x4288('0x2a'),_0x4288('0x2c'),'cm_contacts.ListId',_0x25b564+'.'+_0x26ddea,_0x4288('0x2e'),'cm_contacts.updatedAt'];return squel[_0x4288('0x31')]()[_0x4288('0x32')](_0x4288('0x47'))[_0x4288('0x34')]([_0x4288('0x19'),_0x4288('0x36'),_0x4288('0x37'),_0x26ddea,_0x4288('0x38'),_0x4288('0x39')],squel[_0x4288('0xd')]()[_0x4288('0x3d')](_0x35906e)[_0x4288('0xf')](_0x25b564)[_0x4288('0x10')](_0x4288('0x3e'),null,_0x4288('0x3f')+_0x25b564+_0x4288('0x40'))[_0x4288('0x10')](_0x4a0ae7,null,_0x4a0ae7+_0x4288('0x11')+_0x25b564+'.'+_0x26ddea)[_0x4288('0x12')](_0x25b564+_0x4288('0x41'),_0x314ff4)[_0x4288('0x12')](_0x4288('0x42'),NOW)['where'](_0x4288('0x43'),squel[_0x4288('0xd')]()['field'](_0x4288('0x19'))[_0x4288('0xf')]('cm_hopper_black')[_0x4288('0x12')](_0x4288('0x48'),_0x314ff4)[_0x4288('0x12')](_0x26ddea+_0x4288('0x49'),_0x25b564+'.'+_0x26ddea)))[_0x4288('0x46')]();}function insertCmHopperAdditionalPhones(_0x1a870b){var _0x2fda48=['cm_hopper.id',_0x4288('0x4a'),_0x4288('0x4b'),_0x4288('0x4c'),_0x4288('0x4d')];return squel[_0x4288('0x31')]()[_0x4288('0x32')](_0x4288('0x4e'))[_0x4288('0x34')]([_0x4288('0x4f'),'phone',_0x4288('0x50'),'createdAt',_0x4288('0x39')],squel['select']()['fields'](_0x2fda48)[_0x4288('0xf')](_0x4288('0x33'))[_0x4288('0x10')](_0x4288('0x3e'),null,_0x4288('0x51'))[_0x4288('0x10')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x4288('0x52'),_0x1a870b)['where'](_0x4288('0x42'),NOW))[_0x4288('0x46')]();}function insertCmContact(_0x3f319a,_0x437af3,_0x145dd9,_0x25f67b){var _0x23af31=_[_0x4288('0x53')](_['keys'](_0x25f67b),[_0x4288('0x37'),_0x4288('0x54'),_0x4288('0x38'),'updatedAt']);return squel[_0x4288('0x31')]()[_0x4288('0x32')](_0x4288('0x3e'))[_0x4288('0x34')](_0x23af31,squel[_0x4288('0xd')]()['fields'](_0x23af31)[_0x4288('0xf')](_0x437af3)['where']('('+_0x145dd9['join'](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x4288('0x3d')](_0x145dd9)[_0x4288('0xf')]('cm_contacts')[_0x4288('0x12')]('ListId\x20=\x20?',_0x3f319a))['where'](_0x4288('0x55'),squel[_0x4288('0xd')]()[_0x4288('0xe')]('MIN(id)',_0x4288('0x56'))[_0x4288('0xf')](_0x437af3)[_0x4288('0x57')](_0x145dd9[_0x4288('0x10')](','))))[_0x4288('0x46')]();}function handleStop(){logger[_0x4288('0x58')](_0x4288('0x59'));stopped=!![];}function handleUncaughtException(_0x1251e2){logger[_0x4288('0x5a')](_0x1251e2['message']);process[_0x4288('0x5b')](0x1);}function handleError(_0xd6925a,_0x1647de){stats[_0x4288('0x5c')][_0x4288('0x1b')]({'name':_0x1647de[_0x4288('0x5d')],'message':_0x1647de['message'],'row':_0xd6925a});}function handleQuery(_0x3637e9){logger[_0x4288('0x58')](_0x3637e9);return db[_0x4288('0x14')][_0x4288('0x5e')](_0x3637e9)[_0x4288('0x16')](function(_0x192203){results[_0x4288('0x1b')](_0x192203);})[_0x4288('0x1c')](function(_0x44a419){logger[_0x4288('0x5a')](_0x44a419[_0x4288('0x1d')]);});}function main(_0x362a68,_0x13e74c,_0x595996,_0x52e991){logger['info'](_0x4288('0x5f'),_0x362a68,JSON[_0x4288('0x60')](_0x13e74c));process['send'](_0x4288('0x61'));var _0x471709=_0x13e74c['binding'];var _0x2e38af=_[_0x4288('0x62')](_0x471709);var _0x507241=_0x13e74c[_0x4288('0x63')];var _0x4adb4e=path[_0x4288('0x10')](config['root'],_0x4288('0x64'),_0x507241+_0x4288('0x65'));logger[_0x4288('0x58')]('body',_0x13e74c);db[_0x4288('0x66')][_0x4288('0x67')]({'raw':!![],'attributes':['id',_0x4288('0x68')]})['then'](function(_0x121157){for(var _0x2bb930=0x0;_0x2bb930<_0x121157['length'];_0x2bb930++){if(_0x121157[_0x2bb930][_0x4288('0x68')]in _0x471709){contactItemTypes['push'](_0x121157[_0x2bb930]);delete _0x2e38af[_0x121157[_0x2bb930][_0x4288('0x68')]];hasAdditionalPhones=!![];}for(var _0x4091e2 in _0x471709){if(_0x121157[_0x2bb930][_0x4288('0x68')]+_0x4288('0x69')===_0x4091e2){phoneDescriptions[_0x4288('0x1b')]({'itemTypeId':_0x121157[_0x2bb930]['id'],'description':_0x4091e2});delete _0x2e38af[_0x4091e2];}}}if(hasAdditionalPhones)_0x2e38af[_0x4288('0x1a')]='';var _0x2a3a71=_[_0x4288('0x6a')](_0x2e38af)[_0x4288('0x10')]();logger[_0x4288('0x58')]('header',_0x2a3a71);fs[_0x4288('0x6b')](_0x4adb4e,_0x2a3a71+'\x0a');Papa[_0x4288('0x6c')](fs['createReadStream'](_0x362a68),{'header':!![],'skipEmptyLines':!![],'step':function(_0x40faca,_0x1be5b1){try{for(var _0x1f93e8=0x0,_0x3e1c5a=[];_0x1f93e8<_0x40faca[_0x4288('0x6d')][_0x4288('0x17')];_0x1f93e8++){stats[_0x4288('0x6e')]+=0x1;if(_0x40faca['errors'][_0x1f93e8]){handleError(_0x40faca[_0x4288('0x6d')][_0x1f93e8],_0x40faca[_0x4288('0x5c')][_0x1f93e8]);}else{var _0x1ca8b5=[];var _0x337722=[];var _0x1df79e={};for(var _0xe69237 in _0x471709){let _0x241397=contactItemTypes['find'](_0x18d95b=>_0x18d95b[_0x4288('0x68')]===_0xe69237);let _0x422812=contactItemTypes[_0x4288('0x6f')](_0x5cbb6a=>_0x5cbb6a[_0x4288('0x68')]+_0x4288('0x69')===_0xe69237);if(_[_0x4288('0x18')](_0x241397)&&_[_0x4288('0x18')](_0x422812)){if(_0x471709['hasOwnProperty'](_0xe69237)){if(_0x40faca[_0x4288('0x6d')][_0x1f93e8][_0x471709[_0xe69237]]){var _0x433e60=_[_0x4288('0x70')](_0x40faca[_0x4288('0x6d')][_0x1f93e8][_0x471709[_0xe69237]][_0x4288('0x71')](/"/g,'\x27'));switch(_0xe69237){case _0x4288('0x35'):var _0x24d568=moment(_0x433e60,_0x4288('0x72'),!![]);if(_0x24d568['isValid']()){_0x3e1c5a[_0x4288('0x1b')]('\x22'+_0x433e60+'\x22');}else{_0x1ca8b5[_0x4288('0x1b')](_0x4288('0x73'));}break;case _0x4288('0x3a'):var _0x3ee4aa=parseInt(_0x433e60);_0x433e60=_[_0x4288('0x74')](_0x3ee4aa)||_0x3ee4aa<0x0||_0x3ee4aa>0x4?_0x52e991?0x3:0x2:_0x3ee4aa;_0x3e1c5a[_0x4288('0x1b')]('\x22'+_0x433e60+'\x22');break;case _0x4288('0x3b'):var _0x1305d4=parseInt(_0x433e60);if(_[_0x4288('0x75')](_0x1305d4)&&_[_0x4288('0x76')](_0x595996,_0x1305d4)){_0x3e1c5a[_0x4288('0x1b')]('\x22'+_0x1305d4+'\x22');}else{_0x1ca8b5['push']('agent\x20not\x20exists');}break;case _0x4288('0x77'):if(isEmail(_0x433e60)){_0x3e1c5a[_0x4288('0x1b')]('\x22'+_0x433e60+'\x22');}else{_0x1ca8b5['push'](_0x4288('0x78'));}break;case'dateOfBirth':var _0x38129d=moment(_0x433e60,_0x4288('0x79'),!![]);if(_0x38129d[_0x4288('0x7a')]()){_0x3e1c5a['push']('\x22'+_0x433e60+'\x22');}else{_0x1ca8b5[_0x4288('0x1b')](_0x4288('0x7b'));}break;default:_0x3e1c5a[_0x4288('0x1b')]('\x22'+_0x433e60+'\x22');}}else{switch(_0xe69237){case _0x4288('0x7c'):case _0x4288('0x19'):_0x1ca8b5[_0x4288('0x1b')](_0xe69237+_0x4288('0x7d'));break;default:_0x3e1c5a[_0x4288('0x1b')]('\x22\x22');}}}}else{var _0x546ad1='';if(!_[_0x4288('0x18')](_0x241397)){if(!_0x1df79e['hasOwnProperty'](_0x241397['id'])){for(var _0x4a829b=0x0;_0x4a829b<_0x471709[_0xe69237][_0x4288('0x17')];_0x4a829b++){var _0x433e60=_[_0x4288('0x70')](_0x40faca[_0x4288('0x6d')][_0x1f93e8][_0x471709[_0xe69237][_0x4a829b]][_0x4288('0x71')](/"/g,'\x27'));var _0x416bfc=phoneDescriptions[_0x4288('0x6f')](_0x1b55fa=>_0x1b55fa[_0x4288('0x7e')]===_0x241397['id']);if(!_[_0x4288('0x18')](_0x416bfc)){var _0x1e3821=_[_0x4288('0x70')](_0x40faca['data'][_0x1f93e8][_0x471709[_0x416bfc[_0x4288('0x7f')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x4288('0x18')](_0x1e3821))_0x433e60=_0x433e60+'§'+_0x1e3821;}if(_0x546ad1=='')_0x546ad1=_0x433e60;else _0x546ad1+='|'+_0x433e60;}_0x337722[_0x4288('0x1b')](_0x241397['id']+':'+_0x546ad1);_0x1df79e[_0x241397['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3e1c5a['push']('\x22'+_0x337722[_0x4288('0x10')](';')+'\x22');}if(_0x1ca8b5[_0x4288('0x17')]){handleError(_0x40faca[_0x4288('0x6d')][_0x1f93e8],{'code':'SystemRow','message':_0x1ca8b5[_0x4288('0x10')]()});}else{fs[_0x4288('0x80')](_0x4adb4e,_0x3e1c5a['join']()+'\x0a');}_0x3e1c5a=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x4288('0x81')+_0x507241,stats);stats[_0x4288('0x5c')]=[];}}if(stopped){logger['info'](_0x4288('0x82'));_0x1be5b1[_0x4288('0x83')]();}}catch(_0x48a8f4){handleError(_0x40faca[_0x4288('0x6d')][_0x1f93e8],{'code':_0x4288('0x84'),'message':_0x48a8f4['message']});logger[_0x4288('0x5a')](_0x4288('0x85'),_0x48a8f4[_0x4288('0x1d')]);}},'complete':function(){try{var _0xc24703=[];var _0x3f14f1=tempTableName;_0xc24703[_0x4288('0x1b')](_0x4288('0x86')+_0x3f14f1+_0x4288('0x87'));logger[_0x4288('0x58')]('CIS\x20len',contactItemTypes[_0x4288('0x17')]);var _0xf61144=util[_0x4288('0xa')](_0x4288('0x88'),_0x4adb4e,_0x3f14f1,_0x2a3a71,_0x13e74c[_0x4288('0x37')],_0x13e74c[_0x4288('0x54')]||null,NOW,NOW);if(_[_0x4288('0x18')](_0x471709[_0x4288('0x35')])){_0xf61144+=',\x20scheduledAt\x20=\x20NOW()';}_0xc24703[_0x4288('0x1b')](_0xf61144);BPromise['each'](_0xc24703,handleQuery)['then'](function(_0x3c80){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xc24703=[];for(var _0x1666c2=0x0;_0x1666c2\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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','../parsers/advancedSearch','../parsers/qs','updateInteraction','../../mysqldb','getAccountFK','role','search','field','name','from','tools_tags','user_has_','_interactions','select','u.id','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','find','buildExpression','type','default','text','value','start','unreadMessages','read','and','$substring','split','contact','ContactId','end','Tag','clause','tags','ids','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','user','body','some','compact','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','getInteractionFK','Interaction','Sequelize','SELECT'];(function(_0x33d8fc,_0x5cf5ff){var _0x470807=function(_0x37ff84){while(--_0x37ff84){_0x33d8fc['push'](_0x33d8fc['shift']());}};_0x470807(++_0x5cf5ff);}(_0xfc03,0x16f));var _0x3fc0=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xfc03[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0x3fc0('0x0'));var squel=require('squel');var as=require(_0x3fc0('0x1'));var qs=require(_0x3fc0('0x2'));var updateInteraction=require('./update-interaction')[_0x3fc0('0x3')];var utils=require('./utils');var db=require(_0x3fc0('0x4'))['db'];function skipInteractionsQuery(_0x1eeb62,_0x390f7e,_0x29d814){var _0x92a96c=![];var _0x389bfb=utils[_0x3fc0('0x5')](_0x1eeb62);if(_0x390f7e[_0x3fc0('0x6')]==='agent'&&!_0x29d814[_0x3fc0('0x7')]&&!_0x29d814[_0x389bfb]){_0x92a96c=!![];}return _0x92a96c;}function getTagsQuery(){return squel['select']()[_0x3fc0('0x8')]('id')[_0x3fc0('0x8')](_0x3fc0('0x9'))[_0x3fc0('0x8')]('color')[_0x3fc0('0xa')](_0x3fc0('0xb'));}function getUsersQuery(_0xe9d431,_0x43faa8){var _0x16b04c=utils['getInteractionFK'](_0xe9d431);var _0x1f476c=_0x3fc0('0xc')+_0xe9d431+_0x3fc0('0xd');var _0x5e75e8=squel[_0x3fc0('0xe')]()['field'](_0x3fc0('0xf'))[_0x3fc0('0x8')]('u.fullname')[_0x3fc0('0x8')](_0x3fc0('0x10')+_0x16b04c)[_0x3fc0('0xa')](_0x1f476c,'ui')['left_join'](_0x3fc0('0x11'),'u',_0x3fc0('0x12'));if(_0x43faa8[_0x3fc0('0x13')]>0x0){_0x5e75e8[_0x3fc0('0x14')]('ui.'+_0x16b04c+_0x3fc0('0x15'),_[_0x3fc0('0x16')](_0x43faa8,'id'));}return _0x5e75e8;}function getInteractionsQuery(_0x3ef95e){var _0x5b59f1=utils[_0x3fc0('0x17')](_0x3ef95e);var _0x491446=utils[_0x3fc0('0x5')](_0x3ef95e);var _0x3c5026=utils['getInteractionFK'](_0x3ef95e);return squel[_0x3fc0('0xe')]()[_0x3fc0('0xa')](_0x5b59f1[_0x3fc0('0x18')],'i')[_0x3fc0('0x19')](_0x3fc0('0x1a'),'c',_0x3fc0('0x1b'))[_0x3fc0('0x19')](_0x3fc0('0x11'),'o',_0x3fc0('0x1c'))['left_join'](_0x5b59f1[_0x3fc0('0x1d')],'a',_0x3fc0('0x1e')+_0x491446)[_0x3fc0('0x19')](_0x5b59f1[_0x3fc0('0x1f')],'me',_0x3fc0('0x20')+_0x3c5026+_0x3fc0('0x21'))['left_join'](_0x5b59f1[_0x3fc0('0x22')],'it',_0x3fc0('0x23')+_0x3c5026+_0x3fc0('0x21'))[_0x3fc0('0x19')](_0x3fc0('0xb'),'t',_0x3fc0('0x24'));}function getSqlClauses(){var _0x2f423e={'body':squel[_0x3fc0('0x25')](),'contact':squel[_0x3fc0('0x25')](),'default':squel[_0x3fc0('0x25')](),'fields':squel[_0x3fc0('0x25')](),'filter':squel[_0x3fc0('0x25')](),'read':squel[_0x3fc0('0x25')](),'tags':{'clause':squel[_0x3fc0('0x25')](),'ids':null},'user':squel[_0x3fc0('0x25')]()};return _0x2f423e;}function parseTagParameter(_0xbec5b5){var _0x4f5111=squel[_0x3fc0('0x25')]();if(_0xbec5b5){var _0x1b539b=utils[_0x3fc0('0x26')](_0xbec5b5);_0x1b539b[_0x3fc0('0x27')](function(_0x5a9179){_0x4f5111['or'](_0x3fc0('0x28'),'%,'+_0x5a9179+',%');});}return _0x4f5111;}function parseReadParameter(_0x197dfa){var _0x126515='';if(_0x197dfa){_0x126515=_0x3fc0('0x29');if(_0x197dfa==='1'){_0x126515=_0x126515['replace'](_0x3fc0('0x2a'),'=');}else{_0x126515=_0x126515[_0x3fc0('0x2b')](_0x3fc0('0x2a'),'>');}}return _0x126515;}function parseSearchFilter(_0xac736c,_0x29aa32){var _0x244af1=squel['expr']();if(_0x29aa32){var _0xd9ecae=_0x29aa32[_0x3fc0('0x2b')]('\x5c','\x5c\x5c')[_0x3fc0('0x2b')](/'/g,'\x27\x27');if(qs[_0x3fc0('0x2c')](_0xd9ecae)){_0x244af1['or'](_0x3fc0('0x2d'),_0xd9ecae+'%');if([_0x3fc0('0x2e'),_0x3fc0('0x2f')][_0x3fc0('0x30')](_0xac736c)){_0x244af1['or']('i.phone\x20LIKE\x20?',_0xd9ecae+'%');}else if(_0xac736c==='fax'){_0x244af1['or'](_0x3fc0('0x31'),_0xd9ecae+'%');}else if(_0xac736c==='openchannel'){_0x244af1['or'](_0x3fc0('0x32'),_0xd9ecae+'%');}}else if(_0xac736c===_0x3fc0('0x33')&&qs[_0x3fc0('0x34')](_0xd9ecae)){_0x244af1['or'](_0x3fc0('0x35'),_0xd9ecae+'%');}else{if(_0xac736c===_0x3fc0('0x33')){_0x244af1['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xd9ecae))['or'](_0x3fc0('0x36'),qs[_0x3fc0('0x37')](_0xd9ecae));}else{if(_0xac736c!==_0x3fc0('0x38')){_0x244af1['or'](_0x3fc0('0x39'),qs[_0x3fc0('0x37')](_0xd9ecae));}_0x244af1['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xd9ecae+'%');}}}return _0x244af1;}function parseAdvancedSearchFilter(_0xe1279a,_0x1f19e8){var _0x399c9c=getSqlClauses();var _0x4db60d=as[_0x3fc0('0x3a')](_0xe1279a);var _0x4279c0=_0x4db60d[_0x3fc0('0x3b')];for(var _0x2eee6e=0x0;_0x2eee6e<_0x4db60d['conditions'][_0x3fc0('0x13')];_0x2eee6e++){var _0x19cf58=_0x4db60d['conditions'][_0x2eee6e];var _0x297943='i';var _0x5179e3=_[_0x3fc0('0x3c')](_0x1f19e8,[_0x3fc0('0x9'),_0x19cf58[_0x3fc0('0x8')]]);if(_0x5179e3){var _0x2db02e=as[_0x3fc0('0x3d')](_0x297943,_0x5179e3[_0x3fc0('0x3e')],_0x19cf58);_0x399c9c[_0x3fc0('0x3f')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x42')],_0x2db02e[_0x3fc0('0x41')]['end']);}else{switch(_0x19cf58[_0x3fc0('0x8')]){case _0x3fc0('0x43'):var _0x2af7c6=parseReadParameter(_0x19cf58[_0x3fc0('0x41')]);_0x399c9c[_0x3fc0('0x44')][_0x3fc0('0x45')](_0x2af7c6);break;case'Contact':if(_0x19cf58['operator']===_0x3fc0('0x46')){if(_0x19cf58[_0x3fc0('0x41')][_0x3fc0('0x47')]('\x20')[_0x3fc0('0x13')]>0x1){_0x399c9c[_0x3fc0('0x48')][_0x4279c0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x19cf58['value']),null);}else{var _0x1bc6ad='%'+_0x19cf58[_0x3fc0('0x41')]+'%';_0x399c9c[_0x3fc0('0x48')][_0x4279c0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1bc6ad,_0x1bc6ad,_0x1bc6ad);}}else{_0x5179e3=_['find'](_0x1f19e8,[_0x3fc0('0x9'),_0x3fc0('0x49')]);_0x19cf58[_0x3fc0('0x8')]=_0x3fc0('0x49');_0x2db02e=as['buildExpression'](_0x297943,_0x5179e3['type'],_0x19cf58);_0x399c9c[_0x3fc0('0x48')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e['value'][_0x3fc0('0x42')],_0x2db02e['value'][_0x3fc0('0x4a')]);}break;case _0x3fc0('0x4b'):var _0x33af75=_0x19cf58[_0x3fc0('0x41')][_0x3fc0('0x47')](',')[_0x3fc0('0x16')](function(_0x80dfee){return Number(_0x80dfee);});var _0x1b3b70=parseTagParameter(_0x33af75);_0x399c9c['tags'][_0x3fc0('0x4c')]['and'](_0x1b3b70);_0x399c9c[_0x3fc0('0x4d')][_0x3fc0('0x4e')]=_0x33af75;break;case _0x3fc0('0x4f'):if(_0x19cf58[_0x3fc0('0x50')]===_0x3fc0('0x46')){_0x399c9c['user'][_0x4279c0](_0x3fc0('0x51'),'%'+_0x19cf58[_0x3fc0('0x41')]+'%',null);}else{_0x5179e3=_[_0x3fc0('0x3c')](_0x1f19e8,[_0x3fc0('0x9'),'UserId']);_0x19cf58[_0x3fc0('0x8')]='UserId';_0x2db02e=as[_0x3fc0('0x3d')](_0x297943,_0x5179e3[_0x3fc0('0x3e')],_0x19cf58);_0x399c9c[_0x3fc0('0x52')][_0x4279c0](_0x2db02e[_0x3fc0('0x40')],_0x2db02e[_0x3fc0('0x41')]['start'],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x4a')]);}break;case _0x3fc0('0x53'):case'plainBody':_0x2db02e=as[_0x3fc0('0x3d')]('me',null,_0x19cf58);_0x399c9c[_0x3fc0('0x53')][_0x4279c0](_0x2db02e['text'],_0x2db02e[_0x3fc0('0x41')][_0x3fc0('0x42')],_0x2db02e[_0x3fc0('0x41')]['end']);break;}}}return _0x399c9c;}function parseModelFields(_0x5e5c73,_0x3a35ac,_0xa3de5a){var _0xb70836=utils['getAccountFK'](_0x5e5c73);var _0x1d6844=squel['expr']();var _0x40dbf3=_(_0x3a35ac)['keys']()['map'](function(_0x5be8cc){return _[_0x3fc0('0x54')](_0xa3de5a,[_0x3fc0('0x9'),_0x5be8cc])?_0x5be8cc:undefined;})[_0x3fc0('0x55')]()[_0x3fc0('0x41')]();if(_0x40dbf3[_0x3fc0('0x13')]>0x0){_0x40dbf3[_0x3fc0('0x27')](function(_0x4fa770){if(_0x4fa770===_0xb70836){_0x1d6844[_0x3fc0('0x45')]('i.'+_0xb70836+_0x3fc0('0x15'),[]['concat'](_0x3a35ac[_0x4fa770]));}else if(_0x4fa770==='createdAt'){var _0x74ae6a=JSON[_0x3fc0('0x56')](_0x3a35ac[_0x4fa770])[_0x3fc0('0x57')];var _0x31b981=JSON[_0x3fc0('0x56')](_0x3a35ac[_0x4fa770])[_0x3fc0('0x58')];_0x1d6844[_0x3fc0('0x45')](_0x3fc0('0x59'),_0x74ae6a,_0x31b981);}else{if(_0x3a35ac[_0x4fa770]===_0x3fc0('0x5a')){_0x1d6844[_0x3fc0('0x45')]('i.'+_0x4fa770+_0x3fc0('0x5b'));}else{_0x1d6844[_0x3fc0('0x45')]('i.'+_0x4fa770+'\x20=\x20?',_0x3a35ac[_0x4fa770]);}}});}return _0x1d6844;}function parseQueryParameters(_0x24be72,_0xda5d3e,_0x24ee40){var _0x1dfd2c=getSqlClauses();return Promise[_0x3fc0('0x5c')]()['then'](function(){return parseModelFields(_0x24be72,_0xda5d3e,_0x24ee40);})[_0x3fc0('0x5d')](function(_0x57b6d0){_0x1dfd2c[_0x3fc0('0x5e')][_0x3fc0('0x45')](_0x57b6d0);return parseReadParameter(_0xda5d3e[_0x3fc0('0x44')]);})[_0x3fc0('0x5d')](function(_0x519973){_0x1dfd2c[_0x3fc0('0x44')][_0x3fc0('0x45')](_0x519973);return parseTagParameter(_0xda5d3e[_0x3fc0('0x5f')]);})[_0x3fc0('0x5d')](function(_0xe7f024){_0x1dfd2c[_0x3fc0('0x4d')]['clause'][_0x3fc0('0x45')](_0xe7f024);return parseSearchFilter(_0x24be72,_0xda5d3e[_0x3fc0('0x60')]);})[_0x3fc0('0x5d')](function(_0x21c46f){_0x1dfd2c[_0x3fc0('0x60')]=_0x21c46f;return _0x1dfd2c;});}function checkAccountsRestrictions(_0x737d45,_0x5b9b40,_0x14240b){var _0x258a27=utils[_0x3fc0('0x5')](_0x737d45);var _0x5a3732=_0x3fc0('0x61')+_[_0x3fc0('0x62')](_0x737d45)+(_0x737d45===_0x3fc0('0x63')?_0x3fc0('0x64'):_0x3fc0('0x65'));var _0x30bd70=squel[_0x3fc0('0x25')]();return Promise[_0x3fc0('0x5c')]()[_0x3fc0('0x5d')](function(){if(_0x14240b[_0x3fc0('0x7')]&&_0x5b9b40[_0x3fc0('0x6')]===_0x3fc0('0x66')){return _0x5b9b40[_0x5a3732]({'attributes':['id'],'raw':!![]});}})[_0x3fc0('0x5d')](function(_0x25d6d7){if(_0x25d6d7){if(_0x25d6d7[_0x3fc0('0x13')]===0x0){_0x30bd70['and']('i.'+_0x258a27+_0x3fc0('0x5b'));}else{_0x30bd70[_0x3fc0('0x45')]('i.'+_0x258a27+_0x3fc0('0x15'),_[_0x3fc0('0x16')](_0x25d6d7,'id'));}}else if(!_0x14240b[_0x258a27]){_0x30bd70[_0x3fc0('0x45')]('i.'+_0x258a27+_0x3fc0('0x67'));}})[_0x3fc0('0x5d')](function(){return _0x30bd70;});}function getClosedOrderClause(_0x84ec78,_0x1c7d11){var _0x2b9226='';var _0x5a9ad5=[_0x3fc0('0x68'),_0x3fc0('0x69'),_0x3fc0('0x6a')];if(_0x84ec78===_0x3fc0('0x33')){_0x5a9ad5[_0x3fc0('0x6b')](_0x3fc0('0x6c'));}if(_0x1c7d11['closed']==='0'&&_0x84ec78===_0x3fc0('0x33')){_0x2b9226=_0x3fc0('0x6c');}else{if(_0x1c7d11[_0x3fc0('0x6d')]==='1'){_0x5a9ad5['shift']();}_0x2b9226=_0x3fc0('0x6e')+_0x5a9ad5[_0x3fc0('0x6f')](',\x20')+')';}return _0x2b9226;}function getFilteredInteractions(_0x2f8b6b,_0x105df2,_0x11b3f5,_0x12758a){var _0x5b9161=utils[_0x3fc0('0x70')](_0x2f8b6b);var _0x139971=_['capitalize'](_0x2f8b6b)+_0x3fc0('0x71');var _0x16cd67=[];var _0x11468e=getTagsQuery();var _0x3d7073={'type':db[_0x3fc0('0x72')]['QueryTypes'][_0x3fc0('0x73')],'raw':!![]};var _0x42c1ee=[];var _0x138436=[];return db[_0x3fc0('0x74')][_0x3fc0('0x75')](_0x11468e[_0x3fc0('0x76')](),_0x3d7073)[_0x3fc0('0x5d')](function(_0xa9b93c){_0x16cd67=_[_0x3fc0('0x77')](_0xa9b93c,'id');_0x3d7073=_[_0x3fc0('0x78')](_0x3d7073,{'model':db[_0x139971],'mapToModel':!![],'nest':!![]});if(_0x11b3f5[_0x3fc0('0x5e')]){_0x12758a['attributes'][_0x3fc0('0x27')](function(_0x4f667b){_0x105df2[_0x3fc0('0x8')]('i.'+_0x4f667b);});}else{_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x79'),_0x3fc0('0x43'));_0x105df2['field']('a.key',_0x3fc0('0x7a'));_0x105df2[_0x3fc0('0x8')]('a.mandatoryDisposition',_0x3fc0('0x7b'));if(_0x2f8b6b===_0x3fc0('0x33')){_0x105df2['field'](_0x3fc0('0x7c'),_0x3fc0('0x7d'));_0x105df2[_0x3fc0('0x8')]('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',_0x3fc0('0x7e'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x7f'));_0x105df2['field']('i.createdAt');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x80'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x81'));_0x105df2[_0x3fc0('0x8')]('i.closedAt');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x82'));_0x105df2[_0x3fc0('0x8')]('i.lastMsgAt');_0x105df2['field'](_0x3fc0('0x83'));_0x105df2['field'](_0x3fc0('0x84'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x6a'));_0x105df2[_0x3fc0('0x8')]('i.secondDisposition');_0x105df2['field'](_0x3fc0('0x68'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x6c'));_0x105df2[_0x3fc0('0x8')]('i.to');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x85'));_0x105df2['field'](_0x3fc0('0x86'));_0x105df2['field'](_0x3fc0('0x87'));}else if(_0x2f8b6b===_0x3fc0('0x88')){_0x105df2['field'](_0x3fc0('0x89'),_0x3fc0('0x7e'));}else{_0x105df2[_0x3fc0('0x8')]('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',_0x3fc0('0x7e'));}if(_0x2f8b6b!==_0x3fc0('0x33')){_0x105df2['field']('i.*');}_0x105df2[_0x3fc0('0x8')]('c.firstName',_0x3fc0('0x8a'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x8b'),_0x3fc0('0x8c'));_0x105df2['field'](_0x3fc0('0x8d'),_0x3fc0('0x8e'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x8f'),_0x3fc0('0x90'));_0x105df2['field'](_0x3fc0('0x91'),'Contact.mobile');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x92'),_0x3fc0('0x93'));_0x105df2[_0x3fc0('0x8')]('o.fullname','Owner.fullname');_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x94'),_0x3fc0('0x95'));_0x105df2[_0x3fc0('0x8')](_0x3fc0('0x96'),'TagIds');}if(_0x12758a[_0x3fc0('0x97')]){_0x105df2[_0x3fc0('0x97')](_0x12758a[_0x3fc0('0x97')]);}if(_0x12758a[_0x3fc0('0x98')]){_0x105df2[_0x3fc0('0x98')](_0x12758a[_0x3fc0('0x98')]);}return db['sequelize'][_0x3fc0('0x75')](_0x105df2[_0x3fc0('0x76')](),_0x3d7073);})['then'](function(_0xb6dd6d){_0x42c1ee=_0xb6dd6d;var _0x346b98=getUsersQuery(_0x2f8b6b,_0x42c1ee);return db['sequelize'][_0x3fc0('0x75')](_0x346b98[_0x3fc0('0x76')](),_0x3d7073);})[_0x3fc0('0x5d')](function(_0x9a6d45){_0x138436=_[_0x3fc0('0x99')](_0x9a6d45,_0x5b9161);if(_0x2f8b6b===_0x3fc0('0x33')){return db['Setting']['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x2cbdd6){var _0x2d7d37=_0x2cbdd6?_0x2cbdd6[_0x3fc0('0x9a')]:undefined;var _0x119f70=_0x42c1ee[_0x3fc0('0x16')](function(_0x51bd47){return updateInteraction(_0x51bd47,_0x16cd67,_0x138436,_0x2d7d37);});return Promise[_0x3fc0('0x9b')](_0x119f70);});}function countFilteredInteractions(_0xcb2d8f,_0x166278){var _0x18583a=_0xcb2d8f[_0x3fc0('0x9c')]();_0x18583a[_0x3fc0('0x8')](_0x3fc0('0x9d'));_0x18583a[_0x3fc0('0x8')](_0x3fc0('0x79'),_0x3fc0('0x43'));var _0x592c80=utils[_0x3fc0('0x26')](_0x166278);if(!_[_0x3fc0('0x9e')](_0x592c80)){_0x18583a[_0x3fc0('0x14')](_0x3fc0('0x9f'),_0x592c80);}var _0x57f884={'type':db[_0x3fc0('0x72')][_0x3fc0('0xa0')][_0x3fc0('0x73')],'raw':!![]};return db[_0x3fc0('0x74')][_0x3fc0('0x75')](_0x18583a[_0x3fc0('0x76')](),_0x57f884);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x34e8=['getInteractionFK','user_has_','_interactions','u.fullname','ui.','left_join','users','length','\x20IN\x20?','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','text','value','start','end','unreadMessages','read','Contact','operator','$substring','split','contact','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','type','Tag','map','tags','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','fields','then','tag','filter','get','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','Account.email','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','Owner.fullname','o.internal','limit','offset','sequelize','groupBy','enableEmailPreview','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','tools_tags'];(function(_0x5eec1a,_0xd6822c){var _0x18c913=function(_0x37728e){while(--_0x37728e){_0x5eec1a['push'](_0x5eec1a['shift']());}};_0x18c913(++_0xd6822c);}(_0x34e8,0x12c));var _0x834e=function(_0x4d6023,_0x1f0132){_0x4d6023=_0x4d6023-0x0;var _0x1c8875=_0x34e8[_0x4d6023];return _0x1c8875;};'use strict';var _=require(_0x834e('0x0'));var squel=require(_0x834e('0x1'));var as=require(_0x834e('0x2'));var qs=require(_0x834e('0x3'));var updateInteraction=require('./update-interaction')[_0x834e('0x4')];var utils=require(_0x834e('0x5'));var db=require(_0x834e('0x6'))['db'];function skipInteractionsQuery(_0x31bf20,_0x289ef2,_0x19a3e0){var _0x398bee=![];var _0x4a2018=utils[_0x834e('0x7')](_0x31bf20);if(_0x289ef2['role']===_0x834e('0x8')&&!_0x19a3e0[_0x834e('0x9')]&&!_0x19a3e0[_0x4a2018]){_0x398bee=!![];}return _0x398bee;}function getTagsQuery(){return squel[_0x834e('0xa')]()[_0x834e('0xb')]('id')[_0x834e('0xb')](_0x834e('0xc'))[_0x834e('0xb')](_0x834e('0xd'))[_0x834e('0xe')](_0x834e('0xf'));}function getUsersQuery(_0x1e41fe,_0x36e124){var _0x14038b=utils[_0x834e('0x10')](_0x1e41fe);var _0x293514=_0x834e('0x11')+_0x1e41fe+_0x834e('0x12');var _0x538bb3=squel[_0x834e('0xa')]()[_0x834e('0xb')]('u.id')[_0x834e('0xb')](_0x834e('0x13'))[_0x834e('0xb')](_0x834e('0x14')+_0x14038b)['from'](_0x293514,'ui')[_0x834e('0x15')](_0x834e('0x16'),'u','u.id\x20=\x20ui.UserId');if(_0x36e124[_0x834e('0x17')]>0x0){_0x538bb3['where'](_0x834e('0x14')+_0x14038b+_0x834e('0x18'),_['map'](_0x36e124,'id'));}return _0x538bb3;}function getInteractionsQuery(_0x43ac41){var _0x22106e=utils[_0x834e('0x19')](_0x43ac41);var _0x50b3f6=utils[_0x834e('0x7')](_0x43ac41);var _0x211e9a=utils[_0x834e('0x10')](_0x43ac41);return squel[_0x834e('0xa')]()[_0x834e('0xe')](_0x22106e[_0x834e('0x1a')],'i')[_0x834e('0x15')]('cm_contacts','c',_0x834e('0x1b'))[_0x834e('0x15')](_0x834e('0x16'),'o',_0x834e('0x1c'))['left_join'](_0x22106e[_0x834e('0x1d')],'a',_0x834e('0x1e')+_0x50b3f6)['left_join'](_0x22106e[_0x834e('0x1f')],'me',_0x834e('0x20')+_0x211e9a+_0x834e('0x21'))['left_join'](_0x22106e['interactionsTags'],'it',_0x834e('0x22')+_0x211e9a+_0x834e('0x21'))['left_join'](_0x834e('0xf'),'t',_0x834e('0x23'));}function getSqlClauses(){var _0x58f4fd={'body':squel[_0x834e('0x24')](),'contact':squel[_0x834e('0x24')](),'default':squel[_0x834e('0x24')](),'fields':squel['expr'](),'filter':squel[_0x834e('0x24')](),'read':squel[_0x834e('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel['expr']()};return _0x58f4fd;}function parseTagParameter(_0x1e713a){var _0x508a1d=squel[_0x834e('0x24')]();if(_0x1e713a){var _0x3f1b0b=utils[_0x834e('0x25')](_0x1e713a);_0x3f1b0b[_0x834e('0x26')](function(_0x3cd928){_0x508a1d['or'](_0x834e('0x27'),'%,'+_0x3cd928+',%');});}return _0x508a1d;}function parseReadParameter(_0x491919){var _0x510780='';if(_0x491919){_0x510780='unreadMessages\x20{OPERATOR}\x200';if(_0x491919==='1'){_0x510780=_0x510780['replace'](_0x834e('0x28'),'=');}else{_0x510780=_0x510780[_0x834e('0x29')](_0x834e('0x28'),'>');}}return _0x510780;}function parseSearchFilter(_0x5dacc1,_0xb5bc06){var _0x11f1ce=squel[_0x834e('0x24')]();if(_0xb5bc06){var _0x1e026a=_0xb5bc06[_0x834e('0x29')]('\x5c','\x5c\x5c')[_0x834e('0x29')](/'/g,'\x27\x27');if(qs[_0x834e('0x2a')](_0x1e026a)){_0x11f1ce['or'](_0x834e('0x2b'),_0x1e026a+'%');if([_0x834e('0x2c'),'whatsapp'][_0x834e('0x2d')](_0x5dacc1)){_0x11f1ce['or']('i.phone\x20LIKE\x20?',_0x1e026a+'%');}else if(_0x5dacc1===_0x834e('0x2e')){_0x11f1ce['or'](_0x834e('0x2f'),_0x1e026a+'%');}else if(_0x5dacc1===_0x834e('0x30')){_0x11f1ce['or'](_0x834e('0x31'),_0x1e026a+'%');}}else if(_0x5dacc1===_0x834e('0x32')&&qs[_0x834e('0x33')](_0x1e026a)){_0x11f1ce['or'](_0x834e('0x34'),_0x1e026a+'%');}else{if(_0x5dacc1===_0x834e('0x32')){_0x11f1ce['or'](_0x834e('0x35'),qs[_0x834e('0x36')](_0x1e026a))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x834e('0x36')](_0x1e026a));}else{if(_0x5dacc1!==_0x834e('0x2e')){_0x11f1ce['or'](_0x834e('0x37'),qs[_0x834e('0x36')](_0x1e026a));}_0x11f1ce['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1e026a+'%');}}}return _0x11f1ce;}function parseAdvancedSearchFilter(_0x3f88ad,_0x379d60){var _0x4b12f5=getSqlClauses();var _0x496533=as['parseSearch'](_0x3f88ad);var _0x3e58fa=_0x496533[_0x834e('0x38')];for(var _0x20c6ae=0x0;_0x20c6ae<_0x496533[_0x834e('0x39')][_0x834e('0x17')];_0x20c6ae++){var _0x1b76dd=_0x496533['conditions'][_0x20c6ae];var _0x2c2d94='i';var _0x513f36=_[_0x834e('0x3a')](_0x379d60,[_0x834e('0xc'),_0x1b76dd['field']]);if(_0x513f36){var _0x18ac3b=as[_0x834e('0x3b')](_0x2c2d94,_0x513f36['type'],_0x1b76dd);_0x4b12f5['default'][_0x3e58fa](_0x18ac3b[_0x834e('0x3c')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3e')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3f')]);}else{switch(_0x1b76dd['field']){case _0x834e('0x40'):var _0x548d1d=parseReadParameter(_0x1b76dd['value']);_0x4b12f5[_0x834e('0x41')]['and'](_0x548d1d);break;case _0x834e('0x42'):if(_0x1b76dd[_0x834e('0x43')]===_0x834e('0x44')){if(_0x1b76dd[_0x834e('0x3d')][_0x834e('0x45')]('\x20')['length']>0x1){_0x4b12f5[_0x834e('0x46')][_0x3e58fa](_0x834e('0x47'),qs[_0x834e('0x36')](_0x1b76dd['value']),null);}else{var _0x35380e='%'+_0x1b76dd[_0x834e('0x3d')]+'%';_0x4b12f5['contact'][_0x3e58fa](_0x834e('0x48'),_0x35380e,_0x35380e,_0x35380e);}}else{_0x513f36=_['find'](_0x379d60,[_0x834e('0xc'),_0x834e('0x49')]);_0x1b76dd['field']='ContactId';_0x18ac3b=as[_0x834e('0x3b')](_0x2c2d94,_0x513f36[_0x834e('0x4a')],_0x1b76dd);_0x4b12f5[_0x834e('0x46')][_0x3e58fa](_0x18ac3b[_0x834e('0x3c')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3e')],_0x18ac3b[_0x834e('0x3d')]['end']);}break;case _0x834e('0x4b'):var _0x5abb7a=_0x1b76dd[_0x834e('0x3d')]['split'](',')[_0x834e('0x4c')](function(_0x5a5807){return Number(_0x5a5807);});var _0x361f60=parseTagParameter(_0x5abb7a);_0x4b12f5[_0x834e('0x4d')]['clause'][_0x834e('0x4e')](_0x361f60);_0x4b12f5[_0x834e('0x4d')][_0x834e('0x4f')]=_0x5abb7a;break;case _0x834e('0x50'):if(_0x1b76dd[_0x834e('0x43')]===_0x834e('0x44')){_0x4b12f5[_0x834e('0x51')][_0x3e58fa](_0x834e('0x52'),'%'+_0x1b76dd[_0x834e('0x3d')]+'%',null);}else{_0x513f36=_[_0x834e('0x3a')](_0x379d60,['name',_0x834e('0x53')]);_0x1b76dd[_0x834e('0xb')]='UserId';_0x18ac3b=as[_0x834e('0x3b')](_0x2c2d94,_0x513f36[_0x834e('0x4a')],_0x1b76dd);_0x4b12f5[_0x834e('0x51')][_0x3e58fa](_0x18ac3b[_0x834e('0x3c')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3e')],_0x18ac3b['value']['end']);}break;case _0x834e('0x54'):case _0x834e('0x55'):_0x18ac3b=as[_0x834e('0x3b')]('me',null,_0x1b76dd);_0x4b12f5[_0x834e('0x54')][_0x3e58fa](_0x18ac3b[_0x834e('0x3c')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3e')],_0x18ac3b[_0x834e('0x3d')][_0x834e('0x3f')]);break;}}}return _0x4b12f5;}function parseModelFields(_0x390c45,_0xf02f0d,_0x385435){var _0x1a28f6=utils[_0x834e('0x7')](_0x390c45);var _0x2aa072=squel[_0x834e('0x24')]();var _0x3df078=_(_0xf02f0d)[_0x834e('0x56')]()[_0x834e('0x4c')](function(_0x1adf86){return _['some'](_0x385435,[_0x834e('0xc'),_0x1adf86])?_0x1adf86:undefined;})[_0x834e('0x57')]()['value']();if(_0x3df078[_0x834e('0x17')]>0x0){_0x3df078[_0x834e('0x26')](function(_0x55d491){if(_0x55d491===_0x1a28f6){_0x2aa072[_0x834e('0x4e')]('i.'+_0x1a28f6+_0x834e('0x18'),[][_0x834e('0x58')](_0xf02f0d[_0x55d491]));}else if(_0x55d491===_0x834e('0x59')){var _0x4288e4=JSON[_0x834e('0x5a')](_0xf02f0d[_0x55d491])[_0x834e('0x5b')];var _0x4a8b32=JSON[_0x834e('0x5a')](_0xf02f0d[_0x55d491])[_0x834e('0x5c')];_0x2aa072[_0x834e('0x4e')](_0x834e('0x5d'),_0x4288e4,_0x4a8b32);}else{if(_0xf02f0d[_0x55d491]===_0x834e('0x5e')){_0x2aa072[_0x834e('0x4e')]('i.'+_0x55d491+_0x834e('0x5f'));}else{_0x2aa072[_0x834e('0x4e')]('i.'+_0x55d491+'\x20=\x20?',_0xf02f0d[_0x55d491]);}}});}return _0x2aa072;}function parseQueryParameters(_0x11778e,_0x4dc104,_0x2f4bde){var _0x53a9ee=getSqlClauses();return Promise[_0x834e('0x60')]()['then'](function(){return parseModelFields(_0x11778e,_0x4dc104,_0x2f4bde);})['then'](function(_0x6c0b29){_0x53a9ee[_0x834e('0x61')]['and'](_0x6c0b29);return parseReadParameter(_0x4dc104['read']);})[_0x834e('0x62')](function(_0x2452b4){_0x53a9ee[_0x834e('0x41')][_0x834e('0x4e')](_0x2452b4);return parseTagParameter(_0x4dc104[_0x834e('0x63')]);})[_0x834e('0x62')](function(_0x3d3f2b){_0x53a9ee[_0x834e('0x4d')]['clause'][_0x834e('0x4e')](_0x3d3f2b);return parseSearchFilter(_0x11778e,_0x4dc104[_0x834e('0x64')]);})['then'](function(_0x281342){_0x53a9ee['filter']=_0x281342;return _0x53a9ee;});}function checkAccountsRestrictions(_0x3e58ef,_0x45eceb,_0x5160c4){var _0x41ef86=utils[_0x834e('0x7')](_0x3e58ef);var _0x2de29a=_0x834e('0x65')+_['capitalize'](_0x3e58ef)+(_0x3e58ef===_0x834e('0x66')?_0x834e('0x67'):_0x834e('0x68'));var _0x5925ef=squel[_0x834e('0x24')]();return Promise[_0x834e('0x60')]()[_0x834e('0x62')](function(){if(_0x5160c4[_0x834e('0x9')]&&_0x45eceb[_0x834e('0x69')]===_0x834e('0x8')){return _0x45eceb[_0x2de29a]({'attributes':['id'],'raw':!![]});}})[_0x834e('0x62')](function(_0x1def00){if(_0x1def00){if(_0x1def00[_0x834e('0x17')]===0x0){_0x5925ef[_0x834e('0x4e')]('i.'+_0x41ef86+_0x834e('0x5f'));}else{_0x5925ef[_0x834e('0x4e')]('i.'+_0x41ef86+_0x834e('0x18'),_[_0x834e('0x4c')](_0x1def00,'id'));}}else if(!_0x5160c4[_0x41ef86]){_0x5925ef[_0x834e('0x4e')]('i.'+_0x41ef86+_0x834e('0x6a'));}})[_0x834e('0x62')](function(){return _0x5925ef;});}function getClosedOrderClause(_0x14ed83,_0x193a15){var _0x3e3467='';var _0xed4081=[_0x834e('0x6b'),'i.secondDisposition',_0x834e('0x6c')];if(_0x14ed83===_0x834e('0x32')){_0xed4081[_0x834e('0x6d')](_0x834e('0x6e'));}if(_0x193a15['closed']==='0'&&_0x14ed83===_0x834e('0x32')){_0x3e3467='i.substatus';}else{if(_0x193a15['closed']==='1'){_0xed4081[_0x834e('0x6f')]();}_0x3e3467=_0x834e('0x70')+_0xed4081[_0x834e('0x71')](',\x20')+')';}return _0x3e3467;}function getFilteredInteractions(_0xe79465,_0x216105,_0x3821ad,_0xbb926d){var _0xe5c8f6=utils['getInteractionFK'](_0xe79465);var _0xdef8c4=_['capitalize'](_0xe79465)+_0x834e('0x72');var _0xd35dda=[];var _0x514fe5=getTagsQuery();var _0x4c5886={'type':db[_0x834e('0x73')][_0x834e('0x74')][_0x834e('0x75')],'raw':!![]};var _0x2cca07=[];var _0x2c41bd=[];return db['sequelize'][_0x834e('0x76')](_0x514fe5[_0x834e('0x77')](),_0x4c5886)[_0x834e('0x62')](function(_0x228a60){_0xd35dda=_[_0x834e('0x78')](_0x228a60,'id');_0x4c5886=_[_0x834e('0x79')](_0x4c5886,{'model':db[_0xdef8c4],'mapToModel':!![],'nest':!![]});if(_0x3821ad[_0x834e('0x61')]){_0xbb926d[_0x834e('0x7a')][_0x834e('0x26')](function(_0x324f67){_0x216105['field']('i.'+_0x324f67);});}else{_0x216105[_0x834e('0xb')](_0x834e('0x7b'),_0x834e('0x40'));_0x216105[_0x834e('0xb')]('a.key',_0x834e('0x7c'));_0x216105['field']('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0xe79465===_0x834e('0x32')){_0x216105[_0x834e('0xb')]('a.email',_0x834e('0x7d'));_0x216105[_0x834e('0xb')]('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',_0x834e('0x7e'));_0x216105[_0x834e('0xb')]('i.id');_0x216105['field'](_0x834e('0x7f'));_0x216105[_0x834e('0xb')](_0x834e('0x80'));_0x216105[_0x834e('0xb')](_0x834e('0x81'));_0x216105['field'](_0x834e('0x82'));_0x216105['field'](_0x834e('0x83'));_0x216105[_0x834e('0xb')](_0x834e('0x84'));_0x216105['field'](_0x834e('0x85'));_0x216105[_0x834e('0xb')]('i.subject');_0x216105[_0x834e('0xb')](_0x834e('0x6c'));_0x216105[_0x834e('0xb')]('i.secondDisposition');_0x216105[_0x834e('0xb')](_0x834e('0x6b'));_0x216105[_0x834e('0xb')](_0x834e('0x6e'));_0x216105[_0x834e('0xb')](_0x834e('0x86'));_0x216105[_0x834e('0xb')](_0x834e('0x87'));_0x216105[_0x834e('0xb')](_0x834e('0x88'));_0x216105['field']('i.UserId');}else if(_0xe79465==='openchannel'){_0x216105[_0x834e('0xb')](_0x834e('0x89'),_0x834e('0x7e'));}else{_0x216105[_0x834e('0xb')](_0x834e('0x8a'),'contactName');}if(_0xe79465!=='mail'){_0x216105[_0x834e('0xb')](_0x834e('0x8b'));}_0x216105[_0x834e('0xb')](_0x834e('0x8c'),_0x834e('0x8d'));_0x216105['field'](_0x834e('0x8e'),_0x834e('0x8f'));_0x216105[_0x834e('0xb')]('c.email',_0x834e('0x90'));_0x216105[_0x834e('0xb')](_0x834e('0x91'),_0x834e('0x92'));_0x216105[_0x834e('0xb')]('c.mobile','Contact.mobile');_0x216105[_0x834e('0xb')](_0x834e('0x93'),'Contact.fax');_0x216105[_0x834e('0xb')]('o.fullname',_0x834e('0x94'));_0x216105[_0x834e('0xb')](_0x834e('0x95'),'Owner.internal');_0x216105[_0x834e('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xbb926d['limit']){_0x216105[_0x834e('0x96')](_0xbb926d[_0x834e('0x96')]);}if(_0xbb926d[_0x834e('0x97')]){_0x216105[_0x834e('0x97')](_0xbb926d[_0x834e('0x97')]);}return db[_0x834e('0x98')][_0x834e('0x76')](_0x216105[_0x834e('0x77')](),_0x4c5886);})[_0x834e('0x62')](function(_0x53f6e3){_0x2cca07=_0x53f6e3;var _0x2f775a=getUsersQuery(_0xe79465,_0x2cca07);return db['sequelize'][_0x834e('0x76')](_0x2f775a[_0x834e('0x77')](),_0x4c5886);})[_0x834e('0x62')](function(_0x27df3d){_0x2c41bd=_[_0x834e('0x99')](_0x27df3d,_0xe5c8f6);if(_0xe79465===_0x834e('0x32')){return db['Setting']['findOne']({'attributes':[_0x834e('0x9a')],'raw':!![]});}})[_0x834e('0x62')](function(_0x4eff8d){var _0x3cca51=_0x4eff8d?_0x4eff8d[_0x834e('0x9a')]:undefined;var _0x1bc5d1=_0x2cca07[_0x834e('0x4c')](function(_0xc75f5e){return updateInteraction(_0xc75f5e,_0xd35dda,_0x2c41bd,_0x3cca51);});return Promise['all'](_0x1bc5d1);});}function countFilteredInteractions(_0x29839d,_0x78917b){var _0x4c319d=_0x29839d['clone']();_0x4c319d['field'](_0x834e('0x9b'));_0x4c319d[_0x834e('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x834e('0x40'));var _0x1f053f=utils['getSelectedTags'](_0x78917b);if(!_[_0x834e('0x9c')](_0x1f053f)){_0x4c319d['where']('t.id\x20IN\x20?',_0x1f053f);}var _0x41dfd9={'type':db[_0x834e('0x73')][_0x834e('0x74')][_0x834e('0x75')],'raw':!![]};return db['sequelize'][_0x834e('0x76')](_0x4c319d[_0x834e('0x77')](),_0x41dfd9);}module[_0x834e('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 38b87c0..6cf4ac3 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc31c=['MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','forEach','waiting','answered','total','closed','disposition','abandoned','UserId','talking','unmanaged'];(function(_0x33f53a,_0x24261e){var _0x5db392=function(_0x1ea1ee){while(--_0x1ea1ee){_0x33f53a['push'](_0x33f53a['shift']());}};_0x5db392(++_0x24261e);}(_0xc31c,0x144));var _0xcc31=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xc31c[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var db=require(_0xcc31('0x0'))['db'];function getInteractionUsers(_0x5960e6,_0x4a3184){return new Promise(function(_0x52e65b,_0x4489fe){try{var _0x4a5cb8=[];if(_0x4a3184[_0x5960e6]){_0x4a5cb8=_0x4a3184[_0x5960e6][_0xcc31('0x1')](function(_0x531195){return{'id':_0x531195['id'],'fullname':_0x531195[_0xcc31('0x2')]};});}return _0x52e65b(_0x4a5cb8);}catch(_0x583818){_0x4489fe(_0x583818);}});}function getInteractionTags(_0x2ae967,_0x4b1cff){var _0x4c3be5=[];if(_0x2ae967){_0x2ae967[_0xcc31('0x3')](',')[_0xcc31('0x4')](function(_0x4ec930){_0x4c3be5['push'](_0x4b1cff[_0x4ec930]);});}return _0x4c3be5;}function updateWaitingCounter(_0x2179a4){if(_0x2179a4[_0xcc31('0x5')]){_0x2179a4[_0xcc31('0x5')]-=0x1;}}function updateInteractionCounters(_0x16e17b){_0x16e17b['waiting']=0x0;_0x16e17b['talking']=0x0;_0x16e17b[_0xcc31('0x6')]=0x0;_0x16e17b['unmanaged']=0x0;_0x16e17b['abandoned']=0x0;_0x16e17b[_0xcc31('0x7')]=0x0;if(_0x16e17b[_0xcc31('0x8')]){if(_0x16e17b[_0xcc31('0x9')]===_0xcc31('0xa')){_0x16e17b[_0xcc31('0xa')]+=0x1;updateWaitingCounter(_0x16e17b);}if(_0x16e17b[_0xcc31('0xb')]){_0x16e17b[_0xcc31('0x6')]+=0x1;if(_0x16e17b['talking']){_0x16e17b[_0xcc31('0xc')]-=0x1;}}else{if(_0x16e17b[_0xcc31('0x9')]){_0x16e17b[_0xcc31('0xd')]+=0x1;updateWaitingCounter(_0x16e17b);}}}else{if(!_0x16e17b[_0xcc31('0xb')]){_0x16e17b[_0xcc31('0x5')]+=0x1;}if(_0x16e17b['UserId']){_0x16e17b[_0xcc31('0xc')]+=0x1;updateWaitingCounter(_0x16e17b);}}_0x16e17b['total']+=0x1;return _0x16e17b;}function getLastMessageText(_0x45b606){return db[_0xcc31('0xe')][_0xcc31('0xf')]({'where':{'$and':[{'MailInteractionId':_0x45b606['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xcc31('0x10')],'order':_0xcc31('0x11'),'raw':!![]})[_0xcc31('0x12')](function(_0x2290f8){if(_0x2290f8&&_0x2290f8[_0xcc31('0x10')]){_0x45b606[_0xcc31('0x13')]=_[_0xcc31('0x14')](_0x2290f8['plainBody']);}return _0x45b606;})[_0xcc31('0x15')](function(_0x20b52a){throw _0x20b52a;});}exports[_0xcc31('0x16')]=function(_0x50e155,_0x477881,_0x3d7173,_0x42bb9b){return new Promise(function(_0x5806d7,_0x4fb44c){return getInteractionUsers(_0x50e155['id'],_0x3d7173)[_0xcc31('0x12')](function(_0x3c1c7c){_0x50e155[_0xcc31('0x17')]=_0x3c1c7c;return getInteractionTags(_0x50e155[_0xcc31('0x18')],_0x477881);})['then'](function(_0x37fe6d){_0x50e155[_0xcc31('0x19')]=_0x37fe6d;delete _0x50e155['TagIds'];return updateInteractionCounters(_0x50e155);})['then'](function(_0x58f0e3){if(_0x42bb9b){return getLastMessageText(_0x58f0e3);}else{return _0x58f0e3;}})[_0xcc31('0x12')](function(_0x5a7327){_0x5806d7(_0x5a7327);})[_0xcc31('0x15')](function(_0x95bea0){_0x4fb44c(_0x95bea0);});});}; \ No newline at end of file +var _0xf140=['findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','MailMessage'];(function(_0x443c6f,_0x61be28){var _0x49c07d=function(_0x501010){while(--_0x501010){_0x443c6f['push'](_0x443c6f['shift']());}};_0x49c07d(++_0x61be28);}(_0xf140,0x15d));var _0x0f14=function(_0x214ffc,_0x430a6d){_0x214ffc=_0x214ffc-0x0;var _0x366bbf=_0xf140[_0x214ffc];return _0x366bbf;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4f2fde,_0x252f52){return new Promise(function(_0x2769b1,_0x206982){try{var _0x21035d=[];if(_0x252f52[_0x4f2fde]){_0x21035d=_0x252f52[_0x4f2fde][_0x0f14('0x0')](function(_0x96000a){return{'id':_0x96000a['id'],'fullname':_0x96000a[_0x0f14('0x1')]};});}return _0x2769b1(_0x21035d);}catch(_0x471e2e){_0x206982(_0x471e2e);}});}function getInteractionTags(_0x14000a,_0x319f50){var _0xf97351=[];if(_0x14000a){_0x14000a[_0x0f14('0x2')](',')[_0x0f14('0x3')](function(_0x1c22e6){_0xf97351[_0x0f14('0x4')](_0x319f50[_0x1c22e6]);});}return _0xf97351;}function updateWaitingCounter(_0x1967c3){if(_0x1967c3[_0x0f14('0x5')]){_0x1967c3['waiting']-=0x1;}}function updateInteractionCounters(_0x40b8b6){_0x40b8b6[_0x0f14('0x5')]=0x0;_0x40b8b6[_0x0f14('0x6')]=0x0;_0x40b8b6[_0x0f14('0x7')]=0x0;_0x40b8b6[_0x0f14('0x8')]=0x0;_0x40b8b6[_0x0f14('0x9')]=0x0;_0x40b8b6[_0x0f14('0xa')]=0x0;if(_0x40b8b6[_0x0f14('0xb')]){if(_0x40b8b6[_0x0f14('0xc')]===_0x0f14('0x9')){_0x40b8b6[_0x0f14('0x9')]+=0x1;updateWaitingCounter(_0x40b8b6);}if(_0x40b8b6[_0x0f14('0xd')]){_0x40b8b6[_0x0f14('0x7')]+=0x1;if(_0x40b8b6['talking']){_0x40b8b6[_0x0f14('0x6')]-=0x1;}}else{if(_0x40b8b6[_0x0f14('0xc')]){_0x40b8b6['unmanaged']+=0x1;updateWaitingCounter(_0x40b8b6);}}}else{if(!_0x40b8b6[_0x0f14('0xd')]){_0x40b8b6[_0x0f14('0x5')]+=0x1;}if(_0x40b8b6[_0x0f14('0xd')]){_0x40b8b6[_0x0f14('0x6')]+=0x1;updateWaitingCounter(_0x40b8b6);}}_0x40b8b6[_0x0f14('0xa')]+=0x1;return _0x40b8b6;}function getLastMessageText(_0x492a31){return db[_0x0f14('0xe')][_0x0f14('0xf')]({'where':{'$and':[{'MailInteractionId':_0x492a31['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0f14('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0f14('0x11')],'order':_0x0f14('0x12'),'raw':!![]})[_0x0f14('0x13')](function(_0xaeb8d1){if(_0xaeb8d1&&_0xaeb8d1[_0x0f14('0x11')]){_0x492a31[_0x0f14('0x14')]=_[_0x0f14('0x15')](_0xaeb8d1[_0x0f14('0x11')]);}return _0x492a31;})[_0x0f14('0x16')](function(_0x2b12a5){throw _0x2b12a5;});}exports[_0x0f14('0x17')]=function(_0x1bd8d1,_0x3bb499,_0x1b2560,_0xa530cd){return new Promise(function(_0x142240,_0x49e359){return getInteractionUsers(_0x1bd8d1['id'],_0x1b2560)[_0x0f14('0x13')](function(_0x1e2cb5){_0x1bd8d1[_0x0f14('0x18')]=_0x1e2cb5;return getInteractionTags(_0x1bd8d1[_0x0f14('0x19')],_0x3bb499);})[_0x0f14('0x13')](function(_0x54916c){_0x1bd8d1['Tags']=_0x54916c;delete _0x1bd8d1[_0x0f14('0x19')];return updateInteractionCounters(_0x1bd8d1);})[_0x0f14('0x13')](function(_0x321895){if(_0xa530cd){return getLastMessageText(_0x321895);}else{return _0x321895;}})[_0x0f14('0x13')](function(_0x2f4f10){_0x142240(_0x2f4f10);})['catch'](function(_0x52f136){_0x49e359(_0x52f136);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 4219c56..24536c3 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca4d=['fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','Website','Account','capitalize','upperFirst','InteractionId','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','findOne','update','then','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xca4d,0x11c));var _0xdca4=function(_0x8b67fc,_0x393958){_0x8b67fc=_0x8b67fc-0x0;var _0x424a6e=_0xca4d[_0x8b67fc];return _0x424a6e;};'use strict';var _=require('lodash');var db=require(_0xdca4('0x0'))['db'];var loggers={'openchannel':require(_0xdca4('0x1'))(_0xdca4('0x2')),'mail':require(_0xdca4('0x1'))(_0xdca4('0x3')),'fax':require('../../config/logger')(_0xdca4('0x4')),'sms':require(_0xdca4('0x1'))(_0xdca4('0x5')),'chat':require('../../config/logger')(_0xdca4('0x6')),'whatsapp':require('../../config/logger')(_0xdca4('0x7'))};function getAccountFK(_0x5f0c06){return _['capitalize'](_0x5f0c06)+(_0x5f0c06==='chat'?_0xdca4('0x8'):_0xdca4('0x9'))+'Id';}function getInteractionFK(_0x3bfaea){return _[_0xdca4('0xa')](_0x3bfaea)+'InteractionId';}function getInteractionId(_0x2a13ef,_0x2ad3b5,_0x34b152){if(_0x2a13ef&&_0x2a13ef[_[_0xdca4('0xb')](_0x34b152)+'InteractionId']){return _0x2a13ef[_[_0xdca4('0xb')](_0x34b152)+_0xdca4('0xc')];}else if(_0x2a13ef&&_0x2a13ef['id']){return _0x2a13ef['id'];}else if(_0x2ad3b5&&_0x2ad3b5['id']){return _0x2ad3b5['id'];}else{return _0xdca4('0xd');}}function getInteractionsTables(_0x5baf9f){return{'accounts':_0x5baf9f+'_'+(_0x5baf9f===_0xdca4('0xe')?_0xdca4('0xf'):_0xdca4('0x10')),'interactions':_0x5baf9f+_0xdca4('0x11'),'interactionsTags':_0x5baf9f+_0xdca4('0x12'),'messages':_0x5baf9f+_0xdca4('0x13'),'userInteractions':_0xdca4('0x14')+_0x5baf9f+_0xdca4('0x11')};}function getSelectedTags(_0x1d14a3){var _0x4d6286=[];if(_0x1d14a3){_0x4d6286=Array['isArray'](_0x1d14a3)?_0x1d14a3:[_0x1d14a3];}return _0x4d6286;}function log(_0x4d54ed,_0x52daee,_0x24ae57,_0x39d30d,_0x57a80d,_0x1e0ece){loggers[_0x57a80d[_0xdca4('0x15')]()][_0x4d54ed](_0xdca4('0x16'),_0x1e0ece[_0xdca4('0x17')](),_0x52daee?_0x52daee['id']:null,_0x52daee?_0x52daee[_0xdca4('0x18')]:null,_0x52daee?_0x52daee['role']:null,getInteractionId(_0x24ae57,_0x39d30d,_0x57a80d),_0x24ae57?JSON[_0xdca4('0x19')](_0x24ae57):'null');}function updateUser(_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33){db[_[_0xdca4('0xb')](_0x903b42)+'Interaction'][_0xdca4('0x1a')]({'where':{'id':getInteractionId(_0x512a70,_0x5983a1,_0x903b42)}})['then'](function(_0x2334f0){if(_0x2334f0){return _0x2334f0[_0xdca4('0x1b')]({'UserId':_0x53a0b9?_0x53a0b9['id']:null});}})[_0xdca4('0x1c')](function(_0xc026c){if(_0xc026c){log(_0xdca4('0x1d'),_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33);}})['catch'](function(){log(_0xdca4('0x1e'),_0x53a0b9,_0x512a70,_0x5983a1,_0x903b42,_0x3a2c33);});}module[_0xdca4('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x203e=['findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null'];(function(_0x28f87a,_0x30995a){var _0x31939f=function(_0x1138a5){while(--_0x1138a5){_0x28f87a['push'](_0x28f87a['shift']());}};_0x31939f(++_0x30995a);}(_0x203e,0x7f));var _0xe203=function(_0x8db7c7,_0x4047e6){_0x8db7c7=_0x8db7c7-0x0;var _0x53f59a=_0x203e[_0x8db7c7];return _0x53f59a;};'use strict';var _=require(_0xe203('0x0'));var db=require(_0xe203('0x1'))['db'];var loggers={'openchannel':require(_0xe203('0x2'))('openchannel-interactions'),'mail':require(_0xe203('0x2'))(_0xe203('0x3')),'fax':require(_0xe203('0x2'))('fax-interactions'),'sms':require(_0xe203('0x2'))('sms-interactions'),'chat':require(_0xe203('0x2'))('chat-interactions'),'whatsapp':require(_0xe203('0x2'))(_0xe203('0x4'))};function getAccountFK(_0x46efdd){return _[_0xe203('0x5')](_0x46efdd)+(_0x46efdd===_0xe203('0x6')?_0xe203('0x7'):_0xe203('0x8'))+'Id';}function getInteractionFK(_0x45d510){return _[_0xe203('0x5')](_0x45d510)+'InteractionId';}function getInteractionId(_0x420ce6,_0x2c8a13,_0x46b237){if(_0x420ce6&&_0x420ce6[_[_0xe203('0x9')](_0x46b237)+_0xe203('0xa')]){return _0x420ce6[_[_0xe203('0x9')](_0x46b237)+_0xe203('0xa')];}else if(_0x420ce6&&_0x420ce6['id']){return _0x420ce6['id'];}else if(_0x2c8a13&&_0x2c8a13['id']){return _0x2c8a13['id'];}else{return'unknown';}}function getInteractionsTables(_0x1ff4af){return{'accounts':_0x1ff4af+'_'+(_0x1ff4af===_0xe203('0x6')?_0xe203('0xb'):_0xe203('0xc')),'interactions':_0x1ff4af+_0xe203('0xd'),'interactionsTags':_0x1ff4af+_0xe203('0xe'),'messages':_0x1ff4af+_0xe203('0xf'),'userInteractions':'user_has_'+_0x1ff4af+_0xe203('0xd')};}function getSelectedTags(_0x105fba){var _0x57cac4=[];if(_0x105fba){_0x57cac4=Array[_0xe203('0x10')](_0x105fba)?_0x105fba:[_0x105fba];}return _0x57cac4;}function log(_0x2d0bb8,_0x2267fc,_0x483571,_0x3abe8d,_0x9f2b8,_0x2df6fc){loggers[_0x9f2b8[_0xe203('0x11')]()][_0x2d0bb8](_0xe203('0x12'),_0x2df6fc[_0xe203('0x13')](),_0x2267fc?_0x2267fc['id']:null,_0x2267fc?_0x2267fc[_0xe203('0x14')]:null,_0x2267fc?_0x2267fc['role']:null,getInteractionId(_0x483571,_0x3abe8d,_0x9f2b8),_0x483571?JSON[_0xe203('0x15')](_0x483571):_0xe203('0x16'));}function updateUser(_0x50c867,_0x4ebafc,_0x33b876,_0x4a82b8,_0x2f8432){db[_[_0xe203('0x9')](_0x4a82b8)+'Interaction'][_0xe203('0x17')]({'where':{'id':getInteractionId(_0x4ebafc,_0x33b876,_0x4a82b8)}})[_0xe203('0x18')](function(_0x219438){if(_0x219438){return _0x219438[_0xe203('0x19')]({'UserId':_0x50c867?_0x50c867['id']:null});}})[_0xe203('0x18')](function(_0x4b25e2){if(_0x4b25e2){log(_0xe203('0x1a'),_0x50c867,_0x4ebafc,_0x33b876,_0x4a82b8,_0x2f8432);}})[_0xe203('0x1b')](function(){log(_0xe203('0x1c'),_0x50c867,_0x4ebafc,_0x33b876,_0x4a82b8,_0x2f8432);});}module[_0xe203('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a9ec918..e8c8423 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 _0x1b7f=['split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b7f,0x65));var _0xf1b7=function(_0x227d91,_0x414e00){_0x227d91=_0x227d91-0x0;var _0x1266b6=_0x1b7f[_0x227d91];return _0x1266b6;};'use strict';var crypto=require(_0xf1b7('0x0'));var util=require(_0xf1b7('0x1'));var compose=require(_0xf1b7('0x2'));var db=require(_0xf1b7('0x3'))['db'];var config=require(_0xf1b7('0x4'));function getValueFromLicense(_0x1e7b31,_0x4448dd){if(_0x1e7b31&&_0x4448dd){if(_0x4448dd[_0xf1b7('0x5')]&&_0x4448dd[_0xf1b7('0x6')]){var _0x249693=_0x4448dd['data1'];var _0x1d4e3e=_0x4448dd[_0xf1b7('0x6')];var _0x9fa8d5=_0x249693[_0xf1b7('0x7')]('-')[0x4];var _0xdeafcb=_0x249693[_0xf1b7('0x7')]('-')[0x0];var _0x4d3aaf=crypto['createDecipher'](_0xf1b7('0x8'),util[_0xf1b7('0x9')](_0xf1b7('0xa'),_0x9fa8d5,_0x249693,_0xdeafcb));var _0x401919=_0x4d3aaf[_0xf1b7('0xb')](_0x1d4e3e,_0xf1b7('0xc'),_0xf1b7('0xd'));_0x401919+=_0x4d3aaf['final']('utf8');var _0x3943cf=JSON[_0xf1b7('0xe')](_0x401919);return _0x3943cf[_0xf1b7('0xf')](_0x1e7b31)?_0x3943cf[_0x1e7b31]:null;}}return null;}function isLimit(_0x245f3d,_0x1c32f3,_0x3a666b,_0x4b8ece){var _0x313c1e=_0x1c32f3;return compose()['use'](function(_0x51324,_0x3b5457,_0x5e71dd){return db[_0xf1b7('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3f63c4){var _0xd27cde=getValueFromLicense(_0x245f3d,_0x3f63c4);return _0xd27cde?_0xd27cde:_0x313c1e;})[_0xf1b7('0x11')](function(_0x2c2cc8){_0x313c1e=_0x2c2cc8;return _0x3a666b[_0xf1b7('0x12')](_0x4b8ece);})[_0xf1b7('0x11')](function(_0x18540a){if(_0x18540a>=_0x313c1e){return _0x3b5457[_0xf1b7('0x13')](0x193)[_0xf1b7('0x14')]({'message':util[_0xf1b7('0x9')](_0xf1b7('0x15'),_0x245f3d)});}_0x5e71dd();})[_0xf1b7('0x16')](function(_0x58a815){_0x5e71dd(_0x58a815);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xf1b7('0x17')],{'where':{'$or':[{'role':_0xf1b7('0x18')},{'role':_0xf1b7('0x19')}]}});}exports[_0xf1b7('0x1a')]=isUserLimit; \ No newline at end of file +var _0xafda=['users','User','user','isUserLimit','crypto','util','composable-middleware','data1','license','split','format','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch'];(function(_0x394ce2,_0x3f07c7){var _0xa145e5=function(_0x568a23){while(--_0x568a23){_0x394ce2['push'](_0x394ce2['shift']());}};_0xa145e5(++_0x3f07c7);}(_0xafda,0x1d0));var _0xaafd=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xafda[_0x2d7f0e];return _0x110b07;};'use strict';var crypto=require(_0xaafd('0x0'));var util=require(_0xaafd('0x1'));var compose=require(_0xaafd('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3bf183,_0x13b198){if(_0x3bf183&&_0x13b198){if(_0x13b198[_0xaafd('0x3')]&&_0x13b198['license']){var _0x2f9b20=_0x13b198[_0xaafd('0x3')];var _0x5e8fdd=_0x13b198[_0xaafd('0x4')];var _0x565993=_0x2f9b20['split']('-')[0x4];var _0x2c8f72=_0x2f9b20[_0xaafd('0x5')]('-')[0x0];var _0x4fae1b=crypto['createDecipher']('aes-256-ctr',util[_0xaafd('0x6')]('%s:%s:%s',_0x565993,_0x2f9b20,_0x2c8f72));var _0x28c2f0=_0x4fae1b[_0xaafd('0x7')](_0x5e8fdd,_0xaafd('0x8'),_0xaafd('0x9'));_0x28c2f0+=_0x4fae1b[_0xaafd('0xa')](_0xaafd('0x9'));var _0x5832e6=JSON[_0xaafd('0xb')](_0x28c2f0);return _0x5832e6[_0xaafd('0xc')](_0x3bf183)?_0x5832e6[_0x3bf183]:null;}}return null;}function isLimit(_0x17ea53,_0x2414c1,_0x49f875,_0x273a7d){var _0x2d4fad=_0x2414c1;return compose()[_0xaafd('0xd')](function(_0x3789f7,_0x422611,_0x1c64ee){return db['License'][_0xaafd('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xaafd('0xf')](function(_0x805c38){var _0x535f79=getValueFromLicense(_0x17ea53,_0x805c38);return _0x535f79?_0x535f79:_0x2d4fad;})[_0xaafd('0xf')](function(_0x40aa18){_0x2d4fad=_0x40aa18;return _0x49f875['count'](_0x273a7d);})['then'](function(_0x1b7ddf){if(_0x1b7ddf>=_0x2d4fad){return _0x422611['status'](0x193)[_0xaafd('0x10')]({'message':util[_0xaafd('0x6')](_0xaafd('0x11'),_0x17ea53)});}_0x1c64ee();})[_0xaafd('0x12')](function(_0x2c236f){_0x1c64ee(_0x2c236f);});});}function isUserLimit(){return isLimit(_0xaafd('0x13'),0x1,db[_0xaafd('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0xaafd('0x15')}]}});}exports[_0xaafd('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9bc35e3..76113cf 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 _0xf9ba=['>\x20?','<=\x20?','$gte','>=\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','indexOf','push','DATE','$eq','operator','$between','includes','$gt','$lte','value','add','days','format','castTo','text','CAST(','\x20AS\x20','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','$startsWith','$endsWith','$lt'];(function(_0x423d72,_0x2d6813){var _0xceab52=function(_0xf1a90c){while(--_0xf1a90c){_0x423d72['push'](_0x423d72['shift']());}};_0xceab52(++_0x2d6813);}(_0xf9ba,0x71));var _0xaf9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9ba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf9b('0x0'));var moment=require('moment');exports[_0xaf9b('0x1')]=function(_0x4d5536){var _0x475cbd={'conditions':[]};_0x475cbd['sqlOperator']=_[_0xaf9b('0x2')](_0x4d5536,_0xaf9b('0x3'))?'or':_0xaf9b('0x4');var _0x15a5df=_0x4d5536[_0xaf9b('0x5')](_0xaf9b('0x6'),'')[_0xaf9b('0x5')](_0xaf9b('0x3'),'')[_0xaf9b('0x7')]('||');for(var _0x3a6d85=0x0;_0x3a6d85<_0x15a5df[_0xaf9b('0x8')];_0x3a6d85++){var _0x384fbb=_0x15a5df[_0x3a6d85]['split'](':=');var _0x50d563=_0x384fbb[0x0];var _0x23f16d=_0x384fbb[_0xaf9b('0x9')](0x1);_0x23f16d['forEach'](function(_0x2c5679){var _0xf9404c=_0x2c5679[_0xaf9b('0x7')]('[')[_0xaf9b('0xa')]();var _0x34278a=_0x2c5679[_0xaf9b('0xb')](/\[(.*?)\]/g);_0x34278a[_0xaf9b('0xc')](function(_0x15e6e5){var _0xd4b0ae=_0x15e6e5['split']('[')[_0xaf9b('0xd')](function(_0x5e1c21){return _0x5e1c21[_0xaf9b('0xe')](']')>-0x1;})['map'](function(_0x5ad9a0){return _0x5ad9a0[_0xaf9b('0x7')](']')[0x0];})[0x0];_0x475cbd['conditions'][_0xaf9b('0xf')]({'field':_0x50d563,'operator':_0xf9404c,'value':_0xd4b0ae});});});}return _0x475cbd;};exports['buildExpression']=function(_0x2135de,_0x5e4731,_0x2d6983){var _0x899a1b={};if(_0x5e4731===_0xaf9b('0x10')){if(_0x2d6983['operator']===_0xaf9b('0x11')){_0x2d6983[_0xaf9b('0x12')]=_0xaf9b('0x13');_0x2d6983['value']+=','+_0x2d6983['value'];}else if(_[_0xaf9b('0x14')]([_0xaf9b('0x15'),_0xaf9b('0x16')],_0x2d6983[_0xaf9b('0x12')])){_0x2d6983[_0xaf9b('0x17')]=moment(_0x2d6983[_0xaf9b('0x17')])[_0xaf9b('0x18')](0x1,_0xaf9b('0x19'))[_0xaf9b('0x1a')]('YYYY-MM-DD');}}if(_0x2d6983[_0xaf9b('0x1b')]){_0x5e4731=_0x2d6983[_0xaf9b('0x1b')];_0x899a1b[_0xaf9b('0x1c')]=_0xaf9b('0x1d')+_0x2135de+'.'+_0x2d6983['field']+_0xaf9b('0x1e')+_0x2d6983['castTo']+')\x20'+parseOperator(_0x2d6983['operator']);}else{_0x899a1b[_0xaf9b('0x1c')]=_0x2135de+'.'+_0x2d6983[_0xaf9b('0x1f')]+'\x20'+parseOperator(_0x2d6983[_0xaf9b('0x12')]);}if(_['includes']([_0xaf9b('0x20'),'$notIn'],_0x2d6983[_0xaf9b('0x12')]))_0x899a1b[_0xaf9b('0x1c')]='('+_0x899a1b['text']+_0xaf9b('0x21')+_0x2135de+'.'+_0x2d6983[_0xaf9b('0x1f')]+_0xaf9b('0x22');_0x899a1b['value']=parseValue(_0x5e4731,_0x2d6983[_0xaf9b('0x12')],_0x2d6983[_0xaf9b('0x17')]);return _0x899a1b;};function parseOperator(_0x3672f9){var _0x2338fd;switch(_0x3672f9){case _0xaf9b('0x23'):_0x2338fd='IN\x20?';break;case'$notIn':_0x2338fd=_0xaf9b('0x24');break;case'$eq':_0x2338fd='=\x20?';break;case'$ne':_0x2338fd='<>\x20?';break;case'$substring':case _0xaf9b('0x25'):case _0xaf9b('0x26'):_0x2338fd='LIKE\x20?';break;case _0xaf9b('0x27'):_0x2338fd='<\x20?';break;case _0xaf9b('0x15'):_0x2338fd=_0xaf9b('0x28');break;case _0xaf9b('0x16'):_0x2338fd=_0xaf9b('0x29');break;case _0xaf9b('0x2a'):_0x2338fd=_0xaf9b('0x2b');break;case _0xaf9b('0x13'):_0x2338fd='BETWEEN\x20?\x20AND\x20?';break;}return _0x2338fd;}function parseValue(_0x4332d9,_0x408945,_0x11f6ea){var _0x4e2362={'start':undefined,'end':undefined};switch(_0x408945){case _0xaf9b('0x23'):case'$notIn':_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea[_0xaf9b('0x7')](',');break;case _0xaf9b('0x2d'):_0x4e2362['start']='%'+_0x11f6ea+'%';break;case _0xaf9b('0x25'):_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea+'%';break;case'$endsWith':_0x4e2362[_0xaf9b('0x2c')]='%'+_0x11f6ea;break;case'$between':var _0x207ed2=_0x11f6ea['split'](',');var _0x11f6ea=_0x207ed2[_0xaf9b('0xa')]();var _0x49ea8b=_0x207ed2[_0xaf9b('0x2e')]();if(_0x4332d9===_0xaf9b('0x10')){_0x11f6ea=moment(_0x11f6ea)[_0xaf9b('0x2f')](0x0,!![])[_0xaf9b('0x1a')]();_0x49ea8b=moment(_0x49ea8b)[_0xaf9b('0x2f')](0x0,!![])['add'](0x17,_0xaf9b('0x30'))[_0xaf9b('0x18')](0x3b,_0xaf9b('0x31'))['add'](0x3b,_0xaf9b('0x32'))[_0xaf9b('0x1a')]();}_0x4e2362={'start':_0x11f6ea,'end':_0x49ea8b};break;default:_0x4e2362[_0xaf9b('0x2c')]=_0x11f6ea;break;}return _0x4e2362;} \ No newline at end of file +var _0x780b=['\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','<\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','and','[$and]','replace','split','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x780b,0x1d8));var _0xb780=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x780b[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xb780('0x0'));var moment=require(_0xb780('0x1'));exports[_0xb780('0x2')]=function(_0x5cdcda){var _0x125fdb={'conditions':[]};_0x125fdb['sqlOperator']=_[_0xb780('0x3')](_0x5cdcda,_0xb780('0x4'))?'or':_0xb780('0x5');var _0xbe3c36=_0x5cdcda['replace'](_0xb780('0x6'),'')[_0xb780('0x7')](_0xb780('0x4'),'')[_0xb780('0x8')]('||');for(var _0x4972b5=0x0;_0x4972b5<_0xbe3c36['length'];_0x4972b5++){var _0xe1cf18=_0xbe3c36[_0x4972b5][_0xb780('0x8')](':=');var _0x31f4b6=_0xe1cf18[0x0];var _0x52f08d=_0xe1cf18['slice'](0x1);_0x52f08d[_0xb780('0x9')](function(_0x3ad4b9){var _0x32cde0=_0x3ad4b9[_0xb780('0x8')]('[')[_0xb780('0xa')]();var _0x5b1d5b=_0x3ad4b9[_0xb780('0xb')](/\[(.*?)\]/g);_0x5b1d5b[_0xb780('0x9')](function(_0xbc9a49){var _0x5c60a2=_0xbc9a49[_0xb780('0x8')]('[')[_0xb780('0xc')](function(_0x4db2cc){return _0x4db2cc[_0xb780('0xd')](']')>-0x1;})[_0xb780('0xe')](function(_0x2badad){return _0x2badad[_0xb780('0x8')](']')[0x0];})[0x0];_0x125fdb[_0xb780('0xf')]['push']({'field':_0x31f4b6,'operator':_0x32cde0,'value':_0x5c60a2});});});}return _0x125fdb;};exports[_0xb780('0x10')]=function(_0x4f2562,_0x51a7c6,_0x5eb478){var _0x340d93={};if(_0x51a7c6===_0xb780('0x11')){if(_0x5eb478[_0xb780('0x12')]===_0xb780('0x13')){_0x5eb478['operator']='$between';_0x5eb478[_0xb780('0x14')]+=','+_0x5eb478['value'];}else if(_[_0xb780('0x15')]([_0xb780('0x16'),_0xb780('0x17')],_0x5eb478[_0xb780('0x12')])){_0x5eb478[_0xb780('0x14')]=moment(_0x5eb478[_0xb780('0x14')])[_0xb780('0x18')](0x1,_0xb780('0x19'))[_0xb780('0x1a')](_0xb780('0x1b'));}}if(_0x5eb478[_0xb780('0x1c')]){_0x51a7c6=_0x5eb478[_0xb780('0x1c')];_0x340d93[_0xb780('0x1d')]=_0xb780('0x1e')+_0x4f2562+'.'+_0x5eb478[_0xb780('0x1f')]+_0xb780('0x20')+_0x5eb478[_0xb780('0x1c')]+')\x20'+parseOperator(_0x5eb478[_0xb780('0x12')]);}else{_0x340d93[_0xb780('0x1d')]=_0x4f2562+'.'+_0x5eb478[_0xb780('0x1f')]+'\x20'+parseOperator(_0x5eb478['operator']);}if(_[_0xb780('0x15')]([_0xb780('0x21'),_0xb780('0x22')],_0x5eb478[_0xb780('0x12')]))_0x340d93[_0xb780('0x1d')]='('+_0x340d93[_0xb780('0x1d')]+_0xb780('0x23')+_0x4f2562+'.'+_0x5eb478[_0xb780('0x1f')]+'\x20IS\x20NULL)';_0x340d93['value']=parseValue(_0x51a7c6,_0x5eb478['operator'],_0x5eb478[_0xb780('0x14')]);return _0x340d93;};function parseOperator(_0x125aa1){var _0x56577a;switch(_0x125aa1){case _0xb780('0x24'):_0x56577a=_0xb780('0x25');break;case _0xb780('0x22'):_0x56577a=_0xb780('0x26');break;case _0xb780('0x13'):_0x56577a=_0xb780('0x27');break;case _0xb780('0x21'):_0x56577a=_0xb780('0x28');break;case'$substring':case _0xb780('0x29'):case _0xb780('0x2a'):_0x56577a=_0xb780('0x2b');break;case'$lt':_0x56577a=_0xb780('0x2c');break;case _0xb780('0x16'):_0x56577a='>\x20?';break;case _0xb780('0x17'):_0x56577a=_0xb780('0x2d');break;case _0xb780('0x2e'):_0x56577a='>=\x20?';break;case _0xb780('0x2f'):_0x56577a=_0xb780('0x30');break;}return _0x56577a;}function parseValue(_0x145f2b,_0x4e7ce5,_0x255018){var _0x3c2799={'start':undefined,'end':undefined};switch(_0x4e7ce5){case'$in':case _0xb780('0x22'):_0x3c2799[_0xb780('0x31')]=_0x255018['split'](',');break;case _0xb780('0x32'):_0x3c2799[_0xb780('0x31')]='%'+_0x255018+'%';break;case _0xb780('0x29'):_0x3c2799[_0xb780('0x31')]=_0x255018+'%';break;case'$endsWith':_0x3c2799['start']='%'+_0x255018;break;case _0xb780('0x2f'):var _0x110255=_0x255018['split'](',');var _0x255018=_0x110255[_0xb780('0xa')]();var _0x160303=_0x110255[_0xb780('0x33')]();if(_0x145f2b===_0xb780('0x11')){_0x255018=moment(_0x255018)[_0xb780('0x34')](0x0,!![])[_0xb780('0x1a')]();_0x160303=moment(_0x160303)['utcOffset'](0x0,!![])[_0xb780('0x18')](0x17,_0xb780('0x35'))[_0xb780('0x18')](0x3b,_0xb780('0x36'))[_0xb780('0x18')](0x3b,_0xb780('0x37'))[_0xb780('0x1a')]();}_0x3c2799={'start':_0x255018,'end':_0x160303};break;default:_0x3c2799[_0xb780('0x31')]=_0x255018;break;}return _0x3c2799;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c70ef6f..48624ae 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 _0xef17=['ASC','omit','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','getFullTextValue','match','query','$id','model','attributes','intersection','nolimit','limit','order','where','pick','filter','object','includes','columns','value','merge','map','type','lower','options','lodash','sequelize','moment','parse','keys','fields','split','filters','isEmpty','forOwn','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr'];(function(_0x57437b,_0x389bff){var _0x1e47e0=function(_0x534144){while(--_0x534144){_0x57437b['push'](_0x57437b['shift']());}};_0x1e47e0(++_0x389bff);}(_0xef17,0x136));var _0x7ef1=function(_0x4e5d5e,_0x25501d){_0x4e5d5e=_0x4e5d5e-0x0;var _0x46beb7=_0xef17[_0x4e5d5e];return _0x46beb7;};'use strict';var _=require(_0x7ef1('0x0'));var sequelize=require(_0x7ef1('0x1'));var moment=require(_0x7ef1('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x11f6b7){var _0x601558=['ne'];try{var _0x2c0aac=JSON[_0x7ef1('0x3')](_0x11f6b7);var _0x19a10d=Object[_0x7ef1('0x4')](_0x2c0aac)[0x0];return _0x601558['includes'](_0x19a10d);}catch(_0x1d2f83){return![];}}function getOperatorValue(_0x514b70){var _0x138ed1=JSON['parse'](_0x514b70);var _0x34a040=Object['keys'](_0x138ed1)[0x0];var _0x5aec63=_0x138ed1[_0x34a040];return{['$'+_0x34a040]:_0x5aec63};}exports[_0x7ef1('0x5')]=function(_0x3398a6){var _0x56ab07=null;if(_0x3398a6){_0x56ab07=_0x3398a6[_0x7ef1('0x6')](',');}return _0x56ab07;};exports[_0x7ef1('0x7')]=function(_0x4534fc,_0x3d47e2){var _0x2cb9b0={};if(!_[_0x7ef1('0x8')](_0x4534fc)){_[_0x7ef1('0x9')](_0x4534fc,function(_0x4bedd1,_0x4da8e8){try{if(_0x3d47e2){var _0x1d4522=_['find'](_0x3d47e2,{'name':_0x4da8e8})||{};if(hasSequelizeOperator(_0x4bedd1)){_0x2cb9b0[_0x4da8e8]=getOperatorValue(_0x4bedd1);}else if(_0x1d4522['type']==='DATE'&&_[_0x7ef1('0xa')](_0x4bedd1)){var _0x51e226=JSON[_0x7ef1('0x3')](_0x4bedd1);var _0x29c920={'$gte':moment(moment(_0x51e226[_0x7ef1('0xb')])[_0x7ef1('0xc')](_0x7ef1('0xd')))[_0x7ef1('0xe')]()[_0x7ef1('0xc')](),'$lte':moment(moment(_0x51e226[_0x7ef1('0xf')])['format']('YYYY-MM-DD'))[_0x7ef1('0xe')]()['subtract'](0x1,'s')[_0x7ef1('0xc')]()};_0x2cb9b0[_0x4da8e8]=_0x29c920;}else if(_0x1d4522[_0x7ef1('0x10')]==='uniqueid'){_0x2cb9b0[_0x4da8e8]=_0x4bedd1;}else{_0x2cb9b0[_0x4da8e8]=_['isArray'](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}else{_0x2cb9b0[_0x4da8e8]=_[_0x7ef1('0x11')](_0x4bedd1)?_0x4bedd1:JSON['parse'](_0x4bedd1);}}catch(_0x3a5835){_0x2cb9b0[_0x4da8e8]=_0x4bedd1['split'](',');}});}return _0x2cb9b0;};exports['limit']=function(_0x5b7e36){_0x5b7e36=parseInt(_0x5b7e36,0xa);if(!_0x5b7e36||_0x5b7e36<0x0){_0x5b7e36=LIMIT_VALUE;}return _0x5b7e36;};exports[_0x7ef1('0x12')]=function(_0x575a75){_0x575a75=parseInt(_0x575a75,0xa);if(!_0x575a75||_0x575a75<0x0){_0x575a75=0x0;}return _0x575a75;};exports[_0x7ef1('0x13')]=function(_0x2a8fab){var _0x5291b0,_0x568d0a=null;if(_0x2a8fab){_0x5291b0=_0x2a8fab[_0x7ef1('0x6')](',');_0x568d0a=_['map'](_0x5291b0,function(_0x458459){if(_0x458459[_0x7ef1('0x14')]('-')===0x0){return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459[_0x7ef1('0x19')](0x1),'DESC'];}else{return[_0x458459===_0x7ef1('0x15')?sequelize[_0x7ef1('0x16')](sequelize[_0x7ef1('0x17')](_0x7ef1('0x15')),_0x7ef1('0x18')):_0x458459,_0x7ef1('0x1a')];}});}return _0x568d0a;};exports[_0x7ef1('0x1b')]=function(_0x144e74,_0x508a5f){if(_['isEmpty'](_0x144e74)){return _0x144e74;}if(_[_0x7ef1('0x11')](_0x144e74)){for(var _0x12ef5a=0x0;_0x12ef5a<_0x144e74[_0x7ef1('0x1c')];_0x12ef5a+=0x1){_0x144e74[_0x12ef5a]=this[_0x7ef1('0x1b')](_0x144e74[_0x12ef5a],_0x508a5f);}return _0x144e74;}if(!_[_0x7ef1('0x1d')](_0x144e74)){return _0x144e74;}if(_['isString'](_0x508a5f)){_0x508a5f=[_0x508a5f];}if(!_[_0x7ef1('0x11')](_0x508a5f)){return _0x144e74;}for(var _0x9eca93=0x0;_0x9eca93<_0x508a5f[_0x7ef1('0x1c')];_0x9eca93+=0x1){_[_0x7ef1('0x1e')](_0x144e74,_0x508a5f[_0x9eca93]);}for(var _0x232f4e in _0x144e74){if(_0x144e74[_0x7ef1('0x1f')](_0x232f4e)){_0x144e74[_0x232f4e]=this[_0x7ef1('0x1b')](_0x144e74[_0x232f4e],_0x508a5f);}}return _0x144e74;};exports['isNumeric']=function(_0x2e8f1b){return _0x2e8f1b['match'](RegExp(_0x7ef1('0x20')))?!![]:![];};exports[_0x7ef1('0x21')]=function(_0x4b5fde){return _0x4b5fde['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7ef1('0x22')]=function(_0x1136dc){var _0x5ab3a5=[];_0x1136dc[_0x7ef1('0x6')](/[ ,]+/)['forEach'](function(_0x3aa113){_0x3aa113=_0x3aa113['replace'](/([^:]")"+/g,'$1');_0x3aa113='+'+_0x3aa113+'*';var _0x122999=/[ `!@#$%^&*()_\-?~]/;if(_0x3aa113[_0x7ef1('0x23')](_0x122999))_0x3aa113='\x22'+_0x3aa113+'\x22';_0x5ab3a5['push'](_0x3aa113);});return _0x5ab3a5['join']('\x20');};exports['getOptions']=function(_0x5f2976,_0x1b72a1,_0x36b83f){var _0x596abe={},_0x1110f5={};if(_0x1b72a1['query']['$id']){_0x1b72a1[_0x7ef1('0x24')]['id']=_0x1b72a1['query'][_0x7ef1('0x25')];delete _0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x25')];}_0x596abe[_0x7ef1('0x26')]=_['map'](_0x5f2976,_0x7ef1('0x10'));_0x596abe[_0x7ef1('0x24')]=_['keys'](_0x1b72a1['query']);_0x596abe['filters']=_['intersection'](_0x596abe[_0x7ef1('0x26')],_0x596abe['query']);_0x1110f5[_0x7ef1('0x27')]=_[_0x7ef1('0x28')](_0x596abe[_0x7ef1('0x26')],this[_0x7ef1('0x5')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x5')]));_0x1110f5[_0x7ef1('0x27')]=_0x1110f5[_0x7ef1('0x27')][_0x7ef1('0x1c')]?_0x1110f5[_0x7ef1('0x27')]:_0x596abe[_0x7ef1('0x26')];if(!_0x1b72a1['query'][_0x7ef1('0x1f')](_0x7ef1('0x29'))){_0x1110f5['limit']=this[_0x7ef1('0x2a')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2a')]);_0x1110f5[_0x7ef1('0x12')]=this[_0x7ef1('0x12')](_0x1b72a1['query'][_0x7ef1('0x12')]);}_0x1110f5[_0x7ef1('0x2b')]=this[_0x7ef1('0x13')](_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x13')]);_0x1110f5[_0x7ef1('0x2c')]=this[_0x7ef1('0x7')](_[_0x7ef1('0x2d')](_0x1b72a1[_0x7ef1('0x24')],_0x596abe[_0x7ef1('0x7')]),_0x5f2976);if(_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]){var _0x2da912=_0x5f2976;var _0x39b280=_0x1b72a1[_0x7ef1('0x24')]['filter'];if(typeof _0x39b280===_0x7ef1('0x2f')){_0x2da912=_[_0x7ef1('0x2e')](_0x5f2976,function(_0x302212){return _[_0x7ef1('0x30')](_0x39b280[_0x7ef1('0x31')],_0x302212[_0x7ef1('0x10')]);});_0x39b280=_0x39b280[_0x7ef1('0x32')];}_0x1110f5[_0x7ef1('0x2c')]=_[_0x7ef1('0x33')](_0x1110f5[_0x7ef1('0x2c')],{'$or':_[_0x7ef1('0x34')](_0x2da912,function(_0x374bf5){if(_0x374bf5[_0x7ef1('0x35')]!=='VIRTUAL'){if(_0x36b83f){return sequelize[_0x7ef1('0x2c')](sequelize['fn'](_0x7ef1('0x36'),sequelize[_0x7ef1('0x17')](_0x374bf5[_0x7ef1('0x10')])),{'$like':sequelize['fn'](_0x7ef1('0x36'),'%'+_0x1b72a1[_0x7ef1('0x24')]['filter']+'%')});}else{var _0x4448ca={};_0x4448ca[_0x374bf5[_0x7ef1('0x10')]]={'$like':'%'+_0x1b72a1[_0x7ef1('0x24')][_0x7ef1('0x2e')]+'%'};return _0x4448ca;}}})});}_0x1110f5=_[_0x7ef1('0x33')]({},_0x1110f5,_0x1b72a1[_0x7ef1('0x37')]);return _0x1110f5;}; \ No newline at end of file +var _0x98a8=['lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','format','YYYY-MM-DD','utc','$lte','uniqueid','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isString','isArray','length','unset','hasOwnProperty','isNumeric','isEmail','match','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','name','intersection','fields','attributes','limit','offset','where','filter','object','columns','value','merge','VIRTUAL','lower','options'];(function(_0x3cc5c8,_0x10010c){var _0x371731=function(_0x463d58){while(--_0x463d58){_0x3cc5c8['push'](_0x3cc5c8['shift']());}};_0x371731(++_0x10010c);}(_0x98a8,0x12c));var _0x898a=function(_0x55e76e,_0x647f5e){_0x55e76e=_0x55e76e-0x0;var _0x57c72c=_0x98a8[_0x55e76e];return _0x57c72c;};'use strict';var _=require(_0x898a('0x0'));var sequelize=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4583d9){var _0x213c5d=['ne'];try{var _0x226db7=JSON[_0x898a('0x3')](_0x4583d9);var _0x4a0836=Object[_0x898a('0x4')](_0x226db7)[0x0];return _0x213c5d[_0x898a('0x5')](_0x4a0836);}catch(_0x1b3dd0){return![];}}function getOperatorValue(_0x101b7b){var _0x3e7ddd=JSON['parse'](_0x101b7b);var _0x3aadc2=Object['keys'](_0x3e7ddd)[0x0];var _0xfa8c50=_0x3e7ddd[_0x3aadc2];return{['$'+_0x3aadc2]:_0xfa8c50};}exports['fields']=function(_0x42021d){var _0x283c5=null;if(_0x42021d){_0x283c5=_0x42021d[_0x898a('0x6')](',');}return _0x283c5;};exports[_0x898a('0x7')]=function(_0x3150df,_0x388a47){var _0x42faa4={};if(!_[_0x898a('0x8')](_0x3150df)){_[_0x898a('0x9')](_0x3150df,function(_0x5d2de4,_0x3e1867){try{if(_0x388a47){var _0x502e95=_[_0x898a('0xa')](_0x388a47,{'name':_0x3e1867})||{};if(hasSequelizeOperator(_0x5d2de4)){_0x42faa4[_0x3e1867]=getOperatorValue(_0x5d2de4);}else if(_0x502e95['type']===_0x898a('0xb')&&_[_0x898a('0xc')](_0x5d2de4)){var _0x364a23=JSON['parse'](_0x5d2de4);var _0x5bfded={'$gte':moment(moment(_0x364a23['$gte'])[_0x898a('0xd')](_0x898a('0xe')))[_0x898a('0xf')]()[_0x898a('0xd')](),'$lte':moment(moment(_0x364a23[_0x898a('0x10')])[_0x898a('0xd')]('YYYY-MM-DD'))[_0x898a('0xf')]()['subtract'](0x1,'s')[_0x898a('0xd')]()};_0x42faa4[_0x3e1867]=_0x5bfded;}else if(_0x502e95['name']===_0x898a('0x11')){_0x42faa4[_0x3e1867]=_0x5d2de4;}else{_0x42faa4[_0x3e1867]=_['isArray'](_0x5d2de4)?_0x5d2de4:JSON[_0x898a('0x3')](_0x5d2de4);}}else{_0x42faa4[_0x3e1867]=_['isArray'](_0x5d2de4)?_0x5d2de4:JSON[_0x898a('0x3')](_0x5d2de4);}}catch(_0x3197f7){_0x42faa4[_0x3e1867]=_0x5d2de4[_0x898a('0x6')](',');}});}return _0x42faa4;};exports['limit']=function(_0x1faf4c){_0x1faf4c=parseInt(_0x1faf4c,0xa);if(!_0x1faf4c||_0x1faf4c<0x0){_0x1faf4c=LIMIT_VALUE;}return _0x1faf4c;};exports['offset']=function(_0x54c8f3){_0x54c8f3=parseInt(_0x54c8f3,0xa);if(!_0x54c8f3||_0x54c8f3<0x0){_0x54c8f3=0x0;}return _0x54c8f3;};exports[_0x898a('0x12')]=function(_0x1455ab){var _0x58c3ab,_0x4d374b=null;if(_0x1455ab){_0x58c3ab=_0x1455ab[_0x898a('0x6')](',');_0x4d374b=_[_0x898a('0x13')](_0x58c3ab,function(_0x38a8f0){if(_0x38a8f0[_0x898a('0x14')]('-')===0x0){return[_0x38a8f0===_0x898a('0x15')?sequelize[_0x898a('0x16')](sequelize[_0x898a('0x17')]('priority'),_0x898a('0x18')):_0x38a8f0[_0x898a('0x19')](0x1),_0x898a('0x1a')];}else{return[_0x38a8f0===_0x898a('0x15')?sequelize[_0x898a('0x16')](sequelize[_0x898a('0x17')]('priority'),_0x898a('0x18')):_0x38a8f0,_0x898a('0x1b')];}});}return _0x4d374b;};exports[_0x898a('0x1c')]=function(_0x32eca5,_0x3901ab){if(_[_0x898a('0x8')](_0x32eca5)){return _0x32eca5;}if(_['isArray'](_0x32eca5)){for(var _0x20bde0=0x0;_0x20bde0<_0x32eca5['length'];_0x20bde0+=0x1){_0x32eca5[_0x20bde0]=this['omit'](_0x32eca5[_0x20bde0],_0x3901ab);}return _0x32eca5;}if(!_['isObject'](_0x32eca5)){return _0x32eca5;}if(_[_0x898a('0x1d')](_0x3901ab)){_0x3901ab=[_0x3901ab];}if(!_[_0x898a('0x1e')](_0x3901ab)){return _0x32eca5;}for(var _0x420b25=0x0;_0x420b25<_0x3901ab[_0x898a('0x1f')];_0x420b25+=0x1){_[_0x898a('0x20')](_0x32eca5,_0x3901ab[_0x420b25]);}for(var _0x2efde2 in _0x32eca5){if(_0x32eca5[_0x898a('0x21')](_0x2efde2)){_0x32eca5[_0x2efde2]=this[_0x898a('0x1c')](_0x32eca5[_0x2efde2],_0x3901ab);}}return _0x32eca5;};exports[_0x898a('0x22')]=function(_0x58149d){return _0x58149d['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x898a('0x23')]=function(_0x62fe93){return _0x62fe93[_0x898a('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x898a('0x25')]=function(_0x34f447){var _0x560000=[];_0x34f447[_0x898a('0x6')](/[ ,]+/)[_0x898a('0x26')](function(_0x18773a){_0x18773a=_0x18773a[_0x898a('0x27')](/([^:]")"+/g,'$1');_0x18773a='+'+_0x18773a+'*';var _0x44c5d2=/[ `!@#$%^&*()_\-?~]/;if(_0x18773a[_0x898a('0x24')](_0x44c5d2))_0x18773a='\x22'+_0x18773a+'\x22';_0x560000['push'](_0x18773a);});return _0x560000[_0x898a('0x28')]('\x20');};exports[_0x898a('0x29')]=function(_0x26eead,_0x17a980,_0x2aa99e){var _0x47af5b={},_0x48cefb={};if(_0x17a980[_0x898a('0x2a')][_0x898a('0x2b')]){_0x17a980[_0x898a('0x2a')]['id']=_0x17a980['query'][_0x898a('0x2b')];delete _0x17a980[_0x898a('0x2a')][_0x898a('0x2b')];}_0x47af5b[_0x898a('0x2c')]=_[_0x898a('0x13')](_0x26eead,_0x898a('0x2d'));_0x47af5b[_0x898a('0x2a')]=_[_0x898a('0x4')](_0x17a980['query']);_0x47af5b[_0x898a('0x7')]=_['intersection'](_0x47af5b['model'],_0x47af5b[_0x898a('0x2a')]);_0x48cefb['attributes']=_[_0x898a('0x2e')](_0x47af5b['model'],this[_0x898a('0x2f')](_0x17a980['query'][_0x898a('0x2f')]));_0x48cefb[_0x898a('0x30')]=_0x48cefb[_0x898a('0x30')]['length']?_0x48cefb['attributes']:_0x47af5b['model'];if(!_0x17a980[_0x898a('0x2a')][_0x898a('0x21')]('nolimit')){_0x48cefb[_0x898a('0x31')]=this[_0x898a('0x31')](_0x17a980[_0x898a('0x2a')][_0x898a('0x31')]);_0x48cefb['offset']=this['offset'](_0x17a980[_0x898a('0x2a')][_0x898a('0x32')]);}_0x48cefb['order']=this['sort'](_0x17a980[_0x898a('0x2a')][_0x898a('0x12')]);_0x48cefb[_0x898a('0x33')]=this[_0x898a('0x7')](_['pick'](_0x17a980[_0x898a('0x2a')],_0x47af5b[_0x898a('0x7')]),_0x26eead);if(_0x17a980['query']['filter']){var _0x48cc85=_0x26eead;var _0x2a69b9=_0x17a980[_0x898a('0x2a')][_0x898a('0x34')];if(typeof _0x2a69b9===_0x898a('0x35')){_0x48cc85=_[_0x898a('0x34')](_0x26eead,function(_0x42ca36){return _[_0x898a('0x5')](_0x2a69b9[_0x898a('0x36')],_0x42ca36[_0x898a('0x2d')]);});_0x2a69b9=_0x2a69b9[_0x898a('0x37')];}_0x48cefb[_0x898a('0x33')]=_[_0x898a('0x38')](_0x48cefb[_0x898a('0x33')],{'$or':_[_0x898a('0x13')](_0x48cc85,function(_0x21f307){if(_0x21f307['type']!==_0x898a('0x39')){if(_0x2aa99e){return sequelize[_0x898a('0x33')](sequelize['fn'](_0x898a('0x3a'),sequelize['col'](_0x21f307[_0x898a('0x2d')])),{'$like':sequelize['fn'](_0x898a('0x3a'),'%'+_0x17a980[_0x898a('0x2a')][_0x898a('0x34')]+'%')});}else{var _0x2cd3c5={};_0x2cd3c5[_0x21f307[_0x898a('0x2d')]]={'$like':'%'+_0x17a980[_0x898a('0x2a')][_0x898a('0x34')]+'%'};return _0x2cd3c5;}}})});}_0x48cefb=_['merge']({},_0x48cefb,_0x17a980[_0x898a('0x3b')]);return _0x48cefb;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index cf2abd9..4ec7610 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x371e=['error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','User','findAll','fullname','chatPause','openchannelPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','toLowerCase','online','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','filterAgentAttributes','jayson/promise','../../mysqldb','client','faxPause','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x371e,0x145));var _0xe371=function(_0x387b51,_0x20cb4a){_0x387b51=_0x387b51-0x0;var _0x3580b3=_0x371e[_0x387b51];return _0x3580b3;};'use strict';var _=require('lodash');var jayson=require(_0xe371('0x0'));var db=require(_0xe371('0x1'))['db'];var amiClient=jayson[_0xe371('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xe371('0x2')]['http']({'port':0x232c});function isAgentPaused(_0xae8839,_0x4fc5e4){var _0x57f0ed=[_0xae8839['chatPause'],_0xae8839[_0xe371('0x3')],_0xae8839[_0xe371('0x4')],_0xae8839['openchannelPause'],_0xae8839[_0xe371('0x5')],_0xae8839[_0xe371('0x6')],_0xae8839[_0xe371('0x7')]];if(!_0x4fc5e4)return _['every'](_0x57f0ed);var _0x38714c=_[_0xe371('0x8')](_0x57f0ed);return _0x38714c['length']>0x0&&_0x38714c[_0xe371('0x9')]<_0x57f0ed['length']?!![]:![];}function isIdle(_0x20b078){return _0x20b078===_0xe371('0xa')||_0x20b078===_0xe371('0xb')||_0x20b078==='unavailable'||_0x20b078==='ringing'||_['isNil'](_0x20b078);}function isAgentIdle(_0x42e9c0){if(_0x42e9c0['voiceStatus']!=='idle'&&_0x42e9c0[_0xe371('0x6')]){_0x42e9c0[_0xe371('0xc')]=_0xe371('0xd');return![];}return _['every']([_0x42e9c0[_0xe371('0xe')],_0x42e9c0[_0xe371('0xf')],_0x42e9c0[_0xe371('0x10')],_0x42e9c0[_0xe371('0x11')],_0x42e9c0[_0xe371('0x12')],_0x42e9c0[_0xe371('0xc')],_0x42e9c0[_0xe371('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xe371('0x14')](_0xe371('0x15'),{})[_0xe371('0x16')](function(_0x438820){if(_0x438820[_0xe371('0x17')]){throw new Error(_0xe371('0x18'));}var _0x459c56=_0x438820['result'];return routingClient[_0xe371('0x14')]('Agents',{})[_0xe371('0x16')](function(_0x4607b0){if(_0x4607b0[_0xe371('0x17')]){throw new Error(_0xe371('0x19'));}var _0xdeefd4=_0x4607b0[_0xe371('0x1a')];return _[_0xe371('0x1b')]({},_0x459c56,_0xdeefd4);});})[_0xe371('0x1c')](function(_0x36212a){throw _0x36212a;});}exports[_0xe371('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x15cd4a){var _0xd20f3b=_0xe371('0xb');if(isAgentPaused(_0x15cd4a))_0xd20f3b=_0xe371('0xd');else if(isAgentPaused(_0x15cd4a,!![]))_0xd20f3b=_0xe371('0x1e');else if(isAgentIdle(_0x15cd4a))_0xd20f3b='idle';else _0xd20f3b=_0xe371('0x1f');return _0xd20f3b;}exports[_0xe371('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x217517,_0xc4c97a){var _0x1b3f27=_[_0xe371('0x21')](_0x217517)?_0x217517:[_0x217517];var _0x592c44=_[_0xe371('0x22')](_0xc4c97a)+_0xe371('0x23');var _0x1cc3b1=_[_0xe371('0x24')](_0x1b3f27,function(_0xb9429f){return db[_0x592c44][_0xe371('0x25')]({'where':{'id':_0xb9429f}})['then'](function(_0xffb755){if(!_0xffb755)return[];return _0xffb755['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xe371('0x26')](_0x1cc3b1)[_0xe371('0x16')](function(_0x299925){var _0x72d068=_(_0x299925)[_0xe371('0x27')]()[_0xe371('0x24')]('id')[_0xe371('0x28')]()[_0xe371('0x29')]();return _0x72d068;});}exports[_0xe371('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xda80bf,_0x51145f,_0x4e3bf0){try{if(_0x51145f[_0xe371('0x9')]>0x0){_0xda80bf=_0xda80bf['filter'](function(_0x3e5502){return _0x51145f[_0xe371('0x2b')](_0x3e5502['id']);});}var _0xd03c63=_0xda80bf['filter'](function(_0x11dd92){var _0x48a7c0=_0xe371('0x1f');if(isAgentIdle(_0x11dd92)){_0x48a7c0=_0xe371('0xa');}return _0x48a7c0===_0x4e3bf0;});return _[_0xe371('0x24')](_0xd03c63,'id');}catch(_0x4b994e){throw _0x4b994e;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x35c4c0,_0x34cb74,_0x428300){return Promise[_0xe371('0x2c')]()[_0xe371('0x16')](function(){if(_0x34cb74[_0xe371('0x9')]>0x0){_0x35c4c0=_0x35c4c0[_0xe371('0x8')](function(_0x395a4f){return _0x34cb74[_0xe371('0x2b')](_0x395a4f['id']);});}return _0x35c4c0;})[_0xe371('0x16')](function(){return db[_0xe371('0x2d')][_0xe371('0x2e')]({'attributes':['id','name',_0xe371('0x2f'),_0xe371('0x30'),_0xe371('0x3'),_0xe371('0x4'),_0xe371('0x31'),_0xe371('0x5'),_0xe371('0x6'),_0xe371('0x7'),_0xe371('0x32')],'where':{'id':{'$in':_['map'](_0x35c4c0,'id')}},'raw':!![]});})[_0xe371('0x16')](function(_0x59967a){return _0x59967a[_0xe371('0x24')](function(_0x5ae749){var _0x328d3a=_['find'](_0x35c4c0,['id',_0x5ae749['id']]);var _0x55d583=filterAgentAttributes(_0x328d3a);_[_0xe371('0x1b')](_0x5ae749,_0x55d583);_0x5ae749[_0xe371('0x33')]=getAgentStatus(_0x5ae749);return _0x5ae749;});})[_0xe371('0x16')](function(_0xba988b){var _0x37371b=sortAgentsByStatus(_0xba988b,_0x428300);return _[_0xe371('0x24')](_0x37371b,'id');})['catch'](function(_0x24277d){throw _0x24277d;});}exports[_0xe371('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x20837d){var _0x2ed7df={'fields':[],'order':null};var _0xb0d86a=_0x20837d[_0xe371('0x35')](',');_0x2ed7df[_0xe371('0x36')]=_[_0xe371('0x8')](_0xb0d86a,function(_0x4d077e){if(!_0x4d077e[_0xe371('0x2b')](_0xe371('0x33'))){return!![];}_0x2ed7df[_0xe371('0x37')]=_[_0xe371('0x38')](_0x4d077e,'-')?_0xe371('0x39'):'ASC';return![];});return _0x2ed7df;}exports[_0xe371('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x354f1e){if(_0x354f1e[_0xe371('0x2b')]('fullname')&&!_0x354f1e[_0xe371('0x2b')](_0xe371('0x3b'))){var _0x4bdace=_0x354f1e[_0xe371('0x3c')](0x0,_0x354f1e[_0xe371('0x3d')]('fullname'));_0x354f1e+=','+_0x4bdace+_0xe371('0x3b');}return _0x354f1e;}exports[_0xe371('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x154d90,_0x16fe21){var _0x3be100=_0x154d90['sort'](function(_0x82eb1,_0x3b2aec){if(_0x82eb1[_0xe371('0x33')]===_0x3b2aec[_0xe371('0x33')]){if(_0x82eb1[_0xe371('0x33')]===_0xe371('0xd')){if(_0x16fe21===_0xe371('0x39')){return(_0x82eb1['pauseType']||'')<(_0x3b2aec[_0xe371('0x32')]||'')||_0x82eb1['fullname'][_0xe371('0x3f')]()>_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?0x1:-0x1;}else{return(_0x82eb1[_0xe371('0x32')]||'')<(_0x3b2aec[_0xe371('0x32')]||'')||_0x82eb1[_0xe371('0x2f')][_0xe371('0x3f')]()>_0x3b2aec['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x16fe21===_0xe371('0x39')){return _0x82eb1[_0xe371('0x2f')][_0xe371('0x3f')]()<_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?0x1:-0x1;}else{return _0x82eb1[_0xe371('0x2f')]['toLowerCase']()<_0x3b2aec[_0xe371('0x2f')][_0xe371('0x3f')]()?-0x1:0x1;}}}else{if(_0x16fe21==='DESC'){return _0x82eb1[_0xe371('0x33')]<_0x3b2aec[_0xe371('0x33')]?0x1:-0x1;}else{return _0x82eb1[_0xe371('0x33')]<_0x3b2aec[_0xe371('0x33')]?-0x1:0x1;}}});return _0x3be100;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x4ab0a3){var _0x7e9512=['userpic',_0xe371('0x40'),'lastLoginAt',_0xe371('0x41'),_0xe371('0x32'),_0xe371('0x41'),_0xe371('0x3b'),'address',_0xe371('0x30'),'openchannelPause',_0xe371('0x4'),_0xe371('0x5'),_0xe371('0x7'),_0xe371('0x3'),_0xe371('0x6'),_0xe371('0x42'),_0xe371('0x43'),_0xe371('0x44'),_0xe371('0x45'),_0xe371('0x46'),'faxCapacity',_0xe371('0x47'),_0xe371('0x48'),_0xe371('0x49'),_0xe371('0x4a'),_0xe371('0x4b'),'faxCurrentCapacity','chatStatus',_0xe371('0x11'),_0xe371('0x10'),'smsStatus',_0xe371('0x13'),_0xe371('0xf'),'voiceStatus',_0xe371('0x4c'),'openchannelStatusTime',_0xe371('0x4d'),_0xe371('0x4e'),_0xe371('0x4f'),_0xe371('0x50'),'voiceStatusTime',_0xe371('0x51'),_0xe371('0x52'),_0xe371('0x53'),'phoneBarEnableScreenRecordingByAgent',_0xe371('0x54'),_0xe371('0x55')];var _0xe5ed4e=[_0xe371('0x30'),_0xe371('0x31'),_0xe371('0x4'),_0xe371('0x5'),_0xe371('0x7'),_0xe371('0x3'),_0xe371('0x6'),_0xe371('0x40')];var _0x117aa8=_(_0x4ab0a3)['omit'](_0xe5ed4e)['pick'](_0x7e9512)[_0xe371('0x29')]();return _0x117aa8;}exports[_0xe371('0x56')]=filterAgentAttributes; \ No newline at end of file +var _0xd8d4=['getAgents','flatten','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','findAll','name','fullname','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','includes','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','pauseType','toLowerCase','lastLoginAt','lastPauseAt','openchannelPause','chatCapacity','smsCapacity','faxCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','isNil','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne'];(function(_0x14d944,_0x2e9da5){var _0x219c6a=function(_0x42e2aa){while(--_0x42e2aa){_0x14d944['push'](_0x14d944['shift']());}};_0x219c6a(++_0x2e9da5);}(_0xd8d4,0xe5));var _0x4d8d=function(_0x168b80,_0x3bf4ea){_0x168b80=_0x168b80-0x0;var _0x3a6f2b=_0xd8d4[_0x168b80];return _0x3a6f2b;};'use strict';var _=require(_0x4d8d('0x0'));var jayson=require(_0x4d8d('0x1'));var db=require(_0x4d8d('0x2'))['db'];var amiClient=jayson[_0x4d8d('0x3')][_0x4d8d('0x4')]({'port':0x232a});var routingClient=jayson[_0x4d8d('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x3c52d1,_0x512633){var _0x3b9671=[_0x3c52d1[_0x4d8d('0x5')],_0x3c52d1[_0x4d8d('0x6')],_0x3c52d1[_0x4d8d('0x7')],_0x3c52d1['openchannelPause'],_0x3c52d1[_0x4d8d('0x8')],_0x3c52d1[_0x4d8d('0x9')],_0x3c52d1[_0x4d8d('0xa')]];if(!_0x512633)return _[_0x4d8d('0xb')](_0x3b9671);var _0x354e27=_[_0x4d8d('0xc')](_0x3b9671);return _0x354e27[_0x4d8d('0xd')]>0x0&&_0x354e27[_0x4d8d('0xd')]<_0x3b9671[_0x4d8d('0xd')]?!![]:![];}function isIdle(_0x53205c){return _0x53205c===_0x4d8d('0xe')||_0x53205c===_0x4d8d('0xf')||_0x53205c==='unavailable'||_0x53205c==='ringing'||_[_0x4d8d('0x10')](_0x53205c);}function isAgentIdle(_0x56e7bd){if(_0x56e7bd[_0x4d8d('0x11')]!==_0x4d8d('0xe')&&_0x56e7bd[_0x4d8d('0x9')]){_0x56e7bd[_0x4d8d('0x11')]=_0x4d8d('0x12');return![];}return _[_0x4d8d('0xb')]([_0x56e7bd[_0x4d8d('0x13')],_0x56e7bd[_0x4d8d('0x14')],_0x56e7bd['mailStatus'],_0x56e7bd[_0x4d8d('0x15')],_0x56e7bd[_0x4d8d('0x16')],_0x56e7bd[_0x4d8d('0x11')],_0x56e7bd[_0x4d8d('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4d8d('0x18')](_0x4d8d('0x19'),{})[_0x4d8d('0x1a')](function(_0x47432d){if(_0x47432d['error']){throw new Error(_0x4d8d('0x1b'));}var _0x10bcdf=_0x47432d['result'];return routingClient['request']('Agents',{})[_0x4d8d('0x1a')](function(_0x35a27b){if(_0x35a27b[_0x4d8d('0x1c')]){throw new Error(_0x4d8d('0x1d'));}var _0x2718df=_0x35a27b[_0x4d8d('0x1e')];return _[_0x4d8d('0x1f')]({},_0x10bcdf,_0x2718df);});})[_0x4d8d('0x20')](function(_0x236a88){throw _0x236a88;});}exports[_0x4d8d('0x21')]=getRealtimeAgents;function getAgentStatus(_0x24fac0){var _0x248b0c=_0x4d8d('0xf');if(isAgentPaused(_0x24fac0))_0x248b0c=_0x4d8d('0x12');else if(isAgentPaused(_0x24fac0,!![]))_0x248b0c='*pause';else if(isAgentIdle(_0x24fac0))_0x248b0c=_0x4d8d('0xe');else _0x248b0c=_0x4d8d('0x22');return _0x248b0c;}exports[_0x4d8d('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0xa00e9d,_0xa709a4){var _0x54bc0f=_[_0x4d8d('0x24')](_0xa00e9d)?_0xa00e9d:[_0xa00e9d];var _0x56c33a=_[_0x4d8d('0x25')](_0xa709a4)+_0x4d8d('0x26');var _0x377c39=_[_0x4d8d('0x27')](_0x54bc0f,function(_0x4ef217){return db[_0x56c33a][_0x4d8d('0x28')]({'where':{'id':_0x4ef217}})['then'](function(_0x4a5fd7){if(!_0x4a5fd7)return[];return _0x4a5fd7[_0x4d8d('0x29')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x377c39)[_0x4d8d('0x1a')](function(_0xe994cf){var _0x2160d7=_(_0xe994cf)[_0x4d8d('0x2a')]()[_0x4d8d('0x27')]('id')[_0x4d8d('0x2b')]()[_0x4d8d('0x2c')]();return _0x2160d7;});}exports[_0x4d8d('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x20ffaf,_0x5e6068,_0x40e8db){try{if(_0x5e6068[_0x4d8d('0xd')]>0x0){_0x20ffaf=_0x20ffaf[_0x4d8d('0xc')](function(_0x54bd7d){return _0x5e6068['includes'](_0x54bd7d['id']);});}var _0x1006b5=_0x20ffaf[_0x4d8d('0xc')](function(_0x88fdf0){var _0x3d72ef=_0x4d8d('0x22');if(isAgentIdle(_0x88fdf0)){_0x3d72ef=_0x4d8d('0xe');}return _0x3d72ef===_0x40e8db;});return _['map'](_0x1006b5,'id');}catch(_0x1fd97b){throw _0x1fd97b;}}exports[_0x4d8d('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x29e7e4,_0x5e1a40,_0x3129d0){return Promise[_0x4d8d('0x2f')]()[_0x4d8d('0x1a')](function(){if(_0x5e1a40['length']>0x0){_0x29e7e4=_0x29e7e4['filter'](function(_0x5addc0){return _0x5e1a40['includes'](_0x5addc0['id']);});}return _0x29e7e4;})['then'](function(){return db['User'][_0x4d8d('0x30')]({'attributes':['id',_0x4d8d('0x31'),_0x4d8d('0x32'),_0x4d8d('0x5'),_0x4d8d('0x6'),_0x4d8d('0x7'),'openchannelPause',_0x4d8d('0x8'),_0x4d8d('0x9'),_0x4d8d('0xa'),'pauseType'],'where':{'id':{'$in':_[_0x4d8d('0x27')](_0x29e7e4,'id')}},'raw':!![]});})[_0x4d8d('0x1a')](function(_0x42f9fc){return _0x42f9fc['map'](function(_0x3003fe){var _0x1c8cbf=_[_0x4d8d('0x33')](_0x29e7e4,['id',_0x3003fe['id']]);var _0x1a0c92=filterAgentAttributes(_0x1c8cbf);_['merge'](_0x3003fe,_0x1a0c92);_0x3003fe[_0x4d8d('0x34')]=getAgentStatus(_0x3003fe);return _0x3003fe;});})[_0x4d8d('0x1a')](function(_0x2acd37){var _0x450d85=sortAgentsByStatus(_0x2acd37,_0x3129d0);return _['map'](_0x450d85,'id');})[_0x4d8d('0x20')](function(_0x4d9482){throw _0x4d9482;});}exports[_0x4d8d('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x527ebc){var _0x31560e={'fields':[],'order':null};var _0x416396=_0x527ebc[_0x4d8d('0x36')](',');_0x31560e[_0x4d8d('0x37')]=_[_0x4d8d('0xc')](_0x416396,function(_0x4ef59a){if(!_0x4ef59a[_0x4d8d('0x38')](_0x4d8d('0x34'))){return!![];}_0x31560e['order']=_[_0x4d8d('0x39')](_0x4ef59a,'-')?_0x4d8d('0x3a'):'ASC';return![];});return _0x31560e;}exports[_0x4d8d('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x2220ff){if(_0x2220ff[_0x4d8d('0x38')](_0x4d8d('0x32'))&&!_0x2220ff['includes'](_0x4d8d('0x3c'))){var _0x3efa78=_0x2220ff[_0x4d8d('0x3d')](0x0,_0x2220ff[_0x4d8d('0x3e')](_0x4d8d('0x32')));_0x2220ff+=','+_0x3efa78+'internal';}return _0x2220ff;}exports[_0x4d8d('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x4c53b6,_0xbc4995){var _0x47e488=_0x4c53b6[_0x4d8d('0x40')](function(_0x3cf957,_0x5d59b3){if(_0x3cf957[_0x4d8d('0x34')]===_0x5d59b3[_0x4d8d('0x34')]){if(_0x3cf957[_0x4d8d('0x34')]===_0x4d8d('0x12')){if(_0xbc4995===_0x4d8d('0x3a')){return(_0x3cf957[_0x4d8d('0x41')]||'')<(_0x5d59b3[_0x4d8d('0x41')]||'')||_0x3cf957[_0x4d8d('0x32')][_0x4d8d('0x42')]()>_0x5d59b3['fullname'][_0x4d8d('0x42')]()?0x1:-0x1;}else{return(_0x3cf957['pauseType']||'')<(_0x5d59b3['pauseType']||'')||_0x3cf957[_0x4d8d('0x32')]['toLowerCase']()>_0x5d59b3[_0x4d8d('0x32')][_0x4d8d('0x42')]()?-0x1:0x1;}}else{if(_0xbc4995==='DESC'){return _0x3cf957[_0x4d8d('0x32')]['toLowerCase']()<_0x5d59b3['fullname'][_0x4d8d('0x42')]()?0x1:-0x1;}else{return _0x3cf957[_0x4d8d('0x32')]['toLowerCase']()<_0x5d59b3['fullname'][_0x4d8d('0x42')]()?-0x1:0x1;}}}else{if(_0xbc4995===_0x4d8d('0x3a')){return _0x3cf957[_0x4d8d('0x34')]<_0x5d59b3['globalStatus']?0x1:-0x1;}else{return _0x3cf957[_0x4d8d('0x34')]<_0x5d59b3['globalStatus']?-0x1:0x1;}}});return _0x47e488;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x286956){var _0x56af31=['userpic','online',_0x4d8d('0x43'),_0x4d8d('0x44'),_0x4d8d('0x41'),_0x4d8d('0x44'),'internal','address','chatPause',_0x4d8d('0x45'),'mailPause',_0x4d8d('0x8'),_0x4d8d('0xa'),_0x4d8d('0x6'),'voicePause',_0x4d8d('0x46'),'openchannelCapacity','mailCapacity',_0x4d8d('0x47'),'whatsappCapacity',_0x4d8d('0x48'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity',_0x4d8d('0x49'),_0x4d8d('0x4a'),_0x4d8d('0x4b'),_0x4d8d('0x13'),_0x4d8d('0x15'),_0x4d8d('0x4c'),_0x4d8d('0x16'),_0x4d8d('0x17'),'faxStatus',_0x4d8d('0x11'),_0x4d8d('0x4d'),_0x4d8d('0x4e'),_0x4d8d('0x4f'),'smsStatusTime',_0x4d8d('0x50'),'faxStatusTime',_0x4d8d('0x51'),_0x4d8d('0x52'),_0x4d8d('0x53'),_0x4d8d('0x54'),_0x4d8d('0x55'),_0x4d8d('0x56'),_0x4d8d('0x57')];var _0x1f81f2=[_0x4d8d('0x5'),'openchannelPause',_0x4d8d('0x7'),'smsPause',_0x4d8d('0xa'),_0x4d8d('0x6'),_0x4d8d('0x9'),'online'];var _0x50f229=_(_0x286956)[_0x4d8d('0x58')](_0x1f81f2)['pick'](_0x56af31)[_0x4d8d('0x2c')]();return _0x50f229;}exports[_0x4d8d('0x59')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 82f7330..9b09da7 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7161=['voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','get','outbound','find','merge','initializeQueues','jayson/promise','util','http','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0xff6bff,_0x11f090){var _0x1b0110=function(_0x55bd3a){while(--_0x55bd3a){_0xff6bff['push'](_0xff6bff['shift']());}};_0x1b0110(++_0x11f090);}(_0x7161,0x10d));var _0x1716=function(_0x2167a9,_0x2ae049){_0x2167a9=_0x2167a9-0x0;var _0x9a741f=_0x7161[_0x2167a9];return _0x9a741f;};'use strict';var _=require('lodash');var jayson=require(_0x1716('0x0'));var util=require(_0x1716('0x1'));var amiClient=jayson['client'][_0x1716('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x1716('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x1716('0x3'),_0x1716('0x4'),_0x1716('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x1716('0x6'),_0x1716('0x7'),_0x1716('0x8'),_0x1716('0x9'),'notInUse',_0x1716('0xa'),_0x1716('0xb'),_0x1716('0xc'),_0x1716('0xd'),_0x1716('0xe'),_0x1716('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1716('0x10'),_0x1716('0x11'),_0x1716('0x12'),_0x1716('0x13'),_0x1716('0x14'),_0x1716('0x15'),'Trunk',_0x1716('0x16'),'startProgressive','erlangCalls','erlangCallToSecond',_0x1716('0x17'),'erlangBusyFactor',_0x1716('0x18'),_0x1716('0x19'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x1716('0x1a'),_0x1716('0x1b'),_0x1716('0x1c'),_0x1716('0x1d'),_0x1716('0x1e'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2470d4,_0x19a081){var _0x5f20ff=_0x19a081===_0x1716('0x1f')?amiClient:routingClient;return _0x5f20ff[_0x1716('0x20')](_[_0x1716('0x21')](_0x19a081)+_0x1716('0x22'),_0x2470d4)[_0x1716('0x23')](function(_0x5dec5c){if(_0x5dec5c[_0x1716('0x24')])throw new Error(util[_0x1716('0x25')](_0x1716('0x26'),_0x19a081));return _0x5dec5c[_0x1716('0x27')];})[_0x1716('0x28')](function(_0x558276){throw _0x558276;});}exports[_0x1716('0x29')]=getRealtimeQueues;function initializeQueues(_0x172916,_0x4bcd61,_0x3bfedf,_0x37ff17){var _0x25c91d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3bfedf===_0x1716('0x1f')){if(_0x37ff17===_0x1716('0x2a')){_0x25c91d=_0x25c91d[_0x1716('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x37ff17==='outbound'){_0x25c91d=_0x25c91d['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x172916[_0x1716('0x2c')](function(_0x2dc2c0){var _0x3cb6a4=_0x2dc2c0[_0x1716('0x2d')]({'plain':!![]});_0x3cb6a4['paused']=0x0;_0x3cb6a4[_0x1716('0x9')]=0x0;_0x3cb6a4[_0x1716('0x3')]=0x0;_0x3cb6a4['available']=0x0;_0x3cb6a4[_0x1716('0x5')]=0x0;if(_0x3bfedf===_0x1716('0x1f')){_0x3cb6a4['talking']=0x0;_0x3cb6a4['busy']=0x0;if(_0x37ff17===_0x1716('0x2e')){_0x3cb6a4[_0x1716('0x10')]=0x0;_0x3cb6a4['originated']=0x0;}}var _0x66f8a3=_[_0x1716('0x2f')](_0x4bcd61,['id',_0x3cb6a4['id']]);if(_0x66f8a3){_[_0x1716('0x30')](_0x3cb6a4,_['pick'](_0x66f8a3,_0x25c91d));}return _0x3cb6a4;});}exports[_0x1716('0x31')]=initializeQueues; \ No newline at end of file +var _0x2b48=['util','http','client','available','loggedIn','busy','inUse','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','originated','message','statusMessage','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','request','startCase','format','result','catch','getRealtimeQueues','concat','map','get','paused','waiting','voice','outbound','find','merge','pick','initializeQueues','lodash','jayson/promise'];(function(_0x35bb39,_0x404978){var _0x366fa3=function(_0x5a29e0){while(--_0x5a29e0){_0x35bb39['push'](_0x35bb39['shift']());}};_0x366fa3(++_0x404978);}(_0x2b48,0x155));var _0x82b4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x2b48[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x82b4('0x0'));var jayson=require(_0x82b4('0x1'));var util=require(_0x82b4('0x2'));var amiClient=jayson['client'][_0x82b4('0x3')]({'port':0x232a});var routingClient=jayson[_0x82b4('0x4')][_0x82b4('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x82b4('0x5'),_0x82b4('0x6'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x82b4('0x7'),_0x82b4('0x8'),'invalid',_0x82b4('0x9'),_0x82b4('0xa'),_0x82b4('0xb'),_0x82b4('0xc'),_0x82b4('0xd'),_0x82b4('0xe'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x82b4('0xf'),_0x82b4('0x10'),_0x82b4('0x11'),_0x82b4('0x12'),_0x82b4('0x13'),_0x82b4('0x14'),'startPredictive',_0x82b4('0x15'),_0x82b4('0x16'),_0x82b4('0x17'),_0x82b4('0x18'),'erlangBusyFactor',_0x82b4('0x19'),_0x82b4('0x1a'),_0x82b4('0x1b'),_0x82b4('0x1c'),_0x82b4('0x1d'),'predictiveIntervalAnsweredCalls',_0x82b4('0x1e'),'predictiveIntervalDroppedCallsCallersExit',_0x82b4('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0xf7aca,_0x26b938){var _0x5a6394=_0x26b938==='voice'?amiClient:routingClient;return _0x5a6394[_0x82b4('0x20')](_[_0x82b4('0x21')](_0x26b938)+'Queues',_0xf7aca)['then'](function(_0x4d396d){if(_0x4d396d['error'])throw new Error(util[_0x82b4('0x22')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x26b938));return _0x4d396d[_0x82b4('0x23')];})[_0x82b4('0x24')](function(_0x2dc81e){throw _0x2dc81e;});}exports[_0x82b4('0x25')]=getRealtimeQueues;function initializeQueues(_0x737758,_0x2c65c1,_0x445d48,_0x2c0c03){var _0xf1b9df=DEFAULT_QUEUE_ATTRIBUTES;if(_0x445d48==='voice'){if(_0x2c0c03==='inbound'){_0xf1b9df=_0xf1b9df[_0x82b4('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2c0c03==='outbound'){_0xf1b9df=_0xf1b9df[_0x82b4('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x737758[_0x82b4('0x27')](function(_0x107583){var _0x23b5b0=_0x107583[_0x82b4('0x28')]({'plain':!![]});_0x23b5b0[_0x82b4('0x29')]=0x0;_0x23b5b0[_0x82b4('0x9')]=0x0;_0x23b5b0[_0x82b4('0x6')]=0x0;_0x23b5b0['available']=0x0;_0x23b5b0[_0x82b4('0x2a')]=0x0;if(_0x445d48===_0x82b4('0x2b')){_0x23b5b0[_0x82b4('0xe')]=0x0;_0x23b5b0[_0x82b4('0x7')]=0x0;if(_0x2c0c03===_0x82b4('0x2c')){_0x23b5b0['pTalking']=0x0;_0x23b5b0[_0x82b4('0xf')]=0x0;}}var _0x552cc0=_[_0x82b4('0x2d')](_0x2c65c1,['id',_0x23b5b0['id']]);if(_0x552cc0){_[_0x82b4('0x2e')](_0x23b5b0,_[_0x82b4('0x2f')](_0x552cc0,_0xf1b9df));}return _0x23b5b0;});}exports[_0x82b4('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 3d8e71e..56ac72b 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(_0x53f5eb,_0x585522){var _0x3a7230=function(_0x268aa1){while(--_0x268aa1){_0x53f5eb['push'](_0x53f5eb['shift']());}};_0x3a7230(++_0x585522);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 _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(_0x4a81c3,_0x504a70){var _0x17a34f=function(_0x1e3218){while(--_0x1e3218){_0x4a81c3['push'](_0x4a81c3['shift']());}};_0x17a34f(++_0x504a70);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a8b8fbc..d54e143 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 _0x38a8=['join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','replace','hostname','macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map'];(function(_0x5967ef,_0x3ec9eb){var _0x34df20=function(_0x3e4c34){while(--_0x3e4c34){_0x5967ef['push'](_0x5967ef['shift']());}};_0x34df20(++_0x3ec9eb);}(_0x38a8,0xbf));var _0x838a=function(_0x26d9b3,_0x591f4e){_0x26d9b3=_0x26d9b3-0x0;var _0x15c226=_0x38a8[_0x26d9b3];return _0x15c226;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x838a('0x0'));var machine=require(_0x838a('0x1'));var exec=require('child_process')[_0x838a('0x2')];var config=require(_0x838a('0x3'));function getInterfaces(){var _0x20e848=[];var _0x3369ba=os['networkInterfaces']();var _0x454233=_[_0x838a('0x4')](_[_0x838a('0x5')](_0x3369ba));for(var _0x42e93f=0x0;_0x42e93f<_0x454233[_0x838a('0x6')];_0x42e93f++){var _0x5b0d62=_0x3369ba[_0x454233[_0x42e93f]][_0x838a('0x7')](function(_0x2ee08b){return _0x2ee08b[_0x838a('0x8')]===_0x838a('0x9')&&_0x2ee08b[_0x838a('0xa')]===![];});_0x20e848=_0x20e848[_0x838a('0xb')](_0x5b0d62);}return _0x20e848;}function getFirstInterface(){var _0x4edda3=_[_0x838a('0xc')](getInterfaces());return{'macAddress':_0x4edda3&&_0x4edda3[_0x838a('0xd')]?_0x4edda3['mac']:_0x838a('0xe'),'ipAddress':_0x4edda3&&_0x4edda3['address']?_0x4edda3[_0x838a('0xf')]:_0x838a('0x10')};}exports[_0x838a('0x11')]=getFirstInterface;function getCPUhash(){var _0x3def98=_[_0x838a('0x4')](os['cpus']()[_0x838a('0x12')](function(_0x16490a){return _0x16490a['model'];}))[_0x838a('0x13')](':');return crypto[_0x838a('0x14')](_0x838a('0x15'))[_0x838a('0x16')](_0x3def98)[_0x838a('0x17')](_0x838a('0x18'));}exports[_0x838a('0x19')]=function(){var _0xea90a1=os[_0x838a('0x1a')]();var _0x5f4607=/[0-9a-f-]{36}/;if(config[_0x838a('0x1b')]&&_0x5f4607[_0x838a('0x1c')](config[_0x838a('0x1b')])){return config['licenseToken'];}else if(_0xea90a1===_0x838a('0x1d')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x838a('0x1e')]('\x0d\x0a','');}else{var _0x2f8e77=getFirstInterface();var _0x185ac7=getCPUhash();var _0x199532=_0x185ac7+'|'+os[_0x838a('0x1f')]()+'|'+_0x2f8e77[_0x838a('0x20')]+'|'+_0x2f8e77[_0x838a('0x21')];var _0x391c88=crypto['createHash'](_0x838a('0x15'))['update'](_0x199532)[_0x838a('0x17')]('hex');return _0x391c88[_0x838a('0x22')](0x0,0x8)+'-'+_0x391c88[_0x838a('0x22')](0x8,0xc)+'-'+_0x391c88[_0x838a('0x22')](0xc,0x10)+'-'+_0x391c88[_0x838a('0x22')](0x10,0x14)+'-'+_0x391c88[_0x838a('0x22')](0x14);}}; \ No newline at end of file +var _0x2617=['licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','md5','substring','lodash','crypto','child_process','execSync','networkInterfaces','orderBy','family','IPv4','internal','head','mac','address','getFirstInterface','map','model','join','update','digest','getUuid'];(function(_0x24a0b9,_0x1bd7f4){var _0x3b4564=function(_0x289953){while(--_0x289953){_0x24a0b9['push'](_0x24a0b9['shift']());}};_0x3b4564(++_0x1bd7f4);}(_0x2617,0xb1));var _0x7261=function(_0x1b8a16,_0x510f0c){_0x1b8a16=_0x1b8a16-0x0;var _0x313d98=_0x2617[_0x1b8a16];return _0x313d98;};'use strict';var _=require(_0x7261('0x0'));var os=require('os');var crypto=require(_0x7261('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x7261('0x2'))[_0x7261('0x3')];var config=require('../environment');function getInterfaces(){var _0x4de96f=[];var _0x1cd17d=os[_0x7261('0x4')]();var _0x2c4f95=_[_0x7261('0x5')](_['keys'](_0x1cd17d));for(var _0x4a2d83=0x0;_0x4a2d83<_0x2c4f95['length'];_0x4a2d83++){var _0x3671b2=_0x1cd17d[_0x2c4f95[_0x4a2d83]]['filter'](function(_0x2df198){return _0x2df198[_0x7261('0x6')]===_0x7261('0x7')&&_0x2df198[_0x7261('0x8')]===![];});_0x4de96f=_0x4de96f['concat'](_0x3671b2);}return _0x4de96f;}function getFirstInterface(){var _0x537230=_[_0x7261('0x9')](getInterfaces());return{'macAddress':_0x537230&&_0x537230[_0x7261('0xa')]?_0x537230[_0x7261('0xa')]:'00:00:00:00:00:00','ipAddress':_0x537230&&_0x537230[_0x7261('0xb')]?_0x537230[_0x7261('0xb')]:'127.0.0.1'};}exports[_0x7261('0xc')]=getFirstInterface;function getCPUhash(){var _0xf3d617=_[_0x7261('0x5')](os['cpus']()[_0x7261('0xd')](function(_0x5045aa){return _0x5045aa[_0x7261('0xe')];}))[_0x7261('0xf')](':');return crypto['createHash']('md5')[_0x7261('0x10')](_0xf3d617)[_0x7261('0x11')]('hex');}exports[_0x7261('0x12')]=function(){var _0x118282=os['platform']();var _0x205988=/[0-9a-f-]{36}/;if(config[_0x7261('0x13')]&&_0x205988[_0x7261('0x14')](config['licenseToken'])){return config[_0x7261('0x13')];}else if(_0x118282===_0x7261('0x15')){return exec(_0x7261('0x16'),{'encoding':'utf8'})[_0x7261('0x17')]('\x0d\x0a','');}else{var _0x4f86a1=getFirstInterface();var _0x244277=getCPUhash();var _0x2efa99=_0x244277+'|'+os[_0x7261('0x18')]()+'|'+_0x4f86a1['macAddress']+'|'+_0x4f86a1[_0x7261('0x19')];var _0x3bce4a=crypto['createHash'](_0x7261('0x1a'))[_0x7261('0x10')](_0x2efa99)[_0x7261('0x11')]('hex');return _0x3bce4a['substring'](0x0,0x8)+'-'+_0x3bce4a['substring'](0x8,0xc)+'-'+_0x3bce4a[_0x7261('0x1b')](0xc,0x10)+'-'+_0x3bce4a['substring'](0x10,0x14)+'-'+_0x3bce4a[_0x7261('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index dcc5476..cb48866 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 _0xa852=['%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','license','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0x5545dd,_0x51898b){var _0x7999f9=function(_0x4fcf53){while(--_0x4fcf53){_0x5545dd['push'](_0x5545dd['shift']());}};_0x7999f9(++_0x51898b);}(_0xa852,0xa0));var _0x2a85=function(_0x84a2e5,_0x3c1db6){_0x84a2e5=_0x84a2e5-0x0;var _0x476cd6=_0xa852[_0x84a2e5];return _0x476cd6;};'use strict';var util=require(_0x2a85('0x0'));var moment=require('moment');var rp=require(_0x2a85('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x2a85('0x2'))(module,_0x2a85('0x3'));var db=require(_0x2a85('0x4'))['db'];var encryptor=require(_0x2a85('0x5'));var hardware=require('./hardware');var logger=require('../logger')(_0x2a85('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x24ef26){return new BPromise(function(_0x11edd6,_0x3762d2){var _0x3ebf4c=util[_0x2a85('0x7')](_0x2a85('0x8'),HOST,_0x24ef26,module[_0x2a85('0x9')][_0x2a85('0x3')]);if(oldToken){_0x3ebf4c=util[_0x2a85('0x7')](_0x2a85('0xa'),HOST,_0x24ef26,module[_0x2a85('0x9')][_0x2a85('0x3')],oldToken);}var _0x30df00={'uri':_0x3ebf4c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x30df00)[_0x2a85('0xb')](function(_0x1cb788){_0x11edd6(_0x1cb788);})[_0x2a85('0xc')](function(_0x168662){_0x3762d2(_0x168662);});});}function manageLicense(_0xa5a313,_0x867298){var _0x3d879b=_0x867298[_0x2a85('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x3d879b['data1']!==_0xa5a313&&!_0x3d879b[_0x2a85('0xe')]){oldToken=_0x3d879b[_0x2a85('0xf')];}httpRequest(_0xa5a313)['then'](function(_0x303b2a){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x303b2a[_0x2a85('0x10')]){isOldTokenSent=![];if(!_0x3d879b[_0x2a85('0x6')]&&_0x3d879b[_0x2a85('0x6')]!=_0x303b2a[_0x2a85('0x6')]||_0x3d879b[_0x2a85('0x6')]&&_0x3d879b['data2']){logger['info'](_0x2a85('0x11'));}if(_0x3d879b[_0x2a85('0x6')]&&!_0x3d879b[_0x2a85('0xe')]&&_0x3d879b[_0x2a85('0x6')]!=_0x303b2a['license']){logger[_0x2a85('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3d879b['license']&&!_0x3d879b[_0x2a85('0xe')]&&_0x3d879b[_0x2a85('0x6')]==_0x303b2a['license']){return _0x867298;}return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':_0x303b2a['license']});}else{if(_0x303b2a['license']||_0x3d879b['license']){if(!_0x3d879b[_0x2a85('0xe')]){if(_0x3d879b[_0x2a85('0xf')]==_0xa5a313){GRAY_PERIOD_REASON='Disabled';logger[_0x2a85('0x12')](_0x2a85('0x14'));}else{GRAY_PERIOD_REASON=_0x2a85('0x15');logger[_0x2a85('0x12')](_0x2a85('0x16'),_0x3d879b[_0x2a85('0xf')],_0xa5a313);}logger[_0x2a85('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2a85('0x17')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x867298[_0x2a85('0x13')]({'data2':encryptor[_0x2a85('0x18')](moment()[_0x2a85('0x7')](_0x2a85('0x19')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x3d879b['data2']),_0x2a85('0x1a'))>DAYS){logger[_0x2a85('0x12')](_0x2a85('0x1b'),moment()[_0x2a85('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':null});}}}else{if(_0x3d879b[_0x2a85('0xf')]!=_0xa5a313){logger[_0x2a85('0x12')](_0x2a85('0x16'),_0x3d879b[_0x2a85('0xf')],_0xa5a313);return _0x867298[_0x2a85('0x13')]({'data1':_0xa5a313,'data2':null,'license':null});}}}return _0x867298;})[_0x2a85('0xb')](function(_0x2edddb){_0x867298=_0x2edddb;})[_0x2a85('0xc')](function(_0x107bd6){logger[_0x2a85('0x1c')](_0x107bd6[_0x2a85('0x1d')]);})[_0x2a85('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x2a85('0x1f')](),_0x867298);},TIME);});}function defaultLicense(){var _0xb576cc=hardware[_0x2a85('0x1f')]();if(_0xb576cc){return db['License'][_0x2a85('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0xb576cc}})['spread'](function(_0x204d32,_0x61918a){logger[_0x2a85('0x12')](_0x2a85('0x21'),_0xb576cc);manageLicense(_0xb576cc,_0x204d32);})[_0x2a85('0xc')](function(_0x4bc25b){logger[_0x2a85('0x1c')](_0x4bc25b[_0x2a85('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x17ee=['decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','default','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff'];(function(_0x5da2df,_0x46259b){var _0xca5e0f=function(_0x36d76e){while(--_0x36d76e){_0x5da2df['push'](_0x5da2df['shift']());}};_0xca5e0f(++_0x46259b);}(_0x17ee,0x101));var _0xe17e=function(_0x2a83af,_0x4fa9ed){_0x2a83af=_0x2a83af-0x0;var _0x2e1648=_0x17ee[_0x2a83af];return _0x2e1648;};'use strict';var util=require('util');var moment=require(_0xe17e('0x0'));var rp=require(_0xe17e('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xe17e('0x2'))(module,_0xe17e('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xe17e('0x4'));var hardware=require(_0xe17e('0x5'));var logger=require(_0xe17e('0x6'))(_0xe17e('0x7'));var HOST=_0xe17e('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x270ae7){return new BPromise(function(_0x4f392c,_0x13a490){var _0x26c922=util[_0xe17e('0x9')](_0xe17e('0xa'),HOST,_0x270ae7,module['exports']['version']);if(oldToken){_0x26c922=util[_0xe17e('0x9')](_0xe17e('0xb'),HOST,_0x270ae7,module['exports'][_0xe17e('0x3')],oldToken);}var _0xbea375={'uri':_0x26c922,'method':_0xe17e('0xc'),'timeout':0xea60,'json':!![]};return rp(_0xbea375)[_0xe17e('0xd')](function(_0x3c606c){_0x4f392c(_0x3c606c);})[_0xe17e('0xe')](function(_0x35fc9c){_0x13a490(_0x35fc9c);});});}function manageLicense(_0xf54b38,_0x31dde5){var _0x30f4c7=_0x31dde5[_0xe17e('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x30f4c7[_0xe17e('0x10')]!==_0xf54b38&&!_0x30f4c7[_0xe17e('0x11')]){oldToken=_0x30f4c7[_0xe17e('0x10')];}httpRequest(_0xf54b38)[_0xe17e('0xd')](function(_0x39d019){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x39d019[_0xe17e('0x12')]){isOldTokenSent=![];if(!_0x30f4c7['license']&&_0x30f4c7['license']!=_0x39d019['license']||_0x30f4c7[_0xe17e('0x7')]&&_0x30f4c7[_0xe17e('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x30f4c7['license']&&!_0x30f4c7['data2']&&_0x30f4c7[_0xe17e('0x7')]!=_0x39d019[_0xe17e('0x7')]){logger[_0xe17e('0x13')](_0xe17e('0x14'));}if(_0x30f4c7[_0xe17e('0x7')]&&!_0x30f4c7[_0xe17e('0x11')]&&_0x30f4c7[_0xe17e('0x7')]==_0x39d019[_0xe17e('0x7')]){return _0x31dde5;}return _0x31dde5[_0xe17e('0x15')]({'data1':_0xf54b38,'data2':null,'license':_0x39d019['license']});}else{if(_0x39d019['license']||_0x30f4c7[_0xe17e('0x7')]){if(!_0x30f4c7[_0xe17e('0x11')]){if(_0x30f4c7[_0xe17e('0x10')]==_0xf54b38){GRAY_PERIOD_REASON='Disabled';logger[_0xe17e('0x13')](_0xe17e('0x16'));}else{GRAY_PERIOD_REASON=_0xe17e('0x17');logger[_0xe17e('0x13')](_0xe17e('0x18'),_0x30f4c7[_0xe17e('0x10')],_0xf54b38);}logger['info'](_0xe17e('0x19'),GRAY_PERIOD_REASON[_0xe17e('0x1a')](),moment()[_0xe17e('0x9')](_0xe17e('0x1b')));return _0x31dde5[_0xe17e('0x15')]({'data2':encryptor[_0xe17e('0x1c')](moment()[_0xe17e('0x9')](_0xe17e('0x1b')))});}else{if(moment()[_0xe17e('0x1d')](encryptor[_0xe17e('0x1e')](_0x30f4c7[_0xe17e('0x11')]),_0xe17e('0x1f'))>DAYS){logger[_0xe17e('0x13')](_0xe17e('0x20'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x31dde5[_0xe17e('0x15')]({'data1':_0xf54b38,'data2':null,'license':null});}}}else{if(_0x30f4c7[_0xe17e('0x10')]!=_0xf54b38){logger[_0xe17e('0x13')](_0xe17e('0x18'),_0x30f4c7['data1'],_0xf54b38);return _0x31dde5[_0xe17e('0x15')]({'data1':_0xf54b38,'data2':null,'license':null});}}}return _0x31dde5;})[_0xe17e('0xd')](function(_0x1819a2){_0x31dde5=_0x1819a2;})['catch'](function(_0x495368){logger[_0xe17e('0x21')](_0x495368[_0xe17e('0x22')]);})[_0xe17e('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xe17e('0x24')](),_0x31dde5);},TIME);});}function defaultLicense(){var _0xdf9925=hardware[_0xe17e('0x24')]();if(_0xdf9925){return db[_0xe17e('0x25')][_0xe17e('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0xdf9925}})[_0xe17e('0x27')](function(_0x26d655,_0x1f194b){logger[_0xe17e('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xdf9925);manageLicense(_0xdf9925,_0x26d655);})[_0xe17e('0xe')](function(_0xb3d984){logger[_0xe17e('0x21')](_0xb3d984[_0xe17e('0x22')]);});}}exports[_0xe17e('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 06ffc69..04068c8 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 _0x5fe5=['admin','telephone','users','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','../../components/encryptor','../../mysqldb','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','uuid','isEmpty','data1','data2','split','%s:%s:%s','parse','demo','machineUuid','getUuid','decryptString','gray','deadline','add','days','format','grayReason','message','role','sequelize','COUNT','col','count'];(function(_0x90e312,_0x4deaf4){var _0xe11402=function(_0x3f55f2){while(--_0x3f55f2){_0x90e312['push'](_0x90e312['shift']());}};_0xe11402(++_0x4deaf4);}(_0x5fe5,0x1b6));var _0x55fe=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x5fe5[_0x2906e6];return _0x12517a;};'use strict';var util=require(_0x55fe('0x0'));var _=require(_0x55fe('0x1'));var moment=require(_0x55fe('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x55fe('0x3'));var db=require(_0x55fe('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x55fe('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x55fe('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2be1b6){return new BPromise(function(_0x51ca8d,_0x29c157){return db[_0x55fe('0x7')][_0x55fe('0x8')](_[_0x55fe('0x9')](_0x2be1b6,{'raw':!![],'where':{'id':0x1}}))[_0x55fe('0xa')](function(_0x4dc8ac){return checkLicense(_0x4dc8ac,null);})[_0x55fe('0xa')](function(_0x27cffc){_0x51ca8d(_0x27cffc);return;})[_0x55fe('0xb')](function(_0x599762){_0x29c157(_0x599762);});});}function checkLicense(_0xc68b44,_0x5a763c){if(!_0xc68b44){demoLicense[_0x55fe('0xc')]=_0xc68b44['data1'];return demoLicense;}try{var _0x338663=_0x5a763c||_0xc68b44['license'];if(_[_0x55fe('0xd')](_0x338663)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x5b728b=_0xc68b44[_0x55fe('0xe')];var _0x771374=_0xc68b44[_0x55fe('0xf')];var _0x68c4d5=_0x5b728b[_0x55fe('0x10')]('-')[0x4];var _0x5ddb00=_0x5b728b['split']('-')[0x0];var _0xc6b8c4=encryptor['decryptString'](_0x338663,util['format'](_0x55fe('0x11'),_0x68c4d5,_0x5b728b,_0x5ddb00));var _0x3244bf=JSON[_0x55fe('0x12')](_0xc6b8c4);_0x3244bf[_0x55fe('0x13')]=![];_0x3244bf['uuid']=_0x5b728b;_0x3244bf[_0x55fe('0x14')]=hardware[_0x55fe('0x15')]();if(_0x771374){var _0x23638b=encryptor[_0x55fe('0x16')](_0x771374);_0x3244bf[_0x55fe('0x17')]=_0x23638b;_0x3244bf[_0x55fe('0x18')]=moment(_0x23638b)[_0x55fe('0x19')](0x7,_0x55fe('0x1a'))[_0x55fe('0x1b')]();_0x3244bf[_0x55fe('0x1c')]=_0x3244bf[_0x55fe('0xc')]!=_0x3244bf[_0x55fe('0x14')]?'changed':'disabled';}return _0x3244bf;}catch(_0xe087f7){breakingLicense[_0x55fe('0xc')]=_0xc68b44[_0x55fe('0xe')];breakingLicense[_0x55fe('0x1d')]=_0xe087f7[_0x55fe('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x322582,_0x4ec901){getLicense()[_0x55fe('0xa')](function(_0x34670a){return db['User']['findAll']({'attributes':[_0x55fe('0x1e'),[db[_0x55fe('0x1f')]['fn'](_0x55fe('0x20'),db['sequelize'][_0x55fe('0x21')](_0x55fe('0x1e'))),_0x55fe('0x22')]],'group':_0x55fe('0x1e'),'where':{'role':{'$or':[_0x55fe('0x23'),'user',_0x55fe('0x24')]}},'raw':!![]})[_0x55fe('0xa')](function(_0x58a575){var _0x3289ec={'user':_0x34670a[_0x55fe('0x25')]||0x0,'telephone':_0x34670a['telephones']||0x0};_0x58a575['forEach'](function(_0x53d4e1){var _0x478dd8=_0x53d4e1[_0x55fe('0x1e')]==='admin'?_0x55fe('0x26'):_0x53d4e1[_0x55fe('0x1e')];_0x3289ec[_0x478dd8]-=_0x53d4e1[_0x55fe('0x22')];if(_0x3289ec[_0x478dd8]<0x0)_0x3289ec[_0x478dd8]=0x0;});_0x322582(_0x3289ec);return;});})[_0x55fe('0xb')](function(_0x174964){_0x4ec901(_0x174964);});});}function checkUserLimits(_0xa84077){return new BPromise(function(_0x44bd2d,_0x44259f){getLimits()['then'](function(_0x22f5d7){var _0x36695c=_[_0x55fe('0x27')](_[_0x55fe('0x28')](_0xa84077,_0x55fe('0x1e')),[_0x55fe('0x23'),_0x55fe('0x26'),_0x55fe('0x24')]);var _0x5f1e93=(_0x36695c[_0x55fe('0x23')]||0x0)+(_0x36695c[_0x55fe('0x26')]||0x0);var _0x6a4638=_0x36695c[_0x55fe('0x24')]||0x0;if(_0x5f1e93>_0x22f5d7['user'])return _0x44259f(_0x55fe('0x29'));if(_0x6a4638>_0x22f5d7[_0x55fe('0x24')])return _0x44259f('License\x20limit\x20reached\x20for\x20telephones');return _0x44bd2d();})['catch'](function(_0x4cb1c3){_0x44259f(_0x4cb1c3);});});}module[_0x55fe('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf774=['user','users','telephones','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','uuid','gray','deadline','add','days','machineUuid','changed','disabled','data1','message','User','findAll','sequelize','COUNT','col','count','role','admin'];(function(_0x4ea541,_0x358f15){var _0x11d841=function(_0x1e00e1){while(--_0x1e00e1){_0x4ea541['push'](_0x4ea541['shift']());}};_0x11d841(++_0x358f15);}(_0xf774,0x189));var _0x4f77=function(_0x532704,_0x537743){_0x532704=_0x532704-0x0;var _0x4af590=_0xf774[_0x532704];return _0x4af590;};'use strict';var util=require(_0x4f77('0x0'));var _=require(_0x4f77('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x4f77('0x2'));var encryptor=require(_0x4f77('0x3'));var db=require(_0x4f77('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4f77('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4f77('0x6'),'machineUuid':hardware[_0x4f77('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4f77('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4f77('0x8'),'machineUuid':hardware[_0x4f77('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5243e9){return new BPromise(function(_0x4eeb1d,_0x9528f7){return db[_0x4f77('0x9')][_0x4f77('0xa')](_['defaults'](_0x5243e9,{'raw':!![],'where':{'id':0x1}}))[_0x4f77('0xb')](function(_0x38c64b){return checkLicense(_0x38c64b,null);})[_0x4f77('0xb')](function(_0x45399c){_0x4eeb1d(_0x45399c);return;})[_0x4f77('0xc')](function(_0x494abc){_0x9528f7(_0x494abc);});});}function checkLicense(_0x33a23f,_0xd28c13){if(!_0x33a23f){demoLicense['uuid']=_0x33a23f['data1'];return demoLicense;}try{var _0x1ce085=_0xd28c13||_0x33a23f[_0x4f77('0xd')];if(_[_0x4f77('0xe')](_0x1ce085)){throw new Error(_0x4f77('0xf'));}var _0x9d3d91=_0x33a23f['data1'];var _0x5afdbe=_0x33a23f[_0x4f77('0x10')];var _0x487244=_0x9d3d91[_0x4f77('0x11')]('-')[0x4];var _0x138b70=_0x9d3d91[_0x4f77('0x11')]('-')[0x0];var _0x2b848b=encryptor[_0x4f77('0x12')](_0x1ce085,util[_0x4f77('0x13')]('%s:%s:%s',_0x487244,_0x9d3d91,_0x138b70));var _0x3e4542=JSON[_0x4f77('0x14')](_0x2b848b);_0x3e4542['demo']=![];_0x3e4542[_0x4f77('0x15')]=_0x9d3d91;_0x3e4542['machineUuid']=hardware[_0x4f77('0x7')]();if(_0x5afdbe){var _0xf48a6e=encryptor[_0x4f77('0x12')](_0x5afdbe);_0x3e4542[_0x4f77('0x16')]=_0xf48a6e;_0x3e4542[_0x4f77('0x17')]=moment(_0xf48a6e)[_0x4f77('0x18')](0x7,_0x4f77('0x19'))[_0x4f77('0x13')]();_0x3e4542['grayReason']=_0x3e4542['uuid']!=_0x3e4542[_0x4f77('0x1a')]?_0x4f77('0x1b'):_0x4f77('0x1c');}return _0x3e4542;}catch(_0x580e2f){breakingLicense[_0x4f77('0x15')]=_0x33a23f[_0x4f77('0x1d')];breakingLicense['message']=_0x580e2f[_0x4f77('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x29e7ce,_0x151eb7){getLicense()['then'](function(_0x191f67){return db[_0x4f77('0x1f')][_0x4f77('0x20')]({'attributes':['role',[db[_0x4f77('0x21')]['fn'](_0x4f77('0x22'),db[_0x4f77('0x21')][_0x4f77('0x23')]('role')),_0x4f77('0x24')]],'group':_0x4f77('0x25'),'where':{'role':{'$or':[_0x4f77('0x26'),_0x4f77('0x27'),'telephone']}},'raw':!![]})[_0x4f77('0xb')](function(_0x300d30){var _0x1d6485={'user':_0x191f67[_0x4f77('0x28')]||0x0,'telephone':_0x191f67[_0x4f77('0x29')]||0x0};_0x300d30['forEach'](function(_0x3650d1){var _0x50a009=_0x3650d1[_0x4f77('0x25')]===_0x4f77('0x26')?'user':_0x3650d1[_0x4f77('0x25')];_0x1d6485[_0x50a009]-=_0x3650d1[_0x4f77('0x24')];if(_0x1d6485[_0x50a009]<0x0)_0x1d6485[_0x50a009]=0x0;});_0x29e7ce(_0x1d6485);return;});})[_0x4f77('0xc')](function(_0x3427cf){_0x151eb7(_0x3427cf);});});}function checkUserLimits(_0xd75c65){return new BPromise(function(_0x2618b7,_0x4ad6c2){getLimits()[_0x4f77('0xb')](function(_0x2e49f4){var _0x1997f6=_[_0x4f77('0x2a')](_[_0x4f77('0x2b')](_0xd75c65,'role'),['admin',_0x4f77('0x27'),_0x4f77('0x2c')]);var _0x5bbec9=(_0x1997f6['admin']||0x0)+(_0x1997f6[_0x4f77('0x27')]||0x0);var _0x308047=_0x1997f6[_0x4f77('0x2c')]||0x0;if(_0x5bbec9>_0x2e49f4['user'])return _0x4ad6c2(_0x4f77('0x2d'));if(_0x308047>_0x2e49f4[_0x4f77('0x2c')])return _0x4ad6c2(_0x4f77('0x2e'));return _0x2618b7();})['catch'](function(_0xfb7457){_0x4ad6c2(_0xfb7457);});});}module[_0x4f77('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5f07389..286034a 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 _0xfff0=['app-id','http://localhost:9000','myappanuglar-secret'];(function(_0x30969f,_0x9bc95c){var _0xf66894=function(_0x21c608){while(--_0x21c608){_0x30969f['push'](_0x30969f['shift']());}};_0xf66894(++_0x9bc95c);}(_0xfff0,0x139));var _0x0fff=function(_0x29edd5,_0xb26c07){_0x29edd5=_0x29edd5-0x0;var _0x1bca55=_0xfff0[_0x29edd5];return _0x1bca55;};'use strict';module['exports']={'DOMAIN':_0x0fff('0x0'),'SESSION_SECRET':_0x0fff('0x1'),'GOOGLE_ID':_0x0fff('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x1a37=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x1a37,0xb4));var _0x71a3=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x1a37[_0x474bc0];return _0x4b24cf;};'use strict';module[_0x71a3('0x0')]={'DOMAIN':_0x71a3('0x1'),'SESSION_SECRET':_0x71a3('0x2'),'GOOGLE_ID':_0x71a3('0x3'),'GOOGLE_SECRET':_0x71a3('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a92ce2d..01c9256 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x476e=['exports','../utils/loggers','fileLogger'];(function(_0x4b5982,_0x482507){var _0x70e189=function(_0x217af5){while(--_0x217af5){_0x4b5982['push'](_0x4b5982['shift']());}};_0x70e189(++_0x482507);}(_0x476e,0x172));var _0xe476=function(_0x469a9d,_0x3992f2){_0x469a9d=_0x469a9d-0x0;var _0x567bcb=_0x476e[_0x469a9d];return _0x567bcb;};'use strict';var fileLogger=require(_0xe476('0x0'))[_0xe476('0x1')];module[_0xe476('0x2')]=fileLogger; \ No newline at end of file +var _0xc3f8=['fileLogger','../utils/loggers'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xc3f8,0x8f));var _0x8c3f=function(_0x1d78c3,_0x1fdf2a){_0x1d78c3=_0x1d78c3-0x0;var _0x39565c=_0xc3f8[_0x1d78c3];return _0x39565c;};'use strict';var fileLogger=require(_0x8c3f('0x0'))[_0x8c3f('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 b51d9cc..402cfeb 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 _0x1ca0=['email','../../services/email/index.js','routing','xdr','exports','../../config/environment','resolve','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x3ee55a,_0x19aeea){var _0x581800=function(_0x636cb7){while(--_0x636cb7){_0x3ee55a['push'](_0x3ee55a['shift']());}};_0x581800(++_0x19aeea);}(_0x1ca0,0x122));var _0x01ca=function(_0x2c9056,_0x552f14){_0x2c9056=_0x2c9056-0x0;var _0x3e6959=_0x1ca0[_0x2c9056];return _0x3e6959;};'use strict';var path=require('path');var cfg=require(_0x01ca('0x0'));var env={'NODE_PATH':path[_0x01ca('0x1')](path['join'](cfg['root'],_0x01ca('0x2')))};var pm2config={'apps':[{'name':_0x01ca('0x3'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x5')),'env':env},{'name':_0x01ca('0x6'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x7')),'env':env},{'name':_0x01ca('0x8'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0x9')),'env':env},{'name':_0x01ca('0xa'),'script':path[_0x01ca('0x4')](__dirname,_0x01ca('0xb')),'env':env},{'name':_0x01ca('0xc'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x01ca('0xd'),'script':path[_0x01ca('0x4')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x01ca('0xe')]=pm2config; \ No newline at end of file +var _0x7afc=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7afc,0x148));var _0xc7af=function(_0x2679b0,_0x2a1a6f){_0x2679b0=_0x2679b0-0x0;var _0x192302=_0x7afc[_0x2679b0];return _0x192302;};'use strict';var path=require(_0xc7af('0x0'));var cfg=require(_0xc7af('0x1'));var env={'NODE_PATH':path[_0xc7af('0x2')](path['join'](cfg[_0xc7af('0x3')],_0xc7af('0x4')))};var pm2config={'apps':[{'name':_0xc7af('0x5'),'script':path[_0xc7af('0x6')](__dirname,_0xc7af('0x7')),'env':env},{'name':_0xc7af('0x8'),'script':path[_0xc7af('0x6')](__dirname,_0xc7af('0x9')),'env':env},{'name':'agi','script':path['join'](__dirname,_0xc7af('0xa')),'env':env},{'name':_0xc7af('0xb'),'script':path[_0xc7af('0x6')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0xc7af('0xc'),'script':path['join'](__dirname,_0xc7af('0xd')),'env':env},{'name':_0xc7af('0xe'),'script':path['join'](__dirname,_0xc7af('0xf')),'env':env}]};module[_0xc7af('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 325c8ba..299e9db 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 _0x7c3b=['pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','saved'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7c3b,0x193));var _0xb7c3=function(_0x3604ea,_0x16db6f){_0x3604ea=_0x3604ea-0x0;var _0xd1c443=_0x7c3b[_0x3604ea];return _0xd1c443;};'use strict';var pm2=require(_0xb7c3('0x0'));var BPromise=require(_0xb7c3('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2d5512,_0x34ca7b){return pm2[_0xb7c3('0x2')](function(_0x3442b1){if(_0x3442b1){return _0x34ca7b(_0x3442b1);}return _0x2d5512(_0xb7c3('0x3'));});});};exports[_0xb7c3('0x4')]=function(_0x521a95){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x21c3a,_0x15f0a2){return pm2[_0xb7c3('0x4')](_0x521a95,function(_0x1d2b7f,_0x1c3e9a){if(_0x1d2b7f){return _0x15f0a2(_0x1d2b7f);}pm2[_0xb7c3('0x6')]();return _0x21c3a(_0x1c3e9a);});});});};exports[_0xb7c3('0x7')]=function(_0x3e66ac){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x852797,_0xb1277a){return pm2[_0xb7c3('0x7')](_0x3e66ac,function(_0x3a5921,_0x419eb7){if(_0x3a5921){return _0xb1277a(_0x3a5921);}pm2['disconnect']();return _0x852797(_0x419eb7);});});});};exports[_0xb7c3('0x8')]=function(_0x5af806){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x197e27,_0x125dea){return pm2['restart'](_0x5af806,function(_0xb14b5,_0x4d7a1b){if(_0xb14b5){return _0x125dea(_0xb14b5);}pm2['disconnect']();return _0x197e27(_0x4d7a1b);});});});};exports[_0xb7c3('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x6e8bb2,_0x47e63e){return pm2['list'](function(_0x5b07ff,_0x375c98){if(_0x5b07ff){return _0x47e63e(_0x5b07ff);}pm2[_0xb7c3('0x6')]();return _0x6e8bb2(_0x375c98);});});});};exports[_0xb7c3('0xa')]=function(_0x27c42f){return connect()['then'](function(){return new BPromise(function(_0x4dc9e8,_0x403915){return pm2['describe'](_0x27c42f,function(_0x1e6a1e,_0xd448c6){if(_0x1e6a1e){return _0x403915(_0x1e6a1e);}pm2[_0xb7c3('0x6')]();return _0x4dc9e8(_0xd448c6);});});});};exports[_0xb7c3('0xb')]=function(_0x58d1cd){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0xdeded7,_0x36c00d){return pm2[_0xb7c3('0xb')](_0x58d1cd,function(_0x12b58a,_0x16e4fc){if(_0x12b58a){return _0x36c00d(_0x12b58a);}pm2[_0xb7c3('0x6')]();return _0xdeded7(_0x16e4fc);});});});};exports['dump']=function(){return connect()[_0xb7c3('0x5')](function(){return new BPromise(function(_0x4602dc,_0x4b8733){return pm2['dump'](function(_0x4f0635){if(_0x4f0635){return _0x4b8733(_0x4f0635);}return _0x4602dc(_0xb7c3('0xc'));});});});}; \ No newline at end of file +var _0x6752=['stop','restart','describe','delete','dump','saved','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x553acd,_0x173f94){var _0x1e3e49=function(_0x5cd4d6){while(--_0x5cd4d6){_0x553acd['push'](_0x553acd['shift']());}};_0x1e3e49(++_0x173f94);}(_0x6752,0x1c0));var _0x2675=function(_0x12eab1,_0x54607f){_0x12eab1=_0x12eab1-0x0;var _0x550071=_0x6752[_0x12eab1];return _0x550071;};'use strict';var pm2=require('pm2');var BPromise=require(_0x2675('0x0'));var config=require(_0x2675('0x1'));function connect(){return new BPromise(function(_0x5b9356,_0x24120b){return pm2[_0x2675('0x2')](function(_0x4d05a0){if(_0x4d05a0){return _0x24120b(_0x4d05a0);}return _0x5b9356(_0x2675('0x3'));});});};exports[_0x2675('0x4')]=function(_0x195105){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x22abc7,_0x5243ba){return pm2[_0x2675('0x4')](_0x195105,function(_0x4806e7,_0x47f6c6){if(_0x4806e7){return _0x5243ba(_0x4806e7);}pm2[_0x2675('0x6')]();return _0x22abc7(_0x47f6c6);});});});};exports[_0x2675('0x7')]=function(_0x4914a2){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x4a8862,_0x3b8115){return pm2[_0x2675('0x7')](_0x4914a2,function(_0x3cb2c1,_0x4826e1){if(_0x3cb2c1){return _0x3b8115(_0x3cb2c1);}pm2['disconnect']();return _0x4a8862(_0x4826e1);});});});};exports[_0x2675('0x8')]=function(_0x12c0d1){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x5c5514,_0x355b66){return pm2['restart'](_0x12c0d1,function(_0x12100f,_0x268dab){if(_0x12100f){return _0x355b66(_0x12100f);}pm2[_0x2675('0x6')]();return _0x5c5514(_0x268dab);});});});};exports['list']=function(){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x8e4c23,_0x68bedc){return pm2['list'](function(_0x403c35,_0xff2050){if(_0x403c35){return _0x68bedc(_0x403c35);}pm2[_0x2675('0x6')]();return _0x8e4c23(_0xff2050);});});});};exports['describe']=function(_0x5becb1){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x2994da,_0x1023f8){return pm2[_0x2675('0x9')](_0x5becb1,function(_0x4fdbc5,_0x43520a){if(_0x4fdbc5){return _0x1023f8(_0x4fdbc5);}pm2['disconnect']();return _0x2994da(_0x43520a);});});});};exports[_0x2675('0xa')]=function(_0x223623){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x44407a,_0x32f1dd){return pm2['delete'](_0x223623,function(_0x48664e,_0x28ba43){if(_0x48664e){return _0x32f1dd(_0x48664e);}pm2[_0x2675('0x6')]();return _0x44407a(_0x28ba43);});});});};exports[_0x2675('0xb')]=function(){return connect()[_0x2675('0x5')](function(){return new BPromise(function(_0x28037f,_0x4ba9ec){return pm2['dump'](function(_0x302f23){if(_0x302f23){return _0x4ba9ec(_0x302f23);}return _0x28037f(_0x2675('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 033a1ab..03a9a80 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 _0xad07=['inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad07,0x14c));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var moment=require('moment');var Redis=require(_0x7ad0('0x1'));var util=require(_0x7ad0('0x2'));var config=require('../../config/environment');var db=require(_0x7ad0('0x3'))['db'];var logger=require(_0x7ad0('0x4'))(_0x7ad0('0x5'));config['redis']=_[_0x7ad0('0x6')](config[_0x7ad0('0x7')],{'host':_0x7ad0('0x8'),'port':0x18eb});var io=require(_0x7ad0('0x9'))(new Redis(config[_0x7ad0('0x7')]));function closeInteractions(){var _0xb10bcd=0x0;var _0x3f729e=[];return db[_0x7ad0('0xa')][_0x7ad0('0xb')]({'raw':!![],'attributes':['id',_0x7ad0('0xc')],'where':{'id':0x1}})[_0x7ad0('0xd')](function(_0x5642d1){_0xb10bcd=_0x5642d1[_0x7ad0('0xc')];if(_0xb10bcd){return db['ChatInteraction'][_0x7ad0('0xe')]({'raw':!![],'attributes':['id',_0x7ad0('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5642d1[_0x7ad0('0xc')],_0x7ad0('0x10'))}}});}else{return[];}})[_0x7ad0('0xd')](function(_0x21d2ec){if(_0x21d2ec&&_0x21d2ec[_0x7ad0('0x11')]){_0x3f729e=_[_0x7ad0('0x12')](_0x21d2ec||[],'id');logger[_0x7ad0('0x13')](_0x7ad0('0x14'),_0x3f729e[_0x7ad0('0x15')]());return db['ChatInteraction'][_0x7ad0('0x16')]({'closeReason':_0x7ad0('0x17'),'disposition':_0x7ad0('0x18'),'closed':!![],'closedAt':moment()[_0x7ad0('0x19')](_0x7ad0('0x1a'))},{'where':{'id':_0x3f729e}});}})[_0x7ad0('0xd')](function(){if(_0x3f729e&&_0x3f729e[_0x7ad0('0x11')]){logger[_0x7ad0('0x13')](_0x7ad0('0x1b'),_0x3f729e[_0x7ad0('0x15')]());for(var _0x329ea9=0x0;_0x329ea9<_0x3f729e[_0x7ad0('0x11')];_0x329ea9++){io['emit'](_0x7ad0('0x1c'),{'id':_0x3f729e[_0x329ea9],'closed':!![]});}}})['catch'](function(_0x300013){logger[_0x7ad0('0x1d')](_0x7ad0('0x1e'),_0x300013?util[_0x7ad0('0x1f')](_0x300013,{'showHidden':![],'depth':null}):'');});}exports[_0x7ad0('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x59a7=['inspect','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x3ee39c,_0x4e1b73){var _0x259188=function(_0x2599ee){while(--_0x2599ee){_0x3ee39c['push'](_0x3ee39c['shift']());}};_0x259188(++_0x4e1b73);}(_0x59a7,0x156));var _0x759a=function(_0x4e2943,_0x311fc7){_0x4e2943=_0x4e2943-0x0;var _0x36d518=_0x59a7[_0x4e2943];return _0x36d518;};'use strict';var _=require('lodash');var moment=require(_0x759a('0x0'));var Redis=require('ioredis');var util=require(_0x759a('0x1'));var config=require(_0x759a('0x2'));var db=require(_0x759a('0x3'))['db'];var logger=require(_0x759a('0x4'))(_0x759a('0x5'));config[_0x759a('0x6')]=_[_0x759a('0x7')](config[_0x759a('0x6')],{'host':_0x759a('0x8'),'port':0x18eb});var io=require(_0x759a('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0xa01bb2=0x0;var _0x45a8cb=[];return db[_0x759a('0xa')][_0x759a('0xb')]({'raw':!![],'attributes':['id',_0x759a('0xc')],'where':{'id':0x1}})[_0x759a('0xd')](function(_0x2cf0ff){_0xa01bb2=_0x2cf0ff[_0x759a('0xc')];if(_0xa01bb2){return db[_0x759a('0xe')][_0x759a('0xf')]({'raw':!![],'attributes':['id',_0x759a('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2cf0ff[_0x759a('0xc')],_0x759a('0x11'))}}});}else{return[];}})[_0x759a('0xd')](function(_0x42c1d3){if(_0x42c1d3&&_0x42c1d3[_0x759a('0x12')]){_0x45a8cb=_[_0x759a('0x13')](_0x42c1d3||[],'id');logger['info'](_0x759a('0x14'),_0x45a8cb[_0x759a('0x15')]());return db[_0x759a('0xe')][_0x759a('0x16')]({'closeReason':_0x759a('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x759a('0x18')](_0x759a('0x19'))},{'where':{'id':_0x45a8cb}});}})[_0x759a('0xd')](function(){if(_0x45a8cb&&_0x45a8cb[_0x759a('0x12')]){logger[_0x759a('0x1a')](_0x759a('0x1b'),_0x45a8cb[_0x759a('0x15')]());for(var _0x29d30e=0x0;_0x29d30e<_0x45a8cb[_0x759a('0x12')];_0x29d30e++){io['emit'](_0x759a('0x1c'),{'id':_0x45a8cb[_0x29d30e],'closed':!![]});}}})[_0x759a('0x1d')](function(_0x3b547a){logger[_0x759a('0x1e')](_0x759a('0x1f'),_0x3b547a?util[_0x759a('0x20')](_0x3b547a,{'showHidden':![],'depth':null}):'');});}exports[_0x759a('0x21')]=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 da2587f..4029214 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 _0x1a6e=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2db526,_0x1c599d){var _0x50f269=function(_0x1eeec7){while(--_0x1eeec7){_0x2db526['push'](_0x2db526['shift']());}};_0x50f269(++_0x1c599d);}(_0x1a6e,0x65));var _0xe1a6=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x1a6e[_0x540160];return _0x476120;};'use strict';function start(){var _0x4642cc=require(_0xe1a6('0x0'));return _0x4642cc[_0xe1a6('0x1')]();}module[_0xe1a6('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xfd82=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x5d26d9,_0xfbeef9){var _0x5c0398=function(_0x3551fb){while(--_0x3551fb){_0x5d26d9['push'](_0x5d26d9['shift']());}};_0x5c0398(++_0xfbeef9);}(_0xfd82,0x6d));var _0x2fd8=function(_0x75372b,_0x4b12c4){_0x75372b=_0x75372b-0x0;var _0x2f56a5=_0xfd82[_0x75372b];return _0x2f56a5;};'use strict';function start(){var _0xae4e4f=require(_0x2fd8('0x0'));return _0xae4e4f[_0x2fd8('0x1')]();}module[_0x2fd8('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 7ed46fd..88c6c2c 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 _0x73d7=['stringify','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','error','email\x20sent','catch','error\x20mail','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','add','start','exists','stop','isBetween','endAt','update','update\x20cron','stop\x20cron','run','path','moment','cron-job-manager','jayson/promise','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a'];(function(_0x35ea46,_0x52c1c1){var _0x5e6dfa=function(_0x3a5abc){while(--_0x3a5abc){_0x35ea46['push'](_0x35ea46['shift']());}};_0x5e6dfa(++_0x52c1c1);}(_0x73d7,0x135));var _0x773d=function(_0x2186d0,_0x32b73b){_0x2186d0=_0x2186d0-0x0;var _0x5443bd=_0x73d7[_0x2186d0];return _0x5443bd;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x773d('0x0'));var _=require('lodash');var moment=require(_0x773d('0x1'));var CronJobManager=require(_0x773d('0x2'));var jayson=require(_0x773d('0x3'));var BPromise=require('bluebird');var logger=require(_0x773d('0x4'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x773d('0x5'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x773d('0x6')][_0x773d('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e2ac3,_0x3e4a74){return function(){logger['info'](_0x773d('0x8'),_0x5e2ac3['email']);var _0x52daad=!![];var _0x398f84=_0x5e2ac3[_0x773d('0x9')][_0x773d('0xa')]();var _0x12eff2={'account':_0x398f84,'message':{'from':util[_0x773d('0xb')](_0x773d('0xc'),_0x5e2ac3['MailAccount'][_0x773d('0xd')],_0x5e2ac3['MailAccount']['email']||_0x5e2ac3['MailAccount']['Smtp']['user']),'to':_0x5e2ac3['email'],'cc':_0x5e2ac3['cc'],'bcc':_0x5e2ac3[_0x773d('0xe')],'subject':util[_0x773d('0xb')](_0x773d('0xf'),_0x3e4a74[_0x773d('0xd')],_0x5e2ac3[_0x773d('0x10')],_0x5e2ac3[_0x773d('0x11')])}};var _0x270cd0=path[_0x773d('0x12')](__dirname,_0x773d('0x13'));var _0x41f413=_0x3e4a74[_0x773d('0x14')];var _0x3a5757=util[_0x773d('0xb')](_0x773d('0x15'),path[_0x773d('0x16')](_0x3e4a74['savename'],path['extname'](_0x3e4a74['savename'])),_0x773d('0x17'));var _0x5494d3=path[_0x773d('0x12')](_0x270cd0,_0x41f413);var _0x3cd3d1=path['join'](_0x270cd0,_0x3a5757);if(fs[_0x773d('0x18')](_0x5494d3)){_0x3e4a74[_0x773d('0x19')]=_0x773d('0x1a');_0x12eff2[_0x773d('0x1b')][_0x773d('0x1c')]=[{'filename':_0x41f413,'path':_0x5494d3}];_0x12eff2[_0x773d('0x1b')][_0x773d('0x1d')]=util[_0x773d('0xb')](_0x773d('0x1e'),JSON[_0x773d('0x1f')](_0x3e4a74,null,0x2));}else if(fs[_0x773d('0x18')](_0x3cd3d1)){_0x3e4a74[_0x773d('0x19')]=_0x773d('0x1a');_0x12eff2[_0x773d('0x1b')][_0x773d('0x1c')]=[{'filename':_0x3a5757,'path':_0x3cd3d1}];}else{_0x12eff2[_0x773d('0x1b')]['text']=_0x773d('0x20');if(!_0x5e2ac3['sendIfEmpty']){_0x52daad=![];logger[_0x773d('0x21')](_0x773d('0x22'));}}if(_0x52daad){return client[_0x773d('0x23')]('SendMail',_0x12eff2)['then'](function(_0x5b4c51){if(_0x5b4c51[_0x773d('0x24')]){return logger['error']('error\x20mail',JSON['stringify'](_0x5b4c51));}return logger['info'](_0x773d('0x25'));})[_0x773d('0x26')](function(_0x4637e2){return logger[_0x773d('0x24')](_0x773d('0x27'),JSON[_0x773d('0x1f')](_0x4637e2));});}};}function handleError(){return function(_0x1cdb97){return logger[_0x773d('0x24')](JSON['stringify'](_0x1cdb97));};}function handleResult(_0x150910){return function(_0x1e298a){logger[_0x773d('0x21')](_0x773d('0x28'),JSON[_0x773d('0x1f')](_0x1e298a));if(_0x150910['MailAccount']&&_0x150910[_0x773d('0x9')][_0x773d('0x29')]&&!_[_0x773d('0x2a')](_0x150910['email'])){setTimeout(handleSendEmail(_0x150910,_0x1e298a),0x3c*0x3e8);}};}function handleJob(_0x1f079a){return function(){try{if(_[_0x773d('0x2a')](_0x1f079a[_0x773d('0x10')])){return logger[_0x773d('0x21')](_0x773d('0x2b'));}if(_['isNil'](_0x1f079a[_0x773d('0x11')])){return logger[_0x773d('0x21')](_0x773d('0x2c'));}var _0x14ac2c={'startDate':moment()[_0x773d('0x2d')](_0x1f079a['subtractNumber'],_0x1f079a['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x773d('0x2e')),'type':_0x773d('0x2f'),'output':_0x1f079a[_0x773d('0x30')],'name':_0x1f079a['name']};if(!_[_0x773d('0x2a')](_0x1f079a['DefaultReportId'])){logger['info'](_0x773d('0x31'),_0x1f079a[_0x773d('0x32')]);return analyticDefaultReportController[_0x773d('0x33')]({'id':_0x1f079a[_0x773d('0x32')]},_0x14ac2c)['then'](handleResult(_0x1f079a))[_0x773d('0x26')](handleError());}if(!_[_0x773d('0x2a')](_0x1f079a[_0x773d('0x34')])){logger[_0x773d('0x21')](_0x773d('0x35'),_0x1f079a['CustomReportId']);return analyticCustomReportController[_0x773d('0x33')]({'id':_0x1f079a['CustomReportId']},_0x14ac2c)[_0x773d('0x36')](handleResult(_0x1f079a))['catch'](handleError());}}catch(_0x5e7c37){logger[_0x773d('0x24')](JSON[_0x773d('0x1f')](_0x5e7c37));}return logger['info'](_0x773d('0x37'));};}function getJobs(_0x59f108){var _0x3f00c8={};if(_0x59f108){_0x3f00c8['id']=_0x59f108;}return db[_0x773d('0x38')]['findAll']({'where':_0x3f00c8,'include':[{'model':db['MailAccount'],'attributes':['id',_0x773d('0xd'),'email'],'include':[{'model':db[_0x773d('0x39')],'as':_0x773d('0x29'),'include':[{'model':db[_0x773d('0x3a')],'as':_0x773d('0x3a')}]}]}]})[_0x773d('0x36')](function(_0x52dbed){var _0x5f2a75=_[_0x773d('0x3b')](manager[_0x773d('0x3c')]);var _0x1dfe01=_[_0x773d('0x3d')](_0x52dbed,function(_0x1e0646){return _0x1e0646['id'][_0x773d('0x3e')]();});var _0x5cdea1=_[_0x773d('0x3f')](_0x52dbed,function(_0x15ba88){return _0x15ba88['id'][_0x773d('0x3e')]();});var _0x11964e=_0x59f108?_0x1dfe01:_[_0x773d('0x40')](_0x1dfe01,_0x5f2a75);var _0x118cda=_[_0x773d('0x41')](_0x1dfe01,_0x5f2a75);var _0x387393=_[_0x773d('0x40')](_0x5f2a75,_0x1dfe01);var _0x261774;var _0x4f053b;for(_0x261774=0x0;_0x261774<_0x387393[_0x773d('0x42')]&&!_0x59f108;_0x261774+=0x1){_0x4f053b=_0x387393[_0x261774][_0x773d('0x3e')]();if(manager['exists'](_0x4f053b)){manager['stop'](_0x4f053b);manager[_0x773d('0x43')](_0x4f053b);logger[_0x773d('0x21')]('delete\x20cron',_0x4f053b);}}logger['info'](_0x773d('0x44'),JSON[_0x773d('0x1f')](_0x11964e));for(_0x261774=0x0;_0x261774<_0x11964e[_0x773d('0x42')];_0x261774+=0x1){_0x4f053b=_0x11964e[_0x261774][_0x773d('0x3e')]();logger[_0x773d('0x21')](_0x773d('0x45'),_0x4f053b);if(_0x59f108){logger[_0x773d('0x21')](_0x773d('0x46'),_0x59f108);logger[_0x773d('0x21')](JSON[_0x773d('0x1f')](_0x5cdea1[_0x4f053b]));BPromise[_0x773d('0x47')]()[_0x773d('0x36')](handleJob(_0x5cdea1[_0x4f053b]));logger[_0x773d('0x21')](_0x773d('0x48'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else if(_0x5cdea1[_0x4f053b][_0x773d('0x49')]&&_0x5cdea1[_0x4f053b]['active']&&moment()['isBetween'](_0x5cdea1[_0x4f053b][_0x773d('0x4a')],_0x5cdea1[_0x4f053b]['endAt'])){manager[_0x773d('0x4b')](_0x4f053b,_0x5cdea1[_0x4f053b]['cron'],handleJob(_0x5cdea1[_0x4f053b]));manager[_0x773d('0x4c')](_0x4f053b);logger['info']('add\x20cron',_0x5cdea1[_0x4f053b]['name'],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else if(manager[_0x773d('0x4d')](_0x4f053b)){manager[_0x773d('0x4e')](_0x4f053b);manager['deleteJob'](_0x4f053b);logger[_0x773d('0x21')]('stop\x20cron',_0x5cdea1[_0x4f053b]['name'],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}}for(_0x261774=0x0,_0x4f053b;_0x261774<_0x118cda['length']&&!_0x59f108;_0x261774+=0x1){_0x4f053b=_0x118cda[_0x261774]['toString']();if(manager['exists'](_0x4f053b)){if(_0x5cdea1[_0x4f053b][_0x773d('0x49')]&&_0x5cdea1[_0x4f053b]['active']&&moment()[_0x773d('0x4f')](_0x5cdea1[_0x4f053b][_0x773d('0x4a')],_0x5cdea1[_0x4f053b][_0x773d('0x50')])){manager[_0x773d('0x51')](_0x4f053b,_0x5cdea1[_0x4f053b]['cron'],handleJob(_0x5cdea1[_0x4f053b]));logger[_0x773d('0x21')](_0x773d('0x52'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}else{manager[_0x773d('0x4e')](_0x4f053b);manager['deleteJob'](_0x4f053b);logger['info'](_0x773d('0x53'),_0x5cdea1[_0x4f053b][_0x773d('0xd')],_0x5cdea1[_0x4f053b][_0x773d('0x49')]);}}}})[_0x773d('0x26')](function(_0x5b2941){logger['error'](JSON['stringify'](_0x5b2941));});}exports[_0x773d('0x54')]=function(_0x2661f1){return getJobs(_0x2661f1);};exports[_0x773d('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x124a=['../../files/reports','extname','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','empty\x20file,\x20email\x20not\x20sent','SendMail','error','email\x20sent','catch','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','endAt','start','exists','stop\x20cron','update','update\x20cron','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','subtractNumber','join'];(function(_0x3baa1c,_0x3a749b){var _0x41c2ec=function(_0x1db1a4){while(--_0x1db1a4){_0x3baa1c['push'](_0x3baa1c['shift']());}};_0x41c2ec(++_0x3a749b);}(_0x124a,0x1a6));var _0xa124=function(_0x33e864,_0x2d8439){_0x33e864=_0x33e864-0x0;var _0x1787d7=_0x124a[_0x33e864];return _0x1787d7;};'use strict';var fs=require('fs');var util=require(_0xa124('0x0'));var path=require(_0xa124('0x1'));var _=require(_0xa124('0x2'));var moment=require(_0xa124('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xa124('0x4'));var BPromise=require(_0xa124('0x5'));var logger=require(_0xa124('0x6'))(_0xa124('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xa124('0x8'));var analyticDefaultReportController=require(_0xa124('0x9'));var client=jayson[_0xa124('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x14f056,_0x6fb89c){return function(){logger[_0xa124('0xb')](_0xa124('0xc'),_0x14f056[_0xa124('0xd')]);var _0x3762f6=!![];var _0x1aaa0f=_0x14f056[_0xa124('0xe')][_0xa124('0xf')]();var _0x5f09c3={'account':_0x1aaa0f,'message':{'from':util[_0xa124('0x10')]('\x22%s\x22\x20<%s>',_0x14f056[_0xa124('0xe')][_0xa124('0x11')],_0x14f056[_0xa124('0xe')][_0xa124('0xd')]||_0x14f056[_0xa124('0xe')][_0xa124('0x12')][_0xa124('0x13')]),'to':_0x14f056[_0xa124('0xd')],'cc':_0x14f056['cc'],'bcc':_0x14f056['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x6fb89c[_0xa124('0x11')],_0x14f056[_0xa124('0x14')],_0x14f056['subtractUnit'])}};var _0x101bb7=path[_0xa124('0x15')](__dirname,_0xa124('0x16'));var _0x2b3db9=_0x6fb89c['savename'];var _0x1dc617=util[_0xa124('0x10')]('%s.%s',path['basename'](_0x6fb89c['savename'],path[_0xa124('0x17')](_0x6fb89c['savename'])),'zip');var _0x50dd03=path[_0xa124('0x15')](_0x101bb7,_0x2b3db9);var _0x1017c7=path[_0xa124('0x15')](_0x101bb7,_0x1dc617);if(fs[_0xa124('0x18')](_0x50dd03)){_0x6fb89c[_0xa124('0x19')]=_0xa124('0x1a');_0x5f09c3[_0xa124('0x1b')]['attachments']=[{'filename':_0x2b3db9,'path':_0x50dd03}];_0x5f09c3[_0xa124('0x1b')][_0xa124('0x1c')]=util[_0xa124('0x10')](_0xa124('0x1d'),JSON[_0xa124('0x1e')](_0x6fb89c,null,0x2));}else if(fs['existsSync'](_0x1017c7)){_0x6fb89c['status']=_0xa124('0x1a');_0x5f09c3['message']['attachments']=[{'filename':_0x1dc617,'path':_0x1017c7}];}else{_0x5f09c3[_0xa124('0x1b')][_0xa124('0x1c')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x14f056['sendIfEmpty']){_0x3762f6=![];logger[_0xa124('0xb')](_0xa124('0x1f'));}}if(_0x3762f6){return client['request'](_0xa124('0x20'),_0x5f09c3)['then'](function(_0x48dde3){if(_0x48dde3[_0xa124('0x21')]){return logger[_0xa124('0x21')]('error\x20mail',JSON[_0xa124('0x1e')](_0x48dde3));}return logger[_0xa124('0xb')](_0xa124('0x22'));})[_0xa124('0x23')](function(_0x31e121){return logger[_0xa124('0x21')]('error\x20mail',JSON[_0xa124('0x1e')](_0x31e121));});}};}function handleError(){return function(_0x48f203){return logger['error'](JSON['stringify'](_0x48f203));};}function handleResult(_0x10015b){return function(_0x377f49){logger[_0xa124('0xb')](_0xa124('0x24'),JSON[_0xa124('0x1e')](_0x377f49));if(_0x10015b[_0xa124('0xe')]&&_0x10015b['MailAccount']['Smtp']&&!_[_0xa124('0x25')](_0x10015b[_0xa124('0xd')])){setTimeout(handleSendEmail(_0x10015b,_0x377f49),0x3c*0x3e8);}};}function handleJob(_0x17baa2){return function(){try{if(_['isNil'](_0x17baa2[_0xa124('0x14')])){return logger[_0xa124('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa124('0x25')](_0x17baa2[_0xa124('0x26')])){return logger[_0xa124('0xb')](_0xa124('0x27'));}var _0x4123d8={'startDate':moment()[_0xa124('0x28')](_0x17baa2[_0xa124('0x14')],_0x17baa2[_0xa124('0x26')])[_0xa124('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa124('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa124('0x29'),'output':_0x17baa2[_0xa124('0x2a')],'name':_0x17baa2[_0xa124('0x11')]};if(!_[_0xa124('0x25')](_0x17baa2[_0xa124('0x2b')])){logger[_0xa124('0xb')](_0xa124('0x2c'),_0x17baa2[_0xa124('0x2b')]);return analyticDefaultReportController[_0xa124('0x2d')]({'id':_0x17baa2[_0xa124('0x2b')]},_0x4123d8)[_0xa124('0x2e')](handleResult(_0x17baa2))['catch'](handleError());}if(!_[_0xa124('0x25')](_0x17baa2[_0xa124('0x2f')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x17baa2['CustomReportId']);return analyticCustomReportController[_0xa124('0x2d')]({'id':_0x17baa2['CustomReportId']},_0x4123d8)[_0xa124('0x2e')](handleResult(_0x17baa2))[_0xa124('0x23')](handleError());}}catch(_0x44d742){logger[_0xa124('0x21')](JSON[_0xa124('0x1e')](_0x44d742));}return logger[_0xa124('0xb')](_0xa124('0x30'));};}function getJobs(_0x49f8ce){var _0x255469={};if(_0x49f8ce){_0x255469['id']=_0x49f8ce;}return db[_0xa124('0x31')]['findAll']({'where':_0x255469,'include':[{'model':db[_0xa124('0xe')],'attributes':['id',_0xa124('0x11'),_0xa124('0xd')],'include':[{'model':db[_0xa124('0x32')],'as':'Smtp','include':[{'model':db[_0xa124('0x33')],'as':_0xa124('0x33')}]}]}]})['then'](function(_0x1f8f23){var _0x553516=_[_0xa124('0x34')](manager[_0xa124('0x35')]);var _0x3a225e=_['map'](_0x1f8f23,function(_0x536996){return _0x536996['id'][_0xa124('0x36')]();});var _0x1c70e6=_['keyBy'](_0x1f8f23,function(_0x420353){return _0x420353['id']['toString']();});var _0x4bb48c=_0x49f8ce?_0x3a225e:_[_0xa124('0x37')](_0x3a225e,_0x553516);var _0x2de170=_[_0xa124('0x38')](_0x3a225e,_0x553516);var _0xdcdb40=_[_0xa124('0x37')](_0x553516,_0x3a225e);var _0x1fae42;var _0x1579aa;for(_0x1fae42=0x0;_0x1fae42<_0xdcdb40[_0xa124('0x39')]&&!_0x49f8ce;_0x1fae42+=0x1){_0x1579aa=_0xdcdb40[_0x1fae42][_0xa124('0x36')]();if(manager['exists'](_0x1579aa)){manager[_0xa124('0x3a')](_0x1579aa);manager[_0xa124('0x3b')](_0x1579aa);logger[_0xa124('0xb')](_0xa124('0x3c'),_0x1579aa);}}logger['info'](_0xa124('0x3d'),JSON[_0xa124('0x1e')](_0x4bb48c));for(_0x1fae42=0x0;_0x1fae42<_0x4bb48c[_0xa124('0x39')];_0x1fae42+=0x1){_0x1579aa=_0x4bb48c[_0x1fae42][_0xa124('0x36')]();logger[_0xa124('0xb')](_0xa124('0x3e'),_0x1579aa);if(_0x49f8ce){logger[_0xa124('0xb')](_0xa124('0x3f'),_0x49f8ce);logger[_0xa124('0xb')](JSON[_0xa124('0x1e')](_0x1c70e6[_0x1579aa]));BPromise['resolve']()[_0xa124('0x2e')](handleJob(_0x1c70e6[_0x1579aa]));logger[_0xa124('0xb')](_0xa124('0x40'),_0x1c70e6[_0x1579aa][_0xa124('0x11')],_0x1c70e6[_0x1579aa][_0xa124('0x41')]);}else if(_0x1c70e6[_0x1579aa][_0xa124('0x41')]&&_0x1c70e6[_0x1579aa]['active']&&moment()[_0xa124('0x42')](_0x1c70e6[_0x1579aa][_0xa124('0x43')],_0x1c70e6[_0x1579aa][_0xa124('0x44')])){manager['add'](_0x1579aa,_0x1c70e6[_0x1579aa]['cron'],handleJob(_0x1c70e6[_0x1579aa]));manager[_0xa124('0x45')](_0x1579aa);logger[_0xa124('0xb')]('add\x20cron',_0x1c70e6[_0x1579aa]['name'],_0x1c70e6[_0x1579aa][_0xa124('0x41')]);}else if(manager[_0xa124('0x46')](_0x1579aa)){manager['stop'](_0x1579aa);manager['deleteJob'](_0x1579aa);logger[_0xa124('0xb')](_0xa124('0x47'),_0x1c70e6[_0x1579aa][_0xa124('0x11')],_0x1c70e6[_0x1579aa][_0xa124('0x41')]);}}for(_0x1fae42=0x0,_0x1579aa;_0x1fae42<_0x2de170[_0xa124('0x39')]&&!_0x49f8ce;_0x1fae42+=0x1){_0x1579aa=_0x2de170[_0x1fae42]['toString']();if(manager['exists'](_0x1579aa)){if(_0x1c70e6[_0x1579aa][_0xa124('0x41')]&&_0x1c70e6[_0x1579aa]['active']&&moment()[_0xa124('0x42')](_0x1c70e6[_0x1579aa]['startAt'],_0x1c70e6[_0x1579aa]['endAt'])){manager[_0xa124('0x48')](_0x1579aa,_0x1c70e6[_0x1579aa][_0xa124('0x41')],handleJob(_0x1c70e6[_0x1579aa]));logger[_0xa124('0xb')](_0xa124('0x49'),_0x1c70e6[_0x1579aa][_0xa124('0x11')],_0x1c70e6[_0x1579aa][_0xa124('0x41')]);}else{manager[_0xa124('0x3a')](_0x1579aa);manager[_0xa124('0x3b')](_0x1579aa);logger[_0xa124('0xb')](_0xa124('0x47'),_0x1c70e6[_0x1579aa][_0xa124('0x11')],_0x1c70e6[_0x1579aa]['cron']);}}}})[_0xa124('0x23')](function(_0x4b8e97){logger['error'](JSON[_0xa124('0x1e')](_0x4b8e97));});}exports['run']=function(_0x2ec1c5){return getJobs(_0x2ec1c5);};exports[_0xa124('0x45')]=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 1cb85a0..39075ef 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 _0x530f=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','then','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','start','aws-sdk','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format'];(function(_0x3ec857,_0x443909){var _0x2459ff=function(_0x173b77){while(--_0x173b77){_0x3ec857['push'](_0x3ec857['shift']());}};_0x2459ff(++_0x443909);}(_0x530f,0x167));var _0xf530=function(_0x4f9e31,_0x19881c){_0x4f9e31=_0x4f9e31-0x0;var _0x2f9fc7=_0x530f[_0x4f9e31];return _0x2f9fc7;};var _=require('lodash');var AWS=require(_0xf530('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require(_0xf530('0x1'));var db=require(_0xf530('0x2'))['db'];var logger=require(_0xf530('0x3'))(_0xf530('0x4'));function getTranscriptionJob(_0x464b2e,_0x2bacf8,_0x5cb04f,_0xa4e5b7){return new Promise(function(_0x58f5f8,_0x3a0301){var _0x2ce7f8=new AWS[(_0xf530('0x5'))]({'accessKeyId':_0x2bacf8,'secretAccessKey':_0x464b2e,'region':_0x5cb04f});_0x2ce7f8['getTranscriptionJob']({'TranscriptionJobName':_0xa4e5b7},function(_0x2bbe3c,_0xf205be){if(_0x2bbe3c){return _0x3a0301(_0x2bbe3c);}else{return _0x58f5f8(_0xf205be);}});});}function sentiment(_0x375d92,_0x38503f,_0x4132bf,_0x1b3603,_0x4b8336){return new Promise(function(_0xd747c3,_0x2fd24d){var _0x383493=new AWS[(_0xf530('0x6'))]({'accessKeyId':_0x38503f,'secretAccessKey':_0x375d92,'region':_0x4132bf});_0x383493[_0xf530('0x7')]({'Text':_0x1b3603,'LanguageCode':_0x4b8336[_0xf530('0x8')](0x0,0x2)},function(_0x4cd30d,_0x4c483a){if(_0x4cd30d){return _0x2fd24d(_0x4cd30d);}else{return _0xd747c3(_0x4c483a);}});});}function checkTranscribeJob(_0x35c314,_0x194b1f,_0x27f552){var _0x332ce2;return new BPromise(function(_0x8d76da,_0x4afc17){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0xb'),_0x35c314['id'],_0x35c314[_0xf530('0xc')]));return getTranscriptionJob(_0x27f552[_0xf530('0xd')],_0x27f552[_0xf530('0xe')],_0x194b1f[_0xf530('0xf')],_0x35c314[_0xf530('0xc')])['then'](function(_0x244fb8){logger[_0xf530('0x9')](util['format'](_0xf530('0x10'),_0x35c314['id'],_0x35c314[_0xf530('0xc')],_0x244fb8['TranscriptionJob'][_0xf530('0x11')]));if(!_0x35c314[_0xf530('0x12')]){switch(_0x244fb8[_0xf530('0x13')][_0xf530('0x11')]){case'COMPLETED':var _0x34742c={'transcribeStatus':_0x244fb8[_0xf530('0x13')][_0xf530('0x11')],'fileUri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')]};logger['info'](util[_0xf530('0xa')](_0xf530('0x16'),_0x35c314['id']));return rp({'uri':_0x244fb8[_0xf530('0x13')][_0xf530('0x14')][_0xf530('0x15')],'json':!![]})['then'](function(_0x4dbbaf){logger['info'](util[_0xf530('0xa')](_0xf530('0x17'),_0x35c314['id']));if(_0x4dbbaf&&_0x4dbbaf[_0xf530('0x18')]&&_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')]&&_0x4dbbaf['results'][_0xf530('0x19')][_0xf530('0x1a')]){_0x34742c[_0xf530('0x12')]='';for(var _0x24a4dc=0x0;_0x24a4dc<_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0xf530('0x1a')];_0x24a4dc++){_0x34742c[_0xf530('0x12')]+=_0x4dbbaf[_0xf530('0x18')][_0xf530('0x19')][_0x24a4dc][_0xf530('0x1b')]+'';}}return _0x35c314['update'](_0x34742c);})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35c314['id']));if(!_0x35c314[_0xf530('0x1d')]){throw new db['Sequelize']['ValidationError'](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f['sentimentRegion']||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f[_0xf530('0x22')]){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x25'));}if(!_0x34742c[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf530('0x1c')](function(_0x4a1e5f){if(!_0x4a1e5f){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4a1e5f['data1']||!_0x4a1e5f['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x29'));}_0x332ce2=_0x4a1e5f;logger[_0xf530('0x9')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x35c314['id']));return sentiment(_0x332ce2[_0xf530('0xd')],_0x332ce2[_0xf530('0xe')],_0x194b1f[_0xf530('0x2a')],_0x34742c[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x1d6dfe){logger['info'](util[_0xf530('0xa')](_0xf530('0x2b'),_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x1d6dfe[_0xf530('0x2d')],'sPositive':_0x1d6dfe[_0xf530('0x2e')]['Positive'],'sNegative':_0x1d6dfe[_0xf530('0x2e')]['Negative'],'sMixed':_0x1d6dfe[_0xf530('0x2e')]['Mixed'],'sNeutral':_0x1d6dfe[_0xf530('0x2e')][_0xf530('0x2f')]});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util['format'](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});case'FAILED':return _0x35c314['update']({'transcribeStatus':_0xf530('0x31'),'failureReason':_0x244fb8[_0xf530('0x13')][_0xf530('0x32')]})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});default:logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x33'),_0x35c314['id']));break;}}else{return BPromise[_0xf530('0x34')]()[_0xf530('0x1c')](function(){if(!_0x35c314['tempSentiment']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x1e'));}if(!_0x194b1f[_0xf530('0x1f')]||!_0x194b1f[_0xf530('0x20')]||!_0x194b1f[_0xf530('0x2a')]||!_0x194b1f[_0xf530('0x21')]||!_0x194b1f['bucket']){throw new db['Sequelize']['ValidationError'](_0xf530('0x25'));}if(!_0x35c314[_0xf530('0x12')]){throw new Error(_0xf530('0x26'));}if(_0x194b1f[_0xf530('0x20')]===_0x27f552['id']){return _0x27f552;}else{return db[_0xf530('0x27')]['findOne']({'where':{'id':_settings[_0xf530('0x20')]}});}})['then'](function(_0x38372c){if(!_0x38372c){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x38372c[_0xf530('0xd')]||!_0x38372c['data2']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x332ce2=_0x38372c;logger['info'](util[_0xf530('0xa')](_0xf530('0x36'),_0x35c314['id']));return sentiment(_0x332ce2['data1'],_0x332ce2[_0xf530('0xe')],_0x194b1f['sentimentRegion'],_0x35c314[_0xf530('0x12')],_0x194b1f[_0xf530('0x21')]);})[_0xf530('0x1c')](function(_0x5d6333){logger['info'](util[_0xf530('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35c314['id']));return _0x35c314[_0xf530('0x2c')]({'sentiment':_0x5d6333['Sentiment'],'sPositive':_0x5d6333[_0xf530('0x2e')][_0xf530('0x37')],'sNegative':_0x5d6333['SentimentScore']['Negative'],'sMixed':_0x5d6333['SentimentScore'][_0xf530('0x38')],'sNeutral':_0x5d6333['SentimentScore'][_0xf530('0x2f')],'transcribeStatus':_0xf530('0x39')});})[_0xf530('0x1c')](function(){logger[_0xf530('0x9')](util[_0xf530('0xa')](_0xf530('0x30'),_0x35c314['id']));_0x8d76da();});}})[_0xf530('0x3a')](function(_0x245675){if(_0x245675){if(!_0x245675[_0xf530('0x3b')]||_0x245675[_0xf530('0x3b')]!==_0xf530('0x3c')){logger[_0xf530('0x3d')](util[_0xf530('0xa')](_0xf530('0x3e'),_0x35c314['id']),util[_0xf530('0x3f')](_0x245675,{'showHidden':![],'depth':null}));}}_0x8d76da();});});}function checkTranscribe(){var _0x17acce;var _0x3060a9;var _0x73b6d9;return db[_0xf530('0x40')][_0xf530('0x41')]({'where':{'transcribeStatus':_0xf530('0x42')}})[_0xf530('0x1c')](function(_0x2d3ed9){if(!_0x2d3ed9||!_0x2d3ed9[_0xf530('0x1a')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x43'));}_0x17acce=_0x2d3ed9;return db[_0xf530('0x44')][_0xf530('0x28')]({'where':{'id':0x1}});})[_0xf530('0x1c')](function(_0x484dca){if(!_0x484dca){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))]('Settings\x20not\x20available');}_0x3060a9=_0x484dca;if(!_0x3060a9[_0xf530('0x4')]||!_0x3060a9[_0xf530('0x45')]||!_0x3060a9[_0xf530('0xf')]||!_0x3060a9[_0xf530('0x21')]||!_0x3060a9['bucket']){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x46'));}return db[_0xf530('0x27')][_0xf530('0x28')]({'where':{'id':_0x3060a9[_0xf530('0x45')]}});})['then'](function(_0x304150){if(!_0x304150){throw new db[(_0xf530('0x23'))][(_0xf530('0x24'))](_0xf530('0x35'));}if(!_0x304150['data1']||!_0x304150[_0xf530('0xe')]){throw new db['Sequelize'][(_0xf530('0x24'))](_0xf530('0x29'));}_0x73b6d9=_0x304150;var _0x3d4664=[];_0x17acce[_0xf530('0x47')](function(_0x3c83eb){_0x3d4664['push'](checkTranscribeJob(_0x3c83eb,_0x3060a9,_0x73b6d9));});return BPromise[_0xf530('0x48')](_0x3d4664);})[_0xf530('0x3a')](function(_0x261c00){if(_0x261c00){if(!_0x261c00[_0xf530('0x3b')]||_0x261c00[_0xf530('0x3b')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x261c00,{'showHidden':![],'depth':null}));}}});}exports[_0xf530('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2e54=['tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Neutral','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','inspect','start','lodash','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e54,0x1dd));var _0x42e5=function(_0x3ec4a3,_0x4dfa66){_0x3ec4a3=_0x3ec4a3-0x0;var _0x7ad60b=_0x2e54[_0x3ec4a3];return _0x7ad60b;};var _=require(_0x42e5('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x42e5('0x1'));var BPromise=require(_0x42e5('0x2'));var db=require(_0x42e5('0x3'))['db'];var logger=require(_0x42e5('0x4'))(_0x42e5('0x5'));function getTranscriptionJob(_0x153440,_0x42736b,_0x528772,_0x171302){return new Promise(function(_0x455f48,_0x38cb1b){var _0x4bed10=new AWS[(_0x42e5('0x6'))]({'accessKeyId':_0x42736b,'secretAccessKey':_0x153440,'region':_0x528772});_0x4bed10['getTranscriptionJob']({'TranscriptionJobName':_0x171302},function(_0x335b92,_0x490b99){if(_0x335b92){return _0x38cb1b(_0x335b92);}else{return _0x455f48(_0x490b99);}});});}function sentiment(_0x3a8494,_0x224b11,_0x10ee5a,_0x15f9f1,_0x206bf3){return new Promise(function(_0x1e5d2d,_0xe1ab4b){var _0x2fa2f0=new AWS[(_0x42e5('0x7'))]({'accessKeyId':_0x224b11,'secretAccessKey':_0x3a8494,'region':_0x10ee5a});_0x2fa2f0['detectSentiment']({'Text':_0x15f9f1,'LanguageCode':_0x206bf3[_0x42e5('0x8')](0x0,0x2)},function(_0x28b3b3,_0x5d57f4){if(_0x28b3b3){return _0xe1ab4b(_0x28b3b3);}else{return _0x1e5d2d(_0x5d57f4);}});});}function checkTranscribeJob(_0x3a5189,_0x12385d,_0x4530ba){var _0x41598d;return new BPromise(function(_0x144fb4,_0x1faafc){logger[_0x42e5('0x9')](util[_0x42e5('0xa')](_0x42e5('0xb'),_0x3a5189['id'],_0x3a5189[_0x42e5('0xc')]));return getTranscriptionJob(_0x4530ba['data1'],_0x4530ba[_0x42e5('0xd')],_0x12385d[_0x42e5('0xe')],_0x3a5189[_0x42e5('0xc')])[_0x42e5('0xf')](function(_0x2f4999){logger[_0x42e5('0x9')](util[_0x42e5('0xa')](_0x42e5('0x10'),_0x3a5189['id'],_0x3a5189[_0x42e5('0xc')],_0x2f4999[_0x42e5('0x11')][_0x42e5('0x12')]));if(!_0x3a5189[_0x42e5('0x13')]){switch(_0x2f4999[_0x42e5('0x11')][_0x42e5('0x12')]){case'COMPLETED':var _0x1460c0={'transcribeStatus':_0x2f4999['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x2f4999[_0x42e5('0x11')][_0x42e5('0x14')]['TranscriptFileUri']};logger[_0x42e5('0x9')](util[_0x42e5('0xa')](_0x42e5('0x15'),_0x3a5189['id']));return rp({'uri':_0x2f4999[_0x42e5('0x11')][_0x42e5('0x14')][_0x42e5('0x16')],'json':!![]})[_0x42e5('0xf')](function(_0x58eee5){logger['info'](util[_0x42e5('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3a5189['id']));if(_0x58eee5&&_0x58eee5[_0x42e5('0x17')]&&_0x58eee5[_0x42e5('0x17')][_0x42e5('0x18')]&&_0x58eee5[_0x42e5('0x17')][_0x42e5('0x18')]['length']){_0x1460c0[_0x42e5('0x13')]='';for(var _0xf29221=0x0;_0xf29221<_0x58eee5[_0x42e5('0x17')][_0x42e5('0x18')][_0x42e5('0x19')];_0xf29221++){_0x1460c0['fileText']+=_0x58eee5['results'][_0x42e5('0x18')][_0xf29221]['transcript']+'';}}return _0x3a5189['update'](_0x1460c0);})[_0x42e5('0xf')](function(){logger['info'](util[_0x42e5('0xa')](_0x42e5('0x1a'),_0x3a5189['id']));if(!_0x3a5189[_0x42e5('0x1b')]){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x1e'));}if(!_0x12385d['sentiment']||!_0x12385d[_0x42e5('0x1f')]||!_0x12385d[_0x42e5('0x20')]||!_0x12385d[_0x42e5('0x21')]||!_0x12385d[_0x42e5('0x22')]){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x23'));}if(!_0x1460c0[_0x42e5('0x13')]){throw new Error(_0x42e5('0x24'));}if(_0x12385d[_0x42e5('0x1f')]===_0x4530ba['id']){return _0x4530ba;}else{return db[_0x42e5('0x25')][_0x42e5('0x26')]({'where':{'id':_settings[_0x42e5('0x1f')]}});}})['then'](function(_0x293403){if(!_0x293403){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x27'));}if(!_0x293403['data1']||!_0x293403['data2']){throw new db[(_0x42e5('0x1c'))]['ValidationError'](_0x42e5('0x28'));}_0x41598d=_0x293403;logger['info'](util[_0x42e5('0xa')](_0x42e5('0x29'),_0x3a5189['id']));return sentiment(_0x41598d[_0x42e5('0x2a')],_0x41598d['data2'],_0x12385d[_0x42e5('0x20')],_0x1460c0[_0x42e5('0x13')],_0x12385d['language']);})[_0x42e5('0xf')](function(_0x57558d){logger[_0x42e5('0x9')](util[_0x42e5('0xa')](_0x42e5('0x2b'),_0x3a5189['id']));return _0x3a5189[_0x42e5('0x2c')]({'sentiment':_0x57558d[_0x42e5('0x2d')],'sPositive':_0x57558d[_0x42e5('0x2e')][_0x42e5('0x2f')],'sNegative':_0x57558d['SentimentScore']['Negative'],'sMixed':_0x57558d[_0x42e5('0x2e')][_0x42e5('0x30')],'sNeutral':_0x57558d[_0x42e5('0x2e')]['Neutral']});})['then'](function(){logger['info'](util['format'](_0x42e5('0x1a'),_0x3a5189['id']));_0x144fb4();});case _0x42e5('0x31'):return _0x3a5189[_0x42e5('0x2c')]({'transcribeStatus':_0x42e5('0x31'),'failureReason':_0x2f4999[_0x42e5('0x11')][_0x42e5('0x32')]})[_0x42e5('0xf')](function(){logger[_0x42e5('0x9')](util['format'](_0x42e5('0x1a'),_0x3a5189['id']));_0x144fb4();});default:logger['info'](util[_0x42e5('0xa')](_0x42e5('0x33'),_0x3a5189['id']));break;}}else{return BPromise[_0x42e5('0x34')]()[_0x42e5('0xf')](function(){if(!_0x3a5189[_0x42e5('0x1b')]){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x12385d[_0x42e5('0x35')]||!_0x12385d[_0x42e5('0x1f')]||!_0x12385d['sentimentRegion']||!_0x12385d[_0x42e5('0x21')]||!_0x12385d['bucket']){throw new db['Sequelize']['ValidationError'](_0x42e5('0x23'));}if(!_0x3a5189[_0x42e5('0x13')]){throw new Error(_0x42e5('0x24'));}if(_0x12385d[_0x42e5('0x1f')]===_0x4530ba['id']){return _0x4530ba;}else{return db[_0x42e5('0x25')][_0x42e5('0x26')]({'where':{'id':_settings[_0x42e5('0x1f')]}});}})['then'](function(_0x1baebf){if(!_0x1baebf){throw new db[(_0x42e5('0x1c'))]['ValidationError'](_0x42e5('0x27'));}if(!_0x1baebf[_0x42e5('0x2a')]||!_0x1baebf['data2']){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x28'));}_0x41598d=_0x1baebf;logger[_0x42e5('0x9')](util[_0x42e5('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3a5189['id']));return sentiment(_0x41598d[_0x42e5('0x2a')],_0x41598d[_0x42e5('0xd')],_0x12385d[_0x42e5('0x20')],_0x3a5189[_0x42e5('0x13')],_0x12385d['language']);})[_0x42e5('0xf')](function(_0x24447d){logger[_0x42e5('0x9')](util[_0x42e5('0xa')](_0x42e5('0x2b'),_0x3a5189['id']));return _0x3a5189[_0x42e5('0x2c')]({'sentiment':_0x24447d[_0x42e5('0x2d')],'sPositive':_0x24447d[_0x42e5('0x2e')]['Positive'],'sNegative':_0x24447d[_0x42e5('0x2e')]['Negative'],'sMixed':_0x24447d['SentimentScore'][_0x42e5('0x30')],'sNeutral':_0x24447d[_0x42e5('0x2e')][_0x42e5('0x36')],'transcribeStatus':_0x42e5('0x37')});})[_0x42e5('0xf')](function(){logger[_0x42e5('0x9')](util[_0x42e5('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3a5189['id']));_0x144fb4();});}})[_0x42e5('0x38')](function(_0x27681a){if(_0x27681a){if(!_0x27681a[_0x42e5('0x39')]||_0x27681a[_0x42e5('0x39')]!==_0x42e5('0x3a')){logger[_0x42e5('0x3b')](util[_0x42e5('0xa')](_0x42e5('0x3c'),_0x3a5189['id']),util['inspect'](_0x27681a,{'showHidden':![],'depth':null}));}}_0x144fb4();});});}function checkTranscribe(){var _0x1311bf;var _0x3fbccb;var _0x3616f4;return db[_0x42e5('0x3d')][_0x42e5('0x3e')]({'where':{'transcribeStatus':_0x42e5('0x3f')}})[_0x42e5('0xf')](function(_0x4a9df9){if(!_0x4a9df9||!_0x4a9df9[_0x42e5('0x19')]){throw new db['Sequelize'][(_0x42e5('0x1d'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1311bf=_0x4a9df9;return db[_0x42e5('0x40')][_0x42e5('0x26')]({'where':{'id':0x1}});})[_0x42e5('0xf')](function(_0x48b63b){if(!_0x48b63b){throw new db['Sequelize']['ValidationError'](_0x42e5('0x41'));}_0x3fbccb=_0x48b63b;if(!_0x3fbccb[_0x42e5('0x5')]||!_0x3fbccb[_0x42e5('0x42')]||!_0x3fbccb[_0x42e5('0xe')]||!_0x3fbccb['language']||!_0x3fbccb[_0x42e5('0x22')]){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x42e5('0x25')]['findOne']({'where':{'id':_0x3fbccb[_0x42e5('0x42')]}});})[_0x42e5('0xf')](function(_0x53e29b){if(!_0x53e29b){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x27'));}if(!_0x53e29b[_0x42e5('0x2a')]||!_0x53e29b[_0x42e5('0xd')]){throw new db[(_0x42e5('0x1c'))][(_0x42e5('0x1d'))](_0x42e5('0x28'));}_0x3616f4=_0x53e29b;var _0x1ddd4c=[];_0x1311bf[_0x42e5('0x43')](function(_0x485f3e){_0x1ddd4c[_0x42e5('0x44')](checkTranscribeJob(_0x485f3e,_0x3fbccb,_0x3616f4));});return BPromise[_0x42e5('0x45')](_0x1ddd4c);})[_0x42e5('0x38')](function(_0x10a9bb){if(_0x10a9bb){if(!_0x10a9bb[_0x42e5('0x39')]||_0x10a9bb['name']!==_0x42e5('0x3a')){logger[_0x42e5('0x3b')](util[_0x42e5('0x46')](_0x10a9bb,{'showHidden':![],'depth':null}));}}});}exports[_0x42e5('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 b420981..ac3f232 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 _0x1149=['join','update','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','localhost','socket.io-emitter','findAll','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1149,0x19f));var _0x9114=function(_0x2facd6,_0x2aaf16){_0x2facd6=_0x2facd6-0x0;var _0x4fbcb0=_0x1149[_0x2facd6];return _0x4fbcb0;};'use strict';var _=require(_0x9114('0x0'));var moment=require(_0x9114('0x1'));var Redis=require(_0x9114('0x2'));var util=require(_0x9114('0x3'));var config=require(_0x9114('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x9114('0x5'))('schedule');config[_0x9114('0x6')]=_[_0x9114('0x7')](config[_0x9114('0x6')],{'host':_0x9114('0x8'),'port':0x18eb});var io=require(_0x9114('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x23d9cd=[];return db['WhatsappInteraction'][_0x9114('0xa')]({'raw':!![],'attributes':['id',_0x9114('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x9114('0xc'))}}})[_0x9114('0xd')](function(_0x4deba1){if(_0x4deba1&&_0x4deba1[_0x9114('0xe')]){_0x23d9cd=_['map'](_0x4deba1||[],'id');logger[_0x9114('0xf')](_0x9114('0x10'),_0x23d9cd[_0x9114('0x11')]());return db['WhatsappInteraction'][_0x9114('0x12')]({'closeReason':'system','disposition':_0x9114('0x13'),'closed':!![],'closedAt':moment()[_0x9114('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x23d9cd}});}})['then'](function(){if(_0x23d9cd&&_0x23d9cd[_0x9114('0xe')]){logger[_0x9114('0xf')](_0x9114('0x15'),_0x23d9cd['join']());for(var _0x3f34d6=0x0;_0x3f34d6<_0x23d9cd[_0x9114('0xe')];_0x3f34d6++){io[_0x9114('0x16')](_0x9114('0x17'),{'id':_0x23d9cd[_0x3f34d6],'closed':!![]});}}})[_0x9114('0x18')](function(_0x5ff6fb){logger[_0x9114('0x19')](_0x9114('0x1a'),_0x5ff6fb?util['inspect'](_0x5ff6fb,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6bfc=['system','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x6bfc,0x159));var _0xc6bf=function(_0x2eddbd,_0x22c722){_0x2eddbd=_0x2eddbd-0x0;var _0x3075ab=_0x6bfc[_0x2eddbd];return _0x3075ab;};'use strict';var _=require('lodash');var moment=require(_0xc6bf('0x0'));var Redis=require(_0xc6bf('0x1'));var util=require(_0xc6bf('0x2'));var config=require('../../config/environment');var db=require(_0xc6bf('0x3'))['db'];var logger=require('../logger')(_0xc6bf('0x4'));config['redis']=_[_0xc6bf('0x5')](config[_0xc6bf('0x6')],{'host':_0xc6bf('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc6bf('0x6')]));function closeInteractions(){var _0x2c9049=[];return db[_0xc6bf('0x8')][_0xc6bf('0x9')]({'raw':!![],'attributes':['id',_0xc6bf('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xc6bf('0xb')](0x18,_0xc6bf('0xc'))}}})[_0xc6bf('0xd')](function(_0x52dac0){if(_0x52dac0&&_0x52dac0[_0xc6bf('0xe')]){_0x2c9049=_[_0xc6bf('0xf')](_0x52dac0||[],'id');logger[_0xc6bf('0x10')](_0xc6bf('0x11'),_0x2c9049['join']());return db['WhatsappInteraction'][_0xc6bf('0x12')]({'closeReason':_0xc6bf('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xc6bf('0x14'))},{'where':{'id':_0x2c9049}});}})[_0xc6bf('0xd')](function(){if(_0x2c9049&&_0x2c9049['length']){logger[_0xc6bf('0x10')](_0xc6bf('0x15'),_0x2c9049[_0xc6bf('0x16')]());for(var _0x34420d=0x0;_0x34420d<_0x2c9049[_0xc6bf('0xe')];_0x34420d++){io['emit']('whatsappInteraction:update',{'id':_0x2c9049[_0x34420d],'closed':!![]});}}})[_0xc6bf('0x17')](function(_0x391117){logger[_0xc6bf('0x18')](_0xc6bf('0x19'),_0x391117?util[_0xc6bf('0x1a')](_0x391117,{'showHidden':![],'depth':null}):'');});}exports[_0xc6bf('0x1b')]=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 4a540bf..b869bd9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7895=['CmHopper','hopper1','contacts2','hopper2','catch','util','push','@xcally.com','now','Innocenzo','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1'];(function(_0xf0a541,_0x149051){var _0x48c42b=function(_0xf161ea){while(--_0xf161ea){_0xf0a541['push'](_0xf0a541['shift']());}};_0x48c42b(++_0x149051);}(_0x7895,0x113));var _0x5789=function(_0x1d903d,_0x44911b){_0x1d903d=_0x1d903d-0x0;var _0xe2f9d8=_0x7895[_0x1d903d];return _0xe2f9d8;};'use strict';var util=require(_0x5789('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5789('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x5789('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5789('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x5789('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5789('0x3')](),'updatedAt':Date[_0x5789('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x5789('0x4')+i,'lastName':_0x5789('0x5')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5789('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5789('0x3')](),'updatedAt':Date['now']()});}db[_0x5789('0x6')][_0x5789('0x7')]({'where':{}})[_0x5789('0x8')](function(){return db['CmContact'][_0x5789('0x9')](contacts);})['then'](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xc'));return db[_0x5789('0xd')][_0x5789('0x7')]({'where':{}});})['then'](function(){return db[_0x5789('0xd')][_0x5789('0x9')](hopper);})['then'](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xe'));return db[_0x5789('0x6')][_0x5789('0x9')](contacts2);})[_0x5789('0x8')](function(){console[_0x5789('0xa')](_0x5789('0xb'),_0x5789('0xf'));return db[_0x5789('0xd')][_0x5789('0x9')](hopper2);})[_0x5789('0x8')](function(){console['log'](_0x5789('0xb'),_0x5789('0x10'));})[_0x5789('0x11')](function(_0x2285d3){console['log'](_0x2285d3);}); \ No newline at end of file +var _0xe81c=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','hopper1','contacts2','CmHopper','hopper2','catch'];(function(_0x17603a,_0xb27b9d){var _0x3971d8=function(_0x562e8f){while(--_0x562e8f){_0x17603a['push'](_0x17603a['shift']());}};_0x3971d8(++_0xb27b9d);}(_0xe81c,0xab));var _0xce81=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xe81c[_0x1ee0a1];return _0x1d2d5b;};'use strict';var util=require(_0xce81('0x0'));var db=require(_0xce81('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce81('0x2')]({'id':i,'firstName':_0xce81('0x3')+i,'lastName':_0xce81('0x4')+i,'phone':0xf879fb460+i,'email':_0xce81('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xce81('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce81('0x6')](),'updatedAt':Date[_0xce81('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xce81('0x2')]({'id':i,'firstName':_0xce81('0x3')+i,'lastName':_0xce81('0x4')+i,'phone':0xf879fb460+i,'email':_0xce81('0x5')+i+_0xce81('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xce81('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce81('0x6')](),'updatedAt':Date['now']()});}db[_0xce81('0x8')][_0xce81('0x9')]({'where':{}})[_0xce81('0xa')](function(){return db[_0xce81('0x8')][_0xce81('0xb')](contacts);})[_0xce81('0xa')](function(){console[_0xce81('0xc')](_0xce81('0xd'),'contacts1');return db['CmHopper'][_0xce81('0x9')]({'where':{}});})[_0xce81('0xa')](function(){return db['CmHopper'][_0xce81('0xb')](hopper);})['then'](function(){console[_0xce81('0xc')](_0xce81('0xd'),_0xce81('0xe'));return db[_0xce81('0x8')][_0xce81('0xb')](contacts2);})[_0xce81('0xa')](function(){console[_0xce81('0xc')](_0xce81('0xd'),_0xce81('0xf'));return db[_0xce81('0x10')]['bulkCreate'](hopper2);})['then'](function(){console[_0xce81('0xc')]('finished\x20populating',_0xce81('0x11'));})[_0xce81('0x12')](function(_0x242fcf){console['log'](_0x242fcf);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e8c2781..513740a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe323=['wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp'];(function(_0x338b3e,_0x11d80b){var _0xcb18a0=function(_0x155264){while(--_0x155264){_0x338b3e['push'](_0x338b3e['shift']());}};_0xcb18a0(++_0x11d80b);}(_0xe323,0x1f0));var _0x3e32=function(_0x4e2cf2,_0x1d0f3e){_0x4e2cf2=_0x4e2cf2-0x0;var _0xd70473=_0xe323[_0x4e2cf2];return _0xd70473;};'use strict';var util=require(_0x3e32('0x0'));var db=require(_0x3e32('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3e32('0x2')]({'name':util[_0x3e32('0x3')](_0x3e32('0x4'),_0x3e32('0x5'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x3e32('0x3')](_0x3e32('0x6'),'agent',i),'role':_0x3e32('0x5'),'password':_0x3e32('0x7'),'internal':0xfa0+i,'type':_0x3e32('0x8'),'transport':[_0x3e32('0x9'),'ws',_0x3e32('0xa')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x3e32('0x3')](_0x3e32('0x4'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0x3e32('0xb'),'icesupport':_0x3e32('0xb'),'dtlsenable':_0x3e32('0xb'),'dtlsverify':'no','dtlscertfile':_0x3e32('0xc'),'dtlsprivatekey':_0x3e32('0xd'),'dtlssetup':_0x3e32('0xe'),'callerid':util[_0x3e32('0x3')](_0x3e32('0xf'),util['format'](_0x3e32('0x4'),_0x3e32('0x5'),i),0xfa0+i)});}db[_0x3e32('0x10')][_0x3e32('0x11')](users)[_0x3e32('0x12')](function(){console[_0x3e32('0x13')](_0x3e32('0x14'));})[_0x3e32('0x15')](function(_0x171bb7){console['log'](_0x171bb7);}); \ No newline at end of file +var _0x1711=['add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log'];(function(_0x2c159e,_0x210522){var _0x123df1=function(_0x154fae){while(--_0x154fae){_0x2c159e['push'](_0x2c159e['shift']());}};_0x123df1(++_0x210522);}(_0x1711,0xc9));var _0x1171=function(_0x3c2403,_0x35f3de){_0x3c2403=_0x3c2403-0x0;var _0x37c09b=_0x1711[_0x3c2403];return _0x37c09b;};'use strict';var util=require(_0x1171('0x0'));var db=require(_0x1171('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1171('0x2')]({'name':util[_0x1171('0x3')](_0x1171('0x4'),_0x1171('0x5'),i),'fullname':util[_0x1171('0x3')](_0x1171('0x4'),'agent',i),'email':util[_0x1171('0x3')](_0x1171('0x6'),_0x1171('0x5'),i),'role':_0x1171('0x5'),'password':'password','internal':0xfa0+i,'type':_0x1171('0x7'),'transport':[_0x1171('0x8'),'ws','wss'],'disallow':[_0x1171('0x9')],'allow':[_0x1171('0xa')],'defaultuser':util[_0x1171('0x3')]('%s%s',_0x1171('0x5'),i),'encryption':_0x1171('0xb'),'avpf':_0x1171('0xb'),'force_avp':_0x1171('0xb'),'icesupport':'yes','dtlsenable':_0x1171('0xb'),'dtlsverify':'no','dtlscertfile':_0x1171('0xc'),'dtlsprivatekey':_0x1171('0xd'),'dtlssetup':_0x1171('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x1171('0x3')]('%s%s',_0x1171('0x5'),i),0xfa0+i)});}db[_0x1171('0xf')][_0x1171('0x10')](users)[_0x1171('0x11')](function(){console[_0x1171('0x12')](_0x1171('0x13'));})['catch'](function(_0x2ea989){console[_0x1171('0x12')](_0x2ea989);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 06e5420..ab9397a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91ed=['OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','VoiceQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','address','connection','remoteAddress','request','remotePort','log','nsp','disconnect','DISCONNECTED','bluebird','../mysqldb','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x91ed,0x99));var _0xd91e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x91ed[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xd91e('0x0'));var db=require(_0xd91e('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xd91e('0x2')],'include':[{'as':_0xd91e('0x3'),'model':db[_0xd91e('0x4')],'attributes':['id','name',_0xd91e('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xd91e('0x2')],'where':{'role':_0xd91e('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xd91e('0x2')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xd91e('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xd91e('0x2'),_0xd91e('0x8')],'where':{'type':_0xd91e('0x9')}};function getAssociatedResources(_0x33d9d1,_0x141ea4,_0x4d5dd1){return db[_0xd91e('0xa')][_0xd91e('0xb')]({'where':{'name':_0x33d9d1,'userProfileId':_0x141ea4},'raw':!![]})[_0xd91e('0xc')](function(_0xfd52a){if(_0xfd52a){if(_0xfd52a['autoAssociation']){switch(_0x33d9d1){case _0xd91e('0xd'):case _0xd91e('0xe'):case _0xd91e('0xf'):case _0xd91e('0x10'):case _0xd91e('0x11'):case _0xd91e('0x12'):case _0xd91e('0x13'):return db[_0x4d5dd1]['findAll'](queryQueues);case _0xd91e('0x14'):return db[_0x4d5dd1]['findAll'](queryTelephones);case'Trunks':return db[_0x4d5dd1][_0xd91e('0x15')](queryTrunks);case _0xd91e('0x16'):return db[_0x4d5dd1][_0xd91e('0x15')](queryCampaigns);}}else{return db[_0xd91e('0x17')][_0xd91e('0x15')]({'attributes':[_0xd91e('0x18')],'where':{'sectionId':_0xfd52a['id']},'raw':!![]})[_0xd91e('0xc')](function(_0x47a508){if(_0x47a508){var _0x387cf2={'where':{'id':_[_0xd91e('0x19')](_0x47a508,_0xd91e('0x18'))},'raw':!![]};switch(_0x4d5dd1){case _0xd91e('0x4'):_0x387cf2[_0xd91e('0x1a')][_0xd91e('0x5')]=_0xd91e('0x6');break;case _0xd91e('0x1b'):_0x387cf2[_0xd91e('0x1a')][_0xd91e('0x8')]='ivr';break;}return db[_0x4d5dd1][_0xd91e('0x15')](_0x387cf2);}else{return[];}});}}else{return[];}})[_0xd91e('0xc')](function(_0xa9ca33){return _0xa9ca33;});}function joinOrLeaveQueues(_0x349817,_0x3fdff7,_0x1f0ef5,_0x2d1070){_0x349817[_0x3fdff7](util[_0xd91e('0x1c')](_0xd91e('0x1d'),_0x1f0ef5,_0x2d1070[_0xd91e('0x2')]));if(_0x2d1070[_0xd91e('0x3')]){for(var _0x125ee0=0x0;_0x125ee0<_0x2d1070['Agents'][_0xd91e('0x1e')];_0x125ee0+=0x1){_0x349817[_0x3fdff7](util['format'](_0xd91e('0x1f'),_0x2d1070['Agents'][_0x125ee0][_0xd91e('0x2')]));}}}function joinOrLeave(_0x21339c,_0x38b026,_0x59da27){var _0x55074c;if(_0x21339c[_0xd91e('0x20')][_0xd91e('0x21')]['id']){db[_0xd91e('0x4')][_0xd91e('0x22')]({'attributes':['id',_0xd91e('0x2'),_0xd91e('0x5'),'userProfileId'],'where':{'id':_0x21339c[_0xd91e('0x20')][_0xd91e('0x21')]['id']},'include':[{'model':db[_0xd91e('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x24')],'as':_0xd91e('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xd91e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xd91e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x28')],'as':_0xd91e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xd91e('0x2a')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xd91e('0xc')](function(_0x11d248){if(_0x11d248){_0x55074c=_0x11d248;_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x1f'),_0x11d248['name']));var _0xd4957c=[];switch(_0x11d248[_0xd91e('0x5')]){case _0xd91e('0x2b'):_0x21339c[_0x38b026](_0xd91e('0x2c'));_0x21339c[_0x38b026](_0xd91e('0x2d'));if(queryQueues[_0xd91e('0x2e')](_0xd91e('0x2f'))){delete queryQueues[_0xd91e('0x2f')];}_0xd4957c[_0xd91e('0x30')](db['VoiceQueue']['findAll'](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x31')]['findAll'](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x32')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x33')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db['MailQueue'][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x34')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x35')][_0xd91e('0x15')](queryQueues));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x4')]['findAll'](queryTelephones));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x36')][_0xd91e('0x15')](queryTrunks));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x1b')][_0xd91e('0x15')](queryCampaigns));_0xd4957c[_0xd91e('0x30')](db[_0xd91e('0x4')][_0xd91e('0x15')](queryAgents));break;case _0xd91e('0x37'):_0x21339c[_0x38b026]('voice:inbound');_0x21339c[_0x38b026](_0xd91e('0x2d'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0xd'),_0x11d248[_0xd91e('0x38')],_0xd91e('0x39')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0xe'),_0x11d248[_0xd91e('0x38')],_0xd91e('0x31')));_0xd4957c['push'](getAssociatedResources(_0xd91e('0xf'),_0x11d248['userProfileId'],_0xd91e('0x32')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x10'),_0x11d248[_0xd91e('0x38')],'SmsQueue'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources('MailQueues',_0x11d248[_0xd91e('0x38')],'MailQueue'));_0xd4957c['push'](getAssociatedResources('OpenchannelQueues',_0x11d248[_0xd91e('0x38')],'OpenchannelQueue'));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x13'),_0x11d248['userProfileId'],'WhatsappQueue'));_0xd4957c['push'](getAssociatedResources(_0xd91e('0x14'),_0x11d248['userProfileId'],_0xd91e('0x4')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x3a'),_0x11d248['userProfileId'],_0xd91e('0x36')));_0xd4957c[_0xd91e('0x30')](getAssociatedResources(_0xd91e('0x16'),_0x11d248['userProfileId'],_0xd91e('0x1b')));_0xd4957c['push'](db[_0xd91e('0x4')][_0xd91e('0x15')](queryAgents));break;case _0xd91e('0x7'):_0x21339c[_0x38b026](_0xd91e('0x2c'));_0x21339c[_0x38b026]('voice:outbound');_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3b')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3c')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c['push'](_0x11d248[_0xd91e('0x3d')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248['getSmsQueues']({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c['push'](_0x11d248[_0xd91e('0x3e')]({'attributes':['id','name']}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x3f')]({'attributes':['id',_0xd91e('0x2')]}));_0xd4957c[_0xd91e('0x30')](_0x11d248[_0xd91e('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0xd91e('0x41')](_0xd4957c);}})['then'](function(_0x17b5db){if(_0x17b5db&&_0x17b5db[_0xd91e('0x1e')]){for(var _0x43e2e5=0x0;_0x43e2e5<_0x17b5db['length'];_0x43e2e5+=0x1){for(var _0x27c1ef=0x0;_0x27c1ef<_0x17b5db[_0x43e2e5][_0xd91e('0x1e')];_0x27c1ef+=0x1){switch(_0x43e2e5){case 0x0:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x42'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x1:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x43'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x2:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x44'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x3:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x45'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x4:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x46'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x5:joinOrLeaveQueues(_0x21339c,_0x38b026,'openchannel',_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x6:joinOrLeaveQueues(_0x21339c,_0x38b026,_0xd91e('0x47'),_0x17b5db[_0x43e2e5][_0x27c1ef]);break;case 0x7:if(_0x55074c[_0xd91e('0x5')]!==_0xd91e('0x7'))_0x21339c[_0x38b026](util['format'](_0xd91e('0x48'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0x8:if(_0x55074c[_0xd91e('0x5')]!==_0xd91e('0x7'))_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x49'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0x9:if(_0x55074c['role']!==_0xd91e('0x7'))_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x4a'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x8')],_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;case 0xa:_0x21339c[_0x38b026](util[_0xd91e('0x1c')](_0xd91e('0x1f'),_0x17b5db[_0x43e2e5][_0x27c1ef][_0xd91e('0x2')]));break;}}}}})['then'](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x2f6cc8=_[_0xd91e('0x19')](_0x55074c[_0xd91e('0x4c')],'id');return _0x55074c['removeChatInteractions'](_0x2f6cc8)['then'](function(){for(var _0x59468e=0x0;_0x59468e<_0x2f6cc8[_0xd91e('0x1e')];_0x59468e+=0x1){_0x59da27['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x2f6cc8[_0x59468e]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x5bb1f8=_[_0xd91e('0x19')](_0x55074c[_0xd91e('0x25')],'id');return _0x55074c[_0xd91e('0x4d')](_0x5bb1f8)[_0xd91e('0xc')](function(){for(var _0x578978=0x0;_0x578978<_0x5bb1f8[_0xd91e('0x1e')];_0x578978+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x4f'),{'MailInteractionId':Number(_0x5bb1f8[_0x578978]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x3b1331=_['map'](_0x55074c[_0xd91e('0x26')],'id');return _0x55074c[_0xd91e('0x50')](_0x3b1331)[_0xd91e('0xc')](function(){for(var _0x279a3b=0x0;_0x279a3b<_0x3b1331[_0xd91e('0x1e')];_0x279a3b+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x51'),{'FaxInteractionId':Number(_0x3b1331[_0x279a3b]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0xc')](function(){if(_0x38b026==='leave'){var _0x5183fb=_[_0xd91e('0x19')](_0x55074c['SmsInteractions'],'id');return _0x55074c[_0xd91e('0x52')](_0x5183fb)[_0xd91e('0xc')](function(){for(var _0x4aa68d=0x0;_0x4aa68d<_0x5183fb[_0xd91e('0x1e')];_0x4aa68d+=0x1){_0x59da27['emit'](_0xd91e('0x53'),{'SmsInteractionId':Number(_0x5183fb[_0x4aa68d]),'UserId':Number(_0x55074c['id'])});}});}})['then'](function(){if(_0x38b026===_0xd91e('0x4b')){var _0x3f93f1=_['map'](_0x55074c[_0xd91e('0x29')],'id');return _0x55074c[_0xd91e('0x54')](_0x3f93f1)['then'](function(){for(var _0x3d2ac2=0x0;_0x3d2ac2<_0x3f93f1[_0xd91e('0x1e')];_0x3d2ac2+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x55'),{'OpenchannelInteractionId':Number(_0x3f93f1[_0x3d2ac2]),'UserId':Number(_0x55074c['id'])});}});}})['then'](function(){if(_0x38b026==='leave'){var _0x55300f=_[_0xd91e('0x19')](_0x55074c['WhatsappInteractions'],'id');return _0x55074c['removeWhatsappInteractions'](_0x55300f)['then'](function(){for(var _0x37527a=0x0;_0x37527a<_0x55300f[_0xd91e('0x1e')];_0x37527a+=0x1){_0x59da27[_0xd91e('0x4e')](_0xd91e('0x56'),{'WhatsappInteractionId':Number(_0x55300f[_0x37527a]),'UserId':Number(_0x55074c['id'])});}});}})[_0xd91e('0x57')](function(_0x185ab1){_0x21339c['log'](_0x185ab1);});}}function onDisconnect(_0x2b0c8f,_0x518f14){joinOrLeave(_0x2b0c8f,_0xd91e('0x4b'),_0x518f14);}function onConnect(_0x253ea2){joinOrLeave(_0x253ea2,'join');}exports['default']=function(_0x1b8074){_0x1b8074['on']('connection',function(_0x1d3dae){_0x1d3dae['setMaxListeners'](0x0);_0x1d3dae[_0xd91e('0x58')]=_0x1d3dae['request'][_0xd91e('0x59')][_0xd91e('0x5a')]+':'+_0x1d3dae[_0xd91e('0x5b')][_0xd91e('0x59')][_0xd91e('0x5c')];_0x1d3dae['connectedAt']=new Date();_0x1d3dae[_0xd91e('0x5d')]=function(_0x505cfe){console[_0xd91e('0x5d')]('SocketIO\x20'+_0x1d3dae[_0xd91e('0x5e')]['name']+'['+_0x1d3dae[_0xd91e('0x58')]+']',_0x505cfe);};_0x1d3dae['on'](_0xd91e('0x5f'),function(){onDisconnect(_0x1d3dae,_0x1b8074);_0x1d3dae['log'](_0xd91e('0x60'));});onConnect(_0x1d3dae);_0x1d3dae[_0xd91e('0x5d')]('CONNECTED');});}; \ No newline at end of file +var _0xe6e9=['ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','voice:outbound','include','push','VoiceQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','VoiceQueues','ChatQueue','FaxQueue','SmsQueues','WhatsappQueue','Telephones','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','emit','user_has_chat_interactions:remove','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','Agents','User','agent','telephone','type','ivr','findOne','then','autoAssociation'];(function(_0x105442,_0x472610){var _0x1fa1b2=function(_0x384c23){while(--_0x384c23){_0x105442['push'](_0x105442['shift']());}};_0x1fa1b2(++_0x472610);}(_0xe6e9,0x182));var _0x9e6e=function(_0x3cf95b,_0x54e340){_0x3cf95b=_0x3cf95b-0x0;var _0xc1c3c8=_0xe6e9[_0x3cf95b];return _0xc1c3c8;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var BPromise=require(_0x9e6e('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x9e6e('0x3'));var queryQueues={'attributes':['id',_0x9e6e('0x4')],'include':[{'as':_0x9e6e('0x5'),'model':db[_0x9e6e('0x6')],'attributes':['id',_0x9e6e('0x4'),'role'],'raw':!![],'where':{'role':_0x9e6e('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9e6e('0x4')],'where':{'role':_0x9e6e('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9e6e('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x9e6e('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9e6e('0x4'),_0x9e6e('0x9')],'where':{'type':_0x9e6e('0xa')}};function getAssociatedResources(_0x1470be,_0x1ce1b0,_0x42b7ed){return db['UserProfileSection'][_0x9e6e('0xb')]({'where':{'name':_0x1470be,'userProfileId':_0x1ce1b0},'raw':!![]})[_0x9e6e('0xc')](function(_0x286351){if(_0x286351){if(_0x286351[_0x9e6e('0xd')]){switch(_0x1470be){case'VoiceQueues':case _0x9e6e('0xe'):case _0x9e6e('0xf'):case'SmsQueues':case _0x9e6e('0x10'):case _0x9e6e('0x11'):case _0x9e6e('0x12'):return db[_0x42b7ed][_0x9e6e('0x13')](queryQueues);case'Telephones':return db[_0x42b7ed][_0x9e6e('0x13')](queryTelephones);case _0x9e6e('0x14'):return db[_0x42b7ed][_0x9e6e('0x13')](queryTrunks);case _0x9e6e('0x15'):return db[_0x42b7ed][_0x9e6e('0x13')](queryCampaigns);}}else{return db[_0x9e6e('0x16')][_0x9e6e('0x13')]({'attributes':[_0x9e6e('0x17')],'where':{'sectionId':_0x286351['id']},'raw':!![]})[_0x9e6e('0xc')](function(_0x2dbdba){if(_0x2dbdba){var _0x1941da={'where':{'id':_[_0x9e6e('0x18')](_0x2dbdba,_0x9e6e('0x17'))},'raw':!![]};switch(_0x42b7ed){case _0x9e6e('0x6'):_0x1941da[_0x9e6e('0x19')][_0x9e6e('0x1a')]=_0x9e6e('0x8');break;case _0x9e6e('0x1b'):_0x1941da[_0x9e6e('0x19')][_0x9e6e('0x9')]=_0x9e6e('0xa');break;}return db[_0x42b7ed]['findAll'](_0x1941da);}else{return[];}});}}else{return[];}})['then'](function(_0x5e956c){return _0x5e956c;});}function joinOrLeaveQueues(_0x14acbd,_0x4027ba,_0x9b0282,_0x351201){_0x14acbd[_0x4027ba](util[_0x9e6e('0x1c')](_0x9e6e('0x1d'),_0x9b0282,_0x351201[_0x9e6e('0x4')]));if(_0x351201[_0x9e6e('0x5')]){for(var _0x4e66e3=0x0;_0x4e66e3<_0x351201[_0x9e6e('0x5')][_0x9e6e('0x1e')];_0x4e66e3+=0x1){_0x14acbd[_0x4027ba](util[_0x9e6e('0x1c')](_0x9e6e('0x1f'),_0x351201[_0x9e6e('0x5')][_0x4e66e3][_0x9e6e('0x4')]));}}}function joinOrLeave(_0x3d429e,_0x59e00e,_0x223fd4){var _0x4202cd;if(_0x3d429e[_0x9e6e('0x20')][_0x9e6e('0x21')]['id']){db['User']['find']({'attributes':['id',_0x9e6e('0x4'),_0x9e6e('0x1a'),_0x9e6e('0x22')],'where':{'id':_0x3d429e['handshake']['query']['id']},'include':[{'model':db[_0x9e6e('0x23')],'as':_0x9e6e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x9e6e('0x25')],'as':_0x9e6e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9e6e('0x27')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9e6e('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9e6e('0x29')],'as':_0x9e6e('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2511f7){if(_0x2511f7){_0x4202cd=_0x2511f7;_0x3d429e[_0x59e00e](util[_0x9e6e('0x1c')](_0x9e6e('0x1f'),_0x2511f7[_0x9e6e('0x4')]));var _0x5d85ac=[];switch(_0x2511f7[_0x9e6e('0x1a')]){case'admin':_0x3d429e[_0x59e00e]('voice:inbound');_0x3d429e[_0x59e00e](_0x9e6e('0x2b'));if(queryQueues['hasOwnProperty'](_0x9e6e('0x2c'))){delete queryQueues[_0x9e6e('0x2c')];}_0x5d85ac[_0x9e6e('0x2d')](db[_0x9e6e('0x2e')]['findAll'](queryQueues));_0x5d85ac[_0x9e6e('0x2d')](db['ChatQueue'][_0x9e6e('0x13')](queryQueues));_0x5d85ac['push'](db['FaxQueue'][_0x9e6e('0x13')](queryQueues));_0x5d85ac[_0x9e6e('0x2d')](db[_0x9e6e('0x2f')]['findAll'](queryQueues));_0x5d85ac[_0x9e6e('0x2d')](db[_0x9e6e('0x30')][_0x9e6e('0x13')](queryQueues));_0x5d85ac['push'](db[_0x9e6e('0x31')][_0x9e6e('0x13')](queryQueues));_0x5d85ac[_0x9e6e('0x2d')](db['WhatsappQueue']['findAll'](queryQueues));_0x5d85ac['push'](db[_0x9e6e('0x6')][_0x9e6e('0x13')](queryTelephones));_0x5d85ac['push'](db[_0x9e6e('0x32')]['findAll'](queryTrunks));_0x5d85ac['push'](db[_0x9e6e('0x1b')][_0x9e6e('0x13')](queryCampaigns));_0x5d85ac[_0x9e6e('0x2d')](db['User'][_0x9e6e('0x13')](queryAgents));break;case'user':_0x3d429e[_0x59e00e]('voice:inbound');_0x3d429e[_0x59e00e](_0x9e6e('0x2b'));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources(_0x9e6e('0x33'),_0x2511f7['userProfileId'],_0x9e6e('0x2e')));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources(_0x9e6e('0xe'),_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x34')));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources('FaxQueues',_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x35')));_0x5d85ac['push'](getAssociatedResources(_0x9e6e('0x36'),_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x2f')));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources('MailQueues',_0x2511f7['userProfileId'],_0x9e6e('0x30')));_0x5d85ac['push'](getAssociatedResources('OpenchannelQueues',_0x2511f7['userProfileId'],'OpenchannelQueue'));_0x5d85ac['push'](getAssociatedResources('WhatsappQueues',_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x37')));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources(_0x9e6e('0x38'),_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x6')));_0x5d85ac['push'](getAssociatedResources(_0x9e6e('0x14'),_0x2511f7[_0x9e6e('0x22')],_0x9e6e('0x32')));_0x5d85ac[_0x9e6e('0x2d')](getAssociatedResources(_0x9e6e('0x15'),_0x2511f7['userProfileId'],'Campaign'));_0x5d85ac['push'](db[_0x9e6e('0x6')][_0x9e6e('0x13')](queryAgents));break;case _0x9e6e('0x7'):_0x3d429e[_0x59e00e](_0x9e6e('0x39'));_0x3d429e[_0x59e00e](_0x9e6e('0x2b'));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7[_0x9e6e('0x3a')]({'attributes':['id','name']}));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7[_0x9e6e('0x3b')]({'attributes':['id','name']}));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7[_0x9e6e('0x3c')]({'attributes':['id','name']}));_0x5d85ac['push'](_0x2511f7[_0x9e6e('0x3d')]({'attributes':['id',_0x9e6e('0x4')]}));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7['getMailQueues']({'attributes':['id',_0x9e6e('0x4')]}));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7[_0x9e6e('0x3e')]({'attributes':['id',_0x9e6e('0x4')]}));_0x5d85ac[_0x9e6e('0x2d')](_0x2511f7['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x9e6e('0x3f')](_0x5d85ac);}})[_0x9e6e('0xc')](function(_0x4ba063){if(_0x4ba063&&_0x4ba063['length']){for(var _0x11ba60=0x0;_0x11ba60<_0x4ba063[_0x9e6e('0x1e')];_0x11ba60+=0x1){for(var _0x4a1370=0x0;_0x4a1370<_0x4ba063[_0x11ba60][_0x9e6e('0x1e')];_0x4a1370+=0x1){switch(_0x11ba60){case 0x0:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x40'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x1:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x41'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x2:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x42'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x3:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x43'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x4:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x44'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x5:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x45'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x6:joinOrLeaveQueues(_0x3d429e,_0x59e00e,_0x9e6e('0x46'),_0x4ba063[_0x11ba60][_0x4a1370]);break;case 0x7:if(_0x4202cd[_0x9e6e('0x1a')]!==_0x9e6e('0x7'))_0x3d429e[_0x59e00e](util[_0x9e6e('0x1c')](_0x9e6e('0x47'),_0x4ba063[_0x11ba60][_0x4a1370][_0x9e6e('0x4')]));break;case 0x8:if(_0x4202cd[_0x9e6e('0x1a')]!==_0x9e6e('0x7'))_0x3d429e[_0x59e00e](util[_0x9e6e('0x1c')](_0x9e6e('0x48'),_0x4ba063[_0x11ba60][_0x4a1370][_0x9e6e('0x4')]));break;case 0x9:if(_0x4202cd['role']!==_0x9e6e('0x7'))_0x3d429e[_0x59e00e](util['format']('campaign:%s:%s',_0x4ba063[_0x11ba60][_0x4a1370][_0x9e6e('0x9')],_0x4ba063[_0x11ba60][_0x4a1370]['name']));break;case 0xa:_0x3d429e[_0x59e00e](util['format'](_0x9e6e('0x1f'),_0x4ba063[_0x11ba60][_0x4a1370][_0x9e6e('0x4')]));break;}}}}})[_0x9e6e('0xc')](function(){if(_0x59e00e==='leave'){var _0x33ca5d=_['map'](_0x4202cd[_0x9e6e('0x24')],'id');return _0x4202cd['removeChatInteractions'](_0x33ca5d)[_0x9e6e('0xc')](function(){for(var _0x361ed9=0x0;_0x361ed9<_0x33ca5d[_0x9e6e('0x1e')];_0x361ed9+=0x1){_0x223fd4[_0x9e6e('0x49')](_0x9e6e('0x4a'),{'ChatInteractionId':Number(_0x33ca5d[_0x361ed9]),'UserId':Number(_0x4202cd['id'])});}});}})[_0x9e6e('0xc')](function(){if(_0x59e00e===_0x9e6e('0x4b')){var _0x1fc3ff=_[_0x9e6e('0x18')](_0x4202cd[_0x9e6e('0x26')],'id');return _0x4202cd['removeMailInteractions'](_0x1fc3ff)['then'](function(){for(var _0x39fc26=0x0;_0x39fc26<_0x1fc3ff[_0x9e6e('0x1e')];_0x39fc26+=0x1){_0x223fd4['emit'](_0x9e6e('0x4c'),{'MailInteractionId':Number(_0x1fc3ff[_0x39fc26]),'UserId':Number(_0x4202cd['id'])});}});}})[_0x9e6e('0xc')](function(){if(_0x59e00e===_0x9e6e('0x4b')){var _0x20dcb3=_[_0x9e6e('0x18')](_0x4202cd['FaxInteractions'],'id');return _0x4202cd[_0x9e6e('0x4d')](_0x20dcb3)[_0x9e6e('0xc')](function(){for(var _0x319aa1=0x0;_0x319aa1<_0x20dcb3[_0x9e6e('0x1e')];_0x319aa1+=0x1){_0x223fd4['emit'](_0x9e6e('0x4e'),{'FaxInteractionId':Number(_0x20dcb3[_0x319aa1]),'UserId':Number(_0x4202cd['id'])});}});}})[_0x9e6e('0xc')](function(){if(_0x59e00e==='leave'){var _0x204deb=_[_0x9e6e('0x18')](_0x4202cd[_0x9e6e('0x4f')],'id');return _0x4202cd[_0x9e6e('0x50')](_0x204deb)[_0x9e6e('0xc')](function(){for(var _0x1380c1=0x0;_0x1380c1<_0x204deb[_0x9e6e('0x1e')];_0x1380c1+=0x1){_0x223fd4[_0x9e6e('0x49')](_0x9e6e('0x51'),{'SmsInteractionId':Number(_0x204deb[_0x1380c1]),'UserId':Number(_0x4202cd['id'])});}});}})[_0x9e6e('0xc')](function(){if(_0x59e00e==='leave'){var _0x1e0c33=_['map'](_0x4202cd[_0x9e6e('0x52')],'id');return _0x4202cd[_0x9e6e('0x53')](_0x1e0c33)['then'](function(){for(var _0x174351=0x0;_0x174351<_0x1e0c33[_0x9e6e('0x1e')];_0x174351+=0x1){_0x223fd4['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1e0c33[_0x174351]),'UserId':Number(_0x4202cd['id'])});}});}})['then'](function(){if(_0x59e00e===_0x9e6e('0x4b')){var _0x497a95=_[_0x9e6e('0x18')](_0x4202cd['WhatsappInteractions'],'id');return _0x4202cd[_0x9e6e('0x54')](_0x497a95)[_0x9e6e('0xc')](function(){for(var _0x2ed43b=0x0;_0x2ed43b<_0x497a95['length'];_0x2ed43b+=0x1){_0x223fd4[_0x9e6e('0x49')](_0x9e6e('0x55'),{'WhatsappInteractionId':Number(_0x497a95[_0x2ed43b]),'UserId':Number(_0x4202cd['id'])});}});}})['catch'](function(_0x32b41d){_0x3d429e['log'](_0x32b41d);});}}function onDisconnect(_0x55c4d2,_0x39492e){joinOrLeave(_0x55c4d2,'leave',_0x39492e);}function onConnect(_0x1ff174){joinOrLeave(_0x1ff174,'join');}exports[_0x9e6e('0x56')]=function(_0x45fe51){_0x45fe51['on'](_0x9e6e('0x57'),function(_0x832817){_0x832817[_0x9e6e('0x58')](0x0);_0x832817[_0x9e6e('0x59')]=_0x832817['request'][_0x9e6e('0x57')][_0x9e6e('0x5a')]+':'+_0x832817[_0x9e6e('0x5b')]['connection'][_0x9e6e('0x5c')];_0x832817[_0x9e6e('0x5d')]=new Date();_0x832817[_0x9e6e('0x5e')]=function(_0x3483c9){console['log'](_0x9e6e('0x5f')+_0x832817[_0x9e6e('0x60')][_0x9e6e('0x4')]+'['+_0x832817[_0x9e6e('0x59')]+']',_0x3483c9);};_0x832817['on'](_0x9e6e('0x61'),function(){onDisconnect(_0x832817,_0x45fe51);_0x832817[_0x9e6e('0x5e')](_0x9e6e('0x62'));});onConnect(_0x832817);_0x832817[_0x9e6e('0x5e')](_0x9e6e('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 5fa2917..58b140b 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 _0x2559=['closedinteraction','ChatMessage','afterCreate','newmessage','SmsInteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','channel','opened','interface','AfterCreate','changed','closed','substatus','AfterUpdate','User','fullname','internal','default','length','model','callback','condition','../../mysqldb','../logger','triggers','http','ChatInteraction','newinteraction','Chat','afterUpdate'];(function(_0x596102,_0xf1607b){var _0x560896=function(_0x13f08f){while(--_0x13f08f){_0x596102['push'](_0x596102['shift']());}};_0x560896(++_0xf1607b);}(_0x2559,0x1e2));var _0x9255=function(_0x44b07a,_0x26b754){_0x44b07a=_0x44b07a-0x0;var _0x1ac1d6=_0x2559[_0x44b07a];return _0x1ac1d6;};'use strict';var util=require('util');var db=require(_0x9255('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x9255('0x1'))(_0x9255('0x2'));var client=jayson['client'][_0x9255('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x9255('0x4'),'event':'afterCreate','condition':_0x9255('0x5'),'callback':afterCreate},{'channel':_0x9255('0x6'),'model':_0x9255('0x4'),'event':_0x9255('0x7'),'condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0x6'),'model':_0x9255('0x9'),'event':_0x9255('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9255('0x6'),'model':'ChatOfflineMessage','event':_0x9255('0xa'),'condition':_0x9255('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x9255('0xc'),'event':_0x9255('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9255('0xd'),'model':_0x9255('0xc'),'event':_0x9255('0x7'),'condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0xd'),'model':_0x9255('0xe'),'event':_0x9255('0xa'),'condition':_0x9255('0xb'),'callback':afterCreateMessage},{'channel':_0x9255('0xf'),'model':_0x9255('0x10'),'event':_0x9255('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x9255('0x10'),'event':_0x9255('0x7'),'condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0xf'),'model':_0x9255('0x11'),'event':_0x9255('0xa'),'condition':_0x9255('0xb'),'callback':afterCreateMessage},{'channel':_0x9255('0x12'),'model':_0x9255('0x13'),'event':_0x9255('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9255('0x12'),'model':_0x9255('0x13'),'event':'afterUpdate','condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0x12'),'model':'FaxMessage','event':_0x9255('0xa'),'condition':_0x9255('0xb'),'callback':afterCreateMessage},{'channel':_0x9255('0x14'),'model':_0x9255('0x15'),'event':'afterCreate','condition':_0x9255('0x5'),'callback':afterCreate},{'channel':_0x9255('0x14'),'model':_0x9255('0x15'),'event':_0x9255('0x7'),'condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0x14'),'model':_0x9255('0x16'),'event':'afterCreate','condition':_0x9255('0xb'),'callback':afterCreateMessage},{'channel':_0x9255('0x17'),'model':_0x9255('0x18'),'event':'afterCreate','condition':_0x9255('0x5'),'callback':afterCreate},{'channel':_0x9255('0x17'),'model':_0x9255('0x18'),'event':_0x9255('0x7'),'condition':_0x9255('0x8'),'callback':afterUpdate},{'channel':_0x9255('0x17'),'model':_0x9255('0x19'),'event':_0x9255('0xa'),'condition':_0x9255('0xb'),'callback':afterCreateMessage}];function request(_0x5b6f54){return client[_0x9255('0x1a')](_0x9255('0x1b'),_0x5b6f54)[_0x9255('0x1c')](function(_0x43b9da){logger[_0x9255('0x1d')](_0x9255('0x1e'),'EventManager',_0x43b9da);if(_0x43b9da[_0x9255('0x1f')]){if(_0x43b9da[_0x9255('0x1f')]['code']===0x1f4){logger[_0x9255('0x1f')](_0x9255('0x1e'),'EventManager',_0x43b9da['error']);}}})[_0x9255('0x20')](function(_0x37cb6f){logger[_0x9255('0x1f')](_0x9255('0x1e'),'EventManager',_0x37cb6f);});}function afterCreateMessage(_0x4c74a5){return function(_0x15f4d5){_0x15f4d5=_0x15f4d5['get']({'plain':!![]});_0x15f4d5['channel']=_0x4c74a5;_0x15f4d5[_0x9255('0x21')]=_0x4c74a5;_0x15f4d5[_0x9255('0x22')]=_0x15f4d5[_0x9255('0x23')];Promise[_0x9255('0x24')]()['then'](function(){if(typeof _0x15f4d5[_0x9255('0x25')]===_0x9255('0x26'))return null;var _0x44c9c9=_0x9255('0x27')+_0x15f4d5[_0x9255('0x25')];return db[_0x9255('0x28')][_0x9255('0x29')](_0x44c9c9,{'type':db[_0x9255('0x2a')][_0x9255('0x2b')][_0x9255('0x2c')],'raw':!![]});})[_0x9255('0x1c')](function(_0x4520cc){if(_0x4520cc){_0x15f4d5[_0x9255('0x2d')]=_0x4520cc[0x0];}if(typeof _0x15f4d5['UserId']===_0x9255('0x26'))return;return getAgent(_0x15f4d5[_0x9255('0x2e')]);})[_0x9255('0x1c')](function(_0x107d67){if(_0x107d67){_0x15f4d5['interface']=util['format'](_0x9255('0x2f'),_0x107d67[_0x9255('0x30')]);_0x15f4d5[_0x9255('0x31')]=_0x107d67;_0x15f4d5['channel']=_0x4c74a5;return request({'event':_0x9255('0x32'),'message':_0x15f4d5});}else{return request({'event':_0x9255('0x33'),'message':_0x15f4d5});}})['catch'](function(_0xfac9a){logger['error'](_0x9255('0x1e'),_0x9255('0x34'),_0xfac9a);});};}function afterCreateOfflineMessage(_0x40deca){return function(_0x10d22f){_0x10d22f=_0x10d22f[_0x9255('0x35')]({'plain':!![]});_0x10d22f['channel']=_0x40deca;_0x10d22f['motionChannel']=_0x40deca;_0x10d22f[_0x9255('0x22')]='offlineMessage';return request({'event':_0x10d22f['event'],'message':_0x10d22f});};}function afterCreate(_0x5812f6,_0x364db8){return function(_0xa2e2e2){_0xa2e2e2=_0xa2e2e2[_0x9255('0x35')]({'plain':!![]});_0xa2e2e2[_0x9255('0x36')]=_0x5812f6;_0xa2e2e2[_0x9255('0x21')]=_0x5812f6;_0xa2e2e2[_0x9255('0x22')]=_0x9255('0x37');Promise[_0x9255('0x24')]()['then'](function(){var _0x504202=_0x9255('0x27')+_0xa2e2e2[_0x9255('0x25')];return db[_0x9255('0x28')][_0x9255('0x29')](_0x504202,{'type':db[_0x9255('0x2a')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0xf46169){if(_0xf46169){_0xa2e2e2[_0x9255('0x2d')]=_0xf46169[0x0];}if(typeof _0xa2e2e2[_0x9255('0x2e')]===_0x9255('0x26'))return;return getAgent(_0xa2e2e2[_0x9255('0x2e')]);})[_0x9255('0x1c')](function(_0x19008e){if(_0x19008e){_0xa2e2e2[_0x9255('0x38')]=util['format'](_0x9255('0x2f'),_0x19008e[_0x9255('0x30')]);_0xa2e2e2['agent']=_0x19008e;}return request({'event':_0x364db8,'message':_0xa2e2e2});})[_0x9255('0x20')](function(_0x546ed4){logger[_0x9255('0x1f')](_0x9255('0x1e'),_0x9255('0x39'),_0x546ed4);});};}function afterUpdate(_0x32db19){return function(_0x14732e){var _0x225efd=_0x14732e[_0x9255('0x3a')](_0x9255('0x3b'))&&_0x14732e[_0x9255('0x3b')];var _0x1f0583=_0x14732e['changed'](_0x9255('0x3c'));if(_0x225efd||_0x1f0583){var _0x36b8fa=_0x225efd?_0x9255('0x8'):_0x9255('0x3c');var _0x5d1a0b=_0x14732e[_0x9255('0x35')]({'plain':!![]});_0x5d1a0b[_0x9255('0x36')]=_0x32db19;_0x5d1a0b['motionChannel']=_0x32db19;_0x5d1a0b[_0x9255('0x22')]=_0x225efd?_0x9255('0x3b'):'substatus';var _0x4cf539='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d1a0b[_0x9255('0x25')];return db['sequelize'][_0x9255('0x29')](_0x4cf539,{'type':db['Sequelize'][_0x9255('0x2b')][_0x9255('0x2c')],'raw':!![]})[_0x9255('0x1c')](function(_0x110bcb){if(_0x110bcb){_0x5d1a0b['contact']=_0x110bcb[0x0];}if(typeof _0x5d1a0b['UserId']===_0x9255('0x26'))return;return getAgent(_0x5d1a0b['UserId']);})[_0x9255('0x1c')](function(_0x39a0f9){if(_0x39a0f9){_0x5d1a0b[_0x9255('0x38')]=util['format']('SIP/%s',_0x39a0f9[_0x9255('0x30')]);_0x5d1a0b['agent']=_0x39a0f9;}return request({'event':_0x36b8fa,'message':_0x5d1a0b});})[_0x9255('0x20')](function(_0x12db75){logger[_0x9255('0x1f')]('Trigger,\x20%s',_0x9255('0x3d'),_0x12db75);});}};}function getAgent(_0x4f2bc0){return db[_0x9255('0x3e')]['find']({'where':{'id':_0x4f2bc0},'attributes':['id',_0x9255('0x30'),_0x9255('0x3f'),'email',_0x9255('0x40')],'raw':!![]})['then'](function(_0x37c4cd){return _0x37c4cd;});}exports[_0x9255('0x41')]=function(){for(var _0x26d697=0x0;_0x26d697=_0x2456ec[_0xbbd5('0x17')]){throw Error(_0xbbd5('0x18'));}_0x5efe3e(_0x2297f0);})[_0xbbd5('0x19')](function(_0x3d44ff){_0x37d0c4(_0x3d44ff);});});}; \ No newline at end of file +var _0xa36e=['chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','role','agent','User','count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail'];(function(_0x5b472b,_0x4f6502){var _0x602d3c=function(_0x2643de){while(--_0x2643de){_0x5b472b['push'](_0x5b472b['shift']());}};_0x602d3c(++_0x4f6502);}(_0xa36e,0xc3));var _0xea36=function(_0x1273b3,_0x39e5ed){_0x1273b3=_0x1273b3-0x0;var _0x4cf50f=_0xa36e[_0x1273b3];return _0x4cf50f;};'use strict';var _=require(_0xea36('0x0'));var BPromise=require(_0xea36('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xea36('0x2'));var channels=[_0xea36('0x3'),_0xea36('0x4'),_0xea36('0x5'),_0xea36('0x6'),_0xea36('0x7'),_0xea36('0x8'),'openchannel'];exports[_0xea36('0x9')]=function(){return channels;};exports[_0xea36('0xa')]=function(_0x1742be){_0x1742be=_0x1742be[_0xea36('0xb')]();return _[_0xea36('0xc')](channels,_0x1742be);};exports[_0xea36('0xd')]=function(_0x2b82ca,_0x63851c,_0x4746cd,_0x2cc755){var _0x3a63f4={'loginAttempts':_0x63851c,'blocked':_0x4746cd};if(!_[_0xea36('0xe')](_0x2cc755)){_0x3a63f4['blockedAt']=_0x2cc755;}return _0x2b82ca[_0xea36('0xf')](_0x3a63f4);};exports['getLicense']=function(_0x2c7a3d){return new BPromise(function(_0x5043a4,_0x2530e1){var _0x207123=0x0;if(_0x2c7a3d[_0xea36('0x10')]!==_0xea36('0x11')){_0x5043a4(_0x2c7a3d);}db[_0xea36('0x12')][_0xea36('0x13')]({'where':{'role':_0xea36('0x11'),'online':!![],'id':{'$ne':_0x2c7a3d['id']}}})[_0xea36('0x14')](function(_0x5b394e){_0x207123=_0x5b394e;return util[_0xea36('0x15')]();})[_0xea36('0x14')](function(_0x2c2600){if(_0x2c2600&&_0x2c2600[_0xea36('0x16')]&&_0x207123>=_0x2c2600[_0xea36('0x16')]){throw Error(_0xea36('0x17'));}_0x5043a4(_0x2c7a3d);})[_0xea36('0x18')](function(_0x4ba8dd){_0x2530e1(_0x4ba8dd);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index d7efca1..3944020 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x7d9f81,_0x5a9cd4){var _0x5abef7=function(_0x226a05){while(--_0x226a05){_0x7d9f81['push'](_0x7d9f81['shift']());}};_0x5abef7(++_0x5a9cd4);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xe5b5[_0x1d4449];return _0x4dcde3;};'use strict';var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var APIError=function(_0x3b3efd,_0x208070){this[_0x5e5b('0x3')]=_0x3b3efd||_0x5e5b('0x4');this[_0x5e5b('0x5')]=_0x208070||_0x5e5b('0x6');util[_0x5e5b('0x7')](APIError,Error);};var APIBadRequestError=function(_0xdc6616){this[_0x5e5b('0x3')]=_0xdc6616||_0x5e5b('0x8');this[_0x5e5b('0x5')]=_0x5e5b('0x8');util[_0x5e5b('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xe089b1){this[_0x5e5b('0x3')]=_0xe089b1||_0x5e5b('0x9');this[_0x5e5b('0x5')]=_0x5e5b('0xa');util[_0x5e5b('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x3f8534){switch(_0x3f8534){case'Bad\x20Request':return 0x190;case _0x5e5b('0xb'),'OutOfInterval':return 0x193;case _0x5e5b('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x58185){return function(_0x23e667){logger[_0x5e5b('0xc')](_0x23e667['stack']);var _0x4a1424=getStatusCode(_0x23e667['name']);if(_0x23e667[_0x5e5b('0x5')])delete _0x23e667[_0x5e5b('0x5')];return _0x58185[_0x5e5b('0xd')](_0x4a1424)[_0x5e5b('0xe')](_0x23e667);};}module[_0x5e5b('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x878f,0x173));var _0xf878=function(_0x50b128,_0x193f03){_0x50b128=_0x50b128-0x0;var _0x24cfce=_0x878f[_0x50b128];return _0x24cfce;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('0xd')]={'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 f743219..1e92ec5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b26=['status','render','json','send'];(function(_0x33db28,_0x3f27ec){var _0x588298=function(_0x1073a8){while(--_0x1073a8){_0x33db28['push'](_0x33db28['shift']());}};_0x588298(++_0x3f27ec);}(_0x8b26,0x120));var _0x68b2=function(_0x41eb8b,_0x8e630f){_0x41eb8b=_0x41eb8b-0x0;var _0x57f6be=_0x8b26[_0x41eb8b];return _0x57f6be;};'use strict';module['exports'][0x194]=function pageNotFound(_0x14a53,_0xa5e0cb){var _0x183318='404';var _0x4f338c=0x194;var _0x50f0c0={'status':_0x4f338c};_0xa5e0cb[_0x68b2('0x0')](_0x50f0c0['status']);_0xa5e0cb[_0x68b2('0x1')](_0x183318,{},function(_0x5bcd6a,_0x2f9b13){if(_0x5bcd6a){return _0xa5e0cb['status'](_0x50f0c0[_0x68b2('0x0')])[_0x68b2('0x2')](_0x50f0c0);}_0xa5e0cb[_0x68b2('0x3')](_0x2f9b13);});}; \ No newline at end of file +var _0x4552=['exports','404','status','render','send'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4552,0xe1));var _0x2455=function(_0x53e765,_0x26cfbf){_0x53e765=_0x53e765-0x0;var _0x142bc2=_0x4552[_0x53e765];return _0x142bc2;};'use strict';module[_0x2455('0x0')][0x194]=function pageNotFound(_0x2f611b,_0x46adb3){var _0x5380d3=_0x2455('0x1');var _0x2017bb=0x194;var _0x2416be={'status':_0x2017bb};_0x46adb3[_0x2455('0x2')](_0x2416be['status']);_0x46adb3[_0x2455('0x3')](_0x5380d3,{},function(_0x4101b1,_0x27b805){if(_0x4101b1){return _0x46adb3[_0x2455('0x2')](_0x2416be[_0x2455('0x2')])['json'](_0x2416be);}_0x46adb3[_0x2455('0x4')](_0x27b805);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b2be8fe..cefb0c0 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e0a=['../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotification','SenderId','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','VoiceContext','Applications','VoiceMusicOnHold','Sound','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','Agents','Team','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Disposition','Dispositions','Answers','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','Contact','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsite','TagId','Dashboard','Items','FaxAccountId','Interactions','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','MailInteractions','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticFieldReport','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Configurations','Field','VariableId','int_desk_configuration_has_tags','ZohoField','ZohoAccount','FreshdeskConfiguration','VtigerConfiguration','VtigerField','ServicenowField','Dynamics365Configuration','FreshsalesConfiguration','FreshsalesAccount','ToId','JscriptyQuestionReport','SessionId','ProjectId','JscriptyProject','team_has_whatsapp_queues','WhatsappQueues','HopperFinals','TrunkId','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','ToChatWebsiteId','FromUserId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserVoicePrefix','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Smtp','exports','../config/environment','lodash','jstz','determine','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','VoiceExtension'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0x7e0a,0x1eb));var _0xa7e0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7e0a[_0x4b369d];return _0x571a98;};'use strict';var config=require(_0xa7e0('0x0'));var Sequelize=require('sequelize');var _=require(_0xa7e0('0x1'));var jstz=require(_0xa7e0('0x2'));var timezone=jstz[_0xa7e0('0x3')]();config[_0xa7e0('0x4')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0xa7e0('0x5'),'password':_0xa7e0('0x6'),'options':{'host':_0xa7e0('0x7'),'port':0xcea,'dialect':_0xa7e0('0x8'),'dialectOptions':{'charset':_0xa7e0('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xa7e0('0xa')}}});config[_0xa7e0('0xb')]=_[_0xa7e0('0xc')](config[_0xa7e0('0xb')],{'database':_0xa7e0('0xd'),'username':_0xa7e0('0x5'),'password':'xC@LL1234','options':{'host':_0xa7e0('0x7'),'port':0xcea,'dialect':_0xa7e0('0x8'),'dialectOptions':{'charset':_0xa7e0('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa7e0('0x4')][_0xa7e0('0xe')],config[_0xa7e0('0x4')][_0xa7e0('0xf')],config[_0xa7e0('0x4')][_0xa7e0('0x10')],config['sequelize'][_0xa7e0('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa7e0('0xb')]['database'],config[_0xa7e0('0xb')][_0xa7e0('0xf')],config[_0xa7e0('0xb')][_0xa7e0('0x10')],config[_0xa7e0('0xb')]['options'])};db[_0xa7e0('0x12')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x14'));db[_0xa7e0('0x15')]=db['sequelize'][_0xa7e0('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x16'));db[_0xa7e0('0x17')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x18'));db['VoiceMusicOnHold']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x19'));db[_0xa7e0('0x1a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1b'));db[_0xa7e0('0x1c')]=db['sequelize'][_0xa7e0('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xa7e0('0x1d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1e'));db['VoiceMail']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x1f'));db[_0xa7e0('0x20')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x21'));db['VoiceDialReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x22'));db[_0xa7e0('0x23')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xa7e0('0x4')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x24'));db['Trunk']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x25'));db[_0xa7e0('0x26')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x27'));db[_0xa7e0('0x28')]=db['sequelize']['import'](_0xa7e0('0x29'));db['UserVoiceQueue']=db[_0xa7e0('0x4')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xa7e0('0x2a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xa7e0('0x2b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x2c'));db[_0xa7e0('0x2d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x2e'));db['UserOpenchannelQueue']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x2f'));db[_0xa7e0('0x30')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x31'));db[_0xa7e0('0x32')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x33'));db[_0xa7e0('0x34')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x35'));db[_0xa7e0('0x36')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x37'));db['MailQueue']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x38'));db[_0xa7e0('0x39')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x3a'));db[_0xa7e0('0x3b')]=db[_0xa7e0('0x4')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xa7e0('0x3c')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x3d'));db[_0xa7e0('0x3e')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x3f'));db[_0xa7e0('0x40')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x41'));db['Dashboard']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x42'));db[_0xa7e0('0x43')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x44'));db[_0xa7e0('0x45')]=db['sequelize'][_0xa7e0('0x13')]('../api/faxAccount/faxAccount.model');db[_0xa7e0('0x46')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x47'));db[_0xa7e0('0x48')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x49'));db[_0xa7e0('0x4a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x4b'));db[_0xa7e0('0x4c')]=db[_0xa7e0('0x4')]['import']('../api/faxQueue/faxQueue.model');db[_0xa7e0('0x4d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xa7e0('0x4e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x4f'));db[_0xa7e0('0x50')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x51'));db[_0xa7e0('0x52')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x53'));db[_0xa7e0('0x54')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x55'));db[_0xa7e0('0x56')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x57'));db[_0xa7e0('0x58')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x59'));db[_0xa7e0('0x5a')]=db[_0xa7e0('0x4')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x5b'));db[_0xa7e0('0x5c')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x5d'));db[_0xa7e0('0x5e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x5f'));db['ChatWebsite']=db[_0xa7e0('0x4')]['import']('../api/chatWebsite/chatWebsite.model');db[_0xa7e0('0x60')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x61'));db[_0xa7e0('0x62')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x63'));db['ChatInteraction']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x64'));db[_0xa7e0('0x65')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/chatMessage/chatMessage.model');db[_0xa7e0('0x66')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x67'));db[_0xa7e0('0x68')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x69'));db[_0xa7e0('0x6a')]=db['sequelize'][_0xa7e0('0x13')]('../api/chatGroup/chatGroup.model');db[_0xa7e0('0x6b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa7e0('0x6c')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x6d'));db[_0xa7e0('0x6e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x6f'));db[_0xa7e0('0x70')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x71'));db['CmHopperBlack']=db['sequelize']['import'](_0xa7e0('0x72'));db['CmHopperFinal']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xa7e0('0x73')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xa7e0('0x74')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x75'));db[_0xa7e0('0x76')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x77'));db['Action']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x78'));db[_0xa7e0('0x79')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7a'));db[_0xa7e0('0x7b')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7c'));db['Disposition']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/disposition/disposition.model');db[_0xa7e0('0x7d')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x7e'));db[_0xa7e0('0x7f')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/interval/interval.model');db[_0xa7e0('0x80')]=db['sequelize']['import'](_0xa7e0('0x81'));db[_0xa7e0('0x82')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x83'));db[_0xa7e0('0x84')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xa7e0('0x85')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x86'));db['Sound']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x87'));db[_0xa7e0('0x88')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x89'));db[_0xa7e0('0x8a')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x8b'));db[_0xa7e0('0x8c')]=db[_0xa7e0('0x4')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0xa7e0('0x8d')]=db['sequelize']['import'](_0xa7e0('0x8e'));db[_0xa7e0('0x8f')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x90'));db[_0xa7e0('0x91')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x92'));db[_0xa7e0('0x93')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x94'));db['Integration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x95'));db['IntegrationReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x96'));db[_0xa7e0('0x97')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xa7e0('0x98')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xa7e0('0x99')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9a'));db[_0xa7e0('0x9b')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0x9c'));db['AnalyticFieldReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9d'));db[_0xa7e0('0x9e')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x9f'));db[_0xa7e0('0xa0')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa1'));db[_0xa7e0('0xa2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xa7e0('0xa3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa4'));db[_0xa7e0('0xa5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa6'));db[_0xa7e0('0xa7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xa8'));db[_0xa7e0('0xa9')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xaa'));db[_0xa7e0('0xab')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xac'));db[_0xa7e0('0xad')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xae'));db['ZohoAccount']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xaf'));db[_0xa7e0('0xb0')]=db['sequelize'][_0xa7e0('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xb1'));db[_0xa7e0('0xb2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xb3'));db[_0xa7e0('0xb4')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xa7e0('0xb5')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xb6'));db[_0xa7e0('0xb7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xb8'));db['FreshdeskConfiguration']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xb9'));db[_0xa7e0('0xba')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xbb'));db[_0xa7e0('0xbc')]=db[_0xa7e0('0x4')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xbd'));db['VtigerField']=db[_0xa7e0('0x4')]['import']('../api/intVtigerField/intVtigerField.model');db[_0xa7e0('0xbe')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xa7e0('0xbf')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc0'));db['ServicenowField']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc1'));db[_0xa7e0('0xc2')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc3'));db['Dynamics365Configuration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc4'));db[_0xa7e0('0xc5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc6'));db['FreshsalesAccount']=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xc7'));db['FreshsalesConfiguration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xc8'));db[_0xa7e0('0xc9')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xca'));db[_0xa7e0('0xcb')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x95'));db[_0xa7e0('0xcc')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xcd'));db[_0xa7e0('0xce')]=db['sequelize']['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xa7e0('0xcf')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xd0'));db[_0xa7e0('0xd1')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd2'));db['JscriptyQuestionReport']=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xa7e0('0xd3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd4'));db[_0xa7e0('0xd5')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xd6'));db[_0xa7e0('0xd7')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd8'));db['SquareDetailsReport']=db['sequelize'][_0xa7e0('0x13')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xd9'));db['Setting']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xda'));db[_0xa7e0('0xdb')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xdc'));db[_0xa7e0('0xdd')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xde'));db[_0xa7e0('0xdf')]=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xe0'));db[_0xa7e0('0xe1')]=db['sequelize']['import'](_0xa7e0('0xe2'));db['Team']=db[_0xa7e0('0x4')]['import']('../api/team/team.model');db[_0xa7e0('0xe3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xe4'));db[_0xa7e0('0xe5')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xe6'));db['Migration']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/migration/migration.model');db[_0xa7e0('0xe7')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xe8'));db[_0xa7e0('0xe9')]=db['sequelize'][_0xa7e0('0x13')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xa7e0('0xea')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xeb'));db[_0xa7e0('0xec')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xed'));db[_0xa7e0('0xee')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xef'));db['SmsTransferReport']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf0'));db[_0xa7e0('0xf1')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0xf2'));db[_0xa7e0('0xf3')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf4'));db[_0xa7e0('0xf5')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userProfile/userProfile.model');db[_0xa7e0('0xf6')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xf7'));db[_0xa7e0('0xf8')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db['sequelize'][_0xa7e0('0x13')]('../api/userNotification/userNotification.model');db[_0xa7e0('0xf9')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xfa'));db['WhatsappApplication']=db['sequelize'][_0xa7e0('0x13')](_0xa7e0('0xfb'));db[_0xa7e0('0xfc')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0xfd'));db['WhatsappMessage']=db['sequelize']['import'](_0xa7e0('0xfe'));db[_0xa7e0('0xff')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x100'));db[_0xa7e0('0x101')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x102'));db[_0xa7e0('0x103')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x104'));db[_0xa7e0('0x105')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xa7e0('0x106')]=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x107'));db[_0xa7e0('0x108')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x109'));db['UserVoicePrefix']=db[_0xa7e0('0x4')][_0xa7e0('0x13')](_0xa7e0('0x10a'));db[_0xa7e0('0x10b')]=db[_0xa7e0('0x4')]['import'](_0xa7e0('0x10c'));db[_0xa7e0('0x12')][_0xa7e0('0x10d')](db[_0xa7e0('0x10e')],{'as':_0xa7e0('0x10e'),'onDelete':'cascade','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')]['hasOne'](db[_0xa7e0('0x10b')],{'as':_0xa7e0('0x110'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x1c')],{'as':_0xa7e0('0x113'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db['UserVoiceQueueRt'],{'as':_0xa7e0('0x114'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x115'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x12')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':'HopperHistory','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':'UserId'});db['User'][_0xa7e0('0x112')](db[_0xa7e0('0x116')],{'as':_0xa7e0('0x117'),'foreignKey':'UserId'});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x119'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x11a'),'foreignKey':'UserId'});db['User'][_0xa7e0('0x112')](db[_0xa7e0('0x48')],{'as':_0xa7e0('0x11b'),'foreignKey':_0xa7e0('0x10f')});db['User']['hasMany'](db[_0xa7e0('0x3b')],{'as':'MailInteractions','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x12')]['hasMany'](db[_0xa7e0('0xfc')],{'as':_0xa7e0('0x11c'),'foreignKey':'UserId'});db[_0xa7e0('0x12')]['hasMany'](db[_0xa7e0('0x11d')],{'as':'UserNotifications','foreignKey':_0xa7e0('0x11e')});db['User']['belongsTo'](db[_0xa7e0('0xf5')],{'as':_0xa7e0('0xf5'),'foreignKey':'userProfileId'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x6a')],{'as':_0xa7e0('0x120'),'through':_0xa7e0('0x121')});db['User']['belongsToMany'](db['CmContact'],{'as':'Contacts','through':_0xa7e0('0x122')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x123'),'through':'cm_user_has_lists'});db[_0xa7e0('0x12')]['belongsToMany'](db['Team'],{'through':_0xa7e0('0x124')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['MailInteraction'],{'as':'MailInteractions','through':_0xa7e0('0x125')});db[_0xa7e0('0x12')]['belongsToMany'](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x119'),'through':_0xa7e0('0x126')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x48')],{'as':_0xa7e0('0x11b'),'through':_0xa7e0('0x127')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0xa7e0('0x11a'),'through':'user_has_sms_interactions'});db[_0xa7e0('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['WhatsappInteraction'],{'as':_0xa7e0('0x11c'),'through':_0xa7e0('0x128')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x129'),'through':_0xa7e0('0x12a'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf3')],{'as':_0xa7e0('0x12b'),'through':'UserVoicePrefix','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x12c')],{'as':_0xa7e0('0x12d'),'through':_0xa7e0('0x2b'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x68')],{'as':_0xa7e0('0x12e'),'through':_0xa7e0('0x2a'),'required':![],'hooks':!![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x4c')],{'as':_0xa7e0('0x12f'),'through':'UserFaxQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['SmsQueue'],{'as':_0xa7e0('0x130'),'through':'UserSmsQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x5e')],{'as':_0xa7e0('0x131'),'through':'UserOpenchannelQueue','required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x103')],{'as':'WhatsappQueues','through':_0xa7e0('0x30'),'required':![]});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf1')],{'through':_0xa7e0('0x132')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['ChatWebsite'],{'as':_0xa7e0('0x133'),'through':_0xa7e0('0x134')});db['User']['belongsToMany'](db[_0xa7e0('0x45')],{'as':_0xa7e0('0x135'),'through':_0xa7e0('0x136')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x137'),'through':_0xa7e0('0x138')});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['OpenchannelAccount'],{'as':_0xa7e0('0x139'),'through':'user_has_openchannel_accounts'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db['SmsAccount'],{'as':_0xa7e0('0x13a'),'through':'user_has_sms_accounts'});db[_0xa7e0('0x12')][_0xa7e0('0x11f')](db[_0xa7e0('0xf9')],{'as':_0xa7e0('0x13b'),'through':_0xa7e0('0x13c')});db['VoiceChanSpy']['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x13d'),'onDelete':_0xa7e0('0x111'),'foreignKey':'ChanSpyId'});db[_0xa7e0('0x13e')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x17')]['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x13f'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x140')]['belongsToMany'](db[_0xa7e0('0x141')],{'as':'Sounds','through':_0xa7e0('0x142')});db['VoiceQueue'][_0xa7e0('0x112')](db[_0xa7e0('0x28')],{'as':_0xa7e0('0x143'),'foreignKey':_0xa7e0('0x144')});db['VoiceQueue'][_0xa7e0('0x112')](db[_0xa7e0('0x70')],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':'HopperFinals','foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':_0xa7e0('0x147'),'foreignKey':'VoiceQueueId'});db[_0xa7e0('0x1a')]['hasMany'](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')]['hasMany'](db[_0xa7e0('0x148')],{'as':_0xa7e0('0x149'),'foreignKey':'VoiceQueueId'});db[_0xa7e0('0x1a')][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'as':_0xa7e0('0x14a'),'foreignKey':_0xa7e0('0x144')});db[_0xa7e0('0x1a')]['belongsTo'](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14b'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14d'),'foreignKey':_0xa7e0('0x14e')});db[_0xa7e0('0x1a')][_0xa7e0('0x14c')](db['Interval'],{'as':_0xa7e0('0x7f'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x1a')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x123'),'through':'voice_queues_has_cm_lists'});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x12a')});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'as':_0xa7e0('0x152'),'through':_0xa7e0('0x106')});db[_0xa7e0('0x1a')][_0xa7e0('0x11f')](db['CmList'],{'as':'BlackLists','through':_0xa7e0('0x153')});db[_0xa7e0('0x1c')]['belongsTo'](db[_0xa7e0('0x12')],{'as':'User','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x1d')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x12'),'foreignKey':'UserId'});db[_0xa7e0('0x10e')][_0xa7e0('0x112')](db['VoiceMailMessage'],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':_0xa7e0('0x155'),'sourceKey':_0xa7e0('0x156')});db[_0xa7e0('0x157')][_0xa7e0('0x14c')](db[_0xa7e0('0x10e')],{'foreignKey':'mailboxuser','targetKey':_0xa7e0('0x156')});db[_0xa7e0('0x20')][_0xa7e0('0x112')](db['VoiceQueueReport'],{'as':_0xa7e0('0x158'),'foreignKey':'uniqueid','constraints':![]});db[_0xa7e0('0x20')][_0xa7e0('0x112')](db[_0xa7e0('0x23')],{'as':'AgentReports','foreignKey':_0xa7e0('0x159'),'constraints':![]});db['VoiceCallReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x12'),'foreignKey':'UserId'});db[_0xa7e0('0x20')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x32')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x32')]['belongsTo'](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':'CloudProviderId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x34')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x34')][_0xa7e0('0x14c')](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':_0xa7e0('0x15d'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x36')]['hasOne'](db[_0xa7e0('0x32')],{'as':_0xa7e0('0x15e'),'onDelete':'cascade'});db['MailAccount'][_0xa7e0('0x10d')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x36')]['hasMany'](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x15b'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x3c')],{'as':'Messages','foreignKey':_0xa7e0('0x15b')});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0xa7e0('0x36')][_0xa7e0('0x112')](db[_0xa7e0('0x3e')],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db['CmList'],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db[_0xa7e0('0x8f')],{'as':_0xa7e0('0x8f'),'foreignKey':_0xa7e0('0x164')});db[_0xa7e0('0x36')][_0xa7e0('0x14c')](db['Pause'],{'as':_0xa7e0('0x165'),'foreignKey':_0xa7e0('0x166')});db[_0xa7e0('0x36')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x138')});db[_0xa7e0('0x12c')]['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x167'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x3b')][_0xa7e0('0x112')](db[_0xa7e0('0x3c')],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':'Account','foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x3b')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db['MailInteraction']['belongsTo'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x3b')][_0xa7e0('0x11f')](db['Tag'],{'through':_0xa7e0('0x16a'),'as':_0xa7e0('0x16b')});db['MailInteraction'][_0xa7e0('0x11f')](db['Tag'],{'through':_0xa7e0('0x16a'),'as':'ThroughTags'});db[_0xa7e0('0x3b')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x125'),'foreignKey':_0xa7e0('0x16d')});db['MailMessage'][_0xa7e0('0x112')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0x16e'),'onDelete':'cascade'});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':'User'});db[_0xa7e0('0x3c')]['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168')});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x3b')],{'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x16d')});db[_0xa7e0('0x3c')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x15b')});db['MailMessage']['belongsTo'](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x171'),'foreignKey':'ChatWebsiteId'});db[_0xa7e0('0x3c')]['belongsTo'](db[_0xa7e0('0x66')],{'as':_0xa7e0('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db['User'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication'][_0xa7e0('0x14c')](db['MailAccount'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x3e')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db['MailQueueReport'][_0xa7e0('0x14c')](db['MailInteraction'],{});db[_0xa7e0('0x40')][_0xa7e0('0x14c')](db[_0xa7e0('0x3c')],{});db[_0xa7e0('0x40')]['belongsTo'](db[_0xa7e0('0x12')],{});db['MailQueueReport']['belongsTo'](db[_0xa7e0('0x12c')],{});db[_0xa7e0('0x173')][_0xa7e0('0x112')](db['DashboardItem'],{'as':_0xa7e0('0x174'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':_0xa7e0('0x175'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':'FaxAccountId'});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db['FaxInteraction'],{'as':_0xa7e0('0x176')});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x46')],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x45')]['hasMany'](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x177'),'onDelete':'cascade'});db[_0xa7e0('0x45')][_0xa7e0('0x112')](db[_0xa7e0('0x4a')],{'as':'Messages'});db[_0xa7e0('0x45')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':'Trunk'});db[_0xa7e0('0x45')][_0xa7e0('0x14c')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['FaxAccount']['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x45')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x136')});db['FaxApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db[_0xa7e0('0x4c')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db['FaxAccount'],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x46')][_0xa7e0('0x14c')](db['Tag'],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db['FaxInteraction'][_0xa7e0('0x112')](db[_0xa7e0('0x4a')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xa7e0('0x48')][_0xa7e0('0x14c')](db['FaxAccount'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x175')});db['FaxInteraction']['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x48')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xa7e0('0x48')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'fax_interaction_has_tags','as':_0xa7e0('0x16b')});db[_0xa7e0('0x48')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x178'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x48')]['belongsToMany'](db['User'],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x127'),'foreignKey':'FaxInteractionId'});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'as':'User'});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x48')],{'as':'Interaction','foreignKey':_0xa7e0('0x17a')});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168')});db[_0xa7e0('0x4a')][_0xa7e0('0x14c')](db['Attachment'],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db['FaxMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'as':'Account','foreignKey':_0xa7e0('0x175')});db['FaxQueue'][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x17c')});db['FaxQueue']['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x17d'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db['FaxAccount'],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db['FaxQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x48')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x4a')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x4d')][_0xa7e0('0x14c')](db['FaxQueue'],{});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x4e')]['hasMany'](db[_0xa7e0('0x7b')],{'as':'Answers','foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x54')],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x176')});db[_0xa7e0('0x4e')][_0xa7e0('0x112')](db['SmsApplication'],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x4e')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x4e')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x17f')});db['SmsApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x56')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x50')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':'IntervalId'});db['SmsApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x52')][_0xa7e0('0x112')](db[_0xa7e0('0x54')],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x180')});db['SmsInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'as':_0xa7e0('0x170'),'foreignKey':'SmsAccountId'});db[_0xa7e0('0x52')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x52')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x169'),'foreignKey':'UserId'});db['SmsInteraction'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x181'),'as':_0xa7e0('0x16b')});db[_0xa7e0('0x52')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x181'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x52')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x182'),'foreignKey':'SmsInteractionId'});db[_0xa7e0('0x54')]['belongsTo'](db['User'],{'as':_0xa7e0('0x12')});db[_0xa7e0('0x54')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x52')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x180')});db[_0xa7e0('0x54')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x17e')});db[_0xa7e0('0x56')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x2d'),'foreignKey':_0xa7e0('0x183')});db['SmsQueue'][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x184'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':'Dispositions','foreignKey':_0xa7e0('0x185'),'onDelete':'cascade'});db['OpenchannelAccount'][_0xa7e0('0x112')](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')]['hasMany'](db[_0xa7e0('0x116')],{'as':_0xa7e0('0x176'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db[_0xa7e0('0x5c')],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x58')][_0xa7e0('0x112')](db['OpenchannelApplication'],{'as':_0xa7e0('0x13f'),'foreignKey':_0xa7e0('0x185')});db['OpenchannelAccount']['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0x58')]['belongsTo'](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x58')][_0xa7e0('0x11f')](db['User'],{'as':'Agents','through':_0xa7e0('0x186')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xa7e0('0x187')});db[_0xa7e0('0x5a')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x185')});db['OpenchannelApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x14f')});db['OpenchannelApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x116')][_0xa7e0('0x112')](db['OpenchannelMessage'],{'as':_0xa7e0('0x154'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x188')});db['OpenchannelInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'as':_0xa7e0('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0xa7e0('0x116')][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x116')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x189'),'as':'Tags'});db['OpenchannelInteraction'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x189'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x116')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x18a'),'foreignKey':_0xa7e0('0x188')});db[_0xa7e0('0x5c')]['belongsTo'](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x12')});db[_0xa7e0('0x5c')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x168')});db['OpenchannelMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x116')],{'onDelete':'cascade','as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x188')});db[_0xa7e0('0x5c')][_0xa7e0('0x14c')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db[_0xa7e0('0x5c')]['belongsTo'](db[_0xa7e0('0x58')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x185')});db[_0xa7e0('0x5e')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x18b'),'foreignKey':_0xa7e0('0x187')});db[_0xa7e0('0x5e')][_0xa7e0('0x11f')](db['Team'],{'through':_0xa7e0('0x18c'),'as':'Teams'});db['ChatWebsite'][_0xa7e0('0x112')](db['Disposition'],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x18d'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x171')]['hasMany'](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x18d')});db['ChatWebsite'][_0xa7e0('0x112')](db[_0xa7e0('0x6b')],{'as':'ProactiveActions'});db[_0xa7e0('0x171')][_0xa7e0('0x112')](db[_0xa7e0('0x118')],{'as':_0xa7e0('0x176')});db['ChatWebsite'][_0xa7e0('0x112')](db['ChatApplication'],{'as':_0xa7e0('0x13f')});db[_0xa7e0('0x171')]['hasMany'](db[_0xa7e0('0x65')],{'as':_0xa7e0('0x154')});db[_0xa7e0('0x171')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db['ChatWebsite']['belongsTo'](db[_0xa7e0('0x7f')],{'as':_0xa7e0('0x7f'),'foreignKey':_0xa7e0('0x14f')});db['ChatWebsite'][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{'as':_0xa7e0('0x36'),'foreignKey':_0xa7e0('0x15b')});db[_0xa7e0('0x171')][_0xa7e0('0x14c')](db['Pause'],{'as':_0xa7e0('0x165'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa7e0('0x171')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x150'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db[_0xa7e0('0x60')]['belongsTo'](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x116')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x5c')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x60')][_0xa7e0('0x14c')](db[_0xa7e0('0x5e')],{});db['ChatApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x18e'),'foreignKey':_0xa7e0('0x10f'),'onDelete':_0xa7e0('0x15c')});db['ChatApplication'][_0xa7e0('0x14c')](db['ChatQueue'],{'as':_0xa7e0('0x18f'),'foreignKey':_0xa7e0('0x190'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x62')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x191'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xa7e0('0x62')][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0x118')][_0xa7e0('0x112')](db[_0xa7e0('0x65')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db['ChatInteraction'][_0xa7e0('0x14c')](db['CmContact'],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x118')][_0xa7e0('0x14c')](db['User'],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x118')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x192'),'as':_0xa7e0('0x16b')});db[_0xa7e0('0x118')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x192'),'as':_0xa7e0('0x179')});db[_0xa7e0('0x118')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x126'),'foreignKey':'ChatInteractionId'});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':'cascade','as':_0xa7e0('0x12')});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db['CmContact'],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db[_0xa7e0('0x65')][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':_0xa7e0('0x193')});db['ChatMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0xe7')],{'as':_0xa7e0('0xe7'),'foreignKey':_0xa7e0('0x17b')});db['ChatMessage'][_0xa7e0('0x14c')](db['ChatWebsite'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x66')][_0xa7e0('0x112')](db[_0xa7e0('0xe7')],{'as':'Attachments','foreignKey':_0xa7e0('0x194'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':'cascade','as':_0xa7e0('0x168'),'foreignKey':'ContactId'});db[_0xa7e0('0x66')]['belongsTo'](db[_0xa7e0('0x171')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x68')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x2a'),'hooks':!![]});db[_0xa7e0('0x68')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':'team_has_chat_queues','as':'Teams'});db['ChatGroup'][_0xa7e0('0x112')](db[_0xa7e0('0xcf')],{'as':'Messages','foreignKey':_0xa7e0('0x195'),'onDelete':'cascade'});db[_0xa7e0('0x6a')][_0xa7e0('0x11f')](db['User'],{'as':_0xa7e0('0x143'),'through':_0xa7e0('0x121')});db[_0xa7e0('0x6b')][_0xa7e0('0x14c')](db['ChatWebsite'],{'as':_0xa7e0('0x191'),'foreignKey':_0xa7e0('0x18d')});db[_0xa7e0('0x6c')][_0xa7e0('0x112')](db['CmContact'],{'as':_0xa7e0('0x196'),'foreignKey':_0xa7e0('0x197')});db['CmContact']['hasMany'](db[_0xa7e0('0x8c')],{'as':_0xa7e0('0x198'),'foreignKey':_0xa7e0('0x199')});db['CmContact'][_0xa7e0('0x112')](db[_0xa7e0('0x70')],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x15a')});db['CmContact'][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':'HopperHistories','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x6e')]['hasMany'](db[_0xa7e0('0x74')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'as':_0xa7e0('0x14a'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x116')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xa7e0('0x6e')]['hasMany'](db[_0xa7e0('0x118')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x52')],{'as':_0xa7e0('0x11a'),'foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x15c')});db['CmContact'][_0xa7e0('0x112')](db['FaxInteraction'],{'as':_0xa7e0('0x11b'),'foreignKey':'ContactId','onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x112')](db[_0xa7e0('0x3b')],{'as':_0xa7e0('0x19a'),'foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x6e')][_0xa7e0('0x14c')](db[_0xa7e0('0x6c')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db['CmContact']['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'through':_0xa7e0('0x122')});db[_0xa7e0('0x6e')][_0xa7e0('0x11f')](db['Tag'],{'as':'Tags','through':_0xa7e0('0x19b')});db[_0xa7e0('0x6e')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x19b'),'as':_0xa7e0('0x179')});db['CmHopper'][_0xa7e0('0x112')](db[_0xa7e0('0x8d')],{'as':_0xa7e0('0x19c'),'foreignKey':'CmHopperId'});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x111')});db['CmHopper'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x18e'),'foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x18f'),'foreignKey':_0xa7e0('0x144'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0xe5')],{'as':_0xa7e0('0xe5'),'foreignKey':_0xa7e0('0x19d'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x70')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x169'),'foreignKey':_0xa7e0('0x19e')});db['CmHopperBlack'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a'),'onDelete':_0xa7e0('0x111')});db['CmHopperBlack'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x148')]['belongsTo'](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x18f'),'foreignKey':'VoiceQueueId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x148')][_0xa7e0('0x14c')](db[_0xa7e0('0xe5')],{'as':_0xa7e0('0xe5'),'foreignKey':'CampaignId','onDelete':_0xa7e0('0x111')});db[_0xa7e0('0x79')][_0xa7e0('0x112')](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x19f'),'singular':_0xa7e0('0x1a0')},'foreignKey':_0xa7e0('0x1a1'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x79')]['hasMany'](db['Condition'],{'as':{'plural':_0xa7e0('0x1a2'),'singular':_0xa7e0('0x1a3')},'foreignKey':_0xa7e0('0x1a4'),'onDelete':'cascade','hooks':!![]});db[_0xa7e0('0x79')][_0xa7e0('0x112')](db[_0xa7e0('0x1a5')],{'as':_0xa7e0('0x1a6'),'foreignKey':'AutomationId','onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x15f')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x1a7'),'onDelete':'cascade'});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db['Interval'],{'as':_0xa7e0('0x1a8'),'foreignKey':_0xa7e0('0x14f'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db[_0xa7e0('0x17')],{'as':_0xa7e0('0x115'),'foreignKey':_0xa7e0('0x14f'),'onDelete':_0xa7e0('0x15c')});db['Interval'][_0xa7e0('0x112')](db[_0xa7e0('0x3e')],{'as':'MailApplications','foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x7f')]['hasMany'](db[_0xa7e0('0x62')],{'as':_0xa7e0('0x1a9'),'foreignKey':'IntervalId'});db[_0xa7e0('0x7f')]['hasMany'](db['FaxApplication'],{'as':_0xa7e0('0x1aa'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x7f')][_0xa7e0('0x112')](db[_0xa7e0('0x50')],{'as':_0xa7e0('0x1ab'),'foreignKey':_0xa7e0('0x14f')});db[_0xa7e0('0x85')][_0xa7e0('0x14c')](db[_0xa7e0('0x36')],{});db[_0xa7e0('0x85')]['belongsTo'](db[_0xa7e0('0x98')],{'foreignKey':_0xa7e0('0x1ac')});db['Schedule'][_0xa7e0('0x14c')](db[_0xa7e0('0x97')],{'foreignKey':_0xa7e0('0x1ad')});db[_0xa7e0('0x141')][_0xa7e0('0x11f')](db[_0xa7e0('0x140')],{'as':_0xa7e0('0x1ae'),'through':_0xa7e0('0x142'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x88')]['belongsToMany'](db['CmContact'],{'through':_0xa7e0('0x19b')});db['Tag'][_0xa7e0('0x11f')](db[_0xa7e0('0x118')],{'through':_0xa7e0('0x192')});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x3b')],{'through':_0xa7e0('0x16a')});db['Tag'][_0xa7e0('0x11f')](db[_0xa7e0('0x52')],{'through':'sms_interaction_has_tags'});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x48')],{'through':'fax_interaction_has_tags'});db[_0xa7e0('0x88')][_0xa7e0('0x11f')](db[_0xa7e0('0x116')],{'through':_0xa7e0('0x189')});db[_0xa7e0('0x88')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0xa7e0('0x1af')});db['CmContactHasItem'][_0xa7e0('0x14c')](db[_0xa7e0('0x8a')],{'as':'ItemType','foreignKey':_0xa7e0('0x1b0')});db[_0xa7e0('0x8d')][_0xa7e0('0x14c')](db['CmHopper'],{'as':_0xa7e0('0x1b1'),'foreignKey':'CmHopperId'});db[_0xa7e0('0x8c')][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x168'),'foreignKey':'CmContactId'});db[_0xa7e0('0x91')][_0xa7e0('0x112')](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x1b2'),'singular':_0xa7e0('0x1b3')},'foreignKey':_0xa7e0('0x1b4'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xa7e0('0x7d')],{'as':{'plural':_0xa7e0('0x1b5'),'singular':_0xa7e0('0x1b6')},'foreignKey':_0xa7e0('0x1b7'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x91')][_0xa7e0('0x112')](db[_0xa7e0('0x1a5')],{'as':_0xa7e0('0x1a6'),'foreignKey':_0xa7e0('0x1b8'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db['AnalyticCustomReport'][_0xa7e0('0x112')](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1ad'),'hooks':!![]});db[_0xa7e0('0x98')][_0xa7e0('0x112')](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1ac')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1ba')});db[_0xa7e0('0x1bb')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xa7e0('0x1ba')});db[_0xa7e0('0x9e')][_0xa7e0('0x112')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db['SalesforceField'],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1bf'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa0')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa0')][_0xa7e0('0x14c')](db[_0xa7e0('0x9e')],{'as':'Account','foreignKey':'AccountId'});db[_0xa7e0('0xa2')]['hasMany'](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa2')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa2')][_0xa7e0('0x112')](db[_0xa7e0('0xa2')],{'as':'Field','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa2')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa7e0('0xa3')]['hasMany'](db[_0xa7e0('0xa5')],{'as':_0xa7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db['SugarcrmConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1bd'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xa5')]['hasMany'](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':'FieldId'});db[_0xa7e0('0xa5')][_0xa7e0('0x14c')](db[_0xa7e0('0xa3')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0xa7')][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['SugarcrmField'][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa7e0('0xa7')][_0xa7e0('0x112')](db[_0xa7e0('0xa7')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xa7')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':_0xa7e0('0x1c6')});db['DeskAccount'][_0xa7e0('0x112')](db[_0xa7e0('0xab')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db[_0xa7e0('0xab')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xab')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db['DeskConfiguration']['hasMany'](db[_0xa7e0('0xad')],{'as':'Fields','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xab')]['belongsTo'](db['DeskAccount'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xab')]['belongsToMany'](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x1c7')});db[_0xa7e0('0xad')]['hasMany'](db['DeskField'],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['DeskField'][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xad')][_0xa7e0('0x112')](db[_0xa7e0('0xad')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xad')][_0xa7e0('0x14c')](db['Variable'],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db['ZohoField'],{'as':_0xa7e0('0x1bd'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':'Descriptions','onDelete':_0xa7e0('0x111'),'foreignKey':'DescriptionId'});db[_0xa7e0('0xb0')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xb0')][_0xa7e0('0x14c')](db[_0xa7e0('0x1c9')],{'as':'Account','foreignKey':_0xa7e0('0x1bc')});db['ZohoField'][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1c8')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c3'),'foreignKey':'DescriptionId'});db[_0xa7e0('0x1c8')][_0xa7e0('0x112')](db[_0xa7e0('0x1c8')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1c8')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xb2')][_0xa7e0('0x112')](db[_0xa7e0('0xb4')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1bf'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xb4')][_0xa7e0('0x112')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xb4')][_0xa7e0('0x14c')](db['ZendeskAccount'],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'int_zendesk_configuration_has_tags'});db[_0xa7e0('0xb5')][_0xa7e0('0x112')](db['ZendeskField'],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db['ZendeskField'][_0xa7e0('0x112')](db[_0xa7e0('0xb5')],{'as':_0xa7e0('0x1c3'),'foreignKey':'DescriptionId'});db[_0xa7e0('0xb5')][_0xa7e0('0x112')](db[_0xa7e0('0xb5')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db['ZendeskField'][_0xa7e0('0x14c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xa7e0('0xb7')]['hasMany'](db[_0xa7e0('0x1ca')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1bc')});db['FreshdeskConfiguration'][_0xa7e0('0x112')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xa7e0('0x111'),'foreignKey':'SubjectId'});db[_0xa7e0('0x1ca')]['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1bf'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c0')});db['FreshdeskConfiguration']['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1b9'),'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1ca')]['belongsTo'](db[_0xa7e0('0xb7')],{'as':'Account','foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0x1ca')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xa7e0('0xba')]['hasMany'](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xba')][_0xa7e0('0x112')](db[_0xa7e0('0xba')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db['FreshdeskField']['hasMany'](db[_0xa7e0('0xba')],{'as':'Field','foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xba')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xbc')][_0xa7e0('0x112')](db['VtigerConfiguration'],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db[_0xa7e0('0x1cb')][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1cb')]['hasMany'](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1bf'),'foreignKey':'DescriptionId'});db[_0xa7e0('0x1cb')][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cb')]['belongsTo'](db[_0xa7e0('0xbc')],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db['VtigerField'][_0xa7e0('0x112')](db['VtigerField'],{'as':_0xa7e0('0x1c2'),'foreignKey':'SubjectId'});db[_0xa7e0('0x1cc')][_0xa7e0('0x112')](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db['VtigerField']['hasMany'](db[_0xa7e0('0x1cc')],{'as':_0xa7e0('0x1c5'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cc')]['belongsTo'](db[_0xa7e0('0x93')],{'as':'Variable','foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xbe')][_0xa7e0('0x112')](db['ServicenowConfiguration'],{'as':_0xa7e0('0x1c4'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db['ServicenowConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1bd'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xbf')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1bf'),'foreignKey':_0xa7e0('0x1c0')});db['ServicenowConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0xbf')][_0xa7e0('0x14c')](db[_0xa7e0('0xbe')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1c2'),'foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x112')](db[_0xa7e0('0x1cd')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db[_0xa7e0('0x1cd')][_0xa7e0('0x14c')](db['Variable'],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xc2')]['hasMany'](db[_0xa7e0('0x1ce')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xc2')][_0xa7e0('0x14c')](db[_0xa7e0('0x105')],{'as':_0xa7e0('0x105'),'foreignKey':'CloudProviderId'});db[_0xa7e0('0x1ce')]['hasMany'](db[_0xa7e0('0xc5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0x1ce')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0x1ce')][_0xa7e0('0x112')](db[_0xa7e0('0xc5')],{'as':_0xa7e0('0x1b9'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1c1')});db['Dynamics365Configuration'][_0xa7e0('0x14c')](db['Dynamics365Account'],{'as':_0xa7e0('0x170'),'foreignKey':_0xa7e0('0x1bc')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db['Dynamics365Field'],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xc5')][_0xa7e0('0x112')](db[_0xa7e0('0xc5')],{'as':_0xa7e0('0x1c5'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xa7e0('0x112')](db[_0xa7e0('0x1cf')],{'as':_0xa7e0('0x1c4'),'onDelete':_0xa7e0('0x111'),'foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1bd'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':'Descriptions','foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0x1cf')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1b9'),'foreignKey':_0xa7e0('0x1c1')});db[_0xa7e0('0x1cf')][_0xa7e0('0x14c')](db[_0xa7e0('0x1d0')],{'as':_0xa7e0('0x170'),'foreignKey':'AccountId'});db[_0xa7e0('0xc9')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':'Subject','foreignKey':_0xa7e0('0x1be')});db[_0xa7e0('0xc9')][_0xa7e0('0x112')](db[_0xa7e0('0xc9')],{'as':_0xa7e0('0x1c3'),'foreignKey':_0xa7e0('0x1c0')});db[_0xa7e0('0xc9')]['hasMany'](db[_0xa7e0('0xc9')],{'as':'Field','foreignKey':'FieldId'});db[_0xa7e0('0xc9')][_0xa7e0('0x14c')](db[_0xa7e0('0x93')],{'as':_0xa7e0('0x93'),'foreignKey':_0xa7e0('0x1c6')});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{});db[_0xa7e0('0xce')]['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x65')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0xce')][_0xa7e0('0x14c')](db['ChatQueue'],{});db['ChatInternalMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'foreignKey':'FromId'});db[_0xa7e0('0xcf')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x111'),'foreignKey':_0xa7e0('0x1d1')});db[_0xa7e0('0xd3')][_0xa7e0('0x112')](db[_0xa7e0('0x1d2')],{'foreignKey':_0xa7e0('0x1d3'),'onDelete':'cascade'});db[_0xa7e0('0xd3')][_0xa7e0('0x112')](db[_0xa7e0('0xd1')],{'foreignKey':_0xa7e0('0x1d3'),'onDelete':'cascade'});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db['SmsAccount'],{});db[_0xa7e0('0xd5')]['belongsTo'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':'ListId'});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db['CmContact'],{'as':_0xa7e0('0x168'),'foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x52')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x54')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0xd5')][_0xa7e0('0x14c')](db[_0xa7e0('0x56')],{});db['JscriptyProject'][_0xa7e0('0x112')](db[_0xa7e0('0xd3')],{'foreignKey':_0xa7e0('0x1d4')});db[_0xa7e0('0x1d5')][_0xa7e0('0x112')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xa7e0('0x112')](db[_0xa7e0('0xd1')],{'foreignKey':'ProjectId'});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x124')});db['Team']['belongsToMany'](db[_0xa7e0('0x1a')],{'through':'TeamVoiceQueue','as':_0xa7e0('0x129')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xa7e0('0x12d')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x68')],{'through':'team_has_chat_queues','as':_0xa7e0('0x12e')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x4c')],{'through':_0xa7e0('0x17d'),'as':'FaxQueues'});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x56')],{'through':_0xa7e0('0x184'),'as':_0xa7e0('0x130')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x5e')],{'through':_0xa7e0('0x18c'),'as':_0xa7e0('0x131')});db[_0xa7e0('0x151')][_0xa7e0('0x11f')](db[_0xa7e0('0x103')],{'through':_0xa7e0('0x1d6'),'as':_0xa7e0('0x1d7')});db[_0xa7e0('0x151')]['belongsToMany'](db[_0xa7e0('0xf3')],{'through':_0xa7e0('0x108'),'as':'VoicePrefixes'});db[_0xa7e0('0xe5')]['hasMany'](db['CmHopper'],{'as':_0xa7e0('0x145'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x112')](db['CmHopperFinal'],{'as':_0xa7e0('0x1d8'),'foreignKey':_0xa7e0('0x19d')});db['Campaign'][_0xa7e0('0x112')](db[_0xa7e0('0x73')],{'as':_0xa7e0('0x147'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x112')](db[_0xa7e0('0x148')],{'as':_0xa7e0('0x149'),'foreignKey':_0xa7e0('0x19d')});db[_0xa7e0('0xe5')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':'Trunk','foreignKey':_0xa7e0('0x1d9')});db[_0xa7e0('0xe5')][_0xa7e0('0x14c')](db[_0xa7e0('0x14b')],{'as':_0xa7e0('0x14d'),'foreignKey':_0xa7e0('0x14e')});db['Campaign']['belongsTo'](db[_0xa7e0('0x7f')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xa7e0('0xe5')]['belongsTo'](db[_0xa7e0('0xdd')],{'as':_0xa7e0('0xdd'),'foreignKey':'SquareProjectId'});db[_0xa7e0('0xe5')]['belongsToMany'](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x123'),'through':'campaigns_has_cm_lists'});db[_0xa7e0('0xe5')][_0xa7e0('0x11f')](db['CmList'],{'as':_0xa7e0('0x1da'),'through':_0xa7e0('0x1db')});db[_0xa7e0('0xe7')]['belongsTo'](db[_0xa7e0('0x66')],{'as':_0xa7e0('0x66'),'foreignKey':_0xa7e0('0x194')});db['MailTransferReport']['belongsTo'](db[_0xa7e0('0x3c')],{});db['MailTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x3b')],{});db[_0xa7e0('0x1dc')]['belongsTo'](db[_0xa7e0('0x36')],{'foreignKey':_0xa7e0('0x1dd'),'as':'FromAccount'});db['MailTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db['MailTransferReport'][_0xa7e0('0x14c')](db['User'],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db['MailTransferReport'][_0xa7e0('0x14c')](db['MailQueue'],{'foreignKey':_0xa7e0('0x1e0'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x1dc')][_0xa7e0('0x14c')](db['MailAccount'],{'foreignKey':_0xa7e0('0x1e2'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x65')],{});db['ChatTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x118')],{});db[_0xa7e0('0xea')]['belongsTo'](db[_0xa7e0('0x171')],{'foreignKey':_0xa7e0('0x1e4'),'as':_0xa7e0('0x1e5')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x68')],{'foreignKey':_0xa7e0('0x1e7'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0xea')][_0xa7e0('0x14c')](db[_0xa7e0('0x171')],{'foreignKey':_0xa7e0('0x1e8'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x4a')],{});db[_0xa7e0('0xec')]['belongsTo'](db[_0xa7e0('0x48')],{});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'foreignKey':'FromFaxAccountId','as':_0xa7e0('0x1e5')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db['User'],{'foreignKey':_0xa7e0('0x1e9'),'as':_0xa7e0('0x1de')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db[_0xa7e0('0xec')][_0xa7e0('0x14c')](db['FaxQueue'],{'foreignKey':_0xa7e0('0x1ea'),'as':_0xa7e0('0x1e1')});db['FaxTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x45')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db['OpenchannelMessage'],{});db[_0xa7e0('0xee')]['belongsTo'](db[_0xa7e0('0x116')],{});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db['OpenchannelTransferReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x5e')],{'foreignKey':_0xa7e0('0x1eb'),'as':'ToQueue'});db[_0xa7e0('0xee')][_0xa7e0('0x14c')](db[_0xa7e0('0x58')],{'foreignKey':_0xa7e0('0x1ec'),'as':_0xa7e0('0x1e3')});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['SmsMessage'],{});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['SmsInteraction'],{});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db[_0xa7e0('0x4e')],{'foreignKey':_0xa7e0('0x1ee'),'as':_0xa7e0('0x1e5')});db['SmsTransferReport'][_0xa7e0('0x14c')](db['User'],{'foreignKey':'FromUserId','as':_0xa7e0('0x1de')});db[_0xa7e0('0x1ed')][_0xa7e0('0x14c')](db['User'],{'foreignKey':_0xa7e0('0x1e6'),'as':_0xa7e0('0x1df')});db[_0xa7e0('0x1ed')]['belongsTo'](db[_0xa7e0('0x56')],{'foreignKey':_0xa7e0('0x1ef'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x1ed')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xa7e0('0x1f0'),'as':'ToAccount'});db['CmList'][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x163'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x6e')],{'as':_0xa7e0('0x196'),'onDelete':_0xa7e0('0x111'),'foreignKey':'ListId'});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x146')],{'as':_0xa7e0('0x1d8'),'foreignKey':_0xa7e0('0x163')});db['CmList'][_0xa7e0('0x112')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf1')][_0xa7e0('0x112')](db[_0xa7e0('0x74')],{'as':_0xa7e0('0x74'),'foreignKey':'ListId'});db[_0xa7e0('0xf1')][_0xa7e0('0x11f')](db[_0xa7e0('0x1a')],{'as':_0xa7e0('0x1f1'),'through':_0xa7e0('0x1f2')});db[_0xa7e0('0xf1')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Agents','through':_0xa7e0('0x132')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0xa7e0('0x115'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf3')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Agents','through':_0xa7e0('0x1f3')});db[_0xa7e0('0xf3')][_0xa7e0('0x11f')](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x108'),'as':'Teams'});db['UserProfile'][_0xa7e0('0x112')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x16c'),'foreignKey':_0xa7e0('0x1f4')});db[_0xa7e0('0xf5')]['hasMany'](db[_0xa7e0('0xf6')],{'as':_0xa7e0('0x1f5'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xa7e0('0xf6')][_0xa7e0('0x112')](db[_0xa7e0('0xf8')],{'as':_0xa7e0('0x1f6'),'foreignKey':_0xa7e0('0x1f7'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db[_0xa7e0('0x15f')],{'as':_0xa7e0('0x160'),'foreignKey':_0xa7e0('0x1f8'),'onDelete':_0xa7e0('0x111')});db[_0xa7e0('0xf9')]['hasMany'](db[_0xa7e0('0x7b')],{'as':_0xa7e0('0x161'),'foreignKey':_0xa7e0('0x1f8')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db['WhatsappMessage'],{'as':_0xa7e0('0x154'),'foreignKey':_0xa7e0('0x1f8')});db['WhatsappAccount'][_0xa7e0('0x112')](db[_0xa7e0('0xfc')],{'as':_0xa7e0('0x176')});db[_0xa7e0('0xf9')][_0xa7e0('0x112')](db[_0xa7e0('0x1f9')],{'as':_0xa7e0('0x13f')});db['WhatsappAccount'][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':_0xa7e0('0x162'),'foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xf9')][_0xa7e0('0x14c')](db[_0xa7e0('0x80')],{'as':_0xa7e0('0x165'),'foreignKey':_0xa7e0('0x166')});db[_0xa7e0('0xf9')][_0xa7e0('0x11f')](db['User'],{'as':'Agents','through':_0xa7e0('0x13c')});db['WhatsappApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0x103')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x1f9')][_0xa7e0('0x14c')](db[_0xa7e0('0x7f')],{'onDelete':_0xa7e0('0x15c'),'foreignKey':_0xa7e0('0x14f')});db['WhatsappApplication'][_0xa7e0('0x14c')](db[_0xa7e0('0x88')],{'onDelete':'restrict','foreignKey':_0xa7e0('0x172')});db[_0xa7e0('0xfc')][_0xa7e0('0x112')](db[_0xa7e0('0x1fa')],{'as':_0xa7e0('0x154'),'onDelete':'cascade','foreignKey':_0xa7e0('0x1fb')});db[_0xa7e0('0xfc')]['belongsTo'](db[_0xa7e0('0xf9')],{'as':'Account','foreignKey':_0xa7e0('0x1f8')});db['WhatsappInteraction'][_0xa7e0('0x14c')](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xfc')]['belongsTo'](db[_0xa7e0('0x12')],{'as':'Owner','foreignKey':_0xa7e0('0x10f')});db[_0xa7e0('0xfc')][_0xa7e0('0x11f')](db[_0xa7e0('0x88')],{'through':_0xa7e0('0x1af'),'as':_0xa7e0('0x16b')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':_0xa7e0('0x1af'),'as':_0xa7e0('0x179')});db[_0xa7e0('0xfc')][_0xa7e0('0x11f')](db[_0xa7e0('0x12')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xa7e0('0x1fb')});db['WhatsappMessage'][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x12')});db['WhatsappMessage']['belongsTo'](db[_0xa7e0('0x6e')],{'onDelete':_0xa7e0('0x111'),'as':'Contact'});db[_0xa7e0('0x1fa')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{'onDelete':_0xa7e0('0x111'),'as':_0xa7e0('0x16f'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db['WhatsappAccount'],{'as':_0xa7e0('0x170'),'foreignKey':'WhatsappAccountId'});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xf1')],{'as':'List','foreignKey':_0xa7e0('0x163')});db[_0xa7e0('0xff')]['belongsTo'](db[_0xa7e0('0x6e')],{'as':'Contact','foreignKey':_0xa7e0('0x15a')});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xa7e0('0x14c')](db[_0xa7e0('0x1fa')],{});db[_0xa7e0('0xff')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x1fa')],{});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0xfc')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xa7e0('0xf9')],{'foreignKey':_0xa7e0('0x1fc'),'as':_0xa7e0('0x1e5')});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0xf9')],{'foreignKey':_0xa7e0('0x1fd'),'as':'ToAccount'});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x103')],{'foreignKey':_0xa7e0('0x1fe'),'as':_0xa7e0('0x1e1')});db[_0xa7e0('0x101')]['belongsTo'](db[_0xa7e0('0x12')],{'foreignKey':_0xa7e0('0x1e9'),'as':_0xa7e0('0x1de')});db[_0xa7e0('0x101')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'foreignKey':'ToUserId','as':_0xa7e0('0x1df')});db[_0xa7e0('0x103')]['belongsToMany'](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x150'),'through':_0xa7e0('0x30'),'foreignKey':_0xa7e0('0x1ff')});db[_0xa7e0('0x103')]['belongsToMany'](db[_0xa7e0('0x151')],{'through':_0xa7e0('0x1d6'),'as':_0xa7e0('0x152')});db[_0xa7e0('0x10b')][_0xa7e0('0x14c')](db[_0xa7e0('0x12')],{'as':_0xa7e0('0x200'),'foreignKey':_0xa7e0('0x10f'),'onDelete':_0xa7e0('0x111'),'hooks':!![]});db[_0xa7e0('0x105')]['hasOne'](db['Dynamics365Account'],{'as':_0xa7e0('0xc2'),'onDelete':'restrict'});db[_0xa7e0('0x105')][_0xa7e0('0x10d')](db[_0xa7e0('0x32')],{'as':_0xa7e0('0x15e'),'onDelete':_0xa7e0('0x15c')});db[_0xa7e0('0x105')][_0xa7e0('0x10d')](db[_0xa7e0('0x34')],{'as':_0xa7e0('0x201'),'onDelete':'restrict'});module[_0xa7e0('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbb58=['voice_queues_has_cm_blacklists','mailboxuser','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Messages','List','ListId','TemplateId','MailMessage','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','ContactId','Items','Disposition','FaxAccountId','Exntensions','user_has_fax_accounts','FaxApplication','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','Interactions','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','OpenchannelQueueReport','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','CmCompany','Contacts','Phones','CmContactId','Hoppers','JscriptySessions','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','ChatApplications','FaxApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','ItemType','ItemTypeId','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','AnalyticMetric','AccountId','SubjectId','Descriptions','FieldId','Description','DescriptionId','Field','VariableId','Configurations','Subjects','Subject','DeskAccount','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','VtigerAccount','VtigerConfiguration','ServicenowField','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','JscriptyAnswerReport','team_has_mail_queues','team_has_chat_queues','team_has_fax_queues','FaxQueues','team_has_whatsapp_queues','HopperHistories','HopperBlacks','SquareProject','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FaxTransferReport','FromFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','cm_user_has_lists','UserVoicePrefix','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','lodash','determine','defaultsDeep','sequelize','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','motion2','utf8mb4','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','UserId','UserSetting','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','cm_user_has_contacts','Lists','user_has_teams','belongsToMany','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists'];(function(_0x16275a,_0x3180c5){var _0x53afd4=function(_0x54b04e){while(--_0x54b04e){_0x16275a['push'](_0x16275a['shift']());}};_0x53afd4(++_0x3180c5);}(_0xbb58,0xa5));var _0x8bb5=function(_0x1d36c2,_0x3c48d5){_0x1d36c2=_0x1d36c2-0x0;var _0x857f7d=_0xbb58[_0x1d36c2];return _0x857f7d;};'use strict';var config=require(_0x8bb5('0x0'));var Sequelize=require('sequelize');var _=require(_0x8bb5('0x1'));var jstz=require('jstz');var timezone=jstz[_0x8bb5('0x2')]();config['sequelize']=_[_0x8bb5('0x3')](config[_0x8bb5('0x4')],{'database':'motion2','username':_0x8bb5('0x5'),'password':_0x8bb5('0x6'),'options':{'host':_0x8bb5('0x7'),'port':0xcea,'dialect':_0x8bb5('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x8bb5('0x9')](),'define':{'charset':_0x8bb5('0xa'),'collate':_0x8bb5('0xb')}}});config[_0x8bb5('0xc')]=_['defaultsDeep'](config[_0x8bb5('0xc')],{'database':_0x8bb5('0xd'),'username':_0x8bb5('0x5'),'password':_0x8bb5('0x6'),'options':{'host':_0x8bb5('0x7'),'port':0xcea,'dialect':_0x8bb5('0x8'),'dialectOptions':{'charset':_0x8bb5('0xe')},'logging':![],'timezone':timezone[_0x8bb5('0x9')](),'define':{'charset':'utf8','collate':_0x8bb5('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bb5('0x4')][_0x8bb5('0xf')],config['sequelize'][_0x8bb5('0x10')],config[_0x8bb5('0x4')]['password'],config[_0x8bb5('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8bb5('0xc')][_0x8bb5('0xf')],config[_0x8bb5('0xc')][_0x8bb5('0x10')],config['sequelizeHistory'][_0x8bb5('0x11')],config[_0x8bb5('0xc')][_0x8bb5('0x12')])};db[_0x8bb5('0x13')]=db['sequelize']['import']('../api/user/user.model');db[_0x8bb5('0x14')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x16'));db[_0x8bb5('0x17')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x18'));db[_0x8bb5('0x19')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x1a'));db[_0x8bb5('0x1b')]=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x8bb5('0x1c')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x1d'));db['VoiceRecording']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x1e'));db[_0x8bb5('0x1f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x20'));db[_0x8bb5('0x21')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x22'));db[_0x8bb5('0x23')]=db['sequelize'][_0x8bb5('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8bb5('0x24')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x25'));db[_0x8bb5('0x26')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x8bb5('0x27')]=db[_0x8bb5('0x4')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x8bb5('0x28')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x29'));db[_0x8bb5('0x2a')]=db[_0x8bb5('0x4')]['import']('../api/trunk/trunk.model');db[_0x8bb5('0x2b')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x2c'));db['UserVoiceQueueRt']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x8bb5('0x2d')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x2e'));db[_0x8bb5('0x2f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0x8bb5('0x30')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0x8bb5('0x31')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x32'));db[_0x8bb5('0x33')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x34'));db[_0x8bb5('0x35')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x36'));db[_0x8bb5('0x37')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x8bb5('0x38')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x39'));db[_0x8bb5('0x3a')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x8bb5('0x3b')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x3c'));db[_0x8bb5('0x3d')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x3e'));db[_0x8bb5('0x3f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x40'));db[_0x8bb5('0x41')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x42'));db['MailMessage']=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x43'));db[_0x8bb5('0x44')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x45'));db[_0x8bb5('0x46')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x47'));db[_0x8bb5('0x48')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x49'));db[_0x8bb5('0x4a')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x4b'));db[_0x8bb5('0x4c')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x4d'));db['FaxApplication']=db[_0x8bb5('0x4')]['import']('../api/faxApplication/faxApplication.model');db[_0x8bb5('0x4e')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x4f'));db[_0x8bb5('0x50')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x51'));db['FaxQueue']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/faxQueue/faxQueue.model');db[_0x8bb5('0x52')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x53'));db[_0x8bb5('0x54')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x55'));db[_0x8bb5('0x56')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x57'));db[_0x8bb5('0x58')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x59'));db[_0x8bb5('0x5a')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x5b'));db[_0x8bb5('0x5c')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x5d'));db[_0x8bb5('0x5e')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x5f'));db[_0x8bb5('0x60')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x61'));db['OpenchannelInteraction']=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x62'));db[_0x8bb5('0x63')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x64'));db[_0x8bb5('0x65')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x66'));db[_0x8bb5('0x67')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x8bb5('0x68')]=db['sequelize']['import'](_0x8bb5('0x69'));db[_0x8bb5('0x6a')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x6b'));db[_0x8bb5('0x6c')]=db['sequelize']['import'](_0x8bb5('0x6d'));db[_0x8bb5('0x6e')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x8bb5('0x6f')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x70'));db[_0x8bb5('0x71')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x72'));db[_0x8bb5('0x73')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x74'));db['CmCompany']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x75'));db[_0x8bb5('0x76')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cmContact/cmContact.model');db[_0x8bb5('0x77')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x78'));db[_0x8bb5('0x79')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x8bb5('0x7a')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x7b'));db['CmHopperHistory']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x8bb5('0x7c')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x7d'));db[_0x8bb5('0x7e')]=db[_0x8bb5('0x4')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x8bb5('0x7f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/action/action.model');db[_0x8bb5('0x80')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x81'));db[_0x8bb5('0x82')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x83'));db['Disposition']=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x84'));db[_0x8bb5('0x85')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x86'));db[_0x8bb5('0x87')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x88'));db[_0x8bb5('0x89')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/pause/pause.model');db[_0x8bb5('0x8a')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cdr/cdr.model');db[_0x8bb5('0x8b')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x8c'));db[_0x8bb5('0x8d')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x8e'));db[_0x8bb5('0x8f')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x90'));db[_0x8bb5('0x91')]=db['sequelize']['import']('../api/tag/tag.model');db[_0x8bb5('0x92')]=db[_0x8bb5('0x4')]['import']('../api/contactItemType/contactItemType.model');db[_0x8bb5('0x93')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x94'));db[_0x8bb5('0x95')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x8bb5('0x96')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x97'));db[_0x8bb5('0x98')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x99'));db[_0x8bb5('0x9a')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x9b'));db[_0x8bb5('0x9c')]=db[_0x8bb5('0x4')]['import']('../api/integration/integration.model');db[_0x8bb5('0x9d')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x9e'));db[_0x8bb5('0x9f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xa0'));db['AnalyticDefaultReport']=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xa1'));db[_0x8bb5('0xa2')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xa3'));db['AnalyticMetric']=db['sequelize']['import'](_0x8bb5('0xa4'));db[_0x8bb5('0xa5')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xa6'));db[_0x8bb5('0xa7')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xa8'));db[_0x8bb5('0xa9')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xaa'));db[_0x8bb5('0xab')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xac'));db[_0x8bb5('0xad')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x8bb5('0xae')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xaf'));db[_0x8bb5('0xb0')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xb1'));db[_0x8bb5('0xb2')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xb3'));db['DeskAccount']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xb4'));db['DeskConfiguration']=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xb5'));db['DeskField']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xb6'));db[_0x8bb5('0xb7')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xb8'));db[_0x8bb5('0xb9')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xba'));db['ZendeskAccount']=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xbb'));db[_0x8bb5('0xbc')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xbd'));db[_0x8bb5('0xbe')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xbf'));db[_0x8bb5('0xc0')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xc1'));db[_0x8bb5('0xc2')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xc3'));db[_0x8bb5('0xc4')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xc5'));db['VtigerConfiguration']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x8bb5('0xc6')]=db[_0x8bb5('0x4')]['import']('../api/intVtigerField/intVtigerField.model');db[_0x8bb5('0xc7')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x8bb5('0xc8')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xc9'));db['ServicenowField']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0x8bb5('0xca')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8bb5('0xcb')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xcc'));db[_0x8bb5('0xcd')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xce'));db['FreshsalesAccount']=db['sequelize'][_0x8bb5('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x8bb5('0xcf')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xd0'));db[_0x8bb5('0xd1')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xd2'));db[_0x8bb5('0x9c')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xd3'));db['Network']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/network/network.model');db[_0x8bb5('0xd4')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xd5'));db[_0x8bb5('0xd6')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xd7'));db['JscriptyAnswerReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x8bb5('0xd8')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xd9'));db[_0x8bb5('0xda')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xdb'));db[_0x8bb5('0xdc')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xdd'));db[_0x8bb5('0xde')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xdf'));db[_0x8bb5('0xe0')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xe1'));db[_0x8bb5('0xe2')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xe3'));db[_0x8bb5('0xe4')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xe5'));db['SquareProject']=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xe6'));db[_0x8bb5('0xe7')]=db[_0x8bb5('0x4')]['import']('../api/squareRecording/squareRecording.model');db[_0x8bb5('0xe8')]=db[_0x8bb5('0x4')]['import']('../api/squareMessage/squareMessage.model');db[_0x8bb5('0xe9')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xea'));db[_0x8bb5('0xeb')]=db['sequelize']['import'](_0x8bb5('0xec'));db[_0x8bb5('0xed')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xee'));db[_0x8bb5('0xef')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/migration/migration.model');db['Attachment']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/attachment/attachment.model');db[_0x8bb5('0xf0')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xf1'));db[_0x8bb5('0xf2')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xf3'));db[_0x8bb5('0xf4')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0xf5'));db['FaxTransferReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8bb5('0xf6')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xf7'));db[_0x8bb5('0xf8')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xf9'));db[_0x8bb5('0xfa')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0xfb'));db[_0x8bb5('0xfc')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xfd'));db[_0x8bb5('0xfe')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0xff'));db[_0x8bb5('0x100')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x8bb5('0x101')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x102'));db[_0x8bb5('0x103')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x104'));db[_0x8bb5('0x105')]=db[_0x8bb5('0x4')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x8bb5('0x106')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x107'));db[_0x8bb5('0x108')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x109'));db[_0x8bb5('0x10a')]=db[_0x8bb5('0x4')]['import'](_0x8bb5('0x10b'));db['WhatsappQueueReport']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x10c'));db[_0x8bb5('0x10d')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x10e'));db[_0x8bb5('0x10f')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x110'));db[_0x8bb5('0x111')]=db[_0x8bb5('0x4')][_0x8bb5('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0x8bb5('0x112')]=db['sequelize']['import'](_0x8bb5('0x113'));db[_0x8bb5('0x114')]=db['sequelize'][_0x8bb5('0x15')](_0x8bb5('0x115'));db['UserVoicePrefix']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x116'));db['UserSetting']=db[_0x8bb5('0x4')][_0x8bb5('0x15')](_0x8bb5('0x117'));db[_0x8bb5('0x13')][_0x8bb5('0x118')](db['VoiceMail'],{'as':_0x8bb5('0x21'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')][_0x8bb5('0x118')](db[_0x8bb5('0x11b')],{'as':_0x8bb5('0x11c'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')][_0x8bb5('0x11d')](db[_0x8bb5('0x11e')],{'as':_0x8bb5('0x11f'),'foreignKey':'UserId'});db[_0x8bb5('0x13')][_0x8bb5('0x11d')](db['UserVoiceQueueRt'],{'as':_0x8bb5('0x120'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')]['hasMany'](db[_0x8bb5('0x19')],{'as':_0x8bb5('0x121'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db[_0x8bb5('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x8bb5('0x122'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')][_0x8bb5('0x11d')](db[_0x8bb5('0x123')],{'as':_0x8bb5('0x124'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')][_0x8bb5('0x11d')](db[_0x8bb5('0x7c')],{'as':_0x8bb5('0x7c'),'foreignKey':_0x8bb5('0x11a')});db['User']['hasMany'](db[_0x8bb5('0x125')],{'as':_0x8bb5('0x126'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x13')]['hasMany'](db[_0x8bb5('0x6a')],{'as':_0x8bb5('0x127'),'foreignKey':'UserId'});db['User'][_0x8bb5('0x11d')](db[_0x8bb5('0x58')],{'as':_0x8bb5('0x128'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x8bb5('0x4e')],{'as':_0x8bb5('0x129'),'foreignKey':_0x8bb5('0x11a')});db['User']['hasMany'](db['MailInteraction'],{'as':_0x8bb5('0x12a'),'foreignKey':'UserId'});db['User'][_0x8bb5('0x11d')](db[_0x8bb5('0x108')],{'as':_0x8bb5('0x12b'),'foreignKey':_0x8bb5('0x11a')});db['User']['hasMany'](db[_0x8bb5('0x103')],{'as':_0x8bb5('0x12c'),'foreignKey':_0x8bb5('0x12d')});db[_0x8bb5('0x13')][_0x8bb5('0x12e')](db[_0x8bb5('0xfe')],{'as':_0x8bb5('0xfe'),'foreignKey':_0x8bb5('0x12f')});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x71')],{'as':_0x8bb5('0x130'),'through':_0x8bb5('0x131')});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x76')],{'as':'Contacts','through':_0x8bb5('0x132')});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x133'),'through':'cm_user_has_lists'});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0xe9')],{'through':_0x8bb5('0x134')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x41')],{'as':_0x8bb5('0x12a'),'through':_0x8bb5('0x136')});db[_0x8bb5('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':_0x8bb5('0x127'),'through':_0x8bb5('0x137')});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x4e')],{'as':_0x8bb5('0x129'),'through':_0x8bb5('0x138')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x58')],{'as':'SmsInteractions','through':_0x8bb5('0x139')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x125')],{'as':_0x8bb5('0x126'),'through':_0x8bb5('0x13a')});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x108')],{'as':_0x8bb5('0x12b'),'through':'user_has_whatsapp_interactions'});db[_0x8bb5('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':_0x8bb5('0x13b'),'through':'UserVoiceQueue','required':![]});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0xfc')],{'as':_0x8bb5('0x13c'),'through':'UserVoicePrefix','required':![]});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x3d')],{'as':_0x8bb5('0x13d'),'through':_0x8bb5('0x30'),'required':![]});db['User'][_0x8bb5('0x135')](db['ChatQueue'],{'as':_0x8bb5('0x13e'),'through':_0x8bb5('0x2f'),'required':![],'hooks':!![]});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x13f')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x5c')],{'as':_0x8bb5('0x140'),'through':_0x8bb5('0x33'),'required':![]});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x65')],{'as':_0x8bb5('0x141'),'through':_0x8bb5('0x35'),'required':![]});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db['WhatsappQueue'],{'as':_0x8bb5('0x142'),'through':'UserWhatsappQueue','required':![]});db['User'][_0x8bb5('0x135')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x8bb5('0x13')]['belongsToMany'](db[_0x8bb5('0x67')],{'as':_0x8bb5('0x143'),'through':_0x8bb5('0x144')});db['User']['belongsToMany'](db[_0x8bb5('0x4c')],{'as':_0x8bb5('0x145'),'through':'user_has_fax_accounts'});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x3b')],{'as':_0x8bb5('0x146'),'through':_0x8bb5('0x147')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x5e')],{'as':_0x8bb5('0x148'),'through':_0x8bb5('0x149')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x54')],{'as':_0x8bb5('0x14a'),'through':_0x8bb5('0x14b')});db[_0x8bb5('0x13')][_0x8bb5('0x135')](db[_0x8bb5('0x105')],{'as':_0x8bb5('0x14c'),'through':_0x8bb5('0x14d')});db[_0x8bb5('0x14')][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'as':_0x8bb5('0x14e'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x14f')});db[_0x8bb5('0x17')][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x19')][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'as':_0x8bb5('0x150'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x1b')][_0x8bb5('0x135')](db['Sound'],{'as':_0x8bb5('0x151'),'through':'moh_has_sounds'});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db['UserVoiceQueueRt'],{'as':_0x8bb5('0x152'),'foreignKey':_0x8bb5('0x153')});db['VoiceQueue'][_0x8bb5('0x11d')](db[_0x8bb5('0x77')],{'as':'Hoppers','foreignKey':_0x8bb5('0x153')});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db[_0x8bb5('0x7a')],{'as':_0x8bb5('0x122'),'foreignKey':_0x8bb5('0x153')});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db[_0x8bb5('0x123')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db[_0x8bb5('0x7c')],{'as':_0x8bb5('0x7c'),'foreignKey':_0x8bb5('0x153')});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x8bb5('0x153')});db[_0x8bb5('0x1c')][_0x8bb5('0x11d')](db[_0x8bb5('0xd8')],{'as':'JscriptySessions','foreignKey':_0x8bb5('0x153')});db[_0x8bb5('0x1c')][_0x8bb5('0x12e')](db[_0x8bb5('0x2a')],{'as':'Trunk','foreignKey':_0x8bb5('0x154')});db['VoiceQueue'][_0x8bb5('0x12e')](db['Trunk'],{'as':_0x8bb5('0x155'),'foreignKey':_0x8bb5('0x156')});db[_0x8bb5('0x1c')][_0x8bb5('0x12e')](db[_0x8bb5('0x87')],{'as':_0x8bb5('0x87'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x1c')]['belongsTo'](db[_0x8bb5('0x89')],{'as':_0x8bb5('0x158'),'foreignKey':_0x8bb5('0x159')});db[_0x8bb5('0x1c')][_0x8bb5('0x135')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x133'),'through':_0x8bb5('0x15a')});db[_0x8bb5('0x1c')][_0x8bb5('0x135')](db['User'],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x2d')});db[_0x8bb5('0x1c')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'as':_0x8bb5('0x15c'),'through':'TeamVoiceQueue'});db[_0x8bb5('0x1c')][_0x8bb5('0x135')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x15d'),'through':_0x8bb5('0x15e')});db[_0x8bb5('0x11e')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x13'),'foreignKey':'UserId'});db[_0x8bb5('0x1f')][_0x8bb5('0x12e')](db['User'],{'as':'User','foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x21')][_0x8bb5('0x11d')](db['VoiceMailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x8bb5('0x15f'),'sourceKey':'mailbox'});db[_0x8bb5('0x23')][_0x8bb5('0x12e')](db[_0x8bb5('0x21')],{'foreignKey':_0x8bb5('0x15f'),'targetKey':'mailbox'});db[_0x8bb5('0x24')][_0x8bb5('0x11d')](db[_0x8bb5('0x27')],{'as':'QueueCalls','foreignKey':_0x8bb5('0x160'),'constraints':![]});db[_0x8bb5('0x24')][_0x8bb5('0x11d')](db[_0x8bb5('0x26')],{'as':_0x8bb5('0x161'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x13'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x24')][_0x8bb5('0x12e')](db['CmContact'],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db['MailServerIn']['belongsTo'](db['MailAccount'],{'as':_0x8bb5('0x3b'),'foreignKey':_0x8bb5('0x163')});db[_0x8bb5('0x38')][_0x8bb5('0x12e')](db[_0x8bb5('0x111')],{'as':_0x8bb5('0x111'),'foreignKey':_0x8bb5('0x164'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x3a')]['belongsTo'](db['MailAccount'],{'as':_0x8bb5('0x3b'),'foreignKey':_0x8bb5('0x163')});db['MailServerOut']['belongsTo'](db['CloudProvider'],{'as':_0x8bb5('0x111'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0x8bb5('0x3b')][_0x8bb5('0x118')](db[_0x8bb5('0x38')],{'as':_0x8bb5('0x166'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x3b')][_0x8bb5('0x118')](db[_0x8bb5('0x3a')],{'as':_0x8bb5('0x167'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x3b')]['hasMany'](db['Disposition'],{'as':_0x8bb5('0x168'),'foreignKey':'MailAccountId','onDelete':_0x8bb5('0x119')});db['MailAccount']['hasMany'](db[_0x8bb5('0x82')],{'as':_0x8bb5('0x169'),'foreignKey':'MailAccountId'});db[_0x8bb5('0x3b')]['hasMany'](db['MailMessage'],{'as':_0x8bb5('0x16a'),'foreignKey':_0x8bb5('0x163')});db['MailAccount'][_0x8bb5('0x11d')](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0x8bb5('0x11d')](db['MailApplication'],{'as':'Applications'});db[_0x8bb5('0x3b')][_0x8bb5('0x12e')](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db['MailAccount'][_0x8bb5('0x12e')](db[_0x8bb5('0x96')],{'as':_0x8bb5('0x96'),'foreignKey':_0x8bb5('0x16d')});db[_0x8bb5('0x3b')][_0x8bb5('0x12e')](db['Pause'],{'as':_0x8bb5('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8bb5('0x3b')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':'Agents','through':_0x8bb5('0x147')});db[_0x8bb5('0x3d')]['belongsToMany'](db['User'],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x30')});db[_0x8bb5('0x3d')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'through':'team_has_mail_queues','as':_0x8bb5('0x15c')});db[_0x8bb5('0x41')][_0x8bb5('0x11d')](db[_0x8bb5('0x16e')],{'as':_0x8bb5('0x16a'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x16f')});db['MailInteraction'][_0x8bb5('0x12e')](db[_0x8bb5('0x3b')],{'as':_0x8bb5('0x170'),'foreignKey':'MailAccountId'});db[_0x8bb5('0x41')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':'Contact','foreignKey':'ContactId'});db['MailInteraction'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x171'),'foreignKey':_0x8bb5('0x11a')});db['MailInteraction']['belongsToMany'](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x172'),'as':_0x8bb5('0x173')});db[_0x8bb5('0x41')][_0x8bb5('0x135')](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x172'),'as':_0x8bb5('0x174')});db[_0x8bb5('0x41')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x175'),'through':'user_has_mail_interactions','foreignKey':_0x8bb5('0x16f')});db[_0x8bb5('0x16e')]['hasMany'](db[_0x8bb5('0x176')],{'as':_0x8bb5('0x177'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x16e')][_0x8bb5('0x12e')](db['User'],{'as':_0x8bb5('0x13')});db[_0x8bb5('0x16e')]['belongsTo'](db[_0x8bb5('0x76')],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x162')});db[_0x8bb5('0x16e')][_0x8bb5('0x12e')](db[_0x8bb5('0x41')],{'as':_0x8bb5('0x178'),'foreignKey':_0x8bb5('0x16f')});db[_0x8bb5('0x16e')][_0x8bb5('0x12e')](db[_0x8bb5('0x3b')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x163')});db[_0x8bb5('0x16e')][_0x8bb5('0x12e')](db['ChatWebsite'],{'as':_0x8bb5('0x67'),'foreignKey':_0x8bb5('0x179')});db['MailMessage'][_0x8bb5('0x12e')](db['ChatOfflineMessage'],{'as':_0x8bb5('0x6e'),'foreignKey':_0x8bb5('0x17a')});db[_0x8bb5('0x44')]['belongsTo'](db['User'],{'onDelete':_0x8bb5('0x165')});db['MailApplication'][_0x8bb5('0x12e')](db[_0x8bb5('0x3d')],{'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x44')][_0x8bb5('0x12e')](db[_0x8bb5('0x3b')],{'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x44')][_0x8bb5('0x12e')](db[_0x8bb5('0x87')],{'onDelete':'restrict','foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x44')][_0x8bb5('0x12e')](db[_0x8bb5('0x91')],{'onDelete':'restrict','foreignKey':_0x8bb5('0x17b')});db[_0x8bb5('0x46')]['belongsTo'](db[_0x8bb5('0x3b')],{});db[_0x8bb5('0x46')][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x46')]['belongsTo'](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x46')][_0x8bb5('0x12e')](db['MailInteraction'],{});db[_0x8bb5('0x46')][_0x8bb5('0x12e')](db[_0x8bb5('0x16e')],{});db['MailQueueReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{});db[_0x8bb5('0x46')][_0x8bb5('0x12e')](db['MailQueue'],{});db[_0x8bb5('0x48')]['hasMany'](db[_0x8bb5('0x4a')],{'as':_0x8bb5('0x17d'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x4c')][_0x8bb5('0x11d')](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x17f'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x4c')]['hasMany'](db[_0x8bb5('0x82')],{'as':_0x8bb5('0x169'),'foreignKey':_0x8bb5('0x17f')});db[_0x8bb5('0x4c')][_0x8bb5('0x11d')](db[_0x8bb5('0x4e')],{'as':'Interactions'});db[_0x8bb5('0x4c')][_0x8bb5('0x11d')](db['FaxApplication'],{'as':_0x8bb5('0x150')});db[_0x8bb5('0x4c')][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'as':_0x8bb5('0x180'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x4c')][_0x8bb5('0x11d')](db[_0x8bb5('0x50')],{'as':_0x8bb5('0x16a')});db[_0x8bb5('0x4c')][_0x8bb5('0x12e')](db[_0x8bb5('0x2a')],{'as':_0x8bb5('0x2a')});db['FaxAccount'][_0x8bb5('0x12e')](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x4c')][_0x8bb5('0x12e')](db['Pause'],{'as':_0x8bb5('0x158'),'foreignKey':_0x8bb5('0x159')});db[_0x8bb5('0x4c')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x181')});db[_0x8bb5('0x182')]['belongsTo'](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x182')][_0x8bb5('0x12e')](db[_0x8bb5('0x13f')],{'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x182')][_0x8bb5('0x12e')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x8bb5('0x182')][_0x8bb5('0x12e')](db[_0x8bb5('0x91')],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x17b')});db[_0x8bb5('0x4e')]['hasMany'](db[_0x8bb5('0x50')],{'as':_0x8bb5('0x16a'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x183')});db['FaxInteraction'][_0x8bb5('0x12e')](db['FaxAccount'],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x17f')});db['FaxInteraction'][_0x8bb5('0x12e')](db['CmContact'],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x8bb5('0x12e')](db['User'],{'as':_0x8bb5('0x171'),'foreignKey':_0x8bb5('0x11a')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x8bb5('0x184'),'as':_0x8bb5('0x173')});db['FaxInteraction'][_0x8bb5('0x135')](db['Tag'],{'through':_0x8bb5('0x184'),'as':_0x8bb5('0x174')});db[_0x8bb5('0x4e')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x175'),'through':_0x8bb5('0x138'),'foreignKey':_0x8bb5('0x183')});db['FaxMessage'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x13')});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x8bb5('0x183')});db['FaxMessage'][_0x8bb5('0x12e')](db['CmContact'],{'onDelete':_0x8bb5('0x119'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0x8bb5('0x176')],{'as':_0x8bb5('0x176'),'foreignKey':_0x8bb5('0x185')});db[_0x8bb5('0x50')][_0x8bb5('0x12e')](db[_0x8bb5('0x4c')],{'as':'Account','foreignKey':_0x8bb5('0x17f')});db['FaxQueue']['belongsToMany'](db[_0x8bb5('0x13')],{'as':'Agents','through':_0x8bb5('0x31')});db[_0x8bb5('0x13f')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x8bb5('0x52')][_0x8bb5('0x12e')](db[_0x8bb5('0x4c')],{});db[_0x8bb5('0x52')][_0x8bb5('0x12e')](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x52')][_0x8bb5('0x12e')](db['CmContact'],{'as':'Contact','foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x52')][_0x8bb5('0x12e')](db[_0x8bb5('0x4e')],{});db[_0x8bb5('0x52')]['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport']['belongsTo'](db[_0x8bb5('0x13')],{});db[_0x8bb5('0x52')][_0x8bb5('0x12e')](db[_0x8bb5('0x13f')],{});db[_0x8bb5('0x54')][_0x8bb5('0x11d')](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x186'),'onDelete':'cascade'});db['SmsAccount'][_0x8bb5('0x11d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x8bb5('0x186')});db[_0x8bb5('0x54')][_0x8bb5('0x11d')](db[_0x8bb5('0x5a')],{'as':_0x8bb5('0x16a'),'foreignKey':_0x8bb5('0x186')});db[_0x8bb5('0x54')][_0x8bb5('0x11d')](db[_0x8bb5('0x58')],{'as':'Interactions'});db[_0x8bb5('0x54')][_0x8bb5('0x11d')](db[_0x8bb5('0x56')],{'as':_0x8bb5('0x150')});db[_0x8bb5('0x54')][_0x8bb5('0x12e')](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db['SmsAccount'][_0x8bb5('0x12e')](db['Pause'],{'as':_0x8bb5('0x158'),'foreignKey':_0x8bb5('0x159')});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x14b')});db[_0x8bb5('0x56')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x165')});db['SmsApplication']['belongsTo'](db[_0x8bb5('0x5c')],{'onDelete':'restrict'});db['SmsApplication'][_0x8bb5('0x12e')](db[_0x8bb5('0x54')],{'onDelete':_0x8bb5('0x165')});db['SmsApplication']['belongsTo'](db[_0x8bb5('0x87')],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x56')][_0x8bb5('0x12e')](db['Tag'],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x17b')});db['SmsInteraction']['hasMany'](db[_0x8bb5('0x5a')],{'as':_0x8bb5('0x16a'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x187')});db[_0x8bb5('0x58')]['belongsTo'](db[_0x8bb5('0x54')],{'as':'Account','foreignKey':_0x8bb5('0x186')});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x58')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':'Owner','foreignKey':_0x8bb5('0x11a')});db['SmsInteraction'][_0x8bb5('0x135')](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x188'),'as':'Tags'});db['SmsInteraction'][_0x8bb5('0x135')](db['Tag'],{'through':_0x8bb5('0x188'),'as':_0x8bb5('0x174')});db[_0x8bb5('0x58')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x175'),'through':_0x8bb5('0x139'),'foreignKey':_0x8bb5('0x187')});db[_0x8bb5('0x5a')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':'User'});db[_0x8bb5('0x5a')]['belongsTo'](db[_0x8bb5('0x76')],{'onDelete':_0x8bb5('0x119'),'as':'Contact'});db[_0x8bb5('0x5a')]['belongsTo'](db[_0x8bb5('0x58')],{'onDelete':_0x8bb5('0x119'),'as':'Interaction','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x8bb5('0x12e')](db[_0x8bb5('0x54')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x186')});db['SmsQueue'][_0x8bb5('0x135')](db['User'],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x33'),'foreignKey':_0x8bb5('0x189')});db[_0x8bb5('0x5c')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'through':_0x8bb5('0x18a'),'as':_0x8bb5('0x15c')});db[_0x8bb5('0x5e')]['hasMany'](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x18b'),'onDelete':'cascade'});db[_0x8bb5('0x5e')][_0x8bb5('0x11d')](db['CannedAnswer'],{'as':_0x8bb5('0x169'),'foreignKey':_0x8bb5('0x18b')});db[_0x8bb5('0x5e')][_0x8bb5('0x11d')](db[_0x8bb5('0x125')],{'as':_0x8bb5('0x18c'),'foreignKey':_0x8bb5('0x18b')});db[_0x8bb5('0x5e')][_0x8bb5('0x11d')](db['OpenchannelMessage'],{'as':_0x8bb5('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0x8bb5('0x5e')][_0x8bb5('0x11d')](db[_0x8bb5('0x60')],{'as':_0x8bb5('0x150'),'foreignKey':_0x8bb5('0x18b')});db[_0x8bb5('0x5e')]['belongsTo'](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':'ListId'});db[_0x8bb5('0x5e')][_0x8bb5('0x12e')](db[_0x8bb5('0x89')],{'as':_0x8bb5('0x158'),'foreignKey':_0x8bb5('0x159')});db['OpenchannelAccount']['belongsToMany'](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':'user_has_openchannel_accounts'});db[_0x8bb5('0x60')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x8bb5('0x60')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x18d')});db['OpenchannelApplication'][_0x8bb5('0x12e')](db[_0x8bb5('0x5e')],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x18b')});db[_0x8bb5('0x60')][_0x8bb5('0x12e')](db['Interval'],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x60')][_0x8bb5('0x12e')](db[_0x8bb5('0x91')],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x17b')});db['OpenchannelInteraction'][_0x8bb5('0x11d')](db[_0x8bb5('0x63')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x8bb5('0x18e')});db[_0x8bb5('0x125')][_0x8bb5('0x12e')](db['OpenchannelAccount'],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x18b')});db['OpenchannelInteraction'][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db[_0x8bb5('0x125')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x171'),'foreignKey':'UserId'});db[_0x8bb5('0x125')][_0x8bb5('0x135')](db['Tag'],{'through':_0x8bb5('0x18f'),'as':_0x8bb5('0x173')});db['OpenchannelInteraction'][_0x8bb5('0x135')](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x18f'),'as':'ThroughTags'});db[_0x8bb5('0x125')][_0x8bb5('0x135')](db['User'],{'as':'Users','through':_0x8bb5('0x13a'),'foreignKey':_0x8bb5('0x18e')});db['OpenchannelMessage'][_0x8bb5('0x12e')](db['User'],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x13')});db['OpenchannelMessage']['belongsTo'](db[_0x8bb5('0x76')],{'onDelete':'cascade','as':_0x8bb5('0x162')});db[_0x8bb5('0x63')][_0x8bb5('0x12e')](db['OpenchannelInteraction'],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x178'),'foreignKey':_0x8bb5('0x18e')});db[_0x8bb5('0x63')]['belongsTo'](db[_0x8bb5('0x176')],{'as':_0x8bb5('0x176'),'foreignKey':_0x8bb5('0x185')});db['OpenchannelMessage'][_0x8bb5('0x12e')](db[_0x8bb5('0x5e')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x18b')});db['OpenchannelQueue'][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x35'),'foreignKey':_0x8bb5('0x18d')});db[_0x8bb5('0x65')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'through':_0x8bb5('0x190'),'as':_0x8bb5('0x15c')});db['ChatWebsite']['hasMany'](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x179'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x67')][_0x8bb5('0x11d')](db[_0x8bb5('0x82')],{'as':'Answers','foreignKey':_0x8bb5('0x179')});db[_0x8bb5('0x67')][_0x8bb5('0x11d')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x8bb5('0x67')][_0x8bb5('0x11d')](db[_0x8bb5('0x6a')],{'as':'Interactions'});db[_0x8bb5('0x67')][_0x8bb5('0x11d')](db['ChatApplication'],{'as':_0x8bb5('0x150')});db['ChatWebsite'][_0x8bb5('0x11d')](db[_0x8bb5('0x6c')],{'as':_0x8bb5('0x16a')});db[_0x8bb5('0x67')][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x67')][_0x8bb5('0x12e')](db[_0x8bb5('0x87')],{'as':_0x8bb5('0x87'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x67')]['belongsTo'](db[_0x8bb5('0x3b')],{'as':'MailAccount','foreignKey':_0x8bb5('0x163')});db['ChatWebsite'][_0x8bb5('0x12e')](db['Pause'],{'as':_0x8bb5('0x158'),'foreignKey':_0x8bb5('0x159')});db[_0x8bb5('0x67')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x144')});db[_0x8bb5('0x191')]['belongsTo'](db[_0x8bb5('0x5e')],{});db[_0x8bb5('0x191')]['belongsTo'](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x191')]['belongsTo'](db['CmContact'],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db['OpenchannelQueueReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x125')],{});db[_0x8bb5('0x191')]['belongsTo'](db[_0x8bb5('0x63')],{});db[_0x8bb5('0x191')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{});db[_0x8bb5('0x191')][_0x8bb5('0x12e')](db[_0x8bb5('0x65')],{});db[_0x8bb5('0x68')][_0x8bb5('0x12e')](db['User'],{'as':'Agent','foreignKey':_0x8bb5('0x11a'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x68')]['belongsTo'](db[_0x8bb5('0x6f')],{'as':_0x8bb5('0x192'),'foreignKey':_0x8bb5('0x193'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x68')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{'as':_0x8bb5('0x194'),'foreignKey':_0x8bb5('0x179'),'onDelete':'restrict'});db['ChatApplication'][_0x8bb5('0x12e')](db[_0x8bb5('0x91')],{'onDelete':_0x8bb5('0x165'),'foreignKey':'TagId'});db[_0x8bb5('0x6a')][_0x8bb5('0x11d')](db[_0x8bb5('0x6c')],{'as':_0x8bb5('0x16a'),'onDelete':_0x8bb5('0x119'),'foreignKey':'ChatInteractionId'});db[_0x8bb5('0x6a')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x179')});db[_0x8bb5('0x6a')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db[_0x8bb5('0x6a')][_0x8bb5('0x12e')](db['User'],{'as':_0x8bb5('0x171'),'foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x6a')][_0x8bb5('0x135')](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x195'),'as':_0x8bb5('0x173')});db[_0x8bb5('0x6a')]['belongsToMany'](db['Tag'],{'through':_0x8bb5('0x195'),'as':_0x8bb5('0x174')});db['ChatInteraction'][_0x8bb5('0x135')](db['User'],{'as':_0x8bb5('0x175'),'through':_0x8bb5('0x137'),'foreignKey':_0x8bb5('0x196')});db[_0x8bb5('0x6c')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x119'),'as':'User'});db[_0x8bb5('0x6c')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db[_0x8bb5('0x6c')][_0x8bb5('0x12e')](db[_0x8bb5('0x6a')],{'onDelete':_0x8bb5('0x119'),'as':'Interaction','foreignKey':_0x8bb5('0x196')});db[_0x8bb5('0x6c')][_0x8bb5('0x12e')](db[_0x8bb5('0x176')],{'as':'Attachment','foreignKey':_0x8bb5('0x185')});db[_0x8bb5('0x6c')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x179')});db['ChatOfflineMessage'][_0x8bb5('0x11d')](db[_0x8bb5('0x176')],{'as':_0x8bb5('0x177'),'foreignKey':_0x8bb5('0x17a'),'onDelete':'cascade','hooks':!![]});db[_0x8bb5('0x6e')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db[_0x8bb5('0x6e')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x179')});db[_0x8bb5('0x6f')][_0x8bb5('0x135')](db['User'],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x2f'),'hooks':!![]});db[_0x8bb5('0x6f')][_0x8bb5('0x135')](db[_0x8bb5('0xe9')],{'through':'team_has_chat_queues','as':_0x8bb5('0x15c')});db[_0x8bb5('0x71')][_0x8bb5('0x11d')](db[_0x8bb5('0xd6')],{'as':_0x8bb5('0x16a'),'foreignKey':_0x8bb5('0x197'),'onDelete':_0x8bb5('0x119')});db['ChatGroup'][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x152'),'through':_0x8bb5('0x131')});db[_0x8bb5('0x73')][_0x8bb5('0x12e')](db['ChatWebsite'],{'as':_0x8bb5('0x194'),'foreignKey':_0x8bb5('0x179')});db[_0x8bb5('0x198')][_0x8bb5('0x11d')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x199'),'foreignKey':'CompanyId'});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0x93')],{'as':_0x8bb5('0x19a'),'foreignKey':_0x8bb5('0x19b')});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0x77')],{'as':_0x8bb5('0x19c'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x76')]['hasMany'](db[_0x8bb5('0x7a')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0x123')],{'as':'HopperHistories','foreignKey':_0x8bb5('0x17c')});db['CmContact'][_0x8bb5('0x11d')](db[_0x8bb5('0x7c')],{'as':_0x8bb5('0x7c'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0xd8')],{'as':_0x8bb5('0x19d'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0x125')],{'as':'OpenchannelInteractions','foreignKey':_0x8bb5('0x17c'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x76')]['hasMany'](db['ChatInteraction'],{'as':_0x8bb5('0x127'),'foreignKey':_0x8bb5('0x17c'),'onDelete':_0x8bb5('0x165')});db['CmContact'][_0x8bb5('0x11d')](db[_0x8bb5('0x58')],{'as':'SmsInteractions','foreignKey':_0x8bb5('0x17c'),'onDelete':'restrict'});db[_0x8bb5('0x76')][_0x8bb5('0x11d')](db[_0x8bb5('0x4e')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x8bb5('0x165')});db['CmContact'][_0x8bb5('0x11d')](db[_0x8bb5('0x41')],{'as':_0x8bb5('0x12a'),'foreignKey':_0x8bb5('0x17c'),'onDelete':_0x8bb5('0x165')});db['CmContact']['belongsTo'](db['CmCompany'],{'as':_0x8bb5('0x19e'),'foreignKey':_0x8bb5('0x19f')});db['CmContact'][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':'List','foreignKey':_0x8bb5('0x16c'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x76')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x175'),'through':'cm_user_has_contacts'});db[_0x8bb5('0x76')][_0x8bb5('0x135')](db['Tag'],{'as':_0x8bb5('0x173'),'through':_0x8bb5('0x1a0')});db[_0x8bb5('0x76')][_0x8bb5('0x135')](db[_0x8bb5('0x91')],{'through':'cm_contact_has_tags','as':_0x8bb5('0x174')});db[_0x8bb5('0x77')][_0x8bb5('0x11d')](db[_0x8bb5('0x95')],{'as':_0x8bb5('0x1a1'),'foreignKey':_0x8bb5('0x1a2')});db['CmHopper'][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId','onDelete':_0x8bb5('0x119')});db['CmHopper'][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c'),'onDelete':_0x8bb5('0x119')});db['CmHopper']['belongsTo'](db['User'],{'as':'Agent','foreignKey':_0x8bb5('0x11a')});db[_0x8bb5('0x77')][_0x8bb5('0x12e')](db['VoiceQueue'],{'as':_0x8bb5('0x192'),'foreignKey':_0x8bb5('0x153'),'onDelete':'cascade'});db[_0x8bb5('0x77')][_0x8bb5('0x12e')](db[_0x8bb5('0xed')],{'as':_0x8bb5('0xed'),'foreignKey':'CampaignId','onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x77')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':'Owner','foreignKey':'OwnerId'});db[_0x8bb5('0x79')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c'),'onDelete':'cascade'});db[_0x8bb5('0x79')][_0x8bb5('0x12e')](db['CmList'],{'as':_0x8bb5('0x16b'),'foreignKey':'ListId','onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x79')][_0x8bb5('0x12e')](db['VoiceQueue'],{'as':_0x8bb5('0x192'),'foreignKey':'VoiceQueueId','onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x79')][_0x8bb5('0x12e')](db[_0x8bb5('0xed')],{'as':'Campaign','foreignKey':_0x8bb5('0x1a3'),'onDelete':'cascade'});db['Automation'][_0x8bb5('0x11d')](db[_0x8bb5('0x85')],{'as':{'plural':_0x8bb5('0x1a4'),'singular':_0x8bb5('0x1a5')},'foreignKey':_0x8bb5('0x1a6'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db[_0x8bb5('0x80')][_0x8bb5('0x11d')](db[_0x8bb5('0x85')],{'as':{'plural':_0x8bb5('0x1a7'),'singular':_0x8bb5('0x1a8')},'foreignKey':_0x8bb5('0x1a9'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db[_0x8bb5('0x80')]['hasMany'](db[_0x8bb5('0x7f')],{'as':_0x8bb5('0x1aa'),'foreignKey':_0x8bb5('0x1ab'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db[_0x8bb5('0x17e')]['hasMany'](db[_0x8bb5('0x17e')],{'as':'Dispositions','foreignKey':_0x8bb5('0x1ac'),'onDelete':'cascade'});db[_0x8bb5('0x87')][_0x8bb5('0x11d')](db[_0x8bb5('0x87')],{'as':'Intervals','foreignKey':_0x8bb5('0x157'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x8bb5('0x87')][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'as':'Extensions','foreignKey':_0x8bb5('0x157'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x87')][_0x8bb5('0x11d')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x8bb5('0x87')][_0x8bb5('0x11d')](db[_0x8bb5('0x68')],{'as':_0x8bb5('0x1ad'),'foreignKey':_0x8bb5('0x157')});db['Interval']['hasMany'](db[_0x8bb5('0x182')],{'as':_0x8bb5('0x1ae'),'foreignKey':'IntervalId'});db[_0x8bb5('0x87')][_0x8bb5('0x11d')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x8d')][_0x8bb5('0x12e')](db['MailAccount'],{});db[_0x8bb5('0x8d')][_0x8bb5('0x12e')](db[_0x8bb5('0x1af')],{'foreignKey':_0x8bb5('0x1b0')});db['Schedule'][_0x8bb5('0x12e')](db['AnalyticCustomReport'],{'foreignKey':_0x8bb5('0x1b1')});db['Sound']['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x8bb5('0x1b2'),'through':_0x8bb5('0x1b3'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x91')][_0x8bb5('0x135')](db[_0x8bb5('0x76')],{'through':_0x8bb5('0x1a0')});db[_0x8bb5('0x91')][_0x8bb5('0x135')](db['ChatInteraction'],{'through':_0x8bb5('0x195')});db[_0x8bb5('0x91')][_0x8bb5('0x135')](db[_0x8bb5('0x41')],{'through':_0x8bb5('0x172')});db[_0x8bb5('0x91')][_0x8bb5('0x135')](db['SmsInteraction'],{'through':_0x8bb5('0x188')});db[_0x8bb5('0x91')][_0x8bb5('0x135')](db[_0x8bb5('0x4e')],{'through':_0x8bb5('0x184')});db['Tag'][_0x8bb5('0x135')](db[_0x8bb5('0x125')],{'through':_0x8bb5('0x18f')});db[_0x8bb5('0x91')]['belongsToMany'](db[_0x8bb5('0x108')],{'through':'whatsapp_interaction_has_tags'});db[_0x8bb5('0x93')][_0x8bb5('0x12e')](db['ContactItemType'],{'as':_0x8bb5('0x1b4'),'foreignKey':_0x8bb5('0x1b5')});db['CmHopperAdditionalPhone']['belongsTo'](db['CmHopper'],{'as':'Hopper','foreignKey':_0x8bb5('0x1a2')});db[_0x8bb5('0x93')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':'Contact','foreignKey':'CmContactId'});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0x8bb5('0x1b6'),'singular':_0x8bb5('0x1b7')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x8bb5('0x98')][_0x8bb5('0x11d')](db[_0x8bb5('0x85')],{'as':{'plural':_0x8bb5('0x1b8'),'singular':_0x8bb5('0x1b9')},'foreignKey':_0x8bb5('0x1ba'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x8bb5('0x7f')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x8bb5('0x119'),'hooks':!![]});db['AnalyticCustomReport'][_0x8bb5('0x11d')](db['AnalyticFieldReport'],{'as':_0x8bb5('0x1bb'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1b1'),'hooks':!![]});db[_0x8bb5('0x1af')][_0x8bb5('0x11d')](db['AnalyticFieldReport'],{'as':_0x8bb5('0x1bb'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1b0')});db['AnalyticMetric'][_0x8bb5('0x11d')](db[_0x8bb5('0xa5')],{'as':_0x8bb5('0x1bb'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1bc')});db['AnalyticFieldReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x1bd')],{'foreignKey':_0x8bb5('0x1bc')});db['SalesforceAccount'][_0x8bb5('0x11d')](db[_0x8bb5('0xab')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xab')][_0x8bb5('0x11d')](db['SalesforceField'],{'as':'Subjects','onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xab')][_0x8bb5('0x11d')](db[_0x8bb5('0xad')],{'as':_0x8bb5('0x1c0'),'onDelete':_0x8bb5('0x119'),'foreignKey':'DescriptionId'});db[_0x8bb5('0xab')][_0x8bb5('0x11d')](db[_0x8bb5('0xad')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xab')]['belongsTo'](db[_0x8bb5('0xa9')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xad')][_0x8bb5('0x11d')](db[_0x8bb5('0xad')],{'as':'Subject','foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xad')][_0x8bb5('0x11d')](db[_0x8bb5('0xad')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xad')]['hasMany'](db['SalesforceField'],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db['SalesforceField'][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':_0x8bb5('0x9a'),'foreignKey':_0x8bb5('0x1c5')});db['SugarcrmAccount'][_0x8bb5('0x11d')](db['SugarcrmConfiguration'],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xb0')]['hasMany'](db[_0x8bb5('0xb2')],{'as':_0x8bb5('0x1c7'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xb0')][_0x8bb5('0x11d')](db[_0x8bb5('0xb2')],{'as':_0x8bb5('0x1c0'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xb0')][_0x8bb5('0x11d')](db[_0x8bb5('0xb2')],{'as':_0x8bb5('0x1bb'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c1')});db['SugarcrmConfiguration'][_0x8bb5('0x12e')](db[_0x8bb5('0xae')],{'as':'Account','foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xb2')][_0x8bb5('0x11d')](db[_0x8bb5('0xb2')],{'as':_0x8bb5('0x1c8'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xb2')]['hasMany'](db['SugarcrmField'],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xb2')][_0x8bb5('0x11d')](db[_0x8bb5('0xb2')],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xb2')]['belongsTo'](db[_0x8bb5('0x9a')],{'as':_0x8bb5('0x9a'),'foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0x1c9')]['hasMany'](db[_0x8bb5('0x1ca')],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0x1ca')][_0x8bb5('0x11d')](db[_0x8bb5('0x1cb')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0x1ca')][_0x8bb5('0x11d')](db['DeskField'],{'as':_0x8bb5('0x1c0'),'onDelete':_0x8bb5('0x119'),'foreignKey':'DescriptionId'});db[_0x8bb5('0x1ca')]['hasMany'](db[_0x8bb5('0x1cb')],{'as':_0x8bb5('0x1bb'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0x1ca')][_0x8bb5('0x12e')](db[_0x8bb5('0x1c9')],{'as':_0x8bb5('0x170'),'foreignKey':'AccountId'});db[_0x8bb5('0x1ca')][_0x8bb5('0x135')](db['Tag'],{'through':_0x8bb5('0x1cc')});db[_0x8bb5('0x1cb')]['hasMany'](db[_0x8bb5('0x1cb')],{'as':_0x8bb5('0x1c8'),'foreignKey':'SubjectId'});db[_0x8bb5('0x1cb')]['hasMany'](db[_0x8bb5('0x1cb')],{'as':'Description','foreignKey':_0x8bb5('0x1c3')});db['DeskField'][_0x8bb5('0x11d')](db[_0x8bb5('0x1cb')],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db['DeskField'][_0x8bb5('0x12e')](db['Variable'],{'as':_0x8bb5('0x9a'),'foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0x1cd')][_0x8bb5('0x11d')](db[_0x8bb5('0xb7')],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db['ZohoConfiguration']['hasMany'](db[_0x8bb5('0xb9')],{'as':_0x8bb5('0x1c7'),'onDelete':_0x8bb5('0x119'),'foreignKey':'SubjectId'});db[_0x8bb5('0xb7')][_0x8bb5('0x11d')](db['ZohoField'],{'as':_0x8bb5('0x1c0'),'onDelete':_0x8bb5('0x119'),'foreignKey':'DescriptionId'});db[_0x8bb5('0xb7')][_0x8bb5('0x11d')](db['ZohoField'],{'as':'Fields','onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xb7')][_0x8bb5('0x12e')](db[_0x8bb5('0x1cd')],{'as':'Account','foreignKey':'AccountId'});db[_0x8bb5('0xb9')][_0x8bb5('0x11d')](db[_0x8bb5('0xb9')],{'as':_0x8bb5('0x1c8'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xb9')][_0x8bb5('0x11d')](db[_0x8bb5('0xb9')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xb9')][_0x8bb5('0x11d')](db[_0x8bb5('0xb9')],{'as':'Field','foreignKey':_0x8bb5('0x1c1')});db['ZohoField'][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':_0x8bb5('0x9a'),'foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0x1ce')][_0x8bb5('0x11d')](db[_0x8bb5('0xbc')],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xbc')][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':_0x8bb5('0x1c7'),'foreignKey':'SubjectId'});db[_0x8bb5('0xbc')][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':_0x8bb5('0x1bb'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xbc')][_0x8bb5('0x12e')](db[_0x8bb5('0x1ce')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xbc')][_0x8bb5('0x135')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x8bb5('0xbe')][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':_0x8bb5('0x1c8'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xbe')][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xbe')][_0x8bb5('0x11d')](db[_0x8bb5('0xbe')],{'as':'Field','foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xbe')][_0x8bb5('0x12e')](db['Variable'],{'as':_0x8bb5('0x9a'),'foreignKey':'VariableId'});db[_0x8bb5('0xc0')][_0x8bb5('0x11d')](db[_0x8bb5('0xc2')],{'as':_0x8bb5('0x1c6'),'onDelete':'cascade','foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xc2')][_0x8bb5('0x11d')](db[_0x8bb5('0xc4')],{'as':_0x8bb5('0x1c7'),'onDelete':'cascade','foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xc2')][_0x8bb5('0x11d')](db[_0x8bb5('0xc4')],{'as':_0x8bb5('0x1c0'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x8bb5('0xc2')][_0x8bb5('0x11d')](db['FreshdeskField'],{'as':'Fields','onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c1')});db['FreshdeskConfiguration']['belongsTo'](db[_0x8bb5('0xc0')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xc2')][_0x8bb5('0x135')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x8bb5('0x11d')](db[_0x8bb5('0xc4')],{'as':_0x8bb5('0x1c8'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xc4')][_0x8bb5('0x11d')](db[_0x8bb5('0xc4')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db['FreshdeskField'][_0x8bb5('0x11d')](db[_0x8bb5('0xc4')],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xc4')][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':'Variable','foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0x1cf')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d0')],{'as':'Configurations','onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0x1d0')][_0x8bb5('0x11d')](db[_0x8bb5('0xc6')],{'as':_0x8bb5('0x1c7'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0x1d0')][_0x8bb5('0x11d')](db[_0x8bb5('0xc6')],{'as':_0x8bb5('0x1c0'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0x1d0')]['hasMany'](db[_0x8bb5('0xc6')],{'as':'Fields','foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0x1d0')][_0x8bb5('0x12e')](db[_0x8bb5('0x1cf')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xc6')]['hasMany'](db['VtigerField'],{'as':_0x8bb5('0x1c8'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xc6')][_0x8bb5('0x11d')](db[_0x8bb5('0xc6')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xc6')][_0x8bb5('0x11d')](db['VtigerField'],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db['VtigerField'][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':_0x8bb5('0x9a'),'foreignKey':_0x8bb5('0x1c5')});db['ServicenowAccount'][_0x8bb5('0x11d')](db[_0x8bb5('0xc8')],{'as':_0x8bb5('0x1c6'),'onDelete':'cascade','foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xc8')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d1')],{'as':_0x8bb5('0x1c7'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xc8')]['hasMany'](db[_0x8bb5('0x1d1')],{'as':_0x8bb5('0x1c0'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xc8')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d1')],{'as':_0x8bb5('0x1bb'),'foreignKey':_0x8bb5('0x1c1')});db['ServicenowConfiguration'][_0x8bb5('0x12e')](db[_0x8bb5('0xc7')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db['ServicenowField'][_0x8bb5('0x11d')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x8bb5('0x1bf')});db['ServicenowField'][_0x8bb5('0x11d')](db[_0x8bb5('0x1d1')],{'as':'Description','foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0x1d1')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d1')],{'as':'Field','foreignKey':'FieldId'});db[_0x8bb5('0x1d1')][_0x8bb5('0x12e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x8bb5('0xca')][_0x8bb5('0x11d')](db[_0x8bb5('0xcb')],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xca')][_0x8bb5('0x12e')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x8bb5('0x164')});db[_0x8bb5('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':_0x8bb5('0x1c7'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xcb')][_0x8bb5('0x11d')](db[_0x8bb5('0xcd')],{'as':_0x8bb5('0x1c0'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c3')});db['Dynamics365Configuration'][_0x8bb5('0x11d')](db[_0x8bb5('0xcd')],{'as':'Fields','onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xcb')][_0x8bb5('0x12e')](db[_0x8bb5('0xca')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1be')});db['Dynamics365Field'][_0x8bb5('0x11d')](db[_0x8bb5('0xcd')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8bb5('0xcd')][_0x8bb5('0x11d')](db[_0x8bb5('0xcd')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db[_0x8bb5('0xcd')][_0x8bb5('0x11d')](db[_0x8bb5('0xcd')],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xcd')][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':'Variable','foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0x1d2')][_0x8bb5('0x11d')](db['FreshsalesConfiguration'],{'as':_0x8bb5('0x1c6'),'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1be')});db[_0x8bb5('0xcf')]['hasMany'](db[_0x8bb5('0xd1')],{'as':'Subjects','foreignKey':_0x8bb5('0x1bf')});db[_0x8bb5('0xcf')][_0x8bb5('0x11d')](db[_0x8bb5('0xd1')],{'as':_0x8bb5('0x1c0'),'foreignKey':'DescriptionId'});db[_0x8bb5('0xcf')][_0x8bb5('0x11d')](db[_0x8bb5('0xd1')],{'as':_0x8bb5('0x1bb'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xcf')][_0x8bb5('0x12e')](db[_0x8bb5('0x1d2')],{'as':'Account','foreignKey':_0x8bb5('0x1be')});db['FreshsalesField'][_0x8bb5('0x11d')](db[_0x8bb5('0xd1')],{'as':_0x8bb5('0x1c8'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x8bb5('0x11d')](db[_0x8bb5('0xd1')],{'as':_0x8bb5('0x1c2'),'foreignKey':_0x8bb5('0x1c3')});db['FreshsalesField'][_0x8bb5('0x11d')](db[_0x8bb5('0xd1')],{'as':_0x8bb5('0x1c4'),'foreignKey':_0x8bb5('0x1c1')});db[_0x8bb5('0xd1')][_0x8bb5('0x12e')](db[_0x8bb5('0x9a')],{'as':'Variable','foreignKey':_0x8bb5('0x1c5')});db[_0x8bb5('0xd4')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{});db[_0x8bb5('0xd4')][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':'List','foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0xd4')]['belongsTo'](db['CmContact'],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0xd4')]['belongsTo'](db['ChatInteraction'],{});db[_0x8bb5('0xd4')]['belongsTo'](db[_0x8bb5('0x6c')],{});db[_0x8bb5('0xd4')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{});db['ChatQueueReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x6f')],{});db[_0x8bb5('0xd6')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1d3')});db['ChatInternalMessage']['belongsTo'](db[_0x8bb5('0x13')],{'onDelete':_0x8bb5('0x119'),'foreignKey':_0x8bb5('0x1d4')});db[_0x8bb5('0xd8')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d5')],{'foreignKey':_0x8bb5('0x1d6'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0xd8')][_0x8bb5('0x11d')](db['JscriptyAnswerReport'],{'foreignKey':_0x8bb5('0x1d6'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0xda')][_0x8bb5('0x12e')](db[_0x8bb5('0x54')],{});db[_0x8bb5('0xda')]['belongsTo'](db[_0x8bb5('0xfa')],{'as':'List','foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0xda')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':'ContactId'});db[_0x8bb5('0xda')][_0x8bb5('0x12e')](db[_0x8bb5('0x58')],{});db[_0x8bb5('0xda')][_0x8bb5('0x12e')](db['SmsMessage'],{});db[_0x8bb5('0xda')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{});db['SmsQueueReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x5c')],{});db[_0x8bb5('0xe0')][_0x8bb5('0x11d')](db[_0x8bb5('0xd8')],{'foreignKey':_0x8bb5('0x1d7')});db['JscriptyProject'][_0x8bb5('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0x8bb5('0x1d7')});db[_0x8bb5('0xe0')][_0x8bb5('0x11d')](db[_0x8bb5('0x1d8')],{'foreignKey':'ProjectId'});db[_0x8bb5('0xe9')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':'Agents','through':_0x8bb5('0x134')});db[_0x8bb5('0xe9')]['belongsToMany'](db['VoiceQueue'],{'through':_0x8bb5('0x112'),'as':'VoiceQueues'});db[_0x8bb5('0xe9')]['belongsToMany'](db[_0x8bb5('0x3d')],{'through':_0x8bb5('0x1d9'),'as':'MailQueues'});db[_0x8bb5('0xe9')][_0x8bb5('0x135')](db[_0x8bb5('0x6f')],{'through':_0x8bb5('0x1da'),'as':'ChatQueues'});db['Team']['belongsToMany'](db[_0x8bb5('0x13f')],{'through':_0x8bb5('0x1db'),'as':_0x8bb5('0x1dc')});db['Team'][_0x8bb5('0x135')](db[_0x8bb5('0x5c')],{'through':_0x8bb5('0x18a'),'as':_0x8bb5('0x140')});db[_0x8bb5('0xe9')][_0x8bb5('0x135')](db[_0x8bb5('0x65')],{'through':'team_has_openchannel_queues','as':_0x8bb5('0x141')});db['Team'][_0x8bb5('0x135')](db[_0x8bb5('0x10f')],{'through':_0x8bb5('0x1dd'),'as':_0x8bb5('0x142')});db['Team'][_0x8bb5('0x135')](db['VoicePrefix'],{'through':_0x8bb5('0x114'),'as':_0x8bb5('0x13c')});db[_0x8bb5('0xed')]['hasMany'](db[_0x8bb5('0x77')],{'as':'Hoppers','foreignKey':_0x8bb5('0x1a3')});db[_0x8bb5('0xed')][_0x8bb5('0x11d')](db[_0x8bb5('0x7a')],{'as':_0x8bb5('0x122'),'foreignKey':_0x8bb5('0x1a3')});db[_0x8bb5('0xed')][_0x8bb5('0x11d')](db[_0x8bb5('0x123')],{'as':_0x8bb5('0x1de'),'foreignKey':'CampaignId'});db[_0x8bb5('0xed')]['hasMany'](db[_0x8bb5('0x79')],{'as':_0x8bb5('0x1df'),'foreignKey':'CampaignId'});db[_0x8bb5('0xed')]['belongsTo'](db[_0x8bb5('0x2a')],{'as':'Trunk','foreignKey':_0x8bb5('0x154')});db[_0x8bb5('0xed')][_0x8bb5('0x12e')](db[_0x8bb5('0x2a')],{'as':_0x8bb5('0x155'),'foreignKey':_0x8bb5('0x156')});db[_0x8bb5('0xed')][_0x8bb5('0x12e')](db['Interval'],{'as':_0x8bb5('0x87'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0xed')]['belongsTo'](db['SquareProject'],{'as':_0x8bb5('0x1e0'),'foreignKey':_0x8bb5('0x1e1')});db[_0x8bb5('0xed')][_0x8bb5('0x135')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x133'),'through':_0x8bb5('0x1e2')});db[_0x8bb5('0xed')][_0x8bb5('0x135')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x15d'),'through':'campaigns_has_cm_blacklists'});db[_0x8bb5('0x176')][_0x8bb5('0x12e')](db[_0x8bb5('0x6e')],{'as':_0x8bb5('0x6e'),'foreignKey':_0x8bb5('0x17a')});db['MailTransferReport'][_0x8bb5('0x12e')](db['MailMessage'],{});db[_0x8bb5('0xf2')]['belongsTo'](db[_0x8bb5('0x41')],{});db[_0x8bb5('0xf2')][_0x8bb5('0x12e')](db[_0x8bb5('0x3b')],{'foreignKey':_0x8bb5('0x1e3'),'as':_0x8bb5('0x1e4')});db[_0x8bb5('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x8bb5('0x1e5'),'as':_0x8bb5('0x1e6')});db['MailTransferReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db[_0x8bb5('0xf2')][_0x8bb5('0x12e')](db[_0x8bb5('0x3d')],{'foreignKey':_0x8bb5('0x1e9'),'as':_0x8bb5('0x1ea')});db[_0x8bb5('0xf2')][_0x8bb5('0x12e')](db[_0x8bb5('0x3b')],{'foreignKey':_0x8bb5('0x1eb'),'as':_0x8bb5('0x1ec')});db[_0x8bb5('0xf4')][_0x8bb5('0x12e')](db['ChatMessage'],{});db[_0x8bb5('0xf4')][_0x8bb5('0x12e')](db[_0x8bb5('0x6a')],{});db[_0x8bb5('0xf4')][_0x8bb5('0x12e')](db[_0x8bb5('0x67')],{'foreignKey':_0x8bb5('0x1ed'),'as':'FromAccount'});db[_0x8bb5('0xf4')][_0x8bb5('0x12e')](db['User'],{'foreignKey':_0x8bb5('0x1e5'),'as':_0x8bb5('0x1e6')});db['ChatTransferReport']['belongsTo'](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db[_0x8bb5('0xf4')][_0x8bb5('0x12e')](db[_0x8bb5('0x6f')],{'foreignKey':_0x8bb5('0x1ee'),'as':'ToQueue'});db[_0x8bb5('0xf4')]['belongsTo'](db[_0x8bb5('0x67')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db['FaxMessage'],{});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db['FaxInteraction'],{});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db[_0x8bb5('0x4c')],{'foreignKey':_0x8bb5('0x1f0'),'as':'FromAccount'});db['FaxTransferReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e5'),'as':_0x8bb5('0x1e6')});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x8bb5('0x1ef')][_0x8bb5('0x12e')](db[_0x8bb5('0x4c')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x8bb5('0xf6')][_0x8bb5('0x12e')](db[_0x8bb5('0x125')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x8bb5('0x5e')],{'foreignKey':_0x8bb5('0x1f1'),'as':_0x8bb5('0x1e4')});db[_0x8bb5('0xf6')][_0x8bb5('0x12e')](db['User'],{'foreignKey':_0x8bb5('0x1e5'),'as':_0x8bb5('0x1e6')});db[_0x8bb5('0xf6')][_0x8bb5('0x12e')](db['User'],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db[_0x8bb5('0xf6')]['belongsTo'](db[_0x8bb5('0x65')],{'foreignKey':_0x8bb5('0x1f2'),'as':_0x8bb5('0x1ea')});db[_0x8bb5('0xf6')][_0x8bb5('0x12e')](db[_0x8bb5('0x5e')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0x8bb5('0xf8')]['belongsTo'](db[_0x8bb5('0x5a')],{});db['SmsTransferReport'][_0x8bb5('0x12e')](db['SmsInteraction'],{});db[_0x8bb5('0xf8')][_0x8bb5('0x12e')](db[_0x8bb5('0x54')],{'foreignKey':_0x8bb5('0x1f3'),'as':_0x8bb5('0x1e4')});db[_0x8bb5('0xf8')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e5'),'as':'FromAgent'});db['SmsTransferReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db['SmsTransferReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x5c')],{'foreignKey':_0x8bb5('0x1f4'),'as':'ToQueue'});db[_0x8bb5('0xf8')]['belongsTo'](db[_0x8bb5('0x54')],{'foreignKey':'ToSmsAccountId','as':_0x8bb5('0x1ec')});db['CmList'][_0x8bb5('0x11d')](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x16c'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0xfa')]['hasMany'](db[_0x8bb5('0x7e')],{'as':'CustomFields','foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0xfa')]['hasMany'](db[_0x8bb5('0x76')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0xfa')][_0x8bb5('0x11d')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x8bb5('0x16c')});db['CmList']['hasMany'](db[_0x8bb5('0x123')],{'as':_0x8bb5('0x124'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0xfa')][_0x8bb5('0x11d')](db[_0x8bb5('0x7c')],{'as':_0x8bb5('0x7c'),'foreignKey':'ListId'});db[_0x8bb5('0xfa')][_0x8bb5('0x135')](db[_0x8bb5('0x1c')],{'as':'Queues','through':_0x8bb5('0x15a')});db[_0x8bb5('0xfa')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':'Agents','through':_0x8bb5('0x1f5')});db['VoicePrefix'][_0x8bb5('0x11d')](db[_0x8bb5('0x19')],{'as':_0x8bb5('0x121'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0xfc')]['belongsToMany'](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':_0x8bb5('0x1f6')});db[_0x8bb5('0xfc')]['belongsToMany'](db[_0x8bb5('0xe9')],{'through':_0x8bb5('0x114'),'as':_0x8bb5('0x15c')});db['UserProfile'][_0x8bb5('0x11d')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x175'),'foreignKey':_0x8bb5('0x12f')});db[_0x8bb5('0xfe')][_0x8bb5('0x11d')](db[_0x8bb5('0x100')],{'as':'UserProfileSections','foreignKey':_0x8bb5('0x12f'),'onDelete':'cascade'});db[_0x8bb5('0x100')][_0x8bb5('0x11d')](db[_0x8bb5('0x101')],{'as':_0x8bb5('0x1f7'),'foreignKey':_0x8bb5('0x1f8'),'onDelete':_0x8bb5('0x119')});db['WhatsappAccount'][_0x8bb5('0x11d')](db[_0x8bb5('0x17e')],{'as':_0x8bb5('0x168'),'foreignKey':_0x8bb5('0x1f9'),'onDelete':_0x8bb5('0x119')});db[_0x8bb5('0x105')][_0x8bb5('0x11d')](db[_0x8bb5('0x82')],{'as':_0x8bb5('0x169'),'foreignKey':'WhatsappAccountId'});db[_0x8bb5('0x105')][_0x8bb5('0x11d')](db[_0x8bb5('0x10a')],{'as':_0x8bb5('0x16a'),'foreignKey':_0x8bb5('0x1f9')});db[_0x8bb5('0x105')][_0x8bb5('0x11d')](db['WhatsappInteraction'],{'as':_0x8bb5('0x18c')});db['WhatsappAccount'][_0x8bb5('0x11d')](db[_0x8bb5('0x106')],{'as':_0x8bb5('0x150')});db[_0x8bb5('0x105')]['belongsTo'](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db['WhatsappAccount']['belongsTo'](db[_0x8bb5('0x89')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x8bb5('0x105')][_0x8bb5('0x135')](db['User'],{'as':'Agents','through':_0x8bb5('0x14d')});db[_0x8bb5('0x106')][_0x8bb5('0x12e')](db['User'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8bb5('0x12e')](db['WhatsappQueue'],{'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x106')]['belongsTo'](db[_0x8bb5('0x105')],{'onDelete':_0x8bb5('0x165')});db['WhatsappApplication'][_0x8bb5('0x12e')](db[_0x8bb5('0x87')],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x157')});db[_0x8bb5('0x106')][_0x8bb5('0x12e')](db['Tag'],{'onDelete':_0x8bb5('0x165'),'foreignKey':_0x8bb5('0x17b')});db['WhatsappInteraction'][_0x8bb5('0x11d')](db[_0x8bb5('0x10a')],{'as':_0x8bb5('0x16a'),'onDelete':'cascade','foreignKey':_0x8bb5('0x1fa')});db[_0x8bb5('0x108')][_0x8bb5('0x12e')](db[_0x8bb5('0x105')],{'as':_0x8bb5('0x170'),'foreignKey':_0x8bb5('0x1f9')});db[_0x8bb5('0x108')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x108')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x8bb5('0x108')][_0x8bb5('0x135')](db['Tag'],{'through':_0x8bb5('0x1fb'),'as':_0x8bb5('0x173')});db[_0x8bb5('0x108')]['belongsToMany'](db[_0x8bb5('0x91')],{'through':_0x8bb5('0x1fb'),'as':_0x8bb5('0x174')});db[_0x8bb5('0x108')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':'Users','through':_0x8bb5('0x1fc'),'foreignKey':_0x8bb5('0x1fa')});db[_0x8bb5('0x10a')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':'User'});db[_0x8bb5('0x10a')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'onDelete':_0x8bb5('0x119'),'as':_0x8bb5('0x162')});db[_0x8bb5('0x10a')][_0x8bb5('0x12e')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x8bb5('0x178'),'foreignKey':'WhatsappInteractionId'});db[_0x8bb5('0x10a')][_0x8bb5('0x12e')](db[_0x8bb5('0x105')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db[_0x8bb5('0x105')],{});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db[_0x8bb5('0xfa')],{'as':_0x8bb5('0x16b'),'foreignKey':_0x8bb5('0x16c')});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db[_0x8bb5('0x76')],{'as':_0x8bb5('0x162'),'foreignKey':_0x8bb5('0x17c')});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db[_0x8bb5('0x108')],{});db['WhatsappQueueReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x10f')],{});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db[_0x8bb5('0x10a')],{});db[_0x8bb5('0x1fd')][_0x8bb5('0x12e')](db['User'],{});db[_0x8bb5('0x10d')][_0x8bb5('0x12e')](db[_0x8bb5('0x10a')],{});db[_0x8bb5('0x10d')][_0x8bb5('0x12e')](db[_0x8bb5('0x108')],{});db[_0x8bb5('0x10d')]['belongsTo'](db[_0x8bb5('0x105')],{'foreignKey':_0x8bb5('0x1fe'),'as':'FromAccount'});db['WhatsappTransferReport'][_0x8bb5('0x12e')](db[_0x8bb5('0x105')],{'foreignKey':_0x8bb5('0x1ff'),'as':_0x8bb5('0x1ec')});db[_0x8bb5('0x10d')][_0x8bb5('0x12e')](db[_0x8bb5('0x10f')],{'foreignKey':_0x8bb5('0x200'),'as':_0x8bb5('0x1ea')});db[_0x8bb5('0x10d')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e5'),'as':_0x8bb5('0x1e6')});db[_0x8bb5('0x10d')]['belongsTo'](db[_0x8bb5('0x13')],{'foreignKey':_0x8bb5('0x1e7'),'as':_0x8bb5('0x1e8')});db[_0x8bb5('0x10f')][_0x8bb5('0x135')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x15b'),'through':'UserWhatsappQueue','foreignKey':_0x8bb5('0x201')});db[_0x8bb5('0x10f')]['belongsToMany'](db[_0x8bb5('0xe9')],{'through':'team_has_whatsapp_queues','as':_0x8bb5('0x15c')});db[_0x8bb5('0x11b')][_0x8bb5('0x12e')](db[_0x8bb5('0x13')],{'as':_0x8bb5('0x202'),'foreignKey':_0x8bb5('0x11a'),'onDelete':_0x8bb5('0x119'),'hooks':!![]});db[_0x8bb5('0x111')]['hasOne'](db[_0x8bb5('0xca')],{'as':_0x8bb5('0xca'),'onDelete':_0x8bb5('0x165')});db[_0x8bb5('0x111')]['hasOne'](db[_0x8bb5('0x38')],{'as':_0x8bb5('0x166'),'onDelete':'restrict'});db[_0x8bb5('0x111')]['hasOne'](db[_0x8bb5('0x3a')],{'as':_0x8bb5('0x167'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0b9296a..b276200 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb631=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./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/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.1.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','./errors','./config/environment','setupLoggers','default','then','/api/users','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations'];(function(_0xc0ebd3,_0x30a6ac){var _0x5ac54a=function(_0x56cb42){while(--_0x56cb42){_0xc0ebd3['push'](_0xc0ebd3['shift']());}};_0x5ac54a(++_0x30a6ac);}(_0xb631,0x8a));var _0x1b63=function(_0x49f450,_0x236469){_0x49f450=_0x49f450-0x0;var _0x3253b2=_0xb631[_0x49f450];return _0x3253b2;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x1b63('0x0'));var config=require(_0x1b63('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x1b63('0x2')];var clientSideLogs=require('./api/client-side-logs');exports[_0x1b63('0x3')]=function(_0x5a0818){return setupLoggers(_0x5a0818)[_0x1b63('0x4')](function(){_0x5a0818['use'](_0x1b63('0x5'),require('./api/user'));_0x5a0818[_0x1b63('0x6')]('/api/voice/chanspy',require(_0x1b63('0x7')));_0x5a0818['use'](_0x1b63('0x8'),require(_0x1b63('0x9')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa'),require(_0x1b63('0xb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc'),require(_0x1b63('0xd')));_0x5a0818['use']('/api/voice/queues',require(_0x1b63('0xe')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf'),require(_0x1b63('0x10')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x11'),require(_0x1b63('0x12')));_0x5a0818['use'](_0x1b63('0x13'),require('./api/voiceMail'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x14'),require(_0x1b63('0x15')));_0x5a0818['use']('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5a0818[_0x1b63('0x6')]('/api/voice/dials/reports',require(_0x1b63('0x16')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x17'),require(_0x1b63('0x18')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x19'),require('./api/voiceQueueReport'));_0x5a0818[_0x1b63('0x6')]('/api/members/reports',require('./api/memberReport'));_0x5a0818['use'](_0x1b63('0x1a'),require(_0x1b63('0x1b')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1c'),require(_0x1b63('0x1d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1e'),require('./api/mailServerOut'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x1f'),require(_0x1b63('0x20')));_0x5a0818['use'](_0x1b63('0x21'),require(_0x1b63('0x22')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x23'),require(_0x1b63('0x24')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x25'),require(_0x1b63('0x26')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x27'),require('./api/mailMessage'));_0x5a0818[_0x1b63('0x6')]('/api/mail/applications',require(_0x1b63('0x28')));_0x5a0818['use'](_0x1b63('0x29'),require(_0x1b63('0x2a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x2b'),require('./api/dashboard'));_0x5a0818['use'](_0x1b63('0x2c'),require(_0x1b63('0x2d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x2e'),require(_0x1b63('0x2f')));_0x5a0818['use']('/api/fax/applications',require(_0x1b63('0x30')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x31'),require('./api/faxInteraction'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x32'),require(_0x1b63('0x33')));_0x5a0818['use'](_0x1b63('0x34'),require(_0x1b63('0x35')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x36'),require(_0x1b63('0x37')));_0x5a0818[_0x1b63('0x6')]('/api/sms/accounts',require(_0x1b63('0x38')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x39'),require('./api/smsApplication'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x3a'),require(_0x1b63('0x3b')));_0x5a0818[_0x1b63('0x6')]('/api/sms/messages',require(_0x1b63('0x3c')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x3d'),require(_0x1b63('0x3e')));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/accounts',require(_0x1b63('0x3f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x40'),require(_0x1b63('0x41')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x42'),require(_0x1b63('0x43')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x44'),require(_0x1b63('0x45')));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/queues',require(_0x1b63('0x46')));_0x5a0818['use'](_0x1b63('0x47'),require('./api/chatWebsite'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x48'),require(_0x1b63('0x49')));_0x5a0818['use'](_0x1b63('0x4a'),require('./api/chatApplication'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4b'),require('./api/chatInteraction'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4c'),require(_0x1b63('0x4d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x4e'),require(_0x1b63('0x4f')));_0x5a0818[_0x1b63('0x6')]('/api/chat/queues',require('./api/chatQueue'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x50'),require(_0x1b63('0x51')));_0x5a0818[_0x1b63('0x6')]('/api/chat/proactive_actions',require(_0x1b63('0x52')));_0x5a0818['use']('/api/cm/companies',require(_0x1b63('0x53')));_0x5a0818['use'](_0x1b63('0x54'),require(_0x1b63('0x55')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x56'),require(_0x1b63('0x57')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x58'),require(_0x1b63('0x59')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5a'),require(_0x1b63('0x5b')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5c'),require(_0x1b63('0x5d')));_0x5a0818[_0x1b63('0x6')]('/api/cm/custom_fields',require(_0x1b63('0x5e')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x5f'),require(_0x1b63('0x60')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x61'),require(_0x1b63('0x62')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x63'),require('./api/cannedAnswer'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x64'),require('./api/disposition'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x65'),require(_0x1b63('0x66')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x67'),require(_0x1b63('0x68')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x69'),require(_0x1b63('0x6a')));_0x5a0818['use'](_0x1b63('0x6b'),require('./api/cdr'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x6c'),require('./api/voiceQueuesLog'));_0x5a0818['use'](_0x1b63('0x6d'),require(_0x1b63('0x6e')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x6f'),require(_0x1b63('0x70')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x71'),require(_0x1b63('0x72')));_0x5a0818[_0x1b63('0x6')]('/api/contact_item_types',require(_0x1b63('0x73')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x74'),require(_0x1b63('0x75')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x76'),require('./api/cmHopperAdditionalPhone'));_0x5a0818['use'](_0x1b63('0x77'),require('./api/template'));_0x5a0818[_0x1b63('0x6')]('/api/triggers',require(_0x1b63('0x78')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x79'),require('./api/variable'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x7a'),require(_0x1b63('0x7b')));_0x5a0818['use'](_0x1b63('0x7c'),require(_0x1b63('0x7d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x7e'),require(_0x1b63('0x7f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x80'),require(_0x1b63('0x81')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/extracted_reports',require(_0x1b63('0x82')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x83'),require(_0x1b63('0x84')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/field_reports',require(_0x1b63('0x85')));_0x5a0818[_0x1b63('0x6')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x86'),require(_0x1b63('0x87')));_0x5a0818['use']('/api/integrations/salesforce/configurations',require(_0x1b63('0x88')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x89'),require(_0x1b63('0x8a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8b'),require('./api/intSugarcrmAccount'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8c'),require(_0x1b63('0x8d')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x8e'),require(_0x1b63('0x8f')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x90'),require(_0x1b63('0x91')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x92'),require(_0x1b63('0x93')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x94'),require(_0x1b63('0x95')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x96'),require('./api/intZohoAccount'));_0x5a0818[_0x1b63('0x6')]('/api/integrations/zoho/configurations',require(_0x1b63('0x97')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x98'),require(_0x1b63('0x99')));_0x5a0818[_0x1b63('0x6')]('/api/integrations/zendesk/accounts',require(_0x1b63('0x9a')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x9b'),require(_0x1b63('0x9c')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x9d'),require('./api/intZendeskField'));_0x5a0818['use'](_0x1b63('0x9e'),require(_0x1b63('0x9f')));_0x5a0818['use']('/api/integrations/freshdesk/configurations',require(_0x1b63('0xa0')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa1'),require(_0x1b63('0xa2')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa3'),require(_0x1b63('0xa4')));_0x5a0818['use'](_0x1b63('0xa5'),require(_0x1b63('0xa6')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xa7'),require(_0x1b63('0xa8')));_0x5a0818['use'](_0x1b63('0xa9'),require('./api/intServicenowAccount'));_0x5a0818['use'](_0x1b63('0xaa'),require(_0x1b63('0xab')));_0x5a0818[_0x1b63('0x6')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xac'),require(_0x1b63('0xad')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xae'),require(_0x1b63('0xaf')));_0x5a0818['use'](_0x1b63('0xb0'),require('./api/intDynamics365Field'));_0x5a0818[_0x1b63('0x6')]('/api/integrations/freshsales/accounts',require(_0x1b63('0xb1')));_0x5a0818['use'](_0x1b63('0xb2'),require('./api/intFreshsalesConfiguration'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xb3'),require(_0x1b63('0xb4')));_0x5a0818[_0x1b63('0x6')]('/api/networks',require(_0x1b63('0xb5')));_0x5a0818[_0x1b63('0x6')]('/api/chat/reports/queue',require(_0x1b63('0xb6')));_0x5a0818['use'](_0x1b63('0xb7'),require(_0x1b63('0xb8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xb9'),require('./api/jscriptyAnswerReport'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xba'),require(_0x1b63('0xbb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xbc'),require(_0x1b63('0xbd')));_0x5a0818['use'](_0x1b63('0xbe'),require(_0x1b63('0xbf')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc0'),require(_0x1b63('0xc1')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc2'),require(_0x1b63('0xc3')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc4'),require('./api/jscriptyProject'));_0x5a0818[_0x1b63('0x6')]('/api/settings',require('./api/setting'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc5'),require(_0x1b63('0xc6')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc7'),require(_0x1b63('0xc8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xc9'),require(_0x1b63('0xca')));_0x5a0818[_0x1b63('0x6')]('/api/square/messages',require(_0x1b63('0xcb')));_0x5a0818[_0x1b63('0x6')]('/api/teams',require(_0x1b63('0xcc')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xcd'),require(_0x1b63('0xce')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xcf'),require(_0x1b63('0xd0')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd1'),require(_0x1b63('0xd2')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd3'),require('./api/attachment'));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd4'),require('./api/plugin'));_0x5a0818[_0x1b63('0x6')]('/api/mail/reports/transfer',require(_0x1b63('0xd5')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd6'),require(_0x1b63('0xd7')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xd8'),require('./api/faxTransferReport'));_0x5a0818[_0x1b63('0x6')]('/api/openchannel/reports/transfer',require(_0x1b63('0xd9')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xda'),require(_0x1b63('0xdb')));_0x5a0818['use'](_0x1b63('0xdc'),require(_0x1b63('0xdd')));_0x5a0818['use'](_0x1b63('0xde'),require(_0x1b63('0xdf')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe0'),require(_0x1b63('0xe1')));_0x5a0818['use'](_0x1b63('0xe2'),require(_0x1b63('0xe3')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe4'),require(_0x1b63('0xe5')));_0x5a0818[_0x1b63('0x6')]('/api/userNotifications',require('./api/userNotification'));_0x5a0818[_0x1b63('0x6')]('/api/whatsapp/accounts',require(_0x1b63('0xe6')));_0x5a0818['use'](_0x1b63('0xe7'),require(_0x1b63('0xe8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xe9'),require(_0x1b63('0xea')));_0x5a0818[_0x1b63('0x6')]('/api/whatsapp/messages',require(_0x1b63('0xeb')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xec'),require(_0x1b63('0xed')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xee'),require(_0x1b63('0xef')));_0x5a0818['use'](_0x1b63('0xf0'),require(_0x1b63('0xf1')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf2'),require(_0x1b63('0xf3')));_0x5a0818['use'](_0x1b63('0xf4'),require(_0x1b63('0xf5')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf6'),require(_0x1b63('0xf7')));_0x5a0818[_0x1b63('0x6')]('/api/auth/local',require(_0x1b63('0xf8')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xf9'),require(_0x1b63('0xfa')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xfb'),require(_0x1b63('0xfc')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xfd'),require(_0x1b63('0xfe')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0xff'),require(_0x1b63('0x100')));_0x5a0818['use'](_0x1b63('0x101'),require(_0x1b63('0x102')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x103'),require(_0x1b63('0x104')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x105'),require(_0x1b63('0x106')));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x107'),require('./api/webbar'));_0x5a0818['use'](_0x1b63('0x108'),clientSideLogs);_0x5a0818['use'](_0x1b63('0x109'),express[_0x1b63('0x10a')](path['join'](config['root'],_0x1b63('0x109'))));_0x5a0818['use']('/www',express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],_0x1b63('0x10d'))));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x10e'),express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],_0x1b63('0x10e'))));_0x5a0818[_0x1b63('0x6')](_0x1b63('0x10f'),express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config[_0x1b63('0x10c')],'snippet',_0x1b63('0x110'))));_0x5a0818['use']('/plugins',express[_0x1b63('0x10a')](path[_0x1b63('0x10b')](config['root'],_0x1b63('0x111'))));_0x5a0818['route'](_0x1b63('0x112'))[_0x1b63('0x113')](errors[0x194]);_0x5a0818['route']('/*')[_0x1b63('0x113')](function(_0xf4b1d5,_0x59965a){_0x59965a[_0x1b63('0x114')](path[_0x1b63('0x115')](_0x5a0818[_0x1b63('0x113')]('appPath')+_0x1b63('0x116')));});return _0x5a0818;});}; \ No newline at end of file +var _0x422e=['/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/queues','./api/smsQueue','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','/api/cdr','./api/cdr','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/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/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','/www','join','root','/demo','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication'];(function(_0x581156,_0x404966){var _0x1569a1=function(_0x141150){while(--_0x141150){_0x581156['push'](_0x581156['shift']());}};_0x1569a1(++_0x404966);}(_0x422e,0xdd));var _0xe422=function(_0x19ca14,_0x49dc2c){_0x19ca14=_0x19ca14-0x0;var _0x9f2249=_0x422e[_0x19ca14];return _0x9f2249;};'use strict';var path=require(_0xe422('0x0'));var express=require('express');var errors=require(_0xe422('0x1'));var config=require(_0xe422('0x2'));var setupLoggers=require(_0xe422('0x3'))['setupLoggers'];var clientSideLogs=require(_0xe422('0x4'));exports[_0xe422('0x5')]=function(_0x5138fe){return setupLoggers(_0x5138fe)[_0xe422('0x6')](function(){_0x5138fe[_0xe422('0x7')](_0xe422('0x8'),require(_0xe422('0x9')));_0x5138fe['use'](_0xe422('0xa'),require(_0xe422('0xb')));_0x5138fe['use']('/api/voice/contexts',require(_0xe422('0xc')));_0x5138fe[_0xe422('0x7')](_0xe422('0xd'),require(_0xe422('0xe')));_0x5138fe[_0xe422('0x7')]('/api/voice/mohs',require(_0xe422('0xf')));_0x5138fe[_0xe422('0x7')](_0xe422('0x10'),require('./api/voiceQueue'));_0x5138fe['use']('/api/voice/recordings',require(_0xe422('0x11')));_0x5138fe[_0xe422('0x7')](_0xe422('0x12'),require(_0xe422('0x13')));_0x5138fe[_0xe422('0x7')](_0xe422('0x14'),require(_0xe422('0x15')));_0x5138fe[_0xe422('0x7')]('/api/voice/mails/messages',require(_0xe422('0x16')));_0x5138fe[_0xe422('0x7')](_0xe422('0x17'),require(_0xe422('0x18')));_0x5138fe[_0xe422('0x7')](_0xe422('0x19'),require(_0xe422('0x1a')));_0x5138fe['use'](_0xe422('0x1b'),require(_0xe422('0x1c')));_0x5138fe[_0xe422('0x7')](_0xe422('0x1d'),require(_0xe422('0x1e')));_0x5138fe[_0xe422('0x7')]('/api/members/reports',require(_0xe422('0x1f')));_0x5138fe['use'](_0xe422('0x20'),require(_0xe422('0x21')));_0x5138fe['use']('/api/voice/transfers/reports',require(_0xe422('0x22')));_0x5138fe['use'](_0xe422('0x23'),require('./api/mailServerOut'));_0x5138fe[_0xe422('0x7')]('/api/mail/accounts',require('./api/mailAccount'));_0x5138fe[_0xe422('0x7')](_0xe422('0x24'),require('./api/mailQueue'));_0x5138fe[_0xe422('0x7')]('/api/mail/substatuses',require(_0xe422('0x25')));_0x5138fe['use'](_0xe422('0x26'),require('./api/mailInteraction'));_0x5138fe[_0xe422('0x7')](_0xe422('0x27'),require(_0xe422('0x28')));_0x5138fe[_0xe422('0x7')](_0xe422('0x29'),require(_0xe422('0x2a')));_0x5138fe['use'](_0xe422('0x2b'),require(_0xe422('0x2c')));_0x5138fe[_0xe422('0x7')](_0xe422('0x2d'),require(_0xe422('0x2e')));_0x5138fe[_0xe422('0x7')](_0xe422('0x2f'),require(_0xe422('0x30')));_0x5138fe[_0xe422('0x7')](_0xe422('0x31'),require(_0xe422('0x32')));_0x5138fe[_0xe422('0x7')](_0xe422('0x33'),require('./api/faxApplication'));_0x5138fe['use'](_0xe422('0x34'),require(_0xe422('0x35')));_0x5138fe[_0xe422('0x7')](_0xe422('0x36'),require('./api/faxMessage'));_0x5138fe[_0xe422('0x7')](_0xe422('0x37'),require(_0xe422('0x38')));_0x5138fe[_0xe422('0x7')](_0xe422('0x39'),require(_0xe422('0x3a')));_0x5138fe[_0xe422('0x7')](_0xe422('0x3b'),require(_0xe422('0x3c')));_0x5138fe[_0xe422('0x7')](_0xe422('0x3d'),require(_0xe422('0x3e')));_0x5138fe[_0xe422('0x7')](_0xe422('0x3f'),require('./api/smsInteraction'));_0x5138fe[_0xe422('0x7')]('/api/sms/messages',require('./api/smsMessage'));_0x5138fe['use'](_0xe422('0x40'),require(_0xe422('0x41')));_0x5138fe[_0xe422('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x5138fe[_0xe422('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x5138fe['use'](_0xe422('0x42'),require('./api/openchannelInteraction'));_0x5138fe[_0xe422('0x7')]('/api/openchannel/messages',require(_0xe422('0x43')));_0x5138fe[_0xe422('0x7')](_0xe422('0x44'),require(_0xe422('0x45')));_0x5138fe[_0xe422('0x7')]('/api/chat/websites',require(_0xe422('0x46')));_0x5138fe[_0xe422('0x7')](_0xe422('0x47'),require(_0xe422('0x48')));_0x5138fe[_0xe422('0x7')](_0xe422('0x49'),require(_0xe422('0x4a')));_0x5138fe[_0xe422('0x7')](_0xe422('0x4b'),require(_0xe422('0x4c')));_0x5138fe[_0xe422('0x7')](_0xe422('0x4d'),require(_0xe422('0x4e')));_0x5138fe[_0xe422('0x7')]('/api/chat/offline_messages',require(_0xe422('0x4f')));_0x5138fe[_0xe422('0x7')]('/api/chat/queues',require(_0xe422('0x50')));_0x5138fe[_0xe422('0x7')](_0xe422('0x51'),require(_0xe422('0x52')));_0x5138fe[_0xe422('0x7')]('/api/chat/proactive_actions',require(_0xe422('0x53')));_0x5138fe[_0xe422('0x7')]('/api/cm/companies',require(_0xe422('0x54')));_0x5138fe[_0xe422('0x7')](_0xe422('0x55'),require(_0xe422('0x56')));_0x5138fe[_0xe422('0x7')]('/api/cm/hopper',require(_0xe422('0x57')));_0x5138fe['use'](_0xe422('0x58'),require(_0xe422('0x59')));_0x5138fe[_0xe422('0x7')](_0xe422('0x5a'),require(_0xe422('0x5b')));_0x5138fe[_0xe422('0x7')]('/api/cm/hopper_history',require(_0xe422('0x5c')));_0x5138fe['use'](_0xe422('0x5d'),require('./api/cmCustomField'));_0x5138fe[_0xe422('0x7')](_0xe422('0x5e'),require(_0xe422('0x5f')));_0x5138fe[_0xe422('0x7')](_0xe422('0x60'),require(_0xe422('0x61')));_0x5138fe['use'](_0xe422('0x62'),require(_0xe422('0x63')));_0x5138fe[_0xe422('0x7')](_0xe422('0x64'),require(_0xe422('0x65')));_0x5138fe[_0xe422('0x7')](_0xe422('0x66'),require(_0xe422('0x67')));_0x5138fe[_0xe422('0x7')](_0xe422('0x68'),require('./api/interval'));_0x5138fe['use']('/api/pauses',require(_0xe422('0x69')));_0x5138fe[_0xe422('0x7')](_0xe422('0x6a'),require(_0xe422('0x6b')));_0x5138fe[_0xe422('0x7')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x5138fe[_0xe422('0x7')](_0xe422('0x6c'),require('./api/schedule'));_0x5138fe[_0xe422('0x7')](_0xe422('0x6d'),require('./api/sound'));_0x5138fe['use'](_0xe422('0x6e'),require(_0xe422('0x6f')));_0x5138fe[_0xe422('0x7')](_0xe422('0x70'),require(_0xe422('0x71')));_0x5138fe['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x5138fe[_0xe422('0x7')](_0xe422('0x72'),require(_0xe422('0x73')));_0x5138fe['use'](_0xe422('0x74'),require(_0xe422('0x75')));_0x5138fe[_0xe422('0x7')](_0xe422('0x76'),require(_0xe422('0x77')));_0x5138fe['use'](_0xe422('0x78'),require('./api/variable'));_0x5138fe[_0xe422('0x7')](_0xe422('0x79'),require(_0xe422('0x7a')));_0x5138fe[_0xe422('0x7')](_0xe422('0x7b'),require(_0xe422('0x7c')));_0x5138fe[_0xe422('0x7')](_0xe422('0x7d'),require(_0xe422('0x7e')));_0x5138fe['use'](_0xe422('0x7f'),require(_0xe422('0x80')));_0x5138fe['use']('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x5138fe['use']('/api/analytics/metrics',require(_0xe422('0x81')));_0x5138fe[_0xe422('0x7')](_0xe422('0x82'),require('./api/analyticFieldReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0x83'),require('./api/analyticTreeReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0x84'),require(_0xe422('0x85')));_0x5138fe['use'](_0xe422('0x86'),require('./api/intSalesforceConfiguration'));_0x5138fe[_0xe422('0x7')]('/api/integrations/salesforce/fields',require(_0xe422('0x87')));_0x5138fe[_0xe422('0x7')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x5138fe[_0xe422('0x7')](_0xe422('0x88'),require(_0xe422('0x89')));_0x5138fe['use'](_0xe422('0x8a'),require(_0xe422('0x8b')));_0x5138fe['use'](_0xe422('0x8c'),require(_0xe422('0x8d')));_0x5138fe[_0xe422('0x7')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x5138fe['use'](_0xe422('0x8e'),require('./api/intDeskField'));_0x5138fe[_0xe422('0x7')]('/api/integrations/zoho/accounts',require(_0xe422('0x8f')));_0x5138fe['use'](_0xe422('0x90'),require(_0xe422('0x91')));_0x5138fe[_0xe422('0x7')](_0xe422('0x92'),require(_0xe422('0x93')));_0x5138fe['use'](_0xe422('0x94'),require(_0xe422('0x95')));_0x5138fe[_0xe422('0x7')](_0xe422('0x96'),require(_0xe422('0x97')));_0x5138fe[_0xe422('0x7')](_0xe422('0x98'),require(_0xe422('0x99')));_0x5138fe['use'](_0xe422('0x9a'),require('./api/intFreshdeskAccount'));_0x5138fe['use']('/api/integrations/freshdesk/configurations',require(_0xe422('0x9b')));_0x5138fe[_0xe422('0x7')](_0xe422('0x9c'),require(_0xe422('0x9d')));_0x5138fe[_0xe422('0x7')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x5138fe[_0xe422('0x7')](_0xe422('0x9e'),require(_0xe422('0x9f')));_0x5138fe[_0xe422('0x7')](_0xe422('0xa0'),require('./api/intVtigerField'));_0x5138fe[_0xe422('0x7')](_0xe422('0xa1'),require(_0xe422('0xa2')));_0x5138fe[_0xe422('0x7')](_0xe422('0xa3'),require(_0xe422('0xa4')));_0x5138fe[_0xe422('0x7')](_0xe422('0xa5'),require(_0xe422('0xa6')));_0x5138fe[_0xe422('0x7')]('/api/integrations/dynamics365/accounts',require(_0xe422('0xa7')));_0x5138fe[_0xe422('0x7')](_0xe422('0xa8'),require(_0xe422('0xa9')));_0x5138fe[_0xe422('0x7')](_0xe422('0xaa'),require(_0xe422('0xab')));_0x5138fe[_0xe422('0x7')](_0xe422('0xac'),require(_0xe422('0xad')));_0x5138fe['use'](_0xe422('0xae'),require(_0xe422('0xaf')));_0x5138fe[_0xe422('0x7')](_0xe422('0xb0'),require(_0xe422('0xb1')));_0x5138fe[_0xe422('0x7')](_0xe422('0xb2'),require(_0xe422('0xb3')));_0x5138fe['use']('/api/chat/reports/queue',require(_0xe422('0xb4')));_0x5138fe[_0xe422('0x7')](_0xe422('0xb5'),require(_0xe422('0xb6')));_0x5138fe[_0xe422('0x7')](_0xe422('0xb7'),require(_0xe422('0xb8')));_0x5138fe[_0xe422('0x7')](_0xe422('0xb9'),require(_0xe422('0xba')));_0x5138fe[_0xe422('0x7')]('/api/jscripty/sessions/reports',require(_0xe422('0xbb')));_0x5138fe['use'](_0xe422('0xbc'),require('./api/smsQueueReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0xbd'),require('./api/squareReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0xbe'),require(_0xe422('0xbf')));_0x5138fe[_0xe422('0x7')](_0xe422('0xc0'),require('./api/jscriptyProject'));_0x5138fe['use'](_0xe422('0xc1'),require(_0xe422('0xc2')));_0x5138fe[_0xe422('0x7')](_0xe422('0xc3'),require('./api/squareOdbc'));_0x5138fe[_0xe422('0x7')](_0xe422('0xc4'),require(_0xe422('0xc5')));_0x5138fe['use'](_0xe422('0xc6'),require(_0xe422('0xc7')));_0x5138fe[_0xe422('0x7')]('/api/square/messages',require(_0xe422('0xc8')));_0x5138fe['use'](_0xe422('0xc9'),require(_0xe422('0xca')));_0x5138fe[_0xe422('0x7')]('/api/license',require(_0xe422('0xcb')));_0x5138fe['use'](_0xe422('0xcc'),require('./api/campaign'));_0x5138fe[_0xe422('0x7')]('/api/migrations',require(_0xe422('0xcd')));_0x5138fe[_0xe422('0x7')](_0xe422('0xce'),require(_0xe422('0xcf')));_0x5138fe[_0xe422('0x7')](_0xe422('0xd0'),require(_0xe422('0xd1')));_0x5138fe['use'](_0xe422('0xd2'),require('./api/mailTransferReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0xd3'),require(_0xe422('0xd4')));_0x5138fe[_0xe422('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x5138fe['use'](_0xe422('0xd5'),require('./api/openchannelTransferReport'));_0x5138fe[_0xe422('0x7')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0xd6'),require('./api/cmList'));_0x5138fe[_0xe422('0x7')](_0xe422('0xd7'),require('./api/voicePrefix'));_0x5138fe['use'](_0xe422('0xd8'),require('./api/userProfile'));_0x5138fe[_0xe422('0x7')](_0xe422('0xd9'),require(_0xe422('0xda')));_0x5138fe['use'](_0xe422('0xdb'),require(_0xe422('0xdc')));_0x5138fe[_0xe422('0x7')]('/api/userNotifications',require(_0xe422('0xdd')));_0x5138fe[_0xe422('0x7')](_0xe422('0xde'),require(_0xe422('0xdf')));_0x5138fe[_0xe422('0x7')](_0xe422('0xe0'),require('./api/whatsappApplication'));_0x5138fe['use']('/api/whatsapp/interactions',require(_0xe422('0xe1')));_0x5138fe['use'](_0xe422('0xe2'),require(_0xe422('0xe3')));_0x5138fe[_0xe422('0x7')](_0xe422('0xe4'),require('./api/whatsappQueueReport'));_0x5138fe[_0xe422('0x7')](_0xe422('0xe5'),require(_0xe422('0xe6')));_0x5138fe['use'](_0xe422('0xe7'),require(_0xe422('0xe8')));_0x5138fe[_0xe422('0x7')](_0xe422('0xe9'),require(_0xe422('0xea')));_0x5138fe[_0xe422('0x7')](_0xe422('0xeb'),require(_0xe422('0xec')));_0x5138fe[_0xe422('0x7')]('/api/user-settings',require('./api/user-setting'));_0x5138fe[_0xe422('0x7')]('/api/auth/local',require(_0xe422('0xed')));_0x5138fe[_0xe422('0x7')](_0xe422('0xee'),require(_0xe422('0xef')));_0x5138fe['use'](_0xe422('0xf0'),require('./api/authActiveDirectory'));_0x5138fe[_0xe422('0x7')](_0xe422('0xf1'),require('./api/jira'));_0x5138fe[_0xe422('0x7')]('/api/rpc',require(_0xe422('0xf2')));_0x5138fe[_0xe422('0x7')]('/api/version',require(_0xe422('0xf3')));_0x5138fe[_0xe422('0x7')](_0xe422('0xf4'),require(_0xe422('0xf5')));_0x5138fe[_0xe422('0x7')]('/api/pm2',require(_0xe422('0xf6')));_0x5138fe['use'](_0xe422('0xf7'),require(_0xe422('0xf8')));_0x5138fe['use'](_0xe422('0xf9'),clientSideLogs);_0x5138fe[_0xe422('0x7')](_0xe422('0xfa'),express[_0xe422('0xfb')](path['join'](config['root'],_0xe422('0xfa'))));_0x5138fe['use'](_0xe422('0xfc'),express[_0xe422('0xfb')](path['join'](config['root'],_0xe422('0xfc'))));_0x5138fe['use']('/demo',express[_0xe422('0xfb')](path[_0xe422('0xfd')](config[_0xe422('0xfe')],_0xe422('0xff'))));_0x5138fe[_0xe422('0x7')]('/snippet',express[_0xe422('0xfb')](path['join'](config[_0xe422('0xfe')],'snippet',_0xe422('0x100'))));_0x5138fe['use'](_0xe422('0x101'),express['static'](path[_0xe422('0xfd')](config['root'],_0xe422('0x102'))));_0x5138fe[_0xe422('0x103')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x5138fe[_0xe422('0x103')]('/*')[_0xe422('0x104')](function(_0x469c06,_0x1b7d5f){_0x1b7d5f[_0xe422('0x105')](path[_0xe422('0x106')](_0x5138fe[_0xe422('0x104')]('appPath')+_0xe422('0x107')));});return _0x5138fe;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 11416ea..1434e03 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aee=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x35e28d,_0x2bcf66){var _0x2b72d9=function(_0x1689a1){while(--_0x1689a1){_0x35e28d['push'](_0x35e28d['shift']());}};_0x2b72d9(++_0x2bcf66);}(_0x0aee,0x1a3));var _0xe0ae=function(_0x1bbd58,_0x3015e6){_0x1bbd58=_0x1bbd58-0x0;var _0x50fd62=_0x0aee[_0x1bbd58];return _0x50fd62;};'use strict';var jayson=require(_0xe0ae('0x0'));var _=require('lodash');var config=require(_0xe0ae('0x1'));exports['listen']=function(){return new Promise(function(_0x474185,_0x54aa83){var _0x4be96a={};_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/voiceExtension/voiceExtension.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x4')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x5')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x6')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x7')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x8')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x9')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0xa')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xb')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xc')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xd')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xe')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0xf')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x10')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x11')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x12')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x13')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x14')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x15')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x16')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x17')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x18')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x19')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1a')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x1b')));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsInteraction/smsInteraction.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsMessage/smsMessage.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/smsQueue/smsQueue.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1c')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1d')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x1e')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x1f')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x20')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x21')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x22')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x23')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x24')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x25')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x26')));_0x4be96a=_['merge'](_0x4be96a,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x27')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x28')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x29')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2a')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2b')));_0x4be96a=_['merge'](_0x4be96a,require('../api/trigger/trigger.rpc'));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x2c')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x2d')));_0x4be96a=_['merge'](_0x4be96a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2e')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x2f')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x30')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x31')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x32')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x33')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x34')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareReport/squareReport.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x35')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x36')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareOdbc/squareOdbc.rpc'));_0x4be96a=_['merge'](_0x4be96a,require('../api/squareProject/squareProject.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x37')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/squareMessage/squareMessage.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x38')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x39')));_0x4be96a=_['merge'](_0x4be96a,require(_0xe0ae('0x3a')));_0x4be96a=_['merge'](_0x4be96a,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3b')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3c')));_0x4be96a=_[_0xe0ae('0x2')](_0x4be96a,require(_0xe0ae('0x3d')));var _0x98faa=jayson[_0xe0ae('0x3e')](_0x4be96a)[_0xe0ae('0x3f')]();var _0x511249=config['rpc'][_0xe0ae('0x40')]||config[_0xe0ae('0x40')]+0x1;var _0x529742=config[_0xe0ae('0x41')]['ip']||_0xe0ae('0x42');_0x98faa['on'](_0xe0ae('0x43'),function(_0x4569c6){return _0x54aa83(_0x4569c6);});_0x98faa[_0xe0ae('0x44')](_0x511249,_0x529742,function(){console[_0xe0ae('0x45')](_0xe0ae('0x46'),_0x529742,_0x511249);require('../config/triggers')[_0xe0ae('0x47')]();return _0x474185(_0xe0ae('0x48')+_0x529742+':'+_0x511249);});});}; \ No newline at end of file +var _0x1261=['../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/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc'];(function(_0x410d5b,_0x131b10){var _0x3cf136=function(_0x474389){while(--_0x474389){_0x410d5b['push'](_0x410d5b['shift']());}};_0x3cf136(++_0x131b10);}(_0x1261,0x144));var _0x1126=function(_0x2d582c,_0x424a15){_0x2d582c=_0x2d582c-0x0;var _0x37e92a=_0x1261[_0x2d582c];return _0x37e92a;};'use strict';var jayson=require('jayson/promise');var _=require(_0x1126('0x0'));var config=require(_0x1126('0x1'));exports[_0x1126('0x2')]=function(){return new Promise(function(_0x331a2c,_0x39b786){var _0x350f3a={};_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x4')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x5')));_0x350f3a=_['merge'](_0x350f3a,require('../api/voiceQueue/voiceQueue.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x6')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x7')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x8')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x9')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0xa')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0xb')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0xc')));_0x350f3a=_['merge'](_0x350f3a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0xd')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0xe')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0xf')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x10')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/mailMessage/mailMessage.rpc'));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x11')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x12')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x13')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x14')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x15')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x16')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/faxQueue/faxQueue.rpc'));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x17')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/smsAccount/smsAccount.rpc'));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x18')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x19')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x1a')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x1b')));_0x350f3a=_['merge'](_0x350f3a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x1c')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x1d')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x1e')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/chatInteraction/chatInteraction.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/chatMessage/chatMessage.rpc'));_0x350f3a=_['merge'](_0x350f3a,require('../api/chatQueue/chatQueue.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x1f')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x20')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x21')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x22')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x23')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x24')));_0x350f3a=_['merge'](_0x350f3a,require('../api/interval/interval.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x25')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x26')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/template/template.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/trigger/trigger.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/variable/variable.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x350f3a=_['merge'](_0x350f3a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x27')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x28')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x29')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x2a')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x2b')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x2c')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x2d')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x2e')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x2f')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x30')));_0x350f3a=_['merge'](_0x350f3a,require('../api/squareProject/squareProject.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x31')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x32')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x33')));_0x350f3a=_['merge'](_0x350f3a,require('../api/attachment/attachment.rpc'));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x34')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x35')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x36')));_0x350f3a=_['merge'](_0x350f3a,require(_0x1126('0x37')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x38')));_0x350f3a=_[_0x1126('0x3')](_0x350f3a,require(_0x1126('0x39')));var _0x5746f6=jayson[_0x1126('0x3a')](_0x350f3a)[_0x1126('0x3b')]();var _0x2939a9=config[_0x1126('0x3c')][_0x1126('0x3d')]||config[_0x1126('0x3d')]+0x1;var _0x3052f9=config['rpc']['ip']||_0x1126('0x3e');_0x5746f6['on'](_0x1126('0x3f'),function(_0x227a6b){return _0x39b786(_0x227a6b);});_0x5746f6[_0x1126('0x2')](_0x2939a9,_0x3052f9,function(){console[_0x1126('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3052f9,_0x2939a9);require('../config/triggers')[_0x1126('0x41')]();return _0x331a2c(_0x1126('0x42')+_0x3052f9+':'+_0x2939a9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 630a7cc..9e925fa 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 _0x9802=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','./error','setTimeout','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic'];(function(_0x2f002f,_0xce066a){var _0x42d0df=function(_0x5180a9){while(--_0x5180a9){_0x2f002f['push'](_0x2f002f['shift']());}};_0x42d0df(++_0xce066a);}(_0x9802,0xf6));var _0x2980=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x9802[_0x4a747d];return _0x3a5b5c;};'use strict';var util=require(_0x2980('0x0'));var _=require(_0x2980('0x1'));var EventEmitter=require(_0x2980('0x2'))['EventEmitter'];var AGIReply=require(_0x2980('0x3'));var AGIError=require(_0x2980('0x4'));function AGIChannel(_0x8c8c1e){var _0x21e68f=this,_0x2879d2=new AGIReply(),_0x59f868=![],_0x2bf45d={};EventEmitter['call'](_0x21e68f);_0x8c8c1e['setEncoding']('utf8');_0x8c8c1e[_0x2980('0x5')](0x8*0x3c*0x3c*0x3e8);_0x2879d2[_0x2980('0x6')](_0x2980('0x7'));_0x2879d2['on']('headers',function(_0x44f9d6){for(var _0x114694 in _0x44f9d6){_0x21e68f[_0x114694]=_0x44f9d6[_0x114694];}_0x21e68f[_0x2980('0x8')](_0x2980('0x9'));});_0x2879d2['on'](_0x2980('0xa'),function(_0x222f2f){if(_0x222f2f[_0x2980('0xb')]()==_0x2980('0xc')){_0x21e68f['emit']('hangup');return;}if(_0x222f2f['substring'](0x0,0xb)==_0x2980('0xd')){_0x59f868=!![];}if(_0x59f868){_0x2bf45d['rx']+=_0x222f2f+'\x0a';if(_0x222f2f[_0x2980('0xe')](_0x2980('0xf'))!=-0x1){_0x59f868=![];}}else{_0x2bf45d['rx']=_0x222f2f;}if(_0x59f868){return;}if(typeof _0x2bf45d['cb']==_0x2980('0x10')){var _0x34a13c=_0x2bf45d['rx'][_0x2980('0x11')](0x0,0x3),_0xa259f9=null,_0x4f5f2d=null;_0x34a13c=parseInt(_0x34a13c);if(isNaN(_0x34a13c)){_0x2bf45d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x34a13c!=0xc8){_0x2bf45d['cb'](null,{'code':_0x34a13c,'result':-0x1,'extra':'KO'});return;}_0xa259f9=_0x2bf45d['rx'][_0x2980('0x11')](0x4)[_0x2980('0x12')](_0x2980('0x13'),'');if(_0xa259f9[_0x2980('0x14')]('\x20')!=-0x1){_0xa259f9=_0xa259f9[_0x2980('0x15')](0x0,_0xa259f9[_0x2980('0x14')]('\x20'));}if(_['startsWith'](_0xa259f9,'-1')){_0xa259f9=parseInt(_0xa259f9);}_0x4f5f2d=_0x2bf45d['rx'][_0x2980('0x16')]('\x20');if(_0x4f5f2d[_0x2980('0x17')]==0x3){_0x4f5f2d=_0x4f5f2d[0x2][_0x2980('0x11')](0x1,_0x4f5f2d[0x2]['length']-0x1);}else if(_0x4f5f2d[_0x2980('0x17')]>0x3){var _0x5e5074=/\((.+)\)/;var _0x74d740=_0x2bf45d['rx'][_0x2980('0x18')](_0x5e5074);if(_0x74d740){_0x4f5f2d=_0x74d740[0x1];}else{_0x4f5f2d=null;}}else{_0x4f5f2d=null;}_0x2bf45d['cb'](null,{'code':_0x34a13c,'result':_0xa259f9,'extra':_0x4f5f2d});}});_0x8c8c1e['on'](_0x2980('0x19'),function(_0x1ec2e9){_0x21e68f[_0x2980('0x8')](_0x2980('0x19'),new AGIError(_0x2980('0x1a'),_0x1ec2e9['code']));});_0x8c8c1e['on']('close',function(){_0x21e68f[_0x2980('0x8')](_0x2980('0x1b'),new AGIError(_0x2980('0x1c')));});_0x8c8c1e['on'](_0x2980('0x1d'),function(){_0x21e68f[_0x2980('0x8')](_0x2980('0x1d'),new AGIError(_0x2980('0x1e')));_0x8c8c1e[_0x2980('0x1f')]();});_0x8c8c1e[_0x2980('0x20')](_0x2879d2);this[_0x2980('0x21')]=function(_0x16d8f3,_0x1a37eb){var _0x16d8f3=_0x16d8f3||'',_0x1a37eb=typeof _0x1a37eb=='function'?_0x1a37eb:new Function();_0x2bf45d={'tx':_0x16d8f3,'rx':'','cb':_0x1a37eb};_0x8c8c1e[_0x2980('0x22')](_0x16d8f3+'\x0a');},this['close']=function(){_0x8c8c1e[_0x2980('0x1f')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x2980('0x23')]=function(_0x10b6ae){return this[_0x2980('0x21')]['sync'](this,_0x10b6ae);};AGIChannel[_0x2980('0x24')][_0x2980('0x25')]=function(){return this['sendRequest'](_0x2980('0x26'));};AGIChannel[_0x2980('0x24')][_0x2980('0x27')]=function(_0x98e126,_0x3bbf4a,_0x1e785e){_0x98e126=_0x98e126===undefined?_0x2980('0x28'):_0x98e126;_0x3bbf4a=_0x3bbf4a===undefined?'5':_0x3bbf4a;_0x1e785e=_0x1e785e===undefined?'1':_0x1e785e;return this[_0x2980('0x23')](util[_0x2980('0x29')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x98e126,_0x3bbf4a*0x3e8,_0x1e785e));};AGIChannel[_0x2980('0x24')][_0x2980('0x2a')]=function(_0x77ebd){_0x77ebd=_0x77ebd||_0x2980('0x2b');return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x2c'),_0x77ebd));};AGIChannel[_0x2980('0x24')][_0x2980('0x2d')]=function(_0x12806d,_0x67f072){if(_[_0x2980('0x2e')](_0x67f072)){return this[_0x2980('0x23')](util['format'](_0x2980('0x2f'),_0x12806d,_0x67f072[_0x2980('0x30')](',')));}return this[_0x2980('0x23')](util['format']('EXEC\x20%s\x20%s',_0x12806d,_0x67f072));};AGIChannel['prototype'][_0x2980('0x31')]=function(_0x7eb8e0){return this[_0x2980('0x23')](util[_0x2980('0x29')]('SET\x20CONTEXT\x20%s',_0x7eb8e0));};AGIChannel[_0x2980('0x24')][_0x2980('0x32')]=function(_0x240a83){return this['sendRequest'](util[_0x2980('0x29')](_0x2980('0x33'),_0x240a83));};AGIChannel[_0x2980('0x24')]['setPriority']=function(_0x5ef26a){return this[_0x2980('0x23')](util['format'](_0x2980('0x34'),_0x5ef26a));};AGIChannel[_0x2980('0x24')][_0x2980('0xc')]=function(){return this[_0x2980('0x23')](_0x2980('0x35'));};AGIChannel[_0x2980('0x24')][_0x2980('0x36')]=function(_0x1ab83b,_0x27b73a){var _0x528e12=_['isBoolean'](_0x27b73a)||_[_0x2980('0x37')](_0x27b73a)?_0x27b73a[_0x2980('0x38')]():_0x27b73a;return this['sendRequest'](util['format'](_0x2980('0x39'),_0x1ab83b,_0x528e12?_0x528e12[_0x2980('0x38')]()[_0x2980('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x2980('0x3a')]=function(_0x2a4d8e,_0x159115){return this[_0x2980('0x23')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x2a4d8e,_0x159115));};AGIChannel['prototype'][_0x2980('0x3b')]=function(_0x5714ac,_0x330def){return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x3c'),_0x5714ac,_0x330def));};AGIChannel['prototype'][_0x2980('0x3d')]=function(_0x310956,_0x431354){return this[_0x2980('0x23')](util['format'](_0x2980('0x3e'),_0x310956,_0x431354));};AGIChannel[_0x2980('0x24')][_0x2980('0x3f')]=function(_0x437813,_0x1e24c8,_0x95e279){_0x1e24c8=_0x1e24c8||this[_0x2980('0x40')];_0x95e279=_0x95e279||0x1;this[_0x2980('0x31')](_0x437813);this[_0x2980('0x32')](_0x1e24c8);this[_0x2980('0x41')](_0x95e279);return this['noop'](util[_0x2980('0x29')](_0x2980('0x42'),_0x437813,_0x1e24c8,_0x95e279));};AGIChannel[_0x2980('0x24')][_0x2980('0x43')]=function(_0x12636c){return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x44'),_0x12636c));};AGIChannel['prototype'][_0x2980('0x45')]=function(_0x1decd0,_0x55337d,_0x1d766f,_0x907823,_0x55ba0f,_0x5728e1){_0x55337d=_0x55337d||'wav';_0x1d766f=_0x1d766f||'';_0x907823=_0x907823===undefined?-0x1:_0x907823==='-1'?-0x1:_0x907823*0x3e8;_0x55ba0f=_0x55ba0f===undefined?'':'s='+_0x55ba0f;_0x5728e1=_0x5728e1?_0x2980('0x46'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1decd0,_0x55337d,_0x1d766f,_0x907823,_0x5728e1,_0x55ba0f));};AGIChannel['prototype'][_0x2980('0x47')]=function(_0x6899d8,_0x4bd680){_0x4bd680=_0x4bd680||'';return this[_0x2980('0x23')](util[_0x2980('0x29')](_0x2980('0x48'),_0x6899d8,_0x4bd680));};AGIChannel[_0x2980('0x24')]['agi']=function(_0xa844b3){return this[_0x2980('0x2d')]('AGI',_0xa844b3);};AGIChannel[_0x2980('0x24')][_0x2980('0x49')]=function(_0x2c809a){return this[_0x2980('0x2d')](_0x2980('0x4a'),_0x2c809a);};AGIChannel['prototype'][_0x2980('0x19')]=function(_0x36f495,_0x4a2bd6){this[_0x2980('0x2a')](util[_0x2980('0x29')](_0x2980('0x4b'),_0x36f495['id'],_0x36f495[_0x2980('0x4c')],_0x4a2bd6));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xfea2=['length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','toString','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./error','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','result=','indexOf','substr','startsWith','split'];(function(_0x2bf258,_0x5e0bb2){var _0x3b43af=function(_0x2c40af){while(--_0x2c40af){_0x2bf258['push'](_0x2bf258['shift']());}};_0x3b43af(++_0x5e0bb2);}(_0xfea2,0x117));var _0x2fea=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0xfea2[_0x1501e2];return _0xfce8c5;};'use strict';var util=require('util');var _=require(_0x2fea('0x0'));var EventEmitter=require(_0x2fea('0x1'))[_0x2fea('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x2fea('0x3'));function AGIChannel(_0x25512d){var _0x18dcee=this,_0x686892=new AGIReply(),_0x29a5a6=![],_0x323029={};EventEmitter['call'](_0x18dcee);_0x25512d[_0x2fea('0x4')](_0x2fea('0x5'));_0x25512d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x686892['setEncoding'](_0x2fea('0x5'));_0x686892['on'](_0x2fea('0x6'),function(_0x311e31){for(var _0x4b3bf3 in _0x311e31){_0x18dcee[_0x4b3bf3]=_0x311e31[_0x4b3bf3];}_0x18dcee[_0x2fea('0x7')](_0x2fea('0x8'));});_0x686892['on'](_0x2fea('0x9'),function(_0x5ab0f4){if(_0x5ab0f4[_0x2fea('0xa')]()==_0x2fea('0xb')){_0x18dcee[_0x2fea('0x7')](_0x2fea('0xb'));return;}if(_0x5ab0f4[_0x2fea('0xc')](0x0,0xb)==_0x2fea('0xd')){_0x29a5a6=!![];}if(_0x29a5a6){_0x323029['rx']+=_0x5ab0f4+'\x0a';if(_0x5ab0f4[_0x2fea('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x29a5a6=![];}}else{_0x323029['rx']=_0x5ab0f4;}if(_0x29a5a6){return;}if(typeof _0x323029['cb']==_0x2fea('0xf')){var _0x2909f8=_0x323029['rx']['substring'](0x0,0x3),_0x36e732=null,_0x5762cf=null;_0x2909f8=parseInt(_0x2909f8);if(isNaN(_0x2909f8)){_0x323029['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2909f8!=0xc8){_0x323029['cb'](null,{'code':_0x2909f8,'result':-0x1,'extra':'KO'});return;}_0x36e732=_0x323029['rx'][_0x2fea('0xc')](0x4)['replace'](_0x2fea('0x10'),'');if(_0x36e732[_0x2fea('0x11')]('\x20')!=-0x1){_0x36e732=_0x36e732[_0x2fea('0x12')](0x0,_0x36e732[_0x2fea('0x11')]('\x20'));}if(_[_0x2fea('0x13')](_0x36e732,'-1')){_0x36e732=parseInt(_0x36e732);}_0x5762cf=_0x323029['rx'][_0x2fea('0x14')]('\x20');if(_0x5762cf['length']==0x3){_0x5762cf=_0x5762cf[0x2][_0x2fea('0xc')](0x1,_0x5762cf[0x2][_0x2fea('0x15')]-0x1);}else if(_0x5762cf[_0x2fea('0x15')]>0x3){var _0x56e41e=/\((.+)\)/;var _0x204f75=_0x323029['rx']['match'](_0x56e41e);if(_0x204f75){_0x5762cf=_0x204f75[0x1];}else{_0x5762cf=null;}}else{_0x5762cf=null;}_0x323029['cb'](null,{'code':_0x2909f8,'result':_0x36e732,'extra':_0x5762cf});}});_0x25512d['on']('error',function(_0x43d600){_0x18dcee[_0x2fea('0x7')](_0x2fea('0x16'),new AGIError(_0x2fea('0x17'),_0x43d600[_0x2fea('0x18')]));});_0x25512d['on'](_0x2fea('0x19'),function(){_0x18dcee[_0x2fea('0x7')](_0x2fea('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x25512d['on'](_0x2fea('0x1a'),function(){_0x18dcee[_0x2fea('0x7')](_0x2fea('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x25512d[_0x2fea('0x1b')]();});_0x25512d['pipe'](_0x686892);this[_0x2fea('0x1c')]=function(_0x25303b,_0x1e1041){var _0x25303b=_0x25303b||'',_0x1e1041=typeof _0x1e1041==_0x2fea('0xf')?_0x1e1041:new Function();_0x323029={'tx':_0x25303b,'rx':'','cb':_0x1e1041};_0x25512d[_0x2fea('0x1d')](_0x25303b+'\x0a');},this[_0x2fea('0x19')]=function(){_0x25512d['destroy']();};}util[_0x2fea('0x1e')](AGIChannel,EventEmitter);AGIChannel[_0x2fea('0x1f')][_0x2fea('0x20')]=function(_0x38ee67){return this['command'][_0x2fea('0x21')](this,_0x38ee67);};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x22')]=function(){return this['sendRequest'](_0x2fea('0x23'));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x24')]=function(_0x19848e,_0x3ab743,_0x8ca124){_0x19848e=_0x19848e===undefined?_0x2fea('0x25'):_0x19848e;_0x3ab743=_0x3ab743===undefined?'5':_0x3ab743;_0x8ca124=_0x8ca124===undefined?'1':_0x8ca124;return this[_0x2fea('0x20')](util['format'](_0x2fea('0x26'),_0x19848e,_0x3ab743*0x3e8,_0x8ca124));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x27')]=function(_0x572599){_0x572599=_0x572599||_0x2fea('0x28');return this[_0x2fea('0x20')](util[_0x2fea('0x29')]('VERBOSE\x20\x22%s\x22',_0x572599));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x2a')]=function(_0x5c6e70,_0x50a795){if(_[_0x2fea('0x2b')](_0x50a795)){return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x2c'),_0x5c6e70,_0x50a795[_0x2fea('0x2d')](',')));}return this['sendRequest'](util[_0x2fea('0x29')](_0x2fea('0x2c'),_0x5c6e70,_0x50a795));};AGIChannel['prototype'][_0x2fea('0x2e')]=function(_0xc874b8){return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x2f'),_0xc874b8));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x30')]=function(_0x4d5479){return this['sendRequest'](util[_0x2fea('0x29')](_0x2fea('0x31'),_0x4d5479));};AGIChannel['prototype']['setPriority']=function(_0x177b26){return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x32'),_0x177b26));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0xb')]=function(){return this[_0x2fea('0x20')](_0x2fea('0x33'));};AGIChannel[_0x2fea('0x1f')]['setVariable']=function(_0x3ee555,_0x3ef3e7){var _0x553a12=_[_0x2fea('0x34')](_0x3ef3e7)||_['isNumber'](_0x3ef3e7)?_0x3ef3e7[_0x2fea('0x35')]():_0x3ef3e7;return this[_0x2fea('0x20')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3ee555,_0x553a12?_0x553a12['toString']()[_0x2fea('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2fea('0x1f')]['sayNumber']=function(_0x640b6a,_0x44e8d1){return this[_0x2fea('0x20')](util['format'](_0x2fea('0x37'),_0x640b6a,_0x44e8d1));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x38')]=function(_0x150617,_0x4c7e85){return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x39'),_0x150617,_0x4c7e85));};AGIChannel['prototype'][_0x2fea('0x3a')]=function(_0x1a51b3,_0x18e787){return this[_0x2fea('0x20')](util['format'](_0x2fea('0x3b'),_0x1a51b3,_0x18e787));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x3c')]=function(_0x536a4a,_0x435a5c,_0x2cac1c){_0x435a5c=_0x435a5c||this['extension'];_0x2cac1c=_0x2cac1c||0x1;this[_0x2fea('0x2e')](_0x536a4a);this['setExtension'](_0x435a5c);this['setPriority'](_0x2cac1c);return this[_0x2fea('0x27')](util[_0x2fea('0x29')](_0x2fea('0x3d'),_0x536a4a,_0x435a5c,_0x2cac1c));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x3e')]=function(_0x3c3805){return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x3f'),_0x3c3805));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x40')]=function(_0x319a3b,_0x51e025,_0x460c2b,_0x28220d,_0x250253,_0x1d3e0e){_0x51e025=_0x51e025||_0x2fea('0x41');_0x460c2b=_0x460c2b||'';_0x28220d=_0x28220d===undefined?-0x1:_0x28220d==='-1'?-0x1:_0x28220d*0x3e8;_0x250253=_0x250253===undefined?'':'s='+_0x250253;_0x1d3e0e=_0x1d3e0e?_0x2fea('0x42'):'';return this['sendRequest'](util[_0x2fea('0x29')](_0x2fea('0x43'),_0x319a3b,_0x51e025,_0x460c2b,_0x28220d,_0x1d3e0e,_0x250253));};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x44')]=function(_0x11655a,_0x44843b){_0x44843b=_0x44843b||'';return this[_0x2fea('0x20')](util[_0x2fea('0x29')](_0x2fea('0x45'),_0x11655a,_0x44843b));};AGIChannel[_0x2fea('0x1f')]['agi']=function(_0x4e0f42){return this['exec'](_0x2fea('0x46'),_0x4e0f42);};AGIChannel[_0x2fea('0x1f')][_0x2fea('0x47')]=function(_0x162629){return this[_0x2fea('0x2a')](_0x2fea('0x48'),_0x162629);};AGIChannel['prototype'][_0x2fea('0x16')]=function(_0x21d77a,_0x5f1216){this[_0x2fea('0x27')](util[_0x2fea('0x29')](_0x2fea('0x49'),_0x21d77a['id'],_0x21d77a['label'],_0x5f1216));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2fea('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 887f66d..5fc75cd 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 _0x9b70=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x4497d1,_0x3b9f15){var _0x43cfd4=function(_0x2a6d4f){while(--_0x2a6d4f){_0x4497d1['push'](_0x4497d1['shift']());}};_0x43cfd4(++_0x3b9f15);}(_0x9b70,0x186));var _0x09b7=function(_0x4178d9,_0x457645){_0x4178d9=_0x4178d9-0x0;var _0x4c0932=_0x9b70[_0x4178d9];return _0x4c0932;};'use strict';var util=require(_0x09b7('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x09b7('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x09b7('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x09b7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x09b7('0x4'),'E_AGI_SOCKET_ERROR':_0x09b7('0x5'),'E_AGI_SOCKET_CLOSE':_0x09b7('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x09b7('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x178909){var _0x178909=_0x178909||null,_0x28e167=_0x28e167||[],_0x2938a3=0x1,_0x3becc2='';if(!error[_0x178909]){_0x178909='E_AGI_UNDEFINED';}_0x28e167[_0x09b7('0x8')](error[_0x178909]);while(arguments[_0x2938a3]){_0x28e167[_0x09b7('0x8')](arguments[_0x2938a3]);_0x2938a3++;}_0x3becc2=util[_0x09b7('0x9')][_0x09b7('0xa')](util,_0x28e167);this[_0x09b7('0xb')]=_0x3becc2;this[_0x09b7('0xc')]=_0x178909;}module[_0x09b7('0xd')]=AGIError; \ No newline at end of file +var _0x1537=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x1537,0xdd));var _0x7153=function(_0x381b96,_0x3447a0){_0x381b96=_0x381b96-0x0;var _0x16cb29=_0x1537[_0x381b96];return _0x16cb29;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7153('0x0'),'E_AGI_ARGUMENT_PORT':_0x7153('0x1'),'E_AGI_SERVER_ERROR':_0x7153('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7153('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x7153('0x4'),'E_AGI_SOCKET_ERROR':_0x7153('0x5'),'E_AGI_SOCKET_CLOSE':_0x7153('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7153('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7153('0x8'),'E_AGI_IVR_ENTRY':_0x7153('0x9')};function AGIError(_0x20030c){var _0x20030c=_0x20030c||null,_0x2c62b8=_0x2c62b8||[],_0x360158=0x1,_0x36565e='';if(!error[_0x20030c]){_0x20030c=_0x7153('0xa');}_0x2c62b8[_0x7153('0xb')](error[_0x20030c]);while(arguments[_0x360158]){_0x2c62b8[_0x7153('0xb')](arguments[_0x360158]);_0x360158++;}_0x36565e=util[_0x7153('0xc')][_0x7153('0xd')](util,_0x2c62b8);this[_0x7153('0xe')]=_0x36565e;this[_0x7153('0xf')]=_0x20030c;}module[_0x7153('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 017ac74..54afecc 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 _0x7234=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','EventEmitter','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x7234,0x1da));var _0x4723=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x7234[_0x1b820f];return _0x423354;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x4723('0x0')];var Redis=require('ioredis');var AGIError=require(_0x4723('0x1'));var config=require(_0x4723('0x2'));config[_0x4723('0x3')]=_['defaults'](config[_0x4723('0x3')],{'host':_0x4723('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4723('0x3')]);sub[_0x4723('0x5')](_0x4723('0x6'),function(_0x5db086){if(_0x5db086)return eventEmitter[_0x4723('0x7')](_0x4723('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x5db086));});sub['on'](_0x4723('0x9'),function(_0x3ddeeb,_0x27d10e){if(_0x3ddeeb!==_0x4723('0x6'))return;try{var _0xe5fd95=JSON[_0x4723('0xa')](_0x27d10e);eventEmitter[_0x4723('0x7')](_0x4723('0xb'),_0xe5fd95);}catch(_0x3f4957){eventEmitter[_0x4723('0x7')]('error',new AGIError(_0x4723('0xc'),_0x3f4957));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x9952=['E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','defaults','redis','agi','emit','parse','error'];(function(_0x3a5bc3,_0x5ed1c6){var _0x1a8299=function(_0x30afb3){while(--_0x30afb3){_0x3a5bc3['push'](_0x3a5bc3['shift']());}};_0x1a8299(++_0x5ed1c6);}(_0x9952,0x84));var _0x2995=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x9952[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x2995('0x0'));var EventEmitter=require(_0x2995('0x1'))[_0x2995('0x2')];var Redis=require(_0x2995('0x3'));var AGIError=require(_0x2995('0x4'));var config=require('../../config/environment');config['redis']=_[_0x2995('0x5')](config[_0x2995('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2995('0x6')]);sub['subscribe'](_0x2995('0x7'),function(_0x5da482){if(_0x5da482)return eventEmitter[_0x2995('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x5da482));});sub['on']('message',function(_0x43ee38,_0x3f49ed){if(_0x43ee38!==_0x2995('0x7'))return;try{var _0x436985=JSON[_0x2995('0x9')](_0x3f49ed);eventEmitter[_0x2995('0x8')]('projectUpdate',_0x436985);}catch(_0x5dea2e){eventEmitter['emit'](_0x2995('0xa'),new AGIError(_0x2995('0xb'),_0x5dea2e));}});module[_0x2995('0xc')]={'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 e4ba443..6107ee0 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 _0x0bb6=['no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','relations','traverseBFS','info'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x0bb6,0x159));var _0x60bb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0bb6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x60bb('0x0'));var logger=require(_0x60bb('0x1'))(_0x60bb('0x2'));var verticesWithRetry=[_0x60bb('0x3'),_0x60bb('0x4'),_0x60bb('0x5')];var Graph=function(){this[_0x60bb('0x6')]={};this[_0x60bb('0x7')]={};this[_0x60bb('0x8')]=0x0;};Graph[_0x60bb('0x9')][_0x60bb('0xa')]=function(_0x2a2a42){this[_0x60bb('0x6')][_0x2a2a42['id']]=_0x2a2a42;this[_0x60bb('0x7')][_0x2a2a42['id']]=[];};Graph['prototype']['addEdge']=function(_0x36b283,_0x311e8b,_0x2eaf79){this[_0x60bb('0x7')][_0x36b283][_0x60bb('0xb')]({'target':_0x311e8b,'condition':_0x2eaf79});this[_0x60bb('0x8')]+=0x1;};Graph[_0x60bb('0x9')]['size']=function(){return _['size'](this[_0x60bb('0x6')]);};Graph['prototype'][_0x60bb('0xc')]=function(){return this[_0x60bb('0x8')];};Graph[_0x60bb('0x9')]['getVertex']=function(_0x4531d7){return this[_0x60bb('0x6')][_0x4531d7];};Graph[_0x60bb('0x9')][_0x60bb('0xd')]=function(_0x33dcdc,_0x3301d7){if(!this[_0x60bb('0x6')][_0x33dcdc]){return logger[_0x60bb('0xe')](_0x60bb('0xf'));}var _0x44e586=_0x3301d7(this[_0x60bb('0x6')][_0x33dcdc]);if(!_0x44e586){return logger[_0x60bb('0xe')](_0x60bb('0x10'));}if(this[_0x60bb('0x7')][_0x33dcdc][_0x60bb('0x11')]===0x0){return logger[_0x60bb('0xe')]('no\x20edge/s\x20available');}for(var _0x5de9ce=0x0,_0x4af370=[],_0x23dcb5=![];_0x5de9ce\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','agi_','substring','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','find','handleNotFound','production','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','./server','listening','connection','lodash','../../config/environment','../../config/license/util'];(function(_0x1ffff7,_0x2f9ff6){var _0x49d017=function(_0x1d2483){while(--_0x1d2483){_0x1ffff7['push'](_0x1ffff7['shift']());}};_0x49d017(++_0x2f9ff6);}(_0x2097,0x115));var _0x7209=function(_0x55ecdd,_0x23e592){_0x55ecdd=_0x55ecdd-0x0;var _0x17ee2b=_0x2097[_0x55ecdd];return _0x17ee2b;};'use strict';var _=require(_0x7209('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x7209('0x1'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7209('0x2'));var rpc=require(_0x7209('0x3'));var Project=require(_0x7209('0x4'));var AGIEmitter=require(_0x7209('0x5'))[_0x7209('0x6')];var projects=[];config[_0x7209('0x7')]=_[_0x7209('0x8')](config['agi'],{'ip':_0x7209('0x9'),'port':0x11dd});AGIEmitter['on'](_0x7209('0xa'),projectUpdateHandler);function connectionHandler(_0x84ccd0){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x84ccd0);agiHandler(_0x84ccd0);}catch(_0xf19236){logger['error'](_0xf19236[_0x7209('0xb')]);}});});}function projectUpdateHandler(_0xdb8104){try{var _0x536955=_[_0x7209('0xc')](projects,['id',_0xdb8104['id']]);if(_0x536955>-0x1){if(_0xdb8104[_0x7209('0xd')]===!![]){projects[_0x7209('0xe')](_0x536955,0x1);}else{projects[_0x536955]=_0xdb8104;}}else{projects['push'](_0xdb8104);}}catch(_0x29871f){logger[_0x7209('0xf')](_0x29871f[_0x7209('0xb')]);}}function listeningHandler(){console[_0x7209('0x10')](_0x7209('0x11'),config[_0x7209('0x7')][_0x7209('0x12')]);logger['info'](util[_0x7209('0x13')](_0x7209('0x14'),config[_0x7209('0x7')]['ip'],config[_0x7209('0x7')][_0x7209('0x12')]));}function errorHandler(_0x5a44bb){if(_0x5a44bb&&_0x5a44bb[_0x7209('0x15')]&&_0x5a44bb[_0x7209('0x16')]){logger[_0x7209('0xf')](util[_0x7209('0x13')](_0x7209('0x17'),_0x5a44bb[_0x7209('0x15')],_0x5a44bb[_0x7209('0x16')]));}else{logger[_0x7209('0xf')](util[_0x7209('0x13')](_0x7209('0x18'),_0x5a44bb[_0x7209('0xb')]));}}function closeHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));try{createSquareReport(this);}catch(_0x4e66a3){logger[_0x7209('0xf')](_0x4e66a3[_0x7209('0xb')]);}}function timeoutHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7209('0x1e')],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));}function hangupHandler(){logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x1f'),this[_0x7209('0x1e')],this[_0x7209('0x1a')],this[_0x7209('0x1b')],this[_0x7209('0x1c')],this[_0x7209('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x2f9002,_0x374dd4){rpc[_0x7209('0x20')](_0x2f9002)[_0x7209('0x21')](function(_0x43ce5e){if(_0x374dd4){_0x374dd4(null,_0x43ce5e);}})['catch'](function(_0x5434ac){if(_0x374dd4){_0x374dd4(null,_0x5434ac);}});}function setChannelVariables(_0x5cefcc){for(var _0x2e6c62 in _0x5cefcc){if(_0x5cefcc[_0x7209('0x22')](_0x2e6c62)){if(_0x2e6c62['indexOf'](_0x7209('0x23'))===0x0){_0x5cefcc[_0x2e6c62[_0x7209('0x24')](0x4)]=_0x5cefcc[_0x2e6c62];delete _0x5cefcc[_0x2e6c62];}}}}function agiHandler(_0x1f3a7f){logger['debug']('variables',JSON['stringify'](_0x1f3a7f,null,0x2));logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x25'),_0x1f3a7f[_0x7209('0x1e')],_0x1f3a7f[_0x7209('0x1a')],_0x1f3a7f[_0x7209('0x1b')],_0x1f3a7f[_0x7209('0x1c')],_0x1f3a7f[_0x7209('0x1d')]));_0x1f3a7f['on']('error',errorHandler);_0x1f3a7f['on'](_0x7209('0x26'),closeHandler);_0x1f3a7f['on'](_0x7209('0x27'),timeoutHandler);_0x1f3a7f[_0x7209('0x28')]=![];_0x1f3a7f['on']('hangup',hangupHandler);var _0xd498b0=_[_0x7209('0x29')](projects,['name',_0x1f3a7f[_0x7209('0x1e')]]);if(!_0xd498b0)return Project[_0x7209('0x2a')](_0x1f3a7f);if(!_0xd498b0[_0x7209('0x2b')])return Project['handleUnpublished'](_0x1f3a7f);return Project[_0x7209('0x2c')](_0xd498b0,_0x1f3a7f);}function main(){var _0x30ca44;return utilLicense['getLicense']()['then'](function(_0xa6d06d){if(!_0xa6d06d)return;if(_0xa6d06d[_0x7209('0x2d')]){if(_0xa6d06d[_0x7209('0x2e')]&&_0xa6d06d[_0x7209('0x2e')]>0x0){logger[_0x7209('0x19')](util[_0x7209('0x13')](_0x7209('0x2f'),_0xa6d06d[_0x7209('0x2e')]));_0x30ca44=_0xa6d06d[_0x7209('0x2e')];}else{logger[_0x7209('0x19')](_0x7209('0x30'));}}else{logger['info'](_0x7209('0x31'));_0x30ca44=-0x1;}})[_0x7209('0x21')](function(){return Project[_0x7209('0x32')]();})[_0x7209('0x21')](function(_0x1f58cd){projects=_0x1f58cd;return;})[_0x7209('0x33')](function(_0x4ef3ba){logger[_0x7209('0xf')](_0x7209('0x34'),_0x4ef3ba[_0x7209('0xb')]);})['finally'](function(){var _0x160ded=require(_0x7209('0x35'))(config[_0x7209('0x7')][_0x7209('0x12')],config['agi']['ip'],_0x30ca44);_0x160ded['on'](_0x7209('0xf'),errorHandler);_0x160ded['on'](_0x7209('0x36'),listeningHandler);_0x160ded['on'](_0x7209('0x37'),connectionHandler);_0x160ded['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xa7ac=['[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','stringify','timeout','evtHangup','hangup','find','handleNotFound','production','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','./server','listening','connection','close','lodash','syncho','../../config/environment','./project','./events','EventEmitter','agi','127.0.0.1','projectUpdate','nextTick','error','stack','splice','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','arg_1','callerid'];(function(_0xd25a88,_0x29bdea){var _0x5996a4=function(_0x2571e5){while(--_0x2571e5){_0xd25a88['push'](_0xd25a88['shift']());}};_0x5996a4(++_0x29bdea);}(_0xa7ac,0x1af));var _0xca7a=function(_0x183329,_0x215f8d){_0x183329=_0x183329-0x0;var _0x9ff7e6=_0xa7ac[_0x183329];return _0x9ff7e6;};'use strict';var _=require(_0xca7a('0x0'));var syncho=require(_0xca7a('0x1'));var util=require('util');var config=require(_0xca7a('0x2'));var logger=require('../../config/logger')('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0xca7a('0x3'));var AGIEmitter=require(_0xca7a('0x4'))[_0xca7a('0x5')];var projects=[];config['agi']=_['defaults'](config[_0xca7a('0x6')],{'ip':_0xca7a('0x7'),'port':0x11dd});AGIEmitter['on'](_0xca7a('0x8'),projectUpdateHandler);function connectionHandler(_0x18a944){process[_0xca7a('0x9')](function(){syncho(function(){try{setChannelVariables(_0x18a944);agiHandler(_0x18a944);}catch(_0x1d1667){logger[_0xca7a('0xa')](_0x1d1667[_0xca7a('0xb')]);}});});}function projectUpdateHandler(_0x424457){try{var _0x125f5e=_['findIndex'](projects,['id',_0x424457['id']]);if(_0x125f5e>-0x1){if(_0x424457['deleted']===!![]){projects[_0xca7a('0xc')](_0x125f5e,0x1);}else{projects[_0x125f5e]=_0x424457;}}else{projects['push'](_0x424457);}}catch(_0x1de932){logger[_0xca7a('0xa')](_0x1de932[_0xca7a('0xb')]);}}function listeningHandler(){console[_0xca7a('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xca7a('0x6')]['port']);logger[_0xca7a('0xe')](util[_0xca7a('0xf')](_0xca7a('0x10'),config[_0xca7a('0x6')]['ip'],config[_0xca7a('0x6')][_0xca7a('0x11')]));}function errorHandler(_0x212727){if(_0x212727&&_0x212727[_0xca7a('0x12')]&&_0x212727['message']){logger[_0xca7a('0xa')](util['format'](_0xca7a('0x13'),_0x212727['name'],_0x212727[_0xca7a('0x14')]));}else{logger['error'](util[_0xca7a('0xf')](_0xca7a('0x15'),_0x212727['stack']));}}function closeHandler(){logger['info'](util[_0xca7a('0xf')](_0xca7a('0x16'),this['arg_1'],this[_0xca7a('0x17')],this['callerid'],this[_0xca7a('0x18')],this[_0xca7a('0x19')]));try{createSquareReport(this);}catch(_0x3d1ee9){logger[_0xca7a('0xa')](_0x3d1ee9['stack']);}}function timeoutHandler(){logger[_0xca7a('0xe')](util[_0xca7a('0xf')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xca7a('0x1a')],this[_0xca7a('0x17')],this[_0xca7a('0x1b')],this[_0xca7a('0x18')],this[_0xca7a('0x19')]));}function hangupHandler(){logger[_0xca7a('0xe')](util[_0xca7a('0xf')](_0xca7a('0x1c'),this[_0xca7a('0x1a')],this[_0xca7a('0x17')],this[_0xca7a('0x1b')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x38180b,_0x2677d9){rpc[_0xca7a('0x1d')](_0x38180b)[_0xca7a('0x1e')](function(_0xdbaaa5){if(_0x2677d9){_0x2677d9(null,_0xdbaaa5);}})['catch'](function(_0xdb29a6){if(_0x2677d9){_0x2677d9(null,_0xdb29a6);}});}function setChannelVariables(_0x4677aa){for(var _0x5eb6f4 in _0x4677aa){if(_0x4677aa[_0xca7a('0x1f')](_0x5eb6f4)){if(_0x5eb6f4[_0xca7a('0x20')](_0xca7a('0x21'))===0x0){_0x4677aa[_0x5eb6f4[_0xca7a('0x22')](0x4)]=_0x4677aa[_0x5eb6f4];delete _0x4677aa[_0x5eb6f4];}}}}function agiHandler(_0x308187){logger['debug']('variables',JSON[_0xca7a('0x23')](_0x308187,null,0x2));logger[_0xca7a('0xe')](util[_0xca7a('0xf')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x308187[_0xca7a('0x1a')],_0x308187[_0xca7a('0x17')],_0x308187[_0xca7a('0x1b')],_0x308187['dnid'],_0x308187['uniqueid']));_0x308187['on'](_0xca7a('0xa'),errorHandler);_0x308187['on']('close',closeHandler);_0x308187['on'](_0xca7a('0x24'),timeoutHandler);_0x308187[_0xca7a('0x25')]=![];_0x308187['on'](_0xca7a('0x26'),hangupHandler);var _0x2af64c=_[_0xca7a('0x27')](projects,[_0xca7a('0x12'),_0x308187[_0xca7a('0x1a')]]);if(!_0x2af64c)return Project[_0xca7a('0x28')](_0x308187);if(!_0x2af64c[_0xca7a('0x29')])return Project['handleUnpublished'](_0x308187);return Project['initialize'](_0x2af64c,_0x308187);}function main(){var _0x3417da;return utilLicense['getLicense']()[_0xca7a('0x1e')](function(_0x275aef){if(!_0x275aef)return;if(_0x275aef[_0xca7a('0x2a')]){if(_0x275aef[_0xca7a('0x2b')]&&_0x275aef[_0xca7a('0x2b')]>0x0){logger[_0xca7a('0xe')](util[_0xca7a('0xf')](_0xca7a('0x2c'),_0x275aef[_0xca7a('0x2b')]));_0x3417da=_0x275aef[_0xca7a('0x2b')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xca7a('0xe')](_0xca7a('0x2d'));_0x3417da=-0x1;}})[_0xca7a('0x1e')](function(){return Project['getAll']();})[_0xca7a('0x1e')](function(_0x481be7){projects=_0x481be7;return;})[_0xca7a('0x2e')](function(_0x1c3f39){logger[_0xca7a('0xa')]('[LICENSE]',_0x1c3f39[_0xca7a('0xb')]);})['finally'](function(){var _0xd8e150=require(_0xca7a('0x2f'))(config[_0xca7a('0x6')]['port'],config[_0xca7a('0x6')]['ip'],_0x3417da);_0xd8e150['on'](_0xca7a('0xa'),errorHandler);_0xd8e150['on'](_0xca7a('0x30'),listeningHandler);_0xd8e150['on'](_0xca7a('0x31'),connectionHandler);_0xd8e150['on'](_0xca7a('0x32'),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 aca4503..4a5121a 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 _0x1947=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x16536c,_0x77fb11){var _0x268ab6=function(_0x4a0f7d){while(--_0x4a0f7d){_0x16536c['push'](_0x16536c['shift']());}};_0x268ab6(++_0x77fb11);}(_0x1947,0x76));var _0x7194=function(_0x2a2733,_0x3dfaaf){_0x2a2733=_0x2a2733-0x0;var _0x2c22e5=_0x1947[_0x2a2733];return _0x2c22e5;};'use strict';var BPromise=require(_0x7194('0x0'));var jayson=require(_0x7194('0x1'));var client=jayson['client'][_0x7194('0x2')]({'port':0x232b});function request(_0x138208,_0xcddd47){return new BPromise(function(_0x6d354d,_0x311e5b){return client[_0x7194('0x3')](_0x138208,_0xcddd47)[_0x7194('0x4')](function(_0x5daf80){if(_0x5daf80[_0x7194('0x5')]){return _0x311e5b(_0x5daf80[_0x7194('0x5')][_0x7194('0x6')]);}else{return _0x6d354d(_0x5daf80['result']);}})[_0x7194('0x7')](function(_0x100bcb){return _0x311e5b(_0x100bcb);});});}exports[_0x7194('0x8')]=function(_0x212e50,_0x1ddac1){return request(_0x7194('0x9'),{'account':_0x212e50,'message':_0x1ddac1});}; \ No newline at end of file +var _0xc31e=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0x41badf,_0x1722d1){var _0x3c5f9b=function(_0x514fdf){while(--_0x514fdf){_0x41badf['push'](_0x41badf['shift']());}};_0x3c5f9b(++_0x1722d1);}(_0xc31e,0x188));var _0xec31=function(_0x4ca049,_0x8438d6){_0x4ca049=_0x4ca049-0x0;var _0x162b26=_0xc31e[_0x4ca049];return _0x162b26;};'use strict';var BPromise=require(_0xec31('0x0'));var jayson=require(_0xec31('0x1'));var client=jayson['client'][_0xec31('0x2')]({'port':0x232b});function request(_0x463fce,_0x1ffca1){return new BPromise(function(_0x596198,_0x1c3757){return client[_0xec31('0x3')](_0x463fce,_0x1ffca1)['then'](function(_0x41414e){if(_0x41414e['error']){return _0x1c3757(_0x41414e[_0xec31('0x4')][_0xec31('0x5')]);}else{return _0x596198(_0x41414e['result']);}})[_0xec31('0x6')](function(_0x16b107){return _0x1c3757(_0x16b107);});});}exports[_0xec31('0x7')]=function(_0x2760ef,_0x3b0ef9){return request(_0xec31('0x8'),{'account':_0x2760ef,'message':_0x3b0ef9});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 9e7fcae..b277cd3 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 _0x4aeb=['addEdge','inspect','production','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','traverseBFS','start','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','error','finally','vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','xml2json','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target'];(function(_0x214405,_0x2e9b3e){var _0x41d9ee=function(_0x393042){while(--_0x393042){_0x214405['push'](_0x214405['shift']());}};_0x41d9ee(++_0x2e9b3e);}(_0x4aeb,0x9a));var _0xb4ae=function(_0x56f67a,_0x438db2){_0x56f67a=_0x56f67a-0x0;var _0x472e91=_0x4aeb[_0x56f67a];return _0x472e91;};'use strict';var _=require(_0xb4ae('0x0'));var moment=require('moment');var parser=require(_0xb4ae('0x1'));var util=require('util');var logger=require(_0xb4ae('0x2'))('agi');var rpc=require(_0xb4ae('0x3'));var mailRpc=require(_0xb4ae('0x4'));var Graph=require(_0xb4ae('0x5'));var Vertices=require(_0xb4ae('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb4ae('0x7')]()['catch'](function(_0x450fde){logger['error'](_0xb4ae('0x8'),_0x450fde[_0xb4ae('0x9')]);return[];});}function addVertex(_0x421a5a,_0x5566de,_0x121b46){_0x5566de[_0xb4ae('0xa')]=_0x121b46;if(_0x5566de[_0xb4ae('0xb')]('retry')){_0x5566de['maxRetry']=parseInt(_0x5566de[_0xb4ae('0xc')],0xa);}_0x421a5a[_0xb4ae('0xd')](_[_0xb4ae('0xe')](_0x5566de,_0xb4ae('0xf')));}function initGraph(_0x54245d,_0x344999){var _0x1112f0=new Graph();for(var _0x3fbc73 in _0x54245d){if(_0x54245d[_0xb4ae('0xb')](_0x3fbc73)){if(_[_0xb4ae('0x10')](_0x54245d[_0x3fbc73])){for(var _0x528eac=0x0;_0x528eac<_0x54245d[_0x3fbc73][_0xb4ae('0x11')];_0x528eac+=0x1){addVertex(_0x1112f0,_0x54245d[_0x3fbc73][_0x528eac],_0x3fbc73);}}else{addVertex(_0x1112f0,_0x54245d[_0x3fbc73],_0x3fbc73);}}}for(var _0x1e9b49=0x0;_0x1e9b49<_0x344999[_0xb4ae('0x11')];_0x1e9b49+=0x1){if(_0x344999[_0x1e9b49][_0xb4ae('0x12')]&&_0x344999[_0x1e9b49][_0xb4ae('0x13')]){_0x1112f0[_0xb4ae('0x14')](_0x344999[_0x1e9b49]['source'],_0x344999[_0x1e9b49][_0xb4ae('0x13')],_0x344999[_0x1e9b49]['value']);}}return _0x1112f0;}function getRoot(_0x5c6916){return parser['toJson'](_0x5c6916,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x33bc72){return util[_0xb4ae('0x15')](_0x33bc72,{'showHidden':![],'depth':null});}function initialize(_0x52cb2f,_0x5cc7ad){var _0x4c87c4=getRoot(_0x52cb2f[_0xb4ae('0x16')]);if(!_0x4c87c4||!_0x4c87c4['start'])return;var _0xd84515,_0x13dfc5,_0x1d8f73;logger[_0xb4ae('0x17')](_0xb4ae('0x18'),JSON[_0xb4ae('0x19')](_0x4c87c4,null,0x2));_0x5cc7ad[_0xb4ae('0x1a')]=moment()['format'](_0xb4ae('0x1b'));_0xd84515=initGraph(_[_0xb4ae('0xe')](_0x4c87c4,_0xb4ae('0xf')),_0x4c87c4[_0xb4ae('0xf')]);_0x13dfc5=new Vertices(_0x5cc7ad,rpc,mailRpc);logger['info'](util[_0xb4ae('0x1c')](_0xb4ae('0x1d'),_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad['calleridname'],_0x5cc7ad['callerid'],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad[_0xb4ae('0x20')]));_0xd84515[_0xb4ae('0x21')](_0x4c87c4[_0xb4ae('0x22')]['id'],function(_0x3f7528){try{_0x3f7528=_0x13dfc5['clear'](_0x3f7528);logger['debug']('vertex',JSON[_0xb4ae('0x19')](_0x3f7528,null,0x2));if(_0x3f7528[_0xb4ae('0xa')]===_0xb4ae('0x23')){logger[_0xb4ae('0x24')](_0xb4ae('0x25'));_0x5cc7ad[_0xb4ae('0x26')]=_0x3f7528[_0xb4ae('0x26')]||_0x5cc7ad[_0xb4ae('0x26')];_0x5cc7ad[_0xb4ae('0x27')]=_0x3f7528[_0xb4ae('0x27')];_0x5cc7ad['priority']=_0x3f7528[_0xb4ae('0x28')]?_0x3f7528['priority']-0x1:0x1;return null;}else if(_0x3f7528&&_0x13dfc5[_0x3f7528['agicommand']]){_0x1d8f73=_0x13dfc5[_0x3f7528['agicommand']](_0x3f7528);logger[_0xb4ae('0x24')](_0xb4ae('0x29'),JSON['stringify'](_0x1d8f73,null,0x2));if(_0x1d8f73&&_0x1d8f73[_0xb4ae('0x2a')]===AGI_CODE_SUCCESS&&_0x1d8f73['result']!==AGI_RESULT_ERROR&&!_0x5cc7ad['evtHangup']){logger['debug'](_0xb4ae('0x29'),inspect(_0x1d8f73));return _[_0xb4ae('0x2b')](_0x1d8f73[_0xb4ae('0x2c')])?null:_0x1d8f73['result']['toString']();}else{logger[_0xb4ae('0x2d')](_0xb4ae('0x29'),inspect(_0x1d8f73));return null;}}else{logger[_0xb4ae('0x2d')]('agicommand\x20not\x20found');return null;}}catch(_0x51b434){logger[_0xb4ae('0x2d')](_0x51b434[_0xb4ae('0x9')]);return null;}});if(_0x4c87c4[_0xb4ae('0x2e')]){logger[_0xb4ae('0x24')](util[_0xb4ae('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad['calleridname'],_0x5cc7ad['callerid'],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad['uniqueid']));_0xd84515['traverseBFS'](_0x4c87c4[_0xb4ae('0x2e')]['id'],function(_0x5ac084){try{_0x5ac084=_0x13dfc5['clear'](_0x5ac084);logger[_0xb4ae('0x17')](_0xb4ae('0x2f'),JSON[_0xb4ae('0x19')](_0x5ac084,null,0x2));if(_0x5ac084&&_0x13dfc5[_0x5ac084['agicommand']]){_0x1d8f73=_0x13dfc5[_0x5ac084['agicommand']](_0x5ac084);if(_0x1d8f73){logger['debug'](_0xb4ae('0x29'),inspect(_0x1d8f73));return _[_0xb4ae('0x2b')](_0x1d8f73[_0xb4ae('0x2c')])?null:_0x1d8f73['result'][_0xb4ae('0x30')]();}else{logger[_0xb4ae('0x2d')]('response',inspect(_0x1d8f73));return null;}}else{logger[_0xb4ae('0x2d')](_0xb4ae('0x31'));return null;}}catch(_0x25c38d){logger[_0xb4ae('0x2d')](_0x25c38d[_0xb4ae('0x9')]);return null;}});}logger['info'](util['format'](_0xb4ae('0x32'),_0x5cc7ad[_0xb4ae('0x1e')],_0x5cc7ad[_0xb4ae('0x33')],_0x5cc7ad[_0xb4ae('0x34')],_0x5cc7ad[_0xb4ae('0x1f')],_0x5cc7ad[_0xb4ae('0x20')]));logger[_0xb4ae('0x24')](util[_0xb4ae('0x1c')](_0xb4ae('0x35'),_0x5cc7ad['context'],_0x5cc7ad[_0xb4ae('0x27')],parseInt(_0x5cc7ad[_0xb4ae('0x28')],0xa)+0x1));_0x5cc7ad[_0xb4ae('0x36')](_0x5cc7ad[_0xb4ae('0x26')],_0x5cc7ad['extension'],parseInt(_0x5cc7ad[_0xb4ae('0x28')],0xa)+0x1);_0x5cc7ad['close']();}function handleNotFound(_0x3f33b4){logger['error'](util['format'](_0xb4ae('0x37'),_0x3f33b4[_0xb4ae('0x1e')]));_0x3f33b4[_0xb4ae('0x36')](_0x3f33b4[_0xb4ae('0x26')],_0x3f33b4[_0xb4ae('0x27')],parseInt(_0x3f33b4[_0xb4ae('0x28')],0xa)+0x1);_0x3f33b4[_0xb4ae('0x38')]();}function handleUnpublished(_0x4c2c49){logger[_0xb4ae('0x2d')](util['format'](_0xb4ae('0x39'),_0x4c2c49[_0xb4ae('0x1e')]));_0x4c2c49[_0xb4ae('0x36')](_0x4c2c49[_0xb4ae('0x26')],_0x4c2c49[_0xb4ae('0x27')],parseInt(_0x4c2c49[_0xb4ae('0x28')],0xa)+0x1);_0x4c2c49[_0xb4ae('0x38')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x254e=['mxGraphModel','root','inspect','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result','evtHangup','toString','agicommand\x20not\x20found','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','extension','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','util','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','toJson'];(function(_0x4c627b,_0x591cae){var _0x5c5ebc=function(_0x3bfba2){while(--_0x3bfba2){_0x4c627b['push'](_0x4c627b['shift']());}};_0x5c5ebc(++_0x591cae);}(_0x254e,0x1e1));var _0xe254=function(_0x173099,_0xbd020c){_0x173099=_0x173099-0x0;var _0x1f8836=_0x254e[_0x173099];return _0x1f8836;};'use strict';var _=require('lodash');var moment=require(_0xe254('0x0'));var parser=require('xml2json');var util=require(_0xe254('0x1'));var logger=require('../../config/logger')(_0xe254('0x2'));var rpc=require(_0xe254('0x3'));var mailRpc=require(_0xe254('0x4'));var Graph=require('./graph');var Vertices=require(_0xe254('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe254('0x6')]()[_0xe254('0x7')](function(_0x52b114){logger['error'](_0xe254('0x8'),_0x52b114[_0xe254('0x9')]);return[];});}function addVertex(_0x7ed033,_0x5ba381,_0x1685e8){_0x5ba381[_0xe254('0xa')]=_0x1685e8;if(_0x5ba381[_0xe254('0xb')]('retry')){_0x5ba381[_0xe254('0xc')]=parseInt(_0x5ba381['retry'],0xa);}_0x7ed033[_0xe254('0xd')](_[_0xe254('0xe')](_0x5ba381,_0xe254('0xf')));}function initGraph(_0x251af3,_0x15b883){var _0x4943ae=new Graph();for(var _0x73e907 in _0x251af3){if(_0x251af3['hasOwnProperty'](_0x73e907)){if(_[_0xe254('0x10')](_0x251af3[_0x73e907])){for(var _0x1a1e44=0x0;_0x1a1e44<_0x251af3[_0x73e907][_0xe254('0x11')];_0x1a1e44+=0x1){addVertex(_0x4943ae,_0x251af3[_0x73e907][_0x1a1e44],_0x73e907);}}else{addVertex(_0x4943ae,_0x251af3[_0x73e907],_0x73e907);}}}for(var _0x2737fe=0x0;_0x2737fe<_0x15b883[_0xe254('0x11')];_0x2737fe+=0x1){if(_0x15b883[_0x2737fe][_0xe254('0x12')]&&_0x15b883[_0x2737fe]['target']){_0x4943ae[_0xe254('0x13')](_0x15b883[_0x2737fe][_0xe254('0x12')],_0x15b883[_0x2737fe][_0xe254('0x14')],_0x15b883[_0x2737fe][_0xe254('0x15')]);}}return _0x4943ae;}function getRoot(_0x12579b){return parser[_0xe254('0x16')](_0x12579b,{'object':!![]})[_0xe254('0x17')][_0xe254('0x18')];}function inspect(_0x33859a){return util[_0xe254('0x19')](_0x33859a,{'showHidden':![],'depth':null});}function initialize(_0x20dd30,_0x380d4b){var _0x4a6560=getRoot(_0x20dd30[_0xe254('0x1a')]);if(!_0x4a6560||!_0x4a6560[_0xe254('0x1b')])return;var _0xa0b1b8,_0xe89e24,_0x20bfd6;logger[_0xe254('0x1c')](_0xe254('0x18'),JSON[_0xe254('0x1d')](_0x4a6560,null,0x2));_0x380d4b['joinAt']=moment()[_0xe254('0x1e')](_0xe254('0x1f'));_0xa0b1b8=initGraph(_[_0xe254('0xe')](_0x4a6560,_0xe254('0xf')),_0x4a6560[_0xe254('0xf')]);_0xe89e24=new Vertices(_0x380d4b,rpc,mailRpc);logger[_0xe254('0x20')](util[_0xe254('0x1e')](_0xe254('0x21'),_0x380d4b['arg_1'],_0x380d4b['calleridname'],_0x380d4b[_0xe254('0x22')],_0x380d4b[_0xe254('0x23')],_0x380d4b['uniqueid']));_0xa0b1b8[_0xe254('0x24')](_0x4a6560['start']['id'],function(_0x69b1a5){try{_0x69b1a5=_0xe89e24[_0xe254('0x25')](_0x69b1a5);logger['debug'](_0xe254('0x26'),JSON[_0xe254('0x1d')](_0x69b1a5,null,0x2));if(_0x69b1a5['agicommand']==='gotoc'){logger[_0xe254('0x20')](_0xe254('0x27'));_0x380d4b['context']=_0x69b1a5['context']||_0x380d4b[_0xe254('0x28')];_0x380d4b['extension']=_0x69b1a5['extension'];_0x380d4b['priority']=_0x69b1a5[_0xe254('0x29')]?_0x69b1a5['priority']-0x1:0x1;return null;}else if(_0x69b1a5&&_0xe89e24[_0x69b1a5[_0xe254('0xa')]]){_0x20bfd6=_0xe89e24[_0x69b1a5['agicommand']](_0x69b1a5);logger[_0xe254('0x20')](_0xe254('0x2a'),JSON[_0xe254('0x1d')](_0x20bfd6,null,0x2));if(_0x20bfd6&&_0x20bfd6[_0xe254('0x2b')]===AGI_CODE_SUCCESS&&_0x20bfd6[_0xe254('0x2c')]!==AGI_RESULT_ERROR&&!_0x380d4b[_0xe254('0x2d')]){logger['debug'](_0xe254('0x2a'),inspect(_0x20bfd6));return _['isUndefined'](_0x20bfd6[_0xe254('0x2c')])?null:_0x20bfd6[_0xe254('0x2c')][_0xe254('0x2e')]();}else{logger['error'](_0xe254('0x2a'),inspect(_0x20bfd6));return null;}}else{logger['error'](_0xe254('0x2f'));return null;}}catch(_0x59656b){logger[_0xe254('0x30')](_0x59656b[_0xe254('0x9')]);return null;}});if(_0x4a6560[_0xe254('0x31')]){logger['info'](util['format'](_0xe254('0x32'),_0x380d4b[_0xe254('0x33')],_0x380d4b[_0xe254('0x34')],_0x380d4b['callerid'],_0x380d4b[_0xe254('0x23')],_0x380d4b[_0xe254('0x35')]));_0xa0b1b8[_0xe254('0x24')](_0x4a6560['finally']['id'],function(_0x5e9393){try{_0x5e9393=_0xe89e24['clear'](_0x5e9393);logger[_0xe254('0x1c')](_0xe254('0x26'),JSON[_0xe254('0x1d')](_0x5e9393,null,0x2));if(_0x5e9393&&_0xe89e24[_0x5e9393[_0xe254('0xa')]]){_0x20bfd6=_0xe89e24[_0x5e9393[_0xe254('0xa')]](_0x5e9393);if(_0x20bfd6){logger[_0xe254('0x1c')](_0xe254('0x2a'),inspect(_0x20bfd6));return _[_0xe254('0x36')](_0x20bfd6[_0xe254('0x2c')])?null:_0x20bfd6['result'][_0xe254('0x2e')]();}else{logger[_0xe254('0x30')]('response',inspect(_0x20bfd6));return null;}}else{logger[_0xe254('0x30')](_0xe254('0x2f'));return null;}}catch(_0x1ec9fd){logger[_0xe254('0x30')](_0x1ec9fd[_0xe254('0x9')]);return null;}});}logger[_0xe254('0x20')](util[_0xe254('0x1e')](_0xe254('0x37'),_0x380d4b[_0xe254('0x33')],_0x380d4b['calleridname'],_0x380d4b['callerid'],_0x380d4b[_0xe254('0x23')],_0x380d4b[_0xe254('0x35')]));logger[_0xe254('0x20')](util[_0xe254('0x1e')](_0xe254('0x38'),_0x380d4b[_0xe254('0x28')],_0x380d4b['extension'],parseInt(_0x380d4b[_0xe254('0x29')],0xa)+0x1));_0x380d4b[_0xe254('0x39')](_0x380d4b[_0xe254('0x28')],_0x380d4b[_0xe254('0x3a')],parseInt(_0x380d4b[_0xe254('0x29')],0xa)+0x1);_0x380d4b[_0xe254('0x3b')]();}function handleNotFound(_0x41a2d9){logger[_0xe254('0x30')](util[_0xe254('0x1e')](_0xe254('0x3c'),_0x41a2d9[_0xe254('0x33')]));_0x41a2d9['continueAt'](_0x41a2d9[_0xe254('0x28')],_0x41a2d9['extension'],parseInt(_0x41a2d9[_0xe254('0x29')],0xa)+0x1);_0x41a2d9['close']();}function handleUnpublished(_0x5609b2){logger[_0xe254('0x30')](util[_0xe254('0x1e')](_0xe254('0x3d'),_0x5609b2['arg_1']));_0x5609b2[_0xe254('0x39')](_0x5609b2[_0xe254('0x28')],_0x5609b2[_0xe254('0x3a')],parseInt(_0x5609b2[_0xe254('0x29')],0xa)+0x1);_0x5609b2[_0xe254('0x3b')]();}module[_0xe254('0x3e')]={'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 94bbc2d..7c8ce19 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 _0xe3c9=['emit','headers','_inBody','exports','stream','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','split','indexOf','slice','trim','length'];(function(_0x53115c,_0x4f3917){var _0xbcea2c=function(_0x12253c){while(--_0x12253c){_0x53115c['push'](_0x53115c['shift']());}};_0xbcea2c(++_0x4f3917);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe3c9[_0x1694f5];return _0x5b4321;};'use strict';var util=require('util');var Transform=require(_0x9e3c('0x0'))['Transform'];function AGIReply(_0x23ecbd){Transform[_0x9e3c('0x1')](this,_0x23ecbd);this[_0x9e3c('0x2')]='';this['_inBody']=![];}util[_0x9e3c('0x3')](AGIReply,Transform);AGIReply[_0x9e3c('0x4')][_0x9e3c('0x5')]=function(_0x78dd08,_0x5405dc,_0x344bd1){var _0xd6e54e='\x0a',_0x5347cb=['\x0a\x0a',_0x9e3c('0x6')],_0x1437a0=-0x1,_0x335e99=-0x1,_0x59a631='',_0x3cc670=0x0,_0x53196b='',_0x54fc54='';this[_0x9e3c('0x2')]+=_0x78dd08['toString']();_0x53196b=this[_0x9e3c('0x2')];if(!this['_inBody']){_0x3cc670=0x0;while(_0x5347cb[_0x3cc670]){while((_0x335e99=_0x53196b['indexOf'](_0x5347cb[_0x3cc670]))!=-0x1){_0x59a631=_0x5347cb[_0x3cc670];_0x54fc54=_0x53196b[_0x9e3c('0x7')](0x0,_0x335e99);_0x53196b=_0x53196b[_0x9e3c('0x7')](_0x335e99+_0x59a631['length']);var _0x32a34e=_0x54fc54[_0x9e3c('0x8')](_0xd6e54e),_0xdaf85d=0x0,_0x15c99e={},_0x4bbf17='',_0x29edd0='',_0x9152bf=-0x1;while(_0x32a34e[_0xdaf85d]){_0x9152bf=_0x32a34e[_0xdaf85d][_0x9e3c('0x9')](':');if(_0x9152bf!=-0x1){_0x4bbf17=_0x32a34e[_0xdaf85d]['slice'](0x0,_0x9152bf)['trim']();_0x29edd0=_0x32a34e[_0xdaf85d][_0x9e3c('0xa')](_0x9152bf+0x1)[_0x9e3c('0xb')]();if(_0x4bbf17[_0x9e3c('0xc')]>0x0){_0x15c99e[_0x4bbf17]=_0x29edd0;}}else{}_0xdaf85d++;}this[_0x9e3c('0xd')](_0x9e3c('0xe'),_0x15c99e);this[_0x9e3c('0xf')]=!![];}_0x3cc670++;}this['_localBuffer']=_0x53196b;}else{while((_0x1437a0=_0x53196b[_0x9e3c('0x9')](_0xd6e54e))!=-0x1){_0x54fc54=_0x53196b[_0x9e3c('0x7')](0x0,_0x1437a0);this['emit']('line',_0x54fc54);_0x53196b=_0x53196b['substring'](_0x1437a0+_0xd6e54e[_0x9e3c('0xc')]);}this['_localBuffer']=_0x53196b;}_0x344bd1();};module[_0x9e3c('0x10')]=AGIReply; \ No newline at end of file +var _0x63eb=['indexOf','substring','length','slice','trim','emit','headers','line','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x38d32a,_0x4a37ca){var _0x5a9cb5=function(_0x30a90c){while(--_0x30a90c){_0x38d32a['push'](_0x38d32a['shift']());}};_0x5a9cb5(++_0x4a37ca);}(_0x63eb,0x90));var _0xb63e=function(_0x223a3e,_0x2da798){_0x223a3e=_0x223a3e-0x0;var _0x582005=_0x63eb[_0x223a3e];return _0x582005;};'use strict';var util=require(_0xb63e('0x0'));var Transform=require(_0xb63e('0x1'))[_0xb63e('0x2')];function AGIReply(_0x121675){Transform[_0xb63e('0x3')](this,_0x121675);this[_0xb63e('0x4')]='';this[_0xb63e('0x5')]=![];}util[_0xb63e('0x6')](AGIReply,Transform);AGIReply[_0xb63e('0x7')][_0xb63e('0x8')]=function(_0x217465,_0x2ab252,_0x3d043b){var _0x1c5849='\x0a',_0x456ca3=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xeb9650=-0x1,_0x2f1729=-0x1,_0xe4f423='',_0x199b7b=0x0,_0xf4dcb6='',_0x24efe2='';this[_0xb63e('0x4')]+=_0x217465['toString']();_0xf4dcb6=this[_0xb63e('0x4')];if(!this[_0xb63e('0x5')]){_0x199b7b=0x0;while(_0x456ca3[_0x199b7b]){while((_0x2f1729=_0xf4dcb6[_0xb63e('0x9')](_0x456ca3[_0x199b7b]))!=-0x1){_0xe4f423=_0x456ca3[_0x199b7b];_0x24efe2=_0xf4dcb6['substring'](0x0,_0x2f1729);_0xf4dcb6=_0xf4dcb6[_0xb63e('0xa')](_0x2f1729+_0xe4f423[_0xb63e('0xb')]);var _0x796260=_0x24efe2['split'](_0x1c5849),_0x833a47=0x0,_0x5e46ba={},_0x11c40f='',_0xbc98bd='',_0xa716ba=-0x1;while(_0x796260[_0x833a47]){_0xa716ba=_0x796260[_0x833a47][_0xb63e('0x9')](':');if(_0xa716ba!=-0x1){_0x11c40f=_0x796260[_0x833a47][_0xb63e('0xc')](0x0,_0xa716ba)[_0xb63e('0xd')]();_0xbc98bd=_0x796260[_0x833a47][_0xb63e('0xc')](_0xa716ba+0x1)['trim']();if(_0x11c40f[_0xb63e('0xb')]>0x0){_0x5e46ba[_0x11c40f]=_0xbc98bd;}}else{}_0x833a47++;}this[_0xb63e('0xe')](_0xb63e('0xf'),_0x5e46ba);this[_0xb63e('0x5')]=!![];}_0x199b7b++;}this[_0xb63e('0x4')]=_0xf4dcb6;}else{while((_0xeb9650=_0xf4dcb6['indexOf'](_0x1c5849))!=-0x1){_0x24efe2=_0xf4dcb6[_0xb63e('0xa')](0x0,_0xeb9650);this[_0xb63e('0xe')](_0xb63e('0x10'),_0x24efe2);_0xf4dcb6=_0xf4dcb6[_0xb63e('0xa')](_0xeb9650+_0x1c5849[_0xb63e('0xb')]);}this[_0xb63e('0x4')]=_0xf4dcb6;}_0x3d043b();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index ce799ce..2512b9b 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 _0x864a=['ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','getPauseById','agentLogin','LoginUser','agentUnpause','LogoutUser','lodash','moment','jayson/promise','client','then','error','message','catch','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x864a,0x8a));var _0xa864=function(_0x1f50be,_0x5a3bb4){_0x1f50be=_0x1f50be-0x0;var _0x397f81=_0x864a[_0x1f50be];return _0x397f81;};'use strict';var _=require(_0xa864('0x0'));var moment=require(_0xa864('0x1'));var jayson=require(_0xa864('0x2'));var client=jayson[_0xa864('0x3')]['http']({'port':0x2329});function request(_0x4aba69,_0x4af03c){return new Promise(function(_0xa48455,_0x5b7903){return client['request'](_0x4aba69,_0x4af03c)[_0xa864('0x4')](function(_0xb64fd4){if(_0xb64fd4[_0xa864('0x5')]){return _0x5b7903(_0xb64fd4[_0xa864('0x5')][_0xa864('0x6')]);}else{return _0xa48455(_0xb64fd4['result']);}})[_0xa864('0x7')](function(_0x26c6d9){return _0x5b7903(_0x26c6d9);});});}exports['getSquareProjects']=function(){return request(_0xa864('0x8'),{'options':{'raw':![],'attributes':['id',_0xa864('0x9'),_0xa864('0xa')]}});};exports[_0xa864('0xb')]=function(_0x543f33){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x543f33},'attributes':[_0xa864('0xa')]}});};exports[_0xa864('0xc')]=function(_0x8baed){return request(_0xa864('0xd'),{'options':{'raw':![],'where':{'id':_0x8baed},'include':[{'model':_0xa864('0xe'),'as':_0xa864('0xf'),'include':[{'model':_0xa864('0x10'),'as':_0xa864('0x10')}]}],'attributes':['id',_0xa864('0x9'),_0xa864('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1fe5b2){return request(_0xa864('0x12'),{'options':{'where':{'id':_0x1fe5b2},'attributes':['name']}});};exports[_0xa864('0x13')]=function(_0x6e0430){return request(_0xa864('0x14'),{'options':{'where':{'id':_0x6e0430},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x15')]=function(_0x2aeed5){return request('ShowVariable',{'options':{'where':{'id':_0x2aeed5},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x16')]=function(_0x204fb0){return request(_0xa864('0x17'),{'options':{'where':{'id':_0x204fb0},'attributes':[_0xa864('0x18')]}});};exports[_0xa864('0x19')]=function(_0x2e8336){return request(_0xa864('0x1a'),{'options':{'where':{'id':_0x2e8336},'attributes':['name']}});};exports[_0xa864('0x1b')]=function(_0x40cc6a){return request('GetContactByPhone',{'options':{'where':{'phone':_0x40cc6a[_0xa864('0x1c')]},'attributes':['id']}});};exports[_0xa864('0x1d')]=function(_0x1b3941){return request(_0xa864('0x1e'),{'options':{'where':{'id':_0x1b3941},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x1f')]=function(_0x1f4f08){return request(_0xa864('0x20'),{'options':{'where':{'id':_0x1f4f08},'attributes':[_0xa864('0x21')]}});};exports['getIntervalById']=function(_0xc4c6ce){return request(_0xa864('0x22'),{'options':{'raw':![],'where':{'id':_0xc4c6ce},'include':[{'model':'Interval','as':_0xa864('0x23')}]}});};exports[_0xa864('0x24')]=function(_0x31d019){return request(_0xa864('0x25'),{'options':{'where':{'id':_0x31d019},'attributes':['id',_0xa864('0x9')]}});};exports[_0xa864('0x26')]=function(_0x452be5){return request('CreateSmsMessage',{'body':_0x452be5});};exports[_0xa864('0x27')]=function(_0x22e185){return request('CreateSquareDetailsReport',{'body':_0x22e185});};exports[_0xa864('0x28')]=function(_0x5ad543){return request(_0xa864('0x29'),{'body':_[_0xa864('0x2a')](_0x5ad543,{'project_name':_0x5ad543[_0xa864('0x2b')],'prev_project_name':_0x5ad543['arg_2']||'','is_subproject':_0x5ad543['arg_2']?!![]:![],'leaveAt':moment()[_0xa864('0x2c')](_0xa864('0x2d'))})});};exports['createSquareRecording']=function(_0x3a0d07){return request(_0xa864('0x2e'),{'body':_0x3a0d07});};exports[_0xa864('0x2f')]=function(_0x28950e){return request(_0xa864('0x30'),{'body':_0x28950e});};exports['createCmContact']=function(_0x4235e8){return request(_0xa864('0x31'),{'options':{'raw':![],'where':{'phone':_0x4235e8['phone'],'ListId':_0x4235e8[_0xa864('0x32')]}}})['then'](function(_0xe3f731){if(_0xe3f731){return _0xe3f731;}return request('CreateCmContact',{'body':_0x4235e8});});};exports[_0xa864('0x33')]=function(_0xa3ce00){return request('ShowPause',{'options':{'where':{'id':_0xa3ce00},'attributes':[_0xa864('0x9')]}});};exports[_0xa864('0x34')]=function(_0xa290,_0x5866df){return request(_0xa864('0x35'),{'body':{'interface':_0x5866df},'options':{'where':_0xa290}});};exports['agentPause']=function(_0x11fc1e,_0x25bc3d,_0x23a7e2){return request('PauseUser',{'body':{'type':_0x25bc3d,'uniqueid':_0x23a7e2},'options':{'where':_0x11fc1e}});};exports[_0xa864('0x36')]=function(_0x48b408){return request('UnpauseUser',{'body':{},'options':{'where':_0x48b408}});};exports['agentLogout']=function(_0x1f38c8){return request(_0xa864('0x37'),{'body':{},'options':{'where':_0x1f38c8}});}; \ No newline at end of file +var _0xee39=['jayson/promise','http','request','then','error','result','catch','GetSquareProjects','production','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xee39,0x1e6));var _0x9ee3=function(_0x4aaaa9,_0x32fc0f){_0x4aaaa9=_0x4aaaa9-0x0;var _0x4b8467=_0xee39[_0x4aaaa9];return _0x4b8467;};'use strict';var _=require(_0x9ee3('0x0'));var moment=require(_0x9ee3('0x1'));var jayson=require(_0x9ee3('0x2'));var client=jayson['client'][_0x9ee3('0x3')]({'port':0x2329});function request(_0x64784f,_0x18357f){return new Promise(function(_0x3cdeaf,_0x2724c7){return client[_0x9ee3('0x4')](_0x64784f,_0x18357f)[_0x9ee3('0x5')](function(_0x603485){if(_0x603485[_0x9ee3('0x6')]){return _0x2724c7(_0x603485[_0x9ee3('0x6')]['message']);}else{return _0x3cdeaf(_0x603485[_0x9ee3('0x7')]);}})[_0x9ee3('0x8')](function(_0x22c8fc){return _0x2724c7(_0x22c8fc);});});}exports['getSquareProjects']=function(){return request(_0x9ee3('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x9ee3('0xa')]}});};exports['getSquareProject']=function(_0x2a5ae7){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x2a5ae7},'attributes':['production']}});};exports[_0x9ee3('0xb')]=function(_0x5d3644){return request(_0x9ee3('0xc'),{'options':{'raw':![],'where':{'id':_0x5d3644},'include':[{'model':'MailServerOut','as':_0x9ee3('0xd'),'include':[{'model':_0x9ee3('0xe'),'as':_0x9ee3('0xe')}]}],'attributes':['id',_0x9ee3('0xf'),_0x9ee3('0x10')],'smtp':!![]}});};exports[_0x9ee3('0x11')]=function(_0x64e211){return request('ShowSquareProject',{'options':{'where':{'id':_0x64e211},'attributes':[_0x9ee3('0xf')]}});};exports[_0x9ee3('0x12')]=function(_0x7fa8c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x7fa8c},'attributes':[_0x9ee3('0xf')]}});};exports[_0x9ee3('0x13')]=function(_0x3cdabf){return request(_0x9ee3('0x14'),{'options':{'where':{'id':_0x3cdabf},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0xa60602){return request(_0x9ee3('0x15'),{'options':{'where':{'id':_0xa60602},'attributes':[_0x9ee3('0x16')]}});};exports[_0x9ee3('0x17')]=function(_0x1f0810){return request(_0x9ee3('0x18'),{'options':{'where':{'id':_0x1f0810},'attributes':['name']}});};exports['getContactByPhone']=function(_0x1f937f){return request(_0x9ee3('0x19'),{'options':{'where':{'phone':_0x1f937f[_0x9ee3('0x1a')]},'attributes':['id']}});};exports[_0x9ee3('0x1b')]=function(_0x21ecc6){return request(_0x9ee3('0x1c'),{'options':{'where':{'id':_0x21ecc6},'attributes':[_0x9ee3('0xf')]}});};exports[_0x9ee3('0x1d')]=function(_0x17fab0){return request(_0x9ee3('0x1e'),{'options':{'where':{'id':_0x17fab0},'attributes':['save_name']}});};exports[_0x9ee3('0x1f')]=function(_0x4459f4){return request(_0x9ee3('0x20'),{'options':{'raw':![],'where':{'id':_0x4459f4},'include':[{'model':_0x9ee3('0x21'),'as':_0x9ee3('0x22')}]}});};exports[_0x9ee3('0x23')]=function(_0x5f1c6a){return request(_0x9ee3('0x24'),{'options':{'where':{'id':_0x5f1c6a},'attributes':['id',_0x9ee3('0xf')]}});};exports[_0x9ee3('0x25')]=function(_0x2533c6){return request('CreateSmsMessage',{'body':_0x2533c6});};exports['createSquareDetailsReport']=function(_0x4142fc){return request(_0x9ee3('0x26'),{'body':_0x4142fc});};exports[_0x9ee3('0x27')]=function(_0x2e5888){return request(_0x9ee3('0x28'),{'body':_[_0x9ee3('0x29')](_0x2e5888,{'project_name':_0x2e5888[_0x9ee3('0x2a')],'prev_project_name':_0x2e5888[_0x9ee3('0x2b')]||'','is_subproject':_0x2e5888[_0x9ee3('0x2b')]?!![]:![],'leaveAt':moment()[_0x9ee3('0x2c')](_0x9ee3('0x2d'))})});};exports['createSquareRecording']=function(_0x4fcf8c){return request(_0x9ee3('0x2e'),{'body':_0x4fcf8c});};exports[_0x9ee3('0x2f')]=function(_0x1f4029){return request(_0x9ee3('0x30'),{'body':_0x1f4029});};exports[_0x9ee3('0x31')]=function(_0x350140){return request(_0x9ee3('0x32'),{'options':{'raw':![],'where':{'phone':_0x350140[_0x9ee3('0x1a')],'ListId':_0x350140[_0x9ee3('0x33')]}}})['then'](function(_0x41037f){if(_0x41037f){return _0x41037f;}return request(_0x9ee3('0x34'),{'body':_0x350140});});};exports[_0x9ee3('0x35')]=function(_0x33153){return request('ShowPause',{'options':{'where':{'id':_0x33153},'attributes':[_0x9ee3('0xf')]}});};exports[_0x9ee3('0x36')]=function(_0x5664d9,_0x38afd3){return request(_0x9ee3('0x37'),{'body':{'interface':_0x38afd3},'options':{'where':_0x5664d9}});};exports[_0x9ee3('0x38')]=function(_0x4e0757,_0x1af6ae,_0x57daa4){return request('PauseUser',{'body':{'type':_0x1af6ae,'uniqueid':_0x57daa4},'options':{'where':_0x4e0757}});};exports[_0x9ee3('0x39')]=function(_0x2caeac){return request(_0x9ee3('0x3a'),{'body':{},'options':{'where':_0x2caeac}});};exports[_0x9ee3('0x3b')]=function(_0x574130){return request(_0x9ee3('0x3c'),{'body':{},'options':{'where':_0x574130}});}; \ 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 50dbbcf..9b0a95c 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 _0xb7ac=['exports','./polly','./lex'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x33fb62,_0x1e1f11){_0x33fb62=_0x33fb62-0x0;var _0x17d328=_0xb7ac[_0x33fb62];return _0x17d328;};var polly=require(_0xcb7a('0x0'));var lex=require(_0xcb7a('0x1'));module[_0xcb7a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xcf12=['./lex'];(function(_0x3f435d,_0x200201){var _0xa4b361=function(_0x1d3562){while(--_0x1d3562){_0x3f435d['push'](_0x3f435d['shift']());}};_0xa4b361(++_0x200201);}(_0xcf12,0x140));var _0x2cf1=function(_0x46bb98,_0x81eaa3){_0x46bb98=_0x46bb98-0x0;var _0x4f670b=_0xcf12[_0x46bb98];return _0x4f670b;};var polly=require('./polly');var lex=require(_0x2cf1('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index f7413b1..cbaba5a 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 _0x668b=['./lib/api','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x668b,0x140));var _0xb668=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x668b[_0x38854e];return _0x3f8415;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ No newline at end of file +var _0x70e0=['exports','./lib/api'];(function(_0x524021,_0x25d5ea){var _0x269c3e=function(_0x2418a5){while(--_0x2418a5){_0x524021['push'](_0x524021['shift']());}};_0x269c3e(++_0x25d5ea);}(_0x70e0,0x17b));var _0x070e=function(_0x3731c8,_0x898adb){_0x3731c8=_0x3731c8-0x0;var _0x1b9c08=_0x70e0[_0x3731c8];return _0x1b9c08;};'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 diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index c83a560..daf3a2f 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(_0x599380,_0x4d8a07){var _0x3493ca=function(_0xbf9681){while(--_0xbf9681){_0x599380['push'](_0x599380['shift']());}};_0x3493ca(++_0x4d8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x3c71da,_0x2262e5){var _0x5d78bf=function(_0x5330aa){while(--_0x5330aa){_0x3c71da['push'](_0x3c71da['shift']());}};_0x5d78bf(++_0x2262e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 a3924ca..c69779d 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 _0xce6b=['exports','./lib/api'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xce6b,0x19b));var _0xbce6=function(_0x5a27a1,_0x38f0a5){_0x5a27a1=_0x5a27a1-0x0;var _0x4b09d0=_0xce6b[_0x5a27a1];return _0x4b09d0;};'use strict';var polly=require(_0xbce6('0x0'));module[_0xbce6('0x1')]=function(_0x2220df,_0x48b7eb,_0x221e75,_0x55afc5,_0x62abcd,_0x5956ab,_0x5db60e){return polly(_0x2220df,_0x48b7eb,_0x221e75,_0x55afc5,_0x62abcd,_0x5956ab,_0x5db60e);}; \ No newline at end of file +var _0xe026=['./lib/api','exports'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xe026,0x136));var _0x6e02=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe026[_0x5d6456];return _0x4d66c1;};'use strict';var polly=require(_0x6e02('0x0'));module[_0x6e02('0x1')]=function(_0x358e72,_0x3e1316,_0x3efa74,_0x1ce31,_0xf0c6bb,_0xd591a8,_0x458e34){return polly(_0x358e72,_0x3e1316,_0x3efa74,_0x1ce31,_0xf0c6bb,_0xd591a8,_0x458e34);}; \ 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 676b26f..dd0ce12 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 _0x3734=['bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0xe44663,_0x115a95){var _0xcb8ae8=function(_0x53f5e5){while(--_0x53f5e5){_0xe44663['push'](_0xe44663['shift']());}};_0xcb8ae8(++_0x115a95);}(_0x3734,0x68));var _0x4373=function(_0x35056d,_0x1349cb){_0x35056d=_0x35056d-0x0;var _0x51fa9a=_0x3734[_0x35056d];return _0x51fa9a;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x4373('0x0'));var rs=require('randomstring');var AWS=require(_0x4373('0x1'));function pollyResult(_0x292e30,_0x2bed2c,_0x27e36a){return new BPromise(function(_0x1ca311,_0x375342){_0x292e30[_0x4373('0x2')](_0x2bed2c,function(_0x10cc74,_0x594c44){if(_0x10cc74){_0x375342(_0x10cc74);}else if(_0x594c44){if(_0x594c44[_0x4373('0x3')]instanceof Buffer){fs[_0x4373('0x4')](_0x27e36a,_0x594c44[_0x4373('0x3')],function(_0x76bd1e){if(_0x76bd1e){_0x375342(_0x76bd1e);}else{_0x1ca311();}});}else{_0x375342(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x375342(new Error(_0x4373('0x5')));}});});}module['exports']=function(_0x4864de,_0x1c64f6,_0x2ed451,_0x314ab4,_0x505559,_0x24b6a3,_0x2ba88a){var _0x1da8ce=new AWS[(_0x4373('0x6'))]({'accessKeyId':_0x4864de,'secretAccessKey':_0x1c64f6,'region':_0x2ed451});var _0x113f1b={'Text':_0x505559,'TextType':_0x24b6a3||_0x4373('0x7'),'OutputFormat':'mp3','VoiceId':_0x314ab4};return pollyResult(_0x1da8ce,_0x113f1b,_0x2ba88a);}; \ No newline at end of file +var _0xa947=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x1fb937,_0xe85eb1){var _0x5f44f4=function(_0x43bb15){while(--_0x43bb15){_0x1fb937['push'](_0x1fb937['shift']());}};_0x5f44f4(++_0xe85eb1);}(_0xa947,0x15c));var _0x7a94=function(_0x2615b1,_0x3a35a2){_0x2615b1=_0x2615b1-0x0;var _0x3a2651=_0xa947[_0x2615b1];return _0x3a2651;};'use strict';var fs=require('fs');var path=require(_0x7a94('0x0'));var BPromise=require(_0x7a94('0x1'));var rs=require(_0x7a94('0x2'));var AWS=require(_0x7a94('0x3'));function pollyResult(_0x2d3c2d,_0xf5a6c2,_0x49ecf4){return new BPromise(function(_0x30d6e8,_0x48c435){_0x2d3c2d[_0x7a94('0x4')](_0xf5a6c2,function(_0x547391,_0x64e512){if(_0x547391){_0x48c435(_0x547391);}else if(_0x64e512){if(_0x64e512[_0x7a94('0x5')]instanceof Buffer){fs[_0x7a94('0x6')](_0x49ecf4,_0x64e512['AudioStream'],function(_0x23385c){if(_0x23385c){_0x48c435(_0x23385c);}else{_0x30d6e8();}});}else{_0x48c435(new Error(_0x7a94('0x7')));}}else{_0x48c435(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x7a94('0x8')]=function(_0x59c4ce,_0x5b640c,_0x58e3d1,_0x4e731b,_0x525120,_0x24acde,_0x54a9f2){var _0x2127e7=new AWS['Polly']({'accessKeyId':_0x59c4ce,'secretAccessKey':_0x5b640c,'region':_0x58e3d1});var _0x4e02a7={'Text':_0x525120,'TextType':_0x24acde||_0x7a94('0x9'),'OutputFormat':_0x7a94('0xa'),'VoiceId':_0x4e731b};return pollyResult(_0x2127e7,_0x4e02a7,_0x54a9f2);}; \ 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 e3f5866..34b00c3 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 _0x684b=['./lib/api','exports'];(function(_0x329816,_0x2d09ae){var _0x4a611e=function(_0x5c1c14){while(--_0x5c1c14){_0x329816['push'](_0x329816['shift']());}};_0x4a611e(++_0x2d09ae);}(_0x684b,0xf6));var _0xb684=function(_0x16610c,_0x2796de){_0x16610c=_0x16610c-0x0;var _0x37f21b=_0x684b[_0x16610c];return _0x37f21b;};'use strict';var asr=require(_0xb684('0x0'));module[_0xb684('0x1')]=function(_0x5a3bc0,_0x3c2e78,_0x375c8e,_0x70f1b9){return asr(_0x5a3bc0,_0x3c2e78,_0x375c8e);}; \ No newline at end of file +var _0x8899=['exports','./lib/api'];(function(_0x2c53a8,_0x44516d){var _0x51763f=function(_0x2ce43c){while(--_0x2ce43c){_0x2c53a8['push'](_0x2c53a8['shift']());}};_0x51763f(++_0x44516d);}(_0x8899,0x1b9));var _0x9889=function(_0x470aff,_0xc63bd3){_0x470aff=_0x470aff-0x0;var _0x48989b=_0x8899[_0x470aff];return _0x48989b;};'use strict';var asr=require(_0x9889('0x0'));module[_0x9889('0x1')]=function(_0x84217c,_0x2eb5da,_0x5ddc65,_0x258e85){return asr(_0x84217c,_0x2eb5da,_0x5ddc65);}; \ 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 24fb4e3..9353e4d 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 _0xd87e=['bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','length','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x2057ec,_0x2e3a88){var _0x386626=function(_0x3755f4){while(--_0x3755f4){_0x2057ec['push'](_0x2057ec['shift']());}};_0x386626(++_0x2e3a88);}(_0xd87e,0x1bf));var _0xed87=function(_0x1698f6,_0x441e4b){_0x1698f6=_0x1698f6-0x0;var _0x11d58f=_0xd87e[_0x1698f6];return _0x11d58f;};'use strict';var url=require(_0xed87('0x0'));var BPromise=require(_0xed87('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xed87('0x2')]=function(_0x189fdd,_0x16509b,_0x5901be){return new BPromise(function(_0xbbee79,_0x5e960f){var _0x11a5d9;if(typeof _0x189fdd!==_0xed87('0x3')||_0x189fdd['length']===0x0){return _0x5e960f(_0xed87('0x4'));}if(typeof _0x16509b!=='string'||_0x16509b['length']===0x0){return _0x5e960f(_0xed87('0x5'));}if(typeof _0x5901be!==_0xed87('0x6')&&(typeof _0x5901be!==_0xed87('0x3')||_0x5901be[_0xed87('0x7')]===0x0)){return _0x5e960f('lang\x20should\x20be\x20a\x20string');}try{_0x11a5d9=fs[_0xed87('0x8')](_0x189fdd)[_0xed87('0x9')](_0xed87('0xa'));}catch(_0x3c9a3c){return _0x5e960f(_0x3c9a3c);}return _0xbbee79({'method':_0xed87('0xb'),'uri':host+_0xed87('0xc')+_0x16509b,'body':{'config':{'encoding':_0xed87('0xd'),'sampleRateHertz':'8000','languageCode':_0x5901be},'audio':{'content':_0x11a5d9}},'json':!![]});});}; \ No newline at end of file +var _0x9e9b=['POST','/v1/speech:recognize?key=','8000','url','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x9e9b,0x1a7));var _0xb9e9=function(_0x2688d5,_0x45db72){_0x2688d5=_0x2688d5-0x0;var _0x372637=_0x9e9b[_0x2688d5];return _0x372637;};'use strict';var url=require(_0xb9e9('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xb9e9('0x1')]=function(_0x3d68be,_0x42d119,_0x1ccb2d){return new BPromise(function(_0x58a9cd,_0x430131){var _0x394a8e;if(typeof _0x3d68be!=='string'||_0x3d68be[_0xb9e9('0x2')]===0x0){return _0x430131(_0xb9e9('0x3'));}if(typeof _0x42d119!==_0xb9e9('0x4')||_0x42d119[_0xb9e9('0x2')]===0x0){return _0x430131(_0xb9e9('0x5'));}if(typeof _0x1ccb2d!==_0xb9e9('0x6')&&(typeof _0x1ccb2d!==_0xb9e9('0x4')||_0x1ccb2d[_0xb9e9('0x2')]===0x0)){return _0x430131(_0xb9e9('0x7'));}try{_0x394a8e=fs[_0xb9e9('0x8')](_0x3d68be)[_0xb9e9('0x9')](_0xb9e9('0xa'));}catch(_0x50f3ff){return _0x430131(_0x50f3ff);}return _0x58a9cd({'method':_0xb9e9('0xb'),'uri':host+_0xb9e9('0xc')+_0x42d119,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xb9e9('0xd'),'languageCode':_0x1ccb2d},'audio':{'content':_0x394a8e}},'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 520573f..664ba43 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 _0x7df3=['exports','./asr'];(function(_0x49a0b9,_0x8201dd){var _0x457f3e=function(_0x4abffd){while(--_0x4abffd){_0x49a0b9['push'](_0x49a0b9['shift']());}};_0x457f3e(++_0x8201dd);}(_0x7df3,0x1e1));var _0x37df=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7df3[_0x484e36];return _0xafc85d;};var asr=require(_0x37df('0x0'));module[_0x37df('0x1')]={'asr':asr}; \ No newline at end of file +var _0x0f67=['exports','./asr'];(function(_0x2c2ebc,_0x528e0a){var _0x1a527e=function(_0x1b426d){while(--_0x1b426d){_0x2c2ebc['push'](_0x2c2ebc['shift']());}};_0x1a527e(++_0x528e0a);}(_0x0f67,0x117));var _0x70f6=function(_0x49d114,_0x4fdf4b){_0x49d114=_0x49d114-0x0;var _0x3006c1=_0x0f67[_0x49d114];return _0x3006c1;};var asr=require(_0x70f6('0x0'));module[_0x70f6('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 28a06e6..f4682bf 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 _0xf758=['name','message','googleDialogflow','textRequest','result','source','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','bluebird','https','md5','path','querystring','randomstring','sox','url','parse','./aws','./google','./tilde','agi','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish\x20download\x20file','close','error','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','chmodSync','777','info','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','data','.mp3','googleASR','asr','results','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s'];(function(_0x107a30,_0x175ab9){var _0x41b99b=function(_0x2c00b6){while(--_0x2c00b6){_0x107a30['push'](_0x107a30['shift']());}};_0x41b99b(++_0x175ab9);}(_0xf758,0xb5));var _0x8f75=function(_0x1fd7c0,_0x1d3c01){_0x1fd7c0=_0x1fd7c0-0x0;var _0x1f27d5=_0xf758[_0x1fd7c0];return _0x1f27d5;};'use strict';var apiai=require(_0x8f75('0x0'));var BPromise=require(_0x8f75('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x8f75('0x2'));var md5=require(_0x8f75('0x3'));var path=require(_0x8f75('0x4'));var querystring=require(_0x8f75('0x5'));var rp=require('request-promise');var rs=require(_0x8f75('0x6'));var sox=require(_0x8f75('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x8f75('0x8'))[_0x8f75('0x9')];var util=require('util');var aws=require(_0x8f75('0xa'));var google=require(_0x8f75('0xb'));var sestek=require('./sestek');var tilde=require(_0x8f75('0xc'));var logger=require('../../../config/logger')(_0x8f75('0xd'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x3ce5ae,_0x2ca5f3){return new BPromise(function(_0x23d693,_0x4a8ac7){var _0x251253=urlParse(_0x3ce5ae);var _0x17d0d0=_0x251253[_0x8f75('0xe')]===_0x8f75('0xf')?https:http;var _0x52674d={'host':_0x251253[_0x8f75('0x10')],'path':_0x251253[_0x8f75('0x4')],'headers':{'user-agent':_0x8f75('0x11')}};_0x17d0d0[_0x8f75('0x12')](_0x52674d,function(_0x3636f5){if(_0x3636f5['statusCode']!==0xc8){logger['error'](_0x8f75('0x13')+_0x3ce5ae+_0x8f75('0x14')+_0x3636f5[_0x8f75('0x15')]+'\x20('+_0x3636f5['statusMessage']+')');_0x4a8ac7(new Error(_0x8f75('0x13')+_0x3ce5ae+_0x8f75('0x14')+_0x3636f5[_0x8f75('0x15')]+'\x20('+_0x3636f5[_0x8f75('0x16')]+')'));return;}var _0xe075dc=fs[_0x8f75('0x17')](_0x2ca5f3);_0xe075dc['on']('finish',function(){logger['info'](_0x8f75('0x18'));_0xe075dc[_0x8f75('0x19')](_0x23d693);});_0xe075dc['on'](_0x8f75('0x1a'),function(_0x579e70){fs['unlink'](_0x2ca5f3);logger[_0x8f75('0x1a')](_0x8f75('0x1b'),_0x579e70);_0x4a8ac7(_0x579e70);});_0x3636f5[_0x8f75('0x1c')](_0xe075dc);})['on'](_0x8f75('0x1a'),function(_0x1c640c){logger[_0x8f75('0x1a')](_0x1c640c);_0x4a8ac7(_0x1c640c);})[_0x8f75('0x1d')]();});}function uploadFile(_0x4bf36a){return new BPromise(function(_0xc4f8a8,_0x3ddabf){var _0x4944d0=urlParse(_0x4bf36a);var _0x2457d3=_0x4944d0['protocol']==='https:'?https:http;var _0x3cb090={'host':_0x4944d0[_0x8f75('0x10')],'path':_0x4944d0['path'],'headers':{'user-agent':_0x8f75('0x11')}};_0x2457d3[_0x8f75('0x12')](_0x3cb090,function(_0x44cf45){if(_0x44cf45[_0x8f75('0x15')]!==0xc8){_0x3ddabf(new Error(_0x8f75('0x13')+_0x4bf36a+_0x8f75('0x14')+_0x44cf45['statusCode']+'\x20('+_0x44cf45[_0x8f75('0x16')]+')'));return;}var _0x2c5dea='';_0x44cf45['on']('data',function(_0x189ed0){_0x2c5dea+=_0x189ed0;});_0x44cf45['on']('end',function(){_0xc4f8a8(_0x2c5dea);});})['on'](_0x8f75('0x1a'),function(_0x300328){_0x3ddabf(_0x300328);})['end']();});}function convertFile(_0x31f734,_0x51fd52){return new BPromise(function(_0x468c44,_0x3edd9f){var _0x210e56=sox[_0x8f75('0x1e')](_0x31f734,_0x51fd52,{'sampleRate':0x1f40,'format':_0x8f75('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x210e56['on'](_0x8f75('0x1a'),function(_0x3ed20a){logger['error'](_0x8f75('0x20'),_0x3ed20a);_0x3edd9f(_0x3ed20a);});_0x210e56['on'](_0x8f75('0x1d'),function(){logger['info'](_0x8f75('0x21'));_0x468c44();});_0x210e56[_0x8f75('0x22')]();});}function base64Decode(_0xa05413,_0x490cea){var _0x100a91=path[_0x8f75('0x23')](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+_0x8f75('0x26'));fs[_0x8f75('0x27')](_0x100a91,_0xa05413,_0x8f75('0x28'));return convertFile(_0x100a91,_0x490cea)[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x100a91);fs['chmodSync'](_0x490cea,'777');}catch(_0x4c68ac){logger[_0x8f75('0x1a')](_0x4c68ac);}return _0x490cea[_0x8f75('0x2b')]('.')[0x0];});}function base64Encode(_0x152775){var _0x226ba8=fs[_0x8f75('0x2c')](_0x152775);return new Buffer(_0x226ba8)['toString']('base64');}exports['googleCloudTTS']=function(_0x248726,_0x579917,_0x4eb2b2,_0x568298,_0x25606d,_0x367fde){var _0x476986,_0xb195db;var _0x4fbc2f=_0x8f75('0x2d');var _0x39c7cb=_0x8f75('0x2e')+_0x248726;var _0x56e372={};if(_0x579917===_0x8f75('0x2f')){_0x56e372[_0x8f75('0x30')]={'ssml':_0x4eb2b2};}else{_0x56e372['input']={'text':_0x4eb2b2};};_0x56e372[_0x8f75('0x31')]={'languageCode':_0x568298,'ssmlGender':_0x25606d};_0x56e372[_0x8f75('0x32')]={'audioEncoding':_0x8f75('0x33'),'sampleRateHertz':0x1f40};var _0x2a61d0={'url':_0x4fbc2f+_0x8f75('0x34')+_0x39c7cb,'method':_0x8f75('0x35'),'json':!![],'body':_0x56e372};return rp(_0x2a61d0)['then'](function(_0xc29f6d){return new BPromise(function(_0x1d2a28,_0x2a926a){_0x476986=path[_0x8f75('0x23')](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+'.mp3');var _0x2fd6d6=Buffer[_0x8f75('0x36')](_0xc29f6d[_0x8f75('0x37')],'base64');return fs['writeFile'](_0x476986,_0x2fd6d6,function(_0x30d263){_0x2a926a(_0x30d263);},function(_0x52cfbf){fs[_0x8f75('0x38')](_0x476986,_0x8f75('0x39'));_0x1d2a28(_0x52cfbf);});});})[_0x8f75('0x29')](function(_0x47dd5e){_0xb195db=path[_0x8f75('0x23')](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+_0x8f75('0x26'));return convertFile(_0x476986,_0xb195db);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x476986);fs[_0x8f75('0x38')](_0xb195db,'777');}catch(_0x3e5236){logger[_0x8f75('0x1a')](_0x3e5236);}logger[_0x8f75('0x3a')]('googleCloudTTS\x20path',_0xb195db[_0x8f75('0x2b')]('.')[0x0]);return _0xb195db[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x3b')]=function(_0x461b15,_0x15254c){var _0x448a11=_0x8f75('0x3c');var _0x1a144c,_0x8507f0;var _0x87013f;var _0x13f9d0={'encoding':_0x8f75('0x3d'),'method':'POST','timeout':0x2710,'url':_0x448a11,'headers':{'Content-Type':_0x8f75('0x3e')},'body':_0x8f75('0x3f')+encodeURIComponent(JSON[_0x8f75('0x40')]([[['jQ1olc',JSON['stringify']([_0x461b15,_0x15254c||'en',![],'null']),null,'generic']]]))};return rp(_0x13f9d0)[_0x8f75('0x29')](function(_0x23ae25){try{_0x87013f=eval(_0x23ae25[_0x8f75('0x41')](0x5))[0x0][0x2];}catch(_0x4ff0d7){throw new Error('parse\x20response\x20failed:\x0a'+_0x23ae25['data']);}if(!_0x87013f){if(_0x461b15[_0x8f75('0x42')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x8f75('0x43')+_0x15254c+_0x8f75('0x44'));}}try{_0x87013f=eval(_0x87013f)[0x0];}catch(_0x5b767b){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8f75('0x45')]);}const _0x510997=_0x87013f;_0x1a144c=path['resolve'](__dirname,'tmp',rs[_0x8f75('0x25')](0x4)+_0x8f75('0x46'));fs[_0x8f75('0x27')](_0x1a144c,_0x87013f,{'encoding':_0x8f75('0x28')});_0x8507f0=path[_0x8f75('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1a144c,_0x8507f0);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x1a144c);fs['chmodSync'](_0x8507f0,_0x8f75('0x39'));}catch(_0x3fa7ab){logger[_0x8f75('0x1a')](_0x3fa7ab);}logger[_0x8f75('0x3a')]('goggleTTS\x20path',_0x8507f0[_0x8f75('0x2b')]('.')[0x0]);return _0x8507f0[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x47')]=function(_0x3f4d61,_0x40fca0,_0x50371e){return google[_0x8f75('0x48')](_0x3f4d61,_0x40fca0,_0x50371e)[_0x8f75('0x29')](function(_0x5c6e49){logger[_0x8f75('0x3a')](_0x5c6e49['uri']);return rp(_0x5c6e49);})[_0x8f75('0x29')](function(_0x44a499){var _0x4ddd7a='';var _0x37e537=0x0;try{fs[_0x8f75('0x2a')](_0x3f4d61);}catch(_0x123f2f){logger[_0x8f75('0x1a')](_0x123f2f);}if(_0x44a499&&_0x44a499[_0x8f75('0x49')]){_0x4ddd7a=_0x44a499[_0x8f75('0x49')]['map'](function(_0x135d0b){return _0x135d0b&&_0x135d0b[_0x8f75('0x4a')][0x0]&&_0x135d0b[_0x8f75('0x4a')][0x0][_0x8f75('0x4b')]?_0x135d0b[_0x8f75('0x4a')][0x0]['transcript']:'';})['join']('\x0a');_0x37e537=_0x44a499[_0x8f75('0x49')]['map'](function(_0x25c7ce){return _0x25c7ce&&_0x25c7ce[_0x8f75('0x4a')][0x0]&&_0x25c7ce['alternatives'][0x0][_0x8f75('0x4c')]?_0x25c7ce[_0x8f75('0x4a')][0x0][_0x8f75('0x4c')]:0x0;})[_0x8f75('0x4d')]('\x0a');}logger[_0x8f75('0x3a')](_0x8f75('0x4e'),_0x4ddd7a);logger[_0x8f75('0x3a')]('googleASR\x20confidence',_0x37e537);return{'transcript':_0x4ddd7a,'confidence':_0x37e537};})[_0x8f75('0x4f')](function(_0x29023c){logger[_0x8f75('0x1a')](_0x8f75('0x50'),_0x29023c[_0x8f75('0x15')],_0x29023c[_0x8f75('0x51')],_0x29023c[_0x8f75('0x52')]);});};exports[_0x8f75('0x53')]=function(_0x5b797b,_0x444f76,_0x10741a,_0x4ca740){var _0x2004a9=apiai(_0x444f76,{'language':_0x4ca740||'en'});return _0x2004a9[_0x8f75('0x54')](_0x10741a,{'sessionId':md5(_0x5b797b)})[_0x8f75('0x29')](function(_0xf730e4){logger[_0x8f75('0x3a')](JSON[_0x8f75('0x40')](_0xf730e4));return{'source':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x56')],'resolvedQuery':_0xf730e4[_0x8f75('0x55')]['resolvedQuery'],'action':_0xf730e4[_0x8f75('0x55')]['action'],'actionIncomplete':_0xf730e4[_0x8f75('0x55')]['actionIncomplete'],'speech':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x57')][_0x8f75('0x58')],'score':_0xf730e4[_0x8f75('0x55')]['score'],'statusCode':_0xf730e4[_0x8f75('0x59')][_0x8f75('0x5a')],'endConversation':_0xf730e4['result'][_0x8f75('0x5b')][_0x8f75('0x5c')]||![],'isFallbackIntent':_0xf730e4[_0x8f75('0x55')][_0x8f75('0x5b')][_0x8f75('0x5d')]};});};exports[_0x8f75('0x5e')]=function(_0x4397d1,_0x3ea3ba,_0x3ddd7a,_0x40d1fb,_0x1835ff,_0x1231d5){var _0x188293=_0x40d1fb['replace'](/\\n/g,'\x0a');var _0x5df3cc={'credentials':{'private_key':_0x188293,'client_email':_0x3ddd7a}};var _0x32e326=new dialogflow['SessionsClient'](_0x5df3cc);var _0x16fb37=_0x32e326[_0x8f75('0x5f')](_0x3ea3ba,md5(_0x4397d1));var _0x18e631={'session':_0x16fb37,'queryInput':{'text':{'text':_0x1835ff,'languageCode':_0x1231d5}}};return _0x32e326[_0x8f75('0x60')](_0x18e631)[_0x8f75('0x29')](function(_0x3f6949){if(_0x3f6949&&_0x3f6949[_0x8f75('0x42')]){logger[_0x8f75('0x3a')](_0x8f75('0x61'),JSON[_0x8f75('0x40')](_0x3f6949));var _0x27e7eb=_0x3f6949[0x0];if(_0x27e7eb){var _0x3f9d68={'action':_0x27e7eb['queryResult'][_0x8f75('0x62')],'allRequiredParamsPresent':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x64')],'endConversation':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x65')]&&_0x27e7eb['queryResult'][_0x8f75('0x65')][_0x8f75('0x66')]?_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x65')][_0x8f75('0x66')][_0x8f75('0x67')][_0x8f75('0x68')]:![],'fulfillmentText':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x69')],'intentName':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6a')]['name'],'intentDisplayName':_0x27e7eb['queryResult'][_0x8f75('0x6a')][_0x8f75('0x6b')],'isFallbackIntent':_0x27e7eb['queryResult']['intent'][_0x8f75('0x6c')],'languageCode':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6d')],'queryText':_0x27e7eb[_0x8f75('0x63')]['queryText'],'responseId':_0x27e7eb[_0x8f75('0x6e')],'score':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x6f')],'speech':_0x27e7eb[_0x8f75('0x63')][_0x8f75('0x69')],'providerResponse':JSON[_0x8f75('0x40')](_0x3f6949)};return _0x3f9d68;}}});};exports[_0x8f75('0x70')]=function(_0x363549,_0x167da0,_0x1ca4ef,_0xdcf201){return tilde[_0x8f75('0x48')](_0x363549,_0x167da0,_0x1ca4ef,_0xdcf201)[_0x8f75('0x29')](function(_0x35fdfb){try{fs[_0x8f75('0x2a')](_0x363549);}catch(_0x5831b8){logger[_0x8f75('0x1a')](_0x5831b8);}logger[_0x8f75('0x3a')](_0x8f75('0x71'),_0x35fdfb['transcript']);logger[_0x8f75('0x3a')](_0x8f75('0x72'),_0x35fdfb['confidence']);return _0x35fdfb;});};exports[_0x8f75('0x73')]=function(_0x372086,_0x10be48,_0x3e37cb,_0x1f7113,_0xd6ba7d,_0x46f3b1){var _0x19e6c3=path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.mp3');var _0x13140;return aws['polly'](_0x372086,_0x10be48,_0x3e37cb,_0x1f7113,_0xd6ba7d,_0x46f3b1,_0x19e6c3)[_0x8f75('0x29')](function(){_0x13140=path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.wav');return convertFile(_0x19e6c3,_0x13140);})['then'](function(){try{fs[_0x8f75('0x2a')](_0x19e6c3);fs[_0x8f75('0x38')](_0x13140,_0x8f75('0x39'));}catch(_0x55d488){logger['error'](_0x55d488);}return _0x13140[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x74')]=function(_0x3907ae,_0x8fa2d6,_0x5278db,_0x416a38,_0x116ec4,_0x585732){return aws['lex'](_0x3907ae,_0x8fa2d6,_0x5278db,_0x416a38,_0x116ec4,_0x585732)[_0x8f75('0x29')](function(_0x1daee9){logger['info'](JSON[_0x8f75('0x40')](_0x1daee9));return _0x1daee9;});};exports[_0x8f75('0x75')]=function(_0x14c0b7,_0x456f11,_0x449f66,_0x5fb587){var _0x907f9d=util[_0x8f75('0x76')](_0x8f75('0x77'),ISPEECH_API,_0x14c0b7,encodeURIComponent(_0x456f11),_0x449f66,_0x5fb587);var _0x2834d1=path[_0x8f75('0x23')](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+_0x8f75('0x46'));var _0xeca3bb;return downloadFile(_0x907f9d,_0x2834d1)['then'](function(){_0xeca3bb=path[_0x8f75('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x8f75('0x26'));return convertFile(_0x2834d1,_0xeca3bb);})[_0x8f75('0x29')](function(){try{fs[_0x8f75('0x2a')](_0x2834d1);fs[_0x8f75('0x38')](_0xeca3bb,'777');}catch(_0x1b8507){logger['error'](_0x1b8507);}return _0xeca3bb[_0x8f75('0x2b')]('.')[0x0];});};exports[_0x8f75('0x78')]=function(_0x19e2d2,_0x5b22d9,_0x21d07a,_0x3e57ba){var _0x5c6460=util[_0x8f75('0x76')](_0x8f75('0x79'),ISPEECH_API,_0x5b22d9,_0x21d07a,base64Encode(_0x19e2d2),_0x3e57ba?util[_0x8f75('0x76')](_0x8f75('0x7a'),encodeURIComponent(_0x3e57ba)):_0x8f75('0x7b'));return uploadFile(_0x5c6460)['then'](function(_0x2f0e82){return querystring[_0x8f75('0x9')](_0x2f0e82);});};exports[_0x8f75('0x7c')]=function(_0x2c0d2f,_0x54d22d){return sestek[_0x8f75('0x7d')](_0x2c0d2f,_0x54d22d)['then'](function(_0xdaf0fd){logger[_0x8f75('0x3a')](JSON[_0x8f75('0x40')](_0xdaf0fd));var _0x47174e={'speech':_0xdaf0fd[_0x8f75('0x7e')],'action':_0xdaf0fd['channelData']?_0xdaf0fd[_0x8f75('0x7f')]['CustomAction']:undefined,'actiondata':_0xdaf0fd[_0x8f75('0x7f')]?_0xdaf0fd[_0x8f75('0x7f')][_0x8f75('0x80')]:undefined};if(_0xdaf0fd[_0x8f75('0x7f')]&&_0xdaf0fd[_0x8f75('0x7f')]['AudioFromTts']){return base64Decode(_0xdaf0fd[_0x8f75('0x7f')][_0x8f75('0x81')]['Data'],path['resolve'](__dirname,_0x8f75('0x24'),rs[_0x8f75('0x25')](0x4)+'.wav'))[_0x8f75('0x29')](function(_0x4be803){_0x47174e['audiofile']=_0x4be803;return _0x47174e;});}return _0x47174e;});};exports[_0x8f75('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0xaaf9=['allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','download\x20error','pipe','https:','host','data','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','writeFile','resolve','unlink','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','[%s]\x20%s:%s','name','message','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0xaaf9,0x134));var _0x9aaf=function(_0x8889f1,_0x40f102){_0x8889f1=_0x8889f1-0x0;var _0x25af2b=_0xaaf9[_0x8889f1];return _0x25af2b;};'use strict';var apiai=require(_0x9aaf('0x0'));var BPromise=require(_0x9aaf('0x1'));var dialogflow=require(_0x9aaf('0x2'));var fs=require('fs');var http=require(_0x9aaf('0x3'));var https=require(_0x9aaf('0x4'));var md5=require(_0x9aaf('0x5'));var path=require(_0x9aaf('0x6'));var querystring=require(_0x9aaf('0x7'));var rp=require(_0x9aaf('0x8'));var rs=require(_0x9aaf('0x9'));var sox=require(_0x9aaf('0xa'));var tts=require(_0x9aaf('0xb'));var urlParse=require('url')[_0x9aaf('0xc')];var util=require(_0x9aaf('0xd'));var aws=require(_0x9aaf('0xe'));var google=require('./google');var sestek=require(_0x9aaf('0xf'));var tilde=require('./tilde');var logger=require(_0x9aaf('0x10'))('agi');var ISPEECH_API=_0x9aaf('0x11');function downloadFile(_0x50de6e,_0x20aec9){return new BPromise(function(_0x26d918,_0x5649cf){var _0x313d2a=urlParse(_0x50de6e);var _0x10de68=_0x313d2a[_0x9aaf('0x12')]==='https:'?https:http;var _0x1109fa={'host':_0x313d2a['host'],'path':_0x313d2a['path'],'headers':{'user-agent':_0x9aaf('0x13')}};_0x10de68[_0x9aaf('0x14')](_0x1109fa,function(_0x393ba3){if(_0x393ba3[_0x9aaf('0x15')]!==0xc8){logger[_0x9aaf('0x16')](_0x9aaf('0x17')+_0x50de6e+_0x9aaf('0x18')+_0x393ba3[_0x9aaf('0x15')]+'\x20('+_0x393ba3[_0x9aaf('0x19')]+')');_0x5649cf(new Error(_0x9aaf('0x17')+_0x50de6e+'\x20failed,\x20status\x20code\x20=\x20'+_0x393ba3['statusCode']+'\x20('+_0x393ba3[_0x9aaf('0x19')]+')'));return;}var _0x438603=fs['createWriteStream'](_0x20aec9);_0x438603['on'](_0x9aaf('0x1a'),function(){logger['info'](_0x9aaf('0x1b'));_0x438603[_0x9aaf('0x1c')](_0x26d918);});_0x438603['on'](_0x9aaf('0x16'),function(_0x52a40d){fs['unlink'](_0x20aec9);logger[_0x9aaf('0x16')](_0x9aaf('0x1d'),_0x52a40d);_0x5649cf(_0x52a40d);});_0x393ba3[_0x9aaf('0x1e')](_0x438603);})['on'](_0x9aaf('0x16'),function(_0x24139a){logger[_0x9aaf('0x16')](_0x24139a);_0x5649cf(_0x24139a);})['end']();});}function uploadFile(_0x5d8a42){return new BPromise(function(_0x472f83,_0x254901){var _0x10b020=urlParse(_0x5d8a42);var _0x3e874a=_0x10b020['protocol']===_0x9aaf('0x1f')?https:http;var _0x240686={'host':_0x10b020[_0x9aaf('0x20')],'path':_0x10b020['path'],'headers':{'user-agent':_0x9aaf('0x13')}};_0x3e874a['get'](_0x240686,function(_0xd7ff17){if(_0xd7ff17[_0x9aaf('0x15')]!==0xc8){_0x254901(new Error(_0x9aaf('0x17')+_0x5d8a42+_0x9aaf('0x18')+_0xd7ff17[_0x9aaf('0x15')]+'\x20('+_0xd7ff17['statusMessage']+')'));return;}var _0x3a8a8e='';_0xd7ff17['on'](_0x9aaf('0x21'),function(_0x315581){_0x3a8a8e+=_0x315581;});_0xd7ff17['on'](_0x9aaf('0x22'),function(){_0x472f83(_0x3a8a8e);});})['on']('error',function(_0x4c517d){_0x254901(_0x4c517d);})['end']();});}function convertFile(_0x17d7d0,_0x42cdfa){return new BPromise(function(_0x11a358,_0x33f9f3){var _0x8a0ed1=sox[_0x9aaf('0x23')](_0x17d7d0,_0x42cdfa,{'sampleRate':0x1f40,'format':_0x9aaf('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x8a0ed1['on'](_0x9aaf('0x16'),function(_0x82d831){logger[_0x9aaf('0x16')](_0x9aaf('0x25'),_0x82d831);_0x33f9f3(_0x82d831);});_0x8a0ed1['on'](_0x9aaf('0x22'),function(){logger[_0x9aaf('0x26')](_0x9aaf('0x27'));_0x11a358();});_0x8a0ed1[_0x9aaf('0x28')]();});}function base64Decode(_0x34c0b0,_0x5284ea){var _0x100152=path['resolve'](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x2b'));fs[_0x9aaf('0x2c')](_0x100152,_0x34c0b0,_0x9aaf('0x2d'));return convertFile(_0x100152,_0x5284ea)[_0x9aaf('0x2e')](function(){try{fs['unlink'](_0x100152);fs[_0x9aaf('0x2f')](_0x5284ea,_0x9aaf('0x30'));}catch(_0x375e5a){logger['error'](_0x375e5a);}return _0x5284ea[_0x9aaf('0x31')]('.')[0x0];});}function base64Encode(_0x51fad8){var _0x256b37=fs[_0x9aaf('0x32')](_0x51fad8);return new Buffer(_0x256b37)[_0x9aaf('0x33')](_0x9aaf('0x2d'));}exports[_0x9aaf('0x34')]=function(_0x4fdd2e,_0x68ee6f,_0x215f45,_0x4e0422,_0x3b863a,_0x979462){var _0x1369e9,_0x1cdd8f;var _0x16ee30='https://texttospeech.googleapis.com/v1/';var _0x58b435=_0x9aaf('0x35')+_0x4fdd2e;var _0x2e67d0={};if(_0x68ee6f===_0x9aaf('0x36')){_0x2e67d0[_0x9aaf('0x37')]={'ssml':_0x215f45};}else{_0x2e67d0['input']={'text':_0x215f45};};_0x2e67d0[_0x9aaf('0x38')]={'languageCode':_0x4e0422,'ssmlGender':_0x3b863a};_0x2e67d0[_0x9aaf('0x39')]={'audioEncoding':_0x9aaf('0x3a'),'sampleRateHertz':0x1f40};var _0x477ecd={'url':_0x16ee30+_0x9aaf('0x3b')+_0x58b435,'method':_0x9aaf('0x3c'),'json':!![],'body':_0x2e67d0};return rp(_0x477ecd)['then'](function(_0xf5f27c){return new BPromise(function(_0x2b33cb,_0x1ba556){_0x1369e9=path['resolve'](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x3d'));var _0x412400=Buffer['from'](_0xf5f27c['audioContent'],_0x9aaf('0x2d'));return fs[_0x9aaf('0x3e')](_0x1369e9,_0x412400,function(_0xbcbe6f){_0x1ba556(_0xbcbe6f);},function(_0x483cab){fs[_0x9aaf('0x2f')](_0x1369e9,_0x9aaf('0x30'));_0x2b33cb(_0x483cab);});});})[_0x9aaf('0x2e')](function(_0x2b1963){_0x1cdd8f=path[_0x9aaf('0x3f')](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x2b'));return convertFile(_0x1369e9,_0x1cdd8f);})[_0x9aaf('0x2e')](function(){try{fs[_0x9aaf('0x40')](_0x1369e9);fs['chmodSync'](_0x1cdd8f,'777');}catch(_0x33a74e){logger[_0x9aaf('0x16')](_0x33a74e);}logger[_0x9aaf('0x26')](_0x9aaf('0x41'),_0x1cdd8f['split']('.')[0x0]);return _0x1cdd8f[_0x9aaf('0x31')]('.')[0x0];});};exports['googleTTS']=function(_0x1554a3,_0x504cd2){var _0x20f913=_0x9aaf('0x42');var _0x28b2ca,_0x131cac;var _0x1414ce;var _0x309533={'encoding':_0x9aaf('0x43'),'method':_0x9aaf('0x3c'),'timeout':0x2710,'url':_0x20f913,'headers':{'Content-Type':_0x9aaf('0x44')},'body':_0x9aaf('0x45')+encodeURIComponent(JSON[_0x9aaf('0x46')]([[[_0x9aaf('0x47'),JSON[_0x9aaf('0x46')]([_0x1554a3,_0x504cd2||'en',![],_0x9aaf('0x48')]),null,_0x9aaf('0x49')]]]))};return rp(_0x309533)[_0x9aaf('0x2e')](function(_0xe865f0){try{_0x1414ce=eval(_0xe865f0['slice'](0x5))[0x0][0x2];}catch(_0x319de3){throw new Error(_0x9aaf('0x4a')+_0xe865f0[_0x9aaf('0x21')]);}if(!_0x1414ce){if(_0x1554a3['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x9aaf('0x4b')+_0x504cd2+_0x9aaf('0x4c'));}}try{_0x1414ce=eval(_0x1414ce)[0x0];}catch(_0x51631c){throw new Error(_0x9aaf('0x4a')+res[_0x9aaf('0x21')]);}const _0x5f3673=_0x1414ce;_0x28b2ca=path[_0x9aaf('0x3f')](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x3d'));fs[_0x9aaf('0x2c')](_0x28b2ca,_0x1414ce,{'encoding':_0x9aaf('0x2d')});_0x131cac=path['resolve'](__dirname,_0x9aaf('0x29'),rs['generate'](0x4)+_0x9aaf('0x2b'));return convertFile(_0x28b2ca,_0x131cac);})[_0x9aaf('0x2e')](function(){try{fs[_0x9aaf('0x40')](_0x28b2ca);fs['chmodSync'](_0x131cac,_0x9aaf('0x30'));}catch(_0x1ec774){logger[_0x9aaf('0x16')](_0x1ec774);}logger['info'](_0x9aaf('0x4d'),_0x131cac['split']('.')[0x0]);return _0x131cac[_0x9aaf('0x31')]('.')[0x0];});};exports[_0x9aaf('0x4e')]=function(_0x1895f9,_0x407d79,_0x43974a){return google[_0x9aaf('0x4f')](_0x1895f9,_0x407d79,_0x43974a)[_0x9aaf('0x2e')](function(_0x4713d0){logger['info'](_0x4713d0[_0x9aaf('0x50')]);return rp(_0x4713d0);})[_0x9aaf('0x2e')](function(_0x490a96){var _0x39769b='';var _0x19f989=0x0;try{fs['unlink'](_0x1895f9);}catch(_0x152f6a){logger[_0x9aaf('0x16')](_0x152f6a);}if(_0x490a96&&_0x490a96[_0x9aaf('0x51')]){_0x39769b=_0x490a96['results'][_0x9aaf('0x52')](function(_0x552d82){return _0x552d82&&_0x552d82[_0x9aaf('0x53')][0x0]&&_0x552d82['alternatives'][0x0][_0x9aaf('0x54')]?_0x552d82[_0x9aaf('0x53')][0x0][_0x9aaf('0x54')]:'';})['join']('\x0a');_0x19f989=_0x490a96[_0x9aaf('0x51')][_0x9aaf('0x52')](function(_0x26c59e){return _0x26c59e&&_0x26c59e[_0x9aaf('0x53')][0x0]&&_0x26c59e[_0x9aaf('0x53')][0x0]['confidence']?_0x26c59e[_0x9aaf('0x53')][0x0][_0x9aaf('0x55')]:0x0;})[_0x9aaf('0x56')]('\x0a');}logger['info']('googleASR\x20transcription',_0x39769b);logger[_0x9aaf('0x26')](_0x9aaf('0x57'),_0x19f989);return{'transcript':_0x39769b,'confidence':_0x19f989};})['catch'](function(_0x2a490c){logger[_0x9aaf('0x16')](_0x9aaf('0x58'),_0x2a490c['statusCode'],_0x2a490c[_0x9aaf('0x59')],_0x2a490c[_0x9aaf('0x5a')]);});};exports['googleDialogflow']=function(_0x5e1852,_0x3b9d75,_0x2495a7,_0x410bf2){var _0x565742=apiai(_0x3b9d75,{'language':_0x410bf2||'en'});return _0x565742['textRequest'](_0x2495a7,{'sessionId':md5(_0x5e1852)})['then'](function(_0x242c35){logger[_0x9aaf('0x26')](JSON[_0x9aaf('0x46')](_0x242c35));return{'source':_0x242c35['result'][_0x9aaf('0x5b')],'resolvedQuery':_0x242c35[_0x9aaf('0x5c')][_0x9aaf('0x5d')],'action':_0x242c35['result'][_0x9aaf('0x5e')],'actionIncomplete':_0x242c35['result']['actionIncomplete'],'speech':_0x242c35['result'][_0x9aaf('0x5f')][_0x9aaf('0x60')],'score':_0x242c35[_0x9aaf('0x5c')][_0x9aaf('0x61')],'statusCode':_0x242c35[_0x9aaf('0x62')][_0x9aaf('0x63')],'endConversation':_0x242c35[_0x9aaf('0x5c')]['metadata'][_0x9aaf('0x64')]||![],'isFallbackIntent':_0x242c35['result'][_0x9aaf('0x65')][_0x9aaf('0x66')]};});};exports['googleDialogflowV2']=function(_0x4c5e1d,_0x23bc06,_0x972bda,_0x19d40c,_0x1ed153,_0x2ea6e9){var _0x2aef21=_0x19d40c[_0x9aaf('0x67')](/\\n/g,'\x0a');var _0x29b0cc={'credentials':{'private_key':_0x2aef21,'client_email':_0x972bda}};var _0x4c009b=new dialogflow[(_0x9aaf('0x68'))](_0x29b0cc);var _0x414508=_0x4c009b[_0x9aaf('0x69')](_0x23bc06,md5(_0x4c5e1d));var _0x27f56a={'session':_0x414508,'queryInput':{'text':{'text':_0x1ed153,'languageCode':_0x2ea6e9}}};return _0x4c009b[_0x9aaf('0x6a')](_0x27f56a)[_0x9aaf('0x2e')](function(_0x2893d8){if(_0x2893d8&&_0x2893d8['length']){logger['info'](_0x9aaf('0x6b'),JSON[_0x9aaf('0x46')](_0x2893d8));var _0x47e60a=_0x2893d8[0x0];if(_0x47e60a){var _0x4007f={'action':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x5e')],'allRequiredParamsPresent':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x6d')],'endConversation':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x6e')]&&_0x47e60a[_0x9aaf('0x6c')]['diagnosticInfo'][_0x9aaf('0x6f')]?_0x47e60a['queryResult']['diagnosticInfo']['fields'][_0x9aaf('0x70')]['boolValue']:![],'fulfillmentText':_0x47e60a['queryResult'][_0x9aaf('0x71')],'intentName':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x72')][_0x9aaf('0x59')],'intentDisplayName':_0x47e60a['queryResult']['intent'][_0x9aaf('0x73')],'isFallbackIntent':_0x47e60a[_0x9aaf('0x6c')]['intent'][_0x9aaf('0x74')],'languageCode':_0x47e60a['queryResult']['languageCode'],'queryText':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x75')],'responseId':_0x47e60a['responseId'],'score':_0x47e60a[_0x9aaf('0x6c')][_0x9aaf('0x76')],'speech':_0x47e60a['queryResult'][_0x9aaf('0x71')],'providerResponse':JSON[_0x9aaf('0x46')](_0x2893d8)};return _0x4007f;}}});};exports[_0x9aaf('0x77')]=function(_0xc42fce,_0x263ec4,_0x4a2d5c,_0x1c78f2){return tilde[_0x9aaf('0x4f')](_0xc42fce,_0x263ec4,_0x4a2d5c,_0x1c78f2)[_0x9aaf('0x2e')](function(_0x4fe5c6){try{fs[_0x9aaf('0x40')](_0xc42fce);}catch(_0x4463ab){logger[_0x9aaf('0x16')](_0x4463ab);}logger[_0x9aaf('0x26')](_0x9aaf('0x78'),_0x4fe5c6[_0x9aaf('0x54')]);logger[_0x9aaf('0x26')](_0x9aaf('0x79'),_0x4fe5c6[_0x9aaf('0x55')]);return _0x4fe5c6;});};exports['awsPolly']=function(_0xad81d3,_0x5c1667,_0x166597,_0x3ad45a,_0x158539,_0x1046cc){var _0xa4c72a=path[_0x9aaf('0x3f')](__dirname,_0x9aaf('0x29'),rs['generate'](0x4)+'.mp3');var _0xe2bb5f;return aws[_0x9aaf('0x7a')](_0xad81d3,_0x5c1667,_0x166597,_0x3ad45a,_0x158539,_0x1046cc,_0xa4c72a)[_0x9aaf('0x2e')](function(){_0xe2bb5f=path[_0x9aaf('0x3f')](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x2b'));return convertFile(_0xa4c72a,_0xe2bb5f);})[_0x9aaf('0x2e')](function(){try{fs['unlink'](_0xa4c72a);fs[_0x9aaf('0x2f')](_0xe2bb5f,'777');}catch(_0x25c791){logger[_0x9aaf('0x16')](_0x25c791);}return _0xe2bb5f[_0x9aaf('0x31')]('.')[0x0];});};exports[_0x9aaf('0x7b')]=function(_0x2e7c04,_0x23a204,_0x3c4326,_0x4a3bf4,_0x1246b7,_0x2d7f34){return aws[_0x9aaf('0x7c')](_0x2e7c04,_0x23a204,_0x3c4326,_0x4a3bf4,_0x1246b7,_0x2d7f34)['then'](function(_0x30a1e6){logger['info'](JSON[_0x9aaf('0x46')](_0x30a1e6));return _0x30a1e6;});};exports['ispeechTTS']=function(_0x4728df,_0x299a4f,_0x406335,_0x5a6717){var _0x8fe881=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4728df,encodeURIComponent(_0x299a4f),_0x406335,_0x5a6717);var _0x255901=path['resolve'](__dirname,_0x9aaf('0x29'),rs['generate'](0x4)+'.mp3');var _0x2ad6ac;return downloadFile(_0x8fe881,_0x255901)['then'](function(){_0x2ad6ac=path['resolve'](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+_0x9aaf('0x2b'));return convertFile(_0x255901,_0x2ad6ac);})[_0x9aaf('0x2e')](function(){try{fs[_0x9aaf('0x40')](_0x255901);fs['chmodSync'](_0x2ad6ac,'777');}catch(_0x2e5065){logger[_0x9aaf('0x16')](_0x2e5065);}return _0x2ad6ac[_0x9aaf('0x31')]('.')[0x0];});};exports[_0x9aaf('0x7d')]=function(_0xda3cfb,_0x3aa320,_0x4dd565,_0x538d9d){var _0x112137=util[_0x9aaf('0x7e')](_0x9aaf('0x7f'),ISPEECH_API,_0x3aa320,_0x4dd565,base64Encode(_0xda3cfb),_0x538d9d?util[_0x9aaf('0x7e')]('model=%s',encodeURIComponent(_0x538d9d)):_0x9aaf('0x80'));return uploadFile(_0x112137)['then'](function(_0x5e1665){return querystring['parse'](_0x5e1665);});};exports[_0x9aaf('0x81')]=function(_0x540063,_0x24d66e){return sestek[_0x9aaf('0x82')](_0x540063,_0x24d66e)[_0x9aaf('0x2e')](function(_0x403b4d){logger[_0x9aaf('0x26')](JSON[_0x9aaf('0x46')](_0x403b4d));var _0x24869e={'speech':_0x403b4d[_0x9aaf('0x83')],'action':_0x403b4d[_0x9aaf('0x84')]?_0x403b4d[_0x9aaf('0x84')][_0x9aaf('0x85')]:undefined,'actiondata':_0x403b4d['channelData']?_0x403b4d['channelData'][_0x9aaf('0x86')]:undefined};if(_0x403b4d[_0x9aaf('0x84')]&&_0x403b4d[_0x9aaf('0x84')][_0x9aaf('0x87')]){return base64Decode(_0x403b4d[_0x9aaf('0x84')]['AudioFromTts'][_0x9aaf('0x88')],path['resolve'](__dirname,_0x9aaf('0x29'),rs[_0x9aaf('0x2a')](0x4)+'.wav'))[_0x9aaf('0x2e')](function(_0x2a2dc5){_0x24869e[_0x9aaf('0x89')]=_0x2a2dc5;return _0x24869e;});}return _0x24869e;});};exports[_0x9aaf('0x8a')]=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 41d191f..fa5e623 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 _0xbff4=['exports'];(function(_0x57f8fa,_0x413e2b){var _0x89e95a=function(_0x1b98e7){while(--_0x1b98e7){_0x57f8fa['push'](_0x57f8fa['shift']());}};_0x89e95a(++_0x413e2b);}(_0xbff4,0x80));var _0x4bff=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xbff4[_0x3299d1];return _0x44356e;};var nda=require('./nda');module[_0x4bff('0x0')]={'nda':nda}; \ No newline at end of file +var _0xf7d9=['./nda','exports'];(function(_0x2fa566,_0xd1711c){var _0x3eb483=function(_0x55e05d){while(--_0x55e05d){_0x2fa566['push'](_0x2fa566['shift']());}};_0x3eb483(++_0xd1711c);}(_0xf7d9,0x1e8));var _0x9f7d=function(_0x11e0f3,_0xbfa958){_0x11e0f3=_0x11e0f3-0x0;var _0x2a93ce=_0xf7d9[_0x11e0f3];return _0x2a93ce;};var nda=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 55e569a..292ba1c 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 _0x33a4=['project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','body','info','stringify','url','agi','exports','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token'];(function(_0x325676,_0x1615a9){var _0xaababf=function(_0x22b03b){while(--_0x22b03b){_0x325676['push'](_0x325676['shift']());}};_0xaababf(++_0x1615a9);}(_0x33a4,0x88));var _0x433a=function(_0x1c4387,_0x3288ff){_0x1c4387=_0x1c4387-0x0;var _0x357041=_0x33a4[_0x1c4387];return _0x357041;};'use strict';var rp=require('request-promise');var url=require(_0x433a('0x0'));var logger=require('../../../../../config/logger')(_0x433a('0x1'));module[_0x433a('0x2')]=function(_0x1917aa,_0x4909a4){var _0x4b7aef={'method':'POST','uri':url[_0x433a('0x3')](_0x4909a4[_0x433a('0x4')],_0x433a('0x5')),'form':{'grant_type':_0x433a('0x6'),'username':_0x4909a4[_0x433a('0x7')],'password':_0x4909a4['password']},'json':!![]};return rp(_0x4b7aef)[_0x433a('0x8')](function(_0x58e65c){var _0x2c2404={'method':_0x433a('0x9'),'uri':url[_0x433a('0x3')](_0x4909a4[_0x433a('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x4909a4['ndaactivity_type']||_0x433a('0xb'),'channelId':_0x433a('0xc'),'conversation':{'id':_0x1917aa[_0x433a('0xd')]},'from':{'id':_0x1917aa[_0x433a('0xe')],'name':_0x1917aa[_0x433a('0xf')]},'recipient':{'id':_0x1917aa['dnid'],'name':_0x1917aa['extension']},'text':_0x4909a4[_0x433a('0x10')],'channelData':{}},'headers':{'Authorization':_0x433a('0x11')+_0x58e65c[_0x433a('0x12')]},'json':!![]};if(_0x4909a4[_0x433a('0x13')]){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x15')]=_0x4909a4['project'];}if(_0x4909a4[_0x433a('0x16')]=='1'){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x433a('0x18')};}if(_0x4909a4['custom_action']){_0x2c2404['body'][_0x433a('0x14')][_0x433a('0x19')]=_0x4909a4[_0x433a('0x1a')];if(_0x4909a4[_0x433a('0x1b')]){_0x2c2404[_0x433a('0x1c')]['channelData']['CustomActionData']=_0x4909a4[_0x433a('0x1b')];}}logger[_0x433a('0x1d')](JSON[_0x433a('0x1e')](_0x2c2404));return rp(_0x2c2404);});}; \ No newline at end of file +var _0x9cff=['ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username','then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','calleridname','dnid','text','access_token','body'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x37070e,_0x300cc9){_0x37070e=_0x37070e-0x0;var _0x7f275d=_0x9cff[_0x37070e];return _0x7f275d;};'use strict';var rp=require('request-promise');var url=require(_0xf9cf('0x0'));var logger=require(_0xf9cf('0x1'))(_0xf9cf('0x2'));module['exports']=function(_0x197da2,_0x142fc6){var _0x41a299={'method':'POST','uri':url[_0xf9cf('0x3')](_0x142fc6[_0xf9cf('0x4')],_0xf9cf('0x5')),'form':{'grant_type':_0xf9cf('0x6'),'username':_0x142fc6[_0xf9cf('0x7')],'password':_0x142fc6[_0xf9cf('0x6')]},'json':!![]};return rp(_0x41a299)[_0xf9cf('0x8')](function(_0x19d7f9){var _0x1c29f6={'method':_0xf9cf('0x9'),'uri':url[_0xf9cf('0x3')](_0x142fc6['ndassistant_url'],_0xf9cf('0xa')),'body':{'type':_0x142fc6[_0xf9cf('0xb')]||'message','channelId':_0xf9cf('0xc'),'conversation':{'id':_0x197da2['uniqueid']},'from':{'id':_0x197da2['callerid'],'name':_0x197da2[_0xf9cf('0xd')]},'recipient':{'id':_0x197da2[_0xf9cf('0xe')],'name':_0x197da2['extension']},'text':_0x142fc6[_0xf9cf('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x19d7f9[_0xf9cf('0x10')]},'json':!![]};if(_0x142fc6['project']){_0x1c29f6[_0xf9cf('0x11')]['channelData'][_0xf9cf('0x12')]=_0x142fc6[_0xf9cf('0x13')];}if(_0x142fc6[_0xf9cf('0x14')]=='1'){_0x1c29f6[_0xf9cf('0x11')][_0xf9cf('0x15')][_0xf9cf('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf9cf('0x17')};}if(_0x142fc6['custom_action']){_0x1c29f6[_0xf9cf('0x11')][_0xf9cf('0x15')][_0xf9cf('0x18')]=_0x142fc6[_0xf9cf('0x19')];if(_0x142fc6[_0xf9cf('0x1a')]){_0x1c29f6[_0xf9cf('0x11')][_0xf9cf('0x15')][_0xf9cf('0x1b')]=_0x142fc6[_0xf9cf('0x1a')];}}logger[_0xf9cf('0x1c')](JSON[_0xf9cf('0x1d')](_0x1c29f6));return rp(_0x1c29f6);});}; \ 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 15d89c2..d4f2f85 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 _0xa739=['./lib/api','exports'];(function(_0x295491,_0x4d8b4a){var _0x2a6742=function(_0xfa3f7d){while(--_0xfa3f7d){_0x295491['push'](_0x295491['shift']());}};_0x2a6742(++_0x4d8b4a);}(_0xa739,0x72));var _0x9a73=function(_0x2d23c4,_0x32be04){_0x2d23c4=_0x2d23c4-0x0;var _0x323c61=_0xa739[_0x2d23c4];return _0x323c61;};'use strict';var asr=require(_0x9a73('0x0'));module[_0x9a73('0x1')]=function(_0x19d803,_0xd52a17,_0x3c67a8,_0x22cc8e){return asr(_0x19d803,_0xd52a17,_0x3c67a8,_0x22cc8e);}; \ No newline at end of file +var _0xa89b=['exports'];(function(_0x25401e,_0x58490d){var _0x125b0c=function(_0x6c90b8){while(--_0x6c90b8){_0x25401e['push'](_0x25401e['shift']());}};_0x125b0c(++_0x58490d);}(_0xa89b,0x75));var _0xba89=function(_0x583a0b,_0x3c4d27){_0x583a0b=_0x583a0b-0x0;var _0x234c4a=_0xa89b[_0x583a0b];return _0x234c4a;};'use strict';var asr=require('./lib/api');module[_0xba89('0x0')]=function(_0x46aa54,_0x16ae4f,_0x6081d,_0x1502a3){return asr(_0x46aa54,_0x16ae4f,_0x6081d,_0x1502a3);}; \ 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 996688d..7342f91 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 _0x723e=['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','bluebird','lodash','moment','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','createReadStream','send','close','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.'];(function(_0x57417d,_0xe51207){var _0x5a0a3a=function(_0x2bb304){while(--_0x2bb304){_0x57417d['push'](_0x57417d['shift']());}};_0x5a0a3a(++_0xe51207);}(_0x723e,0xf3));var _0xe723=function(_0x14cd6e,_0x583fcf){_0x14cd6e=_0x14cd6e-0x0;var _0x4efbfb=_0x723e[_0x14cd6e];return _0x4efbfb;};'use strict';var BPromise=require(_0xe723('0x0'));var _=require(_0xe723('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe723('0x2'));var crypto=require(_0xe723('0x3'));var logger=require('../../../../../../config/logger')(_0xe723('0x4'));module[_0xe723('0x5')]=function(_0x16232b,_0x3fd094,_0x47e696,_0x4b7db9){return new BPromise(function(_0x529d03,_0x597725){logger[_0xe723('0x6')]('Tilde\x20URI',_0x4b7db9||_0xe723('0x7'));var _0x30e293=new WebSocket(_0x4b7db9||_0xe723('0x7'),{'perMessageDeflate':![]});var _0x1478ec='';var _0x16fce9='0';var _0x1612e1='1';var _0x598dea=_0xe723('0x8');function _0x5db5bc(_0x3743ed){var _0x4540cd=crypto[_0xe723('0x9')]('sha1');_0x4540cd[_0xe723('0xa')](_0x3743ed);return _0x4540cd[_0xe723('0xb')](_0xe723('0xc'));}function _0x1b43fe(){try{logger['info'](_0xe723('0xd'));var _0x4d7f5d=moment()['unix']();var _0x1aae10=_0x5db5bc(_0x4d7f5d+_0x3fd094+_0x47e696);_0x30e293['send'](JSON['stringify']({'appID':_0x3fd094,'timestamp':_0x4d7f5d,'appKey':_0x1aae10}));var _0x25d4bf=fs[_0xe723('0xe')](_0x16232b);_0x25d4bf['on']('data',function(_0x90c779){_0x30e293[_0xe723('0xf')](_0x90c779);});_0x25d4bf['on'](_0xe723('0x10'),function(){_0x30e293[_0xe723('0xf')]('EOS');});}catch(_0x2075e9){logger[_0xe723('0x11')](_0xe723('0x12'),JSON[_0xe723('0x13')](_0x2075e9));_0x30e293[_0xe723('0x14')]();}}function _0x2a5477(_0x4f800c){try{if(_0x4f800c){var _0x3a1a12=JSON[_0xe723('0x15')](_0x4f800c);switch(_0x3a1a12[_0xe723('0x16')]){case 0x0:if(_0x3a1a12[_0xe723('0x17')]){if(_0x3a1a12[_0xe723('0x17')][_0xe723('0x18')]){logger[_0xe723('0x6')](_0xe723('0x19'),JSON[_0xe723('0x13')](_0x3a1a12[_0xe723('0x17')][_0xe723('0x1a')]));_0x1478ec=_0x3a1a12[_0xe723('0x17')]['hypotheses'][0x0][_0xe723('0x1b')];_0x16fce9=_0x3a1a12[_0xe723('0x17')][_0xe723('0x1a')][0x0][_0xe723('0x1c')];_0x1612e1='0';_0x598dea=_0xe723('0x1d');_0x30e293[_0xe723('0x14')]();}}break;case 0x1:logger[_0xe723('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1612e1='1';_0x598dea=_0xe723('0x8');break;case 0x2:logger['info'](_0xe723('0x1e'));_0x1612e1='2';_0x598dea=_0xe723('0x1e');break;case 0x9:logger['info'](_0xe723('0x1f'));_0x1612e1='9';_0x598dea=_0xe723('0x1f');break;case 0xa:logger[_0xe723('0x6')](_0xe723('0x20'));_0x1612e1='10';_0x598dea=_0xe723('0x20');break;case 0xb:logger[_0xe723('0x6')](_0xe723('0x21'));_0x1612e1='11';_0x598dea='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1e81f6){logger[_0xe723('0x11')](_0xe723('0x22'),JSON[_0xe723('0x13')](_0x1e81f6));_0x30e293[_0xe723('0x14')]();}}function _0x193771(){logger[_0xe723('0x6')]('Close\x20Tilde\x20ASR\x20socket');_0x529d03({'transcript':_0x1478ec,'confidence':_0x16fce9,'status':_0x1612e1,'status_message':_0x598dea});}function _0x4b20ff(_0x5ba03f){logger['error'](_0xe723('0x23'));if(!_['isNil'](_0x5ba03f)){logger[_0xe723('0x11')](_[_0xe723('0x24')](_0x5ba03f)?JSON[_0xe723('0x13')](_0x5ba03f):_0x5ba03f);}}_0x30e293['on'](_0xe723('0x25'),_0x1b43fe);_0x30e293['on'](_0xe723('0x26'),_0x2a5477);_0x30e293['on'](_0xe723('0x10'),_0x193771);_0x30e293['on'](_0xe723('0x11'),_0x4b20ff);});}; \ No newline at end of file +var _0x2d6b=['digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','transcript','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','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','sha1'];(function(_0x24af1d,_0x45acd2){var _0x28b1c5=function(_0x3d8471){while(--_0x3d8471){_0x24af1d['push'](_0x24af1d['shift']());}};_0x28b1c5(++_0x45acd2);}(_0x2d6b,0xf1));var _0xb2d6=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x2d6b[_0x44bcb0];return _0xfaf881;};'use strict';var BPromise=require(_0xb2d6('0x0'));var _=require(_0xb2d6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb2d6('0x2'));var crypto=require(_0xb2d6('0x3'));var logger=require('../../../../../../config/logger')(_0xb2d6('0x4'));module[_0xb2d6('0x5')]=function(_0x255bdc,_0xe3955c,_0x6687bc,_0x3a0f0f){return new BPromise(function(_0x3e0ee1,_0x510efa){logger[_0xb2d6('0x6')](_0xb2d6('0x7'),_0x3a0f0f||_0xb2d6('0x8'));var _0x1f03aa=new WebSocket(_0x3a0f0f||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1c153c='';var _0x34675c='0';var _0x58b5f5='1';var _0xeb076b=_0xb2d6('0x9');function _0xa0559a(_0x21f99c){var _0x2cf10b=crypto['createHash'](_0xb2d6('0xa'));_0x2cf10b['update'](_0x21f99c);return _0x2cf10b[_0xb2d6('0xb')](_0xb2d6('0xc'));}function _0x1fb774(){try{logger[_0xb2d6('0x6')](_0xb2d6('0xd'));var _0x1f3f17=moment()[_0xb2d6('0xe')]();var _0x228977=_0xa0559a(_0x1f3f17+_0xe3955c+_0x6687bc);_0x1f03aa['send'](JSON['stringify']({'appID':_0xe3955c,'timestamp':_0x1f3f17,'appKey':_0x228977}));var _0x48c76f=fs['createReadStream'](_0x255bdc);_0x48c76f['on'](_0xb2d6('0xf'),function(_0x4583b4){_0x1f03aa[_0xb2d6('0x10')](_0x4583b4);});_0x48c76f['on'](_0xb2d6('0x11'),function(){_0x1f03aa[_0xb2d6('0x10')](_0xb2d6('0x12'));});}catch(_0x19dba1){logger[_0xb2d6('0x13')](_0xb2d6('0x14'),JSON[_0xb2d6('0x15')](_0x19dba1));_0x1f03aa[_0xb2d6('0x16')]();}}function _0x418e98(_0x4c4b7f){try{if(_0x4c4b7f){var _0x1037df=JSON[_0xb2d6('0x17')](_0x4c4b7f);switch(_0x1037df[_0xb2d6('0x18')]){case 0x0:if(_0x1037df[_0xb2d6('0x19')]){if(_0x1037df['result'][_0xb2d6('0x1a')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0xb2d6('0x15')](_0x1037df[_0xb2d6('0x19')]['hypotheses']));_0x1c153c=_0x1037df[_0xb2d6('0x19')]['hypotheses'][0x0][_0xb2d6('0x1b')];_0x34675c=_0x1037df[_0xb2d6('0x19')][_0xb2d6('0x1c')][0x0][_0xb2d6('0x1d')];_0x58b5f5='0';_0xeb076b=_0xb2d6('0x1e');_0x1f03aa[_0xb2d6('0x16')]();}}break;case 0x1:logger['info'](_0xb2d6('0x9'));_0x58b5f5='1';_0xeb076b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb2d6('0x6')](_0xb2d6('0x1f'));_0x58b5f5='2';_0xeb076b='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x58b5f5='9';_0xeb076b=_0xb2d6('0x20');break;case 0xa:logger['info'](_0xb2d6('0x21'));_0x58b5f5='10';_0xeb076b='Authentication\x20failed.';break;case 0xb:logger[_0xb2d6('0x6')](_0xb2d6('0x22'));_0x58b5f5='11';_0xeb076b=_0xb2d6('0x22');}}}catch(_0x6b6f08){logger[_0xb2d6('0x13')](_0xb2d6('0x23'),JSON[_0xb2d6('0x15')](_0x6b6f08));_0x1f03aa[_0xb2d6('0x16')]();}}function _0x4285bd(){logger[_0xb2d6('0x6')](_0xb2d6('0x24'));_0x3e0ee1({'transcript':_0x1c153c,'confidence':_0x34675c,'status':_0x58b5f5,'status_message':_0xeb076b});}function _0x5a8a67(_0x44e479){logger['error'](_0xb2d6('0x25'));if(!_[_0xb2d6('0x26')](_0x44e479)){logger[_0xb2d6('0x13')](_[_0xb2d6('0x27')](_0x44e479)?JSON[_0xb2d6('0x15')](_0x44e479):_0x44e479);}}_0x1f03aa['on'](_0xb2d6('0x28'),_0x1fb774);_0x1f03aa['on'](_0xb2d6('0x29'),_0x418e98);_0x1f03aa['on']('close',_0x4285bd);_0x1f03aa['on'](_0xb2d6('0x13'),_0x5a8a67);});}; \ 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 834787d..6ad06f7 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 _0xe0f4=['exports','./asr'];(function(_0x9d315a,_0x5b9349){var _0x8370d=function(_0x21a321){while(--_0x21a321){_0x9d315a['push'](_0x9d315a['shift']());}};_0x8370d(++_0x5b9349);}(_0xe0f4,0x177));var _0x4e0f=function(_0x29a056,_0xdb8a9a){_0x29a056=_0x29a056-0x0;var _0x166500=_0xe0f4[_0x29a056];return _0x166500;};var asr=require(_0x4e0f('0x0'));module[_0x4e0f('0x1')]={'asr':asr}; \ No newline at end of file +var _0x802c=['./asr','exports'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x802c,0x18a));var _0xc802=function(_0x18dc02,_0x5b48d9){_0x18dc02=_0x18dc02-0x0;var _0x35be0e=_0x802c[_0x18dc02];return _0x35be0e;};var asr=require(_0xc802('0x0'));module[_0xc802('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index cd9b3f3..a52f620 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +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(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 e177b1a..8ac83ed 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 _0xa958=['NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','toUpperCase','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','intKey','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','opts','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','getVariable','catch','getVoiceQueue','getVoiceQueueById','then','name','getSquareProject','getSquareProjectById','prototype','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','uniqueid','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','url','method','timeout','number','POST','PUT','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','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','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','createSquareMessage','googleDialogflow','DIALOGFLOW_%s','speech','dialogflow','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','beep'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa958,0x94));var _0x8a95=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa958[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x8a95('0x0'));var _=require('lodash');var sh=require(_0x8a95('0x1'));var odbc=require(_0x8a95('0x2'))();var rs=require(_0x8a95('0x3'));var moment=require(_0x8a95('0x4'));var Mustache=require(_0x8a95('0x5'));var rp=require(_0x8a95('0x6'));var logger=require('../../config/logger')('agi');var config=require(_0x8a95('0x7'));var shared=require(_0x8a95('0x8'));var scripts=require(_0x8a95('0x9'));var FILES_PATH=_0x8a95('0xa');var recursiveMapAttributes=[_0x8a95('0xb'),_0x8a95('0xc')];var verticesWithRetry=[_0x8a95('0xd'),'getdigits',_0x8a95('0xe')];var AGIVertices=function(_0x1e5a06,_0x1f944c,_0x240b22){this[_0x8a95('0xf')]=_0x1e5a06;this[_0x8a95('0x10')]=_0x1f944c;this[_0x8a95('0x11')]=_0x240b22;};AGIVertices['prototype'][_0x8a95('0x12')]=function(_0x98e81c,_0x574fef){this[_0x8a95('0x10')]['getVariableById'](_0x98e81c)['then'](function(_0x108b6f){_0x574fef(null,_0x108b6f?_0x108b6f['name']:![]);})[_0x8a95('0x13')](function(_0x1579cd){_0x574fef(_0x1579cd);});};AGIVertices['prototype'][_0x8a95('0x14')]=function(_0x189505,_0x59c5cc){this[_0x8a95('0x10')][_0x8a95('0x15')](_0x189505)[_0x8a95('0x16')](function(_0x3cae29){_0x59c5cc(null,_0x3cae29?_0x3cae29[_0x8a95('0x17')]:![]);})[_0x8a95('0x13')](function(_0x13922b){_0x59c5cc(_0x13922b);});};AGIVertices['prototype'][_0x8a95('0x18')]=function(_0x556592,_0x334b18){this['rpc'][_0x8a95('0x19')](_0x556592)[_0x8a95('0x16')](function(_0x2d6305){_0x334b18(null,_0x2d6305?_0x2d6305[_0x8a95('0x17')]:![]);})[_0x8a95('0x13')](function(_0x33e007){_0x334b18(_0x33e007);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b')]=function(_0x2b0eaf,_0x23da17){this[_0x8a95('0x10')][_0x8a95('0x1c')](_0x2b0eaf)[_0x8a95('0x16')](function(_0x361804){_0x23da17(null,_0x361804?_0x361804[_0x8a95('0x1d')]:![]);})[_0x8a95('0x13')](function(_0x1e812e){_0x23da17(_0x1e812e);});};AGIVertices['prototype']['getUser']=function(_0x476c2c,_0x25e5a7){this[_0x8a95('0x10')][_0x8a95('0x1e')](_0x476c2c)[_0x8a95('0x16')](function(_0xfc238){_0x25e5a7(null,_0xfc238?_0xfc238['name']:![]);})['catch'](function(_0x29a731){_0x25e5a7(_0x29a731);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1f')]=function(_0x23130a,_0x223737){this[_0x8a95('0x10')][_0x8a95('0x20')](_0x23130a)[_0x8a95('0x16')](function(_0x3e880b){_0x223737(null,_0x3e880b?_0x3e880b[_0x8a95('0x17')]:![]);})['catch'](function(_0x1a98e0){_0x223737(_0x1a98e0);});};AGIVertices[_0x8a95('0x1a')]['getSound']=function(_0x1d21a9,_0x582d2c){var _0x508b0f=this;this[_0x8a95('0x10')]['getSoundById'](_0x1d21a9)[_0x8a95('0x16')](function(_0x5d961f){_0x582d2c(null,_0x5d961f?_0x508b0f[_0x8a95('0x21')](_0x5d961f[_0x8a95('0x22')]):![]);})[_0x8a95('0x13')](function(_0x13e2ed){_0x582d2c(_0x13e2ed);});};AGIVertices[_0x8a95('0x1a')]['getMailAccount']=function(_0x23252e,_0x5e0837){this['rpc'][_0x8a95('0x23')](_0x23252e)['then'](function(_0x511925){_0x5e0837(null,_0x511925?_0x511925:![]);})[_0x8a95('0x13')](function(_0x186745){_0x5e0837(_0x186745);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x24')]=function(_0x3091aa,_0x2d0a28,_0x371ad3){this[_0x8a95('0x11')][_0x8a95('0x24')](_0x3091aa,_0x2d0a28)[_0x8a95('0x16')](function(){_0x371ad3(null);})[_0x8a95('0x13')](function(_0x311239){_0x371ad3(_0x311239);});};AGIVertices[_0x8a95('0x1a')]['getIntervals']=function(_0x2edb09,_0x5e647f){this['rpc'][_0x8a95('0x25')](_0x2edb09)[_0x8a95('0x16')](function(_0x25e55a){if(_0x25e55a){if(_0x25e55a['IntervalId']){_0x5e647f(null,[_0x25e55a[_0x8a95('0x26')]]);}else{_0x5e647f(null,_[_0x8a95('0x27')](_0x25e55a[_0x8a95('0x28')],_0x8a95('0x26')));}}else{_0x5e647f(null,![]);}})[_0x8a95('0x13')](function(_0x411bf3){_0x5e647f(_0x411bf3);});};AGIVertices[_0x8a95('0x1a')]['getSoundPath']=function(_0x432d01){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x432d01);};AGIVertices['prototype']['getQueryOdbc']=function(_0x504f9e,_0x57e522,_0x129edc){odbc[_0x8a95('0x29')](_0x504f9e,function(_0x980019){if(_0x980019){logger[_0x8a95('0x2a')](_0x8a95('0x2b'),_0x980019);_0x129edc(_0x980019);}else{logger[_0x8a95('0x2c')](_0x8a95('0x2d'));odbc[_0x8a95('0x2e')](_0x57e522,function(_0x557608,_0x2752d2){if(_0x557608){logger['info'](_0x8a95('0x2f'),_0x57e522);_0x129edc(_0x557608);}else{logger[_0x8a95('0x2c')](_0x8a95('0x30'),_0x57e522);odbc[_0x8a95('0x31')](function(_0x1e7592){if(_0x1e7592){logger[_0x8a95('0x2a')](_0x8a95('0x32'),_0x1e7592);}_0x129edc(null,_0x2752d2);});}});}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x33')]=function(_0x3bccb9,_0x1aba8d){this['rpc'][_0x8a95('0x34')](_0x3bccb9)['then'](function(_0x358a9c){_0x1aba8d(null,_0x358a9c?_0x358a9c:![]);})['catch'](function(_0x5e0c6d){_0x1aba8d(_0x5e0c6d);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x35')]=function(_0xabf2b2,_0x453815){this[_0x8a95('0x10')][_0x8a95('0x35')](_0xabf2b2)['then'](function(_0xab4e60){_0x453815(null,_0xab4e60);})[_0x8a95('0x13')](function(_0x5e7479){_0x453815(_0x5e7479);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x36')]=function(_0xff9088,_0x2e983a,_0x2729db){this[_0x8a95('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x8a95('0xf')]['uniqueid'],'node':_0xff9088[_0x8a95('0x37')],'application':_0xff9088[_0x8a95('0x38')],'data':_0x2e983a||null,'project_name':this[_0x8a95('0xf')]['arg_1'],'callerid':this[_0x8a95('0xf')][_0x8a95('0x39')]})['then'](function(_0x503585){if(_0x2729db){_0x2729db(null,_0x503585);}})[_0x8a95('0x13')](function(_0x54c193){if(_0x2729db){_0x2729db(_0x54c193);}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x3a')]=function(_0x4cbffb,_0x192bc9,_0x2f3b23,_0x3dfb84){this[_0x8a95('0x10')][_0x8a95('0x3a')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8a95('0xf')]['callerid'],'calleridname':this[_0x8a95('0xf')][_0x8a95('0x3b')],'context':this[_0x8a95('0xf')][_0x8a95('0x3c')],'extension':this['channel'][_0x8a95('0x3d')],'priority':this[_0x8a95('0xf')][_0x8a95('0x3e')],'accountcode':this[_0x8a95('0xf')][_0x8a95('0x3f')],'dnid':this[_0x8a95('0xf')][_0x8a95('0x40')],'projectName':this[_0x8a95('0xf')]['arg_1'],'saveName':_0x192bc9,'filename':_0x4cbffb[_0x8a95('0x41')]||_0x192bc9,'savePath':_0x2f3b23})['then'](function(_0x2e29ab){_0x3dfb84(null,_0x2e29ab);})[_0x8a95('0x13')](function(_0x463a5b){_0x3dfb84(_0x463a5b);});};AGIVertices[_0x8a95('0x1a')]['createSquareMessage']=function(_0x541438,_0x40280b,_0x529e93,_0x744326,_0x50bc10){this[_0x8a95('0x10')]['createSquareMessage']({'uniqueid':this[_0x8a95('0xf')][_0x8a95('0x42')],'body':_0x541438,'direction':_0x40280b,'providerName':_0x529e93,'providerResponse':_0x744326})[_0x8a95('0x16')](function(_0x1460c7){if(_0x50bc10){_0x50bc10(null,_0x1460c7);}})[_0x8a95('0x13')](function(_0x29afff){if(_0x50bc10){_0x50bc10(_0x29afff);}});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x43')]=function(_0xeabff1,_0x561831){this[_0x8a95('0x10')][_0x8a95('0x43')]({'firstName':_[_0x8a95('0x44')](_0xeabff1['name'])||_[_0x8a95('0x45')](_0xeabff1[_0x8a95('0x17')])?_0x8a95('0x46')+Math['random']():_0xeabff1[_0x8a95('0x17')],'lastName':_[_0x8a95('0x44')](_0xeabff1[_0x8a95('0x47')])||_['isNil'](_0xeabff1[_0x8a95('0x47')])?null:_0xeabff1[_0x8a95('0x47')],'phone':_0xeabff1['phone'],'ListId':_0xeabff1[_0x8a95('0x48')],'scheduledat':_0xeabff1[_0x8a95('0x49')],'callbackUniqueid':this[_0x8a95('0xf')]['uniqueid'],'tags':_0x8a95('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0xeabff1[_0x8a95('0x49')][_0x8a95('0x4b')](),'priority':_0xeabff1[_0x8a95('0x4c')]})['then'](function(_0xe04bed){_0x561831(null,_0xe04bed);})[_0x8a95('0x13')](function(_0x155556){_0x561831(_0x155556);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x4d')]=function(_0x3a267a,_0x488f26){this['rpc'][_0x8a95('0x4e')](_0x3a267a)['then'](function(_0x1db297){_0x488f26(null,_0x1db297?_0x1db297['name']:![]);})[_0x8a95('0x13')](function(_0x1597d8){_0x488f26(_0x1597d8);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x4f')]=function(_0x33baeb,_0x4923d1,_0x1d87eb){var _0x4bf6c2={'role':_0x8a95('0x50')};_0x4bf6c2[_0x33baeb]=this[_0x8a95('0xf')]['callerid'];this[_0x8a95('0x10')][_0x8a95('0x4f')](_0x4bf6c2,_0x4923d1,this['channel']['uniqueid'])['then'](function(_0x46fb97){_0x1d87eb(null,_[_0x8a95('0x45')](_0x46fb97)?![]:!![]);})[_0x8a95('0x13')](function(_0x3203f7){logger[_0x8a95('0x2a')](_0x3203f7);_0x1d87eb(null,![]);});};AGIVertices[_0x8a95('0x1a')]['agentUnpause']=function(_0x5f1777,_0x42cb08){var _0x3f2f35={'role':_0x8a95('0x50')};_0x3f2f35[_0x5f1777]=this[_0x8a95('0xf')][_0x8a95('0x39')];this[_0x8a95('0x10')][_0x8a95('0x51')](_0x3f2f35)[_0x8a95('0x16')](function(_0x1ffad9){_0x42cb08(null,_[_0x8a95('0x45')](_0x1ffad9)?![]:!![]);})[_0x8a95('0x13')](function(_0x46bffd){logger['error'](_0x46bffd);_0x42cb08(null,![]);});};AGIVertices[_0x8a95('0x1a')]['agentLogout']=function(_0x21b395,_0x4426dc){var _0x6206fe={'role':_0x8a95('0x50')};_0x6206fe[_0x21b395]=this[_0x8a95('0xf')][_0x8a95('0x39')];this[_0x8a95('0x10')][_0x8a95('0x52')](_0x6206fe)[_0x8a95('0x16')](function(_0x49395f){_0x4426dc(null,_[_0x8a95('0x45')](_0x49395f)?![]:!![]);})[_0x8a95('0x13')](function(_0x584bf9){logger['error'](_0x584bf9);_0x4426dc(null,![]);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x53')]=function(_0x3475e0,_0x58192c){var _0x1c0321={'role':'agent'};_0x1c0321[_0x3475e0]=this[_0x8a95('0xf')]['callerid'];var _0x24fba1=_0x3475e0!=_0x8a95('0x54')?util[_0x8a95('0x55')](_0x8a95('0x56'),_0x8a95('0x57'),this[_0x8a95('0xf')][_0x8a95('0x39')]):undefined;this[_0x8a95('0x10')][_0x8a95('0x53')](_0x1c0321,_0x24fba1)[_0x8a95('0x16')](function(_0x1ea4f8){_0x58192c(null,_[_0x8a95('0x45')](_0x1ea4f8)?![]:!![]);})[_0x8a95('0x13')](function(_0x11e1ad){logger[_0x8a95('0x2a')](_0x11e1ad);_0x58192c(null,![]);});};AGIVertices['prototype'][_0x8a95('0x58')]=function(_0xb576bd,_0x40c552){sh[_0x8a95('0x59')](_['trim'](_0xb576bd),function(_0x52130e,_0x5772db){var _0x379c60=_0x5772db[_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'');_0x40c552(null,_0x379c60);});};AGIVertices['prototype'][_0x8a95('0x5b')]=function(_0x5bf56b,_0x3ebb7f){scripts[_0x8a95('0x5b')](_0x5bf56b[_0x8a95('0x5c')],_0x5bf56b[_0x8a95('0x5d')]||_0x8a95('0x5e'),_0x5bf56b[_0x8a95('0x5e')],_0x5bf56b[_0x8a95('0x5f')]||'en-US',_0x5bf56b[_0x8a95('0x60')]||_0x8a95('0x61'),_0x5bf56b['audioEncoding']||_0x8a95('0x62'))[_0x8a95('0x16')](function(_0x31226a){_0x3ebb7f(null,_0x31226a);})[_0x8a95('0x13')](function(_0x13e659){_0x3ebb7f(_0x13e659);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x63')]=function(_0x4564a7,_0x455b2f){scripts[_0x8a95('0x63')](_0x4564a7[_0x8a95('0x5e')],_0x4564a7['google_tts_language']||'en',0x1)[_0x8a95('0x16')](function(_0x4e42e6){_0x455b2f(null,_0x4e42e6);})[_0x8a95('0x13')](function(_0x2c00be){_0x455b2f(_0x2c00be);});};AGIVertices[_0x8a95('0x1a')]['restAPI']=function(_0x2485bb,_0x244ac9){var _0x4fa511={'uri':_0x2485bb[_0x8a95('0x64')],'method':_0x2485bb[_0x8a95('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2485bb[_0x8a95('0x66')])===_0x8a95('0x67')&&parseInt(_0x2485bb[_0x8a95('0x66')])>=0x1?parseInt(_0x2485bb[_0x8a95('0x66')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8a95('0x68'),_0x8a95('0x69')],_0x4fa511['method']['toUpperCase']())){try{_0x4fa511[_0x8a95('0x6a')]=_0x2485bb['rawBody']?JSON['parse'](_0x2485bb['rawBody']):{};}catch(_0x22da9e){logger[_0x8a95('0x2a')](_0x8a95('0x6b'),_0x22da9e);}}try{_0x4fa511[_0x8a95('0x6c')]=_0x2485bb[_0x8a95('0xb')]?JSON[_0x8a95('0x6d')](_0x2485bb[_0x8a95('0xb')]):{};}catch(_0x201fb1){logger['error'](_0x8a95('0x6e'),_0x201fb1);}if(_0x2485bb[_0x8a95('0x6f')]){try{var _0x403d8e=require(_0x2485bb['computedVariables'])[_0x8a95('0x70')](this,_0x4fa511);_0x4fa511[_0x8a95('0x71')]=Mustache[_0x8a95('0x72')](_0x2485bb[_0x8a95('0x64')],_0x403d8e,{},['$$','$$']);if(_0x4fa511['headers']){_0x4fa511[_0x8a95('0x6c')]=JSON['parse'](Mustache[_0x8a95('0x72')](JSON[_0x8a95('0x73')](_0x4fa511[_0x8a95('0x6c')]),_0x403d8e,{},['$$','$$']));}if(_0x4fa511[_0x8a95('0x6a')]){_0x4fa511['body']=JSON[_0x8a95('0x6d')](Mustache['render'](JSON['stringify'](_0x4fa511['body']),_0x403d8e,{},['$$','$$']));}}catch(_0x297fb2){logger[_0x8a95('0x2a')](_0x8a95('0x74'),_0x297fb2);}}rp(_0x4fa511)[_0x8a95('0x16')](function(_0x511fd2){var _0x284af6={'statusCode':_0x511fd2[_0x8a95('0x75')]||0xc8,'statusMessage':_0x511fd2[_0x8a95('0x76')]||'OK','headers':_0x511fd2[_0x8a95('0x6c')]||{},'body':_0x511fd2[_0x8a95('0x6a')]||{}};_0x244ac9(null,_0x284af6);})[_0x8a95('0x13')](function(_0x511dc5){var _0x192388={'statusCode':_0x511dc5['statusCode']||0x1f4,'statusMessage':_0x511dc5[_0x8a95('0x77')]||_0x8a95('0x78'),'headers':_0x511dc5['options'][_0x8a95('0x6c')]||{},'body':_0x511dc5[_0x8a95('0x79')][_0x8a95('0x6a')]||{}};_0x244ac9(null,_0x192388);});};AGIVertices['prototype']['googleDialogflow']=function(_0x201d40,_0x1162c5){scripts['googleDialogflow'](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x201d40[_0x8a95('0x7a')],_0x201d40['text'],_0x201d40[_0x8a95('0x7b')]||'en')[_0x8a95('0x16')](function(_0x4e25fa){_0x1162c5(null,_0x4e25fa);})[_0x8a95('0x13')](function(_0x14e2ca){_0x1162c5(_0x14e2ca);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x7c')]=function(_0x57aaa0,_0x32534c){scripts[_0x8a95('0x7c')](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x57aaa0[_0x8a95('0x7d')],_0x57aaa0[_0x8a95('0x7e')],_0x57aaa0[_0x8a95('0x7f')],_0x57aaa0[_0x8a95('0x5e')],_0x57aaa0['dialogflowV2_language']||'en')[_0x8a95('0x16')](function(_0x48ba2e){_0x32534c(null,_0x48ba2e);})['catch'](function(_0x1fa486){_0x32534c(_0x1fa486);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x80')]=function(_0x324001,_0xf988aa){scripts['sestekNDA'](this[_0x8a95('0xf')],_0x324001)[_0x8a95('0x16')](function(_0x24f059){_0xf988aa(null,_0x24f059);})[_0x8a95('0x13')](function(_0x22d413){_0xf988aa(_0x22d413);});};AGIVertices['prototype']['ispeechTTS']=function(_0x392332,_0x1fe5b2){scripts[_0x8a95('0x81')](_0x392332[_0x8a95('0x7a')],_0x392332[_0x8a95('0x5e')],_0x392332['ispeech_tts_language']||_0x8a95('0x82'),_0x392332[_0x8a95('0x83')])['then'](function(_0x5a34a4){_0x1fe5b2(null,_0x5a34a4);})[_0x8a95('0x13')](function(_0x19976d){_0x1fe5b2(_0x19976d);});};AGIVertices['prototype'][_0x8a95('0x84')]=function(_0xc928e0,_0x3459f9,_0xc53840){scripts[_0x8a95('0x84')](_0x3459f9,_0xc928e0[_0x8a95('0x7a')],_0xc928e0['ispeech_asr_language']||_0x8a95('0x82'),this[_0x8a95('0x85')](_0xc928e0[_0x8a95('0x86')])?_0xc928e0[_0x8a95('0x86')]:undefined)['then'](function(_0x177ba6){_0xc53840(null,_0x177ba6);})[_0x8a95('0x13')](function(_0x503d4d){_0xc53840(_0x503d4d);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x87')]=function(_0x5ecf4f,_0x6694be){scripts[_0x8a95('0x87')](_0x5ecf4f[_0x8a95('0x88')],_0x5ecf4f[_0x8a95('0x89')],_0x5ecf4f[_0x8a95('0x8a')],_0x5ecf4f['aws_polly_voice']||'Amy',_0x5ecf4f[_0x8a95('0x5e')],_0x5ecf4f['aws_text_type']||_0x8a95('0x5e'))[_0x8a95('0x16')](function(_0xa661a){_0x6694be(null,_0xa661a);})[_0x8a95('0x13')](function(_0x351d51){_0x6694be(_0x351d51);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x8b')]=function(_0x184897,_0xb13730){scripts[_0x8a95('0x8b')](this[_0x8a95('0xf')][_0x8a95('0x42')],_0x184897[_0x8a95('0x88')],_0x184897['aws_secret_access_key'],_0x184897[_0x8a95('0x8c')],_0x184897[_0x8a95('0x5e')],_0x184897[_0x8a95('0x8d')])[_0x8a95('0x16')](function(_0x2965ff){_0xb13730(null,_0x2965ff);})[_0x8a95('0x13')](function(_0x1dcdc2){_0xb13730(_0x1dcdc2);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x8e')]=function(_0x8b8a21,_0x1b897b,_0x514f1d){scripts[_0x8a95('0x8e')](_0x1b897b,_0x8b8a21[_0x8a95('0x7a')],_0x8b8a21[_0x8a95('0x8f')]||'en-US')[_0x8a95('0x16')](function(_0x34f796){_0x514f1d(null,_0x34f796);})[_0x8a95('0x13')](function(_0x583d84){_0x514f1d(_0x583d84);});};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x90')]=function(_0x1fdce3,_0x19005a,_0x16d3b9){scripts[_0x8a95('0x90')](_0x19005a,_0x1fdce3[_0x8a95('0x91')],_0x1fdce3[_0x8a95('0x92')],_0x1fdce3['uri'])[_0x8a95('0x16')](function(_0x5086b0){_0x16d3b9(null,_0x5086b0);})[_0x8a95('0x13')](function(_0x55ad3a){_0x16d3b9(_0x55ad3a);});};AGIVertices[_0x8a95('0x1a')]['clear']=function(_0x1bd5b4){var _0x238703=_[_0x8a95('0x93')](verticesWithRetry,_0x1bd5b4[_0x8a95('0x38')])?_0x1bd5b4:_['clone'](_0x1bd5b4);for(var _0x728c42 in _0x238703){if(_0x238703[_0x8a95('0x94')](_0x728c42)){if(_0x238703[_0x728c42]&&_[_0x8a95('0x95')](_0x238703[_0x728c42])){if(_['includes'](recursiveMapAttributes,_0x728c42)){_0x238703[_0x728c42]=this[_0x8a95('0x96')](_0x238703[_0x728c42]);}else{_0x238703[_0x728c42]=this['replaceAllVariables'](_0x238703[_0x728c42]);}}}}return _0x238703;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x97')]=function(_0xbf4c82){for(var _0x2a58d7 in _0xbf4c82){if(_0xbf4c82['hasOwnProperty'](_0x2a58d7)){if(_[_0x8a95('0x98')](_0xbf4c82[_0x2a58d7])){this[_0x8a95('0x97')](_0xbf4c82[_0x2a58d7]);}else if(_['isArray'](_0xbf4c82[_0x2a58d7])){for(var _0x15f022=0x0;_0x15f022<_0xbf4c82[_0x2a58d7][_0x8a95('0x99')];_0x15f022++){this[_0x8a95('0x97')](_0xbf4c82[_0x2a58d7][_0x15f022]);}}else if(_[_0x8a95('0x95')](_0xbf4c82[_0x2a58d7])){_0xbf4c82[_0x2a58d7]=this[_0x8a95('0x9a')](_0xbf4c82[_0x2a58d7]);}}}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x9b')]=function(_0x35d44a,_0x66af1){for(var _0x118321 in _0x35d44a){if(_0x35d44a[_0x8a95('0x94')](_0x118321)){if(_[_0x8a95('0x98')](_0x35d44a[_0x118321])){if(!_[_0x8a95('0x44')](_0x35d44a[_0x118321])){this['saveRestApiResult'](_0x35d44a[_0x118321],util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321));}}else if(_[_0x8a95('0x9d')](_0x35d44a[_0x118321])){for(var _0xffcbb9=0x0;_0xffcbb9<_0x35d44a[_0x118321][_0x8a95('0x99')];_0xffcbb9++){this[_0x8a95('0x9b')](_0x35d44a[_0x118321][_0xffcbb9],util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321+'['+_0xffcbb9+']'));}}else{if(!_[_0x8a95('0x45')](_0x35d44a[_0x118321])){this[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x66af1,_0x118321),_0x35d44a[_0x118321]);}}}}};AGIVertices[_0x8a95('0x1a')]['replaceObjectAllVariables']=function(_0x3aa0d8){try{var _0x435021=JSON['parse'](_0x3aa0d8);this[_0x8a95('0x97')](_0x435021);return JSON[_0x8a95('0x73')](_0x435021);}catch(_0x410bb1){return this[_0x8a95('0x9a')](_0x3aa0d8);}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x9a')]=function(_0x2eaf8b){var _0x182df9=_0x2eaf8b[_0x8a95('0x9f')]('{');for(var _0x5327a1=0x1;_0x5327a1<_0x182df9[_0x8a95('0x99')];_0x5327a1+=0x1){var _0x169a83=_0x182df9[_0x5327a1][_0x8a95('0x9f')]('}');if(_0x169a83['length']>0x1){_0x2eaf8b=_0x2eaf8b['replaceAll']('{'+_0x169a83[0x0]+'}',this[_0x8a95('0xf')]['getVariable'](_0x169a83[0x0])[_0x8a95('0xa0')]||_0x169a83[0x0]);}}if(_0x182df9['length']===0x1){return _0x2eaf8b[_0x8a95('0x4b')]();}return this[_0x8a95('0x9a')](_0x2eaf8b);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xa1')]=function(_0x5f55b0,_0x2ff2e4){var _0x4cbb96=this[_0x8a95('0xf')][_0x8a95('0x12')](_0x5f55b0);if(_0x4cbb96[_0x8a95('0xa2')]===-0x1){return _0x4cbb96;}logger[_0x8a95('0x2c')](util['format'](_0x8a95('0xa3'),_0x2ff2e4,_0x4cbb96[_0x8a95('0xa0')]));return this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x2ff2e4,_0x4cbb96[_0x8a95('0xa0')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x85')]=function(_0x5b9f63){return _0x5b9f63&&_0x5b9f63!=='0'&&_0x5b9f63!=='-1'&&_0x5b9f63!=='';};AGIVertices['prototype'][_0x8a95('0xa4')]=function(_0x4c2ed9){this[_0x8a95('0x36')]['sync'](this,_0x4c2ed9,'-');_0x4c2ed9[_0x8a95('0xa5')]=_0x4c2ed9['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xa6')]=function(_0x1754c7){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xa7'),_0x1754c7['label']));if(!this[_0x8a95('0x85')](_0x1754c7[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}var _0x3cb114='\x22'+_0x1754c7[_0x8a95('0x5e')]+'\x22';if(this[_0x8a95('0x85')](_0x1754c7[_0x8a95('0x79')])){_0x3cb114+=','+_0x1754c7['options'];}var _0x45e646=this['channel']['exec'](_0x8a95('0xaa'),_0x3cb114);if(_0x45e646['result']===-0x1){return _0x45e646;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3cb114));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xab')]=function(_0x1f9428){logger['info'](util['format'](_0x8a95('0xac'),_0x1f9428[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x1f9428[_0x8a95('0xad')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xae'));}var _0x110d3a=_0x1f9428[_0x8a95('0xad')];if(this['isConfigured'](_0x1f9428[_0x8a95('0x79')])){_0x110d3a+=','+_0x1f9428[_0x8a95('0x79')];}var _0x8d7ff3=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0xaf'),_0x110d3a);if(_0x8d7ff3[_0x8a95('0xa2')]===-0x1){return _0x8d7ff3;}var _0x1f9a3d=this['getAndSetVariable'](_0x8a95('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x1f9a3d[_0x8a95('0xa2')]===-0x1){return _0x1f9a3d;}var _0x5b31cc=this[_0x8a95('0xa1')](_0x8a95('0xb1'),_0x8a95('0xb2'));if(_0x5b31cc['result']===-0x1){return _0x5b31cc;}var _0x1b4c42=this[_0x8a95('0xa1')](_0x8a95('0xb3'),_0x8a95('0xb4'));if(_0x1b4c42[_0x8a95('0xa2')]===-0x1){return _0x1b4c42;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xb5'),_0x110d3a));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xb6')]=function(_0x12a59b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xb7'),_0x12a59b[_0x8a95('0x37')]));return this[_0x8a95('0xf')]['agi']([_0x12a59b['command'],_0x12a59b[_0x8a95('0xb8')]]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xb9')]=function(_0x540fc8){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x540fc8[_0x8a95('0x37')]));if(this[_0x8a95('0x85')](_0x540fc8[_0x8a95('0x66')])){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xba'),_0x540fc8[_0x8a95('0x66')]));var _0x2e32f9=this[_0x8a95('0xf')][_0x8a95('0xbb')](_0x540fc8[_0x8a95('0x66')]);if(_0x2e32f9[_0x8a95('0xa2')]===-0x1){return _0x2e32f9;}}return this[_0x8a95('0xf')]['answer']();};AGIVertices['prototype'][_0x8a95('0x4a')]=function(_0xf46069){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0xf46069[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xf46069['list_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xf46069,'no\x20list\x20selected');}_0xf46069[_0x8a95('0x49')]=moment();if(this[_0x8a95('0x85')](_0xf46069['delay'])){_0xf46069[_0x8a95('0x49')]=moment()[_0x8a95('0xbc')](_0xf46069[_0x8a95('0xbd')],_0x8a95('0xbe'));}if(!this[_0x8a95('0x85')](_0xf46069[_0x8a95('0x4c')])){_0xf46069[_0x8a95('0x4c')]=0x2;}this[_0x8a95('0x43')][_0x8a95('0x70')](this,_0xf46069);return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xbf'),_0xf46069['phone'],_0xf46069[_0x8a95('0x48')],_0xf46069[_0x8a95('0x49')]));};AGIVertices[_0x8a95('0x1a')]['custom_app']=function(_0xb84467){logger['info'](util[_0x8a95('0x55')](_0x8a95('0xc0'),_0xb84467[_0x8a95('0x37')]));var _0x5a5c27=this[_0x8a95('0xf')]['exec'](_0xb84467['application'],_0xb84467['options']);if(_0x5a5c27['result']===-0x1){return _0x5a5c27;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc1'),_0xb84467[_0x8a95('0xc2')],_0xb84467[_0x8a95('0x79')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc3')]=function(_0x126075){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc4'),_0x126075[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x126075[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}var _0x37588d='\x22'+_0x126075[_0x8a95('0x5e')]+'\x22';if(this['isConfigured'](_0x126075[_0x8a95('0x79')])){_0x37588d+=','+_0x126075[_0x8a95('0x79')];}var _0x27b045=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0xaa'),_0x37588d);if(_0x27b045['result']===-0x1){return _0x27b045;}return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc5'),_0x37588d));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc6')]=function(_0x5b65d5){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc7'),_0x5b65d5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x5b65d5[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}var _0x5d2ab0='\x22'+_0x5b65d5[_0x8a95('0x5e')]+'\x22';if(this['isConfigured'](_0x5b65d5[_0x8a95('0x79')])){_0x5d2ab0+=','+_0x5b65d5[_0x8a95('0x79')];}var _0x26fdc2=this[_0x8a95('0xf')][_0x8a95('0x59')]('MRCPSynth',_0x5d2ab0);if(_0x26fdc2[_0x8a95('0xa2')]===-0x1){return _0x26fdc2;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format'](_0x8a95('0xc5'),_0x5d2ab0));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xc8')]=function(_0x4b3c00){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xc9'),_0x4b3c00['label']));if(!this[_0x8a95('0x85')](_0x4b3c00['grammar'])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xae'));}var _0x2c03a0=_0x4b3c00[_0x8a95('0xad')];if(this[_0x8a95('0x85')](_0x4b3c00[_0x8a95('0x79')])){_0x2c03a0+=','+_0x4b3c00[_0x8a95('0x79')];}var _0x456da0=this['channel'][_0x8a95('0x59')](_0x8a95('0xaf'),_0x2c03a0);if(_0x456da0[_0x8a95('0xa2')]===-0x1){return _0x456da0;}var _0x4eaf0b=this[_0x8a95('0xa1')](_0x8a95('0xb0'),_0x8a95('0xca'));if(_0x4eaf0b[_0x8a95('0xa2')]===-0x1){return _0x4eaf0b;}var _0x24e1cd=this[_0x8a95('0xa1')](_0x8a95('0xb1'),_0x8a95('0xcb'));if(_0x24e1cd[_0x8a95('0xa2')]===-0x1){return _0x24e1cd;}var _0x49a4c5=this[_0x8a95('0xa1')]('RECOG_INSTANCE()',_0x8a95('0xcc'));if(_0x49a4c5[_0x8a95('0xa2')]===-0x1){return _0x49a4c5;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xb5'),_0x2c03a0));};AGIVertices[_0x8a95('0x1a')]['sestekasr']=function(_0x2df116){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2df116[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x2df116[_0x8a95('0xad')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xae'));}var _0x579813=_0x2df116['grammar'];if(this[_0x8a95('0x85')](_0x2df116[_0x8a95('0x79')])){_0x579813+=','+_0x2df116[_0x8a95('0x79')];}var _0x3e313f=this['channel'][_0x8a95('0x59')](_0x8a95('0xaf'),_0x579813);if(_0x3e313f[_0x8a95('0xa2')]===-0x1){return _0x3e313f;}var _0x179811=this[_0x8a95('0xa1')](_0x8a95('0xb0'),_0x8a95('0xcd'));if(_0x179811[_0x8a95('0xa2')]===-0x1){return _0x179811;}var _0x200204=this[_0x8a95('0xa1')]('RECOG_INPUT()',_0x8a95('0xce'));if(_0x200204[_0x8a95('0xa2')]===-0x1){return _0x200204;}var _0x1af308=this[_0x8a95('0xa1')](_0x8a95('0xb3'),_0x8a95('0xcf'));if(_0x1af308[_0x8a95('0xa2')]===-0x1){return _0x1af308;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x579813));};AGIVertices[_0x8a95('0x1a')]['database']=function(_0x144c53){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xd0'),_0x144c53[_0x8a95('0x37')]));if(!this['isConfigured'](_0x144c53[_0x8a95('0xd1')])){return this[_0x8a95('0xf')]['error'](_0x144c53,'no\x20database\x20selected');}var _0x2eb25a=this[_0x8a95('0x1b')][_0x8a95('0x70')](this,_0x144c53[_0x8a95('0xd1')]);if(!_0x2eb25a){return this[_0x8a95('0xf')]['error'](_0x144c53,_0x8a95('0xd2'));}if(!this['isConfigured'](_0x144c53[_0x8a95('0x2e')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x144c53,_0x8a95('0xd3'));}var _0x308078=_0x144c53[_0x8a95('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('query:\x20%s',_0x308078));var _0x4bb9ae=this[_0x8a95('0xd4')][_0x8a95('0x70')](this,_0x2eb25a,_0x308078);this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x144c53,_0x308078);if(!this[_0x8a95('0x85')](_0x144c53[_0x8a95('0xd5')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xd6'));}var _0x500ccf=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x144c53[_0x8a95('0xd5')]);if(!_0x500ccf){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x144c53,_0x8a95('0xd7'));}var _0x590c57=this;_0x4bb9ae[_0x8a95('0xd8')](function(_0x2c191e,_0x4fce46){Object[_0x8a95('0xd9')](_0x2c191e)[_0x8a95('0xd8')](function(_0x40e6e9){_0x590c57[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0xda'),_0x500ccf,_0x4fce46,_0x40e6e9),_0x2c191e[_0x40e6e9]);});});this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0xdb'),_0x500ccf),_0x4bb9ae[_0x8a95('0x99')]);return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xdc'),_0x500ccf));};AGIVertices[_0x8a95('0x1a')]['dial']=function(_0x20629f){logger[_0x8a95('0xdd')](util[_0x8a95('0x55')](_0x8a95('0xde'),_0x20629f[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x20629f[_0x8a95('0xdf')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x20629f,_0x8a95('0xe0'));}var _0x3759ed=this[_0x8a95('0xe1')]['sync'](this,_0x20629f['sip_id']);if(!_0x3759ed){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x20629f,_0x8a95('0xe2'));}var _0x487423=this[_0x8a95('0xf')]['exec'](_0x8a95('0xe3'),[util['format'](_0x8a95('0xe4'),_0x3759ed),_0x20629f[_0x8a95('0x66')],_0x20629f['opts'],_0x20629f[_0x8a95('0x64')]]);if(_0x487423[_0x8a95('0xa2')]===-0x1){return _0x487423;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xe5'),_0x8a95('0xe3')));};AGIVertices['prototype']['dialogflow']=function(_0xb2cd9e){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xe6'),_0xb2cd9e[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xb2cd9e[_0x8a95('0x7a')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xe7'));}if(!this[_0x8a95('0x85')](_0xb2cd9e[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xe8')]=!![];this['createSquareDetailsReport'](_0xb2cd9e);this[_0x8a95('0xe9')](_0xb2cd9e[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0xb2cd9e[_0x8a95('0x5e')]));var _0x3ec950=this[_0x8a95('0xea')][_0x8a95('0x70')](this,_0xb2cd9e);if(_0x3ec950){for(var _0x8c94c in _0x3ec950){if(_0x3ec950[_0x8a95('0x94')](_0x8c94c)){this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0xeb'),_0x8c94c['toUpperCase']()),_0x3ec950[_0x8c94c]);}}this[_0x8a95('0xe9')](_0x3ec950[_0x8a95('0xec')],'out',_0x8a95('0xed'),'');return this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Dialogflow\x20Result\x20%s',_0x3ec950['speech']));}return this[_0x8a95('0xf')]['error'](_0xb2cd9e,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')]['dialogflowV2']=function(_0x399eac){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0xee'),_0x399eac[_0x8a95('0x37')]));if(!this['isConfigured'](_0x399eac[_0x8a95('0x7d')])){return this['channel'][_0x8a95('0xa8')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x399eac[_0x8a95('0x7e')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xef'));}if(!this['isConfigured'](_0x399eac[_0x8a95('0x7f')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xf0'));}if(!this[_0x8a95('0x85')](_0x399eac[_0x8a95('0xf1')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xf2'));}if(!this['isConfigured'](_0x399eac[_0x8a95('0x5e')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xa9'));}this['channel']['bot']=!![];this[_0x8a95('0x36')](_0x399eac);this['createSquareMessage'](_0x399eac[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xf3'),_0x399eac[_0x8a95('0x5e')]));var _0x4f0485=this[_0x8a95('0x7c')][_0x8a95('0x70')](this,_0x399eac);if(_0x4f0485){for(var _0x46469b in _0x4f0485){if(_0x4f0485['hasOwnProperty'](_0x46469b)){if(_0x46469b!==_0x8a95('0xf4')){this[_0x8a95('0xf')]['setVariable'](util['format'](_0x8a95('0xeb'),_0x46469b['toUpperCase']()),_0x4f0485[_0x46469b]);}}}this[_0x8a95('0xe9')](_0x4f0485[_0x8a95('0xec')],_0x8a95('0xf5'),_0x8a95('0xf6'),_0x4f0485['providerResponse']);return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xf7'),_0x4f0485[_0x8a95('0xec')]));}return this['channel']['error'](_0x399eac,_0x8a95('0xf8'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xf9')]=function(_0xf211a5){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0xfa'),_0xf211a5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0xf211a5['ndauth_url'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xfb'));}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xfc')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0xfd'));}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xfe')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20password\x20configured');}if(!this[_0x8a95('0x85')](_0xf211a5[_0x8a95('0xff')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}this[_0x8a95('0xf')]['bot']=!![];this[_0x8a95('0x36')](_0xf211a5);this[_0x8a95('0xe9')](_0xf211a5[_0x8a95('0x5e')],'in','','');this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('Trying\x20SestekNDA:\x20%s',_0xf211a5[_0x8a95('0x5e')]));var _0x3fc641=this[_0x8a95('0x80')]['sync'](this,_0xf211a5);if(_0x3fc641){for(var _0x123840 in _0x3fc641){if(_0x3fc641[_0x8a95('0x94')](_0x123840)){this[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')](_0x8a95('0x100'),_0x123840['toUpperCase']()),_0x3fc641[_0x123840]);}}this[_0x8a95('0xe9')](_0x3fc641[_0x8a95('0xec')],_0x8a95('0xf5'),'sesteknda','');if(_0x3fc641[_0x8a95('0x101')]){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x102'),_0x3fc641[_0x8a95('0x101')]));var _0xad0294=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x3fc641[_0x8a95('0x101')]);try{fs[_0x8a95('0x104')](_0x3fc641[_0x8a95('0x101')]+_0x8a95('0x105'));}catch(_0x39142e){logger['error'](_0x39142e);}return _0xad0294;}else{return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x106'),_0x3fc641['speech']));}}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xf211a5,_0x8a95('0x107'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x108')]=function(_0x80be49){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x109'),_0x80be49[_0x8a95('0x37')]));return this['channel'][_0x8a95('0xa8')](_0x8a95('0x108'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x10a')]=function(_0x4b6b59){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x10b'),_0x4b6b59[_0x8a95('0x37')]));var _0x470928='';if(_0x4b6b59[_0x8a95('0x10c')]){if(!this['isConfigured'](_0x4b6b59[_0x8a95('0x10c')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10d'));}else{var _0x1540fd=parseInt(_0x4b6b59[_0x8a95('0x10c')],0xa);if(isNaN(_0x1540fd)){_0x470928=_0x4b6b59[_0x8a95('0x10c')];}else{_0x470928=this['getTrunk'][_0x8a95('0x70')](this,_0x4b6b59[_0x8a95('0x10c')]);if(!_0x470928){return this['channel'][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10e'));}}}}else if(_0x4b6b59[_0x8a95('0x10f')]){_0x470928=_0x4b6b59[_0x8a95('0x10f')];}else{return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4b6b59,_0x8a95('0x10d'));}var _0x1f82db=this[_0x8a95('0xf')][_0x8a95('0x59')]('DIAL',[util[_0x8a95('0x55')](_0x8a95('0x110'),_0x470928,_0x4b6b59['phone']),_0x4b6b59[_0x8a95('0x66')],_0x4b6b59['opts'],_0x4b6b59[_0x8a95('0x64')]]);if(_0x1f82db[_0x8a95('0xa2')]===-0x1){return _0x1f82db;}return this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0xe5'),'DIAL'));};AGIVertices[_0x8a95('0x1a')]['finally']=function(_0x209a35){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x111'),_0x209a35['label']));return this['channel'][_0x8a95('0xa8')]('finally');};AGIVertices['prototype'][_0x8a95('0x112')]=function(_0x18c3fb){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x113'),_0x18c3fb[_0x8a95('0x37')]));if(_0x18c3fb[_0x8a95('0xa5')]===0x0){return this['maxRetry'](_0x18c3fb);}_0x18c3fb['retry']-=0x1;if(!this[_0x8a95('0x85')](_0x18c3fb['file_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0x114'));}var _0x4aa0aa=this[_0x8a95('0x115')][_0x8a95('0x70')](this,_0x18c3fb[_0x8a95('0x116')]);if(!_0x4aa0aa){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0x117'));}if(!this[_0x8a95('0x85')](_0x18c3fb[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x8a95('0xd6'));}var _0x5f3d4f=this[_0x8a95('0xf')]['getData'](_0x4aa0aa,_0x18c3fb[_0x8a95('0x118')],_0x18c3fb[_0x8a95('0x119')]);var _0x40aba6=_0x5f3d4f['result']?_0x5f3d4f[_0x8a95('0xa2')][_0x8a95('0x4b')]():'';logger[_0x8a95('0x2c')](_0x8a95('0x11a'),JSON[_0x8a95('0x73')](_0x5f3d4f));if(_0x5f3d4f['result']===-0x1){this[_0x8a95('0x36')]['sync'](this,_0x18c3fb,_0x40aba6);return _0x5f3d4f;}else if(_0x5f3d4f[_0x8a95('0xa0')]===_0x8a95('0x66')){_0x5f3d4f[_0x8a95('0xa2')]=_0x40aba6[_0x8a95('0x99')]>=parseInt(_0x18c3fb[_0x8a95('0x11b')])?'x':'i';}else{_0x5f3d4f[_0x8a95('0xa2')]=_0x40aba6['length']>=parseInt(_0x18c3fb[_0x8a95('0x11b')])&&_0x40aba6[_0x8a95('0x99')]<=parseInt(_0x18c3fb[_0x8a95('0x119')])?'x':'i';}var _0x5e1f0f=this['getVariable'][_0x8a95('0x70')](this,_0x18c3fb[_0x8a95('0xd5')]);if(!_0x5e1f0f){return this['channel'][_0x8a95('0x2a')](_0x18c3fb,_0x8a95('0xd7'));}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x5e1f0f,_0x40aba6);if(this[_0x8a95('0x85')](_0x18c3fb[_0x8a95('0x11c')])){var _0x555bd5=parseInt(_0x18c3fb['hiddendigitsnum'],0xa);var _0x5ec846=rs[_0x8a95('0x11d')]({'charset':'*','length':_0x555bd5});var _0x5972c1=_0x40aba6[_0x8a95('0x99')];if(_0x5972c1>0x0){if(_0x5972c1>_0x555bd5){this['createSquareDetailsReport']['sync'](this,_0x18c3fb,_0x18c3fb[_0x8a95('0x11e')]===_0x8a95('0x11f')?_0x5ec846+_0x40aba6[_0x8a95('0x120')](_0x555bd5):_0x40aba6[_0x8a95('0x120')](0x0,_0x5972c1-_0x555bd5)+_0x5ec846);}else{this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x18c3fb,rs[_0x8a95('0x11d')]({'charset':'*','length':_0x5972c1}));}}else{this['createSquareDetailsReport']['sync'](this,_0x18c3fb,'');}}else{this['createSquareDetailsReport'][_0x8a95('0x70')](this,_0x18c3fb,_0x40aba6);}return _0x5f3d4f;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xe')]=function(_0x2d74fe){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x121'),_0x2d74fe['label']));return this['getdigits'](_0x2d74fe);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x122')]=function(_0x4e2524){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x123'),_0x4e2524[_0x8a95('0x37')]));this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4e2524,_0x4e2524[_0x8a95('0x124')]);return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x125'),_0x4e2524['goalname']));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x126')]=function(_0x2db921){logger['info'](util[_0x8a95('0x55')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2db921['label']));if(!this[_0x8a95('0x85')](_0x2db921['aws_access_key_id'])||!this[_0x8a95('0x85')](_0x2db921[_0x8a95('0x89')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x127'));}if(!this[_0x8a95('0x85')](_0x2db921[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x2db921[_0x8a95('0x5e')]));var _0x4c0f28=this[_0x8a95('0x87')][_0x8a95('0x70')](this,_0x2db921);if(_0x4c0f28){this['channel']['noop'](util['format'](_0x8a95('0x128'),_0x4c0f28));var _0x37af74=this[_0x8a95('0xf')]['streamFile'](_0x4c0f28);try{fs['unlink'](_0x4c0f28+_0x8a95('0x105'));}catch(_0x23d6dc){logger[_0x8a95('0x2a')](_0x23d6dc);}return _0x37af74;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x2db921,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x129')]=function(_0x5dcaa0){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x12a'),_0x5dcaa0[_0x8a95('0x37')]));if(!this['isConfigured'](_0x5dcaa0[_0x8a95('0x88')])||!this['isConfigured'](_0x5dcaa0['aws_secret_access_key'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x127'));}if(!this['isConfigured'](_0x5dcaa0[_0x8a95('0x8d')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x12b'));}if(!this[_0x8a95('0x85')](_0x5dcaa0['text'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20text\x20configured');}this['channel'][_0x8a95('0xe8')]=!![];this['createSquareDetailsReport'](_0x5dcaa0);this[_0x8a95('0xe9')](_0x5dcaa0[_0x8a95('0x5e')],'in','','');this['channel'][_0x8a95('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x5dcaa0[_0x8a95('0x5e')]));var _0x3cbe41=this['awsLex'][_0x8a95('0x70')](this,_0x5dcaa0);if(_0x3cbe41){for(var _0x5dbda4 in _0x3cbe41){if(_0x3cbe41[_0x8a95('0x94')](_0x5dbda4)&&_['isString'](_0x3cbe41[_0x5dbda4])){this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0x12c'),_0x5dbda4['toUpperCase']()),_0x3cbe41[_0x5dbda4]);}}if(_[_0x8a95('0x45')](_0x3cbe41['message'])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x12d'));}else{this[_0x8a95('0xe9')](_0x3cbe41[_0x8a95('0x77')],_0x8a95('0xf5'),_0x8a95('0x12e'),'');return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x12f'),_0x3cbe41[_0x8a95('0x77')]));}}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x5dcaa0,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x130')]=function(_0x5218ab){logger['info'](util[_0x8a95('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5218ab[_0x8a95('0x37')],_0x5218ab[_0x8a95('0x66')]));if(!this[_0x8a95('0x85')](_0x5218ab[_0x8a95('0x7a')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xe7'));}var _0x13ceaa='wav';var _0x257e35=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,rs[_0x8a95('0x11d')](0x4));var _0x54d4c9=util[_0x8a95('0x55')]('%s.%s',_0x257e35,_0x13ceaa);var _0xa74ccb=!![];if(_0x5218ab[_0x8a95('0x132')]===_0x8a95('0x133')){_0xa74ccb=![];}var _0x4d9c38=this['channel'][_0x8a95('0x134')](_0x257e35,_0x13ceaa,_0x5218ab['intKey'],_0x5218ab[_0x8a95('0x66')],undefined,_0xa74ccb);if(_0x4d9c38['result']!==-0x1){this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x135'),_0x54d4c9));var _0x243940=this[_0x8a95('0x8e')][_0x8a95('0x70')](this,_0x5218ab,_0x54d4c9);if(_0x243940){for(var _0x5bed9d in _0x243940){if(_0x243940[_0x8a95('0x94')](_0x5bed9d)){this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x136'),_0x5bed9d[_0x8a95('0x137')]()),_0x243940[_0x5bed9d]);}}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x243940)));}}return _0x4d9c38;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x138')]=function(_0x5b7d61){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x139'),_0x5b7d61[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x5b7d61[_0x8a95('0x91')])){return this[_0x8a95('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8a95('0x85')](_0x5b7d61[_0x8a95('0x92')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')]('no\x20appsecret\x20configured');}var _0x2e56bd=_0x8a95('0x13a');var _0x325cbe=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,rs['generate'](0x4));var _0x3ea677=util[_0x8a95('0x55')](_0x8a95('0x9c'),_0x325cbe,_0x2e56bd);var _0x10fd35=!![];if(_0x5b7d61[_0x8a95('0x132')]===_0x8a95('0x133')){_0x10fd35=![];}var _0x4d08c9=this[_0x8a95('0xf')][_0x8a95('0x134')](_0x325cbe,_0x2e56bd,_0x5b7d61[_0x8a95('0x13b')],_0x5b7d61[_0x8a95('0x66')],undefined,_0x10fd35);if(_0x4d08c9[_0x8a95('0xa2')]!==-0x1){this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format']('tilde\x20%s\x20file\x20created',_0x3ea677));var _0x3662e1=this[_0x8a95('0x90')][_0x8a95('0x70')](this,_0x5b7d61,_0x3ea677);if(_0x3662e1){for(var _0x4347df in _0x3662e1){if(_0x3662e1[_0x8a95('0x94')](_0x4347df)){this['channel']['setVariable'](util[_0x8a95('0x55')]('TILDE_ASR_%s',_0x4347df[_0x8a95('0x137')]()),_0x3662e1[_0x4347df]);}}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('TildeASR\x20Result\x20%s',JSON[_0x8a95('0x73')](_0x3662e1)));}}return _0x4d08c9;};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x13c')]=function(_0x360770){logger['info'](util['format'](_0x8a95('0x13d'),_0x360770[_0x8a95('0x37')]));return this['channel'][_0x8a95('0x13e')](_0x360770[_0x8a95('0x3c')],_0x360770[_0x8a95('0x3d')],_0x360770[_0x8a95('0x3e')]);};AGIVertices['prototype'][_0x8a95('0x13f')]=function(_0x3e2906){logger['info'](util['format'](_0x8a95('0x140'),_0x3e2906[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x3e2906[_0x8a95('0x141')])){return this['channel'][_0x8a95('0x2a')](_0x3e2906,_0x8a95('0x142'));}try{var _0x33ab2e=eval(_0x3e2906[_0x8a95('0x141')])?'true':_0x8a95('0x143');this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x144'),_0x3e2906[_0x8a95('0x141')],_0x33ab2e));return{'code':0xc8,'result':_0x33ab2e};}catch(_0x13a1bd){return{'code':0xc8,'result':_0x8a95('0x143')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x145')]=function(_0x57c504){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x146'),_0x57c504[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x57c504['interval_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x57c504,'no\x20interval\x20configured');}var _0x441be2=this['getIntervals']['sync'](this,_0x57c504['interval_id']);if(!_0x441be2){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x57c504,'no\x20intervals\x20found');}for(var _0x460e5b=0x0;_0x460e5b<_0x441be2[_0x8a95('0x99')];_0x460e5b+=0x1){var _0x476256=this[_0x8a95('0xf')]['getVariable'](util[_0x8a95('0x55')](_0x8a95('0x147'),_0x441be2[_0x460e5b]));if(_0x476256['result']===-0x1){return _0x476256;}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],_0x476256['extra']));if(_0x476256[_0x8a95('0xa0')]===_0x8a95('0x149')){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],_0x8a95('0x149')));this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0x148'),_0x441be2[_0x460e5b],'true'));return{'code':0xc8,'result':_0x8a95('0x149')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('IFTIME\x20%s\x20%s',_0x441be2[_0x460e5b],_0x8a95('0x143')));this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0x148'),_0x441be2[_0x460e5b],'false'));}}return{'code':0xc8,'result':_0x8a95('0x143')};};AGIVertices['prototype'][_0x8a95('0x14a')]=function(_0x445752){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x14b'),_0x445752[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0x1ad172){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x14c'),_0x1ad172[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x1ad172['key'])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xe7'));}var _0x4d5f9e=_0x8a95('0x13a');var _0x1cb70b=util[_0x8a95('0x55')]('%s/recordings/%s',FILES_PATH,rs[_0x8a95('0x11d')](0x4));var _0x567470=util[_0x8a95('0x55')]('%s.%s',_0x1cb70b,_0x4d5f9e);var _0x2bb0a6=!![];if(_0x1ad172[_0x8a95('0x132')]===_0x8a95('0x133')){_0x2bb0a6=![];}var _0x24ed61=this[_0x8a95('0xf')]['recordFile'](_0x1cb70b,_0x4d5f9e,_0x1ad172[_0x8a95('0x13b')],_0x1ad172[_0x8a95('0x66')],undefined,_0x2bb0a6);if(_0x24ed61[_0x8a95('0xa2')]!==-0x1){this['channel']['noop'](util[_0x8a95('0x55')]('ispeech\x20%s\x20file\x20created',_0x567470));var _0x53ceb2=this['ispeechASR'][_0x8a95('0x70')](this,_0x1ad172,_0x567470);if(_0x53ceb2){for(var _0x48dbb8 in _0x53ceb2){if(_0x53ceb2[_0x8a95('0x94')](_0x48dbb8)){this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x14d'),_0x48dbb8[_0x8a95('0x137')]()),_0x53ceb2[_0x48dbb8]);}}return this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x14e'),JSON[_0x8a95('0x73')](_0x53ceb2)));}}return _0x24ed61;};AGIVertices[_0x8a95('0x1a')]['ispeechtts']=function(_0x55b7e1){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x14f'),_0x55b7e1[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x55b7e1[_0x8a95('0x7a')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xe7'));}if(!this[_0x8a95('0x85')](_0x55b7e1[_0x8a95('0x5e')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0xa9'));}this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x150'),_0x55b7e1[_0x8a95('0x5e')]));var _0x41e967=this[_0x8a95('0x81')][_0x8a95('0x70')](this,_0x55b7e1);if(_0x41e967){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x151'),_0x41e967));var _0x5e61be=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x41e967,_0x55b7e1[_0x8a95('0x13b')]);try{fs['unlink'](_0x41e967+'.wav');}catch(_0x55e5f9){logger['error'](_0x55e5f9);}return _0x5e61be;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x55b7e1,_0x8a95('0x152'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x153')]=function(_0x3c2307){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x3c2307[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x3c2307[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x3c2307,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x156'),this[_0x8a95('0xf')]['callerid'],_0x3c2307[_0x8a95('0x154')]));var _0x390959=this[_0x8a95('0x53')][_0x8a95('0x70')](this,_0x3c2307[_0x8a95('0x154')]);if(_0x390959){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x3c2307['findBy']));this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x3c2307[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x15b')]=function(_0xc9c6fa){logger['info'](util[_0x8a95('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xc9c6fa['label']));if(!this[_0x8a95('0x85')](_0xc9c6fa[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0xc9c6fa,_0x8a95('0x155'));}logger['info'](util['format'](_0x8a95('0x156'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));var _0x418589=this[_0x8a95('0x52')][_0x8a95('0x70')](this,_0xc9c6fa['findBy']);if(_0x418589){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));return{'code':0xc8,'result':'success'};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa[_0x8a95('0x154')]));this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0xc9c6fa['findBy']));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x15c')]=function(_0x675a78){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x15d'),_0x675a78[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x675a78[_0x8a95('0x15e')])){return this['channel'][_0x8a95('0x2a')](_0x675a78,_0x8a95('0x15f'));}this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0x160'),_0x675a78[_0x8a95('0x15e')]));var _0x15def3=eval(_0x675a78['operation']);if(!this['isConfigured'](_0x675a78[_0x8a95('0xd5')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0xd6'));}var _0x197a1f=this['getVariable']['sync'](this,_0x675a78[_0x8a95('0xd5')]);if(!_0x197a1f){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x675a78,_0x8a95('0xd7'));}if(_[_0x8a95('0x9d')](_0x15def3)){var _0x2c5ed2=this;_0x15def3['forEach'](function(_0x57bc35,_0x4ebdcd){_0x2c5ed2[_0x8a95('0xf')][_0x8a95('0x9e')](util[_0x8a95('0x55')]('%s[%s]',_0x197a1f,_0x4ebdcd),_0x57bc35);});return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x161'),_0x197a1f));}else{return this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x197a1f,_0x15def3);}};AGIVertices[_0x8a95('0x1a')][_0x8a95('0xd')]=function(_0x4bfb4e){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x162'),_0x4bfb4e[_0x8a95('0x37')]));if(_0x4bfb4e[_0x8a95('0xa5')]===0x0){return this[_0x8a95('0xa4')](_0x4bfb4e);}_0x4bfb4e[_0x8a95('0xa5')]-=0x1;if(!this[_0x8a95('0x85')](_0x4bfb4e['file_id'])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4bfb4e,_0x8a95('0x114'));}var _0x1ffe9f=this[_0x8a95('0x115')][_0x8a95('0x70')](this,_0x4bfb4e[_0x8a95('0x116')]);if(!_0x1ffe9f){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x4bfb4e,'no\x20file\x20audio\x20found');}var _0x4bb53f=this['channel'][_0x8a95('0x163')](_0x1ffe9f,_0x4bfb4e[_0x8a95('0x118')],_0x4bfb4e['digit']);var _0x218dcb=_0x4bb53f[_0x8a95('0xa2')];if(_0x4bb53f['result']===-0x1){this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bfb4e,'-1');return _0x4bb53f;}else if(_0x4bb53f[_0x8a95('0xa0')]===_0x8a95('0x66')){_0x4bb53f['result']=_0x4bb53f[_0x8a95('0xa2')]['length']>0x0?_0x4bb53f['result']:'t';}else if(_[_0x8a95('0x44')](_0x4bb53f['result'])){_0x4bb53f['result']='#';_0x218dcb='#';}if(!this[_0x8a95('0x85')](_0x4bfb4e[_0x8a95('0xd5')])){this[_0x8a95('0xf')]['noop'](_0x8a95('0xd6'));}else{var _0x5cc09f=this['getVariable'][_0x8a95('0x70')](this,_0x4bfb4e[_0x8a95('0xd5')]);if(!_0x5cc09f){return this[_0x8a95('0xf')]['error'](_0x4bfb4e,_0x8a95('0xd7'));}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x5cc09f,_0x218dcb);}this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bfb4e,_0x218dcb);return _0x4bb53f;};AGIVertices['prototype'][_0x8a95('0xa8')]=function(_0x331079){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x164'),_0x331079[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x331079[_0x8a95('0x165')]||_0x331079['label']);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x166')]=function(_0x4f9490){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x167'),_0x4f9490['label']));if(!this[_0x8a95('0x85')](_0x4f9490[_0x8a95('0x154')])){return this[_0x8a95('0xf')]['error'](_0x4f9490,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x156'),this[_0x8a95('0xf')]['callerid'],_0x4f9490[_0x8a95('0x154')]));var _0x33ca93=this['getPause'][_0x8a95('0x70')](this,_0x4f9490[_0x8a95('0x168')]);var _0x584dba=this[_0x8a95('0x4f')]['sync'](this,_0x4f9490['findBy'],_0x33ca93);if(_0x584dba){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8a95('0xf')]['callerid'],_0x4f9490[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490[_0x8a95('0x154')]));this['channel']['noop'](util['format'](_0x8a95('0x157'),this[_0x8a95('0xf')][_0x8a95('0x39')],_0x4f9490['findBy']));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices['prototype'][_0x8a95('0x169')]=function(_0x5a3996){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x16a'),_0x5a3996[_0x8a95('0x37')]));if(!this['isConfigured'](_0x5a3996[_0x8a95('0x116')])){return this[_0x8a95('0xf')]['error'](_0x5a3996,_0x8a95('0x114'));}var _0x57719c=this['getSound'][_0x8a95('0x70')](this,_0x5a3996[_0x8a95('0x116')]);if(!_0x57719c){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x5a3996,_0x8a95('0x117'));}var _0x359a2e=this['channel'][_0x8a95('0x59')]('PLAYBACK',[_0x57719c,_0x5a3996['opts']]);if(_0x359a2e['result']===-0x1){return _0x359a2e;}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x57719c));};AGIVertices['prototype'][_0x8a95('0x16b')]=function(_0x39c5b5){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x16c'),_0x39c5b5[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x39c5b5[_0x8a95('0x16d')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x39c5b5,'no\x20queue\x20selected');}var _0x4a0d9e='';var _0x2ec0e0=parseInt(_0x39c5b5[_0x8a95('0x16d')],0xa);if(isNaN(_0x2ec0e0)){_0x4a0d9e=_0x39c5b5['queue_id'];}else{_0x4a0d9e=this['getVoiceQueue'][_0x8a95('0x70')](this,_0x39c5b5[_0x8a95('0x16d')]);if(!_0x4a0d9e){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x39c5b5,_0x8a95('0x16e'));}}var _0x33d555='';if(this[_0x8a95('0x85')](_0x39c5b5[_0x8a95('0x116')])){var _0x491cb1=this[_0x8a95('0x115')]['sync'](this,_0x39c5b5[_0x8a95('0x116')]);if(_0x491cb1){_0x33d555=_0x491cb1;}}this[_0x8a95('0x36')]['sync'](this,_0x39c5b5,_0x4a0d9e);if(_0x39c5b5[_0x8a95('0x16f')][_0x8a95('0x170')]('x')<0x0){_0x39c5b5['opts']+='x';}if(_0x39c5b5['opts'][_0x8a95('0x170')]('X')<0x0){_0x39c5b5[_0x8a95('0x16f')]+='X';}this[_0x8a95('0xf')][_0x8a95('0x9e')](_0x8a95('0x171'),_0x4a0d9e?_0x4a0d9e[_0x8a95('0x172')]():'');var _0xcca4b9=this[_0x8a95('0xf')][_0x8a95('0x59')]('QUEUE',[_0x4a0d9e,_0x39c5b5[_0x8a95('0x16f')],_0x39c5b5[_0x8a95('0x64')],_0x33d555,_0x39c5b5['timeout'],_0x39c5b5['agi'],_0x39c5b5['macro'],_0x39c5b5[_0x8a95('0x173')],'',_0x39c5b5[_0x8a95('0x174')]]);if(_0xcca4b9['result']===-0x1){return _0xcca4b9;}return this[_0x8a95('0xf')]['noop'](util['format'](_0x8a95('0xc1'),_0x8a95('0x175'),_0x4a0d9e));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x176')]=function(_0xcc653d){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x177'),_0xcc653d['label']));var _0x402d99=_0xcc653d['recordingFormat']||_0x8a95('0x13a');var _0x312ba5=util[_0x8a95('0x55')]('%s_%s',this['channel'][_0x8a95('0x42')],rs[_0x8a95('0x11d')](0x5));var _0x4c3b32=util[_0x8a95('0x55')](_0x8a95('0x178'),FILES_PATH,_0x312ba5,_0x402d99);var _0x16f7c3=util[_0x8a95('0x55')](_0x8a95('0x131'),FILES_PATH,_0x312ba5);this['createSquareRecording']['sync'](this,_0xcc653d,_0x312ba5,_0x4c3b32);this['channel'][_0x8a95('0x9e')]('RECORDING_SAVENAME',_0x312ba5);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7c3,_0x402d99,_0xcc653d[_0x8a95('0x179')],_0xcc653d[_0x8a95('0x66')]);return this[_0x8a95('0xf')][_0x8a95('0x134')](_0x16f7c3,_0x402d99,_0xcc653d[_0x8a95('0x179')],_0xcc653d[_0x8a95('0x66')],undefined,!![]);};AGIVertices['prototype'][_0x8a95('0x17a')]=function(_0x101d2e){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x17b'),_0x101d2e[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x101d2e[_0x8a95('0x64')])){return this[_0x8a95('0xf')]['noop'](_0x8a95('0x17c'));}var _0x39ba8a=this['restAPI'][_0x8a95('0x70')](this,_0x101d2e);logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x17d'),util['inspect'](_0x39ba8a,{'showHidden':![],'depth':null})));if(!this[_0x8a95('0x85')](_0x101d2e[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x17e'));}var _0x22f13a=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x101d2e['variable_id']);if(!_0x22f13a){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x101d2e,_0x8a95('0xd7'));}this[_0x8a95('0xf')]['setVariable'](util[_0x8a95('0x55')](_0x8a95('0x17f'),_0x22f13a),_0x39ba8a['statusCode']?_0x39ba8a[_0x8a95('0x75')]:_0x8a95('0x180'));this[_0x8a95('0xf')][_0x8a95('0x9e')](util['format'](_0x8a95('0x181'),_0x22f13a),_0x39ba8a[_0x8a95('0x76')]?_0x39ba8a[_0x8a95('0x76')]:'OK');if(_0x39ba8a[_0x8a95('0x6a')]){try{this[_0x8a95('0x9b')](_0x39ba8a[_0x8a95('0x6a')],_0x22f13a);}catch(_0x30152b){logger[_0x8a95('0x2a')](util[_0x8a95('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x22f13a));}}return this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xdc'),_0x22f13a));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x182')]=function(_0x4cc42b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x183'),_0x4cc42b[_0x8a95('0x37')]));return this[_0x8a95('0xf')][_0x8a95('0x184')](_0x4cc42b[_0x8a95('0x185')]['replace'](/\s+/g,''),_0x4cc42b[_0x8a95('0x179')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x186')]=function(_0x1805a6){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x187'),_0x1805a6[_0x8a95('0x37')]));return this['channel']['sayNumber'](_0x1805a6[_0x8a95('0x67')]['replace'](/\s+/g,''),_0x1805a6[_0x8a95('0x179')]);};AGIVertices['prototype'][_0x8a95('0x188')]=function(_0x1148a4){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1148a4[_0x8a95('0x37')]));return this['channel'][_0x8a95('0x189')](_0x1148a4[_0x8a95('0x5e')],_0x1148a4[_0x8a95('0x179')]);};AGIVertices['prototype'][_0x8a95('0x18a')]=function(_0x27839f){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x18b'),_0x27839f['label']));if(!this['isConfigured'](_0x27839f[_0x8a95('0x18c')])){return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x18d'));}var _0x5c2748=this[_0x8a95('0x18e')][_0x8a95('0x70')](this,_0x27839f[_0x8a95('0x18c')]);if(!_0x5c2748||!_0x5c2748[_0x8a95('0x18f')]){return this['channel'][_0x8a95('0x2a')](_0x27839f,_0x8a95('0x190'));}var _0x3d81ac={'from':util['format'](_0x8a95('0x191'),_0x5c2748[_0x8a95('0x17')],_0x5c2748[_0x8a95('0x192')]||_0x5c2748[_0x8a95('0x18f')][_0x8a95('0x193')]),'to':_0x27839f['to']||'','cc':_0x27839f['cc']||'','bcc':_0x27839f[_0x8a95('0x194')]||'','subject':_0x27839f['subject'],'html':_0x27839f['text'],'text':_0x27839f['text']};if(this[_0x8a95('0x85')](_0x27839f['template_id'])){}logger[_0x8a95('0xdd')](_0x8a95('0x195'),JSON['stringify'](_0x3d81ac));this[_0x8a95('0x36')]['sync'](this,_0x27839f,_0x27839f['account_id']);this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5c2748[_0x8a95('0x17')]));this[_0x8a95('0x24')]['sync'](this,_0x5c2748['smtpOptions'],_0x3d81ac);return this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x196'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x197')]=function(_0x279dea){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x198'),_0x279dea[_0x8a95('0x37')]));return this['channel'][_0x8a95('0xa8')](_0x8a95('0x199'));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x19a')]=function(_0x266f16){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x19b'),_0x266f16['label']));if(!this[_0x8a95('0x85')](_0x266f16[_0x8a95('0x19c')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x19d'));}var _0x2acf95=this['getSmsAccount'][_0x8a95('0x70')](this,_0x266f16[_0x8a95('0x19c')]);if(!_0x2acf95){return this[_0x8a95('0xf')]['error'](_0x266f16,_0x8a95('0x19e'));}var _0x3c76f4={'body':_0x266f16[_0x8a95('0x19f')],'phone':_0x266f16['to']||'','SmsAccountId':_0x2acf95['id']};logger['debug'](_0x8a95('0x1a0'),JSON[_0x8a95('0x73')](_0x3c76f4));this[_0x8a95('0x36')]['sync'](this,_0x266f16,_0x266f16[_0x8a95('0x19c')]);this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1a1'),_0x2acf95[_0x8a95('0x17')]));this[_0x8a95('0x35')][_0x8a95('0x70')](this,_0x3c76f4);return this[_0x8a95('0xf')]['noop'](_0x8a95('0x1a2'));};AGIVertices[_0x8a95('0x1a')]['set']=function(_0x539169){logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x1a3'),_0x539169['label']));if(!this[_0x8a95('0x85')](_0x539169[_0x8a95('0xd5')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x539169,_0x8a95('0x1a4'));}var _0x4d99a2=this[_0x8a95('0x12')][_0x8a95('0x70')](this,_0x539169[_0x8a95('0xd5')]);if(!_0x4d99a2){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x539169,'no\x20variable\x20found');}return this[_0x8a95('0xf')]['setVariable'](_0x4d99a2,_0x539169[_0x8a95('0x1a5')]);};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1a6')]=function(_0x2b921f){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2b921f[_0x8a95('0x37')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x1a7'));if(_0x2b921f[_0x8a95('0xb9')]===_0x8a95('0x1a8')){this[_0x8a95('0xf')][_0x8a95('0xa8')](_0x8a95('0x1a9'));return this[_0x8a95('0xf')][_0x8a95('0xb9')]();}return this['channel'][_0x8a95('0xa8')](_0x8a95('0x1aa'));};AGIVertices[_0x8a95('0x1a')]['subproject']=function(_0x149287){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1ab'),_0x149287[_0x8a95('0x37')]));if(!this['isConfigured'](_0x149287[_0x8a95('0x1ac')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,'no\x20subproject\x20selected');}var _0x57170b=this['getSquareProject'][_0x8a95('0x70')](this,_0x149287[_0x8a95('0x1ac')]);if(!this[_0x8a95('0x85')](_0x57170b)){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,util[_0x8a95('0x55')](_0x8a95('0x1ad'),_0x149287[_0x8a95('0x1ac')]));}if(_0x57170b===this[_0x8a95('0xf')][_0x8a95('0x1ae')]){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x149287,_0x8a95('0x1af'));}this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x149287,_0x57170b);var _0x562c86=this['channel'][_0x8a95('0x59')](_0x8a95('0x1b0'),util[_0x8a95('0x55')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x8a95('0xb6')][_0x8a95('0x1b1')]||'127.0.0.1',_0x57170b,this[_0x8a95('0xf')][_0x8a95('0x1ae')]));if(_0x562c86[_0x8a95('0xa2')]===-0x1){return _0x562c86;}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0xc1'),'AGI',_0x57170b));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b2')]=function(_0x4bac9b){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4bac9b[_0x8a95('0x37')]));var _0x437843=this['shellCommand'][_0x8a95('0x70')](this,_0x4bac9b[_0x8a95('0x1b3')]);this[_0x8a95('0x36')][_0x8a95('0x70')](this,_0x4bac9b,_0x4bac9b['command']);if(this[_0x8a95('0x85')](_0x4bac9b[_0x8a95('0xd5')])){var _0x1b1774=this['getVariable'][_0x8a95('0x70')](this,_0x4bac9b['variable_id']);if(_0x1b1774){this[_0x8a95('0xf')]['setVariable'](_0x1b1774,_0x437843);return this['channel'][_0x8a95('0xa8')](util['format'](_0x8a95('0x1b4'),_0x4bac9b[_0x8a95('0x1b3')],_0x1b1774));}}return this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1b5'),_0x4bac9b[_0x8a95('0x1b3')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1b6')]=function(_0x41fa6e){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1b7'),_0x41fa6e[_0x8a95('0x37')]));_0x41fa6e['text']=_0x41fa6e[_0x8a95('0x5e')][_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x41fa6e[_0x8a95('0x5c')])){return this['channel'][_0x8a95('0xa8')](_0x8a95('0x1b8'));}if(!this[_0x8a95('0x85')](_0x41fa6e[_0x8a95('0x5e')])){return this['channel']['noop'](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1b9'),_0x41fa6e['text']));var _0x300bbc=this['googleCloudTTS'][_0x8a95('0x70')](this,_0x41fa6e);if(_0x300bbc){this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1ba'),_0x300bbc));var _0x27eee8=this[_0x8a95('0xf')][_0x8a95('0x103')](_0x300bbc);try{fs[_0x8a95('0x104')](_0x300bbc+'.wav');}catch(_0x5613fc){logger[_0x8a95('0x2a')](_0x5613fc);}return _0x27eee8;}return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x41fa6e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')]['tts']=function(_0x20ecda){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1bb'),_0x20ecda[_0x8a95('0x37')]));_0x20ecda[_0x8a95('0x5e')]=_0x20ecda[_0x8a95('0x5e')][_0x8a95('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8a95('0x85')](_0x20ecda['text'])){return this['channel']['noop'](_0x8a95('0xa9'));}this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1bc'),_0x20ecda[_0x8a95('0x5e')]));var _0xc4aefa=this['googleTTS'][_0x8a95('0x70')](this,_0x20ecda);if(_0xc4aefa){this['channel'][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x1bd'),_0xc4aefa));var _0x81f72b=this[_0x8a95('0xf')][_0x8a95('0x103')](_0xc4aefa);try{fs['unlink'](_0xc4aefa+_0x8a95('0x105'));}catch(_0x1f0a8c){logger[_0x8a95('0x2a')](_0x1f0a8c);}return _0x81f72b;}return this['channel'][_0x8a95('0x2a')](_0x20ecda,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1be')]=function(_0x453450){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x1bf'),_0x453450[_0x8a95('0x37')]));if(!this[_0x8a95('0x85')](_0x453450[_0x8a95('0x154')])){return this[_0x8a95('0xf')][_0x8a95('0x2a')](_0x453450,_0x8a95('0x155'));}logger[_0x8a95('0x2c')](util[_0x8a95('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8a95('0xf')][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));var _0x4b28b1=this[_0x8a95('0x51')][_0x8a95('0x70')](this,_0x453450[_0x8a95('0x154')]);if(_0x4b28b1){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x157'),this['channel'][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util['format'](_0x8a95('0x157'),this['channel'][_0x8a95('0x39')],_0x453450[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x158')};}else{logger[_0x8a95('0x2c')](util['format'](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x453450[_0x8a95('0x154')]));this[_0x8a95('0xf')][_0x8a95('0xa8')](util[_0x8a95('0x55')](_0x8a95('0x159'),this[_0x8a95('0xf')]['callerid'],_0x453450[_0x8a95('0x154')]));return{'code':0xc8,'result':_0x8a95('0x15a')};}};AGIVertices['prototype'][_0x8a95('0x1c0')]=function(_0x588cb5){logger['info'](util[_0x8a95('0x55')](_0x8a95('0x1c1'),_0x588cb5[_0x8a95('0x37')]));var _0x40948d=this[_0x8a95('0xf')][_0x8a95('0x59')](_0x8a95('0x1c2'),[_0x588cb5[_0x8a95('0x1c3')],_0x588cb5[_0x8a95('0x79')]]);if(_0x40948d[_0x8a95('0xa2')]===-0x1){return _0x40948d;}return this[_0x8a95('0xf')]['noop'](util[_0x8a95('0x55')](_0x8a95('0xc1'),_0x8a95('0x1c2'),_0x588cb5[_0x8a95('0x1c3')]));};AGIVertices[_0x8a95('0x1a')][_0x8a95('0x1c4')]=function(_0x3bfeba){logger[_0x8a95('0x2c')](util[_0x8a95('0x55')](_0x8a95('0x1c5'),_0x3bfeba[_0x8a95('0x37')]));if(!this['isConfigured'](_0x3bfeba['variable_id'])){return this['channel'][_0x8a95('0x2a')](_0x3bfeba,_0x8a95('0x1a4'));}var _0x189f63=this['getVariable'][_0x8a95('0x70')](this,_0x3bfeba['variable_id']);if(!_0x189f63){return this[_0x8a95('0xf')]['error'](_0x3bfeba,'no\x20variable\x20found');}var _0xd000ca=this['channel'][_0x8a95('0x12')](_0x189f63);return{'code':0xc8,'result':_0xd000ca['extra']?_0xd000ca['extra']:'-'};};String[_0x8a95('0x1a')][_0x8a95('0x1c6')]=function(_0x49f791,_0x13cc83){return this['split'](_0x49f791)['join'](_0x13cc83);};module['exports']=AGIVertices; \ No newline at end of file +var _0x3d45=['Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariable','rpc','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','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','statusMessage','message','options','googleDialogflow','dialogflow_language','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','noop','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_INSTANCE()','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','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','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','sestekNDA','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','unlink','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','email','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','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','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','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts'];(function(_0x1dda39,_0x221826){var _0x269408=function(_0x545613){while(--_0x545613){_0x1dda39['push'](_0x1dda39['shift']());}};_0x269408(++_0x221826);}(_0x3d45,0x1d2));var _0x53d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d45[_0x5b644e];return _0x49c6bf;};'use strict';var fs=require('fs');var util=require(_0x53d4('0x0'));var _=require(_0x53d4('0x1'));var sh=require(_0x53d4('0x2'));var odbc=require(_0x53d4('0x3'))();var rs=require(_0x53d4('0x4'));var moment=require('moment');var Mustache=require(_0x53d4('0x5'));var rp=require(_0x53d4('0x6'));var logger=require('../../config/logger')(_0x53d4('0x7'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x53d4('0x8'),_0x53d4('0x9')];var verticesWithRetry=[_0x53d4('0xa'),_0x53d4('0xb'),_0x53d4('0xc')];var AGIVertices=function(_0x488c2e,_0x3b19f6,_0x20b209){this[_0x53d4('0xd')]=_0x488c2e;this['rpc']=_0x3b19f6;this[_0x53d4('0xe')]=_0x20b209;};AGIVertices['prototype'][_0x53d4('0xf')]=function(_0x44cf11,_0x2e7e42){this[_0x53d4('0x10')][_0x53d4('0x11')](_0x44cf11)['then'](function(_0x3ad057){_0x2e7e42(null,_0x3ad057?_0x3ad057[_0x53d4('0x12')]:![]);})[_0x53d4('0x13')](function(_0x4cd884){_0x2e7e42(_0x4cd884);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x15')]=function(_0x543701,_0x256409){this['rpc'][_0x53d4('0x16')](_0x543701)[_0x53d4('0x17')](function(_0xe2356c){_0x256409(null,_0xe2356c?_0xe2356c['name']:![]);})[_0x53d4('0x13')](function(_0x121bcb){_0x256409(_0x121bcb);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x18')]=function(_0xdc050c,_0x503259){this[_0x53d4('0x10')][_0x53d4('0x19')](_0xdc050c)['then'](function(_0x5e5cbf){_0x503259(null,_0x5e5cbf?_0x5e5cbf[_0x53d4('0x12')]:![]);})[_0x53d4('0x13')](function(_0x28346b){_0x503259(_0x28346b);});};AGIVertices['prototype'][_0x53d4('0x1a')]=function(_0x463d8f,_0x24b321){this[_0x53d4('0x10')][_0x53d4('0x1b')](_0x463d8f)[_0x53d4('0x17')](function(_0x25ed73){_0x24b321(null,_0x25ed73?_0x25ed73[_0x53d4('0x1c')]:![]);})['catch'](function(_0x57dfd0){_0x24b321(_0x57dfd0);});};AGIVertices['prototype'][_0x53d4('0x1d')]=function(_0x557c63,_0x87fabf){this[_0x53d4('0x10')][_0x53d4('0x1e')](_0x557c63)[_0x53d4('0x17')](function(_0x1de622){_0x87fabf(null,_0x1de622?_0x1de622[_0x53d4('0x12')]:![]);})[_0x53d4('0x13')](function(_0x3a2ff4){_0x87fabf(_0x3a2ff4);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1f')]=function(_0x3b2b2e,_0x363e6e){this[_0x53d4('0x10')][_0x53d4('0x20')](_0x3b2b2e)[_0x53d4('0x17')](function(_0x3adddd){_0x363e6e(null,_0x3adddd?_0x3adddd[_0x53d4('0x12')]:![]);})[_0x53d4('0x13')](function(_0x112e91){_0x363e6e(_0x112e91);});};AGIVertices['prototype'][_0x53d4('0x21')]=function(_0x11540f,_0x2a7259){var _0x2f6bc1=this;this['rpc'][_0x53d4('0x22')](_0x11540f)[_0x53d4('0x17')](function(_0x49e0a7){_0x2a7259(null,_0x49e0a7?_0x2f6bc1['getSoundPath'](_0x49e0a7['save_name']):![]);})[_0x53d4('0x13')](function(_0x1586ab){_0x2a7259(_0x1586ab);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x23')]=function(_0x26e9f9,_0x547eb9){this[_0x53d4('0x10')]['getMailAccountById'](_0x26e9f9)[_0x53d4('0x17')](function(_0x2801e7){_0x547eb9(null,_0x2801e7?_0x2801e7:![]);})[_0x53d4('0x13')](function(_0x2ce0ce){_0x547eb9(_0x2ce0ce);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x24')]=function(_0x5b3c3d,_0x4d38ac,_0x2c9a6d){this['mailRpc']['sendMailMessage'](_0x5b3c3d,_0x4d38ac)[_0x53d4('0x17')](function(){_0x2c9a6d(null);})[_0x53d4('0x13')](function(_0x2301fc){_0x2c9a6d(_0x2301fc);});};AGIVertices[_0x53d4('0x14')]['getIntervals']=function(_0x4d04fd,_0x33b4e4){this[_0x53d4('0x10')][_0x53d4('0x25')](_0x4d04fd)[_0x53d4('0x17')](function(_0x13b706){if(_0x13b706){if(_0x13b706[_0x53d4('0x26')]){_0x33b4e4(null,[_0x13b706[_0x53d4('0x27')]]);}else{_0x33b4e4(null,_[_0x53d4('0x28')](_0x13b706[_0x53d4('0x29')],_0x53d4('0x27')));}}else{_0x33b4e4(null,![]);}})[_0x53d4('0x13')](function(_0x3273bd){_0x33b4e4(_0x3273bd);});};AGIVertices[_0x53d4('0x14')]['getSoundPath']=function(_0x294c68){return util[_0x53d4('0x2a')](_0x53d4('0x2b'),FILES_PATH,_0x294c68);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x2c')]=function(_0x395d79,_0x271f7f,_0x2d3ded){odbc[_0x53d4('0x2d')](_0x395d79,function(_0x3d933c){if(_0x3d933c){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x3d933c);_0x2d3ded(_0x3d933c);}else{logger[_0x53d4('0x2e')](_0x53d4('0x2f'));odbc['query'](_0x271f7f,function(_0x448634,_0x50e5b8){if(_0x448634){logger[_0x53d4('0x2e')]('Error\x20executing\x20query\x20%s',_0x271f7f);_0x2d3ded(_0x448634);}else{logger[_0x53d4('0x2e')](_0x53d4('0x30'),_0x271f7f);odbc[_0x53d4('0x31')](function(_0x286962){if(_0x286962){logger[_0x53d4('0x32')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x286962);}_0x2d3ded(null,_0x50e5b8);});}});}});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x33')]=function(_0x20c418,_0x5d14a3){this[_0x53d4('0x10')][_0x53d4('0x34')](_0x20c418)[_0x53d4('0x17')](function(_0x5d44d6){_0x5d14a3(null,_0x5d44d6?_0x5d44d6:![]);})[_0x53d4('0x13')](function(_0x7aacb2){_0x5d14a3(_0x7aacb2);});};AGIVertices[_0x53d4('0x14')]['createSmsMessage']=function(_0x569b74,_0x10d576){this[_0x53d4('0x10')][_0x53d4('0x35')](_0x569b74)[_0x53d4('0x17')](function(_0x10b867){_0x10d576(null,_0x10b867);})['catch'](function(_0x569656){_0x10d576(_0x569656);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x36')]=function(_0x407fc2,_0x2b54ba,_0x167038){this['rpc'][_0x53d4('0x36')]({'uniqueid':this[_0x53d4('0xd')][_0x53d4('0x37')],'node':_0x407fc2[_0x53d4('0x38')],'application':_0x407fc2['agicommand'],'data':_0x2b54ba||null,'project_name':this[_0x53d4('0xd')][_0x53d4('0x39')],'callerid':this[_0x53d4('0xd')]['callerid']})[_0x53d4('0x17')](function(_0x243f1b){if(_0x167038){_0x167038(null,_0x243f1b);}})[_0x53d4('0x13')](function(_0xd5f813){if(_0x167038){_0x167038(_0xd5f813);}});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x3a')]=function(_0x14497f,_0x45fdce,_0x251769,_0x23c339){this[_0x53d4('0x10')][_0x53d4('0x3a')]({'uniqueid':this['channel'][_0x53d4('0x37')],'callerid':this[_0x53d4('0xd')]['callerid'],'calleridname':this[_0x53d4('0xd')][_0x53d4('0x3b')],'context':this[_0x53d4('0xd')]['context'],'extension':this[_0x53d4('0xd')][_0x53d4('0x3c')],'priority':this[_0x53d4('0xd')][_0x53d4('0x3d')],'accountcode':this[_0x53d4('0xd')][_0x53d4('0x3e')],'dnid':this['channel'][_0x53d4('0x3f')],'projectName':this[_0x53d4('0xd')]['arg_1'],'saveName':_0x45fdce,'filename':_0x14497f[_0x53d4('0x40')]||_0x45fdce,'savePath':_0x251769})['then'](function(_0x16af72){_0x23c339(null,_0x16af72);})[_0x53d4('0x13')](function(_0x4d5b43){_0x23c339(_0x4d5b43);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x41')]=function(_0x34924d,_0x1a9a67,_0x2e4a97,_0x449049,_0xd9f2d4){this[_0x53d4('0x10')][_0x53d4('0x41')]({'uniqueid':this[_0x53d4('0xd')][_0x53d4('0x37')],'body':_0x34924d,'direction':_0x1a9a67,'providerName':_0x2e4a97,'providerResponse':_0x449049})[_0x53d4('0x17')](function(_0x3d1a45){if(_0xd9f2d4){_0xd9f2d4(null,_0x3d1a45);}})[_0x53d4('0x13')](function(_0x53c31c){if(_0xd9f2d4){_0xd9f2d4(_0x53c31c);}});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x42')]=function(_0x91c0f7,_0x2e2115){this['rpc'][_0x53d4('0x42')]({'firstName':_[_0x53d4('0x43')](_0x91c0f7[_0x53d4('0x12')])||_[_0x53d4('0x44')](_0x91c0f7['name'])?_0x53d4('0x45')+Math[_0x53d4('0x46')]():_0x91c0f7[_0x53d4('0x12')],'lastName':_[_0x53d4('0x43')](_0x91c0f7[_0x53d4('0x47')])||_[_0x53d4('0x44')](_0x91c0f7['lastName'])?null:_0x91c0f7[_0x53d4('0x47')],'phone':_0x91c0f7[_0x53d4('0x48')],'ListId':_0x91c0f7[_0x53d4('0x49')],'scheduledat':_0x91c0f7['scheduledAt'],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x53d4('0x4a'),'description':_0x53d4('0x4b')+_0x91c0f7[_0x53d4('0x4c')][_0x53d4('0x4d')](),'priority':_0x91c0f7[_0x53d4('0x4e')]})[_0x53d4('0x17')](function(_0x50d0a3){_0x2e2115(null,_0x50d0a3);})['catch'](function(_0x24e5d6){_0x2e2115(_0x24e5d6);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x4f')]=function(_0x645b35,_0x5e1b1e){this[_0x53d4('0x10')][_0x53d4('0x50')](_0x645b35)['then'](function(_0x46e847){_0x5e1b1e(null,_0x46e847?_0x46e847[_0x53d4('0x12')]:![]);})['catch'](function(_0x455402){_0x5e1b1e(_0x455402);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x51')]=function(_0x21a169,_0x2cb740,_0x24c7db){var _0x5ab3b8={'role':_0x53d4('0x52')};_0x5ab3b8[_0x21a169]=this['channel'][_0x53d4('0x53')];this[_0x53d4('0x10')][_0x53d4('0x51')](_0x5ab3b8,_0x2cb740,this[_0x53d4('0xd')][_0x53d4('0x37')])[_0x53d4('0x17')](function(_0x417033){_0x24c7db(null,_['isNil'](_0x417033)?![]:!![]);})[_0x53d4('0x13')](function(_0x236db3){logger[_0x53d4('0x32')](_0x236db3);_0x24c7db(null,![]);});};AGIVertices['prototype'][_0x53d4('0x54')]=function(_0x59f899,_0x2708f7){var _0x21474d={'role':_0x53d4('0x52')};_0x21474d[_0x59f899]=this[_0x53d4('0xd')][_0x53d4('0x53')];this[_0x53d4('0x10')]['agentUnpause'](_0x21474d)['then'](function(_0x2bb8e0){_0x2708f7(null,_['isNil'](_0x2bb8e0)?![]:!![]);})[_0x53d4('0x13')](function(_0x3c94ce){logger[_0x53d4('0x32')](_0x3c94ce);_0x2708f7(null,![]);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x55')]=function(_0x182e3c,_0x47ac11){var _0x10ea9d={'role':_0x53d4('0x52')};_0x10ea9d[_0x182e3c]=this[_0x53d4('0xd')]['callerid'];this[_0x53d4('0x10')][_0x53d4('0x55')](_0x10ea9d)['then'](function(_0x1eacdf){_0x47ac11(null,_['isNil'](_0x1eacdf)?![]:!![]);})[_0x53d4('0x13')](function(_0x58ec9d){logger[_0x53d4('0x32')](_0x58ec9d);_0x47ac11(null,![]);});};AGIVertices['prototype'][_0x53d4('0x56')]=function(_0x1e15e6,_0x48aaf0){var _0xb3f1dd={'role':_0x53d4('0x52')};_0xb3f1dd[_0x1e15e6]=this[_0x53d4('0xd')][_0x53d4('0x53')];var _0x1c98d1=_0x1e15e6!=_0x53d4('0x57')?util[_0x53d4('0x2a')](_0x53d4('0x58'),_0x53d4('0x59'),this[_0x53d4('0xd')][_0x53d4('0x53')]):undefined;this[_0x53d4('0x10')]['agentLogin'](_0xb3f1dd,_0x1c98d1)['then'](function(_0x34f460){_0x48aaf0(null,_[_0x53d4('0x44')](_0x34f460)?![]:!![]);})[_0x53d4('0x13')](function(_0x3e58ec){logger[_0x53d4('0x32')](_0x3e58ec);_0x48aaf0(null,![]);});};AGIVertices['prototype'][_0x53d4('0x5a')]=function(_0x47ff38,_0x4a9908){sh[_0x53d4('0x5b')](_[_0x53d4('0x5c')](_0x47ff38),function(_0x251616,_0x4f8550){var _0x3c0b6e=_0x4f8550['replace'](/(\r\n|\n|\r)/gm,'');_0x4a9908(null,_0x3c0b6e);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x5d')]=function(_0x3b2bb0,_0x310c57){scripts[_0x53d4('0x5d')](_0x3b2bb0['apiKey'],_0x3b2bb0['google_cloud_tts_text_type']||'text',_0x3b2bb0[_0x53d4('0x5e')],_0x3b2bb0[_0x53d4('0x5f')]||'en-US',_0x3b2bb0[_0x53d4('0x60')]||'MALE',_0x3b2bb0[_0x53d4('0x61')]||_0x53d4('0x62'))['then'](function(_0x322862){_0x310c57(null,_0x322862);})[_0x53d4('0x13')](function(_0xb3e918){_0x310c57(_0xb3e918);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x63')]=function(_0x409c3a,_0x4789e6){scripts[_0x53d4('0x63')](_0x409c3a[_0x53d4('0x5e')],_0x409c3a[_0x53d4('0x64')]||'en',0x1)[_0x53d4('0x17')](function(_0xa45364){_0x4789e6(null,_0xa45364);})[_0x53d4('0x13')](function(_0x3eb306){_0x4789e6(_0x3eb306);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x65')]=function(_0x55a26c,_0x17187c){var _0x1b716c={'uri':_0x55a26c[_0x53d4('0x66')],'method':_0x55a26c[_0x53d4('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x55a26c[_0x53d4('0x68')])==='number'&&parseInt(_0x55a26c[_0x53d4('0x68')])>=0x1?parseInt(_0x55a26c[_0x53d4('0x68')])*0x3e8:0x5*0x3e8};if(_[_0x53d4('0x69')]([_0x53d4('0x6a'),_0x53d4('0x6b')],_0x1b716c['method'][_0x53d4('0x6c')]())){try{_0x1b716c[_0x53d4('0x6d')]=_0x55a26c[_0x53d4('0x9')]?JSON[_0x53d4('0x6e')](_0x55a26c[_0x53d4('0x9')]):{};}catch(_0x41d07a){logger[_0x53d4('0x32')](_0x53d4('0x6f'),_0x41d07a);}}try{_0x1b716c[_0x53d4('0x70')]=_0x55a26c['rawHeaders']?JSON[_0x53d4('0x6e')](_0x55a26c[_0x53d4('0x8')]):{};}catch(_0x2a68c9){logger[_0x53d4('0x32')](_0x53d4('0x71'),_0x2a68c9);}if(_0x55a26c[_0x53d4('0x72')]){try{var _0x25b3be=require(_0x55a26c[_0x53d4('0x72')])[_0x53d4('0x73')](this,_0x1b716c);_0x1b716c[_0x53d4('0x74')]=Mustache[_0x53d4('0x75')](_0x55a26c[_0x53d4('0x66')],_0x25b3be,{},['$$','$$']);if(_0x1b716c['headers']){_0x1b716c['headers']=JSON[_0x53d4('0x6e')](Mustache[_0x53d4('0x75')](JSON[_0x53d4('0x76')](_0x1b716c['headers']),_0x25b3be,{},['$$','$$']));}if(_0x1b716c[_0x53d4('0x6d')]){_0x1b716c[_0x53d4('0x6d')]=JSON[_0x53d4('0x6e')](Mustache[_0x53d4('0x75')](JSON['stringify'](_0x1b716c[_0x53d4('0x6d')]),_0x25b3be,{},['$$','$$']));}}catch(_0x32bb7d){logger[_0x53d4('0x32')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x32bb7d);}}rp(_0x1b716c)[_0x53d4('0x17')](function(_0x4a8e53){var _0x32f2ff={'statusCode':_0x4a8e53['statusCode']||0xc8,'statusMessage':_0x4a8e53[_0x53d4('0x77')]||'OK','headers':_0x4a8e53[_0x53d4('0x70')]||{},'body':_0x4a8e53[_0x53d4('0x6d')]||{}};_0x17187c(null,_0x32f2ff);})[_0x53d4('0x13')](function(_0x538ffe){var _0x37c067={'statusCode':_0x538ffe['statusCode']||0x1f4,'statusMessage':_0x538ffe[_0x53d4('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x538ffe[_0x53d4('0x79')]['headers']||{},'body':_0x538ffe['options'][_0x53d4('0x6d')]||{}};_0x17187c(null,_0x37c067);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x7a')]=function(_0x43e9a4,_0x1e94d9){scripts[_0x53d4('0x7a')](this[_0x53d4('0xd')][_0x53d4('0x37')],_0x43e9a4['key'],_0x43e9a4[_0x53d4('0x5e')],_0x43e9a4[_0x53d4('0x7b')]||'en')[_0x53d4('0x17')](function(_0x6294c4){_0x1e94d9(null,_0x6294c4);})[_0x53d4('0x13')](function(_0x5306ed){_0x1e94d9(_0x5306ed);});};AGIVertices[_0x53d4('0x14')]['googleDialogflowV2']=function(_0x1ee93e,_0x286fb0){scripts['googleDialogflowV2'](this[_0x53d4('0xd')][_0x53d4('0x37')],_0x1ee93e[_0x53d4('0x7c')],_0x1ee93e['client_email'],_0x1ee93e[_0x53d4('0x7d')],_0x1ee93e[_0x53d4('0x5e')],_0x1ee93e[_0x53d4('0x7e')]||'en')['then'](function(_0x58fde8){_0x286fb0(null,_0x58fde8);})[_0x53d4('0x13')](function(_0x47e173){_0x286fb0(_0x47e173);});};AGIVertices[_0x53d4('0x14')]['sestekNDA']=function(_0x4e04a3,_0x5071d2){scripts['sestekNDA'](this[_0x53d4('0xd')],_0x4e04a3)[_0x53d4('0x17')](function(_0x327539){_0x5071d2(null,_0x327539);})[_0x53d4('0x13')](function(_0x2ccb90){_0x5071d2(_0x2ccb90);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x7f')]=function(_0x444f24,_0x873e4){scripts[_0x53d4('0x7f')](_0x444f24['key'],_0x444f24[_0x53d4('0x5e')],_0x444f24[_0x53d4('0x80')]||_0x53d4('0x81'),_0x444f24[_0x53d4('0x82')])['then'](function(_0x42867d){_0x873e4(null,_0x42867d);})[_0x53d4('0x13')](function(_0x29dc1c){_0x873e4(_0x29dc1c);});};AGIVertices['prototype']['ispeechASR']=function(_0x3a579f,_0x3e4974,_0x5350a4){scripts[_0x53d4('0x83')](_0x3e4974,_0x3a579f[_0x53d4('0x84')],_0x3a579f[_0x53d4('0x85')]||_0x53d4('0x81'),this[_0x53d4('0x86')](_0x3a579f[_0x53d4('0x87')])?_0x3a579f['model']:undefined)['then'](function(_0x3babd9){_0x5350a4(null,_0x3babd9);})[_0x53d4('0x13')](function(_0x3fb3b2){_0x5350a4(_0x3fb3b2);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x88')]=function(_0x4da253,_0x5049d1){scripts['awsPolly'](_0x4da253[_0x53d4('0x89')],_0x4da253['aws_secret_access_key'],_0x4da253[_0x53d4('0x8a')],_0x4da253[_0x53d4('0x8b')]||'Amy',_0x4da253[_0x53d4('0x5e')],_0x4da253[_0x53d4('0x8c')]||_0x53d4('0x5e'))[_0x53d4('0x17')](function(_0x2cfd98){_0x5049d1(null,_0x2cfd98);})[_0x53d4('0x13')](function(_0x1a989c){_0x5049d1(_0x1a989c);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x8d')]=function(_0x18dc7f,_0x488ca8){scripts[_0x53d4('0x8d')](this[_0x53d4('0xd')][_0x53d4('0x37')],_0x18dc7f[_0x53d4('0x89')],_0x18dc7f[_0x53d4('0x8e')],_0x18dc7f[_0x53d4('0x8f')],_0x18dc7f[_0x53d4('0x5e')],_0x18dc7f[_0x53d4('0x90')])[_0x53d4('0x17')](function(_0x4117e7){_0x488ca8(null,_0x4117e7);})[_0x53d4('0x13')](function(_0x22b8ff){_0x488ca8(_0x22b8ff);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x91')]=function(_0x304bbd,_0x5b689c,_0x49a9b4){scripts['googleASR'](_0x5b689c,_0x304bbd[_0x53d4('0x84')],_0x304bbd[_0x53d4('0x92')]||_0x53d4('0x81'))[_0x53d4('0x17')](function(_0x2db6fc){_0x49a9b4(null,_0x2db6fc);})['catch'](function(_0x719b52){_0x49a9b4(_0x719b52);});};AGIVertices[_0x53d4('0x14')]['tildeASR']=function(_0x4e46ff,_0x1ae3cd,_0x3839fb){scripts[_0x53d4('0x93')](_0x1ae3cd,_0x4e46ff['appid'],_0x4e46ff['appsecret'],_0x4e46ff[_0x53d4('0x74')])['then'](function(_0x2599c1){_0x3839fb(null,_0x2599c1);})[_0x53d4('0x13')](function(_0x5f5f6e){_0x3839fb(_0x5f5f6e);});};AGIVertices[_0x53d4('0x14')][_0x53d4('0x94')]=function(_0x56622c){var _0x233fca=_[_0x53d4('0x69')](verticesWithRetry,_0x56622c[_0x53d4('0x95')])?_0x56622c:_[_0x53d4('0x96')](_0x56622c);for(var _0x5b33a0 in _0x233fca){if(_0x233fca[_0x53d4('0x97')](_0x5b33a0)){if(_0x233fca[_0x5b33a0]&&_[_0x53d4('0x98')](_0x233fca[_0x5b33a0])){if(_[_0x53d4('0x69')](recursiveMapAttributes,_0x5b33a0)){_0x233fca[_0x5b33a0]=this[_0x53d4('0x99')](_0x233fca[_0x5b33a0]);}else{_0x233fca[_0x5b33a0]=this[_0x53d4('0x9a')](_0x233fca[_0x5b33a0]);}}}}return _0x233fca;};AGIVertices['prototype'][_0x53d4('0x9b')]=function(_0x203ff0){for(var _0x57fd72 in _0x203ff0){if(_0x203ff0[_0x53d4('0x97')](_0x57fd72)){if(_[_0x53d4('0x9c')](_0x203ff0[_0x57fd72])){this[_0x53d4('0x9b')](_0x203ff0[_0x57fd72]);}else if(_[_0x53d4('0x9d')](_0x203ff0[_0x57fd72])){for(var _0x31ae1c=0x0;_0x31ae1c<_0x203ff0[_0x57fd72][_0x53d4('0x9e')];_0x31ae1c++){this[_0x53d4('0x9b')](_0x203ff0[_0x57fd72][_0x31ae1c]);}}else if(_[_0x53d4('0x98')](_0x203ff0[_0x57fd72])){_0x203ff0[_0x57fd72]=this['replaceAllVariables'](_0x203ff0[_0x57fd72]);}}}};AGIVertices[_0x53d4('0x14')]['saveRestApiResult']=function(_0x2c2611,_0x383b79){for(var _0x5f17b9 in _0x2c2611){if(_0x2c2611['hasOwnProperty'](_0x5f17b9)){if(_[_0x53d4('0x9c')](_0x2c2611[_0x5f17b9])){if(!_[_0x53d4('0x43')](_0x2c2611[_0x5f17b9])){this[_0x53d4('0x9f')](_0x2c2611[_0x5f17b9],util[_0x53d4('0x2a')](_0x53d4('0xa0'),_0x383b79,_0x5f17b9));}}else if(_[_0x53d4('0x9d')](_0x2c2611[_0x5f17b9])){for(var _0xb58710=0x0;_0xb58710<_0x2c2611[_0x5f17b9][_0x53d4('0x9e')];_0xb58710++){this['saveRestApiResult'](_0x2c2611[_0x5f17b9][_0xb58710],util[_0x53d4('0x2a')](_0x53d4('0xa0'),_0x383b79,_0x5f17b9+'['+_0xb58710+']'));}}else{if(!_[_0x53d4('0x44')](_0x2c2611[_0x5f17b9])){this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0xa0'),_0x383b79,_0x5f17b9),_0x2c2611[_0x5f17b9]);}}}}};AGIVertices['prototype'][_0x53d4('0x99')]=function(_0x1a533f){try{var _0x2f056e=JSON[_0x53d4('0x6e')](_0x1a533f);this['recursiveNodeIndex'](_0x2f056e);return JSON[_0x53d4('0x76')](_0x2f056e);}catch(_0x17d09d){return this[_0x53d4('0x9a')](_0x1a533f);}};AGIVertices[_0x53d4('0x14')][_0x53d4('0x9a')]=function(_0x55483f){var _0x1a6cc8=_0x55483f[_0x53d4('0xa2')]('{');for(var _0x10f8fd=0x1;_0x10f8fd<_0x1a6cc8[_0x53d4('0x9e')];_0x10f8fd+=0x1){var _0x5d91ee=_0x1a6cc8[_0x10f8fd][_0x53d4('0xa2')]('}');if(_0x5d91ee['length']>0x1){_0x55483f=_0x55483f[_0x53d4('0xa3')]('{'+_0x5d91ee[0x0]+'}',this[_0x53d4('0xd')][_0x53d4('0xf')](_0x5d91ee[0x0])[_0x53d4('0xa4')]||_0x5d91ee[0x0]);}}if(_0x1a6cc8[_0x53d4('0x9e')]===0x1){return _0x55483f[_0x53d4('0x4d')]();}return this['replaceAllVariables'](_0x55483f);};AGIVertices[_0x53d4('0x14')]['getAndSetVariable']=function(_0x103d1e,_0xfee832){var _0x339c3c=this[_0x53d4('0xd')][_0x53d4('0xf')](_0x103d1e);if(_0x339c3c[_0x53d4('0xa5')]===-0x1){return _0x339c3c;}logger[_0x53d4('0x2e')](util['format'](_0x53d4('0xa6'),_0xfee832,_0x339c3c[_0x53d4('0xa4')]));return this['channel'][_0x53d4('0xa1')](_0xfee832,_0x339c3c[_0x53d4('0xa4')]);};AGIVertices['prototype'][_0x53d4('0x86')]=function(_0x1451d3){return _0x1451d3&&_0x1451d3!=='0'&&_0x1451d3!=='-1'&&_0x1451d3!=='';};AGIVertices[_0x53d4('0x14')][_0x53d4('0xa7')]=function(_0x16ef8f){this[_0x53d4('0x36')]['sync'](this,_0x16ef8f,'-');_0x16ef8f[_0x53d4('0xa8')]=_0x16ef8f[_0x53d4('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x53d4('0x14')]['mrcpsynth']=function(_0x1b82f5){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xa9'),_0x1b82f5[_0x53d4('0x38')]));if(!this['isConfigured'](_0x1b82f5[_0x53d4('0x5e')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xaa'));}var _0x137574='\x22'+_0x1b82f5[_0x53d4('0x5e')]+'\x22';if(this['isConfigured'](_0x1b82f5[_0x53d4('0x79')])){_0x137574+=','+_0x1b82f5[_0x53d4('0x79')];}var _0x142e0c=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0xab'),_0x137574);if(_0x142e0c['result']===-0x1){return _0x142e0c;}return this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')](_0x53d4('0xac'),_0x137574));};AGIVertices[_0x53d4('0x14')]['mrcprecog']=function(_0x5afda0){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xad'),_0x5afda0[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x5afda0[_0x53d4('0xae')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x8e0842=_0x5afda0['grammar'];if(this[_0x53d4('0x86')](_0x5afda0[_0x53d4('0x79')])){_0x8e0842+=','+_0x5afda0[_0x53d4('0x79')];}var _0x29637c=this['channel'][_0x53d4('0x5b')](_0x53d4('0xaf'),_0x8e0842);if(_0x29637c[_0x53d4('0xa5')]===-0x1){return _0x29637c;}var _0x10c156=this[_0x53d4('0xb0')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x10c156['result']===-0x1){return _0x10c156;}var _0x496c75=this[_0x53d4('0xb0')](_0x53d4('0xb1'),_0x53d4('0xb2'));if(_0x496c75['result']===-0x1){return _0x496c75;}var _0xcef139=this[_0x53d4('0xb0')]('RECOG_INSTANCE()',_0x53d4('0xb3'));if(_0xcef139[_0x53d4('0xa5')]===-0x1){return _0xcef139;}return this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')](_0x53d4('0xb4'),_0x8e0842));};AGIVertices['prototype']['agi']=function(_0x5e6496){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0xb5'),_0x5e6496[_0x53d4('0x38')]));return this['channel'][_0x53d4('0x7')]([_0x5e6496[_0x53d4('0xb6')],_0x5e6496[_0x53d4('0xb7')]]);};AGIVertices[_0x53d4('0x14')][_0x53d4('0xb8')]=function(_0xae9525){logger['info'](util[_0x53d4('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xae9525[_0x53d4('0x38')]));if(this[_0x53d4('0x86')](_0xae9525[_0x53d4('0x68')])){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xb9'),_0xae9525['timeout']));var _0x3929b0=this['channel']['wait'](_0xae9525[_0x53d4('0x68')]);if(_0x3929b0[_0x53d4('0xa5')]===-0x1){return _0x3929b0;}}return this[_0x53d4('0xd')][_0x53d4('0xb8')]();};AGIVertices['prototype'][_0x53d4('0x4a')]=function(_0x1ece33){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xba'),_0x1ece33[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x1ece33[_0x53d4('0x49')])){return this[_0x53d4('0xd')]['error'](_0x1ece33,'no\x20list\x20selected');}_0x1ece33['scheduledAt']=moment();if(this[_0x53d4('0x86')](_0x1ece33['delay'])){_0x1ece33[_0x53d4('0x4c')]=moment()[_0x53d4('0xbb')](_0x1ece33[_0x53d4('0xbc')],'minutes');}if(!this[_0x53d4('0x86')](_0x1ece33[_0x53d4('0x4e')])){_0x1ece33[_0x53d4('0x4e')]=0x2;}this[_0x53d4('0x42')][_0x53d4('0x73')](this,_0x1ece33);return this[_0x53d4('0xd')]['noop'](util['format'](_0x53d4('0xbd'),_0x1ece33[_0x53d4('0x48')],_0x1ece33['list_id'],_0x1ece33[_0x53d4('0x4c')]));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xbe')]=function(_0xa21c0b){logger['info'](util[_0x53d4('0x2a')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xa21c0b[_0x53d4('0x38')]));var _0x532cb5=this[_0x53d4('0xd')]['exec'](_0xa21c0b[_0x53d4('0xbf')],_0xa21c0b['options']);if(_0x532cb5[_0x53d4('0xa5')]===-0x1){return _0x532cb5;}return this['channel']['noop'](util[_0x53d4('0x2a')](_0x53d4('0xc0'),_0xa21c0b['application'],_0xa21c0b[_0x53d4('0x79')]));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xc1')]=function(_0x3ca9de){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xc2'),_0x3ca9de['label']));if(!this['isConfigured'](_0x3ca9de[_0x53d4('0x5e')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xaa'));}var _0x4bd67b='\x22'+_0x3ca9de[_0x53d4('0x5e')]+'\x22';if(this[_0x53d4('0x86')](_0x3ca9de['options'])){_0x4bd67b+=','+_0x3ca9de[_0x53d4('0x79')];}var _0x2be8da=this['channel']['exec'](_0x53d4('0xab'),_0x4bd67b);if(_0x2be8da['result']===-0x1){return _0x2be8da;}return this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xac'),_0x4bd67b));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xc4')]=function(_0x12c119){logger['info'](util['format'](_0x53d4('0xc5'),_0x12c119[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x12c119[_0x53d4('0x5e')])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0xaa'));}var _0x9319fb='\x22'+_0x12c119[_0x53d4('0x5e')]+'\x22';if(this[_0x53d4('0x86')](_0x12c119[_0x53d4('0x79')])){_0x9319fb+=','+_0x12c119[_0x53d4('0x79')];}var _0x5ebcfd=this[_0x53d4('0xd')]['exec'](_0x53d4('0xab'),_0x9319fb);if(_0x5ebcfd[_0x53d4('0xa5')]===-0x1){return _0x5ebcfd;}return this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')](_0x53d4('0xac'),_0x9319fb));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xc6')]=function(_0x2fbfcd){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0xc7'),_0x2fbfcd[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x2fbfcd[_0x53d4('0xae')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xc8'));}var _0x1284a0=_0x2fbfcd[_0x53d4('0xae')];if(this[_0x53d4('0x86')](_0x2fbfcd[_0x53d4('0x79')])){_0x1284a0+=','+_0x2fbfcd[_0x53d4('0x79')];}var _0x53ba77=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0xaf'),_0x1284a0);if(_0x53ba77[_0x53d4('0xa5')]===-0x1){return _0x53ba77;}var _0x5bd08f=this[_0x53d4('0xb0')](_0x53d4('0xc9'),_0x53d4('0xca'));if(_0x5bd08f[_0x53d4('0xa5')]===-0x1){return _0x5bd08f;}var _0x118fb9=this[_0x53d4('0xb0')](_0x53d4('0xb1'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x118fb9['result']===-0x1){return _0x118fb9;}var _0x51be3c=this[_0x53d4('0xb0')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x51be3c['result']===-0x1){return _0x51be3c;}return this[_0x53d4('0xd')]['noop'](util['format'](_0x53d4('0xb4'),_0x1284a0));};AGIVertices[_0x53d4('0x14')]['sestekasr']=function(_0x2520ec){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0xcb'),_0x2520ec[_0x53d4('0x38')]));if(!this['isConfigured'](_0x2520ec['grammar'])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0xc8'));}var _0x2d826d=_0x2520ec[_0x53d4('0xae')];if(this['isConfigured'](_0x2520ec[_0x53d4('0x79')])){_0x2d826d+=','+_0x2520ec[_0x53d4('0x79')];}var _0x63647a=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0xaf'),_0x2d826d);if(_0x63647a[_0x53d4('0xa5')]===-0x1){return _0x63647a;}var _0x4d78ac=this[_0x53d4('0xb0')](_0x53d4('0xc9'),'SESTEK_ASR_CONFIDENCE');if(_0x4d78ac[_0x53d4('0xa5')]===-0x1){return _0x4d78ac;}var _0x3db0f1=this[_0x53d4('0xb0')](_0x53d4('0xb1'),'SESTEK_ASR_TRANSCRIPT');if(_0x3db0f1['result']===-0x1){return _0x3db0f1;}var _0x41175a=this[_0x53d4('0xb0')](_0x53d4('0xcc'),'SESTEK_ASR_INSTANCE');if(_0x41175a[_0x53d4('0xa5')]===-0x1){return _0x41175a;}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xb4'),_0x2d826d));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xcd')]=function(_0x527964){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0xce'),_0x527964[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x527964[_0x53d4('0xcf')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x527964,_0x53d4('0xd0'));}var _0x3cbf8d=this[_0x53d4('0x1a')][_0x53d4('0x73')](this,_0x527964[_0x53d4('0xcf')]);if(!_0x3cbf8d){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x527964,_0x53d4('0xd1'));}if(!this['isConfigured'](_0x527964['query'])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x527964,'no\x20query\x20configured');}var _0x3aab2a=_0x527964[_0x53d4('0xd2')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format']('query:\x20%s',_0x3aab2a));var _0xe3cf35=this[_0x53d4('0x2c')][_0x53d4('0x73')](this,_0x3cbf8d,_0x3aab2a);this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0x527964,_0x3aab2a);if(!this[_0x53d4('0x86')](_0x527964[_0x53d4('0xd3')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xd4'));}var _0x3c68c7=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x527964[_0x53d4('0xd3')]);if(!_0x3c68c7){return this['channel'][_0x53d4('0x32')](_0x527964,_0x53d4('0xd5'));}var _0x329532=this;_0xe3cf35[_0x53d4('0xd6')](function(_0x358179,_0x5a711d){Object[_0x53d4('0xd7')](_0x358179)[_0x53d4('0xd6')](function(_0x2c655f){_0x329532['channel']['setVariable'](util[_0x53d4('0x2a')](_0x53d4('0xd8'),_0x3c68c7,_0x5a711d,_0x2c655f),_0x358179[_0x2c655f]);});});this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0xd9'),_0x3c68c7),_0xe3cf35[_0x53d4('0x9e')]);return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xda'),_0x3c68c7));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xdb')]=function(_0x3a007f){logger[_0x53d4('0xdc')](util[_0x53d4('0x2a')](_0x53d4('0xdd'),_0x3a007f[_0x53d4('0x38')]));if(!this['isConfigured'](_0x3a007f[_0x53d4('0xde')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x3a007f,_0x53d4('0xdf'));}var _0x511a7d=this['getUser'][_0x53d4('0x73')](this,_0x3a007f[_0x53d4('0xde')]);if(!_0x511a7d){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x3a007f,_0x53d4('0xe0'));}var _0x103634=this[_0x53d4('0xd')]['exec'](_0x53d4('0xe1'),[util[_0x53d4('0x2a')](_0x53d4('0xe2'),_0x511a7d),_0x3a007f['timeout'],_0x3a007f[_0x53d4('0xe3')],_0x3a007f[_0x53d4('0x66')]]);if(_0x103634[_0x53d4('0xa5')]===-0x1){return _0x103634;}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x53d4('0xe4')]=function(_0x559237){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0xe5'),_0x559237[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x559237[_0x53d4('0x84')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xe6'));}if(!this[_0x53d4('0x86')](_0x559237[_0x53d4('0x5e')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xaa'));}this[_0x53d4('0xd')][_0x53d4('0xe7')]=!![];this['createSquareDetailsReport'](_0x559237);this[_0x53d4('0x41')](_0x559237[_0x53d4('0x5e')],'in','','');this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xe8'),_0x559237[_0x53d4('0x5e')]));var _0xa4bce8=this[_0x53d4('0x7a')]['sync'](this,_0x559237);if(_0xa4bce8){for(var _0x24c331 in _0xa4bce8){if(_0xa4bce8[_0x53d4('0x97')](_0x24c331)){this['channel']['setVariable'](util[_0x53d4('0x2a')]('DIALOGFLOW_%s',_0x24c331[_0x53d4('0x6c')]()),_0xa4bce8[_0x24c331]);}}this[_0x53d4('0x41')](_0xa4bce8['speech'],_0x53d4('0xe9'),_0x53d4('0xe4'),'');return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xea'),_0xa4bce8[_0x53d4('0xeb')]));}return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x559237,_0x53d4('0xec'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xed')]=function(_0x37b75a){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0xee'),_0x37b75a[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x37b75a['dialogflowV2_project_id'])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0xef'));}if(!this['isConfigured'](_0x37b75a['client_email'])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xf0'));}if(!this['isConfigured'](_0x37b75a[_0x53d4('0x7d')])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0xf1'));}if(!this[_0x53d4('0x86')](_0x37b75a[_0x53d4('0x7e')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xf2'));}if(!this['isConfigured'](_0x37b75a[_0x53d4('0x5e')])){return this['channel']['noop'](_0x53d4('0xaa'));}this[_0x53d4('0xd')]['bot']=!![];this[_0x53d4('0x36')](_0x37b75a);this[_0x53d4('0x41')](_0x37b75a[_0x53d4('0x5e')],'in','','');this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('Trying\x20DialogflowV2:\x20%s',_0x37b75a['text']));var _0x37a6b2=this['googleDialogflowV2'][_0x53d4('0x73')](this,_0x37b75a);if(_0x37a6b2){for(var _0x460c68 in _0x37a6b2){if(_0x37a6b2['hasOwnProperty'](_0x460c68)){if(_0x460c68!==_0x53d4('0xf3')){this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0xf4'),_0x460c68[_0x53d4('0x6c')]()),_0x37a6b2[_0x460c68]);}}}this[_0x53d4('0x41')](_0x37a6b2[_0x53d4('0xeb')],_0x53d4('0xe9'),_0x53d4('0xed'),_0x37a6b2[_0x53d4('0xf3')]);return this[_0x53d4('0xd')]['noop'](util['format'](_0x53d4('0xf5'),_0x37a6b2[_0x53d4('0xeb')]));}return this['channel'][_0x53d4('0x32')](_0x37b75a,_0x53d4('0xf6'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xf7')]=function(_0x281db6){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x281db6['label']));if(!this[_0x53d4('0x86')](_0x281db6[_0x53d4('0xf8')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xf9'));}if(!this[_0x53d4('0x86')](_0x281db6['username'])){return this[_0x53d4('0xd')]['noop']('no\x20username\x20configured');}if(!this['isConfigured'](_0x281db6['password'])){return this[_0x53d4('0xd')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x281db6['ndassistant_url'])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xaa'));}this[_0x53d4('0xd')][_0x53d4('0xe7')]=!![];this[_0x53d4('0x36')](_0x281db6);this['createSquareMessage'](_0x281db6['text'],'in','','');this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('Trying\x20SestekNDA:\x20%s',_0x281db6['text']));var _0x1ff6d0=this[_0x53d4('0xfa')][_0x53d4('0x73')](this,_0x281db6);if(_0x1ff6d0){for(var _0x2f6f39 in _0x1ff6d0){if(_0x1ff6d0[_0x53d4('0x97')](_0x2f6f39)){this['channel'][_0x53d4('0xa1')](util['format'](_0x53d4('0xfb'),_0x2f6f39[_0x53d4('0x6c')]()),_0x1ff6d0[_0x2f6f39]);}}this[_0x53d4('0x41')](_0x1ff6d0[_0x53d4('0xeb')],_0x53d4('0xe9'),'sesteknda','');if(_0x1ff6d0['audiofile']){this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0xfc'),_0x1ff6d0[_0x53d4('0xfd')]));var _0x592716=this[_0x53d4('0xd')][_0x53d4('0xfe')](_0x1ff6d0[_0x53d4('0xfd')]);try{fs['unlink'](_0x1ff6d0['audiofile']+_0x53d4('0xff'));}catch(_0x109852){logger['error'](_0x109852);}return _0x592716;}else{return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x100'),_0x1ff6d0['speech']));}}return this['channel'][_0x53d4('0x32')](_0x281db6,_0x53d4('0x101'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x102')]=function(_0x5373a0){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x103'),_0x5373a0[_0x53d4('0x38')]));return this['channel'][_0x53d4('0xc3')](_0x53d4('0x102'));};AGIVertices['prototype'][_0x53d4('0x104')]=function(_0x5d624c){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x105'),_0x5d624c['label']));var _0x47ac3f='';if(_0x5d624c['trunk_id']){if(!this[_0x53d4('0x86')](_0x5d624c[_0x53d4('0x106')])){return this['channel'][_0x53d4('0x32')](_0x5d624c,_0x53d4('0x107'));}else{var _0x205a77=parseInt(_0x5d624c[_0x53d4('0x106')],0xa);if(isNaN(_0x205a77)){_0x47ac3f=_0x5d624c[_0x53d4('0x106')];}else{_0x47ac3f=this['getTrunk'][_0x53d4('0x73')](this,_0x5d624c['trunk_id']);if(!_0x47ac3f){return this['channel'][_0x53d4('0x32')](_0x5d624c,_0x53d4('0x108'));}}}}else if(_0x5d624c[_0x53d4('0x109')]){_0x47ac3f=_0x5d624c[_0x53d4('0x109')];}else{return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x5d624c,_0x53d4('0x107'));}var _0x72d66=this[_0x53d4('0xd')]['exec'](_0x53d4('0xe1'),[util[_0x53d4('0x2a')]('SIP/%s/%s',_0x47ac3f,_0x5d624c[_0x53d4('0x48')]),_0x5d624c[_0x53d4('0x68')],_0x5d624c[_0x53d4('0xe3')],_0x5d624c[_0x53d4('0x66')]]);if(_0x72d66[_0x53d4('0xa5')]===-0x1){return _0x72d66;}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x10a'),_0x53d4('0xe1')));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x10b')]=function(_0x1448f6){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x10c'),_0x1448f6[_0x53d4('0x38')]));return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0x10b'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0xb')]=function(_0xb96f74){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xb96f74['label']));if(_0xb96f74[_0x53d4('0xa8')]===0x0){return this['maxRetry'](_0xb96f74);}_0xb96f74[_0x53d4('0xa8')]-=0x1;if(!this[_0x53d4('0x86')](_0xb96f74[_0x53d4('0x10d')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0xb96f74,_0x53d4('0x10e'));}var _0x4d5f81=this[_0x53d4('0x21')][_0x53d4('0x73')](this,_0xb96f74[_0x53d4('0x10d')]);if(!_0x4d5f81){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0xb96f74,_0x53d4('0x10f'));}if(!this['isConfigured'](_0xb96f74[_0x53d4('0xd3')])){return this[_0x53d4('0xd')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3f34e0=this[_0x53d4('0xd')][_0x53d4('0x110')](_0x4d5f81,_0xb96f74[_0x53d4('0x111')],_0xb96f74[_0x53d4('0x112')]);var _0x2bfd51=_0x3f34e0['result']?_0x3f34e0['result']['toString']():'';logger[_0x53d4('0x2e')](_0x53d4('0x113'),JSON['stringify'](_0x3f34e0));if(_0x3f34e0['result']===-0x1){this['createSquareDetailsReport'][_0x53d4('0x73')](this,_0xb96f74,_0x2bfd51);return _0x3f34e0;}else if(_0x3f34e0[_0x53d4('0xa4')]===_0x53d4('0x68')){_0x3f34e0[_0x53d4('0xa5')]=_0x2bfd51[_0x53d4('0x9e')]>=parseInt(_0xb96f74[_0x53d4('0x114')])?'x':'i';}else{_0x3f34e0['result']=_0x2bfd51['length']>=parseInt(_0xb96f74[_0x53d4('0x114')])&&_0x2bfd51[_0x53d4('0x9e')]<=parseInt(_0xb96f74[_0x53d4('0x112')])?'x':'i';}var _0x4452f0=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0xb96f74['variable_id']);if(!_0x4452f0){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0xb96f74,'no\x20variable\x20found');}this[_0x53d4('0xd')][_0x53d4('0xa1')](_0x4452f0,_0x2bfd51);if(this['isConfigured'](_0xb96f74[_0x53d4('0x115')])){var _0x157281=parseInt(_0xb96f74[_0x53d4('0x115')],0xa);var _0x395165=rs[_0x53d4('0x116')]({'charset':'*','length':_0x157281});var _0x859a5a=_0x2bfd51[_0x53d4('0x9e')];if(_0x859a5a>0x0){if(_0x859a5a>_0x157281){this['createSquareDetailsReport']['sync'](this,_0xb96f74,_0xb96f74['hiddendigitspos']===_0x53d4('0x117')?_0x395165+_0x2bfd51[_0x53d4('0x118')](_0x157281):_0x2bfd51[_0x53d4('0x118')](0x0,_0x859a5a-_0x157281)+_0x395165);}else{this['createSquareDetailsReport'][_0x53d4('0x73')](this,_0xb96f74,rs[_0x53d4('0x116')]({'charset':'*','length':_0x859a5a}));}}else{this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0xb96f74,'');}}else{this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0xb96f74,_0x2bfd51);}return _0x3f34e0;};AGIVertices[_0x53d4('0x14')][_0x53d4('0xc')]=function(_0x3ea950){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0x119'),_0x3ea950[_0x53d4('0x38')]));return this[_0x53d4('0xb')](_0x3ea950);};AGIVertices[_0x53d4('0x14')]['goal']=function(_0xf80705){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x11a'),_0xf80705[_0x53d4('0x38')]));this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0xf80705,_0xf80705['goalname']);return this['channel']['noop'](util[_0x53d4('0x2a')](_0x53d4('0x11b'),_0xf80705[_0x53d4('0x11c')]));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x11d')]=function(_0x131435){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0x11e'),_0x131435[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x131435[_0x53d4('0x89')])||!this[_0x53d4('0x86')](_0x131435[_0x53d4('0x8e')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0x11f'));}if(!this[_0x53d4('0x86')](_0x131435['text'])){return this[_0x53d4('0xd')][_0x53d4('0xc3')]('no\x20text\x20configured');}this[_0x53d4('0xd')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x131435['text']));var _0x4f3b36=this[_0x53d4('0x88')][_0x53d4('0x73')](this,_0x131435);if(_0x4f3b36){this[_0x53d4('0xd')]['noop'](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x4f3b36));var _0xe01f50=this[_0x53d4('0xd')][_0x53d4('0xfe')](_0x4f3b36);try{fs['unlink'](_0x4f3b36+'.wav');}catch(_0x54795a){logger[_0x53d4('0x32')](_0x54795a);}return _0xe01f50;}return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x131435,_0x53d4('0x120'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x121')]=function(_0x2081ea){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x122'),_0x2081ea[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x2081ea[_0x53d4('0x89')])||!this[_0x53d4('0x86')](_0x2081ea[_0x53d4('0x8e')])){return this['channel'][_0x53d4('0xc3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x53d4('0x86')](_0x2081ea[_0x53d4('0x90')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0x123'));}if(!this[_0x53d4('0x86')](_0x2081ea[_0x53d4('0x5e')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xaa'));}this[_0x53d4('0xd')][_0x53d4('0xe7')]=!![];this[_0x53d4('0x36')](_0x2081ea);this[_0x53d4('0x41')](_0x2081ea[_0x53d4('0x5e')],'in','','');this['channel'][_0x53d4('0xc3')](util['format'](_0x53d4('0x124'),_0x2081ea['text']));var _0x43f17b=this['awsLex'][_0x53d4('0x73')](this,_0x2081ea);if(_0x43f17b){for(var _0x30d36c in _0x43f17b){if(_0x43f17b[_0x53d4('0x97')](_0x30d36c)&&_['isString'](_0x43f17b[_0x30d36c])){this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0x125'),_0x30d36c[_0x53d4('0x6c')]()),_0x43f17b[_0x30d36c]);}}if(_[_0x53d4('0x44')](_0x43f17b[_0x53d4('0x78')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x53d4('0x41')](_0x43f17b[_0x53d4('0x78')],_0x53d4('0xe9'),_0x53d4('0x126'),'');return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('Amazon\x20Lex\x20Result\x20%s',_0x43f17b[_0x53d4('0x78')]));}}return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x2081ea,_0x53d4('0x127'));};AGIVertices[_0x53d4('0x14')]['googleasr']=function(_0x1a2d0f){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x128'),_0x1a2d0f[_0x53d4('0x38')],_0x1a2d0f[_0x53d4('0x68')]));if(!this[_0x53d4('0x86')](_0x1a2d0f[_0x53d4('0x84')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xe6'));}var _0x41f35f=_0x53d4('0x129');var _0x5281fa=util[_0x53d4('0x2a')](_0x53d4('0x12a'),FILES_PATH,rs[_0x53d4('0x116')](0x4));var _0x171170=util[_0x53d4('0x2a')](_0x53d4('0xa0'),_0x5281fa,_0x41f35f);var _0x53c6d7=!![];if(_0x1a2d0f[_0x53d4('0x12b')]===_0x53d4('0x12c')){_0x53c6d7=![];}var _0x498d64=this[_0x53d4('0xd')][_0x53d4('0x12d')](_0x5281fa,_0x41f35f,_0x1a2d0f[_0x53d4('0x12e')],_0x1a2d0f[_0x53d4('0x68')],undefined,_0x53c6d7);if(_0x498d64[_0x53d4('0xa5')]!==-0x1){this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x12f'),_0x171170));var _0x24c7fc=this[_0x53d4('0x91')][_0x53d4('0x73')](this,_0x1a2d0f,_0x171170);if(_0x24c7fc){for(var _0x2492b5 in _0x24c7fc){if(_0x24c7fc[_0x53d4('0x97')](_0x2492b5)){this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')]('GOOGLE_ASR_%s',_0x2492b5[_0x53d4('0x6c')]()),_0x24c7fc[_0x2492b5]);}}return this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0x53d4('0x76')](_0x24c7fc)));}}return _0x498d64;};AGIVertices[_0x53d4('0x14')][_0x53d4('0x130')]=function(_0x2e754f){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x131'),_0x2e754f[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x2e754f[_0x53d4('0x132')])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0x133'));}if(!this[_0x53d4('0x86')](_0x2e754f[_0x53d4('0x134')])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0x135'));}var _0x7e0762='wav';var _0x5d1647=util[_0x53d4('0x2a')](_0x53d4('0x12a'),FILES_PATH,rs[_0x53d4('0x116')](0x4));var _0x257b57=util[_0x53d4('0x2a')]('%s.%s',_0x5d1647,_0x7e0762);var _0x101020=!![];if(_0x2e754f[_0x53d4('0x12b')]===_0x53d4('0x12c')){_0x101020=![];}var _0x37cd73=this[_0x53d4('0xd')][_0x53d4('0x12d')](_0x5d1647,_0x7e0762,_0x2e754f['intKey'],_0x2e754f[_0x53d4('0x68')],undefined,_0x101020);if(_0x37cd73[_0x53d4('0xa5')]!==-0x1){this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x136'),_0x257b57));var _0x201e1e=this['tildeASR'][_0x53d4('0x73')](this,_0x2e754f,_0x257b57);if(_0x201e1e){for(var _0x30ef16 in _0x201e1e){if(_0x201e1e['hasOwnProperty'](_0x30ef16)){this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0x137'),_0x30ef16[_0x53d4('0x6c')]()),_0x201e1e[_0x30ef16]);}}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x53d4('0x76')](_0x201e1e)));}}return _0x37cd73;};AGIVertices[_0x53d4('0x14')][_0x53d4('0x138')]=function(_0x340904){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x139'),_0x340904[_0x53d4('0x38')]));return this[_0x53d4('0xd')][_0x53d4('0x13a')](_0x340904[_0x53d4('0x13b')],_0x340904[_0x53d4('0x3c')],_0x340904[_0x53d4('0x3d')]);};AGIVertices['prototype'][_0x53d4('0x13c')]=function(_0x4a76ae){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x13d'),_0x4a76ae['label']));if(!this[_0x53d4('0x86')](_0x4a76ae[_0x53d4('0x13e')])){return this[_0x53d4('0xd')]['error'](_0x4a76ae,_0x53d4('0x13f'));}try{var _0x43d5d9=eval(_0x4a76ae[_0x53d4('0x13e')])?_0x53d4('0x140'):'false';this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x141'),_0x4a76ae['condition'],_0x43d5d9));return{'code':0xc8,'result':_0x43d5d9};}catch(_0x1dd1dc){return{'code':0xc8,'result':_0x53d4('0x142')};}};AGIVertices[_0x53d4('0x14')]['gotoiftime']=function(_0x192e9e){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x143'),_0x192e9e[_0x53d4('0x38')]));if(!this['isConfigured'](_0x192e9e[_0x53d4('0x144')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x192e9e,_0x53d4('0x145'));}var _0x70b08=this['getIntervals'][_0x53d4('0x73')](this,_0x192e9e[_0x53d4('0x144')]);if(!_0x70b08){return this[_0x53d4('0xd')]['error'](_0x192e9e,_0x53d4('0x146'));}for(var _0x97f984=0x0;_0x97f984<_0x70b08['length'];_0x97f984+=0x1){var _0x8050f4=this['channel'][_0x53d4('0xf')](util[_0x53d4('0x2a')](_0x53d4('0x147'),_0x70b08[_0x97f984]));if(_0x8050f4['result']===-0x1){return _0x8050f4;}logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x148'),_0x70b08[_0x97f984],_0x8050f4['extra']));if(_0x8050f4[_0x53d4('0xa4')]==='true'){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x148'),_0x70b08[_0x97f984],'true'));this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x148'),_0x70b08[_0x97f984],_0x53d4('0x140')));return{'code':0xc8,'result':_0x53d4('0x140')};}else{logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x148'),_0x70b08[_0x97f984],'false'));this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')]('IFTIME\x20%s\x20%s',_0x70b08[_0x97f984],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x53d4('0x14')][_0x53d4('0x149')]=function(_0x4a157e){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x14a'),_0x4a157e['label']));return this[_0x53d4('0xd')][_0x53d4('0x149')]();};AGIVertices[_0x53d4('0x14')][_0x53d4('0x14b')]=function(_0x38838b){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x14c'),_0x38838b[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x38838b[_0x53d4('0x84')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xe6'));}var _0x56d593=_0x53d4('0x129');var _0x5bec92=util['format'](_0x53d4('0x12a'),FILES_PATH,rs[_0x53d4('0x116')](0x4));var _0x4c0a10=util[_0x53d4('0x2a')](_0x53d4('0xa0'),_0x5bec92,_0x56d593);var _0x246650=!![];if(_0x38838b[_0x53d4('0x12b')]===_0x53d4('0x12c')){_0x246650=![];}var _0x498bd4=this[_0x53d4('0xd')]['recordFile'](_0x5bec92,_0x56d593,_0x38838b[_0x53d4('0x12e')],_0x38838b['timeout'],undefined,_0x246650);if(_0x498bd4[_0x53d4('0xa5')]!==-0x1){this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('ispeech\x20%s\x20file\x20created',_0x4c0a10));var _0x2955cc=this['ispeechASR']['sync'](this,_0x38838b,_0x4c0a10);if(_0x2955cc){for(var _0xf022c7 in _0x2955cc){if(_0x2955cc[_0x53d4('0x97')](_0xf022c7)){this['channel'][_0x53d4('0xa1')](util['format'](_0x53d4('0x14d'),_0xf022c7['toUpperCase']()),_0x2955cc[_0xf022c7]);}}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('IspeechASR\x20Result\x20%s',JSON[_0x53d4('0x76')](_0x2955cc)));}}return _0x498bd4;};AGIVertices[_0x53d4('0x14')]['ispeechtts']=function(_0x31da65){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x14e'),_0x31da65[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x31da65['key'])){return this[_0x53d4('0xd')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x31da65[_0x53d4('0x5e')])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xaa'));}this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x14f'),_0x31da65['text']));var _0x270cc7=this[_0x53d4('0x7f')][_0x53d4('0x73')](this,_0x31da65);if(_0x270cc7){this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('ispeech\x20%s\x20file\x20created',_0x270cc7));var _0x62f12=this[_0x53d4('0xd')][_0x53d4('0xfe')](_0x270cc7,_0x31da65[_0x53d4('0x12e')]);try{fs[_0x53d4('0x150')](_0x270cc7+'.wav');}catch(_0x546eaa){logger[_0x53d4('0x32')](_0x546eaa);}return _0x62f12;}return this['channel'][_0x53d4('0x32')](_0x31da65,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x6f8ef2){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x151'),_0x6f8ef2['label']));if(!this[_0x53d4('0x86')](_0x6f8ef2[_0x53d4('0x152')])){return this['channel'][_0x53d4('0x32')](_0x6f8ef2,_0x53d4('0x153'));}logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x154'),this[_0x53d4('0xd')]['callerid'],_0x6f8ef2[_0x53d4('0x152')]));var _0x23932d=this[_0x53d4('0x56')][_0x53d4('0x73')](this,_0x6f8ef2[_0x53d4('0x152')]);if(_0x23932d){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x155'),this['channel'][_0x53d4('0x53')],_0x6f8ef2[_0x53d4('0x152')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x155'),this[_0x53d4('0xd')]['callerid'],_0x6f8ef2[_0x53d4('0x152')]));return{'code':0xc8,'result':_0x53d4('0x156')};}else{logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x157'),this[_0x53d4('0xd')]['callerid'],_0x6f8ef2[_0x53d4('0x152')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x157'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x6f8ef2[_0x53d4('0x152')]));return{'code':0xc8,'result':_0x53d4('0x158')};}};AGIVertices[_0x53d4('0x14')][_0x53d4('0x159')]=function(_0x42d486){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x42d486['label']));if(!this[_0x53d4('0x86')](_0x42d486[_0x53d4('0x152')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x42d486,_0x53d4('0x153'));}logger['info'](util[_0x53d4('0x2a')](_0x53d4('0x154'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x42d486['findBy']));var _0x12602b=this[_0x53d4('0x55')][_0x53d4('0x73')](this,_0x42d486[_0x53d4('0x152')]);if(_0x12602b){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x155'),this['channel'][_0x53d4('0x53')],_0x42d486[_0x53d4('0x152')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x155'),this['channel'][_0x53d4('0x53')],_0x42d486[_0x53d4('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x157'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x42d486[_0x53d4('0x152')]));this['channel'][_0x53d4('0xc3')](util['format'](_0x53d4('0x157'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x42d486[_0x53d4('0x152')]));return{'code':0xc8,'result':_0x53d4('0x158')};}};AGIVertices['prototype'][_0x53d4('0x15a')]=function(_0x5ee3fa){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x15b'),_0x5ee3fa[_0x53d4('0x38')]));if(!this['isConfigured'](_0x5ee3fa[_0x53d4('0x15c')])){return this['channel'][_0x53d4('0x32')](_0x5ee3fa,_0x53d4('0x15d'));}this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x15e'),_0x5ee3fa[_0x53d4('0x15c')]));var _0x3d37e5=eval(_0x5ee3fa[_0x53d4('0x15c')]);if(!this['isConfigured'](_0x5ee3fa['variable_id'])){return this['channel']['noop'](_0x53d4('0xd4'));}var _0x3ca2d3=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x5ee3fa[_0x53d4('0xd3')]);if(!_0x3ca2d3){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x5ee3fa,_0x53d4('0xd5'));}if(_[_0x53d4('0x9d')](_0x3d37e5)){var _0x3672da=this;_0x3d37e5['forEach'](function(_0x37d508,_0x190581){_0x3672da[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0x15f'),_0x3ca2d3,_0x190581),_0x37d508);});return this[_0x53d4('0xd')]['noop'](util['format'](_0x53d4('0x160'),_0x3ca2d3));}else{return this[_0x53d4('0xd')][_0x53d4('0xa1')](_0x3ca2d3,_0x3d37e5);}};AGIVertices[_0x53d4('0x14')]['menu']=function(_0x3d391c){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x161'),_0x3d391c[_0x53d4('0x38')]));if(_0x3d391c[_0x53d4('0xa8')]===0x0){return this['maxRetry'](_0x3d391c);}_0x3d391c[_0x53d4('0xa8')]-=0x1;if(!this[_0x53d4('0x86')](_0x3d391c[_0x53d4('0x10d')])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x3d391c,_0x53d4('0x10e'));}var _0x380c2f=this['getSound'][_0x53d4('0x73')](this,_0x3d391c[_0x53d4('0x10d')]);if(!_0x380c2f){return this[_0x53d4('0xd')]['error'](_0x3d391c,_0x53d4('0x10f'));}var _0x976964=this[_0x53d4('0xd')][_0x53d4('0x110')](_0x380c2f,_0x3d391c[_0x53d4('0x111')],_0x3d391c['digit']);var _0x28dfed=_0x976964[_0x53d4('0xa5')];if(_0x976964['result']===-0x1){this['createSquareDetailsReport'][_0x53d4('0x73')](this,_0x3d391c,'-1');return _0x976964;}else if(_0x976964['extra']==='timeout'){_0x976964[_0x53d4('0xa5')]=_0x976964[_0x53d4('0xa5')]['length']>0x0?_0x976964[_0x53d4('0xa5')]:'t';}else if(_[_0x53d4('0x43')](_0x976964[_0x53d4('0xa5')])){_0x976964[_0x53d4('0xa5')]='#';_0x28dfed='#';}if(!this['isConfigured'](_0x3d391c[_0x53d4('0xd3')])){this[_0x53d4('0xd')][_0x53d4('0xc3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x35ead6=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x3d391c['variable_id']);if(!_0x35ead6){return this['channel'][_0x53d4('0x32')](_0x3d391c,_0x53d4('0xd5'));}this[_0x53d4('0xd')]['setVariable'](_0x35ead6,_0x28dfed);}this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0x3d391c,_0x28dfed);return _0x976964;};AGIVertices[_0x53d4('0x14')][_0x53d4('0xc3')]=function(_0x1cb01b){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x162'),_0x1cb01b[_0x53d4('0x38')]));return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x1cb01b[_0x53d4('0x163')]||_0x1cb01b[_0x53d4('0x38')]);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x164')]=function(_0x316e18){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x165'),_0x316e18[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x316e18['findBy'])){return this['channel'][_0x53d4('0x32')](_0x316e18,_0x53d4('0x153'));}logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x154'),this[_0x53d4('0xd')]['callerid'],_0x316e18[_0x53d4('0x152')]));var _0x3fc04b=this['getPause']['sync'](this,_0x316e18[_0x53d4('0x166')]);var _0x59c692=this['agentPause'][_0x53d4('0x73')](this,_0x316e18[_0x53d4('0x152')],_0x3fc04b);if(_0x59c692){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x155'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x316e18['findBy']));this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x155'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x316e18[_0x53d4('0x152')]));return{'code':0xc8,'result':_0x53d4('0x156')};}else{logger['info'](util[_0x53d4('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x53d4('0xd')][_0x53d4('0x53')],_0x316e18[_0x53d4('0x152')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x155'),this[_0x53d4('0xd')][_0x53d4('0x53')],_0x316e18[_0x53d4('0x152')]));return{'code':0xc8,'result':_0x53d4('0x158')};}};AGIVertices[_0x53d4('0x14')][_0x53d4('0x167')]=function(_0x370ed3){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x168'),_0x370ed3['label']));if(!this['isConfigured'](_0x370ed3['file_id'])){return this[_0x53d4('0xd')]['error'](_0x370ed3,'no\x20file\x20audio\x20selected');}var _0x4e076f=this[_0x53d4('0x21')][_0x53d4('0x73')](this,_0x370ed3[_0x53d4('0x10d')]);if(!_0x4e076f){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x370ed3,_0x53d4('0x10f'));}var _0x41d7cf=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0x169'),[_0x4e076f,_0x370ed3[_0x53d4('0xe3')]]);if(_0x41d7cf[_0x53d4('0xa5')]===-0x1){return _0x41d7cf;}return this['channel']['noop'](util[_0x53d4('0x2a')](_0x53d4('0xc0'),_0x53d4('0x169'),_0x4e076f));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x16a')]=function(_0x5079e1){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x16b'),_0x5079e1['label']));if(!this[_0x53d4('0x86')](_0x5079e1['queue_id'])){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x5079e1,'no\x20queue\x20selected');}var _0x44248b='';var _0x2db3c2=parseInt(_0x5079e1[_0x53d4('0x16c')],0xa);if(isNaN(_0x2db3c2)){_0x44248b=_0x5079e1['queue_id'];}else{_0x44248b=this[_0x53d4('0x15')][_0x53d4('0x73')](this,_0x5079e1[_0x53d4('0x16c')]);if(!_0x44248b){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x5079e1,'no\x20queue\x20found');}}var _0x222ea2='';if(this[_0x53d4('0x86')](_0x5079e1[_0x53d4('0x10d')])){var _0x5a384=this[_0x53d4('0x21')][_0x53d4('0x73')](this,_0x5079e1[_0x53d4('0x10d')]);if(_0x5a384){_0x222ea2=_0x5a384;}}this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0x5079e1,_0x44248b);if(_0x5079e1[_0x53d4('0xe3')][_0x53d4('0x16d')]('x')<0x0){_0x5079e1['opts']+='x';}if(_0x5079e1[_0x53d4('0xe3')][_0x53d4('0x16d')]('X')<0x0){_0x5079e1['opts']+='X';}this[_0x53d4('0xd')][_0x53d4('0xa1')]('XMCS-QUEUE',_0x44248b?_0x44248b[_0x53d4('0x16e')]():'');var _0x13ec2a=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0x16f'),[_0x44248b,_0x5079e1['opts'],_0x5079e1['url'],_0x222ea2,_0x5079e1[_0x53d4('0x68')],_0x5079e1[_0x53d4('0x7')],_0x5079e1[_0x53d4('0x170')],_0x5079e1[_0x53d4('0x171')],'',_0x5079e1['position']]);if(_0x13ec2a[_0x53d4('0xa5')]===-0x1){return _0x13ec2a;}return this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xc0'),_0x53d4('0x16f'),_0x44248b));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x172')]=function(_0x37e27a){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x173'),_0x37e27a[_0x53d4('0x38')]));var _0x3d6095=_0x37e27a[_0x53d4('0x174')]||_0x53d4('0x129');var _0x1923ee=util[_0x53d4('0x2a')](_0x53d4('0x175'),this[_0x53d4('0xd')][_0x53d4('0x37')],rs[_0x53d4('0x116')](0x5));var _0x43f1be=util[_0x53d4('0x2a')](_0x53d4('0x176'),FILES_PATH,_0x1923ee,_0x3d6095);var _0x72fb9f=util[_0x53d4('0x2a')](_0x53d4('0x12a'),FILES_PATH,_0x1923ee);this[_0x53d4('0x3a')][_0x53d4('0x73')](this,_0x37e27a,_0x1923ee,_0x43f1be);this[_0x53d4('0xd')]['setVariable'](_0x53d4('0x177'),_0x1923ee);logger[_0x53d4('0x2e')](_0x53d4('0x178'),_0x72fb9f,_0x3d6095,_0x37e27a[_0x53d4('0x179')],_0x37e27a['timeout']);return this[_0x53d4('0xd')][_0x53d4('0x12d')](_0x72fb9f,_0x3d6095,_0x37e27a[_0x53d4('0x179')],_0x37e27a[_0x53d4('0x68')],undefined,!![]);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x17a')]=function(_0x1f58ac){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x17b'),_0x1f58ac[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x1f58ac[_0x53d4('0x66')])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0x17c'));}var _0x40becc=this[_0x53d4('0x65')][_0x53d4('0x73')](this,_0x1f58ac);logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x17d'),util[_0x53d4('0x17e')](_0x40becc,{'showHidden':![],'depth':null})));if(!this[_0x53d4('0x86')](_0x1f58ac['variable_id'])){return this[_0x53d4('0xd')][_0x53d4('0xc3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4aeefe=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x1f58ac[_0x53d4('0xd3')]);if(!_0x4aeefe){return this['channel'][_0x53d4('0x32')](_0x1f58ac,_0x53d4('0xd5'));}this[_0x53d4('0xd')][_0x53d4('0xa1')](util[_0x53d4('0x2a')](_0x53d4('0x17f'),_0x4aeefe),_0x40becc[_0x53d4('0x180')]?_0x40becc[_0x53d4('0x180')]:_0x53d4('0x181'));this[_0x53d4('0xd')]['setVariable'](util[_0x53d4('0x2a')](_0x53d4('0x182'),_0x4aeefe),_0x40becc['statusMessage']?_0x40becc['statusMessage']:'OK');if(_0x40becc[_0x53d4('0x6d')]){try{this[_0x53d4('0x9f')](_0x40becc[_0x53d4('0x6d')],_0x4aeefe);}catch(_0x2793e9){logger[_0x53d4('0x32')](util[_0x53d4('0x2a')](_0x53d4('0x183'),_0x4aeefe));}}return this['channel'][_0x53d4('0xc3')](util['format'](_0x53d4('0xda'),_0x4aeefe));};AGIVertices[_0x53d4('0x14')]['saydigits']=function(_0xe37af9){logger['info'](util[_0x53d4('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xe37af9['label']));return this[_0x53d4('0xd')][_0x53d4('0x184')](_0xe37af9['digits'][_0x53d4('0x185')](/\s+/g,''),_0xe37af9['escape_digits']);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x186')]=function(_0x5cf481){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x187'),_0x5cf481[_0x53d4('0x38')]));return this[_0x53d4('0xd')][_0x53d4('0x188')](_0x5cf481[_0x53d4('0x189')][_0x53d4('0x185')](/\s+/g,''),_0x5cf481[_0x53d4('0x179')]);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x18a')]=function(_0x1956e2){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x18b'),_0x1956e2[_0x53d4('0x38')]));return this[_0x53d4('0xd')]['sayPhonetic'](_0x1956e2[_0x53d4('0x5e')],_0x1956e2[_0x53d4('0x179')]);};AGIVertices[_0x53d4('0x14')][_0x53d4('0x18c')]=function(_0x486c48){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x18d'),_0x486c48['label']));if(!this[_0x53d4('0x86')](_0x486c48[_0x53d4('0x18e')])){return this[_0x53d4('0xd')]['noop']('no\x20mail\x20account\x20configured');}var _0x5e074d=this[_0x53d4('0x23')][_0x53d4('0x73')](this,_0x486c48[_0x53d4('0x18e')]);if(!_0x5e074d||!_0x5e074d[_0x53d4('0x18f')]){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x486c48,'no\x20mail\x20account\x20found');}var _0x40476c={'from':util[_0x53d4('0x2a')]('\x22%s\x22\x20<%s>',_0x5e074d[_0x53d4('0x12')],_0x5e074d[_0x53d4('0x190')]||_0x5e074d[_0x53d4('0x18f')]['user']),'to':_0x486c48['to']||'','cc':_0x486c48['cc']||'','bcc':_0x486c48[_0x53d4('0x191')]||'','subject':_0x486c48[_0x53d4('0x192')],'html':_0x486c48[_0x53d4('0x5e')],'text':_0x486c48[_0x53d4('0x5e')]};if(this['isConfigured'](_0x486c48['template_id'])){}logger['debug'](_0x53d4('0x193'),JSON['stringify'](_0x40476c));this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0x486c48,_0x486c48[_0x53d4('0x18e')]);this[_0x53d4('0xd')]['noop'](util['format'](_0x53d4('0x194'),_0x5e074d[_0x53d4('0x12')]));this[_0x53d4('0x24')]['sync'](this,_0x5e074d[_0x53d4('0x195')],_0x40476c);return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0x196'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x197')]=function(_0x340405){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0x198'),_0x340405[_0x53d4('0x38')]));return this[_0x53d4('0xd')][_0x53d4('0xc3')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x53d4('0x14')][_0x53d4('0x199')]=function(_0xf9c6b9){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x19a'),_0xf9c6b9['label']));if(!this['isConfigured'](_0xf9c6b9['sms_account_id'])){return this['channel'][_0x53d4('0xc3')]('no\x20sms\x20account\x20configured');}var _0x1b61d9=this[_0x53d4('0x33')][_0x53d4('0x73')](this,_0xf9c6b9[_0x53d4('0x19b')]);if(!_0x1b61d9){return this['channel'][_0x53d4('0x32')](_0xf9c6b9,_0x53d4('0x19c'));}var _0x26b1e7={'body':_0xf9c6b9[_0x53d4('0x19d')],'phone':_0xf9c6b9['to']||'','SmsAccountId':_0x1b61d9['id']};logger[_0x53d4('0xdc')](_0x53d4('0x19e'),JSON[_0x53d4('0x76')](_0x26b1e7));this[_0x53d4('0x36')]['sync'](this,_0xf9c6b9,_0xf9c6b9[_0x53d4('0x19b')]);this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x19f'),_0x1b61d9[_0x53d4('0x12')]));this[_0x53d4('0x35')][_0x53d4('0x73')](this,_0x26b1e7);return this[_0x53d4('0xd')][_0x53d4('0xc3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1a0')]=function(_0x29b07f){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x29b07f['label']));if(!this['isConfigured'](_0x29b07f[_0x53d4('0xd3')])){return this['channel'][_0x53d4('0x32')](_0x29b07f,_0x53d4('0x1a1'));}var _0x1d2ba7=this['getVariable'][_0x53d4('0x73')](this,_0x29b07f['variable_id']);if(!_0x1d2ba7){return this[_0x53d4('0xd')][_0x53d4('0x32')](_0x29b07f,'no\x20variable\x20found');}return this[_0x53d4('0xd')][_0x53d4('0xa1')](_0x1d2ba7,_0x29b07f[_0x53d4('0x1a2')]);};AGIVertices['prototype'][_0x53d4('0x1a3')]=function(_0x475eee){logger[_0x53d4('0x2e')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x475eee[_0x53d4('0x38')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0x1a4'));if(_0x475eee[_0x53d4('0xb8')]===_0x53d4('0x1a5')){this['channel'][_0x53d4('0xc3')](_0x53d4('0x1a6'));return this[_0x53d4('0xd')][_0x53d4('0xb8')]();}return this['channel'][_0x53d4('0xc3')](_0x53d4('0x1a7'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1a8')]=function(_0x33b63a){logger['info'](util[_0x53d4('0x2a')](_0x53d4('0x1a9'),_0x33b63a[_0x53d4('0x38')]));if(!this['isConfigured'](_0x33b63a[_0x53d4('0x1aa')])){return this[_0x53d4('0xd')]['error'](_0x33b63a,_0x53d4('0x1ab'));}var _0x32c381=this[_0x53d4('0x18')][_0x53d4('0x73')](this,_0x33b63a['project_id']);if(!this[_0x53d4('0x86')](_0x32c381)){return this['channel'][_0x53d4('0x32')](_0x33b63a,util['format'](_0x53d4('0x1ac'),_0x33b63a[_0x53d4('0x1aa')]));}if(_0x32c381===this[_0x53d4('0xd')][_0x53d4('0x39')]){return this[_0x53d4('0xd')]['error'](_0x33b63a,_0x53d4('0x1ad'));}this['createSquareDetailsReport'][_0x53d4('0x73')](this,_0x33b63a,_0x32c381);var _0x539546=this[_0x53d4('0xd')][_0x53d4('0x5b')](_0x53d4('0x1ae'),util[_0x53d4('0x2a')](_0x53d4('0x1af'),config[_0x53d4('0x7')]['host']||_0x53d4('0x1b0'),_0x32c381,this['channel'][_0x53d4('0x39')]));if(_0x539546[_0x53d4('0xa5')]===-0x1){return _0x539546;}return this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')](_0x53d4('0xc0'),_0x53d4('0x1ae'),_0x32c381));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1b1')]=function(_0x196b4f){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x1b2'),_0x196b4f[_0x53d4('0x38')]));var _0x103ed5=this[_0x53d4('0x5a')][_0x53d4('0x73')](this,_0x196b4f[_0x53d4('0xb6')]);this[_0x53d4('0x36')][_0x53d4('0x73')](this,_0x196b4f,_0x196b4f[_0x53d4('0xb6')]);if(this[_0x53d4('0x86')](_0x196b4f[_0x53d4('0xd3')])){var _0x581fb6=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x196b4f[_0x53d4('0xd3')]);if(_0x581fb6){this[_0x53d4('0xd')]['setVariable'](_0x581fb6,_0x103ed5);return this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x1b3'),_0x196b4f[_0x53d4('0xb6')],_0x581fb6));}}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x1b4'),_0x196b4f[_0x53d4('0xb6')]));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1b5')]=function(_0x5382de){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x1b6'),_0x5382de[_0x53d4('0x38')]));_0x5382de[_0x53d4('0x5e')]=_0x5382de['text'][_0x53d4('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x53d4('0x86')](_0x5382de[_0x53d4('0x1b7')])){return this['channel'][_0x53d4('0xc3')](_0x53d4('0x1b8'));}if(!this['isConfigured'](_0x5382de['text'])){return this[_0x53d4('0xd')][_0x53d4('0xc3')](_0x53d4('0xaa'));}this['channel'][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0x1b9'),_0x5382de['text']));var _0x3e1da7=this[_0x53d4('0x5d')][_0x53d4('0x73')](this,_0x5382de);if(_0x3e1da7){this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3e1da7));var _0x3eafde=this[_0x53d4('0xd')][_0x53d4('0xfe')](_0x3e1da7);try{fs[_0x53d4('0x150')](_0x3e1da7+_0x53d4('0xff'));}catch(_0x2881f2){logger[_0x53d4('0x32')](_0x2881f2);}return _0x3eafde;}return this[_0x53d4('0xd')]['error'](_0x5382de,_0x53d4('0x1ba'));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1bb')]=function(_0x300191){logger[_0x53d4('0x2e')](util['format'](_0x53d4('0x1bc'),_0x300191[_0x53d4('0x38')]));_0x300191[_0x53d4('0x5e')]=_0x300191[_0x53d4('0x5e')][_0x53d4('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x53d4('0x86')](_0x300191['text'])){return this[_0x53d4('0xd')]['noop'](_0x53d4('0xaa'));}this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format'](_0x53d4('0x1bd'),_0x300191['text']));var _0x55ee94=this[_0x53d4('0x63')][_0x53d4('0x73')](this,_0x300191);if(_0x55ee94){this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x55ee94));var _0x4874f2=this[_0x53d4('0xd')][_0x53d4('0xfe')](_0x55ee94);try{fs[_0x53d4('0x150')](_0x55ee94+_0x53d4('0xff'));}catch(_0x513886){logger[_0x53d4('0x32')](_0x513886);}return _0x4874f2;}return this['channel'][_0x53d4('0x32')](_0x300191,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1be')]=function(_0x368a8e){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x1bf'),_0x368a8e[_0x53d4('0x38')]));if(!this[_0x53d4('0x86')](_0x368a8e[_0x53d4('0x152')])){return this[_0x53d4('0xd')]['error'](_0x368a8e,'no\x20find\x20by\x20configured');}logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x154'),this[_0x53d4('0xd')]['callerid'],_0x368a8e[_0x53d4('0x152')]));var _0x4b38cb=this['agentUnpause'][_0x53d4('0x73')](this,_0x368a8e['findBy']);if(_0x4b38cb){logger[_0x53d4('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x53d4('0xd')][_0x53d4('0x53')],_0x368a8e[_0x53d4('0x152')]));this[_0x53d4('0xd')][_0x53d4('0xc3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x53d4('0x53')],_0x368a8e[_0x53d4('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x157'),this[_0x53d4('0xd')]['callerid'],_0x368a8e[_0x53d4('0x152')]));this[_0x53d4('0xd')]['noop'](util[_0x53d4('0x2a')](_0x53d4('0x157'),this[_0x53d4('0xd')]['callerid'],_0x368a8e[_0x53d4('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1c0')]=function(_0x207326){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x1c1'),_0x207326[_0x53d4('0x38')]));var _0x141a98=this['channel'][_0x53d4('0x5b')]('VOICEMAIL',[_0x207326[_0x53d4('0x1c2')],_0x207326[_0x53d4('0x79')]]);if(_0x141a98[_0x53d4('0xa5')]===-0x1){return _0x141a98;}return this[_0x53d4('0xd')][_0x53d4('0xc3')](util[_0x53d4('0x2a')](_0x53d4('0xc0'),'VOICEMAIL',_0x207326['mailbox']));};AGIVertices[_0x53d4('0x14')][_0x53d4('0x1c3')]=function(_0x3a80af){logger[_0x53d4('0x2e')](util[_0x53d4('0x2a')](_0x53d4('0x1c4'),_0x3a80af['label']));if(!this[_0x53d4('0x86')](_0x3a80af['variable_id'])){return this['channel'][_0x53d4('0x32')](_0x3a80af,_0x53d4('0x1a1'));}var _0x415e73=this[_0x53d4('0xf')][_0x53d4('0x73')](this,_0x3a80af[_0x53d4('0xd3')]);if(!_0x415e73){return this['channel'][_0x53d4('0x32')](_0x3a80af,_0x53d4('0xd5'));}var _0x54b907=this[_0x53d4('0xd')][_0x53d4('0xf')](_0x415e73);return{'code':0xc8,'result':_0x54b907['extra']?_0x54b907[_0x53d4('0xa4')]:'-'};};String[_0x53d4('0x14')][_0x53d4('0xa3')]=function(_0x1e883d,_0xe33597){return this[_0x53d4('0xa2')](_0x1e883d)[_0x53d4('0x1c5')](_0xe33597);};module[_0x53d4('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5eaf3f9..a3f82b9 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 _0xedd7=['blindtransfer','diff','seconds','prototype','queue','ACW','mandatoryDispositionPause','name','QueuePause','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','lastPauseAt','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','bind','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer'];(function(_0x5e7098,_0x1371ba){var _0x50f670=function(_0x102f4a){while(--_0x102f4a){_0x5e7098['push'](_0x5e7098['shift']());}};_0x50f670(++_0x1371ba);}(_0xedd7,0x90));var _0x7edd=function(_0x29a578,_0x406599){_0x29a578=_0x29a578-0x0;var _0x1cebfe=_0xedd7[_0x29a578];return _0x1cebfe;};'use strict';var _=require(_0x7edd('0x0'));var moment=require(_0x7edd('0x1'));var ami=require(_0x7edd('0x2'));var logger=require('../../../config/logger')(_0x7edd('0x3'));var RpcUser=require(_0x7edd('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x8828e3){this['voiceQueues']=_0x8828e3[_0x7edd('0x5')];this[_0x7edd('0x6')]=_0x8828e3['agents'];this['timers']=_0x8828e3[_0x7edd('0x7')];this[_0x7edd('0x8')]={};ami['on'](_0x7edd('0x9'),this['syncAgentConnect'][_0x7edd('0xa')](this));ami['on']('hanguprequest',this[_0x7edd('0xb')][_0x7edd('0xa')](this));ami['on']('hangup',this[_0x7edd('0xc')][_0x7edd('0xa')](this));ami['on'](_0x7edd('0xd'),this[_0x7edd('0xe')]['bind'](this));ami['on'](_0x7edd('0xf'),this['syncAttendedTransfer'][_0x7edd('0xa')](this));ami['on'](_0x7edd('0x10'),this['syncBlindTransfer']['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x7edd('0xa')](this));}function getDiff(_0x67e320){var _0x5d2871=moment()['milliseconds'](0x0);var _0x25c5b8=moment(_0x67e320)['milliseconds'](0x0);return _0x5d2871[_0x7edd('0x11')](_0x25c5b8,_0x7edd('0x12'));}Acw[_0x7edd('0x13')]['startAcw']=function(_0xb53e2a){try{var _0x112ebb=this;var _0x5ab7f5=this['channels'][_0xb53e2a]['interface'];var _0x2bc5a0=this[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x14')];var _0x53d34d=this[_0x7edd('0x5')][_0x2bc5a0];var _0x19bdc8=![];var _0x3863a4=_0x7edd('0x15');if(_0x53d34d['mandatoryDisposition']){if(_0x53d34d[_0x7edd('0x16')]['name']){_0x19bdc8=!![];_0x3863a4=_0x53d34d['mandatoryDispositionPause'][_0x7edd('0x17')];}}return ami['Action']({'action':_0x7edd('0x18'),'interface':_0x5ab7f5,'paused':!![],'reason':_0x3863a4})['then'](function(){if(_0x112ebb[_0x7edd('0x6')][_0x5ab7f5]){return RpcUser['getAgent'](_0x112ebb[_0x7edd('0x6')][_0x5ab7f5]['id'])['then'](function(_0x529d6c){if(_0x529d6c&&!_0x529d6c[_0x7edd('0x19')]){logger[_0x7edd('0x1a')](_0x7edd('0x1b'),_0xb53e2a,_0x5ab7f5,_0x2bc5a0);var _0x14977b=_0x112ebb[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x1c')]&&_0x112ebb[_0x7edd('0x8')][_0xb53e2a][_0x7edd('0x1d')]?_0x112ebb['channels'][_0xb53e2a][_0x7edd('0x1d')]:_0xb53e2a;return RpcUser[_0x7edd('0x1e')](_0x112ebb[_0x7edd('0x6')][_0x5ab7f5],_0x3863a4,_0x14977b)[_0x7edd('0x1f')](function(){if(!_0x19bdc8){_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]={};logger[_0x7edd('0x1a')](_0x7edd('0x20'),_0xb53e2a,_0x112ebb[_0x7edd('0x5')][_0x2bc5a0][_0x7edd('0x21')],_0x5ab7f5,_0x2bc5a0);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['timer']=setTimeout(_0x112ebb[_0x7edd('0x22')][_0x7edd('0xa')](_0x112ebb,_0x5ab7f5),_0x112ebb[_0x7edd('0x5')][_0x2bc5a0][_0x7edd('0x21')]*0x3e8);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['lastPauseAt']=moment()[_0x7edd('0x23')](_0x7edd('0x24'));_0x112ebb[_0x7edd('0x7')][_0x5ab7f5]['uniqueid']=_0xb53e2a;_0x112ebb['timers'][_0x5ab7f5][_0x7edd('0x14')]=_0x2bc5a0;_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x25')]=function(){var _0x1fe904=getDiff(_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x26')]);clearTimeout(_0x112ebb['timers'][_0x5ab7f5][_0x7edd('0x27')]);_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x27')]=![];RpcVoiceAgentReport[_0x7edd('0x28')]({'acwtime':_0x1fe904},_0x112ebb[_0x7edd('0x7')][_0x5ab7f5][_0x7edd('0x29')],_0x5ab7f5)['then'](function(_0x18ebe6){logger['info'](_0x7edd('0x2a'),_0xb53e2a,_0x1fe904,_0x18ebe6);})[_0x7edd('0x2b')](function(_0x57bda0){logger['error'](_0x7edd('0x2c'),_0xb53e2a,_0x57bda0);});delete _0x112ebb[_0x7edd('0x7')][_0x5ab7f5];};}});}else{logger[_0x7edd('0x1a')](_0x7edd('0x2d'),_0xb53e2a,_0x5ab7f5,_0x2bc5a0);}});}})[_0x7edd('0x2b')](function(){logger[_0x7edd('0x2e')](_0x7edd('0x20'),_0xb53e2a,_0x112ebb['voiceQueues'][_0x2bc5a0][_0x7edd('0x21')],_0x5ab7f5,_0x2bc5a0);})['finally'](function(){delete _0x112ebb[_0x7edd('0x8')][_0xb53e2a];});}catch(_0x4d2001){logger[_0x7edd('0x2e')](_0x7edd('0x2f'),_0x4d2001[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0x22')]=function(_0x360c93){try{var _0x2c5336=this;if(_0x2c5336[_0x7edd('0x7')][_0x360c93]){_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x27')]=![];var _0xe03af5=_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x29')];var _0x7a21c4=_0x2c5336[_0x7edd('0x7')][_0x360c93][_0x7edd('0x14')];var _0x467288=_0x2c5336['voiceQueues'][_0x7a21c4][_0x7edd('0x21')];logger[_0x7edd('0x1a')](_0x7edd('0x31'),_0xe03af5,_0x360c93);RpcUser['saveUnpause'](this['agents'][_0x360c93]);RpcVoiceAgentReport['update']({'acwtime':_0x467288,'agentacw':!![]},_0xe03af5,_0x360c93)[_0x7edd('0x1f')](function(_0x3087b4){logger[_0x7edd('0x1a')](_0x7edd('0x2a'),_0xe03af5,_0x467288,_0x3087b4);})[_0x7edd('0x2b')](function(_0x4929fa){logger[_0x7edd('0x2e')](_0x7edd('0x2c'),_0xe03af5,_0x4929fa);});}else{logger[_0x7edd('0x2e')](_0x7edd('0x32'),_0x360c93);if(_0x2c5336[_0x7edd('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x7edd('0x33')](_0x2c5336[_0x7edd('0x7')]));}}}catch(_0x2109f8){logger[_0x7edd('0x2e')](_0x7edd('0x34'),_0x2109f8[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')]['syncAgentConnect']=function(_0x2d37fa){try{if(this[_0x7edd('0x5')][_0x2d37fa['queue']]&&(this[_0x7edd('0x5')][_0x2d37fa[_0x7edd('0x14')]]['acw']||this['voiceQueues'][_0x2d37fa['queue']]['mandatoryDisposition'])){if(this['agents'][_0x2d37fa[_0x7edd('0x35')]]){this['channels'][_0x2d37fa[_0x7edd('0x29')]]={'queue':_0x2d37fa[_0x7edd('0x14')],'interface':_0x2d37fa[_0x7edd('0x35')],'destlinkedid':_0x2d37fa[_0x7edd('0x1d')]};}}}catch(_0x5210e9){logger[_0x7edd('0x2e')](_0x7edd('0x36'),_0x5210e9[_0x7edd('0x30')]);}};Acw['prototype'][_0x7edd('0x37')]=function(_0x713ba3){try{if(this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]]&&(this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]]['acw']||this[_0x7edd('0x5')][_0x713ba3[_0x7edd('0x14')]][_0x7edd('0x38')])){if(this[_0x7edd('0x6')][_0x713ba3[_0x7edd('0x35')]]){this[_0x7edd('0x8')][_0x713ba3[_0x7edd('0x29')]]={'queue':_0x713ba3[_0x7edd('0x14')],'interface':_0x713ba3[_0x7edd('0x35')]};}}}catch(_0x5eb600){logger[_0x7edd('0x2e')](_0x7edd('0x39'),_0x5eb600[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0xb')]=function(_0x39428c){try{if(this[_0x7edd('0x8')][_0x39428c[_0x7edd('0x29')]]&&_[_0x7edd('0x3a')](this[_0x7edd('0x8')][_0x39428c['uniqueid']]['attended'])){logger['info'](_0x7edd('0x3b'),_0x39428c[_0x7edd('0x29')]);this[_0x7edd('0x3c')](_0x39428c[_0x7edd('0x29')]);}else if(this['channels'][_0x39428c['linkedid']]&&_['isUndefined'](this[_0x7edd('0x8')][_0x39428c[_0x7edd('0x3d')]][_0x7edd('0x1c')])){logger[_0x7edd('0x1a')](_0x7edd('0x3e'),_0x39428c[_0x7edd('0x3d')]);this[_0x7edd('0x3c')](_0x39428c[_0x7edd('0x3d')]);}}catch(_0x647b8d){logger[_0x7edd('0x2e')](_0x7edd('0x3f'),_0x647b8d[_0x7edd('0x30')]);}};Acw['prototype'][_0x7edd('0xc')]=function(_0x3eb84c){try{if(this[_0x7edd('0x8')][_0x3eb84c[_0x7edd('0x29')]]&&this[_0x7edd('0x8')][_0x3eb84c['uniqueid']][_0x7edd('0x1c')]){logger[_0x7edd('0x1a')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3eb84c['uniqueid']);this[_0x7edd('0x3c')](_0x3eb84c['uniqueid']);}else if(this['channels'][_0x3eb84c['linkedid']]&&this[_0x7edd('0x8')][_0x3eb84c[_0x7edd('0x3d')]][_0x7edd('0x1c')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3eb84c[_0x7edd('0x3d')]);this[_0x7edd('0x3c')](_0x3eb84c[_0x7edd('0x3d')]);}}catch(_0x120604){logger[_0x7edd('0x2e')](_0x7edd('0x40'),_0x120604[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')]['syncAttendedTransfer']=function(_0x2b3780){try{if(!_['isNil'](this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x41')]])){this[_0x7edd('0x3c')](_0x2b3780[_0x7edd('0x41')]);if(this['channels'][_0x2b3780['secondtransfereruniqueid']]){this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x42')]][_0x7edd('0x1c')]=!![];this[_0x7edd('0x8')][_0x2b3780['transfertargetuniqueid']]=this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x42')]];delete this[_0x7edd('0x8')][_0x2b3780['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x43')]])){this[_0x7edd('0x3c')](_0x2b3780[_0x7edd('0x43')]);if(this['channels'][_0x2b3780['origtransfereruniqueid']]){this['channels'][_0x2b3780[_0x7edd('0x44')]]['attended']=!![];this['channels'][_0x2b3780[_0x7edd('0x41')]]=this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x44')]];delete this[_0x7edd('0x8')][_0x2b3780[_0x7edd('0x44')]];}}}catch(_0x2e6b86){logger[_0x7edd('0x2e')](_0x7edd('0x45'),_0x2e6b86[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0x46')]=function(_0x17c26a){try{if(this[_0x7edd('0x8')][_0x17c26a['transfereruniqueid']]){logger[_0x7edd('0x1a')](_0x7edd('0x47'),JSON['stringify'](_0x17c26a[_0x7edd('0x48')]));this['startAcw'](_0x17c26a[_0x7edd('0x48')]);}else if(this[_0x7edd('0x8')][_0x17c26a[_0x7edd('0x49')]]){logger[_0x7edd('0x1a')](_0x7edd('0x4a'),JSON[_0x7edd('0x33')](_0x17c26a[_0x7edd('0x49')]));this[_0x7edd('0x3c')](_0x17c26a['transfererlinkedid']);}}catch(_0xd02309){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0xd02309[_0x7edd('0x30')]);}};Acw[_0x7edd('0x13')][_0x7edd('0xe')]=function(_0x349639){try{if(this[_0x7edd('0x5')][_0x349639[_0x7edd('0x14')]]&&this[_0x7edd('0x5')][_0x349639[_0x7edd('0x14')]][_0x7edd('0x4b')]===_0x7edd('0x4c')){if(this['agents'][_0x349639['interface']]){logger[_0x7edd('0x1a')](_0x7edd('0x4d'),_0x349639[_0x7edd('0x29')],_0x349639['interface'],_0x349639[_0x7edd('0x14')]);return RpcUser[_0x7edd('0x1e')](this[_0x7edd('0x6')][_0x349639['interface']],'Auto-Pause',_0x349639[_0x7edd('0x29')]);}}}catch(_0x5a1d25){logger['error'](_0x7edd('0x4e'),_0x5a1d25['message']);}};module[_0x7edd('0x4f')]=Acw; \ No newline at end of file +var _0x0af4=['timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','savePause','Auto-Pause','exports','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','acwTimeout'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x0af4,0x166));var _0x40af=function(_0x322b39,_0x45af83){_0x322b39=_0x322b39-0x0;var _0x21309f=_0x0af4[_0x322b39];return _0x21309f;};'use strict';var _=require('lodash');var moment=require(_0x40af('0x0'));var ami=require(_0x40af('0x1'));var logger=require('../../../config/logger')(_0x40af('0x2'));var RpcUser=require(_0x40af('0x3'));var RpcVoiceAgentReport=require(_0x40af('0x4'));function Acw(_0x225ca7){this['voiceQueues']=_0x225ca7[_0x40af('0x5')];this[_0x40af('0x6')]=_0x225ca7[_0x40af('0x6')];this['timers']=_0x225ca7[_0x40af('0x7')];this[_0x40af('0x8')]={};ami['on'](_0x40af('0x9'),this[_0x40af('0xa')][_0x40af('0xb')](this));ami['on']('hanguprequest',this[_0x40af('0xc')]['bind'](this));ami['on'](_0x40af('0xd'),this['syncHangup']['bind'](this));ami['on'](_0x40af('0xe'),this['syncAgentRingNoAnswer'][_0x40af('0xb')](this));ami['on'](_0x40af('0xf'),this[_0x40af('0x10')]['bind'](this));ami['on']('blindtransfer',this[_0x40af('0x11')]['bind'](this));ami['on'](_0x40af('0x12'),this[_0x40af('0x13')][_0x40af('0xb')](this));}function getDiff(_0x20eb0c){var _0x2b7ee3=moment()[_0x40af('0x14')](0x0);var _0x2476e4=moment(_0x20eb0c)[_0x40af('0x14')](0x0);return _0x2b7ee3[_0x40af('0x15')](_0x2476e4,_0x40af('0x16'));}Acw[_0x40af('0x17')][_0x40af('0x18')]=function(_0x735c8f){try{var _0x10e15c=this;var _0x41dd31=this[_0x40af('0x8')][_0x735c8f]['interface'];var _0x3af6bb=this[_0x40af('0x8')][_0x735c8f][_0x40af('0x19')];var _0x32ac1b=this['voiceQueues'][_0x3af6bb];var _0x3b22e0=![];var _0x50e061=_0x40af('0x1a');if(_0x32ac1b[_0x40af('0x1b')]){if(_0x32ac1b[_0x40af('0x1c')][_0x40af('0x1d')]){_0x3b22e0=!![];_0x50e061=_0x32ac1b[_0x40af('0x1c')][_0x40af('0x1d')];}}return ami[_0x40af('0x1e')]({'action':'QueuePause','interface':_0x41dd31,'paused':!![],'reason':_0x50e061})[_0x40af('0x1f')](function(){if(_0x10e15c[_0x40af('0x6')][_0x41dd31]){return RpcUser['getAgent'](_0x10e15c['agents'][_0x41dd31]['id'])[_0x40af('0x1f')](function(_0x35fa2b){if(_0x35fa2b&&!_0x35fa2b[_0x40af('0x20')]){logger[_0x40af('0x21')](_0x40af('0x22'),_0x735c8f,_0x41dd31,_0x3af6bb);var _0x2b4e53=_0x10e15c[_0x40af('0x8')][_0x735c8f]['attended']&&_0x10e15c['channels'][_0x735c8f]['destlinkedid']?_0x10e15c[_0x40af('0x8')][_0x735c8f][_0x40af('0x23')]:_0x735c8f;return RpcUser['savePause'](_0x10e15c[_0x40af('0x6')][_0x41dd31],_0x50e061,_0x2b4e53)[_0x40af('0x1f')](function(){if(!_0x3b22e0){_0x10e15c[_0x40af('0x7')][_0x41dd31]={};logger[_0x40af('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x735c8f,_0x10e15c[_0x40af('0x5')][_0x3af6bb][_0x40af('0x24')],_0x41dd31,_0x3af6bb);_0x10e15c[_0x40af('0x7')][_0x41dd31][_0x40af('0x25')]=setTimeout(_0x10e15c[_0x40af('0x26')][_0x40af('0xb')](_0x10e15c,_0x41dd31),_0x10e15c['voiceQueues'][_0x3af6bb][_0x40af('0x24')]*0x3e8);_0x10e15c[_0x40af('0x7')][_0x41dd31]['lastPauseAt']=moment()[_0x40af('0x27')](_0x40af('0x28'));_0x10e15c['timers'][_0x41dd31][_0x40af('0x29')]=_0x735c8f;_0x10e15c[_0x40af('0x7')][_0x41dd31][_0x40af('0x19')]=_0x3af6bb;_0x10e15c[_0x40af('0x7')][_0x41dd31][_0x40af('0x2a')]=function(){var _0x16922a=getDiff(_0x10e15c['timers'][_0x41dd31]['lastPauseAt']);clearTimeout(_0x10e15c[_0x40af('0x7')][_0x41dd31][_0x40af('0x25')]);_0x10e15c[_0x40af('0x7')][_0x41dd31][_0x40af('0x25')]=![];RpcVoiceAgentReport[_0x40af('0x2b')]({'acwtime':_0x16922a},_0x10e15c['timers'][_0x41dd31][_0x40af('0x29')],_0x41dd31)[_0x40af('0x1f')](function(_0xb83ca9){logger['info'](_0x40af('0x2c'),_0x735c8f,_0x16922a,_0xb83ca9);})[_0x40af('0x2d')](function(_0x226491){logger[_0x40af('0x2e')](_0x40af('0x2f'),_0x735c8f,_0x226491);});delete _0x10e15c[_0x40af('0x7')][_0x41dd31];};}});}else{logger[_0x40af('0x21')](_0x40af('0x30'),_0x735c8f,_0x41dd31,_0x3af6bb);}});}})[_0x40af('0x2d')](function(){logger[_0x40af('0x2e')](_0x40af('0x31'),_0x735c8f,_0x10e15c[_0x40af('0x5')][_0x3af6bb][_0x40af('0x24')],_0x41dd31,_0x3af6bb);})[_0x40af('0x32')](function(){delete _0x10e15c[_0x40af('0x8')][_0x735c8f];});}catch(_0x2d7468){logger[_0x40af('0x2e')](_0x40af('0x33'),_0x2d7468[_0x40af('0x34')]);}};Acw[_0x40af('0x17')][_0x40af('0x26')]=function(_0x350631){try{var _0x1b084e=this;if(_0x1b084e['timers'][_0x350631]){_0x1b084e[_0x40af('0x7')][_0x350631][_0x40af('0x25')]=![];var _0x5c1a01=_0x1b084e[_0x40af('0x7')][_0x350631][_0x40af('0x29')];var _0x19725e=_0x1b084e['timers'][_0x350631][_0x40af('0x19')];var _0x48f7c9=_0x1b084e[_0x40af('0x5')][_0x19725e][_0x40af('0x24')];logger[_0x40af('0x21')]('[%s][TIMER][STOP][AGENT:%s]',_0x5c1a01,_0x350631);RpcUser[_0x40af('0x35')](this[_0x40af('0x6')][_0x350631]);RpcVoiceAgentReport['update']({'acwtime':_0x48f7c9,'agentacw':!![]},_0x5c1a01,_0x350631)['then'](function(_0x429b1e){logger[_0x40af('0x21')](_0x40af('0x2c'),_0x5c1a01,_0x48f7c9,_0x429b1e);})[_0x40af('0x2d')](function(_0x8cfa44){logger[_0x40af('0x2e')](_0x40af('0x2f'),_0x5c1a01,_0x8cfa44);});}else{logger['error'](_0x40af('0x36'),_0x350631);if(_0x1b084e['timers']){logger[_0x40af('0x21')](_0x40af('0x37'),JSON[_0x40af('0x38')](_0x1b084e[_0x40af('0x7')]));}}}catch(_0xe50bc7){logger['error'](_0x40af('0x39'),_0xe50bc7[_0x40af('0x34')]);}};Acw['prototype'][_0x40af('0xa')]=function(_0x27e53b){try{if(this[_0x40af('0x5')][_0x27e53b[_0x40af('0x19')]]&&(this['voiceQueues'][_0x27e53b['queue']][_0x40af('0x2')]||this[_0x40af('0x5')][_0x27e53b[_0x40af('0x19')]][_0x40af('0x1b')])){if(this[_0x40af('0x6')][_0x27e53b[_0x40af('0x3a')]]){this['channels'][_0x27e53b['uniqueid']]={'queue':_0x27e53b[_0x40af('0x19')],'interface':_0x27e53b[_0x40af('0x3a')],'destlinkedid':_0x27e53b[_0x40af('0x23')]};}}}catch(_0x579b34){logger['error'](_0x40af('0x3b'),_0x579b34[_0x40af('0x34')]);}};Acw[_0x40af('0x17')][_0x40af('0x13')]=function(_0x4c5bd9){try{if(this['voiceQueues'][_0x4c5bd9['queue']]&&(this[_0x40af('0x5')][_0x4c5bd9['queue']]['acw']||this[_0x40af('0x5')][_0x4c5bd9[_0x40af('0x19')]]['mandatoryDisposition'])){if(this[_0x40af('0x6')][_0x4c5bd9[_0x40af('0x3a')]]){this[_0x40af('0x8')][_0x4c5bd9['uniqueid']]={'queue':_0x4c5bd9[_0x40af('0x19')],'interface':_0x4c5bd9[_0x40af('0x3a')]};}}}catch(_0x294711){logger[_0x40af('0x2e')](_0x40af('0x3c'),_0x294711['message']);}};Acw[_0x40af('0x17')][_0x40af('0xc')]=function(_0x15496d){try{if(this['channels'][_0x15496d['uniqueid']]&&_[_0x40af('0x3d')](this[_0x40af('0x8')][_0x15496d[_0x40af('0x29')]][_0x40af('0x3e')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x15496d[_0x40af('0x29')]);this[_0x40af('0x18')](_0x15496d[_0x40af('0x29')]);}else if(this[_0x40af('0x8')][_0x15496d[_0x40af('0x3f')]]&&_[_0x40af('0x3d')](this['channels'][_0x15496d[_0x40af('0x3f')]][_0x40af('0x3e')])){logger[_0x40af('0x21')]('[%s][HANGUP:LINKEDID]',_0x15496d[_0x40af('0x3f')]);this['startAcw'](_0x15496d[_0x40af('0x3f')]);}}catch(_0x1a9bf6){logger[_0x40af('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x1a9bf6[_0x40af('0x34')]);}};Acw['prototype']['syncHangup']=function(_0x1995d8){try{if(this[_0x40af('0x8')][_0x1995d8['uniqueid']]&&this[_0x40af('0x8')][_0x1995d8[_0x40af('0x29')]][_0x40af('0x3e')]){logger[_0x40af('0x21')](_0x40af('0x40'),_0x1995d8[_0x40af('0x29')]);this[_0x40af('0x18')](_0x1995d8[_0x40af('0x29')]);}else if(this[_0x40af('0x8')][_0x1995d8[_0x40af('0x3f')]]&&this[_0x40af('0x8')][_0x1995d8[_0x40af('0x3f')]][_0x40af('0x3e')]){logger[_0x40af('0x21')](_0x40af('0x41'),_0x1995d8[_0x40af('0x3f')]);this[_0x40af('0x18')](_0x1995d8['linkedid']);}}catch(_0x654cee){logger[_0x40af('0x2e')](_0x40af('0x42'),_0x654cee['message']);}};Acw['prototype'][_0x40af('0x10')]=function(_0x9bcd0b){try{if(!_['isNil'](this['channels'][_0x9bcd0b['transfereeuniqueid']])){this[_0x40af('0x18')](_0x9bcd0b[_0x40af('0x43')]);if(this['channels'][_0x9bcd0b[_0x40af('0x44')]]){this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x44')]]['attended']=!![];this['channels'][_0x9bcd0b[_0x40af('0x45')]]=this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x44')]];delete this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x44')]];}}else if(!_[_0x40af('0x46')](this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x45')]])){this[_0x40af('0x18')](_0x9bcd0b['transfertargetuniqueid']);if(this[_0x40af('0x8')][_0x9bcd0b['origtransfereruniqueid']]){this[_0x40af('0x8')][_0x9bcd0b['origtransfereruniqueid']][_0x40af('0x3e')]=!![];this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x43')]]=this[_0x40af('0x8')][_0x9bcd0b['origtransfereruniqueid']];delete this[_0x40af('0x8')][_0x9bcd0b[_0x40af('0x47')]];}}}catch(_0x16eb62){logger[_0x40af('0x2e')]('[ACW][syncAttendedTransfer]\x20%s',_0x16eb62[_0x40af('0x34')]);}};Acw[_0x40af('0x17')][_0x40af('0x11')]=function(_0x9bf2de){try{if(this[_0x40af('0x8')][_0x9bf2de[_0x40af('0x48')]]){logger[_0x40af('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x40af('0x38')](_0x9bf2de[_0x40af('0x48')]));this['startAcw'](_0x9bf2de[_0x40af('0x48')]);}else if(this['channels'][_0x9bf2de['transfererlinkedid']]){logger[_0x40af('0x21')](_0x40af('0x49'),JSON[_0x40af('0x38')](_0x9bf2de[_0x40af('0x4a')]));this['startAcw'](_0x9bf2de['transfererlinkedid']);}}catch(_0x3d4e47){logger[_0x40af('0x2e')]('[ACW][syncBlindTransfer]\x20%s',_0x3d4e47['message']);}};Acw[_0x40af('0x17')]['syncAgentRingNoAnswer']=function(_0x4de616){try{if(this['voiceQueues'][_0x4de616['queue']]&&this[_0x40af('0x5')][_0x4de616[_0x40af('0x19')]]['autopause']===_0x40af('0x4b')){if(this['agents'][_0x4de616[_0x40af('0x3a')]]){logger[_0x40af('0x21')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4de616[_0x40af('0x29')],_0x4de616[_0x40af('0x3a')],_0x4de616['queue']);return RpcUser[_0x40af('0x4c')](this['agents'][_0x4de616[_0x40af('0x3a')]],_0x40af('0x4d'),_0x4de616[_0x40af('0x29')]);}}}catch(_0x3ff047){logger[_0x40af('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3ff047[_0x40af('0x34')]);}};module[_0x40af('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 779d038..9e3df97 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 _0xc756=['catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x26ac72,_0x482803){var _0x25fc90=function(_0x5f063c){while(--_0x5f063c){_0x26ac72['push'](_0x26ac72['shift']());}};_0x25fc90(++_0x482803);}(_0xc756,0x147));var _0x6c75=function(_0x3cc3ed,_0x1d9a7e){_0x3cc3ed=_0x3cc3ed-0x0;var _0x2e36e1=_0xc756[_0x3cc3ed];return _0x2e36e1;};'use strict';var Manager=require(_0x6c75('0x0'));var BPromise=require(_0x6c75('0x1'));var util=require(_0x6c75('0x2'));var logger=require('../../config/logger')('ami');var config=require(_0x6c75('0x3'));var ami=new Manager(config[_0x6c75('0x4')][_0x6c75('0x5')],config['asterisk']['ip'],config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['password'],!![]);ami[_0x6c75('0x7')]();ami[_0x6c75('0x8')]=BPromise[_0x6c75('0x9')](ami['action']);function error(_0x1b3f24){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')],util[_0x6c75('0xa')](_0x1b3f24,![],null)));}function close(){logger[_0x6c75('0xb')](util[_0x6c75('0xc')](_0x6c75('0xd'),config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')]));}ami[_0x6c75('0xe')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':'sipshowregistry'});};};ami[_0x6c75('0xf')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':_0x6c75('0x10')});};};ami[_0x6c75('0x11')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':'sippeerstatus'});};};ami[_0x6c75('0x12')]=function(){return function(){return ami[_0x6c75('0x8')]({'action':_0x6c75('0x13')});};};ami[_0x6c75('0x14')]=function(){return function(){return ami['Action']({'action':_0x6c75('0x15')});};};function connect(){logger['info'](util['format'](_0x6c75('0x16'),config[_0x6c75('0x4')][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')]));ami[_0x6c75('0x17')](_0x6c75('0xb'),error);ami['once'](_0x6c75('0x18'),close);}ami['on'](_0x6c75('0x19'),connect);ami['on'](_0x6c75('0x1a'),function(_0x5d31c5){logger['info'](util['format'](_0x6c75('0x1b'),config['asterisk'][_0x6c75('0x6')],config[_0x6c75('0x4')]['ip'],config[_0x6c75('0x4')][_0x6c75('0x5')],util[_0x6c75('0xa')](_0x5d31c5,![],null)));});ami['on'](_0x6c75('0x1c'),function(){logger[_0x6c75('0x1d')](util['format'](_0x6c75('0x1e'),config[_0x6c75('0x4')][_0x6c75('0x6')],config['asterisk']['ip'],config[_0x6c75('0x4')]['port']));return Promise[_0x6c75('0x1f')]()[_0x6c75('0x20')](ami[_0x6c75('0xe')]())[_0x6c75('0x20')](ami[_0x6c75('0xf')]())[_0x6c75('0x20')](ami[_0x6c75('0x11')]())[_0x6c75('0x20')](ami['actionQueueSummary']())[_0x6c75('0x20')](ami[_0x6c75('0x14')]())[_0x6c75('0x21')](function(_0x168b61){logger['error'](_0x6c75('0x22'),util[_0x6c75('0xa')](_0x168b61,{'showHidden':![],'depth':null}));});});ami['once'](_0x6c75('0xb'),error);ami['once'](_0x6c75('0x18'),close);module[_0x6c75('0x23')]=ami; \ No newline at end of file +var _0xeb91=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','exports','../../config/logger','ami','../../config/environment','asterisk','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','once','close','shutdown','info','fullybooted'];(function(_0x532862,_0x450d41){var _0x2668e1=function(_0x9f8e29){while(--_0x9f8e29){_0x532862['push'](_0x532862['shift']());}};_0x2668e1(++_0x450d41);}(_0xeb91,0xfd));var _0x1eb9=function(_0x13ae3b,_0x4ddd7c){_0x13ae3b=_0x13ae3b-0x0;var _0x145764=_0xeb91[_0x13ae3b];return _0x145764;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require('util');var logger=require(_0x1eb9('0x0'))(_0x1eb9('0x1'));var config=require(_0x1eb9('0x2'));var ami=new Manager(config[_0x1eb9('0x3')]['port'],config['asterisk']['ip'],config['asterisk']['username'],config[_0x1eb9('0x3')][_0x1eb9('0x4')],!![]);ami[_0x1eb9('0x5')]();ami[_0x1eb9('0x6')]=BPromise[_0x1eb9('0x7')](ami['action']);function error(_0x5f29f7){logger[_0x1eb9('0x8')](util[_0x1eb9('0x9')](_0x1eb9('0xa'),config['asterisk'][_0x1eb9('0xb')],config[_0x1eb9('0x3')]['ip'],config[_0x1eb9('0x3')][_0x1eb9('0xc')],util[_0x1eb9('0xd')](_0x5f29f7,![],null)));}function close(){logger[_0x1eb9('0x8')](util[_0x1eb9('0x9')](_0x1eb9('0xe'),config[_0x1eb9('0x3')]['username'],config[_0x1eb9('0x3')]['ip'],config['asterisk'][_0x1eb9('0xc')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x1eb9('0x6')]({'action':_0x1eb9('0xf')});};};ami[_0x1eb9('0x10')]=function(){return function(){return ami[_0x1eb9('0x6')]({'action':_0x1eb9('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x1eb9('0x6')]({'action':_0x1eb9('0x12')});};};ami[_0x1eb9('0x13')]=function(){return function(){return ami[_0x1eb9('0x6')]({'action':'queuesummary'});};};ami[_0x1eb9('0x14')]=function(){return function(){return ami[_0x1eb9('0x6')]({'action':_0x1eb9('0x15')});};};function connect(){logger['info'](util[_0x1eb9('0x9')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x1eb9('0xb')],config['asterisk']['ip'],config['asterisk'][_0x1eb9('0xc')]));ami[_0x1eb9('0x16')](_0x1eb9('0x8'),error);ami['once'](_0x1eb9('0x17'),close);}ami['on']('connect',connect);ami['on'](_0x1eb9('0x18'),function(_0x1e4499){logger[_0x1eb9('0x19')](util[_0x1eb9('0x9')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x1eb9('0x3')][_0x1eb9('0xb')],config[_0x1eb9('0x3')]['ip'],config[_0x1eb9('0x3')][_0x1eb9('0xc')],util[_0x1eb9('0xd')](_0x1e4499,![],null)));});ami['on'](_0x1eb9('0x1a'),function(){logger[_0x1eb9('0x19')](util[_0x1eb9('0x9')](_0x1eb9('0x1b'),config['asterisk'][_0x1eb9('0xb')],config[_0x1eb9('0x3')]['ip'],config[_0x1eb9('0x3')][_0x1eb9('0xc')]));return Promise[_0x1eb9('0x1c')]()['then'](ami[_0x1eb9('0x1d')]())['then'](ami['actionDeviceStateList']())[_0x1eb9('0x1e')](ami[_0x1eb9('0x1f')]())['then'](ami[_0x1eb9('0x13')]())[_0x1eb9('0x1e')](ami[_0x1eb9('0x14')]())[_0x1eb9('0x20')](function(_0x214d40){logger[_0x1eb9('0x8')](_0x1eb9('0x21'),util[_0x1eb9('0xd')](_0x214d40,{'showHidden':![],'depth':null}));});});ami[_0x1eb9('0x16')](_0x1eb9('0x8'),error);ami[_0x1eb9('0x16')](_0x1eb9('0x17'),close);module[_0x1eb9('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 92d4ff1..6ef8d1c 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(_0x22e2b1,_0x26ff20){var _0x23f9ef=function(_0x4f6528){while(--_0x4f6528){_0x22e2b1['push'](_0x22e2b1['shift']());}};_0x23f9ef(++_0x26ff20);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x47f7f5,_0xa5caf){_0x47f7f5=_0x47f7f5-0x0;var _0x52fe6b=_0xbdb7[_0x47f7f5];return _0x52fe6b;};'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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x441912,_0x46e1f2){var _0x4923e2=function(_0x1c6711){while(--_0x1c6711){_0x441912['push'](_0x441912['shift']());}};_0x4923e2(++_0x46e1f2);}(_0xf4eb,0xec));var _0xbf4e=function(_0x55ded6,_0x47e363){_0x55ded6=_0x55ded6-0x0;var _0x335e3b=_0xf4eb[_0x55ded6];return _0x335e3b;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 502c488..15cbee2 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 _0xd8c0=['uniqueid','ivr','updateOriginated','answertime','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','additional','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','ListId','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','locked','stateinterface','idHopper','paused','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','CampaignId','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','stateGlobal','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','dialQueueProject','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','undefined','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','UserId','[syncQueueCallerAbandon]\x20[Drop]','user:%s','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','getCaller','dialAMDInitialSilence','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate','originate\x20action\x20Error','checkRetriveMax','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','talking','predictiveIntervalAnsweredCalls','dropRate','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','predictiveIntervalHitRate','[CatchErlangB]','agentBusyFactor','loggedIn','milliseconds','fail\x20to\x20scheduled\x20calls','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkIsBlackListIvr','checkContactBlack','loggerHandler','getContactDialer','countReScheduled','RUNNING','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginate]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','erlangb','----\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]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','uuid','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\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','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','debug','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue'];(function(_0x192e6b,_0x7cef59){var _0x7bec68=function(_0x4060f3){while(--_0x4060f3){_0x192e6b['push'](_0x192e6b['shift']());}};_0x7bec68(++_0x7cef59);}(_0xd8c0,0x162));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0d8c('0x0'));var _=require(_0x0d8c('0x1'));var uuid=require(_0x0d8c('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x0d8c('0x3'));var ut=require(_0x0d8c('0x4'));var config=require('../../../config/environment/');var logger=require(_0x0d8c('0x5'))(_0x0d8c('0x6'));var loggerBooked=require('../../../config/logger')(_0x0d8c('0x7'));var loggerPredictive=require(_0x0d8c('0x5'))('predictive');var loggerPredictiveCalls=require(_0x0d8c('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x0d8c('0x5'))('syncQueueSummary');var ami=require(_0x0d8c('0x8'));config[_0x0d8c('0x9')]=_[_0x0d8c('0xa')](config[_0x0d8c('0x9')],{'host':_0x0d8c('0xb'),'port':0x18eb});var io=require(_0x0d8c('0xc'))(new Redis(config[_0x0d8c('0x9')]));var cmHopper=require(_0x0d8c('0xd'));var voiceQueueRt=require(_0x0d8c('0xe'));var RpcSetting=require(_0x0d8c('0xf'));var Interval=require(_0x0d8c('0x10'));var Action=require(_0x0d8c('0x11'));var History=require(_0x0d8c('0x12'));var Final=require(_0x0d8c('0x13'));var AgentComplete=require(_0x0d8c('0x14'));var QueueCallerAbandon=require(_0x0d8c('0x15'));var Hangup=require(_0x0d8c('0x16'));var ipAgi=process[_0x0d8c('0x17')]['XCALLY_IP_AGI']||_0x0d8c('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0d8c('0x19')]['enqueue']=function(_0x4bd75d){this[_0x0d8c('0x1a')]=this[_0x0d8c('0x1a')]?this[_0x0d8c('0x1a')][_0x0d8c('0x1b')](_0x4bd75d):_0x4bd75d();};function Dialer(_0x155726,_0x388662){this['sequence']=new Sequence();this[_0x0d8c('0x1c')]=_0x388662;this[_0x0d8c('0x1d')]=_0x155726[_0x0d8c('0x1d')];this[_0x0d8c('0x1e')]=_0x155726[_0x0d8c('0x1e')];this[_0x0d8c('0x1f')]=_0x155726[_0x0d8c('0x1f')];this[_0x0d8c('0x20')]=_0x155726[_0x0d8c('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x0d8c('0x21')]={};this[_0x0d8c('0x22')]={};this[_0x0d8c('0x23')]={};this['optionPredictive']={};this[_0x0d8c('0x24')]={};this[_0x0d8c('0x25')]={};this[_0x0d8c('0x26')]={};this[_0x0d8c('0x27')]={};this[_0x0d8c('0x28')]={};this[_0x0d8c('0x29')]={};ami['on'](_0x0d8c('0x2a'),this[_0x0d8c('0x2b')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x2d'),this[_0x0d8c('0x2e')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x2f'),this[_0x0d8c('0x30')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x31'),this[_0x0d8c('0x32')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x33'),this[_0x0d8c('0x34')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x35'),this[_0x0d8c('0x36')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x37'),this[_0x0d8c('0x38')][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x39'),this['syncNewExten'][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x3a'),this['syncVarSet'][_0x0d8c('0x2c')](this));ami['on'](_0x0d8c('0x3b'),this[_0x0d8c('0x3c')][_0x0d8c('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x0d8c('0x3d')][_0x0d8c('0x2c')](this));this[_0x0d8c('0x3e')]();this['loopClearZombieChannels']();RpcSetting[_0x0d8c('0x3f')]()[_0x0d8c('0x40')](function(_0x14be3f){previewRecallmeReminderInterval=_0x14be3f[_0x0d8c('0x41')];});}function isNotNull(_0x88e213){return _0x88e213!==null&&!_[_0x0d8c('0x42')](_0x88e213);}function msgResponse(_0x1757a7,_0x3256bf,_0x3be9d4){return{'action':_0x1757a7,'response':_0x3256bf,'message':_0x3be9d4,'stack':_0x3be9d4};}function emit(_0x19ae43,_0x3cd4c6,_0x129692){io['to'](_0x19ae43)[_0x0d8c('0x43')](_0x3cd4c6,_0x129692);}function emitOutboundVoiceQueueSummary(_0x121b46){if(_0x121b46[_0x0d8c('0x44')]===_0x0d8c('0x45')){logger['debug'](_0x0d8c('0x46'),util[_0x0d8c('0x47')](_0x121b46,{'showHidden':![],'depth':null}));emit(util[_0x0d8c('0x48')]('voice:queue:%s',_0x121b46[_0x0d8c('0x49')]),_0x0d8c('0x4a'),_0x121b46);}}function checkGetDataPredictive(_0x39e2f9){if(isNotNull(_0x39e2f9)&&!_[_0x0d8c('0x4b')](_0x39e2f9)){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x4d'));loggerPredictive[_0x0d8c('0x4c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39e2f9[_0x0d8c('0x4e')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x4f'),_0x39e2f9['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x50'),_0x39e2f9[_0x0d8c('0x51')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x52'),_0x39e2f9[_0x0d8c('0x53')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x54'),_0x39e2f9[_0x0d8c('0x55')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x56'),_0x39e2f9[_0x0d8c('0x57')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));if(_0x39e2f9[_0x0d8c('0x4e')]>0x0){if(!_[_0x0d8c('0x42')](_0x39e2f9[_0x0d8c('0x57')])&&_0x39e2f9['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0d8c('0x4c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0d8c('0x42')](_0x39e2f9['predictiveIntervalAvgHoldtime'])&&_0x39e2f9['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x59'));}else{loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5a'));}}else{loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5b'));}return![];}function mergeDataErlangB(_0x3e3647){return function(_0xde1d81){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xde1d81[_0x0d8c('0x5d')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x5e'),_0xde1d81[_0x0d8c('0x5f')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x60'),_0xde1d81['erlangAbandonmentRate']);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x61'),_0xde1d81[_0x0d8c('0x62')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x60'),_0xde1d81[_0x0d8c('0x63')]);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));_[_0x0d8c('0x64')](_0x3e3647,_0xde1d81);};}function ifInterval(_0x1fa7a0,_0xf78850){if(_['isUndefined'](_0xf78850)){return![];}return utils['getSeconds'](undefined,_0xf78850)<_0x1fa7a0*0x3c;}function clearPredictiveAttributes(_0x2b04ff){if(_0x2b04ff[_0x0d8c('0x25')]){_0x2b04ff[_0x0d8c('0x25')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff['name'],'startProgressive\x20value\x20cleared');}if(_0x2b04ff[_0x0d8c('0x24')]){_0x2b04ff[_0x0d8c('0x24')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff[_0x0d8c('0x49')],_0x0d8c('0x66'));}if(_0x2b04ff['handlePredictive']){clearInterval(_0x2b04ff[_0x0d8c('0x67')]);_0x2b04ff[_0x0d8c('0x67')]=undefined;loggerPredictive[_0x0d8c('0x65')](_0x2b04ff[_0x0d8c('0x49')],_0x0d8c('0x68'));}}function loggerCatchPredictive(_0x11e8e8,_0x4a0fee){return function(_0x58e241){loggerPredictive[_0x0d8c('0x69')](_0x4a0fee[_0x0d8c('0x49')],_0x11e8e8);loggerPredictive[_0x0d8c('0x69')](_0x58e241[_0x0d8c('0x6a')]);clearPredictiveAttributes(_0x4a0fee);};}function loggerCatch(_0x4b8939){return function(_0x2b8b31){logger[_0x0d8c('0x69')](_0x4b8939,util['inspect'](_0x2b8b31,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3934c7,_0x28affa,_0x5aacf8){return function(_0x3806da){utils[_0x0d8c('0x6b')](_0x28affa,_0x5aacf8,0x0);logger[_0x0d8c('0x69')](_0x3934c7,util[_0x0d8c('0x47')](_0x3806da,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4e13a9){return function(_0x7a174a){if(isNotNull(_0x7a174a)&&isNotNull(_0x7a174a[0x0])){if(_0x7a174a[0x0][_0x0d8c('0x6c')]>0x0){_0x4e13a9[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x6f')];logger[_0x0d8c('0x4c')]('[getContactDialer2][ReScheduled]'+_0x4e13a9[_0x0d8c('0x49')],_0x7a174a[0x0][_0x0d8c('0x6c')],_0x0d8c('0x70'));}else{_0x4e13a9['message']=utils[_0x0d8c('0x6e')][_0x0d8c('0x71')];logger[_0x0d8c('0x4c')](_0x0d8c('0x72')+_0x4e13a9['name']);}}};}function createObjHistory(_0x3bfe8f,_0x597134,_0x2e9e96,_0x20412f,_0x57a003){_0x3bfe8f[_0x0d8c('0x6d')]=_0x2e9e96;var _0x375c20=new Action(_0x3bfe8f,_0x597134);var _0x25bee8=new History(_0x375c20);_0x25bee8[_0x0d8c('0x73')]=_0x20412f;_0x25bee8[_0x0d8c('0x74')]=_0x57a003;_0x25bee8[_0x0d8c('0x75')]=_0x375c20[_0x0d8c('0x76')];return _0x25bee8;}function unlockQueueStatus(_0xb17ad9,_0x39c539){setTimeout(function(){if(_[_0x0d8c('0x42')](_0xb17ad9[_0x0d8c('0x77')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x39c539);}_0xb17ad9['queueStatusComplete']=!![];loggerBooked[_0x0d8c('0x4c')](_0x0d8c('0x78'),_0x39c539,JSON[_0x0d8c('0x79')](_[_0x0d8c('0x7a')](_0xb17ad9,[_0x0d8c('0x49'),_0x0d8c('0x77')])));},0x1f3);}function checkInterval(_0x3a3cb5){return function(){if(!isNotNull(_0x3a3cb5[_0x0d8c('0x7b')])){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];throw _0x3a3cb5[_0x0d8c('0x49')]+_0x0d8c('0x7d');}if(!isNotNull(_0x3a3cb5[_0x0d8c('0x7b')][_0x0d8c('0x7e')])){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['NULL_INTERVAL'];throw _0x3a3cb5['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0d8c('0x4b')](_0x3a3cb5[_0x0d8c('0x7b')][_0x0d8c('0x7e')]))){_0x3a3cb5[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];throw _0x3a3cb5[_0x0d8c('0x49')]+_0x0d8c('0x7d');}};}function checkIsIVRCampaignActive(_0x17e044){return function(){if(!utils[_0x0d8c('0x7f')](_0x17e044)){_0x17e044[_0x0d8c('0x6d')]=utils['CAMPAIGN_STATUS'][_0x0d8c('0x80')];throw _0x17e044['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x45d57a){if(utils[_0x0d8c('0x81')](_0x45d57a)){emit(util[_0x0d8c('0x48')](_0x0d8c('0x82'),_0x45d57a[_0x0d8c('0x49')]),'campaign:save',_0x45d57a);}}function loggerCatchQueueSummary(_0x3a842f,_0x1a7002){return function(_0x4f2e14){clearPredictiveAttributes(_0x1a7002);emitCampaignSummary(_0x1a7002);loggerSyncQueueSummary['debug'](_0x3a842f,util[_0x0d8c('0x47')](_0x4f2e14,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2035f6){if(_0x2035f6['sendMessageOneNotActive']){if(_0x2035f6['originated']===0x0){_0x2035f6[_0x0d8c('0x83')]=![];_0x2035f6['message']=utils['CAMPAIGN_STATUS'][_0x0d8c('0x80')];loggerSyncQueueSummary[_0x0d8c('0x65')](_0x0d8c('0x84'),_0x2035f6['name'],_0x0d8c('0x85'));}else{_0x2035f6[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['DISACTIVED'];loggerSyncQueueSummary[_0x0d8c('0x65')](_0x0d8c('0x84'),_0x2035f6[_0x0d8c('0x49')],_0x0d8c('0x86'));}emitCampaignSummary(_0x2035f6);}}function myreject(_0x17b734){return function(_0x483802){return _0x17b734(msgResponse(_0x0d8c('0x87'),_0x0d8c('0x88'),JSON[_0x0d8c('0x79')](_0x483802)));};}Dialer[_0x0d8c('0x19')][_0x0d8c('0x89')]=function(_0x4d863d){return!_['isUndefined'](_0x4d863d)&&_0x4d863d&&!_[_0x0d8c('0x42')](_0x4d863d[_0x0d8c('0x49')])&&!_[_0x0d8c('0x42')](_0x4d863d[_0x0d8c('0x8a')])&&_0x4d863d[_0x0d8c('0x8a')]&&(this[_0x0d8c('0x20')][util[_0x0d8c('0x48')](_0x0d8c('0x8b'),_0x4d863d[_0x0d8c('0x49')])][_0x0d8c('0x8c')]==='reachable'||this[_0x0d8c('0x20')][util[_0x0d8c('0x48')]('SIP/%s',_0x4d863d[_0x0d8c('0x49')])][_0x0d8c('0x8c')]===_0x0d8c('0x8d'));};Dialer[_0x0d8c('0x19')][_0x0d8c('0x8e')]=function(_0x1829e6){var _0x546a7b=this;return function(){if(!_0x546a7b[_0x0d8c('0x89')](_0x1829e6[_0x0d8c('0x8f')])){if(!_0x546a7b['isTrunkReachable'](_0x1829e6[_0x0d8c('0x90')])){_0x1829e6[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x91')];throw _0x1829e6[_0x0d8c('0x49')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x0d8c('0x19')]['checkIfTime']=function(_0x12ea54,_0x40c243,_0x563ed9,_0x1b2984){var _0xd133ca=this;return function(){var _0x528f6a=!![];return _0xd133ca['ifTimeIvr'](_0x12ea54,_0x40c243,_0x563ed9,_0x1b2984,_0x528f6a);};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x92')]=function(_0x191875,_0x231fb4,_0x5c0ae0,_0x19f2c0){var _0x1c5465=this;return function(){var _0x19d237=![];return _0x1c5465['ifTimeIvr'](_0x191875[_0x0d8c('0x7e')],_0x231fb4,_0x5c0ae0,_0x19f2c0,_0x19d237);};};Dialer['prototype'][_0x0d8c('0x93')]=function(_0x512c3e,_0x432adf,_0x32fc22,_0x1de4e8,_0x452153){var _0x9beb99=[];return new Promise(function(_0x3116a9,_0x36054f){if(!isNotNull(_0x512c3e)){_0x1de4e8[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')][_0x0d8c('0x7c')];return _0x36054f(msgResponse(_0x0d8c('0x94'),_0x0d8c('0x95'),_0x32fc22+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x0d8c('0x4b')](_0x512c3e)){_0x1de4e8[_0x0d8c('0x6d')]=utils['CAMPAIGN_STATUS'][_0x0d8c('0x96')];return _0x36054f(msgResponse(_0x0d8c('0x94'),'Failure',_0x32fc22+_0x0d8c('0x97')));}if(_0x432adf&&_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])){_0x1de4e8['message']=utils[_0x0d8c('0x6e')][_0x0d8c('0x99')];return _0x36054f(msgResponse('ifTime',_0x0d8c('0x95'),_0x32fc22+_0x0d8c('0x9a')+_0x432adf));}if(_[_0x0d8c('0x9b')](_0x512c3e)){for(var _0x538b20=0x0;_0x538b20<_0x512c3e[_0x0d8c('0x9c')];_0x538b20+=0x1){_0x9beb99[_0x0d8c('0x9d')](ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x9f'),'command':util[_0x0d8c('0x48')](_0x0d8c('0xa0'),_0x512c3e[_0x538b20][_0x0d8c('0xa1')],!_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])?_0x432adf:'')})[_0x0d8c('0x40')](function(_0x45d169){return _0x45d169[_0x0d8c('0xa2')][_0x0d8c('0xa3')](_0x0d8c('0xa4'))>=0x0;})[_0x0d8c('0xa5')](myreject(_0x36054f)));}}else{_0x9beb99[_0x0d8c('0x9d')](ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x9f'),'command':util['format']('iftime\x20%s,%s',_0x512c3e,!_[_0x0d8c('0x42')](config[_0x0d8c('0x98')][_0x432adf])?_0x432adf:'')})[_0x0d8c('0x40')](function(_0x39468a){return _0x39468a[_0x0d8c('0xa2')][_0x0d8c('0xa3')]('true')>=0x0;})['catch'](myreject(_0x36054f)));}Promise['all'](_0x9beb99)[_0x0d8c('0x40')](function(_0x3018d6){var _0x2b7053=_[_0x0d8c('0xa6')](_0x3018d6);if(_0x2b7053){return _0x3116a9(_0x2b7053);}else{_0x1de4e8[_0x0d8c('0x6d')]=_0x452153?utils[_0x0d8c('0x6e')][_0x0d8c('0xa7')]:utils[_0x0d8c('0x6e')][_0x0d8c('0xa8')];return _0x36054f(msgResponse('[ifTime][promiseAll]',_0x0d8c('0x95'),'Global:\x20'+_0x452153+'\x20'+_0x32fc22+_0x0d8c('0xa9')+util[_0x0d8c('0x47')](_0x512c3e,{'showHidden':![],'depth':null})+_0x0d8c('0xaa')+_0x432adf));}})[_0x0d8c('0xa5')](function(_0xc7e51){return _0x36054f(msgResponse('ifTime',_0x0d8c('0x95'),JSON[_0x0d8c('0x79')](_0xc7e51)));});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x3e')]=function(){var _0x317356=this;return cmHopper[_0x0d8c('0xab')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x317356['syncCampaigns']();},0x3e8);});};Dialer[_0x0d8c('0x19')][_0x0d8c('0xac')]=function(){var _0x78bb25=this;var _0x1dbc03;for(var _0x48cd9b in this['campaigns']){if(typeof this['campaigns'][_0x48cd9b]!=='undefined'){_0x1dbc03=this['campaigns'][_0x48cd9b];if(utils[_0x0d8c('0x81')](_0x1dbc03)&&utils[_0x0d8c('0x7f')](_0x1dbc03)){_0x1dbc03[_0x0d8c('0x83')]=!![];Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](checkIsIVRCampaignActive(_0x1dbc03))[_0x0d8c('0x40')](checkInterval(_0x1dbc03))[_0x0d8c('0x40')](_0x78bb25[_0x0d8c('0x8e')](_0x1dbc03))[_0x0d8c('0x40')](_0x78bb25[_0x0d8c('0xae')](_0x1dbc03[_0x0d8c('0xaf')],_0x1dbc03[_0x0d8c('0xb0')],_0x1dbc03[_0x0d8c('0x49')],_0x1dbc03))['then'](_0x78bb25['checkIfTimeIntervals'](_0x1dbc03['Interval'],_0x1dbc03[_0x0d8c('0xb0')],_0x1dbc03['name'],_0x1dbc03))['then'](_0x78bb25[_0x0d8c('0xb1')](_0x1dbc03))[_0x0d8c('0xa5')](loggerCatchQueueSummary(_0x0d8c('0xb2'),_0x1dbc03));}else{notSendMessagesCampaign(_0x1dbc03);}}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0xb3')]=function(_0x1b9c68){if(_0x1b9c68[_0x0d8c('0xb4')]!==_0x0d8c('0xb5')){clearPredictiveAttributes(_0x1b9c68);}switch(_0x1b9c68[_0x0d8c('0xb4')]){case _0x0d8c('0xb6'):this[_0x0d8c('0xb7')](_0x1b9c68,0x1);break;case'power':this[_0x0d8c('0xb7')](_0x1b9c68,_0x1b9c68[_0x0d8c('0xb8')]);break;case'predictive':this[_0x0d8c('0xb5')](_0x1b9c68);break;case'booked':this['handlePower'](_0x1b9c68,0x1);break;default:logger[_0x0d8c('0x69')](_0x0d8c('0xb9'),_0x1b9c68[_0x0d8c('0x49')],_0x0d8c('0xba'));}};Dialer['prototype'][_0x0d8c('0x94')]=function(_0x2d663e,_0x4902fb){var _0x2a7854=_0x2d663e[_0x0d8c('0xb0')];var _0x1edf60=_0x4902fb?_0x2d663e['dialGlobalInterval']:_0x2d663e[_0x0d8c('0x7b')][_0x0d8c('0x7e')];logger[_0x0d8c('0xbb')](_0x0d8c('0xbc'),_0x1edf60,_0x2a7854,_0x2d663e['name'],util['format'](_0x0d8c('0xbd'),_0x2d663e['name'],_0x2d663e['id']));var _0x8aaeb8=null;return Interval['intervalIftime'](_0x1edf60,_0x2a7854)[_0x0d8c('0x40')](function(_0x3106b0){if(_0x3106b0===!![]){return _0x3106b0;}else{_0x2d663e[_0x0d8c('0x6d')]=_0x4902fb?utils[_0x0d8c('0x6e')][_0x0d8c('0xa7')]:utils['CAMPAIGN_STATUS'][_0x0d8c('0xa8')];_0x8aaeb8=msgResponse(_0x0d8c('0xbe'),_0x0d8c('0x95'),_0x0d8c('0xbf')+_0x4902fb+'\x20'+_0x2d663e[_0x0d8c('0x49')]+_0x0d8c('0xa9')+util[_0x0d8c('0x47')](_0x1edf60,{'showHidden':![],'depth':null})+_0x0d8c('0xaa')+_0x2a7854);}if(_0x8aaeb8!==null){logger[_0x0d8c('0xbb')](_0x0d8c('0xc0'),_0x8aaeb8);_0x8aaeb8[_0x0d8c('0xc1')]=_0x4902fb;throw _0x8aaeb8;}})[_0x0d8c('0xa5')](function(_0xab9140){logger['error']('AMI\x20IfTime',_0xab9140);throw msgResponse(_0x0d8c('0x87'),_0x0d8c('0x88'),util['inspect'](_0xab9140,{'showHidden':![],'depth':null}));});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x2b')]=function(_0x59ad75){if(this[_0x0d8c('0x1d')][_0x59ad75[_0x0d8c('0xc2')]]){if(this[_0x0d8c('0x23')][_0x59ad75[_0x0d8c('0xc3')]]&&this[_0x0d8c('0x23')][_0x59ad75[_0x0d8c('0xc3')]]['type']!==_0x0d8c('0xc4')){this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][_0x59ad75[_0x0d8c('0xc2')]]);this['uniqueId'][_0x59ad75[_0x0d8c('0xc3')]][_0x0d8c('0xc6')]=moment()[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x32')]=function(_0x3591f4){var _0x2e64e8=this[_0x0d8c('0x23')][_0x3591f4[_0x0d8c('0xc3')]];if(this[_0x0d8c('0x1d')][_0x3591f4[_0x0d8c('0xc2')]]){if(_0x2e64e8&&_0x2e64e8[_0x0d8c('0x44')]!==_0x0d8c('0xc4')){delete this['uniqueId'][_0x3591f4['uniqueid']];this['voiceQueues'][_0x3591f4[_0x0d8c('0xc2')]][_0x0d8c('0xc7')]+=0x1;var _0x16d423=new AgentComplete(_0x2e64e8,_0x3591f4);if(_0x3591f4[_0x0d8c('0xc8')]===_0x0d8c('0xc9')){_0x16d423[_0x0d8c('0xca')]=this[_0x0d8c('0x1d')][_0x3591f4['queue']][_0x0d8c('0xcb')]&&this[_0x0d8c('0x1d')][_0x3591f4[_0x0d8c('0xc2')]][_0x0d8c('0xcc')]?moment()['format'](_0x0d8c('0xcd')):undefined;}hopperUtils[_0x0d8c('0xce')](_0x16d423)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xcf')));hopperUtils[_0x0d8c('0xd0')](_0x16d423)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xd1')));}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x2e')]=function(_0x4ce3bb){var _0x1d2ec2=this[_0x0d8c('0x23')][_0x4ce3bb[_0x0d8c('0xc3')]];var _0x1ec30e=this;var _0x4b8ed8=![];var _0x32677c;var _0x368581;if(this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]]){if(_0x1d2ec2&&_0x1d2ec2[_0x0d8c('0x44')]!=='ivr'){delete this[_0x0d8c('0x23')][_0x4ce3bb[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]);_0x1d2ec2[_0x0d8c('0xd2')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));var _0x340513=new QueueCallerAbandon(_0x1d2ec2,_0x4ce3bb);if(utils['getSeconds'](_0x1d2ec2[_0x0d8c('0xd2')],_0x1d2ec2['responsetime'])>=_0x1d2ec2[_0x0d8c('0xd3')]){this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xd4')]+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xd5')]+=0x1;_0x340513[_0x0d8c('0x73')]=0xa;_0x340513[_0x0d8c('0x74')]='Drop';_0x340513[_0x0d8c('0xd6')]=_0x0d8c('0xd7');_0x340513[_0x0d8c('0xca')]=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xcb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x340513[_0x0d8c('0xd8')]+=0x1;_0x340513[_0x0d8c('0xd9')]+=0x1;_0x32677c=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]]['dialDropRetryFrequency'];_0x368581=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xdb')](_0x340513,_0x340513[_0x0d8c('0x73')],_0x1d2ec2[_0x0d8c('0xdc')])['then'](function(_0x2883bc){_0x4b8ed8=_0x2883bc['additional']==0x1;if(_0x340513[_0x0d8c('0xd8')]>=_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xdd')]){_0x1ec30e['queueCallerAbandonCreateState'](_0x340513,_0x2883bc[_0x0d8c('0xde')]);}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countdropretry':_0x340513[_0x0d8c('0xd8')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xe1')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d2ec2[_0x0d8c('0xe3')],'ListId':_0x1d2ec2['ListId'],'VoiceQueueId':_0x1d2ec2[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x1d2ec2['CampaignId']||undefined})['catch'](loggerCatch(_0x0d8c('0xe5')));var _0x16a2b5=new History(_0x340513);_0x16a2b5[_0x0d8c('0x73')]=0xa;_0x16a2b5[_0x0d8c('0x74')]=_0x0d8c('0xe6');_0x16a2b5[_0x0d8c('0x76')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));_0x16a2b5['endtime']=_0x16a2b5[_0x0d8c('0x76')];_0x16a2b5[_0x0d8c('0xe7')]=_0x340513['calleridname'];_0x16a2b5[_0x0d8c('0xe8')]=_0x340513['calleridnum'];hopperUtils[_0x0d8c('0xce')](_0x16a2b5)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xe9')));}})[_0x0d8c('0x40')](function(){if(_0x4b8ed8)hopperUtils[_0x0d8c('0xea')](_0x340513,_0x32677c,_0x368581)[_0x0d8c('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xeb')]+=0x1;_0x340513[_0x0d8c('0x73')]=0xb;_0x340513[_0x0d8c('0x74')]='Abandoned';_0x340513[_0x0d8c('0xd6')]=_0x0d8c('0xec');_0x340513['countabandonedretry']+=0x1;_0x340513[_0x0d8c('0xd9')]+=0x1;_0x32677c=this['voiceQueues'][_0x4ce3bb['queue']]['dialAbandonedRetryFrequency'];_0x368581=this[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xda')];hopperUtils['verifyAdditionalPhones'](_0x340513,_0x340513[_0x0d8c('0x73')],_0x1d2ec2[_0x0d8c('0xdc')])['then'](function(_0x24d98c){if(_0x340513[_0x0d8c('0xed')]>=_0x1ec30e[_0x0d8c('0x1d')][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xee')]){_0x1ec30e[_0x0d8c('0xef')](_0x340513,_0x24d98c[_0x0d8c('0xde')]);}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countabandonedretry':_0x340513[_0x0d8c('0xed')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x1ec30e['voiceQueues'][_0x4ce3bb[_0x0d8c('0xc2')]][_0x0d8c('0xf0')],_0x0d8c('0xe2'))['format'](_0x0d8c('0xcd')),'ContactId':_0x1d2ec2[_0x0d8c('0xe3')],'ListId':_0x1d2ec2[_0x0d8c('0xf1')],'VoiceQueueId':_0x1d2ec2[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x1d2ec2['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5d80c4=new History(_0x340513);_0x5d80c4['state']=0xb;_0x5d80c4[_0x0d8c('0x74')]=_0x0d8c('0xf2');_0x5d80c4[_0x0d8c('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5d80c4[_0x0d8c('0x75')]=_0x5d80c4[_0x0d8c('0x76')];_0x5d80c4['calleridname']=_0x340513[_0x0d8c('0xe7')];_0x5d80c4[_0x0d8c('0xe8')]=_0x340513[_0x0d8c('0xe8')];hopperUtils[_0x0d8c('0xce')](_0x5d80c4)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xf3')));}})['then'](function(){if(_0x4b8ed8)hopperUtils[_0x0d8c('0xea')](_0x340513,_0x32677c,_0x368581)[_0x0d8c('0x40')](function(){return 0x1;});});}}}};Dialer[_0x0d8c('0x19')]['syncNewExten']=function(_0x574c06){if(this['actions'][_0x574c06[_0x0d8c('0xc3')]]){this[_0x0d8c('0x21')][_0x574c06[_0x0d8c('0xc3')]][_0x0d8c('0xf4')]=_0x574c06[_0x0d8c('0xf4')];}if(this['uniqueId'][_0x574c06['uniqueid']]){this[_0x0d8c('0x23')][_0x574c06[_0x0d8c('0xc3')]][_0x0d8c('0xf4')]=_0x574c06[_0x0d8c('0xf4')];}};Dialer['prototype']['syncQueueMember']=function(_0x598ead){if(!this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]){return;}var _0x22ea18=this[_0x0d8c('0x1d')][this['actions'][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]['strategy']||_0x0d8c('0xf6');if(_0x22ea18==='roundrobin'){if(this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]&&_[_0x0d8c('0xf7')](this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf8')])&&_0x598ead[_0x0d8c('0x8c')]==='1'&&_0x598ead['paused']==='0'){if(this[_0x0d8c('0x1f')][_0x598ead[_0x0d8c('0xf9')]]){if(!this[_0x0d8c('0x1f')][_0x598ead[_0x0d8c('0xf9')]][_0x0d8c('0xf8')]){this[_0x0d8c('0x1f')][_0x598ead['stateinterface']]['locked']=!![];this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf8')]=!![];this[_0x0d8c('0x21')][_0x598ead['actionid']][_0x0d8c('0xf9')]=_0x598ead['stateinterface'];}}}}else if(_0x22ea18===_0x0d8c('0xf6')){if(this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]]){if(this['agents'][_0x598ead['stateinterface']]){this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xf9')]=_0x598ead[_0x0d8c('0xf9')];if(_[_0x0d8c('0xf7')](this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]])){this['queueBooked'][this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]=[];}this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x598ead['actionid']][_0x0d8c('0xc2')]][_0x0d8c('0x9d')](_[_0x0d8c('0x64')](_['pick'](this[_0x0d8c('0x21')][_0x598ead[_0x0d8c('0xf5')]],[_0x0d8c('0xfa'),'stateinterface']),{'status':_0x598ead['status'],'paused':_0x598ead[_0x0d8c('0xfb')]}));}}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x3d')]=function(_0x354959){if(!this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]){return;}var _0x46684e=this;var _0x29111d=this[_0x0d8c('0x1d')][this[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xc2')]];var _0x103798=_0x29111d['strategy']||_0x0d8c('0xf6');if(_0x103798===_0x0d8c('0xfc')){if(this['actions'][_0x354959[_0x0d8c('0xf5')]]&&this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xf9')]){this['preview'][_0x0d8c('0xfd')](this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xfa')],this[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xf9')])[_0x0d8c('0xa5')](function(_0x50f804){logger['error'](_0x0d8c('0xfe'),util['inspect'](_0x50f804,{'showHidden':![],'depth':null}));})[_0x0d8c('0x1b')](function(){_0x46684e[_0x0d8c('0xc5')](_0x46684e['voiceQueues'][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]);_0x46684e['agents'][_0x46684e[_0x0d8c('0x21')][_0x354959['actionid']][_0x0d8c('0xf9')]]['locked']=![];delete _0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]];unlockQueueStatus(_0x29111d);});}else{this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']]);hopperUtils[_0x0d8c('0xdf')]({'active':![],'ContactId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xe3')],'ListId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xf1')],'VoiceQueueId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xe4')]||undefined,'CampaignId':this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]];unlockQueueStatus(_0x29111d);}}else if(_0x103798===_0x0d8c('0xf6')){var _0xed8d82;if(this[_0x0d8c('0x21')][_0x354959['actionid']]&&!_['isEmpty'](this[_0x0d8c('0x27')][this['actions'][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]])){if(this['queueBookedRR'][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']]){this[_0x0d8c('0x28')][_0x46684e[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]=this[_0x0d8c('0x28')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]?this[_0x0d8c('0x28')][this['actions'][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]]:this[_0x0d8c('0x27')][this['actions'][_0x354959[_0x0d8c('0xf5')]]['queue']]?this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]][_0x0d8c('0xff')]||0x0:0x0;}this[_0x0d8c('0x27')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]]['queue']][_0x0d8c('0xff')]=this[_0x0d8c('0x28')][this[_0x0d8c('0x21')][_0x354959[_0x0d8c('0xf5')]][_0x0d8c('0xc2')]];for(var _0x46eda8=0x0;_0x46eda8=_0x3975e8[_0x0d8c('0x129')]){_0xd6d0a0['stateGlobal'](_0x3dcc33,_0x522a49,_0x5c44a6,'reason19\x20machine....');}else{if(_0x3dcc33[_0x0d8c('0x122')]>=_0x3975e8[_0x0d8c('0x12a')]){_0xd6d0a0['createStateFinal'](_0x3dcc33,_0x522a49,_0x5c44a6,_0x0d8c('0x12b'));}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x3dcc33[_0x0d8c('0x122')],'scheduledat':moment()['add'](_0x3975e8[_0x0d8c('0x12c')],_0x0d8c('0xe2'))['format'](_0x0d8c('0xcd')),'ContactId':_0x3dcc33['ContactId'],'ListId':_0x3dcc33['ListId'],'VoiceQueueId':_0x3dcc33[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x3dcc33[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x12d')));_0x522a49({'reschedule':0x1});}}});}if(_0x21eb69[_0x0d8c('0x44')]===_0x0d8c('0xc4')&&this[_0x0d8c('0x1e')][_0x21eb69['queue']]['dialAMDActive']&&_0x59196d[_0x0d8c('0x116')]===_0x0d8c('0x117')){delete this['uniqueId'][_0x59196d['uniqueid']];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]]);_0x3c6bef=new Hangup(_0x21eb69,_0x59196d);_0x3c6bef[_0x0d8c('0x73')]=0x12;_0x3c6bef['statedesc']=_0x0d8c('0x119');_0x3c6bef[_0x0d8c('0x11a')]=_0x0d8c('0x11b');ami[_0x0d8c('0x43')](_0x0d8c('0x11c'),ut[_0x0d8c('0x11d')](_0x3c6bef,_0x0d8c('0x123')));this[_0x0d8c('0x12e')](_0x3c6bef,_0x0d8c('0x12f'),'[syncHangupInAMDIvr]');}if(_0x21eb69[_0x0d8c('0x44')]===_0x0d8c('0xc4')&&this[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]][_0x0d8c('0x11f')]&&_0x59196d['value']===_0x0d8c('0x120')){return new Promise(function(_0x318128,_0x32824a){delete _0xd6d0a0[_0x0d8c('0x23')][_0x59196d[_0x0d8c('0xc3')]];_0xd6d0a0[_0x0d8c('0xc5')](_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]]);_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]][_0x0d8c('0xc7')]+=0x1;_0xd6d0a0['campaigns'][_0x21eb69[_0x0d8c('0xc2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x50fe7d=_0xd6d0a0[_0x0d8c('0x1e')][_0x21eb69[_0x0d8c('0xc2')]];var _0x2f2f00=new Hangup(_0x21eb69,_0x59196d);_0x2f2f00[_0x0d8c('0x73')]=0x13;_0x2f2f00[_0x0d8c('0x74')]='Machine';_0x2f2f00[_0x0d8c('0x11a')]=_0x0d8c('0x11b');_0x2f2f00['countmachineretry']+=0x1;_0x2f2f00[_0x0d8c('0xd9')]+=0x1;_0x2f2f00[_0x0d8c('0x123')]=!![];ami[_0x0d8c('0x43')](_0x0d8c('0x11c'),ut[_0x0d8c('0x11d')](_0x2f2f00,_0x0d8c('0x123')));hopperUtils['createHistory'](_0x2f2f00)[_0x0d8c('0xa5')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2f2f00[_0x0d8c('0x125')]+_0x2f2f00[_0x0d8c('0x126')]+_0x2f2f00[_0x0d8c('0x130')]+_0x2f2f00[_0x0d8c('0x127')]+_0x2f2f00[_0x0d8c('0xd8')]+_0x2f2f00[_0x0d8c('0xed')]+_0x2f2f00[_0x0d8c('0x122')]+_0x2f2f00[_0x0d8c('0x128')]>=_0x50fe7d[_0x0d8c('0x129')]){_0xd6d0a0[_0x0d8c('0x131')](_0x2f2f00,_0x318128,_0x32824a,_0x0d8c('0x132'));}else{if(_0x2f2f00[_0x0d8c('0x122')]>=_0x50fe7d[_0x0d8c('0x12a')]){_0xd6d0a0['createStateFinal'](_0x2f2f00,_0x318128,_0x32824a,'reason\x2019\x20machine....');}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x2f2f00[_0x0d8c('0x122')],'scheduledat':moment()[_0x0d8c('0xe0')](_0x50fe7d[_0x0d8c('0x12c')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x2f2f00[_0x0d8c('0xe3')],'ListId':_0x2f2f00['ListId'],'VoiceQueueId':_0x2f2f00[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x2f2f00[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x12d')));_0x318128({'reschedule':0x1});}}});}}};Dialer[_0x0d8c('0x19')]['syncHangup']=function(_0x2327ec){var _0x415694=this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];var _0x7cf4c9;if(_0x415694&&_0x415694[_0x0d8c('0x44')]===_0x0d8c('0xc4')){delete this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1e')][_0x415694[_0x0d8c('0xc2')]]);this[_0x0d8c('0x1e')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x133')]+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);hopperUtils['createHistory'](_0x7cf4c9)['catch'](loggerCatch(_0x0d8c('0x134')));hopperUtils['moveContactManagedDialer'](_0x7cf4c9)['catch'](loggerCatch(_0x0d8c('0x135')));}if(_0x415694&&_0x415694[_0x0d8c('0x44')]!==_0x0d8c('0xc4')&&isNotNull(this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]['dialQueueProject'])){delete this['uniqueId'][_0x2327ec[_0x0d8c('0xc3')]];this[_0x0d8c('0xc5')](this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]);this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]['outboundAnswerCallsDay']+=0x1;this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x118')]+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);_0x7cf4c9['state']=0x10;_0x7cf4c9[_0x0d8c('0x74')]='AnswerAGI';_0x7cf4c9[_0x0d8c('0x11a')]=_0x0d8c('0x136');hopperUtils['createHistory'](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x134')));hopperUtils[_0x0d8c('0xd0')](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x135')));}if(_0x415694&&_0x415694[_0x0d8c('0x44')]!=='ivr'&&!isNotNull(this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]][_0x0d8c('0x137')])){delete this[_0x0d8c('0x23')][_0x2327ec['uniqueid']];this['updateOriginated'](this[_0x0d8c('0x1d')][_0x415694[_0x0d8c('0xc2')]]);this['voiceQueues'][_0x415694['queue']]['outboundUnknownCallsDay']+=0x1;_0x7cf4c9=new Hangup(_0x415694,_0x2327ec);_0x7cf4c9[_0x0d8c('0x73')]=0xc;_0x7cf4c9[_0x0d8c('0x74')]=_0x2327ec[_0x0d8c('0x138')];_0x7cf4c9[_0x0d8c('0x11a')]=_0x0d8c('0x139');hopperUtils[_0x0d8c('0xce')](_0x7cf4c9)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0d8c('0xd0')](_0x7cf4c9)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x135')));}};Dialer['prototype']['syncQueueSummary']=function(_0x274b31){var _0x433ae4=this;if(!_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]]){_0x433ae4[_0x0d8c('0x29')][_0x274b31['name']]={'running':![]};}else if(_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]]['running']===!![]){return;}else if(_0x433ae4[_0x0d8c('0x29')][_0x274b31['name']][_0x0d8c('0x13a')]===![]){_0x433ae4[_0x0d8c('0x29')][_0x274b31[_0x0d8c('0x49')]][_0x0d8c('0x13a')]=!![];}var _0x6f6311=_0x433ae4[_0x0d8c('0x1d')][_0x274b31[_0x0d8c('0x49')]];var _0xe66d08=_0x6f6311['message']!==utils[_0x0d8c('0x6e')][_0x0d8c('0x80')];var _0x3abd7f=utils[_0x0d8c('0x13b')](_0x6f6311);_0x6f6311[_0x0d8c('0x13c')]=utils[_0x0d8c('0x13d')](_0x6f6311,_0x433ae4[_0x0d8c('0x20')]);Promise[_0x0d8c('0xad')]()['then'](function(){if(_0x6f6311['statusMessage']===utils[_0x0d8c('0x6e')][_0x0d8c('0x80')]){if(_0xe66d08){clearPredictiveAttributes(_0x6f6311);_0x274b31[_0x0d8c('0x24')]=undefined;_0x274b31[_0x0d8c('0x25')]=undefined;}if(_0x6f6311[_0x0d8c('0x13c')]===utils[_0x0d8c('0x6e')][_0x0d8c('0x80')]){_0x274b31[_0x0d8c('0x13e')]=0x0;_0x274b31[_0x0d8c('0xfb')]=0x0;_0x274b31[_0x0d8c('0x13f')]=0x0;_0x274b31['talking']=0x0;_0x274b31[_0x0d8c('0x140')]=0x0;}}else if(_0x6f6311[_0x0d8c('0x13c')]===utils[_0x0d8c('0x6e')][_0x0d8c('0x141')]&&!_0x3abd7f){return _0x433ae4[_0x0d8c('0x94')](_0x6f6311,!![])['then'](function(){return _0x433ae4[_0x0d8c('0x94')](_0x6f6311,![]);})[_0x0d8c('0x40')](function(){return _0x433ae4['checkDialMethod'](_0x6f6311);})[_0x0d8c('0xa5')](function(_0x57193d){loggerSyncQueueSummary['debug'](_0x0d8c('0x142'),util[_0x0d8c('0x47')](_0x57193d,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x6f6311);});}else{clearPredictiveAttributes(_0x6f6311);}})[_0x0d8c('0x40')](function(){var _0x2e0e55=_0x274b31['compareToOutboundQueue'](_0x6f6311);if(_0x2e0e55||_0x6f6311[_0x0d8c('0x143')]){_0x6f6311[_0x0d8c('0x143')]=![];_0x274b31[_0x0d8c('0x144')](_0x6f6311);Object[_0x0d8c('0x145')](_0x6f6311,_0x274b31);emitOutboundVoiceQueueSummary(_0x274b31);}_0x433ae4[_0x0d8c('0x29')][_0x6f6311['name']][_0x0d8c('0x13a')]=![];})[_0x0d8c('0xa5')](function(_0x445b10){logger[_0x0d8c('0x69')]('[syncQueueSummary]',util[_0x0d8c('0x47')](_0x445b10,{'showHidden':![],'depth':null}));_0x433ae4[_0x0d8c('0x29')][_0x6f6311[_0x0d8c('0x49')]]['running']=![];});};Dialer[_0x0d8c('0x19')]['syncQueueSummaryComplete']=_[_0x0d8c('0x146')](function(){var _0x4981a2=_[_0x0d8c('0x147')](this[_0x0d8c('0x1d')],function(_0x501f20){return _0x501f20[_0x0d8c('0x148')];});var _0x29047d=_[_0x0d8c('0x147')](this[_0x0d8c('0x1f')],function(_0x36854c){return _0x36854c['online']&&_0x36854c[_0x0d8c('0x8c')]===_0x0d8c('0x149');});if(_0x4981a2['length']>0x0&&_0x29047d[_0x0d8c('0x9c')]>0x0){return Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](cmHopper[_0x0d8c('0x14a')](_[_0x0d8c('0x14b')](_0x4981a2,'id'),previewRecallmeReminderInterval,_[_0x0d8c('0x14b')](_0x29047d,'id')))['then'](function(_0x3ecfa3){for(var _0x59a7ed=0x0;_0x59a7ed<_0x3ecfa3[_0x0d8c('0x9c')];_0x59a7ed++){var _0x5bb455=_0x3ecfa3[_0x59a7ed][_0x0d8c('0x14c')]['name'];if(_0x5bb455)io['to'](util[_0x0d8c('0x48')]('user:%s',_0x5bb455))[_0x0d8c('0x43')](_0x0d8c('0x14d'),{'hopper':_0x3ecfa3[_0x59a7ed]});}})[_0x0d8c('0xa5')](function(_0x3fea86){logger[_0x0d8c('0x69')](_0x0d8c('0x14e'),_0x3fea86);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0d8c('0x19')][_0x0d8c('0x14f')]=function(){var _0x248b62=this;setInterval(function(){_0x248b62[_0x0d8c('0x150')](_0x248b62[_0x0d8c('0x23')],'[uniqueid]');_0x248b62[_0x0d8c('0x150')](_0x248b62[_0x0d8c('0x21')],'[actions]');},0x32c8);};Dialer[_0x0d8c('0x19')]['clearZombieChannels']=function(_0x2ccb66,_0x594f08){var _0x2910f6=this;for(var _0x11f174 in _0x2ccb66){if(typeof _0x2ccb66[_0x11f174]!==_0x0d8c('0x151')){this['sequence'][_0x0d8c('0x152')](function(){if(!_[_0x0d8c('0xf7')](_0x2ccb66[_0x11f174])){return ami[_0x0d8c('0x9e')]({'action':_0x0d8c('0x8c'),'channel':_0x2ccb66[_0x11f174][_0x0d8c('0xf4')]})['catch'](function(_0x306aaa){if(_0x306aaa[_0x0d8c('0x6d')]===_0x0d8c('0x153')){setTimeout(function(){if(_0x2ccb66[_0x11f174]&&_0x2ccb66[_0x11f174][_0x0d8c('0x44')]!==_0x0d8c('0xc4')){_0x2910f6[_0x0d8c('0xc5')](_0x2910f6[_0x0d8c('0x1d')][_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]]);logger[_0x0d8c('0x69')](_0x0d8c('0x154'),_0x594f08,_0x11f174,_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]);delete _0x2ccb66[_0x11f174];}if(_0x2ccb66[_0x11f174]&&_0x2ccb66[_0x11f174][_0x0d8c('0x44')]===_0x0d8c('0xc4')){_0x2910f6[_0x0d8c('0xc5')](_0x2910f6[_0x0d8c('0x1e')][_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]]);logger[_0x0d8c('0x69')](_0x0d8c('0x155'),_0x594f08,_0x11f174,_0x2ccb66[_0x11f174][_0x0d8c('0xc2')]);delete _0x2ccb66[_0x11f174];}},0x2328);}});}});}}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x156')]=function(_0x1f7abb){return Promise[_0x0d8c('0xad')]()['then'](voiceQueueRt[_0x0d8c('0x156')](_0x1f7abb))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x157')));};Dialer[_0x0d8c('0x19')][_0x0d8c('0xc5')]=function(_0x550df1){if(!_['isUndefined'](_0x550df1)&&_0x550df1!==null){if(typeof _0x550df1[_0x0d8c('0x158')]!=='undefined'){if(_0x550df1[_0x0d8c('0x158')]>0x0){_0x550df1[_0x0d8c('0x158')]-=0x1;}else{logger[_0x0d8c('0x69')](_0x0d8c('0x159'));}}}else{logger['error'](_0x0d8c('0x15a'));}};Dialer['prototype']['loggerHandler']=function(_0x2739f0,_0x3406bc){var _0x20b912=this;return function(_0x2d0cd9){_0x20b912['updateOriginated'](_0x3406bc);logger[_0x0d8c('0x69')](_0x2739f0,util[_0x0d8c('0x47')](_0x2d0cd9,{'showHidden':![],'depth':null}));};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x15b')]=function(_0x2b1502,_0x3ab53c,_0x70110f){var _0xc3b0d6={'state':0x19,'statedesc':'notFound'};this[_0x0d8c('0xc5')](_0x3ab53c);this[_0x0d8c('0x12e')](_[_0x0d8c('0x64')](_0xc3b0d6,_['pick'](_0x70110f,[_0x0d8c('0xe3'),_0x0d8c('0xf1'),_0x0d8c('0x15c'),'VoiceQueueId',_0x0d8c('0x105')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x2b1502);};Dialer[_0x0d8c('0x19')]['saveInDb']=function(_0x4913a0,_0x8dfa5f,_0x88f794){hopperUtils[_0x0d8c('0xce')](_0x4913a0)[_0x0d8c('0xa5')](loggerCatch(_0x8dfa5f));hopperUtils['moveContactManagedDialer'](_0x4913a0)[_0x0d8c('0xa5')](loggerCatch(_0x88f794));};Dialer[_0x0d8c('0x19')][_0x0d8c('0xef')]=function(_0x34b99a,_0x10d31e){hopperUtils[_0x0d8c('0xce')](_0x34b99a)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xcf')));if(_0x10d31e==0x0){hopperUtils['moveContactManagedDialer'](_0x34b99a)['catch'](loggerCatch(_0x0d8c('0x15d')));}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x14e')]=function(_0x212151){return Promise[_0x0d8c('0xad')]()[_0x0d8c('0x40')](cmHopper['handlePreviewRecallNotifications'](_0x212151['id'],previewRecallmeReminderInterval))[_0x0d8c('0x40')](function(_0x1d90e5){for(var _0x1d1b49=0x0;_0x1d1b49<_0x1d90e5['length'];_0x1d1b49++){var _0x5555e6=_0x1d90e5[_0x1d1b49][_0x0d8c('0x14c')][_0x0d8c('0x49')];if(_0x5555e6)io['to'](util[_0x0d8c('0x48')](_0x0d8c('0x15e'),_0x5555e6))[_0x0d8c('0x43')]('user:dialPreviewRecallReminder',{'hopper':_0x1d90e5[_0x1d1b49]});}})[_0x0d8c('0xa5')](function(){});};Dialer['prototype'][_0x0d8c('0xb1')]=function(_0x31f35d){var _0x45d3cc=this;return function(){_0x45d3cc[_0x0d8c('0x15f')](_0x31f35d);};};Dialer[_0x0d8c('0x19')][_0x0d8c('0x160')]=function(_0x33f32d,_0x1f5b9e){var _0x4a57a7=this;var _0x19f420=uuid['v4']();this['actions'][_0x19f420]=new Action(_0x33f32d,_0x1f5b9e,_0x19f420);return new Promise(function(_0x2965dc,_0x49ed4d){if(_[_0x0d8c('0x42')](_0x33f32d)&&typeof _0x33f32d!==_0x0d8c('0x161')){return _0x49ed4d(msgResponse('originate','Failure',_0x0d8c('0x162')));}if(_[_0x0d8c('0x42')](_0x1f5b9e[_0x0d8c('0x163')])||_0x1f5b9e[_0x0d8c('0x163')]===null){return _0x49ed4d(msgResponse('originate',_0x0d8c('0x95'),_0x0d8c('0x164')));}var _0x370e57={'XMD-CALLERID':_0x4a57a7['actions'][_0x19f420]['getCaller'](),'XMD-AGI':_0x33f32d['dialQueueProject']?util[_0x0d8c('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33f32d[_0x0d8c('0x137')]):_0x0d8c('0x165'),'XMD-AGIAFTER':_0x33f32d[_0x0d8c('0xcb')]?util[_0x0d8c('0x48')]('\x22agi://%s/square,%s\x22',ipAgi,_0x33f32d['dialQueueProject2']):'NONE','XMD-QUEUE':utils[_0x0d8c('0x166')](_0x33f32d)?util[_0x0d8c('0x48')](_0x0d8c('0x167'),_0x33f32d[_0x0d8c('0x49')],_0x33f32d['dialQueueOptions']||'',_0x33f32d[_0x0d8c('0xcc')]?'c':'',_0x33f32d['dialQueueTimeout']||0x3):_0x0d8c('0x165'),'XMD-CONTACTID':_0x1f5b9e[_0x0d8c('0xe3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4a57a7[_0x0d8c('0x21')][_0x19f420][_0x0d8c('0x168')](),'XMD-AMD':_0x33f32d[_0x0d8c('0x11f')]?'ACTIVE':_0x0d8c('0x165'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x33f32d[_0x0d8c('0x11f')]){_0x370e57['XMD-AMDINITIALSILENCE']=_0x33f32d[_0x0d8c('0x169')]||0x9c4;_0x370e57['XMD-AMDGREETING']=_0x33f32d['dialAMDGreeting']||0x5dc;_0x370e57['XMD-AMDAFTERGREETINGSILENCE']=_0x33f32d[_0x0d8c('0x16a')]||0x320;_0x370e57[_0x0d8c('0x16b')]=_0x33f32d[_0x0d8c('0x16c')]||0x1388;_0x370e57[_0x0d8c('0x16d')]=_0x33f32d[_0x0d8c('0x16e')]||0x64;_0x370e57[_0x0d8c('0x16f')]=_0x33f32d['dialAMDBetweenWordsSilence']||0x32;_0x370e57['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x33f32d[_0x0d8c('0x170')]||0x3;_0x370e57[_0x0d8c('0x171')]=_0x33f32d[_0x0d8c('0x172')]||0x100;_0x370e57[_0x0d8c('0x173')]=_0x33f32d[_0x0d8c('0x174')]||0x1388;}if(utils['isOutboundQueue'](_0x33f32d)){_0x370e57[_0x0d8c('0x175')]=_0x1f5b9e['VoiceQueueId'];}else{_0x370e57[_0x0d8c('0x176')]=_0x1f5b9e[_0x0d8c('0x105')];}for(var _0x7cab5b in _0x1f5b9e[_0x0d8c('0x177')]){if(typeof _0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b]!=='undefined'){if(isNotNull(_0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b])&&_0x7cab5b!=='id'&&_0x7cab5b!==_0x0d8c('0x178')&&_0x7cab5b!==_0x0d8c('0x179')&&_0x7cab5b!==_0x0d8c('0x17a')){_0x370e57[util['format']('%s%s',_0x0d8c('0x17b'),_[_0x0d8c('0x17c')](_0x7cab5b))]=_0x1f5b9e[_0x0d8c('0x177')][_0x7cab5b];}}}var _0x38e671=_0x4a57a7[_0x0d8c('0x89')](_0x33f32d['Trunk'])?utils[_0x0d8c('0x17d')](_0x33f32d[_0x0d8c('0x8f')]['callerid'],_0x33f32d[_0x0d8c('0x17e')],_0x33f32d[_0x0d8c('0x17f')]>0x0?utils[_0x0d8c('0x180')](_0x33f32d[_0x0d8c('0x181')],_0x33f32d[_0x0d8c('0x17f')]):_0x33f32d['dialOriginateCallerIdNumber']):utils[_0x0d8c('0x17d')](_[_0x0d8c('0xf7')](_0x33f32d[_0x0d8c('0x90')])?_0x33f32d[_0x0d8c('0x8f')]['callerid']:_0x33f32d[_0x0d8c('0x90')][_0x0d8c('0x182')],_0x33f32d[_0x0d8c('0x17e')],_0x33f32d[_0x0d8c('0x17f')]>0x0?utils[_0x0d8c('0x180')](_0x33f32d[_0x0d8c('0x181')],_0x33f32d[_0x0d8c('0x17f')]):_0x33f32d['dialOriginateCallerIdNumber']);if(_0x38e671){_0x370e57[_0x0d8c('0x183')]=_0x4a57a7[_0x0d8c('0x21')][_0x19f420][_0x0d8c('0x184')]=utils[_0x0d8c('0x185')](_0x38e671);_0x370e57[_0x0d8c('0x186')]=_0x1f5b9e[_0x0d8c('0x163')];}_0x33f32d[_0x0d8c('0x187')]=_0x370e57;return ami[_0x0d8c('0x9e')]({'actionid':_0x19f420,'action':'originate','channel':_0x4a57a7[_0x0d8c('0x89')](_0x33f32d[_0x0d8c('0x8f')])?util[_0x0d8c('0x48')](_0x0d8c('0x188'),_0x33f32d[_0x0d8c('0x8f')][_0x0d8c('0x49')],isNotNull(_0x33f32d[_0x0d8c('0x189')])?_0x33f32d[_0x0d8c('0x189')][_0x0d8c('0x18a')]()||'':'',_0x33f32d[_0x0d8c('0x18b')]>0x0?_0x1f5b9e[_0x0d8c('0x163')][_0x0d8c('0x18c')](_0x33f32d['dialCutDigit']):_0x1f5b9e[_0x0d8c('0x163')]):util[_0x0d8c('0x48')]('SIP/%s/%s%s',_[_0x0d8c('0xf7')](_0x33f32d['TrunkBackup'])?_0x33f32d[_0x0d8c('0x8f')][_0x0d8c('0x49')]:_0x33f32d[_0x0d8c('0x90')][_0x0d8c('0x49')],isNotNull(_0x33f32d[_0x0d8c('0x189')])?_0x33f32d[_0x0d8c('0x189')][_0x0d8c('0x18a')]()||'':'',_0x33f32d[_0x0d8c('0x18b')]>0x0?_0x1f5b9e[_0x0d8c('0x163')][_0x0d8c('0x18c')](_0x33f32d[_0x0d8c('0x18b')]):_0x1f5b9e[_0x0d8c('0x163')]),'callerid':_0x38e671,'Exten':_0x0d8c('0x115'),'Context':_0x0d8c('0x18d'),'Priority':'1','variable':_0x370e57,'timeout':(_0x33f32d[_0x0d8c('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x19f420})['then'](function(_0x278716){return _0x2965dc(_0x278716);})[_0x0d8c('0xa5')](function(_0x3a78b4){_0x33f32d[_0x0d8c('0x18f')]+=0x1;var _0x265b7c=new History(_0x4a57a7[_0x0d8c('0x21')][_0x19f420]);logger[_0x0d8c('0x69')](util[_0x0d8c('0x48')](_0x0d8c('0x190'),JSON[_0x0d8c('0x79')](_0x3a78b4)));_0x265b7c[_0x0d8c('0x73')]=0xe;_0x265b7c[_0x0d8c('0x74')]='OriginateError';_0x265b7c[_0x0d8c('0x76')]=moment()['format'](_0x0d8c('0xcd'));_0x265b7c['endtime']=_0x265b7c[_0x0d8c('0x76')];hopperUtils['createHistory'](_0x265b7c)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x191')));_0x4a57a7['moveContactManagedDialer'](_0x265b7c)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x191')))[_0x0d8c('0x1b')](function(){delete _0x4a57a7['actions'][_0x19f420];return _0x49ed4d(msgResponse(_0x0d8c('0x192'),_0x0d8c('0x88'),_0x0d8c('0x193')));});});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x194')]=function(_0x2c68e5,_0x856177,_0x4c0f44){var _0x47633d=new History(_0x856177);if(_0x47633d[_0x0d8c('0x125')]+_0x47633d[_0x0d8c('0x126')]+_0x47633d[_0x0d8c('0x130')]+_0x47633d[_0x0d8c('0x127')]+_0x47633d[_0x0d8c('0xd8')]+_0x47633d[_0x0d8c('0xed')]+_0x47633d[_0x0d8c('0x122')]+_0x47633d[_0x0d8c('0x128')]>=_0x4c0f44[_0x0d8c('0x129')]-0x1){return!![];}switch(_0x2c68e5){case 0x3:if(_0x47633d[_0x0d8c('0x130')]>=_0x4c0f44['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x47633d[_0x0d8c('0x130')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44['dialNoAnswerRetryFrequency'],'minutes')[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d['ListId'],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x47633d[_0x0d8c('0x125')]>=_0x4c0f44[_0x0d8c('0x195')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countbusyretry':_0x47633d['countbusyretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x196')],'minutes')[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x197')));break;case 0x8:if(_0x47633d['countcongestionretry']>=_0x4c0f44[_0x0d8c('0x198')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countcongestionretry':_0x47633d[_0x0d8c('0x126')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x199')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x19a')));break;case 0x0:if(_0x47633d[_0x0d8c('0x127')]>=_0x4c0f44[_0x0d8c('0x19b')]-0x1){return!![];}else{hopperUtils[_0x0d8c('0xdf')]({'active':![],'countnosuchnumberretry':_0x47633d['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x19c')],'minutes')['format'](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch(_0x0d8c('0x19d')));}break;case 0xa:if(_0x47633d['countdropretry']>=_0x4c0f44[_0x0d8c('0xdd')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countdropretry':_0x47633d[_0x0d8c('0xd8')]+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0xe1')],'minutes')[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d['ListId'],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x47633d[_0x0d8c('0xed')]>=_0x4c0f44[_0x0d8c('0xee')]-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countabandonedretry':_0x47633d['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0xf0')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d['VoiceQueueId']||undefined,'CampaignId':_0x47633d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x19e')));break;case 0x13:if(_0x47633d[_0x0d8c('0x122')]>=_0x4c0f44['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0d8c('0xdf')]({'active':![],'countmachineretry':_0x47633d['countmachineretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x12c')],_0x0d8c('0xe2'))[_0x0d8c('0x48')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x12d')));break;case 0x14:if(_0x47633d[_0x0d8c('0x128')]>=_0x4c0f44[_0x0d8c('0x19f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x47633d['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x0d8c('0xe0')](_0x4c0f44[_0x0d8c('0x1a0')],_0x0d8c('0xe2'))[_0x0d8c('0x48')](_0x0d8c('0xcd')),'ContactId':_0x47633d[_0x0d8c('0xe3')],'ListId':_0x47633d[_0x0d8c('0xf1')],'VoiceQueueId':_0x47633d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x47633d[_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1a1')));break;default:return!![];}};Dialer[_0x0d8c('0x19')]['callProgressDetecting']=function(_0xd70724,_0x3da563,_0x4f7b07){var _0x73a8e8=this;var _0x3dd734=new History(_0xd70724);var _0x18da3a=![];var _0x70850e;var _0x5d2831;return new Promise(function(_0x49ec9d,_0x2bb954){if(_['isUndefined'](_0x3da563)&&typeof _0x3da563!==_0x0d8c('0x161')){return _0x2bb954(msgResponse(_0x0d8c('0x1a2'),_0x0d8c('0x95'),_0x0d8c('0x1a3')));}if(_['isUndefined'](_0x4f7b07)&&typeof _0x4f7b07!==_0x0d8c('0x161')){return _0x2bb954(msgResponse(_0x0d8c('0x1a2'),_0x0d8c('0x95'),_0x0d8c('0x1a4')));}hopperUtils[_0x0d8c('0xdb')](_0x3dd734,_0x4f7b07[_0x0d8c('0xc8')],_0x3da563)['then'](function(_0x289206){if(_0x289206['additional']==0x1)_0x18da3a=!![];switch(_0x4f7b07[_0x0d8c('0xc8')]){case'0':_0x3da563[_0x0d8c('0x1a5')]+=0x1;_0x3dd734['state']=0x0;_0x3dd734['statedesc']='NoSuchNumber';_0x3dd734[_0x0d8c('0x127')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;ami[_0x0d8c('0x43')](_0x0d8c('0x1a6'),ut['buildObj'](_0xd70724,_0x0d8c('0x1a7')));_0x70850e=_0x3da563[_0x0d8c('0x19c')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x124')));if(_0x73a8e8[_0x0d8c('0x194')](0x0,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734['countnosuchnumberretry']>=_0x3da563[_0x0d8c('0x19b')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1a9'));}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3da563[_0x0d8c('0x1aa')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x3;_0x3dd734['statedesc']=_0x0d8c('0x1ab');_0x3dd734['countnoanswerretry']+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;var _0x39d171=ut['buildNoAnswerEventPayload'](_0xd70724,_0x3da563);ami[_0x0d8c('0x43')](_0x0d8c('0x1ac'),_0x39d171);_0x70850e=_0x3da563[_0x0d8c('0x1ad')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)['catch'](loggerCatch(_0x0d8c('0x1ae')));if(_0x73a8e8[_0x0d8c('0x194')](0x3,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x130')]>=_0x3da563[_0x0d8c('0x1af')]){_0x73a8e8['createStateFinal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x203\x20ringing\x20no\x20answer');}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3da563[_0x0d8c('0x1b0')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x5;_0x3dd734[_0x0d8c('0x74')]='Busy';_0x3dd734[_0x0d8c('0x125')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;ami[_0x0d8c('0x43')](_0x0d8c('0x1b1'),ut[_0x0d8c('0x11d')](_0xd70724,_0x0d8c('0x1b2')));_0x70850e=_0x3da563[_0x0d8c('0x196')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1b3')));if(_0x73a8e8[_0x0d8c('0x194')](0x5,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x125')]>=_0x3da563[_0x0d8c('0x195')]){_0x73a8e8['createStateFinal'](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b4'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b4'));}}break;case'8':_0x3da563[_0x0d8c('0x1b5')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0x8;_0x3dd734['statedesc']=_0x0d8c('0x1b6');_0x3dd734['countcongestionretry']+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0x199')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];ami[_0x0d8c('0x43')](_0x0d8c('0x1b7'),ut[_0x0d8c('0x11d')](_0xd70724,_0x0d8c('0x1b8')));hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x73a8e8[_0x0d8c('0x194')](0x8,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x126')]>=_0x3da563[_0x0d8c('0x198')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x208\x20congestion');}else{_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1b9'));}}break;case'11':_0x3da563[_0x0d8c('0x1ba')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0xb;_0x3dd734[_0x0d8c('0x74')]=_0x0d8c('0xf2');_0x3dd734[_0x0d8c('0xed')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0xf0')];_0x5d2831=_0x3da563['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0xf3')));if(_0x73a8e8['checkRetriveMax'](0xb,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0xed')]>=_0x3da563[_0x0d8c('0xee')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1bb'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x2011\x20abandoned');}}break;case'20':_0x3da563[_0x0d8c('0x1bc')]+=0x1;_0x3dd734['state']=0x14;_0x3dd734[_0x0d8c('0x74')]=_0x0d8c('0x1bd');_0x3dd734[_0x0d8c('0x128')]+=0x1;_0x3dd734[_0x0d8c('0xd9')]+=0x1;_0x70850e=_0x3da563[_0x0d8c('0x1a0')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];ami[_0x0d8c('0x43')](_0x0d8c('0x1be'),ut[_0x0d8c('0x11d')](_0xd70724,'agentreject'));hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1bf')));if(_0x73a8e8[_0x0d8c('0x194')](0x14,_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x128')]>=_0x3da563[_0x0d8c('0x19f')]){_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x0d8c('0x1c0'));}else{_0x73a8e8['stateGlobal'](_0x3dd734,_0x49ec9d,_0x2bb954,'reason\x2020\x20agentreject');}}break;default:_0x3da563[_0x0d8c('0x1c1')]+=0x1;_0x3dd734[_0x0d8c('0x73')]=0xc;_0x3dd734[_0x0d8c('0x74')]=_0x4f7b07[_0x0d8c('0xc8')];_0x70850e=_0x3da563[_0x0d8c('0x1a0')];_0x5d2831=_0x3da563[_0x0d8c('0xda')];hopperUtils[_0x0d8c('0xce')](_0x3dd734)[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1c2')));if(_0x73a8e8['checkRetriveMax'](_0x4f7b07['reason'],_0xd70724,_0x3da563)&&!_0x18da3a){if(_0x3dd734[_0x0d8c('0x125')]+_0x3dd734['countcongestionretry']+_0x3dd734['countnoanswerretry']+_0x3dd734[_0x0d8c('0x127')]+_0x3dd734[_0x0d8c('0xd8')]+_0x3dd734[_0x0d8c('0xed')]+_0x3dd734[_0x0d8c('0x122')]+_0x3dd734[_0x0d8c('0x128')]>=_0x3da563['dialGlobalMaxRetry']){_0x73a8e8[_0x0d8c('0x131')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x4f7b07[_0x0d8c('0xc8')]);}else{_0x73a8e8[_0x0d8c('0x1a8')](_0x3dd734,_0x49ec9d,_0x2bb954,_0x4f7b07[_0x0d8c('0xc8')]);}}}})['then'](function(){if(_0x18da3a){hopperUtils[_0x0d8c('0xea')](_0x3dd734,_0x70850e,_0x5d2831)[_0x0d8c('0x40')](function(){return _0x49ec9d(0x1);});}});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x131')]=function(_0x15145a,_0x5dfb13,_0x122ca0,_0x50eb00){var _0x2c8380=new Final(_0x15145a);_0x2c8380[_0x0d8c('0x73')]=0xf;_0x2c8380[_0x0d8c('0x74')]=_0x0d8c('0x1c3');this[_0x0d8c('0x1a8')](_0x2c8380,_0x5dfb13,_0x122ca0,_0x50eb00);};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1a8')]=function(_0x1ab1cb,_0x5da4fb,_0x33b472,_0x271e8e){hopperUtils[_0x0d8c('0xd0')](_0x1ab1cb)[_0x0d8c('0x40')](function(){return _0x5da4fb(msgResponse('[callProgressDetecting]',_0x0d8c('0x10e'),_0x271e8e));})[_0x0d8c('0xa5')](function(){return _0x33b472(msgResponse('[moveContactManagedDialer][0]',_0x0d8c('0x95'),_0x0d8c('0x1c4')));});};Dialer['prototype']['predictive']=function(_0x488d02){var _0x34d7d4=_0x488d02[_0x0d8c('0x1c5')]/0x64;var _0x40933b=_0x488d02[_0x0d8c('0xd4')]/(_0x488d02[_0x0d8c('0xd4')]+_0x488d02[_0x0d8c('0xc7')]);var _0xf5d714=Math[_0x0d8c('0x1c6')](_0x488d02[_0x0d8c('0x1c7')]*(_0x488d02[_0x0d8c('0x1c8')]/0x64));var _0x317f67=Math[_0x0d8c('0x1c6')](_0x488d02['predictiveIntervalAvailable']*(_0x488d02[_0x0d8c('0x1c9')]/0x64));var _0xd92e9c=_0x488d02['available']+_0x488d02['talking'];var _0x42426f=Math[_0x0d8c('0x1ca')](_0x488d02[_0x0d8c('0x5d')]*_0x488d02[_0x0d8c('0x63')]*_0x488d02['predictiveIntervalHitRate']*_0x488d02[_0x0d8c('0x1cb')]);if(_[_0x0d8c('0x42')](_0x488d02['startProgressive'])){if(!_[_0x0d8c('0x42')](_0x488d02[_0x0d8c('0x24')])){_0x488d02[_0x0d8c('0x24')]=undefined;loggerPredictive[_0x0d8c('0x69')](_0x0d8c('0x1cc'),_0x0d8c('0x1cd'));}if(!_[_0x0d8c('0x42')](_0x488d02[_0x0d8c('0x67')])){loggerPredictive[_0x0d8c('0x69')](_0x0d8c('0x1cc'),_0x0d8c('0x1ce'));clearInterval(_0x488d02[_0x0d8c('0x67')]);_0x488d02[_0x0d8c('0x67')]=undefined;}_0x488d02[_0x0d8c('0x25')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1cf'),_0x488d02[_0x0d8c('0x25')]);this[_0x0d8c('0xb7')](_0x488d02,0x1);}else if(ifInterval(_0x488d02['dialPredictiveInterval'],_0x488d02[_0x0d8c('0x25')])){this[_0x0d8c('0xb7')](_0x488d02,0x1);loggerPredictiveCalls[_0x0d8c('0x4c')](_0x0d8c('0x1d0'),_0x488d02['startProgressive'],_0x488d02['name']);_0x488d02[_0x0d8c('0x5d')]=0x0;_0x488d02[_0x0d8c('0xd5')]=0x0;}else if(_0x34d7d4<_0x40933b&&_0x488d02[_0x0d8c('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0d8c('0x1d2'),_0x40933b,_0x0d8c('0x25'),_0x488d02[_0x0d8c('0x49')]);}else if(_0x42426f<_0x488d02[_0x0d8c('0xd5')]&&_0x488d02[_0x0d8c('0x1d1')]==='dropRate'){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x1d3'),_0x0d8c('0x1d4'),_0x42426f,'Drop\x20in\x20this\x20interval',_0x488d02['predictiveIntervalErlangCallsDroppedCalls'],_0x0d8c('0x25'),_0x488d02[_0x0d8c('0x49')]);}else if(!ifInterval(_0x488d02[_0x0d8c('0x1d5')],_0x488d02[_0x0d8c('0x25')])&&_[_0x0d8c('0x42')](_0x488d02['startPredictive'])&&!_[_0x0d8c('0x42')](_0x488d02['startProgressive'])){_0x488d02[_0x0d8c('0x24')]=moment()['format'](_0x0d8c('0xcd'));loggerPredictive['info'](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1d6'),_0x488d02['startPredictive']);hopperUtils[_0x0d8c('0x1d7')](_0x488d02[_0x0d8c('0x1d5')])[_0x0d8c('0x40')](this[_0x0d8c('0x1d8')](_0x488d02))[_0x0d8c('0x40')](mergeDataErlangB(_0x488d02))[_0x0d8c('0x40')](this[_0x0d8c('0x1d9')](_0x488d02))[_0x0d8c('0xa5')](loggerCatchPredictive(_0x0d8c('0x1da'),_0x488d02));}else if(!ifInterval(_0x488d02[_0x0d8c('0x1d5')],_0x488d02['startPredictive'])){_0x488d02[_0x0d8c('0xd5')]=0x0;_0x488d02[_0x0d8c('0x24')]=moment()[_0x0d8c('0x48')](_0x0d8c('0xcd'));loggerPredictive[_0x0d8c('0x4c')](_0x488d02['name'],_0x0d8c('0x1db'),_0x488d02[_0x0d8c('0x24')]);clearInterval(_0x488d02[_0x0d8c('0x67')]);_0x488d02[_0x0d8c('0x67')]=undefined;hopperUtils['avgHandleTime'](_0x488d02['dialPredictiveInterval'])[_0x0d8c('0x40')](this[_0x0d8c('0x1d8')](_0x488d02))[_0x0d8c('0x40')](mergeDataErlangB(_0x488d02))[_0x0d8c('0x40')](this[_0x0d8c('0x1d9')](_0x488d02))[_0x0d8c('0xa5')](loggerCatchPredictive(_0x0d8c('0x1dc'),_0x488d02));}else if(_0x488d02['predictiveIntervalAvailable']&&_0xd92e9c<_0x488d02[_0x0d8c('0x1c7')]-_0x317f67){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1dd'),_0xd92e9c,_0x0d8c('0x1de'),_0x488d02[_0x0d8c('0x1c7')],'-',_0x317f67,'=',_0x488d02[_0x0d8c('0x1c7')]-_0x317f67,')');}else if(_0x488d02['predictiveIntervalAvailable']&&_0xd92e9c>_0x488d02[_0x0d8c('0x1c7')]+_0xf5d714){clearPredictiveAttributes(_0x488d02);loggerPredictive[_0x0d8c('0x4c')](_0x488d02[_0x0d8c('0x49')],_0x0d8c('0x1dd'),_0xd92e9c,_0x0d8c('0x1df'),_0x488d02['predictiveIntervalAvailable'],'+',_0xf5d714,'=',_0x488d02['predictiveIntervalAvailable']+_0xf5d714,')');}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1d8')]=function(_0x48136a){var _0x43ba5a=this;return function(_0x2a9418){return new Promise(function(_0x167a5c,_0x19c51a){_[_0x0d8c('0x64')](_0x48136a,_0x2a9418[0x0]);if(checkGetDataPredictive(_0x2a9418[0x0])){var _0x8b8a59=_0x48136a['predictiveIntervalAvailable']=_0x48136a[_0x0d8c('0x1e0')]+_0x48136a[_0x0d8c('0x13e')];var _0x3d49d7=_0x48136a['dialPredictiveInterval']*0x3c;var _0xef9b3b=_0x2a9418[0x0][_0x0d8c('0x57')]+_0x2a9418[0x0]['predictiveIntervalAvgHoldtime'];var _0x3cb30f=(_0x2a9418[0x0][_0x0d8c('0x1e1')]+_0x2a9418[0x0][_0x0d8c('0x51')]+_0x2a9418[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a9418[0x0][_0x0d8c('0x4e')];_0x48136a['predictiveIntervalHitRate']=_0x3cb30f>0x0?_0x3cb30f:0x1;switch(_0x48136a[_0x0d8c('0x1d1')]){case _0x0d8c('0x1e2'):var _0x22a773=_0x48136a[_0x0d8c('0x1c5')]/0x64;return _0x43ba5a[_0x0d8c('0x1e3')](_0x8b8a59,_0x3d49d7,_0xef9b3b,_0x3cb30f,_0x22a773)['then'](function(_0x271fc3){return _0x167a5c(_0x271fc3);});case'agentBusyFactor':var _0x4ec864=_0x48136a['dialPredictiveOptimizationPercentage']/0x64;return _0x43ba5a[_0x0d8c('0x1e4')](_0x8b8a59,_0x3d49d7,_0xef9b3b,_0x3cb30f,_0x4ec864)['then'](function(_0x2547ba){return _0x167a5c(_0x2547ba);});default:return _0x19c51a(msgResponse(_0x0d8c('0x1e5'),_0x0d8c('0x95'),'Unknown\x20Predictive'));}}else{return _0x19c51a(msgResponse(_0x0d8c('0x1e5'),'Failure',_0x0d8c('0x1e6')));}});};};Dialer[_0x0d8c('0x19')]['getDataPredictiveOld']=function(_0x5f00fc){var _0x16bc05=this;return function(_0x304eaf){return new Promise(function(_0x554b61,_0x561773){_[_0x0d8c('0x64')](_0x5f00fc,_0x304eaf[0x0]);if(checkGetDataPredictive(_0x304eaf[0x0])){loggerPredictive['info'](JSON[_0x0d8c('0x79')](_0x304eaf[0x0]));if(_0x5f00fc[_0x0d8c('0x1d1')]===_0x0d8c('0x1e2')){return _0x16bc05['getVoiceQueueRtPauses'](_0x5f00fc['id'])[_0x0d8c('0x40')](function(_0x83179e){var _0x18b2bc=_0x5f00fc['loggedIn']-_0x83179e[0x0][_0x0d8c('0x1e7')];var _0x163cc5=_0x5f00fc[_0x0d8c('0x1d5')]*0x3c;var _0x4f1848=_0x304eaf[0x0][_0x0d8c('0x57')]+_0x304eaf[0x0]['predictiveIntervalAvgHoldtime'];var _0x14bf43=(_0x304eaf[0x0][_0x0d8c('0x1e1')]+_0x304eaf[0x0][_0x0d8c('0x51')]+_0x304eaf[0x0][_0x0d8c('0x53')])/_0x304eaf[0x0][_0x0d8c('0x4e')];var _0x1db70c=_0x5f00fc[_0x0d8c('0x1c5')]/0x64;_0x5f00fc[_0x0d8c('0x1e8')]=_0x83179e[0x0][_0x0d8c('0x1e7')]||0x0;_0x5f00fc[_0x0d8c('0x1e9')]=_0x14bf43>0x0?_0x14bf43:0x1;return _0x16bc05['abandonmentRate'](_0x18b2bc,_0x163cc5,_0x4f1848,_0x14bf43,_0x1db70c);})[_0x0d8c('0x40')](function(_0x27d685){return _0x554b61(_0x27d685);})['catch'](function(_0x5f3e71){return _0x561773(msgResponse(_0x0d8c('0x1ea'),_0x0d8c('0x95'),JSON[_0x0d8c('0x79')](_0x5f3e71)));});}if(_0x5f00fc[_0x0d8c('0x1d1')]===_0x0d8c('0x1eb')){return _0x16bc05[_0x0d8c('0x156')](_0x5f00fc['id'])[_0x0d8c('0x40')](function(_0x65a55e){var _0xcde3d6=_0x5f00fc[_0x0d8c('0x1ec')]-_0x65a55e[0x0][_0x0d8c('0x1e7')];var _0x364422=_0x5f00fc[_0x0d8c('0x1d5')]*0x3c;var _0x333549=_0x304eaf[0x0][_0x0d8c('0x57')]+_0x304eaf[0x0]['predictiveIntervalAvgHoldtime'];var _0x2ca449=(_0x304eaf[0x0][_0x0d8c('0x1e1')]+_0x304eaf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x304eaf[0x0][_0x0d8c('0x53')])/_0x304eaf[0x0][_0x0d8c('0x4e')];var _0x348343=_0x5f00fc[_0x0d8c('0x1c5')]/0x64;_0x5f00fc[_0x0d8c('0x1e8')]=_0x65a55e[0x0][_0x0d8c('0x1e7')]||0x0;_0x5f00fc[_0x0d8c('0x1e9')]=_0x2ca449>0x0?_0x2ca449:0x1;return _0x16bc05[_0x0d8c('0x1e4')](_0xcde3d6,_0x364422,_0x333549,_0x2ca449,_0x348343);})['then'](function(_0x3fa7af){return _0x554b61(_0x3fa7af);})['catch'](function(_0x5b7cc5){return _0x561773(msgResponse(_0x0d8c('0x1ea'),'Failure',JSON['stringify'](_0x5b7cc5)));});}}else{return _0x561773(msgResponse('[getDataPredictive]',_0x0d8c('0x95'),_0x0d8c('0x1e6')));}});};};Dialer['prototype'][_0x0d8c('0x1d9')]=function(_0x1b3f90){var _0x59d990=this;return function(){var _0x14e3f9=0x0;var _0x20e57b=Math[_0x0d8c('0x1ca')](_0x1b3f90['erlangCallToSecond']*0x3e8);if(_0x20e57b>0x0){_0x20e57b=_0x20e57b<0x64?0x64:_0x20e57b;loggerPredictive[_0x0d8c('0x4c')](_0x1b3f90[_0x0d8c('0x49')],'one\x20call\x20every:',_0x20e57b,_0x0d8c('0x1ed'));_0x1b3f90['handlePredictive']=setInterval(function(){_0x59d990[_0x0d8c('0x67')](_0x1b3f90);loggerPredictiveCalls[_0x0d8c('0x4c')]('[handlePredictive]',_0x14e3f9+=0x1);},_0x20e57b);}else{loggerPredictive['info'](_0x1b3f90[_0x0d8c('0x49')],_0x0d8c('0x1ee'));}};};Dialer[_0x0d8c('0x19')]['checkContactBlack']=function(_0x5cf2aa,_0x3d4f1d){var _0x547a2f=this;return function(_0x1e7ac0){if(_[_0x0d8c('0x4b')](_0x1e7ac0)){if(_[_0x0d8c('0xf7')](_0x3d4f1d[_0x0d8c('0x15c')])||!_0x3d4f1d[_0x0d8c('0x1ef')]){if(_0x5cf2aa['dialMethod']==='booked'){_0x5cf2aa[_0x0d8c('0x77')]=_[_0x0d8c('0x42')](_0x5cf2aa['queueStatusComplete'])?!![]:_0x5cf2aa[_0x0d8c('0x77')];var _0xdc9d20=uuid['v4']();_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]=new Action(_0x5cf2aa,_0x3d4f1d,_0xdc9d20);loggerBooked['info']('[booked][checkContactBlack]',_0xdc9d20,'queueStatusComplete:\x20',JSON[_0x0d8c('0x79')](_0x5cf2aa[_0x0d8c('0x77')]),_0x0d8c('0x1f0'),_0x5cf2aa['name']);if(_0x5cf2aa[_0x0d8c('0x77')]){_0x5cf2aa[_0x0d8c('0x77')]=![];_0x547a2f[_0x0d8c('0x27')][_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xc2')]]=[];ami[_0x0d8c('0x9e')]({'actionid':_0xdc9d20,'action':_0x0d8c('0x1f1'),'queue':_0x5cf2aa[_0x0d8c('0x49')]})['catch'](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]['ContactId'],'ListId':_0x547a2f['actions'][_0xdc9d20]['ListId'],'VoiceQueueId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xe4')]||undefined,'CampaignId':_0x547a2f['actions'][_0xdc9d20][_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f2')));delete _0x547a2f[_0x0d8c('0x21')][_0xdc9d20];});}else{loggerBooked[_0x0d8c('0x4c')](_0x0d8c('0x1f3'),JSON[_0x0d8c('0x79')](_0x5cf2aa[_0x0d8c('0x77')]),'Queue:\x20',_0x5cf2aa['name']);_0x547a2f['updateOriginated'](_0x5cf2aa);hopperUtils[_0x0d8c('0xdf')]({'active':![],'ContactId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20]['ContactId'],'ListId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xf1')],'VoiceQueueId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0xe4')]||undefined,'CampaignId':_0x547a2f[_0x0d8c('0x21')][_0xdc9d20][_0x0d8c('0x105')]||undefined})[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f2')));delete _0x547a2f[_0x0d8c('0x21')][_0xdc9d20];}}else{return _0x547a2f[_0x0d8c('0x160')](_0x5cf2aa,_0x3d4f1d);}}else{if(utils['getSeconds'](undefined,_0x3d4f1d[_0x0d8c('0x1f4')])<_0x5cf2aa[_0x0d8c('0x1f5')]*0x3c){if(_0x3d4f1d[_0x0d8c('0x14c')]&&!_0x3d4f1d[_0x0d8c('0x14c')]['voicePause']){_0x547a2f[_0x0d8c('0x1c')][_0x0d8c('0xfd')](_0x3d4f1d['id'])[_0x0d8c('0x1b')](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);});}else{hopperUtils['unlockContact']({'active':![]},_0x3d4f1d['id'],0x1)[_0x0d8c('0x1b')](function(){_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);});}}else{_0x5cf2aa[_0x0d8c('0x1f6')]+=0x1;_0x547a2f[_0x0d8c('0xc5')](_0x5cf2aa);if(_0x5cf2aa['dialRecallInQueue']){hopperUtils[_0x0d8c('0xdf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d4f1d[_0x0d8c('0xe3')],'ListId':_0x3d4f1d['ListId'],'VoiceQueueId':_0x3d4f1d[_0x0d8c('0xe4')]||undefined,'CampaignId':_0x3d4f1d['CampaignId']||undefined})[_0x0d8c('0xa5')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils[_0x0d8c('0x6e')]['QUEUE_RECALL'],0x17,'RecallInQueue'))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x1f7')));}else{_0x547a2f[_0x0d8c('0x12e')](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils['CAMPAIGN_STATUS'][_0x0d8c('0x1f8')],0x16,_0x0d8c('0x1f9')),_0x0d8c('0x1fa'),_0x0d8c('0x1fb'));}}}}else{_0x5cf2aa['outboundBlacklistCallsDay']+=0x1;_0x547a2f['saveInDb'](createObjHistory(_0x5cf2aa,_0x3d4f1d,utils['CAMPAIGN_STATUS'][_0x0d8c('0x1fc')],0xd,_0x0d8c('0x1fd')),_0x0d8c('0x1fe'),'[Originate][MoveBlacklist]');throw _0x0d8c('0x1ff');}};};Dialer['prototype']['handleIvr']=function(_0x1a6c40){var _0x5cfb0c=this;var _0x330544=_0x1a6c40['limitCalls']-_0x1a6c40[_0x0d8c('0x158')]-_0x1a6c40[_0x0d8c('0x200')];emitCampaignSummary(_0x1a6c40);if(_0x330544>0x0){if(_0x330544>this['maxNumberOriginate']){_0x330544=this[_0x0d8c('0x201')];}_0x1a6c40[_0x0d8c('0x200')]+=_0x330544;hopperUtils[_0x0d8c('0x202')](_0x1a6c40,_0x330544)['then'](function(_0x3b536d){_0x1a6c40[_0x0d8c('0x200')]-=_0x330544;_0x1a6c40[_0x0d8c('0x200')]=_0x1a6c40['temp']>0x0?_0x1a6c40['temp']:0x0;if(!utils[_0x0d8c('0x203')](_0x3b536d)){_0x1a6c40[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['NO_AVAILABLE_CONTACTS'];logger[_0x0d8c('0x4c')](_0x0d8c('0x204')+_0x1a6c40['name']);}else{_0x1a6c40[_0x0d8c('0x158')]+=_0x3b536d[_0x0d8c('0x9c')];_0x1a6c40['message']=utils[_0x0d8c('0x6e')]['RUNNING'];for(var _0x49070a=0x0;_0x49070a<_0x3b536d['length'];_0x49070a+=0x1){_0x1a6c40[_0x0d8c('0x205')]+=0x1;if(_[_0x0d8c('0xf7')](_0x3b536d[_0x49070a])||_[_0x0d8c('0xf7')](_0x3b536d[_0x49070a][_0x0d8c('0x177')])||_['isNil'](_0x3b536d[_0x49070a][_0x0d8c('0x163')])){_0x5cfb0c[_0x0d8c('0x15b')]('[actionOriginate]\x20',_0x1a6c40,_0x3b536d[_0x49070a]);}else{hopperUtils[_0x0d8c('0x206')](_[_0x0d8c('0x7a')](_0x3b536d[_0x49070a],[_0x0d8c('0x105'),_0x0d8c('0x163')]))[_0x0d8c('0x40')](_0x5cfb0c[_0x0d8c('0x207')](_0x1a6c40,_0x3b536d[_0x49070a]))[_0x0d8c('0xa5')](_0x5cfb0c[_0x0d8c('0x208')]('[actionOriginateIvr]\x20',_0x1a6c40));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x1a6c40,_0x330544));}};Dialer['prototype']['handlePower']=function(_0x3d0108,_0x412202){var _0x5227f6=this;var _0x4e6165=[];if(_0x412202<0x1||_0x3d0108[_0x0d8c('0xb4')]===_0x0d8c('0x7')){_0x412202=0x1;}var _0x242e8e=Math[_0x0d8c('0x1ca')](_0x3d0108['available']*_0x412202)-_0x3d0108[_0x0d8c('0x158')]-_0x3d0108[_0x0d8c('0x200')];if(_0x3d0108['dialLimitQueue']>0x0){var _0x9b064c=_0x3d0108['dialLimitQueue']-_0x3d0108[_0x0d8c('0x158')]-_0x3d0108[_0x0d8c('0x1e0')]-_0x3d0108[_0x0d8c('0x200')]-_0x3d0108[_0x0d8c('0x140')];if(_0x242e8e>_0x9b064c){_0x242e8e=_0x9b064c;}}if(_0x242e8e>0x0){if(_0x3d0108['dialMethod']===_0x0d8c('0x7')){_0x242e8e=0x1;}if(_0x242e8e>this[_0x0d8c('0x201')]){_0x242e8e=this[_0x0d8c('0x201')];}_0x3d0108[_0x0d8c('0x200')]+=_0x242e8e;for(var _0x437d32 in this[_0x0d8c('0x1f')]){if(typeof this[_0x0d8c('0x1f')][_0x437d32]!==_0x0d8c('0x151')){if(this[_0x0d8c('0x1f')][_0x437d32][_0x0d8c('0x73')]==='not_inuse'&&this[_0x0d8c('0x1f')][_0x437d32]['status']===_0x0d8c('0x149')){_0x4e6165[_0x0d8c('0x9d')](this['agents'][_0x437d32]['id']);}}}hopperUtils[_0x0d8c('0x209')](_0x3d0108,_0x4e6165,_0x242e8e)['then'](function(_0x51c02f){_0x3d0108[_0x0d8c('0x200')]-=_0x242e8e;_0x3d0108[_0x0d8c('0x200')]=_0x3d0108['temp']>0x0?_0x3d0108[_0x0d8c('0x200')]:0x0;if(!utils[_0x0d8c('0x203')](_0x51c02f)){hopperUtils[_0x0d8c('0x20a')](_0x3d0108)['then'](sendMessageReschedule(_0x3d0108))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x3d0108[_0x0d8c('0x158')]+=_0x51c02f['length'];_0x3d0108[_0x0d8c('0x6d')]=_0x3d0108['dialMethod']==='booked'?utils[_0x0d8c('0x6e')][_0x0d8c('0x141')]:utils[_0x0d8c('0x6e')][_0x0d8c('0x20b')];for(var _0x47f321=0x0;_0x47f321<_0x51c02f[_0x0d8c('0x9c')];_0x47f321+=0x1){if(_['isNil'](_0x51c02f[_0x47f321])||_[_0x0d8c('0xf7')](_0x51c02f[_0x47f321][_0x0d8c('0x177')])||_[_0x0d8c('0xf7')](_0x51c02f[_0x47f321][_0x0d8c('0x163')])){_0x5227f6[_0x0d8c('0x15b')]('[actionOriginate]\x20',_0x3d0108,_0x51c02f[_0x47f321]);}else{hopperUtils[_0x0d8c('0x20c')](_[_0x0d8c('0x7a')](_0x51c02f[_0x47f321],[_0x0d8c('0xe4'),_0x0d8c('0x163')]))['then'](_0x5227f6['checkContactBlack'](_0x3d0108,_0x51c02f[_0x47f321]))['catch'](_0x5227f6[_0x0d8c('0x208')]('[actionOriginate]\x20',_0x3d0108));}}}})[_0x0d8c('0xa5')](loggerGetContactDialer(_0x0d8c('0x20d'),_0x3d0108,_0x242e8e));}};Dialer[_0x0d8c('0x19')][_0x0d8c('0x67')]=function(_0x2db8e7){if(_0x2db8e7['dialLimitQueue']>0x0){var _0x1f5b1b=_0x2db8e7[_0x0d8c('0x20e')]-_0x2db8e7[_0x0d8c('0x158')]-_0x2db8e7['talking'];if(_0x1f5b1b>0x0){this[_0x0d8c('0x20f')](_0x2db8e7);}else{loggerPredictiveCalls[_0x0d8c('0x4c')](_0x0d8c('0x210'));}}else{this['tryOriginatePredictive'](_0x2db8e7);}};Dialer['prototype'][_0x0d8c('0x20f')]=function(_0x4aec3c){var _0x5678fc=this;var _0xf78871=[];_0x4aec3c[_0x0d8c('0x158')]+=0x1;for(var _0x2784f6 in this[_0x0d8c('0x1f')]){if(typeof this[_0x0d8c('0x1f')][_0x2784f6]!=='undefined'){if(this['agents'][_0x2784f6][_0x0d8c('0x73')]===_0x0d8c('0x211')&&this[_0x0d8c('0x1f')][_0x2784f6][_0x0d8c('0x8c')]==='reachable'){_0xf78871[_0x0d8c('0x9d')](this['agents'][_0x2784f6]['id']);}}}return this[_0x0d8c('0x209')](_0x4aec3c['id'],_0xf78871,0x1,_0x4aec3c[_0x0d8c('0x212')],_0x4aec3c)['then'](function(_0xde4316){if(!utils['checkContactEmpty'](_0xde4316)){utils['checkContactLowerLimitOriginate'](_0x4aec3c,0x1,0x0);return hopperUtils['countReScheduled'](_0x4aec3c)['then'](sendMessageReschedule(_0x4aec3c))[_0x0d8c('0xa5')](loggerCatch(_0x0d8c('0x213')));}else{_0x4aec3c[_0x0d8c('0x6d')]=utils[_0x0d8c('0x6e')]['RUNNING'];if(_['isNil'](_0xde4316[0x0])||_[_0x0d8c('0xf7')](_0xde4316[0x0]['Contact'])||_[_0x0d8c('0xf7')](_0xde4316[0x0][_0x0d8c('0x163')])){_0x5678fc[_0x0d8c('0x15b')](_0x0d8c('0x214'),_0x4aec3c,_0xde4316[0x0]);}else{return hopperUtils[_0x0d8c('0x20c')](_[_0x0d8c('0x7a')](_0xde4316[0x0],[_0x0d8c('0xe4'),_0x0d8c('0x163')]))[_0x0d8c('0x40')](_0x5678fc[_0x0d8c('0x207')](_0x4aec3c,_0xde4316[0x0]))['catch'](_0x5678fc[_0x0d8c('0x208')](_0x0d8c('0x215'),_0x4aec3c));}}})[_0x0d8c('0xa5')](loggerGetContactDialer(_0x0d8c('0x216'),_0x4aec3c,0x1));};Dialer[_0x0d8c('0x19')]['abandonmentRate']=function(_0x59f5de,_0x3545f5,_0x722a93,_0x1df550,_0x4ee5d1,_0x2eb747){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x217'));loggerPredictive[_0x0d8c('0x4c')]('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',_0x59f5de);loggerPredictive['info'](_0x0d8c('0x218'),_0x3545f5);loggerPredictive[_0x0d8c('0x4c')]('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',_0x722a93);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x219'),_0x1df550);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21a'),_0x4ee5d1);loggerPredictive[_0x0d8c('0x4c')]('---------------------------');return new Promise(function(_0x14e6c3,_0xeaedf2){if(_0x59f5de<=0x0||isNaN(_0x59f5de)){return _0xeaedf2(msgResponse('[abandonmentRate]','Error',_0x0d8c('0x21b')+_0x59f5de));}if(_0x722a93<=0x0||isNaN(_0x722a93)){return _0xeaedf2(msgResponse(_0x0d8c('0x21c'),_0x0d8c('0x88'),'Ts\x20=\x20'+_0x722a93));}if(_0x1df550<=0x0||isNaN(_0x1df550)){return _0xeaedf2(msgResponse('[abandonmentRate]',_0x0d8c('0x88'),'p\x20=\x20'+_0x1df550));}if(_0x3545f5<=0x0||isNaN(_0x3545f5)){return _0xeaedf2(msgResponse('[abandonmentRate]','Error','interval\x20=\x20'+_0x3545f5));}if(_0x4ee5d1<=0x0||isNaN(_0x4ee5d1)){return _0xeaedf2(msgResponse(_0x0d8c('0x21c'),_0x0d8c('0x88'),'Amax\x20=\x20'+_0x4ee5d1));}_0x2eb747=_0x2eb747||0x0;var _0x53c19e=0x1/_0x722a93;var _0x249490=0x0;var _0x25dbfe=0x0;var _0xebec2a=0x0;var _0x1a8e69=0x0;for(var _0x46e3b7=0x0;_0xebec2a<_0x4ee5d1;_0x46e3b7+=0x1){_0x25dbfe=_0x46e3b7/_0x3545f5;_0x249490=(_0x1df550*_0x25dbfe+_0x2eb747)/_0x53c19e;_0xebec2a=utils[_0x0d8c('0x21d')](_0x249490,_0x59f5de);_0x1a8e69=_0x249490/_0x59f5de*(0x1-utils['erlangb'](_0x249490,_0x59f5de));}return _0x14e6c3({'erlangCalls':_0x46e3b7,'erlangCallToSecond':_0x3545f5/_0x46e3b7,'erlangAbandonmentRate':_0xebec2a,'erlangBusyFactor':_0x1a8e69});});};Dialer[_0x0d8c('0x19')][_0x0d8c('0x1e4')]=function(_0x419be6,_0x119e1f,_0x5cf74f,_0x584125,_0x354450,_0x583331){loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21e'));loggerPredictive[_0x0d8c('0x4c')]('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',_0x419be6);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x218'),_0x119e1f);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x21f'),_0x5cf74f);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x219'),_0x584125);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x220'),_0x354450);loggerPredictive[_0x0d8c('0x4c')](_0x0d8c('0x58'));return new Promise(function(_0x1a634c,_0x44bc49){if(_0x419be6<=0x0||isNaN(_0x419be6)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x21b')+_0x419be6));}if(_0x5cf74f<=0x0||isNaN(_0x5cf74f)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x222')+_0x5cf74f));}if(_0x584125<=0x0||isNaN(_0x584125)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),'p\x20=\x20'+_0x584125));}if(_0x119e1f<=0x0||isNaN(_0x119e1f)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),'Error',_0x0d8c('0x223')+_0x119e1f));}if(_0x354450<=0x0||isNaN(_0x354450)){return _0x44bc49(msgResponse(_0x0d8c('0x221'),_0x0d8c('0x88'),_0x0d8c('0x224')+_0x354450));}_0x583331=_0x583331||0x0;var _0x1f57c9=0x1/_0x5cf74f;var _0x197384=0x0;var _0x4f8282=0x0;var _0x34750c=0x0;var _0x53cf32=0x0;for(var _0x56ec46=0x0;_0x53cf32<_0x354450;_0x56ec46+=0x1){_0x4f8282=_0x56ec46/_0x119e1f;_0x197384=(_0x584125*_0x4f8282+_0x583331)/_0x1f57c9;_0x34750c=utils[_0x0d8c('0x21d')](_0x197384,_0x419be6);_0x53cf32=_0x197384/_0x419be6*(0x1-utils[_0x0d8c('0x21d')](_0x197384,_0x419be6));}return _0x1a634c({'erlangCalls':_0x56ec46,'erlangCallToSecond':_0x119e1f/_0x56ec46,'erlangAbandonmentRate':_0x34750c,'erlangBusyFactor':_0x53cf32});});};module['exports']=Dialer; \ No newline at end of file +var _0x41a6=['XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','dialPrefix','dialCutDigit','SIP/%s/%s%s','trim','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','getDataPredictive','talking','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','check\x20failure','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','temp','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','available','dialLimitQueue','maxNumberOriginate','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[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]','m\x20=\x20','interval\x20=\x20','erlangb','----\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]','p\x20=\x20','exports','util','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isEmpty','Interval','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','Trunk','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','content','true','catch','some','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','add','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','callAdditionalPhoneAfterMin','queueCallerAbandonCreateState','rescheduleContact','dialAbandonedRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','response','Success','callProgressDetecting','syncVarSet','variable','amdstatus','exten','value','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','outboundAnswerAgiCallsDay','Machine','membername','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','dialMachineMaxRetry','createStateFinal','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','[syncHangupIvr][createHistory]','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','undefined','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','launchHandleIvr','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue'];(function(_0x294195,_0x45ebdc){var _0x3f4c6c=function(_0x2b3699){while(--_0x2b3699){_0x294195['push'](_0x294195['shift']());}};_0x3f4c6c(++_0x45ebdc);}(_0x41a6,0xbc));var _0x641a=function(_0x44b40c,_0x3cc2ac){_0x44b40c=_0x44b40c-0x0;var _0x49e38f=_0x41a6[_0x44b40c];return _0x49e38f;};'use strict';var util=require(_0x641a('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x641a('0x1'));var rr=require('rr');var Redis=require(_0x641a('0x2'));var utils=require(_0x641a('0x3'));var hopperUtils=require(_0x641a('0x4'));var ut=require(_0x641a('0x5'));var config=require(_0x641a('0x6'));var logger=require(_0x641a('0x7'))(_0x641a('0x8'));var loggerBooked=require('../../../config/logger')(_0x641a('0x9'));var loggerPredictive=require(_0x641a('0x7'))('predictive');var loggerPredictiveCalls=require(_0x641a('0x7'))(_0x641a('0xa'));var loggerSyncQueueSummary=require(_0x641a('0x7'))(_0x641a('0xb'));var ami=require('../ami');config[_0x641a('0xc')]=_[_0x641a('0xd')](config[_0x641a('0xc')],{'host':_0x641a('0xe'),'port':0x18eb});var io=require(_0x641a('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x641a('0x10'));var voiceQueueRt=require(_0x641a('0x11'));var RpcSetting=require(_0x641a('0x12'));var Interval=require('../rpc/interval');var Action=require(_0x641a('0x13'));var History=require(_0x641a('0x14'));var Final=require(_0x641a('0x15'));var AgentComplete=require(_0x641a('0x16'));var QueueCallerAbandon=require(_0x641a('0x17'));var Hangup=require(_0x641a('0x18'));var ipAgi=process[_0x641a('0x19')]['XCALLY_IP_AGI']||_0x641a('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x641a('0x1b')][_0x641a('0x1c')]=function(_0x3b0ead){this[_0x641a('0x1d')]=this[_0x641a('0x1d')]?this[_0x641a('0x1d')][_0x641a('0x1e')](_0x3b0ead):_0x3b0ead();};function Dialer(_0x2735e3,_0x3fee40){this[_0x641a('0x1f')]=new Sequence();this[_0x641a('0x20')]=_0x3fee40;this[_0x641a('0x21')]=_0x2735e3[_0x641a('0x21')];this['campaigns']=_0x2735e3[_0x641a('0x22')];this[_0x641a('0x23')]=_0x2735e3[_0x641a('0x23')];this['trunks']=_0x2735e3[_0x641a('0x24')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x641a('0x25')]={};this[_0x641a('0x26')]={};this[_0x641a('0x27')]={};this[_0x641a('0x28')]={};this[_0x641a('0x29')]={};this[_0x641a('0x2a')]={};this[_0x641a('0x2b')]={};this[_0x641a('0x2c')]={};this[_0x641a('0x2d')]={};this[_0x641a('0x2e')]={};this[_0x641a('0x2f')]={};ami['on'](_0x641a('0x30'),this[_0x641a('0x31')][_0x641a('0x32')](this));ami['on']('queuecallerabandon',this[_0x641a('0x33')][_0x641a('0x32')](this));ami['on'](_0x641a('0x34'),this[_0x641a('0x35')][_0x641a('0x32')](this));ami['on'](_0x641a('0x36'),this[_0x641a('0x37')]['bind'](this));ami['on'](_0x641a('0x38'),this[_0x641a('0xb')][_0x641a('0x32')](this));ami['on'](_0x641a('0x39'),this[_0x641a('0x3a')][_0x641a('0x32')](this));ami['on']('hangup',this[_0x641a('0x3b')][_0x641a('0x32')](this));ami['on'](_0x641a('0x3c'),this['syncNewExten'][_0x641a('0x32')](this));ami['on'](_0x641a('0x3d'),this['syncVarSet'][_0x641a('0x32')](this));ami['on'](_0x641a('0x3e'),this[_0x641a('0x3f')][_0x641a('0x32')](this));ami['on']('queuestatuscomplete',this[_0x641a('0x40')][_0x641a('0x32')](this));this['loopCampaigns']();this[_0x641a('0x41')]();RpcSetting[_0x641a('0x42')]()[_0x641a('0x43')](function(_0x587d83){previewRecallmeReminderInterval=_0x587d83[_0x641a('0x44')];});}function isNotNull(_0x398bb1){return _0x398bb1!==null&&!_[_0x641a('0x45')](_0x398bb1);}function msgResponse(_0x415a94,_0x5eb2e0,_0x44145e){return{'action':_0x415a94,'response':_0x5eb2e0,'message':_0x44145e,'stack':_0x44145e};}function emit(_0x548389,_0xa9409d,_0x13ec23){io['to'](_0x548389)[_0x641a('0x46')](_0xa9409d,_0x13ec23);}function emitOutboundVoiceQueueSummary(_0x2e5868){if(_0x2e5868[_0x641a('0x47')]===_0x641a('0x48')){logger[_0x641a('0x49')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x641a('0x4a')](_0x2e5868,{'showHidden':![],'depth':null}));emit(util[_0x641a('0x4b')](_0x641a('0x4c'),_0x2e5868[_0x641a('0x4d')]),_0x641a('0x4e'),_0x2e5868);}}function checkGetDataPredictive(_0x3b17d2){if(isNotNull(_0x3b17d2)&&!_['isEmpty'](_0x3b17d2)){loggerPredictive[_0x641a('0x4f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x641a('0x50'),_0x3b17d2[_0x641a('0x51')]);loggerPredictive['info'](_0x641a('0x52'),_0x3b17d2['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x641a('0x4f')](_0x641a('0x53'),_0x3b17d2[_0x641a('0x54')]);loggerPredictive[_0x641a('0x4f')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b17d2['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x641a('0x4f')](_0x641a('0x55'),_0x3b17d2['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b17d2[_0x641a('0x56')]);loggerPredictive[_0x641a('0x4f')](_0x641a('0x57'));if(_0x3b17d2[_0x641a('0x51')]>0x0){if(!_['isUndefined'](_0x3b17d2['predictiveIntervalAvgTalktime'])&&_0x3b17d2[_0x641a('0x56')]>0x0){return!![];}loggerPredictive[_0x641a('0x4f')](_0x641a('0x58'));if(!_[_0x641a('0x45')](_0x3b17d2['predictiveIntervalAvgHoldtime'])&&_0x3b17d2[_0x641a('0x59')]>0x0){return!![];}loggerPredictive[_0x641a('0x4f')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x641a('0x5a'));}}else{loggerPredictive['info'](_0x641a('0x5b'));}return![];}function mergeDataErlangB(_0x5c0c09){return function(_0x2068c6){loggerPredictive[_0x641a('0x4f')](_0x641a('0x5c'));loggerPredictive[_0x641a('0x4f')](_0x641a('0x5d'),_0x2068c6[_0x641a('0x5e')]);loggerPredictive['info'](_0x641a('0x5f'),_0x2068c6[_0x641a('0x60')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2068c6[_0x641a('0x61')]);loggerPredictive['info'](_0x641a('0x62'),_0x2068c6[_0x641a('0x63')]);loggerPredictive[_0x641a('0x4f')](_0x641a('0x64'),_0x2068c6['erlangAbandonmentRate']);loggerPredictive[_0x641a('0x4f')](_0x641a('0x57'));_[_0x641a('0x65')](_0x5c0c09,_0x2068c6);};}function ifInterval(_0x273fa3,_0x24d9b1){if(_['isUndefined'](_0x24d9b1)){return![];}return utils[_0x641a('0x66')](undefined,_0x24d9b1)<_0x273fa3*0x3c;}function clearPredictiveAttributes(_0x4b7303){if(_0x4b7303[_0x641a('0x2b')]){_0x4b7303[_0x641a('0x2b')]=undefined;loggerPredictive['debug'](_0x4b7303[_0x641a('0x4d')],_0x641a('0x67'));}if(_0x4b7303[_0x641a('0x2a')]){_0x4b7303[_0x641a('0x2a')]=undefined;loggerPredictive[_0x641a('0x49')](_0x4b7303[_0x641a('0x4d')],'startPredictive\x20value\x20cleared');}if(_0x4b7303[_0x641a('0x68')]){clearInterval(_0x4b7303['handlePredictive']);_0x4b7303['handlePredictive']=undefined;loggerPredictive[_0x641a('0x49')](_0x4b7303[_0x641a('0x4d')],_0x641a('0x69'));}}function loggerCatchPredictive(_0x3f29b5,_0x7d6454){return function(_0x59df8f){loggerPredictive[_0x641a('0x6a')](_0x7d6454[_0x641a('0x4d')],_0x3f29b5);loggerPredictive[_0x641a('0x6a')](_0x59df8f[_0x641a('0x6b')]);clearPredictiveAttributes(_0x7d6454);};}function loggerCatch(_0x217358){return function(_0x285fa8){logger['error'](_0x217358,util[_0x641a('0x4a')](_0x285fa8,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4dfba5,_0xe02f9c,_0x57cc53){return function(_0x3c5802){utils[_0x641a('0x6c')](_0xe02f9c,_0x57cc53,0x0);logger[_0x641a('0x6a')](_0x4dfba5,util[_0x641a('0x4a')](_0x3c5802,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x444132){return function(_0x570e2c){if(isNotNull(_0x570e2c)&&isNotNull(_0x570e2c[0x0])){if(_0x570e2c[0x0][_0x641a('0x6d')]>0x0){_0x444132[_0x641a('0x6e')]=utils[_0x641a('0x6f')]['CONTACTS_RESCHEDULED'];logger[_0x641a('0x4f')]('[getContactDialer2][ReScheduled]'+_0x444132[_0x641a('0x4d')],_0x570e2c[0x0][_0x641a('0x6d')],_0x641a('0x70'));}else{_0x444132['message']=utils[_0x641a('0x6f')][_0x641a('0x71')];logger[_0x641a('0x4f')]('[getContactDialer2][Empty]'+_0x444132[_0x641a('0x4d')]);}}};}function createObjHistory(_0x3acc0f,_0x143a7b,_0x451125,_0x4d35a6,_0x43c0e6){_0x3acc0f[_0x641a('0x6e')]=_0x451125;var _0x5c24af=new Action(_0x3acc0f,_0x143a7b);var _0x17936e=new History(_0x5c24af);_0x17936e['state']=_0x4d35a6;_0x17936e[_0x641a('0x72')]=_0x43c0e6;_0x17936e[_0x641a('0x73')]=_0x5c24af['starttime'];return _0x17936e;}function unlockQueueStatus(_0x4a28b0,_0x27dafb){setTimeout(function(){if(_['isUndefined'](_0x4a28b0[_0x641a('0x74')])){loggerBooked['error'](_0x641a('0x75'),_0x27dafb);}_0x4a28b0['queueStatusComplete']=!![];loggerBooked['info'](_0x641a('0x76'),_0x27dafb,JSON[_0x641a('0x77')](_[_0x641a('0x78')](_0x4a28b0,[_0x641a('0x4d'),_0x641a('0x74')])));},0x1f3);}function checkInterval(_0x223156){return function(){if(!isNotNull(_0x223156['Interval'])){_0x223156[_0x641a('0x6e')]=utils[_0x641a('0x6f')]['NULL_INTERVAL'];throw _0x223156[_0x641a('0x4d')]+_0x641a('0x79');}if(!isNotNull(_0x223156['Interval'][_0x641a('0x7a')])){_0x223156['message']=utils[_0x641a('0x6f')][_0x641a('0x7b')];throw _0x223156[_0x641a('0x4d')]+_0x641a('0x79');}if(!isNotNull(_[_0x641a('0x7c')](_0x223156[_0x641a('0x7d')][_0x641a('0x7a')]))){_0x223156[_0x641a('0x6e')]=utils['CAMPAIGN_STATUS'][_0x641a('0x7b')];throw _0x223156[_0x641a('0x4d')]+_0x641a('0x79');}};}function checkIsIVRCampaignActive(_0x4ee422){return function(){if(!utils[_0x641a('0x7e')](_0x4ee422)){_0x4ee422['message']=utils[_0x641a('0x6f')]['INACTIVE'];throw _0x4ee422[_0x641a('0x4d')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x50942f){if(utils[_0x641a('0x7f')](_0x50942f)){emit(util[_0x641a('0x4b')](_0x641a('0x80'),_0x50942f['name']),_0x641a('0x81'),_0x50942f);}}function loggerCatchQueueSummary(_0x514aba,_0x2d3d1d){return function(_0x13bf77){clearPredictiveAttributes(_0x2d3d1d);emitCampaignSummary(_0x2d3d1d);loggerSyncQueueSummary[_0x641a('0x49')](_0x514aba,util[_0x641a('0x4a')](_0x13bf77,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x530238){if(_0x530238[_0x641a('0x82')]){if(_0x530238[_0x641a('0x83')]===0x0){_0x530238[_0x641a('0x82')]=![];_0x530238[_0x641a('0x6e')]=utils[_0x641a('0x6f')][_0x641a('0x84')];loggerSyncQueueSummary[_0x641a('0x49')](_0x641a('0x85'),_0x530238['name'],_0x641a('0x86'));}else{_0x530238[_0x641a('0x6e')]=utils[_0x641a('0x6f')][_0x641a('0x87')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x530238['name'],_0x641a('0x88'));}emitCampaignSummary(_0x530238);}}function myreject(_0x506d54){return function(_0x2cee83){return _0x506d54(msgResponse(_0x641a('0x89'),_0x641a('0x8a'),JSON[_0x641a('0x77')](_0x2cee83)));};}Dialer[_0x641a('0x1b')]['isTrunkReachable']=function(_0x333580){return!_['isUndefined'](_0x333580)&&_0x333580&&!_[_0x641a('0x45')](_0x333580[_0x641a('0x4d')])&&!_[_0x641a('0x45')](_0x333580[_0x641a('0x8b')])&&_0x333580[_0x641a('0x8b')]&&(this[_0x641a('0x24')][util[_0x641a('0x4b')](_0x641a('0x8c'),_0x333580['name'])][_0x641a('0x8d')]===_0x641a('0x8e')||this[_0x641a('0x24')][util[_0x641a('0x4b')](_0x641a('0x8c'),_0x333580['name'])]['status']===_0x641a('0x8f'));};Dialer[_0x641a('0x1b')]['checkIsTrunkReachable']=function(_0x5ef9fa){var _0x5f1a61=this;return function(){if(!_0x5f1a61['isTrunkReachable'](_0x5ef9fa[_0x641a('0x90')])){if(!_0x5f1a61[_0x641a('0x91')](_0x5ef9fa[_0x641a('0x92')])){_0x5ef9fa[_0x641a('0x6e')]=utils['CAMPAIGN_STATUS'][_0x641a('0x93')];throw _0x5ef9fa[_0x641a('0x4d')]+_0x641a('0x94');}}};};Dialer['prototype'][_0x641a('0x95')]=function(_0x4398d3,_0x37ef53,_0x3d6c44,_0x193a89){var _0x4f5221=this;return function(){var _0x32efdc=!![];return _0x4f5221[_0x641a('0x96')](_0x4398d3,_0x37ef53,_0x3d6c44,_0x193a89,_0x32efdc);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x536580,_0x457035,_0x383cfc,_0x159206){var _0x2fdf2c=this;return function(){var _0x36cf7e=![];return _0x2fdf2c[_0x641a('0x96')](_0x536580[_0x641a('0x7a')],_0x457035,_0x383cfc,_0x159206,_0x36cf7e);};};Dialer[_0x641a('0x1b')][_0x641a('0x96')]=function(_0x3c41fd,_0x2dd860,_0x4eef68,_0x1c1786,_0x482445){var _0x22d7fd=[];return new Promise(function(_0x1181f1,_0x387438){if(!isNotNull(_0x3c41fd)){_0x1c1786[_0x641a('0x6e')]=utils['CAMPAIGN_STATUS'][_0x641a('0x7b')];return _0x387438(msgResponse(_0x641a('0x97'),_0x641a('0x98'),_0x4eef68+_0x641a('0x99')));}if(_[_0x641a('0x7c')](_0x3c41fd)){_0x1c1786['message']=utils['CAMPAIGN_STATUS'][_0x641a('0x9a')];return _0x387438(msgResponse('ifTime',_0x641a('0x98'),_0x4eef68+'\x20Intervals\x20is\x20empty\x20'));}if(_0x2dd860&&_[_0x641a('0x45')](config[_0x641a('0x9b')][_0x2dd860])){_0x1c1786['message']=utils[_0x641a('0x6f')][_0x641a('0x9c')];return _0x387438(msgResponse('ifTime',_0x641a('0x98'),_0x4eef68+_0x641a('0x9d')+_0x2dd860));}if(_[_0x641a('0x9e')](_0x3c41fd)){for(var _0x358140=0x0;_0x358140<_0x3c41fd[_0x641a('0x9f')];_0x358140+=0x1){_0x22d7fd[_0x641a('0xa0')](ami[_0x641a('0xa1')]({'action':_0x641a('0xa2'),'command':util['format'](_0x641a('0xa3'),_0x3c41fd[_0x358140]['interval'],!_[_0x641a('0x45')](config[_0x641a('0x9b')][_0x2dd860])?_0x2dd860:'')})[_0x641a('0x43')](function(_0x325549){return _0x325549[_0x641a('0xa4')]['indexOf'](_0x641a('0xa5'))>=0x0;})['catch'](myreject(_0x387438)));}}else{_0x22d7fd[_0x641a('0xa0')](ami['Action']({'action':_0x641a('0xa2'),'command':util[_0x641a('0x4b')](_0x641a('0xa3'),_0x3c41fd,!_[_0x641a('0x45')](config[_0x641a('0x9b')][_0x2dd860])?_0x2dd860:'')})['then'](function(_0x11f598){return _0x11f598[_0x641a('0xa4')]['indexOf']('true')>=0x0;})[_0x641a('0xa6')](myreject(_0x387438)));}Promise['all'](_0x22d7fd)[_0x641a('0x43')](function(_0x30291e){var _0x1336a8=_[_0x641a('0xa7')](_0x30291e);if(_0x1336a8){return _0x1181f1(_0x1336a8);}else{_0x1c1786[_0x641a('0x6e')]=_0x482445?utils[_0x641a('0x6f')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x641a('0xa8')];return _0x387438(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x482445+'\x20'+_0x4eef68+_0x641a('0xa9')+util[_0x641a('0x4a')](_0x3c41fd,{'showHidden':![],'depth':null})+_0x641a('0xaa')+_0x2dd860));}})[_0x641a('0xa6')](function(_0x18aca4){return _0x387438(msgResponse('ifTime',_0x641a('0x98'),JSON[_0x641a('0x77')](_0x18aca4)));});});};Dialer['prototype'][_0x641a('0xab')]=function(){var _0x35386e=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x641a('0x43')](function(){setInterval(function(){_0x35386e[_0x641a('0xac')]();},0x3e8);});};Dialer[_0x641a('0x1b')][_0x641a('0xac')]=function(){var _0x54ff16=this;var _0x55fb00;for(var _0x356a13 in this['campaigns']){if(typeof this[_0x641a('0x22')][_0x356a13]!=='undefined'){_0x55fb00=this['campaigns'][_0x356a13];if(utils['isIVRCampaign'](_0x55fb00)&&utils['isIVRCampaignActive'](_0x55fb00)){_0x55fb00['sendMessageOneNotActive']=!![];Promise[_0x641a('0xad')]()[_0x641a('0x43')](checkIsIVRCampaignActive(_0x55fb00))[_0x641a('0x43')](checkInterval(_0x55fb00))['then'](_0x54ff16[_0x641a('0xae')](_0x55fb00))[_0x641a('0x43')](_0x54ff16[_0x641a('0x95')](_0x55fb00[_0x641a('0xaf')],_0x55fb00[_0x641a('0xb0')],_0x55fb00['name'],_0x55fb00))[_0x641a('0x43')](_0x54ff16[_0x641a('0xb1')](_0x55fb00[_0x641a('0x7d')],_0x55fb00[_0x641a('0xb0')],_0x55fb00[_0x641a('0x4d')],_0x55fb00))[_0x641a('0x43')](_0x54ff16['launchHandleIvr'](_0x55fb00))['catch'](loggerCatchQueueSummary(_0x641a('0xb2'),_0x55fb00));}else{notSendMessagesCampaign(_0x55fb00);}}}};Dialer[_0x641a('0x1b')][_0x641a('0xb3')]=function(_0x399e6c){if(_0x399e6c[_0x641a('0xb4')]!==_0x641a('0xb5')){clearPredictiveAttributes(_0x399e6c);}switch(_0x399e6c['dialMethod']){case _0x641a('0xb6'):this[_0x641a('0xb7')](_0x399e6c,0x1);break;case _0x641a('0xb8'):this['handlePower'](_0x399e6c,_0x399e6c[_0x641a('0xb9')]);break;case _0x641a('0xb5'):this[_0x641a('0xb5')](_0x399e6c);break;case'booked':this['handlePower'](_0x399e6c,0x1);break;default:logger[_0x641a('0x6a')](_0x641a('0xba'),_0x399e6c[_0x641a('0x4d')],_0x641a('0xbb'));}};Dialer[_0x641a('0x1b')][_0x641a('0x97')]=function(_0x13dfa2,_0xbb9215){var _0x1f7947=_0x13dfa2[_0x641a('0xb0')];var _0x302570=_0xbb9215?_0x13dfa2['dialGlobalInterval']:_0x13dfa2[_0x641a('0x7d')][_0x641a('0x7a')];logger[_0x641a('0xbc')](_0x641a('0xbd'),_0x302570,_0x1f7947,_0x13dfa2[_0x641a('0x4d')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x13dfa2['name'],_0x13dfa2['id']));var _0x31697e=null;return Interval['intervalIftime'](_0x302570,_0x1f7947)['then'](function(_0xca2e16){if(_0xca2e16===!![]){return _0xca2e16;}else{_0x13dfa2['message']=_0xbb9215?utils[_0x641a('0x6f')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x641a('0x6f')][_0x641a('0xa8')];_0x31697e=msgResponse('[ifTime][promiseAll]',_0x641a('0x98'),_0x641a('0xbe')+_0xbb9215+'\x20'+_0x13dfa2['name']+_0x641a('0xa9')+util[_0x641a('0x4a')](_0x302570,{'showHidden':![],'depth':null})+_0x641a('0xaa')+_0x1f7947);}if(_0x31697e!==null){logger[_0x641a('0xbc')](_0x641a('0xbf'),_0x31697e);_0x31697e[_0x641a('0xc0')]=_0xbb9215;throw _0x31697e;}})['catch'](function(_0xa907f3){logger['error']('AMI\x20IfTime',_0xa907f3);throw msgResponse('[ifTime][Action]',_0x641a('0x8a'),util[_0x641a('0x4a')](_0xa907f3,{'showHidden':![],'depth':null}));});};Dialer[_0x641a('0x1b')][_0x641a('0x31')]=function(_0x5336bd){if(this[_0x641a('0x21')][_0x5336bd[_0x641a('0xc1')]]){if(this['uniqueId'][_0x5336bd[_0x641a('0xc2')]]&&this[_0x641a('0x28')][_0x5336bd['uniqueid']][_0x641a('0x47')]!==_0x641a('0xc3')){this[_0x641a('0xc4')](this[_0x641a('0x21')][_0x5336bd[_0x641a('0xc1')]]);this[_0x641a('0x28')][_0x5336bd['uniqueid']][_0x641a('0xc5')]=moment()['format'](_0x641a('0xc6'));}}};Dialer['prototype'][_0x641a('0x37')]=function(_0x265b18){var _0x53c0ca=this[_0x641a('0x28')][_0x265b18[_0x641a('0xc2')]];if(this[_0x641a('0x21')][_0x265b18[_0x641a('0xc1')]]){if(_0x53c0ca&&_0x53c0ca[_0x641a('0x47')]!==_0x641a('0xc3')){delete this['uniqueId'][_0x265b18[_0x641a('0xc2')]];this[_0x641a('0x21')][_0x265b18['queue']][_0x641a('0xc7')]+=0x1;var _0x45b987=new AgentComplete(_0x53c0ca,_0x265b18);if(_0x265b18[_0x641a('0xc8')]===_0x641a('0xc9')){_0x45b987['agiafterat']=this[_0x641a('0x21')][_0x265b18[_0x641a('0xc1')]][_0x641a('0xca')]&&this[_0x641a('0x21')][_0x265b18[_0x641a('0xc1')]][_0x641a('0xcb')]?moment()[_0x641a('0x4b')](_0x641a('0xc6')):undefined;}hopperUtils[_0x641a('0xcc')](_0x45b987)[_0x641a('0xa6')](loggerCatch(_0x641a('0xcd')));hopperUtils[_0x641a('0xce')](_0x45b987)[_0x641a('0xa6')](loggerCatch(_0x641a('0xcf')));}}};Dialer[_0x641a('0x1b')]['syncQueueCallerAbandon']=function(_0x98771d){var _0x2de56e=this[_0x641a('0x28')][_0x98771d[_0x641a('0xc2')]];var _0x4408e6=this;var _0x1dec5d=![];var _0x5171ae;var _0x16212f;if(this[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]]){if(_0x2de56e&&_0x2de56e[_0x641a('0x47')]!=='ivr'){delete this['uniqueId'][_0x98771d[_0x641a('0xc2')]];this[_0x641a('0xc4')](this[_0x641a('0x21')][_0x98771d['queue']]);_0x2de56e[_0x641a('0xd0')]=moment()[_0x641a('0x4b')](_0x641a('0xc6'));var _0xc91981=new QueueCallerAbandon(_0x2de56e,_0x98771d);if(utils[_0x641a('0x66')](_0x2de56e[_0x641a('0xd0')],_0x2de56e['responsetime'])>=_0x2de56e['dialQueueTimeout']){this[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x641a('0x21')][_0x98771d['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x98771d['queue']][_0x641a('0xd1')]+=0x1;_0xc91981[_0x641a('0xd2')]=0xa;_0xc91981[_0x641a('0x72')]='Drop';_0xc91981[_0x641a('0xd3')]=_0x641a('0xd4');_0xc91981['agiafterat']=this[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]][_0x641a('0xca')]?moment()['format'](_0x641a('0xc6')):undefined;_0xc91981[_0x641a('0xd5')]+=0x1;_0xc91981[_0x641a('0xd6')]+=0x1;_0x5171ae=this[_0x641a('0x21')][_0x98771d['queue']][_0x641a('0xd7')];_0x16212f=this['voiceQueues'][_0x98771d[_0x641a('0xc1')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x641a('0xd8')](_0xc91981,_0xc91981['state'],_0x2de56e[_0x641a('0xd9')])[_0x641a('0x43')](function(_0x70a18b){_0x1dec5d=_0x70a18b['additional']==0x1;if(_0xc91981['countdropretry']>=_0x4408e6['voiceQueues'][_0x98771d['queue']]['dialDropMaxRetry']){_0x4408e6['queueCallerAbandonCreateState'](_0xc91981,_0x70a18b[_0x641a('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xc91981[_0x641a('0xd5')],'scheduledat':moment()[_0x641a('0xdb')](_0x4408e6['voiceQueues'][_0x98771d[_0x641a('0xc1')]]['dialDropRetryFrequency'],'minutes')[_0x641a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2de56e[_0x641a('0xdc')],'ListId':_0x2de56e[_0x641a('0xdd')],'VoiceQueueId':_0x2de56e['VoiceQueueId']||undefined,'CampaignId':_0x2de56e[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0xdf')));var _0x5e2ac1=new History(_0xc91981);_0x5e2ac1[_0x641a('0xd2')]=0xa;_0x5e2ac1[_0x641a('0x72')]='Drop';_0x5e2ac1[_0x641a('0xe0')]=moment()['format'](_0x641a('0xc6'));_0x5e2ac1[_0x641a('0x73')]=_0x5e2ac1[_0x641a('0xe0')];_0x5e2ac1[_0x641a('0xe1')]=_0xc91981[_0x641a('0xe1')];_0x5e2ac1[_0x641a('0xe2')]=_0xc91981['calleridnum'];hopperUtils[_0x641a('0xcc')](_0x5e2ac1)[_0x641a('0xa6')](loggerCatch(_0x641a('0xe3')));}})[_0x641a('0x43')](function(){if(_0x1dec5d)hopperUtils[_0x641a('0xe4')](_0xc91981,_0x5171ae,_0x16212f)[_0x641a('0x43')](function(){return 0x1;});});}else{this['voiceQueues'][_0x98771d[_0x641a('0xc1')]][_0x641a('0xe5')]+=0x1;this[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]][_0x641a('0xe6')]+=0x1;_0xc91981[_0x641a('0xd2')]=0xb;_0xc91981[_0x641a('0x72')]=_0x641a('0xe7');_0xc91981[_0x641a('0xd3')]=_0x641a('0xe8');_0xc91981[_0x641a('0xe9')]+=0x1;_0xc91981[_0x641a('0xd6')]+=0x1;_0x5171ae=this[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]]['dialAbandonedRetryFrequency'];_0x16212f=this['voiceQueues'][_0x98771d[_0x641a('0xc1')]][_0x641a('0xea')];hopperUtils[_0x641a('0xd8')](_0xc91981,_0xc91981['state'],_0x2de56e[_0x641a('0xd9')])[_0x641a('0x43')](function(_0x5c4852){if(_0xc91981[_0x641a('0xe9')]>=_0x4408e6[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]]['dialAbandonedMaxRetry']){_0x4408e6[_0x641a('0xeb')](_0xc91981,_0x5c4852[_0x641a('0xda')]);}else{hopperUtils[_0x641a('0xec')]({'active':![],'countabandonedretry':_0xc91981['countabandonedretry'],'scheduledat':moment()[_0x641a('0xdb')](_0x4408e6[_0x641a('0x21')][_0x98771d[_0x641a('0xc1')]][_0x641a('0xed')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0x2de56e[_0x641a('0xdc')],'ListId':_0x2de56e[_0x641a('0xdd')],'VoiceQueueId':_0x2de56e[_0x641a('0xef')]||undefined,'CampaignId':_0x2de56e[_0x641a('0xde')]||undefined})['catch'](loggerCatch(_0x641a('0xf0')));var _0x11b336=new History(_0xc91981);_0x11b336[_0x641a('0xd2')]=0xb;_0x11b336[_0x641a('0x72')]=_0x641a('0xe7');_0x11b336['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x11b336[_0x641a('0x73')]=_0x11b336[_0x641a('0xe0')];_0x11b336[_0x641a('0xe1')]=_0xc91981['calleridname'];_0x11b336[_0x641a('0xe2')]=_0xc91981[_0x641a('0xe2')];hopperUtils['createHistory'](_0x11b336)[_0x641a('0xa6')](loggerCatch(_0x641a('0xf1')));}})['then'](function(){if(_0x1dec5d)hopperUtils[_0x641a('0xe4')](_0xc91981,_0x5171ae,_0x16212f)[_0x641a('0x43')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x641a('0xf2')]=function(_0x3a1f72){if(this[_0x641a('0x26')][_0x3a1f72[_0x641a('0xc2')]]){this[_0x641a('0x26')][_0x3a1f72['uniqueid']]['channel']=_0x3a1f72[_0x641a('0xf3')];}if(this['uniqueId'][_0x3a1f72[_0x641a('0xc2')]]){this['uniqueId'][_0x3a1f72['uniqueid']]['channel']=_0x3a1f72[_0x641a('0xf3')];}};Dialer['prototype']['syncQueueMember']=function(_0x3ad270){if(!this['actions'][_0x3ad270[_0x641a('0xf4')]]){return;}var _0x165f6c=this['voiceQueues'][this[_0x641a('0x26')][_0x3ad270['actionid']][_0x641a('0xc1')]][_0x641a('0xf5')]||_0x641a('0xf6');if(_0x165f6c===_0x641a('0xf7')){if(this[_0x641a('0x26')][_0x3ad270[_0x641a('0xf4')]]&&_[_0x641a('0xf8')](this['actions'][_0x3ad270[_0x641a('0xf4')]][_0x641a('0xf9')])&&_0x3ad270[_0x641a('0x8d')]==='1'&&_0x3ad270[_0x641a('0xfa')]==='0'){if(this[_0x641a('0x23')][_0x3ad270[_0x641a('0xfb')]]){if(!this[_0x641a('0x23')][_0x3ad270[_0x641a('0xfb')]][_0x641a('0xf9')]){this[_0x641a('0x23')][_0x3ad270[_0x641a('0xfb')]][_0x641a('0xf9')]=!![];this[_0x641a('0x26')][_0x3ad270['actionid']][_0x641a('0xf9')]=!![];this['actions'][_0x3ad270[_0x641a('0xf4')]][_0x641a('0xfb')]=_0x3ad270['stateinterface'];}}}}else if(_0x165f6c===_0x641a('0xf6')){if(this['actions'][_0x3ad270['actionid']]){if(this[_0x641a('0x23')][_0x3ad270[_0x641a('0xfb')]]){this[_0x641a('0x26')][_0x3ad270['actionid']]['stateinterface']=_0x3ad270[_0x641a('0xfb')];if(_[_0x641a('0xf8')](this[_0x641a('0x2d')][this[_0x641a('0x26')][_0x3ad270[_0x641a('0xf4')]]['queue']])){this['queueBooked'][this[_0x641a('0x26')][_0x3ad270['actionid']]['queue']]=[];}this[_0x641a('0x2d')][this[_0x641a('0x26')][_0x3ad270[_0x641a('0xf4')]][_0x641a('0xc1')]][_0x641a('0xa0')](_[_0x641a('0x65')](_['pick'](this['actions'][_0x3ad270['actionid']],[_0x641a('0xfc'),'stateinterface']),{'status':_0x3ad270[_0x641a('0x8d')],'paused':_0x3ad270['paused']}));}}}};Dialer[_0x641a('0x1b')][_0x641a('0x40')]=function(_0x46e7fd){if(!this['actions'][_0x46e7fd[_0x641a('0xf4')]]){return;}var _0xcd31dd=this;var _0x163b2c=this['voiceQueues'][this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]]['queue']];var _0x1a2ea3=_0x163b2c[_0x641a('0xf5')]||_0x641a('0xf6');if(_0x1a2ea3===_0x641a('0xf7')){if(this[_0x641a('0x26')][_0x46e7fd['actionid']]&&this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xfb')]){this[_0x641a('0x20')][_0x641a('0xfd')](this['actions'][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xfc')],this[_0x641a('0x26')][_0x46e7fd['actionid']][_0x641a('0xfb')])[_0x641a('0xa6')](function(_0x3a2fb2){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x641a('0x4a')](_0x3a2fb2,{'showHidden':![],'depth':null}));})[_0x641a('0x1e')](function(){_0xcd31dd[_0x641a('0xc4')](_0xcd31dd['voiceQueues'][_0xcd31dd[_0x641a('0x26')][_0x46e7fd['actionid']]['queue']]);_0xcd31dd['agents'][_0xcd31dd[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xfb')]]['locked']=![];delete _0xcd31dd['actions'][_0x46e7fd[_0x641a('0xf4')]];unlockQueueStatus(_0x163b2c);});}else{this['updateOriginated'](this[_0x641a('0x21')][this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]);hopperUtils[_0x641a('0xec')]({'active':![],'ContactId':this[_0x641a('0x26')][_0x46e7fd['actionid']][_0x641a('0xdc')],'ListId':this[_0x641a('0x26')][_0x46e7fd['actionid']]['ListId'],'VoiceQueueId':this['actions'][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xef')]||undefined,'CampaignId':this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0xfe')));delete this['actions'][_0x46e7fd[_0x641a('0xf4')]];unlockQueueStatus(_0x163b2c);}}else if(_0x1a2ea3===_0x641a('0xf6')){var _0x155e3c;if(this['actions'][_0x46e7fd[_0x641a('0xf4')]]&&!_[_0x641a('0x7c')](this[_0x641a('0x2d')][this[_0x641a('0x26')][_0x46e7fd['actionid']]['queue']])){if(this['queueBookedRR'][_0xcd31dd[_0x641a('0x26')][_0x46e7fd['actionid']][_0x641a('0xc1')]]){this[_0x641a('0x2e')][_0xcd31dd[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]=this[_0x641a('0x2e')][this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]?this['queueBookedRR'][this[_0x641a('0x26')][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]:this[_0x641a('0x2d')][this['actions'][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]?this[_0x641a('0x2d')][this['actions'][_0x46e7fd[_0x641a('0xf4')]][_0x641a('0xc1')]]['_rr']||0x0:0x0;}this[_0x641a('0x2d')][this['actions'][_0x46e7fd[_0x641a('0xf4')]]['queue']][_0x641a('0xff')]=this[_0x641a('0x2e')][this['actions'][_0x46e7fd[_0x641a('0xf4')]]['queue']];for(var _0x38f25a=0x0;_0x38f25a=_0x56a11c[_0x641a('0x122')]){_0x458b4b[_0x641a('0x123')](_0x33661d,_0x2444cf,_0xe8e1fa,_0x641a('0x124'));}else{if(_0x33661d[_0x641a('0x11d')]>=_0x56a11c['dialMachineMaxRetry']){_0x458b4b['createStateFinal'](_0x33661d,_0x2444cf,_0xe8e1fa,_0x641a('0x125'));}else{hopperUtils[_0x641a('0xec')]({'active':![],'countmachineretry':_0x33661d[_0x641a('0x11d')],'scheduledat':moment()['add'](_0x56a11c[_0x641a('0x126')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0x33661d[_0x641a('0xdc')],'ListId':_0x33661d[_0x641a('0xdd')],'VoiceQueueId':_0x33661d[_0x641a('0xef')]||undefined,'CampaignId':_0x33661d[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x127')));_0x2444cf({'reschedule':0x1});}}});}if(_0xe142f5['type']===_0x641a('0xc3')&&this[_0x641a('0x22')][_0xe142f5[_0x641a('0xc1')]][_0x641a('0x128')]&&_0x10a84d[_0x641a('0x112')]===_0x641a('0x129')){delete this[_0x641a('0x28')][_0x10a84d[_0x641a('0xc2')]];this['updateOriginated'](this['campaigns'][_0xe142f5[_0x641a('0xc1')]]);_0x596609=new Hangup(_0xe142f5,_0x10a84d);_0x596609[_0x641a('0xd2')]=0x12;_0x596609[_0x641a('0x72')]='HangupInAMD';_0x596609[_0x641a('0x11c')]=_0x641a('0x114');ami[_0x641a('0x46')](_0x641a('0x115'),ut['buildObj'](_0x596609,'amd'));this[_0x641a('0x118')](_0x596609,_0x641a('0x12a'),_0x641a('0x12b'));}if(_0xe142f5[_0x641a('0x47')]===_0x641a('0xc3')&&this['campaigns'][_0xe142f5[_0x641a('0xc1')]][_0x641a('0x128')]&&_0x10a84d['value']==='MACHINE'){return new Promise(function(_0x313561,_0x5c583b){delete _0x458b4b[_0x641a('0x28')][_0x10a84d['uniqueid']];_0x458b4b[_0x641a('0xc4')](_0x458b4b[_0x641a('0x22')][_0xe142f5[_0x641a('0xc1')]]);_0x458b4b[_0x641a('0x22')][_0xe142f5['queue']][_0x641a('0xc7')]+=0x1;_0x458b4b['campaigns'][_0xe142f5['queue']][_0x641a('0x11a')]+=0x1;var _0x59bb55=_0x458b4b[_0x641a('0x22')][_0xe142f5['queue']];var _0x522d4f=new Hangup(_0xe142f5,_0x10a84d);_0x522d4f[_0x641a('0xd2')]=0x13;_0x522d4f[_0x641a('0x72')]=_0x641a('0x11b');_0x522d4f[_0x641a('0x11c')]='AMD';_0x522d4f[_0x641a('0x11d')]+=0x1;_0x522d4f['countglobal']+=0x1;_0x522d4f[_0x641a('0x117')]=!![];ami[_0x641a('0x46')](_0x641a('0x115'),ut['buildObj'](_0x522d4f,'amd'));hopperUtils[_0x641a('0xcc')](_0x522d4f)[_0x641a('0xa6')](loggerCatch(_0x641a('0x12c')));if(_0x522d4f[_0x641a('0x11e')]+_0x522d4f[_0x641a('0x11f')]+_0x522d4f[_0x641a('0x120')]+_0x522d4f[_0x641a('0x12d')]+_0x522d4f[_0x641a('0xd5')]+_0x522d4f['countabandonedretry']+_0x522d4f[_0x641a('0x11d')]+_0x522d4f[_0x641a('0x121')]>=_0x59bb55['dialGlobalMaxRetry']){_0x458b4b['stateGlobal'](_0x522d4f,_0x313561,_0x5c583b,'reason19\x20machine....');}else{if(_0x522d4f['countmachineretry']>=_0x59bb55[_0x641a('0x12e')]){_0x458b4b[_0x641a('0x12f')](_0x522d4f,_0x313561,_0x5c583b,_0x641a('0x125'));}else{hopperUtils[_0x641a('0xec')]({'active':![],'countmachineretry':_0x522d4f[_0x641a('0x11d')],'scheduledat':moment()[_0x641a('0xdb')](_0x59bb55['dialMachineRetryFrequency'],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0x522d4f[_0x641a('0xdc')],'ListId':_0x522d4f[_0x641a('0xdd')],'VoiceQueueId':_0x522d4f[_0x641a('0xef')]||undefined,'CampaignId':_0x522d4f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x127')));_0x313561({'reschedule':0x1});}}});}}};Dialer[_0x641a('0x1b')][_0x641a('0x3b')]=function(_0x278e67){var _0x33a5f9=this[_0x641a('0x28')][_0x278e67[_0x641a('0xc2')]];var _0x51e5d3;if(_0x33a5f9&&_0x33a5f9['type']===_0x641a('0xc3')){delete this[_0x641a('0x28')][_0x278e67[_0x641a('0xc2')]];this[_0x641a('0xc4')](this[_0x641a('0x22')][_0x33a5f9[_0x641a('0xc1')]]);this[_0x641a('0x22')][_0x33a5f9['queue']]['ivrAnswerCallsDay']+=0x1;_0x51e5d3=new Hangup(_0x33a5f9,_0x278e67);hopperUtils['createHistory'](_0x51e5d3)[_0x641a('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x641a('0xce')](_0x51e5d3)[_0x641a('0xa6')](loggerCatch(_0x641a('0x130')));}if(_0x33a5f9&&_0x33a5f9[_0x641a('0x47')]!==_0x641a('0xc3')&&isNotNull(this['voiceQueues'][_0x33a5f9[_0x641a('0xc1')]][_0x641a('0x131')])){delete this[_0x641a('0x28')][_0x278e67[_0x641a('0xc2')]];this['updateOriginated'](this['voiceQueues'][_0x33a5f9[_0x641a('0xc1')]]);this[_0x641a('0x21')][_0x33a5f9[_0x641a('0xc1')]]['outboundAnswerCallsDay']+=0x1;this[_0x641a('0x21')][_0x33a5f9[_0x641a('0xc1')]][_0x641a('0x11a')]+=0x1;_0x51e5d3=new Hangup(_0x33a5f9,_0x278e67);_0x51e5d3[_0x641a('0xd2')]=0x10;_0x51e5d3['statedesc']=_0x641a('0x132');_0x51e5d3[_0x641a('0x11c')]=_0x641a('0x133');hopperUtils['createHistory'](_0x51e5d3)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x51e5d3)[_0x641a('0xa6')](loggerCatch('[syncHangupIvr]'));}if(_0x33a5f9&&_0x33a5f9[_0x641a('0x47')]!==_0x641a('0xc3')&&!isNotNull(this['voiceQueues'][_0x33a5f9[_0x641a('0xc1')]][_0x641a('0x131')])){delete this[_0x641a('0x28')][_0x278e67[_0x641a('0xc2')]];this[_0x641a('0xc4')](this[_0x641a('0x21')][_0x33a5f9[_0x641a('0xc1')]]);this[_0x641a('0x21')][_0x33a5f9[_0x641a('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x51e5d3=new Hangup(_0x33a5f9,_0x278e67);_0x51e5d3[_0x641a('0xd2')]=0xc;_0x51e5d3[_0x641a('0x72')]=_0x278e67[_0x641a('0x134')];_0x51e5d3[_0x641a('0x11c')]=_0x641a('0x135');hopperUtils['createHistory'](_0x51e5d3)[_0x641a('0xa6')](loggerCatch(_0x641a('0x136')));hopperUtils[_0x641a('0xce')](_0x51e5d3)['catch'](loggerCatch(_0x641a('0x130')));}};Dialer[_0x641a('0x1b')][_0x641a('0xb')]=function(_0xa36029){var _0x1fdd7d=this;if(!_0x1fdd7d[_0x641a('0x2f')][_0xa36029['name']]){_0x1fdd7d[_0x641a('0x2f')][_0xa36029['name']]={'running':![]};}else if(_0x1fdd7d[_0x641a('0x2f')][_0xa36029[_0x641a('0x4d')]][_0x641a('0x137')]===!![]){return;}else if(_0x1fdd7d[_0x641a('0x2f')][_0xa36029[_0x641a('0x4d')]]['running']===![]){_0x1fdd7d[_0x641a('0x2f')][_0xa36029[_0x641a('0x4d')]]['running']=!![];}var _0x2f926b=_0x1fdd7d[_0x641a('0x21')][_0xa36029[_0x641a('0x4d')]];var _0x585a21=_0x2f926b[_0x641a('0x6e')]!==utils[_0x641a('0x6f')][_0x641a('0x84')];var _0x143638=utils[_0x641a('0x138')](_0x2f926b);_0x2f926b[_0x641a('0x139')]=utils[_0x641a('0x13a')](_0x2f926b,_0x1fdd7d[_0x641a('0x24')]);Promise[_0x641a('0xad')]()[_0x641a('0x43')](function(){if(_0x2f926b[_0x641a('0x139')]===utils['CAMPAIGN_STATUS'][_0x641a('0x84')]){if(_0x585a21){clearPredictiveAttributes(_0x2f926b);_0xa36029[_0x641a('0x2a')]=undefined;_0xa36029['startProgressive']=undefined;}if(_0x2f926b[_0x641a('0x139')]===utils['CAMPAIGN_STATUS'][_0x641a('0x84')]){_0xa36029['available']=0x0;_0xa36029[_0x641a('0xfa')]=0x0;_0xa36029[_0x641a('0x13b')]=0x0;_0xa36029['talking']=0x0;_0xa36029[_0x641a('0x13c')]=0x0;}}else if(_0x2f926b['statusMessage']===utils[_0x641a('0x6f')][_0x641a('0x13d')]&&!_0x143638){return _0x1fdd7d[_0x641a('0x97')](_0x2f926b,!![])[_0x641a('0x43')](function(){return _0x1fdd7d[_0x641a('0x97')](_0x2f926b,![]);})[_0x641a('0x43')](function(){return _0x1fdd7d[_0x641a('0xb3')](_0x2f926b);})[_0x641a('0xa6')](function(_0x48d0bd){loggerSyncQueueSummary[_0x641a('0x49')](_0x641a('0x13e'),util[_0x641a('0x4a')](_0x48d0bd,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2f926b);});}else{clearPredictiveAttributes(_0x2f926b);}})[_0x641a('0x43')](function(){var _0x50cfd0=_0xa36029[_0x641a('0x13f')](_0x2f926b);if(_0x50cfd0||_0x2f926b[_0x641a('0x140')]){_0x2f926b[_0x641a('0x140')]=![];_0xa36029[_0x641a('0x141')](_0x2f926b);Object[_0x641a('0x142')](_0x2f926b,_0xa36029);emitOutboundVoiceQueueSummary(_0xa36029);}_0x1fdd7d[_0x641a('0x2f')][_0x2f926b[_0x641a('0x4d')]][_0x641a('0x137')]=![];})['catch'](function(_0x417109){logger[_0x641a('0x6a')](_0x641a('0x13e'),util['inspect'](_0x417109,{'showHidden':![],'depth':null}));_0x1fdd7d[_0x641a('0x2f')][_0x2f926b[_0x641a('0x4d')]][_0x641a('0x137')]=![];});};Dialer[_0x641a('0x1b')][_0x641a('0x3a')]=_[_0x641a('0x143')](function(){var _0x1d6c45=_[_0x641a('0x144')](this['voiceQueues'],function(_0x472356){return _0x472356[_0x641a('0x145')];});var _0x2437e5=_[_0x641a('0x144')](this[_0x641a('0x23')],function(_0xdc6edf){return _0xdc6edf[_0x641a('0x146')]&&_0xdc6edf[_0x641a('0x8d')]==='reachable';});if(_0x1d6c45['length']>0x0&&_0x2437e5[_0x641a('0x9f')]>0x0){return Promise[_0x641a('0xad')]()['then'](cmHopper[_0x641a('0x147')](_[_0x641a('0x148')](_0x1d6c45,'id'),previewRecallmeReminderInterval,_[_0x641a('0x148')](_0x2437e5,'id')))['then'](function(_0x1a8de3){for(var _0x2c5262=0x0;_0x2c5262<_0x1a8de3['length'];_0x2c5262++){var _0x56601f=_0x1a8de3[_0x2c5262][_0x641a('0x149')][_0x641a('0x4d')];if(_0x56601f)io['to'](util[_0x641a('0x4b')]('user:%s',_0x56601f))['emit'](_0x641a('0x14a'),{'hopper':_0x1a8de3[_0x2c5262]});}})[_0x641a('0xa6')](function(_0x558286){logger[_0x641a('0x6a')]('checkPreviewRecallReminder',_0x558286);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x641a('0x41')]=function(){var _0x2d8f86=this;setInterval(function(){_0x2d8f86[_0x641a('0x14b')](_0x2d8f86[_0x641a('0x28')],_0x641a('0x14c'));_0x2d8f86[_0x641a('0x14b')](_0x2d8f86['actions'],_0x641a('0x14d'));},0x32c8);};Dialer[_0x641a('0x1b')]['clearZombieChannels']=function(_0x5ee6ec,_0x4eb3fa){var _0x192c37=this;for(var _0x2e6419 in _0x5ee6ec){if(typeof _0x5ee6ec[_0x2e6419]!=='undefined'){this['sequence'][_0x641a('0x1c')](function(){if(!_[_0x641a('0xf8')](_0x5ee6ec[_0x2e6419])){return ami[_0x641a('0xa1')]({'action':_0x641a('0x8d'),'channel':_0x5ee6ec[_0x2e6419]['channel']})[_0x641a('0xa6')](function(_0x4ca0f7){if(_0x4ca0f7[_0x641a('0x6e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5ee6ec[_0x2e6419]&&_0x5ee6ec[_0x2e6419][_0x641a('0x47')]!==_0x641a('0xc3')){_0x192c37[_0x641a('0xc4')](_0x192c37[_0x641a('0x21')][_0x5ee6ec[_0x2e6419]['queue']]);logger[_0x641a('0x6a')](_0x641a('0x14e'),_0x4eb3fa,_0x2e6419,_0x5ee6ec[_0x2e6419][_0x641a('0xc1')]);delete _0x5ee6ec[_0x2e6419];}if(_0x5ee6ec[_0x2e6419]&&_0x5ee6ec[_0x2e6419][_0x641a('0x47')]==='ivr'){_0x192c37[_0x641a('0xc4')](_0x192c37['campaigns'][_0x5ee6ec[_0x2e6419][_0x641a('0xc1')]]);logger[_0x641a('0x6a')](_0x641a('0x14f'),_0x4eb3fa,_0x2e6419,_0x5ee6ec[_0x2e6419]['queue']);delete _0x5ee6ec[_0x2e6419];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x55c244){return Promise[_0x641a('0xad')]()['then'](voiceQueueRt[_0x641a('0x150')](_0x55c244))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x641a('0x1b')][_0x641a('0xc4')]=function(_0x4fd80f){if(!_[_0x641a('0x45')](_0x4fd80f)&&_0x4fd80f!==null){if(typeof _0x4fd80f[_0x641a('0x83')]!==_0x641a('0x151')){if(_0x4fd80f[_0x641a('0x83')]>0x0){_0x4fd80f[_0x641a('0x83')]-=0x1;}else{logger[_0x641a('0x6a')](_0x641a('0x152'));}}}else{logger[_0x641a('0x6a')](_0x641a('0x153'));}};Dialer[_0x641a('0x1b')][_0x641a('0x154')]=function(_0x1dcfe2,_0xe15884){var _0x5582d1=this;return function(_0x4348e1){_0x5582d1['updateOriginated'](_0xe15884);logger['error'](_0x1dcfe2,util[_0x641a('0x4a')](_0x4348e1,{'showHidden':![],'depth':null}));};};Dialer[_0x641a('0x1b')][_0x641a('0x155')]=function(_0x248537,_0x374f38,_0x233058){var _0x442a41={'state':0x19,'statedesc':_0x641a('0x156')};this[_0x641a('0xc4')](_0x374f38);this[_0x641a('0x118')](_[_0x641a('0x65')](_0x442a41,_[_0x641a('0x78')](_0x233058,[_0x641a('0xdc'),_0x641a('0xdd'),_0x641a('0x157'),_0x641a('0xef'),'CampaignId'])),_0x641a('0x158'),_0x641a('0x159'));logger[_0x641a('0x6a')](_0x248537);};Dialer[_0x641a('0x1b')][_0x641a('0x118')]=function(_0x448c75,_0x1a53a8,_0x3720ae){hopperUtils[_0x641a('0xcc')](_0x448c75)['catch'](loggerCatch(_0x1a53a8));hopperUtils['moveContactManagedDialer'](_0x448c75)[_0x641a('0xa6')](loggerCatch(_0x3720ae));};Dialer['prototype'][_0x641a('0xeb')]=function(_0xe2b641,_0x2c375f){hopperUtils[_0x641a('0xcc')](_0xe2b641)[_0x641a('0xa6')](loggerCatch(_0x641a('0xcd')));if(_0x2c375f==0x0){hopperUtils[_0x641a('0xce')](_0xe2b641)[_0x641a('0xa6')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x641a('0x1b')]['checkPreviewRecallReminder']=function(_0x1efdcf){return Promise[_0x641a('0xad')]()[_0x641a('0x43')](cmHopper['handlePreviewRecallNotifications'](_0x1efdcf['id'],previewRecallmeReminderInterval))[_0x641a('0x43')](function(_0x45cdb8){for(var _0x28a1d9=0x0;_0x28a1d9<_0x45cdb8[_0x641a('0x9f')];_0x28a1d9++){var _0xc14013=_0x45cdb8[_0x28a1d9][_0x641a('0x149')][_0x641a('0x4d')];if(_0xc14013)io['to'](util['format']('user:%s',_0xc14013))['emit'](_0x641a('0x14a'),{'hopper':_0x45cdb8[_0x28a1d9]});}})[_0x641a('0xa6')](function(){});};Dialer[_0x641a('0x1b')][_0x641a('0x15a')]=function(_0x26ccc7){var _0x1cb241=this;return function(){_0x1cb241[_0x641a('0x15b')](_0x26ccc7);};};Dialer[_0x641a('0x1b')][_0x641a('0x15c')]=function(_0x4af287,_0x3ae2da){var _0x3427a7=this;var _0x128167=uuid['v4']();this[_0x641a('0x26')][_0x128167]=new Action(_0x4af287,_0x3ae2da,_0x128167);return new Promise(function(_0x4b8255,_0x5eeaff){if(_[_0x641a('0x45')](_0x4af287)&&typeof _0x4af287!=='object'){return _0x5eeaff(msgResponse(_0x641a('0x15d'),_0x641a('0x98'),_0x641a('0x15e')));}if(_[_0x641a('0x45')](_0x3ae2da['phone'])||_0x3ae2da['phone']===null){return _0x5eeaff(msgResponse('originate',_0x641a('0x98'),_0x641a('0x15f')));}var _0x21e702={'XMD-CALLERID':_0x3427a7['actions'][_0x128167][_0x641a('0x160')](),'XMD-AGI':_0x4af287[_0x641a('0x131')]?util[_0x641a('0x4b')](_0x641a('0x161'),ipAgi,_0x4af287[_0x641a('0x131')]):_0x641a('0x162'),'XMD-AGIAFTER':_0x4af287[_0x641a('0xca')]?util[_0x641a('0x4b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4af287[_0x641a('0xca')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x4af287)?util[_0x641a('0x4b')]('\x22%s,%s%s,,,%s\x22',_0x4af287[_0x641a('0x4d')],_0x4af287[_0x641a('0x163')]||'',_0x4af287[_0x641a('0xcb')]?'c':'',_0x4af287['dialQueueTimeout']||0x3):_0x641a('0x162'),'XMD-CONTACTID':_0x3ae2da[_0x641a('0xdc')],'XMD-CDRTYPE':_0x641a('0x8'),'CALLERID(all)':_0x3427a7[_0x641a('0x26')][_0x128167][_0x641a('0x160')](),'XMD-AMD':_0x4af287[_0x641a('0x128')]?_0x641a('0x13d'):_0x641a('0x162'),'XMD-DESTINATION':_0x641a('0x164')};if(_0x4af287[_0x641a('0x128')]){_0x21e702[_0x641a('0x165')]=_0x4af287[_0x641a('0x166')]||0x9c4;_0x21e702[_0x641a('0x167')]=_0x4af287[_0x641a('0x168')]||0x5dc;_0x21e702[_0x641a('0x169')]=_0x4af287[_0x641a('0x16a')]||0x320;_0x21e702[_0x641a('0x16b')]=_0x4af287['dialAMDTotalAnalysisTime']||0x1388;_0x21e702[_0x641a('0x16c')]=_0x4af287[_0x641a('0x16d')]||0x64;_0x21e702[_0x641a('0x16e')]=_0x4af287[_0x641a('0x16f')]||0x32;_0x21e702[_0x641a('0x170')]=_0x4af287[_0x641a('0x171')]||0x3;_0x21e702[_0x641a('0x172')]=_0x4af287[_0x641a('0x173')]||0x100;_0x21e702[_0x641a('0x174')]=_0x4af287[_0x641a('0x175')]||0x1388;}if(utils[_0x641a('0x176')](_0x4af287)){_0x21e702[_0x641a('0x177')]=_0x3ae2da[_0x641a('0xef')];}else{_0x21e702[_0x641a('0x178')]=_0x3ae2da[_0x641a('0xde')];}for(var _0xf947fd in _0x3ae2da['Contact']){if(typeof _0x3ae2da[_0x641a('0x179')][_0xf947fd]!==_0x641a('0x151')){if(isNotNull(_0x3ae2da[_0x641a('0x179')][_0xf947fd])&&_0xf947fd!=='id'&&_0xf947fd!==_0x641a('0x17a')&&_0xf947fd!==_0x641a('0x17b')&&_0xf947fd!==_0x641a('0x17c')){_0x21e702[util[_0x641a('0x4b')](_0x641a('0x17d'),_0x641a('0x17e'),_[_0x641a('0x17f')](_0xf947fd))]=_0x3ae2da[_0x641a('0x179')][_0xf947fd];}}}var _0xff93b1=_0x3427a7['isTrunkReachable'](_0x4af287['Trunk'])?utils[_0x641a('0x180')](_0x4af287['Trunk'][_0x641a('0x181')],_0x4af287[_0x641a('0x182')],_0x4af287[_0x641a('0x183')]>0x0?utils[_0x641a('0x184')](_0x4af287['dialOriginateCallerIdNumber'],_0x4af287[_0x641a('0x183')]):_0x4af287[_0x641a('0x185')]):utils[_0x641a('0x180')](_[_0x641a('0xf8')](_0x4af287['TrunkBackup'])?_0x4af287[_0x641a('0x90')][_0x641a('0x181')]:_0x4af287[_0x641a('0x92')][_0x641a('0x181')],_0x4af287[_0x641a('0x182')],_0x4af287[_0x641a('0x183')]>0x0?utils[_0x641a('0x184')](_0x4af287['dialOriginateCallerIdNumber'],_0x4af287['dialRandomLastDigitCallerIdNumber']):_0x4af287[_0x641a('0x185')]);if(_0xff93b1){_0x21e702[_0x641a('0x186')]=_0x3427a7[_0x641a('0x26')][_0x128167][_0x641a('0x187')]=utils[_0x641a('0x188')](_0xff93b1);_0x21e702[_0x641a('0x189')]=_0x3ae2da[_0x641a('0x18a')];}_0x4af287['variables']=_0x21e702;return ami[_0x641a('0xa1')]({'actionid':_0x128167,'action':_0x641a('0x15d'),'channel':_0x3427a7['isTrunkReachable'](_0x4af287[_0x641a('0x90')])?util[_0x641a('0x4b')]('SIP/%s/%s%s',_0x4af287[_0x641a('0x90')]['name'],isNotNull(_0x4af287[_0x641a('0x18b')])?_0x4af287[_0x641a('0x18b')]['trim']()||'':'',_0x4af287[_0x641a('0x18c')]>0x0?_0x3ae2da['phone']['substring'](_0x4af287[_0x641a('0x18c')]):_0x3ae2da[_0x641a('0x18a')]):util[_0x641a('0x4b')](_0x641a('0x18d'),_['isNil'](_0x4af287[_0x641a('0x92')])?_0x4af287[_0x641a('0x90')][_0x641a('0x4d')]:_0x4af287['TrunkBackup']['name'],isNotNull(_0x4af287[_0x641a('0x18b')])?_0x4af287[_0x641a('0x18b')][_0x641a('0x18e')]()||'':'',_0x4af287['dialCutDigit']>0x0?_0x3ae2da[_0x641a('0x18a')][_0x641a('0x18f')](_0x4af287[_0x641a('0x18c')]):_0x3ae2da[_0x641a('0x18a')]),'callerid':_0xff93b1,'Exten':_0x641a('0x164'),'Context':_0x641a('0x190'),'Priority':'1','variable':_0x21e702,'timeout':(_0x4af287['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x128167})['then'](function(_0x1e4e7e){return _0x4b8255(_0x1e4e7e);})[_0x641a('0xa6')](function(_0x47b8f9){_0x4af287[_0x641a('0x191')]+=0x1;var _0x89a3e5=new History(_0x3427a7[_0x641a('0x26')][_0x128167]);logger['error'](util[_0x641a('0x4b')](_0x641a('0x192'),JSON['stringify'](_0x47b8f9)));_0x89a3e5['state']=0xe;_0x89a3e5[_0x641a('0x72')]=_0x641a('0x193');_0x89a3e5['starttime']=moment()[_0x641a('0x4b')](_0x641a('0xc6'));_0x89a3e5[_0x641a('0x73')]=_0x89a3e5[_0x641a('0xe0')];hopperUtils[_0x641a('0xcc')](_0x89a3e5)['catch'](loggerCatch(_0x641a('0x194')));_0x3427a7[_0x641a('0xce')](_0x89a3e5)['catch'](loggerCatch(_0x641a('0x194')))[_0x641a('0x1e')](function(){delete _0x3427a7['actions'][_0x128167];return _0x5eeaff(msgResponse('originate',_0x641a('0x8a'),'originate\x20action\x20Error'));});});});};Dialer[_0x641a('0x1b')][_0x641a('0x195')]=function(_0xb2d119,_0x4a1f79,_0x138b2e){var _0xd5be0f=new History(_0x4a1f79);if(_0xd5be0f['countbusyretry']+_0xd5be0f[_0x641a('0x11f')]+_0xd5be0f[_0x641a('0x120')]+_0xd5be0f[_0x641a('0x12d')]+_0xd5be0f[_0x641a('0xd5')]+_0xd5be0f[_0x641a('0xe9')]+_0xd5be0f[_0x641a('0x11d')]+_0xd5be0f['countagentrejectretry']>=_0x138b2e[_0x641a('0x122')]-0x1){return!![];}switch(_0xb2d119){case 0x3:if(_0xd5be0f[_0x641a('0x120')]>=_0x138b2e['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xd5be0f['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x138b2e[_0x641a('0x196')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x197')));break;case 0x5:if(_0xd5be0f[_0x641a('0x11e')]>=_0x138b2e['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x641a('0xec')]({'active':![],'countbusyretry':_0xd5be0f[_0x641a('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x138b2e['dialBusyRetryFrequency'],_0x641a('0xee'))['format'](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f['VoiceQueueId']||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x198')));break;case 0x8:if(_0xd5be0f[_0x641a('0x11f')]>=_0x138b2e[_0x641a('0x199')]-0x1){return!![];}hopperUtils[_0x641a('0xec')]({'active':![],'countcongestionretry':_0xd5be0f[_0x641a('0x11f')]+=0x1,'scheduledat':moment()[_0x641a('0xdb')](_0x138b2e[_0x641a('0x19a')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0xd5be0f['ContactId'],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f['VoiceQueueId']||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x19b')));break;case 0x0:if(_0xd5be0f[_0x641a('0x12d')]>=_0x138b2e[_0x641a('0x19c')]-0x1){return!![];}else{hopperUtils[_0x641a('0xec')]({'active':![],'countnosuchnumberretry':_0xd5be0f[_0x641a('0x12d')]+=0x1,'scheduledat':moment()['add'](_0x138b2e[_0x641a('0x19d')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f['CampaignId']||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x19e')));}break;case 0xa:if(_0xd5be0f[_0x641a('0xd5')]>=_0x138b2e[_0x641a('0x19f')]-0x1){return!![];}hopperUtils[_0x641a('0xec')]({'active':![],'countdropretry':_0xd5be0f[_0x641a('0xd5')]+=0x1,'scheduledat':moment()[_0x641a('0xdb')](_0x138b2e[_0x641a('0xd7')],'minutes')['format'](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xd5be0f[_0x641a('0xe9')]>=_0x138b2e[_0x641a('0x1a0')]-0x1){return!![];}hopperUtils[_0x641a('0xec')]({'active':![],'countabandonedretry':_0xd5be0f[_0x641a('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x138b2e[_0x641a('0xed')],_0x641a('0xee'))[_0x641a('0x4b')](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})['catch'](loggerCatch(_0x641a('0xf0')));break;case 0x13:if(_0xd5be0f[_0x641a('0x11d')]>=_0x138b2e[_0x641a('0x12e')]-0x1){return!![];}hopperUtils[_0x641a('0xec')]({'active':![],'countmachineretry':_0xd5be0f[_0x641a('0x11d')]+=0x1,'scheduledat':moment()[_0x641a('0xdb')](_0x138b2e['dialMachineRetryFrequency'],_0x641a('0xee'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f['ListId'],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xd5be0f[_0x641a('0x121')]>=_0x138b2e[_0x641a('0x1a1')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xd5be0f[_0x641a('0x121')]+=0x1,'scheduledat':moment()['add'](_0x138b2e['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x641a('0xc6')),'ContactId':_0xd5be0f[_0x641a('0xdc')],'ListId':_0xd5be0f[_0x641a('0xdd')],'VoiceQueueId':_0xd5be0f[_0x641a('0xef')]||undefined,'CampaignId':_0xd5be0f[_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x1a2')));break;default:return!![];}};Dialer['prototype'][_0x641a('0x10d')]=function(_0x283a65,_0x5b44d9,_0x561471){var _0x602d3e=this;var _0x49162b=new History(_0x283a65);var _0x4b1a27=![];var _0x57131d;var _0x33dbd7;return new Promise(function(_0x203d55,_0x5bd4a3){if(_[_0x641a('0x45')](_0x5b44d9)&&typeof _0x5b44d9!==_0x641a('0x1a3')){return _0x5bd4a3(msgResponse('[callProgressDetecting]',_0x641a('0x98'),_0x641a('0x1a4')));}if(_[_0x641a('0x45')](_0x561471)&&typeof _0x561471!==_0x641a('0x1a3')){return _0x5bd4a3(msgResponse(_0x641a('0x1a5'),'Failure',_0x641a('0x1a6')));}hopperUtils[_0x641a('0xd8')](_0x49162b,_0x561471['reason'],_0x5b44d9)['then'](function(_0x164ac8){if(_0x164ac8['additional']==0x1)_0x4b1a27=!![];switch(_0x561471['reason']){case'0':_0x5b44d9[_0x641a('0x1a7')]+=0x1;_0x49162b[_0x641a('0xd2')]=0x0;_0x49162b[_0x641a('0x72')]=_0x641a('0x1a8');_0x49162b['countnosuchnumberretry']+=0x1;_0x49162b[_0x641a('0xd6')]+=0x1;ami[_0x641a('0x46')](_0x641a('0x1a9'),ut[_0x641a('0x116')](_0x283a65,_0x641a('0x1aa')));_0x57131d=_0x5b44d9['dialNoSuchNumberRetryFrequency'];_0x33dbd7=_0x5b44d9[_0x641a('0xea')];hopperUtils[_0x641a('0xcc')](_0x49162b)[_0x641a('0xa6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x602d3e[_0x641a('0x195')](0x0,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b[_0x641a('0x12d')]>=_0x5b44d9[_0x641a('0x19c')]){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1ab'));}else{_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1ab'));}}break;case'3':_0x5b44d9[_0x641a('0x1ac')]+=0x1;_0x49162b['state']=0x3;_0x49162b[_0x641a('0x72')]=_0x641a('0x1ad');_0x49162b[_0x641a('0x120')]+=0x1;_0x49162b['countglobal']+=0x1;var _0x45eecd=ut[_0x641a('0x1ae')](_0x283a65,_0x5b44d9);ami[_0x641a('0x46')](_0x641a('0x1af'),_0x45eecd);_0x57131d=_0x5b44d9['dialNoAnswerRetryFrequency'];_0x33dbd7=_0x5b44d9[_0x641a('0xea')];hopperUtils['createHistory'](_0x49162b)[_0x641a('0xa6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x602d3e['checkRetriveMax'](0x3,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b['countnoanswerretry']>=_0x5b44d9[_0x641a('0x1b0')]){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1b1'));}else{_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1b1'));}}break;case'5':_0x5b44d9[_0x641a('0x1b2')]+=0x1;_0x49162b[_0x641a('0xd2')]=0x5;_0x49162b[_0x641a('0x72')]=_0x641a('0x1b3');_0x49162b[_0x641a('0x11e')]+=0x1;_0x49162b['countglobal']+=0x1;ami[_0x641a('0x46')](_0x641a('0x1b4'),ut[_0x641a('0x116')](_0x283a65,_0x641a('0x1b5')));_0x57131d=_0x5b44d9[_0x641a('0x1b6')];_0x33dbd7=_0x5b44d9['callAdditionalPhoneAfterMin'];hopperUtils[_0x641a('0xcc')](_0x49162b)[_0x641a('0xa6')](loggerCatch(_0x641a('0x1b7')));if(_0x602d3e[_0x641a('0x195')](0x5,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b[_0x641a('0x11e')]>=_0x5b44d9['dialBusyMaxRetry']){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1b8'));}else{_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1b8'));}}break;case'8':_0x5b44d9[_0x641a('0x1b9')]+=0x1;_0x49162b[_0x641a('0xd2')]=0x8;_0x49162b[_0x641a('0x72')]=_0x641a('0x1ba');_0x49162b[_0x641a('0x11f')]+=0x1;_0x49162b[_0x641a('0xd6')]+=0x1;_0x57131d=_0x5b44d9[_0x641a('0x19a')];_0x33dbd7=_0x5b44d9['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x641a('0x116')](_0x283a65,_0x641a('0x1bb')));hopperUtils[_0x641a('0xcc')](_0x49162b)['catch'](loggerCatch(_0x641a('0x1bc')));if(_0x602d3e['checkRetriveMax'](0x8,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b['countcongestionretry']>=_0x5b44d9[_0x641a('0x199')]){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1bd'));}else{_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,'reason\x208\x20congestion');}}break;case'11':_0x5b44d9['outboundAbandonedCallsDay']+=0x1;_0x49162b[_0x641a('0xd2')]=0xb;_0x49162b[_0x641a('0x72')]=_0x641a('0xe7');_0x49162b[_0x641a('0xe9')]+=0x1;_0x49162b[_0x641a('0xd6')]+=0x1;_0x57131d=_0x5b44d9[_0x641a('0xed')];_0x33dbd7=_0x5b44d9[_0x641a('0xea')];hopperUtils['createHistory'](_0x49162b)[_0x641a('0xa6')](loggerCatch(_0x641a('0xf1')));if(_0x602d3e[_0x641a('0x195')](0xb,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b['countabandonedretry']>=_0x5b44d9['dialAbandonedMaxRetry']){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1be'));}else{_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1be'));}}break;case'20':_0x5b44d9[_0x641a('0x1bf')]+=0x1;_0x49162b['state']=0x14;_0x49162b[_0x641a('0x72')]=_0x641a('0x1c0');_0x49162b['countagentrejectretry']+=0x1;_0x49162b[_0x641a('0xd6')]+=0x1;_0x57131d=_0x5b44d9[_0x641a('0x1c1')];_0x33dbd7=_0x5b44d9[_0x641a('0xea')];ami[_0x641a('0x46')](_0x641a('0x1c2'),ut[_0x641a('0x116')](_0x283a65,'agentreject'));hopperUtils[_0x641a('0xcc')](_0x49162b)[_0x641a('0xa6')](loggerCatch(_0x641a('0x1c3')));if(_0x602d3e['checkRetriveMax'](0x14,_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b[_0x641a('0x121')]>=_0x5b44d9['dialAgentRejectMaxRetry']){_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1c4'));}else{_0x602d3e['stateGlobal'](_0x49162b,_0x203d55,_0x5bd4a3,_0x641a('0x1c4'));}}break;default:_0x5b44d9[_0x641a('0x1c5')]+=0x1;_0x49162b[_0x641a('0xd2')]=0xc;_0x49162b[_0x641a('0x72')]=_0x561471[_0x641a('0xc8')];_0x57131d=_0x5b44d9['dialAgentRejectRetryFrequency'];_0x33dbd7=_0x5b44d9[_0x641a('0xea')];hopperUtils[_0x641a('0xcc')](_0x49162b)[_0x641a('0xa6')](loggerCatch(_0x641a('0x1c6')));if(_0x602d3e[_0x641a('0x195')](_0x561471[_0x641a('0xc8')],_0x283a65,_0x5b44d9)&&!_0x4b1a27){if(_0x49162b['countbusyretry']+_0x49162b['countcongestionretry']+_0x49162b[_0x641a('0x120')]+_0x49162b[_0x641a('0x12d')]+_0x49162b['countdropretry']+_0x49162b[_0x641a('0xe9')]+_0x49162b['countmachineretry']+_0x49162b[_0x641a('0x121')]>=_0x5b44d9[_0x641a('0x122')]){_0x602d3e[_0x641a('0x123')](_0x49162b,_0x203d55,_0x5bd4a3,_0x561471[_0x641a('0xc8')]);}else{_0x602d3e[_0x641a('0x12f')](_0x49162b,_0x203d55,_0x5bd4a3,_0x561471[_0x641a('0xc8')]);}}}})['then'](function(){if(_0x4b1a27){hopperUtils[_0x641a('0xe4')](_0x49162b,_0x57131d,_0x33dbd7)['then'](function(){return _0x203d55(0x1);});}});});};Dialer['prototype'][_0x641a('0x123')]=function(_0xdbd7de,_0x5cae8e,_0x357fab,_0x394dc1){var _0xd749c6=new Final(_0xdbd7de);_0xd749c6['state']=0xf;_0xd749c6[_0x641a('0x72')]=_0x641a('0x1c7');this[_0x641a('0x12f')](_0xd749c6,_0x5cae8e,_0x357fab,_0x394dc1);};Dialer[_0x641a('0x1b')][_0x641a('0x12f')]=function(_0x36574b,_0x1ad209,_0x23885c,_0x1b8f56){hopperUtils['moveContactManagedDialer'](_0x36574b)[_0x641a('0x43')](function(){return _0x1ad209(msgResponse('[callProgressDetecting]',_0x641a('0x10c'),_0x1b8f56));})['catch'](function(){return _0x23885c(msgResponse('[moveContactManagedDialer][0]',_0x641a('0x98'),_0x641a('0x1c8')));});};Dialer['prototype'][_0x641a('0xb5')]=function(_0x3ec0b2){var _0x24e62f=_0x3ec0b2[_0x641a('0x1c9')]/0x64;var _0x395c16=_0x3ec0b2[_0x641a('0x1ca')]/(_0x3ec0b2[_0x641a('0x1ca')]+_0x3ec0b2['outboundAnswerCallsDay']);var _0x356aa9=Math[_0x641a('0x1cb')](_0x3ec0b2[_0x641a('0x1cc')]*(_0x3ec0b2[_0x641a('0x1cd')]/0x64));var _0x280159=Math['round'](_0x3ec0b2[_0x641a('0x1cc')]*(_0x3ec0b2[_0x641a('0x1ce')]/0x64));var _0x9407ac=_0x3ec0b2['available']+_0x3ec0b2['talking'];var _0x504c68=Math[_0x641a('0x1cf')](_0x3ec0b2[_0x641a('0x5e')]*_0x3ec0b2['erlangAbandonmentRate']*_0x3ec0b2[_0x641a('0x1d0')]*_0x3ec0b2[_0x641a('0x1d1')]);if(_[_0x641a('0x45')](_0x3ec0b2[_0x641a('0x2b')])){if(!_[_0x641a('0x45')](_0x3ec0b2[_0x641a('0x2a')])){_0x3ec0b2[_0x641a('0x2a')]=undefined;loggerPredictive[_0x641a('0x6a')](_0x641a('0x1d2'),_0x641a('0x1d3'));}if(!_[_0x641a('0x45')](_0x3ec0b2[_0x641a('0x68')])){loggerPredictive['error'](_0x641a('0x1d2'),_0x641a('0x1d4'));clearInterval(_0x3ec0b2['handlePredictive']);_0x3ec0b2[_0x641a('0x68')]=undefined;}_0x3ec0b2[_0x641a('0x2b')]=moment()[_0x641a('0x4b')](_0x641a('0xc6'));loggerPredictive[_0x641a('0x4f')](_0x3ec0b2[_0x641a('0x4d')],_0x641a('0x1d5'),_0x3ec0b2[_0x641a('0x2b')]);this['handlePower'](_0x3ec0b2,0x1);}else if(ifInterval(_0x3ec0b2[_0x641a('0x1d6')],_0x3ec0b2[_0x641a('0x2b')])){this['handlePower'](_0x3ec0b2,0x1);loggerPredictiveCalls[_0x641a('0x4f')](_0x641a('0x1d7'),_0x3ec0b2[_0x641a('0x2b')],_0x3ec0b2[_0x641a('0x4d')]);_0x3ec0b2[_0x641a('0x5e')]=0x0;_0x3ec0b2[_0x641a('0xd1')]=0x0;}else if(_0x24e62f<_0x395c16&&_0x3ec0b2[_0x641a('0x1d8')]===_0x641a('0x1d9')){clearPredictiveAttributes(_0x3ec0b2);loggerPredictive[_0x641a('0x4f')](_0x641a('0x1da'),_0x641a('0x1db'),_0x395c16,_0x641a('0x2b'),_0x3ec0b2[_0x641a('0x4d')]);}else if(_0x504c68<_0x3ec0b2[_0x641a('0xd1')]&&_0x3ec0b2[_0x641a('0x1d8')]===_0x641a('0x1d9')){clearPredictiveAttributes(_0x3ec0b2);loggerPredictive[_0x641a('0x4f')](_0x641a('0x1dc'),'Max\x20Drop\x20',_0x504c68,_0x641a('0x1dd'),_0x3ec0b2[_0x641a('0xd1')],'startProgressive',_0x3ec0b2[_0x641a('0x4d')]);}else if(!ifInterval(_0x3ec0b2['dialPredictiveInterval'],_0x3ec0b2[_0x641a('0x2b')])&&_['isUndefined'](_0x3ec0b2[_0x641a('0x2a')])&&!_['isUndefined'](_0x3ec0b2[_0x641a('0x2b')])){_0x3ec0b2['startPredictive']=moment()[_0x641a('0x4b')](_0x641a('0xc6'));loggerPredictive[_0x641a('0x4f')](_0x3ec0b2['name'],_0x641a('0x1de'),_0x3ec0b2[_0x641a('0x2a')]);hopperUtils[_0x641a('0x1df')](_0x3ec0b2[_0x641a('0x1d6')])['then'](this['getDataPredictive'](_0x3ec0b2))[_0x641a('0x43')](mergeDataErlangB(_0x3ec0b2))[_0x641a('0x43')](this[_0x641a('0x1e0')](_0x3ec0b2))[_0x641a('0xa6')](loggerCatchPredictive(_0x641a('0x1e1'),_0x3ec0b2));}else if(!ifInterval(_0x3ec0b2[_0x641a('0x1d6')],_0x3ec0b2[_0x641a('0x2a')])){_0x3ec0b2[_0x641a('0xd1')]=0x0;_0x3ec0b2[_0x641a('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x641a('0x4f')](_0x3ec0b2[_0x641a('0x4d')],_0x641a('0x1e2'),_0x3ec0b2['startPredictive']);clearInterval(_0x3ec0b2['handlePredictive']);_0x3ec0b2[_0x641a('0x68')]=undefined;hopperUtils[_0x641a('0x1df')](_0x3ec0b2[_0x641a('0x1d6')])[_0x641a('0x43')](this['getDataPredictive'](_0x3ec0b2))[_0x641a('0x43')](mergeDataErlangB(_0x3ec0b2))[_0x641a('0x43')](this['startMethodPredictive'](_0x3ec0b2))[_0x641a('0xa6')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3ec0b2));}else if(_0x3ec0b2[_0x641a('0x1cc')]&&_0x9407ac<_0x3ec0b2['predictiveIntervalAvailable']-_0x280159){clearPredictiveAttributes(_0x3ec0b2);loggerPredictive['info'](_0x3ec0b2[_0x641a('0x4d')],_0x641a('0x1e3'),_0x9407ac,_0x641a('0x1e4'),_0x3ec0b2[_0x641a('0x1cc')],'-',_0x280159,'=',_0x3ec0b2['predictiveIntervalAvailable']-_0x280159,')');}else if(_0x3ec0b2[_0x641a('0x1cc')]&&_0x9407ac>_0x3ec0b2[_0x641a('0x1cc')]+_0x356aa9){clearPredictiveAttributes(_0x3ec0b2);loggerPredictive[_0x641a('0x4f')](_0x3ec0b2[_0x641a('0x4d')],_0x641a('0x1e3'),_0x9407ac,_0x641a('0x1e5'),_0x3ec0b2['predictiveIntervalAvailable'],'+',_0x356aa9,'=',_0x3ec0b2[_0x641a('0x1cc')]+_0x356aa9,')');}};Dialer[_0x641a('0x1b')][_0x641a('0x1e6')]=function(_0x36eb71){var _0x17b699=this;return function(_0x56af6c){return new Promise(function(_0x1b5303,_0x8868e5){_[_0x641a('0x65')](_0x36eb71,_0x56af6c[0x0]);if(checkGetDataPredictive(_0x56af6c[0x0])){var _0x56be3c=_0x36eb71[_0x641a('0x1cc')]=_0x36eb71[_0x641a('0x1e7')]+_0x36eb71['available'];var _0x54ccde=_0x36eb71[_0x641a('0x1d6')]*0x3c;var _0x343e00=_0x56af6c[0x0]['predictiveIntervalAvgTalktime']+_0x56af6c[0x0][_0x641a('0x59')];var _0x387468=(_0x56af6c[0x0][_0x641a('0x1e8')]+_0x56af6c[0x0][_0x641a('0x54')]+_0x56af6c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x56af6c[0x0][_0x641a('0x51')];_0x36eb71['predictiveIntervalHitRate']=_0x387468>0x0?_0x387468:0x1;switch(_0x36eb71['dialPredictiveOptimization']){case'dropRate':var _0x59c50b=_0x36eb71['dialPredictiveOptimizationPercentage']/0x64;return _0x17b699[_0x641a('0x1e9')](_0x56be3c,_0x54ccde,_0x343e00,_0x387468,_0x59c50b)[_0x641a('0x43')](function(_0xf16bc4){return _0x1b5303(_0xf16bc4);});case'agentBusyFactor':var _0x145168=_0x36eb71[_0x641a('0x1c9')]/0x64;return _0x17b699[_0x641a('0x1ea')](_0x56be3c,_0x54ccde,_0x343e00,_0x387468,_0x145168)[_0x641a('0x43')](function(_0x1e468d){return _0x1b5303(_0x1e468d);});default:return _0x8868e5(msgResponse('[getDataPredictive]',_0x641a('0x98'),_0x641a('0x1eb')));}}else{return _0x8868e5(msgResponse(_0x641a('0x1ec'),_0x641a('0x98'),'check\x20failure'));}});};};Dialer[_0x641a('0x1b')][_0x641a('0x1ed')]=function(_0x35b13d){var _0x184ab9=this;return function(_0x5205aa){return new Promise(function(_0x26b089,_0x2d9514){_['merge'](_0x35b13d,_0x5205aa[0x0]);if(checkGetDataPredictive(_0x5205aa[0x0])){loggerPredictive[_0x641a('0x4f')](JSON[_0x641a('0x77')](_0x5205aa[0x0]));if(_0x35b13d[_0x641a('0x1d8')]===_0x641a('0x1d9')){return _0x184ab9[_0x641a('0x150')](_0x35b13d['id'])[_0x641a('0x43')](function(_0x2f1ee9){var _0x3ef4cd=_0x35b13d[_0x641a('0x1ee')]-_0x2f1ee9[0x0][_0x641a('0x1ef')];var _0x42b67e=_0x35b13d[_0x641a('0x1d6')]*0x3c;var _0x4d93fb=_0x5205aa[0x0][_0x641a('0x56')]+_0x5205aa[0x0]['predictiveIntervalAvgHoldtime'];var _0x545359=(_0x5205aa[0x0]['predictiveIntervalAnsweredCalls']+_0x5205aa[0x0][_0x641a('0x54')]+_0x5205aa[0x0][_0x641a('0xe5')])/_0x5205aa[0x0]['predictiveIntervalTotalCalls'];var _0x5b9674=_0x35b13d[_0x641a('0x1c9')]/0x64;_0x35b13d[_0x641a('0x1f0')]=_0x2f1ee9[0x0]['outboundQueuePauses']||0x0;_0x35b13d[_0x641a('0x1d0')]=_0x545359>0x0?_0x545359:0x1;return _0x184ab9[_0x641a('0x1e9')](_0x3ef4cd,_0x42b67e,_0x4d93fb,_0x545359,_0x5b9674);})[_0x641a('0x43')](function(_0x3ba11b){return _0x26b089(_0x3ba11b);})['catch'](function(_0x3520f0){return _0x2d9514(msgResponse(_0x641a('0x1f1'),_0x641a('0x98'),JSON[_0x641a('0x77')](_0x3520f0)));});}if(_0x35b13d[_0x641a('0x1d8')]===_0x641a('0x1f2')){return _0x184ab9[_0x641a('0x150')](_0x35b13d['id'])[_0x641a('0x43')](function(_0x3102da){var _0x12771b=_0x35b13d['loggedIn']-_0x3102da[0x0][_0x641a('0x1ef')];var _0x100532=_0x35b13d['dialPredictiveInterval']*0x3c;var _0x46c9a4=_0x5205aa[0x0][_0x641a('0x56')]+_0x5205aa[0x0]['predictiveIntervalAvgHoldtime'];var _0x53ae1a=(_0x5205aa[0x0][_0x641a('0x1e8')]+_0x5205aa[0x0][_0x641a('0x54')]+_0x5205aa[0x0][_0x641a('0xe5')])/_0x5205aa[0x0][_0x641a('0x51')];var _0x29dbf2=_0x35b13d[_0x641a('0x1c9')]/0x64;_0x35b13d['predictiveIntervalPauses']=_0x3102da[0x0][_0x641a('0x1ef')]||0x0;_0x35b13d[_0x641a('0x1d0')]=_0x53ae1a>0x0?_0x53ae1a:0x1;return _0x184ab9[_0x641a('0x1ea')](_0x12771b,_0x100532,_0x46c9a4,_0x53ae1a,_0x29dbf2);})[_0x641a('0x43')](function(_0x1b986a){return _0x26b089(_0x1b986a);})[_0x641a('0xa6')](function(_0x36f900){return _0x2d9514(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x36f900)));});}}else{return _0x2d9514(msgResponse('[getDataPredictive]',_0x641a('0x98'),_0x641a('0x1f3')));}});};};Dialer[_0x641a('0x1b')][_0x641a('0x1e0')]=function(_0x21a83c){var _0x5f03a6=this;return function(){var _0x13e5f5=0x0;var _0x4295fa=Math[_0x641a('0x1cf')](_0x21a83c[_0x641a('0x60')]*0x3e8);if(_0x4295fa>0x0){_0x4295fa=_0x4295fa<0x64?0x64:_0x4295fa;loggerPredictive[_0x641a('0x4f')](_0x21a83c[_0x641a('0x4d')],_0x641a('0x1f4'),_0x4295fa,_0x641a('0x1f5'));_0x21a83c[_0x641a('0x68')]=setInterval(function(){_0x5f03a6['handlePredictive'](_0x21a83c);loggerPredictiveCalls['info'](_0x641a('0x1f6'),_0x13e5f5+=0x1);},_0x4295fa);}else{loggerPredictive[_0x641a('0x4f')](_0x21a83c[_0x641a('0x4d')],_0x641a('0x1f7'));}};};Dialer[_0x641a('0x1b')][_0x641a('0x1f8')]=function(_0x13d743,_0x3641da){var _0x315928=this;return function(_0x5ddfce){if(_[_0x641a('0x7c')](_0x5ddfce)){if(_[_0x641a('0xf8')](_0x3641da['UserId'])||!_0x3641da[_0x641a('0x1f9')]){if(_0x13d743[_0x641a('0xb4')]===_0x641a('0x9')){_0x13d743['queueStatusComplete']=_['isUndefined'](_0x13d743[_0x641a('0x74')])?!![]:_0x13d743[_0x641a('0x74')];var _0x5011cf=uuid['v4']();_0x315928['actions'][_0x5011cf]=new Action(_0x13d743,_0x3641da,_0x5011cf);loggerBooked[_0x641a('0x4f')](_0x641a('0x1fa'),_0x5011cf,_0x641a('0x1fb'),JSON['stringify'](_0x13d743['queueStatusComplete']),_0x641a('0x1fc'),_0x13d743[_0x641a('0x4d')]);if(_0x13d743[_0x641a('0x74')]){_0x13d743[_0x641a('0x74')]=![];_0x315928[_0x641a('0x2d')][_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xc1')]]=[];ami[_0x641a('0xa1')]({'actionid':_0x5011cf,'action':_0x641a('0x1fd'),'queue':_0x13d743['name']})[_0x641a('0xa6')](function(){_0x315928[_0x641a('0xc4')](_0x13d743);hopperUtils[_0x641a('0xec')]({'active':![],'ContactId':_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xdc')],'ListId':_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xdd')],'VoiceQueueId':_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xef')]||undefined,'CampaignId':_0x315928[_0x641a('0x26')][_0x5011cf]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x315928['actions'][_0x5011cf];});}else{loggerBooked[_0x641a('0x4f')](_0x641a('0x1fe'),JSON[_0x641a('0x77')](_0x13d743[_0x641a('0x74')]),'Queue:\x20',_0x13d743['name']);_0x315928[_0x641a('0xc4')](_0x13d743);hopperUtils[_0x641a('0xec')]({'active':![],'ContactId':_0x315928['actions'][_0x5011cf][_0x641a('0xdc')],'ListId':_0x315928['actions'][_0x5011cf][_0x641a('0xdd')],'VoiceQueueId':_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xef')]||undefined,'CampaignId':_0x315928[_0x641a('0x26')][_0x5011cf][_0x641a('0xde')]||undefined})[_0x641a('0xa6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x315928[_0x641a('0x26')][_0x5011cf];}}else{return _0x315928['actionOriginate'](_0x13d743,_0x3641da);}}else{if(utils[_0x641a('0x66')](undefined,_0x3641da[_0x641a('0x1ff')])<_0x13d743[_0x641a('0x200')]*0x3c){if(_0x3641da[_0x641a('0x149')]&&!_0x3641da[_0x641a('0x149')]['voicePause']){_0x315928[_0x641a('0x20')][_0x641a('0xfd')](_0x3641da['id'])['finally'](function(){_0x315928[_0x641a('0xc4')](_0x13d743);});}else{hopperUtils['unlockContact']({'active':![]},_0x3641da['id'],0x1)['finally'](function(){_0x315928[_0x641a('0xc4')](_0x13d743);});}}else{_0x13d743[_0x641a('0x201')]+=0x1;_0x315928[_0x641a('0xc4')](_0x13d743);if(_0x13d743[_0x641a('0x202')]){hopperUtils[_0x641a('0xec')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3641da['ContactId'],'ListId':_0x3641da[_0x641a('0xdd')],'VoiceQueueId':_0x3641da['VoiceQueueId']||undefined,'CampaignId':_0x3641da['CampaignId']||undefined})[_0x641a('0xa6')](loggerCatch(_0x641a('0x203')));hopperUtils[_0x641a('0xcc')](createObjHistory(_0x13d743,_0x3641da,utils[_0x641a('0x6f')][_0x641a('0x204')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x641a('0x205')));}else{_0x315928[_0x641a('0x118')](createObjHistory(_0x13d743,_0x3641da,utils['CAMPAIGN_STATUS'][_0x641a('0x206')],0x16,_0x641a('0x207')),_0x641a('0x208'),_0x641a('0x209'));}}}}else{_0x13d743[_0x641a('0x20a')]+=0x1;_0x315928[_0x641a('0x118')](createObjHistory(_0x13d743,_0x3641da,utils[_0x641a('0x6f')]['BLACKLIST'],0xd,'Blacklist'),_0x641a('0x20b'),_0x641a('0x20c'));throw _0x641a('0x20d');}};};Dialer[_0x641a('0x1b')][_0x641a('0x15b')]=function(_0x3c5727){var _0x3c6895=this;var _0xa03e45=_0x3c5727[_0x641a('0x20e')]-_0x3c5727['originated']-_0x3c5727['temp'];emitCampaignSummary(_0x3c5727);if(_0xa03e45>0x0){if(_0xa03e45>this['maxNumberOriginate']){_0xa03e45=this['maxNumberOriginate'];}_0x3c5727['temp']+=_0xa03e45;hopperUtils[_0x641a('0x20f')](_0x3c5727,_0xa03e45)['then'](function(_0x5ed4d0){_0x3c5727['temp']-=_0xa03e45;_0x3c5727[_0x641a('0x210')]=_0x3c5727['temp']>0x0?_0x3c5727[_0x641a('0x210')]:0x0;if(!utils[_0x641a('0x211')](_0x5ed4d0)){_0x3c5727[_0x641a('0x6e')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x641a('0x4f')](_0x641a('0x212')+_0x3c5727[_0x641a('0x4d')]);}else{_0x3c5727['originated']+=_0x5ed4d0['length'];_0x3c5727[_0x641a('0x6e')]=utils[_0x641a('0x6f')]['RUNNING'];for(var _0x58ff81=0x0;_0x58ff81<_0x5ed4d0[_0x641a('0x9f')];_0x58ff81+=0x1){_0x3c5727[_0x641a('0x213')]+=0x1;if(_[_0x641a('0xf8')](_0x5ed4d0[_0x58ff81])||_[_0x641a('0xf8')](_0x5ed4d0[_0x58ff81][_0x641a('0x179')])||_[_0x641a('0xf8')](_0x5ed4d0[_0x58ff81][_0x641a('0x18a')])){_0x3c6895[_0x641a('0x155')](_0x641a('0x214'),_0x3c5727,_0x5ed4d0[_0x58ff81]);}else{hopperUtils[_0x641a('0x215')](_[_0x641a('0x78')](_0x5ed4d0[_0x58ff81],['CampaignId',_0x641a('0x18a')]))[_0x641a('0x43')](_0x3c6895[_0x641a('0x1f8')](_0x3c5727,_0x5ed4d0[_0x58ff81]))[_0x641a('0xa6')](_0x3c6895['loggerHandler'](_0x641a('0x216'),_0x3c5727));}}}})['catch'](loggerGetContactDialer(_0x641a('0x217'),_0x3c5727,_0xa03e45));}};Dialer['prototype'][_0x641a('0xb7')]=function(_0x4a8eda,_0x2b1126){var _0x8ed157=this;var _0x5c80ce=[];if(_0x2b1126<0x1||_0x4a8eda[_0x641a('0xb4')]==='booked'){_0x2b1126=0x1;}var _0x461773=Math[_0x641a('0x1cf')](_0x4a8eda[_0x641a('0x218')]*_0x2b1126)-_0x4a8eda[_0x641a('0x83')]-_0x4a8eda[_0x641a('0x210')];if(_0x4a8eda[_0x641a('0x219')]>0x0){var _0x5ad54e=_0x4a8eda[_0x641a('0x219')]-_0x4a8eda[_0x641a('0x83')]-_0x4a8eda[_0x641a('0x1e7')]-_0x4a8eda[_0x641a('0x210')]-_0x4a8eda[_0x641a('0x13c')];if(_0x461773>_0x5ad54e){_0x461773=_0x5ad54e;}}if(_0x461773>0x0){if(_0x4a8eda[_0x641a('0xb4')]===_0x641a('0x9')){_0x461773=0x1;}if(_0x461773>this['maxNumberOriginate']){_0x461773=this[_0x641a('0x21a')];}_0x4a8eda[_0x641a('0x210')]+=_0x461773;for(var _0x3be2e2 in this[_0x641a('0x23')]){if(typeof this['agents'][_0x3be2e2]!=='undefined'){if(this[_0x641a('0x23')][_0x3be2e2][_0x641a('0xd2')]===_0x641a('0x21b')&&this['agents'][_0x3be2e2][_0x641a('0x8d')]===_0x641a('0x8e')){_0x5c80ce['push'](this[_0x641a('0x23')][_0x3be2e2]['id']);}}}hopperUtils[_0x641a('0x21c')](_0x4a8eda,_0x5c80ce,_0x461773)[_0x641a('0x43')](function(_0x1af475){_0x4a8eda[_0x641a('0x210')]-=_0x461773;_0x4a8eda['temp']=_0x4a8eda[_0x641a('0x210')]>0x0?_0x4a8eda['temp']:0x0;if(!utils[_0x641a('0x211')](_0x1af475)){hopperUtils[_0x641a('0x21d')](_0x4a8eda)[_0x641a('0x43')](sendMessageReschedule(_0x4a8eda))[_0x641a('0xa6')](loggerCatch(_0x641a('0x21e')));}else{_0x4a8eda[_0x641a('0x83')]+=_0x1af475[_0x641a('0x9f')];_0x4a8eda[_0x641a('0x6e')]=_0x4a8eda[_0x641a('0xb4')]===_0x641a('0x9')?utils[_0x641a('0x6f')][_0x641a('0x13d')]:utils[_0x641a('0x6f')][_0x641a('0x21f')];for(var _0x43ba58=0x0;_0x43ba58<_0x1af475[_0x641a('0x9f')];_0x43ba58+=0x1){if(_[_0x641a('0xf8')](_0x1af475[_0x43ba58])||_[_0x641a('0xf8')](_0x1af475[_0x43ba58][_0x641a('0x179')])||_['isNil'](_0x1af475[_0x43ba58]['phone'])){_0x8ed157['emptyContact'](_0x641a('0x214'),_0x4a8eda,_0x1af475[_0x43ba58]);}else{hopperUtils['checkIsBlackList'](_[_0x641a('0x78')](_0x1af475[_0x43ba58],['VoiceQueueId','phone']))[_0x641a('0x43')](_0x8ed157[_0x641a('0x1f8')](_0x4a8eda,_0x1af475[_0x43ba58]))['catch'](_0x8ed157[_0x641a('0x154')](_0x641a('0x214'),_0x4a8eda));}}}})[_0x641a('0xa6')](loggerGetContactDialer('[getContactDialer2]',_0x4a8eda,_0x461773));}};Dialer[_0x641a('0x1b')][_0x641a('0x68')]=function(_0x317722){if(_0x317722[_0x641a('0x219')]>0x0){var _0x460cc2=_0x317722[_0x641a('0x219')]-_0x317722[_0x641a('0x83')]-_0x317722['talking'];if(_0x460cc2>0x0){this[_0x641a('0x220')](_0x317722);}else{loggerPredictiveCalls[_0x641a('0x4f')](_0x641a('0x221'));}}else{this[_0x641a('0x220')](_0x317722);}};Dialer[_0x641a('0x1b')][_0x641a('0x220')]=function(_0x558991){var _0x50292b=this;var _0x564a4c=[];_0x558991[_0x641a('0x83')]+=0x1;for(var _0x4b5326 in this[_0x641a('0x23')]){if(typeof this[_0x641a('0x23')][_0x4b5326]!==_0x641a('0x151')){if(this[_0x641a('0x23')][_0x4b5326][_0x641a('0xd2')]===_0x641a('0x21b')&&this[_0x641a('0x23')][_0x4b5326][_0x641a('0x8d')]==='reachable'){_0x564a4c[_0x641a('0xa0')](this[_0x641a('0x23')][_0x4b5326]['id']);}}}return this[_0x641a('0x21c')](_0x558991['id'],_0x564a4c,0x1,_0x558991['dialOrderByScheduledAt'],_0x558991)[_0x641a('0x43')](function(_0x6c1247){if(!utils['checkContactEmpty'](_0x6c1247)){utils[_0x641a('0x6c')](_0x558991,0x1,0x0);return hopperUtils[_0x641a('0x21d')](_0x558991)['then'](sendMessageReschedule(_0x558991))['catch'](loggerCatch(_0x641a('0x21e')));}else{_0x558991['message']=utils[_0x641a('0x6f')][_0x641a('0x21f')];if(_[_0x641a('0xf8')](_0x6c1247[0x0])||_[_0x641a('0xf8')](_0x6c1247[0x0][_0x641a('0x179')])||_[_0x641a('0xf8')](_0x6c1247[0x0]['phone'])){_0x50292b[_0x641a('0x155')](_0x641a('0x214'),_0x558991,_0x6c1247[0x0]);}else{return hopperUtils[_0x641a('0x222')](_[_0x641a('0x78')](_0x6c1247[0x0],[_0x641a('0xef'),_0x641a('0x18a')]))[_0x641a('0x43')](_0x50292b[_0x641a('0x1f8')](_0x558991,_0x6c1247[0x0]))[_0x641a('0xa6')](_0x50292b[_0x641a('0x154')](_0x641a('0x223'),_0x558991));}}})[_0x641a('0xa6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x558991,0x1));};Dialer[_0x641a('0x1b')]['abandonmentRate']=function(_0x3742da,_0x327b2f,_0x3534ff,_0xd21f66,_0x551339,_0x339eb1){loggerPredictive[_0x641a('0x4f')](_0x641a('0x224'));loggerPredictive['info'](_0x641a('0x225'),_0x3742da);loggerPredictive[_0x641a('0x4f')](_0x641a('0x226'),_0x327b2f);loggerPredictive['info']('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',_0x3534ff);loggerPredictive[_0x641a('0x4f')](_0x641a('0x227'),_0xd21f66);loggerPredictive[_0x641a('0x4f')](_0x641a('0x228'),_0x551339);loggerPredictive[_0x641a('0x4f')](_0x641a('0x57'));return new Promise(function(_0x382a3d,_0x4f5c4c){if(_0x3742da<=0x0||isNaN(_0x3742da)){return _0x4f5c4c(msgResponse(_0x641a('0x229'),_0x641a('0x8a'),_0x641a('0x22a')+_0x3742da));}if(_0x3534ff<=0x0||isNaN(_0x3534ff)){return _0x4f5c4c(msgResponse('[abandonmentRate]','Error','Ts\x20=\x20'+_0x3534ff));}if(_0xd21f66<=0x0||isNaN(_0xd21f66)){return _0x4f5c4c(msgResponse(_0x641a('0x229'),_0x641a('0x8a'),'p\x20=\x20'+_0xd21f66));}if(_0x327b2f<=0x0||isNaN(_0x327b2f)){return _0x4f5c4c(msgResponse(_0x641a('0x229'),'Error',_0x641a('0x22b')+_0x327b2f));}if(_0x551339<=0x0||isNaN(_0x551339)){return _0x4f5c4c(msgResponse(_0x641a('0x229'),_0x641a('0x8a'),'Amax\x20=\x20'+_0x551339));}_0x339eb1=_0x339eb1||0x0;var _0x3994d0=0x1/_0x3534ff;var _0x385d0b=0x0;var _0x59c29c=0x0;var _0x387d14=0x0;var _0x51036=0x0;for(var _0x529f52=0x0;_0x387d14<_0x551339;_0x529f52+=0x1){_0x59c29c=_0x529f52/_0x327b2f;_0x385d0b=(_0xd21f66*_0x59c29c+_0x339eb1)/_0x3994d0;_0x387d14=utils[_0x641a('0x22c')](_0x385d0b,_0x3742da);_0x51036=_0x385d0b/_0x3742da*(0x1-utils[_0x641a('0x22c')](_0x385d0b,_0x3742da));}return _0x382a3d({'erlangCalls':_0x529f52,'erlangCallToSecond':_0x327b2f/_0x529f52,'erlangAbandonmentRate':_0x387d14,'erlangBusyFactor':_0x51036});});};Dialer['prototype'][_0x641a('0x1ea')]=function(_0x94f3ed,_0x42797f,_0x254ce1,_0x2cbbbe,_0x2cfcd5,_0xa956b1){loggerPredictive[_0x641a('0x4f')](_0x641a('0x22d'));loggerPredictive['info'](_0x641a('0x225'),_0x94f3ed);loggerPredictive[_0x641a('0x4f')](_0x641a('0x226'),_0x42797f);loggerPredictive[_0x641a('0x4f')](_0x641a('0x22e'),_0x254ce1);loggerPredictive[_0x641a('0x4f')](_0x641a('0x227'),_0x2cbbbe);loggerPredictive[_0x641a('0x4f')](_0x641a('0x22f'),_0x2cfcd5);loggerPredictive['info'](_0x641a('0x57'));return new Promise(function(_0x27f735,_0x439110){if(_0x94f3ed<=0x0||isNaN(_0x94f3ed)){return _0x439110(msgResponse(_0x641a('0x230'),_0x641a('0x8a'),_0x641a('0x22a')+_0x94f3ed));}if(_0x254ce1<=0x0||isNaN(_0x254ce1)){return _0x439110(msgResponse(_0x641a('0x230'),_0x641a('0x8a'),'Ts\x20=\x20'+_0x254ce1));}if(_0x2cbbbe<=0x0||isNaN(_0x2cbbbe)){return _0x439110(msgResponse('[busyFactor]',_0x641a('0x8a'),_0x641a('0x231')+_0x2cbbbe));}if(_0x42797f<=0x0||isNaN(_0x42797f)){return _0x439110(msgResponse('[busyFactor]','Error',_0x641a('0x22b')+_0x42797f));}if(_0x2cfcd5<=0x0||isNaN(_0x2cfcd5)){return _0x439110(msgResponse(_0x641a('0x230'),'Error','Umin\x20=\x20'+_0x2cfcd5));}_0xa956b1=_0xa956b1||0x0;var _0x262029=0x1/_0x254ce1;var _0x2abf6e=0x0;var _0x50dd9a=0x0;var _0x2b6b15=0x0;var _0x358fb0=0x0;for(var _0x5a37e3=0x0;_0x358fb0<_0x2cfcd5;_0x5a37e3+=0x1){_0x50dd9a=_0x5a37e3/_0x42797f;_0x2abf6e=(_0x2cbbbe*_0x50dd9a+_0xa956b1)/_0x262029;_0x2b6b15=utils[_0x641a('0x22c')](_0x2abf6e,_0x94f3ed);_0x358fb0=_0x2abf6e/_0x94f3ed*(0x1-utils['erlangb'](_0x2abf6e,_0x94f3ed));}return _0x27f735({'erlangCalls':_0x5a37e3,'erlangCallToSecond':_0x42797f/_0x5a37e3,'erlangAbandonmentRate':_0x2b6b15,'erlangBusyFactor':_0x358fb0});});};module[_0x641a('0x232')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index c2e7c34..cad9088 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e94=['getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x336c17,_0x12bc12){var _0x37a0ca=function(_0x21c229){while(--_0x21c229){_0x336c17['push'](_0x336c17['shift']());}};_0x37a0ca(++_0x12bc12);}(_0x4e94,0x84));var _0x44e9=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x4e94[_0x1b8e60];return _0x363363;};'use strict';var util=require(_0x44e9('0x0'));var _=require(_0x44e9('0x1'));var moment=require(_0x44e9('0x2'));function checkNameSurname(_0x447f1a,_0x647514,_0x65043b){var _0x2f2650='';if(!_['isNil'](_0x647514)&&_0x44e9('0x3')===typeof _0x647514){_0x2f2650+=_0x647514;}if(!_['isNil'](_0x65043b)&&'string'===typeof _0x65043b){_0x2f2650+='\x20'+_0x65043b;}if(_0x2f2650!==''){return _0x2f2650;}return _0x447f1a;}function Action(_0xec7429,_0x26f0c5,_0x498588){this[_0x44e9('0x4')]=_0xec7429;this['uniqueid']=_0x498588||undefined;this['name']=checkNameSurname(_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x6')],_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x7')],_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x8')]);this[_0x44e9('0x9')]=_0x26f0c5['phone'];this[_0x44e9('0xa')]=_0xec7429[_0x44e9('0xb')];this[_0x44e9('0xc')]=_0x26f0c5['active']||![];this[_0x44e9('0xd')]=_0xec7429[_0x44e9('0xd')];this[_0x44e9('0xe')]=_0xec7429['dialQueueTimeout']||0x3;this[_0x44e9('0xf')]=_0x26f0c5[_0x44e9('0xf')];this['countbusyretry']=_0x26f0c5[_0x44e9('0x10')];this['countcongestionretry']=_0x26f0c5[_0x44e9('0x11')];this[_0x44e9('0x12')]=_0x26f0c5['countnoanswerretry'];this[_0x44e9('0x13')]=_0x26f0c5[_0x44e9('0x13')];this[_0x44e9('0x14')]=_0x26f0c5['countdropretry'];this['countabandonedretry']=_0x26f0c5[_0x44e9('0x15')];this[_0x44e9('0x16')]=_0x26f0c5[_0x44e9('0x16')];this[_0x44e9('0x17')]=_0x26f0c5[_0x44e9('0x17')];this[_0x44e9('0x18')]=_0x26f0c5[_0x44e9('0x18')];this['ListId']=_0x26f0c5[_0x44e9('0x19')];this['UserId']=_0x26f0c5['UserId'];this['VoiceQueueId']=_0x26f0c5[_0x44e9('0x1a')];this[_0x44e9('0x1b')]=_0x26f0c5['CampaignId'];this[_0x44e9('0x1c')]=_0x26f0c5['id'];this['ContactFirstName']=_0x26f0c5[_0x44e9('0x5')][_0x44e9('0x7')]||'';this[_0x44e9('0x1d')]=moment()[_0x44e9('0x1e')](_0x44e9('0x1f'));this[_0x44e9('0x20')]=_0x26f0c5['callback'];this[_0x44e9('0x21')]=_0x26f0c5['callbackuniqueid'];this[_0x44e9('0x22')]=_0x26f0c5[_0x44e9('0x22')];this[_0x44e9('0x23')]=_0x26f0c5[_0x44e9('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x44e9('0x24')]=function(){return util['format'](_0x44e9('0x25'),this['name'],this[_0x44e9('0x4')][_0x44e9('0x26')]>0x0?this[_0x44e9('0x9')][_0x44e9('0x27')](this[_0x44e9('0x4')]['dialCutDigit']):this[_0x44e9('0x9')]);};Action['prototype'][_0x44e9('0x28')]=function(){return this[_0x44e9('0xa')];};module[_0x44e9('0x29')]=Action; \ No newline at end of file +var _0xc479=['originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','getQueue','exports','util','lodash','moment','isNil','string','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xc479,0x179));var _0x9c47=function(_0x4bc063,_0x2e9d5c){_0x4bc063=_0x4bc063-0x0;var _0x482ad0=_0xc479[_0x4bc063];return _0x482ad0;};'use strict';var util=require(_0x9c47('0x0'));var _=require(_0x9c47('0x1'));var moment=require(_0x9c47('0x2'));function checkNameSurname(_0x312064,_0x4ecd80,_0x1f3e02){var _0xde6951='';if(!_[_0x9c47('0x3')](_0x4ecd80)&&_0x9c47('0x4')===typeof _0x4ecd80){_0xde6951+=_0x4ecd80;}if(!_[_0x9c47('0x3')](_0x1f3e02)&&_0x9c47('0x4')===typeof _0x1f3e02){_0xde6951+='\x20'+_0x1f3e02;}if(_0xde6951!==''){return _0xde6951;}return _0x312064;}function Action(_0x188c66,_0x25e106,_0x3b7b17){this['voiceQueue']=_0x188c66;this['uniqueid']=_0x3b7b17||undefined;this[_0x9c47('0x5')]=checkNameSurname(_0x25e106[_0x9c47('0x6')][_0x9c47('0x7')],_0x25e106[_0x9c47('0x6')][_0x9c47('0x8')],_0x25e106[_0x9c47('0x6')][_0x9c47('0x9')]);this[_0x9c47('0xa')]=_0x25e106['phone'];this[_0x9c47('0xb')]=_0x188c66[_0x9c47('0x5')];this[_0x9c47('0xc')]=_0x25e106[_0x9c47('0xc')]||![];this[_0x9c47('0xd')]=_0x188c66[_0x9c47('0xd')];this[_0x9c47('0xe')]=_0x188c66[_0x9c47('0xe')]||0x3;this[_0x9c47('0xf')]=_0x25e106[_0x9c47('0xf')];this[_0x9c47('0x10')]=_0x25e106['countbusyretry'];this[_0x9c47('0x11')]=_0x25e106['countcongestionretry'];this[_0x9c47('0x12')]=_0x25e106[_0x9c47('0x12')];this[_0x9c47('0x13')]=_0x25e106[_0x9c47('0x13')];this[_0x9c47('0x14')]=_0x25e106[_0x9c47('0x14')];this[_0x9c47('0x15')]=_0x25e106['countabandonedretry'];this['countmachineretry']=_0x25e106[_0x9c47('0x16')];this[_0x9c47('0x17')]=_0x25e106['countagentrejectretry'];this[_0x9c47('0x18')]=_0x25e106[_0x9c47('0x18')];this[_0x9c47('0x19')]=_0x25e106[_0x9c47('0x19')];this[_0x9c47('0x1a')]=_0x25e106[_0x9c47('0x1a')];this[_0x9c47('0x1b')]=_0x25e106['VoiceQueueId'];this[_0x9c47('0x1c')]=_0x25e106[_0x9c47('0x1c')];this['idHopper']=_0x25e106['id'];this[_0x9c47('0x1d')]=_0x25e106['Contact'][_0x9c47('0x8')]||'';this[_0x9c47('0x1e')]=moment()[_0x9c47('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9c47('0x20')]=_0x25e106[_0x9c47('0x20')];this['callbackuniqueid']=_0x25e106[_0x9c47('0x21')];this[_0x9c47('0x22')]=_0x25e106[_0x9c47('0x22')];this[_0x9c47('0x23')]=_0x25e106['recallme'];this[_0x9c47('0x24')]='';this[_0x9c47('0x25')]='';}Action['prototype'][_0x9c47('0x26')]=function(){return util[_0x9c47('0x1f')](_0x9c47('0x27'),this[_0x9c47('0x5')],this[_0x9c47('0x28')][_0x9c47('0x29')]>0x0?this[_0x9c47('0xa')][_0x9c47('0x2a')](this['voiceQueue']['dialCutDigit']):this[_0x9c47('0xa')]);};Action[_0x9c47('0x2b')][_0x9c47('0x2c')]=function(){return this[_0x9c47('0xb')];};module[_0x9c47('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 69a8461..a6d6c99 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x942b=['ringtime','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57bd71,_0x33adb7){var _0x487fae=function(_0x288715){while(--_0x288715){_0x57bd71['push'](_0x57bd71['shift']());}};_0x487fae(++_0x33adb7);}(_0x942b,0xc6));var _0xb942=function(_0x376121,_0xd28328){_0x376121=_0x376121-0x0;var _0x3504e7=_0x942b[_0x376121];return _0x3504e7;};'use strict';var moment=require(_0xb942('0x0'));var utils=require(_0xb942('0x1'));function AgentComplete(_0x4af21a,_0x4f6df8){this[_0xb942('0x2')]=0x4;this[_0xb942('0x3')]=_0xb942('0x4');this[_0xb942('0x5')]=_0x4af21a['scheduledat'];this[_0xb942('0x6')]=_0x4af21a[_0xb942('0x6')];this[_0xb942('0x7')]=_0x4af21a['type']===_0xb942('0x8')?_0xb942('0x9'):_0x4af21a[_0xb942('0x6')];this[_0xb942('0xa')]=_0x4af21a[_0xb942('0xa')];this[_0xb942('0xb')]=_0x4af21a[_0xb942('0xb')];this[_0xb942('0xc')]=_0x4af21a[_0xb942('0xc')];this['countglobal']=_0x4af21a[_0xb942('0xa')]+_0x4af21a[_0xb942('0xb')]+_0x4af21a[_0xb942('0xc')]+_0x4af21a[_0xb942('0xd')]+_0x4af21a[_0xb942('0xe')]+_0x4af21a[_0xb942('0xf')]+_0x4af21a[_0xb942('0x10')]+_0x4af21a[_0xb942('0x11')];this['countnosuchnumberretry']=_0x4af21a[_0xb942('0xd')];this[_0xb942('0xe')]=_0x4af21a[_0xb942('0xe')];this[_0xb942('0xf')]=_0x4af21a[_0xb942('0xf')];this[_0xb942('0x10')]=_0x4af21a[_0xb942('0x10')];this[_0xb942('0x11')]=_0x4af21a['countagentrejectretry'];this[_0xb942('0x12')]=_0x4f6df8[_0xb942('0x12')];this['calleridname']=_0x4af21a['name'];this[_0xb942('0x13')]=_0x4af21a[_0xb942('0x14')];this[_0xb942('0x15')]=_0x4af21a[_0xb942('0x15')];this[_0xb942('0x16')]=_0x4af21a[_0xb942('0x16')];this['answertime']=_0x4af21a[_0xb942('0x17')];this[_0xb942('0x18')]=moment()[_0xb942('0x19')](_0xb942('0x1a'));this[_0xb942('0x1b')]=utils[_0xb942('0x1c')](_0x4af21a[_0xb942('0x16')],_0x4af21a[_0xb942('0x15')]);this[_0xb942('0x1d')]=utils['getSeconds'](_0x4af21a['answertime'],_0x4af21a[_0xb942('0x16')]);this[_0xb942('0x1e')]=utils[_0xb942('0x1c')](this[_0xb942('0x18')],_0x4af21a['answertime']);this[_0xb942('0x9')]=_0x4f6df8[_0xb942('0x9')];this[_0xb942('0x1f')]=_0x4f6df8[_0xb942('0x1f')];this['reason']=_0x4f6df8['reason'];this[_0xb942('0x20')]=_0x4af21a['callback'];this['callbackuniqueid']=_0x4af21a[_0xb942('0x21')];this[_0xb942('0x22')]=_0x4af21a[_0xb942('0x22')];this[_0xb942('0x23')]=_0x4af21a[_0xb942('0x23')];this['ContactId']=_0x4af21a[_0xb942('0x24')];this[_0xb942('0x25')]=_0x4af21a['ListId'];this['UserId']=_0x4af21a[_0xb942('0x26')];this[_0xb942('0x27')]=_0x4af21a[_0xb942('0x27')];this[_0xb942('0x28')]=_0x4af21a[_0xb942('0x28')];this[_0xb942('0x29')]=_0x4af21a[_0xb942('0x29')]||'';this[_0xb942('0x2a')]=_0x4af21a['originatecalleridname']||'';this[_0xb942('0x2b')]=_0x4af21a[_0xb942('0x2b')];}module[_0xb942('0x2c')]=AgentComplete; \ No newline at end of file +var _0x1201=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1201,0x16c));var _0x1120=function(_0x1a13b1,_0x4d1d25){_0x1a13b1=_0x1a13b1-0x0;var _0x395e05=_0x1201[_0x1a13b1];return _0x395e05;};'use strict';var moment=require(_0x1120('0x0'));var utils=require(_0x1120('0x1'));function AgentComplete(_0x56d73,_0x1e3985){this[_0x1120('0x2')]=0x4;this['statedesc']=_0x1120('0x3');this['scheduledat']=_0x56d73[_0x1120('0x4')];this[_0x1120('0x5')]=_0x56d73[_0x1120('0x5')];this[_0x1120('0x6')]=_0x56d73[_0x1120('0x5')]===_0x1120('0x7')?_0x1120('0x8'):_0x56d73[_0x1120('0x5')];this[_0x1120('0x9')]=_0x56d73[_0x1120('0x9')];this['countcongestionretry']=_0x56d73[_0x1120('0xa')];this[_0x1120('0xb')]=_0x56d73[_0x1120('0xb')];this[_0x1120('0xc')]=_0x56d73['countbusyretry']+_0x56d73[_0x1120('0xa')]+_0x56d73['countnoanswerretry']+_0x56d73[_0x1120('0xd')]+_0x56d73[_0x1120('0xe')]+_0x56d73[_0x1120('0xf')]+_0x56d73[_0x1120('0x10')]+_0x56d73[_0x1120('0x11')];this['countnosuchnumberretry']=_0x56d73[_0x1120('0xd')];this[_0x1120('0xe')]=_0x56d73['countdropretry'];this['countabandonedretry']=_0x56d73[_0x1120('0xf')];this[_0x1120('0x10')]=_0x56d73[_0x1120('0x10')];this[_0x1120('0x11')]=_0x56d73[_0x1120('0x11')];this['uniqueid']=_0x1e3985['uniqueid'];this[_0x1120('0x12')]=_0x56d73['name'];this[_0x1120('0x13')]=_0x56d73[_0x1120('0x14')];this[_0x1120('0x15')]=_0x56d73[_0x1120('0x15')];this['responsetime']=_0x56d73[_0x1120('0x16')];this[_0x1120('0x17')]=_0x56d73['answertime'];this[_0x1120('0x18')]=moment()[_0x1120('0x19')](_0x1120('0x1a'));this[_0x1120('0x1b')]=utils[_0x1120('0x1c')](_0x56d73[_0x1120('0x16')],_0x56d73['starttime']);this[_0x1120('0x1d')]=utils[_0x1120('0x1c')](_0x56d73[_0x1120('0x17')],_0x56d73[_0x1120('0x16')]);this[_0x1120('0x1e')]=utils[_0x1120('0x1c')](this[_0x1120('0x18')],_0x56d73[_0x1120('0x17')]);this[_0x1120('0x8')]=_0x1e3985[_0x1120('0x8')];this[_0x1120('0x1f')]=_0x1e3985[_0x1120('0x1f')];this[_0x1120('0x20')]=_0x1e3985[_0x1120('0x20')];this[_0x1120('0x21')]=_0x56d73[_0x1120('0x21')];this[_0x1120('0x22')]=_0x56d73['callbackuniqueid'];this['callbackat']=_0x56d73[_0x1120('0x23')];this[_0x1120('0x24')]=_0x56d73['recallme'];this[_0x1120('0x25')]=_0x56d73[_0x1120('0x25')];this[_0x1120('0x26')]=_0x56d73['ListId'];this[_0x1120('0x27')]=_0x56d73[_0x1120('0x27')];this[_0x1120('0x28')]=_0x56d73[_0x1120('0x28')];this[_0x1120('0x29')]=_0x56d73[_0x1120('0x29')];this[_0x1120('0x2a')]=_0x56d73['originatecalleridnum']||'';this[_0x1120('0x2b')]=_0x56d73[_0x1120('0x2b')]||'';this[_0x1120('0x2c')]=_0x56d73[_0x1120('0x2c')];}module[_0x1120('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 88ada58..baf4555 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30d6=['uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x30d6,0xd8));var _0x630d=function(_0x372129,_0x539547){_0x372129=_0x372129-0x0;var _0x2385b4=_0x30d6[_0x372129];return _0x2385b4;};'use strict';function Final(_0x11db91){this['uniqueid']=_0x11db91[_0x630d('0x0')];this['scheduledat']=_0x11db91[_0x630d('0x1')];this['type']=_0x11db91[_0x630d('0x2')];this[_0x630d('0x3')]=_0x11db91[_0x630d('0x2')]===_0x630d('0x4')?'queue':_0x11db91[_0x630d('0x2')];this[_0x630d('0x5')]=_0x11db91[_0x630d('0x5')];this[_0x630d('0x6')]=_0x11db91['countcongestionretry'];this[_0x630d('0x7')]=_0x11db91[_0x630d('0x7')];this[_0x630d('0x8')]=_0x11db91[_0x630d('0x5')]+_0x11db91['countcongestionretry']+_0x11db91[_0x630d('0x7')]+_0x11db91[_0x630d('0x9')]+_0x11db91[_0x630d('0xa')]+_0x11db91[_0x630d('0xb')]+_0x11db91['countmachineretry']+_0x11db91[_0x630d('0xc')];this[_0x630d('0x9')]=_0x11db91[_0x630d('0x9')];this['countdropretry']=_0x11db91[_0x630d('0xa')];this['countabandonedretry']=_0x11db91['countabandonedretry'];this[_0x630d('0xd')]=_0x11db91[_0x630d('0xd')];this[_0x630d('0xc')]=_0x11db91['countagentrejectretry'];this[_0x630d('0xe')]=_0x11db91[_0x630d('0xe')];this['calleridname']=_0x11db91[_0x630d('0xf')];this[_0x630d('0x10')]=_0x11db91['calleridnum'];this[_0x630d('0x11')]=_0x11db91[_0x630d('0x11')];this[_0x630d('0x12')]=_0x11db91[_0x630d('0x12')];this[_0x630d('0x13')]=_0x11db91[_0x630d('0x12')];this[_0x630d('0x14')]=_0x11db91[_0x630d('0x14')]||0x0;this[_0x630d('0x15')]=_0x11db91[_0x630d('0x15')]||0x0;this[_0x630d('0x16')]=_0x11db91[_0x630d('0x16')]||0x0;this['callback']=_0x11db91[_0x630d('0x17')];this[_0x630d('0x18')]=_0x11db91[_0x630d('0x18')];this['callbackat']=_0x11db91[_0x630d('0x19')];this['recallme']=_0x11db91[_0x630d('0x1a')];this['ContactId']=_0x11db91[_0x630d('0x1b')];this['ListId']=_0x11db91[_0x630d('0x1c')];this[_0x630d('0x1d')]=_0x11db91[_0x630d('0x1d')];this['VoiceQueueId']=_0x11db91[_0x630d('0x1e')];this['CampaignId']=_0x11db91['CampaignId'];this['originatecalleridnum']=_0x11db91[_0x630d('0x1f')]||'';this[_0x630d('0x20')]=_0x11db91[_0x630d('0x20')]||'';this[_0x630d('0x21')]=_0x11db91[_0x630d('0x21')];this[_0x630d('0x22')]=_0x11db91[_0x630d('0x22')];}module[_0x630d('0x23')]=Final; \ No newline at end of file +var _0x8c67=['endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime'];(function(_0x5c10fc,_0x1116d9){var _0x44391b=function(_0x2de5b2){while(--_0x2de5b2){_0x5c10fc['push'](_0x5c10fc['shift']());}};_0x44391b(++_0x1116d9);}(_0x8c67,0xe2));var _0x78c6=function(_0x3814ac,_0x3b5cc4){_0x3814ac=_0x3814ac-0x0;var _0x436e1f=_0x8c67[_0x3814ac];return _0x436e1f;};'use strict';function Final(_0x190796){this[_0x78c6('0x0')]=_0x190796['uniqueid'];this[_0x78c6('0x1')]=_0x190796[_0x78c6('0x1')];this['type']=_0x190796[_0x78c6('0x2')];this[_0x78c6('0x3')]=_0x190796[_0x78c6('0x2')]===_0x78c6('0x4')?_0x78c6('0x5'):_0x190796[_0x78c6('0x2')];this[_0x78c6('0x6')]=_0x190796[_0x78c6('0x6')];this['countcongestionretry']=_0x190796[_0x78c6('0x7')];this[_0x78c6('0x8')]=_0x190796[_0x78c6('0x8')];this[_0x78c6('0x9')]=_0x190796[_0x78c6('0x6')]+_0x190796['countcongestionretry']+_0x190796[_0x78c6('0x8')]+_0x190796['countnosuchnumberretry']+_0x190796[_0x78c6('0xa')]+_0x190796['countabandonedretry']+_0x190796['countmachineretry']+_0x190796[_0x78c6('0xb')];this[_0x78c6('0xc')]=_0x190796[_0x78c6('0xc')];this['countdropretry']=_0x190796[_0x78c6('0xa')];this[_0x78c6('0xd')]=_0x190796[_0x78c6('0xd')];this[_0x78c6('0xe')]=_0x190796[_0x78c6('0xe')];this[_0x78c6('0xb')]=_0x190796[_0x78c6('0xb')];this[_0x78c6('0x5')]=_0x190796[_0x78c6('0x5')];this[_0x78c6('0xf')]=_0x190796[_0x78c6('0xf')];this[_0x78c6('0x10')]=_0x190796[_0x78c6('0x10')];this[_0x78c6('0x11')]=_0x190796['starttime'];this['responsetime']=_0x190796[_0x78c6('0x12')];this[_0x78c6('0x13')]=_0x190796[_0x78c6('0x12')];this[_0x78c6('0x14')]=_0x190796[_0x78c6('0x14')]||0x0;this['holdtime']=_0x190796[_0x78c6('0x15')]||0x0;this[_0x78c6('0x16')]=_0x190796[_0x78c6('0x16')]||0x0;this[_0x78c6('0x17')]=_0x190796[_0x78c6('0x17')];this['callbackuniqueid']=_0x190796[_0x78c6('0x18')];this['callbackat']=_0x190796['callbackat'];this[_0x78c6('0x19')]=_0x190796[_0x78c6('0x19')];this[_0x78c6('0x1a')]=_0x190796[_0x78c6('0x1a')];this[_0x78c6('0x1b')]=_0x190796[_0x78c6('0x1b')];this[_0x78c6('0x1c')]=_0x190796[_0x78c6('0x1c')];this[_0x78c6('0x1d')]=_0x190796[_0x78c6('0x1d')];this[_0x78c6('0x1e')]=_0x190796[_0x78c6('0x1e')];this['originatecalleridnum']=_0x190796[_0x78c6('0x1f')]||'';this['originatecalleridname']=_0x190796['originatecalleridname']||'';this[_0x78c6('0x20')]=_0x190796[_0x78c6('0x20')];this[_0x78c6('0x21')]=_0x190796[_0x78c6('0x21')];}module[_0x78c6('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 36365f3..a101ea5 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf74=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','campaigntype','type','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime'];(function(_0x4415b1,_0x31b8e9){var _0x30e06c=function(_0x59c21b){while(--_0x59c21b){_0x4415b1['push'](_0x4415b1['shift']());}};_0x30e06c(++_0x31b8e9);}(_0xbf74,0x10f));var _0x4bf7=function(_0x1dc5c3,_0x1bea78){_0x1dc5c3=_0x1dc5c3-0x0;var _0x5e4b7e=_0xbf74[_0x1dc5c3];return _0x5e4b7e;};'use strict';var moment=require(_0x4bf7('0x0'));var utils=require(_0x4bf7('0x1'));function Hangup(_0x9bf184,_0x460aa3){this[_0x4bf7('0x2')]=0x4;this[_0x4bf7('0x3')]=_0x4bf7('0x4');this[_0x4bf7('0x5')]=_0x9bf184['scheduledat'];this['type']=_0x9bf184['type'];this[_0x4bf7('0x6')]=_0x9bf184[_0x4bf7('0x7')]==='outbound'?_0x4bf7('0x8'):_0x9bf184['type'];this[_0x4bf7('0x9')]=_0x9bf184['amd']||![];this['countbusyretry']=_0x9bf184[_0x4bf7('0xa')];this['countcongestionretry']=_0x9bf184['countcongestionretry'];this[_0x4bf7('0xb')]=_0x9bf184[_0x4bf7('0xb')];this[_0x4bf7('0xc')]=_0x9bf184['countbusyretry']+_0x9bf184[_0x4bf7('0xd')]+_0x9bf184[_0x4bf7('0xb')]+_0x9bf184[_0x4bf7('0xe')]+_0x9bf184[_0x4bf7('0xf')]+_0x9bf184[_0x4bf7('0x10')]+_0x9bf184[_0x4bf7('0x11')]+_0x9bf184[_0x4bf7('0x12')];this[_0x4bf7('0xe')]=_0x9bf184[_0x4bf7('0xe')];this[_0x4bf7('0xf')]=_0x9bf184[_0x4bf7('0xf')];this[_0x4bf7('0x10')]=_0x9bf184[_0x4bf7('0x10')];this[_0x4bf7('0x11')]=_0x9bf184[_0x4bf7('0x11')];this[_0x4bf7('0x12')]=_0x9bf184['countagentrejectretry'];this['uniqueid']=_0x460aa3['uniqueid'];this[_0x4bf7('0x13')]=_0x9bf184['name'];this[_0x4bf7('0x14')]=_0x9bf184[_0x4bf7('0x15')];this[_0x4bf7('0x16')]=_0x9bf184[_0x4bf7('0x16')];this[_0x4bf7('0x17')]=_0x9bf184[_0x4bf7('0x17')];this[_0x4bf7('0x18')]=moment()[_0x4bf7('0x19')](_0x4bf7('0x1a'));this[_0x4bf7('0x1b')]=utils[_0x4bf7('0x1c')](_0x9bf184[_0x4bf7('0x17')],_0x9bf184[_0x4bf7('0x16')]);this['holdtime']=0x0;this[_0x4bf7('0x1d')]=utils[_0x4bf7('0x1c')](this[_0x4bf7('0x18')],_0x9bf184[_0x4bf7('0x17')]);this['queue']=_0x9bf184[_0x4bf7('0x8')];this[_0x4bf7('0x1e')]=_0x4bf7('0x1f');this[_0x4bf7('0x20')]=_0x460aa3[_0x4bf7('0x21')];this[_0x4bf7('0x22')]=_0x9bf184[_0x4bf7('0x22')];this[_0x4bf7('0x23')]=_0x9bf184[_0x4bf7('0x23')];this[_0x4bf7('0x24')]=_0x9bf184[_0x4bf7('0x24')];this['recallme']=_0x9bf184[_0x4bf7('0x25')];this['ContactId']=_0x9bf184['ContactId'];this[_0x4bf7('0x26')]=_0x9bf184[_0x4bf7('0x26')];this['UserId']=_0x9bf184['UserId'];this[_0x4bf7('0x27')]=_0x9bf184[_0x4bf7('0x27')];this[_0x4bf7('0x28')]=_0x9bf184[_0x4bf7('0x28')];}module[_0x4bf7('0x29')]=Hangup; \ No newline at end of file +var _0x8eaa=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','IVR','reason','callback','callbackuniqueid','callbackat'];(function(_0x225504,_0x5806d6){var _0x1544ef=function(_0x1e8250){while(--_0x1e8250){_0x225504['push'](_0x225504['shift']());}};_0x1544ef(++_0x5806d6);}(_0x8eaa,0x157));var _0xa8ea=function(_0xafd5cd,_0x868023){_0xafd5cd=_0xafd5cd-0x0;var _0x1fd74c=_0x8eaa[_0xafd5cd];return _0x1fd74c;};'use strict';var moment=require('moment');var utils=require(_0xa8ea('0x0'));function Hangup(_0x4d872a,_0x4bc816){this[_0xa8ea('0x1')]=0x4;this[_0xa8ea('0x2')]=_0xa8ea('0x3');this['scheduledat']=_0x4d872a[_0xa8ea('0x4')];this['type']=_0x4d872a['type'];this['campaigntype']=_0x4d872a[_0xa8ea('0x5')]===_0xa8ea('0x6')?_0xa8ea('0x7'):_0x4d872a[_0xa8ea('0x5')];this[_0xa8ea('0x8')]=_0x4d872a[_0xa8ea('0x8')]||![];this[_0xa8ea('0x9')]=_0x4d872a['countbusyretry'];this[_0xa8ea('0xa')]=_0x4d872a[_0xa8ea('0xa')];this['countnoanswerretry']=_0x4d872a[_0xa8ea('0xb')];this[_0xa8ea('0xc')]=_0x4d872a[_0xa8ea('0x9')]+_0x4d872a['countcongestionretry']+_0x4d872a[_0xa8ea('0xb')]+_0x4d872a[_0xa8ea('0xd')]+_0x4d872a[_0xa8ea('0xe')]+_0x4d872a['countabandonedretry']+_0x4d872a[_0xa8ea('0xf')]+_0x4d872a[_0xa8ea('0x10')];this[_0xa8ea('0xd')]=_0x4d872a[_0xa8ea('0xd')];this[_0xa8ea('0xe')]=_0x4d872a[_0xa8ea('0xe')];this[_0xa8ea('0x11')]=_0x4d872a['countabandonedretry'];this[_0xa8ea('0xf')]=_0x4d872a[_0xa8ea('0xf')];this[_0xa8ea('0x10')]=_0x4d872a[_0xa8ea('0x10')];this['uniqueid']=_0x4bc816[_0xa8ea('0x12')];this['calleridname']=_0x4d872a[_0xa8ea('0x13')];this[_0xa8ea('0x14')]=_0x4d872a['number'];this[_0xa8ea('0x15')]=_0x4d872a[_0xa8ea('0x15')];this['responsetime']=_0x4d872a[_0xa8ea('0x16')];this[_0xa8ea('0x17')]=moment()[_0xa8ea('0x18')](_0xa8ea('0x19'));this[_0xa8ea('0x1a')]=utils['getSeconds'](_0x4d872a[_0xa8ea('0x16')],_0x4d872a['starttime']);this[_0xa8ea('0x1b')]=0x0;this[_0xa8ea('0x1c')]=utils[_0xa8ea('0x1d')](this['endtime'],_0x4d872a[_0xa8ea('0x16')]);this['queue']=_0x4d872a[_0xa8ea('0x7')];this['membername']=_0xa8ea('0x1e');this[_0xa8ea('0x1f')]=_0x4bc816['cause-txt'];this['callback']=_0x4d872a[_0xa8ea('0x20')];this[_0xa8ea('0x21')]=_0x4d872a[_0xa8ea('0x21')];this[_0xa8ea('0x22')]=_0x4d872a[_0xa8ea('0x22')];this[_0xa8ea('0x23')]=_0x4d872a[_0xa8ea('0x23')];this['ContactId']=_0x4d872a[_0xa8ea('0x24')];this['ListId']=_0x4d872a[_0xa8ea('0x25')];this[_0xa8ea('0x26')]=_0x4d872a['UserId'];this[_0xa8ea('0x27')]=_0x4d872a[_0xa8ea('0x27')];this['CampaignId']=_0x4d872a[_0xa8ea('0x28')];}module[_0xa8ea('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index b106e6a..8a1080f 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42ef=['campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','calleridnum','starttime','endtime','responsetime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x42ef,0x138));var _0xf42e=function(_0x1eadd5,_0x407ffa){_0x1eadd5=_0x1eadd5-0x0;var _0x5ac6a4=_0x42ef[_0x1eadd5];return _0x5ac6a4;};'use strict';var utils=require('../utils');function History(_0x313fe0){this[_0xf42e('0x0')]=_0x313fe0[_0xf42e('0x0')];this['scheduledat']=_0x313fe0[_0xf42e('0x1')]||undefined;this[_0xf42e('0x2')]=_0x313fe0[_0xf42e('0x2')];this[_0xf42e('0x3')]=_0x313fe0[_0xf42e('0x2')]==='outbound'?'queue':_0x313fe0['type'];this[_0xf42e('0x4')]=_0x313fe0['countbusyretry'];this[_0xf42e('0x5')]=_0x313fe0[_0xf42e('0x5')];this[_0xf42e('0x6')]=_0x313fe0[_0xf42e('0x6')];this[_0xf42e('0x7')]=_0x313fe0[_0xf42e('0x4')]+_0x313fe0[_0xf42e('0x5')]+_0x313fe0['countnoanswerretry']+_0x313fe0['countnosuchnumberretry']+_0x313fe0[_0xf42e('0x8')]+_0x313fe0[_0xf42e('0x9')]+_0x313fe0[_0xf42e('0xa')]+_0x313fe0[_0xf42e('0xb')];this[_0xf42e('0xc')]=_0x313fe0['countnosuchnumberretry'];this['countdropretry']=_0x313fe0[_0xf42e('0x8')];this['countabandonedretry']=_0x313fe0['countabandonedretry'];this[_0xf42e('0xa')]=_0x313fe0['countmachineretry'];this[_0xf42e('0xb')]=_0x313fe0[_0xf42e('0xb')];this[_0xf42e('0xd')]=_0x313fe0['queue'];this['calleridname']=_0x313fe0[_0xf42e('0xe')];this[_0xf42e('0xf')]=_0x313fe0['number'];this[_0xf42e('0x10')]=_0x313fe0[_0xf42e('0x10')];this['responsetime']=_0x313fe0['responsetime'];this[_0xf42e('0x11')]=_0x313fe0[_0xf42e('0x12')];this[_0xf42e('0x13')]=utils[_0xf42e('0x14')](_0x313fe0[_0xf42e('0x12')],_0x313fe0['starttime']);this[_0xf42e('0x15')]=0x0;this['talktime']=0x0;this[_0xf42e('0x16')]=_0x313fe0['callback'];this[_0xf42e('0x17')]=_0x313fe0['callbackuniqueid'];this[_0xf42e('0x18')]=_0x313fe0[_0xf42e('0x18')];this[_0xf42e('0x19')]=_0x313fe0[_0xf42e('0x19')];this[_0xf42e('0x1a')]=_0x313fe0[_0xf42e('0x1a')];this[_0xf42e('0x1b')]=_0x313fe0[_0xf42e('0x1b')];this[_0xf42e('0x1c')]=_0x313fe0[_0xf42e('0x1c')];this['VoiceQueueId']=_0x313fe0['VoiceQueueId'];this['CampaignId']=_0x313fe0[_0xf42e('0x1d')];this[_0xf42e('0x1e')]=_0x313fe0['originatecalleridnum']||'';this[_0xf42e('0x1f')]=_0x313fe0[_0xf42e('0x1f')]||'';this['state']=_0x313fe0[_0xf42e('0x20')];this[_0xf42e('0x21')]=_0x313fe0[_0xf42e('0x21')];}module[_0xf42e('0x22')]=History; \ No newline at end of file +var _0x3eba=['statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3eba,0x6b));var _0xa3eb=function(_0x1a698f,_0x470fcd){_0x1a698f=_0x1a698f-0x0;var _0x57e694=_0x3eba[_0x1a698f];return _0x57e694;};'use strict';var utils=require('../utils');function History(_0xb97fa9){this[_0xa3eb('0x0')]=_0xb97fa9[_0xa3eb('0x0')];this['scheduledat']=_0xb97fa9[_0xa3eb('0x1')]||undefined;this[_0xa3eb('0x2')]=_0xb97fa9[_0xa3eb('0x2')];this[_0xa3eb('0x3')]=_0xb97fa9['type']===_0xa3eb('0x4')?_0xa3eb('0x5'):_0xb97fa9[_0xa3eb('0x2')];this[_0xa3eb('0x6')]=_0xb97fa9[_0xa3eb('0x6')];this['countcongestionretry']=_0xb97fa9['countcongestionretry'];this[_0xa3eb('0x7')]=_0xb97fa9[_0xa3eb('0x7')];this['countglobal']=_0xb97fa9['countbusyretry']+_0xb97fa9['countcongestionretry']+_0xb97fa9[_0xa3eb('0x7')]+_0xb97fa9[_0xa3eb('0x8')]+_0xb97fa9[_0xa3eb('0x9')]+_0xb97fa9['countabandonedretry']+_0xb97fa9[_0xa3eb('0xa')]+_0xb97fa9[_0xa3eb('0xb')];this[_0xa3eb('0x8')]=_0xb97fa9[_0xa3eb('0x8')];this[_0xa3eb('0x9')]=_0xb97fa9[_0xa3eb('0x9')];this[_0xa3eb('0xc')]=_0xb97fa9[_0xa3eb('0xc')];this[_0xa3eb('0xa')]=_0xb97fa9[_0xa3eb('0xa')];this[_0xa3eb('0xb')]=_0xb97fa9['countagentrejectretry'];this['queue']=_0xb97fa9['queue'];this[_0xa3eb('0xd')]=_0xb97fa9['name'];this['calleridnum']=_0xb97fa9[_0xa3eb('0xe')];this[_0xa3eb('0xf')]=_0xb97fa9['starttime'];this[_0xa3eb('0x10')]=_0xb97fa9[_0xa3eb('0x10')];this[_0xa3eb('0x11')]=_0xb97fa9['responsetime'];this[_0xa3eb('0x12')]=utils[_0xa3eb('0x13')](_0xb97fa9[_0xa3eb('0x10')],_0xb97fa9['starttime']);this['holdtime']=0x0;this[_0xa3eb('0x14')]=0x0;this[_0xa3eb('0x15')]=_0xb97fa9[_0xa3eb('0x15')];this[_0xa3eb('0x16')]=_0xb97fa9['callbackuniqueid'];this['callbackat']=_0xb97fa9[_0xa3eb('0x17')];this[_0xa3eb('0x18')]=_0xb97fa9[_0xa3eb('0x18')];this[_0xa3eb('0x19')]=_0xb97fa9[_0xa3eb('0x19')];this[_0xa3eb('0x1a')]=_0xb97fa9[_0xa3eb('0x1a')];this[_0xa3eb('0x1b')]=_0xb97fa9[_0xa3eb('0x1b')];this[_0xa3eb('0x1c')]=_0xb97fa9[_0xa3eb('0x1c')];this['CampaignId']=_0xb97fa9[_0xa3eb('0x1d')];this[_0xa3eb('0x1e')]=_0xb97fa9[_0xa3eb('0x1e')]||'';this[_0xa3eb('0x1f')]=_0xb97fa9[_0xa3eb('0x1f')]||'';this[_0xa3eb('0x20')]=_0xb97fa9[_0xa3eb('0x20')];this[_0xa3eb('0x21')]=_0xb97fa9['statedesc'];}module[_0xa3eb('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 8b619b7..7fc7b91 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f77=['recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x0f77,0x65));var _0x70f7=function(_0x170a9f,_0x5ecb4a){_0x170a9f=_0x170a9f-0x0;var _0x9be5af=_0x0f77[_0x170a9f];return _0x9be5af;};'use strict';var utils=require(_0x70f7('0x0'));function QueueCallerAbandon(_0x1b8235,_0xa0ce59){this[_0x70f7('0x1')]=_0x1b8235[_0x70f7('0x1')];this[_0x70f7('0x2')]=_0x1b8235[_0x70f7('0x2')];this[_0x70f7('0x3')]=_0x1b8235[_0x70f7('0x2')]===_0x70f7('0x4')?_0x70f7('0x5'):_0x1b8235['type'];this['countbusyretry']=_0x1b8235['countbusyretry'];this[_0x70f7('0x6')]=_0x1b8235[_0x70f7('0x6')];this[_0x70f7('0x7')]=_0x1b8235[_0x70f7('0x7')];this[_0x70f7('0x8')]=_0x1b8235[_0x70f7('0x9')]+_0x1b8235[_0x70f7('0x6')]+_0x1b8235[_0x70f7('0x7')]+_0x1b8235[_0x70f7('0xa')]+_0x1b8235[_0x70f7('0xb')]+_0x1b8235[_0x70f7('0xc')]+_0x1b8235['countmachineretry']+_0x1b8235[_0x70f7('0xd')];this['countnosuchnumberretry']=_0x1b8235[_0x70f7('0xa')];this[_0x70f7('0xb')]=_0x1b8235[_0x70f7('0xb')];this[_0x70f7('0xc')]=_0x1b8235[_0x70f7('0xc')];this[_0x70f7('0xe')]=_0x1b8235[_0x70f7('0xe')];this['countagentrejectretry']=_0x1b8235['countagentrejectretry'];this[_0x70f7('0xf')]=_0xa0ce59[_0x70f7('0xf')];this[_0x70f7('0x10')]=_0x1b8235[_0x70f7('0x11')];this['calleridnum']=_0x1b8235[_0x70f7('0x12')];this[_0x70f7('0x13')]=_0x1b8235[_0x70f7('0x13')];this[_0x70f7('0x14')]=_0x1b8235['responsetime'];this[_0x70f7('0x15')]=_0x1b8235[_0x70f7('0x15')];this[_0x70f7('0x16')]=_0x1b8235[_0x70f7('0x16')];this[_0x70f7('0x17')]=this[_0x70f7('0x15')];this[_0x70f7('0x18')]=utils[_0x70f7('0x19')](_0x1b8235[_0x70f7('0x14')],_0x1b8235['starttime']);this[_0x70f7('0x1a')]=utils[_0x70f7('0x19')](this['droptime'],_0x1b8235['responsetime']);this[_0x70f7('0x1b')]=0x0;this[_0x70f7('0x5')]=_0xa0ce59[_0x70f7('0x5')];this[_0x70f7('0x1c')]=_0xa0ce59[_0x70f7('0x1d')];this[_0x70f7('0x1e')]=_0xa0ce59['reason'];this[_0x70f7('0x1f')]=_0x1b8235[_0x70f7('0x1f')];this['callbackuniqueid']=_0x1b8235[_0x70f7('0x20')];this[_0x70f7('0x21')]=_0x1b8235[_0x70f7('0x21')];this[_0x70f7('0x22')]=_0x1b8235['recallme'];this[_0x70f7('0x23')]=_0x1b8235['ContactId'];this[_0x70f7('0x24')]=_0x1b8235[_0x70f7('0x24')];this[_0x70f7('0x25')]=_0x1b8235['UserId'];this['VoiceQueueId']=_0x1b8235['VoiceQueueId'];this[_0x70f7('0x26')]=_0x1b8235[_0x70f7('0x26')];this['originatecalleridnum']=_0x1b8235[_0x70f7('0x27')]||'';this['originatecalleridname']=_0x1b8235[_0x70f7('0x28')]||'';this[_0x70f7('0x29')]=_0x1b8235['agiafterat'];this[_0x70f7('0x2a')]=_0x1b8235[_0x70f7('0x2a')];this[_0x70f7('0x2b')]=_0x1b8235[_0x70f7('0x2b')];}module[_0x70f7('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x1dbb=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','state','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry'];(function(_0x5c7883,_0x2d0e2e){var _0x2e4777=function(_0x86e0cc){while(--_0x86e0cc){_0x5c7883['push'](_0x5c7883['shift']());}};_0x2e4777(++_0x2d0e2e);}(_0x1dbb,0x18b));var _0xb1db=function(_0x5bce3d,_0x9a2abc){_0x5bce3d=_0x5bce3d-0x0;var _0x1ee0b3=_0x1dbb[_0x5bce3d];return _0x1ee0b3;};'use strict';var utils=require(_0xb1db('0x0'));function QueueCallerAbandon(_0x30457a,_0x55d674){this['scheduledat']=_0x30457a[_0xb1db('0x1')];this[_0xb1db('0x2')]=_0x30457a[_0xb1db('0x2')];this[_0xb1db('0x3')]=_0x30457a[_0xb1db('0x2')]===_0xb1db('0x4')?_0xb1db('0x5'):_0x30457a[_0xb1db('0x2')];this['countbusyretry']=_0x30457a[_0xb1db('0x6')];this[_0xb1db('0x7')]=_0x30457a['countcongestionretry'];this[_0xb1db('0x8')]=_0x30457a[_0xb1db('0x8')];this[_0xb1db('0x9')]=_0x30457a[_0xb1db('0x6')]+_0x30457a[_0xb1db('0x7')]+_0x30457a[_0xb1db('0x8')]+_0x30457a[_0xb1db('0xa')]+_0x30457a[_0xb1db('0xb')]+_0x30457a['countabandonedretry']+_0x30457a['countmachineretry']+_0x30457a[_0xb1db('0xc')];this[_0xb1db('0xa')]=_0x30457a[_0xb1db('0xa')];this[_0xb1db('0xb')]=_0x30457a[_0xb1db('0xb')];this[_0xb1db('0xd')]=_0x30457a[_0xb1db('0xd')];this['countmachineretry']=_0x30457a[_0xb1db('0xe')];this['countagentrejectretry']=_0x30457a['countagentrejectretry'];this[_0xb1db('0xf')]=_0x55d674[_0xb1db('0xf')];this[_0xb1db('0x10')]=_0x30457a[_0xb1db('0x11')];this[_0xb1db('0x12')]=_0x30457a[_0xb1db('0x13')];this[_0xb1db('0x14')]=_0x30457a['starttime'];this[_0xb1db('0x15')]=_0x30457a[_0xb1db('0x15')];this[_0xb1db('0x16')]=_0x30457a[_0xb1db('0x16')];this[_0xb1db('0x17')]=_0x30457a[_0xb1db('0x17')];this[_0xb1db('0x18')]=this['droptime'];this[_0xb1db('0x19')]=utils[_0xb1db('0x1a')](_0x30457a[_0xb1db('0x15')],_0x30457a['starttime']);this[_0xb1db('0x1b')]=utils[_0xb1db('0x1a')](this[_0xb1db('0x16')],_0x30457a[_0xb1db('0x15')]);this['talktime']=0x0;this['queue']=_0x55d674[_0xb1db('0x5')];this[_0xb1db('0x1c')]=_0x55d674[_0xb1db('0x1d')];this[_0xb1db('0x1e')]=_0x55d674[_0xb1db('0x1e')];this[_0xb1db('0x1f')]=_0x30457a['callback'];this['callbackuniqueid']=_0x30457a['callbackuniqueid'];this[_0xb1db('0x20')]=_0x30457a[_0xb1db('0x20')];this[_0xb1db('0x21')]=_0x30457a[_0xb1db('0x21')];this[_0xb1db('0x22')]=_0x30457a['ContactId'];this[_0xb1db('0x23')]=_0x30457a['ListId'];this['UserId']=_0x30457a['UserId'];this[_0xb1db('0x24')]=_0x30457a[_0xb1db('0x24')];this[_0xb1db('0x25')]=_0x30457a[_0xb1db('0x25')];this[_0xb1db('0x26')]=_0x30457a[_0xb1db('0x26')]||'';this['originatecalleridname']=_0x30457a['originatecalleridname']||'';this[_0xb1db('0x27')]=_0x30457a[_0xb1db('0x27')];this[_0xb1db('0x28')]=_0x30457a[_0xb1db('0x28')];this['statedesc']=_0x30457a['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 4e08055..94e1d5a 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x468033,_0x13fdf8){var _0x7151f9=function(_0x2c9d05){while(--_0x2c9d05){_0x468033['push'](_0x468033['shift']());}};_0x7151f9(++_0x13fdf8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4214da,_0x586705){_0x4214da=_0x4214da-0x0;var _0x64da0=_0xb10b[_0x4214da];return _0x64da0;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0xa9e0=['catch','temp','getContactDialer','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopperBlack','inspect','dialOrderByScheduledAt'];(function(_0x5ee9ca,_0x51eb9d){var _0x420a2d=function(_0x50c2fb){while(--_0x50c2fb){_0x5ee9ca['push'](_0x5ee9ca['shift']());}};_0x420a2d(++_0x51eb9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0a9e('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x333808){return util[_0x0a9e('0x4')](_0x333808,{'showHidden':![],'depth':null});}function getContactDialer(_0x2ab90b,_0x991246,_0x981158){return cmHopper['getContactDialer'](_0x2ab90b['id'],_0x991246,_0x981158,_0x2ab90b[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x2cc193){_0x2ab90b['temp']-=_0x981158;if(_0x2ab90b['temp']<0x0){_0x2ab90b[_0x0a9e('0x7')]=0x0;}logger['error']('[getContactDialer]',inspectError(_0x2cc193));});}exports[_0x0a9e('0x8')]=getContactDialer;function getContactDialerIvr(_0xf81284,_0x307b3e){return cmHopper[_0x0a9e('0x9')](_0xf81284['id'],_0x307b3e,_0xf81284[_0x0a9e('0x5')])[_0x0a9e('0x6')](function(_0x4a4c56){_0xf81284['temp']-=_0x307b3e;if(_0xf81284['temp']<0x0){_0xf81284['temp']=0x0;}logger[_0x0a9e('0xa')](_0x0a9e('0xb'),inspectError(_0x4a4c56));});}exports[_0x0a9e('0x9')]=getContactDialerIvr;function countReScheduled(_0x26d672){return cmHopper[_0x0a9e('0xc')](_0x26d672)[_0x0a9e('0x6')](function(_0x5db4b0){logger[_0x0a9e('0xa')](_0x0a9e('0xd'),inspectError(_0x5db4b0));});}exports[_0x0a9e('0xc')]=countReScheduled;function rescheduleContact(_0x281129){return cmHopper[_0x0a9e('0xe')](_0x281129)[_0x0a9e('0x6')](function(_0x52a03d){logger[_0x0a9e('0xa')]('[rescheduleContact]',inspectError(_0x52a03d));});}exports[_0x0a9e('0xe')]=rescheduleContact;function unlockContact(_0x519dfd,_0x16033c,_0x12066b){return cmHopper['unlockContact'](_0x519dfd,_0x16033c,_0x12066b)[_0x0a9e('0x6')](function(_0x5a0a06){logger[_0x0a9e('0xa')](_0x0a9e('0xf'),inspectError(_0x5a0a06));});}exports[_0x0a9e('0x10')]=unlockContact;function moveContactManagedDialer(_0x205fd6){return cmHopper[_0x0a9e('0x11')](_0x205fd6)[_0x0a9e('0x6')](function(_0x530eb7){logger[_0x0a9e('0xa')](_0x0a9e('0x12'),inspectError(_0x530eb7));});}exports[_0x0a9e('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x1c696a){return cmHopperBlack[_0x0a9e('0x13')](_0x1c696a)['catch'](function(_0x2c3407){logger[_0x0a9e('0xa')]('[checkIsBlackList]',inspectError(_0x2c3407));});}exports[_0x0a9e('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5a09ef){return cmHopperBlack['checkIsBlackListIvr'](_0x5a09ef)[_0x0a9e('0x6')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x14'),inspectError(_0x432e56));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return cmHopperAdditionalPhone[_0x0a9e('0x15')](_0xfb6e48,_0x2fb0e4,_0x3b45bc)[_0x0a9e('0x6')](function(_0x42ac8f){logger[_0x0a9e('0xa')]('[verifyAdditionalPhone]',inspectError(_0x42ac8f));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x197ec0,_0x3a8e58,_0x40c424){return cmHopperAdditionalPhone[_0x0a9e('0x16')](_0x197ec0,_0x3a8e58,_0x40c424)['catch'](function(_0x384319){logger['error'](_0x0a9e('0x17'),inspectError(_0x384319));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x1dc186){return cmHopperHistory[_0x0a9e('0x18')](_0x1dc186)[_0x0a9e('0x6')](function(_0x14433c){logger[_0x0a9e('0xa')](_0x0a9e('0x19'),inspectError(_0x14433c));});}exports[_0x0a9e('0x18')]=avgHandleTime;function createHistory(_0x14de77){return cmHopperHistory['createHistory'](_0x14de77)[_0x0a9e('0x6')](function(_0x468813){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),inspectError(_0x468813));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 2ba3774..2f9f901 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe237=['dialActive','active','isIVRCampaignActive','milliseconds','diff','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','unmonitored','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','util','dialer','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue'];(function(_0x1af26f,_0x2d9fe0){var _0x584374=function(_0x303d34){while(--_0x303d34){_0x1af26f['push'](_0x1af26f['shift']());}};_0x584374(++_0x2d9fe0);}(_0xe237,0x1a2));var _0x7e23=function(_0x247126,_0x5e6a3a){_0x247126=_0x247126-0x0;var _0x485479=_0xe237[_0x247126];return _0x485479;};'use strict';var _=require(_0x7e23('0x0'));var moment=require('moment');var util=require(_0x7e23('0x1'));var logger=require('../../../../config/logger')(_0x7e23('0x2'));var timezones=require('../../../../config/environment/shared')['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x7e23('0x3'),'BLACKLIST':_0x7e23('0x4'),'CONTACTS_RESCHEDULED':_0x7e23('0x5'),'DEACTIVATED':_0x7e23('0x6'),'DISACTIVED':_0x7e23('0x7'),'EMPTY_INTERVAL':_0x7e23('0x8'),'INACTIVE':_0x7e23('0x9'),'NO_AGENTS_LOGGED':_0x7e23('0xa'),'NO_AVAILABLE_CONTACTS':_0x7e23('0xb'),'NULL_INTERVAL':_0x7e23('0xc'),'OVERTIME_INTERVAL':_0x7e23('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x7e23('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x7e23('0xf'),'RUNNING':_0x7e23('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x7e23('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x47c526){return _0x47c526[_0x7e23('0x12')]===_0x7e23('0x13');}exports[_0x7e23('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x43c169){return _0x43c169['type']===_0x7e23('0x15');}exports[_0x7e23('0x16')]=isIVRCampaign;function isOutboundQueue(_0x3aa8d6){return _0x3aa8d6[_0x7e23('0x17')]===_0x7e23('0x18');}exports[_0x7e23('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x541099){return _0x541099[_0x7e23('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x400f57){return _0x400f57[_0x7e23('0x1b')];}exports[_0x7e23('0x1c')]=isIVRCampaignActive;function getSeconds(_0x23f57e,_0x11cb93){var _0x222fe6=moment(_0x23f57e)[_0x7e23('0x1d')](0x0);var _0x56b792=moment(_0x11cb93)[_0x7e23('0x1d')](0x0);return _0x222fe6[_0x7e23('0x1e')](_0x56b792,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4da0d4,_0x1d463b){var _0x417ec=![];var _0x24f4fc=_0x4da0d4[_0x7e23('0x12')]!==_0x1d463b[_0x7e23('0x12')]||_0x4da0d4[_0x7e23('0x1a')]!==_0x1d463b[_0x7e23('0x1a')]||_0x4da0d4[_0x7e23('0x1f')]!==_0x1d463b[_0x7e23('0x1f')];var _0x27bc04=_0x4da0d4[_0x7e23('0x20')]!==_0x1d463b[_0x7e23('0x20')]||_0x4da0d4['loggedIn']!==_0x1d463b[_0x7e23('0x21')]||_0x4da0d4['loggedInDb']!==_0x1d463b[_0x7e23('0x22')]||_0x4da0d4[_0x7e23('0x23')]!==_0x1d463b[_0x7e23('0x23')]||_0x4da0d4[_0x7e23('0x24')]!==_0x1d463b[_0x7e23('0x24')]||_0x4da0d4[_0x7e23('0x25')]!==_0x1d463b[_0x7e23('0x25')]||_0x4da0d4[_0x7e23('0x26')]!==_0x1d463b[_0x7e23('0x26')]||_0x4da0d4['inUse']!==_0x1d463b[_0x7e23('0x27')]||_0x4da0d4[_0x7e23('0x28')]!==_0x1d463b['originated'];if(_0x4da0d4[_0x7e23('0x29')]&&_0x1d463b[_0x7e23('0x29')]){_0x417ec=_0x4da0d4[_0x7e23('0x29')][_0x7e23('0x2a')]!==_0x1d463b[_0x7e23('0x29')]['name']||_0x4da0d4[_0x7e23('0x29')][_0x7e23('0x1b')]!==_0x1d463b['Trunk'][_0x7e23('0x1b')];}return _0x24f4fc||_0x27bc04||_0x417ec;}exports[_0x7e23('0x2b')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x18b19e){var _0x4f3d01=null;var _0x1e774c=_0x18b19e['dialTimezone'];if(_[_0x7e23('0x2c')](_0x18b19e[_0x7e23('0x2d')])||_[_0x7e23('0x2c')](_0x18b19e[_0x7e23('0x2e')])||_['isNil'](_0x18b19e[_0x7e23('0x2e')][_0x7e23('0x2f')])){_0x4f3d01=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x7e23('0x30')](_0x18b19e[_0x7e23('0x2d')])||_[_0x7e23('0x30')](_0x18b19e[_0x7e23('0x2e')][_0x7e23('0x2f')])){_0x4f3d01=CAMPAIGN_STATUS[_0x7e23('0x31')];}else if(_0x1e774c&&!timezones[_0x1e774c]){_0x4f3d01=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x4f3d01;}function checkAnyValidTrunk(_0x4349af,_0x35908d){var _0x10604c=null;var _0x4300c1='SIP/';var _0x17069c=['reachable',_0x7e23('0x32')];var _0x40ecbd=!![];if(_0x4349af[_0x7e23('0x29')]&&_0x4349af['Trunk']['active']){_0x4300c1+=_0x4349af['Trunk']['name'];_0x10604c=_0x35908d[_0x4300c1];_0x40ecbd=_0x17069c['includes'](_0x10604c['status']);}else if(_0x4349af['TrunkBackup']&&_0x4349af[_0x7e23('0x33')][_0x7e23('0x1b')]){_0x4300c1+=_0x4349af[_0x7e23('0x33')][_0x7e23('0x2a')];_0x10604c=_0x35908d[_0x4300c1];_0x40ecbd=_0x17069c['includes'](_0x10604c[_0x7e23('0x34')]);}return _0x40ecbd;}function getQueueCampaignStatusMessage(_0x50c391,_0x379ed6){var _0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x3')];var _0x3ef1dd=isPreviewCampaign(_0x50c391);if(!isQueueCampaignActive(_0x50c391)){if(_0x3ef1dd){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x35')];}else{if(_0x50c391[_0x7e23('0x28')]===0x0&&_0x50c391[_0x7e23('0x24')]===0x0&&_0x50c391['waiting']===0x0&&(_0x50c391['pTalking']||0x0)===0x0){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x35')];}else{_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x36')];}}}else if(_0x50c391[_0x7e23('0x21')]===0x0){_0x2d46ea=CAMPAIGN_STATUS[_0x7e23('0x37')];}else if(!checkAnyValidTrunk(_0x50c391,_0x379ed6)){_0x2d46ea=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x50c391)){var _0xc7aaa5=checkAnyValidQueueCampaignInterval(_0x50c391);if(_0xc7aaa5){_0x2d46ea=_0xc7aaa5;}}return _0x2d46ea;}exports[_0x7e23('0x38')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x35562b){var _0x554c30=CAMPAIGN_STATUS[_0x7e23('0x36')];if(_0x35562b[_0x7e23('0x28')]===0x0&&_0x35562b[_0x7e23('0x24')]===0x0&&_0x35562b[_0x7e23('0x26')]===0x0&&(_0x35562b[_0x7e23('0x25')]||0x0)===0x0){_0x554c30=CAMPAIGN_STATUS[_0x7e23('0x35')];}return _0x554c30;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x147d16){var _0x49a4ec=_0x147d16['match'](/"(.*?)"/);return _0x49a4ec?_0x49a4ec[0x1]:_0x147d16;}exports[_0x7e23('0x39')]=extractCalleridName;function getCallerId(_0x39fc41,_0x2ac396,_0x3e91c0){if(!_[_0x7e23('0x3a')](_0x3e91c0)&&typeof _0x3e91c0===_0x7e23('0x3b')&&!_['isEmpty'](_0x3e91c0)){if(!_[_0x7e23('0x3a')](_0x2ac396)&&typeof _0x2ac396===_0x7e23('0x3b')&&!_['isEmpty'](_0x2ac396)){return util[_0x7e23('0x3c')](_0x7e23('0x3d'),_0x2ac396,_0x3e91c0);}return util[_0x7e23('0x3c')](_0x7e23('0x3d'),_0x3e91c0,_0x3e91c0);}if(!_['isUndefined'](_0x39fc41)&&typeof _0x39fc41==='string'&&!_['isEmpty'](_0x39fc41)){return _0x39fc41;}return'\x22\x22\x20<>';}exports[_0x7e23('0x3e')]=getCallerId;function getCallerIdRandom(_0x4c059c,_0x3a1ebf){var _0x535600;var _0x15a584;var _0x450e21;if(_0x3a1ebf<=0x0){_0x3a1ebf=0x1;}_0x535600=new RegExp(_0x7e23('0x3f')+_0x3a1ebf+'}$');_0x15a584=Math[_0x7e23('0x40')](0xa,_0x3a1ebf-0x1);_0x450e21=Math[_0x7e23('0x40')](0xa,_0x3a1ebf)-0x1;return util[_0x7e23('0x3c')]('%s',_[_0x7e23('0x41')](_0x4c059c,_0x535600,_[_0x7e23('0x42')](_0x15a584,_0x450e21)[_0x7e23('0x43')]()));}exports[_0x7e23('0x44')]=getCallerIdRandom;function decrementOriginate(_0x36e882){if(_0x36e882[_0x7e23('0x28')]&&_0x36e882[_0x7e23('0x28')]>0x0){_0x36e882['originated']-=0x1;}else{logger['error'](_0x7e23('0x45'));}}exports[_0x7e23('0x46')]=decrementOriginate;function checkContactEmpty(_0x2b5cfb){return _0x2b5cfb&&_0x2b5cfb['length']>0x0;}exports[_0x7e23('0x47')]=checkContactEmpty;function erlangb(_0x4fd234,_0x3c6bd2){if(_0x3c6bd2===0x0){return 0x0;}var _0x2a4ea2=0x1;for(var _0x280421=0x1;_0x280421<=_0x3c6bd2;_0x280421+=0x1){_0x2a4ea2=0x1+_0x2a4ea2*_0x280421/_0x4fd234;}return 0x1/_0x2a4ea2;}exports[_0x7e23('0x48')]=erlangb;function checkContactLowerLimitOriginate(_0x907f2b,_0x33d6ee,_0x6f533a){if(_0x33d6ee>_0x6f533a){for(var _0x30d50c=0x0;_0x30d50c<_0x33d6ee-_0x6f533a;_0x30d50c+=0x1){decrementOriginate(_0x907f2b);}}}exports[_0x7e23('0x49')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x782c=['INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','INACTIVE','pTalking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','erlangb','checkContactLowerLimitOriginate','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED'];(function(_0x108b05,_0x4f5d0d){var _0x21a060=function(_0x1643da){while(--_0x1643da){_0x108b05['push'](_0x108b05['shift']());}};_0x21a060(++_0x4f5d0d);}(_0x782c,0x18b));var _0xc782=function(_0xa26942,_0x214495){_0xa26942=_0xa26942-0x0;var _0x3c90d7=_0x782c[_0xa26942];return _0x3c90d7;};'use strict';var _=require(_0xc782('0x0'));var moment=require('moment');var util=require(_0xc782('0x1'));var logger=require(_0xc782('0x2'))(_0xc782('0x3'));var timezones=require(_0xc782('0x4'))[_0xc782('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xc782('0x6'),'BLACKLIST':_0xc782('0x7'),'CONTACTS_RESCHEDULED':_0xc782('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xc782('0x9'),'EMPTY_INTERVAL':_0xc782('0xa'),'INACTIVE':_0xc782('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xc782('0xc'),'NULL_INTERVAL':_0xc782('0xd'),'OVERTIME_INTERVAL':_0xc782('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xc782('0xf'),'QUEUE_RECALL':_0xc782('0x10'),'RECALL_TIMEOUT':_0xc782('0x11'),'RUNNING':_0xc782('0x12'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xc782('0x13')};exports[_0xc782('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2e704e){return _0x2e704e[_0xc782('0x15')]===_0xc782('0x16');}exports[_0xc782('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x1266fb){return _0x1266fb[_0xc782('0x18')]===_0xc782('0x19');}exports[_0xc782('0x1a')]=isIVRCampaign;function isOutboundQueue(_0x5863f3){return _0x5863f3['type']===_0xc782('0x1b');}exports[_0xc782('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x532e57){return _0x532e57[_0xc782('0x1d')];}exports[_0xc782('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x444af9){return _0x444af9[_0xc782('0x1f')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0xcad56,_0x198fd3){var _0x14b36e=moment(_0xcad56)['milliseconds'](0x0);var _0x1bdfd4=moment(_0x198fd3)[_0xc782('0x20')](0x0);return _0x14b36e[_0xc782('0x21')](_0x1bdfd4,_0xc782('0x22'));}exports[_0xc782('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x27e19a,_0x30120f){var _0x55709d=![];var _0x1bd8c2=_0x27e19a[_0xc782('0x15')]!==_0x30120f[_0xc782('0x15')]||_0x27e19a[_0xc782('0x1d')]!==_0x30120f[_0xc782('0x1d')]||_0x27e19a[_0xc782('0x24')]!==_0x30120f[_0xc782('0x24')];var _0x353166=_0x27e19a[_0xc782('0x25')]!==_0x30120f['available']||_0x27e19a['loggedIn']!==_0x30120f[_0xc782('0x26')]||_0x27e19a[_0xc782('0x27')]!==_0x30120f[_0xc782('0x27')]||_0x27e19a[_0xc782('0x28')]!==_0x30120f[_0xc782('0x28')]||_0x27e19a[_0xc782('0x29')]!==_0x30120f['talking']||_0x27e19a['pTalking']!==_0x30120f['pTalking']||_0x27e19a[_0xc782('0x2a')]!==_0x30120f[_0xc782('0x2a')]||_0x27e19a[_0xc782('0x2b')]!==_0x30120f[_0xc782('0x2b')]||_0x27e19a[_0xc782('0x2c')]!==_0x30120f[_0xc782('0x2c')];if(_0x27e19a[_0xc782('0x2d')]&&_0x30120f[_0xc782('0x2d')]){_0x55709d=_0x27e19a[_0xc782('0x2d')][_0xc782('0x2e')]!==_0x30120f['Trunk'][_0xc782('0x2e')]||_0x27e19a[_0xc782('0x2d')][_0xc782('0x1f')]!==_0x30120f['Trunk'][_0xc782('0x1f')];}return _0x1bd8c2||_0x353166||_0x55709d;}exports[_0xc782('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4b0eaa){var _0x29c915=null;var _0x92ea73=_0x4b0eaa['dialTimezone'];if(_[_0xc782('0x30')](_0x4b0eaa[_0xc782('0x31')])||_[_0xc782('0x30')](_0x4b0eaa[_0xc782('0x32')])||_[_0xc782('0x30')](_0x4b0eaa[_0xc782('0x32')][_0xc782('0x33')])){_0x29c915=CAMPAIGN_STATUS[_0xc782('0x34')];}else if(_[_0xc782('0x35')](_0x4b0eaa[_0xc782('0x31')])||_[_0xc782('0x35')](_0x4b0eaa[_0xc782('0x32')][_0xc782('0x33')])){_0x29c915=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x92ea73&&!timezones[_0x92ea73]){_0x29c915=CAMPAIGN_STATUS[_0xc782('0x36')];}return _0x29c915;}function checkAnyValidTrunk(_0x3ec47d,_0x247699){var _0x4e7b5f=null;var _0x35d06a=_0xc782('0x37');var _0x381a98=[_0xc782('0x38'),_0xc782('0x39')];var _0x1a2690=!![];if(_0x3ec47d['Trunk']&&_0x3ec47d[_0xc782('0x2d')][_0xc782('0x1f')]){_0x35d06a+=_0x3ec47d['Trunk']['name'];_0x4e7b5f=_0x247699[_0x35d06a];_0x1a2690=_0x381a98['includes'](_0x4e7b5f['status']);}else if(_0x3ec47d[_0xc782('0x3a')]&&_0x3ec47d[_0xc782('0x3a')]['active']){_0x35d06a+=_0x3ec47d['TrunkBackup']['name'];_0x4e7b5f=_0x247699[_0x35d06a];_0x1a2690=_0x381a98[_0xc782('0x3b')](_0x4e7b5f['status']);}return _0x1a2690;}function getQueueCampaignStatusMessage(_0x4777e7,_0x1fe905){var _0x34baea=CAMPAIGN_STATUS['ACTIVE'];var _0x5cce16=isPreviewCampaign(_0x4777e7);if(!isQueueCampaignActive(_0x4777e7)){if(_0x5cce16){_0x34baea=CAMPAIGN_STATUS[_0xc782('0x3c')];}else{if(_0x4777e7[_0xc782('0x2c')]===0x0&&_0x4777e7[_0xc782('0x29')]===0x0&&_0x4777e7['waiting']===0x0&&(_0x4777e7[_0xc782('0x3d')]||0x0)===0x0){_0x34baea=CAMPAIGN_STATUS[_0xc782('0x3c')];}else{_0x34baea=CAMPAIGN_STATUS[_0xc782('0x3e')];}}}else if(_0x4777e7[_0xc782('0x26')]===0x0){_0x34baea=CAMPAIGN_STATUS[_0xc782('0x3f')];}else if(!checkAnyValidTrunk(_0x4777e7,_0x1fe905)){_0x34baea=CAMPAIGN_STATUS[_0xc782('0x40')];}else if(!isPreviewCampaign(_0x4777e7)){var _0x133389=checkAnyValidQueueCampaignInterval(_0x4777e7);if(_0x133389){_0x34baea=_0x133389;}}return _0x34baea;}exports[_0xc782('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x170e49){var _0x58f7dc=CAMPAIGN_STATUS[_0xc782('0x3e')];if(_0x170e49['originated']===0x0&&_0x170e49[_0xc782('0x29')]===0x0&&_0x170e49[_0xc782('0x2a')]===0x0&&(_0x170e49[_0xc782('0x3d')]||0x0)===0x0){_0x58f7dc=CAMPAIGN_STATUS[_0xc782('0x3c')];}return _0x58f7dc;}exports[_0xc782('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x211275){var _0x297760=_0x211275[_0xc782('0x43')](/"(.*?)"/);return _0x297760?_0x297760[0x1]:_0x211275;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0xd5c2b4,_0x1fd432,_0x32c5d8){if(!_[_0xc782('0x44')](_0x32c5d8)&&typeof _0x32c5d8===_0xc782('0x45')&&!_[_0xc782('0x35')](_0x32c5d8)){if(!_['isUndefined'](_0x1fd432)&&typeof _0x1fd432==='string'&&!_[_0xc782('0x35')](_0x1fd432)){return util[_0xc782('0x46')](_0xc782('0x47'),_0x1fd432,_0x32c5d8);}return util[_0xc782('0x46')](_0xc782('0x47'),_0x32c5d8,_0x32c5d8);}if(!_[_0xc782('0x44')](_0xd5c2b4)&&typeof _0xd5c2b4===_0xc782('0x45')&&!_['isEmpty'](_0xd5c2b4)){return _0xd5c2b4;}return _0xc782('0x48');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x6b01da,_0xe97f18){var _0x1b07cb;var _0x4e6334;var _0x75dc4;if(_0xe97f18<=0x0){_0xe97f18=0x1;}_0x1b07cb=new RegExp(_0xc782('0x49')+_0xe97f18+'}$');_0x4e6334=Math[_0xc782('0x4a')](0xa,_0xe97f18-0x1);_0x75dc4=Math['pow'](0xa,_0xe97f18)-0x1;return util['format']('%s',_[_0xc782('0x4b')](_0x6b01da,_0x1b07cb,_[_0xc782('0x4c')](_0x4e6334,_0x75dc4)[_0xc782('0x4d')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0xb80d43){if(_0xb80d43[_0xc782('0x2c')]&&_0xb80d43['originated']>0x0){_0xb80d43['originated']-=0x1;}else{logger['error'](_0xc782('0x4e'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0xc6485c){return _0xc6485c&&_0xc6485c['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x431435,_0x536b5a){if(_0x536b5a===0x0){return 0x0;}var _0x4051ce=0x1;for(var _0x4d9902=0x1;_0x4d9902<=_0x536b5a;_0x4d9902+=0x1){_0x4051ce=0x1+_0x4051ce*_0x4d9902/_0x431435;}return 0x1/_0x4051ce;}exports[_0xc782('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x578564,_0x3b15fc,_0x2ad50c){if(_0x3b15fc>_0x2ad50c){for(var _0x505c46=0x0;_0x505c46<_0x3b15fc-_0x2ad50c;_0x505c46+=0x1){decrementOriginate(_0x578564);}}}exports[_0xc782('0x50')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index a64a7d1..cd28a8f 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(_0x29cb28,_0x28e555){var _0x4ea33b=function(_0xbec6dd){while(--_0xbec6dd){_0x29cb28['push'](_0x29cb28['shift']());}};_0x4ea33b(++_0x28e555);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x378d3b,_0x19318b){var _0x39bb34=function(_0x368b7b){while(--_0x368b7b){_0x378d3b['push'](_0x378d3b['shift']());}};_0x39bb34(++_0x19318b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 3029e78..2b8473f 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 _0xc741=['FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','isTrunkReachable','[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','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','../../../config/logger','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','bind','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','syncNewchannel','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','.pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send'];(function(_0x4b8f4a,_0x30d9f6){var _0x3d84db=function(_0x231607){while(--_0x231607){_0x4b8f4a['push'](_0x4b8f4a['shift']());}};_0x3d84db(++_0x30d9f6);}(_0xc741,0x99));var _0x1c74=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc741[_0x36c5b0];return _0xf19333;};'use strict';var util=require('util');var _=require(_0x1c74('0x0'));var BPromise=require(_0x1c74('0x1'));var uuid=require(_0x1c74('0x2'));var moment=require(_0x1c74('0x3'));var path=require('path');var tiff2pdf=require(_0x1c74('0x4'));var gs=require('./util/gs');var logger=require(_0x1c74('0x5'))('fax');var ami=require(_0x1c74('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x1c74('0x7'));var ut=require(_0x1c74('0x8'));var Action=require(_0x1c74('0x9'));var faxAccount=require(_0x1c74('0xa'));var attachment=require(_0x1c74('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2b7755){this[_0x1c74('0xc')]={};this[_0x1c74('0xd')]=_0x2b7755['faxAccounts'];this[_0x1c74('0xe')]=_0x2b7755['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel'][_0x1c74('0xf')](this));ami['on']('varset',this[_0x1c74('0x10')][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x11'),this[_0x1c74('0x12')][_0x1c74('0xf')](this));ami['on']('newexten',this[_0x1c74('0x13')]['bind'](this));ami['on'](_0x1c74('0x14'),this['syncFaxStatus'][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x15'),this[_0x1c74('0x16')][_0x1c74('0xf')](this));ami['on'](_0x1c74('0x17'),this[_0x1c74('0x18')][_0x1c74('0xf')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x1c74('0xf')](this));}Fax[_0x1c74('0x19')][_0x1c74('0x1a')]=function(_0x593586){if(_0x593586[_0x1c74('0x1b')]==='from-voip-provider'){for(var _0x9ee805 in this[_0x1c74('0xd')]){if(this['faxAccounts'][_0x1c74('0x1c')](_0x9ee805)){if(_0x593586['exten']===this[_0x1c74('0xd')][_0x9ee805][_0x1c74('0x1d')]){this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]]={};this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x1f')]=_0x593586['channel'];this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]]['id']=this[_0x1c74('0xd')][_0x9ee805]['id'];this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x20')]=this[_0x1c74('0xd')][_0x9ee805][_0x1c74('0x20')];logger[_0x1c74('0x21')](_0x593586[_0x1c74('0x1e')],'\x20syncNewchannel\x20');}}}}if(this[_0x1c74('0x22')][_0x593586[_0x1c74('0x1e')]]){this['channels'][_0x593586[_0x1c74('0x1e')]]={};this[_0x1c74('0xc')][_0x593586[_0x1c74('0x1e')]][_0x1c74('0x1f')]=_0x593586[_0x1c74('0x1f')];logger[_0x1c74('0x21')](_0x593586[_0x1c74('0x1e')],_0x1c74('0x23'));}};Fax['prototype'][_0x1c74('0x10')]=function(_0x2694a6){if(this['channels'][_0x2694a6['uniqueid']]){for(var _0x25aa67 in _0x2694a6[_0x1c74('0x24')]){if(_0x2694a6['variable'][_0x1c74('0x1c')](_0x25aa67)){this[_0x1c74('0xc')][_0x2694a6[_0x1c74('0x1e')]][_0x25aa67]=_0x2694a6[_0x1c74('0x25')];}}}};Fax[_0x1c74('0x19')][_0x1c74('0x12')]=function(_0x464a8f){if(this['channels'][_0x464a8f[_0x1c74('0x1e')]]){this['channels'][_0x464a8f[_0x1c74('0x1e')]][_0x1c74('0x26')]=_0x464a8f[_0x1c74('0x26')];this[_0x1c74('0xc')][_0x464a8f[_0x1c74('0x1e')]]['channelstatedesc']=_0x464a8f[_0x1c74('0x27')];}};Fax[_0x1c74('0x19')][_0x1c74('0x13')]=function(_0x6559d0){if(this[_0x1c74('0xc')][_0x6559d0[_0x1c74('0x1e')]]){for(var _0x447a71 in _0x6559d0[_0x1c74('0x24')]){if(_0x6559d0['variable']['hasOwnProperty'](_0x447a71)){this[_0x1c74('0xc')][_0x6559d0['uniqueid']][_0x447a71]=_0x6559d0[_0x1c74('0x25')];}}}};Fax[_0x1c74('0x19')][_0x1c74('0x28')]=function(_0x145392){if(this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]]){this['channels'][_0x145392[_0x1c74('0x1e')]][_0x1c74('0x29')]=_0x145392[_0x1c74('0x29')];this[_0x1c74('0xc')][_0x145392['uniqueid']][_0x1c74('0x2a')]=_0x145392['status'];this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]][_0x1c74('0x1d')]=_0x145392[_0x1c74('0x1d')];this[_0x1c74('0xc')][_0x145392[_0x1c74('0x1e')]]['filename']=_0x145392['filename'];logger[_0x1c74('0x21')](_0x145392['uniqueid'],_0x1c74('0x2b'));}};Fax['prototype'][_0x1c74('0x16')]=function(_0x1bc71d){var _0x1b745e=this;if(this[_0x1c74('0xc')][_0x1bc71d['uniqueid']]){var _0x1cd106=this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]]['id'];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x2c')]=_0x1bc71d['remotestationid'];this[_0x1c74('0xc')][_0x1bc71d['uniqueid']][_0x1c74('0x2d')]=_0x1bc71d[_0x1c74('0x2d')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x1d')]=_0x1bc71d[_0x1c74('0x1d')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]]['resolution']=_0x1bc71d[_0x1c74('0x2e')];this['channels'][_0x1bc71d['uniqueid']][_0x1c74('0x2f')]=_0x1bc71d[_0x1c74('0x2f')];this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x30')]=_0x1bc71d['filename'];this[_0x1c74('0xc')][_0x1bc71d['uniqueid']][_0x1c74('0x31')]=_0x1bc71d['calleridnum'];if(this[_0x1c74('0xc')][_0x1bc71d[_0x1c74('0x1e')]][_0x1c74('0x2d')]>0x0){tiff2pdf(_0x1bc71d['filename'],_0x1c74('0x32'),function(_0x3f8c29){logger[_0x1c74('0x21')](_0x1bc71d[_0x1c74('0x1e')],'\x20result\x20conversion\x20file\x20',_0x3f8c29[_0x1c74('0x33')]);attachment['create']({'name':path[_0x1c74('0x34')](_0x1bc71d[_0x1c74('0x30')])['name'],'basename':path[_0x1c74('0x34')](_0x1bc71d[_0x1c74('0x30')])['name']+_0x1c74('0x35'),'type':'application/pdf'})[_0x1c74('0x36')](function(_0x1feae0){faxAccount[_0x1c74('0x37')](_0x1cd106,{'from':_0x1bc71d[_0x1c74('0x31')],'mapKey':'fax','body':path['parse'](_0x1bc71d[_0x1c74('0x30')])[_0x1c74('0x20')]+'.pdf','AttachmentId':_0x1feae0['id']})[_0x1c74('0x38')](function(_0x1beed0){logger[_0x1c74('0x39')](_0x1bc71d[_0x1c74('0x1e')],_0x1c74('0x3a'),JSON[_0x1c74('0x3b')](_0x1beed0));});})[_0x1c74('0x38')](function(_0x629532){logger[_0x1c74('0x39')](_0x1bc71d['uniqueid'],_0x1c74('0x3c'),JSON[_0x1c74('0x3b')](_0x629532));});});}logger[_0x1c74('0x21')](_0x1bc71d[_0x1c74('0x1e')],_0x1c74('0x3c'));}};Fax[_0x1c74('0x19')]['syncOriginateResponse']=function(_0x48eff4){if(this[_0x1c74('0x22')][_0x48eff4[_0x1c74('0x1e')]]){_[_0x1c74('0x3d')](this[_0x1c74('0xc')][_0x48eff4[_0x1c74('0x1e')]],_[_0x1c74('0x3e')](_0x48eff4,['response',_0x1c74('0x3f')]));}};function updateStatus(_0x586776){if(_0x586776[_0x1c74('0x40')]){faxMessage[_0x1c74('0x41')](_0x586776[_0x1c74('0x40')],{'failMessage':_0x1c74('0x42')})[_0x1c74('0x36')](function(_0x3f8190){ut[_0x1c74('0x43')](_0x1c74('0x44'),_0x3f8190);})[_0x1c74('0x38')](function(_0x2c12fe){ut[_0x1c74('0x43')](_0x1c74('0x45'),_0x2c12fe);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x1c74('0x46')]=function(_0x24178a,_0x426f86,_0x20b423){var _0x210755=this;var _0x3a06b9={};if(_0x426f86){_0x3a06b9={'read':_0x426f86};}else{_0x3a06b9={'failMessage':_0x20b423};}if(this[_0x1c74('0x22')][_0x24178a]['AttachmentId']){faxMessage[_0x1c74('0x41')](this[_0x1c74('0x22')][_0x24178a][_0x1c74('0x40')],_0x3a06b9)[_0x1c74('0x36')](function(_0x550565){ut[_0x1c74('0x43')](_0x1c74('0x47'),_0x550565);})[_0x1c74('0x38')](function(_0x33b14e){ut[_0x1c74('0x43')]('[Fax][Message][NoUpdate1]',_0x33b14e);})[_0x1c74('0x48')](function(){delete _0x210755['channels'][_0x24178a];delete _0x210755[_0x1c74('0x22')][_0x24178a];});}else{ut['logger'](_0x1c74('0x49'));delete this[_0x1c74('0xc')][_0x24178a];delete this['actions'][_0x24178a];}};Fax[_0x1c74('0x19')]['syncHangup']=function(_0x42cbe4){var _0xed721=this;if(this['channels'][_0x42cbe4[_0x1c74('0x1e')]]){if(this[_0x1c74('0x22')][_0x42cbe4[_0x1c74('0x1e')]]){this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]]['id']=this['actions'][_0x42cbe4[_0x1c74('0x1e')]]['id'];this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x20')]=this[_0x1c74('0x22')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x20')];}logger[_0x1c74('0x21')](_0x42cbe4[_0x1c74('0x1e')],this[_0x1c74('0x22')][_0x42cbe4['uniqueid']]?_0x1c74('0x4a'):_0x1c74('0x4b'),JSON[_0x1c74('0x3b')](this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]]));if(this['actions'][_0x42cbe4[_0x1c74('0x1e')]]){if(this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x4c')]>0x0&&this[_0x1c74('0xc')][_0x42cbe4['uniqueid']][_0x1c74('0x14')]===_0x1c74('0x4d')){this[_0x1c74('0x46')](_0x42cbe4[_0x1c74('0x1e')],!![]);}else{this[_0x1c74('0x46')](_0x42cbe4['uniqueid'],![],this[_0x1c74('0xc')][_0x42cbe4['uniqueid']][_0x1c74('0x4e')]?_0x1c74('0x4f')+this[_0x1c74('0xc')][_0x42cbe4[_0x1c74('0x1e')]][_0x1c74('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x1c74('0x19')][_0x1c74('0x50')]=function(_0x49c045){var _0xcf8007=this;return new BPromise(function(_0xb44389,_0x51a758){_0xcf8007['execOriginate'](_0x49c045,_0xcf8007[_0x1c74('0xd')][_0x49c045[_0x1c74('0x51')]])[_0x1c74('0x36')](function(_0x1ff375){ut['logger'](_0x1c74('0x52'),_0x1ff375);_0xb44389(ut['message'](_0x1c74('0x53')));})[_0x1c74('0x38')](function(_0x1ecf30){ut[_0x1c74('0x43')](_0x1c74('0x54'),_0x1ecf30);updateStatus(_0x49c045);_0x51a758(ut[_0x1c74('0x33')](_0x1c74('0x55')));});});};Fax[_0x1c74('0x19')][_0x1c74('0x56')]=function(_0x6d10ea){var _0x5327a3=this;return new BPromise(function(_0x34d579,_0x3ae483){var _0x2d83e6=_0x5327a3[_0x1c74('0x57')](_0x5327a3['faxAccounts'][_0x6d10ea['FaxAccountId']][_0x1c74('0x58')],_0x6d10ea);if(_0x2d83e6[_0x1c74('0x59')]){_0x34d579(ut[_0x1c74('0x33')](_0x1c74('0x5a')));}else{_0x3ae483(ut[_0x1c74('0x33')](_0x2d83e6[_0x1c74('0x33')]));}});};function originate(_0x1ae88e,_0x57935e,_0x284886){return new BPromise(function(_0x2fab95,_0xc5eb57){if(_0x284886){var _0x3d2c82=util['format'](_0x1c74('0x5b'),path[_0x1c74('0x34')](_0x1ae88e['path'])[_0x1c74('0x20')],_0x1ae88e[_0x1c74('0x5c')]);gs[_0x1c74('0x5d')](_0x3d2c82)[_0x1c74('0x36')](function(){_0x1ae88e[_0x1c74('0x5c')]=util[_0x1c74('0x5e')](_0x1c74('0x5f'),path['parse'](_0x1ae88e[_0x1c74('0x5c')])[_0x1c74('0x60')],path[_0x1c74('0x34')](_0x1ae88e[_0x1c74('0x5c')])[_0x1c74('0x20')]);_0x57935e[_0x1c74('0x61')]=_0x1ae88e['path'];ut[_0x1c74('0x43')](_0x1c74('0x62'),'');ami[_0x1c74('0x63')](ut[_0x1c74('0x64')](_0x1ae88e,_0x57935e))[_0x1c74('0x36')](function(_0x35883d){_0x2fab95(_0x35883d);})[_0x1c74('0x38')](function(_0x5ac5b1){_0xc5eb57(_0x5ac5b1);});})[_0x1c74('0x38')](function(_0x55b86b){_0xc5eb57(_0x55b86b);});}else{ami[_0x1c74('0x63')](ut['variablesAction'](_0x1ae88e,_0x57935e))[_0x1c74('0x36')](function(_0x28d51f){_0x2fab95(_0x28d51f);})['catch'](function(_0x2c6ded){_0xc5eb57(_0x2c6ded);});}});}Fax[_0x1c74('0x19')][_0x1c74('0x65')]=function(_0x5b128a,_0x30996f){var _0x4b95f1=this;return new BPromise(function(_0x47740b,_0x187848){var _0xfa0e3e=uuid['v4']();var _0x481f26=ut[_0x1c74('0x66')](_0x5b128a,_0x30996f);_0x4b95f1[_0x1c74('0x22')][_0xfa0e3e]=new Action(_0xfa0e3e,_0x30996f,_0x5b128a);var _0x52e1e1=_0x4b95f1[_0x1c74('0x22')][_0xfa0e3e];if(path['parse'](_0x5b128a['path'])[_0x1c74('0x67')]===_0x1c74('0x35')){originate(_0x52e1e1,_0x481f26,!![])['then'](function(_0x309c89){_0x47740b(_0x309c89);})[_0x1c74('0x38')](function(_0xd28941){_0x187848(_0xd28941);});}else{originate(_0x52e1e1,_0x481f26,![])[_0x1c74('0x36')](function(_0x1f85be){_0x47740b(_0x1f85be);})[_0x1c74('0x38')](function(_0x139130){_0x187848(_0x139130);});}});};Fax[_0x1c74('0x19')]['isTrunkReachable']=function(_0x2dfa7e){return!_[_0x1c74('0x68')](_0x2dfa7e)&&!_[_0x1c74('0x68')](_0x2dfa7e[_0x1c74('0x20')])&&!_[_0x1c74('0x68')](_0x2dfa7e[_0x1c74('0x69')])&&_0x2dfa7e[_0x1c74('0x69')]&&!_[_0x1c74('0x68')](this[_0x1c74('0xe')][util['format']('SIP/%s',_0x2dfa7e[_0x1c74('0x20')])])&&!_[_0x1c74('0x68')](this['trunks'][util[_0x1c74('0x5e')](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])]['status'])&&(this['trunks'][util[_0x1c74('0x5e')](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])][_0x1c74('0x2a')]==='reachable'||this['trunks'][util['format'](_0x1c74('0x6a'),_0x2dfa7e[_0x1c74('0x20')])][_0x1c74('0x2a')]==='unmonitored');};Fax[_0x1c74('0x19')]['checkTrunk']=function(_0x4cf019,_0x451742){if(!this[_0x1c74('0x6b')](_0x4cf019)){ut[_0x1c74('0x43')](_0x1c74('0x6c'),_[_0x1c74('0x68')](_0x4cf019)?'':_0x4cf019[_0x1c74('0x20')]+_0x1c74('0x6d'));return{'isValid':![],'message':_0x1c74('0x6e')};}if(_[_0x1c74('0x68')](_0x451742['fax'])){ut[_0x1c74('0x43')](_0x1c74('0x6f'),JSON[_0x1c74('0x3b')](_0x451742));return{'isValid':![],'message':_0x1c74('0x70')};}if(_[_0x1c74('0x68')](_0x451742[_0x1c74('0x5c')])){ut[_0x1c74('0x43')](_0x1c74('0x71'),JSON[_0x1c74('0x3b')](_0x451742));return{'isValid':![],'message':_0x1c74('0x72')};}return{'isValid':!![],'message':_0x1c74('0x73')};};module[_0x1c74('0x74')]=Fax; \ No newline at end of file +var _0x367c=['value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','./util/gs','../../../config/logger','fax','./rpcDb','./channel','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','hangup','syncHangup','originateresponse','syncOriginateResponse','context','localstationid','uniqueid','channel','channels','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty'];(function(_0x46f154,_0x6bd9ba){var _0x5e3b38=function(_0xf36d1e){while(--_0xf36d1e){_0x46f154['push'](_0x46f154['shift']());}};_0x5e3b38(++_0x6bd9ba);}(_0x367c,0xcb));var _0xc367=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x367c[_0x2bc3f4];return _0x14ac53;};'use strict';var util=require('util');var _=require(_0xc367('0x0'));var BPromise=require(_0xc367('0x1'));var uuid=require(_0xc367('0x2'));var moment=require(_0xc367('0x3'));var path=require(_0xc367('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xc367('0x5'));var logger=require(_0xc367('0x6'))(_0xc367('0x7'));var ami=require('../ami');var rpcDb=require(_0xc367('0x8'));var Channel=require(_0xc367('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc367('0xa'));var faxMessage=require(_0xc367('0xb'));function Fax(_0x21e7c5){this['channels']={};this[_0xc367('0xc')]=_0x21e7c5['faxAccounts'];this[_0xc367('0xd')]=_0x21e7c5[_0xc367('0xd')];this[_0xc367('0xe')]={};ami['on'](_0xc367('0xf'),this[_0xc367('0x10')][_0xc367('0x11')](this));ami['on'](_0xc367('0x12'),this[_0xc367('0x13')]['bind'](this));ami['on']('newstate',this[_0xc367('0x14')][_0xc367('0x11')](this));ami['on'](_0xc367('0x15'),this[_0xc367('0x16')][_0xc367('0x11')](this));ami['on'](_0xc367('0x17'),this['syncFaxStatus'][_0xc367('0x11')](this));ami['on']('receivefax',this['syncReceiveFax'][_0xc367('0x11')](this));ami['on'](_0xc367('0x18'),this[_0xc367('0x19')][_0xc367('0x11')](this));ami['on'](_0xc367('0x1a'),this[_0xc367('0x1b')][_0xc367('0x11')](this));}Fax['prototype']['syncNewchannel']=function(_0x56e27e){if(_0x56e27e[_0xc367('0x1c')]==='from-voip-provider'){for(var _0x1255b4 in this[_0xc367('0xc')]){if(this[_0xc367('0xc')]['hasOwnProperty'](_0x1255b4)){if(_0x56e27e['exten']===this[_0xc367('0xc')][_0x1255b4][_0xc367('0x1d')]){this['channels'][_0x56e27e[_0xc367('0x1e')]]={};this['channels'][_0x56e27e[_0xc367('0x1e')]][_0xc367('0x1f')]=_0x56e27e['channel'];this[_0xc367('0x20')][_0x56e27e['uniqueid']]['id']=this[_0xc367('0xc')][_0x1255b4]['id'];this[_0xc367('0x20')][_0x56e27e[_0xc367('0x1e')]]['name']=this['faxAccounts'][_0x1255b4][_0xc367('0x21')];logger[_0xc367('0x22')](_0x56e27e[_0xc367('0x1e')],_0xc367('0x23'));}}}}if(this[_0xc367('0xe')][_0x56e27e[_0xc367('0x1e')]]){this[_0xc367('0x20')][_0x56e27e[_0xc367('0x1e')]]={};this[_0xc367('0x20')][_0x56e27e[_0xc367('0x1e')]][_0xc367('0x1f')]=_0x56e27e['channel'];logger['info'](_0x56e27e['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xc367('0x24')][_0xc367('0x13')]=function(_0x28c90a){if(this[_0xc367('0x20')][_0x28c90a[_0xc367('0x1e')]]){for(var _0x2f9320 in _0x28c90a[_0xc367('0x25')]){if(_0x28c90a['variable'][_0xc367('0x26')](_0x2f9320)){this[_0xc367('0x20')][_0x28c90a['uniqueid']][_0x2f9320]=_0x28c90a[_0xc367('0x27')];}}}};Fax[_0xc367('0x24')][_0xc367('0x14')]=function(_0x59f5a8){if(this['channels'][_0x59f5a8[_0xc367('0x1e')]]){this[_0xc367('0x20')][_0x59f5a8[_0xc367('0x1e')]][_0xc367('0x28')]=_0x59f5a8[_0xc367('0x28')];this[_0xc367('0x20')][_0x59f5a8[_0xc367('0x1e')]][_0xc367('0x29')]=_0x59f5a8['channelstatedesc'];}};Fax[_0xc367('0x24')]['syncNewExten']=function(_0x4c3083){if(this[_0xc367('0x20')][_0x4c3083[_0xc367('0x1e')]]){for(var _0x5d6448 in _0x4c3083['variable']){if(_0x4c3083['variable']['hasOwnProperty'](_0x5d6448)){this['channels'][_0x4c3083[_0xc367('0x1e')]][_0x5d6448]=_0x4c3083[_0xc367('0x27')];}}}};Fax[_0xc367('0x24')][_0xc367('0x2a')]=function(_0x8f7853){if(this[_0xc367('0x20')][_0x8f7853['uniqueid']]){this[_0xc367('0x20')][_0x8f7853[_0xc367('0x1e')]][_0xc367('0x2b')]=_0x8f7853[_0xc367('0x2b')];this[_0xc367('0x20')][_0x8f7853['uniqueid']][_0xc367('0x2c')]=_0x8f7853[_0xc367('0x2c')];this['channels'][_0x8f7853[_0xc367('0x1e')]]['localstationid']=_0x8f7853[_0xc367('0x1d')];this[_0xc367('0x20')][_0x8f7853[_0xc367('0x1e')]][_0xc367('0x2d')]=_0x8f7853[_0xc367('0x2d')];logger[_0xc367('0x22')](_0x8f7853[_0xc367('0x1e')],_0xc367('0x2e'));}};Fax['prototype'][_0xc367('0x2f')]=function(_0x3f75e3){var _0x184b4b=this;if(this[_0xc367('0x20')][_0x3f75e3[_0xc367('0x1e')]]){var _0xd50390=this['channels'][_0x3f75e3[_0xc367('0x1e')]]['id'];this['channels'][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x30')]=_0x3f75e3[_0xc367('0x30')];this[_0xc367('0x20')][_0x3f75e3['uniqueid']][_0xc367('0x31')]=_0x3f75e3[_0xc367('0x31')];this[_0xc367('0x20')][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x1d')]=_0x3f75e3[_0xc367('0x1d')];this[_0xc367('0x20')][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x32')]=_0x3f75e3[_0xc367('0x32')];this[_0xc367('0x20')][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x33')]=_0x3f75e3['transferrate'];this['channels'][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x2d')]=_0x3f75e3[_0xc367('0x2d')];this[_0xc367('0x20')][_0x3f75e3['uniqueid']]['calleridnum']=_0x3f75e3[_0xc367('0x34')];if(this[_0xc367('0x20')][_0x3f75e3[_0xc367('0x1e')]][_0xc367('0x31')]>0x0){tiff2pdf(_0x3f75e3[_0xc367('0x2d')],_0xc367('0x35'),function(_0x4923a0){logger[_0xc367('0x22')](_0x3f75e3[_0xc367('0x1e')],_0xc367('0x36'),_0x4923a0[_0xc367('0x37')]);attachment[_0xc367('0x38')]({'name':path[_0xc367('0x39')](_0x3f75e3[_0xc367('0x2d')])[_0xc367('0x21')],'basename':path[_0xc367('0x39')](_0x3f75e3[_0xc367('0x2d')])[_0xc367('0x21')]+_0xc367('0x3a'),'type':_0xc367('0x3b')})[_0xc367('0x3c')](function(_0x317713){faxAccount[_0xc367('0x3d')](_0xd50390,{'from':_0x3f75e3[_0xc367('0x34')],'mapKey':'fax','body':path[_0xc367('0x39')](_0x3f75e3[_0xc367('0x2d')])[_0xc367('0x21')]+_0xc367('0x3a'),'AttachmentId':_0x317713['id']})[_0xc367('0x3e')](function(_0x211ee2){logger[_0xc367('0x3f')](_0x3f75e3[_0xc367('0x1e')],_0xc367('0x40'),JSON[_0xc367('0x41')](_0x211ee2));});})[_0xc367('0x3e')](function(_0x70598c){logger['error'](_0x3f75e3['uniqueid'],'\x20receiveFax\x20',JSON[_0xc367('0x41')](_0x70598c));});});}logger['info'](_0x3f75e3['uniqueid'],_0xc367('0x42'));}};Fax[_0xc367('0x24')]['syncOriginateResponse']=function(_0x267640){if(this[_0xc367('0xe')][_0x267640[_0xc367('0x1e')]]){_[_0xc367('0x43')](this['channels'][_0x267640[_0xc367('0x1e')]],_[_0xc367('0x44')](_0x267640,['response',_0xc367('0x45')]));}};function updateStatus(_0xfd10ae){if(_0xfd10ae[_0xc367('0x46')]){faxMessage[_0xc367('0x47')](_0xfd10ae[_0xc367('0x46')],{'failMessage':_0xc367('0x48')})[_0xc367('0x3c')](function(_0x48a437){ut[_0xc367('0x49')](_0xc367('0x4a'),_0x48a437);})['catch'](function(_0x35496b){ut[_0xc367('0x49')](_0xc367('0x4b'),_0x35496b);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xc367('0x24')][_0xc367('0x4c')]=function(_0x46555f,_0x143a6b,_0x556ad3){var _0x20d0b5=this;var _0x40b985={};if(_0x143a6b){_0x40b985={'read':_0x143a6b};}else{_0x40b985={'failMessage':_0x556ad3};}if(this[_0xc367('0xe')][_0x46555f][_0xc367('0x46')]){faxMessage[_0xc367('0x47')](this[_0xc367('0xe')][_0x46555f]['AttachmentId'],_0x40b985)[_0xc367('0x3c')](function(_0x1e3ea2){ut[_0xc367('0x49')]('[Fax][Message][Updated]',_0x1e3ea2);})[_0xc367('0x3e')](function(_0x3edb0e){ut[_0xc367('0x49')](_0xc367('0x4d'),_0x3edb0e);})[_0xc367('0x4e')](function(){delete _0x20d0b5['channels'][_0x46555f];delete _0x20d0b5['actions'][_0x46555f];});}else{ut[_0xc367('0x49')](_0xc367('0x4f'));delete this['channels'][_0x46555f];delete this[_0xc367('0xe')][_0x46555f];}};Fax[_0xc367('0x24')][_0xc367('0x19')]=function(_0x39912e){var _0xbfacf5=this;if(this[_0xc367('0x20')][_0x39912e[_0xc367('0x1e')]]){if(this[_0xc367('0xe')][_0x39912e['uniqueid']]){this[_0xc367('0x20')][_0x39912e['uniqueid']]['id']=this['actions'][_0x39912e[_0xc367('0x1e')]]['id'];this['channels'][_0x39912e['uniqueid']][_0xc367('0x21')]=this[_0xc367('0xe')][_0x39912e[_0xc367('0x1e')]][_0xc367('0x21')];}logger[_0xc367('0x22')](_0x39912e[_0xc367('0x1e')],this[_0xc367('0xe')][_0x39912e[_0xc367('0x1e')]]?_0xc367('0x50'):_0xc367('0x51'),JSON[_0xc367('0x41')](this['channels'][_0x39912e['uniqueid']]));if(this[_0xc367('0xe')][_0x39912e[_0xc367('0x1e')]]){if(this['channels'][_0x39912e['uniqueid']][_0xc367('0x52')]>0x0&&this[_0xc367('0x20')][_0x39912e['uniqueid']][_0xc367('0x17')]===_0xc367('0x53')){this[_0xc367('0x4c')](_0x39912e['uniqueid'],!![]);}else{this[_0xc367('0x4c')](_0x39912e[_0xc367('0x1e')],![],this['channels'][_0x39912e[_0xc367('0x1e')]][_0xc367('0x54')]?_0xc367('0x55')+this[_0xc367('0x20')][_0x39912e[_0xc367('0x1e')]][_0xc367('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xc367('0x24')][_0xc367('0x56')]=function(_0x3dcc51){var _0x3c36fa=this;return new BPromise(function(_0x51f07b,_0x3373c5){_0x3c36fa[_0xc367('0x57')](_0x3dcc51,_0x3c36fa['faxAccounts'][_0x3dcc51['FaxAccountId']])[_0xc367('0x3c')](function(_0x214034){ut[_0xc367('0x49')](_0xc367('0x58'),_0x214034);_0x51f07b(ut[_0xc367('0x37')](_0xc367('0x59')));})['catch'](function(_0x24bc2c){ut[_0xc367('0x49')]('[Fax][execOriginate][failure]',_0x24bc2c);updateStatus(_0x3dcc51);_0x3373c5(ut[_0xc367('0x37')](_0xc367('0x5a')));});});};Fax['prototype'][_0xc367('0x5b')]=function(_0x3931e0){var _0x159239=this;return new BPromise(function(_0x2f8836,_0x592e85){var _0x317d80=_0x159239[_0xc367('0x5c')](_0x159239[_0xc367('0xc')][_0x3931e0[_0xc367('0x5d')]][_0xc367('0x5e')],_0x3931e0);if(_0x317d80[_0xc367('0x5f')]){_0x2f8836(ut[_0xc367('0x37')](_0xc367('0x60')));}else{_0x592e85(ut['message'](_0x317d80[_0xc367('0x37')]));}});};function originate(_0xc2190,_0x53ed8b,_0x58f36f){return new BPromise(function(_0x281892,_0x1b8c57){if(_0x58f36f){var _0x2e8fdc=util[_0xc367('0x61')](_0xc367('0x62'),path[_0xc367('0x39')](_0xc2190[_0xc367('0x4')])['name'],_0xc2190[_0xc367('0x4')]);gs[_0xc367('0x63')](_0x2e8fdc)[_0xc367('0x3c')](function(){_0xc2190['path']=util[_0xc367('0x61')](_0xc367('0x64'),path[_0xc367('0x39')](_0xc2190['path'])[_0xc367('0x65')],path[_0xc367('0x39')](_0xc2190[_0xc367('0x4')])['name']);_0x53ed8b[_0xc367('0x66')]=_0xc2190[_0xc367('0x4')];ut[_0xc367('0x49')](_0xc367('0x67'),'');ami['Action'](ut[_0xc367('0x68')](_0xc2190,_0x53ed8b))[_0xc367('0x3c')](function(_0x5a0c61){_0x281892(_0x5a0c61);})[_0xc367('0x3e')](function(_0x236995){_0x1b8c57(_0x236995);});})[_0xc367('0x3e')](function(_0x167c26){_0x1b8c57(_0x167c26);});}else{ami[_0xc367('0x69')](ut['variablesAction'](_0xc2190,_0x53ed8b))[_0xc367('0x3c')](function(_0x34516f){_0x281892(_0x34516f);})[_0xc367('0x3e')](function(_0x2d69eb){_0x1b8c57(_0x2d69eb);});}});}Fax[_0xc367('0x24')][_0xc367('0x57')]=function(_0x46f893,_0x5a81ff){var _0x2d311d=this;return new BPromise(function(_0x596ba2,_0x4b437d){var _0x46b989=uuid['v4']();var _0x99859a=ut[_0xc367('0x6a')](_0x46f893,_0x5a81ff);_0x2d311d[_0xc367('0xe')][_0x46b989]=new Action(_0x46b989,_0x5a81ff,_0x46f893);var _0x261220=_0x2d311d[_0xc367('0xe')][_0x46b989];if(path[_0xc367('0x39')](_0x46f893['path'])[_0xc367('0x6b')]===_0xc367('0x3a')){originate(_0x261220,_0x99859a,!![])[_0xc367('0x3c')](function(_0x1e72df){_0x596ba2(_0x1e72df);})[_0xc367('0x3e')](function(_0x3f10d0){_0x4b437d(_0x3f10d0);});}else{originate(_0x261220,_0x99859a,![])[_0xc367('0x3c')](function(_0x118489){_0x596ba2(_0x118489);})[_0xc367('0x3e')](function(_0x204a34){_0x4b437d(_0x204a34);});}});};Fax[_0xc367('0x24')][_0xc367('0x6c')]=function(_0x26bdb8){return!_[_0xc367('0x6d')](_0x26bdb8)&&!_['isNil'](_0x26bdb8[_0xc367('0x21')])&&!_[_0xc367('0x6d')](_0x26bdb8[_0xc367('0x6e')])&&_0x26bdb8[_0xc367('0x6e')]&&!_[_0xc367('0x6d')](this[_0xc367('0xd')][util['format']('SIP/%s',_0x26bdb8[_0xc367('0x21')])])&&!_[_0xc367('0x6d')](this['trunks'][util[_0xc367('0x61')](_0xc367('0x6f'),_0x26bdb8[_0xc367('0x21')])][_0xc367('0x2c')])&&(this[_0xc367('0xd')][util[_0xc367('0x61')](_0xc367('0x6f'),_0x26bdb8[_0xc367('0x21')])][_0xc367('0x2c')]===_0xc367('0x70')||this[_0xc367('0xd')][util[_0xc367('0x61')](_0xc367('0x6f'),_0x26bdb8[_0xc367('0x21')])][_0xc367('0x2c')]===_0xc367('0x71'));};Fax[_0xc367('0x24')][_0xc367('0x5c')]=function(_0x25e0ab,_0x4981a2){if(!this[_0xc367('0x6c')](_0x25e0ab)){ut[_0xc367('0x49')](_0xc367('0x72'),_[_0xc367('0x6d')](_0x25e0ab)?'':_0x25e0ab[_0xc367('0x21')]+_0xc367('0x73'));return{'isValid':![],'message':_0xc367('0x74')};}if(_[_0xc367('0x6d')](_0x4981a2[_0xc367('0x7')])){ut[_0xc367('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc367('0x41')](_0x4981a2));return{'isValid':![],'message':_0xc367('0x75')};}if(_['isNil'](_0x4981a2[_0xc367('0x4')])){ut[_0xc367('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xc367('0x41')](_0x4981a2));return{'isValid':![],'message':_0xc367('0x76')};}return{'isValid':!![],'message':_0xc367('0x77')};};module[_0xc367('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 5714f5e..da2241d 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 _0xbcf5=['notify','resolve','then','catch','[Notify]\x20','util','../../../config/logger','error'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0xbcf5,0x8d));var _0x5bcf=function(_0x90ca5e,_0x180f9c){_0x90ca5e=_0x90ca5e-0x0;var _0x52c9b5=_0xbcf5[_0x90ca5e];return _0x52c9b5;};'use strict';var util=require(_0x5bcf('0x0'));var BPromise=require('bluebird');var logger=require(_0x5bcf('0x1'))('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5e7ed4){return function(_0x2a4eda){logger[_0x5bcf('0x2')](_0x5e7ed4,util['inspect'](_0x2a4eda,{'showHidden':![],'depth':null}));};}exports[_0x5bcf('0x3')]=function(_0x431d40,_0x2ed892){return BPromise[_0x5bcf('0x4')]()[_0x5bcf('0x5')](faxAccount[_0x5bcf('0x3')](_0x431d40,_0x2ed892))[_0x5bcf('0x6')](loggerCatch(_0x5bcf('0x7')));}; \ No newline at end of file +var _0xeea8=['resolve','then','catch','[Notify]\x20','../../../config/logger','preview','lodash','error','inspect','notify'];(function(_0x43dfc7,_0x27d176){var _0x3637c4=function(_0xc0c38b){while(--_0xc0c38b){_0x43dfc7['push'](_0x43dfc7['shift']());}};_0x3637c4(++_0x27d176);}(_0xeea8,0x14e));var _0x8eea=function(_0x726c4d,_0x25e618){_0x726c4d=_0x726c4d-0x0;var _0x309479=_0xeea8[_0x726c4d];return _0x309479;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x8eea('0x0'))(_0x8eea('0x1'));var _=require(_0x8eea('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x198540){return function(_0x453f5d){logger[_0x8eea('0x3')](_0x198540,util[_0x8eea('0x4')](_0x453f5d,{'showHidden':![],'depth':null}));};}exports[_0x8eea('0x5')]=function(_0x39e075,_0x4e2101){return BPromise[_0x8eea('0x6')]()[_0x8eea('0x7')](faxAccount[_0x8eea('0x5')](_0x39e075,_0x4e2101))[_0x8eea('0x8')](loggerCatch(_0x8eea('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7bc5ea3..46ae405 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 _0xf4e6=['execute','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x4db243,_0x364131){var _0x18a45e=function(_0x2b8a68){while(--_0x2b8a68){_0x4db243['push'](_0x4db243['shift']());}};_0x18a45e(++_0x364131);}(_0xf4e6,0x130));var _0x6f4e=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0xf4e6[_0x13187a];return _0x65b85f;};'use strict';var util=require(_0x6f4e('0x0'));var logger=require(_0x6f4e('0x1'))(_0x6f4e('0x2'));var BPromise=require(_0x6f4e('0x3'));var exec=require(_0x6f4e('0x4'))[_0x6f4e('0x5')];exports[_0x6f4e('0x6')]=function(_0x5c0bf9){return new BPromise(function(_0x1878a5,_0xdc9340){exec(_0x5c0bf9,function(_0x36ddc0,_0x41d075,_0x599ebe){logger[_0x6f4e('0x7')]('Exec\x20gs',_0x41d075);if(_0x36ddc0){logger[_0x6f4e('0x7')]('Exec\x20gs',_0x6f4e('0x8'),util[_0x6f4e('0x9')](_0x36ddc0,{'showHidden':![],'depth':null}),_0x41d075,_0x599ebe);_0xdc9340(_0x36ddc0);}_0x1878a5(_0x41d075);});});}; \ No newline at end of file +var _0xfa3e=['\x20Error\x20:','../../../../config/logger','fax','execute','info','Exec\x20gs'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfa3e,0x97));var _0xefa3=function(_0x254a46,_0x22d32b){_0x254a46=_0x254a46-0x0;var _0x2e87e3=_0xfa3e[_0x254a46];return _0x2e87e3;};'use strict';var util=require('util');var logger=require(_0xefa3('0x0'))(_0xefa3('0x1'));var BPromise=require('bluebird');var exec=require('child_process')['exec'];exports[_0xefa3('0x2')]=function(_0x507017){return new BPromise(function(_0x8154f0,_0x52041c){exec(_0x507017,function(_0x154ac2,_0x3773ed,_0x37c23d){logger[_0xefa3('0x3')](_0xefa3('0x4'),_0x3773ed);if(_0x154ac2){logger['info'](_0xefa3('0x4'),_0xefa3('0x5'),util['inspect'](_0x154ac2,{'showHidden':![],'depth':null}),_0x3773ed,_0x37c23d);_0x52041c(_0x154ac2);}_0x8154f0(_0x3773ed);});});}; \ 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 8aa0147..71191c9 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 _0x25ad=['headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','localstationid','util','moment','../../../../config/logger','fax','logger','info','inspect'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x25ad,0x1b1));var _0xd25a=function(_0x3d0c0a,_0x569519){_0x3d0c0a=_0x3d0c0a-0x0;var _0x338e0e=_0x25ad[_0x3d0c0a];return _0x338e0e;};'use strict';var util=require(_0xd25a('0x0'));var _=require('lodash');var moment=require(_0xd25a('0x1'));var logger=require(_0xd25a('0x2'))(_0xd25a('0x3'));exports['message']=function(_0x26b892){return{'message':_0x26b892};};exports[_0xd25a('0x4')]=function(_0x1532c5,_0x6a6a0d){logger[_0xd25a('0x5')](_0x1532c5,util[_0xd25a('0x6')](_0x6a6a0d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ca0db,_0x3694c6){var _0x330817={'XMF-ECM':_0x3694c6['ecm'],'XMF-HEADERINFO':_0x3694c6[_0xd25a('0x7')],'XMF-MINRATE':_0x3694c6[_0xd25a('0x8')],'XMF-MAXRATE':_0x3694c6[_0xd25a('0x9')],'XMF-MODEM':util[_0xd25a('0xa')](_0xd25a('0xb'),_0x3694c6[_0xd25a('0xc')]),'XMF-GATEWAY':_0x3694c6[_0xd25a('0xd')],'XMF-FAXDETECT':_0x3694c6['faxdetect'],'XMF-T38TIMEOUT':_0x3694c6[_0xd25a('0xe')],'XMF-LOCALSTATIONID':_0x3694c6['localstationid'],'XMF-PATH':_0x4ca0db[_0xd25a('0xf')]};return _0x330817;};exports['variablesAction']=function(_0x54b88c,_0x5a9a8e){return{'actionid':_0x54b88c[_0xd25a('0x10')],'action':_0xd25a('0x11'),'channel':_0x54b88c[_0xd25a('0x12')],'Exten':_0xd25a('0x13'),'Context':_0xd25a('0x14'),'Priority':'1','callerid':util[_0xd25a('0xa')]('\x22%s\x22\x20<%s>',_0x54b88c[_0xd25a('0x7')]?_0x54b88c[_0xd25a('0x7')]:'',_0x54b88c[_0xd25a('0x15')]),'variable':_0x5a9a8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x54b88c['uniqueid']};}; \ No newline at end of file +var _0xaadf=['util','lodash','moment','fax','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x46596a,_0x2a464e){var _0x17b8a6=function(_0xb5ae4a){while(--_0xb5ae4a){_0x46596a['push'](_0x46596a['shift']());}};_0x17b8a6(++_0x2a464e);}(_0xaadf,0x114));var _0xfaad=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xaadf[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0xfaad('0x0'));var _=require(_0xfaad('0x1'));var moment=require(_0xfaad('0x2'));var logger=require('../../../../config/logger')(_0xfaad('0x3'));exports['message']=function(_0x2caeb0){return{'message':_0x2caeb0};};exports[_0xfaad('0x4')]=function(_0x46d032,_0x3f5df8){logger[_0xfaad('0x5')](_0x46d032,util['inspect'](_0x3f5df8,{'showHidden':![],'depth':null}));};exports[_0xfaad('0x6')]=function(_0x3418ce,_0x125e10){var _0x443e49={'XMF-ECM':_0x125e10[_0xfaad('0x7')],'XMF-HEADERINFO':_0x125e10[_0xfaad('0x8')],'XMF-MINRATE':_0x125e10[_0xfaad('0x9')],'XMF-MAXRATE':_0x125e10[_0xfaad('0xa')],'XMF-MODEM':util[_0xfaad('0xb')](_0xfaad('0xc'),_0x125e10[_0xfaad('0xd')]),'XMF-GATEWAY':_0x125e10['gateway'],'XMF-FAXDETECT':_0x125e10[_0xfaad('0xe')],'XMF-T38TIMEOUT':_0x125e10[_0xfaad('0xf')],'XMF-LOCALSTATIONID':_0x125e10[_0xfaad('0x10')],'XMF-PATH':_0x3418ce[_0xfaad('0x11')]};return _0x443e49;};exports[_0xfaad('0x12')]=function(_0x195d69,_0x431715){return{'actionid':_0x195d69[_0xfaad('0x13')],'action':_0xfaad('0x14'),'channel':_0x195d69[_0xfaad('0x15')],'Exten':_0xfaad('0x16'),'Context':'from-sip','Priority':'1','callerid':util[_0xfaad('0xb')]('\x22%s\x22\x20<%s>',_0x195d69[_0xfaad('0x8')]?_0x195d69[_0xfaad('0x8')]:'',_0x195d69[_0xfaad('0x10')]),'variable':_0x431715,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x195d69[_0xfaad('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 447a18d..687fc86 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 _0x0551=['getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./server','./realtime','./acw','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initTelephones','getTrunks','initVoiceQueues','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions'];(function(_0x962814,_0x14e92e){var _0x2b404d=function(_0x459c97){while(--_0x459c97){_0x962814['push'](_0x962814['shift']());}};_0x2b404d(++_0x14e92e);}(_0x0551,0x15a));var _0x1055=function(_0x3ab0ac,_0x1ea9cf){_0x3ab0ac=_0x3ab0ac-0x0;var _0x1f743d=_0x0551[_0x3ab0ac];return _0x1f743d;};'use strict';var util=require(_0x1055('0x0'));var moment=require(_0x1055('0x1'));var server=require(_0x1055('0x2'));var Realtime=require(_0x1055('0x3'));var Report=require('./report');var Acw=require(_0x1055('0x4'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x1055('0x5'));var Fax=require(_0x1055('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x1055('0x7'));var voiceQueueReport=require(_0x1055('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x1055('0x9'));var trigger=require(_0x1055('0xa'));var template=require(_0x1055('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x1055('0xc'));var faxAccount=require(_0x1055('0xd'));var zendesk=require(_0x1055('0xe'));var salesforce=require(_0x1055('0xf'));var sugarcrm=require(_0x1055('0x10'));var freshdesk=require(_0x1055('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1055('0x12'));var freshsales=require(_0x1055('0x13'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x1055('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x1055('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x1055('0x16')](_0x1055('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x1055('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x1055('0x18')](user[_0x1055('0x19')]())[_0x1055('0x18')](realtime['initAgents']())[_0x1055('0x18')](user['getTelephones']())[_0x1055('0x18')](realtime[_0x1055('0x1a')]())[_0x1055('0x18')](trunk[_0x1055('0x1b')]())[_0x1055('0x18')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0x1055('0x18')](realtime[_0x1055('0x1c')]())['then'](trigger['getTriggers']())[_0x1055('0x18')](realtime['initTriggers']())[_0x1055('0x18')](template[_0x1055('0x1d')]())[_0x1055('0x18')](realtime['initTemplates']())['then'](zendesk[_0x1055('0x1e')]())['then'](realtime[_0x1055('0x1f')]())[_0x1055('0x18')](salesforce[_0x1055('0x20')]())[_0x1055('0x18')](realtime[_0x1055('0x21')]())[_0x1055('0x18')](sugarcrm[_0x1055('0x22')]())[_0x1055('0x18')](realtime['initSugarcrmAccounts']())[_0x1055('0x18')](freshdesk['getFreshdeskAccounts']())[_0x1055('0x18')](realtime[_0x1055('0x23')]())[_0x1055('0x18')](desk['getDeskAccounts']())[_0x1055('0x18')](realtime[_0x1055('0x24')]())[_0x1055('0x18')](zoho[_0x1055('0x25')]())['then'](realtime[_0x1055('0x26')]())[_0x1055('0x18')](vtiger[_0x1055('0x27')]())[_0x1055('0x18')](realtime[_0x1055('0x28')]())[_0x1055('0x18')](freshsales[_0x1055('0x29')]())[_0x1055('0x18')](realtime[_0x1055('0x2a')]())[_0x1055('0x18')](servicenow[_0x1055('0x2b')]())[_0x1055('0x18')](realtime[_0x1055('0x2c')]())['then'](dynamics365[_0x1055('0x2d')]())[_0x1055('0x18')](realtime['initDynamics365Accounts']())['then'](campaign[_0x1055('0x2e')]())[_0x1055('0x18')](realtime[_0x1055('0x2f')]())[_0x1055('0x18')](voiceExtension[_0x1055('0x30')]())[_0x1055('0x18')](realtime[_0x1055('0x31')]())[_0x1055('0x18')](faxAccount[_0x1055('0x32')]())[_0x1055('0x18')](realtime[_0x1055('0x33')]())[_0x1055('0x18')](function(){return realtime;});}function initParams(){return Promise[_0x1055('0x34')]()[_0x1055('0x18')](voiceQueueReport[_0x1055('0x35')]())[_0x1055('0x18')](realtime[_0x1055('0x36')]())[_0x1055('0x18')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x1055('0x18')](realtime[_0x1055('0x37')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x1055('0x18')](realtime[_0x1055('0x38')]())['then'](voiceCallReport[_0x1055('0x39')]())[_0x1055('0x18')](realtime[_0x1055('0x3a')]())[_0x1055('0x3b')](function(_0x20f142){logger[_0x1055('0x3c')](_0x1055('0x3d'),util['inspect'](_0x20f142,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1055('0x3e')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})[_0x1055('0x18')](function(){report[_0x1055('0x3f')]();setInterval(initRealtime,0x1388);})[_0x1055('0x3b')](function(_0x510ff9){logger[_0x1055('0x3c')](_0x1055('0x40'),util[_0x1055('0x41')](_0x510ff9,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5895=['./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5895,0x151));var _0x5589=function(_0xe4a0d4,_0x556cb8){_0xe4a0d4=_0xe4a0d4-0x0;var _0x1cfec6=_0x5895[_0xe4a0d4];return _0x1cfec6;};'use strict';var util=require('util');var moment=require(_0x5589('0x0'));var server=require(_0x5589('0x1'));var Realtime=require(_0x5589('0x2'));var Report=require('./report');var Acw=require(_0x5589('0x3'));var Trigger=require(_0x5589('0x4'));var Dialer=require(_0x5589('0x5'));var Preview=require(_0x5589('0x6'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x5589('0x7'));var voiceCallReport=require(_0x5589('0x8'));var trunk=require(_0x5589('0x9'));var trigger=require(_0x5589('0xa'));var template=require(_0x5589('0xb'));var cmHopperHistory=require(_0x5589('0xc'));var campaign=require(_0x5589('0xd'));var voiceExtension=require(_0x5589('0xe'));var faxAccount=require(_0x5589('0xf'));var zendesk=require(_0x5589('0x10'));var salesforce=require(_0x5589('0x11'));var sugarcrm=require(_0x5589('0x12'));var freshdesk=require(_0x5589('0x13'));var desk=require(_0x5589('0x14'));var zoho=require(_0x5589('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x5589('0x16'));var servicenow=require(_0x5589('0x17'));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(_0x5589('0x18'))(_0x5589('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x5589('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x5589('0x1a')](_0x5589('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x5589('0x1c')]()[_0x5589('0x1d')](user['getAgents']())[_0x5589('0x1d')](realtime[_0x5589('0x1e')]())[_0x5589('0x1d')](user[_0x5589('0x1f')]())['then'](realtime[_0x5589('0x20')]())[_0x5589('0x1d')](trunk['getTrunks']())[_0x5589('0x1d')](realtime['initTrunks']())[_0x5589('0x1d')](voiceQueue['getVoiceQueues']())[_0x5589('0x1d')](realtime['initVoiceQueues']())[_0x5589('0x1d')](trigger[_0x5589('0x21')]())[_0x5589('0x1d')](realtime['initTriggers']())[_0x5589('0x1d')](template['getTemplates']())['then'](realtime[_0x5589('0x22')]())[_0x5589('0x1d')](zendesk[_0x5589('0x23')]())[_0x5589('0x1d')](realtime['initZendeskAccounts']())[_0x5589('0x1d')](salesforce[_0x5589('0x24')]())[_0x5589('0x1d')](realtime[_0x5589('0x25')]())[_0x5589('0x1d')](sugarcrm[_0x5589('0x26')]())[_0x5589('0x1d')](realtime[_0x5589('0x27')]())[_0x5589('0x1d')](freshdesk[_0x5589('0x28')]())[_0x5589('0x1d')](realtime[_0x5589('0x29')]())[_0x5589('0x1d')](desk[_0x5589('0x2a')]())[_0x5589('0x1d')](realtime[_0x5589('0x2b')]())[_0x5589('0x1d')](zoho['getZohoAccounts']())[_0x5589('0x1d')](realtime[_0x5589('0x2c')]())[_0x5589('0x1d')](vtiger[_0x5589('0x2d')]())[_0x5589('0x1d')](realtime[_0x5589('0x2e')]())['then'](freshsales[_0x5589('0x2f')]())[_0x5589('0x1d')](realtime[_0x5589('0x30')]())[_0x5589('0x1d')](servicenow['getServicenowAccounts']())[_0x5589('0x1d')](realtime[_0x5589('0x31')]())[_0x5589('0x1d')](dynamics365[_0x5589('0x32')]())[_0x5589('0x1d')](realtime[_0x5589('0x33')]())[_0x5589('0x1d')](campaign[_0x5589('0x34')]())[_0x5589('0x1d')](realtime[_0x5589('0x35')]())[_0x5589('0x1d')](voiceExtension['getVoiceExtensions']())[_0x5589('0x1d')](realtime[_0x5589('0x36')]())[_0x5589('0x1d')](faxAccount[_0x5589('0x37')]())[_0x5589('0x1d')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x5589('0x1d')](voiceQueueReport[_0x5589('0x38')]())['then'](realtime[_0x5589('0x39')]())['then'](cmHopperHistory[_0x5589('0x3a')]())[_0x5589('0x1d')](realtime[_0x5589('0x3b')]())[_0x5589('0x1d')](cmHopperHistory[_0x5589('0x3c')]())[_0x5589('0x1d')](realtime[_0x5589('0x3d')]())['then'](voiceCallReport[_0x5589('0x3e')]())['then'](realtime[_0x5589('0x3f')]())[_0x5589('0x40')](function(_0x1f8dc8){logger[_0x5589('0x41')](_0x5589('0x42'),util[_0x5589('0x43')](_0x1f8dc8,{'showHidden':![],'depth':null}));});}function main(){return server[_0x5589('0x44')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x5589('0x1d')](function(){return initParams();})[_0x5589('0x1d')](function(){report[_0x5589('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x137799){logger[_0x5589('0x41')](_0x5589('0x46'),util[_0x5589('0x43')](_0x137799,{'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 a639691..28f8f02 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 _0xae24=['state','unknown','stateTime','status','address','mobile','interface','online','voiceStatusTime','voiceStatusQueue','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','user:%s','user:save','user:presence','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname'];(function(_0x35e534,_0x1652a9){var _0x4ea57f=function(_0xd8fae){while(--_0xd8fae){_0x35e534['push'](_0x35e534['shift']());}};_0x4ea57f(++_0x1652a9);}(_0xae24,0x180));var _0x4ae2=function(_0x26940b,_0x3fdb1d){_0x26940b=_0x26940b-0x0;var _0xdad58d=_0xae24[_0x26940b];return _0xdad58d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ae2('0x0'));var md5=require(_0x4ae2('0x1'));var Redis=require(_0x4ae2('0x2'));var config=require(_0x4ae2('0x3'));config[_0x4ae2('0x4')]=_[_0x4ae2('0x5')](config[_0x4ae2('0x4')],{'host':_0x4ae2('0x6'),'port':0x18eb});var io=require(_0x4ae2('0x7'))(new Redis(config[_0x4ae2('0x4')]));function Agent(_0x526b01){this['id']=_0x526b01['id']||0x0;this[_0x4ae2('0x8')]=_0x526b01[_0x4ae2('0x8')]||'';this[_0x4ae2('0x9')]=_0x526b01['email']||'';this['accountcode']=_0x526b01[_0x4ae2('0xa')]||'';this[_0x4ae2('0xb')]=_0x526b01[_0x4ae2('0xb')]||'';this[_0x4ae2('0xc')]=_0x4ae2('0xd');this[_0x4ae2('0xe')]=0x0;this[_0x4ae2('0xf')]=_0x4ae2('0xd');this[_0x4ae2('0x10')]='';this['phone']='';this[_0x4ae2('0x11')]='';this[_0x4ae2('0x12')]='';this['online']=_0x526b01[_0x4ae2('0x13')]||![];this['voiceStatus']=_0x4ae2('0xd');this[_0x4ae2('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x4ae2('0x15')]='';this['onhold']=![];this[_0x4ae2('0x16')]=![];this[_0x4ae2('0x1')]='';}Agent['prototype'][_0x4ae2('0x17')]=function(_0x401bd4){var _0xf73472;if(_0x401bd4&&_0x401bd4[_0x4ae2('0xc')]){_0xf73472=_0x401bd4[_0x4ae2('0xc')][_0x4ae2('0x18')]();switch(_0xf73472){case _0x4ae2('0x19'):_0xf73472=_0x4ae2('0x1a');break;case _0x4ae2('0x1b'):_0xf73472=_0x4ae2('0x1c');break;}}if(_0xf73472&&this[_0x4ae2('0x1d')]!==_0xf73472||_0x401bd4['statePause']){this[_0x4ae2('0x14')]=_[_0x4ae2('0x1e')](moment()[_0x4ae2('0x1f')]('x'));}if(_0xf73472){this['voiceStatus']=_0xf73472;}var _0x16f68b={'id':this['id'],'name':this['name'],'email':this[_0x4ae2('0x9')],'accountcode':this[_0x4ae2('0xa')],'fullname':this[_0x4ae2('0xb')],'state':this['state'],'stateTime':this[_0x4ae2('0xe')],'status':this[_0x4ae2('0xf')],'address':this[_0x4ae2('0x10')],'online':this[_0x4ae2('0x13')],'voiceStatus':this[_0x4ae2('0x1d')],'voiceStatusTime':this[_0x4ae2('0x14')],'voiceStatusCallerIdNumber':this[_0x4ae2('0x20')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x4ae2('0x12')],'onhold':this['onhold']};var _0x1eae9a=md5(JSON['stringify'](_0x16f68b));if(this[_0x4ae2('0x1')]!==_0x1eae9a){this[_0x4ae2('0x1')]=_0x1eae9a;io['to'](util['format'](_0x4ae2('0x21'),_0x16f68b[_0x4ae2('0x8')]))['emit'](_0x4ae2('0x22'),_0x16f68b);io['emit'](_0x4ae2('0x23'),_0x16f68b);}};module['exports']=Agent; \ No newline at end of file +var _0x0d78=['fullname','state','unknown','stateTime','status','address','mobile','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','toNumber','format','accountcode','online','interface','onhold','stringify','user:%s','emit','user:save','user:presence','exports','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','email'];(function(_0x672021,_0x2af115){var _0x7b4ffb=function(_0x586200){while(--_0x586200){_0x672021['push'](_0x672021['shift']());}};_0x7b4ffb(++_0x2af115);}(_0x0d78,0x134));var _0x80d7=function(_0x10dc5d,_0x4b62cc){_0x10dc5d=_0x10dc5d-0x0;var _0x2c1e6f=_0x0d78[_0x10dc5d];return _0x2c1e6f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require(_0x80d7('0x0'));var Redis=require('ioredis');var config=require(_0x80d7('0x1'));config[_0x80d7('0x2')]=_[_0x80d7('0x3')](config[_0x80d7('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x80d7('0x4'))(new Redis(config['redis']));function Agent(_0x3b22d0){this['id']=_0x3b22d0['id']||0x0;this[_0x80d7('0x5')]=_0x3b22d0[_0x80d7('0x5')]||'';this[_0x80d7('0x6')]=_0x3b22d0[_0x80d7('0x6')]||'';this['accountcode']=_0x3b22d0['accountcode']||'';this[_0x80d7('0x7')]=_0x3b22d0[_0x80d7('0x7')]||'';this[_0x80d7('0x8')]=_0x80d7('0x9');this[_0x80d7('0xa')]=0x0;this[_0x80d7('0xb')]=_0x80d7('0x9');this[_0x80d7('0xc')]='';this['phone']='';this[_0x80d7('0xd')]='';this['interface']='';this['online']=_0x3b22d0['online']||![];this[_0x80d7('0xe')]=_0x80d7('0x9');this[_0x80d7('0xf')]=0x0;this[_0x80d7('0x10')]='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0x80d7('0x0')]='';}Agent[_0x80d7('0x11')][_0x80d7('0x12')]=function(_0x5f3a23){var _0x485f2b;if(_0x5f3a23&&_0x5f3a23[_0x80d7('0x8')]){_0x485f2b=_0x5f3a23['state'][_0x80d7('0x13')]();switch(_0x485f2b){case'not_inuse':_0x485f2b=_0x80d7('0x14');break;case _0x80d7('0x15'):_0x485f2b=_0x80d7('0x16');break;}}if(_0x485f2b&&this['voiceStatus']!==_0x485f2b||_0x5f3a23['statePause']){this[_0x80d7('0xf')]=_[_0x80d7('0x17')](moment()[_0x80d7('0x18')]('x'));}if(_0x485f2b){this['voiceStatus']=_0x485f2b;}var _0x5697ed={'id':this['id'],'name':this[_0x80d7('0x5')],'email':this[_0x80d7('0x6')],'accountcode':this[_0x80d7('0x19')],'fullname':this[_0x80d7('0x7')],'state':this[_0x80d7('0x8')],'stateTime':this['stateTime'],'status':this[_0x80d7('0xb')],'address':this[_0x80d7('0xc')],'online':this[_0x80d7('0x1a')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x80d7('0xf')],'voiceStatusCallerIdNumber':this[_0x80d7('0x10')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x80d7('0x1b')],'onhold':this[_0x80d7('0x1c')]};var _0x42c2d6=md5(JSON[_0x80d7('0x1d')](_0x5697ed));if(this[_0x80d7('0x0')]!==_0x42c2d6){this['md5']=_0x42c2d6;io['to'](util[_0x80d7('0x18')](_0x80d7('0x1e'),_0x5697ed[_0x80d7('0x5')]))[_0x80d7('0x1f')](_0x80d7('0x20'),_0x5697ed);io[_0x80d7('0x1f')](_0x80d7('0x21'),_0x5697ed);}};module[_0x80d7('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 12127d1..68433c8 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 _0x7dbc=['dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x48646f,_0x54b3a7){var _0x2601cb=function(_0x4d8ee2){while(--_0x4d8ee2){_0x48646f['push'](_0x48646f['shift']());}};_0x2601cb(++_0x54b3a7);}(_0x7dbc,0x77));var _0xc7db=function(_0x57cd2a,_0x217d82){_0x57cd2a=_0x57cd2a-0x0;var _0x4cda43=_0x7dbc[_0x57cd2a];return _0x4cda43;};'use strict';function Campaign(_0x3b9e45){this['id']=_0x3b9e45['id']||0x0;this[_0xc7db('0x0')]=_0x3b9e45[_0xc7db('0x0')]||'';this[_0xc7db('0x1')]=_0x3b9e45[_0xc7db('0x1')]||_0xc7db('0x2');this[_0xc7db('0x3')]=0x0;this[_0xc7db('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xc7db('0x5')]=0x0;this[_0xc7db('0x6')]='';this[_0xc7db('0x7')]=!![];this['active']=_0x3b9e45['active'];this[_0xc7db('0x8')]=_0x3b9e45[_0xc7db('0x8')];this[_0xc7db('0x9')]=_0x3b9e45['dialTimezone']||null;this['dialGlobalInterval']=_0x3b9e45[_0xc7db('0xa')]?_0x3b9e45['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x3b9e45[_0xc7db('0xb')];this[_0xc7db('0xc')]=_0x3b9e45['dialOriginateCallerIdNumber'];this[_0xc7db('0xd')]=_0x3b9e45[_0xc7db('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x3b9e45['dialCongestionMaxRetry'];this[_0xc7db('0xe')]=_0x3b9e45[_0xc7db('0xe')];this['dialBusyMaxRetry']=_0x3b9e45[_0xc7db('0xf')];this['dialBusyRetryFrequency']=_0x3b9e45[_0xc7db('0x10')];this['dialNoAnswerMaxRetry']=_0x3b9e45[_0xc7db('0x11')];this[_0xc7db('0x12')]=_0x3b9e45['dialNoAnswerRetryFrequency'];this[_0xc7db('0x13')]=_0x3b9e45[_0xc7db('0x13')];this['dialNoSuchNumberMaxRetry']=_0x3b9e45[_0xc7db('0x14')]||0x3;this[_0xc7db('0x15')]=_0x3b9e45[_0xc7db('0x15')]||0x96;this[_0xc7db('0x16')]=_0x3b9e45['dialDropMaxRetry']||0x3;this[_0xc7db('0x17')]=_0x3b9e45['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x3b9e45['dialAbandonedMaxRetry']||0x3;this[_0xc7db('0x18')]=_0x3b9e45[_0xc7db('0x18')]||0x96;this[_0xc7db('0x19')]=_0x3b9e45['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x3b9e45[_0xc7db('0x1a')]||0x96;this[_0xc7db('0x1b')]=_0x3b9e45['dialAgentRejectMaxRetry']||0x3;this[_0xc7db('0x1c')]=_0x3b9e45['dialAgentRejectRetryFrequency']||0x96;this[_0xc7db('0x1d')]=_0x3b9e45['dialOrderByScheduledAt']||_0xc7db('0x1e');this[_0xc7db('0x1f')]=_0x3b9e45['dialPrefix']||undefined;this[_0xc7db('0x20')]=_0x3b9e45[_0xc7db('0x20')]||undefined;this[_0xc7db('0x21')]=_0x3b9e45['dialCutDigit']||undefined;this[_0xc7db('0x22')]=_0x3b9e45[_0xc7db('0x22')]?_0x3b9e45[_0xc7db('0x22')]:undefined;this[_0xc7db('0x23')]=_0x3b9e45[_0xc7db('0x23')]?_0x3b9e45[_0xc7db('0x23')]:undefined;this[_0xc7db('0x24')]=_0x3b9e45[_0xc7db('0x24')]?_0x3b9e45['Interval']:undefined;this[_0xc7db('0x25')]=_0x3b9e45[_0xc7db('0x25')]?_0x3b9e45[_0xc7db('0x25')]:undefined;this['dialQueueProject']=_0x3b9e45[_0xc7db('0x25')]?_0x3b9e45[_0xc7db('0x25')][_0xc7db('0x0')]:undefined;this[_0xc7db('0x26')]=_0x3b9e45[_0xc7db('0x26')]||![];this[_0xc7db('0x27')]=_0x3b9e45['dialAMDInitialSilence'];this[_0xc7db('0x28')]=_0x3b9e45['dialAMDGreeting'];this[_0xc7db('0x29')]=_0x3b9e45[_0xc7db('0x29')];this[_0xc7db('0x2a')]=_0x3b9e45[_0xc7db('0x2a')];this[_0xc7db('0x2b')]=_0x3b9e45[_0xc7db('0x2b')];this[_0xc7db('0x2c')]=_0x3b9e45[_0xc7db('0x2c')];this[_0xc7db('0x2d')]=_0x3b9e45[_0xc7db('0x2d')];this[_0xc7db('0x2e')]=_0x3b9e45['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3b9e45[_0xc7db('0x2f')];}module[_0xc7db('0x30')]=Campaign; \ No newline at end of file +var _0xda40=['exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x565a0b,_0x462b87){var _0x4f002b=function(_0x36aa32){while(--_0x36aa32){_0x565a0b['push'](_0x565a0b['shift']());}};_0x4f002b(++_0x462b87);}(_0xda40,0x189));var _0x0da4=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0xda40[_0x845505];return _0x2513b9;};'use strict';function Campaign(_0x4e4d5b){this['id']=_0x4e4d5b['id']||0x0;this[_0x0da4('0x0')]=_0x4e4d5b['name']||'';this['type']=_0x4e4d5b[_0x0da4('0x1')]||_0x0da4('0x2');this[_0x0da4('0x3')]=0x0;this[_0x0da4('0x4')]=0x0;this[_0x0da4('0x5')]=0x0;this[_0x0da4('0x6')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0da4('0x7')]=_0x4e4d5b[_0x0da4('0x7')];this['limitCalls']=_0x4e4d5b['limitCalls'];this[_0x0da4('0x8')]=_0x4e4d5b['dialTimezone']||null;this[_0x0da4('0x9')]=_0x4e4d5b[_0x0da4('0x9')]?_0x4e4d5b[_0x0da4('0x9')]:null;this[_0x0da4('0xa')]=_0x4e4d5b[_0x0da4('0xa')];this['dialOriginateCallerIdNumber']=_0x4e4d5b[_0x0da4('0xb')];this[_0x0da4('0xc')]=_0x4e4d5b[_0x0da4('0xc')]||0x1e;this[_0x0da4('0xd')]=_0x4e4d5b[_0x0da4('0xd')];this['dialCongestionRetryFrequency']=_0x4e4d5b[_0x0da4('0xe')];this['dialBusyMaxRetry']=_0x4e4d5b['dialBusyMaxRetry'];this[_0x0da4('0xf')]=_0x4e4d5b[_0x0da4('0xf')];this[_0x0da4('0x10')]=_0x4e4d5b[_0x0da4('0x10')];this[_0x0da4('0x11')]=_0x4e4d5b['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x4e4d5b[_0x0da4('0x12')];this[_0x0da4('0x13')]=_0x4e4d5b['dialNoSuchNumberMaxRetry']||0x3;this[_0x0da4('0x14')]=_0x4e4d5b[_0x0da4('0x14')]||0x96;this[_0x0da4('0x15')]=_0x4e4d5b[_0x0da4('0x15')]||0x3;this[_0x0da4('0x16')]=_0x4e4d5b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x4e4d5b[_0x0da4('0x17')]||0x3;this[_0x0da4('0x18')]=_0x4e4d5b[_0x0da4('0x18')]||0x96;this[_0x0da4('0x19')]=_0x4e4d5b[_0x0da4('0x19')]||0x3;this[_0x0da4('0x1a')]=_0x4e4d5b[_0x0da4('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x4e4d5b[_0x0da4('0x1b')]||0x3;this[_0x0da4('0x1c')]=_0x4e4d5b[_0x0da4('0x1c')]||0x96;this[_0x0da4('0x1d')]=_0x4e4d5b[_0x0da4('0x1d')]||_0x0da4('0x1e');this[_0x0da4('0x1f')]=_0x4e4d5b[_0x0da4('0x1f')]||undefined;this[_0x0da4('0x20')]=_0x4e4d5b[_0x0da4('0x20')]||undefined;this[_0x0da4('0x21')]=_0x4e4d5b[_0x0da4('0x21')]||undefined;this[_0x0da4('0x22')]=_0x4e4d5b[_0x0da4('0x22')]?_0x4e4d5b[_0x0da4('0x22')]:undefined;this[_0x0da4('0x23')]=_0x4e4d5b['Trunk']?_0x4e4d5b[_0x0da4('0x23')]:undefined;this[_0x0da4('0x24')]=_0x4e4d5b[_0x0da4('0x24')]?_0x4e4d5b[_0x0da4('0x24')]:undefined;this[_0x0da4('0x25')]=_0x4e4d5b[_0x0da4('0x25')]?_0x4e4d5b[_0x0da4('0x25')]:undefined;this[_0x0da4('0x26')]=_0x4e4d5b['SquareProject']?_0x4e4d5b[_0x0da4('0x25')]['name']:undefined;this[_0x0da4('0x27')]=_0x4e4d5b[_0x0da4('0x27')]||![];this[_0x0da4('0x28')]=_0x4e4d5b[_0x0da4('0x28')];this[_0x0da4('0x29')]=_0x4e4d5b[_0x0da4('0x29')];this[_0x0da4('0x2a')]=_0x4e4d5b['dialAMDAfterGreetingSilence'];this[_0x0da4('0x2b')]=_0x4e4d5b[_0x0da4('0x2b')];this[_0x0da4('0x2c')]=_0x4e4d5b[_0x0da4('0x2c')];this['dialAMDBetweenWordsSilence']=_0x4e4d5b['dialAMDBetweenWordsSilence'];this[_0x0da4('0x2d')]=_0x4e4d5b[_0x0da4('0x2d')];this[_0x0da4('0x2e')]=_0x4e4d5b[_0x0da4('0x2e')];this['dialAMDMaximumWordLength']=_0x4e4d5b[_0x0da4('0x2f')];}module[_0x0da4('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 21f9d97..4b69822 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 _0xdc36=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastdata','duration','holdtime','type','tag','disposition','monitorFilename'];(function(_0x1d1afc,_0xf849f5){var _0xf8db68=function(_0x168225){while(--_0x168225){_0x1d1afc['push'](_0x1d1afc['shift']());}};_0xf8db68(++_0xf849f5);}(_0xdc36,0x18c));var _0x6dc3=function(_0x3815ac,_0x4b3151){_0x3815ac=_0x3815ac-0x0;var _0x218cec=_0xdc36[_0x3815ac];return _0x218cec;};'use strict';function Channel(){this[_0x6dc3('0x0')]=null;this['channel']='';this[_0x6dc3('0x1')]='';this[_0x6dc3('0x2')]=0x0;this['calleridname']='';this[_0x6dc3('0x3')]=undefined;this[_0x6dc3('0x4')]=undefined;this[_0x6dc3('0x5')]=0x0;this['context']='';this[_0x6dc3('0x6')]=0x0;this[_0x6dc3('0x7')]=0x0;this[_0x6dc3('0x8')]=0x0;this['answered']=![];this[_0x6dc3('0x9')]=null;this[_0x6dc3('0xa')]=null;this[_0x6dc3('0xb')]=![];this[_0x6dc3('0xc')]=![];this['lastapplication']='';this[_0x6dc3('0xd')]='';this[_0x6dc3('0xe')]=0x0;this['billableseconds']=0x0;this[_0x6dc3('0xf')]=0x0;this[_0x6dc3('0x10')]=null;this[_0x6dc3('0x11')]=null;this[_0x6dc3('0x12')]=null;this['monitor']=![];this[_0x6dc3('0x13')]=null;this['queue']=null;this[_0x6dc3('0x14')]=[];this[_0x6dc3('0x15')]=undefined;this[_0x6dc3('0x16')]=undefined;this[_0x6dc3('0x17')]=undefined;this[_0x6dc3('0x18')]=0x0;}module[_0x6dc3('0x19')]=Channel; \ No newline at end of file +var _0x2ed4=['calleridname','connectedlinenum','connectedlinename','context','uniqueid','answered','endtime','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x48d74d,_0x5e295d){var _0x9431a3=function(_0xd1a2b3){while(--_0xd1a2b3){_0x48d74d['push'](_0x48d74d['shift']());}};_0x9431a3(++_0x5e295d);}(_0x2ed4,0xe6));var _0x42ed=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x2ed4[_0x3e6d5d];return _0x238923;};'use strict';function Channel(){this[_0x42ed('0x0')]=null;this[_0x42ed('0x1')]='';this[_0x42ed('0x2')]='';this[_0x42ed('0x3')]=0x0;this[_0x42ed('0x4')]='';this[_0x42ed('0x5')]=undefined;this[_0x42ed('0x6')]=undefined;this['accountcode']=0x0;this[_0x42ed('0x7')]='';this[_0x42ed('0x8')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x42ed('0x9')]=![];this['answertime']=null;this[_0x42ed('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x42ed('0xb')]='';this['lastdata']='';this[_0x42ed('0xc')]=0x0;this[_0x42ed('0xd')]=0x0;this[_0x42ed('0xe')]=0x0;this[_0x42ed('0xf')]=null;this[_0x42ed('0x10')]=null;this[_0x42ed('0x11')]=null;this[_0x42ed('0x12')]=![];this[_0x42ed('0x13')]=null;this['queue']=null;this[_0x42ed('0x14')]=[];this[_0x42ed('0x15')]=undefined;this[_0x42ed('0x16')]=undefined;this[_0x42ed('0x17')]=undefined;this[_0x42ed('0x18')]=0x0;}module[_0x42ed('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 71ebdc6..e690e4c 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 _0xb34d=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x167181,_0x119986){var _0x2f4ae0=function(_0x429527){while(--_0x429527){_0x167181['push'](_0x167181['shift']());}};_0x2f4ae0(++_0x119986);}(_0xb34d,0xd1));var _0xdb34=function(_0x33faf3,_0x5628a7){_0x33faf3=_0x33faf3-0x0;var _0x395766=_0xb34d[_0x33faf3];return _0x395766;};'use strict';function DeskAccount(_0x49db46){this['id']=_0x49db46['id']||0x0;this[_0xdb34('0x0')]=_0x49db46['name']||'';this[_0xdb34('0x1')]=_0x49db46[_0xdb34('0x1')]||'';this[_0xdb34('0x2')]=_0x49db46[_0xdb34('0x2')]||'';this['authType']=_0x49db46[_0xdb34('0x3')]||'';this[_0xdb34('0x4')]=_0x49db46['password']||'';this[_0xdb34('0x5')]=_0x49db46['consumerKey']||'';this['consumerSecret']=_0x49db46[_0xdb34('0x6')]||'';this['token']=_0x49db46[_0xdb34('0x7')]||'';this['tokenSecret']=_0x49db46[_0xdb34('0x8')]||'';this['type']=_0x49db46[_0xdb34('0x9')]||'';this[_0xdb34('0xa')]=_0x49db46[_0xdb34('0xa')]||'';this[_0xdb34('0xb')]=_0x49db46[_0xdb34('0xb')]||{};}module[_0xdb34('0xc')]=DeskAccount; \ No newline at end of file +var _0x8369=['exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8369,0x151));var _0x9836=function(_0x485e4f,_0x564bb2){_0x485e4f=_0x485e4f-0x0;var _0x561602=_0x8369[_0x485e4f];return _0x561602;};'use strict';function DeskAccount(_0x314584){this['id']=_0x314584['id']||0x0;this[_0x9836('0x0')]=_0x314584[_0x9836('0x0')]||'';this['username']=_0x314584[_0x9836('0x1')]||'';this[_0x9836('0x2')]=_0x314584['remoteUri']||'';this['authType']=_0x314584[_0x9836('0x3')]||'';this['password']=_0x314584[_0x9836('0x4')]||'';this['consumerKey']=_0x314584['consumerKey']||'';this[_0x9836('0x5')]=_0x314584[_0x9836('0x5')]||'';this[_0x9836('0x6')]=_0x314584['token']||'';this[_0x9836('0x7')]=_0x314584[_0x9836('0x7')]||'';this[_0x9836('0x8')]=_0x314584['type']||'';this[_0x9836('0x9')]=_0x314584[_0x9836('0x9')]||'';this['Configurations']=_0x314584[_0x9836('0xa')]||{};}module[_0x9836('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 afd1e31..089bb94 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 _0xf144=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x4971ac,_0x4a7b95){var _0x5d31cb=function(_0x4b1aa5){while(--_0x4b1aa5){_0x4971ac['push'](_0x4971ac['shift']());}};_0x5d31cb(++_0x4a7b95);}(_0xf144,0x9c));var _0x4f14=function(_0x3e8f8e,_0x50e78d){_0x3e8f8e=_0x3e8f8e-0x0;var _0x428d54=_0xf144[_0x3e8f8e];return _0x428d54;};'use strict';function Dynamics365Account(_0x1cb61c){this['id']=_0x1cb61c['id']||0x0;this[_0x4f14('0x0')]=_0x1cb61c[_0x4f14('0x0')]||'';this[_0x4f14('0x1')]=_0x1cb61c['username']||'';this[_0x4f14('0x2')]=_0x1cb61c['password']||'';this[_0x4f14('0x3')]=_0x1cb61c[_0x4f14('0x3')]||'';this[_0x4f14('0x4')]=_0x1cb61c[_0x4f14('0x4')]||'';this['clientId']=_0x1cb61c['clientId']||'';this[_0x4f14('0x5')]=_0x1cb61c[_0x4f14('0x5')]||{};this['serverUrl']=_0x1cb61c[_0x4f14('0x6')]||'';this[_0x4f14('0x7')]=_0x1cb61c['modernAuthentication']||![];this[_0x4f14('0x8')]=_0x1cb61c[_0x4f14('0x8')]||{};this[_0x4f14('0x9')]=_0x1cb61c[_0x4f14('0x9')]||{};}module[_0x4f14('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xde8c=['remoteUri','tenantId','clientSecret','modernAuthentication','Configurations','CloudProvider','name','username','password'];(function(_0xa8f776,_0x420cbf){var _0x435961=function(_0x241c69){while(--_0x241c69){_0xa8f776['push'](_0xa8f776['shift']());}};_0x435961(++_0x420cbf);}(_0xde8c,0xe7));var _0xcde8=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xde8c[_0x710815];return _0x5b3b89;};'use strict';function Dynamics365Account(_0x4e11ca){this['id']=_0x4e11ca['id']||0x0;this[_0xcde8('0x0')]=_0x4e11ca[_0xcde8('0x0')]||'';this[_0xcde8('0x1')]=_0x4e11ca[_0xcde8('0x1')]||'';this[_0xcde8('0x2')]=_0x4e11ca[_0xcde8('0x2')]||'';this['remoteUri']=_0x4e11ca[_0xcde8('0x3')]||'';this['tenantId']=_0x4e11ca[_0xcde8('0x4')]||'';this['clientId']=_0x4e11ca['clientId']||'';this[_0xcde8('0x5')]=_0x4e11ca[_0xcde8('0x5')]||{};this['serverUrl']=_0x4e11ca['serverUrl']||'';this[_0xcde8('0x6')]=_0x4e11ca[_0xcde8('0x6')]||![];this[_0xcde8('0x7')]=_0x4e11ca[_0xcde8('0x7')]||{};this[_0xcde8('0x8')]=_0x4e11ca[_0xcde8('0x8')]||{};}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 5065fd1..7163a56 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 _0xf93e=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x5cb052,_0x333521){var _0x4a0f67=function(_0x1f14c8){while(--_0x1f14c8){_0x5cb052['push'](_0x5cb052['shift']());}};_0x4a0f67(++_0x333521);}(_0xf93e,0x1be));var _0xef93=function(_0x50a5ee,_0xa4c369){_0x50a5ee=_0x50a5ee-0x0;var _0x2aea2f=_0xf93e[_0x50a5ee];return _0x2aea2f;};'use strict';function FaxAccount(_0x1da172){this['id']=_0x1da172['id']||0x0;this[_0xef93('0x0')]=_0x1da172[_0xef93('0x0')]||'';this[_0xef93('0x1')]=_0x1da172[_0xef93('0x1')];this[_0xef93('0x2')]=_0x1da172[_0xef93('0x2')];this[_0xef93('0x3')]=_0x1da172[_0xef93('0x3')];this[_0xef93('0x4')]=_0x1da172[_0xef93('0x4')];this['minrate']=_0x1da172[_0xef93('0x5')]||0x960;this[_0xef93('0x6')]=_0x1da172[_0xef93('0x6')]||0x3840;this['modem']=_0x1da172[_0xef93('0x7')]||'v17,v27,v29';this[_0xef93('0x8')]=_0x1da172['gateway']||'no';this[_0xef93('0x9')]=_0x1da172[_0xef93('0x9')]||'no';this[_0xef93('0xa')]=_0x1da172[_0xef93('0xa')]||0x1388;this[_0xef93('0xb')]=_0x1da172[_0xef93('0xb')]||_0xef93('0xc');this[_0xef93('0xd')]=_0x1da172[_0xef93('0xd')]?_0x1da172[_0xef93('0xd')]:undefined;this[_0xef93('0xe')]=_0x1da172[_0xef93('0xe')];this[_0xef93('0xf')]=_0x1da172[_0xef93('0xf')];}module[_0xef93('0x10')]=FaxAccount; \ No newline at end of file +var _0xf062=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0xf436aa,_0x1137c9){var _0x3fb88f=function(_0x56e99d){while(--_0x56e99d){_0xf436aa['push'](_0xf436aa['shift']());}};_0x3fb88f(++_0x1137c9);}(_0xf062,0x6b));var _0x2f06=function(_0x5e9b36,_0x4fe839){_0x5e9b36=_0x5e9b36-0x0;var _0x12ae68=_0xf062[_0x5e9b36];return _0x12ae68;};'use strict';function FaxAccount(_0x5542a4){this['id']=_0x5542a4['id']||0x0;this[_0x2f06('0x0')]=_0x5542a4[_0x2f06('0x0')]||'';this[_0x2f06('0x1')]=_0x5542a4['description'];this['ecm']=_0x5542a4[_0x2f06('0x2')];this[_0x2f06('0x3')]=_0x5542a4['headerinfo'];this[_0x2f06('0x4')]=_0x5542a4[_0x2f06('0x4')];this[_0x2f06('0x5')]=_0x5542a4['minrate']||0x960;this[_0x2f06('0x6')]=_0x5542a4[_0x2f06('0x6')]||0x3840;this[_0x2f06('0x7')]=_0x5542a4[_0x2f06('0x7')]||_0x2f06('0x8');this[_0x2f06('0x9')]=_0x5542a4[_0x2f06('0x9')]||'no';this[_0x2f06('0xa')]=_0x5542a4[_0x2f06('0xa')]||'no';this['t38timeout']=_0x5542a4[_0x2f06('0xb')]||0x1388;this[_0x2f06('0xc')]=_0x5542a4['tech']||_0x2f06('0xd');this[_0x2f06('0xe')]=_0x5542a4[_0x2f06('0xe')]?_0x5542a4['Trunk']:undefined;this['ListId']=_0x5542a4[_0x2f06('0xf')];this[_0x2f06('0x10')]=_0x5542a4[_0x2f06('0x10')];}module[_0x2f06('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 ad53019..61dea8e 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 _0x345c=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x345c,0x1dc));var _0xc345=function(_0x4e936c,_0x81f200){_0x4e936c=_0x4e936c-0x0;var _0xa39a1c=_0x345c[_0x4e936c];return _0xa39a1c;};'use strict';function FreshdeskAccount(_0x73d2a1){this['id']=_0x73d2a1['id']||0x0;this[_0xc345('0x0')]=_0x73d2a1[_0xc345('0x0')]||'';this[_0xc345('0x1')]=_0x73d2a1[_0xc345('0x1')]||'';this[_0xc345('0x2')]=_0x73d2a1['token']||'';this[_0xc345('0x3')]=_0x73d2a1[_0xc345('0x3')]||'';this[_0xc345('0x4')]=_0x73d2a1[_0xc345('0x4')]||'';this[_0xc345('0x5')]=_0x73d2a1['Configurations']||{};}module[_0xc345('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x359d=['serverUrl','name','apiKey','token','remoteUri'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x359d,0x15a));var _0xd359=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x359d[_0x3f4891];return _0x54f2d8;};'use strict';function FreshdeskAccount(_0xd949fe){this['id']=_0xd949fe['id']||0x0;this['name']=_0xd949fe[_0xd359('0x0')]||'';this['username']=_0xd949fe['username']||'';this[_0xd359('0x1')]=_0xd949fe[_0xd359('0x2')]||'';this[_0xd359('0x3')]=_0xd949fe[_0xd359('0x3')]||'';this[_0xd359('0x4')]=_0xd949fe[_0xd359('0x4')]||'';this['Configurations']=_0xd949fe['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e02147e..b405489 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 _0xabce=['username','remoteUri','serverUrl','Configurations','name'];(function(_0x5e45c2,_0x2d6a5d){var _0x27760c=function(_0x57472b){while(--_0x57472b){_0x5e45c2['push'](_0x5e45c2['shift']());}};_0x27760c(++_0x2d6a5d);}(_0xabce,0x103));var _0xeabc=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xabce[_0x2bf141];return _0x48277b;};'use strict';function FreshsalesAccount(_0x3c9509){this['id']=_0x3c9509['id']||0x0;this[_0xeabc('0x0')]=_0x3c9509[_0xeabc('0x0')]||'';this[_0xeabc('0x1')]=_0x3c9509[_0xeabc('0x1')]||'';this['apiKey']=_0x3c9509['token']||'';this[_0xeabc('0x2')]=_0x3c9509[_0xeabc('0x2')]||'';this[_0xeabc('0x3')]=_0x3c9509['serverUrl']||'';this['Configurations']=_0x3c9509[_0xeabc('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x6075=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xc464eb,_0x3e7e90){var _0x5c2d45=function(_0x248ec0){while(--_0x248ec0){_0xc464eb['push'](_0xc464eb['shift']());}};_0x5c2d45(++_0x3e7e90);}(_0x6075,0x191));var _0x5607=function(_0x51a301,_0x4dcc25){_0x51a301=_0x51a301-0x0;var _0x27d250=_0x6075[_0x51a301];return _0x27d250;};'use strict';function FreshsalesAccount(_0x24c5fc){this['id']=_0x24c5fc['id']||0x0;this[_0x5607('0x0')]=_0x24c5fc[_0x5607('0x0')]||'';this[_0x5607('0x1')]=_0x24c5fc[_0x5607('0x1')]||'';this[_0x5607('0x2')]=_0x24c5fc[_0x5607('0x3')]||'';this[_0x5607('0x4')]=_0x24c5fc[_0x5607('0x4')]||'';this[_0x5607('0x5')]=_0x24c5fc['serverUrl']||'';this[_0x5607('0x6')]=_0x24c5fc[_0x5607('0x6')]||{};}module[_0x5607('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 77a6a8c..6ec5648 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 _0xac3b=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel','voice','routealias','mohtime','exports','type','inbound','uniqueid'];(function(_0x10fca9,_0x2aca67){var _0x5b3c4f=function(_0x51bb9c){while(--_0x51bb9c){_0x10fca9['push'](_0x10fca9['shift']());}};_0x5b3c4f(++_0x2aca67);}(_0xac3b,0x169));var _0xbac3=function(_0x13023b,_0x51328e){_0x13023b=_0x13023b-0x0;var _0x458326=_0xac3b[_0x13023b];return _0x458326;};'use strict';function QueueReport(){this[_0xbac3('0x0')]=_0xbac3('0x1');this[_0xbac3('0x2')]='';this[_0xbac3('0x3')]='';this[_0xbac3('0x4')]='';this[_0xbac3('0x5')]='';this[_0xbac3('0x6')]=null;this[_0xbac3('0x7')]=null;this['position']=0x1;this['count']=0x1;this[_0xbac3('0x8')]=![];this[_0xbac3('0x9')]=null;this['queuecallercomplete']=![];this[_0xbac3('0xa')]=null;this[_0xbac3('0xb')]=![];this[_0xbac3('0xc')]=null;this['originalposition']=0x1;this[_0xbac3('0xd')]='';this[_0xbac3('0xe')]='';this[_0xbac3('0xf')]='';this[_0xbac3('0x10')]='';this['context']='';this[_0xbac3('0x11')]='';this[_0xbac3('0x12')]='';this[_0xbac3('0x13')]=0x0;this[_0xbac3('0x14')]=![];this['lastAssignedTo']='';this[_0xbac3('0x15')]=_0xbac3('0x16');this[_0xbac3('0x17')]=null;this[_0xbac3('0x18')]=0x0;this['variables']={};}module[_0xbac3('0x19')]=QueueReport; \ No newline at end of file +var _0x2e25=['queue','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','calleridname'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e25,0xaf));var _0x52e2=function(_0x46742d,_0x5c5401){_0x46742d=_0x46742d-0x0;var _0x3a083e=_0x2e25[_0x46742d];return _0x3a083e;};'use strict';function QueueReport(){this['type']='inbound';this['uniqueid']='';this['calleridnum']='';this[_0x52e2('0x0')]='';this[_0x52e2('0x1')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x52e2('0x2')]=0x1;this[_0x52e2('0x3')]=0x1;this[_0x52e2('0x4')]=![];this['queuecallerabandonAt']=null;this[_0x52e2('0x5')]=![];this[_0x52e2('0x6')]=null;this[_0x52e2('0x7')]=![];this[_0x52e2('0x8')]=null;this['originalposition']=0x1;this[_0x52e2('0x9')]='';this[_0x52e2('0xa')]='';this[_0x52e2('0xb')]='';this[_0x52e2('0xc')]='';this[_0x52e2('0xd')]='';this[_0x52e2('0xe')]='';this['priority']='';this[_0x52e2('0xf')]=0x0;this[_0x52e2('0x10')]=![];this[_0x52e2('0x11')]='';this[_0x52e2('0x12')]='voice';this[_0x52e2('0x13')]=null;this[_0x52e2('0x14')]=0x0;this[_0x52e2('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3435f8f..7d189df 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 _0x5707=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','integrationTab','serverUrl'];(function(_0x3687e6,_0x33eb32){var _0xdd9a8e=function(_0x136a4a){while(--_0x136a4a){_0x3687e6['push'](_0x3687e6['shift']());}};_0xdd9a8e(++_0x33eb32);}(_0x5707,0x1b9));var _0x7570=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x5707[_0x18f82b];return _0x5d8128;};'use strict';function SalesforceAccount(_0x22269d){this['id']=_0x22269d['id']||0x0;this['name']=_0x22269d[_0x7570('0x0')]||'';this[_0x7570('0x1')]=_0x22269d[_0x7570('0x1')]||'';this[_0x7570('0x2')]=_0x22269d[_0x7570('0x2')]||'';this[_0x7570('0x3')]=_0x22269d[_0x7570('0x3')]||'';this[_0x7570('0x4')]=_0x22269d[_0x7570('0x4')]||'';this[_0x7570('0x5')]=_0x22269d[_0x7570('0x5')]||'';this[_0x7570('0x6')]=_0x22269d['securityToken']||'';this['type']=_0x22269d['type']||_0x7570('0x7');this[_0x7570('0x8')]=_0x22269d[_0x7570('0x8')]||'';this['Configurations']=_0x22269d['Configurations']||{};}module[_0x7570('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x7366=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x202e6c,_0xb884e1){var _0x342cb0=function(_0x3c385b){while(--_0x3c385b){_0x202e6c['push'](_0x202e6c['shift']());}};_0x342cb0(++_0xb884e1);}(_0x7366,0x9d));var _0x6736=function(_0x362d8d,_0x543ba7){_0x362d8d=_0x362d8d-0x0;var _0x88cef5=_0x7366[_0x362d8d];return _0x88cef5;};'use strict';function SalesforceAccount(_0x4bb2e9){this['id']=_0x4bb2e9['id']||0x0;this[_0x6736('0x0')]=_0x4bb2e9[_0x6736('0x0')]||'';this[_0x6736('0x1')]=_0x4bb2e9[_0x6736('0x1')]||'';this[_0x6736('0x2')]=_0x4bb2e9[_0x6736('0x2')]||'';this[_0x6736('0x3')]=_0x4bb2e9[_0x6736('0x3')]||'';this['clientId']=_0x4bb2e9[_0x6736('0x4')]||'';this['clientSecret']=_0x4bb2e9['clientSecret']||'';this[_0x6736('0x5')]=_0x4bb2e9[_0x6736('0x5')]||'';this[_0x6736('0x6')]=_0x4bb2e9['type']||_0x6736('0x7');this[_0x6736('0x8')]=_0x4bb2e9[_0x6736('0x8')]||'';this['Configurations']=_0x4bb2e9[_0x6736('0x9')]||{};}module[_0x6736('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 4deb0fc..c7a2218 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 _0x7c9b=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x28147f,_0x1e1f2d){var _0x32a646=function(_0x13713e){while(--_0x13713e){_0x28147f['push'](_0x28147f['shift']());}};_0x32a646(++_0x1e1f2d);}(_0x7c9b,0x8a));var _0xb7c9=function(_0x1b7615,_0x3489b8){_0x1b7615=_0x1b7615-0x0;var _0x476788=_0x7c9b[_0x1b7615];return _0x476788;};'use strict';function ServicenowAccount(_0x4e6cb8){this['id']=_0x4e6cb8['id']||0x0;this[_0xb7c9('0x0')]=_0x4e6cb8[_0xb7c9('0x0')]||'';this[_0xb7c9('0x1')]=_0x4e6cb8['username']||'';this[_0xb7c9('0x2')]=_0x4e6cb8['password']||'';this[_0xb7c9('0x3')]=_0x4e6cb8[_0xb7c9('0x3')]||'';this[_0xb7c9('0x4')]=_0x4e6cb8[_0xb7c9('0x4')]||'';this[_0xb7c9('0x5')]=_0x4e6cb8[_0xb7c9('0x5')]||{};}module[_0xb7c9('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x46b2=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x3c6e1b,_0x560e80){var _0x178d0f=function(_0x2ddee4){while(--_0x2ddee4){_0x3c6e1b['push'](_0x3c6e1b['shift']());}};_0x178d0f(++_0x560e80);}(_0x46b2,0x1d0));var _0x246b=function(_0x5e5cbb,_0x5ddbc5){_0x5e5cbb=_0x5e5cbb-0x0;var _0x198981=_0x46b2[_0x5e5cbb];return _0x198981;};'use strict';function ServicenowAccount(_0x92aeee){this['id']=_0x92aeee['id']||0x0;this[_0x246b('0x0')]=_0x92aeee['name']||'';this[_0x246b('0x1')]=_0x92aeee[_0x246b('0x1')]||'';this[_0x246b('0x2')]=_0x92aeee[_0x246b('0x2')]||'';this[_0x246b('0x3')]=_0x92aeee[_0x246b('0x3')]||'';this[_0x246b('0x4')]=_0x92aeee[_0x246b('0x4')]||'';this['Configurations']=_0x92aeee[_0x246b('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 779fe74..7b74e05 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 _0x41d7=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x41d7,0x186));var _0x741d=function(_0xc160f3,_0x217558){_0xc160f3=_0xc160f3-0x0;var _0x34f4f6=_0x41d7[_0xc160f3];return _0x34f4f6;};'use strict';function SugarcrmAccount(_0x76ab98){this['id']=_0x76ab98['id']||0x0;this[_0x741d('0x0')]=_0x76ab98[_0x741d('0x0')]||'';this[_0x741d('0x1')]=_0x76ab98[_0x741d('0x1')]||'';this[_0x741d('0x2')]=_0x76ab98['password']||'';this[_0x741d('0x3')]=_0x76ab98[_0x741d('0x3')]||'';this[_0x741d('0x4')]=_0x76ab98[_0x741d('0x4')]||'';this['Configurations']=_0x76ab98[_0x741d('0x5')]||{};}module[_0x741d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x78f9=['password','serverUrl','Configurations','exports','name'];(function(_0x3952c2,_0xb6e2fd){var _0x2cf602=function(_0xea39f2){while(--_0xea39f2){_0x3952c2['push'](_0x3952c2['shift']());}};_0x2cf602(++_0xb6e2fd);}(_0x78f9,0xc2));var _0x978f=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x78f9[_0x18cd5b];return _0x5eaa52;};'use strict';function SugarcrmAccount(_0x51f7d2){this['id']=_0x51f7d2['id']||0x0;this['name']=_0x51f7d2[_0x978f('0x0')]||'';this['username']=_0x51f7d2['username']||'';this[_0x978f('0x1')]=_0x51f7d2[_0x978f('0x1')]||'';this['remoteUri']=_0x51f7d2['remoteUri']||'';this[_0x978f('0x2')]=_0x51f7d2[_0x978f('0x2')]||'';this[_0x978f('0x3')]=_0x51f7d2[_0x978f('0x3')]||{};}module[_0x978f('0x4')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index d0d2a24..afb9ecc 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 _0xe8cd=['state','stateTime','status','name','accountcode'];(function(_0x3e5a19,_0x22a0bf){var _0x46bf34=function(_0x3f8dd9){while(--_0x3f8dd9){_0x3e5a19['push'](_0x3e5a19['shift']());}};_0x46bf34(++_0x22a0bf);}(_0xe8cd,0x152));var _0xde8c=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xe8cd[_0x5093e9];return _0x4c9a22;};'use strict';function Telephone(_0x3168de){this['id']=_0x3168de['id']||0x0;this['name']=_0x3168de[_0xde8c('0x0')]||'';this[_0xde8c('0x1')]=_0x3168de['accountcode']||'';this[_0xde8c('0x2')]='unknown';this[_0xde8c('0x3')]=0x0;this[_0xde8c('0x4')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xda3f=['name','unknown','status','exports'];(function(_0x309fbf,_0x523e5b){var _0x5045ee=function(_0xbefebb){while(--_0xbefebb){_0x309fbf['push'](_0x309fbf['shift']());}};_0x5045ee(++_0x523e5b);}(_0xda3f,0xec));var _0xfda3=function(_0x5cb532,_0x57f140){_0x5cb532=_0x5cb532-0x0;var _0x4caf51=_0xda3f[_0x5cb532];return _0x4caf51;};'use strict';function Telephone(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['accountcode']=_0x33f0ce['accountcode']||'';this['state']=_0xfda3('0x1');this['stateTime']=0x0;this[_0xfda3('0x2')]=_0xfda3('0x1');this['address']='';}module[_0xfda3('0x3')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0fb5aa5..e3cc67e 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(_0x66ae4d,_0x1e36d9){var _0x12f159=function(_0x201b26){while(--_0x201b26){_0x66ae4d['push'](_0x66ae4d['shift']());}};_0x12f159(++_0x1e36d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x49e77b,_0x59ced7){_0x49e77b=_0x49e77b-0x0;var _0x58b978=_0xb10b[_0x49e77b];return _0x58b978;};'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(_0x3aba80,_0x4b5dc8){var _0x323cba=function(_0x405471){while(--_0x405471){_0x3aba80['push'](_0x3aba80['shift']());}};_0x323cba(++_0x4b5dc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 93edba4..597d6e2 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 _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x4310cb,_0x7c6127){var _0x3841ff=function(_0x2776d3){while(--_0x2776d3){_0x4310cb['push'](_0x4310cb['shift']());}};_0x3841ff(++_0x7c6127);}(_0xb10b,0x12a));var _0xbb10=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0xb10b[_0x42c341];return _0x43621b;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('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 c7be746..8bb5304 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 _0xa7cf=['state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name'];(function(_0x2d926d,_0x106492){var _0x2aa16c=function(_0x19f303){while(--_0x19f303){_0x2d926d['push'](_0x2d926d['shift']());}};_0x2aa16c(++_0x106492);}(_0xa7cf,0x7c));var _0xfa7c=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xa7cf[_0x15ea09];return _0x3e9c78;};'use strict';function Trunk(_0x5b17f5){this['id']=_0x5b17f5['id']||0x0;this[_0xfa7c('0x0')]=_0x5b17f5[_0xfa7c('0x0')]||![];this[_0xfa7c('0x1')]=_0x5b17f5['name']||'';this[_0xfa7c('0x2')]=_0xfa7c('0x3');this[_0xfa7c('0x4')]=0x0;this['status']=_0xfa7c('0x3');this[_0xfa7c('0x5')]=_0x5b17f5[_0xfa7c('0x5')]&&_0x5b17f5['registry'][_0xfa7c('0x6')](':')?_0x5b17f5[_0xfa7c('0x5')][_0xfa7c('0x7')](':')[0x0]:'';this[_0xfa7c('0x8')]='';this[_0xfa7c('0x9')]='';this[_0xfa7c('0xa')]='';this[_0xfa7c('0xb')]='';this[_0xfa7c('0xc')]='';this[_0xfa7c('0xd')]=_0xfa7c('0x3');this[_0xfa7c('0xe')]='';this[_0xfa7c('0xf')]='';this[_0xfa7c('0x10')]=_0x5b17f5['defaultuser']||'';}module[_0xfa7c('0x11')]=Trunk; \ No newline at end of file +var _0x843d=['registry','indexOf','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status'];(function(_0x47b017,_0x52942d){var _0x485638=function(_0x3af023){while(--_0x3af023){_0x47b017['push'](_0x47b017['shift']());}};_0x485638(++_0x52942d);}(_0x843d,0xe8));var _0xd843=function(_0x1e3d74,_0x466479){_0x1e3d74=_0x1e3d74-0x0;var _0xbf2bbd=_0x843d[_0x1e3d74];return _0xbf2bbd;};'use strict';function Trunk(_0x2f02aa){this['id']=_0x2f02aa['id']||0x0;this[_0xd843('0x0')]=_0x2f02aa['active']||![];this[_0xd843('0x1')]=_0x2f02aa[_0xd843('0x1')]||'';this[_0xd843('0x2')]=_0xd843('0x3');this[_0xd843('0x4')]=0x0;this[_0xd843('0x5')]=_0xd843('0x3');this[_0xd843('0x6')]=_0x2f02aa[_0xd843('0x6')]&&_0x2f02aa['registry'][_0xd843('0x7')](':')?_0x2f02aa[_0xd843('0x6')]['split'](':')[0x0]:'';this[_0xd843('0x8')]='';this[_0xd843('0x9')]='';this[_0xd843('0xa')]='';this[_0xd843('0xb')]='';this[_0xd843('0xc')]='';this[_0xd843('0xd')]=_0xd843('0x3');this[_0xd843('0xe')]='';this[_0xd843('0xf')]='';this[_0xd843('0x10')]=_0x2f02aa[_0xd843('0x10')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 2677134..9aed217 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 _0x8c85=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c85,0x1ea));var _0x58c8=function(_0x560b45,_0x159cff){_0x560b45=_0x560b45-0x0;var _0x474278=_0x8c85[_0x560b45];return _0x474278;};'use strict';function voiceExtension(_0x5a6b63){this['id']=_0x5a6b63['id']||0x0;this[_0x58c8('0x0')]=_0x5a6b63[_0x58c8('0x0')]||'';this[_0x58c8('0x1')]=_0x5a6b63[_0x58c8('0x1')]||_0x58c8('0x2');this[_0x58c8('0x3')]=_0x5a6b63[_0x58c8('0x3')]||![];}module[_0x58c8('0x4')]=voiceExtension; \ No newline at end of file +var _0x2edc=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x2edc,0x14a));var _0xc2ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2edc[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x345e70){this['id']=_0x345e70['id']||0x0;this[_0xc2ed('0x0')]=_0x345e70[_0xc2ed('0x0')]||'';this[_0xc2ed('0x1')]=_0x345e70[_0xc2ed('0x1')]||_0xc2ed('0x2');this[_0xc2ed('0x3')]=_0x345e70[_0xc2ed('0x3')]||![];}module[_0xc2ed('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 d1b7935..114a896 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 _0x4384=['available','busy','inUse','invalid','notInUse','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','ringall','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4384,0x6d));var _0x4438=function(_0xc13402,_0x1b3c4f){_0xc13402=_0xc13402-0x0;var _0x3f1fca=_0x4384[_0xc13402];return _0x3f1fca;};'use strict';var monitorFormat={'wav':_0x4438('0x0'),'wav49':_0x4438('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x4438('0x2'),'leastrecent':_0x4438('0x3'),'linear':'linear','random':'random','ringall':_0x4438('0x4'),'rr':'roundrobin','rrmemory':_0x4438('0x5'),'rrordered':_0x4438('0x6'),'wrandom':_0x4438('0x7')};function VoiceQueue(_0x80152a){this['id']=_0x80152a['id']||0x0;this[_0x4438('0x8')]=_0x80152a[_0x4438('0x8')]||'';this['monitor_format']=_0x80152a[_0x4438('0x9')]||'';this[_0x4438('0xa')]=_0x80152a[_0x4438('0xa')]||_0x4438('0xb');this['waiting']=0x0;this[_0x4438('0xc')]=0x0;this['answered']=0x0;this[_0x4438('0xd')]=0x0;this[_0x4438('0xe')]=0x0;this[_0x4438('0xf')]=0x0;this[_0x4438('0x10')]=0x0;this[_0x4438('0x11')]=0x0;this[_0x4438('0x12')]=0x0;this[_0x4438('0x13')]=0x0;this[_0x4438('0x14')]=0x0;this[_0x4438('0x15')]=0x0;this['loggedIn']=0x0;this[_0x4438('0x16')]=0x0;this['onHold']=0x0;this['paused']=0x0;this['ringing']=0x0;this[_0x4438('0x17')]=0x0;this[_0x4438('0x18')]=0x0;this[_0x4438('0x19')]=0x0;this[_0x4438('0x1a')]=0x0;this[_0x4438('0x1b')]=_0x80152a['acw']||![];this[_0x4438('0x1c')]=_0x80152a['acwTimeout']||0xa;this['autopause']=_0x80152a[_0x4438('0x1d')]||'no';this[_0x4438('0x1e')]=!![];this['message']='';this[_0x4438('0x1f')]='';this['originated']=0x0;this[_0x4438('0x20')]=0x0;this['dialTimezone']=_0x80152a[_0x4438('0x21')]||null;this[_0x4438('0x22')]=_0x80152a['dialGlobalInterval']?_0x80152a[_0x4438('0x22')]:null;this[_0x4438('0x23')]=_0x80152a['dialActive'];this['dialMethod']=_0x80152a[_0x4438('0x24')]||_0x4438('0x25');this['dialLimitChannel']=_0x80152a[_0x4438('0x26')]||0x0;this[_0x4438('0x27')]=_0x80152a[_0x4438('0x27')]||0x0;this[_0x4438('0x28')]=_0x80152a[_0x4438('0x28')]||0x1;this[_0x4438('0x29')]=_0x80152a[_0x4438('0x29')]||'dropRate';this[_0x4438('0x2a')]=_0x80152a[_0x4438('0x2a')]||0.03;this[_0x4438('0x2b')]=_0x80152a[_0x4438('0x2b')]||0x258;this[_0x4438('0x2c')]=_0x80152a['dialOriginateCallerIdName']||_0x4438('0x2d');this[_0x4438('0x2e')]=_0x80152a[_0x4438('0x2e')]||_0x4438('0x2d');this['dialOriginateTimeout']=_0x80152a[_0x4438('0x2f')]||0x1e;this[_0x4438('0x30')]=_0x80152a[_0x4438('0x30')]||_0x4438('0x31');this[_0x4438('0x32')]=_0x80152a['dialQueueTimeout']||0x3;this[_0x4438('0x33')]=_0x80152a['dialQueueProject']||undefined;this[_0x4438('0x34')]=_0x80152a[_0x4438('0x34')]||0x3;this[_0x4438('0x35')]=_0x80152a[_0x4438('0x35')]||0x96;this['dialBusyMaxRetry']=_0x80152a['dialBusyMaxRetry']||0x3;this[_0x4438('0x36')]=_0x80152a['dialBusyRetryFrequency']||0x96;this[_0x4438('0x37')]=_0x80152a[_0x4438('0x37')]||0x3;this[_0x4438('0x38')]=_0x80152a[_0x4438('0x38')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x80152a[_0x4438('0x39')]||0x3;this[_0x4438('0x3a')]=_0x80152a['dialNoSuchNumberRetryFrequency']||0x96;this[_0x4438('0x3b')]=_0x80152a[_0x4438('0x3b')]||0x3;this[_0x4438('0x3c')]=_0x80152a[_0x4438('0x3c')]||0x96;this[_0x4438('0x3d')]=_0x80152a[_0x4438('0x3d')]||0x3;this[_0x4438('0x3e')]=_0x80152a[_0x4438('0x3e')]||0x96;this['dialMachineMaxRetry']=_0x80152a['dialMachineMaxRetry']||0x3;this[_0x4438('0x3f')]=_0x80152a[_0x4438('0x3f')]||0x96;this[_0x4438('0x40')]=_0x80152a[_0x4438('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x80152a[_0x4438('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x80152a[_0x4438('0x42')]||0x3;this['dialGlobalMaxRetry']=_0x80152a[_0x4438('0x43')]||0x4;this[_0x4438('0x44')]=_0x80152a[_0x4438('0x44')]?_0x80152a[_0x4438('0x44')]:undefined;this[_0x4438('0x45')]=_0x80152a['TrunkBackup']?_0x80152a[_0x4438('0x45')]:undefined;this[_0x4438('0x46')]=_0x80152a[_0x4438('0x46')]||undefined;this[_0x4438('0x47')]=_0x80152a[_0x4438('0x47')]?_0x80152a[_0x4438('0x47')]:undefined;this['dialOrderByScheduledAt']=_0x80152a[_0x4438('0x48')]||'DESC';this[_0x4438('0x49')]=_0x80152a['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4438('0x4a')]=_0x80152a['dialCutDigit']||undefined;this['strategy']=strategy[_0x80152a[_0x4438('0x4b')]];this[_0x4438('0x4c')]=!![];this['dialAMDActive']=_0x80152a[_0x4438('0x4d')]||![];this[_0x4438('0x4e')]=_0x80152a[_0x4438('0x4e')];this['dialAMDGreeting']=_0x80152a[_0x4438('0x4f')];this['dialAMDAfterGreetingSilence']=_0x80152a[_0x4438('0x50')];this[_0x4438('0x51')]=_0x80152a['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x80152a[_0x4438('0x52')];this[_0x4438('0x53')]=_0x80152a[_0x4438('0x53')];this[_0x4438('0x54')]=_0x80152a[_0x4438('0x54')];this[_0x4438('0x55')]=_0x80152a['dialAMDSilenceThreshold'];this[_0x4438('0x56')]=_0x80152a[_0x4438('0x56')];this['outboundRejectCallsDay']=0x0;this[_0x4438('0x57')]=0x0;this[_0x4438('0x58')]=_0x80152a[_0x4438('0x58')];this[_0x4438('0x59')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x4438('0x5a')]=0x0;this[_0x4438('0x5b')]=0x0;this[_0x4438('0x5c')]=0x0;this[_0x4438('0x5d')]=0x0;this[_0x4438('0x5e')]=0x0;this[_0x4438('0x5f')]=0x0;this[_0x4438('0x60')]=0x0;this[_0x4438('0x61')]=0x0;this[_0x4438('0x62')]=0x0;this[_0x4438('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x4438('0x64')]=0x0;this[_0x4438('0x65')]=undefined;this[_0x4438('0x66')]=undefined;this[_0x4438('0x67')]=undefined;this[_0x4438('0x68')]=1.05;this[_0x4438('0x69')]=0x0;this[_0x4438('0x6a')]=0x0;this[_0x4438('0x6b')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4438('0x6c')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x4438('0x6d')]=0x0;this[_0x4438('0x6e')]=0x0;this['predictiveIntervalMaxThreshold']=_0x80152a['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x4438('0x6f')]=_0x80152a[_0x4438('0x70')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x4438('0x71')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x4438('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x4438('0x73')]=0x0;this[_0x4438('0x74')]=0x0;this['dialRecallMeTimeout']=_0x80152a[_0x4438('0x75')]||0x1e;this['dialRecallInQueue']=_0x80152a[_0x4438('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x80152a['dialPreviewAutoRecallMe']||![];this[_0x4438('0x77')]=!!_0x80152a['dialPreviewRecallmeReminder']||![];this[_0x4438('0x78')]=_0x80152a[_0x4438('0x78')]||undefined;this[_0x4438('0x79')]=_0x80152a['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x80152a[_0x4438('0x7a')]||![];this[_0x4438('0x9')]=monitorFormat[_0x80152a[_0x4438('0x9')]]?monitorFormat[_0x80152a[_0x4438('0x9')]]:undefined;this[_0x4438('0x7b')]=_0x80152a['mandatoryDisposition']||![];this[_0x4438('0x7c')]=_0x80152a[_0x4438('0x7c')]?_0x80152a[_0x4438('0x7c')]:undefined;this[_0x4438('0x7d')]=![];}module[_0x4438('0x7e')]=VoiceQueue; \ No newline at end of file +var _0x382c=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','type','inbound','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','paused','ringing','ringInUse','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0xda406a,_0x157d74){var _0x427ce2=function(_0x15e208){while(--_0x15e208){_0xda406a['push'](_0xda406a['shift']());}};_0x427ce2(++_0x157d74);}(_0x382c,0xbb));var _0xc382=function(_0x1730dd,_0x3cacb2){_0x1730dd=_0x1730dd-0x0;var _0x15a53c=_0x382c[_0x1730dd];return _0x15a53c;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xc382('0x0'),'linear':_0xc382('0x1'),'random':'random','ringall':_0xc382('0x2'),'rr':_0xc382('0x3'),'rrmemory':_0xc382('0x4'),'rrordered':_0xc382('0x5'),'wrandom':_0xc382('0x6')};function VoiceQueue(_0x31a557){this['id']=_0x31a557['id']||0x0;this[_0xc382('0x7')]=_0x31a557[_0xc382('0x7')]||'';this['monitor_format']=_0x31a557['monitor_format']||'';this[_0xc382('0x8')]=_0x31a557['type']||_0xc382('0x9');this['waiting']=0x0;this['total']=0x0;this[_0xc382('0xa')]=0x0;this[_0xc382('0xb')]=0x0;this['sumHoldTime']=0x0;this[_0xc382('0xc')]=0x0;this[_0xc382('0xd')]=0x0;this[_0xc382('0xe')]=0x0;this[_0xc382('0xf')]=0x0;this[_0xc382('0x10')]=0x0;this[_0xc382('0x11')]=0x0;this['invalid']=0x0;this[_0xc382('0x12')]=0x0;this[_0xc382('0x13')]=0x0;this['onHold']=0x0;this[_0xc382('0x14')]=0x0;this[_0xc382('0x15')]=0x0;this[_0xc382('0x16')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0xc382('0x17')]=_0x31a557[_0xc382('0x17')]||![];this[_0xc382('0x18')]=_0x31a557[_0xc382('0x18')]||0xa;this[_0xc382('0x19')]=_0x31a557[_0xc382('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0xc382('0x1a')]='';this[_0xc382('0x1b')]='';this['originated']=0x0;this[_0xc382('0x1c')]=0x0;this[_0xc382('0x1d')]=_0x31a557[_0xc382('0x1d')]||null;this[_0xc382('0x1e')]=_0x31a557[_0xc382('0x1e')]?_0x31a557[_0xc382('0x1e')]:null;this[_0xc382('0x1f')]=_0x31a557['dialActive'];this[_0xc382('0x20')]=_0x31a557['dialMethod']||_0xc382('0x21');this[_0xc382('0x22')]=_0x31a557['dialLimitChannel']||0x0;this[_0xc382('0x23')]=_0x31a557[_0xc382('0x23')]||0x0;this[_0xc382('0x24')]=_0x31a557[_0xc382('0x24')]||0x1;this[_0xc382('0x25')]=_0x31a557[_0xc382('0x25')]||'dropRate';this[_0xc382('0x26')]=_0x31a557[_0xc382('0x26')]||0.03;this['dialPredictiveInterval']=_0x31a557[_0xc382('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x31a557[_0xc382('0x28')]||_0xc382('0x29');this['dialOriginateCallerIdNumber']=_0x31a557[_0xc382('0x2a')]||_0xc382('0x29');this[_0xc382('0x2b')]=_0x31a557[_0xc382('0x2b')]||0x1e;this['dialQueueOptions']=_0x31a557[_0xc382('0x2c')]||_0xc382('0x2d');this['dialQueueTimeout']=_0x31a557[_0xc382('0x2e')]||0x3;this[_0xc382('0x2f')]=_0x31a557[_0xc382('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x31a557[_0xc382('0x30')]||0x3;this[_0xc382('0x31')]=_0x31a557[_0xc382('0x31')]||0x96;this['dialBusyMaxRetry']=_0x31a557['dialBusyMaxRetry']||0x3;this[_0xc382('0x32')]=_0x31a557['dialBusyRetryFrequency']||0x96;this[_0xc382('0x33')]=_0x31a557['dialNoAnswerMaxRetry']||0x3;this[_0xc382('0x34')]=_0x31a557[_0xc382('0x34')]||0x96;this[_0xc382('0x35')]=_0x31a557[_0xc382('0x35')]||0x3;this[_0xc382('0x36')]=_0x31a557[_0xc382('0x36')]||0x96;this['dialDropMaxRetry']=_0x31a557[_0xc382('0x37')]||0x3;this[_0xc382('0x38')]=_0x31a557[_0xc382('0x38')]||0x96;this[_0xc382('0x39')]=_0x31a557[_0xc382('0x39')]||0x3;this[_0xc382('0x3a')]=_0x31a557[_0xc382('0x3a')]||0x96;this[_0xc382('0x3b')]=_0x31a557[_0xc382('0x3b')]||0x3;this[_0xc382('0x3c')]=_0x31a557[_0xc382('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x31a557[_0xc382('0x3d')]||0x3;this[_0xc382('0x3e')]=_0x31a557['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x31a557[_0xc382('0x3f')]||0x3;this['dialGlobalMaxRetry']=_0x31a557[_0xc382('0x40')]||0x4;this[_0xc382('0x41')]=_0x31a557[_0xc382('0x41')]?_0x31a557[_0xc382('0x41')]:undefined;this[_0xc382('0x42')]=_0x31a557['TrunkBackup']?_0x31a557[_0xc382('0x42')]:undefined;this[_0xc382('0x43')]=_0x31a557[_0xc382('0x43')]||undefined;this[_0xc382('0x44')]=_0x31a557[_0xc382('0x44')]?_0x31a557['Interval']:undefined;this['dialOrderByScheduledAt']=_0x31a557[_0xc382('0x45')]||'DESC';this[_0xc382('0x46')]=_0x31a557['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xc382('0x47')]=_0x31a557[_0xc382('0x47')]||undefined;this[_0xc382('0x48')]=strategy[_0x31a557[_0xc382('0x48')]];this[_0xc382('0x49')]=!![];this[_0xc382('0x4a')]=_0x31a557[_0xc382('0x4a')]||![];this[_0xc382('0x4b')]=_0x31a557[_0xc382('0x4b')];this[_0xc382('0x4c')]=_0x31a557['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x31a557[_0xc382('0x4d')];this['dialAMDTotalAnalysisTime']=_0x31a557[_0xc382('0x4e')];this[_0xc382('0x4f')]=_0x31a557[_0xc382('0x4f')];this['dialAMDBetweenWordsSilence']=_0x31a557[_0xc382('0x50')];this[_0xc382('0x51')]=_0x31a557[_0xc382('0x51')];this[_0xc382('0x52')]=_0x31a557['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x31a557['dialAMDMaximumWordLength'];this[_0xc382('0x53')]=0x0;this[_0xc382('0x54')]=0x0;this[_0xc382('0x55')]=_0x31a557[_0xc382('0x55')];this[_0xc382('0x56')]=0x0;this[_0xc382('0x57')]=0x0;this[_0xc382('0x58')]=0x0;this[_0xc382('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xc382('0x5a')]=0x0;this[_0xc382('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xc382('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc382('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xc382('0x5e')]=0x0;this[_0xc382('0x5f')]=undefined;this[_0xc382('0x60')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xc382('0x61')]=0x0;this[_0xc382('0x62')]=0x0;this[_0xc382('0x63')]=0x0;this[_0xc382('0x64')]=0x0;this[_0xc382('0x65')]=0x0;this[_0xc382('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xc382('0x67')]=0x0;this[_0xc382('0x68')]=_0x31a557[_0xc382('0x69')]||0x14;this[_0xc382('0x6a')]=_0x31a557[_0xc382('0x69')]||0xa;this[_0xc382('0x6b')]=0x0;this[_0xc382('0x6c')]=0x0;this[_0xc382('0x6d')]=0x1;this['erlangCalls']=0x0;this[_0xc382('0x6e')]=0x0;this[_0xc382('0x6f')]=0x0;this[_0xc382('0x70')]=0x0;this[_0xc382('0x71')]=_0x31a557['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x31a557['dialRecallInQueue']||![];this[_0xc382('0x72')]=!!_0x31a557[_0xc382('0x72')]||![];this[_0xc382('0x73')]=!!_0x31a557[_0xc382('0x73')]||![];this[_0xc382('0x74')]=_0x31a557[_0xc382('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x31a557[_0xc382('0x75')]||![];this[_0xc382('0x76')]=_0x31a557[_0xc382('0x76')]||![];this[_0xc382('0x77')]=monitorFormat[_0x31a557['monitor_format']]?monitorFormat[_0x31a557[_0xc382('0x77')]]:undefined;this[_0xc382('0x78')]=_0x31a557[_0xc382('0x78')]||![];this['mandatoryDispositionPause']=_0x31a557[_0xc382('0x79')]?_0x31a557[_0xc382('0x79')]:undefined;this[_0xc382('0x7a')]=![];}module[_0xc382('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index bd5ab28..ac9c55d 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab36=['message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','booked','keys','queue','dialer','exten','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x3fe44b,_0x5c0687){var _0x5cfeec=function(_0x71133e){while(--_0x71133e){_0x3fe44b['push'](_0x3fe44b['shift']());}};_0x5cfeec(++_0x5c0687);}(_0xab36,0x1df));var _0x6ab3=function(_0x3ad20,_0x3efbea){_0x3ad20=_0x3ad20-0x0;var _0x468f48=_0xab36[_0x3ad20];return _0x468f48;};'use strict';var INBOUND_COUNTERS=[_0x6ab3('0x0'),_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x3'),_0x6ab3('0x4'),'talking',_0x6ab3('0x5')];var OUTBOUND_COUNTERS=[_0x6ab3('0x0'),_0x6ab3('0x6'),'inUse',_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x7'),_0x6ab3('0x8'),_0x6ab3('0x9'),_0x6ab3('0xa'),'outboundBusyCallsDay',_0x6ab3('0xb'),_0x6ab3('0xc'),'outboundNoSuchCallsDay',_0x6ab3('0xd'),'outboundRejectCallsDay',_0x6ab3('0xe'),_0x6ab3('0x3'),_0x6ab3('0xf'),_0x6ab3('0x10'),_0x6ab3('0x11'),_0x6ab3('0x12'),'total',_0x6ab3('0x5')];function VoiceQueueSummary(_0x576723){this['id']=_0x576723['id'];this[_0x6ab3('0x13')]=_0x576723[_0x6ab3('0x13')];this[_0x6ab3('0x14')]=_0x576723[_0x6ab3('0x14')];this[_0x6ab3('0x15')]=_0x576723['abandoned']||0x0;this[_0x6ab3('0x6')]=_0x576723[_0x6ab3('0x6')]||0x0;this[_0x6ab3('0x0')]=_0x576723[_0x6ab3('0x0')]||0x0;this[_0x6ab3('0x16')]=_0x576723['busy']||0x0;this[_0x6ab3('0x17')]=_0x576723['inUse']||0x0;this[_0x6ab3('0x18')]=_0x576723[_0x6ab3('0x18')]||0x0;this[_0x6ab3('0x1')]=_0x576723[_0x6ab3('0x1')]||0x0;this[_0x6ab3('0x2')]=_0x576723[_0x6ab3('0x2')]||0x0;this[_0x6ab3('0x19')]=_0x576723[_0x6ab3('0x19')]||0x0;this[_0x6ab3('0x1a')]=_0x576723['notInUse']||0x0;this[_0x6ab3('0x3')]=_0x576723['paused']||0x0;this[_0x6ab3('0x4')]=_0x576723[_0x6ab3('0x4')]||0x0;this[_0x6ab3('0x1b')]=_0x576723[_0x6ab3('0x1b')];this[_0x6ab3('0x11')]=_0x576723[_0x6ab3('0x11')];this[_0x6ab3('0x12')]=_0x576723['sumDuration'];this[_0x6ab3('0x1c')]=_0x576723[_0x6ab3('0x1c')]||0x0;this[_0x6ab3('0x10')]=_0x576723['talking']||0x0;this[_0x6ab3('0x1d')]=_0x576723['total']||0x0;this['type']=_0x576723[_0x6ab3('0x1e')];this['unavailable']=_0x576723[_0x6ab3('0x1f')]||0x0;this[_0x6ab3('0x20')]=_0x576723[_0x6ab3('0x20')]||0x0;this[_0x6ab3('0x21')]=_0x576723[_0x6ab3('0x21')]||0x0;this[_0x6ab3('0x5')]=_0x576723[_0x6ab3('0x5')]||0x0;if(_0x576723[_0x6ab3('0x1e')]===_0x6ab3('0x22')){this[_0x6ab3('0xf')]=_0x576723[_0x6ab3('0xf')]||0x0;this[_0x6ab3('0x23')]=_0x576723[_0x6ab3('0x23')];this[_0x6ab3('0x24')]=_0x576723['dialMethod'];this[_0x6ab3('0x25')]=_0x576723['dialOriginateCallerIdName'];this[_0x6ab3('0x26')]=_0x576723[_0x6ab3('0x26')];this[_0x6ab3('0x27')]=_0x576723[_0x6ab3('0x27')];this[_0x6ab3('0x28')]=_0x576723[_0x6ab3('0x28')];this['temp']=_0x576723['temp'];this[_0x6ab3('0x29')]=_0x576723['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x576723[_0x6ab3('0x9')];this[_0x6ab3('0xa')]=_0x576723[_0x6ab3('0xa')];this[_0x6ab3('0x2a')]=_0x576723[_0x6ab3('0x2a')];this[_0x6ab3('0xb')]=_0x576723[_0x6ab3('0xb')];this[_0x6ab3('0x2b')]=_0x576723['outboundDropCallsDayACS'];this[_0x6ab3('0x2c')]=_0x576723[_0x6ab3('0x2c')];this[_0x6ab3('0x2d')]=_0x576723[_0x6ab3('0x2d')];this[_0x6ab3('0xc')]=_0x576723[_0x6ab3('0xc')];this[_0x6ab3('0x2e')]=_0x576723[_0x6ab3('0x2e')];this['outboundOriginateFailureCallsDay']=_0x576723[_0x6ab3('0x2f')];this['outboundReCallsDay']=_0x576723['outboundReCallsDay'];this[_0x6ab3('0x30')]=_0x576723['outboundRejectCallsDay'];this[_0x6ab3('0xe')]=_0x576723[_0x6ab3('0xe')];this[_0x6ab3('0x31')]=_0x576723[_0x6ab3('0x31')];this[_0x6ab3('0x32')]=_0x576723[_0x6ab3('0x32')];this[_0x6ab3('0x33')]=_0x576723[_0x6ab3('0x33')];this[_0x6ab3('0x34')]=_0x576723[_0x6ab3('0x34')];this[_0x6ab3('0x35')]=_0x576723[_0x6ab3('0x35')];this[_0x6ab3('0x36')]=_0x576723[_0x6ab3('0x36')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x576723[_0x6ab3('0x37')];this[_0x6ab3('0x38')]=_0x576723[_0x6ab3('0x38')];this[_0x6ab3('0x39')]=_0x576723[_0x6ab3('0x39')];this[_0x6ab3('0x3a')]=_0x576723['predictiveIntervalPauses'];this[_0x6ab3('0x3b')]=_0x576723['predictiveIntervalAvailable'];this[_0x6ab3('0x3c')]=_0x576723[_0x6ab3('0x3c')];this['originated']=_0x576723[_0x6ab3('0x7')];this[_0x6ab3('0x3d')]=_0x576723['erlangCalls'];this['erlangCallToSecond']=_0x576723[_0x6ab3('0x3e')];this['erlangAbandonmentRate']=_0x576723[_0x6ab3('0x3f')];this[_0x6ab3('0x40')]=_0x576723['erlangBusyFactor'];this['startPredictive']=_0x576723[_0x6ab3('0x41')];this[_0x6ab3('0x42')]=_0x576723['startProgressive'];this['message']=_0x576723[_0x6ab3('0x43')];this[_0x6ab3('0x44')]=_0x576723['statusMessage'];}if(_0x576723[_0x6ab3('0x45')]){this[_0x6ab3('0x45')]={'id':_0x576723[_0x6ab3('0x45')]['id'],'name':_0x576723[_0x6ab3('0x45')][_0x6ab3('0x13')],'active':_0x576723['Trunk'][_0x6ab3('0x46')],'callerid':_0x576723['Trunk'][_0x6ab3('0x47')]};}}VoiceQueueSummary[_0x6ab3('0x48')][_0x6ab3('0x49')]=function(_0x3e5ae8,_0x26d6d6,_0x1fd302,_0x238059){this['loggedInDb']=0x0;this[_0x6ab3('0x10')]=0x0;this[_0x6ab3('0x3')]=0x0;this[_0x6ab3('0x20')]=0x0;this[_0x6ab3('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x6ab3('0x18')]=0x0;this[_0x6ab3('0x1f')]=0x0;this[_0x6ab3('0x4')]=0x0;this[_0x6ab3('0x1b')]=0x0;this[_0x6ab3('0x19')]=0x0;if(_0x1fd302){if(_0x1fd302['available']){this[_0x6ab3('0x0')]=Number(_0x1fd302['available']);}if(_0x1fd302[_0x6ab3('0x4a')]){this['loggedIn']=Number(_0x1fd302[_0x6ab3('0x4a')]);}if(_0x1fd302[_0x6ab3('0x4b')]){this[_0x6ab3('0x5')]=Number(_0x1fd302[_0x6ab3('0x4b')]);}}for(var _0x5be6ce=0x0;_0x5be6ce<_0x3e5ae8[_0x6ab3('0x4c')];_0x5be6ce++){var _0x1be23f=_0x26d6d6[_0x6ab3('0x4d')+_0x3e5ae8[_0x5be6ce][_0x6ab3('0x13')]];if(_0x1be23f&&_0x1be23f[_0x6ab3('0x4e')]){this[_0x6ab3('0x2')]+=0x1;}if(_0x3e5ae8[_0x5be6ce][_0x6ab3('0x4f')]==='1'){this['talking']+=0x1;}if(_0x3e5ae8[_0x5be6ce][_0x6ab3('0x3')]==='1'&&!['2','7','8']['includes'](_0x3e5ae8[_0x5be6ce][_0x6ab3('0x50')])){this['paused']+=0x1;}switch(_0x3e5ae8[_0x5be6ce]['status']){case'0':this[_0x6ab3('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x6ab3('0x17')]+=0x1;break;case'3':this[_0x6ab3('0x16')]+=0x1;break;case'4':this[_0x6ab3('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x6ab3('0x1b')]+=0x1;break;case'8':this[_0x6ab3('0x19')]+=0x1;break;}}if(this[_0x6ab3('0x24')]===_0x6ab3('0x51')){var _0x59ce45=Object[_0x6ab3('0x52')](_0x238059);for(var _0x3db4b6=0x0;_0x3db4b6<_0x59ce45[_0x6ab3('0x4c')];_0x3db4b6++){var _0x3bad93=_0x59ce45[_0x3db4b6];var _0x2f3132=_0x238059[_0x3bad93];if(_0x2f3132[_0x6ab3('0x53')]===this[_0x6ab3('0x13')]&&_0x2f3132['type']===_0x6ab3('0x54')&&_0x2f3132[_0x6ab3('0x55')]==='xcally-motion-preview'){this[_0x6ab3('0x10')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x6ab3('0x10')]=this[_0x6ab3('0x17')];}this[_0x6ab3('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x6ab3('0x48')]['compareToInboundQueue']=function(_0x30298e){var _0x21805e=![];if(_0x30298e){_0x21805e=INBOUND_COUNTERS[_0x6ab3('0x56')](function(_0x2ae757){return this[_0x2ae757]!==_0x30298e[_0x2ae757];},this);}return _0x21805e;};VoiceQueueSummary[_0x6ab3('0x48')][_0x6ab3('0x57')]=function(_0x3ad8a9){var _0x3d55a4=![];var _0x4f6c9b=![];var _0x1f6f10=![];if(_0x3ad8a9){_0x3d55a4=this['dialMethod']!==_0x3ad8a9['dialMethod']||this[_0x6ab3('0x23')]!==_0x3ad8a9[_0x6ab3('0x23')]||this['message']!==_0x3ad8a9[_0x6ab3('0x43')]||this['statusMessage']!==_0x3ad8a9['statusMessage'];_0x4f6c9b=OUTBOUND_COUNTERS[_0x6ab3('0x56')](function(_0x591eed){return this[_0x591eed]!==_0x3ad8a9[_0x591eed];},this);if(this['Trunk']&&_0x3ad8a9[_0x6ab3('0x45')]){_0x1f6f10=this[_0x6ab3('0x45')][_0x6ab3('0x13')]!==_0x3ad8a9['Trunk']['name']||this[_0x6ab3('0x45')][_0x6ab3('0x46')]!==_0x3ad8a9[_0x6ab3('0x45')][_0x6ab3('0x46')];}}return _0x3d55a4||_0x4f6c9b||_0x1f6f10;};VoiceQueueSummary['prototype'][_0x6ab3('0x58')]=function(_0x407315){this[_0x6ab3('0x6')]=_0x407315[_0x6ab3('0x6')];this[_0x6ab3('0x43')]=_0x407315['message'];this[_0x6ab3('0x44')]=_0x407315['statusMessage'];this['originated']=_0x407315[_0x6ab3('0x7')];this[_0x6ab3('0x8')]=_0x407315[_0x6ab3('0x8')];this[_0x6ab3('0x9')]=_0x407315['outboundAnswerCallsDay'];this[_0x6ab3('0xa')]=_0x407315[_0x6ab3('0xa')];this['outboundBusyCallsDay']=_0x407315[_0x6ab3('0x2a')];this[_0x6ab3('0xb')]=_0x407315[_0x6ab3('0xb')];this[_0x6ab3('0xc')]=_0x407315['outboundNoAnswerCallsDay'];this[_0x6ab3('0x2e')]=_0x407315[_0x6ab3('0x2e')];this[_0x6ab3('0xd')]=_0x407315[_0x6ab3('0xd')];this['outboundRejectCallsDay']=_0x407315[_0x6ab3('0x30')];this[_0x6ab3('0xe')]=_0x407315[_0x6ab3('0xe')];this[_0x6ab3('0x11')]=_0x407315[_0x6ab3('0x11')];this[_0x6ab3('0x12')]=_0x407315['sumDuration'];this['total']=_0x407315[_0x6ab3('0x1d')];if(this['dialMethod']===_0x6ab3('0x59')){this[_0x6ab3('0xf')]=_0x407315[_0x6ab3('0xf')];}};module[_0x6ab3('0x5a')]=VoiceQueueSummary; \ No newline at end of file +var _0x5581=['incall','status','booked','keys','queue','dialer','xcally-motion-preview','compareToInboundQueue','some','prototype','compareToOutboundQueue','updateReportFromOutboundQueue','preview','available','loggedInDb','paused','ringing','talking','waiting','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','online'];(function(_0x5c118f,_0x31b475){var _0x1406f8=function(_0x11ca98){while(--_0x11ca98){_0x5c118f['push'](_0x5c118f['shift']());}};_0x1406f8(++_0x31b475);}(_0x5581,0x115));var _0x1558=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x5581[_0x1b2ff7];return _0x31656a;};'use strict';var INBOUND_COUNTERS=[_0x1558('0x0'),'loggedIn',_0x1558('0x1'),_0x1558('0x2'),_0x1558('0x3'),_0x1558('0x4'),_0x1558('0x5')];var OUTBOUND_COUNTERS=[_0x1558('0x0'),'answered',_0x1558('0x6'),_0x1558('0x7'),'loggedInDb',_0x1558('0x8'),_0x1558('0x9'),'outboundAnswerCallsDay',_0x1558('0xa'),_0x1558('0xb'),_0x1558('0xc'),_0x1558('0xd'),_0x1558('0xe'),'outboundReCallsDay',_0x1558('0xf'),_0x1558('0x10'),_0x1558('0x2'),_0x1558('0x11'),_0x1558('0x4'),_0x1558('0x12'),_0x1558('0x13'),_0x1558('0x14'),_0x1558('0x5')];function VoiceQueueSummary(_0x36d92a){this['id']=_0x36d92a['id'];this[_0x1558('0x15')]=_0x36d92a[_0x1558('0x15')];this[_0x1558('0x16')]=_0x36d92a['strategy'];this[_0x1558('0x17')]=_0x36d92a[_0x1558('0x17')]||0x0;this[_0x1558('0x18')]=_0x36d92a[_0x1558('0x18')]||0x0;this[_0x1558('0x0')]=_0x36d92a[_0x1558('0x0')]||0x0;this[_0x1558('0x19')]=_0x36d92a[_0x1558('0x19')]||0x0;this[_0x1558('0x6')]=_0x36d92a['inUse']||0x0;this[_0x1558('0x1a')]=_0x36d92a[_0x1558('0x1a')]||0x0;this[_0x1558('0x7')]=_0x36d92a['loggedIn']||0x0;this[_0x1558('0x1')]=_0x36d92a[_0x1558('0x1')]||0x0;this[_0x1558('0x1b')]=_0x36d92a[_0x1558('0x1b')]||0x0;this[_0x1558('0x1c')]=_0x36d92a['notInUse']||0x0;this['paused']=_0x36d92a[_0x1558('0x2')]||0x0;this[_0x1558('0x3')]=_0x36d92a[_0x1558('0x3')]||0x0;this[_0x1558('0x1d')]=_0x36d92a[_0x1558('0x1d')];this[_0x1558('0x12')]=_0x36d92a[_0x1558('0x12')];this[_0x1558('0x13')]=_0x36d92a['sumDuration'];this['sumHoldTime']=_0x36d92a['sumHoldTime']||0x0;this[_0x1558('0x4')]=_0x36d92a[_0x1558('0x4')]||0x0;this[_0x1558('0x14')]=_0x36d92a[_0x1558('0x14')]||0x0;this[_0x1558('0x1e')]=_0x36d92a[_0x1558('0x1e')];this[_0x1558('0x1f')]=_0x36d92a[_0x1558('0x1f')]||0x0;this['unknown']=_0x36d92a[_0x1558('0x20')]||0x0;this['unmanaged']=_0x36d92a[_0x1558('0x21')]||0x0;this[_0x1558('0x5')]=_0x36d92a[_0x1558('0x5')]||0x0;if(_0x36d92a[_0x1558('0x1e')]===_0x1558('0x22')){this[_0x1558('0x11')]=_0x36d92a[_0x1558('0x11')]||0x0;this['dialActive']=_0x36d92a[_0x1558('0x23')];this[_0x1558('0x24')]=_0x36d92a[_0x1558('0x24')];this[_0x1558('0x25')]=_0x36d92a[_0x1558('0x25')];this['dialOriginateCallerIdNumber']=_0x36d92a[_0x1558('0x26')];this[_0x1558('0x27')]=_0x36d92a[_0x1558('0x27')];this['dialPrefix']=_0x36d92a[_0x1558('0x28')];this[_0x1558('0x29')]=_0x36d92a[_0x1558('0x29')];this['outboundAnswerAgiCallsDay']=_0x36d92a[_0x1558('0x2a')];this['outboundAnswerCallsDay']=_0x36d92a[_0x1558('0x2b')];this[_0x1558('0xa')]=_0x36d92a['outboundBlacklistCallsDay'];this[_0x1558('0xb')]=_0x36d92a['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x36d92a[_0x1558('0xc')];this[_0x1558('0x2c')]=_0x36d92a[_0x1558('0x2c')];this[_0x1558('0x2d')]=_0x36d92a[_0x1558('0x2d')];this['outboundDropCallsDayTimeout']=_0x36d92a['outboundDropCallsDayTimeout'];this[_0x1558('0xd')]=_0x36d92a[_0x1558('0xd')];this[_0x1558('0xe')]=_0x36d92a[_0x1558('0xe')];this[_0x1558('0x2e')]=_0x36d92a[_0x1558('0x2e')];this['outboundReCallsDay']=_0x36d92a[_0x1558('0x2f')];this['outboundRejectCallsDay']=_0x36d92a[_0x1558('0xf')];this[_0x1558('0x10')]=_0x36d92a[_0x1558('0x10')];this[_0x1558('0x30')]=_0x36d92a[_0x1558('0x30')];this[_0x1558('0x31')]=_0x36d92a[_0x1558('0x31')];this[_0x1558('0x32')]=_0x36d92a['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x36d92a[_0x1558('0x33')];this[_0x1558('0x34')]=_0x36d92a['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x36d92a['predictiveIntervalErlangCalls'];this[_0x1558('0x35')]=_0x36d92a['predictiveIntervalErlangCallsDroppedCalls'];this[_0x1558('0x36')]=_0x36d92a[_0x1558('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x36d92a[_0x1558('0x37')];this['predictiveIntervalPauses']=_0x36d92a[_0x1558('0x38')];this['predictiveIntervalAvailable']=_0x36d92a[_0x1558('0x39')];this['predictiveIntervalTotalCalls']=_0x36d92a[_0x1558('0x3a')];this[_0x1558('0x8')]=_0x36d92a[_0x1558('0x8')];this[_0x1558('0x3b')]=_0x36d92a[_0x1558('0x3b')];this[_0x1558('0x3c')]=_0x36d92a[_0x1558('0x3c')];this[_0x1558('0x3d')]=_0x36d92a[_0x1558('0x3d')];this['erlangBusyFactor']=_0x36d92a['erlangBusyFactor'];this[_0x1558('0x3e')]=_0x36d92a[_0x1558('0x3e')];this[_0x1558('0x3f')]=_0x36d92a[_0x1558('0x3f')];this[_0x1558('0x40')]=_0x36d92a[_0x1558('0x40')];this[_0x1558('0x41')]=_0x36d92a['statusMessage'];}if(_0x36d92a[_0x1558('0x42')]){this['Trunk']={'id':_0x36d92a[_0x1558('0x42')]['id'],'name':_0x36d92a['Trunk'][_0x1558('0x15')],'active':_0x36d92a[_0x1558('0x42')][_0x1558('0x43')],'callerid':_0x36d92a[_0x1558('0x42')][_0x1558('0x44')]};}}VoiceQueueSummary['prototype'][_0x1558('0x45')]=function(_0x48bd37,_0xc35c46,_0x304b9c,_0x346af2){this[_0x1558('0x1')]=0x0;this[_0x1558('0x4')]=0x0;this[_0x1558('0x2')]=0x0;this[_0x1558('0x20')]=0x0;this[_0x1558('0x1c')]=0x0;this[_0x1558('0x6')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x1558('0x1f')]=0x0;this[_0x1558('0x3')]=0x0;this['ringInUse']=0x0;this[_0x1558('0x1b')]=0x0;if(_0x304b9c){if(_0x304b9c[_0x1558('0x0')]){this[_0x1558('0x0')]=Number(_0x304b9c['available']);}if(_0x304b9c[_0x1558('0x46')]){this[_0x1558('0x7')]=Number(_0x304b9c['loggedin']);}if(_0x304b9c[_0x1558('0x47')]){this[_0x1558('0x5')]=Number(_0x304b9c[_0x1558('0x47')]);}}for(var _0x4988f3=0x0;_0x4988f3<_0x48bd37[_0x1558('0x48')];_0x4988f3++){var _0x4b3357=_0xc35c46[_0x1558('0x49')+_0x48bd37[_0x4988f3][_0x1558('0x15')]];if(_0x4b3357&&_0x4b3357[_0x1558('0x4a')]){this[_0x1558('0x1')]+=0x1;}if(_0x48bd37[_0x4988f3][_0x1558('0x4b')]==='1'){this[_0x1558('0x4')]+=0x1;}if(_0x48bd37[_0x4988f3][_0x1558('0x2')]==='1'&&!['2','7','8']['includes'](_0x48bd37[_0x4988f3][_0x1558('0x4c')])){this['paused']+=0x1;}switch(_0x48bd37[_0x4988f3][_0x1558('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x1558('0x6')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x1558('0x1f')]+=0x1;break;case'6':this[_0x1558('0x3')]+=0x1;break;case'7':this[_0x1558('0x1d')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x1558('0x24')]===_0x1558('0x4d')){var _0x2e52ce=Object[_0x1558('0x4e')](_0x346af2);for(var _0x22ff42=0x0;_0x22ff42<_0x2e52ce[_0x1558('0x48')];_0x22ff42++){var _0x5c614f=_0x2e52ce[_0x22ff42];var _0x3c7502=_0x346af2[_0x5c614f];if(_0x3c7502[_0x1558('0x4f')]===this[_0x1558('0x15')]&&_0x3c7502[_0x1558('0x1e')]===_0x1558('0x50')&&_0x3c7502['exten']===_0x1558('0x51')){this[_0x1558('0x4')]+=0x1;}}if(this['talking']>this['inUse']){this[_0x1558('0x4')]=this['inUse'];}this[_0x1558('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x1558('0x52')]=function(_0x3d60e5){var _0x2729e4=![];if(_0x3d60e5){_0x2729e4=INBOUND_COUNTERS[_0x1558('0x53')](function(_0x54e33e){return this[_0x54e33e]!==_0x3d60e5[_0x54e33e];},this);}return _0x2729e4;};VoiceQueueSummary[_0x1558('0x54')][_0x1558('0x55')]=function(_0x1bd5ed){var _0x55cce4=![];var _0x19a287=![];var _0x520df2=![];if(_0x1bd5ed){_0x55cce4=this[_0x1558('0x24')]!==_0x1bd5ed['dialMethod']||this[_0x1558('0x23')]!==_0x1bd5ed[_0x1558('0x23')]||this[_0x1558('0x40')]!==_0x1bd5ed[_0x1558('0x40')]||this['statusMessage']!==_0x1bd5ed[_0x1558('0x41')];_0x19a287=OUTBOUND_COUNTERS[_0x1558('0x53')](function(_0x26c604){return this[_0x26c604]!==_0x1bd5ed[_0x26c604];},this);if(this[_0x1558('0x42')]&&_0x1bd5ed[_0x1558('0x42')]){_0x520df2=this[_0x1558('0x42')][_0x1558('0x15')]!==_0x1bd5ed['Trunk'][_0x1558('0x15')]||this[_0x1558('0x42')]['active']!==_0x1bd5ed[_0x1558('0x42')][_0x1558('0x43')];}}return _0x55cce4||_0x19a287||_0x520df2;};VoiceQueueSummary[_0x1558('0x54')][_0x1558('0x56')]=function(_0x2c44cc){this[_0x1558('0x18')]=_0x2c44cc[_0x1558('0x18')];this[_0x1558('0x40')]=_0x2c44cc['message'];this[_0x1558('0x41')]=_0x2c44cc[_0x1558('0x41')];this[_0x1558('0x8')]=_0x2c44cc[_0x1558('0x8')];this[_0x1558('0x9')]=_0x2c44cc['outboundAbandonedCallsDay'];this[_0x1558('0x2b')]=_0x2c44cc['outboundAnswerCallsDay'];this[_0x1558('0xa')]=_0x2c44cc[_0x1558('0xa')];this[_0x1558('0xb')]=_0x2c44cc[_0x1558('0xb')];this['outboundCongestionCallsDay']=_0x2c44cc[_0x1558('0xc')];this[_0x1558('0xd')]=_0x2c44cc[_0x1558('0xd')];this[_0x1558('0xe')]=_0x2c44cc[_0x1558('0xe')];this[_0x1558('0x2f')]=_0x2c44cc[_0x1558('0x2f')];this[_0x1558('0xf')]=_0x2c44cc['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x2c44cc[_0x1558('0x10')];this[_0x1558('0x12')]=_0x2c44cc[_0x1558('0x12')];this['sumDuration']=_0x2c44cc[_0x1558('0x13')];this['total']=_0x2c44cc[_0x1558('0x14')];if(this[_0x1558('0x24')]===_0x1558('0x57')){this[_0x1558('0x11')]=_0x2c44cc[_0x1558('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 025bb11..5320e79 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 _0x28c5=['exports','username','remoteUri','serverUrl','Configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28c5,0x19b));var _0x528c=function(_0x4bed11,_0xfb18bd){_0x4bed11=_0x4bed11-0x0;var _0x5b3fca=_0x28c5[_0x4bed11];return _0x5b3fca;};'use strict';function VtigerAccount(_0x374d62){this['id']=_0x374d62['id']||0x0;this['name']=_0x374d62['name']||'';this[_0x528c('0x0')]=_0x374d62[_0x528c('0x0')]||'';this['accessKey']=_0x374d62['accessKey']||'';this[_0x528c('0x1')]=_0x374d62['remoteUri']||'';this[_0x528c('0x2')]=_0x374d62[_0x528c('0x2')]||'';this['Configurations']=_0x374d62[_0x528c('0x3')]||{};}module[_0x528c('0x4')]=VtigerAccount; \ No newline at end of file +var _0xd8e5=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xd8e5,0xd2));var _0x5d8e=function(_0x37db0a,_0x14501d){_0x37db0a=_0x37db0a-0x0;var _0x4daea8=_0xd8e5[_0x37db0a];return _0x4daea8;};'use strict';function VtigerAccount(_0x4a8302){this['id']=_0x4a8302['id']||0x0;this[_0x5d8e('0x0')]=_0x4a8302[_0x5d8e('0x0')]||'';this[_0x5d8e('0x1')]=_0x4a8302['username']||'';this[_0x5d8e('0x2')]=_0x4a8302['accessKey']||'';this[_0x5d8e('0x3')]=_0x4a8302[_0x5d8e('0x3')]||'';this['serverUrl']=_0x4a8302[_0x5d8e('0x4')]||'';this[_0x5d8e('0x5')]=_0x4a8302[_0x5d8e('0x5')]||{};}module[_0x5d8e('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 fc90359..8ffbe6f 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 _0xf692=['token','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x28731b,_0x254826){var _0x628abc=function(_0x2b753c){while(--_0x2b753c){_0x28731b['push'](_0x28731b['shift']());}};_0x628abc(++_0x254826);}(_0xf692,0xba));var _0x2f69=function(_0x113fac,_0x44a43d){_0x113fac=_0x113fac-0x0;var _0x32e9fc=_0xf692[_0x113fac];return _0x32e9fc;};'use strict';function ZendeskAccount(_0x5349d7){this['id']=_0x5349d7['id']||0x0;this[_0x2f69('0x0')]=_0x5349d7[_0x2f69('0x0')]||'';this['username']=_0x5349d7[_0x2f69('0x1')]||'';this[_0x2f69('0x2')]=_0x5349d7[_0x2f69('0x2')]||'';this[_0x2f69('0x3')]=_0x5349d7['token']||'';this['remoteUri']=_0x5349d7['remoteUri']||'';this[_0x2f69('0x4')]=_0x5349d7['authType']||'';this[_0x2f69('0x5')]=_0x5349d7[_0x2f69('0x5')]||_0x2f69('0x6');this[_0x2f69('0x7')]=_0x5349d7[_0x2f69('0x7')]||'';this['Configurations']=_0x5349d7[_0x2f69('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x55ef=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x30de5d,_0x457ae9){var _0x377c5b=function(_0x5c8287){while(--_0x5c8287){_0x30de5d['push'](_0x30de5d['shift']());}};_0x377c5b(++_0x457ae9);}(_0x55ef,0x1b8));var _0xf55e=function(_0x2c2541,_0x389b96){_0x2c2541=_0x2c2541-0x0;var _0x57036b=_0x55ef[_0x2c2541];return _0x57036b;};'use strict';function ZendeskAccount(_0x2f847f){this['id']=_0x2f847f['id']||0x0;this[_0xf55e('0x0')]=_0x2f847f[_0xf55e('0x0')]||'';this[_0xf55e('0x1')]=_0x2f847f['username']||'';this[_0xf55e('0x2')]=_0x2f847f[_0xf55e('0x2')]||'';this['token']=_0x2f847f[_0xf55e('0x3')]||'';this[_0xf55e('0x4')]=_0x2f847f['remoteUri']||'';this[_0xf55e('0x5')]=_0x2f847f[_0xf55e('0x5')]||'';this[_0xf55e('0x6')]=_0x2f847f[_0xf55e('0x6')]||_0xf55e('0x7');this[_0xf55e('0x8')]=_0x2f847f['serverUrl']||'';this[_0xf55e('0x9')]=_0x2f847f[_0xf55e('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 9772ebf..0c780d7 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 _0xeef7=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x87ffc2,_0x38d737){var _0x5179be=function(_0x533e09){while(--_0x533e09){_0x87ffc2['push'](_0x87ffc2['shift']());}};_0x5179be(++_0x38d737);}(_0xeef7,0x133));var _0x7eef=function(_0x4d07d9,_0x152e11){_0x4d07d9=_0x4d07d9-0x0;var _0xcc917e=_0xeef7[_0x4d07d9];return _0xcc917e;};'use strict';function ZohoAccount(_0x2f4050){this['id']=_0x2f4050['id']||0x0;this[_0x7eef('0x0')]=_0x2f4050['name']||'';this[_0x7eef('0x1')]=_0x2f4050[_0x7eef('0x1')]||'';this[_0x7eef('0x2')]=_0x2f4050[_0x7eef('0x2')]||'';this[_0x7eef('0x3')]=_0x2f4050[_0x7eef('0x3')]||'';this[_0x7eef('0x4')]=_0x2f4050['clientId']||'';this[_0x7eef('0x5')]=_0x2f4050['clientSecret']||'';this[_0x7eef('0x6')]=_0x2f4050[_0x7eef('0x6')]||'';this['code']=_0x2f4050[_0x7eef('0x7')]||'';this[_0x7eef('0x8')]=_0x2f4050[_0x7eef('0x8')]||'';this[_0x7eef('0x9')]=_0x2f4050[_0x7eef('0x9')]||{};}module[_0x7eef('0xa')]=ZohoAccount; \ No newline at end of file +var _0xd1fd=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x308d5d,_0xbd35a9){var _0xbdb9c1=function(_0x590786){while(--_0x590786){_0x308d5d['push'](_0x308d5d['shift']());}};_0xbdb9c1(++_0xbd35a9);}(_0xd1fd,0x153));var _0xdd1f=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0xd1fd[_0x57966a];return _0x191765;};'use strict';function ZohoAccount(_0x51cf30){this['id']=_0x51cf30['id']||0x0;this[_0xdd1f('0x0')]=_0x51cf30['name']||'';this['description']=_0x51cf30['description']||'';this[_0xdd1f('0x1')]=_0x51cf30[_0xdd1f('0x1')]||'';this[_0xdd1f('0x2')]=_0x51cf30[_0xdd1f('0x2')]||'';this[_0xdd1f('0x3')]=_0x51cf30[_0xdd1f('0x3')]||'';this[_0xdd1f('0x4')]=_0x51cf30[_0xdd1f('0x4')]||'';this[_0xdd1f('0x5')]=_0x51cf30[_0xdd1f('0x5')]||'';this[_0xdd1f('0x6')]=_0x51cf30[_0xdd1f('0x6')]||'';this[_0xdd1f('0x7')]=_0x51cf30[_0xdd1f('0x7')]||'';this[_0xdd1f('0x8')]=_0x51cf30[_0xdd1f('0x8')]||{};}module[_0xdd1f('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index bd8ac79..50aaa3b 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 _0xe820=['calleridname','Contact','lastName','phone','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','format','SIP/%s'];(function(_0x5b1499,_0x49d3f1){var _0x5b70de=function(_0x49e362){while(--_0x49e362){_0x5b1499['push'](_0x5b1499['shift']());}};_0x5b70de(++_0x49d3f1);}(_0xe820,0xd2));var _0x0e82=function(_0x371fc4,_0x49353c){_0x371fc4=_0x371fc4-0x0;var _0x9dfa94=_0xe820[_0x371fc4];return _0x9dfa94;};'use strict';var util=require(_0x0e82('0x0'));var _=require('lodash');var moment=require(_0x0e82('0x1'));function checkNameSurname(_0x4e6b50,_0x55bbeb,_0x2d4a09){var _0x7b2e95='';if(!_[_0x0e82('0x2')](_0x55bbeb)&&'string'===typeof _0x55bbeb){_0x7b2e95+=_0x55bbeb;}if(!_[_0x0e82('0x2')](_0x2d4a09)&&'string'===typeof _0x2d4a09){_0x7b2e95+='\x20'+_0x2d4a09;}if(_0x7b2e95!==''){return _0x7b2e95;}return _0x4e6b50;}function Action(_0x2cb88f,_0x105e3c,_0x69e27f,_0x328b32,_0x2a0f9b){this['uniqueid']=_0x69e27f||undefined;this[_0x0e82('0x3')]=_0x2cb88f['id'];this[_0x0e82('0x4')]=_0x105e3c[_0x0e82('0x5')];this[_0x0e82('0x6')]=_0x105e3c[_0x0e82('0x6')];this['campaigntype']=_0x0e82('0x4');this[_0x0e82('0x7')]=![];this[_0x0e82('0x8')]=_[_0x0e82('0x2')](_0x2cb88f[_0x0e82('0x9')])?undefined:_0x2cb88f[_0x0e82('0x9')][_0x0e82('0x5')];this['channelAgent']=this[_0x0e82('0x8')]?util[_0x0e82('0xa')](_0x0e82('0xb'),this[_0x0e82('0x8')]):_0x328b32||undefined;this[_0x0e82('0xc')]=checkNameSurname(_0x2cb88f[_0x0e82('0xd')]['phone'],_0x2cb88f[_0x0e82('0xd')]['firstName'],_0x2cb88f['Contact'][_0x0e82('0xe')]);this['active']=_0x2cb88f['active']||![];this['calleridnum']=_0x2cb88f[_0x0e82('0xf')];this['scheduledat']=_0x2cb88f['scheduledat'];this[_0x0e82('0x10')]=_0x2cb88f['countbusyretry']||0x0;this[_0x0e82('0x11')]=_0x2cb88f[_0x0e82('0x11')]||0x0;this[_0x0e82('0x12')]=_0x2cb88f[_0x0e82('0x12')]||0x0;this['countglobal']=(_0x2cb88f[_0x0e82('0x10')]||0x0)+(_0x2cb88f[_0x0e82('0x11')]||0x0)+(_0x2cb88f[_0x0e82('0x12')]||0x0)+(_0x2cb88f[_0x0e82('0x13')]||0x0)+(_0x2cb88f[_0x0e82('0x14')]||0x0)+(_0x2cb88f[_0x0e82('0x15')]||0x0)+(_0x2cb88f[_0x0e82('0x16')]||0x0)+(_0x2cb88f[_0x0e82('0x17')]||0x0);this[_0x0e82('0x13')]=_0x2cb88f[_0x0e82('0x13')]||0x0;this[_0x0e82('0x14')]=_0x2cb88f['countdropretry']||0x0;this['countabandonedretry']=_0x2cb88f[_0x0e82('0x15')]||0x0;this[_0x0e82('0x16')]=_0x2cb88f[_0x0e82('0x16')]||0x0;this[_0x0e82('0x17')]=_0x2cb88f[_0x0e82('0x17')]||0x0;this[_0x0e82('0x18')]=_0x2cb88f[_0x0e82('0x18')];this[_0x0e82('0x19')]=_0x2cb88f['callbackuniqueid'];this[_0x0e82('0x1a')]=_0x2cb88f[_0x0e82('0x1a')];this[_0x0e82('0x1b')]=_0x2cb88f[_0x0e82('0x1b')];this['ContactId']=_0x2cb88f[_0x0e82('0x1c')];this[_0x0e82('0x1d')]=_0x2cb88f[_0x0e82('0x1d')];this[_0x0e82('0x1e')]=_['isNil'](_0x2cb88f[_0x0e82('0x9')])?_0x2cb88f['UserId']:_0x2cb88f['Agent']['id'];this[_0x0e82('0x1f')]=_0x2cb88f[_0x0e82('0x1f')];this['originatecalleridnum']='';this[_0x0e82('0x20')]='';}Action[_0x0e82('0x21')][_0x0e82('0x22')]=function(){return util['format'](_0x0e82('0x23'),this[_0x0e82('0xc')],this['number']);};module[_0x0e82('0x24')]=Action; \ No newline at end of file +var _0x3d04=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry'];(function(_0x572557,_0x2fea97){var _0x269649=function(_0x38f968){while(--_0x38f968){_0x572557['push'](_0x572557['shift']());}};_0x269649(++_0x2fea97);}(_0x3d04,0xbe));var _0x43d0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3d04[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x43d0('0x0'));var _=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));function checkNameSurname(_0x105c73,_0x191de5,_0x143fea){var _0x3d6e62='';if(!_[_0x43d0('0x3')](_0x191de5)&&'string'===typeof _0x191de5){_0x3d6e62+=_0x191de5;}if(!_[_0x43d0('0x3')](_0x143fea)&&_0x43d0('0x4')===typeof _0x143fea){_0x3d6e62+='\x20'+_0x143fea;}if(_0x3d6e62!==''){return _0x3d6e62;}return _0x105c73;}function Action(_0x746f5e,_0x617bf,_0x5e284f,_0x484271,_0x50919e){this['uniqueid']=_0x5e284f||undefined;this[_0x43d0('0x5')]=_0x746f5e['id'];this[_0x43d0('0x6')]=_0x617bf[_0x43d0('0x7')];this[_0x43d0('0x8')]=_0x617bf[_0x43d0('0x8')];this['campaigntype']='queue';this[_0x43d0('0x9')]=![];this['membername']=_['isNil'](_0x746f5e[_0x43d0('0xa')])?undefined:_0x746f5e[_0x43d0('0xa')][_0x43d0('0x7')];this[_0x43d0('0xb')]=this['membername']?util[_0x43d0('0xc')](_0x43d0('0xd'),this['membername']):_0x484271||undefined;this[_0x43d0('0xe')]=checkNameSurname(_0x746f5e[_0x43d0('0xf')][_0x43d0('0x10')],_0x746f5e['Contact'][_0x43d0('0x11')],_0x746f5e[_0x43d0('0xf')][_0x43d0('0x12')]);this['active']=_0x746f5e[_0x43d0('0x13')]||![];this[_0x43d0('0x14')]=_0x746f5e[_0x43d0('0x10')];this[_0x43d0('0x15')]=_0x746f5e[_0x43d0('0x15')];this['countbusyretry']=_0x746f5e['countbusyretry']||0x0;this[_0x43d0('0x16')]=_0x746f5e[_0x43d0('0x16')]||0x0;this[_0x43d0('0x17')]=_0x746f5e['countnoanswerretry']||0x0;this[_0x43d0('0x18')]=(_0x746f5e['countbusyretry']||0x0)+(_0x746f5e[_0x43d0('0x16')]||0x0)+(_0x746f5e[_0x43d0('0x17')]||0x0)+(_0x746f5e[_0x43d0('0x19')]||0x0)+(_0x746f5e['countdropretry']||0x0)+(_0x746f5e[_0x43d0('0x1a')]||0x0)+(_0x746f5e[_0x43d0('0x1b')]||0x0)+(_0x746f5e['countagentrejectretry']||0x0);this[_0x43d0('0x19')]=_0x746f5e[_0x43d0('0x19')]||0x0;this[_0x43d0('0x1c')]=_0x746f5e[_0x43d0('0x1c')]||0x0;this[_0x43d0('0x1a')]=_0x746f5e[_0x43d0('0x1a')]||0x0;this[_0x43d0('0x1b')]=_0x746f5e[_0x43d0('0x1b')]||0x0;this[_0x43d0('0x1d')]=_0x746f5e[_0x43d0('0x1d')]||0x0;this[_0x43d0('0x1e')]=_0x746f5e[_0x43d0('0x1e')];this[_0x43d0('0x1f')]=_0x746f5e[_0x43d0('0x1f')];this[_0x43d0('0x20')]=_0x746f5e['callbackat'];this[_0x43d0('0x21')]=_0x746f5e[_0x43d0('0x21')];this['ContactId']=_0x746f5e[_0x43d0('0x22')];this['ListId']=_0x746f5e[_0x43d0('0x23')];this[_0x43d0('0x24')]=_['isNil'](_0x746f5e[_0x43d0('0xa')])?_0x746f5e[_0x43d0('0x24')]:_0x746f5e['Agent']['id'];this[_0x43d0('0x25')]=_0x746f5e[_0x43d0('0x25')];this[_0x43d0('0x26')]='';this['originatecalleridname']='';}Action[_0x43d0('0x27')][_0x43d0('0x28')]=function(){return util[_0x43d0('0xc')](_0x43d0('0x29'),this[_0x43d0('0xe')],this[_0x43d0('0x2a')]);};module[_0x43d0('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 e898725..785bc07 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','Answer','[syncHangup][talking]','cause','statedesc','channelstate','transfer','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','name','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','isNil','Contact','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]'];(function(_0x2c4e05,_0x306c4e){var _0x2563df=function(_0x2a56fa){while(--_0x2a56fa){_0x2c4e05['push'](_0x2c4e05['shift']());}};_0x2563df(++_0x306c4e);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));var logger=require(_0x49c4('0x4'))(_0x49c4('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x49c4('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49c4('0x7'));var Action=require(_0x49c4('0x8'));var ut=require(_0x49c4('0x9'));var utils=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitVoiceQueueChannelRemove(_0x46e475){logger[_0x49c4('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x46e475));emit(util['format'](_0x49c4('0x25'),_0x46e475['name']),'voice_queue_channel:remove',_0x46e475);io[_0x49c4('0x23')](_0x49c4('0x26'),_0x46e475);}function notSendMessagesQueue(_0x26c640){if(_0x26c640[_0x49c4('0x27')]){if(_0x26c640['originated']===0x0&&_0x26c640['pTalking']===0x0){_0x26c640[_0x49c4('0x27')]=![];_0x26c640[_0x49c4('0x28')]=0x0;_0x26c640['paused']=0x0;_0x26c640[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];ut[_0x49c4('0x2c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26c640['name']+_0x49c4('0x2d'));}else{_0x26c640['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2e')];ut[_0x49c4('0x2c')](_0x49c4('0x2f'),_0x26c640['name']+_0x49c4('0x30'));}}}Preview[_0x49c4('0x31')][_0x49c4('0x22')]=function(){var _0x4f28a2=this;setInterval(function(){_0x4f28a2[_0x49c4('0x32')]();},0x7cf);};Preview[_0x49c4('0x31')][_0x49c4('0x32')]=function(){var _0x427b26=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x46f7ea in _0x427b26){if(_0x427b26['hasOwnProperty'](_0x46f7ea)&&(_0x427b26[_0x46f7ea]['dialMethod']==='preview'||_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x34'))&&_0x427b26[_0x46f7ea][_0x49c4('0x35')]===_0x49c4('0x36')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x37')]();}}if(_0x427b26[_0x49c4('0x38')](_0x46f7ea)&&_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x5')&&_0x427b26[_0x46f7ea]['type']==='outbound'){if(_0x427b26[_0x46f7ea][_0x49c4('0x39')]){this[_0x49c4('0x3a')](_0x427b26[_0x46f7ea]);if(_0x427b26[_0x46f7ea][_0x49c4('0x3b')])this[_0x49c4('0x3c')](_0x427b26[_0x46f7ea]);}else{notSendMessagesQueue(_0x427b26[_0x46f7ea]);}}}};Preview[_0x49c4('0x31')]['clearZombieChannel']=function(_0x2aac35){var _0x84c621=this;this[_0x49c4('0x3d')]['enqueue'](function(){if(!_['isNil'](_0x84c621[_0x49c4('0x13')][_0x2aac35])){loggerAction[_0x49c4('0x24')](_0x49c4('0x3e'),_0x2aac35,_0x49c4('0x3f'),_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')],_0x49c4('0x41'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]]['originated']),_0x49c4('0x43'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35]['queue']][_0x49c4('0x44')]),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x13')][_0x2aac35]['dialAnswer']),JSON[_0x49c4('0x42')](_[_0x49c4('0x45')](_0x84c621[_0x49c4('0x13')][_0x2aac35],[_0x49c4('0x46'),_0x49c4('0x47'),_0x49c4('0x48'),_0x49c4('0x49')])));return ami[_0x49c4('0x4a')]({'action':_0x49c4('0x4b'),'channel':_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x4c')]})['catch'](function(_0x2d2510){if(_0x2d2510[_0x49c4('0x29')]===_0x49c4('0x4d')){setTimeout(function(){if(_0x84c621[_0x49c4('0x13')][_0x2aac35]){ut[_0x49c4('0x4e')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]],_0x49c4('0x4f'));if(_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x50')]===!![]){ut[_0x49c4('0x51')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]],'[clearZombieChannel]');ut[_0x49c4('0x52')](_0x49c4('0x53')+_0x2aac35,_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]);}ut[_0x49c4('0x52')](_0x49c4('0x54')+_0x2aac35,_0x84c621['actions'][_0x2aac35]['queue']);delete _0x84c621[_0x49c4('0x13')][_0x2aac35];}},0x2328);}});}});};Preview[_0x49c4('0x31')][_0x49c4('0x37')]=function(){var _0x117151=this;loggerAction['info'](_0x49c4('0x55'),_[_0x49c4('0x56')](this[_0x49c4('0x13')]));for(var _0x444270 in this[_0x49c4('0x13')]){if(_0x117151[_0x49c4('0x13')][_0x49c4('0x38')](_0x444270)){_0x117151[_0x49c4('0x57')](_0x444270);}}};Preview[_0x49c4('0x31')]['recallMe']=function(_0x2ad771){var _0x4d27d0=this;rpcDb[_0x49c4('0x58')](_0x2ad771['id'],ut[_0x49c4('0x59')](this[_0x49c4('0x14')]))[_0x49c4('0x5a')](function(_0x2d93d8){if(!_['isNil'](_0x2d93d8)){for(var _0x592e8e=0x0;_0x592e8e<_0x2d93d8[_0x49c4('0x5b')];_0x592e8e+=0x1){if(ut[_0x49c4('0x5c')](_0x2d93d8[_0x592e8e][_0x49c4('0x5d')])<_0x2ad771[_0x49c4('0x5e')]*0x3c){if(_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]&&!_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]['voicePause']){_0x4d27d0[_0x49c4('0x60')](_0x2d93d8[_0x592e8e]['id'])['then'](ut[_0x49c4('0x61')](_0x49c4('0x62')))[_0x49c4('0x63')](ut[_0x49c4('0x61')](_0x49c4('0x62')));}else{rpcDb[_0x49c4('0x64')](_0x2d93d8[_0x592e8e]['id']);}}else{var _0x2c6be1=new Action(_0x2d93d8[_0x592e8e],_0x2ad771);_0x2c6be1['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x2ad771['outboundReCallsDay']+=0x1;ut[_0x49c4('0x67')](_0x2c6be1,0x17,_0x49c4('0x68'));if(_0x2ad771[_0x49c4('0x69')]){rpcDb[_0x49c4('0x6a')](ut['createBody'](_0x2d93d8[_0x592e8e]));rpcDb['createCustomerHistory'](_0x2c6be1,_0x49c4('0x6b'));}else{ut['logCustomer'](_0x2c6be1,0x16,_0x49c4('0x6c'));rpcDb[_0x49c4('0x6d')](_0x2c6be1,_0x49c4('0x6e'));rpcDb[_0x49c4('0x6f')](_0x2c6be1,_0x49c4('0x6e'));}}}}})[_0x49c4('0x63')](ut[_0x49c4('0x61')]('[getContactRecallMe]'));};Preview[_0x49c4('0x31')][_0x49c4('0x3a')]=function(_0x3936d3){_0x3936d3[_0x49c4('0x27')]=!![];if(ut[_0x49c4('0x70')](_0x3936d3[_0x49c4('0x71')])){_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x72')];}else if(!ut[_0x49c4('0x73')](_0x3936d3['dialActive'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];}else if(!this['isTrunkReachable'](_0x3936d3['Trunk'])){if(!this[_0x49c4('0x74')](_0x3936d3['TrunkBackup'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x75')];}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x76')];}}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')]['ACTIVE'];}};Preview[_0x49c4('0x31')][_0x49c4('0x77')]=function(_0x207572,_0x208208,_0x73840f){var _0xa431d=this;var _0x5d24f3=this['actions'][_0x208208];var _0x1ef0c1=this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]];var _0xf7a10f;var _0x23288e=![];var _0x6b2592=0x2;var _0xc2033f=0x3;if(_0x1ef0c1){switch(_0x73840f){case'1':_0x1ef0c1['outboundNoSuchCallsDay']+=0x1;_0x5d24f3[_0x49c4('0x78')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut['totalGlobal'](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x0,'NoSuchNumber');ami[_0x49c4('0x23')](_0x49c4('0x7a'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x7c')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x7d'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'0',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x483770){_0x23288e=_0x483770[_0x49c4('0x7f')]==0x1;_0x6b2592=_0x1ef0c1[_0x49c4('0x80')];_0xc2033f=_0x1ef0c1['callAdditionalPhoneAfterMin'];if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5d24f3['countnosuchnumberretry']>=_0x1ef0c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0x84'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0x78'),_0x1ef0c1['dialNoSuchNumberRetryFrequency']),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}delete this['actions'][_0x207572[_0x49c4('0x88')]];}else{_0x5d24f3[_0x49c4('0x78')]++;logger[_0x49c4('0x24')](_0x49c4('0x89'),_0x5d24f3['countnosuchnumberretry']);logger[_0x49c4('0x24')]('id',_0x5d24f3[_0x49c4('0x8a')]);_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnosuchnumberretry':_0x5d24f3['countnosuchnumberretry']}})[_0x49c4('0x5a')](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'ANSWER':var _0x5d6de0=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x5d24f3[_0x49c4('0x8c')]=_0x5d6de0;_0x5d24f3[_0x49c4('0x8d')]=_0x5d6de0;_0x5d24f3['dialAnswer']=!![];_0x1ef0c1['pTalking']+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x8e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);ami[_0x49c4('0x23')]('custom:agentconnect',ut[_0x49c4('0x7b')](_0x5d24f3,'connect',this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));if(_0x1ef0c1[_0x49c4('0x92')]){ami[_0x49c4('0x23')](_0x49c4('0x93'),ut[_0x49c4('0x94')](_0x5d24f3));}break;case'16':ami[_0x49c4('0x23')](_0x49c4('0x95'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96'),this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96')));_0x1ef0c1[_0x49c4('0x97')]+=0x1;_0x1ef0c1[_0x49c4('0x98')]+=0x1;_0x1ef0c1[_0x49c4('0x99')]+=0x1;ut[_0x49c4('0x51')](_0x1ef0c1,'[16]');_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x4,'Answer');rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x9a'));rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5d24f3);_0x1ef0c1['sumDuration']+=_0x5d24f3['talktime'];_0x1ef0c1[_0x49c4('0x9c')]+=_0x5d24f3[_0x49c4('0x9d')];logger[_0x49c4('0x24')](_0x49c4('0x9e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);delete this['actions'][_0x207572[_0x49c4('0x88')]];break;case _0x49c4('0x9f'):_0x1ef0c1[_0x49c4('0xa0')]+=0x1;_0x5d24f3['countbusyretry']+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x5,_0x49c4('0xa1'));_0x6b2592=_0x1ef0c1[_0x49c4('0xa2')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xa4'),ut['buildObj'](_0x5d24f3,_0x49c4('0xa5')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xa6'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'5',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x4a204d){_0x23288e=_0x4a204d['additional']==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xa8'));}else{if(_0x5d24f3[_0x49c4('0xa9')]>=_0x1ef0c1[_0x49c4('0xaa')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xa6'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xa9'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xa9')]++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countbusyretry':_0x5d24f3['countbusyretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case _0x49c4('0xad'):_0x1ef0c1['outboundNoAnswerCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xae')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x3,_0x49c4('0xaf'));_0x6b2592=_0x1ef0c1['dialNoAnswerRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];var _0x2329b6=ut['buildNoAnswerEventPayload'](_0x5d24f3,_0x1ef0c1);ami[_0x49c4('0x23')](_0x49c4('0xb0'),_0x2329b6);rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb1'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'3',_0x1ef0c1)['then'](function(_0x37fef1){_0x23288e=_0x37fef1[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d24f3[_0x49c4('0xae')]>=_0x1ef0c1['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xae'),_0x1ef0c1[_0x49c4('0xb2')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3['idContact'],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CONGESTION':_0x1ef0c1['outboundCongestionCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xb3')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut['logCustomer'](_0x5d24f3,0x8,_0x49c4('0xb4'));_0x6b2592=_0x1ef0c1[_0x49c4('0xb5')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xb6'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xb7')));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb8'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'8',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x16864c){_0x23288e=_0x16864c[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb['createCustomerFinal'](_0xf7a10f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d24f3[_0x49c4('0xb3')]>=_0x1ef0c1[_0x49c4('0xb9')]){rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xb8'));}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xb3'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countcongestionretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countcongestionretry':_0x5d24f3[_0x49c4('0xb3')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CANCEL':_0x1ef0c1[_0x49c4('0xba')]+=0x1;_0x5d24f3[_0x49c4('0xbb')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x14,_0x49c4('0xbc'));_0x6b2592=_0x1ef0c1['dialAgentRejectRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xbd'),ut[_0x49c4('0x7b')](_0x5d24f3,'agentreject'));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xbe'));_0xa431d['verifyAdditionalPhones'](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x532ba5){_0x23288e=_0x532ba5[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xf7a10f,_0x49c4('0xbf'));}else{if(_0x5d24f3[_0x49c4('0xbb')]>=_0x1ef0c1[_0x49c4('0xc0')]){rpcDb['createCustomerFinal'](_0x5d24f3,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,'countagentrejectretry',_0x1ef0c1[_0x49c4('0xc1')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'ABANDONED':_0x1ef0c1[_0x49c4('0xc2')]+=0x1;_0x5d24f3[_0x49c4('0xc3')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xb,_0x49c4('0xc4'));rpcDb[_0x49c4('0x6d')](_0x5d24f3,'[callProgressDetectingCustomer][logAbandoned]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'11',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x85418e){_0x23288e=_0x85418e[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xc5'));}else{if(_0x5d24f3[_0x49c4('0xc6')]>=_0x1ef0c1[_0x49c4('0xc7')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xc5'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xc3'),_0x1ef0c1[_0x49c4('0xc8')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3['activeContact']);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'18':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0xca')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x12,_0x207572['cause-txt']||_0x207572['dialstatus']);ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcd'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x2b6e61){_0x23288e=_0x2b6e61[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0x12,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcd'));}else{rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xcd'));}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3['countnoanswerretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;case'19':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x13,_0x207572[_0x49c4('0xce')]||_0x207572['dialstatus']);ami['emit']('custom:amd',ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcf'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)['then'](function(_0x3ea304){_0x23288e=_0x3ea304[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcf'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xcf'));}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;default:if(_0x5d24f3[_0x49c4('0x50')]){ut['decrementTalkink'](_0x1ef0c1,'[default]');ut[_0x49c4('0x52')](_0x49c4('0xd0')+_0x1ef0c1['name'],_0x207572);}_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xc,_0x207572[_0x49c4('0xce')]||_0x207572[_0x49c4('0xd1')]);_0x6b2592=_0x1ef0c1[_0x49c4('0xc1')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];rpcDb['createCustomerHistory'](_0x5d24f3,'[callProgressDetectingCustomer][logUnknown]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x42f2db){_0x23288e=_0x42f2db['additional']==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xd2'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xd2'));}delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0x88')]];}else{_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});}});}if(!(_0x5d24f3[_0x49c4('0x50')]&&_0x73840f==='16')){ut[_0x49c4('0x4e')](_0x1ef0c1,_0x49c4('0xd3'));logger['info'](_0x49c4('0xd4'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],'originated:\x20',_0x1ef0c1['originated']);}if(_0x73840f!==_0x49c4('0xd5')){delete this['actions'][_0x207572[_0x49c4('0x88')]];delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0xd6')]];}_0x1ef0c1[_0x49c4('0xd7')]=!![];}};Preview[_0x49c4('0x31')][_0x49c4('0xd8')]=function(_0x3238e7,_0xe9e187,_0x31ba95){if(_[_0x49c4('0xd9')](_0xe9e187)&&_0x49c4('0xda')!==typeof _0xe9e187){return;}if(_[_0x49c4('0xd9')](_0x31ba95)&&'object'!==typeof _0x31ba95){return;}switch(_0x31ba95[_0x49c4('0xdb')]){case'0':ut[_0x49c4('0xdc')](_0x3238e7,0x0,_0x49c4('0xdd'));rpcDb['createAgentHistory'](_0x3238e7,_0x49c4('0xde'));break;case'3':ut['logAgent'](_0x3238e7,0x3,_0x49c4('0xaf'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe0'));break;case'5':ut[_0x49c4('0xdc')](_0x3238e7,0x5,'Busy');rpcDb[_0x49c4('0xdf')](_0x3238e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3238e7,0x8,_0x49c4('0xb4'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));break;case'22':ut['logAgent'](_0x3238e7,0x16,'AnswerAGI');rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe2'));break;default:ut[_0x49c4('0xdc')](_0x3238e7,0xc,_0x31ba95[_0x49c4('0xdb')]);rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));}ut[_0x49c4('0x4e')](_0xe9e187,_0x49c4('0xe3'));logger[_0x49c4('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x3238e7[_0x49c4('0x8f')],_0x49c4('0x90'),_0xe9e187['name'],'originated:\x20',_0xe9e187[_0x49c4('0xe4')]);delete this['actions'][_0x3238e7[_0x49c4('0x8f')]];};Preview['prototype'][_0x49c4('0x7e')]=function(_0x4b83a6,_0x30781e,_0x1fb51e){return cmHopperAdditionalPhone[_0x49c4('0x7e')](_0x4b83a6,_0x30781e,_0x1fb51e)[_0x49c4('0x63')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x49c4('0x31')][_0x49c4('0xac')]=function(_0x3ce256,_0x5737b4,_0x367d3d){return cmHopperAdditionalPhone[_0x49c4('0xac')](_0x3ce256,_0x5737b4,_0x367d3d)['catch'](logger['info'](_0x49c4('0xe5')));};Preview[_0x49c4('0x31')][_0x49c4('0x8b')]=function(_0x49dc8a){return Promise[_0x49c4('0xe6')]()[_0x49c4('0x5a')](cmHopperAdditionalPhone[_0x49c4('0x8b')](_0x49dc8a))[_0x49c4('0x63')](logger['info'](_0x49c4('0xe7')));};Preview['prototype']['checkInBlack']=function(_0xf5f718,_0x171530,_0x12fda9,_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new Promise(function(_0x947dd8,_0xa6f48){if(_[_0x49c4('0xe8')](_0x171530)||_['isNil'](_0x171530[_0x49c4('0xe9')])||_['isNil'](_0x171530['phone'])||_[_0x49c4('0xe8')](_0x171530[_0x49c4('0x48')])){_0xa6f48(ut[_0x49c4('0x29')]('Contact\x20is\x20undefined',_0x24ff20,_0x5adb90));return;}var _0x336853=uuid['v4']();var _0x4a874a=_0x32b6e4[_0x49c4('0x10')][_0x171530[_0x49c4('0x3f')][_0x49c4('0x91')]];var _0x3738d7=_0x12fda9?_0x32b6e4[_0x49c4('0x14')][_0x12fda9]['id']:undefined;_0x32b6e4[_0x49c4('0x13')][_0x336853]=new Action(_0x171530,_0x4a874a,_0x336853,_0x12fda9,_0x3738d7);var _0x2b31ac=_0x32b6e4['actions'][_0x336853];_0x2b31ac[_0x49c4('0x86')]=_0x24ff20;_0x2b31ac[_0x49c4('0x87')]=_0x5adb90;_0x2b31ac[_0x49c4('0xea')]=_0x12fda9;if(_[_0x49c4('0xeb')](_0xf5f718)){_0x32b6e4['execCall'](_0x2b31ac,_0x4a874a,_0x171530,_0x12fda9)['then'](function(_0x4c15ff){logger[_0x49c4('0x24')](_0x49c4('0xec'),_0x49c4('0xed')+_0x2b31ac[_0x49c4('0x40')]+_0x49c4('0xee')+_0x2b31ac[_0x49c4('0x8a')],JSON[_0x49c4('0x42')](_0x4c15ff));ami['emit'](_0x49c4('0xef'),ut[_0x49c4('0x7b')](_0x2b31ac,'called',_0x32b6e4['campaignsPreview'][_0x2b31ac['queue']]));_0x947dd8(ut[_0x49c4('0x29')](_0x49c4('0xf0')));})[_0x49c4('0x63')](function(_0x3d0013){ut[_0x49c4('0x2c')](_0x49c4('0xf1'),_0x3d0013);_0xa6f48(ut[_0x49c4('0x29')]('Call\x20failed',_0x24ff20,_0x5adb90));});}else{_0x4a874a[_0x49c4('0xf2')]+=0x1;ut[_0x49c4('0xf3')](_0x2b31ac);rpcDb[_0x49c4('0xf4')](_0x2b31ac,_0x49c4('0xf5'));delete _0x32b6e4['actions'][_0x336853];_0xa6f48(ut[_0x49c4('0x29')](_0x49c4('0xf6'),_0x24ff20,_0x5adb90));}});};Preview[_0x49c4('0x31')][_0x49c4('0x74')]=function(_0x12d707){return!_['isNil'](_0x12d707)&&!_[_0x49c4('0xe8')](_0x12d707['name'])&&!_['isNil'](_0x12d707[_0x49c4('0xf7')])&&_0x12d707[_0x49c4('0xf7')]&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util[_0x49c4('0x65')]('SIP/%s',_0x12d707[_0x49c4('0x91')])])&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])]['status'])&&(this[_0x49c4('0x12')][util[_0x49c4('0x65')](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xf9')||this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xfa'));};Preview[_0x49c4('0x31')]['run']=function(_0x34ce60,_0x39dc83){return this[_0x49c4('0xfb')](_0x34ce60,_0x39dc83)[_0x49c4('0x5a')](function(_0xa2c8cf){return _['pick'](_0xa2c8cf,[_0x49c4('0x29')]);})[_0x49c4('0x63')](function(_0x789121){if(_0x789121[_0x49c4('0xfc')]){rpcDb[_0x49c4('0xfd')](_0x34ce60);}if(_0x789121[_0x49c4('0xf7')]){rpcDb[_0x49c4('0x64')](_0x34ce60);}throw _[_0x49c4('0x45')](_0x789121,[_0x49c4('0x29')]);});};Preview[_0x49c4('0x31')]['execRun']=function(_0x2d3211,_0x1b6966){var _0x2c4d2a=this;var _0x1745f8,_0xe22808;return rpcDb['getContactPreview'](_0x2d3211)['then'](function(_0x13aab1){if(!_[_0x49c4('0xe8')](_0x13aab1[0x0])){_0xe22808=_0x13aab1[0x0][_0x49c4('0xfe')]?![]:!![];_0x1745f8=_0x13aab1[0x0][_0x49c4('0xfe')]?!![]:![];_0x1745f8=_0x1b6966?!![]:_0x1745f8;}var _0xd87f7e=_0x2c4d2a[_0x49c4('0xff')](_0x13aab1);if(_0xd87f7e['isValid']){rpcDb[_0x49c4('0x100')](_[_0x49c4('0x45')](_0x13aab1[0x0],['VoiceQueueId',_0x49c4('0x101')]))['then'](function(_0x30d99a){_0x2c4d2a[_0x49c4('0x102')](_0x30d99a,_0x13aab1[0x0],_0x1b6966,_0xe22808,_0x1745f8)[_0x49c4('0x5a')](function(_0x5db4a1){return _0x5db4a1;})[_0x49c4('0x63')](function(_0x4f431e){throw _0x4f431e;});})[_0x49c4('0x63')](function(_0x5025ee){ut['logger'](_0x49c4('0x103'),_0x5025ee);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),_0xe22808,_0x1745f8);});}else{throw ut[_0x49c4('0x29')](_0xd87f7e[_0x49c4('0x29')],_0xe22808,_0x1745f8);}})[_0x49c4('0x63')](function(_0x5a06d7){ut['logger'](_0x49c4('0x105'),_0x5a06d7);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),![],!![]);});};Preview[_0x49c4('0x31')][_0x49c4('0xff')]=function(_0x3d2dd0){if(_[_0x49c4('0xe8')](_0x3d2dd0)||_['isEmpty'](_0x3d2dd0)||!_['isNil'](_0x3d2dd0[0x0]['Agent'])&&_['isNil'](_0x3d2dd0[0x0][_0x49c4('0x5f')]['name'])){ut[_0x49c4('0x2c')](_0x49c4('0x106'),_0x3d2dd0);return{'isValid':![],'message':_0x49c4('0x107')};}var _0x53dd04=this['campaignsPreview'][_0x3d2dd0[0x0][_0x49c4('0x3f')][_0x49c4('0x91')]];_0x53dd04['message']=utils[_0x49c4('0x2a')][_0x49c4('0x76')];if(_[_0x49c4('0xe8')](_0x53dd04)){ut[_0x49c4('0x2c')](_0x49c4('0x108'),_0x53dd04);return{'isValid':![],'message':_0x49c4('0x109')};}if(!this['isTrunkReachable'](_0x53dd04[_0x49c4('0x10a')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10c'));if(!this[_0x49c4('0x74')](_0x53dd04[_0x49c4('0x10d')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x49c4('0x73')](_0x53dd04[_0x49c4('0x39')])){ut[_0x49c4('0x2c')](_0x49c4('0x10f'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110')};}return{'isValid':!![],'message':_0x49c4('0x111')};};Preview[_0x49c4('0x31')][_0x49c4('0x112')]=function(_0x3a8fe1,_0x29c6fc,_0x1642fd,_0x4806ac){var _0xc641bc=this;return new Promise(function(_0xcec186,_0x1c8258){var _0x471e28=_0x3a8fe1[_0x49c4('0x8f')];var _0x5a471d=_0xc641bc['isTrunkReachable'](_0x29c6fc[_0x49c4('0x10a')])?util[_0x49c4('0x65')]('SIP/%s/%s%s',_0x29c6fc['Trunk'][_0x49c4('0x91')],_['isNil'](_0x29c6fc[_0x49c4('0x113')])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc[_0x49c4('0x115')]>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd[_0x49c4('0x101')]):util['format'](_0x49c4('0x117'),_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x91')]:_0x29c6fc['TrunkBackup'][_0x49c4('0x91')],_[_0x49c4('0xe8')](_0x29c6fc['dialPrefix'])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc['dialCutDigit']>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd['phone']);var _0x1ee36e=_0xc641bc[_0x49c4('0x74')](_0x29c6fc[_0x49c4('0x10a')])?ut[_0x49c4('0x118')](_0x29c6fc['Trunk'][_0x49c4('0x119')],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc['dialOriginateCallerIdNumber']):ut[_0x49c4('0x118')](_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x119')]:_0x29c6fc[_0x49c4('0x10d')]['callerid'],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc[_0x49c4('0x11c')]);if(_0x1ee36e){_0x3a8fe1[_0x49c4('0x11d')]=ut[_0x49c4('0x11e')](_0x1ee36e);_0x3a8fe1[_0x49c4('0x11f')]=ut[_0x49c4('0x120')](_0x1ee36e);}var _0x37dbbf=ut[_0x49c4('0x121')](_0x29c6fc,_0x1642fd,_0x5a471d,_0x1ee36e,_0x471e28,_0x3a8fe1);_[_0x49c4('0x122')](_0x3a8fe1,ut['toLowerVariables'](_0x37dbbf));_0x3a8fe1[_0x49c4('0x123')]=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c6fc[_0x49c4('0x124')]=_0x37dbbf;var _0x5adc01=ut[_0x49c4('0x125')](_0x3a8fe1,_0x29c6fc,_0x37dbbf,_0x3a8fe1[_0x49c4('0x87')],_0x4806ac);return ami['Action'](_0x5adc01)[_0x49c4('0x5a')](function(_0x245fae){_0x29c6fc[_0x49c4('0xe4')]+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x126'),_0x471e28,'\x20Queue',_0x29c6fc[_0x49c4('0x91')],'originated:\x20',_0x29c6fc[_0x49c4('0xe4')]);_0xcec186(_0x245fae);})[_0x49c4('0x63')](function(_0x294b2c){ut['logAgent'](_0x3a8fe1,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xdf')](_0x3a8fe1,_0x49c4('0x128'));_0x1c8258(_0x294b2c);});});};Preview['prototype']['syncNewExten']=function(_0x256d6b){if(this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]]){this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]][_0x49c4('0x4c')]=_0x256d6b['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x2eae62){var _0x417cef=this;var _0x153450=this[_0x49c4('0x13')][_0x2eae62['actionid']];if(_0x153450){if(_0x153450[_0x49c4('0xea')]&&this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]){ut[_0x49c4('0x129')](_0x153450,this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]][_0x49c4('0x91')],this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]['id']);}var _0x39e6f5=_[_0x49c4('0x12a')](_0x153450);_0x39e6f5['responsetime']=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3308c4=_0x417cef[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]];if(ut[_0x49c4('0x12b')](_0x2eae62['response'])){if(_0x153450[_0x49c4('0x86')]){rpcDb['unlockContact'](_0x153450['idContact']);}if(_0x153450['activeContact']){rpcDb[_0x49c4('0x64')](_0x153450[_0x49c4('0x8a')]);}ami[_0x49c4('0x23')]('custom:agentringnoanswer',ut[_0x49c4('0x7b')](_0x153450,'rejected',this[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]]));this[_0x49c4('0xd8')](_0x39e6f5,_0x3308c4,_0x2eae62);}else{_0x153450['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));ut[_0x49c4('0xdc')](_0x39e6f5,0x4,_0x49c4('0x12c'));rpcDb[_0x49c4('0xdf')](_0x39e6f5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49c4('0x31')][_0x49c4('0x1a')]=function(_0x15e35f){var _0x6b1554=this['actions'][_0x15e35f['linkedid']];var _0x238884;if(_0x6b1554){_0x238884=this[_0x49c4('0x10')][_0x6b1554['queue']];logger[_0x49c4('0x24')](_0x49c4('0x12d'),_0x15e35f[_0x49c4('0x88')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);}if(this['actions'][_0x15e35f['linkedid']]&&_0x15e35f[_0x49c4('0x88')]!==_0x15e35f[_0x49c4('0x8f')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]]['dialAnswer']){this[_0x49c4('0x77')](_0x15e35f,_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')]);}else if(this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]][_0x49c4('0x50')]){logger['info']('[syncHangup][talking][cause]',_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884[_0x49c4('0x91')],_0x49c4('0x43'),_0x238884['pTalking']);this['callProgressDetectingCustomer'](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}}else if(_0x6b1554&&_[_0x49c4('0xe8')](_0x6b1554[_0x49c4('0x12f')])&&_0x238884['dialQueueProject']&&_0x15e35f[_0x49c4('0x88')]===_0x15e35f[_0x49c4('0x8f')]&&_[_0x49c4('0xe8')](_0x15e35f['reason'])&&_0x15e35f[_0x49c4('0x12e')]==='16'&&_0x15e35f[_0x49c4('0x130')]==='6'&&_[_0x49c4('0xd9')](_0x6b1554['transfer'])){if(_0x6b1554[_0x49c4('0x86')]){rpcDb[_0x49c4('0xfd')](_0x6b1554['idContact']);}if(_0x6b1554[_0x49c4('0x87')]){rpcDb[_0x49c4('0x64')](_0x6b1554['idContact']);}_0x15e35f[_0x49c4('0xdb')]='22';this[_0x49c4('0xd8')](_0x6b1554,_0x238884,_0x15e35f);}else if(_0x6b1554&&_0x6b1554[_0x49c4('0x131')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][transfer]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884['pTalking']);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}else if(this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][cause]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],'\x20Queue',_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')]);}}};Preview['prototype'][_0x49c4('0x1d')]=function(_0x40afb8){if(this[_0x49c4('0x13')][_0x40afb8[_0x49c4('0xd6')]]&&_0x40afb8[_0x49c4('0xd6')]!==_0x40afb8['destuniqueid']){this[_0x49c4('0x77')](_0x40afb8,_0x40afb8[_0x49c4('0xd6')],_0x40afb8[_0x49c4('0xd1')]);}};Preview[_0x49c4('0x31')][_0x49c4('0x1b')]=function(_0x39abbf){if(this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]&&_0x39abbf['linkedid']!==_0x39abbf[_0x49c4('0x8f')]&&!this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]['dialAnswer']){if(_0x39abbf['cause']==='1'){this[_0x49c4('0x77')](_0x39abbf,_0x39abbf['linkedid'],_0x39abbf[_0x49c4('0x12e')]);}}};Preview[_0x49c4('0x31')][_0x49c4('0x132')]=function(_0x3f0e74,_0x55f423,_0x3ce0f9){if(this[_0x49c4('0x13')][_0x3f0e74]){if(_[_0x49c4('0xe8')](this[_0x49c4('0x13')][_0x3f0e74]['variables'])){this[_0x49c4('0x13')][_0x3f0e74][_0x49c4('0x124')]={};}this['actions'][_0x3f0e74][_0x49c4('0x124')][_0x55f423]=_0x3ce0f9;}};Preview[_0x49c4('0x31')][_0x49c4('0x133')]=function(_0x72eab6){try{if(!_[_0x49c4('0xe8')](_0x72eab6)){if(ut[_0x49c4('0x134')](_[_0x49c4('0x135')](_0x72eab6[_0x49c4('0x136')])[0x0])){this['addVariable'](_0x72eab6['uniqueid'],_['keys'](_0x72eab6[_0x49c4('0x136')])[0x0],_0x72eab6[_0x49c4('0x137')]);}}}catch(_0x418ead){logger[_0x49c4('0x138')](_0x49c4('0x139'),util['inspect'](_0x418ead,{'showHidden':![],'depth':null}));}};Preview[_0x49c4('0x31')][_0x49c4('0x20')]=function(_0x9786bf){if(_0x9786bf){if(this[_0x49c4('0x13')][_0x9786bf['transfertargetlinkedid']]){this['actions'][_0x9786bf[_0x49c4('0x13a')]][_0x49c4('0x131')]=!![];}}};Preview[_0x49c4('0x31')][_0x49c4('0x13b')]=function(_0x281151){if(_0x281151){if(this[_0x49c4('0x13')][_0x281151['transfererlinkedid']]){this['actions'][_0x281151[_0x49c4('0x13c')]][_0x49c4('0x131')]=!![];}}};module[_0x49c4('0x13d')]=Preview; \ No newline at end of file +var _0x9c44=['Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','starttime','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','Answer','[syncHangup][talking]','cause','statedesc','channelstate','transfer','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','available','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','sequence','[clearZombieChannels][talking]','Queue','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','catch','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','totalGlobal','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','name','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','originated','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','isNil','Contact','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]'];(function(_0x4d331a,_0x14c56f){var _0x5d0a34=function(_0xc68432){while(--_0xc68432){_0x4d331a['push'](_0x4d331a['shift']());}};_0x5d0a34(++_0x14c56f);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x49c4('0x0'));var moment=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));var logger=require(_0x49c4('0x4'))(_0x49c4('0x5'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x49c4('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49c4('0x7'));var Action=require(_0x49c4('0x8'));var ut=require(_0x49c4('0x9'));var utils=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitVoiceQueueChannelRemove(_0x46e475){logger[_0x49c4('0x24')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x46e475));emit(util['format'](_0x49c4('0x25'),_0x46e475['name']),'voice_queue_channel:remove',_0x46e475);io[_0x49c4('0x23')](_0x49c4('0x26'),_0x46e475);}function notSendMessagesQueue(_0x26c640){if(_0x26c640[_0x49c4('0x27')]){if(_0x26c640['originated']===0x0&&_0x26c640['pTalking']===0x0){_0x26c640[_0x49c4('0x27')]=![];_0x26c640[_0x49c4('0x28')]=0x0;_0x26c640['paused']=0x0;_0x26c640[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];ut[_0x49c4('0x2c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x26c640['name']+_0x49c4('0x2d'));}else{_0x26c640['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2e')];ut[_0x49c4('0x2c')](_0x49c4('0x2f'),_0x26c640['name']+_0x49c4('0x30'));}}}Preview[_0x49c4('0x31')][_0x49c4('0x22')]=function(){var _0x4f28a2=this;setInterval(function(){_0x4f28a2[_0x49c4('0x32')]();},0x7cf);};Preview[_0x49c4('0x31')][_0x49c4('0x32')]=function(){var _0x427b26=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x46f7ea in _0x427b26){if(_0x427b26['hasOwnProperty'](_0x46f7ea)&&(_0x427b26[_0x46f7ea]['dialMethod']==='preview'||_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x34'))&&_0x427b26[_0x46f7ea][_0x49c4('0x35')]===_0x49c4('0x36')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x37')]();}}if(_0x427b26[_0x49c4('0x38')](_0x46f7ea)&&_0x427b26[_0x46f7ea][_0x49c4('0x33')]===_0x49c4('0x5')&&_0x427b26[_0x46f7ea]['type']==='outbound'){if(_0x427b26[_0x46f7ea][_0x49c4('0x39')]){this[_0x49c4('0x3a')](_0x427b26[_0x46f7ea]);if(_0x427b26[_0x46f7ea][_0x49c4('0x3b')])this[_0x49c4('0x3c')](_0x427b26[_0x46f7ea]);}else{notSendMessagesQueue(_0x427b26[_0x46f7ea]);}}}};Preview[_0x49c4('0x31')]['clearZombieChannel']=function(_0x2aac35){var _0x84c621=this;this[_0x49c4('0x3d')]['enqueue'](function(){if(!_['isNil'](_0x84c621[_0x49c4('0x13')][_0x2aac35])){loggerAction[_0x49c4('0x24')](_0x49c4('0x3e'),_0x2aac35,_0x49c4('0x3f'),_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')],_0x49c4('0x41'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]]['originated']),_0x49c4('0x43'),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35]['queue']][_0x49c4('0x44')]),JSON[_0x49c4('0x42')](_0x84c621[_0x49c4('0x13')][_0x2aac35]['dialAnswer']),JSON[_0x49c4('0x42')](_[_0x49c4('0x45')](_0x84c621[_0x49c4('0x13')][_0x2aac35],[_0x49c4('0x46'),_0x49c4('0x47'),_0x49c4('0x48'),_0x49c4('0x49')])));return ami[_0x49c4('0x4a')]({'action':_0x49c4('0x4b'),'channel':_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x4c')]})['catch'](function(_0x2d2510){if(_0x2d2510[_0x49c4('0x29')]===_0x49c4('0x4d')){setTimeout(function(){if(_0x84c621[_0x49c4('0x13')][_0x2aac35]){ut[_0x49c4('0x4e')](_0x84c621[_0x49c4('0x10')][_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]],_0x49c4('0x4f'));if(_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x50')]===!![]){ut[_0x49c4('0x51')](_0x84c621[_0x49c4('0x10')][_0x84c621['actions'][_0x2aac35][_0x49c4('0x40')]],'[clearZombieChannel]');ut[_0x49c4('0x52')](_0x49c4('0x53')+_0x2aac35,_0x84c621[_0x49c4('0x13')][_0x2aac35][_0x49c4('0x40')]);}ut[_0x49c4('0x52')](_0x49c4('0x54')+_0x2aac35,_0x84c621['actions'][_0x2aac35]['queue']);delete _0x84c621[_0x49c4('0x13')][_0x2aac35];}},0x2328);}});}});};Preview[_0x49c4('0x31')][_0x49c4('0x37')]=function(){var _0x117151=this;loggerAction['info'](_0x49c4('0x55'),_[_0x49c4('0x56')](this[_0x49c4('0x13')]));for(var _0x444270 in this[_0x49c4('0x13')]){if(_0x117151[_0x49c4('0x13')][_0x49c4('0x38')](_0x444270)){_0x117151[_0x49c4('0x57')](_0x444270);}}};Preview[_0x49c4('0x31')]['recallMe']=function(_0x2ad771){var _0x4d27d0=this;rpcDb[_0x49c4('0x58')](_0x2ad771['id'],ut[_0x49c4('0x59')](this[_0x49c4('0x14')]))[_0x49c4('0x5a')](function(_0x2d93d8){if(!_['isNil'](_0x2d93d8)){for(var _0x592e8e=0x0;_0x592e8e<_0x2d93d8[_0x49c4('0x5b')];_0x592e8e+=0x1){if(ut[_0x49c4('0x5c')](_0x2d93d8[_0x592e8e][_0x49c4('0x5d')])<_0x2ad771[_0x49c4('0x5e')]*0x3c){if(_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]&&!_0x2d93d8[_0x592e8e][_0x49c4('0x5f')]['voicePause']){_0x4d27d0[_0x49c4('0x60')](_0x2d93d8[_0x592e8e]['id'])['then'](ut[_0x49c4('0x61')](_0x49c4('0x62')))[_0x49c4('0x63')](ut[_0x49c4('0x61')](_0x49c4('0x62')));}else{rpcDb[_0x49c4('0x64')](_0x2d93d8[_0x592e8e]['id']);}}else{var _0x2c6be1=new Action(_0x2d93d8[_0x592e8e],_0x2ad771);_0x2c6be1['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x2ad771['outboundReCallsDay']+=0x1;ut[_0x49c4('0x67')](_0x2c6be1,0x17,_0x49c4('0x68'));if(_0x2ad771[_0x49c4('0x69')]){rpcDb[_0x49c4('0x6a')](ut['createBody'](_0x2d93d8[_0x592e8e]));rpcDb['createCustomerHistory'](_0x2c6be1,_0x49c4('0x6b'));}else{ut['logCustomer'](_0x2c6be1,0x16,_0x49c4('0x6c'));rpcDb[_0x49c4('0x6d')](_0x2c6be1,_0x49c4('0x6e'));rpcDb[_0x49c4('0x6f')](_0x2c6be1,_0x49c4('0x6e'));}}}}})[_0x49c4('0x63')](ut[_0x49c4('0x61')]('[getContactRecallMe]'));};Preview[_0x49c4('0x31')][_0x49c4('0x3a')]=function(_0x3936d3){_0x3936d3[_0x49c4('0x27')]=!![];if(ut[_0x49c4('0x70')](_0x3936d3[_0x49c4('0x71')])){_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x72')];}else if(!ut[_0x49c4('0x73')](_0x3936d3['dialActive'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x2b')];}else if(!this['isTrunkReachable'](_0x3936d3['Trunk'])){if(!this[_0x49c4('0x74')](_0x3936d3['TrunkBackup'])){_0x3936d3['message']=utils[_0x49c4('0x2a')][_0x49c4('0x75')];}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')][_0x49c4('0x76')];}}else{_0x3936d3[_0x49c4('0x29')]=utils[_0x49c4('0x2a')]['ACTIVE'];}};Preview[_0x49c4('0x31')][_0x49c4('0x77')]=function(_0x207572,_0x208208,_0x73840f){var _0xa431d=this;var _0x5d24f3=this['actions'][_0x208208];var _0x1ef0c1=this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]];var _0xf7a10f;var _0x23288e=![];var _0x6b2592=0x2;var _0xc2033f=0x3;if(_0x1ef0c1){switch(_0x73840f){case'1':_0x1ef0c1['outboundNoSuchCallsDay']+=0x1;_0x5d24f3[_0x49c4('0x78')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut['totalGlobal'](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x0,'NoSuchNumber');ami[_0x49c4('0x23')](_0x49c4('0x7a'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x7c')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x7d'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'0',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x483770){_0x23288e=_0x483770[_0x49c4('0x7f')]==0x1;_0x6b2592=_0x1ef0c1[_0x49c4('0x80')];_0xc2033f=_0x1ef0c1['callAdditionalPhoneAfterMin'];if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5d24f3['countnosuchnumberretry']>=_0x1ef0c1['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0x84'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0x78'),_0x1ef0c1['dialNoSuchNumberRetryFrequency']),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}delete this['actions'][_0x207572[_0x49c4('0x88')]];}else{_0x5d24f3[_0x49c4('0x78')]++;logger[_0x49c4('0x24')](_0x49c4('0x89'),_0x5d24f3['countnosuchnumberretry']);logger[_0x49c4('0x24')]('id',_0x5d24f3[_0x49c4('0x8a')]);_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnosuchnumberretry':_0x5d24f3['countnosuchnumberretry']}})[_0x49c4('0x5a')](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'ANSWER':var _0x5d6de0=moment()[_0x49c4('0x65')](_0x49c4('0x66'));_0x5d24f3[_0x49c4('0x8c')]=_0x5d6de0;_0x5d24f3[_0x49c4('0x8d')]=_0x5d6de0;_0x5d24f3['dialAnswer']=!![];_0x1ef0c1['pTalking']+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x8e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);ami[_0x49c4('0x23')]('custom:agentconnect',ut[_0x49c4('0x7b')](_0x5d24f3,'connect',this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));if(_0x1ef0c1[_0x49c4('0x92')]){ami[_0x49c4('0x23')](_0x49c4('0x93'),ut[_0x49c4('0x94')](_0x5d24f3));}break;case'16':ami[_0x49c4('0x23')](_0x49c4('0x95'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96'),this[_0x49c4('0x10')][_0x5d24f3[_0x49c4('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0x96')));_0x1ef0c1[_0x49c4('0x97')]+=0x1;_0x1ef0c1[_0x49c4('0x98')]+=0x1;_0x1ef0c1[_0x49c4('0x99')]+=0x1;ut[_0x49c4('0x51')](_0x1ef0c1,'[16]');_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x4,'Answer');rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0x9a'));rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0x9b'));rpcDb['crateCustomerReportQueue'](_0x5d24f3);_0x1ef0c1['sumDuration']+=_0x5d24f3['talktime'];_0x1ef0c1[_0x49c4('0x9c')]+=_0x5d24f3[_0x49c4('0x9d')];logger[_0x49c4('0x24')](_0x49c4('0x9e'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],_0x49c4('0x43'),_0x1ef0c1[_0x49c4('0x44')]);delete this['actions'][_0x207572[_0x49c4('0x88')]];break;case _0x49c4('0x9f'):_0x1ef0c1[_0x49c4('0xa0')]+=0x1;_0x5d24f3['countbusyretry']+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x5,_0x49c4('0xa1'));_0x6b2592=_0x1ef0c1[_0x49c4('0xa2')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xa4'),ut['buildObj'](_0x5d24f3,_0x49c4('0xa5')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xa6'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'5',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x4a204d){_0x23288e=_0x4a204d['additional']==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xa8'));}else{if(_0x5d24f3[_0x49c4('0xa9')]>=_0x1ef0c1[_0x49c4('0xaa')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xa6'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xa9'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xa9')]++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countbusyretry':_0x5d24f3['countbusyretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case _0x49c4('0xad'):_0x1ef0c1['outboundNoAnswerCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xae')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x3,_0x49c4('0xaf'));_0x6b2592=_0x1ef0c1['dialNoAnswerRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];var _0x2329b6=ut['buildNoAnswerEventPayload'](_0x5d24f3,_0x1ef0c1);ami[_0x49c4('0x23')](_0x49c4('0xb0'),_0x2329b6);rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb1'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'3',_0x1ef0c1)['then'](function(_0x37fef1){_0x23288e=_0x37fef1[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5d24f3[_0x49c4('0xae')]>=_0x1ef0c1['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xae'),_0x1ef0c1[_0x49c4('0xb2')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3['idContact'],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CONGESTION':_0x1ef0c1['outboundCongestionCallsDay']+=0x1;_0x5d24f3[_0x49c4('0xb3')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut['logCustomer'](_0x5d24f3,0x8,_0x49c4('0xb4'));_0x6b2592=_0x1ef0c1[_0x49c4('0xb5')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xb6'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xb7')));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xb8'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'8',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x16864c){_0x23288e=_0x16864c[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb['createCustomerFinal'](_0xf7a10f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5d24f3[_0x49c4('0xb3')]>=_0x1ef0c1[_0x49c4('0xb9')]){rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xb8'));}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,_0x49c4('0xb3'),_0x1ef0c1[_0x49c4('0xa2')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3['countcongestionretry']++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countcongestionretry':_0x5d24f3[_0x49c4('0xb3')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'CANCEL':_0x1ef0c1[_0x49c4('0xba')]+=0x1;_0x5d24f3[_0x49c4('0xbb')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x14,_0x49c4('0xbc'));_0x6b2592=_0x1ef0c1['dialAgentRejectRetryFrequency'];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];ami[_0x49c4('0x23')](_0x49c4('0xbd'),ut[_0x49c4('0x7b')](_0x5d24f3,'agentreject'));rpcDb['createCustomerHistory'](_0x5d24f3,_0x49c4('0xbe'));_0xa431d['verifyAdditionalPhones'](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x532ba5){_0x23288e=_0x532ba5[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0xf7a10f,_0x49c4('0xbf'));}else{if(_0x5d24f3[_0x49c4('0xbb')]>=_0x1ef0c1[_0x49c4('0xc0')]){rpcDb['createCustomerFinal'](_0x5d24f3,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x49c4('0xab')](ut['scheduledAt'](_0x5d24f3,'countagentrejectretry',_0x1ef0c1[_0x49c4('0xc1')]),_0x5d24f3['unlockAgent'],_0x5d24f3[_0x49c4('0x87')]);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d['swapAdditionalPhones'](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});break;case'ABANDONED':_0x1ef0c1[_0x49c4('0xc2')]+=0x1;_0x5d24f3[_0x49c4('0xc3')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xb,_0x49c4('0xc4'));rpcDb[_0x49c4('0x6d')](_0x5d24f3,'[callProgressDetectingCustomer][logAbandoned]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'11',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x85418e){_0x23288e=_0x85418e[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,'Global');rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xc5'));}else{if(_0x5d24f3[_0x49c4('0xc6')]>=_0x1ef0c1[_0x49c4('0xc7')]){rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xc5'));}else{rpcDb[_0x49c4('0xab')](ut[_0x49c4('0x85')](_0x5d24f3,_0x49c4('0xc3'),_0x1ef0c1[_0x49c4('0xc8')]),_0x5d24f3[_0x49c4('0x86')],_0x5d24f3['activeContact']);}}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)['then'](function(){});});}});break;case'18':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0xca')]+=0x1;_0x5d24f3['countglobal']=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x12,_0x207572['cause-txt']||_0x207572['dialstatus']);ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcd'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x2b6e61){_0x23288e=_0x2b6e61[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1['dialGlobalMaxRetry']){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0x12,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcd'));}else{rpcDb['createCustomerFinal'](_0x5d24f3,_0x49c4('0xcd'));}}else{_0x5d24f3[_0x49c4('0xae')]++;_0xa431d['incrementPreviewCounters']({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3['countnoanswerretry']}})[_0x49c4('0x5a')](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;case'19':_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0x13,_0x207572[_0x49c4('0xce')]||_0x207572['dialstatus']);ami['emit']('custom:amd',ut[_0x49c4('0x7b')](_0x5d24f3,_0x49c4('0xcc')));rpcDb[_0x49c4('0x6d')](_0x5d24f3,_0x49c4('0xcf'));_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'18',_0x1ef0c1)['then'](function(_0x3ea304){_0x23288e=_0x3ea304[_0x49c4('0x7f')]==0x1;if(!_0x23288e){if(ut[_0x49c4('0x81')](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut['cloneAction'](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xcf'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xcf'));}}else{_0x5d24f3['countnoanswerretry']++;_0xa431d[_0x49c4('0x8b')]({'id':_0x5d24f3[_0x49c4('0x8a')],'field':{'countnoanswerretry':_0x5d24f3[_0x49c4('0xae')]}})['then'](function(){_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});});}});delete this[_0x49c4('0x13')][_0x207572['linkedid']];break;default:if(_0x5d24f3[_0x49c4('0x50')]){ut['decrementTalkink'](_0x1ef0c1,'[default]');ut[_0x49c4('0x52')](_0x49c4('0xd0')+_0x1ef0c1['name'],_0x207572);}_0x1ef0c1[_0x49c4('0xc9')]+=0x1;_0x5d24f3[_0x49c4('0x79')]=ut[_0x49c4('0x81')](_0x5d24f3);ut[_0x49c4('0x67')](_0x5d24f3,0xc,_0x207572[_0x49c4('0xce')]||_0x207572[_0x49c4('0xd1')]);_0x6b2592=_0x1ef0c1[_0x49c4('0xc1')];_0xc2033f=_0x1ef0c1[_0x49c4('0xa3')];rpcDb['createCustomerHistory'](_0x5d24f3,'[callProgressDetectingCustomer][logUnknown]');_0xa431d[_0x49c4('0x7e')](_0x5d24f3,'20',_0x1ef0c1)[_0x49c4('0x5a')](function(_0x42f2db){_0x23288e=_0x42f2db['additional']==0x1;if(!_0x23288e){if(ut['totalGlobal'](_0x5d24f3)>=_0x1ef0c1[_0x49c4('0x82')]){_0xf7a10f=ut[_0x49c4('0xa7')](_0x5d24f3,0xf,_0x49c4('0x83'));rpcDb[_0x49c4('0x6f')](_0xf7a10f,_0x49c4('0xd2'));}else{rpcDb[_0x49c4('0x6f')](_0x5d24f3,_0x49c4('0xd2'));}delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0x88')]];}else{_0xa431d[_0x49c4('0xac')](_0x5d24f3,_0x6b2592,_0xc2033f)[_0x49c4('0x5a')](function(){});}});}if(!(_0x5d24f3[_0x49c4('0x50')]&&_0x73840f==='16')){ut[_0x49c4('0x4e')](_0x1ef0c1,_0x49c4('0xd3'));logger['info'](_0x49c4('0xd4'),_0x5d24f3[_0x49c4('0x8f')],_0x49c4('0x90'),_0x1ef0c1[_0x49c4('0x91')],'originated:\x20',_0x1ef0c1['originated']);}if(_0x73840f!==_0x49c4('0xd5')){delete this['actions'][_0x207572[_0x49c4('0x88')]];delete this[_0x49c4('0x13')][_0x207572[_0x49c4('0xd6')]];}_0x1ef0c1[_0x49c4('0xd7')]=!![];}};Preview[_0x49c4('0x31')][_0x49c4('0xd8')]=function(_0x3238e7,_0xe9e187,_0x31ba95){if(_[_0x49c4('0xd9')](_0xe9e187)&&_0x49c4('0xda')!==typeof _0xe9e187){return;}if(_[_0x49c4('0xd9')](_0x31ba95)&&'object'!==typeof _0x31ba95){return;}switch(_0x31ba95[_0x49c4('0xdb')]){case'0':ut[_0x49c4('0xdc')](_0x3238e7,0x0,_0x49c4('0xdd'));rpcDb['createAgentHistory'](_0x3238e7,_0x49c4('0xde'));break;case'3':ut['logAgent'](_0x3238e7,0x3,_0x49c4('0xaf'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe0'));break;case'5':ut[_0x49c4('0xdc')](_0x3238e7,0x5,'Busy');rpcDb[_0x49c4('0xdf')](_0x3238e7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3238e7,0x8,_0x49c4('0xb4'));rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));break;case'22':ut['logAgent'](_0x3238e7,0x16,'AnswerAGI');rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe2'));break;default:ut[_0x49c4('0xdc')](_0x3238e7,0xc,_0x31ba95[_0x49c4('0xdb')]);rpcDb[_0x49c4('0xdf')](_0x3238e7,_0x49c4('0xe1'));}ut[_0x49c4('0x4e')](_0xe9e187,_0x49c4('0xe3'));logger[_0x49c4('0x24')]('[originated][decrement][callProgressDetectingAgent]',_0x3238e7[_0x49c4('0x8f')],_0x49c4('0x90'),_0xe9e187['name'],'originated:\x20',_0xe9e187[_0x49c4('0xe4')]);delete this['actions'][_0x3238e7[_0x49c4('0x8f')]];};Preview['prototype'][_0x49c4('0x7e')]=function(_0x4b83a6,_0x30781e,_0x1fb51e){return cmHopperAdditionalPhone[_0x49c4('0x7e')](_0x4b83a6,_0x30781e,_0x1fb51e)[_0x49c4('0x63')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0x49c4('0x31')][_0x49c4('0xac')]=function(_0x3ce256,_0x5737b4,_0x367d3d){return cmHopperAdditionalPhone[_0x49c4('0xac')](_0x3ce256,_0x5737b4,_0x367d3d)['catch'](logger['info'](_0x49c4('0xe5')));};Preview[_0x49c4('0x31')][_0x49c4('0x8b')]=function(_0x49dc8a){return Promise[_0x49c4('0xe6')]()[_0x49c4('0x5a')](cmHopperAdditionalPhone[_0x49c4('0x8b')](_0x49dc8a))[_0x49c4('0x63')](logger['info'](_0x49c4('0xe7')));};Preview['prototype']['checkInBlack']=function(_0xf5f718,_0x171530,_0x12fda9,_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new Promise(function(_0x947dd8,_0xa6f48){if(_[_0x49c4('0xe8')](_0x171530)||_['isNil'](_0x171530[_0x49c4('0xe9')])||_['isNil'](_0x171530['phone'])||_[_0x49c4('0xe8')](_0x171530[_0x49c4('0x48')])){_0xa6f48(ut[_0x49c4('0x29')]('Contact\x20is\x20undefined',_0x24ff20,_0x5adb90));return;}var _0x336853=uuid['v4']();var _0x4a874a=_0x32b6e4[_0x49c4('0x10')][_0x171530[_0x49c4('0x3f')][_0x49c4('0x91')]];var _0x3738d7=_0x12fda9?_0x32b6e4[_0x49c4('0x14')][_0x12fda9]['id']:undefined;_0x32b6e4[_0x49c4('0x13')][_0x336853]=new Action(_0x171530,_0x4a874a,_0x336853,_0x12fda9,_0x3738d7);var _0x2b31ac=_0x32b6e4['actions'][_0x336853];_0x2b31ac[_0x49c4('0x86')]=_0x24ff20;_0x2b31ac[_0x49c4('0x87')]=_0x5adb90;_0x2b31ac[_0x49c4('0xea')]=_0x12fda9;if(_[_0x49c4('0xeb')](_0xf5f718)){_0x32b6e4['execCall'](_0x2b31ac,_0x4a874a,_0x171530,_0x12fda9)['then'](function(_0x4c15ff){logger[_0x49c4('0x24')](_0x49c4('0xec'),_0x49c4('0xed')+_0x2b31ac[_0x49c4('0x40')]+_0x49c4('0xee')+_0x2b31ac[_0x49c4('0x8a')],JSON[_0x49c4('0x42')](_0x4c15ff));ami['emit'](_0x49c4('0xef'),ut[_0x49c4('0x7b')](_0x2b31ac,'called',_0x32b6e4['campaignsPreview'][_0x2b31ac['queue']]));_0x947dd8(ut[_0x49c4('0x29')](_0x49c4('0xf0')));})[_0x49c4('0x63')](function(_0x3d0013){ut[_0x49c4('0x2c')](_0x49c4('0xf1'),_0x3d0013);_0xa6f48(ut[_0x49c4('0x29')]('Call\x20failed',_0x24ff20,_0x5adb90));});}else{_0x4a874a[_0x49c4('0xf2')]+=0x1;ut[_0x49c4('0xf3')](_0x2b31ac);rpcDb[_0x49c4('0xf4')](_0x2b31ac,_0x49c4('0xf5'));delete _0x32b6e4['actions'][_0x336853];_0xa6f48(ut[_0x49c4('0x29')](_0x49c4('0xf6'),_0x24ff20,_0x5adb90));}});};Preview[_0x49c4('0x31')][_0x49c4('0x74')]=function(_0x12d707){return!_['isNil'](_0x12d707)&&!_[_0x49c4('0xe8')](_0x12d707['name'])&&!_['isNil'](_0x12d707[_0x49c4('0xf7')])&&_0x12d707[_0x49c4('0xf7')]&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util[_0x49c4('0x65')]('SIP/%s',_0x12d707[_0x49c4('0x91')])])&&!_[_0x49c4('0xe8')](this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])]['status'])&&(this[_0x49c4('0x12')][util[_0x49c4('0x65')](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xf9')||this[_0x49c4('0x12')][util['format'](_0x49c4('0xf8'),_0x12d707[_0x49c4('0x91')])][_0x49c4('0x4b')]===_0x49c4('0xfa'));};Preview[_0x49c4('0x31')]['run']=function(_0x34ce60,_0x39dc83){return this[_0x49c4('0xfb')](_0x34ce60,_0x39dc83)[_0x49c4('0x5a')](function(_0xa2c8cf){return _['pick'](_0xa2c8cf,[_0x49c4('0x29')]);})[_0x49c4('0x63')](function(_0x789121){if(_0x789121[_0x49c4('0xfc')]){rpcDb[_0x49c4('0xfd')](_0x34ce60);}if(_0x789121[_0x49c4('0xf7')]){rpcDb[_0x49c4('0x64')](_0x34ce60);}throw _[_0x49c4('0x45')](_0x789121,[_0x49c4('0x29')]);});};Preview[_0x49c4('0x31')]['execRun']=function(_0x2d3211,_0x1b6966){var _0x2c4d2a=this;var _0x1745f8,_0xe22808;return rpcDb['getContactPreview'](_0x2d3211)['then'](function(_0x13aab1){if(!_[_0x49c4('0xe8')](_0x13aab1[0x0])){_0xe22808=_0x13aab1[0x0][_0x49c4('0xfe')]?![]:!![];_0x1745f8=_0x13aab1[0x0][_0x49c4('0xfe')]?!![]:![];_0x1745f8=_0x1b6966?!![]:_0x1745f8;}var _0xd87f7e=_0x2c4d2a[_0x49c4('0xff')](_0x13aab1);if(_0xd87f7e['isValid']){rpcDb[_0x49c4('0x100')](_[_0x49c4('0x45')](_0x13aab1[0x0],['VoiceQueueId',_0x49c4('0x101')]))['then'](function(_0x30d99a){_0x2c4d2a[_0x49c4('0x102')](_0x30d99a,_0x13aab1[0x0],_0x1b6966,_0xe22808,_0x1745f8)[_0x49c4('0x5a')](function(_0x5db4a1){return _0x5db4a1;})[_0x49c4('0x63')](function(_0x4f431e){throw _0x4f431e;});})[_0x49c4('0x63')](function(_0x5025ee){ut['logger'](_0x49c4('0x103'),_0x5025ee);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),_0xe22808,_0x1745f8);});}else{throw ut[_0x49c4('0x29')](_0xd87f7e[_0x49c4('0x29')],_0xe22808,_0x1745f8);}})[_0x49c4('0x63')](function(_0x5a06d7){ut['logger'](_0x49c4('0x105'),_0x5a06d7);throw ut[_0x49c4('0x29')](_0x49c4('0x104'),![],!![]);});};Preview[_0x49c4('0x31')][_0x49c4('0xff')]=function(_0x3d2dd0){if(_[_0x49c4('0xe8')](_0x3d2dd0)||_['isEmpty'](_0x3d2dd0)||!_['isNil'](_0x3d2dd0[0x0]['Agent'])&&_['isNil'](_0x3d2dd0[0x0][_0x49c4('0x5f')]['name'])){ut[_0x49c4('0x2c')](_0x49c4('0x106'),_0x3d2dd0);return{'isValid':![],'message':_0x49c4('0x107')};}var _0x53dd04=this['campaignsPreview'][_0x3d2dd0[0x0][_0x49c4('0x3f')][_0x49c4('0x91')]];_0x53dd04['message']=utils[_0x49c4('0x2a')][_0x49c4('0x76')];if(_[_0x49c4('0xe8')](_0x53dd04)){ut[_0x49c4('0x2c')](_0x49c4('0x108'),_0x53dd04);return{'isValid':![],'message':_0x49c4('0x109')};}if(!this['isTrunkReachable'](_0x53dd04[_0x49c4('0x10a')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10c'));if(!this[_0x49c4('0x74')](_0x53dd04[_0x49c4('0x10d')])){ut[_0x49c4('0x2c')](_0x49c4('0x10b'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x49c4('0x73')](_0x53dd04[_0x49c4('0x39')])){ut[_0x49c4('0x2c')](_0x49c4('0x10f'),_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x53dd04[_0x49c4('0x91')]+_0x49c4('0x110')};}return{'isValid':!![],'message':_0x49c4('0x111')};};Preview[_0x49c4('0x31')][_0x49c4('0x112')]=function(_0x3a8fe1,_0x29c6fc,_0x1642fd,_0x4806ac){var _0xc641bc=this;return new Promise(function(_0xcec186,_0x1c8258){var _0x471e28=_0x3a8fe1[_0x49c4('0x8f')];var _0x5a471d=_0xc641bc['isTrunkReachable'](_0x29c6fc[_0x49c4('0x10a')])?util[_0x49c4('0x65')]('SIP/%s/%s%s',_0x29c6fc['Trunk'][_0x49c4('0x91')],_['isNil'](_0x29c6fc[_0x49c4('0x113')])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc[_0x49c4('0x115')]>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd[_0x49c4('0x101')]):util['format'](_0x49c4('0x117'),_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x91')]:_0x29c6fc['TrunkBackup'][_0x49c4('0x91')],_[_0x49c4('0xe8')](_0x29c6fc['dialPrefix'])?'':_0x29c6fc[_0x49c4('0x113')][_0x49c4('0x114')]()||'',_0x29c6fc['dialCutDigit']>0x0?_0x1642fd[_0x49c4('0x101')][_0x49c4('0x116')](_0x29c6fc[_0x49c4('0x115')]):_0x1642fd['phone']);var _0x1ee36e=_0xc641bc[_0x49c4('0x74')](_0x29c6fc[_0x49c4('0x10a')])?ut[_0x49c4('0x118')](_0x29c6fc['Trunk'][_0x49c4('0x119')],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc['dialOriginateCallerIdNumber']):ut[_0x49c4('0x118')](_[_0x49c4('0xe8')](_0x29c6fc[_0x49c4('0x10d')])?_0x29c6fc[_0x49c4('0x10a')][_0x49c4('0x119')]:_0x29c6fc[_0x49c4('0x10d')]['callerid'],_0x29c6fc['dialOriginateCallerIdName'],_0x29c6fc[_0x49c4('0x11a')]>0x0?ut[_0x49c4('0x11b')](_0x29c6fc[_0x49c4('0x11c')],_0x29c6fc[_0x49c4('0x11a')]):_0x29c6fc[_0x49c4('0x11c')]);if(_0x1ee36e){_0x3a8fe1[_0x49c4('0x11d')]=ut[_0x49c4('0x11e')](_0x1ee36e);_0x3a8fe1[_0x49c4('0x11f')]=ut[_0x49c4('0x120')](_0x1ee36e);}var _0x37dbbf=ut[_0x49c4('0x121')](_0x29c6fc,_0x1642fd,_0x5a471d,_0x1ee36e,_0x471e28,_0x3a8fe1);_[_0x49c4('0x122')](_0x3a8fe1,ut['toLowerVariables'](_0x37dbbf));_0x3a8fe1[_0x49c4('0x123')]=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x29c6fc[_0x49c4('0x124')]=_0x37dbbf;var _0x5adc01=ut[_0x49c4('0x125')](_0x3a8fe1,_0x29c6fc,_0x37dbbf,_0x3a8fe1[_0x49c4('0x87')],_0x4806ac);return ami['Action'](_0x5adc01)[_0x49c4('0x5a')](function(_0x245fae){_0x29c6fc[_0x49c4('0xe4')]+=0x1;logger[_0x49c4('0x24')](_0x49c4('0x126'),_0x471e28,'\x20Queue',_0x29c6fc[_0x49c4('0x91')],'originated:\x20',_0x29c6fc[_0x49c4('0xe4')]);_0xcec186(_0x245fae);})[_0x49c4('0x63')](function(_0x294b2c){ut['logAgent'](_0x3a8fe1,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xdf')](_0x3a8fe1,_0x49c4('0x128'));_0x1c8258(_0x294b2c);});});};Preview['prototype']['syncNewExten']=function(_0x256d6b){if(this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]]){this[_0x49c4('0x13')][_0x256d6b[_0x49c4('0x88')]][_0x49c4('0x4c')]=_0x256d6b['channel'];}};Preview['prototype']['syncOriginateResponse']=function(_0x2eae62){var _0x417cef=this;var _0x153450=this[_0x49c4('0x13')][_0x2eae62['actionid']];if(_0x153450){if(_0x153450[_0x49c4('0xea')]&&this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]){ut[_0x49c4('0x129')](_0x153450,this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]][_0x49c4('0x91')],this[_0x49c4('0x14')][_0x153450[_0x49c4('0xea')]]['id']);}var _0x39e6f5=_[_0x49c4('0x12a')](_0x153450);_0x39e6f5['responsetime']=moment()[_0x49c4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3308c4=_0x417cef[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]];if(ut[_0x49c4('0x12b')](_0x2eae62['response'])){if(_0x153450[_0x49c4('0x86')]){rpcDb['unlockContact'](_0x153450['idContact']);}if(_0x153450['activeContact']){rpcDb[_0x49c4('0x64')](_0x153450[_0x49c4('0x8a')]);}ami[_0x49c4('0x23')]('custom:agentringnoanswer',ut[_0x49c4('0x7b')](_0x153450,'rejected',this[_0x49c4('0x10')][_0x153450[_0x49c4('0x40')]]));this[_0x49c4('0xd8')](_0x39e6f5,_0x3308c4,_0x2eae62);}else{_0x153450['starttime']=moment()[_0x49c4('0x65')](_0x49c4('0x66'));ut[_0x49c4('0xdc')](_0x39e6f5,0x4,_0x49c4('0x12c'));rpcDb[_0x49c4('0xdf')](_0x39e6f5,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49c4('0x31')][_0x49c4('0x1a')]=function(_0x15e35f){var _0x6b1554=this['actions'][_0x15e35f['linkedid']];var _0x238884;if(_0x6b1554){_0x238884=this[_0x49c4('0x10')][_0x6b1554['queue']];logger[_0x49c4('0x24')](_0x49c4('0x12d'),_0x15e35f[_0x49c4('0x88')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);}if(this['actions'][_0x15e35f['linkedid']]&&_0x15e35f[_0x49c4('0x88')]!==_0x15e35f[_0x49c4('0x8f')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]]['dialAnswer']){this[_0x49c4('0x77')](_0x15e35f,_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')]);}else if(this[_0x49c4('0x13')][_0x15e35f[_0x49c4('0x88')]][_0x49c4('0x50')]){logger['info']('[syncHangup][talking][cause]',_0x15e35f['linkedid'],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884[_0x49c4('0x91')],_0x49c4('0x43'),_0x238884['pTalking']);this['callProgressDetectingCustomer'](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}}else if(_0x6b1554&&_[_0x49c4('0xe8')](_0x6b1554[_0x49c4('0x12f')])&&_0x238884['dialQueueProject']&&_0x15e35f[_0x49c4('0x88')]===_0x15e35f[_0x49c4('0x8f')]&&_[_0x49c4('0xe8')](_0x15e35f['reason'])&&_0x15e35f[_0x49c4('0x12e')]==='16'&&_0x15e35f[_0x49c4('0x130')]==='6'&&_[_0x49c4('0xd9')](_0x6b1554['transfer'])){if(_0x6b1554[_0x49c4('0x86')]){rpcDb[_0x49c4('0xfd')](_0x6b1554['idContact']);}if(_0x6b1554[_0x49c4('0x87')]){rpcDb[_0x49c4('0x64')](_0x6b1554['idContact']);}_0x15e35f[_0x49c4('0xdb')]='22';this[_0x49c4('0xd8')](_0x6b1554,_0x238884,_0x15e35f);}else if(_0x6b1554&&_0x6b1554[_0x49c4('0x131')]){if(_0x15e35f[_0x49c4('0x12e')]==='16'&&this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][transfer]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],_0x49c4('0x90'),_0x238884['name'],_0x49c4('0x43'),_0x238884['pTalking']);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f['cause']);}else if(this[_0x49c4('0x13')][_0x15e35f['linkedid']][_0x49c4('0x50')]){logger[_0x49c4('0x24')]('[syncHangup][talking][cause]',_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')],'\x20Queue',_0x238884['name'],_0x49c4('0x43'),_0x238884[_0x49c4('0x44')]);this[_0x49c4('0x77')](_0x15e35f,_0x15e35f[_0x49c4('0x88')],_0x15e35f[_0x49c4('0x12e')]);}}};Preview['prototype'][_0x49c4('0x1d')]=function(_0x40afb8){if(this[_0x49c4('0x13')][_0x40afb8[_0x49c4('0xd6')]]&&_0x40afb8[_0x49c4('0xd6')]!==_0x40afb8['destuniqueid']){this[_0x49c4('0x77')](_0x40afb8,_0x40afb8[_0x49c4('0xd6')],_0x40afb8[_0x49c4('0xd1')]);}};Preview[_0x49c4('0x31')][_0x49c4('0x1b')]=function(_0x39abbf){if(this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]&&_0x39abbf['linkedid']!==_0x39abbf[_0x49c4('0x8f')]&&!this[_0x49c4('0x13')][_0x39abbf[_0x49c4('0x88')]]['dialAnswer']){if(_0x39abbf['cause']==='1'){this[_0x49c4('0x77')](_0x39abbf,_0x39abbf['linkedid'],_0x39abbf[_0x49c4('0x12e')]);}}};Preview[_0x49c4('0x31')][_0x49c4('0x132')]=function(_0x3f0e74,_0x55f423,_0x3ce0f9){if(this[_0x49c4('0x13')][_0x3f0e74]){if(_[_0x49c4('0xe8')](this[_0x49c4('0x13')][_0x3f0e74]['variables'])){this[_0x49c4('0x13')][_0x3f0e74][_0x49c4('0x124')]={};}this['actions'][_0x3f0e74][_0x49c4('0x124')][_0x55f423]=_0x3ce0f9;}};Preview[_0x49c4('0x31')][_0x49c4('0x133')]=function(_0x72eab6){try{if(!_[_0x49c4('0xe8')](_0x72eab6)){if(ut[_0x49c4('0x134')](_[_0x49c4('0x135')](_0x72eab6[_0x49c4('0x136')])[0x0])){this['addVariable'](_0x72eab6['uniqueid'],_['keys'](_0x72eab6[_0x49c4('0x136')])[0x0],_0x72eab6[_0x49c4('0x137')]);}}}catch(_0x418ead){logger[_0x49c4('0x138')](_0x49c4('0x139'),util['inspect'](_0x418ead,{'showHidden':![],'depth':null}));}};Preview[_0x49c4('0x31')][_0x49c4('0x20')]=function(_0x9786bf){if(_0x9786bf){if(this[_0x49c4('0x13')][_0x9786bf['transfertargetlinkedid']]){this['actions'][_0x9786bf[_0x49c4('0x13a')]][_0x49c4('0x131')]=!![];}}};Preview[_0x49c4('0x31')][_0x49c4('0x13b')]=function(_0x281151){if(_0x281151){if(this[_0x49c4('0x13')][_0x281151['transfererlinkedid']]){this['actions'][_0x281151[_0x49c4('0x13c')]][_0x49c4('0x131')]=!![];}}};module[_0x49c4('0x13d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 7bd098b..5b3a918 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 _0xb2b1=['queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt'];(function(_0x48b8d8,_0x2288cb){var _0x3d3394=function(_0x31ff72){while(--_0x31ff72){_0x48b8d8['push'](_0x48b8d8['shift']());}};_0x3d3394(++_0x2288cb);}(_0xb2b1,0xb3));var _0x1b2b=function(_0x4f4319,_0x472bf7){_0x4f4319=_0x4f4319-0x0;var _0xacf3f6=_0xb2b1[_0x4f4319];return _0xacf3f6;};'use strict';var util=require(_0x1b2b('0x0'));var BPromise=require(_0x1b2b('0x1'));var logger=require(_0x1b2b('0x2'))('preview');var cmHopper=require(_0x1b2b('0x3'));var cmHopperHistory=require(_0x1b2b('0x4'));var cmHopperBlack=require(_0x1b2b('0x5'));var agentReportPreview=require(_0x1b2b('0x6'));var voiceQueueReport=require(_0x1b2b('0x7'));function loggerCatch(_0x5d4b95){return function(_0x1313a6){logger[_0x1b2b('0x8')](_0x5d4b95,util[_0x1b2b('0x9')](_0x1313a6,{'showHidden':![],'depth':null}));};}function create(_0x49d7fe){return cmHopperHistory['createHistory'](_0x49d7fe)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0xb')));}function createAgent(_0x14b935){return BPromise[_0x1b2b('0xc')]()['then'](agentReportPreview[_0x1b2b('0xd')](_0x14b935))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3e5854){return cmHopper[_0x1b2b('0xe')](_0x3e5854,!![])[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0xf')));}exports[_0x1b2b('0x10')]=function(_0x3ebdb1){return cmHopperBlack[_0x1b2b('0x10')](_0x3ebdb1)['catch'](loggerCatch(_0x1b2b('0x11')));};exports[_0x1b2b('0x12')]=function(_0x391c46){return BPromise['resolve']()[_0x1b2b('0x13')](cmHopper[_0x1b2b('0x12')](_0x391c46))[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x14')));};exports[_0x1b2b('0xd')]=function(_0x4ad97d,_0x39bc20){create(_0x4ad97d)['catch'](loggerCatch(_0x39bc20));moveContact(_0x4ad97d)[_0x1b2b('0xa')](loggerCatch(_0x39bc20));};exports[_0x1b2b('0x15')]=function(_0xc3a355,_0x450b1d){createAgent(_0xc3a355)[_0x1b2b('0xa')](loggerCatch(_0x450b1d));};exports[_0x1b2b('0x16')]=function(_0x43fd98,_0x3e0250){create(_0x43fd98)[_0x1b2b('0xa')](loggerCatch(_0x3e0250));};exports[_0x1b2b('0x17')]=function(_0x5d187d,_0x488ea8){moveContact(_0x5d187d)['catch'](loggerCatch(_0x488ea8));};exports['rescheduleContact']=function(_0x2846b8,_0x14701c,_0x409e3a){if(_0x14701c){_0x2846b8[_0x1b2b('0x18')]=null;}if(_0x409e3a){_0x2846b8['active']=![];}return cmHopper[_0x1b2b('0x19')](_0x2846b8)[_0x1b2b('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x36bb21){return cmHopper[_0x1b2b('0x1a')](_0x36bb21)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x1b')));};exports[_0x1b2b('0x1c')]=function(_0x23dc4e){return cmHopper[_0x1b2b('0x1c')]({'UserId':null},_0x23dc4e,0x1)[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x1d')));};exports[_0x1b2b('0x1e')]=function(_0x41c20f){return cmHopper[_0x1b2b('0x1c')]({'active':![]},_0x41c20f,0x1)[_0x1b2b('0xa')](loggerCatch('[activeContact]\x20'));};exports[_0x1b2b('0x1f')]=function(_0x1151b0){var _0x3edeff={};_0x3edeff['type']=_0x1151b0[_0x1b2b('0x20')];_0x3edeff['uniqueid']=_0x1151b0[_0x1b2b('0x21')];_0x3edeff['calleridnum']=_0x1151b0[_0x1b2b('0x22')];_0x3edeff['calleridname']=_0x1151b0['calleridname'];_0x3edeff[_0x1b2b('0x23')]=_0x1151b0[_0x1b2b('0x23')];_0x3edeff[_0x1b2b('0x24')]=_0x1151b0['answertime'];_0x3edeff[_0x1b2b('0x25')]=_0x1151b0[_0x1b2b('0x26')];_0x3edeff[_0x1b2b('0x27')]=0x1;_0x3edeff[_0x1b2b('0x28')]=_0x1151b0['endtime'];_0x3edeff[_0x1b2b('0x29')]=_0x1151b0[_0x1b2b('0x2a')];_0x3edeff[_0x1b2b('0x2b')]='from-sip';_0x3edeff[_0x1b2b('0x2c')]=_0x1b2b('0x2d');_0x3edeff[_0x1b2b('0x2e')]=0x0;_0x3edeff['assigned']=0x1;_0x3edeff[_0x1b2b('0x2f')]=_0x1151b0[_0x1b2b('0x2a')];_0x3edeff[_0x1b2b('0x30')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x1b2b('0x31')](_0x3edeff))['catch'](loggerCatch(_0x1b2b('0x32')));};exports['getContactRecallMe']=function(_0x2aaa09,_0x3aa868){return BPromise[_0x1b2b('0xc')]()[_0x1b2b('0x13')](cmHopper[_0x1b2b('0x33')](_0x2aaa09,_0x3aa868))[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x34')));};exports['rescheduleContactInQueue']=function(_0x5a3063){return cmHopper[_0x1b2b('0x19')](_0x5a3063,!![],!![])[_0x1b2b('0xa')](loggerCatch(_0x1b2b('0x35')));}; \ No newline at end of file +var _0x9260=['rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x9260,0x110));var _0x0926=function(_0x29755a,_0xd68f9d){_0x29755a=_0x29755a-0x0;var _0x267a42=_0x9260[_0x29755a];return _0x267a42;};'use strict';var util=require(_0x0926('0x0'));var BPromise=require(_0x0926('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x0926('0x2'));var cmHopperHistory=require(_0x0926('0x3'));var cmHopperBlack=require(_0x0926('0x4'));var agentReportPreview=require(_0x0926('0x5'));var voiceQueueReport=require(_0x0926('0x6'));function loggerCatch(_0x3e7b32){return function(_0x5cec52){logger[_0x0926('0x7')](_0x3e7b32,util[_0x0926('0x8')](_0x5cec52,{'showHidden':![],'depth':null}));};}function create(_0x3c4adf){return cmHopperHistory[_0x0926('0x9')](_0x3c4adf)[_0x0926('0xa')](loggerCatch(_0x0926('0xb')));}function createAgent(_0x298a6c){return BPromise[_0x0926('0xc')]()[_0x0926('0xd')](agentReportPreview['createHistory'](_0x298a6c))[_0x0926('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5e10b3){return cmHopper[_0x0926('0xe')](_0x5e10b3,!![])[_0x0926('0xa')](loggerCatch(_0x0926('0xf')));}exports[_0x0926('0x10')]=function(_0x2e8572){return cmHopperBlack[_0x0926('0x10')](_0x2e8572)[_0x0926('0xa')](loggerCatch(_0x0926('0x11')));};exports[_0x0926('0x12')]=function(_0x1e1161){return BPromise[_0x0926('0xc')]()['then'](cmHopper[_0x0926('0x12')](_0x1e1161))['catch'](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x2a2fd1,_0x4a8941){create(_0x2a2fd1)[_0x0926('0xa')](loggerCatch(_0x4a8941));moveContact(_0x2a2fd1)['catch'](loggerCatch(_0x4a8941));};exports['createAgentHistory']=function(_0x4bd70e,_0x307592){createAgent(_0x4bd70e)['catch'](loggerCatch(_0x307592));};exports['createCustomerHistory']=function(_0x27b8c6,_0x4138c3){create(_0x27b8c6)[_0x0926('0xa')](loggerCatch(_0x4138c3));};exports[_0x0926('0x13')]=function(_0x5b110b,_0x458099){moveContact(_0x5b110b)['catch'](loggerCatch(_0x458099));};exports[_0x0926('0x14')]=function(_0x2c7adf,_0x1be6b2,_0x5bff9c){if(_0x1be6b2){_0x2c7adf['UserId']=null;}if(_0x5bff9c){_0x2c7adf[_0x0926('0x15')]=![];}return cmHopper[_0x0926('0x14')](_0x2c7adf)[_0x0926('0xa')](loggerCatch(_0x0926('0x16')));};exports[_0x0926('0x17')]=function(_0x1f1198){return cmHopper[_0x0926('0x17')](_0x1f1198)['catch'](loggerCatch(_0x0926('0x18')));};exports[_0x0926('0x19')]=function(_0x2df060){return cmHopper[_0x0926('0x19')]({'UserId':null},_0x2df060,0x1)[_0x0926('0xa')](loggerCatch(_0x0926('0x1a')));};exports[_0x0926('0x1b')]=function(_0xb81f97){return cmHopper['unlockContact']({'active':![]},_0xb81f97,0x1)[_0x0926('0xa')](loggerCatch(_0x0926('0x1c')));};exports[_0x0926('0x1d')]=function(_0x3e7475){var _0x1e676c={};_0x1e676c[_0x0926('0x1e')]=_0x3e7475[_0x0926('0x1e')];_0x1e676c['uniqueid']=_0x3e7475[_0x0926('0x1f')];_0x1e676c[_0x0926('0x20')]=_0x3e7475[_0x0926('0x20')];_0x1e676c[_0x0926('0x21')]=_0x3e7475[_0x0926('0x21')];_0x1e676c[_0x0926('0x22')]=_0x3e7475[_0x0926('0x22')];_0x1e676c[_0x0926('0x23')]=_0x3e7475[_0x0926('0x24')];_0x1e676c[_0x0926('0x25')]=_0x3e7475[_0x0926('0x24')];_0x1e676c['queuecallercomplete']=0x1;_0x1e676c[_0x0926('0x26')]=_0x3e7475[_0x0926('0x27')];_0x1e676c[_0x0926('0x28')]=_0x3e7475[_0x0926('0x29')];_0x1e676c['context']=_0x0926('0x2a');_0x1e676c[_0x0926('0x2b')]=_0x0926('0x2c');_0x1e676c['holdtime']=0x0;_0x1e676c[_0x0926('0x2d')]=0x1;_0x1e676c[_0x0926('0x2e')]=_0x3e7475['membername'];_0x1e676c[_0x0926('0x2f')]=_0x0926('0x30');return BPromise[_0x0926('0xc')]()[_0x0926('0xd')](voiceQueueReport[_0x0926('0x31')](_0x1e676c))[_0x0926('0xa')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0926('0x32')]=function(_0x4e4e20,_0x3e791f){return BPromise[_0x0926('0xc')]()['then'](cmHopper[_0x0926('0x32')](_0x4e4e20,_0x3e791f))[_0x0926('0xa')](loggerCatch(_0x0926('0x33')));};exports[_0x0926('0x34')]=function(_0x39e5e0){return cmHopper[_0x0926('0x14')](_0x39e5e0,!![],!![])[_0x0926('0xa')](loggerCatch(_0x0926('0x35')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 5352720..13c4d1a 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 _0xf2d9=['match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridnum','VoiceQueueId','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','updateOriginated','isNil','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','getSeconds','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','minutes','ListId','decrementTalkink','IsNotLoggedIn','lastevent','queue','motionChannel','mandatoryDisposition','buildObj','interface','agentReadyId','not_inuse','status','push','milliseconds','diff','seconds','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber'];(function(_0x3fc505,_0x1d11fd){var _0x25d2d5=function(_0xca2279){while(--_0xca2279){_0x3fc505['push'](_0x3fc505['shift']());}};_0x25d2d5(++_0x1d11fd);}(_0xf2d9,0x125));var _0x9f2d=function(_0x5cb284,_0x4b558f){_0x5cb284=_0x5cb284-0x0;var _0x3302f2=_0xf2d9[_0x5cb284];return _0x3302f2;};'use strict';var util=require(_0x9f2d('0x0'));var _=require('lodash');var moment=require(_0x9f2d('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x9f2d('0x2')][_0x9f2d('0x3')]||_0x9f2d('0x4');var utils=require(_0x9f2d('0x5'));exports[_0x9f2d('0x6')]=function(_0xdd7392){return function(_0x24ea47){logger['error'](_0xdd7392,util[_0x9f2d('0x7')](_0x24ea47,{'showHidden':![],'depth':null}));};};exports[_0x9f2d('0x8')]=function(_0x4a81fa,_0x7523a2){logger[_0x9f2d('0x9')](_0x4a81fa,util['inspect'](_0x7523a2,{'showHidden':![],'depth':null}));};exports[_0x9f2d('0xa')]=function(_0x1581b1,_0x10dd98){logger[_0x9f2d('0xb')](_0x1581b1,util['inspect'](_0x10dd98,{'showHidden':![],'depth':null}));};exports[_0x9f2d('0xc')]=function(_0x481338){return function(_0x1c59ba){logger['info'](_0x481338,util[_0x9f2d('0x7')](_0x1c59ba,{'showHidden':![],'depth':null}));};};exports[_0x9f2d('0xd')]=function(_0x5b45f5,_0x31a50a,_0x112f7d){return{'message':_0x5b45f5,'unlock':_0x31a50a,'active':_0x112f7d};};exports[_0x9f2d('0xe')]=function(_0x469e44,_0x4b8afe,_0x168335){if(!_[_0x9f2d('0xf')](_0x168335)&&_0x9f2d('0x10')===typeof _0x168335&&!_['isEmpty'](_0x168335)){if(!_[_0x9f2d('0xf')](_0x4b8afe)&&_0x9f2d('0x10')===typeof _0x4b8afe&&!_[_0x9f2d('0x11')](_0x4b8afe)){return util[_0x9f2d('0x12')]('\x22%s\x22\x20<%s>',_0x4b8afe,_0x168335);}return util[_0x9f2d('0x12')](_0x9f2d('0x13'),_0x168335,_0x168335);}if(!_[_0x9f2d('0xf')](_0x469e44)&&'string'===typeof _0x469e44&&!_[_0x9f2d('0x11')](_0x469e44)){return _0x469e44;}return _0x9f2d('0x14');};exports['isActive']=function(_0x9201d){if(_['isNil'](_0x9201d)){return![];}return _0x9201d;};exports[_0x9f2d('0x15')]=function(_0x5cdccc,_0x4ad767,_0x42b5e2,_0x546451,_0x14f294,_0x1f17e1){var _0x1cb234={'XMD-QUEUE':_0x4ad767[_0x9f2d('0x16')]?_0x4ad767[_0x9f2d('0x16')][_0x9f2d('0x17')]:'','XMD-CALLERID':_0x546451,'XMD-CALLERID-PREVIEW':_0x1f17e1?util[_0x9f2d('0x12')](_0x9f2d('0x13'),_0x1f17e1['calleridname'],_0x1f17e1[_0x9f2d('0x18')]):_0x546451,'XMD-DIALID':_0x14f294,'XMD-CONTACTID':_0x4ad767['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x546451,'XMD-VOICEQUEUEID':_0x4ad767[_0x9f2d('0x19')],'XMD-DIALCHANNEL':_0x42b5e2,'XMD-DIALTIMEOUT':_0x5cdccc['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x9f2d('0x12')]('\x22rtTxX%s%s\x22',_0x5cdccc[_0x9f2d('0x1a')]?'g':'',_[_0x9f2d('0x11')](_0x5cdccc['monitor_format'])?'':_0x9f2d('0x1b')),'XMD-DIALURL':_0x5cdccc['dialPreviewUrl']||'','XMD-AGI':_0x5cdccc[_0x9f2d('0x1c')]?util[_0x9f2d('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5cdccc[_0x9f2d('0x1c')]):'NONE','XMD-AGIAFTER':_0x5cdccc[_0x9f2d('0x1a')]?util[_0x9f2d('0x12')](_0x9f2d('0x1d'),ipAgi,_0x5cdccc['dialQueueProject2']):_0x9f2d('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x1f17e1?_0x1f17e1[_0x9f2d('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x1f17e1?_0x1f17e1[_0x9f2d('0x20')]:'','XMD-DESTINATION':_0x9f2d('0x21'),'SIPADDHEADER':_0x9f2d('0x22')};if(!_[_0x9f2d('0x11')](_0x5cdccc[_0x9f2d('0x23')])){_0x1cb234[util[_0x9f2d('0x12')]('%s',_0x9f2d('0x24'))]=_0x5cdccc['monitor_format'];_0x1cb234[util['format']('%s',_0x9f2d('0x25'))]=_0x14f294;}if(_0x4ad767&&_0x4ad767[_0x9f2d('0x26')]){for(var _0x3185bf in _0x4ad767[_0x9f2d('0x26')]){if(_0x4ad767['Contact'][_0x9f2d('0x27')](_0x3185bf)){if(!_['isNil'](_0x4ad767[_0x9f2d('0x26')][_0x3185bf])&&_0x3185bf!=='id'&&_0x3185bf!==_0x9f2d('0x28')&&_0x3185bf!==_0x9f2d('0x29')&&_0x3185bf!==_0x9f2d('0x2a')){_0x1cb234[util[_0x9f2d('0x12')](_0x9f2d('0x2b'),'XMD-',_[_0x9f2d('0x2c')](_0x3185bf))]=_0x4ad767[_0x9f2d('0x26')][_0x3185bf];}}}}return _0x1cb234;};exports[_0x9f2d('0x2d')]=function(_0x313eb0){var _0xc5541a={};for(var _0x256c66 in _0x313eb0){if(_0x313eb0[_0x9f2d('0x27')](_0x256c66)){_0xc5541a[util[_0x9f2d('0x12')]('%s',_['toLower'](_0x256c66))]=_0x313eb0[_0x256c66];}}return{'variables':_0xc5541a};};exports[_0x9f2d('0x2e')]=function(_0x48fae4,_0x2e801a){if(!_[_0x9f2d('0x2f')](_0x48fae4)){if(_0x48fae4[_0x9f2d('0x27')]('originated')){if(_0x48fae4['originated']>0x0){_0x48fae4['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2e801a);}}}else{logger[_0x9f2d('0xb')](_0x9f2d('0x30'),_0x2e801a);}};exports[_0x9f2d('0x31')]=function(_0x54af6b){var _0x2bb127=moment()[_0x9f2d('0x12')](_0x9f2d('0x32'));_0x54af6b[_0x9f2d('0x33')]=0xd;_0x54af6b[_0x9f2d('0x34')]='Blacklist';_0x54af6b[_0x9f2d('0x35')]=_0x2bb127;_0x54af6b[_0x9f2d('0x36')]=_0x2bb127;_0x54af6b[_0x9f2d('0x37')]=_0x2bb127;};exports['logAgent']=function(_0x407629,_0x44ab53,_0x224e24){var _0x1893ff=moment()[_0x9f2d('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x407629[_0x9f2d('0x33')]=_0x44ab53;_0x407629[_0x9f2d('0x34')]=_0x224e24;_0x407629[_0x9f2d('0x36')]=_0x1893ff;_0x407629['ringtime']=utils[_0x9f2d('0x38')](_0x407629[_0x9f2d('0x36')],_0x407629[_0x9f2d('0x35')]);};exports['logLookAgent']=function(_0x5dec34,_0x41d400,_0x3cabb0){_0x5dec34[_0x9f2d('0x39')]=_0x41d400;_0x5dec34[_0x9f2d('0x3a')]=_0x3cabb0;};exports[_0x9f2d('0x3b')]=function(_0x315ca0,_0x268074,_0x29bfd8){var _0x2d07c7=moment()[_0x9f2d('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x315ca0[_0x9f2d('0x33')]=_0x268074;_0x315ca0[_0x9f2d('0x34')]=_0x29bfd8;_0x315ca0[_0x9f2d('0x36')]=_0x315ca0['responsetime']?_0x315ca0[_0x9f2d('0x36')]:_0x2d07c7;_0x315ca0[_0x9f2d('0x37')]=_0x315ca0[_0x9f2d('0x37')]?_0x315ca0[_0x9f2d('0x37')]:_0x2d07c7;_0x315ca0[_0x9f2d('0x3c')]=utils[_0x9f2d('0x38')](_0x315ca0[_0x9f2d('0x36')]||0x0,_0x315ca0[_0x9f2d('0x35')]||0x0);_0x315ca0[_0x9f2d('0x3d')]=_0x315ca0[_0x9f2d('0x3e')]?utils['getSeconds'](_0x315ca0[_0x9f2d('0x37')],_0x315ca0[_0x9f2d('0x3e')]):0x0;};exports[_0x9f2d('0x3f')]=function(_0x40c9b0){return _0x40c9b0===_0x9f2d('0x40');};exports[_0x9f2d('0x41')]=function(_0x51f247,_0x430287,_0x470ce1,_0x185bc1,_0x2262cc){var _0x1662d1=_0x185bc1?_0x9f2d('0x42'):_0x51f247[_0x9f2d('0x43')];_0x1662d1=_0x2262cc?'BOOKED':_0x1662d1;return{'actionid':_0x51f247[_0x9f2d('0x44')],'action':_0x9f2d('0x45'),'channel':_0x51f247[_0x9f2d('0x46')],'callerid':util[_0x9f2d('0x12')]('\x22%s\x22\x20<%s>',_0x1662d1,_0x51f247[_0x9f2d('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x470ce1,'timeout':(_0x430287[_0x9f2d('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x51f247[_0x9f2d('0x44')]};};exports[_0x9f2d('0x48')]=function(_0x21a349){return _0x21a349[_0x9f2d('0x49')]+_0x21a349[_0x9f2d('0x4a')]+_0x21a349['countnoanswerretry']+_0x21a349['countagentrejectretry']+_0x21a349[_0x9f2d('0x4b')];};exports[_0x9f2d('0x4c')]=function(_0x355608){var _0x51a1e9=_['clone'](_0x355608);_0x51a1e9[_0x9f2d('0x33')]=0xf;_0x51a1e9[_0x9f2d('0x34')]=_0x9f2d('0x4d');return _0x51a1e9;};exports[_0x9f2d('0x4e')]=function(_0x32ed25,_0x2e5962,_0x52209a){var _0xf7b0a0={};_0xf7b0a0[_0x2e5962]=_0x32ed25[_0x2e5962];_0xf7b0a0[_0x9f2d('0x4f')]=![];_0xf7b0a0['scheduledat']=moment()['add'](_0x52209a,_0x9f2d('0x50'))['format'](_0x9f2d('0x32'));_0xf7b0a0['ContactId']=_0x32ed25['ContactId'];_0xf7b0a0[_0x9f2d('0x51')]=_0x32ed25['ListId'];_0xf7b0a0['VoiceQueueId']=_0x32ed25[_0x9f2d('0x19')]||undefined;return _0xf7b0a0;};exports[_0x9f2d('0x52')]=function(_0x7e7170,_0xb6f5c9){if(!_['isNil'](_0x7e7170)){if(_0x7e7170['pTalking']>0x0){_0x7e7170['pTalking']-=0x1;}else{logger['error'](_0xb6f5c9,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0xb6f5c9,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x9f2d('0x53')]=function(_0x55e4b1){if(_0x55e4b1<=0x0){return!![];}return![];};function buildObj(_0x4e1999,_0x3f1cca,_0x449bd5){_0x4e1999[_0x9f2d('0x54')]=_0x3f1cca;_0x4e1999[_0x9f2d('0x17')]=_0x4e1999[_0x9f2d('0x55')];_0x4e1999['interface']=_0x4e1999['channelAgent'];_0x4e1999[_0x9f2d('0x56')]='voice';if(_0x449bd5){_0x4e1999[_0x9f2d('0x57')]=_0x449bd5[_0x9f2d('0x57')];}return _0x4e1999;}exports[_0x9f2d('0x58')]=buildObj;exports['buildAcw']=function(_0xa00d65){var _0x120caa={};_0x120caa[_0x9f2d('0x55')]=_0xa00d65['queue'];_0x120caa[_0x9f2d('0x59')]=_0xa00d65[_0x9f2d('0x46')];_0x120caa['uniqueid']=_0xa00d65[_0x9f2d('0x44')];return _0x120caa;};exports[_0x9f2d('0x5a')]=function(_0x4e92a8){var _0x4bc378=[];for(var _0x4e7cff in _0x4e92a8){if(_0x4e92a8[_0x9f2d('0x27')](_0x4e7cff)){if(!_[_0x9f2d('0x2f')](_0x4e92a8[_0x4e7cff])&&_0x4e92a8[_0x4e7cff][_0x9f2d('0x33')]===_0x9f2d('0x5b')&&_0x4e92a8[_0x4e7cff][_0x9f2d('0x5c')]==='reachable'){_0x4bc378[_0x9f2d('0x5d')](_0x4e92a8[_0x4e7cff]['id']);}}}return _0x4bc378;};exports['getDiff']=function(_0x1181d2){var _0xc1f377=moment()[_0x9f2d('0x5e')](0x0);var _0x1a0943=moment(_0x1181d2)[_0x9f2d('0x5e')](0x0);return _0xc1f377[_0x9f2d('0x5f')](_0x1a0943,_0x9f2d('0x60'));};exports[_0x9f2d('0x61')]=function(_0x177784){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x177784['ContactId'],'ListId':_0x177784['ListId'],'VoiceQueueId':_0x177784[_0x9f2d('0x19')]||undefined,'CampaignId':_0x177784[_0x9f2d('0x62')]||undefined};};exports['filterKey']=function(_0x570a72){if(_0x570a72===_0x9f2d('0x44')||_0x570a72===_0x9f2d('0x63')||_0x570a72==='queue'||_0x570a72===_0x9f2d('0x64')||_0x570a72===_0x9f2d('0x65')||_0x570a72===_0x9f2d('0x66')||_0x570a72===_0x9f2d('0x39')||_0x570a72===_0x9f2d('0x46')||_0x570a72===_0x9f2d('0x43')||_0x570a72==='active'||_0x570a72===_0x9f2d('0x18')||_0x570a72==='scheduledat'||_0x570a72===_0x9f2d('0x49')||_0x570a72==='countcongestionretry'||_0x570a72===_0x9f2d('0x67')||_0x570a72===_0x9f2d('0x68')||_0x570a72===_0x9f2d('0x69')||_0x570a72===_0x9f2d('0x6a')||_0x570a72===_0x9f2d('0x6b')||_0x570a72===_0x9f2d('0x6c')||_0x570a72===_0x9f2d('0x6d')||_0x570a72==='ListId'||_0x570a72==='UserId'||_0x570a72===_0x9f2d('0x19')||_0x570a72==='sipcallid'||_0x570a72===_0x9f2d('0x6e')||_0x570a72===_0x9f2d('0x6f')||_0x570a72===_0x9f2d('0x70')||_0x570a72===_0x9f2d('0x71')||_0x570a72===_0x9f2d('0x72')||_0x570a72===_0x9f2d('0x73')||_0x570a72===_0x9f2d('0x74')||_0x570a72===_0x9f2d('0x75')||_0x570a72==='xmd-dialchannel'||_0x570a72===_0x9f2d('0x76')||_0x570a72===_0x9f2d('0x77')||_0x570a72===_0x9f2d('0x78')||_0x570a72===_0x9f2d('0x79')||_0x570a72===_0x9f2d('0x7a')||_0x570a72===_0x9f2d('0x7b')||_0x570a72===_0x9f2d('0x7c')||_0x570a72==='rtpaudioqosjitter'||_0x570a72===_0x9f2d('0x7d')||_0x570a72===_0x9f2d('0x7e')||_0x570a72===_0x9f2d('0x7f')||_0x570a72===_0x9f2d('0x80')||_0x570a72===_0x9f2d('0x81')||_0x570a72===_0x9f2d('0x7b')||_0x570a72===_0x9f2d('0x7c')||_0x570a72==='rtpaudioqosjitter'||_0x570a72===_0x9f2d('0x7d')||_0x570a72==='rtpaudioqosloss'||_0x570a72===_0x9f2d('0x7f')||_0x570a72===_0x9f2d('0x80')||_0x570a72===_0x9f2d('0x81')||_0x570a72==='bridgepeer'||_0x570a72==='bridgepvtcallid'||_0x570a72==='state'||_0x570a72===_0x9f2d('0x34')){return![];}return!![];};exports[_0x9f2d('0x82')]=function(_0x4c5397,_0x38db8a){var _0x2a1e9f,_0x1c779d,_0x51df89;if(_0x38db8a<=0x0){_0x38db8a=0x1;}_0x2a1e9f=new RegExp(_0x9f2d('0x83')+_0x38db8a+'}$');_0x1c779d=Math[_0x9f2d('0x84')](0xa,_0x38db8a-0x1);_0x51df89=Math[_0x9f2d('0x84')](0xa,_0x38db8a)-0x1;return util[_0x9f2d('0x12')]('%s',_[_0x9f2d('0x85')](_0x4c5397,_0x2a1e9f,_[_0x9f2d('0x86')](_0x1c779d,_0x51df89)));};exports['extractCalleridName']=function(_0xc47800){var _0x40c686=_0xc47800['match'](/"(.*?)"/);return _0x40c686?_0x40c686[0x1]:_0xc47800;};exports[_0x9f2d('0x87')]=function(_0x268b9c){var _0x5656b1=_0x268b9c[_0x9f2d('0x88')](/<(.*?)>/);return _0x5656b1?_0x5656b1[0x1]:_0x268b9c;};function buildNoAnswerEventPayload(_0x104c78,_0x54c5a7){var _0x2ca907=buildObj(_0x104c78,_0x9f2d('0x89'));if(!_['isEmpty'](_0x54c5a7[_0x9f2d('0x8a')])){Object[_0x9f2d('0x8b')](_0x54c5a7[_0x9f2d('0x8a')])[_0x9f2d('0x8c')](function(_0x3ecaee){_0x2ca907[_0x3ecaee[_0x9f2d('0x8d')]()]=_0x54c5a7[_0x9f2d('0x8a')][_0x3ecaee];});}return _0x2ca907;}exports[_0x9f2d('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1d42=['responsetime','logAgent','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','getSeconds','talktime','answertime','isFailure','Failure','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime'];(function(_0x1c47b3,_0x57ae22){var _0x50e877=function(_0x158299){while(--_0x158299){_0x1c47b3['push'](_0x1c47b3['shift']());}};_0x50e877(++_0x57ae22);}(_0x1d42,0xe7));var _0x21d4=function(_0x329fde,_0x2c7da0){_0x329fde=_0x329fde-0x0;var _0x20184c=_0x1d42[_0x329fde];return _0x20184c;};'use strict';var util=require(_0x21d4('0x0'));var _=require('lodash');var moment=require(_0x21d4('0x1'));var logger=require(_0x21d4('0x2'))(_0x21d4('0x3'));var ipAgi=process['env'][_0x21d4('0x4')]||_0x21d4('0x5');var utils=require('../../dialer/utils');exports[_0x21d4('0x6')]=function(_0x2d437d){return function(_0xecfd7f){logger[_0x21d4('0x7')](_0x2d437d,util[_0x21d4('0x8')](_0xecfd7f,{'showHidden':![],'depth':null}));};};exports[_0x21d4('0x9')]=function(_0x29bd11,_0x14debc){logger[_0x21d4('0xa')](_0x29bd11,util['inspect'](_0x14debc,{'showHidden':![],'depth':null}));};exports[_0x21d4('0xb')]=function(_0x21063a,_0x3b5436){logger['error'](_0x21063a,util['inspect'](_0x3b5436,{'showHidden':![],'depth':null}));};exports[_0x21d4('0xc')]=function(_0x3d3372){return function(_0x36529d){logger[_0x21d4('0xa')](_0x3d3372,util['inspect'](_0x36529d,{'showHidden':![],'depth':null}));};};exports[_0x21d4('0xd')]=function(_0xc1e9a1,_0x31a71e,_0x19f0d2){return{'message':_0xc1e9a1,'unlock':_0x31a71e,'active':_0x19f0d2};};exports['getCallerId']=function(_0x345159,_0x85e794,_0x4c2912){if(!_[_0x21d4('0xe')](_0x4c2912)&&_0x21d4('0xf')===typeof _0x4c2912&&!_['isEmpty'](_0x4c2912)){if(!_['isUndefined'](_0x85e794)&&_0x21d4('0xf')===typeof _0x85e794&&!_[_0x21d4('0x10')](_0x85e794)){return util[_0x21d4('0x11')](_0x21d4('0x12'),_0x85e794,_0x4c2912);}return util[_0x21d4('0x11')](_0x21d4('0x12'),_0x4c2912,_0x4c2912);}if(!_[_0x21d4('0xe')](_0x345159)&&_0x21d4('0xf')===typeof _0x345159&&!_[_0x21d4('0x10')](_0x345159)){return _0x345159;}return _0x21d4('0x13');};exports[_0x21d4('0x14')]=function(_0x3e5c6e){if(_[_0x21d4('0x15')](_0x3e5c6e)){return![];}return _0x3e5c6e;};exports[_0x21d4('0x16')]=function(_0x14b605,_0x90758f,_0x4f95e9,_0x30d904,_0x3cc588,_0x589878){var _0x277e7b={'XMD-QUEUE':_0x90758f[_0x21d4('0x17')]?_0x90758f['Queue']['name']:'','XMD-CALLERID':_0x30d904,'XMD-CALLERID-PREVIEW':_0x589878?util[_0x21d4('0x11')](_0x21d4('0x12'),_0x589878[_0x21d4('0x18')],_0x589878[_0x21d4('0x19')]):_0x30d904,'XMD-DIALID':_0x3cc588,'XMD-CONTACTID':_0x90758f['ContactId'],'XMD-CDRTYPE':_0x21d4('0x1a'),'CALLERID(all)':_0x30d904,'XMD-VOICEQUEUEID':_0x90758f[_0x21d4('0x1b')],'XMD-DIALCHANNEL':_0x4f95e9,'XMD-DIALTIMEOUT':_0x14b605[_0x21d4('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x14b605[_0x21d4('0x1d')]?'g':'',_[_0x21d4('0x10')](_0x14b605[_0x21d4('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x14b605[_0x21d4('0x1f')]||'','XMD-AGI':_0x14b605[_0x21d4('0x20')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x14b605[_0x21d4('0x20')]):_0x21d4('0x21'),'XMD-AGIAFTER':_0x14b605[_0x21d4('0x1d')]?util[_0x21d4('0x11')](_0x21d4('0x22'),ipAgi,_0x14b605['dialQueueProject2']):_0x21d4('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x589878?_0x589878[_0x21d4('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x589878?_0x589878[_0x21d4('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x14b605[_0x21d4('0x1e')])){_0x277e7b[util[_0x21d4('0x11')]('%s',_0x21d4('0x25'))]=_0x14b605[_0x21d4('0x1e')];_0x277e7b[util[_0x21d4('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3cc588;}if(_0x90758f&&_0x90758f[_0x21d4('0x26')]){for(var _0x1e9ca5 in _0x90758f[_0x21d4('0x26')]){if(_0x90758f[_0x21d4('0x26')][_0x21d4('0x27')](_0x1e9ca5)){if(!_[_0x21d4('0x15')](_0x90758f[_0x21d4('0x26')][_0x1e9ca5])&&_0x1e9ca5!=='id'&&_0x1e9ca5!==_0x21d4('0x28')&&_0x1e9ca5!==_0x21d4('0x29')&&_0x1e9ca5!=='updatedAt'){_0x277e7b[util[_0x21d4('0x11')](_0x21d4('0x2a'),_0x21d4('0x2b'),_[_0x21d4('0x2c')](_0x1e9ca5))]=_0x90758f[_0x21d4('0x26')][_0x1e9ca5];}}}}return _0x277e7b;};exports[_0x21d4('0x2d')]=function(_0x3ca5d4){var _0x14bfc9={};for(var _0x2d6081 in _0x3ca5d4){if(_0x3ca5d4[_0x21d4('0x27')](_0x2d6081)){_0x14bfc9[util['format']('%s',_[_0x21d4('0x2e')](_0x2d6081))]=_0x3ca5d4[_0x2d6081];}}return{'variables':_0x14bfc9};};exports[_0x21d4('0x2f')]=function(_0x220274,_0x24c2c8){if(!_['isNil'](_0x220274)){if(_0x220274[_0x21d4('0x27')]('originated')){if(_0x220274['originated']>0x0){_0x220274[_0x21d4('0x30')]-=0x1;}else{logger[_0x21d4('0x7')](_0x21d4('0x31'),_0x24c2c8);}}}else{logger[_0x21d4('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x24c2c8);}};exports['logBlacklist']=function(_0x24f0dc){var _0x1e0a4f=moment()['format'](_0x21d4('0x32'));_0x24f0dc[_0x21d4('0x33')]=0xd;_0x24f0dc[_0x21d4('0x34')]=_0x21d4('0x35');_0x24f0dc[_0x21d4('0x36')]=_0x1e0a4f;_0x24f0dc[_0x21d4('0x37')]=_0x1e0a4f;_0x24f0dc['endtime']=_0x1e0a4f;};exports[_0x21d4('0x38')]=function(_0x5ceafb,_0x422d0c,_0x4cb859){var _0xf3bb36=moment()[_0x21d4('0x11')](_0x21d4('0x32'));_0x5ceafb[_0x21d4('0x33')]=_0x422d0c;_0x5ceafb['statedesc']=_0x4cb859;_0x5ceafb[_0x21d4('0x37')]=_0xf3bb36;_0x5ceafb['ringtime']=utils['getSeconds'](_0x5ceafb[_0x21d4('0x37')],_0x5ceafb[_0x21d4('0x36')]);};exports[_0x21d4('0x39')]=function(_0x2fd943,_0x8c97f2,_0x3929cd){_0x2fd943[_0x21d4('0x3a')]=_0x8c97f2;_0x2fd943[_0x21d4('0x3b')]=_0x3929cd;};exports[_0x21d4('0x3c')]=function(_0x15113a,_0x35b9a8,_0x382dae){var _0x12b608=moment()[_0x21d4('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x15113a['state']=_0x35b9a8;_0x15113a[_0x21d4('0x34')]=_0x382dae;_0x15113a[_0x21d4('0x37')]=_0x15113a[_0x21d4('0x37')]?_0x15113a['responsetime']:_0x12b608;_0x15113a[_0x21d4('0x3d')]=_0x15113a[_0x21d4('0x3d')]?_0x15113a['endtime']:_0x12b608;_0x15113a[_0x21d4('0x3e')]=utils[_0x21d4('0x3f')](_0x15113a[_0x21d4('0x37')]||0x0,_0x15113a[_0x21d4('0x36')]||0x0);_0x15113a[_0x21d4('0x40')]=_0x15113a[_0x21d4('0x41')]?utils['getSeconds'](_0x15113a[_0x21d4('0x3d')],_0x15113a[_0x21d4('0x41')]):0x0;};exports[_0x21d4('0x42')]=function(_0x19039e){return _0x19039e===_0x21d4('0x43');};exports['variablesAction']=function(_0x2cabf1,_0x21688b,_0x228912,_0x32e010,_0x21ec41){var _0x4378a9=_0x32e010?_0x21d4('0x44'):_0x2cabf1[_0x21d4('0x18')];_0x4378a9=_0x21ec41?_0x21d4('0x45'):_0x4378a9;return{'actionid':_0x2cabf1['uniqueid'],'action':_0x21d4('0x46'),'channel':_0x2cabf1[_0x21d4('0x47')],'callerid':util[_0x21d4('0x11')]('\x22%s\x22\x20<%s>',_0x4378a9,_0x2cabf1['calleridnum']),'Exten':_0x21d4('0x48'),'Context':_0x21d4('0x49'),'Priority':'1','variable':_0x228912,'timeout':(_0x21688b[_0x21d4('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2cabf1[_0x21d4('0x4b')]};};exports['totalGlobal']=function(_0x236517){return _0x236517[_0x21d4('0x4c')]+_0x236517[_0x21d4('0x4d')]+_0x236517[_0x21d4('0x4e')]+_0x236517[_0x21d4('0x4f')]+_0x236517[_0x21d4('0x50')];};exports['cloneAction']=function(_0x2ad8a1){var _0x4403e0=_['clone'](_0x2ad8a1);_0x4403e0['state']=0xf;_0x4403e0[_0x21d4('0x34')]='Global';return _0x4403e0;};exports['scheduledAt']=function(_0x448288,_0x2282eb,_0x318bcc){var _0x1549f1={};_0x1549f1[_0x2282eb]=_0x448288[_0x2282eb];_0x1549f1['active']=![];_0x1549f1[_0x21d4('0x51')]=moment()[_0x21d4('0x52')](_0x318bcc,_0x21d4('0x53'))[_0x21d4('0x11')](_0x21d4('0x32'));_0x1549f1['ContactId']=_0x448288[_0x21d4('0x54')];_0x1549f1[_0x21d4('0x55')]=_0x448288[_0x21d4('0x55')];_0x1549f1[_0x21d4('0x1b')]=_0x448288[_0x21d4('0x1b')]||undefined;return _0x1549f1;};exports[_0x21d4('0x56')]=function(_0x108e34,_0x1f5a22){if(!_[_0x21d4('0x15')](_0x108e34)){if(_0x108e34[_0x21d4('0x57')]>0x0){_0x108e34[_0x21d4('0x57')]-=0x1;}else{logger[_0x21d4('0x7')](_0x1f5a22,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x1f5a22,_0x21d4('0x58'));}};exports[_0x21d4('0x59')]=function(_0xb31ac7){if(_0xb31ac7<=0x0){return!![];}return![];};function buildObj(_0x35856b,_0x140f01,_0x405a15){_0x35856b[_0x21d4('0x5a')]=_0x140f01;_0x35856b[_0x21d4('0x5b')]=_0x35856b[_0x21d4('0x5c')];_0x35856b[_0x21d4('0x5d')]=_0x35856b[_0x21d4('0x47')];_0x35856b[_0x21d4('0x5e')]=_0x21d4('0x5f');if(_0x405a15){_0x35856b[_0x21d4('0x60')]=_0x405a15[_0x21d4('0x60')];}return _0x35856b;}exports[_0x21d4('0x61')]=buildObj;exports['buildAcw']=function(_0x4d572f){var _0x4bbf48={};_0x4bbf48['queue']=_0x4d572f[_0x21d4('0x5c')];_0x4bbf48['interface']=_0x4d572f[_0x21d4('0x47')];_0x4bbf48[_0x21d4('0x4b')]=_0x4d572f[_0x21d4('0x4b')];return _0x4bbf48;};exports[_0x21d4('0x62')]=function(_0x5789be){var _0x1d4ffe=[];for(var _0x3d9618 in _0x5789be){if(_0x5789be['hasOwnProperty'](_0x3d9618)){if(!_[_0x21d4('0x15')](_0x5789be[_0x3d9618])&&_0x5789be[_0x3d9618][_0x21d4('0x33')]===_0x21d4('0x63')&&_0x5789be[_0x3d9618][_0x21d4('0x64')]===_0x21d4('0x65')){_0x1d4ffe[_0x21d4('0x66')](_0x5789be[_0x3d9618]['id']);}}}return _0x1d4ffe;};exports[_0x21d4('0x67')]=function(_0x55d8f1){var _0x1986bd=moment()[_0x21d4('0x68')](0x0);var _0x33b41d=moment(_0x55d8f1)[_0x21d4('0x68')](0x0);return _0x1986bd[_0x21d4('0x69')](_0x33b41d,'seconds');};exports[_0x21d4('0x6a')]=function(_0x2731fd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2731fd['ContactId'],'ListId':_0x2731fd[_0x21d4('0x55')],'VoiceQueueId':_0x2731fd[_0x21d4('0x1b')]||undefined,'CampaignId':_0x2731fd['CampaignId']||undefined};};exports[_0x21d4('0x6b')]=function(_0x193ae2){if(_0x193ae2==='uniqueid'||_0x193ae2===_0x21d4('0x6c')||_0x193ae2===_0x21d4('0x5c')||_0x193ae2===_0x21d4('0x6d')||_0x193ae2===_0x21d4('0x6e')||_0x193ae2===_0x21d4('0x6f')||_0x193ae2===_0x21d4('0x3a')||_0x193ae2===_0x21d4('0x47')||_0x193ae2==='calleridname'||_0x193ae2==='active'||_0x193ae2===_0x21d4('0x19')||_0x193ae2===_0x21d4('0x51')||_0x193ae2===_0x21d4('0x4c')||_0x193ae2===_0x21d4('0x4d')||_0x193ae2===_0x21d4('0x4e')||_0x193ae2===_0x21d4('0x70')||_0x193ae2==='callback'||_0x193ae2===_0x21d4('0x71')||_0x193ae2===_0x21d4('0x72')||_0x193ae2==='recallme'||_0x193ae2===_0x21d4('0x54')||_0x193ae2===_0x21d4('0x55')||_0x193ae2===_0x21d4('0x3b')||_0x193ae2===_0x21d4('0x1b')||_0x193ae2===_0x21d4('0x73')||_0x193ae2===_0x21d4('0x74')||_0x193ae2==='xmd-queue'||_0x193ae2==='xmd-phone'||_0x193ae2===_0x21d4('0x75')||_0x193ae2==='xmd-dialurl'||_0x193ae2==='xmd-dialtimeout'||_0x193ae2==='xmd-dialoptions'||_0x193ae2===_0x21d4('0x76')||_0x193ae2===_0x21d4('0x77')||_0x193ae2===_0x21d4('0x78')||_0x193ae2===_0x21d4('0x79')||_0x193ae2==='xmd-callerid'||_0x193ae2===_0x21d4('0x7a')||_0x193ae2==='xmd-agi'||_0x193ae2===_0x21d4('0x7b')||_0x193ae2===_0x21d4('0x7c')||_0x193ae2===_0x21d4('0x7d')||_0x193ae2==='rtpaudioqosjitterbridged'||_0x193ae2===_0x21d4('0x7e')||_0x193ae2===_0x21d4('0x7f')||_0x193ae2===_0x21d4('0x80')||_0x193ae2===_0x21d4('0x81')||_0x193ae2==='rtpaudioqos'||_0x193ae2===_0x21d4('0x7c')||_0x193ae2===_0x21d4('0x7d')||_0x193ae2===_0x21d4('0x82')||_0x193ae2===_0x21d4('0x7e')||_0x193ae2==='rtpaudioqoslossbridged'||_0x193ae2==='rtpaudioqosrtt'||_0x193ae2==='rtpaudioqosrttbridged'||_0x193ae2===_0x21d4('0x83')||_0x193ae2==='bridgepvtcallid'||_0x193ae2===_0x21d4('0x33')||_0x193ae2===_0x21d4('0x34')){return![];}return!![];};exports[_0x21d4('0x84')]=function(_0x2e59b2,_0x39a0a9){var _0x32af9a,_0x259c3f,_0xf17651;if(_0x39a0a9<=0x0){_0x39a0a9=0x1;}_0x32af9a=new RegExp(_0x21d4('0x85')+_0x39a0a9+'}$');_0x259c3f=Math[_0x21d4('0x86')](0xa,_0x39a0a9-0x1);_0xf17651=Math['pow'](0xa,_0x39a0a9)-0x1;return util[_0x21d4('0x11')]('%s',_['replace'](_0x2e59b2,_0x32af9a,_[_0x21d4('0x87')](_0x259c3f,_0xf17651)));};exports[_0x21d4('0x88')]=function(_0x28dfcb){var _0x6ec6dd=_0x28dfcb[_0x21d4('0x89')](/"(.*?)"/);return _0x6ec6dd?_0x6ec6dd[0x1]:_0x28dfcb;};exports[_0x21d4('0x8a')]=function(_0x5d9f72){var _0x2ce258=_0x5d9f72[_0x21d4('0x89')](/<(.*?)>/);return _0x2ce258?_0x2ce258[0x1]:_0x5d9f72;};function buildNoAnswerEventPayload(_0x3eb060,_0x34cd89){var _0x4303e1=buildObj(_0x3eb060,'noanswer');if(!_[_0x21d4('0x10')](_0x34cd89[_0x21d4('0x8b')])){Object['keys'](_0x34cd89['variables'])[_0x21d4('0x8c')](function(_0x4b5baa){_0x4303e1[_0x4b5baa[_0x21d4('0x8d')]()]=_0x34cd89[_0x21d4('0x8b')][_0x4b5baa];});}return _0x4303e1;}exports[_0x21d4('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 01d4cd6..c49cb84 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 _0xc442=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string'];(function(_0x555b87,_0x58ddfd){var _0x3f106f=function(_0x3e02ef){while(--_0x3e02ef){_0x555b87['push'](_0x555b87['shift']());}};_0x3f106f(++_0x58ddfd);}(_0xc442,0x8f));var _0x2c44=function(_0x5c2360,_0x1d13e0){_0x5c2360=_0x5c2360-0x0;var _0x4e26f0=_0xc442[_0x5c2360];return _0x4e26f0;};'use strict';exports['queueadd']={'queue':{'type':_0x2c44('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x2c44('0x0'),'required':!![]},'penalty':{'type':_0x2c44('0x1'),'required':![]},'paused':{'type':_0x2c44('0x2'),'required':![]}};exports[_0x2c44('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x2c44('0x0'),'required':!![]},'paused':{'type':_0x2c44('0x2')},'reason':{'type':'string','required':![]}};exports[_0x2c44('0x4')]={'module':{'type':'string','required':![]}};exports[_0x2c44('0x5')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]}};exports[_0x2c44('0x6')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]},'filename':{'type':_0x2c44('0x0')},'format':{'type':_0x2c44('0x0')},'mixmonitorid':{'type':_0x2c44('0x0')}};exports[_0x2c44('0x7')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]}};exports[_0x2c44('0x8')]={'uniqueid':{'type':_0x2c44('0x0'),'required':!![]},'exten':{'type':_0x2c44('0x0'),'required':!![]},'context':{'type':_0x2c44('0x0')}}; \ No newline at end of file +var _0x2993=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queueremove'];(function(_0x34bf49,_0x53a588){var _0x3fbca6=function(_0x3f001e){while(--_0x3f001e){_0x34bf49['push'](_0x34bf49['shift']());}};_0x3fbca6(++_0x53a588);}(_0x2993,0x91));var _0x3299=function(_0x3497e2,_0x24c992){_0x3497e2=_0x3497e2-0x0;var _0x1cba36=_0x2993[_0x3497e2];return _0x1cba36;};'use strict';exports[_0x3299('0x0')]={'queue':{'type':_0x3299('0x1'),'required':!![]},'interface':{'type':_0x3299('0x1'),'required':!![]},'membername':{'type':_0x3299('0x1'),'required':!![]},'penalty':{'type':_0x3299('0x2'),'required':![]},'paused':{'type':_0x3299('0x3'),'required':![]}};exports[_0x3299('0x4')]={'queue':{'type':_0x3299('0x1'),'required':!![]},'interface':{'type':_0x3299('0x1'),'required':!![]}};exports[_0x3299('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x3299('0x3')},'reason':{'type':_0x3299('0x1'),'required':![]}};exports[_0x3299('0x6')]={'module':{'type':_0x3299('0x1'),'required':![]}};exports[_0x3299('0x7')]={'uniqueid':{'type':_0x3299('0x1'),'required':!![]}};exports[_0x3299('0x8')]={'uniqueid':{'type':_0x3299('0x1'),'required':!![]},'filename':{'type':_0x3299('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x3299('0x9')]={'uniqueid':{'type':_0x3299('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x3299('0x1'),'required':!![]},'exten':{'type':_0x3299('0x1'),'required':!![]},'context':{'type':_0x3299('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 677c4b4..b7aa899 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x0b0e[_0x311aad];return _0x1779bd;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0xb8c29a,_0x3c1efd){var _0x27efd3=function(_0x2b01a7){while(--_0x2b01a7){_0xb8c29a['push'](_0xb8c29a['shift']());}};_0x27efd3(++_0x3c1efd);}(_0xdb28,0x106));var _0x8db2=function(_0x42f52b,_0x1285af){_0x42f52b=_0x42f52b-0x0;var _0x29d676=_0xdb28[_0x42f52b];return _0x29d676;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 84ac366..0c4ebba 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ed6=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x5d85f6,_0x392ce4){var _0xf1f85d=function(_0x4ffdfe){while(--_0x4ffdfe){_0x5d85f6['push'](_0x5d85f6['shift']());}};_0xf1f85d(++_0x392ce4);}(_0x5ed6,0x152));var _0x65ed=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x5ed6[_0x256e32];return _0x464070;};'use strict';function mergeDBDataToRealtime(_0x100ef2,_0x1b2c91){var _0x1b12dd=Object[_0x65ed('0x0')]({},_0x100ef2);for(var _0x1588ac in _0x1b2c91){if(_0x1b12dd[_0x65ed('0x1')](_0x1588ac)){_0x1b12dd[_0x1588ac]=_0x1b2c91[_0x1588ac];}}return _0x1b12dd;}exports[_0x65ed('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x3861=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3861,0x140));var _0x1386=function(_0x4e9703,_0xe94f21){_0x4e9703=_0x4e9703-0x0;var _0x321bc2=_0x3861[_0x4e9703];return _0x321bc2;};'use strict';function mergeDBDataToRealtime(_0x164ebb,_0x1e2d8f){var _0x4525fc=Object['assign']({},_0x164ebb);for(var _0xbc1a37 in _0x1e2d8f){if(_0x4525fc[_0x1386('0x0')](_0xbc1a37)){_0x4525fc[_0xbc1a37]=_0x1e2d8f[_0xbc1a37];}}return _0x4525fc;}exports[_0x1386('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9fdc9cc..21564f4 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 _0xc07a=['realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','SIP/%s','length','findAgent','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','callerid','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinenum','connectedlinename','xcally-motion-dialer','isArray','create','startsWith','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport'];(function(_0x2e28e6,_0x1b062b){var _0x1871dd=function(_0x5b63ff){while(--_0x5b63ff){_0x2e28e6['push'](_0x2e28e6['shift']());}};_0x1871dd(++_0x1b062b);}(_0xc07a,0x15c));var _0xac07=function(_0x39dc14,_0x175dae){_0x39dc14=_0x39dc14-0x0;var _0x4d7da1=_0xc07a[_0x39dc14];return _0x4d7da1;};'use strict';var _=require(_0xac07('0x0'));var moment=require(_0xac07('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xac07('0x2'));var RpcVoiceAgentReport=require(_0xac07('0x3'));var RpcVoiceCallReport=require(_0xac07('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xac07('0x5'));var RpcVoiceRecording=require(_0xac07('0x6'));var RpcVoiceTransferReport=require(_0xac07('0x7'));var VoiceQueueReport=require(_0xac07('0x8'));var VoiceCallReport=require(_0xac07('0x9'));var VoiceAgentReport=require(_0xac07('0xa'));var VoiceDialReport=require(_0xac07('0xb'));var UserReport=require('./userReport');function Report(_0x8fcfd0){this[_0xac07('0xc')]=_0x8fcfd0;this[_0xac07('0xd')]=_0x8fcfd0[_0xac07('0xd')];this['telephones']=_0x8fcfd0[_0xac07('0xe')];}Report[_0xac07('0xf')]['sync']=function(_0x47eb42){var _0x16267e=new VoiceQueueReport(this[_0xac07('0xc')]);var _0x3d3be3=new VoiceAgentReport(this['realtime']);var _0x3e0c57=new VoiceDialReport(this[_0xac07('0xc')]);var _0x2bb938=new VoiceCallReport(this['realtime']);var _0x280ac7=new UserReport(this[_0xac07('0xc')]);if(config[_0xac07('0x10')]&&config['xdr'][_0xac07('0x11')]){ami['on']('custom:voiceQueueReport',this[_0xac07('0x12')]['bind'](this));ami['on'](_0xac07('0x13'),this[_0xac07('0x14')][_0xac07('0x15')](this));ami['on'](_0xac07('0x16'),this[_0xac07('0x17')][_0xac07('0x15')](this));ami['on'](_0xac07('0x18'),this[_0xac07('0x19')]['bind'](this));ami['on'](_0xac07('0x1a'),this['blindTransfer'][_0xac07('0x15')](this));ami['on'](_0xac07('0x1b'),this[_0xac07('0x1c')][_0xac07('0x15')](this));}};Report[_0xac07('0xf')]['findAgent']=function(_0x3c524a){var _0x535997;_0x535997=_[_0xac07('0x1d')](this[_0xac07('0xd')],function(_0x51b74c){return _0x51b74c[_0xac07('0x1e')]==_0x3c524a||_0x51b74c[_0xac07('0x1f')]==_0x3c524a;});if(_[_0xac07('0x20')](_0x535997)){var _0x279c2e=_[_0xac07('0x1d')](this[_0xac07('0xe')],function(_0x544a8b){return _0x544a8b[_0xac07('0x1e')]==_0x3c524a||_0x544a8b[_0xac07('0x1f')]==_0x3c524a;});if(_0x279c2e){_0x535997=_[_0xac07('0x1d')](this['agents'],function(_0xdb4a14){return _0xdb4a14[_0xac07('0x21')]==util[_0xac07('0x22')](_0xac07('0x23'),_0x279c2e[_0xac07('0x1f')]);});}}return _0x535997;};Report[_0xac07('0xf')][_0xac07('0x12')]=function(_0x35b894){for(var _0x2400a9=0x0;_0x2400a9<_0x35b894[_0xac07('0x24')];_0x2400a9+=0x1){var _0x2e483d=this[_0xac07('0x25')](_0x35b894[_0x2400a9]['connectedlinenum']);if(_0x2e483d){_0x35b894[_0x2400a9]['accountcode']=_0x2e483d[_0xac07('0x1e')];_0x35b894[_0x2400a9][_0xac07('0x26')]=!![];_0x35b894[_0x2400a9][_0xac07('0x27')]=_0x2e483d[_0xac07('0x1f')];_0x35b894[_0x2400a9][_0xac07('0x21')]=_[_0xac07('0x20')](_0x2e483d[_0xac07('0x21')])?util[_0xac07('0x22')](_0xac07('0x23'),_0x2e483d[_0xac07('0x1f')]):_0x2e483d[_0xac07('0x21')];if(_0x35b894[_0x2400a9]['queuecallercomplete']){_0x35b894[_0x2400a9][_0xac07('0x28')]=moment()[_0xac07('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x35b894[_0x2400a9]['queuecallerexit']){_0x35b894[_0x2400a9]['queuecallerexitAt']=moment()['format'](_0xac07('0x29'));}RpcMemberReport['voiceQueueReport'](_0x35b894[_0x2400a9]);}RpcVoiceQueueReport['create'](_0x35b894[_0x2400a9]);}};function extractCalleridNumber(_0x537a20){var _0x5c17d9=_0x537a20[_0xac07('0x2a')](/<(.*?)>/);return _0x5c17d9?_0x5c17d9[0x1]:_0x537a20;}Report[_0xac07('0xf')][_0xac07('0x2b')]=function(_0x21f381){for(var _0x5a7734=0x0;_0x5a7734',_0x571b79[_0xac07('0x41')],_0x571b79[_0xac07('0x3e')]);}if(RpcVoiceTransferReport[_0xac07('0x42')][_0x571b79[_0xac07('0x43')]]){var _0x35ffbf=RpcVoiceTransferReport['transfers'][_0x571b79['linkedid']];_0x35ffbf[_0xac07('0x44')]=_0x571b79[_0xac07('0x45')];RpcVoiceTransferReport[_0xac07('0x46')](_0x35ffbf);delete RpcVoiceTransferReport['transfers'][_0x571b79[_0xac07('0x43')]];}if(_[_0xac07('0x20')](_0x571b79['type'])){_0x571b79[_0xac07('0x47')]=this['getCallType'](_0x571b79);}if(_[_0xac07('0x20')](_0x571b79[_0xac07('0x48')])){var _0x7a116d=_0x571b79[_0xac07('0x3d')][_0xac07('0x2e')]('-')[0x0];var _0x14c8ef=this[_0xac07('0xd')][_0x7a116d];if(!_0x14c8ef)_0x14c8ef=this[_0xac07('0x2b')](_0x571b79[_0xac07('0x1e')]);if(_0x14c8ef){_0x571b79['UserId']=_0x14c8ef['id'];_0x571b79[_0xac07('0x49')]=_0x14c8ef['name'];}}RpcVoiceCallReport['create'](_0x571b79);if(_0x571b79['monitor']){for(var _0x49bca5=0x0;_0x49bca5<_0x571b79[_0xac07('0x4a')][_0xac07('0x24')];_0x49bca5+=0x1){_0x571b79[_0xac07('0x4b')]=_0x571b79[_0xac07('0x4a')][_0x49bca5][_0xac07('0x4c')];_0x571b79['createdAt']=_0x571b79[_0xac07('0x4a')][_0x49bca5][_0xac07('0x4d')];if(_0x571b79[_0xac07('0x32')]==_0xac07('0x39')){_0x571b79[_0xac07('0x3e')]=_0x571b79['connectedlinenum'];_0x571b79[_0xac07('0x41')]=_0x571b79['connectedlinename'];_0x571b79[_0xac07('0x4e')]=_0x571b79['accountcode'];_0x571b79[_0xac07('0x4f')]=_0x571b79['membername'];_0x571b79['exten']=_0x571b79['originatecalleridnum'];}else if(_0x571b79[_0xac07('0x32')]==_0xac07('0x50')){_0x571b79[_0xac07('0x3e')]=_0x571b79[_0xac07('0x31')];_0x571b79[_0xac07('0x32')]=_0x571b79['originatecalleridnum'];}RpcVoiceRecording['create'](_0x571b79);}}};Report[_0xac07('0xf')]['voiceAgentReport']=function(_0xe16f95){if(_[_0xac07('0x51')](_0xe16f95)){_0xe16f95['forEach'](function(_0x45a33b){RpcVoiceAgentReport['create'](_0x45a33b);});}else{RpcVoiceAgentReport[_0xac07('0x52')](_0xe16f95);}};Report[_0xac07('0xf')][_0xac07('0x19')]=function(_0x45ccd0){RpcVoiceDialReport[_0xac07('0x52')](_0x45ccd0);var _0x42f8e5;var _0x5ccb3f;var _0xc49b51=_0x45ccd0[_0xac07('0x3d')];if(_[_0xac07('0x53')](_0xc49b51,'Local')){_0x5ccb3f=_0xc49b51['substring'](_0xc49b51[_0xac07('0x54')]('/')+0x1,_0xc49b51['indexOf']('@'));_0x42f8e5=_[_0xac07('0x1d')](this[_0xac07('0xd')],function(_0x3ea655){return _0x3ea655[_0xac07('0x55')]==_0x5ccb3f||_0x3ea655[_0xac07('0x56')]==_0x5ccb3f||_0x3ea655[_0xac07('0x1e')]==_0x5ccb3f;});}else{_0x5ccb3f=_0xc49b51['substring'](_0xc49b51[_0xac07('0x54')]('/')+0x1,_0xc49b51[_0xac07('0x57')]('-'));_0x42f8e5=this[_0xac07('0x25')](_0x5ccb3f);}if(_0x42f8e5){_0x45ccd0['interface']=_[_0xac07('0x20')](_0x42f8e5['interface'])?util[_0xac07('0x22')]('SIP/%s',_0x42f8e5[_0xac07('0x1f')]):_0x42f8e5[_0xac07('0x21')];_0x45ccd0[_0xac07('0x49')]=_0x42f8e5['name'];_0x45ccd0[_0xac07('0x1e')]=_0x42f8e5['accountcode'];RpcMemberReport['voiceDialReport'](_0x45ccd0);}};Report[_0xac07('0xf')][_0xac07('0x46')]=function(_0x4816d5){RpcVoiceTransferReport[_0xac07('0x42')][_0x4816d5[_0xac07('0x58')]]=_0x4816d5;};Report[_0xac07('0xf')][_0xac07('0x1c')]=function(_0xfd4ce6){RpcVoiceTransferReport['attendedTransfer'](_0xfd4ce6);};module[_0xac07('0x59')]=Report; \ No newline at end of file +var _0x6b8a=['getAgentByInternal','calleridnum','outbound','destination','exten','dialer','lastapplication','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfers','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','filename','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','exports','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','length','connectedlinenum','assigned','lastAssignedTo','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','keys','getCallType','split'];(function(_0x22233a,_0x2cbae0){var _0x538bfb=function(_0x1046bc){while(--_0x1046bc){_0x22233a['push'](_0x22233a['shift']());}};_0x538bfb(++_0x2cbae0);}(_0x6b8a,0xe4));var _0xa6b8=function(_0x2563e,_0x386f0f){_0x2563e=_0x2563e-0x0;var _0x554e15=_0x6b8a[_0x2563e];return _0x554e15;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa6b8('0x0'));var config=require(_0xa6b8('0x1'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa6b8('0x2'));var RpcVoiceCallReport=require(_0xa6b8('0x3'));var RpcVoiceDialReport=require(_0xa6b8('0x4'));var RpcMemberReport=require(_0xa6b8('0x5'));var RpcVoiceQueueReport=require(_0xa6b8('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xa6b8('0x7'));var VoiceQueueReport=require(_0xa6b8('0x8'));var VoiceCallReport=require(_0xa6b8('0x9'));var VoiceAgentReport=require(_0xa6b8('0xa'));var VoiceDialReport=require(_0xa6b8('0xb'));var UserReport=require(_0xa6b8('0xc'));function Report(_0x5253ca){this['realtime']=_0x5253ca;this[_0xa6b8('0xd')]=_0x5253ca[_0xa6b8('0xd')];this[_0xa6b8('0xe')]=_0x5253ca[_0xa6b8('0xe')];}Report[_0xa6b8('0xf')]['sync']=function(_0x64add6){var _0x54646f=new VoiceQueueReport(this[_0xa6b8('0x10')]);var _0x5a0d81=new VoiceAgentReport(this['realtime']);var _0xb0e034=new VoiceDialReport(this[_0xa6b8('0x10')]);var _0x331f61=new VoiceCallReport(this[_0xa6b8('0x10')]);var _0x45e782=new UserReport(this[_0xa6b8('0x10')]);if(config['xdr']&&config[_0xa6b8('0x11')][_0xa6b8('0x12')]){ami['on'](_0xa6b8('0x13'),this[_0xa6b8('0x14')][_0xa6b8('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xa6b8('0x16')]['bind'](this));ami['on'](_0xa6b8('0x17'),this[_0xa6b8('0x18')][_0xa6b8('0x15')](this));ami['on'](_0xa6b8('0x19'),this[_0xa6b8('0x1a')][_0xa6b8('0x15')](this));ami['on']('blindtransfer',this[_0xa6b8('0x1b')][_0xa6b8('0x15')](this));ami['on'](_0xa6b8('0x1c'),this[_0xa6b8('0x1d')]['bind'](this));}};Report[_0xa6b8('0xf')][_0xa6b8('0x1e')]=function(_0x456f35){var _0x55cbff;_0x55cbff=_[_0xa6b8('0x1f')](this['agents'],function(_0x79ee89){return _0x79ee89[_0xa6b8('0x20')]==_0x456f35||_0x79ee89[_0xa6b8('0x21')]==_0x456f35;});if(_[_0xa6b8('0x22')](_0x55cbff)){var _0x1c5557=_[_0xa6b8('0x1f')](this[_0xa6b8('0xe')],function(_0x3db8b2){return _0x3db8b2['accountcode']==_0x456f35||_0x3db8b2[_0xa6b8('0x21')]==_0x456f35;});if(_0x1c5557){_0x55cbff=_[_0xa6b8('0x1f')](this['agents'],function(_0x3a4c86){return _0x3a4c86['interface']==util[_0xa6b8('0x23')]('SIP/%s',_0x1c5557[_0xa6b8('0x21')]);});}}return _0x55cbff;};Report[_0xa6b8('0xf')][_0xa6b8('0x14')]=function(_0x57ed6f){for(var _0x46b9e4=0x0;_0x46b9e4<_0x57ed6f[_0xa6b8('0x24')];_0x46b9e4+=0x1){var _0x329087=this['findAgent'](_0x57ed6f[_0x46b9e4][_0xa6b8('0x25')]);if(_0x329087){_0x57ed6f[_0x46b9e4][_0xa6b8('0x20')]=_0x329087[_0xa6b8('0x20')];_0x57ed6f[_0x46b9e4][_0xa6b8('0x26')]=!![];_0x57ed6f[_0x46b9e4][_0xa6b8('0x27')]=_0x329087[_0xa6b8('0x21')];_0x57ed6f[_0x46b9e4]['interface']=_[_0xa6b8('0x22')](_0x329087[_0xa6b8('0x28')])?util[_0xa6b8('0x23')](_0xa6b8('0x29'),_0x329087[_0xa6b8('0x21')]):_0x329087[_0xa6b8('0x28')];if(_0x57ed6f[_0x46b9e4][_0xa6b8('0x2a')]){_0x57ed6f[_0x46b9e4][_0xa6b8('0x2b')]=moment()[_0xa6b8('0x23')](_0xa6b8('0x2c'));}if(_0x57ed6f[_0x46b9e4][_0xa6b8('0x2d')]){_0x57ed6f[_0x46b9e4][_0xa6b8('0x2e')]=moment()[_0xa6b8('0x23')](_0xa6b8('0x2c'));}RpcMemberReport[_0xa6b8('0x14')](_0x57ed6f[_0x46b9e4]);}RpcVoiceQueueReport[_0xa6b8('0x2f')](_0x57ed6f[_0x46b9e4]);}};function extractCalleridNumber(_0x108143){var _0x3a049e=_0x108143['match'](/<(.*?)>/);return _0x3a049e?_0x3a049e[0x1]:_0x108143;}Report[_0xa6b8('0xf')]['getAgentByInternal']=function(_0x20244d){for(var _0x38a1ff=0x0;_0x38a1ff0x0?!![]:![];if(!_0x5618a5){return this[_0x237b('0x17')](this['summary'][_0x237b('0x6c')]);}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x6d')]=function(_0x3d35fa){var _0x496bf8=this[_0x237b('0x45')]['id'];if(this['summary'][_0x237b('0x61')][_0x496bf8]&&this[_0x237b('0x45')]['queuestatus'][_0x496bf8][_0x3d35fa[_0x237b('0x5f')]]){this[_0x237b('0x45')][_0x237b('0x61')][_0x496bf8][_0x3d35fa[_0x237b('0x5f')]][_0x237b('0x11')]['push'](_0x3d35fa);}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x15')]=function(_0x585c39){var _0x40344b=this;try{if(this[_0x237b('0x59')](_0x585c39)&&this[_0x237b('0x59')](_0x585c39['queue'])){logger[_0x237b('0x54')](_0x237b('0x6e'),util[_0x237b('0x3f')](_0x585c39,{'showHidden':![],'depth':null}));var _0x133b38=this[_0x237b('0x12')][_0x585c39[_0x237b('0x4c')]];if(_0x133b38){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x133b38[_0x237b('0x57')]);this[_0x237b('0x45')][_0x237b('0x5b')][_0x133b38['name']]={'summaryEvent':_0x585c39};this[_0x237b('0x45')][_0x237b('0x6b')]+=0x1;return ami['Action']({'action':_0x237b('0x61'),'queue':_0x133b38['name']})['then'](function(_0x1d06f1){if(!_0x40344b['summary'][_0x237b('0x61')][_0x585c39[_0x237b('0x5f')]]){_0x40344b[_0x237b('0x45')][_0x237b('0x61')][_0x585c39['actionid']]={};}_0x40344b[_0x237b('0x45')][_0x237b('0x61')][_0x585c39[_0x237b('0x5f')]][_0x1d06f1[_0x237b('0x5f')]]={'queue':_0x133b38['name'],'agents':[]};})[_0x237b('0x3c')](function(_0x5a1ed1){throw _0x5a1ed1;});}}}catch(_0x1d0fe8){logger['error'](_0x237b('0x62'),util['inspect'](_0x1d0fe8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0x17')]=function(_0x178f36){if(this[_0x237b('0x45')][_0x237b('0x6b')]>0x0){this[_0x237b('0x45')][_0x237b('0x6c')]=_0x178f36;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x237b('0x3f')](_0x178f36,{'showHidden':![],'depth':null}));this[_0x237b('0x45')]=initializeSummary();ami[_0x237b('0x48')](_0x237b('0x6f'),{});};VoiceQueueReport['prototype'][_0x237b('0x1c')]=function(_0x46ca1c){try{if(this[_0x237b('0x59')](_0x46ca1c)){logger['debug'](_0x237b('0x70'),_0x46ca1c[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x46ca1c,{'showHidden':![],'depth':null}));if(_[_0x237b('0x71')](this[_0x237b('0xf')][_0x46ca1c[_0x237b('0x4a')]])){this['queueReports'][_0x46ca1c[_0x237b('0x4a')]]=[];}if(_[_0x237b('0x71')](this[_0x237b('0x37')][_0x46ca1c['uniqueid']])){this[_0x237b('0x37')][_0x46ca1c[_0x237b('0x4a')]]={};}var _0x1c390d=new QueueReport();_0x1c390d[_0x237b('0x4c')]=_0x46ca1c[_0x237b('0x4c')];_0x1c390d[_0x237b('0x52')]=this[_0x237b('0x12')][_0x1c390d[_0x237b('0x4c')]]&&this[_0x237b('0x12')][_0x1c390d['queue']][_0x237b('0x52')]?this[_0x237b('0x12')][_0x1c390d[_0x237b('0x4c')]]['type']||_0x237b('0x53'):'inbound';_0x1c390d['queuecallerjoinAt']=moment()['format'](_0x237b('0x72'));_0x1c390d['position']=_0x46ca1c[_0x237b('0x73')];_0x1c390d[_0x237b('0x74')]=_0x46ca1c[_0x237b('0x74')];_0x1c390d['uniqueid']=_0x46ca1c[_0x237b('0x4a')];_0x1c390d[_0x237b('0x75')]=this[_0x237b('0x37')][_0x46ca1c['uniqueid']]['routealias'];logger[_0x237b('0x76')](_0x237b('0x77'),_0x1c390d[_0x237b('0x4c')],_0x1c390d[_0x237b('0x52')]);_[_0x237b('0x78')](_0x1c390d,_[_0x237b('0x79')](_0x46ca1c,_['keys'](_0x1c390d)));this[_0x237b('0xf')][_0x46ca1c[_0x237b('0x4a')]][_0x237b('0x7a')](_0x1c390d);this['channels'][_0x46ca1c['uniqueid']]=_0x1c390d;this[_0x237b('0x7b')](_0x1c390d,_0x237b('0x1b'));}}catch(_0x2dcf0f){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x46ca1c[_0x237b('0x4a')],util['inspect'](_0x2dcf0f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x1e')]=function(_0x3b29f6){try{if(this['isNotNull'](_0x3b29f6)){logger[_0x237b('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3b29f6[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x3b29f6,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3b29f6[_0x237b('0x4a')]]){var _0x1ba1b0=_[_0x237b('0x7c')](this['queueReports'][_0x3b29f6[_0x237b('0x4a')]]);_0x1ba1b0[_0x237b('0x7d')]=![];_0x1ba1b0[_0x237b('0x7e')]=null;_0x1ba1b0['holdtime']=_0x3b29f6['holdtime'];_0x1ba1b0[_0x237b('0x7f')]=_0x3b29f6[_0x237b('0x7f')];_0x1ba1b0[_0x237b('0x1d')]=!![];_0x1ba1b0[_0x237b('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1ba1b0[_0x237b('0x81')]=_0x237b('0x82');_0x1ba1b0[_0x237b('0x83')]=null;logger[_0x237b('0x76')](_0x237b('0x84'),_0x1ba1b0[_0x237b('0x4c')],_0x1ba1b0[_0x237b('0x52')]);this['channels'][_0x3b29f6[_0x237b('0x4a')]]=_0x1ba1b0;this[_0x237b('0x46')](_0x1ba1b0,_0x237b('0x1d'));}}}catch(_0x71d4ee){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x3b29f6[_0x237b('0x4a')],util['inspect'](_0x71d4ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x85')]=function(_0x4883ef){try{if(this[_0x237b('0x59')](_0x4883ef)){logger[_0x237b('0x54')](_0x237b('0x86'),_0x4883ef['uniqueid'],util[_0x237b('0x3f')](_0x4883ef,{'showHidden':![],'depth':null}));if(this[_0x237b('0xf')][_0x4883ef[_0x237b('0x4a')]]){var _0x481a50=_['last'](this[_0x237b('0xf')][_0x4883ef['uniqueid']]);_0x481a50[_0x237b('0x87')]=moment()['format'](_0x237b('0x72'));_0x481a50[_0x237b('0x88')]=_0x4883ef[_0x237b('0x88')];_0x481a50[_0x237b('0x89')]=_0x4883ef[_0x237b('0x89')];logger[_0x237b('0x76')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x481a50[_0x237b('0x4c')],_0x481a50['type'],_0x4883ef[_0x237b('0x88')],_0x4883ef[_0x237b('0x89')]);this[_0x237b('0x37')][_0x4883ef[_0x237b('0x4a')]]=_0x481a50;this['emitVoiceQueueChannelSave'](_0x481a50,_0x237b('0x1f'));}}}catch(_0x3ce223){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4883ef[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x3ce223,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0x23')]=function(_0x1ba630){try{if(this[_0x237b('0x59')](_0x1ba630)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x1ba630[_0x237b('0x4a')],util['inspect'](_0x1ba630,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1ba630[_0x237b('0x4a')]]){var _0x1c5b50=_[_0x237b('0x7c')](this[_0x237b('0xf')][_0x1ba630[_0x237b('0x4a')]]);_0x1c5b50[_0x237b('0x7d')]=!![];_0x1c5b50[_0x237b('0x81')]=_0x237b('0x8a');logger[_0x237b('0x76')](_0x237b('0x8b'),_0x1c5b50['queue'],_0x1c5b50[_0x237b('0x52')]);}}}catch(_0xfcf100){logger[_0x237b('0x3d')](_0x237b('0x8c'),_0x1ba630[_0x237b('0x4a')],util[_0x237b('0x3f')](_0xfcf100,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0x21')]=function(_0x1524de){try{if(this['isNotNull'](_0x1524de)){logger[_0x237b('0x54')](_0x237b('0x8d'),_0x1524de['uniqueid'],util['inspect'](_0x1524de,{'showHidden':![],'depth':null}));if(this[_0x237b('0xf')][_0x1524de[_0x237b('0x4a')]]){var _0x22adfd=_[_0x237b('0x7c')](this[_0x237b('0xf')][_0x1524de['uniqueid']]);_0x22adfd[_0x237b('0x1d')]=![];_0x22adfd['queuecallerabandonAt']=null;_0x22adfd['assigned']=!![];_0x22adfd[_0x237b('0x83')]=_0x1524de['membername'];_0x22adfd[_0x237b('0x8e')]=_0x1524de[_0x237b('0x8e')];_0x22adfd['queuecallercomplete']=!![];_0x22adfd[_0x237b('0x8f')]=![];_0x22adfd[_0x237b('0x90')]=null;if(!_0x22adfd[_0x237b('0x91')]){if(_0x1524de['reason']==_0x237b('0x91')){_0x22adfd[_0x237b('0x81')]='COMPLETED';logger[_0x237b('0x76')](_0x237b('0x92'),_0x22adfd[_0x237b('0x4c')],_0x22adfd['type']);}else{if(_[_0x237b('0x93')](_0x1524de[_0x237b('0x3b')][_0x237b('0x94')](),'local/')){if(this['queueReports'][_0x1524de['linkedid']]){var _0xf6504d=_['last'](this[_0x237b('0xf')][_0x1524de['linkedid']]);_0xf6504d[_0x237b('0x7d')]=![];_0xf6504d[_0x237b('0x8f')]=!![];_0xf6504d[_0x237b('0x90')]=moment(_0x22adfd[_0x237b('0x95')])[_0x237b('0x96')](_0x1524de[_0x237b('0x8e')],_0x237b('0x97'))[_0x237b('0x56')](_0x237b('0x72'));_0xf6504d['queuecallerexitreason']='FORWARDTRANSFER';_0xf6504d['transfer']=!![];_0xf6504d[_0x237b('0x98')]=_0x237b('0x99');_0xf6504d[_0x237b('0x9a')]=_0x1524de['destexten'];_0xf6504d['transferuniqueid']=_0x1524de[_0x237b('0x4a')];logger[_0x237b('0x76')](_0x237b('0x9b'),_0xf6504d[_0x237b('0x4c')],_0xf6504d[_0x237b('0x52')]);var _0x278fcc=this['queueReports'][_0x1524de[_0x237b('0x9c')]];this[_0x237b('0xf')][_0x1524de[_0x237b('0x9c')]]=this[_0x237b('0xf')][_0x1524de[_0x237b('0x4a')]];this['queueReports'][_0x1524de['uniqueid']]=_0x278fcc;}}else{_0x22adfd[_0x237b('0x81')]=_0x237b('0x9d')+_0x1524de[_0x237b('0x9e')][_0x237b('0x9f')]();logger[_0x237b('0x76')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x22adfd[_0x237b('0x4c')],_0x22adfd[_0x237b('0x52')],_0x22adfd[_0x237b('0x81')]);}}}this[_0x237b('0x37')][_0x1524de['uniqueid']]=_0x22adfd;this['emitVoiceQueueChannelRemove'](_0x22adfd,_0x237b('0x20'));}}}catch(_0x262781){logger[_0x237b('0x3d')](_0x237b('0x8d'),_0x1524de['uniqueid'],util[_0x237b('0x3f')](_0x262781,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x237b('0xa0')]=function(_0x479cf0){try{if(this[_0x237b('0x59')](_0x479cf0)){logger['debug'](_0x237b('0xa1'),_0x479cf0['uniqueid'],util['inspect'](_0x479cf0,{'showHidden':![],'depth':null}));this['addVariable'](_0x479cf0[_0x237b('0x4a')],_[_0x237b('0xa2')](_0x479cf0[_0x237b('0xa3')])[0x0],_0x479cf0[_0x237b('0xa4')]);if(this[_0x237b('0xf')][_0x479cf0[_0x237b('0x4a')]]){var _0x55aaa9=_['last'](this[_0x237b('0xf')][_0x479cf0[_0x237b('0x4a')]]);if(_0x55aaa9){if(this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')])&&this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')][_0x237b('0x61')])){switch(_0x479cf0[_0x237b('0xa4')]){case'CONTINUE':_0x55aaa9[_0x237b('0x8f')]=![];_0x55aaa9[_0x237b('0x90')]=null;break;case _0x237b('0xa5'):_0x55aaa9[_0x237b('0xa6')]=_0x237b('0xa7');_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9[_0x237b('0x90')]=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9[_0x237b('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x237b('0x54')](_0x237b('0xa8'),_0x479cf0[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x55aaa9,{'showHidden':![],'depth':null}));ami[_0x237b('0x48')](_0x237b('0xa9'),_0x55aaa9);break;default:_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9['queuecallerexitAt']=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9[_0x237b('0x87')]=moment()[_0x237b('0x56')](_0x237b('0x72'));}_0x55aaa9[_0x237b('0x1d')]=![];_0x55aaa9[_0x237b('0x80')]=null;_0x55aaa9[_0x237b('0x81')]=_0x479cf0[_0x237b('0xa4')];this[_0x237b('0x37')][_0x479cf0[_0x237b('0x4a')]]=_0x55aaa9;this['emitVoiceQueueChannelRemove'](_0x55aaa9,_0x237b('0x24'));}else if(this[_0x237b('0x59')](_0x479cf0[_0x237b('0xa3')])&&this['isNotNull'](_0x479cf0['variable'][_0x237b('0xaa')])){if(!_0x55aaa9['queuecallerabandon']){_0x55aaa9[_0x237b('0x8f')]=!![];_0x55aaa9[_0x237b('0x90')]=moment()[_0x237b('0x56')](_0x237b('0x72'));_0x55aaa9['queuecallerexitreason']=_0x237b('0xab');_0x55aaa9[_0x237b('0x87')]=moment()[_0x237b('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x237b('0x37')][_0x479cf0['uniqueid']]=_0x55aaa9;}}logger[_0x237b('0x76')](_0x237b('0xac'),_0x479cf0[_0x237b('0x4a')],_0x55aaa9['queue'],_0x55aaa9[_0x237b('0x52')],_[_0x237b('0xa2')](_0x479cf0[_0x237b('0xa3')])[0x0],_0x479cf0['value']);_0x55aaa9['variables']=this[_0x237b('0x13')][_0x479cf0[_0x237b('0x4a')]];}}}}catch(_0x1975a6){logger[_0x237b('0x3d')](_0x237b('0xa1'),_0x479cf0[_0x237b('0x4a')],util[_0x237b('0x3f')](_0x1975a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0xad')]=function(_0x415dec,_0x1d5fb1,_0x1ffee4){var _0x59049a=[_0x237b('0xae'),'rtpaudioqosbridged',_0x237b('0xaf'),_0x237b('0xb0'),_0x237b('0xb1'),'rtpaudioqoslossbridged',_0x237b('0xb2'),'rtpaudioqosrttbridged',_0x237b('0xb3'),'sipuri','bridgepeer',_0x237b('0xb4'),_0x237b('0xb5'),_0x237b('0xb6'),_0x237b('0xb7'),_0x237b('0xb8'),_0x237b('0xb9'),_0x237b('0xba'),'memberrealtime'];if(!_['isNil'](_0x1d5fb1)&&!_['includes'](_0x59049a,_0x1d5fb1)){if(_[_0x237b('0x71')](this[_0x237b('0x13')][_0x415dec])){this['variables'][_0x415dec]={};}this[_0x237b('0x13')][_0x415dec][_0x1d5fb1]=_0x1ffee4;}};VoiceQueueReport[_0x237b('0xa')][_0x237b('0xbb')]=function(_0x225ff3,_0xb81423,_0x5749a4){var _0xd27cec={};for(var _0x1c196e=0x0;_0x1c196e0x0?!![]:![];if(!_0x12b153){return this[_0x9f74('0x16')](this['summary']['completeEvent']);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x50ac9a){var _0x122d6d=this['summary']['id'];if(this[_0x9f74('0x13')][_0x9f74('0x5e')][_0x122d6d]&&this['summary'][_0x9f74('0x5e')][_0x122d6d][_0x50ac9a[_0x9f74('0x5d')]]){this[_0x9f74('0x13')]['queuestatus'][_0x122d6d][_0x50ac9a['actionid']][_0x9f74('0xf')][_0x9f74('0x6b')](_0x50ac9a);}};VoiceQueueReport['prototype'][_0x9f74('0x6c')]=function(_0x28f660){var _0x11a33b=this;try{if(this[_0x9f74('0x6d')](_0x28f660)&&this['isNotNull'](_0x28f660[_0x9f74('0x4a')])){logger[_0x9f74('0x47')](_0x9f74('0x6e'),util[_0x9f74('0x3e')](_0x28f660,{'showHidden':![],'depth':null}));var _0x13cbf9=this['voiceQueues'][_0x28f660[_0x9f74('0x4a')]];if(_0x13cbf9){logger[_0x9f74('0x6f')](_0x9f74('0x70'),_0x13cbf9[_0x9f74('0x61')]);this[_0x9f74('0x13')][_0x9f74('0x58')][_0x13cbf9['name']]={'summaryEvent':_0x28f660};this[_0x9f74('0x13')]['statusRequests']+=0x1;return ami['Action']({'action':_0x9f74('0x5e'),'queue':_0x13cbf9['name']})[_0x9f74('0x5c')](function(_0x1ad6ee){if(!_0x11a33b[_0x9f74('0x13')][_0x9f74('0x5e')][_0x28f660[_0x9f74('0x5d')]]){_0x11a33b[_0x9f74('0x13')][_0x9f74('0x5e')][_0x28f660[_0x9f74('0x5d')]]={};}_0x11a33b[_0x9f74('0x13')][_0x9f74('0x5e')][_0x28f660[_0x9f74('0x5d')]][_0x1ad6ee[_0x9f74('0x5d')]]={'queue':_0x13cbf9['name'],'agents':[]};})[_0x9f74('0x39')](function(_0x7b9d86){throw _0x7b9d86;});}}}catch(_0x5064fd){logger[_0x9f74('0x3c')](_0x9f74('0x5f'),util[_0x9f74('0x3e')](_0x5064fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')][_0x9f74('0x16')]=function(_0x4d72eb){if(this[_0x9f74('0x13')][_0x9f74('0x6a')]>0x0){this[_0x9f74('0x13')][_0x9f74('0x71')]=_0x4d72eb;return;}logger[_0x9f74('0x47')](_0x9f74('0x72'),util[_0x9f74('0x3e')](_0x4d72eb,{'showHidden':![],'depth':null}));this[_0x9f74('0x13')]=initializeSummary();ami['emit'](_0x9f74('0x73'),{});};VoiceQueueReport[_0x9f74('0xb')]['syncQueueCallerJoin']=function(_0x7cacb7){try{if(this[_0x9f74('0x6d')](_0x7cacb7)){logger[_0x9f74('0x47')](_0x9f74('0x74'),_0x7cacb7[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x7cacb7,{'showHidden':![],'depth':null}));if(_[_0x9f74('0x55')](this[_0x9f74('0x3f')][_0x7cacb7[_0x9f74('0x4e')]])){this[_0x9f74('0x3f')][_0x7cacb7['uniqueid']]=[];}if(_[_0x9f74('0x55')](this[_0x9f74('0x34')][_0x7cacb7[_0x9f74('0x4e')]])){this['channels'][_0x7cacb7['uniqueid']]={};}var _0x4720df=new QueueReport();_0x4720df[_0x9f74('0x4a')]=_0x7cacb7[_0x9f74('0x4a')];_0x4720df[_0x9f74('0x52')]=this['voiceQueues'][_0x4720df[_0x9f74('0x4a')]]&&this[_0x9f74('0x11')][_0x4720df['queue']][_0x9f74('0x52')]?this['voiceQueues'][_0x4720df[_0x9f74('0x4a')]][_0x9f74('0x52')]||_0x9f74('0x53'):'inbound';_0x4720df[_0x9f74('0x75')]=moment()['format'](_0x9f74('0x76'));_0x4720df['position']=_0x7cacb7[_0x9f74('0x77')];_0x4720df[_0x9f74('0x78')]=_0x7cacb7[_0x9f74('0x78')];_0x4720df[_0x9f74('0x4e')]=_0x7cacb7[_0x9f74('0x4e')];_0x4720df['routealias']=this['channels'][_0x7cacb7[_0x9f74('0x4e')]]['routealias'];logger[_0x9f74('0x6f')](_0x9f74('0x79'),_0x4720df[_0x9f74('0x4a')],_0x4720df[_0x9f74('0x52')]);_[_0x9f74('0x7a')](_0x4720df,_[_0x9f74('0x7b')](_0x7cacb7,_['keys'](_0x4720df)));this[_0x9f74('0x3f')][_0x7cacb7[_0x9f74('0x4e')]][_0x9f74('0x6b')](_0x4720df);this[_0x9f74('0x34')][_0x7cacb7[_0x9f74('0x4e')]]=_0x4720df;this[_0x9f74('0x46')](_0x4720df,'queuecallerjoin');}}catch(_0x259581){logger['error'](_0x9f74('0x74'),_0x7cacb7[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x259581,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')][_0x9f74('0x1d')]=function(_0x30de96){try{if(this[_0x9f74('0x6d')](_0x30de96)){logger[_0x9f74('0x47')]('[%s][voiceQueueReport][queuecallerabandon]',_0x30de96[_0x9f74('0x4e')],util['inspect'](_0x30de96,{'showHidden':![],'depth':null}));if(this[_0x9f74('0x3f')][_0x30de96[_0x9f74('0x4e')]]){var _0x32b948=_[_0x9f74('0x7c')](this[_0x9f74('0x3f')][_0x30de96[_0x9f74('0x4e')]]);_0x32b948[_0x9f74('0x7d')]=![];_0x32b948['queuecallercompleteAt']=null;_0x32b948[_0x9f74('0x7e')]=_0x30de96['holdtime'];_0x32b948[_0x9f74('0x7f')]=_0x30de96[_0x9f74('0x7f')];_0x32b948[_0x9f74('0x1c')]=!![];_0x32b948[_0x9f74('0x80')]=moment()[_0x9f74('0x49')](_0x9f74('0x76'));_0x32b948[_0x9f74('0x4f')]=_0x9f74('0x81');_0x32b948[_0x9f74('0x82')]=null;logger[_0x9f74('0x6f')](_0x9f74('0x83'),_0x32b948[_0x9f74('0x4a')],_0x32b948[_0x9f74('0x52')]);this['channels'][_0x30de96[_0x9f74('0x4e')]]=_0x32b948;this[_0x9f74('0x4d')](_0x32b948,_0x9f74('0x1c'));}}}catch(_0x5ea1d4){logger[_0x9f74('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x30de96[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x5ea1d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')][_0x9f74('0x84')]=function(_0x209a98){try{if(this['isNotNull'](_0x209a98)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x209a98[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x209a98,{'showHidden':![],'depth':null}));if(this[_0x9f74('0x3f')][_0x209a98[_0x9f74('0x4e')]]){var _0x40f74c=_[_0x9f74('0x7c')](this[_0x9f74('0x3f')][_0x209a98[_0x9f74('0x4e')]]);_0x40f74c[_0x9f74('0x85')]=moment()[_0x9f74('0x49')](_0x9f74('0x76'));_0x40f74c[_0x9f74('0x86')]=_0x209a98[_0x9f74('0x86')];_0x40f74c[_0x9f74('0x87')]=_0x209a98[_0x9f74('0x87')];logger[_0x9f74('0x6f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x40f74c[_0x9f74('0x4a')],_0x40f74c['type'],_0x209a98['connectedlinenum'],_0x209a98[_0x9f74('0x87')]);this[_0x9f74('0x34')][_0x209a98[_0x9f74('0x4e')]]=_0x40f74c;this[_0x9f74('0x46')](_0x40f74c,'queuecallerleave');}}}catch(_0x43f018){logger['error'](_0x9f74('0x88'),_0x209a98['uniqueid'],util[_0x9f74('0x3e')](_0x43f018,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')][_0x9f74('0x22')]=function(_0xbce6f){try{if(this['isNotNull'](_0xbce6f)){logger[_0x9f74('0x47')](_0x9f74('0x89'),_0xbce6f['uniqueid'],util[_0x9f74('0x3e')](_0xbce6f,{'showHidden':![],'depth':null}));if(this[_0x9f74('0x3f')][_0xbce6f[_0x9f74('0x4e')]]){var _0x152998=_[_0x9f74('0x7c')](this[_0x9f74('0x3f')][_0xbce6f[_0x9f74('0x4e')]]);_0x152998['queuecallercomplete']=!![];_0x152998[_0x9f74('0x4f')]=_0x9f74('0x8a');logger[_0x9f74('0x6f')](_0x9f74('0x8b'),_0x152998[_0x9f74('0x4a')],_0x152998[_0x9f74('0x52')]);}}}catch(_0x369326){logger['error'](_0x9f74('0x89'),_0xbce6f[_0x9f74('0x4e')],util['inspect'](_0x369326,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9f74('0x20')]=function(_0xccfc6a){try{if(this[_0x9f74('0x6d')](_0xccfc6a)){logger[_0x9f74('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0xccfc6a[_0x9f74('0x4e')],util['inspect'](_0xccfc6a,{'showHidden':![],'depth':null}));if(this[_0x9f74('0x3f')][_0xccfc6a['uniqueid']]){var _0x2214ce=_[_0x9f74('0x7c')](this[_0x9f74('0x3f')][_0xccfc6a[_0x9f74('0x4e')]]);_0x2214ce[_0x9f74('0x1c')]=![];_0x2214ce[_0x9f74('0x80')]=null;_0x2214ce[_0x9f74('0x8c')]=!![];_0x2214ce[_0x9f74('0x82')]=_0xccfc6a[_0x9f74('0x8d')];_0x2214ce['holdtime']=_0xccfc6a[_0x9f74('0x7e')];_0x2214ce[_0x9f74('0x7d')]=!![];_0x2214ce[_0x9f74('0x8e')]=![];_0x2214ce[_0x9f74('0x8f')]=null;if(!_0x2214ce[_0x9f74('0x90')]){if(_0xccfc6a[_0x9f74('0x91')]==_0x9f74('0x90')){_0x2214ce[_0x9f74('0x4f')]=_0x9f74('0x92');logger[_0x9f74('0x6f')](_0x9f74('0x93'),_0x2214ce[_0x9f74('0x4a')],_0x2214ce[_0x9f74('0x52')]);}else{if(_[_0x9f74('0x94')](_0xccfc6a[_0x9f74('0x38')]['toLowerCase'](),_0x9f74('0x95'))){if(this[_0x9f74('0x3f')][_0xccfc6a['linkedid']]){var _0x4f47af=_['last'](this['queueReports'][_0xccfc6a[_0x9f74('0x96')]]);_0x4f47af[_0x9f74('0x7d')]=![];_0x4f47af['queuecallerexit']=!![];_0x4f47af[_0x9f74('0x8f')]=moment(_0x2214ce['queuecallerjoinAt'])[_0x9f74('0x97')](_0xccfc6a[_0x9f74('0x7e')],'seconds')[_0x9f74('0x49')](_0x9f74('0x76'));_0x4f47af['queuecallerexitreason']=_0x9f74('0x98');_0x4f47af[_0x9f74('0x90')]=!![];_0x4f47af[_0x9f74('0x99')]=_0x9f74('0x9a');_0x4f47af['transferexten']=_0xccfc6a['destexten'];_0x4f47af[_0x9f74('0x9b')]=_0xccfc6a[_0x9f74('0x4e')];logger['info'](_0x9f74('0x9c'),_0x4f47af['queue'],_0x4f47af[_0x9f74('0x52')]);var _0x417532=this[_0x9f74('0x3f')][_0xccfc6a[_0x9f74('0x96')]];this['queueReports'][_0xccfc6a[_0x9f74('0x96')]]=this[_0x9f74('0x3f')][_0xccfc6a['uniqueid']];this['queueReports'][_0xccfc6a['uniqueid']]=_0x417532;}}else{_0x2214ce[_0x9f74('0x4f')]=_0x9f74('0x9d')+_0xccfc6a[_0x9f74('0x91')][_0x9f74('0x9e')]();logger[_0x9f74('0x6f')](_0x9f74('0x9f'),_0x2214ce[_0x9f74('0x4a')],_0x2214ce[_0x9f74('0x52')],_0x2214ce[_0x9f74('0x4f')]);}}}this[_0x9f74('0x34')][_0xccfc6a[_0x9f74('0x4e')]]=_0x2214ce;this[_0x9f74('0x4d')](_0x2214ce,'agentcomplete');}}}catch(_0x469784){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0xccfc6a[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x469784,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')]['syncVarSet']=function(_0x19a0c4){try{if(this['isNotNull'](_0x19a0c4)){logger['debug'](_0x9f74('0xa0'),_0x19a0c4['uniqueid'],util[_0x9f74('0x3e')](_0x19a0c4,{'showHidden':![],'depth':null}));this['addVariable'](_0x19a0c4[_0x9f74('0x4e')],_[_0x9f74('0xa1')](_0x19a0c4['variable'])[0x0],_0x19a0c4['value']);if(this[_0x9f74('0x3f')][_0x19a0c4[_0x9f74('0x4e')]]){var _0x7d1009=_['last'](this[_0x9f74('0x3f')][_0x19a0c4[_0x9f74('0x4e')]]);if(_0x7d1009){if(this[_0x9f74('0x6d')](_0x19a0c4[_0x9f74('0xa2')])&&this[_0x9f74('0x6d')](_0x19a0c4['variable'][_0x9f74('0x5e')])){switch(_0x19a0c4[_0x9f74('0xa3')]){case'CONTINUE':_0x7d1009[_0x9f74('0x8e')]=![];_0x7d1009[_0x9f74('0x8f')]=null;break;case'TIMEOUT':_0x7d1009[_0x9f74('0xa4')]=_0x9f74('0xa5');_0x7d1009['queuecallerexit']=!![];_0x7d1009[_0x9f74('0x8f')]=moment()[_0x9f74('0x49')](_0x9f74('0x76'));_0x7d1009['queuecallerleaveAt']=moment()['format'](_0x9f74('0x76'));logger[_0x9f74('0x47')](_0x9f74('0xa6'),_0x19a0c4[_0x9f74('0x4e')],util[_0x9f74('0x3e')](_0x7d1009,{'showHidden':![],'depth':null}));ami[_0x9f74('0x45')](_0x9f74('0xa7'),_0x7d1009);break;default:_0x7d1009[_0x9f74('0x8e')]=!![];_0x7d1009[_0x9f74('0x8f')]=moment()[_0x9f74('0x49')](_0x9f74('0x76'));_0x7d1009[_0x9f74('0x85')]=moment()[_0x9f74('0x49')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7d1009[_0x9f74('0x1c')]=![];_0x7d1009[_0x9f74('0x80')]=null;_0x7d1009[_0x9f74('0x4f')]=_0x19a0c4['value'];this[_0x9f74('0x34')][_0x19a0c4[_0x9f74('0x4e')]]=_0x7d1009;this[_0x9f74('0x4d')](_0x7d1009,_0x9f74('0xa8'));}else if(this[_0x9f74('0x6d')](_0x19a0c4['variable'])&&this['isNotNull'](_0x19a0c4[_0x9f74('0xa2')]['queueposition'])){if(!_0x7d1009['queuecallerabandon']){_0x7d1009[_0x9f74('0x8e')]=!![];_0x7d1009[_0x9f74('0x8f')]=moment()[_0x9f74('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x7d1009[_0x9f74('0x4f')]=_0x9f74('0xa9');_0x7d1009[_0x9f74('0x85')]=moment()[_0x9f74('0x49')](_0x9f74('0x76'));this[_0x9f74('0x34')][_0x19a0c4['uniqueid']]=_0x7d1009;}}logger[_0x9f74('0x6f')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x19a0c4[_0x9f74('0x4e')],_0x7d1009[_0x9f74('0x4a')],_0x7d1009[_0x9f74('0x52')],_[_0x9f74('0xa1')](_0x19a0c4['variable'])[0x0],_0x19a0c4[_0x9f74('0xa3')]);_0x7d1009[_0x9f74('0x41')]=this['variables'][_0x19a0c4[_0x9f74('0x4e')]];}}}}catch(_0xa58daa){logger['error'](_0x9f74('0xa0'),_0x19a0c4[_0x9f74('0x4e')],util['inspect'](_0xa58daa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f74('0xb')][_0x9f74('0xaa')]=function(_0x5a3317,_0x141ed9,_0x30fe38){var _0x4e3bfd=['rtpaudioqos',_0x9f74('0xab'),_0x9f74('0xac'),_0x9f74('0xad'),_0x9f74('0xae'),_0x9f74('0xaf'),_0x9f74('0xb0'),_0x9f74('0xb1'),_0x9f74('0xb2'),_0x9f74('0xb3'),_0x9f74('0xb4'),_0x9f74('0xb5'),_0x9f74('0xb6'),_0x9f74('0xb7'),_0x9f74('0xb8'),_0x9f74('0xb9'),'membername',_0x9f74('0xba'),'memberrealtime'];if(!_[_0x9f74('0xbb')](_0x141ed9)&&!_[_0x9f74('0xbc')](_0x4e3bfd,_0x141ed9)){if(_[_0x9f74('0x55')](this[_0x9f74('0x41')][_0x5a3317])){this[_0x9f74('0x41')][_0x5a3317]={};}this[_0x9f74('0x41')][_0x5a3317][_0x141ed9]=_0x30fe38;}};VoiceQueueReport[_0x9f74('0xb')]['handleHangup']=function(_0xab9ab1,_0x36b81b,_0x324a7a){var _0x2079f5={};for(var _0x2cfaab=0x0;_0x2cfaab=0x0?moment(_0x3c2767[_0x09cf('0x18')])[_0x09cf('0x1a')](_0x3c2767['starttime'],'seconds'):null,'data1':_0x09cf('0x1b'),'data2':_0x3c2767[_0x09cf('0x14')],'data3':_0x3c2767[_0x09cf('0x1c')],'data4':_0x3c2767[_0x09cf('0x1d')]||null,'role':_0x09cf('0x13'),'internal':_0x3c2767['accountcode']?_[_0x09cf('0x15')](_0x3c2767[_0x09cf('0x14')]):undefined,'uniqueid':_0x3c2767['uniqueid']},'log':_0x09cf('0x7')});}; \ No newline at end of file +var _0x2dad=['diff','outbound','dialstring','agent','moment','util','../client','voiceQueueReport','queuecallercompleteAt','voice','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','toNumber','accountcode','uniqueid','voiceDialReport','Request','CreateMemberReport','membername','starttime','endtime'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2dad,0x1b6));var _0xd2da=function(_0x9fff4b,_0x1fcacf){_0x9fff4b=_0x9fff4b-0x0;var _0x469247=_0x2dad[_0x9fff4b];return _0x469247;};'use strict';var moment=require(_0xd2da('0x0'));var _=require('lodash');var util=require(_0xd2da('0x1'));var client=require(_0xd2da('0x2'));exports[_0xd2da('0x3')]=function(_0x5e97b0){var _0xbca9fe=_0x5e97b0[_0xd2da('0x4')]||_0x5e97b0['queuecallerexitAt'];return client['Request']('CreateMemberReport',{'body':{'channel':_0xd2da('0x5'),'membername':_0x5e97b0[_0xd2da('0x6')],'interface':_[_0xd2da('0x7')](_0x5e97b0['interface'])?util[_0xd2da('0x8')](_0xd2da('0x9'),_0x5e97b0['lastAssignedTo']):_0x5e97b0[_0xd2da('0xa')],'type':_0xd2da('0xb'),'enterAt':_0x5e97b0[_0xd2da('0xc')],'exitAt':_0xbca9fe,'duration':moment(_0xbca9fe)['diff'](_0x5e97b0[_0xd2da('0xc')],_0xd2da('0xd')),'data1':_0xd2da('0xe'),'data2':_0x5e97b0[_0xd2da('0xf')],'data3':_0x5e97b0[_0xd2da('0x10')],'data4':null,'data5':_0x5e97b0[_0xd2da('0x11')],'role':'agent','internal':_0x5e97b0['accountcode']?_[_0xd2da('0x12')](_0x5e97b0[_0xd2da('0x13')]):undefined,'uniqueid':_0x5e97b0[_0xd2da('0x14')]},'log':'CreateMemberReport'});};exports[_0xd2da('0x15')]=function(_0xfa1942){return client[_0xd2da('0x16')](_0xd2da('0x17'),{'body':{'channel':'voice','membername':_0xfa1942[_0xd2da('0x18')],'interface':_0xfa1942[_0xd2da('0xa')],'type':_0xd2da('0xb'),'enterAt':_0xfa1942[_0xd2da('0x19')],'exitAt':_0xfa1942[_0xd2da('0x1a')],'duration':moment(_0xfa1942[_0xd2da('0x1a')])[_0xd2da('0x1b')](_0xfa1942[_0xd2da('0x19')],_0xd2da('0xd'))>=0x0?moment(_0xfa1942[_0xd2da('0x1a')])[_0xd2da('0x1b')](_0xfa1942[_0xd2da('0x19')],_0xd2da('0xd')):null,'data1':_0xd2da('0x1c'),'data2':_0xfa1942['accountcode'],'data3':_0xfa1942['exten'],'data4':_0xfa1942[_0xd2da('0x1d')]||null,'role':_0xd2da('0x1e'),'internal':_0xfa1942[_0xd2da('0x13')]?_['toNumber'](_0xfa1942[_0xd2da('0x13')]):undefined,'uniqueid':_0xfa1942[_0xd2da('0x14')]},'log':_0xd2da('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 92760d7..2dcd2ac 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 _0x40ac=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request'];(function(_0xd04b50,_0x3d635d){var _0x5de236=function(_0x9129b1){while(--_0x9129b1){_0xd04b50['push'](_0xd04b50['shift']());}};_0x5de236(++_0x3d635d);}(_0x40ac,0x1de));var _0xc40a=function(_0x5e0e90,_0x1c8363){_0x5e0e90=_0x5e0e90-0x0;var _0x33cfe3=_0x40ac[_0x5e0e90];return _0x33cfe3;};'use strict';var client=require(_0xc40a('0x0'));exports['getSettings']=function(){return client[_0xc40a('0x1')](_0xc40a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc40a('0x3'),_0xc40a('0x4')]},'log':_0xc40a('0x5')});}; \ No newline at end of file +var _0x174b=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','ShowSetting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x174b,0x19d));var _0xb174=function(_0x258e57,_0x5ea531){_0x258e57=_0x258e57-0x0;var _0x58a1f4=_0x174b[_0x258e57];return _0x58a1f4;};'use strict';var client=require(_0xb174('0x0'));exports['getSettings']=function(){return client['Request'](_0xb174('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb174('0x2'),_0xb174('0x3')]},'log':_0xb174('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2ae61de..31a2cc2 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 _0xcd2e=['html','getTemplates','Request','GetTemplate','name'];(function(_0xa895e7,_0x3d969d){var _0x41abe0=function(_0x7a9b69){while(--_0x7a9b69){_0xa895e7['push'](_0xa895e7['shift']());}};_0x41abe0(++_0x3d969d);}(_0xcd2e,0xfb));var _0xecd2=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0xcd2e[_0xce6f11];return _0x35b709;};'use strict';var client=require('../client');exports[_0xecd2('0x0')]=function(_0x217807){return function(_0x3abfbd){return client[_0xecd2('0x1')](_0xecd2('0x2'),{'options':{'raw':!![],'attributes':['id',_0xecd2('0x3'),_0xecd2('0x4')]},'log':_0xecd2('0x2')});};}; \ No newline at end of file +var _0xbfda=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbfda,0x193));var _0xabfd=function(_0x29fa3d,_0x45d24f){_0x29fa3d=_0x29fa3d-0x0;var _0x5d4bbf=_0xbfda[_0x29fa3d];return _0x5d4bbf;};'use strict';var client=require(_0xabfd('0x0'));exports[_0xabfd('0x1')]=function(_0xbe088a){return function(_0x4021cc){return client[_0xabfd('0x2')](_0xabfd('0x3'),{'options':{'raw':!![],'attributes':['id',_0xabfd('0x4'),_0xabfd('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 4424ffb..c1bf10d 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 _0x45a8=['Condition','AnyConditions','value','Actions','action','data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','name','channel','AllConditions','field','operator'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x45a8,0x1b0));var _0x845a=function(_0x264ee4,_0x2986a6){_0x264ee4=_0x264ee4-0x0;var _0x1cda8e=_0x45a8[_0x264ee4];return _0x1cda8e;};'use strict';var client=require(_0x845a('0x0'));exports[_0x845a('0x1')]=function(_0x386a91){return function(_0x52f5e5){return client[_0x845a('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x845a('0x3'),_0x845a('0x4'),'status'],'include':[{'model':'Condition','as':_0x845a('0x5'),'attributes':['id',_0x845a('0x6'),_0x845a('0x7'),'value']},{'model':_0x845a('0x8'),'as':_0x845a('0x9'),'attributes':['id',_0x845a('0x6'),_0x845a('0x7'),_0x845a('0xa')]},{'model':'Action','as':_0x845a('0xb'),'attributes':['id',_0x845a('0xc'),_0x845a('0xd'),_0x845a('0xe'),_0x845a('0xf'),_0x845a('0x10'),_0x845a('0x11'),_0x845a('0x12'),'data7']}]},'log':_0x845a('0x13')});};}; \ No newline at end of file +var _0xce07=['GetTrigger','name','channel','status','Condition','AnyConditions','field','operator','value','Action','action','data1','data2','data4','data5','data6','data7','../client','getTriggers'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0xce07,0x17a));var _0x7ce0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xce07[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x7ce0('0x0'));exports[_0x7ce0('0x1')]=function(_0x2995ab){return function(_0x512003){return client['Request'](_0x7ce0('0x2'),{'options':{'raw':![],'attributes':['id',_0x7ce0('0x3'),_0x7ce0('0x4'),_0x7ce0('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field','operator','value']},{'model':_0x7ce0('0x6'),'as':_0x7ce0('0x7'),'attributes':['id',_0x7ce0('0x8'),_0x7ce0('0x9'),_0x7ce0('0xa')]},{'model':_0x7ce0('0xb'),'as':'Actions','attributes':['id',_0x7ce0('0xc'),_0x7ce0('0xd'),_0x7ce0('0xe'),'data3',_0x7ce0('0xf'),_0x7ce0('0x10'),_0x7ce0('0x11'),_0x7ce0('0x12')]}]},'log':_0x7ce0('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 9fa22d1..199099d 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 _0x3525=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x3525,0x143));var _0x5352=function(_0x8beed2,_0xd5bf4b){_0x8beed2=_0x8beed2-0x0;var _0x481ed9=_0x3525[_0x8beed2];return _0x481ed9;};'use strict';var client=require(_0x5352('0x0'));exports[_0x5352('0x1')]=function(_0xba0928){return function(_0x3a8fe7){return client[_0x5352('0x2')](_0x5352('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5352('0x4'),_0x5352('0x5'),'defaultuser']},'log':_0x5352('0x3')});};}; \ No newline at end of file +var _0xa5c5=['Request','GetTrunk','name','defaultuser','../client','getTrunks'];(function(_0x156de7,_0x556703){var _0x212a7=function(_0x29db46){while(--_0x29db46){_0x156de7['push'](_0x156de7['shift']());}};_0x212a7(++_0x556703);}(_0xa5c5,0x64));var _0x5a5c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa5c5[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x5a5c('0x0'));exports[_0x5a5c('0x1')]=function(_0x211cdc){return function(_0x2e6964){return client[_0x5a5c('0x2')](_0x5a5c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5a5c('0x4'),'registry',_0x5a5c('0x5')]},'log':_0x5a5c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 49b01fa..3d3670e 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe706,0xa3));var _0x6e70=function(_0x5ae187,_0x8afd5c){_0x5ae187=_0x5ae187-0x0;var _0x211069=_0xe706[_0x5ae187];return _0x211069;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0xbcbf0a,_0x54df44){var _0x48557a=function(_0x3ead5f){while(--_0x3ead5f){_0xbcbf0a['push'](_0xbcbf0a['shift']());}};_0x48557a(++_0x54df44);}(_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 4b3f183..c8b5eb0 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 _0xb589=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x4938ac,_0x3d8f06){var _0x5ed8e7=function(_0x202ef4){while(--_0x202ef4){_0x4938ac['push'](_0x4938ac['shift']());}};_0x5ed8e7(++_0x3d8f06);}(_0xb589,0x139));var _0x9b58=function(_0x147e9f,_0x57b3cb){_0x147e9f=_0x147e9f-0x0;var _0x321585=_0xb589[_0x147e9f];return _0x321585;};'use strict';var client=require(_0x9b58('0x0'));exports[_0x9b58('0x1')]=function(_0xf179a6){return client[_0x9b58('0x2')](_0x9b58('0x3'),{'body':_0xf179a6,'log':'CreateVoiceAgentReport'});};exports[_0x9b58('0x4')]=function(_0xadcbd,_0xb17ae4,_0x1762e6){return client['Request'](_0x9b58('0x5'),{'body':_0xadcbd,'options':{'where':{'uniqueid':_0xb17ae4,'interface':_0x1762e6,'agentcomplete':!![]}},'log':_0x9b58('0x5')});}; \ No newline at end of file +var _0xfb2f=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb2f,0x107));var _0xffb2=function(_0x4c9839,_0x145f86){_0x4c9839=_0x4c9839-0x0;var _0x936f3e=_0xfb2f[_0x4c9839];return _0x936f3e;};'use strict';var client=require(_0xffb2('0x0'));exports[_0xffb2('0x1')]=function(_0x28d30b){return client[_0xffb2('0x2')]('CreateVoiceAgentReport',{'body':_0x28d30b,'log':_0xffb2('0x3')});};exports[_0xffb2('0x4')]=function(_0x40b8d7,_0x46b826,_0x33aae9){return client[_0xffb2('0x2')]('UpdateVoiceAgentReport',{'body':_0x40b8d7,'options':{'where':{'uniqueid':_0x46b826,'interface':_0x33aae9,'agentcomplete':!![]}},'log':_0xffb2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b01cecf..b2c1700 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 _0x679f=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','day','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds'];(function(_0x55e2c0,_0x25ade0){var _0x440712=function(_0x1b2aca){while(--_0x1b2aca){_0x55e2c0['push'](_0x55e2c0['shift']());}};_0x440712(++_0x25ade0);}(_0x679f,0x1b6));var _0xf679=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x679f[_0x4a9fb1];return _0x348672;};'use strict';var moment=require(_0xf679('0x0'));var util=require(_0xf679('0x1'));var _=require(_0xf679('0x2'));var client=require(_0xf679('0x3'));exports[_0xf679('0x4')]=function(_0x5889da){return client[_0xf679('0x5')]('CreateVoiceCallReport',{'body':_[_0xf679('0x6')](_0x5889da,{'source':_0x5889da[_0xf679('0x7')],'destinationcontext':_0x5889da[_0xf679('0x8')],'callerid':_0x5889da[_0xf679('0x9')],'amaflags':_0xf679('0xa')}),'log':_0xf679('0xb')});};exports[_0xf679('0xc')]=function(){return function(){return client[_0xf679('0x5')](_0xf679('0xd'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xf679('0xe')](_0xf679('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf679('0x10')]('day')['format'](_0xf679('0x11'))]}},'attributes':[_0xf679('0x12'),_0xf679('0x13'),_0xf679('0x14'),_0xf679('0x15')]},'log':_0xf679('0x16')});};}; \ No newline at end of file +var _0x2498=['context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','create','Request','merge','calleridnum'];(function(_0x3456b5,_0x44a6dc){var _0x3d4edb=function(_0x1448e3){while(--_0x1448e3){_0x3456b5['push'](_0x3456b5['shift']());}};_0x3d4edb(++_0x44a6dc);}(_0x2498,0x176));var _0x8249=function(_0x10b9f0,_0x1aaaf0){_0x10b9f0=_0x10b9f0-0x0;var _0x803a90=_0x2498[_0x10b9f0];return _0x803a90;};'use strict';var moment=require(_0x8249('0x0'));var util=require(_0x8249('0x1'));var _=require('lodash');var client=require('../client');exports[_0x8249('0x2')]=function(_0x117309){return client[_0x8249('0x3')]('CreateVoiceCallReport',{'body':_[_0x8249('0x4')](_0x117309,{'source':_0x117309[_0x8249('0x5')],'destinationcontext':_0x117309[_0x8249('0x6')],'callerid':_0x117309[_0x8249('0x7')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x8249('0x8')]=function(){return function(){return client['Request'](_0x8249('0x9'),{'options':{'where':{'type':[_0x8249('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x8249('0xb'))['format'](_0x8249('0xc')),moment()[_0x8249('0xd')](_0x8249('0xb'))[_0x8249('0xe')](_0x8249('0xc'))]}},'attributes':[_0x8249('0xf'),_0x8249('0x10'),_0x8249('0x11'),_0x8249('0x12')]},'log':_0x8249('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 94efd38..6eb14be 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 _0x61d4=['../client','create','CreateVoiceDialReport'];(function(_0x23931f,_0x44a59c){var _0x2575ce=function(_0xea6dec){while(--_0xea6dec){_0x23931f['push'](_0x23931f['shift']());}};_0x2575ce(++_0x44a59c);}(_0x61d4,0xcf));var _0x461d=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0x61d4[_0x5555c6];return _0x5e8dc5;};'use strict';var client=require(_0x461d('0x0'));exports[_0x461d('0x1')]=function(_0x4244b6){return client['Request'](_0x461d('0x2'),{'body':_0x4244b6,'log':_0x461d('0x2')});}; \ No newline at end of file +var _0xe448=['Request','CreateVoiceDialReport','../client','create'];(function(_0x14f5c4,_0x2712d4){var _0x5dcc52=function(_0x3faf15){while(--_0x3faf15){_0x14f5c4['push'](_0x14f5c4['shift']());}};_0x5dcc52(++_0x2712d4);}(_0xe448,0x1c6));var _0x8e44=function(_0x308975,_0x58856b){_0x308975=_0x308975-0x0;var _0x2c78f7=_0xe448[_0x308975];return _0x2c78f7;};'use strict';var client=require(_0x8e44('0x0'));exports[_0x8e44('0x1')]=function(_0x470c9c){return client[_0x8e44('0x2')]('CreateVoiceDialReport',{'body':_0x470c9c,'log':_0x8e44('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d864e99..cb2b7b8 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 _0xf151=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x29db16,_0x5e73f1){var _0x2784ce=function(_0x555b10){while(--_0x555b10){_0x29db16['push'](_0x29db16['shift']());}};_0x2784ce(++_0x5e73f1);}(_0xf151,0xab));var _0x1f15=function(_0x2e56a4,_0x481289){_0x2e56a4=_0x2e56a4-0x0;var _0x475c49=_0xf151[_0x2e56a4];return _0x475c49;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x1f15('0x0')](_0x1f15('0x1'),{'options':{'raw':!![],'attributes':['id',_0x1f15('0x2'),_0x1f15('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1f15('0x4')});};}; \ No newline at end of file +var _0xf109=['getVoiceExtensions','Request','../client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf109,0xce));var _0x9f10=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xf109[_0x5ddaac];return _0x2a9c58;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(){return function(){return client[_0x9f10('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x9f10('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c387b0e..4b5d375 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 _0x4af2=['dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x15726f,_0x437797){var _0x2a261c=function(_0x5ec05c){while(--_0x5ec05c){_0x15726f['push'](_0x15726f['shift']());}};_0x2a261c(++_0x437797);}(_0x4af2,0xa8));var _0x24af=function(_0x26899b,_0x50ed58){_0x26899b=_0x26899b-0x0;var _0x1c7a04=_0x4af2[_0x26899b];return _0x1c7a04;};'use strict';var client=require('../client');exports[_0x24af('0x0')]=function(){return function(){return client[_0x24af('0x1')](_0x24af('0x2'),{'options':{'raw':![],'attributes':['id',_0x24af('0x3'),_0x24af('0x4'),'acwTimeout',_0x24af('0x5'),_0x24af('0x6'),'type','dialActive',_0x24af('0x7'),_0x24af('0x8'),_0x24af('0x9'),_0x24af('0xa'),_0x24af('0xb'),_0x24af('0xc'),_0x24af('0xd'),_0x24af('0xe'),_0x24af('0xf'),_0x24af('0x10'),_0x24af('0x11'),_0x24af('0x12'),'dialQueueProject',_0x24af('0x13'),_0x24af('0x14'),_0x24af('0x15'),'dialBusyRetryFrequency',_0x24af('0x16'),_0x24af('0x17'),_0x24af('0x18'),_0x24af('0x19'),_0x24af('0x1a'),_0x24af('0x1b'),_0x24af('0x1c'),_0x24af('0x1d'),_0x24af('0x1e'),_0x24af('0x1f'),_0x24af('0x20'),_0x24af('0x21'),_0x24af('0x22'),_0x24af('0x23'),_0x24af('0x24'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x24af('0x25'),_0x24af('0x26'),_0x24af('0x27'),_0x24af('0x28'),'dialAgiAfterHangupAgent',_0x24af('0x29'),_0x24af('0x2a'),_0x24af('0x6'),_0x24af('0x2b'),_0x24af('0x2c'),_0x24af('0x2d'),_0x24af('0x2e'),'dialNoSuchNumberRetryFrequency',_0x24af('0x2f'),_0x24af('0x30'),'dialAbandonedMaxRetry',_0x24af('0x31'),_0x24af('0x32'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x24af('0x33'),_0x24af('0x34'),_0x24af('0x35'),'dialPreviewAutoRecallMe',_0x24af('0x36')],'include':[{'model':_0x24af('0x37'),'as':_0x24af('0x37'),'attributes':['id',_0x24af('0x3'),_0x24af('0x38'),_0x24af('0x39')]},{'model':_0x24af('0x3a'),'as':_0x24af('0x3b'),'attributes':['id',_0x24af('0x3')]},{'model':_0x24af('0x37'),'as':'TrunkBackup','attributes':['id',_0x24af('0x3'),_0x24af('0x38'),'active']},{'model':'Interval','as':_0x24af('0x3c'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0x24af('0x3d'),'attributes':['id',_0x24af('0x3'),_0x24af('0x3e')]}]}]},'log':_0x24af('0x0')});};}; \ No newline at end of file +var _0x1e21=['dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive'];(function(_0x2fd530,_0x260081){var _0x173387=function(_0x532825){while(--_0x532825){_0x2fd530['push'](_0x2fd530['shift']());}};_0x173387(++_0x260081);}(_0x1e21,0x102));var _0x11e2=function(_0x4ea405,_0x13634f){_0x4ea405=_0x4ea405-0x0;var _0x4d6cad=_0x1e21[_0x4ea405];return _0x4d6cad;};'use strict';var client=require(_0x11e2('0x0'));exports[_0x11e2('0x1')]=function(){return function(){return client[_0x11e2('0x2')](_0x11e2('0x3'),{'options':{'raw':![],'attributes':['id',_0x11e2('0x4'),_0x11e2('0x5'),'acwTimeout',_0x11e2('0x6'),_0x11e2('0x7'),_0x11e2('0x8'),_0x11e2('0x9'),'dialMethod',_0x11e2('0xa'),_0x11e2('0xb'),_0x11e2('0xc'),_0x11e2('0xd'),_0x11e2('0xe'),_0x11e2('0xf'),_0x11e2('0x10'),_0x11e2('0x11'),_0x11e2('0x12'),_0x11e2('0x13'),_0x11e2('0x14'),_0x11e2('0x15'),'dialCongestionMaxRetry',_0x11e2('0x16'),_0x11e2('0x17'),'dialBusyRetryFrequency',_0x11e2('0x18'),'dialNoAnswerRetryFrequency',_0x11e2('0x19'),_0x11e2('0x1a'),_0x11e2('0x1b'),_0x11e2('0x1c'),_0x11e2('0x1d'),'dialAMDActive',_0x11e2('0x1e'),_0x11e2('0x1f'),_0x11e2('0x20'),_0x11e2('0x21'),_0x11e2('0x22'),_0x11e2('0x23'),_0x11e2('0x24'),_0x11e2('0x25'),_0x11e2('0x26'),_0x11e2('0x27'),'dialRecallMeTimeout',_0x11e2('0x28'),_0x11e2('0x29'),'dialAgiAfterHangupAgent',_0x11e2('0x2a'),_0x11e2('0x2b'),_0x11e2('0x7'),_0x11e2('0x2c'),_0x11e2('0x2d'),'dialCutDigit',_0x11e2('0x2e'),_0x11e2('0x2f'),_0x11e2('0x30'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0x11e2('0x31'),_0x11e2('0x32'),_0x11e2('0x33'),_0x11e2('0x34'),_0x11e2('0x35'),_0x11e2('0x36'),_0x11e2('0x37'),_0x11e2('0x38'),_0x11e2('0x39'),_0x11e2('0x3a')],'include':[{'model':_0x11e2('0x3b'),'as':'Trunk','attributes':['id',_0x11e2('0x4'),_0x11e2('0x3c'),_0x11e2('0x3d')]},{'model':_0x11e2('0x3e'),'as':_0x11e2('0x3f'),'attributes':['id','name']},{'model':_0x11e2('0x3b'),'as':_0x11e2('0x40'),'attributes':['id',_0x11e2('0x4'),_0x11e2('0x3c'),_0x11e2('0x3d')]},{'model':_0x11e2('0x41'),'as':_0x11e2('0x41'),'attributes':['id',_0x11e2('0x4')],'include':[{'model':_0x11e2('0x41'),'as':_0x11e2('0x42'),'attributes':['id',_0x11e2('0x4'),'interval']}]}]},'log':_0x11e2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1be0c4f..64514aa 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(_0x367b76,_0x5b9900){var _0x7612b3=function(_0x5c1240){while(--_0x5c1240){_0x367b76['push'](_0x367b76['shift']());}};_0x7612b3(++_0x5b9900);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0xba345d,_0x56ab65){var _0x4554dc=function(_0x403866){while(--_0x403866){_0xba345d['push'](_0xba345d['shift']());}};_0x4554dc(++_0x56ab65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 d742e56..90a391f 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 _0xec96=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1dabd4,_0x48d3b2){var _0x4a806b=function(_0x47a00d){while(--_0x47a00d){_0x1dabd4['push'](_0x1dabd4['shift']());}};_0x4a806b(++_0x48d3b2);}(_0xec96,0x96));var _0x6ec9=function(_0x8d89a0,_0x4cbdc4){_0x8d89a0=_0x8d89a0-0x0;var _0x218e97=_0xec96[_0x8d89a0];return _0x218e97;};'use strict';var client=require(_0x6ec9('0x0'));exports[_0x6ec9('0x1')]=function(_0x3e242e){return function(){return client[_0x6ec9('0x2')](_0x6ec9('0x3'),{'options':{'where':{'VoiceQueueId':_0x3e242e,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x716e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2bde35,_0x2461de){var _0x8b5a68=function(_0x276c30){while(--_0x276c30){_0x2bde35['push'](_0x2bde35['shift']());}};_0x8b5a68(++_0x2461de);}(_0x716e,0xd7));var _0xe716=function(_0x4ec577,_0x5b5bb2){_0x4ec577=_0x4ec577-0x0;var _0x2fd5b1=_0x716e[_0x4ec577];return _0x2fd5b1;};'use strict';var client=require(_0xe716('0x0'));exports[_0xe716('0x1')]=function(_0x327e84){return function(){return client[_0xe716('0x2')](_0xe716('0x3'),{'options':{'where':{'VoiceQueueId':_0x327e84,'paused':!![]},'raw':!![]},'log':_0xe716('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 129707c..f6ee9d5 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x402789,_0x5e1cbd){var _0x33a1ed=function(_0x244bf4){while(--_0x244bf4){_0x402789['push'](_0x402789['shift']());}};_0x33a1ed(++_0x5e1cbd);}(_0x7a54,0x106));var _0x47a5=function(_0x3ccca2,_0x3bd75d){_0x3ccca2=_0x3ccca2-0x0;var _0xe4c8f3=_0x7a54[_0x3ccca2];return _0xe4c8f3;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x15a37f,_0x14f240){var _0xc13672=function(_0x5984f6){while(--_0x5984f6){_0x15a37f['push'](_0x15a37f['shift']());}};_0xc13672(++_0x14f240);}(_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 diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index bd72bbf..71483e9 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 _0x36dc=['transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereecalleridnum'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x36dc,0xdd));var _0xc36d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36dc[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc36d('0x0'));exports[_0xc36d('0x1')]={};exports[_0xc36d('0x2')]=function(_0x50836c){return client['Request'](_0xc36d('0x3'),{'body':{'result':_0x50836c[_0xc36d('0x4')],'transfererchannel':_0x50836c[_0xc36d('0x5')],'transferercalleridnum':_0x50836c[_0xc36d('0x6')],'transferercalleridname':_0x50836c[_0xc36d('0x7')],'transfererconnectedlinenum':_0x50836c[_0xc36d('0x8')],'transfererconnectedlinename':_0x50836c[_0xc36d('0x9')],'transfereraccountcode':_0x50836c[_0xc36d('0xa')],'transferercontext':_0x50836c['transferercontext'],'transfererexten':_0x50836c[_0xc36d('0xb')],'transfererlinkedid':_0x50836c['transfererlinkedid'],'transfereechannel':_0x50836c['transfereechannel'],'transfereecalleridnum':_0x50836c[_0xc36d('0xc')],'transfereecalleridname':_0x50836c['transfereecalleridname'],'transfereeconnectedlinenum':_0x50836c['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x50836c[_0xc36d('0xd')],'transfereeaccountcode':_0x50836c[_0xc36d('0xe')],'transfereecontext':_0x50836c['transfereecontext'],'transfereeexten':_0x50836c[_0xc36d('0xf')],'transfereelinkedid':_0x50836c[_0xc36d('0x10')],'isexternal':_0x50836c[_0xc36d('0x11')],'context':_0x50836c[_0xc36d('0x12')],'extension':_0x50836c[_0xc36d('0x13')],'type':_0xc36d('0x14')},'log':_0xc36d('0x3')});};exports[_0xc36d('0x15')]=function(_0x2e3227){return client[_0xc36d('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x2e3227[_0xc36d('0x4')],'transfererchannel':_0x2e3227[_0xc36d('0x17')],'transferercalleridnum':_0x2e3227['origtransferercalleridnum'],'transferercalleridname':_0x2e3227[_0xc36d('0x18')],'transfererconnectedlinenum':_0x2e3227[_0xc36d('0x19')],'transfererconnectedlinename':_0x2e3227[_0xc36d('0x1a')],'transfereraccountcode':_0x2e3227[_0xc36d('0x1b')],'transferercontext':_0x2e3227[_0xc36d('0x1c')],'transfererexten':_0x2e3227['secondtransfererexten'],'transfererlinkedid':_0x2e3227[_0xc36d('0x1d')],'transfereechannel':_0x2e3227['transfertargetchannel'],'transfereecalleridnum':_0x2e3227['transfertargetcalleridnum'],'transfereecalleridname':_0x2e3227[_0xc36d('0x1e')],'transfereeconnectedlinenum':_0x2e3227[_0xc36d('0x1f')],'transfereeconnectedlinename':_0x2e3227['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2e3227[_0xc36d('0x20')],'transfereecontext':_0x2e3227[_0xc36d('0x21')],'transfereeexten':_0x2e3227[_0xc36d('0x22')],'transfereelinkedid':_0x2e3227[_0xc36d('0x23')],'isexternal':_0x2e3227[_0xc36d('0x11')],'context':_0x2e3227[_0xc36d('0x24')],'extension':_0x2e3227[_0xc36d('0x25')],'type':_0xc36d('0x26')},'log':_0xc36d('0x3')});}; \ No newline at end of file +var _0x7fd0=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','extension','blind','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0x7fd0,0x1e3));var _0x07fd=function(_0x14d65b,_0x343f48){_0x14d65b=_0x14d65b-0x0;var _0x5b785c=_0x7fd0[_0x14d65b];return _0x5b785c;};'use strict';var client=require(_0x07fd('0x0'));exports[_0x07fd('0x1')]={};exports[_0x07fd('0x2')]=function(_0x1f9a29){return client[_0x07fd('0x3')](_0x07fd('0x4'),{'body':{'result':_0x1f9a29[_0x07fd('0x5')],'transfererchannel':_0x1f9a29[_0x07fd('0x6')],'transferercalleridnum':_0x1f9a29[_0x07fd('0x7')],'transferercalleridname':_0x1f9a29['transferercalleridname'],'transfererconnectedlinenum':_0x1f9a29['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1f9a29['transfererconnectedlinename'],'transfereraccountcode':_0x1f9a29[_0x07fd('0x8')],'transferercontext':_0x1f9a29[_0x07fd('0x9')],'transfererexten':_0x1f9a29[_0x07fd('0xa')],'transfererlinkedid':_0x1f9a29[_0x07fd('0xb')],'transfereechannel':_0x1f9a29[_0x07fd('0xc')],'transfereecalleridnum':_0x1f9a29[_0x07fd('0xd')],'transfereecalleridname':_0x1f9a29['transfereecalleridname'],'transfereeconnectedlinenum':_0x1f9a29['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1f9a29[_0x07fd('0xe')],'transfereeaccountcode':_0x1f9a29[_0x07fd('0xf')],'transfereecontext':_0x1f9a29[_0x07fd('0x10')],'transfereeexten':_0x1f9a29['transfereeexten'],'transfereelinkedid':_0x1f9a29[_0x07fd('0x11')],'isexternal':_0x1f9a29[_0x07fd('0x12')],'context':_0x1f9a29['context'],'extension':_0x1f9a29[_0x07fd('0x13')],'type':_0x07fd('0x14')},'log':_0x07fd('0x4')});};exports['attendedTransfer']=function(_0x16e519){return client[_0x07fd('0x3')](_0x07fd('0x4'),{'body':{'result':_0x16e519[_0x07fd('0x5')],'transfererchannel':_0x16e519[_0x07fd('0x15')],'transferercalleridnum':_0x16e519[_0x07fd('0x16')],'transferercalleridname':_0x16e519['origtransferercalleridname'],'transfererconnectedlinenum':_0x16e519[_0x07fd('0x17')],'transfererconnectedlinename':_0x16e519[_0x07fd('0x18')],'transfereraccountcode':_0x16e519[_0x07fd('0x19')],'transferercontext':_0x16e519[_0x07fd('0x1a')],'transfererexten':_0x16e519['secondtransfererexten'],'transfererlinkedid':_0x16e519[_0x07fd('0x1b')],'transfereechannel':_0x16e519[_0x07fd('0x1c')],'transfereecalleridnum':_0x16e519[_0x07fd('0x1d')],'transfereecalleridname':_0x16e519[_0x07fd('0x1e')],'transfereeconnectedlinenum':_0x16e519[_0x07fd('0x1f')],'transfereeconnectedlinename':_0x16e519[_0x07fd('0x20')],'transfereeaccountcode':_0x16e519['transfertargetaccountcode'],'transfereecontext':_0x16e519[_0x07fd('0x21')],'transfereeexten':_0x16e519[_0x07fd('0x22')],'transfereelinkedid':_0x16e519[_0x07fd('0x23')],'isexternal':_0x16e519['isexternal'],'context':_0x16e519[_0x07fd('0x24')],'extension':_0x16e519[_0x07fd('0x25')],'type':_0x07fd('0x26')},'log':_0x07fd('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 67fc1b1..bb629f2 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 _0xf006=['mixmonitorid','rec','MixMonitor\x20Success','uniqueid','resolve','StopMixMonitor','destinationchannel','status','stop','Channel\x20doesn\x27t\x20exist','queueChannels','type','inbound','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','Reload','message','catch','error','action','Command','Action','then','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/'];(function(_0x2c918e,_0xdc575e){var _0x5358e0=function(_0x30d6d3){while(--_0x30d6d3){_0x2c918e['push'](_0x2c918e['shift']());}};_0x5358e0(++_0xdc575e);}(_0xf006,0x146));var _0x6f00=function(_0x3acee3,_0x3280b6){_0x3acee3=_0x3acee3-0x0;var _0x280811=_0xf006[_0x3acee3];return _0x280811;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x6f00('0x0'));var schema=require(_0x6f00('0x1'));var moment=require('moment');var config=require(_0x6f00('0x2'));var properties=require('../properties');var ami=require(_0x6f00('0x3'));var VoiceQueueSummary=require('../model/voiceQueueSummary');exports['listen']=function(_0x44a0f9,_0x402677,_0x141e71){return new Promise(function(_0x52c9a2,_0x3c29ff){var _0x4f918f={'QueuePause':function(_0x3875fb){return new Promise(function(_0x3001b1){var _0x185728=util[_0x6f00('0x4')](_0x6f00('0x5'),_0x6f00('0x6'),_0x3875fb[_0x6f00('0x7')]);if(_0x44a0f9[_0x6f00('0x8')]&&_0x44a0f9[_0x6f00('0x8')][_0x185728]&&_0x44a0f9[_0x6f00('0x8')][_0x185728][_0x6f00('0x9')]){_0x44a0f9[_0x6f00('0x8')][_0x185728][_0x6f00('0xa')]();}if(_0x44a0f9['agents'][_0x185728]){_0x44a0f9[_0x6f00('0xb')][_0x185728][_0x6f00('0xc')]({'statePause':_0x3875fb[_0x6f00('0xd')]?!![]:![]});}_0x3001b1({'code':0xc8,'message':_0x6f00('0xe')});});},'Reload':function(_0x289fe9){var _0x5e3264=this;return new Promise(function(_0x322116,_0x4d5b73){if(ami[_0x6f00('0xf')]()==![]){return _0x4d5b73(_0x5e3264['error'](0x1f4,[config[_0x6f00('0x10')]['ip'],config[_0x6f00('0x10')][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}_0x289fe9=_[_0x6f00('0x14')](_0x289fe9,_[_0x6f00('0x15')](properties[_0x6f00('0x16')][_0x6f00('0x17')]));_0x289fe9['action']=_0x6f00('0x18');return ami['Action'](_0x289fe9)['then'](function(_0x7c047e){_0x322116({'code':0xc8,'message':_0x7c047e[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x340f78){_0x4d5b73(_0x5e3264[_0x6f00('0x1b')](0x1f5,_0x340f78[_0x6f00('0x19')]));});});},'Command':function(_0x23fe10){var _0x295640=this;return new Promise(function(_0x9844bf,_0x198cc7){if(ami[_0x6f00('0xf')]()==![]){return _0x198cc7(_0x295640[_0x6f00('0x1b')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}_0x23fe10=_[_0x6f00('0x14')](_0x23fe10,'command');_0x23fe10[_0x6f00('0x1c')]=_0x6f00('0x1d');return ami[_0x6f00('0x1e')](_0x23fe10)[_0x6f00('0x1f')](function(_0x388983){_0x9844bf({'code':0xc8,'message':_0x388983[_0x6f00('0x20')]});})[_0x6f00('0x1a')](function(_0x1ea061){_0x198cc7(_0x295640['error'](0x1f5,_0x1ea061[_0x6f00('0x19')]));});});},'VoiceQueues':function(){return new Promise(function(_0x45945e){var _0x1fd40b=[];for(var _0x4d41ef in _0x44a0f9[_0x6f00('0x21')]){if(_0x44a0f9['voiceQueues'][_0x6f00('0x22')](_0x4d41ef)){var _0x511293=_0x44a0f9[_0x6f00('0x21')][_0x4d41ef];var _0x39375d=new VoiceQueueSummary(_0x511293);_0x1fd40b[_0x6f00('0x23')](_0x39375d);}}_0x45945e({'count':_0x1fd40b[_0x6f00('0x24')],'rows':_0x1fd40b});});},'UpdateVoiceQueue':function(_0x375d76){return new Promise(function(_0x49eb87,_0x23a346){var _0x25cc71=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x21')],{'id':parseInt(_0x375d76['id'])});var _0x2671fe=_[_0x6f00('0x26')](_0x375d76,['id']);if(_0x25cc71){for(var _0xff36ce in _0x2671fe){if(typeof _0x2671fe[_0xff36ce]!==_0x6f00('0x27')&&typeof _0x25cc71[_0xff36ce]!==_0x6f00('0x27')){_0x25cc71[_0xff36ce]=_0x2671fe[_0xff36ce];}}_0x49eb87(_0x25cc71);}else{_0x23a346();}});},'VoiceChannels':function(){return new Promise(function(_0x3f0b64){var _0x380e68=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x29')]);_0x3f0b64({'count':_0x380e68[_0x6f00('0x24')],'rows':_0x380e68});});},'VoiceChannelMixMonitor':function(_0x5dde51){var _0x5775c5=this;return new Promise(function(_0x5d16ad,_0x5df06d){if(ami['isConnected']()==![]){return _0x5df06d(_0x5775c5['error'](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk'][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}var _0x344446=schema(properties[_0x6f00('0x2a')])[_0x6f00('0x1')](_0x5dde51);if(_0x344446['length']>0x0){return _0x5df06d(_0x5775c5[_0x6f00('0x1b')](0x1f4,_[_0x6f00('0x2b')](_0x344446,_0x6f00('0x19'))[_0x6f00('0x13')](',\x20')));}var _0x4255e8=_['find'](_0x44a0f9['channels'],{'uniqueid':_0x5dde51['uniqueid']});if(_0x4255e8&&_0x4255e8[_0x6f00('0x2c')]){var _0x127569=util[_0x6f00('0x4')](_0x6f00('0x2d'),_0x5dde51[_0x6f00('0x2e')]||_0x5dde51['uniqueid'],_0x5dde51[_0x6f00('0x4')]||_0x6f00('0x2f'));return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x30'),'channel':_0x4255e8[_0x6f00('0x2c')],'file':_0x127569,'options':_0x6f00('0x31')})[_0x6f00('0x1f')](function(_0x52936d){var _0x28e436=_[_0x6f00('0x25')](_0x4255e8[_0x6f00('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x127569[_0x6f00('0x33')]()});if(_[_0x6f00('0x34')](_0x28e436)){_0x4255e8[_0x6f00('0x32')]['push']({'filename':_0x6f00('0x35')+_0x127569['toLowerCase'](),'createdAt':moment()[_0x6f00('0x4')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x52936d[_0x6f00('0x36')],'status':_0x6f00('0x37')});}else{_0x28e436[_0x6f00('0x36')]=_0x52936d[_0x6f00('0x36')];_0x28e436['status']=_0x6f00('0x37');}_0x5d16ad({'code':0xc8,'message':[_0x5dde51['uniqueid'],_0x6f00('0x38'),_0x52936d['mixmonitorid']][_0x6f00('0x13')]('\x20'),'mixmonitorid':_0x52936d[_0x6f00('0x36')]});})[_0x6f00('0x1a')](function(_0x1ed015){_0x5df06d(_0x5775c5['error'](0x1f5,[_0x5dde51['uniqueid'],_0x1ed015[_0x6f00('0x19')]['toLowerCase']()][_0x6f00('0x13')]('\x20')));});}else{return _0x5df06d(_0x5775c5[_0x6f00('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x2699af){var _0x5dce37=this;return new Promise(function(_0x4cac2c,_0x38da7f){if(ami[_0x6f00('0xf')]()==![]){return _0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk'][_0x6f00('0x11')],_0x6f00('0x12')][_0x6f00('0x13')]('\x20')));}var _0x407f35=schema(properties[_0x6f00('0x2a')])[_0x6f00('0x1')](_0x2699af);if(_0x407f35['length']>0x0){return _0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f4,_[_0x6f00('0x2b')](_0x407f35,_0x6f00('0x19'))[_0x6f00('0x13')](',\x20')));}var _0x303a32=_[_0x6f00('0x25')](_0x44a0f9['channels'],{'uniqueid':_0x2699af[_0x6f00('0x39')]});if(_0x303a32){return Promise[_0x6f00('0x3a')]()[_0x6f00('0x1f')](function(){if(_0x303a32['channel']){return ami[_0x6f00('0x1e')]({'action':'StopMixMonitor','channel':_0x303a32[_0x6f00('0x2c')],'mixmonitorid':_0x2699af[_0x6f00('0x36')]})['catch'](function(){});}})[_0x6f00('0x1f')](function(){if(_0x303a32['destinationchannel']){return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x3b'),'channel':_0x303a32[_0x6f00('0x3c')],'mixmonitorid':_0x2699af[_0x6f00('0x36')]})['catch'](function(){});}})[_0x6f00('0x1f')](function(){var _0x59085a=_[_0x6f00('0x25')](_0x303a32['monitors'],{'mixmonitorid':_0x2699af[_0x6f00('0x36')]});if(_0x59085a){_0x59085a[_0x6f00('0x3d')]=_0x6f00('0x3e');}})[_0x6f00('0x1f')](function(){var _0x470ff3=util[_0x6f00('0x4')](_0x6f00('0x2d'),_0x2699af[_0x6f00('0x2e')]||_0x2699af['uniqueid'],_0x2699af[_0x6f00('0x4')]||'wav');var _0x265666=_[_0x6f00('0x25')](_0x303a32[_0x6f00('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x470ff3['toLowerCase']()});if(_0x265666){_0x265666[_0x6f00('0x3d')]=_0x6f00('0x3e');}})['then'](function(){_0x4cac2c({'code':0xc8,'message':[_0x2699af[_0x6f00('0x39')],'StopMixMonitor\x20Success'][_0x6f00('0x13')]('\x20')});})['catch'](function(_0x21ef05){_0x38da7f(_0x5dce37[_0x6f00('0x1b')](0x1f5,[_0x2699af['uniqueid'],_0x21ef05['message'][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')));});}else{return _0x38da7f(_0x5dce37['error'](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannels':function(_0x5c1ad7){var _0x32a4e1=this;return new Promise(function(_0x7f80ed){var _0x3100ee=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x40')]);var _0x7bbc78={'count':_0x3100ee[_0x6f00('0x24')],'rows':_0x3100ee};if(_0x5c1ad7&&_0x5c1ad7[_0x6f00('0x41')]){if(![_0x6f00('0x42'),_0x6f00('0x43')][_0x6f00('0x44')](_0x5c1ad7[_0x6f00('0x41')])){return _0x3c29ff(_0x32a4e1[_0x6f00('0x1b')](0x190,_0x6f00('0x45')));}var _0x2a1bda=_[_0x6f00('0x46')](_0x3100ee,function(_0x2ba83e){return _0x2ba83e[_0x6f00('0x41')]===_0x5c1ad7[_0x6f00('0x41')];});_0x7bbc78[_0x6f00('0x47')]=_0x2a1bda['length'];_0x7bbc78['rows']=_0x2a1bda;}_0x7f80ed(_0x7bbc78);});},'VoiceQueuesChannel':function(_0x13f299){var _0x5eda94=this;return new Promise(function(_0x1bbd46,_0xd0bf75){var _0x4edd9f=schema(properties[_0x6f00('0x48')])[_0x6f00('0x1')](_0x13f299);if(_0x4edd9f[_0x6f00('0x24')]>0x0){return _0xd0bf75(_0x5eda94['error'](0x1f4,_[_0x6f00('0x2b')](_0x4edd9f,'message')[_0x6f00('0x13')](',\x20')));}var _0x19a99c=_['find'](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x13f299[_0x6f00('0x39')]});if(_0x19a99c){_0x1bbd46(_0x19a99c);}else{return _0xd0bf75(_0x5eda94[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannelHangup':function(_0x3cf1a5){var _0x1bb9f5=this;return new Promise(function(_0x2f8720,_0x4a4905){if(ami['isConnected']()==![]){return _0x4a4905(_0x1bb9f5['error'](0x1f4,[config['asterisk']['ip'],config[_0x6f00('0x10')][_0x6f00('0x11')],'ami\x20disconnected']['join']('\x20')));}var _0x120674=schema(properties[_0x6f00('0x49')])[_0x6f00('0x1')](_0x3cf1a5);if(_0x120674[_0x6f00('0x24')]>0x0){return _0x4a4905(_0x1bb9f5['error'](0x1f4,_[_0x6f00('0x2b')](_0x120674,'message')['join'](',\x20')));}var _0x419f32=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x3cf1a5[_0x6f00('0x39')]});if(_0x419f32&&_0x419f32[_0x6f00('0x2c')]){return ami['Action']({'action':_0x6f00('0x4a'),'channel':_0x419f32[_0x6f00('0x2c')]})[_0x6f00('0x1f')](function(_0xa21d60){_0x2f8720({'code':0xc8,'message':[_0x3cf1a5['uniqueid'],_0xa21d60['message'][_0x6f00('0x33')]()]['join']('\x20')});})[_0x6f00('0x1a')](function(_0x67c198){_0x4a4905(_0x1bb9f5[_0x6f00('0x1b')](0x1f5,[_0x3cf1a5[_0x6f00('0x39')],_0x67c198['message']['toLowerCase']()][_0x6f00('0x13')]('\x20')));});}else{return _0x4a4905(_0x1bb9f5[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x1f19c0){var _0x555bb1=this;return new Promise(function(_0x14554c,_0x37af94){if(ami[_0x6f00('0xf')]()==![]){return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f4,[config[_0x6f00('0x10')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6f00('0x13')]('\x20')));}var _0x3ca0af=schema(properties['voicequeuechannelredirect'])['validate'](_0x1f19c0);if(_0x3ca0af[_0x6f00('0x24')]>0x0){return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f4,_['map'](_0x3ca0af,'message')[_0x6f00('0x13')](',\x20')));}var _0x201795=_[_0x6f00('0x25')](_0x44a0f9[_0x6f00('0x40')],{'uniqueid':_0x1f19c0[_0x6f00('0x39')]});if(_0x201795&&_0x201795[_0x6f00('0x2c')]){return ami[_0x6f00('0x1e')]({'action':_0x6f00('0x4b'),'channel':_0x201795['channel'],'exten':_0x1f19c0['exten'],'context':_0x1f19c0[_0x6f00('0x4c')]||_0x201795[_0x6f00('0x4c')],'priority':0x1})[_0x6f00('0x1f')](function(_0x36742b){_0x14554c({'code':0xc8,'message':[_0x1f19c0[_0x6f00('0x39')],_0x36742b[_0x6f00('0x19')][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')});})[_0x6f00('0x1a')](function(_0xeaa3ca){_0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f5,[_0x1f19c0[_0x6f00('0x39')],_0xeaa3ca[_0x6f00('0x19')][_0x6f00('0x33')]()][_0x6f00('0x13')]('\x20')));});}else{return _0x37af94(_0x555bb1[_0x6f00('0x1b')](0x1f5,_0x6f00('0x3f')));}});},'Agents':function(_0x4f2ce8){return new Promise(function(_0x58321e){var _0x28bdeb=_['values'](_0x44a0f9[_0x6f00('0xb')]);if(_0x4f2ce8&&_0x4f2ce8['id']){var _0x46e8a5=_[_0x6f00('0x25')](_0x28bdeb,function(_0x8904ae){return _0x8904ae['id']===_0x4f2ce8['id'];});_0x58321e(_0x46e8a5);}else{_0x58321e({'count':_0x28bdeb[_0x6f00('0x24')],'rows':_0x28bdeb});}});},'Telephones':function(){return new Promise(function(_0x5a4a18){var _0x25420e=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x4d')]);_0x5a4a18({'count':_0x25420e[_0x6f00('0x24')],'rows':_0x25420e});});},'Trunks':function(){return new Promise(function(_0x23260e){var _0xd1f5a8=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x4e')]);_0x23260e({'count':_0xd1f5a8[_0x6f00('0x24')],'rows':_0xd1f5a8});});},'OutboundChannels':function(){return new Promise(function(_0x1cc857){var _0x19b5eb=_['values'](_0x44a0f9[_0x6f00('0x4f')]);_0x1cc857({'count':_0x19b5eb[_0x6f00('0x24')],'rows':_0x19b5eb});});},'Outbound':function(){return new Promise(function(_0x422318){_0x422318(_0x44a0f9['outbound']);});},'Campaigns':function(){return new Promise(function(_0x576927){var _0xab1d07=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x50')]);_0x576927({'count':_0xab1d07[_0x6f00('0x24')],'rows':_0xab1d07});});},'VoiceQueuesPreview':function(_0x5a9b42){var _0x564625=this;return new Promise(function(_0x4cb62d,_0x5089a5){_0x402677[_0x6f00('0x51')](_0x5a9b42['id'])[_0x6f00('0x1f')](function(_0x3fb141){_0x4cb62d({'code':0xc8,'message':_0x3fb141[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x505746){_0x5089a5(_0x564625[_0x6f00('0x1b')](0x1f4,_0x505746[_0x6f00('0x19')]));});});},'EventManager':function(_0x538143){var _0xf8a1b6=this;return new Promise(function(_0x220711,_0x418af1){if(!_0x538143[_0x6f00('0x52')]){return _0x418af1(_0xf8a1b6[_0x6f00('0x1b')](0x1f4,_0x6f00('0x53')));}ami[_0x6f00('0x54')](_0x6f00('0x55')+_0x538143['event'],_0x538143[_0x6f00('0x19')]);_0x220711({'code':0xc8,'message':_0x538143});});},'FaxAccounts':function(){return new Promise(function(_0x552bee){var _0x426f41=_[_0x6f00('0x28')](_0x44a0f9[_0x6f00('0x56')]);_0x552bee({'count':_0x426f41[_0x6f00('0x24')],'rows':_0x426f41});});},'SendFax':function(_0x1ad295){var _0x1468ca=this;return new Promise(function(_0x2d1c2b,_0x3a2dad){_0x141e71[_0x6f00('0x57')](_0x1ad295)[_0x6f00('0x1f')](function(_0x1de592){_0x2d1c2b({'code':0xc8,'message':_0x1de592[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x31e3f4){_0x3a2dad(_0x1468ca['error'](0x1f4,_0x31e3f4[_0x6f00('0x19')]));});});},'CheckAfterSend':function(_0xdfa8ff){var _0x1be439=this;return new Promise(function(_0x523476,_0x6cfc80){_0x141e71[_0x6f00('0x58')](_0xdfa8ff)['then'](function(_0x30f620){_0x523476({'code':0xc8,'message':_0x30f620[_0x6f00('0x19')]});})[_0x6f00('0x1a')](function(_0x28ed94){_0x6cfc80(_0x1be439['error'](0x1f4,_0x28ed94['message']));});});}};var _0x4e3fd8=jayson[_0x6f00('0x59')](_0x4f918f)[_0x6f00('0x5a')]();_0x4e3fd8['on'](_0x6f00('0x1b'),function(_0x19eb2c){return _0x3c29ff(_0x19eb2c);});_0x4e3fd8['listen'](0x232a,_0x6f00('0x5b'),function(){console[_0x6f00('0x5c')](_0x6f00('0x5d'),0x232a);return _0x52c9a2(_0x6f00('0x5e')+0x232a);});});}; \ No newline at end of file +var _0x2123=['rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','StopMixMonitor\x20Success','queueChannels','inbound','outbound','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','custom:','faxAccounts','send','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','Command','content','catch','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid'];(function(_0xc4d1c6,_0x4b6ee9){var _0xfd4b3b=function(_0x111b7a){while(--_0x111b7a){_0xc4d1c6['push'](_0xc4d1c6['shift']());}};_0xfd4b3b(++_0x4b6ee9);}(_0x2123,0x190));var _0x3212=function(_0x51aec3,_0x1116fe){_0x51aec3=_0x51aec3-0x0;var _0x45b5e7=_0x2123[_0x51aec3];return _0x45b5e7;};'use strict';var _=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var jayson=require(_0x3212('0x2'));var schema=require(_0x3212('0x3'));var moment=require(_0x3212('0x4'));var config=require(_0x3212('0x5'));var properties=require(_0x3212('0x6'));var ami=require(_0x3212('0x7'));var VoiceQueueSummary=require(_0x3212('0x8'));exports[_0x3212('0x9')]=function(_0x37058e,_0x265328,_0x5d9d36){return new Promise(function(_0x3859e4,_0x2b1302){var _0x1fec5d={'QueuePause':function(_0x4b35e9){return new Promise(function(_0x3e17a3){var _0x56c38f=util[_0x3212('0xa')](_0x3212('0xb'),_0x3212('0xc'),_0x4b35e9[_0x3212('0xd')]);if(_0x37058e['timers']&&_0x37058e['timers'][_0x56c38f]&&_0x37058e[_0x3212('0xe')][_0x56c38f][_0x3212('0xf')]){_0x37058e[_0x3212('0xe')][_0x56c38f][_0x3212('0x10')]();}if(_0x37058e[_0x3212('0x11')][_0x56c38f]){_0x37058e[_0x3212('0x11')][_0x56c38f][_0x3212('0x12')]({'statePause':_0x4b35e9[_0x3212('0x13')]?!![]:![]});}_0x3e17a3({'code':0xc8,'message':_0x3212('0x14')});});},'Reload':function(_0x2d5fce){var _0x40745f=this;return new Promise(function(_0x2e4cf0,_0x9f0bc){if(ami[_0x3212('0x15')]()==![]){return _0x9f0bc(_0x40745f[_0x3212('0x16')](0x1f4,[config[_0x3212('0x17')]['ip'],config[_0x3212('0x17')][_0x3212('0x18')],_0x3212('0x19')][_0x3212('0x1a')]('\x20')));}_0x2d5fce=_[_0x3212('0x1b')](_0x2d5fce,_[_0x3212('0x1c')](properties['reload'][_0x3212('0x1d')]));_0x2d5fce[_0x3212('0x1e')]=_0x3212('0x1f');return ami[_0x3212('0x20')](_0x2d5fce)[_0x3212('0x21')](function(_0x34ce95){_0x2e4cf0({'code':0xc8,'message':_0x34ce95[_0x3212('0x22')]});})['catch'](function(_0x4c1158){_0x9f0bc(_0x40745f[_0x3212('0x16')](0x1f5,_0x4c1158['message']));});});},'Command':function(_0x2380e8){var _0x41237c=this;return new Promise(function(_0xb0b717,_0x28a4cd){if(ami[_0x3212('0x15')]()==![]){return _0x28a4cd(_0x41237c['error'](0x1f4,[config[_0x3212('0x17')]['ip'],config[_0x3212('0x17')]['username'],_0x3212('0x19')][_0x3212('0x1a')]('\x20')));}_0x2380e8=_[_0x3212('0x1b')](_0x2380e8,'command');_0x2380e8['action']=_0x3212('0x23');return ami[_0x3212('0x20')](_0x2380e8)[_0x3212('0x21')](function(_0x3b1c35){_0xb0b717({'code':0xc8,'message':_0x3b1c35[_0x3212('0x24')]});})[_0x3212('0x25')](function(_0x47d941){_0x28a4cd(_0x41237c['error'](0x1f5,_0x47d941[_0x3212('0x22')]));});});},'VoiceQueues':function(){return new Promise(function(_0x47cfdc){var _0x24cdf3=[];for(var _0x3108a6 in _0x37058e[_0x3212('0x26')]){if(_0x37058e['voiceQueues'][_0x3212('0x27')](_0x3108a6)){var _0x32f7fd=_0x37058e[_0x3212('0x26')][_0x3108a6];var _0x4de92e=new VoiceQueueSummary(_0x32f7fd);_0x24cdf3[_0x3212('0x28')](_0x4de92e);}}_0x47cfdc({'count':_0x24cdf3[_0x3212('0x29')],'rows':_0x24cdf3});});},'UpdateVoiceQueue':function(_0x108eee){return new Promise(function(_0x443a5,_0x21f003){var _0x1638c5=_[_0x3212('0x2a')](_0x37058e[_0x3212('0x26')],{'id':parseInt(_0x108eee['id'])});var _0x1de338=_[_0x3212('0x2b')](_0x108eee,['id']);if(_0x1638c5){for(var _0x31c672 in _0x1de338){if(typeof _0x1de338[_0x31c672]!==_0x3212('0x2c')&&typeof _0x1638c5[_0x31c672]!=='undefined'){_0x1638c5[_0x31c672]=_0x1de338[_0x31c672];}}_0x443a5(_0x1638c5);}else{_0x21f003();}});},'VoiceChannels':function(){return new Promise(function(_0x1e2660){var _0x265368=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x2e')]);_0x1e2660({'count':_0x265368[_0x3212('0x29')],'rows':_0x265368});});},'VoiceChannelMixMonitor':function(_0x309420){var _0x3a7883=this;return new Promise(function(_0x5059bd,_0x3cbd1a){if(ami['isConnected']()==![]){return _0x3cbd1a(_0x3a7883[_0x3212('0x16')](0x1f4,[config['asterisk']['ip'],config[_0x3212('0x17')]['username'],'ami\x20disconnected'][_0x3212('0x1a')]('\x20')));}var _0x571ae0=schema(properties[_0x3212('0x2f')])[_0x3212('0x3')](_0x309420);if(_0x571ae0[_0x3212('0x29')]>0x0){return _0x3cbd1a(_0x3a7883['error'](0x1f4,_[_0x3212('0x30')](_0x571ae0,_0x3212('0x22'))[_0x3212('0x1a')](',\x20')));}var _0x487ce4=_[_0x3212('0x2a')](_0x37058e[_0x3212('0x2e')],{'uniqueid':_0x309420[_0x3212('0x31')]});if(_0x487ce4&&_0x487ce4[_0x3212('0x32')]){var _0xc690c4=util['format'](_0x3212('0x33'),_0x309420[_0x3212('0x34')]||_0x309420[_0x3212('0x31')],_0x309420['format']||_0x3212('0x35'));return ami[_0x3212('0x20')]({'action':_0x3212('0x36'),'channel':_0x487ce4[_0x3212('0x32')],'file':_0xc690c4,'options':'ai(mixmonitorid)'})[_0x3212('0x21')](function(_0x3f157c){var _0xf5d848=_[_0x3212('0x2a')](_0x487ce4['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0xc690c4['toLowerCase']()});if(_['isNil'](_0xf5d848)){_0x487ce4[_0x3212('0x37')][_0x3212('0x28')]({'filename':_0x3212('0x38')+_0xc690c4[_0x3212('0x39')](),'createdAt':moment()['format'](_0x3212('0x3a')),'mixmonitorid':_0x3f157c[_0x3212('0x3b')],'status':_0x3212('0x3c')});}else{_0xf5d848[_0x3212('0x3b')]=_0x3f157c['mixmonitorid'];_0xf5d848['status']=_0x3212('0x3c');}_0x5059bd({'code':0xc8,'message':[_0x309420[_0x3212('0x31')],_0x3212('0x3d'),_0x3f157c[_0x3212('0x3b')]][_0x3212('0x1a')]('\x20'),'mixmonitorid':_0x3f157c[_0x3212('0x3b')]});})[_0x3212('0x25')](function(_0x52860f){_0x3cbd1a(_0x3a7883[_0x3212('0x16')](0x1f5,[_0x309420[_0x3212('0x31')],_0x52860f[_0x3212('0x22')][_0x3212('0x39')]()]['join']('\x20')));});}else{return _0x3cbd1a(_0x3a7883[_0x3212('0x16')](0x1f5,_0x3212('0x3e')));}});},'VoiceChannelStopMixMonitor':function(_0x1c71f7){var _0x262564=this;return new Promise(function(_0x572429,_0xb365f7){if(ami['isConnected']()==![]){return _0xb365f7(_0x262564[_0x3212('0x16')](0x1f4,[config[_0x3212('0x17')]['ip'],config[_0x3212('0x17')][_0x3212('0x18')],_0x3212('0x19')][_0x3212('0x1a')]('\x20')));}var _0x14626d=schema(properties[_0x3212('0x2f')])['validate'](_0x1c71f7);if(_0x14626d[_0x3212('0x29')]>0x0){return _0xb365f7(_0x262564[_0x3212('0x16')](0x1f4,_[_0x3212('0x30')](_0x14626d,_0x3212('0x22'))[_0x3212('0x1a')](',\x20')));}var _0x36ccb2=_[_0x3212('0x2a')](_0x37058e['channels'],{'uniqueid':_0x1c71f7[_0x3212('0x31')]});if(_0x36ccb2){return Promise[_0x3212('0x3f')]()[_0x3212('0x21')](function(){if(_0x36ccb2[_0x3212('0x32')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x36ccb2['channel'],'mixmonitorid':_0x1c71f7['mixmonitorid']})[_0x3212('0x25')](function(){});}})['then'](function(){if(_0x36ccb2[_0x3212('0x40')]){return ami[_0x3212('0x20')]({'action':_0x3212('0x41'),'channel':_0x36ccb2[_0x3212('0x40')],'mixmonitorid':_0x1c71f7['mixmonitorid']})[_0x3212('0x25')](function(){});}})[_0x3212('0x21')](function(){var _0x75286f=_['find'](_0x36ccb2[_0x3212('0x37')],{'mixmonitorid':_0x1c71f7[_0x3212('0x3b')]});if(_0x75286f){_0x75286f[_0x3212('0x42')]=_0x3212('0x43');}})['then'](function(){var _0x3ede8c=util[_0x3212('0xa')]('%s.%s',_0x1c71f7[_0x3212('0x34')]||_0x1c71f7[_0x3212('0x31')],_0x1c71f7[_0x3212('0xa')]||'wav');var _0x4c87d7=_[_0x3212('0x2a')](_0x36ccb2[_0x3212('0x37')],{'filename':_0x3212('0x38')+_0x3ede8c['toLowerCase']()});if(_0x4c87d7){_0x4c87d7[_0x3212('0x42')]=_0x3212('0x43');}})['then'](function(){_0x572429({'code':0xc8,'message':[_0x1c71f7[_0x3212('0x31')],_0x3212('0x44')][_0x3212('0x1a')]('\x20')});})['catch'](function(_0x523310){_0xb365f7(_0x262564[_0x3212('0x16')](0x1f5,[_0x1c71f7[_0x3212('0x31')],_0x523310[_0x3212('0x22')][_0x3212('0x39')]()]['join']('\x20')));});}else{return _0xb365f7(_0x262564[_0x3212('0x16')](0x1f5,_0x3212('0x3e')));}});},'VoiceQueuesChannels':function(_0x3ab8c0){var _0x541998=this;return new Promise(function(_0x1e77b3){var _0x4ff331=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x45')]);var _0x3304db={'count':_0x4ff331[_0x3212('0x29')],'rows':_0x4ff331};if(_0x3ab8c0&&_0x3ab8c0['type']){if(![_0x3212('0x46'),_0x3212('0x47')]['includes'](_0x3ab8c0[_0x3212('0x48')])){return _0x2b1302(_0x541998[_0x3212('0x16')](0x190,_0x3212('0x49')));}var _0x1639df=_[_0x3212('0x4a')](_0x4ff331,function(_0x1fa578){return _0x1fa578[_0x3212('0x48')]===_0x3ab8c0['type'];});_0x3304db[_0x3212('0x4b')]=_0x1639df[_0x3212('0x29')];_0x3304db[_0x3212('0x4c')]=_0x1639df;}_0x1e77b3(_0x3304db);});},'VoiceQueuesChannel':function(_0x8f9c82){var _0x54a6df=this;return new Promise(function(_0x5a6050,_0x5abdf6){var _0x52a506=schema(properties[_0x3212('0x4d')])['validate'](_0x8f9c82);if(_0x52a506[_0x3212('0x29')]>0x0){return _0x5abdf6(_0x54a6df[_0x3212('0x16')](0x1f4,_[_0x3212('0x30')](_0x52a506,_0x3212('0x22'))[_0x3212('0x1a')](',\x20')));}var _0x33120d=_[_0x3212('0x2a')](_0x37058e[_0x3212('0x45')],{'uniqueid':_0x8f9c82[_0x3212('0x31')]});if(_0x33120d){_0x5a6050(_0x33120d);}else{return _0x5abdf6(_0x54a6df[_0x3212('0x16')](0x1f5,_0x3212('0x3e')));}});},'VoiceQueuesChannelHangup':function(_0x587fc2){var _0x51751b=this;return new Promise(function(_0x5a8158,_0x1f111a){if(ami[_0x3212('0x15')]()==![]){return _0x1f111a(_0x51751b[_0x3212('0x16')](0x1f4,[config[_0x3212('0x17')]['ip'],config[_0x3212('0x17')][_0x3212('0x18')],'ami\x20disconnected']['join']('\x20')));}var _0x16867a=schema(properties[_0x3212('0x4e')])['validate'](_0x587fc2);if(_0x16867a['length']>0x0){return _0x1f111a(_0x51751b[_0x3212('0x16')](0x1f4,_[_0x3212('0x30')](_0x16867a,'message')[_0x3212('0x1a')](',\x20')));}var _0x1b3c60=_[_0x3212('0x2a')](_0x37058e[_0x3212('0x45')],{'uniqueid':_0x587fc2[_0x3212('0x31')]});if(_0x1b3c60&&_0x1b3c60['channel']){return ami[_0x3212('0x20')]({'action':_0x3212('0x4f'),'channel':_0x1b3c60[_0x3212('0x32')]})[_0x3212('0x21')](function(_0x581eb8){_0x5a8158({'code':0xc8,'message':[_0x587fc2[_0x3212('0x31')],_0x581eb8[_0x3212('0x22')][_0x3212('0x39')]()]['join']('\x20')});})[_0x3212('0x25')](function(_0x83a499){_0x1f111a(_0x51751b[_0x3212('0x16')](0x1f5,[_0x587fc2[_0x3212('0x31')],_0x83a499['message'][_0x3212('0x39')]()][_0x3212('0x1a')]('\x20')));});}else{return _0x1f111a(_0x51751b[_0x3212('0x16')](0x1f5,_0x3212('0x3e')));}});},'VoiceQueuesChannelRedirect':function(_0x49afb3){var _0x8564fa=this;return new Promise(function(_0x3f35a9,_0x4162ae){if(ami[_0x3212('0x15')]()==![]){return _0x4162ae(_0x8564fa['error'](0x1f4,[config[_0x3212('0x17')]['ip'],config[_0x3212('0x17')][_0x3212('0x18')],_0x3212('0x19')][_0x3212('0x1a')]('\x20')));}var _0x3ae978=schema(properties[_0x3212('0x50')])[_0x3212('0x3')](_0x49afb3);if(_0x3ae978[_0x3212('0x29')]>0x0){return _0x4162ae(_0x8564fa['error'](0x1f4,_['map'](_0x3ae978,_0x3212('0x22'))[_0x3212('0x1a')](',\x20')));}var _0x4a8d7e=_[_0x3212('0x2a')](_0x37058e[_0x3212('0x45')],{'uniqueid':_0x49afb3[_0x3212('0x31')]});if(_0x4a8d7e&&_0x4a8d7e[_0x3212('0x32')]){return ami['Action']({'action':_0x3212('0x51'),'channel':_0x4a8d7e[_0x3212('0x32')],'exten':_0x49afb3[_0x3212('0x52')],'context':_0x49afb3[_0x3212('0x53')]||_0x4a8d7e[_0x3212('0x53')],'priority':0x1})[_0x3212('0x21')](function(_0x59ebc2){_0x3f35a9({'code':0xc8,'message':[_0x49afb3[_0x3212('0x31')],_0x59ebc2[_0x3212('0x22')]['toLowerCase']()]['join']('\x20')});})[_0x3212('0x25')](function(_0xfd4d70){_0x4162ae(_0x8564fa[_0x3212('0x16')](0x1f5,[_0x49afb3[_0x3212('0x31')],_0xfd4d70[_0x3212('0x22')]['toLowerCase']()][_0x3212('0x1a')]('\x20')));});}else{return _0x4162ae(_0x8564fa[_0x3212('0x16')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xa7fb5){return new Promise(function(_0x41af6d){var _0x4e43dd=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x11')]);if(_0xa7fb5&&_0xa7fb5['id']){var _0x1653b0=_['find'](_0x4e43dd,function(_0x304e0a){return _0x304e0a['id']===_0xa7fb5['id'];});_0x41af6d(_0x1653b0);}else{_0x41af6d({'count':_0x4e43dd['length'],'rows':_0x4e43dd});}});},'Telephones':function(){return new Promise(function(_0x593d31){var _0x58b9ad=_[_0x3212('0x2d')](_0x37058e['telephones']);_0x593d31({'count':_0x58b9ad[_0x3212('0x29')],'rows':_0x58b9ad});});},'Trunks':function(){return new Promise(function(_0x53ef60){var _0x30c897=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x54')]);_0x53ef60({'count':_0x30c897[_0x3212('0x29')],'rows':_0x30c897});});},'OutboundChannels':function(){return new Promise(function(_0x99fb9b){var _0x5aa666=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x55')]);_0x99fb9b({'count':_0x5aa666[_0x3212('0x29')],'rows':_0x5aa666});});},'Outbound':function(){return new Promise(function(_0x3ed543){_0x3ed543(_0x37058e[_0x3212('0x47')]);});},'Campaigns':function(){return new Promise(function(_0xba63){var _0x5c6a97=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x56')]);_0xba63({'count':_0x5c6a97[_0x3212('0x29')],'rows':_0x5c6a97});});},'VoiceQueuesPreview':function(_0x1d9afc){var _0x45c5ec=this;return new Promise(function(_0xe68c69,_0x1de5ea){_0x265328[_0x3212('0x57')](_0x1d9afc['id'])[_0x3212('0x21')](function(_0x3365d3){_0xe68c69({'code':0xc8,'message':_0x3365d3['message']});})['catch'](function(_0x10e970){_0x1de5ea(_0x45c5ec[_0x3212('0x16')](0x1f4,_0x10e970['message']));});});},'EventManager':function(_0x2addc5){var _0x5db3ec=this;return new Promise(function(_0x513e7a,_0x544134){if(!_0x2addc5['event']){return _0x544134(_0x5db3ec['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x3212('0x58')+_0x2addc5['event'],_0x2addc5[_0x3212('0x22')]);_0x513e7a({'code':0xc8,'message':_0x2addc5});});},'FaxAccounts':function(){return new Promise(function(_0x221882){var _0x20a308=_[_0x3212('0x2d')](_0x37058e[_0x3212('0x59')]);_0x221882({'count':_0x20a308[_0x3212('0x29')],'rows':_0x20a308});});},'SendFax':function(_0x566ea2){var _0xa21686=this;return new Promise(function(_0x1e4a42,_0x5a95ff){_0x5d9d36[_0x3212('0x5a')](_0x566ea2)[_0x3212('0x21')](function(_0x177a58){_0x1e4a42({'code':0xc8,'message':_0x177a58['message']});})[_0x3212('0x25')](function(_0x4c8dc8){_0x5a95ff(_0xa21686[_0x3212('0x16')](0x1f4,_0x4c8dc8[_0x3212('0x22')]));});});},'CheckAfterSend':function(_0x56b939){var _0x5488aa=this;return new Promise(function(_0x52062c,_0xde26b1){_0x5d9d36['checkAfterSend'](_0x56b939)['then'](function(_0x45fe83){_0x52062c({'code':0xc8,'message':_0x45fe83[_0x3212('0x22')]});})[_0x3212('0x25')](function(_0xef13c0){_0xde26b1(_0x5488aa[_0x3212('0x16')](0x1f4,_0xef13c0[_0x3212('0x22')]));});});}};var _0x4f24ad=jayson['server'](_0x1fec5d)['http']();_0x4f24ad['on']('error',function(_0x467458){return _0x2b1302(_0x467458);});_0x4f24ad[_0x3212('0x9')](0x232a,'127.0.0.1',function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3859e4(_0x3212('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 115d7c2..f6592d6 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 _0xafc8=['getContacts','isEmpty','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','length','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','then'];(function(_0x11cf41,_0x3172b6){var _0x4e6a37=function(_0x1a2f20){while(--_0x1a2f20){_0x11cf41['push'](_0x11cf41['shift']());}};_0x4e6a37(++_0x3172b6);}(_0xafc8,0x15a));var _0x8afc=function(_0x5c234f,_0x37dabc){_0x5c234f=_0x5c234f-0x0;var _0x1b3ba6=_0xafc8[_0x5c234f];return _0x1b3ba6;};'use strict';var _=require('lodash');var BPromise=require(_0x8afc('0x0'));var Redis=require(_0x8afc('0x1'));var util=require(_0x8afc('0x2'));var config=require('../../../../config/environment');var logger=require(_0x8afc('0x3'))(_0x8afc('0x4'));var cmContactRpc=require(_0x8afc('0x5'));config[_0x8afc('0x6')]=_['defaults'](config[_0x8afc('0x6')],{'host':_0x8afc('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8afc('0x6')]));function emit(_0x5609ea,_0x5ba1a4,_0x1ad6a1,_0x2180cf,_0x3c5b87){logger[_0x8afc('0x8')](_0x8afc('0x9'),_0x5609ea,_0x5ba1a4['id'],_0x1ad6a1,_0x2180cf,JSON[_0x8afc('0xa')](_0x3c5b87));io['to'](_0x1ad6a1)['emit'](_0x2180cf,_0x3c5b87);}exports[_0x8afc('0xb')]=function(_0x55d01a,_0x44ec03,_0x5681f1,_0x9a2754){var _0xa50be4,_0x1c2527;var _0x4107e7={};var _0x535328;var _0x1ebfe0=Number(_0x5681f1[_0x8afc('0xc')]);var _0x52f19e=_0x5681f1['data2']?Boolean(Number(_0x5681f1[_0x8afc('0xd')])):![];var _0x452dc9;var _0x1c1c80=![];if(!_['isNil'](_0x5681f1['data5'])){if(_0x5681f1[_0x8afc('0xe')]=='1')_0x1c1c80=!![];}if(!_0x1c1c80){if(_0x9a2754[_0x8afc('0xf')]){_0x4107e7['id']=_0x9a2754['xmd-contactid'];}}if(!_0x4107e7['id']){_0x4107e7[_0x8afc('0x10')]=_0x1ebfe0;_0x452dc9=_0x5681f1[_0x8afc('0x11')]&&_0x5681f1[_0x8afc('0x11')]!=='0'?_0x5681f1['data3']['split'](','):[_0x8afc('0x12')];_0x4107e7[_0x8afc('0x13')]=_[_0x8afc('0x14')](_0x452dc9,function(_0x40a255){var _0x1319d9={};_0x1319d9[_0x40a255]=_0x9a2754[_0x8afc('0x15')]?_0x9a2754[_0x8afc('0x16')]:_0x9a2754[_0x8afc('0x17')];return _0x1319d9;});_0x535328=_0x9a2754[_0x8afc('0x15')]?_0x9a2754[_0x8afc('0x16')]:_0x9a2754[_0x8afc('0x17')];}var _0x717467=['id',_0x8afc('0x18'),_0x8afc('0x19'),_0x8afc('0x12'),_0x8afc('0x1a'),'fax','ListId','createdAt',_0x8afc('0x1b'),_0x8afc('0x1c')];var _0x424eb1=_[_0x8afc('0x1d')](_0x717467,_0x452dc9);BPromise[_0x8afc('0x1e')]()[_0x8afc('0x1f')](cmContactRpc[_0x8afc('0x20')]({'attributes':_0x424eb1,'where':_0x4107e7,'phone':_0x535328}))[_0x8afc('0x1f')](function(_0x4a1727){_0x1c2527=_0x4a1727;if(!_[_0x8afc('0x21')](_0x1c2527)){if(_0x1c2527['length']===0x1){_0xa50be4=_0x1c2527[0x0];logger[_0x8afc('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x9a2754[_0x8afc('0x22')],_0x44ec03['id'],_0xa50be4['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9a2754['uniqueid'],_0x44ec03['id'],_[_0x8afc('0x14')](_0x1c2527,'id')[_0x8afc('0x23')](','));}return;}else{logger[_0x8afc('0x8')](_0x8afc('0x24'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);var _0x1971b5={'ListId':_0x1ebfe0};var _0xf86e27=_0x5681f1[_0x8afc('0x25')]&&_0x5681f1[_0x8afc('0x25')]!=='0'?_0x5681f1['data4']:'phone';if(_0x52f19e){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);_0x1971b5[_0xf86e27]=_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])?_0x9a2754[_0x8afc('0x17')]:_0x9a2754[_0x8afc('0x16')];if(_['isNil'](_0x9a2754[_0x8afc('0x15')])){_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x27')]&&_0x9a2754[_0x8afc('0x27')]!==_0x8afc('0x28')?_0x9a2754['calleridname']:_0x8afc('0x29');}else{_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x2a')]&&_0x9a2754['destcalleridname']!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x2a')]:_0x8afc('0x29');}return BPromise[_0x8afc('0x1e')]()[_0x8afc('0x1f')](cmContactRpc[_0x8afc('0x2b')](_0x1971b5))['then'](function(_0x22bec3){_0xa50be4=_0x22bec3;_0x1c2527[_0x8afc('0x2c')](_0x22bec3);if(_0xa50be4){logger[_0x8afc('0x8')](_0x8afc('0x2d'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id'],_0xa50be4['id']);}return;});}else{logger[_0x8afc('0x8')](_0x8afc('0x2e'),_0x9a2754[_0x8afc('0x22')],_0x44ec03['id']);_0x1971b5[_0xf86e27]=_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])?_0x9a2754['calleridnum']:_0x9a2754[_0x8afc('0x16')];if(_[_0x8afc('0x26')](_0x9a2754[_0x8afc('0x15')])){_0x1971b5['firstName']=_0x9a2754[_0x8afc('0x27')]&&_0x9a2754[_0x8afc('0x27')]!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x27')]:_0x8afc('0x29');}else{_0x1971b5['firstName']=_0x9a2754['destcalleridname']&&_0x9a2754[_0x8afc('0x2a')]!==_0x8afc('0x28')?_0x9a2754[_0x8afc('0x2a')]:_0x8afc('0x29');}_0xa50be4=_0x1971b5;_0x1c2527[_0x8afc('0x2c')](_0x1971b5);return;}}})['then'](function(){if(_0x55d01a){emit(_0x9a2754['uniqueid'],_0x44ec03,util['format']('user:%s',_0x55d01a[_0x8afc('0x2f')]),util[_0x8afc('0x30')](_0x8afc('0x31'),_0x5681f1[_0x8afc('0x32')][_0x8afc('0x33')]()),{'evt':_[_0x8afc('0x34')](_0x9a2754,{'autoCreate':_0x52f19e}),'contact':_0xa50be4===undefined?{}:_0xa50be4,'contacts':_0x1c2527[_0x8afc('0x35')]===0x0?undefined:_0x1c2527});}});}; \ No newline at end of file +var _0xabc8=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','action','toLowerCase','lodash','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','data5','data3','split','phone','map','routeId','calleridnum','destcalleridnum','firstName','mobile','fax','ListId','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x168f94,_0x55bd48){var _0x598305=function(_0x401613){while(--_0x401613){_0x168f94['push'](_0x168f94['shift']());}};_0x598305(++_0x55bd48);}(_0xabc8,0x7a));var _0x8abc=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xabc8[_0x50cfc3];return _0x5c11ef;};'use strict';var _=require(_0x8abc('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0x8abc('0x1'));var config=require(_0x8abc('0x2'));var logger=require(_0x8abc('0x3'))(_0x8abc('0x4'));var cmContactRpc=require(_0x8abc('0x5'));config['redis']=_[_0x8abc('0x6')](config[_0x8abc('0x7')],{'host':_0x8abc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x36cb5c,_0x314245,_0x3eeea9,_0x42b1f2,_0x30fb10){logger[_0x8abc('0x9')](_0x8abc('0xa'),_0x36cb5c,_0x314245['id'],_0x3eeea9,_0x42b1f2,JSON[_0x8abc('0xb')](_0x30fb10));io['to'](_0x3eeea9)[_0x8abc('0xc')](_0x42b1f2,_0x30fb10);}exports[_0x8abc('0xd')]=function(_0x7c3a8d,_0x4db109,_0x306073,_0xb23a91){var _0x52a0bb,_0x34bdc4;var _0x3f0b82={};var _0x20a0e8;var _0x29b936=Number(_0x306073[_0x8abc('0xe')]);var _0x5cdc9a=_0x306073[_0x8abc('0xf')]?Boolean(Number(_0x306073[_0x8abc('0xf')])):![];var _0x3d719a;var _0x53e5d7=![];if(!_['isNil'](_0x306073['data5'])){if(_0x306073[_0x8abc('0x10')]=='1')_0x53e5d7=!![];}if(!_0x53e5d7){if(_0xb23a91['xmd-contactid']){_0x3f0b82['id']=_0xb23a91['xmd-contactid'];}}if(!_0x3f0b82['id']){_0x3f0b82['ListId']=_0x29b936;_0x3d719a=_0x306073['data3']&&_0x306073[_0x8abc('0x11')]!=='0'?_0x306073[_0x8abc('0x11')][_0x8abc('0x12')](','):[_0x8abc('0x13')];_0x3f0b82['$or']=_[_0x8abc('0x14')](_0x3d719a,function(_0x279bee){var _0x4ea9ae={};_0x4ea9ae[_0x279bee]=_0xb23a91[_0x8abc('0x15')]?_0xb23a91['destcalleridnum']:_0xb23a91[_0x8abc('0x16')];return _0x4ea9ae;});_0x20a0e8=_0xb23a91[_0x8abc('0x15')]?_0xb23a91[_0x8abc('0x17')]:_0xb23a91[_0x8abc('0x16')];}var _0x3f5e5a=['id',_0x8abc('0x18'),'lastName',_0x8abc('0x13'),_0x8abc('0x19'),_0x8abc('0x1a'),_0x8abc('0x1b'),'createdAt',_0x8abc('0x1c'),_0x8abc('0x1d')];var _0x1068de=_[_0x8abc('0x1e')](_0x3f5e5a,_0x3d719a);BPromise[_0x8abc('0x1f')]()[_0x8abc('0x20')](cmContactRpc[_0x8abc('0x21')]({'attributes':_0x1068de,'where':_0x3f0b82,'phone':_0x20a0e8}))[_0x8abc('0x20')](function(_0x49dff3){_0x34bdc4=_0x49dff3;if(!_[_0x8abc('0x22')](_0x34bdc4)){if(_0x34bdc4[_0x8abc('0x23')]===0x1){_0x52a0bb=_0x34bdc4[0x0];logger[_0x8abc('0x9')](_0x8abc('0x24'),_0xb23a91[_0x8abc('0x25')],_0x4db109['id'],_0x52a0bb['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xb23a91['uniqueid'],_0x4db109['id'],_['map'](_0x34bdc4,'id')[_0x8abc('0x26')](','));}return;}else{logger[_0x8abc('0x9')](_0x8abc('0x27'),_0xb23a91[_0x8abc('0x25')],_0x4db109['id']);var _0x5d5811={'ListId':_0x29b936};var _0x4a6b69=_0x306073['data4']&&_0x306073[_0x8abc('0x28')]!=='0'?_0x306073[_0x8abc('0x28')]:_0x8abc('0x13');if(_0x5cdc9a){logger[_0x8abc('0x9')](_0x8abc('0x29'),_0xb23a91['uniqueid'],_0x4db109['id']);_0x5d5811[_0x4a6b69]=_[_0x8abc('0x2a')](_0xb23a91['routeId'])?_0xb23a91['calleridnum']:_0xb23a91[_0x8abc('0x17')];if(_['isNil'](_0xb23a91['routeId'])){_0x5d5811[_0x8abc('0x18')]=_0xb23a91[_0x8abc('0x2b')]&&_0xb23a91[_0x8abc('0x2b')]!==_0x8abc('0x2c')?_0xb23a91['calleridname']:_0x8abc('0x2d');}else{_0x5d5811[_0x8abc('0x18')]=_0xb23a91[_0x8abc('0x2e')]&&_0xb23a91[_0x8abc('0x2e')]!==''?_0xb23a91[_0x8abc('0x2e')]:'Unknown';}return BPromise['resolve']()[_0x8abc('0x20')](cmContactRpc[_0x8abc('0x2f')](_0x5d5811))[_0x8abc('0x20')](function(_0x363a21){_0x52a0bb=_0x363a21;_0x34bdc4[_0x8abc('0x30')](_0x363a21);if(_0x52a0bb){logger['info'](_0x8abc('0x31'),_0xb23a91[_0x8abc('0x25')],_0x4db109['id'],_0x52a0bb['id']);}return;});}else{logger[_0x8abc('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0xb23a91['uniqueid'],_0x4db109['id']);_0x5d5811[_0x4a6b69]=_[_0x8abc('0x2a')](_0xb23a91[_0x8abc('0x15')])?_0xb23a91[_0x8abc('0x16')]:_0xb23a91['destcalleridnum'];if(_['isNil'](_0xb23a91[_0x8abc('0x15')])){_0x5d5811[_0x8abc('0x18')]=_0xb23a91['calleridname']&&_0xb23a91[_0x8abc('0x2b')]!==_0x8abc('0x2c')?_0xb23a91['calleridname']:_0x8abc('0x2d');}else{_0x5d5811[_0x8abc('0x18')]=_0xb23a91[_0x8abc('0x2e')]&&_0xb23a91[_0x8abc('0x2e')]!==''?_0xb23a91[_0x8abc('0x2e')]:'Unknown';}_0x52a0bb=_0x5d5811;_0x34bdc4[_0x8abc('0x30')](_0x5d5811);return;}}})['then'](function(){if(_0x7c3a8d){emit(_0xb23a91[_0x8abc('0x25')],_0x4db109,util[_0x8abc('0x32')]('user:%s',_0x7c3a8d['name']),util[_0x8abc('0x32')](_0x8abc('0x33'),_0x306073[_0x8abc('0x34')][_0x8abc('0x35')]()),{'evt':_['merge'](_0xb23a91,{'autoCreate':_0x5cdc9a}),'contact':_0x52a0bb===undefined?{}:_0x52a0bb,'contacts':_0x34bdc4['length']===0x0?undefined:_0x34bdc4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1de1873..d2b7986 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 _0x937d=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','info','emit','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','contactmanager','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','data3','isNil','data4','location','uriLocation','windowWidth','data5','data6','600','winapp','winApplication','winArguments','format','user:%s','trigger:%s:%s','action','toLowerCase','jscripty','trigger:%s','name','integration','queue','urlforward','exec','buildUri','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','routeId','mailSubstatus','substatus','offlineMessage','created','exports','util','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','trigger','../ami','redis','localhost','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x475049,_0x3fd4a7){var _0x5a7aa7=function(_0x14e363){while(--_0x14e363){_0x475049['push'](_0x475049['shift']());}};_0x5a7aa7(++_0x3fd4a7);}(_0x937d,0x1f4));var _0xd937=function(_0x41a35a,_0xda06ad){_0x41a35a=_0x41a35a-0x0;var _0x33899c=_0x937d[_0x41a35a];return _0x33899c;};'use strict';var util=require(_0xd937('0x0'));var _=require('lodash');var url=require('url');var Mustache=require('mustache');var Redis=require(_0xd937('0x1'));var urlforward=require(_0xd937('0x2'));var integration=require(_0xd937('0x3'));var cmContact=require(_0xd937('0x4'));var script=require(_0xd937('0x5'));var config=require(_0xd937('0x6'));var logger=require('../../../config/logger')(_0xd937('0x7'));var ami=require(_0xd937('0x8'));config[_0xd937('0x9')]=_['defaults'](config[_0xd937('0x9')],{'host':_0xd937('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd937('0x9')]));var operators={'equals':function(_0x1df81d,_0x2d7594){return _0x1df81d==_0x2d7594;},'not_equals':function(_0xa97338,_0x40c5af){return _0xa97338!=_0x40c5af;}};var barAndWebActions=['popup',_0xd937('0xb'),'winapp'];function Trigger(_0xd8f575){this['triggers']=_0xd8f575[_0xd937('0xc')];this[_0xd937('0xd')]=_0xd8f575[_0xd937('0xd')];this[_0xd937('0xe')]=_0xd8f575[_0xd937('0xe')];this['templates']=_0xd8f575[_0xd937('0xf')];this[_0xd937('0x10')]=_0xd8f575[_0xd937('0x10')];this[_0xd937('0x11')]=_0xd8f575[_0xd937('0x11')];this[_0xd937('0x12')]=_0xd8f575[_0xd937('0x12')];this[_0xd937('0x13')]=_0xd8f575[_0xd937('0x13')];this[_0xd937('0x14')]=_0xd8f575['sugarcrmAccounts'];this[_0xd937('0x15')]=_0xd8f575[_0xd937('0x15')];this[_0xd937('0x16')]=_0xd8f575['deskAccounts'];this[_0xd937('0x17')]=_0xd8f575[_0xd937('0x17')];this[_0xd937('0x18')]=_0xd8f575['servicenowAccounts'];this[_0xd937('0x19')]=_0xd8f575[_0xd937('0x19')];this[_0xd937('0x1a')]=_0xd8f575[_0xd937('0x1a')];this[_0xd937('0x1b')]={'zendesk':this[_0xd937('0x11')],'salesforce':this[_0xd937('0x13')],'freshdesk':this[_0xd937('0x12')],'sugarcrm':this[_0xd937('0x14')],'zoho':this[_0xd937('0x15')],'desk':this[_0xd937('0x16')],'vtiger':this[_0xd937('0x17')],'dynamics365':this[_0xd937('0x19')],'freshsales':this[_0xd937('0x1a')],'servicenow':this[_0xd937('0x18')]};ami['on'](_0xd937('0x1c'),this[_0xd937('0x1d')]['bind'](this));ami['on'](_0xd937('0x1e'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x20'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x21'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x22'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xd937('0x1f')](this));ami['on'](_0xd937('0x23'),this['syncCustomEvent'][_0xd937('0x1f')](this));ami['on'](_0xd937('0x24'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:agentreject',this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x25'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x26'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x27'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on']('custom:dialbegin',this[_0xd937('0x28')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x29'),this[_0xd937('0x28')]['bind'](this));ami['on'](_0xd937('0x2a'),this[_0xd937('0x28')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2b'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2c'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2d'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2e'),this[_0xd937('0x1d')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x2f'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x30'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));ami['on'](_0xd937('0x31'),this[_0xd937('0x1d')][_0xd937('0x1f')](this));}Trigger['prototype']['emit']=function(_0x592cb7,_0x6c8fc6,_0x54a348){logger[_0xd937('0x32')](_0x592cb7,_0x6c8fc6,JSON['stringify'](_0x54a348));io['to'](_0x592cb7)[_0xd937('0x33')](_0x6c8fc6,_0x54a348);};Trigger[_0xd937('0x34')][_0xd937('0x1d')]=function(_0x700e62){var _0x36823a=_[_0xd937('0x35')](_0x700e62);if(typeof _0x36823a[_0xd937('0x36')]===_0xd937('0x37')){_0x36823a[_0xd937('0x36')]=_0xd937('0x38');}logger[_0xd937('0x39')](_0xd937('0x1d'),util[_0xd937('0x3a')](_0x36823a,{'showHidden':!![],'depth':null}));this[_0xd937('0x3b')](_0x36823a);};Trigger[_0xd937('0x34')][_0xd937('0x28')]=function(_0x3ca45f){if(this['agents'][_0x3ca45f[_0xd937('0x3c')]]){this[_0xd937('0x1d')](_0x3ca45f);}};Trigger[_0xd937('0x34')][_0xd937('0x3b')]=function(_0x39e413){var _0x20b7c2;for(var _0x4d9987 in this[_0xd937('0xc')]){if(this['triggers'][_0xd937('0x3d')](_0x4d9987)){if(this[_0xd937('0xc')][_0x4d9987][_0xd937('0x3e')]){_0x20b7c2=this[_0xd937('0x3f')](this['triggers'][_0x4d9987],_0x39e413);if(_0x20b7c2){_[_0xd937('0x40')](_0x39e413,_0x39e413[_0xd937('0x41')]);for(var _0x58b12e=0x0,_0x3f2fd5,_0x3a1eb3,_0x240562;_0x58b12e0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x114e5c,_0xa03330){var _0x1b4402=function(_0x331dec){while(--_0x331dec){_0x114e5c['push'](_0x114e5c['shift']());}};_0x1b4402(++_0xa03330);}(_0x814b,0x1a2));var _0xb814=function(_0x46bec2,_0x36cde0){_0x46bec2=_0x46bec2-0x0;var _0x39b857=_0x814b[_0x46bec2];return _0x39b857;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 c456c18..b5d3c1a 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 _0xac0e=['isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','userId','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing','info',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','indexOf','content','ticketType','incidents','getString','Fields','callDirection','queue','/contacts(','phonecalls','assign','Subjects','Descriptions','ticketId','catch','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','clientId','username','password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xac0e,0x12b));var _0xeac0=function(_0x281c26,_0x317ce9){_0x281c26=_0x281c26-0x0;var _0x579e87=_0xac0e[_0x281c26];return _0x579e87;};'use strict';var _=require('lodash');var rp=require(_0xeac0('0x0'));var util=require(_0xeac0('0x1'));var intUtil=require(_0xeac0('0x2'));var md5=require('md5');var Redis=require(_0xeac0('0x3'));var logger=require(_0xeac0('0x4'))(_0xeac0('0x5'));var config=require(_0xeac0('0x6'));config['redis']=_[_0xeac0('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xeac0('0x8'))(new Redis(config['redis']));function getAuthToken(_0xa99120,_0x1bd239,_0x3784af){if(_0xa99120[_0xeac0('0x9')]){_0xa99120[_0xeac0('0xa')]=_0xa99120[_0xeac0('0xb')][_0xeac0('0xc')];_0xa99120[_0xeac0('0xd')]=_0xa99120[_0xeac0('0xb')][_0xeac0('0xe')];return Promise[_0xeac0('0xf')](_0xa99120[_0xeac0('0xb')]['data5']);}var _0xcb40e={'method':'POST','uri':_0x1bd239,'form':{'client_id':_0xa99120[_0xeac0('0x10')],'resource':_0xa99120['remoteUri'],'username':_0xa99120[_0xeac0('0x11')],'password':_0xa99120['password'],'grant_type':_0xeac0('0x12'),'client_secret':_0xa99120['clientSecret']},'json':!![]};return rp(_0xcb40e)[_0xeac0('0x13')](function(_0x4b617e){return _0x4b617e[_0xeac0('0x14')];})['catch'](function(_0x5415f8){logger[_0xeac0('0x15')]('['+[_0x3784af[_0xeac0('0x16')]()]+_0xeac0('0x17'));return _0x5415f8[_0xeac0('0x18')];});}function getUser(_0x17096c,_0x445af9,_0x4019b8,_0x5a20a4,_0x5a4c5b,_0x5bde18){return new Promise(function(_0x10cc35,_0x10ff5a){return getAuthToken(_0x445af9,_0x5a20a4,_0x5bde18)[_0xeac0('0x13')](function(_0x5e032d){var _0x38f82a={'method':_0xeac0('0x19'),'uri':_0x5a4c5b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5e032d,'OData-Version':_0xeac0('0x1a')},'json':!![]};return rp(_0x38f82a);})[_0xeac0('0x13')](function(_0x1d1baf){var _0x224b21=_0x1d1baf[_0xeac0('0x1b')];var _0x440263=![];var _0x39d00f=null;if(!_[_0xeac0('0x1c')](_0x4019b8)){if(intUtil[_0xeac0('0x1d')](_0x4019b8[_0xeac0('0x1e')])){_0x17096c['userEmail']=_0x4019b8['email'];for(_0x39d00f=0x0;_0x39d00f<_0x224b21[_0xeac0('0x1f')];_0x39d00f++){if(_0x224b21[_0x39d00f][_0xeac0('0x20')]===_0x4019b8[_0xeac0('0x1e')]&&!_0x224b21[_0x39d00f][_0xeac0('0x21')]){_0x440263=!![];logger['info']('['+[_0x5bde18['toUpperCase']()]+_0xeac0('0x22')+_0x224b21[_0x39d00f]['systemuserid']+'!');_0x17096c['userId']=_0x224b21[_0x39d00f][_0xeac0('0x23')];}}}}if(!_0x440263){logger['info']('['+[_0x5bde18[_0xeac0('0x16')]()]+_0xeac0('0x24'));_0x17096c[_0xeac0('0x25')]=_0x445af9[_0xeac0('0x11')];for(_0x39d00f=0x0;_0x39d00f<_0x224b21[_0xeac0('0x1f')];_0x39d00f++){if(_0x224b21[_0x39d00f]['internalemailaddress']===_0x445af9['username']){_0x17096c[_0xeac0('0x26')]=_0x224b21[_0x39d00f][_0xeac0('0x23')];}}}_0x10cc35(_0x17096c);})['catch'](function(_0x457552){_0x10ff5a(_0x457552[_0xeac0('0x18')]);});});}function createEndUser(_0x242951,_0x280ff1,_0x283d76,_0x5d2c36,_0x329927,_0x5f4750,_0xdfb8ed){return new Promise(function(_0x5a0901,_0x338741){return getAuthToken(_0x280ff1,_0x283d76,_0x5f4750)[_0xeac0('0x13')](function(_0x14f7c9){var _0x2076e5=_0x5f4750[_0xeac0('0x27')]()===_0xeac0('0x28')?_0x329927['destcalleridnum']:_0x329927[_0xeac0('0x29')];var _0x11f43b={'method':_0xeac0('0x2a'),'uri':_0x5d2c36+_0xeac0('0x2b'),'body':{'fullname':_0x2076e5,'firstname':_0x2076e5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xeac0('0x2c')+_0x242951[_0xeac0('0x26')]+')'},'headers':{'Authorization':_0xeac0('0x2d')+_0x14f7c9,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x11f43b['body'][_0xdfb8ed]=_0x2076e5;return rp(_0x11f43b);})[_0xeac0('0x13')](function(_0x2df40a){var _0x151191=_0x2df40a[_0xeac0('0x2e')][_0xeac0('0x2f')];var _0x515bc7=_0x151191[_0xeac0('0x30')](_0x151191[_0xeac0('0x31')]('(')+0x1,_0x151191[_0xeac0('0x31')](')'));_0x242951[_0xeac0('0x32')]=_0x515bc7;_0x5a0901(_0x242951);})['catch'](function(_0x312db2){_0x338741(_0x312db2['message']);});});}function getEndUser(_0xb82012,_0x260510,_0x1a745d,_0x317415,_0x36407b,_0x1dbdc7,_0x53f9d6,_0x2599bd){var _0x56907a=_0x1dbdc7[_0xeac0('0x27')]()==='outbound'?_0x36407b[_0xeac0('0x33')]:_0x36407b[_0xeac0('0x29')];return getAuthToken(_0x260510,_0x1a745d,_0x1dbdc7)[_0xeac0('0x13')](function(_0x355ced){_0x2599bd=_0x2599bd?_0x2599bd:_0xeac0('0x34');var _0x1e1c2e={'method':'GET','uri':_0x317415+_0xeac0('0x35')+_0x2599bd+'&$filter='+_0x2599bd+_0xeac0('0x36')+_0x56907a[_0xeac0('0x37')]('+',_0xeac0('0x38'))+'\x27','headers':{'Authorization':_0xeac0('0x2d')+_0x355ced,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e1c2e);})[_0xeac0('0x13')](function(_0x2ca915){var _0x4e6e67=![];if(!_0x2ca915)return _0x4e6e67;var _0x4b8824=_0x2ca915['value'];for(var _0x464d14=0x0;_0x464d14<_0x4b8824['length'];_0x464d14++){if(_0x4b8824[_0x464d14][_0x2599bd]===_0x56907a){_0x4e6e67=!![];_0xb82012[_0xeac0('0x32')]=_0x4b8824[_0x464d14][_0xeac0('0x39')];}}return _0x4e6e67;})['then'](function(_0x2166c3){if(_0x2166c3)return _0xb82012;if(_0x53f9d6===_0xeac0('0x3a')){logger[_0xeac0('0x3b')]('['+[_0x1dbdc7[_0xeac0('0x16')]()]+_0xeac0('0x3c'));return _0xb82012;}return createEndUser(_0xb82012,_0x260510,_0x1a745d,_0x317415,_0x36407b,_0x1dbdc7,_0x2599bd)[_0xeac0('0x13')](function(_0x102a11){logger['info']('['+[_0x1dbdc7[_0xeac0('0x16')]()]+_0xeac0('0x3d'),_0x102a11[_0xeac0('0x32')]);return _0x102a11;});});}function getCustomFields(_0x3a1951,_0x32099a,_0x2e206a){var _0x34c154={};if(_0x3a1951[_0xeac0('0x1f')]>0x0){_[_0xeac0('0x3e')](_0x3a1951,function(_0x47f07f){if(_[_0xeac0('0x3f')](['string',_0xeac0('0x40')],_0x47f07f[_0xeac0('0x41')])&&_0x47f07f[_0xeac0('0x42')]&&!_0x47f07f[_0xeac0('0x43')]){var _0x2f6684=_0x47f07f['idField']['toLowerCase']();var _0x3d16f0=_0x2f6684[_0xeac0('0x30')](0x0,_0x2f6684[_0xeac0('0x44')]('_'));var _0x2da586=_0x2f6684[_0xeac0('0x30')](_0x2f6684[_0xeac0('0x44')]('_')+0x1);if(_0x3d16f0===_0x2e206a){_0x34c154[_0x2da586]=_0x47f07f[_0xeac0('0x45')];}}});}return _0x34c154;}function getTicket(_0x4c0d4c,_0xcda559,_0x29ec83,_0x319ec1,_0x1fbc9a,_0x190e67,_0x582da8){return new Promise(function(_0x54a27b,_0x45d151){var _0x45e247;return getAuthToken(_0xcda559,_0x29ec83,_0x582da8)[_0xeac0('0x13')](function(_0x1a495d){if(_0x190e67[_0xeac0('0x46')]==='incident'){_0x45e247={'method':_0xeac0('0x2a'),'uri':_0x319ec1+_0xeac0('0x47'),'body':Object['assign']({},{'title':intUtil[_0xeac0('0x48')](_0x190e67['Subjects'],_0x1fbc9a,'\x20'),'description':intUtil['getString'](_0x190e67['Descriptions'],_0x1fbc9a,'\x0a'),'customerid_contact@odata.bind':_0x4c0d4c['enduserId']?'/contacts('+_0x4c0d4c['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4c0d4c[_0xeac0('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x190e67[_0xeac0('0x49')],_0x1fbc9a,_0x190e67[_0xeac0('0x46')])),'headers':{'Authorization':'Bearer\x20'+_0x1a495d,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x190e67[_0xeac0('0x46')]==='phonecall'){var _0x717ef1=_0x4c0d4c[_0xeac0('0x32')]?[{'partyid_systemuser@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xeac0('0x4c')+_0x4c0d4c[_0xeac0('0x32')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','participationtypemask':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?0x2:0x1}];_0x45e247={'method':_0xeac0('0x2a'),'uri':_0x319ec1+_0xeac0('0x4d'),'body':Object[_0xeac0('0x4e')]({},{'subject':intUtil[_0xeac0('0x48')](_0x190e67[_0xeac0('0x4f')],_0x1fbc9a,'\x20'),'phonenumber':String(_0x1fbc9a[_0xeac0('0x29')]),'description':intUtil['getString'](_0x190e67[_0xeac0('0x50')],_0x1fbc9a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4c0d4c[_0xeac0('0x32')]?_0xeac0('0x4c')+_0x4c0d4c[_0xeac0('0x32')]+')':undefined,'ownerid@odata.bind':_0xeac0('0x2c')+_0x4c0d4c[_0xeac0('0x26')]+')','directioncode':_0x4c0d4c[_0xeac0('0x4a')]===_0xeac0('0x4b')?![]:!![],'phonecall_activity_parties':_0x717ef1},getCustomFields(_0x190e67[_0xeac0('0x49')],_0x1fbc9a,_0x190e67['ticketType'])),'headers':{'Authorization':_0xeac0('0x2d')+_0x1a495d,'OData-Version':_0xeac0('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x45e247);})['then'](function(_0x4f4601){var _0x3ef0b7=_0x4f4601[_0xeac0('0x2e')][_0xeac0('0x2f')];var _0x4be0cf=_0x3ef0b7['substring'](_0x3ef0b7['lastIndexOf']('(')+0x1,_0x3ef0b7[_0xeac0('0x31')](')'));_0x4c0d4c[_0xeac0('0x51')]=_0x4be0cf;_0x54a27b(_0x4c0d4c);})[_0xeac0('0x52')](function(_0x14c7c7){_0x45d151(_0x14c7c7[_0xeac0('0x18')]);});});}function emit(_0x2e7d8d,_0x2f9056,_0x26b5a1,_0xc1135c){var _0x2fbabc={'uri':util[_0xeac0('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x2e7d8d,_0x26b5a1,_0xc1135c)};io['to'](util['format'](_0xeac0('0x54'),_0x2f9056))[_0xeac0('0x55')](_0xeac0('0x56'),_0x2fbabc);}exports['cs']=function(_0x837081,_0x276d46,_0x5bdcf1,_0x248c31,_0x4b2809,_0x4aa464,_0x2fa7e5,_0x8bfb82){var _0x163c1a={};_0x4aa464[_0xeac0('0xa')]=_0x4aa464[_0xeac0('0x9')]?intUtil[_0xeac0('0x57')](_0x4aa464['CloudProvider'][_0xeac0('0xc')]):intUtil[_0xeac0('0x57')](_0x4aa464[_0xeac0('0xa')]);_0x4aa464[_0xeac0('0x58')]=intUtil[_0xeac0('0x57')](_0x4aa464[_0xeac0('0x58')]);_0x163c1a[_0xeac0('0x4a')]=_0x8bfb82==='queue'||_0x8bfb82==='unmanaged'?_0xeac0('0x4b'):_0xeac0('0x28');var _0x5135de=_0x4aa464[_0xeac0('0x9')]?util[_0xeac0('0x53')](_0xeac0('0x59'),_0x4aa464['CloudProvider'][_0xeac0('0xc')]):util[_0xeac0('0x53')]('%s/api/data/v9.0/',_0x4aa464[_0xeac0('0xa')]);var _0xddd6ff=util[_0xeac0('0x53')](_0xeac0('0x5a'),_0x4aa464['tenantId']);var _0x1ced8f=util[_0xeac0('0x53')](_0xeac0('0x5b'),_0x4aa464['serverUrl'],_0x276d46['uniqueid'],md5(_0x276d46[_0xeac0('0x5c')]));if(_0x4b2809&&_0x4b2809['monitor_format']){logger[_0xeac0('0x3b')](_0xeac0('0x5d'),'Recording\x20is\x20enabled!');_0x276d46[_0xeac0('0x5e')]=_0x1ced8f;}else if(_0x2fa7e5&&_0x2fa7e5[_0xeac0('0x5f')]&&_0x2fa7e5[_0xeac0('0x5f')]!==_0xeac0('0x60')){logger[_0xeac0('0x3b')](_0xeac0('0x61'),_0xeac0('0x62'));_0x276d46[_0xeac0('0x5e')]=_0x1ced8f;}else{_0x276d46[_0xeac0('0x5e')]='';}return getUser(_0x163c1a,_0x4aa464,_0x248c31,_0xddd6ff,_0x5135de,_0x8bfb82)['then'](function(_0x38fef1){logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x63'),_0x38fef1[_0xeac0('0x26')]);logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x64'),_0x38fef1[_0xeac0('0x25')]);return getEndUser(_0x38fef1,_0x4aa464,_0xddd6ff,_0x5135de,_0x276d46,_0x8bfb82,_0x5bdcf1[_0xeac0('0x65')],_0x5bdcf1[_0xeac0('0x66')]);})[_0xeac0('0x13')](function(_0x10baee){logger[_0xeac0('0x3b')]('['+_0x8bfb82['toUpperCase']()+_0xeac0('0x67'),_0x10baee[_0xeac0('0x32')]);logger[_0xeac0('0x3b')]('['+_0x8bfb82[_0xeac0('0x16')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x276d46['calleridnum']);return getTicket(_0x10baee,_0x4aa464,_0xddd6ff,_0x5135de,_0x276d46,_0x5bdcf1,_0x8bfb82);})['then'](function(_0x20a476){logger[_0xeac0('0x3b')](util[_0xeac0('0x53')]('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x68'),_0x5bdcf1['ticketType'],_0x20a476[_0xeac0('0x51')]));logger[_0xeac0('0x3b')](util['format']('['+_0x8bfb82[_0xeac0('0x16')]()+_0xeac0('0x69'),_0x8bfb82));if(_0x8bfb82!==_0xeac0('0x6a')&&_0x5bdcf1[_0xeac0('0x6b')]){logger['info']('['+_0x8bfb82[_0xeac0('0x16')]()+']',_0xeac0('0x6c'));emit(_0x4aa464[_0xeac0('0xa')],_0x248c31['name'],_0x5bdcf1[_0xeac0('0x46')],_0x20a476['ticketId']);}})[_0xeac0('0x52')](function(_0xd44c83){logger[_0xeac0('0x15')]('['+_0x8bfb82[_0xeac0('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xd44c83[_0xeac0('0x18')]);console[_0xeac0('0x15')]('Error\x20running\x20Dynamics365\x20integration',_0xd44c83);});}; \ No newline at end of file +var _0xdf48=['nameField','customField','toLowerCase','indexOf','content','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','calleridnum','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','remoteUri','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','userId','systemuserid','catch','outbound','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','%2b','Bearer\x20','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','picklist','type'];(function(_0x580ef3,_0x471646){var _0x46a603=function(_0x39e7e1){while(--_0x39e7e1){_0x580ef3['push'](_0x580ef3['shift']());}};_0x46a603(++_0x471646);}(_0xdf48,0x9e));var _0x8df4=function(_0x713ab2,_0x1608d4){_0x713ab2=_0x713ab2-0x0;var _0x16fea1=_0xdf48[_0x713ab2];return _0x16fea1;};'use strict';var _=require(_0x8df4('0x0'));var rp=require(_0x8df4('0x1'));var util=require(_0x8df4('0x2'));var intUtil=require(_0x8df4('0x3'));var md5=require(_0x8df4('0x4'));var Redis=require(_0x8df4('0x5'));var logger=require(_0x8df4('0x6'))(_0x8df4('0x7'));var config=require(_0x8df4('0x8'));config[_0x8df4('0x9')]=_[_0x8df4('0xa')](config[_0x8df4('0x9')],{'host':_0x8df4('0xb'),'port':0x18eb});var io=require(_0x8df4('0xc'))(new Redis(config[_0x8df4('0x9')]));function getAuthToken(_0x37e2cd,_0x3ba3ac,_0x337420){if(_0x37e2cd[_0x8df4('0xd')]){_0x37e2cd['remoteUri']=_0x37e2cd[_0x8df4('0xe')][_0x8df4('0xf')];_0x37e2cd[_0x8df4('0x10')]=_0x37e2cd[_0x8df4('0xe')][_0x8df4('0x11')];return Promise[_0x8df4('0x12')](_0x37e2cd[_0x8df4('0xe')][_0x8df4('0x13')]);}var _0x202ef5={'method':_0x8df4('0x14'),'uri':_0x3ba3ac,'form':{'client_id':_0x37e2cd['clientId'],'resource':_0x37e2cd[_0x8df4('0x15')],'username':_0x37e2cd['username'],'password':_0x37e2cd[_0x8df4('0x16')],'grant_type':_0x8df4('0x16'),'client_secret':_0x37e2cd[_0x8df4('0x17')]},'json':!![]};return rp(_0x202ef5)[_0x8df4('0x18')](function(_0x13da61){return _0x13da61[_0x8df4('0x19')];})['catch'](function(_0x2e037f){logger[_0x8df4('0x1a')]('['+[_0x337420[_0x8df4('0x1b')]()]+']\x20Wrong\x20credentials!');return _0x2e037f[_0x8df4('0x1c')];});}function getUser(_0x28002a,_0x240e2f,_0x4e5b9b,_0x1d82b0,_0x426803,_0x193723){return new Promise(function(_0x29c800,_0x49abae){return getAuthToken(_0x240e2f,_0x1d82b0,_0x193723)[_0x8df4('0x18')](function(_0x5ab8c9){var _0x49c8ed={'method':_0x8df4('0x1d'),'uri':_0x426803+_0x8df4('0x1e'),'headers':{'Authorization':'Bearer\x20'+_0x5ab8c9,'OData-Version':_0x8df4('0x1f')},'json':!![]};return rp(_0x49c8ed);})[_0x8df4('0x18')](function(_0x144909){var _0x223d8f=_0x144909[_0x8df4('0x20')];var _0x14b47e=![];var _0x356669=null;if(!_[_0x8df4('0x21')](_0x4e5b9b)){if(intUtil[_0x8df4('0x22')](_0x4e5b9b[_0x8df4('0x23')])){_0x28002a[_0x8df4('0x24')]=_0x4e5b9b['email'];for(_0x356669=0x0;_0x356669<_0x223d8f[_0x8df4('0x25')];_0x356669++){if(_0x223d8f[_0x356669]['internalemailaddress']===_0x4e5b9b[_0x8df4('0x23')]&&!_0x223d8f[_0x356669][_0x8df4('0x26')]){_0x14b47e=!![];logger[_0x8df4('0x27')]('['+[_0x193723[_0x8df4('0x1b')]()]+']\x20Agent\x20found\x20'+_0x223d8f[_0x356669]['systemuserid']+'!');_0x28002a['userId']=_0x223d8f[_0x356669]['systemuserid'];}}}}if(!_0x14b47e){logger[_0x8df4('0x27')]('['+[_0x193723[_0x8df4('0x1b')]()]+_0x8df4('0x28'));_0x28002a[_0x8df4('0x24')]=_0x240e2f[_0x8df4('0x29')];for(_0x356669=0x0;_0x356669<_0x223d8f['length'];_0x356669++){if(_0x223d8f[_0x356669][_0x8df4('0x2a')]===_0x240e2f[_0x8df4('0x29')]){_0x28002a[_0x8df4('0x2b')]=_0x223d8f[_0x356669][_0x8df4('0x2c')];}}}_0x29c800(_0x28002a);})[_0x8df4('0x2d')](function(_0x44927d){_0x49abae(_0x44927d[_0x8df4('0x1c')]);});});}function createEndUser(_0x2e5d8c,_0x41b8b6,_0x2f1ee2,_0x3735da,_0x903592,_0x4e8995,_0x44ba34){return new Promise(function(_0x289668,_0x3779d3){return getAuthToken(_0x41b8b6,_0x2f1ee2,_0x4e8995)['then'](function(_0x8a17c8){var _0xb76ac6=_0x4e8995['toLowerCase']()===_0x8df4('0x2e')?_0x903592['destcalleridnum']:_0x903592['calleridnum'];var _0x12d857={'method':_0x8df4('0x14'),'uri':_0x3735da+'contacts','body':{'fullname':_0xb76ac6,'firstname':_0xb76ac6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8df4('0x2f')+_0x2e5d8c[_0x8df4('0x2b')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x8a17c8,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x12d857['body'][_0x44ba34]=_0xb76ac6;return rp(_0x12d857);})[_0x8df4('0x18')](function(_0x3143e6){var _0x2d8ed4=_0x3143e6[_0x8df4('0x30')][_0x8df4('0x31')];var _0x279155=_0x2d8ed4[_0x8df4('0x32')](_0x2d8ed4[_0x8df4('0x33')]('(')+0x1,_0x2d8ed4[_0x8df4('0x33')](')'));_0x2e5d8c[_0x8df4('0x34')]=_0x279155;_0x289668(_0x2e5d8c);})[_0x8df4('0x2d')](function(_0x3beadc){_0x3779d3(_0x3beadc[_0x8df4('0x1c')]);});});}function getEndUser(_0x4628ec,_0x34c816,_0x1dba48,_0x3bda62,_0x159300,_0x245130,_0x1bd289,_0x24ead7){var _0x476bbc=_0x245130['toLowerCase']()===_0x8df4('0x2e')?_0x159300[_0x8df4('0x35')]:_0x159300['calleridnum'];return getAuthToken(_0x34c816,_0x1dba48,_0x245130)['then'](function(_0x4a8e8c){_0x24ead7=_0x24ead7?_0x24ead7:_0x8df4('0x36');var _0x4085a8={'method':_0x8df4('0x1d'),'uri':_0x3bda62+_0x8df4('0x37')+_0x24ead7+'&$filter='+_0x24ead7+_0x8df4('0x38')+_0x476bbc['replace']('+',_0x8df4('0x39'))+'\x27','headers':{'Authorization':_0x8df4('0x3a')+_0x4a8e8c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4085a8);})['then'](function(_0x3563a6){var _0x34af44=![];if(!_0x3563a6)return _0x34af44;var _0x23989d=_0x3563a6[_0x8df4('0x20')];for(var _0x4f5828=0x0;_0x4f5828<_0x23989d[_0x8df4('0x25')];_0x4f5828++){if(_0x23989d[_0x4f5828][_0x24ead7]===_0x476bbc){_0x34af44=!![];_0x4628ec[_0x8df4('0x34')]=_0x23989d[_0x4f5828][_0x8df4('0x3b')];}}return _0x34af44;})['then'](function(_0x2c369c){if(_0x2c369c)return _0x4628ec;if(_0x1bd289===_0x8df4('0x3c')){logger[_0x8df4('0x27')]('['+[_0x245130[_0x8df4('0x1b')]()]+_0x8df4('0x3d'));return _0x4628ec;}return createEndUser(_0x4628ec,_0x34c816,_0x1dba48,_0x3bda62,_0x159300,_0x245130,_0x24ead7)[_0x8df4('0x18')](function(_0x3541c8){logger[_0x8df4('0x27')]('['+[_0x245130[_0x8df4('0x1b')]()]+']\x20Enduser\x20created!',_0x3541c8[_0x8df4('0x34')]);return _0x3541c8;});});}function getCustomFields(_0x30195e,_0x1dd4ac,_0x591fe2){var _0x226de4={};if(_0x30195e[_0x8df4('0x25')]>0x0){_[_0x8df4('0x3e')](_0x30195e,function(_0x203eef){if(_[_0x8df4('0x3f')](['string',_0x8df4('0x40')],_0x203eef[_0x8df4('0x41')])&&_0x203eef[_0x8df4('0x42')]&&!_0x203eef[_0x8df4('0x43')]){var _0x132881=_0x203eef['idField'][_0x8df4('0x44')]();var _0x2b86c3=_0x132881[_0x8df4('0x32')](0x0,_0x132881[_0x8df4('0x45')]('_'));var _0xc87a48=_0x132881[_0x8df4('0x32')](_0x132881[_0x8df4('0x45')]('_')+0x1);if(_0x2b86c3===_0x591fe2){_0x226de4[_0xc87a48]=_0x203eef[_0x8df4('0x46')];}}});}return _0x226de4;}function getTicket(_0x5dec31,_0x34106f,_0x32bd23,_0x1da677,_0x9bcde8,_0x15d67a,_0x523344){return new Promise(function(_0x518f32,_0xeab132){var _0x2ccbaf;return getAuthToken(_0x34106f,_0x32bd23,_0x523344)['then'](function(_0x2e2711){if(_0x15d67a[_0x8df4('0x47')]==='incident'){_0x2ccbaf={'method':_0x8df4('0x14'),'uri':_0x1da677+_0x8df4('0x48'),'body':Object['assign']({},{'title':intUtil[_0x8df4('0x49')](_0x15d67a[_0x8df4('0x4a')],_0x9bcde8,'\x20'),'description':intUtil['getString'](_0x15d67a[_0x8df4('0x4b')],_0x9bcde8,'\x0a'),'customerid_contact@odata.bind':_0x5dec31['enduserId']?_0x8df4('0x4c')+_0x5dec31['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x5dec31[_0x8df4('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x15d67a[_0x8df4('0x4d')],_0x9bcde8,_0x15d67a[_0x8df4('0x47')])),'headers':{'Authorization':'Bearer\x20'+_0x2e2711,'OData-Version':_0x8df4('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x15d67a[_0x8df4('0x47')]===_0x8df4('0x4e')){var _0x41450b=_0x5dec31[_0x8df4('0x34')]?[{'partyid_systemuser@odata.bind':_0x8df4('0x2f')+_0x5dec31[_0x8df4('0x2b')]+')','participationtypemask':_0x5dec31[_0x8df4('0x4f')]===_0x8df4('0x50')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5dec31['enduserId']+')','participationtypemask':_0x5dec31[_0x8df4('0x4f')]===_0x8df4('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5dec31['userId']+')','participationtypemask':_0x5dec31[_0x8df4('0x4f')]==='queue'?0x2:0x1}];_0x2ccbaf={'method':'POST','uri':_0x1da677+_0x8df4('0x51'),'body':Object[_0x8df4('0x52')]({},{'subject':intUtil[_0x8df4('0x49')](_0x15d67a[_0x8df4('0x4a')],_0x9bcde8,'\x20'),'phonenumber':String(_0x9bcde8[_0x8df4('0x53')]),'description':intUtil[_0x8df4('0x49')](_0x15d67a[_0x8df4('0x4b')],_0x9bcde8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5dec31['enduserId']?_0x8df4('0x4c')+_0x5dec31[_0x8df4('0x34')]+')':undefined,'ownerid@odata.bind':_0x8df4('0x2f')+_0x5dec31['userId']+')','directioncode':_0x5dec31['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x41450b},getCustomFields(_0x15d67a[_0x8df4('0x4d')],_0x9bcde8,_0x15d67a[_0x8df4('0x47')])),'headers':{'Authorization':_0x8df4('0x3a')+_0x2e2711,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2ccbaf);})['then'](function(_0xe31f08){var _0x4d3f25=_0xe31f08[_0x8df4('0x30')]['odata-entityid'];var _0x134bbe=_0x4d3f25[_0x8df4('0x32')](_0x4d3f25[_0x8df4('0x33')]('(')+0x1,_0x4d3f25[_0x8df4('0x33')](')'));_0x5dec31[_0x8df4('0x54')]=_0x134bbe;_0x518f32(_0x5dec31);})[_0x8df4('0x2d')](function(_0x1f6901){_0xeab132(_0x1f6901[_0x8df4('0x1c')]);});});}function emit(_0x3c5c1f,_0x2913c7,_0x18e778,_0x195def){var _0x494fb2={'uri':util[_0x8df4('0x55')](_0x8df4('0x56'),_0x3c5c1f,_0x18e778,_0x195def)};io['to'](util[_0x8df4('0x55')](_0x8df4('0x57'),_0x2913c7))['emit'](_0x8df4('0x58'),_0x494fb2);}exports['cs']=function(_0xdaf91,_0x2f47a0,_0x18e2cf,_0x48f80c,_0x19c81a,_0x3b9cd3,_0x43f77c,_0x5e058b){var _0x53bb1a={};_0x3b9cd3[_0x8df4('0x15')]=_0x3b9cd3['modernAuthentication']?intUtil[_0x8df4('0x59')](_0x3b9cd3[_0x8df4('0xe')][_0x8df4('0xf')]):intUtil[_0x8df4('0x59')](_0x3b9cd3[_0x8df4('0x15')]);_0x3b9cd3[_0x8df4('0x5a')]=intUtil[_0x8df4('0x59')](_0x3b9cd3[_0x8df4('0x5a')]);_0x53bb1a[_0x8df4('0x4f')]=_0x5e058b===_0x8df4('0x50')||_0x5e058b===_0x8df4('0x5b')?_0x8df4('0x50'):_0x8df4('0x2e');var _0x476223=_0x3b9cd3[_0x8df4('0xd')]?util[_0x8df4('0x55')]('%s/api/data/v9.0/',_0x3b9cd3[_0x8df4('0xe')][_0x8df4('0xf')]):util[_0x8df4('0x55')](_0x8df4('0x5c'),_0x3b9cd3[_0x8df4('0x15')]);var _0x5c2bf1=util[_0x8df4('0x55')](_0x8df4('0x5d'),_0x3b9cd3[_0x8df4('0x10')]);var _0x2ea90a=util[_0x8df4('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b9cd3[_0x8df4('0x5a')],_0x2f47a0['uniqueid'],md5(_0x2f47a0[_0x8df4('0x5e')]));if(_0x19c81a&&_0x19c81a[_0x8df4('0x5f')]){logger[_0x8df4('0x27')]('[QUEUE]',_0x8df4('0x60'));_0x2f47a0['recordingURL']=_0x2ea90a;}else if(_0x43f77c&&_0x43f77c['recordingFormat']&&_0x43f77c[_0x8df4('0x61')]!==_0x8df4('0x62')){logger[_0x8df4('0x27')](_0x8df4('0x63'),_0x8df4('0x60'));_0x2f47a0[_0x8df4('0x64')]=_0x2ea90a;}else{_0x2f47a0[_0x8df4('0x64')]='';}return getUser(_0x53bb1a,_0x3b9cd3,_0x48f80c,_0x5c2bf1,_0x476223,_0x5e058b)[_0x8df4('0x18')](function(_0x25750c){logger['info']('['+_0x5e058b['toUpperCase']()+_0x8df4('0x65'),_0x25750c['userId']);logger[_0x8df4('0x27')]('['+_0x5e058b[_0x8df4('0x1b')]()+_0x8df4('0x66'),_0x25750c[_0x8df4('0x24')]);return getEndUser(_0x25750c,_0x3b9cd3,_0x5c2bf1,_0x476223,_0x2f47a0,_0x5e058b,_0x18e2cf[_0x8df4('0x67')],_0x18e2cf[_0x8df4('0x68')]);})[_0x8df4('0x18')](function(_0x60e516){logger[_0x8df4('0x27')]('['+_0x5e058b[_0x8df4('0x1b')]()+_0x8df4('0x69'),_0x60e516[_0x8df4('0x34')]);logger[_0x8df4('0x27')]('['+_0x5e058b[_0x8df4('0x1b')]()+_0x8df4('0x6a'),_0x2f47a0[_0x8df4('0x53')]);return getTicket(_0x60e516,_0x3b9cd3,_0x5c2bf1,_0x476223,_0x2f47a0,_0x18e2cf,_0x5e058b);})[_0x8df4('0x18')](function(_0x1e7e5c){logger['info'](util[_0x8df4('0x55')]('['+_0x5e058b[_0x8df4('0x1b')]()+_0x8df4('0x6b'),_0x18e2cf[_0x8df4('0x47')],_0x1e7e5c[_0x8df4('0x54')]));logger[_0x8df4('0x27')](util[_0x8df4('0x55')]('['+_0x5e058b[_0x8df4('0x1b')]()+']\x20Call\x20direction:\x20%s',_0x5e058b));if(_0x5e058b!=='unmanaged'&&_0x18e2cf['openNewTab']){logger[_0x8df4('0x27')]('['+_0x5e058b[_0x8df4('0x1b')]()+']',_0x8df4('0x6c'));emit(_0x3b9cd3['remoteUri'],_0x48f80c[_0x8df4('0x6d')],_0x18e2cf[_0x8df4('0x47')],_0x1e7e5c[_0x8df4('0x54')]);}})[_0x8df4('0x2d')](function(_0x90ab06){logger[_0x8df4('0x1a')]('['+_0x5e058b[_0x8df4('0x1b')]()+_0x8df4('0x6e'),_0x90ab06[_0x8df4('0x1c')]);console['error'](_0x8df4('0x6f'),_0x90ab06);});}; \ 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 25e85d0..7c253c8 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 _0x9cc6=['util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','name','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','customField','push','content','variable','variableName','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','uniqueid','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','toUpperCase','request-promise','md5'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cc6,0x1b6));var _0x69cc=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x9cc6[_0x5a7112];return _0x3147f7;};'use strict';var _=require('lodash');var rp=require(_0x69cc('0x0'));var md5=require(_0x69cc('0x1'));var util=require(_0x69cc('0x2'));var Redis=require(_0x69cc('0x3'));var intUtil=require(_0x69cc('0x4'));var config=require('../../../../config/environment');var logger=require(_0x69cc('0x5'))(_0x69cc('0x6'));config[_0x69cc('0x7')]=_[_0x69cc('0x8')](config['redis'],{'host':_0x69cc('0x9'),'port':0x18eb});var io=require(_0x69cc('0xa'))(new Redis(config[_0x69cc('0x7')]));var headers={'Content-Type':_0x69cc('0xb'),'Accept':_0x69cc('0xb')};function emit(_0x3ec856,_0x20f8df,_0xd6d6d2){io['to'](_0x3ec856)['emit'](_0x20f8df,_0xd6d6d2);}function getTicket(_0x11f81e,_0x1df57d,_0x3f58a1,_0x4ea142,_0x4b4d25){logger['info'](_0x69cc('0xc'));var _0x43e653=_[_0x69cc('0xd')]({'responder_id':_0x1df57d['id'],'requester_id':_0x3f58a1['id'],'name':util[_0x69cc('0xe')](_0x69cc('0xf'),_0x4b4d25[_0x69cc('0x10')]),'phone':_0x4b4d25[_0x69cc('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x4ea142[_0x69cc('0x12')],_0x4b4d25,'\x20'),'description':intUtil['getString'](_0x4ea142[_0x69cc('0x13')],_0x4b4d25,_0x69cc('0x14')),'tags':getTags(_0x4ea142['Tags'],_0x69cc('0x15'))},getCustomFields(_0x4ea142['Fields'],_0x4b4d25));_0x43e653[_0x69cc('0x16')]=_['mapValues'](_['keyBy'](_0x43e653[_0x69cc('0x16')],'id'),'value');return request({'uri':util[_0x69cc('0xe')](_0x69cc('0x17'),_0x11f81e[_0x69cc('0x18')]),'method':_0x69cc('0x19'),'body':_0x43e653})[_0x69cc('0x1a')](function(_0x19523a){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));return _0x19523a;});}function getUser(_0x168d03,_0x2d00fe){if(intUtil['validateEmail'](_0x2d00fe)){return request({'uri':util['format'](_0x69cc('0x1d'),_0x168d03[_0x69cc('0x18')]),'qs':{'email':_0x2d00fe}})[_0x69cc('0x1a')](function(_0x14c1c3){if(_0x14c1c3[_0x69cc('0x1e')]){logger['info'](_0x69cc('0x1f'));return _['find'](_0x14c1c3,function(_0x46e27f){return _0x46e27f['contact']['email']===_0x2d00fe;});}else{logger[_0x69cc('0x1b')](_0x69cc('0x20'));return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/agents/me',_0x168d03[_0x69cc('0x18')])})['then'](function(_0x3bea23){logger['info'](_0x69cc('0x21'));return _0x3bea23;});}});}else{logger['info'](_0x69cc('0x22'));return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/agents/me',_0x168d03[_0x69cc('0x18')])})['then'](function(_0x326627){logger[_0x69cc('0x1b')](_0x69cc('0x21'));return _0x326627;});}}function getEndUser(_0x1c5e85,_0x1243fc,_0x3803b4){logger[_0x69cc('0x1b')](_0x69cc('0x23'),_0x3803b4);return request({'uri':util[_0x69cc('0xe')]('%s/api/v2/contacts',_0x1c5e85['remoteUri']),'qs':{'phone':_0x3803b4}})['then'](function(_0x5697d8){if(_0x5697d8[_0x69cc('0x1e')]){logger[_0x69cc('0x1b')](_0x69cc('0x24'));return _[_0x69cc('0x25')](_0x5697d8,{'phone':_0x3803b4});}else{logger[_0x69cc('0x1b')](_0x69cc('0x26'));return request({'uri':util[_0x69cc('0xe')](_0x69cc('0x27'),_0x1c5e85['remoteUri']),'method':_0x69cc('0x19'),'body':{'name':_0x1243fc,'phone':_0x3803b4}})[_0x69cc('0x1a')](function(_0x2831d6){logger[_0x69cc('0x1b')](_0x69cc('0x28'));return _0x2831d6;});}});}function getAuth(_0x5e9ae6){return util[_0x69cc('0xe')](_0x69cc('0x29'),new Buffer(_0x5e9ae6[_0x69cc('0x2a')]+':X')[_0x69cc('0x2b')](_0x69cc('0x2c')));}function request(_0x385e79){logger[_0x69cc('0x2d')](_0x69cc('0x2e'),JSON[_0x69cc('0x2f')](_0x385e79));return rp(_['defaults'](_0x385e79,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x22707c,_0x34a566){var _0x342fd3=[];if(_0x22707c&&_0x22707c[_0x69cc('0x1e')]>0x0){_0x342fd3=_['map'](_0x22707c,_0x34a566);}return _0x342fd3;}function getCustomFields(_0x4bd45e,_0x2b56ee){var _0x6b46fa=[];var _0x1db601={'custom_fields':[]};if(_0x4bd45e[_0x69cc('0x1e')]>0x0){_[_0x69cc('0x30')](_0x4bd45e,function(_0x5b6ef0){if(_[_0x69cc('0x31')]([_0x69cc('0x32'),_0x69cc('0x33')],_0x5b6ef0[_0x69cc('0x34')])&&_0x5b6ef0[_0x69cc('0x35')]&&!_0x5b6ef0['customField']){_0x1db601[_0x5b6ef0['nameField'][_0x69cc('0x36')]()]=_0x5b6ef0['content'][_0x69cc('0x2b')]();}else if(_[_0x69cc('0x31')]([_0x69cc('0x32'),_0x69cc('0x33')],_0x5b6ef0[_0x69cc('0x34')])&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x1db601[_0x69cc('0x16')][_0x69cc('0x39')]({'id':_0x5b6ef0[_0x69cc('0x37')],'value':_0x5b6ef0[_0x69cc('0x3a')][_0x69cc('0x2b')]()});}else if(_0x5b6ef0[_0x69cc('0x34')]===_0x69cc('0x3b')&&_0x5b6ef0[_0x69cc('0x3c')]&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x2b56ee[_0x5b6ef0[_0x69cc('0x3c')]]&&_0x1db601[_0x69cc('0x16')][_0x69cc('0x39')]({'id':_0x5b6ef0[_0x69cc('0x37')],'value':_0x2b56ee[_0x5b6ef0[_0x69cc('0x3c')]][_0x69cc('0x2b')]()});}else if(_0x5b6ef0['type']==='customVariable'&&_0x5b6ef0[_0x69cc('0x3d')]&&_0x5b6ef0['Variable'][_0x69cc('0x15')]&&_0x5b6ef0[_0x69cc('0x37')]&&_0x5b6ef0[_0x69cc('0x38')]){_0x2b56ee[_0x5b6ef0['Variable'][_0x69cc('0x15')]['toLowerCase']()]&&_0x1db601['custom_fields']['push']({'id':_0x5b6ef0['idField'],'value':_0x2b56ee[_0x5b6ef0['Variable']['name'][_0x69cc('0x36')]()][_0x69cc('0x2b')]()});}});}return _0x1db601;}exports['queue']=function(_0x17db9a,_0x48d843,_0x556b1f,_0x3f36ac,_0x243ee6,_0x434e34){var _0x4fadd2,_0x19d4f0;_0x434e34['remoteUri']=intUtil[_0x69cc('0x3e')](_0x434e34['remoteUri']);_0x434e34['serverUrl']=intUtil[_0x69cc('0x3e')](_0x434e34[_0x69cc('0x3f')]);if(_0x243ee6&&_0x243ee6['monitor_format']){logger[_0x69cc('0x1b')](_0x69cc('0x40'),_0x69cc('0x41'));_0x48d843[_0x69cc('0x42')]=util[_0x69cc('0xe')](_0x69cc('0x43'),_0x434e34['serverUrl'],_0x48d843['uniqueid'],md5(_0x48d843['uniqueid']));}else{_0x48d843[_0x69cc('0x42')]='';}headers[_0x69cc('0x44')]=getAuth(_0x434e34);return getUser(_0x434e34,_0x3f36ac[_0x69cc('0x45')])[_0x69cc('0x1a')](function(_0x2f71ee){_0x4fadd2=_0x2f71ee;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x4fadd2['id']);return getEndUser(_0x434e34,_0x48d843['calleridname'],_0x48d843['calleridnum']);})['then'](function(_0x21039c){_0x19d4f0=_0x21039c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x19d4f0['id']);return getTicket(_0x434e34,_0x4fadd2,_0x19d4f0,_0x556b1f,_0x48d843);})[_0x69cc('0x1a')](function(_0x58e473){if(_0x58e473&&_0x58e473['id']){logger['info'](_0x69cc('0x1c'));logger[_0x69cc('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x58e473['id']);logger[_0x69cc('0x1b')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x69cc('0xe')](_0x69cc('0x47'),_0x3f36ac[_0x69cc('0x15')]),_0x69cc('0x48'),{'uri':util[_0x69cc('0xe')](_0x69cc('0x49'),_0x434e34[_0x69cc('0x18')],_0x58e473['id'])});}})[_0x69cc('0x4a')](function(_0x17cd9c){logger[_0x69cc('0x4b')]('[QUEUE]',JSON[_0x69cc('0x2f')](_0x17cd9c));});};exports[_0x69cc('0x4c')]=function(_0x238cc8,_0x2394d0,_0x1e687b,_0x153fa1,_0x503e7a,_0x5b8fb3,_0xf98e53){var _0x11eeff,_0x590bef;_0x5b8fb3[_0x69cc('0x18')]=intUtil[_0x69cc('0x3e')](_0x5b8fb3[_0x69cc('0x18')]);_0x5b8fb3[_0x69cc('0x3f')]=intUtil[_0x69cc('0x3e')](_0x5b8fb3[_0x69cc('0x3f')]);if(_0xf98e53&&_0xf98e53[_0x69cc('0x4d')]&&_0xf98e53[_0x69cc('0x4d')]!==_0x69cc('0x4e')){logger[_0x69cc('0x1b')]('[OUTBOUND]',_0x69cc('0x41'));_0x2394d0[_0x69cc('0x42')]=util[_0x69cc('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b8fb3[_0x69cc('0x3f')],_0x2394d0[_0x69cc('0x4f')],md5(_0x2394d0[_0x69cc('0x4f')]));}headers[_0x69cc('0x44')]=getAuth(_0x5b8fb3);return getUser(_0x5b8fb3,_0x153fa1[_0x69cc('0x45')])[_0x69cc('0x1a')](function(_0x4ccb4d){_0x11eeff=_0x4ccb4d;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x11eeff['id']);return getEndUser(_0x5b8fb3,_0x2394d0['destcalleridname'],_0x2394d0[_0x69cc('0x50')]);})[_0x69cc('0x1a')](function(_0x6d7c90){_0x590bef=_0x6d7c90;logger[_0x69cc('0x1b')](_0x69cc('0x51'),_0x590bef['id']);return getTicket(_0x5b8fb3,_0x11eeff,_0x590bef,_0x1e687b,_0x2394d0);})['then'](function(_0x2264c8){if(_0x2264c8&&_0x2264c8['id']){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));logger['info'](_0x69cc('0x52'),_0x2264c8['id']);logger[_0x69cc('0x1b')](_0x69cc('0x53'),_0x69cc('0x54'));emit(util['format'](_0x69cc('0x47'),_0x153fa1[_0x69cc('0x15')]),_0x69cc('0x48'),{'uri':util[_0x69cc('0xe')](_0x69cc('0x49'),_0x5b8fb3[_0x69cc('0x18')],_0x2264c8['id'])});}})[_0x69cc('0x4a')](function(_0x45ae92){logger[_0x69cc('0x4b')]('[OUTBOUND]',JSON['stringify'](_0x45ae92));});};exports[_0x69cc('0x55')]=function(_0xc5f497,_0x3c2033,_0x5b365b,_0x4eebae,_0x20d7d0,_0x1521df){var _0x5aaf34,_0x10b78e;_0x1521df[_0x69cc('0x18')]=intUtil[_0x69cc('0x3e')](_0x1521df[_0x69cc('0x18')]);_0x1521df[_0x69cc('0x3f')]=intUtil[_0x69cc('0x3e')](_0x1521df[_0x69cc('0x3f')]);if(_0x20d7d0&&_0x20d7d0[_0x69cc('0x56')]){logger['info']('['+_0x3c2033['lastevent'][_0x69cc('0x57')]()+']',_0x69cc('0x41'));_0x3c2033[_0x69cc('0x42')]=util[_0x69cc('0xe')](_0x69cc('0x43'),_0x1521df['serverUrl'],_0x3c2033[_0x69cc('0x4f')],md5(_0x3c2033[_0x69cc('0x4f')]));}else{_0x3c2033[_0x69cc('0x42')]='';}headers[_0x69cc('0x44')]=getAuth(_0x1521df);return getUser(_0x1521df,'')[_0x69cc('0x1a')](function(_0x46823a){_0x5aaf34=_0x46823a;logger[_0x69cc('0x1b')](_0x69cc('0x46'),_0x5aaf34['id']);return getEndUser(_0x1521df,_0x3c2033[_0x69cc('0x10')],_0x3c2033['calleridnum']);})['then'](function(_0x17d298){_0x10b78e=_0x17d298;logger['info']('The\x20Enduser\x20ID\x20is:',_0x10b78e['id']);return getTicket(_0x1521df,_0x5aaf34,_0x10b78e,_0x5b365b,_0x3c2033);})[_0x69cc('0x1a')](function(_0x364037){if(_0x364037){logger[_0x69cc('0x1b')](_0x69cc('0x1c'));logger[_0x69cc('0x1b')](_0x69cc('0x52'),_0x364037['id']);}})['catch'](function(_0x5f39b0){logger[_0x69cc('0x4b')]('['+_0x3c2033['lastevent'][_0x69cc('0x57')]()+']',JSON[_0x69cc('0x2f')](_0x5f39b0));});}; \ No newline at end of file +var _0x6747=['[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','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','toString','base64','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x6747,0x72));var _0x7674=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x6747[_0x2b91c5];return _0xbd5531;};'use strict';var _=require(_0x7674('0x0'));var rp=require('request-promise');var md5=require(_0x7674('0x1'));var util=require(_0x7674('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7674('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7674('0x4'))(_0x7674('0x5'));config[_0x7674('0x6')]=_[_0x7674('0x7')](config[_0x7674('0x6')],{'host':_0x7674('0x8'),'port':0x18eb});var io=require(_0x7674('0x9'))(new Redis(config[_0x7674('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x7674('0xa')};function emit(_0x3eb379,_0x252b84,_0x2ea400){io['to'](_0x3eb379)[_0x7674('0xb')](_0x252b84,_0x2ea400);}function getTicket(_0x1b1691,_0x128958,_0x40b445,_0x2cbac5,_0x4780c1){logger[_0x7674('0xc')]('Creating\x20new\x20ticket...');var _0x3a3e32=_[_0x7674('0xd')]({'responder_id':_0x128958['id'],'requester_id':_0x40b445['id'],'name':util[_0x7674('0xe')](_0x7674('0xf'),_0x4780c1[_0x7674('0x10')]),'phone':_0x4780c1[_0x7674('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2cbac5[_0x7674('0x12')],_0x4780c1,'\x20'),'description':intUtil[_0x7674('0x13')](_0x2cbac5[_0x7674('0x14')],_0x4780c1,_0x7674('0x15')),'tags':getTags(_0x2cbac5[_0x7674('0x16')],_0x7674('0x17'))},getCustomFields(_0x2cbac5[_0x7674('0x18')],_0x4780c1));_0x3a3e32[_0x7674('0x19')]=_[_0x7674('0x1a')](_[_0x7674('0x1b')](_0x3a3e32[_0x7674('0x19')],'id'),'value');return request({'uri':util['format'](_0x7674('0x1c'),_0x1b1691[_0x7674('0x1d')]),'method':_0x7674('0x1e'),'body':_0x3a3e32})[_0x7674('0x1f')](function(_0x304272){logger[_0x7674('0xc')](_0x7674('0x20'));return _0x304272;});}function getUser(_0x4cf54b,_0x24c7da){if(intUtil[_0x7674('0x21')](_0x24c7da)){return request({'uri':util[_0x7674('0xe')]('%s/api/v2/agents',_0x4cf54b[_0x7674('0x1d')]),'qs':{'email':_0x24c7da}})['then'](function(_0x391145){if(_0x391145[_0x7674('0x22')]){logger[_0x7674('0xc')](_0x7674('0x23'));return _[_0x7674('0x24')](_0x391145,function(_0x419424){return _0x419424[_0x7674('0x25')]['email']===_0x24c7da;});}else{logger['info'](_0x7674('0x26'));return request({'uri':util[_0x7674('0xe')](_0x7674('0x27'),_0x4cf54b[_0x7674('0x1d')])})[_0x7674('0x1f')](function(_0x438de6){logger[_0x7674('0xc')](_0x7674('0x28'));return _0x438de6;});}});}else{logger[_0x7674('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7674('0xe')](_0x7674('0x27'),_0x4cf54b[_0x7674('0x1d')])})[_0x7674('0x1f')](function(_0x50d523){logger[_0x7674('0xc')](_0x7674('0x28'));return _0x50d523;});}}function getEndUser(_0x944e63,_0x2d749a,_0x10fbc9){logger[_0x7674('0xc')](_0x7674('0x29'),_0x10fbc9);return request({'uri':util[_0x7674('0xe')](_0x7674('0x2a'),_0x944e63['remoteUri']),'qs':{'phone':_0x10fbc9}})[_0x7674('0x1f')](function(_0x29c49d){if(_0x29c49d[_0x7674('0x22')]){logger[_0x7674('0xc')](_0x7674('0x2b'));return _[_0x7674('0x24')](_0x29c49d,{'phone':_0x10fbc9});}else{logger[_0x7674('0xc')](_0x7674('0x2c'));return request({'uri':util[_0x7674('0xe')]('%s/api/v2/contacts',_0x944e63[_0x7674('0x1d')]),'method':_0x7674('0x1e'),'body':{'name':_0x2d749a,'phone':_0x10fbc9}})[_0x7674('0x1f')](function(_0x5be463){logger['info'](_0x7674('0x2d'));return _0x5be463;});}});}function getAuth(_0x4c66df){return util[_0x7674('0xe')](_0x7674('0x2e'),new Buffer(_0x4c66df['apiKey']+':X')[_0x7674('0x2f')](_0x7674('0x30')));}function request(_0x221ec8){logger['debug']('[HTTP]',JSON[_0x7674('0x31')](_0x221ec8));return rp(_[_0x7674('0x7')](_0x221ec8,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2c5554,_0x3c23ec){var _0x34dfa1=[];if(_0x2c5554&&_0x2c5554['length']>0x0){_0x34dfa1=_[_0x7674('0x32')](_0x2c5554,_0x3c23ec);}return _0x34dfa1;}function getCustomFields(_0x5bbdbf,_0x2fa855){var _0x42f859=[];var _0x5ab156={'custom_fields':[]};if(_0x5bbdbf[_0x7674('0x22')]>0x0){_[_0x7674('0x33')](_0x5bbdbf,function(_0x14c1d4){if(_[_0x7674('0x34')]([_0x7674('0x35'),_0x7674('0x36')],_0x14c1d4[_0x7674('0x37')])&&_0x14c1d4[_0x7674('0x38')]&&!_0x14c1d4[_0x7674('0x39')]){_0x5ab156[_0x14c1d4[_0x7674('0x38')][_0x7674('0x3a')]()]=_0x14c1d4[_0x7674('0x3b')][_0x7674('0x2f')]();}else if(_['includes']([_0x7674('0x35'),_0x7674('0x36')],_0x14c1d4[_0x7674('0x37')])&&_0x14c1d4[_0x7674('0x3c')]&&_0x14c1d4[_0x7674('0x39')]){_0x5ab156[_0x7674('0x19')][_0x7674('0x3d')]({'id':_0x14c1d4['idField'],'value':_0x14c1d4[_0x7674('0x3b')][_0x7674('0x2f')]()});}else if(_0x14c1d4[_0x7674('0x37')]===_0x7674('0x3e')&&_0x14c1d4[_0x7674('0x3f')]&&_0x14c1d4[_0x7674('0x3c')]&&_0x14c1d4['customField']){_0x2fa855[_0x14c1d4[_0x7674('0x3f')]]&&_0x5ab156[_0x7674('0x19')][_0x7674('0x3d')]({'id':_0x14c1d4[_0x7674('0x3c')],'value':_0x2fa855[_0x14c1d4[_0x7674('0x3f')]][_0x7674('0x2f')]()});}else if(_0x14c1d4[_0x7674('0x37')]==='customVariable'&&_0x14c1d4[_0x7674('0x40')]&&_0x14c1d4[_0x7674('0x40')][_0x7674('0x17')]&&_0x14c1d4[_0x7674('0x3c')]&&_0x14c1d4['customField']){_0x2fa855[_0x14c1d4['Variable'][_0x7674('0x17')][_0x7674('0x3a')]()]&&_0x5ab156['custom_fields']['push']({'id':_0x14c1d4['idField'],'value':_0x2fa855[_0x14c1d4[_0x7674('0x40')]['name'][_0x7674('0x3a')]()]['toString']()});}});}return _0x5ab156;}exports[_0x7674('0x41')]=function(_0x53f10b,_0x3fb9d7,_0x270648,_0x5a3352,_0x5965c5,_0x3193f6){var _0x567b1d,_0x2f59ae;_0x3193f6['remoteUri']=intUtil['stripTrailingSlash'](_0x3193f6[_0x7674('0x1d')]);_0x3193f6[_0x7674('0x42')]=intUtil[_0x7674('0x43')](_0x3193f6[_0x7674('0x42')]);if(_0x5965c5&&_0x5965c5[_0x7674('0x44')]){logger[_0x7674('0xc')]('[QUEUE]',_0x7674('0x45'));_0x3fb9d7[_0x7674('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3193f6[_0x7674('0x42')],_0x3fb9d7[_0x7674('0x47')],md5(_0x3fb9d7[_0x7674('0x47')]));}else{_0x3fb9d7[_0x7674('0x46')]='';}headers[_0x7674('0x48')]=getAuth(_0x3193f6);return getUser(_0x3193f6,_0x5a3352['email'])[_0x7674('0x1f')](function(_0x12b596){_0x567b1d=_0x12b596;logger['info']('The\x20User\x20ID\x20is:',_0x567b1d['id']);return getEndUser(_0x3193f6,_0x3fb9d7[_0x7674('0x10')],_0x3fb9d7[_0x7674('0x11')]);})[_0x7674('0x1f')](function(_0x3c1c25){_0x2f59ae=_0x3c1c25;logger[_0x7674('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2f59ae['id']);return getTicket(_0x3193f6,_0x567b1d,_0x2f59ae,_0x270648,_0x3fb9d7);})['then'](function(_0x103c8f){if(_0x103c8f&&_0x103c8f['id']){logger[_0x7674('0xc')](_0x7674('0x20'));logger[_0x7674('0xc')](_0x7674('0x49'),_0x103c8f['id']);logger['info'](_0x7674('0x4a'),_0x7674('0x4b'));emit(util[_0x7674('0xe')](_0x7674('0x4c'),_0x5a3352[_0x7674('0x17')]),'trigger:browser:url',{'uri':util['format'](_0x7674('0x4d'),_0x3193f6[_0x7674('0x1d')],_0x103c8f['id'])});}})[_0x7674('0x4e')](function(_0x502f39){logger[_0x7674('0x4f')](_0x7674('0x4a'),JSON['stringify'](_0x502f39));});};exports[_0x7674('0x50')]=function(_0xc2be26,_0x5100cf,_0x369343,_0x954dc4,_0x37fec6,_0xda224f,_0x3e2760){var _0x1487ef,_0x5b8dee;_0xda224f['remoteUri']=intUtil[_0x7674('0x43')](_0xda224f['remoteUri']);_0xda224f[_0x7674('0x42')]=intUtil[_0x7674('0x43')](_0xda224f['serverUrl']);if(_0x3e2760&&_0x3e2760[_0x7674('0x51')]&&_0x3e2760[_0x7674('0x51')]!==_0x7674('0x52')){logger[_0x7674('0xc')](_0x7674('0x53'),_0x7674('0x45'));_0x5100cf[_0x7674('0x46')]=util[_0x7674('0xe')](_0x7674('0x54'),_0xda224f['serverUrl'],_0x5100cf[_0x7674('0x47')],md5(_0x5100cf['uniqueid']));}headers[_0x7674('0x48')]=getAuth(_0xda224f);return getUser(_0xda224f,_0x954dc4[_0x7674('0x55')])[_0x7674('0x1f')](function(_0x48eb51){_0x1487ef=_0x48eb51;logger[_0x7674('0xc')](_0x7674('0x56'),_0x1487ef['id']);return getEndUser(_0xda224f,_0x5100cf[_0x7674('0x57')],_0x5100cf[_0x7674('0x58')]);})[_0x7674('0x1f')](function(_0x3b7c59){_0x5b8dee=_0x3b7c59;logger[_0x7674('0xc')](_0x7674('0x59'),_0x5b8dee['id']);return getTicket(_0xda224f,_0x1487ef,_0x5b8dee,_0x369343,_0x5100cf);})[_0x7674('0x1f')](function(_0x300146){if(_0x300146&&_0x300146['id']){logger[_0x7674('0xc')](_0x7674('0x20'));logger[_0x7674('0xc')]('The\x20Ticket\x20ID\x20is:',_0x300146['id']);logger[_0x7674('0xc')](_0x7674('0x53'),_0x7674('0x4b'));emit(util[_0x7674('0xe')]('user:%s',_0x954dc4[_0x7674('0x17')]),_0x7674('0x5a'),{'uri':util['format'](_0x7674('0x4d'),_0xda224f[_0x7674('0x1d')],_0x300146['id'])});}})[_0x7674('0x4e')](function(_0x2a6216){logger[_0x7674('0x4f')](_0x7674('0x53'),JSON['stringify'](_0x2a6216));});};exports[_0x7674('0x5b')]=function(_0x491c1f,_0x2de519,_0x398d3d,_0x158943,_0x26c06d,_0xf7daf9){var _0xbccf0b,_0x1d0451;_0xf7daf9[_0x7674('0x1d')]=intUtil[_0x7674('0x43')](_0xf7daf9[_0x7674('0x1d')]);_0xf7daf9['serverUrl']=intUtil[_0x7674('0x43')](_0xf7daf9[_0x7674('0x42')]);if(_0x26c06d&&_0x26c06d['monitor_format']){logger[_0x7674('0xc')]('['+_0x2de519[_0x7674('0x5c')][_0x7674('0x5d')]()+']','Recording\x20is\x20enabled!');_0x2de519[_0x7674('0x46')]=util[_0x7674('0xe')](_0x7674('0x54'),_0xf7daf9[_0x7674('0x42')],_0x2de519[_0x7674('0x47')],md5(_0x2de519['uniqueid']));}else{_0x2de519['recordingURL']='';}headers[_0x7674('0x48')]=getAuth(_0xf7daf9);return getUser(_0xf7daf9,'')[_0x7674('0x1f')](function(_0x211a7e){_0xbccf0b=_0x211a7e;logger['info']('The\x20User\x20ID\x20is:',_0xbccf0b['id']);return getEndUser(_0xf7daf9,_0x2de519[_0x7674('0x10')],_0x2de519[_0x7674('0x11')]);})['then'](function(_0x5bafa9){_0x1d0451=_0x5bafa9;logger[_0x7674('0xc')](_0x7674('0x59'),_0x1d0451['id']);return getTicket(_0xf7daf9,_0xbccf0b,_0x1d0451,_0x398d3d,_0x2de519);})[_0x7674('0x1f')](function(_0x1aca97){if(_0x1aca97){logger['info'](_0x7674('0x20'));logger[_0x7674('0xc')](_0x7674('0x49'),_0x1aca97['id']);}})[_0x7674('0x4e')](function(_0x2569be){logger[_0x7674('0x4f')]('['+_0x2de519[_0x7674('0x5c')][_0x7674('0x5d')]()+']',JSON[_0x7674('0x31')](_0x2569be));});}; \ 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 03d6a5b..c83f673 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 _0x2fb8=['User\x20found:','Admin\x20selected','error','toUpperCase','/api/lookup?q=','&f=','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','unmanaged','queue','%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',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId'];(function(_0x4d8310,_0x5df4fc){var _0xf9d244=function(_0x3e4600){while(--_0x3e4600){_0x4d8310['push'](_0x4d8310['shift']());}};_0xf9d244(++_0x5df4fc);}(_0x2fb8,0x12c));var _0x82fb=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2fb8[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x82fb('0x0'));var moment=require(_0x82fb('0x1'));var Promise=require(_0x82fb('0x2'));var Redis=require(_0x82fb('0x3'));var intUtil=require(_0x82fb('0x4'));var config=require(_0x82fb('0x5'));var logger=require(_0x82fb('0x6'))(_0x82fb('0x7'));config['redis']=_[_0x82fb('0x8')](config['redis'],{'host':_0x82fb('0x9'),'port':0x18eb});var io=require(_0x82fb('0xa'))(new Redis(config[_0x82fb('0xb')]));function getAdminId(_0x1ed4a7,_0x2d2267,_0x2f006a,_0x24b25c){return new Promise(function(_0x45534e,_0x1f26b5){var _0xa8d494=![];var _0x4c3860={'method':_0x82fb('0xc'),'uri':_0x24b25c+_0x82fb('0xd'),'json':!![]};_0x4c3860[_0x82fb('0xe')]=_0x2f006a;logger['info'](_0x82fb('0xf'));return rp(_0x4c3860)[_0x82fb('0x10')](function(_0x21483f){if(_0x21483f){var _0x4201ed=_0x21483f['users'];var _0x2b22c4=null;for(_0x2b22c4=0x0;_0x2b22c4<_0x4201ed['length'];_0x2b22c4++){if(_0x4201ed[_0x2b22c4]['email']===_0x1ed4a7[_0x82fb('0x11')]){_0x1ed4a7[_0x82fb('0x12')]=_0x4201ed[_0x2b22c4]['id'];_0xa8d494=!![];}}if(_0xa8d494){logger[_0x82fb('0x13')](_0x82fb('0x14'),_0x1ed4a7[_0x82fb('0x12')]);_0x45534e(_0x1ed4a7);}else{_0x1f26b5({'statusCode':0x194,'message':_0x82fb('0x15')});}}else{_0x1f26b5({'statusCode':0x194,'message':_0x82fb('0x15')});}})[_0x82fb('0x16')](function(_0x3b74e4){logger['error']('['+[_0x2d2267['toUpperCase']()]+']',_0x3b74e4[_0x82fb('0x17')]);_0x1f26b5(_0x3b74e4);});});}function getUser(_0x340933,_0x5602b8,_0x11adc0){return function(_0x31f877){return new Promise(function(_0x220623,_0x197d88){var _0x306c54={'method':_0x82fb('0xc'),'uri':_0x11adc0+_0x82fb('0xd'),'json':!![]};_0x306c54['headers']=_0x5602b8;logger[_0x82fb('0x13')](_0x82fb('0x18'));return rp(_0x306c54)[_0x82fb('0x10')](function(_0x1220b0){if(_0x1220b0){var _0x2f4a9b=_0x1220b0[_0x82fb('0x19')];var _0x1141fb=![];var _0x437810=null;if(_0x31f877[_0x82fb('0x1a')]!==null){logger[_0x82fb('0x13')](_0x82fb('0x1b'),_0x31f877[_0x82fb('0x1a')]);_0x31f877[_0x82fb('0x1c')]=_0x31f877[_0x82fb('0x1a')];for(_0x437810=0x0;_0x437810<_0x2f4a9b[_0x82fb('0x1d')];_0x437810++){if(_0x2f4a9b[_0x437810][_0x82fb('0x1e')]===_0x31f877[_0x82fb('0x1a')]){_0x1141fb=!![];_0x31f877[_0x82fb('0x1f')]=_0x2f4a9b[_0x437810]['id'];logger[_0x82fb('0x13')](_0x82fb('0x20'),_0x31f877[_0x82fb('0x1f')]);}}}if(!_0x1141fb){logger[_0x82fb('0x13')](_0x82fb('0x21'));_0x31f877[_0x82fb('0x1c')]=_0x31f877[_0x82fb('0x11')];_0x31f877[_0x82fb('0x1f')]=_0x31f877[_0x82fb('0x12')];_0x1141fb=!![];}if(_0x1141fb){_0x220623(_0x31f877);}else{_0x197d88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x197d88({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x82fb('0x16')](function(_0x4f40bb){logger[_0x82fb('0x22')]('['+[_0x340933[_0x82fb('0x23')]()]+']',_0x4f40bb[_0x82fb('0x17')]);_0x197d88(_0x4f40bb);});});};}function searchContact(_0x1cdedc,_0x106bd4,_0xecf5c5,_0xd8e919){return new Promise(function(_0xa586e0,_0x3e1761){var _0x456e9d={'method':'GET','headers':_0x106bd4,'uri':_0x1cdedc+_0x82fb('0x24')+_0xd8e919+_0x82fb('0x25')+_0xecf5c5+'&entities=contact','json':!![]};rp(_0x456e9d)[_0x82fb('0x10')](function(_0x3dd254){var _0x53fe92=_['find'](_0x3dd254[_0x82fb('0x26')][_0x82fb('0x26')],[_0xecf5c5,_0xd8e919]);_0xa586e0(_0x53fe92);})[_0x82fb('0x16')](function(_0x28c6c5){_0x3e1761(_0x28c6c5);});});}function getEndUser(_0x5e2be0,_0x5c3ae0,_0x47d6bc){return function(_0x45c26c){return new Promise(function(_0x2e6e65,_0x3f90e3){logger[_0x82fb('0x13')](util[_0x82fb('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x45c26c[_0x82fb('0x28')]));searchContact(_0x47d6bc,_0x5c3ae0,_0x82fb('0x29'),_0x45c26c[_0x82fb('0x28')])[_0x82fb('0x10')](function(_0x562cc2){if(_0x562cc2){_0x45c26c['endUserId']=_0x562cc2['id'];logger['info'](_0x82fb('0x2a'),_0x45c26c['endUserId']);return _0x2e6e65(_0x45c26c);}searchContact(_0x47d6bc,_0x5c3ae0,_0x82fb('0x2b'),_0x45c26c[_0x82fb('0x28')])[_0x82fb('0x10')](function(_0x518aae){if(_0x518aae){_0x45c26c[_0x82fb('0x2c')]=_0x518aae['id'];logger[_0x82fb('0x13')](_0x82fb('0x2d'),_0x45c26c[_0x82fb('0x2c')]);return _0x2e6e65(_0x45c26c);}createEndUser(_0x45c26c,_0x5e2be0,_0x5c3ae0,_0x47d6bc)[_0x82fb('0x10')](function(_0xc83806){logger[_0x82fb('0x13')]('Contact\x20created:',_0xc83806[_0x82fb('0x2c')]);return _0x2e6e65(_0xc83806);});});})[_0x82fb('0x16')](function(_0x46a36e){_0x3f90e3(_0x46a36e);});});};}function createEndUser(_0x33e78b,_0x50fd93,_0x1ba79f,_0x6c60ad){return new Promise(function(_0x521ba5,_0x134e83){var _0x359d4f=moment();var _0x281203={'method':_0x82fb('0x2e'),'uri':_0x6c60ad+_0x82fb('0x2f'),'body':{'contact':{'last_name':_0x33e78b[_0x82fb('0x28')],'work_number':_0x33e78b[_0x82fb('0x28')],'mobile_number':_0x33e78b[_0x82fb('0x28')],'owner_id':_0x33e78b['userId'],'created_at':_0x359d4f[_0x82fb('0x27')](_0x82fb('0x30'))}},'json':!![]};_0x281203['headers']=_0x1ba79f;logger[_0x82fb('0x13')](_0x82fb('0x31'));return rp(_0x281203)['then'](function(_0x51d0c4){_0x33e78b[_0x82fb('0x2c')]=_0x51d0c4['contact']['id'];_0x521ba5(_0x33e78b);})[_0x82fb('0x16')](function(_0x47fb60){logger[_0x82fb('0x22')]('['+[_0x50fd93['toUpperCase']()]+']',_0x47fb60['message']);_0x134e83(_0x47fb60['message']);});});}function getTicket(_0x32e65f,_0x12fd79,_0x347452,_0x152818,_0x38c3a9){return function(_0x82856c){logger[_0x82fb('0x13')](_0x82fb('0x32'));return new Promise(function(_0x50fefa,_0x31d648){var _0x420522=moment();var _0x3a76e8={'method':_0x82fb('0x2e'),'uri':_0x347452+'/api/tasks','body':{'title':intUtil[_0x82fb('0x33')](_0x152818[_0x82fb('0x34')],_0x38c3a9,'\x20'),'description':intUtil['getString'](_0x152818[_0x82fb('0x35')],_0x38c3a9,'\x0a'),'owner_id':_0x82856c['userId'],'creater_id':_0x82856c[_0x82fb('0x12')],'targetable_id':_0x82856c['endUserId'],'targetable_type':_0x82fb('0x36'),'created_at':_0x420522[_0x82fb('0x27')](_0x82fb('0x30')),'due_date':_0x420522[_0x82fb('0x37')](0x1e,'m')[_0x82fb('0x27')](_0x82fb('0x30'))},'json':!![]};_0x3a76e8[_0x82fb('0xe')]=_0x12fd79;return rp(_0x3a76e8)[_0x82fb('0x10')](function(_0x2243db){_0x82856c[_0x82fb('0x38')]=_0x2243db[_0x82fb('0x39')]['id'];logger['info'](_0x82fb('0x3a'),_0x82856c[_0x82fb('0x38')]);_0x50fefa(_0x82856c);})[_0x82fb('0x16')](function(_0x43aeab){logger[_0x82fb('0x22')]('['+[_0x32e65f[_0x82fb('0x23')]()]+']',_0x43aeab[_0x82fb('0x17')]);_0x31d648(_0x43aeab['message']);});});};}function emit(_0x5a732c,_0x133580,_0x15bedc){var _0x83ac54={'uri':_0x5a732c+_0x82fb('0x3b')+_0x15bedc};io['to'](util[_0x82fb('0x27')](_0x82fb('0x3c'),_0x133580))['emit'](_0x82fb('0x3d'),_0x83ac54);}exports['cs']=function(_0x239f72,_0x294bf1,_0x35315b,_0x24ceb2,_0x3199fa,_0x41d2e7,_0x2ca4f4,_0x280ef4){var _0x5072f4={};var _0x14fed9={'Authorization':_0x82fb('0x3e')+_0x41d2e7['apiKey']};_0x41d2e7[_0x82fb('0x3f')]=intUtil['stripTrailingSlash'](_0x41d2e7['remoteUri']);_0x41d2e7['serverUrl']=intUtil[_0x82fb('0x40')](_0x41d2e7[_0x82fb('0x41')]);var _0x161d28=_0x41d2e7[_0x82fb('0x3f')];_0x5072f4[_0x82fb('0x11')]=_0x41d2e7[_0x82fb('0x42')];_0x5072f4[_0x82fb('0x28')]=_0x280ef4[_0x82fb('0x43')]()===_0x82fb('0x44')?_0x294bf1['destcalleridnum']:_0x294bf1[_0x82fb('0x45')];_0x5072f4[_0x82fb('0x46')]=_0x280ef4==='queue'||_0x280ef4===_0x82fb('0x47')?_0x82fb('0x48'):_0x82fb('0x44');if(_0x24ceb2){_0x5072f4['agentEmail']=_0x24ceb2[_0x82fb('0x1e')];}var _0x4fadb4=util[_0x82fb('0x27')](_0x82fb('0x49'),_0x41d2e7['serverUrl'],_0x294bf1[_0x82fb('0x4a')],md5(_0x294bf1['uniqueid']));if(_0x3199fa&&_0x3199fa[_0x82fb('0x4b')]){logger[_0x82fb('0x13')]('[QUEUE]',_0x82fb('0x4c'));_0x294bf1[_0x82fb('0x4d')]=_0x4fadb4;}else if(_0x2ca4f4&&_0x2ca4f4[_0x82fb('0x4e')]&&_0x2ca4f4[_0x82fb('0x4e')]!==_0x82fb('0x4f')){logger[_0x82fb('0x13')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x294bf1[_0x82fb('0x4d')]=_0x4fadb4;}else{_0x294bf1['recordingURL']='';}return getAdminId(_0x5072f4,_0x280ef4,_0x14fed9,_0x161d28)[_0x82fb('0x10')](getUser(_0x280ef4,_0x14fed9,_0x161d28))['then'](getEndUser(_0x280ef4,_0x14fed9,_0x161d28))['then'](getTicket(_0x280ef4,_0x14fed9,_0x161d28,_0x35315b,_0x294bf1))[_0x82fb('0x10')](function(_0xa56cb0){logger['info'](util[_0x82fb('0x27')](_0x82fb('0x50'),_0xa56cb0[_0x82fb('0x38')]));if(_0x280ef4!==_0x82fb('0x47')){logger[_0x82fb('0x13')]('['+[_0x280ef4[_0x82fb('0x23')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x161d28,_0x24ceb2['name'],_0xa56cb0[_0x82fb('0x2c')]);}})[_0x82fb('0x16')](function(_0x1ff5cc){logger[_0x82fb('0x22')]('['+[_0x280ef4[_0x82fb('0x23')]()]+_0x82fb('0x51'),util[_0x82fb('0x52')](_0x1ff5cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x45db=['Admin\x20selected','toUpperCase','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','localhost','socket.io-emitter','redis','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','GET','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:'];(function(_0x1a2ac5,_0x431ac7){var _0x2cedd0=function(_0x169aac){while(--_0x169aac){_0x1a2ac5['push'](_0x1a2ac5['shift']());}};_0x2cedd0(++_0x431ac7);}(_0x45db,0x189));var _0xb45d=function(_0xfb7bbc,_0x586acf){_0xfb7bbc=_0xfb7bbc-0x0;var _0x6893ec=_0x45db[_0xfb7bbc];return _0x6893ec;};'use strict';var _=require(_0xb45d('0x0'));var rp=require(_0xb45d('0x1'));var md5=require('md5');var util=require(_0xb45d('0x2'));var moment=require(_0xb45d('0x3'));var Promise=require(_0xb45d('0x4'));var Redis=require(_0xb45d('0x5'));var intUtil=require(_0xb45d('0x6'));var config=require(_0xb45d('0x7'));var logger=require('../../../../config/logger')(_0xb45d('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0xb45d('0x9'),'port':0x18eb});var io=require(_0xb45d('0xa'))(new Redis(config[_0xb45d('0xb')]));function getAdminId(_0xaca79a,_0xd1e802,_0x9a2423,_0x3627ba){return new Promise(function(_0x4f8be7,_0x1a9499){var _0x4383b5=![];var _0x108b4b={'method':'GET','uri':_0x3627ba+_0xb45d('0xc'),'json':!![]};_0x108b4b[_0xb45d('0xd')]=_0x9a2423;logger[_0xb45d('0xe')](_0xb45d('0xf'));return rp(_0x108b4b)['then'](function(_0x486f6d){if(_0x486f6d){var _0x325a04=_0x486f6d[_0xb45d('0x10')];var _0x508225=null;for(_0x508225=0x0;_0x508225<_0x325a04['length'];_0x508225++){if(_0x325a04[_0x508225][_0xb45d('0x11')]===_0xaca79a[_0xb45d('0x12')]){_0xaca79a[_0xb45d('0x13')]=_0x325a04[_0x508225]['id'];_0x4383b5=!![];}}if(_0x4383b5){logger['info'](_0xb45d('0x14'),_0xaca79a['adminId']);_0x4f8be7(_0xaca79a);}else{_0x1a9499({'statusCode':0x194,'message':_0xb45d('0x15')});}}else{_0x1a9499({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb45d('0x16')](function(_0x445e81){logger[_0xb45d('0x17')]('['+[_0xd1e802['toUpperCase']()]+']',_0x445e81['message']);_0x1a9499(_0x445e81);});});}function getUser(_0xd83b34,_0x1d8b3c,_0x14854f){return function(_0x5b1f13){return new Promise(function(_0x3f0651,_0x2ba568){var _0xdef6ce={'method':_0xb45d('0x18'),'uri':_0x14854f+_0xb45d('0xc'),'json':!![]};_0xdef6ce[_0xb45d('0xd')]=_0x1d8b3c;logger[_0xb45d('0xe')](_0xb45d('0x19'));return rp(_0xdef6ce)[_0xb45d('0x1a')](function(_0x48af27){if(_0x48af27){var _0x2b93e7=_0x48af27[_0xb45d('0x10')];var _0x74859b=![];var _0x1a51e2=null;if(_0x5b1f13[_0xb45d('0x1b')]!==null){logger[_0xb45d('0xe')](_0xb45d('0x1c'),_0x5b1f13[_0xb45d('0x1b')]);_0x5b1f13[_0xb45d('0x1d')]=_0x5b1f13['agentEmail'];for(_0x1a51e2=0x0;_0x1a51e2<_0x2b93e7['length'];_0x1a51e2++){if(_0x2b93e7[_0x1a51e2][_0xb45d('0x11')]===_0x5b1f13[_0xb45d('0x1b')]){_0x74859b=!![];_0x5b1f13[_0xb45d('0x1e')]=_0x2b93e7[_0x1a51e2]['id'];logger[_0xb45d('0xe')](_0xb45d('0x1f'),_0x5b1f13[_0xb45d('0x1e')]);}}}if(!_0x74859b){logger['info'](_0xb45d('0x20'));_0x5b1f13[_0xb45d('0x1d')]=_0x5b1f13[_0xb45d('0x12')];_0x5b1f13[_0xb45d('0x1e')]=_0x5b1f13[_0xb45d('0x13')];_0x74859b=!![];}if(_0x74859b){_0x3f0651(_0x5b1f13);}else{_0x2ba568({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2ba568({'statusCode':0x194,'message':_0xb45d('0x15')});}})[_0xb45d('0x16')](function(_0x4f4218){logger['error']('['+[_0xd83b34[_0xb45d('0x21')]()]+']',_0x4f4218[_0xb45d('0x22')]);_0x2ba568(_0x4f4218);});});};}function searchContact(_0x183229,_0x43a97f,_0x33fb60,_0x577c49){return new Promise(function(_0x366ac9,_0x4d7cec){var _0x2d5546={'method':'GET','headers':_0x43a97f,'uri':_0x183229+_0xb45d('0x23')+_0x577c49+_0xb45d('0x24')+_0x33fb60+_0xb45d('0x25'),'json':!![]};rp(_0x2d5546)['then'](function(_0x3918bc){var _0x376c61=_[_0xb45d('0x26')](_0x3918bc[_0xb45d('0x27')][_0xb45d('0x27')],[_0x33fb60,_0x577c49]);_0x366ac9(_0x376c61);})['catch'](function(_0x36672d){_0x4d7cec(_0x36672d);});});}function getEndUser(_0x1dc955,_0x5acd95,_0x39b7a7){return function(_0x42ac3e){return new Promise(function(_0x5ad33d,_0x1eb1eb){logger[_0xb45d('0xe')](util[_0xb45d('0x28')]('Searching\x20contact\x20with\x20phone\x20%s',_0x42ac3e[_0xb45d('0x29')]));searchContact(_0x39b7a7,_0x5acd95,_0xb45d('0x2a'),_0x42ac3e[_0xb45d('0x29')])['then'](function(_0x1f5473){if(_0x1f5473){_0x42ac3e[_0xb45d('0x2b')]=_0x1f5473['id'];logger['info'](_0xb45d('0x2c'),_0x42ac3e[_0xb45d('0x2b')]);return _0x5ad33d(_0x42ac3e);}searchContact(_0x39b7a7,_0x5acd95,_0xb45d('0x2d'),_0x42ac3e[_0xb45d('0x29')])['then'](function(_0x272227){if(_0x272227){_0x42ac3e['endUserId']=_0x272227['id'];logger[_0xb45d('0xe')](_0xb45d('0x2e'),_0x42ac3e[_0xb45d('0x2b')]);return _0x5ad33d(_0x42ac3e);}createEndUser(_0x42ac3e,_0x1dc955,_0x5acd95,_0x39b7a7)['then'](function(_0x2c6a6c){logger[_0xb45d('0xe')](_0xb45d('0x2f'),_0x2c6a6c[_0xb45d('0x2b')]);return _0x5ad33d(_0x2c6a6c);});});})[_0xb45d('0x16')](function(_0x155b0f){_0x1eb1eb(_0x155b0f);});});};}function createEndUser(_0x59d42f,_0x1a4282,_0x3ab9e3,_0x26f727){return new Promise(function(_0x397572,_0x153229){var _0x3a1304=moment();var _0x158241={'method':_0xb45d('0x30'),'uri':_0x26f727+_0xb45d('0x31'),'body':{'contact':{'last_name':_0x59d42f[_0xb45d('0x29')],'work_number':_0x59d42f[_0xb45d('0x29')],'mobile_number':_0x59d42f[_0xb45d('0x29')],'owner_id':_0x59d42f['userId'],'created_at':_0x3a1304[_0xb45d('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x158241[_0xb45d('0xd')]=_0x3ab9e3;logger[_0xb45d('0xe')](_0xb45d('0x32'));return rp(_0x158241)[_0xb45d('0x1a')](function(_0x4d44d0){_0x59d42f[_0xb45d('0x2b')]=_0x4d44d0[_0xb45d('0x33')]['id'];_0x397572(_0x59d42f);})[_0xb45d('0x16')](function(_0x5a6cfd){logger[_0xb45d('0x17')]('['+[_0x1a4282['toUpperCase']()]+']',_0x5a6cfd[_0xb45d('0x22')]);_0x153229(_0x5a6cfd[_0xb45d('0x22')]);});});}function getTicket(_0x4abb48,_0x333885,_0x4ca9f7,_0x454465,_0x396348){return function(_0x423875){logger[_0xb45d('0xe')](_0xb45d('0x34'));return new Promise(function(_0x16f028,_0x234672){var _0x2a461d=moment();var _0x2b9fe8={'method':_0xb45d('0x30'),'uri':_0x4ca9f7+_0xb45d('0x35'),'body':{'title':intUtil[_0xb45d('0x36')](_0x454465[_0xb45d('0x37')],_0x396348,'\x20'),'description':intUtil[_0xb45d('0x36')](_0x454465[_0xb45d('0x38')],_0x396348,'\x0a'),'owner_id':_0x423875[_0xb45d('0x1e')],'creater_id':_0x423875['adminId'],'targetable_id':_0x423875[_0xb45d('0x2b')],'targetable_type':'Contact','created_at':_0x2a461d[_0xb45d('0x28')](_0xb45d('0x39')),'due_date':_0x2a461d[_0xb45d('0x3a')](0x1e,'m')['format'](_0xb45d('0x39'))},'json':!![]};_0x2b9fe8[_0xb45d('0xd')]=_0x333885;return rp(_0x2b9fe8)[_0xb45d('0x1a')](function(_0x89117d){_0x423875[_0xb45d('0x3b')]=_0x89117d[_0xb45d('0x3c')]['id'];logger[_0xb45d('0xe')]('Task\x20created:',_0x423875[_0xb45d('0x3b')]);_0x16f028(_0x423875);})[_0xb45d('0x16')](function(_0x4758ca){logger[_0xb45d('0x17')]('['+[_0x4abb48['toUpperCase']()]+']',_0x4758ca[_0xb45d('0x22')]);_0x234672(_0x4758ca['message']);});});};}function emit(_0x4282f6,_0x4602fd,_0x5bfafd){var _0x186422={'uri':_0x4282f6+_0xb45d('0x3d')+_0x5bfafd};io['to'](util[_0xb45d('0x28')]('user:%s',_0x4602fd))[_0xb45d('0x3e')](_0xb45d('0x3f'),_0x186422);}exports['cs']=function(_0x544d62,_0xb2044d,_0x2c05b9,_0x473241,_0x579ca5,_0x21c9f7,_0x385f9c,_0x39ce09){var _0x52d5af={};var _0x322e0a={'Authorization':_0xb45d('0x40')+_0x21c9f7['apiKey']};_0x21c9f7[_0xb45d('0x41')]=intUtil[_0xb45d('0x42')](_0x21c9f7[_0xb45d('0x41')]);_0x21c9f7[_0xb45d('0x43')]=intUtil[_0xb45d('0x42')](_0x21c9f7[_0xb45d('0x43')]);var _0x59a94e=_0x21c9f7[_0xb45d('0x41')];_0x52d5af[_0xb45d('0x12')]=_0x21c9f7[_0xb45d('0x44')];_0x52d5af[_0xb45d('0x29')]=_0x39ce09['toLowerCase']()===_0xb45d('0x45')?_0xb2044d['destcalleridnum']:_0xb2044d[_0xb45d('0x46')];_0x52d5af[_0xb45d('0x47')]=_0x39ce09===_0xb45d('0x48')||_0x39ce09===_0xb45d('0x49')?_0xb45d('0x48'):_0xb45d('0x45');if(_0x473241){_0x52d5af[_0xb45d('0x1b')]=_0x473241[_0xb45d('0x11')];}var _0x49552d=util[_0xb45d('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21c9f7[_0xb45d('0x43')],_0xb2044d[_0xb45d('0x4a')],md5(_0xb2044d[_0xb45d('0x4a')]));if(_0x579ca5&&_0x579ca5[_0xb45d('0x4b')]){logger[_0xb45d('0xe')](_0xb45d('0x4c'),_0xb45d('0x4d'));_0xb2044d[_0xb45d('0x4e')]=_0x49552d;}else if(_0x385f9c&&_0x385f9c[_0xb45d('0x4f')]&&_0x385f9c['recordingFormat']!==_0xb45d('0x50')){logger[_0xb45d('0xe')](_0xb45d('0x51'),_0xb45d('0x4d'));_0xb2044d[_0xb45d('0x4e')]=_0x49552d;}else{_0xb2044d[_0xb45d('0x4e')]='';}return getAdminId(_0x52d5af,_0x39ce09,_0x322e0a,_0x59a94e)[_0xb45d('0x1a')](getUser(_0x39ce09,_0x322e0a,_0x59a94e))['then'](getEndUser(_0x39ce09,_0x322e0a,_0x59a94e))['then'](getTicket(_0x39ce09,_0x322e0a,_0x59a94e,_0x2c05b9,_0xb2044d))['then'](function(_0x74306d){logger['info'](util[_0xb45d('0x28')](_0xb45d('0x52'),_0x74306d[_0xb45d('0x3b')]));if(_0x39ce09!==_0xb45d('0x49')){logger[_0xb45d('0xe')]('['+[_0x39ce09['toUpperCase']()]+']',_0xb45d('0x53'));emit(_0x59a94e,_0x473241['name'],_0x74306d[_0xb45d('0x2b')]);}})[_0xb45d('0x16')](function(_0x3361ed){logger['error']('['+[_0x39ce09[_0xb45d('0x21')]()]+_0xb45d('0x54'),util['inspect'](_0x3361ed,{'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 3cd0123..31bca44 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 _0x5432=['log','EVENT\x20UNKNOWN','unmanaged','zendesk','vtiger','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x5432,0xc5));var _0x2543=function(_0x27ff79,_0x2216a0){_0x27ff79=_0x27ff79-0x0;var _0x4f2da3=_0x5432[_0x27ff79];return _0x4f2da3;};'use strict';var _=require(_0x2543('0x0'));var util=require(_0x2543('0x1'));var zendesk=require(_0x2543('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x2543('0x3'));var freshdesk=require(_0x2543('0x4'));var zoho=require(_0x2543('0x5'));var desk=require(_0x2543('0x6'));var vtiger=require(_0x2543('0x7'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x2543('0x8'));var integrations=['zendesk',_0x2543('0x9'),_0x2543('0xa'),_0x2543('0xb'),_0x2543('0xc'),_0x2543('0xd'),'vtiger',_0x2543('0xe'),_0x2543('0xf'),'servicenow'];exports[_0x2543('0x10')]=function(_0x2dd21a,_0x252471,_0x239cc4,_0x1fbb4a,_0x34dd3a,_0x4d9a69){if(_0x239cc4){if(_['includes'](integrations,_0x2dd21a[_0x2543('0x11')]['toLowerCase']())){try{var _0x37dabf=null;var _0x4c2179='';var _0x501338=_0x239cc4[_0x2dd21a['data1'][_0x2543('0x12')]()];if(_0x501338){var _0x513f11=_0x501338[_0x2dd21a[_0x2543('0x13')]];if(_0x513f11){var _0x1fc63b=_[_0x2543('0x14')](_0x513f11[_0x2543('0x15')],{'id':parseInt(_0x2dd21a[_0x2543('0x16')],0xa)});if(_0x1fc63b){if(_0x1fbb4a){if(_0x34dd3a&&_0x252471['queue']){_0x4c2179=_0x2543('0x17');}else if(_0x252471[_0x2543('0x18')]){_0x4c2179='outbound';}else{console[_0x2543('0x19')](_0x2543('0x1a'),_0x252471);}}else{_0x4c2179=_0x2543('0x1b');}switch(_0x2dd21a['data1'][_0x2543('0x12')]()){case _0x2543('0x1c'):zendesk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0x9'):salesforce[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xa'):sugarcrm[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case'freshdesk':freshdesk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case'zoho':zoho[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xd'):desk[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0x1d'):vtiger[_0x4c2179](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69);break;case _0x2543('0xf'):freshsales['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;case _0x2543('0x1e'):servicenow['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;case _0x2543('0xe'):dynamics365['cs'](_0x2dd21a,_0x252471,_0x1fc63b,_0x1fbb4a,_0x34dd3a,_0x513f11,_0x4d9a69,_0x4c2179);break;default:console['log'](_0x2543('0x1f'));}}else{_0x37dabf=require(_0x2543('0x20'))(_0x2dd21a[_0x2543('0x11')][_0x2543('0x12')]());_0x37dabf[_0x2543('0x21')](_0x2543('0x22'),util[_0x2543('0x23')](_0x2543('0x24'),_0x2dd21a[_0x2543('0x11')][_0x2543('0x12')](),_0x2dd21a['data3']));}}else{_0x37dabf=require('../../../../config/logger')(_0x2dd21a[_0x2543('0x11')]['toLowerCase']());_0x37dabf[_0x2543('0x21')]('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2dd21a[_0x2543('0x11')]['toLowerCase'](),_0x2dd21a[_0x2543('0x13')]));}}else{}}catch(_0x3b81aa){console[_0x2543('0x21')](_0x3b81aa);}}}}; \ No newline at end of file +var _0x104c=['./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','zendesk','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./salesforce','./freshdesk','./zoho','./desk'];(function(_0x41fc0e,_0x1c5ca2){var _0x34bb60=function(_0x3fb143){while(--_0x3fb143){_0x41fc0e['push'](_0x41fc0e['shift']());}};_0x34bb60(++_0x1c5ca2);}(_0x104c,0x1c2));var _0xc104=function(_0x42a6c1,_0x21909d){_0x42a6c1=_0x42a6c1-0x0;var _0x4ffc21=_0x104c[_0x42a6c1];return _0x4ffc21;};'use strict';var _=require(_0xc104('0x0'));var util=require(_0xc104('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0xc104('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc104('0x3'));var zoho=require(_0xc104('0x4'));var desk=require(_0xc104('0x5'));var vtiger=require(_0xc104('0x6'));var servicenow=require(_0xc104('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc104('0x8'));var integrations=['zendesk',_0xc104('0x9'),_0xc104('0xa'),_0xc104('0xb'),_0xc104('0xc'),_0xc104('0xd'),_0xc104('0xe'),_0xc104('0xf'),_0xc104('0x10'),_0xc104('0x11')];exports[_0xc104('0x12')]=function(_0x53b807,_0x4cd042,_0x4bd64c,_0x4e6df6,_0x529d1a,_0x4e53ff){if(_0x4bd64c){if(_[_0xc104('0x13')](integrations,_0x53b807['data1'][_0xc104('0x14')]())){try{var _0x55f317=null;var _0x309f9f='';var _0x24c886=_0x4bd64c[_0x53b807[_0xc104('0x15')][_0xc104('0x14')]()];if(_0x24c886){var _0x2b8153=_0x24c886[_0x53b807[_0xc104('0x16')]];if(_0x2b8153){var _0x78571=_[_0xc104('0x17')](_0x2b8153[_0xc104('0x18')],{'id':parseInt(_0x53b807[_0xc104('0x19')],0xa)});if(_0x78571){if(_0x4e6df6){if(_0x529d1a&&_0x4cd042[_0xc104('0x1a')]){_0x309f9f='queue';}else if(_0x4cd042[_0xc104('0x1b')]){_0x309f9f=_0xc104('0x1c');}else{console[_0xc104('0x1d')](_0xc104('0x1e'),_0x4cd042);}}else{_0x309f9f='unmanaged';}switch(_0x53b807[_0xc104('0x15')][_0xc104('0x14')]()){case _0xc104('0x1f'):zendesk[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case _0xc104('0x9'):salesforce[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case _0xc104('0xa'):sugarcrm[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case'freshdesk':freshdesk[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case'zoho':zoho[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case _0xc104('0xd'):desk[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case'vtiger':vtiger[_0x309f9f](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff);break;case _0xc104('0x10'):freshsales['cs'](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff,_0x309f9f);break;case _0xc104('0x11'):servicenow['cs'](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff,_0x309f9f);break;case'dynamics365':dynamics365['cs'](_0x53b807,_0x4cd042,_0x78571,_0x4e6df6,_0x529d1a,_0x2b8153,_0x4e53ff,_0x309f9f);break;default:console[_0xc104('0x1d')](_0xc104('0x20'));}}else{_0x55f317=require(_0xc104('0x21'))(_0x53b807[_0xc104('0x15')]['toLowerCase']());_0x55f317['error'](_0xc104('0x22'),util[_0xc104('0x23')](_0xc104('0x24'),_0x53b807[_0xc104('0x15')][_0xc104('0x14')](),_0x53b807[_0xc104('0x19')]));}}else{_0x55f317=require(_0xc104('0x21'))(_0x53b807[_0xc104('0x15')]['toLowerCase']());_0x55f317['error'](_0xc104('0x22'),util[_0xc104('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x53b807['data1'][_0xc104('0x14')](),_0x53b807[_0xc104('0x16')]));}}else{}}catch(_0x559bae){console[_0xc104('0x25')](_0x559bae);}}}}; \ 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 53186c3..32234ce 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 _0x97dd=['Email','Agent\x20%s\x20found.','resolve','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','additionalSearchContact','$or','Contact','length','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','Account','additionalSearchAccount','first','Name','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.','LastName','format','Company','','Caller\x20-\x20%s','upperFirst','forEach','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','endUserType','contact','lead','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','execute','then','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97dd,0x157));var _0xd97d=function(_0x55a8e1,_0x55cda7){_0x55a8e1=_0x55a8e1-0x0;var _0x402dc2=_0x97dd[_0x55a8e1];return _0x402dc2;};'use strict';var _=require(_0xd97d('0x0'));var rp=require('request-promise');var moment=require(_0xd97d('0x1'));var BPromise=require(_0xd97d('0x2'));var md5=require('md5');var jsforce=require(_0xd97d('0x3'));var util=require(_0xd97d('0x4'));var Redis=require('ioredis');var intUtil=require(_0xd97d('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd97d('0x6'))('salesforce');config['redis']=_['defaults'](config[_0xd97d('0x7')],{'host':_0xd97d('0x8'),'port':0x18eb});var io=require(_0xd97d('0x9'))(new Redis(config[_0xd97d('0x7')]));function emit(_0x86e4ac,_0x280b14,_0x662dc9){io['to'](_0x86e4ac)[_0xd97d('0xa')](_0x280b14,_0x662dc9);}function getTicket(_0x35b226,_0x121ed5,_0x4d3604,_0x18a2cf,_0x34c819,_0x20f941,_0x436e81,_0xbfc790){var _0x109ac1=Object[_0xd97d('0xb')]({},{'OwnerId':_0x121ed5['id'],'Subject':intUtil[_0xd97d('0xc')](_0x18a2cf['Subjects'],_0x34c819,'\x20'),'Description':intUtil[_0xd97d('0xc')](_0x18a2cf[_0xd97d('0xd')],_0x34c819,'\x0a')},getCustomFields(_0x20f941,_0x34c819));if(_0x4d3604){if(_0x18a2cf[_0xd97d('0xe')]==='Task'){_0x109ac1[_0xd97d('0xf')]=moment[_0xd97d('0x10')]();_0x109ac1[_0xd97d('0x11')]=![];_0x109ac1['IsRecurrence']=![];if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x13')||_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x14')){_0x109ac1['WhoId']=_0x4d3604['id'];}else if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x15')){_0x109ac1[_0xd97d('0x16')]=_0x4d3604['id'];}}else if(_0x18a2cf[_0xd97d('0xe')]===_0xd97d('0x17')){if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x13')){_0x109ac1['ContactId']=_0x4d3604['id'];}else if(_0x4d3604[_0xd97d('0x12')]===_0xd97d('0x15')){_0x109ac1[_0xd97d('0x18')]=_0x4d3604['id'];}else if(_0x4d3604['endUserType']==='lead'&&_0x18a2cf[_0xd97d('0x19')]){_0x109ac1[_0x18a2cf[_0xd97d('0x19')]]=_0x4d3604['id'];}else{logger[_0xd97d('0x1a')](_0xd97d('0x1b'));}}}return _0x436e81[_0xd97d('0x1c')](_0x18a2cf[_0xd97d('0xe')])[_0xd97d('0x1d')](_0x109ac1);}function getUser(_0x47cc27,_0x5f28e7,_0x763639){if(!_[_0xd97d('0x1e')](_0x5f28e7)&&intUtil[_0xd97d('0x1f')](_0x5f28e7)){var _0x448266={'Email':_0x5f28e7};var _0x353b90={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x763639['sobject']('User')['find'](_0x448266,_0x353b90)[_0xd97d('0x20')]()[_0xd97d('0x21')](function(_0x4e78d7){if(_0x4e78d7['length']){var _0x479dbc=_[_0xd97d('0x22')](_0x4e78d7,function(_0x2727da){return _0x2727da[_0xd97d('0x23')]===_0x5f28e7;});if(_0x479dbc){logger[_0xd97d('0x1a')](_0xd97d('0x24'),_0x5f28e7);return BPromise[_0xd97d('0x25')]({'id':_0x479dbc['Id'],'name':_0x479dbc['Name']});}}else{logger[_0xd97d('0x1a')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f28e7);return _0x763639['identity']()[_0xd97d('0x21')](function(_0x3972cd){return BPromise[_0xd97d('0x25')]({'id':_0x3972cd[_0xd97d('0x26')],'name':_0x3972cd['display_name']});});}});}else{logger['info'](_0xd97d('0x27'),_0x5f28e7);return _0x763639[_0xd97d('0x28')]()[_0xd97d('0x21')](function(_0x5b088d){return BPromise[_0xd97d('0x25')]({'id':_0x5b088d[_0xd97d('0x26')],'name':_0x5b088d[_0xd97d('0x29')]});});}}function getEndUser(_0x4ad017,_0x1007f5,_0x180b46,_0x1857ff,_0x5496a6){var _0x356ed5={'$or':{'Phone':_0x1857ff}};var _0x4e7a1a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd97d('0x25')]()[_0xd97d('0x21')](function(){logger[_0xd97d('0x1a')](_0xd97d('0x2a'),_0x1857ff,_0x1007f5['moduleSearch']);switch(_0x1007f5['moduleSearch']){case _0xd97d('0x2b'):var _0x724290=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x2c')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5[_0xd97d('0x2c')]]=_0x1857ff;_['merge'](_0x724290[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6['sobject'](_0xd97d('0x2e'))['find'](_0x724290,_0x4e7a1a)['execute']()[_0xd97d('0x21')](function(_0x4c9a4a){if(_0x4c9a4a&&_0x4c9a4a[_0xd97d('0x2f')]){return _0x4c9a4a;}else{var _0x154981=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x331123={};_0x331123[_0x1007f5[_0xd97d('0x31')]]=_0x1857ff;_[_0xd97d('0x32')](_0x154981[_0xd97d('0x2d')],_0x331123);}return _0x5496a6['sobject'](_0xd97d('0x33'))[_0xd97d('0x22')](_0x154981,_0x4e7a1a);}});case _0xd97d('0x34'):var _0x151306=_['cloneDeep'](_0x356ed5);if(_0x1007f5['additionalSearchAccount']){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchAccount']]=_0x1857ff;_[_0xd97d('0x32')](_0x151306['$or'],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x35'))[_0xd97d('0x22')](_0x151306,_0x4e7a1a)[_0xd97d('0x20')]()['then'](function(_0x32c0a){if(_0x32c0a&&_0x32c0a[_0xd97d('0x2f')]){return _0x32c0a;}else{var _0x1d04ba=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x2c')]){var _0x2f8965={};_0x2f8965[_0x1007f5[_0xd97d('0x2c')]]=_0x1857ff;_['merge'](_0x1d04ba[_0xd97d('0x2d')],_0x2f8965);}return _0x5496a6['sobject'](_0xd97d('0x2e'))[_0xd97d('0x22')](_0x1d04ba,_0x4e7a1a)[_0xd97d('0x21')](function(_0x3b121f){if(_0x3b121f&&_0x3b121f[_0xd97d('0x2f')]){return _0x3b121f;}else{var _0xdce732=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x1b764f={};_0x1b764f[_0x1007f5[_0xd97d('0x31')]]=_0x1857ff;_[_0xd97d('0x32')](_0xdce732['$or'],_0x1b764f);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x33'))[_0xd97d('0x22')](_0xdce732,_0x4e7a1a);}});}});case'contact':var _0x724290=_[_0xd97d('0x30')](_0x356ed5);if(_0x1007f5['additionalSearchContact']){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchContact']]=_0x1857ff;_['merge'](_0x724290[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6['sobject'](_0xd97d('0x2e'))['find'](_0x724290,_0x4e7a1a)[_0xd97d('0x20')]();case _0xd97d('0x14'):var _0x4a3fea=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x31')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5['additionalSearchLead']]=_0x1857ff;_[_0xd97d('0x32')](_0x4a3fea[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x33'))['find'](_0x4a3fea,_0x4e7a1a);case _0xd97d('0x15'):var _0x151306=_['cloneDeep'](_0x356ed5);if(_0x1007f5[_0xd97d('0x36')]){var _0x1f36ee={};_0x1f36ee[_0x1007f5[_0xd97d('0x36')]]=_0x1857ff;_['merge'](_0x151306[_0xd97d('0x2d')],_0x1f36ee);}return _0x5496a6[_0xd97d('0x1c')](_0xd97d('0x35'))[_0xd97d('0x22')](_0x151306,_0x4e7a1a);default:return null;}})[_0xd97d('0x21')](function(_0x2ba8b1){if(_0x2ba8b1&&_0x2ba8b1['length']){var _0x3f2d54=_[_0xd97d('0x37')](_0x2ba8b1);if(_0x3f2d54){return BPromise[_0xd97d('0x25')]({'id':_0x3f2d54['Id'],'name':_0x3f2d54[_0xd97d('0x38')],'phone':_0x3f2d54[_0xd97d('0x39')],'endUserType':_0x3f2d54[_0xd97d('0x3a')][_0xd97d('0x3b')][_0xd97d('0x3c')]()});}}})[_0xd97d('0x21')](function(_0x2352e1){if(_0x2352e1){logger['info'](_0xd97d('0x3d'),_0x2352e1[_0xd97d('0x12')],_0x1857ff);return BPromise[_0xd97d('0x25')](_0x2352e1);}else{logger[_0xd97d('0x1a')](_0xd97d('0x3e'),_0x1857ff);var _0x1e93b4={'Phone':_0x1857ff};if(_0x1007f5[_0xd97d('0x3f')]){if(_0x1007f5['moduleCreate']===_0xd97d('0x13')){logger[_0xd97d('0x1a')](_0xd97d('0x40'),_0x1857ff,_0x1007f5['moduleCreate']);_0x1e93b4[_0xd97d('0x41')]=_0x180b46!==''?_0x180b46:util[_0xd97d('0x42')]('Caller\x20-\x20%s',_0x1857ff);}else if(_0x1007f5[_0xd97d('0x3f')]==='lead'){logger[_0xd97d('0x1a')](_0xd97d('0x40'),_0x1857ff,_0x1007f5['moduleCreate']);_0x1e93b4[_0xd97d('0x41')]=_0x180b46!==''?_0x180b46:util[_0xd97d('0x42')]('Caller\x20-\x20%s',_0x1857ff);_0x1e93b4[_0xd97d('0x43')]='No\x20Company';}else if(_0x1007f5['moduleCreate']===_0xd97d('0x15')){logger[_0xd97d('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1857ff,_0x1007f5[_0xd97d('0x3f')]);_0x1e93b4[_0xd97d('0x38')]=_0x180b46!==_0xd97d('0x44')?_0x180b46:util[_0xd97d('0x42')](_0xd97d('0x45'),_0x1857ff);}else{return null;}}return _0x5496a6[_0xd97d('0x1c')](_[_0xd97d('0x46')](_0x1007f5[_0xd97d('0x3f')]))[_0xd97d('0x1d')](_0x1e93b4)[_0xd97d('0x21')](function(_0x503524){return BPromise[_0xd97d('0x25')]({'id':_0x503524['id'],'endUserType':_0x1007f5[_0xd97d('0x3f')]});});}});}function getCustomFields(_0xea22dc,_0x335fce){var _0x7e7ecd={};if(_0xea22dc[_0xd97d('0x2f')]>0x0){_[_0xd97d('0x47')](_0xea22dc,function(_0x2fabf9){if(_['includes']([_0xd97d('0x48'),_0xd97d('0x49')],_0x2fabf9['type'])&&_0x2fabf9['idField']){_0x7e7ecd[_0x2fabf9[_0xd97d('0x4a')]]=_0x2fabf9[_0xd97d('0x4b')][_0xd97d('0x4c')]();}else if(_0x2fabf9[_0xd97d('0x3b')]===_0xd97d('0x4d')&&_0x2fabf9[_0xd97d('0x4e')]&&_0x2fabf9[_0xd97d('0x4a')]){_0x335fce[_0x2fabf9[_0xd97d('0x4e')]]&&(_0x7e7ecd[_0x2fabf9[_0xd97d('0x4a')]]=_0x335fce[_0x2fabf9[_0xd97d('0x4e')]]['toString']());}else if(_0x2fabf9[_0xd97d('0x3b')]===_0xd97d('0x4f')&&_0x2fabf9[_0xd97d('0x50')]&&_0x2fabf9[_0xd97d('0x50')][_0xd97d('0x51')]&&_0x2fabf9[_0xd97d('0x4a')]){_0x335fce[_0x2fabf9[_0xd97d('0x50')][_0xd97d('0x51')][_0xd97d('0x3c')]()]&&(_0x7e7ecd[_0x2fabf9['idField']]=_0x335fce[_0x2fabf9['Variable'][_0xd97d('0x51')][_0xd97d('0x3c')]()][_0xd97d('0x4c')]());}});}return _0x7e7ecd;}function getConnection(_0x59b0c0){var _0x76012=_0x59b0c0['password']['concat'](_0x59b0c0[_0xd97d('0x52')]);var _0x21c706=new jsforce[(_0xd97d('0x53'))]({'oauth2':{'loginUrl':_0x59b0c0[_0xd97d('0x54')]||_0xd97d('0x55'),'clientId':_0x59b0c0[_0xd97d('0x56')],'clientSecret':_0x59b0c0[_0xd97d('0x57')]}});return _0x21c706[_0xd97d('0x58')](_0x59b0c0[_0xd97d('0x59')],_0x76012)[_0xd97d('0x21')](function(){logger[_0xd97d('0x1a')](_0xd97d('0x5a'));return _0x21c706;});}exports[_0xd97d('0x5b')]=function(_0x213435,_0x42f0d1,_0x49573f,_0x2a9b99,_0xf7f0f,_0xdee7b1){var _0x30b2b1,_0x19c380,_0x225da1,_0x2e9403;_0xdee7b1[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0xdee7b1[_0xd97d('0x5c')]);_0xdee7b1[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0xdee7b1[_0xd97d('0x54')]);if(_0xf7f0f&&_0xf7f0f[_0xd97d('0x5e')]){logger[_0xd97d('0x1a')](_0xd97d('0x5f'),_0xd97d('0x60'));_0x42f0d1[_0xd97d('0x61')]=util[_0xd97d('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdee7b1[_0xd97d('0x5c')],_0x42f0d1[_0xd97d('0x62')],md5(_0x42f0d1[_0xd97d('0x62')]));}else{_0x42f0d1[_0xd97d('0x61')]='';}return getConnection(_0xdee7b1)[_0xd97d('0x21')](function(_0x247487){_0x2e9403=_0x247487;return getUser(_0xdee7b1,_0x2a9b99[_0xd97d('0x63')],_0x2e9403);})[_0xd97d('0x21')](function(_0x1cd07c){_0x30b2b1=_0x1cd07c;return getEndUser(_0xdee7b1,_0x49573f,_0x42f0d1[_0xd97d('0x64')],_0x42f0d1[_0xd97d('0x65')],_0x2e9403);})[_0xd97d('0x21')](function(_0x47a592){_0x19c380=_0x47a592;return getTicket(_0xdee7b1,_0x30b2b1,_0x19c380,_0x49573f,_0x42f0d1,_0x49573f[_0xd97d('0x66')],_0x2e9403,_0xd97d('0x5b'));})[_0xd97d('0x21')](function(_0x17aaef){_0x225da1=_0x17aaef;logger['info'](_0xd97d('0x67'),_0x225da1['id']);logger[_0xd97d('0x1a')](_0xd97d('0x68'),_0x225da1['id'],_0x2a9b99['name'],_0xdee7b1[_0xd97d('0x3b')]);switch(_0xdee7b1['type']){case _0xd97d('0x69'):emit(util[_0xd97d('0x42')](_0xd97d('0x6a'),_0x2a9b99[_0xd97d('0x51')]),_0xd97d('0x6b'),{'recordId':_0x225da1['id']});break;case _0xd97d('0x6c'):emit(util[_0xd97d('0x42')](_0xd97d('0x6a'),_0x2a9b99[_0xd97d('0x51')]),_0xd97d('0x6d'),{'uri':util[_0xd97d('0x42')](_0xd97d('0x6e'),_0x2e9403[_0xd97d('0x6f')],_0x225da1['id'])});break;default:logger[_0xd97d('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xd97d('0x71')](function(_0x38f506){logger[_0xd97d('0x70')](_0xd97d('0x5f'),_0x38f506);});};exports[_0xd97d('0x72')]=function(_0x30bbd,_0x1adbb2,_0x13718c,_0x43d4f9,_0x740922,_0x47e1e5,_0x207f48){var _0x40ff97,_0x186580,_0x2f4993,_0x18f1b7;_0x47e1e5[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0x47e1e5[_0xd97d('0x5c')]);_0x47e1e5[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0x47e1e5[_0xd97d('0x54')]);if(_0x207f48&&_0x207f48[_0xd97d('0x73')]&&_0x207f48['recordingFormat']!==_0xd97d('0x74')){logger[_0xd97d('0x1a')]('[OUTBOUND]',_0xd97d('0x60'));_0x1adbb2[_0xd97d('0x61')]=util[_0xd97d('0x42')](_0xd97d('0x75'),_0x47e1e5[_0xd97d('0x5c')],_0x1adbb2[_0xd97d('0x62')],md5(_0x1adbb2[_0xd97d('0x62')]));}return getConnection(_0x47e1e5)[_0xd97d('0x21')](function(_0x40640e){_0x18f1b7=_0x40640e;return getUser(_0x47e1e5,_0x43d4f9[_0xd97d('0x63')],_0x18f1b7);})['then'](function(_0x188d5){_0x40ff97=_0x188d5;return getEndUser(_0x47e1e5,_0x13718c,_0x1adbb2[_0xd97d('0x76')],_0x1adbb2['destcalleridnum'],_0x18f1b7);})[_0xd97d('0x21')](function(_0x14a7cc){_0x186580=_0x14a7cc;return getTicket(_0x47e1e5,_0x40ff97,_0x186580,_0x13718c,_0x1adbb2,_0x13718c['Fields'],_0x18f1b7,_0xd97d('0x72'));})[_0xd97d('0x21')](function(_0x24945e){_0x2f4993=_0x24945e;logger[_0xd97d('0x1a')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2f4993['id']);logger['info'](_0xd97d('0x77'),_0x2f4993['id'],_0x43d4f9['name'],_0x47e1e5['type']);switch(_0x47e1e5['type']){case'integrationTab':emit(util['format'](_0xd97d('0x6a'),_0x43d4f9['name']),_0xd97d('0x6b'),{'recordId':_0x2f4993['id']});break;case _0xd97d('0x6c'):emit(util['format'](_0xd97d('0x6a'),_0x43d4f9['name']),'trigger:browser:url',{'uri':util[_0xd97d('0x42')](_0xd97d('0x6e'),_0x18f1b7[_0xd97d('0x6f')],_0x2f4993['id'])});break;default:logger[_0xd97d('0x70')]('[OUTBOUND]',_0xd97d('0x78'));}})[_0xd97d('0x71')](function(_0x376f46){logger[_0xd97d('0x70')](_0xd97d('0x79'),_0x376f46);});};exports['unmanaged']=function(_0x2c7ea6,_0x226d8c,_0x3f19ff,_0x10b45a,_0x46582c,_0x2ca756){var _0x9c7f8d,_0x121eef,_0x28f2b0,_0x4db3cc;_0x2ca756[_0xd97d('0x5c')]=intUtil[_0xd97d('0x5d')](_0x2ca756[_0xd97d('0x5c')]);_0x2ca756[_0xd97d('0x54')]=intUtil[_0xd97d('0x5d')](_0x2ca756['remoteUri']);if(_0x46582c&&_0x46582c[_0xd97d('0x5e')]){logger['info']('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+']',_0xd97d('0x60'));_0x226d8c[_0xd97d('0x61')]=util['format'](_0xd97d('0x75'),_0x2ca756[_0xd97d('0x5c')],_0x226d8c[_0xd97d('0x62')],md5(_0x226d8c[_0xd97d('0x62')]));}else{_0x226d8c['recordingURL']='';}return getConnection(_0x2ca756)['then'](function(_0x2bc054){_0x4db3cc=_0x2bc054;if(!_[_0xd97d('0x1e')](_0x10b45a)){return getUser(_0x2ca756,_0x10b45a['name'],_0x4db3cc);}else{return getUser(_0x2ca756,null,_0x4db3cc);}})[_0xd97d('0x21')](function(_0x37acd0){_0x9c7f8d=_0x37acd0;return getEndUser(_0x2ca756,_0x3f19ff,_0x226d8c['calleridname'],_0x226d8c[_0xd97d('0x65')],_0x4db3cc);})[_0xd97d('0x21')](function(_0x3ede9d){_0x121eef=_0x3ede9d;return getTicket(_0x2ca756,_0x9c7f8d,_0x121eef,_0x3f19ff,_0x226d8c,_0x3f19ff[_0xd97d('0x66')],_0x4db3cc);})['then'](function(_0x1e3192){_0x28f2b0=_0x1e3192;logger[_0xd97d('0x1a')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+_0xd97d('0x7c'),_0x28f2b0['id']);logger[_0xd97d('0x1a')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+_0xd97d('0x7d'),_0x2ca756[_0xd97d('0x3b')]);})[_0xd97d('0x71')](function(_0x2e92b0){logger[_0xd97d('0x70')]('['+_0x226d8c[_0xd97d('0x7a')][_0xd97d('0x7b')]()+']',_0x2e92b0);});}; \ No newline at end of file +var _0x1a16=['LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','toString','variable','variableName','idField','customVariable','Variable','name','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','defaults','socket.io-emitter','redis','emit','assign','getString','Subjects','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.'];(function(_0x36e0d6,_0xf8c200){var _0x187f2a=function(_0x19c103){while(--_0x19c103){_0x36e0d6['push'](_0x36e0d6['shift']());}};_0x187f2a(++_0xf8c200);}(_0x1a16,0x142));var _0x61a1=function(_0x1fee9d,_0x56950c){_0x1fee9d=_0x1fee9d-0x0;var _0x21f57a=_0x1a16[_0x1fee9d];return _0x21f57a;};'use strict';var _=require(_0x61a1('0x0'));var rp=require('request-promise');var moment=require(_0x61a1('0x1'));var BPromise=require(_0x61a1('0x2'));var md5=require(_0x61a1('0x3'));var jsforce=require(_0x61a1('0x4'));var util=require(_0x61a1('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x61a1('0x6'));var logger=require(_0x61a1('0x7'))(_0x61a1('0x8'));config['redis']=_[_0x61a1('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x61a1('0xa'))(new Redis(config[_0x61a1('0xb')]));function emit(_0x257590,_0x4bbba6,_0x132e97){io['to'](_0x257590)[_0x61a1('0xc')](_0x4bbba6,_0x132e97);}function getTicket(_0xc3c909,_0x343fd7,_0x44590e,_0x5be4cc,_0x339148,_0x5b8b04,_0x4d0875,_0x3aaa36){var _0x25f322=Object[_0x61a1('0xd')]({},{'OwnerId':_0x343fd7['id'],'Subject':intUtil[_0x61a1('0xe')](_0x5be4cc[_0x61a1('0xf')],_0x339148,'\x20'),'Description':intUtil[_0x61a1('0xe')](_0x5be4cc['Descriptions'],_0x339148,'\x0a')},getCustomFields(_0x5b8b04,_0x339148));if(_0x44590e){if(_0x5be4cc[_0x61a1('0x10')]==='Task'){_0x25f322[_0x61a1('0x11')]=moment[_0x61a1('0x12')]();_0x25f322[_0x61a1('0x13')]=![];_0x25f322[_0x61a1('0x14')]=![];if(_0x44590e[_0x61a1('0x15')]===_0x61a1('0x16')||_0x44590e[_0x61a1('0x15')]===_0x61a1('0x17')){_0x25f322[_0x61a1('0x18')]=_0x44590e['id'];}else if(_0x44590e['endUserType']===_0x61a1('0x19')){_0x25f322['WhatId']=_0x44590e['id'];}}else if(_0x5be4cc['ticketType']===_0x61a1('0x1a')){if(_0x44590e[_0x61a1('0x15')]===_0x61a1('0x16')){_0x25f322[_0x61a1('0x1b')]=_0x44590e['id'];}else if(_0x44590e[_0x61a1('0x15')]===_0x61a1('0x19')){_0x25f322[_0x61a1('0x1c')]=_0x44590e['id'];}else if(_0x44590e['endUserType']===_0x61a1('0x17')&&_0x5be4cc[_0x61a1('0x1d')]){_0x25f322[_0x5be4cc['leadId']]=_0x44590e['id'];}else{logger[_0x61a1('0x1e')](_0x61a1('0x1f'));}}}return _0x4d0875[_0x61a1('0x20')](_0x5be4cc[_0x61a1('0x10')])['create'](_0x25f322);}function getUser(_0x189f99,_0x14e8e2,_0x1cc1db){if(!_[_0x61a1('0x21')](_0x14e8e2)&&intUtil[_0x61a1('0x22')](_0x14e8e2)){var _0x5eda2e={'Email':_0x14e8e2};var _0x4e5301={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1cc1db['sobject'](_0x61a1('0x23'))[_0x61a1('0x24')](_0x5eda2e,_0x4e5301)[_0x61a1('0x25')]()[_0x61a1('0x26')](function(_0x1041ff){if(_0x1041ff['length']){var _0x26172a=_['find'](_0x1041ff,function(_0x48e2f9){return _0x48e2f9['Email']===_0x14e8e2;});if(_0x26172a){logger[_0x61a1('0x1e')](_0x61a1('0x27'),_0x14e8e2);return BPromise['resolve']({'id':_0x26172a['Id'],'name':_0x26172a[_0x61a1('0x28')]});}}else{logger[_0x61a1('0x1e')](_0x61a1('0x29'),_0x14e8e2);return _0x1cc1db[_0x61a1('0x2a')]()['then'](function(_0x4f29e5){return BPromise['resolve']({'id':_0x4f29e5[_0x61a1('0x2b')],'name':_0x4f29e5[_0x61a1('0x2c')]});});}});}else{logger[_0x61a1('0x1e')](_0x61a1('0x29'),_0x14e8e2);return _0x1cc1db[_0x61a1('0x2a')]()[_0x61a1('0x26')](function(_0x94c85){return BPromise[_0x61a1('0x2d')]({'id':_0x94c85[_0x61a1('0x2b')],'name':_0x94c85['display_name']});});}}function getEndUser(_0x3c8eb6,_0x135366,_0x82f53f,_0x563852,_0x15e52e){var _0x1e2b2f={'$or':{'Phone':_0x563852}};var _0xf147e0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x61a1('0x2d')]()[_0x61a1('0x26')](function(){logger[_0x61a1('0x1e')](_0x61a1('0x2e'),_0x563852,_0x135366[_0x61a1('0x2f')]);switch(_0x135366[_0x61a1('0x2f')]){case _0x61a1('0x30'):var _0x3e4f7e=_[_0x61a1('0x31')](_0x1e2b2f);if(_0x135366['additionalSearchContact']){var _0xb0d81={};_0xb0d81[_0x135366[_0x61a1('0x32')]]=_0x563852;_[_0x61a1('0x33')](_0x3e4f7e['$or'],_0xb0d81);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x34'))[_0x61a1('0x24')](_0x3e4f7e,_0xf147e0)[_0x61a1('0x25')]()['then'](function(_0x2db349){if(_0x2db349&&_0x2db349[_0x61a1('0x35')]){return _0x2db349;}else{var _0x17d877=_[_0x61a1('0x31')](_0x1e2b2f);if(_0x135366[_0x61a1('0x36')]){var _0x5b19e0={};_0x5b19e0[_0x135366[_0x61a1('0x36')]]=_0x563852;_[_0x61a1('0x33')](_0x17d877['$or'],_0x5b19e0);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x37'))[_0x61a1('0x24')](_0x17d877,_0xf147e0);}});case _0x61a1('0x38'):var _0x2bea71=_['cloneDeep'](_0x1e2b2f);if(_0x135366['additionalSearchAccount']){var _0xb0d81={};_0xb0d81[_0x135366[_0x61a1('0x39')]]=_0x563852;_[_0x61a1('0x33')](_0x2bea71[_0x61a1('0x3a')],_0xb0d81);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x3b'))[_0x61a1('0x24')](_0x2bea71,_0xf147e0)[_0x61a1('0x25')]()[_0x61a1('0x26')](function(_0x532fff){if(_0x532fff&&_0x532fff['length']){return _0x532fff;}else{var _0x5411a0=_['cloneDeep'](_0x1e2b2f);if(_0x135366[_0x61a1('0x32')]){var _0x661e1e={};_0x661e1e[_0x135366[_0x61a1('0x32')]]=_0x563852;_[_0x61a1('0x33')](_0x5411a0[_0x61a1('0x3a')],_0x661e1e);}return _0x15e52e['sobject'](_0x61a1('0x34'))[_0x61a1('0x24')](_0x5411a0,_0xf147e0)[_0x61a1('0x26')](function(_0x15024e){if(_0x15024e&&_0x15024e[_0x61a1('0x35')]){return _0x15024e;}else{var _0x539579=_['cloneDeep'](_0x1e2b2f);if(_0x135366[_0x61a1('0x36')]){var _0x1c44f6={};_0x1c44f6[_0x135366[_0x61a1('0x36')]]=_0x563852;_[_0x61a1('0x33')](_0x539579[_0x61a1('0x3a')],_0x1c44f6);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x37'))[_0x61a1('0x24')](_0x539579,_0xf147e0);}});}});case'contact':var _0x3e4f7e=_[_0x61a1('0x31')](_0x1e2b2f);if(_0x135366[_0x61a1('0x32')]){var _0xb0d81={};_0xb0d81[_0x135366[_0x61a1('0x32')]]=_0x563852;_['merge'](_0x3e4f7e[_0x61a1('0x3a')],_0xb0d81);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x34'))[_0x61a1('0x24')](_0x3e4f7e,_0xf147e0)[_0x61a1('0x25')]();case _0x61a1('0x17'):var _0x3eed2=_[_0x61a1('0x31')](_0x1e2b2f);if(_0x135366['additionalSearchLead']){var _0xb0d81={};_0xb0d81[_0x135366[_0x61a1('0x36')]]=_0x563852;_[_0x61a1('0x33')](_0x3eed2[_0x61a1('0x3a')],_0xb0d81);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x37'))[_0x61a1('0x24')](_0x3eed2,_0xf147e0);case _0x61a1('0x19'):var _0x2bea71=_['cloneDeep'](_0x1e2b2f);if(_0x135366['additionalSearchAccount']){var _0xb0d81={};_0xb0d81[_0x135366[_0x61a1('0x39')]]=_0x563852;_[_0x61a1('0x33')](_0x2bea71[_0x61a1('0x3a')],_0xb0d81);}return _0x15e52e[_0x61a1('0x20')](_0x61a1('0x3b'))['find'](_0x2bea71,_0xf147e0);default:return null;}})[_0x61a1('0x26')](function(_0x1f16da){if(_0x1f16da&&_0x1f16da[_0x61a1('0x35')]){var _0x108ec9=_[_0x61a1('0x3c')](_0x1f16da);if(_0x108ec9){return BPromise['resolve']({'id':_0x108ec9['Id'],'name':_0x108ec9[_0x61a1('0x28')],'phone':_0x108ec9[_0x61a1('0x3d')],'endUserType':_0x108ec9[_0x61a1('0x3e')][_0x61a1('0x3f')][_0x61a1('0x40')]()});}}})['then'](function(_0x640d70){if(_0x640d70){logger['info'](_0x61a1('0x41'),_0x640d70[_0x61a1('0x15')],_0x563852);return BPromise['resolve'](_0x640d70);}else{logger[_0x61a1('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x563852);var _0x356ad4={'Phone':_0x563852};if(_0x135366[_0x61a1('0x42')]){if(_0x135366[_0x61a1('0x42')]==='contact'){logger[_0x61a1('0x1e')](_0x61a1('0x43'),_0x563852,_0x135366[_0x61a1('0x42')]);_0x356ad4[_0x61a1('0x44')]=_0x82f53f!==''?_0x82f53f:util[_0x61a1('0x45')](_0x61a1('0x46'),_0x563852);}else if(_0x135366[_0x61a1('0x42')]===_0x61a1('0x17')){logger[_0x61a1('0x1e')](_0x61a1('0x43'),_0x563852,_0x135366[_0x61a1('0x42')]);_0x356ad4[_0x61a1('0x44')]=_0x82f53f!==_0x61a1('0x47')?_0x82f53f:util[_0x61a1('0x45')]('Caller\x20-\x20%s',_0x563852);_0x356ad4[_0x61a1('0x48')]=_0x61a1('0x49');}else if(_0x135366[_0x61a1('0x42')]===_0x61a1('0x19')){logger[_0x61a1('0x1e')](_0x61a1('0x43'),_0x563852,_0x135366[_0x61a1('0x42')]);_0x356ad4['Name']=_0x82f53f!==_0x61a1('0x47')?_0x82f53f:util[_0x61a1('0x45')](_0x61a1('0x46'),_0x563852);}else{return null;}}return _0x15e52e['sobject'](_[_0x61a1('0x4a')](_0x135366['moduleCreate']))[_0x61a1('0x4b')](_0x356ad4)[_0x61a1('0x26')](function(_0x2c5f20){return BPromise['resolve']({'id':_0x2c5f20['id'],'endUserType':_0x135366['moduleCreate']});});}});}function getCustomFields(_0x74c2a4,_0xc80c54){var _0x48f9e7={};if(_0x74c2a4['length']>0x0){_[_0x61a1('0x4c')](_0x74c2a4,function(_0x170bc3){if(_[_0x61a1('0x4d')]([_0x61a1('0x4e'),_0x61a1('0x4f')],_0x170bc3[_0x61a1('0x3f')])&&_0x170bc3['idField']){_0x48f9e7[_0x170bc3['idField']]=_0x170bc3['content'][_0x61a1('0x50')]();}else if(_0x170bc3[_0x61a1('0x3f')]===_0x61a1('0x51')&&_0x170bc3['variableName']&&_0x170bc3['idField']){_0xc80c54[_0x170bc3[_0x61a1('0x52')]]&&(_0x48f9e7[_0x170bc3[_0x61a1('0x53')]]=_0xc80c54[_0x170bc3[_0x61a1('0x52')]]['toString']());}else if(_0x170bc3['type']===_0x61a1('0x54')&&_0x170bc3[_0x61a1('0x55')]&&_0x170bc3['Variable'][_0x61a1('0x56')]&&_0x170bc3[_0x61a1('0x53')]){_0xc80c54[_0x170bc3[_0x61a1('0x55')][_0x61a1('0x56')][_0x61a1('0x40')]()]&&(_0x48f9e7[_0x170bc3[_0x61a1('0x53')]]=_0xc80c54[_0x170bc3[_0x61a1('0x55')][_0x61a1('0x56')]['toLowerCase']()][_0x61a1('0x50')]());}});}return _0x48f9e7;}function getConnection(_0x390333){var _0x5b5b25=_0x390333['password'][_0x61a1('0x57')](_0x390333['securityToken']);var _0x34c94e=new jsforce[(_0x61a1('0x58'))]({'oauth2':{'loginUrl':_0x390333[_0x61a1('0x59')]||_0x61a1('0x5a'),'clientId':_0x390333[_0x61a1('0x5b')],'clientSecret':_0x390333[_0x61a1('0x5c')]}});return _0x34c94e[_0x61a1('0x5d')](_0x390333[_0x61a1('0x5e')],_0x5b5b25)[_0x61a1('0x26')](function(){logger[_0x61a1('0x1e')](_0x61a1('0x5f'));return _0x34c94e;});}exports[_0x61a1('0x60')]=function(_0x21797e,_0x4fd92d,_0x1bd91e,_0x5213d3,_0x3195f6,_0x2eb635){var _0x425541,_0x32f5e7,_0x423fc1,_0x3d808b;_0x2eb635['serverUrl']=intUtil[_0x61a1('0x61')](_0x2eb635['serverUrl']);_0x2eb635['remoteUri']=intUtil[_0x61a1('0x61')](_0x2eb635[_0x61a1('0x59')]);if(_0x3195f6&&_0x3195f6[_0x61a1('0x62')]){logger[_0x61a1('0x1e')](_0x61a1('0x63'),_0x61a1('0x64'));_0x4fd92d['recordingURL']=util[_0x61a1('0x45')](_0x61a1('0x65'),_0x2eb635[_0x61a1('0x66')],_0x4fd92d['uniqueid'],md5(_0x4fd92d[_0x61a1('0x67')]));}else{_0x4fd92d[_0x61a1('0x68')]='';}return getConnection(_0x2eb635)[_0x61a1('0x26')](function(_0x59821a){_0x3d808b=_0x59821a;return getUser(_0x2eb635,_0x5213d3['email'],_0x3d808b);})[_0x61a1('0x26')](function(_0xa52010){_0x425541=_0xa52010;return getEndUser(_0x2eb635,_0x1bd91e,_0x4fd92d['calleridname'],_0x4fd92d['calleridnum'],_0x3d808b);})[_0x61a1('0x26')](function(_0x54d8b1){_0x32f5e7=_0x54d8b1;return getTicket(_0x2eb635,_0x425541,_0x32f5e7,_0x1bd91e,_0x4fd92d,_0x1bd91e[_0x61a1('0x69')],_0x3d808b,'queue');})[_0x61a1('0x26')](function(_0x3eacde){_0x423fc1=_0x3eacde;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x423fc1['id']);logger[_0x61a1('0x1e')](_0x61a1('0x6a'),_0x423fc1['id'],_0x5213d3[_0x61a1('0x56')],_0x2eb635['type']);switch(_0x2eb635['type']){case _0x61a1('0x6b'):emit(util[_0x61a1('0x45')]('user:%s',_0x5213d3[_0x61a1('0x56')]),_0x61a1('0x6c'),{'recordId':_0x423fc1['id']});break;case'newTab':emit(util[_0x61a1('0x45')]('user:%s',_0x5213d3['name']),_0x61a1('0x6d'),{'uri':util['format'](_0x61a1('0x6e'),_0x3d808b[_0x61a1('0x6f')],_0x423fc1['id'])});break;default:logger[_0x61a1('0x70')](_0x61a1('0x71'));}})['catch'](function(_0x3ea1ca){logger['error'](_0x61a1('0x63'),_0x3ea1ca);});};exports[_0x61a1('0x72')]=function(_0x34f8e6,_0x21c358,_0x49695e,_0x11221e,_0x3f65ba,_0x4951e7,_0x5878ce){var _0x373cad,_0x54c39b,_0x31589e,_0x2a822f;_0x4951e7[_0x61a1('0x66')]=intUtil[_0x61a1('0x61')](_0x4951e7[_0x61a1('0x66')]);_0x4951e7[_0x61a1('0x59')]=intUtil['stripTrailingSlash'](_0x4951e7[_0x61a1('0x59')]);if(_0x5878ce&&_0x5878ce[_0x61a1('0x73')]&&_0x5878ce[_0x61a1('0x73')]!==_0x61a1('0x74')){logger[_0x61a1('0x1e')](_0x61a1('0x75'),'Recording\x20is\x20enabled!');_0x21c358['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4951e7[_0x61a1('0x66')],_0x21c358[_0x61a1('0x67')],md5(_0x21c358[_0x61a1('0x67')]));}return getConnection(_0x4951e7)[_0x61a1('0x26')](function(_0x34ced8){_0x2a822f=_0x34ced8;return getUser(_0x4951e7,_0x11221e['email'],_0x2a822f);})[_0x61a1('0x26')](function(_0x35acde){_0x373cad=_0x35acde;return getEndUser(_0x4951e7,_0x49695e,_0x21c358['destcalleridname'],_0x21c358[_0x61a1('0x76')],_0x2a822f);})['then'](function(_0x3c9fb8){_0x54c39b=_0x3c9fb8;return getTicket(_0x4951e7,_0x373cad,_0x54c39b,_0x49695e,_0x21c358,_0x49695e['Fields'],_0x2a822f,_0x61a1('0x72'));})[_0x61a1('0x26')](function(_0x27e320){_0x31589e=_0x27e320;logger[_0x61a1('0x1e')](_0x61a1('0x77'),_0x31589e['id']);logger[_0x61a1('0x1e')](_0x61a1('0x78'),_0x31589e['id'],_0x11221e[_0x61a1('0x56')],_0x4951e7[_0x61a1('0x3f')]);switch(_0x4951e7[_0x61a1('0x3f')]){case _0x61a1('0x6b'):emit(util['format'](_0x61a1('0x79'),_0x11221e[_0x61a1('0x56')]),_0x61a1('0x6c'),{'recordId':_0x31589e['id']});break;case _0x61a1('0x7a'):emit(util[_0x61a1('0x45')]('user:%s',_0x11221e[_0x61a1('0x56')]),'trigger:browser:url',{'uri':util[_0x61a1('0x45')]('%s/%s/e',_0x2a822f[_0x61a1('0x6f')],_0x31589e['id'])});break;default:logger[_0x61a1('0x70')](_0x61a1('0x75'),_0x61a1('0x7b'));}})['catch'](function(_0x218eed){logger[_0x61a1('0x70')](_0x61a1('0x75'),_0x218eed);});};exports[_0x61a1('0x7c')]=function(_0x2e0699,_0x512e62,_0x3eed56,_0x290461,_0x2d81b8,_0x19858d){var _0x1fed1f,_0x232cb1,_0x40223f,_0x40ef33;_0x19858d[_0x61a1('0x66')]=intUtil[_0x61a1('0x61')](_0x19858d[_0x61a1('0x66')]);_0x19858d['remoteUri']=intUtil[_0x61a1('0x61')](_0x19858d[_0x61a1('0x59')]);if(_0x2d81b8&&_0x2d81b8[_0x61a1('0x62')]){logger['info']('['+_0x512e62[_0x61a1('0x7d')][_0x61a1('0x7e')]()+']',_0x61a1('0x64'));_0x512e62[_0x61a1('0x68')]=util[_0x61a1('0x45')](_0x61a1('0x65'),_0x19858d[_0x61a1('0x66')],_0x512e62['uniqueid'],md5(_0x512e62[_0x61a1('0x67')]));}else{_0x512e62[_0x61a1('0x68')]='';}return getConnection(_0x19858d)[_0x61a1('0x26')](function(_0x3e0a1a){_0x40ef33=_0x3e0a1a;if(!_[_0x61a1('0x21')](_0x290461)){return getUser(_0x19858d,_0x290461[_0x61a1('0x56')],_0x40ef33);}else{return getUser(_0x19858d,null,_0x40ef33);}})['then'](function(_0xf724db){_0x1fed1f=_0xf724db;return getEndUser(_0x19858d,_0x3eed56,_0x512e62['calleridname'],_0x512e62['calleridnum'],_0x40ef33);})[_0x61a1('0x26')](function(_0x15c515){_0x232cb1=_0x15c515;return getTicket(_0x19858d,_0x1fed1f,_0x232cb1,_0x3eed56,_0x512e62,_0x3eed56[_0x61a1('0x69')],_0x40ef33);})['then'](function(_0x4d952b){_0x40223f=_0x4d952b;logger[_0x61a1('0x1e')]('['+_0x512e62[_0x61a1('0x7d')][_0x61a1('0x7e')]()+_0x61a1('0x7f'),_0x40223f['id']);logger[_0x61a1('0x1e')]('['+_0x512e62['lastevent']['toUpperCase']()+_0x61a1('0x80'),_0x19858d['type']);})[_0x61a1('0x81')](function(_0x593ea2){logger[_0x61a1('0x70')]('['+_0x512e62['lastevent'][_0x61a1('0x7e')]()+']',_0x593ea2);});}; \ 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 309cada..042cf7b 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 _0x6ece=['defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','endUserNumber','user','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','variableName','idField','customVariable','name','Variable',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis'];(function(_0x15bb28,_0x9ab4a7){var _0x3bad26=function(_0xefcbb3){while(--_0xefcbb3){_0x15bb28['push'](_0x15bb28['shift']());}};_0x3bad26(++_0x9ab4a7);}(_0x6ece,0x13f));var _0xe6ec=function(_0x58ec65,_0x46445e){_0x58ec65=_0x58ec65-0x0;var _0x7ecd05=_0x6ece[_0x58ec65];return _0x7ecd05;};'use strict';var _=require(_0xe6ec('0x0'));var Promise=require(_0xe6ec('0x1'));var rp=require('request-promise');var util=require(_0xe6ec('0x2'));var md5=require(_0xe6ec('0x3'));var Redis=require(_0xe6ec('0x4'));var intUtil=require('./util');var config=require(_0xe6ec('0x5'));var logger=require(_0xe6ec('0x6'))('servicenow');config[_0xe6ec('0x7')]=_[_0xe6ec('0x8')](config[_0xe6ec('0x7')],{'host':_0xe6ec('0x9'),'port':0x18eb});var io=require(_0xe6ec('0xa'))(new Redis(config[_0xe6ec('0x7')]));function getAdminUser(_0x39740c,_0x34392e,_0x3062ce,_0x412219,_0xd4dd31,_0x1550ef){return new Promise(function(_0x3cefcd,_0x58dd22){var _0x38dd61={'method':_0xe6ec('0xb'),'uri':_0x412219+_0xe6ec('0xc')+'&'+_0xd4dd31+'&'+_0x1550ef,'auth':_0x34392e,'json':!![]};return rp(_0x38dd61)[_0xe6ec('0xd')](function(_0x1171ab){if(_0x1171ab[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0){_0x3062ce[_0xe6ec('0x10')]=_0x1171ab['result'][0x0][_0xe6ec('0x11')];}logger[_0xe6ec('0x12')]('['+[_0x39740c[_0xe6ec('0x13')]()]+_0xe6ec('0x14'),_0x3062ce);_0x3cefcd(_0x3062ce);})[_0xe6ec('0x15')](function(_0x15f879){logger[_0xe6ec('0x16')]('['+[_0x39740c[_0xe6ec('0x13')]()]+']',_0x15f879[_0xe6ec('0x17')]);_0x58dd22(_0x15f879[_0xe6ec('0x17')]);});});}function getUser(_0x26390c,_0x5cd960,_0x6941cd,_0x22554a,_0x5ce067){return function(_0x37ab98){logger[_0xe6ec('0x12')]('['+[_0x26390c[_0xe6ec('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x37ab98);return new Promise(function(_0x4c2195,_0x3d8bd4){if(intUtil['validateEmail'](_0x37ab98[_0xe6ec('0x18')])){var _0x4347b0={'method':'GET','uri':_0x6941cd+_0xe6ec('0x19')+_0x37ab98[_0xe6ec('0x18')]+'&'+_0x22554a+'&'+_0x5ce067,'auth':_0x5cd960,'json':!![]};logger['info']('['+[_0x26390c[_0xe6ec('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x4347b0);return rp(_0x4347b0)[_0xe6ec('0xd')](function(_0x6331de){logger['info']('['+[_0x26390c[_0xe6ec('0x13')]()]+_0xe6ec('0x1a'),_0x6331de);if(_0x6331de[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0&&String(_0x6331de[_0xe6ec('0xe')][0x0][_0xe6ec('0x1b')])===_0xe6ec('0x1c')){_0x37ab98[_0xe6ec('0x1d')]=_0x6331de[_0xe6ec('0xe')][0x0]['sys_id'];}else{_0x37ab98[_0xe6ec('0x1d')]=_0x37ab98[_0xe6ec('0x10')];_0x37ab98[_0xe6ec('0x18')]=_0x37ab98['adminEmail'];}logger[_0xe6ec('0x12')]('['+[_0x26390c['toUpperCase']()]+_0xe6ec('0x1e'),_0x37ab98);_0x4c2195(_0x37ab98);})[_0xe6ec('0x15')](function(_0x3d62e3){logger[_0xe6ec('0x16')]('['+[_0x26390c[_0xe6ec('0x13')]()]+']',_0x3d62e3['message']);_0x3d8bd4(_0x3d62e3[_0xe6ec('0x17')]);});}else{logger[_0xe6ec('0x12')]('['+[_0x26390c['toUpperCase']()]+_0xe6ec('0x1f'));_0x37ab98[_0xe6ec('0x1d')]=_0x37ab98['adminId'];_0x37ab98[_0xe6ec('0x18')]=_0x37ab98[_0xe6ec('0x20')];_0x4c2195(_0x37ab98);}});};}function createEndUser(_0x3cb7ef,_0x50f122,_0x4a3451,_0xc2cc1b,_0xfbadfa){logger[_0xe6ec('0x12')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+'],\x20createEndUser\x20input\x20crm',_0x4a3451);return new Promise(function(_0x69b27d,_0x521b06){var _0x1941ce={'method':'POST','uri':_0xc2cc1b+'sys_user?'+_0xfbadfa,'body':{'user_name':_0x4a3451[_0xe6ec('0x21')],'roles':_0xe6ec('0x22'),'first_name':_0x4a3451[_0xe6ec('0x21')],'active':_0xe6ec('0x1c'),'date_format':'System','phone':_0x4a3451['endUserNumber']},'auth':_0x50f122,'json':!![]};return rp(_0x1941ce)[_0xe6ec('0xd')](function(_0x48779e){logger[_0xe6ec('0x12')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+'],\x20EndUser\x20schema',_0x48779e[_0xe6ec('0xe')]);_0x4a3451['endUserId']=_0x48779e[_0xe6ec('0xe')][_0xe6ec('0x11')];_0x69b27d(_0x4a3451);})['catch'](function(_0x298044){logger[_0xe6ec('0x16')]('['+[_0x3cb7ef[_0xe6ec('0x13')]()]+']',_0x298044[_0xe6ec('0x17')]);_0x521b06(_0x298044[_0xe6ec('0x17')]);});});}function getEndUser(_0x35f2cb,_0x247f47,_0x550e62,_0x256c23,_0x1dba30){return function(_0x5f1536){logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+_0xe6ec('0x23'),_0x5f1536);return new Promise(function(_0x41e4e6,_0x2e7351){var _0x2ed02b={'method':_0xe6ec('0xb'),'uri':_0x550e62+_0xe6ec('0x24')+_0x5f1536['endUserNumber']+'&'+_0x256c23+'&'+_0x1dba30,'auth':_0x247f47,'json':!![]};return rp(_0x2ed02b)[_0xe6ec('0xd')](function(_0xdb73a){if(_0xdb73a[_0xe6ec('0xe')][_0xe6ec('0xf')]>0x0){_0x5f1536[_0xe6ec('0x25')]=_0xdb73a[_0xe6ec('0xe')][0x0][_0xe6ec('0x11')];logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+_0xe6ec('0x26'),_0x5f1536);_0x41e4e6(_0x5f1536);}else{return createEndUser(_0x35f2cb,_0x247f47,_0x5f1536,_0x550e62,_0x256c23)[_0xe6ec('0xd')](function(_0xbaf03e){logger[_0xe6ec('0x12')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+'],\x20createEndUser\x20crm',_0xbaf03e);_0x41e4e6(_0xbaf03e);});}})['catch'](function(_0x7e21b0){logger[_0xe6ec('0x16')]('['+[_0x35f2cb[_0xe6ec('0x13')]()]+']',_0x7e21b0[_0xe6ec('0x17')]);_0x2e7351(_0x7e21b0[_0xe6ec('0x17')]);});});};}function getCustomFields(_0x16e288,_0x374031){var _0x549292={};if(_0x16e288[_0xe6ec('0xf')]>0x0){_[_0xe6ec('0x27')](_0x16e288,function(_0x2904ab){if(_[_0xe6ec('0x28')]([_0xe6ec('0x29'),_0xe6ec('0x2a')],_0x2904ab[_0xe6ec('0x2b')])&&_0x2904ab[_0xe6ec('0x2c')]&&!_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab[_0xe6ec('0x2c')][_0xe6ec('0x2e')]()]=_0x2904ab[_0xe6ec('0x2f')][_0xe6ec('0x30')]();}else if(_[_0xe6ec('0x28')]([_0xe6ec('0x29'),_0xe6ec('0x2a')],_0x2904ab[_0xe6ec('0x2b')])&&_0x2904ab['idField']&&_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab['idField'][_0xe6ec('0x2e')]()]=_0x2904ab[_0xe6ec('0x2f')][_0xe6ec('0x30')]();}else if(_0x2904ab[_0xe6ec('0x2b')]==='variable'&&_0x2904ab[_0xe6ec('0x31')]&&_0x2904ab[_0xe6ec('0x32')]&&_0x2904ab[_0xe6ec('0x2d')]){_0x549292[_0x2904ab['idField']['toLowerCase']()]=_0x374031[_0x2904ab[_0xe6ec('0x31')]][_0xe6ec('0x30')]();}else if(_0x2904ab[_0xe6ec('0x2b')]===_0xe6ec('0x33')&&_0x2904ab['Variable']&&_0x2904ab['Variable'][_0xe6ec('0x34')]&&_0x2904ab['idField']&&_0x2904ab['customField']){_0x549292[_0x2904ab[_0xe6ec('0x32')][_0xe6ec('0x2e')]()]=_0x374031[_0x2904ab[_0xe6ec('0x35')][_0xe6ec('0x34')][_0xe6ec('0x2e')]()][_0xe6ec('0x30')]();}});}return _0x549292;}function getTicket(_0x5383da,_0x4afb50,_0x17c68f,_0x468d27,_0x526c01,_0x3e3860){return function(_0x81fa34){logger[_0xe6ec('0x12')]('['+[_0x5383da[_0xe6ec('0x13')]()]+_0xe6ec('0x36'),_0x81fa34);return new Promise(function(_0x97804c,_0x583fcf){var _0x163e87=_0x5383da[_0xe6ec('0x2e')]()==='outbound'?_0x81fa34[_0xe6ec('0x1d')]:_0x81fa34['endUserId'];var _0x3a8117={'method':_0xe6ec('0x37'),'uri':_0x17c68f+_0xe6ec('0x38')+'?'+_0x3e3860,'body':Object[_0xe6ec('0x39')]({},{'active':_0xe6ec('0x1c'),'caller_id':_0x163e87,'assigned_to':_0x81fa34[_0xe6ec('0x1d')],'short_description':intUtil[_0xe6ec('0x3a')](_0x468d27[_0xe6ec('0x3b')],_0x526c01,'\x20'),'description':intUtil[_0xe6ec('0x3a')](_0x468d27[_0xe6ec('0x3c')],_0x526c01,'\x0a')},getCustomFields(_0x468d27['Fields'],_0x526c01)),'auth':_0x4afb50,'json':!![]};return rp(_0x3a8117)[_0xe6ec('0xd')](function(_0x5932e0){logger[_0xe6ec('0x12')]('['+[_0x5383da['toUpperCase']()]+_0xe6ec('0x3d'),_0x5932e0['result']);_0x81fa34[_0xe6ec('0x3e')]=_0x5932e0[_0xe6ec('0xe')]['sys_id'];_0x81fa34[_0xe6ec('0x3f')]=_0x5932e0['result'][_0xe6ec('0x40')];logger['info']('['+[_0x5383da[_0xe6ec('0x13')]()]+']\x20getTicket\x20crm',_0x81fa34);_0x97804c(_0x81fa34);})['catch'](function(_0x340988){logger[_0xe6ec('0x16')]('['+[_0x5383da[_0xe6ec('0x13')]()]+']',_0x340988[_0xe6ec('0x17')]);_0x583fcf(_0x340988[_0xe6ec('0x17')]);});});};}function createRemoteTag(_0x3acd7e,_0x46d394,_0x44dfdf,_0x117a01){return new Promise(function(_0x505cb6,_0x1b56de){var _0x388486={'method':_0xe6ec('0x37'),'uri':_0x44dfdf+_0xe6ec('0x41')+'?'+_0x117a01,'body':{'short_description':_0x3acd7e,'global':!![],'active':!![],'name':_0x3acd7e},'auth':_0x46d394,'json':!![]};return rp(_0x388486)['then'](function(_0x59390b){var _0x337d7a=_0x59390b[_0xe6ec('0xe')][_0xe6ec('0x11')];_0x505cb6(_0x337d7a);});});}function getRemoteTag(_0x441339,_0x43e566,_0x4d7413,_0x1d3e11,_0x146925){return new Promise(function(_0x226831,_0x46c4aa){var _0x5dfe16={'method':_0xe6ec('0xb'),'uri':_0x4d7413+'label'+'?sysparm_query=name%3D'+_0x441339+'&'+_0x1d3e11,'auth':_0x43e566,'json':!![]};return rp(_0x5dfe16)[_0xe6ec('0xd')](function(_0x5c8e53){if(_0x5c8e53[_0xe6ec('0xe')]['length']>0x0){var _0x3cbaa0=_0x5c8e53['result'][0x0][_0xe6ec('0x11')];_0x226831(_0x3cbaa0);}else{return createRemoteTag(_0x441339,_0x43e566,_0x4d7413,_0x1d3e11)[_0xe6ec('0xd')](function(_0x51041d){_0x226831(_0x51041d);});}});});}function assignTagToIncident(_0x1dfca2,_0x3122d4,_0x2e1ed4,_0x5b6041,_0x37ca1f){return new Promise(function(_0x4a69c7,_0x226428){var _0x46723b={'method':_0xe6ec('0x37'),'uri':_0x2e1ed4+_0xe6ec('0x42')+'?'+_0x37ca1f,'body':{'label':_0x1dfca2,'table':_0xe6ec('0x38'),'id_type':_0xe6ec('0x43'),'table_key':_0x5b6041[_0xe6ec('0x3e')],'title':_0xe6ec('0x44')+_0x5b6041['ticketNumber'],'id_display':_0x5b6041[_0xe6ec('0x3f')]},'auth':_0x3122d4,'json':!![]};return rp(_0x46723b)['then'](function(_0x2742c1){_0x4a69c7();})[_0xe6ec('0x15')](function(){_0x4a69c7();});});}function manageTags(_0x1627e2,_0xbc0866,_0x5112b1,_0x2d989a,_0x5ab612,_0x2e91e0,_0x65e7c){return new Promise(function(_0x2c7a57,_0x1f2437){var _0x5317f5=[];_0xbc0866[_0xe6ec('0x27')](function(_0x52e8ff){_0x5317f5['push'](getRemoteTag(_0x52e8ff,_0x5112b1,_0x2d989a,_0x2e91e0,_0x65e7c));});return Promise[_0xe6ec('0x45')](_0x5317f5)[_0xe6ec('0xd')](function(_0x2f5777){if(_0x2f5777[_0xe6ec('0xf')]){logger['info']('['+[_0x1627e2['toUpperCase']()]+_0xe6ec('0x46'),_0x2f5777);var _0x38852c=[];_0x2f5777[_0xe6ec('0x27')](function(_0x25dd3d){_0x38852c[_0xe6ec('0x47')](assignTagToIncident(_0x25dd3d,_0x5112b1,_0x2d989a,_0x5ab612,_0x2e91e0));});return Promise[_0xe6ec('0x45')](_0x38852c)[_0xe6ec('0xd')](function(){_0x2c7a57();})[_0xe6ec('0x15')](function(){_0x2c7a57();});}else{_0x2c7a57();}});});}function getTags(_0x54f0e1,_0x5c7216,_0x32463d,_0x2b2637,_0x2f477e,_0xd904f9){return function(_0x57313a){return new Promise(function(_0x41b56,_0x181b4e){var _0x598353=[];var _0x15f837=_0x2b2637[_0xe6ec('0x48')];if(_0x15f837&&_0x15f837[_0xe6ec('0xf')]>0x0){_0x598353=_[_0xe6ec('0x49')](_0x15f837,_0xe6ec('0x34'));}if(_0x598353['length']>0x0){return manageTags(_0x54f0e1,_0x598353,_0x5c7216,_0x32463d,_0x57313a,_0x2f477e,_0xd904f9)[_0xe6ec('0xd')](function(){_0x41b56(_0x57313a);});}else{_0x41b56(_0x57313a);}});};}function emit(_0x47cf12,_0xfd6c74,_0x39a780){var _0x1f7a16=_0xe6ec('0x4a')+_0xe6ec('0x4b')+_0xe6ec('0x4c')+_0xe6ec('0x4d');var _0x48d631={'uri':_0x47cf12+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x39a780+_0x1f7a16};io['to'](util[_0xe6ec('0x4e')](_0xe6ec('0x4f'),_0xfd6c74))['emit'](_0xe6ec('0x50'),_0x48d631);}exports['cs']=function(_0x4e29e3,_0x5549c3,_0xe27484,_0x21dc18,_0x15a8dc,_0x593d48,_0x27e2a7,_0x4b48e2){var _0x44cf87={};var _0x29873d={'user':_0x593d48[_0xe6ec('0x51')],'pass':_0x593d48[_0xe6ec('0x52')]};var _0x542e35=_0xe6ec('0x53');var _0x33b084='sysparm_display_value=true';_0x593d48['remoteUri']=intUtil['stripTrailingSlash'](_0x593d48[_0xe6ec('0x54')]);_0x593d48[_0xe6ec('0x55')]=intUtil[_0xe6ec('0x56')](_0x593d48[_0xe6ec('0x55')]);var _0x513db2=util[_0xe6ec('0x4e')](_0xe6ec('0x57'),_0x593d48['remoteUri']);_0x44cf87[_0xe6ec('0x18')]=!_[_0xe6ec('0x58')](_0x21dc18)?_0x21dc18['email']:null;_0x44cf87['adminEmail']=_0x593d48[_0xe6ec('0x59')];_0x44cf87[_0xe6ec('0x21')]=_0x4b48e2[_0xe6ec('0x2e')]()===_0xe6ec('0x5a')?_0x5549c3[_0xe6ec('0x5b')]:_0x5549c3[_0xe6ec('0x5c')];_0x44cf87['callDirection']=_0x4b48e2===_0xe6ec('0x5d')||_0x4b48e2===_0xe6ec('0x5e')?_0xe6ec('0x5d'):_0xe6ec('0x5a');var _0x300a64=util[_0xe6ec('0x4e')](_0xe6ec('0x5f'),_0x593d48[_0xe6ec('0x55')],_0x5549c3[_0xe6ec('0x60')],md5(_0x5549c3[_0xe6ec('0x60')]));if(_0x15a8dc&&_0x15a8dc[_0xe6ec('0x61')]){logger[_0xe6ec('0x12')](_0xe6ec('0x62'),'Recording\x20is\x20enabled!');_0x5549c3['recordingURL']=_0x300a64;}else if(_0x27e2a7&&_0x27e2a7[_0xe6ec('0x63')]&&_0x27e2a7[_0xe6ec('0x63')]!==_0xe6ec('0x64')){logger[_0xe6ec('0x12')](_0xe6ec('0x65'),_0xe6ec('0x66'));_0x5549c3['recordingURL']=_0x300a64;}else{_0x5549c3[_0xe6ec('0x67')]='';}return getAdminUser(_0x4b48e2,_0x29873d,_0x44cf87,_0x513db2,_0x33b084,_0x542e35)[_0xe6ec('0xd')](getUser(_0x4b48e2,_0x29873d,_0x513db2,_0x33b084,_0x542e35))[_0xe6ec('0xd')](getEndUser(_0x4b48e2,_0x29873d,_0x513db2,_0x33b084,_0x542e35))[_0xe6ec('0xd')](getTicket(_0x4b48e2,_0x29873d,_0x513db2,_0xe27484,_0x5549c3,_0x33b084))[_0xe6ec('0xd')](function(_0x67bf9a){logger['info'](util[_0xe6ec('0x4e')](_0xe6ec('0x68'),_0x67bf9a[_0xe6ec('0x3e')]));logger[_0xe6ec('0x12')](util[_0xe6ec('0x4e')](_0xe6ec('0x69'),_0x4b48e2));if(_0x4b48e2!==_0xe6ec('0x5e')){logger[_0xe6ec('0x12')]('['+[_0x4b48e2[_0xe6ec('0x13')]()]+']',_0xe6ec('0x6a'));emit(_0x593d48[_0xe6ec('0x54')],_0x21dc18[_0xe6ec('0x34')],_0x67bf9a[_0xe6ec('0x3e')]);}})[_0xe6ec('0x15')](function(_0x34d669){logger[_0xe6ec('0x16')]('['+[_0x4b48e2[_0xe6ec('0x13')]()]+_0xe6ec('0x6b'),util[_0xe6ec('0x6c')](_0x34d669,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9bd2=['],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','catch','error','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9bd2,0x1db));var _0x29bd=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9bd2[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x29bd('0x0'));var Promise=require(_0x29bd('0x1'));var rp=require(_0x29bd('0x2'));var util=require(_0x29bd('0x3'));var md5=require(_0x29bd('0x4'));var Redis=require(_0x29bd('0x5'));var intUtil=require(_0x29bd('0x6'));var config=require(_0x29bd('0x7'));var logger=require(_0x29bd('0x8'))(_0x29bd('0x9'));config[_0x29bd('0xa')]=_[_0x29bd('0xb')](config[_0x29bd('0xa')],{'host':_0x29bd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29bd('0xa')]));function getAdminUser(_0xb41c56,_0x11f86c,_0x3ecdc9,_0x5cc6b1,_0x479279,_0x4132ad){return new Promise(function(_0x3a4925,_0x20e617){var _0x43f087={'method':_0x29bd('0xd'),'uri':_0x5cc6b1+_0x29bd('0xe')+'&'+_0x479279+'&'+_0x4132ad,'auth':_0x11f86c,'json':!![]};return rp(_0x43f087)[_0x29bd('0xf')](function(_0x13d156){if(_0x13d156[_0x29bd('0x10')][_0x29bd('0x11')]>0x0){_0x3ecdc9[_0x29bd('0x12')]=_0x13d156[_0x29bd('0x10')][0x0]['sys_id'];}logger[_0x29bd('0x13')]('['+[_0xb41c56[_0x29bd('0x14')]()]+'],\x20getAdminUser\x20crm',_0x3ecdc9);_0x3a4925(_0x3ecdc9);})[_0x29bd('0x15')](function(_0x278376){logger[_0x29bd('0x16')]('['+[_0xb41c56[_0x29bd('0x14')]()]+']',_0x278376['message']);_0x20e617(_0x278376[_0x29bd('0x17')]);});});}function getUser(_0x632497,_0x1c6347,_0x336831,_0x4fbf15,_0x3c43a1){return function(_0x50f420){logger[_0x29bd('0x13')]('['+[_0x632497['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x50f420);return new Promise(function(_0x2a4889,_0x4d2b27){if(intUtil[_0x29bd('0x18')](_0x50f420[_0x29bd('0x19')])){var _0x2e41ff={'method':_0x29bd('0xd'),'uri':_0x336831+'sys_user?sysparm_query=email%3D'+_0x50f420['userEmail']+'&'+_0x4fbf15+'&'+_0x3c43a1,'auth':_0x1c6347,'json':!![]};logger[_0x29bd('0x13')]('['+[_0x632497['toUpperCase']()]+_0x29bd('0x1a'),_0x2e41ff);return rp(_0x2e41ff)[_0x29bd('0xf')](function(_0x5eeffa){logger[_0x29bd('0x13')]('['+[_0x632497[_0x29bd('0x14')]()]+_0x29bd('0x1b'),_0x5eeffa);if(_0x5eeffa[_0x29bd('0x10')][_0x29bd('0x11')]>0x0&&String(_0x5eeffa['result'][0x0]['active'])===_0x29bd('0x1c')){_0x50f420[_0x29bd('0x1d')]=_0x5eeffa['result'][0x0][_0x29bd('0x1e')];}else{_0x50f420[_0x29bd('0x1d')]=_0x50f420[_0x29bd('0x12')];_0x50f420['userEmail']=_0x50f420[_0x29bd('0x1f')];}logger['info']('['+[_0x632497['toUpperCase']()]+_0x29bd('0x20'),_0x50f420);_0x2a4889(_0x50f420);})['catch'](function(_0x334a4c){logger[_0x29bd('0x16')]('['+[_0x632497[_0x29bd('0x14')]()]+']',_0x334a4c['message']);_0x4d2b27(_0x334a4c[_0x29bd('0x17')]);});}else{logger[_0x29bd('0x13')]('['+[_0x632497['toUpperCase']()]+_0x29bd('0x21'));_0x50f420[_0x29bd('0x1d')]=_0x50f420[_0x29bd('0x12')];_0x50f420[_0x29bd('0x19')]=_0x50f420[_0x29bd('0x1f')];_0x2a4889(_0x50f420);}});};}function createEndUser(_0x559e50,_0x2530b6,_0x2338a1,_0x46d81b,_0x287b0b){logger[_0x29bd('0x13')]('['+[_0x559e50[_0x29bd('0x14')]()]+_0x29bd('0x22'),_0x2338a1);return new Promise(function(_0x63d3c9,_0x114123){var _0x5782ba={'method':_0x29bd('0x23'),'uri':_0x46d81b+_0x29bd('0x24')+_0x287b0b,'body':{'user_name':_0x2338a1['endUserNumber'],'roles':_0x29bd('0x25'),'first_name':_0x2338a1[_0x29bd('0x26')],'active':'true','date_format':_0x29bd('0x27'),'phone':_0x2338a1[_0x29bd('0x26')]},'auth':_0x2530b6,'json':!![]};return rp(_0x5782ba)['then'](function(_0x59015a){logger[_0x29bd('0x13')]('['+[_0x559e50[_0x29bd('0x14')]()]+_0x29bd('0x28'),_0x59015a[_0x29bd('0x10')]);_0x2338a1[_0x29bd('0x29')]=_0x59015a[_0x29bd('0x10')]['sys_id'];_0x63d3c9(_0x2338a1);})[_0x29bd('0x15')](function(_0x14f14a){logger[_0x29bd('0x16')]('['+[_0x559e50[_0x29bd('0x14')]()]+']',_0x14f14a['message']);_0x114123(_0x14f14a[_0x29bd('0x17')]);});});}function getEndUser(_0x45adb1,_0x103b4a,_0x16e814,_0x19eceb,_0x54c947){return function(_0x509398){logger['info']('['+[_0x45adb1['toUpperCase']()]+_0x29bd('0x2a'),_0x509398);return new Promise(function(_0x5d7219,_0xeb1896){var _0x5e4060={'method':_0x29bd('0xd'),'uri':_0x16e814+_0x29bd('0x2b')+_0x509398[_0x29bd('0x26')]+'&'+_0x19eceb+'&'+_0x54c947,'auth':_0x103b4a,'json':!![]};return rp(_0x5e4060)[_0x29bd('0xf')](function(_0x1b0c6d){if(_0x1b0c6d['result'][_0x29bd('0x11')]>0x0){_0x509398[_0x29bd('0x29')]=_0x1b0c6d[_0x29bd('0x10')][0x0][_0x29bd('0x1e')];logger[_0x29bd('0x13')]('['+[_0x45adb1[_0x29bd('0x14')]()]+_0x29bd('0x2c'),_0x509398);_0x5d7219(_0x509398);}else{return createEndUser(_0x45adb1,_0x103b4a,_0x509398,_0x16e814,_0x19eceb)[_0x29bd('0xf')](function(_0x3eadd3){logger['info']('['+[_0x45adb1['toUpperCase']()]+_0x29bd('0x2d'),_0x3eadd3);_0x5d7219(_0x3eadd3);});}})['catch'](function(_0x13a4b0){logger['error']('['+[_0x45adb1['toUpperCase']()]+']',_0x13a4b0[_0x29bd('0x17')]);_0xeb1896(_0x13a4b0[_0x29bd('0x17')]);});});};}function getCustomFields(_0x106273,_0x3e74e0){var _0x38513c={};if(_0x106273[_0x29bd('0x11')]>0x0){_['forEach'](_0x106273,function(_0x1c6291){if(_['includes']([_0x29bd('0x2e'),_0x29bd('0x2f')],_0x1c6291[_0x29bd('0x30')])&&_0x1c6291[_0x29bd('0x31')]&&!_0x1c6291[_0x29bd('0x32')]){_0x38513c[_0x1c6291['nameField'][_0x29bd('0x33')]()]=_0x1c6291[_0x29bd('0x34')][_0x29bd('0x35')]();}else if(_[_0x29bd('0x36')]([_0x29bd('0x2e'),_0x29bd('0x2f')],_0x1c6291[_0x29bd('0x30')])&&_0x1c6291[_0x29bd('0x37')]&&_0x1c6291[_0x29bd('0x32')]){_0x38513c[_0x1c6291[_0x29bd('0x37')][_0x29bd('0x33')]()]=_0x1c6291[_0x29bd('0x34')]['toString']();}else if(_0x1c6291[_0x29bd('0x30')]==='variable'&&_0x1c6291['variableName']&&_0x1c6291[_0x29bd('0x37')]&&_0x1c6291[_0x29bd('0x32')]){_0x38513c[_0x1c6291[_0x29bd('0x37')][_0x29bd('0x33')]()]=_0x3e74e0[_0x1c6291['variableName']][_0x29bd('0x35')]();}else if(_0x1c6291[_0x29bd('0x30')]===_0x29bd('0x38')&&_0x1c6291[_0x29bd('0x39')]&&_0x1c6291['Variable'][_0x29bd('0x3a')]&&_0x1c6291[_0x29bd('0x37')]&&_0x1c6291[_0x29bd('0x32')]){_0x38513c[_0x1c6291[_0x29bd('0x37')]['toLowerCase']()]=_0x3e74e0[_0x1c6291[_0x29bd('0x39')][_0x29bd('0x3a')][_0x29bd('0x33')]()][_0x29bd('0x35')]();}});}return _0x38513c;}function getTicket(_0x1049c5,_0x86c13a,_0x955555,_0x25df7b,_0x361924,_0x5b358f){return function(_0x3ca871){logger[_0x29bd('0x13')]('['+[_0x1049c5[_0x29bd('0x14')]()]+_0x29bd('0x3b'),_0x3ca871);return new Promise(function(_0x4c4e53,_0x23c02b){var _0x5bbbeb=_0x1049c5[_0x29bd('0x33')]()===_0x29bd('0x3c')?_0x3ca871[_0x29bd('0x1d')]:_0x3ca871[_0x29bd('0x29')];var _0x126224={'method':'POST','uri':_0x955555+_0x29bd('0x3d')+'?'+_0x5b358f,'body':Object[_0x29bd('0x3e')]({},{'active':_0x29bd('0x1c'),'caller_id':_0x5bbbeb,'assigned_to':_0x3ca871['userId'],'short_description':intUtil[_0x29bd('0x3f')](_0x25df7b[_0x29bd('0x40')],_0x361924,'\x20'),'description':intUtil[_0x29bd('0x3f')](_0x25df7b[_0x29bd('0x41')],_0x361924,'\x0a')},getCustomFields(_0x25df7b['Fields'],_0x361924)),'auth':_0x86c13a,'json':!![]};return rp(_0x126224)[_0x29bd('0xf')](function(_0x440c43){logger[_0x29bd('0x13')]('['+[_0x1049c5[_0x29bd('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x440c43[_0x29bd('0x10')]);_0x3ca871['ticketId']=_0x440c43[_0x29bd('0x10')][_0x29bd('0x1e')];_0x3ca871[_0x29bd('0x42')]=_0x440c43[_0x29bd('0x10')][_0x29bd('0x43')];logger[_0x29bd('0x13')]('['+[_0x1049c5['toUpperCase']()]+_0x29bd('0x44'),_0x3ca871);_0x4c4e53(_0x3ca871);})[_0x29bd('0x15')](function(_0x4862e5){logger['error']('['+[_0x1049c5[_0x29bd('0x14')]()]+']',_0x4862e5[_0x29bd('0x17')]);_0x23c02b(_0x4862e5[_0x29bd('0x17')]);});});};}function createRemoteTag(_0x3cca44,_0x4bfa35,_0x560120,_0x43e6de){return new Promise(function(_0x4f4b74,_0x459675){var _0x3f1d4c={'method':_0x29bd('0x23'),'uri':_0x560120+'label'+'?'+_0x43e6de,'body':{'short_description':_0x3cca44,'global':!![],'active':!![],'name':_0x3cca44},'auth':_0x4bfa35,'json':!![]};return rp(_0x3f1d4c)[_0x29bd('0xf')](function(_0x431358){var _0x3935ae=_0x431358[_0x29bd('0x10')]['sys_id'];_0x4f4b74(_0x3935ae);});});}function getRemoteTag(_0x1775ff,_0x572a89,_0xabe7f6,_0x38cff0,_0x410332){return new Promise(function(_0x439f2b,_0x2f5740){var _0x5b8bc3={'method':'GET','uri':_0xabe7f6+_0x29bd('0x45')+_0x29bd('0x46')+_0x1775ff+'&'+_0x38cff0,'auth':_0x572a89,'json':!![]};return rp(_0x5b8bc3)[_0x29bd('0xf')](function(_0x39cff5){if(_0x39cff5['result'][_0x29bd('0x11')]>0x0){var _0x15ea4d=_0x39cff5[_0x29bd('0x10')][0x0][_0x29bd('0x1e')];_0x439f2b(_0x15ea4d);}else{return createRemoteTag(_0x1775ff,_0x572a89,_0xabe7f6,_0x38cff0)[_0x29bd('0xf')](function(_0x320560){_0x439f2b(_0x320560);});}});});}function assignTagToIncident(_0xec7bb6,_0x38fb40,_0x3f272d,_0x783e7e,_0xfb80c6){return new Promise(function(_0x1546af,_0x1b7261){var _0x430a75={'method':_0x29bd('0x23'),'uri':_0x3f272d+_0x29bd('0x47')+'?'+_0xfb80c6,'body':{'label':_0xec7bb6,'table':_0x29bd('0x3d'),'id_type':'Incident','table_key':_0x783e7e[_0x29bd('0x48')],'title':'Incident\x20-\x20'+_0x783e7e[_0x29bd('0x42')],'id_display':_0x783e7e['ticketNumber']},'auth':_0x38fb40,'json':!![]};return rp(_0x430a75)[_0x29bd('0xf')](function(_0x4af5e5){_0x1546af();})[_0x29bd('0x15')](function(){_0x1546af();});});}function manageTags(_0x38635c,_0x44875f,_0x547439,_0x15ce6f,_0x370038,_0x4774fb,_0xd1b247){return new Promise(function(_0x48e961,_0x5d139c){var _0x4ce3dd=[];_0x44875f[_0x29bd('0x49')](function(_0x4e91d5){_0x4ce3dd['push'](getRemoteTag(_0x4e91d5,_0x547439,_0x15ce6f,_0x4774fb,_0xd1b247));});return Promise['all'](_0x4ce3dd)[_0x29bd('0xf')](function(_0x4f7483){if(_0x4f7483[_0x29bd('0x11')]){logger[_0x29bd('0x13')]('['+[_0x38635c[_0x29bd('0x14')]()]+_0x29bd('0x4a'),_0x4f7483);var _0x361311=[];_0x4f7483[_0x29bd('0x49')](function(_0x3065b2){_0x361311[_0x29bd('0x4b')](assignTagToIncident(_0x3065b2,_0x547439,_0x15ce6f,_0x370038,_0x4774fb));});return Promise['all'](_0x361311)['then'](function(){_0x48e961();})[_0x29bd('0x15')](function(){_0x48e961();});}else{_0x48e961();}});});}function getTags(_0x5340d6,_0x137465,_0x505fb0,_0x2d73e8,_0x2385b8,_0x4e8d38){return function(_0x53b95f){return new Promise(function(_0x2c4b16,_0x2dc5fb){var _0x1e2b25=[];var _0x3d2939=_0x2d73e8[_0x29bd('0x4c')];if(_0x3d2939&&_0x3d2939[_0x29bd('0x11')]>0x0){_0x1e2b25=_[_0x29bd('0x4d')](_0x3d2939,_0x29bd('0x3a'));}if(_0x1e2b25['length']>0x0){return manageTags(_0x5340d6,_0x1e2b25,_0x137465,_0x505fb0,_0x53b95f,_0x2385b8,_0x4e8d38)[_0x29bd('0xf')](function(){_0x2c4b16(_0x53b95f);});}else{_0x2c4b16(_0x53b95f);}});};}function emit(_0x4a3827,_0x2eb2a6,_0x1f5954){var _0xcfabfc=_0x29bd('0x4e')+_0x29bd('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x29bd('0x50');var _0x22fcef={'uri':_0x4a3827+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x1f5954+_0xcfabfc};io['to'](util['format'](_0x29bd('0x51'),_0x2eb2a6))[_0x29bd('0x52')](_0x29bd('0x53'),_0x22fcef);}exports['cs']=function(_0x3497e5,_0x1a5d11,_0x38cb25,_0x4123f0,_0x3d676c,_0x25b0e5,_0x2b9cac,_0x66b653){var _0x2cb24a={};var _0x1f157a={'user':_0x25b0e5['username'],'pass':_0x25b0e5[_0x29bd('0x54')]};var _0x3e19d5=_0x29bd('0x55');var _0x33128c=_0x29bd('0x56');_0x25b0e5[_0x29bd('0x57')]=intUtil[_0x29bd('0x58')](_0x25b0e5[_0x29bd('0x57')]);_0x25b0e5[_0x29bd('0x59')]=intUtil[_0x29bd('0x58')](_0x25b0e5[_0x29bd('0x59')]);var _0x24f23f=util[_0x29bd('0x5a')](_0x29bd('0x5b'),_0x25b0e5[_0x29bd('0x57')]);_0x2cb24a[_0x29bd('0x19')]=!_[_0x29bd('0x5c')](_0x4123f0)?_0x4123f0[_0x29bd('0x5d')]:null;_0x2cb24a[_0x29bd('0x1f')]=_0x25b0e5[_0x29bd('0x5d')];_0x2cb24a[_0x29bd('0x26')]=_0x66b653['toLowerCase']()===_0x29bd('0x3c')?_0x1a5d11[_0x29bd('0x5e')]:_0x1a5d11['calleridnum'];_0x2cb24a[_0x29bd('0x5f')]=_0x66b653===_0x29bd('0x60')||_0x66b653==='unmanaged'?'queue':'outbound';var _0x38ff49=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25b0e5[_0x29bd('0x59')],_0x1a5d11['uniqueid'],md5(_0x1a5d11[_0x29bd('0x61')]));if(_0x3d676c&&_0x3d676c[_0x29bd('0x62')]){logger[_0x29bd('0x13')](_0x29bd('0x63'),_0x29bd('0x64'));_0x1a5d11[_0x29bd('0x65')]=_0x38ff49;}else if(_0x2b9cac&&_0x2b9cac[_0x29bd('0x66')]&&_0x2b9cac[_0x29bd('0x66')]!=='none'){logger['info'](_0x29bd('0x67'),_0x29bd('0x64'));_0x1a5d11[_0x29bd('0x65')]=_0x38ff49;}else{_0x1a5d11[_0x29bd('0x65')]='';}return getAdminUser(_0x66b653,_0x1f157a,_0x2cb24a,_0x24f23f,_0x33128c,_0x3e19d5)[_0x29bd('0xf')](getUser(_0x66b653,_0x1f157a,_0x24f23f,_0x33128c,_0x3e19d5))['then'](getEndUser(_0x66b653,_0x1f157a,_0x24f23f,_0x33128c,_0x3e19d5))[_0x29bd('0xf')](getTicket(_0x66b653,_0x1f157a,_0x24f23f,_0x38cb25,_0x1a5d11,_0x33128c))['then'](function(_0x47b8c9){logger[_0x29bd('0x13')](util[_0x29bd('0x5a')]('The\x20ticket\x20ID\x20is:\x20%s',_0x47b8c9[_0x29bd('0x48')]));logger[_0x29bd('0x13')](util['format']('call\x20direction:\x20%s',_0x66b653));if(_0x66b653!=='unmanaged'){logger[_0x29bd('0x13')]('['+[_0x66b653[_0x29bd('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25b0e5[_0x29bd('0x57')],_0x4123f0[_0x29bd('0x3a')],_0x47b8c9[_0x29bd('0x48')]);}})['catch'](function(_0x46ade9){logger[_0x29bd('0x16')]('['+[_0x66b653[_0x29bd('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x46ade9,{'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 8ee303c..b50bee9 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 _0x2ed3=['parent_type','parent_name','direction','forEach','idField','variableName','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','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!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','string','customField','toLowerCase','custom_fields','push','content','toString','type','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','uri','lastevent','toUpperCase','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','info','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','replace'];(function(_0x5909c3,_0x15ad7a){var _0x45795b=function(_0x3683a4){while(--_0x3683a4){_0x5909c3['push'](_0x5909c3['shift']());}};_0x45795b(++_0x15ad7a);}(_0x2ed3,0xd4));var _0x32ed=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x2ed3[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var Redis=require('ioredis');var intUtil=require(_0x32ed('0x2'));var config=require(_0x32ed('0x3'));var logger=require('../../../../config/logger')(_0x32ed('0x4'));config[_0x32ed('0x5')]=_[_0x32ed('0x6')](config[_0x32ed('0x5')],{'host':_0x32ed('0x7'),'port':0x18eb});var io=require(_0x32ed('0x8'))(new Redis(config[_0x32ed('0x5')]));var def={'method':'POST','json':!![]};function emit(_0x17ca71,_0x933fb7,_0x4ed90a){io['to'](_0x17ca71)['emit'](_0x933fb7,_0x4ed90a);}function getTicket(_0x21ebb0,_0x256df1,_0x5178b5,_0x226b83,_0xc75f70,_0x58e792,_0x1f9c17,_0x2794b3){logger[_0x32ed('0x9')]('Creating\x20new\x20ticket...');var _0x550fe8=new Date();var _0x183a4f=[{'name':_0x32ed('0xa'),'value':intUtil['getString'](_0x226b83[_0x32ed('0xb')],_0xc75f70,'\x20')},{'name':_0x32ed('0xc'),'value':_0x256df1['id']},{'name':_0x32ed('0xd'),'value':_0x256df1['id']},{'name':_0x32ed('0xe'),'value':intUtil[_0x32ed('0xf')](_0x226b83[_0x32ed('0x10')],_0xc75f70,'\x0a')},{'name':'date_start','value':_0x550fe8[_0x32ed('0x11')]()[_0x32ed('0x12')](0x0,0x13)[_0x32ed('0x13')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x5178b5['id']},{'name':_0x32ed('0x14'),'value':'Contacts'},{'name':_0x32ed('0x15'),'value':_0x5178b5['name']},{'name':_0x32ed('0x16'),'value':_0x2794b3}];if(_0x58e792['length']){_[_0x32ed('0x17')](_0x58e792,function(_0x247aff){if(_0xc75f70[_0x247aff['variableName']]){_0x183a4f['push']({'name':_0x247aff[_0x32ed('0x18')],'value':_0xc75f70[_0x247aff[_0x32ed('0x19')]]});}});}return request({'form':{'method':_0x32ed('0x1a'),'input_type':'JSON','response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x1f9c17['id'],'module_name':'Calls','name_value_list':_0x183a4f})}});}function getAuth(_0x5f02f3){return util[_0x32ed('0x1d')](_0x32ed('0x1e'),new Buffer(_0x5f02f3[_0x32ed('0x1f')]+':X')['toString']('base64'));}function getServerInfo(_0x53d0e5){return request({'form':{'method':'get_server_info','input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x53d0e5['id']})}});}function getUser(_0x2c48e5,_0x5e6d17,_0x521712){if(!_[_0x32ed('0x20')](_0x5e6d17)){logger['info'](_0x32ed('0x21'),_0x5e6d17);return request({'form':{'method':_0x32ed('0x22'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x521712['id'],'module_name':'Employees','query':util[_0x32ed('0x1d')](_0x32ed('0x23'),_0x5e6d17),'order_by':'','offset':'0','select_fields':['id',_0x32ed('0xa'),_0x32ed('0x24')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32ed('0x25')](function(_0x35a068){if(_0x35a068[_0x32ed('0x26')][_0x32ed('0x27')]){var _0xf58d5a=_['find'](_0x35a068[_0x32ed('0x26')],function(_0x5478ad){return _0x5478ad[_0x32ed('0x28')][_0x32ed('0x24')][_0x32ed('0x29')]===_0x5e6d17;});if(_0xf58d5a){logger[_0x32ed('0x9')](_0x32ed('0x2a'));return BPromise[_0x32ed('0x2b')]({'id':_0xf58d5a[_0x32ed('0x28')]['id'][_0x32ed('0x29')],'name':_0xf58d5a[_0x32ed('0x28')][_0x32ed('0xa')]['value']});}}logger[_0x32ed('0x9')](_0x32ed('0x2c'));return BPromise[_0x32ed('0x2b')]({'id':_0x521712[_0x32ed('0x28')][_0x32ed('0x2d')]['value'],'name':_0x521712['name_value_list']['user_name']['value']});});}else{logger[_0x32ed('0x9')](_0x32ed('0x2e'));return BPromise[_0x32ed('0x2b')]({'id':_0x521712[_0x32ed('0x28')][_0x32ed('0x2d')]['value'],'name':_0x521712['name_value_list'][_0x32ed('0x24')][_0x32ed('0x29')]});}}function getEndUser(_0x9a18b2,_0x754edf,_0x5725f3,_0x65593f){logger[_0x32ed('0x9')](_0x32ed('0x2f'),_0x5725f3);return request({'form':{'method':_0x32ed('0x22'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x65593f['id'],'module_name':_0x32ed('0x30'),'query':util['format'](_0x32ed('0x31'),_0x5725f3),'order_by':'','offset':'0','select_fields':['id','name',_0x32ed('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x32ed('0x25')](function(_0x3287df){if(_0x3287df[_0x32ed('0x26')][_0x32ed('0x27')]){var _0x5a60b1=_['find'](_0x3287df['entry_list'],function(_0x8144d6){return _0x8144d6[_0x32ed('0x28')]['phone_home'][_0x32ed('0x29')]===_0x5725f3;});if(_0x5a60b1){logger[_0x32ed('0x9')](_0x32ed('0x33'));return BPromise[_0x32ed('0x2b')]({'id':_0x5a60b1[_0x32ed('0x28')]['id']['value'],'name':_0x5a60b1[_0x32ed('0x28')][_0x32ed('0xa')][_0x32ed('0x29')],'phone':_0x5a60b1[_0x32ed('0x28')][_0x32ed('0x32')][_0x32ed('0x29')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x32ed('0x1a'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON['stringify']({'session':_0x65593f['id'],'module_name':_0x32ed('0x30'),'name_value_list':[{'name':_0x32ed('0x34'),'value':_0x754edf!==_0x32ed('0x35')?_0x754edf:util[_0x32ed('0x1d')](_0x32ed('0x36'),_0x5725f3)},{'name':_0x32ed('0x32'),'value':_0x5725f3}]})}})[_0x32ed('0x25')](function(_0x52c747){logger[_0x32ed('0x9')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x52c747['id'],'name':_0x52c747[_0x32ed('0x26')][_0x32ed('0x34')][_0x32ed('0x29')],'phone':_0x52c747[_0x32ed('0x26')][_0x32ed('0x32')]['value']});});}});}function request(_0x21986e){logger[_0x32ed('0x37')](_0x32ed('0x38'),JSON[_0x32ed('0x1c')](_0x21986e));return rp(_[_0x32ed('0x39')](def,_0x21986e));}function getTags(_0x1c4cad,_0x240853){var _0x1fec3f=[];if(_0x1c4cad&&_0x1c4cad[_0x32ed('0x27')]>0x0){_0x1fec3f=_[_0x32ed('0x3a')](_0x1c4cad,_0x240853);}return _0x1fec3f;}function getCustomFields(_0x41db96,_0x37bdc1){var _0x23233a=[];var _0x4f693f={'custom_fields':[]};if(_0x41db96['length']>0x0){_[_0x32ed('0x17')](_0x41db96,function(_0x1c4fca){if(_0x1c4fca['type']===_0x32ed('0x3b')&&_0x1c4fca['nameField']&&!_0x1c4fca[_0x32ed('0x3c')]){_0x4f693f[_0x1c4fca['nameField'][_0x32ed('0x3d')]()]=_0x1c4fca['content']['toString']();}else if(_0x1c4fca['type']===_0x32ed('0x3b')&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x4f693f[_0x32ed('0x3e')][_0x32ed('0x3f')]({'id':_0x1c4fca['idField'],'value':_0x1c4fca[_0x32ed('0x40')][_0x32ed('0x41')]()});}else if(_0x1c4fca[_0x32ed('0x42')]===_0x32ed('0x43')&&_0x1c4fca[_0x32ed('0x19')]&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x37bdc1[_0x1c4fca[_0x32ed('0x19')]]&&_0x4f693f['custom_fields']['push']({'id':_0x1c4fca['idField'],'value':_0x37bdc1[_0x1c4fca[_0x32ed('0x19')]][_0x32ed('0x41')]()});}else if(_0x1c4fca[_0x32ed('0x42')]===_0x32ed('0x44')&&_0x1c4fca[_0x32ed('0x45')]&&_0x1c4fca[_0x32ed('0x45')]['name']&&_0x1c4fca[_0x32ed('0x18')]&&_0x1c4fca[_0x32ed('0x3c')]){_0x37bdc1[_0x1c4fca[_0x32ed('0x45')]['name']['toLowerCase']()]&&_0x4f693f[_0x32ed('0x3e')]['push']({'id':_0x1c4fca['idField'],'value':_0x37bdc1[_0x1c4fca[_0x32ed('0x45')]['name'][_0x32ed('0x3d')]()][_0x32ed('0x41')]()});}});}return _0x4f693f;}function getConnection(_0x8a74fb){return request({'method':_0x32ed('0x46'),'form':{'method':_0x32ed('0x47'),'input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'user_auth':{'user_name':_0x8a74fb[_0x32ed('0x48')],'password':_0x8a74fb[_0x32ed('0x49')],'encryption':_0x32ed('0x4a')},'application':_0x32ed('0x4b')})}})[_0x32ed('0x25')](function(_0x3b5724){var _0x40bbd7=_0x3b5724;if(_0x40bbd7['id']){def['sessionID']=_0x40bbd7['id'];return BPromise[_0x32ed('0x2b')](_0x40bbd7);}else{throw new Error(util[_0x32ed('0x1d')](_0x32ed('0x4c'),_0x8a74fb['id']));}});}function setRelationship(_0x2f3394,_0x298c4d,_0x53bb1b,_0x4746be){return request({'form':{'method':'set_relationship','input_type':_0x32ed('0x1b'),'response_type':_0x32ed('0x1b'),'rest_data':JSON[_0x32ed('0x1c')]({'session':_0x2f3394['id'],'module_name':'Calls','module_id':_0x53bb1b['id'],'link_field_name':_0x4746be,'related_ids':[_0x298c4d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x32ed('0x4d')]=function(_0x550ed1,_0x2e0842,_0x5f166b,_0x5570fb,_0x333b6b,_0x203e78){var _0x55ac66,_0xf919fe,_0x439712,_0x30865b;_0x203e78[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x203e78[_0x32ed('0x4e')]);_0x203e78['serverUrl']=intUtil[_0x32ed('0x4f')](_0x203e78[_0x32ed('0x50')]);def['uri']=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x203e78['remoteUri']);if(_0x333b6b&&_0x333b6b[_0x32ed('0x52')]){logger[_0x32ed('0x9')](_0x32ed('0x53'),'Recording\x20is\x20enabled!');_0x2e0842[_0x32ed('0x54')]=util[_0x32ed('0x1d')](_0x32ed('0x55'),_0x203e78[_0x32ed('0x50')],_0x2e0842[_0x32ed('0x56')],md5(_0x2e0842['uniqueid']));}else{_0x2e0842[_0x32ed('0x54')]='';}return getConnection(_0x203e78)['then'](function(_0x3a7d34){_0x30865b=_0x3a7d34;return getUser(_0x203e78,_0x5570fb['name'],_0x30865b);})[_0x32ed('0x25')](function(_0x3b3a97){_0x55ac66=_0x3b3a97;logger[_0x32ed('0x9')](_0x32ed('0x57'),_0x55ac66['id']);return getEndUser(_0x203e78,_0x2e0842[_0x32ed('0x58')],_0x2e0842[_0x32ed('0x59')],_0x30865b);})[_0x32ed('0x25')](function(_0x525bb2){_0xf919fe=_0x525bb2;logger[_0x32ed('0x9')](_0x32ed('0x5a'),_0xf919fe['id']);return getTicket(_0x203e78,_0x55ac66,_0xf919fe,_0x5f166b,_0x2e0842,_0x5f166b['Fields'],_0x30865b,_0x32ed('0x5b'));})[_0x32ed('0x25')](function(_0x3598f2){_0x439712=_0x3598f2;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x439712['id']);return setRelationship(_0x30865b,_0x55ac66,_0x439712,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x30865b,_0xf919fe,_0x439712,_0x32ed('0x5f'));})[_0x32ed('0x25')](function(){return getServerInfo(_0x30865b);})['then'](function(_0x30965a){var _0x4861d5=parseInt(_0x30965a[_0x32ed('0x60')][_0x32ed('0x61')](0x0));var _0x31e07b=util[_0x32ed('0x1d')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x203e78[_0x32ed('0x4e')],_0x439712['id']);if(_0x4861d5>0x6){_0x31e07b=util[_0x32ed('0x1d')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x203e78['remoteUri'],_0x439712['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x32ed('0x1d')](_0x32ed('0x62'),_0x5570fb[_0x32ed('0xa')]),_0x32ed('0x63'),{'uri':_0x31e07b});})['catch'](function(_0x11e3ad){logger[_0x32ed('0x64')]('[QUEUE]',JSON['stringify'](_0x11e3ad));});};exports[_0x32ed('0x65')]=function(_0x11551d,_0x59325f,_0x4fa75e,_0x4b7f36,_0x4ad0af,_0x26f3a0,_0x313c3e){var _0x4b0965,_0x26c613,_0x511c77,_0x5f4405;_0x26f3a0[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x26f3a0[_0x32ed('0x4e')]);_0x26f3a0[_0x32ed('0x50')]=intUtil[_0x32ed('0x4f')](_0x26f3a0[_0x32ed('0x50')]);def['uri']=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x26f3a0[_0x32ed('0x4e')]);if(_0x313c3e&&_0x313c3e['recordingFormat']&&_0x313c3e[_0x32ed('0x66')]!==_0x32ed('0x67')){logger['info'](_0x32ed('0x68'),_0x32ed('0x69'));_0x59325f[_0x32ed('0x54')]=util['format'](_0x32ed('0x55'),_0x26f3a0[_0x32ed('0x50')],_0x59325f[_0x32ed('0x56')],md5(_0x59325f[_0x32ed('0x56')]));}return getConnection(_0x26f3a0)[_0x32ed('0x25')](function(_0x1900b7){_0x5f4405=_0x1900b7;return getUser(_0x26f3a0,_0x4b7f36[_0x32ed('0xa')],_0x5f4405);})['then'](function(_0x2eb70a){_0x4b0965=_0x2eb70a;logger[_0x32ed('0x9')](_0x32ed('0x57'),_0x4b0965['id']);return getEndUser(_0x26f3a0,_0x59325f[_0x32ed('0x6a')],_0x59325f[_0x32ed('0x6b')],_0x5f4405);})[_0x32ed('0x25')](function(_0x25956d){_0x26c613=_0x25956d;logger[_0x32ed('0x9')](_0x32ed('0x5a'),_0x26c613['id']);return getTicket(_0x26f3a0,_0x4b0965,_0x26c613,_0x4fa75e,_0x59325f,_0x4fa75e[_0x32ed('0x6c')],_0x5f4405,'Outbound');})[_0x32ed('0x25')](function(_0x32df2b){_0x511c77=_0x32df2b;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x511c77['id']);return setRelationship(_0x5f4405,_0x4b0965,_0x511c77,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x5f4405,_0x26c613,_0x511c77,_0x32ed('0x5f'));})['then'](function(){return getServerInfo(_0x5f4405);})[_0x32ed('0x25')](function(_0x717935){var _0x5b671c=parseInt(_0x717935[_0x32ed('0x60')]['charAt'](0x0));var _0x53141d=util[_0x32ed('0x1d')](_0x32ed('0x6d'),_0x26f3a0[_0x32ed('0x4e')],_0x511c77['id']);if(_0x5b671c>0x6){_0x53141d=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x26f3a0['remoteUri'],_0x511c77['id']);}logger[_0x32ed('0x9')](_0x32ed('0x68'),_0x32ed('0x6e'));emit(util[_0x32ed('0x1d')](_0x32ed('0x62'),_0x4b7f36[_0x32ed('0xa')]),_0x32ed('0x63'),{'uri':_0x53141d});})[_0x32ed('0x6f')](function(_0xd1cf0){logger[_0x32ed('0x64')](_0x32ed('0x68'),JSON[_0x32ed('0x1c')](_0xd1cf0));});};exports[_0x32ed('0x70')]=function(_0x12e04e,_0x4d2c2e,_0x4648d7,_0x497c8e,_0x56c271,_0x1c2586){var _0x9884c,_0x2faff5,_0x4c0aad,_0x45b72a;_0x1c2586[_0x32ed('0x4e')]=intUtil[_0x32ed('0x4f')](_0x1c2586['remoteUri']);_0x1c2586[_0x32ed('0x50')]=intUtil[_0x32ed('0x4f')](_0x1c2586['serverUrl']);def[_0x32ed('0x71')]=util[_0x32ed('0x1d')](_0x32ed('0x51'),_0x1c2586[_0x32ed('0x4e')]);if(_0x56c271&&_0x56c271[_0x32ed('0x52')]){logger[_0x32ed('0x9')]('['+_0x4d2c2e[_0x32ed('0x72')][_0x32ed('0x73')]()+']','Recording\x20is\x20enabled!');_0x4d2c2e[_0x32ed('0x54')]=util['format'](_0x32ed('0x55'),_0x1c2586['serverUrl'],_0x4d2c2e['uniqueid'],md5(_0x4d2c2e[_0x32ed('0x56')]));}else{_0x4d2c2e[_0x32ed('0x54')]='';}return getConnection(_0x1c2586)['then'](function(_0x5d6b4c){_0x45b72a=_0x5d6b4c;if(!_[_0x32ed('0x20')](_0x497c8e)){return getUser(_0x1c2586,_0x497c8e['name'],_0x45b72a);}else{return getUser(_0x1c2586,null,_0x45b72a);}})[_0x32ed('0x25')](function(_0x2d31ba){_0x9884c=_0x2d31ba;logger['info'](_0x32ed('0x57'),_0x9884c['id']);return getEndUser(_0x1c2586,_0x4d2c2e[_0x32ed('0x58')],_0x4d2c2e['calleridnum'],_0x45b72a);})['then'](function(_0x84341a){_0x2faff5=_0x84341a;logger[_0x32ed('0x9')]('The\x20Enduser\x20ID\x20is:',_0x2faff5['id']);return getTicket(_0x1c2586,_0x9884c,_0x2faff5,_0x4648d7,_0x4d2c2e,_0x4648d7[_0x32ed('0x6c')],_0x45b72a,_0x32ed('0x5b'));})[_0x32ed('0x25')](function(_0x7f4794){_0x4c0aad=_0x7f4794;logger[_0x32ed('0x9')](_0x32ed('0x5c'));logger[_0x32ed('0x9')](_0x32ed('0x5d'),_0x4c0aad['id']);return setRelationship(_0x45b72a,_0x9884c,_0x4c0aad,_0x32ed('0x5e'));})[_0x32ed('0x25')](function(){return setRelationship(_0x45b72a,_0x2faff5,_0x4c0aad,_0x32ed('0x5f'));})['then'](function(){return getServerInfo(_0x45b72a);})[_0x32ed('0x6f')](function(_0xa5566){logger[_0x32ed('0x64')]('['+_0x4d2c2e[_0x32ed('0x72')]['toUpperCase']()+']',JSON[_0x32ed('0x1c')](_0xa5566));});}; \ No newline at end of file +var _0xc79d=['Enduser\x20created.','debug','[HTTP]','merge','map','forEach','nameField','customField','content','type','string','custom_fields','variable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','version','trigger:browser:url','unmanaged','Inbound','error','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','created_by','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','format','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s'];(function(_0x49d4c7,_0x21c588){var _0x416eb3=function(_0x12c7a5){while(--_0x12c7a5){_0x49d4c7['push'](_0x49d4c7['shift']());}};_0x416eb3(++_0x21c588);}(_0xc79d,0xaf));var _0xdc79=function(_0x1631c3,_0x3ab009){_0x1631c3=_0x1631c3-0x0;var _0x2ed290=_0xc79d[_0x1631c3];return _0x2ed290;};'use strict';var _=require(_0xdc79('0x0'));var rp=require(_0xdc79('0x1'));var BPromise=require('bluebird');var md5=require(_0xdc79('0x2'));var util=require(_0xdc79('0x3'));var Redis=require(_0xdc79('0x4'));var intUtil=require(_0xdc79('0x5'));var config=require(_0xdc79('0x6'));var logger=require(_0xdc79('0x7'))(_0xdc79('0x8'));config['redis']=_[_0xdc79('0x9')](config[_0xdc79('0xa')],{'host':_0xdc79('0xb'),'port':0x18eb});var io=require(_0xdc79('0xc'))(new Redis(config[_0xdc79('0xa')]));var def={'method':_0xdc79('0xd'),'json':!![]};function emit(_0x3a6b04,_0x256a6f,_0x3587d2){io['to'](_0x3a6b04)['emit'](_0x256a6f,_0x3587d2);}function getTicket(_0x552a20,_0x506334,_0x39f616,_0x44e2af,_0x1b6626,_0x4e40f8,_0x40834e,_0x123333){logger[_0xdc79('0xe')]('Creating\x20new\x20ticket...');var _0x4b9038=new Date();var _0x53714d=[{'name':_0xdc79('0xf'),'value':intUtil[_0xdc79('0x10')](_0x44e2af[_0xdc79('0x11')],_0x1b6626,'\x20')},{'name':'assigned_user_id','value':_0x506334['id']},{'name':_0xdc79('0x12'),'value':_0x506334['id']},{'name':'description','value':intUtil['getString'](_0x44e2af[_0xdc79('0x13')],_0x1b6626,'\x0a')},{'name':_0xdc79('0x14'),'value':_0x4b9038['toISOString']()[_0xdc79('0x15')](0x0,0x13)[_0xdc79('0x16')]('T','\x20')},{'name':_0xdc79('0x17'),'value':'0'},{'name':_0xdc79('0x18'),'value':'15'},{'name':_0xdc79('0x19'),'value':_0x39f616['id']},{'name':_0xdc79('0x1a'),'value':_0xdc79('0x1b')},{'name':'parent_name','value':_0x39f616[_0xdc79('0xf')]},{'name':_0xdc79('0x1c'),'value':_0x123333}];if(_0x4e40f8[_0xdc79('0x1d')]){_['forEach'](_0x4e40f8,function(_0x2f2a7c){if(_0x1b6626[_0x2f2a7c[_0xdc79('0x1e')]]){_0x53714d[_0xdc79('0x1f')]({'name':_0x2f2a7c[_0xdc79('0x20')],'value':_0x1b6626[_0x2f2a7c['variableName']]});}});}return request({'form':{'method':_0xdc79('0x21'),'input_type':_0xdc79('0x22'),'response_type':_0xdc79('0x22'),'rest_data':JSON[_0xdc79('0x23')]({'session':_0x40834e['id'],'module_name':_0xdc79('0x24'),'name_value_list':_0x53714d})}});}function getAuth(_0x21f874){return util['format'](_0xdc79('0x25'),new Buffer(_0x21f874[_0xdc79('0x26')]+':X')[_0xdc79('0x27')]('base64'));}function getServerInfo(_0x3c48a2){return request({'form':{'method':_0xdc79('0x28'),'input_type':_0xdc79('0x22'),'response_type':_0xdc79('0x22'),'rest_data':JSON[_0xdc79('0x23')]({'session':_0x3c48a2['id']})}});}function getUser(_0x2f2d2a,_0x11f327,_0x12a54b){if(!_[_0xdc79('0x29')](_0x11f327)){logger[_0xdc79('0xe')](_0xdc79('0x2a'),_0x11f327);return request({'form':{'method':'get_entry_list','input_type':_0xdc79('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x12a54b['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x11f327),'order_by':'','offset':'0','select_fields':['id','name',_0xdc79('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdc79('0x2c')](function(_0x5994dc){if(_0x5994dc[_0xdc79('0x2d')][_0xdc79('0x1d')]){var _0x5753f9=_[_0xdc79('0x2e')](_0x5994dc[_0xdc79('0x2d')],function(_0x232730){return _0x232730[_0xdc79('0x2f')]['user_name']['value']===_0x11f327;});if(_0x5753f9){logger[_0xdc79('0xe')](_0xdc79('0x30'));return BPromise[_0xdc79('0x31')]({'id':_0x5753f9[_0xdc79('0x2f')]['id'][_0xdc79('0x32')],'name':_0x5753f9['name_value_list'][_0xdc79('0xf')][_0xdc79('0x32')]});}}logger[_0xdc79('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x12a54b[_0xdc79('0x2f')][_0xdc79('0x33')][_0xdc79('0x32')],'name':_0x12a54b[_0xdc79('0x2f')][_0xdc79('0x2b')][_0xdc79('0x32')]});});}else{logger[_0xdc79('0xe')](_0xdc79('0x34'));return BPromise[_0xdc79('0x31')]({'id':_0x12a54b[_0xdc79('0x2f')][_0xdc79('0x33')][_0xdc79('0x32')],'name':_0x12a54b['name_value_list'][_0xdc79('0x2b')][_0xdc79('0x32')]});}}function getEndUser(_0x504a62,_0x18daf6,_0x1abbe8,_0x41c6f0){logger['info'](_0xdc79('0x35'),_0x1abbe8);return request({'form':{'method':'get_entry_list','input_type':_0xdc79('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x41c6f0['id'],'module_name':'Contacts','query':util[_0xdc79('0x36')](_0xdc79('0x37'),_0x1abbe8),'order_by':'','offset':'0','select_fields':['id',_0xdc79('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xdc79('0x2c')](function(_0x514d86){if(_0x514d86[_0xdc79('0x2d')][_0xdc79('0x1d')]){var _0x3262e0=_[_0xdc79('0x2e')](_0x514d86['entry_list'],function(_0x4558a5){return _0x4558a5['name_value_list'][_0xdc79('0x38')][_0xdc79('0x32')]===_0x1abbe8;});if(_0x3262e0){logger[_0xdc79('0xe')](_0xdc79('0x39'));return BPromise[_0xdc79('0x31')]({'id':_0x3262e0[_0xdc79('0x2f')]['id']['value'],'name':_0x3262e0['name_value_list'][_0xdc79('0xf')][_0xdc79('0x32')],'phone':_0x3262e0[_0xdc79('0x2f')][_0xdc79('0x38')][_0xdc79('0x32')]});}}else{logger[_0xdc79('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xdc79('0x22'),'response_type':_0xdc79('0x22'),'rest_data':JSON['stringify']({'session':_0x41c6f0['id'],'module_name':_0xdc79('0x1b'),'name_value_list':[{'name':_0xdc79('0x3a'),'value':_0x18daf6!==_0xdc79('0x3b')?_0x18daf6:util[_0xdc79('0x36')](_0xdc79('0x3c'),_0x1abbe8)},{'name':_0xdc79('0x38'),'value':_0x1abbe8}]})}})[_0xdc79('0x2c')](function(_0xc44cf2){logger['info'](_0xdc79('0x3d'));return BPromise['resolve']({'id':_0xc44cf2['id'],'name':_0xc44cf2['entry_list'][_0xdc79('0x3a')][_0xdc79('0x32')],'phone':_0xc44cf2[_0xdc79('0x2d')][_0xdc79('0x38')][_0xdc79('0x32')]});});}});}function request(_0x168a1c){logger[_0xdc79('0x3e')](_0xdc79('0x3f'),JSON[_0xdc79('0x23')](_0x168a1c));return rp(_[_0xdc79('0x40')](def,_0x168a1c));}function getTags(_0x2dd320,_0x3bf9f8){var _0x1ecb49=[];if(_0x2dd320&&_0x2dd320['length']>0x0){_0x1ecb49=_[_0xdc79('0x41')](_0x2dd320,_0x3bf9f8);}return _0x1ecb49;}function getCustomFields(_0x330ef8,_0x5345e5){var _0x4fd895=[];var _0x2a170b={'custom_fields':[]};if(_0x330ef8[_0xdc79('0x1d')]>0x0){_[_0xdc79('0x42')](_0x330ef8,function(_0x376324){if(_0x376324['type']==='string'&&_0x376324[_0xdc79('0x43')]&&!_0x376324[_0xdc79('0x44')]){_0x2a170b[_0x376324[_0xdc79('0x43')]['toLowerCase']()]=_0x376324[_0xdc79('0x45')][_0xdc79('0x27')]();}else if(_0x376324[_0xdc79('0x46')]===_0xdc79('0x47')&&_0x376324['idField']&&_0x376324[_0xdc79('0x44')]){_0x2a170b[_0xdc79('0x48')][_0xdc79('0x1f')]({'id':_0x376324['idField'],'value':_0x376324['content'][_0xdc79('0x27')]()});}else if(_0x376324[_0xdc79('0x46')]===_0xdc79('0x49')&&_0x376324[_0xdc79('0x1e')]&&_0x376324[_0xdc79('0x20')]&&_0x376324[_0xdc79('0x44')]){_0x5345e5[_0x376324[_0xdc79('0x1e')]]&&_0x2a170b[_0xdc79('0x48')][_0xdc79('0x1f')]({'id':_0x376324[_0xdc79('0x20')],'value':_0x5345e5[_0x376324['variableName']]['toString']()});}else if(_0x376324[_0xdc79('0x46')]==='customVariable'&&_0x376324[_0xdc79('0x4a')]&&_0x376324[_0xdc79('0x4a')]['name']&&_0x376324[_0xdc79('0x20')]&&_0x376324['customField']){_0x5345e5[_0x376324[_0xdc79('0x4a')]['name'][_0xdc79('0x4b')]()]&&_0x2a170b['custom_fields'][_0xdc79('0x1f')]({'id':_0x376324[_0xdc79('0x20')],'value':_0x5345e5[_0x376324[_0xdc79('0x4a')][_0xdc79('0xf')][_0xdc79('0x4b')]()][_0xdc79('0x27')]()});}});}return _0x2a170b;}function getConnection(_0x159a11){return request({'method':_0xdc79('0xd'),'form':{'method':_0xdc79('0x4c'),'input_type':_0xdc79('0x22'),'response_type':'JSON','rest_data':JSON[_0xdc79('0x23')]({'user_auth':{'user_name':_0x159a11['username'],'password':_0x159a11[_0xdc79('0x4d')],'encryption':_0xdc79('0x4e')},'application':_0xdc79('0x4f')})}})[_0xdc79('0x2c')](function(_0x1b0fe2){var _0x4040aa=_0x1b0fe2;if(_0x4040aa['id']){def[_0xdc79('0x50')]=_0x4040aa['id'];return BPromise[_0xdc79('0x31')](_0x4040aa);}else{throw new Error(util[_0xdc79('0x36')](_0xdc79('0x51'),_0x159a11['id']));}});}function setRelationship(_0x2b8f98,_0x16047e,_0x51f1f7,_0x15e492){return request({'form':{'method':_0xdc79('0x52'),'input_type':'JSON','response_type':_0xdc79('0x22'),'rest_data':JSON[_0xdc79('0x23')]({'session':_0x2b8f98['id'],'module_name':_0xdc79('0x24'),'module_id':_0x51f1f7['id'],'link_field_name':_0x15e492,'related_ids':[_0x16047e['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x41b88a,_0x165feb,_0x456292,_0x3f3a6c,_0x1f197a,_0x16235e){var _0x5025c4,_0x515f46,_0x45be03,_0x2acc43;_0x16235e[_0xdc79('0x53')]=intUtil[_0xdc79('0x54')](_0x16235e['remoteUri']);_0x16235e['serverUrl']=intUtil[_0xdc79('0x54')](_0x16235e[_0xdc79('0x55')]);def[_0xdc79('0x56')]=util[_0xdc79('0x36')](_0xdc79('0x57'),_0x16235e['remoteUri']);if(_0x1f197a&&_0x1f197a[_0xdc79('0x58')]){logger[_0xdc79('0xe')](_0xdc79('0x59'),_0xdc79('0x5a'));_0x165feb['recordingURL']=util['format'](_0xdc79('0x5b'),_0x16235e[_0xdc79('0x55')],_0x165feb[_0xdc79('0x5c')],md5(_0x165feb['uniqueid']));}else{_0x165feb[_0xdc79('0x5d')]='';}return getConnection(_0x16235e)[_0xdc79('0x2c')](function(_0x219d4f){_0x2acc43=_0x219d4f;return getUser(_0x16235e,_0x3f3a6c[_0xdc79('0xf')],_0x2acc43);})['then'](function(_0x577829){_0x5025c4=_0x577829;logger[_0xdc79('0xe')](_0xdc79('0x5e'),_0x5025c4['id']);return getEndUser(_0x16235e,_0x165feb[_0xdc79('0x5f')],_0x165feb['calleridnum'],_0x2acc43);})[_0xdc79('0x2c')](function(_0x7d72d9){_0x515f46=_0x7d72d9;logger[_0xdc79('0xe')](_0xdc79('0x60'),_0x515f46['id']);return getTicket(_0x16235e,_0x5025c4,_0x515f46,_0x456292,_0x165feb,_0x456292['Fields'],_0x2acc43,'Inbound');})[_0xdc79('0x2c')](function(_0x3ad7a1){_0x45be03=_0x3ad7a1;logger[_0xdc79('0xe')](_0xdc79('0x61'));logger[_0xdc79('0xe')](_0xdc79('0x62'),_0x45be03['id']);return setRelationship(_0x2acc43,_0x5025c4,_0x45be03,_0xdc79('0x63'));})[_0xdc79('0x2c')](function(){return setRelationship(_0x2acc43,_0x515f46,_0x45be03,_0xdc79('0x64'));})[_0xdc79('0x2c')](function(){return getServerInfo(_0x2acc43);})[_0xdc79('0x2c')](function(_0x228a28){var _0x354b00=parseInt(_0x228a28['version'][_0xdc79('0x65')](0x0));var _0x320963=util[_0xdc79('0x36')](_0xdc79('0x66'),_0x16235e[_0xdc79('0x53')],_0x45be03['id']);if(_0x354b00>0x6){_0x320963=util[_0xdc79('0x36')](_0xdc79('0x67'),_0x16235e[_0xdc79('0x53')],_0x45be03['id']);}logger[_0xdc79('0xe')]('[QUEUE]',_0xdc79('0x68'));emit(util['format'](_0xdc79('0x69'),_0x3f3a6c['name']),'trigger:browser:url',{'uri':_0x320963});})[_0xdc79('0x6a')](function(_0x1a7aad){logger['error']('[QUEUE]',JSON[_0xdc79('0x23')](_0x1a7aad));});};exports['outbound']=function(_0xcf398d,_0x1fcef4,_0x20e77f,_0x1755e0,_0x5daa06,_0x1f1b83,_0x38048c){var _0xf9b54b,_0x54e51f,_0x5cbd88,_0x145680;_0x1f1b83[_0xdc79('0x53')]=intUtil['stripTrailingSlash'](_0x1f1b83[_0xdc79('0x53')]);_0x1f1b83[_0xdc79('0x55')]=intUtil[_0xdc79('0x54')](_0x1f1b83[_0xdc79('0x55')]);def[_0xdc79('0x56')]=util[_0xdc79('0x36')]('%s/service/v4_1/rest.php',_0x1f1b83[_0xdc79('0x53')]);if(_0x38048c&&_0x38048c[_0xdc79('0x6b')]&&_0x38048c[_0xdc79('0x6b')]!==_0xdc79('0x6c')){logger[_0xdc79('0xe')](_0xdc79('0x6d'),_0xdc79('0x5a'));_0x1fcef4['recordingURL']=util['format'](_0xdc79('0x5b'),_0x1f1b83[_0xdc79('0x55')],_0x1fcef4[_0xdc79('0x5c')],md5(_0x1fcef4[_0xdc79('0x5c')]));}return getConnection(_0x1f1b83)[_0xdc79('0x2c')](function(_0x3d5b1a){_0x145680=_0x3d5b1a;return getUser(_0x1f1b83,_0x1755e0[_0xdc79('0xf')],_0x145680);})['then'](function(_0xa30e5b){_0xf9b54b=_0xa30e5b;logger[_0xdc79('0xe')](_0xdc79('0x5e'),_0xf9b54b['id']);return getEndUser(_0x1f1b83,_0x1fcef4['destcalleridname'],_0x1fcef4[_0xdc79('0x6e')],_0x145680);})[_0xdc79('0x2c')](function(_0x1290e6){_0x54e51f=_0x1290e6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x54e51f['id']);return getTicket(_0x1f1b83,_0xf9b54b,_0x54e51f,_0x20e77f,_0x1fcef4,_0x20e77f[_0xdc79('0x6f')],_0x145680,'Outbound');})['then'](function(_0x1f7180){_0x5cbd88=_0x1f7180;logger[_0xdc79('0xe')](_0xdc79('0x61'));logger[_0xdc79('0xe')](_0xdc79('0x62'),_0x5cbd88['id']);return setRelationship(_0x145680,_0xf9b54b,_0x5cbd88,'users');})['then'](function(){return setRelationship(_0x145680,_0x54e51f,_0x5cbd88,_0xdc79('0x64'));})['then'](function(){return getServerInfo(_0x145680);})['then'](function(_0xc977db){var _0x1758cc=parseInt(_0xc977db[_0xdc79('0x70')][_0xdc79('0x65')](0x0));var _0x58ca33=util[_0xdc79('0x36')](_0xdc79('0x66'),_0x1f1b83[_0xdc79('0x53')],_0x5cbd88['id']);if(_0x1758cc>0x6){_0x58ca33=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1f1b83[_0xdc79('0x53')],_0x5cbd88['id']);}logger[_0xdc79('0xe')](_0xdc79('0x6d'),_0xdc79('0x68'));emit(util['format']('user:%s',_0x1755e0[_0xdc79('0xf')]),_0xdc79('0x71'),{'uri':_0x58ca33});})[_0xdc79('0x6a')](function(_0x4d6329){logger['error'](_0xdc79('0x6d'),JSON[_0xdc79('0x23')](_0x4d6329));});};exports[_0xdc79('0x72')]=function(_0x52d41f,_0x30ce08,_0x2bc3ee,_0x43b391,_0x26d655,_0x220102){var _0x59c6c5,_0x289032,_0x4922f9,_0xf18ebf;_0x220102['remoteUri']=intUtil[_0xdc79('0x54')](_0x220102[_0xdc79('0x53')]);_0x220102[_0xdc79('0x55')]=intUtil[_0xdc79('0x54')](_0x220102[_0xdc79('0x55')]);def[_0xdc79('0x56')]=util['format']('%s/service/v4_1/rest.php',_0x220102['remoteUri']);if(_0x26d655&&_0x26d655[_0xdc79('0x58')]){logger[_0xdc79('0xe')]('['+_0x30ce08['lastevent']['toUpperCase']()+']',_0xdc79('0x5a'));_0x30ce08[_0xdc79('0x5d')]=util[_0xdc79('0x36')](_0xdc79('0x5b'),_0x220102['serverUrl'],_0x30ce08[_0xdc79('0x5c')],md5(_0x30ce08[_0xdc79('0x5c')]));}else{_0x30ce08[_0xdc79('0x5d')]='';}return getConnection(_0x220102)['then'](function(_0x3b85c2){_0xf18ebf=_0x3b85c2;if(!_[_0xdc79('0x29')](_0x43b391)){return getUser(_0x220102,_0x43b391[_0xdc79('0xf')],_0xf18ebf);}else{return getUser(_0x220102,null,_0xf18ebf);}})[_0xdc79('0x2c')](function(_0x3bf019){_0x59c6c5=_0x3bf019;logger[_0xdc79('0xe')]('The\x20User\x20ID\x20is:',_0x59c6c5['id']);return getEndUser(_0x220102,_0x30ce08[_0xdc79('0x5f')],_0x30ce08['calleridnum'],_0xf18ebf);})[_0xdc79('0x2c')](function(_0x544974){_0x289032=_0x544974;logger[_0xdc79('0xe')](_0xdc79('0x60'),_0x289032['id']);return getTicket(_0x220102,_0x59c6c5,_0x289032,_0x2bc3ee,_0x30ce08,_0x2bc3ee['Fields'],_0xf18ebf,_0xdc79('0x73'));})['then'](function(_0x113907){_0x4922f9=_0x113907;logger[_0xdc79('0xe')]('Ticket\x20created!');logger[_0xdc79('0xe')](_0xdc79('0x62'),_0x4922f9['id']);return setRelationship(_0xf18ebf,_0x59c6c5,_0x4922f9,'users');})[_0xdc79('0x2c')](function(){return setRelationship(_0xf18ebf,_0x289032,_0x4922f9,_0xdc79('0x64'));})[_0xdc79('0x2c')](function(){return getServerInfo(_0xf18ebf);})[_0xdc79('0x6a')](function(_0x5d67df){logger[_0xdc79('0x74')]('['+_0x30ce08['lastevent'][_0xdc79('0x75')]()+']',JSON['stringify'](_0x5d67df));});}; \ 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 7a87664..0bcd8e2 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 _0xc1a1=['keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','string','push','content','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase'];(function(_0x4c4272,_0x1baa18){var _0x1b67ea=function(_0x4ae7f1){while(--_0x4ae7f1){_0x4c4272['push'](_0x4c4272['shift']());}};_0x1b67ea(++_0x1baa18);}(_0xc1a1,0x9f));var _0x1c1a=function(_0x652265,_0x21e1bd){_0x652265=_0x652265-0x0;var _0xeb5219=_0xc1a1[_0x652265];return _0xeb5219;};'use strict';var _=require('lodash');var util=require(_0x1c1a('0x0'));exports[_0x1c1a('0x1')]=function(_0x58000a,_0x525b88,_0x102572){var _0x15ffcd=[];if(_0x58000a[_0x1c1a('0x2')]>0x0){var _0x56ce92=_[_0x1c1a('0x3')](_0x58000a,['id']);for(var _0x5a5f7e=0x0;_0x5a5f7e<_0x56ce92[_0x1c1a('0x2')];_0x5a5f7e++){var _0x56f5d7=_0x56ce92[_0x5a5f7e];if(_0x56f5d7['type']===_0x1c1a('0x4')){_0x15ffcd[_0x1c1a('0x5')](_0x56f5d7[_0x1c1a('0x6')]);}else if(_0x56f5d7['type']===_0x1c1a('0x7')&&_0x56f5d7[_0x1c1a('0x8')]){_0x525b88[_0x56f5d7[_0x1c1a('0x8')]]&&_0x15ffcd[_0x1c1a('0x5')](_0x525b88[_0x56f5d7['variableName']][_0x1c1a('0x9')]());}else if(_0x56f5d7[_0x1c1a('0xa')]===_0x1c1a('0xb')&&_0x56f5d7[_0x1c1a('0xc')]&&_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')]){_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]&&_0x15ffcd[_0x1c1a('0x5')](_0x525b88[_0x56f5d7[_0x1c1a('0xc')]['name']['toLowerCase']()][_0x1c1a('0x9')]());}else if(_0x56f5d7[_0x1c1a('0xa')]===_0x1c1a('0xf')){if(_0x56f5d7[_0x1c1a('0x10')]===_0x1c1a('0x4')&&_0x56f5d7['key']){_0x15ffcd[_0x1c1a('0x5')](util[_0x1c1a('0x11')](_0x1c1a('0x12'),_0x56f5d7[_0x1c1a('0x13')],_0x56f5d7[_0x1c1a('0x14')]));}else if(_0x56f5d7['keyType']===_0x1c1a('0x7')&&_0x56f5d7['variableName']&&_0x56f5d7[_0x1c1a('0x13')]){_0x525b88[_0x56f5d7['variableName']]&&_0x15ffcd['push'](util[_0x1c1a('0x11')](_0x1c1a('0x12'),_0x56f5d7['key'],_0x525b88[_0x56f5d7['variableName']]));}else if(_0x56f5d7[_0x1c1a('0x10')]===_0x1c1a('0xb')&&_0x56f5d7[_0x1c1a('0xc')]&&_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')]&&_0x56f5d7[_0x1c1a('0x13')]){_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]&&_0x15ffcd['push'](util[_0x1c1a('0x11')]('%s:\x20%s',_0x56f5d7['key'],_0x525b88[_0x56f5d7[_0x1c1a('0xc')][_0x1c1a('0xd')][_0x1c1a('0xe')]()]));}}}}return _0x15ffcd[_0x1c1a('0x15')](_0x102572);};exports[_0x1c1a('0x16')]=function(_0x23fff6){var _0x5d7703=_0x23fff6[_0x1c1a('0x17')](-0x1);if(_0x5d7703==='/'){_0x23fff6=_0x23fff6[_0x1c1a('0x18')](0x0,_0x23fff6[_0x1c1a('0x19')](_0x5d7703));}return _0x23fff6;};exports[_0x1c1a('0x1a')]=function(_0x400151){if(!_[_0x1c1a('0x1b')](_0x400151)&&_0x400151!==''){var _0x230bae=/^(([^<>()\[\]\\.,;:\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 _0x230bae[_0x1c1a('0x1c')](String(_0x400151)[_0x1c1a('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x29f3=['content','variable','variableName','toString','customVariable','Variable','name','string','format','%s:\x20%s','key','keyContent','keyType','toLowerCase','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','util','length','sortBy','type','push'];(function(_0x4cb779,_0x45a0fb){var _0x22aef2=function(_0x2cfe1c){while(--_0x2cfe1c){_0x4cb779['push'](_0x4cb779['shift']());}};_0x22aef2(++_0x45a0fb);}(_0x29f3,0x1e9));var _0x329f=function(_0x256e63,_0x5e1323){_0x256e63=_0x256e63-0x0;var _0x3b69ea=_0x29f3[_0x256e63];return _0x3b69ea;};'use strict';var _=require('lodash');var util=require(_0x329f('0x0'));exports['getString']=function(_0x4d15fd,_0x495b33,_0x829661){var _0x4f7fb5=[];if(_0x4d15fd[_0x329f('0x1')]>0x0){var _0x1d9a01=_[_0x329f('0x2')](_0x4d15fd,['id']);for(var _0x492da1=0x0;_0x492da1<_0x1d9a01[_0x329f('0x1')];_0x492da1++){var _0x418ff5=_0x1d9a01[_0x492da1];if(_0x418ff5[_0x329f('0x3')]==='string'){_0x4f7fb5[_0x329f('0x4')](_0x418ff5[_0x329f('0x5')]);}else if(_0x418ff5['type']===_0x329f('0x6')&&_0x418ff5[_0x329f('0x7')]){_0x495b33[_0x418ff5[_0x329f('0x7')]]&&_0x4f7fb5[_0x329f('0x4')](_0x495b33[_0x418ff5[_0x329f('0x7')]][_0x329f('0x8')]());}else if(_0x418ff5['type']===_0x329f('0x9')&&_0x418ff5[_0x329f('0xa')]&&_0x418ff5['Variable'][_0x329f('0xb')]){_0x495b33[_0x418ff5['Variable'][_0x329f('0xb')]['toLowerCase']()]&&_0x4f7fb5[_0x329f('0x4')](_0x495b33[_0x418ff5[_0x329f('0xa')]['name']['toLowerCase']()][_0x329f('0x8')]());}else if(_0x418ff5[_0x329f('0x3')]==='keyValue'){if(_0x418ff5['keyType']===_0x329f('0xc')&&_0x418ff5['key']){_0x4f7fb5[_0x329f('0x4')](util[_0x329f('0xd')](_0x329f('0xe'),_0x418ff5[_0x329f('0xf')],_0x418ff5[_0x329f('0x10')]));}else if(_0x418ff5[_0x329f('0x11')]===_0x329f('0x6')&&_0x418ff5[_0x329f('0x7')]&&_0x418ff5['key']){_0x495b33[_0x418ff5[_0x329f('0x7')]]&&_0x4f7fb5[_0x329f('0x4')](util[_0x329f('0xd')](_0x329f('0xe'),_0x418ff5[_0x329f('0xf')],_0x495b33[_0x418ff5[_0x329f('0x7')]]));}else if(_0x418ff5[_0x329f('0x11')]===_0x329f('0x9')&&_0x418ff5[_0x329f('0xa')]&&_0x418ff5[_0x329f('0xa')][_0x329f('0xb')]&&_0x418ff5[_0x329f('0xf')]){_0x495b33[_0x418ff5[_0x329f('0xa')][_0x329f('0xb')][_0x329f('0x12')]()]&&_0x4f7fb5[_0x329f('0x4')](util[_0x329f('0xd')]('%s:\x20%s',_0x418ff5[_0x329f('0xf')],_0x495b33[_0x418ff5[_0x329f('0xa')]['name']['toLowerCase']()]));}}}}return _0x4f7fb5[_0x329f('0x13')](_0x829661);};exports[_0x329f('0x14')]=function(_0x5a00ca){var _0x5935cf=_0x5a00ca[_0x329f('0x15')](-0x1);if(_0x5935cf==='/'){_0x5a00ca=_0x5a00ca[_0x329f('0x16')](0x0,_0x5a00ca[_0x329f('0x17')](_0x5935cf));}return _0x5a00ca;};exports['validateEmail']=function(_0x315199){if(!_[_0x329f('0x18')](_0x315199)&&_0x315199!==''){var _0x2c8763=/^(([^<>()\[\]\\.,;:\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 _0x2c8763[_0x329f('0x19')](String(_0x315199)[_0x329f('0x12')]());}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 14571b2..876a116 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4951b92..b95c451 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 _0xfba4=['/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','[HTTP]','stringify','defaults','GET','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','custom_fields','variable','variableName','idField','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace'];(function(_0x31b35d,_0x89e87c){var _0x36072e=function(_0x597d43){while(--_0x597d43){_0x31b35d['push'](_0x31b35d['shift']());}};_0x36072e(++_0x89e87c);}(_0xfba4,0xf8));var _0x4fba=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xfba4[_0x2ef8f1];return _0x17498d;};'use strict';var _=require('lodash');var rp=require(_0x4fba('0x0'));var md5=require(_0x4fba('0x1'));var util=require(_0x4fba('0x2'));var Redis=require(_0x4fba('0x3'));var intUtil=require(_0x4fba('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4fba('0x5'))(_0x4fba('0x6'));config[_0x4fba('0x7')]=_['defaults'](config['redis'],{'host':_0x4fba('0x8'),'port':0x18eb});var io=require(_0x4fba('0x9'))(new Redis(config[_0x4fba('0x7')]));function emit(_0x47e882,_0x3ec0c9,_0x2dedb6){io['to'](_0x47e882)[_0x4fba('0xa')](_0x3ec0c9,_0x2dedb6);}var headers={'Content-Type':_0x4fba('0xb'),'Accept':_0x4fba('0xb')};function getTicket(_0x2d65bf,_0x38c02d,_0x53094b,_0x5143ec,_0x372446){logger['info'](_0x4fba('0xc'));return request({'uri':util['format'](_0x4fba('0xd'),_0x2d65bf[_0x4fba('0xe')]),'method':_0x4fba('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x53094b['id'],'submitter_id':_0x38c02d?_0x38c02d['id']:undefined,'assignee_id':_0x38c02d?_0x38c02d['id']:undefined,'tags':getTags(_0x5143ec[_0x4fba('0x10')],_0x4fba('0x11')),'subject':intUtil[_0x4fba('0x12')](_0x5143ec[_0x4fba('0x13')],_0x372446,'\x20'),'description':intUtil[_0x4fba('0x12')](_0x5143ec['Descriptions'],_0x372446,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4fba('0x12')](_0x5143ec[_0x4fba('0x14')],_0x372446,'\x0a')}},getCustomFields(_0x5143ec[_0x4fba('0x15')],_0x372446))}})[_0x4fba('0x16')](function(_0x4a7615){logger[_0x4fba('0x17')](_0x4fba('0x18'));return _0x4a7615[_0x4fba('0x19')];});}function getUser(_0x131088,_0x9cc27f){if(intUtil[_0x4fba('0x1a')](_0x9cc27f)){logger[_0x4fba('0x17')](_0x4fba('0x1b'),_0x9cc27f);return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x1d'),_0x131088['remoteUri']),'qs':{'query':util[_0x4fba('0x1c')](_0x4fba('0x1e'),_0x9cc27f)}})[_0x4fba('0x16')](function(_0x391412){if(_0x391412[_0x4fba('0x1f')]){logger[_0x4fba('0x17')](_0x4fba('0x20'));return _['find'](_0x391412['results'],{'email':_0x9cc27f,'role':_0x4fba('0x21')});}else{logger[_0x4fba('0x17')](_0x4fba('0x22'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x23'),_0x131088[_0x4fba('0xe')])})[_0x4fba('0x16')](function(_0x4ec57d){logger[_0x4fba('0x17')](_0x4fba('0x24'));return _0x4ec57d[_0x4fba('0x25')];});}});}else{logger[_0x4fba('0x17')](_0x4fba('0x22'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x23'),_0x131088[_0x4fba('0xe')])})['then'](function(_0x3cf342){logger[_0x4fba('0x17')]('Admin\x20account\x20selected.');return _0x3cf342[_0x4fba('0x25')];});}}function getEndUser(_0x4365f6,_0x1b791c,_0x585568){logger[_0x4fba('0x17')](_0x4fba('0x26'),_0x585568);return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x1d'),_0x4365f6[_0x4fba('0xe')]),'qs':{'query':util['format'](_0x4fba('0x27'),_0x585568)}})['then'](function(_0x497773){var _0x53a491;if(_0x497773['results'][_0x4fba('0x28')]){_0x497773[_0x4fba('0x29')]=_[_0x4fba('0x2a')](_0x497773[_0x4fba('0x29')],{'suspended':![],'role':_0x4fba('0x2b')});if(_0x497773[_0x4fba('0x29')][_0x4fba('0x28')]){_0x53a491=_[_0x4fba('0x2c')](_0x497773[_0x4fba('0x29')]);}}if(_0x53a491){logger[_0x4fba('0x17')](_0x4fba('0x2d'));return _0x53a491;}else{logger['info'](_0x4fba('0x2e'));return request({'uri':util['format'](_0x4fba('0x2f'),_0x4365f6[_0x4fba('0xe')]),'method':_0x4fba('0xf'),'body':{'user':{'role':_0x4fba('0x2b'),'name':util[_0x4fba('0x1c')](_0x4fba('0x30'),_0x1b791c||_0x585568),'phone':_0x585568}}})[_0x4fba('0x16')](function(_0xbb2ca9){logger[_0x4fba('0x17')](_0x4fba('0x31'));return _0xbb2ca9[_0x4fba('0x25')];});}});}function getAuth(_0x1591f5){var _0x7f88d4;if(_0x1591f5[_0x4fba('0x32')]===_0x4fba('0x33')){_0x7f88d4=util[_0x4fba('0x1c')](_0x4fba('0x34'),_0x1591f5[_0x4fba('0x35')],_0x1591f5[_0x4fba('0x33')]);}else if(_0x1591f5[_0x4fba('0x32')]===_0x4fba('0x36')){_0x7f88d4=util[_0x4fba('0x1c')](_0x4fba('0x37'),_0x1591f5[_0x4fba('0x35')],_0x1591f5[_0x4fba('0x36')]);}return util[_0x4fba('0x1c')]('Basic\x20%s',new Buffer(_0x7f88d4)[_0x4fba('0x38')]('base64'));}function request(_0x566d05){logger['debug'](_0x4fba('0x39'),JSON[_0x4fba('0x3a')](_0x566d05));return rp(_[_0x4fba('0x3b')](_0x566d05,{'method':_0x4fba('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x50e9c4,_0x2fbe4b){var _0xdc0ef0=[];if(_0x50e9c4&&_0x50e9c4[_0x4fba('0x28')]>0x0){_0xdc0ef0=_['map'](_0x50e9c4,_0x2fbe4b);}return _0xdc0ef0;}function getCustomFields(_0x354421,_0xca96ae){var _0x409f55=[];var _0xd8ab92={'custom_fields':[]};if(_0x354421['length']>0x0){_[_0x4fba('0x3d')](_0x354421,function(_0x1d62a2){if(_[_0x4fba('0x3e')]([_0x4fba('0x3f'),'picklist'],_0x1d62a2[_0x4fba('0x40')])&&_0x1d62a2[_0x4fba('0x41')]&&!_0x1d62a2[_0x4fba('0x42')]){_0xd8ab92[_0x1d62a2[_0x4fba('0x41')][_0x4fba('0x43')]()]=_0x1d62a2[_0x4fba('0x44')][_0x4fba('0x38')]();}else if(_['includes']([_0x4fba('0x3f'),_0x4fba('0x45')],_0x1d62a2[_0x4fba('0x40')])&&_0x1d62a2['idField']&&_0x1d62a2[_0x4fba('0x42')]){_0xd8ab92[_0x4fba('0x46')]['push']({'id':_0x1d62a2['idField'],'value':_0x1d62a2[_0x4fba('0x44')]['toString']()});}else if(_0x1d62a2[_0x4fba('0x40')]===_0x4fba('0x47')&&_0x1d62a2[_0x4fba('0x48')]&&_0x1d62a2[_0x4fba('0x49')]&&_0x1d62a2['customField']){_0xca96ae[_0x1d62a2[_0x4fba('0x48')]]&&_0xd8ab92['custom_fields'][_0x4fba('0x4a')]({'id':_0x1d62a2['idField'],'value':_0xca96ae[_0x1d62a2[_0x4fba('0x48')]][_0x4fba('0x38')]()});}else if(_0x1d62a2[_0x4fba('0x40')]===_0x4fba('0x4b')&&_0x1d62a2['Variable']&&_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')]&&_0x1d62a2[_0x4fba('0x49')]&&_0x1d62a2['customField']){_0xca96ae[_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')][_0x4fba('0x43')]()]&&_0xd8ab92[_0x4fba('0x46')]['push']({'id':_0x1d62a2[_0x4fba('0x49')],'value':_0xca96ae[_0x1d62a2[_0x4fba('0x4c')][_0x4fba('0x11')][_0x4fba('0x43')]()][_0x4fba('0x38')]()});}});}return _0xd8ab92;}exports[_0x4fba('0x4d')]=function(_0x255b47,_0x58adf0,_0x4d6e75,_0x2b62f6,_0x1d9883,_0x2e5449){var _0x4ad422,_0x45d253;_0x2e5449[_0x4fba('0xe')]=intUtil[_0x4fba('0x4e')](_0x2e5449['remoteUri']);_0x2e5449[_0x4fba('0x4f')]=intUtil[_0x4fba('0x4e')](_0x2e5449['serverUrl']);if(_0x1d9883&&_0x1d9883[_0x4fba('0x50')]){logger['info'](_0x4fba('0x51'),_0x4fba('0x52'));_0x58adf0[_0x4fba('0x53')]=util[_0x4fba('0x1c')](_0x4fba('0x54'),_0x2e5449[_0x4fba('0x4f')],_0x58adf0[_0x4fba('0x55')],md5(_0x58adf0[_0x4fba('0x55')]));}else{_0x58adf0[_0x4fba('0x53')]='';}headers[_0x4fba('0x56')]=getAuth(_0x2e5449);return getUser(_0x2e5449,_0x2b62f6[_0x4fba('0x57')])['then'](function(_0xf198b){_0x4ad422=_0xf198b;logger[_0x4fba('0x17')](_0x4fba('0x58'),_0x4ad422['id']);return getEndUser(_0x2e5449,_0x58adf0[_0x4fba('0x59')],_0x58adf0[_0x4fba('0x5a')]);})['then'](function(_0x564dd6){_0x45d253=_0x564dd6;logger[_0x4fba('0x17')](_0x4fba('0x5b'),_0x45d253['id']);return getTicket(_0x2e5449,_0x4ad422,_0x45d253,_0x4d6e75,_0x58adf0);})['then'](function(_0x5503fa){if(_0x5503fa){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x5503fa['id']);switch(_0x2e5449[_0x4fba('0x40')]){case _0x4fba('0x5d'):logger['info'](_0x4fba('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2e5449[_0x4fba('0xe')],_0x4ad422['id'],_0x5503fa['id']),'method':'POST'});case _0x4fba('0x5e'):logger[_0x4fba('0x17')]('[QUEUE]',_0x4fba('0x5f'));emit(util[_0x4fba('0x1c')](_0x4fba('0x60'),_0x2b62f6[_0x4fba('0x11')]),_0x4fba('0x61'),{'uri':util[_0x4fba('0x1c')](_0x4fba('0x62'),_0x2e5449[_0x4fba('0xe')][_0x4fba('0x63')](_0x4fba('0x64'),''),_0x5503fa['id'])});break;default:logger[_0x4fba('0x65')]('[QUEUE]',_0x4fba('0x66'));}}})[_0x4fba('0x67')](function(_0x3b3c0a){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4fba('0x68')](_0x3b3c0a,{'showHidden':!![],'depth':null}));});};exports[_0x4fba('0x69')]=function(_0x56d31b,_0x19b50b,_0xd2ccf2,_0x1800c9,_0xe65f2,_0x37ce6f,_0x46f05c){var _0x3aa149,_0x36fc3b;_0x37ce6f[_0x4fba('0xe')]=intUtil[_0x4fba('0x4e')](_0x37ce6f[_0x4fba('0xe')]);_0x37ce6f['serverUrl']=intUtil['stripTrailingSlash'](_0x37ce6f[_0x4fba('0x4f')]);if(_0x46f05c&&_0x46f05c['recordingFormat']&&_0x46f05c[_0x4fba('0x6a')]!==_0x4fba('0x6b')){logger[_0x4fba('0x17')](_0x4fba('0x6c'),_0x4fba('0x52'));_0x19b50b[_0x4fba('0x53')]=util[_0x4fba('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x37ce6f[_0x4fba('0x4f')],_0x19b50b[_0x4fba('0x55')],md5(_0x19b50b[_0x4fba('0x55')]));}headers['Authorization']=getAuth(_0x37ce6f);return getUser(_0x37ce6f,_0x1800c9[_0x4fba('0x57')])['then'](function(_0x104609){_0x3aa149=_0x104609;logger[_0x4fba('0x17')](_0x4fba('0x58'),_0x3aa149['id']);return getEndUser(_0x37ce6f,_0x19b50b[_0x4fba('0x6d')],_0x19b50b['destcalleridnum']);})[_0x4fba('0x16')](function(_0x1cd0e8){_0x36fc3b=_0x1cd0e8;logger[_0x4fba('0x17')](_0x4fba('0x5b'),_0x36fc3b['id']);return getTicket(_0x37ce6f,_0x3aa149,_0x36fc3b,_0xd2ccf2,_0x19b50b);})['then'](function(_0x162baf){if(_0x162baf){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x162baf['id']);switch(_0x37ce6f[_0x4fba('0x40')]){case _0x4fba('0x5d'):logger[_0x4fba('0x17')](_0x4fba('0x6c'),_0x4fba('0x6e'));return request({'uri':util[_0x4fba('0x1c')](_0x4fba('0x6f'),_0x37ce6f['remoteUri'],_0x3aa149['id'],_0x162baf['id']),'method':_0x4fba('0xf')});case'newTab':logger[_0x4fba('0x17')](_0x4fba('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x1800c9[_0x4fba('0x11')]),'trigger:browser:url',{'uri':util[_0x4fba('0x1c')](_0x4fba('0x62'),_0x37ce6f[_0x4fba('0xe')][_0x4fba('0x63')](_0x4fba('0x64'),''),_0x162baf['id'])});break;default:logger[_0x4fba('0x65')](_0x4fba('0x6c'),_0x4fba('0x66'));}}})[_0x4fba('0x67')](function(_0x27beb8){logger[_0x4fba('0x65')](_0x4fba('0x70'),util['inspect'](_0x27beb8,{'showHidden':!![],'depth':null}));});};exports[_0x4fba('0x71')]=function(_0x5744bd,_0x8ca35,_0x4d0878,_0x138070,_0x9978da,_0xeffcc6){var _0x3261ee,_0x3fa270;_0xeffcc6['remoteUri']=intUtil[_0x4fba('0x4e')](_0xeffcc6[_0x4fba('0xe')]);_0xeffcc6['serverUrl']=intUtil[_0x4fba('0x4e')](_0xeffcc6[_0x4fba('0x4f')]);if(_0x9978da&&_0x9978da[_0x4fba('0x50')]){logger[_0x4fba('0x17')]('['+_0x8ca35['lastevent'][_0x4fba('0x72')]()+']','Recording\x20is\x20enabled!');_0x8ca35[_0x4fba('0x53')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeffcc6['serverUrl'],_0x8ca35[_0x4fba('0x55')],md5(_0x8ca35['uniqueid']));}else{_0x8ca35[_0x4fba('0x53')]='';}headers['Authorization']=getAuth(_0xeffcc6);return getUser(_0xeffcc6)[_0x4fba('0x16')](function(_0xe48ac9){_0x3261ee=_0xe48ac9;logger[_0x4fba('0x17')]('The\x20User\x20ID\x20is:',_0x3261ee['id']);return getEndUser(_0xeffcc6,_0x8ca35[_0x4fba('0x59')],_0x8ca35[_0x4fba('0x5a')]);})[_0x4fba('0x16')](function(_0x3efb7d){_0x3fa270=_0x3efb7d;logger[_0x4fba('0x17')]('The\x20Enduser\x20ID\x20is:',_0x3fa270['id']);return getTicket(_0xeffcc6,_0x3261ee,_0x3fa270,_0x4d0878,_0x8ca35);})[_0x4fba('0x16')](function(_0x4ed67d){if(_0x4ed67d){logger[_0x4fba('0x17')](_0x4fba('0x5c'),_0x4ed67d['id']);}})['catch'](function(_0x2d7ebb){logger[_0x4fba('0x65')]('['+_0x8ca35['lastevent'][_0x4fba('0x72')]()+']'+_0x4fba('0x73'),util['inspect'](_0x2d7ebb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5b48=['The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','email','destcalleridnum','[OUTBOUND]','catch','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json','merge','Tags','getString','Subjects','Descriptions','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','[HTTP]','stringify','defaults','GET','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x39cf67,_0x1debfb){var _0x1b3cff=function(_0x5cfc80){while(--_0x5cfc80){_0x39cf67['push'](_0x39cf67['shift']());}};_0x1b3cff(++_0x1debfb);}(_0x5b48,0x89));var _0x85b4=function(_0x238202,_0x10da07){_0x238202=_0x238202-0x0;var _0x217367=_0x5b48[_0x238202];return _0x217367;};'use strict';var _=require(_0x85b4('0x0'));var rp=require(_0x85b4('0x1'));var md5=require(_0x85b4('0x2'));var util=require(_0x85b4('0x3'));var Redis=require('ioredis');var intUtil=require(_0x85b4('0x4'));var config=require(_0x85b4('0x5'));var logger=require(_0x85b4('0x6'))(_0x85b4('0x7'));config[_0x85b4('0x8')]=_['defaults'](config[_0x85b4('0x8')],{'host':_0x85b4('0x9'),'port':0x18eb});var io=require(_0x85b4('0xa'))(new Redis(config['redis']));function emit(_0x1eff5e,_0x1ca705,_0x569db8){io['to'](_0x1eff5e)[_0x85b4('0xb')](_0x1ca705,_0x569db8);}var headers={'Content-Type':_0x85b4('0xc'),'Accept':_0x85b4('0xc')};function getTicket(_0x16c5ad,_0x4c4fa7,_0x4d3620,_0x2650d0,_0x3c440c){logger[_0x85b4('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x85b4('0xe'),_0x16c5ad['remoteUri']),'method':'POST','body':{'ticket':_[_0x85b4('0xf')]({'requester_id':_0x4d3620['id'],'submitter_id':_0x4c4fa7?_0x4c4fa7['id']:undefined,'assignee_id':_0x4c4fa7?_0x4c4fa7['id']:undefined,'tags':getTags(_0x2650d0[_0x85b4('0x10')],'name'),'subject':intUtil[_0x85b4('0x11')](_0x2650d0[_0x85b4('0x12')],_0x3c440c,'\x20'),'description':intUtil[_0x85b4('0x11')](_0x2650d0[_0x85b4('0x13')],_0x3c440c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x85b4('0x11')](_0x2650d0['Descriptions'],_0x3c440c,'\x0a')}},getCustomFields(_0x2650d0['Fields'],_0x3c440c))}})[_0x85b4('0x14')](function(_0x2980d2){logger[_0x85b4('0xd')](_0x85b4('0x15'));return _0x2980d2['ticket'];});}function getUser(_0x3a3e2e,_0x428f52){if(intUtil[_0x85b4('0x16')](_0x428f52)){logger['info'](_0x85b4('0x17'),_0x428f52);return request({'uri':util[_0x85b4('0x18')](_0x85b4('0x19'),_0x3a3e2e[_0x85b4('0x1a')]),'qs':{'query':util[_0x85b4('0x18')](_0x85b4('0x1b'),_0x428f52)}})[_0x85b4('0x14')](function(_0xf5c3d7){if(_0xf5c3d7[_0x85b4('0x1c')]){logger[_0x85b4('0xd')](_0x85b4('0x1d'));return _['find'](_0xf5c3d7[_0x85b4('0x1e')],{'email':_0x428f52,'role':'agent'});}else{logger[_0x85b4('0xd')](_0x85b4('0x1f'));return request({'uri':util[_0x85b4('0x18')](_0x85b4('0x20'),_0x3a3e2e[_0x85b4('0x1a')])})['then'](function(_0x281708){logger[_0x85b4('0xd')](_0x85b4('0x21'));return _0x281708[_0x85b4('0x22')];});}});}else{logger['info'](_0x85b4('0x1f'));return request({'uri':util[_0x85b4('0x18')](_0x85b4('0x20'),_0x3a3e2e[_0x85b4('0x1a')])})['then'](function(_0x384dce){logger['info'](_0x85b4('0x21'));return _0x384dce['user'];});}}function getEndUser(_0x3f38ee,_0x358b23,_0x792aae){logger[_0x85b4('0xd')](_0x85b4('0x23'),_0x792aae);return request({'uri':util['format'](_0x85b4('0x19'),_0x3f38ee[_0x85b4('0x1a')]),'qs':{'query':util['format'](_0x85b4('0x24'),_0x792aae)}})[_0x85b4('0x14')](function(_0x1328c3){var _0x4746af;if(_0x1328c3['results'][_0x85b4('0x25')]){_0x1328c3[_0x85b4('0x1e')]=_[_0x85b4('0x26')](_0x1328c3['results'],{'suspended':![],'role':'end-user'});if(_0x1328c3['results'][_0x85b4('0x25')]){_0x4746af=_[_0x85b4('0x27')](_0x1328c3[_0x85b4('0x1e')]);}}if(_0x4746af){logger['info']('Enduser\x20found!');return _0x4746af;}else{logger[_0x85b4('0xd')](_0x85b4('0x28'));return request({'uri':util['format'](_0x85b4('0x29'),_0x3f38ee[_0x85b4('0x1a')]),'method':_0x85b4('0x2a'),'body':{'user':{'role':_0x85b4('0x2b'),'name':util[_0x85b4('0x18')](_0x85b4('0x2c'),_0x358b23||_0x792aae),'phone':_0x792aae}}})['then'](function(_0x1b16cb){logger[_0x85b4('0xd')](_0x85b4('0x2d'));return _0x1b16cb[_0x85b4('0x22')];});}});}function getAuth(_0x200747){var _0x5c7d93;if(_0x200747[_0x85b4('0x2e')]===_0x85b4('0x2f')){_0x5c7d93=util[_0x85b4('0x18')](_0x85b4('0x30'),_0x200747[_0x85b4('0x31')],_0x200747[_0x85b4('0x2f')]);}else if(_0x200747[_0x85b4('0x2e')]===_0x85b4('0x32')){_0x5c7d93=util['format'](_0x85b4('0x33'),_0x200747[_0x85b4('0x31')],_0x200747['token']);}return util['format']('Basic\x20%s',new Buffer(_0x5c7d93)[_0x85b4('0x34')](_0x85b4('0x35')));}function request(_0xc7ffc8){logger['debug'](_0x85b4('0x36'),JSON[_0x85b4('0x37')](_0xc7ffc8));return rp(_[_0x85b4('0x38')](_0xc7ffc8,{'method':_0x85b4('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2f741b,_0x4cd3f0){var _0x5f53f7=[];if(_0x2f741b&&_0x2f741b[_0x85b4('0x25')]>0x0){_0x5f53f7=_['map'](_0x2f741b,_0x4cd3f0);}return _0x5f53f7;}function getCustomFields(_0x2561d6,_0x312e9a){var _0x3a8bff=[];var _0x519681={'custom_fields':[]};if(_0x2561d6[_0x85b4('0x25')]>0x0){_[_0x85b4('0x3a')](_0x2561d6,function(_0x1b3be7){if(_['includes']([_0x85b4('0x3b'),_0x85b4('0x3c')],_0x1b3be7[_0x85b4('0x3d')])&&_0x1b3be7[_0x85b4('0x3e')]&&!_0x1b3be7[_0x85b4('0x3f')]){_0x519681[_0x1b3be7['nameField'][_0x85b4('0x40')]()]=_0x1b3be7[_0x85b4('0x41')][_0x85b4('0x34')]();}else if(_['includes']([_0x85b4('0x3b'),_0x85b4('0x3c')],_0x1b3be7[_0x85b4('0x3d')])&&_0x1b3be7[_0x85b4('0x42')]&&_0x1b3be7[_0x85b4('0x3f')]){_0x519681[_0x85b4('0x43')][_0x85b4('0x44')]({'id':_0x1b3be7['idField'],'value':_0x1b3be7[_0x85b4('0x41')][_0x85b4('0x34')]()});}else if(_0x1b3be7['type']===_0x85b4('0x45')&&_0x1b3be7[_0x85b4('0x46')]&&_0x1b3be7['idField']&&_0x1b3be7['customField']){_0x312e9a[_0x1b3be7[_0x85b4('0x46')]]&&_0x519681[_0x85b4('0x43')][_0x85b4('0x44')]({'id':_0x1b3be7[_0x85b4('0x42')],'value':_0x312e9a[_0x1b3be7[_0x85b4('0x46')]][_0x85b4('0x34')]()});}else if(_0x1b3be7['type']==='customVariable'&&_0x1b3be7[_0x85b4('0x47')]&&_0x1b3be7[_0x85b4('0x47')][_0x85b4('0x48')]&&_0x1b3be7[_0x85b4('0x42')]&&_0x1b3be7[_0x85b4('0x3f')]){_0x312e9a[_0x1b3be7[_0x85b4('0x47')][_0x85b4('0x48')][_0x85b4('0x40')]()]&&_0x519681['custom_fields'][_0x85b4('0x44')]({'id':_0x1b3be7[_0x85b4('0x42')],'value':_0x312e9a[_0x1b3be7[_0x85b4('0x47')][_0x85b4('0x48')][_0x85b4('0x40')]()][_0x85b4('0x34')]()});}});}return _0x519681;}exports[_0x85b4('0x49')]=function(_0x3f24c4,_0x2276ad,_0x3494d3,_0x4a210f,_0x424daa,_0x5b9eb7){var _0x405fb7,_0x4e2678;_0x5b9eb7[_0x85b4('0x1a')]=intUtil['stripTrailingSlash'](_0x5b9eb7['remoteUri']);_0x5b9eb7[_0x85b4('0x4a')]=intUtil[_0x85b4('0x4b')](_0x5b9eb7[_0x85b4('0x4a')]);if(_0x424daa&&_0x424daa[_0x85b4('0x4c')]){logger[_0x85b4('0xd')](_0x85b4('0x4d'),_0x85b4('0x4e'));_0x2276ad[_0x85b4('0x4f')]=util['format'](_0x85b4('0x50'),_0x5b9eb7[_0x85b4('0x4a')],_0x2276ad['uniqueid'],md5(_0x2276ad[_0x85b4('0x51')]));}else{_0x2276ad[_0x85b4('0x4f')]='';}headers[_0x85b4('0x52')]=getAuth(_0x5b9eb7);return getUser(_0x5b9eb7,_0x4a210f['email'])[_0x85b4('0x14')](function(_0x44e909){_0x405fb7=_0x44e909;logger['info'](_0x85b4('0x53'),_0x405fb7['id']);return getEndUser(_0x5b9eb7,_0x2276ad[_0x85b4('0x54')],_0x2276ad[_0x85b4('0x55')]);})['then'](function(_0x3f9f48){_0x4e2678=_0x3f9f48;logger[_0x85b4('0xd')](_0x85b4('0x56'),_0x4e2678['id']);return getTicket(_0x5b9eb7,_0x405fb7,_0x4e2678,_0x3494d3,_0x2276ad);})[_0x85b4('0x14')](function(_0x3a4189){if(_0x3a4189){logger[_0x85b4('0xd')](_0x85b4('0x57'),_0x3a4189['id']);switch(_0x5b9eb7[_0x85b4('0x3d')]){case _0x85b4('0x58'):logger[_0x85b4('0xd')](_0x85b4('0x4d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x85b4('0x18')](_0x85b4('0x59'),_0x5b9eb7['remoteUri'],_0x405fb7['id'],_0x3a4189['id']),'method':'POST'});case'newTab':logger[_0x85b4('0xd')](_0x85b4('0x4d'),_0x85b4('0x5a'));emit(util[_0x85b4('0x18')](_0x85b4('0x5b'),_0x4a210f['name']),_0x85b4('0x5c'),{'uri':util[_0x85b4('0x18')](_0x85b4('0x5d'),_0x5b9eb7['remoteUri'][_0x85b4('0x5e')]('/api/v2',''),_0x3a4189['id'])});break;default:logger['error'](_0x85b4('0x4d'),_0x85b4('0x5f'));}}})['catch'](function(_0x52ffe3){logger[_0x85b4('0x60')](_0x85b4('0x61'),util[_0x85b4('0x62')](_0x52ffe3,{'showHidden':!![],'depth':null}));});};exports[_0x85b4('0x63')]=function(_0x3e0c7d,_0x19ef6f,_0x3f07b7,_0x5c84d5,_0x437958,_0x7c0835,_0x277194){var _0x4fdd82,_0x2a5f88;_0x7c0835[_0x85b4('0x1a')]=intUtil[_0x85b4('0x4b')](_0x7c0835[_0x85b4('0x1a')]);_0x7c0835[_0x85b4('0x4a')]=intUtil[_0x85b4('0x4b')](_0x7c0835[_0x85b4('0x4a')]);if(_0x277194&&_0x277194[_0x85b4('0x64')]&&_0x277194[_0x85b4('0x64')]!==_0x85b4('0x65')){logger['info']('[OUTBOUND]',_0x85b4('0x4e'));_0x19ef6f[_0x85b4('0x4f')]=util[_0x85b4('0x18')](_0x85b4('0x50'),_0x7c0835[_0x85b4('0x4a')],_0x19ef6f[_0x85b4('0x51')],md5(_0x19ef6f[_0x85b4('0x51')]));}headers['Authorization']=getAuth(_0x7c0835);return getUser(_0x7c0835,_0x5c84d5[_0x85b4('0x66')])[_0x85b4('0x14')](function(_0x515dff){_0x4fdd82=_0x515dff;logger[_0x85b4('0xd')](_0x85b4('0x53'),_0x4fdd82['id']);return getEndUser(_0x7c0835,_0x19ef6f['destcalleridname'],_0x19ef6f[_0x85b4('0x67')]);})[_0x85b4('0x14')](function(_0x59578a){_0x2a5f88=_0x59578a;logger[_0x85b4('0xd')](_0x85b4('0x56'),_0x2a5f88['id']);return getTicket(_0x7c0835,_0x4fdd82,_0x2a5f88,_0x3f07b7,_0x19ef6f);})[_0x85b4('0x14')](function(_0x4588ed){if(_0x4588ed){logger['info']('The\x20Ticket\x20ID\x20is:',_0x4588ed['id']);switch(_0x7c0835['type']){case _0x85b4('0x58'):logger[_0x85b4('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x85b4('0x18')](_0x85b4('0x59'),_0x7c0835[_0x85b4('0x1a')],_0x4fdd82['id'],_0x4588ed['id']),'method':_0x85b4('0x2a')});case'newTab':logger[_0x85b4('0xd')](_0x85b4('0x68'),_0x85b4('0x5a'));emit(util[_0x85b4('0x18')]('user:%s',_0x5c84d5[_0x85b4('0x48')]),'trigger:browser:url',{'uri':util['format'](_0x85b4('0x5d'),_0x7c0835['remoteUri'][_0x85b4('0x5e')]('/api/v2',''),_0x4588ed['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x85b4('0x69')](function(_0x243bdf){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x85b4('0x62')](_0x243bdf,{'showHidden':!![],'depth':null}));});};exports[_0x85b4('0x6a')]=function(_0x1c691a,_0xe91095,_0x59df0a,_0x5e9205,_0x252199,_0x502944){var _0x20b70e,_0x2d8639;_0x502944['remoteUri']=intUtil['stripTrailingSlash'](_0x502944[_0x85b4('0x1a')]);_0x502944[_0x85b4('0x4a')]=intUtil[_0x85b4('0x4b')](_0x502944[_0x85b4('0x4a')]);if(_0x252199&&_0x252199[_0x85b4('0x4c')]){logger[_0x85b4('0xd')]('['+_0xe91095[_0x85b4('0x6b')][_0x85b4('0x6c')]()+']',_0x85b4('0x4e'));_0xe91095[_0x85b4('0x4f')]=util[_0x85b4('0x18')](_0x85b4('0x50'),_0x502944['serverUrl'],_0xe91095[_0x85b4('0x51')],md5(_0xe91095['uniqueid']));}else{_0xe91095[_0x85b4('0x4f')]='';}headers[_0x85b4('0x52')]=getAuth(_0x502944);return getUser(_0x502944)[_0x85b4('0x14')](function(_0x557431){_0x20b70e=_0x557431;logger[_0x85b4('0xd')](_0x85b4('0x53'),_0x20b70e['id']);return getEndUser(_0x502944,_0xe91095['calleridname'],_0xe91095[_0x85b4('0x55')]);})['then'](function(_0x4dfdf4){_0x2d8639=_0x4dfdf4;logger['info'](_0x85b4('0x56'),_0x2d8639['id']);return getTicket(_0x502944,_0x20b70e,_0x2d8639,_0x59df0a,_0xe91095);})[_0x85b4('0x14')](function(_0x88678c){if(_0x88678c){logger[_0x85b4('0xd')](_0x85b4('0x57'),_0x88678c['id']);}})['catch'](function(_0x46d2b7){logger[_0x85b4('0x60')]('['+_0xe91095[_0x85b4('0x6b')][_0x85b4('0x6c')]()+']'+_0x85b4('0x6d'),util[_0x85b4('0x62')](_0x46d2b7,{'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 33dc27a..c5d34de 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 _0x3079=['then','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Called','Call_Result','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','[QUEUE]','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','/api/voice/recordings/','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]','stringify','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token'];(function(_0x1c635a,_0x216a2d){var _0x3f1ce6=function(_0x382b50){while(--_0x382b50){_0x1c635a['push'](_0x1c635a['shift']());}};_0x3f1ce6(++_0x216a2d);}(_0x3079,0x112));var _0x9307=function(_0x13f9c3,_0x2036c0){_0x13f9c3=_0x13f9c3-0x0;var _0x22185a=_0x3079[_0x13f9c3];return _0x22185a;};'use strict';var _=require(_0x9307('0x0'));var rp=require(_0x9307('0x1'));var md5=require('md5');var util=require(_0x9307('0x2'));var intUtil=require(_0x9307('0x3'));var moment=require(_0x9307('0x4'));var Redis=require(_0x9307('0x5'));var BPromise=require(_0x9307('0x6'));var config=require('../../../../config/environment');var logger=require(_0x9307('0x7'))(_0x9307('0x8'));config[_0x9307('0x9')]=_['defaults'](config['redis'],{'host':_0x9307('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4f511b,_0x1cc526,_0x23a58b){io['to'](_0x4f511b)[_0x9307('0xb')](_0x1cc526,_0x23a58b);}function request(_0x19015f){logger[_0x9307('0xc')](_0x9307('0xd'),JSON[_0x9307('0xe')](_0x19015f));return rp(_0x19015f);}function getCustomFields(_0x51da52,_0x2d02ef){var _0x294aa8={};if(_0x51da52['length']>0x0){_[_0x9307('0xf')](_0x51da52,function(_0x213aa9){if(_[_0x9307('0x10')](['string',_0x9307('0x11')],_0x213aa9[_0x9307('0x12')])&&_0x213aa9[_0x9307('0x13')]){_0x294aa8[_0x213aa9[_0x9307('0x13')]]=_0x213aa9[_0x9307('0x14')][_0x9307('0x15')]();}else if(_0x213aa9[_0x9307('0x12')]===_0x9307('0x16')&&_0x213aa9['variableName']&&_0x213aa9[_0x9307('0x13')]&&_0x2d02ef[_0x213aa9[_0x9307('0x17')]]){_0x294aa8[_0x213aa9[_0x9307('0x13')]]=_0x2d02ef[_0x213aa9['variableName']]['toString']();}else if(_0x213aa9[_0x9307('0x12')]===_0x9307('0x18')&&_0x213aa9[_0x9307('0x19')]&&_0x213aa9['Variable']['name']&&_0x213aa9[_0x9307('0x13')]&&_0x2d02ef[_0x213aa9['Variable'][_0x9307('0x1a')]['toLowerCase']()]){_0x294aa8[_0x213aa9['idField']]=_0x2d02ef[_0x213aa9[_0x9307('0x19')]['name'][_0x9307('0x1b')]()]['toString']();}});}return _0x294aa8;}function getName(_0x1fccfa){if(_0x1fccfa[_0x9307('0x1c')]('\x20')>0x0){var _0x191027=_0x1fccfa[_0x9307('0x1d')](/ (.+)/);if(_0x191027[0x1]){return _0x191027;}}return[_0x1fccfa,_0x1fccfa];}var accountsTokens={};function getAccessToken(_0x5f4dbf){return new Promise(function(_0xda3c18,_0x4f26a8){if(!_[_0x9307('0x1e')](accountsTokens[_0x5f4dbf['id']])&&!_[_0x9307('0x1e')](accountsTokens[_0x5f4dbf['id']][_0x9307('0x1f')])){if(moment()[_0x9307('0x20')](accountsTokens[_0x5f4dbf['id']][_0x9307('0x21')])){_0xda3c18(accountsTokens[_0x5f4dbf['id']][_0x9307('0x1f')]);}}var _0x1960e9;switch(_0x5f4dbf[_0x9307('0x22')]){case'US':_0x1960e9=_0x9307('0x23');break;case'AU':_0x1960e9='https://accounts.zoho.com.au';break;case'EU':_0x1960e9='https://accounts.zoho.eu';break;case'IN':_0x1960e9=_0x9307('0x24');break;case'CN':_0x1960e9=_0x9307('0x25');break;default:_0x1960e9=_0x9307('0x26');break;}var _0x565464={'method':_0x9307('0x27'),'uri':_0x1960e9+_0x9307('0x28'),'qs':{'refresh_token':_0x5f4dbf[_0x9307('0x29')],'client_id':_0x5f4dbf[_0x9307('0x2a')],'client_secret':_0x5f4dbf['clientSecret'],'grant_type':_0x9307('0x2b')},'json':!![]};return rp(_0x565464)[_0x9307('0x2c')](function(_0x19b79a){accountsTokens[_0x5f4dbf['id']]={'access_token':_0x19b79a['access_token'],'expires_in':moment()['add'](_0x19b79a[_0x9307('0x21')],'seconds')};_0xda3c18(_0x19b79a[_0x9307('0x1f')]);})[_0x9307('0x2d')](function(_0x3dcf14){logger[_0x9307('0x2e')](_0x9307('0x2f'),_0x3dcf14[_0x9307('0x30')]);_0x4f26a8(_0x3dcf14);});});}function getUser(_0x397855,_0x4bca19,_0x24190b,_0x5c88be){logger[_0x9307('0x31')]('Search\x20user');return request({'method':'GET','uri':util[_0x9307('0x32')](_0x9307('0x33'),_0x4bca19),'qs':{'type':_0x9307('0x34')},'headers':{'Authorization':_0x9307('0x35')+_0x397855},'json':!![]})['then'](function(_0x4020c4){if(_0x4020c4['users']){var _0x36f395=-0x1;if(_[_0x9307('0x36')](_0x4020c4[_0x9307('0x37')])){if(!_['isNil'](_0x5c88be)){_0x36f395=_[_0x9307('0x38')](_0x4020c4['users'],function(_0x49b895){return _0x49b895['email']===_0x5c88be;});}if(_0x36f395>=0x0){logger[_0x9307('0x31')](_0x9307('0x39'));}else{logger[_0x9307('0x31')](_0x9307('0x3a'));_0x36f395=_[_0x9307('0x38')](_0x4020c4[_0x9307('0x37')],function(_0x6f3531){return _0x6f3531[_0x9307('0x3b')]['name']===_0x9307('0x3c');});}return _0x4020c4[_0x9307('0x37')][_0x36f395];}else{if(_0x4020c4['user'][_0x9307('0x3b')]['name']===_0x9307('0x3c')){logger[_0x9307('0x31')](_0x9307('0x3a'));user=_0x4020c4['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x4020c4));throw new Error(_0x9307('0x3d')+JSON[_0x9307('0xe')](_0x4020c4));}}}else{logger[_0x9307('0x2e')](_0x9307('0x3e'),JSON[_0x9307('0xe')](_0x4020c4));throw new Error(_0x9307('0x3d')+JSON[_0x9307('0xe')](_0x4020c4));}})[_0x9307('0x2d')](function(_0x26cf6c){console['error'](_0x26cf6c);});}function getZohoUser(_0x59ee24,_0x3a176f){return new BPromise(function(_0x34c396,_0x29b089){request(_0x59ee24)['then'](function(_0x4343ce){var _0x573b00=null;if(_0x4343ce){_0x573b00=_0x4343ce[_0x9307('0x3f')][0x0];_0x573b00[_0x9307('0x40')]=_0x3a176f;}_0x34c396(_0x573b00);})['catch'](function(_0x3835cc){_0x29b089(_0x3835cc);});});}function createEndUser(_0x4b255b,_0x1068e0,_0x5e2fc0,_0x5b27d8,_0x3f445e,_0x414872){var _0x5e2fc0=getName(_0x5e2fc0);return request({'method':'POST','uri':_0x9307('0x41')+_0x1068e0+_0x9307('0x42')+_[_0x9307('0x43')](_0x414872['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5e2fc0[0x1],'First_Name':_0x5e2fc0[0x0],'Phone':_0x5b27d8,'Owner':{'name':!_[_0x9307('0x1e')](_0x3f445e[_0x9307('0x44')][_0x9307('0x1a')])?_0x3f445e[_0x9307('0x44')][_0x9307('0x1a')]:!_[_0x9307('0x1e')](_0x3f445e['first_name'])?_0x3f445e['first_name']+'\x20'+_0x3f445e[_0x9307('0x45')]:_0x3f445e['last_name'],'id':_0x3f445e['id']}}]},'headers':{'Authorization':_0x9307('0x35')+_0x4b255b},'json':!![]})[_0x9307('0x2c')](function(_0x3b470f){if(_0x3b470f&&_0x3b470f[_0x9307('0x3f')][0x0][_0x9307('0x46')]===_0x9307('0x47')){var _0x29245d=_0x3b470f[_0x9307('0x3f')][0x0][_0x9307('0x48')];_0x29245d[_0x9307('0x40')]=_[_0x9307('0x43')](_0x414872[_0x9307('0x49')])+'s';return _0x29245d;}logger['error'](_0x9307('0x3e'),JSON[_0x9307('0xe')](data));throw new Error(_0x9307('0x4a')+JSON[_0x9307('0xe')](data));})[_0x9307('0x2d')](function(_0x41f88c){console[_0x9307('0x4b')](_0x9307('0x4c'),_0x41f88c);});}function getEndUser(_0x3b566d,_0x135e7f,_0x18bc0b,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e){var _0x5e79a1={'method':_0x9307('0x4d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3b566d},'json':!![]};switch(_0x3bea0e[_0x9307('0x4e')]){case _0x9307('0x4f'):_0x5e79a1[_0x9307('0x50')]=_0x9307('0x41')+_0x135e7f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,'Contacts')[_0x9307('0x2c')](function(_0x249e8e){if(_0x249e8e)return _0x249e8e;_0x5e79a1['uri']=_0x9307('0x41')+_0x135e7f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,'Leads')[_0x9307('0x2c')](function(_0x367ae5){if(_0x367ae5)return _0x367ae5;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});});break;case _0x9307('0x52'):_0x5e79a1[_0x9307('0x50')]='https://www.zohoapis.'+_0x135e7f+_0x9307('0x53')+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,_0x9307('0x54'))[_0x9307('0x2c')](function(_0x25f8af){if(_0x25f8af)return _0x25f8af;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});break;case _0x9307('0x55'):_0x5e79a1[_0x9307('0x50')]='https://www.zohoapis.'+_0x135e7f+_0x9307('0x56')+_0x2b86fd+'))';return getZohoUser(_0x5e79a1,_0x9307('0x57'))[_0x9307('0x2c')](function(_0x108a49){if(_0x108a49)return _0x108a49;if(_0x3bea0e[_0x9307('0x49')]!=_0x9307('0x51')){return createEndUser(_0x3b566d,_0x135e7f,_0x4b2b6e,_0x2b86fd,_0x41b0bd,_0x3bea0e);}else{return{};}});break;}}function getCall(_0x7ce31d,_0x295fde,_0x10634b,_0x10d6a1,_0x57000d,_0x105119,_0x2c0160,_0x187f23){logger['info'](_0x9307('0x58'));var _0x25feb6={};_0x25feb6[_0x9307('0x59')]={'name':!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x44')][_0x9307('0x1a')])&&!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x3b')][_0x9307('0x1a')])&&_0x10d6a1[_0x9307('0x3b')][_0x9307('0x1a')]===_0x9307('0x5a')?_0x10d6a1[_0x9307('0x44')][_0x9307('0x1a')]:!_[_0x9307('0x1e')](_0x10d6a1[_0x9307('0x5b')])?_0x10d6a1[_0x9307('0x5b')]+'\x20'+_0x10d6a1[_0x9307('0x45')]:_0x10d6a1[_0x9307('0x45')],'id':_0x10d6a1['id']};_0x25feb6[_0x9307('0x5c')]=intUtil[_0x9307('0x5d')](_0x105119[_0x9307('0x5e')],_0x2c0160,'\x20');_0x25feb6[_0x9307('0x5f')]=intUtil[_0x9307('0x5d')](_0x105119[_0x9307('0x60')],_0x2c0160,'\x0a');if(_0x57000d[_0x9307('0x40')]===_0x9307('0x54')){_0x25feb6['Who_Id']={'name':!_[_0x9307('0x1e')](_0x57000d['Full_Name'])?_0x57000d['Full_Name']:!_[_0x9307('0x1e')](_0x57000d[_0x9307('0x61')])?_0x57000d[_0x9307('0x61')]+'\x20'+_0x57000d[_0x9307('0x62')]:_0x57000d['Last_Name'],'id':_0x57000d['id']};}if(_0x57000d[_0x9307('0x40')]===_0x9307('0x57')){_0x25feb6[_0x9307('0x63')]={'name':!_['isNil'](_0x57000d[_0x9307('0x64')])?_0x57000d[_0x9307('0x64')]:!_['isNil'](_0x57000d['First_Name'])?_0x57000d[_0x9307('0x61')]+'\x20'+_0x57000d['Last_Name']:_0x57000d[_0x9307('0x62')],'id':_0x57000d['id']};_0x25feb6[_0x9307('0x65')]=_[_0x9307('0x43')](_0x57000d['enduserType']);}if(_0x2c0160[_0x9307('0x66')]){_0x25feb6[_0x9307('0x67')]=moment[_0x9307('0x68')](parseInt(_0x2c0160[_0x9307('0x66')])*0x3e8)[_0x9307('0x32')](_0x9307('0x69'));}else if(_0x2c0160['answertime']&&_0x2c0160[_0x9307('0x6a')]){_0x25feb6[_0x9307('0x67')]=moment[_0x9307('0x68')](moment(_0x2c0160['endtime'],_0x9307('0x6b'))[_0x9307('0x6c')](moment(_0x2c0160[_0x9307('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x9307('0x32')](_0x9307('0x69'));}switch(_0x2c0160[_0x9307('0x6e')]){case _0x9307('0x6f'):_0x25feb6['Call_Result']=_0x9307('0x70');break;case'complete':case'connect':_0x25feb6[_0x9307('0x71')]='Answered';break;case _0x9307('0x72'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x73');break;case _0x9307('0x74'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x75');break;case _0x9307('0x76'):_0x25feb6[_0x9307('0x71')]=_0x9307('0x77');default:}_0x25feb6['Call_Start_Time']=(_0x187f23==='outbound'?moment(_0x2c0160[_0x9307('0x6d')])[_0x9307('0x32')](_0x9307('0x6b')):moment(_0x2c0160[_0x9307('0x78')])[_0x9307('0x32')](_0x9307('0x6b')))||moment()['format'](_0x9307('0x6b'));_0x25feb6[_0x9307('0x79')]=_0x187f23||_0x9307('0x7a');_0x25feb6=_[_0x9307('0x7b')](_0x25feb6,getCustomFields(_0x105119['Fields'],_0x2c0160));return request({'method':_0x9307('0x27'),'uri':_0x9307('0x41')+_0x295fde+_0x9307('0x7c'),'headers':{'Authorization':_0x9307('0x35')+_0x7ce31d},'body':{'data':[_0x25feb6]},'json':!![]})[_0x9307('0x2c')](function(_0x5e867b){if(_0x5e867b&&_0x5e867b[_0x9307('0x3f')][0x0][_0x9307('0x46')]==='SUCCESS'){logger['info'](_0x9307('0x7d'));return{'id':_0x5e867b[_0x9307('0x3f')][0x0][_0x9307('0x48')]['id']};}})[_0x9307('0x2d')](function(_0x1c2212){logger[_0x9307('0x31')]('err',_0x1c2212[_0x9307('0x30')]);console[_0x9307('0x4b')](_0x9307('0x7e'),_0x1c2212);});}exports[_0x9307('0x7f')]=function(_0x4b73bc,_0x3011db,_0x5aa4f5,_0x311685,_0x25e768,_0xaa07fe){var _0x27744d,_0x25a5b0,_0x5eb9a3;_0xaa07fe[_0x9307('0x80')]=intUtil[_0x9307('0x81')](_0xaa07fe[_0x9307('0x80')]);_0xaa07fe['serverUrl']=intUtil[_0x9307('0x81')](_0xaa07fe['serverUrl']);if(_0x25e768&&_0x25e768['monitor_format']){logger[_0x9307('0x31')]('[QUEUE]',_0x9307('0x82'));_0x3011db[_0x9307('0x83')]=_0xaa07fe[_0x9307('0x84')]+'/api/voice/recordings/'+_0x3011db[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x3011db[_0x9307('0x85')]);}else{_0x3011db[_0x9307('0x83')]='';}var _0x50047f=_0xaa07fe[_0x9307('0x80')]===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0xaa07fe)[_0x9307('0x2c')](function(_0x15cebd){_0x5eb9a3=_0x15cebd;return getUser(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x311685['email']);})[_0x9307('0x2c')](function(_0x18c86c){_0x27744d=_0x18c86c;logger[_0x9307('0x31')]('The\x20User\x20ID\x20is:',_0x27744d['id']);return getEndUser(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x3011db[_0x9307('0x89')],_0x3011db[_0x9307('0x8a')],_0x27744d,_0x5aa4f5);})[_0x9307('0x2c')](function(_0x3cc958){_0x25a5b0=_0x3cc958;return getCall(_0x5eb9a3,_0x50047f,_0xaa07fe,_0x27744d,_0x25a5b0,_0x5aa4f5,_0x3011db,_0x9307('0x7a'));})[_0x9307('0x2c')](function(_0x5669a5){if(_0x5669a5){logger[_0x9307('0x31')]('The\x20Call\x20ID\x20is:',_0x5669a5['id']);logger[_0x9307('0x31')](_0x9307('0x8b'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9307('0x32')](_0x9307('0x8c'),_0x311685['name']),'trigger:browser:url',{'uri':_0x9307('0x8d')+_0xaa07fe['host']+_0x9307('0x8e')+_0x5669a5['id']});}})[_0x9307('0x2d')](function(_0x4b43ea){logger[_0x9307('0x2e')](_0x9307('0x8b'),JSON[_0x9307('0xe')](_0x4b43ea));});};exports[_0x9307('0x8f')]=function(_0x38aed,_0x4a346e,_0x533dab,_0x22343e,_0x174f50,_0x2a1f78,_0xc56931){var _0x30d373,_0x2eb8c2,_0x2e3d58;_0x2a1f78[_0x9307('0x80')]=intUtil[_0x9307('0x81')](_0x2a1f78[_0x9307('0x80')]);_0x2a1f78[_0x9307('0x84')]=intUtil[_0x9307('0x81')](_0x2a1f78['serverUrl']);if(_0xc56931&&_0xc56931[_0x9307('0x90')]&&_0xc56931[_0x9307('0x90')]!==_0x9307('0x91')){logger[_0x9307('0x31')]('[OUTBOUND]',_0x9307('0x82'));_0x4a346e[_0x9307('0x83')]=_0x2a1f78[_0x9307('0x84')]+_0x9307('0x92')+_0x4a346e[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x4a346e['uniqueid']);}var _0x3de6f6=_0x2a1f78['host']===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0x2a1f78)['then'](function(_0xa60585){_0x2e3d58=_0xa60585;return getUser(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x22343e[_0x9307('0x93')]);})[_0x9307('0x2c')](function(_0x55fea1){_0x30d373=_0x55fea1;logger[_0x9307('0x31')](_0x9307('0x94'),_0x30d373['id']);return getEndUser(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x4a346e[_0x9307('0x95')],_0x4a346e[_0x9307('0x96')],_0x30d373,_0x533dab);})[_0x9307('0x2c')](function(_0x315907){_0x2eb8c2=_0x315907;return getCall(_0x2e3d58,_0x3de6f6,_0x2a1f78,_0x30d373,_0x2eb8c2,_0x533dab,_0x4a346e,_0x9307('0x97'));})[_0x9307('0x2c')](function(_0x42d95b){if(_0x42d95b){logger['info'](_0x9307('0x98'),_0x42d95b['id']);logger[_0x9307('0x31')]('[OUTBOUND]',_0x9307('0x99'));emit(util[_0x9307('0x32')]('user:%s',_0x22343e['name']),_0x9307('0x9a'),{'uri':'https://crm.'+_0x2a1f78[_0x9307('0x80')]+_0x9307('0x8e')+_0x42d95b['id']});}})[_0x9307('0x2d')](function(_0x5afb6a){logger[_0x9307('0x2e')](_0x9307('0x9b'),JSON[_0x9307('0xe')](_0x5afb6a));});};exports[_0x9307('0x9c')]=function(_0x28557e,_0x15a632,_0x592047,_0x224b10,_0x447a03,_0x42a538){var _0x5a42a5,_0x5310ef,_0x46809c;_0x42a538['host']=intUtil['stripTrailingSlash'](_0x42a538[_0x9307('0x80')]);_0x42a538[_0x9307('0x84')]=intUtil[_0x9307('0x81')](_0x42a538['serverUrl']);if(_0x447a03&&_0x447a03[_0x9307('0x9d')]){logger['info']('['+_0x15a632['lastevent'][_0x9307('0x9e')]()+']','Recording\x20is\x20enabled!');_0x15a632[_0x9307('0x83')]=_0x42a538[_0x9307('0x84')]+'/api/voice/recordings/'+_0x15a632[_0x9307('0x85')]+_0x9307('0x86')+md5(_0x15a632[_0x9307('0x85')]);}else{_0x15a632[_0x9307('0x83')]='';}var _0x1fbc07=_0x42a538[_0x9307('0x80')]===_0x9307('0x87')?'eu':_0x9307('0x88');return getAccessToken(_0x42a538)[_0x9307('0x2c')](function(_0x374764){_0x46809c=_0x374764;return getUser(_0x46809c,_0x1fbc07,_0x42a538);})[_0x9307('0x2c')](function(_0x4b8073){_0x5a42a5=_0x4b8073;logger[_0x9307('0x31')]('The\x20User\x20ID\x20is:',_0x5a42a5['id']);return getEndUser(_0x46809c,_0x1fbc07,_0x42a538,_0x15a632[_0x9307('0x89')],_0x15a632[_0x9307('0x8a')],_0x5a42a5,_0x592047);})[_0x9307('0x2c')](function(_0x16ad54){_0x5310ef=_0x16ad54;return getCall(_0x46809c,_0x1fbc07,_0x42a538,_0x5a42a5,_0x5310ef,_0x592047,_0x15a632,'Inbound');})['then'](function(_0x48d82a){if(_0x48d82a){logger[_0x9307('0x31')](_0x9307('0x98'),_0x48d82a['id']);}})[_0x9307('0x2d')](function(_0x152446){logger['error']('['+_0x15a632[_0x9307('0x6e')]['toUpperCase']()+']',JSON[_0x9307('0xe')](_0x152446));});}; \ No newline at end of file +var _0x6e12=['moduleCreate','role','first_name','last_name','data','details','Error:\x20','GET','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','getString','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','Call_Result','Answered','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','SUCCESS','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','[HTTP]','stringify','length','forEach','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase'];(function(_0x5aad99,_0x543969){var _0x442884=function(_0x234e24){while(--_0x234e24){_0x5aad99['push'](_0x5aad99['shift']());}};_0x442884(++_0x543969);}(_0x6e12,0xf2));var _0x26e1=function(_0x275834,_0x35a93b){_0x275834=_0x275834-0x0;var _0x102a06=_0x6e12[_0x275834];return _0x102a06;};'use strict';var _=require('lodash');var rp=require(_0x26e1('0x0'));var md5=require(_0x26e1('0x1'));var util=require(_0x26e1('0x2'));var intUtil=require(_0x26e1('0x3'));var moment=require(_0x26e1('0x4'));var Redis=require(_0x26e1('0x5'));var BPromise=require(_0x26e1('0x6'));var config=require(_0x26e1('0x7'));var logger=require(_0x26e1('0x8'))(_0x26e1('0x9'));config['redis']=_[_0x26e1('0xa')](config[_0x26e1('0xb')],{'host':_0x26e1('0xc'),'port':0x18eb});var io=require(_0x26e1('0xd'))(new Redis(config[_0x26e1('0xb')]));function emit(_0x3e101f,_0x580f78,_0x388d2d){io['to'](_0x3e101f)['emit'](_0x580f78,_0x388d2d);}function request(_0x325f2e){logger['debug'](_0x26e1('0xe'),JSON[_0x26e1('0xf')](_0x325f2e));return rp(_0x325f2e);}function getCustomFields(_0xea59df,_0x3c7c83){var _0x47763c={};if(_0xea59df[_0x26e1('0x10')]>0x0){_[_0x26e1('0x11')](_0xea59df,function(_0x53e05e){if(_['includes'](['string',_0x26e1('0x12')],_0x53e05e[_0x26e1('0x13')])&&_0x53e05e[_0x26e1('0x14')]){_0x47763c[_0x53e05e['idField']]=_0x53e05e[_0x26e1('0x15')][_0x26e1('0x16')]();}else if(_0x53e05e[_0x26e1('0x13')]===_0x26e1('0x17')&&_0x53e05e[_0x26e1('0x18')]&&_0x53e05e['idField']&&_0x3c7c83[_0x53e05e[_0x26e1('0x18')]]){_0x47763c[_0x53e05e[_0x26e1('0x14')]]=_0x3c7c83[_0x53e05e[_0x26e1('0x18')]][_0x26e1('0x16')]();}else if(_0x53e05e['type']===_0x26e1('0x19')&&_0x53e05e[_0x26e1('0x1a')]&&_0x53e05e[_0x26e1('0x1a')]['name']&&_0x53e05e[_0x26e1('0x14')]&&_0x3c7c83[_0x53e05e[_0x26e1('0x1a')][_0x26e1('0x1b')][_0x26e1('0x1c')]()]){_0x47763c[_0x53e05e[_0x26e1('0x14')]]=_0x3c7c83[_0x53e05e['Variable'][_0x26e1('0x1b')][_0x26e1('0x1c')]()][_0x26e1('0x16')]();}});}return _0x47763c;}function getName(_0x4e406f){if(_0x4e406f[_0x26e1('0x1d')]('\x20')>0x0){var _0xbebd23=_0x4e406f[_0x26e1('0x1e')](/ (.+)/);if(_0xbebd23[0x1]){return _0xbebd23;}}return[_0x4e406f,_0x4e406f];}var accountsTokens={};function getAccessToken(_0x31a180){return new Promise(function(_0x40dda2,_0x2c9fea){if(!_[_0x26e1('0x1f')](accountsTokens[_0x31a180['id']])&&!_[_0x26e1('0x1f')](accountsTokens[_0x31a180['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x31a180['id']][_0x26e1('0x20')])){_0x40dda2(accountsTokens[_0x31a180['id']][_0x26e1('0x21')]);}}var _0x1a4f38;switch(_0x31a180[_0x26e1('0x22')]){case'US':_0x1a4f38=_0x26e1('0x23');break;case'AU':_0x1a4f38=_0x26e1('0x24');break;case'EU':_0x1a4f38=_0x26e1('0x25');break;case'IN':_0x1a4f38=_0x26e1('0x26');break;case'CN':_0x1a4f38=_0x26e1('0x27');break;default:_0x1a4f38=_0x26e1('0x25');break;}var _0x1f5124={'method':_0x26e1('0x28'),'uri':_0x1a4f38+_0x26e1('0x29'),'qs':{'refresh_token':_0x31a180[_0x26e1('0x2a')],'client_id':_0x31a180[_0x26e1('0x2b')],'client_secret':_0x31a180[_0x26e1('0x2c')],'grant_type':_0x26e1('0x2d')},'json':!![]};return rp(_0x1f5124)[_0x26e1('0x2e')](function(_0x5afd3e){accountsTokens[_0x31a180['id']]={'access_token':_0x5afd3e['access_token'],'expires_in':moment()[_0x26e1('0x2f')](_0x5afd3e['expires_in'],_0x26e1('0x30'))};_0x40dda2(_0x5afd3e[_0x26e1('0x21')]);})['catch'](function(_0x356c29){logger['error']('Failing\x20creating\x20the\x20access_token',_0x356c29[_0x26e1('0x31')]);_0x2c9fea(_0x356c29);});});}function getUser(_0x542b03,_0x2b0c77,_0x58afc5,_0x396147){logger[_0x26e1('0x32')](_0x26e1('0x33'));return request({'method':'GET','uri':util['format'](_0x26e1('0x34'),_0x2b0c77),'qs':{'type':_0x26e1('0x35')},'headers':{'Authorization':_0x26e1('0x36')+_0x542b03},'json':!![]})[_0x26e1('0x2e')](function(_0x5ddaf6){if(_0x5ddaf6[_0x26e1('0x37')]){var _0x1e1f8b=-0x1;if(_[_0x26e1('0x38')](_0x5ddaf6[_0x26e1('0x37')])){if(!_['isNil'](_0x396147)){_0x1e1f8b=_[_0x26e1('0x39')](_0x5ddaf6[_0x26e1('0x37')],function(_0x212e33){return _0x212e33['email']===_0x396147;});}if(_0x1e1f8b>=0x0){logger[_0x26e1('0x32')]('Agent\x20found!');}else{logger['info'](_0x26e1('0x3a'));_0x1e1f8b=_[_0x26e1('0x39')](_0x5ddaf6[_0x26e1('0x37')],function(_0x380cf0){return _0x380cf0[_0x26e1('0x3b')][_0x26e1('0x1b')]===_0x26e1('0x3c');});}return _0x5ddaf6[_0x26e1('0x37')][_0x1e1f8b];}else{if(_0x5ddaf6[_0x26e1('0x3d')][_0x26e1('0x3b')][_0x26e1('0x1b')]==='Administrator'){logger['info'](_0x26e1('0x3a'));user=_0x5ddaf6[_0x26e1('0x3d')];return user;}else{logger['error'](_0x26e1('0x3e'),JSON[_0x26e1('0xf')](_0x5ddaf6));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x26e1('0xf')](_0x5ddaf6));}}}else{logger[_0x26e1('0x3f')](_0x26e1('0x3e'),JSON[_0x26e1('0xf')](_0x5ddaf6));throw new Error(_0x26e1('0x40')+JSON[_0x26e1('0xf')](_0x5ddaf6));}})['catch'](function(_0x351bc1){console[_0x26e1('0x3f')](_0x351bc1);});}function getZohoUser(_0x19a22b,_0x239159){return new BPromise(function(_0x480c2b,_0x155002){request(_0x19a22b)[_0x26e1('0x2e')](function(_0xbd0399){var _0x272b67=null;if(_0xbd0399){_0x272b67=_0xbd0399['data'][0x0];_0x272b67[_0x26e1('0x41')]=_0x239159;}_0x480c2b(_0x272b67);})[_0x26e1('0x42')](function(_0x49a71c){_0x155002(_0x49a71c);});});}function createEndUser(_0x27d976,_0x384e14,_0xec2570,_0x5dcd4c,_0x502f44,_0xad1e98){var _0xec2570=getName(_0xec2570);return request({'method':_0x26e1('0x28'),'uri':_0x26e1('0x43')+_0x384e14+_0x26e1('0x44')+_[_0x26e1('0x45')](_0xad1e98[_0x26e1('0x46')])+'s','body':{'data':[{'Last_Name':_0xec2570[0x1],'First_Name':_0xec2570[0x0],'Phone':_0x5dcd4c,'Owner':{'name':!_[_0x26e1('0x1f')](_0x502f44['role'][_0x26e1('0x1b')])?_0x502f44[_0x26e1('0x47')][_0x26e1('0x1b')]:!_[_0x26e1('0x1f')](_0x502f44['first_name'])?_0x502f44[_0x26e1('0x48')]+'\x20'+_0x502f44['last_name']:_0x502f44[_0x26e1('0x49')],'id':_0x502f44['id']}}]},'headers':{'Authorization':_0x26e1('0x36')+_0x27d976},'json':!![]})['then'](function(_0x65fcd5){if(_0x65fcd5&&_0x65fcd5[_0x26e1('0x4a')][0x0]['code']==='SUCCESS'){var _0x6c2258=_0x65fcd5[_0x26e1('0x4a')][0x0][_0x26e1('0x4b')];_0x6c2258[_0x26e1('0x41')]=_['startCase'](_0xad1e98['moduleCreate'])+'s';return _0x6c2258;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x26e1('0xf')](data));throw new Error(_0x26e1('0x4c')+JSON[_0x26e1('0xf')](data));})[_0x26e1('0x42')](function(_0x3f5ae5){console['log']('CREATE\x20ERROR',_0x3f5ae5);});}function getEndUser(_0x4d947a,_0x5d519b,_0x534bfe,_0x3a5733,_0x94822a,_0xae7ff5,_0x31a218){var _0x1b7c4c={'method':_0x26e1('0x4d'),'uri':'','headers':{'Authorization':_0x26e1('0x36')+_0x4d947a},'json':!![]};switch(_0x31a218[_0x26e1('0x4e')]){case'contact_lead':_0x1b7c4c['uri']=_0x26e1('0x43')+_0x5d519b+_0x26e1('0x4f')+_0x94822a+'))';return getZohoUser(_0x1b7c4c,'Contacts')[_0x26e1('0x2e')](function(_0x42256a){if(_0x42256a)return _0x42256a;_0x1b7c4c['uri']=_0x26e1('0x43')+_0x5d519b+_0x26e1('0x50')+_0x94822a+'))';return getZohoUser(_0x1b7c4c,'Leads')[_0x26e1('0x2e')](function(_0x436f22){if(_0x436f22)return _0x436f22;if(_0x31a218[_0x26e1('0x46')]!=_0x26e1('0x51')){return createEndUser(_0x4d947a,_0x5d519b,_0x3a5733,_0x94822a,_0xae7ff5,_0x31a218);}else{return{};}});});break;case _0x26e1('0x52'):_0x1b7c4c['uri']=_0x26e1('0x43')+_0x5d519b+_0x26e1('0x4f')+_0x94822a+'))';return getZohoUser(_0x1b7c4c,_0x26e1('0x53'))['then'](function(_0x589916){if(_0x589916)return _0x589916;if(_0x31a218['moduleCreate']!=_0x26e1('0x51')){return createEndUser(_0x4d947a,_0x5d519b,_0x3a5733,_0x94822a,_0xae7ff5,_0x31a218);}else{return{};}});break;case _0x26e1('0x54'):_0x1b7c4c['uri']='https://www.zohoapis.'+_0x5d519b+_0x26e1('0x50')+_0x94822a+'))';return getZohoUser(_0x1b7c4c,_0x26e1('0x55'))[_0x26e1('0x2e')](function(_0x2ea645){if(_0x2ea645)return _0x2ea645;if(_0x31a218[_0x26e1('0x46')]!=_0x26e1('0x51')){return createEndUser(_0x4d947a,_0x5d519b,_0x3a5733,_0x94822a,_0xae7ff5,_0x31a218);}else{return{};}});break;}}function getCall(_0x221b90,_0x1a5cdd,_0x2671f3,_0x5b7939,_0x2b711b,_0x5c8876,_0x31e3d8,_0xfc3e0b){logger['info'](_0x26e1('0x56'));var _0x147233={};_0x147233[_0x26e1('0x57')]={'name':!_[_0x26e1('0x1f')](_0x5b7939[_0x26e1('0x47')][_0x26e1('0x1b')])&&!_[_0x26e1('0x1f')](_0x5b7939['profile'][_0x26e1('0x1b')])&&_0x5b7939[_0x26e1('0x3b')][_0x26e1('0x1b')]===_0x26e1('0x58')?_0x5b7939[_0x26e1('0x47')]['name']:!_[_0x26e1('0x1f')](_0x5b7939['first_name'])?_0x5b7939[_0x26e1('0x48')]+'\x20'+_0x5b7939[_0x26e1('0x49')]:_0x5b7939['last_name'],'id':_0x5b7939['id']};_0x147233[_0x26e1('0x59')]=intUtil['getString'](_0x5c8876[_0x26e1('0x5a')],_0x31e3d8,'\x20');_0x147233['Description']=intUtil[_0x26e1('0x5b')](_0x5c8876['Descriptions'],_0x31e3d8,'\x0a');if(_0x2b711b[_0x26e1('0x41')]===_0x26e1('0x53')){_0x147233['Who_Id']={'name':!_[_0x26e1('0x1f')](_0x2b711b[_0x26e1('0x5c')])?_0x2b711b[_0x26e1('0x5c')]:!_[_0x26e1('0x1f')](_0x2b711b[_0x26e1('0x5d')])?_0x2b711b[_0x26e1('0x5d')]+'\x20'+_0x2b711b[_0x26e1('0x5e')]:_0x2b711b[_0x26e1('0x5e')],'id':_0x2b711b['id']};}if(_0x2b711b['enduserType']===_0x26e1('0x55')){_0x147233[_0x26e1('0x5f')]={'name':!_[_0x26e1('0x1f')](_0x2b711b['Full_Name'])?_0x2b711b[_0x26e1('0x5c')]:!_[_0x26e1('0x1f')](_0x2b711b['First_Name'])?_0x2b711b[_0x26e1('0x5d')]+'\x20'+_0x2b711b[_0x26e1('0x5e')]:_0x2b711b[_0x26e1('0x5e')],'id':_0x2b711b['id']};_0x147233[_0x26e1('0x60')]=_[_0x26e1('0x45')](_0x2b711b[_0x26e1('0x41')]);}if(_0x31e3d8[_0x26e1('0x61')]){_0x147233['Call_Duration']=moment[_0x26e1('0x62')](parseInt(_0x31e3d8[_0x26e1('0x61')])*0x3e8)['format'](_0x26e1('0x63'));}else if(_0x31e3d8[_0x26e1('0x64')]&&_0x31e3d8[_0x26e1('0x65')]){_0x147233[_0x26e1('0x66')]=moment['utc'](moment(_0x31e3d8[_0x26e1('0x65')],_0x26e1('0x67'))[_0x26e1('0x68')](moment(_0x31e3d8[_0x26e1('0x69')],_0x26e1('0x67'))))[_0x26e1('0x6a')]('mm:ss');}switch(_0x31e3d8[_0x26e1('0x6b')]){case'called':_0x147233[_0x26e1('0x6c')]='Called';break;case'complete':case'connect':_0x147233[_0x26e1('0x6c')]=_0x26e1('0x6d');break;case'rejected':_0x147233[_0x26e1('0x6c')]=_0x26e1('0x6e');break;case _0x26e1('0x6f'):_0x147233[_0x26e1('0x6c')]='Abandoned';break;case _0x26e1('0x70'):_0x147233[_0x26e1('0x6c')]=_0x26e1('0x71');default:}_0x147233[_0x26e1('0x72')]=(_0xfc3e0b===_0x26e1('0x73')?moment(_0x31e3d8[_0x26e1('0x69')])[_0x26e1('0x6a')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x31e3d8[_0x26e1('0x74')])[_0x26e1('0x6a')](_0x26e1('0x67')))||moment()[_0x26e1('0x6a')]('YYYY-MM-DDTHH:mm:ss');_0x147233[_0x26e1('0x75')]=_0xfc3e0b||_0x26e1('0x76');_0x147233=_[_0x26e1('0x77')](_0x147233,getCustomFields(_0x5c8876[_0x26e1('0x78')],_0x31e3d8));return request({'method':_0x26e1('0x28'),'uri':_0x26e1('0x43')+_0x1a5cdd+_0x26e1('0x79'),'headers':{'Authorization':_0x26e1('0x36')+_0x221b90},'body':{'data':[_0x147233]},'json':!![]})[_0x26e1('0x2e')](function(_0x451bc8){if(_0x451bc8&&_0x451bc8[_0x26e1('0x4a')][0x0][_0x26e1('0x7a')]===_0x26e1('0x7b')){logger[_0x26e1('0x32')](_0x26e1('0x7c'));return{'id':_0x451bc8[_0x26e1('0x4a')][0x0][_0x26e1('0x4b')]['id']};}})[_0x26e1('0x42')](function(_0x1644ef){logger['info'](_0x26e1('0x7d'),_0x1644ef[_0x26e1('0x31')]);console[_0x26e1('0x7e')]('err',_0x1644ef);});}exports[_0x26e1('0x7f')]=function(_0x313caa,_0x48288e,_0x207010,_0xb1f6e5,_0x52de34,_0x2af291){var _0x569782,_0x3c3407,_0x22acd2;_0x2af291[_0x26e1('0x80')]=intUtil[_0x26e1('0x81')](_0x2af291[_0x26e1('0x80')]);_0x2af291[_0x26e1('0x82')]=intUtil['stripTrailingSlash'](_0x2af291[_0x26e1('0x82')]);if(_0x52de34&&_0x52de34[_0x26e1('0x83')]){logger[_0x26e1('0x32')]('[QUEUE]',_0x26e1('0x84'));_0x48288e['recordingURL']=_0x2af291[_0x26e1('0x82')]+_0x26e1('0x85')+_0x48288e['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x48288e[_0x26e1('0x86')]);}else{_0x48288e[_0x26e1('0x87')]='';}var _0x33f792=_0x2af291[_0x26e1('0x80')]===_0x26e1('0x88')?'eu':_0x26e1('0x89');return getAccessToken(_0x2af291)[_0x26e1('0x2e')](function(_0x52ad22){_0x22acd2=_0x52ad22;return getUser(_0x22acd2,_0x33f792,_0x2af291,_0xb1f6e5[_0x26e1('0x8a')]);})[_0x26e1('0x2e')](function(_0x32ea17){_0x569782=_0x32ea17;logger[_0x26e1('0x32')](_0x26e1('0x8b'),_0x569782['id']);return getEndUser(_0x22acd2,_0x33f792,_0x2af291,_0x48288e[_0x26e1('0x8c')],_0x48288e[_0x26e1('0x8d')],_0x569782,_0x207010);})[_0x26e1('0x2e')](function(_0x36b560){_0x3c3407=_0x36b560;return getCall(_0x22acd2,_0x33f792,_0x2af291,_0x569782,_0x3c3407,_0x207010,_0x48288e,'Inbound');})[_0x26e1('0x2e')](function(_0x24ce8b){if(_0x24ce8b){logger[_0x26e1('0x32')]('The\x20Call\x20ID\x20is:',_0x24ce8b['id']);logger['info'](_0x26e1('0x8e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x26e1('0x6a')](_0x26e1('0x8f'),_0xb1f6e5['name']),'trigger:browser:url',{'uri':_0x26e1('0x90')+_0x2af291[_0x26e1('0x80')]+_0x26e1('0x91')+_0x24ce8b['id']});}})[_0x26e1('0x42')](function(_0x3d01a5){logger[_0x26e1('0x3f')](_0x26e1('0x8e'),JSON[_0x26e1('0xf')](_0x3d01a5));});};exports[_0x26e1('0x73')]=function(_0x283bed,_0x2425d9,_0x5ab7dc,_0x1a675f,_0x1b1f33,_0x259050,_0x2fddd9){var _0x5d95bf,_0x3fb3f3,_0x1c273a;_0x259050[_0x26e1('0x80')]=intUtil[_0x26e1('0x81')](_0x259050['host']);_0x259050[_0x26e1('0x82')]=intUtil[_0x26e1('0x81')](_0x259050['serverUrl']);if(_0x2fddd9&&_0x2fddd9[_0x26e1('0x92')]&&_0x2fddd9[_0x26e1('0x92')]!==_0x26e1('0x93')){logger[_0x26e1('0x32')](_0x26e1('0x94'),_0x26e1('0x84'));_0x2425d9[_0x26e1('0x87')]=_0x259050[_0x26e1('0x82')]+_0x26e1('0x85')+_0x2425d9['uniqueid']+_0x26e1('0x95')+md5(_0x2425d9['uniqueid']);}var _0x2f5a25=_0x259050[_0x26e1('0x80')]===_0x26e1('0x88')?'eu':_0x26e1('0x89');return getAccessToken(_0x259050)[_0x26e1('0x2e')](function(_0x463ccf){_0x1c273a=_0x463ccf;return getUser(_0x1c273a,_0x2f5a25,_0x259050,_0x1a675f[_0x26e1('0x8a')]);})['then'](function(_0x455d69){_0x5d95bf=_0x455d69;logger[_0x26e1('0x32')](_0x26e1('0x8b'),_0x5d95bf['id']);return getEndUser(_0x1c273a,_0x2f5a25,_0x259050,_0x2425d9[_0x26e1('0x96')],_0x2425d9[_0x26e1('0x97')],_0x5d95bf,_0x5ab7dc);})['then'](function(_0x2f842a){_0x3fb3f3=_0x2f842a;return getCall(_0x1c273a,_0x2f5a25,_0x259050,_0x5d95bf,_0x3fb3f3,_0x5ab7dc,_0x2425d9,'Outbound');})[_0x26e1('0x2e')](function(_0x206c76){if(_0x206c76){logger[_0x26e1('0x32')](_0x26e1('0x98'),_0x206c76['id']);logger[_0x26e1('0x32')]('[OUTBOUND]',_0x26e1('0x99'));emit(util['format'](_0x26e1('0x8f'),_0x1a675f[_0x26e1('0x1b')]),_0x26e1('0x9a'),{'uri':_0x26e1('0x90')+_0x259050[_0x26e1('0x80')]+_0x26e1('0x91')+_0x206c76['id']});}})['catch'](function(_0x4f2af5){logger[_0x26e1('0x3f')](_0x26e1('0x94'),JSON['stringify'](_0x4f2af5));});};exports['unmanaged']=function(_0x46e752,_0x4038cd,_0x364bf5,_0xa6907d,_0x26d17a,_0x532a6a){var _0x2516db,_0x563b9f,_0x2a1899;_0x532a6a[_0x26e1('0x80')]=intUtil[_0x26e1('0x81')](_0x532a6a[_0x26e1('0x80')]);_0x532a6a[_0x26e1('0x82')]=intUtil[_0x26e1('0x81')](_0x532a6a[_0x26e1('0x82')]);if(_0x26d17a&&_0x26d17a['monitor_format']){logger[_0x26e1('0x32')]('['+_0x4038cd[_0x26e1('0x6b')][_0x26e1('0x9b')]()+']',_0x26e1('0x84'));_0x4038cd[_0x26e1('0x87')]=_0x532a6a['serverUrl']+_0x26e1('0x85')+_0x4038cd[_0x26e1('0x86')]+_0x26e1('0x95')+md5(_0x4038cd[_0x26e1('0x86')]);}else{_0x4038cd[_0x26e1('0x87')]='';}var _0x32fdee=_0x532a6a[_0x26e1('0x80')]==='zoho.eu'?'eu':_0x26e1('0x89');return getAccessToken(_0x532a6a)['then'](function(_0x4c4eef){_0x2a1899=_0x4c4eef;return getUser(_0x2a1899,_0x32fdee,_0x532a6a);})[_0x26e1('0x2e')](function(_0x2c2483){_0x2516db=_0x2c2483;logger['info'](_0x26e1('0x8b'),_0x2516db['id']);return getEndUser(_0x2a1899,_0x32fdee,_0x532a6a,_0x4038cd[_0x26e1('0x8c')],_0x4038cd[_0x26e1('0x8d')],_0x2516db,_0x364bf5);})[_0x26e1('0x2e')](function(_0xdb3ee3){_0x563b9f=_0xdb3ee3;return getCall(_0x2a1899,_0x32fdee,_0x532a6a,_0x2516db,_0x563b9f,_0x364bf5,_0x4038cd,'Inbound');})[_0x26e1('0x2e')](function(_0x3f051a){if(_0x3f051a){logger[_0x26e1('0x32')](_0x26e1('0x98'),_0x3f051a['id']);}})[_0x26e1('0x42')](function(_0x2e3eec){logger[_0x26e1('0x3f')]('['+_0x4038cd[_0x26e1('0x6b')][_0x26e1('0x9b')]()+']',JSON['stringify'](_0x2e3eec));});}; \ 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 316f514..97095f0 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 _0x5edb=['data2','Script','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5edb,0xc7));var _0xb5ed=function(_0x406c31,_0x5a2ba0){_0x406c31=_0x406c31-0x0;var _0x4c6efa=_0x5edb[_0x406c31];return _0x4c6efa;};'use strict';var util=require('util');var sh=require(_0xb5ed('0x0'));var Mustache=require(_0xb5ed('0x1'));var logger=require(_0xb5ed('0x2'))(_0xb5ed('0x3'));exports[_0xb5ed('0x4')]=function(_0x4d34ac,_0x1cf122){var _0x4494f3=_0x4d34ac[_0xb5ed('0x5')]?_0x4d34ac[_0xb5ed('0x5')]:_0xb5ed('0x6');var _0x328c54=_0x4d34ac['data3']?Mustache[_0xb5ed('0x7')](_0x4d34ac['data3'],_0x1cf122):_0x1cf122;sh['exec'](_0x328c54,function(_0x2205ad,_0x25bf1e,_0x573a81){if(_0x2205ad!==0x0){logger[_0xb5ed('0x8')](util[_0xb5ed('0x9')](_0xb5ed('0xa'),_0x4494f3,_0x328c54,_0x2205ad,_0x573a81));}else{logger['info'](util[_0xb5ed('0x9')](_0xb5ed('0xb'),_0x4494f3,_0x328c54,_0x25bf1e));}});}; \ No newline at end of file +var _0x713f=['Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x41cb1e,_0x1b3c1b){var _0x37a277=function(_0x36a0c6){while(--_0x36a0c6){_0x41cb1e['push'](_0x41cb1e['shift']());}};_0x37a277(++_0x1b3c1b);}(_0x713f,0x9e));var _0xf713=function(_0x559f34,_0x38fd3b){_0x559f34=_0x559f34-0x0;var _0x28a6e1=_0x713f[_0x559f34];return _0x28a6e1;};'use strict';var util=require(_0xf713('0x0'));var sh=require(_0xf713('0x1'));var Mustache=require(_0xf713('0x2'));var logger=require(_0xf713('0x3'))(_0xf713('0x4'));exports[_0xf713('0x5')]=function(_0x5ebfb6,_0x1d8136){var _0x15f8fd=_0x5ebfb6['data2']?_0x5ebfb6[_0xf713('0x6')]:_0xf713('0x7');var _0x125f7e=_0x5ebfb6[_0xf713('0x8')]?Mustache[_0xf713('0x9')](_0x5ebfb6['data3'],_0x1d8136):_0x1d8136;sh[_0xf713('0x5')](_0x125f7e,function(_0xc17d33,_0x5803a0,_0x46cb11){if(_0xc17d33!==0x0){logger[_0xf713('0xa')](util['format'](_0xf713('0xb'),_0x15f8fd,_0x125f7e,_0xc17d33,_0x46cb11));}else{logger[_0xf713('0xc')](util[_0xf713('0xd')](_0xf713('0xe'),_0x15f8fd,_0x125f7e,_0x5803a0));}});}; \ 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 5dd9a26..294a0fb 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 _0xd195=['number','data6','parse','error','stack','GET','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data5'];(function(_0x1d0113,_0x36f7d6){var _0x5c29e6=function(_0x75d19f){while(--_0x75d19f){_0x1d0113['push'](_0x1d0113['shift']());}};_0x5c29e6(++_0x36f7d6);}(_0xd195,0xb6));var _0x5d19=function(_0x25b98f,_0x45e6b8){_0x25b98f=_0x25b98f-0x0;var _0x207d50=_0xd195[_0x25b98f];return _0x207d50;};'use strict';var rp=require(_0x5d19('0x0'));var util=require(_0x5d19('0x1'));var _=require(_0x5d19('0x2'));var Mustache=require(_0x5d19('0x3'));var logger=require('../../../../config/logger')(_0x5d19('0x4'));exports[_0x5d19('0x5')]=function(_0x4215cf,_0x4bc26f){var _0x290f65,_0x4ab60f;var _0x482703={'method':_0x4215cf[_0x5d19('0x6')][_0x5d19('0x7')](),'uri':Mustache[_0x5d19('0x8')](_0x4215cf['data2'],_0x4bc26f),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4215cf[_0x5d19('0x9')])===_0x5d19('0xa')&&parseInt(_0x4215cf[_0x5d19('0x9')])>=0x1&&parseInt(_0x4215cf[_0x5d19('0x9')])<=0xa?parseInt(_0x4215cf[_0x5d19('0x9')])*0x3e8:0x5*0x3e8};try{_0x482703['headers']=_0x4215cf[_0x5d19('0xb')]?JSON[_0x5d19('0xc')](Mustache['render'](_0x4215cf[_0x5d19('0xb')],_0x4bc26f)):{};}catch(_0x219dd4){logger[_0x5d19('0xd')](_0x219dd4[_0x5d19('0xe')]);}switch(_0x4215cf[_0x5d19('0x6')]['toUpperCase']()){case _0x5d19('0xf'):case _0x5d19('0x10'):_0x290f65=null;_0x482703['qs']=_0x4bc26f;break;case _0x5d19('0x11'):case'PUT':if(_0x4215cf[_0x5d19('0x12')]){try{_0x290f65=JSON[_0x5d19('0xc')](Mustache[_0x5d19('0x8')](_0x4215cf['data7'],_0x4bc26f));_0x482703[_0x5d19('0x13')]=_0x290f65;}catch(_0x5289ba){logger[_0x5d19('0xd')](_0x5289ba[_0x5d19('0xe')]);logger[_0x5d19('0xd')](_0x5d19('0x14'));}}else{_0x290f65=_0x4bc26f;_0x482703['body']=_0x290f65;}break;}logger[_0x5d19('0x15')](util[_0x5d19('0x16')](_0x5d19('0x17'),_0x4215cf[_0x5d19('0x6')],_0x4215cf[_0x5d19('0x18')],JSON[_0x5d19('0x19')](_0x482703)));rp(_0x482703)[_0x5d19('0x1a')](function(_0x424737){_0x290f65=!_['isNil'](_0x290f65)?_0x5d19('0x1b')+_0x290f65:'';_0x4ab60f=typeof _0x424737[_0x5d19('0x13')]===_0x5d19('0x1c')?JSON[_0x5d19('0x19')](_0x424737['body']):_0x424737['body'];logger['info'](util['format'](_0x5d19('0x1d'),_0x4215cf[_0x5d19('0x6')],_0x4215cf[_0x5d19('0x18')],_0x424737[_0x5d19('0x1e')],_0x4ab60f));})['catch'](function(_0x5ef92f){logger[_0x5d19('0xd')](util[_0x5d19('0x16')](_0x5d19('0x1f'),_0x4215cf['data1'],_0x4215cf[_0x5d19('0x18')],_0x5ef92f['statusCode'],_0x5ef92f['name'],_0x5ef92f['message']));});}; \ No newline at end of file +var _0x9f07=['name','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','render','data2','number','data5','data6','parse','error','stack','toUpperCase','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x23a9ff,_0x216960){var _0x28f274=function(_0x3b9bad){while(--_0x3b9bad){_0x23a9ff['push'](_0x23a9ff['shift']());}};_0x28f274(++_0x216960);}(_0x9f07,0x12a));var _0x79f0=function(_0x2d0733,_0x5a1e06){_0x2d0733=_0x2d0733-0x0;var _0x50ad90=_0x9f07[_0x2d0733];return _0x50ad90;};'use strict';var rp=require(_0x79f0('0x0'));var util=require(_0x79f0('0x1'));var _=require(_0x79f0('0x2'));var Mustache=require('mustache');var logger=require(_0x79f0('0x3'))(_0x79f0('0x4'));exports[_0x79f0('0x5')]=function(_0x170ca0,_0xd16757){var _0x2995ea,_0x9c1268;var _0x1d3406={'method':_0x170ca0[_0x79f0('0x6')]['toUpperCase'](),'uri':Mustache[_0x79f0('0x7')](_0x170ca0[_0x79f0('0x8')],_0xd16757),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x170ca0['data5'])===_0x79f0('0x9')&&parseInt(_0x170ca0[_0x79f0('0xa')])>=0x1&&parseInt(_0x170ca0['data5'])<=0xa?parseInt(_0x170ca0['data5'])*0x3e8:0x5*0x3e8};try{_0x1d3406['headers']=_0x170ca0[_0x79f0('0xb')]?JSON[_0x79f0('0xc')](Mustache[_0x79f0('0x7')](_0x170ca0[_0x79f0('0xb')],_0xd16757)):{};}catch(_0x3c76f8){logger[_0x79f0('0xd')](_0x3c76f8[_0x79f0('0xe')]);}switch(_0x170ca0['data1'][_0x79f0('0xf')]()){case _0x79f0('0x10'):case _0x79f0('0x11'):_0x2995ea=null;_0x1d3406['qs']=_0xd16757;break;case'POST':case _0x79f0('0x12'):if(_0x170ca0[_0x79f0('0x13')]){try{_0x2995ea=JSON[_0x79f0('0xc')](Mustache[_0x79f0('0x7')](_0x170ca0[_0x79f0('0x13')],_0xd16757));_0x1d3406[_0x79f0('0x14')]=_0x2995ea;}catch(_0x40277f){logger[_0x79f0('0xd')](_0x40277f[_0x79f0('0xe')]);logger[_0x79f0('0xd')](_0x79f0('0x15'));}}else{_0x2995ea=_0xd16757;_0x1d3406[_0x79f0('0x14')]=_0x2995ea;}break;}logger['info'](util[_0x79f0('0x16')](_0x79f0('0x17'),_0x170ca0[_0x79f0('0x6')],_0x170ca0[_0x79f0('0x8')],JSON[_0x79f0('0x18')](_0x1d3406)));rp(_0x1d3406)[_0x79f0('0x19')](function(_0x5a74c0){_0x2995ea=!_[_0x79f0('0x1a')](_0x2995ea)?_0x79f0('0x1b')+_0x2995ea:'';_0x9c1268=typeof _0x5a74c0['body']===_0x79f0('0x1c')?JSON[_0x79f0('0x18')](_0x5a74c0['body']):_0x5a74c0[_0x79f0('0x14')];logger['info'](util[_0x79f0('0x16')](_0x79f0('0x1d'),_0x170ca0[_0x79f0('0x6')],_0x170ca0[_0x79f0('0x8')],_0x5a74c0[_0x79f0('0x1e')],_0x9c1268));})['catch'](function(_0x2e2db5){logger['error'](util[_0x79f0('0x16')](_0x79f0('0x1f'),_0x170ca0['data1'],_0x170ca0[_0x79f0('0x8')],_0x2e2db5[_0x79f0('0x1e')],_0x2e2db5[_0x79f0('0x20')],_0x2e2db5['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e0e2174..959b61c 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 _0x0efe=['then','debug','error','rpc','message','jayson/promise','bluebird','../../config/logger','routing','client','Request','request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0efe,0x101));var _0xe0ef=function(_0x2888f7,_0x1e6586){_0x2888f7=_0x2888f7-0x0;var _0x4f951f=_0x0efe[_0x2888f7];return _0x4f951f;};'use strict';var jayson=require(_0xe0ef('0x0'));var BPromise=require(_0xe0ef('0x1'));var logger=require(_0xe0ef('0x2'))(_0xe0ef('0x3'));var client=jayson[_0xe0ef('0x4')]['http']({'port':0x2329});client[_0xe0ef('0x5')]=function(_0xce7692,_0x26cda3){return new BPromise(function(_0xeec32e,_0x375edf){return client[_0xe0ef('0x6')](_0xce7692,_0x26cda3)[_0xe0ef('0x7')](function(_0x49dc49){logger[_0xe0ef('0x8')]('rpc',_0xe0ef('0x3'),_0xce7692,_0x26cda3,_0x49dc49);if(_0x49dc49[_0xe0ef('0x9')]){logger[_0xe0ef('0x9')](_0xe0ef('0xa'),'routing',_0xce7692,_0x49dc49[_0xe0ef('0x9')][_0xe0ef('0xb')],_0x26cda3);return _0x375edf(_0x49dc49['error']['message']);}else{return _0xeec32e(_0x49dc49['result']);}})['catch'](function(_0x5ecaf9){logger[_0xe0ef('0x9')](_0xe0ef('0xa'),'routing',_0xce7692,_0x5ecaf9,_0x26cda3);return _0x375edf(_0x5ecaf9);});});};module['exports']=client; \ No newline at end of file +var _0x02e9=['request','rpc','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x3ab3ad,_0x364f13){var _0x5e15dd=function(_0x11e7b1){while(--_0x11e7b1){_0x3ab3ad['push'](_0x3ab3ad['shift']());}};_0x5e15dd(++_0x364f13);}(_0x02e9,0xe3));var _0x902e=function(_0x3d31bf,_0x1ac24e){_0x3d31bf=_0x3d31bf-0x0;var _0x2a0fcc=_0x02e9[_0x3d31bf];return _0x2a0fcc;};'use strict';var jayson=require(_0x902e('0x0'));var BPromise=require(_0x902e('0x1'));var logger=require(_0x902e('0x2'))(_0x902e('0x3'));var client=jayson[_0x902e('0x4')][_0x902e('0x5')]({'port':0x2329});client[_0x902e('0x6')]=function(_0x54ebf9,_0x456e1a){return new BPromise(function(_0xb8826c,_0x508737){return client[_0x902e('0x7')](_0x54ebf9,_0x456e1a)['then'](function(_0x38efdf){logger['debug'](_0x902e('0x8'),_0x902e('0x3'),_0x54ebf9,_0x456e1a,_0x38efdf);if(_0x38efdf[_0x902e('0x9')]){logger[_0x902e('0x9')](_0x902e('0x8'),'routing',_0x54ebf9,_0x38efdf[_0x902e('0x9')][_0x902e('0xa')],_0x456e1a);return _0x508737(_0x38efdf['error'][_0x902e('0xa')]);}else{return _0xb8826c(_0x38efdf['result']);}})[_0x902e('0xb')](function(_0x44139d){logger[_0x902e('0x9')](_0x902e('0x8'),_0x902e('0x3'),_0x54ebf9,_0x44139d,_0x456e1a);return _0x508737(_0x44139d);});});};module[_0x902e('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5fa6887..4ce5d86 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 _0x4812=['refresh','mailAccounts','getSettings','loginMailFrequency','error','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x537e14,_0x3e1298){var _0x2f0523=function(_0x1bc091){while(--_0x1bc091){_0x537e14['push'](_0x537e14['shift']());}};_0x2f0523(++_0x3e1298);}(_0x4812,0xe5));var _0x2481=function(_0x174af4,_0x1eec81){_0x174af4=_0x174af4-0x0;var _0x49f3e1=_0x4812[_0x174af4];return _0x49f3e1;};'use strict';var server=require(_0x2481('0x0'));var Realtime=require(_0x2481('0x1'));var EmailChannel=require(_0x2481('0x2'));var mailAccount=require(_0x2481('0x3'));var setting=require(_0x2481('0x4'));var logger=require(_0x2481('0x5'))(_0x2481('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2481('0x7')]()[_0x2481('0x8')](mailAccount[_0x2481('0x9')]())['then'](realtime[_0x2481('0xa')]())[_0x2481('0x8')](function(){email[_0x2481('0xb')](realtime[_0x2481('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x2481('0x8')](function(){return initRealtime();})[_0x2481('0x8')](function(){return setting[_0x2481('0xd')]();})[_0x2481('0x8')](function(_0x5aa915){return setInterval(initRealtime,_0x5aa915[_0x2481('0xe')]*0x3e8);})['catch'](function(_0x25807d){logger[_0x2481('0xf')]('Email\x20service\x20initialization',_0x25807d);});}main(); \ No newline at end of file +var _0x556c=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x556c,0x1a9));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var server=require(_0xc556('0x0'));var Realtime=require(_0xc556('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc556('0x2'));var setting=require(_0xc556('0x3'));var logger=require(_0xc556('0x4'))(_0xc556('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc556('0x6')]()[_0xc556('0x7')](mailAccount[_0xc556('0x8')]())['then'](realtime[_0xc556('0x9')]())[_0xc556('0x7')](function(){email[_0xc556('0xa')](realtime[_0xc556('0xb')]);return realtime;});}function main(){return server[_0xc556('0xc')](realtime,email)[_0xc556('0x7')](function(){return initRealtime();})[_0xc556('0x7')](function(){return setting[_0xc556('0xd')]();})[_0xc556('0x7')](function(_0x4b3d16){return setInterval(initRealtime,_0x4b3d16[_0xc556('0xe')]*0x3e8);})[_0xc556('0xf')](function(_0x29b9b0){logger[_0xc556('0x10')](_0xc556('0x11'),_0x29b9b0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 7f91666..4426679 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 _0x0ace=['stringify','mailAccount:update','refresh','hasOwnProperty','active','service','custom','provider','box','handleImapBox','bind','handleImapEmail','handleImapEnd','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','catch','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','imapAccounts','smtp','prototype','emit','mailAccounts','name','key','Imap','status','messageStatus','isNil'];(function(_0x58d488,_0x9afd95){var _0x3b8503=function(_0x5a0de6){while(--_0x5a0de6){_0x58d488['push'](_0x58d488['shift']());}};_0x3b8503(++_0x9afd95);}(_0x0ace,0x1cf));var _0xe0ac=function(_0x4370c7,_0x5dbfb0){_0x4370c7=_0x4370c7-0x0;var _0xce78a9=_0x0ace[_0x4370c7];return _0xce78a9;};'use strict';var _=require(_0xe0ac('0x0'));var moment=require(_0xe0ac('0x1'));var BPromise=require(_0xe0ac('0x2'));var md5=require(_0xe0ac('0x3'));var Redis=require(_0xe0ac('0x4'));var config=require(_0xe0ac('0x5'));var logger=require(_0xe0ac('0x6'))(_0xe0ac('0x7'));config[_0xe0ac('0x8')]=_['defaults'](config[_0xe0ac('0x8')],{'host':_0xe0ac('0x9'),'port':0x18eb});var io=require(_0xe0ac('0xa'))(new Redis(config[_0xe0ac('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xe0ac('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1b2aa1){logger[_0xe0ac('0xc')](_0xe0ac('0xd'));this['mailAccounts']=_0x1b2aa1['mailAccounts'];this[_0xe0ac('0xe')]={};this[_0xe0ac('0xf')]=new EmailSmtp();}EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x11')]=function(_0x169533){var _0x2f5664=this[_0xe0ac('0x12')][_0x169533];var _0x4e0425={'id':_0x2f5664['id'],'name':_0x2f5664[_0xe0ac('0x13')],'key':_0x2f5664[_0xe0ac('0x14')],'active':_0x2f5664['active'],'Imap':{'status':_0x2f5664[_0xe0ac('0x15')][_0xe0ac('0x16')],'messageStatus':_0x2f5664[_0xe0ac('0x15')][_0xe0ac('0x17')],'total':_0x2f5664[_0xe0ac('0x15')]['total']}};if(_[_0xe0ac('0x18')](md5Accounts[_0x169533])){md5Accounts[_0x169533]={};}var _0x565d49=md5(JSON[_0xe0ac('0x19')](_0x4e0425));if(md5Accounts[_0x169533]['md5']!==_0x565d49){md5Accounts[_0x169533]['md5']=_0x565d49;io[_0xe0ac('0x11')](_0xe0ac('0x1a'),_0x4e0425);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x1b')]=function(_0x576b62){for(var _0x5a91e0 in _0x576b62){if(_0x576b62[_0xe0ac('0x1c')](_0x5a91e0)){if(_0x576b62[_0x5a91e0][_0xe0ac('0x15')]&&_0x576b62[_0x5a91e0][_0xe0ac('0x1d')]){var _0x5122c1=_0x576b62[_0x5a91e0][_0xe0ac('0x15')];if(!_0x5122c1[_0xe0ac('0x1e')]&&_0x576b62[_0x5a91e0]['provider']!==_0xe0ac('0x1f'))_0x5122c1[_0xe0ac('0x1e')]=_0x576b62[_0x5a91e0][_0xe0ac('0x20')];if(!this[_0xe0ac('0xe')][_0xe0ac('0x1c')](_0x5122c1['id'])){this['imapAccounts'][_0x5122c1['id']]=new EmailImap(_0x5122c1,_0x576b62[_0x5a91e0][_0xe0ac('0x7')]);this[_0xe0ac('0xe')][_0x5122c1['id']]['on'](_0xe0ac('0x21'),this[_0xe0ac('0x22')][_0xe0ac('0x23')](this,_0x5a91e0));this['imapAccounts'][_0x5122c1['id']]['on'](_0xe0ac('0x7'),this[_0xe0ac('0x24')][_0xe0ac('0x23')](this,_0x5a91e0));this[_0xe0ac('0xe')][_0x5122c1['id']]['on']('end',this[_0xe0ac('0x25')][_0xe0ac('0x23')](this,_0x5a91e0));this['imapAccounts'][_0x5122c1['id']]['on']('error',this[_0xe0ac('0x26')][_0xe0ac('0x23')](this,_0x5a91e0));}}else{if(_['isNil'](this[_0xe0ac('0x12')][_0x5a91e0]['Imap'])){this[_0xe0ac('0x12')][_0x5a91e0][_0xe0ac('0x15')]={};}this[_0xe0ac('0x12')][_0x5a91e0][_0xe0ac('0x15')][_0xe0ac('0x16')]=_0xe0ac('0x27');this['mailAccounts'][_0x5a91e0]['Imap'][_0xe0ac('0x17')]='';this[_0xe0ac('0x11')](_0x5a91e0);}}}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x22')]=function(_0xd18eac,_0x14afe1){if(this[_0xe0ac('0x12')][_0xd18eac]){this[_0xe0ac('0x12')][_0xd18eac]['Imap']['status']=_0xe0ac('0x28');this['mailAccounts'][_0xd18eac]['Imap'][_0xe0ac('0x17')]=_0x14afe1['name'];if(_0x14afe1[_0xe0ac('0x29')]){this[_0xe0ac('0x12')][_0xd18eac][_0xe0ac('0x15')]['total']=_0x14afe1[_0xe0ac('0x29')][_0xe0ac('0x2a')];}return this[_0xe0ac('0x11')](_0xd18eac);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x24')]=function(_0x4b6cdd,_0x436dd2){logger[_0xe0ac('0xc')](_0xe0ac('0x2b'),_0x436dd2[_0xe0ac('0x2c')],_0x436dd2[_0xe0ac('0x2d')],_0x436dd2[_0xe0ac('0x2e')],_0x4b6cdd);if(this['mailAccounts'][_0x4b6cdd]){return mailAccount[_0xe0ac('0x2f')](_0x4b6cdd,_0x436dd2)[_0xe0ac('0x30')](function(_0x2cae8b){if(_0x2cae8b){logger['info'](_0xe0ac('0x31'));}})['catch'](function(_0x50e304){logger[_0xe0ac('0x32')](_0xe0ac('0x33'),JSON['stringify'](_0x50e304));});}};EmailChannel['prototype'][_0xe0ac('0x25')]=function(_0x5a4539){if(this['mailAccounts'][_0x5a4539]&&this['mailAccounts'][_0x5a4539][_0xe0ac('0x15')]){if(this['imapAccounts'][this[_0xe0ac('0x12')][_0x5a4539]['Imap']['id']]){delete this[_0xe0ac('0xe')][this[_0xe0ac('0x12')][_0x5a4539][_0xe0ac('0x15')]['id']];}this[_0xe0ac('0x12')][_0x5a4539]['Imap'][_0xe0ac('0x34')]=moment();this[_0xe0ac('0x11')](_0x5a4539);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x26')]=function(_0x55e6fa,_0xec3ffd){if(this[_0xe0ac('0x12')][_0x55e6fa]){this[_0xe0ac('0x12')][_0x55e6fa][_0xe0ac('0x15')][_0xe0ac('0x16')]=_0xe0ac('0x32');this['mailAccounts'][_0x55e6fa][_0xe0ac('0x15')][_0xe0ac('0x17')]=_0xec3ffd;return this['emit'](_0x55e6fa);}};EmailChannel[_0xe0ac('0x10')][_0xe0ac('0x35')]=function(_0x3adbae,_0x418f8e){return this[_0xe0ac('0xf')][_0xe0ac('0x36')](_0x3adbae,_0x418f8e);};EmailChannel['prototype'][_0xe0ac('0x37')]=function(_0x114af3){var _0x12513e=this;if(this[_0xe0ac('0x12')][_0x114af3['id']]){if(_[_0xe0ac('0x18')](this[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')])){this[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')]={};}this[_0xe0ac('0x12')][_0x114af3['id']]['Smtp'][_0xe0ac('0x34')]=moment();return new BPromise(function(_0x20f029,_0x2cc246){return _0x12513e[_0xe0ac('0xf')]['verify'](_0x114af3)[_0xe0ac('0x30')](function(_0x225e9f){_0x12513e[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')][_0xe0ac('0x16')]=_0xe0ac('0x39');_0x12513e['mailAccounts'][_0x114af3['id']][_0xe0ac('0x38')][_0xe0ac('0x17')]='';_0x12513e[_0xe0ac('0x11')](_0x114af3['id']);_0x20f029(_0x225e9f);})[_0xe0ac('0x3a')](function(_0x5d74bc){_0x12513e[_0xe0ac('0x12')][_0x114af3['id']][_0xe0ac('0x38')]['status']=_0xe0ac('0x32');_0x12513e['mailAccounts'][_0x114af3['id']][_0xe0ac('0x38')]['messageStatus']=_0x5d74bc;_0x12513e[_0xe0ac('0x11')](_0x114af3['id']);_0x2cc246(_0x5d74bc);});});}return this[_0xe0ac('0xf')][_0xe0ac('0x3b')](_0x114af3);};module[_0xe0ac('0x3c')]=EmailChannel; \ No newline at end of file +var _0x4f97=['end','handleImapEnd','error','handleImapError','disabled','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','handleImapBox','bind','handleImapEmail'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4f97,0x1c3));var _0x74f9=function(_0x5ac9b1,_0x54e897){_0x5ac9b1=_0x5ac9b1-0x0;var _0x19e2c0=_0x4f97[_0x5ac9b1];return _0x19e2c0;};'use strict';var _=require(_0x74f9('0x0'));var moment=require(_0x74f9('0x1'));var BPromise=require(_0x74f9('0x2'));var md5=require(_0x74f9('0x3'));var Redis=require(_0x74f9('0x4'));var config=require(_0x74f9('0x5'));var logger=require(_0x74f9('0x6'))(_0x74f9('0x7'));config[_0x74f9('0x8')]=_[_0x74f9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x74f9('0xa'))(new Redis(config[_0x74f9('0x8')]));var EmailImap=require(_0x74f9('0xb'));var EmailSmtp=require(_0x74f9('0xc'));var mailAccount=require(_0x74f9('0xd'));var md5Accounts={};function EmailChannel(_0x3687a9){logger[_0x74f9('0xe')]('start\x20email\x20channel');this[_0x74f9('0xf')]=_0x3687a9[_0x74f9('0xf')];this[_0x74f9('0x10')]={};this[_0x74f9('0x11')]=new EmailSmtp();}EmailChannel[_0x74f9('0x12')][_0x74f9('0x13')]=function(_0x2d78a1){var _0x514f2d=this[_0x74f9('0xf')][_0x2d78a1];var _0x2f2892={'id':_0x514f2d['id'],'name':_0x514f2d[_0x74f9('0x14')],'key':_0x514f2d[_0x74f9('0x15')],'active':_0x514f2d[_0x74f9('0x16')],'Imap':{'status':_0x514f2d[_0x74f9('0x17')]['status'],'messageStatus':_0x514f2d[_0x74f9('0x17')][_0x74f9('0x18')],'total':_0x514f2d[_0x74f9('0x17')][_0x74f9('0x19')]}};if(_[_0x74f9('0x1a')](md5Accounts[_0x2d78a1])){md5Accounts[_0x2d78a1]={};}var _0x103cc0=md5(JSON[_0x74f9('0x1b')](_0x2f2892));if(md5Accounts[_0x2d78a1][_0x74f9('0x3')]!==_0x103cc0){md5Accounts[_0x2d78a1]['md5']=_0x103cc0;io[_0x74f9('0x13')](_0x74f9('0x1c'),_0x2f2892);}};EmailChannel[_0x74f9('0x12')][_0x74f9('0x1d')]=function(_0x26e3dd){for(var _0x17b55a in _0x26e3dd){if(_0x26e3dd[_0x74f9('0x1e')](_0x17b55a)){if(_0x26e3dd[_0x17b55a][_0x74f9('0x17')]&&_0x26e3dd[_0x17b55a][_0x74f9('0x16')]){var _0x2f4989=_0x26e3dd[_0x17b55a][_0x74f9('0x17')];if(!_0x2f4989[_0x74f9('0x1f')]&&_0x26e3dd[_0x17b55a][_0x74f9('0x20')]!==_0x74f9('0x21'))_0x2f4989['service']=_0x26e3dd[_0x17b55a][_0x74f9('0x20')];if(!this[_0x74f9('0x10')]['hasOwnProperty'](_0x2f4989['id'])){this[_0x74f9('0x10')][_0x2f4989['id']]=new EmailImap(_0x2f4989,_0x26e3dd[_0x17b55a][_0x74f9('0x7')]);this[_0x74f9('0x10')][_0x2f4989['id']]['on']('box',this[_0x74f9('0x22')][_0x74f9('0x23')](this,_0x17b55a));this[_0x74f9('0x10')][_0x2f4989['id']]['on']('email',this[_0x74f9('0x24')][_0x74f9('0x23')](this,_0x17b55a));this['imapAccounts'][_0x2f4989['id']]['on'](_0x74f9('0x25'),this[_0x74f9('0x26')][_0x74f9('0x23')](this,_0x17b55a));this[_0x74f9('0x10')][_0x2f4989['id']]['on'](_0x74f9('0x27'),this[_0x74f9('0x28')]['bind'](this,_0x17b55a));}}else{if(_['isNil'](this[_0x74f9('0xf')][_0x17b55a]['Imap'])){this['mailAccounts'][_0x17b55a][_0x74f9('0x17')]={};}this[_0x74f9('0xf')][_0x17b55a][_0x74f9('0x17')]['status']=_0x74f9('0x29');this[_0x74f9('0xf')][_0x17b55a][_0x74f9('0x17')][_0x74f9('0x18')]='';this[_0x74f9('0x13')](_0x17b55a);}}}};EmailChannel['prototype'][_0x74f9('0x22')]=function(_0x14e832,_0x34d269){if(this[_0x74f9('0xf')][_0x14e832]){this[_0x74f9('0xf')][_0x14e832][_0x74f9('0x17')][_0x74f9('0x2a')]=_0x74f9('0x2b');this[_0x74f9('0xf')][_0x14e832][_0x74f9('0x17')][_0x74f9('0x18')]=_0x34d269[_0x74f9('0x14')];if(_0x34d269[_0x74f9('0x2c')]){this['mailAccounts'][_0x14e832][_0x74f9('0x17')][_0x74f9('0x19')]=_0x34d269[_0x74f9('0x2c')][_0x74f9('0x19')];}return this[_0x74f9('0x13')](_0x14e832);}};EmailChannel[_0x74f9('0x12')][_0x74f9('0x24')]=function(_0x4fe2b5,_0x1a9e56){logger[_0x74f9('0xe')](_0x74f9('0x2d'),_0x1a9e56[_0x74f9('0x2e')],_0x1a9e56[_0x74f9('0x2f')],_0x1a9e56[_0x74f9('0x30')],_0x4fe2b5);if(this[_0x74f9('0xf')][_0x4fe2b5]){return mailAccount[_0x74f9('0x31')](_0x4fe2b5,_0x1a9e56)[_0x74f9('0x32')](function(_0x5c4b4f){if(_0x5c4b4f){logger[_0x74f9('0xe')](_0x74f9('0x33'));}})[_0x74f9('0x34')](function(_0x2d95d2){logger[_0x74f9('0x27')](_0x74f9('0x35'),JSON[_0x74f9('0x1b')](_0x2d95d2));});}};EmailChannel[_0x74f9('0x12')]['handleImapEnd']=function(_0x355062){if(this['mailAccounts'][_0x355062]&&this['mailAccounts'][_0x355062][_0x74f9('0x17')]){if(this[_0x74f9('0x10')][this[_0x74f9('0xf')][_0x355062]['Imap']['id']]){delete this[_0x74f9('0x10')][this['mailAccounts'][_0x355062][_0x74f9('0x17')]['id']];}this[_0x74f9('0xf')][_0x355062]['Imap'][_0x74f9('0x36')]=moment();this[_0x74f9('0x13')](_0x355062);}};EmailChannel[_0x74f9('0x12')][_0x74f9('0x28')]=function(_0x27cf86,_0xd2b09){if(this['mailAccounts'][_0x27cf86]){this[_0x74f9('0xf')][_0x27cf86][_0x74f9('0x17')]['status']=_0x74f9('0x27');this[_0x74f9('0xf')][_0x27cf86][_0x74f9('0x17')][_0x74f9('0x18')]=_0xd2b09;return this[_0x74f9('0x13')](_0x27cf86);}};EmailChannel['prototype'][_0x74f9('0x37')]=function(_0x1c10ab,_0x5d1355){return this['smtp']['send'](_0x1c10ab,_0x5d1355);};EmailChannel['prototype'][_0x74f9('0x38')]=function(_0x9caf6a){var _0x211e5f=this;if(this[_0x74f9('0xf')][_0x9caf6a['id']]){if(_['isNil'](this[_0x74f9('0xf')][_0x9caf6a['id']][_0x74f9('0x39')])){this[_0x74f9('0xf')][_0x9caf6a['id']][_0x74f9('0x39')]={};}this[_0x74f9('0xf')][_0x9caf6a['id']][_0x74f9('0x39')][_0x74f9('0x36')]=moment();return new BPromise(function(_0x28cc76,_0x3084e9){return _0x211e5f[_0x74f9('0x11')]['verify'](_0x9caf6a)[_0x74f9('0x32')](function(_0x288879){_0x211e5f[_0x74f9('0xf')][_0x9caf6a['id']]['Smtp']['status']=_0x74f9('0x3a');_0x211e5f['mailAccounts'][_0x9caf6a['id']]['Smtp']['messageStatus']='';_0x211e5f[_0x74f9('0x13')](_0x9caf6a['id']);_0x28cc76(_0x288879);})[_0x74f9('0x34')](function(_0x3571da){_0x211e5f[_0x74f9('0xf')][_0x9caf6a['id']][_0x74f9('0x39')][_0x74f9('0x2a')]=_0x74f9('0x27');_0x211e5f[_0x74f9('0xf')][_0x9caf6a['id']][_0x74f9('0x39')][_0x74f9('0x18')]=_0x3571da;_0x211e5f[_0x74f9('0x13')](_0x9caf6a['id']);_0x3084e9(_0x3571da);});});}return this[_0x74f9('0x11')][_0x74f9('0x3b')](_0x9caf6a);};module[_0x74f9('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 4d9d3af..d8fe19e 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 _0x93ec=['handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','account','textCode','hasOwnProperty','upperFirst','exports','lodash','util','mailparser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','getAccount','imap','once','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','anonymous@xcally.com','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','fetch','handleFetchMessage','handleFetchError'];(function(_0x1ffbc7,_0xc2d684){var _0x33b33f=function(_0x2097f6){while(--_0x2097f6){_0x1ffbc7['push'](_0x1ffbc7['shift']());}};_0x33b33f(++_0xc2d684);}(_0x93ec,0x16f));var _0xc93e=function(_0x2d5818,_0xc9aa8b){_0x2d5818=_0x2d5818-0x0;var _0x1d1e9d=_0x93ec[_0x2d5818];return _0x1d1e9d;};'use strict';var _=require(_0xc93e('0x0'));var util=require(_0xc93e('0x1'));var Imap=require('imap');var simpleParser=require(_0xc93e('0x2'))['simpleParser'];var Iconv=require(_0xc93e('0x3'))[_0xc93e('0x4')];var EventEmitter=require(_0xc93e('0x5'))[_0xc93e('0x6')];var utils=require('./utils');var logger=require(_0xc93e('0x7'))(_0xc93e('0x8'));function EmailImap(_0x2d072a,_0x591a7c){this['mailbox']=_0x2d072a['mailbox'];this['account']=this[_0xc93e('0x9')](_0x2d072a,_0x591a7c);this['imap']=new Imap(this['account']);this[_0xc93e('0xa')][_0xc93e('0xb')]('ready',this[_0xc93e('0xc')]['bind'](this));this[_0xc93e('0xa')][_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0xe')][_0xc93e('0xf')](this));this[_0xc93e('0xa')]['on'](_0xc93e('0x10'),this[_0xc93e('0x11')][_0xc93e('0xf')](this));this[_0xc93e('0xa')][_0xc93e('0x12')]();}util[_0xc93e('0x13')](EmailImap,EventEmitter);EmailImap[_0xc93e('0x14')][_0xc93e('0x9')]=function(_0x1afa83,_0x5609c2){var _0x2bd25a={'connTimeout':_0x1afa83[_0xc93e('0x15')]?_0x1afa83[_0xc93e('0x15')]*0x3e8:0x2710,'authTimeout':_0x1afa83['authTimeout']?_0x1afa83[_0xc93e('0x16')]*0x3e8:0x1388};if(_0x1afa83[_0xc93e('0x17')]){_0x2bd25a[_0xc93e('0x18')]=_0x1afa83[_0xc93e('0x18')];if(_0x1afa83[_0xc93e('0x19')]){_0x2bd25a[_0xc93e('0x1a')]=utils['generateXOAuth2Token'](_0x1afa83[_0xc93e('0x1b')][_0xc93e('0x1c')],_0x1afa83[_0xc93e('0x18')]);}else{_0x2bd25a[_0xc93e('0x1d')]=_0x1afa83[_0xc93e('0x1d')];}}else{if(_0x1afa83['authentication']){_0x2bd25a[_0xc93e('0x18')]=_0x1afa83['user'];_0x2bd25a[_0xc93e('0x1d')]=_0x1afa83[_0xc93e('0x1d')];}}_0x2bd25a[_0xc93e('0x8')]=_0x5609c2||_0x1afa83[_0xc93e('0x18')]||_0xc93e('0x1e');_0x2bd25a['host']=_0x1afa83['host'];_0x2bd25a[_0xc93e('0x1f')]=_0x1afa83[_0xc93e('0x1f')]||0x3e1;if(_0x1afa83['tls']){_0x2bd25a[_0xc93e('0x20')]=!![];}else{_0x2bd25a[_0xc93e('0x20')]=![];_0x2bd25a[_0xc93e('0x21')]=_0xc93e('0x22');}return _0x2bd25a;};EmailImap[_0xc93e('0x14')][_0xc93e('0xc')]=function(){this[_0xc93e('0xa')][_0xc93e('0x23')](this['mailbox'],![],this[_0xc93e('0x24')][_0xc93e('0xf')](this));};EmailImap['prototype'][_0xc93e('0x24')]=function(_0x1f1734,_0x3957e0){if(_0x1f1734){this[_0xc93e('0x11')](_0x1f1734,!![]);}else{this[_0xc93e('0x25')](_0xc93e('0x26'),_0x3957e0);this[_0xc93e('0x27')]();}};EmailImap[_0xc93e('0x14')][_0xc93e('0x28')]=function(_0x209b38){if(_0x209b38){this['handleError'](_0x209b38,!![]);}else{this['imap']['end']();}};EmailImap[_0xc93e('0x14')][_0xc93e('0x27')]=function(){this['imap'][_0xc93e('0x29')]([_0xc93e('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xc93e('0x14')]['handleReadUnseen']=function(_0x3b8310,_0x497b84){if(_0x3b8310){this[_0xc93e('0x11')](_0x3b8310,!![]);}else{if(_0x497b84['length']){try{var _0x1d7748=this[_0xc93e('0xa')][_0xc93e('0x2b')](_0x497b84,{'bodies':'','markSeen':!![]});_0x1d7748['on']('message',this[_0xc93e('0x2c')][_0xc93e('0xf')](this));_0x1d7748[_0xc93e('0xb')](_0xc93e('0x10'),this[_0xc93e('0x2d')][_0xc93e('0xf')](this));_0x1d7748[_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0x2e')][_0xc93e('0xf')](this));}catch(_0xd34476){logger[_0xc93e('0x10')](_0xd34476);}}else{this[_0xc93e('0xa')][_0xc93e('0x2f')](!![],this[_0xc93e('0x28')]['bind'](this));}}};EmailImap[_0xc93e('0x14')][_0xc93e('0x2c')]=function(_0x4610c1){_0x4610c1['on']('body',this[_0xc93e('0x30')][_0xc93e('0xf')](this));_0x4610c1['once'](_0xc93e('0x31'),this[_0xc93e('0x32')][_0xc93e('0xf')](this));_0x4610c1[_0xc93e('0xb')](_0xc93e('0xd'),this[_0xc93e('0x33')]['bind'](this));};EmailImap[_0xc93e('0x14')][_0xc93e('0x30')]=function(_0x1cab41){simpleParser(_0x1cab41,{'Iconv':Iconv},this['handleSimpleParser'][_0xc93e('0xf')](this));};EmailImap[_0xc93e('0x14')][_0xc93e('0x32')]=function(){};EmailImap[_0xc93e('0x14')]['handleMessageEnd']=function(){};EmailImap[_0xc93e('0x14')][_0xc93e('0x34')]=function(_0x1881cf,_0x2866bf){if(_0x1881cf){logger['error'](_0x1881cf);}else{var _0x8819ef=this;utils[_0xc93e('0x35')](this['account'],_0x2866bf,function(_0x4fe184){_0x8819ef[_0xc93e('0x25')](_0xc93e('0x8'),_0x4fe184);});}};EmailImap[_0xc93e('0x14')]['handleFetchEnd']=function(){this[_0xc93e('0xa')][_0xc93e('0x2f')](!![],this[_0xc93e('0x28')][_0xc93e('0xf')](this));};EmailImap['prototype'][_0xc93e('0x2d')]=function(_0x2ab456){this['handleError'](_0x2ab456);this['imap'][_0xc93e('0x2f')](!![],this['handleCloseBox'][_0xc93e('0xf')](this));};EmailImap[_0xc93e('0x14')]['handleEnd']=function(){this['emit'](_0xc93e('0xd'));};EmailImap[_0xc93e('0x14')][_0xc93e('0x11')]=function(_0x3932e2,_0x264d9a){logger['error'](_0xc93e('0x11'),this[_0xc93e('0x36')][_0xc93e('0x8')],JSON['stringify'](_0x3932e2));var _0x5f2cec='';if(_0x3932e2){if(_0x3932e2[_0xc93e('0x37')]){_0x5f2cec=_0x3932e2[_0xc93e('0x37')];}else{for(var _0x5a935f in _0x3932e2){if(_0x3932e2[_0xc93e('0x38')](_0x5a935f)){_0x5f2cec+=_[_0xc93e('0x39')](_0x5a935f)+':\x20'+_0x3932e2[_0x5a935f]+'\x0a';}}}}if(_0x264d9a){this[_0xc93e('0xa')]['end']();}else{this['emit'](_0xc93e('0x10'),_0x5f2cec);this[_0xc93e('0x25')]('end');}};module[_0xc93e('0x3a')]=EmailImap; \ No newline at end of file +var _0xd16e=['hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','Iconv','events','../../../config/logger','getAccount','ready','handleReady','bind','once','handleEnd','connect','prototype','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','host','port','tls','autotls','required','mailbox','handleOpenBox','handleError','box','end','readUnseen','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','error','handleFetchError','handleCloseBox','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','handleFetchEnd','closeBox','account','stringify','textCode'];(function(_0x2add83,_0x3a014e){var _0x5570e5=function(_0x2ca016){while(--_0x2ca016){_0x2add83['push'](_0x2add83['shift']());}};_0x5570e5(++_0x3a014e);}(_0xd16e,0xef));var _0xed16=function(_0x783ca,_0x21c507){_0x783ca=_0x783ca-0x0;var _0x54fc77=_0xd16e[_0x783ca];return _0x54fc77;};'use strict';var _=require(_0xed16('0x0'));var util=require(_0xed16('0x1'));var Imap=require(_0xed16('0x2'));var simpleParser=require(_0xed16('0x3'))['simpleParser'];var Iconv=require('iconv')[_0xed16('0x4')];var EventEmitter=require(_0xed16('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require(_0xed16('0x6'))('email');function EmailImap(_0x1b84b7,_0x53f404){this['mailbox']=_0x1b84b7['mailbox'];this['account']=this[_0xed16('0x7')](_0x1b84b7,_0x53f404);this[_0xed16('0x2')]=new Imap(this['account']);this[_0xed16('0x2')]['once'](_0xed16('0x8'),this[_0xed16('0x9')][_0xed16('0xa')](this));this[_0xed16('0x2')][_0xed16('0xb')]('end',this[_0xed16('0xc')][_0xed16('0xa')](this));this[_0xed16('0x2')]['on']('error',this['handleError'][_0xed16('0xa')](this));this[_0xed16('0x2')][_0xed16('0xd')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xed16('0xe')]['getAccount']=function(_0x1ba946,_0x3cebc0){var _0x2a118e={'connTimeout':_0x1ba946['connTimeout']?_0x1ba946['connTimeout']*0x3e8:0x2710,'authTimeout':_0x1ba946[_0xed16('0xf')]?_0x1ba946['authTimeout']*0x3e8:0x1388};if(_0x1ba946[_0xed16('0x10')]){_0x2a118e[_0xed16('0x11')]=_0x1ba946[_0xed16('0x11')];if(_0x1ba946['modernAuthentication']){_0x2a118e[_0xed16('0x12')]=utils[_0xed16('0x13')](_0x1ba946[_0xed16('0x14')][_0xed16('0x15')],_0x1ba946[_0xed16('0x11')]);}else{_0x2a118e[_0xed16('0x16')]=_0x1ba946[_0xed16('0x16')];}}else{if(_0x1ba946[_0xed16('0x17')]){_0x2a118e[_0xed16('0x11')]=_0x1ba946['user'];_0x2a118e[_0xed16('0x16')]=_0x1ba946[_0xed16('0x16')];}}_0x2a118e[_0xed16('0x18')]=_0x3cebc0||_0x1ba946[_0xed16('0x11')]||'anonymous@xcally.com';_0x2a118e[_0xed16('0x19')]=_0x1ba946['host'];_0x2a118e[_0xed16('0x1a')]=_0x1ba946[_0xed16('0x1a')]||0x3e1;if(_0x1ba946[_0xed16('0x1b')]){_0x2a118e[_0xed16('0x1b')]=!![];}else{_0x2a118e[_0xed16('0x1b')]=![];_0x2a118e[_0xed16('0x1c')]=_0xed16('0x1d');}return _0x2a118e;};EmailImap[_0xed16('0xe')][_0xed16('0x9')]=function(){this[_0xed16('0x2')]['openBox'](this[_0xed16('0x1e')],![],this[_0xed16('0x1f')]['bind'](this));};EmailImap[_0xed16('0xe')][_0xed16('0x1f')]=function(_0x23b95a,_0x4bafb1){if(_0x23b95a){this[_0xed16('0x20')](_0x23b95a,!![]);}else{this['emit'](_0xed16('0x21'),_0x4bafb1);this['readUnseen']();}};EmailImap[_0xed16('0xe')]['handleCloseBox']=function(_0x332b39){if(_0x332b39){this[_0xed16('0x20')](_0x332b39,!![]);}else{this[_0xed16('0x2')][_0xed16('0x22')]();}};EmailImap[_0xed16('0xe')][_0xed16('0x23')]=function(){this[_0xed16('0x2')][_0xed16('0x24')]([_0xed16('0x25')],this[_0xed16('0x26')][_0xed16('0xa')](this));};EmailImap[_0xed16('0xe')][_0xed16('0x26')]=function(_0x190bf5,_0x58b4c2){if(_0x190bf5){this[_0xed16('0x20')](_0x190bf5,!![]);}else{if(_0x58b4c2['length']){try{var _0x4fa827=this[_0xed16('0x2')]['fetch'](_0x58b4c2,{'bodies':'','markSeen':!![]});_0x4fa827['on'](_0xed16('0x27'),this[_0xed16('0x28')][_0xed16('0xa')](this));_0x4fa827[_0xed16('0xb')](_0xed16('0x29'),this[_0xed16('0x2a')][_0xed16('0xa')](this));_0x4fa827[_0xed16('0xb')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x295ee7){logger['error'](_0x295ee7);}}else{this[_0xed16('0x2')]['closeBox'](!![],this[_0xed16('0x2b')][_0xed16('0xa')](this));}}};EmailImap[_0xed16('0xe')][_0xed16('0x28')]=function(_0x46ea07){_0x46ea07['on']('body',this['handleMessageBody']['bind'](this));_0x46ea07['once'](_0xed16('0x2c'),this[_0xed16('0x2d')][_0xed16('0xa')](this));_0x46ea07[_0xed16('0xb')]('end',this[_0xed16('0x2e')][_0xed16('0xa')](this));};EmailImap['prototype'][_0xed16('0x2f')]=function(_0x2ae225){simpleParser(_0x2ae225,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xed16('0xe')][_0xed16('0x2d')]=function(){};EmailImap[_0xed16('0xe')][_0xed16('0x2e')]=function(){};EmailImap[_0xed16('0xe')][_0xed16('0x30')]=function(_0x114136,_0x3de381){if(_0x114136){logger['error'](_0x114136);}else{var _0x3b3895=this;utils[_0xed16('0x31')](this['account'],_0x3de381,function(_0x1f54a0){_0x3b3895[_0xed16('0x32')](_0xed16('0x18'),_0x1f54a0);});}};EmailImap[_0xed16('0xe')][_0xed16('0x33')]=function(){this[_0xed16('0x2')][_0xed16('0x34')](!![],this[_0xed16('0x2b')][_0xed16('0xa')](this));};EmailImap[_0xed16('0xe')][_0xed16('0x2a')]=function(_0x1c92bc){this['handleError'](_0x1c92bc);this[_0xed16('0x2')][_0xed16('0x34')](!![],this[_0xed16('0x2b')][_0xed16('0xa')](this));};EmailImap[_0xed16('0xe')][_0xed16('0xc')]=function(){this[_0xed16('0x32')](_0xed16('0x22'));};EmailImap[_0xed16('0xe')][_0xed16('0x20')]=function(_0x100405,_0x215a9c){logger['error'](_0xed16('0x20'),this[_0xed16('0x35')][_0xed16('0x18')],JSON[_0xed16('0x36')](_0x100405));var _0x426ef6='';if(_0x100405){if(_0x100405['textCode']){_0x426ef6=_0x100405[_0xed16('0x37')];}else{for(var _0x36f288 in _0x100405){if(_0x100405[_0xed16('0x38')](_0x36f288)){_0x426ef6+=_[_0xed16('0x39')](_0x36f288)+':\x20'+_0x100405[_0x36f288]+'\x0a';}}}}if(_0x215a9c){this[_0xed16('0x2')]['end']();}else{this[_0xed16('0x32')](_0xed16('0x29'),_0x426ef6);this[_0xed16('0x32')](_0xed16('0x22'));}};module[_0xed16('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2aaf734..f287c79 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 _0x4e99=['nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail','toString','verify','exports','nodemailer'];(function(_0x527365,_0x36fb3a){var _0x5de073=function(_0x52a251){while(--_0x52a251){_0x527365['push'](_0x527365['shift']());}};_0x5de073(++_0x36fb3a);}(_0x4e99,0xaa));var _0x94e9=function(_0x1df1b0,_0x113423){_0x1df1b0=_0x1df1b0-0x0;var _0x13322c=_0x4e99[_0x1df1b0];return _0x13322c;};'use strict';var nodemailer=require(_0x94e9('0x0'));var inlineBase64=require(_0x94e9('0x1'));function EmailSmtp(){}EmailSmtp[_0x94e9('0x2')]['send']=function(_0x1bf480,_0x1dcb35){return new Promise(function(_0x27d024,_0x43cd6c){var _0x584d47=nodemailer[_0x94e9('0x3')](_0x1bf480);_0x584d47[_0x94e9('0x4')]('compile',inlineBase64());_0x584d47[_0x94e9('0x5')](_0x1dcb35,function(_0x1784b3,_0x21ba3f){if(_0x1784b3){_0x43cd6c(_0x1784b3[_0x94e9('0x6')]());}else{_0x27d024(_0x21ba3f);}});});};EmailSmtp['prototype']['verify']=function(_0x1911f5){return new Promise(function(_0x395108,_0x5c8a0e){var _0x5ae5f9=nodemailer[_0x94e9('0x3')](_0x1911f5);_0x5ae5f9[_0x94e9('0x7')](function(_0x1d4fec,_0x1c93bf){if(_0x1d4fec){_0x5c8a0e(_0x1d4fec[_0x94e9('0x6')]());}else{if(_0x1c93bf){_0x395108(_0x1c93bf);}else{_0x5c8a0e('Not\x20verifired');}}});});};module[_0x94e9('0x8')]=EmailSmtp; \ No newline at end of file +var _0xcbd8=['prototype','send','createTransport','use','compile','sendMail','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0x45447c,_0x5f1f98){var _0x29a65c=function(_0x1ed48f){while(--_0x1ed48f){_0x45447c['push'](_0x45447c['shift']());}};_0x29a65c(++_0x5f1f98);}(_0xcbd8,0x78));var _0x8cbd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcbd8[_0x397e5f];return _0x5302b8;};'use strict';var nodemailer=require(_0x8cbd('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x8cbd('0x1')][_0x8cbd('0x2')]=function(_0x3755fc,_0x54c384){return new Promise(function(_0x4948d0,_0x448984){var _0x3afa13=nodemailer[_0x8cbd('0x3')](_0x3755fc);_0x3afa13[_0x8cbd('0x4')](_0x8cbd('0x5'),inlineBase64());_0x3afa13[_0x8cbd('0x6')](_0x54c384,function(_0x2fdce8,_0x4bab03){if(_0x2fdce8){_0x448984(_0x2fdce8['toString']());}else{_0x4948d0(_0x4bab03);}});});};EmailSmtp[_0x8cbd('0x1')][_0x8cbd('0x7')]=function(_0x1a72d4){return new Promise(function(_0x5aeff0,_0x5befa1){var _0x304570=nodemailer[_0x8cbd('0x3')](_0x1a72d4);_0x304570[_0x8cbd('0x7')](function(_0x56d8b1,_0x33ed21){if(_0x56d8b1){_0x5befa1(_0x56d8b1[_0x8cbd('0x8')]());}else{if(_0x33ed21){_0x5aeff0(_0x33ed21);}else{_0x5befa1(_0x8cbd('0x9'));}}});});};module[_0x8cbd('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a9888f6..029d695 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 _0xe4df=['split','length','slice','join','Anonymous','pop','isEmpty','anonymous','html','test','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','generate','name','substring'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xe4df,0xdf));var _0xfe4d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe4df[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xfe4d('0x0'));var moment=require(_0xfe4d('0x1'));var random=require(_0xfe4d('0x2'));var fs=require('fs');var path=require(_0xfe4d('0x3'));var util=require(_0xfe4d('0x4'));var tnef=require('node-tnef');var logger=require(_0xfe4d('0x5'))(_0xfe4d('0x6'));var config=require(_0xfe4d('0x7'));function getAddress(_0x38c887){var _0x5c0034=_[_0xfe4d('0x8')](_0x38c887[_0xfe4d('0x9')]);return _0x5c0034&&_0x5c0034[_0xfe4d('0xa')]?_0x5c0034['address']:'anonymous'+random[_0xfe4d('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x576d8d){var _0x1ceab0=_[_0xfe4d('0x8')](_0x576d8d[_0xfe4d('0x9')]);if(_0x1ceab0&&_0x1ceab0[_0xfe4d('0xc')]){if(_0x1ceab0[_0xfe4d('0xc')]==_0x1ceab0[_0xfe4d('0xa')]){return _0x1ceab0['name'][_0xfe4d('0xd')](0x0,_0x1ceab0[_0xfe4d('0xc')]['indexOf']('@'));}var _0x586fc2=_0x1ceab0[_0xfe4d('0xc')][_0xfe4d('0xe')](/\s+/);return _0x586fc2[_0xfe4d('0xf')]>0x1?_0x586fc2[_0xfe4d('0x10')](0x0,-0x1)[_0xfe4d('0x11')]('\x20'):_0x1ceab0[_0xfe4d('0xc')];}return _0xfe4d('0x12');}function getLastName(_0x45bfb4){var _0x57613e=_[_0xfe4d('0x8')](_0x45bfb4['value']);if(_0x57613e&&_0x57613e['name']){var _0x22696c=_0x57613e['name'][_0xfe4d('0xe')](/\s+/);return _0x22696c[_0xfe4d('0xf')]>0x1?_0x22696c[_0xfe4d('0x13')]():'';}return'';}function getMails(_0x46dba,_0x2f4b0a){var _0x4f7898='';for(var _0x13da9f=0x0;_0x13da9f<_0x2f4b0a[_0xfe4d('0x9')][_0xfe4d('0xf')];_0x13da9f+=0x1){if(_0x2f4b0a['value'][_0x13da9f][_0xfe4d('0xa')]!==_0x46dba){if(!_[_0xfe4d('0x14')](_0x4f7898)){_0x4f7898+=',';}_0x4f7898+=_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f][_0xfe4d('0xc')]||_0x2f4b0a['value'][_0x13da9f][_0xfe4d('0xa')]||'';_0x4f7898+='\x20<';_0x4f7898+=_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f]['address']?_0x2f4b0a[_0xfe4d('0x9')][_0x13da9f][_0xfe4d('0xa')]:_0xfe4d('0x15')+random[_0xfe4d('0xb')](0x6)+'@xcally.com';_0x4f7898+='>';}}return _0x4f7898;}function parseEmail(_0x41c7af,_0x213190,_0xc266df){if(_0x213190[_0xfe4d('0x16')]){var _0x23e7d3=/)<[^<]*)*<\/script>/gi;while(_0x23e7d3[_0xfe4d('0x17')](_0x213190[_0xfe4d('0x16')])){_0x213190[_0xfe4d('0x16')]=_0x213190['html']['replace'](_0x23e7d3,'');}if(_0x213190['html']['includes'](_0xfe4d('0x18'))){var _0x49a0e9=[];_0x213190[_0xfe4d('0x19')][_0xfe4d('0x1a')](_0x202cc3=>{_0x49a0e9[_0xfe4d('0x1b')](_0x202cc3[_0xfe4d('0x1c')]);});var _0x26399d=/]+>/g;var _0x16f910=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d4410=_0x213190[_0xfe4d('0x16')][_0xfe4d('0x1d')](_0x16f910,_0xfe4d('0x1e'));var _0x2b454a=_0x5d4410['replace'](_0x26399d,_0xfe4d('0x1f'));for(let _0x4d1107=0x0;_0x4d1107<_0x49a0e9[_0xfe4d('0xf')];_0x4d1107++){var _0x3d1336=_0x2b454a[_0xfe4d('0x1d')](_0xfe4d('0x1f'),_0xfe4d('0x20')+_0x49a0e9[_0x4d1107]+_0xfe4d('0x21'));_0x2b454a=_0x3d1336;}_0x213190['html']=_0x2b454a;}_0xc266df['body']=_0x213190[_0xfe4d('0x16')];}else{_0xc266df['body']=_0x213190['textAsHtml'];}if(_0xc266df[_0xfe4d('0x22')]){_0xc266df[_0xfe4d('0x22')]=_0xc266df[_0xfe4d('0x22')]['replace'](/0x0){var _0x771341=[_0xfe4d('0x32'),_0xfe4d('0x33'),_0xfe4d('0x34')];for(var _0x1c7930=0x0;_0x1c7930<_0x213190[_0xfe4d('0x31')]['length'];_0x1c7930++){var _0x3972a1=_[_0xfe4d('0x35')](_0x771341,_0x213190[_0xfe4d('0x31')][_0x1c7930][_0xfe4d('0x36')]);if(_0x3972a1>=0x0){_0xc266df[_0xfe4d('0x37')]=!![];}}}return _0xc266df;}exports[_0xfe4d('0x38')]=function(_0x260e15,_0x19174f,_0x562bc1){var _0x5c1a0d={'from':getAddress(_0x19174f[_0xfe4d('0x39')]),'firstName':getFirstName(_0x19174f[_0xfe4d('0x39')]),'lastName':getLastName(_0x19174f[_0xfe4d('0x39')]),'mapKey':_0xfe4d('0x6'),'message':{'from':getMails(_0x260e15['email'],_0x19174f[_0xfe4d('0x39')]),'to':_0x260e15[_0xfe4d('0x6')],'cc':'','subject':_0x19174f[_0xfe4d('0x3a')]||'','messageId':_0x19174f[_0xfe4d('0x3b')],'inReplyTo':_0x19174f[_0xfe4d('0x3c')],'sentAt':moment(_0x19174f[_0xfe4d('0x3d')])[_0xfe4d('0x2b')](_0xfe4d('0x3e')),'attach':![],'attachments':[]}};if(!_0x19174f[_0xfe4d('0x16')]&&!_0x19174f[_0xfe4d('0x3f')]){var _0x4e6a6f=_[_0xfe4d('0x40')](_0x19174f[_0xfe4d('0x19')],{'contentType':_0xfe4d('0x41')});if(_0x4e6a6f[_0xfe4d('0xf')]){logger[_0xfe4d('0x42')](util[_0xfe4d('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x19174f[_0xfe4d('0x3b')]));tnef[_0xfe4d('0x43')](_['first'](_0x4e6a6f)['content'],function(_0x147777,_0x1b246e){if(_0x1b246e){_0x19174f[_0xfe4d('0x16')]=_0x1b246e[_0xfe4d('0x44')]||_0xfe4d('0x45');if(_0x1b246e[_0xfe4d('0x46')]){for(var _0x531d74=0x0;_0x531d74<_0x1b246e[_0xfe4d('0x46')][_0xfe4d('0xf')];_0x531d74++){var _0x234553=_0x1b246e[_0xfe4d('0x46')][_0x531d74];_0x5c1a0d['message'][_0xfe4d('0x19')]['push']({'filename':_0x234553[_0xfe4d('0x47')],'content':Buffer[_0xfe4d('0x39')](_0x234553[_0xfe4d('0x48')])});}}}_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));});}else{_0x19174f[_0xfe4d('0x16')]=_0xfe4d('0x45');_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));}}else{_0x562bc1(parseEmail(_0x260e15,_0x19174f,_0x5c1a0d));}};exports[_0xfe4d('0x49')]=function(_0x2d31ee,_0x2285be){var _0x583763=[_0xfe4d('0x4a')+(_0x2285be||''),_0xfe4d('0x4b')+_0x2d31ee,'',''];return Buffer[_0xfe4d('0x39')](_0x583763[_0xfe4d('0x11')](''),_0xfe4d('0x4c'))[_0xfe4d('0x4d')](_0xfe4d('0x4e'));}; \ No newline at end of file +var _0xc650=['lodash','randomstring','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','isEmpty','html','test','replace','attachments','forEach','push','filename','_SRC','_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','utf-8'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc650,0x1dc));var _0x0c65=function(_0x2bd5e7,_0x463e1a){_0x2bd5e7=_0x2bd5e7-0x0;var _0xdf6ec7=_0xc650[_0x2bd5e7];return _0xdf6ec7;};'use strict';var _=require(_0x0c65('0x0'));var moment=require('moment');var random=require(_0x0c65('0x1'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x0c65('0x2'));var logger=require(_0x0c65('0x3'))(_0x0c65('0x4'));var config=require('../../../config/environment');function getAddress(_0x341147){var _0x4e07cd=_[_0x0c65('0x5')](_0x341147[_0x0c65('0x6')]);return _0x4e07cd&&_0x4e07cd[_0x0c65('0x7')]?_0x4e07cd[_0x0c65('0x7')]:_0x0c65('0x8')+random[_0x0c65('0x9')](0x6)+_0x0c65('0xa');}function getFirstName(_0x34c856){var _0x3bbbc4=_[_0x0c65('0x5')](_0x34c856[_0x0c65('0x6')]);if(_0x3bbbc4&&_0x3bbbc4[_0x0c65('0xb')]){if(_0x3bbbc4[_0x0c65('0xb')]==_0x3bbbc4[_0x0c65('0x7')]){return _0x3bbbc4[_0x0c65('0xb')][_0x0c65('0xc')](0x0,_0x3bbbc4[_0x0c65('0xb')][_0x0c65('0xd')]('@'));}var _0x1d9df8=_0x3bbbc4[_0x0c65('0xb')][_0x0c65('0xe')](/\s+/);return _0x1d9df8[_0x0c65('0xf')]>0x1?_0x1d9df8[_0x0c65('0x10')](0x0,-0x1)[_0x0c65('0x11')]('\x20'):_0x3bbbc4[_0x0c65('0xb')];}return'Anonymous';}function getLastName(_0x47fab9){var _0x26b733=_[_0x0c65('0x5')](_0x47fab9['value']);if(_0x26b733&&_0x26b733['name']){var _0xd5417c=_0x26b733[_0x0c65('0xb')][_0x0c65('0xe')](/\s+/);return _0xd5417c[_0x0c65('0xf')]>0x1?_0xd5417c['pop']():'';}return'';}function getMails(_0x15a0bf,_0x5b91c0){var _0x487d9f='';for(var _0x28cc8e=0x0;_0x28cc8e<_0x5b91c0['value'][_0x0c65('0xf')];_0x28cc8e+=0x1){if(_0x5b91c0['value'][_0x28cc8e]['address']!==_0x15a0bf){if(!_[_0x0c65('0x12')](_0x487d9f)){_0x487d9f+=',';}_0x487d9f+=_0x5b91c0[_0x0c65('0x6')][_0x28cc8e][_0x0c65('0xb')]||_0x5b91c0[_0x0c65('0x6')][_0x28cc8e][_0x0c65('0x7')]||'';_0x487d9f+='\x20<';_0x487d9f+=_0x5b91c0[_0x0c65('0x6')][_0x28cc8e][_0x0c65('0x7')]?_0x5b91c0['value'][_0x28cc8e][_0x0c65('0x7')]:_0x0c65('0x8')+random[_0x0c65('0x9')](0x6)+_0x0c65('0xa');_0x487d9f+='>';}}return _0x487d9f;}function parseEmail(_0x296f14,_0x423a65,_0x4907aa){if(_0x423a65[_0x0c65('0x13')]){var _0x37d431=/)<[^<]*)*<\/script>/gi;while(_0x37d431[_0x0c65('0x14')](_0x423a65[_0x0c65('0x13')])){_0x423a65['html']=_0x423a65['html'][_0x0c65('0x15')](_0x37d431,'');}if(_0x423a65[_0x0c65('0x13')]['includes']('{_0x22784c[_0x0c65('0x18')](_0x2b1ecd[_0x0c65('0x19')]);});var _0x5a7ec3=/]+>/g;var _0xaa105e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a3f49=_0x423a65['html'][_0x0c65('0x15')](_0xaa105e,_0x0c65('0x1a'));var _0x20f7eb=_0x5a3f49[_0x0c65('0x15')](_0x5a7ec3,_0x0c65('0x1b'));for(let _0x3689ca=0x0;_0x3689ca<_0x22784c[_0x0c65('0xf')];_0x3689ca++){var _0x5f17f5=_0x20f7eb[_0x0c65('0x15')](_0x0c65('0x1b'),'\x20[Attachment:\x20'+_0x22784c[_0x3689ca]+_0x0c65('0x1c'));_0x20f7eb=_0x5f17f5;}_0x423a65[_0x0c65('0x13')]=_0x20f7eb;}_0x4907aa[_0x0c65('0x1d')]=_0x423a65[_0x0c65('0x13')];}else{_0x4907aa[_0x0c65('0x1d')]=_0x423a65[_0x0c65('0x1e')];}if(_0x4907aa[_0x0c65('0x1d')]){_0x4907aa[_0x0c65('0x1d')]=_0x4907aa[_0x0c65('0x1d')]['replace'](/0x0){var _0x160baf=[_0x0c65('0x2e'),_0x0c65('0x2f'),_0x0c65('0x30')];for(var _0x176600=0x0;_0x176600<_0x423a65[_0x0c65('0x2d')][_0x0c65('0xf')];_0x176600++){var _0x26e6bd=_[_0x0c65('0xd')](_0x160baf,_0x423a65[_0x0c65('0x2d')][_0x176600]['line']);if(_0x26e6bd>=0x0){_0x4907aa[_0x0c65('0x31')]=!![];}}}return _0x4907aa;}exports[_0x0c65('0x32')]=function(_0x439927,_0x29c87b,_0x1a5b7c){var _0x4d8829={'from':getAddress(_0x29c87b['from']),'firstName':getFirstName(_0x29c87b[_0x0c65('0x33')]),'lastName':getLastName(_0x29c87b[_0x0c65('0x33')]),'mapKey':_0x0c65('0x4'),'message':{'from':getMails(_0x439927[_0x0c65('0x4')],_0x29c87b[_0x0c65('0x33')]),'to':_0x439927[_0x0c65('0x4')],'cc':'','subject':_0x29c87b[_0x0c65('0x34')]||'','messageId':_0x29c87b[_0x0c65('0x35')],'inReplyTo':_0x29c87b[_0x0c65('0x36')],'sentAt':moment(_0x29c87b['date'])[_0x0c65('0x28')](_0x0c65('0x37')),'attach':![],'attachments':[]}};if(!_0x29c87b['html']&&!_0x29c87b[_0x0c65('0x1e')]){var _0x42dc35=_[_0x0c65('0x38')](_0x29c87b[_0x0c65('0x16')],{'contentType':_0x0c65('0x39')});if(_0x42dc35['length']){logger['info'](util['format'](_0x0c65('0x3a'),_0x29c87b[_0x0c65('0x35')]));tnef[_0x0c65('0x3b')](_[_0x0c65('0x3c')](_0x42dc35)['content'],function(_0x2557d7,_0x4199d6){if(_0x4199d6){_0x29c87b[_0x0c65('0x13')]=_0x4199d6[_0x0c65('0x3d')]||_0x0c65('0x3e');if(_0x4199d6['Attachments']){for(var _0x356a40=0x0;_0x356a40<_0x4199d6[_0x0c65('0x3f')][_0x0c65('0xf')];_0x356a40++){var _0x30ae6e=_0x4199d6[_0x0c65('0x3f')][_0x356a40];_0x4d8829[_0x0c65('0x20')][_0x0c65('0x16')][_0x0c65('0x18')]({'filename':_0x30ae6e[_0x0c65('0x40')],'content':Buffer['from'](_0x30ae6e[_0x0c65('0x41')])});}}}_0x1a5b7c(parseEmail(_0x439927,_0x29c87b,_0x4d8829));});}else{_0x29c87b['html']=_0x0c65('0x3e');_0x1a5b7c(parseEmail(_0x439927,_0x29c87b,_0x4d8829));}}else{_0x1a5b7c(parseEmail(_0x439927,_0x29c87b,_0x4d8829));}};exports['generateXOAuth2Token']=function(_0x390bcf,_0x481d57){var _0x411724=[_0x0c65('0x42')+(_0x481d57||''),'auth=Bearer\x20'+_0x390bcf,'',''];return Buffer['from'](_0x411724[_0x0c65('0x11')](''),_0x0c65('0x43'))['toString']('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b862ce1..fb2a6ea 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 _0x53d2=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x543f21,_0x170a2e){var _0x1d1f3e=function(_0xf13c32){while(--_0xf13c32){_0x543f21['push'](_0x543f21['shift']());}};_0x1d1f3e(++_0x170a2e);}(_0x53d2,0x6e));var _0x253d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x253d('0x0'));function MailAccount(_0x50084e){this['id']=_0x50084e['id']||0x0;this[_0x253d('0x1')]=_0x50084e[_0x253d('0x1')]||_0x253d('0x2');this[_0x253d('0x3')]=_0x50084e[_0x253d('0x3')]||_0x253d('0x4');this[_0x253d('0x5')]=_0x50084e['active']||![];this[_0x253d('0x6')]=_0x50084e[_0x253d('0x6')]||[];this['Smtp']=_0x50084e[_0x253d('0x7')]||[];}module[_0x253d('0x8')]=MailAccount; \ No newline at end of file +var _0x0567=['exports','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x28063b,_0x6df3b2){var _0xee41a7=function(_0x2b6482){while(--_0x2b6482){_0x28063b['push'](_0x28063b['shift']());}};_0xee41a7(++_0x6df3b2);}(_0x0567,0x101));var _0x7056=function(_0x5942fe,_0x51f396){_0x5942fe=_0x5942fe-0x0;var _0x25310a=_0x0567[_0x5942fe];return _0x25310a;};'use strict';var _=require('lodash');function MailAccount(_0xc25fa6){this['id']=_0xc25fa6['id']||0x0;this[_0x7056('0x0')]=_0xc25fa6[_0x7056('0x0')]||_0x7056('0x1');this[_0x7056('0x2')]=_0xc25fa6['key']||_0x7056('0x3');this[_0x7056('0x4')]=_0xc25fa6[_0x7056('0x4')]||![];this[_0x7056('0x5')]=_0xc25fa6[_0x7056('0x5')]||[];this[_0x7056('0x6')]=_0xc25fa6[_0x7056('0x6')]||[];}module[_0x7056('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c57a625..a9666f8 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 _0x968a=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x968a,0xfa));var _0xa968=function(_0x142f81,_0x59512a){_0x142f81=_0x142f81-0x0;var _0xa6ea15=_0x968a[_0x142f81];return _0xa6ea15;};'use strict';var _=require(_0xa968('0x0'));var MailAccount=require(_0xa968('0x1'));var Realtime=function(){this[_0xa968('0x2')]={};};function freeIsNotKey(_0x52bc0e,_0x3791b8,_0x5bac41){var _0x3ef5c6=_['mapKeys'](_0x52bc0e,function(_0x23f6e1,_0x2e4068){return _0x23f6e1[_0x5bac41];});for(var _0x408469 in _0x3791b8){if(_0x3791b8[_0xa968('0x3')](_0x408469)){if(!_0x3ef5c6[_0x408469]){delete _0x3791b8[_0x408469];}}}}Realtime[_0xa968('0x4')][_0xa968('0x5')]=function(_0x2fb6e4,_0x1b4477){for(var _0x54c535 in _0x1b4477){if(_0x2fb6e4[_0xa968('0x3')](_0x54c535)){_0x2fb6e4[_0x54c535]=_0x1b4477[_0x54c535];}}};Realtime[_0xa968('0x4')][_0xa968('0x6')]=function(){var _0x423cd3=this;return function(_0x453ad5){if(_0x453ad5){freeIsNotKey(_0x453ad5,_0x423cd3[_0xa968('0x2')],'id');for(var _0x4e4aa6=0x0,_0x24653b={},_0x39ae7f={};_0x4e4aa6<_0x453ad5[_0xa968('0x7')];_0x4e4aa6+=0x1){_0x24653b=_0x453ad5[_0x4e4aa6];if(_[_0xa968('0x8')](_0x423cd3[_0xa968('0x2')][_0x24653b['id']])){_0x423cd3[_0xa968('0x2')][_0x24653b['id']]=new MailAccount(_0x24653b);}else{_['merge'](_0x423cd3[_0xa968('0x2')][_0x24653b['id']],_0x24653b);}}}return _0x423cd3[_0xa968('0x2')];};};module[_0xa968('0x9')]=Realtime; \ No newline at end of file +var _0x1958=['exports','lodash','../model/mailAccount','mapKeys','prototype','initMailAccounts','mailAccounts','length','isUndefined','merge'];(function(_0x461291,_0x264202){var _0x3b1d5b=function(_0x2e751d){while(--_0x2e751d){_0x461291['push'](_0x461291['shift']());}};_0x3b1d5b(++_0x264202);}(_0x1958,0xbf));var _0x8195=function(_0x20e81e,_0x2ad41f){_0x20e81e=_0x20e81e-0x0;var _0x3e6654=_0x1958[_0x20e81e];return _0x3e6654;};'use strict';var _=require(_0x8195('0x0'));var MailAccount=require(_0x8195('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2c1753,_0x90800d,_0x528489){var _0x5b39d2=_[_0x8195('0x2')](_0x2c1753,function(_0x21c986,_0x3d14c9){return _0x21c986[_0x528489];});for(var _0x312a32 in _0x90800d){if(_0x90800d['hasOwnProperty'](_0x312a32)){if(!_0x5b39d2[_0x312a32]){delete _0x90800d[_0x312a32];}}}}Realtime[_0x8195('0x3')]['mergeFromDatabase']=function(_0x364be6,_0x79b6a){for(var _0x3bdc1f in _0x79b6a){if(_0x364be6['hasOwnProperty'](_0x3bdc1f)){_0x364be6[_0x3bdc1f]=_0x79b6a[_0x3bdc1f];}}};Realtime[_0x8195('0x3')][_0x8195('0x4')]=function(){var _0x1e3f6d=this;return function(_0x2887d9){if(_0x2887d9){freeIsNotKey(_0x2887d9,_0x1e3f6d[_0x8195('0x5')],'id');for(var _0x322736=0x0,_0x115b67={},_0x302893={};_0x322736<_0x2887d9[_0x8195('0x6')];_0x322736+=0x1){_0x115b67=_0x2887d9[_0x322736];if(_[_0x8195('0x7')](_0x1e3f6d[_0x8195('0x5')][_0x115b67['id']])){_0x1e3f6d[_0x8195('0x5')][_0x115b67['id']]=new MailAccount(_0x115b67);}else{_[_0x8195('0x8')](_0x1e3f6d[_0x8195('0x5')][_0x115b67['id']],_0x115b67);}}}return _0x1e3f6d[_0x8195('0x5')];};};module[_0x8195('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 549e153..0dcc2b5 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 _0x8b0e=['Request','GetMailAccount','name','provider','email','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','data5','MailServerOut','Smtp','type','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b0e,0x166));var _0xe8b0=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x8b0e[_0x40d8d7];return _0x3454cc;};'use strict';var client=require(_0xe8b0('0x0'));exports[_0xe8b0('0x1')]=function(){return function(){return client[_0xe8b0('0x2')](_0xe8b0('0x3'),{'options':{'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0x5'),'service',_0xe8b0('0x6'),'active',_0xe8b0('0x7'),_0xe8b0('0x8'),_0xe8b0('0x9')],'raw':![],'include':[{'model':_0xe8b0('0xa'),'as':_0xe8b0('0xb'),'include':[{'model':_0xe8b0('0xc'),'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0xd'),'type',_0xe8b0('0xe')],'as':_0xe8b0('0xc')}]},{'model':_0xe8b0('0xf'),'as':_0xe8b0('0x10'),'include':[{'model':_0xe8b0('0xc'),'attributes':['id',_0xe8b0('0x4'),_0xe8b0('0xd'),_0xe8b0('0x11'),_0xe8b0('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xe8b0('0x12')]=function(_0x38f224,_0x1d9781){return client['Request'](_0xe8b0('0x13'),{'account':{'id':_0x38f224},'body':_0x1d9781,'log':_0xe8b0('0x13')});}; \ No newline at end of file +var _0x83b3=['MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','TemplateId','MailServerIn','Imap','CloudProvider','type','data5'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x83b3,0x147));var _0x383b=function(_0x67f368,_0x67108c){_0x67f368=_0x67f368-0x0;var _0x33a80b=_0x83b3[_0x67f368];return _0x33a80b;};'use strict';var client=require(_0x383b('0x0'));exports[_0x383b('0x1')]=function(){return function(){return client[_0x383b('0x2')](_0x383b('0x3'),{'options':{'attributes':['id',_0x383b('0x4'),_0x383b('0x5'),_0x383b('0x6'),_0x383b('0x7'),_0x383b('0x8'),'key','ListId',_0x383b('0x9')],'raw':![],'include':[{'model':_0x383b('0xa'),'as':_0x383b('0xb'),'include':[{'model':_0x383b('0xc'),'attributes':['id',_0x383b('0x4'),_0x383b('0x6'),_0x383b('0xd'),_0x383b('0xe')],'as':_0x383b('0xc')}]},{'model':_0x383b('0xf'),'as':_0x383b('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x383b('0x4'),_0x383b('0x6'),_0x383b('0xd'),_0x383b('0xe')],'as':_0x383b('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x383b('0x11')]=function(_0x4816c7,_0x149ca6){return client['Request'](_0x383b('0x12'),{'account':{'id':_0x4816c7},'body':_0x149ca6,'log':_0x383b('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6fd121c..a3634a9 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 _0x1e07=['GetSettings','../client','getSettings','loginMailFrequency'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x1e07,0xe1));var _0x71e0=function(_0x2f4e9b,_0x207f22){_0x2f4e9b=_0x2f4e9b-0x0;var _0x55f60c=_0x1e07[_0x2f4e9b];return _0x55f60c;};'use strict';var client=require(_0x71e0('0x0'));exports[_0x71e0('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x71e0('0x2')]},'log':_0x71e0('0x3')});}; \ No newline at end of file +var _0x0e32=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x23d317,_0x1ca3cc){var _0x348731=function(_0x4881c3){while(--_0x4881c3){_0x23d317['push'](_0x23d317['shift']());}};_0x348731(++_0x1ca3cc);}(_0x0e32,0x16c));var _0x20e3=function(_0x6f3395,_0x344256){_0x6f3395=_0x6f3395-0x0;var _0x285d66=_0x0e32[_0x6f3395];return _0x285d66;};'use strict';var client=require(_0x20e3('0x0'));exports[_0x20e3('0x1')]=function(){return client[_0x20e3('0x2')](_0x20e3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x20e3('0x4')]},'log':_0x20e3('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7f68497..353b481 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 12c11ec..5e61aa9 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 _0x0cfd=['defaults','localhost','../../config/triggers','default','once','listening','log','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','socket.io','redis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0cfd,0x107));var _0xd0cf=function(_0x52e130,_0x36a67c){_0x52e130=_0x52e130-0x0;var _0x167346=_0x0cfd[_0x52e130];return _0x167346;};'use strict';var _=require(_0xd0cf('0x0'));var http=require(_0xd0cf('0x1'));var express=require(_0xd0cf('0x2'));var sticky=require(_0xd0cf('0x3'));var Redis=require(_0xd0cf('0x4'));var config=require(_0xd0cf('0x5'));var app=express();var server=http[_0xd0cf('0x6')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xd0cf('0x7'))(server,{'transports':['websocket','polling']});config[_0xd0cf('0x8')]=_[_0xd0cf('0x9')](config['redis'],{'host':_0xd0cf('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xd0cf('0x8')]),'subClient':new Redis(config['redis'])}));require(_0xd0cf('0xb'))[_0xd0cf('0xc')]();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0xd0cf('0xc')](app);require('../../routes')['default'](app);}else{server[_0xd0cf('0xd')](_0xd0cf('0xe'),function(){console[_0xd0cf('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0xb145=['exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log'];(function(_0xcfeb73,_0x4eed3b){var _0x5e1bb5=function(_0x1e85e0){while(--_0x1e85e0){_0xcfeb73['push'](_0xcfeb73['shift']());}};_0x5e1bb5(++_0x4eed3b);}(_0xb145,0x171));var _0x5b14=function(_0x9a0e3d,_0x60e858){_0x9a0e3d=_0x9a0e3d-0x0;var _0x3aa6cd=_0xb145[_0x9a0e3d];return _0x3aa6cd;};'use strict';var _=require(_0x5b14('0x0'));var http=require(_0x5b14('0x1'));var express=require(_0x5b14('0x2'));var sticky=require(_0x5b14('0x3'));var Redis=require(_0x5b14('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x5b14('0x5')](app);server[_0x5b14('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x5b14('0x7')])){var socketio=require(_0x5b14('0x8'))(server,{'transports':[_0x5b14('0x9'),_0x5b14('0xa')]});config['redis']=_['defaults'](config[_0x5b14('0xb')],{'host':_0x5b14('0xc'),'port':0x18eb});socketio[_0x5b14('0xd')](require(_0x5b14('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x5b14('0xb')])}));require(_0x5b14('0xf'))[_0x5b14('0x10')]();require(_0x5b14('0x11'))[_0x5b14('0x10')](socketio);require(_0x5b14('0x12'))[_0x5b14('0x10')](app);require(_0x5b14('0x13'))[_0x5b14('0x10')](app);}else{server['once'](_0x5b14('0x14'),function(){console[_0x5b14('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5b14('0x7')]);});}exports=module[_0x5b14('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 122d2ed..300ed41 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 _0x4a87=['routing','http','request','then','debug','error','message','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x1256d5,_0x5862b8){var _0x246866=function(_0x3da346){while(--_0x3da346){_0x1256d5['push'](_0x1256d5['shift']());}};_0x246866(++_0x5862b8);}(_0x4a87,0xa5));var _0x74a8=function(_0x368ddb,_0x409d59){_0x368ddb=_0x368ddb-0x0;var _0x59c380=_0x4a87[_0x368ddb];return _0x59c380;};'use strict';var jayson=require(_0x74a8('0x0'));var BPromise=require(_0x74a8('0x1'));var logger=require(_0x74a8('0x2'))(_0x74a8('0x3'));var client=jayson['client'][_0x74a8('0x4')]({'port':0x2329});client['Request']=function(_0xf59d4d,_0x3a7ef3){return new BPromise(function(_0x5810f5,_0x393c13){return client[_0x74a8('0x5')](_0xf59d4d,_0x3a7ef3)[_0x74a8('0x6')](function(_0x308e80){logger[_0x74a8('0x7')]('rpc',_0x74a8('0x3'),_0xf59d4d,_0x3a7ef3,_0x308e80);if(_0x308e80['error']){logger[_0x74a8('0x8')]('rpc',_0x74a8('0x3'),_0xf59d4d,_0x308e80['error'][_0x74a8('0x9')],_0x3a7ef3);return _0x393c13(_0x308e80['error'][_0x74a8('0x9')]);}else{return _0x5810f5(_0x308e80[_0x74a8('0xa')]);}})[_0x74a8('0xb')](function(_0x4ead5a){logger['error'](_0x74a8('0xc'),_0x74a8('0x3'),_0xf59d4d,_0x4ead5a,_0x3a7ef3);return _0x393c13(_0x4ead5a);});});};module[_0x74a8('0xd')]=client; \ No newline at end of file +var _0x919c=['jayson/promise','bluebird','client','Request','request','then','debug','rpc','routing','error','result','catch','exports'];(function(_0x54229d,_0x3937cd){var _0x9b165e=function(_0x11f54a){while(--_0x11f54a){_0x54229d['push'](_0x54229d['shift']());}};_0x9b165e(++_0x3937cd);}(_0x919c,0x8f));var _0xc919=function(_0x2e450d,_0x5264e3){_0x2e450d=_0x2e450d-0x0;var _0x3d8c6c=_0x919c[_0x2e450d];return _0x3d8c6c;};'use strict';var jayson=require(_0xc919('0x0'));var BPromise=require(_0xc919('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xc919('0x2')]['http']({'port':0x2329});client[_0xc919('0x3')]=function(_0x1fef59,_0x2969ce){return new BPromise(function(_0xde290c,_0x5f7256){return client[_0xc919('0x4')](_0x1fef59,_0x2969ce)[_0xc919('0x5')](function(_0x10ed2a){logger[_0xc919('0x6')](_0xc919('0x7'),_0xc919('0x8'),_0x1fef59,_0x2969ce,_0x10ed2a);if(_0x10ed2a['error']){logger[_0xc919('0x9')](_0xc919('0x7'),_0xc919('0x8'),_0x1fef59,_0x10ed2a[_0xc919('0x9')]['message'],_0x2969ce);return _0x5f7256(_0x10ed2a[_0xc919('0x9')]['message']);}else{return _0xde290c(_0x10ed2a[_0xc919('0xa')]);}})[_0xc919('0xb')](function(_0x5a430c){logger[_0xc919('0x9')](_0xc919('0x7'),_0xc919('0x8'),_0x1fef59,_0x5a430c,_0x2969ce);return _0x5f7256(_0x5a430c);});});};module[_0xc919('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 017b4be..b9b6c5d 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 _0x70f9=['getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','then','initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0xc48cfe,_0x4926a8){var _0x3ca6f9=function(_0x13c63e){while(--_0x13c63e){_0xc48cfe['push'](_0xc48cfe['shift']());}};_0x3ca6f9(++_0x4926a8);}(_0x70f9,0x103));var _0x970f=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x70f9[_0x4350c2];return _0x8b6406;};'use strict';var BPromise=require(_0x970f('0x0'));var server=require(_0x970f('0x1'));var Realtime=require(_0x970f('0x2'));var user=require(_0x970f('0x3'));var interval=require(_0x970f('0x4'));var openchannelQueue=require(_0x970f('0x5'));var chatQueue=require(_0x970f('0x6'));var smsQueue=require(_0x970f('0x7'));var mailQueue=require(_0x970f('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x970f('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x970f('0xa')](user['getAgents']())[_0x970f('0xa')](realtime[_0x970f('0xb')]())[_0x970f('0xa')](interval['getIntervals']())[_0x970f('0xa')](realtime['initIntervals']())[_0x970f('0xa')](openchannelQueue[_0x970f('0xc')]())['then'](realtime[_0x970f('0xd')]())['then'](chatQueue[_0x970f('0xe')]())[_0x970f('0xa')](realtime[_0x970f('0xf')]())[_0x970f('0xa')](smsQueue[_0x970f('0x10')]())[_0x970f('0xa')](realtime[_0x970f('0x11')]())['then'](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0x970f('0xa')](faxQueue[_0x970f('0x12')]())[_0x970f('0xa')](realtime[_0x970f('0x13')]())[_0x970f('0xa')](whatsappQueue[_0x970f('0x14')]())[_0x970f('0xa')](realtime[_0x970f('0x15')]())[_0x970f('0xa')](function(){return realtime;});}function main(){return server[_0x970f('0x16')](realtime)['then'](function(_0x3bcf87){return initRealtime();})[_0x970f('0xa')](function(_0xcaff88){return setInterval(initRealtime,0x1388);})[_0x970f('0x17')](function(_0x50bfa7){console[_0x970f('0x18')](_0x50bfa7);});}main(); \ No newline at end of file +var _0x9000=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime'];(function(_0x1040c8,_0x1baa50){var _0x5d0df0=function(_0x182b7f){while(--_0x182b7f){_0x1040c8['push'](_0x1040c8['shift']());}};_0x5d0df0(++_0x1baa50);}(_0x9000,0xc8));var _0x0900=function(_0x4b9c29,_0x46c107){_0x4b9c29=_0x4b9c29-0x0;var _0xfacb34=_0x9000[_0x4b9c29];return _0xfacb34;};'use strict';var BPromise=require(_0x0900('0x0'));var server=require(_0x0900('0x1'));var Realtime=require(_0x0900('0x2'));var user=require(_0x0900('0x3'));var interval=require(_0x0900('0x4'));var openchannelQueue=require(_0x0900('0x5'));var chatQueue=require(_0x0900('0x6'));var smsQueue=require(_0x0900('0x7'));var mailQueue=require(_0x0900('0x8'));var faxQueue=require(_0x0900('0x9'));var whatsappQueue=require(_0x0900('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0900('0xb')]()['then'](user[_0x0900('0xc')]())['then'](realtime['initAgents']())[_0x0900('0xd')](interval[_0x0900('0xe')]())['then'](realtime[_0x0900('0xf')]())[_0x0900('0xd')](openchannelQueue['getOpenchannelQueues']())[_0x0900('0xd')](realtime[_0x0900('0x10')]())[_0x0900('0xd')](chatQueue[_0x0900('0x11')]())[_0x0900('0xd')](realtime[_0x0900('0x12')]())['then'](smsQueue[_0x0900('0x13')]())[_0x0900('0xd')](realtime[_0x0900('0x14')]())[_0x0900('0xd')](mailQueue[_0x0900('0x15')]())[_0x0900('0xd')](realtime[_0x0900('0x16')]())[_0x0900('0xd')](faxQueue[_0x0900('0x17')]())[_0x0900('0xd')](realtime[_0x0900('0x18')]())['then'](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x0900('0x19')]())['then'](function(){return realtime;});}function main(){return server[_0x0900('0x1a')](realtime)[_0x0900('0xd')](function(_0x1b9911){return initRealtime();})[_0x0900('0xd')](function(_0x5415a5){return setInterval(initRealtime,0x1388);})[_0x0900('0x1b')](function(_0x26c48a){console[_0x0900('0x1c')](_0x26c48a);});}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 5e2afb4..2d4651f 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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x1ee5ef,_0x38d42b){var _0x448ab8=function(_0x508932){while(--_0x508932){_0x1ee5ef['push'](_0x1ee5ef['shift']());}};_0x448ab8(++_0x38d42b);}(_0x326f,0xd1));var _0xf326=function(_0x3f0af2,_0x361fe0){_0x3f0af2=_0x3f0af2-0x0;var _0x5c8974=_0x326f[_0x3f0af2];return _0x5c8974;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +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(_0x1cca82,_0x5c2d29){var _0xe5527d=function(_0x308708){while(--_0x308708){_0x1cca82['push'](_0x1cca82['shift']());}};_0xe5527d(++_0x5c2d29);}(_0x814b,0x1a2));var _0xb814=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0x814b[_0x104b35];return _0x55584d;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2506076..c2dc1af 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 _0x2209=['then','error','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2209,0xe1));var _0x9220=function(_0xb2627d,_0x524e30){_0xb2627d=_0xb2627d-0x0;var _0x5aa69b=_0x2209[_0xb2627d];return _0x5aa69b;};'use strict';var BPromise=require(_0x9220('0x0'));var jayson=require(_0x9220('0x1'));var client=jayson[_0x9220('0x2')][_0x9220('0x3')]({'port':0x232b});function request(_0x37877b,_0x505a1f){return new BPromise(function(_0xa3e011,_0x2d956b){return client[_0x9220('0x4')](_0x37877b,_0x505a1f)[_0x9220('0x5')](function(_0x2add8a){if(_0x2add8a[_0x9220('0x6')]){return _0x2d956b(_0x2add8a[_0x9220('0x6')]['message']);}else{return _0xa3e011(_0x2add8a['result']);}})[_0x9220('0x7')](function(_0x493705){return _0x2d956b(_0x493705);});});}exports[_0x9220('0x8')]=function(_0x4fac06,_0x5ae18b){return request(_0x9220('0x9'),{'account':_0x4fac06,'message':_0x5ae18b});}; \ No newline at end of file +var _0xcf53=['http','request','then','error','message','result','catch','bluebird','jayson/promise'];(function(_0x47b319,_0x791a39){var _0x56ae66=function(_0x44726a){while(--_0x44726a){_0x47b319['push'](_0x47b319['shift']());}};_0x56ae66(++_0x791a39);}(_0xcf53,0x85));var _0x3cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf53[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x3cf5('0x0'));var jayson=require(_0x3cf5('0x1'));var client=jayson['client'][_0x3cf5('0x2')]({'port':0x232b});function request(_0x5b2660,_0x1f7f7f){return new BPromise(function(_0x231c5c,_0x5b3aa2){return client[_0x3cf5('0x3')](_0x5b2660,_0x1f7f7f)[_0x3cf5('0x4')](function(_0xaca09d){if(_0xaca09d[_0x3cf5('0x5')]){return _0x5b3aa2(_0xaca09d[_0x3cf5('0x5')][_0x3cf5('0x6')]);}else{return _0x231c5c(_0xaca09d[_0x3cf5('0x7')]);}})[_0x3cf5('0x8')](function(_0xb4e173){return _0x5b3aa2(_0xb4e173);});});}exports['sendMailMessage']=function(_0x3022a5,_0x2f5e7a){return request('SendMail',{'account':_0x3022a5,'message':_0x2f5e7a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 7b586b4..b542af8 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 _0xa74b=['emit','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','voicePause','smsStatusTime','mailWaitingInteractions','stringify'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa74b,0x15b));var _0xba74=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa74b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xba74('0x0'));var moment=require(_0xba74('0x1'));var md5=require(_0xba74('0x2'));var Redis=require(_0xba74('0x3'));var config=require(_0xba74('0x4'));config[_0xba74('0x5')]=_[_0xba74('0x6')](config[_0xba74('0x5')],{'host':_0xba74('0x7'),'port':0x18eb});var io=require(_0xba74('0x8'))(new Redis(config['redis']));function Agent(_0x56f87d){this['id']=_0x56f87d['id']||0x0;this[_0xba74('0x9')]=_0x56f87d[_0xba74('0x9')]||'';this[_0xba74('0xa')]=_0x56f87d['online']||!![];this['voicePause']=_0x56f87d['voicePause']||![];this['chatPause']=_0x56f87d[_0xba74('0xb')]||![];this[_0xba74('0xc')]=_0x56f87d[_0xba74('0xc')]||![];this[_0xba74('0xd')]=_0x56f87d['faxPause']||![];this[_0xba74('0xe')]=_0x56f87d['smsPause']||![];this[_0xba74('0xf')]=_0x56f87d['openchannelPause']||![];this[_0xba74('0x10')]='unknown';this[_0xba74('0x11')]=0x0;this[_0xba74('0x12')]=_0x56f87d[_0xba74('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xba74('0x13')]=_0xba74('0x14');this['mailStatusTime']=0x0;this[_0xba74('0x15')]=_0x56f87d['mailCapacity']||0x0;this[_0xba74('0x16')]=0x0;this[_0xba74('0x17')]=_0xba74('0x14');this[_0xba74('0x18')]=0x0;this[_0xba74('0x19')]=_0x56f87d[_0xba74('0x19')]||0x0;this[_0xba74('0x1a')]=0x0;this[_0xba74('0x1b')]=_0xba74('0x14');this['smsStatusTime']=0x0;this[_0xba74('0x1c')]=_0x56f87d[_0xba74('0x1c')]||0x0;this[_0xba74('0x1d')]=0x0;this['whatsappStatus']=_0xba74('0x14');this[_0xba74('0x1e')]=0x0;this[_0xba74('0x1f')]=_0x56f87d['whatsappCapacity']||0x0;this[_0xba74('0x20')]=0x0;this[_0xba74('0x21')]=_0xba74('0x14');this[_0xba74('0x22')]=0x0;this[_0xba74('0x23')]=_0x56f87d['openchannelCapacity']||0x0;this[_0xba74('0x24')]=0x0;this[_0xba74('0x25')]=![];this[_0xba74('0x26')]=undefined;this['md5']='';this[_0xba74('0x27')]={};this[_0xba74('0x28')]={};this['mailWaitingInteractions']={};this[_0xba74('0x29')]={};this[_0xba74('0x2a')]={};this[_0xba74('0x2b')]={};this[_0xba74('0x2c')]();}Agent[_0xba74('0x2d')][_0xba74('0x2e')]=function(_0x58af1d){if(this[_0x58af1d+_0xba74('0x2f')]>0x0){if(this[_0x58af1d+_0xba74('0x30')]>0x0&&this[_0x58af1d+_0xba74('0x2f')]>=this[_0x58af1d+_0xba74('0x30')]){return _0xba74('0x31');}else{return _0xba74('0x32');}}else{return _0xba74('0x33');}};Agent[_0xba74('0x2d')][_0xba74('0x2c')]=function(){var _0x14b6ec=[_0xba74('0x34'),_0xba74('0x35'),_0xba74('0x36'),_0xba74('0x37'),_0xba74('0x38'),_0xba74('0x39')];for(var _0x136dc9=0x0;_0x136dc9<_0x14b6ec[_0xba74('0x3a')];_0x136dc9+=0x1){var _0x2b3a63=this[_0xba74('0x2e')](_0x14b6ec[_0x136dc9]);if(this[_0x14b6ec[_0x136dc9]+_0xba74('0x3b')]!==_0x2b3a63){this[_0x14b6ec[_0x136dc9]+_0xba74('0x3c')]=_[_0xba74('0x3d')](moment()[_0xba74('0x3e')]('x'));}this[_0x14b6ec[_0x136dc9]+'Status']=_0x2b3a63;}var _0x288a2d={'id':this['id'],'name':this[_0xba74('0x9')],'online':this[_0xba74('0xa')],'voicePause':this[_0xba74('0x3f')],'chatPause':this[_0xba74('0xb')],'mailPause':this[_0xba74('0xc')],'smsPause':this[_0xba74('0xe')],'faxPause':this[_0xba74('0xd')],'openchannelPause':this[_0xba74('0xf')],'chatStatus':this[_0xba74('0x10')],'chatStatusTime':this[_0xba74('0x11')],'chatCapacity':this[_0xba74('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xba74('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xba74('0x17')],'faxStatusTime':this[_0xba74('0x18')],'faxCapacity':this[_0xba74('0x19')],'faxCurrentCapacity':this[_0xba74('0x1a')],'smsStatus':this[_0xba74('0x1b')],'smsStatusTime':this[_0xba74('0x40')],'smsCapacity':this[_0xba74('0x1c')],'smsCurrentCapacity':this[_0xba74('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xba74('0x1f')],'whatsappCurrentCapacity':this[_0xba74('0x20')],'openchannelStatus':this[_0xba74('0x21')],'openchannelStatusTime':this[_0xba74('0x22')],'openchannelCapacity':this[_0xba74('0x23')],'openchannelCurrentCapacity':this[_0xba74('0x24')],'busy':this[_0xba74('0x25')],'busyQueue':this[_0xba74('0x26')],'chatWaitingInteractions':this[_0xba74('0x27')],'faxWaitingInteractions':this[_0xba74('0x28')],'mailWaitingInteractions':this[_0xba74('0x41')],'openchannelWaitingInteractions':this[_0xba74('0x29')],'smsWaitingInteractions':this[_0xba74('0x2a')],'whatsappWaitingInteractions':this[_0xba74('0x2b')]};var _0x332662=md5(JSON[_0xba74('0x42')](_0x288a2d));if(this[_0xba74('0x2')]!==_0x332662){this[_0xba74('0x2')]=_0x332662;io[_0xba74('0x43')](_0xba74('0x44'),_0x288a2d);}};module['exports']=Agent; \ No newline at end of file +var _0x939d=['chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','getChannelStatus','Capacity','maxcapacity','working','idle','prototype','updateRealtime','mail','chat','openchannel','sms','Status','toNumber','format','faxCurrentCapacity','smsStatus','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','md5','emit','user:save','exports','moment','ioredis','redis','defaults','localhost','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x33f150,_0x3d23ff){var _0x175717=function(_0x10dcda){while(--_0x10dcda){_0x33f150['push'](_0x33f150['shift']());}};_0x175717(++_0x3d23ff);}(_0x939d,0x1f4));var _0xd939=function(_0x160e0a,_0x50f7cd){_0x160e0a=_0x160e0a-0x0;var _0x4205f3=_0x939d[_0x160e0a];return _0x4205f3;};'use strict';var _=require('lodash');var moment=require(_0xd939('0x0'));var md5=require('md5');var Redis=require(_0xd939('0x1'));var config=require('../../../config/environment');config[_0xd939('0x2')]=_[_0xd939('0x3')](config[_0xd939('0x2')],{'host':_0xd939('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd939('0x2')]));function Agent(_0x3efeda){this['id']=_0x3efeda['id']||0x0;this[_0xd939('0x5')]=_0x3efeda[_0xd939('0x5')]||'';this[_0xd939('0x6')]=_0x3efeda['online']||!![];this[_0xd939('0x7')]=_0x3efeda[_0xd939('0x7')]||![];this['chatPause']=_0x3efeda['chatPause']||![];this[_0xd939('0x8')]=_0x3efeda[_0xd939('0x8')]||![];this[_0xd939('0x9')]=_0x3efeda[_0xd939('0x9')]||![];this[_0xd939('0xa')]=_0x3efeda[_0xd939('0xa')]||![];this[_0xd939('0xb')]=_0x3efeda['openchannelPause']||![];this[_0xd939('0xc')]=_0xd939('0xd');this[_0xd939('0xe')]=0x0;this[_0xd939('0xf')]=_0x3efeda[_0xd939('0xf')]||0x0;this[_0xd939('0x10')]=0x0;this[_0xd939('0x11')]=_0xd939('0xd');this[_0xd939('0x12')]=0x0;this[_0xd939('0x13')]=_0x3efeda['mailCapacity']||0x0;this[_0xd939('0x14')]=0x0;this[_0xd939('0x15')]='unknown';this[_0xd939('0x16')]=0x0;this[_0xd939('0x17')]=_0x3efeda[_0xd939('0x17')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xd939('0xd');this[_0xd939('0x18')]=0x0;this[_0xd939('0x19')]=_0x3efeda[_0xd939('0x19')]||0x0;this[_0xd939('0x1a')]=0x0;this[_0xd939('0x1b')]=_0xd939('0xd');this[_0xd939('0x1c')]=0x0;this['whatsappCapacity']=_0x3efeda[_0xd939('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd939('0x1e')]='unknown';this['openchannelStatusTime']=0x0;this[_0xd939('0x1f')]=_0x3efeda[_0xd939('0x1f')]||0x0;this[_0xd939('0x20')]=0x0;this[_0xd939('0x21')]=![];this['busyQueue']=undefined;this['md5']='';this[_0xd939('0x22')]={};this[_0xd939('0x23')]={};this[_0xd939('0x24')]={};this['openchannelWaitingInteractions']={};this[_0xd939('0x25')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype'][_0xd939('0x26')]=function(_0x2acbf9){if(this[_0x2acbf9+'CurrentCapacity']>0x0){if(this[_0x2acbf9+_0xd939('0x27')]>0x0&&this[_0x2acbf9+'CurrentCapacity']>=this[_0x2acbf9+_0xd939('0x27')]){return _0xd939('0x28');}else{return _0xd939('0x29');}}else{return _0xd939('0x2a');}};Agent[_0xd939('0x2b')][_0xd939('0x2c')]=function(){var _0x57d777=[_0xd939('0x2d'),_0xd939('0x2e'),_0xd939('0x2f'),'fax',_0xd939('0x30'),'whatsapp'];for(var _0x3e665e=0x0;_0x3e665e<_0x57d777['length'];_0x3e665e+=0x1){var _0x27f886=this['getChannelStatus'](_0x57d777[_0x3e665e]);if(this[_0x57d777[_0x3e665e]+_0xd939('0x31')]!==_0x27f886){this[_0x57d777[_0x3e665e]+'StatusTime']=_[_0xd939('0x32')](moment()[_0xd939('0x33')]('x'));}this[_0x57d777[_0x3e665e]+_0xd939('0x31')]=_0x27f886;}var _0x42271f={'id':this['id'],'name':this[_0xd939('0x5')],'online':this[_0xd939('0x6')],'voicePause':this[_0xd939('0x7')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xd939('0xa')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd939('0xb')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd939('0xe')],'chatCapacity':this[_0xd939('0xf')],'chatCurrentCapacity':this[_0xd939('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xd939('0x12')],'mailCapacity':this[_0xd939('0x13')],'mailCurrentCapacity':this[_0xd939('0x14')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xd939('0x16')],'faxCapacity':this[_0xd939('0x17')],'faxCurrentCapacity':this[_0xd939('0x34')],'smsStatus':this[_0xd939('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xd939('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xd939('0x1c')],'whatsappCapacity':this[_0xd939('0x1d')],'whatsappCurrentCapacity':this[_0xd939('0x36')],'openchannelStatus':this[_0xd939('0x1e')],'openchannelStatusTime':this[_0xd939('0x37')],'openchannelCapacity':this[_0xd939('0x1f')],'openchannelCurrentCapacity':this[_0xd939('0x20')],'busy':this[_0xd939('0x21')],'busyQueue':this[_0xd939('0x38')],'chatWaitingInteractions':this[_0xd939('0x22')],'faxWaitingInteractions':this[_0xd939('0x23')],'mailWaitingInteractions':this[_0xd939('0x24')],'openchannelWaitingInteractions':this[_0xd939('0x39')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xd939('0x3a')]};var _0x5c2b6a=md5(JSON[_0xd939('0x3b')](_0x42271f));if(this[_0xd939('0x3c')]!==_0x5c2b6a){this['md5']=_0x5c2b6a;io[_0xd939('0x3d')](_0xd939('0x3e'),_0x42271f);}};module[_0xd939('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 94e773c..d0e224d 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 _0xd942=['md5','util','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','online','chatPause','paused','available','waiting','format','chat:queue:%s','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd942,0x6b));var _0x2d94=function(_0x1b26b8,_0x43c5a2){_0x1b26b8=_0x1b26b8-0x0;var _0x178346=_0xd942[_0x1b26b8];return _0x178346;};'use strict';var _=require(_0x2d94('0x0'));var md5=require(_0x2d94('0x1'));var util=require(_0x2d94('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x2d94('0x3')](config[_0x2d94('0x4')],{'host':_0x2d94('0x5'),'port':0x18eb});var io=require(_0x2d94('0x6'))(new Redis(config[_0x2d94('0x4')]));function ChatQueue(_0x2d0e09){this['id']=_0x2d0e09['id']||0x0;this[_0x2d94('0x7')]=_0x2d0e09[_0x2d94('0x7')]||'';this[_0x2d94('0x8')]=_0x2d0e09[_0x2d94('0x8')]||0xa;this[_0x2d94('0x9')]=_0x2d0e09[_0x2d94('0x9')]||_0x2d94('0xa');this[_0x2d94('0xb')]=_0x2d0e09[_0x2d94('0xb')];this[_0x2d94('0xc')]={};this['waiting']=0x0;this[_0x2d94('0x1')]='';this[_0x2d94('0xd')]();this[_0x2d94('0xe')]();}ChatQueue[_0x2d94('0xf')][_0x2d94('0xd')]=function(){var _0xf37881=this[_0x2d94('0xc')][_0x2d94('0x10')];this[_0x2d94('0xc')]=_['map'](this[_0x2d94('0xb')],'id');this[_0x2d94('0xc')][_0x2d94('0x10')]=_0xf37881;};ChatQueue[_0x2d94('0xf')]['updateRealtime']=function(){this[_0x2d94('0x11')]=0x0;this['paused']=0x0;for(var _0xd3412a=0x0;_0xd3412a=0x0?this['available']:0x0;var _0x486c51={'id':this['id'],'available':this[_0x2d94('0x16')],'loggedIn':this[_0x2d94('0x11')],'name':this[_0x2d94('0x7')],'paused':this[_0x2d94('0x15')],'waiting':this[_0x2d94('0x17')]};var _0x35c111=md5(JSON['stringify'](_0x486c51));if(this[_0x2d94('0x1')]!==_0x35c111){this['md5']=_0x35c111;io['to'](util[_0x2d94('0x18')](_0x2d94('0x19'),_0x486c51['name']))['emit']('chat_queue:save',_0x486c51);}};module[_0x2d94('0x1a')]=ChatQueue; \ No newline at end of file +var _0xc8de=['timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','emit','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x5df866,_0x1cfa1a){var _0x1b259e=function(_0x571bec){while(--_0x571bec){_0x5df866['push'](_0x5df866['shift']());}};_0x1b259e(++_0x1cfa1a);}(_0xc8de,0x18d));var _0xec8d=function(_0x43f903,_0x593f0d){_0x43f903=_0x43f903-0x0;var _0x2ec116=_0xc8de[_0x43f903];return _0x2ec116;};'use strict';var _=require('lodash');var md5=require(_0xec8d('0x0'));var util=require(_0xec8d('0x1'));var Redis=require(_0xec8d('0x2'));var config=require(_0xec8d('0x3'));config['redis']=_[_0xec8d('0x4')](config[_0xec8d('0x5')],{'host':_0xec8d('0x6'),'port':0x18eb});var io=require(_0xec8d('0x7'))(new Redis(config[_0xec8d('0x5')]));function ChatQueue(_0x1923b8){this['id']=_0x1923b8['id']||0x0;this[_0xec8d('0x8')]=_0x1923b8[_0xec8d('0x8')]||'';this[_0xec8d('0x9')]=_0x1923b8[_0xec8d('0x9')]||0xa;this[_0xec8d('0xa')]=_0x1923b8['strategy']||_0xec8d('0xb');this['Agents']=_0x1923b8[_0xec8d('0xc')];this['mapAgentsId']={};this[_0xec8d('0xd')]=0x0;this[_0xec8d('0x0')]='';this['updateRouting']();this[_0xec8d('0xe')]();}ChatQueue['prototype'][_0xec8d('0xf')]=function(){var _0x3a36a8=this[_0xec8d('0x10')][_0xec8d('0x11')];this['mapAgentsId']=_[_0xec8d('0x12')](this['Agents'],'id');this[_0xec8d('0x10')]['_rr']=_0x3a36a8;};ChatQueue[_0xec8d('0x13')][_0xec8d('0xe')]=function(){this[_0xec8d('0x14')]=0x0;this[_0xec8d('0x15')]=0x0;for(var _0x2c8497=0x0;_0x2c8497=0x0?this[_0xec8d('0x18')]:0x0;var _0x2f3a9f={'id':this['id'],'available':this[_0xec8d('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xec8d('0x8')],'paused':this[_0xec8d('0x15')],'waiting':this[_0xec8d('0xd')]};var _0x29f334=md5(JSON[_0xec8d('0x19')](_0x2f3a9f));if(this['md5']!==_0x29f334){this[_0xec8d('0x0')]=_0x29f334;io['to'](util['format']('chat:queue:%s',_0x2f3a9f[_0xec8d('0x8')]))[_0xec8d('0x1a')](_0xec8d('0x1b'),_0x2f3a9f);}};module[_0xec8d('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 82f91a4..188706d 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 _0x3eb6=['stringify','format','fax:queue:%s','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0x3eb6,0x113));var _0x63eb=function(_0x32e919,_0x4fd27c){_0x32e919=_0x32e919-0x0;var _0x2fc4cb=_0x3eb6[_0x32e919];return _0x2fc4cb;};'use strict';var _=require('lodash');var md5=require(_0x63eb('0x0'));var util=require(_0x63eb('0x1'));var Redis=require(_0x63eb('0x2'));var config=require(_0x63eb('0x3'));config['redis']=_[_0x63eb('0x4')](config[_0x63eb('0x5')],{'host':_0x63eb('0x6'),'port':0x18eb});var io=require(_0x63eb('0x7'))(new Redis(config[_0x63eb('0x5')]));function FaxQueue(_0x31e0b5){this['id']=_0x31e0b5['id']||0x0;this['name']=_0x31e0b5[_0x63eb('0x8')]||'';this[_0x63eb('0x9')]=_0x31e0b5[_0x63eb('0x9')]||0xa;this[_0x63eb('0xa')]=_0x31e0b5[_0x63eb('0xa')]||_0x63eb('0xb');this['Agents']=_0x31e0b5[_0x63eb('0xc')];this[_0x63eb('0xd')]={};this[_0x63eb('0xe')]=0x0;this[_0x63eb('0x0')]='';this[_0x63eb('0xf')]();this['updateRealtime']();}FaxQueue[_0x63eb('0x10')][_0x63eb('0xf')]=function(){var _0x3a9d17=this['mapAgentsId'][_0x63eb('0x11')];this[_0x63eb('0xd')]=_[_0x63eb('0x12')](this[_0x63eb('0xc')],'id');this[_0x63eb('0xd')]['_rr']=_0x3a9d17;};FaxQueue[_0x63eb('0x10')][_0x63eb('0x13')]=function(){this[_0x63eb('0x14')]=0x0;this[_0x63eb('0x15')]=0x0;for(var _0x3b7855=0x0;_0x3b7855=0x0?this[_0x63eb('0x18')]:0x0;var _0x31397e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x63eb('0x14')],'name':this[_0x63eb('0x8')],'paused':this[_0x63eb('0x15')],'waiting':this[_0x63eb('0xe')]};var _0x3dda9e=md5(JSON[_0x63eb('0x19')](_0x31397e));if(this[_0x63eb('0x0')]!==_0x3dda9e){this[_0x63eb('0x0')]=_0x3dda9e;io['to'](util[_0x63eb('0x1a')](_0x63eb('0x1b'),_0x31397e[_0x63eb('0x8')]))['emit'](_0x63eb('0x1c'),_0x31397e);}};module[_0x63eb('0x1d')]=FaxQueue; \ No newline at end of file +var _0xf160=['fax:queue:%s','emit','exports','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format'];(function(_0x41614f,_0x215189){var _0x432d1b=function(_0xf1ded4){while(--_0xf1ded4){_0x41614f['push'](_0x41614f['shift']());}};_0x432d1b(++_0x215189);}(_0xf160,0x1f0));var _0x0f16=function(_0x314d01,_0x1f19d4){_0x314d01=_0x314d01-0x0;var _0x570e37=_0xf160[_0x314d01];return _0x570e37;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0f16('0x0'));var Redis=require(_0x0f16('0x1'));var config=require('../../../config/environment');config[_0x0f16('0x2')]=_[_0x0f16('0x3')](config[_0x0f16('0x2')],{'host':_0x0f16('0x4'),'port':0x18eb});var io=require(_0x0f16('0x5'))(new Redis(config[_0x0f16('0x2')]));function FaxQueue(_0x293e08){this['id']=_0x293e08['id']||0x0;this[_0x0f16('0x6')]=_0x293e08['name']||'';this[_0x0f16('0x7')]=_0x293e08[_0x0f16('0x7')]||0xa;this['strategy']=_0x293e08[_0x0f16('0x8')]||_0x0f16('0x9');this['Agents']=_0x293e08[_0x0f16('0xa')];this[_0x0f16('0xb')]={};this[_0x0f16('0xc')]=0x0;this[_0x0f16('0xd')]='';this['updateRouting']();this[_0x0f16('0xe')]();}FaxQueue[_0x0f16('0xf')]['updateRouting']=function(){var _0x1f4c8b=this[_0x0f16('0xb')][_0x0f16('0x10')];this[_0x0f16('0xb')]=_[_0x0f16('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x0f16('0x10')]=_0x1f4c8b;};FaxQueue[_0x0f16('0xf')][_0x0f16('0xe')]=function(){this[_0x0f16('0x12')]=0x0;this[_0x0f16('0x13')]=0x0;for(var _0x428279=0x0;_0x428279=0x0?this[_0x0f16('0x17')]:0x0;var _0x3792ba={'id':this['id'],'available':this[_0x0f16('0x17')],'loggedIn':this[_0x0f16('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0f16('0xc')]};var _0x329a73=md5(JSON[_0x0f16('0x18')](_0x3792ba));if(this[_0x0f16('0xd')]!==_0x329a73){this['md5']=_0x329a73;io['to'](util[_0x0f16('0x19')](_0x0f16('0x1a'),_0x3792ba['name']))[_0x0f16('0x1b')]('fax_queue:save',_0x3792ba);}};module[_0x0f16('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 60deb61..d96fa33 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 _0xf186=['name','Intervals'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0xf186,0x122));var _0x6f18=function(_0x574dd2,_0x12eeb2){_0x574dd2=_0x574dd2-0x0;var _0x3ff667=_0xf186[_0x574dd2];return _0x3ff667;};'use strict';function Interval(_0x40a24a){this['id']=_0x40a24a['id']||0x0;this[_0x6f18('0x0')]=_0x40a24a[_0x6f18('0x0')]||'';this['Intervals']=_0x40a24a[_0x6f18('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x7771=['Intervals','exports','name'];(function(_0x3c3fe8,_0x5c9320){var _0x214aa2=function(_0x51ac57){while(--_0x51ac57){_0x3c3fe8['push'](_0x3c3fe8['shift']());}};_0x214aa2(++_0x5c9320);}(_0x7771,0x1ee));var _0x1777=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x7771[_0x3bd52b];return _0x1e5b89;};'use strict';function Interval(_0x5e39c1){this['id']=_0x5e39c1['id']||0x0;this[_0x1777('0x0')]=_0x5e39c1[_0x1777('0x0')]||'';this['Intervals']=_0x5e39c1[_0x1777('0x1')]||{};}module[_0x1777('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 8d537dd..17ca42c 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 _0xa597=['md5','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa597,0x1b9));var _0x7a59=function(_0x24ccc4,_0x59822a){_0x24ccc4=_0x24ccc4-0x0;var _0x20afb0=_0xa597[_0x24ccc4];return _0x20afb0;};'use strict';var _=require(_0x7a59('0x0'));var md5=require(_0x7a59('0x1'));var util=require('util');var Redis=require(_0x7a59('0x2'));var config=require(_0x7a59('0x3'));config[_0x7a59('0x4')]=_['defaults'](config[_0x7a59('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a59('0x4')]));function MailQueue(_0xdecfef){this['id']=_0xdecfef['id']||0x0;this[_0x7a59('0x5')]=_0xdecfef[_0x7a59('0x5')]||'';this[_0x7a59('0x6')]=_0xdecfef[_0x7a59('0x6')]||0xa;this[_0x7a59('0x7')]=_0xdecfef[_0x7a59('0x7')]||_0x7a59('0x8');this[_0x7a59('0x9')]=_0xdecfef[_0x7a59('0x9')];this[_0x7a59('0xa')]={};this[_0x7a59('0xb')]=0x0;this[_0x7a59('0x1')]='';this[_0x7a59('0xc')]();this[_0x7a59('0xd')]();}MailQueue['prototype'][_0x7a59('0xc')]=function(){var _0x1eedd2=this[_0x7a59('0xa')][_0x7a59('0xe')];this[_0x7a59('0xa')]=_['map'](this[_0x7a59('0x9')],'id');this[_0x7a59('0xa')]['_rr']=_0x1eedd2;};MailQueue[_0x7a59('0xf')][_0x7a59('0xd')]=function(){this[_0x7a59('0x10')]=0x0;this[_0x7a59('0x11')]=0x0;for(var _0x1b62af=0x0;_0x1b62af=0x0?this[_0x7a59('0x14')]:0x0;var _0x28b11c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7a59('0x10')],'name':this[_0x7a59('0x5')],'paused':this[_0x7a59('0x11')],'waiting':this[_0x7a59('0xb')]};var _0x1ee4b2=md5(JSON[_0x7a59('0x15')](_0x28b11c));if(this[_0x7a59('0x1')]!==_0x1ee4b2){this[_0x7a59('0x1')]=_0x1ee4b2;io['to'](util[_0x7a59('0x16')](_0x7a59('0x17'),_0x28b11c[_0x7a59('0x5')]))['emit'](_0x7a59('0x18'),_0x28b11c);}};module[_0x7a59('0x19')]=MailQueue; \ No newline at end of file +var _0xf488=['_rr','map','loggedIn','paused','length','online','available','stringify','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRealtime','prototype'];(function(_0x42ad6b,_0x39a94){var _0x442838=function(_0x4dc38c){while(--_0x4dc38c){_0x42ad6b['push'](_0x42ad6b['shift']());}};_0x442838(++_0x39a94);}(_0xf488,0x83));var _0x8f48=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0xf488[_0x190681];return _0x4f2ada;};'use strict';var _=require(_0x8f48('0x0'));var md5=require('md5');var util=require(_0x8f48('0x1'));var Redis=require(_0x8f48('0x2'));var config=require('../../../config/environment');config[_0x8f48('0x3')]=_[_0x8f48('0x4')](config[_0x8f48('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x8f48('0x5'))(new Redis(config[_0x8f48('0x3')]));function MailQueue(_0x5420ed){this['id']=_0x5420ed['id']||0x0;this['name']=_0x5420ed[_0x8f48('0x6')]||'';this['timeout']=_0x5420ed[_0x8f48('0x7')]||0xa;this['strategy']=_0x5420ed['strategy']||'beepall';this[_0x8f48('0x8')]=_0x5420ed['Agents'];this[_0x8f48('0x9')]={};this[_0x8f48('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0x8f48('0xb')]();}MailQueue[_0x8f48('0xc')]['updateRouting']=function(){var _0x4ed9fa=this['mapAgentsId'][_0x8f48('0xd')];this['mapAgentsId']=_[_0x8f48('0xe')](this[_0x8f48('0x8')],'id');this[_0x8f48('0x9')][_0x8f48('0xd')]=_0x4ed9fa;};MailQueue['prototype']['updateRealtime']=function(){this[_0x8f48('0xf')]=0x0;this[_0x8f48('0x10')]=0x0;for(var _0x1b17bb=0x0;_0x1b17bb=0x0?this['available']:0x0;var _0x73363d={'id':this['id'],'available':this[_0x8f48('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x8f48('0x6')],'paused':this[_0x8f48('0x10')],'waiting':this[_0x8f48('0xa')]};var _0x261de3=md5(JSON[_0x8f48('0x14')](_0x73363d));if(this['md5']!==_0x261de3){this['md5']=_0x261de3;io['to'](util['format']('mail:queue:%s',_0x73363d[_0x8f48('0x6')]))[_0x8f48('0x15')](_0x8f48('0x16'),_0x73363d);}};module[_0x8f48('0x17')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 73138c8..564753e 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(_0xf24612,_0x288e25){var _0x3388ee=function(_0x97ed23){while(--_0x97ed23){_0xf24612['push'](_0xf24612['shift']());}};_0x3388ee(++_0x288e25);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5fc3[_0x3b380d];return _0x54502b;};'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 _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(_0x4ea09e,_0x2b032f){var _0x195774=function(_0x146eca){while(--_0x146eca){_0x4ea09e['push'](_0x4ea09e['shift']());}};_0x195774(++_0x2b032f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x5fc3[_0x336376];return _0x1d2a8e;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c05b141..3bf7bc6 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 _0x9b87=['emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','stringify','format','sms:queue:%s'];(function(_0x1e8987,_0x48c658){var _0x5a3d41=function(_0x5a6593){while(--_0x5a6593){_0x1e8987['push'](_0x1e8987['shift']());}};_0x5a3d41(++_0x48c658);}(_0x9b87,0x8e));var _0x79b8=function(_0x4059ac,_0x1e5e0b){_0x4059ac=_0x4059ac-0x0;var _0x4f14d9=_0x9b87[_0x4059ac];return _0x4f14d9;};'use strict';var _=require(_0x79b8('0x0'));var md5=require(_0x79b8('0x1'));var util=require(_0x79b8('0x2'));var Redis=require(_0x79b8('0x3'));var config=require(_0x79b8('0x4'));config[_0x79b8('0x5')]=_[_0x79b8('0x6')](config[_0x79b8('0x5')],{'host':_0x79b8('0x7'),'port':0x18eb});var io=require(_0x79b8('0x8'))(new Redis(config[_0x79b8('0x5')]));function SmsQueue(_0x399796){this['id']=_0x399796['id']||0x0;this[_0x79b8('0x9')]=_0x399796[_0x79b8('0x9')]||'';this[_0x79b8('0xa')]=_0x399796[_0x79b8('0xa')]||0xa;this['strategy']=_0x399796['strategy']||'beepall';this['Agents']=_0x399796[_0x79b8('0xb')];this[_0x79b8('0xc')]={};this[_0x79b8('0xd')]=0x0;this['md5']='';this[_0x79b8('0xe')]();this[_0x79b8('0xf')]();}SmsQueue[_0x79b8('0x10')]['updateRouting']=function(){var _0x5a4683=this[_0x79b8('0xc')][_0x79b8('0x11')];this[_0x79b8('0xc')]=_[_0x79b8('0x12')](this[_0x79b8('0xb')],'id');this[_0x79b8('0xc')][_0x79b8('0x11')]=_0x5a4683;};SmsQueue[_0x79b8('0x10')][_0x79b8('0xf')]=function(){this[_0x79b8('0x13')]=0x0;this[_0x79b8('0x14')]=0x0;for(var _0x59e229=0x0;_0x59e229=0x0?this[_0x79b8('0x16')]:0x0;var _0x383a34={'id':this['id'],'available':this[_0x79b8('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x79b8('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x9bcb94=md5(JSON[_0x79b8('0x17')](_0x383a34));if(this[_0x79b8('0x1')]!==_0x9bcb94){this[_0x79b8('0x1')]=_0x9bcb94;io['to'](util[_0x79b8('0x18')](_0x79b8('0x19'),_0x383a34[_0x79b8('0x9')]))[_0x79b8('0x1a')](_0x79b8('0x1b'),_0x383a34);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x8bdf=['paused','available','name','waiting','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','map','updateRealtime','loggedIn'];(function(_0x2aec98,_0x565569){var _0x5ddc80=function(_0x13ba59){while(--_0x13ba59){_0x2aec98['push'](_0x2aec98['shift']());}};_0x5ddc80(++_0x565569);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8bdf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf8bd('0x0'));var md5=require(_0xf8bd('0x1'));var util=require(_0xf8bd('0x2'));var Redis=require(_0xf8bd('0x3'));var config=require(_0xf8bd('0x4'));config['redis']=_[_0xf8bd('0x5')](config[_0xf8bd('0x6')],{'host':_0xf8bd('0x7'),'port':0x18eb});var io=require(_0xf8bd('0x8'))(new Redis(config[_0xf8bd('0x6')]));function SmsQueue(_0x261e01){this['id']=_0x261e01['id']||0x0;this['name']=_0x261e01['name']||'';this['timeout']=_0x261e01[_0xf8bd('0x9')]||0xa;this[_0xf8bd('0xa')]=_0x261e01[_0xf8bd('0xa')]||_0xf8bd('0xb');this['Agents']=_0x261e01[_0xf8bd('0xc')];this[_0xf8bd('0xd')]={};this['waiting']=0x0;this[_0xf8bd('0x1')]='';this[_0xf8bd('0xe')]();this['updateRealtime']();}SmsQueue[_0xf8bd('0xf')][_0xf8bd('0xe')]=function(){var _0x20a3f7=this[_0xf8bd('0xd')]['_rr'];this[_0xf8bd('0xd')]=_[_0xf8bd('0x10')](this['Agents'],'id');this[_0xf8bd('0xd')]['_rr']=_0x20a3f7;};SmsQueue[_0xf8bd('0xf')][_0xf8bd('0x11')]=function(){this[_0xf8bd('0x12')]=0x0;this[_0xf8bd('0x13')]=0x0;for(var _0x43d517=0x0;_0x43d517=0x0?this[_0xf8bd('0x14')]:0x0;var _0x53c547={'id':this['id'],'available':this[_0xf8bd('0x14')],'loggedIn':this[_0xf8bd('0x12')],'name':this[_0xf8bd('0x15')],'paused':this[_0xf8bd('0x13')],'waiting':this[_0xf8bd('0x16')]};var _0x1b18db=md5(JSON['stringify'](_0x53c547));if(this[_0xf8bd('0x1')]!==_0x1b18db){this[_0xf8bd('0x1')]=_0x1b18db;io['to'](util['format'](_0xf8bd('0x17'),_0x53c547['name']))[_0xf8bd('0x18')](_0xf8bd('0x19'),_0x53c547);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4a759c5..3556c3e 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 _0x0fd5=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5'];(function(_0x368c17,_0x3b462c){var _0x598b3b=function(_0x5c11e3){while(--_0x5c11e3){_0x368c17['push'](_0x368c17['shift']());}};_0x598b3b(++_0x3b462c);}(_0x0fd5,0xdf));var _0x50fd=function(_0x2031e2,_0x1404fe){_0x2031e2=_0x2031e2-0x0;var _0x577cca=_0x0fd5[_0x2031e2];return _0x577cca;};'use strict';var _=require('lodash');var md5=require(_0x50fd('0x0'));var util=require(_0x50fd('0x1'));var Redis=require(_0x50fd('0x2'));var config=require(_0x50fd('0x3'));config['redis']=_['defaults'](config[_0x50fd('0x4')],{'host':_0x50fd('0x5'),'port':0x18eb});var io=require(_0x50fd('0x6'))(new Redis(config[_0x50fd('0x4')]));function WhatsappQueue(_0x1c0eaa){this['id']=_0x1c0eaa['id']||0x0;this[_0x50fd('0x7')]=_0x1c0eaa[_0x50fd('0x7')]||'';this[_0x50fd('0x8')]=_0x1c0eaa[_0x50fd('0x8')]||0xa;this['strategy']=_0x1c0eaa[_0x50fd('0x9')]||'beepall';this[_0x50fd('0xa')]=_0x1c0eaa[_0x50fd('0xa')];this[_0x50fd('0xb')]={};this[_0x50fd('0xc')]=0x0;this[_0x50fd('0x0')]='';this[_0x50fd('0xd')]();this[_0x50fd('0xe')]();}WhatsappQueue[_0x50fd('0xf')]['updateRouting']=function(){var _0x1864a2=this['mapAgentsId'][_0x50fd('0x10')];this[_0x50fd('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0x50fd('0x10')]=_0x1864a2;};WhatsappQueue[_0x50fd('0xf')][_0x50fd('0xe')]=function(){this['loggedIn']=0x0;this[_0x50fd('0x11')]=0x0;for(var _0x43b38e=0x0;_0x43b38e=0x0?this[_0x50fd('0x15')]:0x0;var _0x2d79f2={'id':this['id'],'available':this[_0x50fd('0x15')],'loggedIn':this[_0x50fd('0x13')],'name':this[_0x50fd('0x7')],'paused':this[_0x50fd('0x11')],'waiting':this[_0x50fd('0xc')]};var _0x72c372=md5(JSON[_0x50fd('0x16')](_0x2d79f2));if(this['md5']!==_0x72c372){this['md5']=_0x72c372;io['to'](util[_0x50fd('0x17')](_0x50fd('0x18'),_0x2d79f2[_0x50fd('0x7')]))[_0x50fd('0x19')](_0x50fd('0x1a'),_0x2d79f2);}};module[_0x50fd('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xafeb=['available','format','whatsapp:queue:%s','whatsapp_queue:save','md5','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','loggedIn','length','online','whatsappPause','paused'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xafeb,0x77));var _0xbafe=function(_0x5cfd9e,_0x27d6a6){_0x5cfd9e=_0x5cfd9e-0x0;var _0x2c75ac=_0xafeb[_0x5cfd9e];return _0x2c75ac;};'use strict';var _=require('lodash');var md5=require(_0xbafe('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xbafe('0x1'));config['redis']=_[_0xbafe('0x2')](config[_0xbafe('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbafe('0x3')]));function WhatsappQueue(_0x164051){this['id']=_0x164051['id']||0x0;this['name']=_0x164051[_0xbafe('0x4')]||'';this['timeout']=_0x164051[_0xbafe('0x5')]||0xa;this[_0xbafe('0x6')]=_0x164051['strategy']||'beepall';this[_0xbafe('0x7')]=_0x164051[_0xbafe('0x7')];this[_0xbafe('0x8')]={};this[_0xbafe('0x9')]=0x0;this[_0xbafe('0x0')]='';this['updateRouting']();this[_0xbafe('0xa')]();}WhatsappQueue['prototype'][_0xbafe('0xb')]=function(){var _0x39837d=this['mapAgentsId'][_0xbafe('0xc')];this[_0xbafe('0x8')]=_[_0xbafe('0xd')](this[_0xbafe('0x7')],'id');this[_0xbafe('0x8')][_0xbafe('0xc')]=_0x39837d;};WhatsappQueue['prototype'][_0xbafe('0xa')]=function(){this[_0xbafe('0xe')]=0x0;this['paused']=0x0;for(var _0x4dcd33=0x0;_0x4dcd33=0x0?this[_0xbafe('0x13')]:0x0;var _0x2a5e07={'id':this['id'],'available':this[_0xbafe('0x13')],'loggedIn':this[_0xbafe('0xe')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xbafe('0x9')]};var _0x209995=md5(JSON['stringify'](_0x2a5e07));if(this['md5']!==_0x209995){this[_0xbafe('0x0')]=_0x209995;io['to'](util[_0xbafe('0x14')](_0xbafe('0x15'),_0x2a5e07[_0xbafe('0x4')]))['emit'](_0xbafe('0x16'),_0x2a5e07);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 0ad5e35..290db60 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(_0x29d750,_0x12ec95){var _0x551bc3=function(_0x2d4c09){while(--_0x2d4c09){_0x29d750['push'](_0x29d750['shift']());}};_0x551bc3(++_0x12ec95);}(_0xb10b,0x12a));var _0xbb10=function(_0x22b2be,_0x4b164c){_0x22b2be=_0x22b2be-0x0;var _0x213c31=_0xb10b[_0x22b2be];return _0x213c31;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 e4c4d3c..a46ef9a 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 _0x6eb8=['addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x15482e,_0x25b23c){var _0x4a0651=function(_0x5afab4){while(--_0x5afab4){_0x15482e['push'](_0x15482e['shift']());}};_0x4a0651(++_0x25b23c);}(_0x6eb8,0x1cf));var _0x86eb=function(_0x4f668b,_0x1be98e){_0x4f668b=_0x4f668b-0x0;var _0x3cfe00=_0x6eb8[_0x4f668b];return _0x3cfe00;};'use strict';var client=require('../client');exports[_0x86eb('0x0')]=function(_0x9f834b,_0x426422){return client[_0x86eb('0x1')](_0x86eb('0x2'),{'body':_0x426422,'options':{'where':{'id':_0x9f834b}},'log':_0x86eb('0x3')});};exports[_0x86eb('0x4')]=function(_0x16f7a4,_0x14df5e){return client['Request']('AddTagsToChatInteraction',{'body':_0x14df5e,'options':{'where':{'id':_0x16f7a4}},'log':_0x86eb('0x5')});}; \ No newline at end of file +var _0x4677=['addTags','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0x4677,0x1c2));var _0x7467=function(_0x32d757,_0x3fc5f3){_0x32d757=_0x32d757-0x0;var _0xafad52=_0x4677[_0x32d757];return _0xafad52;};'use strict';var client=require('../client');exports['update']=function(_0x1cc31b,_0x1565e1){return client['Request'](_0x7467('0x0'),{'body':_0x1565e1,'options':{'where':{'id':_0x1cc31b}},'log':_0x7467('0x1')});};exports[_0x7467('0x2')]=function(_0x23eed0,_0x2b0d8c){return client[_0x7467('0x3')]('AddTagsToChatInteraction',{'body':_0x2b0d8c,'options':{'where':{'id':_0x23eed0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7058d93..b32f01c 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 _0xb373=['../client','Request','createChatMessage'];(function(_0x4d21d0,_0x4326b8){var _0x39b57e=function(_0x3ed474){while(--_0x3ed474){_0x4d21d0['push'](_0x4d21d0['shift']());}};_0x39b57e(++_0x4326b8);}(_0xb373,0xfc));var _0x3b37=function(_0x3cb9de,_0x1035b7){_0x3cb9de=_0x3cb9de-0x0;var _0x2677e1=_0xb373[_0x3cb9de];return _0x2677e1;};'use strict';var client=require(_0x3b37('0x0'));exports['create']=function(_0x51fde3){return client[_0x3b37('0x1')]('CreateChatMessage',{'body':_0x51fde3,'log':_0x3b37('0x2')});}; \ No newline at end of file +var _0xa5dc=['CreateChatMessage','createChatMessage','../client','Request'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0xa5dc,0xe2));var _0xca5d=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xa5dc[_0x48ec91];return _0x22766c;};'use strict';var client=require(_0xca5d('0x0'));exports['create']=function(_0x564251){return client[_0xca5d('0x1')](_0xca5d('0x2'),{'body':_0x564251,'log':_0xca5d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 26e554a..b3f1374 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 _0x36b2=['strategy','Agents','chatPause','../client','getChatQueues','Request','name','timeout'];(function(_0x318b88,_0x146ed7){var _0x1fec14=function(_0x20b3e2){while(--_0x20b3e2){_0x318b88['push'](_0x318b88['shift']());}};_0x1fec14(++_0x146ed7);}(_0x36b2,0x6b));var _0x236b=function(_0x35a71c,_0x85ce9a){_0x35a71c=_0x35a71c-0x0;var _0x3df5e7=_0x36b2[_0x35a71c];return _0x3df5e7;};'use strict';var client=require(_0x236b('0x0'));exports[_0x236b('0x1')]=function(){return function(){return client[_0x236b('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x236b('0x3'),_0x236b('0x4'),_0x236b('0x5')],'include':[{'model':'User','as':_0x236b('0x6'),'attributes':['id',_0x236b('0x3'),'online',_0x236b('0x7')]}]},'log':_0x236b('0x1')});};}; \ No newline at end of file +var _0x975f=['getChatQueues','name','timeout','User','Agents','online','../client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x975f,0x109));var _0xf975=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x975f[_0x57645b];return _0xe82f00;};'use strict';var client=require(_0xf975('0x0'));exports[_0xf975('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xf975('0x2'),_0xf975('0x3'),'strategy'],'include':[{'model':_0xf975('0x4'),'as':_0xf975('0x5'),'attributes':['id',_0xf975('0x2'),_0xf975('0x6'),'chatPause']}]},'log':_0xf975('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 820e5a1..83a14c0 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 _0xb31a=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xb31a,0xd4));var _0xab31=function(_0x3c63bf,_0x164c9d){_0x3c63bf=_0x3c63bf-0x0;var _0x9064d7=_0xb31a[_0x3c63bf];return _0x9064d7;};'use strict';var client=require(_0xab31('0x0'));exports[_0xab31('0x1')]=function(_0x16a117){return client[_0xab31('0x2')](_0xab31('0x3'),{'body':_0x16a117,'log':_0xab31('0x3')});};exports[_0xab31('0x4')]=function(_0x20b002,_0x2addad){return client[_0xab31('0x2')](_0xab31('0x5'),{'body':_0x2addad,'options':{'where':{'uniqueid':_0x20b002},'order':[['id',_0xab31('0x6')]],'limit':0x1},'log':_0xab31('0x5')});}; \ No newline at end of file +var _0x50a6=['create','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x393569,_0x2aa756){var _0x427c6a=function(_0x55ef5c){while(--_0x55ef5c){_0x393569['push'](_0x393569['shift']());}};_0x427c6a(++_0x2aa756);}(_0x50a6,0xa4));var _0x650a=function(_0x26cc16,_0x4c174f){_0x26cc16=_0x26cc16-0x0;var _0x345e3e=_0x50a6[_0x26cc16];return _0x345e3e;};'use strict';var client=require(_0x650a('0x0'));exports[_0x650a('0x1')]=function(_0x47b929){return client['Request'](_0x650a('0x2'),{'body':_0x47b929,'log':'CreateChatQueueReport'});};exports[_0x650a('0x3')]=function(_0x15dd02,_0x2c71ba){return client['Request'](_0x650a('0x4'),{'body':_0x2c71ba,'options':{'where':{'uniqueid':_0x15dd02},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e83cf74..be6c96c 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(_0x3faf01,_0x323df0){var _0x5d0d0c=function(_0x35d65f){while(--_0x35d65f){_0x3faf01['push'](_0x3faf01['shift']());}};_0x5d0d0c(++_0x323df0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x7a54,0x106));var _0x47a5=function(_0x14247d,_0x12cce6){_0x14247d=_0x14247d-0x0;var _0x44eed9=_0x7a54[_0x14247d];return _0x44eed9;};'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 fa88caf..fd85fbd 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 _0x4874=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x2e8124,_0x375e38){var _0x2021c2=function(_0x3552d9){while(--_0x3552d9){_0x2e8124['push'](_0x2e8124['shift']());}};_0x2021c2(++_0x375e38);}(_0x4874,0x1b3));var _0x4487=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4874[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x4487('0x0'));exports[_0x4487('0x1')]=function(_0x57fe23){return client['Request'](_0x4487('0x2'),{'body':_0x57fe23,'log':_0x4487('0x3')});}; \ No newline at end of file +var _0xb426=['Request','createFaxMessage','../client'];(function(_0x4c074b,_0x22bc2b){var _0x561eb7=function(_0x17b0f9){while(--_0x17b0f9){_0x4c074b['push'](_0x4c074b['shift']());}};_0x561eb7(++_0x22bc2b);}(_0xb426,0x125));var _0x6b42=function(_0x2e1e3a,_0x17fd2c){_0x2e1e3a=_0x2e1e3a-0x0;var _0x3a23bd=_0xb426[_0x2e1e3a];return _0x3a23bd;};'use strict';var client=require(_0x6b42('0x0'));exports['create']=function(_0x331d70){return client[_0x6b42('0x1')]('CreateFaxMessage',{'body':_0x331d70,'log':_0x6b42('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b3fbc66..993398e 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 _0x3857=['User','Agents','name','online','faxPause','../client','getFaxQueues','GetFaxQueue','timeout','strategy'];(function(_0x3c2d87,_0x623ad){var _0x142d3c=function(_0x3fa5a5){while(--_0x3fa5a5){_0x3c2d87['push'](_0x3c2d87['shift']());}};_0x142d3c(++_0x623ad);}(_0x3857,0x195));var _0x7385=function(_0x40ba51,_0x17d236){_0x40ba51=_0x40ba51-0x0;var _0x44d653=_0x3857[_0x40ba51];return _0x44d653;};'use strict';var client=require(_0x7385('0x0'));exports[_0x7385('0x1')]=function(){return function(){return client['Request'](_0x7385('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7385('0x3'),_0x7385('0x4')],'include':[{'model':_0x7385('0x5'),'as':_0x7385('0x6'),'attributes':['id',_0x7385('0x7'),_0x7385('0x8'),_0x7385('0x9')]}]},'log':_0x7385('0x1')});};}; \ No newline at end of file +var _0x0bf7=['User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x4bff31,_0x48c620){var _0x1c0e78=function(_0x57d36a){while(--_0x57d36a){_0x4bff31['push'](_0x4bff31['shift']());}};_0x1c0e78(++_0x48c620);}(_0x0bf7,0x158));var _0x70bf=function(_0x32e5cd,_0x524c7c){_0x32e5cd=_0x32e5cd-0x0;var _0x2ec966=_0x0bf7[_0x32e5cd];return _0x2ec966;};'use strict';var client=require(_0x70bf('0x0'));exports[_0x70bf('0x1')]=function(){return function(){return client[_0x70bf('0x2')](_0x70bf('0x3'),{'options':{'raw':![],'attributes':['id',_0x70bf('0x4'),_0x70bf('0x5'),'strategy'],'include':[{'model':_0x70bf('0x6'),'as':_0x70bf('0x7'),'attributes':['id',_0x70bf('0x4'),_0x70bf('0x8'),_0x70bf('0x9')]}]},'log':_0x70bf('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0ff0b93..5d643a7 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 _0xc989=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x80b77d,_0x3c7c6e){var _0x1e7793=function(_0x399657){while(--_0x399657){_0x80b77d['push'](_0x80b77d['shift']());}};_0x1e7793(++_0x3c7c6e);}(_0xc989,0x126));var _0x9c98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc989[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x9c98('0x0'));exports[_0x9c98('0x1')]=function(_0x4b441e){return client[_0x9c98('0x2')](_0x9c98('0x3'),{'body':_0x4b441e,'log':_0x9c98('0x3')});};exports[_0x9c98('0x4')]=function(_0xddd75c,_0x2d1cf5){return client[_0x9c98('0x2')](_0x9c98('0x5'),{'body':_0x2d1cf5,'options':{'where':{'uniqueid':_0xddd75c},'order':[['id',_0x9c98('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x3141=['../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x44a9ba,_0x3967d4){var _0x19fddb=function(_0x36eea4){while(--_0x36eea4){_0x44a9ba['push'](_0x44a9ba['shift']());}};_0x19fddb(++_0x3967d4);}(_0x3141,0x186));var _0x1314=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3141[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x1314('0x0'));exports[_0x1314('0x1')]=function(_0x2073c9){return client[_0x1314('0x2')](_0x1314('0x3'),{'body':_0x2073c9,'log':_0x1314('0x3')});};exports[_0x1314('0x4')]=function(_0x549b10,_0x48975b){return client[_0x1314('0x2')]('UpdateFaxQueueReport',{'body':_0x48975b,'options':{'where':{'uniqueid':_0x549b10},'order':[['id',_0x1314('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c9ea840..a44e4c7 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 _0x02cf=['interval','../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x4559e9,_0x361d01){var _0xf1198d=function(_0x574dba){while(--_0x574dba){_0x4559e9['push'](_0x4559e9['shift']());}};_0xf1198d(++_0x361d01);}(_0x02cf,0x1e4));var _0xf02c=function(_0x5180b7,_0x3c813e){_0x5180b7=_0x5180b7-0x0;var _0x377e0f=_0x02cf[_0x5180b7];return _0x377e0f;};'use strict';var client=require(_0xf02c('0x0'));exports[_0xf02c('0x1')]=function(){return function(){return client[_0xf02c('0x2')](_0xf02c('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf02c('0x4')],'include':[{'model':'Interval','as':_0xf02c('0x5'),'attributes':['id',_0xf02c('0x4'),_0xf02c('0x6')]}]},'log':_0xf02c('0x1')});};}; \ No newline at end of file +var _0x3f39=['Request','GetInterval','name','Interval','Intervals','../client','getIntervals'];(function(_0x3a5c8b,_0x19e243){var _0x5c7968=function(_0x306796){while(--_0x306796){_0x3a5c8b['push'](_0x3a5c8b['shift']());}};_0x5c7968(++_0x19e243);}(_0x3f39,0x18d));var _0x93f3=function(_0x29ff02,_0x2df8ec){_0x29ff02=_0x29ff02-0x0;var _0x7fecde=_0x3f39[_0x29ff02];return _0x7fecde;};'use strict';var client=require(_0x93f3('0x0'));exports[_0x93f3('0x1')]=function(){return function(){return client[_0x93f3('0x2')](_0x93f3('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x93f3('0x4')],'include':[{'model':_0x93f3('0x5'),'as':_0x93f3('0x6'),'attributes':['id',_0x93f3('0x4'),'interval']}]},'log':_0x93f3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a58b382..2a28395 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 _0x4137=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(_0x370399,_0x4f372c){return client[_0x7413('0x2')](_0x7413('0x3'),{'body':_0x4f372c,'options':{'where':{'id':_0x370399}},'log':_0x7413('0x4')});};exports[_0x7413('0x5')]=function(_0x258255,_0x3dc48a){return client[_0x7413('0x2')](_0x7413('0x6'),{'body':_0x3dc48a,'options':{'where':{'id':_0x258255}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9f0e=['Request','addTags','AddTagsToMailInteraction','../client','update'];(function(_0x4f5fbc,_0x74cb4e){var _0x486e0e=function(_0x306829){while(--_0x306829){_0x4f5fbc['push'](_0x4f5fbc['shift']());}};_0x486e0e(++_0x74cb4e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x37a3a0,_0x1a1d8a){_0x37a3a0=_0x37a3a0-0x0;var _0x23a297=_0x9f0e[_0x37a3a0];return _0x23a297;};'use strict';var client=require(_0xe9f0('0x0'));exports[_0xe9f0('0x1')]=function(_0x28c33d,_0x1a7796){return client[_0xe9f0('0x2')]('UpdateMailInteraction',{'body':_0x1a7796,'options':{'where':{'id':_0x28c33d}},'log':'updateMailInteraction'});};exports[_0xe9f0('0x3')]=function(_0x150a03,_0x3c589d){return client[_0xe9f0('0x2')](_0xe9f0('0x4'),{'body':_0x3c589d,'options':{'where':{'id':_0x150a03}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index f902fb6..7beb116 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 _0xa056=['createMailMessage','../client','Request'];(function(_0x16b055,_0x5811ca){var _0x2c103c=function(_0x18635a){while(--_0x18635a){_0x16b055['push'](_0x16b055['shift']());}};_0x2c103c(++_0x5811ca);}(_0xa056,0x124));var _0x6a05=function(_0x56fda6,_0x5be31d){_0x56fda6=_0x56fda6-0x0;var _0x376e10=_0xa056[_0x56fda6];return _0x376e10;};'use strict';var client=require(_0x6a05('0x0'));exports['create']=function(_0x14d1cd){return client[_0x6a05('0x1')]('CreateMailMessage',{'body':_0x14d1cd,'log':_0x6a05('0x2')});}; \ No newline at end of file +var _0x12f1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x12f1,0x1f2));var _0x112f=function(_0x71a990,_0x215b82){_0x71a990=_0x71a990-0x0;var _0x1d4cc8=_0x12f1[_0x71a990];return _0x1d4cc8;};'use strict';var client=require(_0x112f('0x0'));exports[_0x112f('0x1')]=function(_0x1ac3b1){return client[_0x112f('0x2')](_0x112f('0x3'),{'body':_0x1ac3b1,'log':_0x112f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8169059..af44e4a 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 _0xedf7=['GetMailQueue','timeout','strategy','User','online','mailPause','getMailQueues','Request'];(function(_0x5db968,_0x2b6308){var _0x50c8cf=function(_0x4627b3){while(--_0x4627b3){_0x5db968['push'](_0x5db968['shift']());}};_0x50c8cf(++_0x2b6308);}(_0xedf7,0x7e));var _0x7edf=function(_0x1e1360,_0x3274d1){_0x1e1360=_0x1e1360-0x0;var _0x382ccf=_0xedf7[_0x1e1360];return _0x382ccf;};'use strict';var client=require('../client');exports[_0x7edf('0x0')]=function(){return function(){return client[_0x7edf('0x1')](_0x7edf('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x7edf('0x3'),_0x7edf('0x4')],'include':[{'model':_0x7edf('0x5'),'as':'Agents','attributes':['id','name',_0x7edf('0x6'),_0x7edf('0x7')]}]},'log':_0x7edf('0x0')});};}; \ No newline at end of file +var _0x381d=['../client','getMailQueues','name','timeout','strategy','User','Agents','mailPause'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x381d,0xb8));var _0xd381=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x381d[_0x162780];return _0x1ea2dc;};'use strict';var client=require(_0xd381('0x0'));exports[_0xd381('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd381('0x2'),_0xd381('0x3'),_0xd381('0x4')],'include':[{'model':_0xd381('0x5'),'as':_0xd381('0x6'),'attributes':['id',_0xd381('0x2'),'online',_0xd381('0x7')]}]},'log':_0xd381('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7d1ece8..a22e1d7 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 _0x3962=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x3962,0x17f));var _0x2396=function(_0x11e829,_0x8ac0fa){_0x11e829=_0x11e829-0x0;var _0x5a8a34=_0x3962[_0x11e829];return _0x5a8a34;};'use strict';var client=require('../client');exports[_0x2396('0x0')]=function(_0x4f002c){return client[_0x2396('0x1')](_0x2396('0x2'),{'body':_0x4f002c,'log':_0x2396('0x2')});};exports[_0x2396('0x3')]=function(_0x35c4ee,_0x2e64ec){return client[_0x2396('0x1')](_0x2396('0x4'),{'body':_0x2e64ec,'options':{'where':{'uniqueid':_0x35c4ee},'order':[['id',_0x2396('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xea12=['Request','UpdateMailQueueReport','../client','create','update'];(function(_0x2f9526,_0x3f7a08){var _0x1a1b37=function(_0x2ca062){while(--_0x2ca062){_0x2f9526['push'](_0x2f9526['shift']());}};_0x1a1b37(++_0x3f7a08);}(_0xea12,0x84));var _0x2ea1=function(_0x319ec2,_0x3384d4){_0x319ec2=_0x319ec2-0x0;var _0x3b1aed=_0xea12[_0x319ec2];return _0x3b1aed;};'use strict';var client=require(_0x2ea1('0x0'));exports[_0x2ea1('0x1')]=function(_0x462d3d){return client['Request']('CreateMailQueueReport',{'body':_0x462d3d,'log':'CreateMailQueueReport'});};exports[_0x2ea1('0x2')]=function(_0x208988,_0x417734){return client[_0x2ea1('0x3')](_0x2ea1('0x4'),{'body':_0x417734,'options':{'where':{'uniqueid':_0x208988},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 87084d7..7721acd 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 _0x0bc6=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0xc56830,_0x273bee){var _0x559b2e=function(_0x2b3df3){while(--_0x2b3df3){_0xc56830['push'](_0xc56830['shift']());}};_0x559b2e(++_0x273bee);}(_0x0bc6,0x112));var _0x60bc=function(_0x14c2cf,_0x29a840){_0x14c2cf=_0x14c2cf-0x0;var _0x32b9f4=_0x0bc6[_0x14c2cf];return _0x32b9f4;};'use strict';var client=require(_0x60bc('0x0'));exports[_0x60bc('0x1')]=function(_0x504a4a,_0x443480){return client[_0x60bc('0x2')](_0x60bc('0x3'),{'body':_0x443480,'options':{'where':{'id':_0x504a4a}},'log':_0x60bc('0x4')});};exports['addTags']=function(_0x20cb0b,_0x2b59f8){return client[_0x60bc('0x2')](_0x60bc('0x5'),{'body':_0x2b59f8,'options':{'where':{'id':_0x20cb0b}},'log':_0x60bc('0x6')});}; \ No newline at end of file +var _0x9cff=['../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x4af7cd,_0x44531c){var _0x19dc66=function(_0x47952e){while(--_0x47952e){_0x4af7cd['push'](_0x4af7cd['shift']());}};_0x19dc66(++_0x44531c);}(_0x9cff,0xa2));var _0xf9cf=function(_0x37dc82,_0x3bbe87){_0x37dc82=_0x37dc82-0x0;var _0x167a29=_0x9cff[_0x37dc82];return _0x167a29;};'use strict';var client=require(_0xf9cf('0x0'));exports['update']=function(_0x57f2ff,_0x369d49){return client[_0xf9cf('0x1')](_0xf9cf('0x2'),{'body':_0x369d49,'options':{'where':{'id':_0x57f2ff}},'log':_0xf9cf('0x3')});};exports[_0xf9cf('0x4')]=function(_0x2f2fd3,_0x41d8ce){return client[_0xf9cf('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x41d8ce,'options':{'where':{'id':_0x2f2fd3}},'log':_0xf9cf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 94c0833..beb9e72 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 _0xac6f=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0xac6f,0xa7));var _0xfac6=function(_0x3986d6,_0x25eade){_0x3986d6=_0x3986d6-0x0;var _0x46fa23=_0xac6f[_0x3986d6];return _0x46fa23;};'use strict';var client=require(_0xfac6('0x0'));exports['create']=function(_0x1d8c96){return client[_0xfac6('0x1')](_0xfac6('0x2'),{'body':_0x1d8c96,'log':_0xfac6('0x3')});}; \ No newline at end of file +var _0xb3b7=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x58b44a,_0x1a7aa6){var _0xd6779d=function(_0x40d8f3){while(--_0x40d8f3){_0x58b44a['push'](_0x58b44a['shift']());}};_0xd6779d(++_0x1a7aa6);}(_0xb3b7,0x1a8));var _0x7b3b=function(_0x5383a7,_0x3d609d){_0x5383a7=_0x5383a7-0x0;var _0x533dcf=_0xb3b7[_0x5383a7];return _0x533dcf;};'use strict';var client=require(_0x7b3b('0x0'));exports['create']=function(_0x3b68e0){return client[_0x7b3b('0x1')](_0x7b3b('0x2'),{'body':_0x3b68e0,'log':_0x7b3b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index f4e2a9f..8b2bc7f 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 _0x1912=['online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User','Agents'];(function(_0x3fab1b,_0x22a161){var _0x18c0e0=function(_0x2717c0){while(--_0x2717c0){_0x3fab1b['push'](_0x3fab1b['shift']());}};_0x18c0e0(++_0x22a161);}(_0x1912,0x192));var _0x2191=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1912[_0x465a0c];return _0x1e202e;};'use strict';var client=require(_0x2191('0x0'));exports[_0x2191('0x1')]=function(){return function(){return client[_0x2191('0x2')](_0x2191('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2191('0x4'),_0x2191('0x5')],'include':[{'model':_0x2191('0x6'),'as':_0x2191('0x7'),'attributes':['id','name',_0x2191('0x8'),_0x2191('0x9')]}]},'log':_0x2191('0x1')});};}; \ No newline at end of file +var _0x1c2a=['timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x1631cf,_0x22d27b){var _0x3843c1=function(_0x34ff43){while(--_0x34ff43){_0x1631cf['push'](_0x1631cf['shift']());}};_0x3843c1(++_0x22d27b);}(_0x1c2a,0xb6));var _0xa1c2=function(_0x5ac021,_0x3675b9){_0x5ac021=_0x5ac021-0x0;var _0x4e1362=_0x1c2a[_0x5ac021];return _0x4e1362;};'use strict';var client=require(_0xa1c2('0x0'));exports[_0xa1c2('0x1')]=function(){return function(){return client[_0xa1c2('0x2')](_0xa1c2('0x3'),{'options':{'raw':![],'attributes':['id',_0xa1c2('0x4'),_0xa1c2('0x5'),_0xa1c2('0x6')],'include':[{'model':_0xa1c2('0x7'),'as':_0xa1c2('0x8'),'attributes':['id',_0xa1c2('0x4'),_0xa1c2('0x9'),_0xa1c2('0xa')]}]},'log':_0xa1c2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f5cc5b9..1f446c1 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 _0xe8c6=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x7b634a,_0x2f6e7e){var _0x898456=function(_0x4554f6){while(--_0x4554f6){_0x7b634a['push'](_0x7b634a['shift']());}};_0x898456(++_0x2f6e7e);}(_0xe8c6,0x1bc));var _0x6e8c=function(_0x392c8d,_0x4f947a){_0x392c8d=_0x392c8d-0x0;var _0x53adda=_0xe8c6[_0x392c8d];return _0x53adda;};'use strict';var client=require('../client');exports[_0x6e8c('0x0')]=function(_0x3924da){return client[_0x6e8c('0x1')](_0x6e8c('0x2'),{'body':_0x3924da,'log':_0x6e8c('0x2')});};exports[_0x6e8c('0x3')]=function(_0x3794f6,_0x2bd74){return client[_0x6e8c('0x1')](_0x6e8c('0x4'),{'body':_0x2bd74,'options':{'where':{'uniqueid':_0x3794f6},'order':[['id',_0x6e8c('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x2804=['UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport','Request'];(function(_0x258d58,_0xa70cc0){var _0xdcbc04=function(_0x105930){while(--_0x105930){_0x258d58['push'](_0x258d58['shift']());}};_0xdcbc04(++_0xa70cc0);}(_0x2804,0xf8));var _0x4280=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2804[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x4280('0x0'));exports[_0x4280('0x1')]=function(_0x561910){return client['Request'](_0x4280('0x2'),{'body':_0x561910,'log':_0x4280('0x2')});};exports['update']=function(_0x2cc439,_0x689d9){return client[_0x4280('0x3')](_0x4280('0x4'),{'body':_0x689d9,'options':{'where':{'uniqueid':_0x2cc439},'order':[['id',_0x4280('0x5')]],'limit':0x1},'log':_0x4280('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index a567922..47513e3 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 _0xcb99=['addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x517d5d,_0x248fb6){var _0x1900bc=function(_0x14539f){while(--_0x14539f){_0x517d5d['push'](_0x517d5d['shift']());}};_0x1900bc(++_0x248fb6);}(_0xcb99,0x8b));var _0x9cb9=function(_0x293055,_0x10e0b1){_0x293055=_0x293055-0x0;var _0x19c83a=_0xcb99[_0x293055];return _0x19c83a;};'use strict';var client=require(_0x9cb9('0x0'));exports['update']=function(_0x30a555,_0x52af95){return client['Request'](_0x9cb9('0x1'),{'body':_0x52af95,'options':{'where':{'id':_0x30a555}},'log':_0x9cb9('0x2')});};exports[_0x9cb9('0x3')]=function(_0x51f2ee,_0x167735){return client[_0x9cb9('0x4')]('AddTagsToSmsInteraction',{'body':_0x167735,'options':{'where':{'id':_0x51f2ee}},'log':_0x9cb9('0x5')});}; \ No newline at end of file +var _0xa630=['Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x213e56,_0x458801){var _0x550b0d=function(_0x28969f){while(--_0x28969f){_0x213e56['push'](_0x213e56['shift']());}};_0x550b0d(++_0x458801);}(_0xa630,0xbe));var _0x0a63=function(_0x32c7c6,_0x1cb502){_0x32c7c6=_0x32c7c6-0x0;var _0x57cd5f=_0xa630[_0x32c7c6];return _0x57cd5f;};'use strict';var client=require(_0x0a63('0x0'));exports[_0x0a63('0x1')]=function(_0x51d2c0,_0x52ad93){return client[_0x0a63('0x2')]('UpdateSmsInteraction',{'body':_0x52ad93,'options':{'where':{'id':_0x51d2c0}},'log':_0x0a63('0x3')});};exports['addTags']=function(_0x91a747,_0x3bcb90){return client[_0x0a63('0x2')](_0x0a63('0x4'),{'body':_0x3bcb90,'options':{'where':{'id':_0x91a747}},'log':_0x0a63('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 3df6677..de0ed71 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 _0x9fc8=['createSmsMessage','create','Request','CreateSmsMessage'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x9fc8,0xd5));var _0x89fc=function(_0x4dc027,_0x408187){_0x4dc027=_0x4dc027-0x0;var _0x9f0c04=_0x9fc8[_0x4dc027];return _0x9f0c04;};'use strict';var client=require('../client');exports[_0x89fc('0x0')]=function(_0x431f72){return client[_0x89fc('0x1')](_0x89fc('0x2'),{'body':_0x431f72,'log':_0x89fc('0x3')});}; \ No newline at end of file +var _0x5c67=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x5c67,0x1d8));var _0x75c6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5c67[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x75c6('0x0'));exports[_0x75c6('0x1')]=function(_0x1d930f){return client[_0x75c6('0x2')](_0x75c6('0x3'),{'body':_0x1d930f,'log':_0x75c6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2f00e82..e20cff1 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x55df01,_0x62ec17){var _0x495fdc=function(_0x3f6828){while(--_0x3f6828){_0x55df01['push'](_0x55df01['shift']());}};_0x495fdc(++_0x62ec17);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x18a281,_0x4fc562){var _0xd22b1e=function(_0x677583){while(--_0x677583){_0x18a281['push'](_0x18a281['shift']());}};_0xd22b1e(++_0x4fc562);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b12647c..5d8631e 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x30b783,_0x5d86ac){var _0xf0a0=function(_0x57cece){while(--_0x57cece){_0x30b783['push'](_0x30b783['shift']());}};_0xf0a0(++_0x5d86ac);}(_0x55ca,0x126));var _0xa55c=function(_0x264b79,_0xc62859){_0x264b79=_0x264b79-0x0;var _0x548c85=_0x55ca[_0x264b79];return _0x548c85;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x1f6a92,_0x10d790){var _0x247da5=function(_0x25a92c){while(--_0x25a92c){_0x1f6a92['push'](_0x1f6a92['shift']());}};_0x247da5(++_0x10d790);}(_0x55ca,0x126));var _0xa55c=function(_0xb43d1b,_0x3935cf){_0xb43d1b=_0xb43d1b-0x0;var _0x4aafca=_0x55ca[_0xb43d1b];return _0x4aafca;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b1b7a0d..b834545 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(_0x28661b,_0x31f4de){var _0x3cddf1=function(_0x18a9cb){while(--_0x18a9cb){_0x28661b['push'](_0x28661b['shift']());}};_0x3cddf1(++_0x31f4de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x5c67dd,_0x13dd6c){var _0x1bdb4b=function(_0x3f1967){while(--_0x3f1967){_0x5c67dd['push'](_0x5c67dd['shift']());}};_0x1bdb4b(++_0x13dd6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 f025957..3618d6a 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 _0x11e5=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x130939,_0x18de65){var _0xb6f6f5=function(_0x2905b3){while(--_0x2905b3){_0x130939['push'](_0x130939['shift']());}};_0xb6f6f5(++_0x18de65);}(_0x11e5,0x8b));var _0x511e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x11e5[_0x38b2d9];return _0x23a3e1;};'use strict';var client=require(_0x511e('0x0'));exports['update']=function(_0xfd6709,_0x269c68){return client['Request'](_0x511e('0x1'),{'body':_0x269c68,'options':{'where':{'id':_0xfd6709}},'log':_0x511e('0x2')});};exports[_0x511e('0x3')]=function(_0x5cab33,_0x249e4d){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x249e4d,'options':{'where':{'id':_0x5cab33}},'log':_0x511e('0x4')});}; \ No newline at end of file +var _0x39c7=['updateWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x45373c,_0x42ab38){var _0x3f8fe3=function(_0x4d0545){while(--_0x4d0545){_0x45373c['push'](_0x45373c['shift']());}};_0x3f8fe3(++_0x42ab38);}(_0x39c7,0x85));var _0x739c=function(_0x121b9f,_0x3e538b){_0x121b9f=_0x121b9f-0x0;var _0x3d1f31=_0x39c7[_0x121b9f];return _0x3d1f31;};'use strict';var client=require('../client');exports[_0x739c('0x0')]=function(_0x30270a,_0x11237b){return client[_0x739c('0x1')](_0x739c('0x2'),{'body':_0x11237b,'options':{'where':{'id':_0x30270a}},'log':_0x739c('0x3')});};exports['addTags']=function(_0x11c0a6,_0xff8215){return client[_0x739c('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xff8215,'options':{'where':{'id':_0x11c0a6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c523086..6b367d6 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 _0x12b8=['createWhatsappMessage','create','Request'];(function(_0x1ce67b,_0x5d1e9f){var _0xc64cb0=function(_0x376ce4){while(--_0x376ce4){_0x1ce67b['push'](_0x1ce67b['shift']());}};_0xc64cb0(++_0x5d1e9f);}(_0x12b8,0x16f));var _0x812b=function(_0x7c3553,_0x58020e){_0x7c3553=_0x7c3553-0x0;var _0x3d2fc5=_0x12b8[_0x7c3553];return _0x3d2fc5;};'use strict';var client=require('../client');exports[_0x812b('0x0')]=function(_0x639a4){return client[_0x812b('0x1')]('CreateWhatsappMessage',{'body':_0x639a4,'log':_0x812b('0x2')});}; \ No newline at end of file +var _0x6f5a=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x6f5a,0xb4));var _0xa6f5=function(_0x547ff3,_0x113691){_0x547ff3=_0x547ff3-0x0;var _0x194e84=_0x6f5a[_0x547ff3];return _0x194e84;};'use strict';var client=require('../client');exports[_0xa6f5('0x0')]=function(_0x2a5b51){return client['Request'](_0xa6f5('0x1'),{'body':_0x2a5b51,'log':_0xa6f5('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 2fe0aaf..1eb9139 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 _0xa578=['User','online','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x28b68e,_0x527118){var _0x4fefeb=function(_0x100412){while(--_0x100412){_0x28b68e['push'](_0x28b68e['shift']());}};_0x4fefeb(++_0x527118);}(_0xa578,0x135));var _0x8a57=function(_0x3e1562,_0x4150b3){_0x3e1562=_0x3e1562-0x0;var _0x3efda1=_0xa578[_0x3e1562];return _0x3efda1;};'use strict';var client=require('../client');exports[_0x8a57('0x0')]=function(){return function(){return client[_0x8a57('0x1')](_0x8a57('0x2'),{'options':{'raw':![],'attributes':['id',_0x8a57('0x3'),_0x8a57('0x4'),_0x8a57('0x5')],'include':[{'model':_0x8a57('0x6'),'as':'Agents','attributes':['id',_0x8a57('0x3'),_0x8a57('0x7'),_0x8a57('0x8')]}]},'log':_0x8a57('0x0')});};}; \ No newline at end of file +var _0x17c9=['name','timeout','strategy','../client','getWhatsappQueues'];(function(_0x37a445,_0x3ff6e5){var _0x2fe1ea=function(_0x51ac7a){while(--_0x51ac7a){_0x37a445['push'](_0x37a445['shift']());}};_0x2fe1ea(++_0x3ff6e5);}(_0x17c9,0x170));var _0x917c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x17c9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x917c('0x0'));exports[_0x917c('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x917c('0x2'),_0x917c('0x3'),_0x917c('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x917c('0x2'),'online','whatsappPause']}]},'log':_0x917c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ea59de8..69cf079 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 _0xc1a5=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x563b76,_0x51cfae){var _0x38d84d=function(_0x163f8b){while(--_0x163f8b){_0x563b76['push'](_0x563b76['shift']());}};_0x38d84d(++_0x51cfae);}(_0xc1a5,0x1b5));var _0x5c1a=function(_0x4606b8,_0x55cb73){_0x4606b8=_0x4606b8-0x0;var _0x3344a1=_0xc1a5[_0x4606b8];return _0x3344a1;};'use strict';var client=require(_0x5c1a('0x0'));exports[_0x5c1a('0x1')]=function(_0x4ef2bf){return client[_0x5c1a('0x2')](_0x5c1a('0x3'),{'body':_0x4ef2bf,'log':_0x5c1a('0x3')});};exports[_0x5c1a('0x4')]=function(_0x2b6980,_0x2a727c){return client[_0x5c1a('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2a727c,'options':{'where':{'uniqueid':_0x2b6980},'order':[['id',_0x5c1a('0x5')]],'limit':0x1},'log':_0x5c1a('0x6')});}; \ No newline at end of file +var _0xd9c6=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0xd9c6,0xba));var _0x6d9c=function(_0x3d22a6,_0xff89dd){_0x3d22a6=_0x3d22a6-0x0;var _0x45156d=_0xd9c6[_0x3d22a6];return _0x45156d;};'use strict';var client=require('../client');exports[_0x6d9c('0x0')]=function(_0x331f90){return client['Request'](_0x6d9c('0x1'),{'body':_0x331f90,'log':'CreateWhatsappQueueReport'});};exports[_0x6d9c('0x2')]=function(_0x36ddc1,_0x3383ba){return client[_0x6d9c('0x3')](_0x6d9c('0x4'),{'body':_0x3383ba,'options':{'where':{'uniqueid':_0x36ddc1},'order':[['id',_0x6d9c('0x5')]],'limit':0x1},'log':_0x6d9c('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 fc72a89..9732ea1 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 _0xdd48=['end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','rules'];(function(_0x5bb057,_0x5a1d02){var _0x2dacb2=function(_0x23225c){while(--_0x23225c){_0x5bb057['push'](_0x5bb057['shift']());}};_0x2dacb2(++_0x5a1d02);}(_0xdd48,0x1d1));var _0x8dd4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd48[_0x21a9d9];return _0x46adce;};'use strict';var schema=require(_0x8dd4('0x0'));var _=require(_0x8dd4('0x1'));var util=require(_0x8dd4('0x2'));var seqqueue=require(_0x8dd4('0x3'));var logger=require(_0x8dd4('0x4'))('routing');var strategy=require(_0x8dd4('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x251eab,_0x3b1441,_0x3126c7){return logger[_0x8dd4('0x6')](util[_0x8dd4('0x7')](_0x8dd4('0x8'),_0x251eab,_0x3b1441['name'],_0x3126c7));}function handleFindAgent(_0x3bc261){return function(_0x35c689){return _0x35c689[_0x8dd4('0x9')][_0x8dd4('0xa')]()===_0x3bc261['toLowerCase']();};}exports[_0x8dd4('0xb')]=function(_0x4ed3e6,_0x2f97e3,_0x1682b2,_0x48613f){return function(_0x34078d){try{var _0x263a81={'name':_0x2f97e3[0x0],'timeout':_0x2f97e3[0x1]};var _0x144e78=queue[_0x8dd4('0x0')](_0x263a81,{'typecast':!![]});if(_0x144e78[_0x8dd4('0xc')]){logger[_0x8dd4('0xd')](_0x8dd4('0xe'),_0x4ed3e6,_[_0x8dd4('0xf')](_0x144e78,_0x8dd4('0x10'))[_0x8dd4('0x11')](',\x20'));_0x34078d[_0x8dd4('0x12')]();}else{var _0x102ea0=_[_0x8dd4('0x13')](_0x1682b2[_0x8dd4('0x14')],handleFindAgent(_0x263a81[_0x8dd4('0x9')]));if(_0x102ea0){var _0x4cf6e2=(_0x263a81[_0x8dd4('0x15')]||0xa)*0x3e8;var _0x34837f,_0x42d790;var _0x2187eb=seqqueue[_0x8dd4('0x16')](_0x4cf6e2);_0x2187eb['id']=_0x4ed3e6;_0x2187eb['atimeout']=_0x4cf6e2;_0x2187eb[_0x8dd4('0x17')]=_0x48613f[_0x8dd4('0x17')];writeLog(_0x4ed3e6,_0x102ea0,util[_0x8dd4('0x7')]('START:%s',_0x4cf6e2));_0x1682b2[_0x8dd4('0x18')][_0x4ed3e6]['on'](_0x8dd4('0x19'),function(){logger[_0x8dd4('0x6')](_0x8dd4('0x1a'),_0x4ed3e6);clearTimeout(_0x42d790);_0x42d790=undefined;_0x2187eb[_0x8dd4('0x1b')]();if(_0x1682b2[_0x8dd4('0x18')][_0x4ed3e6]){delete _0x1682b2[_0x8dd4('0x18')][_0x4ed3e6];}_0x34078d['stop']();});_0x1682b2['rules'][_0x4ed3e6]['on'](_0x8dd4('0x1c'),function(){if(_0x1682b2['rules'][_0x4ed3e6]){delete _0x1682b2[_0x8dd4('0x18')][_0x4ed3e6];}});_0x42d790=setTimeout(function(){logger[_0x8dd4('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x4ed3e6);clearTimeout(_0x42d790);_0x2187eb[_0x8dd4('0x1b')]();_0x34078d[_0x8dd4('0x1d')]();},_0x4cf6e2);strategy[_0x8dd4('0x1e')](_0x2187eb,_0x102ea0,_0x1682b2,_0x48613f);}else{logger[_0x8dd4('0xd')](_0x8dd4('0x1f'),_0x4ed3e6,_0x263a81['name']);_0x34078d[_0x8dd4('0x12')]();}}}catch(_0x3bdce4){console[_0x8dd4('0x20')](_0x3bdce4);logger['error'](_0x8dd4('0x21'),_0x4ed3e6,_0x3bdce4[_0x8dd4('0x22')]);_0x34078d[_0x8dd4('0x12')]();}};}; \ No newline at end of file +var _0xcb74=['name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','agents','timeout','createQueue','atimeout','channel','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','agent','log','[%s][QUEUE]\x20%s','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcb74,0x6f));var _0x4cb7=function(_0x1bc09f,_0xef06ce){_0x1bc09f=_0x1bc09f-0x0;var _0x5e1f5a=_0xcb74[_0x1bc09f];return _0x5e1f5a;};'use strict';var schema=require(_0x4cb7('0x0'));var _=require(_0x4cb7('0x1'));var util=require(_0x4cb7('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x4cb7('0x3'))('routing');var strategy=require(_0x4cb7('0x4'));var queue=schema({'name':{'type':_0x4cb7('0x5'),'required':!![],'message':_0x4cb7('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x12e8e9,_0x1bdda2,_0x16a274){return logger['info'](util[_0x4cb7('0x7')](_0x4cb7('0x8'),_0x12e8e9,_0x1bdda2[_0x4cb7('0x9')],_0x16a274));}function handleFindAgent(_0x4fa254){return function(_0x17c8b9){return _0x17c8b9[_0x4cb7('0x9')][_0x4cb7('0xa')]()===_0x4fa254[_0x4cb7('0xa')]();};}exports[_0x4cb7('0xb')]=function(_0x138f61,_0xb64594,_0x2e7d75,_0x2049a1){return function(_0x6de7b3){try{var _0x1315d6={'name':_0xb64594[0x0],'timeout':_0xb64594[0x1]};var _0x58313f=queue[_0x4cb7('0x0')](_0x1315d6,{'typecast':!![]});if(_0x58313f[_0x4cb7('0xc')]){logger[_0x4cb7('0xd')](_0x4cb7('0xe'),_0x138f61,_['map'](_0x58313f,'message')['join'](',\x20'));_0x6de7b3['stop']();}else{var _0x583fbb=_['find'](_0x2e7d75[_0x4cb7('0xf')],handleFindAgent(_0x1315d6['name']));if(_0x583fbb){var _0x7af471=(_0x1315d6[_0x4cb7('0x10')]||0xa)*0x3e8;var _0x1e7536,_0x4c5cb5;var _0x3fb10a=seqqueue[_0x4cb7('0x11')](_0x7af471);_0x3fb10a['id']=_0x138f61;_0x3fb10a[_0x4cb7('0x12')]=_0x7af471;_0x3fb10a[_0x4cb7('0x13')]=_0x2049a1[_0x4cb7('0x13')];writeLog(_0x138f61,_0x583fbb,util[_0x4cb7('0x7')]('START:%s',_0x7af471));_0x2e7d75[_0x4cb7('0x14')][_0x138f61]['on']('end',function(){logger[_0x4cb7('0x15')](_0x4cb7('0x16'),_0x138f61);clearTimeout(_0x4c5cb5);_0x4c5cb5=undefined;_0x3fb10a[_0x4cb7('0x17')]();if(_0x2e7d75[_0x4cb7('0x14')][_0x138f61]){delete _0x2e7d75['rules'][_0x138f61];}_0x6de7b3[_0x4cb7('0x18')]();});_0x2e7d75[_0x4cb7('0x14')][_0x138f61]['on'](_0x4cb7('0x19'),function(){if(_0x2e7d75['rules'][_0x138f61]){delete _0x2e7d75[_0x4cb7('0x14')][_0x138f61];}});_0x4c5cb5=setTimeout(function(){logger[_0x4cb7('0x15')](_0x4cb7('0x1a'),_0x138f61);clearTimeout(_0x4c5cb5);_0x3fb10a[_0x4cb7('0x17')]();_0x6de7b3['next']();},_0x7af471);strategy[_0x4cb7('0x1b')](_0x3fb10a,_0x583fbb,_0x2e7d75,_0x2049a1);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x138f61,_0x1315d6[_0x4cb7('0x9')]);_0x6de7b3[_0x4cb7('0x18')]();}}}catch(_0xb9ef88){console[_0x4cb7('0x1c')](_0xb9ef88);logger[_0x4cb7('0xd')](_0x4cb7('0x1d'),_0x138f61,_0xb9ef88['stack']);_0x6de7b3['stop']();}};}; \ 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 923657d..274e303 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 _0x70f7=['YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','ChatWebsiteId','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','LexRuntime','message','toString','postText','error','amazonlex','providerName','dialogState','stop','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x252782,_0x5b7839){var _0x5123ea=function(_0xbace4b){while(--_0xbace4b){_0x252782['push'](_0x252782['shift']());}};_0x5123ea(++_0x5b7839);}(_0x70f7,0xab));var _0x770f=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x70f7[_0x2bfe52];return _0x1cf649;};'use strict';var _=require('lodash');var moment=require(_0x770f('0x0'));var AWS=require(_0x770f('0x1'));var utils=require(_0x770f('0x2'));var logger=require(_0x770f('0x3'))(_0x770f('0x4'));var rpc={'chatMessage':require(_0x770f('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x770f('0x6')),'faxMessage':require(_0x770f('0x7')),'whatsappMessage':require(_0x770f('0x8'))};exports['consequence']=function(_0x3b56ad,_0x30754d){return function(_0x1162a7){try{if(!_[_0x770f('0x9')](this[_0x770f('0xa')][_0x770f('0xb')])){logger[_0x770f('0xc')]('[%s][AMAZONLEX]\x20%s',_0x3b56ad,_0x770f('0xd'));return _0x1162a7[_0x770f('0xe')]();}var _0x404483={'ContactId':this[_0x770f('0xf')]['id'],'sentAt':moment()[_0x770f('0x10')](_0x770f('0x11')),'direction':'out'};if(this[_0x770f('0x12')]===_0x770f('0x13')||this[_0x770f('0x12')]==='whatsapp'){_0x404483['phone']=this[_0x770f('0xa')][_0x770f('0x14')];}var _0x510fb3=this[_0x770f('0x12')];if(_0x510fb3===_0x770f('0x15')){_0x404483[_0x770f('0x16')]=this['account']['id'];}else{_0x404483[_['upperFirst'](_0x510fb3)+_0x770f('0x17')]=this['account']['id'];}_0x404483[_[_0x770f('0x18')](_0x510fb3)+_0x770f('0x19')]=this['interaction']['id'];if(this[_0x770f('0xa')][_0x770f('0x1a')]){var _0x1323df=_0x30754d[0x4];if(!_[_0x770f('0x1b')](_0x1323df)){_0x404483[_0x770f('0x1c')]=utils[_0x770f('0x1d')](_0x1323df,this);return rpc[_0x510fb3+_0x770f('0x1e')][_0x770f('0x1f')](_0x404483)[_0x770f('0x20')](function(_0x5aa3b6){logger['info'](_0x770f('0x21'),_0x3b56ad,_0x404483[_0x770f('0x1c')]);})[_0x770f('0x22')](function(_0x1be07b){logger['error'](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x1be07b));})[_0x770f('0x24')](function(){logger[_0x770f('0xc')](_0x770f('0x25'),_0x3b56ad);_0x1162a7['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3b56ad);_0x1162a7['stop']();}}else{var _0x4a19d1=this;var _0x38801d=new AWS[(_0x770f('0x26'))]({'accessKeyId':_0x30754d[0x0],'secretAccessKey':_0x30754d[0x1],'region':_0x30754d[0x2]});var _0xc2be65={'botAlias':'$LATEST','botName':_0x30754d[0x3],'inputText':this[_0x770f('0x27')][_0x770f('0x1c')],'userId':this[_0x770f('0x12')]+':'+this[_0x770f('0xa')]['id'][_0x770f('0x28')]()};_0x38801d[_0x770f('0x29')](_0xc2be65,function(_0x51f874,_0x3dbe60){if(_0x51f874){logger[_0x770f('0x2a')](_0x770f('0x21'),_0x3b56ad,_0x51f874[_0x770f('0x27')]);_0x1162a7[_0x770f('0xe')]();}else if(_0x3dbe60&&_0x3dbe60['message']){_0x4a19d1['body'][_0x770f('0x2b')]=_0x3dbe60;_0x404483[_0x770f('0x1c')]=_0x3dbe60[_0x770f('0x27')];_0x404483[_0x770f('0x2c')]=_0x770f('0x2b');_0x404483['providerResponse']=JSON[_0x770f('0x23')](_0x3dbe60);return rpc[_0x510fb3+'Message']['create'](_0x404483)[_0x770f('0x20')](function(_0x236b30){logger[_0x770f('0xc')](_0x770f('0x21'),_0x3b56ad,_0x404483[_0x770f('0x1c')]);if(_0x3dbe60[_0x770f('0x2d')]=='Failed'){_0x1162a7[_0x770f('0xe')]();}else{_0x1162a7[_0x770f('0x2e')]();}})[_0x770f('0x22')](function(_0x54aee2){logger[_0x770f('0x2a')](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x54aee2));_0x1162a7[_0x770f('0xe')]();});}else{_0x1162a7['next']();}});}}catch(_0x2c8147){logger['error'](_0x770f('0x21'),_0x3b56ad,JSON[_0x770f('0x23')](_0x2c8147));_0x1162a7['stop']();}};}; \ No newline at end of file +var _0x8b72=['error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','message','providerName','amazonlex','create','dialogState','lodash','moment','aws-sdk','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','account','upperFirst','created','isEmpty','body','getMustacheRender','then','catch'];(function(_0x1710ce,_0x38df1f){var _0x49127f=function(_0x48fb1f){while(--_0x48fb1f){_0x1710ce['push'](_0x1710ce['shift']());}};_0x49127f(++_0x38df1f);}(_0x8b72,0x11a));var _0x28b7=function(_0x3f1467,_0x622560){_0x3f1467=_0x3f1467-0x0;var _0x5c27dc=_0x8b72[_0x3f1467];return _0x5c27dc;};'use strict';var _=require(_0x28b7('0x0'));var moment=require(_0x28b7('0x1'));var AWS=require(_0x28b7('0x2'));var utils=require(_0x28b7('0x3'));var logger=require('../../../../config/logger')(_0x28b7('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x28b7('0x5')),'mailMessage':require(_0x28b7('0x6')),'smsMessage':require(_0x28b7('0x7')),'faxMessage':require(_0x28b7('0x8')),'whatsappMessage':require(_0x28b7('0x9'))};exports[_0x28b7('0xa')]=function(_0x3c0e21,_0xcf78e0){return function(_0x557109){try{if(!_[_0x28b7('0xb')](this[_0x28b7('0xc')]['UserId'])){logger[_0x28b7('0xd')](_0x28b7('0xe'),_0x3c0e21,_0x28b7('0xf'));return _0x557109[_0x28b7('0x10')]();}var _0x3e3713={'ContactId':this[_0x28b7('0x11')]['id'],'sentAt':moment()[_0x28b7('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x28b7('0x13')};if(this[_0x28b7('0x14')]===_0x28b7('0x15')||this['channel']===_0x28b7('0x16')){_0x3e3713[_0x28b7('0x17')]=this['interaction'][_0x28b7('0x17')];}var _0x3d2190=this[_0x28b7('0x14')];if(_0x3d2190===_0x28b7('0x18')){_0x3e3713['ChatWebsiteId']=this[_0x28b7('0x19')]['id'];}else{_0x3e3713[_[_0x28b7('0x1a')](_0x3d2190)+'AccountId']=this[_0x28b7('0x19')]['id'];}_0x3e3713[_[_0x28b7('0x1a')](_0x3d2190)+'InteractionId']=this[_0x28b7('0xc')]['id'];if(this[_0x28b7('0xc')][_0x28b7('0x1b')]){var _0x5b1a17=_0xcf78e0[0x4];if(!_[_0x28b7('0x1c')](_0x5b1a17)){_0x3e3713[_0x28b7('0x1d')]=utils[_0x28b7('0x1e')](_0x5b1a17,this);return rpc[_0x3d2190+'Message']['create'](_0x3e3713)[_0x28b7('0x1f')](function(_0x49a91c){logger[_0x28b7('0xd')](_0x28b7('0xe'),_0x3c0e21,_0x3e3713[_0x28b7('0x1d')]);})[_0x28b7('0x20')](function(_0xace881){logger[_0x28b7('0x21')](_0x28b7('0xe'),_0x3c0e21,JSON[_0x28b7('0x22')](_0xace881));})['finally'](function(){logger[_0x28b7('0xd')](_0x28b7('0x23'),_0x3c0e21);_0x557109[_0x28b7('0x24')]();});}else{logger['info'](_0x28b7('0x25'),_0x3c0e21);_0x557109['stop']();}}else{var _0x125c8a=this;var _0x278752=new AWS[(_0x28b7('0x26'))]({'accessKeyId':_0xcf78e0[0x0],'secretAccessKey':_0xcf78e0[0x1],'region':_0xcf78e0[0x2]});var _0x5e8db6={'botAlias':'$LATEST','botName':_0xcf78e0[0x3],'inputText':this['message'][_0x28b7('0x1d')],'userId':this[_0x28b7('0x14')]+':'+this[_0x28b7('0xc')]['id'][_0x28b7('0x27')]()};_0x278752['postText'](_0x5e8db6,function(_0x2514bd,_0x489ca6){if(_0x2514bd){logger['error'](_0x28b7('0xe'),_0x3c0e21,_0x2514bd['message']);_0x557109[_0x28b7('0x10')]();}else if(_0x489ca6&&_0x489ca6[_0x28b7('0x28')]){_0x125c8a[_0x28b7('0x1d')]['amazonlex']=_0x489ca6;_0x3e3713[_0x28b7('0x1d')]=_0x489ca6[_0x28b7('0x28')];_0x3e3713[_0x28b7('0x29')]=_0x28b7('0x2a');_0x3e3713['providerResponse']=JSON['stringify'](_0x489ca6);return rpc[_0x3d2190+'Message'][_0x28b7('0x2b')](_0x3e3713)[_0x28b7('0x1f')](function(_0xc15e3c){logger['info'](_0x28b7('0xe'),_0x3c0e21,_0x3e3713['body']);if(_0x489ca6[_0x28b7('0x2c')]=='Failed'){_0x557109[_0x28b7('0x10')]();}else{_0x557109['stop']();}})[_0x28b7('0x20')](function(_0x5d06aa){logger[_0x28b7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x3c0e21,JSON[_0x28b7('0x22')](_0x5d06aa));_0x557109[_0x28b7('0x10')]();});}else{_0x557109[_0x28b7('0x10')]();}});}}catch(_0xf99af2){logger[_0x28b7('0x21')]('[%s][AMAZONLEX]\x20%s',_0x3c0e21,JSON[_0x28b7('0x22')](_0xf99af2));_0x557109['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 5288672..6597aa4 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 _0x8c02=['../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','','headers','auto_reply','sendMailMessage','account','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','autoreplyExecuted','update','stop','lodash','./utils','routing'];(function(_0x1f68dd,_0x40414e){var _0x5b72c9=function(_0x57ed35){while(--_0x57ed35){_0x1f68dd['push'](_0x1f68dd['shift']());}};_0x5b72c9(++_0x40414e);}(_0x8c02,0xc9));var _0x28c0=function(_0x182526,_0x1f35fc){_0x182526=_0x182526-0x0;var _0x4ee6cb=_0x8c02[_0x182526];return _0x4ee6cb;};'use strict';var _=require(_0x28c0('0x0'));var moment=require('moment');var utils=require(_0x28c0('0x1'));var logger=require('../../../../config/logger')(_0x28c0('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x28c0('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x28c0('0x4')),'faxMessage':require(_0x28c0('0x5')),'whatsappMessage':require(_0x28c0('0x6')),'chatInteraction':require(_0x28c0('0x7')),'openchannelInteraction':require(_0x28c0('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x28c0('0x9')),'faxInteraction':require(_0x28c0('0xa')),'whatsappInteraction':require(_0x28c0('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x28c0('0xc')]=function(_0x2f47da,_0x16a123,_0xe5a316,_0x19e997){return function(_0x3552fe){try{var _0x46a53f=this['channel'];if(_0x46a53f===_0x28c0('0xd')&&_0x19e997[_0x28c0('0xe')][_0x28c0('0xf')]){logger['info'](_0x28c0('0x10'),_0x2f47da,_0x28c0('0x11'));return _0x3552fe[_0x28c0('0x12')]();}if(_0x16a123[0x0]==='1'&&(_[_0x28c0('0x13')](this[_0x28c0('0x14')]['created'])||!this[_0x28c0('0x14')][_0x28c0('0x15')])){logger[_0x28c0('0x16')](_0x28c0('0x10'),_0x2f47da,_0x28c0('0x17'));return _0x3552fe[_0x28c0('0x12')]();}if(_0x16a123[0x0]==='2'&&this[_0x28c0('0x14')]['autoreplyExecuted']){logger[_0x28c0('0x16')](_0x28c0('0x18'),_0x2f47da,'One\x20Time\x20already\x20sent');return _0x3552fe[_0x28c0('0x12')]();}var _0x159892={'ContactId':this[_0x28c0('0x19')]['id'],'sentAt':moment()[_0x28c0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x28c0('0x1b')};if(this[_0x28c0('0x1c')]===_0x28c0('0xd')){_0x159892[_0x28c0('0xe')]=utils['getMustacheRender'](_0x16a123[0x2],this);}else{_0x159892[_0x28c0('0xe')]=utils[_0x28c0('0x1d')](_0x16a123[0x1],this);}if(this[_0x28c0('0x1e')]){_0x159892['to']=this[_0x28c0('0x1e')]['from']||'';if(this[_0x28c0('0x1c')]===_0x28c0('0xd')&&_0x16a123[0x1]==='1'){_0x159892['cc']=this[_0x28c0('0x1e')]['cc']||'';}_0x159892[_0x28c0('0x1f')]=this['message']['to']||'';_0x159892['phone']=this[_0x28c0('0x1e')][_0x28c0('0x20')]||'';_0x159892['read']=!![];if(this[_0x28c0('0x1e')][_0x28c0('0x21')]){_0x159892[_0x28c0('0x21')]='';_0x159892[_0x28c0('0x21')]+=_[_0x28c0('0x22')](this['message'][_0x28c0('0x21')],_0x28c0('0x23'))?'':_0x28c0('0x24');_0x159892['subject']+=this[_0x28c0('0x1e')][_0x28c0('0x21')];}}if(this[_0x28c0('0x1c')]===_0x28c0('0x25')){_0x159892[_0x28c0('0x26')]=this['account']['id'];}else{_0x159892[_[_0x28c0('0x27')](this[_0x28c0('0x1c')])+_0x28c0('0x28')]=this['account']['id'];}_0x159892[_[_0x28c0('0x27')](this[_0x28c0('0x1c')])+_0x28c0('0x29')]=this['interaction']['id'];var _0x355c36=this[_0x28c0('0x14')];if(rpc[this[_0x28c0('0x1c')]+_0x28c0('0x2a')]){if(this['channel']===_0x28c0('0xd')){_0x159892[_0x28c0('0x2b')]=this[_0x28c0('0x1e')][_0x28c0('0x2c')];_0x159892[_0x28c0('0x2d')]=_0x28c0('0x2e')+_['replace'](_0x159892[_0x28c0('0xe')],'','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','error','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil'];(function(_0x5c54ba,_0x15ec36){var _0x2b190d=function(_0x4b8552){while(--_0x4b8552){_0x5c54ba['push'](_0x5c54ba['shift']());}};_0x2b190d(++_0x15ec36);}(_0x7c79,0x13d));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x97c7('0x0'));var moment=require(_0x97c7('0x1'));var utils=require(_0x97c7('0x2'));var logger=require('../../../../config/logger')(_0x97c7('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x97c7('0x4')),'mailMessage':require(_0x97c7('0x5')),'smsMessage':require(_0x97c7('0x6')),'faxMessage':require(_0x97c7('0x7')),'whatsappMessage':require(_0x97c7('0x8')),'chatInteraction':require(_0x97c7('0x9')),'openchannelInteraction':require(_0x97c7('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x97c7('0xb')),'faxInteraction':require(_0x97c7('0xc')),'whatsappInteraction':require(_0x97c7('0xd'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3d8959,_0x416f96,_0x60fe3c,_0x3e331c){return function(_0x51bfc6){try{var _0x23f642=this[_0x97c7('0xe')];if(_0x23f642===_0x97c7('0xf')&&_0x3e331c[_0x97c7('0x10')][_0x97c7('0x11')]){logger[_0x97c7('0x12')](_0x97c7('0x13'),_0x3d8959,_0x97c7('0x14'));return _0x51bfc6[_0x97c7('0x15')]();}if(_0x416f96[0x0]==='1'&&(_[_0x97c7('0x16')](this[_0x97c7('0x17')][_0x97c7('0x18')])||!this['interaction']['created'])){logger[_0x97c7('0x12')](_0x97c7('0x13'),_0x3d8959,_0x97c7('0x19'));return _0x51bfc6[_0x97c7('0x15')]();}if(_0x416f96[0x0]==='2'&&this[_0x97c7('0x17')][_0x97c7('0x1a')]){logger[_0x97c7('0x12')](_0x97c7('0x1b'),_0x3d8959,_0x97c7('0x1c'));return _0x51bfc6[_0x97c7('0x15')]();}var _0x311cb6={'ContactId':this[_0x97c7('0x1d')]['id'],'sentAt':moment()['format'](_0x97c7('0x1e')),'direction':'out'};if(this['channel']===_0x97c7('0xf')){_0x311cb6[_0x97c7('0x10')]=utils[_0x97c7('0x1f')](_0x416f96[0x2],this);}else{_0x311cb6[_0x97c7('0x10')]=utils['getMustacheRender'](_0x416f96[0x1],this);}if(this['message']){_0x311cb6['to']=this[_0x97c7('0x20')][_0x97c7('0x21')]||'';if(this['channel']==='mail'&&_0x416f96[0x1]==='1'){_0x311cb6['cc']=this[_0x97c7('0x20')]['cc']||'';}_0x311cb6['from']=this[_0x97c7('0x20')]['to']||'';_0x311cb6[_0x97c7('0x22')]=this[_0x97c7('0x20')]['phone']||'';_0x311cb6[_0x97c7('0x23')]=!![];if(this[_0x97c7('0x20')]['subject']){_0x311cb6['subject']='';_0x311cb6['subject']+=_[_0x97c7('0x24')](this[_0x97c7('0x20')]['subject'],_0x97c7('0x25'))?'':_0x97c7('0x26');_0x311cb6['subject']+=this[_0x97c7('0x20')][_0x97c7('0x27')];}}if(this[_0x97c7('0xe')]==='chat'){_0x311cb6[_0x97c7('0x28')]=this[_0x97c7('0x29')]['id'];}else{_0x311cb6[_[_0x97c7('0x2a')](this[_0x97c7('0xe')])+'AccountId']=this[_0x97c7('0x29')]['id'];}_0x311cb6[_['upperFirst'](this[_0x97c7('0xe')])+_0x97c7('0x2b')]=this[_0x97c7('0x17')]['id'];var _0x150102=this['interaction'];if(rpc[this[_0x97c7('0xe')]+'Message']){if(this[_0x97c7('0xe')]==='mail'){_0x311cb6['inReplyTo']=this[_0x97c7('0x20')][_0x97c7('0x2c')];_0x311cb6[_0x97c7('0x2d')]=''+_[_0x97c7('0x2e')](_0x311cb6['body'],_0x97c7('0x2f'),_0x97c7('0x30'))+_0x97c7('0x31');_0x311cb6[_0x97c7('0x32')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x97c7('0x33'),'Precedence':_0x97c7('0x34')};return mailRpc[_0x97c7('0x35')](this[_0x97c7('0x29')][_0x97c7('0x36')],_0x311cb6)[_0x97c7('0x37')](function(_0x5985d5){logger['info'](_0x97c7('0x38'),_0x3d8959);_0x311cb6[_0x97c7('0x2c')]=_0x5985d5[_0x97c7('0x20')][_0x97c7('0x2c')];return rpc[_0x23f642+_0x97c7('0x39')][_0x97c7('0x3a')](_0x311cb6);})[_0x97c7('0x37')](function(_0x55f428){logger['info'](_0x97c7('0x13'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x55f428));})[_0x97c7('0x3c')](function(_0x28f0ec){logger['error'](_0x97c7('0x3d'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x28f0ec));})[_0x97c7('0x3e')](function(){Promise['resolve']()[_0x97c7('0x37')](function(){if(_0x416f96[0x0]!=='2'||_0x150102['autoreplyExecuted'])return;return rpc[_0x23f642+_0x97c7('0x3f')]['update'](_0x150102['id'],{'autoreplyExecuted':!![]})[_0x97c7('0x37')](function(_0x49e23e){logger[_0x97c7('0x12')](_0x97c7('0x1b'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x49e23e));})[_0x97c7('0x3c')](function(_0x14a035){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3d8959,JSON[_0x97c7('0x3b')](_0x14a035));});})[_0x97c7('0x37')](function(){_0x51bfc6['next']();});});}else{return rpc[this[_0x97c7('0xe')]+_0x97c7('0x39')][_0x97c7('0x3a')](_0x311cb6)[_0x97c7('0x37')](function(){logger[_0x97c7('0x12')](_0x97c7('0x13'),_0x3d8959,_0x311cb6[_0x97c7('0x10')]);})['catch'](function(_0x4524fa){logger[_0x97c7('0x40')](_0x97c7('0x13'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x4524fa));})[_0x97c7('0x3e')](function(){Promise[_0x97c7('0x41')]()[_0x97c7('0x37')](function(){if(_0x416f96[0x0]!=='2'||_0x150102[_0x97c7('0x1a')])return;return rpc[_0x23f642+_0x97c7('0x3f')][_0x97c7('0x42')](_0x150102['id'],{'autoreplyExecuted':!![]})[_0x97c7('0x37')](function(_0x186423){logger[_0x97c7('0x12')](_0x97c7('0x1b'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x186423));})[_0x97c7('0x3c')](function(_0x47914c){logger[_0x97c7('0x40')](_0x97c7('0x43'),_0x3d8959,JSON[_0x97c7('0x3b')](_0x47914c));});})[_0x97c7('0x37')](function(){_0x51bfc6['next']();});});}}}catch(_0x43e120){logger[_0x97c7('0x40')](_0x97c7('0x13'),_0x3d8959,JSON['stringify'](_0x43e120));_0x51bfc6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 3b594e4..e1dac73 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5edb=['../../rpc/smsInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','stringify','stop','error','[%s][CLOSE]\x20%s','moment','routing','../../rpc/chatInteraction'];(function(_0x4e6fb2,_0x3cf23e){var _0x2f1636=function(_0x53c7eb){while(--_0x53c7eb){_0x4e6fb2['push'](_0x4e6fb2['shift']());}};_0x2f1636(++_0x3cf23e);}(_0x5edb,0x12f));var _0xb5ed=function(_0x326afd,_0x42bb4d){_0x326afd=_0x326afd-0x0;var _0x4f0c1c=_0x5edb[_0x326afd];return _0x4f0c1c;};'use strict';var moment=require(_0xb5ed('0x0'));var logger=require('../../../../config/logger')(_0xb5ed('0x1'));var rpc={'chatInteraction':require(_0xb5ed('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb5ed('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb5ed('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x260afc,_0x4a9e82,_0x115c93,_0x3a0ff1){return function(_0x38f3ff){try{logger['info'](_0xb5ed('0x5'),_0x260afc,_0x4a9e82[0x0]);var _0x2897af={'closed':0x1,'closedAt':moment()['format'](_0xb5ed('0x6')),'closeReason':_0xb5ed('0x7'),'disposition':_0x4a9e82[0x0]};if(rpc[_0x3a0ff1['channel']+_0xb5ed('0x8')]){rpc[_0x3a0ff1[_0xb5ed('0x9')]+_0xb5ed('0x8')][_0xb5ed('0xa')](_0x3a0ff1['interaction']['id'],_0x2897af)[_0xb5ed('0xb')](function(_0x6c525d){logger['info'](_0xb5ed('0xc'),_0x260afc,_0x3a0ff1['interaction']['id']);})['catch'](function(_0x592833){logger['error']('[%s][CLOSE]\x20%s',_0x260afc,JSON[_0xb5ed('0xd')](_0x592833));})['finally'](function(){_0x38f3ff[_0xb5ed('0xe')]();});}}catch(_0x466a5f){logger[_0xb5ed('0xf')](_0xb5ed('0x10'),_0x260afc,JSON[_0xb5ed('0xd')](_0x466a5f));_0x38f3ff['stop']();}};}; \ No newline at end of file +var _0xa632=['interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0xa632,0x15a));var _0x2a63=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa632[_0xea8947];return _0x2455e9;};'use strict';var moment=require(_0x2a63('0x0'));var logger=require(_0x2a63('0x1'))(_0x2a63('0x2'));var rpc={'chatInteraction':require(_0x2a63('0x3')),'openchannelInteraction':require(_0x2a63('0x4')),'smsInteraction':require(_0x2a63('0x5')),'mailInteraction':require(_0x2a63('0x6')),'faxInteraction':require(_0x2a63('0x7')),'whatsappInteraction':require(_0x2a63('0x8'))};exports['consequence']=function(_0x3e46c7,_0x5e5b50,_0x5b0097,_0xa01c79){return function(_0x40ec68){try{logger['info'](_0x2a63('0x9'),_0x3e46c7,_0x5e5b50[0x0]);var _0x2d2d51={'closed':0x1,'closedAt':moment()['format'](_0x2a63('0xa')),'closeReason':_0x2a63('0xb'),'disposition':_0x5e5b50[0x0]};if(rpc[_0xa01c79[_0x2a63('0xc')]+_0x2a63('0xd')]){rpc[_0xa01c79[_0x2a63('0xc')]+'Interaction']['update'](_0xa01c79[_0x2a63('0xe')]['id'],_0x2d2d51)[_0x2a63('0xf')](function(_0x39e6ff){logger[_0x2a63('0x10')](_0x2a63('0x11'),_0x3e46c7,_0xa01c79[_0x2a63('0xe')]['id']);})[_0x2a63('0x12')](function(_0x46ab5d){logger[_0x2a63('0x13')](_0x2a63('0x14'),_0x3e46c7,JSON['stringify'](_0x46ab5d));})[_0x2a63('0x15')](function(){_0x40ec68['stop']();});}}catch(_0x5d2361){logger[_0x2a63('0x13')](_0x2a63('0x14'),_0x3e46c7,JSON[_0x2a63('0x16')](_0x5d2361));_0x40ec68[_0x2a63('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 5fbe03b..9aaadf2 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88b0=['UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','Message','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','providerResponse','next','message','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction'];(function(_0x12b966,_0x102249){var _0x1d3e89=function(_0x1b703d){while(--_0x1b703d){_0x12b966['push'](_0x12b966['shift']());}};_0x1d3e89(++_0x102249);}(_0x88b0,0x1cb));var _0x088b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x88b0[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x088b('0x2'));var logger=require(_0x088b('0x3'))(_0x088b('0x4'));var rpc={'chatMessage':require(_0x088b('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x088b('0x6')),'smsMessage':require(_0x088b('0x7')),'faxMessage':require(_0x088b('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfd98a3,_0xa5a81f){return function(_0x18fa42){try{if(!_[_0x088b('0x9')](this[_0x088b('0xa')][_0x088b('0xb')])){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x088b('0xd'));return _0x18fa42['next']();}var _0x2502df={'ContactId':this['contact']['id'],'sentAt':moment()[_0x088b('0xe')](_0x088b('0xf')),'direction':'out'};if(this['channel']===_0x088b('0x10')||this[_0x088b('0x11')]===_0x088b('0x12')){_0x2502df['phone']=this[_0x088b('0xa')][_0x088b('0x13')];}var _0x1ea6d7=this['channel'];if(_0x1ea6d7===_0x088b('0x14')){_0x2502df[_0x088b('0x15')]=this[_0x088b('0x16')]['id'];}else{_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+_0x088b('0x18')]=this[_0x088b('0x16')]['id'];}_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+'InteractionId']=this[_0x088b('0xa')]['id'];if(this[_0x088b('0xa')][_0x088b('0x19')]){var _0xdee68a=_0xa5a81f[0x2];if(!_[_0x088b('0x1a')](_0xdee68a)){_0x2502df[_0x088b('0x1b')]=utils['getMustacheRender'](_0xdee68a,this);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x31d121){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x2502df['body']);})[_0x088b('0x1f')](function(_0x3b3eb6){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x3b3eb6));})[_0x088b('0x23')](function(){logger['info'](_0x088b('0x24'),_0xfd98a3);_0x18fa42[_0x088b('0x25')]();});}else{logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xfd98a3);_0x18fa42['stop']();}}else{var _0x464949=this;var _0x1db300=apiai(_0xa5a81f[0x0],{'language':_0xa5a81f[0x1]||'en'});return _0x1db300[_0x088b('0x26')](this['message'][_0x088b('0x1b')],{'sessionId':md5(this[_0x088b('0xa')]['id'])})['then'](function(_0x4b4d3f){_0x464949['body'][_0x088b('0x27')]=_0x4b4d3f;_0x2502df['body']=_0x4b4d3f[_0x088b('0x28')][_0x088b('0x29')][_0x088b('0x2a')];_0x2502df[_0x088b('0x2b')]=_0x088b('0x27');_0x2502df[_0x088b('0x2c')]=JSON['stringify'](_0x4b4d3f);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x5f20de){logger[_0x088b('0xc')](_0x088b('0x21'),_0xfd98a3,_0x2502df[_0x088b('0x1b')]);if(_0x4b4d3f[_0x088b('0x28')]['metadata']['endConversation']){_0x18fa42[_0x088b('0x2d')]();}else{_0x18fa42[_0x088b('0x25')]();}})[_0x088b('0x1f')](function(_0x193a00){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,JSON[_0x088b('0x22')](_0x193a00));_0x18fa42[_0x088b('0x2d')]();});})[_0x088b('0x1f')](function(_0x6535be){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x6535be[_0x088b('0x2e')]);_0x18fa42[_0x088b('0x2d')]();});}}catch(_0x213cbe){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x213cbe));_0x18fa42[_0x088b('0x25')]();}};}; \ No newline at end of file +var _0x0cfe=['body','getMustacheRender','Message','create','then','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','providerName','providerResponse','lodash','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','isEmpty'];(function(_0x9d693d,_0x4265c1){var _0x50088d=function(_0x277e9b){while(--_0x277e9b){_0x9d693d['push'](_0x9d693d['shift']());}};_0x50088d(++_0x4265c1);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x14cd1e,_0x3f3f3d){_0x14cd1e=_0x14cd1e-0x0;var _0x7794e3=_0x0cfe[_0x14cd1e];return _0x7794e3;};'use strict';var _=require(_0xe0cf('0x0'));var moment=require('moment');var apiai=require(_0xe0cf('0x1'));var md5=require(_0xe0cf('0x2'));var utils=require(_0xe0cf('0x3'));var logger=require('../../../../config/logger')(_0xe0cf('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe0cf('0x5')),'mailMessage':require(_0xe0cf('0x6')),'smsMessage':require(_0xe0cf('0x7')),'faxMessage':require(_0xe0cf('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe0cf('0x9')]=function(_0x2abd29,_0x1985b6){return function(_0x518995){try{if(!_[_0xe0cf('0xa')](this[_0xe0cf('0xb')]['UserId'])){logger[_0xe0cf('0xc')](_0xe0cf('0xd'),_0x2abd29,_0xe0cf('0xe'));return _0x518995[_0xe0cf('0xf')]();}var _0x2e689c={'ContactId':this[_0xe0cf('0x10')]['id'],'sentAt':moment()['format'](_0xe0cf('0x11')),'direction':_0xe0cf('0x12')};if(this[_0xe0cf('0x13')]===_0xe0cf('0x14')||this[_0xe0cf('0x13')]===_0xe0cf('0x15')){_0x2e689c[_0xe0cf('0x16')]=this[_0xe0cf('0xb')][_0xe0cf('0x16')];}var _0x1e69b5=this[_0xe0cf('0x13')];if(_0x1e69b5===_0xe0cf('0x17')){_0x2e689c['ChatWebsiteId']=this[_0xe0cf('0x18')]['id'];}else{_0x2e689c[_[_0xe0cf('0x19')](_0x1e69b5)+_0xe0cf('0x1a')]=this[_0xe0cf('0x18')]['id'];}_0x2e689c[_[_0xe0cf('0x19')](_0x1e69b5)+'InteractionId']=this['interaction']['id'];if(this[_0xe0cf('0xb')]['created']){var _0x553844=_0x1985b6[0x2];if(!_[_0xe0cf('0x1b')](_0x553844)){_0x2e689c[_0xe0cf('0x1c')]=utils[_0xe0cf('0x1d')](_0x553844,this);return rpc[_0x1e69b5+_0xe0cf('0x1e')][_0xe0cf('0x1f')](_0x2e689c)[_0xe0cf('0x20')](function(_0x39741b){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2abd29,_0x2e689c[_0xe0cf('0x1c')]);})[_0xe0cf('0x21')](function(_0x5bfe30){logger[_0xe0cf('0x22')](_0xe0cf('0xd'),_0x2abd29,JSON[_0xe0cf('0x23')](_0x5bfe30));})[_0xe0cf('0x24')](function(){logger[_0xe0cf('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2abd29);_0x518995[_0xe0cf('0x25')]();});}else{logger['info'](_0xe0cf('0x26'),_0x2abd29);_0x518995[_0xe0cf('0x25')]();}}else{var _0x4793de=this;var _0x234969=apiai(_0x1985b6[0x0],{'language':_0x1985b6[0x1]||'en'});return _0x234969[_0xe0cf('0x27')](this[_0xe0cf('0x28')][_0xe0cf('0x1c')],{'sessionId':md5(this['interaction']['id'])})[_0xe0cf('0x20')](function(_0x3ae09c){_0x4793de[_0xe0cf('0x1c')][_0xe0cf('0x29')]=_0x3ae09c;_0x2e689c['body']=_0x3ae09c[_0xe0cf('0x2a')]['fulfillment'][_0xe0cf('0x2b')];_0x2e689c[_0xe0cf('0x2c')]=_0xe0cf('0x29');_0x2e689c[_0xe0cf('0x2d')]=JSON[_0xe0cf('0x23')](_0x3ae09c);return rpc[_0x1e69b5+_0xe0cf('0x1e')]['create'](_0x2e689c)[_0xe0cf('0x20')](function(_0x2387ab){logger[_0xe0cf('0xc')](_0xe0cf('0xd'),_0x2abd29,_0x2e689c[_0xe0cf('0x1c')]);if(_0x3ae09c['result']['metadata']['endConversation']){_0x518995[_0xe0cf('0xf')]();}else{_0x518995[_0xe0cf('0x25')]();}})['catch'](function(_0x5e3fdd){logger[_0xe0cf('0x22')](_0xe0cf('0xd'),_0x2abd29,JSON[_0xe0cf('0x23')](_0x5e3fdd));_0x518995[_0xe0cf('0xf')]();});})[_0xe0cf('0x21')](function(_0x2e1392){logger[_0xe0cf('0x22')](_0xe0cf('0xd'),_0x2abd29,_0x2e1392['message']);_0x518995['next']();});}}catch(_0x3c041c){logger[_0xe0cf('0x22')](_0xe0cf('0xd'),_0x2abd29,JSON[_0xe0cf('0x23')](_0x3c041c));_0x518995[_0xe0cf('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 5c697ff..03016be 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x659a=['sms','phone','account','upperFirst','InteractionId','created','getMustacheRender','error','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','length','dialogflowV2','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','queryResult','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','stack','lodash','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x659a,0x1d5));var _0xa659=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x659a[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0xa659('0x0'));var dialogflow=require(_0xa659('0x1'));var md5=require('md5');var moment=require(_0xa659('0x2'));var Promise=require('bluebird');var logger=require(_0xa659('0x3'))(_0xa659('0x4'));var utils=require(_0xa659('0x5'));var rpc={'chatMessage':require(_0xa659('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa659('0x7')),'smsMessage':require(_0xa659('0x8')),'faxMessage':require(_0xa659('0x9')),'whatsappMessage':require(_0xa659('0xa'))};function createMessage(_0x3b24e7,_0x3eae3b,_0x59024a,_0xfe3886){return new Promise(function(_0x2d134a,_0x3d4904){var _0x109659=_[_0xa659('0xb')](_0x59024a);_0x109659[_0xa659('0xc')]=_0xfe3886;return rpc[_0x3eae3b+_0xa659('0xd')][_0xa659('0xe')](_0x109659)[_0xa659('0xf')](function(){logger[_0xa659('0x10')](_0xa659('0x11'),_0x3b24e7,_0x109659[_0xa659('0xc')]);_0x2d134a();})[_0xa659('0x12')](function(_0xf4dd93){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3b24e7,JSON[_0xa659('0x13')](_0xf4dd93));_0x3d4904(_0xf4dd93);});});}exports[_0xa659('0x14')]=function(_0x132795,_0x2bf206){return function(_0x123762){try{if(!_[_0xa659('0x15')](this[_0xa659('0x16')][_0xa659('0x17')])){logger[_0xa659('0x10')](_0xa659('0x11'),_0x132795,_0xa659('0x18'));return _0x123762['next']();}var _0x1689cb={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa659('0x19')](_0xa659('0x1a')),'direction':'out'};if(this[_0xa659('0x1b')]===_0xa659('0x1c')||this[_0xa659('0x1b')]==='whatsapp'){_0x1689cb[_0xa659('0x1d')]=this[_0xa659('0x16')][_0xa659('0x1d')];}var _0x20637a=this[_0xa659('0x1b')];if(_0x20637a==='chat'){_0x1689cb['ChatWebsiteId']=this[_0xa659('0x1e')]['id'];}else{_0x1689cb[_[_0xa659('0x1f')](_0x20637a)+'AccountId']=this['account']['id'];}_0x1689cb[_[_0xa659('0x1f')](_0x20637a)+_0xa659('0x20')]=this['interaction']['id'];if(this['interaction'][_0xa659('0x21')]){var _0x213369=_0x2bf206[0x4];if(!_['isEmpty'](_0x213369)){_0x1689cb['body']=utils[_0xa659('0x22')](_0x213369,this);return rpc[_0x20637a+'Message'][_0xa659('0xe')](_0x1689cb)[_0xa659('0xf')](function(_0x16c308){logger[_0xa659('0x10')](_0xa659('0x11'),_0x132795,_0x1689cb['body']);})['catch'](function(_0x137dfe){logger[_0xa659('0x23')](_0xa659('0x11'),_0x132795,JSON[_0xa659('0x13')](_0x137dfe));})[_0xa659('0x24')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x132795);_0x123762[_0xa659('0x25')]();});}else{logger[_0xa659('0x10')](_0xa659('0x26'),_0x132795);_0x123762[_0xa659('0x25')]();}}else{var _0x124404=this;var _0x424bea=_0x2bf206[0x2][_0xa659('0x27')](/\\n/g,'\x0a');var _0x53b031={'credentials':{'private_key':_0x424bea,'client_email':_0x2bf206[0x1]}};var _0x4a4dc9=new dialogflow[(_0xa659('0x28'))](_0x53b031);var _0x30c3df=_0x4a4dc9['sessionPath'](_0x2bf206[0x0],md5(_0x124404[_0xa659('0x16')]['id']));var _0x2d6d3c={'session':_0x30c3df,'queryInput':{'text':{'text':_0x124404[_0xa659('0x29')][_0xa659('0xc')],'languageCode':_0x2bf206[0x3]||'en'}}};return _0x4a4dc9['detectIntent'](_0x2d6d3c)[_0xa659('0xf')](function(_0xe25a17){if(_0xe25a17&&_0xe25a17[_0xa659('0x2a')]){_0x124404[_0xa659('0xc')][_0xa659('0x2b')]=_0xe25a17;var _0x43fea8=_0xe25a17[0x0];var _0x46e587=_0x43fea8['queryResult'][_0xa659('0x2c')]&&_0x43fea8['queryResult'][_0xa659('0x2c')][_0xa659('0x2d')]?_0x43fea8['queryResult'][_0xa659('0x2c')][_0xa659('0x2d')][_0xa659('0x2e')][_0xa659('0x2f')]:![];_0x124404['body'][_0xa659('0x30')]=_0x43fea8[_0xa659('0x31')]['action'];_0x124404[_0xa659('0xc')][_0xa659('0x32')]=_0x43fea8[_0xa659('0x31')][_0xa659('0x33')];_0x124404[_0xa659('0xc')][_0xa659('0x34')]=_0x43fea8[_0xa659('0x31')][_0xa659('0x2c')]&&_0x43fea8[_0xa659('0x31')][_0xa659('0x2c')][_0xa659('0x2d')]?_0x43fea8[_0xa659('0x31')][_0xa659('0x2c')][_0xa659('0x2d')][_0xa659('0x2e')][_0xa659('0x2f')]:![];_0x124404[_0xa659('0xc')][_0xa659('0x35')]=_0x43fea8[_0xa659('0x31')][_0xa659('0x36')][_0xa659('0x37')];_0x124404[_0xa659('0xc')][_0xa659('0x38')]=_0x43fea8[_0xa659('0x31')][_0xa659('0x36')][_0xa659('0x39')];_0x124404[_0xa659('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x43fea8[_0xa659('0x31')][_0xa659('0x36')][_0xa659('0x3a')];_0x124404[_0xa659('0xc')][_0xa659('0x3b')]=_0x43fea8[_0xa659('0x31')]['languageCode'];_0x124404[_0xa659('0xc')][_0xa659('0x3c')]=_0x43fea8[_0xa659('0x31')][_0xa659('0x3d')];_0x124404[_0xa659('0xc')][_0xa659('0x3e')]=_0x43fea8['queryResult'][_0xa659('0x3f')];_0x1689cb[_0xa659('0x40')]='dialogflowV2';_0x1689cb[_0xa659('0x41')]=JSON[_0xa659('0x13')](_0xe25a17);var _0x55913b=[];for(var _0x2058e8=0x0;_0x2058e8<_0xe25a17['length'];_0x2058e8++){var _0x470e74=_0xe25a17[_0x2058e8];if(_0x470e74&&_0x470e74[_0xa659('0x31')]&&_0x470e74[_0xa659('0x31')]['fulfillmentText']){_0x55913b[_0xa659('0x42')](createMessage(_0x132795,_0x20637a,_0x1689cb,_0x470e74[_0xa659('0x31')][_0xa659('0x43')]));}}return Promise[_0xa659('0x44')](_0x55913b)[_0xa659('0xf')](function(){if(_0x46e587){_0x123762[_0xa659('0x45')]();}else{_0x123762[_0xa659('0x25')]();}})[_0xa659('0x12')](function(_0x5c4ad5){logger[_0xa659('0x23')](_0xa659('0x11'),_0x132795,JSON[_0xa659('0x13')](_0x5c4ad5));_0x123762[_0xa659('0x45')]();});}})[_0xa659('0x12')](function(_0x5c681f){logger[_0xa659('0x23')](_0xa659('0x11'),_0x132795,_0x5c681f[_0xa659('0x29')],_0x5c681f[_0xa659('0x46')]);_0x123762[_0xa659('0x45')]();});}}catch(_0x283af0){logger['error'](_0xa659('0x11'),_0x132795,JSON[_0xa659('0x13')](_0x283af0));_0x123762['stop']();}};}; \ No newline at end of file +var _0xad80=['fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','catch','lodash','dialogflow','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','queryResult'];(function(_0x2d171e,_0x3f2046){var _0x357302=function(_0x55f536){while(--_0x55f536){_0x2d171e['push'](_0x2d171e['shift']());}};_0x357302(++_0x3f2046);}(_0xad80,0x17f));var _0x0ad8=function(_0x5921dd,_0x15770d){_0x5921dd=_0x5921dd-0x0;var _0x1cf8fe=_0xad80[_0x5921dd];return _0x1cf8fe;};'use strict';var _=require(_0x0ad8('0x0'));var dialogflow=require(_0x0ad8('0x1'));var md5=require('md5');var moment=require(_0x0ad8('0x2'));var Promise=require('bluebird');var logger=require('../../../../config/logger')('routing');var utils=require(_0x0ad8('0x3'));var rpc={'chatMessage':require(_0x0ad8('0x4')),'openchannelMessage':require(_0x0ad8('0x5')),'mailMessage':require(_0x0ad8('0x6')),'smsMessage':require(_0x0ad8('0x7')),'faxMessage':require(_0x0ad8('0x8')),'whatsappMessage':require(_0x0ad8('0x9'))};function createMessage(_0x1892c2,_0x30a397,_0x308ecc,_0x2115f6){return new Promise(function(_0x3b00e4,_0x5622a7){var _0xcff2bb=_[_0x0ad8('0xa')](_0x308ecc);_0xcff2bb['body']=_0x2115f6;return rpc[_0x30a397+_0x0ad8('0xb')][_0x0ad8('0xc')](_0xcff2bb)[_0x0ad8('0xd')](function(){logger[_0x0ad8('0xe')](_0x0ad8('0xf'),_0x1892c2,_0xcff2bb[_0x0ad8('0x10')]);_0x3b00e4();})['catch'](function(_0x414219){logger[_0x0ad8('0x11')](_0x0ad8('0xf'),_0x1892c2,JSON[_0x0ad8('0x12')](_0x414219));_0x5622a7(_0x414219);});});}exports[_0x0ad8('0x13')]=function(_0x3731d9,_0x5e8b61){return function(_0x32c694){try{if(!_['isNil'](this[_0x0ad8('0x14')][_0x0ad8('0x15')])){logger[_0x0ad8('0xe')](_0x0ad8('0xf'),_0x3731d9,_0x0ad8('0x16'));return _0x32c694[_0x0ad8('0x17')]();}var _0x403be6={'ContactId':this[_0x0ad8('0x18')]['id'],'sentAt':moment()[_0x0ad8('0x19')](_0x0ad8('0x1a')),'direction':_0x0ad8('0x1b')};if(this[_0x0ad8('0x1c')]===_0x0ad8('0x1d')||this[_0x0ad8('0x1c')]==='whatsapp'){_0x403be6['phone']=this[_0x0ad8('0x14')][_0x0ad8('0x1e')];}var _0x2d12ed=this[_0x0ad8('0x1c')];if(_0x2d12ed===_0x0ad8('0x1f')){_0x403be6[_0x0ad8('0x20')]=this[_0x0ad8('0x21')]['id'];}else{_0x403be6[_[_0x0ad8('0x22')](_0x2d12ed)+_0x0ad8('0x23')]=this[_0x0ad8('0x21')]['id'];}_0x403be6[_[_0x0ad8('0x22')](_0x2d12ed)+_0x0ad8('0x24')]=this['interaction']['id'];if(this['interaction'][_0x0ad8('0x25')]){var _0x7dc890=_0x5e8b61[0x4];if(!_[_0x0ad8('0x26')](_0x7dc890)){_0x403be6['body']=utils['getMustacheRender'](_0x7dc890,this);return rpc[_0x2d12ed+_0x0ad8('0xb')][_0x0ad8('0xc')](_0x403be6)[_0x0ad8('0xd')](function(_0x3b67bb){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x3731d9,_0x403be6['body']);})['catch'](function(_0x6dc909){logger[_0x0ad8('0x11')](_0x0ad8('0xf'),_0x3731d9,JSON[_0x0ad8('0x12')](_0x6dc909));})[_0x0ad8('0x27')](function(){logger[_0x0ad8('0xe')](_0x0ad8('0x28'),_0x3731d9);_0x32c694[_0x0ad8('0x29')]();});}else{logger[_0x0ad8('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3731d9);_0x32c694[_0x0ad8('0x29')]();}}else{var _0x43327b=this;var _0x22d4ff=_0x5e8b61[0x2][_0x0ad8('0x2a')](/\\n/g,'\x0a');var _0x3facbe={'credentials':{'private_key':_0x22d4ff,'client_email':_0x5e8b61[0x1]}};var _0x3bfeef=new dialogflow['SessionsClient'](_0x3facbe);var _0x5a7052=_0x3bfeef[_0x0ad8('0x2b')](_0x5e8b61[0x0],md5(_0x43327b['interaction']['id']));var _0x4e743b={'session':_0x5a7052,'queryInput':{'text':{'text':_0x43327b[_0x0ad8('0x2c')][_0x0ad8('0x10')],'languageCode':_0x5e8b61[0x3]||'en'}}};return _0x3bfeef[_0x0ad8('0x2d')](_0x4e743b)[_0x0ad8('0xd')](function(_0x35a293){if(_0x35a293&&_0x35a293['length']){_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x2e')]=_0x35a293;var _0x1c2122=_0x35a293[0x0];var _0xedd28e=_0x1c2122['queryResult'][_0x0ad8('0x2f')]&&_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x2f')][_0x0ad8('0x31')]?_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x2f')][_0x0ad8('0x31')][_0x0ad8('0x32')][_0x0ad8('0x33')]:![];_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x34')]=_0x1c2122['queryResult'][_0x0ad8('0x35')];_0x43327b[_0x0ad8('0x10')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1c2122['queryResult'][_0x0ad8('0x36')];_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x37')]=_0x1c2122[_0x0ad8('0x30')]['diagnosticInfo']&&_0x1c2122[_0x0ad8('0x30')]['diagnosticInfo'][_0x0ad8('0x31')]?_0x1c2122['queryResult'][_0x0ad8('0x2f')][_0x0ad8('0x31')][_0x0ad8('0x32')][_0x0ad8('0x33')]:![];_0x43327b[_0x0ad8('0x10')]['DIALOGFLOWV2_INTENTNAME']=_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x38')][_0x0ad8('0x39')];_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x3a')]=_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x38')]['displayName'];_0x43327b[_0x0ad8('0x10')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1c2122[_0x0ad8('0x30')]['intent'][_0x0ad8('0x3b')];_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x3c')]=_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x3d')];_0x43327b[_0x0ad8('0x10')][_0x0ad8('0x3e')]=_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x3f')];_0x43327b[_0x0ad8('0x10')]['DIALOGFLOWV2_SCORE']=_0x1c2122[_0x0ad8('0x30')][_0x0ad8('0x40')];_0x403be6[_0x0ad8('0x41')]=_0x0ad8('0x2e');_0x403be6[_0x0ad8('0x42')]=JSON[_0x0ad8('0x12')](_0x35a293);var _0x378cb1=[];for(var _0x54843c=0x0;_0x54843c<_0x35a293[_0x0ad8('0x43')];_0x54843c++){var _0x2edb8f=_0x35a293[_0x54843c];if(_0x2edb8f&&_0x2edb8f[_0x0ad8('0x30')]&&_0x2edb8f[_0x0ad8('0x30')][_0x0ad8('0x44')]){_0x378cb1[_0x0ad8('0x45')](createMessage(_0x3731d9,_0x2d12ed,_0x403be6,_0x2edb8f[_0x0ad8('0x30')][_0x0ad8('0x44')]));}}return Promise[_0x0ad8('0x46')](_0x378cb1)[_0x0ad8('0xd')](function(){if(_0xedd28e){_0x32c694[_0x0ad8('0x17')]();}else{_0x32c694[_0x0ad8('0x29')]();}})[_0x0ad8('0x47')](function(_0x1a73cd){logger[_0x0ad8('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x3731d9,JSON['stringify'](_0x1a73cd));_0x32c694[_0x0ad8('0x17')]();});}})[_0x0ad8('0x47')](function(_0x581c05){logger[_0x0ad8('0x11')](_0x0ad8('0xf'),_0x3731d9,_0x581c05[_0x0ad8('0x2c')],_0x581c05['stack']);_0x32c694['next']();});}}catch(_0x29fb72){logger[_0x0ad8('0x11')](_0x0ad8('0xf'),_0x3731d9,JSON[_0x0ad8('0x12')](_0x29fb72));_0x32c694[_0x0ad8('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 060f1dc..c6b3ab6 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5793=['priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue'];(function(_0x312d2f,_0x4ba8b1){var _0x48204d=function(_0x2fe228){while(--_0x2fe228){_0x312d2f['push'](_0x312d2f['shift']());}};_0x48204d(++_0x4ba8b1);}(_0x5793,0x15f));var _0x3579=function(_0x3050a9,_0x2352a8){_0x3050a9=_0x3050a9-0x0;var _0x38abaa=_0x5793[_0x3050a9];return _0x38abaa;};'use strict';var schema=require('validate');var _=require(_0x3579('0x0'));var htmlToText=require(_0x3579('0x1'));var utils=require(_0x3579('0x2'));var logger=require(_0x3579('0x3'))(_0x3579('0x4'));var gotoif=schema({'condition':{'type':_0x3579('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x3579('0x6'),'message':_0x3579('0x7')},'priorityFalse':{'type':'number','message':_0x3579('0x8')}});exports[_0x3579('0x9')]=function(_0xaebc82,_0x36a4d6){return function(_0x4c8fa2){try{var _0x145292={'condition':htmlToText[_0x3579('0xa')](utils[_0x3579('0xb')](_0x36a4d6[0x0],this),{'wordwrap':![]})[_0x3579('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x36a4d6[0x1],'priorityFalse':_0x36a4d6[0x2]};var _0x55e8bc=gotoif[_0x3579('0xd')](_0x145292,{'typecast':!![]});if(_0x55e8bc['length']){logger[_0x3579('0xe')](_0x3579('0xf'),_0xaebc82,_[_0x3579('0x10')](_0x55e8bc,_0x3579('0x11'))[_0x3579('0x12')](',\x20'));_0x4c8fa2['stop']();}else{try{var _0x1d2e7f=eval('('+_0x145292[_0x3579('0x13')]+')');var _0x5507a7=_0x1d2e7f?_0x145292[_0x3579('0x14')]:_0x145292[_0x3579('0x15')];logger[_0x3579('0x16')](_0x3579('0x17'),_0xaebc82,_0x145292[_0x3579('0x13')],_0x1d2e7f,_0x5507a7||_0x3579('0x18'));if(_0x5507a7){var _0x26c9e0=_['findIndex'](_0x4c8fa2[_0x3579('0x19')](),{'p':_0x5507a7});if(_0x26c9e0>=0x0){logger[_0x3579('0x16')](_0x3579('0x1a'),_0xaebc82,_0x5507a7||'next',_0x26c9e0);_0x4c8fa2[_0x3579('0x18')](_0x26c9e0);}else{logger['info'](_0x3579('0x1b'),_0xaebc82,_0x5507a7||_0x3579('0x18'));_0x4c8fa2[_0x3579('0x1c')]();}}else{_0x4c8fa2['next']();}}catch(_0x442a27){logger[_0x3579('0xe')](_0x3579('0x1d'),_0xaebc82,_0x442a27[_0x3579('0x11')]);_0x4c8fa2[_0x3579('0x1c')]();}}}catch(_0x26a8e2){logger['error'](_0x3579('0xf'),_0xaebc82,JSON[_0x3579('0x1e')](_0x26a8e2));_0x4c8fa2[_0x3579('0x1c')]();}};}; \ No newline at end of file +var _0x9def=['map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s'];(function(_0x587bb0,_0xfc600f){var _0x456ccd=function(_0x1a537e){while(--_0x1a537e){_0x587bb0['push'](_0x587bb0['shift']());}};_0x456ccd(++_0xfc600f);}(_0x9def,0x9e));var _0xf9de=function(_0x1c396a,_0x1b3ce0){_0x1c396a=_0x1c396a-0x0;var _0x1cde36=_0x9def[_0x1c396a];return _0x1cde36;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xf9de('0x0'));var utils=require(_0xf9de('0x1'));var logger=require(_0xf9de('0x2'))(_0xf9de('0x3'));var gotoif=schema({'condition':{'type':_0xf9de('0x4'),'required':!![],'message':_0xf9de('0x5')},'priorityTrue':{'type':_0xf9de('0x6'),'message':_0xf9de('0x7')},'priorityFalse':{'type':'number','message':_0xf9de('0x8')}});exports['consequence']=function(_0x2fec9a,_0x2db25e){return function(_0x5f3d66){try{var _0x152903={'condition':htmlToText[_0xf9de('0x9')](utils[_0xf9de('0xa')](_0x2db25e[0x0],this),{'wordwrap':![]})[_0xf9de('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2db25e[0x1],'priorityFalse':_0x2db25e[0x2]};var _0x5487c4=gotoif[_0xf9de('0xc')](_0x152903,{'typecast':!![]});if(_0x5487c4[_0xf9de('0xd')]){logger[_0xf9de('0xe')](_0xf9de('0xf'),_0x2fec9a,_[_0xf9de('0x10')](_0x5487c4,_0xf9de('0x11'))[_0xf9de('0x12')](',\x20'));_0x5f3d66[_0xf9de('0x13')]();}else{try{var _0x28dab4=eval('('+_0x152903[_0xf9de('0x14')]+')');var _0x33c20c=_0x28dab4?_0x152903[_0xf9de('0x15')]:_0x152903['priorityFalse'];logger['info'](_0xf9de('0x16'),_0x2fec9a,_0x152903[_0xf9de('0x14')],_0x28dab4,_0x33c20c||_0xf9de('0x17'));if(_0x33c20c){var _0x3c7db8=_[_0xf9de('0x18')](_0x5f3d66['rules'](),{'p':_0x33c20c});if(_0x3c7db8>=0x0){logger[_0xf9de('0x19')](_0xf9de('0x1a'),_0x2fec9a,_0x33c20c||_0xf9de('0x17'),_0x3c7db8);_0x5f3d66['next'](_0x3c7db8);}else{logger[_0xf9de('0x19')](_0xf9de('0x1b'),_0x2fec9a,_0x33c20c||_0xf9de('0x17'));_0x5f3d66[_0xf9de('0x13')]();}}else{_0x5f3d66['next']();}}catch(_0xba5fbd){logger[_0xf9de('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2fec9a,_0xba5fbd[_0xf9de('0x11')]);_0x5f3d66[_0xf9de('0x13')]();}}}catch(_0x5df624){logger[_0xf9de('0xe')](_0xf9de('0xf'),_0x2fec9a,JSON[_0xf9de('0x1c')](_0x5df624));_0x5f3d66[_0xf9de('0x13')]();}};}; \ 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 f730345..b690637 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 _0x16ec=['next','stop','stringify','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','info','[%s][GOTOP]\x20priority\x20%s','findIndex','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x1a7382,_0x192eda){var _0x184d19=function(_0x3f73fc){while(--_0x3f73fc){_0x1a7382['push'](_0x1a7382['shift']());}};_0x184d19(++_0x192eda);}(_0x16ec,0xc9));var _0xc16e=function(_0x3bf865,_0x163c5a){_0x3bf865=_0x3bf865-0x0;var _0x2e35e9=_0x16ec[_0x3bf865];return _0x2e35e9;};'use strict';var schema=require('validate');var _=require(_0xc16e('0x0'));var logger=require(_0xc16e('0x1'))('routing');var gotop=schema({'priority':{'type':_0xc16e('0x2'),'required':!![],'message':_0xc16e('0x3')}});exports[_0xc16e('0x4')]=function(_0x23889d,_0x1f7113){return function(_0x470716){try{var _0x40c6a8={'priority':_0x1f7113[0x0]};var _0x1cc197=gotop[_0xc16e('0x5')](_0x40c6a8,{'typecast':!![]});if(_0x1cc197[_0xc16e('0x6')]){logger[_0xc16e('0x7')](_0xc16e('0x8'),_0x23889d,_['map'](_0x1cc197,_0xc16e('0x9'))['join'](',\x20'));_0x470716['stop']();}else{logger[_0xc16e('0xa')](_0xc16e('0xb'),_0x23889d,_0x40c6a8['priority']);if(_0x40c6a8['priority']){var _0x2ecd3b=_[_0xc16e('0xc')](_0x470716['rules'](),{'p':_0x40c6a8[_0xc16e('0xd')]});if(_0x2ecd3b>=0x0){logger['info'](_0xc16e('0xe'),_0x23889d,_0x40c6a8['priority']||'next',_0x2ecd3b);_0x470716[_0xc16e('0xf')](_0x2ecd3b);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x23889d,_0x40c6a8[_0xc16e('0xd')]||_0xc16e('0xf'));_0x470716[_0xc16e('0x10')]();}}else{_0x470716['next']();}}}catch(_0x384bc7){logger[_0xc16e('0x7')](_0xc16e('0x8'),_0x23889d,JSON[_0xc16e('0x11')](_0x384bc7));_0x470716[_0xc16e('0x10')]();}};}; \ No newline at end of file +var _0x9fae=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x9fae,0xf1));var _0xe9fa=function(_0x226760,_0x552936){_0x226760=_0x226760-0x0;var _0x1db68d=_0x9fae[_0x226760];return _0x1db68d;};'use strict';var schema=require(_0xe9fa('0x0'));var _=require(_0xe9fa('0x1'));var logger=require(_0xe9fa('0x2'))(_0xe9fa('0x3'));var gotop=schema({'priority':{'type':_0xe9fa('0x4'),'required':!![],'message':_0xe9fa('0x5')}});exports[_0xe9fa('0x6')]=function(_0x444f03,_0x356e0c){return function(_0x1e7f75){try{var _0x5082c8={'priority':_0x356e0c[0x0]};var _0x241ec4=gotop[_0xe9fa('0x0')](_0x5082c8,{'typecast':!![]});if(_0x241ec4['length']){logger[_0xe9fa('0x7')](_0xe9fa('0x8'),_0x444f03,_[_0xe9fa('0x9')](_0x241ec4,_0xe9fa('0xa'))[_0xe9fa('0xb')](',\x20'));_0x1e7f75[_0xe9fa('0xc')]();}else{logger[_0xe9fa('0xd')](_0xe9fa('0xe'),_0x444f03,_0x5082c8[_0xe9fa('0xf')]);if(_0x5082c8[_0xe9fa('0xf')]){var _0x156c08=_[_0xe9fa('0x10')](_0x1e7f75[_0xe9fa('0x11')](),{'p':_0x5082c8[_0xe9fa('0xf')]});if(_0x156c08>=0x0){logger[_0xe9fa('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x444f03,_0x5082c8[_0xe9fa('0xf')]||_0xe9fa('0x12'),_0x156c08);_0x1e7f75[_0xe9fa('0x12')](_0x156c08);}else{logger['info'](_0xe9fa('0x13'),_0x444f03,_0x5082c8['priority']||_0xe9fa('0x12'));_0x1e7f75[_0xe9fa('0xc')]();}}else{_0x1e7f75[_0xe9fa('0x12')]();}}}catch(_0xbd5127){logger[_0xe9fa('0x7')](_0xe9fa('0x8'),_0x444f03,JSON[_0xe9fa('0x14')](_0xbd5127));_0x1e7f75[_0xe9fa('0xc')]();}};}; \ 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 027ac77..09f6431 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 _0xb6b8=['channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','info','next','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x4b679e,_0x1f1abc){var _0x1221c5=function(_0x2aca19){while(--_0x2aca19){_0x4b679e['push'](_0x4b679e['shift']());}};_0x1221c5(++_0x1f1abc);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x23aa37,_0xce7f30){_0x23aa37=_0x23aa37-0x0;var _0x27c058=_0xb6b8[_0x23aa37];return _0x27c058;};'use strict';var _=require('lodash');var utils=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));var rpc={'chatMessage':require(_0x8b6b('0x3')),'openchannelMessage':require(_0x8b6b('0x4')),'mailMessage':require(_0x8b6b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8b6b('0x6')),'whatsappMessage':require(_0x8b6b('0x7'))};exports[_0x8b6b('0x8')]=function(_0x5db098,_0x144451){return function(_0x511688){try{var _0x56da2a={'body':utils[_0x8b6b('0x9')](_0x144451[0x0],this),'ContactId':this[_0x8b6b('0xa')]['id']};if(this[_0x8b6b('0xb')]===_0x8b6b('0xc')){_0x56da2a[_0x8b6b('0xd')]=this[_0x8b6b('0xe')]['id'];}else{_0x56da2a[_[_0x8b6b('0xf')](this[_0x8b6b('0xb')])+'AccountId']=this['account']['id'];}_0x56da2a[_['upperFirst'](this[_0x8b6b('0xb')])+_0x8b6b('0x10')]=this[_0x8b6b('0x11')]['id'];if(rpc[this['channel']+_0x8b6b('0x12')]){return rpc[this[_0x8b6b('0xb')]+'Message'][_0x8b6b('0x13')](_0x56da2a)['then'](function(_0x2674e3){logger[_0x8b6b('0x14')]('[%s][MESSAGE]\x20%s',_0x5db098,_0x56da2a['body']);_0x511688[_0x8b6b('0x15')]();})['catch'](function(_0x352c14){logger[_0x8b6b('0x16')](_0x8b6b('0x17'),_0x5db098,JSON[_0x8b6b('0x18')](_0x352c14));_0x511688[_0x8b6b('0x19')]();});}}catch(_0x532da5){logger[_0x8b6b('0x16')](_0x8b6b('0x17'),_0x5db098,JSON[_0x8b6b('0x18')](_0x532da5));_0x511688[_0x8b6b('0x19')]();}};}; \ No newline at end of file +var _0xe605=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','account','upperFirst','channel','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stop','lodash','./utils','routing','../../rpc/chatMessage'];(function(_0x227c18,_0x110a45){var _0x41f2bc=function(_0x19a381){while(--_0x19a381){_0x227c18['push'](_0x227c18['shift']());}};_0x41f2bc(++_0x110a45);}(_0xe605,0x92));var _0x5e60=function(_0x3fe28e,_0x10f172){_0x3fe28e=_0x3fe28e-0x0;var _0x294327=_0xe605[_0x3fe28e];return _0x294327;};'use strict';var _=require(_0x5e60('0x0'));var utils=require(_0x5e60('0x1'));var logger=require('../../../../config/logger')(_0x5e60('0x2'));var rpc={'chatMessage':require(_0x5e60('0x3')),'openchannelMessage':require(_0x5e60('0x4')),'mailMessage':require(_0x5e60('0x5')),'smsMessage':require(_0x5e60('0x6')),'faxMessage':require(_0x5e60('0x7')),'whatsappMessage':require(_0x5e60('0x8'))};exports[_0x5e60('0x9')]=function(_0x297ab2,_0xc41535){return function(_0x1d4a08){try{var _0x168a14={'body':utils['getMustacheRender'](_0xc41535[0x0],this),'ContactId':this[_0x5e60('0xa')]['id']};if(this['channel']==='chat'){_0x168a14['ChatWebsiteId']=this[_0x5e60('0xb')]['id'];}else{_0x168a14[_[_0x5e60('0xc')](this[_0x5e60('0xd')])+_0x5e60('0xe')]=this[_0x5e60('0xb')]['id'];}_0x168a14[_[_0x5e60('0xc')](this['channel'])+_0x5e60('0xf')]=this['interaction']['id'];if(rpc[this[_0x5e60('0xd')]+_0x5e60('0x10')]){return rpc[this[_0x5e60('0xd')]+'Message'][_0x5e60('0x11')](_0x168a14)[_0x5e60('0x12')](function(_0x1f4e14){logger[_0x5e60('0x13')](_0x5e60('0x14'),_0x297ab2,_0x168a14[_0x5e60('0x15')]);_0x1d4a08['next']();})[_0x5e60('0x16')](function(_0x45304f){logger[_0x5e60('0x17')](_0x5e60('0x14'),_0x297ab2,JSON['stringify'](_0x45304f));_0x1d4a08[_0x5e60('0x18')]();});}}catch(_0x529ffe){logger[_0x5e60('0x17')](_0x5e60('0x14'),_0x297ab2,JSON['stringify'](_0x529ffe));_0x1d4a08[_0x5e60('0x18')]();}};}; \ 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 ca20691..3a9ca26 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 _0x83ff=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s'];(function(_0x3d9b4d,_0x581243){var _0x2b579c=function(_0x271a7a){while(--_0x271a7a){_0x3d9b4d['push'](_0x3d9b4d['shift']());}};_0x2b579c(++_0x581243);}(_0x83ff,0x17f));var _0xf83f=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x83ff[_0x5d80de];return _0x1c7556;};'use strict';var utils=require('./utils');var logger=require(_0xf83f('0x0'))(_0xf83f('0x1'));exports[_0xf83f('0x2')]=function(_0x19edff,_0x143ca6){return function(_0x86ad00){try{logger['info'](_0xf83f('0x3'),_0x19edff,utils[_0xf83f('0x4')](_0x143ca6[0x0],this));_0x86ad00[_0xf83f('0x5')]();}catch(_0x490235){logger[_0xf83f('0x6')](_0xf83f('0x3'),_0x19edff,JSON[_0xf83f('0x7')](_0x490235));_0x86ad00[_0xf83f('0x8')]();}};}; \ No newline at end of file +var _0x1b28=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','error','stringify','stop'];(function(_0x29119c,_0x284ee8){var _0x3e540d=function(_0x206834){while(--_0x206834){_0x29119c['push'](_0x29119c['shift']());}};_0x3e540d(++_0x284ee8);}(_0x1b28,0x14d));var _0x81b2=function(_0x555d7f,_0x2a1027){_0x555d7f=_0x555d7f-0x0;var _0x3f8dee=_0x1b28[_0x555d7f];return _0x3f8dee;};'use strict';var utils=require(_0x81b2('0x0'));var logger=require(_0x81b2('0x1'))(_0x81b2('0x2'));exports[_0x81b2('0x3')]=function(_0x2b6491,_0xfe3d45){return function(_0x553754){try{logger[_0x81b2('0x4')](_0x81b2('0x5'),_0x2b6491,utils['getMustacheRender'](_0xfe3d45[0x0],this));_0x553754['next']();}catch(_0x1048e1){logger[_0x81b2('0x6')](_0x81b2('0x5'),_0x2b6491,JSON[_0x81b2('0x7')](_0x1048e1));_0x553754[_0x81b2('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 0639159..c26f4f9 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 _0xf822=['contact','list','upperFirst','interaction','MessageId','message','channel','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','accepted','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','end','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','emit','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x39c0aa,_0x40fecc){var _0x420864=function(_0x2dacc4){while(--_0x2dacc4){_0x39c0aa['push'](_0x39c0aa['shift']());}};_0x420864(++_0x40fecc);}(_0xf822,0xc3));var _0x2f82=function(_0x2f50b9,_0x31a19e){_0x2f50b9=_0x2f50b9-0x0;var _0xac1a3c=_0xf822[_0x2f50b9];return _0xac1a3c;};'use strict';var schema=require(_0x2f82('0x0'));var _=require(_0x2f82('0x1'));var util=require('util');var seqqueue=require(_0x2f82('0x2'));var moment=require(_0x2f82('0x3'));var Redis=require(_0x2f82('0x4'));var config=require(_0x2f82('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config['redis']=_[_0x2f82('0x6')](config[_0x2f82('0x7')],{'host':_0x2f82('0x8'),'port':0x18eb});var io=require(_0x2f82('0x9'))(new Redis(config[_0x2f82('0x7')]));var attributes=['id',_0x2f82('0xa'),_0x2f82('0xb'),_0x2f82('0xc'),_0x2f82('0xd'),'joinAt'];function emit(_0x29d74a,_0x3bfd35,_0xaf6727){io['to'](_0x29d74a)[_0x2f82('0xe')](_0x3bfd35,_0xaf6727);}function emitChannelQueueInteraction(_0xd9941,_0x34c4b9,_0x7ad799,_0x20927f,_0x38759f,_0x4a459d,_0x8e9263,_0x22e24c){var _0x5f3116=_['clone'](_0x7ad799);_0x5f3116[_0x2f82('0xa')]=_0x22e24c;_0x5f3116[_0x2f82('0xc')]=_0x34c4b9;_0x5f3116[_0x2f82('0xb')]=_0x20927f;_0x5f3116['id']=_0x38759f;if(_0x4a459d){attributes['push'](_['capitalize'](_0xd9941)+_0x2f82('0xf'));_0x8e9263[util[_0x2f82('0x10')](_0x2f82('0x11'),_0xd9941)][_0x38759f]=_['pick'](_0x5f3116,attributes);}else{delete _0x8e9263[util[_0x2f82('0x10')](_0x2f82('0x11'),_0xd9941)][_0x38759f];}emit(util[_0x2f82('0x10')](_0x2f82('0x12'),_0xd9941,_0x34c4b9),util[_0x2f82('0x10')](_0x2f82('0x13'),_0xd9941,_0x4a459d?_0x2f82('0x14'):_0x2f82('0x15')),_['pick'](_0x5f3116,attributes));}var rpc={'openchannelQueueReport':require(_0x2f82('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2f82('0x17')),'smsQueueReport':require(_0x2f82('0x18')),'faxQueueReport':require(_0x2f82('0x19')),'whatsappQueueReport':require(_0x2f82('0x1a'))};var queue=schema({'name':{'type':_0x2f82('0x1b'),'required':!![],'message':_0x2f82('0x1c')},'timeout':{'type':_0x2f82('0x1d'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x15fae5,_0x50ceaa,_0x5a0975,_0x7e9815){if(_0x15fae5&&_0x50ceaa&&_0x5a0975){_0x50ceaa[_0x2f82('0x1e')]+=0x1;var _0x22ea06={'uniqueid':_0x15fae5,'from':_0x5a0975[_0x2f82('0x1f')]?_0x5a0975[_0x2f82('0x1f')][_0x2f82('0xd')]:'','joinAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'ContactId':_0x5a0975['contact']?_0x5a0975[_0x2f82('0x21')]['id']:null,'ListId':_0x5a0975[_0x2f82('0x22')]?_0x5a0975[_0x2f82('0x22')]['id']:null};_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+'QueueId']=_0x50ceaa['id']||null;_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+_0x2f82('0xf')]=_0x5a0975[_0x2f82('0x24')]?_0x5a0975[_0x2f82('0x24')]['id']:null;_0x22ea06[_[_0x2f82('0x23')](_0x5a0975['channel'])+_0x2f82('0x25')]=_0x5a0975[_0x2f82('0x26')]?_0x5a0975[_0x2f82('0x26')]['id']:null;_0x22ea06[_['upperFirst'](_0x5a0975[_0x2f82('0x27')])+(_0x5a0975[_0x2f82('0x27')]!==_0x2f82('0x28')?_0x2f82('0x29'):_0x2f82('0x2a'))]=_0x5a0975['account']?_0x5a0975[_0x2f82('0xb')]['id']:null;logger[_0x2f82('0x2b')](util[_0x2f82('0x10')](_0x2f82('0x2c'),_0x15fae5,_0x50ceaa['name']));emitChannelQueueInteraction(_0x5a0975[_0x2f82('0x27')],_0x50ceaa[_0x2f82('0x2d')],_0x22ea06,_0x5a0975[_0x2f82('0xb')]['name'],_0x5a0975[_0x2f82('0x26')]['id'],!![],_0x7e9815,_0x50ceaa['id']);if(rpc[_0x5a0975[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x5a0975[_0x2f82('0x27')]+_0x2f82('0x2e')]['create'](_0x22ea06)['catch'](function(_0x2d6a7a){logger[_0x2f82('0x2f')](_0x2f82('0x30'));});}}}function stopRouting(_0x370699,_0x2c10b2,_0x1d93d6,_0x4b9666){if(_0x370699&&_0x2c10b2){_0x2c10b2[_0x2f82('0x1e')]-=0x1;var _0x488d83={'leaveAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'acceptAt':moment()[_0x2f82('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2f82('0x31')};logger['info'](util[_0x2f82('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x370699,_0x2c10b2[_0x2f82('0x2d')]));emitChannelQueueInteraction(_0x1d93d6[_0x2f82('0x27')],_0x2c10b2[_0x2f82('0x2d')],_0x1d93d6[_0x2f82('0x1f')],_0x1d93d6[_0x2f82('0xb')][_0x2f82('0x2d')],_0x1d93d6[_0x2f82('0x26')]['id'],![],_0x4b9666,_0x2c10b2['id']);if(rpc[_0x1d93d6[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x1d93d6[_0x2f82('0x27')]+_0x2f82('0x2e')][_0x2f82('0x32')](_0x370699,_0x488d83)[_0x2f82('0x33')](function(_0x3c9dc9){logger[_0x2f82('0x2f')](_0x2f82('0x34'));});}}}function endRouting(_0x3e658b,_0x114b66,_0x341aac,_0xa941e8){if(_0x3e658b&&_0x114b66){_0x114b66[_0x2f82('0x1e')]-=0x1;var _0x1aef0f={'leaveAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'exitAt':moment()[_0x2f82('0x10')](_0x2f82('0x20')),'reason':_0x2f82('0x35')};logger[_0x2f82('0x2b')](util['format'](_0x2f82('0x36'),_0x3e658b,_0x114b66[_0x2f82('0x2d')]));emitChannelQueueInteraction(_0x341aac[_0x2f82('0x27')],_0x114b66[_0x2f82('0x2d')],_0x341aac[_0x2f82('0x1f')],_0x341aac[_0x2f82('0xb')]['name'],_0x341aac[_0x2f82('0x26')]['id'],![],_0xa941e8);if(rpc[_0x341aac[_0x2f82('0x27')]+_0x2f82('0x2e')]){return rpc[_0x341aac[_0x2f82('0x27')]+'QueueReport'][_0x2f82('0x32')](_0x3e658b,_0x1aef0f)[_0x2f82('0x33')](function(_0x514960){logger[_0x2f82('0x2f')](_0x2f82('0x34'));});}}}function handleFindQueue(_0x413f4c){return function(_0x459cbd){return _0x459cbd[_0x2f82('0x2d')][_0x2f82('0x37')]()===_0x413f4c[_0x2f82('0x37')]();};}exports[_0x2f82('0x38')]=function(_0x5d1252,_0x2027cb,_0x211778,_0x2c83fc){return function(_0x545eaf){try{var _0x1a454c={'name':_0x2027cb[0x0],'timeout':_0x2027cb[0x1]};var _0x3ea9e4=queue[_0x2f82('0x0')](_0x1a454c,{'typecast':!![]});if(_0x3ea9e4[_0x2f82('0x39')]){logger[_0x2f82('0x2f')](_0x2f82('0x3a'),_0x5d1252,_[_0x2f82('0x3b')](_0x3ea9e4,'message')['join'](',\x20'));_0x545eaf[_0x2f82('0x3c')]();}else{var _0x40771b=_['find'](_0x211778[_0x2c83fc[_0x2f82('0x27')]+_0x2f82('0x3d')],handleFindQueue(_0x1a454c[_0x2f82('0x2d')]));if(_0x40771b){startRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);var _0x41528d=(_0x40771b[_0x2f82('0x35')]||0xa)*0x3e8;var _0xed0c68=(_0x1a454c[_0x2f82('0x35')]||0x14)*0x3e8;var _0x37f675;if(_0x41528d>_0xed0c68){_0xed0c68=_0x41528d;}var _0x36b9d6=seqqueue[_0x2f82('0x3e')](_0x41528d);_0x36b9d6['id']=_0x5d1252;_0x36b9d6[_0x2f82('0x3f')]=_0x41528d;_0x36b9d6['qtimeout']=_0xed0c68;_0x36b9d6[_0x2f82('0x27')]=_0x2c83fc[_0x2f82('0x27')];_0x211778['rules'][_0x5d1252]['on'](_0x2f82('0x40'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5d1252);stopRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);clearTimeout(_0x37f675);_0x37f675=undefined;_0x36b9d6[_0x2f82('0x41')](!![]);if(_0x211778[_0x2f82('0x42')][_0x5d1252]){delete _0x211778[_0x2f82('0x42')][_0x5d1252];}_0x545eaf[_0x2f82('0x3c')]();});_0x211778[_0x2f82('0x42')][_0x5d1252]['on'](_0x2f82('0x43'),function(){if(_0x211778[_0x2f82('0x42')][_0x5d1252]){delete _0x211778[_0x2f82('0x42')][_0x5d1252];}});_0x37f675=setTimeout(function(){logger[_0x2f82('0x2b')](_0x2f82('0x44'),_0x5d1252);endRouting(_0x5d1252,_0x40771b,_0x2c83fc,_0x211778);clearTimeout(_0x37f675);_0x36b9d6[_0x2f82('0x41')](!![]);_0x545eaf[_0x2f82('0x45')]();},_0xed0c68);switch(_0x40771b[_0x2f82('0x46')]){case _0x2f82('0x47'):strategy[_0x2f82('0x47')](_0x36b9d6,_0x40771b,_0x211778,_0x2c83fc);break;default:strategy[_0x2f82('0x48')](_0x36b9d6,_0x40771b,_0x211778,_0x2c83fc);}}else{logger[_0x2f82('0x2f')](_0x2f82('0x49'),_0x5d1252,_0x1a454c['name']);_0x545eaf['stop']();}}}catch(_0x4de2c6){console[_0x2f82('0x4a')](_0x4de2c6);logger[_0x2f82('0x2f')](_0x2f82('0x3a'),_0x5d1252,_0x4de2c6[_0x2f82('0x4b')]);_0x545eaf[_0x2f82('0x3c')]();}};}; \ No newline at end of file +var _0xa380=['qtimeout','end','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','socket.io-emitter','queue_id','queue','joinAt','emit','clone','account','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout'];(function(_0x5880a8,_0x5b1dca){var _0x1578f2=function(_0x23b3d7){while(--_0x23b3d7){_0x5880a8['push'](_0x5880a8['shift']());}};_0x1578f2(++_0x5b1dca);}(_0xa380,0xe6));var _0x0a38=function(_0x30e3f7,_0x116f32){_0x30e3f7=_0x30e3f7-0x0;var _0x3f63fb=_0xa380[_0x30e3f7];return _0x3f63fb;};'use strict';var schema=require(_0x0a38('0x0'));var _=require(_0x0a38('0x1'));var util=require('util');var seqqueue=require(_0x0a38('0x2'));var moment=require('moment');var Redis=require(_0x0a38('0x3'));var config=require(_0x0a38('0x4'));var logger=require(_0x0a38('0x5'))(_0x0a38('0x6'));var strategy=require('./strategy');config[_0x0a38('0x7')]=_['defaults'](config[_0x0a38('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0a38('0x8'))(new Redis(config[_0x0a38('0x7')]));var attributes=['id',_0x0a38('0x9'),'account',_0x0a38('0xa'),'from',_0x0a38('0xb')];function emit(_0x5bc1ef,_0x2e5d6d,_0x4a7623){io['to'](_0x5bc1ef)[_0x0a38('0xc')](_0x2e5d6d,_0x4a7623);}function emitChannelQueueInteraction(_0x46fd4a,_0x440eb4,_0x5be29b,_0x2ac804,_0x21e72b,_0x583203,_0x156726,_0x1d2e25){var _0x10a619=_[_0x0a38('0xd')](_0x5be29b);_0x10a619[_0x0a38('0x9')]=_0x1d2e25;_0x10a619[_0x0a38('0xa')]=_0x440eb4;_0x10a619[_0x0a38('0xe')]=_0x2ac804;_0x10a619['id']=_0x21e72b;if(_0x583203){attributes['push'](_[_0x0a38('0xf')](_0x46fd4a)+_0x0a38('0x10'));_0x156726[util['format'](_0x0a38('0x11'),_0x46fd4a)][_0x21e72b]=_[_0x0a38('0x12')](_0x10a619,attributes);}else{delete _0x156726[util[_0x0a38('0x13')](_0x0a38('0x11'),_0x46fd4a)][_0x21e72b];}emit(util[_0x0a38('0x13')]('%s:queue:%s',_0x46fd4a,_0x440eb4),util[_0x0a38('0x13')]('%s_queue_waiting_interaction:%s',_0x46fd4a,_0x583203?'save':'remove'),_[_0x0a38('0x12')](_0x10a619,attributes));}var rpc={'openchannelQueueReport':require(_0x0a38('0x14')),'mailQueueReport':require(_0x0a38('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x0a38('0x16')),'whatsappQueueReport':require(_0x0a38('0x17'))};var queue=schema({'name':{'type':_0x0a38('0x18'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0a38('0x19'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x56cfdc,_0x2463f0,_0x3c9c2b,_0xd706df){if(_0x56cfdc&&_0x2463f0&&_0x3c9c2b){_0x2463f0[_0x0a38('0x1a')]+=0x1;var _0x2927c1={'uniqueid':_0x56cfdc,'from':_0x3c9c2b[_0x0a38('0x1b')]?_0x3c9c2b[_0x0a38('0x1b')][_0x0a38('0x1c')]:'','joinAt':moment()[_0x0a38('0x13')](_0x0a38('0x1d')),'ContactId':_0x3c9c2b[_0x0a38('0x1e')]?_0x3c9c2b[_0x0a38('0x1e')]['id']:null,'ListId':_0x3c9c2b[_0x0a38('0x1f')]?_0x3c9c2b['list']['id']:null};_0x2927c1[_['upperFirst'](_0x3c9c2b['channel'])+_0x0a38('0x20')]=_0x2463f0['id']||null;_0x2927c1[_[_0x0a38('0x21')](_0x3c9c2b[_0x0a38('0x22')])+'InteractionId']=_0x3c9c2b['interaction']?_0x3c9c2b[_0x0a38('0x23')]['id']:null;_0x2927c1[_['upperFirst'](_0x3c9c2b['channel'])+_0x0a38('0x24')]=_0x3c9c2b[_0x0a38('0x25')]?_0x3c9c2b[_0x0a38('0x25')]['id']:null;_0x2927c1[_['upperFirst'](_0x3c9c2b[_0x0a38('0x22')])+(_0x3c9c2b[_0x0a38('0x22')]!==_0x0a38('0x26')?_0x0a38('0x27'):_0x0a38('0x28'))]=_0x3c9c2b[_0x0a38('0xe')]?_0x3c9c2b[_0x0a38('0xe')]['id']:null;logger[_0x0a38('0x29')](util['format'](_0x0a38('0x2a'),_0x56cfdc,_0x2463f0[_0x0a38('0x2b')]));emitChannelQueueInteraction(_0x3c9c2b['channel'],_0x2463f0[_0x0a38('0x2b')],_0x2927c1,_0x3c9c2b[_0x0a38('0xe')][_0x0a38('0x2b')],_0x3c9c2b[_0x0a38('0x25')]['id'],!![],_0xd706df,_0x2463f0['id']);if(rpc[_0x3c9c2b[_0x0a38('0x22')]+'QueueReport']){return rpc[_0x3c9c2b['channel']+_0x0a38('0x2c')]['create'](_0x2927c1)['catch'](function(_0x2b4b2e){logger[_0x0a38('0x2d')](_0x0a38('0x2e'));});}}}function stopRouting(_0x57f550,_0x5d53c5,_0x418bdc,_0x1b9c16){if(_0x57f550&&_0x5d53c5){_0x5d53c5[_0x0a38('0x1a')]-=0x1;var _0x4c23fa={'leaveAt':moment()[_0x0a38('0x13')](_0x0a38('0x1d')),'acceptAt':moment()[_0x0a38('0x13')](_0x0a38('0x1d')),'reason':'accepted'};logger[_0x0a38('0x29')](util[_0x0a38('0x13')](_0x0a38('0x2f'),_0x57f550,_0x5d53c5[_0x0a38('0x2b')]));emitChannelQueueInteraction(_0x418bdc[_0x0a38('0x22')],_0x5d53c5['name'],_0x418bdc[_0x0a38('0x1b')],_0x418bdc[_0x0a38('0xe')][_0x0a38('0x2b')],_0x418bdc[_0x0a38('0x25')]['id'],![],_0x1b9c16,_0x5d53c5['id']);if(rpc[_0x418bdc[_0x0a38('0x22')]+_0x0a38('0x2c')]){return rpc[_0x418bdc['channel']+_0x0a38('0x2c')][_0x0a38('0x30')](_0x57f550,_0x4c23fa)['catch'](function(_0x4be95e){logger[_0x0a38('0x2d')](_0x0a38('0x31'));});}}}function endRouting(_0x13fd20,_0x315f83,_0x9c2596,_0x5e8e44){if(_0x13fd20&&_0x315f83){_0x315f83[_0x0a38('0x1a')]-=0x1;var _0xb0b30c={'leaveAt':moment()['format'](_0x0a38('0x1d')),'exitAt':moment()[_0x0a38('0x13')](_0x0a38('0x1d')),'reason':_0x0a38('0x32')};logger[_0x0a38('0x29')](util[_0x0a38('0x13')](_0x0a38('0x33'),_0x13fd20,_0x315f83[_0x0a38('0x2b')]));emitChannelQueueInteraction(_0x9c2596['channel'],_0x315f83[_0x0a38('0x2b')],_0x9c2596[_0x0a38('0x1b')],_0x9c2596[_0x0a38('0xe')][_0x0a38('0x2b')],_0x9c2596[_0x0a38('0x25')]['id'],![],_0x5e8e44);if(rpc[_0x9c2596[_0x0a38('0x22')]+'QueueReport']){return rpc[_0x9c2596[_0x0a38('0x22')]+_0x0a38('0x2c')][_0x0a38('0x30')](_0x13fd20,_0xb0b30c)[_0x0a38('0x34')](function(_0x190d18){logger[_0x0a38('0x2d')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x55c269){return function(_0x3792d6){return _0x3792d6['name']['toLowerCase']()===_0x55c269[_0x0a38('0x35')]();};}exports['consequence']=function(_0x14c24c,_0x163ba3,_0x242610,_0x430a53){return function(_0x26d9da){try{var _0x3b96f2={'name':_0x163ba3[0x0],'timeout':_0x163ba3[0x1]};var _0x2bc2c6=queue[_0x0a38('0x0')](_0x3b96f2,{'typecast':!![]});if(_0x2bc2c6[_0x0a38('0x36')]){logger['error'](_0x0a38('0x37'),_0x14c24c,_['map'](_0x2bc2c6,_0x0a38('0x25'))[_0x0a38('0x38')](',\x20'));_0x26d9da[_0x0a38('0x39')]();}else{var _0x1f01ac=_[_0x0a38('0x3a')](_0x242610[_0x430a53[_0x0a38('0x22')]+_0x0a38('0x3b')],handleFindQueue(_0x3b96f2[_0x0a38('0x2b')]));if(_0x1f01ac){startRouting(_0x14c24c,_0x1f01ac,_0x430a53,_0x242610);var _0x131104=(_0x1f01ac[_0x0a38('0x32')]||0xa)*0x3e8;var _0x4c84d0=(_0x3b96f2[_0x0a38('0x32')]||0x14)*0x3e8;var _0x4e5111;if(_0x131104>_0x4c84d0){_0x4c84d0=_0x131104;}var _0x4310e0=seqqueue[_0x0a38('0x3c')](_0x131104);_0x4310e0['id']=_0x14c24c;_0x4310e0[_0x0a38('0x3d')]=_0x131104;_0x4310e0[_0x0a38('0x3e')]=_0x4c84d0;_0x4310e0['channel']=_0x430a53[_0x0a38('0x22')];_0x242610['rules'][_0x14c24c]['on'](_0x0a38('0x3f'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x14c24c);stopRouting(_0x14c24c,_0x1f01ac,_0x430a53,_0x242610);clearTimeout(_0x4e5111);_0x4e5111=undefined;_0x4310e0[_0x0a38('0x40')](!![]);if(_0x242610['rules'][_0x14c24c]){delete _0x242610['rules'][_0x14c24c];}_0x26d9da[_0x0a38('0x39')]();});_0x242610[_0x0a38('0x41')][_0x14c24c]['on']('complete',function(){if(_0x242610['rules'][_0x14c24c]){delete _0x242610['rules'][_0x14c24c];}});_0x4e5111=setTimeout(function(){logger[_0x0a38('0x29')](_0x0a38('0x42'),_0x14c24c);endRouting(_0x14c24c,_0x1f01ac,_0x430a53,_0x242610);clearTimeout(_0x4e5111);_0x4310e0[_0x0a38('0x40')](!![]);_0x26d9da[_0x0a38('0x43')]();},_0x4c84d0);switch(_0x1f01ac[_0x0a38('0x44')]){case _0x0a38('0x45'):strategy[_0x0a38('0x45')](_0x4310e0,_0x1f01ac,_0x242610,_0x430a53);break;default:strategy[_0x0a38('0x46')](_0x4310e0,_0x1f01ac,_0x242610,_0x430a53);}}else{logger['error'](_0x0a38('0x47'),_0x14c24c,_0x3b96f2[_0x0a38('0x2b')]);_0x26d9da[_0x0a38('0x39')]();}}}catch(_0x28d354){console['log'](_0x28d354);logger['error']('[%s][QUEUE]\x20%s',_0x14c24c,_0x28d354[_0x0a38('0x48')]);_0x26d9da['stop']();}};}; \ 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 73d0fc1..7e33928 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 _0x5089=['uuid','../../../../../config/logger','routing','notificationId','agent','realtime','push','handleRun','handleTimeout','bind','timeout','squeue','drained','handleDrained','prototype','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','lodash'];(function(_0x4df66f,_0xb81bc9){var _0x45ddcb=function(_0x4c4f94){while(--_0x4c4f94){_0x4df66f['push'](_0x4df66f['shift']());}};_0x45ddcb(++_0xb81bc9);}(_0x5089,0x1bb));var _0x9508=function(_0x29a29f,_0x155ce7){_0x29a29f=_0x29a29f-0x0;var _0x443ea3=_0x5089[_0x29a29f];return _0x443ea3;};'use strict';var _=require(_0x9508('0x0'));var uuid=require(_0x9508('0x1'));var util=require('./util');var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var Agent=function(_0x7dd13d,_0x100d7e,_0x172549,_0x59d3ee){this[_0x9508('0x4')]=uuid['v4']();this['squeue']=_0x7dd13d;this[_0x9508('0x5')]=_0x100d7e;this[_0x9508('0x6')]=_0x172549;this[_0x9508('0x3')]=_0x59d3ee;this['squeue'][_0x9508('0x7')](this[_0x9508('0x8')]['bind'](this),this[_0x9508('0x9')][_0x9508('0xa')](this));this['squeue']['on'](_0x9508('0xb'),this['handleTimeout'][_0x9508('0xa')](this));this[_0x9508('0xc')]['on'](_0x9508('0xd'),this[_0x9508('0xe')][_0x9508('0xa')](this));};Agent[_0x9508('0xf')]['push']=function(){this[_0x9508('0xc')]['push'](this[_0x9508('0x8')][_0x9508('0xa')](this),this['handleTimeout'][_0x9508('0xa')](this));};Agent[_0x9508('0xf')][_0x9508('0xe')]=function(){this[_0x9508('0x9')](!![]);};Agent['prototype'][_0x9508('0x8')]=function(){logger[_0x9508('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x9508('0xc')]['id'],this['agent']['id']);if(_[_0x9508('0x11')](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){logger[_0x9508('0x10')](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this['push'][_0x9508('0xa')](this),0x3e8);}else{if(this[_0x9508('0x3')][_0x9508('0x14')]||util[_0x9508('0x15')](this[_0x9508('0xc')]['id'],this[_0x9508('0x6')]['agents'][this['agent']['id']],this[_0x9508('0xc')]['channel'],![])){this[_0x9508('0x6')]['agents'][this[_0x9508('0x5')]['id']][_0x9508('0x16')]=!![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x18')](this['realtime'],this['routing'],this[_0x9508('0x5')],this[_0x9508('0xc')][_0x9508('0x19')]);util[_0x9508('0x1a')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this['routing']);util['writeLog'](this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],_0x9508('0x1b')+(this['routing'][_0x9508('0x14')]?_0x9508('0x1c'):''));}else{logger[_0x9508('0x10')](_0x9508('0x1d'),this[_0x9508('0xc')]['id'],this[_0x9508('0x5')]['id']);setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}}};Agent[_0x9508('0xf')][_0x9508('0x9')]=function(_0x19a984){if(_['isNil'](this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']])){return logger['debug'](_0x9508('0x13'),this[_0x9508('0xc')]['id'],this['agent']['id']);}else{logger[_0x9508('0x10')](_0x9508('0x1e'),this['squeue']['id'],this[_0x9508('0x5')]['id']);util[_0x9508('0x1f')](this[_0x9508('0x4')],this[_0x9508('0xc')]['id'],this['realtime']['agents'][this[_0x9508('0x5')]['id']],null,this[_0x9508('0x3')]);this[_0x9508('0x6')]['agents'][this['agent']['id']][_0x9508('0x16')]=![];this[_0x9508('0x6')][_0x9508('0x12')][this[_0x9508('0x5')]['id']][_0x9508('0x17')]=undefined;util[_0x9508('0x20')](this[_0x9508('0x6')],this[_0x9508('0x3')],this[_0x9508('0x5')],this[_0x9508('0xc')]['channel']);util[_0x9508('0x21')](this[_0x9508('0xc')]['id'],this['realtime'][_0x9508('0x12')][this[_0x9508('0x5')]['id']],_0x19a984?_0x9508('0x22'):_0x9508('0x23'));}if(!_0x19a984){setTimeout(this[_0x9508('0x7')][_0x9508('0xa')](this),0x3e8);}};function agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75){return new Agent(_0x33e17c,_0x3700f1,_0xfb6676,_0x98ff75);}module[_0x9508('0x24')]=agent; \ No newline at end of file +var _0xbec5=['bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun'];(function(_0x3dcf21,_0x572c92){var _0x24a091=function(_0x440986){while(--_0x440986){_0x3dcf21['push'](_0x3dcf21['shift']());}};_0x24a091(++_0x572c92);}(_0xbec5,0xe5));var _0x5bec=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xbec5[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x5bec('0x0'));var uuid=require(_0x5bec('0x1'));var util=require('./util');var logger=require(_0x5bec('0x2'))(_0x5bec('0x3'));var Agent=function(_0x276b9e,_0x3859a1,_0x244027,_0x4ee982){this[_0x5bec('0x4')]=uuid['v4']();this[_0x5bec('0x5')]=_0x276b9e;this[_0x5bec('0x6')]=_0x3859a1;this['realtime']=_0x244027;this[_0x5bec('0x3')]=_0x4ee982;this[_0x5bec('0x5')][_0x5bec('0x7')](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this[_0x5bec('0xa')][_0x5bec('0x9')](this));this[_0x5bec('0x5')]['on']('timeout',this[_0x5bec('0xa')]['bind'](this));this[_0x5bec('0x5')]['on'](_0x5bec('0xb'),this[_0x5bec('0xc')]['bind'](this));};Agent[_0x5bec('0xd')][_0x5bec('0x7')]=function(){this[_0x5bec('0x5')]['push'](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this['handleTimeout'][_0x5bec('0x9')](this));};Agent[_0x5bec('0xd')][_0x5bec('0xc')]=function(){this[_0x5bec('0xa')](!![]);};Agent[_0x5bec('0xd')][_0x5bec('0x8')]=function(){logger[_0x5bec('0xe')](_0x5bec('0xf'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']])){logger['debug'](_0x5bec('0x13'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}else{if(this['routing'][_0x5bec('0x14')]||util[_0x5bec('0x15')](this['squeue']['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],this[_0x5bec('0x5')]['channel'],![])){this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x16')]=!![];this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']]['busyQueue']=undefined;util[_0x5bec('0x17')](this['realtime'],this[_0x5bec('0x3')],this[_0x5bec('0x6')],this['squeue'][_0x5bec('0x18')]);util[_0x5bec('0x19')](this['notificationId'],this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],null,this[_0x5bec('0x3')]);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],_0x5bec('0x1b')+(this[_0x5bec('0x3')][_0x5bec('0x14')]?':FORCED':''));}else{logger[_0x5bec('0xe')](_0x5bec('0x1c'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x5bec('0xa')]=function(_0x2a82d5){if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']])){return logger['debug'](_0x5bec('0x13'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);}else{logger[_0x5bec('0xe')](_0x5bec('0x1d'),this[_0x5bec('0x5')]['id'],this['agent']['id']);util[_0x5bec('0x1e')](this[_0x5bec('0x4')],this[_0x5bec('0x5')]['id'],this['realtime'][_0x5bec('0x12')][this['agent']['id']],null,this[_0x5bec('0x3')]);this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']][_0x5bec('0x16')]=![];this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x1f')]=undefined;util[_0x5bec('0x20')](this[_0x5bec('0x11')],this[_0x5bec('0x3')],this['agent'],this[_0x5bec('0x5')]['channel']);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],_0x2a82d5?_0x5bec('0x21'):'TIMEOUT');}if(!_0x2a82d5){setTimeout(this[_0x5bec('0x7')][_0x5bec('0x9')](this),0x3e8);}};function agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707){return new Agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 90c3aac..f4ec7b4 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 _0x1854=['agents','debug','isAgentAvailable','channel','writeLog','RINGING','busy','saveWaitingNotification','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busyQueue','removeWaitingNotification','exports','lodash','uuid','./util','notificationId','queue','realtime','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length'];(function(_0x2ef7b2,_0x5ed01d){var _0x2f5cf5=function(_0x5635a0){while(--_0x5635a0){_0x2ef7b2['push'](_0x2ef7b2['shift']());}};_0x2f5cf5(++_0x5ed01d);}(_0x1854,0xfe));var _0x4185=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0x1854[_0x3011b7];return _0x304ca2;};'use strict';var _=require(_0x4185('0x0'));var uuid=require(_0x4185('0x1'));var util=require(_0x4185('0x2'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x17c5eb,_0x331407,_0x258357,_0x817389){this[_0x4185('0x3')]=uuid['v4']();this['squeue']=_0x17c5eb;this[_0x4185('0x4')]=_0x331407;this[_0x4185('0x5')]=_0x258357;this['routing']=_0x817389;this[_0x4185('0x6')][_0x4185('0x7')](this[_0x4185('0x8')][_0x4185('0x9')](this),this['handleTimeout'][_0x4185('0x9')](this));this[_0x4185('0x6')]['on'](_0x4185('0xa'),this[_0x4185('0xb')]['bind'](this));this[_0x4185('0x6')]['on'](_0x4185('0xc'),this[_0x4185('0xd')][_0x4185('0x9')](this));};Beepall['prototype'][_0x4185('0x7')]=function(){this[_0x4185('0x6')][_0x4185('0x7')](this[_0x4185('0x8')][_0x4185('0x9')](this),this[_0x4185('0xb')][_0x4185('0x9')](this));};Beepall[_0x4185('0xe')][_0x4185('0xd')]=function(){this[_0x4185('0xb')](!![]);};Beepall['prototype'][_0x4185('0x8')]=function(){var _0x382f11=!![];if(!_[_0x4185('0xf')](this[_0x4185('0x4')])&&!_[_0x4185('0xf')](this[_0x4185('0x4')][_0x4185('0x10')])&&this['queue'][_0x4185('0x10')][_0x4185('0x11')]>0x0){for(var _0x7e2f39=0x0,_0x69981b;_0x7e2f390x0){for(var _0x367965=0x0,_0x3b3e2e;_0x3679650x0&&_0x5e9607[_0x2cdffe+_0x6fa6('0x24')]>=_0x5e9607[_0x2cdffe+_0x6fa6('0x23')]){writeLog(_0x8d7e2f,_0x5e9607,_0x2cdffe['toUpperCase']()+_0x6fa6('0x25'));return![];}}return!![];};exports[_0x6fa6('0x26')]=function(_0x29d3bc,_0x1b04eb,_0x27d9be,_0x4ef1f1,_0x256ae8){return sendNotification(!![],_0x29d3bc,_0x1b04eb,_0x27d9be,_0x4ef1f1,_0x256ae8);};exports[_0x6fa6('0x27')]=function(_0xf1b330,_0x50a10b,_0x144038,_0x115fad,_0x538ccc){return sendNotification(![],_0xf1b330,_0x50a10b,_0x144038,_0x115fad,_0x538ccc);};exports[_0x6fa6('0x28')]=function(_0x40ea2e,_0x555f0f,_0x201afb){var _0x470b42=_0x555f0f[_0x6fa6('0x29')]['UserId'];if(!_0x470b42&&_0x201afb){_0x470b42=_0x201afb['id'];}var _0x328c87=_[_0x6fa6('0x2a')](_0x40ea2e[_0x555f0f['channel']+_0x6fa6('0x2b')],function(_0x5c8ecf){var _0x2aeea6=_[_0x6fa6('0x2c')](_0x555f0f['channel'])+_0x6fa6('0x2d');return _0x5c8ecf[_0x2aeea6]===_0x555f0f[_0x6fa6('0x29')]['id'];});if(!_0x328c87&&_0x470b42){_0x328c87=_[_0x6fa6('0x2a')](_0x40ea2e[_0x6fa6('0x2e')][_0x470b42][_0x555f0f['channel']+_0x6fa6('0x2f')],function(_0x22146a){return _0x22146a['id']===_0x555f0f[_0x6fa6('0x29')]['id'];});}return _0x328c87;};exports['saveWaitingNotification']=function(_0x4d07ec,_0x89d9cb,_0x47eb9b,_0x45d4f6){_0x4d07ec['agents'][_0x47eb9b['id']][_0x45d4f6+_0x6fa6('0x2f')][_0x89d9cb[_0x6fa6('0x19')]['id']]={'id':_0x89d9cb['interaction']['id']};};exports[_0x6fa6('0x30')]=function(_0x32fc44,_0x19c745,_0x196530,_0x546779){delete _0x32fc44[_0x6fa6('0x2e')][_0x196530['id']][_0x546779+'WaitingInteractions'][_0x19c745['message']['id']];};exports[_0x6fa6('0x31')]=writeLog; \ No newline at end of file +var _0x44e1=['account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','some','channel','capitalize','InteractionId','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','format','user:%s','name','\x20interaction'];(function(_0xd53c6a,_0x4ba546){var _0x5a015a=function(_0x5303e2){while(--_0x5303e2){_0xd53c6a['push'](_0xd53c6a['shift']());}};_0x5a015a(++_0x4ba546);}(_0x44e1,0x1cb));var _0x144e=function(_0x4242a3,_0x1c7510){_0x4242a3=_0x4242a3-0x0;var _0x5766bb=_0x44e1[_0x4242a3];return _0x5766bb;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x144e('0x0'));var Redis=require('ioredis');var config=require(_0x144e('0x1'));var logger=require(_0x144e('0x2'))(_0x144e('0x3'));config[_0x144e('0x4')]=_[_0x144e('0x5')](config['redis'],{'host':_0x144e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x144e('0x4')]));function sendNotification(_0x1d69ca,_0x4e34d,_0x4b00ba,_0x18aae2,_0x18be07,_0x4a04ae){io['to'](util[_0x144e('0x7')](_0x144e('0x8'),_0x18aae2[_0x144e('0x9')]))['emit']('user:save',_0x18aae2);var _0x190ab6=_0x4a04ae||{};var _0x2b411e=_0x4b00ba['split']('.');var _0x1ca3cb={'uniqueid':_0x4e34d,'channel':_0x2b411e[0x0],'id':_0x2b411e[0x1],'title':_0x2b411e[0x0]+_0x144e('0xa'),'interactionId':_0x2b411e[0x2],'queue':_0x18be07?_0x18be07['name']:null,'sound':_0x190ab6[_0x144e('0xb')][_0x144e('0xc')],'shake':_0x190ab6[_0x144e('0xb')][_0x144e('0xd')]};try{if(!_0x190ab6[_0x144e('0xe')]){_0x190ab6[_0x144e('0xe')]={};}if(_0x18be07){_0x190ab6[_0x144e('0xe')][_0x144e('0xf')]=_0x18be07;}else if(_0x190ab6['body'][_0x144e('0xf')]){delete _0x190ab6[_0x144e('0xe')][_0x144e('0xf')];}_0x1ca3cb[_0x144e('0x10')]=utils[_0x144e('0x11')](_0x190ab6[_0x144e('0xb')]['notificationTemplate'],_0x190ab6);}catch(_0x5cfa90){_0x1ca3cb['msg']=_0x144e('0x12');logger[_0x144e('0x13')](util['format'](_0x144e('0x14'),_0x4e34d,_0x5cfa90[_0x144e('0x15')]));}io['to'](util[_0x144e('0x7')](_0x144e('0x8'),_0x18aae2[_0x144e('0x9')]))['emit'](util[_0x144e('0x7')]('notification:%s',_0x1d69ca?'save':_0x144e('0x16')),_0x1ca3cb);}function writeLog(_0x5a861b,_0x55be92,_0x5a9abf){return logger['debug'](util[_0x144e('0x7')](_0x144e('0x17'),_0x5a861b,_0x55be92['name'],_0x5a9abf));}exports[_0x144e('0x18')]=function(_0x5cba0e,_0x37512d,_0x320874,_0x39b868){if(_0x37512d[_0x144e('0x19')]){writeLog(_0x5cba0e,_0x37512d,_0x144e('0x1a'));return![];}if(!_0x37512d[_0x144e('0x1b')]){writeLog(_0x5cba0e,_0x37512d,'OFFLINE');return![];}if(_0x37512d[_0x320874+_0x144e('0x1c')]){writeLog(_0x5cba0e,_0x37512d,'PAUSE');return![];}if(_0x39b868&&_0x37512d[_0x144e('0x1d')](_0x320874+_0x144e('0x1e'))&&_0x37512d['hasOwnProperty'](_0x320874+'CurrentCapacity')){if(_0x37512d[_0x320874+_0x144e('0x1e')]>0x0&&_0x37512d[_0x320874+_0x144e('0x1f')]>=_0x37512d[_0x320874+_0x144e('0x1e')]){writeLog(_0x5cba0e,_0x37512d,_0x320874[_0x144e('0x20')]()+_0x144e('0x21'));return![];}}return!![];};exports[_0x144e('0x22')]=function(_0x38cdc4,_0x1bbdc7,_0xf09371,_0x481eba,_0x37180b){return sendNotification(!![],_0x38cdc4,_0x1bbdc7,_0xf09371,_0x481eba,_0x37180b);};exports[_0x144e('0x23')]=function(_0x13ba8,_0x5290fc,_0x412ff9,_0xc34157,_0x59e0df){return sendNotification(![],_0x13ba8,_0x5290fc,_0x412ff9,_0xc34157,_0x59e0df);};exports[_0x144e('0x24')]=function(_0x30f35f,_0x4e13f0,_0x2da9f4){var _0x41911e=_0x4e13f0[_0x144e('0x25')]['UserId'];if(!_0x41911e&&_0x2da9f4){_0x41911e=_0x2da9f4['id'];}var _0x2a3931=_[_0x144e('0x26')](_0x30f35f[_0x4e13f0[_0x144e('0x27')]+'QueuesWaitingInteractions'],function(_0x37563a){var _0xc58d9=_[_0x144e('0x28')](_0x4e13f0[_0x144e('0x27')])+_0x144e('0x29');return _0x37563a[_0xc58d9]===_0x4e13f0[_0x144e('0x25')]['id'];});if(!_0x2a3931&&_0x41911e){_0x2a3931=_['some'](_0x30f35f['agents'][_0x41911e][_0x4e13f0[_0x144e('0x27')]+_0x144e('0x2a')],function(_0x4f12f0){return _0x4f12f0['id']===_0x4e13f0['interaction']['id'];});}return _0x2a3931;};exports[_0x144e('0x2b')]=function(_0x5b6bf7,_0x3b93d5,_0x320097,_0x310213){_0x5b6bf7[_0x144e('0x2c')][_0x320097['id']][_0x310213+_0x144e('0x2a')][_0x3b93d5[_0x144e('0x15')]['id']]={'id':_0x3b93d5['interaction']['id']};};exports[_0x144e('0x2d')]=function(_0x1a4c9b,_0x70daea,_0x24b11e,_0x309ba9){delete _0x1a4c9b[_0x144e('0x2c')][_0x24b11e['id']][_0x309ba9+'WaitingInteractions'][_0x70daea[_0x144e('0x15')]['id']];};exports[_0x144e('0x2e')]=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 c1d93b3..cabe4be 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 _0x3422=['map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s'];(function(_0x1a2e43,_0x645814){var _0x125fb4=function(_0x58875f){while(--_0x58875f){_0x1a2e43['push'](_0x1a2e43['shift']());}};_0x125fb4(++_0x645814);}(_0x3422,0x118));var _0x2342=function(_0x56ab57,_0x528151){_0x56ab57=_0x56ab57-0x0;var _0x53ac9b=_0x3422[_0x56ab57];return _0x53ac9b;};'use strict';var schema=require(_0x2342('0x0'));var sh=require(_0x2342('0x1'));var _=require(_0x2342('0x2'));var utils=require('./utils');var logger=require(_0x2342('0x3'))(_0x2342('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2342('0x5')}});exports['consequence']=function(_0x226c0f,_0x5e1b7c){return function(_0x4e44ba){try{var _0x196c13={'command':_0x5e1b7c[0x0]};var _0x2f7ebd=system[_0x2342('0x0')](_0x196c13,{'typecast':!![]});if(_0x2f7ebd['length']){logger[_0x2342('0x6')](_0x2342('0x7'),_0x226c0f,_[_0x2342('0x8')](_0x2f7ebd,'message')[_0x2342('0x9')](',\x20'));logger[_0x2342('0xa')](_0x2342('0xb'),_0x226c0f);_0x4e44ba[_0x2342('0xc')]();}else{var _0x1c0baf=this;var _0x5bdbd0=utils[_0x2342('0xd')](_0x5e1b7c[0x0],this);logger[_0x2342('0xa')](_0x2342('0xe'),_0x226c0f,_0x5bdbd0);sh[_0x2342('0xf')](_[_0x2342('0x10')](_0x5bdbd0),function(_0x4e2f34,_0x1166a4){logger[_0x2342('0xa')](_0x2342('0x11'),_0x226c0f,_0x4e2f34);if(_0x4e2f34==0x0){var _0x337d54=_0x1166a4[_0x2342('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x2342('0x13')](_0x5e1b7c[0x1])||_[_0x2342('0x14')](_0x5e1b7c[0x1])){logger[_0x2342('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0x226c0f);_0x1c0baf[_0x2342('0x15')][_0x5e1b7c[0x1]]=_0x337d54;}else{logger['info'](_0x2342('0x16'),_0x226c0f,_0x5e1b7c[0x1],_0x337d54);_0x1c0baf['body'][_0x5e1b7c[0x1]]=_0x337d54;}}_0x4e44ba['next']();});}}catch(_0x346098){logger[_0x2342('0x6')]('[%s][SYSTEM]\x20%s',_0x226c0f,_[_0x2342('0x17')](_0x346098)?JSON['stringify'](_0x346098):_0x346098);logger['info'](_0x2342('0xb'),_0x226c0f);_0x4e44ba[_0x2342('0xc')]();}};}; \ No newline at end of file +var _0xd3d1=['[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xd3d1,0x172));var _0x1d3d=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xd3d1[_0x5d4607];return _0x5e4a86;};'use strict';var schema=require(_0x1d3d('0x0'));var sh=require(_0x1d3d('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0x1d3d('0x2'))(_0x1d3d('0x3'));var system=schema({'command':{'type':_0x1d3d('0x4'),'required':!![],'message':_0x1d3d('0x5')}});exports[_0x1d3d('0x6')]=function(_0x328a4e,_0x2445e8){return function(_0xc64465){try{var _0x1cbe06={'command':_0x2445e8[0x0]};var _0x449475=system[_0x1d3d('0x0')](_0x1cbe06,{'typecast':!![]});if(_0x449475[_0x1d3d('0x7')]){logger[_0x1d3d('0x8')](_0x1d3d('0x9'),_0x328a4e,_[_0x1d3d('0xa')](_0x449475,_0x1d3d('0xb'))[_0x1d3d('0xc')](',\x20'));logger['info'](_0x1d3d('0xd'),_0x328a4e);_0xc64465[_0x1d3d('0xe')]();}else{var _0x32d5da=this;var _0x32742c=utils[_0x1d3d('0xf')](_0x2445e8[0x0],this);logger[_0x1d3d('0x10')](_0x1d3d('0x11'),_0x328a4e,_0x32742c);sh[_0x1d3d('0x12')](_[_0x1d3d('0x13')](_0x32742c),function(_0x3cffa5,_0x29e17e){logger['info'](_0x1d3d('0x14'),_0x328a4e,_0x3cffa5);if(_0x3cffa5==0x0){var _0x2e375f=_0x29e17e['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2445e8[0x1])||_[_0x1d3d('0x15')](_0x2445e8[0x1])){logger[_0x1d3d('0x10')](_0x1d3d('0x16'),_0x328a4e);_0x32d5da['body'][_0x2445e8[0x1]]=_0x2e375f;}else{logger[_0x1d3d('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x328a4e,_0x2445e8[0x1],_0x2e375f);_0x32d5da[_0x1d3d('0x17')][_0x2445e8[0x1]]=_0x2e375f;}}_0xc64465[_0x1d3d('0xe')]();});}}catch(_0x3491e4){logger[_0x1d3d('0x8')](_0x1d3d('0x9'),_0x328a4e,_[_0x1d3d('0x18')](_0x3491e4)?JSON[_0x1d3d('0x19')](_0x3491e4):_0x3491e4);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x328a4e);_0xc64465[_0x1d3d('0xe')]();}};}; \ 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 d6127e9..0cbdae0 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 _0x01c5=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x5ce5a7,_0x3208f0){var _0x22c008=function(_0x35a009){while(--_0x35a009){_0x5ce5a7['push'](_0x5ce5a7['shift']());}};_0x22c008(++_0x3208f0);}(_0x01c5,0xdb));var _0x501c=function(_0x2931f8,_0x4ae628){_0x2931f8=_0x2931f8-0x0;var _0x38bb71=_0x01c5[_0x2931f8];return _0x38bb71;};'use strict';var schema=require('validate');var _=require(_0x501c('0x0'));var rpc={'chatInteraction':require(_0x501c('0x1')),'openchannelInteraction':require(_0x501c('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x501c('0x3')),'faxInteraction':require(_0x501c('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x501c('0x5'))(_0x501c('0x6'));var tag=schema({'tag':{'type':_0x501c('0x7'),'required':!![],'message':_0x501c('0x8')}});exports[_0x501c('0x9')]=function(_0x2192be,_0x3166de,_0x543366,_0x541175){return function(_0x5c64d5){try{var _0x3879e1={'tag':_0x3166de[0x0]};var _0xbe4826=tag[_0x501c('0xa')](_0x3879e1,{'typecast':!![]});if(_0xbe4826[_0x501c('0xb')]){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,_[_0x501c('0xe')](_0xbe4826,'message')[_0x501c('0xf')](',\x20'));logger[_0x501c('0x10')](_0x501c('0x11'),_0x2192be);_0x5c64d5[_0x501c('0x12')]();}else{var _0x3dd2bd={'ids':[_0x3166de[0x0]]};if(rpc[_0x541175[_0x501c('0x13')]+_0x501c('0x14')]){rpc[_0x541175[_0x501c('0x13')]+'Interaction'][_0x501c('0x15')](_0x541175[_0x501c('0x16')]['id'],_0x3dd2bd)[_0x501c('0x17')](function(_0x27970e){logger['info'](_0x501c('0x18'),_0x2192be,_0x3166de[0x1],_0x541175['channel'],_0x541175[_0x501c('0x16')]['id']);})['catch'](function(_0x471fb2){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,JSON[_0x501c('0x19')](_0x471fb2));logger[_0x501c('0x10')](_0x501c('0x11'),_0x2192be);})[_0x501c('0x1a')](function(){_0x5c64d5[_0x501c('0x12')]();});}}}catch(_0x58c731){logger[_0x501c('0xc')](_0x501c('0xd'),_0x2192be,_[_0x501c('0x1b')](_0x58c731)?JSON[_0x501c('0x19')](_0x58c731):_0x58c731);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2192be);_0x5c64d5[_0x501c('0x12')]();}};}; \ No newline at end of file +var _0x95f2=['map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','channel','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','next','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','routing','number','consequence','length','error','[%s][TAG]\x20%s'];(function(_0x518cc0,_0x4e38ab){var _0x281183=function(_0x2ffafe){while(--_0x2ffafe){_0x518cc0['push'](_0x518cc0['shift']());}};_0x281183(++_0x4e38ab);}(_0x95f2,0x1ec));var _0x295f=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x95f2[_0x44946b];return _0x249bc4;};'use strict';var schema=require(_0x295f('0x0'));var _=require(_0x295f('0x1'));var rpc={'chatInteraction':require(_0x295f('0x2')),'openchannelInteraction':require(_0x295f('0x3')),'smsInteraction':require(_0x295f('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x295f('0x5'))};var logger=require('../../../../config/logger')(_0x295f('0x6'));var tag=schema({'tag':{'type':_0x295f('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x295f('0x8')]=function(_0x35ede3,_0x4cf024,_0x3b9ce9,_0x36a669){return function(_0x4ff638){try{var _0x85316={'tag':_0x4cf024[0x0]};var _0x26f171=tag[_0x295f('0x0')](_0x85316,{'typecast':!![]});if(_0x26f171[_0x295f('0x9')]){logger[_0x295f('0xa')](_0x295f('0xb'),_0x35ede3,_[_0x295f('0xc')](_0x26f171,'message')[_0x295f('0xd')](',\x20'));logger['info'](_0x295f('0xe'),_0x35ede3);_0x4ff638['next']();}else{var _0x14b12c={'ids':[_0x4cf024[0x0]]};if(rpc[_0x36a669['channel']+_0x295f('0xf')]){rpc[_0x36a669[_0x295f('0x10')]+'Interaction'][_0x295f('0x11')](_0x36a669[_0x295f('0x12')]['id'],_0x14b12c)[_0x295f('0x13')](function(_0x1678b3){logger[_0x295f('0x14')](_0x295f('0x15'),_0x35ede3,_0x4cf024[0x1],_0x36a669['channel'],_0x36a669['interaction']['id']);})['catch'](function(_0x2fc6a6){logger[_0x295f('0xa')](_0x295f('0xb'),_0x35ede3,JSON['stringify'](_0x2fc6a6));logger[_0x295f('0x14')](_0x295f('0xe'),_0x35ede3);})['finally'](function(){_0x4ff638[_0x295f('0x16')]();});}}}catch(_0x109180){logger[_0x295f('0xa')](_0x295f('0xb'),_0x35ede3,_['isObject'](_0x109180)?JSON[_0x295f('0x17')](_0x109180):_0x109180);logger[_0x295f('0x14')](_0x295f('0xe'),_0x35ede3);_0x4ff638[_0x295f('0x16')]();}};}; \ 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 d1f609c..4658a6a 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 _0x03f8=['info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','?params=','urlOnRing','2.0','login','params','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','stop','catch','error','[%s][TVOX]\x20%s'];(function(_0x27b7be,_0x538e2d){var _0x1aa77e=function(_0x52a210){while(--_0x52a210){_0x27b7be['push'](_0x27b7be['shift']());}};_0x1aa77e(++_0x538e2d);}(_0x03f8,0x99));var _0x803f=function(_0x4dc7f8,_0x109c07){_0x4dc7f8=_0x4dc7f8-0x0;var _0xc113f9=_0x03f8[_0x4dc7f8];return _0xc113f9;};'use strict';var rp=require('request-promise');var logger=require(_0x803f('0x0'))(_0x803f('0x1'));var _=require(_0x803f('0x2'));var arr=[];exports['consequence']=function(_0xa9fb2d,_0x7e36bb){return function(_0x1282e7){var _0x2b0d8c=_0x7e36bb[0xa];var _0x25771c=_0x7e36bb[0xb];var _0x1b66d0=_0x7e36bb[0xc];var _0x3a8b7f=_0x7e36bb[0xd];var _0x3a8278=_0x7e36bb[0xe];var _0x4c12a6=_0x7e36bb[0xf][_0x803f('0x3')](/\n/g,_0x803f('0x4'));var _0x4f68e1=_0x7e36bb[0x10][_0x803f('0x3')](/\n/g,'\x20');if(!arr[_0x803f('0x5')](_0x25771c)){arr[_0x803f('0x6')](_0x25771c);var _0x230dc2=_0x7e36bb[0x3];var _0x260015=_0x7e36bb[0x4];var _0xe359ed=_0x7e36bb[0x1];var _0x33bff7=_0x7e36bb[0x0];var _0x14ac17={};_0x14ac17['urlOnAnswer']=_0x7e36bb[0x8]+_0x803f('0x7')+_0x1b66d0+'|'+_0x2b0d8c+'|'+_0x3a8b7f+'|'+_0x25771c+'|'+_0x3a8278;_0x14ac17[_0x803f('0x8')]=_0x7e36bb[0x7]+_0x803f('0x7')+_0x1b66d0+'|'+_0x2b0d8c+'|'+_0x3a8b7f+'|'+_0x25771c+'|'+_0x3a8278+'|'+_0x4c12a6+'|'+_0x4f68e1;_0x14ac17['title']=_0x7e36bb[0x9];var _0x3c4f89={};_0x3c4f89['jsonrpc']=_0x803f('0x9');_0x3c4f89['method']=_0x803f('0xa');var _0x142321=[];_0x142321[_0x803f('0x6')](_0x7e36bb[0x2]);_0x142321[_0x803f('0x6')](_0x7e36bb[0x5]);_0x142321[_0x803f('0x6')](_0x7e36bb[0x6]);_0x3c4f89[_0x803f('0xb')]=_0x142321;_0x3c4f89['id']=0x1;var _0x36a59f=JSON['stringify'](_0x3c4f89);var _0x2fa31d={'encoding':_0x803f('0xc'),'method':_0x803f('0xd'),'timeout':0x2710,'url':_0x230dc2,'headers':{'Content-Type':_0x803f('0xe')},'body':_0x36a59f};return rp(_0x2fa31d)[_0x803f('0xf')](function(_0x3bc418){const _0x111332=JSON[_0x803f('0x10')](_0x3bc418);if(!_0x111332[_0x803f('0x11')]['logged']){throw new Error(_0x803f('0x12'));}var _0x99a57c=_0x25771c;var _0x5dd51a=_0x803f('0x13')+_0xe359ed+_0x803f('0x14')+_0x33bff7+_0x803f('0x15')+_0x99a57c+'&data='+JSON[_0x803f('0x16')](_0x14ac17);var _0x2f0429=_0x260015+'?'+_0x5dd51a;return rp(_0x2f0429);})['then'](function(_0x169827){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0xa9fb2d,_0x169827);_0x1282e7[_0x803f('0x17')]();})[_0x803f('0x18')](function(_0x2aaba2){logger[_0x803f('0x19')](_0x803f('0x1a'),_0xa9fb2d,_['isObject'](_0x2aaba2)?JSON[_0x803f('0x16')](_0x2aaba2):_0x2aaba2);_0x1282e7[_0x803f('0x17')]();});}else{logger[_0x803f('0x1b')](_0x803f('0x1c'),_0xa9fb2d);_0x1282e7[_0x803f('0x1d')]();}};}; \ No newline at end of file +var _0x9604=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','2.0','method','login','params','utf8','POST','application/json-rpc','then','parse'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x9604,0x1ba));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x4960('0x0'));var logger=require(_0x4960('0x1'))('routing');var _=require(_0x4960('0x2'));var arr=[];exports[_0x4960('0x3')]=function(_0x69e7db,_0x477ad0){return function(_0x32b64c){var _0x6df0da=_0x477ad0[0xa];var _0x29f0af=_0x477ad0[0xb];var _0x53fc0a=_0x477ad0[0xc];var _0x3eb6cb=_0x477ad0[0xd];var _0xd2f7f5=_0x477ad0[0xe];var _0x123ef0=_0x477ad0[0xf][_0x4960('0x4')](/\n/g,_0x4960('0x5'));var _0x1c7346=_0x477ad0[0x10][_0x4960('0x4')](/\n/g,'\x20');if(!arr[_0x4960('0x6')](_0x29f0af)){arr[_0x4960('0x7')](_0x29f0af);var _0x375da3=_0x477ad0[0x3];var _0xfc4f09=_0x477ad0[0x4];var _0x2eab99=_0x477ad0[0x1];var _0x1bcf8e=_0x477ad0[0x0];var _0x5d6470={};_0x5d6470['urlOnAnswer']=_0x477ad0[0x8]+_0x4960('0x8')+_0x53fc0a+'|'+_0x6df0da+'|'+_0x3eb6cb+'|'+_0x29f0af+'|'+_0xd2f7f5;_0x5d6470[_0x4960('0x9')]=_0x477ad0[0x7]+'?params='+_0x53fc0a+'|'+_0x6df0da+'|'+_0x3eb6cb+'|'+_0x29f0af+'|'+_0xd2f7f5+'|'+_0x123ef0+'|'+_0x1c7346;_0x5d6470[_0x4960('0xa')]=_0x477ad0[0x9];var _0x28961c={};_0x28961c['jsonrpc']=_0x4960('0xb');_0x28961c[_0x4960('0xc')]=_0x4960('0xd');var _0x4a2dc3=[];_0x4a2dc3['push'](_0x477ad0[0x2]);_0x4a2dc3[_0x4960('0x7')](_0x477ad0[0x5]);_0x4a2dc3['push'](_0x477ad0[0x6]);_0x28961c[_0x4960('0xe')]=_0x4a2dc3;_0x28961c['id']=0x1;var _0x52ece7=JSON['stringify'](_0x28961c);var _0x3a1a96={'encoding':_0x4960('0xf'),'method':_0x4960('0x10'),'timeout':0x2710,'url':_0x375da3,'headers':{'Content-Type':_0x4960('0x11')},'body':_0x52ece7};return rp(_0x3a1a96)[_0x4960('0x12')](function(_0x463421){const _0x900c3e=JSON[_0x4960('0x13')](_0x463421);if(!_0x900c3e['result'][_0x4960('0x14')]){throw new Error(_0x4960('0x15'));}var _0x57543e=_0x29f0af;var _0x5a4685=_0x4960('0x16')+_0x2eab99+_0x4960('0x17')+_0x1bcf8e+_0x4960('0x18')+_0x57543e+_0x4960('0x19')+JSON[_0x4960('0x1a')](_0x5d6470);var _0x4b3a4f=_0xfc4f09+'?'+_0x5a4685;return rp(_0x4b3a4f);})[_0x4960('0x12')](function(_0x9debdd){logger[_0x4960('0x1b')](_0x4960('0x1c'),_0x69e7db,_0x9debdd);_0x32b64c[_0x4960('0x1d')]();})['catch'](function(_0x411e10){logger['error'](_0x4960('0x1e'),_0x69e7db,_[_0x4960('0x1f')](_0x411e10)?JSON['stringify'](_0x411e10):_0x411e10);_0x32b64c[_0x4960('0x1d')]();});}else{logger['info'](_0x4960('0x20'),_0x69e7db);_0x32b64c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 3d14b51..fc0b92e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x311a9f,_0x3ad838){var _0x5440a4=function(_0x238876){while(--_0x238876){_0x311a9f['push'](_0x311a9f['shift']());}};_0x5440a4(++_0x3ad838);}(_0xe706,0xa3));var _0x6e70=function(_0x96f54d,_0x5e5d21){_0x96f54d=_0x96f54d-0x0;var _0xdb885c=_0xe706[_0x96f54d];return _0xdb885c;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x31fadb,_0x45de50){var _0x23ef3e=function(_0x20bafc){while(--_0x20bafc){_0x31fadb['push'](_0x31fadb['shift']());}};_0x23ef3e(++_0x45de50);}(_0xe706,0xa3));var _0x6e70=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xe706[_0x5a26f5];return _0x2e9ef7;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 884c1cc..d9b21ee 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 _0x7e53=['CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','mailQueues','available','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','app','.js','appdata','mail','push','slice','join','dialogflow','split','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','intervals','./applications/','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','end','QueueReport','update','catch','message\x20is\x20empty','busy','busyQueue','capacity','hasOwnProperty'];(function(_0x151f38,_0x452dc3){var _0xeeac1f=function(_0xc127c5){while(--_0xc127c5){_0x151f38['push'](_0x151f38['shift']());}};_0xeeac1f(++_0x452dc3);}(_0x7e53,0xe5));var _0x37e5=function(_0x12ea57,_0x3336dc){_0x12ea57=_0x12ea57-0x0;var _0xf60ddf=_0x7e53[_0x12ea57];return _0xf60ddf;};'use strict';var _=require(_0x37e5('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x37e5('0x1'));var BPromise=require(_0x37e5('0x2'));var utils=require(_0x37e5('0x3'));var sUtils=require(_0x37e5('0x4'));var logger=require(_0x37e5('0x5'))(_0x37e5('0x6'));var rpc={'openchannelQueueReport':require(_0x37e5('0x7')),'mailQueueReport':require(_0x37e5('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x37e5('0x9')),'faxQueueReport':require(_0x37e5('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x37e5('0xb'));function getId(_0x21ee72,_0x3fa767,_0x3717a9){return util[_0x37e5('0xc')]('%s.%s.%s',_0x21ee72,_0x3fa767||0x0,_0x3717a9||0x0);}function getIntervals(_0x2d35ce,_0x34dc75){var _0x866db5=[];if(!_[_0x37e5('0xd')](_0x34dc75[_0x37e5('0xe')])&&!_[_0x37e5('0xd')](_0x2d35ce[_0x34dc75['IntervalId']])&&!_['isNil'](_0x2d35ce[_0x34dc75[_0x37e5('0xe')]][_0x37e5('0xf')])){_0x866db5=_[_0x37e5('0x10')](_0x2d35ce[_0x34dc75[_0x37e5('0xe')]][_0x37e5('0xf')],_0x37e5('0x11'));}else if(!_[_0x37e5('0xd')](_0x34dc75[_0x37e5('0x11')])){_0x866db5=[_0x34dc75[_0x37e5('0x11')]];}return _0x866db5;}exports[_0x37e5('0x12')]=function(_0x324e21){_0x324e21[_0x37e5('0x13')]={};return new BPromise(function(_0x258eb4,_0x511098){var _0x5b7d6a={'Start':function(_0x52ad15){var _0x1e3538=this;return new Promise(function(_0x34f837,_0x43f014){if(_0x52ad15){try{var _0x17d17c=[];var _0x20a196=getId(_0x52ad15[_0x37e5('0x14')],_0x52ad15[_0x37e5('0x15')]?_0x52ad15[_0x37e5('0x15')]['id']:0x0,_0x52ad15[_0x37e5('0x16')]?_0x52ad15[_0x37e5('0x16')]['id']:0x0);var _0x42fe8a=sUtils[_0x37e5('0x17')](_0x324e21,_0x52ad15);if(!_0x42fe8a&&_0x52ad15[_0x37e5('0x18')]&&_[_0x37e5('0x19')](_0x52ad15[_0x37e5('0x18')])&&_0x52ad15[_0x37e5('0x18')][_0x37e5('0x1a')]){for(var _0x25ce86=0x0;_0x25ce86<_0x52ad15[_0x37e5('0x18')]['length'];_0x25ce86+=0x1){var _0x5ab8dc=_0x52ad15[_0x37e5('0x18')][_0x25ce86];if(fs[_0x37e5('0x1b')](path['join'](__dirname,_0x37e5('0x18'),_0x5ab8dc[_0x37e5('0x1c')]+_0x37e5('0x1d')))){var _0x3ae569=[];switch(_0x5ab8dc[_0x37e5('0x1c')]['toLowerCase']()){case'autoreply':var _0x28ae5d=_0x5ab8dc[_0x37e5('0x1e')]['split'](',');if(_0x52ad15['channel']===_0x37e5('0x1f')){_0x3ae569['push'](_0x28ae5d[0x0]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[0x1]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[_0x37e5('0x21')](0x2,_0x28ae5d[_0x37e5('0x1a')])[_0x37e5('0x22')](','));}else{_0x3ae569[_0x37e5('0x20')](_0x28ae5d[0x0]);_0x3ae569[_0x37e5('0x20')](_0x28ae5d[_0x37e5('0x21')](0x1,_0x28ae5d['length'])[_0x37e5('0x22')](','));}break;case _0x37e5('0x23'):var _0x4671ed=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x4671ed[0x0]);_0x3ae569[_0x37e5('0x20')](_0x4671ed[0x1]);_0x3ae569['push'](_0x4671ed[_0x37e5('0x21')](0x2,_0x4671ed[_0x37e5('0x1a')])[_0x37e5('0x22')](','));break;case'dialogflowv2':var _0x3da513=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x3da513[0x0]);_0x3ae569['push'](_0x3da513[0x1]);_0x3ae569[_0x37e5('0x20')](_0x3da513[0x2]);_0x3ae569[_0x37e5('0x20')](_0x3da513[0x3]);_0x3ae569[_0x37e5('0x20')](_0x3da513[_0x37e5('0x21')](0x4,_0x3da513[_0x37e5('0x1a')])[_0x37e5('0x22')](','));break;case _0x37e5('0x25'):var _0x52ba44=_0x5ab8dc['appdata'][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x52ba44[0x0]);_0x3ae569['push'](_0x52ba44[0x1]);_0x3ae569['push'](_0x52ba44[0x2]);_0x3ae569[_0x37e5('0x20')](_0x52ba44[0x3]);_0x3ae569['push'](_0x52ba44[_0x37e5('0x21')](0x4,_0x52ba44['length'])[_0x37e5('0x22')](','));break;case _0x37e5('0x15'):_0x3ae569['push'](_0x5ab8dc['appdata']);break;case _0x37e5('0x26'):_0x3ae569['push'](_0x5ab8dc['TagId']);_0x3ae569[_0x37e5('0x20')](_0x5ab8dc[_0x37e5('0x1e')]);break;case _0x37e5('0x27'):var _0x4bd665=utils[_0x37e5('0x28')](_0x52ad15[_0x37e5('0x29')][_0x37e5('0x2a')],_0x52ad15);var _0x34762c=_0x5ab8dc[_0x37e5('0x1e')][_0x37e5('0x24')](',');_0x3ae569[_0x37e5('0x20')](_0x34762c[0x0]);_0x3ae569['push'](_0x34762c[0x1]);_0x3ae569['push'](_0x34762c[0x2]);_0x3ae569['push'](_0x34762c[0x3]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x4]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x5]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x6]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x7]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x8]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0x9]);_0x3ae569[_0x37e5('0x20')](_0x34762c[0xa]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x16')]['id']);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x15')]['id']);_0x3ae569['push'](_0x5ab8dc[_0x37e5('0x2b')]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x16')][_0x37e5('0x2c')]);_0x3ae569[_0x37e5('0x20')](_0x52ad15[_0x37e5('0x2d')][_0x37e5('0x2d')]);_0x3ae569[_0x37e5('0x20')](_0x4bd665);break;default:_0x3ae569=_[_0x37e5('0xd')](_0x5ab8dc['appdata'])?[]:_0x5ab8dc[_0x37e5('0x1e')]['split'](',');}var _0x19c0ce={'id':util[_0x37e5('0xc')](_0x37e5('0x2e'),_0x20a196,_0x5ab8dc['id'],_0x5ab8dc['app']),'condition':require('./interval')[_0x37e5('0x2f')](_0x20a196,getIntervals(_0x324e21[_0x37e5('0x30')],_0x5ab8dc),_0x324e21),'consequence':require(_0x37e5('0x31')+_0x5ab8dc['app'])['consequence'](_0x20a196,_0x3ae569,_0x324e21,_0x52ad15),'p':_0x5ab8dc['priority']||0x0};logger[_0x37e5('0x32')](_0x37e5('0x33'),_0x19c0ce['id'],'on\x20interval',getIntervals(_0x324e21[_0x37e5('0x30')],_0x5ab8dc)[_0x37e5('0x22')](_0x37e5('0x34')));_0x17d17c[_0x37e5('0x20')](_0x19c0ce);}else{logger[_0x37e5('0x35')](_0x37e5('0x36'),path[_0x37e5('0x22')](__dirname,_0x37e5('0x18'),_0x5ab8dc[_0x37e5('0x1c')]+_0x37e5('0x1d')));}}_0x324e21['rules'][_0x20a196]=new RuleEngine(_0x17d17c);_0x324e21[_0x37e5('0x13')][_0x20a196][_0x37e5('0x37')](_0x52ad15,function(_0x40a54a){logger[_0x37e5('0x32')](_0x37e5('0x38'),JSON['stringify'](_0x40a54a[_0x37e5('0x39')]));if(_0x324e21[_0x37e5('0x13')][_0x20a196]){_0x324e21[_0x37e5('0x13')][_0x20a196][_0x37e5('0x3a')](_0x37e5('0x3b'));}});return _0x34f837({'code':0xc8,'message':_0x52ad15});}else{if(_0x42fe8a){logger['info'](util[_0x37e5('0xc')](_0x37e5('0x3c'),_0x20a196));}else{logger['info'](_0x37e5('0x3d'));}return _0x34f837({'code':0xc8,'message':_0x52ad15});}}catch(_0x553557){logger['error'](_0x553557[_0x37e5('0x3e')]);return _0x43f014(_0x1e3538[_0x37e5('0x35')](0x1f4,_0x553557));}}return _0x43f014('routing\x20is\x20empty');});},'AcceptMessage':function(_0x582429){var _0x25d340=this;return new Promise(function(_0x1bfb10,_0x3cdfe0){if(_0x582429[_0x37e5('0x3f')]&&_0x582429['agent']['id']){if(_0x324e21[_0x37e5('0x40')][_0x582429[_0x37e5('0x3f')]['id']]){_0x324e21[_0x37e5('0x40')][_0x582429[_0x37e5('0x3f')]['id']]['busy']=![];_0x324e21['agents'][_0x582429[_0x37e5('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x582429[_0x37e5('0x15')]&&_0x582429[_0x37e5('0x15')]['id']){try{var _0x2726a0=getId(_0x582429['channel'],_0x582429[_0x37e5('0x15')]?_0x582429[_0x37e5('0x15')]['id']:0x0,_0x582429[_0x37e5('0x16')]?_0x582429[_0x37e5('0x16')]['id']:0x0);if(_0x324e21[_0x37e5('0x13')][_0x2726a0]){_0x324e21[_0x37e5('0x13')][_0x2726a0][_0x37e5('0x3a')](_0x37e5('0x41'));if(rpc[_0x582429[_0x37e5('0x14')]+_0x37e5('0x42')]){rpc[_0x582429['channel']+_0x37e5('0x42')][_0x37e5('0x43')](_0x2726a0,{'UserId':_0x582429[_0x37e5('0x15')]['UserId']})[_0x37e5('0x44')](function(){logger[_0x37e5('0x35')]('error\x20update\x20queue\x20report');});}}return _0x1bfb10({'code':0xc8,'message':_0x582429});}catch(_0xbb7ace){logger[_0x37e5('0x35')](_0xbb7ace[_0x37e5('0x3e')]);return _0x3cdfe0(_0x25d340[_0x37e5('0x35')](0x1f4,_0xbb7ace));}}logger['error'](_0x37e5('0x45'));return _0x3cdfe0(_0x25d340[_0x37e5('0x35')](0x1f4,_0x37e5('0x45')));});},'RejectMessage':function(_0x4f9992){var _0x408366=this;return new Promise(function(_0x2bd678,_0x3c27c5){if(_0x4f9992[_0x37e5('0x3f')]&&_0x4f9992[_0x37e5('0x3f')]['id']){try{if(_0x324e21[_0x37e5('0x40')][_0x4f9992[_0x37e5('0x3f')]['id']]){_0x324e21['agents'][_0x4f9992[_0x37e5('0x3f')]['id']][_0x37e5('0x46')]=![];_0x324e21[_0x37e5('0x40')][_0x4f9992['agent']['id']][_0x37e5('0x47')]=undefined;}return _0x2bd678({'code':0xc8,'message':_0x4f9992});}catch(_0x5951c5){logger[_0x37e5('0x35')](_0x5951c5['stack']);return _0x3c27c5(_0x408366['error'](0x1f4,_0x5951c5));}}logger[_0x37e5('0x35')](_0x37e5('0x45'));return _0x3c27c5(_0x408366[_0x37e5('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1bd743){var _0x3d0fe2=this;return new Promise(function(_0x46d2ec,_0x596b13){if(_0x1bd743['channel']&&_0x1bd743[_0x37e5('0x16')]&&_0x1bd743[_0x37e5('0x16')]['id']){try{var _0xf32267=getId(_0x1bd743[_0x37e5('0x14')],_0x1bd743['message']?_0x1bd743[_0x37e5('0x15')]['id']:0x0,_0x1bd743[_0x37e5('0x16')]?_0x1bd743[_0x37e5('0x16')]['id']:0x0);if(_0x324e21[_0x37e5('0x13')][_0xf32267]){_0x324e21['rules'][_0xf32267][_0x37e5('0x3a')]('end');}return _0x46d2ec({'code':0xc8,'message':_0x1bd743});}catch(_0x5ea166){logger[_0x37e5('0x35')](_0x5ea166[_0x37e5('0x3e')]);return _0x596b13(_0x3d0fe2[_0x37e5('0x35')](0x1f4,_0x5ea166));}}logger[_0x37e5('0x35')](_0x37e5('0x45'));return _0x596b13(_0x3d0fe2[_0x37e5('0x35')](0x1f4,_0x37e5('0x45')));});},'AgentCapacity':function(_0xf9fad8){var _0x5b535a=this;return new Promise(function(_0x33cf21,_0x1006f2){if(_0x324e21['agents']['hasOwnProperty'](_0xf9fad8['id'])){for(var _0x848112 in _0xf9fad8[_0x37e5('0x48')]){if(_0xf9fad8['capacity'][_0x37e5('0x49')](_0x848112)){if(_0x324e21['agents'][_0xf9fad8['id']][_0x37e5('0x49')](_0x848112+_0x37e5('0x4a'))){_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']][_0x848112+_0x37e5('0x4a')]=parseInt(_0xf9fad8[_0x37e5('0x48')][_0x848112],0xa);}}}_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']][_0x37e5('0x4b')]();return _0x33cf21({'code':0xc8,'message':_0x324e21[_0x37e5('0x40')][_0xf9fad8['id']]});}else{return _0x1006f2(_0x5b535a['error'](0x1f4,_0x37e5('0x4c')));}});},'Agents':function(_0x368f63){return new Promise(function(_0x2d7631){var _0x14ab56=_['values'](_0x324e21[_0x37e5('0x40')]);if(_0x368f63&&_0x368f63['id']){var _0x43508d=_[_0x37e5('0x4d')](_0x14ab56,function(_0x6281cb){return _0x6281cb['id']===_0x368f63['id'];});_0x2d7631(_0x43508d);}else{_0x2d7631({'count':_0x14ab56[_0x37e5('0x1a')],'rows':_0x14ab56});}});},'ChatQueues':function(){return new Promise(function(_0x286695){var _0xa8b28c=[];for(var _0x518487 in _0x324e21[_0x37e5('0x4e')]){if(_0x324e21[_0x37e5('0x4e')][_0x37e5('0x49')](_0x518487)){var _0x7ca553=_0x324e21['chatQueues'][_0x518487];var _0x1469fb={'id':_0x7ca553['id'],'available':_0x7ca553['available'],'loggedIn':_0x7ca553[_0x37e5('0x4f')],'name':_0x7ca553[_0x37e5('0x50')],'paused':_0x7ca553[_0x37e5('0x51')],'waiting':_0x7ca553['waiting']};_0xa8b28c[_0x37e5('0x20')](_0x1469fb);}}_0x286695({'count':_0xa8b28c[_0x37e5('0x1a')],'rows':_0xa8b28c});});},'MailQueues':function(){return new Promise(function(_0x3134ee){var _0x2ae523=[];for(var _0x2d947f in _0x324e21[_0x37e5('0x52')]){if(_0x324e21['mailQueues'][_0x37e5('0x49')](_0x2d947f)){var _0x311b15=_0x324e21[_0x37e5('0x52')][_0x2d947f];var _0x42056c={'id':_0x311b15['id'],'available':_0x311b15[_0x37e5('0x53')],'loggedIn':_0x311b15[_0x37e5('0x4f')],'name':_0x311b15[_0x37e5('0x50')],'paused':_0x311b15['paused'],'waiting':_0x311b15[_0x37e5('0x54')]};_0x2ae523[_0x37e5('0x20')](_0x42056c);}}_0x3134ee({'count':_0x2ae523['length'],'rows':_0x2ae523});});},'OpenchannelQueues':function(){return new Promise(function(_0x5d41bb){var _0x2da8f1=[];for(var _0x228dea in _0x324e21[_0x37e5('0x55')]){if(_0x324e21[_0x37e5('0x55')]['hasOwnProperty'](_0x228dea)){var _0x46df30=_0x324e21[_0x37e5('0x55')][_0x228dea];var _0x1c7402={'id':_0x46df30['id'],'available':_0x46df30['available'],'loggedIn':_0x46df30[_0x37e5('0x4f')],'name':_0x46df30[_0x37e5('0x50')],'paused':_0x46df30[_0x37e5('0x51')],'waiting':_0x46df30['waiting']};_0x2da8f1['push'](_0x1c7402);}}_0x5d41bb({'count':_0x2da8f1[_0x37e5('0x1a')],'rows':_0x2da8f1});});},'SmsQueues':function(){return new Promise(function(_0x1b12d9){var _0x30a563=[];for(var _0x222702 in _0x324e21[_0x37e5('0x56')]){if(_0x324e21[_0x37e5('0x56')][_0x37e5('0x49')](_0x222702)){var _0x2c8a15=_0x324e21['smsQueues'][_0x222702];var _0x2e7c5c={'id':_0x2c8a15['id'],'available':_0x2c8a15[_0x37e5('0x53')],'loggedIn':_0x2c8a15['loggedIn'],'name':_0x2c8a15[_0x37e5('0x50')],'paused':_0x2c8a15[_0x37e5('0x51')],'waiting':_0x2c8a15[_0x37e5('0x54')]};_0x30a563[_0x37e5('0x20')](_0x2e7c5c);}}_0x1b12d9({'count':_0x30a563['length'],'rows':_0x30a563});});},'FaxQueues':function(){return new Promise(function(_0x159381){var _0x38b130=[];for(var _0x84647b in _0x324e21['faxQueues']){if(_0x324e21[_0x37e5('0x57')][_0x37e5('0x49')](_0x84647b)){var _0x28c9b4=_0x324e21[_0x37e5('0x57')][_0x84647b];var _0x4bfc3e={'id':_0x28c9b4['id'],'available':_0x28c9b4['available'],'loggedIn':_0x28c9b4['loggedIn'],'name':_0x28c9b4[_0x37e5('0x50')],'paused':_0x28c9b4[_0x37e5('0x51')],'waiting':_0x28c9b4[_0x37e5('0x54')]};_0x38b130['push'](_0x4bfc3e);}}_0x159381({'count':_0x38b130['length'],'rows':_0x38b130});});},'WhatsappQueues':function(){return new Promise(function(_0x38d4e7){var _0x3baf5a=[];for(var _0x16f6dc in _0x324e21['whatsappQueues']){if(_0x324e21[_0x37e5('0x58')][_0x37e5('0x49')](_0x16f6dc)){var _0x55f055=_0x324e21[_0x37e5('0x58')][_0x16f6dc];var _0x42a276={'id':_0x55f055['id'],'available':_0x55f055['available'],'loggedIn':_0x55f055[_0x37e5('0x4f')],'name':_0x55f055['name'],'paused':_0x55f055[_0x37e5('0x51')],'waiting':_0x55f055[_0x37e5('0x54')]};_0x3baf5a[_0x37e5('0x20')](_0x42a276);}}_0x38d4e7({'count':_0x3baf5a[_0x37e5('0x1a')],'rows':_0x3baf5a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x45c5f5){var _0x1b5b2c=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5a')]);_0x45c5f5({'count':_0x1b5b2c[_0x37e5('0x1a')],'rows':_0x1b5b2c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x287a7c){var _0x318e27=_['values'](_0x324e21[_0x37e5('0x5b')]);_0x287a7c({'count':_0x318e27[_0x37e5('0x1a')],'rows':_0x318e27});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3aadbb){var _0x42743d=_['values'](_0x324e21[_0x37e5('0x5c')]);_0x3aadbb({'count':_0x42743d[_0x37e5('0x1a')],'rows':_0x42743d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x364922){var _0x595a3d=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5d')]);_0x364922({'count':_0x595a3d[_0x37e5('0x1a')],'rows':_0x595a3d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x313ac9){var _0x46122c=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5e')]);_0x313ac9({'count':_0x46122c['length'],'rows':_0x46122c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x581647){var _0x1219b2=_[_0x37e5('0x59')](_0x324e21[_0x37e5('0x5f')]);_0x581647({'count':_0x1219b2[_0x37e5('0x1a')],'rows':_0x1219b2});});}};var _0x5dcf20=jayson[_0x37e5('0x60')](_0x5b7d6a)[_0x37e5('0x61')]();_0x5dcf20['on']('error',function(_0x3d89be){logger[_0x37e5('0x35')](JSON['stringify'](_0x3d89be));return _0x511098(_0x3d89be);});_0x5dcf20[_0x37e5('0x12')](0x232c,_0x37e5('0x62'),function(){console[_0x37e5('0x63')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x258eb4(_0x37e5('0x64')+0x232c);});});}; \ No newline at end of file +var _0xc26b=['execute','Applications\x20executed','complete','No\x20applications\x20to\x20execute','stack','agents','agent','busy','busyQueue','emit','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','interaction','checkWaitingNotifications','applications','isArray','.js','app','toLowerCase','appdata','push','slice','join','length','split','dialogflowv2','amazonlex','message','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules'];(function(_0x1f5c63,_0x12734c){var _0x54142d=function(_0x1a48e0){while(--_0x1a48e0){_0x1f5c63['push'](_0x1f5c63['shift']());}};_0x54142d(++_0x12734c);}(_0xc26b,0xf7));var _0xbc26=function(_0x5ada79,_0x13c246){_0x5ada79=_0x5ada79-0x0;var _0x5948da=_0xc26b[_0x5ada79];return _0x5948da;};'use strict';var _=require('lodash');var util=require(_0xbc26('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xbc26('0x1'));var BPromise=require(_0xbc26('0x2'));var utils=require(_0xbc26('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0xbc26('0x4'))(_0xbc26('0x5'));var rpc={'openchannelQueueReport':require(_0xbc26('0x6')),'mailQueueReport':require(_0xbc26('0x7')),'chatQueueReport':require(_0xbc26('0x8')),'smsQueueReport':require(_0xbc26('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbc26('0xa'))};var RuleEngine=require(_0xbc26('0xb'));function getId(_0x39591e,_0x509e83,_0x355d4b){return util[_0xbc26('0xc')](_0xbc26('0xd'),_0x39591e,_0x509e83||0x0,_0x355d4b||0x0);}function getIntervals(_0x22dc11,_0x232a5b){var _0x4b5b28=[];if(!_[_0xbc26('0xe')](_0x232a5b[_0xbc26('0xf')])&&!_[_0xbc26('0xe')](_0x22dc11[_0x232a5b[_0xbc26('0xf')]])&&!_[_0xbc26('0xe')](_0x22dc11[_0x232a5b[_0xbc26('0xf')]]['Intervals'])){_0x4b5b28=_[_0xbc26('0x10')](_0x22dc11[_0x232a5b[_0xbc26('0xf')]][_0xbc26('0x11')],_0xbc26('0x12'));}else if(!_[_0xbc26('0xe')](_0x232a5b[_0xbc26('0x12')])){_0x4b5b28=[_0x232a5b['interval']];}return _0x4b5b28;}exports[_0xbc26('0x13')]=function(_0x467bc6){_0x467bc6['rules']={};return new BPromise(function(_0x3940fb,_0x493877){var _0x5c4c07={'Start':function(_0x3f73c9){var _0x2cccb8=this;return new Promise(function(_0x5b9527,_0x37f1c0){if(_0x3f73c9){try{var _0x312995=[];var _0x580cb0=getId(_0x3f73c9[_0xbc26('0x14')],_0x3f73c9['message']?_0x3f73c9['message']['id']:0x0,_0x3f73c9[_0xbc26('0x15')]?_0x3f73c9[_0xbc26('0x15')]['id']:0x0);var _0x2028ff=sUtils[_0xbc26('0x16')](_0x467bc6,_0x3f73c9);if(!_0x2028ff&&_0x3f73c9[_0xbc26('0x17')]&&_[_0xbc26('0x18')](_0x3f73c9['applications'])&&_0x3f73c9['applications']['length']){for(var _0x7ae0a0=0x0;_0x7ae0a0<_0x3f73c9[_0xbc26('0x17')]['length'];_0x7ae0a0+=0x1){var _0x574538=_0x3f73c9[_0xbc26('0x17')][_0x7ae0a0];if(fs['existsSync'](path['join'](__dirname,_0xbc26('0x17'),_0x574538['app']+_0xbc26('0x19')))){var _0x5291c1=[];switch(_0x574538[_0xbc26('0x1a')][_0xbc26('0x1b')]()){case'autoreply':var _0x26eb08=_0x574538[_0xbc26('0x1c')]['split'](',');if(_0x3f73c9[_0xbc26('0x14')]==='mail'){_0x5291c1[_0xbc26('0x1d')](_0x26eb08[0x0]);_0x5291c1[_0xbc26('0x1d')](_0x26eb08[0x1]);_0x5291c1['push'](_0x26eb08[_0xbc26('0x1e')](0x2,_0x26eb08['length'])[_0xbc26('0x1f')](','));}else{_0x5291c1['push'](_0x26eb08[0x0]);_0x5291c1[_0xbc26('0x1d')](_0x26eb08['slice'](0x1,_0x26eb08[_0xbc26('0x20')])[_0xbc26('0x1f')](','));}break;case'dialogflow':var _0x3ef0ae=_0x574538[_0xbc26('0x1c')][_0xbc26('0x21')](',');_0x5291c1[_0xbc26('0x1d')](_0x3ef0ae[0x0]);_0x5291c1[_0xbc26('0x1d')](_0x3ef0ae[0x1]);_0x5291c1[_0xbc26('0x1d')](_0x3ef0ae['slice'](0x2,_0x3ef0ae[_0xbc26('0x20')])[_0xbc26('0x1f')](','));break;case _0xbc26('0x22'):var _0x22a364=_0x574538[_0xbc26('0x1c')]['split'](',');_0x5291c1['push'](_0x22a364[0x0]);_0x5291c1[_0xbc26('0x1d')](_0x22a364[0x1]);_0x5291c1['push'](_0x22a364[0x2]);_0x5291c1[_0xbc26('0x1d')](_0x22a364[0x3]);_0x5291c1['push'](_0x22a364[_0xbc26('0x1e')](0x4,_0x22a364[_0xbc26('0x20')])[_0xbc26('0x1f')](','));break;case _0xbc26('0x23'):var _0x4987f2=_0x574538[_0xbc26('0x1c')]['split'](',');_0x5291c1['push'](_0x4987f2[0x0]);_0x5291c1['push'](_0x4987f2[0x1]);_0x5291c1['push'](_0x4987f2[0x2]);_0x5291c1['push'](_0x4987f2[0x3]);_0x5291c1[_0xbc26('0x1d')](_0x4987f2[_0xbc26('0x1e')](0x4,_0x4987f2[_0xbc26('0x20')])['join'](','));break;case _0xbc26('0x24'):_0x5291c1['push'](_0x574538[_0xbc26('0x1c')]);break;case _0xbc26('0x25'):_0x5291c1['push'](_0x574538[_0xbc26('0x26')]);_0x5291c1[_0xbc26('0x1d')](_0x574538[_0xbc26('0x1c')]);break;case _0xbc26('0x27'):var _0x38e970=utils[_0xbc26('0x28')](_0x3f73c9[_0xbc26('0x29')][_0xbc26('0x2a')],_0x3f73c9);var _0xc091fa=_0x574538['appdata'][_0xbc26('0x21')](',');_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x0]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x1]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x2]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x3]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x4]);_0x5291c1['push'](_0xc091fa[0x5]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x6]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0x7]);_0x5291c1['push'](_0xc091fa[0x8]);_0x5291c1['push'](_0xc091fa[0x9]);_0x5291c1[_0xbc26('0x1d')](_0xc091fa[0xa]);_0x5291c1[_0xbc26('0x1d')](_0x3f73c9[_0xbc26('0x15')]['id']);_0x5291c1[_0xbc26('0x1d')](_0x3f73c9[_0xbc26('0x24')]['id']);_0x5291c1['push'](_0x574538[_0xbc26('0x2b')]);_0x5291c1['push'](_0x3f73c9['interaction'][_0xbc26('0x2c')]);_0x5291c1[_0xbc26('0x1d')](_0x3f73c9[_0xbc26('0x2d')][_0xbc26('0x2d')]);_0x5291c1[_0xbc26('0x1d')](_0x38e970);break;default:_0x5291c1=_[_0xbc26('0xe')](_0x574538[_0xbc26('0x1c')])?[]:_0x574538[_0xbc26('0x1c')][_0xbc26('0x21')](',');}var _0x269b78={'id':util['format'](_0xbc26('0x2e'),_0x580cb0,_0x574538['id'],_0x574538['app']),'condition':require(_0xbc26('0x2f'))['condition'](_0x580cb0,getIntervals(_0x467bc6[_0xbc26('0x30')],_0x574538),_0x467bc6),'consequence':require(_0xbc26('0x31')+_0x574538[_0xbc26('0x1a')])[_0xbc26('0x32')](_0x580cb0,_0x5291c1,_0x467bc6,_0x3f73c9),'p':_0x574538[_0xbc26('0x33')]||0x0};logger[_0xbc26('0x34')](_0xbc26('0x35'),_0x269b78['id'],_0xbc26('0x36'),getIntervals(_0x467bc6[_0xbc26('0x30')],_0x574538)[_0xbc26('0x1f')](_0xbc26('0x37')));_0x312995[_0xbc26('0x1d')](_0x269b78);}else{logger[_0xbc26('0x38')](_0xbc26('0x39'),path[_0xbc26('0x1f')](__dirname,_0xbc26('0x17'),_0x574538[_0xbc26('0x1a')]+_0xbc26('0x19')));}}_0x467bc6['rules'][_0x580cb0]=new RuleEngine(_0x312995);_0x467bc6[_0xbc26('0x3a')][_0x580cb0][_0xbc26('0x3b')](_0x3f73c9,function(_0x120687){logger[_0xbc26('0x34')](_0xbc26('0x3c'),JSON['stringify'](_0x120687['matchPath']));if(_0x467bc6[_0xbc26('0x3a')][_0x580cb0]){_0x467bc6['rules'][_0x580cb0]['emit'](_0xbc26('0x3d'));}});return _0x5b9527({'code':0xc8,'message':_0x3f73c9});}else{if(_0x2028ff){logger['info'](util[_0xbc26('0xc')]('Skipped\x20routing\x20for\x20%s',_0x580cb0));}else{logger[_0xbc26('0x34')](_0xbc26('0x3e'));}return _0x5b9527({'code':0xc8,'message':_0x3f73c9});}}catch(_0xe7ee32){logger['error'](_0xe7ee32[_0xbc26('0x3f')]);return _0x37f1c0(_0x2cccb8['error'](0x1f4,_0xe7ee32));}}return _0x37f1c0('routing\x20is\x20empty');});},'AcceptMessage':function(_0xf2bc7){var _0x2630c0=this;return new Promise(function(_0xd7c0a8,_0x4e7002){if(_0xf2bc7['agent']&&_0xf2bc7['agent']['id']){if(_0x467bc6[_0xbc26('0x40')][_0xf2bc7['agent']['id']]){_0x467bc6[_0xbc26('0x40')][_0xf2bc7[_0xbc26('0x41')]['id']][_0xbc26('0x42')]=![];_0x467bc6[_0xbc26('0x40')][_0xf2bc7[_0xbc26('0x41')]['id']][_0xbc26('0x43')]=undefined;}}if(_0xf2bc7['message']&&_0xf2bc7[_0xbc26('0x24')]['id']){try{var _0x3d761f=getId(_0xf2bc7[_0xbc26('0x14')],_0xf2bc7[_0xbc26('0x24')]?_0xf2bc7['message']['id']:0x0,_0xf2bc7[_0xbc26('0x15')]?_0xf2bc7[_0xbc26('0x15')]['id']:0x0);if(_0x467bc6[_0xbc26('0x3a')][_0x3d761f]){_0x467bc6[_0xbc26('0x3a')][_0x3d761f][_0xbc26('0x44')](_0xbc26('0x45'));if(rpc[_0xf2bc7[_0xbc26('0x14')]+_0xbc26('0x46')]){rpc[_0xf2bc7[_0xbc26('0x14')]+_0xbc26('0x46')]['update'](_0x3d761f,{'UserId':_0xf2bc7[_0xbc26('0x24')][_0xbc26('0x47')]})['catch'](function(){logger[_0xbc26('0x38')](_0xbc26('0x48'));});}}return _0xd7c0a8({'code':0xc8,'message':_0xf2bc7});}catch(_0x52532e){logger[_0xbc26('0x38')](_0x52532e[_0xbc26('0x3f')]);return _0x4e7002(_0x2630c0[_0xbc26('0x38')](0x1f4,_0x52532e));}}logger[_0xbc26('0x38')](_0xbc26('0x49'));return _0x4e7002(_0x2630c0[_0xbc26('0x38')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3d3ccd){var _0x5ad037=this;return new Promise(function(_0x559dd2,_0x1155b4){if(_0x3d3ccd['agent']&&_0x3d3ccd[_0xbc26('0x41')]['id']){try{if(_0x467bc6[_0xbc26('0x40')][_0x3d3ccd[_0xbc26('0x41')]['id']]){_0x467bc6['agents'][_0x3d3ccd[_0xbc26('0x41')]['id']][_0xbc26('0x42')]=![];_0x467bc6[_0xbc26('0x40')][_0x3d3ccd[_0xbc26('0x41')]['id']][_0xbc26('0x43')]=undefined;}return _0x559dd2({'code':0xc8,'message':_0x3d3ccd});}catch(_0x45d6d1){logger['error'](_0x45d6d1['stack']);return _0x1155b4(_0x5ad037['error'](0x1f4,_0x45d6d1));}}logger[_0xbc26('0x38')]('message\x20is\x20empty');return _0x1155b4(_0x5ad037[_0xbc26('0x38')](0x1f4,_0xbc26('0x49')));});},'AbandonInteraction':function(_0x5a04d6){var _0x1f5c25=this;return new Promise(function(_0x207917,_0x5b578e){if(_0x5a04d6[_0xbc26('0x14')]&&_0x5a04d6[_0xbc26('0x15')]&&_0x5a04d6[_0xbc26('0x15')]['id']){try{var _0x15a880=getId(_0x5a04d6[_0xbc26('0x14')],_0x5a04d6[_0xbc26('0x24')]?_0x5a04d6[_0xbc26('0x24')]['id']:0x0,_0x5a04d6['interaction']?_0x5a04d6[_0xbc26('0x15')]['id']:0x0);if(_0x467bc6[_0xbc26('0x3a')][_0x15a880]){_0x467bc6[_0xbc26('0x3a')][_0x15a880][_0xbc26('0x44')](_0xbc26('0x45'));}return _0x207917({'code':0xc8,'message':_0x5a04d6});}catch(_0x4ece1e){logger[_0xbc26('0x38')](_0x4ece1e[_0xbc26('0x3f')]);return _0x5b578e(_0x1f5c25[_0xbc26('0x38')](0x1f4,_0x4ece1e));}}logger[_0xbc26('0x38')]('message\x20is\x20empty');return _0x5b578e(_0x1f5c25[_0xbc26('0x38')](0x1f4,_0xbc26('0x49')));});},'AgentCapacity':function(_0x59fa94){var _0x462cff=this;return new Promise(function(_0x561096,_0x1e7215){if(_0x467bc6[_0xbc26('0x40')]['hasOwnProperty'](_0x59fa94['id'])){for(var _0x198787 in _0x59fa94[_0xbc26('0x4a')]){if(_0x59fa94[_0xbc26('0x4a')][_0xbc26('0x4b')](_0x198787)){if(_0x467bc6[_0xbc26('0x40')][_0x59fa94['id']]['hasOwnProperty'](_0x198787+_0xbc26('0x4c'))){_0x467bc6[_0xbc26('0x40')][_0x59fa94['id']][_0x198787+_0xbc26('0x4c')]=parseInt(_0x59fa94[_0xbc26('0x4a')][_0x198787],0xa);}}}_0x467bc6[_0xbc26('0x40')][_0x59fa94['id']]['updateRealtime']();return _0x561096({'code':0xc8,'message':_0x467bc6[_0xbc26('0x40')][_0x59fa94['id']]});}else{return _0x1e7215(_0x462cff['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1b7c65){return new Promise(function(_0x3b36fc){var _0x5bc75a=_[_0xbc26('0x4d')](_0x467bc6['agents']);if(_0x1b7c65&&_0x1b7c65['id']){var _0x4c334b=_['find'](_0x5bc75a,function(_0x23af08){return _0x23af08['id']===_0x1b7c65['id'];});_0x3b36fc(_0x4c334b);}else{_0x3b36fc({'count':_0x5bc75a[_0xbc26('0x20')],'rows':_0x5bc75a});}});},'ChatQueues':function(){return new Promise(function(_0x26b847){var _0x899d20=[];for(var _0x133e9a in _0x467bc6['chatQueues']){if(_0x467bc6[_0xbc26('0x4e')]['hasOwnProperty'](_0x133e9a)){var _0x3995e6=_0x467bc6['chatQueues'][_0x133e9a];var _0x1b4ece={'id':_0x3995e6['id'],'available':_0x3995e6[_0xbc26('0x4f')],'loggedIn':_0x3995e6[_0xbc26('0x50')],'name':_0x3995e6[_0xbc26('0x51')],'paused':_0x3995e6[_0xbc26('0x52')],'waiting':_0x3995e6['waiting']};_0x899d20['push'](_0x1b4ece);}}_0x26b847({'count':_0x899d20[_0xbc26('0x20')],'rows':_0x899d20});});},'MailQueues':function(){return new Promise(function(_0x922392){var _0x389d75=[];for(var _0x3382d7 in _0x467bc6[_0xbc26('0x53')]){if(_0x467bc6[_0xbc26('0x53')][_0xbc26('0x4b')](_0x3382d7)){var _0x227b03=_0x467bc6['mailQueues'][_0x3382d7];var _0x59a095={'id':_0x227b03['id'],'available':_0x227b03[_0xbc26('0x4f')],'loggedIn':_0x227b03[_0xbc26('0x50')],'name':_0x227b03[_0xbc26('0x51')],'paused':_0x227b03[_0xbc26('0x52')],'waiting':_0x227b03[_0xbc26('0x54')]};_0x389d75[_0xbc26('0x1d')](_0x59a095);}}_0x922392({'count':_0x389d75[_0xbc26('0x20')],'rows':_0x389d75});});},'OpenchannelQueues':function(){return new Promise(function(_0x4cdcd9){var _0x37878c=[];for(var _0xd2297c in _0x467bc6[_0xbc26('0x55')]){if(_0x467bc6[_0xbc26('0x55')][_0xbc26('0x4b')](_0xd2297c)){var _0x3eedbf=_0x467bc6['openchannelQueues'][_0xd2297c];var _0x206806={'id':_0x3eedbf['id'],'available':_0x3eedbf[_0xbc26('0x4f')],'loggedIn':_0x3eedbf[_0xbc26('0x50')],'name':_0x3eedbf[_0xbc26('0x51')],'paused':_0x3eedbf[_0xbc26('0x52')],'waiting':_0x3eedbf[_0xbc26('0x54')]};_0x37878c[_0xbc26('0x1d')](_0x206806);}}_0x4cdcd9({'count':_0x37878c[_0xbc26('0x20')],'rows':_0x37878c});});},'SmsQueues':function(){return new Promise(function(_0x390232){var _0xae1dec=[];for(var _0x47c0f3 in _0x467bc6[_0xbc26('0x56')]){if(_0x467bc6['smsQueues'][_0xbc26('0x4b')](_0x47c0f3)){var _0x2cad8b=_0x467bc6[_0xbc26('0x56')][_0x47c0f3];var _0x58e38b={'id':_0x2cad8b['id'],'available':_0x2cad8b['available'],'loggedIn':_0x2cad8b['loggedIn'],'name':_0x2cad8b[_0xbc26('0x51')],'paused':_0x2cad8b['paused'],'waiting':_0x2cad8b[_0xbc26('0x54')]};_0xae1dec['push'](_0x58e38b);}}_0x390232({'count':_0xae1dec[_0xbc26('0x20')],'rows':_0xae1dec});});},'FaxQueues':function(){return new Promise(function(_0x2bd99f){var _0x26e33d=[];for(var _0x475702 in _0x467bc6[_0xbc26('0x57')]){if(_0x467bc6[_0xbc26('0x57')]['hasOwnProperty'](_0x475702)){var _0x205712=_0x467bc6[_0xbc26('0x57')][_0x475702];var _0x35671f={'id':_0x205712['id'],'available':_0x205712[_0xbc26('0x4f')],'loggedIn':_0x205712[_0xbc26('0x50')],'name':_0x205712[_0xbc26('0x51')],'paused':_0x205712[_0xbc26('0x52')],'waiting':_0x205712[_0xbc26('0x54')]};_0x26e33d[_0xbc26('0x1d')](_0x35671f);}}_0x2bd99f({'count':_0x26e33d[_0xbc26('0x20')],'rows':_0x26e33d});});},'WhatsappQueues':function(){return new Promise(function(_0x28ae32){var _0x229c7f=[];for(var _0x20ce68 in _0x467bc6[_0xbc26('0x58')]){if(_0x467bc6['whatsappQueues']['hasOwnProperty'](_0x20ce68)){var _0x1c07b2=_0x467bc6[_0xbc26('0x58')][_0x20ce68];var _0x2672ae={'id':_0x1c07b2['id'],'available':_0x1c07b2[_0xbc26('0x4f')],'loggedIn':_0x1c07b2['loggedIn'],'name':_0x1c07b2['name'],'paused':_0x1c07b2[_0xbc26('0x52')],'waiting':_0x1c07b2[_0xbc26('0x54')]};_0x229c7f['push'](_0x2672ae);}}_0x28ae32({'count':_0x229c7f['length'],'rows':_0x229c7f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x50df52){var _0xcc1447=_['values'](_0x467bc6[_0xbc26('0x59')]);_0x50df52({'count':_0xcc1447[_0xbc26('0x20')],'rows':_0xcc1447});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5c550c){var _0x5bb118=_[_0xbc26('0x4d')](_0x467bc6[_0xbc26('0x5a')]);_0x5c550c({'count':_0x5bb118[_0xbc26('0x20')],'rows':_0x5bb118});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x584ae3){var _0x49cee5=_[_0xbc26('0x4d')](_0x467bc6[_0xbc26('0x5b')]);_0x584ae3({'count':_0x49cee5[_0xbc26('0x20')],'rows':_0x49cee5});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x50e5b9){var _0xf3eca4=_[_0xbc26('0x4d')](_0x467bc6[_0xbc26('0x5c')]);_0x50e5b9({'count':_0xf3eca4['length'],'rows':_0xf3eca4});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xa6aa69){var _0x35ac10=_[_0xbc26('0x4d')](_0x467bc6[_0xbc26('0x5d')]);_0xa6aa69({'count':_0x35ac10['length'],'rows':_0x35ac10});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x361d8d){var _0x120e56=_[_0xbc26('0x4d')](_0x467bc6[_0xbc26('0x5e')]);_0x361d8d({'count':_0x120e56[_0xbc26('0x20')],'rows':_0x120e56});});}};var _0x565c88=jayson[_0xbc26('0x5f')](_0x5c4c07)[_0xbc26('0x60')]();_0x565c88['on'](_0xbc26('0x38'),function(_0x2c4374){logger[_0xbc26('0x38')](JSON[_0xbc26('0x61')](_0x2c4374));return _0x493877(_0x2c4374);});_0x565c88[_0xbc26('0x13')](0x232c,_0xbc26('0x62'),function(){console[_0xbc26('0x63')](_0xbc26('0x64'),0x232c);return _0x3940fb(_0xbc26('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d9a442f..f7ac948 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 _0x7d4c=['request','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','http'];(function(_0x5f3ab9,_0x99d12f){var _0x3f92c9=function(_0x294182){while(--_0x294182){_0x5f3ab9['push'](_0x5f3ab9['shift']());}};_0x3f92c9(++_0x99d12f);}(_0x7d4c,0x90));var _0xc7d4=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x7d4c[_0x4c3070];return _0x536a44;};'use strict';var util=require('util');var BPromise=require(_0xc7d4('0x0'));var jayson=require(_0xc7d4('0x1'));var _=require(_0xc7d4('0x2'));var logger=require(_0xc7d4('0x3'))(_0xc7d4('0x4'));var client=jayson['client'][_0xc7d4('0x5')]({'port':0x232a});function request(_0x599a4c,_0x94075b){return new BPromise(function(_0xcf2342,_0x58f2eb){return client[_0xc7d4('0x6')](_0x599a4c,_0x94075b)[_0xc7d4('0x7')](function(_0x326ce5){if(_0x326ce5['error']){return _0x58f2eb(_0x326ce5[_0xc7d4('0x8')]['message']);}else{return _0xcf2342(_0x326ce5[_0xc7d4('0x9')]);}})[_0xc7d4('0xa')](function(_0x526640){return _0x58f2eb(_0x526640);});});}exports[_0xc7d4('0xb')]=function(_0x5c0d91,_0x4eef47,_0x38c443){return function(_0x4b7569){if(_0x38c443[_0xc7d4('0xc')]&&!_0x38c443['rules'][_0x5c0d91]){logger['info'](_0xc7d4('0xd'),_0x5c0d91);return _0x4b7569[_0xc7d4('0xe')]();}var _0x1d1d5f=[];for(var _0x33b3bc=0x0;_0x33b3bc<_0x4eef47['length'];_0x33b3bc+=0x1){_0x1d1d5f['push'](request(_0xc7d4('0xf'),{'command':util['format'](_0xc7d4('0x10'),_0x4eef47[_0x33b3bc])})[_0xc7d4('0x7')](function(_0x46edb6){return _0x46edb6&&_0x46edb6[_0xc7d4('0x11')]&&_0x46edb6[_0xc7d4('0x11')][_0xc7d4('0x12')](_0xc7d4('0x13'))>=0x0?!![]:![];})[_0xc7d4('0xa')](function(_0x1ed7b4){logger['error'](_0xc7d4('0x14'),_0x5c0d91,_0x4eef47[_0x33b3bc]);}));}BPromise[_0xc7d4('0x15')](_0x1d1d5f)[_0xc7d4('0x7')](function(_0x2eab58){var _0x4622ed=_[_0xc7d4('0x16')](_0x2eab58);logger[_0xc7d4('0x17')](_0xc7d4('0x18'),_0x5c0d91,_0x4eef47[_0xc7d4('0x19')](_0xc7d4('0x1a')),_0x4622ed);_0x4b7569[_0xc7d4('0x1b')](_0x4622ed);})['catch'](function(_0x4320f6){console[_0xc7d4('0x1c')](_0x4320f6);logger[_0xc7d4('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x5c0d91,_0x4eef47[_0xc7d4('0x19')]('\x20|\x20'),_0x4320f6[_0xc7d4('0x1d')]);_0x4b7569[_0xc7d4('0xe')]();});};}; \ No newline at end of file +var _0x989e=['\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x989e,0x165));var _0xe989=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x989e[_0xee2e7a];return _0x319dd3;};'use strict';var util=require(_0xe989('0x0'));var BPromise=require(_0xe989('0x1'));var jayson=require(_0xe989('0x2'));var _=require(_0xe989('0x3'));var logger=require(_0xe989('0x4'))(_0xe989('0x5'));var client=jayson[_0xe989('0x6')][_0xe989('0x7')]({'port':0x232a});function request(_0x29abe9,_0xfae395){return new BPromise(function(_0x4801d,_0x4f3347){return client['request'](_0x29abe9,_0xfae395)[_0xe989('0x8')](function(_0x259a5d){if(_0x259a5d[_0xe989('0x9')]){return _0x4f3347(_0x259a5d[_0xe989('0x9')]['message']);}else{return _0x4801d(_0x259a5d[_0xe989('0xa')]);}})[_0xe989('0xb')](function(_0x522516){return _0x4f3347(_0x522516);});});}exports['condition']=function(_0x210ffc,_0x2f32b2,_0x282ec1){return function(_0x11f6b4){if(_0x282ec1[_0xe989('0xc')]&&!_0x282ec1['rules'][_0x210ffc]){logger[_0xe989('0xd')](_0xe989('0xe'),_0x210ffc);return _0x11f6b4[_0xe989('0xf')]();}var _0x3109de=[];for(var _0x8c60ae=0x0;_0x8c60ae<_0x2f32b2[_0xe989('0x10')];_0x8c60ae+=0x1){_0x3109de[_0xe989('0x11')](request(_0xe989('0x12'),{'command':util['format'](_0xe989('0x13'),_0x2f32b2[_0x8c60ae])})[_0xe989('0x8')](function(_0x706a36){return _0x706a36&&_0x706a36[_0xe989('0x14')]&&_0x706a36[_0xe989('0x14')][_0xe989('0x15')](_0xe989('0x16'))>=0x0?!![]:![];})[_0xe989('0xb')](function(_0x3a3b93){logger[_0xe989('0x9')](_0xe989('0x17'),_0x210ffc,_0x2f32b2[_0x8c60ae]);}));}BPromise[_0xe989('0x18')](_0x3109de)[_0xe989('0x8')](function(_0x20e459){var _0x3a7e6d=_[_0xe989('0x19')](_0x20e459);logger[_0xe989('0xd')](_0xe989('0x1a'),_0x210ffc,_0x2f32b2['join'](_0xe989('0x1b')),_0x3a7e6d);_0x11f6b4[_0xe989('0x1c')](_0x3a7e6d);})['catch'](function(_0x1bd81f){console[_0xe989('0x1d')](_0x1bd81f);logger[_0xe989('0x9')](_0xe989('0x1a'),_0x210ffc,_0x2f32b2[_0xe989('0x1e')](_0xe989('0x1b')),_0x1bd81f[_0xe989('0x1f')]);_0x11f6b4['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index cec7c04..781174f 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 _0xe5b5=['[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','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','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acwtime','agentacw','acwTimeout','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xe5b5[_0x596c43];return _0x4e1315;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var utils=require(_0x5e5b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3b3efd,_0x208070){utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x5'),_0x3b3efd[_0x5e5b('0x6')],_0x3b3efd[_0x5e5b('0x7')],_0x3b3efd[_0x5e5b('0x8')],_0x3b3efd[_0x5e5b('0x9')],_0x3b3efd[_0x5e5b('0xa')],_0x3b3efd[_0x5e5b('0xb')],_0x3b3efd[_0x5e5b('0xc')],_0x3b3efd[_0x5e5b('0xd')]));if(_0x3b3efd[_0x5e5b('0x8')]){utils[_0x5e5b('0xe')](_0x3b3efd[_0x5e5b('0x8')])[_0x5e5b('0xf')](function(_0x2aabb5){if(_0x2aabb5){_0x3b3efd[_0x5e5b('0x10')]=_0x2aabb5[_0x5e5b('0x10')];_0x3b3efd['agentacw']=_0x3b3efd[_0x5e5b('0x11')]?_0x2aabb5['acw']:![];_0x3b3efd[_0x5e5b('0x12')]=_0x3b3efd[_0x5e5b('0x13')]?_0x2aabb5[_0x5e5b('0x14')]:0x0;}utils[_0x5e5b('0x15')]('CreateVoiceAgentReport',_0x3b3efd);});}else{utils['request']('CreateVoiceAgentReport',_0x3b3efd);}if(_0x208070){delete transfers[_0x3b3efd[_0x5e5b('0x6')]];}else{delete agents[_0x3b3efd[_0x5e5b('0x16')]];}}exports[_0x5e5b('0x17')]=function(_0x1694ff){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x19'),_0x1694ff['uniqueid']),_0x1694ff);agents[_0x1694ff[_0x5e5b('0x16')]]=_0x1694ff;agents[_0x1694ff[_0x5e5b('0x16')]]['agentcalledAt']=utils[_0x5e5b('0x1a')]();agents[_0x1694ff['destuniqueid']]['lastevent']=_0x5e5b('0x1b');agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0xc')]=null;agents[_0x1694ff['destuniqueid']][_0x5e5b('0x1c')]=null;utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x1d'),_0x1694ff['uniqueid'],agents[_0x1694ff[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x1694ff[_0x5e5b('0x16')]));}catch(_0x538074){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')]('[%s][agents][agentcalled]',_0x1694ff[_0x5e5b('0x6')]),_0x538074);}};exports[_0x5e5b('0x1f')]=function(_0x3c488e){try{if(!_[_0x5e5b('0x20')](agents[_0x3c488e[_0x5e5b('0x16')]])){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e['uniqueid']),_0x3c488e);utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x22'),_0x3c488e[_0x5e5b('0x6')],agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x3c488e[_0x5e5b('0x16')]));agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x1f')]=!![];agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();agents[_0x3c488e['destuniqueid']][_0x5e5b('0xd')]=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['reason']=_0x5e5b('0x24');agents[_0x3c488e[_0x5e5b('0x16')]]['holdtime']=_0x3c488e[_0x5e5b('0x25')]?parseInt(_0x3c488e[_0x5e5b('0x25')])/0x3e8:0x0;agents[_0x3c488e[_0x5e5b('0x16')]][_0x5e5b('0x26')]=0x0;unanswered[_0x5e5b('0x27')](_0x3c488e[_0x5e5b('0x16')]);}}catch(_0x2cb695){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x21'),_0x3c488e[_0x5e5b('0x6')]),_0x2cb695);}};exports[_0x5e5b('0x28')]=function(_0x4ed688){try{_['forIn'](agents,function(_0x365f6f,_0x289f54){if(_0x365f6f[_0x5e5b('0x6')]==_0x4ed688[_0x5e5b('0x6')]&&!_[_0x5e5b('0x29')](unanswered,_0x365f6f['destuniqueid'])){utils[_0x5e5b('0x18')](util['format'](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x4ed688);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4ed688[_0x5e5b('0x6')],_0x365f6f[_0x5e5b('0x9')],_0x365f6f['destuniqueid']));_0x365f6f[_0x5e5b('0x1f')]=!![];_0x365f6f[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x365f6f[_0x5e5b('0xd')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2c')]=_0x5e5b('0x2b');_0x365f6f[_0x5e5b('0x2d')]=_0x4ed688['holdtime'];_0x365f6f[_0x5e5b('0x26')]=0x0;writeDB(_0x365f6f);}});}catch(_0x37b5be){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x2a'),_0x4ed688[_0x5e5b('0x6')]),_0x37b5be);}};exports['agentconnect']=function(_0x5b2ba5){try{if(agents[_0x5b2ba5[_0x5e5b('0x16')]]){utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][agentconnect]',_0x5b2ba5[_0x5e5b('0x6')]),_0x5b2ba5);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x2e'),_0x5b2ba5['uniqueid'],agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x5b2ba5['destuniqueid']));agents[_0x5b2ba5['destuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();agents[_0x5b2ba5[_0x5e5b('0x16')]]['connectedlinenum']=_0x5b2ba5[_0x5e5b('0xc')];agents[_0x5b2ba5['destuniqueid']]['connectedlinename']=_0x5b2ba5[_0x5e5b('0x1c')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];agents[_0x5b2ba5[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x30');_[_0x5e5b('0x31')](agents,function(_0x1034fa,_0x53b88f){if(_0x1034fa[_0x5e5b('0x16')]!=_0x5b2ba5[_0x5e5b('0x16')]&&_0x1034fa['uniqueid']==_0x5b2ba5[_0x5e5b('0x6')]){_0x1034fa['talktime']=0x0;_0x1034fa[_0x5e5b('0x2d')]=_0x5b2ba5[_0x5e5b('0x25')];_0x1034fa[_0x5e5b('0x1f')]=!![];_0x1034fa[_0x5e5b('0x23')]=utils[_0x5e5b('0x1a')]();_0x1034fa[_0x5e5b('0xd')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x2c')]=_0x5e5b('0x32');_0x1034fa[_0x5e5b('0x33')]=_0x5b2ba5[_0x5e5b('0x16')];_0x1034fa['answeredelsewheremembername']=_0x5b2ba5[_0x5e5b('0x9')];writeDB(_0x1034fa);}});}}catch(_0x40e8ce){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x34'),_0x5b2ba5[_0x5e5b('0x6')]),_0x40e8ce);}};exports['agentcomplete']=function(_0x6672d9){try{if(!_[_0x5e5b('0x20')](agents[_0x6672d9['destuniqueid']])){utils[_0x5e5b('0x18')](util['format']('[%s][agents][agentcomplete]',_0x6672d9['uniqueid']),_0x6672d9);utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x35'),_0x6672d9['uniqueid'],agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x9')],_0x6672d9[_0x5e5b('0x16')]));agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x11')]=!![];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x36')]=utils['now']();agents[_0x6672d9['destuniqueid']][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x6672d9['destuniqueid']]['agentcompleteAt'],agents[_0x6672d9[_0x5e5b('0x16')]]['agentconnectAt']);agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0x2c')]=_0x6672d9[_0x5e5b('0x2c')];agents[_0x6672d9[_0x5e5b('0x16')]][_0x5e5b('0xd')]=_0x5e5b('0x37');writeDB(agents[_0x6672d9['destuniqueid']]);}}catch(_0x26a0ff){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x38'),_0x6672d9['uniqueid']),_0x26a0ff);}};exports[_0x5e5b('0x39')]=function(_0x36d8fa){try{if(!_[_0x5e5b('0x20')](agents[_0x36d8fa[_0x5e5b('0x3a')]])){utils['debug'](util[_0x5e5b('0x4')](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x36d8fa);utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x3c'),_0x36d8fa[_0x5e5b('0x6')],agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x9')],agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x6')]));agents[_0x36d8fa[_0x5e5b('0x3a')]]['transfer']=!![];agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x3d')]=_0x5e5b('0x3e');agents[_0x36d8fa['transfereruniqueid']][_0x5e5b('0x3f')]=_0x36d8fa[_0x5e5b('0x40')];agents[_0x36d8fa[_0x5e5b('0x3a')]]['transferuniqueid']=agents[_0x36d8fa[_0x5e5b('0x3a')]][_0x5e5b('0x6')];}}catch(_0x239804){utils['error'](util['format'](_0x5e5b('0x3b'),_0x36d8fa['uniqueid']),_0x239804);}};exports['attendedtransfer']=function(_0x1dfe5d){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')]('[%s][agents][attendedtransfer]',_0x1dfe5d[_0x5e5b('0x41')]),_0x1dfe5d);if(_0x1dfe5d[_0x5e5b('0x41')]==_0x1dfe5d[_0x5e5b('0x42')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x43')]])){utils[_0x5e5b('0x3')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfer']=!![];agents[_0x1dfe5d[_0x5e5b('0x43')]]['transfertype']=_0x5e5b('0x44');agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x3f')]=_0x1dfe5d[_0x5e5b('0x45')];agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0x46')]=_0x1dfe5d[_0x5e5b('0x41')];}if(_0x1dfe5d[_0x5e5b('0x47')]&&agents[_0x1dfe5d['transfereeuniqueid']]){agents[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d[_0x5e5b('0x47')]]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x47')]]);transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d[_0x5e5b('0x43')]][_0x5e5b('0xb')];transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d['secondtransfereruniqueid']][_0x5e5b('0x4a')];transfers[_0x1dfe5d['transfereeuniqueid']][_0x5e5b('0x4b')]=utils['now']();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x47')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x47')]]['agententerreason']=0x2;}}else if(_0x1dfe5d[_0x5e5b('0x43')]==_0x1dfe5d[_0x5e5b('0x4c')]){if(!_[_0x5e5b('0x20')](agents[_0x1dfe5d[_0x5e5b('0x41')]])){utils['info'](util['format'](_0x5e5b('0x4d'),_0x1dfe5d[_0x5e5b('0x41')],agents[_0x1dfe5d['origtransfereruniqueid']][_0x5e5b('0x9')]));agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4e')]=!![];agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3d')]='ATTENDED';agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x3f')]=_0x1dfe5d['secondtransfererexten'];agents[_0x1dfe5d['origtransfereruniqueid']]['transferuniqueid']=_0x1dfe5d[_0x5e5b('0x43')];}if(_0x1dfe5d[_0x5e5b('0x4f')]&&agents[_0x1dfe5d[_0x5e5b('0x4f')]]){agents[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x1;transfers[_0x1dfe5d['transfertargetuniqueid']]=_[_0x5e5b('0x49')](agents[_0x1dfe5d[_0x5e5b('0x4f')]]);transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0xb')]=agents[_0x1dfe5d['origtransfereruniqueid']]['calleridnum'];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4a')]=agents[_0x1dfe5d[_0x5e5b('0x41')]][_0x5e5b('0x4a')];transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x4b')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d['transfertargetuniqueid']][_0x5e5b('0x2f')]=utils[_0x5e5b('0x1a')]();transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x2d')]=0x0;transfers[_0x1dfe5d[_0x5e5b('0x4f')]][_0x5e5b('0x48')]=0x2;}}}catch(_0x32874c){utils[_0x5e5b('0x1e')](util[_0x5e5b('0x4')](_0x5e5b('0x50'),_0x1dfe5d[_0x5e5b('0x41')]),_0x32874c);}};exports['hangup']=function(_0x2c8b25){try{utils[_0x5e5b('0x18')](util[_0x5e5b('0x4')](_0x5e5b('0x51'),_0x2c8b25[_0x5e5b('0x6')]),_0x2c8b25);if(agents[_0x2c8b25['uniqueid']]&&agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]===_0x5e5b('0x24')){if(_0x2c8b25[_0x5e5b('0x52')]==='21'){agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')]='rejected';agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]=_0x5e5b('0x53');}utils['info'](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25[_0x5e5b('0x6')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);var _0x19035d=unanswered['indexOf'](_0x2c8b25[_0x5e5b('0x6')]);if(_0x19035d>-0x1){unanswered[_0x5e5b('0x55')](_0x19035d,0x1);}}if(transfers[_0x2c8b25['uniqueid']]){transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];transfers[_0x2c8b25[_0x5e5b('0x6')]]['agentcompleteAt']=utils[_0x5e5b('0x1a')]();transfers[_0x2c8b25['uniqueid']]['talktime']=utils[_0x5e5b('0x56')](transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x36')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2f')]);transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=_0x5e5b('0x57');transfers[_0x2c8b25[_0x5e5b('0x6')]]['lastevent']=_0x5e5b('0x37');utils[_0x5e5b('0x3')](util['format'](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],transfers[_0x2c8b25['uniqueid']][_0x5e5b('0x9')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],transfers[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(transfers[_0x2c8b25['uniqueid']],!![]);}if(agents[_0x2c8b25[_0x5e5b('0x6')]]&&agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']){agents[_0x2c8b25['uniqueid']][_0x5e5b('0x11')]=!![];agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')]=utils[_0x5e5b('0x1a')]();agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x26')]=utils['diffTime'](agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x36')],agents[_0x2c8b25[_0x5e5b('0x6')]]['agentconnectAt']);agents[_0x2c8b25['uniqueid']][_0x5e5b('0x2c')]=agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x4e')]?'transfer':_0x5e5b('0x57');agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]='complete';utils[_0x5e5b('0x3')](util[_0x5e5b('0x4')](_0x5e5b('0x54'),_0x2c8b25['uniqueid'],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x9')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0x2c')],agents[_0x2c8b25[_0x5e5b('0x6')]][_0x5e5b('0xd')]));writeDB(agents[_0x2c8b25['uniqueid']]);}}catch(_0x202d01){utils[_0x5e5b('0x1e')](util['format'](_0x5e5b('0x51'),_0x2c8b25['uniqueid']),_0x202d01);}}; \ No newline at end of file +var _0x9c00=['acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','origtransfereruniqueid','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','[%s][agents][hangup]','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x9c00,0x1a0));var _0x09c0=function(_0x1410a9,_0x2d4289){_0x1410a9=_0x1410a9-0x0;var _0x43339d=_0x9c00[_0x1410a9];return _0x43339d;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e32e7,_0xe0d293){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x3'),_0x5e32e7[_0x09c0('0x4')],_0x5e32e7[_0x09c0('0x5')],_0x5e32e7[_0x09c0('0x6')],_0x5e32e7[_0x09c0('0x7')],_0x5e32e7['interface'],_0x5e32e7['calleridnum'],_0x5e32e7[_0x09c0('0x8')],_0x5e32e7[_0x09c0('0x9')]));if(_0x5e32e7[_0x09c0('0x6')]){utils[_0x09c0('0xa')](_0x5e32e7[_0x09c0('0x6')])['then'](function(_0x6558ca){if(_0x6558ca){_0x5e32e7[_0x09c0('0xb')]=_0x6558ca[_0x09c0('0xb')];_0x5e32e7[_0x09c0('0xc')]=_0x5e32e7[_0x09c0('0xd')]?_0x6558ca[_0x09c0('0xe')]:![];_0x5e32e7[_0x09c0('0xf')]=_0x5e32e7[_0x09c0('0xc')]?_0x6558ca[_0x09c0('0x10')]:0x0;}utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);});}else{utils[_0x09c0('0x11')](_0x09c0('0x12'),_0x5e32e7);}if(_0xe0d293){delete transfers[_0x5e32e7[_0x09c0('0x4')]];}else{delete agents[_0x5e32e7[_0x09c0('0x13')]];}}exports[_0x09c0('0x14')]=function(_0x6149a8){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x17'),_0x6149a8[_0x09c0('0x4')]),_0x6149a8);agents[_0x6149a8[_0x09c0('0x13')]]=_0x6149a8;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();agents[_0x6149a8[_0x09c0('0x13')]]['lastevent']='called';agents[_0x6149a8['destuniqueid']][_0x09c0('0x8')]=null;agents[_0x6149a8[_0x09c0('0x13')]][_0x09c0('0x1a')]=null;utils[_0x09c0('0x2')](util['format'](_0x09c0('0x1b'),_0x6149a8['uniqueid'],agents[_0x6149a8['destuniqueid']][_0x09c0('0x7')],_0x6149a8['destuniqueid']));}catch(_0x2cda5e){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentcalled]',_0x6149a8[_0x09c0('0x4')]),_0x2cda5e);}};exports[_0x09c0('0x1d')]=function(_0x8ad645){try{if(!_[_0x09c0('0x1e')](agents[_0x8ad645[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x8ad645);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x1f'),_0x8ad645['uniqueid'],agents[_0x8ad645['destuniqueid']][_0x09c0('0x7')],_0x8ad645[_0x09c0('0x13')]));agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x1d')]=!![];agents[_0x8ad645['destuniqueid']][_0x09c0('0x20')]=utils[_0x09c0('0x19')]();agents[_0x8ad645['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x09c0('0x21');agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x8ad645[_0x09c0('0x24')]?parseInt(_0x8ad645[_0x09c0('0x24')])/0x3e8:0x0;agents[_0x8ad645[_0x09c0('0x13')]][_0x09c0('0x25')]=0x0;unanswered['push'](_0x8ad645[_0x09c0('0x13')]);}}catch(_0x1bdde9){utils['error'](util[_0x09c0('0x16')]('[%s][agents][agentringnoanswer]',_0x8ad645[_0x09c0('0x4')]),_0x1bdde9);}};exports['queuecallerabandon']=function(_0x3ac8e4){try{_[_0x09c0('0x26')](agents,function(_0x108409,_0x4159bc){if(_0x108409['uniqueid']==_0x3ac8e4['uniqueid']&&!_[_0x09c0('0x27')](unanswered,_0x108409[_0x09c0('0x13')])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x28'),_0x3ac8e4['uniqueid']),_0x3ac8e4);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x29'),_0x3ac8e4['uniqueid'],_0x108409[_0x09c0('0x7')],_0x108409[_0x09c0('0x13')]));_0x108409[_0x09c0('0x1d')]=!![];_0x108409[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x108409[_0x09c0('0x9')]=_0x09c0('0x2a');_0x108409['reason']=_0x09c0('0x2a');_0x108409[_0x09c0('0x23')]=_0x3ac8e4[_0x09c0('0x23')];_0x108409[_0x09c0('0x25')]=0x0;writeDB(_0x108409);}});}catch(_0x2c1ad3){utils['error'](util[_0x09c0('0x16')](_0x09c0('0x28'),_0x3ac8e4[_0x09c0('0x4')]),_0x2c1ad3);}};exports[_0x09c0('0x2b')]=function(_0x353454){try{if(agents[_0x353454['destuniqueid']]){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x2c'),_0x353454[_0x09c0('0x4')]),_0x353454);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x2d'),_0x353454['uniqueid'],agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x7')],_0x353454[_0x09c0('0x13')]));agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x2e')]=utils['now']();agents[_0x353454['destuniqueid']]['connectedlinenum']=_0x353454['connectedlinenum'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x1a')]=_0x353454[_0x09c0('0x1a')];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x23')]=_0x353454['ringtime'];agents[_0x353454[_0x09c0('0x13')]][_0x09c0('0x9')]='connect';_[_0x09c0('0x26')](agents,function(_0x5d50b9,_0x3ee063){if(_0x5d50b9['destuniqueid']!=_0x353454[_0x09c0('0x13')]&&_0x5d50b9[_0x09c0('0x4')]==_0x353454['uniqueid']){_0x5d50b9[_0x09c0('0x25')]=0x0;_0x5d50b9[_0x09c0('0x23')]=_0x353454['ringtime'];_0x5d50b9[_0x09c0('0x1d')]=!![];_0x5d50b9[_0x09c0('0x20')]=utils[_0x09c0('0x19')]();_0x5d50b9[_0x09c0('0x9')]=_0x09c0('0x2f');_0x5d50b9[_0x09c0('0x22')]='answered_elsewhere';_0x5d50b9[_0x09c0('0x30')]=_0x353454[_0x09c0('0x13')];_0x5d50b9[_0x09c0('0x31')]=_0x353454['membername'];writeDB(_0x5d50b9);}});}}catch(_0x193ed2){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')]('[%s][agents][agentconnect]',_0x353454[_0x09c0('0x4')]),_0x193ed2);}};exports[_0x09c0('0xd')]=function(_0x52cd5c){try{if(!_['isNil'](agents[_0x52cd5c[_0x09c0('0x13')]])){utils[_0x09c0('0x15')](util['format'](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x52cd5c);utils['info'](util[_0x09c0('0x16')](_0x09c0('0x33'),_0x52cd5c[_0x09c0('0x4')],agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x7')],_0x52cd5c['destuniqueid']));agents[_0x52cd5c[_0x09c0('0x13')]]['agentcomplete']=!![];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x25')]=utils[_0x09c0('0x35')](agents[_0x52cd5c[_0x09c0('0x13')]]['agentcompleteAt'],agents[_0x52cd5c['destuniqueid']]['agentconnectAt']);agents[_0x52cd5c[_0x09c0('0x13')]][_0x09c0('0x22')]=_0x52cd5c[_0x09c0('0x22')];agents[_0x52cd5c['destuniqueid']][_0x09c0('0x9')]=_0x09c0('0x36');writeDB(agents[_0x52cd5c[_0x09c0('0x13')]]);}}catch(_0x198517){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x32'),_0x52cd5c[_0x09c0('0x4')]),_0x198517);}};exports[_0x09c0('0x37')]=function(_0x38085c){try{if(!_[_0x09c0('0x1e')](agents[_0x38085c[_0x09c0('0x38')]])){utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0x38085c);utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x3a'),_0x38085c[_0x09c0('0x4')],agents[_0x38085c['transfereruniqueid']][_0x09c0('0x7')],agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')]));agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3b')]=!![];agents[_0x38085c['transfereruniqueid']][_0x09c0('0x3c')]=_0x09c0('0x3d');agents[_0x38085c[_0x09c0('0x38')]]['transferexten']=_0x38085c[_0x09c0('0x3e')];agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x3f')]=agents[_0x38085c[_0x09c0('0x38')]][_0x09c0('0x4')];}}catch(_0xebfd6d){utils[_0x09c0('0x1c')](util['format'](_0x09c0('0x39'),_0x38085c[_0x09c0('0x4')]),_0xebfd6d);}};exports[_0x09c0('0x40')]=function(_0x428f9a){try{utils[_0x09c0('0x15')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a['origtransfereruniqueid']),_0x428f9a);if(_0x428f9a['origtransfereruniqueid']==_0x428f9a[_0x09c0('0x42')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x43')]])){utils['info'](util[_0x09c0('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3c')]='ATTENDED';agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x46')];agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x3f')]=_0x428f9a[_0x09c0('0x44')];}if(_0x428f9a[_0x09c0('0x47')]&&agents[_0x428f9a[_0x09c0('0x47')]]){agents[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a[_0x09c0('0x47')]]=_['clone'](agents[_0x428f9a[_0x09c0('0x47')]]);transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x49')]=agents[_0x428f9a[_0x09c0('0x43')]]['calleridnum'];transfers[_0x428f9a[_0x09c0('0x47')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x43')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x47')]]['agentcalledAt']=utils['now']();transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x47')]]['holdtime']=0x0;transfers[_0x428f9a[_0x09c0('0x47')]][_0x09c0('0x48')]=0x2;}}else if(_0x428f9a['secondtransfereruniqueid']==_0x428f9a[_0x09c0('0x4b')]){if(!_[_0x09c0('0x1e')](agents[_0x428f9a[_0x09c0('0x44')]])){utils[_0x09c0('0x2')](util['format'](_0x09c0('0x4c'),_0x428f9a[_0x09c0('0x44')],agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x7')]));agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3b')]=!![];agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x3c')]=_0x09c0('0x4d');agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x45')]=_0x428f9a[_0x09c0('0x4e')];agents[_0x428f9a[_0x09c0('0x44')]]['transferuniqueid']=_0x428f9a[_0x09c0('0x43')];}if(_0x428f9a[_0x09c0('0x4f')]&&agents[_0x428f9a[_0x09c0('0x4f')]]){agents[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x48')]=0x1;transfers[_0x428f9a['transfertargetuniqueid']]=_[_0x09c0('0x50')](agents[_0x428f9a[_0x09c0('0x4f')]]);transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x49')]=agents[_0x428f9a['origtransfereruniqueid']][_0x09c0('0x49')];transfers[_0x428f9a[_0x09c0('0x4f')]]['calleridname']=agents[_0x428f9a[_0x09c0('0x44')]][_0x09c0('0x4a')];transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x18')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a['transfertargetuniqueid']][_0x09c0('0x2e')]=utils[_0x09c0('0x19')]();transfers[_0x428f9a[_0x09c0('0x4f')]][_0x09c0('0x23')]=0x0;transfers[_0x428f9a[_0x09c0('0x4f')]]['agententerreason']=0x2;}}}catch(_0x422046){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x41'),_0x428f9a[_0x09c0('0x44')]),_0x422046);}};exports[_0x09c0('0x51')]=function(_0x59c57a){try{utils['debug'](util['format']('[%s][agents][hangup]',_0x59c57a[_0x09c0('0x4')]),_0x59c57a);if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]]['reason']===_0x09c0('0x21')){if(_0x59c57a['cause']==='21'){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='rejected';agents[_0x59c57a[_0x09c0('0x4')]]['lastevent']='rejected';}utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a['uniqueid']]);var _0x188af2=unanswered[_0x09c0('0x53')](_0x59c57a['uniqueid']);if(_0x188af2>-0x1){unanswered['splice'](_0x188af2,0x1);}}if(transfers[_0x59c57a[_0x09c0('0x4')]]){transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();transfers[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils[_0x09c0('0x35')](transfers[_0x59c57a['uniqueid']][_0x09c0('0x34')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')]='agent';transfers[_0x59c57a[_0x09c0('0x4')]]['lastevent']=_0x09c0('0x36');utils['info'](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a[_0x09c0('0x4')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],transfers[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],transfers[_0x59c57a['uniqueid']]['lastevent']));writeDB(transfers[_0x59c57a[_0x09c0('0x4')]],!![]);}if(agents[_0x59c57a[_0x09c0('0x4')]]&&agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]){agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0xd')]=!![];agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x34')]=utils[_0x09c0('0x19')]();agents[_0x59c57a[_0x09c0('0x4')]]['talktime']=utils['diffTime'](agents[_0x59c57a['uniqueid']][_0x09c0('0x34')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x2e')]);agents[_0x59c57a['uniqueid']]['reason']=agents[_0x59c57a[_0x09c0('0x4')]]['transfer']?_0x09c0('0x3b'):_0x09c0('0x54');agents[_0x59c57a['uniqueid']][_0x09c0('0x9')]='complete';utils[_0x09c0('0x2')](util[_0x09c0('0x16')](_0x09c0('0x52'),_0x59c57a['uniqueid'],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x7')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x22')],agents[_0x59c57a[_0x09c0('0x4')]][_0x09c0('0x9')]));writeDB(agents[_0x59c57a[_0x09c0('0x4')]]);}}catch(_0x4345a8){utils[_0x09c0('0x1c')](util[_0x09c0('0x16')](_0x09c0('0x55'),_0x59c57a[_0x09c0('0x4')]),_0x4345a8);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 05f465e..55be29e 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 _0x307e=['context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','diffTime','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','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','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','toLowerCase','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x307e,0xc9));var _0xe307=function(_0x4cc5fe,_0xb107ee){_0x4cc5fe=_0x4cc5fe-0x0;var _0x26309c=_0x307e[_0x4cc5fe];return _0x26309c;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var utils=require(_0xe307('0x2'));var transfers=require(_0xe307('0x3'));var dispositions=[_0xe307('0x4'),'FAILED',_0xe307('0x5'),_0xe307('0x4'),'NO\x20ANSWER',_0xe307('0x4'),'ANSWERED',_0xe307('0x6'),_0xe307('0x5'),_0xe307('0x5'),'FAILED'];var channels={};function writeDB(_0x528e79){var _0x3645ea;if(transfers[_0xe307('0x7')][_0x528e79[_0xe307('0x8')]]){_0x3645ea=_0x528e79[_0xe307('0x8')];_0x528e79[_0xe307('0x8')]=transfers[_0xe307('0x7')][_0x528e79[_0xe307('0x8')]][_0xe307('0x9')];}utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0xc'),_0x528e79[_0xe307('0x8')],_0x528e79[_0xe307('0xd')],_0x528e79[_0xe307('0xe')],_0x528e79[_0xe307('0xf')],_0x528e79[_0xe307('0x10')],_0x528e79[_0xe307('0x11')],_0x528e79[_0xe307('0x12')],_0x528e79[_0xe307('0x13')]));if(_0x528e79['accountcode']){utils[_0xe307('0x14')](_0x528e79[_0xe307('0x15')])['then'](function(_0x3faac5){if(_0x3faac5){_0x528e79[_0xe307('0x16')]=_0x3faac5['id'];}utils[_0xe307('0x17')](_0xe307('0x18'),_0x528e79);});}else{utils[_0xe307('0x17')](_0xe307('0x18'),_0x528e79);}if(channels[_0x528e79[_0xe307('0x8')]]){delete channels[_0x528e79['uniqueid']];}else if(_0x3645ea&&channels[_0x3645ea]){if(!transfers[_0xe307('0x7')][_0x3645ea][_0xe307('0x19')])delete transfers[_0xe307('0x7')][_0x3645ea];delete channels[_0x3645ea];}}exports[_0xe307('0x1a')]=function(_0x23e416){try{utils['debug'](util['format'](_0xe307('0x1b'),_0x23e416['uniqueid']),_0x23e416);if(_0x23e416[_0xe307('0x8')]==_0x23e416[_0xe307('0x1c')]&&_0x23e416[_0xe307('0xd')]!=_0xe307('0x1d')){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x1e'),_0x23e416[_0xe307('0x8')],_0x23e416[_0xe307('0x1f')],_0x23e416[_0xe307('0x20')]));channels[_0x23e416[_0xe307('0x8')]]={'uniqueid':_0x23e416[_0xe307('0x8')],'accountcode':_0x23e416[_0xe307('0x15')],'source':_0x23e416[_0xe307('0x11')],'destination':_0x23e416[_0xe307('0x20')],'destinationcontext':_0x23e416['context'],'channel':_0x23e416[_0xe307('0xd')],'starttime':utils[_0xe307('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe307('0x4'),'amaflags':_0xe307('0x22')};}}catch(_0x4fdf45){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x1b'),_0x23e416[_0xe307('0x8')]),_0x4fdf45);}};exports[_0xe307('0x24')]=function(_0x51c015){try{utils['debug'](util[_0xe307('0xb')](_0xe307('0x25'),_0x51c015[_0xe307('0x8')]),_0x51c015);if(!_[_0xe307('0x26')](channels[_0x51c015[_0xe307('0x8')]])&&_0x51c015[_0xe307('0x27')]==0x6){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x28'),_0x51c015['uniqueid'],_0x51c015[_0xe307('0x1f')],_0x51c015[_0xe307('0xd')]));if(_['isNil'](channels[_0x51c015[_0xe307('0x8')]]['systemanswertime'])){channels[_0x51c015['uniqueid']][_0xe307('0x29')]=utils[_0xe307('0x21')]();}}else if(!_[_0xe307('0x26')](channels[_0x51c015['linkedid']])&&_0x51c015[_0xe307('0x27')]==0x6&&_0x51c015['context']!=_0xe307('0x2a')){utils['info'](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x51c015['uniqueid'],_0x51c015[_0xe307('0x1c')],_0x51c015[_0xe307('0x1f')],_0x51c015['channel']));channels[_0x51c015[_0xe307('0x1c')]][_0xe307('0x15')]=_0x51c015[_0xe307('0x15')];channels[_0x51c015[_0xe307('0x1c')]]['destinationchannel']=_0x51c015[_0xe307('0xd')];if(_['isNil'](channels[_0x51c015['linkedid']][_0xe307('0x2b')])){channels[_0x51c015[_0xe307('0x1c')]][_0xe307('0x2b')]=utils[_0xe307('0x21')]();}channels[_0x51c015['linkedid']][_0xe307('0x2c')]=dispositions[_['toNumber'](_0x51c015[_0xe307('0x27')])]||_0xe307('0x2d');}}catch(_0x5d6290){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x25'),_0x51c015[_0xe307('0x8')]),_0x5d6290);}};exports['hangup']=function(_0x4ccf57){try{if(!_[_0xe307('0x26')](channels[_0x4ccf57[_0xe307('0x8')]])){utils['debug'](util[_0xe307('0xb')](_0xe307('0x2e'),_0x4ccf57[_0xe307('0x8')]),_0x4ccf57);if(_['isNil'](channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x2f')])){channels[_0x4ccf57['uniqueid']]['callerid']=_0x4ccf57['calleridname']+'\x20<'+_0x4ccf57[_0xe307('0x11')]+'>';}utils['info'](util[_0xe307('0xb')](_0xe307('0x30'),_0x4ccf57[_0xe307('0x8')],channels[_0x4ccf57[_0xe307('0x8')]]['callerid'],_0x4ccf57[_0xe307('0x31')]));channels[_0x4ccf57[_0xe307('0x8')]]['endtime']=utils['now']();channels[_0x4ccf57[_0xe307('0x8')]]['duration']=utils['diffTime'](channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x32')],channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x33')]);channels[_0x4ccf57[_0xe307('0x8')]]['billableseconds']=channels[_0x4ccf57['uniqueid']][_0xe307('0x2b')]?utils[_0xe307('0x34')](channels[_0x4ccf57[_0xe307('0x8')]]['endtime'],channels[_0x4ccf57[_0xe307('0x8')]][_0xe307('0x2b')]):0x0;writeDB(channels[_0x4ccf57['uniqueid']]);}}catch(_0x2c06c5){utils['error'](util[_0xe307('0xb')]('[%s][calls][hangup]',_0x4ccf57['uniqueid']),_0x2c06c5);}};exports[_0xe307('0x35')]=function(_0x4822f1){try{if(!_[_0xe307('0x26')](channels[_0x4822f1[_0xe307('0x36')]])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x38'),_0x4822f1[_0xe307('0x39')]),_0x4822f1);if(channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0xd')]==_0x4822f1['transfereechannel']){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x3a'),_0x4822f1[_0xe307('0x39')],_0x4822f1[_0xe307('0x36')],_0x4822f1[_0xe307('0x3b')]));channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0x3c')]=_0x4822f1[_0xe307('0x3b')];channels[_0x4822f1['localtwolinkedid']][_0xe307('0x3d')]=_0xe307('0x3e');}else if(channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0xd')]=_0x4822f1[_0xe307('0x3f')]){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4822f1[_0xe307('0x39')],_0x4822f1['localtwolinkedid'],_0x4822f1[_0xe307('0x40')]));channels[_0x4822f1[_0xe307('0x36')]]['destinationchannel']=_0x4822f1['origtransfererchannel'];channels[_0x4822f1[_0xe307('0x36')]][_0xe307('0x3d')]=_0xe307('0x3e');}}}catch(_0x220c21){utils['error'](util[_0xe307('0xb')](_0xe307('0x38'),_0x4822f1[_0xe307('0x39')]),_0x220c21);}};exports[_0xe307('0x41')]=function(_0x42da2d){try{if(!_[_0xe307('0x26')](channels[_0x42da2d['uniqueid']])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x42'),_0x42da2d[_0xe307('0x8')]),_0x42da2d);channels[_0x42da2d[_0xe307('0x8')]][_0xe307('0x43')]=utils[_0xe307('0x21')]();utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x44'),_0x42da2d['uniqueid'],channels[_0x42da2d[_0xe307('0x8')]]['musiconholdstartAt']));}}catch(_0xcab77e){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x42'),_0x42da2d[_0xe307('0x8')]),_0xcab77e);}};exports[_0xe307('0x45')]=function(_0x5223f9){try{if(!_[_0xe307('0x26')](channels[_0x5223f9['uniqueid']])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x46'),_0x5223f9['uniqueid']),_0x5223f9);if(!_['isNil'](channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x43')])){channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x47')]+=utils['diffTime'](utils[_0xe307('0x21')](),channels[_0x5223f9['uniqueid']][_0xe307('0x43')]);utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5223f9[_0xe307('0x8')],channels[_0x5223f9[_0xe307('0x8')]][_0xe307('0x47')]));delete channels[_0x5223f9[_0xe307('0x8')]]['musiconholdstartAt'];}}}catch(_0x1c9a07){utils[_0xe307('0x23')](util[_0xe307('0xb')](_0xe307('0x46'),_0x5223f9['uniqueid']),_0x1c9a07);}};exports[_0xe307('0x48')]=function(_0xdab91b){try{if(!_[_0xe307('0x26')](channels[_0xdab91b[_0xe307('0x8')]])){utils['debug'](util[_0xe307('0xb')](_0xe307('0x49'),_0xdab91b[_0xe307('0x8')]),_0xdab91b);if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')]['xmd-originatecalleridnum'])){utils[_0xe307('0xa')](util['format'](_0xe307('0x4b'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x4c')]=_0xdab91b[_0xe307('0x4d')];}if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x4e')])){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x4f'),_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b['uniqueid']][_0xe307('0x50')]=_0xdab91b['value'];channels[_0xdab91b[_0xe307('0x8')]]['callerid']='\x22'+_0xdab91b['value']+_0xe307('0x51')+_0xdab91b[_0xe307('0x4d')]+'>';}if(!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x52')])||!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x53')])){utils['info'](util['format'](_0xe307('0x54'),_0xdab91b[_0xe307('0x8')],!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x52')])?_0xe307('0x52'):_0xe307('0x53'),_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x2f')]=_0xdab91b[_0xe307('0x4d')];}if(!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x55')])||!_[_0xe307('0x26')](_0xdab91b['variable'][_0xe307('0x56')])){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xdab91b[_0xe307('0x8')],!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')]['xmd-queue'])?'xmd-queue':_0xe307('0x56'),_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x57')]=_0xe307('0x58');channels[_0xdab91b['uniqueid']][_0xe307('0x59')]=_0xdab91b[_0xe307('0x4d')];channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0xe')]=!![];}if(!_[_0xe307('0x26')](_0xdab91b[_0xe307('0x4a')][_0xe307('0x5a')])){utils[_0xe307('0xa')](util['format'](_0xe307('0x5b'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x5c')]=_0xdab91b['value'];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x5d')])){utils[_0xe307('0xa')](util[_0xe307('0xb')](_0xe307('0x5e'),_0xdab91b[_0xe307('0x8')],_0xdab91b['value']));channels[_0xdab91b['uniqueid']][_0xe307('0x5f')]=_0xdab91b[_0xe307('0x4d')];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x60')])){utils['info'](util[_0xe307('0xb')](_0xe307('0x61'),_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x62')]=_0xdab91b['value'];}if(!_['isNil'](_0xdab91b[_0xe307('0x4a')][_0xe307('0x63')])){utils[_0xe307('0xa')](util[_0xe307('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xdab91b[_0xe307('0x8')],_0xdab91b[_0xe307('0x4d')]));channels[_0xdab91b[_0xe307('0x8')]][_0xe307('0x63')]=_0xdab91b[_0xe307('0x4d')];}}}catch(_0x344f6c){utils[_0xe307('0x23')](util['format']('[%s][calls][varset]',_0xdab91b['uniqueid']),_0x344f6c);}};exports[_0xe307('0x64')]=function(_0x16912d){try{if(!_[_0xe307('0x26')](channels[_0x16912d[_0xe307('0x8')]])){utils[_0xe307('0x37')](util[_0xe307('0xb')](_0xe307('0x65'),_0x16912d[_0xe307('0x8')]),_0x16912d);utils[_0xe307('0xa')](util['format'](_0xe307('0x66'),_0x16912d[_0xe307('0x8')],_0x16912d[_0xe307('0x67')],_0x16912d[_0xe307('0x68')]));if(_0x16912d[_0xe307('0x67')]['toLowerCase']()==_0xe307('0x69')&&_[_0xe307('0x6a')](_0x16912d[_0xe307('0x68')]['toLowerCase'](),_0xe307('0x6b'))){var _0x3f3a1b=_0x16912d['appdata'][_0xe307('0x6c')]('=');var _0x37f9b5=_0x3f3a1b[0x0][_0xe307('0x6d')](_0x3f3a1b[0x0]['lastIndexOf']('(')+0x1,_0x3f3a1b[0x0][_0xe307('0x6e')](')'));var _0xe7beb6=_0x3f3a1b[0x1];channels[_0x16912d['uniqueid']][_0x37f9b5]=_0xe7beb6;}if(!_[_0xe307('0x6f')](['hangup',_0xe307('0x70'),_0xe307('0x71'),_0xe307('0x69'),_0xe307('0x72')],_0x16912d[_0xe307('0x67')][_0xe307('0x73')]())){channels[_0x16912d[_0xe307('0x8')]][_0xe307('0x57')]=_0x16912d[_0xe307('0x67')];channels[_0x16912d[_0xe307('0x8')]]['lastdata']=_0x16912d[_0xe307('0x68')];}}}catch(_0x4d4743){utils[_0xe307('0x23')](util['format'](_0xe307('0x65'),_0x16912d['uniqueid']),_0x4d4743);}}; \ No newline at end of file +var _0xea1c=['calleridname','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','transfertargetchannel','userfield','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','set','gotoif','[%s][calls][newexten]','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','CreateVoiceCallReport','request','recording','newchannel','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid'];(function(_0x2021aa,_0x1ec391){var _0x58634b=function(_0x233fa3){while(--_0x233fa3){_0x2021aa['push'](_0x2021aa['shift']());}};_0x58634b(++_0x1ec391);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xcea1('0x0'));var transfers=require(_0xcea1('0x1'));var dispositions=[_0xcea1('0x2'),_0xcea1('0x3'),'FAILED',_0xcea1('0x2'),_0xcea1('0x2'),_0xcea1('0x2'),_0xcea1('0x4'),_0xcea1('0x5'),_0xcea1('0x3'),_0xcea1('0x3'),_0xcea1('0x3')];var channels={};function writeDB(_0x93dfa5){var _0x1441c6;if(transfers[_0xcea1('0x6')][_0x93dfa5['uniqueid']]){_0x1441c6=_0x93dfa5[_0xcea1('0x7')];_0x93dfa5[_0xcea1('0x7')]=transfers[_0xcea1('0x6')][_0x93dfa5['uniqueid']][_0xcea1('0x8')];}utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0xb'),_0x93dfa5[_0xcea1('0x7')],_0x93dfa5[_0xcea1('0xc')],_0x93dfa5[_0xcea1('0xd')],_0x93dfa5[_0xcea1('0xe')],_0x93dfa5[_0xcea1('0xf')],_0x93dfa5[_0xcea1('0x10')],_0x93dfa5[_0xcea1('0x11')],_0x93dfa5['lastevent']));if(_0x93dfa5[_0xcea1('0x12')]){utils['getUserByInternal'](_0x93dfa5[_0xcea1('0x12')])[_0xcea1('0x13')](function(_0x3ab65e){if(_0x3ab65e){_0x93dfa5['UserId']=_0x3ab65e['id'];}utils['request'](_0xcea1('0x14'),_0x93dfa5);});}else{utils[_0xcea1('0x15')](_0xcea1('0x14'),_0x93dfa5);}if(channels[_0x93dfa5[_0xcea1('0x7')]]){delete channels[_0x93dfa5[_0xcea1('0x7')]];}else if(_0x1441c6&&channels[_0x1441c6]){if(!transfers[_0xcea1('0x6')][_0x1441c6][_0xcea1('0x16')])delete transfers[_0xcea1('0x6')][_0x1441c6];delete channels[_0x1441c6];}}exports[_0xcea1('0x17')]=function(_0x1ae683){try{utils[_0xcea1('0x18')](util['format']('[%s][calls][newchannel]',_0x1ae683[_0xcea1('0x7')]),_0x1ae683);if(_0x1ae683[_0xcea1('0x7')]==_0x1ae683['linkedid']&&_0x1ae683['channel']!=_0xcea1('0x19')){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x1a'),_0x1ae683['uniqueid'],_0x1ae683[_0xcea1('0x1b')],_0x1ae683[_0xcea1('0x1c')]));channels[_0x1ae683[_0xcea1('0x7')]]={'uniqueid':_0x1ae683[_0xcea1('0x7')],'accountcode':_0x1ae683[_0xcea1('0x12')],'source':_0x1ae683['calleridnum'],'destination':_0x1ae683[_0xcea1('0x1c')],'destinationcontext':_0x1ae683[_0xcea1('0x1b')],'channel':_0x1ae683[_0xcea1('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xcea1('0x1d')};}}catch(_0x2cadcd){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x1f'),_0x1ae683[_0xcea1('0x7')]),_0x2cadcd);}};exports[_0xcea1('0x20')]=function(_0x2fb482){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x2fb482['uniqueid']),_0x2fb482);if(!_['isNil'](channels[_0x2fb482['uniqueid']])&&_0x2fb482[_0xcea1('0x21')]==0x6){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x22'),_0x2fb482[_0xcea1('0x7')],_0x2fb482['context'],_0x2fb482[_0xcea1('0xc')]));if(_[_0xcea1('0x23')](channels[_0x2fb482[_0xcea1('0x7')]][_0xcea1('0x24')])){channels[_0x2fb482[_0xcea1('0x7')]]['systemanswertime']=utils[_0xcea1('0x25')]();}}else if(!_[_0xcea1('0x23')](channels[_0x2fb482[_0xcea1('0x26')]])&&_0x2fb482[_0xcea1('0x21')]==0x6&&_0x2fb482[_0xcea1('0x1b')]!=_0xcea1('0x27')){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x28'),_0x2fb482['uniqueid'],_0x2fb482[_0xcea1('0x26')],_0x2fb482[_0xcea1('0x1b')],_0x2fb482['channel']));channels[_0x2fb482['linkedid']][_0xcea1('0x12')]=_0x2fb482[_0xcea1('0x12')];channels[_0x2fb482[_0xcea1('0x26')]]['destinationchannel']=_0x2fb482[_0xcea1('0xc')];if(_[_0xcea1('0x23')](channels[_0x2fb482[_0xcea1('0x26')]][_0xcea1('0x29')])){channels[_0x2fb482[_0xcea1('0x26')]]['answertime']=utils['now']();}channels[_0x2fb482[_0xcea1('0x26')]][_0xcea1('0x2a')]=dispositions[_[_0xcea1('0x2b')](_0x2fb482[_0xcea1('0x21')])]||_0xcea1('0x4');}}catch(_0x187986){utils['error'](util['format'](_0xcea1('0x2c'),_0x2fb482[_0xcea1('0x7')]),_0x187986);}};exports[_0xcea1('0x2d')]=function(_0x3a20e9){try{if(!_[_0xcea1('0x23')](channels[_0x3a20e9[_0xcea1('0x7')]])){utils[_0xcea1('0x18')](util['format'](_0xcea1('0x2e'),_0x3a20e9['uniqueid']),_0x3a20e9);if(_[_0xcea1('0x23')](channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x2f')])){channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x2f')]=_0x3a20e9[_0xcea1('0x30')]+'\x20<'+_0x3a20e9[_0xcea1('0x10')]+'>';}utils[_0xcea1('0x9')](util[_0xcea1('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3a20e9[_0xcea1('0x7')],channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x2f')],_0x3a20e9[_0xcea1('0x31')]));channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x32')]=utils[_0xcea1('0x25')]();channels[_0x3a20e9[_0xcea1('0x7')]]['duration']=utils[_0xcea1('0x33')](channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x32')],channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x34')]);channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x35')]=channels[_0x3a20e9[_0xcea1('0x7')]][_0xcea1('0x29')]?utils[_0xcea1('0x33')](channels[_0x3a20e9[_0xcea1('0x7')]]['endtime'],channels[_0x3a20e9['uniqueid']][_0xcea1('0x29')]):0x0;writeDB(channels[_0x3a20e9[_0xcea1('0x7')]]);}}catch(_0x4cdaba){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x2e'),_0x3a20e9['uniqueid']),_0x4cdaba);}};exports[_0xcea1('0x36')]=function(_0x2d0f55){try{if(!_[_0xcea1('0x23')](channels[_0x2d0f55[_0xcea1('0x37')]])){utils['debug'](util[_0xcea1('0xa')](_0xcea1('0x38'),_0x2d0f55[_0xcea1('0x39')]),_0x2d0f55);if(channels[_0x2d0f55['localtwolinkedid']]['channel']==_0x2d0f55[_0xcea1('0x3a')]){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x3b'),_0x2d0f55[_0xcea1('0x39')],_0x2d0f55['localtwolinkedid'],_0x2d0f55['secondtransfererchannel']));channels[_0x2d0f55['localtwolinkedid']]['destinationchannel']=_0x2d0f55['secondtransfererchannel'];channels[_0x2d0f55[_0xcea1('0x37')]]['userfield']='_attended';}else if(channels[_0x2d0f55[_0xcea1('0x37')]][_0xcea1('0xc')]=_0x2d0f55[_0xcea1('0x3c')]){utils[_0xcea1('0x9')](util['format'](_0xcea1('0x3b'),_0x2d0f55[_0xcea1('0x39')],_0x2d0f55[_0xcea1('0x37')],_0x2d0f55['origtransfererchannel']));channels[_0x2d0f55[_0xcea1('0x37')]]['destinationchannel']=_0x2d0f55['origtransfererchannel'];channels[_0x2d0f55[_0xcea1('0x37')]][_0xcea1('0x3d')]=_0xcea1('0x3e');}}}catch(_0x41541e){utils['error'](util[_0xcea1('0xa')](_0xcea1('0x38'),_0x2d0f55[_0xcea1('0x39')]),_0x41541e);}};exports[_0xcea1('0x3f')]=function(_0xbd502f){try{if(!_['isNil'](channels[_0xbd502f['uniqueid']])){utils['debug'](util[_0xcea1('0xa')](_0xcea1('0x40'),_0xbd502f[_0xcea1('0x7')]),_0xbd502f);channels[_0xbd502f['uniqueid']][_0xcea1('0x41')]=utils[_0xcea1('0x25')]();utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x42'),_0xbd502f[_0xcea1('0x7')],channels[_0xbd502f[_0xcea1('0x7')]][_0xcea1('0x41')]));}}catch(_0x4cf447){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x40'),_0xbd502f['uniqueid']),_0x4cf447);}};exports['musiconholdstop']=function(_0x595f8d){try{if(!_[_0xcea1('0x23')](channels[_0x595f8d[_0xcea1('0x7')]])){utils['debug'](util[_0xcea1('0xa')]('[%s][calls][musiconholdstop]',_0x595f8d[_0xcea1('0x7')]),_0x595f8d);if(!_['isNil'](channels[_0x595f8d[_0xcea1('0x7')]][_0xcea1('0x41')])){channels[_0x595f8d[_0xcea1('0x7')]][_0xcea1('0x43')]+=utils[_0xcea1('0x33')](utils['now'](),channels[_0x595f8d[_0xcea1('0x7')]]['musiconholdstartAt']);utils[_0xcea1('0x9')](util['format'](_0xcea1('0x44'),_0x595f8d['uniqueid'],channels[_0x595f8d[_0xcea1('0x7')]]['mohtime']));delete channels[_0x595f8d['uniqueid']]['musiconholdstartAt'];}}}catch(_0x4d8b96){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x45'),_0x595f8d[_0xcea1('0x7')]),_0x4d8b96);}};exports[_0xcea1('0x46')]=function(_0x2b5191){try{if(!_['isNil'](channels[_0x2b5191[_0xcea1('0x7')]])){utils[_0xcea1('0x18')](util[_0xcea1('0xa')](_0xcea1('0x47'),_0x2b5191['uniqueid']),_0x2b5191);if(!_['isNil'](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x49')])){utils[_0xcea1('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2b5191['uniqueid'],_0x2b5191[_0xcea1('0x4a')]));channels[_0x2b5191[_0xcea1('0x7')]][_0xcea1('0x4b')]=_0x2b5191[_0xcea1('0x4a')];}if(!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')]['xmd-phone'])){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x4c'),_0x2b5191[_0xcea1('0x7')],_0x2b5191[_0xcea1('0x4a')]));channels[_0x2b5191['uniqueid']][_0xcea1('0x4d')]=_0x2b5191['value'];channels[_0x2b5191[_0xcea1('0x7')]]['callerid']='\x22'+_0x2b5191[_0xcea1('0x4a')]+_0xcea1('0x4e')+_0x2b5191[_0xcea1('0x4a')]+'>';}if(!_['isNil'](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x4f')])||!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x50')])){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x51'),_0x2b5191['uniqueid'],!_[_0xcea1('0x23')](_0x2b5191['variable'][_0xcea1('0x4f')])?_0xcea1('0x4f'):_0xcea1('0x50'),_0x2b5191[_0xcea1('0x4a')]));channels[_0x2b5191['uniqueid']][_0xcea1('0x2f')]=_0x2b5191['value'];}if(!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x52')])||!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x53')])){utils['info'](util[_0xcea1('0xa')](_0xcea1('0x51'),_0x2b5191[_0xcea1('0x7')],!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x52')])?_0xcea1('0x52'):_0xcea1('0x53'),_0x2b5191[_0xcea1('0x4a')]));channels[_0x2b5191['uniqueid']][_0xcea1('0x54')]=_0xcea1('0x55');channels[_0x2b5191[_0xcea1('0x7')]][_0xcea1('0x56')]=_0x2b5191[_0xcea1('0x4a')];channels[_0x2b5191['uniqueid']]['queue']=!![];}if(!_[_0xcea1('0x23')](_0x2b5191['variable'][_0xcea1('0x57')])){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x58'),_0x2b5191[_0xcea1('0x7')],_0x2b5191['value']));channels[_0x2b5191[_0xcea1('0x7')]]['ContactId']=_0x2b5191['value'];}if(!_[_0xcea1('0x23')](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x59')])){utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x5a'),_0x2b5191[_0xcea1('0x7')],_0x2b5191[_0xcea1('0x4a')]));channels[_0x2b5191['uniqueid']][_0xcea1('0x5b')]=_0x2b5191[_0xcea1('0x4a')];}if(!_['isNil'](_0x2b5191[_0xcea1('0x48')][_0xcea1('0x5c')])){utils[_0xcea1('0x9')](util[_0xcea1('0xa')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2b5191[_0xcea1('0x7')],_0x2b5191['value']));channels[_0x2b5191['uniqueid']]['routeid']=_0x2b5191[_0xcea1('0x4a')];}if(!_['isNil'](_0x2b5191['variable']['sipcallid'])){utils['info'](util['format'](_0xcea1('0x5d'),_0x2b5191[_0xcea1('0x7')],_0x2b5191['value']));channels[_0x2b5191[_0xcea1('0x7')]][_0xcea1('0x5e')]=_0x2b5191[_0xcea1('0x4a')];}}}catch(_0x35522a){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x47'),_0x2b5191[_0xcea1('0x7')]),_0x35522a);}};exports[_0xcea1('0x5f')]=function(_0x10efc7){try{if(!_[_0xcea1('0x23')](channels[_0x10efc7[_0xcea1('0x7')]])){utils[_0xcea1('0x18')](util['format']('[%s][calls][newexten]',_0x10efc7['uniqueid']),_0x10efc7);utils[_0xcea1('0x9')](util[_0xcea1('0xa')](_0xcea1('0x60'),_0x10efc7['uniqueid'],_0x10efc7[_0xcea1('0x61')],_0x10efc7[_0xcea1('0x62')]));if(_0x10efc7[_0xcea1('0x61')]['toLowerCase']()=='set'&&_['startsWith'](_0x10efc7[_0xcea1('0x62')][_0xcea1('0x63')](),_0xcea1('0x64'))){var _0x4a0229=_0x10efc7[_0xcea1('0x62')]['split']('=');var _0x1080dc=_0x4a0229[0x0][_0xcea1('0x65')](_0x4a0229[0x0]['lastIndexOf']('(')+0x1,_0x4a0229[0x0][_0xcea1('0x66')](')'));var _0x3dd4c1=_0x4a0229[0x1];channels[_0x10efc7[_0xcea1('0x7')]][_0x1080dc]=_0x3dd4c1;}if(!_[_0xcea1('0x67')]([_0xcea1('0x2d'),_0xcea1('0x68'),_0xcea1('0x69'),_0xcea1('0x6a'),_0xcea1('0x6b')],_0x10efc7['application'][_0xcea1('0x63')]())){channels[_0x10efc7[_0xcea1('0x7')]][_0xcea1('0x54')]=_0x10efc7[_0xcea1('0x61')];channels[_0x10efc7[_0xcea1('0x7')]][_0xcea1('0x56')]=_0x10efc7['appdata'];}}}catch(_0x2245df){utils[_0xcea1('0x1e')](util[_0xcea1('0xa')](_0xcea1('0x6c'),_0x10efc7[_0xcea1('0x7')]),_0x2245df);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d5f56bd..30bd32a 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 _0xdeaf=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','connect','info','[core]\x20connected','shutdown'];(function(_0x27f9bf,_0x419b67){var _0x40838e=function(_0x217da6){while(--_0x217da6){_0x27f9bf['push'](_0x27f9bf['shift']());}};_0x40838e(++_0x419b67);}(_0xdeaf,0x18c));var _0xfdea=function(_0x1f6b26,_0x44ad25){_0x1f6b26=_0x1f6b26-0x0;var _0x2f85e0=_0xdeaf[_0x1f6b26];return _0x2f85e0;};'use strict';var utils=require('./utils');exports[_0xfdea('0x0')]=function(){utils[_0xfdea('0x1')](_0xfdea('0x2'));};exports[_0xfdea('0x3')]=function(){utils[_0xfdea('0x1')]('[core]\x20shutdown');};exports[_0xfdea('0x4')]=function(){utils[_0xfdea('0x1')](_0xfdea('0x5'));};exports['error']=function(_0x1d51c3){utils[_0xfdea('0x6')](_0xfdea('0x7'),_0x1d51c3);};exports[_0xfdea('0x8')]=function(){utils[_0xfdea('0x1')]('[core]\x20close');};exports[_0xfdea('0x9')]=function(_0x2572ac){}; \ No newline at end of file +var _0x42fc=['error','[core]\x20error','[core]\x20close','./utils','connect','info','[core]\x20fullybooted'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x42fc,0x1ae));var _0xc42f=function(_0x528248,_0x4dfbdb){_0x528248=_0x528248-0x0;var _0x370395=_0x42fc[_0x528248];return _0x370395;};'use strict';var utils=require(_0xc42f('0x0'));exports[_0xc42f('0x1')]=function(){utils[_0xc42f('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xc42f('0x2')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils['info'](_0xc42f('0x3'));};exports['error']=function(_0x510a4e){utils[_0xc42f('0x4')](_0xc42f('0x5'),_0x510a4e);};exports['close']=function(){utils[_0xc42f('0x2')](_0xc42f('0x6'));};exports['managerevent']=function(_0x2dec4e){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fdd4697..2bc87a7 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 _0xdc4c=['uniqueid','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','diffTime','endtime','holdtime','billableseconds','[%s][dials][hangup]','lodash','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','format','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc4c,0x10f));var _0xcdc4=function(_0x404a0b,_0x369ea4){_0x404a0b=_0x404a0b-0x0;var _0x322f1a=_0xdc4c[_0x404a0b];return _0x322f1a;};'use strict';var _=require(_0xcdc4('0x0'));var util=require('util');var utils=require(_0xcdc4('0x1'));var dials={};function writeDB(_0x3a5636){utils['info'](util['format'](_0xcdc4('0x2'),_0x3a5636['uniqueid'],_0x3a5636['channel'],_0x3a5636[_0xcdc4('0x3')],_0x3a5636[_0xcdc4('0x4')],_0x3a5636[_0xcdc4('0x5')],_0x3a5636[_0xcdc4('0x6')]));utils['request']('CreateVoiceDialReport',_0x3a5636);delete dials[_0x3a5636['uniqueid']];}exports['newexten']=function(_0x5abccc){try{utils['debug'](util[_0xcdc4('0x7')](_0xcdc4('0x8'),_0x5abccc['uniqueid']),_0x5abccc);utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0xa'),_0x5abccc[_0xcdc4('0xb')],_0x5abccc['application'],_0x5abccc['appdata']));if(_0x5abccc[_0xcdc4('0xc')][_0xcdc4('0xd')]()=='set'&&_[_0xcdc4('0xe')](_0x5abccc[_0xcdc4('0xf')][_0xcdc4('0xd')](),_0xcdc4('0x10'))){var _0x2931d2=_0x5abccc[_0xcdc4('0xf')][_0xcdc4('0x11')]('=');dials[_0x5abccc['uniqueid']]={'routeId':_0x2931d2[0x1]};}}catch(_0xa1f20a){utils[_0xcdc4('0x12')](util['format'](_0xcdc4('0x8'),_0x5abccc[_0xcdc4('0xb')]),_0xa1f20a);}};exports[_0xcdc4('0x13')]=function(_0x2e4bd9){try{utils[_0xcdc4('0x14')](util['format'](_0xcdc4('0x15'),_0x2e4bd9[_0xcdc4('0xb')]),_0x2e4bd9);if(!_[_0xcdc4('0x16')](_0x2e4bd9[_0xcdc4('0x17')]['outboundrouteid'])){utils['info'](util[_0xcdc4('0x7')](_0xcdc4('0x18'),_0x2e4bd9[_0xcdc4('0xb')],_0x2e4bd9['value']));dials[_0x2e4bd9[_0xcdc4('0xb')]]={'routeId':_0x2e4bd9[_0xcdc4('0x19')]};}}catch(_0x24f749){utils[_0xcdc4('0x12')](util['format'](_0xcdc4('0x15'),_0x2e4bd9[_0xcdc4('0xb')]),_0x24f749);}};exports[_0xcdc4('0x1a')]=function(_0x54b1ac){try{if(!_['isNil'](dials[_0x54b1ac['uniqueid']])){utils['debug'](util[_0xcdc4('0x7')](_0xcdc4('0x1b'),_0x54b1ac[_0xcdc4('0xb')]),_0x54b1ac);dials[_0x54b1ac[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x54b1ac[_0xcdc4('0xb')]],_0x54b1ac);dials[_0x54b1ac['uniqueid']][_0xcdc4('0x1d')]=utils['now']();dials[_0x54b1ac[_0xcdc4('0xb')]][_0xcdc4('0x1e')]='called';utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x1f'),_0x54b1ac[_0xcdc4('0xb')],dials[_0x54b1ac[_0xcdc4('0xb')]][_0xcdc4('0x1d')]));}}catch(_0x559623){utils[_0xcdc4('0x12')](util[_0xcdc4('0x7')](_0xcdc4('0x1b'),_0x54b1ac['uniqueid']),_0x559623);}};exports[_0xcdc4('0x20')]=function(_0x502f87){try{if(!_[_0xcdc4('0x16')](dials[_0x502f87[_0xcdc4('0xb')]])){utils[_0xcdc4('0x14')](util[_0xcdc4('0x7')](_0xcdc4('0x21'),_0x502f87[_0xcdc4('0xb')]),_0x502f87);dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x6')]=_0x502f87[_0xcdc4('0x6')];if(_0x502f87['dialstatus']==_0xcdc4('0x22')){dials[_0x502f87[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x502f87['uniqueid']],_0x502f87);dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x23')]=utils['now']();dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x1e')]=_0xcdc4('0x24');utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x25'),_0x502f87[_0xcdc4('0xb')],_0x502f87[_0xcdc4('0x6')],dials[_0x502f87[_0xcdc4('0xb')]][_0xcdc4('0x23')]));}else{utils[_0xcdc4('0x9')](util['format'](_0xcdc4('0x26'),_0x502f87[_0xcdc4('0xb')],_0x502f87[_0xcdc4('0x6')]));}}}catch(_0x31ce03){utils['error'](util[_0xcdc4('0x7')](_0xcdc4('0x21'),_0x502f87['uniqueid']),_0x31ce03);}};exports[_0xcdc4('0x27')]=function(_0x33ebe1){try{if(!_[_0xcdc4('0x16')](dials[_0x33ebe1[_0xcdc4('0xb')]])){utils[_0xcdc4('0x14')](util[_0xcdc4('0x7')]('[%s][dials][hangup]',_0x33ebe1[_0xcdc4('0xb')]),_0x33ebe1);utils[_0xcdc4('0x9')](util[_0xcdc4('0x7')](_0xcdc4('0x28'),_0x33ebe1[_0xcdc4('0xb')],_0x33ebe1[_0xcdc4('0x4')],_0x33ebe1['calleridname'],_0x33ebe1[_0xcdc4('0x29')]));dials[_0x33ebe1[_0xcdc4('0xb')]]=_[_0xcdc4('0x1c')](dials[_0x33ebe1[_0xcdc4('0xb')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x33ebe1[_0xcdc4('0xb')]]['duration']=utils[_0xcdc4('0x2a')](dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2b')],dials[_0x33ebe1['uniqueid']][_0xcdc4('0x1d')]);dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2c')]=utils['diffTime'](dials[_0x33ebe1[_0xcdc4('0xb')]]['answertime']||dials[_0x33ebe1['uniqueid']][_0xcdc4('0x2b')],dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x1d')]);dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2d')]=dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x23')]?utils[_0xcdc4('0x2a')](dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x2b')],dials[_0x33ebe1[_0xcdc4('0xb')]][_0xcdc4('0x23')]):0x0;writeDB(dials[_0x33ebe1[_0xcdc4('0xb')]]);}}catch(_0x1c8a75){utils['error'](util[_0xcdc4('0x7')](_0xcdc4('0x2e'),_0x33ebe1[_0xcdc4('0xb')]),_0x1c8a75);}}; \ No newline at end of file +var _0xcadf=['diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','debug','[%s][dials][dialbegin]','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration'];(function(_0xce0f7e,_0x40bf8a){var _0x153606=function(_0x472e89){while(--_0x472e89){_0xce0f7e['push'](_0xce0f7e['shift']());}};_0x153606(++_0x40bf8a);}(_0xcadf,0xa3));var _0xfcad=function(_0x447ae5,_0x28dc83){_0x447ae5=_0x447ae5-0x0;var _0x54c1e7=_0xcadf[_0x447ae5];return _0x54c1e7;};'use strict';var _=require(_0xfcad('0x0'));var util=require('util');var utils=require(_0xfcad('0x1'));var dials={};function writeDB(_0x420350){utils[_0xfcad('0x2')](util[_0xfcad('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x420350[_0xfcad('0x4')],_0x420350[_0xfcad('0x5')],_0x420350[_0xfcad('0x6')],_0x420350[_0xfcad('0x7')],_0x420350[_0xfcad('0x8')],_0x420350['dialstatus']));utils[_0xfcad('0x9')](_0xfcad('0xa'),_0x420350);delete dials[_0x420350[_0xfcad('0x4')]];}exports[_0xfcad('0xb')]=function(_0x5749c9){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x5749c9[_0xfcad('0x4')]),_0x5749c9);utils[_0xfcad('0x2')](util[_0xfcad('0x3')](_0xfcad('0xc'),_0x5749c9[_0xfcad('0x4')],_0x5749c9[_0xfcad('0xd')],_0x5749c9[_0xfcad('0xe')]));if(_0x5749c9['application'][_0xfcad('0xf')]()==_0xfcad('0x10')&&_[_0xfcad('0x11')](_0x5749c9['appdata'][_0xfcad('0xf')](),_0xfcad('0x12'))){var _0x2c4ea6=_0x5749c9[_0xfcad('0xe')]['split']('=');dials[_0x5749c9[_0xfcad('0x4')]]={'routeId':_0x2c4ea6[0x1]};}}catch(_0x4585cc){utils[_0xfcad('0x13')](util['format']('[%s][dials][newexten]',_0x5749c9[_0xfcad('0x4')]),_0x4585cc);}};exports[_0xfcad('0x14')]=function(_0x57016e){try{utils['debug'](util['format'](_0xfcad('0x15'),_0x57016e[_0xfcad('0x4')]),_0x57016e);if(!_[_0xfcad('0x16')](_0x57016e[_0xfcad('0x17')]['outboundrouteid'])){utils[_0xfcad('0x2')](util[_0xfcad('0x3')](_0xfcad('0x18'),_0x57016e[_0xfcad('0x4')],_0x57016e[_0xfcad('0x19')]));dials[_0x57016e[_0xfcad('0x4')]]={'routeId':_0x57016e[_0xfcad('0x19')]};}}catch(_0x1d79f2){utils[_0xfcad('0x13')](util[_0xfcad('0x3')](_0xfcad('0x15'),_0x57016e[_0xfcad('0x4')]),_0x1d79f2);}};exports[_0xfcad('0x1a')]=function(_0x402f82){try{if(!_[_0xfcad('0x16')](dials[_0x402f82[_0xfcad('0x4')]])){utils[_0xfcad('0x1b')](util['format'](_0xfcad('0x1c'),_0x402f82[_0xfcad('0x4')]),_0x402f82);dials[_0x402f82[_0xfcad('0x4')]]=_['assign'](dials[_0x402f82['uniqueid']],_0x402f82);dials[_0x402f82['uniqueid']][_0xfcad('0x1d')]=utils[_0xfcad('0x1e')]();dials[_0x402f82[_0xfcad('0x4')]][_0xfcad('0x1f')]='called';utils[_0xfcad('0x2')](util[_0xfcad('0x3')](_0xfcad('0x20'),_0x402f82['uniqueid'],dials[_0x402f82[_0xfcad('0x4')]][_0xfcad('0x1d')]));}}catch(_0x47e202){utils[_0xfcad('0x13')](util[_0xfcad('0x3')](_0xfcad('0x1c'),_0x402f82[_0xfcad('0x4')]),_0x47e202);}};exports[_0xfcad('0x21')]=function(_0x9237a0){try{if(!_['isNil'](dials[_0x9237a0[_0xfcad('0x4')]])){utils[_0xfcad('0x1b')](util[_0xfcad('0x3')](_0xfcad('0x22'),_0x9237a0[_0xfcad('0x4')]),_0x9237a0);dials[_0x9237a0[_0xfcad('0x4')]]['dialstatus']=_0x9237a0['dialstatus'];if(_0x9237a0[_0xfcad('0x23')]==_0xfcad('0x24')){dials[_0x9237a0['uniqueid']]=_[_0xfcad('0x25')](dials[_0x9237a0['uniqueid']],_0x9237a0);dials[_0x9237a0[_0xfcad('0x4')]][_0xfcad('0x26')]=utils[_0xfcad('0x1e')]();dials[_0x9237a0[_0xfcad('0x4')]][_0xfcad('0x1f')]=_0xfcad('0x27');utils[_0xfcad('0x2')](util['format'](_0xfcad('0x28'),_0x9237a0[_0xfcad('0x4')],_0x9237a0[_0xfcad('0x23')],dials[_0x9237a0[_0xfcad('0x4')]][_0xfcad('0x26')]));}else{utils[_0xfcad('0x2')](util[_0xfcad('0x3')](_0xfcad('0x29'),_0x9237a0[_0xfcad('0x4')],_0x9237a0[_0xfcad('0x23')]));}}}catch(_0x326d04){utils[_0xfcad('0x13')](util[_0xfcad('0x3')](_0xfcad('0x22'),_0x9237a0[_0xfcad('0x4')]),_0x326d04);}};exports[_0xfcad('0x2a')]=function(_0x8b0736){try{if(!_[_0xfcad('0x16')](dials[_0x8b0736['uniqueid']])){utils[_0xfcad('0x1b')](util['format'](_0xfcad('0x2b'),_0x8b0736[_0xfcad('0x4')]),_0x8b0736);utils['info'](util[_0xfcad('0x3')](_0xfcad('0x2c'),_0x8b0736[_0xfcad('0x4')],_0x8b0736[_0xfcad('0x7')],_0x8b0736[_0xfcad('0x2d')],_0x8b0736[_0xfcad('0x2e')]));dials[_0x8b0736['uniqueid']]=_['assign'](dials[_0x8b0736['uniqueid']],{'endtime':utils[_0xfcad('0x1e')](),'lastevent':_0xfcad('0x2f')});dials[_0x8b0736['uniqueid']][_0xfcad('0x30')]=utils[_0xfcad('0x31')](dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x32')],dials[_0x8b0736['uniqueid']]['starttime']);dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x33')]=utils[_0xfcad('0x31')](dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x26')]||dials[_0x8b0736['uniqueid']][_0xfcad('0x32')],dials[_0x8b0736[_0xfcad('0x4')]]['starttime']);dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x34')]=dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x26')]?utils[_0xfcad('0x31')](dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x32')],dials[_0x8b0736[_0xfcad('0x4')]][_0xfcad('0x26')]):0x0;writeDB(dials[_0x8b0736['uniqueid']]);}}catch(_0x129a4d){utils[_0xfcad('0x13')](util[_0xfcad('0x3')](_0xfcad('0x2b'),_0x8b0736[_0xfcad('0x4')]),_0x129a4d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5c82348..6ca3122 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 _0xa516=['varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','port','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][varset]'];(function(_0x1d9703,_0x11ab72){var _0x14c4d0=function(_0x3416e0){while(--_0x3416e0){_0x1d9703['push'](_0x1d9703['shift']());}};_0x14c4d0(++_0x11ab72);}(_0xa516,0x126));var _0x6a51=function(_0x50ce10,_0x19bd0d){_0x50ce10=_0x50ce10-0x0;var _0x741502=_0xa516[_0x50ce10];return _0x741502;};var AsteriskManager=require(_0x6a51('0x0'));var config=require('../../config/environment');var utils=require(_0x6a51('0x1'));var util=require(_0x6a51('0x2'));var isXDREnabled=config[_0x6a51('0x3')]&&config[_0x6a51('0x3')]['disabled']?!config[_0x6a51('0x3')][_0x6a51('0x4')]:!![];var isProduction=config[_0x6a51('0x5')]===_0x6a51('0x6')||![];var isLocalAsterisk=config[_0x6a51('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x6a51('0x7')],config[_0x6a51('0x8')]['ip'],config[_0x6a51('0x8')]['username'],config[_0x6a51('0x8')][_0x6a51('0x9')],!![]);ami[_0x6a51('0xa')]();if(!isXDREnabled){utils[_0x6a51('0xb')](_0x6a51('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6a51('0xb')](_0x6a51('0xd'));}else{var agents=require(_0x6a51('0xe'));var calls=require('./calls.controller');var queues=require(_0x6a51('0xf'));var recordings=require('./recordings.controller');var members=require(_0x6a51('0x10'));var dials=require(_0x6a51('0x11'));var transfers=require('./transfers.controller');var core=require(_0x6a51('0x12'));ami['on'](_0x6a51('0x13'),core[_0x6a51('0x13')]);ami['on']('shutdown',core[_0x6a51('0x14')]);ami['on'](_0x6a51('0x15'),core[_0x6a51('0x15')]);ami['on'](_0x6a51('0x16'),core[_0x6a51('0x16')]);ami['on'](_0x6a51('0x17'),core['close']);ami['on'](_0x6a51('0x18'),core[_0x6a51('0x18')]);ami['on']('devicestatechange',function(_0x2e3a20){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x1a'),_0x2e3a20[_0x6a51('0x1b')]),_0x2e3a20);members[_0x6a51('0x1c')](_0x2e3a20);}catch(_0x10fa62){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][devicestatechange]',_0x2e3a20['device']),_0x10fa62);}});ami['on'](_0x6a51('0x1e'),function(_0x499171){try{utils['debug'](util['format'](_0x6a51('0x1f'),_0x499171[_0x6a51('0x20')]),_0x499171);agents['agentcalled'](_0x499171);}catch(_0x3b2817){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x1f'),_0x499171[_0x6a51('0x20')]),_0x3b2817);}});ami['on'](_0x6a51('0x21'),function(_0x348bdc){try{utils['debug'](util[_0x6a51('0x1d')](_0x6a51('0x22'),_0x348bdc[_0x6a51('0x20')]),_0x348bdc);agents['agentringnoanswer'](_0x348bdc);}catch(_0x557b96){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][agentringnoanswer]',_0x348bdc[_0x6a51('0x20')]),_0x557b96);}});ami['on']('agentconnect',function(_0xeecb3b){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x23'),_0xeecb3b[_0x6a51('0x20')]),_0xeecb3b);agents[_0x6a51('0x24')](_0xeecb3b);queues[_0x6a51('0x24')](_0xeecb3b);}catch(_0x4be9df){utils['error'](util['format']('[%s][index][agentconnect]',_0xeecb3b['uniqueid']),_0x4be9df);}});ami['on'](_0x6a51('0x25'),function(_0x575ba7){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x26'),_0x575ba7[_0x6a51('0x20')]),_0x575ba7);agents[_0x6a51('0x25')](_0x575ba7);queues[_0x6a51('0x25')](_0x575ba7);members['agentcomplete'](_0x575ba7);}catch(_0x432f97){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x26'),_0x575ba7['uniqueid']),_0x432f97);}});ami['on'](_0x6a51('0x27'),function(_0x46dbe5){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x28'),_0x46dbe5[_0x6a51('0x20')]),_0x46dbe5);agents[_0x6a51('0x27')](_0x46dbe5);queues['queuecallerabandon'](_0x46dbe5);}catch(_0x2fc773){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][queuecallerabandon]',_0x46dbe5[_0x6a51('0x20')]),_0x2fc773);}});ami['on'](_0x6a51('0x29'),function(_0xda1105){try{utils['debug'](util[_0x6a51('0x1d')]('[%s][index][queuecallerjoin]',_0xda1105[_0x6a51('0x20')]),_0xda1105);queues[_0x6a51('0x29')](_0xda1105);recordings[_0x6a51('0x29')](_0xda1105);}catch(_0xd97afa){utils['error'](util[_0x6a51('0x1d')](_0x6a51('0x2a'),_0xda1105['uniqueid']),_0xd97afa);}});ami['on'](_0x6a51('0x2b'),function(_0x473a06){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x2c'),_0x473a06['uniqueid']),_0x473a06);queues['queuecallerleave'](_0x473a06);}catch(_0x98d68c){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x2c'),_0x473a06[_0x6a51('0x20')]),_0x98d68c);}});ami['on'](_0x6a51('0x2d'),function(_0x57763d){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x2e'),_0x57763d[_0x6a51('0x20')]),_0x57763d);queues[_0x6a51('0x2d')](_0x57763d);calls[_0x6a51('0x2d')](_0x57763d);}catch(_0x3b1497){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x2e'),_0x57763d[_0x6a51('0x20')]),_0x3b1497);}});ami['on'](_0x6a51('0x2f'),function(_0x3ed45c){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x30'),_0x3ed45c['uniqueid']),_0x3ed45c);queues[_0x6a51('0x2f')](_0x3ed45c);calls[_0x6a51('0x2f')](_0x3ed45c);}catch(_0x59a8c5){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x30'),_0x3ed45c['uniqueid']),_0x59a8c5);}});ami['on'](_0x6a51('0x31'),function(_0x416638){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x32'),_0x416638[_0x6a51('0x20')]),_0x416638);calls['newstate'](_0x416638);recordings[_0x6a51('0x31')](_0x416638);}catch(_0x44dc01){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x32'),_0x416638[_0x6a51('0x20')]),_0x44dc01);}});ami['on'](_0x6a51('0x33'),function(_0x318450){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x34'),_0x318450['uniqueid']),_0x318450);calls[_0x6a51('0x33')](_0x318450);recordings[_0x6a51('0x33')](_0x318450);dials[_0x6a51('0x33')](_0x318450);agents[_0x6a51('0x33')](_0x318450);queues[_0x6a51('0x33')](_0x318450);}catch(_0x5c02a8){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][hangup]',_0x318450[_0x6a51('0x20')]),_0x5c02a8);}});ami['on'](_0x6a51('0x35'),function(_0x51dd1e){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x36'),_0x51dd1e[_0x6a51('0x20')]),_0x51dd1e);members[_0x6a51('0x35')](_0x51dd1e);}catch(_0x433cfe){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')]('[%s][index][cdr]',_0x51dd1e[_0x6a51('0x20')]),_0x433cfe);}});ami['on'](_0x6a51('0x37'),function(_0x57b0c8){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x38'),_0x57b0c8[_0x6a51('0x20')]),_0x57b0c8);queues['blindtransfer'](_0x57b0c8);agents[_0x6a51('0x37')](_0x57b0c8);transfers[_0x6a51('0x37')](_0x57b0c8);recordings['blindtransfer'](_0x57b0c8);}catch(_0xbc32f7){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x38'),_0x57b0c8[_0x6a51('0x20')]),_0xbc32f7);}});ami['on']('attendedtransfer',function(_0x291ce6){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x39'),_0x291ce6[_0x6a51('0x3a')]),_0x291ce6);queues[_0x6a51('0x3b')](_0x291ce6);transfers[_0x6a51('0x3b')](_0x291ce6);agents[_0x6a51('0x3b')](_0x291ce6);calls['attendedtransfer'](_0x291ce6);}catch(_0x245d3e){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x39'),_0x291ce6[_0x6a51('0x3a')]),_0x245d3e);}});ami['on']('varset',function(_0x480255){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x3c'),_0x480255['uniqueid']),_0x480255);queues[_0x6a51('0x3d')](_0x480255);recordings[_0x6a51('0x3d')](_0x480255);calls[_0x6a51('0x3d')](_0x480255);dials[_0x6a51('0x3d')](_0x480255);}catch(_0x4f4178){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x3c'),_0x480255[_0x6a51('0x20')]),_0x4f4178);}});ami['on'](_0x6a51('0x3e'),function(_0x2cd3de){try{utils[_0x6a51('0x19')](util['format'](_0x6a51('0x3f'),_0x2cd3de[_0x6a51('0x20')]),_0x2cd3de);calls[_0x6a51('0x3e')](_0x2cd3de);recordings['newexten'](_0x2cd3de);dials[_0x6a51('0x3e')](_0x2cd3de);}catch(_0x34155c){utils['error'](util[_0x6a51('0x1d')](_0x6a51('0x3f'),_0x2cd3de[_0x6a51('0x20')]),_0x34155c);}});ami['on'](_0x6a51('0x40'),function(_0x2c191c){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')](_0x6a51('0x41'),_0x2c191c[_0x6a51('0x20')]),_0x2c191c);calls['newchannel'](_0x2c191c);recordings[_0x6a51('0x40')](_0x2c191c);}catch(_0x3f0a60){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x41'),_0x2c191c[_0x6a51('0x20')]),_0x3f0a60);}});ami['on'](_0x6a51('0x42'),function(_0xfd95c9){try{utils['debug'](util['format'](_0x6a51('0x43'),_0xfd95c9['uniqueid']),_0xfd95c9);dials['dialbegin'](_0xfd95c9);}catch(_0x5c21c6){utils[_0x6a51('0x16')](util['format'](_0x6a51('0x44'),_0xfd95c9[_0x6a51('0x20')]),_0x5c21c6);}});ami['on'](_0x6a51('0x45'),function(_0x28bd08){try{utils[_0x6a51('0x19')](util[_0x6a51('0x1d')]('[%s][index][dialend]',_0x28bd08[_0x6a51('0x20')]),_0x28bd08);dials[_0x6a51('0x45')](_0x28bd08);}catch(_0x2a1296){utils[_0x6a51('0x16')](util[_0x6a51('0x1d')](_0x6a51('0x46'),_0x28bd08['uniqueid']),_0x2a1296);}});} \ No newline at end of file +var _0x98bb=['[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin'];(function(_0x132e1d,_0xe989ec){var _0x22c82c=function(_0x12a526){while(--_0x12a526){_0x132e1d['push'](_0x132e1d['shift']());}};_0x22c82c(++_0xe989ec);}(_0x98bb,0x12e));var _0xb98b=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x98bb[_0x3899d1];return _0xeb4a7d;};var AsteriskManager=require(_0xb98b('0x0'));var config=require(_0xb98b('0x1'));var utils=require(_0xb98b('0x2'));var util=require(_0xb98b('0x3'));var isXDREnabled=config['xdr']&&config[_0xb98b('0x4')][_0xb98b('0x5')]?!config[_0xb98b('0x4')]['disabled']:!![];var isProduction=config['env']===_0xb98b('0x6')||![];var isLocalAsterisk=config[_0xb98b('0x4')]&&config[_0xb98b('0x4')][_0xb98b('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb98b('0x8')][_0xb98b('0x9')],config[_0xb98b('0x8')]['ip'],config[_0xb98b('0x8')][_0xb98b('0xa')],config[_0xb98b('0x8')]['password'],!![]);ami[_0xb98b('0xb')]();if(!isXDREnabled){utils[_0xb98b('0xc')](_0xb98b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb98b('0xc')](_0xb98b('0xe'));}else{var agents=require(_0xb98b('0xf'));var calls=require(_0xb98b('0x10'));var queues=require('./queues.controller');var recordings=require(_0xb98b('0x11'));var members=require(_0xb98b('0x12'));var dials=require('./dials.controller');var transfers=require(_0xb98b('0x13'));var core=require(_0xb98b('0x14'));ami['on'](_0xb98b('0x15'),core[_0xb98b('0x15')]);ami['on'](_0xb98b('0x16'),core[_0xb98b('0x16')]);ami['on'](_0xb98b('0x17'),core[_0xb98b('0x17')]);ami['on'](_0xb98b('0x18'),core[_0xb98b('0x18')]);ami['on']('close',core[_0xb98b('0x19')]);ami['on'](_0xb98b('0x1a'),core[_0xb98b('0x1a')]);ami['on'](_0xb98b('0x1b'),function(_0x4ca19f){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x1e'),_0x4ca19f['device']),_0x4ca19f);members[_0xb98b('0x1b')](_0x4ca19f);}catch(_0x59dd4f){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x1e'),_0x4ca19f[_0xb98b('0x1f')]),_0x59dd4f);}});ami['on']('agentcalled',function(_0x3f5a58){try{utils[_0xb98b('0x1c')](util['format'](_0xb98b('0x20'),_0x3f5a58['uniqueid']),_0x3f5a58);agents[_0xb98b('0x21')](_0x3f5a58);}catch(_0x5d27e9){utils[_0xb98b('0x18')](util['format'](_0xb98b('0x20'),_0x3f5a58[_0xb98b('0x22')]),_0x5d27e9);}});ami['on'](_0xb98b('0x23'),function(_0x3241c4){try{utils[_0xb98b('0x1c')](util['format'](_0xb98b('0x24'),_0x3241c4[_0xb98b('0x22')]),_0x3241c4);agents[_0xb98b('0x23')](_0x3241c4);}catch(_0x50d63b){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')]('[%s][index][agentringnoanswer]',_0x3241c4[_0xb98b('0x22')]),_0x50d63b);}});ami['on'](_0xb98b('0x25'),function(_0x34e66d){try{utils[_0xb98b('0x1c')](util['format']('[%s][index][agentconnect]',_0x34e66d[_0xb98b('0x22')]),_0x34e66d);agents[_0xb98b('0x25')](_0x34e66d);queues['agentconnect'](_0x34e66d);}catch(_0x1ad1a6){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')]('[%s][index][agentconnect]',_0x34e66d['uniqueid']),_0x1ad1a6);}});ami['on'](_0xb98b('0x26'),function(_0x5d2bbc){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x27'),_0x5d2bbc[_0xb98b('0x22')]),_0x5d2bbc);agents[_0xb98b('0x26')](_0x5d2bbc);queues[_0xb98b('0x26')](_0x5d2bbc);members[_0xb98b('0x26')](_0x5d2bbc);}catch(_0xf829cf){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x27'),_0x5d2bbc[_0xb98b('0x22')]),_0xf829cf);}});ami['on']('queuecallerabandon',function(_0x11d537){try{utils[_0xb98b('0x1c')](util['format']('[%s][index][queuecallerabandon]',_0x11d537[_0xb98b('0x22')]),_0x11d537);agents[_0xb98b('0x28')](_0x11d537);queues[_0xb98b('0x28')](_0x11d537);}catch(_0x2c35de){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x29'),_0x11d537[_0xb98b('0x22')]),_0x2c35de);}});ami['on'](_0xb98b('0x2a'),function(_0x69cbdb){try{utils['debug'](util[_0xb98b('0x1d')](_0xb98b('0x2b'),_0x69cbdb[_0xb98b('0x22')]),_0x69cbdb);queues[_0xb98b('0x2a')](_0x69cbdb);recordings[_0xb98b('0x2a')](_0x69cbdb);}catch(_0xe20bb7){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x2b'),_0x69cbdb['uniqueid']),_0xe20bb7);}});ami['on'](_0xb98b('0x2c'),function(_0xe011b8){try{utils[_0xb98b('0x1c')](util['format'](_0xb98b('0x2d'),_0xe011b8[_0xb98b('0x22')]),_0xe011b8);queues[_0xb98b('0x2c')](_0xe011b8);}catch(_0xfd217b){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x2d'),_0xe011b8['uniqueid']),_0xfd217b);}});ami['on'](_0xb98b('0x2e'),function(_0x5ce6b4){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x2f'),_0x5ce6b4['uniqueid']),_0x5ce6b4);queues[_0xb98b('0x2e')](_0x5ce6b4);calls[_0xb98b('0x2e')](_0x5ce6b4);}catch(_0xf3ac01){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x2f'),_0x5ce6b4[_0xb98b('0x22')]),_0xf3ac01);}});ami['on'](_0xb98b('0x30'),function(_0x5122c2){try{utils['debug'](util[_0xb98b('0x1d')]('[%s][index][musiconholdstop]',_0x5122c2[_0xb98b('0x22')]),_0x5122c2);queues[_0xb98b('0x30')](_0x5122c2);calls[_0xb98b('0x30')](_0x5122c2);}catch(_0x1762be){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x31'),_0x5122c2['uniqueid']),_0x1762be);}});ami['on'](_0xb98b('0x32'),function(_0x2790a8){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x33'),_0x2790a8[_0xb98b('0x22')]),_0x2790a8);calls[_0xb98b('0x32')](_0x2790a8);recordings[_0xb98b('0x32')](_0x2790a8);}catch(_0x3e9558){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x33'),_0x2790a8[_0xb98b('0x22')]),_0x3e9558);}});ami['on'](_0xb98b('0x34'),function(_0x275016){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x35'),_0x275016[_0xb98b('0x22')]),_0x275016);calls[_0xb98b('0x34')](_0x275016);recordings[_0xb98b('0x34')](_0x275016);dials[_0xb98b('0x34')](_0x275016);agents['hangup'](_0x275016);queues[_0xb98b('0x34')](_0x275016);}catch(_0x5e80fe){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x35'),_0x275016[_0xb98b('0x22')]),_0x5e80fe);}});ami['on'](_0xb98b('0x36'),function(_0x48617e){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x37'),_0x48617e[_0xb98b('0x22')]),_0x48617e);members[_0xb98b('0x36')](_0x48617e);}catch(_0x15846f){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x37'),_0x48617e[_0xb98b('0x22')]),_0x15846f);}});ami['on']('blindtransfer',function(_0x244145){try{utils['debug'](util[_0xb98b('0x1d')](_0xb98b('0x38'),_0x244145[_0xb98b('0x22')]),_0x244145);queues[_0xb98b('0x39')](_0x244145);agents['blindtransfer'](_0x244145);transfers[_0xb98b('0x39')](_0x244145);recordings[_0xb98b('0x39')](_0x244145);}catch(_0x10f4de){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x38'),_0x244145['uniqueid']),_0x10f4de);}});ami['on'](_0xb98b('0x3a'),function(_0x14c105){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x3b'),_0x14c105[_0xb98b('0x3c')]),_0x14c105);queues[_0xb98b('0x3a')](_0x14c105);transfers[_0xb98b('0x3a')](_0x14c105);agents['attendedtransfer'](_0x14c105);calls['attendedtransfer'](_0x14c105);}catch(_0x2b797b){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x3b'),_0x14c105['origtransfereruniqueid']),_0x2b797b);}});ami['on'](_0xb98b('0x3d'),function(_0x2ab157){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x3e'),_0x2ab157['uniqueid']),_0x2ab157);queues[_0xb98b('0x3d')](_0x2ab157);recordings['varset'](_0x2ab157);calls['varset'](_0x2ab157);dials['varset'](_0x2ab157);}catch(_0x1cd19c){utils['error'](util[_0xb98b('0x1d')]('[%s][index][varset]',_0x2ab157['uniqueid']),_0x1cd19c);}});ami['on'](_0xb98b('0x3f'),function(_0xa1cdaf){try{utils[_0xb98b('0x1c')](util['format'](_0xb98b('0x40'),_0xa1cdaf[_0xb98b('0x22')]),_0xa1cdaf);calls['newexten'](_0xa1cdaf);recordings[_0xb98b('0x3f')](_0xa1cdaf);dials[_0xb98b('0x3f')](_0xa1cdaf);}catch(_0x21a388){utils['error'](util['format'](_0xb98b('0x40'),_0xa1cdaf[_0xb98b('0x22')]),_0x21a388);}});ami['on']('newchannel',function(_0x5a592f){try{utils['debug'](util['format'](_0xb98b('0x41'),_0x5a592f[_0xb98b('0x22')]),_0x5a592f);calls[_0xb98b('0x42')](_0x5a592f);recordings[_0xb98b('0x42')](_0x5a592f);}catch(_0x3ad273){utils['error'](util[_0xb98b('0x1d')](_0xb98b('0x41'),_0x5a592f[_0xb98b('0x22')]),_0x3ad273);}});ami['on']('dialbegin',function(_0x4256be){try{utils[_0xb98b('0x1c')](util['format']('[%s][index][dialbegin]',_0x4256be[_0xb98b('0x22')]),_0x4256be);dials[_0xb98b('0x43')](_0x4256be);}catch(_0x403ba1){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')]('[%s]dialbegin',_0x4256be[_0xb98b('0x22')]),_0x403ba1);}});ami['on']('dialend',function(_0x510783){try{utils[_0xb98b('0x1c')](util[_0xb98b('0x1d')](_0xb98b('0x44'),_0x510783[_0xb98b('0x22')]),_0x510783);dials['dialend'](_0x510783);}catch(_0x4b1acc){utils[_0xb98b('0x18')](util[_0xb98b('0x1d')](_0xb98b('0x44'),_0x510783[_0xb98b('0x22')]),_0x4b1acc);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b5cc796..f8534e1 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 _0xaaa2=['INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name','request','CreateMemberReport','split','then','internal','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state'];(function(_0x205cab,_0x4cfdef){var _0x4423ad=function(_0x10f799){while(--_0x10f799){_0x205cab['push'](_0x205cab['shift']());}};_0x4423ad(++_0x4cfdef);}(_0xaaa2,0xac));var _0x2aaa=function(_0x59fc23,_0x2c1ecf){_0x59fc23=_0x59fc23-0x0;var _0x51c7d3=_0xaaa2[_0x59fc23];return _0x51c7d3;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var utils=require(_0x2aaa('0x2'));var members={};var exclude=[_0x2aaa('0x3'),_0x2aaa('0x4')];function writeDB(_0x10a7bf){utils['info'](util[_0x2aaa('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x10a7bf[_0x2aaa('0x6')],_0x10a7bf[_0x2aaa('0x7')],_0x10a7bf[_0x2aaa('0x8')],_0x10a7bf[_0x2aaa('0x9')],_0x10a7bf[_0x2aaa('0xa')],_0x10a7bf[_0x2aaa('0xb')]));if(_0x10a7bf['interface']){utils[_0x2aaa('0xc')](_0x10a7bf['interface'])['then'](function(_0x139ca7){if(_0x139ca7){_0x10a7bf['membername']=_0x139ca7[_0x2aaa('0xd')];_0x10a7bf['internal']=_0x139ca7['internal'];utils[_0x2aaa('0xe')](_0x2aaa('0xf'),_0x10a7bf);}else{utils['getUserByName'](_0x10a7bf[_0x2aaa('0x7')][_0x2aaa('0x10')]('/')[0x1])[_0x2aaa('0x11')](function(_0x501e2b){if(_0x501e2b){_0x10a7bf[_0x2aaa('0xa')]=_0x501e2b[_0x2aaa('0xd')];_0x10a7bf[_0x2aaa('0x12')]=_0x501e2b[_0x2aaa('0x12')];utils[_0x2aaa('0xe')](_0x2aaa('0xf'),_0x10a7bf);}});}})[_0x2aaa('0x13')](function(_0x104c12){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x15'),_0x10a7bf[_0x2aaa('0x6')]),_0x104c12);});}delete members[_0x10a7bf['interface']];}function startsWith(_0x166321,_0x4df56b){return _[_0x2aaa('0x16')](_0x166321,function(_0x1a5573){return _['startsWith'](_0x4df56b,_0x1a5573);});}exports['devicestatechange']=function(_0x50a767){try{utils[_0x2aaa('0x17')](util[_0x2aaa('0x5')](_0x2aaa('0x18'),members[_0x50a767[_0x2aaa('0x19')]]?members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]:_0x50a767[_0x2aaa('0x19')]),_0x50a767);utils['info'](util[_0x2aaa('0x5')](_0x2aaa('0x1a'),members[_0x50a767['device']]?members[_0x50a767[_0x2aaa('0x19')]]['uniqueid']:_0x50a767['device'],_0x50a767[_0x2aaa('0x1b')],_0x50a767[_0x2aaa('0x19')]));switch(_0x50a767[_0x2aaa('0x1b')]){case _0x2aaa('0x1c'):case _0x2aaa('0x1d'):if(!startsWith(exclude,_0x50a767[_0x2aaa('0x19')])){members[_0x50a767[_0x2aaa('0x19')]]={'channel':_0x2aaa('0x1e'),'interface':_0x50a767['device'],'type':_0x2aaa('0x1f'),'enterAt':utils[_0x2aaa('0x20')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x2aaa('0x21')](members[_0x50a767['device']])){members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x22')]=utils['now']();members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x23')]=utils['diffTime'](members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x22')],members[_0x50a767[_0x2aaa('0x19')]]['enterAt']);if(members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]){writeDB(members[_0x50a767['device']]);}}break;default:break;}}catch(_0x565860){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x18'),members[_0x50a767[_0x2aaa('0x19')]]?members[_0x50a767[_0x2aaa('0x19')]][_0x2aaa('0x6')]:_0x50a767[_0x2aaa('0x19')]),_0x565860);}};exports[_0x2aaa('0x24')]=function(_0x12cd47){try{if(!_[_0x2aaa('0x21')](members[_0x12cd47[_0x2aaa('0x7')]])){utils[_0x2aaa('0x17')](util['format'](_0x2aaa('0x25'),_0x12cd47['uniqueid']),_0x12cd47);utils[_0x2aaa('0x26')](util[_0x2aaa('0x5')](_0x2aaa('0x27'),_0x12cd47[_0x2aaa('0x6')],_0x12cd47[_0x2aaa('0x7')],_0x12cd47[_0x2aaa('0x28')]));members[_0x12cd47[_0x2aaa('0x7')]]=_[_0x2aaa('0x29')](members[_0x12cd47[_0x2aaa('0x7')]],{'data4':_0x12cd47[_0x2aaa('0x28')],'uniqueid':_0x12cd47['uniqueid']});}}catch(_0x484c04){utils['error'](util['format']('[%s][members][agentcomplete]',_0x12cd47[_0x2aaa('0x6')]),_0x484c04);}};exports[_0x2aaa('0x2a')]=function(_0x153851){try{utils[_0x2aaa('0x17')](util[_0x2aaa('0x5')](_0x2aaa('0x2b'),_0x153851[_0x2aaa('0x6')]),_0x153851);if(_0x153851[_0x2aaa('0x8')]){var _0x5e9fdf=_0x153851[_0x2aaa('0x8')][_0x2aaa('0x10')]('-')[0x0];if(!_['isNil'](members[_0x5e9fdf])){members[_0x5e9fdf]=_[_0x2aaa('0x29')](members[_0x5e9fdf],{'data1':members[_0x5e9fdf][_0x2aaa('0x2c')]||_0x153851['type'],'data2':members[_0x5e9fdf][_0x2aaa('0x9')]||_0x153851[_0x2aaa('0x2d')],'data3':members[_0x5e9fdf][_0x2aaa('0x2e')]||_0x153851[_0x2aaa('0x2f')],'uniqueid':members[_0x5e9fdf][_0x2aaa('0x6')]||_0x153851[_0x2aaa('0x6')]});utils[_0x2aaa('0x26')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x153851[_0x2aaa('0x6')],members[_0x5e9fdf]['data1'],members[_0x5e9fdf][_0x2aaa('0x9')],members[_0x5e9fdf][_0x2aaa('0x2e')]));if(members[_0x5e9fdf]['exitAt']){writeDB(members[_0x5e9fdf]);}}}if(_0x153851[_0x2aaa('0x30')]){var _0x2cab76=_0x153851[_0x2aaa('0x30')]['split']('-')[0x0];if(!_[_0x2aaa('0x21')](members[_0x2cab76])){members[_0x2cab76]=_[_0x2aaa('0x29')](members[_0x2cab76],{'data1':members[_0x2cab76][_0x2aaa('0x2c')]||_0x153851[_0x2aaa('0xb')],'data2':members[_0x2cab76]['data2']||_0x153851[_0x2aaa('0x2d')],'data3':members[_0x2cab76][_0x2aaa('0x2e')]||_0x153851[_0x2aaa('0x2f')],'uniqueid':members[_0x2cab76][_0x2aaa('0x6')]||_0x153851[_0x2aaa('0x6')]});utils[_0x2aaa('0x26')](util[_0x2aaa('0x5')](_0x2aaa('0x31'),_0x153851[_0x2aaa('0x6')],members[_0x2cab76][_0x2aaa('0x2c')],members[_0x2cab76][_0x2aaa('0x9')],members[_0x2cab76][_0x2aaa('0x2e')]));if(members[_0x2cab76][_0x2aaa('0x22')]){writeDB(members[_0x2cab76]);}}}}catch(_0x54a9c8){utils[_0x2aaa('0x14')](util[_0x2aaa('0x5')](_0x2aaa('0x2b'),_0x153851['uniqueid']),_0x54a9c8);}}; \ No newline at end of file +var _0x067d=['request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','uniqueid','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','split','data1','type','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','interface','channel','data2','membername','getUserByInterface','then','name','internal'];(function(_0x3243be,_0x7869bd){var _0x50d7ec=function(_0x18856c){while(--_0x18856c){_0x3243be['push'](_0x3243be['shift']());}};_0x50d7ec(++_0x7869bd);}(_0x067d,0x1db));var _0xd067=function(_0x4d23dc,_0x30def6){_0x4d23dc=_0x4d23dc-0x0;var _0x1ffc30=_0x067d[_0x4d23dc];return _0x1ffc30;};'use strict';var _=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var utils=require(_0xd067('0x2'));var members={};var exclude=[_0xd067('0x3'),_0xd067('0x4')];function writeDB(_0x2322f3){utils[_0xd067('0x5')](util[_0xd067('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2322f3['uniqueid'],_0x2322f3[_0xd067('0x7')],_0x2322f3[_0xd067('0x8')],_0x2322f3[_0xd067('0x9')],_0x2322f3[_0xd067('0xa')],_0x2322f3['type']));if(_0x2322f3[_0xd067('0x7')]){utils[_0xd067('0xb')](_0x2322f3[_0xd067('0x7')])[_0xd067('0xc')](function(_0x474817){if(_0x474817){_0x2322f3[_0xd067('0xa')]=_0x474817[_0xd067('0xd')];_0x2322f3['internal']=_0x474817[_0xd067('0xe')];utils[_0xd067('0xf')](_0xd067('0x10'),_0x2322f3);}else{utils[_0xd067('0x11')](_0x2322f3[_0xd067('0x7')]['split']('/')[0x1])[_0xd067('0xc')](function(_0x34019a){if(_0x34019a){_0x2322f3[_0xd067('0xa')]=_0x34019a[_0xd067('0xd')];_0x2322f3[_0xd067('0xe')]=_0x34019a[_0xd067('0xe')];utils[_0xd067('0xf')](_0xd067('0x10'),_0x2322f3);}});}})[_0xd067('0x12')](function(_0x3550db){utils[_0xd067('0x13')](util['format'](_0xd067('0x14'),_0x2322f3[_0xd067('0x15')]),_0x3550db);});}delete members[_0x2322f3[_0xd067('0x7')]];}function startsWith(_0x5936c8,_0x4eaafe){return _['some'](_0x5936c8,function(_0x5df3c8){return _['startsWith'](_0x4eaafe,_0x5df3c8);});}exports[_0xd067('0x16')]=function(_0x5bf2d5){try{utils[_0xd067('0x17')](util[_0xd067('0x6')](_0xd067('0x18'),members[_0x5bf2d5[_0xd067('0x19')]]?members[_0x5bf2d5[_0xd067('0x19')]][_0xd067('0x15')]:_0x5bf2d5[_0xd067('0x19')]),_0x5bf2d5);utils[_0xd067('0x5')](util[_0xd067('0x6')](_0xd067('0x1a'),members[_0x5bf2d5['device']]?members[_0x5bf2d5[_0xd067('0x19')]]['uniqueid']:_0x5bf2d5[_0xd067('0x19')],_0x5bf2d5['state'],_0x5bf2d5['device']));switch(_0x5bf2d5[_0xd067('0x1b')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x5bf2d5[_0xd067('0x19')])){members[_0x5bf2d5[_0xd067('0x19')]]={'channel':'voice','interface':_0x5bf2d5['device'],'type':'TALKING','enterAt':utils[_0xd067('0x1c')](),'role':_0xd067('0x1d')};}break;case _0xd067('0x1e'):if(!_[_0xd067('0x1f')](members[_0x5bf2d5[_0xd067('0x19')]])){members[_0x5bf2d5['device']][_0xd067('0x20')]=utils['now']();members[_0x5bf2d5['device']]['duration']=utils[_0xd067('0x21')](members[_0x5bf2d5['device']]['exitAt'],members[_0x5bf2d5[_0xd067('0x19')]][_0xd067('0x22')]);if(members[_0x5bf2d5[_0xd067('0x19')]]['uniqueid']){writeDB(members[_0x5bf2d5[_0xd067('0x19')]]);}}break;default:break;}}catch(_0x5c10f5){utils[_0xd067('0x13')](util['format']('[%s][members][devicestatechange]',members[_0x5bf2d5[_0xd067('0x19')]]?members[_0x5bf2d5[_0xd067('0x19')]][_0xd067('0x15')]:_0x5bf2d5[_0xd067('0x19')]),_0x5c10f5);}};exports[_0xd067('0x23')]=function(_0x186f68){try{if(!_[_0xd067('0x1f')](members[_0x186f68['interface']])){utils[_0xd067('0x17')](util[_0xd067('0x6')](_0xd067('0x24'),_0x186f68[_0xd067('0x15')]),_0x186f68);utils[_0xd067('0x5')](util[_0xd067('0x6')](_0xd067('0x25'),_0x186f68[_0xd067('0x15')],_0x186f68['interface'],_0x186f68[_0xd067('0x26')]));members[_0x186f68[_0xd067('0x7')]]=_[_0xd067('0x27')](members[_0x186f68[_0xd067('0x7')]],{'data4':_0x186f68[_0xd067('0x26')],'uniqueid':_0x186f68[_0xd067('0x15')]});}}catch(_0xb0b75f){utils[_0xd067('0x13')](util[_0xd067('0x6')](_0xd067('0x24'),_0x186f68[_0xd067('0x15')]),_0xb0b75f);}};exports['cdr']=function(_0x20d2c5){try{utils[_0xd067('0x17')](util[_0xd067('0x6')](_0xd067('0x28'),_0x20d2c5[_0xd067('0x15')]),_0x20d2c5);if(_0x20d2c5['channel']){var _0x1ba0c5=_0x20d2c5['channel'][_0xd067('0x29')]('-')[0x0];if(!_['isNil'](members[_0x1ba0c5])){members[_0x1ba0c5]=_['assign'](members[_0x1ba0c5],{'data1':members[_0x1ba0c5][_0xd067('0x2a')]||_0x20d2c5[_0xd067('0x2b')],'data2':members[_0x1ba0c5][_0xd067('0x9')]||_0x20d2c5['source'],'data3':members[_0x1ba0c5]['data3']||_0x20d2c5[_0xd067('0x2c')],'uniqueid':members[_0x1ba0c5][_0xd067('0x15')]||_0x20d2c5[_0xd067('0x15')]});utils['info'](util[_0xd067('0x6')](_0xd067('0x2d'),_0x20d2c5[_0xd067('0x15')],members[_0x1ba0c5][_0xd067('0x2a')],members[_0x1ba0c5][_0xd067('0x9')],members[_0x1ba0c5]['data3']));if(members[_0x1ba0c5][_0xd067('0x20')]){writeDB(members[_0x1ba0c5]);}}}if(_0x20d2c5[_0xd067('0x2e')]){var _0x37a881=_0x20d2c5[_0xd067('0x2e')]['split']('-')[0x0];if(!_[_0xd067('0x1f')](members[_0x37a881])){members[_0x37a881]=_[_0xd067('0x27')](members[_0x37a881],{'data1':members[_0x37a881]['data1']||_0x20d2c5[_0xd067('0x2b')],'data2':members[_0x37a881][_0xd067('0x9')]||_0x20d2c5[_0xd067('0x2f')],'data3':members[_0x37a881][_0xd067('0x30')]||_0x20d2c5[_0xd067('0x2c')],'uniqueid':members[_0x37a881][_0xd067('0x15')]||_0x20d2c5[_0xd067('0x15')]});utils[_0xd067('0x5')](util[_0xd067('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x20d2c5[_0xd067('0x15')],members[_0x37a881][_0xd067('0x2a')],members[_0x37a881][_0xd067('0x9')],members[_0x37a881][_0xd067('0x30')]));if(members[_0x37a881]['exitAt']){writeDB(members[_0x37a881]);}}}}catch(_0x3bd50b){utils[_0xd067('0x13')](util[_0xd067('0x6')](_0xd067('0x28'),_0x20d2c5[_0xd067('0x15')]),_0x3bd50b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 56b7879..2298a9c 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 _0xdfa1=['[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','transfertargetlinkedid','queuecallerenterreason','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','value','CONTINUE','queuecallerexitAt','queuecallerexitreason','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','position','count','agentconnect'];(function(_0x110872,_0x5e2a88){var _0x4607aa=function(_0x135e70){while(--_0x135e70){_0x110872['push'](_0x110872['shift']());}};_0x4607aa(++_0x5e2a88);}(_0xdfa1,0xfc));var _0x1dfa=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdfa1[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x1dfa('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x1fc41c){utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x2'),_0x1fc41c['uniqueid'],_0x1fc41c['channel'],_0x1fc41c[_0x1dfa('0x3')],_0x1fc41c[_0x1dfa('0x4')],_0x1fc41c[_0x1dfa('0x5')],_0x1fc41c['accountcode'],_0x1fc41c['queuecallerexitreason']));if(_0x1fc41c[_0x1dfa('0x3')]){utils[_0x1dfa('0x6')](_0x1fc41c[_0x1dfa('0x3')])[_0x1dfa('0x7')](function(_0x4cec83){if(_0x4cec83){_0x1fc41c[_0x1dfa('0x8')]=_0x4cec83['type'];}utils['request'](_0x1dfa('0x9'),_0x1fc41c);});}else{utils[_0x1dfa('0xa')](_0x1dfa('0x9'),_0x1fc41c);}if(_0x1fc41c['transfereduniqueid']){delete queues[_0x1fc41c[_0x1dfa('0xb')]];}else{delete queues[_0x1fc41c['uniqueid']];}}exports[_0x1dfa('0xc')]=function(_0x476811){try{utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')]('[%s][queues][queuecallerjoin]',_0x476811[_0x1dfa('0xe')]),_0x476811);utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0xf'),_0x476811['uniqueid'],_0x476811['queue'],_0x476811['position']));queues[_0x476811[_0x1dfa('0xe')]]=_['assign'](_0x476811,{'originalposition':_0x476811['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x52eb38){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')](_0x1dfa('0x11'),_0x476811[_0x1dfa('0xe')]),_0x52eb38);}};exports[_0x1dfa('0x12')]=function(_0x4ca95b){try{if(!_[_0x1dfa('0x13')](queues[_0x4ca95b['uniqueid']])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x14'),_0x4ca95b[_0x1dfa('0xe')]),_0x4ca95b);if(queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x15')]){if(!queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x16')]&&!queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x17')]){queues[_0x4ca95b['uniqueid']][_0x1dfa('0x18')]=!![];queues[_0x4ca95b['uniqueid']][_0x1dfa('0x19')]=utils[_0x1dfa('0x1a')]();queues[_0x4ca95b[_0x1dfa('0xe')]]['queuecallerexitreason']=_0x1dfa('0x1b');}utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x1d'),_0x4ca95b['uniqueid'],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x4ca95b[_0x1dfa('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x4ca95b[_0x1dfa('0xe')]]);}else if(queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]){utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x1f'),_0x4ca95b[_0x1dfa('0xe')],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]));queues[queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]]=queues[_0x4ca95b[_0x1dfa('0xe')]];queues[queues[_0x4ca95b[_0x1dfa('0xe')]][_0x1dfa('0xb')]]['queuecallerenterreason']=0x2;delete queues[_0x4ca95b[_0x1dfa('0xe')]];}}}catch(_0x462f2f){utils['error'](util['format']('[%s][queues][hangup]',_0x4ca95b['uniqueid']),_0x462f2f);}};exports[_0x1dfa('0x20')]=function(_0x5a2d1c){try{utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x21'),_0x5a2d1c[_0x1dfa('0xe')]),_0x5a2d1c);if(!_['isNil'](_0x5a2d1c['variable'][_0x1dfa('0x22')])&&_0x5a2d1c[_0x1dfa('0x23')]['toUpperCase']()!==_0x1dfa('0x24')){if(!_[_0x1dfa('0x13')](queues[_0x5a2d1c[_0x1dfa('0xe')]])){queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x16')]=![];queues[_0x5a2d1c['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5a2d1c['uniqueid']]['queuecallerexit']=!![];queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x25')]=utils[_0x1dfa('0x1a')]();queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x5a2d1c[_0x1dfa('0x23')]['toUpperCase']();utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x27'),_0x5a2d1c[_0x1dfa('0xe')],queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x5a2d1c[_0x1dfa('0x23')],queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerexitreason']));writeDB(queues[_0x5a2d1c[_0x1dfa('0xe')]]);}}else if(!_['isNil'](_0x5a2d1c[_0x1dfa('0x28')][_0x1dfa('0x29')])){if(!_[_0x1dfa('0x13')](queues[_0x5a2d1c[_0x1dfa('0xe')]])&&!queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerabandon']){queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerabandon']=![];queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x2a')]=null;queues[_0x5a2d1c[_0x1dfa('0xe')]]['queuecallerexit']=!![];queues[_0x5a2d1c['uniqueid']]['queuecallerexitAt']=utils[_0x1dfa('0x1a')]();queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x26')]=_0x1dfa('0x2b');utils['info'](util[_0x1dfa('0x1')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5a2d1c[_0x1dfa('0xe')],queues[_0x5a2d1c[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x5a2d1c[_0x1dfa('0x23')],queues[_0x5a2d1c['uniqueid']][_0x1dfa('0x26')]));}}}catch(_0x51f125){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x21'),_0x5a2d1c['uniqueid']),_0x51f125);}};exports['queuecallerabandon']=function(_0x18e0ae){try{if(!_[_0x1dfa('0x13')](queues[_0x18e0ae[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')]('[%s][queues][queuecallerabandon]',_0x18e0ae[_0x1dfa('0xe')]),_0x18e0ae);queues[_0x18e0ae[_0x1dfa('0xe')]][_0x1dfa('0x17')]=![];queues[_0x18e0ae[_0x1dfa('0xe')]]['queuecallerexitAt']=null;queues[_0x18e0ae['uniqueid']][_0x1dfa('0x16')]=!![];queues[_0x18e0ae[_0x1dfa('0xe')]]['queuecallerabandonAt']=utils[_0x1dfa('0x1a')]();queues[_0x18e0ae[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x2c');utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x2d'),_0x18e0ae[_0x1dfa('0xe')],queues[_0x18e0ae['uniqueid']][_0x1dfa('0x1e')],queues[_0x18e0ae['uniqueid']][_0x1dfa('0x26')]));}}catch(_0x4135c4){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x2e'),_0x18e0ae[_0x1dfa('0xe')]),_0x4135c4);}};exports[_0x1dfa('0x2f')]=function(_0x29490f){try{if(!_['isNil'](queues[_0x29490f[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util['format'](_0x1dfa('0x30'),_0x29490f[_0x1dfa('0xe')]),_0x29490f);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x31'),_0x29490f[_0x1dfa('0xe')],queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x29490f[_0x1dfa('0x32')],_0x29490f[_0x1dfa('0x33')]));queues[_0x29490f['uniqueid']]['queuecallerleave']=!![];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x15')]=utils['now']();queues[_0x29490f['uniqueid']][_0x1dfa('0x34')]=utils['diffTime'](queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x15')],queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x35')]);queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x36')]=_0x29490f[_0x1dfa('0x36')];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x37')]=_0x29490f['count'];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x32')]=_0x29490f[_0x1dfa('0x32')];queues[_0x29490f[_0x1dfa('0xe')]][_0x1dfa('0x33')]=_0x29490f['connectedlinename'];}}catch(_0x9d9534){utils['error'](util['format'](_0x1dfa('0x30'),_0x29490f[_0x1dfa('0xe')]),_0x9d9534);}};exports[_0x1dfa('0x38')]=function(_0x1b0fe8){try{if(!_[_0x1dfa('0x13')](queues[_0x1b0fe8['uniqueid']])){utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x39'),_0x1b0fe8['uniqueid']),_0x1b0fe8);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x3a'),_0x1b0fe8[_0x1dfa('0xe')],queues[_0x1b0fe8['uniqueid']][_0x1dfa('0x1e')],_0x1b0fe8[_0x1dfa('0x3b')],_0x1b0fe8[_0x1dfa('0x3c')]));queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x16')]=![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x16')]=![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x2a')]=null;queues[_0x1b0fe8['uniqueid']]['queuecallerexit']=![];queues[_0x1b0fe8['uniqueid']][_0x1dfa('0x26')]=null;queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x25')]=null;queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x3d')]=!![];queues[_0x1b0fe8[_0x1dfa('0xe')]][_0x1dfa('0x3e')]=_0x1b0fe8[_0x1dfa('0x3c')];queues[_0x1b0fe8[_0x1dfa('0xe')]]['lastAssignedTo']=_0x1b0fe8[_0x1dfa('0x3b')];}}catch(_0x3f537e){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')]('[%s][queues][agentconnect]',_0x1b0fe8[_0x1dfa('0xe')]),_0x3f537e);}};exports[_0x1dfa('0x3f')]=function(_0x2c55db){try{if(!_[_0x1dfa('0x13')](queues[_0x2c55db[_0x1dfa('0xe')]])){if(queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x15')]){utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x40'),_0x2c55db[_0x1dfa('0xe')]),_0x2c55db);queues[_0x2c55db[_0x1dfa('0xe')]]['queuecallerabandon']=![];queues[_0x2c55db['uniqueid']]['queuecallerabandon']=![];queues[_0x2c55db['uniqueid']][_0x1dfa('0x2a')]=null;queues[_0x2c55db['uniqueid']][_0x1dfa('0x17')]=![];queues[_0x2c55db['uniqueid']][_0x1dfa('0x25')]=null;queues[_0x2c55db['uniqueid']]['assigned']=!![];queues[_0x2c55db[_0x1dfa('0xe')]]['lastAssignedTo']=_0x2c55db['membername'];queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x18')]=!![];queues[_0x2c55db['uniqueid']]['queuecallercompleteAt']=utils[_0x1dfa('0x1a')]();if(_0x2c55db[_0x1dfa('0x41')]==_0x1dfa('0x42')){if(!queues[_0x2c55db['uniqueid']]['transfer']){queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x43');}}else{queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x26')]=_0x1dfa('0x44')+_0x2c55db['reason'][_0x1dfa('0x45')]();}utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x46'),_0x2c55db[_0x1dfa('0xe')],queues[_0x2c55db[_0x1dfa('0xe')]][_0x1dfa('0x1e')],_0x2c55db[_0x1dfa('0x3b')],queues[_0x2c55db['uniqueid']][_0x1dfa('0x26')]));writeDB(queues[_0x2c55db[_0x1dfa('0xe')]]);}}}catch(_0x1b12f5){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')]('[%s][queues][agentcomplete]',_0x2c55db[_0x1dfa('0xe')]),_0x1b12f5);}};exports[_0x1dfa('0x47')]=function(_0x175ce1){try{if(!_[_0x1dfa('0x13')](queues[_0x175ce1[_0x1dfa('0x48')]])){utils['debug'](util['format'](_0x1dfa('0x49'),_0x175ce1['uniqueid']),_0x175ce1);queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x42')]=!![];queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x4a')]=_0x1dfa('0x4b');queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x4c')]=_0x175ce1['extension'];queues[_0x175ce1['transfereeuniqueid']][_0x1dfa('0x4d')]=_0x175ce1[_0x1dfa('0x48')];queues[_0x175ce1['transfereeuniqueid']][_0x1dfa('0x26')]='BLINDTRANSFER';utils[_0x1dfa('0x1c')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x175ce1[_0x1dfa('0xe')],queues[_0x175ce1[_0x1dfa('0x48')]][_0x1dfa('0x1e')],_0x175ce1[_0x1dfa('0x48')],_0x175ce1[_0x1dfa('0x4e')]));}}catch(_0x3bbc46){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x49'),_0x175ce1[_0x1dfa('0xe')]),_0x3bbc46);}};exports['attendedtransfer']=function(_0x19a5d7){try{utils['debug'](util[_0x1dfa('0x1')](_0x1dfa('0x4f'),_0x19a5d7[_0x1dfa('0x50')]),_0x19a5d7);if(_0x19a5d7[_0x1dfa('0x50')]==_0x19a5d7[_0x1dfa('0x51')]){if(!_['isNil'](queues[_0x19a5d7['secondtransfererlinkedid']])){utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x52'),_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x54')]));queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x42')]=!![];queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0x4a')]=_0x1dfa('0x55');queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x4c')]=_0x19a5d7[_0x1dfa('0x54')];queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x4d')]=_0x19a5d7[_0x1dfa('0x50')];queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x26')]=_0x1dfa('0x56');}if(!_[_0x1dfa('0x13')](queues[_0x19a5d7[_0x1dfa('0x51')]])){if(_0x19a5d7[_0x1dfa('0x57')]&&queues[_0x19a5d7['transfereelinkedid']]){queues[_0x19a5d7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x19a5d7[_0x1dfa('0x48')]]=_[_0x1dfa('0x58')](queues[_0x19a5d7[_0x1dfa('0x57')]]);queues[_0x19a5d7['transfereeuniqueid']][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x59')];queues[_0x19a5d7[_0x1dfa('0x48')]]['queuecallerenterreason']=0x2;queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5')]=queues[_0x19a5d7[_0x1dfa('0x53')]]['calleridnum'];queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5a')]=queues[_0x19a5d7[_0x1dfa('0x53')]]['calleridname'];queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x35')]=utils['now']();queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x15')]=utils[_0x1dfa('0x1a')]();queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x34')]=0x0;queues[_0x19a5d7[_0x1dfa('0x48')]]['mohtime']=0x0;utils['info'](util[_0x1dfa('0x1')](_0x1dfa('0x5b'),_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7[_0x1dfa('0x48')]]['name'],queues[_0x19a5d7['transfereeuniqueid']][_0x1dfa('0x5')],queues[_0x19a5d7[_0x1dfa('0x48')]][_0x1dfa('0x5a')]));}else{utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')](_0x1dfa('0x5c'),_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x53')]));queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x53')];}}}else if(_0x19a5d7[_0x1dfa('0x5d')]==_0x19a5d7['secondtransfererlinkedid']){if(!_[_0x1dfa('0x13')](queues[_0x19a5d7['origtransfererlinkedid']])){utils[_0x1dfa('0x1c')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x19a5d7[_0x1dfa('0x50')],queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x5d')],_0x19a5d7['secondtransfererexten']));queues[_0x19a5d7['origtransfererlinkedid']][_0x1dfa('0x42')]=!![];queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x4a')]=_0x1dfa('0x55');queues[_0x19a5d7[_0x1dfa('0x51')]]['transferexten']=_0x19a5d7['secondtransfererexten'];queues[_0x19a5d7['origtransfererlinkedid']]['transferuniqueid']=_0x19a5d7[_0x1dfa('0x5d')];queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x26')]=_0x1dfa('0x56');}if(!_[_0x1dfa('0x13')](queues[_0x19a5d7[_0x1dfa('0x53')]])){if(_0x19a5d7[_0x1dfa('0x5e')]&&queues[_0x19a5d7[_0x1dfa('0x5e')]]){queues[_0x19a5d7[_0x1dfa('0x5e')]][_0x1dfa('0x5f')]=0x1;queues[_0x19a5d7[_0x1dfa('0x59')]]=_['clone'](queues[_0x19a5d7[_0x1dfa('0x5e')]]);queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0xb')]=_0x19a5d7[_0x1dfa('0x59')];queues[_0x19a5d7['transfertargetuniqueid']][_0x1dfa('0x5f')]=0x2;queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5')]=queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x5')];queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5a')]=queues[_0x19a5d7[_0x1dfa('0x51')]][_0x1dfa('0x5a')];queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x35')]=utils[_0x1dfa('0x1a')]();queues[_0x19a5d7[_0x1dfa('0x59')]]['queuecallerleaveAt']=utils['now']();queues[_0x19a5d7[_0x1dfa('0x59')]]['holdtime']=0x0;queues[_0x19a5d7['transfertargetuniqueid']][_0x1dfa('0x60')]=0x0;utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x1e')],queues[_0x19a5d7[_0x1dfa('0x59')]]['transfereduniqueid'],queues[_0x19a5d7[_0x1dfa('0x59')]]['calleridnum'],queues[_0x19a5d7[_0x1dfa('0x59')]][_0x1dfa('0x5a')]));}else{utils[_0x1dfa('0x1c')](util['format'](_0x1dfa('0x5c'),_0x19a5d7['origtransfereruniqueid'],queues[_0x19a5d7['secondtransfererlinkedid']][_0x1dfa('0x1e')],_0x19a5d7[_0x1dfa('0x51')]));queues[_0x19a5d7[_0x1dfa('0x53')]][_0x1dfa('0xb')]=_0x19a5d7['origtransfererlinkedid'];}}}}catch(_0x534764){utils[_0x1dfa('0x10')](util[_0x1dfa('0x1')](_0x1dfa('0x4f'),_0x19a5d7['origtransfereruniqueid']),_0x534764);}};exports[_0x1dfa('0x61')]=function(_0x1a3695){try{if(!_[_0x1dfa('0x13')](queues[_0x1a3695[_0x1dfa('0xe')]])){utils[_0x1dfa('0xd')](util[_0x1dfa('0x1')](_0x1dfa('0x62'),_0x1a3695['uniqueid']),_0x1a3695);queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x63')]=utils[_0x1dfa('0x1a')]();utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x1a3695[_0x1dfa('0xe')],queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x1e')],queues[_0x1a3695[_0x1dfa('0xe')]][_0x1dfa('0x63')]));}}catch(_0x27b83c){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x62'),_0x1a3695[_0x1dfa('0xe')]),_0x27b83c);}};exports[_0x1dfa('0x64')]=function(_0x39346a){try{if(!_[_0x1dfa('0x13')](queues[_0x39346a['uniqueid']])){if(!_[_0x1dfa('0x13')](queues[_0x39346a['uniqueid']][_0x1dfa('0x63')])){utils['debug'](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]',_0x39346a['uniqueid']),_0x39346a);queues[_0x39346a['uniqueid']]['mohtime']+=utils[_0x1dfa('0x65')](utils[_0x1dfa('0x1a')](),queues[_0x39346a[_0x1dfa('0xe')]][_0x1dfa('0x63')]);utils[_0x1dfa('0x1c')](util[_0x1dfa('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x39346a[_0x1dfa('0xe')],queues[_0x39346a['uniqueid']][_0x1dfa('0x1e')],queues[_0x39346a[_0x1dfa('0xe')]]['mohtime']));delete queues[_0x39346a[_0x1dfa('0xe')]]['musiconholdstartAt'];}}}catch(_0x17093c){utils[_0x1dfa('0x10')](util['format'](_0x1dfa('0x66'),_0x39346a['uniqueid']),_0x17093c);}}; \ No newline at end of file +var _0xba7c=['transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','queue','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','varset','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexit','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','BLIND'];(function(_0x3e9580,_0x1ae836){var _0x506c09=function(_0x3a2034){while(--_0x3a2034){_0x3e9580['push'](_0x3e9580['shift']());}};_0x506c09(++_0x1ae836);}(_0xba7c,0x1d0));var _0xcba7=function(_0x3aed82,_0x62b9f3){_0x3aed82=_0x3aed82-0x0;var _0x3efbbb=_0xba7c[_0x3aed82];return _0x3efbbb;};'use strict';var _=require(_0xcba7('0x0'));var util=require(_0xcba7('0x1'));var utils=require(_0xcba7('0x2'));var queues={};function writeDB(_0x38dbcf){utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x5'),_0x38dbcf[_0xcba7('0x6')],_0x38dbcf[_0xcba7('0x7')],_0x38dbcf['queue'],_0x38dbcf[_0xcba7('0x8')],_0x38dbcf['calleridnum'],_0x38dbcf['accountcode'],_0x38dbcf[_0xcba7('0x9')]));if(_0x38dbcf[_0xcba7('0xa')]){utils[_0xcba7('0xb')](_0x38dbcf[_0xcba7('0xa')])['then'](function(_0x4a9258){if(_0x4a9258){_0x38dbcf[_0xcba7('0xc')]=_0x4a9258[_0xcba7('0xc')];}utils['request'](_0xcba7('0xd'),_0x38dbcf);});}else{utils['request'](_0xcba7('0xd'),_0x38dbcf);}if(_0x38dbcf[_0xcba7('0xe')]){delete queues[_0x38dbcf[_0xcba7('0xe')]];}else{delete queues[_0x38dbcf[_0xcba7('0x6')]];}}exports['queuecallerjoin']=function(_0xa5ed27){try{utils[_0xcba7('0xf')](util['format'](_0xcba7('0x10'),_0xa5ed27[_0xcba7('0x6')]),_0xa5ed27);utils[_0xcba7('0x3')](util[_0xcba7('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0xa5ed27[_0xcba7('0x6')],_0xa5ed27[_0xcba7('0xa')],_0xa5ed27[_0xcba7('0x11')]));queues[_0xa5ed27[_0xcba7('0x6')]]=_[_0xcba7('0x12')](_0xa5ed27,{'originalposition':_0xa5ed27['position'],'queuecallerjoinAt':utils[_0xcba7('0x13')](),'mohtime':0x0});}catch(_0x1b0084){utils[_0xcba7('0x14')](util[_0xcba7('0x4')]('[%s][queues][queuecallerjoin]',_0xa5ed27[_0xcba7('0x6')]),_0x1b0084);}};exports[_0xcba7('0x15')]=function(_0x4f1805){try{if(!_[_0xcba7('0x16')](queues[_0x4f1805['uniqueid']])){utils['debug'](util[_0xcba7('0x4')](_0xcba7('0x17'),_0x4f1805[_0xcba7('0x6')]),_0x4f1805);if(queues[_0x4f1805['uniqueid']][_0xcba7('0x18')]){if(!queues[_0x4f1805['uniqueid']][_0xcba7('0x19')]&&!queues[_0x4f1805[_0xcba7('0x6')]]['queuecallerexit']){queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0x1a')]=!![];queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0x1b')]=utils[_0xcba7('0x13')]();queues[_0x4f1805['uniqueid']][_0xcba7('0x9')]=_0xcba7('0x1c');}utils['info'](util[_0xcba7('0x4')](_0xcba7('0x1d'),_0x4f1805['uniqueid'],queues[_0x4f1805['uniqueid']][_0xcba7('0x1e')],queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0x9')]));writeDB(queues[_0x4f1805[_0xcba7('0x6')]]);}else if(queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0xe')]){utils[_0xcba7('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4f1805['uniqueid'],queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0x1e')],queues[_0x4f1805[_0xcba7('0x6')]][_0xcba7('0xe')]));queues[queues[_0x4f1805[_0xcba7('0x6')]]['transfereduniqueid']]=queues[_0x4f1805[_0xcba7('0x6')]];queues[queues[_0x4f1805['uniqueid']][_0xcba7('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x4f1805['uniqueid']];}}}catch(_0x4e535f){utils['error'](util['format']('[%s][queues][hangup]',_0x4f1805['uniqueid']),_0x4e535f);}};exports[_0xcba7('0x1f')]=function(_0x4317f4){try{utils[_0xcba7('0xf')](util[_0xcba7('0x4')](_0xcba7('0x20'),_0x4317f4[_0xcba7('0x6')]),_0x4317f4);if(!_['isNil'](_0x4317f4[_0xcba7('0x21')]['queuestatus'])&&_0x4317f4['value'][_0xcba7('0x22')]()!==_0xcba7('0x23')){if(!_[_0xcba7('0x16')](queues[_0x4317f4[_0xcba7('0x6')]])){queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x19')]=![];queues[_0x4317f4[_0xcba7('0x6')]]['queuecallerabandonAt']=null;queues[_0x4317f4[_0xcba7('0x6')]]['queuecallerexit']=!![];queues[_0x4317f4['uniqueid']][_0xcba7('0x24')]=utils[_0xcba7('0x13')]();queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x9')]=_0x4317f4[_0xcba7('0x25')][_0xcba7('0x22')]();utils['info'](util[_0xcba7('0x4')](_0xcba7('0x26'),_0x4317f4['uniqueid'],queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x1e')],_0x4317f4[_0xcba7('0x25')],queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x9')]));writeDB(queues[_0x4317f4['uniqueid']]);}}else if(!_[_0xcba7('0x16')](_0x4317f4[_0xcba7('0x21')][_0xcba7('0x27')])){if(!_['isNil'](queues[_0x4317f4[_0xcba7('0x6')]])&&!queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x19')]){queues[_0x4317f4[_0xcba7('0x6')]]['queuecallerabandon']=![];queues[_0x4317f4['uniqueid']][_0xcba7('0x28')]=null;queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x29')]=!![];queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x24')]=utils[_0xcba7('0x13')]();queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x9')]=_0xcba7('0x2a');utils['info'](util[_0xcba7('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4317f4[_0xcba7('0x6')],queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x1e')],_0x4317f4[_0xcba7('0x25')],queues[_0x4317f4[_0xcba7('0x6')]][_0xcba7('0x9')]));}}}catch(_0x1dce22){utils[_0xcba7('0x14')](util[_0xcba7('0x4')](_0xcba7('0x20'),_0x4317f4[_0xcba7('0x6')]),_0x1dce22);}};exports[_0xcba7('0x19')]=function(_0x561db7){try{if(!_[_0xcba7('0x16')](queues[_0x561db7[_0xcba7('0x6')]])){utils[_0xcba7('0xf')](util['format']('[%s][queues][queuecallerabandon]',_0x561db7[_0xcba7('0x6')]),_0x561db7);queues[_0x561db7['uniqueid']][_0xcba7('0x29')]=![];queues[_0x561db7[_0xcba7('0x6')]][_0xcba7('0x24')]=null;queues[_0x561db7[_0xcba7('0x6')]][_0xcba7('0x19')]=!![];queues[_0x561db7[_0xcba7('0x6')]][_0xcba7('0x28')]=utils[_0xcba7('0x13')]();queues[_0x561db7[_0xcba7('0x6')]][_0xcba7('0x9')]=_0xcba7('0x2b');utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x2c'),_0x561db7['uniqueid'],queues[_0x561db7[_0xcba7('0x6')]]['name'],queues[_0x561db7[_0xcba7('0x6')]][_0xcba7('0x9')]));}}catch(_0x24e450){utils[_0xcba7('0x14')](util['format']('[%s][queues][queuecallerabandon]',_0x561db7['uniqueid']),_0x24e450);}};exports[_0xcba7('0x2d')]=function(_0x1a9721){try{if(!_[_0xcba7('0x16')](queues[_0x1a9721['uniqueid']])){utils['debug'](util[_0xcba7('0x4')](_0xcba7('0x2e'),_0x1a9721[_0xcba7('0x6')]),_0x1a9721);utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x2f'),_0x1a9721[_0xcba7('0x6')],queues[_0x1a9721[_0xcba7('0x6')]]['name'],_0x1a9721['connectedlinenum'],_0x1a9721[_0xcba7('0x30')]));queues[_0x1a9721['uniqueid']][_0xcba7('0x2d')]=!![];queues[_0x1a9721['uniqueid']][_0xcba7('0x18')]=utils[_0xcba7('0x13')]();queues[_0x1a9721[_0xcba7('0x6')]][_0xcba7('0x31')]=utils[_0xcba7('0x32')](queues[_0x1a9721[_0xcba7('0x6')]][_0xcba7('0x18')],queues[_0x1a9721['uniqueid']][_0xcba7('0x33')]);queues[_0x1a9721[_0xcba7('0x6')]][_0xcba7('0x11')]=_0x1a9721[_0xcba7('0x11')];queues[_0x1a9721[_0xcba7('0x6')]][_0xcba7('0x34')]=_0x1a9721[_0xcba7('0x34')];queues[_0x1a9721['uniqueid']][_0xcba7('0x35')]=_0x1a9721[_0xcba7('0x35')];queues[_0x1a9721[_0xcba7('0x6')]][_0xcba7('0x30')]=_0x1a9721[_0xcba7('0x30')];}}catch(_0x3c7183){utils['error'](util['format'](_0xcba7('0x2e'),_0x1a9721[_0xcba7('0x6')]),_0x3c7183);}};exports[_0xcba7('0x36')]=function(_0x27cf73){try{if(!_[_0xcba7('0x16')](queues[_0x27cf73['uniqueid']])){utils[_0xcba7('0xf')](util['format'](_0xcba7('0x37'),_0x27cf73['uniqueid']),_0x27cf73);utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x38'),_0x27cf73[_0xcba7('0x6')],queues[_0x27cf73['uniqueid']][_0xcba7('0x1e')],_0x27cf73[_0xcba7('0x39')],_0x27cf73[_0xcba7('0x3a')]));queues[_0x27cf73[_0xcba7('0x6')]]['queuecallerabandon']=![];queues[_0x27cf73['uniqueid']][_0xcba7('0x19')]=![];queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x28')]=null;queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x29')]=![];queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x9')]=null;queues[_0x27cf73['uniqueid']][_0xcba7('0x24')]=null;queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x3b')]=!![];queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x3c')]=_0x27cf73[_0xcba7('0x3a')];queues[_0x27cf73[_0xcba7('0x6')]][_0xcba7('0x8')]=_0x27cf73[_0xcba7('0x39')];}}catch(_0x61a4b2){utils[_0xcba7('0x14')](util['format'](_0xcba7('0x37'),_0x27cf73[_0xcba7('0x6')]),_0x61a4b2);}};exports['agentcomplete']=function(_0x43c79c){try{if(!_[_0xcba7('0x16')](queues[_0x43c79c[_0xcba7('0x6')]])){if(queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x18')]){utils[_0xcba7('0xf')](util[_0xcba7('0x4')]('[%s][queues][agentcomplete]',_0x43c79c[_0xcba7('0x6')]),_0x43c79c);queues[_0x43c79c[_0xcba7('0x6')]]['queuecallerabandon']=![];queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x19')]=![];queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x28')]=null;queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x29')]=![];queues[_0x43c79c[_0xcba7('0x6')]]['queuecallerexitAt']=null;queues[_0x43c79c[_0xcba7('0x6')]]['assigned']=!![];queues[_0x43c79c['uniqueid']][_0xcba7('0x8')]=_0x43c79c[_0xcba7('0x39')];queues[_0x43c79c[_0xcba7('0x6')]]['queuecallercomplete']=!![];queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x1b')]=utils['now']();if(_0x43c79c['reason']==_0xcba7('0x3d')){if(!queues[_0x43c79c['uniqueid']]['transfer']){queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x9')]=_0xcba7('0x3e');}}else{queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x9')]=_0xcba7('0x3f')+_0x43c79c[_0xcba7('0x40')][_0xcba7('0x22')]();}utils[_0xcba7('0x3')](util['format'](_0xcba7('0x41'),_0x43c79c[_0xcba7('0x6')],queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x1e')],_0x43c79c[_0xcba7('0x39')],queues[_0x43c79c[_0xcba7('0x6')]][_0xcba7('0x9')]));writeDB(queues[_0x43c79c[_0xcba7('0x6')]]);}}}catch(_0x1af091){utils['error'](util[_0xcba7('0x4')](_0xcba7('0x42'),_0x43c79c[_0xcba7('0x6')]),_0x1af091);}};exports[_0xcba7('0x43')]=function(_0x165bfc){try{if(!_[_0xcba7('0x16')](queues[_0x165bfc[_0xcba7('0x44')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x165bfc['uniqueid']),_0x165bfc);queues[_0x165bfc[_0xcba7('0x44')]][_0xcba7('0x3d')]=!![];queues[_0x165bfc[_0xcba7('0x44')]][_0xcba7('0x45')]=_0xcba7('0x46');queues[_0x165bfc[_0xcba7('0x44')]][_0xcba7('0x47')]=_0x165bfc[_0xcba7('0x48')];queues[_0x165bfc[_0xcba7('0x44')]][_0xcba7('0x49')]=_0x165bfc[_0xcba7('0x44')];queues[_0x165bfc['transfereeuniqueid']]['queuecallerexitreason']=_0xcba7('0x4a');utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x4b'),_0x165bfc[_0xcba7('0x6')],queues[_0x165bfc[_0xcba7('0x44')]][_0xcba7('0x1e')],_0x165bfc[_0xcba7('0x44')],_0x165bfc[_0xcba7('0x48')]));}}catch(_0x47dc07){utils[_0xcba7('0x14')](util[_0xcba7('0x4')](_0xcba7('0x4c'),_0x165bfc['uniqueid']),_0x47dc07);}};exports[_0xcba7('0x4d')]=function(_0x40ab43){try{utils[_0xcba7('0xf')](util[_0xcba7('0x4')]('[%s][queues][attendedtransfer]',_0x40ab43[_0xcba7('0x4e')]),_0x40ab43);if(_0x40ab43[_0xcba7('0x4e')]==_0x40ab43[_0xcba7('0x4f')]){if(!_[_0xcba7('0x16')](queues[_0x40ab43[_0xcba7('0x50')]])){utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x51'),_0x40ab43['origtransfereruniqueid'],queues[_0x40ab43[_0xcba7('0x50')]][_0xcba7('0x1e')],_0x40ab43[_0xcba7('0x52')]));queues[_0x40ab43[_0xcba7('0x50')]][_0xcba7('0x3d')]=!![];queues[_0x40ab43[_0xcba7('0x50')]]['transfertype']=_0xcba7('0x53');queues[_0x40ab43[_0xcba7('0x50')]][_0xcba7('0x47')]=_0x40ab43[_0xcba7('0x52')];queues[_0x40ab43['secondtransfererlinkedid']]['transferuniqueid']=_0x40ab43[_0xcba7('0x4e')];queues[_0x40ab43[_0xcba7('0x50')]][_0xcba7('0x9')]=_0xcba7('0x54');}if(!_['isNil'](queues[_0x40ab43[_0xcba7('0x4f')]])){if(_0x40ab43[_0xcba7('0x55')]&&queues[_0x40ab43[_0xcba7('0x55')]]){queues[_0x40ab43[_0xcba7('0x55')]]['queuecallerenterreason']=0x1;queues[_0x40ab43[_0xcba7('0x44')]]=_[_0xcba7('0x56')](queues[_0x40ab43[_0xcba7('0x55')]]);queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0xe')]=_0x40ab43[_0xcba7('0x57')];queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x58')]=0x2;queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x59')]=queues[_0x40ab43['secondtransfererlinkedid']]['calleridnum'];queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x5a')]=queues[_0x40ab43[_0xcba7('0x50')]]['calleridname'];queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x33')]=utils['now']();queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x18')]=utils[_0xcba7('0x13')]();queues[_0x40ab43['transfereeuniqueid']][_0xcba7('0x31')]=0x0;queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x5b')]=0x0;utils['info'](util[_0xcba7('0x4')](_0xcba7('0x5c'),_0x40ab43['origtransfereruniqueid'],queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x1e')],queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x59')],queues[_0x40ab43[_0xcba7('0x44')]][_0xcba7('0x5a')]));}else{utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x5d'),_0x40ab43[_0xcba7('0x4e')],queues[_0x40ab43['origtransfererlinkedid']][_0xcba7('0x1e')],_0x40ab43['secondtransfererlinkedid']));queues[_0x40ab43[_0xcba7('0x4f')]]['transfereduniqueid']=_0x40ab43[_0xcba7('0x50')];}}}else if(_0x40ab43[_0xcba7('0x5e')]==_0x40ab43[_0xcba7('0x50')]){if(!_[_0xcba7('0x16')](queues[_0x40ab43['origtransfererlinkedid']])){utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x5f'),_0x40ab43[_0xcba7('0x4e')],queues[_0x40ab43[_0xcba7('0x4f')]]['name'],_0x40ab43[_0xcba7('0x5e')],_0x40ab43[_0xcba7('0x60')]));queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x3d')]=!![];queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x45')]=_0xcba7('0x53');queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x47')]=_0x40ab43[_0xcba7('0x60')];queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x49')]=_0x40ab43[_0xcba7('0x5e')];queues[_0x40ab43['origtransfererlinkedid']][_0xcba7('0x9')]=_0xcba7('0x54');}if(!_[_0xcba7('0x16')](queues[_0x40ab43[_0xcba7('0x50')]])){if(_0x40ab43[_0xcba7('0x61')]&&queues[_0x40ab43[_0xcba7('0x61')]]){queues[_0x40ab43[_0xcba7('0x61')]][_0xcba7('0x58')]=0x1;queues[_0x40ab43['transfertargetuniqueid']]=_[_0xcba7('0x56')](queues[_0x40ab43[_0xcba7('0x61')]]);queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0xe')]=_0x40ab43[_0xcba7('0x57')];queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x58')]=0x2;queues[_0x40ab43[_0xcba7('0x57')]]['calleridnum']=queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x59')];queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x5a')]=queues[_0x40ab43[_0xcba7('0x4f')]][_0xcba7('0x5a')];queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x33')]=utils[_0xcba7('0x13')]();queues[_0x40ab43['transfertargetuniqueid']][_0xcba7('0x18')]=utils[_0xcba7('0x13')]();queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x31')]=0x0;queues[_0x40ab43[_0xcba7('0x57')]]['mohtime']=0x0;utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x62'),_0x40ab43[_0xcba7('0x4e')],queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x1e')],queues[_0x40ab43[_0xcba7('0x57')]]['transfereduniqueid'],queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x59')],queues[_0x40ab43[_0xcba7('0x57')]][_0xcba7('0x5a')]));}else{utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x5d'),_0x40ab43[_0xcba7('0x4e')],queues[_0x40ab43[_0xcba7('0x50')]]['name'],_0x40ab43[_0xcba7('0x4f')]));queues[_0x40ab43[_0xcba7('0x50')]][_0xcba7('0xe')]=_0x40ab43['origtransfererlinkedid'];}}}}catch(_0x45abab){utils[_0xcba7('0x14')](util['format'](_0xcba7('0x63'),_0x40ab43['origtransfereruniqueid']),_0x45abab);}};exports[_0xcba7('0x64')]=function(_0x4b65b9){try{if(!_['isNil'](queues[_0x4b65b9[_0xcba7('0x6')]])){utils[_0xcba7('0xf')](util[_0xcba7('0x4')](_0xcba7('0x65'),_0x4b65b9[_0xcba7('0x6')]),_0x4b65b9);queues[_0x4b65b9[_0xcba7('0x6')]][_0xcba7('0x66')]=utils[_0xcba7('0x13')]();utils[_0xcba7('0x3')](util['format'](_0xcba7('0x67'),_0x4b65b9[_0xcba7('0x6')],queues[_0x4b65b9['uniqueid']][_0xcba7('0x1e')],queues[_0x4b65b9['uniqueid']][_0xcba7('0x66')]));}}catch(_0x33a4cf){utils[_0xcba7('0x14')](util[_0xcba7('0x4')](_0xcba7('0x65'),_0x4b65b9[_0xcba7('0x6')]),_0x33a4cf);}};exports[_0xcba7('0x68')]=function(_0x324b24){try{if(!_[_0xcba7('0x16')](queues[_0x324b24[_0xcba7('0x6')]])){if(!_[_0xcba7('0x16')](queues[_0x324b24[_0xcba7('0x6')]]['musiconholdstartAt'])){utils[_0xcba7('0xf')](util['format'](_0xcba7('0x69'),_0x324b24[_0xcba7('0x6')]),_0x324b24);queues[_0x324b24[_0xcba7('0x6')]]['mohtime']+=utils[_0xcba7('0x32')](utils[_0xcba7('0x13')](),queues[_0x324b24[_0xcba7('0x6')]][_0xcba7('0x66')]);utils[_0xcba7('0x3')](util[_0xcba7('0x4')](_0xcba7('0x6a'),_0x324b24['uniqueid'],queues[_0x324b24[_0xcba7('0x6')]][_0xcba7('0x1e')],queues[_0x324b24[_0xcba7('0x6')]][_0xcba7('0x5b')]));delete queues[_0x324b24[_0xcba7('0x6')]][_0xcba7('0x66')];}}}catch(_0x3b5369){utils[_0xcba7('0x14')](util['format'](_0xcba7('0x69'),_0x324b24[_0xcba7('0x6')]),_0x3b5369);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4bab64a..24bf8c8 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 _0xd78e=['startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set'];(function(_0x4a198c,_0x4a7e32){var _0x248f53=function(_0x184a95){while(--_0x184a95){_0x4a198c['push'](_0x4a198c['shift']());}};_0x248f53(++_0x4a7e32);}(_0xd78e,0x9d));var _0xed78=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xd78e[_0x18b5e8];return _0x25baed;};'use strict';var _=require(_0xed78('0x0'));var util=require('util');var utils=require(_0xed78('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2aab97){var _0x3a0bed;utils[_0xed78('0x2')](util['format'](_0xed78('0x3'),_0x2aab97[_0xed78('0x4')]));if(transfers[_0xed78('0x5')][_0x2aab97[_0xed78('0x4')]]){_0x3a0bed=_0x2aab97[_0xed78('0x4')];_0x2aab97[_0xed78('0x4')]=transfers[_0xed78('0x5')][_0x2aab97[_0xed78('0x4')]]['transfereeuniqueid'];}if(_0x2aab97[_0xed78('0x6')]){utils[_0xed78('0x7')](_0x2aab97[_0xed78('0x6')])['then'](function(_0x153ae9){if(_0x153ae9){_0x2aab97[_0xed78('0x8')]=_0x153ae9['name'];_0x2aab97[_0xed78('0x9')]=_0x153ae9['id'];}utils[_0xed78('0xa')](_0xed78('0xb'),_0x2aab97);});}else{utils[_0xed78('0xa')](_0xed78('0xb'),_0x2aab97);}if(_0x3a0bed)delete transfers[_0xed78('0x5')][_0x3a0bed];}exports[_0xed78('0xc')]=function(_0x1f2548){try{utils['debug'](util['format'](_0xed78('0xd'),_0x1f2548[_0xed78('0x4')]),_0x1f2548);if(_0x1f2548[_0xed78('0x4')]==_0x1f2548[_0xed78('0xe')]){utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x10'),_0x1f2548['uniqueid'],_0x1f2548[_0xed78('0x11')],_0x1f2548[_0xed78('0x12')]));recordings[_0x1f2548['uniqueid']]={'uniqueid':_0x1f2548[_0xed78('0x4')],'accountcode':_0x1f2548[_0xed78('0x6')],'exten':_0x1f2548[_0xed78('0x12')],'context':_0x1f2548[_0xed78('0x11')],'channel':_0x1f2548[_0xed78('0x13')],'monitors':[]};}}catch(_0x3b0070){utils[_0xed78('0x14')](util['format']('[%s][recordings][newchannel]',_0x1f2548[_0xed78('0x4')]),_0x3b0070);}};exports[_0xed78('0x15')]=function(_0x534ebf){try{utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x17'),_0x534ebf[_0xed78('0x4')]),_0x534ebf);if(!_[_0xed78('0x18')](recordings[_0x534ebf['uniqueid']])&&_0x534ebf['channelstate']==0x6){utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x19'),_0x534ebf[_0xed78('0x4')],_0x534ebf[_0xed78('0x11')],_0x534ebf[_0xed78('0x13')]));}else if(!_[_0xed78('0x18')](recordings[_0x534ebf[_0xed78('0xe')]])&&_0x534ebf[_0xed78('0x1a')]==0x6&&_0x534ebf[_0xed78('0x11')]!=_0xed78('0x1b')){utils[_0xed78('0x2')](util['format'](_0xed78('0x1c'),_0x534ebf['uniqueid'],_0x534ebf['linkedid'],_0x534ebf[_0xed78('0x11')],_0x534ebf[_0xed78('0x13')]));recordings[_0x534ebf[_0xed78('0xe')]][_0xed78('0x6')]=_0x534ebf['accountcode'];}}catch(_0x4c1d43){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x17'),_0x534ebf['uniqueid']),_0x4c1d43);}};exports[_0xed78('0x1d')]=function(_0x3cd748){try{if(!_['isNil'](_0x3cd748['variable'])&&!_[_0xed78('0x18')](_0x3cd748[_0xed78('0x1e')][_0xed78('0x1f')])){utils['debug'](util[_0xed78('0xf')](_0xed78('0x20'),_0x3cd748[_0xed78('0x4')]),_0x3cd748);utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x21'),_0x3cd748[_0xed78('0x4')],_0x3cd748[_0xed78('0x1e')],_0x3cd748['value']));if(_[_0xed78('0x22')](_0x3cd748[_0xed78('0x23')],_0xed78('0x24'))){_0x3cd748[_0xed78('0x23')]=_0x3cd748[_0xed78('0x23')][_0xed78('0x25')]('.wav49',_0xed78('0x26'));}if(recordings[_0x3cd748[_0xed78('0xe')]]){var _0x1f463c=_[_0xed78('0x27')](recordings[_0x3cd748[_0xed78('0xe')]][_0xed78('0x28')],{'value':_0x3cd748['value']});if(_[_0xed78('0x18')](_0x1f463c)){recordings[_0x3cd748[_0xed78('0xe')]][_0xed78('0x28')][_0xed78('0x29')]({'value':_0x3cd748['value']});}}}}catch(_0x517ec2){utils['error'](util[_0xed78('0xf')](_0xed78('0x20'),_0x3cd748[_0xed78('0x4')]),_0x517ec2);}};exports[_0xed78('0x2a')]=function(_0x5e0fdb){try{if(!_[_0xed78('0x18')](recordings[_0x5e0fdb[_0xed78('0x4')]])){utils[_0xed78('0x16')](util['format'](_0xed78('0x2b'),_0x5e0fdb[_0xed78('0x4')]),_0x5e0fdb);utils[_0xed78('0x2')](util[_0xed78('0xf')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5e0fdb[_0xed78('0x4')],_0x5e0fdb['calleridnum'],_0x5e0fdb[_0xed78('0x2c')],_0x5e0fdb[_0xed78('0x2d')]));recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2e')]=_0x5e0fdb['calleridnum'];recordings[_0x5e0fdb['uniqueid']][_0xed78('0x2c')]=_0x5e0fdb[_0xed78('0x2c')];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2f')]=_0x5e0fdb['connectedlinenum'];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x30')]=_0x5e0fdb[_0xed78('0x30')];if(recordings[_0x5e0fdb['uniqueid']][_0xed78('0x31')]=='outbound'&&recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x6')]){recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x2f')]=recordings[_0x5e0fdb['uniqueid']][_0xed78('0x6')];recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x30')]='';}recordings[_0x5e0fdb[_0xed78('0x4')]][_0xed78('0x28')][_0xed78('0x32')](function(_0x38bec6){var _0x596c71=_[_0xed78('0x33')](recordings[_0x5e0fdb[_0xed78('0x4')]]);_0x596c71[_0xed78('0x23')]=_0x38bec6['value'];writeDB(_0x596c71);});delete recordings[_0x5e0fdb[_0xed78('0x4')]];}}catch(_0x15fd5c){utils[_0xed78('0x14')](util['format'](_0xed78('0x2b'),_0x5e0fdb[_0xed78('0x4')]),_0x15fd5c);}};exports[_0xed78('0x34')]=function(_0x239d5c){try{if(!_['isNil'](recordings[_0x239d5c[_0xed78('0x4')]])){utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x35'),_0x239d5c[_0xed78('0x4')]),_0x239d5c);utils[_0xed78('0x2')](util[_0xed78('0xf')](_0xed78('0x36'),_0x239d5c[_0xed78('0x4')],_0x239d5c[_0xed78('0x37')],_0x239d5c[_0xed78('0x38')]));if(_0x239d5c['application'][_0xed78('0x39')]()==_0xed78('0x3a')&&_[_0xed78('0x3b')](_0x239d5c[_0xed78('0x38')]['toLowerCase'](),_0xed78('0x3c'))){var _0x248871=_0x239d5c[_0xed78('0x38')][_0xed78('0x3d')]('=');var _0x4a62a8=_0x248871[0x0]['substring'](_0x248871[0x0][_0xed78('0x3e')]('(')+0x1,_0x248871[0x0][_0xed78('0x3e')](')'));var _0x21c73d=_0x248871[0x1];recordings[_0x239d5c['uniqueid']][_0x4a62a8]=_0x21c73d;}}}catch(_0x1283ea){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x35'),_0x239d5c['uniqueid']),_0x1283ea);}};exports['queuecallerjoin']=function(_0x10b0bc){try{if(!_[_0xed78('0x18')](recordings[_0x10b0bc[_0xed78('0x4')]])){utils[_0xed78('0x16')](util[_0xed78('0xf')](_0xed78('0x3f'),_0x10b0bc[_0xed78('0x4')]),_0x10b0bc);utils['info'](util[_0xed78('0xf')](_0xed78('0x40'),_0x10b0bc[_0xed78('0x4')],_0x10b0bc[_0xed78('0x41')]));recordings[_0x10b0bc[_0xed78('0x4')]][_0xed78('0x41')]=_0x10b0bc['queue'];}}catch(_0x24202e){utils['error'](util['format'](_0xed78('0x3f'),_0x10b0bc[_0xed78('0x4')]),_0x24202e);}};exports['blindtransfer']=function(_0x517be6){try{utils['debug'](util[_0xed78('0xf')](_0xed78('0x42'),_0x517be6['uniqueid']),_0x517be6);utils[_0xed78('0x2')](util[_0xed78('0xf')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x517be6[_0xed78('0x4')],_0x517be6[_0xed78('0x43')],_0x517be6[_0xed78('0x44')],_0x517be6['transfereecalleridnum'],_0x517be6[_0xed78('0x45')]));if(recordings[_0x517be6[_0xed78('0x46')]]&&transfers[_0xed78('0x5')][_0x517be6[_0xed78('0x46')]]){transfers[_0xed78('0x5')][_0x517be6[_0xed78('0x46')]][_0xed78('0x47')]=!![];}}catch(_0x1f1708){utils[_0xed78('0x14')](util[_0xed78('0xf')](_0xed78('0x42'),_0x517be6[_0xed78('0x4')]),_0x1f1708);}}; \ No newline at end of file +var _0x4ba8=['[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone'];(function(_0x28d1a5,_0x5790cc){var _0x31f9ff=function(_0x4eb85c){while(--_0x4eb85c){_0x28d1a5['push'](_0x28d1a5['shift']());}};_0x31f9ff(++_0x5790cc);}(_0x4ba8,0xb3));var _0x84ba=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ba8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x84ba('0x0'));var util=require(_0x84ba('0x1'));var utils=require('./utils');var transfers=require(_0x84ba('0x2'));var recordings={};function writeDB(_0x13c08c){var _0x316271;utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x5'),_0x13c08c[_0x84ba('0x6')]));if(transfers[_0x84ba('0x7')][_0x13c08c[_0x84ba('0x6')]]){_0x316271=_0x13c08c[_0x84ba('0x6')];_0x13c08c[_0x84ba('0x6')]=transfers[_0x84ba('0x7')][_0x13c08c[_0x84ba('0x6')]]['transfereeuniqueid'];}if(_0x13c08c[_0x84ba('0x8')]){utils['getUserByInternal'](_0x13c08c[_0x84ba('0x8')])[_0x84ba('0x9')](function(_0x49590e){if(_0x49590e){_0x13c08c[_0x84ba('0xa')]=_0x49590e['name'];_0x13c08c[_0x84ba('0xb')]=_0x49590e['id'];}utils[_0x84ba('0xc')](_0x84ba('0xd'),_0x13c08c);});}else{utils[_0x84ba('0xc')](_0x84ba('0xd'),_0x13c08c);}if(_0x316271)delete transfers[_0x84ba('0x7')][_0x316271];}exports[_0x84ba('0xe')]=function(_0x56a43b){try{utils[_0x84ba('0xf')](util[_0x84ba('0x4')]('[%s][recordings][newchannel]',_0x56a43b[_0x84ba('0x6')]),_0x56a43b);if(_0x56a43b[_0x84ba('0x6')]==_0x56a43b[_0x84ba('0x10')]){utils['info'](util[_0x84ba('0x4')](_0x84ba('0x11'),_0x56a43b['uniqueid'],_0x56a43b[_0x84ba('0x12')],_0x56a43b[_0x84ba('0x13')]));recordings[_0x56a43b[_0x84ba('0x6')]]={'uniqueid':_0x56a43b[_0x84ba('0x6')],'accountcode':_0x56a43b[_0x84ba('0x8')],'exten':_0x56a43b[_0x84ba('0x13')],'context':_0x56a43b[_0x84ba('0x12')],'channel':_0x56a43b['channel'],'monitors':[]};}}catch(_0x3606a2){utils[_0x84ba('0x14')](util[_0x84ba('0x4')](_0x84ba('0x15'),_0x56a43b[_0x84ba('0x6')]),_0x3606a2);}};exports[_0x84ba('0x16')]=function(_0x55cad0){try{utils[_0x84ba('0xf')](util[_0x84ba('0x4')](_0x84ba('0x17'),_0x55cad0['uniqueid']),_0x55cad0);if(!_[_0x84ba('0x18')](recordings[_0x55cad0[_0x84ba('0x6')]])&&_0x55cad0[_0x84ba('0x19')]==0x6){utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x1a'),_0x55cad0[_0x84ba('0x6')],_0x55cad0['context'],_0x55cad0[_0x84ba('0x1b')]));}else if(!_[_0x84ba('0x18')](recordings[_0x55cad0[_0x84ba('0x10')]])&&_0x55cad0['channelstate']==0x6&&_0x55cad0['context']!=_0x84ba('0x1c')){utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x1d'),_0x55cad0[_0x84ba('0x6')],_0x55cad0['linkedid'],_0x55cad0[_0x84ba('0x12')],_0x55cad0['channel']));recordings[_0x55cad0['linkedid']][_0x84ba('0x8')]=_0x55cad0[_0x84ba('0x8')];}}catch(_0x317e7d){utils[_0x84ba('0x14')](util[_0x84ba('0x4')](_0x84ba('0x17'),_0x55cad0['uniqueid']),_0x317e7d);}};exports[_0x84ba('0x1e')]=function(_0x16f499){try{if(!_[_0x84ba('0x18')](_0x16f499['variable'])&&!_[_0x84ba('0x18')](_0x16f499[_0x84ba('0x1f')][_0x84ba('0x20')])){utils['debug'](util[_0x84ba('0x4')]('[%s][recordings][varset]',_0x16f499['uniqueid']),_0x16f499);utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x21'),_0x16f499['uniqueid'],_0x16f499['variable'],_0x16f499['value']));if(_[_0x84ba('0x22')](_0x16f499[_0x84ba('0x23')],_0x84ba('0x24'))){_0x16f499[_0x84ba('0x23')]=_0x16f499['value'][_0x84ba('0x25')]('.wav49',_0x84ba('0x26'));}if(recordings[_0x16f499['linkedid']]){var _0x4fdcf1=_[_0x84ba('0x27')](recordings[_0x16f499[_0x84ba('0x10')]][_0x84ba('0x28')],{'value':_0x16f499[_0x84ba('0x23')]});if(_[_0x84ba('0x18')](_0x4fdcf1)){recordings[_0x16f499[_0x84ba('0x10')]]['monitors'][_0x84ba('0x29')]({'value':_0x16f499['value']});}}}}catch(_0x2fc4dc){utils['error'](util[_0x84ba('0x4')]('[%s][recordings][varset]',_0x16f499[_0x84ba('0x6')]),_0x2fc4dc);}};exports[_0x84ba('0x2a')]=function(_0x4e3dbd){try{if(!_[_0x84ba('0x18')](recordings[_0x4e3dbd['uniqueid']])){utils[_0x84ba('0xf')](util[_0x84ba('0x4')]('[%s][recordings][hangup]',_0x4e3dbd['uniqueid']),_0x4e3dbd);utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x2b'),_0x4e3dbd[_0x84ba('0x6')],_0x4e3dbd[_0x84ba('0x2c')],_0x4e3dbd['calleridname'],_0x4e3dbd[_0x84ba('0x2d')]));recordings[_0x4e3dbd[_0x84ba('0x6')]][_0x84ba('0x2c')]=_0x4e3dbd[_0x84ba('0x2c')];recordings[_0x4e3dbd['uniqueid']][_0x84ba('0x2e')]=_0x4e3dbd[_0x84ba('0x2e')];recordings[_0x4e3dbd[_0x84ba('0x6')]]['connectedlinenum']=_0x4e3dbd[_0x84ba('0x2f')];recordings[_0x4e3dbd[_0x84ba('0x6')]][_0x84ba('0x30')]=_0x4e3dbd[_0x84ba('0x30')];if(recordings[_0x4e3dbd[_0x84ba('0x6')]]['type']==_0x84ba('0x31')&&recordings[_0x4e3dbd[_0x84ba('0x6')]]['accountcode']){recordings[_0x4e3dbd['uniqueid']]['connectedlinenum']=recordings[_0x4e3dbd[_0x84ba('0x6')]][_0x84ba('0x8')];recordings[_0x4e3dbd[_0x84ba('0x6')]]['connectedlinename']='';}recordings[_0x4e3dbd[_0x84ba('0x6')]][_0x84ba('0x28')][_0x84ba('0x32')](function(_0x5092d8){var _0xb20f96=_[_0x84ba('0x33')](recordings[_0x4e3dbd[_0x84ba('0x6')]]);_0xb20f96[_0x84ba('0x23')]=_0x5092d8[_0x84ba('0x23')];writeDB(_0xb20f96);});delete recordings[_0x4e3dbd[_0x84ba('0x6')]];}}catch(_0x4fa059){utils[_0x84ba('0x14')](util['format'](_0x84ba('0x34'),_0x4e3dbd[_0x84ba('0x6')]),_0x4fa059);}};exports[_0x84ba('0x35')]=function(_0x200798){try{if(!_['isNil'](recordings[_0x200798[_0x84ba('0x6')]])){utils[_0x84ba('0xf')](util[_0x84ba('0x4')](_0x84ba('0x36'),_0x200798[_0x84ba('0x6')]),_0x200798);utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x37'),_0x200798[_0x84ba('0x6')],_0x200798[_0x84ba('0x38')],_0x200798[_0x84ba('0x39')]));if(_0x200798[_0x84ba('0x38')][_0x84ba('0x3a')]()==_0x84ba('0x3b')&&_[_0x84ba('0x3c')](_0x200798['appdata']['toLowerCase'](),_0x84ba('0x3d'))){var _0x3b4278=_0x200798['appdata'][_0x84ba('0x3e')]('=');var _0xc72c7c=_0x3b4278[0x0][_0x84ba('0x3f')](_0x3b4278[0x0][_0x84ba('0x40')]('(')+0x1,_0x3b4278[0x0][_0x84ba('0x40')](')'));var _0x9e2a62=_0x3b4278[0x1];recordings[_0x200798[_0x84ba('0x6')]][_0xc72c7c]=_0x9e2a62;}}}catch(_0x242f41){utils['error'](util['format']('[%s][recordings][newexten]',_0x200798['uniqueid']),_0x242f41);}};exports['queuecallerjoin']=function(_0x4e60bb){try{if(!_[_0x84ba('0x18')](recordings[_0x4e60bb[_0x84ba('0x6')]])){utils[_0x84ba('0xf')](util[_0x84ba('0x4')](_0x84ba('0x41'),_0x4e60bb[_0x84ba('0x6')]),_0x4e60bb);utils[_0x84ba('0x3')](util[_0x84ba('0x4')](_0x84ba('0x42'),_0x4e60bb['uniqueid'],_0x4e60bb[_0x84ba('0x43')]));recordings[_0x4e60bb[_0x84ba('0x6')]][_0x84ba('0x43')]=_0x4e60bb[_0x84ba('0x43')];}}catch(_0x2b9250){utils[_0x84ba('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x4e60bb[_0x84ba('0x6')]),_0x2b9250);}};exports[_0x84ba('0x44')]=function(_0x27ae2c){try{utils[_0x84ba('0xf')](util[_0x84ba('0x4')](_0x84ba('0x45'),_0x27ae2c[_0x84ba('0x6')]),_0x27ae2c);utils['info'](util[_0x84ba('0x4')](_0x84ba('0x46'),_0x27ae2c[_0x84ba('0x6')],_0x27ae2c[_0x84ba('0x47')],_0x27ae2c[_0x84ba('0x48')],_0x27ae2c[_0x84ba('0x49')],_0x27ae2c[_0x84ba('0x4a')]));if(recordings[_0x27ae2c[_0x84ba('0x4b')]]&&transfers[_0x84ba('0x7')][_0x27ae2c[_0x84ba('0x4b')]]){transfers[_0x84ba('0x7')][_0x27ae2c[_0x84ba('0x4b')]][_0x84ba('0x4c')]=!![];}}catch(_0x13d082){utils['error'](util[_0x84ba('0x4')](_0x84ba('0x45'),_0x27ae2c['uniqueid']),_0x13d082);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4e0c5df..72b4e37 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 _0x17f0=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','transfereruniqueid','error','origtransferercalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17f0,0xc7));var _0x017f=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x17f0[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x017f('0x0'));var util=require(_0x017f('0x1'));var utils=require(_0x017f('0x2'));function writeDB(_0x5a5fd8){utils[_0x017f('0x3')](util[_0x017f('0x4')](_0x017f('0x5'),_0x5a5fd8[_0x017f('0x6')]===_0x017f('0x7')?_0x5a5fd8[_0x017f('0x8')]:_0x5a5fd8[_0x017f('0x9')],_0x5a5fd8[_0x017f('0x6')]));utils[_0x017f('0xa')](_0x017f('0xb'),_0x5a5fd8);}exports[_0x017f('0xc')]={};exports[_0x017f('0xd')]=function(_0x2fd6d9){try{utils[_0x017f('0xe')](util[_0x017f('0x4')](_0x017f('0xf'),_0x2fd6d9[_0x017f('0x9')]),_0x2fd6d9);utils[_0x017f('0x3')](util[_0x017f('0x4')](_0x017f('0x10'),_0x2fd6d9[_0x017f('0x9')],_0x2fd6d9[_0x017f('0x11')],_0x2fd6d9[_0x017f('0x12')],_0x2fd6d9['transfereecalleridnum'],_0x2fd6d9[_0x017f('0x13')]));_0x2fd6d9['type']=_0x017f('0x14');exports[_0x017f('0xc')][_0x2fd6d9[_0x017f('0x15')]]=_0x2fd6d9;writeDB(_0x2fd6d9);}catch(_0x47b50f){utils[_0x017f('0x16')](util[_0x017f('0x4')](_0x017f('0xf'),_0x2fd6d9[_0x017f('0x9')]),_0x47b50f);}};exports['attendedtransfer']=function(_0x1f4cd8){try{utils[_0x017f('0xe')](util[_0x017f('0x4')]('[%s][transfers][attendedtransfer]',_0x1f4cd8[_0x017f('0x8')]),_0x1f4cd8);utils[_0x017f('0x3')](util[_0x017f('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1f4cd8[_0x017f('0x8')],_0x1f4cd8[_0x017f('0x17')],_0x1f4cd8['origtransferercalleridname'],_0x1f4cd8['transfertargetcalleridnum'],_0x1f4cd8['transfertargetcalleridname']));_0x1f4cd8=_[_0x017f('0x18')](_0x1f4cd8,{'transfererchannel':_0x1f4cd8['origtransfererchannel'],'transferercalleridnum':_0x1f4cd8['origtransferercalleridnum'],'transferercalleridname':_0x1f4cd8[_0x017f('0x19')],'transfererconnectedlinenum':_0x1f4cd8[_0x017f('0x1a')],'transfererconnectedlinename':_0x1f4cd8[_0x017f('0x1b')],'transfereraccountcode':_0x1f4cd8[_0x017f('0x1c')],'transferercontext':_0x1f4cd8[_0x017f('0x1d')],'transfererexten':_0x1f4cd8[_0x017f('0x1e')],'transfererlinkedid':_0x1f4cd8[_0x017f('0x1f')],'context':_0x1f4cd8[_0x017f('0x20')],'extension':_0x1f4cd8[_0x017f('0x21')],'type':_0x017f('0x7')});if(_[_0x017f('0x22')](_0x1f4cd8[_0x017f('0x23')])){_0x1f4cd8=_['assign'](_0x1f4cd8,{'transfereechannel':_0x1f4cd8[_0x017f('0x24')],'transfereecalleridnum':_0x1f4cd8[_0x017f('0x25')],'transfereecalleridname':_0x1f4cd8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1f4cd8[_0x017f('0x26')],'transfereeconnectedlinename':_0x1f4cd8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f4cd8['transfertargetaccountcode'],'transfereecontext':_0x1f4cd8[_0x017f('0x27')],'transfereeexten':_0x1f4cd8[_0x017f('0x28')],'transfereelinkedid':_0x1f4cd8[_0x017f('0x29')]});}writeDB(_0x1f4cd8);}catch(_0x15a273){utils['error'](util[_0x017f('0x4')](_0x017f('0x2a'),_0x1f4cd8[_0x017f('0x8')]),_0x15a273);}}; \ No newline at end of file +var _0xe513=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','blinds','blindtransfer','debug','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe513,0x164));var _0x3e51=function(_0x5f02d7,_0x2645d3){_0x5f02d7=_0x5f02d7-0x0;var _0x42eb53=_0xe513[_0x5f02d7];return _0x42eb53;};'use strict';var _=require(_0x3e51('0x0'));var util=require(_0x3e51('0x1'));var utils=require(_0x3e51('0x2'));function writeDB(_0x34a714){utils[_0x3e51('0x3')](util[_0x3e51('0x4')](_0x3e51('0x5'),_0x34a714[_0x3e51('0x6')]===_0x3e51('0x7')?_0x34a714[_0x3e51('0x8')]:_0x34a714['uniqueid'],_0x34a714[_0x3e51('0x6')]));utils['request']('CreateVoiceTransferReport',_0x34a714);}exports[_0x3e51('0x9')]={};exports[_0x3e51('0xa')]=function(_0x40974e){try{utils[_0x3e51('0xb')](util[_0x3e51('0x4')]('[%s][transfers][blindtransfer]',_0x40974e[_0x3e51('0xc')]),_0x40974e);utils['info'](util[_0x3e51('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40974e['uniqueid'],_0x40974e[_0x3e51('0xd')],_0x40974e[_0x3e51('0xe')],_0x40974e[_0x3e51('0xf')],_0x40974e[_0x3e51('0x10')]));_0x40974e[_0x3e51('0x6')]=_0x3e51('0x11');exports[_0x3e51('0x9')][_0x40974e[_0x3e51('0x12')]]=_0x40974e;writeDB(_0x40974e);}catch(_0x2b6f7a){utils[_0x3e51('0x13')](util['format'](_0x3e51('0x14'),_0x40974e['uniqueid']),_0x2b6f7a);}};exports['attendedtransfer']=function(_0x40b38d){try{utils[_0x3e51('0xb')](util[_0x3e51('0x4')](_0x3e51('0x15'),_0x40b38d[_0x3e51('0x8')]),_0x40b38d);utils[_0x3e51('0x3')](util[_0x3e51('0x4')](_0x3e51('0x16'),_0x40b38d[_0x3e51('0x8')],_0x40b38d[_0x3e51('0x17')],_0x40b38d[_0x3e51('0x18')],_0x40b38d['transfertargetcalleridnum'],_0x40b38d['transfertargetcalleridname']));_0x40b38d=_[_0x3e51('0x19')](_0x40b38d,{'transfererchannel':_0x40b38d[_0x3e51('0x1a')],'transferercalleridnum':_0x40b38d[_0x3e51('0x17')],'transferercalleridname':_0x40b38d[_0x3e51('0x18')],'transfererconnectedlinenum':_0x40b38d[_0x3e51('0x1b')],'transfererconnectedlinename':_0x40b38d[_0x3e51('0x1c')],'transfereraccountcode':_0x40b38d[_0x3e51('0x1d')],'transferercontext':_0x40b38d[_0x3e51('0x1e')],'transfererexten':_0x40b38d[_0x3e51('0x1f')],'transfererlinkedid':_0x40b38d[_0x3e51('0x20')],'context':_0x40b38d[_0x3e51('0x21')],'extension':_0x40b38d[_0x3e51('0x22')],'type':_0x3e51('0x7')});if(_[_0x3e51('0x23')](_0x40b38d['transfereechannel'])){_0x40b38d=_[_0x3e51('0x19')](_0x40b38d,{'transfereechannel':_0x40b38d['transfertargetchannel'],'transfereecalleridnum':_0x40b38d[_0x3e51('0x24')],'transfereecalleridname':_0x40b38d[_0x3e51('0x25')],'transfereeconnectedlinenum':_0x40b38d[_0x3e51('0x26')],'transfereeconnectedlinename':_0x40b38d[_0x3e51('0x27')],'transfereeaccountcode':_0x40b38d[_0x3e51('0x28')],'transfereecontext':_0x40b38d['transfertargetcontext'],'transfereeexten':_0x40b38d[_0x3e51('0x29')],'transfereelinkedid':_0x40b38d[_0x3e51('0x2a')]});}writeDB(_0x40b38d);}catch(_0xfb8ceb){utils['error'](util[_0x3e51('0x4')]('[%s][transfers][attendedtransfer]',_0x40b38d[_0x3e51('0x8')]),_0xfb8ceb);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e81eabe..018639a 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 _0x462b=['name','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','then','found','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal'];(function(_0x4dbdad,_0x594441){var _0x500d67=function(_0x2bce7e){while(--_0x2bce7e){_0x4dbdad['push'](_0x4dbdad['shift']());}};_0x500d67(++_0x594441);}(_0x462b,0x1da));var _0xb462=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x462b[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xb462('0x0'));var jayson=require(_0xb462('0x1'));var moment=require(_0xb462('0x2'));var util=require(_0xb462('0x3'));var client=jayson['client'][_0xb462('0x4')]({'port':0x2329});var logger=require(_0xb462('0x5'))(_0xb462('0x6'));exports['info']=function(_0x37f37a,_0x5757d0){logger[_0xb462('0x7')](_0x37f37a,_0x5757d0?util[_0xb462('0x8')](_0x5757d0,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0x9')]=function(_0x30182d,_0x3cb604){logger[_0xb462('0x9')](_0x30182d,_0x3cb604?util['inspect'](_0x3cb604,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0xa')]=function(_0x993ae0,_0x42f1cb){logger[_0xb462('0xa')](_0x993ae0,_0x42f1cb?util[_0xb462('0x8')](_0x42f1cb,{'showHidden':![],'depth':null}):'');};exports[_0xb462('0xb')]=function(_0x56ae49,_0x4fdaf9){return client[_0xb462('0xb')](_0x56ae49,{'body':_0x4fdaf9})['then'](function(_0x359d77){logger[_0xb462('0x9')](_0xb462('0xc'),_0x56ae49,_0x359d77?util[_0xb462('0x8')](_0x359d77,{'showHidden':![],'depth':null}):'');})[_0xb462('0xd')](function(_0x3e96c2){logger[_0xb462('0xa')](_0xb462('0xc'),_0x56ae49,_0x3e96c2?util[_0xb462('0x8')](_0x3e96c2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x14e6fc){return client['request'](_0xb462('0xe'),{'options':{'raw':!![],'attributes':['id',_0xb462('0xf'),_0xb462('0x10'),_0xb462('0x11')],'where':_0x14e6fc,'limit':0x1}})['then'](function(_0x337024){logger[_0xb462('0x9')](_0xb462('0x12'),JSON['stringify'](_0x14e6fc),_0x337024?util[_0xb462('0x8')](_0x337024,{'showHidden':![],'depth':null}):'');return _0x337024[_0xb462('0x13')][_0xb462('0x14')]?_0x337024[_0xb462('0x13')][0x0]:null;});}exports[_0xb462('0x15')]=function(_0x4b27fa){return new BPromise(function(_0x488554,_0x2dd2d9){if(_0x4b27fa){return getUser({'internal':_0x4b27fa})[_0xb462('0x16')](function(_0x2ac357){logger[_0xb462('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4b27fa,_0x2ac357?_0xb462('0x17'):'notfound');return _0x488554(_0x2ac357);})[_0xb462('0xd')](function(_0x284d70){logger[_0xb462('0xa')]('[utils][getUserByInternal]',_0x284d70?util[_0xb462('0x8')](_0x284d70,{'showHidden':![],'depth':null}):'');return _0x488554(null);});}return _0x488554(null);});};exports[_0xb462('0x18')]=function(_0x2bd501){return new BPromise(function(_0x2c93a5,_0x46abeb){if(_0x2bd501){return getUser({'interface':_0x2bd501})[_0xb462('0x16')](function(_0x16ba1c){logger[_0xb462('0x7')](_0xb462('0x19'),_0x2bd501,_0x16ba1c?_0xb462('0x17'):_0xb462('0x1a'));return _0x2c93a5(_0x16ba1c);})[_0xb462('0xd')](function(_0x17915a){logger[_0xb462('0xa')](_0xb462('0x1b'),_0x17915a?util[_0xb462('0x8')](_0x17915a,{'showHidden':![],'depth':null}):'');return _0x2c93a5(null);});}return _0x2c93a5(null);});};exports[_0xb462('0x1c')]=function(_0x2cf4c7){return new BPromise(function(_0xceea72,_0x146a5e){if(_0x2cf4c7){return getUser({'name':_0x2cf4c7})['then'](function(_0x1e6cee){logger['info'](_0xb462('0x1d'),_0x2cf4c7,_0x1e6cee?_0xb462('0x17'):'notfound');return _0xceea72(_0x1e6cee);})[_0xb462('0xd')](function(_0x28c34d){logger['error']('[utils][getUserByName]',_0x28c34d?util['inspect'](_0x28c34d,{'showHidden':![],'depth':null}):'');return _0xceea72(null);});}return _0xceea72(null);});};exports[_0xb462('0x1e')]=function(_0x2ddb7e){return new BPromise(function(_0x1b34e7,_0x32a3b4){if(_0x2ddb7e){return client[_0xb462('0xb')](_0xb462('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xb462('0x10'),_0xb462('0x20'),_0xb462('0x21'),'acwTimeout'],'where':{'name':_0x2ddb7e},'limit':0x1}})[_0xb462('0x16')](function(_0x1b2a5d){logger[_0xb462('0x9')](_0xb462('0x22'),_0x2ddb7e,_0x1b2a5d?util[_0xb462('0x8')](_0x1b2a5d,{'showHidden':![],'depth':null}):'');logger[_0xb462('0x7')](_0xb462('0x23'),_0x2ddb7e,_0x1b2a5d?'found':_0xb462('0x1a'));return _0x1b34e7(_0x1b2a5d[_0xb462('0x13')][_0xb462('0x14')]?_0x1b2a5d[_0xb462('0x13')][0x0]:null);})[_0xb462('0xd')](function(_0x4be8ed){logger[_0xb462('0xa')](_0xb462('0x24'),_0x4be8ed?util['inspect'](_0x4be8ed,{'showHidden':![],'depth':null}):'');return _0x1b34e7(null);});}return _0x1b34e7(null);});};exports[_0xb462('0x25')]=function(_0x39568e,_0x460d87){return moment(_0x39568e)[_0xb462('0x26')](_0x460d87,_0xb462('0x27'))['format'](_0xb462('0x28'));};exports[_0xb462('0x29')]=function(_0x540671,_0x481ea4){return moment(_0x540671)[_0xb462('0x2a')](_0x481ea4,_0xb462('0x27'))[_0xb462('0x2b')](_0xb462('0x28'));};exports[_0xb462('0x2c')]=function(_0xa413a5,_0x29bbc0){return moment(_0xa413a5)[_0xb462('0x2d')](moment(_0x29bbc0),_0xb462('0x27'));};exports[_0xb462('0x2e')]=function(_0x320ad2,_0x49911c){return parseInt(_0x320ad2,0xa)+parseInt(_0x49911c,0xa);};exports['now']=function(){return moment()[_0xb462('0x2b')](_0xb462('0x28'));};exports[_0xb462('0x2f')]=function(_0x3b8c8f,_0x5079a){if(_0x5079a){return moment(_0x3b8c8f)[_0xb462('0x2f')](_0x5079a);}return!![];};exports[_0xb462('0x30')]=function(_0x3f8a6f,_0x2af915){if(_0x2af915){return moment(_0x3f8a6f)[_0xb462('0x30')](_0x2af915);}else if(_0x3f8a6f){return!![];}return![];}; \ No newline at end of file +var _0x8110=['http','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','internal','then','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','[utils][getUserByInternal]','getUserByInterface','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','sumTime','now','isAfter','isBefore','jayson/promise'];(function(_0xbd8228,_0x312aed){var _0x3beddf=function(_0x5808ca){while(--_0x5808ca){_0xbd8228['push'](_0xbd8228['shift']());}};_0x3beddf(++_0x312aed);}(_0x8110,0x185));var _0x0811=function(_0x2024e7,_0x4dc480){_0x2024e7=_0x2024e7-0x0;var _0x917a34=_0x8110[_0x2024e7];return _0x917a34;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0811('0x0'));var moment=require('moment');var util=require('util');var client=jayson['client'][_0x0811('0x1')]({'port':0x2329});var logger=require('../../config/logger')(_0x0811('0x2'));exports[_0x0811('0x3')]=function(_0x424170,_0x419fd7){logger[_0x0811('0x3')](_0x424170,_0x419fd7?util['inspect'](_0x419fd7,{'showHidden':![],'depth':null}):'');};exports[_0x0811('0x4')]=function(_0x53b418,_0x39dcb1){logger[_0x0811('0x4')](_0x53b418,_0x39dcb1?util[_0x0811('0x5')](_0x39dcb1,{'showHidden':![],'depth':null}):'');};exports[_0x0811('0x6')]=function(_0x2d6ce6,_0x1504d6){logger[_0x0811('0x6')](_0x2d6ce6,_0x1504d6?util[_0x0811('0x5')](_0x1504d6,{'showHidden':![],'depth':null}):'');};exports[_0x0811('0x7')]=function(_0x37e502,_0x4aea9e){return client['request'](_0x37e502,{'body':_0x4aea9e})['then'](function(_0x186fd9){logger[_0x0811('0x4')]('[utils][request]\x20name:%s',_0x37e502,_0x186fd9?util[_0x0811('0x5')](_0x186fd9,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x220ec1){logger[_0x0811('0x6')](_0x0811('0x8'),_0x37e502,_0x220ec1?util[_0x0811('0x5')](_0x220ec1,{'showHidden':![],'depth':null}):'');});};function getUser(_0xb4ceed){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0811('0x9'),'name','interface'],'where':_0xb4ceed,'limit':0x1}})[_0x0811('0xa')](function(_0x4ca03c){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x0811('0xb')](_0xb4ceed),_0x4ca03c?util[_0x0811('0x5')](_0x4ca03c,{'showHidden':![],'depth':null}):'');return _0x4ca03c[_0x0811('0xc')][_0x0811('0xd')]?_0x4ca03c[_0x0811('0xc')][0x0]:null;});}exports['getUserByInternal']=function(_0xc6d4fd){return new BPromise(function(_0x3c1856,_0x3be019){if(_0xc6d4fd){return getUser({'internal':_0xc6d4fd})[_0x0811('0xa')](function(_0x4ac4ad){logger['info'](_0x0811('0xe'),_0xc6d4fd,_0x4ac4ad?_0x0811('0xf'):'notfound');return _0x3c1856(_0x4ac4ad);})[_0x0811('0x10')](function(_0x21bca4){logger[_0x0811('0x6')](_0x0811('0x11'),_0x21bca4?util['inspect'](_0x21bca4,{'showHidden':![],'depth':null}):'');return _0x3c1856(null);});}return _0x3c1856(null);});};exports[_0x0811('0x12')]=function(_0x43102f){return new BPromise(function(_0x7d3485,_0x3a0cf9){if(_0x43102f){return getUser({'interface':_0x43102f})[_0x0811('0xa')](function(_0x43c1a4){logger[_0x0811('0x3')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x43102f,_0x43c1a4?_0x0811('0xf'):_0x0811('0x13'));return _0x7d3485(_0x43c1a4);})['catch'](function(_0xc4b95c){logger[_0x0811('0x6')](_0x0811('0x14'),_0xc4b95c?util[_0x0811('0x5')](_0xc4b95c,{'showHidden':![],'depth':null}):'');return _0x7d3485(null);});}return _0x7d3485(null);});};exports['getUserByName']=function(_0x5031b6){return new BPromise(function(_0x6d74ac,_0x5cce2e){if(_0x5031b6){return getUser({'name':_0x5031b6})[_0x0811('0xa')](function(_0x4a740b){logger[_0x0811('0x3')](_0x0811('0x15'),_0x5031b6,_0x4a740b?_0x0811('0xf'):_0x0811('0x13'));return _0x6d74ac(_0x4a740b);})[_0x0811('0x10')](function(_0x158c5e){logger[_0x0811('0x6')]('[utils][getUserByName]',_0x158c5e?util[_0x0811('0x5')](_0x158c5e,{'showHidden':![],'depth':null}):'');return _0x6d74ac(null);});}return _0x6d74ac(null);});};exports[_0x0811('0x16')]=function(_0x3a190c){return new BPromise(function(_0x1f9f1e,_0x39af29){if(_0x3a190c){return client[_0x0811('0x7')](_0x0811('0x17'),{'options':{'raw':!![],'attributes':['id','name',_0x0811('0x18'),_0x0811('0x19'),_0x0811('0x1a')],'where':{'name':_0x3a190c},'limit':0x1}})['then'](function(_0x3cc6d1){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x3a190c,_0x3cc6d1?util['inspect'](_0x3cc6d1,{'showHidden':![],'depth':null}):'');logger[_0x0811('0x3')](_0x0811('0x1b'),_0x3a190c,_0x3cc6d1?'found':'notfound');return _0x1f9f1e(_0x3cc6d1[_0x0811('0xc')]['length']?_0x3cc6d1[_0x0811('0xc')][0x0]:null);})[_0x0811('0x10')](function(_0x5d1425){logger[_0x0811('0x6')](_0x0811('0x1c'),_0x5d1425?util[_0x0811('0x5')](_0x5d1425,{'showHidden':![],'depth':null}):'');return _0x1f9f1e(null);});}return _0x1f9f1e(null);});};exports['addTime']=function(_0x36414e,_0x2a9b0a){return moment(_0x36414e)[_0x0811('0x1d')](_0x2a9b0a,_0x0811('0x1e'))[_0x0811('0x1f')](_0x0811('0x20'));};exports[_0x0811('0x21')]=function(_0x2a6781,_0x309fbc){return moment(_0x2a6781)['subtract'](_0x309fbc,_0x0811('0x1e'))[_0x0811('0x1f')](_0x0811('0x20'));};exports['diffTime']=function(_0x4f9814,_0xfe3a9d){return moment(_0x4f9814)[_0x0811('0x22')](moment(_0xfe3a9d),_0x0811('0x1e'));};exports[_0x0811('0x23')]=function(_0x168d8f,_0x118d6b){return parseInt(_0x168d8f,0xa)+parseInt(_0x118d6b,0xa);};exports[_0x0811('0x24')]=function(){return moment()[_0x0811('0x1f')](_0x0811('0x20'));};exports[_0x0811('0x25')]=function(_0x37570e,_0x595442){if(_0x595442){return moment(_0x37570e)[_0x0811('0x25')](_0x595442);}return!![];};exports['isBefore']=function(_0x938d1f,_0x428fcc){if(_0x428fcc){return moment(_0x938d1f)[_0x0811('0x26')](_0x428fcc);}else if(_0x938d1f){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 e42755c..fbe3069 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 _0xed8b=['path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','log','join','role','ensureDir','then','client','catch','user','no-user','data','timestamp','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','name','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xed8b,0x86));var _0xbed8=function(_0x4b6393,_0x2ce649){_0x4b6393=_0x4b6393-0x0;var _0x3bc1a4=_0xed8b[_0x4b6393];return _0x3bc1a4;};var fs=require(_0xbed8('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0xbed8('0x1'));var util=require(_0xbed8('0x2'));var fileLogger=require('./loggers')[_0xbed8('0x3')];var safeTemplate=require(_0xbed8('0x4'))[_0xbed8('0x5')];var maskSensitiveData=require(_0xbed8('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x46502b(_0x2739a9){var _0x41a9f1=path['join'](_0xbed8('0x7'),_0xbed8('0x8'),'xcally');var _0x24a9a7=path[_0xbed8('0x9')]('client',_0x2739a9[_0xbed8('0xa')]+'-'+_0x2739a9['name']);return fs[_0xbed8('0xb')](path[_0xbed8('0x9')](_0x41a9f1,_0x24a9a7))[_0xbed8('0xc')](function(){var _0x4c0fec=fileLogger(_0xbed8('0xd'),path[_0xbed8('0x9')](_0x41a9f1,_0x24a9a7));return _0x4c0fec;})[_0xbed8('0xe')](function(_0x402505){throw _0x402505;});}this[_0xbed8('0x8')]=function(_0x211bda,_0x266279,_0x524310,_0x10da65){return _0x46502b(_0x211bda[_0xbed8('0xf')])[_0xbed8('0xc')](function(_0x40fb74){var _0x5ec4b2=_0x40fb74[_0x266279];return _0x5ec4b2;})[_0xbed8('0xc')](function(_0x9683e8){var _0x540375=_0x211bda[_0xbed8('0xf')]?_0x211bda['user']['id']:_0xbed8('0x10');var _0x2574b8=_0x10da65[_0xbed8('0x11')];var _0x1ebfb8=_0x10da65[_0xbed8('0x12')];var _0x3290f4=new Date(Number(_0x1ebfb8));return _0x9683e8(_0x540375,_0x3290f4,_0x524310,_0x2574b8);})[_0xbed8('0xe')](function(_0x210e37){fileLogger(_0xbed8('0xd'))['error'](_0x210e37);});};}function setupLoggers(_0xdcc7f0){return new Promise(function(_0x2f3c30){var _0x2755bb=new ClientSideLogger();var _0x36f523=fileLogger(_0xbed8('0x13'));var _0x47fec4=fileLogger(_0xbed8('0x14'));_0xdcc7f0['set'](_0xbed8('0x15'),_0x2755bb);_0xdcc7f0[_0xbed8('0x16')](ewinston[_0xbed8('0x17')]({'winstonInstance':_0x36f523,'meta':![],'statusLevels':!![],'msg':function(_0x46de85,_0xf6a3b0){var _0x22726a=_0xbed8('0x18');if(!_[_0xbed8('0x19')](_0x46de85[_0xbed8('0x1a')])){_0x22726a+=_0xbed8('0x1b');var _0x5789e7=_0x46de85[_0xbed8('0x1a')];maskSensitiveData(_0x5789e7);}return safeTemplate(util[_0xbed8('0x1c')](_0x22726a,_0x46de85[_0xbed8('0x1d')],_0x46de85['headers'][_0xbed8('0x1e')]?_0x46de85[_0xbed8('0x1f')]['x-forwarded-for']:_0x46de85['connection'][_0xbed8('0x20')]||_0x46de85['ip'],_0x46de85[_0xbed8('0x21')],_0xf6a3b0[_0xbed8('0x22')],_0xf6a3b0[_0xbed8('0x23')],_0x46de85['user']?_0x46de85[_0xbed8('0xf')]['id']:null,_0x46de85[_0xbed8('0xf')]?_0x46de85[_0xbed8('0xf')][_0xbed8('0x24')]:null,_0x46de85[_0xbed8('0xf')]?_0x46de85['user'][_0xbed8('0xa')]:null,_0x5789e7?util[_0xbed8('0x25')](_0x5789e7,![],null):''));}}));_0xdcc7f0[_0xbed8('0x16')](ewinston[_0xbed8('0x17')]({'winstonInstance':_0x47fec4,'meta':![],'statusLevels':!![],'msg':function(_0x49069f,_0x9e943){var _0x2b85d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x26')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x27')]){_0x2b85d=_0xbed8('0x28');}return util['format'](_0x2b85d,_0x49069f[_0xbed8('0x1d')],_0x49069f[_0xbed8('0x1f')][_0xbed8('0x1e')]?_0x49069f[_0xbed8('0x1f')][_0xbed8('0x1e')]:_0x49069f['connection'][_0xbed8('0x20')]||_0x49069f['ip'],_0x49069f['url'],_0x9e943['statusCode'],_0x9e943[_0xbed8('0x23')],_0x49069f[_0xbed8('0xf')]?_0x49069f['user']['id']:null,_0x49069f['user']?_0x49069f['user'][_0xbed8('0x24')]:null,_0x49069f[_0xbed8('0xf')]?_0x49069f[_0xbed8('0xf')]['role']:null,_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x26')]?_0x49069f['body'][_0xbed8('0x26')]:_0xbed8('0x29'),_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')]['agent_id']?_0x49069f[_0xbed8('0x1a')][_0xbed8('0x27')]:'',_0x49069f[_0xbed8('0x1a')]&&_0x49069f[_0xbed8('0x1a')][_0xbed8('0x2a')]?_0x49069f[_0xbed8('0x1a')][_0xbed8('0x2a')]:'');},'ignoreRoute':function(_0x59bca7){var _0x29ce1f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x29ce1f[_0xbed8('0x2b')](_0x59bca7[_0xbed8('0x21')]);}}));return _0x2f3c30();});}exports[_0xbed8('0x2c')]=setupLoggers; \ No newline at end of file +var _0xdec5=['express-winston','path','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','client','role','name','ensureDir','catch','user','then','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_id','agent_name','test','setupLoggers','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdec5,0x80));var _0x5dec=function(_0x13e456,_0x1a1d8b){_0x13e456=_0x13e456-0x0;var _0x144c05=_0xdec5[_0x13e456];return _0x144c05;};var fs=require('fs-extra');var _=require(_0x5dec('0x0'));var ewinston=require(_0x5dec('0x1'));var path=require(_0x5dec('0x2'));var util=require('util');var fileLogger=require('./loggers')[_0x5dec('0x3')];var safeTemplate=require(_0x5dec('0x4'))[_0x5dec('0x5')];var maskSensitiveData=require('./mask-sensitive-data')[_0x5dec('0x6')];function ClientSideLogger(){function _0x3cc8a8(_0xf244bc){var _0x3299de=path[_0x5dec('0x7')]('/var','log','xcally');var _0x1a1ed9=path[_0x5dec('0x7')](_0x5dec('0x8'),_0xf244bc[_0x5dec('0x9')]+'-'+_0xf244bc[_0x5dec('0xa')]);return fs[_0x5dec('0xb')](path[_0x5dec('0x7')](_0x3299de,_0x1a1ed9))['then'](function(){var _0x14ba55=fileLogger('client',path[_0x5dec('0x7')](_0x3299de,_0x1a1ed9));return _0x14ba55;})[_0x5dec('0xc')](function(_0x545997){throw _0x545997;});}this['log']=function(_0x3c38fe,_0x4d946e,_0x1287e2,_0xe0783d){return _0x3cc8a8(_0x3c38fe[_0x5dec('0xd')])['then'](function(_0x3bd640){var _0x441981=_0x3bd640[_0x4d946e];return _0x441981;})[_0x5dec('0xe')](function(_0x47c5f2){var _0x3b2a4f=_0x3c38fe['user']?_0x3c38fe['user']['id']:'no-user';var _0x4875d7=_0xe0783d['data'];var _0x5a8a39=_0xe0783d[_0x5dec('0xf')];var _0x195577=new Date(Number(_0x5a8a39));return _0x47c5f2(_0x3b2a4f,_0x195577,_0x1287e2,_0x4875d7);})[_0x5dec('0xc')](function(_0x189f9b){fileLogger(_0x5dec('0x8'))[_0x5dec('0x10')](_0x189f9b);});};}function setupLoggers(_0x365e65){return new Promise(function(_0xc95820){var _0xd672e0=new ClientSideLogger();var _0x52a2ec=fileLogger(_0x5dec('0x11'));var _0xa5819c=fileLogger(_0x5dec('0x12'));_0x365e65[_0x5dec('0x13')](_0x5dec('0x14'),_0xd672e0);_0x365e65[_0x5dec('0x15')](ewinston[_0x5dec('0x16')]({'winstonInstance':_0x52a2ec,'meta':![],'statusLevels':!![],'msg':function(_0x439c1c,_0x6c947a){var _0x324a49=_0x5dec('0x17');if(!_[_0x5dec('0x18')](_0x439c1c[_0x5dec('0x19')])){_0x324a49+=_0x5dec('0x1a');var _0x14c6cb=_0x439c1c[_0x5dec('0x19')];maskSensitiveData(_0x14c6cb);}return safeTemplate(util[_0x5dec('0x1b')](_0x324a49,_0x439c1c[_0x5dec('0x1c')],_0x439c1c[_0x5dec('0x1d')]['x-forwarded-for']?_0x439c1c['headers'][_0x5dec('0x1e')]:_0x439c1c[_0x5dec('0x1f')][_0x5dec('0x20')]||_0x439c1c['ip'],_0x439c1c[_0x5dec('0x21')],_0x6c947a[_0x5dec('0x22')],_0x6c947a[_0x5dec('0x23')],_0x439c1c[_0x5dec('0xd')]?_0x439c1c[_0x5dec('0xd')]['id']:null,_0x439c1c[_0x5dec('0xd')]?_0x439c1c[_0x5dec('0xd')][_0x5dec('0xa')]:null,_0x439c1c['user']?_0x439c1c['user'][_0x5dec('0x9')]:null,_0x14c6cb?util[_0x5dec('0x24')](_0x14c6cb,![],null):''));}}));_0x365e65[_0x5dec('0x15')](ewinston[_0x5dec('0x16')]({'winstonInstance':_0xa5819c,'meta':![],'statusLevels':!![],'msg':function(_0xb4ba93,_0x4a7894){var _0x20b0cc='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xb4ba93[_0x5dec('0x19')]&&_0xb4ba93['body'][_0x5dec('0x25')]&&_0xb4ba93[_0x5dec('0x19')]['agent_id']){_0x20b0cc=_0x5dec('0x26');}return util[_0x5dec('0x1b')](_0x20b0cc,_0xb4ba93[_0x5dec('0x1c')],_0xb4ba93[_0x5dec('0x1d')][_0x5dec('0x1e')]?_0xb4ba93[_0x5dec('0x1d')][_0x5dec('0x1e')]:_0xb4ba93[_0x5dec('0x1f')][_0x5dec('0x20')]||_0xb4ba93['ip'],_0xb4ba93[_0x5dec('0x21')],_0x4a7894[_0x5dec('0x22')],_0x4a7894[_0x5dec('0x23')],_0xb4ba93['user']?_0xb4ba93[_0x5dec('0xd')]['id']:null,_0xb4ba93[_0x5dec('0xd')]?_0xb4ba93[_0x5dec('0xd')][_0x5dec('0xa')]:null,_0xb4ba93[_0x5dec('0xd')]?_0xb4ba93['user'][_0x5dec('0x9')]:null,_0xb4ba93[_0x5dec('0x19')]&&_0xb4ba93[_0x5dec('0x19')][_0x5dec('0x25')]?_0xb4ba93[_0x5dec('0x19')][_0x5dec('0x25')]:'other',_0xb4ba93[_0x5dec('0x19')]&&_0xb4ba93[_0x5dec('0x19')][_0x5dec('0x27')]?_0xb4ba93[_0x5dec('0x19')]['agent_id']:'',_0xb4ba93[_0x5dec('0x19')]&&_0xb4ba93['body'][_0x5dec('0x28')]?_0xb4ba93['body'][_0x5dec('0x28')]:'');},'ignoreRoute':function(_0x1d0c35){var _0x1626ef=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1626ef[_0x5dec('0x29')](_0x1d0c35['url']);}}));return _0xc95820();});}exports[_0x5dec('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index d0199a1..820097c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45a7=['monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','endOf','day','isBetween','timeCompare','format','exports','dowCompare','date','max','min','domCompare','includes','monthCompare','guess','test','isMoment','split','padStart','length','lodash','moment-timezone','map','source','isValid','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval'];(function(_0x12a27b,_0x23b3e8){var _0x43502b=function(_0x22344e){while(--_0x22344e){_0x12a27b['push'](_0x12a27b['shift']());}};_0x43502b(++_0x23b3e8);}(_0x45a7,0x11d));var _0x745a=function(_0x5c1353,_0x328298){_0x5c1353=_0x5c1353-0x0;var _0x31e2e6=_0x45a7[_0x5c1353];return _0x31e2e6;};var _=require(_0x745a('0x0'));var moment=require(_0x745a('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x745a('0x2')](function(_0x39281d){return _0x39281d[_0x745a('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2966c9){if(!_0x2966c9[_0x745a('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xa72103){var _0x24ac4d=_0xa72103['split'](':')[_0x745a('0x2')](function(_0x59aa44){return parseInt(_0x59aa44,0xa);});var _0x59fe62=_0x24ac4d[0x0];var _0x59753c=_0x24ac4d[0x1];if(_0x59fe62<0x0||_0x59fe62>0x17||_0x59753c<0x0||_0x59753c>0x3b){throw new Error(EINVALID_DATE);}return[_0x59fe62,_0x59753c];}function circularDoWInterval(_0x1dd940,_0x43f160){if(_0x1dd940===_0x43f160){return[_0x1dd940];}else{var _0x2eeb77=moment[_0x745a('0x5')]();moment[_0x745a('0x5')]('en');var _0x24516b=moment[_0x745a('0x6')]()[_0x745a('0x2')](function(_0x1f6b7b){return _0x1f6b7b['toLowerCase']();});moment[_0x745a('0x5')](_0x2eeb77);var _0x1af996=_0x24516b[_0x745a('0x7')](_0x1dd940);var _0x4f12f0=_0x24516b[_0x745a('0x7')](_0x43f160);if(_0x4f12f0>_0x1af996){return _0x24516b[_0x745a('0x8')](_0x1af996,_0x4f12f0+0x1);}else{var _0x2fc80a=_0x24516b[_0x745a('0x8')](0x0,_0x4f12f0+0x1);var _0x2bec01=_0x24516b[_0x745a('0x8')](_0x1af996);return _0x2bec01[_0x745a('0x9')](_0x2fc80a);}}}module['exports'][_0x745a('0xa')]=circularDoWInterval;function circularMonthInterval(_0x27c2b1,_0x57dd8f){if(_0x27c2b1===_0x57dd8f){return[_0x27c2b1];}else{var _0x3fa6aa=moment[_0x745a('0x5')]();moment[_0x745a('0x5')]('en');var _0x24f310=moment[_0x745a('0xb')]()['map'](function(_0x15fadf){return _0x15fadf[_0x745a('0xc')]();});moment['locale'](_0x3fa6aa);var _0x382a8f=_0x24f310[_0x745a('0x7')](_0x27c2b1);var _0x274f6d=_0x24f310['indexOf'](_0x57dd8f);if(_0x274f6d>_0x382a8f){return _0x24f310['slice'](_0x382a8f,_0x274f6d+0x1);}else{var _0x8e3c6f=_0x24f310['slice'](0x0,_0x274f6d+0x1);var _0x209f31=_0x24f310['slice'](_0x382a8f);return _0x209f31[_0x745a('0x9')](_0x8e3c6f);}}}module['exports'][_0x745a('0xd')]=circularMonthInterval;function parseDom(_0x54f492){var _0x38d277=parseInt(_0x54f492,0xa);if(_0x38d277<0x1||_0x38d277>0x1f){throw new Error(EINVALID_DATE);}return _0x38d277;}function timeCompare(_0x25731f,_0x4f9f44,_0x592a55){var _0x38f810=_0x25731f[_0x745a('0xe')]();var _0x52ea63=extractTime(_0x4f9f44);var _0x28ec6d=_0x52ea63[0x0];var _0x2e5861=_0x52ea63[0x1];var _0x60821a=_0x25731f['clone']()[_0x745a('0xf')](_0x28ec6d)[_0x745a('0x10')](_0x2e5861);throwIfDateNotValid(_0x60821a);var _0x2b6142=extractTime(_0x592a55);var _0x17882f=_0x2b6142[0x0];var _0xcdf8c9=_0x2b6142[0x1];var _0x2843d1=_0x25731f[_0x745a('0xe')]()[_0x745a('0xf')](_0x17882f)[_0x745a('0x10')](_0xcdf8c9);throwIfDateNotValid(_0x2843d1);if(_0x2843d1[_0x745a('0x11')](_0x60821a)){var _0x5b67a6=_0x38f810[_0x745a('0xe')]()['startOf']('day');var _0x2dfb81=_0x38f810[_0x745a('0xe')]()[_0x745a('0x12')](_0x745a('0x13'));return _0x38f810[_0x745a('0x14')](_0x60821a,_0x2dfb81,undefined,'[]')||_0x38f810[_0x745a('0x14')](_0x5b67a6,_0x2843d1,undefined,'[]');}else{return _0x38f810[_0x745a('0x14')](_0x60821a,_0x2843d1,undefined,'[]');}}module['exports'][_0x745a('0x15')]=timeCompare;function dowCompare(_0x401a09,_0x1a3669,_0x5ae1ad){var _0x1d4433=_0x401a09[_0x745a('0x5')]('en')[_0x745a('0x16')]('ddd')['toLowerCase']();return circularDoWInterval(_0x1a3669,_0x5ae1ad)['includes'](_0x1d4433);}module[_0x745a('0x17')][_0x745a('0x18')]=dowCompare;function domCompare(_0x2cc93f,_0x7a1945,_0x813c3){var _0x1dcf1a=_0x2cc93f[_0x745a('0x19')]();if(_0x7a1945===_0x813c3){return _0x1dcf1a===_0x7a1945;}else{var _0x51b3b6=_0x2cc93f['daysInMonth']();var _0x569093=_0x7a1945<_0x813c3;let _0x422f47=![];var _0x59f68b=0x0;var _0x374449=0x0;if(_0x569093){_0x59f68b=Math[_0x745a('0x1a')](0x1,_0x7a1945);_0x374449=Math[_0x745a('0x1b')](_0x813c3,_0x51b3b6);_0x422f47=_0x1dcf1a>=_0x59f68b&&_0x1dcf1a<=_0x374449;}else{_0x59f68b=Math[_0x745a('0x1b')](_0x7a1945,_0x51b3b6);_0x374449=Math[_0x745a('0x1a')](0x1,_0x813c3);_0x422f47=_0x1dcf1a>=_0x59f68b||_0x1dcf1a<=_0x374449;}return _0x422f47;}}module['exports'][_0x745a('0x1c')]=domCompare;function monthCompare(_0xbbdbd8,_0x1f51bd,_0x708f94){var _0x53d370=_0xbbdbd8[_0x745a('0x5')]('en')[_0x745a('0x16')]('MMM')[_0x745a('0xc')]();return circularMonthInterval(_0x1f51bd,_0x708f94)[_0x745a('0x1d')](_0x53d370);}module[_0x745a('0x17')][_0x745a('0x1e')]=monthCompare;function iftime(_0x270fb2,_0x54068d=moment['tz'][_0x745a('0x1f')](),_0x533154=moment()){if(!validateRx[_0x745a('0x20')](_0x270fb2)){throw new Error(EINVALID_STRING);}else{var _0x1be643=(moment[_0x745a('0x21')](_0x533154)?_0x533154[_0x745a('0xe')]():moment(_0x533154))['tz'](_0x54068d)[_0x745a('0x5')]('en');throwIfDateNotValid(_0x1be643);var _0xd24b70=_0x270fb2[_0x745a('0x22')](',');var _0x3bc5b8=_0xd24b70[0x0];var _0x28550b=_0xd24b70[0x1];var _0xca163a=_0xd24b70[0x2];var _0x3e0083=_0xd24b70[0x3];let _0x619339=!![];if(_0x3bc5b8!=='*'){var _0xb5c13b=_0x3bc5b8[_0x745a('0x22')]('-');var _0x37330b=_[_0x745a('0x23')](_0xb5c13b[0x0],0x5,'0');var _0x3c05d5=_0xb5c13b[_0x745a('0x24')]===0x2?_['padStart'](_0xb5c13b[0x1],0x5,'0'):_0x37330b;_0x619339=timeCompare(_0x1be643,_0x37330b,_0x3c05d5);}let _0x556844=!![];if(_0x28550b!=='*'){var _0x2d1bd2=_0x28550b[_0x745a('0x22')]('-');var _0x553145=_0x2d1bd2[0x0];var _0x10d04d=_0x2d1bd2[_0x745a('0x24')]===0x2?_0x2d1bd2[0x1]:_0x553145;_0x556844=dowCompare(_0x1be643,_0x553145,_0x10d04d);}let _0x1924a5=!![];if(_0xca163a!=='*'){var _0x1eb91b=_0xca163a[_0x745a('0x22')]('-');var _0x3af768=parseDom(_0x1eb91b[0x0]);var _0x20a6e5=_0x1eb91b[_0x745a('0x24')]===0x2?parseDom(_0x1eb91b[0x1]):_0x3af768;_0x1924a5=domCompare(_0x1be643,_0x3af768,_0x20a6e5);}let _0x16ffeb=!![];if(_0x3e0083!=='*'){var _0x4147b2=_0x3e0083['split']('-');var _0x22fe3e=_0x4147b2[0x0];var _0x5b3eae=_0x4147b2[_0x745a('0x24')]===0x2?_0x4147b2[0x1]:_0x4147b2[0x0];_0x16ffeb=monthCompare(_0x1be643,_0x22fe3e,_0x5b3eae);}return _0x619339&&_0x556844&&_0x1924a5&&_0x16ffeb;}}module[_0x745a('0x17')]['iftime']=iftime; \ No newline at end of file +var _0x78a1=['join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','test','padStart','length','lodash','moment-timezone','map','source'];(function(_0xf923fa,_0x4bff61){var _0x143ee0=function(_0x15876b){while(--_0x15876b){_0xf923fa['push'](_0xf923fa['shift']());}};_0x143ee0(++_0x4bff61);}(_0x78a1,0xda));var _0x178a=function(_0x8895f1,_0xa1b1ca){_0x8895f1=_0x8895f1-0x0;var _0x3368af=_0x78a1[_0x8895f1];return _0x3368af;};var _=require(_0x178a('0x0'));var moment=require(_0x178a('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x178a('0x2')](function(_0x49d88b){return _0x49d88b[_0x178a('0x3')];})[_0x178a('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x178a('0x5');var EINVALID_DATE=_0x178a('0x6');function throwIfDateNotValid(_0x80ae55){if(!_0x80ae55[_0x178a('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1a1e1c){var _0x439f83=_0x1a1e1c[_0x178a('0x8')](':')['map'](function(_0x2977d9){return parseInt(_0x2977d9,0xa);});var _0x26335d=_0x439f83[0x0];var _0x4f592c=_0x439f83[0x1];if(_0x26335d<0x0||_0x26335d>0x17||_0x4f592c<0x0||_0x4f592c>0x3b){throw new Error(EINVALID_DATE);}return[_0x26335d,_0x4f592c];}function circularDoWInterval(_0x318c19,_0x53861d){if(_0x318c19===_0x53861d){return[_0x318c19];}else{var _0x328535=moment[_0x178a('0x9')]();moment[_0x178a('0x9')]('en');var _0x3348af=moment[_0x178a('0xa')]()[_0x178a('0x2')](function(_0x7442d2){return _0x7442d2[_0x178a('0xb')]();});moment[_0x178a('0x9')](_0x328535);var _0x19aace=_0x3348af[_0x178a('0xc')](_0x318c19);var _0x356772=_0x3348af[_0x178a('0xc')](_0x53861d);if(_0x356772>_0x19aace){return _0x3348af[_0x178a('0xd')](_0x19aace,_0x356772+0x1);}else{var _0x364fa0=_0x3348af['slice'](0x0,_0x356772+0x1);var _0x412fa5=_0x3348af[_0x178a('0xd')](_0x19aace);return _0x412fa5[_0x178a('0xe')](_0x364fa0);}}}module[_0x178a('0xf')][_0x178a('0x10')]=circularDoWInterval;function circularMonthInterval(_0x1ef2ad,_0x571dbc){if(_0x1ef2ad===_0x571dbc){return[_0x1ef2ad];}else{var _0x4e5746=moment[_0x178a('0x9')]();moment[_0x178a('0x9')]('en');var _0x5c80a9=moment['monthsShort']()[_0x178a('0x2')](function(_0x16cbc6){return _0x16cbc6['toLowerCase']();});moment[_0x178a('0x9')](_0x4e5746);var _0x113c94=_0x5c80a9[_0x178a('0xc')](_0x1ef2ad);var _0x41f376=_0x5c80a9[_0x178a('0xc')](_0x571dbc);if(_0x41f376>_0x113c94){return _0x5c80a9[_0x178a('0xd')](_0x113c94,_0x41f376+0x1);}else{var _0x583a15=_0x5c80a9['slice'](0x0,_0x41f376+0x1);var _0x36ff34=_0x5c80a9[_0x178a('0xd')](_0x113c94);return _0x36ff34[_0x178a('0xe')](_0x583a15);}}}module[_0x178a('0xf')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x25eb13){var _0x353644=parseInt(_0x25eb13,0xa);if(_0x353644<0x1||_0x353644>0x1f){throw new Error(EINVALID_DATE);}return _0x353644;}function timeCompare(_0x543895,_0x26f1df,_0x51cd8b){var _0x4ca6a7=_0x543895['clone']();var _0x4d2502=extractTime(_0x26f1df);var _0xd2d508=_0x4d2502[0x0];var _0xbd00f1=_0x4d2502[0x1];var _0x47e7e0=_0x543895[_0x178a('0x11')]()[_0x178a('0x12')](_0xd2d508)[_0x178a('0x13')](_0xbd00f1);throwIfDateNotValid(_0x47e7e0);var _0x47abf2=extractTime(_0x51cd8b);var _0x26314a=_0x47abf2[0x0];var _0x55f57a=_0x47abf2[0x1];var _0x35d0a=_0x543895['clone']()[_0x178a('0x12')](_0x26314a)[_0x178a('0x13')](_0x55f57a);throwIfDateNotValid(_0x35d0a);if(_0x35d0a['isBefore'](_0x47e7e0)){var _0x46f139=_0x4ca6a7[_0x178a('0x11')]()[_0x178a('0x14')](_0x178a('0x15'));var _0x317f81=_0x4ca6a7[_0x178a('0x11')]()[_0x178a('0x16')](_0x178a('0x15'));return _0x4ca6a7[_0x178a('0x17')](_0x47e7e0,_0x317f81,undefined,'[]')||_0x4ca6a7[_0x178a('0x17')](_0x46f139,_0x35d0a,undefined,'[]');}else{return _0x4ca6a7[_0x178a('0x17')](_0x47e7e0,_0x35d0a,undefined,'[]');}}module['exports'][_0x178a('0x18')]=timeCompare;function dowCompare(_0xbeefb8,_0x10ed63,_0x209e3c){var _0x492d45=_0xbeefb8[_0x178a('0x9')]('en')[_0x178a('0x19')]('ddd')[_0x178a('0xb')]();return circularDoWInterval(_0x10ed63,_0x209e3c)[_0x178a('0x1a')](_0x492d45);}module['exports'][_0x178a('0x1b')]=dowCompare;function domCompare(_0x1cd3d9,_0x56fa4,_0x2231da){var _0x54203d=_0x1cd3d9[_0x178a('0x1c')]();if(_0x56fa4===_0x2231da){return _0x54203d===_0x56fa4;}else{var _0x24c767=_0x1cd3d9[_0x178a('0x1d')]();var _0x32168d=_0x56fa4<_0x2231da;let _0x1f9beb=![];var _0x2e5b51=0x0;var _0x17a0a8=0x0;if(_0x32168d){_0x2e5b51=Math[_0x178a('0x1e')](0x1,_0x56fa4);_0x17a0a8=Math[_0x178a('0x1f')](_0x2231da,_0x24c767);_0x1f9beb=_0x54203d>=_0x2e5b51&&_0x54203d<=_0x17a0a8;}else{_0x2e5b51=Math[_0x178a('0x1f')](_0x56fa4,_0x24c767);_0x17a0a8=Math['max'](0x1,_0x2231da);_0x1f9beb=_0x54203d>=_0x2e5b51||_0x54203d<=_0x17a0a8;}return _0x1f9beb;}}module['exports'][_0x178a('0x20')]=domCompare;function monthCompare(_0x26f5d9,_0x43b486,_0x1b530d){var _0x71b5b5=_0x26f5d9[_0x178a('0x9')]('en')[_0x178a('0x19')]('MMM')['toLowerCase']();return circularMonthInterval(_0x43b486,_0x1b530d)['includes'](_0x71b5b5);}module['exports'][_0x178a('0x21')]=monthCompare;function iftime(_0x1541f9,_0x49ce39=moment['tz']['guess'](),_0x422c88=moment()){if(!validateRx[_0x178a('0x22')](_0x1541f9)){throw new Error(EINVALID_STRING);}else{var _0x1c332a=(moment['isMoment'](_0x422c88)?_0x422c88[_0x178a('0x11')]():moment(_0x422c88))['tz'](_0x49ce39)['locale']('en');throwIfDateNotValid(_0x1c332a);var _0x47234c=_0x1541f9[_0x178a('0x8')](',');var _0xfd63a4=_0x47234c[0x0];var _0x246e98=_0x47234c[0x1];var _0xcdaa89=_0x47234c[0x2];var _0x37dfab=_0x47234c[0x3];let _0x614e9=!![];if(_0xfd63a4!=='*'){var _0x42439b=_0xfd63a4[_0x178a('0x8')]('-');var _0x283503=_[_0x178a('0x23')](_0x42439b[0x0],0x5,'0');var _0x551d75=_0x42439b['length']===0x2?_['padStart'](_0x42439b[0x1],0x5,'0'):_0x283503;_0x614e9=timeCompare(_0x1c332a,_0x283503,_0x551d75);}let _0x3e3f2e=!![];if(_0x246e98!=='*'){var _0x59a609=_0x246e98[_0x178a('0x8')]('-');var _0x36895c=_0x59a609[0x0];var _0x1f64dd=_0x59a609['length']===0x2?_0x59a609[0x1]:_0x36895c;_0x3e3f2e=dowCompare(_0x1c332a,_0x36895c,_0x1f64dd);}let _0x33846f=!![];if(_0xcdaa89!=='*'){var _0x3580df=_0xcdaa89[_0x178a('0x8')]('-');var _0x31ff4d=parseDom(_0x3580df[0x0]);var _0x4940e6=_0x3580df['length']===0x2?parseDom(_0x3580df[0x1]):_0x31ff4d;_0x33846f=domCompare(_0x1c332a,_0x31ff4d,_0x4940e6);}let _0x11cf2d=!![];if(_0x37dfab!=='*'){var _0x46aa0a=_0x37dfab['split']('-');var _0x36547f=_0x46aa0a[0x0];var _0x53bcab=_0x46aa0a[_0x178a('0x24')]===0x2?_0x46aa0a[0x1]:_0x46aa0a[0x0];_0x11cf2d=monthCompare(_0x1c332a,_0x36547f,_0x53bcab);}return _0x614e9&&_0x3e3f2e&&_0x33846f&&_0x11cf2d;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 0cb1c1d..0a67453 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d5f=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d5f,0x196));var _0xf6d5=function(_0x16b6e8,_0x15aa2c){_0x16b6e8=_0x16b6e8-0x0;var _0x597954=_0x6d5f[_0x16b6e8];return _0x597954;};'use strict';var path=require(_0xf6d5('0x0'));var util=require(_0xf6d5('0x1'));var moment=require(_0xf6d5('0x2'));var winston=require(_0xf6d5('0x3'));var config=require(_0xf6d5('0x4'));var debugLevel=config[_0xf6d5('0x5')]?config[_0xf6d5('0x5')][_0xf6d5('0x6')]():_0xf6d5('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xf6d5('0x8'),'error':'red','warn':_0xf6d5('0x9'),'info':_0xf6d5('0xa'),'print':_0xf6d5('0xb'),'success':_0xf6d5('0xc'),'http':'gray','verbose':_0xf6d5('0xd'),'debug':_0xf6d5('0xe'),'silly':_0xf6d5('0xf')};winston[_0xf6d5('0x10')](XC_LOG_COLORS);function getLogFileName(_0x2c09a1,_0x4b51a5,_0x1c0429){var _0x3a939e=_0x2c09a1||_0xf6d5('0x11');return path[_0xf6d5('0x12')](_0x3a939e,util[_0xf6d5('0x13')](_0xf6d5('0x14'),_0x4b51a5,_0x1c0429));}function formatter(_0x365f52,_0x609cdd){_0x609cdd[_0xf6d5('0x15')]=_0x609cdd[_0xf6d5('0x15')][_0xf6d5('0x16')](/@@{/g,_0xf6d5('0x17'))[_0xf6d5('0x16')](/}@@/g,_0xf6d5('0x18'))[_0xf6d5('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xf6d5('0x13')](_0xf6d5('0x19'),moment()[_0xf6d5('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x609cdd[_0xf6d5('0x1a')][_0xf6d5('0x1b')](),_0x365f52,_0x609cdd['message']);}function fileFormat(_0x311f93,_0x4f24de){_0x4f24de[_0xf6d5('0x15')]=_0x4f24de[_0xf6d5('0x15')][_0xf6d5('0x16')](/@@{/g,_0xf6d5('0x17'))[_0xf6d5('0x16')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xf6d5('0x16')](/}@/g,'}}');var _0x569336=_0x4f24de['meta']&&Object[_0xf6d5('0x1c')](_0x4f24de[_0xf6d5('0x1d')])[_0xf6d5('0x1e')]?'\x0a\x09'+JSON[_0xf6d5('0x1f')](_0x4f24de[_0xf6d5('0x1d')]):'';return util[_0xf6d5('0x13')](_0xf6d5('0x20'),moment()['format'](_0xf6d5('0x21')),_0x4f24de[_0xf6d5('0x1a')]['toUpperCase'](),_0x311f93,_0x4f24de['message'],_0x569336);}function consoleLogger(){var _0x460e3c=new winston[(_0xf6d5('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d5('0x23'))][(_0xf6d5('0x24'))]({'level':_0xf6d5('0x25'),'json':![],'formatter':function(_0x5a61d8){return formatter('',_0x5a61d8);}})]});return _0x460e3c;}function fileLogger(_0x2d86e9,_0x59a632){var _0x40016b=new winston[(_0xf6d5('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d5('0x23'))][(_0xf6d5('0x26'))]({'name':util[_0xf6d5('0x13')](_0xf6d5('0x27'),_0x2d86e9,'error'),'filename':getLogFileName(_0x59a632,_0x2d86e9,_0xf6d5('0x28')),'level':_0xf6d5('0x28'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d34c7){return fileFormat(_0x2d86e9,_0x1d34c7);}}),new winston[(_0xf6d5('0x23'))]['File']({'name':util[_0xf6d5('0x13')](_0xf6d5('0x27'),_0x2d86e9,debugLevel),'filename':getLogFileName(_0x59a632,_0x2d86e9,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ac1e0){return fileFormat(_0x2d86e9,_0x5ac1e0);}}),new winston['transports'][(_0xf6d5('0x24'))]({'level':_0xf6d5('0x25'),'json':![],'formatter':function(_0x7fb9c9){return fileFormat(_0x2d86e9,_0x7fb9c9);}})]});return _0x40016b;}exports[_0xf6d5('0x29')]=consoleLogger;exports[_0xf6d5('0x2a')]=fileLogger; \ No newline at end of file +var _0xc90b=['stringify','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length'];(function(_0x5c67b2,_0x5b3cb2){var _0xc698fc=function(_0xfc58d3){while(--_0xfc58d3){_0x5c67b2['push'](_0x5c67b2['shift']());}};_0xc698fc(++_0x5b3cb2);}(_0xc90b,0x1c2));var _0xbc90=function(_0x416231,_0x2ed80e){_0x416231=_0x416231-0x0;var _0x4bf03f=_0xc90b[_0x416231];return _0x4bf03f;};'use strict';var path=require(_0xbc90('0x0'));var util=require('util');var moment=require(_0xbc90('0x1'));var winston=require(_0xbc90('0x2'));var config=require(_0xbc90('0x3'));var debugLevel=config[_0xbc90('0x4')]?config['debugLevel'][_0xbc90('0x5')]():_0xbc90('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':_0xbc90('0x7'),'error':_0xbc90('0x8'),'warn':'bold\x20yellow','info':_0xbc90('0x9'),'print':_0xbc90('0xa'),'success':_0xbc90('0xb'),'http':_0xbc90('0xc'),'verbose':'bold\x20magenta','debug':_0xbc90('0xd'),'silly':_0xbc90('0xe')};winston[_0xbc90('0xf')](XC_LOG_COLORS);function getLogFileName(_0x4393e6,_0x3d313c,_0x1f201b){var _0x3c86d7=_0x4393e6||_0xbc90('0x10');return path[_0xbc90('0x11')](_0x3c86d7,util[_0xbc90('0x12')](_0xbc90('0x13'),_0x3d313c,_0x1f201b));}function formatter(_0x2fae19,_0x55cb55){_0x55cb55[_0xbc90('0x14')]=_0x55cb55[_0xbc90('0x14')][_0xbc90('0x15')](/@@{/g,_0xbc90('0x16'))[_0xbc90('0x15')](/}@@/g,'}}}')[_0xbc90('0x15')](/@{/g,'{{')[_0xbc90('0x15')](/}@/g,'}}');return util[_0xbc90('0x12')](_0xbc90('0x17'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x55cb55[_0xbc90('0x18')][_0xbc90('0x19')](),_0x2fae19,_0x55cb55['message']);}function fileFormat(_0x45896d,_0x183379){_0x183379[_0xbc90('0x14')]=_0x183379[_0xbc90('0x14')]['replace'](/@@{/g,_0xbc90('0x16'))[_0xbc90('0x15')](/}@@/g,_0xbc90('0x1a'))[_0xbc90('0x15')](/@{/g,'{{')[_0xbc90('0x15')](/}@/g,'}}');var _0x12eb94=_0x183379[_0xbc90('0x1b')]&&Object[_0xbc90('0x1c')](_0x183379[_0xbc90('0x1b')])[_0xbc90('0x1d')]?'\x0a\x09'+JSON[_0xbc90('0x1e')](_0x183379['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xbc90('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x183379[_0xbc90('0x18')][_0xbc90('0x19')](),_0x45896d,_0x183379[_0xbc90('0x14')],_0x12eb94);}function consoleLogger(){var _0x4a5a09=new winston[(_0xbc90('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbc90('0x20'))][(_0xbc90('0x21'))]({'level':'warn','json':![],'formatter':function(_0x1de924){return formatter('',_0x1de924);}})]});return _0x4a5a09;}function fileLogger(_0x23ad25,_0x110bb9){var _0x3d9e6f=new winston[(_0xbc90('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xbc90('0x20'))][(_0xbc90('0x22'))]({'name':util[_0xbc90('0x12')](_0xbc90('0x23'),_0x23ad25,'error'),'filename':getLogFileName(_0x110bb9,_0x23ad25,_0xbc90('0x24')),'level':_0xbc90('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5eebbf){return fileFormat(_0x23ad25,_0x5eebbf);}}),new winston[(_0xbc90('0x20'))][(_0xbc90('0x22'))]({'name':util['format'](_0xbc90('0x23'),_0x23ad25,debugLevel),'filename':getLogFileName(_0x110bb9,_0x23ad25,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5845ec){return fileFormat(_0x23ad25,_0x5845ec);}}),new winston[(_0xbc90('0x20'))][(_0xbc90('0x21'))]({'level':_0xbc90('0x25'),'json':![],'formatter':function(_0x594533){return fileFormat(_0x23ad25,_0x594533);}})]});return _0x3d9e6f;}exports[_0xbc90('0x26')]=consoleLogger;exports[_0xbc90('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 203156e..2f00d11 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 _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x1eb72e,_0x177579){var _0x56d568=function(_0x151cf7){while(--_0x151cf7){_0x1eb72e['push'](_0x1eb72e['shift']());}};_0x56d568(++_0x177579);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x4072e1,_0x581421){var _0x4a4f05=function(_0x1c9314){while(--_0x1c9314){_0x4072e1['push'](_0x4072e1['shift']());}};_0x4a4f05(++_0x581421);}(_0x66fa,0x117));var _0xa66f=function(_0x293302,_0x4d4240){_0x293302=_0x293302-0x0;var _0x10c9a0=_0x66fa[_0x293302];return _0x10c9a0;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 88c2cc5..e6babfc 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 _0x13f6=['isArray','map','keys','reduce','lodash','string'];(function(_0x3d1b7d,_0x4ae2d5){var _0x3cb35e=function(_0x2fdf5d){while(--_0x2fdf5d){_0x3d1b7d['push'](_0x3d1b7d['shift']());}};_0x3cb35e(++_0x4ae2d5);}(_0x13f6,0x124));var _0x613f=function(_0x20d919,_0x106eb9){_0x20d919=_0x20d919-0x0;var _0x2726b0=_0x13f6[_0x20d919];return _0x2726b0;};var _=require(_0x613f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1844a4){return _0x1844a4==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0xd04cfd){var _0x13b50a=_0xd04cfd;if(typeof _0xd04cfd===_0x613f('0x1')){_0x13b50a=_0xd04cfd['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x613f('0x2')](_0xd04cfd)){_0x13b50a=_0xd04cfd[_0x613f('0x3')](function(_0x20af2f){return safeTemplate(_0x20af2f);});}else if(_['isPlainObject'](_0xd04cfd)){_0x13b50a=Object[_0x613f('0x4')](_0xd04cfd)[_0x613f('0x5')](function(_0x5618fa,_0x4b546b){_0x5618fa[_0x4b546b]=safeTemplate(_0xd04cfd[_0x4b546b]);return _0x5618fa;},{});}return _0x13b50a;}module['exports']['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x11237c,_0x4b38b5){var _0x5d8adf=function(_0x17a793){while(--_0x17a793){_0x11237c['push'](_0x11237c['shift']());}};_0x5d8adf(++_0x4b38b5);}(_0x1a85,0x178));var _0x51a8=function(_0x2a50f7,_0x4c5ed1){_0x2a50f7=_0x2a50f7-0x0;var _0x5123ec=_0x1a85[_0x2a50f7];return _0x5123ec;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x54a0db){return _0x54a0db==='{{'?_0x51a8('0x0'):_0x51a8('0x1');}function safeTemplate(_0x43e22a){var _0x498466=_0x43e22a;if(typeof _0x43e22a==='string'){_0x498466=_0x43e22a[_0x51a8('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x51a8('0x3')](_0x43e22a)){_0x498466=_0x43e22a[_0x51a8('0x4')](function(_0x48a21b){return safeTemplate(_0x48a21b);});}else if(_[_0x51a8('0x5')](_0x43e22a)){_0x498466=Object['keys'](_0x43e22a)[_0x51a8('0x6')](function(_0x5cf430,_0x331117){_0x5cf430[_0x331117]=safeTemplate(_0x43e22a[_0x331117]);return _0x5cf430;},{});}return _0x498466;}module[_0x51a8('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index b969da9..a5384c9 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5a0=['then','updated','info','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','legacy-libs','isArray','apps','name','env','NODE_PATH','pathExists'];(function(_0x5c619e,_0x1bccdf){var _0x445cf8=function(_0x2eaa64){while(--_0x2eaa64){_0x5c619e['push'](_0x5c619e['shift']());}};_0x445cf8(++_0x1bccdf);}(_0xf5a0,0x1d0));var _0x0f5a=function(_0x2deed4,_0x2793e8){_0x2deed4=_0x2deed4-0x0;var _0xfb91f4=_0xf5a0[_0x2deed4];return _0xfb91f4;};var fs=require(_0x0f5a('0x0'));var path=require(_0x0f5a('0x1'));var config=require(_0x0f5a('0x2'));var root=config[_0x0f5a('0x3')];var APP_JSON_PATH=path[_0x0f5a('0x4')](root,'server/app.json');var NODEPATH=path[_0x0f5a('0x4')](root,_0x0f5a('0x5'));function setLegacyLibsNodeEnvPath(_0x5c1ce6){let _0x123308=![];if(Array[_0x0f5a('0x6')](_0x5c1ce6[_0x0f5a('0x7')])){var _0x3c0fb7=_0x5c1ce6[_0x0f5a('0x7')]['findIndex'](function(_0x284fee){return _0x284fee[_0x0f5a('0x8')]==='motion2';});if(_0x3c0fb7>-0x1){var _0x4f684b=_0x5c1ce6[_0x0f5a('0x7')][_0x3c0fb7];if(typeof _0x4f684b[_0x0f5a('0x9')][_0x0f5a('0xa')]!=='string'){_0x4f684b[_0x0f5a('0x9')][_0x0f5a('0xa')]=NODEPATH;_0x123308=!![];}}return{'appConfig':_0x5c1ce6,'updated':_0x123308};}}function updateAppConfig(_0x227854){return fs[_0x0f5a('0xb')](APP_JSON_PATH)[_0x0f5a('0xc')](function(_0x4b71d2){if(_0x4b71d2){return fs['readJSON'](APP_JSON_PATH)[_0x0f5a('0xc')](function(_0x12f41a){var _0x29c600=setLegacyLibsNodeEnvPath(_0x12f41a);if(_0x29c600[_0x0f5a('0xd')]){_0x227854[_0x0f5a('0xe')]('Updating\x20app.json');return fs[_0x0f5a('0xf')](APP_JSON_PATH,_0x12f41a,{'spaces':0x2});}else{return Promise[_0x0f5a('0x4')]();}});}else{return Promise[_0x0f5a('0x4')]();}});}module[_0x0f5a('0x10')]=updateAppConfig; \ No newline at end of file +var _0xa260=['then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists','readJSON'];(function(_0x4ae615,_0x337956){var _0x54887f=function(_0x3f61ee){while(--_0x3f61ee){_0x4ae615['push'](_0x4ae615['shift']());}};_0x54887f(++_0x337956);}(_0xa260,0x117));var _0x0a26=function(_0x42ee96,_0x2f26ed){_0x42ee96=_0x42ee96-0x0;var _0x467fdc=_0xa260[_0x42ee96];return _0x467fdc;};var fs=require(_0x0a26('0x0'));var path=require('path');var config=require(_0x0a26('0x1'));var root=config[_0x0a26('0x2')];var APP_JSON_PATH=path[_0x0a26('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x0a26('0x4'));function setLegacyLibsNodeEnvPath(_0x33cffd){let _0x1daba0=![];if(Array[_0x0a26('0x5')](_0x33cffd['apps'])){var _0x257d2b=_0x33cffd[_0x0a26('0x6')][_0x0a26('0x7')](function(_0x4cf329){return _0x4cf329[_0x0a26('0x8')]===_0x0a26('0x9');});if(_0x257d2b>-0x1){var _0xc8080e=_0x33cffd[_0x0a26('0x6')][_0x257d2b];if(typeof _0xc8080e['env'][_0x0a26('0xa')]!==_0x0a26('0xb')){_0xc8080e[_0x0a26('0xc')][_0x0a26('0xa')]=NODEPATH;_0x1daba0=!![];}}return{'appConfig':_0x33cffd,'updated':_0x1daba0};}}function updateAppConfig(_0x4b765f){return fs[_0x0a26('0xd')](APP_JSON_PATH)['then'](function(_0x4fb35f){if(_0x4fb35f){return fs[_0x0a26('0xe')](APP_JSON_PATH)[_0x0a26('0xf')](function(_0x325cf5){var _0x3ba193=setLegacyLibsNodeEnvPath(_0x325cf5);if(_0x3ba193[_0x0a26('0x10')]){_0x4b765f[_0x0a26('0x11')](_0x0a26('0x12'));return fs[_0x0a26('0x13')](APP_JSON_PATH,_0x325cf5,{'spaces':0x2});}else{return Promise[_0x0a26('0x3')]();}});}else{return Promise[_0x0a26('0x3')]();}});}module[_0x0a26('0x14')]=updateAppConfig; \ No newline at end of file